diff -Naur tomato/release/src/router/snmp/acconfig.h tomato121/release/src/router/snmp/acconfig.h
--- tomato/release/src/router/snmp/acconfig.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/acconfig.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,622 @@
+#ifndef NET_SNMP_CONFIG_H
+#define NET_SNMP_CONFIG_H
+
+/* config.h:  a general config file */
+
+/* Default (SNMP) version number for the tools to use */
+#define DEFAULT_SNMP_VERSION 3
+
+/* don't change these values! */
+#define SNMPV1      0xAAAA       /* readable by anyone */
+#define SNMPV2ANY   0xA000       /* V2 Any type (includes NoAuth) */
+#define SNMPV2AUTH  0x8000       /* V2 Authenticated requests only */
+
+/* default list of mibs to load */
+
+#define DEFAULT_MIBS "IP-MIB:IF-MIB:TCP-MIB:UDP-MIB:SNMPv2-MIB:RFC1213-MIB"
+
+/* default location to look for mibs to load using the above tokens
+   and/or those in the MIBS envrionment variable*/
+
+#undef DEFAULT_MIBDIRS
+
+/* default mib files to load, specified by path. */
+
+#undef DEFAULT_MIBFILES
+
+/* should we compile to use special opaque types: float, double,
+   counter64, i64, ui64, union? */
+#undef OPAQUE_SPECIAL_TYPES
+
+/* comment the next line if you are compiling with libsnmp.h 
+   and are not using the UC-Davis SNMP library. */
+#define UCD_SNMP_LIBRARY 1
+
+/* define if you want to compile support for both authentication and
+   privacy support. */
+#undef SCAPI_AUTHPRIV
+
+/* define if you are using the MD5 code ...*/
+#undef USE_INTERNAL_MD5
+
+/* add in recent CMU library extensions (not complete) */
+#undef CMU_COMPATIBLE
+
+/* add in recent resource lock functions (not complete) */
+#undef _REENTRANT
+
+/* debugging stuff */
+#undef SNMP_NO_DEBUGGING           /* if defined, we optimize the code
+                                      to exclude all debugging calls. */
+#define SNMP_ALWAYS_DEBUG 0        /* Always print debugging information and
+                                      ignore the -D flag passed to the cmds */
+
+/* reverse encoding BER packets is both faster and more efficient in space. */
+#define USE_REVERSE_ASNENCODING       1
+#define DEFAULT_ASNENCODING_DIRECTION 1 /* 1 = reverse, 0 = forwards */
+
+/* PERSISTENT_DIRECTORY: If defined, the library is capabile of saving
+   persisant information to this directory in the form of configuration
+   lines: PERSISTENT_DIRECTORY/NAME.persistent.conf */
+#define PERSISTENT_DIRECTORY "/var/snmp"
+
+/* PERSISTENT_MASK: the umask permissions to set up the persistent files with */
+#define PERSISTENT_MASK 077
+
+/* AGENT_DIRECTORY_MODE: the mode the agents should use to create
+   directories with. Since the data stored here is probably sensitive, it
+   probably should be read-only by root/administrator. */
+#define AGENT_DIRECTORY_MODE 0700
+
+/* MAX_PERSISTENT_BACKUPS:
+ *   The maximum number of persistent backups the library will try to
+ *   read from the persistent cache directory.  If an application fails to
+ *   close down successfully more than this number of times, data will be lost.
+ */
+#define MAX_PERSISTENT_BACKUPS 10
+
+@TOP@
+
+/* define if you are embedding perl in the main agent */
+#undef NETSNMP_EMBEDDED_PERL
+
+/* define the system type include file here */
+#define SYSTEM_INCLUDE_FILE <net-snmp/system/generic.h>
+
+/* define the machine (cpu) type include file here */
+#define MACHINE_INCLUDE_FILE <net-snmp/machine/generic.h>
+
+/* SNMPLIBDIR contains important files */
+
+#undef SNMPLIBPATH
+#undef SNMPSHAREPATH
+#undef SNMPCONFPATH
+#undef SNMPDLMODPATH
+
+/* LOGFILE:  If defined it closes stdout/err/in and opens this in out/err's
+   place.  (stdin is closed so that sh scripts won't wait for it) */
+
+#undef LOGFILE
+
+/* default system contact */
+#undef SYS_CONTACT
+
+/* system location */
+#undef SYS_LOC
+
+/* Use libwrap to handle allow/deny hosts? */
+#undef USE_LIBWRAP
+
+/* Use dmalloc to do malloc debugging? */
+#undef HAVE_DMALLOC_H
+
+/* location of UNIX kernel */
+#define KERNEL_LOC "/vmunix"
+
+/* location of mount table list */
+#define ETC_MNTTAB "/etc/mnttab"
+
+/* location of swap device (ok if not found) */
+#undef DMEM_LOC
+
+/* Command to generate ps output, the final column must be the process
+   name withOUT arguments */
+
+#define PSCMD "/bin/ps"
+
+/* Where is the uname command */
+#define UNAMEPROG "/bin/uname"
+
+/* testing code sections. */
+#undef SNMP_TESTING_CODE 
+
+/* If you don't have root access don't exit upon kmem errors */
+#undef NO_ROOT_ACCESS
+
+/* If we don't want to use kmem. */
+#undef NO_KMEM_USAGE
+
+/* If you don't want the agent to report on variables it doesn't have data for */
+#undef NO_DUMMY_VALUES
+
+/* Define if statfs takes 2 args and the second argument has
+   type struct fs_data. [Ultrix] */
+#undef STAT_STATFS_FS_DATA
+
+/* Define if the TCP timer constants in <netinet/tcp_timer.h>
+   depend on the integer variable `hz'.  [FreeBSD 4.x] */
+#undef TCPTV_NEEDS_HZ
+
+@BOTTOM@
+
+/* define if you have getdevs() */
+#undef HAVE_GETDEVS
+
+/* define if you have <netinet/in_pcb.h> */
+#undef HAVE_NETINET_IN_PCB_H
+
+/* define if you have <sys/disklabel.h> */
+#undef HAVE_SYS_DISKLABEL_H
+
+/* define if you are using linux and /proc/net/dev has the compressed
+   field, which exists in linux kernels 2.2 and greater. */
+#undef PROC_NET_DEV_HAS_COMPRESSED
+
+/* define rtentry to ortentry on SYSV machines (alphas) */
+#undef RTENTRY
+
+/* Use BSD 4.4 routing table entries? */
+#undef RTENTRY_4_4
+
+/* Does struct sigaction have a sa_sigaction field? */
+#undef STRUCT_SIGACTION_HAS_SA_SIGACTION
+
+/* Does struct sockaddr have a sa_len field? */
+#undef STRUCT_SOCKADDR_HAS_SA_LEN
+
+/* Does struct sockaddr have a sa_family2 field? */
+#undef STRUCT_SOCKADDR_HAS_SA_UNION_SA_GENERIC_SA_FAMILY2
+
+/* rtentry structure tests */
+#undef RTENTRY_RT_NEXT
+#undef STRUCT_RTENTRY_HAS_RT_DST
+#undef STRUCT_RTENTRY_HAS_RT_UNIT
+#undef STRUCT_RTENTRY_HAS_RT_USE
+#undef STRUCT_RTENTRY_HAS_RT_REFCNT
+#undef STRUCT_RTENTRY_HAS_RT_HASH
+
+/* ifnet structure tests */
+#undef STRUCT_IFNET_HAS_IF_BAUDRATE
+#undef STRUCT_IFNET_HAS_IF_BAUDRATE_IFS_VALUE
+#undef STRUCT_IFNET_HAS_IF_SPEED
+#undef STRUCT_IFNET_HAS_IF_TYPE
+#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_NOPROTO
+#undef STRUCT_IFNET_HAS_IF_OMCASTS
+#undef STRUCT_IFNET_HAS_IF_XNAME
+#undef STRUCT_IFNET_HAS_IF_OBYTES
+#undef STRUCT_IFNET_HAS_IF_IBYTES
+#undef STRUCT_IFNET_HAS_IF_ADDRLIST
+
+/* tcpstat.tcps_rcvmemdrop */
+#undef STRUCT_TCPSTAT_HAS_TCPS_RCVMEMDROP
+
+/* udpstat.udps_discard */
+#undef STRUCT_UDPSTAT_HAS_UDPS_DISCARD
+
+/* udpstat.udps_discard */
+#undef STRUCT_UDPSTAT_HAS_UDPS_NOPORT
+
+/* udpstat.udps_discard */
+#undef STRUCT_UDPSTAT_HAS_UDPS_NOPORTBCAST
+
+/* udpstat.udps_discard */
+#undef STRUCT_UDPSTAT_HAS_UDPS_FULLSOCK
+
+/* arphd.at_next */
+#undef STRUCT_ARPHD_HAS_AT_NEXT
+
+/* ifaddr.ifa_next */
+#undef STRUCT_IFADDR_HAS_IFA_NEXT
+
+/* ifnet.if_mtu */
+#undef STRUCT_IFNET_HAS_IF_MTU
+
+/* swdevt.sw_nblksenabled */
+#undef STRUCT_SWDEVT_HAS_SW_NBLKSENABLED
+
+/* nlist.n_value */
+#undef STRUCT_NLIST_HAS_N_VALUE
+
+/* ipstat structure tests */
+#undef STRUCT_IPSTAT_HAS_IPS_CANTFORWARD
+#undef STRUCT_IPSTAT_HAS_IPS_CANTFRAG
+#undef STRUCT_IPSTAT_HAS_IPS_DELIVERED
+#undef STRUCT_IPSTAT_HAS_IPS_FRAGDROPPED
+#undef STRUCT_IPSTAT_HAS_IPS_FRAGTIMEOUT
+#undef STRUCT_IPSTAT_HAS_IPS_LOCALOUT
+#undef STRUCT_IPSTAT_HAS_IPS_NOPROTO
+#undef STRUCT_IPSTAT_HAS_IPS_NOROUTE
+#undef STRUCT_IPSTAT_HAS_IPS_ODROPPED
+#undef STRUCT_IPSTAT_HAS_IPS_OFRAGMENTS
+#undef STRUCT_IPSTAT_HAS_IPS_REASSEMBLED
+
+/* vfsstat.f_frsize */
+#undef STRUCT_STATVFS_HAS_F_FRSIZE
+
+/* vfsstat.f_files */
+#undef STRUCT_STATVFS_HAS_F_FILES
+
+/* statfs inode structure tests*/
+#undef STRUCT_STATFS_HAS_F_FILES
+#undef STRUCT_STATFS_HAS_F_FFREE
+#undef STRUCT_STATFS_HAS_F_FAVAIL
+
+/* des_ks_struct.weak_key */
+#undef STRUCT_DES_KS_STRUCT_HAS_WEAK_KEY
+
+/* ifnet needs to have _KERNEL defined */
+#undef IFNET_NEEDS_KERNEL
+
+/* sysctl works to get boottime, etc... */
+#undef CAN_USE_SYSCTL
+
+/* type check for in_addr_t */
+#undef in_addr_t
+
+/* define if SIOCGIFADDR exists in sys/ioctl.h */
+#undef SYS_IOCTL_H_HAS_SIOCGIFADDR
+
+/* define if your compiler (processor) defines __FUNCTION__ for you */
+#undef HAVE_CPP_UNDERBAR_FUNCTION_DEFINED
+
+/* Mib-2 tree Info */
+/* These are the system information variables. */
+
+#define VERS_DESC   "unknown"             /* overridden at run time */
+#define SYS_NAME    "unknown"             /* overridden at run time */
+
+/* comment out the second define to turn off functionality for any of
+   these: (See README for details) */
+
+/*   proc PROCESSNAME [MAX] [MIN] */
+#define PROCMIBNUM 2
+
+/*   exec/shell NAME COMMAND      */
+#define SHELLMIBNUM 8
+
+/*   swap MIN                     */
+#define MEMMIBNUM 4
+
+/*   disk DISK MINSIZE            */
+#define DISKMIBNUM 9
+
+/*   load 1 5 15                  */
+#define LOADAVEMIBNUM 10
+
+/* which version are you using? This mibloc will tell you */
+#define VERSIONMIBNUM 100
+
+/* Reports errors the agent runs into */
+/* (typically its "can't fork, no mem" problems) */
+#define ERRORMIBNUM 101
+
+/* The sub id of EXTENSIBLEMIB returned to queries of
+   .iso.org.dod.internet.mgmt.mib-2.system.sysObjectID.0 */
+#define AGENTID 250
+
+/* This ID is returned after the AGENTID above.  IE, the resulting
+   value returned by a query to sysObjectID is
+   EXTENSIBLEMIB.AGENTID.???, where ??? is defined below by OSTYPE */
+
+#define HPUX9ID 1
+#define SUNOS4ID 2 
+#define SOLARISID 3
+#define OSFID 4
+#define ULTRIXID 5
+#define HPUX10ID 6
+#define NETBSD1ID 7
+#define FREEBSDID 8
+#define IRIXID 9
+#define LINUXID 10
+#define BSDIID 11
+#define OPENBSDID 12
+#define WIN32ID 13
+#define HPUX11ID 14
+#define UNKNOWNID 255
+
+#ifdef hpux9
+#define OSTYPE HPUX9ID
+#endif
+#ifdef hpux10
+#define OSTYPE HPUX10ID
+#endif
+#ifdef hpux11
+#define OSTYPE HPUX11ID
+#endif
+#ifdef sunos4
+#define OSTYPE SUNOS4ID
+#endif
+#ifdef solaris2
+#define OSTYPE SOLARISID
+#endif
+#if defined(osf3) || defined(osf4)
+#define OSTYPE OSFID
+#endif
+#ifdef ultrix4
+#define OSTYPE ULTRIXID
+#endif
+#ifdef netbsd1
+#define OSTYPE NETBSD1ID
+#endif
+#ifdef freebsd2
+#define OSTYPE FREEBSDID
+#endif
+#if defined(irix6) || defined(irix5)
+#define OSTYPE IRIXID
+#endif
+#ifdef linux
+#define OSTYPE LINUXID
+#endif
+#if defined(bsdi2) || defined(bsdi3) || defined(bsdi4)
+#define OSTYPE BSDIID
+#endif
+#ifdef openbsd2
+#define OSTYPE OPENBSDID
+#endif
+/* unknown */
+#ifndef OSTYPE
+#define OSTYPE UNKNOWNID
+#endif
+
+/* The enterprise number has been assigned by the IANA group.   */
+/* Optionally, this may point to the location in the tree your  */
+/* company/organization has been allocated.                     */
+/* The assigned enterprise number for the NET_SNMP MIB modules. */
+#define ENTERPRISE_OID			8072
+#define ENTERPRISE_MIB			1,3,6,1,4,1,8072
+#define ENTERPRISE_DOT_MIB		1.3.6.1.4.1.8072
+#define ENTERPRISE_DOT_MIB_LENGTH	7
+
+/* The assigned enterprise number for sysObjectID. */
+#define SYSTEM_MIB		1,3,6,1,4,1,8072,3,2,OSTYPE
+#define SYSTEM_DOT_MIB		1.3.6.1.4.1.8072.3.2.OSTYPE
+#define SYSTEM_DOT_MIB_LENGTH	10
+
+/* The assigned enterprise number for notifications. */
+#define NOTIFICATION_MIB		1,3,6,1,4,1,8072,4
+#define NOTIFICATION_DOT_MIB		1.3.6.1.4.1.8072.4
+#define NOTIFICATION_DOT_MIB_LENGTH	8
+
+/* this is the location of the ucdavis mib tree.  It shouldn't be
+   changed, as the places it is used are expected to be constant
+   values or are directly tied to the UCD-SNMP-MIB. */
+#define UCDAVIS_OID		2021
+#define UCDAVIS_MIB		1,3,6,1,4,1,2021
+#define UCDAVIS_DOT_MIB		1.3.6.1.4.1.2021
+#define UCDAVIS_DOT_MIB_LENGTH	7
+
+/* how long to wait (seconds) for error querys before reseting the error trap.*/
+#define ERRORTIMELENGTH 600 
+
+/* Exec command to fix PROC problems */
+/* %s will be replaced by the process name in error */
+
+/* #define PROCFIXCMD "/usr/bin/perl /local/scripts/fixproc %s" */
+
+/* Exec command to fix EXEC problems */
+/* %s will be replaced by the exec/script name in error */
+
+/* #define EXECFIXCMD "/usr/bin/perl /local/scripts/fixproc %s" */
+
+/* Should exec output Cashing be used (speeds up things greatly), and
+   if so, After how many seconds should the cache re-newed?  Note:
+   Don't define CASHETIME to disable cashing completely */
+
+#define EXCACHETIME 30
+#define CACHEFILE ".snmp-exec-cache"
+#define MAXCACHESIZE (200*80)   /* roughly 200 lines max */
+
+#define MAXDISKS 50                      /* can't scan more than this number */
+
+/* misc defaults */
+
+/* default of 100 meg minimum if the minimum size is not specified in
+   the config file */
+#define DEFDISKMINIMUMSPACE 100000
+
+#define DEFMAXLOADAVE 12.0      /* default maximum load average before error */
+
+#define MAXREADCOUNT 100   /* max times to loop reading output from
+                              execs.  Because of sleep(1)s, this will also
+                              be time to wait (in seconds) for exec to finish */
+
+#define SNMPBLOCK 1       /* Set to 1 if you want snmpgets to block and never
+                             timeout.  Original CMU code had this
+                             hardcoded into the code as = 1 */
+
+#define RESTARTSLEEP 5    /* How long to wait after a snmpset to
+                             EXTENSIBLEMIB.VERSIONMIBNUM.VERRESTARTAGENT
+                             before restarting the agent.  This is
+                             necessary to finish the snmpset reply
+                             before restarting. */
+
+/* Number of community strings to store */
+#define NUM_COMMUNITIES	5
+
+/* UNdefine to allow specifying zero-length community string */
+/* #define NO_ZEROLENGTH_COMMUNITY 1 */
+
+/* #define EXIT_ON_BAD_KLREAD  */
+/* define to exit the agent on a bad kernel read */
+
+#define LASTFIELD -1      /* internal define */
+
+/* configure options specified */
+#define CONFIGURE_OPTIONS ""
+
+/* got socklen_t? */
+#undef HAVE_SOCKLEN_T
+
+/* got in_addr_t? */
+#undef HAVE_IN_ADDR_T
+
+#ifndef HAVE_STRCHR
+#ifdef HAVE_INDEX
+# define strchr index
+# define strrchr rindex
+#endif
+#endif
+
+#ifndef HAVE_INDEX
+#ifdef HAVE_STRCHR
+# define index strchr
+# define rindex strrchr
+#endif
+#endif
+
+#ifndef HAVE_MEMCPY
+#ifdef HAVE_BCOPY
+# define memcpy(d, s, n) bcopy ((s), (d), (n))
+# define memmove(d, s, n) bcopy ((s), (d), (n))
+# define memcmp bcmp
+#endif
+#endif
+
+#ifndef HAVE_MEMMOVE
+#ifdef HAVE_MEMCPY
+# define memmove memcpy
+#endif
+#endif
+
+#ifndef HAVE_BCOPY
+#ifdef HAVE_MEMCPY
+# define bcopy(s, d, n) memcpy ((d), (s), (n))
+# define bzero(p,n) memset((p),(0),(n))
+# define bcmp memcmp
+#endif
+#endif
+
+/* If you have openssl 0.9.7 or above, you likely have AES support. */
+#undef USE_OPENSSL
+#if defined(USE_OPENSSL) && defined(HAVE_OPENSSL_AES_H) && defined(HAVE_AES_CFB128_ENCRYPT)
+#define HAVE_AES 1
+#endif
+
+/* define random functions */
+
+#ifndef HAVE_RANDOM
+#ifdef HAVE_LRAND48
+#define random lrand48
+#define srandom(s) srand48(s)
+#else
+#ifdef HAVE_RAND
+#define random rand
+#define srandom(s) srand(s)
+#endif
+#endif
+#endif
+
+/* define signal if DNE */
+
+#ifndef HAVE_SIGNAL
+#ifdef HAVE_SIGSET
+#define signal(a,b) sigset(a,b)
+#endif
+#endif
+
+/* define if you have librpm and libdb */
+#undef HAVE_LIBDB
+#undef HAVE_LIBRPM
+
+/* define if you have pkginfo */
+#undef HAVE_PKGINFO
+
+/* define if you have gethostbyname */
+#undef HAVE_GETHOSTBYNAME
+
+/* define if you have getservbyname */
+#undef HAVE_GETSERVBYNAME
+
+/* printing system */
+#undef HAVE_LPSTAT
+#undef LPSTAT_PATH
+#undef HAVE_PRINTCAP
+
+/*  Pluggable transports.  */
+
+/*  This is defined if support for the UDP/IP transport domain is
+    available.   */
+#undef SNMP_TRANSPORT_UDP_DOMAIN
+
+/*  This is defined if support for the TCP/IP transport domain is
+    available.  */
+#undef SNMP_TRANSPORT_TCP_DOMAIN
+
+/*  This is defined if support for the Unix transport domain
+    (a.k.a. "local IPC") is available.  */
+#undef SNMP_TRANSPORT_UNIX_DOMAIN
+
+/*  This is defined if support for the AAL5 PVC transport domain is
+    available.  */
+#undef SNMP_TRANSPORT_AAL5PVC_DOMAIN
+
+/*  This is defined if support for the IPX transport domain is
+    available.  */
+#undef SNMP_TRANSPORT_IPX_DOMAIN
+
+/*  This is defined if support for the UDP/IPv6 transport domain is
+    available.  */
+#undef SNMP_TRANSPORT_UDPIPV6_DOMAIN
+
+/*  This is defined if support for the TCP/IPv6 transport domain is
+    available.  */
+#undef SNMP_TRANSPORT_TCPIPV6_DOMAIN
+
+/* define this if the USM security module is available */
+#undef SNMP_SECMOD_USM
+
+/* define this if the KSM (kerberos based snmp) security module is available */
+#undef SNMP_SECMOD_KSM
+
+/* define this if we're using the new MIT crypto API */
+#undef MIT_NEW_CRYPTO
+
+/* define if you want to build with reentrant/threaded code */
+#undef NS_REENTRANT
+
+/* Not-to-be-compiled macros for use by configure only */
+#define config_require(x)
+#define config_arch_require(x,y)
+#define config_parse_dot_conf(w,x,y,z)
+#define config_add_mib(x)
+  
+#ifdef WIN32
+#define ENV_SEPARATOR ";"
+#define ENV_SEPARATOR_CHAR ';'
+#else
+#define ENV_SEPARATOR ":"
+#define ENV_SEPARATOR_CHAR ':'
+#endif
+
+#include SYSTEM_INCLUDE_FILE
+#include MACHINE_INCLUDE_FILE
+
+#if defined(HAVE_NLIST) && defined(STRUCT_NLIST_HAS_N_VALUE) && !defined(DONT_USE_NLIST) && !defined(NO_KMEM_USAGE)
+#define CAN_USE_NLIST
+#endif
+
+#if HAVE_DMALLOC_H
+#define DMALLOC_FUNC_CHECK
+#endif
+
+#undef INET6
+
+#ifndef NETSNMP_INLINE
+#   define NETSNMP_NO_INLINE
+#   define NETSNMP_INLINE
+#endif
+
+#endif /* NET_SNMP_CONFIG_H */
diff -Naur tomato/release/src/router/snmp/aclocal.m4 tomato121/release/src/router/snmp/aclocal.m4
--- tomato/release/src/router/snmp/aclocal.m4	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/aclocal.m4	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,3902 @@
+dnl @synopsis AC_PROMPT_USER_NO_DEFINE(VARIABLENAME,QUESTION,[DEFAULT])
+dnl
+dnl Asks a QUESTION and puts the results in VARIABLENAME with an optional
+dnl DEFAULT value if the user merely hits return.
+dnl
+dnl @version 1.15
+dnl @author Wes Hardaker <hardaker@users.sourceforge.net>
+dnl
+AC_DEFUN([AC_PROMPT_USER_NO_DEFINE],
+dnl changequote(<<, >>) dnl
+dnl <<
+[
+if test "x$defaults" = "xno"; then
+echo $ac_n "$2 ($3): $ac_c"
+read tmpinput
+if test "$tmpinput" = "" -a "$3" != ""; then
+  tmpinput="$3"
+fi
+eval $1=\"$tmpinput\"
+else
+tmpinput="$3"
+eval $1=\"$tmpinput\"
+fi
+]
+dnl >>
+dnl changequote([, ])
+) dnl done AC_PROMPT_USER
+
+dnl @synopsis AC_PROMPT_USER(VARIABLENAME,QUESTION,[DEFAULT],QUOTED)
+dnl
+dnl Asks a QUESTION and puts the results in VARIABLENAME with an optional
+dnl DEFAULT value if the user merely hits return.  Also calls 
+dnl AC_DEFINE_UNQUOTED() on the VARIABLENAME for VARIABLENAMEs that should
+dnl be entered into the config.h file as well.  If QUOTED is "quoted" then
+dnl the result will be defined within quotes.
+dnl
+dnl @version 1.15
+dnl @author Wes Hardaker <hardaker@users.sourceforge.net>
+dnl
+AC_DEFUN([AC_PROMPT_USER],
+[
+MSG_CHECK=`echo "$2" | tail -1`
+AC_CACHE_CHECK($MSG_CHECK, ac_cv_user_prompt_$1,
+[echo "" >&AC_FD_MSG
+AC_PROMPT_USER_NO_DEFINE($1,[$2],$3)
+eval ac_cv_user_prompt_$1=\$$1
+echo $ac_n "setting $MSG_CHECK to...  $ac_c" >&AC_FD_MSG
+])
+if test "$ac_cv_user_prompt_$1" != "none"; then
+  if test "x$4" = "xquoted" -o "x$4" = "xQUOTED"; then
+    AC_DEFINE_UNQUOTED($1,"$ac_cv_user_prompt_$1")
+  else
+    AC_DEFINE_UNQUOTED($1,$ac_cv_user_prompt_$1)
+  fi
+fi
+]) dnl
+
+dnl @synopsis AC_CHECK_STRUCT_FOR(INCLUDES,STRUCT,MEMBER,DEFINE,[no])
+dnl
+dnl Checks STRUCT for MEMBER and defines DEFINE if found.
+dnl
+dnl @version 1.15
+dnl @author Wes Hardaker <hardaker@users.sourceforge.net>
+dnl
+AC_DEFUN(AC_CHECK_STRUCT_FOR,[
+
+ac_safe_struct=`echo "$2" | sed 'y%./+-%__p_%'`
+ac_safe_member=`echo "$3" | sed 'y%./+-%__p_%'`
+ac_safe_all="ac_cv_struct_${ac_safe_struct}_has_${ac_safe_member}"
+changequote(, )dnl
+  ac_uc_define=STRUCT_`echo "${ac_safe_struct}_HAS_${ac_safe_member}" | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
+changequote([, ])dnl
+
+AC_MSG_CHECKING([for $2.$3])
+AC_CACHE_VAL($ac_safe_all,
+[
+if test "x$4" = "x"; then
+  defineit="= 0"
+elif test "x$4" = "xno"; then
+  defineit=""
+else
+  defineit="$4"
+fi
+AC_TRY_COMPILE([
+$1
+],[
+struct $2 testit; 
+testit.$3 $defineit;
+], 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)
+else
+  AC_MSG_RESULT(no)
+fi
+
+])
+
+dnl AC_CHECK_IFNET_FOR(SUBSTRUCT,[no])
+AC_DEFUN(AC_CHECK_IFNET_FOR,[
+dnl check for $1 in struct ifnet
+AC_CHECK_STRUCT_FOR([
+#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
+], ifnet, $1, $2)
+])
+
+dnl
+dnl Add a search path to the LIBS and CFLAGS variables
+dnl
+AC_DEFUN(AC_ADD_SEARCH_PATH,[
+  if test "x$1" != x -a -d $1; then
+     if test -d $1/lib; then
+       LDFLAGS="-L$1/lib $LDFLAGS"
+     fi
+     if test -d $1/include; then
+	CPPFLAGS="-I$1/include $CPPFLAGS"
+     fi
+  fi
+])
+
+dnl
+dnl Store information for displaying later.
+dnl
+AC_DEFUN(AC_MSG_CACHE_INIT,[
+  rm -f configure-summary
+])
+
+AC_DEFUN(AC_MSG_CACHE_ADD,[
+  cat >> configure-summary << EOF
+  $1
+EOF
+])
+
+AC_DEFUN(AC_MSG_CACHE_DISPLAY,[
+  echo ""
+  echo "---------------------------------------------------------"
+  echo "            Net-SNMP configuration summary:"
+  echo "---------------------------------------------------------"
+  echo ""
+  cat configure-summary
+  echo ""
+  echo "---------------------------------------------------------"
+  echo ""
+])
+
+
+dnl
+dnl Stuff taken from libtool.m4 from the libtool package
+dnl
+
+# libtool.m4 - Configure libtool for the host system. -*-Shell-script-*-
+## Copyright 1996, 1997, 1998, 1999, 2000, 2001
+## Free Software Foundation, Inc.
+## Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
+##
+## This program is free software; you can redistribute it and/or modify
+## it under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 2 of the License, or
+## (at your option) any later version.
+##
+## This program is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with this program; if not, write to the Free Software
+## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+##
+## As a special exception to the GNU General Public License, if you
+## distribute this file as part of a program that contains a
+## configuration script generated by Autoconf, you may include it under
+## the same distribution terms that you use for the rest of that program.
+
+# serial 46 AC_PROG_LIBTOOL
+
+AC_DEFUN([AC_PROG_LIBTOOL],
+[AC_REQUIRE([AC_LIBTOOL_SETUP])dnl
+
+# This can be used to rebuild libtool when needed
+LIBTOOL_DEPS="$ac_aux_dir/ltmain.sh"
+
+# Always use our own libtool.
+LIBTOOL='$(SHELL) $(top_builddir)/libtool'
+AC_SUBST(LIBTOOL)dnl
+
+# Prevent multiple expansion
+define([AC_PROG_LIBTOOL], [])
+])
+
+AC_DEFUN([AC_LIBTOOL_SETUP],
+[AC_PREREQ(2.13)dnl
+AC_REQUIRE([AC_ENABLE_SHARED])dnl
+AC_REQUIRE([AC_ENABLE_STATIC])dnl
+AC_REQUIRE([AC_ENABLE_FAST_INSTALL])dnl
+AC_REQUIRE([AC_CANONICAL_HOST])dnl
+AC_REQUIRE([AC_CANONICAL_BUILD])dnl
+AC_REQUIRE([AC_PROG_CC])dnl
+AC_REQUIRE([AC_PROG_LD])dnl
+AC_REQUIRE([AC_PROG_LD_RELOAD_FLAG])dnl
+AC_REQUIRE([AC_PROG_NM])dnl
+AC_REQUIRE([LT_AC_PROG_SED])dnl
+
+AC_REQUIRE([AC_PROG_LN_S])dnl
+AC_REQUIRE([AC_DEPLIBS_CHECK_METHOD])dnl
+AC_REQUIRE([AC_OBJEXT])dnl
+AC_REQUIRE([AC_EXEEXT])dnl
+dnl
+
+_LT_AC_PROG_ECHO_BACKSLASH
+# Only perform the check for file, if the check method requires it
+case $deplibs_check_method in
+file_magic*)
+  if test "$file_magic_cmd" = '$MAGIC_CMD'; then
+    AC_PATH_MAGIC
+  fi
+  ;;
+esac
+
+AC_CHECK_TOOL(RANLIB, ranlib, :)
+AC_CHECK_TOOL(STRIP, strip, :)
+
+ifdef([AC_PROVIDE_AC_LIBTOOL_DLOPEN], enable_dlopen=yes, enable_dlopen=no)
+ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL],
+enable_win32_dll=yes, enable_win32_dll=no)
+
+AC_ARG_ENABLE(libtool-lock,
+  [  --disable-libtool-lock  avoid locking (might break parallel builds)])
+test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes
+
+# Some flags need to be propagated to the compiler or linker for good
+# libtool support.
+case $host in
+*-*-irix6*)
+  # Find out which ABI we are using.
+  echo '[#]line __oline__ "configure"' > conftest.$ac_ext
+  if AC_TRY_EVAL(ac_compile); then
+    case `/usr/bin/file conftest.$ac_objext` in
+    *32-bit*)
+      LD="${LD-ld} -32"
+      ;;
+    *N32*)
+      LD="${LD-ld} -n32"
+      ;;
+    *64-bit*)
+      LD="${LD-ld} -64"
+      ;;
+    esac
+  fi
+  rm -rf conftest*
+  ;;
+
+*-*-sco3.2v5*)
+  # On SCO OpenServer 5, we need -belf to get full-featured binaries.
+  SAVE_CFLAGS="$CFLAGS"
+  CFLAGS="$CFLAGS -belf"
+  AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf,
+    [AC_LANG_SAVE
+     AC_LANG_C
+     AC_TRY_LINK([],[],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no])
+     AC_LANG_RESTORE])
+  if test x"$lt_cv_cc_needs_belf" != x"yes"; then
+    # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf
+    CFLAGS="$SAVE_CFLAGS"
+  fi
+  ;;
+
+ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL],
+[*-*-cygwin* | *-*-mingw* | *-*-pw32*)
+  AC_CHECK_TOOL(DLLTOOL, dlltool, false)
+  AC_CHECK_TOOL(AS, as, false)
+  AC_CHECK_TOOL(OBJDUMP, objdump, false)
+
+  # recent cygwin and mingw systems supply a stub DllMain which the user
+  # can override, but on older systems we have to supply one
+  AC_CACHE_CHECK([if libtool should supply DllMain function], lt_cv_need_dllmain,
+    [AC_TRY_LINK([],
+      [extern int __attribute__((__stdcall__)) DllMain(void*, int, void*);
+      DllMain (0, 0, 0);],
+      [lt_cv_need_dllmain=no],[lt_cv_need_dllmain=yes])])
+
+  case $host/$CC in
+  *-*-cygwin*/gcc*-mno-cygwin*|*-*-mingw*)
+    # old mingw systems require "-dll" to link a DLL, while more recent ones
+    # require "-mdll"
+    SAVE_CFLAGS="$CFLAGS"
+    CFLAGS="$CFLAGS -mdll"
+    AC_CACHE_CHECK([how to link DLLs], lt_cv_cc_dll_switch,
+      [AC_TRY_LINK([], [], [lt_cv_cc_dll_switch=-mdll],[lt_cv_cc_dll_switch=-dll])])
+    CFLAGS="$SAVE_CFLAGS" ;;
+  *-*-cygwin* | *-*-pw32*)
+    # cygwin systems need to pass --dll to the linker, and not link
+    # crt.o which will require a WinMain@16 definition.
+    lt_cv_cc_dll_switch="-Wl,--dll -nostartfiles" ;;
+  esac
+  ;;
+  ])
+esac
+
+_LT_AC_LTCONFIG_HACK
+
+])
+
+# AC_LIBTOOL_HEADER_ASSERT
+# ------------------------
+AC_DEFUN([AC_LIBTOOL_HEADER_ASSERT],
+[AC_CACHE_CHECK([whether $CC supports assert without backlinking],
+    [lt_cv_func_assert_works],
+    [case $host in
+    *-*-solaris*)
+      if test "$GCC" = yes && test "$with_gnu_ld" != yes; then
+        case `$CC --version 2>/dev/null` in
+        [[12]].*) lt_cv_func_assert_works=no ;;
+        *)        lt_cv_func_assert_works=yes ;;
+        esac
+      fi
+      ;;
+    esac])
+
+if test "x$lt_cv_func_assert_works" = xyes; then
+  AC_CHECK_HEADERS(assert.h)
+fi
+])# AC_LIBTOOL_HEADER_ASSERT
+
+# _LT_AC_CHECK_DLFCN
+# --------------------
+AC_DEFUN([_LT_AC_CHECK_DLFCN],
+[AC_CHECK_HEADERS(dlfcn.h)
+])# _LT_AC_CHECK_DLFCN
+
+# AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE
+# ---------------------------------
+AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE],
+[AC_REQUIRE([AC_CANONICAL_HOST])
+AC_REQUIRE([AC_PROG_NM])
+AC_REQUIRE([AC_OBJEXT])
+# Check for command to grab the raw symbol name followed by C symbol from nm.
+AC_MSG_CHECKING([command to parse $NM output])
+AC_CACHE_VAL([lt_cv_sys_global_symbol_pipe], [dnl
+
+# These are sane defaults that work on at least a few old systems.
+# [They come from Ultrix.  What could be older than Ultrix?!! ;)]
+
+# Character class describing NM global symbol codes.
+symcode='[[BCDEGRST]]'
+
+# Regexp to match symbols that can be accessed directly from C.
+sympat='\([[_A-Za-z]][[_A-Za-z0-9]]*\)'
+
+# Transform the above into a raw symbol and a C symbol.
+symxfrm='\1 \2\3 \3'
+
+# Transform an extracted symbol line into a proper C declaration
+lt_cv_global_symbol_to_cdecl="sed -n -e 's/^. .* \(.*\)$/extern char \1;/p'"
+
+# Transform an extracted symbol line into symbol name and symbol address
+lt_cv_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/  {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode \([[^ ]]*\) \([[^ ]]*\)$/  {\"\2\", (lt_ptr) \&\2},/p'"
+
+# Define system-specific variables.
+case $host_os in
+aix*)
+  symcode='[[BCDT]]'
+  ;;
+cygwin* | mingw* | pw32*)
+  symcode='[[ABCDGISTW]]'
+  ;;
+hpux*) # Its linker distinguishes data from code symbols
+  lt_cv_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern char \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'"
+  lt_cv_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/  {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/  {\"\2\", (lt_ptr) \&\2},/p'"
+  ;;
+irix* | nonstopux*)
+  symcode='[[BCDEGRST]]'
+  ;;
+osf*)
+  symcode='[[BCDEGQRST]]'
+  ;;
+solaris* | sysv5*)
+  symcode='[[BDT]]'
+  ;;
+sysv4)
+  symcode='[[DFNSTU]]'
+  ;;
+esac
+
+# Handle CRLF in mingw tool chain
+opt_cr=
+case $host_os in
+mingw*)
+  opt_cr=`echo 'x\{0,1\}' | tr x '\015'` # option cr in regexp
+  ;;
+esac
+
+# If we're using GNU nm, then use its standard symbol codes.
+if $NM -V 2>&1 | egrep '(GNU|with BFD)' > /dev/null; then
+  symcode='[[ABCDGISTW]]'
+fi
+
+# Try without a prefix undercore, then with it.
+for ac_symprfx in "" "_"; do
+
+  # Write the raw and C identifiers.
+lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[[ 	]]\($symcode$symcode*\)[[ 	]][[ 	]]*\($ac_symprfx\)$sympat$opt_cr$/$symxfrm/p'"
+
+  # Check to see that the pipe works correctly.
+  pipe_works=no
+  rm -f conftest*
+  cat > conftest.$ac_ext <<EOF
+#ifdef __cplusplus
+extern "C" {
+#endif
+char nm_test_var;
+void nm_test_func(){}
+#ifdef __cplusplus
+}
+#endif
+int main(){nm_test_var='a';nm_test_func();return(0);}
+EOF
+
+  if AC_TRY_EVAL(ac_compile); then
+    # Now try to grab the symbols.
+    nlist=conftest.nm
+    if AC_TRY_EVAL(NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist) && test -s "$nlist"; then
+      # Try sorting and uniquifying the output.
+      if sort "$nlist" | uniq > "$nlist"T; then
+	mv -f "$nlist"T "$nlist"
+      else
+	rm -f "$nlist"T
+      fi
+
+      # Make sure that we snagged all the symbols we need.
+      if egrep ' nm_test_var$' "$nlist" >/dev/null; then
+	if egrep ' nm_test_func$' "$nlist" >/dev/null; then
+	  cat <<EOF > conftest.$ac_ext
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+EOF
+	  # Now generate the symbol file.
+	  eval "$lt_cv_global_symbol_to_cdecl"' < "$nlist" >> conftest.$ac_ext'
+
+	  cat <<EOF >> conftest.$ac_ext
+#if defined (__STDC__) && __STDC__
+# define lt_ptr void *
+#else
+# define lt_ptr char *
+# define const
+#endif
+
+/* The mapping between symbol names and symbols. */
+const struct {
+  const char *name;
+  lt_ptr address;
+}
+lt_preloaded_symbols[[]] =
+{
+EOF
+	  sed "s/^$symcode$symcode* \(.*\) \(.*\)$/  {\"\2\", (lt_ptr) \&\2},/" < "$nlist" >> conftest.$ac_ext
+	  cat <<\EOF >> conftest.$ac_ext
+  {0, (lt_ptr) 0}
+};
+
+#ifdef __cplusplus
+}
+#endif
+EOF
+	  # Now try linking the two files.
+	  mv conftest.$ac_objext conftstm.$ac_objext
+	  save_LIBS="$LIBS"
+	  save_CFLAGS="$CFLAGS"
+	  LIBS="conftstm.$ac_objext"
+	  CFLAGS="$CFLAGS$no_builtin_flag"
+	  if AC_TRY_EVAL(ac_link) && test -s conftest$ac_exeext; then
+	    pipe_works=yes
+	  fi
+	  LIBS="$save_LIBS"
+	  CFLAGS="$save_CFLAGS"
+	else
+	  echo "cannot find nm_test_func in $nlist" >&AC_FD_CC
+	fi
+      else
+	echo "cannot find nm_test_var in $nlist" >&AC_FD_CC
+      fi
+    else
+      echo "cannot run $lt_cv_sys_global_symbol_pipe" >&AC_FD_CC
+    fi
+  else
+    echo "$progname: failed program was:" >&AC_FD_CC
+    cat conftest.$ac_ext >&5
+  fi
+  rm -f conftest* conftst*
+
+  # Do not use the global_symbol_pipe unless it works.
+  if test "$pipe_works" = yes; then
+    break
+  else
+    lt_cv_sys_global_symbol_pipe=
+  fi
+done
+])
+global_symbol_pipe="$lt_cv_sys_global_symbol_pipe"
+if test -z "$lt_cv_sys_global_symbol_pipe"; then
+  global_symbol_to_cdecl=
+  global_symbol_to_c_name_address=
+else
+  global_symbol_to_cdecl="$lt_cv_global_symbol_to_cdecl"
+  global_symbol_to_c_name_address="$lt_cv_global_symbol_to_c_name_address"
+fi
+if test -z "$global_symbol_pipe$global_symbol_to_cdec$global_symbol_to_c_name_address";
+then
+  AC_MSG_RESULT(failed)
+else
+  AC_MSG_RESULT(ok)
+fi
+]) # AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE
+
+# _LT_AC_LIBTOOL_SYS_PATH_SEPARATOR
+# ---------------------------------
+AC_DEFUN([_LT_AC_LIBTOOL_SYS_PATH_SEPARATOR],
+[# Find the correct PATH separator.  Usually this is `:', but
+# DJGPP uses `;' like DOS.
+if test "X${PATH_SEPARATOR+set}" != Xset; then
+  UNAME=${UNAME-`uname 2>/dev/null`}
+  case X$UNAME in
+    *-DOS) lt_cv_sys_path_separator=';' ;;
+    *)     lt_cv_sys_path_separator=':' ;;
+  esac
+  PATH_SEPARATOR=$lt_cv_sys_path_separator
+fi
+])# _LT_AC_LIBTOOL_SYS_PATH_SEPARATOR
+
+# _LT_AC_PROG_ECHO_BACKSLASH
+# --------------------------
+# Add some code to the start of the generated configure script which
+# will find an echo command which doesn't interpret backslashes.
+AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH],
+[ifdef([AC_DIVERSION_NOTICE], [AC_DIVERT_PUSH(AC_DIVERSION_NOTICE)],
+			      [AC_DIVERT_PUSH(NOTICE)])
+_LT_AC_LIBTOOL_SYS_PATH_SEPARATOR
+
+# Check that we are running under the correct shell.
+SHELL=${CONFIG_SHELL-/bin/sh}
+
+case X$ECHO in
+X*--fallback-echo)
+  # Remove one level of quotation (which was required for Make).
+  ECHO=`echo "$ECHO" | sed 's,\\\\\[$]\\[$]0,'[$]0','`
+  ;;
+esac
+
+echo=${ECHO-echo}
+if test "X[$]1" = X--no-reexec; then
+  # Discard the --no-reexec flag, and continue.
+  shift
+elif test "X[$]1" = X--fallback-echo; then
+  # Avoid inline document here, it may be left over
+  :
+elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then
+  # Yippee, $echo works!
+  :
+else
+  # Restart under the correct shell.
+  exec $SHELL "[$]0" --no-reexec ${1+"[$]@"}
+fi
+
+if test "X[$]1" = X--fallback-echo; then
+  # used as fallback echo
+  shift
+  cat <<EOF
+$*
+EOF
+  exit 0
+fi
+
+# The HP-UX ksh and POSIX shell print the target directory to stdout
+# if CDPATH is set.
+if test "X${CDPATH+set}" = Xset; then CDPATH=:; export CDPATH; fi
+
+if test -z "$ECHO"; then
+if test "X${echo_test_string+set}" != Xset; then
+# find a string as large as possible, as long as the shell can cope with it
+  for cmd in 'sed 50q "[$]0"' 'sed 20q "[$]0"' 'sed 10q "[$]0"' 'sed 2q "[$]0"' 'echo test'; do
+    # expected sizes: less than 2Kb, 1Kb, 512 bytes, 16 bytes, ...
+    if (echo_test_string="`eval $cmd`") 2>/dev/null &&
+       echo_test_string="`eval $cmd`" &&
+       (test "X$echo_test_string" = "X$echo_test_string") 2>/dev/null
+    then
+      break
+    fi
+  done
+fi
+
+if test "X`($echo '\t') 2>/dev/null`" = 'X\t' &&
+   echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` &&
+   test "X$echo_testing_string" = "X$echo_test_string"; then
+  :
+else
+  # The Solaris, AIX, and Digital Unix default echo programs unquote
+  # backslashes.  This makes it impossible to quote backslashes using
+  #   echo "$something" | sed 's/\\/\\\\/g'
+  #
+  # So, first we look for a working echo in the user's PATH.
+
+  IFS="${IFS= 	}"; save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+  for dir in $PATH /usr/ucb; do
+    if (test -f $dir/echo || test -f $dir/echo$ac_exeext) &&
+       test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' &&
+       echo_testing_string=`($dir/echo "$echo_test_string") 2>/dev/null` &&
+       test "X$echo_testing_string" = "X$echo_test_string"; then
+      echo="$dir/echo"
+      break
+    fi
+  done
+  IFS="$save_ifs"
+
+  if test "X$echo" = Xecho; then
+    # We didn't find a better echo, so look for alternatives.
+    if test "X`(print -r '\t') 2>/dev/null`" = 'X\t' &&
+       echo_testing_string=`(print -r "$echo_test_string") 2>/dev/null` &&
+       test "X$echo_testing_string" = "X$echo_test_string"; then
+      # This shell has a builtin print -r that does the trick.
+      echo='print -r'
+    elif (test -f /bin/ksh || test -f /bin/ksh$ac_exeext) &&
+	 test "X$CONFIG_SHELL" != X/bin/ksh; then
+      # If we have ksh, try running configure again with it.
+      ORIGINAL_CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
+      export ORIGINAL_CONFIG_SHELL
+      CONFIG_SHELL=/bin/ksh
+      export CONFIG_SHELL
+      exec $CONFIG_SHELL "[$]0" --no-reexec ${1+"[$]@"}
+    else
+      # Try using printf.
+      echo='printf %s\n'
+      if test "X`($echo '\t') 2>/dev/null`" = 'X\t' &&
+	 echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` &&
+	 test "X$echo_testing_string" = "X$echo_test_string"; then
+	# Cool, printf works
+	:
+      elif echo_testing_string=`($ORIGINAL_CONFIG_SHELL "[$]0" --fallback-echo '\t') 2>/dev/null` &&
+	   test "X$echo_testing_string" = 'X\t' &&
+	   echo_testing_string=`($ORIGINAL_CONFIG_SHELL "[$]0" --fallback-echo "$echo_test_string") 2>/dev/null` &&
+	   test "X$echo_testing_string" = "X$echo_test_string"; then
+	CONFIG_SHELL=$ORIGINAL_CONFIG_SHELL
+	export CONFIG_SHELL
+	SHELL="$CONFIG_SHELL"
+	export SHELL
+	echo="$CONFIG_SHELL [$]0 --fallback-echo"
+      elif echo_testing_string=`($CONFIG_SHELL "[$]0" --fallback-echo '\t') 2>/dev/null` &&
+	   test "X$echo_testing_string" = 'X\t' &&
+	   echo_testing_string=`($CONFIG_SHELL "[$]0" --fallback-echo "$echo_test_string") 2>/dev/null` &&
+	   test "X$echo_testing_string" = "X$echo_test_string"; then
+	echo="$CONFIG_SHELL [$]0 --fallback-echo"
+      else
+	# maybe with a smaller string...
+	prev=:
+
+	for cmd in 'echo test' 'sed 2q "[$]0"' 'sed 10q "[$]0"' 'sed 20q "[$]0"' 'sed 50q "[$]0"'; do
+	  if (test "X$echo_test_string" = "X`eval $cmd`") 2>/dev/null
+	  then
+	    break
+	  fi
+	  prev="$cmd"
+	done
+
+	if test "$prev" != 'sed 50q "[$]0"'; then
+	  echo_test_string=`eval $prev`
+	  export echo_test_string
+	  exec ${ORIGINAL_CONFIG_SHELL-${CONFIG_SHELL-/bin/sh}} "[$]0" ${1+"[$]@"}
+	else
+	  # Oops.  We lost completely, so just stick with echo.
+	  echo=echo
+	fi
+      fi
+    fi
+  fi
+fi
+fi
+
+# Copy echo and quote the copy suitably for passing to libtool from
+# the Makefile, instead of quoting the original, which is used later.
+ECHO=$echo
+if test "X$ECHO" = "X$CONFIG_SHELL [$]0 --fallback-echo"; then
+   ECHO="$CONFIG_SHELL \\\$\[$]0 --fallback-echo"
+fi
+
+AC_SUBST(ECHO)
+AC_DIVERT_POP
+])# _LT_AC_PROG_ECHO_BACKSLASH
+
+# _LT_AC_TRY_DLOPEN_SELF (ACTION-IF-TRUE, ACTION-IF-TRUE-W-USCORE,
+#                           ACTION-IF-FALSE, ACTION-IF-CROSS-COMPILING)
+# ------------------------------------------------------------------
+AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF],
+[if test "$cross_compiling" = yes; then :
+  [$4]
+else
+  AC_REQUIRE([_LT_AC_CHECK_DLFCN])dnl
+  lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
+  lt_status=$lt_dlunknown
+  cat > conftest.$ac_ext <<EOF
+[#line __oline__ "configure"
+#include "confdefs.h"
+
+#if HAVE_DLFCN_H
+#include <dlfcn.h>
+#endif
+
+#include <stdio.h>
+
+#ifdef RTLD_GLOBAL
+#  define LT_DLGLOBAL		RTLD_GLOBAL
+#else
+#  ifdef DL_GLOBAL
+#    define LT_DLGLOBAL		DL_GLOBAL
+#  else
+#    define LT_DLGLOBAL		0
+#  endif
+#endif
+
+/* We may have to define LT_DLLAZY_OR_NOW in the command line if we
+   find out it does not work in some platform. */
+#ifndef LT_DLLAZY_OR_NOW
+#  ifdef RTLD_LAZY
+#    define LT_DLLAZY_OR_NOW		RTLD_LAZY
+#  else
+#    ifdef DL_LAZY
+#      define LT_DLLAZY_OR_NOW		DL_LAZY
+#    else
+#      ifdef RTLD_NOW
+#        define LT_DLLAZY_OR_NOW	RTLD_NOW
+#      else
+#        ifdef DL_NOW
+#          define LT_DLLAZY_OR_NOW	DL_NOW
+#        else
+#          define LT_DLLAZY_OR_NOW	0
+#        endif
+#      endif
+#    endif
+#  endif
+#endif
+
+#ifdef __cplusplus
+extern "C" void exit (int);
+#endif
+
+void fnord() { int i=42;}
+int main ()
+{
+  void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW);
+  int status = $lt_dlunknown;
+
+  if (self)
+    {
+      if (dlsym (self,"fnord"))       status = $lt_dlno_uscore;
+      else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore;
+      /* dlclose (self); */
+    }
+
+    exit (status);
+}]
+EOF
+  if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext} 2>/dev/null; then
+    (./conftest; exit; ) 2>/dev/null
+    lt_status=$?
+    case x$lt_status in
+      x$lt_dlno_uscore) $1 ;;
+      x$lt_dlneed_uscore) $2 ;;
+      x$lt_unknown|x*) $3 ;;
+    esac
+  else :
+    # compilation failed
+    $3
+  fi
+fi
+rm -fr conftest*
+])# _LT_AC_TRY_DLOPEN_SELF
+
+# AC_LIBTOOL_DLOPEN_SELF
+# -------------------
+AC_DEFUN([AC_LIBTOOL_DLOPEN_SELF],
+[if test "x$enable_dlopen" != xyes; then
+  enable_dlopen=unknown
+  enable_dlopen_self=unknown
+  enable_dlopen_self_static=unknown
+else
+  lt_cv_dlopen=no
+  lt_cv_dlopen_libs=
+
+  case $host_os in
+  beos*)
+    lt_cv_dlopen="load_add_on"
+    lt_cv_dlopen_libs=
+    lt_cv_dlopen_self=yes
+    ;;
+
+  cygwin* | mingw* | pw32*)
+    lt_cv_dlopen="LoadLibrary"
+    lt_cv_dlopen_libs=
+   ;;
+
+  *)
+    AC_CHECK_FUNC([shl_load],
+          [lt_cv_dlopen="shl_load"],
+      [AC_CHECK_LIB([dld], [shl_load],
+            [lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-dld"],
+	[AC_CHECK_FUNC([dlopen],
+	      [lt_cv_dlopen="dlopen"],
+	  [AC_CHECK_LIB([dl], [dlopen],
+	        [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"],
+	    [AC_CHECK_LIB([svld], [dlopen],
+	          [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"],
+	      [AC_CHECK_LIB([dld], [dld_link],
+	            [lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-dld"])
+	      ])
+	    ])
+	  ])
+	])
+      ])
+    ;;
+  esac
+
+  if test "x$lt_cv_dlopen" != xno; then
+    enable_dlopen=yes
+  else
+    enable_dlopen=no
+  fi
+
+  case $lt_cv_dlopen in
+  dlopen)
+    save_CPPFLAGS="$CPPFLAGS"
+    AC_REQUIRE([_LT_AC_CHECK_DLFCN])dnl
+    test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H"
+
+    save_LDFLAGS="$LDFLAGS"
+    eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\"
+
+    save_LIBS="$LIBS"
+    LIBS="$lt_cv_dlopen_libs $LIBS"
+
+    AC_CACHE_CHECK([whether a program can dlopen itself],
+	  lt_cv_dlopen_self, [dnl
+	  _LT_AC_TRY_DLOPEN_SELF(
+	    lt_cv_dlopen_self=yes, lt_cv_dlopen_self=yes,
+	    lt_cv_dlopen_self=no, lt_cv_dlopen_self=cross)
+    ])
+
+    if test "x$lt_cv_dlopen_self" = xyes; then
+      LDFLAGS="$LDFLAGS $link_static_flag"
+      AC_CACHE_CHECK([whether a statically linked program can dlopen itself],
+    	  lt_cv_dlopen_self_static, [dnl
+	  _LT_AC_TRY_DLOPEN_SELF(
+	    lt_cv_dlopen_self_static=yes, lt_cv_dlopen_self_static=yes,
+	    lt_cv_dlopen_self_static=no,  lt_cv_dlopen_self_static=cross)
+      ])
+    fi
+
+    CPPFLAGS="$save_CPPFLAGS"
+    LDFLAGS="$save_LDFLAGS"
+    LIBS="$save_LIBS"
+    ;;
+  esac
+
+  case $lt_cv_dlopen_self in
+  yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;;
+  *) enable_dlopen_self=unknown ;;
+  esac
+
+  case $lt_cv_dlopen_self_static in
+  yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;;
+  *) enable_dlopen_self_static=unknown ;;
+  esac
+fi
+])# AC_LIBTOOL_DLOPEN_SELF
+
+AC_DEFUN([_LT_AC_LTCONFIG_HACK],
+[AC_REQUIRE([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE])dnl
+# Sed substitution that helps us do robust quoting.  It backslashifies
+# metacharacters that are still active within double-quoted strings.
+Xsed='sed -e s/^X//'
+sed_quote_subst='s/\([[\\"\\`$\\\\]]\)/\\\1/g'
+
+# Same as above, but do not quote variable references.
+double_quote_subst='s/\([[\\"\\`\\\\]]\)/\\\1/g'
+
+# Sed substitution to delay expansion of an escaped shell variable in a
+# double_quote_subst'ed string.
+delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g'
+
+# Constants:
+rm="rm -f"
+
+# Global variables:
+default_ofile=libtool
+can_build_shared=yes
+
+# All known linkers require a `.a' archive for static linking (except M$VC,
+# which needs '.lib').
+libext=a
+ltmain="$ac_aux_dir/ltmain.sh"
+ofile="$default_ofile"
+with_gnu_ld="$lt_cv_prog_gnu_ld"
+need_locks="$enable_libtool_lock"
+
+old_CC="$CC"
+old_CFLAGS="$CFLAGS"
+
+# Set sane defaults for various variables
+test -z "$AR" && AR=ar
+test -z "$AR_FLAGS" && AR_FLAGS=cru
+test -z "$AS" && AS=as
+test -z "$CC" && CC=cc
+test -z "$DLLTOOL" && DLLTOOL=dlltool
+test -z "$LD" && LD=ld
+test -z "$LN_S" && LN_S="ln -s"
+test -z "$MAGIC_CMD" && MAGIC_CMD=file
+test -z "$NM" && NM=nm
+test -z "$OBJDUMP" && OBJDUMP=objdump
+test -z "$RANLIB" && RANLIB=:
+test -z "$STRIP" && STRIP=:
+test -z "$ac_objext" && ac_objext=o
+
+if test x"$host" != x"$build"; then
+  ac_tool_prefix=${host_alias}-
+else
+  ac_tool_prefix=
+fi
+
+# Transform linux* to *-*-linux-gnu*, to support old configure scripts.
+case $host_os in
+linux-gnu*) ;;
+linux*) host=`echo $host | sed 's/^\(.*-.*-linux\)\(.*\)$/\1-gnu\2/'`
+esac
+
+case $host_os in
+aix3*)
+  # AIX sometimes has problems with the GCC collect2 program.  For some
+  # reason, if we set the COLLECT_NAMES environment variable, the problems
+  # vanish in a puff of smoke.
+  if test "X${COLLECT_NAMES+set}" != Xset; then
+    COLLECT_NAMES=
+    export COLLECT_NAMES
+  fi
+  ;;
+esac
+
+# Determine commands to create old-style static archives.
+old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs$old_deplibs'
+old_postinstall_cmds='chmod 644 $oldlib'
+old_postuninstall_cmds=
+
+if test -n "$RANLIB"; then
+  case $host_os in
+  openbsd*)
+    old_postinstall_cmds="\$RANLIB -t \$oldlib~$old_postinstall_cmds"
+    ;;
+  *)
+    old_postinstall_cmds="\$RANLIB \$oldlib~$old_postinstall_cmds"
+    ;;
+  esac
+  old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib"
+fi
+
+# Allow CC to be a program name with arguments.
+set dummy $CC
+compiler="[$]2"
+
+## FIXME: this should be a separate macro
+##
+AC_MSG_CHECKING([for objdir])
+rm -f .libs 2>/dev/null
+mkdir .libs 2>/dev/null
+if test -d .libs; then
+  objdir=.libs
+else
+  # MS-DOS does not allow filenames that begin with a dot.
+  objdir=_libs
+fi
+rmdir .libs 2>/dev/null
+AC_MSG_RESULT($objdir)
+##
+## END FIXME
+
+
+## FIXME: this should be a separate macro
+##
+AC_ARG_WITH(pic,
+[  --with-pic              try to use only PIC/non-PIC objects [default=use both]],
+pic_mode="$withval", pic_mode=default)
+test -z "$pic_mode" && pic_mode=default
+
+# We assume here that the value for lt_cv_prog_cc_pic will not be cached
+# in isolation, and that seeing it set (from the cache) indicates that
+# the associated values are set (in the cache) correctly too.
+AC_MSG_CHECKING([for $compiler option to produce PIC])
+AC_CACHE_VAL(lt_cv_prog_cc_pic,
+[ lt_cv_prog_cc_pic=
+  lt_cv_prog_cc_shlib=
+  lt_cv_prog_cc_wl=
+  lt_cv_prog_cc_static=
+  lt_cv_prog_cc_no_builtin=
+  lt_cv_prog_cc_can_build_shared=$can_build_shared
+
+  if test "$GCC" = yes; then
+    lt_cv_prog_cc_wl='-Wl,'
+    lt_cv_prog_cc_static='-static'
+
+    case $host_os in
+    aix*)
+      # Below there is a dirty hack to force normal static linking with -ldl
+      # The problem is because libdl dynamically linked with both libc and
+      # libC (AIX C++ library), which obviously doesn't included in libraries
+      # list by gcc. This cause undefined symbols with -static flags.
+      # This hack allows C programs to be linked with "-static -ldl", but
+      # not sure about C++ programs.
+      lt_cv_prog_cc_static="$lt_cv_prog_cc_static ${lt_cv_prog_cc_wl}-lC"
+      ;;
+    amigaos*)
+      # FIXME: we need at least 68020 code to build shared libraries, but
+      # adding the `-m68020' flag to GCC prevents building anything better,
+      # like `-m68040'.
+      lt_cv_prog_cc_pic='-m68020 -resident32 -malways-restore-a4'
+      ;;
+    beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
+      # PIC is the default for these OSes.
+      ;;
+    darwin* | rhapsody*)
+      # PIC is the default on this platform
+      # Common symbols not allowed in MH_DYLIB files
+      lt_cv_prog_cc_pic='-fno-common'
+      ;;
+    cygwin* | mingw* | pw32* | os2*)
+      # This hack is so that the source file can tell whether it is being
+      # built for inclusion in a dll (and should export symbols for example).
+      lt_cv_prog_cc_pic='-DDLL_EXPORT'
+      ;;
+    sysv4*MP*)
+      if test -d /usr/nec; then
+	 lt_cv_prog_cc_pic=-Kconform_pic
+      fi
+      ;;
+    *)
+      lt_cv_prog_cc_pic='-fPIC'
+      ;;
+    esac
+  else
+    # PORTME Check for PIC flags for the system compiler.
+    case $host_os in
+    aix3* | aix4* | aix5*)
+      lt_cv_prog_cc_wl='-Wl,'
+      # All AIX code is PIC.
+      if test "$host_cpu" = ia64; then
+	# AIX 5 now supports IA64 processor
+	lt_cv_prog_cc_static='-Bstatic'
+      else
+	lt_cv_prog_cc_static='-bnso -bI:/lib/syscalls.exp'
+      fi
+      ;;
+
+    hpux9* | hpux10* | hpux11*)
+      # Is there a better lt_cv_prog_cc_static that works with the bundled CC?
+      lt_cv_prog_cc_wl='-Wl,'
+      lt_cv_prog_cc_static="${lt_cv_prog_cc_wl}-a ${lt_cv_prog_cc_wl}archive"
+      lt_cv_prog_cc_pic='+Z'
+      ;;
+
+    irix5* | irix6* | nonstopux*)
+      lt_cv_prog_cc_wl='-Wl,'
+      lt_cv_prog_cc_static='-non_shared'
+      # PIC (with -KPIC) is the default.
+      ;;
+
+    cygwin* | mingw* | pw32* | os2*)
+      # This hack is so that the source file can tell whether it is being
+      # built for inclusion in a dll (and should export symbols for example).
+      lt_cv_prog_cc_pic='-DDLL_EXPORT'
+      ;;
+
+    newsos6)
+      lt_cv_prog_cc_pic='-KPIC'
+      lt_cv_prog_cc_static='-Bstatic'
+      ;;
+
+    osf3* | osf4* | osf5*)
+      # All OSF/1 code is PIC.
+      lt_cv_prog_cc_wl='-Wl,'
+      lt_cv_prog_cc_static='-non_shared'
+      ;;
+
+    sco3.2v5*)
+      lt_cv_prog_cc_pic='-Kpic'
+      lt_cv_prog_cc_static='-dn'
+      lt_cv_prog_cc_shlib='-belf'
+      ;;
+
+    solaris*)
+      lt_cv_prog_cc_pic='-KPIC'
+      lt_cv_prog_cc_static='-Bstatic'
+      lt_cv_prog_cc_wl='-Wl,'
+      ;;
+
+    sunos4*)
+      lt_cv_prog_cc_pic='-PIC'
+      lt_cv_prog_cc_static='-Bstatic'
+      lt_cv_prog_cc_wl='-Qoption ld '
+      ;;
+
+    sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
+      lt_cv_prog_cc_pic='-KPIC'
+      lt_cv_prog_cc_static='-Bstatic'
+      lt_cv_prog_cc_wl='-Wl,'
+      ;;
+
+    uts4*)
+      lt_cv_prog_cc_pic='-pic'
+      lt_cv_prog_cc_static='-Bstatic'
+      ;;
+
+    sysv4*MP*)
+      if test -d /usr/nec ;then
+	lt_cv_prog_cc_pic='-Kconform_pic'
+	lt_cv_prog_cc_static='-Bstatic'
+      fi
+      ;;
+
+    *)
+      lt_cv_prog_cc_can_build_shared=no
+      ;;
+    esac
+  fi
+])
+if test -z "$lt_cv_prog_cc_pic"; then
+  AC_MSG_RESULT([none])
+else
+  AC_MSG_RESULT([$lt_cv_prog_cc_pic])
+
+  # Check to make sure the pic_flag actually works.
+  AC_MSG_CHECKING([if $compiler PIC flag $lt_cv_prog_cc_pic works])
+  AC_CACHE_VAL(lt_cv_prog_cc_pic_works, [dnl
+    save_CFLAGS="$CFLAGS"
+    CFLAGS="$CFLAGS $lt_cv_prog_cc_pic -DPIC"
+    AC_TRY_COMPILE([], [], [dnl
+      case $host_os in
+      hpux9* | hpux10* | hpux11*)
+	# On HP-UX, both CC and GCC only warn that PIC is supported... then
+	# they create non-PIC objects.  So, if there were any warnings, we
+	# assume that PIC is not supported.
+	if test -s conftest.err; then
+	  lt_cv_prog_cc_pic_works=no
+	else
+	  lt_cv_prog_cc_pic_works=yes
+	fi
+	;;
+      *)
+	lt_cv_prog_cc_pic_works=yes
+	;;
+      esac
+    ], [dnl
+      lt_cv_prog_cc_pic_works=no
+    ])
+    CFLAGS="$save_CFLAGS"
+  ])
+
+  if test "X$lt_cv_prog_cc_pic_works" = Xno; then
+    lt_cv_prog_cc_pic=
+    lt_cv_prog_cc_can_build_shared=no
+  else
+    lt_cv_prog_cc_pic=" $lt_cv_prog_cc_pic"
+  fi
+
+  AC_MSG_RESULT([$lt_cv_prog_cc_pic_works])
+fi
+##
+## END FIXME
+
+# Check for any special shared library compilation flags.
+if test -n "$lt_cv_prog_cc_shlib"; then
+  AC_MSG_WARN([\`$CC' requires \`$lt_cv_prog_cc_shlib' to build shared libraries])
+  if echo "$old_CC $old_CFLAGS " | egrep -e "[[ 	]]$lt_cv_prog_cc_shlib[[ 	]]" >/dev/null; then :
+  else
+   AC_MSG_WARN([add \`$lt_cv_prog_cc_shlib' to the CC or CFLAGS env variable and reconfigure])
+    lt_cv_prog_cc_can_build_shared=no
+  fi
+fi
+
+## FIXME: this should be a separate macro
+##
+AC_MSG_CHECKING([if $compiler static flag $lt_cv_prog_cc_static works])
+AC_CACHE_VAL([lt_cv_prog_cc_static_works], [dnl
+  lt_cv_prog_cc_static_works=no
+  save_LDFLAGS="$LDFLAGS"
+  LDFLAGS="$LDFLAGS $lt_cv_prog_cc_static"
+  AC_TRY_LINK([], [], [lt_cv_prog_cc_static_works=yes])
+  LDFLAGS="$save_LDFLAGS"
+])
+
+# Belt *and* braces to stop my trousers falling down:
+test "X$lt_cv_prog_cc_static_works" = Xno && lt_cv_prog_cc_static=
+AC_MSG_RESULT([$lt_cv_prog_cc_static_works])
+
+pic_flag="$lt_cv_prog_cc_pic"
+special_shlib_compile_flags="$lt_cv_prog_cc_shlib"
+wl="$lt_cv_prog_cc_wl"
+link_static_flag="$lt_cv_prog_cc_static"
+no_builtin_flag="$lt_cv_prog_cc_no_builtin"
+can_build_shared="$lt_cv_prog_cc_can_build_shared"
+##
+## END FIXME
+
+
+## FIXME: this should be a separate macro
+##
+# Check to see if options -o and -c are simultaneously supported by compiler
+AC_MSG_CHECKING([if $compiler supports -c -o file.$ac_objext])
+AC_CACHE_VAL([lt_cv_compiler_c_o], [
+$rm -r conftest 2>/dev/null
+mkdir conftest
+cd conftest
+echo "int some_variable = 0;" > conftest.$ac_ext
+mkdir out
+# According to Tom Tromey, Ian Lance Taylor reported there are C compilers
+# that will create temporary files in the current directory regardless of
+# the output directory.  Thus, making CWD read-only will cause this test
+# to fail, enabling locking or at least warning the user not to do parallel
+# builds.
+chmod -w .
+save_CFLAGS="$CFLAGS"
+CFLAGS="$CFLAGS -o out/conftest2.$ac_objext"
+compiler_c_o=no
+if { (eval echo configure:__oline__: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>out/conftest.err; } && test -s out/conftest2.$ac_objext; then
+  # The compiler can only warn and ignore the option if not recognized
+  # So say no if there are warnings
+  if test -s out/conftest.err; then
+    lt_cv_compiler_c_o=no
+  else
+    lt_cv_compiler_c_o=yes
+  fi
+else
+  # Append any errors to the config.log.
+  cat out/conftest.err 1>&AC_FD_CC
+  lt_cv_compiler_c_o=no
+fi
+CFLAGS="$save_CFLAGS"
+chmod u+w .
+$rm conftest* out/*
+rmdir out
+cd ..
+rmdir conftest
+$rm -r conftest 2>/dev/null
+])
+compiler_c_o=$lt_cv_compiler_c_o
+AC_MSG_RESULT([$compiler_c_o])
+
+if test x"$compiler_c_o" = x"yes"; then
+  # Check to see if we can write to a .lo
+  AC_MSG_CHECKING([if $compiler supports -c -o file.lo])
+  AC_CACHE_VAL([lt_cv_compiler_o_lo], [
+  lt_cv_compiler_o_lo=no
+  save_CFLAGS="$CFLAGS"
+  CFLAGS="$CFLAGS -c -o conftest.lo"
+  save_objext="$ac_objext"
+  ac_objext=lo
+  AC_TRY_COMPILE([], [int some_variable = 0;], [dnl
+    # The compiler can only warn and ignore the option if not recognized
+    # So say no if there are warnings
+    if test -s conftest.err; then
+      lt_cv_compiler_o_lo=no
+    else
+      lt_cv_compiler_o_lo=yes
+    fi
+  ])
+  ac_objext="$save_objext"
+  CFLAGS="$save_CFLAGS"
+  ])
+  compiler_o_lo=$lt_cv_compiler_o_lo
+  AC_MSG_RESULT([$compiler_o_lo])
+else
+  compiler_o_lo=no
+fi
+##
+## END FIXME
+
+## FIXME: this should be a separate macro
+##
+# Check to see if we can do hard links to lock some files if needed
+hard_links="nottested"
+if test "$compiler_c_o" = no && test "$need_locks" != no; then
+  # do not overwrite the value of need_locks provided by the user
+  AC_MSG_CHECKING([if we can lock with hard links])
+  hard_links=yes
+  $rm conftest*
+  ln conftest.a conftest.b 2>/dev/null && hard_links=no
+  touch conftest.a
+  ln conftest.a conftest.b 2>&5 || hard_links=no
+  ln conftest.a conftest.b 2>/dev/null && hard_links=no
+  AC_MSG_RESULT([$hard_links])
+  if test "$hard_links" = no; then
+    AC_MSG_WARN([\`$CC' does not support \`-c -o', so \`make -j' may be unsafe])
+    need_locks=warn
+  fi
+else
+  need_locks=no
+fi
+##
+## END FIXME
+
+## FIXME: this should be a separate macro
+##
+if test "$GCC" = yes; then
+  # Check to see if options -fno-rtti -fno-exceptions are supported by compiler
+  AC_MSG_CHECKING([if $compiler supports -fno-rtti -fno-exceptions])
+  echo "int some_variable = 0;" > conftest.$ac_ext
+  save_CFLAGS="$CFLAGS"
+  CFLAGS="$CFLAGS -fno-rtti -fno-exceptions -c conftest.$ac_ext"
+  compiler_rtti_exceptions=no
+  AC_TRY_COMPILE([], [int some_variable = 0;], [dnl
+    # The compiler can only warn and ignore the option if not recognized
+    # So say no if there are warnings
+    if test -s conftest.err; then
+      compiler_rtti_exceptions=no
+    else
+      compiler_rtti_exceptions=yes
+    fi
+  ])
+  CFLAGS="$save_CFLAGS"
+  AC_MSG_RESULT([$compiler_rtti_exceptions])
+
+  if test "$compiler_rtti_exceptions" = "yes"; then
+    no_builtin_flag=' -fno-builtin -fno-rtti -fno-exceptions'
+  else
+    no_builtin_flag=' -fno-builtin'
+  fi
+fi
+##
+## END FIXME
+
+## FIXME: this should be a separate macro
+##
+# See if the linker supports building shared libraries.
+AC_MSG_CHECKING([whether the linker ($LD) supports shared libraries])
+
+allow_undefined_flag=
+no_undefined_flag=
+need_lib_prefix=unknown
+need_version=unknown
+# when you set need_version to no, make sure it does not cause -set_version
+# flags to be left without arguments
+archive_cmds=
+archive_expsym_cmds=
+old_archive_from_new_cmds=
+old_archive_from_expsyms_cmds=
+export_dynamic_flag_spec=
+whole_archive_flag_spec=
+thread_safe_flag_spec=
+hardcode_into_libs=no
+hardcode_libdir_flag_spec=
+hardcode_libdir_separator=
+hardcode_direct=no
+hardcode_minus_L=no
+hardcode_shlibpath_var=unsupported
+runpath_var=
+link_all_deplibs=unknown
+always_export_symbols=no
+export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | sed '\''s/.* //'\'' | sort | uniq > $export_symbols'
+# include_expsyms should be a list of space-separated symbols to be *always*
+# included in the symbol list
+include_expsyms=
+# exclude_expsyms can be an egrep regular expression of symbols to exclude
+# it will be wrapped by ` (' and `)$', so one must not match beginning or
+# end of line.  Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc',
+# as well as any symbol that contains `d'.
+exclude_expsyms="_GLOBAL_OFFSET_TABLE_"
+# Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out
+# platforms (ab)use it in PIC code, but their linkers get confused if
+# the symbol is explicitly referenced.  Since portable code cannot
+# rely on this symbol name, it's probably fine to never include it in
+# preloaded symbol tables.
+extract_expsyms_cmds=
+
+case $host_os in
+cygwin* | mingw* | pw32*)
+  # FIXME: the MSVC++ port hasn't been tested in a loooong time
+  # When not using gcc, we currently assume that we are using
+  # Microsoft Visual C++.
+  if test "$GCC" != yes; then
+    with_gnu_ld=no
+  fi
+  ;;
+openbsd*)
+  with_gnu_ld=no
+  ;;
+esac
+
+ld_shlibs=yes
+if test "$with_gnu_ld" = yes; then
+  # If archive_cmds runs LD, not CC, wlarc should be empty
+  wlarc='${wl}'
+
+  # See if GNU ld supports shared libraries.
+  case $host_os in
+  aix3* | aix4* | aix5*)
+    # On AIX, the GNU linker is very broken
+    # Note:Check GNU linker on AIX 5-IA64 when/if it becomes available.
+    ld_shlibs=no
+    cat <<EOF 1>&2
+
+*** Warning: the GNU linker, at least up to release 2.9.1, is reported
+*** to be unable to reliably create shared libraries on AIX.
+*** Therefore, libtool is disabling shared libraries support.  If you
+*** really care for shared libraries, you may want to modify your PATH
+*** so that a non-GNU linker is found, and then restart.
+
+EOF
+    ;;
+
+  amigaos*)
+    archive_cmds='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
+    hardcode_libdir_flag_spec='-L$libdir'
+    hardcode_minus_L=yes
+
+    # Samuel A. Falvo II <kc5tja@dolphin.openprojects.net> reports
+    # that the semantics of dynamic libraries on AmigaOS, at least up
+    # to version 4, is to share data among multiple programs linked
+    # with the same dynamic library.  Since this doesn't match the
+    # behavior of shared libraries on other platforms, we can use
+    # them.
+    ld_shlibs=no
+    ;;
+
+  beos*)
+    if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then
+      allow_undefined_flag=unsupported
+      # Joseph Beckenbach <jrb3@best.com> says some releases of gcc
+      # support --undefined.  This deserves some investigation.  FIXME
+      archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+    else
+      ld_shlibs=no
+    fi
+    ;;
+
+  cygwin* | mingw* | pw32*)
+    # hardcode_libdir_flag_spec is actually meaningless, as there is
+    # no search path for DLLs.
+    hardcode_libdir_flag_spec='-L$libdir'
+    allow_undefined_flag=unsupported
+    always_export_symbols=yes
+
+    extract_expsyms_cmds='test -f $output_objdir/impgen.c || \
+      sed -e "/^# \/\* impgen\.c starts here \*\//,/^# \/\* impgen.c ends here \*\// { s/^# //;s/^# *$//; p; }" -e d < $''0 > $output_objdir/impgen.c~
+      test -f $output_objdir/impgen.exe || (cd $output_objdir && \
+      if test "x$HOST_CC" != "x" ; then $HOST_CC -o impgen impgen.c ; \
+      else $CC -o impgen impgen.c ; fi)~
+      $output_objdir/impgen $dir/$soroot > $output_objdir/$soname-def'
+
+    old_archive_from_expsyms_cmds='$DLLTOOL --as=$AS --dllname $soname --def $output_objdir/$soname-def --output-lib $output_objdir/$newlib'
+
+    # cygwin and mingw dlls have different entry points and sets of symbols
+    # to exclude.
+    # FIXME: what about values for MSVC?
+    dll_entry=__cygwin_dll_entry@12
+    dll_exclude_symbols=DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12~
+    case $host_os in
+    mingw*)
+      # mingw values
+      dll_entry=_DllMainCRTStartup@12
+      dll_exclude_symbols=DllMain@12,DllMainCRTStartup@12,DllEntryPoint@12~
+      ;;
+    esac
+
+    # mingw and cygwin differ, and it's simplest to just exclude the union
+    # of the two symbol sets.
+    dll_exclude_symbols=DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12,DllMainCRTStartup@12,DllEntryPoint@12
+
+    # recent cygwin and mingw systems supply a stub DllMain which the user
+    # can override, but on older systems we have to supply one (in ltdll.c)
+    if test "x$lt_cv_need_dllmain" = "xyes"; then
+      ltdll_obj='$output_objdir/$soname-ltdll.'"$ac_objext "
+      ltdll_cmds='test -f $output_objdir/$soname-ltdll.c || sed -e "/^# \/\* ltdll\.c starts here \*\//,/^# \/\* ltdll.c ends here \*\// { s/^# //; p; }" -e d < $''0 > $output_objdir/$soname-ltdll.c~
+	test -f $output_objdir/$soname-ltdll.$ac_objext || (cd $output_objdir && $CC -c $soname-ltdll.c)~'
+    else
+      ltdll_obj=
+      ltdll_cmds=
+    fi
+
+    # Extract the symbol export list from an `--export-all' def file,
+    # then regenerate the def file from the symbol export list, so that
+    # the compiled dll only exports the symbol export list.
+    # Be careful not to strip the DATA tag left be newer dlltools.
+    export_symbols_cmds="$ltdll_cmds"'
+      $DLLTOOL --export-all --exclude-symbols '$dll_exclude_symbols' --output-def $output_objdir/$soname-def '$ltdll_obj'$libobjs $convenience~
+      sed -e "1,/EXPORTS/d" -e "s/ @ [[0-9]]*//" -e "s/ *;.*$//" < $output_objdir/$soname-def > $export_symbols'
+
+    # If the export-symbols file already is a .def file (1st line
+    # is EXPORTS), use it as is.
+    # If DATA tags from a recent dlltool are present, honour them!
+    archive_expsym_cmds='if test "x`sed 1q $export_symbols`" = xEXPORTS; then
+	cp $export_symbols $output_objdir/$soname-def;
+      else
+	echo EXPORTS > $output_objdir/$soname-def;
+	_lt_hint=1;
+	cat $export_symbols | while read symbol; do
+	 set dummy \$symbol;
+	 case \[$]# in
+	   2) echo "   \[$]2 @ \$_lt_hint ; " >> $output_objdir/$soname-def;;
+	   4) echo "   \[$]2 \[$]3 \[$]4 ; " >> $output_objdir/$soname-def; _lt_hint=`expr \$_lt_hint - 1`;;
+	   *) echo "     \[$]2 @ \$_lt_hint \[$]3 ; " >> $output_objdir/$soname-def;;
+	 esac;
+	 _lt_hint=`expr 1 + \$_lt_hint`;
+	done;
+      fi~
+      '"$ltdll_cmds"'
+      $CC -Wl,--base-file,$output_objdir/$soname-base '$lt_cv_cc_dll_switch' -Wl,-e,'$dll_entry' -o $output_objdir/$soname '$ltdll_obj'$libobjs $deplibs $compiler_flags~
+      $DLLTOOL --as=$AS --dllname $soname --exclude-symbols '$dll_exclude_symbols' --def $output_objdir/$soname-def --base-file $output_objdir/$soname-base --output-exp $output_objdir/$soname-exp~
+      $CC -Wl,--base-file,$output_objdir/$soname-base $output_objdir/$soname-exp '$lt_cv_cc_dll_switch' -Wl,-e,'$dll_entry' -o $output_objdir/$soname '$ltdll_obj'$libobjs $deplibs $compiler_flags~
+      $DLLTOOL --as=$AS --dllname $soname --exclude-symbols '$dll_exclude_symbols' --def $output_objdir/$soname-def --base-file $output_objdir/$soname-base --output-exp $output_objdir/$soname-exp --output-lib $output_objdir/$libname.dll.a~
+      $CC $output_objdir/$soname-exp '$lt_cv_cc_dll_switch' -Wl,-e,'$dll_entry' -o $output_objdir/$soname '$ltdll_obj'$libobjs $deplibs $compiler_flags'
+    ;;
+
+  netbsd*)
+    if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
+      archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib'
+      wlarc=
+    else
+      archive_cmds='$CC -shared -nodefaultlibs $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+      archive_expsym_cmds='$CC -shared -nodefaultlibs $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+    fi
+    ;;
+
+  solaris* | sysv5*)
+    if $LD -v 2>&1 | egrep 'BFD 2\.8' > /dev/null; then
+      ld_shlibs=no
+      cat <<EOF 1>&2
+
+*** Warning: The releases 2.8.* of the GNU linker cannot reliably
+*** create shared libraries on Solaris systems.  Therefore, libtool
+*** is disabling shared libraries support.  We urge you to upgrade GNU
+*** binutils to release 2.9.1 or newer.  Another option is to modify
+*** your PATH or compiler configuration so that the native linker is
+*** used, and then restart.
+
+EOF
+    elif $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then
+      archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+      archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+    else
+      ld_shlibs=no
+    fi
+    ;;
+
+  sunos4*)
+    archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+    wlarc=
+    hardcode_direct=yes
+    hardcode_shlibpath_var=no
+    ;;
+
+  *)
+    if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then
+      archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+      archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+    else
+      ld_shlibs=no
+    fi
+    ;;
+  esac
+
+  if test "$ld_shlibs" = yes; then
+    runpath_var=
+    hardcode_libdir_flag_spec=
+    export_dynamic_flag_spec='${wl}--export-dynamic'
+    case $host_os in
+    cygwin* | mingw* | pw32*)
+      # dlltool doesn't understand --whole-archive et. al.
+      whole_archive_flag_spec=
+      ;;
+    *)
+      # ancient GNU ld didn't support --whole-archive et. al.
+      if $LD --help 2>&1 | egrep 'no-whole-archive' > /dev/null; then
+	whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+      else
+	whole_archive_flag_spec=
+      fi
+      ;;
+    esac
+  fi
+else
+  # PORTME fill in a description of your system's linker (not GNU ld)
+  case $host_os in
+  aix3*)
+    allow_undefined_flag=unsupported
+    always_export_symbols=yes
+    archive_expsym_cmds='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname'
+    # Note: this linker hardcodes the directories in LIBPATH if there
+    # are no directories specified by -L.
+    hardcode_minus_L=yes
+    if test "$GCC" = yes && test -z "$link_static_flag"; then
+      # Neither direct hardcoding nor static linking is supported with a
+      # broken collect2.
+      hardcode_direct=unsupported
+    fi
+    ;;
+
+  aix4* | aix5*)
+    if test "$host_cpu" = ia64; then
+      # On IA64, the linker does run time linking by default, so we don't
+      # have to do anything special.
+      aix_use_runtimelinking=no
+      exp_sym_flag='-Bexport'
+      no_entry_flag=""
+    else
+      aix_use_runtimelinking=no
+
+      # Test if we are trying to use run time linking or normal
+      # AIX style linking. If -brtl is somewhere in LDFLAGS, we
+      # need to do runtime linking.
+      case $host_os in aix4.[[23]]|aix4.[[23]].*|aix5*)
+	for ld_flag in $LDFLAGS; do
+	  case $ld_flag in
+	  *-brtl*)
+	    aix_use_runtimelinking=yes
+	    break
+	  ;;
+	  esac
+	done
+      esac
+
+      exp_sym_flag='-bexport'
+      no_entry_flag='-bnoentry'
+    fi
+
+    # When large executables or shared objects are built, AIX ld can
+    # have problems creating the table of contents.  If linking a library
+    # or program results in "error TOC overflow" add -mminimal-toc to
+    # CXXFLAGS/CFLAGS for g++/gcc.  In the cases where that is not
+    # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS.
+
+    hardcode_direct=yes
+    archive_cmds=''
+    hardcode_libdir_separator=':'
+    if test "$GCC" = yes; then
+      case $host_os in aix4.[[012]]|aix4.[[012]].*)
+	collect2name=`${CC} -print-prog-name=collect2`
+	if test -f "$collect2name" && \
+	  strings "$collect2name" | grep resolve_lib_name >/dev/null
+	then
+	  # We have reworked collect2
+	  hardcode_direct=yes
+	else
+	  # We have old collect2
+	  hardcode_direct=unsupported
+	  # It fails to find uninstalled libraries when the uninstalled
+	  # path is not listed in the libpath.  Setting hardcode_minus_L
+	  # to unsupported forces relinking
+	  hardcode_minus_L=yes
+	  hardcode_libdir_flag_spec='-L$libdir'
+	  hardcode_libdir_separator=
+	fi
+      esac
+
+      shared_flag='-shared'
+    else
+      # not using gcc
+      if test "$host_cpu" = ia64; then
+	shared_flag='${wl}-G'
+      else
+	if test "$aix_use_runtimelinking" = yes; then
+	  shared_flag='${wl}-G'
+	else
+	  shared_flag='${wl}-bM:SRE'
+	fi
+      fi
+    fi
+
+    # It seems that -bexpall can do strange things, so it is better to
+    # generate a list of symbols to export.
+    always_export_symbols=yes
+    if test "$aix_use_runtimelinking" = yes; then
+      # Warning - without using the other runtime loading flags (-brtl),
+      # -berok will link without error, but may produce a broken library.
+      allow_undefined_flag='-berok'
+      hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:/usr/lib:/lib'
+      archive_expsym_cmds="\$CC"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols $shared_flag"
+    else
+      if test "$host_cpu" = ia64; then
+	hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib'
+	allow_undefined_flag="-z nodefs"
+	archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname ${wl}-h$soname $libobjs $deplibs $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols"
+      else
+	hardcode_libdir_flag_spec='${wl}-bnolibpath ${wl}-blibpath:$libdir:/usr/lib:/lib'
+	# Warning - without using the other run time loading flags,
+	# -berok will link without error, but may produce a broken library.
+	allow_undefined_flag='${wl}-berok'
+	# This is a bit strange, but is similar to how AIX traditionally builds
+	# it's shared libraries.
+	archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols"' ~$AR -crlo $objdir/$libname$release.a $objdir/$soname'
+      fi
+    fi
+    ;;
+
+  amigaos*)
+    archive_cmds='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
+    hardcode_libdir_flag_spec='-L$libdir'
+    hardcode_minus_L=yes
+    # see comment about different semantics on the GNU ld section
+    ld_shlibs=no
+    ;;
+
+  cygwin* | mingw* | pw32*)
+    # When not using gcc, we currently assume that we are using
+    # Microsoft Visual C++.
+    # hardcode_libdir_flag_spec is actually meaningless, as there is
+    # no search path for DLLs.
+    hardcode_libdir_flag_spec=' '
+    allow_undefined_flag=unsupported
+    # Tell ltmain to make .lib files, not .a files.
+    libext=lib
+    # FIXME: Setting linknames here is a bad hack.
+    archive_cmds='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | sed -e '\''s/ -lc$//'\''` -link -dll~linknames='
+    # The linker will automatically build a .lib file if we build a DLL.
+    old_archive_from_new_cmds='true'
+    # FIXME: Should let the user specify the lib program.
+    old_archive_cmds='lib /OUT:$oldlib$oldobjs$old_deplibs'
+    fix_srcfile_path='`cygpath -w "$srcfile"`'
+    ;;
+
+  darwin* | rhapsody*)
+    case "$host_os" in
+    rhapsody* | darwin1.[[012]])
+      allow_undefined_flag='-undefined suppress'
+      ;;
+    *) # Darwin 1.3 on
+      allow_undefined_flag='-flat_namespace -undefined suppress'
+      ;;
+    esac
+    # FIXME: Relying on posixy $() will cause problems for
+    #        cross-compilation, but unfortunately the echo tests do not
+    #        yet detect zsh echo's removal of \ escapes.  Also zsh mangles
+    #	     `"' quotes if we put them in here... so don't!
+    archive_cmds='$CC -r -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs && $CC $(test .$module = .yes && echo -bundle || echo -dynamiclib) $allow_undefined_flag -o $lib ${lib}-master.o $deplibs$linker_flags $(test .$module != .yes && echo -install_name $rpath/$soname $verstring)'
+    # We need to add '_' to the symbols in $export_symbols first
+    #archive_expsym_cmds="$archive_cmds"' && strip -s $export_symbols'
+    hardcode_direct=yes
+    hardcode_shlibpath_var=no
+    whole_archive_flag_spec='-all_load $convenience'
+    ;;
+
+  freebsd1*)
+    ld_shlibs=no
+    ;;
+
+  # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor
+  # support.  Future versions do this automatically, but an explicit c++rt0.o
+  # does not break anything, and helps significantly (at the cost of a little
+  # extra space).
+  freebsd2.2*)
+    archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o'
+    hardcode_libdir_flag_spec='-R$libdir'
+    hardcode_direct=yes
+    hardcode_shlibpath_var=no
+    ;;
+
+  # Unfortunately, older versions of FreeBSD 2 do not have this feature.
+  freebsd2*)
+    archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+    hardcode_direct=yes
+    hardcode_minus_L=yes
+    hardcode_shlibpath_var=no
+    ;;
+
+  # FreeBSD 3 and greater uses gcc -shared to do shared libraries.
+  freebsd*)
+    archive_cmds='$CC -shared -o $lib $libobjs $deplibs $compiler_flags'
+    hardcode_libdir_flag_spec='-R$libdir'
+    hardcode_direct=yes
+    hardcode_shlibpath_var=no
+    ;;
+
+  hpux9* | hpux10* | hpux11*)
+    case $host_os in
+    hpux9*) archive_cmds='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' ;;
+    *) archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' ;;
+    esac
+    hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
+    hardcode_libdir_separator=:
+    hardcode_direct=yes
+    hardcode_minus_L=yes # Not in the search PATH, but as the default
+			 # location of the library.
+    export_dynamic_flag_spec='${wl}-E'
+    ;;
+
+  irix5* | irix6* | nonstopux*)
+    if test "$GCC" = yes; then
+      archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+      hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+    else
+      archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
+      hardcode_libdir_flag_spec='-rpath $libdir'
+    fi
+    hardcode_libdir_separator=:
+    link_all_deplibs=yes
+    ;;
+
+  netbsd*)
+    if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
+      archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'  # a.out
+    else
+      archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linker_flags'      # ELF
+    fi
+    hardcode_libdir_flag_spec='-R$libdir'
+    hardcode_direct=yes
+    hardcode_shlibpath_var=no
+    ;;
+
+  newsos6)
+    archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+    hardcode_direct=yes
+    hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+    hardcode_libdir_separator=:
+    hardcode_shlibpath_var=no
+    ;;
+
+  openbsd*)
+    hardcode_direct=yes
+    hardcode_shlibpath_var=no
+    if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+      archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+      hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
+      export_dynamic_flag_spec='${wl}-E'
+    else
+      case "$host_os" in
+      openbsd[[01]].* | openbsd2.[[0-7]] | openbsd2.[[0-7]].*)
+	archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+	hardcode_libdir_flag_spec='-R$libdir'
+        ;;
+      *)
+        archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+        hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
+        ;;
+      esac
+    fi
+    ;;
+
+  os2*)
+    hardcode_libdir_flag_spec='-L$libdir'
+    hardcode_minus_L=yes
+    allow_undefined_flag=unsupported
+    archive_cmds='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def'
+    old_archive_from_new_cmds='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def'
+    ;;
+
+  osf3*)
+    if test "$GCC" = yes; then
+      allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
+      archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+    else
+      allow_undefined_flag=' -expect_unresolved \*'
+      archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
+    fi
+    hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+    hardcode_libdir_separator=:
+    ;;
+
+  osf4* | osf5*)	# as osf3* with the addition of -msym flag
+    if test "$GCC" = yes; then
+      allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
+      archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+      hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+    else
+      allow_undefined_flag=' -expect_unresolved \*'
+      archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
+      archive_expsym_cmds='for i in `cat $export_symbols`; do printf "-exported_symbol " >> $lib.exp; echo "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~
+      $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib~$rm $lib.exp'
+
+      #Both c and cxx compiler support -rpath directly
+      hardcode_libdir_flag_spec='-rpath $libdir'
+    fi
+    hardcode_libdir_separator=:
+    ;;
+
+  sco3.2v5*)
+    archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+    hardcode_shlibpath_var=no
+    runpath_var=LD_RUN_PATH
+    hardcode_runpath_var=yes
+    export_dynamic_flag_spec='${wl}-Bexport'
+    ;;
+
+  solaris*)
+    # gcc --version < 3.0 without binutils cannot create self contained
+    # shared libraries reliably, requiring libgcc.a to resolve some of
+    # the object symbols generated in some cases.  Libraries that use
+    # assert need libgcc.a to resolve __eprintf, for example.  Linking
+    # a copy of libgcc.a into every shared library to guarantee resolving
+    # such symbols causes other problems:  According to Tim Van Holder
+    # <tim.van.holder@pandora.be>, C++ libraries end up with a separate
+    # (to the application) exception stack for one thing.
+    no_undefined_flag=' -z defs'
+    if test "$GCC" = yes; then
+      case `$CC --version 2>/dev/null` in
+      [[12]].*)
+	cat <<EOF 1>&2
+
+*** Warning: Releases of GCC earlier than version 3.0 cannot reliably
+*** create self contained shared libraries on Solaris systems, without
+*** introducing a dependency on libgcc.a.  Therefore, libtool is disabling
+*** -no-undefined support, which will at least allow you to build shared
+*** libraries.  However, you may find that when you link such libraries
+*** into an application without using GCC, you have to manually add
+*** \`gcc --print-libgcc-file-name\` to the link command.  We urge you to
+*** upgrade to a newer version of GCC.  Another option is to rebuild your
+*** current GCC to use the GNU linker from GNU binutils 2.9.1 or newer.
+
+EOF
+        no_undefined_flag=
+	;;
+      esac
+    fi
+    # $CC -shared without GNU ld will not create a library from C++
+    # object files and a static libstdc++, better avoid it by now
+    archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags'
+    archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
+		$LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp'
+    hardcode_libdir_flag_spec='-R$libdir'
+    hardcode_shlibpath_var=no
+    case $host_os in
+    solaris2.[[0-5]] | solaris2.[[0-5]].*) ;;
+    *) # Supported since Solaris 2.6 (maybe 2.5.1?)
+      whole_archive_flag_spec='-z allextract$convenience -z defaultextract' ;;
+    esac
+    link_all_deplibs=yes
+    ;;
+
+  sunos4*)
+    if test "x$host_vendor" = xsequent; then
+      # Use $CC to link under sequent, because it throws in some extra .o
+      # files that make .init and .fini sections work.
+      archive_cmds='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags'
+    else
+      archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags'
+    fi
+    hardcode_libdir_flag_spec='-L$libdir'
+    hardcode_direct=yes
+    hardcode_minus_L=yes
+    hardcode_shlibpath_var=no
+    ;;
+
+  sysv4)
+    case $host_vendor in
+      sni)
+        archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+        hardcode_direct=yes # is this really true???
+        ;;
+      siemens)
+        ## LD is ld it makes a PLAMLIB
+        ## CC just makes a GrossModule.
+        archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags'
+        reload_cmds='$CC -r -o $output$reload_objs'
+        hardcode_direct=no
+        ;;
+      motorola)
+        archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+        hardcode_direct=no #Motorola manual says yes, but my tests say they lie
+        ;;
+    esac
+    runpath_var='LD_RUN_PATH'
+    hardcode_shlibpath_var=no
+    ;;
+
+  sysv4.3*)
+    archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+    hardcode_shlibpath_var=no
+    export_dynamic_flag_spec='-Bexport'
+    ;;
+
+  sysv5*)
+    no_undefined_flag=' -z text'
+    # $CC -shared without GNU ld will not create a library from C++
+    # object files and a static libstdc++, better avoid it by now
+    archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags'
+    archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
+		$LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp'
+    hardcode_libdir_flag_spec=
+    hardcode_shlibpath_var=no
+    runpath_var='LD_RUN_PATH'
+    ;;
+
+  uts4*)
+    archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+    hardcode_libdir_flag_spec='-L$libdir'
+    hardcode_shlibpath_var=no
+    ;;
+
+  dgux*)
+    archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+    hardcode_libdir_flag_spec='-L$libdir'
+    hardcode_shlibpath_var=no
+    ;;
+
+  sysv4*MP*)
+    if test -d /usr/nec; then
+      archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      hardcode_shlibpath_var=no
+      runpath_var=LD_RUN_PATH
+      hardcode_runpath_var=yes
+      ld_shlibs=yes
+    fi
+    ;;
+
+  sysv4.2uw2*)
+    archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags'
+    hardcode_direct=yes
+    hardcode_minus_L=no
+    hardcode_shlibpath_var=no
+    hardcode_runpath_var=yes
+    runpath_var=LD_RUN_PATH
+    ;;
+
+  sysv5uw7* | unixware7*)
+    no_undefined_flag='${wl}-z ${wl}text'
+    if test "$GCC" = yes; then
+      archive_cmds='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+    else
+      archive_cmds='$CC -G ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+    fi
+    runpath_var='LD_RUN_PATH'
+    hardcode_shlibpath_var=no
+    ;;
+
+  *)
+    ld_shlibs=no
+    ;;
+  esac
+fi
+AC_MSG_RESULT([$ld_shlibs])
+test "$ld_shlibs" = no && can_build_shared=no
+##
+## END FIXME
+
+## FIXME: this should be a separate macro
+##
+# Check hardcoding attributes.
+AC_MSG_CHECKING([how to hardcode library paths into programs])
+hardcode_action=
+if test -n "$hardcode_libdir_flag_spec" || \
+   test -n "$runpath_var"; then
+
+  # We can hardcode non-existant directories.
+  if test "$hardcode_direct" != no &&
+     # If the only mechanism to avoid hardcoding is shlibpath_var, we
+     # have to relink, otherwise we might link with an installed library
+     # when we should be linking with a yet-to-be-installed one
+     ## test "$hardcode_shlibpath_var" != no &&
+     test "$hardcode_minus_L" != no; then
+    # Linking always hardcodes the temporary library directory.
+    hardcode_action=relink
+  else
+    # We can link without hardcoding, and we can hardcode nonexisting dirs.
+    hardcode_action=immediate
+  fi
+else
+  # We cannot hardcode anything, or else we can only hardcode existing
+  # directories.
+  hardcode_action=unsupported
+fi
+AC_MSG_RESULT([$hardcode_action])
+##
+## END FIXME
+
+## FIXME: this should be a separate macro
+##
+striplib=
+old_striplib=
+AC_MSG_CHECKING([whether stripping libraries is possible])
+if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then
+  test -z "$old_striplib" && old_striplib="$STRIP --strip-debug"
+  test -z "$striplib" && striplib="$STRIP --strip-unneeded"
+  AC_MSG_RESULT([yes])
+else
+  AC_MSG_RESULT([no])
+fi
+##
+## END FIXME
+
+reload_cmds='$LD$reload_flag -o $output$reload_objs'
+test -z "$deplibs_check_method" && deplibs_check_method=unknown
+
+## FIXME: this should be a separate macro
+##
+# PORTME Fill in your ld.so characteristics
+AC_MSG_CHECKING([dynamic linker characteristics])
+library_names_spec=
+libname_spec='lib$name'
+soname_spec=
+postinstall_cmds=
+postuninstall_cmds=
+finish_cmds=
+finish_eval=
+shlibpath_var=
+shlibpath_overrides_runpath=unknown
+version_type=none
+dynamic_linker="$host_os ld.so"
+sys_lib_dlsearch_path_spec="/lib /usr/lib"
+sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib"
+
+case $host_os in
+aix3*)
+  version_type=linux
+  library_names_spec='${libname}${release}.so$versuffix $libname.a'
+  shlibpath_var=LIBPATH
+
+  # AIX has no versioning support, so we append a major version to the name.
+  soname_spec='${libname}${release}.so$major'
+  ;;
+
+aix4* | aix5*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  hardcode_into_libs=yes
+  if test "$host_cpu" = ia64; then
+    # AIX 5 supports IA64
+    library_names_spec='${libname}${release}.so$major ${libname}${release}.so$versuffix $libname.so'
+    shlibpath_var=LD_LIBRARY_PATH
+  else
+    # With GCC up to 2.95.x, collect2 would create an import file
+    # for dependence libraries.  The import file would start with
+    # the line `#! .'.  This would cause the generated library to
+    # depend on `.', always an invalid library.  This was fixed in
+    # development snapshots of GCC prior to 3.0.
+    case $host_os in
+      aix4 | aix4.[[01]] | aix4.[[01]].*)
+	if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)'
+	     echo ' yes '
+	     echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then
+	  :
+	else
+	  can_build_shared=no
+	fi
+	;;
+    esac
+    # AIX (on Power*) has no versioning support, so currently we can
+    # not hardcode correct soname into executable. Probably we can
+    # add versioning support to collect2, so additional links can
+    # be useful in future.
+    if test "$aix_use_runtimelinking" = yes; then
+      # If using run time linking (on AIX 4.2 or later) use lib<name>.so
+      # instead of lib<name>.a to let people know that these are not
+      # typical AIX shared libraries.
+      library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
+    else
+      # We preserve .a as extension for shared libraries through AIX4.2
+      # and later when we are not doing run time linking.
+      library_names_spec='${libname}${release}.a $libname.a'
+      soname_spec='${libname}${release}.so$major'
+    fi
+    shlibpath_var=LIBPATH
+  fi
+  hardcode_into_libs=yes
+  ;;
+
+amigaos*)
+  library_names_spec='$libname.ixlibrary $libname.a'
+  # Create ${libname}_ixlibrary.a entries in /sys/libs.
+  finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([[^/]]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "(cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a)"; (cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a) || exit 1; done'
+  ;;
+
+beos*)
+  library_names_spec='${libname}.so'
+  dynamic_linker="$host_os ld.so"
+  shlibpath_var=LIBRARY_PATH
+  ;;
+
+bsdi4*)
+  version_type=linux
+  need_version=no
+  library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
+  soname_spec='${libname}${release}.so$major'
+  finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib"
+  sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib"
+  export_dynamic_flag_spec=-rdynamic
+  # the default ld.so.conf also contains /usr/contrib/lib and
+  # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow
+  # libtool to hard-code these into programs
+  ;;
+
+cygwin* | mingw* | pw32*)
+  version_type=windows
+  need_version=no
+  need_lib_prefix=no
+  case $GCC,$host_os in
+  yes,cygwin*)
+    library_names_spec='$libname.dll.a'
+    soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | sed -e 's/[[.]]/-/g'`${versuffix}.dll'
+    postinstall_cmds='dlpath=`bash 2>&1 -c '\''. $dir/${file}i;echo \$dlname'\''`~
+      dldir=$destdir/`dirname \$dlpath`~
+      test -d \$dldir || mkdir -p \$dldir~
+      $install_prog .libs/$dlname \$dldir/$dlname'
+    postuninstall_cmds='dldll=`bash 2>&1 -c '\''. $file; echo \$dlname'\''`~
+      dlpath=$dir/\$dldll~
+       $rm \$dlpath'
+    ;;
+  yes,mingw*)
+    library_names_spec='${libname}`echo ${release} | sed -e 's/[[.]]/-/g'`${versuffix}.dll'
+    sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | sed -e "s/^libraries://" -e "s/;/ /g" -e "s,=/,/,g"`
+    ;;
+  yes,pw32*)
+    library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | sed -e 's/[.]/-/g'`${versuffix}.dll'
+    ;;
+  *)
+    library_names_spec='${libname}`echo ${release} | sed -e 's/[[.]]/-/g'`${versuffix}.dll $libname.lib'
+    ;;
+  esac
+  dynamic_linker='Win32 ld.exe'
+  # FIXME: first we should search . and the directory the executable is in
+  shlibpath_var=PATH
+  ;;
+
+darwin* | rhapsody*)
+  dynamic_linker="$host_os dyld"
+  version_type=darwin
+  need_lib_prefix=no
+  need_version=no
+  # FIXME: Relying on posixy $() will cause problems for
+  #        cross-compilation, but unfortunately the echo tests do not
+  #        yet detect zsh echo's removal of \ escapes.
+  library_names_spec='${libname}${release}${versuffix}.$(test .$module = .yes && echo so || echo dylib) ${libname}${release}${major}.$(test .$module = .yes && echo so || echo dylib) ${libname}.$(test .$module = .yes && echo so || echo dylib)'
+  soname_spec='${libname}${release}${major}.$(test .$module = .yes && echo so || echo dylib)'
+  shlibpath_overrides_runpath=yes
+  shlibpath_var=DYLD_LIBRARY_PATH
+  ;;
+
+freebsd1*)
+  dynamic_linker=no
+  ;;
+
+freebsd*)
+  objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout`
+  version_type=freebsd-$objformat
+  case $version_type in
+    freebsd-elf*)
+      library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so $libname.so'
+      need_version=no
+      need_lib_prefix=no
+      ;;
+    freebsd-*)
+      library_names_spec='${libname}${release}.so$versuffix $libname.so$versuffix'
+      need_version=yes
+      ;;
+  esac
+  shlibpath_var=LD_LIBRARY_PATH
+  case $host_os in
+  freebsd2*)
+    shlibpath_overrides_runpath=yes
+    ;;
+  *)
+    shlibpath_overrides_runpath=no
+    hardcode_into_libs=yes
+    ;;
+  esac
+  ;;
+
+gnu*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so${major} ${libname}.so'
+  soname_spec='${libname}${release}.so$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  hardcode_into_libs=yes
+  ;;
+
+hpux9* | hpux10* | hpux11*)
+  # Give a soname corresponding to the major version so that dld.sl refuses to
+  # link against other versions.
+  dynamic_linker="$host_os dld.sl"
+  version_type=sunos
+  need_lib_prefix=no
+  need_version=no
+  shlibpath_var=SHLIB_PATH
+  shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH
+  library_names_spec='${libname}${release}.sl$versuffix ${libname}${release}.sl$major $libname.sl'
+  soname_spec='${libname}${release}.sl$major'
+  # HP-UX runs *really* slowly unless shared libraries are mode 555.
+  postinstall_cmds='chmod 555 $lib'
+  ;;
+
+irix5* | irix6* | nonstopux*)
+  case $host_os in
+    nonstopux*) version_type=nonstopux ;;
+    *)          version_type=irix ;;
+  esac
+  need_lib_prefix=no
+  need_version=no
+  soname_spec='${libname}${release}.so$major'
+  library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major ${libname}${release}.so $libname.so'
+  case $host_os in
+  irix5* | nonstopux*)
+    libsuff= shlibsuff=
+    ;;
+  *)
+    case $LD in # libtool.m4 will add one of these switches to LD
+    *-32|*"-32 ") libsuff= shlibsuff= libmagic=32-bit;;
+    *-n32|*"-n32 ") libsuff=32 shlibsuff=N32 libmagic=N32;;
+    *-64|*"-64 ") libsuff=64 shlibsuff=64 libmagic=64-bit;;
+    *) libsuff= shlibsuff= libmagic=never-match;;
+    esac
+    ;;
+  esac
+  shlibpath_var=LD_LIBRARY${shlibsuff}_PATH
+  shlibpath_overrides_runpath=no
+  sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}"
+  sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}"
+  ;;
+
+# No shared lib support for Linux oldld, aout, or coff.
+linux-gnuoldld* | linux-gnuaout* | linux-gnucoff*)
+  dynamic_linker=no
+  ;;
+
+# This must be Linux ELF.
+linux-gnu*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
+  soname_spec='${libname}${release}.so$major'
+  finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  # This implies no fast_install, which is unacceptable.
+  # Some rework will be needed to allow for fast_install
+  # before this can be enabled.
+  hardcode_into_libs=yes
+
+  # We used to test for /lib/ld.so.1 and disable shared libraries on
+  # powerpc, because MkLinux only supported shared libraries with the
+  # GNU dynamic linker.  Since this was broken with cross compilers,
+  # most powerpc-linux boxes support dynamic linking these days and
+  # people can always --disable-shared, the test was removed, and we
+  # assume the GNU/Linux dynamic linker is in use.
+  dynamic_linker='GNU/Linux ld.so'
+  ;;
+
+netbsd*)
+  version_type=sunos
+  need_lib_prefix=no
+  need_version=no
+  if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
+    library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix'
+    finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
+    dynamic_linker='NetBSD (a.out) ld.so'
+  else
+    library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major ${libname}${release}.so ${libname}.so'
+    soname_spec='${libname}${release}.so$major'
+    dynamic_linker='NetBSD ld.elf_so'
+  fi
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  hardcode_into_libs=yes
+  ;;
+
+newsos6)
+  version_type=linux
+  library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  ;;
+
+openbsd*)
+  version_type=sunos
+  need_lib_prefix=no
+  need_version=no
+  if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+    case "$host_os" in
+    openbsd2.[[89]] | openbsd2.[[89]].*)
+      shlibpath_overrides_runpath=no
+      ;;
+    *)
+      shlibpath_overrides_runpath=yes
+      ;;
+    esac
+  else
+    shlibpath_overrides_runpath=yes
+  fi
+  library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix'
+  finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  ;;
+
+os2*)
+  libname_spec='$name'
+  need_lib_prefix=no
+  library_names_spec='$libname.dll $libname.a'
+  dynamic_linker='OS/2 ld.exe'
+  shlibpath_var=LIBPATH
+  ;;
+
+osf3* | osf4* | osf5*)
+  version_type=osf
+  need_version=no
+  soname_spec='${libname}${release}.so$major'
+  library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
+  shlibpath_var=LD_LIBRARY_PATH
+  sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib"
+  sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec"
+  hardcode_into_libs=yes
+  ;;
+
+sco3.2v5*)
+  version_type=osf
+  soname_spec='${libname}${release}.so$major'
+  library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
+  shlibpath_var=LD_LIBRARY_PATH
+  ;;
+
+solaris*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
+  soname_spec='${libname}${release}.so$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  hardcode_into_libs=yes
+  # ldd complains unless libraries are executable
+  postinstall_cmds='chmod +x $lib'
+  ;;
+
+sunos4*)
+  version_type=sunos
+  library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix'
+  finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  if test "$with_gnu_ld" = yes; then
+    need_lib_prefix=no
+  fi
+  need_version=yes
+  ;;
+
+sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
+  version_type=linux
+  library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
+  soname_spec='${libname}${release}.so$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  case $host_vendor in
+    sni)
+      shlibpath_overrides_runpath=no
+      need_lib_prefix=no
+      export_dynamic_flag_spec='${wl}-Blargedynsym'
+      runpath_var=LD_RUN_PATH
+      ;;
+    siemens)
+      need_lib_prefix=no
+      ;;
+    motorola)
+      need_lib_prefix=no
+      need_version=no
+      shlibpath_overrides_runpath=no
+      sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib'
+      ;;
+  esac
+  ;;
+
+uts4*)
+  version_type=linux
+  library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
+  soname_spec='${libname}${release}.so$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  ;;
+
+dgux*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
+  soname_spec='${libname}${release}.so$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  ;;
+
+sysv4*MP*)
+  if test -d /usr/nec ;then
+    version_type=linux
+    library_names_spec='$libname.so.$versuffix $libname.so.$major $libname.so'
+    soname_spec='$libname.so.$major'
+    shlibpath_var=LD_LIBRARY_PATH
+  fi
+  ;;
+
+*)
+  dynamic_linker=no
+  ;;
+esac
+AC_MSG_RESULT([$dynamic_linker])
+test "$dynamic_linker" = no && can_build_shared=no
+##
+## END FIXME
+
+## FIXME: this should be a separate macro
+##
+# Report the final consequences.
+AC_MSG_CHECKING([if libtool supports shared libraries])
+AC_MSG_RESULT([$can_build_shared])
+##
+## END FIXME
+
+## FIXME: this should be a separate macro
+##
+AC_MSG_CHECKING([whether to build shared libraries])
+test "$can_build_shared" = "no" && enable_shared=no
+
+# On AIX, shared libraries and static libraries use the same namespace, and
+# are all built from PIC.
+case "$host_os" in
+aix3*)
+  test "$enable_shared" = yes && enable_static=no
+  if test -n "$RANLIB"; then
+    archive_cmds="$archive_cmds~\$RANLIB \$lib"
+    postinstall_cmds='$RANLIB $lib'
+  fi
+  ;;
+
+aix4*)
+  if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then
+    test "$enable_shared" = yes && enable_static=no
+  fi
+  ;;
+esac
+AC_MSG_RESULT([$enable_shared])
+##
+## END FIXME
+
+## FIXME: this should be a separate macro
+##
+AC_MSG_CHECKING([whether to build static libraries])
+# Make sure either enable_shared or enable_static is yes.
+test "$enable_shared" = yes || enable_static=yes
+AC_MSG_RESULT([$enable_static])
+##
+## END FIXME
+
+if test "$hardcode_action" = relink; then
+  # Fast installation is not supported
+  enable_fast_install=no
+elif test "$shlibpath_overrides_runpath" = yes ||
+     test "$enable_shared" = no; then
+  # Fast installation is not necessary
+  enable_fast_install=needless
+fi
+
+variables_saved_for_relink="PATH $shlibpath_var $runpath_var"
+if test "$GCC" = yes; then
+  variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
+fi
+
+AC_LIBTOOL_DLOPEN_SELF
+
+## FIXME: this should be a separate macro
+##
+if test "$enable_shared" = yes && test "$GCC" = yes; then
+  case $archive_cmds in
+  *'~'*)
+    # FIXME: we may have to deal with multi-command sequences.
+    ;;
+  '$CC '*)
+    # Test whether the compiler implicitly links with -lc since on some
+    # systems, -lgcc has to come before -lc. If gcc already passes -lc
+    # to ld, don't add -lc before -lgcc.
+    AC_MSG_CHECKING([whether -lc should be explicitly linked in])
+    AC_CACHE_VAL([lt_cv_archive_cmds_need_lc],
+    [$rm conftest*
+    echo 'static int dummy;' > conftest.$ac_ext
+
+    if AC_TRY_EVAL(ac_compile); then
+      soname=conftest
+      lib=conftest
+      libobjs=conftest.$ac_objext
+      deplibs=
+      wl=$lt_cv_prog_cc_wl
+      compiler_flags=-v
+      linker_flags=-v
+      verstring=
+      output_objdir=.
+      libname=conftest
+      save_allow_undefined_flag=$allow_undefined_flag
+      allow_undefined_flag=
+      if AC_TRY_EVAL(archive_cmds 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1)
+      then
+	lt_cv_archive_cmds_need_lc=no
+      else
+	lt_cv_archive_cmds_need_lc=yes
+      fi
+      allow_undefined_flag=$save_allow_undefined_flag
+    else
+      cat conftest.err 1>&5
+    fi])
+    AC_MSG_RESULT([$lt_cv_archive_cmds_need_lc])
+    ;;
+  esac
+fi
+need_lc=${lt_cv_archive_cmds_need_lc-yes}
+##
+## END FIXME
+
+## FIXME: this should be a separate macro
+##
+# The second clause should only fire when bootstrapping the
+# libtool distribution, otherwise you forgot to ship ltmain.sh
+# with your package, and you will get complaints that there are
+# no rules to generate ltmain.sh.
+if test -f "$ltmain"; then
+  :
+else
+  # If there is no Makefile yet, we rely on a make rule to execute
+  # `config.status --recheck' to rerun these tests and create the
+  # libtool script then.
+  test -f Makefile && make "$ltmain"
+fi
+
+if test -f "$ltmain"; then
+  trap "$rm \"${ofile}T\"; exit 1" 1 2 15
+  $rm -f "${ofile}T"
+
+  echo creating $ofile
+
+  # Now quote all the things that may contain metacharacters while being
+  # careful not to overquote the AC_SUBSTed values.  We take copies of the
+  # variables and quote the copies for generation of the libtool script.
+  for var in echo old_CC old_CFLAGS SED \
+    AR AR_FLAGS CC LD LN_S NM SHELL \
+    reload_flag reload_cmds wl \
+    pic_flag link_static_flag no_builtin_flag export_dynamic_flag_spec \
+    thread_safe_flag_spec whole_archive_flag_spec libname_spec \
+    library_names_spec soname_spec \
+    RANLIB old_archive_cmds old_archive_from_new_cmds old_postinstall_cmds \
+    old_postuninstall_cmds archive_cmds archive_expsym_cmds postinstall_cmds \
+    postuninstall_cmds extract_expsyms_cmds old_archive_from_expsyms_cmds \
+    old_striplib striplib file_magic_cmd export_symbols_cmds \
+    deplibs_check_method allow_undefined_flag no_undefined_flag \
+    finish_cmds finish_eval global_symbol_pipe global_symbol_to_cdecl \
+    global_symbol_to_c_name_address \
+    hardcode_libdir_flag_spec hardcode_libdir_separator  \
+    sys_lib_search_path_spec sys_lib_dlsearch_path_spec \
+    compiler_c_o compiler_o_lo need_locks exclude_expsyms include_expsyms; do
+
+    case $var in
+    reload_cmds | old_archive_cmds | old_archive_from_new_cmds | \
+    old_postinstall_cmds | old_postuninstall_cmds | \
+    export_symbols_cmds | archive_cmds | archive_expsym_cmds | \
+    extract_expsyms_cmds | old_archive_from_expsyms_cmds | \
+    postinstall_cmds | postuninstall_cmds | \
+    finish_cmds | sys_lib_search_path_spec | sys_lib_dlsearch_path_spec)
+      # Double-quote double-evaled strings.
+      eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\""
+      ;;
+    *)
+      eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\""
+      ;;
+    esac
+  done
+
+  cat <<__EOF__ > "${ofile}T"
+#! $SHELL
+
+# `$echo "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services.
+# Generated automatically by $PROGRAM (GNU $PACKAGE $VERSION$TIMESTAMP)
+# NOTE: Changes made to this file will be lost: look at ltmain.sh.
+#
+# Copyright (C) 1996-2000 Free Software Foundation, Inc.
+# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# A sed that does not truncate output.
+SED=$lt_SED
+
+# Sed that helps us avoid accidentally triggering echo(1) options like -n.
+Xsed="${SED} -e s/^X//"
+
+# The HP-UX ksh and POSIX shell print the target directory to stdout
+# if CDPATH is set.
+if test "X\${CDPATH+set}" = Xset; then CDPATH=:; export CDPATH; fi
+
+# ### BEGIN LIBTOOL CONFIG
+
+# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
+
+# Shell to use when invoking shell scripts.
+SHELL=$lt_SHELL
+
+# Whether or not to build shared libraries.
+build_libtool_libs=$enable_shared
+
+# Whether or not to build static libraries.
+build_old_libs=$enable_static
+
+# Whether or not to add -lc for building shared libraries.
+build_libtool_need_lc=$need_lc
+
+# Whether or not to optimize for fast installation.
+fast_install=$enable_fast_install
+
+# The host system.
+host_alias=$host_alias
+host=$host
+
+# An echo program that does not interpret backslashes.
+echo=$lt_echo
+
+# The archiver.
+AR=$lt_AR
+AR_FLAGS=$lt_AR_FLAGS
+
+# The default C compiler.
+CC=$lt_CC
+
+# Is the compiler the GNU C compiler?
+with_gcc=$GCC
+
+# The linker used to build libraries.
+LD=$lt_LD
+
+# Whether we need hard or soft links.
+LN_S=$lt_LN_S
+
+# A BSD-compatible nm program.
+NM=$lt_NM
+
+# A symbol stripping program
+STRIP=$STRIP
+
+# Used to examine libraries when file_magic_cmd begins "file"
+MAGIC_CMD=$MAGIC_CMD
+
+# Used on cygwin: DLL creation program.
+DLLTOOL="$DLLTOOL"
+
+# Used on cygwin: object dumper.
+OBJDUMP="$OBJDUMP"
+
+# Used on cygwin: assembler.
+AS="$AS"
+
+# The name of the directory that contains temporary libtool files.
+objdir=$objdir
+
+# How to create reloadable object files.
+reload_flag=$lt_reload_flag
+reload_cmds=$lt_reload_cmds
+
+# How to pass a linker flag through the compiler.
+wl=$lt_wl
+
+# Object file suffix (normally "o").
+objext="$ac_objext"
+
+# Old archive suffix (normally "a").
+libext="$libext"
+
+# Executable file suffix (normally "").
+exeext="$exeext"
+
+# Additional compiler flags for building library objects.
+pic_flag=$lt_pic_flag
+pic_mode=$pic_mode
+
+# Does compiler simultaneously support -c and -o options?
+compiler_c_o=$lt_compiler_c_o
+
+# Can we write directly to a .lo ?
+compiler_o_lo=$lt_compiler_o_lo
+
+# Must we lock files when doing compilation ?
+need_locks=$lt_need_locks
+
+# Do we need the lib prefix for modules?
+need_lib_prefix=$need_lib_prefix
+
+# Do we need a version for libraries?
+need_version=$need_version
+
+# Whether dlopen is supported.
+dlopen_support=$enable_dlopen
+
+# Whether dlopen of programs is supported.
+dlopen_self=$enable_dlopen_self
+
+# Whether dlopen of statically linked programs is supported.
+dlopen_self_static=$enable_dlopen_self_static
+
+# Compiler flag to prevent dynamic linking.
+link_static_flag=$lt_link_static_flag
+
+# Compiler flag to turn off builtin functions.
+no_builtin_flag=$lt_no_builtin_flag
+
+# Compiler flag to allow reflexive dlopens.
+export_dynamic_flag_spec=$lt_export_dynamic_flag_spec
+
+# Compiler flag to generate shared objects directly from archives.
+whole_archive_flag_spec=$lt_whole_archive_flag_spec
+
+# Compiler flag to generate thread-safe objects.
+thread_safe_flag_spec=$lt_thread_safe_flag_spec
+
+# Library versioning type.
+version_type=$version_type
+
+# Format of library name prefix.
+libname_spec=$lt_libname_spec
+
+# List of archive names.  First name is the real one, the rest are links.
+# The last name is the one that the linker finds with -lNAME.
+library_names_spec=$lt_library_names_spec
+
+# The coded name of the library, if different from the real name.
+soname_spec=$lt_soname_spec
+
+# Commands used to build and install an old-style archive.
+RANLIB=$lt_RANLIB
+old_archive_cmds=$lt_old_archive_cmds
+old_postinstall_cmds=$lt_old_postinstall_cmds
+old_postuninstall_cmds=$lt_old_postuninstall_cmds
+
+# Create an old-style archive from a shared archive.
+old_archive_from_new_cmds=$lt_old_archive_from_new_cmds
+
+# Create a temporary old-style archive to link instead of a shared archive.
+old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds
+
+# Commands used to build and install a shared archive.
+archive_cmds=$lt_archive_cmds
+archive_expsym_cmds=$lt_archive_expsym_cmds
+postinstall_cmds=$lt_postinstall_cmds
+postuninstall_cmds=$lt_postuninstall_cmds
+
+# Commands to strip libraries.
+old_striplib=$lt_old_striplib
+striplib=$lt_striplib
+
+# Method to check whether dependent libraries are shared objects.
+deplibs_check_method=$lt_deplibs_check_method
+
+# Command to use when deplibs_check_method == file_magic.
+file_magic_cmd=$lt_file_magic_cmd
+
+# Flag that allows shared libraries with undefined symbols to be built.
+allow_undefined_flag=$lt_allow_undefined_flag
+
+# Flag that forces no undefined symbols.
+no_undefined_flag=$lt_no_undefined_flag
+
+# Commands used to finish a libtool library installation in a directory.
+finish_cmds=$lt_finish_cmds
+
+# Same as above, but a single script fragment to be evaled but not shown.
+finish_eval=$lt_finish_eval
+
+# Take the output of nm and produce a listing of raw symbols and C names.
+global_symbol_pipe=$lt_global_symbol_pipe
+
+# Transform the output of nm in a proper C declaration
+global_symbol_to_cdecl=$lt_global_symbol_to_cdecl
+
+# Transform the output of nm in a C name address pair
+global_symbol_to_c_name_address=$lt_global_symbol_to_c_name_address
+
+# This is the shared library runtime path variable.
+runpath_var=$runpath_var
+
+# This is the shared library path variable.
+shlibpath_var=$shlibpath_var
+
+# Is shlibpath searched before the hard-coded library search path?
+shlibpath_overrides_runpath=$shlibpath_overrides_runpath
+
+# How to hardcode a shared library path into an executable.
+hardcode_action=$hardcode_action
+
+# Whether we should hardcode library paths into libraries.
+hardcode_into_libs=$hardcode_into_libs
+
+# Flag to hardcode \$libdir into a binary during linking.
+# This must work even if \$libdir does not exist.
+hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec
+
+# Whether we need a single -rpath flag with a separated argument.
+hardcode_libdir_separator=$lt_hardcode_libdir_separator
+
+# Set to yes if using DIR/libNAME.so during linking hardcodes DIR into the
+# resulting binary.
+hardcode_direct=$hardcode_direct
+
+# Set to yes if using the -LDIR flag during linking hardcodes DIR into the
+# resulting binary.
+hardcode_minus_L=$hardcode_minus_L
+
+# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into
+# the resulting binary.
+hardcode_shlibpath_var=$hardcode_shlibpath_var
+
+# Variables whose values should be saved in libtool wrapper scripts and
+# restored at relink time.
+variables_saved_for_relink="$variables_saved_for_relink"
+
+# Whether libtool must link a program against all its dependency libraries.
+link_all_deplibs=$link_all_deplibs
+
+# Compile-time system search path for libraries
+sys_lib_search_path_spec=$lt_sys_lib_search_path_spec
+
+# Run-time system search path for libraries
+sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec
+
+# Fix the shell variable \$srcfile for the compiler.
+fix_srcfile_path="$fix_srcfile_path"
+
+# Set to yes if exported symbols are required.
+always_export_symbols=$always_export_symbols
+
+# The commands to list exported symbols.
+export_symbols_cmds=$lt_export_symbols_cmds
+
+# The commands to extract the exported symbol list from a shared archive.
+extract_expsyms_cmds=$lt_extract_expsyms_cmds
+
+# Symbols that should not be listed in the preloaded symbols.
+exclude_expsyms=$lt_exclude_expsyms
+
+# Symbols that must always be exported.
+include_expsyms=$lt_include_expsyms
+
+# ### END LIBTOOL CONFIG
+
+__EOF__
+
+  case $host_os in
+  aix3*)
+    cat <<\EOF >> "${ofile}T"
+
+# AIX sometimes has problems with the GCC collect2 program.  For some
+# reason, if we set the COLLECT_NAMES environment variable, the problems
+# vanish in a puff of smoke.
+if test "X${COLLECT_NAMES+set}" != Xset; then
+  COLLECT_NAMES=
+  export COLLECT_NAMES
+fi
+EOF
+    ;;
+  esac
+
+  case $host_os in
+  cygwin* | mingw* | pw32* | os2*)
+    cat <<'EOF' >> "${ofile}T"
+      # This is a source program that is used to create dlls on Windows
+      # Don't remove nor modify the starting and closing comments
+# /* ltdll.c starts here */
+# #define WIN32_LEAN_AND_MEAN
+# #include <windows.h>
+# #undef WIN32_LEAN_AND_MEAN
+# #include <stdio.h>
+#
+# #ifndef __CYGWIN__
+# #  ifdef __CYGWIN32__
+# #    define __CYGWIN__ __CYGWIN32__
+# #  endif
+# #endif
+#
+# #ifdef __cplusplus
+# extern "C" {
+# #endif
+# BOOL APIENTRY DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved);
+# #ifdef __cplusplus
+# }
+# #endif
+#
+# #ifdef __CYGWIN__
+# #include <cygwin/cygwin_dll.h>
+# DECLARE_CYGWIN_DLL( DllMain );
+# #endif
+# HINSTANCE __hDllInstance_base;
+#
+# BOOL APIENTRY
+# DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved)
+# {
+#   __hDllInstance_base = hInst;
+#   return TRUE;
+# }
+# /* ltdll.c ends here */
+	# This is a source program that is used to create import libraries
+	# on Windows for dlls which lack them. Don't remove nor modify the
+	# starting and closing comments
+# /* impgen.c starts here */
+# /*   Copyright (C) 1999-2000 Free Software Foundation, Inc.
+#
+#  This file is part of GNU libtool.
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#  */
+#
+# #include <stdio.h>		/* for printf() */
+# #include <unistd.h>		/* for open(), lseek(), read() */
+# #include <fcntl.h>		/* for O_RDONLY, O_BINARY */
+# #include <string.h>		/* for strdup() */
+#
+# /* O_BINARY isn't required (or even defined sometimes) under Unix */
+# #ifndef O_BINARY
+# #define O_BINARY 0
+# #endif
+#
+# static unsigned int
+# pe_get16 (fd, offset)
+#      int fd;
+#      int offset;
+# {
+#   unsigned char b[2];
+#   lseek (fd, offset, SEEK_SET);
+#   read (fd, b, 2);
+#   return b[0] + (b[1]<<8);
+# }
+#
+# static unsigned int
+# pe_get32 (fd, offset)
+#     int fd;
+#     int offset;
+# {
+#   unsigned char b[4];
+#   lseek (fd, offset, SEEK_SET);
+#   read (fd, b, 4);
+#   return b[0] + (b[1]<<8) + (b[2]<<16) + (b[3]<<24);
+# }
+#
+# static unsigned int
+# pe_as32 (ptr)
+#      void *ptr;
+# {
+#   unsigned char *b = ptr;
+#   return b[0] + (b[1]<<8) + (b[2]<<16) + (b[3]<<24);
+# }
+#
+# int
+# main (argc, argv)
+#     int argc;
+#     char *argv[];
+# {
+#     int dll;
+#     unsigned long pe_header_offset, opthdr_ofs, num_entries, i;
+#     unsigned long export_rva, export_size, nsections, secptr, expptr;
+#     unsigned long name_rvas, nexp;
+#     unsigned char *expdata, *erva;
+#     char *filename, *dll_name;
+#
+#     filename = argv[1];
+#
+#     dll = open(filename, O_RDONLY|O_BINARY);
+#     if (dll < 1)
+# 	return 1;
+#
+#     dll_name = filename;
+#
+#     for (i=0; filename[i]; i++)
+# 	if (filename[i] == '/' || filename[i] == '\\'  || filename[i] == ':')
+# 	    dll_name = filename + i +1;
+#
+#     pe_header_offset = pe_get32 (dll, 0x3c);
+#     opthdr_ofs = pe_header_offset + 4 + 20;
+#     num_entries = pe_get32 (dll, opthdr_ofs + 92);
+#
+#     if (num_entries < 1) /* no exports */
+# 	return 1;
+#
+#     export_rva = pe_get32 (dll, opthdr_ofs + 96);
+#     export_size = pe_get32 (dll, opthdr_ofs + 100);
+#     nsections = pe_get16 (dll, pe_header_offset + 4 +2);
+#     secptr = (pe_header_offset + 4 + 20 +
+# 	      pe_get16 (dll, pe_header_offset + 4 + 16));
+#
+#     expptr = 0;
+#     for (i = 0; i < nsections; i++)
+#     {
+# 	char sname[8];
+# 	unsigned long secptr1 = secptr + 40 * i;
+# 	unsigned long vaddr = pe_get32 (dll, secptr1 + 12);
+# 	unsigned long vsize = pe_get32 (dll, secptr1 + 16);
+# 	unsigned long fptr = pe_get32 (dll, secptr1 + 20);
+# 	lseek(dll, secptr1, SEEK_SET);
+# 	read(dll, sname, 8);
+# 	if (vaddr <= export_rva && vaddr+vsize > export_rva)
+# 	{
+# 	    expptr = fptr + (export_rva - vaddr);
+# 	    if (export_rva + export_size > vaddr + vsize)
+# 		export_size = vsize - (export_rva - vaddr);
+# 	    break;
+# 	}
+#     }
+#
+#     expdata = (unsigned char*)malloc(export_size);
+#     lseek (dll, expptr, SEEK_SET);
+#     read (dll, expdata, export_size);
+#     erva = expdata - export_rva;
+#
+#     nexp = pe_as32 (expdata+24);
+#     name_rvas = pe_as32 (expdata+32);
+#
+#     printf ("EXPORTS\n");
+#     for (i = 0; i<nexp; i++)
+#     {
+# 	unsigned long name_rva = pe_as32 (erva+name_rvas+i*4);
+# 	printf ("\t%s @ %ld ;\n", erva+name_rva, 1+ i);
+#     }
+#
+#     return 0;
+# }
+# /* impgen.c ends here */
+
+EOF
+    ;;
+  esac
+
+  # We use sed instead of cat because bash on DJGPP gets confused if
+  # if finds mixed CR/LF and LF-only lines.  Since sed operates in
+  # text mode, it properly converts lines to CR/LF.  This bash problem
+  # is reportedly fixed, but why not run on old versions too?
+  sed '$q' "$ltmain" >> "${ofile}T" || (rm -f "${ofile}T"; exit 1)
+
+  mv -f "${ofile}T" "$ofile" || \
+    (rm -f "$ofile" && cp "${ofile}T" "$ofile" && rm -f "${ofile}T")
+  chmod +x "$ofile"
+fi
+##
+## END FIXME
+
+])# _LT_AC_LTCONFIG_HACK
+
+# AC_LIBTOOL_DLOPEN - enable checks for dlopen support
+AC_DEFUN([AC_LIBTOOL_DLOPEN], [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])])
+
+# AC_LIBTOOL_WIN32_DLL - declare package support for building win32 dll's
+AC_DEFUN([AC_LIBTOOL_WIN32_DLL], [AC_BEFORE([$0], [AC_LIBTOOL_SETUP])])
+
+# AC_ENABLE_SHARED - implement the --enable-shared flag
+# Usage: AC_ENABLE_SHARED[(DEFAULT)]
+#   Where DEFAULT is either `yes' or `no'.  If omitted, it defaults to
+#   `yes'.
+AC_DEFUN([AC_ENABLE_SHARED],
+[define([AC_ENABLE_SHARED_DEFAULT], ifelse($1, no, no, yes))dnl
+AC_ARG_ENABLE(shared,
+changequote(<<, >>)dnl
+<<  --enable-shared[=PKGS]  build shared libraries [default=>>AC_ENABLE_SHARED_DEFAULT],
+changequote([, ])dnl
+[p=${PACKAGE-default}
+case $enableval in
+yes) enable_shared=yes ;;
+no) enable_shared=no ;;
+*)
+  enable_shared=no
+  # Look at the argument we got.  We use all the common list separators.
+  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
+  for pkg in $enableval; do
+    if test "X$pkg" = "X$p"; then
+      enable_shared=yes
+    fi
+  done
+  IFS="$ac_save_ifs"
+  ;;
+esac],
+enable_shared=AC_ENABLE_SHARED_DEFAULT)dnl
+])
+
+# AC_DISABLE_SHARED - set the default shared flag to --disable-shared
+AC_DEFUN([AC_DISABLE_SHARED],
+[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
+AC_ENABLE_SHARED(no)])
+
+# AC_ENABLE_STATIC - implement the --enable-static flag
+# Usage: AC_ENABLE_STATIC[(DEFAULT)]
+#   Where DEFAULT is either `yes' or `no'.  If omitted, it defaults to
+#   `yes'.
+AC_DEFUN([AC_ENABLE_STATIC],
+[define([AC_ENABLE_STATIC_DEFAULT], ifelse($1, no, no, yes))dnl
+AC_ARG_ENABLE(static,
+changequote(<<, >>)dnl
+<<  --enable-static[=PKGS]  build static libraries [default=>>AC_ENABLE_STATIC_DEFAULT],
+changequote([, ])dnl
+[p=${PACKAGE-default}
+case $enableval in
+yes) enable_static=yes ;;
+no) enable_static=no ;;
+*)
+  enable_static=no
+  # Look at the argument we got.  We use all the common list separators.
+  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
+  for pkg in $enableval; do
+    if test "X$pkg" = "X$p"; then
+      enable_static=yes
+    fi
+  done
+  IFS="$ac_save_ifs"
+  ;;
+esac],
+enable_static=AC_ENABLE_STATIC_DEFAULT)dnl
+])
+
+# AC_DISABLE_STATIC - set the default static flag to --disable-static
+AC_DEFUN([AC_DISABLE_STATIC],
+[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
+AC_ENABLE_STATIC(no)])
+
+
+# AC_ENABLE_FAST_INSTALL - implement the --enable-fast-install flag
+# Usage: AC_ENABLE_FAST_INSTALL[(DEFAULT)]
+#   Where DEFAULT is either `yes' or `no'.  If omitted, it defaults to
+#   `yes'.
+AC_DEFUN([AC_ENABLE_FAST_INSTALL],
+[define([AC_ENABLE_FAST_INSTALL_DEFAULT], ifelse($1, no, no, yes))dnl
+AC_ARG_ENABLE(fast-install,
+changequote(<<, >>)dnl
+<<  --enable-fast-install[=PKGS]  optimize for fast installation [default=>>AC_ENABLE_FAST_INSTALL_DEFAULT],
+changequote([, ])dnl
+[p=${PACKAGE-default}
+case $enableval in
+yes) enable_fast_install=yes ;;
+no) enable_fast_install=no ;;
+*)
+  enable_fast_install=no
+  # Look at the argument we got.  We use all the common list separators.
+  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
+  for pkg in $enableval; do
+    if test "X$pkg" = "X$p"; then
+      enable_fast_install=yes
+    fi
+  done
+  IFS="$ac_save_ifs"
+  ;;
+esac],
+enable_fast_install=AC_ENABLE_FAST_INSTALL_DEFAULT)dnl
+])
+
+# AC_DISABLE_FAST_INSTALL - set the default to --disable-fast-install
+AC_DEFUN([AC_DISABLE_FAST_INSTALL],
+[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
+AC_ENABLE_FAST_INSTALL(no)])
+
+# AC_LIBTOOL_PICMODE - implement the --with-pic flag
+# Usage: AC_LIBTOOL_PICMODE[(MODE)]
+#   Where MODE is either `yes' or `no'.  If omitted, it defaults to
+#   `both'.
+AC_DEFUN([AC_LIBTOOL_PICMODE],
+[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
+pic_mode=ifelse($#,1,$1,default)])
+
+
+# AC_PATH_TOOL_PREFIX - find a file program which can recognise shared library
+AC_DEFUN([AC_PATH_TOOL_PREFIX],
+[AC_MSG_CHECKING([for $1])
+AC_CACHE_VAL(lt_cv_path_MAGIC_CMD,
+[case $MAGIC_CMD in
+  /*)
+  lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path.
+  ;;
+  ?:/*)
+  lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a dos path.
+  ;;
+  *)
+  ac_save_MAGIC_CMD="$MAGIC_CMD"
+  IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS=":"
+dnl $ac_dummy forces splitting on constant user-supplied paths.
+dnl POSIX.2 word splitting is done only on the output of word expansions,
+dnl not every word.  This closes a longstanding sh security hole.
+  ac_dummy="ifelse([$2], , $PATH, [$2])"
+  for ac_dir in $ac_dummy; do
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/$1; then
+      lt_cv_path_MAGIC_CMD="$ac_dir/$1"
+      if test -n "$file_magic_test_file"; then
+	case $deplibs_check_method in
+	"file_magic "*)
+	  file_magic_regex="`expr \"$deplibs_check_method\" : \"file_magic \(.*\)\"`"
+	  MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+	  if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null |
+	    egrep "$file_magic_regex" > /dev/null; then
+	    :
+	  else
+	    cat <<EOF 1>&2
+
+*** Warning: the command libtool uses to detect shared libraries,
+*** $file_magic_cmd, produces output that libtool cannot recognize.
+*** The result is that libtool may fail to recognize shared libraries
+*** as such.  This will affect the creation of libtool libraries that
+*** depend on shared libraries, but programs linked with such libtool
+*** libraries will work regardless of this problem.  Nevertheless, you
+*** may want to report the problem to your system manager and/or to
+*** bug-libtool@gnu.org
+
+EOF
+	  fi ;;
+	esac
+      fi
+      break
+    fi
+  done
+  IFS="$ac_save_ifs"
+  MAGIC_CMD="$ac_save_MAGIC_CMD"
+  ;;
+esac])
+MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+if test -n "$MAGIC_CMD"; then
+  AC_MSG_RESULT($MAGIC_CMD)
+else
+  AC_MSG_RESULT(no)
+fi
+])
+
+
+# AC_PATH_MAGIC - find a file program which can recognise a shared library
+AC_DEFUN([AC_PATH_MAGIC],
+[AC_REQUIRE([AC_CHECK_TOOL_PREFIX])dnl
+AC_PATH_TOOL_PREFIX(${ac_tool_prefix}file, /usr/bin:$PATH)
+if test -z "$lt_cv_path_MAGIC_CMD"; then
+  if test -n "$ac_tool_prefix"; then
+    AC_PATH_TOOL_PREFIX(file, /usr/bin:$PATH)
+  else
+    MAGIC_CMD=:
+  fi
+fi
+])
+
+
+# AC_PROG_LD - find the path to the GNU or non-GNU linker
+AC_DEFUN([AC_PROG_LD],
+[AC_ARG_WITH(gnu-ld,
+[  --with-gnu-ld           assume the C compiler uses GNU ld [default=no]],
+test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no)
+AC_REQUIRE([AC_PROG_CC])dnl
+AC_REQUIRE([AC_CANONICAL_HOST])dnl
+AC_REQUIRE([AC_CANONICAL_BUILD])dnl
+AC_REQUIRE([_LT_AC_LIBTOOL_SYS_PATH_SEPARATOR])dnl
+ac_prog=ld
+if test "$GCC" = yes; then
+  # Check if gcc -print-prog-name=ld gives a path.
+  AC_MSG_CHECKING([for ld used by GCC])
+  case $host in
+  *-*-mingw*)
+    # gcc leaves a trailing carriage return which upsets mingw
+    ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
+  *)
+    ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
+  esac
+  case $ac_prog in
+    # Accept absolute paths.
+    [[\\/]]* | [[A-Za-z]]:[[\\/]]*)
+      re_direlt='/[[^/]][[^/]]*/\.\./'
+      # Canonicalize the path of ld
+      ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'`
+      while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
+	ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
+      done
+      test -z "$LD" && LD="$ac_prog"
+      ;;
+  "")
+    # If it fails, then pretend we aren't using GCC.
+    ac_prog=ld
+    ;;
+  *)
+    # If it is relative, then search for the first ld in PATH.
+    with_gnu_ld=unknown
+    ;;
+  esac
+elif test "$with_gnu_ld" = yes; then
+  AC_MSG_CHECKING([for GNU ld])
+else
+  AC_MSG_CHECKING([for non-GNU ld])
+fi
+AC_CACHE_VAL(lt_cv_path_LD,
+[if test -z "$LD"; then
+  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+  for ac_dir in $PATH; do
+    test -z "$ac_dir" && ac_dir=.
+    if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
+      lt_cv_path_LD="$ac_dir/$ac_prog"
+      # Check to see if the program is GNU ld.  I'd rather use --version,
+      # but apparently some GNU ld's only accept -v.
+      # Break only if it was the GNU/non-GNU ld that we prefer.
+      if "$lt_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then
+	test "$with_gnu_ld" != no && break
+      else
+	test "$with_gnu_ld" != yes && break
+      fi
+    fi
+  done
+  IFS="$ac_save_ifs"
+else
+  lt_cv_path_LD="$LD" # Let the user override the test with a path.
+fi])
+LD="$lt_cv_path_LD"
+if test -n "$LD"; then
+  AC_MSG_RESULT($LD)
+else
+  AC_MSG_RESULT(no)
+fi
+test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
+AC_PROG_LD_GNU
+])
+
+# AC_PROG_LD_GNU -
+AC_DEFUN([AC_PROG_LD_GNU],
+[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], lt_cv_prog_gnu_ld,
+[# I'd rather use --version here, but apparently some GNU ld's only accept -v.
+if $LD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then
+  lt_cv_prog_gnu_ld=yes
+else
+  lt_cv_prog_gnu_ld=no
+fi])
+with_gnu_ld=$lt_cv_prog_gnu_ld
+])
+
+# AC_PROG_LD_RELOAD_FLAG - find reload flag for linker
+#   -- PORTME Some linkers may need a different reload flag.
+AC_DEFUN([AC_PROG_LD_RELOAD_FLAG],
+[AC_CACHE_CHECK([for $LD option to reload object files], lt_cv_ld_reload_flag,
+[lt_cv_ld_reload_flag='-r'])
+reload_flag=$lt_cv_ld_reload_flag
+test -n "$reload_flag" && reload_flag=" $reload_flag"
+])
+
+# AC_DEPLIBS_CHECK_METHOD - how to check for library dependencies
+#  -- PORTME fill in with the dynamic library characteristics
+AC_DEFUN([AC_DEPLIBS_CHECK_METHOD],
+[AC_CACHE_CHECK([how to recognise dependent libraries],
+lt_cv_deplibs_check_method,
+[lt_cv_file_magic_cmd='$MAGIC_CMD'
+lt_cv_file_magic_test_file=
+lt_cv_deplibs_check_method='unknown'
+# Need to set the preceding variable on all platforms that support
+# interlibrary dependencies.
+# 'none' -- dependencies not supported.
+# `unknown' -- same as none, but documents that we really don't know.
+# 'pass_all' -- all dependencies passed with no checks.
+# 'test_compile' -- check by making test program.
+# 'file_magic [[regex]]' -- check by looking for files in library path
+# which responds to the $file_magic_cmd with a given egrep regex.
+# If you have `file' or equivalent on your system and you're not sure
+# whether `pass_all' will *always* work, you probably want this one.
+
+case $host_os in
+aix4* | aix5*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+beos*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+bsdi4*)
+  lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib)'
+  lt_cv_file_magic_cmd='/usr/bin/file -L'
+  lt_cv_file_magic_test_file=/shlib/libc.so
+  ;;
+
+cygwin* | mingw* | pw32*)
+  lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?'
+  lt_cv_file_magic_cmd='$OBJDUMP -f'
+  ;;
+
+darwin* | rhapsody*)
+  lt_cv_deplibs_check_method='file_magic Mach-O dynamically linked shared library'
+  lt_cv_file_magic_cmd='/usr/bin/file -L'
+  case "$host_os" in
+  rhapsody* | darwin1.[[012]])
+    lt_cv_file_magic_test_file=`echo /System/Library/Frameworks/System.framework/Versions/*/System | head -1`
+    ;;
+  *) # Darwin 1.3 on
+    lt_cv_file_magic_test_file='/usr/lib/libSystem.dylib'
+    ;;
+  esac
+  ;;
+
+freebsd*)
+  if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
+    case $host_cpu in
+    i*86 )
+      # Not sure whether the presence of OpenBSD here was a mistake.
+      # Let's accept both of them until this is cleared up.
+      lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD)/i[[3-9]]86 (compact )?demand paged shared library'
+      lt_cv_file_magic_cmd=/usr/bin/file
+      lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*`
+      ;;
+    esac
+  else
+    lt_cv_deplibs_check_method=pass_all
+  fi
+  ;;
+
+gnu*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+hpux10.20*|hpux11*)
+  lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|PA-RISC[[0-9]].[[0-9]]) shared library'
+  lt_cv_file_magic_cmd=/usr/bin/file
+  lt_cv_file_magic_test_file=/usr/lib/libc.sl
+  ;;
+
+irix5* | irix6* | nonstopux*)
+  case $host_os in
+  irix5* | nonstopux*)
+    # this will be overridden with pass_all, but let us keep it just in case
+    lt_cv_deplibs_check_method="file_magic ELF 32-bit MSB dynamic lib MIPS - version 1"
+    ;;
+  *)
+    case $LD in
+    *-32|*"-32 ") libmagic=32-bit;;
+    *-n32|*"-n32 ") libmagic=N32;;
+    *-64|*"-64 ") libmagic=64-bit;;
+    *) libmagic=never-match;;
+    esac
+    # this will be overridden with pass_all, but let us keep it just in case
+    lt_cv_deplibs_check_method="file_magic ELF ${libmagic} MSB mips-[[1234]] dynamic lib MIPS - version 1"
+    ;;
+  esac
+  lt_cv_file_magic_test_file=`echo /lib${libsuff}/libc.so*`
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+# This must be Linux ELF.
+linux-gnu*)
+  case $host_cpu in
+  alpha* | hppa* | i*86 | mips | mipsel | powerpc* | sparc* | ia64*)
+    lt_cv_deplibs_check_method=pass_all ;;
+  *)
+    # glibc up to 2.1.1 does not perform some relocations on ARM
+    lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB (shared object|dynamic lib )' ;;
+  esac
+  lt_cv_file_magic_test_file=`echo /lib/libc.so* /lib/libc-*.so`
+  ;;
+
+netbsd*)
+  if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
+    lt_cv_deplibs_check_method='match_pattern /lib[[^/\.]]+\.so\.[[0-9]]+\.[[0-9]]+$'
+  else
+    lt_cv_deplibs_check_method='match_pattern /lib[[^/\.]]+\.so$'
+  fi
+  ;;
+
+newos6*)
+  lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (executable|dynamic lib)'
+  lt_cv_file_magic_cmd=/usr/bin/file
+  lt_cv_file_magic_test_file=/usr/lib/libnls.so
+  ;;
+
+openbsd*)
+  lt_cv_file_magic_cmd=/usr/bin/file
+  lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*`
+  if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+    lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB shared object'
+  else
+    lt_cv_deplibs_check_method='file_magic OpenBSD.* shared library'
+  fi
+  ;;
+
+osf3* | osf4* | osf5*)
+  # this will be overridden with pass_all, but let us keep it just in case
+  lt_cv_deplibs_check_method='file_magic COFF format alpha shared library'
+  lt_cv_file_magic_test_file=/shlib/libc.so
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+sco3.2v5*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+solaris*)
+  lt_cv_deplibs_check_method=pass_all
+  lt_cv_file_magic_test_file=/lib/libc.so
+  ;;
+
+sysv5uw[[78]]* | sysv4*uw2*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
+  case $host_vendor in
+  motorola)
+    lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib) M[[0-9]][[0-9]]* Version [[0-9]]'
+    lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*`
+    ;;
+  ncr)
+    lt_cv_deplibs_check_method=pass_all
+    ;;
+  sequent)
+    lt_cv_file_magic_cmd='/bin/file'
+    lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB (shared object|dynamic lib )'
+    ;;
+  sni)
+    lt_cv_file_magic_cmd='/bin/file'
+    lt_cv_deplibs_check_method="file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB dynamic lib"
+    lt_cv_file_magic_test_file=/lib/libc.so
+    ;;
+  siemens)
+    lt_cv_deplibs_check_method=pass_all
+    ;;
+  esac
+  ;;
+esac
+])
+file_magic_cmd=$lt_cv_file_magic_cmd
+deplibs_check_method=$lt_cv_deplibs_check_method
+])
+
+
+# AC_PROG_NM - find the path to a BSD-compatible name lister
+AC_DEFUN([AC_PROG_NM],
+[AC_REQUIRE([_LT_AC_LIBTOOL_SYS_PATH_SEPARATOR])dnl
+AC_MSG_CHECKING([for BSD-compatible nm])
+AC_CACHE_VAL(lt_cv_path_NM,
+[if test -n "$NM"; then
+  # Let the user override the test.
+  lt_cv_path_NM="$NM"
+else
+  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+  for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do
+    test -z "$ac_dir" && ac_dir=.
+    tmp_nm=$ac_dir/${ac_tool_prefix}nm
+    if test -f $tmp_nm || test -f $tmp_nm$ac_exeext ; then
+      # Check to see if the nm accepts a BSD-compat flag.
+      # Adding the `sed 1q' prevents false positives on HP-UX, which says:
+      #   nm: unknown option "B" ignored
+      # Tru64's nm complains that /dev/null is an invalid object file
+      if ($tmp_nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep '(/dev/null|Invalid file or object type)' >/dev/null; then
+	lt_cv_path_NM="$tmp_nm -B"
+	break
+      elif ($tmp_nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
+	lt_cv_path_NM="$tmp_nm -p"
+	break
+      else
+	lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but
+	continue # so that we can try to find one that supports BSD flags
+      fi
+    fi
+  done
+  IFS="$ac_save_ifs"
+  test -z "$lt_cv_path_NM" && lt_cv_path_NM=nm
+fi])
+NM="$lt_cv_path_NM"
+AC_MSG_RESULT([$NM])
+])
+
+# AC_CHECK_LIBM - check for math library
+AC_DEFUN([AC_CHECK_LIBM],
+[AC_REQUIRE([AC_CANONICAL_HOST])dnl
+LIBM=
+case $host in
+*-*-beos* | *-*-cygwin* | *-*-pw32*)
+  # These system don't have libm
+  ;;
+*-ncr-sysv4.3*)
+  AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw")
+  AC_CHECK_LIB(m, main, LIBM="$LIBM -lm")
+  ;;
+*)
+  AC_CHECK_LIB(m, main, LIBM="-lm")
+  ;;
+esac
+])
+
+# AC_LIBLTDL_CONVENIENCE[(dir)] - sets LIBLTDL to the link flags for
+# the libltdl convenience library and LTDLINCL to the include flags for
+# the libltdl header and adds --enable-ltdl-convenience to the
+# configure arguments.  Note that LIBLTDL and LTDLINCL are not
+# AC_SUBSTed, nor is AC_CONFIG_SUBDIRS called.  If DIR is not
+# provided, it is assumed to be `libltdl'.  LIBLTDL will be prefixed
+# with '${top_builddir}/' and LTDLINCL will be prefixed with
+# '${top_srcdir}/' (note the single quotes!).  If your package is not
+# flat and you're not using automake, define top_builddir and
+# top_srcdir appropriately in the Makefiles.
+AC_DEFUN([AC_LIBLTDL_CONVENIENCE],
+[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
+  case $enable_ltdl_convenience in
+  no) AC_MSG_ERROR([this package needs a convenience libltdl]) ;;
+  "") enable_ltdl_convenience=yes
+      ac_configure_args="$ac_configure_args --enable-ltdl-convenience" ;;
+  esac
+  LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdlc.la
+  LTDLINCL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl'])
+  # For backwards non-gettext consistent compatibility...
+  INCLTDL="$LTDLINCL"
+])
+
+# AC_LIBLTDL_INSTALLABLE[(dir)] - sets LIBLTDL to the link flags for
+# the libltdl installable library and LTDLINCL to the include flags for
+# the libltdl header and adds --enable-ltdl-install to the configure
+# arguments.  Note that LIBLTDL and LTDLINCL are not AC_SUBSTed, nor is
+# AC_CONFIG_SUBDIRS called.  If DIR is not provided and an installed
+# libltdl is not found, it is assumed to be `libltdl'.  LIBLTDL will
+# be prefixed with '${top_builddir}/' and LTDLINCL will be prefixed
+# with '${top_srcdir}/' (note the single quotes!).  If your package is
+# not flat and you're not using automake, define top_builddir and
+# top_srcdir appropriately in the Makefiles.
+# In the future, this macro may have to be called after AC_PROG_LIBTOOL.
+AC_DEFUN([AC_LIBLTDL_INSTALLABLE],
+[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
+  AC_CHECK_LIB(ltdl, main,
+  [test x"$enable_ltdl_install" != xyes && enable_ltdl_install=no],
+  [if test x"$enable_ltdl_install" = xno; then
+     AC_MSG_WARN([libltdl not installed, but installation disabled])
+   else
+     enable_ltdl_install=yes
+   fi
+  ])
+  if test x"$enable_ltdl_install" = x"yes"; then
+    ac_configure_args="$ac_configure_args --enable-ltdl-install"
+    LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdl.la
+    LTDLINCL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl'])
+  else
+    ac_configure_args="$ac_configure_args --enable-ltdl-install=no"
+    LIBLTDL="-lltdl"
+    LTDLINCL=
+  fi
+  # For backwards non-gettext consistent compatibility...
+  INCLTDL="$LTDLINCL"
+])
+
+# old names
+AC_DEFUN([AM_PROG_LIBTOOL],   [AC_PROG_LIBTOOL])
+AC_DEFUN([AM_ENABLE_SHARED],  [AC_ENABLE_SHARED($@)])
+AC_DEFUN([AM_ENABLE_STATIC],  [AC_ENABLE_STATIC($@)])
+AC_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)])
+AC_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)])
+AC_DEFUN([AM_PROG_LD],        [AC_PROG_LD])
+AC_DEFUN([AM_PROG_NM],        [AC_PROG_NM])
+
+# This is just to silence aclocal about the macro not being used
+ifelse([AC_DISABLE_FAST_INSTALL])
+
+############################################################
+# NOTE: This macro has been submitted for inclusion into   #
+#  GNU Autoconf as AC_PROG_SED.  When it is available in   #
+#  a released version of Autoconf we should remove this    #
+#  macro and use it instead.                               #
+############################################################
+# LT_AC_PROG_SED
+# --------------
+# Check for a fully-functional sed program, that truncates
+# as few characters as possible.  Prefer GNU sed if found.
+AC_DEFUN([LT_AC_PROG_SED],
+[AC_MSG_CHECKING([for a sed that does not truncate output])
+AC_CACHE_VAL(lt_cv_path_SED,
+[# Loop through the user's path and test for sed and gsed.
+# Then use that list of sed's as ones to test for truncation.
+as_executable_p="test -f"
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_prog in sed gsed; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
+      if $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then
+        _sed_list="$_sed_list $as_dir/$ac_prog$ac_exec_ext"
+      fi
+    done
+  done
+done
+
+  # Create a temporary directory, and hook for its removal unless debugging.
+$debug ||
+{
+  trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0
+  trap '{ (exit 1); exit 1; }' 1 2 13 15
+}
+
+# Create a (secure) tmp directory for tmp files.
+: ${TMPDIR=/tmp}
+{
+  tmp=`(umask 077 && mktemp -d -q "$TMPDIR/sedXXXXXX") 2>/dev/null` &&
+  test -n "$tmp" && test -d "$tmp"
+}  ||
+{
+  tmp=$TMPDIR/sed$$-$RANDOM
+  (umask 077 && mkdir $tmp)
+} ||
+{
+   echo "$me: cannot create a temporary directory in $TMPDIR" >&2
+   { (exit 1); exit 1; }
+}
+  _max=0
+  _count=0
+  # Add /usr/xpg4/bin/sed as it is typically found on Solaris
+  # along with /bin/sed that truncates output.
+  for _sed in $_sed_list /usr/xpg4/bin/sed; do
+    test ! -f ${_sed} && break
+    cat /dev/null > "$tmp/sed.in"
+    _count=0
+    echo ${ECHO_N-$ac_n} "0123456789${ECHO_C-$ac_c}" >"$tmp/sed.in"
+    # Check for GNU sed and select it if it is found.
+    if "${_sed}" --version 2>&1 < /dev/null | egrep '(GNU)' > /dev/null; then
+      lt_cv_path_SED=${_sed}
+      break
+    fi
+    while true; do
+      cat "$tmp/sed.in" "$tmp/sed.in" >"$tmp/sed.tmp"
+      mv "$tmp/sed.tmp" "$tmp/sed.in"
+      cp "$tmp/sed.in" "$tmp/sed.nl"
+      echo >>"$tmp/sed.nl"
+      ${_sed} -e 's/a$//' < "$tmp/sed.nl" >"$tmp/sed.out" || break
+      cmp -s "$tmp/sed.out" "$tmp/sed.nl" || break
+      # 40000 chars as input seems more than enough
+      test $_count -gt 10 && break
+      _count=`expr $_count + 1`
+      if test $_count -gt $_max; then
+        _max=$_count
+        lt_cv_path_SED=$_sed
+      fi
+    done
+  done
+  rm -rf "$tmp"
+])
+if test "X$SED" != "X"; then
+  lt_cv_path_SED=$SED
+else
+  SED=$lt_cv_path_SED
+fi
+AC_MSG_RESULT([$SED])
+])
diff -Naur tomato/release/src/router/snmp/aclocal.m4.libtool tomato121/release/src/router/snmp/aclocal.m4.libtool
--- tomato/release/src/router/snmp/aclocal.m4.libtool	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/aclocal.m4.libtool	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,3902 @@
+dnl @synopsis AC_PROMPT_USER_NO_DEFINE(VARIABLENAME,QUESTION,[DEFAULT])
+dnl
+dnl Asks a QUESTION and puts the results in VARIABLENAME with an optional
+dnl DEFAULT value if the user merely hits return.
+dnl
+dnl @version 1.15
+dnl @author Wes Hardaker <hardaker@users.sourceforge.net>
+dnl
+AC_DEFUN([AC_PROMPT_USER_NO_DEFINE],
+dnl changequote(<<, >>) dnl
+dnl <<
+[
+if test "x$defaults" = "xno"; then
+echo $ac_n "$2 ($3): $ac_c"
+read tmpinput
+if test "$tmpinput" = "" -a "$3" != ""; then
+  tmpinput="$3"
+fi
+eval $1=\"$tmpinput\"
+else
+tmpinput="$3"
+eval $1=\"$tmpinput\"
+fi
+]
+dnl >>
+dnl changequote([, ])
+) dnl done AC_PROMPT_USER
+
+dnl @synopsis AC_PROMPT_USER(VARIABLENAME,QUESTION,[DEFAULT],QUOTED)
+dnl
+dnl Asks a QUESTION and puts the results in VARIABLENAME with an optional
+dnl DEFAULT value if the user merely hits return.  Also calls 
+dnl AC_DEFINE_UNQUOTED() on the VARIABLENAME for VARIABLENAMEs that should
+dnl be entered into the config.h file as well.  If QUOTED is "quoted" then
+dnl the result will be defined within quotes.
+dnl
+dnl @version 1.15
+dnl @author Wes Hardaker <hardaker@users.sourceforge.net>
+dnl
+AC_DEFUN([AC_PROMPT_USER],
+[
+MSG_CHECK=`echo "$2" | tail -1`
+AC_CACHE_CHECK($MSG_CHECK, ac_cv_user_prompt_$1,
+[echo "" >&AC_FD_MSG
+AC_PROMPT_USER_NO_DEFINE($1,[$2],$3)
+eval ac_cv_user_prompt_$1=\$$1
+echo $ac_n "setting $MSG_CHECK to...  $ac_c" >&AC_FD_MSG
+])
+if test "$ac_cv_user_prompt_$1" != "none"; then
+  if test "x$4" = "xquoted" -o "x$4" = "xQUOTED"; then
+    AC_DEFINE_UNQUOTED($1,"$ac_cv_user_prompt_$1")
+  else
+    AC_DEFINE_UNQUOTED($1,$ac_cv_user_prompt_$1)
+  fi
+fi
+]) dnl
+
+dnl @synopsis AC_CHECK_STRUCT_FOR(INCLUDES,STRUCT,MEMBER,DEFINE,[no])
+dnl
+dnl Checks STRUCT for MEMBER and defines DEFINE if found.
+dnl
+dnl @version 1.15
+dnl @author Wes Hardaker <hardaker@users.sourceforge.net>
+dnl
+AC_DEFUN(AC_CHECK_STRUCT_FOR,[
+
+ac_safe_struct=`echo "$2" | sed 'y%./+-%__p_%'`
+ac_safe_member=`echo "$3" | sed 'y%./+-%__p_%'`
+ac_safe_all="ac_cv_struct_${ac_safe_struct}_has_${ac_safe_member}"
+changequote(, )dnl
+  ac_uc_define=STRUCT_`echo "${ac_safe_struct}_HAS_${ac_safe_member}" | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
+changequote([, ])dnl
+
+AC_MSG_CHECKING([for $2.$3])
+AC_CACHE_VAL($ac_safe_all,
+[
+if test "x$4" = "x"; then
+  defineit="= 0"
+elif test "x$4" = "xno"; then
+  defineit=""
+else
+  defineit="$4"
+fi
+AC_TRY_COMPILE([
+$1
+],[
+struct $2 testit; 
+testit.$3 $defineit;
+], 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)
+else
+  AC_MSG_RESULT(no)
+fi
+
+])
+
+dnl AC_CHECK_IFNET_FOR(SUBSTRUCT,[no])
+AC_DEFUN(AC_CHECK_IFNET_FOR,[
+dnl check for $1 in struct ifnet
+AC_CHECK_STRUCT_FOR([
+#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
+], ifnet, $1, $2)
+])
+
+dnl
+dnl Add a search path to the LIBS and CFLAGS variables
+dnl
+AC_DEFUN(AC_ADD_SEARCH_PATH,[
+  if test "x$1" != x -a -d $1; then
+     if test -d $1/lib; then
+       LDFLAGS="-L$1/lib $LDFLAGS"
+     fi
+     if test -d $1/include; then
+	CPPFLAGS="-I$1/include $CPPFLAGS"
+     fi
+  fi
+])
+
+dnl
+dnl Store information for displaying later.
+dnl
+AC_DEFUN(AC_MSG_CACHE_INIT,[
+  rm -f configure-summary
+])
+
+AC_DEFUN(AC_MSG_CACHE_ADD,[
+  cat >> configure-summary << EOF
+  $1
+EOF
+])
+
+AC_DEFUN(AC_MSG_CACHE_DISPLAY,[
+  echo ""
+  echo "---------------------------------------------------------"
+  echo "            Net-SNMP configuration summary:"
+  echo "---------------------------------------------------------"
+  echo ""
+  cat configure-summary
+  echo ""
+  echo "---------------------------------------------------------"
+  echo ""
+])
+
+
+dnl
+dnl Stuff taken from libtool.m4 from the libtool package
+dnl
+
+# libtool.m4 - Configure libtool for the host system. -*-Shell-script-*-
+## Copyright 1996, 1997, 1998, 1999, 2000, 2001
+## Free Software Foundation, Inc.
+## Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
+##
+## This program is free software; you can redistribute it and/or modify
+## it under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 2 of the License, or
+## (at your option) any later version.
+##
+## This program is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with this program; if not, write to the Free Software
+## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+##
+## As a special exception to the GNU General Public License, if you
+## distribute this file as part of a program that contains a
+## configuration script generated by Autoconf, you may include it under
+## the same distribution terms that you use for the rest of that program.
+
+# serial 46 AC_PROG_LIBTOOL
+
+AC_DEFUN([AC_PROG_LIBTOOL],
+[AC_REQUIRE([AC_LIBTOOL_SETUP])dnl
+
+# This can be used to rebuild libtool when needed
+LIBTOOL_DEPS="$ac_aux_dir/ltmain.sh"
+
+# Always use our own libtool.
+LIBTOOL='$(SHELL) $(top_builddir)/libtool'
+AC_SUBST(LIBTOOL)dnl
+
+# Prevent multiple expansion
+define([AC_PROG_LIBTOOL], [])
+])
+
+AC_DEFUN([AC_LIBTOOL_SETUP],
+[AC_PREREQ(2.13)dnl
+AC_REQUIRE([AC_ENABLE_SHARED])dnl
+AC_REQUIRE([AC_ENABLE_STATIC])dnl
+AC_REQUIRE([AC_ENABLE_FAST_INSTALL])dnl
+AC_REQUIRE([AC_CANONICAL_HOST])dnl
+AC_REQUIRE([AC_CANONICAL_BUILD])dnl
+AC_REQUIRE([AC_PROG_CC])dnl
+AC_REQUIRE([AC_PROG_LD])dnl
+AC_REQUIRE([AC_PROG_LD_RELOAD_FLAG])dnl
+AC_REQUIRE([AC_PROG_NM])dnl
+AC_REQUIRE([LT_AC_PROG_SED])dnl
+
+AC_REQUIRE([AC_PROG_LN_S])dnl
+AC_REQUIRE([AC_DEPLIBS_CHECK_METHOD])dnl
+AC_REQUIRE([AC_OBJEXT])dnl
+AC_REQUIRE([AC_EXEEXT])dnl
+dnl
+
+_LT_AC_PROG_ECHO_BACKSLASH
+# Only perform the check for file, if the check method requires it
+case $deplibs_check_method in
+file_magic*)
+  if test "$file_magic_cmd" = '$MAGIC_CMD'; then
+    AC_PATH_MAGIC
+  fi
+  ;;
+esac
+
+AC_CHECK_TOOL(RANLIB, ranlib, :)
+AC_CHECK_TOOL(STRIP, strip, :)
+
+ifdef([AC_PROVIDE_AC_LIBTOOL_DLOPEN], enable_dlopen=yes, enable_dlopen=no)
+ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL],
+enable_win32_dll=yes, enable_win32_dll=no)
+
+AC_ARG_ENABLE(libtool-lock,
+  [  --disable-libtool-lock  avoid locking (might break parallel builds)])
+test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes
+
+# Some flags need to be propagated to the compiler or linker for good
+# libtool support.
+case $host in
+*-*-irix6*)
+  # Find out which ABI we are using.
+  echo '[#]line __oline__ "configure"' > conftest.$ac_ext
+  if AC_TRY_EVAL(ac_compile); then
+    case `/usr/bin/file conftest.$ac_objext` in
+    *32-bit*)
+      LD="${LD-ld} -32"
+      ;;
+    *N32*)
+      LD="${LD-ld} -n32"
+      ;;
+    *64-bit*)
+      LD="${LD-ld} -64"
+      ;;
+    esac
+  fi
+  rm -rf conftest*
+  ;;
+
+*-*-sco3.2v5*)
+  # On SCO OpenServer 5, we need -belf to get full-featured binaries.
+  SAVE_CFLAGS="$CFLAGS"
+  CFLAGS="$CFLAGS -belf"
+  AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf,
+    [AC_LANG_SAVE
+     AC_LANG_C
+     AC_TRY_LINK([],[],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no])
+     AC_LANG_RESTORE])
+  if test x"$lt_cv_cc_needs_belf" != x"yes"; then
+    # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf
+    CFLAGS="$SAVE_CFLAGS"
+  fi
+  ;;
+
+ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL],
+[*-*-cygwin* | *-*-mingw* | *-*-pw32*)
+  AC_CHECK_TOOL(DLLTOOL, dlltool, false)
+  AC_CHECK_TOOL(AS, as, false)
+  AC_CHECK_TOOL(OBJDUMP, objdump, false)
+
+  # recent cygwin and mingw systems supply a stub DllMain which the user
+  # can override, but on older systems we have to supply one
+  AC_CACHE_CHECK([if libtool should supply DllMain function], lt_cv_need_dllmain,
+    [AC_TRY_LINK([],
+      [extern int __attribute__((__stdcall__)) DllMain(void*, int, void*);
+      DllMain (0, 0, 0);],
+      [lt_cv_need_dllmain=no],[lt_cv_need_dllmain=yes])])
+
+  case $host/$CC in
+  *-*-cygwin*/gcc*-mno-cygwin*|*-*-mingw*)
+    # old mingw systems require "-dll" to link a DLL, while more recent ones
+    # require "-mdll"
+    SAVE_CFLAGS="$CFLAGS"
+    CFLAGS="$CFLAGS -mdll"
+    AC_CACHE_CHECK([how to link DLLs], lt_cv_cc_dll_switch,
+      [AC_TRY_LINK([], [], [lt_cv_cc_dll_switch=-mdll],[lt_cv_cc_dll_switch=-dll])])
+    CFLAGS="$SAVE_CFLAGS" ;;
+  *-*-cygwin* | *-*-pw32*)
+    # cygwin systems need to pass --dll to the linker, and not link
+    # crt.o which will require a WinMain@16 definition.
+    lt_cv_cc_dll_switch="-Wl,--dll -nostartfiles" ;;
+  esac
+  ;;
+  ])
+esac
+
+_LT_AC_LTCONFIG_HACK
+
+])
+
+# AC_LIBTOOL_HEADER_ASSERT
+# ------------------------
+AC_DEFUN([AC_LIBTOOL_HEADER_ASSERT],
+[AC_CACHE_CHECK([whether $CC supports assert without backlinking],
+    [lt_cv_func_assert_works],
+    [case $host in
+    *-*-solaris*)
+      if test "$GCC" = yes && test "$with_gnu_ld" != yes; then
+        case `$CC --version 2>/dev/null` in
+        [[12]].*) lt_cv_func_assert_works=no ;;
+        *)        lt_cv_func_assert_works=yes ;;
+        esac
+      fi
+      ;;
+    esac])
+
+if test "x$lt_cv_func_assert_works" = xyes; then
+  AC_CHECK_HEADERS(assert.h)
+fi
+])# AC_LIBTOOL_HEADER_ASSERT
+
+# _LT_AC_CHECK_DLFCN
+# --------------------
+AC_DEFUN([_LT_AC_CHECK_DLFCN],
+[AC_CHECK_HEADERS(dlfcn.h)
+])# _LT_AC_CHECK_DLFCN
+
+# AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE
+# ---------------------------------
+AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE],
+[AC_REQUIRE([AC_CANONICAL_HOST])
+AC_REQUIRE([AC_PROG_NM])
+AC_REQUIRE([AC_OBJEXT])
+# Check for command to grab the raw symbol name followed by C symbol from nm.
+AC_MSG_CHECKING([command to parse $NM output])
+AC_CACHE_VAL([lt_cv_sys_global_symbol_pipe], [dnl
+
+# These are sane defaults that work on at least a few old systems.
+# [They come from Ultrix.  What could be older than Ultrix?!! ;)]
+
+# Character class describing NM global symbol codes.
+symcode='[[BCDEGRST]]'
+
+# Regexp to match symbols that can be accessed directly from C.
+sympat='\([[_A-Za-z]][[_A-Za-z0-9]]*\)'
+
+# Transform the above into a raw symbol and a C symbol.
+symxfrm='\1 \2\3 \3'
+
+# Transform an extracted symbol line into a proper C declaration
+lt_cv_global_symbol_to_cdecl="sed -n -e 's/^. .* \(.*\)$/extern char \1;/p'"
+
+# Transform an extracted symbol line into symbol name and symbol address
+lt_cv_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/  {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode \([[^ ]]*\) \([[^ ]]*\)$/  {\"\2\", (lt_ptr) \&\2},/p'"
+
+# Define system-specific variables.
+case $host_os in
+aix*)
+  symcode='[[BCDT]]'
+  ;;
+cygwin* | mingw* | pw32*)
+  symcode='[[ABCDGISTW]]'
+  ;;
+hpux*) # Its linker distinguishes data from code symbols
+  lt_cv_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern char \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'"
+  lt_cv_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/  {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/  {\"\2\", (lt_ptr) \&\2},/p'"
+  ;;
+irix* | nonstopux*)
+  symcode='[[BCDEGRST]]'
+  ;;
+osf*)
+  symcode='[[BCDEGQRST]]'
+  ;;
+solaris* | sysv5*)
+  symcode='[[BDT]]'
+  ;;
+sysv4)
+  symcode='[[DFNSTU]]'
+  ;;
+esac
+
+# Handle CRLF in mingw tool chain
+opt_cr=
+case $host_os in
+mingw*)
+  opt_cr=`echo 'x\{0,1\}' | tr x '\015'` # option cr in regexp
+  ;;
+esac
+
+# If we're using GNU nm, then use its standard symbol codes.
+if $NM -V 2>&1 | egrep '(GNU|with BFD)' > /dev/null; then
+  symcode='[[ABCDGISTW]]'
+fi
+
+# Try without a prefix undercore, then with it.
+for ac_symprfx in "" "_"; do
+
+  # Write the raw and C identifiers.
+lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[[ 	]]\($symcode$symcode*\)[[ 	]][[ 	]]*\($ac_symprfx\)$sympat$opt_cr$/$symxfrm/p'"
+
+  # Check to see that the pipe works correctly.
+  pipe_works=no
+  rm -f conftest*
+  cat > conftest.$ac_ext <<EOF
+#ifdef __cplusplus
+extern "C" {
+#endif
+char nm_test_var;
+void nm_test_func(){}
+#ifdef __cplusplus
+}
+#endif
+int main(){nm_test_var='a';nm_test_func();return(0);}
+EOF
+
+  if AC_TRY_EVAL(ac_compile); then
+    # Now try to grab the symbols.
+    nlist=conftest.nm
+    if AC_TRY_EVAL(NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist) && test -s "$nlist"; then
+      # Try sorting and uniquifying the output.
+      if sort "$nlist" | uniq > "$nlist"T; then
+	mv -f "$nlist"T "$nlist"
+      else
+	rm -f "$nlist"T
+      fi
+
+      # Make sure that we snagged all the symbols we need.
+      if egrep ' nm_test_var$' "$nlist" >/dev/null; then
+	if egrep ' nm_test_func$' "$nlist" >/dev/null; then
+	  cat <<EOF > conftest.$ac_ext
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+EOF
+	  # Now generate the symbol file.
+	  eval "$lt_cv_global_symbol_to_cdecl"' < "$nlist" >> conftest.$ac_ext'
+
+	  cat <<EOF >> conftest.$ac_ext
+#if defined (__STDC__) && __STDC__
+# define lt_ptr void *
+#else
+# define lt_ptr char *
+# define const
+#endif
+
+/* The mapping between symbol names and symbols. */
+const struct {
+  const char *name;
+  lt_ptr address;
+}
+lt_preloaded_symbols[[]] =
+{
+EOF
+	  sed "s/^$symcode$symcode* \(.*\) \(.*\)$/  {\"\2\", (lt_ptr) \&\2},/" < "$nlist" >> conftest.$ac_ext
+	  cat <<\EOF >> conftest.$ac_ext
+  {0, (lt_ptr) 0}
+};
+
+#ifdef __cplusplus
+}
+#endif
+EOF
+	  # Now try linking the two files.
+	  mv conftest.$ac_objext conftstm.$ac_objext
+	  save_LIBS="$LIBS"
+	  save_CFLAGS="$CFLAGS"
+	  LIBS="conftstm.$ac_objext"
+	  CFLAGS="$CFLAGS$no_builtin_flag"
+	  if AC_TRY_EVAL(ac_link) && test -s conftest$ac_exeext; then
+	    pipe_works=yes
+	  fi
+	  LIBS="$save_LIBS"
+	  CFLAGS="$save_CFLAGS"
+	else
+	  echo "cannot find nm_test_func in $nlist" >&AC_FD_CC
+	fi
+      else
+	echo "cannot find nm_test_var in $nlist" >&AC_FD_CC
+      fi
+    else
+      echo "cannot run $lt_cv_sys_global_symbol_pipe" >&AC_FD_CC
+    fi
+  else
+    echo "$progname: failed program was:" >&AC_FD_CC
+    cat conftest.$ac_ext >&5
+  fi
+  rm -f conftest* conftst*
+
+  # Do not use the global_symbol_pipe unless it works.
+  if test "$pipe_works" = yes; then
+    break
+  else
+    lt_cv_sys_global_symbol_pipe=
+  fi
+done
+])
+global_symbol_pipe="$lt_cv_sys_global_symbol_pipe"
+if test -z "$lt_cv_sys_global_symbol_pipe"; then
+  global_symbol_to_cdecl=
+  global_symbol_to_c_name_address=
+else
+  global_symbol_to_cdecl="$lt_cv_global_symbol_to_cdecl"
+  global_symbol_to_c_name_address="$lt_cv_global_symbol_to_c_name_address"
+fi
+if test -z "$global_symbol_pipe$global_symbol_to_cdec$global_symbol_to_c_name_address";
+then
+  AC_MSG_RESULT(failed)
+else
+  AC_MSG_RESULT(ok)
+fi
+]) # AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE
+
+# _LT_AC_LIBTOOL_SYS_PATH_SEPARATOR
+# ---------------------------------
+AC_DEFUN([_LT_AC_LIBTOOL_SYS_PATH_SEPARATOR],
+[# Find the correct PATH separator.  Usually this is `:', but
+# DJGPP uses `;' like DOS.
+if test "X${PATH_SEPARATOR+set}" != Xset; then
+  UNAME=${UNAME-`uname 2>/dev/null`}
+  case X$UNAME in
+    *-DOS) lt_cv_sys_path_separator=';' ;;
+    *)     lt_cv_sys_path_separator=':' ;;
+  esac
+  PATH_SEPARATOR=$lt_cv_sys_path_separator
+fi
+])# _LT_AC_LIBTOOL_SYS_PATH_SEPARATOR
+
+# _LT_AC_PROG_ECHO_BACKSLASH
+# --------------------------
+# Add some code to the start of the generated configure script which
+# will find an echo command which doesn't interpret backslashes.
+AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH],
+[ifdef([AC_DIVERSION_NOTICE], [AC_DIVERT_PUSH(AC_DIVERSION_NOTICE)],
+			      [AC_DIVERT_PUSH(NOTICE)])
+_LT_AC_LIBTOOL_SYS_PATH_SEPARATOR
+
+# Check that we are running under the correct shell.
+SHELL=${CONFIG_SHELL-/bin/sh}
+
+case X$ECHO in
+X*--fallback-echo)
+  # Remove one level of quotation (which was required for Make).
+  ECHO=`echo "$ECHO" | sed 's,\\\\\[$]\\[$]0,'[$]0','`
+  ;;
+esac
+
+echo=${ECHO-echo}
+if test "X[$]1" = X--no-reexec; then
+  # Discard the --no-reexec flag, and continue.
+  shift
+elif test "X[$]1" = X--fallback-echo; then
+  # Avoid inline document here, it may be left over
+  :
+elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then
+  # Yippee, $echo works!
+  :
+else
+  # Restart under the correct shell.
+  exec $SHELL "[$]0" --no-reexec ${1+"[$]@"}
+fi
+
+if test "X[$]1" = X--fallback-echo; then
+  # used as fallback echo
+  shift
+  cat <<EOF
+$*
+EOF
+  exit 0
+fi
+
+# The HP-UX ksh and POSIX shell print the target directory to stdout
+# if CDPATH is set.
+if test "X${CDPATH+set}" = Xset; then CDPATH=:; export CDPATH; fi
+
+if test -z "$ECHO"; then
+if test "X${echo_test_string+set}" != Xset; then
+# find a string as large as possible, as long as the shell can cope with it
+  for cmd in 'sed 50q "[$]0"' 'sed 20q "[$]0"' 'sed 10q "[$]0"' 'sed 2q "[$]0"' 'echo test'; do
+    # expected sizes: less than 2Kb, 1Kb, 512 bytes, 16 bytes, ...
+    if (echo_test_string="`eval $cmd`") 2>/dev/null &&
+       echo_test_string="`eval $cmd`" &&
+       (test "X$echo_test_string" = "X$echo_test_string") 2>/dev/null
+    then
+      break
+    fi
+  done
+fi
+
+if test "X`($echo '\t') 2>/dev/null`" = 'X\t' &&
+   echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` &&
+   test "X$echo_testing_string" = "X$echo_test_string"; then
+  :
+else
+  # The Solaris, AIX, and Digital Unix default echo programs unquote
+  # backslashes.  This makes it impossible to quote backslashes using
+  #   echo "$something" | sed 's/\\/\\\\/g'
+  #
+  # So, first we look for a working echo in the user's PATH.
+
+  IFS="${IFS= 	}"; save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+  for dir in $PATH /usr/ucb; do
+    if (test -f $dir/echo || test -f $dir/echo$ac_exeext) &&
+       test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' &&
+       echo_testing_string=`($dir/echo "$echo_test_string") 2>/dev/null` &&
+       test "X$echo_testing_string" = "X$echo_test_string"; then
+      echo="$dir/echo"
+      break
+    fi
+  done
+  IFS="$save_ifs"
+
+  if test "X$echo" = Xecho; then
+    # We didn't find a better echo, so look for alternatives.
+    if test "X`(print -r '\t') 2>/dev/null`" = 'X\t' &&
+       echo_testing_string=`(print -r "$echo_test_string") 2>/dev/null` &&
+       test "X$echo_testing_string" = "X$echo_test_string"; then
+      # This shell has a builtin print -r that does the trick.
+      echo='print -r'
+    elif (test -f /bin/ksh || test -f /bin/ksh$ac_exeext) &&
+	 test "X$CONFIG_SHELL" != X/bin/ksh; then
+      # If we have ksh, try running configure again with it.
+      ORIGINAL_CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
+      export ORIGINAL_CONFIG_SHELL
+      CONFIG_SHELL=/bin/ksh
+      export CONFIG_SHELL
+      exec $CONFIG_SHELL "[$]0" --no-reexec ${1+"[$]@"}
+    else
+      # Try using printf.
+      echo='printf %s\n'
+      if test "X`($echo '\t') 2>/dev/null`" = 'X\t' &&
+	 echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` &&
+	 test "X$echo_testing_string" = "X$echo_test_string"; then
+	# Cool, printf works
+	:
+      elif echo_testing_string=`($ORIGINAL_CONFIG_SHELL "[$]0" --fallback-echo '\t') 2>/dev/null` &&
+	   test "X$echo_testing_string" = 'X\t' &&
+	   echo_testing_string=`($ORIGINAL_CONFIG_SHELL "[$]0" --fallback-echo "$echo_test_string") 2>/dev/null` &&
+	   test "X$echo_testing_string" = "X$echo_test_string"; then
+	CONFIG_SHELL=$ORIGINAL_CONFIG_SHELL
+	export CONFIG_SHELL
+	SHELL="$CONFIG_SHELL"
+	export SHELL
+	echo="$CONFIG_SHELL [$]0 --fallback-echo"
+      elif echo_testing_string=`($CONFIG_SHELL "[$]0" --fallback-echo '\t') 2>/dev/null` &&
+	   test "X$echo_testing_string" = 'X\t' &&
+	   echo_testing_string=`($CONFIG_SHELL "[$]0" --fallback-echo "$echo_test_string") 2>/dev/null` &&
+	   test "X$echo_testing_string" = "X$echo_test_string"; then
+	echo="$CONFIG_SHELL [$]0 --fallback-echo"
+      else
+	# maybe with a smaller string...
+	prev=:
+
+	for cmd in 'echo test' 'sed 2q "[$]0"' 'sed 10q "[$]0"' 'sed 20q "[$]0"' 'sed 50q "[$]0"'; do
+	  if (test "X$echo_test_string" = "X`eval $cmd`") 2>/dev/null
+	  then
+	    break
+	  fi
+	  prev="$cmd"
+	done
+
+	if test "$prev" != 'sed 50q "[$]0"'; then
+	  echo_test_string=`eval $prev`
+	  export echo_test_string
+	  exec ${ORIGINAL_CONFIG_SHELL-${CONFIG_SHELL-/bin/sh}} "[$]0" ${1+"[$]@"}
+	else
+	  # Oops.  We lost completely, so just stick with echo.
+	  echo=echo
+	fi
+      fi
+    fi
+  fi
+fi
+fi
+
+# Copy echo and quote the copy suitably for passing to libtool from
+# the Makefile, instead of quoting the original, which is used later.
+ECHO=$echo
+if test "X$ECHO" = "X$CONFIG_SHELL [$]0 --fallback-echo"; then
+   ECHO="$CONFIG_SHELL \\\$\[$]0 --fallback-echo"
+fi
+
+AC_SUBST(ECHO)
+AC_DIVERT_POP
+])# _LT_AC_PROG_ECHO_BACKSLASH
+
+# _LT_AC_TRY_DLOPEN_SELF (ACTION-IF-TRUE, ACTION-IF-TRUE-W-USCORE,
+#                           ACTION-IF-FALSE, ACTION-IF-CROSS-COMPILING)
+# ------------------------------------------------------------------
+AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF],
+[if test "$cross_compiling" = yes; then :
+  [$4]
+else
+  AC_REQUIRE([_LT_AC_CHECK_DLFCN])dnl
+  lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
+  lt_status=$lt_dlunknown
+  cat > conftest.$ac_ext <<EOF
+[#line __oline__ "configure"
+#include "confdefs.h"
+
+#if HAVE_DLFCN_H
+#include <dlfcn.h>
+#endif
+
+#include <stdio.h>
+
+#ifdef RTLD_GLOBAL
+#  define LT_DLGLOBAL		RTLD_GLOBAL
+#else
+#  ifdef DL_GLOBAL
+#    define LT_DLGLOBAL		DL_GLOBAL
+#  else
+#    define LT_DLGLOBAL		0
+#  endif
+#endif
+
+/* We may have to define LT_DLLAZY_OR_NOW in the command line if we
+   find out it does not work in some platform. */
+#ifndef LT_DLLAZY_OR_NOW
+#  ifdef RTLD_LAZY
+#    define LT_DLLAZY_OR_NOW		RTLD_LAZY
+#  else
+#    ifdef DL_LAZY
+#      define LT_DLLAZY_OR_NOW		DL_LAZY
+#    else
+#      ifdef RTLD_NOW
+#        define LT_DLLAZY_OR_NOW	RTLD_NOW
+#      else
+#        ifdef DL_NOW
+#          define LT_DLLAZY_OR_NOW	DL_NOW
+#        else
+#          define LT_DLLAZY_OR_NOW	0
+#        endif
+#      endif
+#    endif
+#  endif
+#endif
+
+#ifdef __cplusplus
+extern "C" void exit (int);
+#endif
+
+void fnord() { int i=42;}
+int main ()
+{
+  void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW);
+  int status = $lt_dlunknown;
+
+  if (self)
+    {
+      if (dlsym (self,"fnord"))       status = $lt_dlno_uscore;
+      else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore;
+      /* dlclose (self); */
+    }
+
+    exit (status);
+}]
+EOF
+  if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext} 2>/dev/null; then
+    (./conftest; exit; ) 2>/dev/null
+    lt_status=$?
+    case x$lt_status in
+      x$lt_dlno_uscore) $1 ;;
+      x$lt_dlneed_uscore) $2 ;;
+      x$lt_unknown|x*) $3 ;;
+    esac
+  else :
+    # compilation failed
+    $3
+  fi
+fi
+rm -fr conftest*
+])# _LT_AC_TRY_DLOPEN_SELF
+
+# AC_LIBTOOL_DLOPEN_SELF
+# -------------------
+AC_DEFUN([AC_LIBTOOL_DLOPEN_SELF],
+[if test "x$enable_dlopen" != xyes; then
+  enable_dlopen=unknown
+  enable_dlopen_self=unknown
+  enable_dlopen_self_static=unknown
+else
+  lt_cv_dlopen=no
+  lt_cv_dlopen_libs=
+
+  case $host_os in
+  beos*)
+    lt_cv_dlopen="load_add_on"
+    lt_cv_dlopen_libs=
+    lt_cv_dlopen_self=yes
+    ;;
+
+  cygwin* | mingw* | pw32*)
+    lt_cv_dlopen="LoadLibrary"
+    lt_cv_dlopen_libs=
+   ;;
+
+  *)
+    AC_CHECK_FUNC([shl_load],
+          [lt_cv_dlopen="shl_load"],
+      [AC_CHECK_LIB([dld], [shl_load],
+            [lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-dld"],
+	[AC_CHECK_FUNC([dlopen],
+	      [lt_cv_dlopen="dlopen"],
+	  [AC_CHECK_LIB([dl], [dlopen],
+	        [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"],
+	    [AC_CHECK_LIB([svld], [dlopen],
+	          [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"],
+	      [AC_CHECK_LIB([dld], [dld_link],
+	            [lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-dld"])
+	      ])
+	    ])
+	  ])
+	])
+      ])
+    ;;
+  esac
+
+  if test "x$lt_cv_dlopen" != xno; then
+    enable_dlopen=yes
+  else
+    enable_dlopen=no
+  fi
+
+  case $lt_cv_dlopen in
+  dlopen)
+    save_CPPFLAGS="$CPPFLAGS"
+    AC_REQUIRE([_LT_AC_CHECK_DLFCN])dnl
+    test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H"
+
+    save_LDFLAGS="$LDFLAGS"
+    eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\"
+
+    save_LIBS="$LIBS"
+    LIBS="$lt_cv_dlopen_libs $LIBS"
+
+    AC_CACHE_CHECK([whether a program can dlopen itself],
+	  lt_cv_dlopen_self, [dnl
+	  _LT_AC_TRY_DLOPEN_SELF(
+	    lt_cv_dlopen_self=yes, lt_cv_dlopen_self=yes,
+	    lt_cv_dlopen_self=no, lt_cv_dlopen_self=cross)
+    ])
+
+    if test "x$lt_cv_dlopen_self" = xyes; then
+      LDFLAGS="$LDFLAGS $link_static_flag"
+      AC_CACHE_CHECK([whether a statically linked program can dlopen itself],
+    	  lt_cv_dlopen_self_static, [dnl
+	  _LT_AC_TRY_DLOPEN_SELF(
+	    lt_cv_dlopen_self_static=yes, lt_cv_dlopen_self_static=yes,
+	    lt_cv_dlopen_self_static=no,  lt_cv_dlopen_self_static=cross)
+      ])
+    fi
+
+    CPPFLAGS="$save_CPPFLAGS"
+    LDFLAGS="$save_LDFLAGS"
+    LIBS="$save_LIBS"
+    ;;
+  esac
+
+  case $lt_cv_dlopen_self in
+  yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;;
+  *) enable_dlopen_self=unknown ;;
+  esac
+
+  case $lt_cv_dlopen_self_static in
+  yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;;
+  *) enable_dlopen_self_static=unknown ;;
+  esac
+fi
+])# AC_LIBTOOL_DLOPEN_SELF
+
+AC_DEFUN([_LT_AC_LTCONFIG_HACK],
+[AC_REQUIRE([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE])dnl
+# Sed substitution that helps us do robust quoting.  It backslashifies
+# metacharacters that are still active within double-quoted strings.
+Xsed='sed -e s/^X//'
+sed_quote_subst='s/\([[\\"\\`$\\\\]]\)/\\\1/g'
+
+# Same as above, but do not quote variable references.
+double_quote_subst='s/\([[\\"\\`\\\\]]\)/\\\1/g'
+
+# Sed substitution to delay expansion of an escaped shell variable in a
+# double_quote_subst'ed string.
+delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g'
+
+# Constants:
+rm="rm -f"
+
+# Global variables:
+default_ofile=libtool
+can_build_shared=yes
+
+# All known linkers require a `.a' archive for static linking (except M$VC,
+# which needs '.lib').
+libext=a
+ltmain="$ac_aux_dir/ltmain.sh"
+ofile="$default_ofile"
+with_gnu_ld="$lt_cv_prog_gnu_ld"
+need_locks="$enable_libtool_lock"
+
+old_CC="$CC"
+old_CFLAGS="$CFLAGS"
+
+# Set sane defaults for various variables
+test -z "$AR" && AR=ar
+test -z "$AR_FLAGS" && AR_FLAGS=cru
+test -z "$AS" && AS=as
+test -z "$CC" && CC=cc
+test -z "$DLLTOOL" && DLLTOOL=dlltool
+test -z "$LD" && LD=ld
+test -z "$LN_S" && LN_S="ln -s"
+test -z "$MAGIC_CMD" && MAGIC_CMD=file
+test -z "$NM" && NM=nm
+test -z "$OBJDUMP" && OBJDUMP=objdump
+test -z "$RANLIB" && RANLIB=:
+test -z "$STRIP" && STRIP=:
+test -z "$ac_objext" && ac_objext=o
+
+if test x"$host" != x"$build"; then
+  ac_tool_prefix=${host_alias}-
+else
+  ac_tool_prefix=
+fi
+
+# Transform linux* to *-*-linux-gnu*, to support old configure scripts.
+case $host_os in
+linux-gnu*) ;;
+linux*) host=`echo $host | sed 's/^\(.*-.*-linux\)\(.*\)$/\1-gnu\2/'`
+esac
+
+case $host_os in
+aix3*)
+  # AIX sometimes has problems with the GCC collect2 program.  For some
+  # reason, if we set the COLLECT_NAMES environment variable, the problems
+  # vanish in a puff of smoke.
+  if test "X${COLLECT_NAMES+set}" != Xset; then
+    COLLECT_NAMES=
+    export COLLECT_NAMES
+  fi
+  ;;
+esac
+
+# Determine commands to create old-style static archives.
+old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs$old_deplibs'
+old_postinstall_cmds='chmod 644 $oldlib'
+old_postuninstall_cmds=
+
+if test -n "$RANLIB"; then
+  case $host_os in
+  openbsd*)
+    old_postinstall_cmds="\$RANLIB -t \$oldlib~$old_postinstall_cmds"
+    ;;
+  *)
+    old_postinstall_cmds="\$RANLIB \$oldlib~$old_postinstall_cmds"
+    ;;
+  esac
+  old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib"
+fi
+
+# Allow CC to be a program name with arguments.
+set dummy $CC
+compiler="[$]2"
+
+## FIXME: this should be a separate macro
+##
+AC_MSG_CHECKING([for objdir])
+rm -f .libs 2>/dev/null
+mkdir .libs 2>/dev/null
+if test -d .libs; then
+  objdir=.libs
+else
+  # MS-DOS does not allow filenames that begin with a dot.
+  objdir=_libs
+fi
+rmdir .libs 2>/dev/null
+AC_MSG_RESULT($objdir)
+##
+## END FIXME
+
+
+## FIXME: this should be a separate macro
+##
+AC_ARG_WITH(pic,
+[  --with-pic              try to use only PIC/non-PIC objects [default=use both]],
+pic_mode="$withval", pic_mode=default)
+test -z "$pic_mode" && pic_mode=default
+
+# We assume here that the value for lt_cv_prog_cc_pic will not be cached
+# in isolation, and that seeing it set (from the cache) indicates that
+# the associated values are set (in the cache) correctly too.
+AC_MSG_CHECKING([for $compiler option to produce PIC])
+AC_CACHE_VAL(lt_cv_prog_cc_pic,
+[ lt_cv_prog_cc_pic=
+  lt_cv_prog_cc_shlib=
+  lt_cv_prog_cc_wl=
+  lt_cv_prog_cc_static=
+  lt_cv_prog_cc_no_builtin=
+  lt_cv_prog_cc_can_build_shared=$can_build_shared
+
+  if test "$GCC" = yes; then
+    lt_cv_prog_cc_wl='-Wl,'
+    lt_cv_prog_cc_static='-static'
+
+    case $host_os in
+    aix*)
+      # Below there is a dirty hack to force normal static linking with -ldl
+      # The problem is because libdl dynamically linked with both libc and
+      # libC (AIX C++ library), which obviously doesn't included in libraries
+      # list by gcc. This cause undefined symbols with -static flags.
+      # This hack allows C programs to be linked with "-static -ldl", but
+      # not sure about C++ programs.
+      lt_cv_prog_cc_static="$lt_cv_prog_cc_static ${lt_cv_prog_cc_wl}-lC"
+      ;;
+    amigaos*)
+      # FIXME: we need at least 68020 code to build shared libraries, but
+      # adding the `-m68020' flag to GCC prevents building anything better,
+      # like `-m68040'.
+      lt_cv_prog_cc_pic='-m68020 -resident32 -malways-restore-a4'
+      ;;
+    beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
+      # PIC is the default for these OSes.
+      ;;
+    darwin* | rhapsody*)
+      # PIC is the default on this platform
+      # Common symbols not allowed in MH_DYLIB files
+      lt_cv_prog_cc_pic='-fno-common'
+      ;;
+    cygwin* | mingw* | pw32* | os2*)
+      # This hack is so that the source file can tell whether it is being
+      # built for inclusion in a dll (and should export symbols for example).
+      lt_cv_prog_cc_pic='-DDLL_EXPORT'
+      ;;
+    sysv4*MP*)
+      if test -d /usr/nec; then
+	 lt_cv_prog_cc_pic=-Kconform_pic
+      fi
+      ;;
+    *)
+      lt_cv_prog_cc_pic='-fPIC'
+      ;;
+    esac
+  else
+    # PORTME Check for PIC flags for the system compiler.
+    case $host_os in
+    aix3* | aix4* | aix5*)
+      lt_cv_prog_cc_wl='-Wl,'
+      # All AIX code is PIC.
+      if test "$host_cpu" = ia64; then
+	# AIX 5 now supports IA64 processor
+	lt_cv_prog_cc_static='-Bstatic'
+      else
+	lt_cv_prog_cc_static='-bnso -bI:/lib/syscalls.exp'
+      fi
+      ;;
+
+    hpux9* | hpux10* | hpux11*)
+      # Is there a better lt_cv_prog_cc_static that works with the bundled CC?
+      lt_cv_prog_cc_wl='-Wl,'
+      lt_cv_prog_cc_static="${lt_cv_prog_cc_wl}-a ${lt_cv_prog_cc_wl}archive"
+      lt_cv_prog_cc_pic='+Z'
+      ;;
+
+    irix5* | irix6* | nonstopux*)
+      lt_cv_prog_cc_wl='-Wl,'
+      lt_cv_prog_cc_static='-non_shared'
+      # PIC (with -KPIC) is the default.
+      ;;
+
+    cygwin* | mingw* | pw32* | os2*)
+      # This hack is so that the source file can tell whether it is being
+      # built for inclusion in a dll (and should export symbols for example).
+      lt_cv_prog_cc_pic='-DDLL_EXPORT'
+      ;;
+
+    newsos6)
+      lt_cv_prog_cc_pic='-KPIC'
+      lt_cv_prog_cc_static='-Bstatic'
+      ;;
+
+    osf3* | osf4* | osf5*)
+      # All OSF/1 code is PIC.
+      lt_cv_prog_cc_wl='-Wl,'
+      lt_cv_prog_cc_static='-non_shared'
+      ;;
+
+    sco3.2v5*)
+      lt_cv_prog_cc_pic='-Kpic'
+      lt_cv_prog_cc_static='-dn'
+      lt_cv_prog_cc_shlib='-belf'
+      ;;
+
+    solaris*)
+      lt_cv_prog_cc_pic='-KPIC'
+      lt_cv_prog_cc_static='-Bstatic'
+      lt_cv_prog_cc_wl='-Wl,'
+      ;;
+
+    sunos4*)
+      lt_cv_prog_cc_pic='-PIC'
+      lt_cv_prog_cc_static='-Bstatic'
+      lt_cv_prog_cc_wl='-Qoption ld '
+      ;;
+
+    sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
+      lt_cv_prog_cc_pic='-KPIC'
+      lt_cv_prog_cc_static='-Bstatic'
+      lt_cv_prog_cc_wl='-Wl,'
+      ;;
+
+    uts4*)
+      lt_cv_prog_cc_pic='-pic'
+      lt_cv_prog_cc_static='-Bstatic'
+      ;;
+
+    sysv4*MP*)
+      if test -d /usr/nec ;then
+	lt_cv_prog_cc_pic='-Kconform_pic'
+	lt_cv_prog_cc_static='-Bstatic'
+      fi
+      ;;
+
+    *)
+      lt_cv_prog_cc_can_build_shared=no
+      ;;
+    esac
+  fi
+])
+if test -z "$lt_cv_prog_cc_pic"; then
+  AC_MSG_RESULT([none])
+else
+  AC_MSG_RESULT([$lt_cv_prog_cc_pic])
+
+  # Check to make sure the pic_flag actually works.
+  AC_MSG_CHECKING([if $compiler PIC flag $lt_cv_prog_cc_pic works])
+  AC_CACHE_VAL(lt_cv_prog_cc_pic_works, [dnl
+    save_CFLAGS="$CFLAGS"
+    CFLAGS="$CFLAGS $lt_cv_prog_cc_pic -DPIC"
+    AC_TRY_COMPILE([], [], [dnl
+      case $host_os in
+      hpux9* | hpux10* | hpux11*)
+	# On HP-UX, both CC and GCC only warn that PIC is supported... then
+	# they create non-PIC objects.  So, if there were any warnings, we
+	# assume that PIC is not supported.
+	if test -s conftest.err; then
+	  lt_cv_prog_cc_pic_works=no
+	else
+	  lt_cv_prog_cc_pic_works=yes
+	fi
+	;;
+      *)
+	lt_cv_prog_cc_pic_works=yes
+	;;
+      esac
+    ], [dnl
+      lt_cv_prog_cc_pic_works=no
+    ])
+    CFLAGS="$save_CFLAGS"
+  ])
+
+  if test "X$lt_cv_prog_cc_pic_works" = Xno; then
+    lt_cv_prog_cc_pic=
+    lt_cv_prog_cc_can_build_shared=no
+  else
+    lt_cv_prog_cc_pic=" $lt_cv_prog_cc_pic"
+  fi
+
+  AC_MSG_RESULT([$lt_cv_prog_cc_pic_works])
+fi
+##
+## END FIXME
+
+# Check for any special shared library compilation flags.
+if test -n "$lt_cv_prog_cc_shlib"; then
+  AC_MSG_WARN([\`$CC' requires \`$lt_cv_prog_cc_shlib' to build shared libraries])
+  if echo "$old_CC $old_CFLAGS " | egrep -e "[[ 	]]$lt_cv_prog_cc_shlib[[ 	]]" >/dev/null; then :
+  else
+   AC_MSG_WARN([add \`$lt_cv_prog_cc_shlib' to the CC or CFLAGS env variable and reconfigure])
+    lt_cv_prog_cc_can_build_shared=no
+  fi
+fi
+
+## FIXME: this should be a separate macro
+##
+AC_MSG_CHECKING([if $compiler static flag $lt_cv_prog_cc_static works])
+AC_CACHE_VAL([lt_cv_prog_cc_static_works], [dnl
+  lt_cv_prog_cc_static_works=no
+  save_LDFLAGS="$LDFLAGS"
+  LDFLAGS="$LDFLAGS $lt_cv_prog_cc_static"
+  AC_TRY_LINK([], [], [lt_cv_prog_cc_static_works=yes])
+  LDFLAGS="$save_LDFLAGS"
+])
+
+# Belt *and* braces to stop my trousers falling down:
+test "X$lt_cv_prog_cc_static_works" = Xno && lt_cv_prog_cc_static=
+AC_MSG_RESULT([$lt_cv_prog_cc_static_works])
+
+pic_flag="$lt_cv_prog_cc_pic"
+special_shlib_compile_flags="$lt_cv_prog_cc_shlib"
+wl="$lt_cv_prog_cc_wl"
+link_static_flag="$lt_cv_prog_cc_static"
+no_builtin_flag="$lt_cv_prog_cc_no_builtin"
+can_build_shared="$lt_cv_prog_cc_can_build_shared"
+##
+## END FIXME
+
+
+## FIXME: this should be a separate macro
+##
+# Check to see if options -o and -c are simultaneously supported by compiler
+AC_MSG_CHECKING([if $compiler supports -c -o file.$ac_objext])
+AC_CACHE_VAL([lt_cv_compiler_c_o], [
+$rm -r conftest 2>/dev/null
+mkdir conftest
+cd conftest
+echo "int some_variable = 0;" > conftest.$ac_ext
+mkdir out
+# According to Tom Tromey, Ian Lance Taylor reported there are C compilers
+# that will create temporary files in the current directory regardless of
+# the output directory.  Thus, making CWD read-only will cause this test
+# to fail, enabling locking or at least warning the user not to do parallel
+# builds.
+chmod -w .
+save_CFLAGS="$CFLAGS"
+CFLAGS="$CFLAGS -o out/conftest2.$ac_objext"
+compiler_c_o=no
+if { (eval echo configure:__oline__: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>out/conftest.err; } && test -s out/conftest2.$ac_objext; then
+  # The compiler can only warn and ignore the option if not recognized
+  # So say no if there are warnings
+  if test -s out/conftest.err; then
+    lt_cv_compiler_c_o=no
+  else
+    lt_cv_compiler_c_o=yes
+  fi
+else
+  # Append any errors to the config.log.
+  cat out/conftest.err 1>&AC_FD_CC
+  lt_cv_compiler_c_o=no
+fi
+CFLAGS="$save_CFLAGS"
+chmod u+w .
+$rm conftest* out/*
+rmdir out
+cd ..
+rmdir conftest
+$rm -r conftest 2>/dev/null
+])
+compiler_c_o=$lt_cv_compiler_c_o
+AC_MSG_RESULT([$compiler_c_o])
+
+if test x"$compiler_c_o" = x"yes"; then
+  # Check to see if we can write to a .lo
+  AC_MSG_CHECKING([if $compiler supports -c -o file.lo])
+  AC_CACHE_VAL([lt_cv_compiler_o_lo], [
+  lt_cv_compiler_o_lo=no
+  save_CFLAGS="$CFLAGS"
+  CFLAGS="$CFLAGS -c -o conftest.lo"
+  save_objext="$ac_objext"
+  ac_objext=lo
+  AC_TRY_COMPILE([], [int some_variable = 0;], [dnl
+    # The compiler can only warn and ignore the option if not recognized
+    # So say no if there are warnings
+    if test -s conftest.err; then
+      lt_cv_compiler_o_lo=no
+    else
+      lt_cv_compiler_o_lo=yes
+    fi
+  ])
+  ac_objext="$save_objext"
+  CFLAGS="$save_CFLAGS"
+  ])
+  compiler_o_lo=$lt_cv_compiler_o_lo
+  AC_MSG_RESULT([$compiler_o_lo])
+else
+  compiler_o_lo=no
+fi
+##
+## END FIXME
+
+## FIXME: this should be a separate macro
+##
+# Check to see if we can do hard links to lock some files if needed
+hard_links="nottested"
+if test "$compiler_c_o" = no && test "$need_locks" != no; then
+  # do not overwrite the value of need_locks provided by the user
+  AC_MSG_CHECKING([if we can lock with hard links])
+  hard_links=yes
+  $rm conftest*
+  ln conftest.a conftest.b 2>/dev/null && hard_links=no
+  touch conftest.a
+  ln conftest.a conftest.b 2>&5 || hard_links=no
+  ln conftest.a conftest.b 2>/dev/null && hard_links=no
+  AC_MSG_RESULT([$hard_links])
+  if test "$hard_links" = no; then
+    AC_MSG_WARN([\`$CC' does not support \`-c -o', so \`make -j' may be unsafe])
+    need_locks=warn
+  fi
+else
+  need_locks=no
+fi
+##
+## END FIXME
+
+## FIXME: this should be a separate macro
+##
+if test "$GCC" = yes; then
+  # Check to see if options -fno-rtti -fno-exceptions are supported by compiler
+  AC_MSG_CHECKING([if $compiler supports -fno-rtti -fno-exceptions])
+  echo "int some_variable = 0;" > conftest.$ac_ext
+  save_CFLAGS="$CFLAGS"
+  CFLAGS="$CFLAGS -fno-rtti -fno-exceptions -c conftest.$ac_ext"
+  compiler_rtti_exceptions=no
+  AC_TRY_COMPILE([], [int some_variable = 0;], [dnl
+    # The compiler can only warn and ignore the option if not recognized
+    # So say no if there are warnings
+    if test -s conftest.err; then
+      compiler_rtti_exceptions=no
+    else
+      compiler_rtti_exceptions=yes
+    fi
+  ])
+  CFLAGS="$save_CFLAGS"
+  AC_MSG_RESULT([$compiler_rtti_exceptions])
+
+  if test "$compiler_rtti_exceptions" = "yes"; then
+    no_builtin_flag=' -fno-builtin -fno-rtti -fno-exceptions'
+  else
+    no_builtin_flag=' -fno-builtin'
+  fi
+fi
+##
+## END FIXME
+
+## FIXME: this should be a separate macro
+##
+# See if the linker supports building shared libraries.
+AC_MSG_CHECKING([whether the linker ($LD) supports shared libraries])
+
+allow_undefined_flag=
+no_undefined_flag=
+need_lib_prefix=unknown
+need_version=unknown
+# when you set need_version to no, make sure it does not cause -set_version
+# flags to be left without arguments
+archive_cmds=
+archive_expsym_cmds=
+old_archive_from_new_cmds=
+old_archive_from_expsyms_cmds=
+export_dynamic_flag_spec=
+whole_archive_flag_spec=
+thread_safe_flag_spec=
+hardcode_into_libs=no
+hardcode_libdir_flag_spec=
+hardcode_libdir_separator=
+hardcode_direct=no
+hardcode_minus_L=no
+hardcode_shlibpath_var=unsupported
+runpath_var=
+link_all_deplibs=unknown
+always_export_symbols=no
+export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | sed '\''s/.* //'\'' | sort | uniq > $export_symbols'
+# include_expsyms should be a list of space-separated symbols to be *always*
+# included in the symbol list
+include_expsyms=
+# exclude_expsyms can be an egrep regular expression of symbols to exclude
+# it will be wrapped by ` (' and `)$', so one must not match beginning or
+# end of line.  Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc',
+# as well as any symbol that contains `d'.
+exclude_expsyms="_GLOBAL_OFFSET_TABLE_"
+# Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out
+# platforms (ab)use it in PIC code, but their linkers get confused if
+# the symbol is explicitly referenced.  Since portable code cannot
+# rely on this symbol name, it's probably fine to never include it in
+# preloaded symbol tables.
+extract_expsyms_cmds=
+
+case $host_os in
+cygwin* | mingw* | pw32*)
+  # FIXME: the MSVC++ port hasn't been tested in a loooong time
+  # When not using gcc, we currently assume that we are using
+  # Microsoft Visual C++.
+  if test "$GCC" != yes; then
+    with_gnu_ld=no
+  fi
+  ;;
+openbsd*)
+  with_gnu_ld=no
+  ;;
+esac
+
+ld_shlibs=yes
+if test "$with_gnu_ld" = yes; then
+  # If archive_cmds runs LD, not CC, wlarc should be empty
+  wlarc='${wl}'
+
+  # See if GNU ld supports shared libraries.
+  case $host_os in
+  aix3* | aix4* | aix5*)
+    # On AIX, the GNU linker is very broken
+    # Note:Check GNU linker on AIX 5-IA64 when/if it becomes available.
+    ld_shlibs=no
+    cat <<EOF 1>&2
+
+*** Warning: the GNU linker, at least up to release 2.9.1, is reported
+*** to be unable to reliably create shared libraries on AIX.
+*** Therefore, libtool is disabling shared libraries support.  If you
+*** really care for shared libraries, you may want to modify your PATH
+*** so that a non-GNU linker is found, and then restart.
+
+EOF
+    ;;
+
+  amigaos*)
+    archive_cmds='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
+    hardcode_libdir_flag_spec='-L$libdir'
+    hardcode_minus_L=yes
+
+    # Samuel A. Falvo II <kc5tja@dolphin.openprojects.net> reports
+    # that the semantics of dynamic libraries on AmigaOS, at least up
+    # to version 4, is to share data among multiple programs linked
+    # with the same dynamic library.  Since this doesn't match the
+    # behavior of shared libraries on other platforms, we can use
+    # them.
+    ld_shlibs=no
+    ;;
+
+  beos*)
+    if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then
+      allow_undefined_flag=unsupported
+      # Joseph Beckenbach <jrb3@best.com> says some releases of gcc
+      # support --undefined.  This deserves some investigation.  FIXME
+      archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+    else
+      ld_shlibs=no
+    fi
+    ;;
+
+  cygwin* | mingw* | pw32*)
+    # hardcode_libdir_flag_spec is actually meaningless, as there is
+    # no search path for DLLs.
+    hardcode_libdir_flag_spec='-L$libdir'
+    allow_undefined_flag=unsupported
+    always_export_symbols=yes
+
+    extract_expsyms_cmds='test -f $output_objdir/impgen.c || \
+      sed -e "/^# \/\* impgen\.c starts here \*\//,/^# \/\* impgen.c ends here \*\// { s/^# //;s/^# *$//; p; }" -e d < $''0 > $output_objdir/impgen.c~
+      test -f $output_objdir/impgen.exe || (cd $output_objdir && \
+      if test "x$HOST_CC" != "x" ; then $HOST_CC -o impgen impgen.c ; \
+      else $CC -o impgen impgen.c ; fi)~
+      $output_objdir/impgen $dir/$soroot > $output_objdir/$soname-def'
+
+    old_archive_from_expsyms_cmds='$DLLTOOL --as=$AS --dllname $soname --def $output_objdir/$soname-def --output-lib $output_objdir/$newlib'
+
+    # cygwin and mingw dlls have different entry points and sets of symbols
+    # to exclude.
+    # FIXME: what about values for MSVC?
+    dll_entry=__cygwin_dll_entry@12
+    dll_exclude_symbols=DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12~
+    case $host_os in
+    mingw*)
+      # mingw values
+      dll_entry=_DllMainCRTStartup@12
+      dll_exclude_symbols=DllMain@12,DllMainCRTStartup@12,DllEntryPoint@12~
+      ;;
+    esac
+
+    # mingw and cygwin differ, and it's simplest to just exclude the union
+    # of the two symbol sets.
+    dll_exclude_symbols=DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12,DllMainCRTStartup@12,DllEntryPoint@12
+
+    # recent cygwin and mingw systems supply a stub DllMain which the user
+    # can override, but on older systems we have to supply one (in ltdll.c)
+    if test "x$lt_cv_need_dllmain" = "xyes"; then
+      ltdll_obj='$output_objdir/$soname-ltdll.'"$ac_objext "
+      ltdll_cmds='test -f $output_objdir/$soname-ltdll.c || sed -e "/^# \/\* ltdll\.c starts here \*\//,/^# \/\* ltdll.c ends here \*\// { s/^# //; p; }" -e d < $''0 > $output_objdir/$soname-ltdll.c~
+	test -f $output_objdir/$soname-ltdll.$ac_objext || (cd $output_objdir && $CC -c $soname-ltdll.c)~'
+    else
+      ltdll_obj=
+      ltdll_cmds=
+    fi
+
+    # Extract the symbol export list from an `--export-all' def file,
+    # then regenerate the def file from the symbol export list, so that
+    # the compiled dll only exports the symbol export list.
+    # Be careful not to strip the DATA tag left be newer dlltools.
+    export_symbols_cmds="$ltdll_cmds"'
+      $DLLTOOL --export-all --exclude-symbols '$dll_exclude_symbols' --output-def $output_objdir/$soname-def '$ltdll_obj'$libobjs $convenience~
+      sed -e "1,/EXPORTS/d" -e "s/ @ [[0-9]]*//" -e "s/ *;.*$//" < $output_objdir/$soname-def > $export_symbols'
+
+    # If the export-symbols file already is a .def file (1st line
+    # is EXPORTS), use it as is.
+    # If DATA tags from a recent dlltool are present, honour them!
+    archive_expsym_cmds='if test "x`sed 1q $export_symbols`" = xEXPORTS; then
+	cp $export_symbols $output_objdir/$soname-def;
+      else
+	echo EXPORTS > $output_objdir/$soname-def;
+	_lt_hint=1;
+	cat $export_symbols | while read symbol; do
+	 set dummy \$symbol;
+	 case \[$]# in
+	   2) echo "   \[$]2 @ \$_lt_hint ; " >> $output_objdir/$soname-def;;
+	   4) echo "   \[$]2 \[$]3 \[$]4 ; " >> $output_objdir/$soname-def; _lt_hint=`expr \$_lt_hint - 1`;;
+	   *) echo "     \[$]2 @ \$_lt_hint \[$]3 ; " >> $output_objdir/$soname-def;;
+	 esac;
+	 _lt_hint=`expr 1 + \$_lt_hint`;
+	done;
+      fi~
+      '"$ltdll_cmds"'
+      $CC -Wl,--base-file,$output_objdir/$soname-base '$lt_cv_cc_dll_switch' -Wl,-e,'$dll_entry' -o $output_objdir/$soname '$ltdll_obj'$libobjs $deplibs $compiler_flags~
+      $DLLTOOL --as=$AS --dllname $soname --exclude-symbols '$dll_exclude_symbols' --def $output_objdir/$soname-def --base-file $output_objdir/$soname-base --output-exp $output_objdir/$soname-exp~
+      $CC -Wl,--base-file,$output_objdir/$soname-base $output_objdir/$soname-exp '$lt_cv_cc_dll_switch' -Wl,-e,'$dll_entry' -o $output_objdir/$soname '$ltdll_obj'$libobjs $deplibs $compiler_flags~
+      $DLLTOOL --as=$AS --dllname $soname --exclude-symbols '$dll_exclude_symbols' --def $output_objdir/$soname-def --base-file $output_objdir/$soname-base --output-exp $output_objdir/$soname-exp --output-lib $output_objdir/$libname.dll.a~
+      $CC $output_objdir/$soname-exp '$lt_cv_cc_dll_switch' -Wl,-e,'$dll_entry' -o $output_objdir/$soname '$ltdll_obj'$libobjs $deplibs $compiler_flags'
+    ;;
+
+  netbsd*)
+    if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
+      archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib'
+      wlarc=
+    else
+      archive_cmds='$CC -shared -nodefaultlibs $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+      archive_expsym_cmds='$CC -shared -nodefaultlibs $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+    fi
+    ;;
+
+  solaris* | sysv5*)
+    if $LD -v 2>&1 | egrep 'BFD 2\.8' > /dev/null; then
+      ld_shlibs=no
+      cat <<EOF 1>&2
+
+*** Warning: The releases 2.8.* of the GNU linker cannot reliably
+*** create shared libraries on Solaris systems.  Therefore, libtool
+*** is disabling shared libraries support.  We urge you to upgrade GNU
+*** binutils to release 2.9.1 or newer.  Another option is to modify
+*** your PATH or compiler configuration so that the native linker is
+*** used, and then restart.
+
+EOF
+    elif $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then
+      archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+      archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+    else
+      ld_shlibs=no
+    fi
+    ;;
+
+  sunos4*)
+    archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+    wlarc=
+    hardcode_direct=yes
+    hardcode_shlibpath_var=no
+    ;;
+
+  *)
+    if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then
+      archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+      archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+    else
+      ld_shlibs=no
+    fi
+    ;;
+  esac
+
+  if test "$ld_shlibs" = yes; then
+    runpath_var=LD_RUN_PATH
+    hardcode_libdir_flag_spec='${wl}--rpath ${wl}$libdir'
+    export_dynamic_flag_spec='${wl}--export-dynamic'
+    case $host_os in
+    cygwin* | mingw* | pw32*)
+      # dlltool doesn't understand --whole-archive et. al.
+      whole_archive_flag_spec=
+      ;;
+    *)
+      # ancient GNU ld didn't support --whole-archive et. al.
+      if $LD --help 2>&1 | egrep 'no-whole-archive' > /dev/null; then
+	whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+      else
+	whole_archive_flag_spec=
+      fi
+      ;;
+    esac
+  fi
+else
+  # PORTME fill in a description of your system's linker (not GNU ld)
+  case $host_os in
+  aix3*)
+    allow_undefined_flag=unsupported
+    always_export_symbols=yes
+    archive_expsym_cmds='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname'
+    # Note: this linker hardcodes the directories in LIBPATH if there
+    # are no directories specified by -L.
+    hardcode_minus_L=yes
+    if test "$GCC" = yes && test -z "$link_static_flag"; then
+      # Neither direct hardcoding nor static linking is supported with a
+      # broken collect2.
+      hardcode_direct=unsupported
+    fi
+    ;;
+
+  aix4* | aix5*)
+    if test "$host_cpu" = ia64; then
+      # On IA64, the linker does run time linking by default, so we don't
+      # have to do anything special.
+      aix_use_runtimelinking=no
+      exp_sym_flag='-Bexport'
+      no_entry_flag=""
+    else
+      aix_use_runtimelinking=no
+
+      # Test if we are trying to use run time linking or normal
+      # AIX style linking. If -brtl is somewhere in LDFLAGS, we
+      # need to do runtime linking.
+      case $host_os in aix4.[[23]]|aix4.[[23]].*|aix5*)
+	for ld_flag in $LDFLAGS; do
+	  case $ld_flag in
+	  *-brtl*)
+	    aix_use_runtimelinking=yes
+	    break
+	  ;;
+	  esac
+	done
+      esac
+
+      exp_sym_flag='-bexport'
+      no_entry_flag='-bnoentry'
+    fi
+
+    # When large executables or shared objects are built, AIX ld can
+    # have problems creating the table of contents.  If linking a library
+    # or program results in "error TOC overflow" add -mminimal-toc to
+    # CXXFLAGS/CFLAGS for g++/gcc.  In the cases where that is not
+    # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS.
+
+    hardcode_direct=yes
+    archive_cmds=''
+    hardcode_libdir_separator=':'
+    if test "$GCC" = yes; then
+      case $host_os in aix4.[[012]]|aix4.[[012]].*)
+	collect2name=`${CC} -print-prog-name=collect2`
+	if test -f "$collect2name" && \
+	  strings "$collect2name" | grep resolve_lib_name >/dev/null
+	then
+	  # We have reworked collect2
+	  hardcode_direct=yes
+	else
+	  # We have old collect2
+	  hardcode_direct=unsupported
+	  # It fails to find uninstalled libraries when the uninstalled
+	  # path is not listed in the libpath.  Setting hardcode_minus_L
+	  # to unsupported forces relinking
+	  hardcode_minus_L=yes
+	  hardcode_libdir_flag_spec='-L$libdir'
+	  hardcode_libdir_separator=
+	fi
+      esac
+
+      shared_flag='-shared'
+    else
+      # not using gcc
+      if test "$host_cpu" = ia64; then
+	shared_flag='${wl}-G'
+      else
+	if test "$aix_use_runtimelinking" = yes; then
+	  shared_flag='${wl}-G'
+	else
+	  shared_flag='${wl}-bM:SRE'
+	fi
+      fi
+    fi
+
+    # It seems that -bexpall can do strange things, so it is better to
+    # generate a list of symbols to export.
+    always_export_symbols=yes
+    if test "$aix_use_runtimelinking" = yes; then
+      # Warning - without using the other runtime loading flags (-brtl),
+      # -berok will link without error, but may produce a broken library.
+      allow_undefined_flag='-berok'
+      hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:/usr/lib:/lib'
+      archive_expsym_cmds="\$CC"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols $shared_flag"
+    else
+      if test "$host_cpu" = ia64; then
+	hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib'
+	allow_undefined_flag="-z nodefs"
+	archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname ${wl}-h$soname $libobjs $deplibs $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols"
+      else
+	hardcode_libdir_flag_spec='${wl}-bnolibpath ${wl}-blibpath:$libdir:/usr/lib:/lib'
+	# Warning - without using the other run time loading flags,
+	# -berok will link without error, but may produce a broken library.
+	allow_undefined_flag='${wl}-berok'
+	# This is a bit strange, but is similar to how AIX traditionally builds
+	# it's shared libraries.
+	archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols"' ~$AR -crlo $objdir/$libname$release.a $objdir/$soname'
+      fi
+    fi
+    ;;
+
+  amigaos*)
+    archive_cmds='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
+    hardcode_libdir_flag_spec='-L$libdir'
+    hardcode_minus_L=yes
+    # see comment about different semantics on the GNU ld section
+    ld_shlibs=no
+    ;;
+
+  cygwin* | mingw* | pw32*)
+    # When not using gcc, we currently assume that we are using
+    # Microsoft Visual C++.
+    # hardcode_libdir_flag_spec is actually meaningless, as there is
+    # no search path for DLLs.
+    hardcode_libdir_flag_spec=' '
+    allow_undefined_flag=unsupported
+    # Tell ltmain to make .lib files, not .a files.
+    libext=lib
+    # FIXME: Setting linknames here is a bad hack.
+    archive_cmds='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | sed -e '\''s/ -lc$//'\''` -link -dll~linknames='
+    # The linker will automatically build a .lib file if we build a DLL.
+    old_archive_from_new_cmds='true'
+    # FIXME: Should let the user specify the lib program.
+    old_archive_cmds='lib /OUT:$oldlib$oldobjs$old_deplibs'
+    fix_srcfile_path='`cygpath -w "$srcfile"`'
+    ;;
+
+  darwin* | rhapsody*)
+    case "$host_os" in
+    rhapsody* | darwin1.[[012]])
+      allow_undefined_flag='-undefined suppress'
+      ;;
+    *) # Darwin 1.3 on
+      allow_undefined_flag='-flat_namespace -undefined suppress'
+      ;;
+    esac
+    # FIXME: Relying on posixy $() will cause problems for
+    #        cross-compilation, but unfortunately the echo tests do not
+    #        yet detect zsh echo's removal of \ escapes.  Also zsh mangles
+    #	     `"' quotes if we put them in here... so don't!
+    archive_cmds='$CC -r -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs && $CC $(test .$module = .yes && echo -bundle || echo -dynamiclib) $allow_undefined_flag -o $lib ${lib}-master.o $deplibs$linker_flags $(test .$module != .yes && echo -install_name $rpath/$soname $verstring)'
+    # We need to add '_' to the symbols in $export_symbols first
+    #archive_expsym_cmds="$archive_cmds"' && strip -s $export_symbols'
+    hardcode_direct=yes
+    hardcode_shlibpath_var=no
+    whole_archive_flag_spec='-all_load $convenience'
+    ;;
+
+  freebsd1*)
+    ld_shlibs=no
+    ;;
+
+  # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor
+  # support.  Future versions do this automatically, but an explicit c++rt0.o
+  # does not break anything, and helps significantly (at the cost of a little
+  # extra space).
+  freebsd2.2*)
+    archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o'
+    hardcode_libdir_flag_spec='-R$libdir'
+    hardcode_direct=yes
+    hardcode_shlibpath_var=no
+    ;;
+
+  # Unfortunately, older versions of FreeBSD 2 do not have this feature.
+  freebsd2*)
+    archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+    hardcode_direct=yes
+    hardcode_minus_L=yes
+    hardcode_shlibpath_var=no
+    ;;
+
+  # FreeBSD 3 and greater uses gcc -shared to do shared libraries.
+  freebsd*)
+    archive_cmds='$CC -shared -o $lib $libobjs $deplibs $compiler_flags'
+    hardcode_libdir_flag_spec='-R$libdir'
+    hardcode_direct=yes
+    hardcode_shlibpath_var=no
+    ;;
+
+  hpux9* | hpux10* | hpux11*)
+    case $host_os in
+    hpux9*) archive_cmds='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' ;;
+    *) archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' ;;
+    esac
+    hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
+    hardcode_libdir_separator=:
+    hardcode_direct=yes
+    hardcode_minus_L=yes # Not in the search PATH, but as the default
+			 # location of the library.
+    export_dynamic_flag_spec='${wl}-E'
+    ;;
+
+  irix5* | irix6* | nonstopux*)
+    if test "$GCC" = yes; then
+      archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+      hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+    else
+      archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
+      hardcode_libdir_flag_spec='-rpath $libdir'
+    fi
+    hardcode_libdir_separator=:
+    link_all_deplibs=yes
+    ;;
+
+  netbsd*)
+    if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
+      archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'  # a.out
+    else
+      archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linker_flags'      # ELF
+    fi
+    hardcode_libdir_flag_spec='-R$libdir'
+    hardcode_direct=yes
+    hardcode_shlibpath_var=no
+    ;;
+
+  newsos6)
+    archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+    hardcode_direct=yes
+    hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+    hardcode_libdir_separator=:
+    hardcode_shlibpath_var=no
+    ;;
+
+  openbsd*)
+    hardcode_direct=yes
+    hardcode_shlibpath_var=no
+    if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+      archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+      hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
+      export_dynamic_flag_spec='${wl}-E'
+    else
+      case "$host_os" in
+      openbsd[[01]].* | openbsd2.[[0-7]] | openbsd2.[[0-7]].*)
+	archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+	hardcode_libdir_flag_spec='-R$libdir'
+        ;;
+      *)
+        archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+        hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
+        ;;
+      esac
+    fi
+    ;;
+
+  os2*)
+    hardcode_libdir_flag_spec='-L$libdir'
+    hardcode_minus_L=yes
+    allow_undefined_flag=unsupported
+    archive_cmds='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def'
+    old_archive_from_new_cmds='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def'
+    ;;
+
+  osf3*)
+    if test "$GCC" = yes; then
+      allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
+      archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+    else
+      allow_undefined_flag=' -expect_unresolved \*'
+      archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
+    fi
+    hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+    hardcode_libdir_separator=:
+    ;;
+
+  osf4* | osf5*)	# as osf3* with the addition of -msym flag
+    if test "$GCC" = yes; then
+      allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
+      archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+      hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+    else
+      allow_undefined_flag=' -expect_unresolved \*'
+      archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
+      archive_expsym_cmds='for i in `cat $export_symbols`; do printf "-exported_symbol " >> $lib.exp; echo "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~
+      $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib~$rm $lib.exp'
+
+      #Both c and cxx compiler support -rpath directly
+      hardcode_libdir_flag_spec='-rpath $libdir'
+    fi
+    hardcode_libdir_separator=:
+    ;;
+
+  sco3.2v5*)
+    archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+    hardcode_shlibpath_var=no
+    runpath_var=LD_RUN_PATH
+    hardcode_runpath_var=yes
+    export_dynamic_flag_spec='${wl}-Bexport'
+    ;;
+
+  solaris*)
+    # gcc --version < 3.0 without binutils cannot create self contained
+    # shared libraries reliably, requiring libgcc.a to resolve some of
+    # the object symbols generated in some cases.  Libraries that use
+    # assert need libgcc.a to resolve __eprintf, for example.  Linking
+    # a copy of libgcc.a into every shared library to guarantee resolving
+    # such symbols causes other problems:  According to Tim Van Holder
+    # <tim.van.holder@pandora.be>, C++ libraries end up with a separate
+    # (to the application) exception stack for one thing.
+    no_undefined_flag=' -z defs'
+    if test "$GCC" = yes; then
+      case `$CC --version 2>/dev/null` in
+      [[12]].*)
+	cat <<EOF 1>&2
+
+*** Warning: Releases of GCC earlier than version 3.0 cannot reliably
+*** create self contained shared libraries on Solaris systems, without
+*** introducing a dependency on libgcc.a.  Therefore, libtool is disabling
+*** -no-undefined support, which will at least allow you to build shared
+*** libraries.  However, you may find that when you link such libraries
+*** into an application without using GCC, you have to manually add
+*** \`gcc --print-libgcc-file-name\` to the link command.  We urge you to
+*** upgrade to a newer version of GCC.  Another option is to rebuild your
+*** current GCC to use the GNU linker from GNU binutils 2.9.1 or newer.
+
+EOF
+        no_undefined_flag=
+	;;
+      esac
+    fi
+    # $CC -shared without GNU ld will not create a library from C++
+    # object files and a static libstdc++, better avoid it by now
+    archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags'
+    archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
+		$LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp'
+    hardcode_libdir_flag_spec='-R$libdir'
+    hardcode_shlibpath_var=no
+    case $host_os in
+    solaris2.[[0-5]] | solaris2.[[0-5]].*) ;;
+    *) # Supported since Solaris 2.6 (maybe 2.5.1?)
+      whole_archive_flag_spec='-z allextract$convenience -z defaultextract' ;;
+    esac
+    link_all_deplibs=yes
+    ;;
+
+  sunos4*)
+    if test "x$host_vendor" = xsequent; then
+      # Use $CC to link under sequent, because it throws in some extra .o
+      # files that make .init and .fini sections work.
+      archive_cmds='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags'
+    else
+      archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags'
+    fi
+    hardcode_libdir_flag_spec='-L$libdir'
+    hardcode_direct=yes
+    hardcode_minus_L=yes
+    hardcode_shlibpath_var=no
+    ;;
+
+  sysv4)
+    case $host_vendor in
+      sni)
+        archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+        hardcode_direct=yes # is this really true???
+        ;;
+      siemens)
+        ## LD is ld it makes a PLAMLIB
+        ## CC just makes a GrossModule.
+        archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags'
+        reload_cmds='$CC -r -o $output$reload_objs'
+        hardcode_direct=no
+        ;;
+      motorola)
+        archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+        hardcode_direct=no #Motorola manual says yes, but my tests say they lie
+        ;;
+    esac
+    runpath_var='LD_RUN_PATH'
+    hardcode_shlibpath_var=no
+    ;;
+
+  sysv4.3*)
+    archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+    hardcode_shlibpath_var=no
+    export_dynamic_flag_spec='-Bexport'
+    ;;
+
+  sysv5*)
+    no_undefined_flag=' -z text'
+    # $CC -shared without GNU ld will not create a library from C++
+    # object files and a static libstdc++, better avoid it by now
+    archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags'
+    archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
+		$LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp'
+    hardcode_libdir_flag_spec=
+    hardcode_shlibpath_var=no
+    runpath_var='LD_RUN_PATH'
+    ;;
+
+  uts4*)
+    archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+    hardcode_libdir_flag_spec='-L$libdir'
+    hardcode_shlibpath_var=no
+    ;;
+
+  dgux*)
+    archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+    hardcode_libdir_flag_spec='-L$libdir'
+    hardcode_shlibpath_var=no
+    ;;
+
+  sysv4*MP*)
+    if test -d /usr/nec; then
+      archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      hardcode_shlibpath_var=no
+      runpath_var=LD_RUN_PATH
+      hardcode_runpath_var=yes
+      ld_shlibs=yes
+    fi
+    ;;
+
+  sysv4.2uw2*)
+    archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags'
+    hardcode_direct=yes
+    hardcode_minus_L=no
+    hardcode_shlibpath_var=no
+    hardcode_runpath_var=yes
+    runpath_var=LD_RUN_PATH
+    ;;
+
+  sysv5uw7* | unixware7*)
+    no_undefined_flag='${wl}-z ${wl}text'
+    if test "$GCC" = yes; then
+      archive_cmds='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+    else
+      archive_cmds='$CC -G ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+    fi
+    runpath_var='LD_RUN_PATH'
+    hardcode_shlibpath_var=no
+    ;;
+
+  *)
+    ld_shlibs=no
+    ;;
+  esac
+fi
+AC_MSG_RESULT([$ld_shlibs])
+test "$ld_shlibs" = no && can_build_shared=no
+##
+## END FIXME
+
+## FIXME: this should be a separate macro
+##
+# Check hardcoding attributes.
+AC_MSG_CHECKING([how to hardcode library paths into programs])
+hardcode_action=
+if test -n "$hardcode_libdir_flag_spec" || \
+   test -n "$runpath_var"; then
+
+  # We can hardcode non-existant directories.
+  if test "$hardcode_direct" != no &&
+     # If the only mechanism to avoid hardcoding is shlibpath_var, we
+     # have to relink, otherwise we might link with an installed library
+     # when we should be linking with a yet-to-be-installed one
+     ## test "$hardcode_shlibpath_var" != no &&
+     test "$hardcode_minus_L" != no; then
+    # Linking always hardcodes the temporary library directory.
+    hardcode_action=relink
+  else
+    # We can link without hardcoding, and we can hardcode nonexisting dirs.
+    hardcode_action=immediate
+  fi
+else
+  # We cannot hardcode anything, or else we can only hardcode existing
+  # directories.
+  hardcode_action=unsupported
+fi
+AC_MSG_RESULT([$hardcode_action])
+##
+## END FIXME
+
+## FIXME: this should be a separate macro
+##
+striplib=
+old_striplib=
+AC_MSG_CHECKING([whether stripping libraries is possible])
+if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then
+  test -z "$old_striplib" && old_striplib="$STRIP --strip-debug"
+  test -z "$striplib" && striplib="$STRIP --strip-unneeded"
+  AC_MSG_RESULT([yes])
+else
+  AC_MSG_RESULT([no])
+fi
+##
+## END FIXME
+
+reload_cmds='$LD$reload_flag -o $output$reload_objs'
+test -z "$deplibs_check_method" && deplibs_check_method=unknown
+
+## FIXME: this should be a separate macro
+##
+# PORTME Fill in your ld.so characteristics
+AC_MSG_CHECKING([dynamic linker characteristics])
+library_names_spec=
+libname_spec='lib$name'
+soname_spec=
+postinstall_cmds=
+postuninstall_cmds=
+finish_cmds=
+finish_eval=
+shlibpath_var=
+shlibpath_overrides_runpath=unknown
+version_type=none
+dynamic_linker="$host_os ld.so"
+sys_lib_dlsearch_path_spec="/lib /usr/lib"
+sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib"
+
+case $host_os in
+aix3*)
+  version_type=linux
+  library_names_spec='${libname}${release}.so$versuffix $libname.a'
+  shlibpath_var=LIBPATH
+
+  # AIX has no versioning support, so we append a major version to the name.
+  soname_spec='${libname}${release}.so$major'
+  ;;
+
+aix4* | aix5*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  hardcode_into_libs=yes
+  if test "$host_cpu" = ia64; then
+    # AIX 5 supports IA64
+    library_names_spec='${libname}${release}.so$major ${libname}${release}.so$versuffix $libname.so'
+    shlibpath_var=LD_LIBRARY_PATH
+  else
+    # With GCC up to 2.95.x, collect2 would create an import file
+    # for dependence libraries.  The import file would start with
+    # the line `#! .'.  This would cause the generated library to
+    # depend on `.', always an invalid library.  This was fixed in
+    # development snapshots of GCC prior to 3.0.
+    case $host_os in
+      aix4 | aix4.[[01]] | aix4.[[01]].*)
+	if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)'
+	     echo ' yes '
+	     echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then
+	  :
+	else
+	  can_build_shared=no
+	fi
+	;;
+    esac
+    # AIX (on Power*) has no versioning support, so currently we can
+    # not hardcode correct soname into executable. Probably we can
+    # add versioning support to collect2, so additional links can
+    # be useful in future.
+    if test "$aix_use_runtimelinking" = yes; then
+      # If using run time linking (on AIX 4.2 or later) use lib<name>.so
+      # instead of lib<name>.a to let people know that these are not
+      # typical AIX shared libraries.
+      library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
+    else
+      # We preserve .a as extension for shared libraries through AIX4.2
+      # and later when we are not doing run time linking.
+      library_names_spec='${libname}${release}.a $libname.a'
+      soname_spec='${libname}${release}.so$major'
+    fi
+    shlibpath_var=LIBPATH
+  fi
+  hardcode_into_libs=yes
+  ;;
+
+amigaos*)
+  library_names_spec='$libname.ixlibrary $libname.a'
+  # Create ${libname}_ixlibrary.a entries in /sys/libs.
+  finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([[^/]]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "(cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a)"; (cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a) || exit 1; done'
+  ;;
+
+beos*)
+  library_names_spec='${libname}.so'
+  dynamic_linker="$host_os ld.so"
+  shlibpath_var=LIBRARY_PATH
+  ;;
+
+bsdi4*)
+  version_type=linux
+  need_version=no
+  library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
+  soname_spec='${libname}${release}.so$major'
+  finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib"
+  sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib"
+  export_dynamic_flag_spec=-rdynamic
+  # the default ld.so.conf also contains /usr/contrib/lib and
+  # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow
+  # libtool to hard-code these into programs
+  ;;
+
+cygwin* | mingw* | pw32*)
+  version_type=windows
+  need_version=no
+  need_lib_prefix=no
+  case $GCC,$host_os in
+  yes,cygwin*)
+    library_names_spec='$libname.dll.a'
+    soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | sed -e 's/[[.]]/-/g'`${versuffix}.dll'
+    postinstall_cmds='dlpath=`bash 2>&1 -c '\''. $dir/${file}i;echo \$dlname'\''`~
+      dldir=$destdir/`dirname \$dlpath`~
+      test -d \$dldir || mkdir -p \$dldir~
+      $install_prog .libs/$dlname \$dldir/$dlname'
+    postuninstall_cmds='dldll=`bash 2>&1 -c '\''. $file; echo \$dlname'\''`~
+      dlpath=$dir/\$dldll~
+       $rm \$dlpath'
+    ;;
+  yes,mingw*)
+    library_names_spec='${libname}`echo ${release} | sed -e 's/[[.]]/-/g'`${versuffix}.dll'
+    sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | sed -e "s/^libraries://" -e "s/;/ /g" -e "s,=/,/,g"`
+    ;;
+  yes,pw32*)
+    library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | sed -e 's/[.]/-/g'`${versuffix}.dll'
+    ;;
+  *)
+    library_names_spec='${libname}`echo ${release} | sed -e 's/[[.]]/-/g'`${versuffix}.dll $libname.lib'
+    ;;
+  esac
+  dynamic_linker='Win32 ld.exe'
+  # FIXME: first we should search . and the directory the executable is in
+  shlibpath_var=PATH
+  ;;
+
+darwin* | rhapsody*)
+  dynamic_linker="$host_os dyld"
+  version_type=darwin
+  need_lib_prefix=no
+  need_version=no
+  # FIXME: Relying on posixy $() will cause problems for
+  #        cross-compilation, but unfortunately the echo tests do not
+  #        yet detect zsh echo's removal of \ escapes.
+  library_names_spec='${libname}${release}${versuffix}.$(test .$module = .yes && echo so || echo dylib) ${libname}${release}${major}.$(test .$module = .yes && echo so || echo dylib) ${libname}.$(test .$module = .yes && echo so || echo dylib)'
+  soname_spec='${libname}${release}${major}.$(test .$module = .yes && echo so || echo dylib)'
+  shlibpath_overrides_runpath=yes
+  shlibpath_var=DYLD_LIBRARY_PATH
+  ;;
+
+freebsd1*)
+  dynamic_linker=no
+  ;;
+
+freebsd*)
+  objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout`
+  version_type=freebsd-$objformat
+  case $version_type in
+    freebsd-elf*)
+      library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so $libname.so'
+      need_version=no
+      need_lib_prefix=no
+      ;;
+    freebsd-*)
+      library_names_spec='${libname}${release}.so$versuffix $libname.so$versuffix'
+      need_version=yes
+      ;;
+  esac
+  shlibpath_var=LD_LIBRARY_PATH
+  case $host_os in
+  freebsd2*)
+    shlibpath_overrides_runpath=yes
+    ;;
+  *)
+    shlibpath_overrides_runpath=no
+    hardcode_into_libs=yes
+    ;;
+  esac
+  ;;
+
+gnu*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so${major} ${libname}.so'
+  soname_spec='${libname}${release}.so$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  hardcode_into_libs=yes
+  ;;
+
+hpux9* | hpux10* | hpux11*)
+  # Give a soname corresponding to the major version so that dld.sl refuses to
+  # link against other versions.
+  dynamic_linker="$host_os dld.sl"
+  version_type=sunos
+  need_lib_prefix=no
+  need_version=no
+  shlibpath_var=SHLIB_PATH
+  shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH
+  library_names_spec='${libname}${release}.sl$versuffix ${libname}${release}.sl$major $libname.sl'
+  soname_spec='${libname}${release}.sl$major'
+  # HP-UX runs *really* slowly unless shared libraries are mode 555.
+  postinstall_cmds='chmod 555 $lib'
+  ;;
+
+irix5* | irix6* | nonstopux*)
+  case $host_os in
+    nonstopux*) version_type=nonstopux ;;
+    *)          version_type=irix ;;
+  esac
+  need_lib_prefix=no
+  need_version=no
+  soname_spec='${libname}${release}.so$major'
+  library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major ${libname}${release}.so $libname.so'
+  case $host_os in
+  irix5* | nonstopux*)
+    libsuff= shlibsuff=
+    ;;
+  *)
+    case $LD in # libtool.m4 will add one of these switches to LD
+    *-32|*"-32 ") libsuff= shlibsuff= libmagic=32-bit;;
+    *-n32|*"-n32 ") libsuff=32 shlibsuff=N32 libmagic=N32;;
+    *-64|*"-64 ") libsuff=64 shlibsuff=64 libmagic=64-bit;;
+    *) libsuff= shlibsuff= libmagic=never-match;;
+    esac
+    ;;
+  esac
+  shlibpath_var=LD_LIBRARY${shlibsuff}_PATH
+  shlibpath_overrides_runpath=no
+  sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}"
+  sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}"
+  ;;
+
+# No shared lib support for Linux oldld, aout, or coff.
+linux-gnuoldld* | linux-gnuaout* | linux-gnucoff*)
+  dynamic_linker=no
+  ;;
+
+# This must be Linux ELF.
+linux-gnu*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
+  soname_spec='${libname}${release}.so$major'
+  finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  # This implies no fast_install, which is unacceptable.
+  # Some rework will be needed to allow for fast_install
+  # before this can be enabled.
+  hardcode_into_libs=yes
+
+  # We used to test for /lib/ld.so.1 and disable shared libraries on
+  # powerpc, because MkLinux only supported shared libraries with the
+  # GNU dynamic linker.  Since this was broken with cross compilers,
+  # most powerpc-linux boxes support dynamic linking these days and
+  # people can always --disable-shared, the test was removed, and we
+  # assume the GNU/Linux dynamic linker is in use.
+  dynamic_linker='GNU/Linux ld.so'
+  ;;
+
+netbsd*)
+  version_type=sunos
+  need_lib_prefix=no
+  need_version=no
+  if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
+    library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix'
+    finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
+    dynamic_linker='NetBSD (a.out) ld.so'
+  else
+    library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major ${libname}${release}.so ${libname}.so'
+    soname_spec='${libname}${release}.so$major'
+    dynamic_linker='NetBSD ld.elf_so'
+  fi
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  hardcode_into_libs=yes
+  ;;
+
+newsos6)
+  version_type=linux
+  library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  ;;
+
+openbsd*)
+  version_type=sunos
+  need_lib_prefix=no
+  need_version=no
+  if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+    case "$host_os" in
+    openbsd2.[[89]] | openbsd2.[[89]].*)
+      shlibpath_overrides_runpath=no
+      ;;
+    *)
+      shlibpath_overrides_runpath=yes
+      ;;
+    esac
+  else
+    shlibpath_overrides_runpath=yes
+  fi
+  library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix'
+  finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  ;;
+
+os2*)
+  libname_spec='$name'
+  need_lib_prefix=no
+  library_names_spec='$libname.dll $libname.a'
+  dynamic_linker='OS/2 ld.exe'
+  shlibpath_var=LIBPATH
+  ;;
+
+osf3* | osf4* | osf5*)
+  version_type=osf
+  need_version=no
+  soname_spec='${libname}${release}.so$major'
+  library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
+  shlibpath_var=LD_LIBRARY_PATH
+  sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib"
+  sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec"
+  hardcode_into_libs=yes
+  ;;
+
+sco3.2v5*)
+  version_type=osf
+  soname_spec='${libname}${release}.so$major'
+  library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
+  shlibpath_var=LD_LIBRARY_PATH
+  ;;
+
+solaris*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
+  soname_spec='${libname}${release}.so$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  hardcode_into_libs=yes
+  # ldd complains unless libraries are executable
+  postinstall_cmds='chmod +x $lib'
+  ;;
+
+sunos4*)
+  version_type=sunos
+  library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix'
+  finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  if test "$with_gnu_ld" = yes; then
+    need_lib_prefix=no
+  fi
+  need_version=yes
+  ;;
+
+sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
+  version_type=linux
+  library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
+  soname_spec='${libname}${release}.so$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  case $host_vendor in
+    sni)
+      shlibpath_overrides_runpath=no
+      need_lib_prefix=no
+      export_dynamic_flag_spec='${wl}-Blargedynsym'
+      runpath_var=LD_RUN_PATH
+      ;;
+    siemens)
+      need_lib_prefix=no
+      ;;
+    motorola)
+      need_lib_prefix=no
+      need_version=no
+      shlibpath_overrides_runpath=no
+      sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib'
+      ;;
+  esac
+  ;;
+
+uts4*)
+  version_type=linux
+  library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
+  soname_spec='${libname}${release}.so$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  ;;
+
+dgux*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
+  soname_spec='${libname}${release}.so$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  ;;
+
+sysv4*MP*)
+  if test -d /usr/nec ;then
+    version_type=linux
+    library_names_spec='$libname.so.$versuffix $libname.so.$major $libname.so'
+    soname_spec='$libname.so.$major'
+    shlibpath_var=LD_LIBRARY_PATH
+  fi
+  ;;
+
+*)
+  dynamic_linker=no
+  ;;
+esac
+AC_MSG_RESULT([$dynamic_linker])
+test "$dynamic_linker" = no && can_build_shared=no
+##
+## END FIXME
+
+## FIXME: this should be a separate macro
+##
+# Report the final consequences.
+AC_MSG_CHECKING([if libtool supports shared libraries])
+AC_MSG_RESULT([$can_build_shared])
+##
+## END FIXME
+
+## FIXME: this should be a separate macro
+##
+AC_MSG_CHECKING([whether to build shared libraries])
+test "$can_build_shared" = "no" && enable_shared=no
+
+# On AIX, shared libraries and static libraries use the same namespace, and
+# are all built from PIC.
+case "$host_os" in
+aix3*)
+  test "$enable_shared" = yes && enable_static=no
+  if test -n "$RANLIB"; then
+    archive_cmds="$archive_cmds~\$RANLIB \$lib"
+    postinstall_cmds='$RANLIB $lib'
+  fi
+  ;;
+
+aix4*)
+  if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then
+    test "$enable_shared" = yes && enable_static=no
+  fi
+  ;;
+esac
+AC_MSG_RESULT([$enable_shared])
+##
+## END FIXME
+
+## FIXME: this should be a separate macro
+##
+AC_MSG_CHECKING([whether to build static libraries])
+# Make sure either enable_shared or enable_static is yes.
+test "$enable_shared" = yes || enable_static=yes
+AC_MSG_RESULT([$enable_static])
+##
+## END FIXME
+
+if test "$hardcode_action" = relink; then
+  # Fast installation is not supported
+  enable_fast_install=no
+elif test "$shlibpath_overrides_runpath" = yes ||
+     test "$enable_shared" = no; then
+  # Fast installation is not necessary
+  enable_fast_install=needless
+fi
+
+variables_saved_for_relink="PATH $shlibpath_var $runpath_var"
+if test "$GCC" = yes; then
+  variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
+fi
+
+AC_LIBTOOL_DLOPEN_SELF
+
+## FIXME: this should be a separate macro
+##
+if test "$enable_shared" = yes && test "$GCC" = yes; then
+  case $archive_cmds in
+  *'~'*)
+    # FIXME: we may have to deal with multi-command sequences.
+    ;;
+  '$CC '*)
+    # Test whether the compiler implicitly links with -lc since on some
+    # systems, -lgcc has to come before -lc. If gcc already passes -lc
+    # to ld, don't add -lc before -lgcc.
+    AC_MSG_CHECKING([whether -lc should be explicitly linked in])
+    AC_CACHE_VAL([lt_cv_archive_cmds_need_lc],
+    [$rm conftest*
+    echo 'static int dummy;' > conftest.$ac_ext
+
+    if AC_TRY_EVAL(ac_compile); then
+      soname=conftest
+      lib=conftest
+      libobjs=conftest.$ac_objext
+      deplibs=
+      wl=$lt_cv_prog_cc_wl
+      compiler_flags=-v
+      linker_flags=-v
+      verstring=
+      output_objdir=.
+      libname=conftest
+      save_allow_undefined_flag=$allow_undefined_flag
+      allow_undefined_flag=
+      if AC_TRY_EVAL(archive_cmds 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1)
+      then
+	lt_cv_archive_cmds_need_lc=no
+      else
+	lt_cv_archive_cmds_need_lc=yes
+      fi
+      allow_undefined_flag=$save_allow_undefined_flag
+    else
+      cat conftest.err 1>&5
+    fi])
+    AC_MSG_RESULT([$lt_cv_archive_cmds_need_lc])
+    ;;
+  esac
+fi
+need_lc=${lt_cv_archive_cmds_need_lc-yes}
+##
+## END FIXME
+
+## FIXME: this should be a separate macro
+##
+# The second clause should only fire when bootstrapping the
+# libtool distribution, otherwise you forgot to ship ltmain.sh
+# with your package, and you will get complaints that there are
+# no rules to generate ltmain.sh.
+if test -f "$ltmain"; then
+  :
+else
+  # If there is no Makefile yet, we rely on a make rule to execute
+  # `config.status --recheck' to rerun these tests and create the
+  # libtool script then.
+  test -f Makefile && make "$ltmain"
+fi
+
+if test -f "$ltmain"; then
+  trap "$rm \"${ofile}T\"; exit 1" 1 2 15
+  $rm -f "${ofile}T"
+
+  echo creating $ofile
+
+  # Now quote all the things that may contain metacharacters while being
+  # careful not to overquote the AC_SUBSTed values.  We take copies of the
+  # variables and quote the copies for generation of the libtool script.
+  for var in echo old_CC old_CFLAGS SED \
+    AR AR_FLAGS CC LD LN_S NM SHELL \
+    reload_flag reload_cmds wl \
+    pic_flag link_static_flag no_builtin_flag export_dynamic_flag_spec \
+    thread_safe_flag_spec whole_archive_flag_spec libname_spec \
+    library_names_spec soname_spec \
+    RANLIB old_archive_cmds old_archive_from_new_cmds old_postinstall_cmds \
+    old_postuninstall_cmds archive_cmds archive_expsym_cmds postinstall_cmds \
+    postuninstall_cmds extract_expsyms_cmds old_archive_from_expsyms_cmds \
+    old_striplib striplib file_magic_cmd export_symbols_cmds \
+    deplibs_check_method allow_undefined_flag no_undefined_flag \
+    finish_cmds finish_eval global_symbol_pipe global_symbol_to_cdecl \
+    global_symbol_to_c_name_address \
+    hardcode_libdir_flag_spec hardcode_libdir_separator  \
+    sys_lib_search_path_spec sys_lib_dlsearch_path_spec \
+    compiler_c_o compiler_o_lo need_locks exclude_expsyms include_expsyms; do
+
+    case $var in
+    reload_cmds | old_archive_cmds | old_archive_from_new_cmds | \
+    old_postinstall_cmds | old_postuninstall_cmds | \
+    export_symbols_cmds | archive_cmds | archive_expsym_cmds | \
+    extract_expsyms_cmds | old_archive_from_expsyms_cmds | \
+    postinstall_cmds | postuninstall_cmds | \
+    finish_cmds | sys_lib_search_path_spec | sys_lib_dlsearch_path_spec)
+      # Double-quote double-evaled strings.
+      eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\""
+      ;;
+    *)
+      eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\""
+      ;;
+    esac
+  done
+
+  cat <<__EOF__ > "${ofile}T"
+#! $SHELL
+
+# `$echo "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services.
+# Generated automatically by $PROGRAM (GNU $PACKAGE $VERSION$TIMESTAMP)
+# NOTE: Changes made to this file will be lost: look at ltmain.sh.
+#
+# Copyright (C) 1996-2000 Free Software Foundation, Inc.
+# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# A sed that does not truncate output.
+SED=$lt_SED
+
+# Sed that helps us avoid accidentally triggering echo(1) options like -n.
+Xsed="${SED} -e s/^X//"
+
+# The HP-UX ksh and POSIX shell print the target directory to stdout
+# if CDPATH is set.
+if test "X\${CDPATH+set}" = Xset; then CDPATH=:; export CDPATH; fi
+
+# ### BEGIN LIBTOOL CONFIG
+
+# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
+
+# Shell to use when invoking shell scripts.
+SHELL=$lt_SHELL
+
+# Whether or not to build shared libraries.
+build_libtool_libs=$enable_shared
+
+# Whether or not to build static libraries.
+build_old_libs=$enable_static
+
+# Whether or not to add -lc for building shared libraries.
+build_libtool_need_lc=$need_lc
+
+# Whether or not to optimize for fast installation.
+fast_install=$enable_fast_install
+
+# The host system.
+host_alias=$host_alias
+host=$host
+
+# An echo program that does not interpret backslashes.
+echo=$lt_echo
+
+# The archiver.
+AR=$lt_AR
+AR_FLAGS=$lt_AR_FLAGS
+
+# The default C compiler.
+CC=$lt_CC
+
+# Is the compiler the GNU C compiler?
+with_gcc=$GCC
+
+# The linker used to build libraries.
+LD=$lt_LD
+
+# Whether we need hard or soft links.
+LN_S=$lt_LN_S
+
+# A BSD-compatible nm program.
+NM=$lt_NM
+
+# A symbol stripping program
+STRIP=$STRIP
+
+# Used to examine libraries when file_magic_cmd begins "file"
+MAGIC_CMD=$MAGIC_CMD
+
+# Used on cygwin: DLL creation program.
+DLLTOOL="$DLLTOOL"
+
+# Used on cygwin: object dumper.
+OBJDUMP="$OBJDUMP"
+
+# Used on cygwin: assembler.
+AS="$AS"
+
+# The name of the directory that contains temporary libtool files.
+objdir=$objdir
+
+# How to create reloadable object files.
+reload_flag=$lt_reload_flag
+reload_cmds=$lt_reload_cmds
+
+# How to pass a linker flag through the compiler.
+wl=$lt_wl
+
+# Object file suffix (normally "o").
+objext="$ac_objext"
+
+# Old archive suffix (normally "a").
+libext="$libext"
+
+# Executable file suffix (normally "").
+exeext="$exeext"
+
+# Additional compiler flags for building library objects.
+pic_flag=$lt_pic_flag
+pic_mode=$pic_mode
+
+# Does compiler simultaneously support -c and -o options?
+compiler_c_o=$lt_compiler_c_o
+
+# Can we write directly to a .lo ?
+compiler_o_lo=$lt_compiler_o_lo
+
+# Must we lock files when doing compilation ?
+need_locks=$lt_need_locks
+
+# Do we need the lib prefix for modules?
+need_lib_prefix=$need_lib_prefix
+
+# Do we need a version for libraries?
+need_version=$need_version
+
+# Whether dlopen is supported.
+dlopen_support=$enable_dlopen
+
+# Whether dlopen of programs is supported.
+dlopen_self=$enable_dlopen_self
+
+# Whether dlopen of statically linked programs is supported.
+dlopen_self_static=$enable_dlopen_self_static
+
+# Compiler flag to prevent dynamic linking.
+link_static_flag=$lt_link_static_flag
+
+# Compiler flag to turn off builtin functions.
+no_builtin_flag=$lt_no_builtin_flag
+
+# Compiler flag to allow reflexive dlopens.
+export_dynamic_flag_spec=$lt_export_dynamic_flag_spec
+
+# Compiler flag to generate shared objects directly from archives.
+whole_archive_flag_spec=$lt_whole_archive_flag_spec
+
+# Compiler flag to generate thread-safe objects.
+thread_safe_flag_spec=$lt_thread_safe_flag_spec
+
+# Library versioning type.
+version_type=$version_type
+
+# Format of library name prefix.
+libname_spec=$lt_libname_spec
+
+# List of archive names.  First name is the real one, the rest are links.
+# The last name is the one that the linker finds with -lNAME.
+library_names_spec=$lt_library_names_spec
+
+# The coded name of the library, if different from the real name.
+soname_spec=$lt_soname_spec
+
+# Commands used to build and install an old-style archive.
+RANLIB=$lt_RANLIB
+old_archive_cmds=$lt_old_archive_cmds
+old_postinstall_cmds=$lt_old_postinstall_cmds
+old_postuninstall_cmds=$lt_old_postuninstall_cmds
+
+# Create an old-style archive from a shared archive.
+old_archive_from_new_cmds=$lt_old_archive_from_new_cmds
+
+# Create a temporary old-style archive to link instead of a shared archive.
+old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds
+
+# Commands used to build and install a shared archive.
+archive_cmds=$lt_archive_cmds
+archive_expsym_cmds=$lt_archive_expsym_cmds
+postinstall_cmds=$lt_postinstall_cmds
+postuninstall_cmds=$lt_postuninstall_cmds
+
+# Commands to strip libraries.
+old_striplib=$lt_old_striplib
+striplib=$lt_striplib
+
+# Method to check whether dependent libraries are shared objects.
+deplibs_check_method=$lt_deplibs_check_method
+
+# Command to use when deplibs_check_method == file_magic.
+file_magic_cmd=$lt_file_magic_cmd
+
+# Flag that allows shared libraries with undefined symbols to be built.
+allow_undefined_flag=$lt_allow_undefined_flag
+
+# Flag that forces no undefined symbols.
+no_undefined_flag=$lt_no_undefined_flag
+
+# Commands used to finish a libtool library installation in a directory.
+finish_cmds=$lt_finish_cmds
+
+# Same as above, but a single script fragment to be evaled but not shown.
+finish_eval=$lt_finish_eval
+
+# Take the output of nm and produce a listing of raw symbols and C names.
+global_symbol_pipe=$lt_global_symbol_pipe
+
+# Transform the output of nm in a proper C declaration
+global_symbol_to_cdecl=$lt_global_symbol_to_cdecl
+
+# Transform the output of nm in a C name address pair
+global_symbol_to_c_name_address=$lt_global_symbol_to_c_name_address
+
+# This is the shared library runtime path variable.
+runpath_var=$runpath_var
+
+# This is the shared library path variable.
+shlibpath_var=$shlibpath_var
+
+# Is shlibpath searched before the hard-coded library search path?
+shlibpath_overrides_runpath=$shlibpath_overrides_runpath
+
+# How to hardcode a shared library path into an executable.
+hardcode_action=$hardcode_action
+
+# Whether we should hardcode library paths into libraries.
+hardcode_into_libs=$hardcode_into_libs
+
+# Flag to hardcode \$libdir into a binary during linking.
+# This must work even if \$libdir does not exist.
+hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec
+
+# Whether we need a single -rpath flag with a separated argument.
+hardcode_libdir_separator=$lt_hardcode_libdir_separator
+
+# Set to yes if using DIR/libNAME.so during linking hardcodes DIR into the
+# resulting binary.
+hardcode_direct=$hardcode_direct
+
+# Set to yes if using the -LDIR flag during linking hardcodes DIR into the
+# resulting binary.
+hardcode_minus_L=$hardcode_minus_L
+
+# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into
+# the resulting binary.
+hardcode_shlibpath_var=$hardcode_shlibpath_var
+
+# Variables whose values should be saved in libtool wrapper scripts and
+# restored at relink time.
+variables_saved_for_relink="$variables_saved_for_relink"
+
+# Whether libtool must link a program against all its dependency libraries.
+link_all_deplibs=$link_all_deplibs
+
+# Compile-time system search path for libraries
+sys_lib_search_path_spec=$lt_sys_lib_search_path_spec
+
+# Run-time system search path for libraries
+sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec
+
+# Fix the shell variable \$srcfile for the compiler.
+fix_srcfile_path="$fix_srcfile_path"
+
+# Set to yes if exported symbols are required.
+always_export_symbols=$always_export_symbols
+
+# The commands to list exported symbols.
+export_symbols_cmds=$lt_export_symbols_cmds
+
+# The commands to extract the exported symbol list from a shared archive.
+extract_expsyms_cmds=$lt_extract_expsyms_cmds
+
+# Symbols that should not be listed in the preloaded symbols.
+exclude_expsyms=$lt_exclude_expsyms
+
+# Symbols that must always be exported.
+include_expsyms=$lt_include_expsyms
+
+# ### END LIBTOOL CONFIG
+
+__EOF__
+
+  case $host_os in
+  aix3*)
+    cat <<\EOF >> "${ofile}T"
+
+# AIX sometimes has problems with the GCC collect2 program.  For some
+# reason, if we set the COLLECT_NAMES environment variable, the problems
+# vanish in a puff of smoke.
+if test "X${COLLECT_NAMES+set}" != Xset; then
+  COLLECT_NAMES=
+  export COLLECT_NAMES
+fi
+EOF
+    ;;
+  esac
+
+  case $host_os in
+  cygwin* | mingw* | pw32* | os2*)
+    cat <<'EOF' >> "${ofile}T"
+      # This is a source program that is used to create dlls on Windows
+      # Don't remove nor modify the starting and closing comments
+# /* ltdll.c starts here */
+# #define WIN32_LEAN_AND_MEAN
+# #include <windows.h>
+# #undef WIN32_LEAN_AND_MEAN
+# #include <stdio.h>
+#
+# #ifndef __CYGWIN__
+# #  ifdef __CYGWIN32__
+# #    define __CYGWIN__ __CYGWIN32__
+# #  endif
+# #endif
+#
+# #ifdef __cplusplus
+# extern "C" {
+# #endif
+# BOOL APIENTRY DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved);
+# #ifdef __cplusplus
+# }
+# #endif
+#
+# #ifdef __CYGWIN__
+# #include <cygwin/cygwin_dll.h>
+# DECLARE_CYGWIN_DLL( DllMain );
+# #endif
+# HINSTANCE __hDllInstance_base;
+#
+# BOOL APIENTRY
+# DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved)
+# {
+#   __hDllInstance_base = hInst;
+#   return TRUE;
+# }
+# /* ltdll.c ends here */
+	# This is a source program that is used to create import libraries
+	# on Windows for dlls which lack them. Don't remove nor modify the
+	# starting and closing comments
+# /* impgen.c starts here */
+# /*   Copyright (C) 1999-2000 Free Software Foundation, Inc.
+#
+#  This file is part of GNU libtool.
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#  */
+#
+# #include <stdio.h>		/* for printf() */
+# #include <unistd.h>		/* for open(), lseek(), read() */
+# #include <fcntl.h>		/* for O_RDONLY, O_BINARY */
+# #include <string.h>		/* for strdup() */
+#
+# /* O_BINARY isn't required (or even defined sometimes) under Unix */
+# #ifndef O_BINARY
+# #define O_BINARY 0
+# #endif
+#
+# static unsigned int
+# pe_get16 (fd, offset)
+#      int fd;
+#      int offset;
+# {
+#   unsigned char b[2];
+#   lseek (fd, offset, SEEK_SET);
+#   read (fd, b, 2);
+#   return b[0] + (b[1]<<8);
+# }
+#
+# static unsigned int
+# pe_get32 (fd, offset)
+#     int fd;
+#     int offset;
+# {
+#   unsigned char b[4];
+#   lseek (fd, offset, SEEK_SET);
+#   read (fd, b, 4);
+#   return b[0] + (b[1]<<8) + (b[2]<<16) + (b[3]<<24);
+# }
+#
+# static unsigned int
+# pe_as32 (ptr)
+#      void *ptr;
+# {
+#   unsigned char *b = ptr;
+#   return b[0] + (b[1]<<8) + (b[2]<<16) + (b[3]<<24);
+# }
+#
+# int
+# main (argc, argv)
+#     int argc;
+#     char *argv[];
+# {
+#     int dll;
+#     unsigned long pe_header_offset, opthdr_ofs, num_entries, i;
+#     unsigned long export_rva, export_size, nsections, secptr, expptr;
+#     unsigned long name_rvas, nexp;
+#     unsigned char *expdata, *erva;
+#     char *filename, *dll_name;
+#
+#     filename = argv[1];
+#
+#     dll = open(filename, O_RDONLY|O_BINARY);
+#     if (dll < 1)
+# 	return 1;
+#
+#     dll_name = filename;
+#
+#     for (i=0; filename[i]; i++)
+# 	if (filename[i] == '/' || filename[i] == '\\'  || filename[i] == ':')
+# 	    dll_name = filename + i +1;
+#
+#     pe_header_offset = pe_get32 (dll, 0x3c);
+#     opthdr_ofs = pe_header_offset + 4 + 20;
+#     num_entries = pe_get32 (dll, opthdr_ofs + 92);
+#
+#     if (num_entries < 1) /* no exports */
+# 	return 1;
+#
+#     export_rva = pe_get32 (dll, opthdr_ofs + 96);
+#     export_size = pe_get32 (dll, opthdr_ofs + 100);
+#     nsections = pe_get16 (dll, pe_header_offset + 4 +2);
+#     secptr = (pe_header_offset + 4 + 20 +
+# 	      pe_get16 (dll, pe_header_offset + 4 + 16));
+#
+#     expptr = 0;
+#     for (i = 0; i < nsections; i++)
+#     {
+# 	char sname[8];
+# 	unsigned long secptr1 = secptr + 40 * i;
+# 	unsigned long vaddr = pe_get32 (dll, secptr1 + 12);
+# 	unsigned long vsize = pe_get32 (dll, secptr1 + 16);
+# 	unsigned long fptr = pe_get32 (dll, secptr1 + 20);
+# 	lseek(dll, secptr1, SEEK_SET);
+# 	read(dll, sname, 8);
+# 	if (vaddr <= export_rva && vaddr+vsize > export_rva)
+# 	{
+# 	    expptr = fptr + (export_rva - vaddr);
+# 	    if (export_rva + export_size > vaddr + vsize)
+# 		export_size = vsize - (export_rva - vaddr);
+# 	    break;
+# 	}
+#     }
+#
+#     expdata = (unsigned char*)malloc(export_size);
+#     lseek (dll, expptr, SEEK_SET);
+#     read (dll, expdata, export_size);
+#     erva = expdata - export_rva;
+#
+#     nexp = pe_as32 (expdata+24);
+#     name_rvas = pe_as32 (expdata+32);
+#
+#     printf ("EXPORTS\n");
+#     for (i = 0; i<nexp; i++)
+#     {
+# 	unsigned long name_rva = pe_as32 (erva+name_rvas+i*4);
+# 	printf ("\t%s @ %ld ;\n", erva+name_rva, 1+ i);
+#     }
+#
+#     return 0;
+# }
+# /* impgen.c ends here */
+
+EOF
+    ;;
+  esac
+
+  # We use sed instead of cat because bash on DJGPP gets confused if
+  # if finds mixed CR/LF and LF-only lines.  Since sed operates in
+  # text mode, it properly converts lines to CR/LF.  This bash problem
+  # is reportedly fixed, but why not run on old versions too?
+  sed '$q' "$ltmain" >> "${ofile}T" || (rm -f "${ofile}T"; exit 1)
+
+  mv -f "${ofile}T" "$ofile" || \
+    (rm -f "$ofile" && cp "${ofile}T" "$ofile" && rm -f "${ofile}T")
+  chmod +x "$ofile"
+fi
+##
+## END FIXME
+
+])# _LT_AC_LTCONFIG_HACK
+
+# AC_LIBTOOL_DLOPEN - enable checks for dlopen support
+AC_DEFUN([AC_LIBTOOL_DLOPEN], [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])])
+
+# AC_LIBTOOL_WIN32_DLL - declare package support for building win32 dll's
+AC_DEFUN([AC_LIBTOOL_WIN32_DLL], [AC_BEFORE([$0], [AC_LIBTOOL_SETUP])])
+
+# AC_ENABLE_SHARED - implement the --enable-shared flag
+# Usage: AC_ENABLE_SHARED[(DEFAULT)]
+#   Where DEFAULT is either `yes' or `no'.  If omitted, it defaults to
+#   `yes'.
+AC_DEFUN([AC_ENABLE_SHARED],
+[define([AC_ENABLE_SHARED_DEFAULT], ifelse($1, no, no, yes))dnl
+AC_ARG_ENABLE(shared,
+changequote(<<, >>)dnl
+<<  --enable-shared[=PKGS]  build shared libraries [default=>>AC_ENABLE_SHARED_DEFAULT],
+changequote([, ])dnl
+[p=${PACKAGE-default}
+case $enableval in
+yes) enable_shared=yes ;;
+no) enable_shared=no ;;
+*)
+  enable_shared=no
+  # Look at the argument we got.  We use all the common list separators.
+  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
+  for pkg in $enableval; do
+    if test "X$pkg" = "X$p"; then
+      enable_shared=yes
+    fi
+  done
+  IFS="$ac_save_ifs"
+  ;;
+esac],
+enable_shared=AC_ENABLE_SHARED_DEFAULT)dnl
+])
+
+# AC_DISABLE_SHARED - set the default shared flag to --disable-shared
+AC_DEFUN([AC_DISABLE_SHARED],
+[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
+AC_ENABLE_SHARED(no)])
+
+# AC_ENABLE_STATIC - implement the --enable-static flag
+# Usage: AC_ENABLE_STATIC[(DEFAULT)]
+#   Where DEFAULT is either `yes' or `no'.  If omitted, it defaults to
+#   `yes'.
+AC_DEFUN([AC_ENABLE_STATIC],
+[define([AC_ENABLE_STATIC_DEFAULT], ifelse($1, no, no, yes))dnl
+AC_ARG_ENABLE(static,
+changequote(<<, >>)dnl
+<<  --enable-static[=PKGS]  build static libraries [default=>>AC_ENABLE_STATIC_DEFAULT],
+changequote([, ])dnl
+[p=${PACKAGE-default}
+case $enableval in
+yes) enable_static=yes ;;
+no) enable_static=no ;;
+*)
+  enable_static=no
+  # Look at the argument we got.  We use all the common list separators.
+  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
+  for pkg in $enableval; do
+    if test "X$pkg" = "X$p"; then
+      enable_static=yes
+    fi
+  done
+  IFS="$ac_save_ifs"
+  ;;
+esac],
+enable_static=AC_ENABLE_STATIC_DEFAULT)dnl
+])
+
+# AC_DISABLE_STATIC - set the default static flag to --disable-static
+AC_DEFUN([AC_DISABLE_STATIC],
+[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
+AC_ENABLE_STATIC(no)])
+
+
+# AC_ENABLE_FAST_INSTALL - implement the --enable-fast-install flag
+# Usage: AC_ENABLE_FAST_INSTALL[(DEFAULT)]
+#   Where DEFAULT is either `yes' or `no'.  If omitted, it defaults to
+#   `yes'.
+AC_DEFUN([AC_ENABLE_FAST_INSTALL],
+[define([AC_ENABLE_FAST_INSTALL_DEFAULT], ifelse($1, no, no, yes))dnl
+AC_ARG_ENABLE(fast-install,
+changequote(<<, >>)dnl
+<<  --enable-fast-install[=PKGS]  optimize for fast installation [default=>>AC_ENABLE_FAST_INSTALL_DEFAULT],
+changequote([, ])dnl
+[p=${PACKAGE-default}
+case $enableval in
+yes) enable_fast_install=yes ;;
+no) enable_fast_install=no ;;
+*)
+  enable_fast_install=no
+  # Look at the argument we got.  We use all the common list separators.
+  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
+  for pkg in $enableval; do
+    if test "X$pkg" = "X$p"; then
+      enable_fast_install=yes
+    fi
+  done
+  IFS="$ac_save_ifs"
+  ;;
+esac],
+enable_fast_install=AC_ENABLE_FAST_INSTALL_DEFAULT)dnl
+])
+
+# AC_DISABLE_FAST_INSTALL - set the default to --disable-fast-install
+AC_DEFUN([AC_DISABLE_FAST_INSTALL],
+[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
+AC_ENABLE_FAST_INSTALL(no)])
+
+# AC_LIBTOOL_PICMODE - implement the --with-pic flag
+# Usage: AC_LIBTOOL_PICMODE[(MODE)]
+#   Where MODE is either `yes' or `no'.  If omitted, it defaults to
+#   `both'.
+AC_DEFUN([AC_LIBTOOL_PICMODE],
+[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
+pic_mode=ifelse($#,1,$1,default)])
+
+
+# AC_PATH_TOOL_PREFIX - find a file program which can recognise shared library
+AC_DEFUN([AC_PATH_TOOL_PREFIX],
+[AC_MSG_CHECKING([for $1])
+AC_CACHE_VAL(lt_cv_path_MAGIC_CMD,
+[case $MAGIC_CMD in
+  /*)
+  lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path.
+  ;;
+  ?:/*)
+  lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a dos path.
+  ;;
+  *)
+  ac_save_MAGIC_CMD="$MAGIC_CMD"
+  IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS=":"
+dnl $ac_dummy forces splitting on constant user-supplied paths.
+dnl POSIX.2 word splitting is done only on the output of word expansions,
+dnl not every word.  This closes a longstanding sh security hole.
+  ac_dummy="ifelse([$2], , $PATH, [$2])"
+  for ac_dir in $ac_dummy; do
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/$1; then
+      lt_cv_path_MAGIC_CMD="$ac_dir/$1"
+      if test -n "$file_magic_test_file"; then
+	case $deplibs_check_method in
+	"file_magic "*)
+	  file_magic_regex="`expr \"$deplibs_check_method\" : \"file_magic \(.*\)\"`"
+	  MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+	  if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null |
+	    egrep "$file_magic_regex" > /dev/null; then
+	    :
+	  else
+	    cat <<EOF 1>&2
+
+*** Warning: the command libtool uses to detect shared libraries,
+*** $file_magic_cmd, produces output that libtool cannot recognize.
+*** The result is that libtool may fail to recognize shared libraries
+*** as such.  This will affect the creation of libtool libraries that
+*** depend on shared libraries, but programs linked with such libtool
+*** libraries will work regardless of this problem.  Nevertheless, you
+*** may want to report the problem to your system manager and/or to
+*** bug-libtool@gnu.org
+
+EOF
+	  fi ;;
+	esac
+      fi
+      break
+    fi
+  done
+  IFS="$ac_save_ifs"
+  MAGIC_CMD="$ac_save_MAGIC_CMD"
+  ;;
+esac])
+MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+if test -n "$MAGIC_CMD"; then
+  AC_MSG_RESULT($MAGIC_CMD)
+else
+  AC_MSG_RESULT(no)
+fi
+])
+
+
+# AC_PATH_MAGIC - find a file program which can recognise a shared library
+AC_DEFUN([AC_PATH_MAGIC],
+[AC_REQUIRE([AC_CHECK_TOOL_PREFIX])dnl
+AC_PATH_TOOL_PREFIX(${ac_tool_prefix}file, /usr/bin:$PATH)
+if test -z "$lt_cv_path_MAGIC_CMD"; then
+  if test -n "$ac_tool_prefix"; then
+    AC_PATH_TOOL_PREFIX(file, /usr/bin:$PATH)
+  else
+    MAGIC_CMD=:
+  fi
+fi
+])
+
+
+# AC_PROG_LD - find the path to the GNU or non-GNU linker
+AC_DEFUN([AC_PROG_LD],
+[AC_ARG_WITH(gnu-ld,
+[  --with-gnu-ld           assume the C compiler uses GNU ld [default=no]],
+test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no)
+AC_REQUIRE([AC_PROG_CC])dnl
+AC_REQUIRE([AC_CANONICAL_HOST])dnl
+AC_REQUIRE([AC_CANONICAL_BUILD])dnl
+AC_REQUIRE([_LT_AC_LIBTOOL_SYS_PATH_SEPARATOR])dnl
+ac_prog=ld
+if test "$GCC" = yes; then
+  # Check if gcc -print-prog-name=ld gives a path.
+  AC_MSG_CHECKING([for ld used by GCC])
+  case $host in
+  *-*-mingw*)
+    # gcc leaves a trailing carriage return which upsets mingw
+    ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
+  *)
+    ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
+  esac
+  case $ac_prog in
+    # Accept absolute paths.
+    [[\\/]]* | [[A-Za-z]]:[[\\/]]*)
+      re_direlt='/[[^/]][[^/]]*/\.\./'
+      # Canonicalize the path of ld
+      ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'`
+      while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
+	ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
+      done
+      test -z "$LD" && LD="$ac_prog"
+      ;;
+  "")
+    # If it fails, then pretend we aren't using GCC.
+    ac_prog=ld
+    ;;
+  *)
+    # If it is relative, then search for the first ld in PATH.
+    with_gnu_ld=unknown
+    ;;
+  esac
+elif test "$with_gnu_ld" = yes; then
+  AC_MSG_CHECKING([for GNU ld])
+else
+  AC_MSG_CHECKING([for non-GNU ld])
+fi
+AC_CACHE_VAL(lt_cv_path_LD,
+[if test -z "$LD"; then
+  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+  for ac_dir in $PATH; do
+    test -z "$ac_dir" && ac_dir=.
+    if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
+      lt_cv_path_LD="$ac_dir/$ac_prog"
+      # Check to see if the program is GNU ld.  I'd rather use --version,
+      # but apparently some GNU ld's only accept -v.
+      # Break only if it was the GNU/non-GNU ld that we prefer.
+      if "$lt_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then
+	test "$with_gnu_ld" != no && break
+      else
+	test "$with_gnu_ld" != yes && break
+      fi
+    fi
+  done
+  IFS="$ac_save_ifs"
+else
+  lt_cv_path_LD="$LD" # Let the user override the test with a path.
+fi])
+LD="$lt_cv_path_LD"
+if test -n "$LD"; then
+  AC_MSG_RESULT($LD)
+else
+  AC_MSG_RESULT(no)
+fi
+test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
+AC_PROG_LD_GNU
+])
+
+# AC_PROG_LD_GNU -
+AC_DEFUN([AC_PROG_LD_GNU],
+[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], lt_cv_prog_gnu_ld,
+[# I'd rather use --version here, but apparently some GNU ld's only accept -v.
+if $LD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then
+  lt_cv_prog_gnu_ld=yes
+else
+  lt_cv_prog_gnu_ld=no
+fi])
+with_gnu_ld=$lt_cv_prog_gnu_ld
+])
+
+# AC_PROG_LD_RELOAD_FLAG - find reload flag for linker
+#   -- PORTME Some linkers may need a different reload flag.
+AC_DEFUN([AC_PROG_LD_RELOAD_FLAG],
+[AC_CACHE_CHECK([for $LD option to reload object files], lt_cv_ld_reload_flag,
+[lt_cv_ld_reload_flag='-r'])
+reload_flag=$lt_cv_ld_reload_flag
+test -n "$reload_flag" && reload_flag=" $reload_flag"
+])
+
+# AC_DEPLIBS_CHECK_METHOD - how to check for library dependencies
+#  -- PORTME fill in with the dynamic library characteristics
+AC_DEFUN([AC_DEPLIBS_CHECK_METHOD],
+[AC_CACHE_CHECK([how to recognise dependent libraries],
+lt_cv_deplibs_check_method,
+[lt_cv_file_magic_cmd='$MAGIC_CMD'
+lt_cv_file_magic_test_file=
+lt_cv_deplibs_check_method='unknown'
+# Need to set the preceding variable on all platforms that support
+# interlibrary dependencies.
+# 'none' -- dependencies not supported.
+# `unknown' -- same as none, but documents that we really don't know.
+# 'pass_all' -- all dependencies passed with no checks.
+# 'test_compile' -- check by making test program.
+# 'file_magic [[regex]]' -- check by looking for files in library path
+# which responds to the $file_magic_cmd with a given egrep regex.
+# If you have `file' or equivalent on your system and you're not sure
+# whether `pass_all' will *always* work, you probably want this one.
+
+case $host_os in
+aix4* | aix5*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+beos*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+bsdi4*)
+  lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib)'
+  lt_cv_file_magic_cmd='/usr/bin/file -L'
+  lt_cv_file_magic_test_file=/shlib/libc.so
+  ;;
+
+cygwin* | mingw* | pw32*)
+  lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?'
+  lt_cv_file_magic_cmd='$OBJDUMP -f'
+  ;;
+
+darwin* | rhapsody*)
+  lt_cv_deplibs_check_method='file_magic Mach-O dynamically linked shared library'
+  lt_cv_file_magic_cmd='/usr/bin/file -L'
+  case "$host_os" in
+  rhapsody* | darwin1.[[012]])
+    lt_cv_file_magic_test_file=`echo /System/Library/Frameworks/System.framework/Versions/*/System | head -1`
+    ;;
+  *) # Darwin 1.3 on
+    lt_cv_file_magic_test_file='/usr/lib/libSystem.dylib'
+    ;;
+  esac
+  ;;
+
+freebsd*)
+  if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
+    case $host_cpu in
+    i*86 )
+      # Not sure whether the presence of OpenBSD here was a mistake.
+      # Let's accept both of them until this is cleared up.
+      lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD)/i[[3-9]]86 (compact )?demand paged shared library'
+      lt_cv_file_magic_cmd=/usr/bin/file
+      lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*`
+      ;;
+    esac
+  else
+    lt_cv_deplibs_check_method=pass_all
+  fi
+  ;;
+
+gnu*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+hpux10.20*|hpux11*)
+  lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|PA-RISC[[0-9]].[[0-9]]) shared library'
+  lt_cv_file_magic_cmd=/usr/bin/file
+  lt_cv_file_magic_test_file=/usr/lib/libc.sl
+  ;;
+
+irix5* | irix6* | nonstopux*)
+  case $host_os in
+  irix5* | nonstopux*)
+    # this will be overridden with pass_all, but let us keep it just in case
+    lt_cv_deplibs_check_method="file_magic ELF 32-bit MSB dynamic lib MIPS - version 1"
+    ;;
+  *)
+    case $LD in
+    *-32|*"-32 ") libmagic=32-bit;;
+    *-n32|*"-n32 ") libmagic=N32;;
+    *-64|*"-64 ") libmagic=64-bit;;
+    *) libmagic=never-match;;
+    esac
+    # this will be overridden with pass_all, but let us keep it just in case
+    lt_cv_deplibs_check_method="file_magic ELF ${libmagic} MSB mips-[[1234]] dynamic lib MIPS - version 1"
+    ;;
+  esac
+  lt_cv_file_magic_test_file=`echo /lib${libsuff}/libc.so*`
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+# This must be Linux ELF.
+linux-gnu*)
+  case $host_cpu in
+  alpha* | hppa* | i*86 | mips | mipsel | powerpc* | sparc* | ia64*)
+    lt_cv_deplibs_check_method=pass_all ;;
+  *)
+    # glibc up to 2.1.1 does not perform some relocations on ARM
+    lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB (shared object|dynamic lib )' ;;
+  esac
+  lt_cv_file_magic_test_file=`echo /lib/libc.so* /lib/libc-*.so`
+  ;;
+
+netbsd*)
+  if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
+    lt_cv_deplibs_check_method='match_pattern /lib[[^/\.]]+\.so\.[[0-9]]+\.[[0-9]]+$'
+  else
+    lt_cv_deplibs_check_method='match_pattern /lib[[^/\.]]+\.so$'
+  fi
+  ;;
+
+newos6*)
+  lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (executable|dynamic lib)'
+  lt_cv_file_magic_cmd=/usr/bin/file
+  lt_cv_file_magic_test_file=/usr/lib/libnls.so
+  ;;
+
+openbsd*)
+  lt_cv_file_magic_cmd=/usr/bin/file
+  lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*`
+  if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+    lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB shared object'
+  else
+    lt_cv_deplibs_check_method='file_magic OpenBSD.* shared library'
+  fi
+  ;;
+
+osf3* | osf4* | osf5*)
+  # this will be overridden with pass_all, but let us keep it just in case
+  lt_cv_deplibs_check_method='file_magic COFF format alpha shared library'
+  lt_cv_file_magic_test_file=/shlib/libc.so
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+sco3.2v5*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+solaris*)
+  lt_cv_deplibs_check_method=pass_all
+  lt_cv_file_magic_test_file=/lib/libc.so
+  ;;
+
+sysv5uw[[78]]* | sysv4*uw2*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
+  case $host_vendor in
+  motorola)
+    lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib) M[[0-9]][[0-9]]* Version [[0-9]]'
+    lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*`
+    ;;
+  ncr)
+    lt_cv_deplibs_check_method=pass_all
+    ;;
+  sequent)
+    lt_cv_file_magic_cmd='/bin/file'
+    lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB (shared object|dynamic lib )'
+    ;;
+  sni)
+    lt_cv_file_magic_cmd='/bin/file'
+    lt_cv_deplibs_check_method="file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB dynamic lib"
+    lt_cv_file_magic_test_file=/lib/libc.so
+    ;;
+  siemens)
+    lt_cv_deplibs_check_method=pass_all
+    ;;
+  esac
+  ;;
+esac
+])
+file_magic_cmd=$lt_cv_file_magic_cmd
+deplibs_check_method=$lt_cv_deplibs_check_method
+])
+
+
+# AC_PROG_NM - find the path to a BSD-compatible name lister
+AC_DEFUN([AC_PROG_NM],
+[AC_REQUIRE([_LT_AC_LIBTOOL_SYS_PATH_SEPARATOR])dnl
+AC_MSG_CHECKING([for BSD-compatible nm])
+AC_CACHE_VAL(lt_cv_path_NM,
+[if test -n "$NM"; then
+  # Let the user override the test.
+  lt_cv_path_NM="$NM"
+else
+  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+  for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do
+    test -z "$ac_dir" && ac_dir=.
+    tmp_nm=$ac_dir/${ac_tool_prefix}nm
+    if test -f $tmp_nm || test -f $tmp_nm$ac_exeext ; then
+      # Check to see if the nm accepts a BSD-compat flag.
+      # Adding the `sed 1q' prevents false positives on HP-UX, which says:
+      #   nm: unknown option "B" ignored
+      # Tru64's nm complains that /dev/null is an invalid object file
+      if ($tmp_nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep '(/dev/null|Invalid file or object type)' >/dev/null; then
+	lt_cv_path_NM="$tmp_nm -B"
+	break
+      elif ($tmp_nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
+	lt_cv_path_NM="$tmp_nm -p"
+	break
+      else
+	lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but
+	continue # so that we can try to find one that supports BSD flags
+      fi
+    fi
+  done
+  IFS="$ac_save_ifs"
+  test -z "$lt_cv_path_NM" && lt_cv_path_NM=nm
+fi])
+NM="$lt_cv_path_NM"
+AC_MSG_RESULT([$NM])
+])
+
+# AC_CHECK_LIBM - check for math library
+AC_DEFUN([AC_CHECK_LIBM],
+[AC_REQUIRE([AC_CANONICAL_HOST])dnl
+LIBM=
+case $host in
+*-*-beos* | *-*-cygwin* | *-*-pw32*)
+  # These system don't have libm
+  ;;
+*-ncr-sysv4.3*)
+  AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw")
+  AC_CHECK_LIB(m, main, LIBM="$LIBM -lm")
+  ;;
+*)
+  AC_CHECK_LIB(m, main, LIBM="-lm")
+  ;;
+esac
+])
+
+# AC_LIBLTDL_CONVENIENCE[(dir)] - sets LIBLTDL to the link flags for
+# the libltdl convenience library and LTDLINCL to the include flags for
+# the libltdl header and adds --enable-ltdl-convenience to the
+# configure arguments.  Note that LIBLTDL and LTDLINCL are not
+# AC_SUBSTed, nor is AC_CONFIG_SUBDIRS called.  If DIR is not
+# provided, it is assumed to be `libltdl'.  LIBLTDL will be prefixed
+# with '${top_builddir}/' and LTDLINCL will be prefixed with
+# '${top_srcdir}/' (note the single quotes!).  If your package is not
+# flat and you're not using automake, define top_builddir and
+# top_srcdir appropriately in the Makefiles.
+AC_DEFUN([AC_LIBLTDL_CONVENIENCE],
+[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
+  case $enable_ltdl_convenience in
+  no) AC_MSG_ERROR([this package needs a convenience libltdl]) ;;
+  "") enable_ltdl_convenience=yes
+      ac_configure_args="$ac_configure_args --enable-ltdl-convenience" ;;
+  esac
+  LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdlc.la
+  LTDLINCL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl'])
+  # For backwards non-gettext consistent compatibility...
+  INCLTDL="$LTDLINCL"
+])
+
+# AC_LIBLTDL_INSTALLABLE[(dir)] - sets LIBLTDL to the link flags for
+# the libltdl installable library and LTDLINCL to the include flags for
+# the libltdl header and adds --enable-ltdl-install to the configure
+# arguments.  Note that LIBLTDL and LTDLINCL are not AC_SUBSTed, nor is
+# AC_CONFIG_SUBDIRS called.  If DIR is not provided and an installed
+# libltdl is not found, it is assumed to be `libltdl'.  LIBLTDL will
+# be prefixed with '${top_builddir}/' and LTDLINCL will be prefixed
+# with '${top_srcdir}/' (note the single quotes!).  If your package is
+# not flat and you're not using automake, define top_builddir and
+# top_srcdir appropriately in the Makefiles.
+# In the future, this macro may have to be called after AC_PROG_LIBTOOL.
+AC_DEFUN([AC_LIBLTDL_INSTALLABLE],
+[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
+  AC_CHECK_LIB(ltdl, main,
+  [test x"$enable_ltdl_install" != xyes && enable_ltdl_install=no],
+  [if test x"$enable_ltdl_install" = xno; then
+     AC_MSG_WARN([libltdl not installed, but installation disabled])
+   else
+     enable_ltdl_install=yes
+   fi
+  ])
+  if test x"$enable_ltdl_install" = x"yes"; then
+    ac_configure_args="$ac_configure_args --enable-ltdl-install"
+    LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdl.la
+    LTDLINCL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl'])
+  else
+    ac_configure_args="$ac_configure_args --enable-ltdl-install=no"
+    LIBLTDL="-lltdl"
+    LTDLINCL=
+  fi
+  # For backwards non-gettext consistent compatibility...
+  INCLTDL="$LTDLINCL"
+])
+
+# old names
+AC_DEFUN([AM_PROG_LIBTOOL],   [AC_PROG_LIBTOOL])
+AC_DEFUN([AM_ENABLE_SHARED],  [AC_ENABLE_SHARED($@)])
+AC_DEFUN([AM_ENABLE_STATIC],  [AC_ENABLE_STATIC($@)])
+AC_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)])
+AC_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)])
+AC_DEFUN([AM_PROG_LD],        [AC_PROG_LD])
+AC_DEFUN([AM_PROG_NM],        [AC_PROG_NM])
+
+# This is just to silence aclocal about the macro not being used
+ifelse([AC_DISABLE_FAST_INSTALL])
+
+############################################################
+# NOTE: This macro has been submitted for inclusion into   #
+#  GNU Autoconf as AC_PROG_SED.  When it is available in   #
+#  a released version of Autoconf we should remove this    #
+#  macro and use it instead.                               #
+############################################################
+# LT_AC_PROG_SED
+# --------------
+# Check for a fully-functional sed program, that truncates
+# as few characters as possible.  Prefer GNU sed if found.
+AC_DEFUN([LT_AC_PROG_SED],
+[AC_MSG_CHECKING([for a sed that does not truncate output])
+AC_CACHE_VAL(lt_cv_path_SED,
+[# Loop through the user's path and test for sed and gsed.
+# Then use that list of sed's as ones to test for truncation.
+as_executable_p="test -f"
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_prog in sed gsed; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
+      if $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then
+        _sed_list="$_sed_list $as_dir/$ac_prog$ac_exec_ext"
+      fi
+    done
+  done
+done
+
+  # Create a temporary directory, and hook for its removal unless debugging.
+$debug ||
+{
+  trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0
+  trap '{ (exit 1); exit 1; }' 1 2 13 15
+}
+
+# Create a (secure) tmp directory for tmp files.
+: ${TMPDIR=/tmp}
+{
+  tmp=`(umask 077 && mktemp -d -q "$TMPDIR/sedXXXXXX") 2>/dev/null` &&
+  test -n "$tmp" && test -d "$tmp"
+}  ||
+{
+  tmp=$TMPDIR/sed$$-$RANDOM
+  (umask 077 && mkdir $tmp)
+} ||
+{
+   echo "$me: cannot create a temporary directory in $TMPDIR" >&2
+   { (exit 1); exit 1; }
+}
+  _max=0
+  _count=0
+  # Add /usr/xpg4/bin/sed as it is typically found on Solaris
+  # along with /bin/sed that truncates output.
+  for _sed in $_sed_list /usr/xpg4/bin/sed; do
+    test ! -f ${_sed} && break
+    cat /dev/null > "$tmp/sed.in"
+    _count=0
+    echo ${ECHO_N-$ac_n} "0123456789${ECHO_C-$ac_c}" >"$tmp/sed.in"
+    # Check for GNU sed and select it if it is found.
+    if "${_sed}" --version 2>&1 < /dev/null | egrep '(GNU)' > /dev/null; then
+      lt_cv_path_SED=${_sed}
+      break
+    fi
+    while true; do
+      cat "$tmp/sed.in" "$tmp/sed.in" >"$tmp/sed.tmp"
+      mv "$tmp/sed.tmp" "$tmp/sed.in"
+      cp "$tmp/sed.in" "$tmp/sed.nl"
+      echo >>"$tmp/sed.nl"
+      ${_sed} -e 's/a$//' < "$tmp/sed.nl" >"$tmp/sed.out" || break
+      cmp -s "$tmp/sed.out" "$tmp/sed.nl" || break
+      # 40000 chars as input seems more than enough
+      test $_count -gt 10 && break
+      _count=`expr $_count + 1`
+      if test $_count -gt $_max; then
+        _max=$_count
+        lt_cv_path_SED=$_sed
+      fi
+    done
+  done
+  rm -rf "$tmp"
+])
+if test "X$SED" != "X"; then
+  lt_cv_path_SED=$SED
+else
+  SED=$lt_cv_path_SED
+fi
+AC_MSG_RESULT([$SED])
+])
diff -Naur tomato/release/src/router/snmp/agent/agent_handler.c tomato121/release/src/router/snmp/agent/agent_handler.c
--- tomato/release/src/router/snmp/agent/agent_handler.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/agent_handler.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,790 @@
+#include <net-snmp/net-snmp-config.h>
+
+#include <sys/types.h>
+
+#if HAVE_STRING_H
+#include <string.h>
+#endif
+
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+#include <net-snmp/agent/bulk_to_next.h>
+/***********************************************************************/
+/*
+ * New Handler based API 
+ */
+/***********************************************************************/
+/** @defgroup handler Net-SNMP Agent handler and extensibility API
+ *  @ingroup agent
+ *
+ *  The basic theory goes something like this: In the past, with the
+ *  original mib module api (which derived from the original CMU SNMP
+ *  code) the underlying mib modules were passed very little
+ *  information (only the truly most basic information about a
+ *  request).  This worked well at the time but in todays world of
+ *  subagents, device instrumentation, low resource consumption, etc,
+ *  it just isn't flexible enough.  "handlers" are here to fix all that.
+ *
+ *  With the rewrite of the agent internals for the net-snmp 5.0
+ *  release, we introduce a modular calling scheme that allows agent
+ *  modules to be written in a very flexible manner, and more
+ *  importantly allows reuse of code in a decent way (and without the
+ *  memory and speed overheads of OO languages like C++).
+ *
+ *  Functionally, the notion of what a handler does is the same as the
+ *  older api: A handler is @link netsnmp_create_handler() created@endlink and
+ *  then @link netsnmp_register_handler() registered@endlink with the main
+ *  agent at a given OID in the OID tree and gets called any time a
+ *  request is made that it should respond to.  You probably should
+ *  use one of the convenience helpers instead of doing anything else
+ *  yourself though:
+ *
+ *  Most importantly, though, is that the handlers are built on the
+ *  notion of modularity and reuse.  Specifically, rather than do all
+ *  the really hard work (like parsing table indexes out of an
+ *  incoming oid request) in each module, the API is designed to make
+ *  it easy to write "helper" handlers that merely process some aspect
+ *  of the request before passing it along to the final handler that
+ *  returns the real answer.  Most people will want to make use of the
+ *  @link instance instance@endlink, @link table table@endlink, @link
+ *  table_iterator table_iterator@endlink, @link table_data
+ *  table_data@endlink, or @link table_dataset table_dataset@endlink
+ *  helpers to make their life easier.  These "helpers" interpert
+ *  important aspects of the request and pass them on to you.
+ *
+ *  For instance, the @link table table@endlink helper is designed to
+ *  hand you a list of extracted index values from an incoming
+ *  request.  THe @link table_iterator table_iterator@endlink helper
+ *  is built on top of the table helper, and is designed to help you
+ *  iterate through data stored elsewhere (like in a kernel) that is
+ *  not in OID lexographical order (ie, don't write your own index/oid
+ *  sorting routine, use this helper instead).  The beauty of the
+ *  @link table_iterator table_iterator helper@, as well as the @link
+ *  instance instance@ helper is that they take care of the complex
+ *  GETNEXT processing entirely for you and hand you everything you
+ *  need to merely return the data as if it was a GET request.  Much
+ *  less code and hair pulling.  I've pulled all my hair out to help
+ *  you so that only one of us has to be bald.
+ *
+ * @{
+ */
+
+/** creates a netsnmp_mib_handler structure given a name and a access method.
+ *  The returned handler should then be @link netsnmp_register_handler()
+ *  registered.@endlink
+ *  @see netsnmp_create_handler_registration()
+ *  @see netsnmp_register_handler()
+ */
+netsnmp_mib_handler *
+netsnmp_create_handler(const char *name,
+                       Netsnmp_Node_Handler * handler_access_method)
+{
+    netsnmp_mib_handler *ret = SNMP_MALLOC_TYPEDEF(netsnmp_mib_handler);
+    ret->handler_name = strdup(name);
+    ret->access_method = handler_access_method;
+    return ret;
+}
+
+/** creates a handler registration structure given a name, a
+ *  access_method function, a registration location oid and the modes
+ *  the handler supports. If modes == 0, then modes will automatically
+ *  be set to the default value of only HANDLER_CAN_DEFAULT, which is
+ *  by default read-only GET and GETNEXT requests.
+ *  @note This ends up calling netsnmp_create_handler(name, handler_access_method)
+ *  @see netsnmp_create_handler()
+ *  @see netsnmp_register_handler()
+ */
+netsnmp_handler_registration *
+netsnmp_create_handler_registration(const char *name,
+                                    Netsnmp_Node_Handler *
+                                    handler_access_method, oid * reg_oid,
+                                    size_t reg_oid_len, int modes)
+{
+    netsnmp_handler_registration *the_reg;
+    the_reg = SNMP_MALLOC_TYPEDEF(netsnmp_handler_registration);
+    if (!the_reg)
+        return NULL;
+
+    if (modes)
+        the_reg->modes = modes;
+    else
+        the_reg->modes = HANDLER_CAN_DEFAULT;
+
+    the_reg->handler = netsnmp_create_handler(name, handler_access_method);
+    if (name)
+        the_reg->handlerName = strdup(name);
+    memdup((u_char **) & the_reg->rootoid, (const u_char *) reg_oid,
+           reg_oid_len * sizeof(oid));
+    the_reg->rootoid_len = reg_oid_len;
+    return the_reg;
+}
+
+/** register a handler, as defined by the netsnmp_handler_registration pointer. */
+int
+netsnmp_register_handler(netsnmp_handler_registration *reginfo)
+{
+    netsnmp_mib_handler *handler;
+    DEBUGIF("handler::register") {
+        DEBUGMSGTL(("handler::register", "Registering "));
+        for (handler = reginfo->handler; handler; handler = handler->next) {
+            DEBUGMSG(("handler::register", "::%s", handler->handler_name));
+        }
+
+        DEBUGMSG(("handler::register", " at "));
+        if (reginfo->rootoid && reginfo->range_subid) {
+            DEBUGMSGOIDRANGE(("handler::register", reginfo->rootoid,
+                              reginfo->rootoid_len, reginfo->range_subid,
+                              reginfo->range_ubound));
+        } else if (reginfo->rootoid) {
+            DEBUGMSGOID(("handler::register", reginfo->rootoid,
+                         reginfo->rootoid_len));
+        } else {
+            DEBUGMSG(("handler::register", "[null]"));
+        }
+        DEBUGMSG(("handler::register", "\n"));
+    }
+
+    /*
+     * don't let them register for absolutely nothing.  Probably a mistake 
+     */
+    if (0 == reginfo->modes) {
+        reginfo->modes = HANDLER_CAN_DEFAULT;
+    }
+
+    /*
+     * for handlers that can't GETBULK, force a conversion handler on them 
+     */
+    if (!(reginfo->modes & HANDLER_CAN_GETBULK)) {
+        netsnmp_inject_handler(reginfo,
+                               netsnmp_get_bulk_to_next_handler());
+    }
+
+    return netsnmp_register_mib(reginfo->handler->handler_name,
+                                NULL, 0, 0,
+                                reginfo->rootoid, reginfo->rootoid_len,
+                                reginfo->priority,
+                                reginfo->range_subid,
+                                reginfo->range_ubound, NULL,
+                                reginfo->contextName, reginfo->timeout, 0,
+                                reginfo, 1);
+}
+
+/** register a handler, as defined by the netsnmp_handler_registration pointer. */
+int
+netsnmp_register_handler_nocallback(netsnmp_handler_registration *reginfo)
+{
+    netsnmp_mib_handler *handler;
+    DEBUGIF("handler::register") {
+        DEBUGMSGTL(("handler::register",
+                    "Registering (with no callback) "));
+        for (handler = reginfo->handler; handler; handler = handler->next) {
+            DEBUGMSG(("handler::register", "::%s", handler->handler_name));
+        }
+
+        DEBUGMSG(("handler::register", " at "));
+        if (reginfo->rootoid && reginfo->range_subid) {
+            DEBUGMSGOIDRANGE(("handler::register", reginfo->rootoid,
+                              reginfo->rootoid_len, reginfo->range_subid,
+                              reginfo->range_ubound));
+        } else if (reginfo->rootoid) {
+            DEBUGMSGOID(("handler::register", reginfo->rootoid,
+                         reginfo->rootoid_len));
+        } else {
+            DEBUGMSG(("handler::register", "[null]"));
+        }
+        DEBUGMSG(("handler::register", "\n"));
+    }
+
+    /*
+     * don't let them register for absolutely nothing.  Probably a mistake 
+     */
+    if (0 == reginfo->modes) {
+        reginfo->modes = HANDLER_CAN_DEFAULT;
+    }
+
+    return netsnmp_register_mib(reginfo->handler->handler_name,
+                                NULL, 0, 0,
+                                reginfo->rootoid, reginfo->rootoid_len,
+                                reginfo->priority,
+                                reginfo->range_subid,
+                                reginfo->range_ubound, NULL,
+                                reginfo->contextName, reginfo->timeout, 0,
+                                reginfo, 0);
+}
+
+/** inject a new handler into the calling chain of the handlers
+   definedy by the netsnmp_handler_registration pointer.  The new handler is
+   injected at the top of the list and hence will be the new handler
+   to be called first.*/
+int
+netsnmp_inject_handler(netsnmp_handler_registration *reginfo,
+                       netsnmp_mib_handler *handler)
+{
+    DEBUGMSGTL(("handler:inject", "injecting %s before %s\n",
+                handler->handler_name, reginfo->handler->handler_name));
+    handler->next = reginfo->handler;
+    if (reginfo->handler)
+        reginfo->handler->prev = handler;
+    reginfo->handler = handler;
+    return SNMPERR_SUCCESS;
+}
+
+/** @internal
+ *  calls all the handlers for a given mode.
+ */
+int
+netsnmp_call_handlers(netsnmp_handler_registration *reginfo,
+                      netsnmp_agent_request_info *reqinfo,
+                      netsnmp_request_info *requests)
+{
+    Netsnmp_Node_Handler *nh;
+    netsnmp_request_info *request;
+    int             status;
+
+    if (reginfo == NULL || reqinfo == NULL || requests == NULL) {
+        snmp_log(LOG_ERR, "netsnmp_call_handlers() called illegally\n");
+        return SNMP_ERR_GENERR;
+    }
+
+    if (reginfo->handler == NULL) {
+        snmp_log(LOG_ERR, "no handler specified.");
+        return SNMP_ERR_GENERR;
+    }
+
+    switch (reqinfo->mode) {
+    case MODE_GETBULK:
+    case MODE_GET:
+    case MODE_GETNEXT:
+        if (!(reginfo->modes & HANDLER_CAN_GETANDGETNEXT))
+            return SNMP_ERR_NOERROR;    /* legal */
+        break;
+
+    case MODE_SET_RESERVE1:
+    case MODE_SET_RESERVE2:
+    case MODE_SET_ACTION:
+    case MODE_SET_COMMIT:
+    case MODE_SET_FREE:
+    case MODE_SET_UNDO:
+        if (!(reginfo->modes & HANDLER_CAN_SET)) {
+            for (; requests; requests = requests->next) {
+                netsnmp_set_request_error(reqinfo, requests,
+                                          SNMP_ERR_NOTWRITABLE);
+            }
+            return SNMP_ERR_NOERROR;
+        }
+        break;
+
+    default:
+        snmp_log(LOG_ERR, "unknown mode in netsnmp_call_handlers! bug!\n");
+        return SNMP_ERR_GENERR;
+    }
+    DEBUGMSGTL(("handler:calling", "calling main handler %s\n",
+                reginfo->handler->handler_name));
+
+    for (request = requests ; request; request = request->next) {
+        request->processed = 0;
+    }
+
+    nh = reginfo->handler->access_method;
+    if (!nh) {
+        snmp_log(LOG_ERR, "no handler access method specified.");
+        return SNMP_ERR_GENERR;
+    }
+
+    /*
+     * XXX: define acceptable return statuses 
+     */
+    status = (*nh) (reginfo->handler, reginfo, reqinfo, requests);
+
+    return status;
+}
+
+/** calls a handler with with appropriate NULL checking of arguments, etc. */
+NETSNMP_INLINE int
+netsnmp_call_handler(netsnmp_mib_handler *next_handler,
+                     netsnmp_handler_registration *reginfo,
+                     netsnmp_agent_request_info *reqinfo,
+                     netsnmp_request_info *requests)
+{
+    Netsnmp_Node_Handler *nh;
+    int             ret;
+
+    if (next_handler == NULL || reginfo == NULL || reqinfo == NULL ||
+        requests == NULL) {
+        snmp_log(LOG_ERR, "netsnmp_call_handler() called illegally\n");
+        return SNMP_ERR_GENERR;
+    }
+
+    nh = next_handler->access_method;
+    if (!nh) {
+        snmp_log(LOG_ERR, "no access method specified in handler %s.",
+                 next_handler->handler_name);
+        return SNMP_ERR_GENERR;
+    }
+
+    DEBUGMSGTL(("handler:calling", "calling handler %s\n",
+                next_handler->handler_name));
+
+    ret = (*nh) (next_handler, reginfo, reqinfo, requests);
+
+    DEBUGMSGTL(("handler:returned", "handler %s returned %d\n",
+                next_handler->handler_name, ret));
+
+    return ret;
+}
+
+/** calls the next handler in the chain after the current one with
+   with appropriate NULL checking, etc. */
+NETSNMP_INLINE int
+netsnmp_call_next_handler(netsnmp_mib_handler *current,
+                          netsnmp_handler_registration *reginfo,
+                          netsnmp_agent_request_info *reqinfo,
+                          netsnmp_request_info *requests)
+{
+
+    if (current == NULL || reginfo == NULL || reqinfo == NULL ||
+        requests == NULL) {
+        snmp_log(LOG_ERR, "netsnmp_call_next_handler() called illegally\n");
+        return SNMP_ERR_GENERR;
+    }
+
+    return netsnmp_call_handler(current->next, reginfo, reqinfo, requests);
+}
+
+/** calls the next handler in the chain after the current one with
+   with appropriate NULL checking, etc. */
+NETSNMP_INLINE int
+netsnmp_call_next_handler_one_request(netsnmp_mib_handler *current,
+                                      netsnmp_handler_registration *reginfo,
+                                      netsnmp_agent_request_info *reqinfo,
+                                      netsnmp_request_info *requests)
+{
+    netsnmp_request_info *request;
+    int ret;
+    
+    if (!requests) {
+        snmp_log(LOG_ERR, "netsnmp_call_next_handler_ONE_REQUEST() called illegally\n");
+        return SNMP_ERR_GENERR;
+    }
+
+    request = requests->next;
+    requests->next = NULL;
+    ret = netsnmp_call_handler(current->next, reginfo, reqinfo, requests);
+    requests->next = request;
+    return ret;
+}
+
+/** free's the resourceses associated with a given handler */
+void
+netsnmp_handler_free(netsnmp_mib_handler *handler)
+{
+    if (handler != NULL) {
+        if (handler->next != NULL) {
+            netsnmp_handler_free(handler->next);
+            handler->next = NULL;
+        }
+        SNMP_FREE(handler->handler_name);
+        free(handler);
+    }
+}
+
+/** dulpicates a handler */
+netsnmp_mib_handler *
+netsnmp_handler_dup(netsnmp_mib_handler *handler)
+{
+    netsnmp_mib_handler *h = NULL;
+
+    if (handler == NULL) {
+        return NULL;
+    }
+
+    h = (netsnmp_mib_handler *) calloc(1, sizeof(netsnmp_mib_handler));
+
+    if (h != NULL) {
+        h->myvoid = handler->myvoid;
+        h->access_method = handler->access_method;
+
+        if (handler->handler_name != NULL) {
+            h->handler_name = strdup(handler->handler_name);
+            if (h->handler_name == NULL) {
+                free(h);
+                return NULL;
+            }
+        }
+
+        if (handler->next != NULL) {
+            h->next = netsnmp_handler_dup(handler->next);
+            if (h->next == NULL) {
+                if (h->handler_name) {
+                    free(h->handler_name);
+                }
+                free(h);
+                return NULL;
+            }
+            h->next->prev = h;
+        }
+        h->prev = NULL;
+        return h;
+    }
+    return NULL;
+}
+
+/** free the resources associated with a handler registration object */
+void
+netsnmp_handler_registration_free(netsnmp_handler_registration *reginfo)
+{
+    if (reginfo != NULL) {
+        netsnmp_handler_free(reginfo->handler);
+        SNMP_FREE(reginfo->handlerName);
+        SNMP_FREE(reginfo->contextName);
+        SNMP_FREE(reginfo->rootoid);
+        free(reginfo);
+    }
+}
+
+/** duplicates the handler registration object */
+netsnmp_handler_registration *
+netsnmp_handler_registration_dup(netsnmp_handler_registration *reginfo)
+{
+    netsnmp_handler_registration *r = NULL;
+
+    if (reginfo == NULL) {
+        return NULL;
+    }
+
+
+    r = (netsnmp_handler_registration *) calloc(1,
+                                                sizeof
+                                                (netsnmp_handler_registration));
+
+    if (r != NULL) {
+        r->modes = reginfo->modes;
+        r->priority = reginfo->priority;
+        r->range_subid = reginfo->range_subid;
+        r->timeout = reginfo->timeout;
+        r->range_ubound = reginfo->range_ubound;
+        r->rootoid_len = reginfo->rootoid_len;
+
+        if (reginfo->handlerName != NULL) {
+            r->handlerName = strdup(reginfo->handlerName);
+            if (r->handlerName == NULL) {
+                netsnmp_handler_registration_free(r);
+                return NULL;
+            }
+        }
+
+        if (reginfo->contextName != NULL) {
+            r->contextName = strdup(reginfo->contextName);
+            if (r->contextName == NULL) {
+                netsnmp_handler_registration_free(r);
+                return NULL;
+            }
+        }
+
+        if (reginfo->rootoid != NULL) {
+            memdup((u_char **) & (r->rootoid),
+                   (const u_char *) reginfo->rootoid,
+                   reginfo->rootoid_len * sizeof(oid));
+            if (r->rootoid == NULL) {
+                netsnmp_handler_registration_free(r);
+                return NULL;
+            }
+        }
+
+        r->handler = netsnmp_handler_dup(reginfo->handler);
+        if (r->handler == NULL) {
+            netsnmp_handler_registration_free(r);
+            return NULL;
+        }
+        return r;
+    }
+
+    return NULL;
+}
+
+/** creates a cache of information which can be saved for future
+   reference.  Use netsnmp_handler_check_cache() later to make sure it's still
+   valid before referencing it in the future. */
+NETSNMP_INLINE netsnmp_delegated_cache *
+netsnmp_create_delegated_cache(netsnmp_mib_handler *handler,
+                               netsnmp_handler_registration *reginfo,
+                               netsnmp_agent_request_info *reqinfo,
+                               netsnmp_request_info *requests,
+                               void *localinfo)
+{
+    netsnmp_delegated_cache *ret;
+
+    ret = SNMP_MALLOC_TYPEDEF(netsnmp_delegated_cache);
+    if (ret) {
+        ret->transaction_id = reqinfo->asp->pdu->transid;
+        ret->handler = handler;
+        ret->reginfo = reginfo;
+        ret->reqinfo = reqinfo;
+        ret->requests = requests;
+        ret->localinfo = localinfo;
+    }
+    return ret;
+}
+
+/** check's a given cache and returns it if it is still valid (ie, the
+   agent still considers it to be an outstanding request.  Returns
+   NULL if it's no longer valid. */
+NETSNMP_INLINE netsnmp_delegated_cache *
+netsnmp_handler_check_cache(netsnmp_delegated_cache *dcache)
+{
+    if (!dcache)
+        return dcache;
+
+    if (netsnmp_check_transaction_id(dcache->transaction_id) ==
+        SNMPERR_SUCCESS)
+        return dcache;
+
+    return NULL;
+}
+
+/** frees a cache once you're finished using it */
+NETSNMP_INLINE void
+netsnmp_free_delegated_cache(netsnmp_delegated_cache *dcache)
+{
+    /*
+     * right now, no extra data is there that needs to be freed 
+     */
+    if (dcache)
+        free(dcache);
+
+    return;
+}
+
+
+/** marks a list of requests as delegated (or not if isdelegaded = 0) */
+void
+netsnmp_handler_mark_requests_as_delegated(netsnmp_request_info *requests,
+                                           int isdelegated)
+{
+    while (requests) {
+        requests->delegated = isdelegated;
+        requests = requests->next;
+    }
+}
+
+/** add data to a request that can be extracted later by submodules */
+NETSNMP_INLINE void
+netsnmp_request_add_list_data(netsnmp_request_info *request,
+                              netsnmp_data_list *node)
+{
+    if (request) {
+        if (request->parent_data)
+            netsnmp_add_list_data(&request->parent_data, node);
+        else
+            request->parent_data = node;
+    }
+}
+
+/** extract data from a request that was added previously by a parent module */
+NETSNMP_INLINE void    *
+netsnmp_request_get_list_data(netsnmp_request_info *request,
+                              const char *name)
+{
+    if (request)
+        return netsnmp_get_list_data(request->parent_data, name);
+    return NULL;
+}
+
+/** Free the extra data stored in a request */
+NETSNMP_INLINE void
+netsnmp_free_request_data_set(netsnmp_request_info *request)
+{
+    if (request)
+        netsnmp_free_list_data(request->parent_data);
+}
+
+/** Free the extra data stored in a bunch of requests (all data in the chain) */
+NETSNMP_INLINE void
+netsnmp_free_request_data_sets(netsnmp_request_info *request)
+{
+    if (request && request->parent_data) {
+        netsnmp_free_all_list_data(request->parent_data);
+        request->parent_data = NULL;
+    }
+}
+
+/** Returns a handler from a chain based on the name */
+netsnmp_mib_handler *
+netsnmp_find_handler_by_name(netsnmp_handler_registration *reginfo,
+                             const char *name)
+{
+    netsnmp_mib_handler *it;
+    for (it = reginfo->handler; it; it = it->next) {
+        if (strcmp(it->handler_name, name) == 0) {
+            return it;
+        }
+    }
+    return NULL;
+}
+
+/** Returns a handler's void * pointer from a chain based on the name.
+ This probably shouldn't be used by the general public as the void *
+ data may change as a handler evolves.  Handlers should really
+ advertise some function for you to use instead. */
+void           *
+netsnmp_find_handler_data_by_name(netsnmp_handler_registration *reginfo,
+                                  const char *name)
+{
+    netsnmp_mib_handler *it = netsnmp_find_handler_by_name(reginfo, name);
+    if (it)
+        return it->myvoid;
+    return NULL;
+}
+
+/** clones a mib handler (it's name and access methods onlys; not myvoid)
+ */
+netsnmp_mib_handler *
+clone_handler(netsnmp_mib_handler *it)
+{
+    return netsnmp_create_handler(it->handler_name, it->access_method);
+}
+
+static netsnmp_data_list *handler_reg = NULL;
+
+/** registers a given handler by name so that it can be found easily later.
+ */
+void
+netsnmp_register_handler_by_name(const char *name,
+                                 netsnmp_mib_handler *handler)
+{
+    netsnmp_add_list_data(&handler_reg,
+                          netsnmp_create_data_list(name, (void *) handler,
+                                                   NULL));
+    DEBUGMSGTL(("handler_registry", "registering helper %s\n", name));
+}
+
+/** @internal
+ *  injects a handler into a subtree, peers and children when a given
+ *  subtrees name matches a passed in name.
+ */
+void
+netsnmp_inject_handler_into_subtree(netsnmp_subtree *tp, const char *name,
+                                    netsnmp_mib_handler *handler)
+{
+    netsnmp_subtree *tptr;
+    netsnmp_mib_handler *mh;
+
+    for (tptr = tp; tptr != NULL; tptr = tptr->next) {
+        /*  if (tptr->children) { 
+              netsnmp_inject_handler_into_subtree(tptr->children,name,handler);
+	    }   */
+        if (strcmp(tptr->label_a, name) == 0) {
+            DEBUGMSGTL(("injectHandler", "injecting handler %s into %s\n",
+                        handler->handler_name, tptr->label_a));
+            netsnmp_inject_handler(tptr->reginfo, clone_handler(handler));
+        } else if (tptr->reginfo != NULL &&
+		   tptr->reginfo->handlerName != NULL &&
+                   strcmp(tptr->reginfo->handlerName, name) == 0) {
+            DEBUGMSGTL(("injectHandler", "injecting handler into %s/%s\n",
+                        tptr->label_a, tptr->reginfo->handlerName));
+            netsnmp_inject_handler(tptr->reginfo, clone_handler(handler));
+        } else {
+            for (mh = tptr->reginfo->handler; mh != NULL; mh = mh->next) {
+                if (mh->handler_name && strcmp(mh->handler_name, name) == 0) {
+                    DEBUGMSGTL(("injectHandler", "injecting handler into %s\n",
+                                tptr->label_a));
+                    netsnmp_inject_handler(tptr->reginfo,
+					   clone_handler(handler));
+                    break;
+                } else {
+                    DEBUGMSGTL(("yyyinjectHandler",
+                                "not injecting handler into %s\n",
+                                mh->handler_name));
+                }
+            }
+        }
+    }
+}
+
+static int      doneit = 0;
+/** @internal
+ *  parses the "injectHandler" token line.
+ */
+void
+parse_injectHandler_conf(const char *token, char *cptr)
+{
+    char            handler_to_insert[256];
+    subtree_context_cache *stc;
+    netsnmp_mib_handler *handler;
+
+    /*
+     * XXXWWW: ensure instead that handler isn't inserted twice 
+     */
+    if (doneit)                 /* we only do this once without restart the agent */
+        return;
+
+    cptr = copy_nword(cptr, handler_to_insert, sizeof(handler_to_insert));
+    handler = netsnmp_get_list_data(handler_reg, handler_to_insert);
+    if (!handler) {
+        config_perror("no such \"%s\" handler registered.");
+        return;
+    }
+
+    if (!cptr) {
+        config_perror("no INTONAME specified.  Can't do insertion.");
+        return;
+    }
+    for (stc = get_top_context_cache(); stc; stc = stc->next) {
+        DEBUGMSGTL(("injectHandler", "Checking context tree %s\n",
+                    stc->context_name));
+        netsnmp_inject_handler_into_subtree(stc->first_subtree, cptr,
+                                            handler);
+    }
+}
+
+/** @internal
+ *  callback to ensure injectHandler parser doesn't do things twice
+ *  @todo replace this with a method to check the handler chain instead.
+ */
+static int
+handler_mark_doneit(int majorID, int minorID,
+                    void *serverarg, void *clientarg)
+{
+    doneit = 1;
+    return 0;
+}
+
+/** @internal
+ *  register's the injectHandle parser token.
+ */
+void
+netsnmp_init_handler_conf(void)
+{
+    snmpd_register_config_handler("injectHandler",
+                                  parse_injectHandler_conf,
+                                  NULL, "injectHandler NAME INTONAME");
+    snmp_register_callback(SNMP_CALLBACK_LIBRARY,
+                           SNMP_CALLBACK_POST_READ_CONFIG,
+                           handler_mark_doneit, NULL);
+
+    se_add_pair_to_slist("agent_mode", strdup("GET"), MODE_GET);
+    se_add_pair_to_slist("agent_mode", strdup("GETNEXT"), MODE_GETNEXT);
+    se_add_pair_to_slist("agent_mode", strdup("GETBULK"), MODE_GETBULK);
+    se_add_pair_to_slist("agent_mode", strdup("SET_BEGIN"),
+                         MODE_SET_BEGIN);
+    se_add_pair_to_slist("agent_mode", strdup("SET_RESERVE1"),
+                         MODE_SET_RESERVE1);
+    se_add_pair_to_slist("agent_mode", strdup("SET_RESERVE2"),
+                         MODE_SET_RESERVE2);
+    se_add_pair_to_slist("agent_mode", strdup("SET_ACTION"),
+                         MODE_SET_ACTION);
+    se_add_pair_to_slist("agent_mode", strdup("SET_COMMIT"),
+                         MODE_SET_COMMIT);
+    se_add_pair_to_slist("agent_mode", strdup("SET_FREE"), MODE_SET_FREE);
+    se_add_pair_to_slist("agent_mode", strdup("SET_UNDO"), MODE_SET_UNDO);
+
+    se_add_pair_to_slist("handler_can_mode", strdup("GET/GETNEXT"),
+                         HANDLER_CAN_GETANDGETNEXT);
+    se_add_pair_to_slist("handler_can_mode", strdup("SET"),
+                         HANDLER_CAN_SET);
+    se_add_pair_to_slist("handler_can_mode", strdup("GETBULK"),
+                         HANDLER_CAN_GETBULK);
+}
+
+/** @} */
diff -Naur tomato/release/src/router/snmp/agent/agent_index.c tomato121/release/src/router/snmp/agent/agent_index.c
--- tomato/release/src/router/snmp/agent/agent_index.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/agent_index.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,864 @@
+/*
+ * agent_index.c
+ *
+ * Maintain a registry of index allocations
+ *      (Primarily required for AgentX support,
+ *       but it could be more widely useable).
+ */
+
+
+#include <net-snmp/net-snmp-config.h>
+#include <signal.h>
+#if HAVE_STRING_H
+#include <string.h>
+#endif
+#if HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#include <sys/types.h>
+#include <stdio.h>
+#include <fcntl.h>
+#if HAVE_WINSOCK_H
+#include <winsock.h>
+#endif
+#if TIME_WITH_SYS_TIME
+# ifdef WIN32
+#  include <sys/timeb.h>
+# else
+#  include <sys/time.h>
+# endif
+# include <time.h>
+#else
+# if HAVE_SYS_TIME_H
+#  include <sys/time.h>
+# else
+#  include <time.h>
+# endif
+#endif
+#if HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+
+#if HAVE_DMALLOC_H
+#include <dmalloc.h>
+#endif
+
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include <net-snmp/agent/agent_callbacks.h>
+#include <net-snmp/agent/agent_index.h>
+
+#include "snmpd.h"
+#include "mibgroup/struct.h"
+#include <net-snmp/agent/table.h>
+#include <net-snmp/agent/table_iterator.h>
+#include "mib_module_includes.h"
+
+#ifdef USING_AGENTX_SUBAGENT_MODULE
+#include "agentx/subagent.h"
+#include "agentx/client.h"
+#endif
+
+        /*
+         * Initial support for index allocation
+         */
+
+struct snmp_index {
+    netsnmp_variable_list *varbind;     /* or pointer to var_list ? */
+    int             allocated;
+    netsnmp_session *session;
+    struct snmp_index *next_oid;
+    struct snmp_index *prev_oid;
+    struct snmp_index *next_idx;
+}              *snmp_index_head = NULL;
+
+extern netsnmp_session *main_session;
+
+/*
+ * The caller is responsible for free()ing the memory returned by
+ * this function.  
+ */
+
+char           *
+register_string_index(oid * name, size_t name_len, char *cp)
+{
+    netsnmp_variable_list varbind, *res;
+
+    memset(&varbind, 0, sizeof(netsnmp_variable_list));
+    varbind.type = ASN_OCTET_STR;
+    snmp_set_var_objid(&varbind, name, name_len);
+    if (cp != ANY_STRING_INDEX) {
+        snmp_set_var_value(&varbind, (u_char *) cp, strlen(cp));
+        res = register_index(&varbind, ALLOCATE_THIS_INDEX, main_session);
+    } else {
+        res = register_index(&varbind, ALLOCATE_ANY_INDEX, main_session);
+    }
+
+    if (res == NULL) {
+        return NULL;
+    } else {
+        char           *rv = strdup(res->val.string);
+        free(res);
+        return rv;
+    }
+}
+
+int
+register_int_index(oid * name, size_t name_len, int val)
+{
+    netsnmp_variable_list varbind, *res;
+
+    memset(&varbind, 0, sizeof(netsnmp_variable_list));
+    varbind.type = ASN_INTEGER;
+    snmp_set_var_objid(&varbind, name, name_len);
+    varbind.val.string = varbind.buf;
+    if (val != ANY_INTEGER_INDEX) {
+        varbind.val_len = sizeof(long);
+        *varbind.val.integer = val;
+        res = register_index(&varbind, ALLOCATE_THIS_INDEX, main_session);
+    } else {
+        res = register_index(&varbind, ALLOCATE_ANY_INDEX, main_session);
+    }
+
+    if (res == NULL) {
+        return -1;
+    } else {
+        int             rv = *(res->val.integer);
+        free(res);
+        return rv;
+    }
+}
+
+/*
+ * The caller is responsible for free()ing the memory returned by
+ * this function.  
+ */
+
+netsnmp_variable_list *
+register_oid_index(oid * name, size_t name_len,
+                   oid * value, size_t value_len)
+{
+    netsnmp_variable_list varbind;
+
+    memset(&varbind, 0, sizeof(netsnmp_variable_list));
+    varbind.type = ASN_OBJECT_ID;
+    snmp_set_var_objid(&varbind, name, name_len);
+    if (value != ANY_OID_INDEX) {
+        snmp_set_var_value(&varbind, (u_char *) value,
+                           value_len * sizeof(oid));
+        return register_index(&varbind, ALLOCATE_THIS_INDEX, main_session);
+    } else {
+        return register_index(&varbind, ALLOCATE_ANY_INDEX, main_session);
+    }
+}
+
+/*
+ * The caller is responsible for free()ing the memory returned by
+ * this function.  
+ */
+
+netsnmp_variable_list *
+register_index(netsnmp_variable_list * varbind, int flags,
+               netsnmp_session * ss)
+{
+    netsnmp_variable_list *rv = NULL;
+    struct snmp_index *new_index, *idxptr, *idxptr2;
+    struct snmp_index *prev_oid_ptr, *prev_idx_ptr;
+    int             res, res2, i;
+
+    DEBUGMSGTL(("register_index", "register "));
+    DEBUGMSGVAR(("register_index", varbind));
+    DEBUGMSG(("register_index", "for session %08p\n", ss));
+
+#if defined(USING_AGENTX_SUBAGENT_MODULE) && !defined(TESTING)
+    if (netsnmp_ds_get_boolean(NETSNMP_DS_APPLICATION_ID, 
+			       NETSNMP_DS_AGENT_ROLE) == SUB_AGENT) {
+        return (agentx_register_index(ss, varbind, flags));
+    }
+#endif
+    /*
+     * Look for the requested OID entry 
+     */
+    prev_oid_ptr = NULL;
+    prev_idx_ptr = NULL;
+    res = 1;
+    res2 = 1;
+    for (idxptr = snmp_index_head; idxptr != NULL;
+         prev_oid_ptr = idxptr, idxptr = idxptr->next_oid) {
+        if ((res = snmp_oid_compare(varbind->name, varbind->name_length,
+                                    idxptr->varbind->name,
+                                    idxptr->varbind->name_length)) <= 0)
+            break;
+    }
+
+    /*
+     * Found the OID - now look at the registered indices 
+     */
+    if (res == 0 && idxptr) {
+        if (varbind->type != idxptr->varbind->type)
+            return NULL;        /* wrong type */
+
+        /*
+         * If we've been asked for an arbitrary new value,
+         *      then find the end of the list.
+         * If we've been asked for any arbitrary value,
+         *      then look for an unused entry, and use that.
+         *      If there aren't any, continue as for new.
+         * Otherwise, locate the given value in the (sorted)
+         *      list of already allocated values
+         */
+        if (flags & ALLOCATE_ANY_INDEX) {
+            for (idxptr2 = idxptr; idxptr2 != NULL;
+                 prev_idx_ptr = idxptr2, idxptr2 = idxptr2->next_idx) {
+
+                if (flags == ALLOCATE_ANY_INDEX && !(idxptr2->allocated)) {
+                    if ((rv =
+                         snmp_clone_varbind(idxptr2->varbind)) != NULL) {
+                        idxptr2->session = ss;
+                        idxptr2->allocated = 1;
+                    }
+                    return rv;
+                }
+            }
+        } else {
+            for (idxptr2 = idxptr; idxptr2 != NULL;
+                 prev_idx_ptr = idxptr2, idxptr2 = idxptr2->next_idx) {
+                switch (varbind->type) {
+                case ASN_INTEGER:
+                    res2 =
+                        (*varbind->val.integer -
+                         *idxptr2->varbind->val.integer);
+                    break;
+                case ASN_OCTET_STR:
+                    i = SNMP_MIN(varbind->val_len,
+                                 idxptr2->varbind->val_len);
+                    res2 =
+                        memcmp(varbind->val.string,
+                               idxptr2->varbind->val.string, i);
+                    break;
+                case ASN_OBJECT_ID:
+                    res2 =
+                        snmp_oid_compare(varbind->val.objid,
+                                         varbind->val_len / sizeof(oid),
+                                         idxptr2->varbind->val.objid,
+                                         idxptr2->varbind->val_len /
+                                         sizeof(oid));
+                    break;
+                default:
+                    return NULL;        /* wrong type */
+                }
+                if (res2 <= 0)
+                    break;
+            }
+            if (res2 == 0) {
+                if (idxptr2->allocated) {
+                    /*
+                     * No good: the index is in use.  
+                     */
+                    return NULL;
+                } else {
+                    /*
+                     * Okay, it's unallocated, we can just claim ownership
+                     * here.  
+                     */
+                    if ((rv =
+                         snmp_clone_varbind(idxptr2->varbind)) != NULL) {
+                        idxptr2->session = ss;
+                        idxptr2->allocated = 1;
+                    }
+                    return rv;
+                }
+            }
+        }
+    }
+
+    /*
+     * OK - we've now located where the new entry needs to
+     *      be fitted into the index registry tree          
+     * To recap:
+     *      'prev_oid_ptr' points to the head of the OID index
+     *          list prior to this one.  If this is null, then
+     *          it means that this is the first OID in the list.
+     *      'idxptr' points either to the head of this OID list,
+     *          or the next OID (if this is a new OID request)
+     *          These can be distinguished by the value of 'res'.
+     *
+     *      'prev_idx_ptr' points to the index entry that sorts
+     *          immediately prior to the requested value (if any).
+     *          If an arbitrary value is required, then this will
+     *          point to the last allocated index.
+     *          If this pointer is null, then either this is a new
+     *          OID request, or the requested value is the first
+     *          in the list.
+     *      'idxptr2' points to the next sorted index (if any)
+     *          but is not actually needed any more.
+     *
+     *  Clear?  Good!
+     *      I hope you've been paying attention.
+     *          There'll be a test later :-)
+     */
+
+    /*
+     *      We proceed by creating the new entry
+     *         (by copying the entry provided)
+     */
+    new_index = (struct snmp_index *) calloc(1, sizeof(struct snmp_index));
+    if (new_index == NULL)
+        return NULL;
+
+    if (0 == snmp_varlist_add_variable(&new_index->varbind,
+                                       varbind->name,
+                                       varbind->name_length,
+                                       varbind->type,
+                                       varbind->val.string,
+                                       varbind->val_len)) {
+        /*
+         * if (snmp_clone_var( varbind, new_index->varbind ) != 0 ) 
+         */
+        free(new_index);
+        return NULL;
+    }
+    new_index->session = ss;
+    new_index->allocated = 1;
+
+    if (varbind->type == ASN_OCTET_STR && flags == ALLOCATE_THIS_INDEX)
+        new_index->varbind->val.string[new_index->varbind->val_len] = 0;
+
+    /*
+     * If we've been given a value, then we can use that, but
+     *    otherwise, we need to create a new value for this entry.
+     * Note that ANY_INDEX and NEW_INDEX are both covered by this
+     *   test (since NEW_INDEX & ANY_INDEX = ANY_INDEX, remember?)
+     */
+    if (flags & ALLOCATE_ANY_INDEX) {
+        if (prev_idx_ptr) {
+            if (snmp_clone_var(prev_idx_ptr->varbind, new_index->varbind)
+                != 0) {
+                free(new_index);
+                return NULL;
+            }
+        } else
+            new_index->varbind->val.string = new_index->varbind->buf;
+
+        switch (varbind->type) {
+        case ASN_INTEGER:
+            if (prev_idx_ptr) {
+                (*new_index->varbind->val.integer)++;
+            } else
+                *(new_index->varbind->val.integer) = 1;
+            new_index->varbind->val_len = sizeof(long);
+            break;
+        case ASN_OCTET_STR:
+            if (prev_idx_ptr) {
+                i = new_index->varbind->val_len - 1;
+                while (new_index->varbind->buf[i] == 'z') {
+                    new_index->varbind->buf[i] = 'a';
+                    i--;
+                    if (i < 0) {
+                        i = new_index->varbind->val_len;
+                        new_index->varbind->buf[i] = 'a';
+                        new_index->varbind->buf[i + 1] = 0;
+                    }
+                }
+                new_index->varbind->buf[i]++;
+            } else
+                strcpy((char *) new_index->varbind->buf, "aaaa");
+            new_index->varbind->val_len =
+                strlen((char *) new_index->varbind->buf);
+            break;
+        case ASN_OBJECT_ID:
+            if (prev_idx_ptr) {
+                i = prev_idx_ptr->varbind->val_len / sizeof(oid) - 1;
+                while (new_index->varbind->val.objid[i] == 255) {
+                    new_index->varbind->val.objid[i] = 1;
+                    i--;
+                    if (i == 0 && new_index->varbind->val.objid[0] == 2) {
+                        new_index->varbind->val.objid[0] = 1;
+                        i = new_index->varbind->val_len / sizeof(oid);
+                        new_index->varbind->val.objid[i] = 0;
+                        new_index->varbind->val_len += sizeof(oid);
+                    }
+                }
+                new_index->varbind->val.objid[i]++;
+            } else {
+                /*
+                 * If the requested OID name is small enough,
+                 * *   append another OID (1) and use this as the
+                 * *   default starting value for new indexes.
+                 */
+                if ((varbind->name_length + 1) * sizeof(oid) <= 40) {
+                    for (i = 0; i < (int) varbind->name_length; i++)
+                        new_index->varbind->val.objid[i] =
+                            varbind->name[i];
+                    new_index->varbind->val.objid[varbind->name_length] =
+                        1;
+                    new_index->varbind->val_len =
+                        (varbind->name_length + 1) * sizeof(oid);
+                } else {
+                    /*
+                     * Otherwise use '.1.1.1.1...' 
+                     */
+                    i = 40 / sizeof(oid);
+                    if (i > 4)
+                        i = 4;
+                    new_index->varbind->val_len = i * (sizeof(oid));
+                    for (i--; i >= 0; i--)
+                        new_index->varbind->val.objid[i] = 1;
+                }
+            }
+            break;
+        default:
+            snmp_free_var(new_index->varbind);
+            free(new_index);
+            return NULL;        /* Index type not supported */
+        }
+    }
+
+    /*
+     * Try to duplicate the new varbind for return.  
+     */
+
+    if ((rv = snmp_clone_varbind(new_index->varbind)) == NULL) {
+        snmp_free_var(new_index->varbind);
+        free(new_index);
+        return NULL;
+    }
+
+    /*
+     * Right - we've set up the new entry.
+     * All that remains is to link it into the tree.
+     * There are a number of possible cases here,
+     *   so watch carefully.
+     */
+    if (prev_idx_ptr) {
+        new_index->next_idx = prev_idx_ptr->next_idx;
+        new_index->next_oid = prev_idx_ptr->next_oid;
+        prev_idx_ptr->next_idx = new_index;
+    } else {
+        if (res == 0 && idxptr) {
+            new_index->next_idx = idxptr;
+            new_index->next_oid = idxptr->next_oid;
+        } else {
+            new_index->next_idx = NULL;
+            new_index->next_oid = idxptr;
+        }
+
+        if (prev_oid_ptr) {
+            while (prev_oid_ptr) {
+                prev_oid_ptr->next_oid = new_index;
+                prev_oid_ptr = prev_oid_ptr->next_idx;
+            }
+        } else
+            snmp_index_head = new_index;
+    }
+    return rv;
+}
+
+        /*
+         * Release an allocated index,
+         *   to allow it to be used elsewhere
+         */
+int
+release_index(netsnmp_variable_list * varbind)
+{
+    return (unregister_index(varbind, TRUE, NULL));
+}
+
+        /*
+         * Completely remove an allocated index,
+         *   due to errors in the registration process.
+         */
+int
+remove_index(netsnmp_variable_list * varbind, netsnmp_session * ss)
+{
+    return (unregister_index(varbind, FALSE, ss));
+}
+
+void
+unregister_index_by_session(netsnmp_session * ss)
+{
+    struct snmp_index *idxptr, *idxptr2;
+    for (idxptr = snmp_index_head; idxptr != NULL;
+         idxptr = idxptr->next_oid)
+        for (idxptr2 = idxptr; idxptr2 != NULL;
+             idxptr2 = idxptr2->next_idx)
+            if (idxptr2->session == ss) {
+                idxptr2->allocated = 0;
+                idxptr2->session = NULL;
+            }
+}
+
+
+int
+unregister_index(netsnmp_variable_list * varbind, int remember,
+                 netsnmp_session * ss)
+{
+    struct snmp_index *idxptr, *idxptr2;
+    struct snmp_index *prev_oid_ptr, *prev_idx_ptr;
+    int             res, res2, i;
+
+#if defined(USING_AGENTX_SUBAGENT_MODULE) && !defined(TESTING)
+    if (netsnmp_ds_get_boolean(NETSNMP_DS_APPLICATION_ID, 
+			       NETSNMP_DS_AGENT_ROLE) == SUB_AGENT) {
+        return (agentx_unregister_index(ss, varbind));
+    }
+#endif
+    /*
+     * Look for the requested OID entry 
+     */
+    prev_oid_ptr = NULL;
+    prev_idx_ptr = NULL;
+    res = 1;
+    res2 = 1;
+    for (idxptr = snmp_index_head; idxptr != NULL;
+         prev_oid_ptr = idxptr, idxptr = idxptr->next_oid) {
+        if ((res = snmp_oid_compare(varbind->name, varbind->name_length,
+                                    idxptr->varbind->name,
+                                    idxptr->varbind->name_length)) <= 0)
+            break;
+    }
+
+    if (res != 0)
+        return INDEX_ERR_NOT_ALLOCATED;
+    if (varbind->type != idxptr->varbind->type)
+        return INDEX_ERR_WRONG_TYPE;
+
+    for (idxptr2 = idxptr; idxptr2 != NULL;
+         prev_idx_ptr = idxptr2, idxptr2 = idxptr2->next_idx) {
+        i = SNMP_MIN(varbind->val_len, idxptr2->varbind->val_len);
+        res2 =
+            memcmp(varbind->val.string, idxptr2->varbind->val.string, i);
+        if (res2 <= 0)
+            break;
+    }
+    if (res2 != 0 || (res2 == 0 && !idxptr2->allocated)) {
+        return INDEX_ERR_NOT_ALLOCATED;
+    }
+    if (ss != idxptr2->session)
+        return INDEX_ERR_WRONG_SESSION;
+
+    /*
+     *  If this is a "normal" index unregistration,
+     *      mark the index entry as unused, but leave
+     *      it in situ.  This allows differentiation
+     *      between ANY_INDEX and NEW_INDEX
+     */
+    if (remember) {
+        idxptr2->allocated = 0; /* Unused index */
+        idxptr2->session = NULL;
+        return SNMP_ERR_NOERROR;
+    }
+    /*
+     *  If this is a failed attempt to register a
+     *      number of indexes, the successful ones
+     *      must be removed completely.
+     */
+    if (prev_idx_ptr) {
+        prev_idx_ptr->next_idx = idxptr2->next_idx;
+    } else if (prev_oid_ptr) {
+        if (idxptr2->next_idx)  /* Use p_idx_ptr as a temp variable */
+            prev_idx_ptr = idxptr2->next_idx;
+        else
+            prev_idx_ptr = idxptr2->next_oid;
+        while (prev_oid_ptr) {
+            prev_oid_ptr->next_oid = prev_idx_ptr;
+            prev_oid_ptr = prev_oid_ptr->next_idx;
+        }
+    } else {
+        if (idxptr2->next_idx)
+            snmp_index_head = idxptr2->next_idx;
+        else
+            snmp_index_head = idxptr2->next_oid;
+    }
+    snmp_free_var(idxptr2->varbind);
+    free(idxptr2);
+    return SNMP_ERR_NOERROR;
+}
+
+int
+unregister_string_index(oid * name, size_t name_len, char *cp)
+{
+    netsnmp_variable_list varbind;
+
+    memset(&varbind, 0, sizeof(netsnmp_variable_list));
+    varbind.type = ASN_OCTET_STR;
+    snmp_set_var_objid(&varbind, name, name_len);
+    snmp_set_var_value(&varbind, (u_char *) cp, strlen(cp));
+    return (unregister_index(&varbind, FALSE, main_session));
+}
+
+int
+unregister_int_index(oid * name, size_t name_len, int val)
+{
+    netsnmp_variable_list varbind;
+
+    memset(&varbind, 0, sizeof(netsnmp_variable_list));
+    varbind.type = ASN_INTEGER;
+    snmp_set_var_objid(&varbind, name, name_len);
+    varbind.val.string = varbind.buf;
+    varbind.val_len = sizeof(long);
+    *varbind.val.integer = val;
+    return (unregister_index(&varbind, FALSE, main_session));
+}
+
+int
+unregister_oid_index(oid * name, size_t name_len,
+                     oid * value, size_t value_len)
+{
+    netsnmp_variable_list varbind;
+
+    memset(&varbind, 0, sizeof(netsnmp_variable_list));
+    varbind.type = ASN_OBJECT_ID;
+    snmp_set_var_objid(&varbind, name, name_len);
+    snmp_set_var_value(&varbind, (u_char *) value,
+                       value_len * sizeof(oid));
+    return (unregister_index(&varbind, FALSE, main_session));
+}
+
+void
+dump_idx_registry(void)
+{
+    struct snmp_index *idxptr, *idxptr2;
+    u_char         *sbuf = NULL, *ebuf = NULL;
+    size_t          sbuf_len = 0, sout_len = 0, ebuf_len = 0, eout_len = 0;
+
+    if (snmp_index_head != NULL) {
+        printf("\nIndex Allocations:\n");
+    }
+
+    for (idxptr = snmp_index_head; idxptr != NULL;
+         idxptr = idxptr->next_oid) {
+        sout_len = 0;
+        if (sprint_realloc_objid(&sbuf, &sbuf_len, &sout_len, 1,
+                                 idxptr->varbind->name,
+                                 idxptr->varbind->name_length)) {
+            printf("%s indexes:\n", sbuf);
+        } else {
+            printf("%s [TRUNCATED] indexes:\n", sbuf);
+        }
+
+        for (idxptr2 = idxptr; idxptr2 != NULL;
+             idxptr2 = idxptr2->next_idx) {
+            switch (idxptr2->varbind->type) {
+            case ASN_INTEGER:
+                printf("    %ld for session %8p, allocated %d\n",
+                       *idxptr2->varbind->val.integer, idxptr2->session,
+                       idxptr2->allocated);
+                break;
+            case ASN_OCTET_STR:
+                printf("    \"%s\" for session %8p, allocated %d\n",
+                       idxptr2->varbind->val.string, idxptr2->session,
+                       idxptr2->allocated);
+                break;
+            case ASN_OBJECT_ID:
+                eout_len = 0;
+                if (sprint_realloc_objid(&ebuf, &ebuf_len, &eout_len, 1,
+                                         idxptr2->varbind->val.objid,
+                                         idxptr2->varbind->val_len /
+                                         sizeof(oid))) {
+                    printf("    %s for session %8p, allocated %d\n", ebuf,
+                           idxptr2->session, idxptr2->allocated);
+                } else {
+                    printf
+                        ("    %s [TRUNCATED] for sess %8p, allocated %d\n",
+                         ebuf, idxptr2->session, idxptr2->allocated);
+                }
+                break;
+            default:
+                printf("unsupported type (%d/0x%02x)\n",
+                       idxptr2->varbind->type, idxptr2->varbind->type);
+            }
+        }
+    }
+
+    if (sbuf != NULL) {
+        free(sbuf);
+    }
+    if (ebuf != NULL) {
+        free(ebuf);
+    }
+}
+
+unsigned long
+count_indexes(oid * name, size_t namelen, int include_unallocated)
+{
+    struct snmp_index *i = NULL, *j = NULL;
+    unsigned long   n = 0;
+
+    for (i = snmp_index_head; i != NULL; i = i->next_oid) {
+        if (netsnmp_oid_equals(name, namelen,
+                             i->varbind->name,
+                             i->varbind->name_length) == 0) {
+            for (j = i; j != NULL; j = j->next_idx) {
+                if (j->allocated || include_unallocated) {
+                    n++;
+                }
+            }
+        }
+    }
+    return n;
+}
+
+
+#ifdef TESTING
+netsnmp_variable_list varbind;
+netsnmp_session main_sess, *main_session = &main_sess;
+
+void
+test_string_register(int n, char *cp)
+{
+    varbind->name[4] = n;
+    if (register_string_index(varbind->name, varbind.name_length, cp) ==
+        NULL)
+        printf("allocating %s failed\n", cp);
+}
+
+void
+test_int_register(int n, int val)
+{
+    varbind->name[4] = n;
+    if (register_int_index(varbind->name, varbind.name_length, val) == -1)
+        printf("allocating %d/%d failed\n", n, val);
+}
+
+void
+test_oid_register(int n, int subid)
+{
+    netsnmp_variable_list *res;
+
+    varbind->name[4] = n;
+    if (subid != -1) {
+        varbind->val.objid[5] = subid;
+        res = register_oid_index(varbind->name, varbind.name_length,
+                                 varbind->val.objid,
+                                 varbind->val_len / sizeof(oid));
+    } else
+        res =
+            register_oid_index(varbind->name, varbind.name_length, NULL,
+                               0);
+
+    if (res == NULL)
+        printf("allocating %d/%d failed\n", n, subid);
+}
+
+void
+main(int argc, char argv[])
+{
+    oid             name[] = { 1, 2, 3, 4, 0 };
+    int             i;
+
+    memset(&varbind, 0, sizeof(netsnmp_variable_list));
+    snmp_set_var_objid(&varbind, name, 5);
+    varbind->type = ASN_OCTET_STR;
+    /*
+     * Test index structure linking:
+     *      a) sorted by OID
+     */
+    test_string_register(20, "empty OID");
+    test_string_register(10, "first OID");
+    test_string_register(40, "last OID");
+    test_string_register(30, "middle OID");
+
+    /*
+     *      b) sorted by index value
+     */
+    test_string_register(25, "eee: empty IDX");
+    test_string_register(25, "aaa: first IDX");
+    test_string_register(25, "zzz: last IDX");
+    test_string_register(25, "mmm: middle IDX");
+    printf("This next one should fail....\n");
+    test_string_register(25, "eee: empty IDX"); /* duplicate */
+    printf("done\n");
+
+    /*
+     *      c) test initial index linking
+     */
+    test_string_register(5, "eee: empty initial IDX");
+    test_string_register(5, "aaa: replace initial IDX");
+
+    /*
+     *      Did it all work?
+     */
+    dump_idx_registry();
+    unregister_index_by_session(main_session);
+    /*
+     *  Now test index allocation
+     *      a) integer values
+     */
+    test_int_register(110, -1); /* empty */
+    test_int_register(110, -1); /* append */
+    test_int_register(110, 10); /* append exact */
+    printf("This next one should fail....\n");
+    test_int_register(110, 10); /* exact duplicate */
+    printf("done\n");
+    test_int_register(110, -1); /* append */
+    test_int_register(110, 5);  /* insert exact */
+
+    /*
+     *      b) string values
+     */
+    test_string_register(120, NULL);    /* empty */
+    test_string_register(120, NULL);    /* append */
+    test_string_register(120, "aaaz");
+    test_string_register(120, NULL);    /* minor rollover */
+    test_string_register(120, "zzzz");
+    test_string_register(120, NULL);    /* major rollover */
+
+    /*
+     *      c) OID values
+     */
+
+    test_oid_register(130, -1); /* empty */
+    test_oid_register(130, -1); /* append */
+
+    varbind->val_len = varbind.name_length * sizeof(oid);
+    memcpy(varbind->buf, varbind.name, varbind.val_len);
+    varbind->val.objid = (oid *) varbind.buf;
+    varbind->val_len += sizeof(oid);
+
+    test_oid_register(130, 255);        /* append exact */
+    test_oid_register(130, -1); /* minor rollover */
+    test_oid_register(130, 100);        /* insert exact */
+    printf("This next one should fail....\n");
+    test_oid_register(130, 100);        /* exact duplicate */
+    printf("done\n");
+
+    varbind->val.objid = (oid *) varbind.buf;
+    for (i = 0; i < 6; i++)
+        varbind->val.objid[i] = 255;
+    varbind->val.objid[0] = 1;
+    test_oid_register(130, 255);        /* set up rollover  */
+    test_oid_register(130, -1); /* medium rollover */
+
+    for (i = 0; i < 6; i++)
+        varbind->val.objid[i] = 255;
+    varbind->val.objid[0] = 2;
+    test_oid_register(130, 255);        /* set up rollover  */
+    test_oid_register(130, -1); /* major rollover */
+
+    /*
+     *      Did it all work?
+     */
+    dump_idx_registry();
+
+    /*
+     *      Test the various "invalid" requests
+     *      (unsupported types, mis-matched types, etc)
+     */
+    printf("The rest of these should fail....\n");
+    test_oid_register(110, -1);
+    test_oid_register(110, 100);
+    test_oid_register(120, -1);
+    test_oid_register(120, 100);
+    test_string_register(110, NULL);
+    test_string_register(110, "aaaa");
+    test_string_register(130, NULL);
+    test_string_register(130, "aaaa");
+    test_int_register(120, -1);
+    test_int_register(120, 1);
+    test_int_register(130, -1);
+    test_int_register(130, 1);
+    printf("done - this dump should be the same as before\n");
+    dump_idx_registry();
+}
+#endif
diff -Naur tomato/release/src/router/snmp/agent/agent_read_config.c tomato121/release/src/router/snmp/agent/agent_read_config.c
--- tomato/release/src/router/snmp/agent/agent_read_config.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/agent_read_config.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,297 @@
+/*
+ * agent_read_config.c
+ */
+
+#include <net-snmp/net-snmp-config.h>
+
+#include <sys/types.h>
+#if HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#if HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+#include <stdio.h>
+#include <ctype.h>
+#include <errno.h>
+
+#if TIME_WITH_SYS_TIME
+# ifdef WIN32
+#  include <sys/timeb.h>
+# else
+#  include <sys/time.h>
+# endif
+# include <time.h>
+#else
+# if HAVE_SYS_TIME_H
+#  include <sys/time.h>
+# else
+#  include <time.h>
+# endif
+#endif
+#if HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+#if HAVE_NETINET_IN_SYSTM_H
+#include <netinet/in_systm.h>
+#endif
+#if HAVE_NETINET_IP_H
+#include <netinet/ip.h>
+#endif
+#ifdef INET6
+#if HAVE_NETINET_IP6_H
+#include <netinet/ip6.h>
+#endif
+#endif
+#if HAVE_SYS_QUEUE_H
+#include <sys/queue.h>
+#endif
+#if HAVE_SYS_SOCKET_H
+#include <sys/socket.h>
+#if HAVE_SYS_SOCKETVAR_H
+#ifndef dynix
+#include <sys/socketvar.h>
+#else
+#include <sys/param.h>
+#endif
+#endif
+#elif HAVE_WINSOCK_H
+#include <winsock.h>
+#endif
+#if HAVE_SYS_STREAM_H
+#include <sys/stream.h>
+#endif
+#if HAVE_NET_ROUTE_H
+#include <net/route.h>
+#endif
+#if HAVE_NETINET_IP_VAR_H
+#include <netinet/ip_var.h>
+#endif
+#ifdef INET6
+#if HAVE_NETINET6_IP6_VAR_H
+#include <netinet6/ip6_var.h>
+#endif
+#endif
+#if HAVE_NETINET_IN_PCB_H
+#include <netinet/in_pcb.h>
+#endif
+#if HAVE_INET_MIB2_H
+#include <inet/mib2.h>
+#endif
+
+#if HAVE_DMALLOC_H
+#include <dmalloc.h>
+#endif
+
+#if HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#ifdef HAVE_PWD_H
+#include <pwd.h>
+#endif
+#ifdef HAVE_GRP_H
+#include <grp.h>
+#endif
+
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+#include "mibgroup/struct.h"
+#include <net-snmp/agent/agent_trap.h>
+#include "snmpd.h"
+#include <net-snmp/agent/agent_callbacks.h>
+#include <net-snmp/agent/table.h>
+#include <net-snmp/agent/table_iterator.h>
+#include <net-snmp/agent/table_data.h>
+#include <net-snmp/agent/table_dataset.h>
+#include "mib_module_includes.h"
+
+char            dontReadConfigFiles;
+char           *optconfigfile;
+
+#ifdef HAVE_UNISTD_H
+void
+snmpd_set_agent_user(const char *token, char *cptr)
+{
+#if defined(HAVE_GETPWNAM) && defined(HAVE_PWD_H)
+    struct passwd  *info;
+#endif
+
+    if (cptr[0] == '#') {
+        char           *ecp;
+        int             uid;
+        uid = strtoul(cptr + 1, &ecp, 10);
+        if (*ecp != 0) {
+            config_perror("Bad number");
+	} else {
+	    netsnmp_ds_set_int(NETSNMP_DS_APPLICATION_ID, 
+			       NETSNMP_DS_AGENT_USERID, uid);
+	}
+    }
+#if defined(HAVE_GETPWNAM) && defined(HAVE_PWD_H)
+    else if ((info = getpwnam(cptr)) != NULL) {
+        netsnmp_ds_set_int(NETSNMP_DS_APPLICATION_ID, 
+			   NETSNMP_DS_AGENT_USERID, info->pw_uid);
+    } else {
+        config_perror("User not found in passwd database");
+    }
+#endif
+}
+
+void
+snmpd_set_agent_group(const char *token, char *cptr)
+{
+#if defined(HAVE_GETGRNAM) && defined(HAVE_GRP_H)
+    struct group   *info;
+#endif
+
+    if (cptr[0] == '#') {
+        char           *ecp;
+        int             gid = strtoul(cptr + 1, &ecp, 10);
+        if (*ecp != 0) {
+            config_perror("Bad number");
+	} else {
+            netsnmp_ds_set_int(NETSNMP_DS_APPLICATION_ID, 
+			       NETSNMP_DS_AGENT_GROUPID, gid);
+	}
+    }
+#if defined(HAVE_GETGRNAM) && defined(HAVE_GRP_H)
+    else if ((info = getgrnam(cptr)) != NULL) {
+        netsnmp_ds_set_int(NETSNMP_DS_APPLICATION_ID, 
+			   NETSNMP_DS_AGENT_GROUPID, info->gr_gid);
+    } else {
+        config_perror("Group not found in group database");
+    }
+#endif
+}
+#endif
+
+void
+snmpd_set_agent_address(const char *token, char *cptr)
+{
+    char            buf[SPRINT_MAX_LEN];
+    char           *ptr;
+
+    /*
+     * has something been specified before? 
+     */
+    ptr = netsnmp_ds_get_string(NETSNMP_DS_APPLICATION_ID, 
+				NETSNMP_DS_AGENT_PORTS);
+
+    if (ptr) {
+        /*
+         * append to the older specification string 
+         */
+        sprintf(buf, "%s,%s", ptr, cptr);
+    } else {
+        strcpy(buf, cptr);
+    }
+
+    DEBUGMSGTL(("snmpd_ports", "port spec: %s\n", buf));
+    netsnmp_ds_set_string(NETSNMP_DS_APPLICATION_ID, 
+			  NETSNMP_DS_AGENT_PORTS, buf);
+}
+
+void
+init_agent_read_config(const char *app)
+{
+    if (app != NULL) {
+        netsnmp_ds_set_string(NETSNMP_DS_LIBRARY_ID, 
+			      NETSNMP_DS_LIB_APPTYPE, app);
+    } else {
+        app = netsnmp_ds_get_string(NETSNMP_DS_LIBRARY_ID, 
+				    NETSNMP_DS_LIB_APPTYPE);
+    }
+
+    register_app_config_handler("authtrapenable",
+                                snmpd_parse_config_authtrap, NULL,
+                                "1 | 2\t\t(1 = enable, 2 = disable)");
+    register_app_config_handler("pauthtrapenable",
+                                snmpd_parse_config_authtrap, NULL, NULL);
+
+
+    if (netsnmp_ds_get_boolean(NETSNMP_DS_APPLICATION_ID, 
+			       NETSNMP_DS_AGENT_ROLE) == MASTER_AGENT) {
+        register_app_config_handler("trapsink",
+                                    snmpd_parse_config_trapsink,
+                                    snmpd_free_trapsinks,
+                                    "host [community] [port]");
+        register_app_config_handler("trap2sink",
+                                    snmpd_parse_config_trap2sink, NULL,
+                                    "host [community] [port]");
+        register_app_config_handler("informsink",
+                                    snmpd_parse_config_informsink, NULL,
+                                    "host [community] [port]");
+        register_app_config_handler("trapsess",
+                                    snmpd_parse_config_trapsess, NULL,
+                                    "[snmpcmdargs] host");
+    }
+    register_app_config_handler("trapcommunity",
+                                snmpd_parse_config_trapcommunity,
+                                snmpd_free_trapcommunity,
+                                "community-string");
+#ifdef HAVE_UNISTD_H
+    register_app_config_handler("agentuser",
+                                snmpd_set_agent_user, NULL, "userid");
+    register_app_config_handler("agentgroup",
+                                snmpd_set_agent_group, NULL, "groupid");
+#endif
+    register_app_config_handler("agentaddress",
+                                snmpd_set_agent_address, NULL,
+                                "SNMP bind address");
+    register_app_config_handler("table",
+                                netsnmp_config_parse_table_set, NULL,
+                                "tableoid");
+    register_app_config_handler("add_row", netsnmp_config_parse_add_row,
+                                NULL, "indexes... values...");
+    netsnmp_ds_register_config(ASN_BOOLEAN, app, "quit", 
+			       NETSNMP_DS_APPLICATION_ID,
+			       NETSNMP_DS_AGENT_QUIT_IMMEDIATELY);
+    netsnmp_ds_register_config(ASN_BOOLEAN, app, "leave_pidfile", 
+			       NETSNMP_DS_APPLICATION_ID,
+			       NETSNMP_DS_AGENT_LEAVE_PIDFILE);
+    netsnmp_init_handler_conf();
+
+#include "mib_module_dot_conf.h"
+#ifdef TESTING
+    print_config_handlers();
+#endif
+}
+
+void
+update_config(void)
+{
+    snmp_call_callbacks(SNMP_CALLBACK_APPLICATION,
+                        SNMPD_CALLBACK_PRE_UPDATE_CONFIG, NULL);
+    free_config();
+    read_configs();
+}
+
+
+void
+snmpd_register_config_handler(const char *token,
+                              void (*parser) (const char *, char *),
+                              void (*releaser) (void), const char *help)
+{
+    DEBUGMSGTL(("snmpd_register_app_config_handler",
+                "registering .conf token for \"%s\"\n", token));
+    register_app_config_handler(token, parser, releaser, help);
+}
+
+void
+snmpd_unregister_config_handler(const char *token)
+{
+    unregister_app_config_handler(token);
+}
+
+/*
+ * this function is intended for use by mib-modules to store permenant
+ * configuration information generated by sets or persistent counters 
+ */
+void
+snmpd_store_config(const char *line)
+{
+    read_app_config_store(line);
+}
diff -Naur tomato/release/src/router/snmp/agent/agent_registry.c tomato121/release/src/router/snmp/agent/agent_registry.c
--- tomato/release/src/router/snmp/agent/agent_registry.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/agent_registry.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,1709 @@
+/*
+ * agent_registry.c
+ *
+ * Maintain a registry of MIB subtrees, together
+ *   with related information regarding mibmodule, sessions, etc
+ */
+
+#define IN_SNMP_VARS_C
+
+#include <net-snmp/net-snmp-config.h>
+#include <signal.h>
+#if HAVE_STRING_H
+#include <string.h>
+#endif
+#if HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#include <sys/types.h>
+#include <stdio.h>
+#include <fcntl.h>
+#if HAVE_WINSOCK_H
+#include <winsock.h>
+#endif
+#if TIME_WITH_SYS_TIME
+# ifdef WIN32
+#  include <sys/timeb.h>
+# else
+#  include <sys/time.h>
+# endif
+# include <time.h>
+#else
+# if HAVE_SYS_TIME_H
+#  include <sys/time.h>
+# else
+#  include <time.h>
+# endif
+#endif
+#if HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+
+#if HAVE_DMALLOC_H
+#include <dmalloc.h>
+#endif
+
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include <net-snmp/agent/agent_callbacks.h>
+
+#include "snmpd.h"
+#include "mibgroup/struct.h"
+#include <net-snmp/agent/old_api.h>
+#include <net-snmp/agent/null.h>
+#include <net-snmp/agent/table.h>
+#include <net-snmp/agent/table_iterator.h>
+#include <net-snmp/agent/agent_registry.h>
+#include "mib_module_includes.h"
+
+#ifdef USING_AGENTX_SUBAGENT_MODULE
+#include "agentx/subagent.h"
+#include "agentx/client.h"
+#endif
+
+static void register_mib_detach_node(netsnmp_subtree *s);
+static NETSNMP_INLINE void invalidate_lookup_cache(const char *context);
+void netsnmp_set_lookup_cache_size(int newsize);
+int netsnmp_get_lookup_cache_size(void);
+
+subtree_context_cache *context_subtrees = NULL;
+
+void
+netsnmp_subtree_free(netsnmp_subtree *a)
+{
+  if (a != NULL) {
+    if (a->variables != NULL && netsnmp_oid_equals(a->name_a, a->namelen, 
+					     a->start_a, a->start_len) == 0) {
+      free(a->variables);
+    }
+    SNMP_FREE(a->name_a);
+    SNMP_FREE(a->start_a);
+    SNMP_FREE(a->end_a);
+    SNMP_FREE(a->label_a);
+    netsnmp_handler_registration_free(a->reginfo);
+    free(a);
+  }
+}
+
+netsnmp_subtree *
+netsnmp_subtree_deepcopy(netsnmp_subtree *a)
+{
+  netsnmp_subtree *b = (netsnmp_subtree *)calloc(1, sizeof(netsnmp_subtree));
+
+  if (b != NULL) {
+    memcpy(b, a, sizeof(netsnmp_subtree));
+    b->name_a  = snmp_duplicate_objid(a->name_a,  a->namelen);
+    b->start_a = snmp_duplicate_objid(a->start_a, a->start_len);
+    b->end_a   = snmp_duplicate_objid(a->end_a,   a->end_len);
+    b->label_a = strdup(a->label_a);
+    
+    if (b->name_a == NULL || b->start_a == NULL || 
+	b->end_a  == NULL || b->label_a == NULL) {
+      netsnmp_subtree_free(b);
+      return NULL;
+    }
+
+    if (a->variables != NULL) {
+      b->variables = (struct variable *)malloc(a->variables_len * 
+					       a->variables_width);
+      if (b->variables != NULL) {
+	memcpy(b->variables, a->variables,a->variables_len*a->variables_width);
+      } else {
+	netsnmp_subtree_free(b);
+	return NULL;
+      }
+    }
+
+    if (a->reginfo != NULL) {
+      b->reginfo = netsnmp_handler_registration_dup(a->reginfo);
+      if (b->reginfo == NULL) {
+	netsnmp_subtree_free(b);
+	return NULL;
+      }
+    }
+  }
+  return b;
+}
+
+subtree_context_cache *
+get_top_context_cache(void)
+{
+    return context_subtrees;
+}
+
+netsnmp_subtree *
+netsnmp_subtree_find_first(const char *context_name)
+{
+    subtree_context_cache *ptr;
+
+    if (!context_name) {
+        context_name = "";
+    }
+
+    DEBUGMSGTL(("subtree", "looking for subtree for context: \"%s\"\n", 
+		context_name));
+    for (ptr = context_subtrees; ptr != NULL; ptr = ptr->next) {
+        if (ptr->context_name != NULL && 
+	    strcmp(ptr->context_name, context_name) == 0) {
+            DEBUGMSGTL(("subtree", "found one for: \"%s\"\n", context_name));
+            return ptr->first_subtree;
+        }
+    }
+    DEBUGMSGTL(("subtree", "didn't find a subtree for context: \"%s\"\n", 
+		context_name));
+    return NULL;
+}
+
+netsnmp_subtree *
+add_subtree(netsnmp_subtree *new_tree, const char *context_name)
+{
+    subtree_context_cache *ptr = SNMP_MALLOC_TYPEDEF(subtree_context_cache);
+    if (!context_name) {
+        context_name = "";
+    }
+
+    if (!ptr) {
+        return NULL;
+    }
+
+    DEBUGMSGTL(("subtree", "adding subtree for context: \"%s\"\n",	
+		context_name));
+    ptr->next = context_subtrees;
+    ptr->first_subtree = new_tree;
+    ptr->context_name = strdup(context_name);
+    context_subtrees = ptr;
+    return ptr->first_subtree;
+}
+
+netsnmp_subtree *
+netsnmp_subtree_replace_first(netsnmp_subtree *new_tree, 
+			      const char *context_name)
+{
+    subtree_context_cache *ptr;
+    if (!context_name) {
+        context_name = "";
+    }
+    for (ptr = context_subtrees; ptr != NULL; ptr = ptr->next) {
+        if (ptr->context_name != NULL &&
+	    strcmp(ptr->context_name, context_name) == 0) {
+            ptr->first_subtree = new_tree;
+            return ptr->first_subtree;
+        }
+    }
+    return add_subtree(new_tree, context_name);
+}
+
+
+
+int
+netsnmp_subtree_compare(const netsnmp_subtree *ap, const netsnmp_subtree *bp)
+{
+    return snmp_oid_compare(ap->name_a, ap->namelen, bp->name_a, bp->namelen);
+}
+
+void
+netsnmp_subtree_join(netsnmp_subtree *root)
+{
+    netsnmp_subtree *s, *tmp, *c, *d;
+
+    while (root != NULL) {
+        s = root->next;
+        while (s != NULL && root->reginfo == s->reginfo) {
+            tmp = s->next;
+            DEBUGMSGTL(("subtree", "root start "));
+            DEBUGMSGOID(("subtree", root->start_a, root->start_len));
+            DEBUGMSG(("subtree", " (original end "));
+            DEBUGMSGOID(("subtree", root->end_a, root->end_len));
+            DEBUGMSG(("subtree", ")\n"));
+            DEBUGMSGTL(("subtree", "  JOINING to "));
+            DEBUGMSGOID(("subtree", s->start_a, s->start_len));
+
+	    SNMP_FREE(root->end_a);
+	    root->end_a   = s->end_a;
+            root->end_len = s->end_len;
+	    s->end_a      = NULL;
+
+            for (c = root; c != NULL; c = c->children) {
+                c->next = s->next;
+            }
+            for (c = s; c != NULL; c = c->children) {
+                c->prev = root;
+            }
+            DEBUGMSG(("subtree", " so new end "));
+            DEBUGMSGOID(("subtree", root->end_a, root->end_len));
+            DEBUGMSG(("subtree", "\n"));
+            /*
+             * Probably need to free children too?  
+             */
+            for (c = s->children; c != NULL; c = d) {
+                d = c->children;
+                netsnmp_subtree_free(c);
+            }
+            netsnmp_subtree_free(s);
+            s = tmp;
+        }
+        root = root->next;
+    }
+}
+
+
+        /*
+         *  Split the subtree into two at the specified point,
+         *    returning the new (second) subtree
+         */
+netsnmp_subtree *
+netsnmp_subtree_split(netsnmp_subtree *current, oid name[], int name_len)
+{
+    struct variable *vp = NULL;
+    netsnmp_subtree *new_sub, *ptr;
+    int i = 0, rc = 0, rc2 = 0;
+    size_t common_len = 0;
+    char *cp;
+    oid *tmp_a, *tmp_b;
+
+    if (snmp_oid_compare(name, name_len, current->end_a, current->end_len)>0) {
+	/* Split comes after the end of this subtree */
+        return NULL;
+    }
+
+    new_sub = netsnmp_subtree_deepcopy(current);
+    if (new_sub == NULL) {
+        return NULL;
+    }
+
+    /*  Set up the point of division.  */
+    tmp_a = snmp_duplicate_objid(name, name_len);
+    if (tmp_a == NULL) {
+	netsnmp_subtree_free(new_sub);
+	return NULL;
+    }
+    tmp_b = snmp_duplicate_objid(name, name_len);
+    if (tmp_b == NULL) {
+	netsnmp_subtree_free(new_sub);
+	free(tmp_a);
+	return NULL;
+    }
+
+    if (current->end_a != NULL) {
+	free(current->end_a);
+    }
+    current->end_a = tmp_a;
+    current->end_len = name_len;
+    if (new_sub->start_a != NULL) {
+	free(new_sub->start_a);
+    }
+    new_sub->start_a = tmp_b;
+    new_sub->start_len = name_len;
+
+    /*  Split the variables between the two new subtrees.  */
+    i = current->variables_len;
+    current->variables_len = 0;
+
+    for (vp = current->variables; i > 0; i--) {
+	/*  Note that the variable "name" field omits the prefix common to the
+	    whole registration, hence the strange comparison here.  */
+
+	rc = snmp_oid_compare(vp->name, vp->namelen,
+			      name     + current->namelen, 
+			      name_len - current->namelen);
+
+        if (name_len - current->namelen > vp->namelen) {
+            common_len = vp->namelen;
+        } else {
+            common_len = name_len - current->namelen;
+        }
+
+        rc2 = snmp_oid_compare(vp->name, common_len,
+                               name + current->namelen, common_len);
+
+        if (rc >= 0) {
+            break;  /* All following variables belong to the second subtree */
+	}
+
+        current->variables_len++;
+        if (rc2 < 0) {
+            new_sub->variables_len--;
+            cp = (char *) new_sub->variables;
+            new_sub->variables = (struct variable *)(cp + 
+						     new_sub->variables_width);
+        }
+        vp = (struct variable *) ((char *) vp + current->variables_width);
+    }
+
+    /* Delegated trees should retain their variables regardless */
+    if (current->variables_len > 0 &&
+        IS_DELEGATED((u_char) current->variables[0].type)) {
+        new_sub->variables_len = 1;
+        new_sub->variables = current->variables;
+    }
+
+    /* Propogate this split down through any children */
+    if (current->children) {
+        new_sub->children = netsnmp_subtree_split(current->children, 
+						  name, name_len);
+    }
+
+    /* Retain the correct linking of the list */
+    for (ptr = current; ptr != NULL; ptr = ptr->children) {
+      ptr->next = new_sub;
+    }
+    for (ptr = new_sub; ptr != NULL; ptr = ptr->children) {
+      ptr->prev = current;
+    }
+    for (ptr = new_sub->next; ptr != NULL; ptr=ptr->children) {
+      ptr->prev = new_sub;
+    }
+
+    return new_sub;
+}
+
+int
+netsnmp_subtree_load(netsnmp_subtree *new_sub, const char *context_name)
+{
+    netsnmp_subtree *tree1, *tree2, *new2;
+    netsnmp_subtree *prev, *next;
+    int             res, rc = 0;
+
+    if (new_sub == NULL) {
+        return MIB_REGISTERED_OK;       /* Degenerate case */
+    }
+
+    /*  Find the subtree that contains the start of the new subtree (if
+	any)...*/
+
+    tree1 = netsnmp_subtree_find(new_sub->start_a, new_sub->start_len, 
+				 NULL, context_name);
+
+    /*  ... and the subtree that follows the new one (NULL implies this is the
+	final region covered).  */
+
+    if (tree1 == NULL) {
+	tree2 = netsnmp_subtree_find_next(new_sub->start_a, new_sub->start_len,
+					  NULL, context_name);
+    } else {
+	tree2 = tree1->next;
+    }
+
+    /*  Handle new subtrees that start in virgin territory.  */
+
+    if (tree1 == NULL) {
+	new2 = NULL;
+	/*  Is there any overlap with later subtrees?  */
+	if (tree2 && snmp_oid_compare(new_sub->end_a, new_sub->end_len,
+				      tree2->start_a, tree2->start_len) > 0) {
+	    new2 = netsnmp_subtree_split(new_sub, 
+					 tree2->start_a, tree2->start_len);
+	}
+
+	/*  Link the new subtree (less any overlapping region) with the list of
+	    existing registrations.  */
+
+	if (tree2) {
+	    new_sub->prev = tree2->prev;
+	    tree2->prev   = new_sub;
+	} else {
+	    new_sub->prev = netsnmp_subtree_find_prev(new_sub->start_a,
+				      new_sub->start_len, NULL, context_name);
+
+	    if (new_sub->prev) {
+		new_sub->prev->next = new_sub;
+	    } else {
+		netsnmp_subtree_replace_first(new_sub, context_name);
+	    }
+
+	    new_sub->next = tree2;
+
+	    /* If there was any overlap, recurse to merge in the overlapping
+	       region (including anything that may follow the overlap).  */
+	    if (new2) {
+		return netsnmp_subtree_load(new2, context_name);
+	    }
+	}
+    } else {
+	/*  If the new subtree starts *within* an existing registration
+	    (rather than at the same point as it), then split the existing
+	    subtree at this point.  */
+
+	if (netsnmp_oid_equals(new_sub->start_a, new_sub->start_len, 
+			     tree1->start_a,   tree1->start_len) != 0) {
+	    tree1 = netsnmp_subtree_split(tree1, new_sub->start_a, 
+					  new_sub->start_len);
+	}
+
+        if (tree1 == NULL) {
+            return MIB_REGISTRATION_FAILED;
+	}
+
+	/*  Now consider the end of this existing subtree:
+	    
+	    If it matches the new subtree precisely,
+	            simply merge the new one into the list of children
+
+	    If it includes the whole of the new subtree,
+		    split it at the appropriate point, and merge again
+     
+	    If the new subtree extends beyond this existing region,
+	            split it, and recurse to merge the two parts.  */
+
+	rc = snmp_oid_compare(new_sub->end_a, new_sub->end_len, 
+			      tree1->end_a, tree1->end_len);
+
+        switch (rc) {
+
+	case -1:
+	    /*  Existing subtree contains new one.  */
+	    netsnmp_subtree_split(tree1, new_sub->end_a, new_sub->end_len);
+	    /* Fall Through */
+
+	case  0:
+	    /*  The two trees match precisely.  */
+
+	    /*  Note: This is the only point where the original registration
+	        OID ("name") is used.  */
+
+	    prev = NULL;
+	    next = tree1;
+	
+	    while (next && next->namelen > new_sub->namelen) {
+		prev = next;
+		next = next->children;
+	    }
+
+	    while (next && next->namelen == new_sub->namelen &&
+		   next->priority < new_sub->priority ) {
+		prev = next;
+		next = next->children;
+	    }
+	
+	    if (next && (next->namelen  == new_sub->namelen) &&
+		(next->priority == new_sub->priority)) {
+		return MIB_DUPLICATE_REGISTRATION;
+	    }
+
+	    if (prev) {
+		prev->children    = new_sub;
+		new_sub->children = next;
+		new_sub->prev = prev->prev;
+		new_sub->next = prev->next;
+	    } else {
+		new_sub->children = next;
+		new_sub->prev = next->prev;
+		new_sub->next = next->next;
+	
+		for (next = new_sub->next; next != NULL;next = next->children){
+		    next->prev = new_sub;
+		}
+
+		for (prev = new_sub->prev; prev != NULL;prev = prev->children){
+		    prev->next = new_sub;
+		}
+	    }
+	    break;
+
+	case  1:
+	    /*  New subtree contains the existing one.  */
+	    new2 = netsnmp_subtree_split(new_sub, tree1->end_a,tree1->end_len);
+	    res = netsnmp_subtree_load(new_sub, context_name);
+	    if (res != MIB_REGISTERED_OK) {
+		netsnmp_subtree_free(new2);
+		return res;
+	    }
+	    return netsnmp_subtree_load(new2, context_name);
+	}
+    }
+    return 0;
+}
+
+int
+netsnmp_register_mib(const char *moduleName,
+                     struct variable *var,
+                     size_t varsize,
+                     size_t numvars,
+                     oid * mibloc,
+                     size_t mibloclen,
+                     int priority,
+                     int range_subid,
+                     oid range_ubound,
+                     netsnmp_session * ss,
+                     const char *context,
+                     int timeout,
+                     int flags,
+                     netsnmp_handler_registration *reginfo,
+                     int perform_callback)
+{
+    netsnmp_subtree *subtree, *sub2;
+    int             res, i;
+    struct register_parameters reg_parms;
+    int old_lookup_cache_val = netsnmp_get_lookup_cache_size();
+
+    subtree = (netsnmp_subtree *)calloc(1, sizeof(netsnmp_subtree));
+    if (subtree == NULL) {
+        return MIB_REGISTRATION_FAILED;
+    }
+
+    DEBUGMSGTL(("register_mib", "registering \"%s\" at ", moduleName));
+    DEBUGMSGOIDRANGE(("register_mib", mibloc, mibloclen, range_subid,
+                      range_ubound));
+    DEBUGMSG(("register_mib", "\n"));
+
+    /*  Create the new subtree node being registered.  */
+
+    subtree->name_a  = snmp_duplicate_objid(mibloc, mibloclen);
+    subtree->start_a = snmp_duplicate_objid(mibloc, mibloclen);
+    subtree->end_a   = snmp_duplicate_objid(mibloc, mibloclen);
+    subtree->label_a = strdup(moduleName);
+    if (subtree->name_a == NULL || subtree->start_a == NULL || 
+	subtree->end_a  == NULL || subtree->label_a == NULL) {
+	netsnmp_subtree_free(subtree);
+	return MIB_REGISTRATION_FAILED;
+    }
+    subtree->namelen   = (u_char)mibloclen;
+    subtree->start_len = (u_char)mibloclen;
+    subtree->end_len   = (u_char)mibloclen;
+    subtree->end_a[mibloclen - 1]++;
+
+    if (var != NULL) {
+	subtree->variables = (struct variable *)malloc(varsize*numvars);
+	if (subtree->variables == NULL) {
+	    netsnmp_subtree_free(subtree);
+	    return MIB_REGISTRATION_FAILED;
+	}
+	memcpy(subtree->variables, var, numvars*varsize);
+	subtree->variables_len = numvars;
+	subtree->variables_width = varsize;
+    }
+    subtree->priority = priority;
+    subtree->timeout = timeout;
+    subtree->range_subid = range_subid;
+    subtree->range_ubound = range_ubound;
+    subtree->session = ss;
+    subtree->reginfo = reginfo;
+    subtree->flags = (u_char)flags;    /*  used to identify instance oids  */
+    subtree->flags |= SUBTREE_ATTACHED;
+    subtree->global_cacheid = reginfo->global_cacheid;
+
+    netsnmp_set_lookup_cache_size(0);
+    res = netsnmp_subtree_load(subtree, context);
+
+    /*  If registering a range, use the first subtree as a template for the
+	rest of the range.  */
+
+    if (res == MIB_REGISTERED_OK && range_subid != 0) {
+	for (i = mibloc[range_subid - 1] + 1; i <= (int)range_ubound; i++) {
+	    sub2 = netsnmp_subtree_deepcopy(subtree);
+
+	    if (sub2 == NULL) {
+                unregister_mib_context(mibloc, mibloclen, priority,
+                                       range_subid, range_ubound, context);
+                netsnmp_set_lookup_cache_size(old_lookup_cache_val);
+                invalidate_lookup_cache(context);
+                return MIB_REGISTRATION_FAILED;
+            }
+
+            sub2->name_a[range_subid - 1]  = i;
+            sub2->start_a[range_subid - 1] = i;
+            sub2->end_a[range_subid - 1]   = i;     /* XXX - ???? */
+            res = netsnmp_subtree_load(sub2, context);
+            sub2->flags |= SUBTREE_ATTACHED;
+            if (res != MIB_REGISTERED_OK) {
+                unregister_mib_context(mibloc, mibloclen, priority,
+                                       range_subid, range_ubound, context);
+		netsnmp_subtree_free(sub2);
+                netsnmp_set_lookup_cache_size(old_lookup_cache_val);
+                invalidate_lookup_cache(context);
+                return res;
+            }
+        }
+    } else if (res == MIB_DUPLICATE_REGISTRATION ||
+               res == MIB_REGISTRATION_FAILED) {
+        netsnmp_subtree_free(subtree);
+    }
+
+    /*
+     * mark the MIB as detached, if there's no master agent present as of now 
+     */
+    if (netsnmp_ds_get_boolean(NETSNMP_DS_APPLICATION_ID, 
+			       NETSNMP_DS_AGENT_ROLE) != MASTER_AGENT) {
+        extern struct snmp_session *main_session;
+        if (main_session == NULL) {
+            register_mib_detach_node(subtree);
+	}
+    }
+
+    if (perform_callback) {
+        reg_parms.name = mibloc;
+        reg_parms.namelen = mibloclen;
+        reg_parms.priority = priority;
+        reg_parms.range_subid = range_subid;
+        reg_parms.range_ubound = range_ubound;
+        reg_parms.timeout = timeout;
+        reg_parms.flags = (u_char) flags;
+
+        /*
+         * Should this really be called if the registration hasn't actually 
+         * succeeded?  
+         */
+
+        snmp_call_callbacks(SNMP_CALLBACK_APPLICATION,
+                            SNMPD_CALLBACK_REGISTER_OID, &reg_parms);
+    }
+
+    netsnmp_set_lookup_cache_size(old_lookup_cache_val);
+    invalidate_lookup_cache(context);
+    return res;
+}
+
+/*
+ * Reattach a particular node.  
+ */
+
+static void
+register_mib_reattach_node(netsnmp_subtree *s)
+{
+    if ((s != NULL) && (s->namelen > 1) && !(s->flags & SUBTREE_ATTACHED)) {
+        struct register_parameters reg_parms;
+        /*
+         * only do registrations that are not the top level nodes 
+         */
+        /*
+         * XXX: do this better 
+         */
+        reg_parms.name = s->name_a;
+        reg_parms.namelen = s->namelen;
+        reg_parms.priority = s->priority;
+        reg_parms.range_subid = s->range_subid;
+        reg_parms.range_ubound = s->range_ubound;
+        reg_parms.timeout = s->timeout;
+        reg_parms.flags = s->flags;
+        snmp_call_callbacks(SNMP_CALLBACK_APPLICATION,
+                            SNMPD_CALLBACK_REGISTER_OID, &reg_parms);
+        s->flags |= SUBTREE_ATTACHED;
+    }
+}
+
+/*
+ * Call callbacks to reattach all our nodes.  
+ */
+
+void
+register_mib_reattach(void)
+{
+    netsnmp_subtree *s, *t;
+    subtree_context_cache *ptr;
+
+    for (ptr = context_subtrees; ptr; ptr = ptr->next) {
+        for (s = ptr->first_subtree; s != NULL; s = s->next) {
+            register_mib_reattach_node(s);
+            for (t = s->children; t != NULL; t = t->children) {
+                register_mib_reattach_node(t);
+            }
+        }
+    }
+}
+
+/*
+ * Mark a node as detached.  
+ */
+
+static void
+register_mib_detach_node(netsnmp_subtree *s)
+{
+    if (s != NULL) {
+        s->flags = s->flags & ~SUBTREE_ATTACHED;
+    }
+}
+
+/*
+ * Mark all our registered OIDs as detached.  This is only really
+ * useful for subagent protocols, when a connection is lost or
+ * something.  
+ */
+
+void
+register_mib_detach(void)
+{
+    netsnmp_subtree *s, *t;
+    subtree_context_cache *ptr;
+    for (ptr = context_subtrees; ptr; ptr = ptr->next) {
+        for (s = ptr->first_subtree; s != NULL; s = s->next) {
+            register_mib_detach_node(s);
+            for (t = s->children; t != NULL; t = t->children) {
+                register_mib_detach_node(t);
+            }
+        }
+    }
+}
+
+int
+register_mib_context(const char *moduleName,
+                     struct variable *var,
+                     size_t varsize,
+                     size_t numvars,
+                     oid * mibloc,
+                     size_t mibloclen,
+                     int priority,
+                     int range_subid,
+                     oid range_ubound,
+                     netsnmp_session * ss,
+                     const char *context, int timeout, int flags)
+{
+    return netsnmp_register_old_api(moduleName, var, varsize, numvars,
+                                    mibloc, mibloclen, priority,
+                                    range_subid, range_ubound, ss, context,
+                                    timeout, flags);
+}
+
+int
+register_mib_range(const char *moduleName,
+                   struct variable *var,
+                   size_t varsize,
+                   size_t numvars,
+                   oid * mibloc,
+                   size_t mibloclen,
+                   int priority,
+                   int range_subid, oid range_ubound, netsnmp_session * ss)
+{
+    return register_mib_context(moduleName, var, varsize, numvars,
+                                mibloc, mibloclen, priority,
+                                range_subid, range_ubound, ss, "", -1, 0);
+}
+
+int
+register_mib_priority(const char *moduleName,
+                      struct variable *var,
+                      size_t varsize,
+                      size_t numvars,
+                      oid * mibloc, size_t mibloclen, int priority)
+{
+    return register_mib_range(moduleName, var, varsize, numvars,
+                              mibloc, mibloclen, priority, 0, 0, NULL);
+}
+
+int
+register_mib(const char *moduleName,
+             struct variable *var,
+             size_t varsize,
+             size_t numvars, oid * mibloc, size_t mibloclen)
+{
+    return register_mib_priority(moduleName, var, varsize, numvars,
+                                 mibloc, mibloclen, DEFAULT_MIB_PRIORITY);
+}
+
+void
+netsnmp_subtree_unload(netsnmp_subtree *sub, netsnmp_subtree *prev, const char *context)
+{
+    netsnmp_subtree *ptr;
+
+    DEBUGMSGTL(("register_mib", "unload("));
+    if (sub != NULL) {
+        DEBUGMSGOID(("register_mib", sub->start_a, sub->start_len));
+    } else {
+        DEBUGMSG(("register_mib", "[NIL]"));
+    }
+    DEBUGMSG(("register_mib", ", "));
+    if (prev != NULL) {
+        DEBUGMSGOID(("register_mib", prev->start_a, prev->start_len));
+    } else {
+        DEBUGMSG(("register_mib", "[NIL]"));
+    }
+    DEBUGMSG(("register_mib", ")\n"));
+
+    if (prev != NULL) {         /* non-leading entries are easy */
+        prev->children = sub->children;
+        return;
+    }
+    /*
+     * otherwise, we need to amend our neighbours as well 
+     */
+
+    if (sub->children == NULL) {        /* just remove this node completely */
+        for (ptr = sub->prev; ptr; ptr = ptr->children)
+            ptr->next = sub->next;
+        for (ptr = sub->next; ptr; ptr = ptr->children)
+            ptr->prev = sub->prev;
+
+	if (sub->prev == NULL) {
+	    netsnmp_subtree_replace_first(sub->next, context);
+	}
+
+        return;
+    } else {
+        for (ptr = sub->prev; ptr; ptr = ptr->children)
+            ptr->next = sub->children;
+        for (ptr = sub->next; ptr; ptr = ptr->children)
+            ptr->prev = sub->children;
+
+	if (sub->prev == NULL) {
+	    netsnmp_subtree_replace_first(sub->children, context);
+	}
+        return;
+    }
+}
+
+int
+unregister_mib_context(oid * name, size_t len, int priority,
+                       int range_subid, oid range_ubound,
+                       const char *context)
+{
+    netsnmp_subtree *list, *myptr;
+    netsnmp_subtree *prev, *child;       /* loop through children */
+    struct register_parameters reg_parms;
+    int old_lookup_cache_val = netsnmp_get_lookup_cache_size();
+    netsnmp_set_lookup_cache_size(0);
+
+    DEBUGMSGTL(("register_mib", "unregistering "));
+    DEBUGMSGOIDRANGE(("register_mib", name, len, range_subid, range_ubound));
+    DEBUGMSG(("register_mib", "\n"));
+
+    list = netsnmp_subtree_find(name, len, netsnmp_subtree_find_first(context),
+				context);
+    if (list == NULL) {
+        return MIB_NO_SUCH_REGISTRATION;
+    }
+
+    for (child = list, prev = NULL; child != NULL;
+         prev = child, child = child->children) {
+        if (netsnmp_oid_equals(child->name_a, child->namelen, name, len) == 0 &&
+            child->priority == priority) {
+            break;              /* found it */
+	}
+    }
+
+    if (child == NULL) {
+        return MIB_NO_SUCH_REGISTRATION;
+    }
+
+    netsnmp_subtree_unload(child, prev, context);
+    myptr = child;              /* remember this for later */
+
+    /*
+     *  Now handle any occurances in the following subtrees,
+     *      as a result of splitting this range.  Due to the
+     *      nature of the way such splits work, the first
+     *      subtree 'slice' that doesn't refer to the given
+     *      name marks the end of the original region.
+     *
+     *  This should also serve to register ranges.
+     */
+
+    for (list = myptr->next; list != NULL; list = list->next) {
+        for (child = list, prev = NULL; child != NULL;
+             prev = child, child = child->children) {
+            if ((netsnmp_oid_equals(child->name_a, child->namelen,
+				  name, len) == 0) &&
+		(child->priority == priority)) {
+                netsnmp_subtree_unload(child, prev, context);
+                netsnmp_subtree_free(child);
+                break;
+            }
+        }
+        if (child == NULL)      /* Didn't find the given name */
+            break;
+    }
+    netsnmp_subtree_free(myptr);
+
+    reg_parms.name = name;
+    reg_parms.namelen = len;
+    reg_parms.priority = priority;
+    reg_parms.range_subid = range_subid;
+    reg_parms.range_ubound = range_ubound;
+    reg_parms.flags = 0x00;     /*  this is okay I think  */
+    snmp_call_callbacks(SNMP_CALLBACK_APPLICATION,
+                        SNMPD_CALLBACK_UNREGISTER_OID, &reg_parms);
+
+    netsnmp_set_lookup_cache_size(old_lookup_cache_val);
+    invalidate_lookup_cache(context);
+    return MIB_UNREGISTERED_OK;
+}
+
+int
+netsnmp_unregister_mib_table_row(oid * name, size_t len, int priority,
+                                 int var_subid, oid range_ubound,
+                                 const char *context)
+{
+    netsnmp_subtree *list, *myptr;
+    netsnmp_subtree *prev, *child;       /* loop through children */
+    struct register_parameters reg_parms;
+    oid             range_lbound = name[var_subid - 1];
+
+    DEBUGMSGTL(("register_mib", "unregistering "));
+    DEBUGMSGOIDRANGE(("register_mib", name, len, var_subid, range_ubound));
+    DEBUGMSG(("register_mib", "\n"));
+
+    for (; name[var_subid - 1] <= range_ubound; name[var_subid - 1]++) {
+        list = netsnmp_subtree_find(name, len, 
+				netsnmp_subtree_find_first(context), context);
+
+        if (list == NULL) {
+            continue;
+        }
+
+        for (child = list, prev = NULL; child != NULL;
+             prev = child, child = child->children) {
+
+            if (netsnmp_oid_equals(child->name_a, child->namelen, 
+				 name, len) == 0 && 
+		(child->priority == priority)) {
+                break;          /* found it */
+            }
+        }
+
+        if (child == NULL) {
+            continue;
+        }
+
+        netsnmp_subtree_unload(child, prev, context);
+        myptr = child;          /* remember this for later */
+
+        for (list = myptr->next; list != NULL; list = list->next) {
+            for (child = list, prev = NULL; child != NULL;
+                 prev = child, child = child->children) {
+
+                if (netsnmp_oid_equals(child->name_a, child->namelen, 
+				      name, len) == 0 &&
+                    (child->priority == priority)) {
+                    netsnmp_subtree_unload(child, prev, context);
+                    netsnmp_subtree_free(child);
+                    break;
+                }
+            }
+            if (child == NULL) {        /* Didn't find the given name */
+                break;
+            }
+        }
+        netsnmp_subtree_free(myptr);
+    }
+
+    name[var_subid - 1] = range_lbound;
+    reg_parms.name = name;
+    reg_parms.namelen = len;
+    reg_parms.priority = priority;
+    reg_parms.range_subid = var_subid;
+    reg_parms.range_ubound = range_ubound;
+    reg_parms.flags = 0x00;     /*  this is okay I think  */
+    snmp_call_callbacks(SNMP_CALLBACK_APPLICATION,
+                        SNMPD_CALLBACK_UNREGISTER_OID, &reg_parms);
+
+    return 0;
+}
+
+int
+unregister_mib_range(oid * name, size_t len, int priority,
+                     int range_subid, oid range_ubound)
+{
+    return unregister_mib_context(name, len, priority, range_subid,
+                                  range_ubound, "");
+}
+
+int
+unregister_mib_priority(oid * name, size_t len, int priority)
+{
+    return unregister_mib_range(name, len, priority, 0, 0);
+}
+
+int
+unregister_mib(oid * name, size_t len)
+{
+    return unregister_mib_priority(name, len, DEFAULT_MIB_PRIORITY);
+}
+
+void
+unregister_mibs_by_session(netsnmp_session * ss)
+{
+    netsnmp_subtree *list, *list2;
+    netsnmp_subtree *child, *prev, *next_child;
+    struct register_parameters rp;
+    subtree_context_cache *contextptr;
+
+    DEBUGMSGTL(("register_mib", "unregister_mibs_by_session(%p) ctxt \"%s\"\n",
+		ss, ss->contextName ? ss->contextName : "[NIL]"));
+
+    for (contextptr = get_top_context_cache(); contextptr != NULL;
+         contextptr = contextptr->next) {
+        for (list = contextptr->first_subtree; list != NULL; list = list2) {
+            list2 = list->next;
+
+            for (child = list, prev = NULL; child != NULL; child = next_child){
+                next_child = child->children;
+
+                if (((ss->flags & SNMP_FLAGS_SUBSESSION) &&
+		     child->session == ss) ||
+                    (!(ss->flags & SNMP_FLAGS_SUBSESSION) && child->session &&
+                     child->session->subsession == ss)) {
+
+                    rp.name = child->name_a;
+		    child->name_a = NULL;
+                    rp.namelen = child->namelen;
+                    rp.priority = child->priority;
+                    rp.range_subid = child->range_subid;
+                    rp.range_ubound = child->range_ubound;
+                    rp.timeout = child->timeout;
+                    rp.flags = child->flags;
+
+                    if (child->reginfo != NULL) {
+                        /*
+                         * Don't let's free the session pointer just yet!  
+                         */
+                        child->reginfo->handler->myvoid = NULL;
+                        netsnmp_handler_registration_free(child->reginfo);
+			child->reginfo = NULL;
+                    }
+
+                    netsnmp_subtree_unload(child, prev, contextptr->context_name);
+                    netsnmp_subtree_free(child);
+
+                    snmp_call_callbacks(SNMP_CALLBACK_APPLICATION,
+                                        SNMPD_CALLBACK_UNREGISTER_OID, &rp);
+		    SNMP_FREE(rp.name);
+                } else {
+                    prev = child;
+                }
+            }
+        }
+        netsnmp_subtree_join(contextptr->first_subtree);
+    }
+}
+
+/*
+ * in_a_view: determines if a given snmp_pdu is allowed to see a
+ * given name/namelen OID pointer
+ * name         IN - name of var, OUT - name matched
+ * nameLen      IN -number of sub-ids in name, OUT - subid-is in matched name
+ * pi           IN - relevant auth info re PDU 
+ * cvp          IN - relevant auth info re mib module
+ */
+
+int
+in_a_view(oid *name, size_t *namelen, netsnmp_pdu *pdu, int type)
+{
+    struct view_parameters view_parms;
+
+    if (pdu->flags & UCD_MSG_FLAG_ALWAYS_IN_VIEW) {
+	/* Enable bypassing of view-based access control */
+        return VACM_SUCCESS;
+    }
+
+    /*
+     * check for v1 and counter64s, since snmpv1 doesn't support it 
+     */
+    if (pdu->version == SNMP_VERSION_1 && type == ASN_COUNTER64) {
+        return VACM_NOTINVIEW;
+    }
+
+    view_parms.pdu = pdu;
+    view_parms.name = name;
+    if (namelen != NULL) {
+        view_parms.namelen = *namelen;
+    } else {
+        view_parms.namelen = 0;
+    }
+    view_parms.errorcode = 0;
+    view_parms.check_subtree = 0;
+
+    switch (pdu->version) {
+    case SNMP_VERSION_1:
+    case SNMP_VERSION_2c:
+    case SNMP_VERSION_3:
+        snmp_call_callbacks(SNMP_CALLBACK_APPLICATION,
+                            SNMPD_CALLBACK_ACM_CHECK, &view_parms);
+        return view_parms.errorcode;
+    }
+    return VACM_NOSECNAME;
+}
+
+/*
+ * check_acces: determines if a given snmp_pdu is ever going to be
+ * allowed to do anynthing or if it's not going to ever be
+ * authenticated.
+ */
+int
+check_access(netsnmp_pdu *pdu)
+{                               /* IN - pdu being checked */
+    struct view_parameters view_parms;
+    view_parms.pdu = pdu;
+    view_parms.name = 0;
+    view_parms.namelen = 0;
+    view_parms.errorcode = 0;
+    view_parms.check_subtree = 0;
+
+    if (pdu->flags & UCD_MSG_FLAG_ALWAYS_IN_VIEW) {
+	/* Enable bypassing of view-based access control */
+        return 0;
+    }
+
+    switch (pdu->version) {
+    case SNMP_VERSION_1:
+    case SNMP_VERSION_2c:
+    case SNMP_VERSION_3:
+        snmp_call_callbacks(SNMP_CALLBACK_APPLICATION,
+                            SNMPD_CALLBACK_ACM_CHECK_INITIAL, &view_parms);
+        return view_parms.errorcode;
+    }
+    return 1;
+}
+
+/** checks to see if everything within a
+ *  given subtree is either: in view, not in view, or possibly both.
+ *  If the entire subtree is not-in-view we can use this information to
+ *  skip calling the sub-handlers entirely.
+ *  @returns 0 if entire subtree is accessible, 5 if not and 7 if
+ *  portions are both.  1 on error (illegal pdu version).
+ */
+int
+netsnmp_acm_check_subtree(netsnmp_pdu *pdu, oid *name, size_t namelen)
+{                               /* IN - pdu being checked */
+    struct view_parameters view_parms;
+    view_parms.pdu = pdu;
+    view_parms.name = name;
+    view_parms.namelen = namelen;
+    view_parms.errorcode = 0;
+    view_parms.check_subtree = 1;
+
+    if (pdu->flags & UCD_MSG_FLAG_ALWAYS_IN_VIEW) {
+	/* Enable bypassing of view-based access control */
+        return 0;
+    }
+
+    switch (pdu->version) {
+    case SNMP_VERSION_1:
+    case SNMP_VERSION_2c:
+    case SNMP_VERSION_3:
+        snmp_call_callbacks(SNMP_CALLBACK_APPLICATION,
+                            SNMPD_CALLBACK_ACM_CHECK_SUBTREE, &view_parms);
+        return view_parms.errorcode;
+    }
+    return 1;
+}
+
+#define SUBTREE_DEFAULT_CACHE_SIZE 8
+#define SUBTREE_MAX_CACHE_SIZE     32
+int lookup_cache_size = 0; /*enabled later after registrations are loaded */
+
+typedef struct lookup_cache_s {
+   netsnmp_subtree *next;
+   netsnmp_subtree *previous;
+} lookup_cache;
+
+typedef struct lookup_cache_context_s {
+   char *context;
+   struct lookup_cache_context_s *next;
+   int thecachecount;
+   int currentpos;
+   lookup_cache cache[SUBTREE_MAX_CACHE_SIZE];
+} lookup_cache_context;
+
+static lookup_cache_context *thecontextcache = NULL;
+
+/** set the lookup cache size for optimized agent registration performance.
+ * @param newsize set to the maximum size of a cache for a given
+ * context.  Set to 0 to completely disable caching, or to -1 to set
+ * to the default cache size (8), or to a number of your chosing.  The
+ * rough guide is that it should be equal to the maximum number of
+ * simultanious managers you expect to talk to the agent (M) times 80%
+ * (or so, he says randomly) the average number (N) of varbinds you
+ * expect to receive in a given request for a manager.  ie, M times N.
+ * Bigger does NOT necessarily mean better.  Certainly 16 should be an
+ * upper limit.  32 is the hard coded limit.
+ */
+void
+netsnmp_set_lookup_cache_size(int newsize) {
+    if (newsize < 0)
+        lookup_cache_size = SUBTREE_DEFAULT_CACHE_SIZE;
+    else if (newsize < SUBTREE_MAX_CACHE_SIZE)
+        lookup_cache_size = newsize;
+    else
+        lookup_cache_size = SUBTREE_MAX_CACHE_SIZE;
+}
+
+/** retrieves the current value of the lookup cache size
+ *  @return the current lookup cache size
+ */
+int
+netsnmp_get_lookup_cache_size(void) {
+    return lookup_cache_size;
+}
+
+static NETSNMP_INLINE lookup_cache_context *
+get_context_lookup_cache(const char *context) {
+    lookup_cache_context *ptr;
+    if (!context)
+        context = "";
+
+    for(ptr = thecontextcache; ptr; ptr = ptr->next) {
+        if (strcmp(ptr->context, context) == 0)
+            break;
+    }
+    if (!ptr) {
+        if (netsnmp_subtree_find_first(context)) {
+            ptr = SNMP_MALLOC_TYPEDEF(lookup_cache_context);
+            ptr->next = thecontextcache;
+            ptr->context = strdup(context);
+            thecontextcache = ptr;
+        } else {
+            return NULL;
+        }
+    }
+    return ptr;
+}
+
+static NETSNMP_INLINE void
+lookup_cache_add(const char *context,
+                 netsnmp_subtree *next, netsnmp_subtree *previous) {
+    lookup_cache_context *cptr;
+
+    if ((cptr = get_context_lookup_cache(context)) == NULL)
+        return;
+    
+    if (cptr->thecachecount < lookup_cache_size)
+        cptr->thecachecount++;
+
+    cptr->cache[cptr->currentpos].next = next;
+    cptr->cache[cptr->currentpos].previous = previous;
+
+    if (++cptr->currentpos >= lookup_cache_size)
+        cptr->currentpos = 0;
+}
+
+static NETSNMP_INLINE void
+lookup_cache_replace(lookup_cache *ptr,
+                     netsnmp_subtree *next, netsnmp_subtree *previous) {
+
+    ptr->next = next;
+    ptr->previous = previous;
+}
+
+static NETSNMP_INLINE lookup_cache *
+lookup_cache_find(const char *context, oid *name, size_t name_len,
+                  int *retcmp) {
+    lookup_cache_context *cptr;
+    lookup_cache *ret = NULL;
+    int cmp;
+    int i;
+
+    if ((cptr = get_context_lookup_cache(context)) == NULL)
+        return NULL;
+
+    for(i = 0; i < cptr->thecachecount && i < lookup_cache_size; i++) {
+        if (cptr->cache[i].previous->start_a)
+            cmp = snmp_oid_compare(name, name_len,
+                                   cptr->cache[i].previous->start_a,
+                                   cptr->cache[i].previous->start_len);
+        else
+            cmp = 1;
+        if (cmp >= 0) {
+            *retcmp = cmp;
+            ret = &(cptr->cache[i]);
+        }
+    }
+    return ret;
+}
+
+static NETSNMP_INLINE void
+invalidate_lookup_cache(const char *context) {
+    lookup_cache_context *cptr;
+    if ((cptr = get_context_lookup_cache(context)) != NULL) {
+        cptr->thecachecount = 0;
+        cptr->currentpos = 0;
+    }
+}
+
+netsnmp_subtree *
+netsnmp_subtree_find_prev(oid *name, size_t len, netsnmp_subtree *subtree,
+			  const char *context_name)
+{
+    lookup_cache *lookup_cache = NULL;
+    netsnmp_subtree *myptr = NULL, *previous = NULL;
+    int cmp = 1;
+
+    if (subtree) {
+        myptr = subtree;
+    } else {
+	/* look through everything */
+        if (lookup_cache_size) {
+            lookup_cache = lookup_cache_find(context_name, name, len, &cmp);
+            if (lookup_cache) {
+                myptr = lookup_cache->next;
+                previous = lookup_cache->previous;
+            }
+            if (!myptr)
+                myptr = netsnmp_subtree_find_first(context_name);
+        } else {
+            myptr = netsnmp_subtree_find_first(context_name);
+        }
+    }
+
+    for (; myptr != NULL; previous = myptr, myptr = myptr->next) {
+        if (snmp_oid_compare(name, len, myptr->start_a, myptr->start_len) < 0) {
+            if (lookup_cache_size && previous && cmp) {
+                if (lookup_cache) {
+                    lookup_cache_replace(lookup_cache, myptr, previous);
+                } else {
+                    lookup_cache_add(context_name, myptr, previous);
+                }
+            }
+            return previous;
+        }
+    }
+    return previous;
+}
+
+netsnmp_subtree *
+netsnmp_subtree_find_next(oid *name, size_t len,
+			  netsnmp_subtree *subtree, const char *context_name)
+{
+    netsnmp_subtree *myptr = NULL;
+
+    myptr = netsnmp_subtree_find_prev(name, len, subtree, context_name);
+
+    if (myptr != NULL) {
+        myptr = myptr->next;
+        while (myptr != NULL && (myptr->variables == NULL || 
+				 myptr->variables_len == 0)) {
+            myptr = myptr->next;
+        }
+        return myptr;
+    } else if (subtree != NULL && snmp_oid_compare(name, len, 
+				   subtree->start_a, subtree->start_len) < 0) {
+        return subtree;
+    } else {
+        return NULL;
+    }
+}
+
+netsnmp_subtree *
+netsnmp_subtree_find(oid *name, size_t len, netsnmp_subtree *subtree, 
+		     const char *context_name)
+{
+    netsnmp_subtree *myptr;
+
+    myptr = netsnmp_subtree_find_prev(name, len, subtree, context_name);
+    if (myptr && myptr->end_a &&
+        snmp_oid_compare(name, len, myptr->end_a, myptr->end_len)<0) {
+        return myptr;
+    }
+
+    return NULL;
+}
+
+netsnmp_session *
+get_session_for_oid(oid *name, size_t len, const char *context_name)
+{
+    netsnmp_subtree *myptr;
+
+    myptr = netsnmp_subtree_find_prev(name, len, 
+				      netsnmp_subtree_find_first(context_name),
+				      context_name);
+
+    while (myptr && myptr->variables == NULL) {
+        myptr = myptr->next;
+    }
+
+    if (myptr == NULL) {
+        return NULL;
+    } else {
+        return myptr->session;
+    }
+}
+
+void
+setup_tree(void)
+{
+    oid ccitt[1]           = { 0 };
+    oid iso[1]             = { 1 };
+    oid joint_ccitt_iso[1] = { 2 };
+
+#ifdef USING_AGENTX_SUBAGENT_MODULE
+    int role =  netsnmp_ds_get_boolean(NETSNMP_DS_APPLICATION_ID, 
+				       NETSNMP_DS_AGENT_ROLE);
+
+    netsnmp_ds_set_boolean(NETSNMP_DS_APPLICATION_ID, NETSNMP_DS_AGENT_ROLE, 
+			   MASTER_AGENT);
+#endif
+
+    netsnmp_register_null(ccitt, 1);
+    netsnmp_register_null(iso, 1);
+    netsnmp_register_null(joint_ccitt_iso, 1);
+
+#ifdef USING_AGENTX_SUBAGENT_MODULE
+    netsnmp_ds_set_boolean(NETSNMP_DS_APPLICATION_ID, NETSNMP_DS_AGENT_ROLE, 
+			   role);
+#endif
+}
+
+
+extern void     dump_idx_registry(void);
+void
+dump_registry(void)
+{
+    struct variable *vp = NULL;
+    netsnmp_subtree *myptr, *myptr2;
+    u_char *s = NULL, *e = NULL, *v = NULL;
+    size_t sl = 256, el = 256, vl = 256, sl_o = 0, el_o = 0, vl_o = 0;
+    int i = 0;
+
+    if ((s = (u_char *) calloc(sl, 1)) != NULL &&
+        (e = (u_char *) calloc(sl, 1)) != NULL &&
+        (v = (u_char *) calloc(sl, 1)) != NULL) {
+
+        subtree_context_cache *ptr;
+        for (ptr = context_subtrees; ptr; ptr = ptr->next) {
+            printf("Subtrees for Context: %s\n", ptr->context_name);
+            for (myptr = ptr->first_subtree; myptr != NULL;
+                 myptr = myptr->next) {
+                sl_o = el_o = vl_o = 0;
+
+                if (!sprint_realloc_objid(&s, &sl, &sl_o, 1,
+                                          myptr->start_a,
+                                          myptr->start_len)) {
+                    break;
+                }
+                if (!sprint_realloc_objid(&e, &el, &el_o, 1,
+                                          myptr->end_a,
+					  myptr->end_len)) {
+                    break;
+                }
+
+                if (myptr->variables) {
+                    printf("%02x ( %s - %s ) [", myptr->flags, s, e);
+                    for (i = 0, vp = myptr->variables;
+                         i < myptr->variables_len; i++) {
+                        vl_o = 0;
+                        if (!sprint_realloc_objid
+                            (&v, &vl, &vl_o, 1, vp->name, vp->namelen)) {
+                            break;
+                        }
+                        printf("%s, ", v);
+                        vp = (struct variable *) ((char *) vp +
+                                                  myptr->variables_width);
+                    }
+                    printf("]\n");
+                } else {
+                    printf("%02x   %s - %s  \n", myptr->flags, s, e);
+                }
+                for (myptr2 = myptr; myptr2 != NULL;
+                     myptr2 = myptr2->children) {
+                    if (myptr2->label_a && myptr2->label_a[0]) {
+                        if (strcmp(myptr2->label_a, "old_api") == 0) {
+                            struct variable *vp =
+                                myptr2->reginfo->handler->myvoid;
+
+                            sprint_realloc_objid(&s, &sl, &sl_o, 1,
+                                                 vp->name, vp->namelen);
+                            printf("\t%s[%s] %p var %s\n", myptr2->label_a,
+                                   myptr2->reginfo->handlerName ? myptr2->
+                                   reginfo->handlerName : "no-name",
+                                   myptr2->reginfo, s);
+                        } else {
+                            printf("\t%s %s %p\n", myptr2->label_a,
+                                   myptr2->reginfo->handlerName ? myptr2->
+                                   reginfo->
+                                   handlerName : "no-handler-name",
+                                   myptr2->reginfo);
+                        }
+                    }
+                }
+            }
+        }
+    }
+
+    if (s != NULL) {
+        free(s);
+    }
+    if (e != NULL) {
+        free(e);
+    }
+    if (v != NULL) {
+        free(v);
+    }
+
+    dump_idx_registry();
+}
+
+
+int	external_readfd[NUM_EXTERNAL_FDS],   external_readfdlen   = 0;
+int	external_writefd[NUM_EXTERNAL_FDS],  external_writefdlen  = 0;
+int	external_exceptfd[NUM_EXTERNAL_FDS], external_exceptfdlen = 0;
+void  (*external_readfdfunc[NUM_EXTERNAL_FDS]) (int, void *);
+void  (*external_writefdfunc[NUM_EXTERNAL_FDS]) (int, void *);
+void  (*external_exceptfdfunc[NUM_EXTERNAL_FDS]) (int, void *);
+void   *external_readfd_data[NUM_EXTERNAL_FDS];
+void   *external_writefd_data[NUM_EXTERNAL_FDS];
+void   *external_exceptfd_data[NUM_EXTERNAL_FDS];
+
+int
+register_readfd(int fd, void (*func) (int, void *), void *data)
+{
+    if (external_readfdlen < NUM_EXTERNAL_FDS) {
+        external_readfd[external_readfdlen] = fd;
+        external_readfdfunc[external_readfdlen] = func;
+        external_readfd_data[external_readfdlen] = data;
+        external_readfdlen++;
+        DEBUGMSGTL(("register_readfd", "registered fd %d\n", fd));
+        return FD_REGISTERED_OK;
+    } else {
+        snmp_log(LOG_CRIT, "register_readfd: too many file descriptors\n");
+        return FD_REGISTRATION_FAILED;
+    }
+}
+
+int
+register_writefd(int fd, void (*func) (int, void *), void *data)
+{
+    if (external_writefdlen < NUM_EXTERNAL_FDS) {
+        external_writefd[external_writefdlen] = fd;
+        external_writefdfunc[external_writefdlen] = func;
+        external_writefd_data[external_writefdlen] = data;
+        external_writefdlen++;
+        DEBUGMSGTL(("register_writefd", "registered fd %d\n", fd));
+        return FD_REGISTERED_OK;
+    } else {
+        snmp_log(LOG_CRIT,
+                 "register_writefd: too many file descriptors\n");
+        return FD_REGISTRATION_FAILED;
+    }
+}
+
+int
+register_exceptfd(int fd, void (*func) (int, void *), void *data)
+{
+    if (external_exceptfdlen < NUM_EXTERNAL_FDS) {
+        external_exceptfd[external_exceptfdlen] = fd;
+        external_exceptfdfunc[external_exceptfdlen] = func;
+        external_exceptfd_data[external_exceptfdlen] = data;
+        external_exceptfdlen++;
+        DEBUGMSGTL(("register_exceptfd", "registered fd %d\n", fd));
+        return FD_REGISTERED_OK;
+    } else {
+        snmp_log(LOG_CRIT,
+                 "register_exceptfd: too many file descriptors\n");
+        return FD_REGISTRATION_FAILED;
+    }
+}
+
+int
+unregister_readfd(int fd)
+{
+    int             i, j;
+
+    for (i = 0; i < external_readfdlen; i++) {
+        if (external_readfd[i] == fd) {
+            external_readfdlen--;
+            for (j = i; j < external_readfdlen; j++) {
+                external_readfd[j] = external_readfd[j + 1];
+                external_readfdfunc[j] = external_readfdfunc[j + 1];
+                external_readfd_data[j] = external_readfd_data[j + 1];
+            }
+            DEBUGMSGTL(("unregister_readfd", "unregistered fd %d\n", fd));
+            return FD_UNREGISTERED_OK;
+        }
+    }
+    return FD_NO_SUCH_REGISTRATION;
+}
+
+int
+unregister_writefd(int fd)
+{
+    int             i, j;
+
+    for (i = 0; i < external_writefdlen; i++) {
+        if (external_writefd[i] == fd) {
+            external_writefdlen--;
+            for (j = i; j < external_writefdlen; j++) {
+                external_writefd[j] = external_writefd[j + 1];
+                external_writefdfunc[j] = external_writefdfunc[j + 1];
+                external_writefd_data[j] = external_writefd_data[j + 1];
+            }
+            DEBUGMSGTL(("unregister_writefd", "unregistered fd %d\n", fd));
+            return FD_UNREGISTERED_OK;
+        }
+    }
+    return FD_NO_SUCH_REGISTRATION;
+}
+
+int
+unregister_exceptfd(int fd)
+{
+    int             i, j;
+
+    for (i = 0; i < external_exceptfdlen; i++) {
+        if (external_exceptfd[i] == fd) {
+            external_exceptfdlen--;
+            for (j = i; j < external_exceptfdlen; j++) {
+                external_exceptfd[j] = external_exceptfd[j + 1];
+                external_exceptfdfunc[j] = external_exceptfdfunc[j + 1];
+                external_exceptfd_data[j] = external_exceptfd_data[j + 1];
+            }
+            DEBUGMSGTL(("unregister_exceptfd", "unregistered fd %d\n",
+                        fd));
+            return FD_UNREGISTERED_OK;
+        }
+    }
+    return FD_NO_SUCH_REGISTRATION;
+}
+
+int             external_signal_scheduled[NUM_EXTERNAL_SIGS];
+void            (*external_signal_handler[NUM_EXTERNAL_SIGS]) (int);
+
+#ifndef WIN32
+
+/*
+ * TODO: add agent_SIGXXX_handler functions and `case SIGXXX: ...' lines
+ *       below for every single that might be handled by register_signal().
+ */
+
+RETSIGTYPE
+agent_SIGCHLD_handler(int sig)
+{
+    external_signal_scheduled[SIGCHLD]++;
+#ifndef HAVE_SIGACTION
+    /*
+     * signal() sucks. It *might* have SysV semantics, which means that
+     * * a signal handler is reset once it gets called. Ensure that it
+     * * remains active.
+     */
+    signal(SIGCHLD, agent_SIGCHLD_handler);
+#endif
+}
+
+int
+register_signal(int sig, void (*func) (int))
+{
+
+    switch (sig) {
+#if defined(SIGCHLD)
+    case SIGCHLD:
+#ifdef HAVE_SIGACTION
+        {
+            static struct sigaction act;
+            act.sa_handler = agent_SIGCHLD_handler;
+            sigemptyset(&act.sa_mask);
+            act.sa_flags = 0;
+            sigaction(SIGCHLD, &act, NULL);
+        }
+#else
+        signal(SIGCHLD, agent_SIGCHLD_handler);
+#endif
+        break;
+#endif
+    default:
+        snmp_log(LOG_CRIT,
+                 "register_signal: signal %d cannot be handled\n", sig);
+        return SIG_REGISTRATION_FAILED;
+    }
+
+    external_signal_handler[sig] = func;
+    external_signal_scheduled[sig] = 0;
+
+    DEBUGMSGTL(("register_signal", "registered signal %d\n", sig));
+    return SIG_REGISTERED_OK;
+}
+
+int
+unregister_signal(int sig)
+{
+    signal(sig, SIG_DFL);
+    DEBUGMSGTL(("unregister_signal", "unregistered signal %d\n", sig));
+    return SIG_UNREGISTERED_OK;
+}
+
+#endif                          /* !WIN32 */
diff -Naur tomato/release/src/router/snmp/agent/agent_trap.c tomato121/release/src/router/snmp/agent/agent_trap.c
--- tomato/release/src/router/snmp/agent/agent_trap.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/agent_trap.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,840 @@
+/*
+ * agent_trap.c: define trap generation routines for mib modules, etc,
+ * to use 
+ */
+
+#include <net-snmp/net-snmp-config.h>
+
+#if HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#if HAVE_NETDB_H
+#include <netdb.h>
+#endif
+#if HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#if HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+#if TIME_WITH_SYS_TIME
+# ifdef WIN32
+#  include <sys/timeb.h>
+# else
+#  include <sys/time.h>
+# endif
+# include <time.h>
+#else
+# if HAVE_SYS_TIME_H
+#  include <sys/time.h>
+# else
+#  include <time.h>
+# endif
+#endif
+#if HAVE_SYS_SOCKET_H
+#include <sys/socket.h>
+#elif HAVE_WINSOCK_H
+#include <winsock.h>
+#endif
+#if HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+#include <net-snmp/utilities.h>
+
+#if HAVE_DMALLOC_H
+#include <dmalloc.h>
+#endif
+
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/agent_trap.h>
+#include <net-snmp/agent/snmp_agent.h>
+#include <net-snmp/agent/agent_callbacks.h>
+
+#include <net-snmp/agent/mib_module_config.h>
+
+struct trap_sink {
+    netsnmp_session *sesp;
+    struct trap_sink *next;
+    int             pdutype;
+    int             version;
+};
+
+struct trap_sink *sinks = NULL;
+
+extern struct timeval starttime;
+
+oid             objid_enterprisetrap[] = { NOTIFICATION_MIB };
+oid             trap_version_id[] = { SYSTEM_MIB };
+int             enterprisetrap_len;
+int             trap_version_id_len;
+
+#define SNMPV2_TRAPS_PREFIX	SNMP_OID_SNMPMODULES,1,1,5
+oid             cold_start_oid[] = { SNMPV2_TRAPS_PREFIX, 1 };  /* SNMPv2-MIB */
+oid             warm_start_oid[] = { SNMPV2_TRAPS_PREFIX, 2 };  /* SNMPv2-MIB */
+oid             link_down_oid[] = { SNMPV2_TRAPS_PREFIX, 3 };   /* IF-MIB */
+oid             link_up_oid[] = { SNMPV2_TRAPS_PREFIX, 4 };     /* IF-MIB */
+oid             auth_fail_oid[] = { SNMPV2_TRAPS_PREFIX, 5 };   /* SNMPv2-MIB */
+oid             egp_xxx_oid[] = { SNMPV2_TRAPS_PREFIX, 99 };    /* ??? */
+
+#define SNMPV2_TRAP_OBJS_PREFIX	SNMP_OID_SNMPMODULES,1,1,4
+oid             snmptrap_oid[] = { SNMPV2_TRAP_OBJS_PREFIX, 1, 0 };
+oid             snmptrapenterprise_oid[] =
+    { SNMPV2_TRAP_OBJS_PREFIX, 3, 0 };
+oid             sysuptime_oid[] = { SNMP_OID_MIB2, 1, 3, 0 };
+size_t          snmptrap_oid_len;
+size_t          snmptrapenterprise_oid_len;
+size_t          sysuptime_oid_len;
+
+
+#define SNMP_AUTHENTICATED_TRAPS_ENABLED	1
+#define SNMP_AUTHENTICATED_TRAPS_DISABLED	2
+
+int             snmp_enableauthentraps = SNMP_AUTHENTICATED_TRAPS_DISABLED;
+int             snmp_enableauthentrapsset = 0;
+char           *snmp_trapcommunity = NULL;
+
+/*
+ * Prototypes 
+ */
+ /*
+  * static int create_v1_trap_session (const char *, u_short, const char *);
+  * static int create_v2_trap_session (const char *, u_short, const char *);
+  * static int create_v2_inform_session (const char *, u_short, const char *);
+  * static void free_trap_session (struct trap_sink *sp);
+  * static void send_v1_trap (netsnmp_session *, int, int);
+  * static void send_v2_trap (netsnmp_session *, int, int, int);
+  */
+
+
+        /*******************
+	 *
+	 * Trap session handling
+	 *
+	 *******************/
+
+void
+init_traps(void)
+{
+    enterprisetrap_len = OID_LENGTH(objid_enterprisetrap);
+    trap_version_id_len = OID_LENGTH(trap_version_id);
+    snmptrap_oid_len = OID_LENGTH(snmptrap_oid);
+    snmptrapenterprise_oid_len = OID_LENGTH(snmptrapenterprise_oid);
+    sysuptime_oid_len = OID_LENGTH(sysuptime_oid);
+}
+
+static void
+free_trap_session(struct trap_sink *sp)
+{
+    snmp_close(sp->sesp);
+    free(sp);
+}
+
+int
+add_trap_session(netsnmp_session * ss, int pdutype, int confirm,
+                 int version)
+{
+    if (snmp_callback_available(SNMP_CALLBACK_APPLICATION,
+                                SNMPD_CALLBACK_REGISTER_NOTIFICATIONS) ==
+        SNMPERR_SUCCESS) {
+        /*
+         * something else wants to handle notification registrations 
+         */
+        struct agent_add_trap_args args;
+        DEBUGMSGTL(("trap", "adding callback trap sink\n"));
+        args.ss = ss;
+        args.confirm = confirm;
+        snmp_call_callbacks(SNMP_CALLBACK_APPLICATION,
+                            SNMPD_CALLBACK_REGISTER_NOTIFICATIONS,
+                            (void *) &args);
+    } else {
+        /*
+         * no other support exists, handle it ourselves. 
+         */
+        struct trap_sink *new_sink;
+
+        DEBUGMSGTL(("trap", "adding internal trap sink\n"));
+        new_sink = (struct trap_sink *) malloc(sizeof(*new_sink));
+        if (new_sink == NULL)
+            return 0;
+
+        new_sink->sesp = ss;
+        new_sink->pdutype = pdutype;
+        new_sink->version = version;
+        new_sink->next = sinks;
+        sinks = new_sink;
+    }
+    return 1;
+}
+
+int
+remove_trap_session(netsnmp_session * ss)
+{
+    struct trap_sink *sp = sinks, *prev = 0;
+
+    while (sp) {
+        if (sp->sesp == ss) {
+            if (prev) {
+                prev->next = sp->next;
+            } else {
+                sinks = sp->next;
+            }
+            /*
+             * I don't believe you *really* want to close the session here;
+             * it may still be in use for other purposes.  In particular this
+             * is awkward for AgentX, since we want to call this function
+             * from the session's callback.  Let's just free the trapsink
+             * data structure.  [jbpn]  
+             */
+            /*
+             * free_trap_session(sp);  
+             */
+            free(sp);
+            return 1;
+        }
+        prev = sp;
+        sp = sp->next;
+    }
+    return 0;
+}
+
+int
+create_trap_session(char *sink, u_short sinkport,
+                    char *com, int version, int pdutype)
+{
+    netsnmp_session session, *sesp;
+    char           *peername = NULL;
+
+    if ((peername = malloc(strlen(sink) + 4 + 32)) == NULL) {
+        return 0;
+    } else {
+        snprintf(peername, strlen(sink) + 4 + 32, "udp:%s:%hu", sink,
+                 sinkport);
+    }
+
+    memset(&session, 0, sizeof(netsnmp_session));
+    session.peername = peername;
+    session.version = version;
+    if (com) {
+        session.community = (u_char *) com;
+        session.community_len = strlen(com);
+    }
+    sesp = snmp_open(&session);
+    free(peername);
+
+    if (sesp) {
+        return add_trap_session(sesp, pdutype,
+                                (pdutype == SNMP_MSG_INFORM), version);
+    }
+
+    /*
+     * diagnose snmp_open errors with the input netsnmp_session pointer 
+     */
+    snmp_sess_perror("snmpd: create_trap_session", &session);
+    return 0;
+}
+
+static int
+create_v1_trap_session(char *sink, u_short sinkport, char *com)
+{
+    return create_trap_session(sink, sinkport, com,
+                               SNMP_VERSION_1, SNMP_MSG_TRAP);
+}
+
+static int
+create_v2_trap_session(char *sink, u_short sinkport, char *com)
+{
+    return create_trap_session(sink, sinkport, com,
+                               SNMP_VERSION_2c, SNMP_MSG_TRAP2);
+}
+
+static int
+create_v2_inform_session(char *sink, u_short sinkport, char *com)
+{
+    return create_trap_session(sink, sinkport, com,
+                               SNMP_VERSION_2c, SNMP_MSG_INFORM);
+}
+
+
+void
+snmpd_free_trapsinks(void)
+{
+    struct trap_sink *sp = sinks;
+    while (sp) {
+        sinks = sinks->next;
+        free_trap_session(sp);
+        sp = sinks;
+    }
+}
+
+        /*******************
+	 *
+	 * Trap handling
+	 *
+	 *******************/
+
+void
+convert_v2_to_v1(netsnmp_variable_list * vars, netsnmp_pdu *template_pdu)
+{
+    netsnmp_variable_list *v, *trap_v = NULL, *ent_v = NULL;
+    oid             trap_prefix[] = { SNMPV2_TRAPS_PREFIX };
+    int             len;
+
+    for (v = vars; v; v = v->next_variable) {
+        if (netsnmp_oid_equals(v->name, v->name_length,
+                             snmptrap_oid, OID_LENGTH(snmptrap_oid)) == 0)
+            trap_v = v;
+        if (netsnmp_oid_equals(v->name, v->name_length,
+                             snmptrapenterprise_oid,
+                             OID_LENGTH(snmptrapenterprise_oid)) == 0)
+            ent_v = v;
+    }
+
+    if (!trap_v)
+        return;                 /* Can't find v2 snmpTrapOID varbind */
+
+    /*
+     * Is this a 'standard' trap?
+     *  Or at least, does it have the correct prefix?
+     */
+    if (netsnmp_oid_equals(trap_v->val.objid, OID_LENGTH(trap_prefix),
+                         trap_prefix, OID_LENGTH(trap_prefix)) == 0) {
+        template_pdu->trap_type =
+            trap_v->val.objid[OID_LENGTH(trap_prefix)] - 1;
+        template_pdu->specific_type = 0;
+    } else {
+        len = trap_v->val_len / sizeof(oid);
+        template_pdu->trap_type = 6;    /* enterprise specific */
+        template_pdu->specific_type = trap_v->val.objid[len - 1];
+    }
+
+    /*
+     *  TODO:
+     *    Extract the appropriate enterprise value from 'ent_v'
+     *    Remove uptime/trapOID varbinds from 'vars' list
+     */
+
+}
+
+void
+send_enterprise_trap_vars(int trap,
+                          int specific,
+                          oid * enterprise, int enterprise_length,
+                          netsnmp_variable_list * vars)
+{
+    netsnmp_variable_list uptime_var, snmptrap_var, enterprise_var;
+    netsnmp_variable_list *v2_vars, *last_var = NULL;
+    netsnmp_pdu    *template_pdu;
+    u_long          uptime;
+    in_addr_t      *pdu_in_addr_t;
+    struct trap_sink *sink;
+    oid             temp_oid[MAX_OID_LEN];
+
+    /*
+     * Initialise SNMPv2 required variables
+     */
+    uptime = netsnmp_get_agent_uptime();
+    memset(&uptime_var, 0, sizeof(netsnmp_variable_list));
+    snmp_set_var_objid(&uptime_var, sysuptime_oid,
+                       OID_LENGTH(sysuptime_oid));
+    snmp_set_var_value(&uptime_var, (u_char *) & uptime, sizeof(uptime));
+    uptime_var.type = ASN_TIMETICKS;
+    uptime_var.next_variable = &snmptrap_var;
+
+    memset(&snmptrap_var, 0, sizeof(netsnmp_variable_list));
+    snmp_set_var_objid(&snmptrap_var, snmptrap_oid,
+                       OID_LENGTH(snmptrap_oid));
+    /*
+     * value set later .... 
+     */
+    snmptrap_var.type = ASN_OBJECT_ID;
+    if (vars)
+        snmptrap_var.next_variable = vars;
+    else
+        snmptrap_var.next_variable = &enterprise_var;
+
+    /*
+     * find end of provided varbind list,
+     * ready to append the enterprise info if necessary 
+     */
+    last_var = vars;
+    while (last_var && last_var->next_variable)
+        last_var = last_var->next_variable;
+
+    memset(&enterprise_var, 0, sizeof(netsnmp_variable_list));
+    snmp_set_var_objid(&enterprise_var,
+                       snmptrapenterprise_oid,
+                       OID_LENGTH(snmptrapenterprise_oid));
+    snmp_set_var_value(&enterprise_var, (u_char *) enterprise,
+                       enterprise_length * sizeof(oid));
+    enterprise_var.type = ASN_OBJECT_ID;
+    enterprise_var.next_variable = NULL;
+
+    v2_vars = &uptime_var;
+
+    /*
+     *  Create a template PDU, ready for sending
+     */
+    template_pdu = snmp_pdu_create(SNMP_MSG_TRAP);
+    if (template_pdu == NULL) {
+        /*
+         * Free memory if value stored dynamically 
+         */
+        snmp_set_var_value(&enterprise_var, NULL, 0);
+        return;
+    }
+    template_pdu->trap_type = trap;
+    template_pdu->specific_type = specific;
+    if (snmp_clone_mem((void **) &template_pdu->enterprise,
+                       enterprise, enterprise_length * sizeof(oid))) {
+        snmp_free_pdu(template_pdu);
+        snmp_set_var_value(&enterprise_var, NULL, 0);
+        return;
+    }
+    template_pdu->enterprise_length = enterprise_length;
+    template_pdu->flags |= UCD_MSG_FLAG_FORCE_PDU_COPY;
+
+    pdu_in_addr_t = (in_addr_t *) template_pdu->agent_addr;
+    *pdu_in_addr_t = get_myaddr();
+    template_pdu->time = uptime;
+
+    /*
+     *  Now use the parameters to determine
+     *    which v2 variables are needed,
+     *    and what values they should take.
+     */
+    switch (trap) {
+    case -1:                   /*
+                                 *      SNMPv2 only
+                                 *  Check to see whether the variables provided
+                                 *    are sufficient for SNMPv2 notifications
+                                 */
+        if (vars && netsnmp_oid_equals(vars->name, vars->name_length,
+                                     sysuptime_oid,
+                                     OID_LENGTH(sysuptime_oid)) == 0)
+            v2_vars = vars;
+        else if (vars && netsnmp_oid_equals(vars->name, vars->name_length,
+                                          snmptrap_oid,
+                                          OID_LENGTH(snmptrap_oid)) == 0)
+            uptime_var.next_variable = vars;
+        else {
+            /*
+             * Hmmm... we don't seem to have a value - oops! 
+             */
+            snmptrap_var.next_variable = vars;
+        }
+        last_var = NULL;        /* Don't need enterprise info */
+        convert_v2_to_v1(vars, template_pdu);
+        break;
+
+        /*
+         * "Standard" SNMPv1 traps 
+         */
+
+    case SNMP_TRAP_COLDSTART:
+        snmp_set_var_value(&snmptrap_var,
+                           (u_char *) cold_start_oid,
+                           sizeof(cold_start_oid));
+        break;
+    case SNMP_TRAP_WARMSTART:
+        snmp_set_var_value(&snmptrap_var,
+                           (u_char *) warm_start_oid,
+                           sizeof(warm_start_oid));
+        break;
+    case SNMP_TRAP_LINKDOWN:
+        snmp_set_var_value(&snmptrap_var,
+                           (u_char *) link_down_oid,
+                           sizeof(link_down_oid));
+        break;
+    case SNMP_TRAP_LINKUP:
+        snmp_set_var_value(&snmptrap_var,
+                           (u_char *) link_up_oid, sizeof(link_up_oid));
+        break;
+    case SNMP_TRAP_AUTHFAIL:
+        if (snmp_enableauthentraps == SNMP_AUTHENTICATED_TRAPS_DISABLED) {
+            snmp_free_pdu(template_pdu);
+            snmp_set_var_value(&enterprise_var, NULL, 0);
+            return;
+        }
+        snmp_set_var_value(&snmptrap_var,
+                           (u_char *) auth_fail_oid,
+                           sizeof(auth_fail_oid));
+        break;
+    case SNMP_TRAP_EGPNEIGHBORLOSS:
+        snmp_set_var_value(&snmptrap_var,
+                           (u_char *) egp_xxx_oid, sizeof(egp_xxx_oid));
+        break;
+
+    case SNMP_TRAP_ENTERPRISESPECIFIC:
+        memcpy(temp_oid,
+               (char *) enterprise, (enterprise_length) * sizeof(oid));
+        temp_oid[enterprise_length] = 0;
+        temp_oid[enterprise_length + 1] = specific;
+        snmp_set_var_value(&snmptrap_var,
+                           (u_char *) temp_oid,
+                           (enterprise_length + 2) * sizeof(oid));
+        snmptrap_var.next_variable = vars;
+        last_var = NULL;        /* Don't need version info */
+        break;
+    }
+
+
+    /*
+     *  Now loop through the list of trap sinks,
+     *   sending an appropriately formatted PDU to each
+     */
+    for (sink = sinks; sink; sink = sink->next) {
+        if (sink->version == SNMP_VERSION_1 && trap == -1)
+            continue;           /* Skip v1 sinks for v2 only traps */
+        template_pdu->command = sink->pdutype;
+
+        if (sink->version != SNMP_VERSION_1) {
+            template_pdu->variables = v2_vars;
+            if (last_var)
+                last_var->next_variable = &enterprise_var;
+        } else
+            template_pdu->variables = vars;
+
+        send_trap_to_sess(sink->sesp, template_pdu);
+
+        if (sink->version != SNMP_VERSION_1 && last_var)
+            last_var->next_variable = NULL;
+    }
+
+    /*
+     * send stuff to registered callbacks 
+     */
+    /*
+     * v2 traps/informs 
+     */
+    template_pdu->variables = v2_vars;
+    if (last_var)
+        last_var->next_variable = &enterprise_var;
+
+    snmp_call_callbacks(SNMP_CALLBACK_APPLICATION,
+                        SNMPD_CALLBACK_SEND_TRAP2, template_pdu);
+
+    if (last_var)
+        last_var->next_variable = NULL;
+
+    /*
+     * v1 traps 
+     */
+    template_pdu->command = SNMP_MSG_TRAP;
+    template_pdu->variables = vars;
+
+    snmp_call_callbacks(SNMP_CALLBACK_APPLICATION,
+                        SNMPD_CALLBACK_SEND_TRAP1, template_pdu);
+
+    /*
+     * Free memory if values stored dynamically 
+     */
+    snmp_set_var_value(&enterprise_var, NULL, 0);
+    snmp_set_var_value(&snmptrap_var, NULL, 0);
+    /*
+     * Ensure we don't free anything we shouldn't 
+     */
+    if (last_var)
+        last_var->next_variable = NULL;
+    template_pdu->variables = NULL;
+    snmp_free_pdu(template_pdu);
+}
+
+/*
+ * send_trap_to_sess: sends a trap to a session but assumes that the
+ * pdu is constructed correctly for the session type. 
+ */
+void
+send_trap_to_sess(netsnmp_session * sess, netsnmp_pdu *template_pdu)
+{
+    netsnmp_pdu    *pdu;
+
+    if (!sess || !template_pdu)
+        return;
+
+    DEBUGMSGTL(("trap", "sending trap type=%d, version=%d\n",
+                template_pdu->command, sess->version));
+
+    if (sess->version == SNMP_VERSION_1 &&
+        (template_pdu->command == SNMP_MSG_TRAP2 ||
+         template_pdu->command == SNMP_MSG_INFORM))
+        return;                 /* Skip v1 sinks for v2 only traps */
+    template_pdu->version = sess->version;
+    pdu = snmp_clone_pdu(template_pdu);
+    pdu->sessid = sess->sessid; /* AgentX only ? */
+    if (snmp_send(sess, pdu) == 0) {
+        snmp_sess_perror("snmpd: send_trap", sess);
+        snmp_free_pdu(pdu);
+    } else {
+        snmp_increment_statistic(STAT_SNMPOUTTRAPS);
+        snmp_increment_statistic(STAT_SNMPOUTPKTS);
+    }
+}
+
+void
+send_trap_vars(int trap, int specific, netsnmp_variable_list * vars)
+{
+    if (trap == SNMP_TRAP_ENTERPRISESPECIFIC)
+        send_enterprise_trap_vars(trap, specific, objid_enterprisetrap,
+                                  OID_LENGTH(objid_enterprisetrap), vars);
+    else
+        send_enterprise_trap_vars(trap, specific, trap_version_id,
+                                  OID_LENGTH(trap_version_id), vars);
+}
+
+void
+send_easy_trap(int trap, int specific)
+{
+    send_trap_vars(trap, specific, NULL);
+}
+
+void
+send_v2trap(netsnmp_variable_list * vars)
+{
+    send_trap_vars(-1, -1, vars);
+}
+
+void
+send_trap_pdu(netsnmp_pdu *pdu)
+{
+    send_trap_vars(-1, -1, pdu->variables);
+}
+
+
+
+        /*******************
+	 *
+	 * Config file handling
+	 *
+	 *******************/
+
+void
+snmpd_parse_config_authtrap(const char *token, char *cptr)
+{
+    int             i;
+
+    i = atoi(cptr);
+    if (i == 0) {
+        if (strcmp(cptr, "enable") == 0) {
+            i = SNMP_AUTHENTICATED_TRAPS_ENABLED;
+        } else if (strcmp(cptr, "disable") == 0) {
+            i = SNMP_AUTHENTICATED_TRAPS_DISABLED;
+        }
+    }
+    if (i < 1 || i > 2) {
+        config_perror("authtrapenable must be 1 or 2");
+    } else {
+        if (strcmp(token, "pauthtrapenable") == 0) {
+            if (snmp_enableauthentrapsset < 0) {
+                /*
+                 * This is bogus (and shouldn't happen anyway) -- the value
+                 * of snmpEnableAuthenTraps.0 is already configured
+                 * read-only.  
+                 */
+                snmp_log(LOG_WARNING,
+                         "ignoring attempted override of read-only snmpEnableAuthenTraps.0\n");
+                return;
+            } else {
+                snmp_enableauthentrapsset++;
+            }
+        } else {
+            if (snmp_enableauthentrapsset > 0) {
+                /*
+                 * This is bogus (and shouldn't happen anyway) -- we already
+                 * read a persistent value of snmpEnableAuthenTraps.0, which
+                 * we should ignore in favour of this one.  
+                 */
+                snmp_log(LOG_WARNING,
+                         "ignoring attempted override of read-only snmpEnableAuthenTraps.0\n");
+                /*
+                 * Fall through and copy in this value.  
+                 */
+            }
+            snmp_enableauthentrapsset = -1;
+        }
+        snmp_enableauthentraps = i;
+    }
+}
+
+void
+snmpd_parse_config_trapsink(const char *token, char *cptr)
+{
+    char            tmpbuf[1024];
+    char           *sp, *cp, *pp = NULL;
+    u_short         sinkport;
+
+    if (!snmp_trapcommunity)
+        snmp_trapcommunity = strdup("public");
+    sp = strtok(cptr, " \t\n");
+    cp = strtok(NULL, " \t\n");
+    if (cp)
+        pp = strtok(NULL, " \t\n");
+    if (cp && pp) {
+        sinkport = atoi(pp);
+        if ((sinkport < 1) || (sinkport > 0xffff)) {
+            config_perror("trapsink port out of range");
+            sinkport = SNMP_TRAP_PORT;
+        }
+    } else {
+        sinkport = SNMP_TRAP_PORT;
+    }
+    if (create_v1_trap_session(sp, sinkport,
+                               cp ? cp : snmp_trapcommunity) == 0) {
+        snprintf(tmpbuf, sizeof(tmpbuf), "cannot create trapsink: %s", cptr);
+        tmpbuf[sizeof(tmpbuf)-1] = '\0';
+        config_perror(tmpbuf);
+    }
+}
+
+
+void
+snmpd_parse_config_trap2sink(const char *word, char *cptr)
+{
+    char            tmpbuf[1024];
+    char           *sp, *cp, *pp = NULL;
+    u_short         sinkport;
+
+    if (!snmp_trapcommunity)
+        snmp_trapcommunity = strdup("public");
+    sp = strtok(cptr, " \t\n");
+    cp = strtok(NULL, " \t\n");
+    if (cp)
+        pp = strtok(NULL, " \t\n");
+    if (cp && pp) {
+        sinkport = atoi(pp);
+        if ((sinkport < 1) || (sinkport > 0xffff)) {
+            config_perror("trapsink port out of range");
+            sinkport = SNMP_TRAP_PORT;
+        }
+    } else {
+        sinkport = SNMP_TRAP_PORT;
+    }
+    if (create_v2_trap_session(sp, sinkport,
+                               cp ? cp : snmp_trapcommunity) == 0) {
+        snprintf(tmpbuf, sizeof(tmpbuf), "cannot create trap2sink: %s", cptr);
+        tmpbuf[sizeof(tmpbuf)-1] = '\0';
+        config_perror(tmpbuf);
+    }
+}
+
+void
+snmpd_parse_config_informsink(const char *word, char *cptr)
+{
+    char            tmpbuf[1024];
+    char           *sp, *cp, *pp = NULL;
+    u_short         sinkport;
+
+    if (!snmp_trapcommunity)
+        snmp_trapcommunity = strdup("public");
+    sp = strtok(cptr, " \t\n");
+    cp = strtok(NULL, " \t\n");
+    if (cp)
+        pp = strtok(NULL, " \t\n");
+    if (cp && pp) {
+        sinkport = atoi(pp);
+        if ((sinkport < 1) || (sinkport > 0xffff)) {
+            config_perror("trapsink port out of range");
+            sinkport = SNMP_TRAP_PORT;
+        }
+    } else {
+        sinkport = SNMP_TRAP_PORT;
+    }
+    if (create_v2_inform_session(sp, sinkport,
+                                 cp ? cp : snmp_trapcommunity) == 0) {
+        snprintf(tmpbuf, sizeof(tmpbuf), "cannot create informsink: %s", cptr);
+        tmpbuf[sizeof(tmpbuf)-1] = '\0';
+        config_perror(tmpbuf);
+    }
+}
+
+/*
+ * this must be standardized somewhere, right? 
+ */
+#define MAX_ARGS 128
+
+static int      traptype;
+
+static void
+trapOptProc(int argc, char *const *argv, int opt)
+{
+    switch (opt) {
+    case 'C':
+        while (*optarg) {
+            switch (*optarg++) {
+            case 'i':
+                traptype = SNMP_MSG_INFORM;
+                break;
+            default:
+                config_perror("unknown argument passed to -C");
+                break;
+            }
+        }
+        break;
+    }
+}
+
+
+void
+snmpd_parse_config_trapsess(const char *word, char *cptr)
+{
+    char           *argv[MAX_ARGS], *cp = cptr, tmp[SPRINT_MAX_LEN];
+    int             argn, arg;
+    netsnmp_session session, *ss;
+
+    /*
+     * inform or trap?  default to trap 
+     */
+    traptype = SNMP_MSG_TRAP2;
+
+    /*
+     * create the argv[] like array 
+     */
+    argv[0] = strdup("snmpd-trapsess"); /* bogus entry for getopt() */
+    for (argn = 1; cp && argn < MAX_ARGS; argn++) {
+        cp = copy_nword(cp, tmp, SPRINT_MAX_LEN);
+        argv[argn] = strdup(tmp);
+    }
+
+    arg = snmp_parse_args(argn, argv, &session, "C:", trapOptProc);
+    ss = snmp_open(&session);
+
+    for (; argn > 0; argn--) {
+        free(argv[argn - 1]);
+    }
+
+    if (!ss) {
+        config_perror
+            ("snmpd: failed to parse this line or the remote trap receiver is down.  Possible cause:");
+        snmp_sess_perror("snmpd: snmpd_parse_config_trapsess()", &session);
+        return;
+    }
+
+    if (ss->version == SNMP_VERSION_1) {
+        add_trap_session(ss, SNMP_MSG_TRAP, 0, SNMP_VERSION_1);
+    } else {
+        add_trap_session(ss, traptype, (traptype == SNMP_MSG_INFORM),
+                         ss->version);
+    }
+}
+
+void
+snmpd_parse_config_trapcommunity(const char *word, char *cptr)
+{
+    if (snmp_trapcommunity != NULL) {
+        free(snmp_trapcommunity);
+    }
+    snmp_trapcommunity = (char *) malloc(strlen(cptr) + 1);
+    if (snmp_trapcommunity != NULL) {
+        copy_nword(cptr, snmp_trapcommunity, strlen(cptr) + 1);
+    }
+}
+
+void
+snmpd_free_trapcommunity(void)
+{
+    if (snmp_trapcommunity) {
+        free(snmp_trapcommunity);
+        snmp_trapcommunity = NULL;
+    }
+}
diff -Naur tomato/release/src/router/snmp/agent/auto_nlist.c tomato121/release/src/router/snmp/agent/auto_nlist.c
--- tomato/release/src/router/snmp/agent/auto_nlist.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/auto_nlist.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,241 @@
+#include <net-snmp/net-snmp-config.h>
+
+#ifdef CAN_USE_NLIST
+#if HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+
+#if HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#include <stdio.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <netinet/in.h>
+#ifdef HAVE_NLIST_H
+#include <nlist.h>
+#endif
+#if HAVE_KVM_H
+#include <kvm.h>
+#endif
+
+#if HAVE_DMALLOC_H
+#include <dmalloc.h>
+#endif
+
+#include <net-snmp/agent/auto_nlist.h>
+#include "autonlist.h"
+#include "kernel.h"
+
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/ds_agent.h>
+
+struct autonlist *nlists = 0;
+static void     init_nlist(struct nlist *);
+
+long
+auto_nlist_value(const char *string)
+{
+    struct autonlist **ptr, *it = 0;
+    int             cmp;
+
+    if (string == 0)
+        return 0;
+
+    ptr = &nlists;
+    while (*ptr != 0 && it == 0) {
+        cmp = strcmp((*ptr)->symbol, string);
+        if (cmp == 0)
+            it = *ptr;
+        else if (cmp < 0) {
+            ptr = &((*ptr)->left);
+        } else {
+            ptr = &((*ptr)->right);
+        }
+    }
+    if (*ptr == 0) {
+        *ptr = (struct autonlist *) malloc(sizeof(struct autonlist));
+        it = *ptr;
+        it->left = 0;
+        it->right = 0;
+        it->symbol = (char *) malloc(strlen(string) + 1);
+        strcpy(it->symbol, string);
+        /*
+         * allocate an extra byte for inclusion of a preceding '_' later 
+         */
+        it->nl[0].n_name = (char *) malloc(strlen(string) + 2);
+#ifdef aix4
+        strcpy(it->nl[0].n_name, string);
+#else
+        sprintf(it->nl[0].n_name, "_%s", string);
+#endif
+        it->nl[1].n_name = 0;
+        init_nlist(it->nl);
+#ifndef aix4
+        if (it->nl[0].n_type == 0) {
+            strcpy(it->nl[0].n_name, string);
+            init_nlist(it->nl);
+        }
+#endif
+        if (it->nl[0].n_type == 0) {
+            if (!netsnmp_ds_get_boolean(NETSNMP_DS_APPLICATION_ID, 
+					NETSNMP_DS_AGENT_NO_ROOT_ACCESS)) {
+                snmp_log(LOG_ERR, "nlist err: neither %s nor _%s found.\n",
+                         string, string);
+	    }
+            return (-1);
+        } else {
+            DEBUGMSGTL(("auto_nlist", "nlist:  found symbol %s at %x.\n",
+                        it->symbol, it->nl[0].n_value));
+            return (it->nl[0].n_value);
+        }
+    } else
+        return (it->nl[0].n_value);
+}
+
+int
+auto_nlist(const char *string, char *var, int size)
+{
+    long            result;
+    int             ret;
+    result = auto_nlist_value(string);
+    if (result != -1) {
+        if (var != NULL) {
+            ret = klookup(result, var, size);
+            if (!ret)
+                snmp_log(LOG_ERR,
+                         "auto_nlist failed on %s at location %lx\n",
+                         string, result);
+            return ret;
+        } else
+            return 1;
+    }
+    return 0;
+}
+
+static void
+init_nlist(struct nlist nl[])
+{
+#ifdef CAN_USE_NLIST
+    int             ret;
+#if HAVE_KVM_OPENFILES
+    kvm_t          *kernel;
+    char            kvm_errbuf[4096];
+
+    if ((kernel = kvm_openfiles(KERNEL_LOC, NULL, NULL, O_RDONLY, kvm_errbuf))
+	== NULL) {
+        if (netsnmp_ds_get_boolean(NETSNMP_DS_APPLICATION_ID, 
+				   NETSNMP_DS_AGENT_NO_ROOT_ACCESS)) {
+            return;
+	} else {
+            snmp_log_perror("kvm_openfiles");
+            snmp_log(LOG_ERR, "kvm_openfiles: %s\n", kvm_errbuf);
+            exit(1);
+        }
+    }
+    if ((ret = kvm_nlist(kernel, nl)) == -1) {
+        if (netsnmp_ds_get_boolean(NETSNMP_DS_APPLICATION_ID, 
+				   NETSNMP_DS_AGENT_NO_ROOT_ACCESS)) {
+            return;
+	} else {
+            snmp_log_perror("kvm_nlist");
+            exit(1);
+        }
+    }
+    kvm_close(kernel);
+#else                           /* ! HAVE_KVM_OPENFILES */
+#if defined(aix4) && defined(HAVE_KNLIST)
+    if (knlist(nl, 1, sizeof(struct nlist)) == -1) {
+        DEBUGMSGTL(("auto_nlist", "knlist failed on symbol:  %s\n",
+                    nl[0].n_name));
+        if (errno == EFAULT) {
+            nl[0].n_type = 0;
+            nl[0].n_value = 0;
+        } else {
+            snmp_log_perror("knlist");
+            if (netsnmp_ds_get_boolean(NETSNMP_DS_APPLICATION_ID, 
+				       NETSNMP_DS_AGENT_NO_ROOT_ACCESS)) {
+                return;
+	    } else {
+                exit(1);
+	    }
+        }
+    }
+#else
+    if ((ret = nlist(KERNEL_LOC, nl)) == -1) {
+        if (netsnmp_ds_get_boolean(NETSNMP_DS_APPLICATION_ID, 
+				   NETSNMP_DS_AGENT_NO_ROOT_ACCESS)) {
+            return;
+	} else {
+            snmp_log_perror("nlist");
+            exit(1);
+        }
+    }
+#endif                          /*aix4 */
+#endif                          /* ! HAVE_KVM_OPENFILES */
+    for (ret = 0; nl[ret].n_name != NULL; ret++) {
+#ifdef aix4
+        if (nl[ret].n_type == 0 && nl[ret].n_value != 0)
+            nl[ret].n_type = 1;
+#endif
+        if (nl[ret].n_type == 0) {
+            if (!netsnmp_ds_get_boolean(NETSNMP_DS_APPLICATION_ID, 
+					NETSNMP_DS_AGENT_NO_ROOT_ACCESS)) {
+                DEBUGMSGTL(("auto_nlist", "nlist err:  %s not found\n",
+                            nl[ret].n_name));
+	    }
+        } else {
+            DEBUGMSGTL(("auto_nlist", "nlist: %s 0x%X\n", nl[ret].n_name,
+                        (unsigned int) nl[ret].n_value));
+        }
+    }
+#endif                          /* CAN_USE_NLIST */
+}
+
+int
+KNLookup(struct nlist nl[], int nl_which, char *buf, int s)
+{
+    struct nlist   *nlp = &nl[nl_which];
+
+    if (nlp->n_value == 0) {
+        snmp_log(LOG_ERR, "Accessing non-nlisted variable: %s\n",
+                 nlp->n_name);
+        nlp->n_value = -1;      /* only one error message ... */
+        return 0;
+    }
+    if (nlp->n_value == -1)
+        return 0;
+
+    return klookup(nlp->n_value, buf, s);
+}
+
+#ifdef TESTING
+void
+auto_nlist_print_tree(int indent, struct autonlist *ptr)
+{
+    char            buf[1024];
+    if (indent == -2) {
+        snmp_log(LOG_ERR, "nlist tree:\n");
+        auto_nlist_print_tree(12, nlists);
+    } else {
+        if (ptr == 0)
+            return;
+        sprintf(buf, "%%%ds\n", indent);
+        /*
+         * DEBUGMSGTL(("auto_nlist", "buf: %s\n",buf)); 
+         */
+        DEBUGMSGTL(("auto_nlist", buf, ptr->symbol));
+        auto_nlist_print_tree(indent + 2, ptr->left);
+        auto_nlist_print_tree(indent + 2, ptr->right);
+    }
+}
+#endif
+#else                           /* !CAN_USE_NLIST */
+int
+auto_nlist_noop(void)
+{
+    return 0;
+}
+#endif                          /* CAN_USE_NLIST */
diff -Naur tomato/release/src/router/snmp/agent/autonlist.h tomato121/release/src/router/snmp/agent/autonlist.h
--- tomato/release/src/router/snmp/agent/autonlist.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/autonlist.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,10 @@
+#ifndef AUTONLIST_H
+
+struct autonlist {
+    char           *symbol;
+    struct nlist    nl[2];
+    struct autonlist *left, *right;
+};
+
+#define AUTONLIST_H
+#endif
diff -Naur tomato/release/src/router/snmp/agent/.cvsignore tomato121/release/src/router/snmp/agent/.cvsignore
--- tomato/release/src/router/snmp/agent/.cvsignore	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/.cvsignore	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,12 @@
+.pure
+.purify
+.nfs*
+.gdb.auto.init
+.gdbinit
+.index
+Makefile
+mib.txt
+snmpd
+.libs
+*.lo
+*.la
diff -Naur tomato/release/src/router/snmp/agent/dlmods/.cvsignore tomato121/release/src/router/snmp/agent/dlmods/.cvsignore
--- tomato/release/src/router/snmp/agent/dlmods/.cvsignore	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/dlmods/.cvsignore	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1 @@
+Makefile
diff -Naur tomato/release/src/router/snmp/agent/helpers/all_helpers.c tomato121/release/src/router/snmp/agent/helpers/all_helpers.c
--- tomato/release/src/router/snmp/agent/helpers/all_helpers.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/helpers/all_helpers.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,39 @@
+/** @name handler
+ *  @{ */
+
+#include <net-snmp/net-snmp-config.h>
+
+#ifdef STILL_TO_DO
+        /*
+         * It ought to be possible to just #include these files,
+         *   but they rely on various other types being defined first.
+         *
+         * I really can't face tracking down the dependency chain
+         *   just at the moment.
+         * So we'll just have to live with the warnings....
+         */
+#include <net-snmp/agent/debug_handler.h>
+#include <net-snmp/agent/serialize.h>
+#include <net-snmp/agent/read_only.h>
+#include <net-snmp/agent/bulk_to_next.h>
+
+#else
+
+void  netsnmp_init_debug_helper(void);
+void  netsnmp_init_serialize(void);
+void  netsnmp_init_read_only_helper(void);
+void  netsnmp_init_bulk_to_next_helper(void);
+
+#endif
+
+/** call the initialization sequence for all handlers with init_ routines. */
+void
+netsnmp_init_helpers(void)
+{
+    netsnmp_init_debug_helper();
+    netsnmp_init_serialize();
+    netsnmp_init_read_only_helper();
+    netsnmp_init_bulk_to_next_helper();
+}
+
+/** @} */
diff -Naur tomato/release/src/router/snmp/agent/helpers/bulk_to_next.c tomato121/release/src/router/snmp/agent/helpers/bulk_to_next.c
--- tomato/release/src/router/snmp/agent/helpers/bulk_to_next.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/helpers/bulk_to_next.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,99 @@
+#include <net-snmp/net-snmp-config.h>
+
+#if HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+#include <net-snmp/agent/bulk_to_next.h>
+
+#if HAVE_DMALLOC_H
+#include <dmalloc.h>
+#endif
+
+/** @defgroup bulk_to_next bulk_to_next: convert GETBULK requests into GETNEXT requests for the handler.
+ *  The only purpose of this handler is to convert a GETBULK request
+ *  to a GETNEXT request.  It is inserted into handler chains where
+ *  the handler has not set the HANDLER_CAN_GETBULK flag.
+ *  @ingroup handler
+ *  @{
+ */
+
+/** returns a bulk_to_next handler that can be injected into a given
+ *  handler chain.
+ */
+netsnmp_mib_handler *
+netsnmp_get_bulk_to_next_handler(void)
+{
+    return netsnmp_create_handler("bulk_to_next",
+                                  netsnmp_bulk_to_next_helper);
+}
+
+/** takes answered requests and decrements the repeat count and
+ *  updates the requests to the next to-do varbind in the list */
+void
+netsnmp_bulk_to_next_fix_requests(netsnmp_request_info *requests)
+{
+    netsnmp_request_info *request;
+    /*
+     * update the varbinds for the next request series 
+     */
+    for (request = requests; request; request = request->next) {
+        if (request->repeat > 0 &&
+            request->requestvb->type != ASN_NULL &&
+            request->requestvb->type != ASN_PRIV_RETRY) {
+            request->repeat--;
+            snmp_set_var_objid(request->requestvb->next_variable,
+                               request->requestvb->name,
+                               request->requestvb->name_length);
+            request->requestvb = request->requestvb->next_variable;
+            request->requestvb->type = ASN_PRIV_RETRY;
+        }
+    }
+}
+
+/** @internal Implements the bulk_to_next handler */
+int
+netsnmp_bulk_to_next_helper(netsnmp_mib_handler *handler,
+                            netsnmp_handler_registration *reginfo,
+                            netsnmp_agent_request_info *reqinfo,
+                            netsnmp_request_info *requests)
+{
+
+    int             ret;
+
+    switch (reqinfo->mode) {
+
+    case MODE_GETBULK:
+        reqinfo->mode = MODE_GETNEXT;
+        ret =
+            netsnmp_call_next_handler(handler, reginfo, reqinfo, requests);
+        reqinfo->mode = MODE_GETBULK;
+
+        /*
+         * update the varbinds for the next request series 
+         */
+        netsnmp_bulk_to_next_fix_requests(requests);
+        return ret;
+
+    default:
+        return netsnmp_call_next_handler(handler, reginfo, reqinfo,
+                                         requests);
+    }
+    return SNMP_ERR_GENERR;     /* should never get here */
+}
+
+/** initializes the bulk_to_next helper which then registers a bulk_to_next
+ *  handler as a run-time injectable handler for configuration file
+ *  use.
+ */
+void
+netsnmp_init_bulk_to_next_helper(void)
+{
+    netsnmp_register_handler_by_name("bulk_to_next",
+                                     netsnmp_get_bulk_to_next_handler());
+}
diff -Naur tomato/release/src/router/snmp/agent/helpers/.cvsignore tomato121/release/src/router/snmp/agent/helpers/.cvsignore
--- tomato/release/src/router/snmp/agent/helpers/.cvsignore	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/helpers/.cvsignore	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,6 @@
+.libs
+Makefile
+*.lo
+*.la
+.gdb.auto.init
+.gdbinit
diff -Naur tomato/release/src/router/snmp/agent/helpers/debug_handler.c tomato121/release/src/router/snmp/agent/helpers/debug_handler.c
--- tomato/release/src/router/snmp/agent/helpers/debug_handler.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/helpers/debug_handler.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,150 @@
+#include <net-snmp/net-snmp-config.h>
+
+#if HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+#include <net-snmp/agent/debug_handler.h>
+
+#if HAVE_DMALLOC_H
+#include <dmalloc.h>
+#endif
+
+/** @defgroup debug debug: print out debugging information about the handler chain being called.
+ *  This is a useful module for run-time
+ *  debugging of requests as the pass this handler in a calling chain.
+ *  All debugging output is done via the standard debugging routines
+ *  with a token name of "helper:debug", so use the -Dhelper:debug
+ *  command line flag to see the output when running the snmpd
+ *  demon. It's not recommended you compile this into a handler chain
+ *  during compile time, but instead use the "injectHandler" token in
+ *  the snmpd.conf file (or similar) to add it to the chain later:
+ *
+ *     injectHandler debug my_module_name
+ *
+ *  to see an example output, try:
+ *
+ *     injectHandler debug mibII/system
+ *
+ *  and then run snmpwalk on the "system" group.
+ *
+ *  @ingroup handler
+ *  @{
+ */
+
+/** returns a debug handler that can be injected into a given
+ *  handler chain.
+ */
+netsnmp_mib_handler *
+netsnmp_get_debug_handler(void)
+{
+    return netsnmp_create_handler("debug", netsnmp_debug_helper);
+}
+
+/** @internal debug print variables in a chain */
+void
+debug_print_requests(netsnmp_request_info *requests)
+{
+    netsnmp_request_info *request;
+
+    for (request = requests; request; request = request->next) {
+        DEBUGMSGTL(("helper:debug", "      #%2d: ", request->index));
+        DEBUGMSGVAR(("helper:debug", request->requestvb));
+        DEBUGMSG(("helper:debug", "\n"));
+
+        if (request->processed)
+            DEBUGMSGTL(("helper:debug", "        [processed]\n"));
+        if (request->delegated)
+            DEBUGMSGTL(("helper:debug", "        [delegated]\n"));
+        if (request->status)
+            DEBUGMSGTL(("helper:debug", "        [status = %d]\n",
+                        request->status));
+        if (request->parent_data) {
+            netsnmp_data_list *lst;
+            DEBUGMSGTL(("helper:debug", "        [parent data ="));
+            for (lst = request->parent_data; lst; lst = lst->next) {
+                DEBUGMSG(("helper:debug", " %s", lst->name));
+            }
+            DEBUGMSG(("helper:debug", "]\n"));
+        }
+    }
+}
+
+
+/** @internal Implements the debug handler */
+int
+netsnmp_debug_helper(netsnmp_mib_handler *handler,
+                     netsnmp_handler_registration *reginfo,
+                     netsnmp_agent_request_info *reqinfo,
+                     netsnmp_request_info *requests)
+{
+
+    netsnmp_mib_handler *hptr;
+    int             i, ret, count;
+
+    DEBUGMSGTL(("helper:debug", "Entering Debugging Helper:\n"));
+    DEBUGMSGTL(("helper:debug", "  Handler Registration Info:\n"));
+    DEBUGMSGTL(("helper:debug", "    Name:        %s\n",
+                reginfo->handlerName));
+    DEBUGMSGTL(("helper:debug", "    Context:     %s\n",
+                reginfo->contextName));
+    DEBUGMSGTL(("helper:debug", "    Base OID:    "));
+    DEBUGMSGOID(("helper:debug", reginfo->rootoid, reginfo->rootoid_len));
+    DEBUGMSG(("helper:debug", "\n"));
+
+    DEBUGMSGTL(("helper:debug", "    Modes:       0x%x = ",
+                reginfo->modes));
+    for (count = 0, i = reginfo->modes; i; i = i >> 1, count++) {
+        if (i & 0x01) {
+            DEBUGMSG(("helper:debug", "%s | ",
+                      se_find_label_in_slist("handler_can_mode",
+                                             0x01 << count)));
+        }
+    }
+    DEBUGMSG(("helper:debug", "\n"));
+
+    DEBUGMSGTL(("helper:debug", "    Priority:    %d\n",
+                reginfo->priority));
+
+    DEBUGMSGTL(("helper:debug", "  Handler Calling Chain:\n"));
+    DEBUGMSGTL(("helper:debug", "   "));
+    for (hptr = reginfo->handler; hptr; hptr = hptr->next) {
+        DEBUGMSG(("helper:debug", " -> %s", hptr->handler_name));
+        if (hptr->myvoid)
+            DEBUGMSG(("helper:debug", " [myvoid = %x]", hptr->myvoid));
+    }
+    DEBUGMSG(("helper:debug", "\n"));
+
+    DEBUGMSGTL(("helper:debug", "  Request information:\n"));
+    DEBUGMSGTL(("helper:debug", "    Mode:        %s (%d = 0x%x)\n",
+                se_find_label_in_slist("agent_mode", reqinfo->mode),
+                reqinfo->mode, reqinfo->mode));
+    DEBUGMSGTL(("helper:debug", "    Request Variables:\n"));
+    debug_print_requests(requests);
+
+    DEBUGMSGTL(("helper:debug", "  --- calling next handler --- \n"));
+    ret = netsnmp_call_next_handler(handler, reginfo, reqinfo, requests);
+
+    DEBUGMSGTL(("helper:debug", "  Results:\n"));
+    DEBUGMSGTL(("helper:debug", "    Returned code: %d\n", ret));
+    DEBUGMSGTL(("helper:debug", "    Returned Variables:\n"));
+    debug_print_requests(requests);
+
+    DEBUGMSGTL(("helper:debug", "Exiting Debugging Helper:\n"));
+    return ret;
+}
+
+/** initializes the debug helper which then registers a debug
+ *  handler as a run-time injectable handler for configuration file
+ *  use.
+ */
+void
+netsnmp_init_debug_helper(void)
+{
+    netsnmp_register_handler_by_name("debug", netsnmp_get_debug_handler());
+}
diff -Naur tomato/release/src/router/snmp/agent/helpers/instance.c tomato121/release/src/router/snmp/agent/helpers/instance.c
--- tomato/release/src/router/snmp/agent/helpers/instance.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/helpers/instance.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,524 @@
+#include <net-snmp/net-snmp-config.h>
+
+#include <stdlib.h>
+#if HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+#include <net-snmp/agent/instance.h>
+#include <net-snmp/agent/serialize.h>
+#include <net-snmp/agent/read_only.h>
+
+#if HAVE_DMALLOC_H
+#include <dmalloc.h>
+#endif
+
+/** @defgroup instance instance: process scalars and other instances easily.
+ *  @ingroup handler
+ *  @{
+ */
+netsnmp_mib_handler *
+netsnmp_get_instance_handler(void)
+{
+    return netsnmp_create_handler("instance",
+                                  netsnmp_instance_helper_handler);
+}
+
+int
+netsnmp_register_instance(netsnmp_handler_registration *reginfo)
+{
+    netsnmp_inject_handler(reginfo, netsnmp_get_instance_handler());
+    return netsnmp_register_serialize(reginfo);
+}
+
+int
+netsnmp_register_read_only_instance(netsnmp_handler_registration *reginfo)
+{
+    netsnmp_inject_handler(reginfo, netsnmp_get_instance_handler());
+    netsnmp_inject_handler(reginfo, netsnmp_get_read_only_handler());
+    return netsnmp_register_serialize(reginfo);
+}
+
+static
+netsnmp_handler_registration *
+get_reg(const char *name,
+        const char *ourname,
+        oid * reg_oid, size_t reg_oid_len,
+        void *it,
+        int modes,
+        Netsnmp_Node_Handler * scalarh, Netsnmp_Node_Handler * subhandler)
+{
+    netsnmp_handler_registration *myreg;
+    netsnmp_mib_handler *myhandler;
+
+    if (subhandler) {
+        myreg =
+            netsnmp_create_handler_registration(name,
+                                                subhandler,
+                                                reg_oid, reg_oid_len,
+                                                modes);
+        myhandler = netsnmp_create_handler(ourname, scalarh);
+        myhandler->myvoid = (void *) it;
+        netsnmp_inject_handler(myreg, myhandler);
+    } else {
+        myreg =
+            netsnmp_create_handler_registration(name,
+                                                scalarh,
+                                                reg_oid, reg_oid_len,
+                                                modes);
+        myreg->handler->myvoid = (void *) it;
+    }
+    return myreg;
+}
+
+int
+netsnmp_register_read_only_ulong_instance(const char *name,
+                                          oid * reg_oid,
+                                          size_t reg_oid_len, u_long * it,
+                                          Netsnmp_Node_Handler *
+                                          subhandler)
+{
+    netsnmp_handler_registration *myreg;
+
+    myreg = get_reg(name, "ulong_handler", reg_oid, reg_oid_len, it,
+                    HANDLER_CAN_RONLY, netsnmp_instance_ulong_handler,
+                    subhandler);
+    return netsnmp_register_read_only_instance(myreg);
+}
+
+int
+netsnmp_register_ulong_instance(const char *name,
+                                oid * reg_oid, size_t reg_oid_len,
+                                u_long * it,
+                                Netsnmp_Node_Handler * subhandler)
+{
+    netsnmp_handler_registration *myreg;
+
+    myreg = get_reg(name, "ulong_handler", reg_oid, reg_oid_len, it,
+                    HANDLER_CAN_RWRITE, netsnmp_instance_ulong_handler,
+                    subhandler);
+    return netsnmp_register_instance(myreg);
+}
+
+int
+netsnmp_register_read_only_counter32_instance(const char *name,
+                                              oid * reg_oid,
+                                              size_t reg_oid_len,
+                                              u_long * it,
+                                              Netsnmp_Node_Handler *
+                                              subhandler)
+{
+    netsnmp_handler_registration *myreg;
+
+    myreg = get_reg(name, "counter32_handler", reg_oid, reg_oid_len, it,
+                    HANDLER_CAN_RWRITE, netsnmp_instance_counter32_handler,
+                    subhandler);
+    return netsnmp_register_read_only_instance(myreg);
+}
+
+int
+netsnmp_register_read_only_long_instance(const char *name,
+                                         oid * reg_oid, size_t reg_oid_len,
+                                         long *it,
+                                         Netsnmp_Node_Handler * subhandler)
+{
+    netsnmp_handler_registration *myreg;
+
+    myreg = get_reg(name, "long_handler", reg_oid, reg_oid_len, it,
+                    HANDLER_CAN_RONLY, netsnmp_instance_long_handler,
+                    subhandler);
+    return netsnmp_register_read_only_instance(myreg);
+}
+
+int
+netsnmp_register_long_instance(const char *name,
+                               oid * reg_oid, size_t reg_oid_len,
+                               long *it, Netsnmp_Node_Handler * subhandler)
+{
+    netsnmp_handler_registration *myreg;
+
+    myreg = get_reg(name, "long_handler", reg_oid, reg_oid_len, it,
+                    HANDLER_CAN_RWRITE, netsnmp_instance_long_handler,
+                    subhandler);
+    return netsnmp_register_instance(myreg);
+}
+
+int
+netsnmp_register_read_only_int_instance(const char *name,
+                                oid * reg_oid, size_t reg_oid_len,
+                                int *it, Netsnmp_Node_Handler * subhandler)
+{
+    netsnmp_handler_registration *myreg;
+
+    myreg = get_reg(name, "int_handler", reg_oid, reg_oid_len, it,
+                    HANDLER_CAN_RONLY, netsnmp_instance_int_handler,
+                    subhandler);
+    return netsnmp_register_read_only_instance(myreg);
+}
+
+  /*
+   * Compatibility with earlier (inconsistently named) routine
+   */
+int
+register_read_only_int_instance(const char *name,
+                                oid * reg_oid, size_t reg_oid_len,
+                                int *it, Netsnmp_Node_Handler * subhandler)
+{
+  return netsnmp_register_read_only_int_instance(name,
+                                reg_oid, reg_oid_len,
+                                it, subhandler);
+}
+
+int
+netsnmp_register_int_instance(const char *name,
+                              oid * reg_oid, size_t reg_oid_len,
+                              int *it, Netsnmp_Node_Handler * subhandler)
+{
+    netsnmp_handler_registration *myreg;
+
+    myreg = get_reg(name, "int_handler", reg_oid, reg_oid_len, it,
+                    HANDLER_CAN_RWRITE, netsnmp_instance_int_handler,
+                    subhandler);
+    return netsnmp_register_instance(myreg);
+}
+
+int
+netsnmp_instance_ulong_handler(netsnmp_mib_handler *handler,
+                               netsnmp_handler_registration *reginfo,
+                               netsnmp_agent_request_info *reqinfo,
+                               netsnmp_request_info *requests)
+{
+
+    u_long         *it = (u_long *) handler->myvoid;
+    u_long         *it_save;
+
+    DEBUGMSGTL(("netsnmp_instance_ulong_handler", "Got request:  %d\n",
+                reqinfo->mode));
+
+    switch (reqinfo->mode) {
+        /*
+         * data requests 
+         */
+    case MODE_GET:
+        snmp_set_var_typed_value(requests->requestvb, ASN_UNSIGNED,
+                                 (u_char *) it, sizeof(*it));
+        break;
+
+        /*
+         * SET requests.  Should only get here if registered RWRITE 
+         */
+    case MODE_SET_RESERVE1:
+        if (requests->requestvb->type != ASN_UNSIGNED)
+            netsnmp_set_request_error(reqinfo, requests,
+                                      SNMP_ERR_WRONGTYPE);
+        break;
+
+    case MODE_SET_RESERVE2:
+        /*
+         * store old info for undo later 
+         */
+        memdup((u_char **) & it_save, (u_char *) it, sizeof(u_long));
+        if (it_save == NULL) {
+            netsnmp_set_request_error(reqinfo, requests,
+                                      SNMP_ERR_RESOURCEUNAVAILABLE);
+            return SNMP_ERR_NOERROR;
+        }
+        netsnmp_request_add_list_data(requests,
+                                      netsnmp_create_data_list
+                                      (INSTANCE_HANDLER_NAME, it_save,
+                                       free));
+        break;
+
+    case MODE_SET_ACTION:
+        /*
+         * update current 
+         */
+        DEBUGMSGTL(("testhandler", "updated u_long %ul -> %ul\n", *it,
+                    *(requests->requestvb->val.integer)));
+        *it = *(requests->requestvb->val.integer);
+        break;
+
+    case MODE_SET_UNDO:
+        *it =
+            *((u_long *) netsnmp_request_get_list_data(requests,
+                                                       INSTANCE_HANDLER_NAME));
+        break;
+
+    case MODE_SET_COMMIT:
+    case MODE_SET_FREE:
+        /*
+         * nothing to do 
+         */
+        break;
+    }
+
+    if (handler->next && handler->next->access_method)
+        return netsnmp_call_next_handler(handler, reginfo, reqinfo,
+                                         requests);
+
+    return SNMP_ERR_NOERROR;
+}
+
+int
+netsnmp_instance_counter32_handler(netsnmp_mib_handler *handler,
+                                   netsnmp_handler_registration *reginfo,
+                                   netsnmp_agent_request_info *reqinfo,
+                                   netsnmp_request_info *requests)
+{
+
+    u_long         *it = (u_long *) handler->myvoid;
+
+    DEBUGMSGTL(("netsnmp_instance_counter32_handler",
+                "Got request:  %d\n", reqinfo->mode));
+
+    switch (reqinfo->mode) {
+        /*
+         * data requests 
+         */
+    case MODE_GET:
+        snmp_set_var_typed_value(requests->requestvb, ASN_COUNTER,
+                                 (u_char *) it, sizeof(*it));
+        break;
+
+        /*
+         * SET requests.  Should only get here if registered RWRITE 
+         */
+    default:
+        snmp_log(LOG_ERR,
+                 "netsnmp_instance_counter32_handler: illegal mode\n");
+        netsnmp_set_request_error(reqinfo, requests, SNMP_ERR_GENERR);
+        return SNMP_ERR_NOERROR;
+    }
+    if (handler->next && handler->next->access_method)
+        return netsnmp_call_next_handler(handler, reginfo, reqinfo,
+                                         requests);
+    return SNMP_ERR_NOERROR;
+}
+
+int
+netsnmp_instance_long_handler(netsnmp_mib_handler *handler,
+                              netsnmp_handler_registration *reginfo,
+                              netsnmp_agent_request_info *reqinfo,
+                              netsnmp_request_info *requests)
+{
+
+    long           *it = (u_long *) handler->myvoid;
+    long           *it_save;
+
+    DEBUGMSGTL(("netsnmp_instance_long_handler", "Got request:  %d\n",
+                reqinfo->mode));
+
+    switch (reqinfo->mode) {
+        /*
+         * data requests 
+         */
+    case MODE_GET:
+        snmp_set_var_typed_value(requests->requestvb, ASN_INTEGER,
+                                 (u_char *) it, sizeof(*it));
+        break;
+
+        /*
+         * SET requests.  Should only get here if registered RWRITE 
+         */
+    case MODE_SET_RESERVE1:
+        if (requests->requestvb->type != ASN_INTEGER)
+            netsnmp_set_request_error(reqinfo, requests,
+                                      SNMP_ERR_WRONGTYPE);
+        break;
+
+    case MODE_SET_RESERVE2:
+        /*
+         * store old info for undo later 
+         */
+        memdup((u_char **) & it_save, (u_char *) it, sizeof(u_long));
+        if (it_save == NULL) {
+            netsnmp_set_request_error(reqinfo, requests,
+                                      SNMP_ERR_RESOURCEUNAVAILABLE);
+            return SNMP_ERR_NOERROR;
+        }
+        netsnmp_request_add_list_data(requests,
+                                      netsnmp_create_data_list
+                                      (INSTANCE_HANDLER_NAME, it_save,
+                                       free));
+        break;
+
+    case MODE_SET_ACTION:
+        /*
+         * update current 
+         */
+        DEBUGMSGTL(("testhandler", "updated u_long %ul -> %ul\n", *it,
+                    *(requests->requestvb->val.integer)));
+        *it = *(requests->requestvb->val.integer);
+        break;
+
+    case MODE_SET_UNDO:
+        *it =
+            *((u_long *) netsnmp_request_get_list_data(requests,
+                                                       INSTANCE_HANDLER_NAME));
+        break;
+
+    case MODE_SET_COMMIT:
+    case MODE_SET_FREE:
+        /*
+         * nothing to do 
+         */
+        break;
+    }
+    if (handler->next && handler->next->access_method)
+        return netsnmp_call_next_handler(handler, reginfo, reqinfo,
+                                         requests);
+    return SNMP_ERR_NOERROR;
+}
+
+int
+netsnmp_instance_int_handler(netsnmp_mib_handler *handler,
+                             netsnmp_handler_registration *reginfo,
+                             netsnmp_agent_request_info *reqinfo,
+                             netsnmp_request_info *requests)
+{
+
+    int            *it = (u_int *) handler->myvoid;
+    int            *it_save;
+
+    DEBUGMSGTL(("netsnmp_instance_int_handler", "Got request:  %d\n",
+                reqinfo->mode));
+
+    switch (reqinfo->mode) {
+        /*
+         * data requests 
+         */
+    case MODE_GET:
+        snmp_set_var_typed_value(requests->requestvb, ASN_INTEGER,
+                                 (u_char *) it, sizeof(*it));
+        break;
+
+        /*
+         * SET requests.  Should only get here if registered RWRITE 
+         */
+    case MODE_SET_RESERVE1:
+        if (requests->requestvb->type != ASN_INTEGER)
+            netsnmp_set_request_error(reqinfo, requests,
+                                      SNMP_ERR_WRONGTYPE);
+        break;
+
+    case MODE_SET_RESERVE2:
+        /*
+         * store old info for undo later 
+         */
+        memdup((u_char **) & it_save, (u_char *) it, sizeof(u_long));
+        if (it_save == NULL) {
+            netsnmp_set_request_error(reqinfo, requests,
+                                      SNMP_ERR_RESOURCEUNAVAILABLE);
+            return SNMP_ERR_NOERROR;
+        }
+        netsnmp_request_add_list_data(requests,
+                                      netsnmp_create_data_list
+                                      (INSTANCE_HANDLER_NAME, it_save,
+                                       free));
+        break;
+
+    case MODE_SET_ACTION:
+        /*
+         * update current 
+         */
+        DEBUGMSGTL(("testhandler", "updated int %d -> %l\n", *it,
+                    *(requests->requestvb->val.integer)));
+        *it = (int) *(requests->requestvb->val.integer);
+        break;
+
+    case MODE_SET_UNDO:
+        *it =
+            *((u_int *) netsnmp_request_get_list_data(requests,
+                                                      INSTANCE_HANDLER_NAME));
+        break;
+
+    case MODE_SET_COMMIT:
+    case MODE_SET_FREE:
+        /*
+         * nothing to do 
+         */
+        break;
+    }
+    if (handler->next && handler->next->access_method)
+        return netsnmp_call_next_handler(handler, reginfo, reqinfo,
+                                         requests);
+    return SNMP_ERR_NOERROR;
+}
+
+int
+netsnmp_instance_helper_handler(netsnmp_mib_handler *handler,
+                                netsnmp_handler_registration *reginfo,
+                                netsnmp_agent_request_info *reqinfo,
+                                netsnmp_request_info *requests)
+{
+
+    netsnmp_variable_list *var = requests->requestvb;
+
+    int             ret, cmp;
+
+    DEBUGMSGTL(("helper:instance", "Got request:\n"));
+    cmp = snmp_oid_compare(requests->requestvb->name,
+                           requests->requestvb->name_length,
+                           reginfo->rootoid, reginfo->rootoid_len);
+
+    DEBUGMSGTL(("helper:instance", "  oid:", cmp));
+    DEBUGMSGOID(("helper:instance", var->name, var->name_length));
+    DEBUGMSG(("helper:instance", "\n"));
+
+    switch (reqinfo->mode) {
+    case MODE_GET:
+        if (cmp != 0) {
+            netsnmp_set_request_error(reqinfo, requests,
+                                      SNMP_NOSUCHINSTANCE);
+            return SNMP_ERR_NOERROR;
+        } else {
+            return netsnmp_call_next_handler(handler, reginfo, reqinfo,
+                                             requests);
+        }
+        break;
+
+    case MODE_SET_RESERVE1:
+    case MODE_SET_RESERVE2:
+    case MODE_SET_ACTION:
+    case MODE_SET_COMMIT:
+    case MODE_SET_UNDO:
+    case MODE_SET_FREE:
+        if (cmp != 0) {
+            netsnmp_set_request_error(reqinfo, requests,
+                                      SNMP_ERR_NOCREATION);
+            return SNMP_ERR_NOERROR;
+        } else {
+            return netsnmp_call_next_handler(handler, reginfo, reqinfo,
+                                             requests);
+        }
+        break;
+
+    case MODE_GETNEXT:
+        if (cmp < 0 || (cmp == 0 && requests->inclusive)) {
+            reqinfo->mode = MODE_GET;
+            snmp_set_var_objid(requests->requestvb, reginfo->rootoid,
+                               reginfo->rootoid_len);
+            ret =
+                netsnmp_call_next_handler(handler, reginfo, reqinfo,
+                                          requests);
+            reqinfo->mode = MODE_GETNEXT;
+            return ret;
+        } else {
+            return SNMP_ERR_NOERROR;
+        }
+        break;
+    }
+    /*
+     * got here only if illegal mode found 
+     */
+    return SNMP_ERR_GENERR;
+}
+
+/*
+ * @} 
+ */
diff -Naur tomato/release/src/router/snmp/agent/helpers/Makefile.depend tomato121/release/src/router/snmp/agent/helpers/Makefile.depend
--- tomato/release/src/router/snmp/agent/helpers/Makefile.depend	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/helpers/Makefile.depend	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,1426 @@
+# DO NOT DELETE THIS LINE -- make depend depends on it.
+
+./all_helpers.lo: ../../include/net-snmp/net-snmp-config.h
+./all_helpers.lo: ../../include/net-snmp/system/linux.h
+./all_helpers.lo: ../../include/net-snmp/system/sysv.h
+./all_helpers.lo: ../../include/net-snmp/system/generic.h
+./all_helpers.lo: ../../include/net-snmp/machine/generic.h
+./bulk_to_next.lo: ../../include/net-snmp/net-snmp-config.h
+./bulk_to_next.lo: ../../include/net-snmp/system/linux.h
+./bulk_to_next.lo: ../../include/net-snmp/system/sysv.h
+./bulk_to_next.lo: ../../include/net-snmp/system/generic.h
+./bulk_to_next.lo: ../../include/net-snmp/machine/generic.h
+./bulk_to_next.lo: ../../include/net-snmp/net-snmp-includes.h
+./bulk_to_next.lo: ../../include/net-snmp/definitions.h
+./bulk_to_next.lo: ../../include/net-snmp/types.h
+./bulk_to_next.lo: ../../include/net-snmp/library/snmp_api.h
+./bulk_to_next.lo: ../../include/net-snmp/library/asn1.h
+./bulk_to_next.lo: ../../include/net-snmp/library/snmp_impl.h
+./bulk_to_next.lo: ../../include/net-snmp/library/snmp.h
+./bulk_to_next.lo: ../../include/net-snmp/library/snmp-tc.h
+./bulk_to_next.lo: ../../include/net-snmp/utilities.h
+./bulk_to_next.lo: ../../include/net-snmp/library/snmp_client.h
+./bulk_to_next.lo: ../../include/net-snmp/library/getopt.h
+./bulk_to_next.lo: ../../include/net-snmp/library/system.h
+./bulk_to_next.lo: ../../include/net-snmp/library/tools.h
+./bulk_to_next.lo: ../../include/net-snmp/library/int64.h
+./bulk_to_next.lo: ../../include/net-snmp/library/mt_support.h
+./bulk_to_next.lo: ../../include/net-snmp/library/snmp_alarm.h
+./bulk_to_next.lo: ../../include/net-snmp/library/data_list.h
+./bulk_to_next.lo: ../../include/net-snmp/library/callback.h
+./bulk_to_next.lo: ../../include/net-snmp/library/oid_stash.h
+./bulk_to_next.lo: ../../include/net-snmp/library/check_varbind.h
+./bulk_to_next.lo: ../../include/net-snmp/version.h
+./bulk_to_next.lo: ../../include/net-snmp/session_api.h
+./bulk_to_next.lo: ../../include/net-snmp/library/snmp_transport.h
+./bulk_to_next.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./bulk_to_next.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./bulk_to_next.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./bulk_to_next.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./bulk_to_next.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./bulk_to_next.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./bulk_to_next.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./bulk_to_next.lo: ../../include/net-snmp/library/ucd_compat.h
+./bulk_to_next.lo: ../../include/net-snmp/pdu_api.h
+./bulk_to_next.lo: ../../include/net-snmp/mib_api.h
+./bulk_to_next.lo: ../../include/net-snmp/library/mib.h
+./bulk_to_next.lo: ../../include/net-snmp/library/parse.h
+./bulk_to_next.lo: ../../include/net-snmp/varbind_api.h
+./bulk_to_next.lo: ../../include/net-snmp/config_api.h
+./bulk_to_next.lo: ../../include/net-snmp/library/read_config.h
+./bulk_to_next.lo: ../../include/net-snmp/library/default_store.h
+./bulk_to_next.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./bulk_to_next.lo: ../../include/net-snmp/library/snmp_enum.h
+./bulk_to_next.lo: ../../include/net-snmp/library/vacm.h
+./bulk_to_next.lo: ../../include/net-snmp/output_api.h
+./bulk_to_next.lo: ../../include/net-snmp/library/snmp_debug.h
+./bulk_to_next.lo: ../../include/net-snmp/library/snmp_logging.h
+./bulk_to_next.lo: ../../include/net-snmp/snmpv3_api.h
+./bulk_to_next.lo: ../../include/net-snmp/library/snmpv3.h
+./bulk_to_next.lo: ../../include/net-snmp/library/transform_oids.h
+./bulk_to_next.lo: ../../include/net-snmp/library/keytools.h
+./bulk_to_next.lo: ../../include/net-snmp/library/scapi.h
+./bulk_to_next.lo: ../../include/net-snmp/library/lcd_time.h
+./bulk_to_next.lo: ../../include/net-snmp/library/snmp_secmod.h
+./bulk_to_next.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./bulk_to_next.lo: ../../include/net-snmp/library/snmpusm.h
+./bulk_to_next.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./bulk_to_next.lo: ../../include/net-snmp/agent/snmp_agent.h
+./bulk_to_next.lo: ../../include/net-snmp/agent/snmp_vars.h
+./bulk_to_next.lo: ../../include/net-snmp/agent/agent_handler.h
+./bulk_to_next.lo: ../../include/net-snmp/agent/var_struct.h
+./bulk_to_next.lo: ../../include/net-snmp/agent/agent_registry.h
+./bulk_to_next.lo: ../../include/net-snmp/agent/ds_agent.h
+./bulk_to_next.lo: ../../include/net-snmp/agent/agent_read_config.h
+./bulk_to_next.lo: ../../include/net-snmp/agent/agent_trap.h
+./bulk_to_next.lo: ../../include/net-snmp/agent/all_helpers.h
+./bulk_to_next.lo: ../../include/net-snmp/agent/instance.h
+./bulk_to_next.lo: ../../include/net-snmp/agent/multiplexer.h
+./bulk_to_next.lo: ../../include/net-snmp/agent/null.h
+./bulk_to_next.lo: ../../include/net-snmp/agent/debug_handler.h
+./bulk_to_next.lo: ../../include/net-snmp/agent/old_api.h
+./bulk_to_next.lo: ../../include/net-snmp/agent/read_only.h
+./bulk_to_next.lo: ../../include/net-snmp/agent/serialize.h
+./bulk_to_next.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./bulk_to_next.lo: ../../include/net-snmp/agent/mode_end_call.h
+./bulk_to_next.lo: ../../include/net-snmp/agent/table.h
+./bulk_to_next.lo: ../../include/net-snmp/agent/table_data.h
+./bulk_to_next.lo: ../../include/net-snmp/agent/table_dataset.h
+./bulk_to_next.lo: ../../include/net-snmp/agent/table_iterator.h
+./bulk_to_next.lo: ../../include/net-snmp/agent/mib_module_config.h
+./debug_handler.lo: ../../include/net-snmp/net-snmp-config.h
+./debug_handler.lo: ../../include/net-snmp/system/linux.h
+./debug_handler.lo: ../../include/net-snmp/system/sysv.h
+./debug_handler.lo: ../../include/net-snmp/system/generic.h
+./debug_handler.lo: ../../include/net-snmp/machine/generic.h
+./debug_handler.lo: ../../include/net-snmp/net-snmp-includes.h
+./debug_handler.lo: ../../include/net-snmp/definitions.h
+./debug_handler.lo: ../../include/net-snmp/types.h
+./debug_handler.lo: ../../include/net-snmp/library/snmp_api.h
+./debug_handler.lo: ../../include/net-snmp/library/asn1.h
+./debug_handler.lo: ../../include/net-snmp/library/snmp_impl.h
+./debug_handler.lo: ../../include/net-snmp/library/snmp.h
+./debug_handler.lo: ../../include/net-snmp/library/snmp-tc.h
+./debug_handler.lo: ../../include/net-snmp/utilities.h
+./debug_handler.lo: ../../include/net-snmp/library/snmp_client.h
+./debug_handler.lo: ../../include/net-snmp/library/getopt.h
+./debug_handler.lo: ../../include/net-snmp/library/system.h
+./debug_handler.lo: ../../include/net-snmp/library/tools.h
+./debug_handler.lo: ../../include/net-snmp/library/int64.h
+./debug_handler.lo: ../../include/net-snmp/library/mt_support.h
+./debug_handler.lo: ../../include/net-snmp/library/snmp_alarm.h
+./debug_handler.lo: ../../include/net-snmp/library/data_list.h
+./debug_handler.lo: ../../include/net-snmp/library/callback.h
+./debug_handler.lo: ../../include/net-snmp/library/oid_stash.h
+./debug_handler.lo: ../../include/net-snmp/library/check_varbind.h
+./debug_handler.lo: ../../include/net-snmp/version.h
+./debug_handler.lo: ../../include/net-snmp/session_api.h
+./debug_handler.lo: ../../include/net-snmp/library/snmp_transport.h
+./debug_handler.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./debug_handler.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./debug_handler.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./debug_handler.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./debug_handler.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./debug_handler.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./debug_handler.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./debug_handler.lo: ../../include/net-snmp/library/ucd_compat.h
+./debug_handler.lo: ../../include/net-snmp/pdu_api.h
+./debug_handler.lo: ../../include/net-snmp/mib_api.h
+./debug_handler.lo: ../../include/net-snmp/library/mib.h
+./debug_handler.lo: ../../include/net-snmp/library/parse.h
+./debug_handler.lo: ../../include/net-snmp/varbind_api.h
+./debug_handler.lo: ../../include/net-snmp/config_api.h
+./debug_handler.lo: ../../include/net-snmp/library/read_config.h
+./debug_handler.lo: ../../include/net-snmp/library/default_store.h
+./debug_handler.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./debug_handler.lo: ../../include/net-snmp/library/snmp_enum.h
+./debug_handler.lo: ../../include/net-snmp/library/vacm.h
+./debug_handler.lo: ../../include/net-snmp/output_api.h
+./debug_handler.lo: ../../include/net-snmp/library/snmp_debug.h
+./debug_handler.lo: ../../include/net-snmp/library/snmp_logging.h
+./debug_handler.lo: ../../include/net-snmp/snmpv3_api.h
+./debug_handler.lo: ../../include/net-snmp/library/snmpv3.h
+./debug_handler.lo: ../../include/net-snmp/library/transform_oids.h
+./debug_handler.lo: ../../include/net-snmp/library/keytools.h
+./debug_handler.lo: ../../include/net-snmp/library/scapi.h
+./debug_handler.lo: ../../include/net-snmp/library/lcd_time.h
+./debug_handler.lo: ../../include/net-snmp/library/snmp_secmod.h
+./debug_handler.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./debug_handler.lo: ../../include/net-snmp/library/snmpusm.h
+./debug_handler.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./debug_handler.lo: ../../include/net-snmp/agent/snmp_agent.h
+./debug_handler.lo: ../../include/net-snmp/agent/snmp_vars.h
+./debug_handler.lo: ../../include/net-snmp/agent/agent_handler.h
+./debug_handler.lo: ../../include/net-snmp/agent/var_struct.h
+./debug_handler.lo: ../../include/net-snmp/agent/agent_registry.h
+./debug_handler.lo: ../../include/net-snmp/agent/ds_agent.h
+./debug_handler.lo: ../../include/net-snmp/agent/agent_read_config.h
+./debug_handler.lo: ../../include/net-snmp/agent/agent_trap.h
+./debug_handler.lo: ../../include/net-snmp/agent/all_helpers.h
+./debug_handler.lo: ../../include/net-snmp/agent/instance.h
+./debug_handler.lo: ../../include/net-snmp/agent/multiplexer.h
+./debug_handler.lo: ../../include/net-snmp/agent/null.h
+./debug_handler.lo: ../../include/net-snmp/agent/debug_handler.h
+./debug_handler.lo: ../../include/net-snmp/agent/old_api.h
+./debug_handler.lo: ../../include/net-snmp/agent/read_only.h
+./debug_handler.lo: ../../include/net-snmp/agent/serialize.h
+./debug_handler.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./debug_handler.lo: ../../include/net-snmp/agent/mode_end_call.h
+./debug_handler.lo: ../../include/net-snmp/agent/table.h
+./debug_handler.lo: ../../include/net-snmp/agent/table_data.h
+./debug_handler.lo: ../../include/net-snmp/agent/table_dataset.h
+./debug_handler.lo: ../../include/net-snmp/agent/table_iterator.h
+./debug_handler.lo: ../../include/net-snmp/agent/mib_module_config.h
+./instance.lo: ../../include/net-snmp/net-snmp-config.h
+./instance.lo: ../../include/net-snmp/system/linux.h
+./instance.lo: ../../include/net-snmp/system/sysv.h
+./instance.lo: ../../include/net-snmp/system/generic.h
+./instance.lo: ../../include/net-snmp/machine/generic.h 
+./instance.lo: ../../include/net-snmp/net-snmp-includes.h
+./instance.lo:  ../../include/net-snmp/definitions.h
+./instance.lo: ../../include/net-snmp/types.h
+./instance.lo: ../../include/net-snmp/library/snmp_api.h
+./instance.lo: ../../include/net-snmp/library/asn1.h
+./instance.lo: ../../include/net-snmp/library/snmp_impl.h
+./instance.lo: ../../include/net-snmp/library/snmp.h
+./instance.lo: ../../include/net-snmp/library/snmp-tc.h
+./instance.lo: ../../include/net-snmp/utilities.h
+./instance.lo: ../../include/net-snmp/library/snmp_client.h
+./instance.lo: ../../include/net-snmp/library/getopt.h
+./instance.lo: ../../include/net-snmp/library/system.h
+./instance.lo: ../../include/net-snmp/library/tools.h
+./instance.lo: ../../include/net-snmp/library/int64.h
+./instance.lo: ../../include/net-snmp/library/mt_support.h
+./instance.lo: ../../include/net-snmp/library/snmp_alarm.h
+./instance.lo: ../../include/net-snmp/library/data_list.h
+./instance.lo: ../../include/net-snmp/library/callback.h
+./instance.lo: ../../include/net-snmp/library/oid_stash.h
+./instance.lo: ../../include/net-snmp/library/check_varbind.h
+./instance.lo: ../../include/net-snmp/version.h
+./instance.lo: ../../include/net-snmp/session_api.h
+./instance.lo: ../../include/net-snmp/library/snmp_transport.h
+./instance.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./instance.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./instance.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./instance.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./instance.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./instance.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./instance.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./instance.lo: ../../include/net-snmp/library/ucd_compat.h
+./instance.lo: ../../include/net-snmp/pdu_api.h
+./instance.lo: ../../include/net-snmp/mib_api.h
+./instance.lo: ../../include/net-snmp/library/mib.h
+./instance.lo: ../../include/net-snmp/library/parse.h
+./instance.lo: ../../include/net-snmp/varbind_api.h
+./instance.lo: ../../include/net-snmp/config_api.h
+./instance.lo: ../../include/net-snmp/library/read_config.h
+./instance.lo: ../../include/net-snmp/library/default_store.h
+./instance.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./instance.lo: ../../include/net-snmp/library/snmp_enum.h
+./instance.lo: ../../include/net-snmp/library/vacm.h
+./instance.lo: ../../include/net-snmp/output_api.h
+./instance.lo: ../../include/net-snmp/library/snmp_debug.h
+./instance.lo: ../../include/net-snmp/library/snmp_logging.h
+./instance.lo: ../../include/net-snmp/snmpv3_api.h
+./instance.lo: ../../include/net-snmp/library/snmpv3.h
+./instance.lo: ../../include/net-snmp/library/transform_oids.h
+./instance.lo: ../../include/net-snmp/library/keytools.h
+./instance.lo: ../../include/net-snmp/library/scapi.h
+./instance.lo: ../../include/net-snmp/library/lcd_time.h
+./instance.lo: ../../include/net-snmp/library/snmp_secmod.h
+./instance.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./instance.lo: ../../include/net-snmp/library/snmpusm.h
+./instance.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./instance.lo: ../../include/net-snmp/agent/snmp_agent.h
+./instance.lo: ../../include/net-snmp/agent/snmp_vars.h
+./instance.lo: ../../include/net-snmp/agent/agent_handler.h
+./instance.lo: ../../include/net-snmp/agent/var_struct.h
+./instance.lo: ../../include/net-snmp/agent/agent_registry.h
+./instance.lo: ../../include/net-snmp/agent/ds_agent.h
+./instance.lo: ../../include/net-snmp/agent/agent_read_config.h
+./instance.lo: ../../include/net-snmp/agent/agent_trap.h
+./instance.lo: ../../include/net-snmp/agent/all_helpers.h
+./instance.lo: ../../include/net-snmp/agent/instance.h
+./instance.lo: ../../include/net-snmp/agent/multiplexer.h
+./instance.lo: ../../include/net-snmp/agent/null.h
+./instance.lo: ../../include/net-snmp/agent/debug_handler.h
+./instance.lo: ../../include/net-snmp/agent/old_api.h
+./instance.lo: ../../include/net-snmp/agent/read_only.h
+./instance.lo: ../../include/net-snmp/agent/serialize.h
+./instance.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./instance.lo: ../../include/net-snmp/agent/mode_end_call.h
+./instance.lo: ../../include/net-snmp/agent/table.h
+./instance.lo: ../../include/net-snmp/agent/table_data.h
+./instance.lo: ../../include/net-snmp/agent/table_dataset.h
+./instance.lo: ../../include/net-snmp/agent/table_iterator.h
+./instance.lo: ../../include/net-snmp/agent/mib_module_config.h
+./mode_end_call.lo: ../../include/net-snmp/net-snmp-config.h
+./mode_end_call.lo: ../../include/net-snmp/system/linux.h
+./mode_end_call.lo: ../../include/net-snmp/system/sysv.h
+./mode_end_call.lo: ../../include/net-snmp/system/generic.h
+./mode_end_call.lo: ../../include/net-snmp/machine/generic.h
+./mode_end_call.lo: ../../include/net-snmp/net-snmp-includes.h
+./mode_end_call.lo: ../../include/net-snmp/definitions.h
+./mode_end_call.lo: ../../include/net-snmp/types.h
+./mode_end_call.lo: ../../include/net-snmp/library/snmp_api.h
+./mode_end_call.lo: ../../include/net-snmp/library/asn1.h
+./mode_end_call.lo: ../../include/net-snmp/library/snmp_impl.h
+./mode_end_call.lo: ../../include/net-snmp/library/snmp.h
+./mode_end_call.lo: ../../include/net-snmp/library/snmp-tc.h
+./mode_end_call.lo: ../../include/net-snmp/utilities.h
+./mode_end_call.lo: ../../include/net-snmp/library/snmp_client.h
+./mode_end_call.lo: ../../include/net-snmp/library/getopt.h
+./mode_end_call.lo: ../../include/net-snmp/library/system.h
+./mode_end_call.lo: ../../include/net-snmp/library/tools.h
+./mode_end_call.lo: ../../include/net-snmp/library/int64.h
+./mode_end_call.lo: ../../include/net-snmp/library/mt_support.h
+./mode_end_call.lo: ../../include/net-snmp/library/snmp_alarm.h
+./mode_end_call.lo: ../../include/net-snmp/library/data_list.h
+./mode_end_call.lo: ../../include/net-snmp/library/callback.h
+./mode_end_call.lo: ../../include/net-snmp/library/oid_stash.h
+./mode_end_call.lo: ../../include/net-snmp/library/check_varbind.h
+./mode_end_call.lo: ../../include/net-snmp/version.h
+./mode_end_call.lo: ../../include/net-snmp/session_api.h
+./mode_end_call.lo: ../../include/net-snmp/library/snmp_transport.h
+./mode_end_call.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./mode_end_call.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./mode_end_call.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./mode_end_call.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./mode_end_call.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./mode_end_call.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./mode_end_call.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./mode_end_call.lo: ../../include/net-snmp/library/ucd_compat.h
+./mode_end_call.lo: ../../include/net-snmp/pdu_api.h
+./mode_end_call.lo: ../../include/net-snmp/mib_api.h
+./mode_end_call.lo: ../../include/net-snmp/library/mib.h
+./mode_end_call.lo: ../../include/net-snmp/library/parse.h
+./mode_end_call.lo: ../../include/net-snmp/varbind_api.h
+./mode_end_call.lo: ../../include/net-snmp/config_api.h
+./mode_end_call.lo: ../../include/net-snmp/library/read_config.h
+./mode_end_call.lo: ../../include/net-snmp/library/default_store.h
+./mode_end_call.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./mode_end_call.lo: ../../include/net-snmp/library/snmp_enum.h
+./mode_end_call.lo: ../../include/net-snmp/library/vacm.h
+./mode_end_call.lo: ../../include/net-snmp/output_api.h
+./mode_end_call.lo: ../../include/net-snmp/library/snmp_debug.h
+./mode_end_call.lo: ../../include/net-snmp/library/snmp_logging.h
+./mode_end_call.lo: ../../include/net-snmp/snmpv3_api.h
+./mode_end_call.lo: ../../include/net-snmp/library/snmpv3.h
+./mode_end_call.lo: ../../include/net-snmp/library/transform_oids.h
+./mode_end_call.lo: ../../include/net-snmp/library/keytools.h
+./mode_end_call.lo: ../../include/net-snmp/library/scapi.h
+./mode_end_call.lo: ../../include/net-snmp/library/lcd_time.h
+./mode_end_call.lo: ../../include/net-snmp/library/snmp_secmod.h
+./mode_end_call.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./mode_end_call.lo: ../../include/net-snmp/library/snmpusm.h
+./mode_end_call.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./mode_end_call.lo: ../../include/net-snmp/agent/snmp_agent.h
+./mode_end_call.lo: ../../include/net-snmp/agent/snmp_vars.h
+./mode_end_call.lo: ../../include/net-snmp/agent/agent_handler.h
+./mode_end_call.lo: ../../include/net-snmp/agent/var_struct.h
+./mode_end_call.lo: ../../include/net-snmp/agent/agent_registry.h
+./mode_end_call.lo: ../../include/net-snmp/agent/ds_agent.h
+./mode_end_call.lo: ../../include/net-snmp/agent/agent_read_config.h
+./mode_end_call.lo: ../../include/net-snmp/agent/agent_trap.h
+./mode_end_call.lo: ../../include/net-snmp/agent/all_helpers.h
+./mode_end_call.lo: ../../include/net-snmp/agent/instance.h
+./mode_end_call.lo: ../../include/net-snmp/agent/multiplexer.h
+./mode_end_call.lo: ../../include/net-snmp/agent/null.h
+./mode_end_call.lo: ../../include/net-snmp/agent/debug_handler.h
+./mode_end_call.lo: ../../include/net-snmp/agent/old_api.h
+./mode_end_call.lo: ../../include/net-snmp/agent/read_only.h
+./mode_end_call.lo: ../../include/net-snmp/agent/serialize.h
+./mode_end_call.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./mode_end_call.lo: ../../include/net-snmp/agent/mode_end_call.h
+./mode_end_call.lo: ../../include/net-snmp/agent/table.h
+./mode_end_call.lo: ../../include/net-snmp/agent/table_data.h
+./mode_end_call.lo: ../../include/net-snmp/agent/table_dataset.h
+./mode_end_call.lo: ../../include/net-snmp/agent/table_iterator.h
+./mode_end_call.lo: ../../include/net-snmp/agent/mib_module_config.h
+./multiplexer.lo: ../../include/net-snmp/net-snmp-config.h
+./multiplexer.lo: ../../include/net-snmp/system/linux.h
+./multiplexer.lo: ../../include/net-snmp/system/sysv.h
+./multiplexer.lo: ../../include/net-snmp/system/generic.h
+./multiplexer.lo: ../../include/net-snmp/machine/generic.h
+./multiplexer.lo: ../../include/net-snmp/net-snmp-includes.h
+./multiplexer.lo: ../../include/net-snmp/definitions.h
+./multiplexer.lo: ../../include/net-snmp/types.h
+./multiplexer.lo: ../../include/net-snmp/library/snmp_api.h
+./multiplexer.lo: ../../include/net-snmp/library/asn1.h
+./multiplexer.lo: ../../include/net-snmp/library/snmp_impl.h
+./multiplexer.lo: ../../include/net-snmp/library/snmp.h
+./multiplexer.lo: ../../include/net-snmp/library/snmp-tc.h
+./multiplexer.lo: ../../include/net-snmp/utilities.h
+./multiplexer.lo: ../../include/net-snmp/library/snmp_client.h
+./multiplexer.lo: ../../include/net-snmp/library/getopt.h
+./multiplexer.lo: ../../include/net-snmp/library/system.h
+./multiplexer.lo: ../../include/net-snmp/library/tools.h
+./multiplexer.lo: ../../include/net-snmp/library/int64.h
+./multiplexer.lo: ../../include/net-snmp/library/mt_support.h
+./multiplexer.lo: ../../include/net-snmp/library/snmp_alarm.h
+./multiplexer.lo: ../../include/net-snmp/library/data_list.h
+./multiplexer.lo: ../../include/net-snmp/library/callback.h
+./multiplexer.lo: ../../include/net-snmp/library/oid_stash.h
+./multiplexer.lo: ../../include/net-snmp/library/check_varbind.h
+./multiplexer.lo: ../../include/net-snmp/version.h
+./multiplexer.lo: ../../include/net-snmp/session_api.h
+./multiplexer.lo: ../../include/net-snmp/library/snmp_transport.h
+./multiplexer.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./multiplexer.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./multiplexer.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./multiplexer.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./multiplexer.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./multiplexer.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./multiplexer.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./multiplexer.lo: ../../include/net-snmp/library/ucd_compat.h
+./multiplexer.lo: ../../include/net-snmp/pdu_api.h
+./multiplexer.lo: ../../include/net-snmp/mib_api.h
+./multiplexer.lo: ../../include/net-snmp/library/mib.h
+./multiplexer.lo: ../../include/net-snmp/library/parse.h
+./multiplexer.lo: ../../include/net-snmp/varbind_api.h
+./multiplexer.lo: ../../include/net-snmp/config_api.h
+./multiplexer.lo: ../../include/net-snmp/library/read_config.h
+./multiplexer.lo: ../../include/net-snmp/library/default_store.h
+./multiplexer.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./multiplexer.lo: ../../include/net-snmp/library/snmp_enum.h
+./multiplexer.lo: ../../include/net-snmp/library/vacm.h
+./multiplexer.lo: ../../include/net-snmp/output_api.h
+./multiplexer.lo: ../../include/net-snmp/library/snmp_debug.h
+./multiplexer.lo: ../../include/net-snmp/library/snmp_logging.h
+./multiplexer.lo: ../../include/net-snmp/snmpv3_api.h
+./multiplexer.lo: ../../include/net-snmp/library/snmpv3.h
+./multiplexer.lo: ../../include/net-snmp/library/transform_oids.h
+./multiplexer.lo: ../../include/net-snmp/library/keytools.h
+./multiplexer.lo: ../../include/net-snmp/library/scapi.h
+./multiplexer.lo: ../../include/net-snmp/library/lcd_time.h
+./multiplexer.lo: ../../include/net-snmp/library/snmp_secmod.h
+./multiplexer.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./multiplexer.lo: ../../include/net-snmp/library/snmpusm.h
+./multiplexer.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./multiplexer.lo: ../../include/net-snmp/agent/snmp_agent.h
+./multiplexer.lo: ../../include/net-snmp/agent/snmp_vars.h
+./multiplexer.lo: ../../include/net-snmp/agent/agent_handler.h
+./multiplexer.lo: ../../include/net-snmp/agent/var_struct.h
+./multiplexer.lo: ../../include/net-snmp/agent/agent_registry.h
+./multiplexer.lo: ../../include/net-snmp/agent/ds_agent.h
+./multiplexer.lo: ../../include/net-snmp/agent/agent_read_config.h
+./multiplexer.lo: ../../include/net-snmp/agent/agent_trap.h
+./multiplexer.lo: ../../include/net-snmp/agent/all_helpers.h
+./multiplexer.lo: ../../include/net-snmp/agent/instance.h
+./multiplexer.lo: ../../include/net-snmp/agent/multiplexer.h
+./multiplexer.lo: ../../include/net-snmp/agent/null.h
+./multiplexer.lo: ../../include/net-snmp/agent/debug_handler.h
+./multiplexer.lo: ../../include/net-snmp/agent/old_api.h
+./multiplexer.lo: ../../include/net-snmp/agent/read_only.h
+./multiplexer.lo: ../../include/net-snmp/agent/serialize.h
+./multiplexer.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./multiplexer.lo: ../../include/net-snmp/agent/mode_end_call.h
+./multiplexer.lo: ../../include/net-snmp/agent/table.h
+./multiplexer.lo: ../../include/net-snmp/agent/table_data.h
+./multiplexer.lo: ../../include/net-snmp/agent/table_dataset.h
+./multiplexer.lo: ../../include/net-snmp/agent/table_iterator.h
+./multiplexer.lo: ../../include/net-snmp/agent/mib_module_config.h
+./null.lo: ../../include/net-snmp/net-snmp-config.h
+./null.lo: ../../include/net-snmp/system/linux.h
+./null.lo: ../../include/net-snmp/system/sysv.h
+./null.lo: ../../include/net-snmp/system/generic.h
+./null.lo: ../../include/net-snmp/machine/generic.h 
+./null.lo:  ../../include/net-snmp/net-snmp-includes.h
+./null.lo:  ../../include/net-snmp/definitions.h
+./null.lo: ../../include/net-snmp/types.h
+./null.lo: ../../include/net-snmp/library/snmp_api.h
+./null.lo: ../../include/net-snmp/library/asn1.h
+./null.lo: ../../include/net-snmp/library/snmp_impl.h
+./null.lo: ../../include/net-snmp/library/snmp.h
+./null.lo: ../../include/net-snmp/library/snmp-tc.h
+./null.lo: ../../include/net-snmp/utilities.h
+./null.lo: ../../include/net-snmp/library/snmp_client.h
+./null.lo: ../../include/net-snmp/library/getopt.h
+./null.lo: ../../include/net-snmp/library/system.h
+./null.lo: ../../include/net-snmp/library/tools.h
+./null.lo: ../../include/net-snmp/library/int64.h
+./null.lo: ../../include/net-snmp/library/mt_support.h
+./null.lo: ../../include/net-snmp/library/snmp_alarm.h
+./null.lo: ../../include/net-snmp/library/data_list.h
+./null.lo: ../../include/net-snmp/library/callback.h
+./null.lo: ../../include/net-snmp/library/oid_stash.h
+./null.lo: ../../include/net-snmp/library/check_varbind.h
+./null.lo: ../../include/net-snmp/version.h
+./null.lo: ../../include/net-snmp/session_api.h
+./null.lo: ../../include/net-snmp/library/snmp_transport.h
+./null.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./null.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./null.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./null.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./null.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./null.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./null.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./null.lo: ../../include/net-snmp/library/ucd_compat.h
+./null.lo: ../../include/net-snmp/pdu_api.h ../../include/net-snmp/mib_api.h
+./null.lo: ../../include/net-snmp/library/mib.h
+./null.lo: ../../include/net-snmp/library/parse.h
+./null.lo: ../../include/net-snmp/varbind_api.h
+./null.lo: ../../include/net-snmp/config_api.h
+./null.lo: ../../include/net-snmp/library/read_config.h
+./null.lo: ../../include/net-snmp/library/default_store.h
+./null.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./null.lo: ../../include/net-snmp/library/snmp_enum.h
+./null.lo: ../../include/net-snmp/library/vacm.h
+./null.lo: ../../include/net-snmp/output_api.h
+./null.lo: ../../include/net-snmp/library/snmp_debug.h
+./null.lo: ../../include/net-snmp/library/snmp_logging.h
+./null.lo: ../../include/net-snmp/snmpv3_api.h
+./null.lo: ../../include/net-snmp/library/snmpv3.h
+./null.lo: ../../include/net-snmp/library/transform_oids.h
+./null.lo: ../../include/net-snmp/library/keytools.h
+./null.lo: ../../include/net-snmp/library/scapi.h
+./null.lo: ../../include/net-snmp/library/lcd_time.h
+./null.lo: ../../include/net-snmp/library/snmp_secmod.h
+./null.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./null.lo: ../../include/net-snmp/library/snmpusm.h
+./null.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./null.lo: ../../include/net-snmp/agent/snmp_agent.h
+./null.lo: ../../include/net-snmp/agent/snmp_vars.h
+./null.lo: ../../include/net-snmp/agent/agent_handler.h
+./null.lo: ../../include/net-snmp/agent/var_struct.h
+./null.lo: ../../include/net-snmp/agent/agent_registry.h
+./null.lo: ../../include/net-snmp/agent/ds_agent.h
+./null.lo: ../../include/net-snmp/agent/agent_read_config.h
+./null.lo: ../../include/net-snmp/agent/agent_trap.h
+./null.lo: ../../include/net-snmp/agent/all_helpers.h
+./null.lo: ../../include/net-snmp/agent/instance.h
+./null.lo: ../../include/net-snmp/agent/multiplexer.h
+./null.lo: ../../include/net-snmp/agent/null.h
+./null.lo: ../../include/net-snmp/agent/debug_handler.h
+./null.lo: ../../include/net-snmp/agent/old_api.h
+./null.lo: ../../include/net-snmp/agent/read_only.h
+./null.lo: ../../include/net-snmp/agent/serialize.h
+./null.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./null.lo: ../../include/net-snmp/agent/mode_end_call.h
+./null.lo: ../../include/net-snmp/agent/table.h
+./null.lo: ../../include/net-snmp/agent/table_data.h
+./null.lo: ../../include/net-snmp/agent/table_dataset.h
+./null.lo: ../../include/net-snmp/agent/table_iterator.h
+./null.lo: ../../include/net-snmp/agent/mib_module_config.h
+./old_api.lo: ../../include/net-snmp/net-snmp-config.h
+./old_api.lo: ../../include/net-snmp/system/linux.h
+./old_api.lo: ../../include/net-snmp/system/sysv.h
+./old_api.lo: ../../include/net-snmp/system/generic.h
+./old_api.lo: ../../include/net-snmp/machine/generic.h 
+./old_api.lo: ../../include/net-snmp/net-snmp-includes.h 
+./old_api.lo:  ../../include/net-snmp/definitions.h
+./old_api.lo: ../../include/net-snmp/types.h
+./old_api.lo: ../../include/net-snmp/library/snmp_api.h
+./old_api.lo: ../../include/net-snmp/library/asn1.h
+./old_api.lo: ../../include/net-snmp/library/snmp_impl.h
+./old_api.lo: ../../include/net-snmp/library/snmp.h
+./old_api.lo: ../../include/net-snmp/library/snmp-tc.h
+./old_api.lo: ../../include/net-snmp/utilities.h
+./old_api.lo: ../../include/net-snmp/library/snmp_client.h
+./old_api.lo: ../../include/net-snmp/library/getopt.h
+./old_api.lo: ../../include/net-snmp/library/system.h
+./old_api.lo: ../../include/net-snmp/library/tools.h
+./old_api.lo: ../../include/net-snmp/library/int64.h
+./old_api.lo: ../../include/net-snmp/library/mt_support.h
+./old_api.lo: ../../include/net-snmp/library/snmp_alarm.h
+./old_api.lo: ../../include/net-snmp/library/data_list.h
+./old_api.lo: ../../include/net-snmp/library/callback.h
+./old_api.lo: ../../include/net-snmp/library/oid_stash.h
+./old_api.lo: ../../include/net-snmp/library/check_varbind.h
+./old_api.lo: ../../include/net-snmp/version.h
+./old_api.lo: ../../include/net-snmp/session_api.h
+./old_api.lo: ../../include/net-snmp/library/snmp_transport.h
+./old_api.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./old_api.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./old_api.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./old_api.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./old_api.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./old_api.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./old_api.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./old_api.lo: ../../include/net-snmp/library/ucd_compat.h
+./old_api.lo: ../../include/net-snmp/pdu_api.h
+./old_api.lo: ../../include/net-snmp/mib_api.h
+./old_api.lo: ../../include/net-snmp/library/mib.h
+./old_api.lo: ../../include/net-snmp/library/parse.h
+./old_api.lo: ../../include/net-snmp/varbind_api.h
+./old_api.lo: ../../include/net-snmp/config_api.h
+./old_api.lo: ../../include/net-snmp/library/read_config.h
+./old_api.lo: ../../include/net-snmp/library/default_store.h
+./old_api.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./old_api.lo: ../../include/net-snmp/library/snmp_enum.h
+./old_api.lo: ../../include/net-snmp/library/vacm.h
+./old_api.lo: ../../include/net-snmp/output_api.h
+./old_api.lo: ../../include/net-snmp/library/snmp_debug.h
+./old_api.lo: ../../include/net-snmp/library/snmp_logging.h
+./old_api.lo: ../../include/net-snmp/snmpv3_api.h
+./old_api.lo: ../../include/net-snmp/library/snmpv3.h
+./old_api.lo: ../../include/net-snmp/library/transform_oids.h
+./old_api.lo: ../../include/net-snmp/library/keytools.h
+./old_api.lo: ../../include/net-snmp/library/scapi.h
+./old_api.lo: ../../include/net-snmp/library/lcd_time.h
+./old_api.lo: ../../include/net-snmp/library/snmp_secmod.h
+./old_api.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./old_api.lo: ../../include/net-snmp/library/snmpusm.h
+./old_api.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./old_api.lo: ../../include/net-snmp/agent/snmp_agent.h
+./old_api.lo: ../../include/net-snmp/agent/snmp_vars.h
+./old_api.lo: ../../include/net-snmp/agent/agent_handler.h
+./old_api.lo: ../../include/net-snmp/agent/var_struct.h
+./old_api.lo: ../../include/net-snmp/agent/agent_registry.h
+./old_api.lo: ../../include/net-snmp/agent/ds_agent.h
+./old_api.lo: ../../include/net-snmp/agent/agent_read_config.h
+./old_api.lo: ../../include/net-snmp/agent/agent_trap.h
+./old_api.lo: ../../include/net-snmp/agent/all_helpers.h
+./old_api.lo: ../../include/net-snmp/agent/instance.h
+./old_api.lo: ../../include/net-snmp/agent/multiplexer.h
+./old_api.lo: ../../include/net-snmp/agent/null.h
+./old_api.lo: ../../include/net-snmp/agent/debug_handler.h
+./old_api.lo: ../../include/net-snmp/agent/old_api.h
+./old_api.lo: ../../include/net-snmp/agent/read_only.h
+./old_api.lo: ../../include/net-snmp/agent/serialize.h
+./old_api.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./old_api.lo: ../../include/net-snmp/agent/mode_end_call.h
+./old_api.lo: ../../include/net-snmp/agent/table.h
+./old_api.lo: ../../include/net-snmp/agent/table_data.h
+./old_api.lo: ../../include/net-snmp/agent/table_dataset.h
+./old_api.lo: ../../include/net-snmp/agent/table_iterator.h
+./old_api.lo: ../../include/net-snmp/agent/mib_module_config.h
+./old_api.lo: ../../include/net-snmp/agent/agent_callbacks.h
+./read_only.lo: ../../include/net-snmp/net-snmp-config.h
+./read_only.lo: ../../include/net-snmp/system/linux.h
+./read_only.lo: ../../include/net-snmp/system/sysv.h
+./read_only.lo: ../../include/net-snmp/system/generic.h
+./read_only.lo: ../../include/net-snmp/machine/generic.h
+./read_only.lo: ../../include/net-snmp/net-snmp-includes.h
+./read_only.lo:  ../../include/net-snmp/definitions.h
+./read_only.lo: ../../include/net-snmp/types.h
+./read_only.lo: ../../include/net-snmp/library/snmp_api.h
+./read_only.lo: ../../include/net-snmp/library/asn1.h
+./read_only.lo: ../../include/net-snmp/library/snmp_impl.h
+./read_only.lo: ../../include/net-snmp/library/snmp.h
+./read_only.lo: ../../include/net-snmp/library/snmp-tc.h
+./read_only.lo: ../../include/net-snmp/utilities.h
+./read_only.lo: ../../include/net-snmp/library/snmp_client.h
+./read_only.lo: ../../include/net-snmp/library/getopt.h
+./read_only.lo: ../../include/net-snmp/library/system.h
+./read_only.lo: ../../include/net-snmp/library/tools.h
+./read_only.lo: ../../include/net-snmp/library/int64.h
+./read_only.lo: ../../include/net-snmp/library/mt_support.h
+./read_only.lo: ../../include/net-snmp/library/snmp_alarm.h
+./read_only.lo: ../../include/net-snmp/library/data_list.h
+./read_only.lo: ../../include/net-snmp/library/callback.h
+./read_only.lo: ../../include/net-snmp/library/oid_stash.h
+./read_only.lo: ../../include/net-snmp/library/check_varbind.h
+./read_only.lo: ../../include/net-snmp/version.h
+./read_only.lo: ../../include/net-snmp/session_api.h
+./read_only.lo: ../../include/net-snmp/library/snmp_transport.h
+./read_only.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./read_only.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./read_only.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./read_only.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./read_only.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./read_only.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./read_only.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./read_only.lo: ../../include/net-snmp/library/ucd_compat.h
+./read_only.lo: ../../include/net-snmp/pdu_api.h
+./read_only.lo: ../../include/net-snmp/mib_api.h
+./read_only.lo: ../../include/net-snmp/library/mib.h
+./read_only.lo: ../../include/net-snmp/library/parse.h
+./read_only.lo: ../../include/net-snmp/varbind_api.h
+./read_only.lo: ../../include/net-snmp/config_api.h
+./read_only.lo: ../../include/net-snmp/library/read_config.h
+./read_only.lo: ../../include/net-snmp/library/default_store.h
+./read_only.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./read_only.lo: ../../include/net-snmp/library/snmp_enum.h
+./read_only.lo: ../../include/net-snmp/library/vacm.h
+./read_only.lo: ../../include/net-snmp/output_api.h
+./read_only.lo: ../../include/net-snmp/library/snmp_debug.h
+./read_only.lo: ../../include/net-snmp/library/snmp_logging.h
+./read_only.lo: ../../include/net-snmp/snmpv3_api.h
+./read_only.lo: ../../include/net-snmp/library/snmpv3.h
+./read_only.lo: ../../include/net-snmp/library/transform_oids.h
+./read_only.lo: ../../include/net-snmp/library/keytools.h
+./read_only.lo: ../../include/net-snmp/library/scapi.h
+./read_only.lo: ../../include/net-snmp/library/lcd_time.h
+./read_only.lo: ../../include/net-snmp/library/snmp_secmod.h
+./read_only.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./read_only.lo: ../../include/net-snmp/library/snmpusm.h
+./read_only.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./read_only.lo: ../../include/net-snmp/agent/snmp_agent.h
+./read_only.lo: ../../include/net-snmp/agent/snmp_vars.h
+./read_only.lo: ../../include/net-snmp/agent/agent_handler.h
+./read_only.lo: ../../include/net-snmp/agent/var_struct.h
+./read_only.lo: ../../include/net-snmp/agent/agent_registry.h
+./read_only.lo: ../../include/net-snmp/agent/ds_agent.h
+./read_only.lo: ../../include/net-snmp/agent/agent_read_config.h
+./read_only.lo: ../../include/net-snmp/agent/agent_trap.h
+./read_only.lo: ../../include/net-snmp/agent/all_helpers.h
+./read_only.lo: ../../include/net-snmp/agent/instance.h
+./read_only.lo: ../../include/net-snmp/agent/multiplexer.h
+./read_only.lo: ../../include/net-snmp/agent/null.h
+./read_only.lo: ../../include/net-snmp/agent/debug_handler.h
+./read_only.lo: ../../include/net-snmp/agent/old_api.h
+./read_only.lo: ../../include/net-snmp/agent/read_only.h
+./read_only.lo: ../../include/net-snmp/agent/serialize.h
+./read_only.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./read_only.lo: ../../include/net-snmp/agent/mode_end_call.h
+./read_only.lo: ../../include/net-snmp/agent/table.h
+./read_only.lo: ../../include/net-snmp/agent/table_data.h
+./read_only.lo: ../../include/net-snmp/agent/table_dataset.h
+./read_only.lo: ../../include/net-snmp/agent/table_iterator.h
+./read_only.lo: ../../include/net-snmp/agent/mib_module_config.h
+./scalar1.lo: ../../include/net-snmp/net-snmp-config.h
+./scalar1.lo: ../../include/net-snmp/system/linux.h
+./scalar1.lo: ../../include/net-snmp/system/sysv.h
+./scalar1.lo: ../../include/net-snmp/system/generic.h
+./scalar1.lo: ../../include/net-snmp/machine/generic.h 
+./scalar1.lo: ../../include/net-snmp/net-snmp-includes.h 
+./scalar1.lo:  ../../include/net-snmp/definitions.h
+./scalar1.lo: ../../include/net-snmp/types.h
+./scalar1.lo: ../../include/net-snmp/library/snmp_api.h
+./scalar1.lo: ../../include/net-snmp/library/asn1.h
+./scalar1.lo: ../../include/net-snmp/library/snmp_impl.h
+./scalar1.lo: ../../include/net-snmp/library/snmp.h
+./scalar1.lo: ../../include/net-snmp/library/snmp-tc.h
+./scalar1.lo: ../../include/net-snmp/utilities.h
+./scalar1.lo: ../../include/net-snmp/library/snmp_client.h
+./scalar1.lo: ../../include/net-snmp/library/getopt.h
+./scalar1.lo: ../../include/net-snmp/library/system.h
+./scalar1.lo: ../../include/net-snmp/library/tools.h
+./scalar1.lo: ../../include/net-snmp/library/int64.h
+./scalar1.lo: ../../include/net-snmp/library/mt_support.h
+./scalar1.lo: ../../include/net-snmp/library/snmp_alarm.h
+./scalar1.lo: ../../include/net-snmp/library/data_list.h
+./scalar1.lo: ../../include/net-snmp/library/callback.h
+./scalar1.lo: ../../include/net-snmp/library/oid_stash.h
+./scalar1.lo: ../../include/net-snmp/library/check_varbind.h
+./scalar1.lo: ../../include/net-snmp/version.h
+./scalar1.lo: ../../include/net-snmp/session_api.h
+./scalar1.lo: ../../include/net-snmp/library/snmp_transport.h
+./scalar1.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./scalar1.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./scalar1.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./scalar1.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./scalar1.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./scalar1.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./scalar1.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./scalar1.lo: ../../include/net-snmp/library/ucd_compat.h
+./scalar1.lo: ../../include/net-snmp/pdu_api.h
+./scalar1.lo: ../../include/net-snmp/mib_api.h
+./scalar1.lo: ../../include/net-snmp/library/mib.h
+./scalar1.lo: ../../include/net-snmp/library/parse.h
+./scalar1.lo: ../../include/net-snmp/varbind_api.h
+./scalar1.lo: ../../include/net-snmp/config_api.h
+./scalar1.lo: ../../include/net-snmp/library/read_config.h
+./scalar1.lo: ../../include/net-snmp/library/default_store.h
+./scalar1.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./scalar1.lo: ../../include/net-snmp/library/snmp_enum.h
+./scalar1.lo: ../../include/net-snmp/library/vacm.h
+./scalar1.lo: ../../include/net-snmp/output_api.h
+./scalar1.lo: ../../include/net-snmp/library/snmp_debug.h
+./scalar1.lo: ../../include/net-snmp/library/snmp_logging.h
+./scalar1.lo: ../../include/net-snmp/snmpv3_api.h
+./scalar1.lo: ../../include/net-snmp/library/snmpv3.h
+./scalar1.lo: ../../include/net-snmp/library/transform_oids.h
+./scalar1.lo: ../../include/net-snmp/library/keytools.h
+./scalar1.lo: ../../include/net-snmp/library/scapi.h
+./scalar1.lo: ../../include/net-snmp/library/lcd_time.h
+./scalar1.lo: ../../include/net-snmp/library/snmp_secmod.h
+./scalar1.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./scalar1.lo: ../../include/net-snmp/library/snmpusm.h
+./scalar1.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./scalar1.lo: ../../include/net-snmp/agent/snmp_agent.h
+./scalar1.lo: ../../include/net-snmp/agent/snmp_vars.h
+./scalar1.lo: ../../include/net-snmp/agent/agent_handler.h
+./scalar1.lo: ../../include/net-snmp/agent/var_struct.h
+./scalar1.lo: ../../include/net-snmp/agent/agent_registry.h
+./scalar1.lo: ../../include/net-snmp/agent/ds_agent.h
+./scalar1.lo: ../../include/net-snmp/agent/agent_read_config.h
+./scalar1.lo: ../../include/net-snmp/agent/agent_trap.h
+./scalar1.lo: ../../include/net-snmp/agent/all_helpers.h
+./scalar1.lo: ../../include/net-snmp/agent/instance.h
+./scalar1.lo: ../../include/net-snmp/agent/multiplexer.h
+./scalar1.lo: ../../include/net-snmp/agent/null.h
+./scalar1.lo: ../../include/net-snmp/agent/debug_handler.h
+./scalar1.lo: ../../include/net-snmp/agent/old_api.h
+./scalar1.lo: ../../include/net-snmp/agent/read_only.h
+./scalar1.lo: ../../include/net-snmp/agent/serialize.h
+./scalar1.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./scalar1.lo: ../../include/net-snmp/agent/mode_end_call.h
+./scalar1.lo: ../../include/net-snmp/agent/table.h
+./scalar1.lo: ../../include/net-snmp/agent/table_data.h
+./scalar1.lo: ../../include/net-snmp/agent/table_dataset.h
+./scalar1.lo: ../../include/net-snmp/agent/table_iterator.h
+./scalar1.lo: ../../include/net-snmp/agent/mib_module_config.h
+./scalar1.lo: ../../include/net-snmp/agent/scalar.h
+./scalar.lo: ../../include/net-snmp/net-snmp-config.h
+./scalar.lo: ../../include/net-snmp/system/linux.h
+./scalar.lo: ../../include/net-snmp/system/sysv.h
+./scalar.lo: ../../include/net-snmp/system/generic.h
+./scalar.lo: ../../include/net-snmp/machine/generic.h 
+./scalar.lo:  ../../include/net-snmp/net-snmp-includes.h
+./scalar.lo:  ../../include/net-snmp/definitions.h
+./scalar.lo: ../../include/net-snmp/types.h
+./scalar.lo: ../../include/net-snmp/library/snmp_api.h
+./scalar.lo: ../../include/net-snmp/library/asn1.h
+./scalar.lo: ../../include/net-snmp/library/snmp_impl.h
+./scalar.lo: ../../include/net-snmp/library/snmp.h
+./scalar.lo: ../../include/net-snmp/library/snmp-tc.h
+./scalar.lo: ../../include/net-snmp/utilities.h
+./scalar.lo: ../../include/net-snmp/library/snmp_client.h
+./scalar.lo: ../../include/net-snmp/library/getopt.h
+./scalar.lo: ../../include/net-snmp/library/system.h
+./scalar.lo: ../../include/net-snmp/library/tools.h
+./scalar.lo: ../../include/net-snmp/library/int64.h
+./scalar.lo: ../../include/net-snmp/library/mt_support.h
+./scalar.lo: ../../include/net-snmp/library/snmp_alarm.h
+./scalar.lo: ../../include/net-snmp/library/data_list.h
+./scalar.lo: ../../include/net-snmp/library/callback.h
+./scalar.lo: ../../include/net-snmp/library/oid_stash.h
+./scalar.lo: ../../include/net-snmp/library/check_varbind.h
+./scalar.lo: ../../include/net-snmp/version.h
+./scalar.lo: ../../include/net-snmp/session_api.h
+./scalar.lo: ../../include/net-snmp/library/snmp_transport.h
+./scalar.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./scalar.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./scalar.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./scalar.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./scalar.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./scalar.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./scalar.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./scalar.lo: ../../include/net-snmp/library/ucd_compat.h
+./scalar.lo: ../../include/net-snmp/pdu_api.h
+./scalar.lo: ../../include/net-snmp/mib_api.h
+./scalar.lo: ../../include/net-snmp/library/mib.h
+./scalar.lo: ../../include/net-snmp/library/parse.h
+./scalar.lo: ../../include/net-snmp/varbind_api.h
+./scalar.lo: ../../include/net-snmp/config_api.h
+./scalar.lo: ../../include/net-snmp/library/read_config.h
+./scalar.lo: ../../include/net-snmp/library/default_store.h
+./scalar.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./scalar.lo: ../../include/net-snmp/library/snmp_enum.h
+./scalar.lo: ../../include/net-snmp/library/vacm.h
+./scalar.lo: ../../include/net-snmp/output_api.h
+./scalar.lo: ../../include/net-snmp/library/snmp_debug.h
+./scalar.lo: ../../include/net-snmp/library/snmp_logging.h
+./scalar.lo: ../../include/net-snmp/snmpv3_api.h
+./scalar.lo: ../../include/net-snmp/library/snmpv3.h
+./scalar.lo: ../../include/net-snmp/library/transform_oids.h
+./scalar.lo: ../../include/net-snmp/library/keytools.h
+./scalar.lo: ../../include/net-snmp/library/scapi.h
+./scalar.lo: ../../include/net-snmp/library/lcd_time.h
+./scalar.lo: ../../include/net-snmp/library/snmp_secmod.h
+./scalar.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./scalar.lo: ../../include/net-snmp/library/snmpusm.h
+./scalar.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./scalar.lo: ../../include/net-snmp/agent/snmp_agent.h
+./scalar.lo: ../../include/net-snmp/agent/snmp_vars.h
+./scalar.lo: ../../include/net-snmp/agent/agent_handler.h
+./scalar.lo: ../../include/net-snmp/agent/var_struct.h
+./scalar.lo: ../../include/net-snmp/agent/agent_registry.h
+./scalar.lo: ../../include/net-snmp/agent/ds_agent.h
+./scalar.lo: ../../include/net-snmp/agent/agent_read_config.h
+./scalar.lo: ../../include/net-snmp/agent/agent_trap.h
+./scalar.lo: ../../include/net-snmp/agent/all_helpers.h
+./scalar.lo: ../../include/net-snmp/agent/instance.h
+./scalar.lo: ../../include/net-snmp/agent/multiplexer.h
+./scalar.lo: ../../include/net-snmp/agent/null.h
+./scalar.lo: ../../include/net-snmp/agent/debug_handler.h
+./scalar.lo: ../../include/net-snmp/agent/old_api.h
+./scalar.lo: ../../include/net-snmp/agent/read_only.h
+./scalar.lo: ../../include/net-snmp/agent/serialize.h
+./scalar.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./scalar.lo: ../../include/net-snmp/agent/mode_end_call.h
+./scalar.lo: ../../include/net-snmp/agent/table.h
+./scalar.lo: ../../include/net-snmp/agent/table_data.h
+./scalar.lo: ../../include/net-snmp/agent/table_dataset.h
+./scalar.lo: ../../include/net-snmp/agent/table_iterator.h
+./scalar.lo: ../../include/net-snmp/agent/mib_module_config.h
+./scalar.lo: ../../include/net-snmp/agent/scalar.h
+./serialize.lo: ../../include/net-snmp/net-snmp-config.h
+./serialize.lo: ../../include/net-snmp/system/linux.h
+./serialize.lo: ../../include/net-snmp/system/sysv.h
+./serialize.lo: ../../include/net-snmp/system/generic.h
+./serialize.lo: ../../include/net-snmp/machine/generic.h
+./serialize.lo: ../../include/net-snmp/net-snmp-includes.h
+./serialize.lo:  ../../include/net-snmp/definitions.h
+./serialize.lo: ../../include/net-snmp/types.h
+./serialize.lo: ../../include/net-snmp/library/snmp_api.h
+./serialize.lo: ../../include/net-snmp/library/asn1.h
+./serialize.lo: ../../include/net-snmp/library/snmp_impl.h
+./serialize.lo: ../../include/net-snmp/library/snmp.h
+./serialize.lo: ../../include/net-snmp/library/snmp-tc.h
+./serialize.lo: ../../include/net-snmp/utilities.h
+./serialize.lo: ../../include/net-snmp/library/snmp_client.h
+./serialize.lo: ../../include/net-snmp/library/getopt.h
+./serialize.lo: ../../include/net-snmp/library/system.h
+./serialize.lo: ../../include/net-snmp/library/tools.h
+./serialize.lo: ../../include/net-snmp/library/int64.h
+./serialize.lo: ../../include/net-snmp/library/mt_support.h
+./serialize.lo: ../../include/net-snmp/library/snmp_alarm.h
+./serialize.lo: ../../include/net-snmp/library/data_list.h
+./serialize.lo: ../../include/net-snmp/library/callback.h
+./serialize.lo: ../../include/net-snmp/library/oid_stash.h
+./serialize.lo: ../../include/net-snmp/library/check_varbind.h
+./serialize.lo: ../../include/net-snmp/version.h
+./serialize.lo: ../../include/net-snmp/session_api.h
+./serialize.lo: ../../include/net-snmp/library/snmp_transport.h
+./serialize.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./serialize.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./serialize.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./serialize.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./serialize.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./serialize.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./serialize.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./serialize.lo: ../../include/net-snmp/library/ucd_compat.h
+./serialize.lo: ../../include/net-snmp/pdu_api.h
+./serialize.lo: ../../include/net-snmp/mib_api.h
+./serialize.lo: ../../include/net-snmp/library/mib.h
+./serialize.lo: ../../include/net-snmp/library/parse.h
+./serialize.lo: ../../include/net-snmp/varbind_api.h
+./serialize.lo: ../../include/net-snmp/config_api.h
+./serialize.lo: ../../include/net-snmp/library/read_config.h
+./serialize.lo: ../../include/net-snmp/library/default_store.h
+./serialize.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./serialize.lo: ../../include/net-snmp/library/snmp_enum.h
+./serialize.lo: ../../include/net-snmp/library/vacm.h
+./serialize.lo: ../../include/net-snmp/output_api.h
+./serialize.lo: ../../include/net-snmp/library/snmp_debug.h
+./serialize.lo: ../../include/net-snmp/library/snmp_logging.h
+./serialize.lo: ../../include/net-snmp/snmpv3_api.h
+./serialize.lo: ../../include/net-snmp/library/snmpv3.h
+./serialize.lo: ../../include/net-snmp/library/transform_oids.h
+./serialize.lo: ../../include/net-snmp/library/keytools.h
+./serialize.lo: ../../include/net-snmp/library/scapi.h
+./serialize.lo: ../../include/net-snmp/library/lcd_time.h
+./serialize.lo: ../../include/net-snmp/library/snmp_secmod.h
+./serialize.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./serialize.lo: ../../include/net-snmp/library/snmpusm.h
+./serialize.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./serialize.lo: ../../include/net-snmp/agent/snmp_agent.h
+./serialize.lo: ../../include/net-snmp/agent/snmp_vars.h
+./serialize.lo: ../../include/net-snmp/agent/agent_handler.h
+./serialize.lo: ../../include/net-snmp/agent/var_struct.h
+./serialize.lo: ../../include/net-snmp/agent/agent_registry.h
+./serialize.lo: ../../include/net-snmp/agent/ds_agent.h
+./serialize.lo: ../../include/net-snmp/agent/agent_read_config.h
+./serialize.lo: ../../include/net-snmp/agent/agent_trap.h
+./serialize.lo: ../../include/net-snmp/agent/all_helpers.h
+./serialize.lo: ../../include/net-snmp/agent/instance.h
+./serialize.lo: ../../include/net-snmp/agent/multiplexer.h
+./serialize.lo: ../../include/net-snmp/agent/null.h
+./serialize.lo: ../../include/net-snmp/agent/debug_handler.h
+./serialize.lo: ../../include/net-snmp/agent/old_api.h
+./serialize.lo: ../../include/net-snmp/agent/read_only.h
+./serialize.lo: ../../include/net-snmp/agent/serialize.h
+./serialize.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./serialize.lo: ../../include/net-snmp/agent/mode_end_call.h
+./serialize.lo: ../../include/net-snmp/agent/table.h
+./serialize.lo: ../../include/net-snmp/agent/table_data.h
+./serialize.lo: ../../include/net-snmp/agent/table_dataset.h
+./serialize.lo: ../../include/net-snmp/agent/table_iterator.h
+./serialize.lo: ../../include/net-snmp/agent/mib_module_config.h
+./table_array.lo: ../../include/net-snmp/net-snmp-config.h
+./table_array.lo: ../../include/net-snmp/system/linux.h
+./table_array.lo: ../../include/net-snmp/system/sysv.h
+./table_array.lo: ../../include/net-snmp/system/generic.h
+./table_array.lo: ../../include/net-snmp/machine/generic.h
+./table_array.lo: ../../include/net-snmp/net-snmp-includes.h
+./table_array.lo: ../../include/net-snmp/definitions.h
+./table_array.lo: ../../include/net-snmp/types.h
+./table_array.lo: ../../include/net-snmp/library/snmp_api.h
+./table_array.lo: ../../include/net-snmp/library/asn1.h
+./table_array.lo: ../../include/net-snmp/library/snmp_impl.h
+./table_array.lo: ../../include/net-snmp/library/snmp.h
+./table_array.lo: ../../include/net-snmp/library/snmp-tc.h
+./table_array.lo: ../../include/net-snmp/utilities.h
+./table_array.lo: ../../include/net-snmp/library/snmp_client.h
+./table_array.lo: ../../include/net-snmp/library/getopt.h
+./table_array.lo: ../../include/net-snmp/library/system.h
+./table_array.lo: ../../include/net-snmp/library/tools.h
+./table_array.lo: ../../include/net-snmp/library/int64.h
+./table_array.lo: ../../include/net-snmp/library/mt_support.h
+./table_array.lo: ../../include/net-snmp/library/snmp_alarm.h
+./table_array.lo: ../../include/net-snmp/library/data_list.h
+./table_array.lo: ../../include/net-snmp/library/callback.h
+./table_array.lo: ../../include/net-snmp/library/oid_stash.h
+./table_array.lo: ../../include/net-snmp/library/check_varbind.h
+./table_array.lo: ../../include/net-snmp/version.h
+./table_array.lo: ../../include/net-snmp/session_api.h
+./table_array.lo: ../../include/net-snmp/library/snmp_transport.h
+./table_array.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./table_array.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./table_array.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./table_array.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./table_array.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./table_array.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./table_array.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./table_array.lo: ../../include/net-snmp/library/ucd_compat.h
+./table_array.lo: ../../include/net-snmp/pdu_api.h
+./table_array.lo: ../../include/net-snmp/mib_api.h
+./table_array.lo: ../../include/net-snmp/library/mib.h
+./table_array.lo: ../../include/net-snmp/library/parse.h
+./table_array.lo: ../../include/net-snmp/varbind_api.h
+./table_array.lo: ../../include/net-snmp/config_api.h
+./table_array.lo: ../../include/net-snmp/library/read_config.h
+./table_array.lo: ../../include/net-snmp/library/default_store.h
+./table_array.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./table_array.lo: ../../include/net-snmp/library/snmp_enum.h
+./table_array.lo: ../../include/net-snmp/library/vacm.h
+./table_array.lo: ../../include/net-snmp/output_api.h
+./table_array.lo: ../../include/net-snmp/library/snmp_debug.h
+./table_array.lo: ../../include/net-snmp/library/snmp_logging.h
+./table_array.lo: ../../include/net-snmp/snmpv3_api.h
+./table_array.lo: ../../include/net-snmp/library/snmpv3.h
+./table_array.lo: ../../include/net-snmp/library/transform_oids.h
+./table_array.lo: ../../include/net-snmp/library/keytools.h
+./table_array.lo: ../../include/net-snmp/library/scapi.h
+./table_array.lo: ../../include/net-snmp/library/lcd_time.h
+./table_array.lo: ../../include/net-snmp/library/snmp_secmod.h
+./table_array.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./table_array.lo: ../../include/net-snmp/library/snmpusm.h
+./table_array.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./table_array.lo: ../../include/net-snmp/agent/snmp_agent.h
+./table_array.lo: ../../include/net-snmp/agent/snmp_vars.h
+./table_array.lo: ../../include/net-snmp/agent/agent_handler.h
+./table_array.lo: ../../include/net-snmp/agent/var_struct.h
+./table_array.lo: ../../include/net-snmp/agent/agent_registry.h
+./table_array.lo: ../../include/net-snmp/agent/ds_agent.h
+./table_array.lo: ../../include/net-snmp/agent/agent_read_config.h
+./table_array.lo: ../../include/net-snmp/agent/agent_trap.h
+./table_array.lo: ../../include/net-snmp/agent/all_helpers.h
+./table_array.lo: ../../include/net-snmp/agent/instance.h
+./table_array.lo: ../../include/net-snmp/agent/multiplexer.h
+./table_array.lo: ../../include/net-snmp/agent/null.h
+./table_array.lo: ../../include/net-snmp/agent/debug_handler.h
+./table_array.lo: ../../include/net-snmp/agent/old_api.h
+./table_array.lo: ../../include/net-snmp/agent/read_only.h
+./table_array.lo: ../../include/net-snmp/agent/serialize.h
+./table_array.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./table_array.lo: ../../include/net-snmp/agent/mode_end_call.h
+./table_array.lo: ../../include/net-snmp/agent/table.h
+./table_array.lo: ../../include/net-snmp/agent/table_data.h
+./table_array.lo: ../../include/net-snmp/agent/table_dataset.h
+./table_array.lo: ../../include/net-snmp/agent/table_iterator.h
+./table_array.lo: ../../include/net-snmp/agent/mib_module_config.h
+./table_array.lo: ../../include/net-snmp/agent/table_array.h
+./table_array.lo: ../../include/net-snmp/library/container.h
+./table_array.lo: ../../include/net-snmp/library/factory.h
+./table_array.lo: ../../include/net-snmp/library/snmp_assert.h
+./table.lo: ../../include/net-snmp/net-snmp-config.h
+./table.lo: ../../include/net-snmp/system/linux.h
+./table.lo: ../../include/net-snmp/system/sysv.h
+./table.lo: ../../include/net-snmp/system/generic.h
+./table.lo: ../../include/net-snmp/machine/generic.h 
+./table.lo:  ../../include/net-snmp/net-snmp-includes.h
+./table.lo:  ../../include/net-snmp/definitions.h
+./table.lo: ../../include/net-snmp/types.h
+./table.lo: ../../include/net-snmp/library/snmp_api.h
+./table.lo: ../../include/net-snmp/library/asn1.h
+./table.lo: ../../include/net-snmp/library/snmp_impl.h
+./table.lo: ../../include/net-snmp/library/snmp.h
+./table.lo: ../../include/net-snmp/library/snmp-tc.h
+./table.lo: ../../include/net-snmp/utilities.h
+./table.lo: ../../include/net-snmp/library/snmp_client.h
+./table.lo: ../../include/net-snmp/library/getopt.h
+./table.lo: ../../include/net-snmp/library/system.h
+./table.lo: ../../include/net-snmp/library/tools.h
+./table.lo: ../../include/net-snmp/library/int64.h
+./table.lo: ../../include/net-snmp/library/mt_support.h
+./table.lo: ../../include/net-snmp/library/snmp_alarm.h
+./table.lo: ../../include/net-snmp/library/data_list.h
+./table.lo: ../../include/net-snmp/library/callback.h
+./table.lo: ../../include/net-snmp/library/oid_stash.h
+./table.lo: ../../include/net-snmp/library/check_varbind.h
+./table.lo: ../../include/net-snmp/version.h
+./table.lo: ../../include/net-snmp/session_api.h
+./table.lo: ../../include/net-snmp/library/snmp_transport.h
+./table.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./table.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./table.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./table.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./table.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./table.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./table.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./table.lo: ../../include/net-snmp/library/ucd_compat.h
+./table.lo: ../../include/net-snmp/pdu_api.h ../../include/net-snmp/mib_api.h
+./table.lo: ../../include/net-snmp/library/mib.h
+./table.lo: ../../include/net-snmp/library/parse.h
+./table.lo: ../../include/net-snmp/varbind_api.h
+./table.lo: ../../include/net-snmp/config_api.h
+./table.lo: ../../include/net-snmp/library/read_config.h
+./table.lo: ../../include/net-snmp/library/default_store.h
+./table.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./table.lo: ../../include/net-snmp/library/snmp_enum.h
+./table.lo: ../../include/net-snmp/library/vacm.h
+./table.lo: ../../include/net-snmp/output_api.h
+./table.lo: ../../include/net-snmp/library/snmp_debug.h
+./table.lo: ../../include/net-snmp/library/snmp_logging.h
+./table.lo: ../../include/net-snmp/snmpv3_api.h
+./table.lo: ../../include/net-snmp/library/snmpv3.h
+./table.lo: ../../include/net-snmp/library/transform_oids.h
+./table.lo: ../../include/net-snmp/library/keytools.h
+./table.lo: ../../include/net-snmp/library/scapi.h
+./table.lo: ../../include/net-snmp/library/lcd_time.h
+./table.lo: ../../include/net-snmp/library/snmp_secmod.h
+./table.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./table.lo: ../../include/net-snmp/library/snmpusm.h
+./table.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./table.lo: ../../include/net-snmp/agent/snmp_agent.h
+./table.lo: ../../include/net-snmp/agent/snmp_vars.h
+./table.lo: ../../include/net-snmp/agent/agent_handler.h
+./table.lo: ../../include/net-snmp/agent/var_struct.h
+./table.lo: ../../include/net-snmp/agent/agent_registry.h
+./table.lo: ../../include/net-snmp/agent/ds_agent.h
+./table.lo: ../../include/net-snmp/agent/agent_read_config.h
+./table.lo: ../../include/net-snmp/agent/agent_trap.h
+./table.lo: ../../include/net-snmp/agent/all_helpers.h
+./table.lo: ../../include/net-snmp/agent/instance.h
+./table.lo: ../../include/net-snmp/agent/multiplexer.h
+./table.lo: ../../include/net-snmp/agent/null.h
+./table.lo: ../../include/net-snmp/agent/debug_handler.h
+./table.lo: ../../include/net-snmp/agent/old_api.h
+./table.lo: ../../include/net-snmp/agent/read_only.h
+./table.lo: ../../include/net-snmp/agent/serialize.h
+./table.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./table.lo: ../../include/net-snmp/agent/mode_end_call.h
+./table.lo: ../../include/net-snmp/agent/table.h
+./table.lo: ../../include/net-snmp/agent/table_data.h
+./table.lo: ../../include/net-snmp/agent/table_dataset.h
+./table.lo: ../../include/net-snmp/agent/table_iterator.h
+./table.lo: ../../include/net-snmp/agent/mib_module_config.h
+./table.lo: ../../include/net-snmp/library/snmp_assert.h
+./table_data.lo: ../../include/net-snmp/net-snmp-config.h
+./table_data.lo: ../../include/net-snmp/system/linux.h
+./table_data.lo: ../../include/net-snmp/system/sysv.h
+./table_data.lo: ../../include/net-snmp/system/generic.h
+./table_data.lo: ../../include/net-snmp/machine/generic.h
+./table_data.lo: ../../include/net-snmp/net-snmp-includes.h
+./table_data.lo:  ../../include/net-snmp/definitions.h
+./table_data.lo: ../../include/net-snmp/types.h
+./table_data.lo: ../../include/net-snmp/library/snmp_api.h
+./table_data.lo: ../../include/net-snmp/library/asn1.h
+./table_data.lo: ../../include/net-snmp/library/snmp_impl.h
+./table_data.lo: ../../include/net-snmp/library/snmp.h
+./table_data.lo: ../../include/net-snmp/library/snmp-tc.h
+./table_data.lo: ../../include/net-snmp/utilities.h
+./table_data.lo: ../../include/net-snmp/library/snmp_client.h
+./table_data.lo: ../../include/net-snmp/library/getopt.h
+./table_data.lo: ../../include/net-snmp/library/system.h
+./table_data.lo: ../../include/net-snmp/library/tools.h
+./table_data.lo: ../../include/net-snmp/library/int64.h
+./table_data.lo: ../../include/net-snmp/library/mt_support.h
+./table_data.lo: ../../include/net-snmp/library/snmp_alarm.h
+./table_data.lo: ../../include/net-snmp/library/data_list.h
+./table_data.lo: ../../include/net-snmp/library/callback.h
+./table_data.lo: ../../include/net-snmp/library/oid_stash.h
+./table_data.lo: ../../include/net-snmp/library/check_varbind.h
+./table_data.lo: ../../include/net-snmp/version.h
+./table_data.lo: ../../include/net-snmp/session_api.h
+./table_data.lo: ../../include/net-snmp/library/snmp_transport.h
+./table_data.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./table_data.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./table_data.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./table_data.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./table_data.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./table_data.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./table_data.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./table_data.lo: ../../include/net-snmp/library/ucd_compat.h
+./table_data.lo: ../../include/net-snmp/pdu_api.h
+./table_data.lo: ../../include/net-snmp/mib_api.h
+./table_data.lo: ../../include/net-snmp/library/mib.h
+./table_data.lo: ../../include/net-snmp/library/parse.h
+./table_data.lo: ../../include/net-snmp/varbind_api.h
+./table_data.lo: ../../include/net-snmp/config_api.h
+./table_data.lo: ../../include/net-snmp/library/read_config.h
+./table_data.lo: ../../include/net-snmp/library/default_store.h
+./table_data.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./table_data.lo: ../../include/net-snmp/library/snmp_enum.h
+./table_data.lo: ../../include/net-snmp/library/vacm.h
+./table_data.lo: ../../include/net-snmp/output_api.h
+./table_data.lo: ../../include/net-snmp/library/snmp_debug.h
+./table_data.lo: ../../include/net-snmp/library/snmp_logging.h
+./table_data.lo: ../../include/net-snmp/snmpv3_api.h
+./table_data.lo: ../../include/net-snmp/library/snmpv3.h
+./table_data.lo: ../../include/net-snmp/library/transform_oids.h
+./table_data.lo: ../../include/net-snmp/library/keytools.h
+./table_data.lo: ../../include/net-snmp/library/scapi.h
+./table_data.lo: ../../include/net-snmp/library/lcd_time.h
+./table_data.lo: ../../include/net-snmp/library/snmp_secmod.h
+./table_data.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./table_data.lo: ../../include/net-snmp/library/snmpusm.h
+./table_data.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./table_data.lo: ../../include/net-snmp/agent/snmp_agent.h
+./table_data.lo: ../../include/net-snmp/agent/snmp_vars.h
+./table_data.lo: ../../include/net-snmp/agent/agent_handler.h
+./table_data.lo: ../../include/net-snmp/agent/var_struct.h
+./table_data.lo: ../../include/net-snmp/agent/agent_registry.h
+./table_data.lo: ../../include/net-snmp/agent/ds_agent.h
+./table_data.lo: ../../include/net-snmp/agent/agent_read_config.h
+./table_data.lo: ../../include/net-snmp/agent/agent_trap.h
+./table_data.lo: ../../include/net-snmp/agent/all_helpers.h
+./table_data.lo: ../../include/net-snmp/agent/instance.h
+./table_data.lo: ../../include/net-snmp/agent/multiplexer.h
+./table_data.lo: ../../include/net-snmp/agent/null.h
+./table_data.lo: ../../include/net-snmp/agent/debug_handler.h
+./table_data.lo: ../../include/net-snmp/agent/old_api.h
+./table_data.lo: ../../include/net-snmp/agent/read_only.h
+./table_data.lo: ../../include/net-snmp/agent/serialize.h
+./table_data.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./table_data.lo: ../../include/net-snmp/agent/mode_end_call.h
+./table_data.lo: ../../include/net-snmp/agent/table.h
+./table_data.lo: ../../include/net-snmp/agent/table_data.h
+./table_data.lo: ../../include/net-snmp/agent/table_dataset.h
+./table_data.lo: ../../include/net-snmp/agent/table_iterator.h
+./table_data.lo: ../../include/net-snmp/agent/mib_module_config.h
+./table_dataset.lo: ../../include/net-snmp/net-snmp-config.h
+./table_dataset.lo: ../../include/net-snmp/system/linux.h
+./table_dataset.lo: ../../include/net-snmp/system/sysv.h
+./table_dataset.lo: ../../include/net-snmp/system/generic.h
+./table_dataset.lo: ../../include/net-snmp/machine/generic.h
+./table_dataset.lo: ../../include/net-snmp/net-snmp-includes.h
+./table_dataset.lo: ../../include/net-snmp/definitions.h
+./table_dataset.lo: ../../include/net-snmp/types.h
+./table_dataset.lo: ../../include/net-snmp/library/snmp_api.h
+./table_dataset.lo: ../../include/net-snmp/library/asn1.h
+./table_dataset.lo: ../../include/net-snmp/library/snmp_impl.h
+./table_dataset.lo: ../../include/net-snmp/library/snmp.h
+./table_dataset.lo: ../../include/net-snmp/library/snmp-tc.h
+./table_dataset.lo: ../../include/net-snmp/utilities.h
+./table_dataset.lo: ../../include/net-snmp/library/snmp_client.h
+./table_dataset.lo: ../../include/net-snmp/library/getopt.h
+./table_dataset.lo: ../../include/net-snmp/library/system.h
+./table_dataset.lo: ../../include/net-snmp/library/tools.h
+./table_dataset.lo: ../../include/net-snmp/library/int64.h
+./table_dataset.lo: ../../include/net-snmp/library/mt_support.h
+./table_dataset.lo: ../../include/net-snmp/library/snmp_alarm.h
+./table_dataset.lo: ../../include/net-snmp/library/data_list.h
+./table_dataset.lo: ../../include/net-snmp/library/callback.h
+./table_dataset.lo: ../../include/net-snmp/library/oid_stash.h
+./table_dataset.lo: ../../include/net-snmp/library/check_varbind.h
+./table_dataset.lo: ../../include/net-snmp/version.h
+./table_dataset.lo: ../../include/net-snmp/session_api.h
+./table_dataset.lo: ../../include/net-snmp/library/snmp_transport.h
+./table_dataset.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./table_dataset.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./table_dataset.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./table_dataset.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./table_dataset.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./table_dataset.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./table_dataset.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./table_dataset.lo: ../../include/net-snmp/library/ucd_compat.h
+./table_dataset.lo: ../../include/net-snmp/pdu_api.h
+./table_dataset.lo: ../../include/net-snmp/mib_api.h
+./table_dataset.lo: ../../include/net-snmp/library/mib.h
+./table_dataset.lo: ../../include/net-snmp/library/parse.h
+./table_dataset.lo: ../../include/net-snmp/varbind_api.h
+./table_dataset.lo: ../../include/net-snmp/config_api.h
+./table_dataset.lo: ../../include/net-snmp/library/read_config.h
+./table_dataset.lo: ../../include/net-snmp/library/default_store.h
+./table_dataset.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./table_dataset.lo: ../../include/net-snmp/library/snmp_enum.h
+./table_dataset.lo: ../../include/net-snmp/library/vacm.h
+./table_dataset.lo: ../../include/net-snmp/output_api.h
+./table_dataset.lo: ../../include/net-snmp/library/snmp_debug.h
+./table_dataset.lo: ../../include/net-snmp/library/snmp_logging.h
+./table_dataset.lo: ../../include/net-snmp/snmpv3_api.h
+./table_dataset.lo: ../../include/net-snmp/library/snmpv3.h
+./table_dataset.lo: ../../include/net-snmp/library/transform_oids.h
+./table_dataset.lo: ../../include/net-snmp/library/keytools.h
+./table_dataset.lo: ../../include/net-snmp/library/scapi.h
+./table_dataset.lo: ../../include/net-snmp/library/lcd_time.h
+./table_dataset.lo: ../../include/net-snmp/library/snmp_secmod.h
+./table_dataset.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./table_dataset.lo: ../../include/net-snmp/library/snmpusm.h
+./table_dataset.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./table_dataset.lo: ../../include/net-snmp/agent/snmp_agent.h
+./table_dataset.lo: ../../include/net-snmp/agent/snmp_vars.h
+./table_dataset.lo: ../../include/net-snmp/agent/agent_handler.h
+./table_dataset.lo: ../../include/net-snmp/agent/var_struct.h
+./table_dataset.lo: ../../include/net-snmp/agent/agent_registry.h
+./table_dataset.lo: ../../include/net-snmp/agent/ds_agent.h
+./table_dataset.lo: ../../include/net-snmp/agent/agent_read_config.h
+./table_dataset.lo: ../../include/net-snmp/agent/agent_trap.h
+./table_dataset.lo: ../../include/net-snmp/agent/all_helpers.h
+./table_dataset.lo: ../../include/net-snmp/agent/instance.h
+./table_dataset.lo: ../../include/net-snmp/agent/multiplexer.h
+./table_dataset.lo: ../../include/net-snmp/agent/null.h
+./table_dataset.lo: ../../include/net-snmp/agent/debug_handler.h
+./table_dataset.lo: ../../include/net-snmp/agent/old_api.h
+./table_dataset.lo: ../../include/net-snmp/agent/read_only.h
+./table_dataset.lo: ../../include/net-snmp/agent/serialize.h
+./table_dataset.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./table_dataset.lo: ../../include/net-snmp/agent/mode_end_call.h
+./table_dataset.lo: ../../include/net-snmp/agent/table.h
+./table_dataset.lo: ../../include/net-snmp/agent/table_data.h
+./table_dataset.lo: ../../include/net-snmp/agent/table_dataset.h
+./table_dataset.lo: ../../include/net-snmp/agent/table_iterator.h
+./table_dataset.lo: ../../include/net-snmp/agent/mib_module_config.h
+./table_iterator.lo: ../../include/net-snmp/net-snmp-config.h
+./table_iterator.lo: ../../include/net-snmp/system/linux.h
+./table_iterator.lo: ../../include/net-snmp/system/sysv.h
+./table_iterator.lo: ../../include/net-snmp/system/generic.h
+./table_iterator.lo: ../../include/net-snmp/machine/generic.h
+./table_iterator.lo: ../../include/net-snmp/net-snmp-includes.h
+./table_iterator.lo: ../../include/net-snmp/definitions.h
+./table_iterator.lo: ../../include/net-snmp/types.h
+./table_iterator.lo: ../../include/net-snmp/library/snmp_api.h
+./table_iterator.lo: ../../include/net-snmp/library/asn1.h
+./table_iterator.lo: ../../include/net-snmp/library/snmp_impl.h
+./table_iterator.lo: ../../include/net-snmp/library/snmp.h
+./table_iterator.lo: ../../include/net-snmp/library/snmp-tc.h
+./table_iterator.lo: ../../include/net-snmp/utilities.h
+./table_iterator.lo: ../../include/net-snmp/library/snmp_client.h
+./table_iterator.lo: ../../include/net-snmp/library/getopt.h
+./table_iterator.lo: ../../include/net-snmp/library/system.h
+./table_iterator.lo: ../../include/net-snmp/library/tools.h
+./table_iterator.lo: ../../include/net-snmp/library/int64.h
+./table_iterator.lo: ../../include/net-snmp/library/mt_support.h
+./table_iterator.lo: ../../include/net-snmp/library/snmp_alarm.h
+./table_iterator.lo: ../../include/net-snmp/library/data_list.h
+./table_iterator.lo: ../../include/net-snmp/library/callback.h
+./table_iterator.lo: ../../include/net-snmp/library/oid_stash.h
+./table_iterator.lo: ../../include/net-snmp/library/check_varbind.h
+./table_iterator.lo: ../../include/net-snmp/version.h
+./table_iterator.lo: ../../include/net-snmp/session_api.h
+./table_iterator.lo: ../../include/net-snmp/library/snmp_transport.h
+./table_iterator.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./table_iterator.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./table_iterator.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./table_iterator.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./table_iterator.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./table_iterator.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./table_iterator.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./table_iterator.lo: ../../include/net-snmp/library/ucd_compat.h
+./table_iterator.lo: ../../include/net-snmp/pdu_api.h
+./table_iterator.lo: ../../include/net-snmp/mib_api.h
+./table_iterator.lo: ../../include/net-snmp/library/mib.h
+./table_iterator.lo: ../../include/net-snmp/library/parse.h
+./table_iterator.lo: ../../include/net-snmp/varbind_api.h
+./table_iterator.lo: ../../include/net-snmp/config_api.h
+./table_iterator.lo: ../../include/net-snmp/library/read_config.h
+./table_iterator.lo: ../../include/net-snmp/library/default_store.h
+./table_iterator.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./table_iterator.lo: ../../include/net-snmp/library/snmp_enum.h
+./table_iterator.lo: ../../include/net-snmp/library/vacm.h
+./table_iterator.lo: ../../include/net-snmp/output_api.h
+./table_iterator.lo: ../../include/net-snmp/library/snmp_debug.h
+./table_iterator.lo: ../../include/net-snmp/library/snmp_logging.h
+./table_iterator.lo: ../../include/net-snmp/snmpv3_api.h
+./table_iterator.lo: ../../include/net-snmp/library/snmpv3.h
+./table_iterator.lo: ../../include/net-snmp/library/transform_oids.h
+./table_iterator.lo: ../../include/net-snmp/library/keytools.h
+./table_iterator.lo: ../../include/net-snmp/library/scapi.h
+./table_iterator.lo: ../../include/net-snmp/library/lcd_time.h
+./table_iterator.lo: ../../include/net-snmp/library/snmp_secmod.h
+./table_iterator.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./table_iterator.lo: ../../include/net-snmp/library/snmpusm.h
+./table_iterator.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./table_iterator.lo: ../../include/net-snmp/agent/snmp_agent.h
+./table_iterator.lo: ../../include/net-snmp/agent/snmp_vars.h
+./table_iterator.lo: ../../include/net-snmp/agent/agent_handler.h
+./table_iterator.lo: ../../include/net-snmp/agent/var_struct.h
+./table_iterator.lo: ../../include/net-snmp/agent/agent_registry.h
+./table_iterator.lo: ../../include/net-snmp/agent/ds_agent.h
+./table_iterator.lo: ../../include/net-snmp/agent/agent_read_config.h
+./table_iterator.lo: ../../include/net-snmp/agent/agent_trap.h
+./table_iterator.lo: ../../include/net-snmp/agent/all_helpers.h
+./table_iterator.lo: ../../include/net-snmp/agent/instance.h
+./table_iterator.lo: ../../include/net-snmp/agent/multiplexer.h
+./table_iterator.lo: ../../include/net-snmp/agent/null.h
+./table_iterator.lo: ../../include/net-snmp/agent/debug_handler.h
+./table_iterator.lo: ../../include/net-snmp/agent/old_api.h
+./table_iterator.lo: ../../include/net-snmp/agent/read_only.h
+./table_iterator.lo: ../../include/net-snmp/agent/serialize.h
+./table_iterator.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./table_iterator.lo: ../../include/net-snmp/agent/mode_end_call.h
+./table_iterator.lo: ../../include/net-snmp/agent/table.h
+./table_iterator.lo: ../../include/net-snmp/agent/table_data.h
+./table_iterator.lo: ../../include/net-snmp/agent/table_dataset.h
+./table_iterator.lo: ../../include/net-snmp/agent/table_iterator.h
+./table_iterator.lo: ../../include/net-snmp/agent/mib_module_config.h
+./watcher.lo: ../../include/net-snmp/net-snmp-config.h
+./watcher.lo: ../../include/net-snmp/system/linux.h
+./watcher.lo: ../../include/net-snmp/system/sysv.h
+./watcher.lo: ../../include/net-snmp/system/generic.h
+./watcher.lo: ../../include/net-snmp/machine/generic.h 
+./watcher.lo: ../../include/net-snmp/net-snmp-includes.h 
+./watcher.lo:  ../../include/net-snmp/definitions.h
+./watcher.lo: ../../include/net-snmp/types.h
+./watcher.lo: ../../include/net-snmp/library/snmp_api.h
+./watcher.lo: ../../include/net-snmp/library/asn1.h
+./watcher.lo: ../../include/net-snmp/library/snmp_impl.h
+./watcher.lo: ../../include/net-snmp/library/snmp.h
+./watcher.lo: ../../include/net-snmp/library/snmp-tc.h
+./watcher.lo: ../../include/net-snmp/utilities.h
+./watcher.lo: ../../include/net-snmp/library/snmp_client.h
+./watcher.lo: ../../include/net-snmp/library/getopt.h
+./watcher.lo: ../../include/net-snmp/library/system.h
+./watcher.lo: ../../include/net-snmp/library/tools.h
+./watcher.lo: ../../include/net-snmp/library/int64.h
+./watcher.lo: ../../include/net-snmp/library/mt_support.h
+./watcher.lo: ../../include/net-snmp/library/snmp_alarm.h
+./watcher.lo: ../../include/net-snmp/library/data_list.h
+./watcher.lo: ../../include/net-snmp/library/callback.h
+./watcher.lo: ../../include/net-snmp/library/oid_stash.h
+./watcher.lo: ../../include/net-snmp/library/check_varbind.h
+./watcher.lo: ../../include/net-snmp/version.h
+./watcher.lo: ../../include/net-snmp/session_api.h
+./watcher.lo: ../../include/net-snmp/library/snmp_transport.h
+./watcher.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./watcher.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./watcher.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./watcher.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./watcher.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./watcher.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./watcher.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./watcher.lo: ../../include/net-snmp/library/ucd_compat.h
+./watcher.lo: ../../include/net-snmp/pdu_api.h
+./watcher.lo: ../../include/net-snmp/mib_api.h
+./watcher.lo: ../../include/net-snmp/library/mib.h
+./watcher.lo: ../../include/net-snmp/library/parse.h
+./watcher.lo: ../../include/net-snmp/varbind_api.h
+./watcher.lo: ../../include/net-snmp/config_api.h
+./watcher.lo: ../../include/net-snmp/library/read_config.h
+./watcher.lo: ../../include/net-snmp/library/default_store.h
+./watcher.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./watcher.lo: ../../include/net-snmp/library/snmp_enum.h
+./watcher.lo: ../../include/net-snmp/library/vacm.h
+./watcher.lo: ../../include/net-snmp/output_api.h
+./watcher.lo: ../../include/net-snmp/library/snmp_debug.h
+./watcher.lo: ../../include/net-snmp/library/snmp_logging.h
+./watcher.lo: ../../include/net-snmp/snmpv3_api.h
+./watcher.lo: ../../include/net-snmp/library/snmpv3.h
+./watcher.lo: ../../include/net-snmp/library/transform_oids.h
+./watcher.lo: ../../include/net-snmp/library/keytools.h
+./watcher.lo: ../../include/net-snmp/library/scapi.h
+./watcher.lo: ../../include/net-snmp/library/lcd_time.h
+./watcher.lo: ../../include/net-snmp/library/snmp_secmod.h
+./watcher.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./watcher.lo: ../../include/net-snmp/library/snmpusm.h
+./watcher.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./watcher.lo: ../../include/net-snmp/agent/snmp_agent.h
+./watcher.lo: ../../include/net-snmp/agent/snmp_vars.h
+./watcher.lo: ../../include/net-snmp/agent/agent_handler.h
+./watcher.lo: ../../include/net-snmp/agent/var_struct.h
+./watcher.lo: ../../include/net-snmp/agent/agent_registry.h
+./watcher.lo: ../../include/net-snmp/agent/ds_agent.h
+./watcher.lo: ../../include/net-snmp/agent/agent_read_config.h
+./watcher.lo: ../../include/net-snmp/agent/agent_trap.h
+./watcher.lo: ../../include/net-snmp/agent/all_helpers.h
+./watcher.lo: ../../include/net-snmp/agent/instance.h
+./watcher.lo: ../../include/net-snmp/agent/multiplexer.h
+./watcher.lo: ../../include/net-snmp/agent/null.h
+./watcher.lo: ../../include/net-snmp/agent/debug_handler.h
+./watcher.lo: ../../include/net-snmp/agent/old_api.h
+./watcher.lo: ../../include/net-snmp/agent/read_only.h
+./watcher.lo: ../../include/net-snmp/agent/serialize.h
+./watcher.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./watcher.lo: ../../include/net-snmp/agent/mode_end_call.h
+./watcher.lo: ../../include/net-snmp/agent/table.h
+./watcher.lo: ../../include/net-snmp/agent/table_data.h
+./watcher.lo: ../../include/net-snmp/agent/table_dataset.h
+./watcher.lo: ../../include/net-snmp/agent/table_iterator.h
+./watcher.lo: ../../include/net-snmp/agent/mib_module_config.h
+./watcher.lo: ../../include/net-snmp/agent/watcher.h
+./watcher.lo: ../../include/net-snmp/agent/scalar.h
diff -Naur tomato/release/src/router/snmp/agent/helpers/Makefile.in tomato121/release/src/router/snmp/agent/helpers/Makefile.in
--- tomato/release/src/router/snmp/agent/helpers/Makefile.in	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/helpers/Makefile.in	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,95 @@
+top_builddir=../..
+
+#
+# What to install
+#
+
+INSTALLLIBS=libnetsnmphelpers.$(LIB_EXTENSION)$(LIB_VERSION)
+INCLUDESUBDIR=agent
+INCLUDESUBDIRHEADERS=all_helpers.h \
+	instance.h \
+	scalar.h \
+	watcher.h \
+        multiplexer.h \
+	bulk_to_next.h \
+        null.h \
+        debug_handler.h \
+        old_api.h \
+        read_only.h \
+        serialize.h \
+        set_helper.h \
+        table_data.h \
+        table_dataset.h \
+	table_array.h \
+        table.h \
+        table_iterator.h \
+	mode_end_call.h
+
+
+#
+# Build info
+#
+CPPFLAGS=-I../../include -I$(top_srcdir)/include \
+	-I. -I.. -I../.. -I$(srcdir) -I$(srcdir)/..  \
+	-I$(srcdir)/../mibgroup -I$(srcdir)/../.. -I$(srcdir)/../../snmplib \
+	@CPPFLAGS@ $(LIB_CFLAGS)
+
+OBJS =  all_helpers.o \
+	multiplexer.o \
+	read_only.o \
+	bulk_to_next.o \
+	instance.o \
+	scalar.o \
+	watcher.o \
+	null.o \
+	debug_handler.o \
+	old_api.o \
+	serialize.o \
+	table_array.o \
+	table_iterator.o \
+	table_data.o \
+	table_dataset.o \
+	table.o \
+	mode_end_call.o
+
+LOBJS = all_helpers.lo \
+	multiplexer.lo \
+	read_only.lo \
+	bulk_to_next.lo \
+	instance.lo \
+	scalar.lo \
+	watcher.lo \
+	null.lo \
+	debug_handler.lo \
+	old_api.lo \
+	serialize.lo \
+	table_array.lo \
+	table_iterator.lo \
+	table_data.lo \
+	table_dataset.lo \
+	table.lo \
+	mode_end_call.lo
+
+SRCS =  all_helpers.c \
+	multiplexer.c \
+	read_only.c \
+	bulk_to_next.c \
+	instance.c \
+	scalar.c \
+	watcher.c \
+	null.c \
+	debug_handler.c \
+	old_api.c \
+	serialize.c \
+	table_array.c \
+	table_iterator.c \
+	table_data.c \
+	table_dataset.c \
+	table.c \
+	mode_end_call.c
+
+all: standardall
+
+libnetsnmphelpers.$(LIB_EXTENSION)$(LIB_VERSION):    ${LOBJS}
+	$(LIB_LD_CMD) libnetsnmphelpers.$(LIB_EXTENSION)$(LIB_VERSION) ${LOBJS}  $(LIB_LD_LIBS)
+	$(RANLIB) libnetsnmphelpers.$(LIB_EXTENSION)$(LIB_VERSION)
diff -Naur tomato/release/src/router/snmp/agent/helpers/mode_end_call.c tomato121/release/src/router/snmp/agent/helpers/mode_end_call.c
--- tomato/release/src/router/snmp/agent/helpers/mode_end_call.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/helpers/mode_end_call.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,108 @@
+#include <net-snmp/net-snmp-config.h>
+
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+#include <net-snmp/agent/mode_end_call.h>
+
+#if HAVE_DMALLOC_H
+#include <dmalloc.h>
+#endif
+
+/** @defgroup mode_end_call mode_end_call: at the end of a series of requests, call another handler hook.
+ *  Handlers that want to loop through a series of requests and then
+ *  receive a callback at the end of a particular MODE can use this
+ *  helper to make this possible.  For most modules, this is not
+ *  needed as the handler itself could perform a for() loop around the
+ *  request list and then perform its actions afterwards.  However, if
+ *  something like the serialize helper is in use this isn't possible
+ *  because not all the requests for a given handler are being passed
+ *  downward in a single group.  Thus, this helper *must* be added
+ *  above other helpers like the serialize helper to be useful.
+ *
+ *  Multiple mode specific handlers can be registered and will be
+ *  called in the order they were regestered in.  Callbacks regesterd
+ *  with a mode of NETSNMP_MODE_END_ALL_MODES will be called for all
+ *  modes.
+ * 
+ *  @ingroup handler
+ *  @{
+ */
+
+/** returns a mode_end_call handler that can be injected into a given
+ *  handler chain.
+ * @param endlist The callback list for the handler to make use of.
+ * @return An injectable Net-SNMP handler.
+ */
+netsnmp_mib_handler *
+netsnmp_get_mode_end_call_handler(netsnmp_mode_handler_list *endlist)
+{
+    netsnmp_mib_handler *me =
+        netsnmp_create_handler("mode_end_call",
+                               netsnmp_mode_end_call_helper);
+
+    if (!me)
+        return NULL;
+
+    me->myvoid = endlist;
+    return me;
+}
+
+/** adds a mode specific callback to the callback list.
+ * @param endinfo the information structure for the mode_end_call helper.  Can be NULL to create a new list.
+ * @param mode the mode to be called upon.  A mode of NETSNMP_MODE_END_ALL_MODES = all modes.
+ * @param callbackh the netsnmp_mib_handler callback to call.
+ * @return the new registration information list upon success.
+ */
+netsnmp_mode_handler_list *
+netsnmp_mode_end_call_add_mode_callback(netsnmp_mode_handler_list *endlist,
+                                        int mode,
+                                        netsnmp_mib_handler *callbackh) {
+    netsnmp_mode_handler_list *ptr, *ptr2;
+    ptr = SNMP_MALLOC_TYPEDEF(netsnmp_mode_handler_list);
+    if (!ptr)
+        return NULL;
+    
+    ptr->mode = mode;
+    ptr->callback_handler = callbackh;
+    ptr->next = endlist;
+
+    if (!endlist)
+        return ptr;
+
+    /* get to end */
+    for(ptr2 = endlist; ptr2->next != NULL; ptr2 = ptr2->next);
+
+    ptr2->next = ptr;
+    return endlist;
+}
+    
+/** @internal Implements the mode_end_call handler */
+int
+netsnmp_mode_end_call_helper(netsnmp_mib_handler *handler,
+                            netsnmp_handler_registration *reginfo,
+                            netsnmp_agent_request_info *reqinfo,
+                            netsnmp_request_info *requests)
+{
+
+    int             ret;
+    int             ret2 = SNMP_ERR_NOERROR;
+    netsnmp_mode_handler_list *ptr;
+
+    /* always call the real handlers first */
+    ret = netsnmp_call_next_handler(handler, reginfo, reqinfo,
+                                    requests);
+
+    /* then call the callback handlers */
+    for(ptr = handler->myvoid; ptr; ptr = ptr->next) {
+        if (ptr->mode == NETSNMP_MODE_END_ALL_MODES ||
+            reqinfo->mode == ptr->mode) {
+            ret2 = netsnmp_call_handler(ptr->callback_handler, reginfo,
+                                             reqinfo, requests);
+            if (ret != SNMP_ERR_NOERROR)
+                ret = ret2;
+        }
+    }
+    
+    return ret2;
+}
diff -Naur tomato/release/src/router/snmp/agent/helpers/multiplexer.c tomato121/release/src/router/snmp/agent/helpers/multiplexer.c
--- tomato/release/src/router/snmp/agent/helpers/multiplexer.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/helpers/multiplexer.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,128 @@
+#include <net-snmp/net-snmp-config.h>
+
+#include <sys/types.h>
+
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+#include <net-snmp/agent/multiplexer.h>
+
+#if HAVE_DMALLOC_H
+#include <dmalloc.h>
+#endif
+
+/** @defgroup multiplexer multiplexer: splits mode requests into calls to different handlers.
+ *  @ingroup handler
+ * The multiplexer helper lets you split the calling chain depending
+ * on the calling mode (get vs getnext vs set).  Useful if you want
+ * different routines to handle different aspects of SNMP requests,
+ * which is very common for GET vs SET type actions.
+ *
+ * Functionally:
+ *
+ * -# GET requests call the get_method
+ * -# GETNEXT requests call the getnext_method, or if not present, the
+ *    get_method.
+ * -# GETBULK requests call the getbulk_method, or if not present, the
+ *    getnext_method, or if even that isn't present the get_method.
+ * -# SET requests call the set_method, or if not present return a
+ *    SNMP_ERR_NOTWRITABLE error.
+ *  @{
+ */
+
+/** returns a multiplixer handler given a netsnmp_mib_handler_methods structure of subhandlers.
+ */
+netsnmp_mib_handler *
+netsnmp_get_multiplexer_handler(netsnmp_mib_handler_methods *req)
+{
+    netsnmp_mib_handler *ret = NULL;
+
+    if (!req) {
+        snmp_log(LOG_INFO,
+                 "netsnmp_get_multiplexer_handler(NULL) called\n");
+        return NULL;
+    }
+
+    ret =
+        netsnmp_create_handler("multiplexer",
+                               netsnmp_multiplexer_helper_handler);
+    if (ret) {
+        ret->myvoid = (void *) req;
+    }
+    return ret;
+}
+
+/** implements the multiplexer helper */
+int
+netsnmp_multiplexer_helper_handler(netsnmp_mib_handler *handler,
+                                   netsnmp_handler_registration *reginfo,
+                                   netsnmp_agent_request_info *reqinfo,
+                                   netsnmp_request_info *requests)
+{
+
+    netsnmp_mib_handler_methods *methods;
+
+    if (!handler->myvoid) {
+        snmp_log(LOG_INFO, "improperly registered multiplexer found\n");
+        return SNMP_ERR_GENERR;
+    }
+
+    methods = (netsnmp_mib_handler_methods *) handler->myvoid;
+
+    switch (reqinfo->mode) {
+    case MODE_GET:
+        handler = methods->get_handler;
+        if (!handler) {
+            netsnmp_set_all_requests_error(reqinfo, requests,
+                                           SNMP_NOSUCHOBJECT);
+        }
+        break;
+
+    case MODE_GETNEXT:
+        handler = methods->getnext_handler;
+        if (!handler)           /* fallback to get handler */
+            handler = methods->get_handler;
+        break;
+
+    case MODE_GETBULK:
+        /*
+         * XXX: this needs to do better getbulk -> getnext
+         * handling (probably via a separate helper) 
+         */
+        handler = methods->getbulk_handler;
+        if (!handler)           /* fallback to getnext handler */
+            handler = methods->getnext_handler;
+        if (!handler)           /* fallback to getnext handler */
+            handler = methods->get_handler;
+        break;
+
+    case MODE_SET_RESERVE1:
+    case MODE_SET_RESERVE2:
+    case MODE_SET_ACTION:
+    case MODE_SET_COMMIT:
+    case MODE_SET_FREE:
+    case MODE_SET_UNDO:
+        handler = methods->set_handler;
+        if (!handler) {
+            netsnmp_set_all_requests_error(reqinfo, requests,
+                                           SNMP_ERR_NOTWRITABLE);
+            return SNMP_ERR_NOERROR;
+        }
+        break;
+
+        /*
+         * XXX: process SETs specially, and possibly others 
+         */
+    default:
+        snmp_log(LOG_ERR, "unsupported mode for multiplexer: %d\n",
+                 reqinfo->mode);
+        return SNMP_ERR_GENERR;
+    }
+    if (!handler) {
+        snmp_log(LOG_ERR,
+                 "No handler enabled for mode %d in multiplexer\n",
+                 reqinfo->mode);
+        return SNMP_ERR_GENERR;
+    }
+    return netsnmp_call_handler(handler, reginfo, reqinfo, requests);
+}
diff -Naur tomato/release/src/router/snmp/agent/helpers/null.c tomato121/release/src/router/snmp/agent/helpers/null.c
--- tomato/release/src/router/snmp/agent/helpers/null.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/helpers/null.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,59 @@
+#include <net-snmp/net-snmp-config.h>
+
+#if HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+#include <net-snmp/agent/null.h>
+
+#if HAVE_DMALLOC_H
+#include <dmalloc.h>
+#endif
+
+int
+netsnmp_register_null(oid * loc, size_t loc_len)
+{
+    netsnmp_handler_registration *reginfo;
+    reginfo = SNMP_MALLOC_TYPEDEF(netsnmp_handler_registration);
+    reginfo->handlerName = strdup("");
+    reginfo->rootoid = loc;
+    reginfo->rootoid_len = loc_len;
+    reginfo->handler =
+        netsnmp_create_handler("null", netsnmp_null_handler);
+    return netsnmp_register_handler(reginfo);
+}
+
+int
+netsnmp_null_handler(netsnmp_mib_handler *handler,
+                     netsnmp_handler_registration *reginfo,
+                     netsnmp_agent_request_info *reqinfo,
+                     netsnmp_request_info *requests)
+{
+    DEBUGMSGTL(("helper:null", "Got request\n"));
+
+    DEBUGMSGTL(("helper:null", "  oid:"));
+    DEBUGMSGOID(("helper:null", requests->requestvb->name,
+                 requests->requestvb->name_length));
+    DEBUGMSG(("helper:null", "\n"));
+
+    switch (reqinfo->mode) {
+    case MODE_GETNEXT:
+    case MODE_GETBULK:
+        return SNMP_ERR_NOERROR;
+
+    case MODE_GET:
+        netsnmp_set_all_requests_error(reqinfo, requests,
+                                       SNMP_NOSUCHOBJECT);
+        return SNMP_ERR_NOERROR;
+
+    default:
+        netsnmp_set_all_requests_error(reqinfo, requests,
+                                       SNMP_ERR_NOSUCHNAME);
+        return SNMP_ERR_NOERROR;
+    }
+}
diff -Naur tomato/release/src/router/snmp/agent/helpers/old_api.c tomato121/release/src/router/snmp/agent/helpers/old_api.c
--- tomato/release/src/router/snmp/agent/helpers/old_api.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/helpers/old_api.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,410 @@
+#include <net-snmp/net-snmp-config.h>
+
+#if HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+#include <net-snmp/agent/old_api.h>
+#include <net-snmp/agent/agent_callbacks.h>
+
+#if HAVE_DMALLOC_H
+#include <dmalloc.h>
+#endif
+
+#define MIB_CLIENTS_ARE_EVIL 1
+
+/*
+ * don't use these! 
+ */
+void            set_current_agent_session(netsnmp_agent_session *asp);
+netsnmp_agent_session *netsnmp_get_current_agent_session(void);
+
+/** @defgroup old_api old_api: Calls mib module code written in the old style of code.
+ *  @ingroup handler
+ *  This is a backwards compatilibity module that allows code written
+ *  in the old API to be run under the new handler based architecture.
+ *  Use it by calling netsnmp_register_old_api().
+ *  @{
+ */
+
+/** returns a old_api handler that should be the final calling
+ * handler.  Don't use this function.  Use the netsnmp_register_old_api()
+ * function instead.
+ */
+netsnmp_mib_handler *
+get_old_api_handler(void)
+{
+    return netsnmp_create_handler("old_api", netsnmp_old_api_helper);
+}
+
+
+/** Registers an old API set into the mib tree.  Functionally this
+ * mimics the old register_mib_context() function (and in fact the new
+ * register_mib_context() function merely calls this new old_api one).
+ */
+int
+netsnmp_register_old_api(const char *moduleName,
+                         struct variable *var,
+                         size_t varsize,
+                         size_t numvars,
+                         oid * mibloc,
+                         size_t mibloclen,
+                         int priority,
+                         int range_subid,
+                         oid range_ubound,
+                         netsnmp_session * ss,
+                         const char *context, int timeout, int flags)
+{
+
+    unsigned int    i;
+
+    /*
+     * register all subtree nodes 
+     */
+    for (i = 0; i < numvars; i++) {
+        struct variable *vp;
+        netsnmp_handler_registration *reginfo =
+            SNMP_MALLOC_TYPEDEF(netsnmp_handler_registration);
+
+        memdup((void *) &vp,
+               (void *) (struct variable *) ((char *) var + varsize * i),
+               varsize);
+
+        reginfo->handler = get_old_api_handler();
+        reginfo->handlerName = strdup(moduleName);
+        reginfo->rootoid_len = (mibloclen + vp->namelen);
+        reginfo->rootoid =
+            (oid *) malloc(reginfo->rootoid_len * sizeof(oid));
+
+        memcpy(reginfo->rootoid, mibloc, mibloclen * sizeof(oid));
+        memcpy(reginfo->rootoid + mibloclen, vp->name, vp->namelen
+               * sizeof(oid));
+        reginfo->handler->myvoid = (void *) vp;
+
+        reginfo->priority = priority;
+        reginfo->range_subid = range_subid;
+
+        reginfo->range_ubound = range_ubound;
+        reginfo->timeout = timeout;
+        reginfo->contextName = (context) ? strdup(context) : NULL;
+        reginfo->modes = HANDLER_CAN_RWRITE;
+
+        /*
+         * register ourselves in the mib tree 
+         */
+        if (netsnmp_register_handler(reginfo) != MIB_REGISTERED_OK) {
+            netsnmp_handler_registration_free(reginfo);
+            SNMP_FREE(vp);
+        }
+    }
+    return SNMPERR_SUCCESS;
+}
+
+/** registers a row within a mib table */
+int
+netsnmp_register_mib_table_row(const char *moduleName,
+                               struct variable *var,
+                               size_t varsize,
+                               size_t numvars,
+                               oid * mibloc,
+                               size_t mibloclen,
+                               int priority,
+                               int var_subid,
+                               netsnmp_session * ss,
+                               const char *context, int timeout, int flags)
+{
+    unsigned int    i = 0, rc = 0;
+    oid             ubound = 0;
+
+    for (i = 0; i < numvars; i++) {
+        struct variable *vr =
+            (struct variable *) ((char *) var + (i * varsize));
+        netsnmp_handler_registration *r =
+            SNMP_MALLOC_TYPEDEF(netsnmp_handler_registration);
+
+        if (r == NULL) {
+            /*
+             * Unregister whatever we have registered so far, and
+             * return an error.  
+             */
+            rc = MIB_REGISTRATION_FAILED;
+            break;
+        }
+        memset(r, 0, sizeof(netsnmp_handler_registration));
+
+        r->handler = get_old_api_handler();
+        r->handlerName = strdup(moduleName);
+
+        if (r->handlerName == NULL) {
+            netsnmp_handler_registration_free(r);
+            break;
+        }
+
+        r->rootoid_len = mibloclen;
+        r->rootoid = (oid *) malloc(r->rootoid_len * sizeof(oid));
+
+        if (r->rootoid == NULL) {
+            netsnmp_handler_registration_free(r);
+            rc = MIB_REGISTRATION_FAILED;
+            break;
+        }
+        memcpy(r->rootoid, mibloc, mibloclen * sizeof(oid));
+        memcpy((u_char *) (r->rootoid + (var_subid - 1)), vr->name,
+               vr->namelen * sizeof(oid));
+        DEBUGMSGTL(("netsnmp_register_mib_table_row", "rootoid "));
+        DEBUGMSGOID(("netsnmp_register_mib_table_row", r->rootoid,
+                     r->rootoid_len));
+        DEBUGMSG(("netsnmp_register_mib_table_row", "\n"));
+        r->handler->myvoid = (void *) malloc(varsize);
+
+        if (r->handler->myvoid == NULL) {
+            netsnmp_handler_registration_free(r);
+            rc = MIB_REGISTRATION_FAILED;
+            break;
+        }
+        memcpy((char *) r->handler->myvoid, vr, varsize);
+
+        r->contextName = (context) ? strdup(context) : NULL;
+
+        if (context != NULL && r->contextName == NULL) {
+            netsnmp_handler_registration_free(r);
+            rc = MIB_REGISTRATION_FAILED;
+            break;
+        }
+
+        r->priority = priority;
+        r->range_subid = 0;     /* var_subid; */
+        r->range_ubound = 0;    /* range_ubound; */
+        r->timeout = timeout;
+        r->modes = HANDLER_CAN_RWRITE;
+
+        /*
+         * Register this column and row  
+         */
+        if ((rc =
+             netsnmp_register_handler_nocallback(r)) !=
+            MIB_REGISTERED_OK) {
+            DEBUGMSGTL(("netsnmp_register_mib_table_row",
+                        "register failed %d\n", rc));
+            netsnmp_handler_registration_free(r);
+            break;
+        }
+
+        if (vr->namelen > 0) {
+            if (vr->name[vr->namelen - 1] > ubound) {
+                ubound = vr->name[vr->namelen - 1];
+            }
+        }
+    }
+
+    if (rc == MIB_REGISTERED_OK) {
+        struct register_parameters reg_parms;
+
+        reg_parms.name = mibloc;
+        reg_parms.namelen = mibloclen;
+        reg_parms.priority = priority;
+        reg_parms.flags = (u_char) flags;
+        reg_parms.range_subid = var_subid;
+        reg_parms.range_ubound = ubound;
+        reg_parms.timeout = timeout;
+        rc = snmp_call_callbacks(SNMP_CALLBACK_APPLICATION,
+                                 SNMPD_CALLBACK_REGISTER_OID, &reg_parms);
+    }
+
+    return rc;
+}
+
+/** implements the old_api handler */
+int
+netsnmp_old_api_helper(netsnmp_mib_handler *handler,
+                       netsnmp_handler_registration *reginfo,
+                       netsnmp_agent_request_info *reqinfo,
+                       netsnmp_request_info *requests)
+{
+
+#if MIB_CLIENTS_ARE_EVIL
+    oid             save[MAX_OID_LEN];
+    size_t          savelen = 0;
+#endif
+    struct variable compat_var, *cvp = &compat_var;
+    int             exact = 1;
+    int             status;
+
+    struct variable *vp;
+    WriteMethod    *write_method = NULL;
+    size_t          len;
+    u_char         *access = NULL;
+    netsnmp_old_api_cache *cacheptr;
+    netsnmp_agent_session *oldasp = NULL;
+
+    vp = (struct variable *) handler->myvoid;
+
+    /*
+     * create old variable structure with right information 
+     */
+    memcpy(cvp->name, reginfo->rootoid,
+           reginfo->rootoid_len * sizeof(oid));
+    cvp->namelen = reginfo->rootoid_len;
+    cvp->type = vp->type;
+    cvp->magic = vp->magic;
+    cvp->acl = vp->acl;
+    cvp->findVar = vp->findVar;
+
+    switch (reqinfo->mode) {
+    case MODE_GETNEXT:
+    case MODE_GETBULK:
+        exact = 0;
+    }
+
+    for (; requests; requests = requests->next) {
+
+#if MIB_CLIENTS_ARE_EVIL
+        savelen = requests->requestvb->name_length;
+        memcpy(save, requests->requestvb->name, savelen * sizeof(oid));
+#endif
+
+        switch (reqinfo->mode) {
+        case MODE_GET:
+        case MODE_GETNEXT:
+        case MODE_SET_RESERVE1:
+            /*
+             * Actually call the old mib-module function 
+             */
+            if (vp && vp->findVar)
+                access = (*(vp->findVar)) (cvp, requests->requestvb->name,
+                                           &(requests->requestvb->
+                                             name_length), exact, &len,
+                                           &write_method);
+            else
+                access = NULL;
+
+#ifdef WWW_FIX
+            if (IS_DELEGATED(cvp->type)) {
+                add_method = (AddVarMethod *) statP;
+                requests->delayed = 1;
+                have_delegated = 1;
+                continue;       /* WWW: This may not get to the right place */
+            }
+#endif
+
+            /*
+             * WWW: end range checking 
+             */
+            if (access) {
+                /*
+                 * result returned 
+                 */
+                if (reqinfo->mode != MODE_SET_RESERVE1)
+                    snmp_set_var_typed_value(requests->requestvb,
+                                             cvp->type, access, len);
+            } else {
+                /*
+                 * no result returned 
+                 */
+#if MIB_CLIENTS_ARE_EVIL
+                if (access == NULL) {
+                    if (netsnmp_oid_equals(requests->requestvb->name,
+                                         requests->requestvb->name_length,
+                                         save, savelen) != 0) {
+                        DEBUGMSGTL(("old_api", "evil_client: %s\n",
+                                    reginfo->handlerName));
+                        memcpy(requests->requestvb->name, save,
+                               savelen * sizeof(oid));
+                        requests->requestvb->name_length = savelen;
+                    }
+                }
+#endif
+            }
+
+            /*
+             * AAA: fall through for everything that is a set (see BBB) 
+             */
+            if (reqinfo->mode != MODE_SET_RESERVE1)
+                break;
+
+            cacheptr = SNMP_MALLOC_TYPEDEF(netsnmp_old_api_cache);
+            if (!cacheptr)
+                return netsnmp_set_request_error(reqinfo, requests,
+                                                 SNMP_ERR_RESOURCEUNAVAILABLE);
+            cacheptr->data = access;
+            cacheptr->write_method = write_method;
+            netsnmp_request_add_list_data(requests,
+                                          netsnmp_create_data_list
+                                          (OLD_API_NAME, cacheptr, free));
+            /*
+             * BBB: fall through for everything that is a set (see AAA) 
+             */
+
+        default:
+            /*
+             * WWW: explicitly list the SET conditions 
+             */
+            /*
+             * (the rest of the) SET contions 
+             */
+            cacheptr =
+                (netsnmp_old_api_cache *)
+                netsnmp_request_get_list_data(requests, OLD_API_NAME);
+
+            if (cacheptr == NULL || cacheptr->write_method == NULL) {
+                /*
+                 * WWW: try to set ourselves if possible? 
+                 */
+                return netsnmp_set_request_error(reqinfo, requests,
+                                                 SNMP_ERR_NOTWRITABLE);
+            }
+
+            oldasp = netsnmp_get_current_agent_session();
+            set_current_agent_session(reqinfo->asp);
+            status =
+                (*(cacheptr->write_method)) (reqinfo->mode,
+                                             requests->requestvb->val.
+                                             string,
+                                             requests->requestvb->type,
+                                             requests->requestvb->val_len,
+                                             cacheptr->data,
+                                             requests->requestvb->name,
+                                             requests->requestvb->
+                                             name_length);
+            set_current_agent_session(oldasp);
+
+            if (status != SNMP_ERR_NOERROR) {
+                netsnmp_set_request_error(reqinfo, requests, status);
+            }
+
+            /*
+             * clean up is done by the automatic freeing of the
+             * cache stored in the request. 
+             */
+
+            break;
+        }
+    }
+    return SNMP_ERR_NOERROR;
+}
+
+/** @} */
+
+/*
+ * don't use this! 
+ */
+static netsnmp_agent_session *current_agent_session = NULL;
+netsnmp_agent_session *
+netsnmp_get_current_agent_session()
+{
+    return current_agent_session;
+}
+
+/*
+ * don't use this! 
+ */
+void
+set_current_agent_session(netsnmp_agent_session *asp)
+{
+    current_agent_session = asp;
+}
diff -Naur tomato/release/src/router/snmp/agent/helpers/read_only.c tomato121/release/src/router/snmp/agent/helpers/read_only.c
--- tomato/release/src/router/snmp/agent/helpers/read_only.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/helpers/read_only.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,75 @@
+#include <net-snmp/net-snmp-config.h>
+
+#if HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+#include <net-snmp/agent/read_only.h>
+
+#if HAVE_DMALLOC_H
+#include <dmalloc.h>
+#endif
+
+/** @defgroup read_only read_only: make your handler read_only automatically 
+ *  The only purpose of this handler is to return an
+ *  appropriate error for any requests passed to it in a SET mode.
+ *  Inserting it into your handler chain will ensure you're never
+ *  asked to perform a SET request so you can ignore those error
+ *  conditions.
+ *  @ingroup handler
+ *  @{
+ */
+
+/** returns a read_only handler that can be injected into a given
+ *  handler chain.
+ */
+netsnmp_mib_handler *
+netsnmp_get_read_only_handler(void)
+{
+    return netsnmp_create_handler("read_only", netsnmp_read_only_helper);
+}
+
+/** @internal Implements the read_only handler */
+int
+netsnmp_read_only_helper(netsnmp_mib_handler *handler,
+                         netsnmp_handler_registration *reginfo,
+                         netsnmp_agent_request_info *reqinfo,
+                         netsnmp_request_info *requests)
+{
+
+    DEBUGMSGTL(("helper:read_only", "Got request\n"));
+
+    switch (reqinfo->mode) {
+
+    case MODE_SET_RESERVE1:
+    case MODE_SET_RESERVE2:
+    case MODE_SET_ACTION:
+    case MODE_SET_COMMIT:
+    case MODE_SET_FREE:
+    case MODE_SET_UNDO:
+        netsnmp_set_all_requests_error(reqinfo, requests,
+                                       SNMP_ERR_NOTWRITABLE);
+        return SNMP_ERR_NOERROR;
+
+    default:
+        return netsnmp_call_next_handler(handler, reginfo, reqinfo,
+                                         requests);
+    }
+    return SNMP_ERR_GENERR;     /* should never get here */
+}
+
+/** initializes the read_only helper which then registers a read_only
+ *  handler as a run-time injectable handler for configuration file
+ *  use.
+ */
+void
+netsnmp_init_read_only_helper(void)
+{
+    netsnmp_register_handler_by_name("read_only",
+                                     netsnmp_get_read_only_handler());
+}
diff -Naur tomato/release/src/router/snmp/agent/helpers/scalar1.c tomato121/release/src/router/snmp/agent/helpers/scalar1.c
--- tomato/release/src/router/snmp/agent/helpers/scalar1.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/helpers/scalar1.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,135 @@
+#include <net-snmp/net-snmp-config.h>
+
+#include <stdlib.h>
+#if HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+#include <net-snmp/agent/scalar.h>
+#include <net-snmp/agent/serialize.h>
+#include <net-snmp/agent/read_only.h>
+
+#if HAVE_DMALLOC_H
+#include <dmalloc.h>
+#endif
+
+/** @defgroup scalar scalar: process scalars easily.
+ *  @ingroup handler
+ *  @{
+ */
+netsnmp_mib_handler *
+netsnmp_get_scalar_handler(void)
+{
+    return netsnmp_create_handler("scalar",
+                                  netsnmp_scalar_helper_handler);
+}
+
+int
+netsnmp_register_scalar(netsnmp_handler_registration *reginfo)
+{
+    netsnmp_inject_handler(reginfo, netsnmp_get_scalar_handler());
+    return netsnmp_register_serialize(reginfo);
+}
+
+int
+netsnmp_register_read_only_scalar(netsnmp_handler_registration *reginfo)
+{
+    netsnmp_inject_handler(reginfo, netsnmp_get_scalar_handler());
+    netsnmp_inject_handler(reginfo, netsnmp_get_read_only_handler());
+    return netsnmp_register_serialize(reginfo);
+}
+
+
+int
+netsnmp_scalar_helper_handler(netsnmp_mib_handler *handler,
+                                netsnmp_handler_registration *reginfo,
+                                netsnmp_agent_request_info *reqinfo,
+                                netsnmp_request_info *requests)
+{
+
+    netsnmp_variable_list *var = requests->requestvb;
+
+    int             ret, cmp;
+    int             namelen;
+    oid             subid;
+    int             nosuch_err;
+
+    oid             build_space[MAX_OID_LEN];
+
+    DEBUGMSGTL(("helper:scalar", "Got request:\n"));
+    namelen = SNMP_MIN(requests->requestvb->name_length,
+                       reginfo->rootoid_len);
+    cmp = snmp_oid_compare(requests->requestvb->name, namelen,
+                           reginfo->rootoid, reginfo->rootoid_len);
+
+    namelen = requests->requestvb->name_length;
+    subid   = requests->requestvb->name[namelen-1];
+
+    DEBUGMSGTL(("helper:scalar", "  oid:", cmp));
+    DEBUGMSGOID(("helper:scalar", var->name, var->name_length));
+    DEBUGMSG(("helper:scalar", "\n"));
+
+    nosuch_err = SNMP_ERR_NOCREATION;
+    switch (reqinfo->mode) {
+    case MODE_GET:
+        nosuch_err = SNMP_NOSUCHINSTANCE;
+        /* Fall-through */
+
+    case MODE_SET_RESERVE1:
+    case MODE_SET_RESERVE2:
+    case MODE_SET_ACTION:
+    case MODE_SET_COMMIT:
+    case MODE_SET_UNDO:
+    case MODE_SET_FREE:
+        if (cmp != 0) {
+            netsnmp_set_request_error(reqinfo, requests,
+                                      SNMP_NOSUCHOBJECT);
+            return SNMP_ERR_NOERROR;
+        } else {
+            if (( namelen != reginfo->rootoid_len+1) ||
+                ( subid   != 0 )) {
+                netsnmp_set_request_error(reqinfo, requests, nosuch_err);
+                return SNMP_ERR_NOERROR;
+            } else {
+                return netsnmp_call_next_handler(handler, reginfo, reqinfo,
+                                             requests);
+            }
+        }
+        break;
+
+    case MODE_GETNEXT:
+        if (cmp < 0 ||
+           (cmp == 0 && namelen <= reginfo->rootoid_len) ||
+           (cmp == 0 && namelen == reginfo->rootoid_len+1 &&
+            subid == 0 && requests->inclusive)) {
+            reqinfo->mode = MODE_GET;
+            memcpy(build_space, reginfo->rootoid,
+                   reginfo->rootoid_len * sizeof(oid));
+            build_space[reginfo->rootoid_len] = 0;  /* add the instance subid */
+
+            snmp_set_var_objid(requests->requestvb, build_space,
+                               reginfo->rootoid_len+1);
+            ret =
+                netsnmp_call_next_handler(handler, reginfo, reqinfo,
+                                          requests);
+            reqinfo->mode = MODE_GETNEXT;
+            return ret;
+        } else {
+            return SNMP_ERR_NOERROR;
+        }
+        break;
+    }
+    /*
+     * got here only if illegal mode found 
+     */
+    return SNMP_ERR_GENERR;
+}
+
+/*
+ * @} 
+ */
diff -Naur tomato/release/src/router/snmp/agent/helpers/scalar.c tomato121/release/src/router/snmp/agent/helpers/scalar.c
--- tomato/release/src/router/snmp/agent/helpers/scalar.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/helpers/scalar.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,138 @@
+#include <net-snmp/net-snmp-config.h>
+
+#include <stdlib.h>
+#if HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+#include <net-snmp/agent/scalar.h>
+#include <net-snmp/agent/instance.h>
+#include <net-snmp/agent/serialize.h>
+#include <net-snmp/agent/read_only.h>
+
+#if HAVE_DMALLOC_H
+#include <dmalloc.h>
+#endif
+
+/** @defgroup scalar scalar: process scalars easily.
+ *  @ingroup handler
+ *  @{
+ */
+netsnmp_mib_handler *
+netsnmp_get_scalar_handler(void)
+{
+    return netsnmp_create_handler("scalar",
+                                  netsnmp_scalar_helper_handler);
+}
+
+int
+netsnmp_register_scalar(netsnmp_handler_registration *reginfo)
+{
+    /*
+     * Extend the registered OID with space for the instance subid
+     * (but don't extend the length just yet!)
+     */
+    reginfo->rootoid = realloc(reginfo->rootoid,
+                              (reginfo->rootoid_len+1) * sizeof(oid) );
+    reginfo->rootoid[ reginfo->rootoid_len ] = 0;
+
+    netsnmp_inject_handler(reginfo, netsnmp_get_instance_handler());
+    netsnmp_inject_handler(reginfo, netsnmp_get_scalar_handler());
+    return netsnmp_register_serialize(reginfo);
+}
+
+int
+netsnmp_register_read_only_scalar(netsnmp_handler_registration *reginfo)
+{
+    /*
+     * Extend the registered OID with space for the instance subid
+     * (but don't extend the length just yet!)
+     */
+    reginfo->rootoid = realloc(reginfo->rootoid,
+                              (reginfo->rootoid_len+1) * sizeof(oid) );
+    reginfo->rootoid[ reginfo->rootoid_len ] = 0;
+
+    netsnmp_inject_handler(reginfo, netsnmp_get_instance_handler());
+    netsnmp_inject_handler(reginfo, netsnmp_get_scalar_handler());
+    netsnmp_inject_handler(reginfo, netsnmp_get_read_only_handler());
+    return netsnmp_register_serialize(reginfo);
+}
+
+
+
+int
+netsnmp_scalar_helper_handler(netsnmp_mib_handler *handler,
+                                netsnmp_handler_registration *reginfo,
+                                netsnmp_agent_request_info *reqinfo,
+                                netsnmp_request_info *requests)
+{
+
+    netsnmp_variable_list *var = requests->requestvb;
+
+    int             ret, cmp;
+    int             namelen;
+
+    DEBUGMSGTL(("helper:scalar", "Got request:\n"));
+    namelen = SNMP_MIN(requests->requestvb->name_length,
+                       reginfo->rootoid_len);
+    cmp = snmp_oid_compare(requests->requestvb->name, namelen,
+                           reginfo->rootoid, reginfo->rootoid_len);
+
+    DEBUGMSGTL(("helper:scalar", "  oid:", cmp));
+    DEBUGMSGOID(("helper:scalar", var->name, var->name_length));
+    DEBUGMSG(("helper:scalar", "\n"));
+
+    switch (reqinfo->mode) {
+    case MODE_GET:
+        if (cmp != 0) {
+            netsnmp_set_request_error(reqinfo, requests,
+                                      SNMP_NOSUCHOBJECT);
+            return SNMP_ERR_NOERROR;
+        } else {
+            reginfo->rootoid_len++;
+            ret = netsnmp_call_next_handler(handler, reginfo, reqinfo,
+                                             requests);
+            reginfo->rootoid_len--;
+            return ret;
+        }
+        break;
+
+    case MODE_SET_RESERVE1:
+    case MODE_SET_RESERVE2:
+    case MODE_SET_ACTION:
+    case MODE_SET_COMMIT:
+    case MODE_SET_UNDO:
+    case MODE_SET_FREE:
+        if (cmp != 0) {
+            netsnmp_set_request_error(reqinfo, requests,
+                                      SNMP_ERR_NOCREATION);
+            return SNMP_ERR_NOERROR;
+        } else {
+            reginfo->rootoid_len++;
+            ret = netsnmp_call_next_handler(handler, reginfo, reqinfo,
+                                             requests);
+            reginfo->rootoid_len--;
+            return ret;
+        }
+        break;
+
+    case MODE_GETNEXT:
+        reginfo->rootoid_len++;
+        ret = netsnmp_call_next_handler(handler, reginfo, reqinfo, requests);
+        reginfo->rootoid_len--;
+        return ret;
+    }
+    /*
+     * got here only if illegal mode found 
+     */
+    return SNMP_ERR_GENERR;
+}
+
+/*
+ * @} 
+ */
diff -Naur tomato/release/src/router/snmp/agent/helpers/serialize.c tomato121/release/src/router/snmp/agent/helpers/serialize.c
--- tomato/release/src/router/snmp/agent/helpers/serialize.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/helpers/serialize.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,100 @@
+#include <net-snmp/net-snmp-config.h>
+
+#if HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+#include <net-snmp/agent/serialize.h>
+
+#if HAVE_DMALLOC_H
+#include <dmalloc.h>
+#endif
+
+/** @defgroup serialize serialize: Calls sub handlers one request at a time.
+ *  @ingroup handler
+ *  This functionally passes in one request at a time
+ *  into lower handlers rather than a whole bunch of requests at once.
+ *  This is useful for handlers that don't want to iterate through the
+ *  request lists themselves.  Generally, this is probably less
+ *  efficient so use with caution.  The serialize handler might be
+ *  useable to dynamically fix handlers with broken looping code,
+ *  however.
+ *  @{
+ */
+
+/** returns a serialize handler that can be injected into a given
+ *  handler chain.  
+ */
+netsnmp_mib_handler *
+netsnmp_get_serialize_handler(void)
+{
+    return netsnmp_create_handler("serialize",
+                                  netsnmp_serialize_helper_handler);
+}
+
+/** functionally the same as calling netsnmp_register_handler() but also
+ * injects a serialize handler at the same time for you. */
+int
+netsnmp_register_serialize(netsnmp_handler_registration *reginfo)
+{
+    netsnmp_inject_handler(reginfo, netsnmp_get_serialize_handler());
+    return netsnmp_register_handler(reginfo);
+}
+
+/** Implements the serial handler */
+int
+netsnmp_serialize_helper_handler(netsnmp_mib_handler *handler,
+                                 netsnmp_handler_registration *reginfo,
+                                 netsnmp_agent_request_info *reqinfo,
+                                 netsnmp_request_info *requests)
+{
+
+    netsnmp_request_info *request, *requesttmp;
+
+    DEBUGMSGTL(("helper:serialize", "Got request\n"));
+    /*
+     * loop through requests 
+     */
+    for (request = requests; request; request = request->next) {
+        int             ret;
+
+        /*
+         * store next pointer and delete it 
+         */
+        requesttmp = request->next;
+        request->next = NULL;
+
+        /*
+         * call the next handler 
+         */
+        ret =
+            netsnmp_call_next_handler(handler, reginfo, reqinfo, request);
+
+        /*
+         * restore original next pointer 
+         */
+        request->next = requesttmp;
+
+        if (ret != SNMP_ERR_NOERROR)
+            return ret;
+    }
+
+    return SNMP_ERR_NOERROR;
+}
+
+/** 
+ *  initializes the serialize helper which then registers a serialize
+ *  handler as a run-time injectable handler for configuration file
+ *  use.
+ */
+void
+netsnmp_init_serialize(void)
+{
+    netsnmp_register_handler_by_name("serialize",
+                                     netsnmp_get_serialize_handler());
+}
diff -Naur tomato/release/src/router/snmp/agent/helpers/table_array.c tomato121/release/src/router/snmp/agent/helpers/table_array.c
--- tomato/release/src/router/snmp/agent/helpers/table_array.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/helpers/table_array.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,932 @@
+/*
+ * table_array.c
+ * $Id: table_array.c,v 1.1.2.1 2004/06/20 21:54:11 nikki Exp $
+ */
+
+#include <net-snmp/net-snmp-config.h>
+
+#if HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+#include <net-snmp/agent/table.h>
+#include <net-snmp/agent/table_array.h>
+#include <net-snmp/library/container.h>
+#include <net-snmp/library/snmp_assert.h>
+
+#if HAVE_DMALLOC_H
+#include <dmalloc.h>
+#endif
+
+/*
+ * snmp.h:#define SNMP_MSG_INTERNAL_SET_BEGIN        -1 
+ * snmp.h:#define SNMP_MSG_INTERNAL_SET_RESERVE1     0 
+ * snmp.h:#define SNMP_MSG_INTERNAL_SET_RESERVE2     1 
+ * snmp.h:#define SNMP_MSG_INTERNAL_SET_ACTION       2 
+ * snmp.h:#define SNMP_MSG_INTERNAL_SET_COMMIT       3 
+ * snmp.h:#define SNMP_MSG_INTERNAL_SET_FREE         4 
+ * snmp.h:#define SNMP_MSG_INTERNAL_SET_UNDO         5 
+ */
+
+static const char *mode_name[] = {
+    "Reserve 1",
+    "Reserve 2",
+    "Action",
+    "Commit",
+    "Free",
+    "Undo"
+};
+
+/*
+ * PRIVATE structure for holding important info for each table.
+ */
+typedef struct table_container_data_s {
+
+   /** registration info for the table */
+    netsnmp_table_registration_info *tblreg_info;
+
+   /** container for the table rows */
+   netsnmp_container          *table;
+
+    /*
+     * mutex_type                lock;
+     */
+
+   /** do we want to group rows with the same index
+    * together when calling callbacks? */
+    int             group_rows;
+
+   /** callbacks for this table */
+    netsnmp_table_array_callbacks *cb;
+
+} table_container_data;
+
+/** @defgroup table_array table_array: Helps you implement a table when data can be stored locally. The data is stored in a sorted array, using a binary search for lookups.
+ *  @ingroup table
+ *
+ *  The table_array handler is used (automatically) in conjuntion
+ *  with the @link table table@endlink handler. It is primarily
+ *  intended to be used with the mib2c configuration file
+ *  mib2c.array-user.conf.
+ *
+ *  The code generated by mib2c is useful when you have control of
+ *  the data for each row. If you cannot control when rows are added
+ *  and deleted (or at least be notified of changes to row data),
+ *  then this handler is probably not for you.
+ *
+ *  This handler makes use of callbacks (function pointers) to
+ *  handle various tasks. Code is generated for each callback,
+ *  but will need to be reviewed and flushed out by the user.
+ *
+ *  NOTE NOTE NOTE: Once place where mib2c is somewhat lacking
+ *  is with regards to tables with external indices. If your
+ *  table makes use of one or more external indices, please
+ *  review the generated code very carefully for comments
+ *  regarding external indices.
+ *
+ *  NOTE NOTE NOTE: This helper, the API and callbacks are still
+ *  being tested and may change.
+ *
+ *  The generated code will define a structure for storage of table
+ *  related data. This structure must be used, as it contains the index
+ *  OID for the row, which is used for keeping the array sorted. You can
+ *  add addition fields or data to the structure for your own use.
+ *
+ *  The generated code will also have code to handle SNMP-SET processing.
+ *  If your table does not support any SET operations, simply comment
+ *  out the #define <PREFIX>_SET_HANDLING (where <PREFIX> is your
+ *  table name) in the header file.
+ *
+ *  SET processing modifies the row in-place. The duplicate_row
+ *  callback will be called to save a copy of the original row.
+ *  In the event of a failure before the commite phase, the
+ *  row_copy callback will be called to restore the original row
+ *  from the copy.
+ *
+ *  Code will be generated to handle row creation. This code may be
+ *  disabled by commenting out the #define <PREFIX>_ROW_CREATION
+ *  in the header file.
+ *
+ *  If your table contains a RowStatus object, by default the
+ *  code will not allow object in an active row to be modified.
+ *  To allow active rows to be modified, remove the comment block
+ *  around the #define <PREFIX>_CAN_MODIFY_ACTIVE_ROW in the header
+ *  file.
+ *
+ *  Code will be generated to maintain a secondary index for all
+ *  rows, stored in a binary tree. This is very useful for finding
+ *  rows by a key other than the OID index. By default, the functions
+ *  for maintaining this tree will be based on a character string.
+ *  NOTE: this will likely be made into a more generic mechanism,
+ *  using new callback methods, in the near future.
+ *
+ *  The generated code contains many TODO comments. Make sure you
+ *  check each one to see if it applies to your code. Examples include
+ *  checking indices for syntax (ranges, etc), initializing default
+ *  values in newly created rows, checking for row activation and
+ *  deactivation requirements, etc.
+ *
+ * @{
+ */
+
+/**********************************************************************
+ **********************************************************************
+ *                                                                    *
+ *                                                                    *
+ * PUBLIC Registration functions                                      *
+ *                                                                    *
+ *                                                                    *
+ **********************************************************************
+ **********************************************************************/
+/** register specified callbacks for the specified table/oid. If the
+    group_rows parameter is set, the row related callbacks will be
+    called once for each unique row index. Otherwise, each callback
+    will be called only once, for all objects.
+*/
+int
+netsnmp_table_container_register(netsnmp_handler_registration *reginfo,
+                             netsnmp_table_registration_info *tabreg,
+                             netsnmp_table_array_callbacks *cb,
+                             netsnmp_container *container,
+                             int group_rows)
+{
+    table_container_data *tad = SNMP_MALLOC_TYPEDEF(table_container_data);
+    if (!tad)
+        return SNMPERR_GENERR;
+    tad->tblreg_info = tabreg;  /* we need it too, but it really is not ours */
+
+    if (!cb) {
+        snmp_log(LOG_ERR, "table_array registration with no callbacks\n" );
+        return SNMPERR_GENERR;
+    }
+    /*
+     * check for required callbacks
+     */
+    if ((cb->can_set &&
+         ((NULL==cb->duplicate_row) || (NULL==cb->delete_row) ||
+          (NULL==cb->row_copy)) )) {
+        snmp_log(LOG_ERR, "table_array registration with incomplete "
+                 "callback structure.\n");
+        return SNMPERR_GENERR;
+    }
+
+    if (NULL==container) {
+        tad->table = netsnmp_container_find("table_array");
+        if (NULL==container) {
+            snmp_log(LOG_ERR,"netsnmp_table_container_register couldn't find table\n");
+            return SNMPERR_GENERR;
+        }
+    }
+    else
+        tad->table = container;
+    if (NULL==container->compare)
+        container->compare = netsnmp_compare_netsnmp_index;
+    if (NULL==container->ncompare)
+        container->ncompare = netsnmp_ncompare_netsnmp_index;
+    
+    tad->cb = cb;
+
+    reginfo->handler->myvoid = tad;
+
+    return netsnmp_register_table(reginfo, tabreg);
+}
+
+/** find the handler for the table_array helper. */
+netsnmp_mib_handler *
+netsnmp_find_table_array_handler(netsnmp_handler_registration *reginfo)
+{
+    netsnmp_mib_handler *mh;
+    if (!reginfo)
+        return NULL;
+    mh = reginfo->handler;
+    while (mh) {
+        if (mh->access_method == netsnmp_table_array_helper_handler)
+            break;
+        mh = mh->next;
+    }
+
+    return mh;
+}
+
+/** find the context data used by the table_array helper */
+netsnmp_container      *
+netsnmp_extract_array_context(netsnmp_request_info *request)
+{
+    return netsnmp_request_get_list_data(request, TABLE_ARRAY_NAME);
+}
+
+/** this function is called to validate RowStatus transitions. */
+int
+netsnmp_table_array_check_row_status(netsnmp_table_array_callbacks *cb,
+                                     netsnmp_request_group *ag,
+                                     long *rs_new, long *rs_old)
+{
+    netsnmp_index *row_ctx;
+    netsnmp_index *undo_ctx;
+    if (!ag || !cb)
+        return SNMPERR_GENERR;
+    row_ctx  = ag->existing_row;
+    undo_ctx = ag->undo_info;
+
+    /*
+     * xxx-rks: revisit row delete scenario
+     */
+    if (row_ctx) {
+        /*
+         * either a new row, or change to old row.
+         * make sure new row-status is valid
+         */
+        if(!rs_new)
+            return SNMPERR_GENERR;
+
+        /*
+         * new row without row status. shouldn't happen.
+         */
+        if(*rs_new == RS_NONEXISTENT) 
+            return SNMP_ERR_INCONSISTENTVALUE;
+        
+        /*
+         * is it set to active?
+         */
+        if (RS_IS_GOING_ACTIVE(*rs_new)) {
+            /*
+             * is it ready to be active?
+             */
+            if ((NULL==cb->can_activate) ||
+                cb->can_activate(undo_ctx, row_ctx, ag))
+                *rs_new = RS_ACTIVE;
+            else
+                return SNMP_ERR_INCONSISTENTVALUE;
+        } else {
+            /*
+             * not going active
+             */
+            if (undo_ctx) {
+                /*
+                 * change
+                 */
+                if (RS_IS_ACTIVE(*rs_old)) {
+                    /*
+                     * check pre-reqs for deactivation
+                     */
+                    if (cb->can_deactivate &&
+                        !cb->can_deactivate(undo_ctx, row_ctx, ag)) {
+                        return SNMP_ERR_INCONSISTENTVALUE;
+                    }
+                }
+            } else {
+                /*
+                 * new row
+                 */
+            }
+
+            if (*rs_new != RS_DESTROY) {
+                if ((NULL==cb->can_activate) ||
+                    cb->can_activate(undo_ctx, row_ctx, ag))
+                    *rs_new = RS_NOTINSERVICE;
+                else
+                    *rs_new = RS_NOTREADY;
+            } else {
+                if (cb->can_delete && !cb->can_delete(undo_ctx, row_ctx, ag)) {
+                    return SNMP_ERR_INCONSISTENTVALUE;
+                }
+                ag->row_deleted = 1;
+            }
+        }
+    } else {
+        /*
+         * check pre-reqs for delete row
+         */
+        if (cb->can_delete && !cb->can_delete(undo_ctx, row_ctx, ag)) {
+            return SNMP_ERR_INCONSISTENTVALUE;
+        }
+    }
+
+    return SNMP_ERR_NOERROR;
+}
+
+/** @} */
+
+#ifndef DOXYGEN_SHOULD_SKIP_THIS
+/**********************************************************************
+ **********************************************************************
+ **********************************************************************
+ **********************************************************************
+ *                                                                    *
+ *                                                                    *
+ *                                                                    *
+ *                                                                    *
+ * EVERYTHING BELOW THIS IS PRIVATE IMPLEMENTATION DETAILS.           *
+ *                                                                    *
+ *                                                                    *
+ *                                                                    *
+ *                                                                    *
+ **********************************************************************
+ **********************************************************************
+ **********************************************************************
+ **********************************************************************/
+
+/**********************************************************************
+ **********************************************************************
+ *                                                                    *
+ *                                                                    *
+ * Structures, Utility/convenience functions                          *
+ *                                                                    *
+ *                                                                    *
+ **********************************************************************
+ **********************************************************************/
+/*
+ * context info for SET requests
+ */
+typedef struct set_context_s {
+    netsnmp_agent_request_info *agtreq_info;
+    table_container_data *tad;
+    int             status;
+} set_context;
+
+static void
+release_netsnmp_request_group(netsnmp_index *g, void *v)
+{
+    netsnmp_request_group_item *tmp;
+    netsnmp_request_group *group = (netsnmp_request_group *) g;
+
+    if (!g)
+        return;
+    while (group->list) {
+        tmp = group->list;
+        group->list = tmp->next;
+        free(tmp);
+    }
+
+    free(group);
+}
+
+static void
+release_netsnmp_request_groups(void *vp)
+{
+    netsnmp_container *c = (netsnmp_container*)vp;
+    CONTAINER_FOR_EACH(c, (netsnmp_container_obj_func*)
+                       release_netsnmp_request_group, NULL);
+    CONTAINER_FREE(c);
+}
+
+NETSNMP_INLINE netsnmp_index *
+find_next_row(netsnmp_table_request_info *tblreq_info,
+              table_container_data * tad)
+{
+    netsnmp_index *row = NULL;
+    netsnmp_index index;
+
+    if (!tblreq_info || !tad)
+        return NULL;
+
+    netsnmp_assert(NULL != tad->table);
+
+    /*
+     * below our minimum column?
+     */
+    if (tblreq_info->colnum < tad->tblreg_info->min_column) {
+        tblreq_info->colnum = tad->tblreg_info->min_column;
+        row = CONTAINER_FIRST(tad->table);
+    } else {
+        index.oids = tblreq_info->index_oid;
+        index.len = tblreq_info->index_oid_len;
+
+        row = CONTAINER_NEXT(tad->table, &index);
+
+        /*
+         * we don't have a row, but we might be at the end of a
+         * column, so try the next one.
+         */
+        if (!row) {
+            ++tblreq_info->colnum;
+            if (tad->tblreg_info->valid_columns) {
+                tblreq_info->colnum = netsnmp_closest_column
+                    (tblreq_info->colnum, tad->tblreg_info->valid_columns);
+            } else if (tblreq_info->colnum > tad->tblreg_info->max_column)
+                tblreq_info->colnum = 0;
+
+            if (tblreq_info->colnum != 0)
+                row = CONTAINER_FIRST(tad->table);
+        }
+    }
+
+    return row;
+}
+
+NETSNMP_INLINE void
+build_new_oid(netsnmp_handler_registration *reginfo,
+              netsnmp_table_request_info *tblreq_info,
+              netsnmp_index *row, netsnmp_request_info *current)
+{
+    oid             coloid[MAX_OID_LEN];
+    int             coloid_len;
+
+    if (!tblreq_info || !reginfo || !row || !current)
+        return;
+
+    coloid_len = reginfo->rootoid_len + 2;
+    memcpy(coloid, reginfo->rootoid, reginfo->rootoid_len * sizeof(oid));
+
+    /** table.entry */
+    coloid[reginfo->rootoid_len] = 1;
+
+    /** table.entry.column */
+    coloid[reginfo->rootoid_len + 1] = tblreq_info->colnum;
+
+    /** table.entry.column.index */
+    memcpy(&coloid[reginfo->rootoid_len + 2], row->oids,
+           row->len * sizeof(oid));
+
+    snmp_set_var_objid(current->requestvb, coloid,
+                       reginfo->rootoid_len + 2 + row->len);
+}
+
+/**********************************************************************
+ **********************************************************************
+ *                                                                    *
+ *                                                                    *
+ * GET procession functions                                           *
+ *                                                                    *
+ *                                                                    *
+ **********************************************************************
+ **********************************************************************/
+NETSNMP_INLINE int
+process_get_requests(netsnmp_handler_registration *reginfo,
+                     netsnmp_agent_request_info *agtreq_info,
+                     netsnmp_request_info *requests,
+                     table_container_data * tad)
+{
+    int             rc = SNMP_ERR_NOERROR;
+    netsnmp_request_info *current;
+    netsnmp_index *row = NULL;
+    netsnmp_table_request_info *tblreq_info;
+    netsnmp_variable_list *var;
+
+    netsnmp_assert(NULL != tad->table);
+
+    /*
+     * Loop through each of the requests, and
+     * try to find the appropriate row from the container.
+     */
+    for (current = requests; current; current = current->next) {
+
+        var = current->requestvb;
+        DEBUGMSGTL(("table_array:get",
+                    "  process_get_request oid:"));
+        DEBUGMSGOID(("table_array:get", var->name,
+                     var->name_length));
+        DEBUGMSG(("table_array:get", "\n"));
+
+        /*
+         * skip anything that doesn't need processing.
+         */
+        if (current->processed != 0) {
+            DEBUGMSGTL(("table_array:get", "already processed\n"));
+            continue;
+        }
+
+        /*
+         * Get pointer to the table information for this request. This
+         * information was saved by table_helper_handler. When
+         * debugging, we double check a few assumptions. For example,
+         * the table_helper_handler should enforce column boundaries.
+         */
+        tblreq_info = netsnmp_extract_table_info(current);
+        netsnmp_assert(tblreq_info->colnum <= tad->tblreg_info->max_column);
+
+        if ((agtreq_info->mode == MODE_GETNEXT) ||
+            (agtreq_info->mode == MODE_GETBULK)) {
+            /*
+             * find the row
+             */
+            row = find_next_row(tblreq_info, tad);
+            if (!row) {
+                /*
+                 * no results found.
+                 *
+                 * xxx-rks: how do we skip this entry for the next handler,
+                 * but still allow it a chance to hit another handler?
+                 */
+                DEBUGMSGTL(("table_array:get", "no row found\n"));
+                continue;
+            }
+
+            /*
+             * * if data was found, make sure it has the column we want
+             */
+/* xxx-rks: add suport for sparse tables */
+
+            /*
+             * build new oid
+             */
+            build_new_oid(reginfo, tblreq_info, row, current);
+
+        } /** GETNEXT/GETBULK */
+        else {
+            netsnmp_index index;
+            index.oids = tblreq_info->index_oid;
+            index.len = tblreq_info->index_oid_len;
+
+            row = CONTAINER_FIND(tad->table, &index);
+            if (!row) {
+                DEBUGMSGTL(("table_array:get", "no row found\n"));
+                netsnmp_set_request_error(agtreq_info, current,
+                                          SNMP_NOSUCHINSTANCE);
+                continue;
+            }
+        } /** GET */
+
+        /*
+         * get the data
+         */
+        rc = tad->cb->get_value(current, row, tblreq_info);
+
+    } /** for ( ... requests ... ) */
+
+    return rc;
+}
+
+/**********************************************************************
+ **********************************************************************
+ *                                                                    *
+ *                                                                    *
+ * SET procession functions                                           *
+ *                                                                    *
+ *                                                                    *
+ **********************************************************************
+ **********************************************************************/
+
+NETSNMP_INLINE void
+group_requests(netsnmp_agent_request_info *agtreq_info,
+               netsnmp_request_info *requests,
+               netsnmp_container *request_group, table_container_data * tad)
+{
+    netsnmp_table_request_info *tblreq_info;
+    netsnmp_variable_list *var;
+    netsnmp_index *row, *tmp, index;
+    netsnmp_request_info *current;
+    netsnmp_request_group *g;
+    netsnmp_request_group_item *i;
+
+    for (current = requests; current; current = current->next) {
+
+        var = current->requestvb;
+
+        /*
+         * skip anything that doesn't need processing.
+         */
+        if (current->processed != 0) {
+            DEBUGMSGTL(("table_array:group",
+                        "already processed\n"));
+            continue;
+        }
+
+        /*
+         * 3.2.1 Setup and paranoia
+         * *
+         * * Get pointer to the table information for this request. This
+         * * information was saved by table_helper_handler. When
+         * * debugging, we double check a few assumptions. For example,
+         * * the table_helper_handler should enforce column boundaries.
+         */
+        row = NULL;
+        tblreq_info = netsnmp_extract_table_info(current);
+        netsnmp_assert(tblreq_info->colnum <= tad->tblreg_info->max_column);
+
+        /*
+         * search for index
+         */
+        index.oids = tblreq_info->index_oid;
+        index.len = tblreq_info->index_oid_len;
+        tmp = CONTAINER_FIND(request_group, &index);
+        if (tmp) {
+            DEBUGMSGTL(("table_array:group",
+                        "    existing group:"));
+            DEBUGMSGOID(("table_array:group", index.oids,
+                         index.len));
+            DEBUGMSG(("table_array:group", "\n"));
+            g = (netsnmp_request_group *) tmp;
+            i = SNMP_MALLOC_TYPEDEF(netsnmp_request_group_item);
+            i->ri = current;
+            i->tri = tblreq_info;
+            i->next = g->list;
+            g->list = i;
+
+            /** xxx-rks: store map of colnum to request */
+            continue;
+        }
+
+        DEBUGMSGTL(("table_array:group", "    new group"));
+        DEBUGMSGOID(("table_array:group", index.oids,
+                     index.len));
+        DEBUGMSG(("table_array:group", "\n"));
+        g = SNMP_MALLOC_TYPEDEF(netsnmp_request_group);
+        i = SNMP_MALLOC_TYPEDEF(netsnmp_request_group_item);
+        g->list = i;
+        g->table = tad->table;
+        i->ri = current;
+        i->tri = tblreq_info;
+        /** xxx-rks: store map of colnum to request */
+
+        /*
+         * search for row. all changes are made to the original row,
+         * later, we'll make a copy in undo_info before we start processing.
+         */
+        row = g->existing_row = CONTAINER_FIND(tad->table, &index);
+        if (!g->existing_row) {
+            if (!tad->cb->create_row) {
+                if(MODE_IS_SET(agtreq_info->mode))
+                    netsnmp_set_request_error(agtreq_info, current,
+                                              SNMP_ERR_NOTWRITABLE);
+                else
+                    netsnmp_set_request_error(agtreq_info, current,
+                                              SNMP_NOSUCHINSTANCE);
+                free(g);
+                free(i);
+                continue;
+            }
+            /** use undo_info temporarily */
+            row = g->existing_row = tad->cb->create_row(&index);
+            if (!row) {
+                /* xxx-rks : parameter to create_row to allow
+                 * for better error reporting. */
+                netsnmp_set_request_error(agtreq_info, current,
+                                          SNMP_ERR_GENERR);
+                free(g);
+                free(i);
+                continue;
+            }
+            g->row_created = 1;
+        }
+
+        g->index.oids = row->oids;
+        g->index.len = row->len;
+
+        CONTAINER_INSERT(request_group, g);
+
+    } /** for( current ... ) */
+}
+
+static NETSNMP_INLINE void
+process_set_group(netsnmp_index *o, void *c)
+{
+    /* xxx-rks: should we continue processing after an error?? */
+    set_context           *context = (set_context *) c;
+    netsnmp_request_group *ag = (netsnmp_request_group *) o;
+    int                    rc = SNMP_ERR_NOERROR;
+
+    switch (context->agtreq_info->mode) {
+
+    case MODE_SET_RESERVE1:/** -> SET_RESERVE2 || SET_FREE */
+
+        /*
+         * if not a new row, save undo info
+         */
+        if (ag->row_created == 0) {
+            ag->undo_info = context->tad->cb->duplicate_row(ag->existing_row);
+            if (NULL == ag->undo_info) {
+                rc = SNMP_ERR_RESOURCEUNAVAILABLE;
+                break;
+            }
+        }
+        
+        if (context->tad->cb->set_reserve1)
+            context->tad->cb->set_reserve1(ag);
+        break;
+
+    case MODE_SET_RESERVE2:/** -> SET_ACTION || SET_FREE */
+        if (context->tad->cb->set_reserve2)
+            context->tad->cb->set_reserve2(ag);
+        break;
+
+    case MODE_SET_ACTION:/** -> SET_COMMIT || SET_UNDO */
+        if (context->tad->cb->set_action)
+            context->tad->cb->set_action(ag);
+        break;
+
+    case MODE_SET_COMMIT:/** FINAL CHANCE ON SUCCESS */
+        if (ag->row_created == 0) {
+            /*
+             * this is an existing row, has it been deleted?
+             */
+            if (ag->row_deleted == 1) {
+                DEBUGMSGT((TABLE_ARRAY_NAME, "action: deleting row\n"));
+                if (CONTAINER_REMOVE(ag->table, ag->existing_row) != 0) {
+                    rc = SNMP_ERR_COMMITFAILED;
+                    break;
+                }
+            }
+        } else if (ag->row_deleted == 0) {
+            /*
+             * new row (that hasn't been deleted) should be inserted
+             */
+            DEBUGMSGT((TABLE_ARRAY_NAME, "action: inserting row\n"));
+            if (CONTAINER_INSERT(ag->table, ag->existing_row) != 0) {
+                rc = SNMP_ERR_COMMITFAILED;
+                break;
+            }
+        }
+
+        if (context->tad->cb->set_commit)
+            context->tad->cb->set_commit(ag);
+
+        /** no more use for undo_info, so free it */
+        if (ag->undo_info) {
+            context->tad->cb->delete_row(ag->undo_info);
+            ag->undo_info = NULL;
+        }
+        break;
+
+    case MODE_SET_FREE:/** FINAL CHANCE ON FAILURE of RESERVE1 or RESERVE2 */
+        if (context->tad->cb->set_free)
+            context->tad->cb->set_free(ag);
+
+        /** no more use for undo_info, so free it */
+        if (ag->undo_info) {
+            context->tad->cb->delete_row(ag->undo_info);
+            ag->undo_info = NULL;
+        }
+        break;
+
+    case MODE_SET_UNDO:/** FINAL CHANCE ON FAILURE of ACTION */
+        if (ag->row_created == 0) {
+            /*
+             * this row existed before.
+             */
+            if (ag->row_deleted == 1) {
+                /*
+                 * re-insert undo_info
+                 */
+                DEBUGMSGT((TABLE_ARRAY_NAME, "undo: re-inserting row\n"));
+                if (CONTAINER_INSERT(ag->table, ag->existing_row) != 0) {
+                    rc = SNMP_ERR_UNDOFAILED;
+                    break;
+                }
+            }
+        } else if (ag->row_deleted == 0) {
+            /*
+             * new row that wasn't deleted should be removed
+             */
+            DEBUGMSGT((TABLE_ARRAY_NAME, "undo: removing new row\n"));
+            if (CONTAINER_REMOVE(ag->table, ag->existing_row) != 0) {
+                rc = SNMP_ERR_UNDOFAILED;
+                break;
+            }
+        }
+
+        /*
+         * status already set - don't change it now
+         */
+        if (context->tad->cb->set_undo)
+            context->tad->cb->set_undo(ag);
+
+        /*
+         * no more use for undo_info, so free it
+         */
+        if (ag->row_created == 0) {
+            /*
+             * restore old values
+             */
+            context->tad->cb->row_copy(ag->existing_row, ag->undo_info);
+            context->tad->cb->delete_row(ag->undo_info);
+            ag->undo_info = NULL;
+        }
+        else {
+            context->tad->cb->delete_row(ag->existing_row);
+            ag->existing_row = NULL;
+        }
+        break;
+
+    default:
+        snmp_log(LOG_ERR, "unknown mode processing SET for "
+                 "netsnmp_table_array_helper_handler\n");
+        rc = SNMP_ERR_GENERR;
+        break;
+    }
+    
+    if (rc)
+        netsnmp_set_request_error(context->agtreq_info,
+                                  ag->list->ri, rc);
+                                               
+}
+
+int
+process_set_requests(netsnmp_agent_request_info *agtreq_info,
+                     netsnmp_request_info *requests,
+                     table_container_data * tad, char *handler_name)
+{
+    set_context         context;
+    netsnmp_container  *request_group;
+
+    /*
+     * create and save structure for set info
+     */
+    request_group = (netsnmp_container*) netsnmp_agent_get_list_data
+        (agtreq_info, handler_name);
+    if (request_group == NULL) {
+        netsnmp_data_list *tmp;
+        request_group = netsnmp_container_find("request_group:"
+                                               "table_container");
+        request_group->compare = netsnmp_compare_netsnmp_index;
+        request_group->ncompare = netsnmp_ncompare_netsnmp_index;
+
+        DEBUGMSGTL(("table_array", "Grouping requests by oid\n"));
+
+        tmp = netsnmp_create_data_list(handler_name,
+                                       request_group,
+                                       release_netsnmp_request_groups);
+        netsnmp_agent_add_list_data(agtreq_info, tmp);
+        /*
+         * group requests.
+         */
+        group_requests(agtreq_info, requests, request_group, tad);
+    }
+
+    /*
+     * process each group one at a time
+     */
+    context.agtreq_info = agtreq_info;
+    context.tad = tad;
+    context.status = SNMP_ERR_NOERROR;
+    CONTAINER_FOR_EACH(request_group,
+                       (netsnmp_container_obj_func*)process_set_group,
+                       &context);
+
+    return context.status;
+}
+
+
+/**********************************************************************
+ **********************************************************************
+ *                                                                    *
+ *                                                                    *
+ * netsnmp_table_array_helper_handler()                               *
+ *                                                                    *
+ *                                                                    *
+ **********************************************************************
+ **********************************************************************/
+int
+netsnmp_table_array_helper_handler(netsnmp_mib_handler *handler,
+                                   netsnmp_handler_registration *reginfo,
+                                   netsnmp_agent_request_info *agtreq_info,
+                                   netsnmp_request_info *requests)
+{
+
+    /*
+     * First off, get our pointer from the handler. This
+     * lets us get to the table registration information we
+     * saved in get_table_array_handler(), as well as the
+     * container where the actual table data is stored.
+     */
+    int             rc = SNMP_ERR_NOERROR;
+    table_container_data *tad = (table_container_data *)handler->myvoid;
+
+    if((NULL == tad) || (NULL == tad->table)) {
+        snmp_log(LOG_ERR,"process_get_requests called without a table\n");
+        return SNMP_ERR_GENERR;
+    }
+
+    if (agtreq_info->mode < 0 || agtreq_info->mode > 5) {
+        DEBUGMSGTL(("table_array", "Mode %d, Got request:\n",
+                    agtreq_info->mode));
+    } else {
+        DEBUGMSGTL(("table_array", "Mode %s, Got request:\n",
+                    mode_name[agtreq_info->mode]));
+    }
+
+    if (MODE_IS_SET(agtreq_info->mode)) {
+        /*
+         * netsnmp_mutex_lock(&tad->lock);
+         */
+        rc = process_set_requests(agtreq_info, requests,
+                                  tad, handler->handler_name);
+        /*
+         * netsnmp_mutex_unlock(&tad->lock);
+         */
+    } else
+        rc = process_get_requests(reginfo, agtreq_info, requests, tad);
+
+    if (rc != SNMP_ERR_NOERROR) {
+        DEBUGMSGTL(("table_array", "processing returned rc %d\n", rc));
+    }
+    
+    /*
+     * Now we've done out processing. If there is another handler below us,
+     * call them.
+     */
+    if (handler->next) {
+        rc = netsnmp_call_next_handler(handler, reginfo, agtreq_info, requests);
+        if (rc != SNMP_ERR_NOERROR) {
+            DEBUGMSGTL(("table_array", "next handler returned rc %d\n", rc));
+        }
+    }
+    
+    return rc;
+}
+#endif /** DOXYGEN_SHOULD_SKIP_THIS */
diff -Naur tomato/release/src/router/snmp/agent/helpers/table.c tomato121/release/src/router/snmp/agent/helpers/table.c
--- tomato/release/src/router/snmp/agent/helpers/table.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/helpers/table.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,847 @@
+/*
+ * table.c 
+ */
+
+/* Portions of this file are subject to the following copyright(s).  See
+ * the Net-SNMP's COPYING file for more details and other copyrights
+ * that may apply:
+ */
+/*
+ * Portions of this file are copyrighted by:
+ * Copyright © 2003 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms specified in the COPYING file
+ * distributed with the Net-SNMP package.
+ */
+
+#include <net-snmp/net-snmp-config.h>
+
+#if HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+
+
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+#include <net-snmp/agent/table.h>
+#include <net-snmp/library/snmp_assert.h>
+
+#if HAVE_DMALLOC_H
+#include <dmalloc.h>
+#endif
+
+static void     table_helper_cleanup(netsnmp_agent_request_info *reqinfo,
+                                     netsnmp_request_info *request,
+                                     int status);
+static void     table_data_free_func(void *data);
+
+/** @defgroup table table: Helps you implement a table.
+ *  @ingroup handler
+ *
+ *  This handler helps you implement a table by doing some of the
+ *  processing for you.
+ *  
+ *  This handler truly shows the power of the new handler mechanism.
+ *  By creating a table handler and injecting it into your calling
+ *  chain, or by using the netsnmp_register_table() function to register your
+ *  table, you get access to some pre-parsed information.
+ *  Specifically, the table handler pulls out the column number and
+ *  indexes from the request oid so that you don't have to do the
+ *  complex work to do that parsing within your own code.
+ *
+ *  To do this, the table handler needs to know up front how your
+ *  table is structured.  To inform it about this, you fill in a
+ *  table_registeration_info structure that is passed to the table
+ *  handler.  It contains the asn index types for the table as well as
+ *  the minimum and maximum column that should be used.
+ *  
+ *  @{
+ */
+
+/** Given a netsnmp_table_registration_info object, creates a table handler.
+ *  You can use this table handler by injecting it into a calling
+ *  chain.  When the handler gets called, it'll do processing and
+ *  store it's information into the request->parent_data structure.
+ */
+netsnmp_mib_handler *
+netsnmp_get_table_handler(netsnmp_table_registration_info *tabreq)
+{
+    netsnmp_mib_handler *ret = NULL;
+
+    if (!tabreq) {
+        snmp_log(LOG_INFO, "netsnmp_get_table_handler(NULL) called\n");
+        return NULL;
+    }
+
+    ret = netsnmp_create_handler(TABLE_HANDLER_NAME, table_helper_handler);
+    if (ret) {
+        ret->myvoid = (void *) tabreq;
+        tabreq->number_indexes = count_varbinds(tabreq->indexes);
+    }
+    return ret;
+}
+
+
+/** creates a table handler given the netsnmp_table_registration_info object,
+ *  inserts it into the request chain and then calls
+ *  netsnmp_register_handler() to register the table into the agent.
+ */
+int
+netsnmp_register_table(netsnmp_handler_registration *reginfo,
+                       netsnmp_table_registration_info *tabreq)
+{
+    netsnmp_inject_handler(reginfo, netsnmp_get_table_handler(tabreq));
+    return netsnmp_register_handler(reginfo);
+}
+
+/** extracts the processed table information from a given request.
+ *  call this from subhandlers on a request to extract the processed
+ *  netsnmp_request_info information.  The resulting information includes the
+ *  index values and the column number.
+ */
+NETSNMP_INLINE netsnmp_table_request_info *
+netsnmp_extract_table_info(netsnmp_request_info *request)
+{
+    return (netsnmp_table_request_info *)
+        netsnmp_request_get_list_data(request, TABLE_HANDLER_NAME);
+}
+
+/** extracts the registered netsnmp_table_registration_info object from a
+ *  netsnmp_handler_registration object */
+netsnmp_table_registration_info *
+netsnmp_find_table_registration_info(netsnmp_handler_registration *reginfo)
+{
+    return (netsnmp_table_registration_info *)
+        netsnmp_find_handler_data_by_name(reginfo, TABLE_HANDLER_NAME);
+}
+
+/** implements the table helper handler */
+int
+table_helper_handler(netsnmp_mib_handler *handler,
+                     netsnmp_handler_registration *reginfo,
+                     netsnmp_agent_request_info *reqinfo,
+                     netsnmp_request_info *requests)
+{
+
+    netsnmp_request_info *request;
+    netsnmp_table_registration_info *tbl_info;
+    int             oid_index_pos;
+    unsigned int    oid_column_pos;
+    unsigned int    tmp_idx;
+    size_t	    tmp_len;
+    int             incomplete, out_of_range, cleaned_up = 0;
+    int             status = SNMP_ERR_NOERROR, need_processing = 0;
+    oid            *tmp_name;
+    netsnmp_table_request_info *tbl_req_info;
+    netsnmp_variable_list *vb;
+
+    if (!reginfo || !handler)
+        return SNMPERR_GENERR;
+
+    oid_index_pos  = reginfo->rootoid_len + 2;
+    oid_column_pos = reginfo->rootoid_len + 1;
+    tbl_info = (netsnmp_table_registration_info *) handler->myvoid;
+
+    if ((!handler->myvoid) || (!tbl_info->indexes)) {
+        snmp_log(LOG_INFO, "improperly registered table found\n");
+
+        /*
+         * XXX-rks: unregister table? 
+         */
+        return SNMP_ERR_GENERR;
+    }
+
+    DEBUGMSGTL(("helper:table", "Got request for handler %s: base oid:",
+                handler->handler_name));
+    DEBUGMSGOID(("helper:table", reginfo->rootoid, reginfo->rootoid_len));
+    DEBUGMSG(("helper:table", "\n"));
+    
+    /*
+     * if the agent request info has a state reference, then this is a 
+     * later pass of a set request and we can skip all the lookup stuff.
+     *
+     * xxx-rks: this might break for handlers which only handle one varbind
+     * at a time... those handlers should not save data by their handler_name
+     * in the netsnmp_agent_request_info. 
+     */
+    if (netsnmp_agent_get_list_data(reqinfo, handler->next->handler_name)) {
+        if (MODE_IS_SET(reqinfo->mode)) {
+            return netsnmp_call_next_handler(handler, reginfo, reqinfo,
+                                             requests);
+        } else {
+/** XXX-rks: memory leak. add cleanup handler? */
+            netsnmp_free_agent_data_sets(reqinfo);
+        }
+    }
+
+    if ( MODE_IS_SET(reqinfo->mode) &&
+         (reqinfo->mode != MODE_SET_RESERVE1)) {
+        /*
+         * for later set modes, we can skip all the index parsing,
+         * and we always need to let child handlers have a chance
+         * to clean up.
+         */
+        need_processing = 1;
+    }
+    else {
+        /*
+         * for RESERVE1 and GETS, only continue if we have at least
+         * one valid request.
+         */
+           
+    /*
+     * loop through requests
+     */
+
+    for (request = requests; request; request = request->next) {
+        netsnmp_variable_list *var = request->requestvb;
+
+        DEBUGMSGOID(("verbose:table", var->name, var->name_length));
+        DEBUGMSG(("verbose:table", "\n"));
+
+        if (request->processed) {
+            DEBUGMSG(("helper:table", "already processed\n"));
+            continue;
+        }
+        netsnmp_assert(request->status == SNMP_ERR_NOERROR);
+
+        /*
+         * this should probably be handled further up 
+         */
+        if ((reqinfo->mode == MODE_GET) && (var->type != ASN_NULL)) {
+            /*
+             * valid request if ASN_NULL 
+             */
+            DEBUGMSGTL(("helper:table",
+                        "  GET var type is not ASN_NULL\n"));
+            netsnmp_set_request_error(reqinfo, request,
+                                      SNMP_ERR_WRONGTYPE);
+            continue;
+        }
+
+        if (reqinfo->mode == MODE_SET_RESERVE1) {
+            DEBUGIF("helper:table") {
+                u_char         *buf = NULL;
+                size_t          buf_len = 0, out_len = 0;
+                DEBUGMSGTL(("helper:table", " SET_REQUEST for OID: "));
+                DEBUGMSGOID(("helper:table", var->name, var->name_length));
+                out_len = 0;
+                if (sprint_realloc_by_type(&buf, &buf_len, &out_len, 1,
+                                           var, 0, 0, 0)) {
+                    DEBUGMSG(("helper:table"," type=%d(%02x), value=%s\n",
+                              var->type, var->type, buf));
+                } else {
+                    if (buf != NULL) {
+                        DEBUGMSG(("helper:table",
+                                  " type=%d(%02x), value=%s [TRUNCATED]\n",
+                                  var->type, var->type, buf));
+                    } else {
+                        DEBUGMSG(("helper:table",
+                                  " type=%d(%02x), value=[NIL] [TRUNCATED]\n",
+                                  var->type, var->type));
+                    }
+                }
+                if (buf != NULL) {
+                    free(buf);
+                }
+            }
+        }
+
+        /*
+         * check to make sure its in table range 
+         */
+
+        out_of_range = 0;
+        /*
+         * if our root oid is > var->name and this is not a GETNEXT, 
+         * then the oid is out of range. (only compare up to shorter 
+         * length) 
+         */
+        if (reginfo->rootoid_len > var->name_length)
+            tmp_len = var->name_length;
+        else
+            tmp_len = reginfo->rootoid_len;
+        if (snmp_oid_compare(reginfo->rootoid, reginfo->rootoid_len,
+                             var->name, tmp_len) > 0) {
+            if (reqinfo->mode == MODE_GETNEXT) {
+                if (var->name != var->name_loc)
+                    free(var->name);
+                snmp_set_var_objid(var, reginfo->rootoid,
+                                   reginfo->rootoid_len);
+            } else {
+                DEBUGMSGTL(("helper:table", "  oid is out of range.\n"));
+                out_of_range = 1;
+            }
+        }
+        /*
+         * if var->name is longer than the root, make sure it is 
+         * table.1 (table.ENTRY).  
+         */
+        else if ((var->name_length > reginfo->rootoid_len) &&
+                 (var->name[reginfo->rootoid_len] != 1)) {
+            if ((var->name[reginfo->rootoid_len] < 1) &&
+                (reqinfo->mode == MODE_GETNEXT)) {
+                var->name[reginfo->rootoid_len] = 1;
+                var->name_length = reginfo->rootoid_len;
+            } else {
+                out_of_range = 1;
+                DEBUGMSGTL(("helper:table", "  oid is out of range.\n"));
+            }
+        }
+        /*
+         * if it is not in range, then mark it in the request list 
+         * because we can't process it. If the request is not a GETNEXT 
+         * then set the error to NOSUCHOBJECT so nobody else wastes time
+         * trying to process it.  
+         */
+        if (out_of_range) {
+            DEBUGMSGTL(("helper:table", "  Not processed: "));
+            DEBUGMSGOID(("helper:table", var->name, var->name_length));
+            DEBUGMSG(("helper:table", "\n"));
+
+            /*
+             *  Reject requests of the form 'myTable.N'   (N != 1)
+             */
+            if (reqinfo->mode != MODE_GETNEXT) {
+                table_helper_cleanup(reqinfo, request,
+                                     SNMP_NOSUCHOBJECT);
+            }
+            continue;
+        }
+
+
+        /*
+         * Check column ranges; set-up to pull out indexes from OID. 
+         */
+
+        incomplete = 0;
+        tbl_req_info = SNMP_MALLOC_TYPEDEF(netsnmp_table_request_info);
+        tbl_req_info->reg_info = tbl_info;
+        tbl_req_info->indexes = snmp_clone_varbind(tbl_info->indexes);
+        tbl_req_info->number_indexes = 0;       /* none yet */
+        netsnmp_request_add_list_data(request,
+                                      netsnmp_create_data_list
+                                      (TABLE_HANDLER_NAME,
+                                       (void *) tbl_req_info,
+                                       table_data_free_func));
+
+        if (var->name_length > oid_column_pos) {
+            /*
+             * oid is long enough to contain index info
+             */
+            if (var->name[oid_column_pos] < tbl_info->min_column) {
+                if (reqinfo->mode == MODE_GETNEXT) {
+                    /*
+                     * fix column, truncate useless index info 
+                     */
+                    var->name_length = oid_column_pos;
+                    tbl_req_info->colnum = tbl_info->min_column;
+                } else
+                    out_of_range = 1;
+            } else if (var->name[oid_column_pos] > tbl_info->max_column)
+                out_of_range = 1;
+
+            if (out_of_range) {
+                /*
+                 * this is out of range...  remove from requests, free
+                 * memory 
+                 */
+                DEBUGMSGTL(("helper:table",
+                            "  oid is out of range. Not processed: "));
+                DEBUGMSGOID(("helper:table", var->name, var->name_length));
+                DEBUGMSG(("helper:table", "\n"));
+
+                /*
+                 *  Reject requests of the form 'myEntry.N'   (invalid N)
+                 */
+                if (reqinfo->mode != MODE_GETNEXT) {
+                    table_helper_cleanup(reqinfo, request,
+                                         SNMP_NOSUCHOBJECT);
+                }
+                continue;
+            }
+            /*
+             * use column verification 
+             */
+            else if (tbl_info->valid_columns) {
+                tbl_req_info->colnum =
+                    netsnmp_closest_column(var->name[oid_column_pos],
+                                           tbl_info->valid_columns);
+                if (tbl_req_info->colnum == 0)
+                    continue;
+                if (tbl_req_info->colnum != var->name[oid_column_pos]) {
+                    /*
+                     * different column! truncate useless index info 
+                     */
+                    var->name_length = oid_column_pos;
+                }
+            }
+            /*
+             * var->name_length may have changed - check again 
+             */
+            if (var->name_length <= oid_column_pos) { /** none available */
+                tbl_req_info->index_oid_len = 0;
+            } else {
+                tbl_req_info->colnum = var->name[oid_column_pos];
+                tbl_req_info->index_oid_len =
+                    var->name_length - oid_index_pos;
+                netsnmp_assert(tbl_req_info->index_oid_len < MAX_OID_LEN);
+                memcpy(tbl_req_info->index_oid, &var->name[oid_index_pos],
+                       tbl_req_info->index_oid_len * sizeof(oid));
+                tmp_name = tbl_req_info->index_oid;
+            }
+        } else if (reqinfo->mode != MODE_GETNEXT) {
+            /*
+             * oid is NOT long enough to contain index info, and this is
+             * NOT a GETNEXT, so we can't do anything with it.
+             *
+             * Reject requests of the form 'myTable' or 'myEntry'
+             */
+            table_helper_cleanup(reqinfo, request, SNMP_NOSUCHOBJECT);
+            continue;
+        } else {
+            /*
+             * oid is NOT long enough to contain column or index info, so start
+             * at the minimum column. Set index oid len to 0 because we don't
+             * have any index info in the OID.
+             */
+            tbl_req_info->index_oid_len = 0;
+            tbl_req_info->colnum = tbl_info->min_column;
+        }
+
+        /*
+         * set up tmp_len to be the number of OIDs we have beyond the column;
+         * these should be the index(s) for the table. If the index_oid_len
+         * is 0, set tmp_len to -1 so that when we try to parse the index below,
+         * we just zero fill everything.
+         */
+        if (tbl_req_info->index_oid_len == 0) {
+            incomplete = 1;
+            tmp_len = -1;
+        } else
+            tmp_len = tbl_req_info->index_oid_len;
+
+
+        /*
+         * for each index type, try to extract the index from var->name
+         */
+
+        for (tmp_idx = 0, vb = tbl_req_info->indexes;
+             tmp_idx < tbl_info->number_indexes;
+             ++tmp_idx, vb = vb->next_variable) {
+            if (incomplete && tmp_len) {
+                /*
+                 * incomplete/illegal OID, set up dummy 0 to parse 
+                 */
+                DEBUGMSGTL(("helper:table",
+                            "  oid indexes not complete: "));
+                DEBUGMSGOID(("helper:table", var->name, var->name_length));
+                DEBUGMSG(("helper:table", "\n"));
+
+                /*
+                 * no sense in trying anymore if this is a GET/SET. 
+                 *
+                 * Reject requests of the form 'myObject'   (no instance)
+                 */
+                if (reqinfo->mode != MODE_GETNEXT) {
+                    table_helper_cleanup(reqinfo, requests,
+                                         SNMP_NOSUCHINSTANCE);
+                    cleaned_up = 1;
+                }
+                tmp_len = 0;
+                tmp_name = (oid *) & tmp_len;
+                break;
+            }
+            /*
+             * try and parse current index 
+             */
+            if (parse_one_oid_index(&tmp_name, &tmp_len,
+                                    vb, 1) != SNMPERR_SUCCESS) {
+                incomplete = 1;
+                tmp_len = -1;   /* is this necessary? Better safe than
+                                 * sorry */
+            } else {
+                /*
+                 * do not count incomplete indexes 
+                 */
+                if (incomplete)
+                    continue;
+                ++tbl_req_info->number_indexes; /** got one ok */
+                if (tmp_len <= 0) {
+                    incomplete = 1;
+                    tmp_len = -1;       /* is this necessary? Better safe
+                                         * than sorry */
+                }
+            }
+        }                       /** for loop */
+
+        DEBUGIF("helper:table") {
+            if (!cleaned_up) {
+                unsigned int    count;
+                u_char         *buf = NULL;
+                size_t          buf_len = 0, out_len = 0;
+                DEBUGMSGTL(("helper:table", "  column: %d, indexes: %d",
+                            tbl_req_info->colnum,
+                            tbl_req_info->number_indexes));
+                for (vb = tbl_req_info->indexes, count = 0;
+                     vb && count < tbl_info->number_indexes;
+                     count++, vb = vb->next_variable) {
+                    out_len = 0;
+                    if (sprint_realloc_by_type(&buf, &buf_len, &out_len, 1,
+                                               vb, 0, 0, 0)) {
+                        DEBUGMSG(("helper:table",
+                                  "   index: type=%d(%02x), value=%s",
+                                  vb->type, vb->type, buf));
+                    } else {
+                        if (buf != NULL) {
+                            DEBUGMSG(("helper:table",
+                                      "   index: type=%d(%02x), value=%s [TRUNCATED]",
+                                      vb->type, vb->type, buf));
+                        } else {
+                            DEBUGMSG(("helper:table",
+                                      "   index: type=%d(%02x), value=[NIL] [TRUNCATED]",
+                                      vb->type, vb->type));
+                        }
+                    }
+                }
+                if (buf != NULL) {
+                    free(buf);
+                }
+                DEBUGMSG(("helper:table", "\n"));
+            }
+        }
+
+
+        /*
+         * do we have sufficent index info to continue?
+         */
+
+        if ((reqinfo->mode != MODE_GETNEXT) &&
+            ((tbl_req_info->number_indexes != tbl_info->number_indexes) ||
+             (tmp_len != -1))) {
+            table_helper_cleanup(reqinfo, request, SNMP_NOSUCHINSTANCE);
+            continue;
+        }
+        netsnmp_assert(request->status == SNMP_ERR_NOERROR);
+        
+        ++need_processing;
+
+    }                           /* for each request */
+    }
+
+    /*
+     * * call our child access function 
+     */
+    if (need_processing)
+        status =
+            netsnmp_call_next_handler(handler, reginfo, reqinfo, requests);
+
+    return status;
+}
+
+/** Builds the result to be returned to the agent given the table information.
+ *  Use this function to return results from lowel level handlers to
+ *  the agent.  It takes care of building the proper resulting oid
+ *  (containing proper indexing) and inserts the result value into the
+ *  returning varbind.
+ */
+int
+netsnmp_table_build_result(netsnmp_handler_registration *reginfo,
+                           netsnmp_request_info *reqinfo,
+                           netsnmp_table_request_info *table_info,
+                           u_char type, u_char * result, size_t result_len)
+{
+
+    netsnmp_variable_list *var;
+
+    if (!reqinfo || !table_info)
+        return SNMPERR_GENERR;
+
+    var = reqinfo->requestvb;
+
+    if (var->name != var->name_loc)
+        free(var->name);
+    var->name = NULL;
+
+    if (netsnmp_table_build_oid(reginfo, reqinfo, table_info) !=
+        SNMPERR_SUCCESS)
+        return SNMPERR_GENERR;
+
+    snmp_set_var_typed_value(var, type, result, result_len);
+
+    return SNMPERR_SUCCESS;
+}
+
+
+/** given a registration info object, a request object and the table
+ *  info object it builds the request->requestvb->name oid from the
+ *  index values and column information found in the table_info
+ *  object.
+ */
+int
+netsnmp_table_build_oid(netsnmp_handler_registration *reginfo,
+                        netsnmp_request_info *reqinfo,
+                        netsnmp_table_request_info *table_info)
+{
+    oid             tmpoid[MAX_OID_LEN];
+    netsnmp_variable_list *var;
+
+    if (!reginfo || !reqinfo || !table_info)
+        return SNMPERR_GENERR;
+
+    memcpy(tmpoid, reginfo->rootoid, reginfo->rootoid_len * sizeof(oid));
+    tmpoid[reginfo->rootoid_len] = 1;   /** .Entry */
+    tmpoid[reginfo->rootoid_len + 1] = table_info->colnum; /** .column */
+
+    var = reqinfo->requestvb;
+    if (build_oid(&var->name, &var->name_length,
+                  tmpoid, reginfo->rootoid_len + 2, table_info->indexes)
+        != SNMPERR_SUCCESS)
+        return SNMPERR_GENERR;
+
+    return SNMPERR_SUCCESS;
+}
+
+/** Builds an oid from index information.
+ */
+int
+netsnmp_table_build_oid_from_index(netsnmp_handler_registration *reginfo,
+                                   netsnmp_request_info *reqinfo,
+                                   netsnmp_table_request_info *table_info)
+{
+    oid             tmpoid[MAX_OID_LEN];
+    netsnmp_variable_list *var;
+    int             len;
+
+    if (!reginfo || !reqinfo || !table_info)
+        return SNMPERR_GENERR;
+
+    var = reqinfo->requestvb;
+    len = reginfo->rootoid_len;
+    memcpy(tmpoid, reginfo->rootoid, len * sizeof(oid));
+    tmpoid[len++] = 1;          /* .Entry */
+    tmpoid[len++] = table_info->colnum; /* .column */
+    memcpy(&tmpoid[len], table_info->index_oid,
+           table_info->index_oid_len * sizeof(oid));
+    len += table_info->index_oid_len;
+    snmp_clone_mem((void **) &var->name, tmpoid, len * sizeof(oid));
+    var->name_length = len;
+
+    return SNMPERR_SUCCESS;
+}
+
+/** parses an OID into table indexses */
+int
+netsnmp_update_variable_list_from_index(netsnmp_table_request_info *tri)
+{
+    if (!tri)
+        return SNMPERR_GENERR;
+
+    return parse_oid_indexes(tri->index_oid, tri->index_oid_len,
+                             tri->indexes);
+}
+
+/** builds an oid given a set of indexes. */
+int
+netsnmp_update_indexes_from_variable_list(netsnmp_table_request_info *tri)
+{
+    if (!tri)
+        return SNMPERR_GENERR;
+
+    return build_oid_noalloc(tri->index_oid, sizeof(tri->index_oid),
+                             &tri->index_oid_len, NULL, 0, tri->indexes);
+}
+
+/**
+ * checks the original request against the current data being passed in if 
+ * its greater than the request oid but less than the current valid
+ * return, set the current valid return to the new value.
+ * 
+ * returns 1 if outvar was replaced with the oid from newvar (success).
+ * returns 0 if not. 
+ */
+int
+netsnmp_check_getnext_reply(netsnmp_request_info *request,
+                            oid * prefix,
+                            size_t prefix_len,
+                            netsnmp_variable_list * newvar,
+                            netsnmp_variable_list ** outvar)
+{
+    oid      myname[MAX_OID_LEN];
+    size_t   myname_len;
+
+    build_oid_noalloc(myname, MAX_OID_LEN, &myname_len,
+                      prefix, prefix_len, newvar);
+    /*
+     * is the build of the new indexes less than our current result 
+     */
+    if ((!(*outvar) || snmp_oid_compare(myname + prefix_len,
+                                        myname_len - prefix_len,
+                                        (*outvar)->name + prefix_len,
+                                        (*outvar)->name_length -
+                                        prefix_len) < 0)) {
+        /*
+         * and greater than the requested oid 
+         */
+        if (snmp_oid_compare(myname, myname_len,
+                             request->requestvb->name,
+                             request->requestvb->name_length) > 0) {
+            /*
+             * the new result must be better than the old 
+             */
+            if (!*outvar)
+                *outvar = snmp_clone_varbind(newvar);
+            snmp_set_var_objid(*outvar, myname, myname_len);
+
+            return 1;
+        }
+    }
+    return 0;
+}
+
+/** @} */
+
+/*
+ * internal routines 
+ */
+void
+table_data_free_func(void *data)
+{
+    netsnmp_table_request_info *info = (netsnmp_table_request_info *) data;
+    if (!info)
+        return;
+    snmp_free_varbind(info->indexes);
+    free(info);
+}
+
+
+
+static void
+table_helper_cleanup(netsnmp_agent_request_info *reqinfo,
+                     netsnmp_request_info *request, int status)
+{
+    netsnmp_set_request_error(reqinfo, request, status);
+    netsnmp_free_request_data_sets(request);
+    if (!request)
+        return;
+    request->parent_data = NULL;
+}
+
+
+unsigned int
+netsnmp_closest_column(unsigned int current,
+                       netsnmp_column_info *valid_columns)
+{
+    unsigned int    closest = 0;
+    char            done = 0;
+    int             idx;
+
+    if (valid_columns == NULL)
+        return 0;
+
+    do {
+
+        if (valid_columns->isRange) {
+
+            if (current < valid_columns->details.range[0]) {
+                if (valid_columns->details.range[0] < closest) {
+                    closest = valid_columns->details.range[0];
+                }
+            } else if (current <= valid_columns->details.range[1]) {
+                closest = current;
+                done = 1;       /* can not get any closer! */
+            }
+
+        } /* range */
+        else {                  /* list */
+
+            if (current < valid_columns->details.list[0]) {
+                if (valid_columns->details.list[0] < closest)
+                    closest = valid_columns->details.list[0];
+                continue;
+            }
+
+            if (current >
+                valid_columns->details.list[(int)valid_columns->list_count])
+                continue;       /* not in list range. */
+
+            for (idx = 0; idx < (int)valid_columns->list_count; ++idx) {
+                if (current == valid_columns->details.list[idx]) {
+                    closest = current;
+                    done = 1;   /* can not get any closer! */
+                    break;      /* for */
+                } else if (current < valid_columns->details.list[idx]) {
+                    if (valid_columns->details.list[idx] < closest)
+                        closest = valid_columns->details.list[idx];
+                    break;      /* list should be sorted */
+                }
+            }                   /* for */
+
+        }                       /* list */
+
+        valid_columns = valid_columns->next;
+
+    } while (!done && valid_columns);
+
+    return closest;
+}
+
+void
+#if HAVE_STDARG_H
+netsnmp_table_helper_add_indexes(netsnmp_table_registration_info *tinfo,
+                                 ...)
+#else
+netsnmp_table_helper_add_indexes(va_alist)
+     va_dcl
+#endif
+{
+    va_list         debugargs;
+    int             type;
+
+#if HAVE_STDARG_H
+    va_start(debugargs, tinfo);
+#else
+    netsnmp_table_registration_info *tinfo;
+
+    va_start(debugargs);
+    tinfo = va_arg(debugargs, table_info *);
+#endif
+
+    while ((type = va_arg(debugargs, int)) != 0) {
+        netsnmp_table_helper_add_index(tinfo, type);
+    }
+
+    va_end(debugargs);
+}
+
+/** returns a row-wide place to store data in.
+    @todo This function will likely change to add free pointer functions. */
+netsnmp_oid_stash_node **
+netsnmp_table_get_or_create_row_stash(netsnmp_agent_request_info *reqinfo,
+                                      const u_char * storage_name)
+{
+    netsnmp_oid_stash_node **stashp = NULL;
+    stashp = (netsnmp_oid_stash_node **)
+        netsnmp_agent_get_list_data(reqinfo, storage_name);
+
+    if (!stashp) {
+        /*
+         * hasn't be created yet.  we create it here. 
+         */
+        stashp = SNMP_MALLOC_TYPEDEF(netsnmp_oid_stash_node *);
+
+        if (!stashp)
+            return NULL;        /* ack. out of mem */
+
+        netsnmp_agent_add_list_data(reqinfo,
+                                    /*
+                                     * XXX: free: wrong 
+                                     */
+                                    netsnmp_create_data_list(storage_name,
+                                                             stashp,
+                                                             free));
+    }
+    return stashp;
+}
diff -Naur tomato/release/src/router/snmp/agent/helpers/table_data.c tomato121/release/src/router/snmp/agent/helpers/table_data.c
--- tomato/release/src/router/snmp/agent/helpers/table_data.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/helpers/table_data.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,628 @@
+#include <net-snmp/net-snmp-config.h>
+
+#if HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+#include <net-snmp/agent/table.h>
+#include <net-snmp/agent/table_data.h>
+#include <net-snmp/agent/read_only.h>
+
+#if HAVE_DMALLOC_H
+#include <dmalloc.h>
+#endif
+
+/** @defgroup table_data table_data: Helps you implement a table with datamatted storage.
+ *  @ingroup table
+ *
+ *  This helper helps you implement a table where all the indexes are
+ *  expected to be stored within the agent itself and not in some
+ *  external storage location.  It can be used to store a list of
+ *  rows, where a row consists of the indexes to the table and a
+ *  generic data pointer.  You can then implement a subhandler which
+ *  is passed the exact row definition and data it must return data
+ *  for or accept data for.  Complex GETNEXT handling is greatly
+ *  simplified in this case.
+ *
+ *  @{
+ */
+
+/**
+ * generates the index portion of an table oid from a varlist.
+ */
+void
+netsnmp_table_data_generate_index_oid(netsnmp_table_row *row)
+{
+    build_oid(&row->index_oid, &row->index_oid_len, NULL, 0, row->indexes);
+}
+
+/**
+ * Adds a row of data to a given table (stored in proper lexographical order).
+ *
+ * returns SNMPERR_SUCCESS on successful addition.
+ *      or SNMPERR_GENERR  on failure (E.G., indexes already existed)
+ */
+int
+netsnmp_table_data_add_row(netsnmp_table_data *table,
+                           netsnmp_table_row *row)
+{
+    netsnmp_table_row *nextrow, *prevrow;
+
+    if (!row || !table)
+        return SNMPERR_GENERR;
+
+    if (row->indexes)
+        netsnmp_table_data_generate_index_oid(row);
+
+    /*
+     * we don't store the index info as it
+     * takes up memory. 
+     */
+    if (!table->store_indexes) {
+        snmp_free_varbind(row->indexes);
+        row->indexes = NULL;
+    }
+
+    if (!row->index_oid) {
+        snmp_log(LOG_ERR,
+                 "illegal data attempted to be added to table %s\n",
+                 table->name);
+        return SNMPERR_GENERR;
+    }
+
+    /*
+     * insert it into the table in the proper oid-lexographical order 
+     */
+    for (nextrow = table->first_row, prevrow = NULL;
+         nextrow != NULL; prevrow = nextrow, nextrow = nextrow->next) {
+        if (nextrow->index_oid &&
+            snmp_oid_compare(nextrow->index_oid, nextrow->index_oid_len,
+                             row->index_oid, row->index_oid_len) > 0)
+            break;
+        if (nextrow->index_oid &&
+            snmp_oid_compare(nextrow->index_oid, nextrow->index_oid_len,
+                             row->index_oid, row->index_oid_len) == 0) {
+            /*
+             * exact match.  Duplicate entries illegal 
+             */
+            snmp_log(LOG_WARNING,
+                     "duplicate table data attempted to be entered\n");
+            return SNMPERR_GENERR;
+        }
+    }
+
+
+    /*
+     * ok, we have the location of where it should go 
+     */
+    /*
+     * (after prevrow, and before nextrow) 
+     */
+    row->next = nextrow;
+    row->prev = prevrow;
+
+    if (row->next)
+        row->next->prev = row;
+
+    if (row->prev)
+        row->prev->next = row;
+
+    if (NULL == row->prev)      /* it's the (new) first row */
+        table->first_row = row;
+
+    DEBUGMSGTL(("table_data_add_data", "added something...\n"));
+
+    return SNMPERR_SUCCESS;
+}
+
+/**
+ * removes a row of data to a given table and returns it (no free's called)
+ *
+ * returns the row pointer itself on successful removing.
+ *      or NULL on failure (bad arguments)
+ */
+netsnmp_table_row *
+netsnmp_table_data_remove_row(netsnmp_table_data *table,
+                              netsnmp_table_row *row)
+{
+    if (!row || !table)
+        return NULL;
+
+    if (row->prev)
+        row->prev->next = row->next;
+    else
+        table->first_row = row->next;
+
+    if (row->next)
+        row->next->prev = row->prev;
+
+    return row;
+}
+
+/** deletes a row's memory.
+ *  returns the void data that it doesn't know how to delete. */
+void           *
+netsnmp_table_data_delete_row(netsnmp_table_row *row)
+{
+    void           *data;
+
+    if (!row)
+        return NULL;
+
+    /*
+     * free the memory we can 
+     */
+    if (row->indexes)
+        snmp_free_varbind(row->indexes);
+    SNMP_FREE(row->index_oid);
+    data = row->data;
+    free(row);
+
+    /*
+     * return the void * pointer 
+     */
+    return data;
+}
+
+/**
+ * removes and frees a row of data to a given table and returns the void *
+ *
+ * returns the void * data on successful deletion.
+ *      or NULL on failure (bad arguments)
+ */
+void           *
+netsnmp_table_data_remove_and_delete_row(netsnmp_table_data *table,
+                                         netsnmp_table_row *row)
+{
+    if (!row || !table)
+        return NULL;
+
+    /*
+     * remove it from the list 
+     */
+    netsnmp_table_data_remove_row(table, row);
+    return netsnmp_table_data_delete_row(row);
+}
+
+/** swaps out origrow with newrow.  This does *not* delete/free anything! */
+NETSNMP_INLINE void
+netsnmp_table_data_replace_row(netsnmp_table_data *table,
+                               netsnmp_table_row *origrow,
+                               netsnmp_table_row *newrow)
+{
+    netsnmp_table_data_remove_row(table, origrow);
+    netsnmp_table_data_add_row(table, newrow);
+}
+
+/** finds the data in "datalist" stored at "indexes" */
+netsnmp_table_row *
+netsnmp_table_data_get(netsnmp_table_data *table,
+                       netsnmp_variable_list * indexes)
+{
+    oid             searchfor[MAX_OID_LEN];
+    size_t          searchfor_len = MAX_OID_LEN;
+
+    build_oid_noalloc(searchfor, MAX_OID_LEN, &searchfor_len, NULL, 0,
+                      indexes);
+    return netsnmp_table_data_get_from_oid(table, searchfor,
+                                           searchfor_len);
+}
+
+/** finds the data in "datalist" stored at the searchfor oid */
+netsnmp_table_row *
+netsnmp_table_data_get_from_oid(netsnmp_table_data *table,
+                                oid * searchfor, size_t searchfor_len)
+{
+    netsnmp_table_row *row;
+    if (!table)
+        return NULL;
+
+    for (row = table->first_row; row != NULL; row = row->next) {
+        if (row->index_oid &&
+            snmp_oid_compare(searchfor, searchfor_len,
+                             row->index_oid, row->index_oid_len) == 0)
+            return row;
+    }
+    return NULL;
+}
+
+/** Creates a table_data handler and returns it */
+netsnmp_mib_handler *
+netsnmp_get_table_data_handler(netsnmp_table_data *table)
+{
+    netsnmp_mib_handler *ret = NULL;
+
+    if (!table) {
+        snmp_log(LOG_INFO,
+                 "netsnmp_get_table_data_handler(NULL) called\n");
+        return NULL;
+    }
+
+    ret =
+        netsnmp_create_handler(TABLE_DATA_NAME,
+                               netsnmp_table_data_helper_handler);
+    if (ret) {
+        ret->myvoid = (void *) table;
+    }
+    return ret;
+}
+
+/** registers a handler as a data table.
+ *  If table_info != NULL, it registers it as a normal table too. */
+int
+netsnmp_register_table_data(netsnmp_handler_registration *reginfo,
+                            netsnmp_table_data *table,
+                            netsnmp_table_registration_info *table_info)
+{
+    netsnmp_inject_handler(reginfo, netsnmp_get_table_data_handler(table));
+    return netsnmp_register_table(reginfo, table_info);
+}
+
+/** registers a handler as a read-only data table
+ *  If table_info != NULL, it registers it as a normal table too. */
+int
+netsnmp_register_read_only_table_data(netsnmp_handler_registration
+                                      *reginfo, netsnmp_table_data *table,
+                                      netsnmp_table_registration_info
+                                      *table_info)
+{
+    netsnmp_inject_handler(reginfo, netsnmp_get_read_only_handler());
+    return netsnmp_register_table_data(reginfo, table, table_info);
+}
+
+
+/**
+ * The helper handler that takes care of passing a specific row of
+ * data down to the lower handler(s).  It sets request->processed if
+ * the request should not be handled.
+ */
+int
+netsnmp_table_data_helper_handler(netsnmp_mib_handler *handler,
+                                  netsnmp_handler_registration *reginfo,
+                                  netsnmp_agent_request_info *reqinfo,
+                                  netsnmp_request_info *requests)
+{
+
+    netsnmp_table_data *table = (netsnmp_table_data *) handler->myvoid;
+    netsnmp_request_info *request;
+    int             valid_request = 0;
+    netsnmp_table_row *row;
+    netsnmp_table_request_info *table_info;
+    netsnmp_table_registration_info *table_reg_info =
+        netsnmp_find_table_registration_info(reginfo);
+    int             result, regresult;
+    int             oldmode;
+
+    for (request = requests; request; request = request->next) {
+        if (request->processed)
+            continue;
+
+        table_info = netsnmp_extract_table_info(request);
+        if (!table_info)
+            continue;           /* ack */
+
+        /*
+         * find the row in question 
+         */
+        switch (reqinfo->mode) {
+        case MODE_GETNEXT:
+        case MODE_GETBULK:     /* XXXWWW */
+            if (request->requestvb->type != ASN_NULL)
+                continue;
+            /*
+             * loop through data till we find the next row 
+             */
+            result = snmp_oid_compare(request->requestvb->name,
+                                      request->requestvb->name_length,
+                                      reginfo->rootoid,
+                                      reginfo->rootoid_len);
+            regresult = snmp_oid_compare(request->requestvb->name,
+                                         SNMP_MIN(request->requestvb->
+                                                  name_length,
+                                                  reginfo->rootoid_len),
+                                         reginfo->rootoid,
+                                         reginfo->rootoid_len);
+            if (regresult == 0
+                && request->requestvb->name_length < reginfo->rootoid_len)
+                regresult = -1;
+
+            if (result < 0 || 0 == result) {
+                /*
+                 * before us entirely, return the first 
+                 */
+                row = table->first_row;
+                table_info->colnum = table_reg_info->min_column;
+            } else if (regresult == 0 && request->requestvb->name_length ==
+                       reginfo->rootoid_len + 1 &&
+                       /* entry node must be 1, but any column is ok */
+                       request->requestvb->name[reginfo->rootoid_len] == 1) {
+                /*
+                 * exactly to the entry 
+                 */
+                row = table->first_row;
+                table_info->colnum = table_reg_info->min_column;
+            } else if (regresult == 0 && request->requestvb->name_length ==
+                       reginfo->rootoid_len + 2 &&
+                       /* entry node must be 1, but any column is ok */
+                       request->requestvb->name[reginfo->rootoid_len] == 1) {
+                /*
+                 * exactly to the column 
+                 */
+                row = table->first_row;
+            } else {
+                /*
+                 * loop through all rows looking for the first one
+                 * that is equal to the request or greater than it 
+                 */
+                for (row = table->first_row; row; row = row->next) {
+                    /*
+                     * compare the index of the request to the row 
+                     */
+                    result =
+                        snmp_oid_compare(row->index_oid,
+                                         row->index_oid_len,
+                                         request->requestvb->name + 2 +
+                                         reginfo->rootoid_len,
+                                         request->requestvb->name_length -
+                                         2 - reginfo->rootoid_len);
+                    if (result == 0) {
+                        /*
+                         * equal match, return the next row 
+                         */
+                        if (row) {
+                            row = row->next;
+                        }
+                        break;
+                    } else if (result > 0) {
+                        /*
+                         * the current row is greater than the
+                         * request, use it 
+                         */
+                        break;
+                    }
+                }
+            }
+            if (!row) {
+                table_info->colnum++;
+                if (table_info->colnum <= table_reg_info->max_column) {
+                    row = table->first_row;
+                }
+            }
+            if (row) {
+                valid_request = 1;
+                netsnmp_request_add_list_data(request,
+                                              netsnmp_create_data_list
+                                              (TABLE_DATA_NAME, row,
+                                               NULL));
+                /*
+                 * Set the name appropriately, so we can pass this
+                 *  request on as a simple GET request
+                 */
+                netsnmp_table_data_build_result(reginfo, reqinfo, request,
+                                                row,
+                                                table_info->colnum,
+                                                ASN_NULL, NULL, 0);
+            } else {            /* no decent result found.  Give up. It's beyond us. */
+                request->processed = 1;
+            }
+            break;
+
+        case MODE_GET:
+            if (request->requestvb->type != ASN_NULL)
+                continue;
+            /*
+             * find the row in question 
+             */
+            if (request->requestvb->name_length < (reginfo->rootoid_len + 3)) { /* table.entry.column... */
+                /*
+                 * request too short 
+                 */
+                netsnmp_set_request_error(reqinfo, request,
+                                          SNMP_NOSUCHINSTANCE);
+                break;
+            } else if (NULL ==
+                       (row =
+                        netsnmp_table_data_get_from_oid(table,
+                                                        request->
+                                                        requestvb->name +
+                                                        reginfo->
+                                                        rootoid_len + 2,
+                                                        request->
+                                                        requestvb->
+                                                        name_length -
+                                                        reginfo->
+                                                        rootoid_len -
+                                                        2))) {
+                /*
+                 * no such row 
+                 */
+                netsnmp_set_request_error(reqinfo, request,
+                                          SNMP_NOSUCHINSTANCE);
+                break;
+            } else {
+                valid_request = 1;
+                netsnmp_request_add_list_data(request,
+                                              netsnmp_create_data_list
+                                              (TABLE_DATA_NAME, row,
+                                               NULL));
+            }
+            break;
+
+        case MODE_SET_RESERVE1:
+            valid_request = 1;
+            if (NULL !=
+                (row =
+                 netsnmp_table_data_get_from_oid(table,
+                                                 request->requestvb->name +
+                                                 reginfo->rootoid_len + 2,
+                                                 request->requestvb->
+                                                 name_length -
+                                                 reginfo->rootoid_len -
+                                                 2))) {
+                netsnmp_request_add_list_data(request,
+                                              netsnmp_create_data_list
+                                              (TABLE_DATA_NAME, row,
+                                               NULL));
+            }
+            break;
+
+        case MODE_SET_RESERVE2:
+        case MODE_SET_ACTION:
+        case MODE_SET_COMMIT:
+        case MODE_SET_FREE:
+        case MODE_SET_UNDO:
+            valid_request = 1;
+
+        }
+    }
+
+    if (valid_request) {
+        /*
+         * If this is a GetNext or GetBulk request, then we've identified
+         *  the row that ought to include the appropriate next instance.
+         *  Convert the request into a Get request, so that the lower-level
+         *  handlers don't need to worry about skipping on....
+         */
+        oldmode = reqinfo->mode;
+        if (reqinfo->mode == MODE_GETNEXT || reqinfo->mode == MODE_GETBULK) {
+            reqinfo->mode = MODE_GET;
+        }
+        result = netsnmp_call_next_handler(handler, reginfo, reqinfo,
+                                         requests);
+        if (oldmode == MODE_GETNEXT || oldmode == MODE_GETBULK) {       /* XXX */
+            for (request = requests; request; request = request->next) {
+                /*
+                 *  ... but if the lower-level handlers aren't dealing with
+                 *  skipping on to the next instance, then we must handle
+                 *  this situation here.
+                 *    Mark 'holes' in the table as needing to be retried.
+                 *
+                 *    This approach is less efficient than handling such
+                 *  holes directly in the table_dataset handler, but allows
+                 *  user-provided handlers to override the dataset handler
+                 *  if this proves necessary.
+                 */
+                if (requests->requestvb->type == ASN_NULL ||
+                    requests->requestvb->type == SNMP_NOSUCHINSTANCE) {
+                    requests->requestvb->type = ASN_PRIV_RETRY;
+                }
+            }
+            reqinfo->mode = oldmode;
+        }
+        return result;
+    }
+    else
+        return SNMP_ERR_NOERROR;
+}
+
+/** creates and returns a pointer to table data set */
+netsnmp_table_data *
+netsnmp_create_table_data(const char *name)
+{
+    netsnmp_table_data *table = SNMP_MALLOC_TYPEDEF(netsnmp_table_data);
+    if (name && table)
+        table->name = strdup(name);
+    return table;
+}
+
+/** creates and returns a pointer to table data set */
+netsnmp_table_row *
+netsnmp_create_table_data_row(void)
+{
+    netsnmp_table_row *row = SNMP_MALLOC_TYPEDEF(netsnmp_table_row);
+    return row;
+}
+
+/** extracts the row being accessed passed from the table_data helper */
+netsnmp_table_row *
+netsnmp_extract_table_row(netsnmp_request_info *request)
+{
+    return (netsnmp_table_row *) netsnmp_request_get_list_data(request,
+                                                               TABLE_DATA_NAME);
+}
+
+/** extracts the data from the row being accessed passed from the
+ * table_data helper */
+void           *
+netsnmp_extract_table_row_data(netsnmp_request_info *request)
+{
+    netsnmp_table_row *row;
+    row = (netsnmp_table_row *) netsnmp_extract_table_row(request);
+    if (row)
+        return row->data;
+    else
+        return NULL;
+}
+
+/** builds a result given a row, a varbind to set and the data */
+int
+netsnmp_table_data_build_result(netsnmp_handler_registration *reginfo,
+                                netsnmp_agent_request_info *reqinfo,
+                                netsnmp_request_info *request,
+                                netsnmp_table_row *row,
+                                int column,
+                                u_char type,
+                                u_char * result_data,
+                                size_t result_data_len)
+{
+    oid             build_space[MAX_OID_LEN];
+
+    if (!reginfo || !reqinfo || !request)
+        return SNMPERR_GENERR;
+
+    if (reqinfo->mode == MODE_GETNEXT || reqinfo->mode == MODE_GETBULK) {
+        /*
+         * only need to do this for getnext type cases where oid is changing 
+         */
+        memcpy(build_space, reginfo->rootoid,   /* registered oid */
+               reginfo->rootoid_len * sizeof(oid));
+        build_space[reginfo->rootoid_len] = 1;  /* entry */
+        build_space[reginfo->rootoid_len + 1] = column; /* column */
+        memcpy(build_space + reginfo->rootoid_len + 2,  /* index data */
+               row->index_oid, row->index_oid_len * sizeof(oid));
+        snmp_set_var_objid(request->requestvb, build_space,
+                           reginfo->rootoid_len + 2 + row->index_oid_len);
+    }
+    snmp_set_var_typed_value(request->requestvb, type,
+                             result_data, result_data_len);
+    return SNMPERR_SUCCESS;     /* WWWXXX: check for bounds */
+}
+
+/** clones a data row. DOES NOT CLONE THE CONTAINED DATA. */
+netsnmp_table_row *
+netsnmp_table_data_clone_row(netsnmp_table_row *row)
+{
+    netsnmp_table_row *newrow = NULL;
+    if (!row)
+        return NULL;
+
+    memdup((u_char **) & newrow, (u_char *) row,
+           sizeof(netsnmp_table_row));
+    if (!newrow)
+        return NULL;
+
+    if (row->indexes) {
+        newrow->indexes = snmp_clone_varbind(newrow->indexes);
+        if (!newrow->indexes)
+            return NULL;
+    }
+
+    if (row->index_oid) {
+        memdup((u_char **) & newrow->index_oid,
+               (u_char *) row->index_oid,
+               row->index_oid_len * sizeof(oid));
+        if (!newrow->index_oid)
+            return NULL;
+    }
+
+    return newrow;
+}
+
+/*
+ * @} 
+ */
diff -Naur tomato/release/src/router/snmp/agent/helpers/table_dataset.c tomato121/release/src/router/snmp/agent/helpers/table_dataset.c
--- tomato/release/src/router/snmp/agent/helpers/table_dataset.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/helpers/table_dataset.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,1076 @@
+#include <net-snmp/net-snmp-config.h>
+
+#if HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+#if HAVE_DMALLOC_H
+#include <dmalloc.h>
+#endif
+
+static netsnmp_data_list *auto_tables;
+
+typedef struct data_set_tables_s {
+    netsnmp_table_data_set *table_set;
+} data_set_tables;
+
+typedef struct data_set_cache_s {
+    void           *data;
+    size_t          data_len;
+} data_set_cache;
+
+#define STATE_ACTION   1
+#define STATE_COMMIT   2
+#define STATE_UNDO     3
+#define STATE_FREE     4
+
+typedef struct newrow_stash_s {
+    netsnmp_table_row *newrow;
+    int             state;
+    int             created;
+    int             deleted;
+} newrow_stash;
+
+/** @defgroup table_dataset table_dataset: Helps you implement a table with automatted storage.
+ *  @ingroup table_data
+ *
+ *  This handler helps you implement a table where all the data is
+ *  expected to be stored within the agent itself and not in some
+ *  external storage location.  It handles all MIB requests including
+ *  GETs, GETNEXTs and SETs.  It's possible to simply create a table
+ *  without actually ever defining a handler to be called when SNMP
+ *  requests come in.  To use the data, you can either attach a
+ *  sub-handler that merely uses/manipulates the data further when
+ *  requests come in, or you can loop through it externally when it's
+ *  actually needed.  This handler is most useful in cases where a
+ *  table is holding configuration data for something which gets
+ *  triggered via another event.
+ *
+ *  NOTE NOTE NOTE: This helper isn't complete and is likely to change
+ *  somewhat over time.  Specifically, the way it stores data
+ *  internally may change drastically.
+ *  
+ *  @{
+ */
+
+/** Create a netsnmp_table_data_set structure given a table_data definition */
+netsnmp_table_data_set *
+netsnmp_create_table_data_set(const char *table_name)
+{
+    netsnmp_table_data_set *table_set =
+        SNMP_MALLOC_TYPEDEF(netsnmp_table_data_set);
+    if (!table_set)
+        return NULL;
+    table_set->table = netsnmp_create_table_data(table_name);
+    return table_set;
+}
+
+/** Given a netsnmp_table_data_set definition, create a handler for it */
+netsnmp_mib_handler *
+netsnmp_get_table_data_set_handler(netsnmp_table_data_set *data_set)
+{
+    netsnmp_mib_handler *ret = NULL;
+
+    if (!data_set) {
+        snmp_log(LOG_INFO,
+                 "netsnmp_get_table_data_set_handler(NULL) called\n");
+        return NULL;
+    }
+
+    ret =
+        netsnmp_create_handler(TABLE_DATA_SET_NAME,
+                               netsnmp_table_data_set_helper_handler);
+    if (ret) {
+        ret->myvoid = (void *) data_set;
+    }
+    return ret;
+}
+
+
+/** register a given data_set at a given oid (specified in the
+    netsnmp_handler_registration pointer).  The
+    reginfo->handler->access_method *may* be null if the call doesn't
+    ever want to be called for SNMP operations.
+*/
+int
+netsnmp_register_table_data_set(netsnmp_handler_registration *reginfo,
+                                netsnmp_table_data_set *data_set,
+                                netsnmp_table_registration_info
+                                *table_info)
+{
+    if (NULL == table_info) {
+        /*
+         * allocate the table if one wasn't allocated 
+         */
+        table_info = SNMP_MALLOC_TYPEDEF(netsnmp_table_registration_info);
+    }
+
+    if (NULL == table_info->indexes && data_set->table->indexes_template) {
+        /*
+         * copy the indexes in 
+         */
+        table_info->indexes =
+            snmp_clone_varbind(data_set->table->indexes_template);
+    }
+
+    if ((!table_info->min_column || !table_info->max_column) &&
+        (data_set->default_row)) {
+        /*
+         * determine min/max columns 
+         */
+        unsigned int    mincol = 0xffffffff, maxcol = 0;
+        netsnmp_table_data_set_storage *row;
+
+        for (row = data_set->default_row; row; row = row->next) {
+            mincol = SNMP_MIN(mincol, row->column);
+            maxcol = SNMP_MAX(maxcol, row->column);
+        }
+        if (!table_info->min_column)
+            table_info->min_column = mincol;
+        if (!table_info->max_column)
+            table_info->max_column = maxcol;
+    }
+
+    netsnmp_inject_handler(reginfo,
+                           netsnmp_get_table_data_set_handler(data_set));
+    return netsnmp_register_table_data(reginfo, data_set->table,
+                                       table_info);
+}
+
+/** Finds a column within a given storage set, given the pointer to
+   the start of the storage set list.
+*/
+netsnmp_table_data_set_storage *
+netsnmp_table_data_set_find_column(netsnmp_table_data_set_storage *start,
+                                   unsigned int column)
+{
+    while (start && start->column != column)
+        start = start->next;
+    return start;
+}
+
+/**
+ * extracts a netsnmp_table_data_set pointer from a given request
+ */
+netsnmp_table_data_set_storage *
+netsnmp_extract_table_data_set_column(netsnmp_request_info *request,
+                                     unsigned int column)
+{
+    netsnmp_table_data_set_storage *data =
+        netsnmp_extract_table_row_data( request );
+    if (data) {
+        data = netsnmp_table_data_set_find_column(data, column);
+    }
+    return data;
+}
+/**
+ * extracts a netsnmp_table_data_set pointer from a given request
+ */
+NETSNMP_INLINE netsnmp_table_data_set *
+netsnmp_extract_table_data_set(netsnmp_request_info *request)
+{
+    return (netsnmp_table_data_set *)
+        netsnmp_request_get_list_data(request, TABLE_DATA_SET_NAME);
+}
+
+/**
+ * marks a given column in a row as writable or not.
+ */
+int
+netsnmp_mark_row_column_writable(netsnmp_table_row *row, int column,
+                                 int writable)
+{
+    netsnmp_table_data_set_storage *data;
+
+    if (!row)
+        return SNMPERR_GENERR;
+
+    data = (netsnmp_table_data_set_storage *) row->data;
+    data = netsnmp_table_data_set_find_column(data, column);
+
+    if (!data) {
+        /*
+         * create it 
+         */
+        data = SNMP_MALLOC_TYPEDEF(netsnmp_table_data_set_storage);
+        if (!data) {
+            snmp_log(LOG_CRIT, "no memory in netsnmp_set_row_column");
+            return SNMPERR_MALLOC;
+        }
+        data->column = column;
+        data->writable = writable;
+        data->next = row->data;
+        row->data = data;
+    } else {
+        data->writable = writable;
+    }
+    return SNMPERR_SUCCESS;
+}
+
+
+/**
+ * sets a given column in a row with data given a type, value, and
+ * length.  Data is memdup'ed by the function.
+ */
+int
+netsnmp_set_row_column(netsnmp_table_row *row, unsigned int column,
+                       int type, const char *value, size_t value_len)
+{
+    netsnmp_table_data_set_storage *data;
+
+    if (!row)
+        return SNMPERR_GENERR;
+
+    data = (netsnmp_table_data_set_storage *) row->data;
+    data = netsnmp_table_data_set_find_column(data, column);
+
+    if (!data) {
+        /*
+         * create it 
+         */
+        data = SNMP_MALLOC_TYPEDEF(netsnmp_table_data_set_storage);
+        if (!data) {
+            snmp_log(LOG_CRIT, "no memory in netsnmp_set_row_column");
+            return SNMPERR_MALLOC;
+        }
+
+        data->column = column;
+        data->type = type;
+        data->next = row->data;
+        row->data = data;
+    }
+
+    if (value) {
+        if (data->type != type)
+            return SNMPERR_GENERR;
+
+        SNMP_FREE(data->data.voidp);
+        if (value_len) {
+            if (memdup(&data->data.string, value, (value_len)) !=
+                SNMPERR_SUCCESS) {
+                snmp_log(LOG_CRIT, "no memory in netsnmp_set_row_column");
+                return SNMPERR_MALLOC;
+            }
+        } else {
+            data->data.string = malloc(1);
+        }
+        data->data_len = value_len;
+    }
+    return SNMPERR_SUCCESS;
+}
+
+/** adds a new default row to a table_set.
+ * Arguments should be the table_set, column number, variable type and
+ * finally a 1 if it is allowed to be writable, or a 0 if not.  If the
+ * default_value field is not NULL, it will be used to populate new
+ * valuse in that column fro newly created rows. It is copied into the
+ * storage template (free your calling argument).
+ *
+ * returns SNMPERR_SUCCESS or SNMPERR_FAILURE
+ */
+int
+netsnmp_table_set_add_default_row(netsnmp_table_data_set *table_set,
+                                  unsigned int column,
+                                  int type, int writable,
+                                  void *default_value,
+                                  size_t default_value_len)
+{
+
+    netsnmp_table_data_set_storage *new_col, *ptr;
+
+    if (!table_set)
+        return SNMPERR_GENERR;
+
+    /*
+     * double check 
+     */
+    new_col =
+        netsnmp_table_data_set_find_column(table_set->default_row, column);
+    if (new_col != NULL) {
+        if (new_col->type == type && new_col->writable == writable)
+            return SNMPERR_SUCCESS;
+        return SNMPERR_GENERR;
+    }
+
+    new_col = SNMP_MALLOC_TYPEDEF(netsnmp_table_data_set_storage);
+    new_col->type = type;
+    new_col->writable = writable;
+    new_col->column = column;
+    if (default_value) {
+        memdup((u_char **) & (new_col->data.voidp),
+               (u_char *) default_value, default_value_len);
+        new_col->data_len = default_value_len;
+    }
+    if (table_set->default_row == NULL)
+        table_set->default_row = new_col;
+    else {
+        for (ptr = table_set->default_row; ptr->next; ptr = ptr->next) {
+        }
+        ptr->next = new_col;
+    }
+    return SNMPERR_SUCCESS;
+}
+
+/** clones a dataset row, including all data. */
+netsnmp_table_row *
+netsnmp_table_data_set_clone_row(netsnmp_table_row *row)
+{
+    netsnmp_table_data_set_storage *data, **newrowdata;
+    netsnmp_table_row *newrow = netsnmp_table_data_clone_row(row);
+
+    if (!row || !newrow)
+        return NULL;
+
+    data = (netsnmp_table_data_set_storage *) row->data;
+
+    if (data) {
+        for (newrowdata =
+             (netsnmp_table_data_set_storage **) &(newrow->data); data;
+             newrowdata = &((*newrowdata)->next), data = data->next) {
+
+            memdup((u_char **) newrowdata, (u_char *) data,
+                   sizeof(netsnmp_table_data_set_storage));
+            if (!*newrowdata)
+                return NULL;
+
+            if (data->data.voidp) {
+                memdup((u_char **) & ((*newrowdata)->data.voidp),
+                       (u_char *) data->data.voidp, data->data_len);
+                if (!(*newrowdata)->data.voidp)
+                    return NULL;
+            }
+        }
+    }
+    return newrow;
+}
+
+/** creates a new row from an existing defined default set */
+netsnmp_table_row *
+netsnmp_table_data_set_create_row_from_defaults
+    (netsnmp_table_data_set_storage *defrow)
+{
+    netsnmp_table_row *row;
+    row = netsnmp_create_table_data_row();
+    if (!row)
+        return NULL;
+    for (; defrow; defrow = defrow->next) {
+        netsnmp_set_row_column(row, defrow->column, defrow->type,
+                               defrow->data.voidp, defrow->data_len);
+        if (defrow->writable)
+            netsnmp_mark_row_column_writable(row, defrow->column, 1);
+
+    }
+    return row;
+}
+
+
+newrow_stash   *
+netsnmp_table_data_set_create_newrowstash
+    (netsnmp_table_data_set     *datatable,
+     netsnmp_table_request_info *table_info)
+{
+    newrow_stash   *newrowstash = NULL;
+    netsnmp_table_row *newrow   = NULL;
+
+    newrowstash = SNMP_MALLOC_TYPEDEF(newrow_stash);
+    newrowstash->created = 1;
+    newrow = netsnmp_table_data_set_create_row_from_defaults
+                        (datatable->default_row);
+    newrow->indexes = snmp_clone_varbind(table_info->indexes);
+    newrowstash->newrow = newrow;
+
+    return newrowstash;
+}
+
+/** implements the table data helper.  This is the routine that takes
+ *  care of all SNMP requests coming into the table. */
+int
+netsnmp_table_data_set_helper_handler(netsnmp_mib_handler *handler,
+                                      netsnmp_handler_registration
+                                      *reginfo,
+                                      netsnmp_agent_request_info *reqinfo,
+                                      netsnmp_request_info *requests)
+{
+
+    netsnmp_table_data_set_storage *data = NULL;
+    newrow_stash   *newrowstash = NULL;
+    netsnmp_table_row *row, *newrow = NULL;
+    netsnmp_table_request_info *table_info;
+    netsnmp_request_info *request;
+    oid            *suffix;
+    size_t          suffix_len;
+    netsnmp_oid_stash_node **stashp = NULL;
+
+    if (!handler)
+        return SNMPERR_GENERR;
+        
+    DEBUGMSGTL(("netsnmp_table_data_set", "handler starting\n"));
+    for (request = requests; request; request = request->next) {
+        netsnmp_table_data_set *datatable =
+            (netsnmp_table_data_set *) handler->myvoid;
+        if (request->processed)
+            continue;
+
+        /*
+         * extract our stored data and table info 
+         */
+        row = netsnmp_extract_table_row(request);
+        table_info = netsnmp_extract_table_info(request);
+        suffix = requests->requestvb->name + reginfo->rootoid_len + 2;
+        suffix_len = requests->requestvb->name_length -
+            (reginfo->rootoid_len + 2);
+
+        if (MODE_IS_SET(reqinfo->mode)) {
+            /*
+             * use a cached copy of the row for modification 
+             */
+
+            /*
+             * cache location: may have been created already by other
+             * SET requests in the same master request. 
+             */
+            stashp = (netsnmp_oid_stash_node **)
+                netsnmp_table_get_or_create_row_stash(reqinfo,
+                                                      "dataset_row_stash");
+
+            newrowstash
+                = netsnmp_oid_stash_get_data(*stashp, suffix, suffix_len);
+
+            if (!newrowstash) {
+                if (!row) {
+                    if (datatable->allow_creation) {
+                        /*
+                         * entirely new row.  Create the row from the template 
+                         */
+                        newrowstash =
+                             netsnmp_table_data_set_create_newrowstash(
+                                                 datatable, table_info);
+                        newrow = newrowstash->newrow;
+                    } else if (datatable->rowstatus_column == 0) {
+                        /*
+                         * A RowStatus object may be used to control the
+                         *  creation of a new row.  But if this object
+                         *  isn't declared (and the table isn't marked as
+                         *  'auto-create'), then we can't create a new row.
+                         */
+                        netsnmp_set_request_error(reqinfo, request,
+                                                  SNMP_ERR_NOCREATION);
+                        continue;
+                    }
+                } else {
+                    /*
+                     * existing row that needs to be modified 
+                     */
+                    newrowstash = SNMP_MALLOC_TYPEDEF(newrow_stash);
+                    newrow = netsnmp_table_data_set_clone_row(row);
+                    newrowstash->newrow = newrow;
+                }
+                netsnmp_oid_stash_add_data(stashp, suffix, suffix_len,
+                                           newrowstash);
+            } else {
+                newrow = newrowstash->newrow;
+            }
+            /*
+             * all future SET data modification operations use this
+             * temp pointer 
+             */
+            if (reqinfo->mode == MODE_SET_RESERVE1 ||
+                reqinfo->mode == MODE_SET_RESERVE2)
+                row = newrow;
+        }
+
+        if (row)
+            data = (netsnmp_table_data_set_storage *) row->data;
+
+        if (!row || !table_info || !data) {
+            if (!MODE_IS_SET(reqinfo->mode)) {
+                netsnmp_set_request_error(reqinfo, request,
+                                          SNMP_NOSUCHINSTANCE);
+                continue;
+            }
+        }
+
+        data =
+            netsnmp_table_data_set_find_column(data, table_info->colnum);
+
+        switch (reqinfo->mode) {
+        case MODE_GET:
+        case MODE_GETNEXT:
+        case MODE_GETBULK:     /* XXXWWW */
+            if (data && data->data.voidp)
+                netsnmp_table_data_build_result(reginfo, reqinfo, request,
+                                                row,
+                                                table_info->colnum,
+                                                data->type,
+                                                data->data.voidp,
+                                                data->data_len);
+            break;
+
+        case MODE_SET_RESERVE1:
+            if (data) {
+                /*
+                 * Can we modify the existing row?
+                 */
+                if (!data->writable) {
+                    netsnmp_set_request_error(reqinfo, request,
+                                              SNMP_ERR_NOTWRITABLE);
+                } else if (request->requestvb->type != data->type) {
+                    netsnmp_set_request_error(reqinfo, request,
+                                              SNMP_ERR_WRONGTYPE);
+                }
+            } else if (datatable->rowstatus_column == table_info->colnum) {
+                /*
+                 * Otherwise, this is where we create a new row using
+                 * the RowStatus object (essentially duplicating the
+                 * steps followed earlier in the 'allow_creation' case)
+                 */
+                switch (*(request->requestvb->val.integer)) {
+                case RS_CREATEANDGO:
+                case RS_CREATEANDWAIT:
+                    newrowstash =
+                             netsnmp_table_data_set_create_newrowstash(
+                                                 datatable, table_info);
+                    newrow = newrowstash->newrow;
+                    row    = newrow;
+                    netsnmp_oid_stash_add_data(stashp, suffix, suffix_len,
+                                               newrowstash);
+                }
+            }
+            break;
+
+        case MODE_SET_RESERVE2:
+            /*
+             * If the agent receives a SET request for an object in a non-existant
+             *  row, then the RESERVE1 pass will create the row automatically.
+             *
+             * But since the row doesn't exist at that point, the test for whether
+             *  the object is writable or not will be skipped.  So we need to check
+             *  for this possibility again here.
+             *
+             * Similarly, if row creation is under the control of the RowStatus
+             *  object (i.e. allow_creation == 0), but this particular request
+             *  doesn't include such an object, then the row won't have been created,
+             *  and the writable check will also have been skipped.  Again - check here.
+             */
+            if (data && data->writable == 0) {
+                netsnmp_set_request_error(reqinfo, request,
+                                          SNMP_ERR_NOTWRITABLE);
+                continue;
+            }
+            if (datatable->rowstatus_column == table_info->colnum) {
+                switch (*(request->requestvb->val.integer)) {
+                case RS_ACTIVE:
+                case RS_NOTINSERVICE:
+                    /*
+                     * Can only operate on pre-existing rows.
+                     */
+                    if (!newrowstash || newrowstash->created) {
+                        netsnmp_set_request_error(reqinfo, request,
+                                                  SNMP_ERR_INCONSISTENTVALUE);
+                        continue;
+                    }
+                    break;
+
+                case RS_CREATEANDGO:
+                case RS_CREATEANDWAIT:
+                    /*
+                     * Can only operate on newly created rows.
+                     */
+                    if (!(newrowstash && newrowstash->created)) {
+                        netsnmp_set_request_error(reqinfo, request,
+                                                  SNMP_ERR_INCONSISTENTVALUE);
+                        continue;
+                    }
+                    break;
+
+                case RS_DESTROY:
+                    /*
+                     * Can operate on new or pre-existing rows.
+                     */
+                    break;
+
+                case RS_NOTREADY:
+                default:
+                    /*
+                     * Not a valid value to Set 
+                     */
+                    netsnmp_set_request_error(reqinfo, request,
+                                              SNMP_ERR_WRONGVALUE);
+                    continue;
+                }
+            }
+            if (!data ) {
+                netsnmp_set_request_error(reqinfo, request,
+                                          SNMP_ERR_NOCREATION);
+                continue;
+            }
+
+            /*
+             * modify row and set new value 
+             */
+            SNMP_FREE(data->data.string);
+            data->data.string =
+                netsnmp_strdup_and_null(request->requestvb->val.string,
+                                        request->requestvb->val_len);
+            if (!data->data.string) {
+                netsnmp_set_request_error(reqinfo, requests,
+                                          SNMP_ERR_RESOURCEUNAVAILABLE);
+            }
+            data->data_len = request->requestvb->val_len;
+
+            if (datatable->rowstatus_column == table_info->colnum) {
+                switch (*(request->requestvb->val.integer)) {
+                case RS_CREATEANDGO:
+                    /*
+                     * XXX: check legality 
+                     */
+                    *(data->data.integer) = RS_ACTIVE;
+                    break;
+
+                case RS_CREATEANDWAIT:
+                    /*
+                     * XXX: check legality 
+                     */
+                    *(data->data.integer) = RS_NOTINSERVICE;
+                    break;
+
+                case RS_DESTROY:
+                    newrowstash->deleted = 1;
+                    break;
+                }
+            }
+            break;
+
+        case MODE_SET_ACTION:
+
+            /*
+             * Install the new row into the stored table.
+	     * Do this only *once* per row ....
+             */
+            if (newrowstash->state != STATE_ACTION) {
+                newrowstash->state = STATE_ACTION;
+		if (newrowstash->created) {
+                    netsnmp_table_dataset_add_row(datatable, newrow);
+                } else {
+                    netsnmp_table_dataset_replace_row(datatable,
+                                                      row, newrow);
+                }
+            }
+            /*
+             * ... but every (relevant) varbind in the request will
+	     * need to know about this new row, so update the
+	     * per-request row information regardless
+             */
+            if (newrowstash->created) {
+		netsnmp_request_add_list_data(request,
+			netsnmp_create_data_list(TABLE_DATA_NAME,
+						 newrow, NULL));
+            }
+            break;
+
+        case MODE_SET_UNDO:
+            /*
+             * extract the new row, replace with the old or delete 
+             */
+            if (newrowstash->state != STATE_UNDO) {
+                newrowstash->state = STATE_UNDO;
+                if (newrowstash->created) {
+                    netsnmp_table_dataset_remove_and_delete_row(datatable, newrow);
+                } else {
+                    netsnmp_table_dataset_replace_row(datatable,
+                                                      newrow, row);
+                    netsnmp_table_dataset_delete_row(newrow);
+                }
+            }
+            break;
+
+        case MODE_SET_COMMIT:
+            if (newrowstash->state != STATE_COMMIT) {
+                newrowstash->state = STATE_COMMIT;
+                if (!newrowstash->created) {
+                    netsnmp_table_dataset_delete_row(row);
+                }
+                if (newrowstash->deleted) {
+                    netsnmp_table_dataset_remove_and_delete_row(datatable, newrow);
+                }
+            }
+            break;
+
+        case MODE_SET_FREE:
+            if (newrowstash && newrowstash->state != STATE_FREE) {
+                newrowstash->state = STATE_FREE;
+                netsnmp_table_dataset_delete_row(newrow);
+            }
+            break;
+        }
+    }
+
+    if (handler->next && handler->next->access_method)
+        netsnmp_call_next_handler(handler, reginfo, reqinfo, requests);
+    return SNMP_ERR_NOERROR;
+}
+
+/** registers a table_dataset so that the "add_row" snmpd.conf token
+  * can be used to add data to this table.  If registration_name is
+  * NULL then the name used when the table was created will be used
+  * instead.
+  *
+  * @todo create a properly free'ing registeration pointer for the
+  * datalist, and get the datalist freed at shutdown.
+  */
+void
+netsnmp_register_auto_data_table(netsnmp_table_data_set *table_set,
+                                 char *registration_name)
+{
+    data_set_tables *tables;
+    tables = SNMP_MALLOC_TYPEDEF(data_set_tables);
+    if (!tables)
+        return;
+    tables->table_set = table_set;
+    if (!registration_name) {
+        registration_name = table_set->table->name;
+    }
+    netsnmp_add_list_data(&auto_tables, netsnmp_create_data_list(registration_name, tables, NULL));     /* XXX */
+}
+
+/** @internal */
+void
+netsnmp_config_parse_table_set(const char *token, char *line)
+{
+    oid             name[MAX_OID_LEN], table_name[MAX_OID_LEN];
+    size_t          name_length = MAX_OID_LEN, table_name_length =
+        MAX_OID_LEN;
+    struct tree    *tp, *indexnode;
+    netsnmp_table_data_set *table_set;
+    struct index_list *index;
+    unsigned int    mincol = 0xffffff, maxcol = 0;
+    u_char          type;
+
+    /*
+     * instatiate a fake table based on MIB information 
+     */
+    if (!snmp_parse_oid(line, table_name, &table_name_length) ||
+        (NULL == (tp = get_tree(table_name, table_name_length,
+                                get_tree_head())))) {
+        config_pwarn
+            ("can't instatiate table %s since I can't find mib information about it\n");
+        return;
+    }
+
+    if (NULL == (tp = tp->child_list) || NULL == tp->child_list) {
+        config_pwarn
+            ("can't instatiate table since it doesn't appear to be a proper table\n");
+        return;
+    }
+
+    table_set = netsnmp_create_table_data_set(line);
+
+    /*
+     * loop through indexes and add types 
+     */
+    for (index = tp->indexes; index; index = index->next) {
+        if (!snmp_parse_oid(index->ilabel, name, &name_length) ||
+            (NULL ==
+             (indexnode = get_tree(name, name_length, get_tree_head())))) {
+            config_pwarn
+                ("can't instatiate table %s since I don't know anything about one index\n");
+            return;             /* xxx mem leak */
+        }
+
+        type = mib_to_asn_type(indexnode->type);
+        if (type == (u_char) - 1) {
+            config_pwarn("unknown index type");
+            return;             /* xxx mem leak */
+        }
+        if (index->isimplied)   /* if implied, mark it as such */
+            type |= ASN_PRIVATE;
+
+        DEBUGMSGTL(("table_set_add_row",
+                    "adding default index of type %d\n", type));
+        netsnmp_table_dataset_add_index(table_set, type);
+    }
+
+    /*
+     * loop through children and add each column info 
+     */
+    for (tp = tp->child_list; tp; tp = tp->next_peer) {
+        int             canwrite = 0;
+        type = mib_to_asn_type(tp->type);
+        if (type == (u_char) - 1) {
+            config_pwarn("unknown column type");
+            return;             /* xxx mem leak */
+        }
+
+        DEBUGMSGTL(("table_set_add_row", "adding column %d of type %d\n",
+                    tp->subid, type));
+
+        switch (tp->access) {
+        case MIB_ACCESS_CREATE:
+            table_set->allow_creation = 1;
+        case MIB_ACCESS_READWRITE:
+        case MIB_ACCESS_WRITEONLY:
+            canwrite = 1;
+        case MIB_ACCESS_READONLY:
+            DEBUGMSGTL(("table_set_add_row",
+                        "adding column %d of type %d\n", tp->subid, type));
+            netsnmp_table_set_add_default_row(table_set, tp->subid, type,
+                                              canwrite, NULL, 0);
+            mincol = SNMP_MIN(mincol, tp->subid);
+            maxcol = SNMP_MAX(maxcol, tp->subid);
+            break;
+
+        case MIB_ACCESS_NOACCESS:
+        case MIB_ACCESS_NOTIFY:
+            break;
+
+        default:
+            config_pwarn("unknown column access type");
+            break;
+        }
+    }
+
+    /*
+     * register the table 
+     */
+    netsnmp_register_table_data_set(netsnmp_create_handler_registration
+                                    (line, NULL, table_name,
+                                     table_name_length,
+                                     HANDLER_CAN_RWRITE), table_set, NULL);
+
+    netsnmp_register_auto_data_table(table_set, NULL);
+}
+
+/** @internal */
+void
+netsnmp_config_parse_add_row(const char *token, char *line)
+{
+    char            buf[SNMP_MAXBUF_MEDIUM];
+    char            tname[SNMP_MAXBUF_MEDIUM];
+    size_t          buf_size;
+
+    data_set_tables *tables;
+    netsnmp_variable_list *vb;  /* containing only types */
+    netsnmp_table_row *row;
+    netsnmp_table_data_set_storage *dr;
+
+    line = copy_nword(line, tname, SNMP_MAXBUF_MEDIUM);
+
+    tables = (data_set_tables *) netsnmp_get_list_data(auto_tables, tname);
+    if (!tables) {
+        config_pwarn("Unknown table trying to add a row");
+        return;
+    }
+
+    /*
+     * do the indexes first 
+     */
+    row = netsnmp_create_table_data_row();
+
+    for (vb = tables->table_set->table->indexes_template; vb;
+         vb = vb->next_variable) {
+        if (!line) {
+            config_pwarn("missing an index value");
+            return;
+        }
+
+        DEBUGMSGTL(("table_set_add_row", "adding index of type %d\n",
+                    vb->type));
+        buf_size = SNMP_MAXBUF_MEDIUM;
+        line = read_config_read_memory(vb->type, line, buf, &buf_size);
+        netsnmp_table_row_add_index(row, vb->type, buf, buf_size);
+    }
+
+    /*
+     * then do the data 
+     */
+    for (dr = tables->table_set->default_row; dr; dr = dr->next) {
+        if (!line) {
+            config_pwarn("missing an data value\n");
+            return;
+        }
+
+        buf_size = SNMP_MAXBUF_MEDIUM;
+        line = read_config_read_memory(dr->type, line, buf, &buf_size);
+        DEBUGMSGTL(("table_set_add_row",
+                    "adding data at column %d of type %d\n", dr->column,
+                    dr->type));
+        netsnmp_set_row_column(row, dr->column, dr->type, buf, buf_size);
+        if (dr->writable)
+            netsnmp_mark_row_column_writable(row, dr->column, 1);       /* make writable */
+    }
+    netsnmp_table_data_add_row(tables->table_set->table, row);
+}
+
+/** adds an index to the table.  Call this repeatly for each index. */
+NETSNMP_INLINE void
+netsnmp_table_dataset_add_index(netsnmp_table_data_set *table, u_char type)
+{
+    if (!table)
+        return;
+    netsnmp_table_data_add_index(table->table, type);
+}
+
+/** adds a new row to a dataset table */
+NETSNMP_INLINE void
+netsnmp_table_dataset_add_row(netsnmp_table_data_set *table,
+                              netsnmp_table_row *row)
+{
+    if (!table)
+        return;
+    netsnmp_table_data_add_row(table->table, row);
+}
+
+/** adds a new row to a dataset table */
+NETSNMP_INLINE void
+netsnmp_table_dataset_replace_row(netsnmp_table_data_set *table,
+                                  netsnmp_table_row *origrow,
+                                  netsnmp_table_row *newrow)
+{
+    if (!table)
+        return;
+    netsnmp_table_data_replace_row(table->table, origrow, newrow);
+}
+
+/** deletes a single dataset table data.
+ *  returns the (possibly still good) next pointer of the deleted data object.
+ */
+NETSNMP_INLINE netsnmp_table_data_set_storage *
+netsnmp_table_dataset_delete_data(netsnmp_table_data_set_storage *data)
+{
+    netsnmp_table_data_set_storage *nextPtr = NULL;
+    if (data) {
+        nextPtr = data->next;
+        SNMP_FREE(data->data.voidp);
+    }
+    SNMP_FREE(data);
+    return nextPtr;
+}
+
+/** deletes all the data from this node and beyond in the linked list */
+NETSNMP_INLINE void
+netsnmp_table_dataset_delete_all_data(netsnmp_table_data_set_storage *data)
+{
+
+    while (data) {
+        data = netsnmp_table_dataset_delete_data(data);
+    }
+}
+
+/** deletes all the data from this node and beyond in the linked list */
+NETSNMP_INLINE void
+netsnmp_table_dataset_delete_row(netsnmp_table_row *row)
+{
+    netsnmp_table_data_set_storage *data;
+
+    if (!row)
+        return;
+
+    data = netsnmp_table_data_delete_row(row);
+    netsnmp_table_dataset_delete_all_data(data);
+}
+
+/** removes a row from the table, but doesn't delete/free anything */
+NETSNMP_INLINE void
+netsnmp_table_dataset_remove_row(netsnmp_table_data_set *table,
+                                 netsnmp_table_row *row)
+{
+    if (!table)
+        return;
+
+    netsnmp_table_data_remove_and_delete_row(table->table, row);
+}
+
+/** removes a row from the table and then deletes it (and all it's data) */
+NETSNMP_INLINE void
+netsnmp_table_dataset_remove_and_delete_row(netsnmp_table_data_set *table,
+                                            netsnmp_table_row *row)
+{
+    netsnmp_table_data_set_storage *data;
+
+    if (!table)
+        return;
+
+    data = (netsnmp_table_data_set_storage *)
+        netsnmp_table_data_remove_and_delete_row(table->table, row);
+
+    netsnmp_table_dataset_delete_all_data(data);
+}
+
+/** adds multiple data column definitions to each row.  Functionally,
+ *  this is a wrapper around calling netsnmp_table_set_add_default_row
+ *  repeatedly for you.
+ */
+void
+#if HAVE_STDARG_H
+netsnmp_table_set_multi_add_default_row(netsnmp_table_data_set *tset, ...)
+#else
+netsnmp_table_set_multi_add_default_row(va_dcl
+    )
+     va_dcl
+#endif
+{
+    va_list         debugargs;
+    unsigned int    column;
+    int             type, writable;
+    void           *data;
+    size_t          data_len;
+
+#if HAVE_STDARG_H
+    va_start(debugargs, tset);
+#else
+    netsnmp_table_data_set *tset;
+
+    va_start(debugargs);
+    tset = va_arg(debugargs, netsnmp_table_data_set *);
+#endif
+
+    while ((column = va_arg(debugargs, unsigned int)) != 0) {
+        type = va_arg(debugargs, int);
+        writable = va_arg(debugargs, int);
+        data = va_arg(debugargs, void *);
+        data_len = va_arg(debugargs, size_t);
+        netsnmp_table_set_add_default_row(tset, column, type, writable,
+                                          data, data_len);
+    }
+
+    va_end(debugargs);
+}
+
+/** adds multiple indexes to a table_dataset helper object.
+ *  To end the list, use a 0 after the list of ASN index types. */
+void
+#if HAVE_STDARG_H
+netsnmp_table_set_add_indexes(netsnmp_table_data_set *tset,
+                              ...)
+#else
+netsnmp_table_set_add_indexes(va_alist)
+     va_dcl
+#endif
+{
+    va_list         debugargs;
+    int             type;
+
+#if HAVE_STDARG_H
+    va_start(debugargs, tset);
+#else
+    netsnmp_table_data_set *tset;
+
+    va_start(debugargs);
+    tset = va_arg(debugargs, netsnmp_table_data_set *);
+#endif
+
+    while ((type = va_arg(debugargs, int)) != 0) {
+        netsnmp_table_dataset_add_index(tset, type);
+    }
+
+    va_end(debugargs);
+}
+
+/*
+ * @} 
+ */
diff -Naur tomato/release/src/router/snmp/agent/helpers/table_iterator.c tomato121/release/src/router/snmp/agent/helpers/table_iterator.c
--- tomato/release/src/router/snmp/agent/helpers/table_iterator.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/helpers/table_iterator.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,523 @@
+/*
+ * table_iterator.c 
+ */
+/** @defgroup table_iterator table_iterator: The table iterator helper is designed to simplify the task of writing a table handler for the net-snmp agent when the data being accessed is not in an oid sorted form and must be accessed externally.
+ *  @ingroup table
+ *  Functionally, it is a specialized version of the more
+ *  generic table helper but easies the burden of GETNEXT processing by
+ *  manually looping through all the data indexes retrieved through
+ *  function calls which should be supplied by the module that wishes
+ *  help.  The module the table_iterator helps should, afterwards,
+ *  never be called for the case of "MODE_GETNEXT" and only for the GET
+ *  and SET related modes instead.
+ */
+
+/* Portions of this file are subject to the following copyright(s).  See
+ * the Net-SNMP's COPYING file for more details and other copyrights
+ * that may apply:
+ */
+/*
+ * Portions of this file are copyrighted by:
+ * Copyright © 2003 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms specified in the COPYING file
+ * distributed with the Net-SNMP package.
+ */
+
+#include <net-snmp/net-snmp-config.h>
+
+#if HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+#include <net-snmp/agent/table.h>
+#include <net-snmp/agent/serialize.h>
+#include <net-snmp/agent/table_iterator.h>
+
+#if HAVE_DMALLOC_H
+#include <dmalloc.h>
+#endif
+
+/*
+ * doesn't work yet, but shouldn't be serialized (for efficiency) 
+ */
+#undef NOT_SERIALIZED
+#define TABLE_ITERATOR_LAST_CONTEXT "ti_last_c"
+
+/** returns a netsnmp_mib_handler object for the table_iterator helper */
+netsnmp_mib_handler *
+netsnmp_get_table_iterator_handler(netsnmp_iterator_info *iinfo)
+{
+    netsnmp_mib_handler *me =
+        netsnmp_create_handler(TABLE_ITERATOR_NAME,
+                               netsnmp_table_iterator_helper_handler);
+
+    if (!me || !iinfo)
+        return NULL;
+
+    me->myvoid = iinfo;
+    return me;
+}
+
+
+/** registers a table after attaching it to a table_iterator helper */
+int
+netsnmp_register_table_iterator(netsnmp_handler_registration *reginfo,
+                                netsnmp_iterator_info *iinfo)
+{
+    netsnmp_inject_handler(reginfo,
+                           netsnmp_get_table_iterator_handler(iinfo));
+    if (!iinfo)
+        return SNMPERR_GENERR;
+
+#ifndef NOT_SERIALIZED
+    netsnmp_inject_handler(reginfo, netsnmp_get_serialize_handler());
+#endif
+    return netsnmp_register_table(reginfo, iinfo->table_reginfo);
+}
+
+/** extracts the table_iterator specific data from a request */
+NETSNMP_INLINE void    *
+netsnmp_extract_iterator_context(netsnmp_request_info *request)
+{
+    return netsnmp_request_get_list_data(request, TABLE_ITERATOR_NAME);
+}
+
+/** implements the table_iterator helper */
+int
+netsnmp_table_iterator_helper_handler(netsnmp_mib_handler *handler,
+                                      netsnmp_handler_registration
+                                      *reginfo,
+                                      netsnmp_agent_request_info *reqinfo,
+                                      netsnmp_request_info *requests)
+{
+
+    netsnmp_table_registration_info *tbl_info;
+    oid             coloid[MAX_OID_LEN];
+    size_t          coloid_len;
+    int             ret;
+    static oid      myname[MAX_OID_LEN];
+    size_t	    myname_len;
+    int             oldmode;
+    netsnmp_iterator_info *iinfo;
+
+    iinfo = (netsnmp_iterator_info *) handler->myvoid;
+    if (!iinfo || !reginfo || !reqinfo)
+        return SNMPERR_GENERR;
+
+    tbl_info = iinfo->table_reginfo;
+
+    /*
+     * copy in the table registration oid for later use 
+     */
+    coloid_len = reginfo->rootoid_len + 2;
+    memcpy(coloid, reginfo->rootoid, reginfo->rootoid_len * sizeof(oid));
+    coloid[reginfo->rootoid_len] = 1;   /* table.entry node */
+
+    /*
+     * illegally got here if these functions aren't defined 
+     */
+    if (iinfo->get_first_data_point == NULL ||
+        iinfo->get_next_data_point == NULL) {
+        snmp_log(LOG_ERR,
+                 "table_iterator helper called without data accessor functions\n");
+        return SNMP_ERR_GENERR;
+    }
+
+    /*
+     * XXXWWW: deal with SET caching 
+     */
+
+#ifdef NOT_SERIALIZED
+    while (requests)            /* XXX: currently only serialized */
+#endif
+    {
+        /*
+         * XXXWWW: optimize by reversing loops (look through data only once) 
+         */
+        netsnmp_variable_list *results = NULL;
+        netsnmp_variable_list *index_search = NULL;     /* WWW: move up? */
+        netsnmp_variable_list *free_this_index_search = NULL;
+        netsnmp_table_request_info *table_info =
+            netsnmp_extract_table_info(requests);
+        void           *callback_loop_context = NULL;
+        void           *callback_data_context = NULL;
+        void           *callback_data_keep = NULL;
+
+        if (requests->processed != 0) {
+#ifdef NOT_SERIALIZED
+            continue;
+#else
+            return SNMP_ERR_NOERROR;
+#endif
+        }
+
+        if (reqinfo->mode != MODE_GET && reqinfo->mode != MODE_GETNEXT && reqinfo->mode != MODE_GETBULK &&      /* XXX */
+            reqinfo->mode != MODE_SET_RESERVE1) {
+            goto skip_processing;
+        }
+
+
+        if (table_info->colnum > tbl_info->max_column) {
+            requests->processed = 1;
+#ifdef NOT_SERIALIZED
+            break;
+#else
+            return SNMP_ERR_NOERROR;
+#endif
+        }
+
+        /*
+         * XXX: if loop through everything, these are never free'd
+         * since iterator returns NULL and thus we forget about
+         * these 
+         */
+
+        index_search = snmp_clone_varbind(table_info->indexes);
+        if (!index_search) {
+            /*
+             * hmmm....  invalid table? 
+             */
+            snmp_log(LOG_WARNING,
+                     "invalid index list or failed malloc for table %s\n",
+                     reginfo->handlerName);
+            return SNMP_ERR_NOERROR;
+        }
+
+        free_this_index_search = index_search;
+
+        /*
+         * below our minimum column? 
+         */
+        if (table_info->colnum < tbl_info->min_column) {
+            results =
+                (iinfo->get_first_data_point) (&callback_loop_context,
+                                               &callback_data_context,
+                                               index_search, iinfo);
+            if (iinfo->free_loop_context) {
+                (iinfo->free_loop_context) (callback_loop_context, iinfo);
+		callback_loop_context = NULL;
+	    }
+            goto got_results;
+        }
+
+        /*
+         * XXX: do "only got some indexes" 
+         */
+
+        /*
+         * find the next legal result to return 
+         */
+        /*
+         * find the first node 
+         */
+        index_search =
+            (iinfo->get_first_data_point) (&callback_loop_context,
+                                           &callback_data_context,
+                                           index_search, iinfo);
+        /*
+         * table.entry.column node 
+         */
+        coloid[reginfo->rootoid_len + 1] = table_info->colnum;
+
+        switch (reqinfo->mode) {
+        case MODE_GETNEXT:
+        case MODE_GETBULK:     /* XXXWWW */
+            /*
+             * loop through all data and find next one 
+             */
+            while (index_search) {
+                /*
+                 * compare the node with previous results 
+                 */
+                if (netsnmp_check_getnext_reply
+                    (requests, coloid, coloid_len, index_search,
+                     &results)) {
+
+                    /*
+                     * result is our current choice, so keep a pointer to
+                     * the data that the lower handler wants us to
+                     * remember (possibly freeing the last known "good"
+                     * result data pointer) 
+                     */
+                    if (callback_data_keep && iinfo->free_data_context) {
+                        (iinfo->free_data_context) (callback_data_keep,
+                                                    iinfo);
+                        callback_data_keep = NULL;
+                    }
+                    if (iinfo->make_data_context && !callback_data_context) {
+                        callback_data_context =
+                            (iinfo->
+                             make_data_context) (callback_loop_context,
+                                                 iinfo);
+
+                    }
+                    callback_data_keep = callback_data_context;
+                    callback_data_context = NULL;
+                } else {
+                    if (callback_data_context && iinfo->free_data_context)
+                        (iinfo->free_data_context) (callback_data_context,
+                                                    iinfo);
+                    callback_data_context = NULL;
+                }
+
+                /*
+                 * get the next node in the data chain 
+                 */
+                index_search =
+                    (iinfo->get_next_data_point) (&callback_loop_context,
+                                                  &callback_data_context,
+                                                  index_search, iinfo);
+
+                if (!index_search && !results &&
+                    tbl_info->max_column > table_info->colnum) {
+                    /*
+                     * restart loop.  XXX: Should cache this better 
+                     */
+                    table_info->colnum++;
+                    coloid[reginfo->rootoid_len + 1] = table_info->colnum;
+                    if (free_this_index_search != NULL)
+                        snmp_free_varbind(free_this_index_search);
+                    index_search = snmp_clone_varbind(table_info->indexes);
+		    free_this_index_search = index_search;
+
+                    if (callback_loop_context &&
+                        iinfo->free_loop_context_at_end) {
+                        (iinfo->free_loop_context_at_end)(callback_loop_context,
+                                                          iinfo);
+                        callback_loop_context = NULL;
+                    }
+                    if (iinfo->free_loop_context && callback_loop_context) {
+                        (iinfo->free_loop_context) (callback_loop_context,
+                                                    iinfo);
+                        callback_loop_context = NULL;
+                    }
+                    if (callback_data_context && iinfo->free_data_context) {
+                        (iinfo->free_data_context) (callback_data_context,
+                                                    iinfo);
+                        callback_data_context = NULL;
+                    }
+                    
+                    index_search =
+                        (iinfo->
+                         get_first_data_point) (&callback_loop_context,
+                                                &callback_data_context,
+                                                index_search, iinfo);
+                }
+            }
+
+            break;
+
+        case MODE_GET:
+        case MODE_SET_RESERVE1:
+            /*
+             * loop through all data till exact results are found 
+             */
+
+            while (index_search) {
+                build_oid_noalloc(myname, MAX_OID_LEN, &myname_len,
+                                  coloid, coloid_len, index_search);
+                if (snmp_oid_compare(myname, myname_len,
+                                     requests->requestvb->name,
+                                     requests->requestvb->name_length) ==
+                    0) {
+                    /*
+                     * found the exact match, so we're done 
+                     */
+                    if (iinfo->make_data_context && !callback_data_context) {
+                        callback_data_context =
+                            (iinfo->
+                             make_data_context) (callback_loop_context,
+                                                 iinfo);
+
+                    }
+                    callback_data_keep = callback_data_context;
+                    callback_data_context = NULL;
+                    results = snmp_clone_varbind(index_search);
+                    snmp_set_var_objid(results, myname, myname_len);
+                    goto got_results;
+                } else {
+                    /*
+                     * free not-needed data context 
+                     */
+                    if (callback_data_context && iinfo->free_data_context) {
+                        (iinfo->free_data_context) (callback_data_context,
+                                                    iinfo);
+                        callback_data_context = NULL;
+                    }
+
+                }
+
+                /*
+                 * get the next node in the data chain 
+                 */
+                index_search =
+                    (iinfo->get_next_data_point) (&callback_loop_context,
+                                                  &callback_data_context,
+                                                  index_search, iinfo);
+            }
+            break;
+
+        default:
+            /*
+             * the rest of the set states have been dealt with already 
+             */
+            goto got_results;
+        }
+
+        /*
+         * XXX: free index_search? 
+         */
+        if (callback_loop_context && iinfo->free_loop_context) {
+            (iinfo->free_loop_context) (callback_loop_context, iinfo);
+            callback_loop_context = NULL;
+        }
+
+      got_results:             /* not milk */
+   
+       /*
+        * This free_data_context call is required in the event that your
+        * get_next_data_point method allocates new memory, even during the
+        * calls where it eventually returns a NULL
+        */
+        if (callback_data_context && iinfo->free_data_context) {
+               (iinfo->free_data_context) (callback_data_context,
+                                           iinfo);
+               callback_data_context = NULL;
+        }
+
+        if (!results && !MODE_IS_SET(reqinfo->mode)) {
+            /*
+             * no results found. 
+             */
+            /*
+             * XXX: check for at least one entry at the very top 
+             */
+#ifdef NOT_SERIALIZED
+            break;
+#else
+            if (callback_loop_context && iinfo->free_loop_context_at_end) {
+                (iinfo->free_loop_context_at_end) (callback_loop_context,
+                                                   iinfo);
+		callback_loop_context = NULL;
+	    }
+            if (free_this_index_search != NULL) {
+                snmp_free_varbind(free_this_index_search);
+            }
+            return SNMP_ERR_NOERROR;
+#endif
+        }
+
+      skip_processing:
+        /*
+         * OK, here results should be a pointer to the data that we
+         * actually need to GET 
+         */
+        oldmode = reqinfo->mode;
+        if (reqinfo->mode == MODE_GETNEXT || reqinfo->mode == MODE_GETBULK) {   /* XXX */
+            snmp_set_var_objid(requests->requestvb, results->name,
+                               results->name_length);
+            reqinfo->mode = MODE_GET;
+        }
+        if (reqinfo->mode == MODE_GET || reqinfo->mode == MODE_GETNEXT || reqinfo->mode == MODE_GETBULK ||      /* XXX */
+            reqinfo->mode == MODE_SET_RESERVE1) {
+            /*
+             * first (or only) pass stuff 
+             */
+            /*
+             * let set requsets use previously constructed data 
+             */
+            snmp_free_varbind(results);
+            if (callback_data_keep)
+                netsnmp_request_add_list_data(requests,
+                                              netsnmp_create_data_list
+                                              (TABLE_ITERATOR_NAME,
+                                               callback_data_keep, NULL));
+            netsnmp_request_add_list_data(requests,
+                                          netsnmp_create_data_list
+                                          (TABLE_ITERATOR_LAST_CONTEXT,
+                                           callback_loop_context, NULL));
+        }
+
+        DEBUGMSGTL(("table_iterator", "doing mode: %s\n",
+                    se_find_label_in_slist("agent_mode", oldmode)));
+        ret =
+            netsnmp_call_next_handler(handler, reginfo, reqinfo, requests);
+        if (oldmode == MODE_GETNEXT || oldmode == MODE_GETBULK) {       /* XXX */
+            if (requests->requestvb->type == ASN_NULL ||
+                requests->requestvb->type == SNMP_NOSUCHINSTANCE) {
+                /*
+                 * get next skipped this value for this column, we
+                 * need to keep searching forward 
+                 */
+                requests->requestvb->type = ASN_PRIV_RETRY;
+            }
+            reqinfo->mode = oldmode;
+        }
+
+        callback_data_keep =
+            netsnmp_request_get_list_data(requests, TABLE_ITERATOR_NAME);
+        callback_loop_context =
+            netsnmp_request_get_list_data(requests,
+                                          TABLE_ITERATOR_LAST_CONTEXT);
+
+        /* 
+         * This has to be done to prevent a memory leak. Notice that on
+         * SET_RESERVE1 we're assigning something to
+         * 'free_this_index_search' at the beginning of this handler (right
+         * above the line that says 'below our minimum column?'), 
+         * but we're not given a chance to free it below with the other 
+         * SET modes, hence our doing it here. 
+         */
+        if (reqinfo->mode == MODE_SET_RESERVE1) {
+            if (free_this_index_search) {
+                snmp_free_varbind(free_this_index_search);
+                free_this_index_search = NULL;
+            }
+        }
+        if (reqinfo->mode == MODE_GET || reqinfo->mode == MODE_GETNEXT ||
+            reqinfo->mode == MODE_GETBULK ||      /* XXX */
+            reqinfo->mode == MODE_SET_FREE ||
+            reqinfo->mode == MODE_SET_UNDO ||
+            reqinfo->mode == MODE_SET_COMMIT) {
+            if (callback_data_keep && iinfo->free_data_context) {
+                (iinfo->free_data_context) (callback_data_keep, iinfo);
+                callback_data_keep = NULL;
+            }
+
+            if (free_this_index_search) {
+                snmp_free_varbind(free_this_index_search);
+                free_this_index_search = NULL;
+            }
+#ifndef NOT_SERIALIZED
+            if (callback_loop_context && iinfo->free_loop_context_at_end) {
+                (iinfo->free_loop_context_at_end) (callback_loop_context,
+                                                   iinfo);
+ 		callback_loop_context = NULL;
+            }
+#endif
+        }
+#ifdef NOT_SERIALIZED
+        return ret;
+#else
+        requests = requests->next;
+#endif
+    }
+#ifdef NOT_SERIALIZED
+    if (reqinfo->mode == MODE_GET || reqinfo->mode == MODE_GETNEXT || reqinfo->mode == MODE_GETBULK ||  /* XXX */
+        reqinfo->mode == MODE_SET_FREE ||
+        reqinfo->mode == MODE_SET_UNDO ||
+        reqinfo->mode == MODE_SET_COMMIT) {
+        if (callback_loop_context && iinfo->free_loop_context_at_end) {
+            (iinfo->free_loop_context_at_end) (callback_loop_context,
+                                               iinfo);
+	    callback_loop_context = NULL;
+	}
+    }
+#endif
+    return SNMP_ERR_NOERROR;
+}
diff -Naur tomato/release/src/router/snmp/agent/helpers/watcher.c tomato121/release/src/router/snmp/agent/helpers/watcher.c
--- tomato/release/src/router/snmp/agent/helpers/watcher.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/helpers/watcher.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,246 @@
+#include <net-snmp/net-snmp-config.h>
+
+#include <stdlib.h>
+#if HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+#include <net-snmp/agent/watcher.h>
+#include <net-snmp/agent/instance.h>
+#include <net-snmp/agent/scalar.h>
+
+#if HAVE_DMALLOC_H
+#include <dmalloc.h>
+#endif
+
+
+/** @defgroup watcher watcher: watch a specified variable and process
+ *   it as an instance or scalar object
+ *  @ingroup handler
+ *  @{
+ */
+netsnmp_mib_handler *
+netsnmp_get_watcher_handler(void)
+{
+    return netsnmp_create_handler("watcher",
+                                  netsnmp_watcher_helper_handler);
+}
+
+netsnmp_watcher_info *
+netsnmp_create_watcher_info(void *data, size_t size, u_char type, int flags)
+{
+    netsnmp_watcher_info *winfo = SNMP_MALLOC_TYPEDEF(netsnmp_watcher_info);
+
+    winfo->data      = data;
+    winfo->data_size = size;
+    winfo->max_size  = size;	/* Probably wrong for non-fixed size data */
+    winfo->type      = type;
+    if (flags)
+        winfo->flags = flags;
+    else
+        winfo->flags = WATCHER_FIXED_SIZE;
+
+    return winfo;
+}
+
+int
+netsnmp_register_watched_instance(netsnmp_handler_registration *reginfo,
+                                  netsnmp_watcher_info         *watchinfo)
+{
+    netsnmp_mib_handler *whandler;
+
+    whandler         = netsnmp_get_watcher_handler();
+    whandler->myvoid = (void *)watchinfo;
+
+    netsnmp_inject_handler(reginfo, whandler);
+    return netsnmp_register_instance(reginfo);
+}
+
+int
+netsnmp_register_watched_scalar(netsnmp_handler_registration *reginfo,
+                                  netsnmp_watcher_info         *watchinfo)
+{
+    netsnmp_mib_handler *whandler;
+
+    whandler         = netsnmp_get_watcher_handler();
+    whandler->myvoid = (void *)watchinfo;
+
+    netsnmp_inject_handler(reginfo, whandler);
+    return netsnmp_register_scalar(reginfo);
+}
+
+
+
+int
+netsnmp_watcher_helper_handler(netsnmp_mib_handler *handler,
+                               netsnmp_handler_registration *reginfo,
+                               netsnmp_agent_request_info *reqinfo,
+                               netsnmp_request_info *requests)
+{
+    netsnmp_watcher_info *winfo = (netsnmp_watcher_info *) handler->myvoid;
+    u_char              *old_data;
+    int                  cmp;
+
+    DEBUGMSGTL(("helper:watcher", "Got request:  %d\n", reqinfo->mode));
+    cmp = snmp_oid_compare(requests->requestvb->name,
+                           requests->requestvb->name_length,
+                           reginfo->rootoid, reginfo->rootoid_len);
+
+    DEBUGMSGTL(( "helper:watcher", "  oid:", cmp));
+    DEBUGMSGOID(("helper:watcher", requests->requestvb->name,
+                                   requests->requestvb->name_length));
+    DEBUGMSG((   "helper:watcher", "\n"));
+
+
+
+    switch (reqinfo->mode) {
+        /*
+         * data requests 
+         */
+    case MODE_GET:
+        snmp_set_var_typed_value(requests->requestvb,
+                                 winfo->type,
+                                 winfo->data,
+                                 winfo->data_size);
+        break;
+
+        /*
+         * SET requests.  Should only get here if registered RWRITE 
+         */
+    case MODE_SET_RESERVE1:
+        if (requests->requestvb->type != winfo->type)
+            netsnmp_set_request_error(reqinfo, requests,
+                                      SNMP_ERR_WRONGTYPE);
+
+        if (((winfo->flags & WATCHER_MAX_SIZE) &&
+               requests->requestvb->val_len >  winfo->max_size) ||
+            ((winfo->flags & WATCHER_FIXED_SIZE) &&
+               requests->requestvb->val_len != winfo->data_size))
+             netsnmp_set_request_error(reqinfo, requests,
+                                      SNMP_ERR_WRONGLENGTH);
+        break;
+
+    case MODE_SET_RESERVE2:
+        /*
+         * store old info for undo later 
+         */
+        memdup(&old_data, (u_char *) winfo->data, winfo->data_size);
+        if (old_data == NULL) {
+            netsnmp_set_request_error(reqinfo, requests,
+                                      SNMP_ERR_RESOURCEUNAVAILABLE);
+            return SNMP_ERR_NOERROR;
+        }
+        netsnmp_request_add_list_data(requests,
+                                      netsnmp_create_data_list
+                                      ("watcher", old_data, free));
+        break;
+
+    case MODE_SET_FREE:
+        /*
+         * nothing to do 
+         */
+        break;
+
+    case MODE_SET_ACTION:
+        /*
+         * update current 
+         */
+        memcpy(winfo->data, (void *)requests->requestvb->val.string,
+                                    requests->requestvb->val_len);
+        break;
+
+    case MODE_SET_UNDO:
+        memcpy(winfo->data,
+               netsnmp_request_get_list_data(requests, "watcher"),
+               winfo->data_size);
+        break;
+
+    case MODE_SET_COMMIT:
+        winfo->data_size = requests->requestvb->val_len;
+        break;
+
+    }
+    if (handler->next && handler->next->access_method)
+        return netsnmp_call_next_handler(handler, reginfo, reqinfo,
+                                         requests);
+    return SNMP_ERR_NOERROR;
+}
+
+
+    /***************************
+     *
+     * A specialised form of the above, reporting
+     *   the sysUpTime indicated by a given timestamp
+     *
+     ***************************/
+
+netsnmp_mib_handler *
+netsnmp_get_watched_timestamp_handler(void)
+{
+    return netsnmp_create_handler("watcher",
+                                  netsnmp_watched_timestamp_handler);
+}
+
+int
+netsnmp_register_watched_timestamp(netsnmp_handler_registration *reginfo,
+                                   marker_t *timestamp)
+{
+    netsnmp_mib_handler *whandler;
+
+    whandler         = netsnmp_get_watched_timestamp_handler();
+    whandler->myvoid = (void *)timestamp;
+    netsnmp_inject_handler(reginfo, whandler);
+    return netsnmp_register_scalar(reginfo);   /* XXX - or instance? */
+}
+
+
+int
+netsnmp_watched_timestamp_handler(netsnmp_mib_handler *handler,
+                               netsnmp_handler_registration *reginfo,
+                               netsnmp_agent_request_info *reqinfo,
+                               netsnmp_request_info *requests)
+{
+    marker_t timestamp = (marker_t) handler->myvoid;
+    int      uptime;
+    int      cmp;
+
+    DEBUGMSGTL(("helper:watcher:timestamp",
+                               "Got request:  %d\n", reqinfo->mode));
+    cmp = snmp_oid_compare(requests->requestvb->name,
+                           requests->requestvb->name_length,
+                           reginfo->rootoid, reginfo->rootoid_len);
+
+    DEBUGMSGTL(( "helper:watcher:timestamp", "  oid:", cmp));
+    DEBUGMSGOID(("helper:watcher:timestamp", requests->requestvb->name,
+                                   requests->requestvb->name_length));
+    DEBUGMSG((   "helper:watcher:timestamp", "\n"));
+
+
+
+    switch (reqinfo->mode) {
+        /*
+         * data requests 
+         */
+    case MODE_GET:
+        uptime = netsnmp_marker_uptime( timestamp );
+        snmp_set_var_typed_value(requests->requestvb,
+                                 ASN_TIMETICKS,
+                                 (u_char *) &uptime,
+                                 sizeof(uptime));
+        break;
+
+        /*
+         * Timestamps are inherently Read-Only,
+         *  so don't need to support SET requests.
+         */
+    }
+    if (handler->next && handler->next->access_method)
+        return netsnmp_call_next_handler(handler, reginfo, reqinfo,
+                                         requests);
+    return SNMP_ERR_NOERROR;
+}
diff -Naur tomato/release/src/router/snmp/agent/kernel.c tomato121/release/src/router/snmp/agent/kernel.c
--- tomato/release/src/router/snmp/agent/kernel.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/kernel.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,201 @@
+
+/*
+ *  13 Jun 91  wsak (wk0x@andrew) added mips support
+ */
+
+#include <net-snmp/net-snmp-config.h>
+
+#ifdef CAN_USE_NLIST
+
+#include <sys/types.h>
+#if HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#if HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#include <stdio.h>
+#include <errno.h>
+#if HAVE_STRING_H
+#include <string.h>
+#endif
+#if HAVE_FCNTL_H
+#include <fcntl.h>
+#endif
+#if HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+#if HAVE_KVM_H
+#include <kvm.h>
+#endif
+
+#include <net-snmp/net-snmp-includes.h>
+
+#include "kernel.h"
+#include <net-snmp/agent/ds_agent.h>
+
+#ifndef NULL
+#define NULL 0
+#endif
+
+
+#if HAVE_KVM_H
+kvm_t          *kd;
+
+void
+init_kmem(const char *file)
+{
+#if HAVE_KVM_OPENFILES
+    char            err[4096];
+    kd = kvm_openfiles(NULL, NULL, NULL, O_RDONLY, err);
+    if (kd == NULL && !netsnmp_ds_get_boolean(NETSNMP_DS_APPLICATION_ID, 
+					   NETSNMP_DS_AGENT_NO_ROOT_ACCESS)) {
+        snmp_log(LOG_CRIT, "init_kmem: kvm_openfiles failed: %s\n", err);
+        exit(1);
+    }
+#else
+    kd = kvm_open(NULL, NULL, NULL, O_RDONLY, NULL);
+    if (!kd && !netsnmp_ds_get_boolean(NETSNMP_DS_APPLICATION_ID, 
+				       NETSNMP_DS_AGENT_NO_ROOT_ACCESS)) {
+        snmp_log(LOG_CRIT, "init_kmem: kvm_open failed: %s\n",
+                 strerror(errno));
+        exit(1);
+    }
+#endif                          /* HAVE_KVM_OPENFILES */
+}
+
+
+/*
+ *  klookup:
+ *
+ *  It seeks to the location  off  in kmem
+ *  It does a read into  target  of  siz  bytes.
+ *
+ *  Return 0 on failure and 1 on sucess.
+ *
+ */
+
+
+int
+klookup(unsigned long off, char *target, int siz)
+{
+    int             result;
+    if (kd == NULL)
+        return 0;
+    result = kvm_read(kd, off, target, siz);
+    if (result != siz) {
+#if HAVE_KVM_OPENFILES
+        snmp_log(LOG_ERR, "kvm_read(*, %lx, %p, %d) = %d: %s\n", off,
+                 target, siz, result, kvm_geterr(kd));
+#else
+        snmp_log(LOG_ERR, "kvm_read(*, %lx, %p, %d) = %d: ", off, target,
+                 siz, result);
+        snmp_log_perror("klookup");
+#endif
+        return 0;
+    }
+    return 1;
+}
+
+#else                           /* HAVE_KVM_H */
+
+static off_t    klseek(off_t);
+static int      klread(char *, int);
+int             swap, mem, kmem;
+
+void
+init_kmem(const char *file)
+{
+    kmem = open(file, O_RDONLY);
+    if (kmem < 0 && !netsnmp_ds_get_boolean(NETSNMP_DS_APPLICATION_ID, 
+					    NETSNMP_DS_AGENT_NO_ROOT_ACCESS)) {
+        snmp_log_perror(file);
+        exit(1);
+    }
+    fcntl(kmem, F_SETFD, 1);
+    mem = open("/dev/mem", O_RDONLY);
+    if (mem < 0 && !netsnmp_ds_get_boolean(NETSNMP_DS_APPLICATION_ID, 
+					   NETSNMP_DS_AGENT_NO_ROOT_ACCESS)) {
+        snmp_log_perror("/dev/mem");
+        exit(1);
+    }
+    fcntl(mem, F_SETFD, 1);
+#ifdef DMEM_LOC
+    swap = open(DMEM_LOC, O_RDONLY);
+    if (swap < 0 && !netsnmp_ds_get_boolean(NETSNMP_DS_APPLICATION_ID, 
+					    NETSNMP_DS_AGENT_NO_ROOT_ACCESS)) {
+        snmp_log_perror(DMEM_LOC);
+        exit(1);
+    }
+    fcntl(swap, F_SETFD, 1);
+#endif
+}
+
+
+/*
+ *  Seek into the kernel for a value.
+ */
+static          off_t
+klseek(off_t base)
+{
+    return (lseek(kmem, (off_t) base, SEEK_SET));
+}
+
+
+/*
+ *  Read from the kernel 
+ */
+static int
+klread(char *buf, int buflen)
+{
+    return (read(kmem, buf, buflen));
+}
+
+
+/*
+ *  klookup:
+ *
+ *  It seeks to the location  off  in kmem
+ *  It does a read into  target  of  siz  bytes.
+ *
+ *  Return 0 on failure and 1 on sucess.
+ *
+ */
+
+
+int
+klookup(unsigned long off, char *target, int siz)
+{
+    long            retsiz;
+
+    if (kmem < 0)
+        return 0;
+
+    if ((retsiz = klseek((off_t) off)) != off) {
+        snmp_log(LOG_ERR, "klookup(%lx, %p, %d): ", off, target, siz);
+        snmp_log_perror("klseek");
+#ifdef EXIT_ON_BAD_KLREAD
+        exit(1);
+#endif
+        return (0);
+    }
+    if ((retsiz = klread(target, siz)) != siz) {
+        if (snmp_get_do_debugging()) {
+            /*
+             * these happen too often on too many architectures to print them
+             * unless we're in debugging mode. People get very full log files. 
+             */
+            snmp_log(LOG_ERR, "klookup(%lx, %p, %d): ", off, target, siz);
+            snmp_log_perror("klread");
+        }
+#ifdef EXIT_ON_BAD_KLREAD
+        exit(1);
+#endif
+        return (0);
+    }
+    return (1);
+}
+
+#endif                          /* HAVE_KVM_H */
+
+#endif                          /* CAN_USE_NLIST */
diff -Naur tomato/release/src/router/snmp/agent/kernel.h tomato121/release/src/router/snmp/agent/kernel.h
--- tomato/release/src/router/snmp/agent/kernel.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/kernel.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,10 @@
+
+#ifndef linux
+extern void     init_kmem(const char *);
+extern int      klookup(unsigned long, char *, int);
+#endif
+
+#if HAVE_KVM_H
+#include <kvm.h>
+extern kvm_t   *kd;
+#endif
diff -Naur tomato/release/src/router/snmp/agent/m2m.h tomato121/release/src/router/snmp/agent/m2m.h
--- tomato/release/src/router/snmp/agent/m2m.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/m2m.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,60 @@
+/*
+ * m2m.h
+ */
+
+struct get_req_state {
+    int             type;
+    void           *info;
+};
+
+/*
+ * values for type field in get_req_state 
+ */
+#define ALARM_GET_REQ	1
+#define EVENT_GET_REQ	2
+
+/*
+ * the following define is used to document a routine or variable which
+ * ** is not static to a module.
+ */
+#define Export
+
+/*
+ * values for EntryStatus 
+ */
+#define ENTRY_ACTIVE		1
+#define ENTRY_NOTINSERVICE	2
+#define ENTRY_NOTREADY		3
+#define ENTRY_CREATEANDGO	4
+#define ENTRY_CREATEANDWAIT	5
+#define ENTRY_DESTROY		6
+
+/*
+ * maximum length for an OwnerString variable 
+ */
+#define MAX_OWNER_STR_LEN 128
+
+/*
+ * maximum length for a description field 
+ */
+#define MAX_DESCRIPTION_LEN 128
+
+/*
+ * defines for noting whether the incoming packet is unicast, broadcast,
+ * ** or multicast
+ */
+#define PKT_UNICAST 0
+#define PKT_BROADCAST 1
+#define PKT_MULTICAST 2
+
+/*
+ * macro to compare two ethernet addresses.  addr1 is a pointer to a
+ * ** struct ether_addr; addr2 is just a struct ether_addr.
+ */
+#define sameEtherAddr(addr1, addr2) \
+	((*((short *)((addr1)->ether_addr_octet)) == \
+					*((short *)((addr2).ether_addr_octet))) &&\
+	 (*((short *)(((addr1)->ether_addr_octet) + 2)) == \
+					*((short *)((((addr2).ether_addr_octet) + 2)))) &&\
+	 (*((short *)(((addr1)->ether_addr_octet) + 4)) == \
+					*((short *)((((addr2).ether_addr_octet) + 4)))))
diff -Naur tomato/release/src/router/snmp/agent/Makefile.depend tomato121/release/src/router/snmp/agent/Makefile.depend
--- tomato/release/src/router/snmp/agent/Makefile.depend	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/Makefile.depend	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,2964 @@
+# DO NOT DELETE THIS LINE -- make depend depends on it.
+
+./agent_handler.lo: ../include/net-snmp/net-snmp-config.h
+./agent_handler.lo: ../include/net-snmp/system/linux.h
+./agent_handler.lo: ../include/net-snmp/system/sysv.h
+./agent_handler.lo: ../include/net-snmp/system/generic.h
+./agent_handler.lo: ../include/net-snmp/machine/generic.h
+./agent_handler.lo: ../include/net-snmp/net-snmp-includes.h
+./agent_handler.lo: ../include/net-snmp/definitions.h
+./agent_handler.lo: ../include/net-snmp/types.h
+./agent_handler.lo: ../include/net-snmp/library/snmp_api.h
+./agent_handler.lo: ../include/net-snmp/library/asn1.h
+./agent_handler.lo: ../include/net-snmp/library/snmp_impl.h
+./agent_handler.lo: ../include/net-snmp/library/snmp.h
+./agent_handler.lo: ../include/net-snmp/library/snmp-tc.h
+./agent_handler.lo: ../include/net-snmp/utilities.h
+./agent_handler.lo: ../include/net-snmp/library/snmp_client.h
+./agent_handler.lo: ../include/net-snmp/library/getopt.h
+./agent_handler.lo: ../include/net-snmp/library/system.h
+./agent_handler.lo: ../include/net-snmp/library/tools.h
+./agent_handler.lo: ../include/net-snmp/library/int64.h
+./agent_handler.lo: ../include/net-snmp/library/mt_support.h
+./agent_handler.lo: ../include/net-snmp/library/snmp_alarm.h
+./agent_handler.lo: ../include/net-snmp/library/data_list.h
+./agent_handler.lo: ../include/net-snmp/library/callback.h
+./agent_handler.lo: ../include/net-snmp/library/oid_stash.h
+./agent_handler.lo: ../include/net-snmp/library/check_varbind.h
+./agent_handler.lo: ../include/net-snmp/version.h
+./agent_handler.lo: ../include/net-snmp/session_api.h
+./agent_handler.lo: ../include/net-snmp/library/snmp_transport.h
+./agent_handler.lo: ../include/net-snmp/library/snmpCallbackDomain.h
+./agent_handler.lo: ../include/net-snmp/library/snmpUnixDomain.h
+./agent_handler.lo: ../include/net-snmp/library/snmpUDPDomain.h
+./agent_handler.lo: ../include/net-snmp/library/snmpTCPDomain.h
+./agent_handler.lo: ../include/net-snmp/library/snmpUDPIPv6Domain.h
+./agent_handler.lo: ../include/net-snmp/library/snmpTCPIPv6Domain.h
+./agent_handler.lo: ../include/net-snmp/library/snmpIPXDomain.h
+./agent_handler.lo: ../include/net-snmp/library/ucd_compat.h
+./agent_handler.lo: ../include/net-snmp/pdu_api.h
+./agent_handler.lo: ../include/net-snmp/mib_api.h
+./agent_handler.lo: ../include/net-snmp/library/mib.h
+./agent_handler.lo: ../include/net-snmp/library/parse.h
+./agent_handler.lo: ../include/net-snmp/varbind_api.h
+./agent_handler.lo: ../include/net-snmp/config_api.h
+./agent_handler.lo: ../include/net-snmp/library/read_config.h
+./agent_handler.lo: ../include/net-snmp/library/default_store.h
+./agent_handler.lo: ../include/net-snmp/library/snmp_parse_args.h
+./agent_handler.lo: ../include/net-snmp/library/snmp_enum.h
+./agent_handler.lo: ../include/net-snmp/library/vacm.h
+./agent_handler.lo: ../include/net-snmp/output_api.h
+./agent_handler.lo: ../include/net-snmp/library/snmp_debug.h
+./agent_handler.lo: ../include/net-snmp/library/snmp_logging.h
+./agent_handler.lo: ../include/net-snmp/snmpv3_api.h
+./agent_handler.lo: ../include/net-snmp/library/snmpv3.h
+./agent_handler.lo: ../include/net-snmp/library/transform_oids.h
+./agent_handler.lo: ../include/net-snmp/library/keytools.h
+./agent_handler.lo: ../include/net-snmp/library/scapi.h
+./agent_handler.lo: ../include/net-snmp/library/lcd_time.h
+./agent_handler.lo: ../include/net-snmp/library/snmp_secmod.h
+./agent_handler.lo: ../include/net-snmp/library/snmpv3-security-includes.h
+./agent_handler.lo: ../include/net-snmp/library/snmpusm.h
+./agent_handler.lo: ../include/net-snmp/agent/net-snmp-agent-includes.h
+./agent_handler.lo: ../include/net-snmp/agent/snmp_agent.h
+./agent_handler.lo: ../include/net-snmp/agent/snmp_vars.h
+./agent_handler.lo: ../include/net-snmp/agent/agent_handler.h
+./agent_handler.lo: ../include/net-snmp/agent/var_struct.h
+./agent_handler.lo: ../include/net-snmp/agent/agent_registry.h
+./agent_handler.lo: ../include/net-snmp/agent/ds_agent.h
+./agent_handler.lo: ../include/net-snmp/agent/agent_read_config.h
+./agent_handler.lo: ../include/net-snmp/agent/agent_trap.h
+./agent_handler.lo: ../include/net-snmp/agent/all_helpers.h
+./agent_handler.lo: ../include/net-snmp/agent/instance.h
+./agent_handler.lo: ../include/net-snmp/agent/multiplexer.h
+./agent_handler.lo: ../include/net-snmp/agent/null.h
+./agent_handler.lo: ../include/net-snmp/agent/debug_handler.h
+./agent_handler.lo: ../include/net-snmp/agent/old_api.h
+./agent_handler.lo: ../include/net-snmp/agent/read_only.h
+./agent_handler.lo: ../include/net-snmp/agent/serialize.h
+./agent_handler.lo: ../include/net-snmp/agent/bulk_to_next.h
+./agent_handler.lo: ../include/net-snmp/agent/mode_end_call.h
+./agent_handler.lo: ../include/net-snmp/agent/table.h
+./agent_handler.lo: ../include/net-snmp/agent/table_data.h
+./agent_handler.lo: ../include/net-snmp/agent/table_dataset.h
+./agent_handler.lo: ../include/net-snmp/agent/table_iterator.h
+./agent_handler.lo: ../include/net-snmp/agent/mib_module_config.h
+./agent_index.lo: ../include/net-snmp/net-snmp-config.h
+./agent_index.lo: ../include/net-snmp/system/linux.h
+./agent_index.lo: ../include/net-snmp/system/sysv.h
+./agent_index.lo: ../include/net-snmp/system/generic.h
+./agent_index.lo: ../include/net-snmp/machine/generic.h 
+./agent_index.lo: ../include/net-snmp/net-snmp-includes.h
+./agent_index.lo: ../include/net-snmp/definitions.h
+./agent_index.lo: ../include/net-snmp/types.h
+./agent_index.lo: ../include/net-snmp/library/snmp_api.h
+./agent_index.lo: ../include/net-snmp/library/asn1.h
+./agent_index.lo: ../include/net-snmp/library/snmp_impl.h
+./agent_index.lo: ../include/net-snmp/library/snmp.h
+./agent_index.lo: ../include/net-snmp/library/snmp-tc.h
+./agent_index.lo: ../include/net-snmp/utilities.h
+./agent_index.lo: ../include/net-snmp/library/snmp_client.h
+./agent_index.lo: ../include/net-snmp/library/getopt.h
+./agent_index.lo: ../include/net-snmp/library/system.h
+./agent_index.lo: ../include/net-snmp/library/tools.h
+./agent_index.lo: ../include/net-snmp/library/int64.h
+./agent_index.lo: ../include/net-snmp/library/mt_support.h
+./agent_index.lo: ../include/net-snmp/library/snmp_alarm.h
+./agent_index.lo: ../include/net-snmp/library/data_list.h
+./agent_index.lo: ../include/net-snmp/library/callback.h
+./agent_index.lo: ../include/net-snmp/library/oid_stash.h
+./agent_index.lo: ../include/net-snmp/library/check_varbind.h
+./agent_index.lo: ../include/net-snmp/version.h
+./agent_index.lo: ../include/net-snmp/session_api.h
+./agent_index.lo: ../include/net-snmp/library/snmp_transport.h
+./agent_index.lo: ../include/net-snmp/library/snmpCallbackDomain.h
+./agent_index.lo: ../include/net-snmp/library/snmpUnixDomain.h
+./agent_index.lo: ../include/net-snmp/library/snmpUDPDomain.h
+./agent_index.lo: ../include/net-snmp/library/snmpTCPDomain.h
+./agent_index.lo: ../include/net-snmp/library/snmpUDPIPv6Domain.h
+./agent_index.lo: ../include/net-snmp/library/snmpTCPIPv6Domain.h
+./agent_index.lo: ../include/net-snmp/library/snmpIPXDomain.h
+./agent_index.lo: ../include/net-snmp/library/ucd_compat.h
+./agent_index.lo: ../include/net-snmp/pdu_api.h ../include/net-snmp/mib_api.h
+./agent_index.lo: ../include/net-snmp/library/mib.h
+./agent_index.lo: ../include/net-snmp/library/parse.h
+./agent_index.lo: ../include/net-snmp/varbind_api.h
+./agent_index.lo: ../include/net-snmp/config_api.h
+./agent_index.lo: ../include/net-snmp/library/read_config.h
+./agent_index.lo: ../include/net-snmp/library/default_store.h
+./agent_index.lo: ../include/net-snmp/library/snmp_parse_args.h
+./agent_index.lo: ../include/net-snmp/library/snmp_enum.h
+./agent_index.lo: ../include/net-snmp/library/vacm.h
+./agent_index.lo: ../include/net-snmp/output_api.h
+./agent_index.lo: ../include/net-snmp/library/snmp_debug.h
+./agent_index.lo: ../include/net-snmp/library/snmp_logging.h
+./agent_index.lo: ../include/net-snmp/snmpv3_api.h
+./agent_index.lo: ../include/net-snmp/library/snmpv3.h
+./agent_index.lo: ../include/net-snmp/library/transform_oids.h
+./agent_index.lo: ../include/net-snmp/library/keytools.h
+./agent_index.lo: ../include/net-snmp/library/scapi.h
+./agent_index.lo: ../include/net-snmp/library/lcd_time.h
+./agent_index.lo: ../include/net-snmp/library/snmp_secmod.h
+./agent_index.lo: ../include/net-snmp/library/snmpv3-security-includes.h
+./agent_index.lo: ../include/net-snmp/library/snmpusm.h
+./agent_index.lo: ../include/net-snmp/agent/net-snmp-agent-includes.h
+./agent_index.lo: ../include/net-snmp/agent/snmp_agent.h
+./agent_index.lo: ../include/net-snmp/agent/snmp_vars.h
+./agent_index.lo: ../include/net-snmp/agent/agent_handler.h
+./agent_index.lo: ../include/net-snmp/agent/var_struct.h
+./agent_index.lo: ../include/net-snmp/agent/agent_registry.h
+./agent_index.lo: ../include/net-snmp/agent/ds_agent.h
+./agent_index.lo: ../include/net-snmp/agent/agent_read_config.h
+./agent_index.lo: ../include/net-snmp/agent/agent_trap.h
+./agent_index.lo: ../include/net-snmp/agent/all_helpers.h
+./agent_index.lo: ../include/net-snmp/agent/instance.h
+./agent_index.lo: ../include/net-snmp/agent/multiplexer.h
+./agent_index.lo: ../include/net-snmp/agent/null.h
+./agent_index.lo: ../include/net-snmp/agent/debug_handler.h
+./agent_index.lo: ../include/net-snmp/agent/old_api.h
+./agent_index.lo: ../include/net-snmp/agent/read_only.h
+./agent_index.lo: ../include/net-snmp/agent/serialize.h
+./agent_index.lo: ../include/net-snmp/agent/bulk_to_next.h
+./agent_index.lo: ../include/net-snmp/agent/mode_end_call.h
+./agent_index.lo: ../include/net-snmp/agent/table.h
+./agent_index.lo: ../include/net-snmp/agent/table_data.h
+./agent_index.lo: ../include/net-snmp/agent/table_dataset.h
+./agent_index.lo: ../include/net-snmp/agent/table_iterator.h
+./agent_index.lo: ../include/net-snmp/agent/mib_module_config.h
+./agent_index.lo: ../include/net-snmp/agent/agent_callbacks.h
+./agent_index.lo: ../include/net-snmp/agent/agent_index.h snmpd.h
+./agent_index.lo: mibgroup/struct.h ./mibgroup/mib_module_includes.h
+./agent_index.lo: mibgroup/mibII.h mibgroup/ucd_snmp.h mibgroup/snmpv3mibs.h
+./agent_index.lo: mibgroup/notification.h mibgroup/target.h
+./agent_index.lo: mibgroup/agent_mibs.h mibgroup/agentx.h
+./agent_index.lo: mibgroup/utilities.h mibgroup/host.h mibgroup/examples.h
+./agent_index.lo: mibgroup/examples/example.h mibgroup/testhandler.h
+./agent_index.lo: mibgroup/smux.h mibgroup/Rmon.h mibgroup/disman/event-mib.h
+./agent_index.lo: mibgroup/mibII/system_mib.h mibgroup/mibII/sysORTable.h
+./agent_index.lo: mibgroup/mibII/at.h mibgroup/mibII/interfaces.h
+./agent_index.lo: mibgroup/mibII/snmp_mib.h mibgroup/mibII/tcp.h
+./agent_index.lo: mibgroup/mibII/icmp.h mibgroup/mibII/ip.h
+./agent_index.lo: mibgroup/mibII/var_route.h mibgroup/mibII/route_write.h
+./agent_index.lo: mibgroup/mibII/at.h mibgroup/mibII/udp.h
+./agent_index.lo: mibgroup/mibII/vacm_vars.h mibgroup/mibII/setSerialNo.h
+./agent_index.lo: mibgroup/ucd-snmp/memory.h ./mibgroup/mibdefs.h
+./agent_index.lo: mibgroup/ucd-snmp/vmstat.h mibgroup/ucd-snmp/proc.h
+./agent_index.lo: mibgroup/ucd-snmp/versioninfo.h mibgroup/ucd-snmp/pass.h
+./agent_index.lo: mibgroup/ucd-snmp/pass_persist.h mibgroup/ucd-snmp/disk.h
+./agent_index.lo: mibgroup/ucd-snmp/loadave.h mibgroup/ucd-snmp/extensible.h
+./agent_index.lo: mibgroup/ucd-snmp/errormib.h mibgroup/ucd-snmp/file.h
+./agent_index.lo: mibgroup/ucd-snmp/dlmod.h mibgroup/ucd-snmp/proxy.h
+./agent_index.lo: mibgroup/snmpv3/snmpEngine.h mibgroup/snmpv3/snmpMPDStats.h
+./agent_index.lo: mibgroup/snmpv3/usmStats.h mibgroup/snmpv3/usmUser.h
+./agent_index.lo: mibgroup/notification/snmpNotifyTable.h
+./agent_index.lo: mibgroup/notification/snmpNotifyFilterTable.h
+./agent_index.lo: mibgroup/notification/snmpNotifyFilterProfileTable.h
+./agent_index.lo: mibgroup/target/snmpTargetAddrEntry.h
+./agent_index.lo: mibgroup/target/snmpTargetParamsEntry.h
+./agent_index.lo: mibgroup/target/target.h mibgroup/target/target_counters.h
+./agent_index.lo: mibgroup/agent/nsTransactionTable.h
+./agent_index.lo: mibgroup/agent/nsModuleTable.h mibgroup/agentx/master.h
+./agent_index.lo: mibgroup/agentx/subagent.h mibgroup/utilities/override.h
+./agent_index.lo: mibgroup/host/hr_system.h mibgroup/host/hr_storage.h
+./agent_index.lo: mibgroup/host/hr_device.h mibgroup/host/hr_other.h
+./agent_index.lo: mibgroup/host/hr_proc.h mibgroup/host/hr_network.h
+./agent_index.lo: mibgroup/host/hr_print.h mibgroup/host/hr_disk.h
+./agent_index.lo: mibgroup/host/hr_partition.h mibgroup/host/hr_filesys.h
+./agent_index.lo: mibgroup/host/hr_swrun.h mibgroup/host/hr_swinst.h
+./agent_index.lo: mibgroup/examples/scalar_int.h mibgroup/examples/data_set.h
+./agent_index.lo: mibgroup/examples/delayed_instance.h mibgroup/util_funcs.h
+./agent_index.lo: mibgroup/struct.h mibgroup/smux/smux.h mibgroup/Rmon/rows.h
+./agent_index.lo: mibgroup/Rmon/agutil.h mibgroup/Rmon/statistics.h
+./agent_index.lo: mibgroup/Rmon/alarm.h mibgroup/Rmon/history.h
+./agent_index.lo: mibgroup/Rmon/event.h mibgroup/disman/mteTriggerTable.h
+./agent_index.lo: mibgroup/disman/mteTriggerDeltaTable.h
+./agent_index.lo: mibgroup/disman/mteTriggerExistenceTable.h
+./agent_index.lo: mibgroup/disman/mteTriggerBooleanTable.h
+./agent_index.lo: mibgroup/disman/mteTriggerThresholdTable.h
+./agent_index.lo: mibgroup/disman/mteObjectsTable.h
+./agent_index.lo: mibgroup/disman/mteEventTable.h
+./agent_index.lo: mibgroup/disman/mteEventNotificationTable.h
+./agent_index.lo: mibgroup/mibII/kernel_linux.h mibgroup/mibII/tcpTable.h
+./agent_index.lo: mibgroup/mibII/ipAddr.h mibgroup/mibII/var_route.h
+./agent_index.lo: mibgroup/mibII/route_write.h mibgroup/mibII/udpTable.h
+./agent_index.lo: mibgroup/mibII/vacm_context.h mibgroup/header_complex.h
+./agent_index.lo: mibgroup/agentx/protocol.h mibgroup/agentx/client.h
+./agent_index.lo: mibgroup/agentx/master_admin.h
+./agent_index.lo: mibgroup/agentx/agentx_config.h
+./agent_index.lo: ./mibgroup/agentx/subagent.h ./mibgroup/agentx/client.h
+./agent_read_config.lo: ../include/net-snmp/net-snmp-config.h
+./agent_read_config.lo: ../include/net-snmp/system/linux.h
+./agent_read_config.lo: ../include/net-snmp/system/sysv.h
+./agent_read_config.lo: ../include/net-snmp/system/generic.h
+./agent_read_config.lo: ../include/net-snmp/machine/generic.h
+./agent_read_config.lo: ../include/net-snmp/net-snmp-includes.h
+./agent_read_config.lo: ../include/net-snmp/definitions.h
+./agent_read_config.lo: ../include/net-snmp/types.h
+./agent_read_config.lo: ../include/net-snmp/library/snmp_api.h
+./agent_read_config.lo: ../include/net-snmp/library/asn1.h
+./agent_read_config.lo: ../include/net-snmp/library/snmp_impl.h
+./agent_read_config.lo: ../include/net-snmp/library/snmp.h
+./agent_read_config.lo: ../include/net-snmp/library/snmp-tc.h
+./agent_read_config.lo: ../include/net-snmp/utilities.h
+./agent_read_config.lo: ../include/net-snmp/library/snmp_client.h
+./agent_read_config.lo: ../include/net-snmp/library/getopt.h
+./agent_read_config.lo: ../include/net-snmp/library/system.h
+./agent_read_config.lo: ../include/net-snmp/library/tools.h
+./agent_read_config.lo: ../include/net-snmp/library/int64.h
+./agent_read_config.lo: ../include/net-snmp/library/mt_support.h
+./agent_read_config.lo: ../include/net-snmp/library/snmp_alarm.h
+./agent_read_config.lo: ../include/net-snmp/library/data_list.h
+./agent_read_config.lo: ../include/net-snmp/library/callback.h
+./agent_read_config.lo: ../include/net-snmp/library/oid_stash.h
+./agent_read_config.lo: ../include/net-snmp/library/check_varbind.h
+./agent_read_config.lo: ../include/net-snmp/version.h
+./agent_read_config.lo: ../include/net-snmp/session_api.h
+./agent_read_config.lo: ../include/net-snmp/library/snmp_transport.h
+./agent_read_config.lo: ../include/net-snmp/library/snmpCallbackDomain.h
+./agent_read_config.lo: ../include/net-snmp/library/snmpUnixDomain.h
+./agent_read_config.lo: ../include/net-snmp/library/snmpUDPDomain.h
+./agent_read_config.lo: ../include/net-snmp/library/snmpTCPDomain.h
+./agent_read_config.lo: ../include/net-snmp/library/snmpUDPIPv6Domain.h
+./agent_read_config.lo: ../include/net-snmp/library/snmpTCPIPv6Domain.h
+./agent_read_config.lo: ../include/net-snmp/library/snmpIPXDomain.h
+./agent_read_config.lo: ../include/net-snmp/library/ucd_compat.h
+./agent_read_config.lo: ../include/net-snmp/pdu_api.h
+./agent_read_config.lo: ../include/net-snmp/mib_api.h
+./agent_read_config.lo: ../include/net-snmp/library/mib.h
+./agent_read_config.lo: ../include/net-snmp/library/parse.h
+./agent_read_config.lo: ../include/net-snmp/varbind_api.h
+./agent_read_config.lo: ../include/net-snmp/config_api.h
+./agent_read_config.lo: ../include/net-snmp/library/read_config.h
+./agent_read_config.lo: ../include/net-snmp/library/default_store.h
+./agent_read_config.lo: ../include/net-snmp/library/snmp_parse_args.h
+./agent_read_config.lo: ../include/net-snmp/library/snmp_enum.h
+./agent_read_config.lo: ../include/net-snmp/library/vacm.h
+./agent_read_config.lo: ../include/net-snmp/output_api.h
+./agent_read_config.lo: ../include/net-snmp/library/snmp_debug.h
+./agent_read_config.lo: ../include/net-snmp/library/snmp_logging.h
+./agent_read_config.lo: ../include/net-snmp/snmpv3_api.h
+./agent_read_config.lo: ../include/net-snmp/library/snmpv3.h
+./agent_read_config.lo: ../include/net-snmp/library/transform_oids.h
+./agent_read_config.lo: ../include/net-snmp/library/keytools.h
+./agent_read_config.lo: ../include/net-snmp/library/scapi.h
+./agent_read_config.lo: ../include/net-snmp/library/lcd_time.h
+./agent_read_config.lo: ../include/net-snmp/library/snmp_secmod.h
+./agent_read_config.lo: ../include/net-snmp/library/snmpv3-security-includes.h
+./agent_read_config.lo: ../include/net-snmp/library/snmpusm.h
+./agent_read_config.lo: ../include/net-snmp/agent/net-snmp-agent-includes.h
+./agent_read_config.lo: ../include/net-snmp/agent/snmp_agent.h
+./agent_read_config.lo: ../include/net-snmp/agent/snmp_vars.h
+./agent_read_config.lo: ../include/net-snmp/agent/agent_handler.h
+./agent_read_config.lo: ../include/net-snmp/agent/var_struct.h
+./agent_read_config.lo: ../include/net-snmp/agent/agent_registry.h
+./agent_read_config.lo: ../include/net-snmp/agent/ds_agent.h
+./agent_read_config.lo: ../include/net-snmp/agent/agent_read_config.h
+./agent_read_config.lo: ../include/net-snmp/agent/agent_trap.h
+./agent_read_config.lo: ../include/net-snmp/agent/all_helpers.h
+./agent_read_config.lo: ../include/net-snmp/agent/instance.h
+./agent_read_config.lo: ../include/net-snmp/agent/multiplexer.h
+./agent_read_config.lo: ../include/net-snmp/agent/null.h
+./agent_read_config.lo: ../include/net-snmp/agent/debug_handler.h
+./agent_read_config.lo: ../include/net-snmp/agent/old_api.h
+./agent_read_config.lo: ../include/net-snmp/agent/read_only.h
+./agent_read_config.lo: ../include/net-snmp/agent/serialize.h
+./agent_read_config.lo: ../include/net-snmp/agent/bulk_to_next.h
+./agent_read_config.lo: ../include/net-snmp/agent/mode_end_call.h
+./agent_read_config.lo: ../include/net-snmp/agent/table.h
+./agent_read_config.lo: ../include/net-snmp/agent/table_data.h
+./agent_read_config.lo: ../include/net-snmp/agent/table_dataset.h
+./agent_read_config.lo: ../include/net-snmp/agent/table_iterator.h
+./agent_read_config.lo: ../include/net-snmp/agent/mib_module_config.h
+./agent_read_config.lo: mibgroup/struct.h snmpd.h
+./agent_read_config.lo: ../include/net-snmp/agent/agent_callbacks.h
+./agent_read_config.lo: ./mibgroup/mib_module_includes.h mibgroup/mibII.h
+./agent_read_config.lo: mibgroup/ucd_snmp.h mibgroup/snmpv3mibs.h
+./agent_read_config.lo: mibgroup/notification.h mibgroup/target.h
+./agent_read_config.lo: mibgroup/agent_mibs.h mibgroup/agentx.h
+./agent_read_config.lo: mibgroup/utilities.h mibgroup/host.h
+./agent_read_config.lo: mibgroup/examples.h mibgroup/examples/example.h
+./agent_read_config.lo: mibgroup/testhandler.h mibgroup/smux.h
+./agent_read_config.lo: mibgroup/Rmon.h mibgroup/disman/event-mib.h
+./agent_read_config.lo: mibgroup/mibII/system_mib.h
+./agent_read_config.lo: mibgroup/mibII/sysORTable.h mibgroup/mibII/at.h
+./agent_read_config.lo: mibgroup/mibII/interfaces.h mibgroup/mibII/snmp_mib.h
+./agent_read_config.lo: mibgroup/mibII/tcp.h mibgroup/mibII/icmp.h
+./agent_read_config.lo: mibgroup/mibII/ip.h mibgroup/mibII/var_route.h
+./agent_read_config.lo: mibgroup/mibII/route_write.h mibgroup/mibII/at.h
+./agent_read_config.lo: mibgroup/mibII/udp.h mibgroup/mibII/vacm_vars.h
+./agent_read_config.lo: mibgroup/mibII/setSerialNo.h
+./agent_read_config.lo: mibgroup/ucd-snmp/memory.h ./mibgroup/mibdefs.h
+./agent_read_config.lo: mibgroup/ucd-snmp/vmstat.h mibgroup/ucd-snmp/proc.h
+./agent_read_config.lo: mibgroup/ucd-snmp/versioninfo.h
+./agent_read_config.lo: mibgroup/ucd-snmp/pass.h
+./agent_read_config.lo: mibgroup/ucd-snmp/pass_persist.h
+./agent_read_config.lo: mibgroup/ucd-snmp/disk.h mibgroup/ucd-snmp/loadave.h
+./agent_read_config.lo: mibgroup/ucd-snmp/extensible.h
+./agent_read_config.lo: mibgroup/ucd-snmp/errormib.h mibgroup/ucd-snmp/file.h
+./agent_read_config.lo: mibgroup/ucd-snmp/dlmod.h mibgroup/ucd-snmp/proxy.h
+./agent_read_config.lo: mibgroup/snmpv3/snmpEngine.h
+./agent_read_config.lo: mibgroup/snmpv3/snmpMPDStats.h
+./agent_read_config.lo: mibgroup/snmpv3/usmStats.h mibgroup/snmpv3/usmUser.h
+./agent_read_config.lo: mibgroup/notification/snmpNotifyTable.h
+./agent_read_config.lo: mibgroup/notification/snmpNotifyFilterTable.h
+./agent_read_config.lo: mibgroup/notification/snmpNotifyFilterProfileTable.h
+./agent_read_config.lo: mibgroup/target/snmpTargetAddrEntry.h
+./agent_read_config.lo: mibgroup/target/snmpTargetParamsEntry.h
+./agent_read_config.lo: mibgroup/target/target.h
+./agent_read_config.lo: mibgroup/target/target_counters.h
+./agent_read_config.lo: mibgroup/agent/nsTransactionTable.h
+./agent_read_config.lo: mibgroup/agent/nsModuleTable.h
+./agent_read_config.lo: mibgroup/agentx/master.h mibgroup/agentx/subagent.h
+./agent_read_config.lo: mibgroup/utilities/override.h
+./agent_read_config.lo: mibgroup/host/hr_system.h mibgroup/host/hr_storage.h
+./agent_read_config.lo: mibgroup/host/hr_device.h mibgroup/host/hr_other.h
+./agent_read_config.lo: mibgroup/host/hr_proc.h mibgroup/host/hr_network.h
+./agent_read_config.lo: mibgroup/host/hr_print.h mibgroup/host/hr_disk.h
+./agent_read_config.lo: mibgroup/host/hr_partition.h
+./agent_read_config.lo: mibgroup/host/hr_filesys.h mibgroup/host/hr_swrun.h
+./agent_read_config.lo: mibgroup/host/hr_swinst.h
+./agent_read_config.lo: mibgroup/examples/scalar_int.h
+./agent_read_config.lo: mibgroup/examples/data_set.h
+./agent_read_config.lo: mibgroup/examples/delayed_instance.h
+./agent_read_config.lo: mibgroup/util_funcs.h mibgroup/struct.h
+./agent_read_config.lo: mibgroup/smux/smux.h mibgroup/Rmon/rows.h
+./agent_read_config.lo: mibgroup/Rmon/agutil.h mibgroup/Rmon/statistics.h
+./agent_read_config.lo: mibgroup/Rmon/alarm.h mibgroup/Rmon/history.h
+./agent_read_config.lo: mibgroup/Rmon/event.h
+./agent_read_config.lo: mibgroup/disman/mteTriggerTable.h
+./agent_read_config.lo: mibgroup/disman/mteTriggerDeltaTable.h
+./agent_read_config.lo: mibgroup/disman/mteTriggerExistenceTable.h
+./agent_read_config.lo: mibgroup/disman/mteTriggerBooleanTable.h
+./agent_read_config.lo: mibgroup/disman/mteTriggerThresholdTable.h
+./agent_read_config.lo: mibgroup/disman/mteObjectsTable.h
+./agent_read_config.lo: mibgroup/disman/mteEventTable.h
+./agent_read_config.lo: mibgroup/disman/mteEventNotificationTable.h
+./agent_read_config.lo: mibgroup/mibII/kernel_linux.h
+./agent_read_config.lo: mibgroup/mibII/tcpTable.h mibgroup/mibII/ipAddr.h
+./agent_read_config.lo: mibgroup/mibII/var_route.h
+./agent_read_config.lo: mibgroup/mibII/route_write.h
+./agent_read_config.lo: mibgroup/mibII/udpTable.h
+./agent_read_config.lo: mibgroup/mibII/vacm_context.h
+./agent_read_config.lo: mibgroup/header_complex.h mibgroup/agentx/protocol.h
+./agent_read_config.lo: mibgroup/agentx/client.h
+./agent_read_config.lo: mibgroup/agentx/master_admin.h
+./agent_read_config.lo: mibgroup/agentx/agentx_config.h
+./agent_read_config.lo: ./mibgroup/mib_module_dot_conf.h
+./agent_registry.lo: ../include/net-snmp/net-snmp-config.h
+./agent_registry.lo: ../include/net-snmp/system/linux.h
+./agent_registry.lo: ../include/net-snmp/system/sysv.h
+./agent_registry.lo: ../include/net-snmp/system/generic.h
+./agent_registry.lo: ../include/net-snmp/machine/generic.h
+./agent_registry.lo: ../include/net-snmp/net-snmp-includes.h
+./agent_registry.lo: ../include/net-snmp/definitions.h
+./agent_registry.lo: ../include/net-snmp/types.h
+./agent_registry.lo: ../include/net-snmp/library/snmp_api.h
+./agent_registry.lo: ../include/net-snmp/library/asn1.h
+./agent_registry.lo: ../include/net-snmp/library/snmp_impl.h
+./agent_registry.lo: ../include/net-snmp/library/snmp.h
+./agent_registry.lo: ../include/net-snmp/library/snmp-tc.h
+./agent_registry.lo: ../include/net-snmp/utilities.h
+./agent_registry.lo: ../include/net-snmp/library/snmp_client.h
+./agent_registry.lo: ../include/net-snmp/library/getopt.h
+./agent_registry.lo: ../include/net-snmp/library/system.h
+./agent_registry.lo: ../include/net-snmp/library/tools.h
+./agent_registry.lo: ../include/net-snmp/library/int64.h
+./agent_registry.lo: ../include/net-snmp/library/mt_support.h
+./agent_registry.lo: ../include/net-snmp/library/snmp_alarm.h
+./agent_registry.lo: ../include/net-snmp/library/data_list.h
+./agent_registry.lo: ../include/net-snmp/library/callback.h
+./agent_registry.lo: ../include/net-snmp/library/oid_stash.h
+./agent_registry.lo: ../include/net-snmp/library/check_varbind.h
+./agent_registry.lo: ../include/net-snmp/version.h
+./agent_registry.lo: ../include/net-snmp/session_api.h
+./agent_registry.lo: ../include/net-snmp/library/snmp_transport.h
+./agent_registry.lo: ../include/net-snmp/library/snmpCallbackDomain.h
+./agent_registry.lo: ../include/net-snmp/library/snmpUnixDomain.h
+./agent_registry.lo: ../include/net-snmp/library/snmpUDPDomain.h
+./agent_registry.lo: ../include/net-snmp/library/snmpTCPDomain.h
+./agent_registry.lo: ../include/net-snmp/library/snmpUDPIPv6Domain.h
+./agent_registry.lo: ../include/net-snmp/library/snmpTCPIPv6Domain.h
+./agent_registry.lo: ../include/net-snmp/library/snmpIPXDomain.h
+./agent_registry.lo: ../include/net-snmp/library/ucd_compat.h
+./agent_registry.lo: ../include/net-snmp/pdu_api.h
+./agent_registry.lo: ../include/net-snmp/mib_api.h
+./agent_registry.lo: ../include/net-snmp/library/mib.h
+./agent_registry.lo: ../include/net-snmp/library/parse.h
+./agent_registry.lo: ../include/net-snmp/varbind_api.h
+./agent_registry.lo: ../include/net-snmp/config_api.h
+./agent_registry.lo: ../include/net-snmp/library/read_config.h
+./agent_registry.lo: ../include/net-snmp/library/default_store.h
+./agent_registry.lo: ../include/net-snmp/library/snmp_parse_args.h
+./agent_registry.lo: ../include/net-snmp/library/snmp_enum.h
+./agent_registry.lo: ../include/net-snmp/library/vacm.h
+./agent_registry.lo: ../include/net-snmp/output_api.h
+./agent_registry.lo: ../include/net-snmp/library/snmp_debug.h
+./agent_registry.lo: ../include/net-snmp/library/snmp_logging.h
+./agent_registry.lo: ../include/net-snmp/snmpv3_api.h
+./agent_registry.lo: ../include/net-snmp/library/snmpv3.h
+./agent_registry.lo: ../include/net-snmp/library/transform_oids.h
+./agent_registry.lo: ../include/net-snmp/library/keytools.h
+./agent_registry.lo: ../include/net-snmp/library/scapi.h
+./agent_registry.lo: ../include/net-snmp/library/lcd_time.h
+./agent_registry.lo: ../include/net-snmp/library/snmp_secmod.h
+./agent_registry.lo: ../include/net-snmp/library/snmpv3-security-includes.h
+./agent_registry.lo: ../include/net-snmp/library/snmpusm.h
+./agent_registry.lo: ../include/net-snmp/agent/net-snmp-agent-includes.h
+./agent_registry.lo: ../include/net-snmp/agent/snmp_agent.h
+./agent_registry.lo: ../include/net-snmp/agent/snmp_vars.h
+./agent_registry.lo: ../include/net-snmp/agent/agent_handler.h
+./agent_registry.lo: ../include/net-snmp/agent/var_struct.h
+./agent_registry.lo: ../include/net-snmp/agent/agent_registry.h
+./agent_registry.lo: ../include/net-snmp/agent/ds_agent.h
+./agent_registry.lo: ../include/net-snmp/agent/agent_read_config.h
+./agent_registry.lo: ../include/net-snmp/agent/agent_trap.h
+./agent_registry.lo: ../include/net-snmp/agent/all_helpers.h
+./agent_registry.lo: ../include/net-snmp/agent/instance.h
+./agent_registry.lo: ../include/net-snmp/agent/multiplexer.h
+./agent_registry.lo: ../include/net-snmp/agent/null.h
+./agent_registry.lo: ../include/net-snmp/agent/debug_handler.h
+./agent_registry.lo: ../include/net-snmp/agent/old_api.h
+./agent_registry.lo: ../include/net-snmp/agent/read_only.h
+./agent_registry.lo: ../include/net-snmp/agent/serialize.h
+./agent_registry.lo: ../include/net-snmp/agent/bulk_to_next.h
+./agent_registry.lo: ../include/net-snmp/agent/mode_end_call.h
+./agent_registry.lo: ../include/net-snmp/agent/table.h
+./agent_registry.lo: ../include/net-snmp/agent/table_data.h
+./agent_registry.lo: ../include/net-snmp/agent/table_dataset.h
+./agent_registry.lo: ../include/net-snmp/agent/table_iterator.h
+./agent_registry.lo: ../include/net-snmp/agent/mib_module_config.h
+./agent_registry.lo: ../include/net-snmp/agent/agent_callbacks.h snmpd.h
+./agent_registry.lo: mibgroup/struct.h ./mibgroup/mib_module_includes.h
+./agent_registry.lo: mibgroup/mibII.h mibgroup/ucd_snmp.h
+./agent_registry.lo: mibgroup/snmpv3mibs.h mibgroup/notification.h
+./agent_registry.lo: mibgroup/target.h mibgroup/agent_mibs.h
+./agent_registry.lo: mibgroup/agentx.h mibgroup/utilities.h mibgroup/host.h
+./agent_registry.lo: mibgroup/examples.h mibgroup/examples/example.h
+./agent_registry.lo: mibgroup/testhandler.h mibgroup/smux.h mibgroup/Rmon.h
+./agent_registry.lo: mibgroup/disman/event-mib.h mibgroup/mibII/system_mib.h
+./agent_registry.lo: mibgroup/mibII/sysORTable.h mibgroup/mibII/at.h
+./agent_registry.lo: mibgroup/mibII/interfaces.h mibgroup/mibII/snmp_mib.h
+./agent_registry.lo: mibgroup/mibII/tcp.h mibgroup/mibII/icmp.h
+./agent_registry.lo: mibgroup/mibII/ip.h mibgroup/mibII/var_route.h
+./agent_registry.lo: mibgroup/mibII/route_write.h mibgroup/mibII/at.h
+./agent_registry.lo: mibgroup/mibII/udp.h mibgroup/mibII/vacm_vars.h
+./agent_registry.lo: mibgroup/mibII/setSerialNo.h mibgroup/ucd-snmp/memory.h
+./agent_registry.lo: ./mibgroup/mibdefs.h mibgroup/ucd-snmp/vmstat.h
+./agent_registry.lo: mibgroup/ucd-snmp/proc.h mibgroup/ucd-snmp/versioninfo.h
+./agent_registry.lo: mibgroup/ucd-snmp/pass.h
+./agent_registry.lo: mibgroup/ucd-snmp/pass_persist.h
+./agent_registry.lo: mibgroup/ucd-snmp/disk.h mibgroup/ucd-snmp/loadave.h
+./agent_registry.lo: mibgroup/ucd-snmp/extensible.h
+./agent_registry.lo: mibgroup/ucd-snmp/errormib.h mibgroup/ucd-snmp/file.h
+./agent_registry.lo: mibgroup/ucd-snmp/dlmod.h mibgroup/ucd-snmp/proxy.h
+./agent_registry.lo: mibgroup/snmpv3/snmpEngine.h
+./agent_registry.lo: mibgroup/snmpv3/snmpMPDStats.h
+./agent_registry.lo: mibgroup/snmpv3/usmStats.h mibgroup/snmpv3/usmUser.h
+./agent_registry.lo: mibgroup/notification/snmpNotifyTable.h
+./agent_registry.lo: mibgroup/notification/snmpNotifyFilterTable.h
+./agent_registry.lo: mibgroup/notification/snmpNotifyFilterProfileTable.h
+./agent_registry.lo: mibgroup/target/snmpTargetAddrEntry.h
+./agent_registry.lo: mibgroup/target/snmpTargetParamsEntry.h
+./agent_registry.lo: mibgroup/target/target.h
+./agent_registry.lo: mibgroup/target/target_counters.h
+./agent_registry.lo: mibgroup/agent/nsTransactionTable.h
+./agent_registry.lo: mibgroup/agent/nsModuleTable.h mibgroup/agentx/master.h
+./agent_registry.lo: mibgroup/agentx/subagent.h mibgroup/utilities/override.h
+./agent_registry.lo: mibgroup/host/hr_system.h mibgroup/host/hr_storage.h
+./agent_registry.lo: mibgroup/host/hr_device.h mibgroup/host/hr_other.h
+./agent_registry.lo: mibgroup/host/hr_proc.h mibgroup/host/hr_network.h
+./agent_registry.lo: mibgroup/host/hr_print.h mibgroup/host/hr_disk.h
+./agent_registry.lo: mibgroup/host/hr_partition.h mibgroup/host/hr_filesys.h
+./agent_registry.lo: mibgroup/host/hr_swrun.h mibgroup/host/hr_swinst.h
+./agent_registry.lo: mibgroup/examples/scalar_int.h
+./agent_registry.lo: mibgroup/examples/data_set.h
+./agent_registry.lo: mibgroup/examples/delayed_instance.h
+./agent_registry.lo: mibgroup/util_funcs.h mibgroup/struct.h
+./agent_registry.lo: mibgroup/smux/smux.h mibgroup/Rmon/rows.h
+./agent_registry.lo: mibgroup/Rmon/agutil.h mibgroup/Rmon/statistics.h
+./agent_registry.lo: mibgroup/Rmon/alarm.h mibgroup/Rmon/history.h
+./agent_registry.lo: mibgroup/Rmon/event.h mibgroup/disman/mteTriggerTable.h
+./agent_registry.lo: mibgroup/disman/mteTriggerDeltaTable.h
+./agent_registry.lo: mibgroup/disman/mteTriggerExistenceTable.h
+./agent_registry.lo: mibgroup/disman/mteTriggerBooleanTable.h
+./agent_registry.lo: mibgroup/disman/mteTriggerThresholdTable.h
+./agent_registry.lo: mibgroup/disman/mteObjectsTable.h
+./agent_registry.lo: mibgroup/disman/mteEventTable.h
+./agent_registry.lo: mibgroup/disman/mteEventNotificationTable.h
+./agent_registry.lo: mibgroup/mibII/kernel_linux.h mibgroup/mibII/tcpTable.h
+./agent_registry.lo: mibgroup/mibII/ipAddr.h mibgroup/mibII/var_route.h
+./agent_registry.lo: mibgroup/mibII/route_write.h mibgroup/mibII/udpTable.h
+./agent_registry.lo: mibgroup/mibII/vacm_context.h mibgroup/header_complex.h
+./agent_registry.lo: mibgroup/agentx/protocol.h mibgroup/agentx/client.h
+./agent_registry.lo: mibgroup/agentx/master_admin.h
+./agent_registry.lo: mibgroup/agentx/agentx_config.h
+./agent_registry.lo: ./mibgroup/agentx/subagent.h ./mibgroup/agentx/client.h
+./agent_trap.lo: ../include/net-snmp/net-snmp-config.h
+./agent_trap.lo: ../include/net-snmp/system/linux.h
+./agent_trap.lo: ../include/net-snmp/system/sysv.h
+./agent_trap.lo: ../include/net-snmp/system/generic.h
+./agent_trap.lo: ../include/net-snmp/machine/generic.h 
+./agent_trap.lo: ../include/net-snmp/utilities.h ../include/net-snmp/types.h
+./agent_trap.lo: ../include/net-snmp/definitions.h
+./agent_trap.lo: ../include/net-snmp/library/snmp_api.h
+./agent_trap.lo: ../include/net-snmp/library/asn1.h
+./agent_trap.lo: ../include/net-snmp/library/snmp_impl.h
+./agent_trap.lo: ../include/net-snmp/library/snmp.h
+./agent_trap.lo: ../include/net-snmp/library/snmp-tc.h
+./agent_trap.lo: ../include/net-snmp/library/snmp_client.h
+./agent_trap.lo: ../include/net-snmp/library/getopt.h
+./agent_trap.lo: ../include/net-snmp/library/system.h
+./agent_trap.lo: ../include/net-snmp/library/tools.h
+./agent_trap.lo: ../include/net-snmp/library/int64.h
+./agent_trap.lo: ../include/net-snmp/library/mt_support.h
+./agent_trap.lo: ../include/net-snmp/library/snmp_alarm.h
+./agent_trap.lo: ../include/net-snmp/library/data_list.h
+./agent_trap.lo: ../include/net-snmp/library/callback.h
+./agent_trap.lo: ../include/net-snmp/library/oid_stash.h
+./agent_trap.lo: ../include/net-snmp/library/check_varbind.h
+./agent_trap.lo: ../include/net-snmp/version.h
+./agent_trap.lo: ../include/net-snmp/net-snmp-includes.h
+./agent_trap.lo: ../include/net-snmp/session_api.h
+./agent_trap.lo: ../include/net-snmp/library/snmp_transport.h
+./agent_trap.lo: ../include/net-snmp/library/snmpCallbackDomain.h
+./agent_trap.lo: ../include/net-snmp/library/snmpUnixDomain.h
+./agent_trap.lo: ../include/net-snmp/library/snmpUDPDomain.h
+./agent_trap.lo: ../include/net-snmp/library/snmpTCPDomain.h
+./agent_trap.lo: ../include/net-snmp/library/snmpUDPIPv6Domain.h
+./agent_trap.lo: ../include/net-snmp/library/snmpTCPIPv6Domain.h
+./agent_trap.lo: ../include/net-snmp/library/snmpIPXDomain.h
+./agent_trap.lo: ../include/net-snmp/library/ucd_compat.h
+./agent_trap.lo: ../include/net-snmp/pdu_api.h ../include/net-snmp/mib_api.h
+./agent_trap.lo: ../include/net-snmp/library/mib.h
+./agent_trap.lo: ../include/net-snmp/library/parse.h
+./agent_trap.lo: ../include/net-snmp/varbind_api.h
+./agent_trap.lo: ../include/net-snmp/config_api.h
+./agent_trap.lo: ../include/net-snmp/library/read_config.h
+./agent_trap.lo: ../include/net-snmp/library/default_store.h
+./agent_trap.lo: ../include/net-snmp/library/snmp_parse_args.h
+./agent_trap.lo: ../include/net-snmp/library/snmp_enum.h
+./agent_trap.lo: ../include/net-snmp/library/vacm.h
+./agent_trap.lo: ../include/net-snmp/output_api.h
+./agent_trap.lo: ../include/net-snmp/library/snmp_debug.h
+./agent_trap.lo: ../include/net-snmp/library/snmp_logging.h
+./agent_trap.lo: ../include/net-snmp/snmpv3_api.h
+./agent_trap.lo: ../include/net-snmp/library/snmpv3.h
+./agent_trap.lo: ../include/net-snmp/library/transform_oids.h
+./agent_trap.lo: ../include/net-snmp/library/keytools.h
+./agent_trap.lo: ../include/net-snmp/library/scapi.h
+./agent_trap.lo: ../include/net-snmp/library/lcd_time.h
+./agent_trap.lo: ../include/net-snmp/library/snmp_secmod.h
+./agent_trap.lo: ../include/net-snmp/library/snmpv3-security-includes.h
+./agent_trap.lo: ../include/net-snmp/library/snmpusm.h
+./agent_trap.lo: ../include/net-snmp/agent/agent_trap.h
+./agent_trap.lo: ../include/net-snmp/agent/snmp_agent.h
+./agent_trap.lo: ../include/net-snmp/agent/agent_callbacks.h
+./agent_trap.lo: ../include/net-snmp/agent/mib_module_config.h
+./auto_nlist.lo: ../include/net-snmp/net-snmp-config.h
+./auto_nlist.lo: ../include/net-snmp/system/linux.h
+./auto_nlist.lo: ../include/net-snmp/system/sysv.h
+./auto_nlist.lo: ../include/net-snmp/system/generic.h
+./auto_nlist.lo: ../include/net-snmp/machine/generic.h
+./kernel.lo: ../include/net-snmp/net-snmp-config.h
+./kernel.lo: ../include/net-snmp/system/linux.h
+./kernel.lo: ../include/net-snmp/system/sysv.h
+./kernel.lo: ../include/net-snmp/system/generic.h
+./kernel.lo: ../include/net-snmp/machine/generic.h
+./mib_modules.lo: ../include/net-snmp/agent/mib_module_config.h
+./mib_modules.lo: ../include/net-snmp/net-snmp-config.h
+./mib_modules.lo: ../include/net-snmp/system/linux.h
+./mib_modules.lo: ../include/net-snmp/system/sysv.h
+./mib_modules.lo: ../include/net-snmp/system/generic.h
+./mib_modules.lo: ../include/net-snmp/machine/generic.h 
+./mib_modules.lo: ../include/net-snmp/net-snmp-includes.h
+./mib_modules.lo: ../include/net-snmp/definitions.h
+./mib_modules.lo: ../include/net-snmp/types.h
+./mib_modules.lo: ../include/net-snmp/library/snmp_api.h
+./mib_modules.lo: ../include/net-snmp/library/asn1.h
+./mib_modules.lo: ../include/net-snmp/library/snmp_impl.h
+./mib_modules.lo: ../include/net-snmp/library/snmp.h
+./mib_modules.lo: ../include/net-snmp/library/snmp-tc.h
+./mib_modules.lo: ../include/net-snmp/utilities.h
+./mib_modules.lo: ../include/net-snmp/library/snmp_client.h
+./mib_modules.lo: ../include/net-snmp/library/getopt.h
+./mib_modules.lo: ../include/net-snmp/library/system.h
+./mib_modules.lo: ../include/net-snmp/library/tools.h
+./mib_modules.lo: ../include/net-snmp/library/int64.h
+./mib_modules.lo: ../include/net-snmp/library/mt_support.h
+./mib_modules.lo: ../include/net-snmp/library/snmp_alarm.h
+./mib_modules.lo: ../include/net-snmp/library/data_list.h
+./mib_modules.lo: ../include/net-snmp/library/callback.h
+./mib_modules.lo: ../include/net-snmp/library/oid_stash.h
+./mib_modules.lo: ../include/net-snmp/library/check_varbind.h
+./mib_modules.lo: ../include/net-snmp/version.h
+./mib_modules.lo: ../include/net-snmp/session_api.h
+./mib_modules.lo: ../include/net-snmp/library/snmp_transport.h
+./mib_modules.lo: ../include/net-snmp/library/snmpCallbackDomain.h
+./mib_modules.lo: ../include/net-snmp/library/snmpUnixDomain.h
+./mib_modules.lo: ../include/net-snmp/library/snmpUDPDomain.h
+./mib_modules.lo: ../include/net-snmp/library/snmpTCPDomain.h
+./mib_modules.lo: ../include/net-snmp/library/snmpUDPIPv6Domain.h
+./mib_modules.lo: ../include/net-snmp/library/snmpTCPIPv6Domain.h
+./mib_modules.lo: ../include/net-snmp/library/snmpIPXDomain.h
+./mib_modules.lo: ../include/net-snmp/library/ucd_compat.h
+./mib_modules.lo: ../include/net-snmp/pdu_api.h ../include/net-snmp/mib_api.h
+./mib_modules.lo: ../include/net-snmp/library/mib.h
+./mib_modules.lo: ../include/net-snmp/library/parse.h
+./mib_modules.lo: ../include/net-snmp/varbind_api.h
+./mib_modules.lo: ../include/net-snmp/config_api.h
+./mib_modules.lo: ../include/net-snmp/library/read_config.h
+./mib_modules.lo: ../include/net-snmp/library/default_store.h
+./mib_modules.lo: ../include/net-snmp/library/snmp_parse_args.h
+./mib_modules.lo: ../include/net-snmp/library/snmp_enum.h
+./mib_modules.lo: ../include/net-snmp/library/vacm.h
+./mib_modules.lo: ../include/net-snmp/output_api.h
+./mib_modules.lo: ../include/net-snmp/library/snmp_debug.h
+./mib_modules.lo: ../include/net-snmp/library/snmp_logging.h
+./mib_modules.lo: ../include/net-snmp/snmpv3_api.h
+./mib_modules.lo: ../include/net-snmp/library/snmpv3.h
+./mib_modules.lo: ../include/net-snmp/library/transform_oids.h
+./mib_modules.lo: ../include/net-snmp/library/keytools.h
+./mib_modules.lo: ../include/net-snmp/library/scapi.h
+./mib_modules.lo: ../include/net-snmp/library/lcd_time.h
+./mib_modules.lo: ../include/net-snmp/library/snmp_secmod.h
+./mib_modules.lo: ../include/net-snmp/library/snmpv3-security-includes.h
+./mib_modules.lo: ../include/net-snmp/library/snmpusm.h
+./mib_modules.lo: ../include/net-snmp/agent/net-snmp-agent-includes.h
+./mib_modules.lo: ../include/net-snmp/agent/snmp_agent.h
+./mib_modules.lo: ../include/net-snmp/agent/snmp_vars.h
+./mib_modules.lo: ../include/net-snmp/agent/agent_handler.h
+./mib_modules.lo: ../include/net-snmp/agent/var_struct.h
+./mib_modules.lo: ../include/net-snmp/agent/agent_registry.h
+./mib_modules.lo: ../include/net-snmp/agent/ds_agent.h
+./mib_modules.lo: ../include/net-snmp/agent/agent_read_config.h
+./mib_modules.lo: ../include/net-snmp/agent/agent_trap.h
+./mib_modules.lo: ../include/net-snmp/agent/all_helpers.h
+./mib_modules.lo: ../include/net-snmp/agent/instance.h
+./mib_modules.lo: ../include/net-snmp/agent/multiplexer.h
+./mib_modules.lo: ../include/net-snmp/agent/null.h
+./mib_modules.lo: ../include/net-snmp/agent/debug_handler.h
+./mib_modules.lo: ../include/net-snmp/agent/old_api.h
+./mib_modules.lo: ../include/net-snmp/agent/read_only.h
+./mib_modules.lo: ../include/net-snmp/agent/serialize.h
+./mib_modules.lo: ../include/net-snmp/agent/bulk_to_next.h
+./mib_modules.lo: ../include/net-snmp/agent/mode_end_call.h
+./mib_modules.lo: ../include/net-snmp/agent/table.h
+./mib_modules.lo: ../include/net-snmp/agent/table_data.h
+./mib_modules.lo: ../include/net-snmp/agent/table_dataset.h
+./mib_modules.lo: ../include/net-snmp/agent/table_iterator.h m2m.h
+./mib_modules.lo: mibgroup/struct.h ../include/net-snmp/agent/mib_modules.h
+./mib_modules.lo: ./mibgroup/mib_module_includes.h mibgroup/mibII.h
+./mib_modules.lo: mibgroup/ucd_snmp.h mibgroup/snmpv3mibs.h
+./mib_modules.lo: mibgroup/notification.h mibgroup/target.h
+./mib_modules.lo: mibgroup/agent_mibs.h mibgroup/agentx.h
+./mib_modules.lo: mibgroup/utilities.h mibgroup/host.h mibgroup/examples.h
+./mib_modules.lo: mibgroup/examples/example.h mibgroup/testhandler.h
+./mib_modules.lo: mibgroup/smux.h mibgroup/Rmon.h mibgroup/disman/event-mib.h
+./mib_modules.lo: mibgroup/mibII/system_mib.h mibgroup/mibII/sysORTable.h
+./mib_modules.lo: mibgroup/mibII/at.h mibgroup/mibII/interfaces.h
+./mib_modules.lo: mibgroup/mibII/snmp_mib.h mibgroup/mibII/tcp.h
+./mib_modules.lo: mibgroup/mibII/icmp.h mibgroup/mibII/ip.h
+./mib_modules.lo: mibgroup/mibII/var_route.h mibgroup/mibII/route_write.h
+./mib_modules.lo: mibgroup/mibII/at.h mibgroup/mibII/udp.h
+./mib_modules.lo: mibgroup/mibII/vacm_vars.h mibgroup/mibII/setSerialNo.h
+./mib_modules.lo: mibgroup/ucd-snmp/memory.h ./mibgroup/mibdefs.h
+./mib_modules.lo: mibgroup/ucd-snmp/vmstat.h mibgroup/ucd-snmp/proc.h
+./mib_modules.lo: mibgroup/ucd-snmp/versioninfo.h mibgroup/ucd-snmp/pass.h
+./mib_modules.lo: mibgroup/ucd-snmp/pass_persist.h mibgroup/ucd-snmp/disk.h
+./mib_modules.lo: mibgroup/ucd-snmp/loadave.h mibgroup/ucd-snmp/extensible.h
+./mib_modules.lo: mibgroup/ucd-snmp/errormib.h mibgroup/ucd-snmp/file.h
+./mib_modules.lo: mibgroup/ucd-snmp/dlmod.h mibgroup/ucd-snmp/proxy.h
+./mib_modules.lo: mibgroup/snmpv3/snmpEngine.h mibgroup/snmpv3/snmpMPDStats.h
+./mib_modules.lo: mibgroup/snmpv3/usmStats.h mibgroup/snmpv3/usmUser.h
+./mib_modules.lo: mibgroup/notification/snmpNotifyTable.h
+./mib_modules.lo: mibgroup/notification/snmpNotifyFilterTable.h
+./mib_modules.lo: mibgroup/notification/snmpNotifyFilterProfileTable.h
+./mib_modules.lo: mibgroup/target/snmpTargetAddrEntry.h
+./mib_modules.lo: mibgroup/target/snmpTargetParamsEntry.h
+./mib_modules.lo: mibgroup/target/target.h mibgroup/target/target_counters.h
+./mib_modules.lo: mibgroup/agent/nsTransactionTable.h
+./mib_modules.lo: mibgroup/agent/nsModuleTable.h mibgroup/agentx/master.h
+./mib_modules.lo: mibgroup/agentx/subagent.h mibgroup/utilities/override.h
+./mib_modules.lo: mibgroup/host/hr_system.h mibgroup/host/hr_storage.h
+./mib_modules.lo: mibgroup/host/hr_device.h mibgroup/host/hr_other.h
+./mib_modules.lo: mibgroup/host/hr_proc.h mibgroup/host/hr_network.h
+./mib_modules.lo: mibgroup/host/hr_print.h mibgroup/host/hr_disk.h
+./mib_modules.lo: mibgroup/host/hr_partition.h mibgroup/host/hr_filesys.h
+./mib_modules.lo: mibgroup/host/hr_swrun.h mibgroup/host/hr_swinst.h
+./mib_modules.lo: mibgroup/examples/scalar_int.h mibgroup/examples/data_set.h
+./mib_modules.lo: mibgroup/examples/delayed_instance.h mibgroup/util_funcs.h
+./mib_modules.lo: mibgroup/struct.h mibgroup/smux/smux.h mibgroup/Rmon/rows.h
+./mib_modules.lo: mibgroup/Rmon/agutil.h mibgroup/Rmon/statistics.h
+./mib_modules.lo: mibgroup/Rmon/alarm.h mibgroup/Rmon/history.h
+./mib_modules.lo: mibgroup/Rmon/event.h mibgroup/disman/mteTriggerTable.h
+./mib_modules.lo: mibgroup/disman/mteTriggerDeltaTable.h
+./mib_modules.lo: mibgroup/disman/mteTriggerExistenceTable.h
+./mib_modules.lo: mibgroup/disman/mteTriggerBooleanTable.h
+./mib_modules.lo: mibgroup/disman/mteTriggerThresholdTable.h
+./mib_modules.lo: mibgroup/disman/mteObjectsTable.h
+./mib_modules.lo: mibgroup/disman/mteEventTable.h
+./mib_modules.lo: mibgroup/disman/mteEventNotificationTable.h
+./mib_modules.lo: mibgroup/mibII/kernel_linux.h mibgroup/mibII/tcpTable.h
+./mib_modules.lo: mibgroup/mibII/ipAddr.h mibgroup/mibII/var_route.h
+./mib_modules.lo: mibgroup/mibII/route_write.h mibgroup/mibII/udpTable.h
+./mib_modules.lo: mibgroup/mibII/vacm_context.h mibgroup/header_complex.h
+./mib_modules.lo: mibgroup/agentx/protocol.h mibgroup/agentx/client.h
+./mib_modules.lo: mibgroup/agentx/master_admin.h
+./mib_modules.lo: mibgroup/agentx/agentx_config.h
+./mib_modules.lo: ./mibgroup/mib_module_inits.h
+./object_monitor.lo: ../include/net-snmp/net-snmp-config.h
+./object_monitor.lo: ../include/net-snmp/system/linux.h
+./object_monitor.lo: ../include/net-snmp/system/sysv.h
+./object_monitor.lo: ../include/net-snmp/system/generic.h
+./object_monitor.lo: ../include/net-snmp/machine/generic.h
+./object_monitor.lo: ../include/net-snmp/net-snmp-includes.h
+./object_monitor.lo: ../include/net-snmp/definitions.h
+./object_monitor.lo: ../include/net-snmp/types.h
+./object_monitor.lo: ../include/net-snmp/library/snmp_api.h
+./object_monitor.lo: ../include/net-snmp/library/asn1.h
+./object_monitor.lo: ../include/net-snmp/library/snmp_impl.h
+./object_monitor.lo: ../include/net-snmp/library/snmp.h
+./object_monitor.lo: ../include/net-snmp/library/snmp-tc.h
+./object_monitor.lo: ../include/net-snmp/utilities.h
+./object_monitor.lo: ../include/net-snmp/library/snmp_client.h
+./object_monitor.lo: ../include/net-snmp/library/getopt.h
+./object_monitor.lo: ../include/net-snmp/library/system.h
+./object_monitor.lo: ../include/net-snmp/library/tools.h
+./object_monitor.lo: ../include/net-snmp/library/int64.h
+./object_monitor.lo: ../include/net-snmp/library/mt_support.h
+./object_monitor.lo: ../include/net-snmp/library/snmp_alarm.h
+./object_monitor.lo: ../include/net-snmp/library/data_list.h
+./object_monitor.lo: ../include/net-snmp/library/callback.h
+./object_monitor.lo: ../include/net-snmp/library/oid_stash.h
+./object_monitor.lo: ../include/net-snmp/library/check_varbind.h
+./object_monitor.lo: ../include/net-snmp/version.h
+./object_monitor.lo: ../include/net-snmp/session_api.h
+./object_monitor.lo: ../include/net-snmp/library/snmp_transport.h
+./object_monitor.lo: ../include/net-snmp/library/snmpCallbackDomain.h
+./object_monitor.lo: ../include/net-snmp/library/snmpUnixDomain.h
+./object_monitor.lo: ../include/net-snmp/library/snmpUDPDomain.h
+./object_monitor.lo: ../include/net-snmp/library/snmpTCPDomain.h
+./object_monitor.lo: ../include/net-snmp/library/snmpUDPIPv6Domain.h
+./object_monitor.lo: ../include/net-snmp/library/snmpTCPIPv6Domain.h
+./object_monitor.lo: ../include/net-snmp/library/snmpIPXDomain.h
+./object_monitor.lo: ../include/net-snmp/library/ucd_compat.h
+./object_monitor.lo: ../include/net-snmp/pdu_api.h
+./object_monitor.lo: ../include/net-snmp/mib_api.h
+./object_monitor.lo: ../include/net-snmp/library/mib.h
+./object_monitor.lo: ../include/net-snmp/library/parse.h
+./object_monitor.lo: ../include/net-snmp/varbind_api.h
+./object_monitor.lo: ../include/net-snmp/config_api.h
+./object_monitor.lo: ../include/net-snmp/library/read_config.h
+./object_monitor.lo: ../include/net-snmp/library/default_store.h
+./object_monitor.lo: ../include/net-snmp/library/snmp_parse_args.h
+./object_monitor.lo: ../include/net-snmp/library/snmp_enum.h
+./object_monitor.lo: ../include/net-snmp/library/vacm.h
+./object_monitor.lo: ../include/net-snmp/output_api.h
+./object_monitor.lo: ../include/net-snmp/library/snmp_debug.h
+./object_monitor.lo: ../include/net-snmp/library/snmp_logging.h
+./object_monitor.lo: ../include/net-snmp/snmpv3_api.h
+./object_monitor.lo: ../include/net-snmp/library/snmpv3.h
+./object_monitor.lo: ../include/net-snmp/library/transform_oids.h
+./object_monitor.lo: ../include/net-snmp/library/keytools.h
+./object_monitor.lo: ../include/net-snmp/library/scapi.h
+./object_monitor.lo: ../include/net-snmp/library/lcd_time.h
+./object_monitor.lo: ../include/net-snmp/library/snmp_secmod.h
+./object_monitor.lo: ../include/net-snmp/library/snmpv3-security-includes.h
+./object_monitor.lo: ../include/net-snmp/library/snmpusm.h
+./object_monitor.lo: ../include/net-snmp/agent/net-snmp-agent-includes.h
+./object_monitor.lo: ../include/net-snmp/agent/snmp_agent.h
+./object_monitor.lo: ../include/net-snmp/agent/snmp_vars.h
+./object_monitor.lo: ../include/net-snmp/agent/agent_handler.h
+./object_monitor.lo: ../include/net-snmp/agent/var_struct.h
+./object_monitor.lo: ../include/net-snmp/agent/agent_registry.h
+./object_monitor.lo: ../include/net-snmp/agent/ds_agent.h
+./object_monitor.lo: ../include/net-snmp/agent/agent_read_config.h
+./object_monitor.lo: ../include/net-snmp/agent/agent_trap.h
+./object_monitor.lo: ../include/net-snmp/agent/all_helpers.h
+./object_monitor.lo: ../include/net-snmp/agent/instance.h
+./object_monitor.lo: ../include/net-snmp/agent/multiplexer.h
+./object_monitor.lo: ../include/net-snmp/agent/null.h
+./object_monitor.lo: ../include/net-snmp/agent/debug_handler.h
+./object_monitor.lo: ../include/net-snmp/agent/old_api.h
+./object_monitor.lo: ../include/net-snmp/agent/read_only.h
+./object_monitor.lo: ../include/net-snmp/agent/serialize.h
+./object_monitor.lo: ../include/net-snmp/agent/bulk_to_next.h
+./object_monitor.lo: ../include/net-snmp/agent/mode_end_call.h
+./object_monitor.lo: ../include/net-snmp/agent/table.h
+./object_monitor.lo: ../include/net-snmp/agent/table_data.h
+./object_monitor.lo: ../include/net-snmp/agent/table_dataset.h
+./object_monitor.lo: ../include/net-snmp/agent/table_iterator.h
+./object_monitor.lo: ../include/net-snmp/agent/mib_module_config.h
+./object_monitor.lo: ../include/net-snmp/library/container.h
+./object_monitor.lo: ../include/net-snmp/library/factory.h
+./object_monitor.lo: ../include/net-snmp/library/snmp_assert.h
+./object_monitor.lo: ../include/net-snmp/agent/object_monitor.h
+./snmp_agent.lo: ../include/net-snmp/net-snmp-config.h
+./snmp_agent.lo: ../include/net-snmp/system/linux.h
+./snmp_agent.lo: ../include/net-snmp/system/sysv.h
+./snmp_agent.lo: ../include/net-snmp/system/generic.h
+./snmp_agent.lo: ../include/net-snmp/machine/generic.h
+./snmp_agent.lo: ../include/net-snmp/net-snmp-includes.h 
+./snmp_agent.lo: ../include/net-snmp/definitions.h
+./snmp_agent.lo: ../include/net-snmp/types.h
+./snmp_agent.lo: ../include/net-snmp/library/snmp_api.h
+./snmp_agent.lo: ../include/net-snmp/library/asn1.h
+./snmp_agent.lo: ../include/net-snmp/library/snmp_impl.h
+./snmp_agent.lo: ../include/net-snmp/library/snmp.h
+./snmp_agent.lo: ../include/net-snmp/library/snmp-tc.h
+./snmp_agent.lo: ../include/net-snmp/utilities.h
+./snmp_agent.lo: ../include/net-snmp/library/snmp_client.h
+./snmp_agent.lo: ../include/net-snmp/library/getopt.h
+./snmp_agent.lo: ../include/net-snmp/library/system.h
+./snmp_agent.lo: ../include/net-snmp/library/tools.h
+./snmp_agent.lo: ../include/net-snmp/library/int64.h
+./snmp_agent.lo: ../include/net-snmp/library/mt_support.h
+./snmp_agent.lo: ../include/net-snmp/library/snmp_alarm.h
+./snmp_agent.lo: ../include/net-snmp/library/data_list.h
+./snmp_agent.lo: ../include/net-snmp/library/callback.h
+./snmp_agent.lo: ../include/net-snmp/library/oid_stash.h
+./snmp_agent.lo: ../include/net-snmp/library/check_varbind.h
+./snmp_agent.lo: ../include/net-snmp/version.h
+./snmp_agent.lo: ../include/net-snmp/session_api.h
+./snmp_agent.lo: ../include/net-snmp/library/snmp_transport.h
+./snmp_agent.lo: ../include/net-snmp/library/snmpCallbackDomain.h
+./snmp_agent.lo: ../include/net-snmp/library/snmpUnixDomain.h
+./snmp_agent.lo: ../include/net-snmp/library/snmpUDPDomain.h
+./snmp_agent.lo: ../include/net-snmp/library/snmpTCPDomain.h
+./snmp_agent.lo: ../include/net-snmp/library/snmpUDPIPv6Domain.h
+./snmp_agent.lo: ../include/net-snmp/library/snmpTCPIPv6Domain.h
+./snmp_agent.lo: ../include/net-snmp/library/snmpIPXDomain.h
+./snmp_agent.lo: ../include/net-snmp/library/ucd_compat.h
+./snmp_agent.lo: ../include/net-snmp/pdu_api.h ../include/net-snmp/mib_api.h
+./snmp_agent.lo: ../include/net-snmp/library/mib.h
+./snmp_agent.lo: ../include/net-snmp/library/parse.h
+./snmp_agent.lo: ../include/net-snmp/varbind_api.h
+./snmp_agent.lo: ../include/net-snmp/config_api.h
+./snmp_agent.lo: ../include/net-snmp/library/read_config.h
+./snmp_agent.lo: ../include/net-snmp/library/default_store.h
+./snmp_agent.lo: ../include/net-snmp/library/snmp_parse_args.h
+./snmp_agent.lo: ../include/net-snmp/library/snmp_enum.h
+./snmp_agent.lo: ../include/net-snmp/library/vacm.h
+./snmp_agent.lo: ../include/net-snmp/output_api.h
+./snmp_agent.lo: ../include/net-snmp/library/snmp_debug.h
+./snmp_agent.lo: ../include/net-snmp/library/snmp_logging.h
+./snmp_agent.lo: ../include/net-snmp/snmpv3_api.h
+./snmp_agent.lo: ../include/net-snmp/library/snmpv3.h
+./snmp_agent.lo: ../include/net-snmp/library/transform_oids.h
+./snmp_agent.lo: ../include/net-snmp/library/keytools.h
+./snmp_agent.lo: ../include/net-snmp/library/scapi.h
+./snmp_agent.lo: ../include/net-snmp/library/lcd_time.h
+./snmp_agent.lo: ../include/net-snmp/library/snmp_secmod.h
+./snmp_agent.lo: ../include/net-snmp/library/snmpv3-security-includes.h
+./snmp_agent.lo: ../include/net-snmp/library/snmpusm.h
+./snmp_agent.lo: ../include/net-snmp/agent/net-snmp-agent-includes.h
+./snmp_agent.lo: ../include/net-snmp/agent/snmp_agent.h
+./snmp_agent.lo: ../include/net-snmp/agent/snmp_vars.h
+./snmp_agent.lo: ../include/net-snmp/agent/agent_handler.h
+./snmp_agent.lo: ../include/net-snmp/agent/var_struct.h
+./snmp_agent.lo: ../include/net-snmp/agent/agent_registry.h
+./snmp_agent.lo: ../include/net-snmp/agent/ds_agent.h
+./snmp_agent.lo: ../include/net-snmp/agent/agent_read_config.h
+./snmp_agent.lo: ../include/net-snmp/agent/agent_trap.h
+./snmp_agent.lo: ../include/net-snmp/agent/all_helpers.h
+./snmp_agent.lo: ../include/net-snmp/agent/instance.h
+./snmp_agent.lo: ../include/net-snmp/agent/multiplexer.h
+./snmp_agent.lo: ../include/net-snmp/agent/null.h
+./snmp_agent.lo: ../include/net-snmp/agent/debug_handler.h
+./snmp_agent.lo: ../include/net-snmp/agent/old_api.h
+./snmp_agent.lo: ../include/net-snmp/agent/read_only.h
+./snmp_agent.lo: ../include/net-snmp/agent/serialize.h
+./snmp_agent.lo: ../include/net-snmp/agent/bulk_to_next.h
+./snmp_agent.lo: ../include/net-snmp/agent/mode_end_call.h
+./snmp_agent.lo: ../include/net-snmp/agent/table.h
+./snmp_agent.lo: ../include/net-snmp/agent/table_data.h
+./snmp_agent.lo: ../include/net-snmp/agent/table_dataset.h
+./snmp_agent.lo: ../include/net-snmp/agent/table_iterator.h
+./snmp_agent.lo: ../include/net-snmp/agent/mib_module_config.h
+./snmp_agent.lo: ../include/net-snmp/library/snmp_assert.h snmpd.h
+./snmp_agent.lo: mibgroup/struct.h mibgroup/util_funcs.h mibgroup/struct.h
+./snmp_agent.lo: ./mibgroup/agentx/protocol.h ./mibgroup/agentx/master.h
+./snmpd.lo: ../include/net-snmp/net-snmp-config.h
+./snmpd.lo: ../include/net-snmp/system/linux.h
+./snmpd.lo: ../include/net-snmp/system/sysv.h
+./snmpd.lo: ../include/net-snmp/system/generic.h
+./snmpd.lo: ../include/net-snmp/machine/generic.h 
+./snmpd.lo: ../include/net-snmp/net-snmp-includes.h
+./snmpd.lo: ../include/net-snmp/definitions.h ../include/net-snmp/types.h
+./snmpd.lo: ../include/net-snmp/library/snmp_api.h
+./snmpd.lo: ../include/net-snmp/library/asn1.h
+./snmpd.lo: ../include/net-snmp/library/snmp_impl.h
+./snmpd.lo: ../include/net-snmp/library/snmp.h
+./snmpd.lo: ../include/net-snmp/library/snmp-tc.h
+./snmpd.lo: ../include/net-snmp/utilities.h
+./snmpd.lo: ../include/net-snmp/library/snmp_client.h
+./snmpd.lo: ../include/net-snmp/library/getopt.h
+./snmpd.lo: ../include/net-snmp/library/system.h
+./snmpd.lo: ../include/net-snmp/library/tools.h
+./snmpd.lo: ../include/net-snmp/library/int64.h
+./snmpd.lo: ../include/net-snmp/library/mt_support.h
+./snmpd.lo: ../include/net-snmp/library/snmp_alarm.h
+./snmpd.lo: ../include/net-snmp/library/data_list.h
+./snmpd.lo: ../include/net-snmp/library/callback.h
+./snmpd.lo: ../include/net-snmp/library/oid_stash.h
+./snmpd.lo: ../include/net-snmp/library/check_varbind.h
+./snmpd.lo: ../include/net-snmp/version.h ../include/net-snmp/session_api.h
+./snmpd.lo: ../include/net-snmp/library/snmp_transport.h
+./snmpd.lo: ../include/net-snmp/library/snmpCallbackDomain.h
+./snmpd.lo: ../include/net-snmp/library/snmpUnixDomain.h
+./snmpd.lo:  ../include/net-snmp/library/snmpUDPDomain.h
+./snmpd.lo: ../include/net-snmp/library/snmpTCPDomain.h
+./snmpd.lo: ../include/net-snmp/library/snmpUDPIPv6Domain.h
+./snmpd.lo: ../include/net-snmp/library/snmpTCPIPv6Domain.h
+./snmpd.lo: ../include/net-snmp/library/snmpIPXDomain.h
+./snmpd.lo: ../include/net-snmp/library/ucd_compat.h
+./snmpd.lo: ../include/net-snmp/pdu_api.h ../include/net-snmp/mib_api.h
+./snmpd.lo: ../include/net-snmp/library/mib.h
+./snmpd.lo: ../include/net-snmp/library/parse.h
+./snmpd.lo: ../include/net-snmp/varbind_api.h
+./snmpd.lo: ../include/net-snmp/config_api.h
+./snmpd.lo: ../include/net-snmp/library/read_config.h
+./snmpd.lo: ../include/net-snmp/library/default_store.h
+./snmpd.lo: ../include/net-snmp/library/snmp_parse_args.h
+./snmpd.lo: ../include/net-snmp/library/snmp_enum.h
+./snmpd.lo: ../include/net-snmp/library/vacm.h
+./snmpd.lo: ../include/net-snmp/output_api.h
+./snmpd.lo: ../include/net-snmp/library/snmp_debug.h
+./snmpd.lo: ../include/net-snmp/library/snmp_logging.h 
+./snmpd.lo:  ../include/net-snmp/snmpv3_api.h
+./snmpd.lo: ../include/net-snmp/library/snmpv3.h
+./snmpd.lo: ../include/net-snmp/library/transform_oids.h
+./snmpd.lo: ../include/net-snmp/library/keytools.h
+./snmpd.lo: ../include/net-snmp/library/scapi.h
+./snmpd.lo: ../include/net-snmp/library/lcd_time.h
+./snmpd.lo: ../include/net-snmp/library/snmp_secmod.h
+./snmpd.lo: ../include/net-snmp/library/snmpv3-security-includes.h
+./snmpd.lo: ../include/net-snmp/library/snmpusm.h
+./snmpd.lo: ../include/net-snmp/agent/net-snmp-agent-includes.h
+./snmpd.lo: ../include/net-snmp/agent/snmp_agent.h
+./snmpd.lo: ../include/net-snmp/agent/snmp_vars.h
+./snmpd.lo: ../include/net-snmp/agent/agent_handler.h
+./snmpd.lo: ../include/net-snmp/agent/var_struct.h
+./snmpd.lo: ../include/net-snmp/agent/agent_registry.h
+./snmpd.lo: ../include/net-snmp/agent/ds_agent.h
+./snmpd.lo: ../include/net-snmp/agent/agent_read_config.h
+./snmpd.lo: ../include/net-snmp/agent/agent_trap.h
+./snmpd.lo: ../include/net-snmp/agent/all_helpers.h
+./snmpd.lo: ../include/net-snmp/agent/instance.h
+./snmpd.lo: ../include/net-snmp/agent/multiplexer.h
+./snmpd.lo: ../include/net-snmp/agent/null.h
+./snmpd.lo: ../include/net-snmp/agent/debug_handler.h
+./snmpd.lo: ../include/net-snmp/agent/old_api.h
+./snmpd.lo: ../include/net-snmp/agent/read_only.h
+./snmpd.lo: ../include/net-snmp/agent/serialize.h
+./snmpd.lo: ../include/net-snmp/agent/bulk_to_next.h
+./snmpd.lo: ../include/net-snmp/agent/mode_end_call.h
+./snmpd.lo: ../include/net-snmp/agent/table.h
+./snmpd.lo: ../include/net-snmp/agent/table_data.h
+./snmpd.lo: ../include/net-snmp/agent/table_dataset.h
+./snmpd.lo: ../include/net-snmp/agent/table_iterator.h
+./snmpd.lo: ../include/net-snmp/agent/mib_module_config.h m2m.h snmpd.h
+./snmpd.lo: mibgroup/struct.h ../include/net-snmp/agent/mib_modules.h
+./snmpd.lo: mibgroup/util_funcs.h mibgroup/struct.h
+./snmpd.lo: ./mibgroup/mib_module_includes.h mibgroup/mibII.h
+./snmpd.lo: mibgroup/ucd_snmp.h mibgroup/snmpv3mibs.h mibgroup/notification.h
+./snmpd.lo: mibgroup/target.h mibgroup/agent_mibs.h mibgroup/agentx.h
+./snmpd.lo: mibgroup/utilities.h mibgroup/host.h mibgroup/examples.h
+./snmpd.lo: mibgroup/examples/example.h mibgroup/testhandler.h
+./snmpd.lo: mibgroup/smux.h mibgroup/Rmon.h mibgroup/disman/event-mib.h
+./snmpd.lo: mibgroup/mibII/system_mib.h mibgroup/mibII/sysORTable.h
+./snmpd.lo: mibgroup/mibII/at.h mibgroup/mibII/interfaces.h
+./snmpd.lo: mibgroup/mibII/snmp_mib.h mibgroup/mibII/tcp.h
+./snmpd.lo: mibgroup/mibII/icmp.h mibgroup/mibII/ip.h
+./snmpd.lo: mibgroup/mibII/var_route.h mibgroup/mibII/route_write.h
+./snmpd.lo: mibgroup/mibII/at.h mibgroup/mibII/udp.h
+./snmpd.lo: mibgroup/mibII/vacm_vars.h mibgroup/mibII/setSerialNo.h
+./snmpd.lo: mibgroup/ucd-snmp/memory.h ./mibgroup/mibdefs.h
+./snmpd.lo: mibgroup/ucd-snmp/vmstat.h mibgroup/ucd-snmp/proc.h
+./snmpd.lo: mibgroup/ucd-snmp/versioninfo.h mibgroup/ucd-snmp/pass.h
+./snmpd.lo: mibgroup/ucd-snmp/pass_persist.h mibgroup/ucd-snmp/disk.h
+./snmpd.lo: mibgroup/ucd-snmp/loadave.h mibgroup/ucd-snmp/extensible.h
+./snmpd.lo: mibgroup/ucd-snmp/errormib.h mibgroup/ucd-snmp/file.h
+./snmpd.lo: mibgroup/ucd-snmp/dlmod.h mibgroup/ucd-snmp/proxy.h
+./snmpd.lo: mibgroup/snmpv3/snmpEngine.h mibgroup/snmpv3/snmpMPDStats.h
+./snmpd.lo: mibgroup/snmpv3/usmStats.h mibgroup/snmpv3/usmUser.h
+./snmpd.lo: mibgroup/notification/snmpNotifyTable.h
+./snmpd.lo: mibgroup/notification/snmpNotifyFilterTable.h
+./snmpd.lo: mibgroup/notification/snmpNotifyFilterProfileTable.h
+./snmpd.lo: mibgroup/target/snmpTargetAddrEntry.h
+./snmpd.lo: mibgroup/target/snmpTargetParamsEntry.h mibgroup/target/target.h
+./snmpd.lo: mibgroup/target/target_counters.h
+./snmpd.lo: mibgroup/agent/nsTransactionTable.h
+./snmpd.lo: mibgroup/agent/nsModuleTable.h mibgroup/agentx/master.h
+./snmpd.lo: mibgroup/agentx/subagent.h mibgroup/utilities/override.h
+./snmpd.lo: mibgroup/host/hr_system.h mibgroup/host/hr_storage.h
+./snmpd.lo: mibgroup/host/hr_device.h mibgroup/host/hr_other.h
+./snmpd.lo: mibgroup/host/hr_proc.h mibgroup/host/hr_network.h
+./snmpd.lo: mibgroup/host/hr_print.h mibgroup/host/hr_disk.h
+./snmpd.lo: mibgroup/host/hr_partition.h mibgroup/host/hr_filesys.h
+./snmpd.lo: mibgroup/host/hr_swrun.h mibgroup/host/hr_swinst.h
+./snmpd.lo: mibgroup/examples/scalar_int.h mibgroup/examples/data_set.h
+./snmpd.lo: mibgroup/examples/delayed_instance.h mibgroup/smux/smux.h
+./snmpd.lo: mibgroup/Rmon/rows.h mibgroup/Rmon/agutil.h
+./snmpd.lo: mibgroup/Rmon/statistics.h mibgroup/Rmon/alarm.h
+./snmpd.lo: mibgroup/Rmon/history.h mibgroup/Rmon/event.h
+./snmpd.lo: mibgroup/disman/mteTriggerTable.h
+./snmpd.lo: mibgroup/disman/mteTriggerDeltaTable.h
+./snmpd.lo: mibgroup/disman/mteTriggerExistenceTable.h
+./snmpd.lo: mibgroup/disman/mteTriggerBooleanTable.h
+./snmpd.lo: mibgroup/disman/mteTriggerThresholdTable.h
+./snmpd.lo: mibgroup/disman/mteObjectsTable.h mibgroup/disman/mteEventTable.h
+./snmpd.lo: mibgroup/disman/mteEventNotificationTable.h
+./snmpd.lo: mibgroup/mibII/kernel_linux.h mibgroup/mibII/tcpTable.h
+./snmpd.lo: mibgroup/mibII/ipAddr.h mibgroup/mibII/var_route.h
+./snmpd.lo: mibgroup/mibII/route_write.h mibgroup/mibII/udpTable.h
+./snmpd.lo: mibgroup/mibII/vacm_context.h mibgroup/header_complex.h
+./snmpd.lo: mibgroup/agentx/protocol.h mibgroup/agentx/client.h
+./snmpd.lo: mibgroup/agentx/master_admin.h mibgroup/agentx/agentx_config.h
+./snmpd.lo: ./mibgroup/mib_module_shutdown.h
+./snmp_perl.lo: ../include/net-snmp/net-snmp-config.h
+./snmp_perl.lo: ../include/net-snmp/system/linux.h
+./snmp_perl.lo: ../include/net-snmp/system/sysv.h
+./snmp_perl.lo: ../include/net-snmp/system/generic.h
+./snmp_perl.lo: ../include/net-snmp/machine/generic.h
+./snmp_perl.lo: ../include/net-snmp/net-snmp-includes.h
+./snmp_perl.lo: ../include/net-snmp/definitions.h ../include/net-snmp/types.h
+./snmp_perl.lo: ../include/net-snmp/library/snmp_api.h
+./snmp_perl.lo: ../include/net-snmp/library/asn1.h
+./snmp_perl.lo: ../include/net-snmp/library/snmp_impl.h
+./snmp_perl.lo: ../include/net-snmp/library/snmp.h
+./snmp_perl.lo: ../include/net-snmp/library/snmp-tc.h
+./snmp_perl.lo: ../include/net-snmp/utilities.h
+./snmp_perl.lo: ../include/net-snmp/library/snmp_client.h
+./snmp_perl.lo: ../include/net-snmp/library/getopt.h
+./snmp_perl.lo: ../include/net-snmp/library/system.h
+./snmp_perl.lo: ../include/net-snmp/library/tools.h
+./snmp_perl.lo: ../include/net-snmp/library/int64.h
+./snmp_perl.lo: ../include/net-snmp/library/mt_support.h
+./snmp_perl.lo: ../include/net-snmp/library/snmp_alarm.h
+./snmp_perl.lo: ../include/net-snmp/library/data_list.h
+./snmp_perl.lo: ../include/net-snmp/library/callback.h
+./snmp_perl.lo: ../include/net-snmp/library/oid_stash.h
+./snmp_perl.lo: ../include/net-snmp/library/check_varbind.h
+./snmp_perl.lo: ../include/net-snmp/version.h
+./snmp_perl.lo: ../include/net-snmp/session_api.h
+./snmp_perl.lo: ../include/net-snmp/library/snmp_transport.h
+./snmp_perl.lo: ../include/net-snmp/library/snmpCallbackDomain.h
+./snmp_perl.lo: ../include/net-snmp/library/snmpUnixDomain.h
+./snmp_perl.lo: ../include/net-snmp/library/snmpUDPDomain.h
+./snmp_perl.lo: ../include/net-snmp/library/snmpTCPDomain.h
+./snmp_perl.lo: ../include/net-snmp/library/snmpUDPIPv6Domain.h
+./snmp_perl.lo: ../include/net-snmp/library/snmpTCPIPv6Domain.h
+./snmp_perl.lo: ../include/net-snmp/library/snmpIPXDomain.h
+./snmp_perl.lo: ../include/net-snmp/library/ucd_compat.h
+./snmp_perl.lo: ../include/net-snmp/pdu_api.h ../include/net-snmp/mib_api.h
+./snmp_perl.lo: ../include/net-snmp/library/mib.h
+./snmp_perl.lo: ../include/net-snmp/library/parse.h
+./snmp_perl.lo: ../include/net-snmp/varbind_api.h
+./snmp_perl.lo: ../include/net-snmp/config_api.h
+./snmp_perl.lo: ../include/net-snmp/library/read_config.h
+./snmp_perl.lo: ../include/net-snmp/library/default_store.h
+./snmp_perl.lo: ../include/net-snmp/library/snmp_parse_args.h
+./snmp_perl.lo: ../include/net-snmp/library/snmp_enum.h
+./snmp_perl.lo: ../include/net-snmp/library/vacm.h
+./snmp_perl.lo: ../include/net-snmp/output_api.h
+./snmp_perl.lo: ../include/net-snmp/library/snmp_debug.h
+./snmp_perl.lo: ../include/net-snmp/library/snmp_logging.h
+./snmp_perl.lo: ../include/net-snmp/snmpv3_api.h
+./snmp_perl.lo: ../include/net-snmp/library/snmpv3.h
+./snmp_perl.lo: ../include/net-snmp/library/transform_oids.h
+./snmp_perl.lo: ../include/net-snmp/library/keytools.h
+./snmp_perl.lo: ../include/net-snmp/library/scapi.h
+./snmp_perl.lo: ../include/net-snmp/library/lcd_time.h
+./snmp_perl.lo: ../include/net-snmp/library/snmp_secmod.h
+./snmp_perl.lo: ../include/net-snmp/library/snmpv3-security-includes.h
+./snmp_perl.lo: ../include/net-snmp/library/snmpusm.h
+./snmp_perl.lo: ../include/net-snmp/agent/net-snmp-agent-includes.h
+./snmp_perl.lo: ../include/net-snmp/agent/snmp_agent.h
+./snmp_perl.lo: ../include/net-snmp/agent/snmp_vars.h
+./snmp_perl.lo: ../include/net-snmp/agent/agent_handler.h
+./snmp_perl.lo: ../include/net-snmp/agent/var_struct.h
+./snmp_perl.lo: ../include/net-snmp/agent/agent_registry.h
+./snmp_perl.lo: ../include/net-snmp/agent/ds_agent.h
+./snmp_perl.lo: ../include/net-snmp/agent/agent_read_config.h
+./snmp_perl.lo: ../include/net-snmp/agent/agent_trap.h
+./snmp_perl.lo: ../include/net-snmp/agent/all_helpers.h
+./snmp_perl.lo: ../include/net-snmp/agent/instance.h
+./snmp_perl.lo: ../include/net-snmp/agent/multiplexer.h
+./snmp_perl.lo: ../include/net-snmp/agent/null.h
+./snmp_perl.lo: ../include/net-snmp/agent/debug_handler.h
+./snmp_perl.lo: ../include/net-snmp/agent/old_api.h
+./snmp_perl.lo: ../include/net-snmp/agent/read_only.h
+./snmp_perl.lo: ../include/net-snmp/agent/serialize.h
+./snmp_perl.lo: ../include/net-snmp/agent/bulk_to_next.h
+./snmp_perl.lo: ../include/net-snmp/agent/mode_end_call.h
+./snmp_perl.lo: ../include/net-snmp/agent/table.h
+./snmp_perl.lo: ../include/net-snmp/agent/table_data.h
+./snmp_perl.lo: ../include/net-snmp/agent/table_dataset.h
+./snmp_perl.lo: ../include/net-snmp/agent/table_iterator.h
+./snmp_perl.lo: ../include/net-snmp/agent/mib_module_config.h
+./snmp_vars.lo: ../include/net-snmp/net-snmp-config.h
+./snmp_vars.lo: ../include/net-snmp/system/linux.h
+./snmp_vars.lo: ../include/net-snmp/system/sysv.h
+./snmp_vars.lo: ../include/net-snmp/system/generic.h
+./snmp_vars.lo: ../include/net-snmp/machine/generic.h 
+./snmp_vars.lo: ../include/net-snmp/net-snmp-includes.h
+./snmp_vars.lo: ../include/net-snmp/definitions.h ../include/net-snmp/types.h
+./snmp_vars.lo: ../include/net-snmp/library/snmp_api.h
+./snmp_vars.lo: ../include/net-snmp/library/asn1.h
+./snmp_vars.lo: ../include/net-snmp/library/snmp_impl.h
+./snmp_vars.lo: ../include/net-snmp/library/snmp.h
+./snmp_vars.lo: ../include/net-snmp/library/snmp-tc.h
+./snmp_vars.lo: ../include/net-snmp/utilities.h
+./snmp_vars.lo: ../include/net-snmp/library/snmp_client.h
+./snmp_vars.lo: ../include/net-snmp/library/getopt.h
+./snmp_vars.lo: ../include/net-snmp/library/system.h
+./snmp_vars.lo: ../include/net-snmp/library/tools.h
+./snmp_vars.lo: ../include/net-snmp/library/int64.h
+./snmp_vars.lo: ../include/net-snmp/library/mt_support.h
+./snmp_vars.lo: ../include/net-snmp/library/snmp_alarm.h
+./snmp_vars.lo: ../include/net-snmp/library/data_list.h
+./snmp_vars.lo: ../include/net-snmp/library/callback.h
+./snmp_vars.lo: ../include/net-snmp/library/oid_stash.h
+./snmp_vars.lo: ../include/net-snmp/library/check_varbind.h
+./snmp_vars.lo: ../include/net-snmp/version.h
+./snmp_vars.lo: ../include/net-snmp/session_api.h
+./snmp_vars.lo: ../include/net-snmp/library/snmp_transport.h
+./snmp_vars.lo: ../include/net-snmp/library/snmpCallbackDomain.h
+./snmp_vars.lo: ../include/net-snmp/library/snmpUnixDomain.h
+./snmp_vars.lo: ../include/net-snmp/library/snmpUDPDomain.h
+./snmp_vars.lo: ../include/net-snmp/library/snmpTCPDomain.h
+./snmp_vars.lo: ../include/net-snmp/library/snmpUDPIPv6Domain.h
+./snmp_vars.lo: ../include/net-snmp/library/snmpTCPIPv6Domain.h
+./snmp_vars.lo: ../include/net-snmp/library/snmpIPXDomain.h
+./snmp_vars.lo: ../include/net-snmp/library/ucd_compat.h
+./snmp_vars.lo: ../include/net-snmp/pdu_api.h ../include/net-snmp/mib_api.h
+./snmp_vars.lo: ../include/net-snmp/library/mib.h
+./snmp_vars.lo: ../include/net-snmp/library/parse.h
+./snmp_vars.lo: ../include/net-snmp/varbind_api.h
+./snmp_vars.lo: ../include/net-snmp/config_api.h
+./snmp_vars.lo: ../include/net-snmp/library/read_config.h
+./snmp_vars.lo: ../include/net-snmp/library/default_store.h
+./snmp_vars.lo: ../include/net-snmp/library/snmp_parse_args.h
+./snmp_vars.lo: ../include/net-snmp/library/snmp_enum.h
+./snmp_vars.lo: ../include/net-snmp/library/vacm.h
+./snmp_vars.lo: ../include/net-snmp/output_api.h
+./snmp_vars.lo: ../include/net-snmp/library/snmp_debug.h
+./snmp_vars.lo: ../include/net-snmp/library/snmp_logging.h
+./snmp_vars.lo: ../include/net-snmp/snmpv3_api.h
+./snmp_vars.lo: ../include/net-snmp/library/snmpv3.h
+./snmp_vars.lo: ../include/net-snmp/library/transform_oids.h
+./snmp_vars.lo: ../include/net-snmp/library/keytools.h
+./snmp_vars.lo: ../include/net-snmp/library/scapi.h
+./snmp_vars.lo: ../include/net-snmp/library/lcd_time.h
+./snmp_vars.lo: ../include/net-snmp/library/snmp_secmod.h
+./snmp_vars.lo: ../include/net-snmp/library/snmpv3-security-includes.h
+./snmp_vars.lo: ../include/net-snmp/library/snmpusm.h
+./snmp_vars.lo: ../include/net-snmp/agent/net-snmp-agent-includes.h
+./snmp_vars.lo: ../include/net-snmp/agent/snmp_agent.h
+./snmp_vars.lo: ../include/net-snmp/agent/snmp_vars.h
+./snmp_vars.lo: ../include/net-snmp/agent/agent_handler.h
+./snmp_vars.lo: ../include/net-snmp/agent/var_struct.h
+./snmp_vars.lo: ../include/net-snmp/agent/agent_registry.h
+./snmp_vars.lo: ../include/net-snmp/agent/ds_agent.h
+./snmp_vars.lo: ../include/net-snmp/agent/agent_read_config.h
+./snmp_vars.lo: ../include/net-snmp/agent/agent_trap.h
+./snmp_vars.lo: ../include/net-snmp/agent/all_helpers.h
+./snmp_vars.lo: ../include/net-snmp/agent/instance.h
+./snmp_vars.lo: ../include/net-snmp/agent/multiplexer.h
+./snmp_vars.lo: ../include/net-snmp/agent/null.h
+./snmp_vars.lo: ../include/net-snmp/agent/debug_handler.h
+./snmp_vars.lo: ../include/net-snmp/agent/old_api.h
+./snmp_vars.lo: ../include/net-snmp/agent/read_only.h
+./snmp_vars.lo: ../include/net-snmp/agent/serialize.h
+./snmp_vars.lo: ../include/net-snmp/agent/bulk_to_next.h
+./snmp_vars.lo: ../include/net-snmp/agent/mode_end_call.h
+./snmp_vars.lo: ../include/net-snmp/agent/table.h
+./snmp_vars.lo: ../include/net-snmp/agent/table_data.h
+./snmp_vars.lo: ../include/net-snmp/agent/table_dataset.h
+./snmp_vars.lo: ../include/net-snmp/agent/table_iterator.h
+./snmp_vars.lo: ../include/net-snmp/agent/mib_module_config.h kernel.h
+./snmp_vars.lo: mibgroup/struct.h snmpd.h ./mibgroup/mib_module_includes.h
+./snmp_vars.lo: mibgroup/mibII.h mibgroup/ucd_snmp.h mibgroup/snmpv3mibs.h
+./snmp_vars.lo: mibgroup/notification.h mibgroup/target.h
+./snmp_vars.lo: mibgroup/agent_mibs.h mibgroup/agentx.h mibgroup/utilities.h
+./snmp_vars.lo: mibgroup/host.h mibgroup/examples.h
+./snmp_vars.lo: mibgroup/examples/example.h mibgroup/testhandler.h
+./snmp_vars.lo: mibgroup/smux.h mibgroup/Rmon.h mibgroup/disman/event-mib.h
+./snmp_vars.lo: mibgroup/mibII/system_mib.h mibgroup/mibII/sysORTable.h
+./snmp_vars.lo: mibgroup/mibII/at.h mibgroup/mibII/interfaces.h
+./snmp_vars.lo: mibgroup/mibII/snmp_mib.h mibgroup/mibII/tcp.h
+./snmp_vars.lo: mibgroup/mibII/icmp.h mibgroup/mibII/ip.h
+./snmp_vars.lo: mibgroup/mibII/var_route.h mibgroup/mibII/route_write.h
+./snmp_vars.lo: mibgroup/mibII/at.h mibgroup/mibII/udp.h
+./snmp_vars.lo: mibgroup/mibII/vacm_vars.h mibgroup/mibII/setSerialNo.h
+./snmp_vars.lo: mibgroup/ucd-snmp/memory.h ./mibgroup/mibdefs.h
+./snmp_vars.lo: mibgroup/ucd-snmp/vmstat.h mibgroup/ucd-snmp/proc.h
+./snmp_vars.lo: mibgroup/ucd-snmp/versioninfo.h mibgroup/ucd-snmp/pass.h
+./snmp_vars.lo: mibgroup/ucd-snmp/pass_persist.h mibgroup/ucd-snmp/disk.h
+./snmp_vars.lo: mibgroup/ucd-snmp/loadave.h mibgroup/ucd-snmp/extensible.h
+./snmp_vars.lo: mibgroup/ucd-snmp/errormib.h mibgroup/ucd-snmp/file.h
+./snmp_vars.lo: mibgroup/ucd-snmp/dlmod.h mibgroup/ucd-snmp/proxy.h
+./snmp_vars.lo: mibgroup/snmpv3/snmpEngine.h mibgroup/snmpv3/snmpMPDStats.h
+./snmp_vars.lo: mibgroup/snmpv3/usmStats.h mibgroup/snmpv3/usmUser.h
+./snmp_vars.lo: mibgroup/notification/snmpNotifyTable.h
+./snmp_vars.lo: mibgroup/notification/snmpNotifyFilterTable.h
+./snmp_vars.lo: mibgroup/notification/snmpNotifyFilterProfileTable.h
+./snmp_vars.lo: mibgroup/target/snmpTargetAddrEntry.h
+./snmp_vars.lo: mibgroup/target/snmpTargetParamsEntry.h
+./snmp_vars.lo: mibgroup/target/target.h mibgroup/target/target_counters.h
+./snmp_vars.lo: mibgroup/agent/nsTransactionTable.h
+./snmp_vars.lo: mibgroup/agent/nsModuleTable.h mibgroup/agentx/master.h
+./snmp_vars.lo: mibgroup/agentx/subagent.h mibgroup/utilities/override.h
+./snmp_vars.lo: mibgroup/host/hr_system.h mibgroup/host/hr_storage.h
+./snmp_vars.lo: mibgroup/host/hr_device.h mibgroup/host/hr_other.h
+./snmp_vars.lo: mibgroup/host/hr_proc.h mibgroup/host/hr_network.h
+./snmp_vars.lo: mibgroup/host/hr_print.h mibgroup/host/hr_disk.h
+./snmp_vars.lo: mibgroup/host/hr_partition.h mibgroup/host/hr_filesys.h
+./snmp_vars.lo: mibgroup/host/hr_swrun.h mibgroup/host/hr_swinst.h
+./snmp_vars.lo: mibgroup/examples/scalar_int.h mibgroup/examples/data_set.h
+./snmp_vars.lo: mibgroup/examples/delayed_instance.h mibgroup/util_funcs.h
+./snmp_vars.lo: mibgroup/struct.h mibgroup/smux/smux.h mibgroup/Rmon/rows.h
+./snmp_vars.lo: mibgroup/Rmon/agutil.h mibgroup/Rmon/statistics.h
+./snmp_vars.lo: mibgroup/Rmon/alarm.h mibgroup/Rmon/history.h
+./snmp_vars.lo: mibgroup/Rmon/event.h mibgroup/disman/mteTriggerTable.h
+./snmp_vars.lo: mibgroup/disman/mteTriggerDeltaTable.h
+./snmp_vars.lo: mibgroup/disman/mteTriggerExistenceTable.h
+./snmp_vars.lo: mibgroup/disman/mteTriggerBooleanTable.h
+./snmp_vars.lo: mibgroup/disman/mteTriggerThresholdTable.h
+./snmp_vars.lo: mibgroup/disman/mteObjectsTable.h
+./snmp_vars.lo: mibgroup/disman/mteEventTable.h
+./snmp_vars.lo: mibgroup/disman/mteEventNotificationTable.h
+./snmp_vars.lo: mibgroup/mibII/kernel_linux.h mibgroup/mibII/tcpTable.h
+./snmp_vars.lo: mibgroup/mibII/ipAddr.h mibgroup/mibII/var_route.h
+./snmp_vars.lo: mibgroup/mibII/route_write.h mibgroup/mibII/udpTable.h
+./snmp_vars.lo: mibgroup/mibII/vacm_context.h mibgroup/header_complex.h
+./snmp_vars.lo: mibgroup/agentx/protocol.h mibgroup/agentx/client.h
+./snmp_vars.lo: mibgroup/agentx/master_admin.h
+./snmp_vars.lo: mibgroup/agentx/agentx_config.h
+./snmp_vars.lo: ../include/net-snmp/library/container.h
+./snmp_vars.lo: ../include/net-snmp/library/factory.h
+./helpers/all_helpers.lo: ../include/net-snmp/net-snmp-config.h
+./helpers/all_helpers.lo: ../include/net-snmp/system/linux.h
+./helpers/all_helpers.lo: ../include/net-snmp/system/sysv.h
+./helpers/all_helpers.lo: ../include/net-snmp/system/generic.h
+./helpers/all_helpers.lo: ../include/net-snmp/machine/generic.h
+./helpers/bulk_to_next.lo: ../include/net-snmp/net-snmp-config.h
+./helpers/bulk_to_next.lo: ../include/net-snmp/system/linux.h
+./helpers/bulk_to_next.lo: ../include/net-snmp/system/sysv.h
+./helpers/bulk_to_next.lo: ../include/net-snmp/system/generic.h
+./helpers/bulk_to_next.lo: ../include/net-snmp/machine/generic.h
+./helpers/bulk_to_next.lo: ../include/net-snmp/net-snmp-includes.h
+./helpers/bulk_to_next.lo: ../include/net-snmp/definitions.h
+./helpers/bulk_to_next.lo: ../include/net-snmp/types.h
+./helpers/bulk_to_next.lo: ../include/net-snmp/library/snmp_api.h
+./helpers/bulk_to_next.lo: ../include/net-snmp/library/asn1.h
+./helpers/bulk_to_next.lo: ../include/net-snmp/library/snmp_impl.h
+./helpers/bulk_to_next.lo: ../include/net-snmp/library/snmp.h
+./helpers/bulk_to_next.lo: ../include/net-snmp/library/snmp-tc.h
+./helpers/bulk_to_next.lo: ../include/net-snmp/utilities.h
+./helpers/bulk_to_next.lo: ../include/net-snmp/library/snmp_client.h
+./helpers/bulk_to_next.lo: ../include/net-snmp/library/getopt.h
+./helpers/bulk_to_next.lo: ../include/net-snmp/library/system.h
+./helpers/bulk_to_next.lo: ../include/net-snmp/library/tools.h
+./helpers/bulk_to_next.lo: ../include/net-snmp/library/int64.h
+./helpers/bulk_to_next.lo: ../include/net-snmp/library/mt_support.h
+./helpers/bulk_to_next.lo: ../include/net-snmp/library/snmp_alarm.h
+./helpers/bulk_to_next.lo: ../include/net-snmp/library/data_list.h
+./helpers/bulk_to_next.lo: ../include/net-snmp/library/callback.h
+./helpers/bulk_to_next.lo: ../include/net-snmp/library/oid_stash.h
+./helpers/bulk_to_next.lo: ../include/net-snmp/library/check_varbind.h
+./helpers/bulk_to_next.lo: ../include/net-snmp/version.h
+./helpers/bulk_to_next.lo: ../include/net-snmp/session_api.h
+./helpers/bulk_to_next.lo: ../include/net-snmp/library/snmp_transport.h
+./helpers/bulk_to_next.lo: ../include/net-snmp/library/snmpCallbackDomain.h
+./helpers/bulk_to_next.lo: ../include/net-snmp/library/snmpUnixDomain.h
+./helpers/bulk_to_next.lo: ../include/net-snmp/library/snmpUDPDomain.h
+./helpers/bulk_to_next.lo: ../include/net-snmp/library/snmpTCPDomain.h
+./helpers/bulk_to_next.lo: ../include/net-snmp/library/snmpUDPIPv6Domain.h
+./helpers/bulk_to_next.lo: ../include/net-snmp/library/snmpTCPIPv6Domain.h
+./helpers/bulk_to_next.lo: ../include/net-snmp/library/snmpIPXDomain.h
+./helpers/bulk_to_next.lo: ../include/net-snmp/library/ucd_compat.h
+./helpers/bulk_to_next.lo: ../include/net-snmp/pdu_api.h
+./helpers/bulk_to_next.lo: ../include/net-snmp/mib_api.h
+./helpers/bulk_to_next.lo: ../include/net-snmp/library/mib.h
+./helpers/bulk_to_next.lo: ../include/net-snmp/library/parse.h
+./helpers/bulk_to_next.lo: ../include/net-snmp/varbind_api.h
+./helpers/bulk_to_next.lo: ../include/net-snmp/config_api.h
+./helpers/bulk_to_next.lo: ../include/net-snmp/library/read_config.h
+./helpers/bulk_to_next.lo: ../include/net-snmp/library/default_store.h
+./helpers/bulk_to_next.lo: ../include/net-snmp/library/snmp_parse_args.h
+./helpers/bulk_to_next.lo: ../include/net-snmp/library/snmp_enum.h
+./helpers/bulk_to_next.lo: ../include/net-snmp/library/vacm.h
+./helpers/bulk_to_next.lo: ../include/net-snmp/output_api.h
+./helpers/bulk_to_next.lo: ../include/net-snmp/library/snmp_debug.h
+./helpers/bulk_to_next.lo: ../include/net-snmp/library/snmp_logging.h
+./helpers/bulk_to_next.lo: ../include/net-snmp/snmpv3_api.h
+./helpers/bulk_to_next.lo: ../include/net-snmp/library/snmpv3.h
+./helpers/bulk_to_next.lo: ../include/net-snmp/library/transform_oids.h
+./helpers/bulk_to_next.lo: ../include/net-snmp/library/keytools.h
+./helpers/bulk_to_next.lo: ../include/net-snmp/library/scapi.h
+./helpers/bulk_to_next.lo: ../include/net-snmp/library/lcd_time.h
+./helpers/bulk_to_next.lo: ../include/net-snmp/library/snmp_secmod.h
+./helpers/bulk_to_next.lo: ../include/net-snmp/library/snmpv3-security-includes.h
+./helpers/bulk_to_next.lo: ../include/net-snmp/library/snmpusm.h
+./helpers/bulk_to_next.lo: ../include/net-snmp/agent/net-snmp-agent-includes.h
+./helpers/bulk_to_next.lo: ../include/net-snmp/agent/snmp_agent.h
+./helpers/bulk_to_next.lo: ../include/net-snmp/agent/snmp_vars.h
+./helpers/bulk_to_next.lo: ../include/net-snmp/agent/agent_handler.h
+./helpers/bulk_to_next.lo: ../include/net-snmp/agent/var_struct.h
+./helpers/bulk_to_next.lo: ../include/net-snmp/agent/agent_registry.h
+./helpers/bulk_to_next.lo: ../include/net-snmp/agent/ds_agent.h
+./helpers/bulk_to_next.lo: ../include/net-snmp/agent/agent_read_config.h
+./helpers/bulk_to_next.lo: ../include/net-snmp/agent/agent_trap.h
+./helpers/bulk_to_next.lo: ../include/net-snmp/agent/all_helpers.h
+./helpers/bulk_to_next.lo: ../include/net-snmp/agent/instance.h
+./helpers/bulk_to_next.lo: ../include/net-snmp/agent/multiplexer.h
+./helpers/bulk_to_next.lo: ../include/net-snmp/agent/null.h
+./helpers/bulk_to_next.lo: ../include/net-snmp/agent/debug_handler.h
+./helpers/bulk_to_next.lo: ../include/net-snmp/agent/old_api.h
+./helpers/bulk_to_next.lo: ../include/net-snmp/agent/read_only.h
+./helpers/bulk_to_next.lo: ../include/net-snmp/agent/serialize.h
+./helpers/bulk_to_next.lo: ../include/net-snmp/agent/bulk_to_next.h
+./helpers/bulk_to_next.lo: ../include/net-snmp/agent/mode_end_call.h
+./helpers/bulk_to_next.lo: ../include/net-snmp/agent/table.h
+./helpers/bulk_to_next.lo: ../include/net-snmp/agent/table_data.h
+./helpers/bulk_to_next.lo: ../include/net-snmp/agent/table_dataset.h
+./helpers/bulk_to_next.lo: ../include/net-snmp/agent/table_iterator.h
+./helpers/bulk_to_next.lo: ../include/net-snmp/agent/mib_module_config.h
+./helpers/debug_handler.lo: ../include/net-snmp/net-snmp-config.h
+./helpers/debug_handler.lo: ../include/net-snmp/system/linux.h
+./helpers/debug_handler.lo: ../include/net-snmp/system/sysv.h
+./helpers/debug_handler.lo: ../include/net-snmp/system/generic.h
+./helpers/debug_handler.lo: ../include/net-snmp/machine/generic.h
+./helpers/debug_handler.lo: ../include/net-snmp/net-snmp-includes.h
+./helpers/debug_handler.lo: ../include/net-snmp/definitions.h
+./helpers/debug_handler.lo: ../include/net-snmp/types.h
+./helpers/debug_handler.lo: ../include/net-snmp/library/snmp_api.h
+./helpers/debug_handler.lo: ../include/net-snmp/library/asn1.h
+./helpers/debug_handler.lo: ../include/net-snmp/library/snmp_impl.h
+./helpers/debug_handler.lo: ../include/net-snmp/library/snmp.h
+./helpers/debug_handler.lo: ../include/net-snmp/library/snmp-tc.h
+./helpers/debug_handler.lo: ../include/net-snmp/utilities.h
+./helpers/debug_handler.lo: ../include/net-snmp/library/snmp_client.h
+./helpers/debug_handler.lo: ../include/net-snmp/library/getopt.h
+./helpers/debug_handler.lo: ../include/net-snmp/library/system.h
+./helpers/debug_handler.lo: ../include/net-snmp/library/tools.h
+./helpers/debug_handler.lo: ../include/net-snmp/library/int64.h
+./helpers/debug_handler.lo: ../include/net-snmp/library/mt_support.h
+./helpers/debug_handler.lo: ../include/net-snmp/library/snmp_alarm.h
+./helpers/debug_handler.lo: ../include/net-snmp/library/data_list.h
+./helpers/debug_handler.lo: ../include/net-snmp/library/callback.h
+./helpers/debug_handler.lo: ../include/net-snmp/library/oid_stash.h
+./helpers/debug_handler.lo: ../include/net-snmp/library/check_varbind.h
+./helpers/debug_handler.lo: ../include/net-snmp/version.h
+./helpers/debug_handler.lo: ../include/net-snmp/session_api.h
+./helpers/debug_handler.lo: ../include/net-snmp/library/snmp_transport.h
+./helpers/debug_handler.lo: ../include/net-snmp/library/snmpCallbackDomain.h
+./helpers/debug_handler.lo: ../include/net-snmp/library/snmpUnixDomain.h
+./helpers/debug_handler.lo: ../include/net-snmp/library/snmpUDPDomain.h
+./helpers/debug_handler.lo: ../include/net-snmp/library/snmpTCPDomain.h
+./helpers/debug_handler.lo: ../include/net-snmp/library/snmpUDPIPv6Domain.h
+./helpers/debug_handler.lo: ../include/net-snmp/library/snmpTCPIPv6Domain.h
+./helpers/debug_handler.lo: ../include/net-snmp/library/snmpIPXDomain.h
+./helpers/debug_handler.lo: ../include/net-snmp/library/ucd_compat.h
+./helpers/debug_handler.lo: ../include/net-snmp/pdu_api.h
+./helpers/debug_handler.lo: ../include/net-snmp/mib_api.h
+./helpers/debug_handler.lo: ../include/net-snmp/library/mib.h
+./helpers/debug_handler.lo: ../include/net-snmp/library/parse.h
+./helpers/debug_handler.lo: ../include/net-snmp/varbind_api.h
+./helpers/debug_handler.lo: ../include/net-snmp/config_api.h
+./helpers/debug_handler.lo: ../include/net-snmp/library/read_config.h
+./helpers/debug_handler.lo: ../include/net-snmp/library/default_store.h
+./helpers/debug_handler.lo: ../include/net-snmp/library/snmp_parse_args.h
+./helpers/debug_handler.lo: ../include/net-snmp/library/snmp_enum.h
+./helpers/debug_handler.lo: ../include/net-snmp/library/vacm.h
+./helpers/debug_handler.lo: ../include/net-snmp/output_api.h
+./helpers/debug_handler.lo: ../include/net-snmp/library/snmp_debug.h
+./helpers/debug_handler.lo: ../include/net-snmp/library/snmp_logging.h
+./helpers/debug_handler.lo: ../include/net-snmp/snmpv3_api.h
+./helpers/debug_handler.lo: ../include/net-snmp/library/snmpv3.h
+./helpers/debug_handler.lo: ../include/net-snmp/library/transform_oids.h
+./helpers/debug_handler.lo: ../include/net-snmp/library/keytools.h
+./helpers/debug_handler.lo: ../include/net-snmp/library/scapi.h
+./helpers/debug_handler.lo: ../include/net-snmp/library/lcd_time.h
+./helpers/debug_handler.lo: ../include/net-snmp/library/snmp_secmod.h
+./helpers/debug_handler.lo: ../include/net-snmp/library/snmpv3-security-includes.h
+./helpers/debug_handler.lo: ../include/net-snmp/library/snmpusm.h
+./helpers/debug_handler.lo: ../include/net-snmp/agent/net-snmp-agent-includes.h
+./helpers/debug_handler.lo: ../include/net-snmp/agent/snmp_agent.h
+./helpers/debug_handler.lo: ../include/net-snmp/agent/snmp_vars.h
+./helpers/debug_handler.lo: ../include/net-snmp/agent/agent_handler.h
+./helpers/debug_handler.lo: ../include/net-snmp/agent/var_struct.h
+./helpers/debug_handler.lo: ../include/net-snmp/agent/agent_registry.h
+./helpers/debug_handler.lo: ../include/net-snmp/agent/ds_agent.h
+./helpers/debug_handler.lo: ../include/net-snmp/agent/agent_read_config.h
+./helpers/debug_handler.lo: ../include/net-snmp/agent/agent_trap.h
+./helpers/debug_handler.lo: ../include/net-snmp/agent/all_helpers.h
+./helpers/debug_handler.lo: ../include/net-snmp/agent/instance.h
+./helpers/debug_handler.lo: ../include/net-snmp/agent/multiplexer.h
+./helpers/debug_handler.lo: ../include/net-snmp/agent/null.h
+./helpers/debug_handler.lo: ../include/net-snmp/agent/debug_handler.h
+./helpers/debug_handler.lo: ../include/net-snmp/agent/old_api.h
+./helpers/debug_handler.lo: ../include/net-snmp/agent/read_only.h
+./helpers/debug_handler.lo: ../include/net-snmp/agent/serialize.h
+./helpers/debug_handler.lo: ../include/net-snmp/agent/bulk_to_next.h
+./helpers/debug_handler.lo: ../include/net-snmp/agent/mode_end_call.h
+./helpers/debug_handler.lo: ../include/net-snmp/agent/table.h
+./helpers/debug_handler.lo: ../include/net-snmp/agent/table_data.h
+./helpers/debug_handler.lo: ../include/net-snmp/agent/table_dataset.h
+./helpers/debug_handler.lo: ../include/net-snmp/agent/table_iterator.h
+./helpers/debug_handler.lo: ../include/net-snmp/agent/mib_module_config.h
+./helpers/instance.lo: ../include/net-snmp/net-snmp-config.h
+./helpers/instance.lo: ../include/net-snmp/system/linux.h
+./helpers/instance.lo: ../include/net-snmp/system/sysv.h
+./helpers/instance.lo: ../include/net-snmp/system/generic.h
+./helpers/instance.lo: ../include/net-snmp/machine/generic.h
+./helpers/instance.lo: ../include/net-snmp/net-snmp-includes.h
+./helpers/instance.lo: ../include/net-snmp/definitions.h
+./helpers/instance.lo: ../include/net-snmp/types.h
+./helpers/instance.lo: ../include/net-snmp/library/snmp_api.h
+./helpers/instance.lo: ../include/net-snmp/library/asn1.h
+./helpers/instance.lo: ../include/net-snmp/library/snmp_impl.h
+./helpers/instance.lo: ../include/net-snmp/library/snmp.h
+./helpers/instance.lo: ../include/net-snmp/library/snmp-tc.h
+./helpers/instance.lo: ../include/net-snmp/utilities.h
+./helpers/instance.lo: ../include/net-snmp/library/snmp_client.h
+./helpers/instance.lo: ../include/net-snmp/library/getopt.h
+./helpers/instance.lo: ../include/net-snmp/library/system.h
+./helpers/instance.lo: ../include/net-snmp/library/tools.h
+./helpers/instance.lo: ../include/net-snmp/library/int64.h
+./helpers/instance.lo: ../include/net-snmp/library/mt_support.h
+./helpers/instance.lo: ../include/net-snmp/library/snmp_alarm.h
+./helpers/instance.lo: ../include/net-snmp/library/data_list.h
+./helpers/instance.lo: ../include/net-snmp/library/callback.h
+./helpers/instance.lo: ../include/net-snmp/library/oid_stash.h
+./helpers/instance.lo: ../include/net-snmp/library/check_varbind.h
+./helpers/instance.lo: ../include/net-snmp/version.h
+./helpers/instance.lo: ../include/net-snmp/session_api.h
+./helpers/instance.lo: ../include/net-snmp/library/snmp_transport.h
+./helpers/instance.lo: ../include/net-snmp/library/snmpCallbackDomain.h
+./helpers/instance.lo: ../include/net-snmp/library/snmpUnixDomain.h
+./helpers/instance.lo: ../include/net-snmp/library/snmpUDPDomain.h
+./helpers/instance.lo: ../include/net-snmp/library/snmpTCPDomain.h
+./helpers/instance.lo: ../include/net-snmp/library/snmpUDPIPv6Domain.h
+./helpers/instance.lo: ../include/net-snmp/library/snmpTCPIPv6Domain.h
+./helpers/instance.lo: ../include/net-snmp/library/snmpIPXDomain.h
+./helpers/instance.lo: ../include/net-snmp/library/ucd_compat.h
+./helpers/instance.lo: ../include/net-snmp/pdu_api.h
+./helpers/instance.lo: ../include/net-snmp/mib_api.h
+./helpers/instance.lo: ../include/net-snmp/library/mib.h
+./helpers/instance.lo: ../include/net-snmp/library/parse.h
+./helpers/instance.lo: ../include/net-snmp/varbind_api.h
+./helpers/instance.lo: ../include/net-snmp/config_api.h
+./helpers/instance.lo: ../include/net-snmp/library/read_config.h
+./helpers/instance.lo: ../include/net-snmp/library/default_store.h
+./helpers/instance.lo: ../include/net-snmp/library/snmp_parse_args.h
+./helpers/instance.lo: ../include/net-snmp/library/snmp_enum.h
+./helpers/instance.lo: ../include/net-snmp/library/vacm.h
+./helpers/instance.lo: ../include/net-snmp/output_api.h
+./helpers/instance.lo: ../include/net-snmp/library/snmp_debug.h
+./helpers/instance.lo: ../include/net-snmp/library/snmp_logging.h
+./helpers/instance.lo: ../include/net-snmp/snmpv3_api.h
+./helpers/instance.lo: ../include/net-snmp/library/snmpv3.h
+./helpers/instance.lo: ../include/net-snmp/library/transform_oids.h
+./helpers/instance.lo: ../include/net-snmp/library/keytools.h
+./helpers/instance.lo: ../include/net-snmp/library/scapi.h
+./helpers/instance.lo: ../include/net-snmp/library/lcd_time.h
+./helpers/instance.lo: ../include/net-snmp/library/snmp_secmod.h
+./helpers/instance.lo: ../include/net-snmp/library/snmpv3-security-includes.h
+./helpers/instance.lo: ../include/net-snmp/library/snmpusm.h
+./helpers/instance.lo: ../include/net-snmp/agent/net-snmp-agent-includes.h
+./helpers/instance.lo: ../include/net-snmp/agent/snmp_agent.h
+./helpers/instance.lo: ../include/net-snmp/agent/snmp_vars.h
+./helpers/instance.lo: ../include/net-snmp/agent/agent_handler.h
+./helpers/instance.lo: ../include/net-snmp/agent/var_struct.h
+./helpers/instance.lo: ../include/net-snmp/agent/agent_registry.h
+./helpers/instance.lo: ../include/net-snmp/agent/ds_agent.h
+./helpers/instance.lo: ../include/net-snmp/agent/agent_read_config.h
+./helpers/instance.lo: ../include/net-snmp/agent/agent_trap.h
+./helpers/instance.lo: ../include/net-snmp/agent/all_helpers.h
+./helpers/instance.lo: ../include/net-snmp/agent/instance.h
+./helpers/instance.lo: ../include/net-snmp/agent/multiplexer.h
+./helpers/instance.lo: ../include/net-snmp/agent/null.h
+./helpers/instance.lo: ../include/net-snmp/agent/debug_handler.h
+./helpers/instance.lo: ../include/net-snmp/agent/old_api.h
+./helpers/instance.lo: ../include/net-snmp/agent/read_only.h
+./helpers/instance.lo: ../include/net-snmp/agent/serialize.h
+./helpers/instance.lo: ../include/net-snmp/agent/bulk_to_next.h
+./helpers/instance.lo: ../include/net-snmp/agent/mode_end_call.h
+./helpers/instance.lo: ../include/net-snmp/agent/table.h
+./helpers/instance.lo: ../include/net-snmp/agent/table_data.h
+./helpers/instance.lo: ../include/net-snmp/agent/table_dataset.h
+./helpers/instance.lo: ../include/net-snmp/agent/table_iterator.h
+./helpers/instance.lo: ../include/net-snmp/agent/mib_module_config.h
+./helpers/mode_end_call.lo: ../include/net-snmp/net-snmp-config.h
+./helpers/mode_end_call.lo: ../include/net-snmp/system/linux.h
+./helpers/mode_end_call.lo: ../include/net-snmp/system/sysv.h
+./helpers/mode_end_call.lo: ../include/net-snmp/system/generic.h
+./helpers/mode_end_call.lo: ../include/net-snmp/machine/generic.h
+./helpers/mode_end_call.lo: ../include/net-snmp/net-snmp-includes.h
+./helpers/mode_end_call.lo: ../include/net-snmp/definitions.h
+./helpers/mode_end_call.lo: ../include/net-snmp/types.h
+./helpers/mode_end_call.lo: ../include/net-snmp/library/snmp_api.h
+./helpers/mode_end_call.lo: ../include/net-snmp/library/asn1.h
+./helpers/mode_end_call.lo: ../include/net-snmp/library/snmp_impl.h
+./helpers/mode_end_call.lo: ../include/net-snmp/library/snmp.h
+./helpers/mode_end_call.lo: ../include/net-snmp/library/snmp-tc.h
+./helpers/mode_end_call.lo: ../include/net-snmp/utilities.h
+./helpers/mode_end_call.lo: ../include/net-snmp/library/snmp_client.h
+./helpers/mode_end_call.lo: ../include/net-snmp/library/getopt.h
+./helpers/mode_end_call.lo: ../include/net-snmp/library/system.h
+./helpers/mode_end_call.lo: ../include/net-snmp/library/tools.h
+./helpers/mode_end_call.lo: ../include/net-snmp/library/int64.h
+./helpers/mode_end_call.lo: ../include/net-snmp/library/mt_support.h
+./helpers/mode_end_call.lo: ../include/net-snmp/library/snmp_alarm.h
+./helpers/mode_end_call.lo: ../include/net-snmp/library/data_list.h
+./helpers/mode_end_call.lo: ../include/net-snmp/library/callback.h
+./helpers/mode_end_call.lo: ../include/net-snmp/library/oid_stash.h
+./helpers/mode_end_call.lo: ../include/net-snmp/library/check_varbind.h
+./helpers/mode_end_call.lo: ../include/net-snmp/version.h
+./helpers/mode_end_call.lo: ../include/net-snmp/session_api.h
+./helpers/mode_end_call.lo: ../include/net-snmp/library/snmp_transport.h
+./helpers/mode_end_call.lo: ../include/net-snmp/library/snmpCallbackDomain.h
+./helpers/mode_end_call.lo: ../include/net-snmp/library/snmpUnixDomain.h
+./helpers/mode_end_call.lo: ../include/net-snmp/library/snmpUDPDomain.h
+./helpers/mode_end_call.lo: ../include/net-snmp/library/snmpTCPDomain.h
+./helpers/mode_end_call.lo: ../include/net-snmp/library/snmpUDPIPv6Domain.h
+./helpers/mode_end_call.lo: ../include/net-snmp/library/snmpTCPIPv6Domain.h
+./helpers/mode_end_call.lo: ../include/net-snmp/library/snmpIPXDomain.h
+./helpers/mode_end_call.lo: ../include/net-snmp/library/ucd_compat.h
+./helpers/mode_end_call.lo: ../include/net-snmp/pdu_api.h
+./helpers/mode_end_call.lo: ../include/net-snmp/mib_api.h
+./helpers/mode_end_call.lo: ../include/net-snmp/library/mib.h
+./helpers/mode_end_call.lo: ../include/net-snmp/library/parse.h
+./helpers/mode_end_call.lo: ../include/net-snmp/varbind_api.h
+./helpers/mode_end_call.lo: ../include/net-snmp/config_api.h
+./helpers/mode_end_call.lo: ../include/net-snmp/library/read_config.h
+./helpers/mode_end_call.lo: ../include/net-snmp/library/default_store.h
+./helpers/mode_end_call.lo: ../include/net-snmp/library/snmp_parse_args.h
+./helpers/mode_end_call.lo: ../include/net-snmp/library/snmp_enum.h
+./helpers/mode_end_call.lo: ../include/net-snmp/library/vacm.h
+./helpers/mode_end_call.lo: ../include/net-snmp/output_api.h
+./helpers/mode_end_call.lo: ../include/net-snmp/library/snmp_debug.h
+./helpers/mode_end_call.lo: ../include/net-snmp/library/snmp_logging.h
+./helpers/mode_end_call.lo: ../include/net-snmp/snmpv3_api.h
+./helpers/mode_end_call.lo: ../include/net-snmp/library/snmpv3.h
+./helpers/mode_end_call.lo: ../include/net-snmp/library/transform_oids.h
+./helpers/mode_end_call.lo: ../include/net-snmp/library/keytools.h
+./helpers/mode_end_call.lo: ../include/net-snmp/library/scapi.h
+./helpers/mode_end_call.lo: ../include/net-snmp/library/lcd_time.h
+./helpers/mode_end_call.lo: ../include/net-snmp/library/snmp_secmod.h
+./helpers/mode_end_call.lo: ../include/net-snmp/library/snmpv3-security-includes.h
+./helpers/mode_end_call.lo: ../include/net-snmp/library/snmpusm.h
+./helpers/mode_end_call.lo: ../include/net-snmp/agent/net-snmp-agent-includes.h
+./helpers/mode_end_call.lo: ../include/net-snmp/agent/snmp_agent.h
+./helpers/mode_end_call.lo: ../include/net-snmp/agent/snmp_vars.h
+./helpers/mode_end_call.lo: ../include/net-snmp/agent/agent_handler.h
+./helpers/mode_end_call.lo: ../include/net-snmp/agent/var_struct.h
+./helpers/mode_end_call.lo: ../include/net-snmp/agent/agent_registry.h
+./helpers/mode_end_call.lo: ../include/net-snmp/agent/ds_agent.h
+./helpers/mode_end_call.lo: ../include/net-snmp/agent/agent_read_config.h
+./helpers/mode_end_call.lo: ../include/net-snmp/agent/agent_trap.h
+./helpers/mode_end_call.lo: ../include/net-snmp/agent/all_helpers.h
+./helpers/mode_end_call.lo: ../include/net-snmp/agent/instance.h
+./helpers/mode_end_call.lo: ../include/net-snmp/agent/multiplexer.h
+./helpers/mode_end_call.lo: ../include/net-snmp/agent/null.h
+./helpers/mode_end_call.lo: ../include/net-snmp/agent/debug_handler.h
+./helpers/mode_end_call.lo: ../include/net-snmp/agent/old_api.h
+./helpers/mode_end_call.lo: ../include/net-snmp/agent/read_only.h
+./helpers/mode_end_call.lo: ../include/net-snmp/agent/serialize.h
+./helpers/mode_end_call.lo: ../include/net-snmp/agent/bulk_to_next.h
+./helpers/mode_end_call.lo: ../include/net-snmp/agent/mode_end_call.h
+./helpers/mode_end_call.lo: ../include/net-snmp/agent/table.h
+./helpers/mode_end_call.lo: ../include/net-snmp/agent/table_data.h
+./helpers/mode_end_call.lo: ../include/net-snmp/agent/table_dataset.h
+./helpers/mode_end_call.lo: ../include/net-snmp/agent/table_iterator.h
+./helpers/mode_end_call.lo: ../include/net-snmp/agent/mib_module_config.h
+./helpers/multiplexer.lo: ../include/net-snmp/net-snmp-config.h
+./helpers/multiplexer.lo: ../include/net-snmp/system/linux.h
+./helpers/multiplexer.lo: ../include/net-snmp/system/sysv.h
+./helpers/multiplexer.lo: ../include/net-snmp/system/generic.h
+./helpers/multiplexer.lo: ../include/net-snmp/machine/generic.h
+./helpers/multiplexer.lo: ../include/net-snmp/net-snmp-includes.h
+./helpers/multiplexer.lo: ../include/net-snmp/definitions.h
+./helpers/multiplexer.lo: ../include/net-snmp/types.h
+./helpers/multiplexer.lo: ../include/net-snmp/library/snmp_api.h
+./helpers/multiplexer.lo: ../include/net-snmp/library/asn1.h
+./helpers/multiplexer.lo: ../include/net-snmp/library/snmp_impl.h
+./helpers/multiplexer.lo: ../include/net-snmp/library/snmp.h
+./helpers/multiplexer.lo: ../include/net-snmp/library/snmp-tc.h
+./helpers/multiplexer.lo: ../include/net-snmp/utilities.h
+./helpers/multiplexer.lo: ../include/net-snmp/library/snmp_client.h
+./helpers/multiplexer.lo: ../include/net-snmp/library/getopt.h
+./helpers/multiplexer.lo: ../include/net-snmp/library/system.h
+./helpers/multiplexer.lo: ../include/net-snmp/library/tools.h
+./helpers/multiplexer.lo: ../include/net-snmp/library/int64.h
+./helpers/multiplexer.lo: ../include/net-snmp/library/mt_support.h
+./helpers/multiplexer.lo: ../include/net-snmp/library/snmp_alarm.h
+./helpers/multiplexer.lo: ../include/net-snmp/library/data_list.h
+./helpers/multiplexer.lo: ../include/net-snmp/library/callback.h
+./helpers/multiplexer.lo: ../include/net-snmp/library/oid_stash.h
+./helpers/multiplexer.lo: ../include/net-snmp/library/check_varbind.h
+./helpers/multiplexer.lo: ../include/net-snmp/version.h
+./helpers/multiplexer.lo: ../include/net-snmp/session_api.h
+./helpers/multiplexer.lo: ../include/net-snmp/library/snmp_transport.h
+./helpers/multiplexer.lo: ../include/net-snmp/library/snmpCallbackDomain.h
+./helpers/multiplexer.lo: ../include/net-snmp/library/snmpUnixDomain.h
+./helpers/multiplexer.lo: ../include/net-snmp/library/snmpUDPDomain.h
+./helpers/multiplexer.lo: ../include/net-snmp/library/snmpTCPDomain.h
+./helpers/multiplexer.lo: ../include/net-snmp/library/snmpUDPIPv6Domain.h
+./helpers/multiplexer.lo: ../include/net-snmp/library/snmpTCPIPv6Domain.h
+./helpers/multiplexer.lo: ../include/net-snmp/library/snmpIPXDomain.h
+./helpers/multiplexer.lo: ../include/net-snmp/library/ucd_compat.h
+./helpers/multiplexer.lo: ../include/net-snmp/pdu_api.h
+./helpers/multiplexer.lo: ../include/net-snmp/mib_api.h
+./helpers/multiplexer.lo: ../include/net-snmp/library/mib.h
+./helpers/multiplexer.lo: ../include/net-snmp/library/parse.h
+./helpers/multiplexer.lo: ../include/net-snmp/varbind_api.h
+./helpers/multiplexer.lo: ../include/net-snmp/config_api.h
+./helpers/multiplexer.lo: ../include/net-snmp/library/read_config.h
+./helpers/multiplexer.lo: ../include/net-snmp/library/default_store.h
+./helpers/multiplexer.lo: ../include/net-snmp/library/snmp_parse_args.h
+./helpers/multiplexer.lo: ../include/net-snmp/library/snmp_enum.h
+./helpers/multiplexer.lo: ../include/net-snmp/library/vacm.h
+./helpers/multiplexer.lo: ../include/net-snmp/output_api.h
+./helpers/multiplexer.lo: ../include/net-snmp/library/snmp_debug.h
+./helpers/multiplexer.lo: ../include/net-snmp/library/snmp_logging.h
+./helpers/multiplexer.lo: ../include/net-snmp/snmpv3_api.h
+./helpers/multiplexer.lo: ../include/net-snmp/library/snmpv3.h
+./helpers/multiplexer.lo: ../include/net-snmp/library/transform_oids.h
+./helpers/multiplexer.lo: ../include/net-snmp/library/keytools.h
+./helpers/multiplexer.lo: ../include/net-snmp/library/scapi.h
+./helpers/multiplexer.lo: ../include/net-snmp/library/lcd_time.h
+./helpers/multiplexer.lo: ../include/net-snmp/library/snmp_secmod.h
+./helpers/multiplexer.lo: ../include/net-snmp/library/snmpv3-security-includes.h
+./helpers/multiplexer.lo: ../include/net-snmp/library/snmpusm.h
+./helpers/multiplexer.lo: ../include/net-snmp/agent/net-snmp-agent-includes.h
+./helpers/multiplexer.lo: ../include/net-snmp/agent/snmp_agent.h
+./helpers/multiplexer.lo: ../include/net-snmp/agent/snmp_vars.h
+./helpers/multiplexer.lo: ../include/net-snmp/agent/agent_handler.h
+./helpers/multiplexer.lo: ../include/net-snmp/agent/var_struct.h
+./helpers/multiplexer.lo: ../include/net-snmp/agent/agent_registry.h
+./helpers/multiplexer.lo: ../include/net-snmp/agent/ds_agent.h
+./helpers/multiplexer.lo: ../include/net-snmp/agent/agent_read_config.h
+./helpers/multiplexer.lo: ../include/net-snmp/agent/agent_trap.h
+./helpers/multiplexer.lo: ../include/net-snmp/agent/all_helpers.h
+./helpers/multiplexer.lo: ../include/net-snmp/agent/instance.h
+./helpers/multiplexer.lo: ../include/net-snmp/agent/multiplexer.h
+./helpers/multiplexer.lo: ../include/net-snmp/agent/null.h
+./helpers/multiplexer.lo: ../include/net-snmp/agent/debug_handler.h
+./helpers/multiplexer.lo: ../include/net-snmp/agent/old_api.h
+./helpers/multiplexer.lo: ../include/net-snmp/agent/read_only.h
+./helpers/multiplexer.lo: ../include/net-snmp/agent/serialize.h
+./helpers/multiplexer.lo: ../include/net-snmp/agent/bulk_to_next.h
+./helpers/multiplexer.lo: ../include/net-snmp/agent/mode_end_call.h
+./helpers/multiplexer.lo: ../include/net-snmp/agent/table.h
+./helpers/multiplexer.lo: ../include/net-snmp/agent/table_data.h
+./helpers/multiplexer.lo: ../include/net-snmp/agent/table_dataset.h
+./helpers/multiplexer.lo: ../include/net-snmp/agent/table_iterator.h
+./helpers/multiplexer.lo: ../include/net-snmp/agent/mib_module_config.h
+./helpers/null.lo: ../include/net-snmp/net-snmp-config.h
+./helpers/null.lo: ../include/net-snmp/system/linux.h
+./helpers/null.lo: ../include/net-snmp/system/sysv.h
+./helpers/null.lo: ../include/net-snmp/system/generic.h
+./helpers/null.lo: ../include/net-snmp/machine/generic.h
+./helpers/null.lo: ../include/net-snmp/net-snmp-includes.h
+./helpers/null.lo:  ../include/net-snmp/definitions.h
+./helpers/null.lo: ../include/net-snmp/types.h
+./helpers/null.lo: ../include/net-snmp/library/snmp_api.h
+./helpers/null.lo: ../include/net-snmp/library/asn1.h
+./helpers/null.lo: ../include/net-snmp/library/snmp_impl.h
+./helpers/null.lo: ../include/net-snmp/library/snmp.h
+./helpers/null.lo: ../include/net-snmp/library/snmp-tc.h
+./helpers/null.lo: ../include/net-snmp/utilities.h
+./helpers/null.lo: ../include/net-snmp/library/snmp_client.h
+./helpers/null.lo: ../include/net-snmp/library/getopt.h
+./helpers/null.lo: ../include/net-snmp/library/system.h
+./helpers/null.lo: ../include/net-snmp/library/tools.h
+./helpers/null.lo: ../include/net-snmp/library/int64.h
+./helpers/null.lo: ../include/net-snmp/library/mt_support.h
+./helpers/null.lo: ../include/net-snmp/library/snmp_alarm.h
+./helpers/null.lo: ../include/net-snmp/library/data_list.h
+./helpers/null.lo: ../include/net-snmp/library/callback.h
+./helpers/null.lo: ../include/net-snmp/library/oid_stash.h
+./helpers/null.lo: ../include/net-snmp/library/check_varbind.h
+./helpers/null.lo: ../include/net-snmp/version.h
+./helpers/null.lo: ../include/net-snmp/session_api.h
+./helpers/null.lo: ../include/net-snmp/library/snmp_transport.h
+./helpers/null.lo: ../include/net-snmp/library/snmpCallbackDomain.h
+./helpers/null.lo: ../include/net-snmp/library/snmpUnixDomain.h
+./helpers/null.lo: ../include/net-snmp/library/snmpUDPDomain.h
+./helpers/null.lo: ../include/net-snmp/library/snmpTCPDomain.h
+./helpers/null.lo: ../include/net-snmp/library/snmpUDPIPv6Domain.h
+./helpers/null.lo: ../include/net-snmp/library/snmpTCPIPv6Domain.h
+./helpers/null.lo: ../include/net-snmp/library/snmpIPXDomain.h
+./helpers/null.lo: ../include/net-snmp/library/ucd_compat.h
+./helpers/null.lo: ../include/net-snmp/pdu_api.h
+./helpers/null.lo: ../include/net-snmp/mib_api.h
+./helpers/null.lo: ../include/net-snmp/library/mib.h
+./helpers/null.lo: ../include/net-snmp/library/parse.h
+./helpers/null.lo: ../include/net-snmp/varbind_api.h
+./helpers/null.lo: ../include/net-snmp/config_api.h
+./helpers/null.lo: ../include/net-snmp/library/read_config.h
+./helpers/null.lo: ../include/net-snmp/library/default_store.h
+./helpers/null.lo: ../include/net-snmp/library/snmp_parse_args.h
+./helpers/null.lo: ../include/net-snmp/library/snmp_enum.h
+./helpers/null.lo: ../include/net-snmp/library/vacm.h
+./helpers/null.lo: ../include/net-snmp/output_api.h
+./helpers/null.lo: ../include/net-snmp/library/snmp_debug.h
+./helpers/null.lo: ../include/net-snmp/library/snmp_logging.h
+./helpers/null.lo: ../include/net-snmp/snmpv3_api.h
+./helpers/null.lo: ../include/net-snmp/library/snmpv3.h
+./helpers/null.lo: ../include/net-snmp/library/transform_oids.h
+./helpers/null.lo: ../include/net-snmp/library/keytools.h
+./helpers/null.lo: ../include/net-snmp/library/scapi.h
+./helpers/null.lo: ../include/net-snmp/library/lcd_time.h
+./helpers/null.lo: ../include/net-snmp/library/snmp_secmod.h
+./helpers/null.lo: ../include/net-snmp/library/snmpv3-security-includes.h
+./helpers/null.lo: ../include/net-snmp/library/snmpusm.h
+./helpers/null.lo: ../include/net-snmp/agent/net-snmp-agent-includes.h
+./helpers/null.lo: ../include/net-snmp/agent/snmp_agent.h
+./helpers/null.lo: ../include/net-snmp/agent/snmp_vars.h
+./helpers/null.lo: ../include/net-snmp/agent/agent_handler.h
+./helpers/null.lo: ../include/net-snmp/agent/var_struct.h
+./helpers/null.lo: ../include/net-snmp/agent/agent_registry.h
+./helpers/null.lo: ../include/net-snmp/agent/ds_agent.h
+./helpers/null.lo: ../include/net-snmp/agent/agent_read_config.h
+./helpers/null.lo: ../include/net-snmp/agent/agent_trap.h
+./helpers/null.lo: ../include/net-snmp/agent/all_helpers.h
+./helpers/null.lo: ../include/net-snmp/agent/instance.h
+./helpers/null.lo: ../include/net-snmp/agent/multiplexer.h
+./helpers/null.lo: ../include/net-snmp/agent/null.h
+./helpers/null.lo: ../include/net-snmp/agent/debug_handler.h
+./helpers/null.lo: ../include/net-snmp/agent/old_api.h
+./helpers/null.lo: ../include/net-snmp/agent/read_only.h
+./helpers/null.lo: ../include/net-snmp/agent/serialize.h
+./helpers/null.lo: ../include/net-snmp/agent/bulk_to_next.h
+./helpers/null.lo: ../include/net-snmp/agent/mode_end_call.h
+./helpers/null.lo: ../include/net-snmp/agent/table.h
+./helpers/null.lo: ../include/net-snmp/agent/table_data.h
+./helpers/null.lo: ../include/net-snmp/agent/table_dataset.h
+./helpers/null.lo: ../include/net-snmp/agent/table_iterator.h
+./helpers/null.lo: ../include/net-snmp/agent/mib_module_config.h
+./helpers/old_api.lo: ../include/net-snmp/net-snmp-config.h
+./helpers/old_api.lo: ../include/net-snmp/system/linux.h
+./helpers/old_api.lo: ../include/net-snmp/system/sysv.h
+./helpers/old_api.lo: ../include/net-snmp/system/generic.h
+./helpers/old_api.lo: ../include/net-snmp/machine/generic.h
+./helpers/old_api.lo: ../include/net-snmp/net-snmp-includes.h
+./helpers/old_api.lo: ../include/net-snmp/definitions.h
+./helpers/old_api.lo: ../include/net-snmp/types.h
+./helpers/old_api.lo: ../include/net-snmp/library/snmp_api.h
+./helpers/old_api.lo: ../include/net-snmp/library/asn1.h
+./helpers/old_api.lo: ../include/net-snmp/library/snmp_impl.h
+./helpers/old_api.lo: ../include/net-snmp/library/snmp.h
+./helpers/old_api.lo: ../include/net-snmp/library/snmp-tc.h
+./helpers/old_api.lo: ../include/net-snmp/utilities.h
+./helpers/old_api.lo: ../include/net-snmp/library/snmp_client.h
+./helpers/old_api.lo: ../include/net-snmp/library/getopt.h
+./helpers/old_api.lo: ../include/net-snmp/library/system.h
+./helpers/old_api.lo: ../include/net-snmp/library/tools.h
+./helpers/old_api.lo: ../include/net-snmp/library/int64.h
+./helpers/old_api.lo: ../include/net-snmp/library/mt_support.h
+./helpers/old_api.lo: ../include/net-snmp/library/snmp_alarm.h
+./helpers/old_api.lo: ../include/net-snmp/library/data_list.h
+./helpers/old_api.lo: ../include/net-snmp/library/callback.h
+./helpers/old_api.lo: ../include/net-snmp/library/oid_stash.h
+./helpers/old_api.lo: ../include/net-snmp/library/check_varbind.h
+./helpers/old_api.lo: ../include/net-snmp/version.h
+./helpers/old_api.lo: ../include/net-snmp/session_api.h
+./helpers/old_api.lo: ../include/net-snmp/library/snmp_transport.h
+./helpers/old_api.lo: ../include/net-snmp/library/snmpCallbackDomain.h
+./helpers/old_api.lo: ../include/net-snmp/library/snmpUnixDomain.h
+./helpers/old_api.lo: ../include/net-snmp/library/snmpUDPDomain.h
+./helpers/old_api.lo: ../include/net-snmp/library/snmpTCPDomain.h
+./helpers/old_api.lo: ../include/net-snmp/library/snmpUDPIPv6Domain.h
+./helpers/old_api.lo: ../include/net-snmp/library/snmpTCPIPv6Domain.h
+./helpers/old_api.lo: ../include/net-snmp/library/snmpIPXDomain.h
+./helpers/old_api.lo: ../include/net-snmp/library/ucd_compat.h
+./helpers/old_api.lo: ../include/net-snmp/pdu_api.h
+./helpers/old_api.lo: ../include/net-snmp/mib_api.h
+./helpers/old_api.lo: ../include/net-snmp/library/mib.h
+./helpers/old_api.lo: ../include/net-snmp/library/parse.h
+./helpers/old_api.lo: ../include/net-snmp/varbind_api.h
+./helpers/old_api.lo: ../include/net-snmp/config_api.h
+./helpers/old_api.lo: ../include/net-snmp/library/read_config.h
+./helpers/old_api.lo: ../include/net-snmp/library/default_store.h
+./helpers/old_api.lo: ../include/net-snmp/library/snmp_parse_args.h
+./helpers/old_api.lo: ../include/net-snmp/library/snmp_enum.h
+./helpers/old_api.lo: ../include/net-snmp/library/vacm.h
+./helpers/old_api.lo: ../include/net-snmp/output_api.h
+./helpers/old_api.lo: ../include/net-snmp/library/snmp_debug.h
+./helpers/old_api.lo: ../include/net-snmp/library/snmp_logging.h
+./helpers/old_api.lo: ../include/net-snmp/snmpv3_api.h
+./helpers/old_api.lo: ../include/net-snmp/library/snmpv3.h
+./helpers/old_api.lo: ../include/net-snmp/library/transform_oids.h
+./helpers/old_api.lo: ../include/net-snmp/library/keytools.h
+./helpers/old_api.lo: ../include/net-snmp/library/scapi.h
+./helpers/old_api.lo: ../include/net-snmp/library/lcd_time.h
+./helpers/old_api.lo: ../include/net-snmp/library/snmp_secmod.h
+./helpers/old_api.lo: ../include/net-snmp/library/snmpv3-security-includes.h
+./helpers/old_api.lo: ../include/net-snmp/library/snmpusm.h
+./helpers/old_api.lo: ../include/net-snmp/agent/net-snmp-agent-includes.h
+./helpers/old_api.lo: ../include/net-snmp/agent/snmp_agent.h
+./helpers/old_api.lo: ../include/net-snmp/agent/snmp_vars.h
+./helpers/old_api.lo: ../include/net-snmp/agent/agent_handler.h
+./helpers/old_api.lo: ../include/net-snmp/agent/var_struct.h
+./helpers/old_api.lo: ../include/net-snmp/agent/agent_registry.h
+./helpers/old_api.lo: ../include/net-snmp/agent/ds_agent.h
+./helpers/old_api.lo: ../include/net-snmp/agent/agent_read_config.h
+./helpers/old_api.lo: ../include/net-snmp/agent/agent_trap.h
+./helpers/old_api.lo: ../include/net-snmp/agent/all_helpers.h
+./helpers/old_api.lo: ../include/net-snmp/agent/instance.h
+./helpers/old_api.lo: ../include/net-snmp/agent/multiplexer.h
+./helpers/old_api.lo: ../include/net-snmp/agent/null.h
+./helpers/old_api.lo: ../include/net-snmp/agent/debug_handler.h
+./helpers/old_api.lo: ../include/net-snmp/agent/old_api.h
+./helpers/old_api.lo: ../include/net-snmp/agent/read_only.h
+./helpers/old_api.lo: ../include/net-snmp/agent/serialize.h
+./helpers/old_api.lo: ../include/net-snmp/agent/bulk_to_next.h
+./helpers/old_api.lo: ../include/net-snmp/agent/mode_end_call.h
+./helpers/old_api.lo: ../include/net-snmp/agent/table.h
+./helpers/old_api.lo: ../include/net-snmp/agent/table_data.h
+./helpers/old_api.lo: ../include/net-snmp/agent/table_dataset.h
+./helpers/old_api.lo: ../include/net-snmp/agent/table_iterator.h
+./helpers/old_api.lo: ../include/net-snmp/agent/mib_module_config.h
+./helpers/old_api.lo: ../include/net-snmp/agent/agent_callbacks.h
+./helpers/read_only.lo: ../include/net-snmp/net-snmp-config.h
+./helpers/read_only.lo: ../include/net-snmp/system/linux.h
+./helpers/read_only.lo: ../include/net-snmp/system/sysv.h
+./helpers/read_only.lo: ../include/net-snmp/system/generic.h
+./helpers/read_only.lo: ../include/net-snmp/machine/generic.h
+./helpers/read_only.lo: ../include/net-snmp/net-snmp-includes.h
+./helpers/read_only.lo: ../include/net-snmp/definitions.h
+./helpers/read_only.lo: ../include/net-snmp/types.h
+./helpers/read_only.lo: ../include/net-snmp/library/snmp_api.h
+./helpers/read_only.lo: ../include/net-snmp/library/asn1.h
+./helpers/read_only.lo: ../include/net-snmp/library/snmp_impl.h
+./helpers/read_only.lo: ../include/net-snmp/library/snmp.h
+./helpers/read_only.lo: ../include/net-snmp/library/snmp-tc.h
+./helpers/read_only.lo: ../include/net-snmp/utilities.h
+./helpers/read_only.lo: ../include/net-snmp/library/snmp_client.h
+./helpers/read_only.lo: ../include/net-snmp/library/getopt.h
+./helpers/read_only.lo: ../include/net-snmp/library/system.h
+./helpers/read_only.lo: ../include/net-snmp/library/tools.h
+./helpers/read_only.lo: ../include/net-snmp/library/int64.h
+./helpers/read_only.lo: ../include/net-snmp/library/mt_support.h
+./helpers/read_only.lo: ../include/net-snmp/library/snmp_alarm.h
+./helpers/read_only.lo: ../include/net-snmp/library/data_list.h
+./helpers/read_only.lo: ../include/net-snmp/library/callback.h
+./helpers/read_only.lo: ../include/net-snmp/library/oid_stash.h
+./helpers/read_only.lo: ../include/net-snmp/library/check_varbind.h
+./helpers/read_only.lo: ../include/net-snmp/version.h
+./helpers/read_only.lo: ../include/net-snmp/session_api.h
+./helpers/read_only.lo: ../include/net-snmp/library/snmp_transport.h
+./helpers/read_only.lo: ../include/net-snmp/library/snmpCallbackDomain.h
+./helpers/read_only.lo: ../include/net-snmp/library/snmpUnixDomain.h
+./helpers/read_only.lo: ../include/net-snmp/library/snmpUDPDomain.h
+./helpers/read_only.lo: ../include/net-snmp/library/snmpTCPDomain.h
+./helpers/read_only.lo: ../include/net-snmp/library/snmpUDPIPv6Domain.h
+./helpers/read_only.lo: ../include/net-snmp/library/snmpTCPIPv6Domain.h
+./helpers/read_only.lo: ../include/net-snmp/library/snmpIPXDomain.h
+./helpers/read_only.lo: ../include/net-snmp/library/ucd_compat.h
+./helpers/read_only.lo: ../include/net-snmp/pdu_api.h
+./helpers/read_only.lo: ../include/net-snmp/mib_api.h
+./helpers/read_only.lo: ../include/net-snmp/library/mib.h
+./helpers/read_only.lo: ../include/net-snmp/library/parse.h
+./helpers/read_only.lo: ../include/net-snmp/varbind_api.h
+./helpers/read_only.lo: ../include/net-snmp/config_api.h
+./helpers/read_only.lo: ../include/net-snmp/library/read_config.h
+./helpers/read_only.lo: ../include/net-snmp/library/default_store.h
+./helpers/read_only.lo: ../include/net-snmp/library/snmp_parse_args.h
+./helpers/read_only.lo: ../include/net-snmp/library/snmp_enum.h
+./helpers/read_only.lo: ../include/net-snmp/library/vacm.h
+./helpers/read_only.lo: ../include/net-snmp/output_api.h
+./helpers/read_only.lo: ../include/net-snmp/library/snmp_debug.h
+./helpers/read_only.lo: ../include/net-snmp/library/snmp_logging.h
+./helpers/read_only.lo: ../include/net-snmp/snmpv3_api.h
+./helpers/read_only.lo: ../include/net-snmp/library/snmpv3.h
+./helpers/read_only.lo: ../include/net-snmp/library/transform_oids.h
+./helpers/read_only.lo: ../include/net-snmp/library/keytools.h
+./helpers/read_only.lo: ../include/net-snmp/library/scapi.h
+./helpers/read_only.lo: ../include/net-snmp/library/lcd_time.h
+./helpers/read_only.lo: ../include/net-snmp/library/snmp_secmod.h
+./helpers/read_only.lo: ../include/net-snmp/library/snmpv3-security-includes.h
+./helpers/read_only.lo: ../include/net-snmp/library/snmpusm.h
+./helpers/read_only.lo: ../include/net-snmp/agent/net-snmp-agent-includes.h
+./helpers/read_only.lo: ../include/net-snmp/agent/snmp_agent.h
+./helpers/read_only.lo: ../include/net-snmp/agent/snmp_vars.h
+./helpers/read_only.lo: ../include/net-snmp/agent/agent_handler.h
+./helpers/read_only.lo: ../include/net-snmp/agent/var_struct.h
+./helpers/read_only.lo: ../include/net-snmp/agent/agent_registry.h
+./helpers/read_only.lo: ../include/net-snmp/agent/ds_agent.h
+./helpers/read_only.lo: ../include/net-snmp/agent/agent_read_config.h
+./helpers/read_only.lo: ../include/net-snmp/agent/agent_trap.h
+./helpers/read_only.lo: ../include/net-snmp/agent/all_helpers.h
+./helpers/read_only.lo: ../include/net-snmp/agent/instance.h
+./helpers/read_only.lo: ../include/net-snmp/agent/multiplexer.h
+./helpers/read_only.lo: ../include/net-snmp/agent/null.h
+./helpers/read_only.lo: ../include/net-snmp/agent/debug_handler.h
+./helpers/read_only.lo: ../include/net-snmp/agent/old_api.h
+./helpers/read_only.lo: ../include/net-snmp/agent/read_only.h
+./helpers/read_only.lo: ../include/net-snmp/agent/serialize.h
+./helpers/read_only.lo: ../include/net-snmp/agent/bulk_to_next.h
+./helpers/read_only.lo: ../include/net-snmp/agent/mode_end_call.h
+./helpers/read_only.lo: ../include/net-snmp/agent/table.h
+./helpers/read_only.lo: ../include/net-snmp/agent/table_data.h
+./helpers/read_only.lo: ../include/net-snmp/agent/table_dataset.h
+./helpers/read_only.lo: ../include/net-snmp/agent/table_iterator.h
+./helpers/read_only.lo: ../include/net-snmp/agent/mib_module_config.h
+./helpers/scalar1.lo: ../include/net-snmp/net-snmp-config.h
+./helpers/scalar1.lo: ../include/net-snmp/system/linux.h
+./helpers/scalar1.lo: ../include/net-snmp/system/sysv.h
+./helpers/scalar1.lo: ../include/net-snmp/system/generic.h
+./helpers/scalar1.lo: ../include/net-snmp/machine/generic.h
+./helpers/scalar1.lo: ../include/net-snmp/net-snmp-includes.h
+./helpers/scalar1.lo: ../include/net-snmp/definitions.h
+./helpers/scalar1.lo: ../include/net-snmp/types.h
+./helpers/scalar1.lo: ../include/net-snmp/library/snmp_api.h
+./helpers/scalar1.lo: ../include/net-snmp/library/asn1.h
+./helpers/scalar1.lo: ../include/net-snmp/library/snmp_impl.h
+./helpers/scalar1.lo: ../include/net-snmp/library/snmp.h
+./helpers/scalar1.lo: ../include/net-snmp/library/snmp-tc.h
+./helpers/scalar1.lo: ../include/net-snmp/utilities.h
+./helpers/scalar1.lo: ../include/net-snmp/library/snmp_client.h
+./helpers/scalar1.lo: ../include/net-snmp/library/getopt.h
+./helpers/scalar1.lo: ../include/net-snmp/library/system.h
+./helpers/scalar1.lo: ../include/net-snmp/library/tools.h
+./helpers/scalar1.lo: ../include/net-snmp/library/int64.h
+./helpers/scalar1.lo: ../include/net-snmp/library/mt_support.h
+./helpers/scalar1.lo: ../include/net-snmp/library/snmp_alarm.h
+./helpers/scalar1.lo: ../include/net-snmp/library/data_list.h
+./helpers/scalar1.lo: ../include/net-snmp/library/callback.h
+./helpers/scalar1.lo: ../include/net-snmp/library/oid_stash.h
+./helpers/scalar1.lo: ../include/net-snmp/library/check_varbind.h
+./helpers/scalar1.lo: ../include/net-snmp/version.h
+./helpers/scalar1.lo: ../include/net-snmp/session_api.h
+./helpers/scalar1.lo: ../include/net-snmp/library/snmp_transport.h
+./helpers/scalar1.lo: ../include/net-snmp/library/snmpCallbackDomain.h
+./helpers/scalar1.lo: ../include/net-snmp/library/snmpUnixDomain.h
+./helpers/scalar1.lo: ../include/net-snmp/library/snmpUDPDomain.h
+./helpers/scalar1.lo: ../include/net-snmp/library/snmpTCPDomain.h
+./helpers/scalar1.lo: ../include/net-snmp/library/snmpUDPIPv6Domain.h
+./helpers/scalar1.lo: ../include/net-snmp/library/snmpTCPIPv6Domain.h
+./helpers/scalar1.lo: ../include/net-snmp/library/snmpIPXDomain.h
+./helpers/scalar1.lo: ../include/net-snmp/library/ucd_compat.h
+./helpers/scalar1.lo: ../include/net-snmp/pdu_api.h
+./helpers/scalar1.lo: ../include/net-snmp/mib_api.h
+./helpers/scalar1.lo: ../include/net-snmp/library/mib.h
+./helpers/scalar1.lo: ../include/net-snmp/library/parse.h
+./helpers/scalar1.lo: ../include/net-snmp/varbind_api.h
+./helpers/scalar1.lo: ../include/net-snmp/config_api.h
+./helpers/scalar1.lo: ../include/net-snmp/library/read_config.h
+./helpers/scalar1.lo: ../include/net-snmp/library/default_store.h
+./helpers/scalar1.lo: ../include/net-snmp/library/snmp_parse_args.h
+./helpers/scalar1.lo: ../include/net-snmp/library/snmp_enum.h
+./helpers/scalar1.lo: ../include/net-snmp/library/vacm.h
+./helpers/scalar1.lo: ../include/net-snmp/output_api.h
+./helpers/scalar1.lo: ../include/net-snmp/library/snmp_debug.h
+./helpers/scalar1.lo: ../include/net-snmp/library/snmp_logging.h
+./helpers/scalar1.lo: ../include/net-snmp/snmpv3_api.h
+./helpers/scalar1.lo: ../include/net-snmp/library/snmpv3.h
+./helpers/scalar1.lo: ../include/net-snmp/library/transform_oids.h
+./helpers/scalar1.lo: ../include/net-snmp/library/keytools.h
+./helpers/scalar1.lo: ../include/net-snmp/library/scapi.h
+./helpers/scalar1.lo: ../include/net-snmp/library/lcd_time.h
+./helpers/scalar1.lo: ../include/net-snmp/library/snmp_secmod.h
+./helpers/scalar1.lo: ../include/net-snmp/library/snmpv3-security-includes.h
+./helpers/scalar1.lo: ../include/net-snmp/library/snmpusm.h
+./helpers/scalar1.lo: ../include/net-snmp/agent/net-snmp-agent-includes.h
+./helpers/scalar1.lo: ../include/net-snmp/agent/snmp_agent.h
+./helpers/scalar1.lo: ../include/net-snmp/agent/snmp_vars.h
+./helpers/scalar1.lo: ../include/net-snmp/agent/agent_handler.h
+./helpers/scalar1.lo: ../include/net-snmp/agent/var_struct.h
+./helpers/scalar1.lo: ../include/net-snmp/agent/agent_registry.h
+./helpers/scalar1.lo: ../include/net-snmp/agent/ds_agent.h
+./helpers/scalar1.lo: ../include/net-snmp/agent/agent_read_config.h
+./helpers/scalar1.lo: ../include/net-snmp/agent/agent_trap.h
+./helpers/scalar1.lo: ../include/net-snmp/agent/all_helpers.h
+./helpers/scalar1.lo: ../include/net-snmp/agent/instance.h
+./helpers/scalar1.lo: ../include/net-snmp/agent/multiplexer.h
+./helpers/scalar1.lo: ../include/net-snmp/agent/null.h
+./helpers/scalar1.lo: ../include/net-snmp/agent/debug_handler.h
+./helpers/scalar1.lo: ../include/net-snmp/agent/old_api.h
+./helpers/scalar1.lo: ../include/net-snmp/agent/read_only.h
+./helpers/scalar1.lo: ../include/net-snmp/agent/serialize.h
+./helpers/scalar1.lo: ../include/net-snmp/agent/bulk_to_next.h
+./helpers/scalar1.lo: ../include/net-snmp/agent/mode_end_call.h
+./helpers/scalar1.lo: ../include/net-snmp/agent/table.h
+./helpers/scalar1.lo: ../include/net-snmp/agent/table_data.h
+./helpers/scalar1.lo: ../include/net-snmp/agent/table_dataset.h
+./helpers/scalar1.lo: ../include/net-snmp/agent/table_iterator.h
+./helpers/scalar1.lo: ../include/net-snmp/agent/mib_module_config.h
+./helpers/scalar1.lo: ../include/net-snmp/agent/scalar.h
+./helpers/scalar.lo: ../include/net-snmp/net-snmp-config.h
+./helpers/scalar.lo: ../include/net-snmp/system/linux.h
+./helpers/scalar.lo: ../include/net-snmp/system/sysv.h
+./helpers/scalar.lo: ../include/net-snmp/system/generic.h
+./helpers/scalar.lo: ../include/net-snmp/machine/generic.h
+./helpers/scalar.lo: ../include/net-snmp/net-snmp-includes.h
+./helpers/scalar.lo: ../include/net-snmp/definitions.h
+./helpers/scalar.lo: ../include/net-snmp/types.h
+./helpers/scalar.lo: ../include/net-snmp/library/snmp_api.h
+./helpers/scalar.lo: ../include/net-snmp/library/asn1.h
+./helpers/scalar.lo: ../include/net-snmp/library/snmp_impl.h
+./helpers/scalar.lo: ../include/net-snmp/library/snmp.h
+./helpers/scalar.lo: ../include/net-snmp/library/snmp-tc.h
+./helpers/scalar.lo: ../include/net-snmp/utilities.h
+./helpers/scalar.lo: ../include/net-snmp/library/snmp_client.h
+./helpers/scalar.lo: ../include/net-snmp/library/getopt.h
+./helpers/scalar.lo: ../include/net-snmp/library/system.h
+./helpers/scalar.lo: ../include/net-snmp/library/tools.h
+./helpers/scalar.lo: ../include/net-snmp/library/int64.h
+./helpers/scalar.lo: ../include/net-snmp/library/mt_support.h
+./helpers/scalar.lo: ../include/net-snmp/library/snmp_alarm.h
+./helpers/scalar.lo: ../include/net-snmp/library/data_list.h
+./helpers/scalar.lo: ../include/net-snmp/library/callback.h
+./helpers/scalar.lo: ../include/net-snmp/library/oid_stash.h
+./helpers/scalar.lo: ../include/net-snmp/library/check_varbind.h
+./helpers/scalar.lo: ../include/net-snmp/version.h
+./helpers/scalar.lo: ../include/net-snmp/session_api.h
+./helpers/scalar.lo: ../include/net-snmp/library/snmp_transport.h
+./helpers/scalar.lo: ../include/net-snmp/library/snmpCallbackDomain.h
+./helpers/scalar.lo: ../include/net-snmp/library/snmpUnixDomain.h
+./helpers/scalar.lo: ../include/net-snmp/library/snmpUDPDomain.h
+./helpers/scalar.lo: ../include/net-snmp/library/snmpTCPDomain.h
+./helpers/scalar.lo: ../include/net-snmp/library/snmpUDPIPv6Domain.h
+./helpers/scalar.lo: ../include/net-snmp/library/snmpTCPIPv6Domain.h
+./helpers/scalar.lo: ../include/net-snmp/library/snmpIPXDomain.h
+./helpers/scalar.lo: ../include/net-snmp/library/ucd_compat.h
+./helpers/scalar.lo: ../include/net-snmp/pdu_api.h
+./helpers/scalar.lo: ../include/net-snmp/mib_api.h
+./helpers/scalar.lo: ../include/net-snmp/library/mib.h
+./helpers/scalar.lo: ../include/net-snmp/library/parse.h
+./helpers/scalar.lo: ../include/net-snmp/varbind_api.h
+./helpers/scalar.lo: ../include/net-snmp/config_api.h
+./helpers/scalar.lo: ../include/net-snmp/library/read_config.h
+./helpers/scalar.lo: ../include/net-snmp/library/default_store.h
+./helpers/scalar.lo: ../include/net-snmp/library/snmp_parse_args.h
+./helpers/scalar.lo: ../include/net-snmp/library/snmp_enum.h
+./helpers/scalar.lo: ../include/net-snmp/library/vacm.h
+./helpers/scalar.lo: ../include/net-snmp/output_api.h
+./helpers/scalar.lo: ../include/net-snmp/library/snmp_debug.h
+./helpers/scalar.lo: ../include/net-snmp/library/snmp_logging.h
+./helpers/scalar.lo: ../include/net-snmp/snmpv3_api.h
+./helpers/scalar.lo: ../include/net-snmp/library/snmpv3.h
+./helpers/scalar.lo: ../include/net-snmp/library/transform_oids.h
+./helpers/scalar.lo: ../include/net-snmp/library/keytools.h
+./helpers/scalar.lo: ../include/net-snmp/library/scapi.h
+./helpers/scalar.lo: ../include/net-snmp/library/lcd_time.h
+./helpers/scalar.lo: ../include/net-snmp/library/snmp_secmod.h
+./helpers/scalar.lo: ../include/net-snmp/library/snmpv3-security-includes.h
+./helpers/scalar.lo: ../include/net-snmp/library/snmpusm.h
+./helpers/scalar.lo: ../include/net-snmp/agent/net-snmp-agent-includes.h
+./helpers/scalar.lo: ../include/net-snmp/agent/snmp_agent.h
+./helpers/scalar.lo: ../include/net-snmp/agent/snmp_vars.h
+./helpers/scalar.lo: ../include/net-snmp/agent/agent_handler.h
+./helpers/scalar.lo: ../include/net-snmp/agent/var_struct.h
+./helpers/scalar.lo: ../include/net-snmp/agent/agent_registry.h
+./helpers/scalar.lo: ../include/net-snmp/agent/ds_agent.h
+./helpers/scalar.lo: ../include/net-snmp/agent/agent_read_config.h
+./helpers/scalar.lo: ../include/net-snmp/agent/agent_trap.h
+./helpers/scalar.lo: ../include/net-snmp/agent/all_helpers.h
+./helpers/scalar.lo: ../include/net-snmp/agent/instance.h
+./helpers/scalar.lo: ../include/net-snmp/agent/multiplexer.h
+./helpers/scalar.lo: ../include/net-snmp/agent/null.h
+./helpers/scalar.lo: ../include/net-snmp/agent/debug_handler.h
+./helpers/scalar.lo: ../include/net-snmp/agent/old_api.h
+./helpers/scalar.lo: ../include/net-snmp/agent/read_only.h
+./helpers/scalar.lo: ../include/net-snmp/agent/serialize.h
+./helpers/scalar.lo: ../include/net-snmp/agent/bulk_to_next.h
+./helpers/scalar.lo: ../include/net-snmp/agent/mode_end_call.h
+./helpers/scalar.lo: ../include/net-snmp/agent/table.h
+./helpers/scalar.lo: ../include/net-snmp/agent/table_data.h
+./helpers/scalar.lo: ../include/net-snmp/agent/table_dataset.h
+./helpers/scalar.lo: ../include/net-snmp/agent/table_iterator.h
+./helpers/scalar.lo: ../include/net-snmp/agent/mib_module_config.h
+./helpers/scalar.lo: ../include/net-snmp/agent/scalar.h
+./helpers/serialize.lo: ../include/net-snmp/net-snmp-config.h
+./helpers/serialize.lo: ../include/net-snmp/system/linux.h
+./helpers/serialize.lo: ../include/net-snmp/system/sysv.h
+./helpers/serialize.lo: ../include/net-snmp/system/generic.h
+./helpers/serialize.lo: ../include/net-snmp/machine/generic.h
+./helpers/serialize.lo: ../include/net-snmp/net-snmp-includes.h
+./helpers/serialize.lo: ../include/net-snmp/definitions.h
+./helpers/serialize.lo: ../include/net-snmp/types.h
+./helpers/serialize.lo: ../include/net-snmp/library/snmp_api.h
+./helpers/serialize.lo: ../include/net-snmp/library/asn1.h
+./helpers/serialize.lo: ../include/net-snmp/library/snmp_impl.h
+./helpers/serialize.lo: ../include/net-snmp/library/snmp.h
+./helpers/serialize.lo: ../include/net-snmp/library/snmp-tc.h
+./helpers/serialize.lo: ../include/net-snmp/utilities.h
+./helpers/serialize.lo: ../include/net-snmp/library/snmp_client.h
+./helpers/serialize.lo: ../include/net-snmp/library/getopt.h
+./helpers/serialize.lo: ../include/net-snmp/library/system.h
+./helpers/serialize.lo: ../include/net-snmp/library/tools.h
+./helpers/serialize.lo: ../include/net-snmp/library/int64.h
+./helpers/serialize.lo: ../include/net-snmp/library/mt_support.h
+./helpers/serialize.lo: ../include/net-snmp/library/snmp_alarm.h
+./helpers/serialize.lo: ../include/net-snmp/library/data_list.h
+./helpers/serialize.lo: ../include/net-snmp/library/callback.h
+./helpers/serialize.lo: ../include/net-snmp/library/oid_stash.h
+./helpers/serialize.lo: ../include/net-snmp/library/check_varbind.h
+./helpers/serialize.lo: ../include/net-snmp/version.h
+./helpers/serialize.lo: ../include/net-snmp/session_api.h
+./helpers/serialize.lo: ../include/net-snmp/library/snmp_transport.h
+./helpers/serialize.lo: ../include/net-snmp/library/snmpCallbackDomain.h
+./helpers/serialize.lo: ../include/net-snmp/library/snmpUnixDomain.h
+./helpers/serialize.lo: ../include/net-snmp/library/snmpUDPDomain.h
+./helpers/serialize.lo: ../include/net-snmp/library/snmpTCPDomain.h
+./helpers/serialize.lo: ../include/net-snmp/library/snmpUDPIPv6Domain.h
+./helpers/serialize.lo: ../include/net-snmp/library/snmpTCPIPv6Domain.h
+./helpers/serialize.lo: ../include/net-snmp/library/snmpIPXDomain.h
+./helpers/serialize.lo: ../include/net-snmp/library/ucd_compat.h
+./helpers/serialize.lo: ../include/net-snmp/pdu_api.h
+./helpers/serialize.lo: ../include/net-snmp/mib_api.h
+./helpers/serialize.lo: ../include/net-snmp/library/mib.h
+./helpers/serialize.lo: ../include/net-snmp/library/parse.h
+./helpers/serialize.lo: ../include/net-snmp/varbind_api.h
+./helpers/serialize.lo: ../include/net-snmp/config_api.h
+./helpers/serialize.lo: ../include/net-snmp/library/read_config.h
+./helpers/serialize.lo: ../include/net-snmp/library/default_store.h
+./helpers/serialize.lo: ../include/net-snmp/library/snmp_parse_args.h
+./helpers/serialize.lo: ../include/net-snmp/library/snmp_enum.h
+./helpers/serialize.lo: ../include/net-snmp/library/vacm.h
+./helpers/serialize.lo: ../include/net-snmp/output_api.h
+./helpers/serialize.lo: ../include/net-snmp/library/snmp_debug.h
+./helpers/serialize.lo: ../include/net-snmp/library/snmp_logging.h
+./helpers/serialize.lo: ../include/net-snmp/snmpv3_api.h
+./helpers/serialize.lo: ../include/net-snmp/library/snmpv3.h
+./helpers/serialize.lo: ../include/net-snmp/library/transform_oids.h
+./helpers/serialize.lo: ../include/net-snmp/library/keytools.h
+./helpers/serialize.lo: ../include/net-snmp/library/scapi.h
+./helpers/serialize.lo: ../include/net-snmp/library/lcd_time.h
+./helpers/serialize.lo: ../include/net-snmp/library/snmp_secmod.h
+./helpers/serialize.lo: ../include/net-snmp/library/snmpv3-security-includes.h
+./helpers/serialize.lo: ../include/net-snmp/library/snmpusm.h
+./helpers/serialize.lo: ../include/net-snmp/agent/net-snmp-agent-includes.h
+./helpers/serialize.lo: ../include/net-snmp/agent/snmp_agent.h
+./helpers/serialize.lo: ../include/net-snmp/agent/snmp_vars.h
+./helpers/serialize.lo: ../include/net-snmp/agent/agent_handler.h
+./helpers/serialize.lo: ../include/net-snmp/agent/var_struct.h
+./helpers/serialize.lo: ../include/net-snmp/agent/agent_registry.h
+./helpers/serialize.lo: ../include/net-snmp/agent/ds_agent.h
+./helpers/serialize.lo: ../include/net-snmp/agent/agent_read_config.h
+./helpers/serialize.lo: ../include/net-snmp/agent/agent_trap.h
+./helpers/serialize.lo: ../include/net-snmp/agent/all_helpers.h
+./helpers/serialize.lo: ../include/net-snmp/agent/instance.h
+./helpers/serialize.lo: ../include/net-snmp/agent/multiplexer.h
+./helpers/serialize.lo: ../include/net-snmp/agent/null.h
+./helpers/serialize.lo: ../include/net-snmp/agent/debug_handler.h
+./helpers/serialize.lo: ../include/net-snmp/agent/old_api.h
+./helpers/serialize.lo: ../include/net-snmp/agent/read_only.h
+./helpers/serialize.lo: ../include/net-snmp/agent/serialize.h
+./helpers/serialize.lo: ../include/net-snmp/agent/bulk_to_next.h
+./helpers/serialize.lo: ../include/net-snmp/agent/mode_end_call.h
+./helpers/serialize.lo: ../include/net-snmp/agent/table.h
+./helpers/serialize.lo: ../include/net-snmp/agent/table_data.h
+./helpers/serialize.lo: ../include/net-snmp/agent/table_dataset.h
+./helpers/serialize.lo: ../include/net-snmp/agent/table_iterator.h
+./helpers/serialize.lo: ../include/net-snmp/agent/mib_module_config.h
+./helpers/table_array.lo: ../include/net-snmp/net-snmp-config.h
+./helpers/table_array.lo: ../include/net-snmp/system/linux.h
+./helpers/table_array.lo: ../include/net-snmp/system/sysv.h
+./helpers/table_array.lo: ../include/net-snmp/system/generic.h
+./helpers/table_array.lo: ../include/net-snmp/machine/generic.h
+./helpers/table_array.lo: ../include/net-snmp/net-snmp-includes.h
+./helpers/table_array.lo: ../include/net-snmp/definitions.h
+./helpers/table_array.lo: ../include/net-snmp/types.h
+./helpers/table_array.lo: ../include/net-snmp/library/snmp_api.h
+./helpers/table_array.lo: ../include/net-snmp/library/asn1.h
+./helpers/table_array.lo: ../include/net-snmp/library/snmp_impl.h
+./helpers/table_array.lo: ../include/net-snmp/library/snmp.h
+./helpers/table_array.lo: ../include/net-snmp/library/snmp-tc.h
+./helpers/table_array.lo: ../include/net-snmp/utilities.h
+./helpers/table_array.lo: ../include/net-snmp/library/snmp_client.h
+./helpers/table_array.lo: ../include/net-snmp/library/getopt.h
+./helpers/table_array.lo: ../include/net-snmp/library/system.h
+./helpers/table_array.lo: ../include/net-snmp/library/tools.h
+./helpers/table_array.lo: ../include/net-snmp/library/int64.h
+./helpers/table_array.lo: ../include/net-snmp/library/mt_support.h
+./helpers/table_array.lo: ../include/net-snmp/library/snmp_alarm.h
+./helpers/table_array.lo: ../include/net-snmp/library/data_list.h
+./helpers/table_array.lo: ../include/net-snmp/library/callback.h
+./helpers/table_array.lo: ../include/net-snmp/library/oid_stash.h
+./helpers/table_array.lo: ../include/net-snmp/library/check_varbind.h
+./helpers/table_array.lo: ../include/net-snmp/version.h
+./helpers/table_array.lo: ../include/net-snmp/session_api.h
+./helpers/table_array.lo: ../include/net-snmp/library/snmp_transport.h
+./helpers/table_array.lo: ../include/net-snmp/library/snmpCallbackDomain.h
+./helpers/table_array.lo: ../include/net-snmp/library/snmpUnixDomain.h
+./helpers/table_array.lo: ../include/net-snmp/library/snmpUDPDomain.h
+./helpers/table_array.lo: ../include/net-snmp/library/snmpTCPDomain.h
+./helpers/table_array.lo: ../include/net-snmp/library/snmpUDPIPv6Domain.h
+./helpers/table_array.lo: ../include/net-snmp/library/snmpTCPIPv6Domain.h
+./helpers/table_array.lo: ../include/net-snmp/library/snmpIPXDomain.h
+./helpers/table_array.lo: ../include/net-snmp/library/ucd_compat.h
+./helpers/table_array.lo: ../include/net-snmp/pdu_api.h
+./helpers/table_array.lo: ../include/net-snmp/mib_api.h
+./helpers/table_array.lo: ../include/net-snmp/library/mib.h
+./helpers/table_array.lo: ../include/net-snmp/library/parse.h
+./helpers/table_array.lo: ../include/net-snmp/varbind_api.h
+./helpers/table_array.lo: ../include/net-snmp/config_api.h
+./helpers/table_array.lo: ../include/net-snmp/library/read_config.h
+./helpers/table_array.lo: ../include/net-snmp/library/default_store.h
+./helpers/table_array.lo: ../include/net-snmp/library/snmp_parse_args.h
+./helpers/table_array.lo: ../include/net-snmp/library/snmp_enum.h
+./helpers/table_array.lo: ../include/net-snmp/library/vacm.h
+./helpers/table_array.lo: ../include/net-snmp/output_api.h
+./helpers/table_array.lo: ../include/net-snmp/library/snmp_debug.h
+./helpers/table_array.lo: ../include/net-snmp/library/snmp_logging.h
+./helpers/table_array.lo: ../include/net-snmp/snmpv3_api.h
+./helpers/table_array.lo: ../include/net-snmp/library/snmpv3.h
+./helpers/table_array.lo: ../include/net-snmp/library/transform_oids.h
+./helpers/table_array.lo: ../include/net-snmp/library/keytools.h
+./helpers/table_array.lo: ../include/net-snmp/library/scapi.h
+./helpers/table_array.lo: ../include/net-snmp/library/lcd_time.h
+./helpers/table_array.lo: ../include/net-snmp/library/snmp_secmod.h
+./helpers/table_array.lo: ../include/net-snmp/library/snmpv3-security-includes.h
+./helpers/table_array.lo: ../include/net-snmp/library/snmpusm.h
+./helpers/table_array.lo: ../include/net-snmp/agent/net-snmp-agent-includes.h
+./helpers/table_array.lo: ../include/net-snmp/agent/snmp_agent.h
+./helpers/table_array.lo: ../include/net-snmp/agent/snmp_vars.h
+./helpers/table_array.lo: ../include/net-snmp/agent/agent_handler.h
+./helpers/table_array.lo: ../include/net-snmp/agent/var_struct.h
+./helpers/table_array.lo: ../include/net-snmp/agent/agent_registry.h
+./helpers/table_array.lo: ../include/net-snmp/agent/ds_agent.h
+./helpers/table_array.lo: ../include/net-snmp/agent/agent_read_config.h
+./helpers/table_array.lo: ../include/net-snmp/agent/agent_trap.h
+./helpers/table_array.lo: ../include/net-snmp/agent/all_helpers.h
+./helpers/table_array.lo: ../include/net-snmp/agent/instance.h
+./helpers/table_array.lo: ../include/net-snmp/agent/multiplexer.h
+./helpers/table_array.lo: ../include/net-snmp/agent/null.h
+./helpers/table_array.lo: ../include/net-snmp/agent/debug_handler.h
+./helpers/table_array.lo: ../include/net-snmp/agent/old_api.h
+./helpers/table_array.lo: ../include/net-snmp/agent/read_only.h
+./helpers/table_array.lo: ../include/net-snmp/agent/serialize.h
+./helpers/table_array.lo: ../include/net-snmp/agent/bulk_to_next.h
+./helpers/table_array.lo: ../include/net-snmp/agent/mode_end_call.h
+./helpers/table_array.lo: ../include/net-snmp/agent/table.h
+./helpers/table_array.lo: ../include/net-snmp/agent/table_data.h
+./helpers/table_array.lo: ../include/net-snmp/agent/table_dataset.h
+./helpers/table_array.lo: ../include/net-snmp/agent/table_iterator.h
+./helpers/table_array.lo: ../include/net-snmp/agent/mib_module_config.h
+./helpers/table_array.lo: ../include/net-snmp/agent/table_array.h
+./helpers/table_array.lo: ../include/net-snmp/library/container.h
+./helpers/table_array.lo: ../include/net-snmp/library/factory.h
+./helpers/table_array.lo: ../include/net-snmp/library/snmp_assert.h
+./helpers/table.lo: ../include/net-snmp/net-snmp-config.h
+./helpers/table.lo: ../include/net-snmp/system/linux.h
+./helpers/table.lo: ../include/net-snmp/system/sysv.h
+./helpers/table.lo: ../include/net-snmp/system/generic.h
+./helpers/table.lo: ../include/net-snmp/machine/generic.h
+./helpers/table.lo: ../include/net-snmp/net-snmp-includes.h
+./helpers/table.lo: ../include/net-snmp/definitions.h
+./helpers/table.lo: ../include/net-snmp/types.h
+./helpers/table.lo: ../include/net-snmp/library/snmp_api.h
+./helpers/table.lo: ../include/net-snmp/library/asn1.h
+./helpers/table.lo: ../include/net-snmp/library/snmp_impl.h
+./helpers/table.lo: ../include/net-snmp/library/snmp.h
+./helpers/table.lo: ../include/net-snmp/library/snmp-tc.h
+./helpers/table.lo: ../include/net-snmp/utilities.h
+./helpers/table.lo: ../include/net-snmp/library/snmp_client.h
+./helpers/table.lo: ../include/net-snmp/library/getopt.h
+./helpers/table.lo: ../include/net-snmp/library/system.h
+./helpers/table.lo: ../include/net-snmp/library/tools.h
+./helpers/table.lo: ../include/net-snmp/library/int64.h
+./helpers/table.lo: ../include/net-snmp/library/mt_support.h
+./helpers/table.lo: ../include/net-snmp/library/snmp_alarm.h
+./helpers/table.lo: ../include/net-snmp/library/data_list.h
+./helpers/table.lo: ../include/net-snmp/library/callback.h
+./helpers/table.lo: ../include/net-snmp/library/oid_stash.h
+./helpers/table.lo: ../include/net-snmp/library/check_varbind.h
+./helpers/table.lo: ../include/net-snmp/version.h
+./helpers/table.lo: ../include/net-snmp/session_api.h
+./helpers/table.lo: ../include/net-snmp/library/snmp_transport.h
+./helpers/table.lo: ../include/net-snmp/library/snmpCallbackDomain.h
+./helpers/table.lo: ../include/net-snmp/library/snmpUnixDomain.h
+./helpers/table.lo: ../include/net-snmp/library/snmpUDPDomain.h
+./helpers/table.lo: ../include/net-snmp/library/snmpTCPDomain.h
+./helpers/table.lo: ../include/net-snmp/library/snmpUDPIPv6Domain.h
+./helpers/table.lo: ../include/net-snmp/library/snmpTCPIPv6Domain.h
+./helpers/table.lo: ../include/net-snmp/library/snmpIPXDomain.h
+./helpers/table.lo: ../include/net-snmp/library/ucd_compat.h
+./helpers/table.lo: ../include/net-snmp/pdu_api.h
+./helpers/table.lo: ../include/net-snmp/mib_api.h
+./helpers/table.lo: ../include/net-snmp/library/mib.h
+./helpers/table.lo: ../include/net-snmp/library/parse.h
+./helpers/table.lo: ../include/net-snmp/varbind_api.h
+./helpers/table.lo: ../include/net-snmp/config_api.h
+./helpers/table.lo: ../include/net-snmp/library/read_config.h
+./helpers/table.lo: ../include/net-snmp/library/default_store.h
+./helpers/table.lo: ../include/net-snmp/library/snmp_parse_args.h
+./helpers/table.lo: ../include/net-snmp/library/snmp_enum.h
+./helpers/table.lo: ../include/net-snmp/library/vacm.h
+./helpers/table.lo: ../include/net-snmp/output_api.h
+./helpers/table.lo: ../include/net-snmp/library/snmp_debug.h
+./helpers/table.lo: ../include/net-snmp/library/snmp_logging.h
+./helpers/table.lo: ../include/net-snmp/snmpv3_api.h
+./helpers/table.lo: ../include/net-snmp/library/snmpv3.h
+./helpers/table.lo: ../include/net-snmp/library/transform_oids.h
+./helpers/table.lo: ../include/net-snmp/library/keytools.h
+./helpers/table.lo: ../include/net-snmp/library/scapi.h
+./helpers/table.lo: ../include/net-snmp/library/lcd_time.h
+./helpers/table.lo: ../include/net-snmp/library/snmp_secmod.h
+./helpers/table.lo: ../include/net-snmp/library/snmpv3-security-includes.h
+./helpers/table.lo: ../include/net-snmp/library/snmpusm.h
+./helpers/table.lo: ../include/net-snmp/agent/net-snmp-agent-includes.h
+./helpers/table.lo: ../include/net-snmp/agent/snmp_agent.h
+./helpers/table.lo: ../include/net-snmp/agent/snmp_vars.h
+./helpers/table.lo: ../include/net-snmp/agent/agent_handler.h
+./helpers/table.lo: ../include/net-snmp/agent/var_struct.h
+./helpers/table.lo: ../include/net-snmp/agent/agent_registry.h
+./helpers/table.lo: ../include/net-snmp/agent/ds_agent.h
+./helpers/table.lo: ../include/net-snmp/agent/agent_read_config.h
+./helpers/table.lo: ../include/net-snmp/agent/agent_trap.h
+./helpers/table.lo: ../include/net-snmp/agent/all_helpers.h
+./helpers/table.lo: ../include/net-snmp/agent/instance.h
+./helpers/table.lo: ../include/net-snmp/agent/multiplexer.h
+./helpers/table.lo: ../include/net-snmp/agent/null.h
+./helpers/table.lo: ../include/net-snmp/agent/debug_handler.h
+./helpers/table.lo: ../include/net-snmp/agent/old_api.h
+./helpers/table.lo: ../include/net-snmp/agent/read_only.h
+./helpers/table.lo: ../include/net-snmp/agent/serialize.h
+./helpers/table.lo: ../include/net-snmp/agent/bulk_to_next.h
+./helpers/table.lo: ../include/net-snmp/agent/mode_end_call.h
+./helpers/table.lo: ../include/net-snmp/agent/table.h
+./helpers/table.lo: ../include/net-snmp/agent/table_data.h
+./helpers/table.lo: ../include/net-snmp/agent/table_dataset.h
+./helpers/table.lo: ../include/net-snmp/agent/table_iterator.h
+./helpers/table.lo: ../include/net-snmp/agent/mib_module_config.h
+./helpers/table.lo: ../include/net-snmp/library/snmp_assert.h
+./helpers/table_data.lo: ../include/net-snmp/net-snmp-config.h
+./helpers/table_data.lo: ../include/net-snmp/system/linux.h
+./helpers/table_data.lo: ../include/net-snmp/system/sysv.h
+./helpers/table_data.lo: ../include/net-snmp/system/generic.h
+./helpers/table_data.lo: ../include/net-snmp/machine/generic.h
+./helpers/table_data.lo: ../include/net-snmp/net-snmp-includes.h
+./helpers/table_data.lo: ../include/net-snmp/definitions.h
+./helpers/table_data.lo: ../include/net-snmp/types.h
+./helpers/table_data.lo: ../include/net-snmp/library/snmp_api.h
+./helpers/table_data.lo: ../include/net-snmp/library/asn1.h
+./helpers/table_data.lo: ../include/net-snmp/library/snmp_impl.h
+./helpers/table_data.lo: ../include/net-snmp/library/snmp.h
+./helpers/table_data.lo: ../include/net-snmp/library/snmp-tc.h
+./helpers/table_data.lo: ../include/net-snmp/utilities.h
+./helpers/table_data.lo: ../include/net-snmp/library/snmp_client.h
+./helpers/table_data.lo: ../include/net-snmp/library/getopt.h
+./helpers/table_data.lo: ../include/net-snmp/library/system.h
+./helpers/table_data.lo: ../include/net-snmp/library/tools.h
+./helpers/table_data.lo: ../include/net-snmp/library/int64.h
+./helpers/table_data.lo: ../include/net-snmp/library/mt_support.h
+./helpers/table_data.lo: ../include/net-snmp/library/snmp_alarm.h
+./helpers/table_data.lo: ../include/net-snmp/library/data_list.h
+./helpers/table_data.lo: ../include/net-snmp/library/callback.h
+./helpers/table_data.lo: ../include/net-snmp/library/oid_stash.h
+./helpers/table_data.lo: ../include/net-snmp/library/check_varbind.h
+./helpers/table_data.lo: ../include/net-snmp/version.h
+./helpers/table_data.lo: ../include/net-snmp/session_api.h
+./helpers/table_data.lo: ../include/net-snmp/library/snmp_transport.h
+./helpers/table_data.lo: ../include/net-snmp/library/snmpCallbackDomain.h
+./helpers/table_data.lo: ../include/net-snmp/library/snmpUnixDomain.h
+./helpers/table_data.lo: ../include/net-snmp/library/snmpUDPDomain.h
+./helpers/table_data.lo: ../include/net-snmp/library/snmpTCPDomain.h
+./helpers/table_data.lo: ../include/net-snmp/library/snmpUDPIPv6Domain.h
+./helpers/table_data.lo: ../include/net-snmp/library/snmpTCPIPv6Domain.h
+./helpers/table_data.lo: ../include/net-snmp/library/snmpIPXDomain.h
+./helpers/table_data.lo: ../include/net-snmp/library/ucd_compat.h
+./helpers/table_data.lo: ../include/net-snmp/pdu_api.h
+./helpers/table_data.lo: ../include/net-snmp/mib_api.h
+./helpers/table_data.lo: ../include/net-snmp/library/mib.h
+./helpers/table_data.lo: ../include/net-snmp/library/parse.h
+./helpers/table_data.lo: ../include/net-snmp/varbind_api.h
+./helpers/table_data.lo: ../include/net-snmp/config_api.h
+./helpers/table_data.lo: ../include/net-snmp/library/read_config.h
+./helpers/table_data.lo: ../include/net-snmp/library/default_store.h
+./helpers/table_data.lo: ../include/net-snmp/library/snmp_parse_args.h
+./helpers/table_data.lo: ../include/net-snmp/library/snmp_enum.h
+./helpers/table_data.lo: ../include/net-snmp/library/vacm.h
+./helpers/table_data.lo: ../include/net-snmp/output_api.h
+./helpers/table_data.lo: ../include/net-snmp/library/snmp_debug.h
+./helpers/table_data.lo: ../include/net-snmp/library/snmp_logging.h
+./helpers/table_data.lo: ../include/net-snmp/snmpv3_api.h
+./helpers/table_data.lo: ../include/net-snmp/library/snmpv3.h
+./helpers/table_data.lo: ../include/net-snmp/library/transform_oids.h
+./helpers/table_data.lo: ../include/net-snmp/library/keytools.h
+./helpers/table_data.lo: ../include/net-snmp/library/scapi.h
+./helpers/table_data.lo: ../include/net-snmp/library/lcd_time.h
+./helpers/table_data.lo: ../include/net-snmp/library/snmp_secmod.h
+./helpers/table_data.lo: ../include/net-snmp/library/snmpv3-security-includes.h
+./helpers/table_data.lo: ../include/net-snmp/library/snmpusm.h
+./helpers/table_data.lo: ../include/net-snmp/agent/net-snmp-agent-includes.h
+./helpers/table_data.lo: ../include/net-snmp/agent/snmp_agent.h
+./helpers/table_data.lo: ../include/net-snmp/agent/snmp_vars.h
+./helpers/table_data.lo: ../include/net-snmp/agent/agent_handler.h
+./helpers/table_data.lo: ../include/net-snmp/agent/var_struct.h
+./helpers/table_data.lo: ../include/net-snmp/agent/agent_registry.h
+./helpers/table_data.lo: ../include/net-snmp/agent/ds_agent.h
+./helpers/table_data.lo: ../include/net-snmp/agent/agent_read_config.h
+./helpers/table_data.lo: ../include/net-snmp/agent/agent_trap.h
+./helpers/table_data.lo: ../include/net-snmp/agent/all_helpers.h
+./helpers/table_data.lo: ../include/net-snmp/agent/instance.h
+./helpers/table_data.lo: ../include/net-snmp/agent/multiplexer.h
+./helpers/table_data.lo: ../include/net-snmp/agent/null.h
+./helpers/table_data.lo: ../include/net-snmp/agent/debug_handler.h
+./helpers/table_data.lo: ../include/net-snmp/agent/old_api.h
+./helpers/table_data.lo: ../include/net-snmp/agent/read_only.h
+./helpers/table_data.lo: ../include/net-snmp/agent/serialize.h
+./helpers/table_data.lo: ../include/net-snmp/agent/bulk_to_next.h
+./helpers/table_data.lo: ../include/net-snmp/agent/mode_end_call.h
+./helpers/table_data.lo: ../include/net-snmp/agent/table.h
+./helpers/table_data.lo: ../include/net-snmp/agent/table_data.h
+./helpers/table_data.lo: ../include/net-snmp/agent/table_dataset.h
+./helpers/table_data.lo: ../include/net-snmp/agent/table_iterator.h
+./helpers/table_data.lo: ../include/net-snmp/agent/mib_module_config.h
+./helpers/table_dataset.lo: ../include/net-snmp/net-snmp-config.h
+./helpers/table_dataset.lo: ../include/net-snmp/system/linux.h
+./helpers/table_dataset.lo: ../include/net-snmp/system/sysv.h
+./helpers/table_dataset.lo: ../include/net-snmp/system/generic.h
+./helpers/table_dataset.lo: ../include/net-snmp/machine/generic.h
+./helpers/table_dataset.lo: ../include/net-snmp/net-snmp-includes.h
+./helpers/table_dataset.lo: ../include/net-snmp/definitions.h
+./helpers/table_dataset.lo: ../include/net-snmp/types.h
+./helpers/table_dataset.lo: ../include/net-snmp/library/snmp_api.h
+./helpers/table_dataset.lo: ../include/net-snmp/library/asn1.h
+./helpers/table_dataset.lo: ../include/net-snmp/library/snmp_impl.h
+./helpers/table_dataset.lo: ../include/net-snmp/library/snmp.h
+./helpers/table_dataset.lo: ../include/net-snmp/library/snmp-tc.h
+./helpers/table_dataset.lo: ../include/net-snmp/utilities.h
+./helpers/table_dataset.lo: ../include/net-snmp/library/snmp_client.h
+./helpers/table_dataset.lo: ../include/net-snmp/library/getopt.h
+./helpers/table_dataset.lo: ../include/net-snmp/library/system.h
+./helpers/table_dataset.lo: ../include/net-snmp/library/tools.h
+./helpers/table_dataset.lo: ../include/net-snmp/library/int64.h
+./helpers/table_dataset.lo: ../include/net-snmp/library/mt_support.h
+./helpers/table_dataset.lo: ../include/net-snmp/library/snmp_alarm.h
+./helpers/table_dataset.lo: ../include/net-snmp/library/data_list.h
+./helpers/table_dataset.lo: ../include/net-snmp/library/callback.h
+./helpers/table_dataset.lo: ../include/net-snmp/library/oid_stash.h
+./helpers/table_dataset.lo: ../include/net-snmp/library/check_varbind.h
+./helpers/table_dataset.lo: ../include/net-snmp/version.h
+./helpers/table_dataset.lo: ../include/net-snmp/session_api.h
+./helpers/table_dataset.lo: ../include/net-snmp/library/snmp_transport.h
+./helpers/table_dataset.lo: ../include/net-snmp/library/snmpCallbackDomain.h
+./helpers/table_dataset.lo: ../include/net-snmp/library/snmpUnixDomain.h
+./helpers/table_dataset.lo: ../include/net-snmp/library/snmpUDPDomain.h
+./helpers/table_dataset.lo: ../include/net-snmp/library/snmpTCPDomain.h
+./helpers/table_dataset.lo: ../include/net-snmp/library/snmpUDPIPv6Domain.h
+./helpers/table_dataset.lo: ../include/net-snmp/library/snmpTCPIPv6Domain.h
+./helpers/table_dataset.lo: ../include/net-snmp/library/snmpIPXDomain.h
+./helpers/table_dataset.lo: ../include/net-snmp/library/ucd_compat.h
+./helpers/table_dataset.lo: ../include/net-snmp/pdu_api.h
+./helpers/table_dataset.lo: ../include/net-snmp/mib_api.h
+./helpers/table_dataset.lo: ../include/net-snmp/library/mib.h
+./helpers/table_dataset.lo: ../include/net-snmp/library/parse.h
+./helpers/table_dataset.lo: ../include/net-snmp/varbind_api.h
+./helpers/table_dataset.lo: ../include/net-snmp/config_api.h
+./helpers/table_dataset.lo: ../include/net-snmp/library/read_config.h
+./helpers/table_dataset.lo: ../include/net-snmp/library/default_store.h
+./helpers/table_dataset.lo: ../include/net-snmp/library/snmp_parse_args.h
+./helpers/table_dataset.lo: ../include/net-snmp/library/snmp_enum.h
+./helpers/table_dataset.lo: ../include/net-snmp/library/vacm.h
+./helpers/table_dataset.lo: ../include/net-snmp/output_api.h
+./helpers/table_dataset.lo: ../include/net-snmp/library/snmp_debug.h
+./helpers/table_dataset.lo: ../include/net-snmp/library/snmp_logging.h
+./helpers/table_dataset.lo: ../include/net-snmp/snmpv3_api.h
+./helpers/table_dataset.lo: ../include/net-snmp/library/snmpv3.h
+./helpers/table_dataset.lo: ../include/net-snmp/library/transform_oids.h
+./helpers/table_dataset.lo: ../include/net-snmp/library/keytools.h
+./helpers/table_dataset.lo: ../include/net-snmp/library/scapi.h
+./helpers/table_dataset.lo: ../include/net-snmp/library/lcd_time.h
+./helpers/table_dataset.lo: ../include/net-snmp/library/snmp_secmod.h
+./helpers/table_dataset.lo: ../include/net-snmp/library/snmpv3-security-includes.h
+./helpers/table_dataset.lo: ../include/net-snmp/library/snmpusm.h
+./helpers/table_dataset.lo: ../include/net-snmp/agent/net-snmp-agent-includes.h
+./helpers/table_dataset.lo: ../include/net-snmp/agent/snmp_agent.h
+./helpers/table_dataset.lo: ../include/net-snmp/agent/snmp_vars.h
+./helpers/table_dataset.lo: ../include/net-snmp/agent/agent_handler.h
+./helpers/table_dataset.lo: ../include/net-snmp/agent/var_struct.h
+./helpers/table_dataset.lo: ../include/net-snmp/agent/agent_registry.h
+./helpers/table_dataset.lo: ../include/net-snmp/agent/ds_agent.h
+./helpers/table_dataset.lo: ../include/net-snmp/agent/agent_read_config.h
+./helpers/table_dataset.lo: ../include/net-snmp/agent/agent_trap.h
+./helpers/table_dataset.lo: ../include/net-snmp/agent/all_helpers.h
+./helpers/table_dataset.lo: ../include/net-snmp/agent/instance.h
+./helpers/table_dataset.lo: ../include/net-snmp/agent/multiplexer.h
+./helpers/table_dataset.lo: ../include/net-snmp/agent/null.h
+./helpers/table_dataset.lo: ../include/net-snmp/agent/debug_handler.h
+./helpers/table_dataset.lo: ../include/net-snmp/agent/old_api.h
+./helpers/table_dataset.lo: ../include/net-snmp/agent/read_only.h
+./helpers/table_dataset.lo: ../include/net-snmp/agent/serialize.h
+./helpers/table_dataset.lo: ../include/net-snmp/agent/bulk_to_next.h
+./helpers/table_dataset.lo: ../include/net-snmp/agent/mode_end_call.h
+./helpers/table_dataset.lo: ../include/net-snmp/agent/table.h
+./helpers/table_dataset.lo: ../include/net-snmp/agent/table_data.h
+./helpers/table_dataset.lo: ../include/net-snmp/agent/table_dataset.h
+./helpers/table_dataset.lo: ../include/net-snmp/agent/table_iterator.h
+./helpers/table_dataset.lo: ../include/net-snmp/agent/mib_module_config.h
+./helpers/table_iterator.lo: ../include/net-snmp/net-snmp-config.h
+./helpers/table_iterator.lo: ../include/net-snmp/system/linux.h
+./helpers/table_iterator.lo: ../include/net-snmp/system/sysv.h
+./helpers/table_iterator.lo: ../include/net-snmp/system/generic.h
+./helpers/table_iterator.lo: ../include/net-snmp/machine/generic.h
+./helpers/table_iterator.lo: ../include/net-snmp/net-snmp-includes.h
+./helpers/table_iterator.lo: ../include/net-snmp/definitions.h
+./helpers/table_iterator.lo: ../include/net-snmp/types.h
+./helpers/table_iterator.lo: ../include/net-snmp/library/snmp_api.h
+./helpers/table_iterator.lo: ../include/net-snmp/library/asn1.h
+./helpers/table_iterator.lo: ../include/net-snmp/library/snmp_impl.h
+./helpers/table_iterator.lo: ../include/net-snmp/library/snmp.h
+./helpers/table_iterator.lo: ../include/net-snmp/library/snmp-tc.h
+./helpers/table_iterator.lo: ../include/net-snmp/utilities.h
+./helpers/table_iterator.lo: ../include/net-snmp/library/snmp_client.h
+./helpers/table_iterator.lo: ../include/net-snmp/library/getopt.h
+./helpers/table_iterator.lo: ../include/net-snmp/library/system.h
+./helpers/table_iterator.lo: ../include/net-snmp/library/tools.h
+./helpers/table_iterator.lo: ../include/net-snmp/library/int64.h
+./helpers/table_iterator.lo: ../include/net-snmp/library/mt_support.h
+./helpers/table_iterator.lo: ../include/net-snmp/library/snmp_alarm.h
+./helpers/table_iterator.lo: ../include/net-snmp/library/data_list.h
+./helpers/table_iterator.lo: ../include/net-snmp/library/callback.h
+./helpers/table_iterator.lo: ../include/net-snmp/library/oid_stash.h
+./helpers/table_iterator.lo: ../include/net-snmp/library/check_varbind.h
+./helpers/table_iterator.lo: ../include/net-snmp/version.h
+./helpers/table_iterator.lo: ../include/net-snmp/session_api.h
+./helpers/table_iterator.lo: ../include/net-snmp/library/snmp_transport.h
+./helpers/table_iterator.lo: ../include/net-snmp/library/snmpCallbackDomain.h
+./helpers/table_iterator.lo: ../include/net-snmp/library/snmpUnixDomain.h
+./helpers/table_iterator.lo: ../include/net-snmp/library/snmpUDPDomain.h
+./helpers/table_iterator.lo: ../include/net-snmp/library/snmpTCPDomain.h
+./helpers/table_iterator.lo: ../include/net-snmp/library/snmpUDPIPv6Domain.h
+./helpers/table_iterator.lo: ../include/net-snmp/library/snmpTCPIPv6Domain.h
+./helpers/table_iterator.lo: ../include/net-snmp/library/snmpIPXDomain.h
+./helpers/table_iterator.lo: ../include/net-snmp/library/ucd_compat.h
+./helpers/table_iterator.lo: ../include/net-snmp/pdu_api.h
+./helpers/table_iterator.lo: ../include/net-snmp/mib_api.h
+./helpers/table_iterator.lo: ../include/net-snmp/library/mib.h
+./helpers/table_iterator.lo: ../include/net-snmp/library/parse.h
+./helpers/table_iterator.lo: ../include/net-snmp/varbind_api.h
+./helpers/table_iterator.lo: ../include/net-snmp/config_api.h
+./helpers/table_iterator.lo: ../include/net-snmp/library/read_config.h
+./helpers/table_iterator.lo: ../include/net-snmp/library/default_store.h
+./helpers/table_iterator.lo: ../include/net-snmp/library/snmp_parse_args.h
+./helpers/table_iterator.lo: ../include/net-snmp/library/snmp_enum.h
+./helpers/table_iterator.lo: ../include/net-snmp/library/vacm.h
+./helpers/table_iterator.lo: ../include/net-snmp/output_api.h
+./helpers/table_iterator.lo: ../include/net-snmp/library/snmp_debug.h
+./helpers/table_iterator.lo: ../include/net-snmp/library/snmp_logging.h
+./helpers/table_iterator.lo: ../include/net-snmp/snmpv3_api.h
+./helpers/table_iterator.lo: ../include/net-snmp/library/snmpv3.h
+./helpers/table_iterator.lo: ../include/net-snmp/library/transform_oids.h
+./helpers/table_iterator.lo: ../include/net-snmp/library/keytools.h
+./helpers/table_iterator.lo: ../include/net-snmp/library/scapi.h
+./helpers/table_iterator.lo: ../include/net-snmp/library/lcd_time.h
+./helpers/table_iterator.lo: ../include/net-snmp/library/snmp_secmod.h
+./helpers/table_iterator.lo: ../include/net-snmp/library/snmpv3-security-includes.h
+./helpers/table_iterator.lo: ../include/net-snmp/library/snmpusm.h
+./helpers/table_iterator.lo: ../include/net-snmp/agent/net-snmp-agent-includes.h
+./helpers/table_iterator.lo: ../include/net-snmp/agent/snmp_agent.h
+./helpers/table_iterator.lo: ../include/net-snmp/agent/snmp_vars.h
+./helpers/table_iterator.lo: ../include/net-snmp/agent/agent_handler.h
+./helpers/table_iterator.lo: ../include/net-snmp/agent/var_struct.h
+./helpers/table_iterator.lo: ../include/net-snmp/agent/agent_registry.h
+./helpers/table_iterator.lo: ../include/net-snmp/agent/ds_agent.h
+./helpers/table_iterator.lo: ../include/net-snmp/agent/agent_read_config.h
+./helpers/table_iterator.lo: ../include/net-snmp/agent/agent_trap.h
+./helpers/table_iterator.lo: ../include/net-snmp/agent/all_helpers.h
+./helpers/table_iterator.lo: ../include/net-snmp/agent/instance.h
+./helpers/table_iterator.lo: ../include/net-snmp/agent/multiplexer.h
+./helpers/table_iterator.lo: ../include/net-snmp/agent/null.h
+./helpers/table_iterator.lo: ../include/net-snmp/agent/debug_handler.h
+./helpers/table_iterator.lo: ../include/net-snmp/agent/old_api.h
+./helpers/table_iterator.lo: ../include/net-snmp/agent/read_only.h
+./helpers/table_iterator.lo: ../include/net-snmp/agent/serialize.h
+./helpers/table_iterator.lo: ../include/net-snmp/agent/bulk_to_next.h
+./helpers/table_iterator.lo: ../include/net-snmp/agent/mode_end_call.h
+./helpers/table_iterator.lo: ../include/net-snmp/agent/table.h
+./helpers/table_iterator.lo: ../include/net-snmp/agent/table_data.h
+./helpers/table_iterator.lo: ../include/net-snmp/agent/table_dataset.h
+./helpers/table_iterator.lo: ../include/net-snmp/agent/table_iterator.h
+./helpers/table_iterator.lo: ../include/net-snmp/agent/mib_module_config.h
+./helpers/watcher.lo: ../include/net-snmp/net-snmp-config.h
+./helpers/watcher.lo: ../include/net-snmp/system/linux.h
+./helpers/watcher.lo: ../include/net-snmp/system/sysv.h
+./helpers/watcher.lo: ../include/net-snmp/system/generic.h
+./helpers/watcher.lo: ../include/net-snmp/machine/generic.h
+./helpers/watcher.lo: ../include/net-snmp/net-snmp-includes.h
+./helpers/watcher.lo: ../include/net-snmp/definitions.h
+./helpers/watcher.lo: ../include/net-snmp/types.h
+./helpers/watcher.lo: ../include/net-snmp/library/snmp_api.h
+./helpers/watcher.lo: ../include/net-snmp/library/asn1.h
+./helpers/watcher.lo: ../include/net-snmp/library/snmp_impl.h
+./helpers/watcher.lo: ../include/net-snmp/library/snmp.h
+./helpers/watcher.lo: ../include/net-snmp/library/snmp-tc.h
+./helpers/watcher.lo: ../include/net-snmp/utilities.h
+./helpers/watcher.lo: ../include/net-snmp/library/snmp_client.h
+./helpers/watcher.lo: ../include/net-snmp/library/getopt.h
+./helpers/watcher.lo: ../include/net-snmp/library/system.h
+./helpers/watcher.lo: ../include/net-snmp/library/tools.h
+./helpers/watcher.lo: ../include/net-snmp/library/int64.h
+./helpers/watcher.lo: ../include/net-snmp/library/mt_support.h
+./helpers/watcher.lo: ../include/net-snmp/library/snmp_alarm.h
+./helpers/watcher.lo: ../include/net-snmp/library/data_list.h
+./helpers/watcher.lo: ../include/net-snmp/library/callback.h
+./helpers/watcher.lo: ../include/net-snmp/library/oid_stash.h
+./helpers/watcher.lo: ../include/net-snmp/library/check_varbind.h
+./helpers/watcher.lo: ../include/net-snmp/version.h
+./helpers/watcher.lo: ../include/net-snmp/session_api.h
+./helpers/watcher.lo: ../include/net-snmp/library/snmp_transport.h
+./helpers/watcher.lo: ../include/net-snmp/library/snmpCallbackDomain.h
+./helpers/watcher.lo: ../include/net-snmp/library/snmpUnixDomain.h
+./helpers/watcher.lo: ../include/net-snmp/library/snmpUDPDomain.h
+./helpers/watcher.lo: ../include/net-snmp/library/snmpTCPDomain.h
+./helpers/watcher.lo: ../include/net-snmp/library/snmpUDPIPv6Domain.h
+./helpers/watcher.lo: ../include/net-snmp/library/snmpTCPIPv6Domain.h
+./helpers/watcher.lo: ../include/net-snmp/library/snmpIPXDomain.h
+./helpers/watcher.lo: ../include/net-snmp/library/ucd_compat.h
+./helpers/watcher.lo: ../include/net-snmp/pdu_api.h
+./helpers/watcher.lo: ../include/net-snmp/mib_api.h
+./helpers/watcher.lo: ../include/net-snmp/library/mib.h
+./helpers/watcher.lo: ../include/net-snmp/library/parse.h
+./helpers/watcher.lo: ../include/net-snmp/varbind_api.h
+./helpers/watcher.lo: ../include/net-snmp/config_api.h
+./helpers/watcher.lo: ../include/net-snmp/library/read_config.h
+./helpers/watcher.lo: ../include/net-snmp/library/default_store.h
+./helpers/watcher.lo: ../include/net-snmp/library/snmp_parse_args.h
+./helpers/watcher.lo: ../include/net-snmp/library/snmp_enum.h
+./helpers/watcher.lo: ../include/net-snmp/library/vacm.h
+./helpers/watcher.lo: ../include/net-snmp/output_api.h
+./helpers/watcher.lo: ../include/net-snmp/library/snmp_debug.h
+./helpers/watcher.lo: ../include/net-snmp/library/snmp_logging.h
+./helpers/watcher.lo: ../include/net-snmp/snmpv3_api.h
+./helpers/watcher.lo: ../include/net-snmp/library/snmpv3.h
+./helpers/watcher.lo: ../include/net-snmp/library/transform_oids.h
+./helpers/watcher.lo: ../include/net-snmp/library/keytools.h
+./helpers/watcher.lo: ../include/net-snmp/library/scapi.h
+./helpers/watcher.lo: ../include/net-snmp/library/lcd_time.h
+./helpers/watcher.lo: ../include/net-snmp/library/snmp_secmod.h
+./helpers/watcher.lo: ../include/net-snmp/library/snmpv3-security-includes.h
+./helpers/watcher.lo: ../include/net-snmp/library/snmpusm.h
+./helpers/watcher.lo: ../include/net-snmp/agent/net-snmp-agent-includes.h
+./helpers/watcher.lo: ../include/net-snmp/agent/snmp_agent.h
+./helpers/watcher.lo: ../include/net-snmp/agent/snmp_vars.h
+./helpers/watcher.lo: ../include/net-snmp/agent/agent_handler.h
+./helpers/watcher.lo: ../include/net-snmp/agent/var_struct.h
+./helpers/watcher.lo: ../include/net-snmp/agent/agent_registry.h
+./helpers/watcher.lo: ../include/net-snmp/agent/ds_agent.h
+./helpers/watcher.lo: ../include/net-snmp/agent/agent_read_config.h
+./helpers/watcher.lo: ../include/net-snmp/agent/agent_trap.h
+./helpers/watcher.lo: ../include/net-snmp/agent/all_helpers.h
+./helpers/watcher.lo: ../include/net-snmp/agent/instance.h
+./helpers/watcher.lo: ../include/net-snmp/agent/multiplexer.h
+./helpers/watcher.lo: ../include/net-snmp/agent/null.h
+./helpers/watcher.lo: ../include/net-snmp/agent/debug_handler.h
+./helpers/watcher.lo: ../include/net-snmp/agent/old_api.h
+./helpers/watcher.lo: ../include/net-snmp/agent/read_only.h
+./helpers/watcher.lo: ../include/net-snmp/agent/serialize.h
+./helpers/watcher.lo: ../include/net-snmp/agent/bulk_to_next.h
+./helpers/watcher.lo: ../include/net-snmp/agent/mode_end_call.h
+./helpers/watcher.lo: ../include/net-snmp/agent/table.h
+./helpers/watcher.lo: ../include/net-snmp/agent/table_data.h
+./helpers/watcher.lo: ../include/net-snmp/agent/table_dataset.h
+./helpers/watcher.lo: ../include/net-snmp/agent/table_iterator.h
+./helpers/watcher.lo: ../include/net-snmp/agent/mib_module_config.h
+./helpers/watcher.lo: ../include/net-snmp/agent/watcher.h
+./helpers/watcher.lo: ../include/net-snmp/agent/scalar.h
+./mibgroup/header_complex.lo: ../include/net-snmp/net-snmp-config.h
+./mibgroup/header_complex.lo: ../include/net-snmp/system/linux.h
+./mibgroup/header_complex.lo: ../include/net-snmp/system/sysv.h
+./mibgroup/header_complex.lo: ../include/net-snmp/system/generic.h
+./mibgroup/header_complex.lo: ../include/net-snmp/machine/generic.h
+./mibgroup/header_complex.lo: ../include/net-snmp/net-snmp-includes.h
+./mibgroup/header_complex.lo: ../include/net-snmp/definitions.h
+./mibgroup/header_complex.lo: ../include/net-snmp/types.h
+./mibgroup/header_complex.lo: ../include/net-snmp/library/snmp_api.h
+./mibgroup/header_complex.lo: ../include/net-snmp/library/asn1.h
+./mibgroup/header_complex.lo: ../include/net-snmp/library/snmp_impl.h
+./mibgroup/header_complex.lo: ../include/net-snmp/library/snmp.h
+./mibgroup/header_complex.lo: ../include/net-snmp/library/snmp-tc.h
+./mibgroup/header_complex.lo: ../include/net-snmp/utilities.h
+./mibgroup/header_complex.lo: ../include/net-snmp/library/snmp_client.h
+./mibgroup/header_complex.lo: ../include/net-snmp/library/getopt.h
+./mibgroup/header_complex.lo: ../include/net-snmp/library/system.h
+./mibgroup/header_complex.lo: ../include/net-snmp/library/tools.h
+./mibgroup/header_complex.lo: ../include/net-snmp/library/int64.h
+./mibgroup/header_complex.lo: ../include/net-snmp/library/mt_support.h
+./mibgroup/header_complex.lo: ../include/net-snmp/library/snmp_alarm.h
+./mibgroup/header_complex.lo: ../include/net-snmp/library/data_list.h
+./mibgroup/header_complex.lo: ../include/net-snmp/library/callback.h
+./mibgroup/header_complex.lo: ../include/net-snmp/library/oid_stash.h
+./mibgroup/header_complex.lo: ../include/net-snmp/library/check_varbind.h
+./mibgroup/header_complex.lo: ../include/net-snmp/version.h
+./mibgroup/header_complex.lo: ../include/net-snmp/session_api.h
+./mibgroup/header_complex.lo: ../include/net-snmp/library/snmp_transport.h
+./mibgroup/header_complex.lo: ../include/net-snmp/library/snmpCallbackDomain.h
+./mibgroup/header_complex.lo: ../include/net-snmp/library/snmpUnixDomain.h
+./mibgroup/header_complex.lo: ../include/net-snmp/library/snmpUDPDomain.h
+./mibgroup/header_complex.lo: ../include/net-snmp/library/snmpTCPDomain.h
+./mibgroup/header_complex.lo: ../include/net-snmp/library/snmpUDPIPv6Domain.h
+./mibgroup/header_complex.lo: ../include/net-snmp/library/snmpTCPIPv6Domain.h
+./mibgroup/header_complex.lo: ../include/net-snmp/library/snmpIPXDomain.h
+./mibgroup/header_complex.lo: ../include/net-snmp/library/ucd_compat.h
+./mibgroup/header_complex.lo: ../include/net-snmp/pdu_api.h
+./mibgroup/header_complex.lo: ../include/net-snmp/mib_api.h
+./mibgroup/header_complex.lo: ../include/net-snmp/library/mib.h
+./mibgroup/header_complex.lo: ../include/net-snmp/library/parse.h
+./mibgroup/header_complex.lo: ../include/net-snmp/varbind_api.h
+./mibgroup/header_complex.lo: ../include/net-snmp/config_api.h
+./mibgroup/header_complex.lo: ../include/net-snmp/library/read_config.h
+./mibgroup/header_complex.lo: ../include/net-snmp/library/default_store.h
+./mibgroup/header_complex.lo: ../include/net-snmp/library/snmp_parse_args.h
+./mibgroup/header_complex.lo: ../include/net-snmp/library/snmp_enum.h
+./mibgroup/header_complex.lo: ../include/net-snmp/library/vacm.h
+./mibgroup/header_complex.lo: ../include/net-snmp/output_api.h
+./mibgroup/header_complex.lo: ../include/net-snmp/library/snmp_debug.h
+./mibgroup/header_complex.lo: ../include/net-snmp/library/snmp_logging.h
+./mibgroup/header_complex.lo: ../include/net-snmp/snmpv3_api.h
+./mibgroup/header_complex.lo: ../include/net-snmp/library/snmpv3.h
+./mibgroup/header_complex.lo: ../include/net-snmp/library/transform_oids.h
+./mibgroup/header_complex.lo: ../include/net-snmp/library/keytools.h
+./mibgroup/header_complex.lo: ../include/net-snmp/library/scapi.h
+./mibgroup/header_complex.lo: ../include/net-snmp/library/lcd_time.h
+./mibgroup/header_complex.lo: ../include/net-snmp/library/snmp_secmod.h
+./mibgroup/header_complex.lo: ../include/net-snmp/library/snmpv3-security-includes.h
+./mibgroup/header_complex.lo: ../include/net-snmp/library/snmpusm.h
+./mibgroup/header_complex.lo: ../include/net-snmp/agent/net-snmp-agent-includes.h
+./mibgroup/header_complex.lo: ../include/net-snmp/agent/snmp_agent.h
+./mibgroup/header_complex.lo: ../include/net-snmp/agent/snmp_vars.h
+./mibgroup/header_complex.lo: ../include/net-snmp/agent/agent_handler.h
+./mibgroup/header_complex.lo: ../include/net-snmp/agent/var_struct.h
+./mibgroup/header_complex.lo: ../include/net-snmp/agent/agent_registry.h
+./mibgroup/header_complex.lo: ../include/net-snmp/agent/ds_agent.h
+./mibgroup/header_complex.lo: ../include/net-snmp/agent/agent_read_config.h
+./mibgroup/header_complex.lo: ../include/net-snmp/agent/agent_trap.h
+./mibgroup/header_complex.lo: ../include/net-snmp/agent/all_helpers.h
+./mibgroup/header_complex.lo: ../include/net-snmp/agent/instance.h
+./mibgroup/header_complex.lo: ../include/net-snmp/agent/multiplexer.h
+./mibgroup/header_complex.lo: ../include/net-snmp/agent/null.h
+./mibgroup/header_complex.lo: ../include/net-snmp/agent/debug_handler.h
+./mibgroup/header_complex.lo: ../include/net-snmp/agent/old_api.h
+./mibgroup/header_complex.lo: ../include/net-snmp/agent/read_only.h
+./mibgroup/header_complex.lo: ../include/net-snmp/agent/serialize.h
+./mibgroup/header_complex.lo: ../include/net-snmp/agent/bulk_to_next.h
+./mibgroup/header_complex.lo: ../include/net-snmp/agent/mode_end_call.h
+./mibgroup/header_complex.lo: ../include/net-snmp/agent/table.h
+./mibgroup/header_complex.lo: ../include/net-snmp/agent/table_data.h
+./mibgroup/header_complex.lo: ../include/net-snmp/agent/table_dataset.h
+./mibgroup/header_complex.lo: ../include/net-snmp/agent/table_iterator.h
+./mibgroup/header_complex.lo: ../include/net-snmp/agent/mib_module_config.h
+./mibgroup/header_complex.lo: ./mibgroup/header_complex.h
+./mibgroup/kernel_sunos5.lo: ../include/net-snmp/net-snmp-config.h
+./mibgroup/kernel_sunos5.lo: ../include/net-snmp/system/linux.h
+./mibgroup/kernel_sunos5.lo: ../include/net-snmp/system/sysv.h
+./mibgroup/kernel_sunos5.lo: ../include/net-snmp/system/generic.h
+./mibgroup/kernel_sunos5.lo: ../include/net-snmp/machine/generic.h
+./mibgroup/testhandler.lo: ../include/net-snmp/net-snmp-config.h
+./mibgroup/testhandler.lo: ../include/net-snmp/system/linux.h
+./mibgroup/testhandler.lo: ../include/net-snmp/system/sysv.h
+./mibgroup/testhandler.lo: ../include/net-snmp/system/generic.h
+./mibgroup/testhandler.lo: ../include/net-snmp/machine/generic.h
+./mibgroup/testhandler.lo: ../include/net-snmp/net-snmp-includes.h
+./mibgroup/testhandler.lo: ../include/net-snmp/definitions.h
+./mibgroup/testhandler.lo: ../include/net-snmp/types.h
+./mibgroup/testhandler.lo: ../include/net-snmp/library/snmp_api.h
+./mibgroup/testhandler.lo: ../include/net-snmp/library/asn1.h
+./mibgroup/testhandler.lo: ../include/net-snmp/library/snmp_impl.h
+./mibgroup/testhandler.lo: ../include/net-snmp/library/snmp.h
+./mibgroup/testhandler.lo: ../include/net-snmp/library/snmp-tc.h
+./mibgroup/testhandler.lo: ../include/net-snmp/utilities.h
+./mibgroup/testhandler.lo: ../include/net-snmp/library/snmp_client.h
+./mibgroup/testhandler.lo: ../include/net-snmp/library/getopt.h
+./mibgroup/testhandler.lo: ../include/net-snmp/library/system.h
+./mibgroup/testhandler.lo: ../include/net-snmp/library/tools.h
+./mibgroup/testhandler.lo: ../include/net-snmp/library/int64.h
+./mibgroup/testhandler.lo: ../include/net-snmp/library/mt_support.h
+./mibgroup/testhandler.lo: ../include/net-snmp/library/snmp_alarm.h
+./mibgroup/testhandler.lo: ../include/net-snmp/library/data_list.h
+./mibgroup/testhandler.lo: ../include/net-snmp/library/callback.h
+./mibgroup/testhandler.lo: ../include/net-snmp/library/oid_stash.h
+./mibgroup/testhandler.lo: ../include/net-snmp/library/check_varbind.h
+./mibgroup/testhandler.lo: ../include/net-snmp/version.h
+./mibgroup/testhandler.lo: ../include/net-snmp/session_api.h
+./mibgroup/testhandler.lo: ../include/net-snmp/library/snmp_transport.h
+./mibgroup/testhandler.lo: ../include/net-snmp/library/snmpCallbackDomain.h
+./mibgroup/testhandler.lo: ../include/net-snmp/library/snmpUnixDomain.h
+./mibgroup/testhandler.lo: ../include/net-snmp/library/snmpUDPDomain.h
+./mibgroup/testhandler.lo: ../include/net-snmp/library/snmpTCPDomain.h
+./mibgroup/testhandler.lo: ../include/net-snmp/library/snmpUDPIPv6Domain.h
+./mibgroup/testhandler.lo: ../include/net-snmp/library/snmpTCPIPv6Domain.h
+./mibgroup/testhandler.lo: ../include/net-snmp/library/snmpIPXDomain.h
+./mibgroup/testhandler.lo: ../include/net-snmp/library/ucd_compat.h
+./mibgroup/testhandler.lo: ../include/net-snmp/pdu_api.h
+./mibgroup/testhandler.lo: ../include/net-snmp/mib_api.h
+./mibgroup/testhandler.lo: ../include/net-snmp/library/mib.h
+./mibgroup/testhandler.lo: ../include/net-snmp/library/parse.h
+./mibgroup/testhandler.lo: ../include/net-snmp/varbind_api.h
+./mibgroup/testhandler.lo: ../include/net-snmp/config_api.h
+./mibgroup/testhandler.lo: ../include/net-snmp/library/read_config.h
+./mibgroup/testhandler.lo: ../include/net-snmp/library/default_store.h
+./mibgroup/testhandler.lo: ../include/net-snmp/library/snmp_parse_args.h
+./mibgroup/testhandler.lo: ../include/net-snmp/library/snmp_enum.h
+./mibgroup/testhandler.lo: ../include/net-snmp/library/vacm.h
+./mibgroup/testhandler.lo: ../include/net-snmp/output_api.h
+./mibgroup/testhandler.lo: ../include/net-snmp/library/snmp_debug.h
+./mibgroup/testhandler.lo: ../include/net-snmp/library/snmp_logging.h
+./mibgroup/testhandler.lo: ../include/net-snmp/snmpv3_api.h
+./mibgroup/testhandler.lo: ../include/net-snmp/library/snmpv3.h
+./mibgroup/testhandler.lo: ../include/net-snmp/library/transform_oids.h
+./mibgroup/testhandler.lo: ../include/net-snmp/library/keytools.h
+./mibgroup/testhandler.lo: ../include/net-snmp/library/scapi.h
+./mibgroup/testhandler.lo: ../include/net-snmp/library/lcd_time.h
+./mibgroup/testhandler.lo: ../include/net-snmp/library/snmp_secmod.h
+./mibgroup/testhandler.lo: ../include/net-snmp/library/snmpv3-security-includes.h
+./mibgroup/testhandler.lo: ../include/net-snmp/library/snmpusm.h
+./mibgroup/testhandler.lo: ../include/net-snmp/agent/net-snmp-agent-includes.h
+./mibgroup/testhandler.lo: ../include/net-snmp/agent/snmp_agent.h
+./mibgroup/testhandler.lo: ../include/net-snmp/agent/snmp_vars.h
+./mibgroup/testhandler.lo: ../include/net-snmp/agent/agent_handler.h
+./mibgroup/testhandler.lo: ../include/net-snmp/agent/var_struct.h
+./mibgroup/testhandler.lo: ../include/net-snmp/agent/agent_registry.h
+./mibgroup/testhandler.lo: ../include/net-snmp/agent/ds_agent.h
+./mibgroup/testhandler.lo: ../include/net-snmp/agent/agent_read_config.h
+./mibgroup/testhandler.lo: ../include/net-snmp/agent/agent_trap.h
+./mibgroup/testhandler.lo: ../include/net-snmp/agent/all_helpers.h
+./mibgroup/testhandler.lo: ../include/net-snmp/agent/instance.h
+./mibgroup/testhandler.lo: ../include/net-snmp/agent/multiplexer.h
+./mibgroup/testhandler.lo: ../include/net-snmp/agent/null.h
+./mibgroup/testhandler.lo: ../include/net-snmp/agent/debug_handler.h
+./mibgroup/testhandler.lo: ../include/net-snmp/agent/old_api.h
+./mibgroup/testhandler.lo: ../include/net-snmp/agent/read_only.h
+./mibgroup/testhandler.lo: ../include/net-snmp/agent/serialize.h
+./mibgroup/testhandler.lo: ../include/net-snmp/agent/bulk_to_next.h
+./mibgroup/testhandler.lo: ../include/net-snmp/agent/mode_end_call.h
+./mibgroup/testhandler.lo: ../include/net-snmp/agent/table.h
+./mibgroup/testhandler.lo: ../include/net-snmp/agent/table_data.h
+./mibgroup/testhandler.lo: ../include/net-snmp/agent/table_dataset.h
+./mibgroup/testhandler.lo: ../include/net-snmp/agent/table_iterator.h
+./mibgroup/testhandler.lo: ../include/net-snmp/agent/mib_module_config.h
+./mibgroup/testhandler.lo: ./mibgroup/testhandler.h
+./mibgroup/util_funcs.lo: ../include/net-snmp/net-snmp-config.h
+./mibgroup/util_funcs.lo: ../include/net-snmp/system/linux.h
+./mibgroup/util_funcs.lo: ../include/net-snmp/system/sysv.h
+./mibgroup/util_funcs.lo: ../include/net-snmp/system/generic.h
+./mibgroup/util_funcs.lo: ../include/net-snmp/machine/generic.h
+./mibgroup/util_funcs.lo: ../include/net-snmp/net-snmp-includes.h
+./mibgroup/util_funcs.lo: ../include/net-snmp/definitions.h
+./mibgroup/util_funcs.lo: ../include/net-snmp/types.h
+./mibgroup/util_funcs.lo: ../include/net-snmp/library/snmp_api.h
+./mibgroup/util_funcs.lo: ../include/net-snmp/library/asn1.h
+./mibgroup/util_funcs.lo: ../include/net-snmp/library/snmp_impl.h
+./mibgroup/util_funcs.lo: ../include/net-snmp/library/snmp.h
+./mibgroup/util_funcs.lo: ../include/net-snmp/library/snmp-tc.h
+./mibgroup/util_funcs.lo: ../include/net-snmp/utilities.h
+./mibgroup/util_funcs.lo: ../include/net-snmp/library/snmp_client.h
+./mibgroup/util_funcs.lo: ../include/net-snmp/library/getopt.h
+./mibgroup/util_funcs.lo: ../include/net-snmp/library/system.h
+./mibgroup/util_funcs.lo: ../include/net-snmp/library/tools.h
+./mibgroup/util_funcs.lo: ../include/net-snmp/library/int64.h
+./mibgroup/util_funcs.lo: ../include/net-snmp/library/mt_support.h
+./mibgroup/util_funcs.lo: ../include/net-snmp/library/snmp_alarm.h
+./mibgroup/util_funcs.lo: ../include/net-snmp/library/data_list.h
+./mibgroup/util_funcs.lo: ../include/net-snmp/library/callback.h
+./mibgroup/util_funcs.lo: ../include/net-snmp/library/oid_stash.h
+./mibgroup/util_funcs.lo: ../include/net-snmp/library/check_varbind.h
+./mibgroup/util_funcs.lo: ../include/net-snmp/version.h
+./mibgroup/util_funcs.lo: ../include/net-snmp/session_api.h
+./mibgroup/util_funcs.lo: ../include/net-snmp/library/snmp_transport.h
+./mibgroup/util_funcs.lo: ../include/net-snmp/library/snmpCallbackDomain.h
+./mibgroup/util_funcs.lo: ../include/net-snmp/library/snmpUnixDomain.h
+./mibgroup/util_funcs.lo: ../include/net-snmp/library/snmpUDPDomain.h
+./mibgroup/util_funcs.lo: ../include/net-snmp/library/snmpTCPDomain.h
+./mibgroup/util_funcs.lo: ../include/net-snmp/library/snmpUDPIPv6Domain.h
+./mibgroup/util_funcs.lo: ../include/net-snmp/library/snmpTCPIPv6Domain.h
+./mibgroup/util_funcs.lo: ../include/net-snmp/library/snmpIPXDomain.h
+./mibgroup/util_funcs.lo: ../include/net-snmp/library/ucd_compat.h
+./mibgroup/util_funcs.lo: ../include/net-snmp/pdu_api.h
+./mibgroup/util_funcs.lo: ../include/net-snmp/mib_api.h
+./mibgroup/util_funcs.lo: ../include/net-snmp/library/mib.h
+./mibgroup/util_funcs.lo: ../include/net-snmp/library/parse.h
+./mibgroup/util_funcs.lo: ../include/net-snmp/varbind_api.h
+./mibgroup/util_funcs.lo: ../include/net-snmp/config_api.h
+./mibgroup/util_funcs.lo: ../include/net-snmp/library/read_config.h
+./mibgroup/util_funcs.lo: ../include/net-snmp/library/default_store.h
+./mibgroup/util_funcs.lo: ../include/net-snmp/library/snmp_parse_args.h
+./mibgroup/util_funcs.lo: ../include/net-snmp/library/snmp_enum.h
+./mibgroup/util_funcs.lo: ../include/net-snmp/library/vacm.h
+./mibgroup/util_funcs.lo: ../include/net-snmp/output_api.h
+./mibgroup/util_funcs.lo: ../include/net-snmp/library/snmp_debug.h
+./mibgroup/util_funcs.lo: ../include/net-snmp/library/snmp_logging.h
+./mibgroup/util_funcs.lo: ../include/net-snmp/snmpv3_api.h
+./mibgroup/util_funcs.lo: ../include/net-snmp/library/snmpv3.h
+./mibgroup/util_funcs.lo: ../include/net-snmp/library/transform_oids.h
+./mibgroup/util_funcs.lo: ../include/net-snmp/library/keytools.h
+./mibgroup/util_funcs.lo: ../include/net-snmp/library/scapi.h
+./mibgroup/util_funcs.lo: ../include/net-snmp/library/lcd_time.h
+./mibgroup/util_funcs.lo: ../include/net-snmp/library/snmp_secmod.h
+./mibgroup/util_funcs.lo: ../include/net-snmp/library/snmpv3-security-includes.h
+./mibgroup/util_funcs.lo: ../include/net-snmp/library/snmpusm.h
+./mibgroup/util_funcs.lo: ../include/net-snmp/agent/net-snmp-agent-includes.h
+./mibgroup/util_funcs.lo: ../include/net-snmp/agent/snmp_agent.h
+./mibgroup/util_funcs.lo: ../include/net-snmp/agent/snmp_vars.h
+./mibgroup/util_funcs.lo: ../include/net-snmp/agent/agent_handler.h
+./mibgroup/util_funcs.lo: ../include/net-snmp/agent/var_struct.h
+./mibgroup/util_funcs.lo: ../include/net-snmp/agent/agent_registry.h
+./mibgroup/util_funcs.lo: ../include/net-snmp/agent/ds_agent.h
+./mibgroup/util_funcs.lo: ../include/net-snmp/agent/agent_read_config.h
+./mibgroup/util_funcs.lo: ../include/net-snmp/agent/agent_trap.h
+./mibgroup/util_funcs.lo: ../include/net-snmp/agent/all_helpers.h
+./mibgroup/util_funcs.lo: ../include/net-snmp/agent/instance.h
+./mibgroup/util_funcs.lo: ../include/net-snmp/agent/multiplexer.h
+./mibgroup/util_funcs.lo: ../include/net-snmp/agent/null.h
+./mibgroup/util_funcs.lo: ../include/net-snmp/agent/debug_handler.h
+./mibgroup/util_funcs.lo: ../include/net-snmp/agent/old_api.h
+./mibgroup/util_funcs.lo: ../include/net-snmp/agent/read_only.h
+./mibgroup/util_funcs.lo: ../include/net-snmp/agent/serialize.h
+./mibgroup/util_funcs.lo: ../include/net-snmp/agent/bulk_to_next.h
+./mibgroup/util_funcs.lo: ../include/net-snmp/agent/mode_end_call.h
+./mibgroup/util_funcs.lo: ../include/net-snmp/agent/table.h
+./mibgroup/util_funcs.lo: ../include/net-snmp/agent/table_data.h
+./mibgroup/util_funcs.lo: ../include/net-snmp/agent/table_dataset.h
+./mibgroup/util_funcs.lo: ../include/net-snmp/agent/table_iterator.h
+./mibgroup/util_funcs.lo: ../include/net-snmp/agent/mib_module_config.h
+./mibgroup/util_funcs.lo: mibgroup/struct.h ./mibgroup/util_funcs.h
+./mibgroup/util_funcs.lo: ./mibgroup/ucd-snmp/errormib.h ./mibgroup/mibdefs.h
diff -Naur tomato/release/src/router/snmp/agent/Makefile.in tomato121/release/src/router/snmp/agent/Makefile.in
--- tomato/release/src/router/snmp/agent/Makefile.in	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/Makefile.in	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,135 @@
+#
+# Makefile for snmpd
+#
+
+top_builddir	= ..
+
+#
+# what to install
+#
+SUBDIRS=helpers mibgroup
+
+INSTALLSBINPROGS= snmpd$(EXEEXT)
+INSTALLLIBS	= libnetsnmpagent.$(LIB_EXTENSION)$(LIB_VERSION) \
+		libnetsnmpmibs.$(LIB_EXTENSION)$(LIB_VERSION)
+
+INCLUDESUBDIR=agent
+INCLUDESUBDIRHEADERS=agent_read_config.h \
+	agent_registry.h \
+	agent_index.h \
+	agent_trap.h \
+	auto_nlist.h \
+	ds_agent.h \
+	snmp_agent.h \
+	snmp_vars.h \
+	var_struct.h \
+	agent_handler.h \
+	net-snmp-agent-includes.h \
+	agent_callbacks.h
+
+INSTALLBUILTSUBDIRHEADERS=../include/net-snmp/agent/mib_module_config.h \
+			mibgroup/mib_module_includes.h
+INSTALLBUILTSUBDIR=agent
+
+OTHERINSTALL=@EMBEDPERLINSTALL@
+
+# XXX: need to install these  They're really UCD specific, however.
+BROKEINSTALL= \
+	mib_modules.h \
+	mibgroup/struct.h \
+	mibgroup/util_funcs.h \
+	mibgroup/mibincl.h \
+	mibgroup/header_complex.h
+
+INSTALLUCDHEADERS= \
+	agent_index.h	\
+	agent_read_config.h \
+	agent_registry.h \
+	agent_trap.h	\
+	auto_nlist.h	\
+	ds_agent.h	\
+	header_complex.h \
+	mibincl.h	\
+	snmp_agent.h	\
+	ucd-snmp-includes.h	\
+	ucd-snmp-agent-includes.h \
+	util_funcs.h	\
+	var_struct.h
+
+#
+# how to build it info
+#
+USELIBS		= ../snmplib/libnetsnmp.$(LIB_EXTENSION)$(LIB_VERSION)
+HELPERLIB	= helpers/libnetsnmphelpers.$(LIB_EXTENSION)$(LIB_VERSION)
+LOCAL_LIBS	= 
+LIBS		= ../snmplib/libnetsnmp.$(LIB_EXTENSION)$(LIB_VERSION) @AGENTLIBS@
+WRAPLIBS	= @WRAPLIBS@
+OUR_AGENT_LIBS	= $(INSTALLLIBS) $(HELPERLIB) $(WRAPLIBS) $(LIBS) @DLLIBS@
+CPPFLAGS	= -I../include -I$(top_srcdir)/include \
+		  -I.. -I$(srcdir)/.. -I$(srcdir)/../snmplib \
+		  -I$(srcdir) -I. -I$(srcdir)/mibgroup -Imibgroup @CPPFLAGS@
+
+#
+# Objects
+#
+
+# libnetsnmpmib objects.
+LMIBOBJS	= @mibgroup_list_lo@ mib_modules.lo auto_nlist.lo
+MIBOBJS		= @mibgroup_list_o@ mib_modules.o auto_nlist.o
+
+# libnetsnmpagent objects
+LIBAGENTOBJS=snmp_agent.o snmp_vars.o agent_read_config.o agent_registry.o \
+	agent_index.o agent_trap.o kernel.o  agent_handler.o \
+	@OTHERAGENTLIBOBJS@
+LLIBAGENTOBJS=snmp_agent.lo snmp_vars.lo agent_read_config.lo agent_registry.lo\
+	agent_index.lo agent_trap.lo kernel.lo agent_handler.lo \
+	@OTHERAGENTLIBLOBJS@
+
+# The agent objects.
+AGENTOBJS=snmpd.o
+LAGENTOBJS=snmpd.lo
+
+#
+# Define OBJS and LOBJS for clean target (just this directory)
+#
+OBJS		= $(LIBAGENTOBJS)  $(AGENTOBJS)  mib_modules.o  auto_nlist.o
+LOBJS		= $(LLIBAGENTOBJS) $(LAGENTOBJS) mib_modules.lo auto_nlist.lo
+
+
+all: standardall
+
+#
+# build stuff targets
+#
+getkstat: getkstat.o
+	$(CC) $(CFLAGS) -o $@ $? $(LOCAL_LIBS) $(LIBS)
+
+getkstat.o: mibgroup/kernel_sunos5.c
+	$(CC) $(CFLAGS) -o $@ -D_GETKSTAT_TEST -DDODEBUG -c $? 
+
+getmibstat: getmibstat.o
+	$(CC) $(CFLAGS) -o $@ $? $(LOCAL_LIBS) $(LIBS)
+
+getmibstat.o: mibgroup/kernel_sunos5.c
+	$(CC) $(CFLAGS) -o $@ -D_GETMIBSTAT_TEST -DDODEBUG -c $? 
+
+snmpd$(EXEEXT):	${LAGENTOBJS} $(USELIBS) $(HELPERLIB) $(LIBTARG) ${INSTALLLIBS}
+	$(LINK) $(CFLAGS) -o $@ ${LAGENTOBJS} $(LOCAL_LIBS) ${LDFLAGS} ${OUR_AGENT_LIBS}
+
+
+libnetsnmpagent.$(LIB_EXTENSION)$(LIB_VERSION):    ${LLIBAGENTOBJS} libnetsnmpmibs.$(LIB_EXTENSION)$(LIB_VERSION)
+	$(LIB_LD_CMD) libnetsnmpagent.$(LIB_EXTENSION)$(LIB_VERSION) ${LLIBAGENTOBJS}  $(LIB_LD_LIBS)
+	$(RANLIB) libnetsnmpagent.$(LIB_EXTENSION)$(LIB_VERSION)
+
+libnetsnmpmibs.$(LIB_EXTENSION)$(LIB_VERSION):    ${LMIBOBJS}
+	$(LIB_LD_CMD) libnetsnmpmibs.$(LIB_EXTENSION)$(LIB_VERSION) ${LMIBOBJS}  $(LIB_LD_LIBS)
+	$(RANLIB) libnetsnmpmibs.$(LIB_EXTENSION)$(LIB_VERSION)
+
+embedperlinstall:
+	  @$(SHELL) $(srcdir)/../mkinstalldirs $(snmplibdir)
+	  @$(INSTALL) $(srcdir)/snmp_perl.pl $(snmplibdir)/snmp_perl.pl
+	  @echo "install:  installed $$i in $(snmplibdir)"
+
+snmp_vars.lo: @module_list_h@
+read_config.lo: @module_list_h@
+mib_modules.lo: mibgroup/mib_module_inits.h
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/agent/.cvsignore tomato121/release/src/router/snmp/agent/mibgroup/agent/.cvsignore
--- tomato/release/src/router/snmp/agent/mibgroup/agent/.cvsignore	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/agent/.cvsignore	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,2 @@
+*.lo
+.libs
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/agent/nsModuleTable.c tomato121/release/src/router/snmp/agent/mibgroup/agent/nsModuleTable.c
--- tomato/release/src/router/snmp/agent/mibgroup/agent/nsModuleTable.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/agent/nsModuleTable.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,307 @@
+/*
+ * Note: this file originally auto-generated by mib2c using
+ *        : mib2c.iterate.conf,v 1.5 2001/12/04 21:36:27 hardaker Exp $
+ */
+
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include "nsModuleTable.h"
+
+void
+nsModuleTable_free(void *context, netsnmp_iterator_info *dont_care)
+{
+    free(context);
+}
+    
+/** Initialize the nsModuleTable table by defining it's contents and how it's structured */
+void
+initialize_table_nsModuleTable(void)
+{
+    static oid      nsModuleTable_oid[] =
+        { 1, 3, 6, 1, 4, 1, 8072, 1, 2, 1 };
+    netsnmp_table_registration_info *table_info;
+    netsnmp_handler_registration *my_handler;
+    netsnmp_iterator_info *iinfo;
+
+    /*
+     * create the table structure itself 
+     */
+    table_info = SNMP_MALLOC_TYPEDEF(netsnmp_table_registration_info);
+    iinfo = SNMP_MALLOC_TYPEDEF(netsnmp_iterator_info);
+
+    /*
+     * if your table is read only, it's easiest to change the
+     * HANDLER_CAN_RWRITE definition below to HANDLER_CAN_RONLY 
+     */
+    my_handler = netsnmp_create_handler_registration("nsModuleTable",
+                                                     nsModuleTable_handler,
+                                                     nsModuleTable_oid,
+                                                     OID_LENGTH
+                                                     (nsModuleTable_oid),
+                                                     HANDLER_CAN_RWRITE);
+
+    if (!my_handler || !table_info || !iinfo)
+        return;                 /* mallocs failed */
+
+    /***************************************************
+     * Setting up the table's definition
+     */
+    netsnmp_table_helper_add_indexes(table_info, ASN_OCTET_STR, /* context name */
+                                     ASN_OBJECT_ID,     /* reg point */
+                                     ASN_INTEGER,       /* priority */
+                                     0);
+
+    table_info->min_column = 4;
+    table_info->max_column = 6;
+
+    /*
+     * iterator access routines 
+     */
+    iinfo->get_first_data_point = nsModuleTable_get_first_data_point;
+    iinfo->get_next_data_point = nsModuleTable_get_next_data_point;
+    iinfo->free_loop_context_at_end = nsModuleTable_free;
+    iinfo->table_reginfo = table_info;
+
+    /***************************************************
+     * registering the table with the master agent
+     */
+    DEBUGMSGTL(("initialize_table_nsModuleTable",
+                "Registering table nsModuleTable as a table iterator\n"));
+    netsnmp_register_table_iterator(my_handler, iinfo);
+}
+
+/** Initialzies the nsModuleTable module */
+void
+init_nsModuleTable(void)
+{
+
+    /*
+     * here we initialize all the tables we're planning on supporting 
+     */
+    initialize_table_nsModuleTable();
+}
+
+/** returns the first data point within the nsModuleTable table data.
+
+    Set the my_loop_context variable to the first data point structure
+    of your choice (from which you can find the next one).  This could
+    be anything from the first node in a linked list, to an integer
+    pointer containing the beginning of an array variable.
+
+    Set the my_data_context variable to something to be returned to
+    you later that will provide you with the data to return in a given
+    row.  This could be the same pointer as what my_loop_context is
+    set to, or something different.
+
+    The put_index_data variable contains a list of snmp variable
+    bindings, one for each index in your table.  Set the values of
+    each appropriately according to the data matching the first row
+    and return the put_index_data variable at the end of the function.
+*/
+typedef struct context_tree_ptr_s {
+    netsnmp_subtree *tree;
+    subtree_context_cache *context_ptr;
+} context_tree_ptr;
+
+netsnmp_variable_list *
+nsModuleTable_get_first_data_point(void **my_loop_context,
+                                   void **my_data_context,
+                                   netsnmp_variable_list * put_index_data,
+                                   netsnmp_iterator_info *otherstuff)
+{
+
+    struct variable_list *vptr;
+    u_long          ultmp;
+    context_tree_ptr *ctree;
+
+    ctree = SNMP_MALLOC_TYPEDEF(context_tree_ptr);
+
+    ctree->context_ptr = get_top_context_cache();
+    ctree->tree = ctree->context_ptr->first_subtree;
+
+    *my_loop_context = ctree;
+    *my_data_context = ctree->tree;
+
+    vptr = put_index_data;
+    snmp_set_var_value(vptr, (u_char *) ctree->context_ptr->context_name,
+                       strlen(ctree->context_ptr->context_name));
+
+    vptr = vptr->next_variable;
+    snmp_set_var_value(vptr,
+                       (u_char *)ctree->context_ptr->first_subtree->name_a,
+                       ctree->context_ptr->first_subtree->namelen *
+                       sizeof(oid));
+
+    ultmp = ctree->context_ptr->first_subtree->priority;
+    vptr = vptr->next_variable;
+    snmp_set_var_value(vptr, (u_char *) & ultmp, sizeof(ultmp));
+
+    return put_index_data;
+}
+
+/** functionally the same as nsModuleTable_get_first_data_point, but
+   my_loop_context has already been set to a previous value and should
+   be updated to the next in the list.  For example, if it was a
+   linked list, you might want to cast it and the return
+   my_loop_context->next.  The my_data_context pointer should be set
+   to something you need later and the indexes in put_index_data
+   updated again. */
+
+struct variable_list *
+nsModuleTable_get_next_data_point(void **my_loop_context,
+                                  void **my_data_context,
+                                  struct variable_list *put_index_data,
+                                  netsnmp_iterator_info *otherstuff)
+{
+
+    struct variable_list *vptr;
+    context_tree_ptr *ctree = (context_tree_ptr *) * my_loop_context;
+    u_long          ultmp;
+
+    if (ctree->tree->next)
+        ctree->tree = ctree->tree->next;
+    else {
+        ctree->context_ptr = ctree->context_ptr->next;
+        if (!ctree->context_ptr) {
+            return NULL;
+        }
+        ctree->tree = ctree->context_ptr->first_subtree;
+    }
+
+    *my_data_context = ctree->tree;
+
+    vptr = put_index_data;
+    snmp_set_var_value(vptr, (u_char *) ctree->context_ptr->context_name,
+                       strlen(ctree->context_ptr->context_name));
+
+    vptr = vptr->next_variable;
+    snmp_set_var_value(vptr, (u_char *) ctree->tree->name_a,
+                       ctree->tree->namelen * sizeof(oid));
+
+    ultmp = ctree->tree->priority;
+    vptr = vptr->next_variable;
+    snmp_set_var_value(vptr, (u_char *) & ultmp, sizeof(ultmp));
+
+    return put_index_data;
+}
+
+/** handles requests for the nsModuleTable table, if anything else needs to be done */
+int
+nsModuleTable_handler(netsnmp_mib_handler *handler,
+                      netsnmp_handler_registration *reginfo,
+                      netsnmp_agent_request_info *reqinfo,
+                      netsnmp_request_info *requests)
+{
+
+    netsnmp_table_request_info *table_info;
+    netsnmp_request_info *request;
+    netsnmp_variable_list *var;
+    netsnmp_subtree *tree;
+    u_long          ultmp;
+    u_char          modes[1];
+
+    for (request = requests; request; request = request->next) {
+        var = request->requestvb;
+        if (request->processed != 0)
+            continue;
+
+        /*
+         * perform anything here that you need to do.  The request have
+         * already been processed by the master table_dataset handler, but
+         * this gives you chance to act on the request in some other way if 
+         * need be. 
+         */
+
+        /*
+         * the following extracts the my_data_context pointer set in the
+         * loop functions above.  You can then use the results to help
+         * return data for the columns of the nsModuleTable table in
+         * question 
+         */
+        tree = (netsnmp_subtree *)netsnmp_extract_iterator_context(request);
+        if (tree == NULL) {
+            if (reqinfo->mode == MODE_GET) {
+                netsnmp_set_request_error(reqinfo, request,
+                                          SNMP_NOSUCHINSTANCE);
+                continue;
+            }
+            /*
+             * XXX: no row existed, if you support creation and this is a
+             * set, start dealing with it here, else continue 
+             */
+        }
+
+        /*
+         * extracts the information about the table from the request 
+         */
+        table_info = netsnmp_extract_table_info(request);
+
+        /*
+         * table_info->colnum contains the column number requested 
+         */
+        /*
+         * table_info->indexes contains a linked list of snmp variable
+         * bindings for the indexes of the table.  Values in the list have 
+         * been set corresponding to the indexes of the request 
+         */
+        if (table_info == NULL) {
+            continue;
+        }
+
+        switch (reqinfo->mode) {
+            /*
+             * the table_iterator helper should change all GETNEXTs into
+             * GETs for you automatically, so you don't have to worry
+             * about the GETNEXT case.  Only GETs and SETs need to be
+             * dealt with here 
+             */
+        case MODE_GET:
+            switch (table_info->colnum) {
+            case COLUMN_NSMODULENAME:
+		if (tree->reginfo->handlerName) {
+                    snmp_set_var_typed_value(var, ASN_OCTET_STR,
+                                           tree->reginfo->handlerName,
+                                           strlen(tree->reginfo->handlerName));
+                } else {
+                    snmp_set_var_typed_value(var, ASN_OCTET_STR, "", 0);
+		}
+                break;
+
+            case COLUMN_NSMODULEMODES:
+                /*
+                 * basically, these BITS needs to be inverted in order 
+                 */
+                modes[0] =
+                    ((HANDLER_CAN_GETANDGETNEXT & tree->reginfo->
+                      modes) << 7) | ((HANDLER_CAN_SET & tree->reginfo->
+                                       modes) << 5) | ((HANDLER_CAN_GETBULK
+                                                        & tree->reginfo->
+                                                        modes) << 3);
+		/*  yuck  */
+                snmp_set_var_typed_value(var, ASN_OCTET_STR, modes, 1);
+                break;
+
+            case COLUMN_NSMODULETIMEOUT:
+                ultmp = tree->timeout;
+                snmp_set_var_typed_value(var, ASN_INTEGER,
+                                         (u_char *) & ultmp,
+                                         sizeof(u_long));
+                break;
+
+            default:
+                /*
+                 * We shouldn't get here 
+                 */
+                snmp_log(LOG_ERR,
+                         "problem encountered in nsModuleTable_handler: unknown column\n");
+            }
+            break;
+
+        default:
+            snmp_log(LOG_ERR,
+                     "problem encountered in nsModuleTable_handler: unsupported mode\n");
+        }
+    }
+    return SNMP_ERR_NOERROR;
+}
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/agent/nsModuleTable.h tomato121/release/src/router/snmp/agent/mibgroup/agent/nsModuleTable.h
--- tomato/release/src/router/snmp/agent/mibgroup/agent/nsModuleTable.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/agent/nsModuleTable.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,27 @@
+/*
+ * Note: this file originally auto-generated by mib2c using
+ *        : mib2c.iterate.conf,v 1.5 2001/12/04 21:36:27 hardaker Exp $
+ */
+#ifndef NSMODULETABLE_H
+#define NSMODULETABLE_H
+
+/*
+ * function declarations 
+ */
+void            init_nsModuleTable(void);
+void            initialize_table_nsModuleTable(void);
+Netsnmp_Node_Handler nsModuleTable_handler;
+
+Netsnmp_First_Data_Point nsModuleTable_get_first_data_point;
+Netsnmp_Next_Data_Point nsModuleTable_get_next_data_point;
+
+/*
+ * column number definitions for table nsModuleTable 
+ */
+#define COLUMN_NSMCONTEXTNAME		1
+#define COLUMN_NSMREGISTRATIONPOINT	2
+#define COLUMN_NSMREGISTRATIONPRIORITY	3
+#define COLUMN_NSMODULENAME		4
+#define COLUMN_NSMODULEMODES		5
+#define COLUMN_NSMODULETIMEOUT		6
+#endif                          /* NSMODULETABLE_H */
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/agent/nsTransactionTable.c tomato121/release/src/router/snmp/agent/mibgroup/agent/nsTransactionTable.c
--- tomato/release/src/router/snmp/agent/mibgroup/agent/nsTransactionTable.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/agent/nsTransactionTable.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,244 @@
+/*
+ * Note: this file originally auto-generated by mib2c 
+ */
+
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+#include <net-snmp/agent/table.h>
+#include <net-snmp/agent/table_iterator.h>
+#include "nsTransactionTable.h"
+
+/** Initialize the nsTransactionTable table by defining it's contents
+   and how it's structured */
+void
+initialize_table_nsTransactionTable(void)
+{
+    static oid      nsTransactionTable_oid[] =
+        { 1, 3, 6, 1, 4, 1, 8072, 1, 8, 1 };
+    size_t          nsTransactionTable_oid_len =
+        OID_LENGTH(nsTransactionTable_oid);
+    netsnmp_table_registration_info *table_info;
+    netsnmp_handler_registration *my_handler;
+    netsnmp_iterator_info *iinfo;
+
+    /*
+     * create the table structure itself 
+     */
+    table_info = SNMP_MALLOC_TYPEDEF(netsnmp_table_registration_info);
+    iinfo = SNMP_MALLOC_TYPEDEF(netsnmp_iterator_info);
+
+    /*
+     * if your table is read only, it's easiest to change the
+     * HANDLER_CAN_RWRITE definition below to HANDLER_CAN_RONLY 
+     */
+    my_handler = netsnmp_create_handler_registration("nsTransactionTable",
+                                                     nsTransactionTable_handler,
+                                                     nsTransactionTable_oid,
+                                                     nsTransactionTable_oid_len,
+                                                     HANDLER_CAN_RONLY);
+
+    if (!my_handler || !table_info || !iinfo)
+        return;                 /* mallocs failed */
+
+    /***************************************************
+     * Setting up the table's definition
+     */
+    netsnmp_table_helper_add_index(table_info, ASN_INTEGER);    /* index:
+                                                                 * * nsTransactionID 
+                                                                 */
+
+    table_info->min_column = 2;
+    table_info->max_column = 2;
+    iinfo->get_first_data_point = nsTransactionTable_get_first_data_point;
+    iinfo->get_next_data_point = nsTransactionTable_get_next_data_point;
+    iinfo->table_reginfo = table_info;
+
+    /***************************************************
+     * registering the table with the master agent
+     */
+    DEBUGMSGTL(("initialize_table_nsTransactionTable",
+                "Registering table nsTransactionTable as a table iterator\n"));
+    netsnmp_register_table_iterator(my_handler, iinfo);
+}
+
+/** Initialzies the nsTransactionTable module */
+void
+init_nsTransactionTable(void)
+{
+
+    /*
+     * here we initialize all the tables we're planning on supporting 
+     */
+    initialize_table_nsTransactionTable();
+}
+
+/** returns the first data point within the nsTransactionTable table data.
+
+    Set the my_loop_context variable to the first data point structure
+    of your choice (from which you can find the next one).  This could
+    be anything from the first node in a linked list, to an integer
+    pointer containing the beginning of an array variable.
+
+    Set the my_data_context variable to something to be returned to
+    you later that will provide you with the data to return in a given
+    row.  This could be the same pointer as what my_loop_context is
+    set to, or something different.
+
+    The put_index_data variable contains a list of snmp variable
+    bindings, one for each index in your table.  Set the values of
+    each appropriately according to the data matching the first row
+    and return the put_index_data variable at the end of the function.
+*/
+extern netsnmp_agent_session *agent_delegated_list;
+
+netsnmp_variable_list *
+nsTransactionTable_get_first_data_point(void **my_loop_context,
+                                        void **my_data_context,
+                                        netsnmp_variable_list
+                                        * put_index_data,
+                                        netsnmp_iterator_info *iinfo)
+{
+
+    netsnmp_variable_list *vptr;
+
+    if (!agent_delegated_list)
+        return NULL;
+
+    *my_loop_context = (void *) agent_delegated_list;
+    *my_data_context = (void *) agent_delegated_list;
+
+    vptr = put_index_data;
+
+    snmp_set_var_value(vptr,
+                       (u_char *) & agent_delegated_list->pdu->transid,
+                       sizeof(agent_delegated_list->pdu->transid));
+    return put_index_data;
+}
+
+/** functionally the same as nsTransactionTable_get_first_data_point, but
+   my_loop_context has already been set to a previous value and should
+   be updated to the next in the list.  For example, if it was a
+   linked list, you might want to cast it and the return
+   my_loop_context->next.  The my_data_context pointer should be set
+   to something you need later and the indexes in put_index_data
+   updated again. */
+
+netsnmp_variable_list *
+nsTransactionTable_get_next_data_point(void **my_loop_context,
+                                       void **my_data_context,
+                                       netsnmp_variable_list
+                                       * put_index_data,
+                                       netsnmp_iterator_info *iinfo)
+{
+
+    netsnmp_variable_list *vptr;
+    netsnmp_agent_session *alist = (netsnmp_agent_session *)
+        *my_loop_context;
+
+    if (!alist->next)
+        return NULL;
+
+    alist = alist->next;
+
+    *my_loop_context = (void *) alist;
+    *my_data_context = (void *) alist;
+
+    vptr = put_index_data;
+
+    snmp_set_var_value(vptr, (u_char *) & alist->pdu->transid,
+                       sizeof(alist->pdu->transid));
+    return put_index_data;
+}
+
+/** handles requests for the nsTransactionTable table, if anything
+   else needs to be done */
+int
+nsTransactionTable_handler(netsnmp_mib_handler *handler,
+                           netsnmp_handler_registration *reginfo,
+                           netsnmp_agent_request_info *reqinfo,
+                           netsnmp_request_info *requests)
+{
+
+    netsnmp_table_request_info *table_info;
+    netsnmp_variable_list *var;
+    netsnmp_agent_session *asp;
+
+    while (requests) {
+        var = requests->requestvb;
+        if (requests->processed != 0)
+            continue;
+
+        /*
+         * perform anything here that you need to do.  The requests have
+         * already been processed by the master table_dataset handler, but
+         * this gives you chance to act on the request in some other way if 
+         * need be. 
+         */
+
+        /*
+         * the following extracts the my_data_context pointer set in the
+         * loop functions above.  You can then use the results to help
+         * return data for the columns of the nsTransactionTable table in
+         * question 
+         */
+        asp =
+            (netsnmp_agent_session *)
+            netsnmp_extract_iterator_context(requests);
+        if (asp == NULL) {
+            netsnmp_set_request_error(reqinfo, requests,
+                                      SNMP_NOSUCHINSTANCE);
+        }
+
+        /*
+         * extracts the information about the table from the request 
+         */
+        table_info = netsnmp_extract_table_info(requests);
+
+        /*
+         * table_info->colnum contains the column number requested 
+         */
+        /*
+         * table_info->indexes contains a linked list of snmp variable
+         * bindings for the indexes of the table.  Values in the list have 
+         * been set corresponding to the indexes of the request 
+         */
+        if (table_info == NULL) {
+            requests = requests->next;
+            continue;
+        }
+
+        switch (reqinfo->mode) {
+            /*
+             * the table_iterator helper should change all GETNEXTs into
+             * GETs for you automatically, so you don't have to worry
+             * about the GETNEXT case.  Only GETs and SETs need to be
+             * dealt with here 
+             */
+        case MODE_GET:
+            switch (table_info->colnum) {
+
+            case COLUMN_NSTRANSACTIONMODE:
+                snmp_set_var_typed_value(var, ASN_INTEGER,
+                                         (u_char *) & asp->mode,
+                                         sizeof(asp->mode));
+                break;
+
+            default:
+                /*
+                 * We shouldn't get here 
+                 */
+                snmp_log(LOG_ERR,
+                         "problem encountered in nsTransactionTable_handler: unknown column\n");
+            }
+            break;
+
+        default:
+            snmp_log(LOG_ERR,
+                     "problem encountered in nsTransactionTable_handler: unsupported mode\n");
+        }
+        requests = requests->next;
+    }
+    return SNMP_ERR_NOERROR;
+}
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/agent/nsTransactionTable.h tomato121/release/src/router/snmp/agent/mibgroup/agent/nsTransactionTable.h
--- tomato/release/src/router/snmp/agent/mibgroup/agent/nsTransactionTable.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/agent/nsTransactionTable.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,21 @@
+/*
+ * Note: this file originally auto-generated by mib2c 
+ */
+#ifndef NSTRANSACTIONTABLE_H
+#define NSTRANSACTIONTABLE_H
+
+/*
+ * function declarations 
+ */
+void            init_nsTransactionTable(void);
+void            initialize_table_nsTransactionTable(void);
+Netsnmp_Node_Handler nsTransactionTable_handler;
+Netsnmp_First_Data_Point nsTransactionTable_get_first_data_point;
+Netsnmp_Next_Data_Point nsTransactionTable_get_next_data_point;
+
+/*
+ * column number definitions for table nsTransactionTable 
+ */
+#define COLUMN_NSTRANSACTIONID		1
+#define COLUMN_NSTRANSACTIONMODE		2
+#endif                          /* NSTRANSACTIONTABLE_H */
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/agent_mibs.h tomato121/release/src/router/snmp/agent/mibgroup/agent_mibs.h
--- tomato/release/src/router/snmp/agent/mibgroup/agent_mibs.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/agent_mibs.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,3 @@
+config_require(agent/nsTransactionTable)
+config_require(agent/nsModuleTable)
+config_add_mib(NET-SNMP-AGENT-MIB)
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/agentx/agentx_config.c tomato121/release/src/router/snmp/agent/mibgroup/agentx/agentx_config.c
--- tomato/release/src/router/snmp/agent/mibgroup/agentx/agentx_config.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/agentx/agentx_config.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,97 @@
+/*
+ *  AgentX Configuration
+ */
+#include <net-snmp/net-snmp-config.h>
+
+#include <stdio.h>
+#include <sys/types.h>
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#if HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include "snmpd.h"
+#include "agentx/agentx_config.h"
+
+#ifdef USING_AGENTX_MASTER_MODULE
+void
+agentx_parse_master(const char *token, char *cptr)
+{
+    int             i = -1;
+    char            buf[BUFSIZ];
+
+    if (!strcmp(cptr, "agentx") ||
+        !strcmp(cptr, "all") ||
+        !strcmp(cptr, "yes") || !strcmp(cptr, "on")) {
+        i = 1;
+        snmp_log(LOG_INFO, "Turning on AgentX master support.\n");
+    } else if (!strcmp(cptr, "no") || !strcmp(cptr, "off"))
+        i = 0;
+    else
+        i = atoi(cptr);
+
+    if (i < 0 || i > 1) {
+        sprintf(buf, "master '%s' unrecognised", cptr);
+        config_perror(buf);
+    } else
+        netsnmp_ds_set_boolean(NETSNMP_DS_APPLICATION_ID, NETSNMP_DS_AGENT_AGENTX_MASTER, i);
+}
+#endif                          /* USING_AGENTX_MASTER_MODULE */
+
+void
+agentx_parse_agentx_socket(const char *token, char *cptr)
+{
+    DEBUGMSGTL(("agentx/config", "port spec: %s\n", cptr));
+    netsnmp_ds_set_string(NETSNMP_DS_APPLICATION_ID, NETSNMP_DS_AGENT_X_SOCKET, cptr);
+}
+
+void
+agentx_parse_agentx_timeout(const char *token, char *cptr)
+{
+    int x = atoi(cptr);
+    DEBUGMSGTL(("agentx/config/timeout", "%s\n", cptr));
+    netsnmp_ds_set_int(NETSNMP_DS_APPLICATION_ID,
+                       NETSNMP_DS_AGENT_AGENTX_TIMEOUT, x * ONE_SEC);
+}
+
+void
+agentx_parse_agentx_retries(const char *token, char *cptr)
+{
+    int x = atoi(cptr);
+    DEBUGMSGTL(("agentx/config/retries", "%s\n", cptr));
+    netsnmp_ds_set_int(NETSNMP_DS_APPLICATION_ID,
+                       NETSNMP_DS_AGENT_AGENTX_RETRIES, x);
+}
+
+void
+init_agentx_config(void)
+{
+    /*
+     * Don't set this up as part of the per-module initialisation.
+     * Delay this until the 'init_master_agent()' routine is called,
+     *   so that the config settings have been processed.
+     * This means that we can use a config directive to determine
+     *   whether or not to run as an AgentX master.
+     */
+#ifdef USING_AGENTX_MASTER_MODULE
+    if (netsnmp_ds_get_boolean(NETSNMP_DS_APPLICATION_ID, NETSNMP_DS_AGENT_ROLE) == MASTER_AGENT)
+        snmpd_register_config_handler("master",
+                                      agentx_parse_master, NULL,
+                                      "specify 'agentx' for AgentX support");
+#endif                          /* USING_AGENTX_MASTER_MODULE */
+    snmpd_register_config_handler("agentxsocket",
+                                  agentx_parse_agentx_socket, NULL,
+                                  "AgentX bind address");
+    snmpd_register_config_handler("agentxRetries",
+                                  agentx_parse_agentx_retries, NULL,
+                                  "AgentX Retries");
+    snmpd_register_config_handler("agentxTimeout",
+                                  agentx_parse_agentx_timeout, NULL,
+                                  "AgentX Timeout (seconds)");
+}
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/agentx/agentx_config.h tomato121/release/src/router/snmp/agent/mibgroup/agentx/agentx_config.h
--- tomato/release/src/router/snmp/agent/mibgroup/agentx/agentx_config.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/agentx/agentx_config.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,16 @@
+#ifndef __AGENTX_CONFIG_H__
+#define __AGENTX_CONFIG_H__
+
+#ifdef __cplusplus
+extern          "C" {
+#endif
+
+    void            agentx_parse_master(const char *token, char *cptr);
+    void            agentx_parse_agentx_socket(const char *token,
+                                               char *cptr);
+    void            init_agentx_config(void);
+
+#ifdef __cplusplus
+}
+#endif
+#endif                          /* __AGENTX_CONFIG_H__ */
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/agentx/client.c tomato121/release/src/router/snmp/agent/mibgroup/agentx/client.c
--- tomato/release/src/router/snmp/agent/mibgroup/agentx/client.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/agentx/client.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,490 @@
+/*
+ *   AgentX utility routines
+ */
+
+#include <net-snmp/net-snmp-config.h>
+
+#include <stdio.h>
+#include <errno.h>
+#if HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#if HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+#if HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#include <sys/types.h>
+#if TIME_WITH_SYS_TIME
+# ifdef WIN32
+#  include <sys/timeb.h>
+# else
+#  include <sys/time.h>
+# endif
+# include <time.h>
+#else
+# if HAVE_SYS_TIME_H
+#  include <sys/time.h>
+# else
+#  include <time.h>
+# endif
+#endif
+
+#if HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+#if HAVE_WINSOCK_H
+#include <winsock.h>
+#endif
+
+#if HAVE_DMALLOC_H
+#include <dmalloc.h>
+#endif
+
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include <net-snmp/agent/agent_index.h>
+
+#include "agentx/protocol.h"
+#include "agentx/client.h"
+#include "agentx/subagent.h"
+
+extern struct timeval starttime;
+
+        /*
+         * AgentX handling utility routines
+         *
+         * Mostly wrappers round, or re-writes of
+         *   the SNMP equivalents
+         */
+
+int
+agentx_synch_input(int op,
+                   netsnmp_session * session,
+                   int reqid, netsnmp_pdu *pdu, void *magic)
+{
+    struct synch_state *state = (struct synch_state *) magic;
+    struct timeval  now, diff;
+
+    if (reqid != state->reqid) {
+        return handle_agentx_packet(op, session, reqid, pdu, magic);
+    }
+
+    DEBUGMSGTL(("agentx/subagent", "synching input, op 0x%02x\n", op));
+    state->waiting = 0;
+    if (op == NETSNMP_CALLBACK_OP_RECEIVED_MESSAGE) {
+        if (pdu->command == AGENTX_MSG_RESPONSE) {
+            state->pdu = snmp_clone_pdu(pdu);
+            state->status = STAT_SUCCESS;
+            session->s_snmp_errno = SNMPERR_SUCCESS;
+
+            /*
+             * Synchronise sysUpTime with the master agent
+             */
+            gettimeofday(&now, NULL);
+            now.tv_sec--;
+            now.tv_usec += 1000000L;
+            diff.tv_sec = pdu->time / 100;
+            diff.tv_usec = (pdu->time - (diff.tv_sec * 100)) * 10000;
+            starttime.tv_sec = now.tv_sec - diff.tv_sec;
+            starttime.tv_usec = now.tv_usec - diff.tv_usec;
+            if (starttime.tv_usec > 1000000L) {
+                starttime.tv_usec -= 1000000L;
+                starttime.tv_sec++;
+            }
+        }
+    } else if (op == NETSNMP_CALLBACK_OP_TIMED_OUT) {
+        state->pdu = NULL;
+        state->status = STAT_TIMEOUT;
+        session->s_snmp_errno = SNMPERR_TIMEOUT;
+    } else if (op == NETSNMP_CALLBACK_OP_DISCONNECT) {
+        return handle_agentx_packet(op, session, reqid, pdu, magic);
+    }
+
+    return 1;
+}
+
+
+
+int
+agentx_synch_response(netsnmp_session * ss, netsnmp_pdu *pdu,
+                      netsnmp_pdu **response)
+{
+    return snmp_synch_response_cb(ss, pdu, response, agentx_synch_input);
+}
+
+
+        /*
+         * AgentX PofE convenience functions
+         */
+
+int
+agentx_open_session(netsnmp_session * ss)
+{
+    netsnmp_pdu    *pdu, *response;
+    extern oid      version_sysoid[];
+
+    DEBUGMSGTL(("agentx/subagent", "opening session \n"));
+    if (ss == NULL || !IS_AGENTX_VERSION(ss->version)) {
+        return 0;
+    }
+
+    pdu = snmp_pdu_create(AGENTX_MSG_OPEN);
+    if (pdu == NULL)
+        return 0;
+    pdu->time = 0;
+    snmp_add_var(pdu, version_sysoid, SYSTEM_DOT_MIB_LENGTH,
+		 's', "Net-SNMP AgentX sub-agent");
+
+    if (agentx_synch_response(ss, pdu, &response) != STAT_SUCCESS)
+        return 0;
+
+    if (response->errstat != SNMP_ERR_NOERROR) {
+        snmp_free_pdu(response);
+        return 0;
+    }
+
+    ss->sessid = response->sessid;
+    snmp_free_pdu(response);
+
+    DEBUGMSGTL(("agentx/subagent", "open \n"));
+    return 1;
+}
+
+int
+agentx_close_session(netsnmp_session * ss, int why)
+{
+    netsnmp_pdu    *pdu, *response;
+    DEBUGMSGTL(("agentx/subagent", "closing session\n"));
+
+    if (ss == NULL || !IS_AGENTX_VERSION(ss->version)) {
+        return 0;
+    }
+
+    pdu = snmp_pdu_create(AGENTX_MSG_CLOSE);
+    if (pdu == NULL)
+        return 0;
+    pdu->time = 0;
+    pdu->errstat = why;
+    pdu->sessid = ss->sessid;
+
+    (void) agentx_synch_response(ss, pdu, &response);
+    snmp_free_pdu(response);
+    DEBUGMSGTL(("agentx/subagent", "closed\n"));
+
+    return 1;
+}
+
+int
+agentx_register(netsnmp_session * ss, oid start[], size_t startlen,
+                int priority, int range_subid, oid range_ubound,
+                int timeout, u_char flags)
+{
+    netsnmp_pdu    *pdu, *response;
+
+    DEBUGMSGTL(("agentx/subagent", "registering: "));
+    DEBUGMSGOIDRANGE(("agentx/subagent", start, startlen, range_subid,
+                      range_ubound));
+    DEBUGMSG(("agentx/subagent", "\n"));
+
+    if (ss == NULL || !IS_AGENTX_VERSION(ss->version)) {
+        return 0;
+    }
+
+    pdu = snmp_pdu_create(AGENTX_MSG_REGISTER);
+    if (pdu == NULL) {
+        return 0;
+    }
+    pdu->time = timeout;
+    pdu->priority = priority;
+    pdu->sessid = ss->sessid;
+    pdu->range_subid = range_subid;
+
+    if (flags & FULLY_QUALIFIED_INSTANCE) {
+        pdu->flags |= AGENTX_MSG_FLAG_INSTANCE_REGISTER;
+    }
+
+    if (range_subid) {
+        snmp_pdu_add_variable(pdu, start, startlen, ASN_OBJECT_ID,
+                              (u_char *) start, startlen * sizeof(oid));
+        pdu->variables->val.objid[range_subid - 1] = range_ubound;
+    } else {
+        snmp_add_null_var(pdu, start, startlen);
+    }
+
+    if (agentx_synch_response(ss, pdu, &response) != STAT_SUCCESS) {
+        DEBUGMSGTL(("agentx/subagent", "registering failed!\n"));
+        return 0;
+    }
+
+    if (response->errstat != SNMP_ERR_NOERROR) {
+        DEBUGMSGTL(("agentx/subagent", "registering pdu failed: %d!\n",
+                    response->errstat));
+        snmp_free_pdu(response);
+        return 0;
+    }
+
+    snmp_free_pdu(response);
+    DEBUGMSGTL(("agentx/subagent", "registered\n"));
+    return 1;
+}
+
+int
+agentx_unregister(netsnmp_session * ss, oid start[], size_t startlen,
+                  int priority, int range_subid, oid range_ubound)
+{
+    netsnmp_pdu    *pdu, *response;
+
+    if (ss == NULL || !IS_AGENTX_VERSION(ss->version)) {
+        return 0;
+    }
+
+    DEBUGMSGTL(("agentx/subagent", "unregistering: "));
+    DEBUGMSGOIDRANGE(("agentx/subagent", start, startlen, range_subid,
+                      range_ubound));
+    DEBUGMSG(("agentx/subagent", "\n"));
+    pdu = snmp_pdu_create(AGENTX_MSG_UNREGISTER);
+    if (pdu == NULL) {
+        return 0;
+    }
+    pdu->time = 0;
+    pdu->priority = priority;
+    pdu->sessid = ss->sessid;
+    pdu->range_subid = range_subid;
+    if (range_subid) {
+        snmp_pdu_add_variable(pdu, start, startlen, ASN_OBJECT_ID,
+                              (u_char *) start, startlen * sizeof(oid));
+        pdu->variables->val.objid[range_subid - 1] = range_ubound;
+    } else {
+        snmp_add_null_var(pdu, start, startlen);
+    }
+
+    if (agentx_synch_response(ss, pdu, &response) != STAT_SUCCESS)
+        return 0;
+
+    if (response->errstat != SNMP_ERR_NOERROR) {
+        snmp_free_pdu(response);
+        return 0;
+    }
+
+    snmp_free_pdu(response);
+    DEBUGMSGTL(("agentx/subagent", "unregistered\n"));
+    return 1;
+}
+
+netsnmp_variable_list *
+agentx_register_index(netsnmp_session * ss,
+                      netsnmp_variable_list * varbind, int flags)
+{
+    netsnmp_pdu    *pdu, *response;
+    netsnmp_variable_list *varbind2;
+
+    if (ss == NULL || !IS_AGENTX_VERSION(ss->version)) {
+        return NULL;
+    }
+
+    /*
+     * Make a copy of the index request varbind
+     *    for the AgentX request PDU
+     *    (since the pdu structure will be freed)
+     */
+    varbind2 =
+        (netsnmp_variable_list *) malloc(sizeof(netsnmp_variable_list));
+    if (varbind2 == NULL)
+        return NULL;
+    if (snmp_clone_var(varbind, varbind2)) {
+        snmp_free_varbind(varbind2);
+        return NULL;
+    }
+    if (varbind2->val.string == NULL)
+        varbind2->val.string = varbind2->buf;   /* ensure it points somewhere */
+
+    pdu = snmp_pdu_create(AGENTX_MSG_INDEX_ALLOCATE);
+    if (pdu == NULL) {
+        snmp_free_varbind(varbind2);
+        return NULL;
+    }
+    pdu->time = 0;
+    pdu->sessid = ss->sessid;
+    if (flags == ALLOCATE_ANY_INDEX)
+        pdu->flags |= AGENTX_MSG_FLAG_ANY_INSTANCE;
+    if (flags == ALLOCATE_NEW_INDEX)
+        pdu->flags |= AGENTX_MSG_FLAG_NEW_INSTANCE;
+
+    /*
+     *  Just send a single index request varbind.
+     *  Although the AgentX protocol supports
+     *    multiple index allocations in a single
+     *    request, the model used in the net-snmp agent
+     *    doesn't currently take advantage of this.
+     *  I believe this is our prerogative - just as
+     *    long as the master side Index request handler
+     *    can cope with multiple index requests.
+     */
+    pdu->variables = varbind2;
+
+    if (agentx_synch_response(ss, pdu, &response) != STAT_SUCCESS)
+        return NULL;
+
+    if (response->errstat != SNMP_ERR_NOERROR) {
+        snmp_free_pdu(response);
+        return NULL;
+    }
+
+    /*
+     * Unlink the (single) response varbind to return
+     *  to the main driving index request routine.
+     *
+     * This is a memory leak, as nothing will ever
+     *  release this varbind.  If this becomes a problem,
+     *  we'll need to keep a list of these here, and
+     *  free the memory in the "index release" routine.
+     * But the master side never frees these either (by
+     *  design, since it still needs them), so expecting
+     *  the subagent to is discrimination, pure & simple :-)
+     */
+    varbind2 = response->variables;
+    response->variables = NULL;
+    snmp_free_pdu(response);
+    return varbind2;
+}
+
+int
+agentx_unregister_index(netsnmp_session * ss,
+                        netsnmp_variable_list * varbind)
+{
+    netsnmp_pdu    *pdu, *response;
+    netsnmp_variable_list *varbind2;
+
+    if (ss == NULL || !IS_AGENTX_VERSION(ss->version)) {
+        return -1;
+    }
+
+    /*
+     * Make a copy of the index request varbind
+     *    for the AgentX request PDU
+     *    (since the pdu structure will be freed)
+     */
+    varbind2 =
+        (netsnmp_variable_list *) malloc(sizeof(netsnmp_variable_list));
+    if (varbind2 == NULL)
+        return -1;
+    if (snmp_clone_var(varbind, varbind2)) {
+        snmp_free_varbind(varbind2);
+        return -1;
+    }
+
+    pdu = snmp_pdu_create(AGENTX_MSG_INDEX_DEALLOCATE);
+    if (pdu == NULL) {
+        snmp_free_varbind(varbind2);
+        return -1;
+    }
+    pdu->time = 0;
+    pdu->sessid = ss->sessid;
+
+    /*
+     *  Just send a single index release varbind.
+     *      (as above)
+     */
+    pdu->variables = varbind2;
+
+    if (agentx_synch_response(ss, pdu, &response) != STAT_SUCCESS)
+        return -1;
+
+    if (response->errstat != SNMP_ERR_NOERROR) {
+        snmp_free_pdu(response);
+        return -1;              /* XXX - say why */
+    }
+
+    snmp_free_pdu(response);
+    return SNMP_ERR_NOERROR;
+}
+
+int
+agentx_add_agentcaps(netsnmp_session * ss,
+                     oid * agent_cap, size_t agent_caplen,
+                     const char *descr)
+{
+    netsnmp_pdu    *pdu, *response;
+
+    if (ss == NULL || !IS_AGENTX_VERSION(ss->version)) {
+        return 0;
+    }
+
+    pdu = snmp_pdu_create(AGENTX_MSG_ADD_AGENT_CAPS);
+    if (pdu == NULL)
+        return 0;
+    pdu->time = 0;
+    pdu->sessid = ss->sessid;
+    snmp_add_var(pdu, agent_cap, agent_caplen, 's', descr);
+
+    if (agentx_synch_response(ss, pdu, &response) != STAT_SUCCESS)
+        return 0;
+
+    if (response->errstat != SNMP_ERR_NOERROR) {
+        snmp_free_pdu(response);
+        return 0;
+    }
+
+    snmp_free_pdu(response);
+    return 1;
+}
+
+int
+agentx_remove_agentcaps(netsnmp_session * ss,
+                        oid * agent_cap, size_t agent_caplen)
+{
+    netsnmp_pdu    *pdu, *response;
+
+    if (ss == NULL || !IS_AGENTX_VERSION(ss->version)) {
+        return 0;
+    }
+
+    pdu = snmp_pdu_create(AGENTX_MSG_REMOVE_AGENT_CAPS);
+    if (pdu == NULL)
+        return 0;
+    pdu->time = 0;
+    pdu->sessid = ss->sessid;
+    snmp_add_null_var(pdu, agent_cap, agent_caplen);
+
+    if (agentx_synch_response(ss, pdu, &response) != STAT_SUCCESS)
+        return 0;
+
+    if (response->errstat != SNMP_ERR_NOERROR) {
+        snmp_free_pdu(response);
+        return 0;
+    }
+
+    snmp_free_pdu(response);
+    return 1;
+}
+
+int
+agentx_send_ping(netsnmp_session * ss)
+{
+    netsnmp_pdu    *pdu, *response;
+
+    if (ss == NULL || !IS_AGENTX_VERSION(ss->version)) {
+        return 0;
+    }
+
+    pdu = snmp_pdu_create(AGENTX_MSG_PING);
+    if (pdu == NULL)
+        return 0;
+    pdu->time = 0;
+    pdu->sessid = ss->sessid;
+
+    if (agentx_synch_response(ss, pdu, &response) != STAT_SUCCESS)
+        return 0;
+
+    if (response->errstat != SNMP_ERR_NOERROR) {
+        snmp_free_pdu(response);
+        return 0;
+    }
+
+    snmp_free_pdu(response);
+    return 1;
+}
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/agentx/client.h tomato121/release/src/router/snmp/agent/mibgroup/agentx/client.h
--- tomato/release/src/router/snmp/agent/mibgroup/agentx/client.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/agentx/client.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,40 @@
+#ifndef AGENTX_CLIENT_H
+#define AGENTX_CLIENT_H
+
+#ifdef __cplusplus
+extern          "C" {
+#endif
+    /*
+     *  Utility functions for Agent Extensibility Protocol (RFC 2257)
+     *
+     */
+
+
+    int             agentx_open_session(netsnmp_session *);
+    int             agentx_close_session(netsnmp_session *, int);
+    int             agentx_register(netsnmp_session *, oid *, size_t, int,
+                                    int, oid, int, u_char);
+    int             agentx_unregister(netsnmp_session *, oid *, size_t,
+                                      int, int, oid);
+    netsnmp_variable_list *agentx_register_index(netsnmp_session *,
+                                                 netsnmp_variable_list *,
+                                                 int);
+    int             agentx_unregister_index(netsnmp_session *,
+                                            netsnmp_variable_list *);
+    int             agentx_add_agentcaps(netsnmp_session *, oid *, size_t,
+                                         const char *);
+    int             agentx_remove_agentcaps(netsnmp_session *, oid *,
+                                            size_t);
+    int             agentx_send_ping(netsnmp_session *);
+
+#define AGENTX_CLOSE_OTHER    1
+#define AGENTX_CLOSE_PARSE    2
+#define AGENTX_CLOSE_PROTOCOL 3
+#define AGENTX_CLOSE_TIMEOUT  4
+#define AGENTX_CLOSE_SHUTDOWN 5
+#define AGENTX_CLOSE_MANAGER  6
+
+#ifdef __cplusplus
+}
+#endif
+#endif                          /* AGENTX_CLIENT_H */
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/agentx/.cvsignore tomato121/release/src/router/snmp/agent/mibgroup/agentx/.cvsignore
--- tomato/release/src/router/snmp/agent/mibgroup/agentx/.cvsignore	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/agentx/.cvsignore	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,3 @@
+.libs
+*.lo
+Makefile
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/agentx/master_admin.c tomato121/release/src/router/snmp/agent/mibgroup/agentx/master_admin.c
--- tomato/release/src/router/snmp/agent/mibgroup/agentx/master_admin.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/agentx/master_admin.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,580 @@
+/*
+ *  AgentX Administrative request handling
+ */
+#include <net-snmp/net-snmp-config.h>
+
+#include <sys/types.h>
+#ifdef HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#if TIME_WITH_SYS_TIME
+# ifdef WIN32
+#  include <sys/timeb.h>
+# else
+#  include <sys/time.h>
+# endif
+# include <time.h>
+#else
+# if HAVE_SYS_TIME_H
+#  include <sys/time.h>
+# else
+#  include <time.h>
+# endif
+#endif
+#if HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+#if HAVE_WINSOCK_H
+#include <winsock.h>
+#endif
+#if HAVE_SYS_SOCKET_H
+#include <sys/socket.h>
+#endif
+#if HAVE_DMALLOC_H
+#include <dmalloc.h>
+#endif
+
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+#include "agentx/protocol.h"
+#include "agentx/client.h"
+
+#include <net-snmp/agent/agent_index.h>
+#include <net-snmp/agent/agent_trap.h>
+#include "mibII/sysORTable.h"
+#include "master.h"
+
+extern struct timeval starttime;
+
+
+
+netsnmp_session *
+find_agentx_session(netsnmp_session * session, int sessid)
+{
+    netsnmp_session *sp;
+    for (sp = session->subsession; sp != NULL; sp = sp->next) {
+        if (sp->sessid == sessid)
+            return sp;
+    }
+    return NULL;
+}
+
+
+int
+open_agentx_session(netsnmp_session * session, netsnmp_pdu *pdu)
+{
+    netsnmp_session *sp;
+    struct timeval  now;
+
+    DEBUGMSGTL(("agentx/master", "open %08p\n", session));
+    sp = (netsnmp_session *) malloc(sizeof(netsnmp_session));
+    if (sp == NULL) {
+        session->s_snmp_errno = AGENTX_ERR_OPEN_FAILED;
+        return -1;
+    }
+
+    memcpy(sp, session, sizeof(netsnmp_session));
+    sp->sessid = snmp_get_next_sessid();
+    sp->version = pdu->version;
+    sp->timeout = pdu->time;
+
+    /*
+     * Be careful with fields: if these aren't zeroed, they will get free()d
+     * more than once when the session is closed -- once in the main session,
+     * and once in each subsession.  Basically, if it's not being used for
+     * some AgentX-specific purpose, it ought to be zeroed here. 
+     */
+
+    sp->community = NULL;
+    sp->peername = NULL;
+    sp->contextEngineID = NULL;
+    sp->contextName = NULL;
+    sp->securityEngineID = NULL;
+    sp->securityPrivProto = NULL;
+
+    /*
+     * This next bit utilises unused SNMPv3 fields
+     *   to store the subagent OID and description.
+     * This really ought to use AgentX-specific fields,
+     *   but it hardly seems worth it for a one-off use.
+     *
+     * But I'm willing to be persuaded otherwise....  */
+    sp->securityAuthProto = snmp_duplicate_objid(pdu->variables->name,
+                                                 pdu->variables->
+                                                 name_length);
+    sp->securityAuthProtoLen = pdu->variables->name_length;
+    sp->securityName = strdup((char *) pdu->variables->val.string);
+    gettimeofday(&now, NULL);
+    sp->engineTime = calculate_time_diff(&now, &starttime);
+
+    sp->subsession = session;   /* link back to head */
+    sp->flags |= SNMP_FLAGS_SUBSESSION;
+    sp->flags &= ~AGENTX_MSG_FLAG_NETWORK_BYTE_ORDER;
+    sp->flags |= (pdu->flags & AGENTX_MSG_FLAG_NETWORK_BYTE_ORDER);
+    sp->next = session->subsession;
+    session->subsession = sp;
+    DEBUGMSGTL(("agentx/master", "opened %08p = %d with flags = %02x\n",
+                sp, sp->sessid, sp->flags & AGENTX_MSG_FLAGS_MASK));
+
+    return sp->sessid;
+}
+
+int
+close_agentx_session(netsnmp_session * session, int sessid)
+{
+    netsnmp_session *sp, **prevNext;
+
+    DEBUGMSGTL(("agentx/master", "close %08p, %d\n", session, sessid));
+    if (session != NULL && sessid == -1) {
+        unregister_mibs_by_session(session);
+        unregister_index_by_session(session);
+        unregister_sysORTable_by_session(session);
+	if (session->myvoid != NULL) {
+	  free(session->myvoid);
+	}
+        /*
+         * The following is necessary to avoid locking up the agent when
+         * a sugagent dies during a set request. We must clean up the
+         * requests, so that the delegated request will be completed and
+         * further requests can be processed
+         */
+        netsnmp_remove_delegated_requests_for_session(session);
+        if (session->subsession != NULL) {
+            netsnmp_session *subsession = session->subsession;
+            for(; subsession; subsession = subsession->next) {
+                netsnmp_remove_delegated_requests_for_session(subsession);
+            }
+        }
+                
+        return AGENTX_ERR_NOERROR;
+    }
+
+    prevNext = &(session->subsession);
+
+    for (sp = session->subsession; sp != NULL; sp = sp->next) {
+
+        if (sp->sessid == sessid) {
+            unregister_mibs_by_session(sp);
+            unregister_index_by_session(sp);
+            unregister_sysORTable_by_session(sp);
+
+            *prevNext = sp->next;
+
+            if (sp->securityAuthProto != NULL) {
+                free(sp->securityAuthProto);
+            }
+            if (sp->securityName != NULL) {
+                free(sp->securityName);
+            }
+            free(sp);
+            sp = NULL;
+
+            DEBUGMSGTL(("agentx/master", "closed %08p, %d okay\n",
+                        session, sessid));
+            return AGENTX_ERR_NOERROR;
+        }
+
+        prevNext = &(sp->next);
+    }
+
+    DEBUGMSGTL(("agentx/master", "sessid %d not found\n", sessid));
+    return AGENTX_ERR_NOT_OPEN;
+}
+
+int
+register_agentx_list(netsnmp_session * session, netsnmp_pdu *pdu)
+{
+    netsnmp_session *sp;
+    char            buf[128];
+    oid             ubound = 0;
+    u_long          flags = 0;
+    netsnmp_handler_registration *reg;
+    int             rc = 0;
+    int             cacheid;
+
+    DEBUGMSGTL(("agentx/master", "in register_agentx_list\n"));
+
+    sp = find_agentx_session(session, pdu->sessid);
+    if (sp == NULL)
+        return AGENTX_ERR_NOT_OPEN;
+
+    sprintf(buf, "AgentX subagent %ld, session %8p, subsession %8p",
+            sp->sessid, session, sp);
+    /*
+     * * TODO: registration timeout
+     * *   registration context
+     */
+    if (pdu->range_subid) {
+        ubound = pdu->variables->val.objid[pdu->range_subid - 1];
+    }
+
+    if (pdu->flags & AGENTX_MSG_FLAG_INSTANCE_REGISTER) {
+        flags = FULLY_QUALIFIED_INSTANCE;
+    }
+
+    reg = netsnmp_create_handler_registration(buf, agentx_master_handler, pdu->variables->name, pdu->variables->name_length, HANDLER_CAN_RWRITE | HANDLER_CAN_GETBULK); /* fake it */
+    if (!session->myvoid) {
+        session->myvoid = malloc(sizeof(cacheid));
+        cacheid = netsnmp_allocate_globalcacheid();
+        *((int *) session->myvoid) = cacheid;
+    } else {
+        cacheid = *((int *) session->myvoid);
+    }
+
+    reg->handler->myvoid = session;
+    reg->global_cacheid = cacheid;
+    /*
+     * register mib. Note that for failure cases, the registration info
+     * (reg) will be freed, and thus is no longer a valid pointer.
+     */
+    switch (netsnmp_register_mib(buf, NULL, 0, 1,
+                                 pdu->variables->name,
+                                 pdu->variables->name_length,
+                                 pdu->priority, pdu->range_subid, ubound,
+                                 sp, (char *) pdu->community, pdu->time,
+                                 flags, reg, 1)) {
+
+    case MIB_REGISTERED_OK:
+        DEBUGMSGTL(("agentx/master", "registered ok\n"));
+        return AGENTX_ERR_NOERROR;
+
+    case MIB_DUPLICATE_REGISTRATION:
+        DEBUGMSGTL(("agentx/master", "duplicate registration\n"));
+        rc = AGENTX_ERR_DUPLICATE_REGISTRATION;
+        break;
+
+    case MIB_REGISTRATION_FAILED:
+    default:
+        rc = AGENTX_ERR_REQUEST_DENIED;
+        DEBUGMSGTL(("agentx/master", "failed registration\n"));
+    }
+    return rc;
+}
+
+int
+unregister_agentx_list(netsnmp_session * session, netsnmp_pdu *pdu)
+{
+    netsnmp_session *sp;
+    int             rc = 0;
+
+    sp = find_agentx_session(session, pdu->sessid);
+    if (sp == NULL) {
+        return AGENTX_ERR_NOT_OPEN;
+    }
+
+    if (pdu->range_subid != 0) {
+        oid             ubound =
+            pdu->variables->val.objid[pdu->range_subid - 1];
+        rc = netsnmp_unregister_mib_table_row(pdu->variables->name,
+                                              pdu->variables->name_length,
+                                              pdu->priority,
+                                              pdu->range_subid, ubound,
+                                              (char *) pdu->community);
+    } else {
+        rc = unregister_mib_context(pdu->variables->name,
+                                    pdu->variables->name_length,
+                                    pdu->priority, 0, 0,
+                                    (char *) pdu->community);
+    }
+
+    switch (rc) {
+    case MIB_UNREGISTERED_OK:
+        return AGENTX_ERR_NOERROR;
+    case MIB_NO_SUCH_REGISTRATION:
+        return AGENTX_ERR_UNKNOWN_REGISTRATION;
+    case MIB_UNREGISTRATION_FAILED:
+    default:
+        return AGENTX_ERR_REQUEST_DENIED;
+    }
+}
+
+int
+allocate_idx_list(netsnmp_session * session, netsnmp_pdu *pdu)
+{
+    netsnmp_session *sp;
+    netsnmp_variable_list *vp, *vp2, *next, *res;
+    int             flags = 0;
+
+    sp = find_agentx_session(session, pdu->sessid);
+    if (sp == NULL)
+        return AGENTX_ERR_NOT_OPEN;
+
+    if (pdu->flags & AGENTX_MSG_FLAG_ANY_INSTANCE)
+        flags |= ALLOCATE_ANY_INDEX;
+    if (pdu->flags & AGENTX_MSG_FLAG_NEW_INSTANCE)
+        flags |= ALLOCATE_NEW_INDEX;
+
+    /*
+     * XXX - what about errors?
+     *
+     *  If any allocations fail, then we need to
+     *    *fully* release the earlier ones.
+     *  (i.e. remove them completely from the index registry,
+     *    not simply mark them as available for re-use)
+     *
+     * For now - assume they all succeed.
+     */
+    for (vp = pdu->variables; vp != NULL; vp = next) {
+        next = vp->next_variable;
+        res = register_index(vp, flags, session);
+        if (res == NULL) {
+            /*
+             *  If any allocations fail, we need to *fully* release
+             *      all previous ones (i.e. remove them completely
+             *      from the index registry)
+             */
+            for (vp2 = pdu->variables; vp2 != vp; vp2 = vp2->next_variable) {
+                remove_index(vp2, session);
+            }
+            return AGENTX_ERR_INDEX_NONE_AVAILABLE;     /* XXX */
+        } else {
+            (void) snmp_clone_var(res, vp);
+            free(res);
+        }
+        vp->next_variable = next;
+    }
+    return AGENTX_ERR_NOERROR;
+}
+
+int
+release_idx_list(netsnmp_session * session, netsnmp_pdu *pdu)
+{
+    netsnmp_session *sp;
+    netsnmp_variable_list *vp, *vp2, *rv = NULL;
+    int             res;
+
+    sp = find_agentx_session(session, pdu->sessid);
+    if (sp == NULL)
+        return AGENTX_ERR_NOT_OPEN;
+
+    for (vp = pdu->variables; vp != NULL; vp = vp->next_variable) {
+        res = unregister_index(vp, TRUE, session);
+        /*
+         *  If any releases fail,
+         *      we need to reinstate all previous ones.
+         */
+        if (res != SNMP_ERR_NOERROR) {
+            for (vp2 = pdu->variables; vp2 != vp; vp2 = vp2->next_variable) {
+                rv = register_index(vp2, ALLOCATE_THIS_INDEX, session);
+                free(rv);
+            }
+            return AGENTX_ERR_INDEX_NOT_ALLOCATED;      /* Probably */
+        }
+    }
+    return AGENTX_ERR_NOERROR;
+}
+
+int
+add_agent_caps_list(netsnmp_session * session, netsnmp_pdu *pdu)
+{
+    netsnmp_session *sp;
+
+    sp = find_agentx_session(session, pdu->sessid);
+    if (sp == NULL)
+        return AGENTX_ERR_NOT_OPEN;
+
+    register_sysORTable_sess(pdu->variables->name,
+                             pdu->variables->name_length,
+                             (char *) pdu->variables->val.string, sp);
+    return AGENTX_ERR_NOERROR;
+}
+
+int
+remove_agent_caps_list(netsnmp_session * session, netsnmp_pdu *pdu)
+{
+    netsnmp_session *sp;
+
+    sp = find_agentx_session(session, pdu->sessid);
+    if (sp == NULL)
+        return AGENTX_ERR_NOT_OPEN;
+
+    if (unregister_sysORTable_sess(pdu->variables->name,
+                                   pdu->variables->name_length, sp) < 0)
+        return AGENTX_ERR_UNKNOWN_AGENTCAPS;
+    else
+        return AGENTX_ERR_NOERROR;
+}
+
+int
+agentx_notify(netsnmp_session * session, netsnmp_pdu *pdu)
+{
+    netsnmp_session *sp;
+    netsnmp_variable_list *var;
+    int             got_sysuptime = 0;
+    extern oid      sysuptime_oid[], snmptrap_oid[];
+    extern size_t   sysuptime_oid_len, snmptrap_oid_len;
+
+    sp = find_agentx_session(session, pdu->sessid);
+    if (sp == NULL)
+        return AGENTX_ERR_NOT_OPEN;
+
+    var = pdu->variables;
+    if (!var)
+        return AGENTX_ERR_PROCESSING_ERROR;
+
+    if (snmp_oid_compare(var->name, var->name_length,
+                         sysuptime_oid, sysuptime_oid_len) == 0) {
+        got_sysuptime = 1;
+        var = var->next_variable;
+    }
+
+    if (!var || snmp_oid_compare(var->name, var->name_length,
+                                 snmptrap_oid, snmptrap_oid_len) != 0)
+        return AGENTX_ERR_PROCESSING_ERROR;
+
+    /*
+     *  If sysUptime isn't the first varbind, don't worry.  
+     *     send_trap_vars() will add it if necessary.
+     *
+     *  Note that if this behaviour is altered, it will
+     *     be necessary to add sysUptime here,
+     *     as this is valid AgentX syntax.
+     */
+
+    send_trap_vars(-1, -1, pdu->variables);
+    return AGENTX_ERR_NOERROR;
+}
+
+
+int
+agentx_ping_response(netsnmp_session * session, netsnmp_pdu *pdu)
+{
+    netsnmp_session *sp;
+
+    sp = find_agentx_session(session, pdu->sessid);
+    if (sp == NULL)
+        return AGENTX_ERR_NOT_OPEN;
+    else
+        return AGENTX_ERR_NOERROR;
+}
+
+int
+handle_master_agentx_packet(int operation,
+                            netsnmp_session * session,
+                            int reqid, netsnmp_pdu *pdu, void *magic)
+{
+    netsnmp_agent_session *asp;
+    struct timeval  now;
+
+    if (operation == NETSNMP_CALLBACK_OP_DISCONNECT) {
+        DEBUGMSGTL(("agentx/master",
+                    "transport disconnect on session %08p\n", session));
+        /*
+         * Shut this session down gracefully.  
+         */
+        close_agentx_session(session, -1);
+        return 1;
+    } else if (operation != NETSNMP_CALLBACK_OP_RECEIVED_MESSAGE) {
+        DEBUGMSGTL(("agentx/master", "unexpected callback op %d\n",
+                    operation));
+        return 1;
+    }
+
+    /*
+     * Okay, it's a NETSNMP_CALLBACK_OP_RECEIVED_MESSAGE op.  
+     */
+
+    if (magic) {
+        asp = (netsnmp_agent_session *) magic;
+    } else {
+        asp = init_agent_snmp_session(session, pdu);
+    }
+
+    DEBUGMSGTL(("agentx/master", "handle pdu (req=0x%x,trans=0x%x,sess=0x%x)\n",
+                pdu->reqid,pdu->transid, pdu->sessid));
+    
+    switch (pdu->command) {
+    case AGENTX_MSG_OPEN:
+        asp->pdu->sessid = open_agentx_session(session, pdu);
+        if (asp->pdu->sessid == -1)
+            asp->status = session->s_snmp_errno;
+        break;
+
+    case AGENTX_MSG_CLOSE:
+        asp->status = close_agentx_session(session, pdu->sessid);
+        break;
+
+    case AGENTX_MSG_REGISTER:
+        asp->status = register_agentx_list(session, pdu);
+        break;
+
+    case AGENTX_MSG_UNREGISTER:
+        asp->status = unregister_agentx_list(session, pdu);
+        break;
+
+    case AGENTX_MSG_INDEX_ALLOCATE:
+        asp->status = allocate_idx_list(session, asp->pdu);
+        if (asp->status != AGENTX_ERR_NOERROR) {
+            snmp_free_pdu(asp->pdu);
+            asp->pdu = snmp_clone_pdu(pdu);
+        }
+        break;
+
+    case AGENTX_MSG_INDEX_DEALLOCATE:
+        asp->status = release_idx_list(session, pdu);
+        break;
+
+    case AGENTX_MSG_ADD_AGENT_CAPS:
+        asp->status = add_agent_caps_list(session, pdu);
+        break;
+
+    case AGENTX_MSG_REMOVE_AGENT_CAPS:
+        asp->status = remove_agent_caps_list(session, pdu);
+        break;
+
+    case AGENTX_MSG_NOTIFY:
+        asp->status = agentx_notify(session, pdu);
+        break;
+
+    case AGENTX_MSG_PING:
+        asp->status = agentx_ping_response(session, pdu);
+        break;
+
+        /*
+         * TODO: Other admin packets 
+         */
+
+    case AGENTX_MSG_GET:
+    case AGENTX_MSG_GETNEXT:
+    case AGENTX_MSG_GETBULK:
+    case AGENTX_MSG_TESTSET:
+    case AGENTX_MSG_COMMITSET:
+    case AGENTX_MSG_UNDOSET:
+    case AGENTX_MSG_CLEANUPSET:
+    case AGENTX_MSG_RESPONSE:
+        /*
+         * Shouldn't be handled here 
+         */
+        break;
+
+    default:
+        asp->status = AGENTX_ERR_PARSE_FAILED;
+        break;
+    }
+
+    gettimeofday(&now, NULL);
+    asp->pdu->time = calculate_time_diff(&now, &starttime);
+    asp->pdu->command = AGENTX_MSG_RESPONSE;
+    asp->pdu->errstat = asp->status;
+    DEBUGMSGTL(("agentx/master", "send response, stat %d (req=0x%x,trans="
+                "0x%x,sess=0x%x)\n",
+                asp->status, pdu->reqid,pdu->transid, pdu->sessid));
+    if (!snmp_send(asp->session, asp->pdu)) {
+        char           *eb = NULL;
+        int             pe, pse;
+        snmp_error(asp->session, &pe, &pse, &eb);
+        snmp_free_pdu(asp->pdu);
+        DEBUGMSGTL(("agentx/master", "FAILED %d %d %s\n", pe, pse, eb));
+        free(eb);
+    }
+    asp->pdu = NULL;
+    free_agent_snmp_session(asp);
+
+    return 1;
+}
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/agentx/master_admin.h tomato121/release/src/router/snmp/agent/mibgroup/agentx/master_admin.h
--- tomato/release/src/router/snmp/agent/mibgroup/agentx/master_admin.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/agentx/master_admin.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,10 @@
+#ifndef _AGENTX_MASTER_ADMIN_H
+#define _AGENTX_MASTER_ADMIN_H
+
+int             handle_master_agentx_packet(int, netsnmp_session *,
+                                            int, netsnmp_pdu *, void *);
+
+int             close_agentx_session(netsnmp_session * session,
+                                     int sessid);
+
+#endif                          /* _AGENTX_MASTER_ADMIN_H */
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/agentx/master.c tomato121/release/src/router/snmp/agent/mibgroup/agentx/master.c
--- tomato/release/src/router/snmp/agent/mibgroup/agentx/master.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/agentx/master.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,520 @@
+/*
+ *  AgentX master agent
+ */
+
+#include <net-snmp/net-snmp-config.h>
+
+#include <stdio.h>
+#include <sys/types.h>
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#if HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+#if HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+#if HAVE_WINSOCK_H
+#include <winsock.h>
+#endif
+#if HAVE_SYS_SOCKET_H
+#include <sys/socket.h>
+#endif
+#include <errno.h>
+
+#if HAVE_DMALLOC_H
+#include <dmalloc.h>
+#endif
+
+#define SNMP_NEED_REQUEST_LIST
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include "snmpd.h"
+#include "agentx/protocol.h"
+#include "agentx/master_admin.h"
+
+void
+real_init_master(void)
+{
+    netsnmp_session sess, *session;
+    char *agentx_sockets;
+    char *cp1, *cp2;
+
+    if (netsnmp_ds_get_boolean(NETSNMP_DS_APPLICATION_ID, NETSNMP_DS_AGENT_ROLE) != MASTER_AGENT)
+        return;
+
+    DEBUGMSGTL(("agentx/master", "initializing...\n"));
+    snmp_sess_init(&sess);
+    sess.version = AGENTX_VERSION_1;
+    sess.flags |= SNMP_FLAGS_STREAM_SOCKET;
+    sess.timeout = netsnmp_ds_get_int(NETSNMP_DS_APPLICATION_ID,
+                                      NETSNMP_DS_AGENT_AGENTX_TIMEOUT);
+    sess.retries = netsnmp_ds_get_int(NETSNMP_DS_APPLICATION_ID,
+                                      NETSNMP_DS_AGENT_AGENTX_RETRIES);
+
+    if (netsnmp_ds_get_string(NETSNMP_DS_APPLICATION_ID, 
+			      NETSNMP_DS_AGENT_X_SOCKET)) {
+	agentx_sockets = netsnmp_ds_get_string(NETSNMP_DS_APPLICATION_ID, 
+					       NETSNMP_DS_AGENT_X_SOCKET);
+    } else {
+        agentx_sockets = strdup(AGENTX_SOCKET);
+    }
+
+    cp1 = agentx_sockets;
+    while (1) {
+        /*
+         *  If the AgentX socket string contains multiple descriptors,
+         *  then pick this apart and handle them one by one.
+         *
+         */
+        cp2 = strchr(cp1, ',');
+        if (cp2 != NULL) {
+            *cp2 = '\0';
+	}
+        sess.peername = cp1;
+        if (cp2 != NULL) {
+            cp1 = cp2+1;
+	}
+    
+        if (sess.peername[0] == '/') {
+            /*
+             *  If this is a Unix pathname,
+             *  try and create the directory first.
+             */
+            if (mkdirhier(sess.peername, AGENT_DIRECTORY_MODE, 1)) {
+                snmp_log(LOG_ERR,
+                         "Failed to create the directory for the agentX socket: %s\n",
+                         sess.peername);
+            }
+        }
+    
+        /*
+         *  Otherwise, let 'snmp_open' interpret the string.
+         */
+        sess.local_port = AGENTX_PORT;      /* Indicate server & set default port */
+        sess.remote_port = 0;
+        sess.callback = handle_master_agentx_packet;
+        session = snmp_open_ex(&sess, NULL, agentx_parse, NULL, NULL,
+                               agentx_realloc_build, agentx_check_packet);
+    
+        if (session == NULL && sess.s_errno == EADDRINUSE) {
+            /*
+             * Could be a left-over socket (now deleted)
+             * Try again
+             */
+            session = snmp_open_ex(&sess, NULL, agentx_parse, NULL, NULL,
+                                   agentx_realloc_build, agentx_check_packet);
+        }
+    
+        if (session == NULL) {
+            /*
+             * diagnose snmp_open errors with the input netsnmp_session pointer 
+             */
+            if (!netsnmp_ds_get_boolean(NETSNMP_DS_APPLICATION_ID, NETSNMP_DS_AGENT_NO_ROOT_ACCESS)) {
+                snmp_sess_perror
+                    ("Error: Couldn't open a master agentx socket to listen on",
+                     &sess);
+                exit(1);
+            } else {
+                netsnmp_sess_log_error(LOG_WARNING,
+                                       "Warning: Couldn't open a agentx master socket to listen on",
+                                       &sess);
+            }
+        }
+        /*
+         * If we've processed the last (or only) socket, then we're done.
+         */
+        if (!cp2)
+            break;
+    }
+
+    SNMP_FREE(agentx_sockets);
+    DEBUGMSGTL(("agentx/master", "initializing...   DONE\n"));
+}
+
+        /*
+         * Handle the response from an AgentX subagent,
+         *   merging the answers back into the original query
+         */
+int
+agentx_got_response(int operation,
+                    netsnmp_session * session,
+                    int reqid, netsnmp_pdu *pdu, void *magic)
+{
+    netsnmp_delegated_cache *cache = (netsnmp_delegated_cache *) magic;
+    int             i, ret;
+    netsnmp_request_info *requests, *request;
+    netsnmp_variable_list *var;
+    netsnmp_session *ax_session;
+
+    cache = netsnmp_handler_check_cache(cache);
+    if (!cache) {
+        DEBUGMSGTL(("agentx/master", "response too late on session %08p\n",
+                    session));
+        return 0;
+    }
+    requests = cache->requests;
+
+    switch (operation) {
+    case NETSNMP_CALLBACK_OP_TIMED_OUT:{
+            void           *s = snmp_sess_pointer(session);
+            DEBUGMSGTL(("agentx/master", "timeout on session %08p\n",
+                        session));
+
+            /*
+             * This is a bit sledgehammer because the other sessions on this
+             * transport may be okay (e.g. some thread in the subagent has
+             * wedged, but the others are alright).  OTOH the overwhelming
+             * probability is that the whole agent has died somehow.  
+             */
+
+            if (s != NULL) {
+                netsnmp_transport *t = snmp_sess_transport(s);
+                close_agentx_session(session, -1);
+
+                if (t != NULL) {
+                    DEBUGMSGTL(("agentx/master", "close transport\n"));
+                    t->f_close(t);
+                } else {
+                    DEBUGMSGTL(("agentx/master", "NULL transport??\n"));
+                }
+            } else {
+                DEBUGMSGTL(("agentx/master", "NULL sess_pointer??\n"));
+            }
+            netsnmp_handler_mark_requests_as_delegated(requests,
+                                                       REQUEST_IS_NOT_DELEGATED);
+            netsnmp_set_request_error(cache->reqinfo, requests, /* XXXWWW: should be index=0 */
+                                      SNMP_ERR_GENERR);
+            ax_session = (netsnmp_session *) cache->localinfo;
+            netsnmp_free_agent_snmp_session_by_session(ax_session, NULL);
+            netsnmp_free_delegated_cache(cache);
+            return 0;
+        }
+
+    case NETSNMP_CALLBACK_OP_DISCONNECT:
+    case NETSNMP_CALLBACK_OP_SEND_FAILED:
+        if (operation == NETSNMP_CALLBACK_OP_DISCONNECT) {
+            DEBUGMSGTL(("agentx/master", "disconnect on session %08p\n",
+                        session));
+        } else {
+            DEBUGMSGTL(("agentx/master", "send failed on session %08p\n",
+                        session));
+        }
+        close_agentx_session(session, -1);
+        netsnmp_handler_mark_requests_as_delegated(requests,
+                                                   REQUEST_IS_NOT_DELEGATED);
+        netsnmp_set_request_error(cache->reqinfo, requests,     /* XXXWWW: should be index=0 */
+                                  SNMP_ERR_GENERR);
+        netsnmp_free_delegated_cache(cache);
+        return 0;
+
+    case NETSNMP_CALLBACK_OP_RECEIVED_MESSAGE:
+        /*
+         * This session is alive 
+         */
+        CLEAR_SNMP_STRIKE_FLAGS(session->flags);
+        break;
+    default:
+        snmp_log(LOG_ERR, "Unknown operation %d in agentx_got_response\n",
+                 operation);
+        netsnmp_free_delegated_cache(cache);
+        return 0;
+    }
+
+    DEBUGMSGTL(("agentx/master", "got response errstat=%d, (req=0x%x,trans="
+                "0x%x,sess=0x%x)\n",
+                pdu->errstat,pdu->reqid,pdu->transid, pdu->sessid));
+
+    if (pdu->errstat != AGENTX_ERR_NOERROR) {
+        /*
+         *  If the request failed, locate the
+         *    original index of the variable resonsible
+         */
+        DEBUGMSGTL(("agentx/master",
+                    "agentx_got_response() error branch\n"));
+        if (cache->reqinfo->mode == MODE_GETNEXT) {
+            /*
+             * grr...  got back an actual error for a getnext.
+             * Replace error with NULL and change the rest to retry 
+             */
+            for (request = requests, i = 1; request;
+                 request = request->next, i++) {
+                if (request->index != pdu->errindex
+                    && request->requestvb->type == ASN_NULL) {
+                    request->requestvb->type = ASN_PRIV_RETRY;
+                }
+                request->delegated = REQUEST_IS_NOT_DELEGATED;
+            }
+            netsnmp_free_delegated_cache(cache);
+            DEBUGMSGTL(("agentx/master", "end error branch\n"));
+            return 1;
+        } else {
+            DEBUGMSGTL(("agentx/master", "errindex=%d\n", pdu->errindex));
+            ret = 0;
+            for (request = requests, i = 1; request;
+                 request = request->next, i++) {
+                if (request->index == pdu->errindex) {
+                    /*
+                     * mark this one as the one generating the error 
+                     */
+                    netsnmp_set_request_error(cache->reqinfo, request,
+                                              pdu->errstat);
+                    ret = 1;
+                }
+                request->delegated = REQUEST_IS_NOT_DELEGATED;
+            }
+            if (!ret) {
+                /*
+                 * ack, unknown, mark the first one 
+                 */
+                netsnmp_set_request_error(cache->reqinfo, request,
+                                          SNMP_ERR_GENERR);
+            }
+            netsnmp_free_delegated_cache(cache);
+            DEBUGMSGTL(("agentx/master", "end error branch\n"));
+            return 1;
+        }
+    } else if (cache->reqinfo->mode == MODE_GET ||
+               cache->reqinfo->mode == MODE_GETNEXT ||
+               cache->reqinfo->mode == MODE_GETBULK) {
+        /*
+         * Replace varbinds for data request types, but not SETs.  
+         */
+        DEBUGMSGTL(("agentx/master",
+                    "agentx_got_response() beginning...\n"));
+        for (var = pdu->variables, request = requests; request && var;
+             request = request->next, var = var->next_variable) {
+            /*
+             * Otherwise, process successful requests
+             */
+            DEBUGMSGTL(("agentx/master",
+                        "  handle_agentx_response: processing: "));
+            DEBUGMSGOID(("agentx/master", var->name, var->name_length));
+            DEBUGMSG(("agentx/master", "\n"));
+            if (netsnmp_ds_get_boolean(NETSNMP_DS_APPLICATION_ID, NETSNMP_DS_AGENT_VERBOSE)) {
+                DEBUGMSGTL(("snmp_agent", "    >> "));
+                DEBUGMSGVAR(("snmp_agent", var));
+                DEBUGMSG(("snmp_agent", "\n"));
+            }
+
+            /*
+             * update the oid in the original request 
+             */
+            if (var->type != SNMP_ENDOFMIBVIEW) {
+                snmp_set_var_typed_value(request->requestvb, var->type,
+                                         var->val.string, var->val_len);
+                snmp_set_var_objid(request->requestvb, var->name,
+                                   var->name_length);
+            }
+            request->delegated = REQUEST_IS_NOT_DELEGATED;
+        }
+
+        if (request || var) {
+            /*
+             * ack, this is bad.  The # of varbinds don't match and
+             * there is no way to fix the problem 
+             */
+            snmp_log(LOG_ERR,
+                     "response to agentx request illegal.  We're screwed.\n");
+            netsnmp_set_request_error(cache->reqinfo, requests,
+                                      SNMP_ERR_GENERR);
+        }
+
+        if (cache->reqinfo->mode == MODE_GETBULK)
+            netsnmp_bulk_to_next_fix_requests(requests);
+    } else {
+        /*
+         * mark set requests as handled 
+         */
+        for (request = requests; request; request = request->next) {
+            request->delegated = REQUEST_IS_NOT_DELEGATED;
+        }
+    }
+    DEBUGMSGTL(("agentx/master",
+                "handle_agentx_response() finishing...\n"));
+    netsnmp_free_delegated_cache(cache);
+    return 1;
+}
+
+/*
+ *
+ * AgentX State diagram.  [mode] = internal mode it's mapped from:
+ *
+ * TESTSET -success-> COMMIT -success-> CLEANUP
+ * [RESERVE1]         [ACTION]          [COMMIT]
+ *    |                 |
+ *    |                 \--failure-> UNDO
+ *    |                              [UNDO]
+ *    |
+ *     --failure-> CLEANUP
+ *                 [FREE]
+ */
+int
+agentx_master_handler(netsnmp_mib_handler *handler,
+                      netsnmp_handler_registration *reginfo,
+                      netsnmp_agent_request_info *reqinfo,
+                      netsnmp_request_info *requests)
+{
+    netsnmp_session *ax_session = (netsnmp_session *) handler->myvoid;
+    netsnmp_request_info *request = requests;
+    netsnmp_pdu    *pdu;
+    void           *cb_data;
+
+    DEBUGMSGTL(("agentx/master",
+                "agentx master handler starting, mode = 0x%02x\n",
+                reqinfo->mode));
+
+    /*
+     * build a new pdu based on the pdu type coming in 
+     */
+    switch (reqinfo->mode) {
+    case MODE_GET:
+        pdu = snmp_pdu_create(AGENTX_MSG_GET);
+        break;
+
+    case MODE_GETNEXT:
+        pdu = snmp_pdu_create(AGENTX_MSG_GETNEXT);
+        break;
+
+    case MODE_GETBULK:         /* WWWXXX */
+        pdu = snmp_pdu_create(AGENTX_MSG_GETNEXT);
+        break;
+
+    case MODE_SET_RESERVE1:
+        pdu = snmp_pdu_create(AGENTX_MSG_TESTSET);
+        break;
+
+    case MODE_SET_RESERVE2:
+        /*
+         * don't do anything here for AgentX.  Assume all is fine
+         * and go on since AgentX only has one test phase. 
+         */
+        return SNMP_ERR_NOERROR;
+
+    case MODE_SET_ACTION:
+        pdu = snmp_pdu_create(AGENTX_MSG_COMMITSET);
+        break;
+
+    case MODE_SET_UNDO:
+        pdu = snmp_pdu_create(AGENTX_MSG_UNDOSET);
+        break;
+
+    case MODE_SET_COMMIT:
+    case MODE_SET_FREE:
+        pdu = snmp_pdu_create(AGENTX_MSG_CLEANUPSET);
+        break;
+
+    default:
+        snmp_log(LOG_WARNING,
+                 "unsupported mode for agentx/master called\n");
+        return SNMP_ERR_NOERROR;
+    }
+
+    if (!pdu || !ax_session) {
+        netsnmp_set_request_error(reqinfo, requests, SNMP_ERR_GENERR);
+        return SNMP_ERR_NOERROR;
+    }
+
+    pdu->version = AGENTX_VERSION_1;
+    pdu->reqid = snmp_get_next_transid();
+    pdu->transid = reqinfo->asp->pdu->transid;
+    pdu->sessid = ax_session->subsession->sessid;
+    if (ax_session->subsession->flags & AGENTX_MSG_FLAG_NETWORK_BYTE_ORDER)
+        pdu->flags |= AGENTX_MSG_FLAG_NETWORK_BYTE_ORDER;
+
+    while (request) {
+
+        size_t nlen = request->requestvb->name_length;
+        oid   *nptr = request->requestvb->name;
+        
+        DEBUGMSGTL(("agentx/master","request for variable ("));
+        DEBUGMSGOID(("agent/master", nptr, nlen));
+        DEBUGMSG(("agentx/master", ")\n"));
+        
+        /*
+         * loop through all the requests and create agentx ones out of them 
+         */
+
+        if (reqinfo->mode == MODE_GETNEXT || reqinfo->mode == MODE_GETBULK) {
+
+            if (snmp_oid_compare(nptr, nlen, request->subtree->start_a,
+                                 request->subtree->start_len) < 0) {
+                DEBUGMSGTL(("agentx/master","inexact request preceeding region ("));
+                DEBUGMSGOID(("agent/master", request->subtree->start_a,
+                             request->subtree->start_len));
+                DEBUGMSG(("agentx/master", ")\n"));
+                nptr = request->subtree->start_a;
+                nlen = request->subtree->start_len;
+                request->inclusive = 1;
+            }
+
+            if (request->inclusive) {
+                DEBUGMSGTL(("agentx/master", "INCLUSIVE varbind "));
+                DEBUGMSGOID(("agentx/master", nptr, nlen));
+                DEBUGMSG(("agentx/master", " scoped to "));
+                DEBUGMSGOID(("agentx/master", request->range_end,
+                             request->range_end_len));
+                DEBUGMSG(("agentx/master", "\n"));
+                snmp_pdu_add_variable(pdu, nptr, nlen, ASN_PRIV_INCL_RANGE,
+                                      (u_char *) request->range_end,
+                                      request->range_end_len *
+                                      sizeof(oid));
+                request->inclusive = 0;
+            } else {
+                DEBUGMSGTL(("agentx/master", "EXCLUSIVE varbind "));
+                DEBUGMSGOID(("agentx/master", nptr, nlen));
+                DEBUGMSG(("agentx/master", " scoped to "));
+                DEBUGMSGOID(("agentx/master", request->range_end,
+                             request->range_end_len));
+                DEBUGMSG(("agentx/master", "\n"));
+                snmp_pdu_add_variable(pdu, nptr, nlen, ASN_PRIV_EXCL_RANGE,
+                                      (u_char *) request->range_end,
+                                      request->range_end_len *
+                                      sizeof(oid));
+            }
+        } else {
+            snmp_pdu_add_variable(pdu, request->requestvb->name,
+                                  request->requestvb->name_length,
+                                  request->requestvb->type,
+                                  request->requestvb->val.string,
+                                  request->requestvb->val_len);
+        }
+
+        /*
+         * mark the request as delayed 
+         */
+        if (pdu->command != AGENTX_MSG_CLEANUPSET)
+            request->delegated = REQUEST_IS_DELEGATED;
+        else
+            request->delegated = REQUEST_IS_NOT_DELEGATED;
+
+        /*
+         * next... 
+         */
+        request = request->next;
+    }
+
+    /*
+     * When the master sends a CleanupSet PDU, it will never get a response
+     * back from the subagent. So we shouldn't allocate the
+     * netsnmp_delegated_cache structure in this case.
+     */
+    if (pdu->command != AGENTX_MSG_CLEANUPSET)
+        cb_data = netsnmp_create_delegated_cache(handler, reginfo,
+                                                 reqinfo, requests,
+                                                 (void *) ax_session);
+    else
+        cb_data = NULL;
+
+    /*
+     * send the requests out 
+     */
+    DEBUGMSGTL(("agentx", "sending pdu (req=0x%x,trans=0x%x,sess=0x%x)\n",
+                pdu->reqid,pdu->transid, pdu->sessid));
+    snmp_async_send(ax_session, pdu, agentx_got_response, cb_data);
+
+    return SNMP_ERR_NOERROR;
+}
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/agentx/master.h tomato121/release/src/router/snmp/agent/mibgroup/agentx/master.h
--- tomato/release/src/router/snmp/agent/mibgroup/agentx/master.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/agentx/master.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,14 @@
+#ifndef _AGENTX_MASTER_H
+#define _AGENTX_MASTER_H
+
+config_require(agentx/protocol)
+config_require(agentx/client)
+config_require(agentx/master_admin)
+config_require(agentx/agentx_config)
+config_require(mibII/sysORTable)
+
+     void            init_master(void);
+     void            real_init_master(void);
+     Netsnmp_Node_Handler agentx_master_handler;
+
+#endif                          /* _AGENTX_MASTER_H */
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/agentx/protocol.c tomato121/release/src/router/snmp/agent/mibgroup/agentx/protocol.c
--- tomato/release/src/router/snmp/agent/mibgroup/agentx/protocol.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/agentx/protocol.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,2054 @@
+/* Portions of this file are subject to the following copyright(s).  See
+ * the Net-SNMP's COPYING file for more details and other copyrights
+ * that may apply:
+ */
+/*
+ * Portions of this file are copyrighted by:
+ * Copyright © 2003 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms specified in the COPYING file
+ * distributed with the Net-SNMP package.
+ */
+
+#include <net-snmp/net-snmp-config.h>
+
+#include <stdio.h>
+#include <errno.h>
+#if HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#if HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+#if HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#include <sys/types.h>
+#if TIME_WITH_SYS_TIME
+# ifdef WIN32
+#  include <sys/timeb.h>
+# else
+#  include <sys/time.h>
+# endif
+# include <time.h>
+#else
+# if HAVE_SYS_TIME_H
+#  include <sys/time.h>
+# else
+#  include <time.h>
+# endif
+#endif
+#if HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+#if HAVE_ARPA_INET_H
+#include <arpa/inet.h>
+#endif
+
+#if HAVE_DMALLOC_H
+#include <dmalloc.h>
+#endif
+
+#if HAVE_WINSOCK_H
+#include <winsock.h>
+#endif
+
+#include <net-snmp/net-snmp-includes.h>
+
+#include "agentx/protocol.h"
+
+const char     *
+agentx_cmd(u_char code)
+{
+    switch (code) {
+    case AGENTX_MSG_OPEN:
+        return "Open";
+    case AGENTX_MSG_CLOSE:
+        return "Close";
+    case AGENTX_MSG_REGISTER:
+        return "Register";
+    case AGENTX_MSG_UNREGISTER:
+        return "Unregister";
+    case AGENTX_MSG_GET:
+        return "Get";
+    case AGENTX_MSG_GETNEXT:
+        return "Get Next";
+    case AGENTX_MSG_GETBULK:
+        return "Get Bulk";
+    case AGENTX_MSG_TESTSET:
+        return "Test Set";
+    case AGENTX_MSG_COMMITSET:
+        return "Commit Set";
+    case AGENTX_MSG_UNDOSET:
+        return "Undo Set";
+    case AGENTX_MSG_CLEANUPSET:
+        return "Cleanup Set";
+    case AGENTX_MSG_NOTIFY:
+        return "Notify";
+    case AGENTX_MSG_PING:
+        return "Ping";
+    case AGENTX_MSG_INDEX_ALLOCATE:
+        return "Index Allocate";
+    case AGENTX_MSG_INDEX_DEALLOCATE:
+        return "Index Deallocate";
+    case AGENTX_MSG_ADD_AGENT_CAPS:
+        return "Add Agent Caps";
+    case AGENTX_MSG_REMOVE_AGENT_CAPS:
+        return "Remove Agent Caps";
+    case AGENTX_MSG_RESPONSE:
+        return "Response";
+    default:
+        return "Unknown";
+    }
+}
+
+int
+agentx_realloc_build_int(u_char ** buf, size_t * buf_len, size_t * out_len,
+                         int allow_realloc,
+                         unsigned int value, int network_order)
+{
+    unsigned int    ivalue = value;
+    size_t          ilen = *out_len;
+#ifdef WORDS_BIGENDIAN
+    unsigned int    i = 0;
+#endif
+
+    while ((*out_len + 4) >= *buf_len) {
+        if (!(allow_realloc && snmp_realloc(buf, buf_len))) {
+            return 0;
+        }
+    }
+
+    if (network_order) {
+#ifndef WORDS_BIGENDIAN
+        value = ntohl(value);
+#endif
+        memmove((*buf + *out_len), &value, 4);
+        *out_len += 4;
+    } else {
+#ifndef WORDS_BIGENDIAN
+        memmove((*buf + *out_len), &value, 4);
+        *out_len += 4;
+#else
+        for (i = 0; i < 4; i++) {
+            *(*buf + *out_len) = (u_char) value & 0xff;
+            (*out_len)++;
+            value >>= 8;
+        }
+#endif
+    }
+    DEBUGDUMPSETUP("send", (*buf + ilen), 4);
+    DEBUGMSG(("dumpv_send", "  Integer:\t%lu (0x%.2lX)\n", ivalue,
+              ivalue));
+    return 1;
+}
+
+void
+agentx_build_int(u_char * bufp, u_int value, int network_byte_order)
+{
+    u_char         *orig_bufp = bufp;
+    u_int           orig_val = value;
+
+    if (network_byte_order) {
+#ifndef WORDS_BIGENDIAN
+        value = ntohl(value);
+#endif
+        memmove(bufp, &value, 4);
+    } else {
+#ifndef WORDS_BIGENDIAN
+        memmove(bufp, &value, 4);
+#else
+        *bufp = (u_char) value & 0xff;
+        value >>= 8;
+        bufp++;
+        *bufp = (u_char) value & 0xff;
+        value >>= 8;
+        bufp++;
+        *bufp = (u_char) value & 0xff;
+        value >>= 8;
+        bufp++;
+        *bufp = (u_char) value & 0xff;
+#endif
+    }
+    DEBUGDUMPSETUP("send", orig_bufp, 4);
+    DEBUGMSG(("dumpv_send", "  Integer:\t%ld (0x%.2X)\n", orig_val,
+              orig_val));
+}
+
+int
+agentx_realloc_build_short(u_char ** buf, size_t * buf_len,
+                           size_t * out_len, int allow_realloc,
+                           unsigned short value, int network_order)
+{
+    unsigned short  ivalue = value;
+    size_t          ilen = *out_len;
+#ifdef WORDS_BIGENDIAN
+    unsigned short  i = 0;
+#endif
+
+    while ((*out_len + 2) >= *buf_len) {
+        if (!(allow_realloc && snmp_realloc(buf, buf_len))) {
+            return 0;
+        }
+    }
+
+    if (network_order) {
+#ifndef WORDS_BIGENDIAN
+        value = ntohs(value);
+#endif
+        memmove((*buf + *out_len), &value, 2);
+        *out_len += 2;
+    } else {
+#ifndef WORDS_BIGENDIAN
+        memmove((*buf + *out_len), &value, 2);
+        *out_len += 2;
+#else
+        for (i = 0; i < 2; i++) {
+            *(*buf + *out_len) = (u_char) value & 0xff;
+            (*out_len)++;
+            value >>= 8;
+        }
+#endif
+    }
+    DEBUGDUMPSETUP("send", (*buf + ilen), 2);
+    DEBUGMSG(("dumpv_send", "  Short:\t%hu (0x%.2hX)\n", ivalue, ivalue));
+    return 1;
+}
+
+int
+agentx_realloc_build_oid(u_char ** buf, size_t * buf_len, size_t * out_len,
+                         int allow_realloc,
+                         int inclusive, oid * name, size_t name_len,
+                         int network_order)
+{
+    size_t          ilen = *out_len, i = 0;
+    int             prefix = 0;
+
+    DEBUGPRINTINDENT("dumpv_send");
+    DEBUGMSG(("dumpv_send", "OID: "));
+    DEBUGMSGOID(("dumpv_send", name, name_len));
+    DEBUGMSG(("dumpv_send", "\n"));
+
+    if (name_len == 2 && (name[0] == 0 && name[1] == 0)) {
+        name_len = 0;           /* Null OID */
+    }
+
+    /*
+     * 'Compact' internet OIDs 
+     */
+    if (name_len >= 5 && (name[0] == 1 && name[1] == 3 &&
+                          name[2] == 6 && name[3] == 1)) {
+        prefix = name[4];
+        name += 5;
+        name_len -= 5;
+    }
+
+    while ((*out_len + 4 + (4 * name_len)) >= *buf_len) {
+        if (!(allow_realloc && snmp_realloc(buf, buf_len))) {
+            return 0;
+        }
+    }
+
+    *(*buf + *out_len) = (u_char) name_len;
+    (*out_len)++;
+    *(*buf + *out_len) = (u_char) prefix;
+    (*out_len)++;
+    *(*buf + *out_len) = (u_char) inclusive;
+    (*out_len)++;
+    *(*buf + *out_len) = (u_char) 0x00;
+    (*out_len)++;
+
+    DEBUGDUMPHEADER("send", "OID Header");
+    DEBUGDUMPSETUP("send", (*buf + ilen), 4);
+    DEBUGMSG(("dumpv_send", "  # subids:\t%d (0x%.2X)\n", name_len,
+              name_len));
+    DEBUGPRINTINDENT("dumpv_send");
+    DEBUGMSG(("dumpv_send", "  prefix:\t%d (0x%.2X)\n", prefix, prefix));
+    DEBUGPRINTINDENT("dumpv_send");
+    DEBUGMSG(("dumpv_send", "  inclusive:\t%d (0x%.2X)\n", inclusive,
+              inclusive));
+    DEBUGINDENTLESS();
+    DEBUGDUMPHEADER("send", "OID Segments");
+
+    for (i = 0; i < name_len; i++) {
+        if (!agentx_realloc_build_int(buf, buf_len, out_len, allow_realloc,
+                                      name[i], network_order)) {
+            DEBUGINDENTLESS();
+            return 0;
+        }
+    }
+    DEBUGINDENTLESS();
+
+    return 1;
+}
+
+int
+agentx_realloc_build_string(u_char ** buf, size_t * buf_len,
+                            size_t * out_len, int allow_realloc,
+                            u_char * string, size_t string_len,
+                            int network_order)
+{
+    size_t          ilen = *out_len, i = 0;
+
+    while ((*out_len + 4 + (4 * ((string_len + 3) / 4))) >= *buf_len) {
+        if (!(allow_realloc && snmp_realloc(buf, buf_len))) {
+            return 0;
+        }
+    }
+
+    DEBUGDUMPHEADER("send", "Build String");
+    DEBUGDUMPHEADER("send", "length");
+    if (!agentx_realloc_build_int(buf, buf_len, out_len, allow_realloc,
+                                  string_len, network_order)) {
+        DEBUGINDENTLESS();
+        DEBUGINDENTLESS();
+        return 0;
+    }
+
+    if (string_len == 0) {
+        DEBUGMSG(("dumpv_send", "  String: <empty>\n"));
+        DEBUGINDENTLESS();
+        DEBUGINDENTLESS();
+        return 1;
+    }
+
+    memmove((*buf + *out_len), string, string_len);
+    *out_len += string_len;
+
+    /*
+     * Pad to a multiple of 4 bytes if necessary (per RFC 2741).  
+     */
+
+    if (string_len % 4 != 0) {
+        for (i = 0; i < 4 - (string_len % 4); i++) {
+            *(*buf + *out_len) = 0;
+            (*out_len)++;
+        }
+    }
+
+    DEBUGDUMPSETUP("send", (*buf + ilen + 4), ((string_len + 3) / 4) * 4);
+    DEBUGMSG(("dumpv_send", "  String:\t%s\n", string));
+    DEBUGINDENTLESS();
+    DEBUGINDENTLESS();
+    return 1;
+}
+
+#ifdef OPAQUE_SPECIAL_TYPES
+int
+agentx_realloc_build_double(u_char ** buf, size_t * buf_len,
+                            size_t * out_len, int allow_realloc,
+                            double double_val, int network_order)
+{
+    union {
+        double          doubleVal;
+        int             intVal[2];
+        char            c[sizeof(double)];
+    } du;
+    int             tmp;
+    u_char          opaque_buffer[3 + sizeof(double)];
+
+    opaque_buffer[0] = ASN_OPAQUE_TAG1;
+    opaque_buffer[1] = ASN_OPAQUE_DOUBLE;
+    opaque_buffer[2] = sizeof(double);
+
+    du.doubleVal = double_val;
+    tmp = htonl(du.intVal[0]);
+    du.intVal[0] = htonl(du.intVal[1]);
+    du.intVal[1] = tmp;
+    memcpy(&opaque_buffer[3], &du.c[0], sizeof(double));
+
+    return agentx_realloc_build_string(buf, buf_len, out_len,
+                                       allow_realloc, opaque_buffer,
+                                       3 + sizeof(double), network_order);
+}
+
+int
+agentx_realloc_build_float(u_char ** buf, size_t * buf_len,
+                           size_t * out_len, int allow_realloc,
+                           float float_val, int network_order)
+{
+    union {
+        float           floatVal;
+        int             intVal;
+        char            c[sizeof(float)];
+    } fu;
+    u_char          opaque_buffer[3 + sizeof(float)];
+
+    opaque_buffer[0] = ASN_OPAQUE_TAG1;
+    opaque_buffer[1] = ASN_OPAQUE_FLOAT;
+    opaque_buffer[2] = sizeof(float);
+
+    fu.floatVal = float_val;
+    fu.intVal = htonl(fu.intVal);
+    memcpy(&opaque_buffer[3], &fu.c[0], sizeof(float));
+
+    return agentx_realloc_build_string(buf, buf_len, out_len,
+                                       allow_realloc, opaque_buffer,
+                                       3 + sizeof(float), network_order);
+}
+#endif
+
+int
+agentx_realloc_build_varbind(u_char ** buf, size_t * buf_len,
+                             size_t * out_len, int allow_realloc,
+                             netsnmp_variable_list * vp, int network_order)
+{
+    DEBUGDUMPHEADER("send", "VarBind");
+    DEBUGDUMPHEADER("send", "type");
+#ifdef OPAQUE_SPECIAL_TYPES
+    if ((vp->type == ASN_OPAQUE_FLOAT) || (vp->type == ASN_OPAQUE_DOUBLE)
+        || (vp->type == ASN_OPAQUE_I64) || (vp->type == ASN_OPAQUE_U64)
+        || (vp->type == ASN_OPAQUE_COUNTER64)) {
+        if (!agentx_realloc_build_short
+            (buf, buf_len, out_len, allow_realloc,
+             (unsigned short) ASN_OPAQUE, network_order)) {
+            DEBUGINDENTLESS();
+            DEBUGINDENTLESS();
+            return 0;
+        }
+    } else
+#endif
+    if (vp->type == ASN_PRIV_INCL_RANGE || vp->type == ASN_PRIV_EXCL_RANGE) {
+        if (!agentx_realloc_build_short
+            (buf, buf_len, out_len, allow_realloc,
+             (unsigned short) ASN_OBJECT_ID, network_order)) {
+            DEBUGINDENTLESS();
+            DEBUGINDENTLESS();
+            return 0;
+        }
+    } else {
+        if (!agentx_realloc_build_short
+            (buf, buf_len, out_len, allow_realloc,
+             (unsigned short) vp->type, network_order)) {
+            DEBUGINDENTLESS();
+            DEBUGINDENTLESS();
+            return 0;
+        }
+    }
+
+    while ((*out_len + 2) >= *buf_len) {
+        if (!(allow_realloc && snmp_realloc(buf, buf_len))) {
+            DEBUGINDENTLESS();
+            DEBUGINDENTLESS();
+            return 0;
+        }
+    }
+
+    *(*buf + *out_len) = 0;
+    (*out_len)++;
+    *(*buf + *out_len) = 0;
+    (*out_len)++;
+    DEBUGINDENTLESS();
+
+    DEBUGDUMPHEADER("send", "name");
+    if (!agentx_realloc_build_oid(buf, buf_len, out_len, allow_realloc, 0,
+                                  vp->name, vp->name_length,
+                                  network_order)) {
+        DEBUGINDENTLESS();
+        return 0;
+    }
+    DEBUGINDENTLESS();
+
+    DEBUGDUMPHEADER("send", "value");
+    switch (vp->type) {
+
+    case ASN_INTEGER:
+    case ASN_COUNTER:
+    case ASN_GAUGE:
+    case ASN_TIMETICKS:
+        if (!agentx_realloc_build_int(buf, buf_len, out_len, allow_realloc,
+                                      *(vp->val.integer), network_order)) {
+            DEBUGINDENTLESS();
+            DEBUGINDENTLESS();
+            return 0;
+        }
+        break;
+
+#ifdef OPAQUE_SPECIAL_TYPES
+    case ASN_OPAQUE_FLOAT:
+        DEBUGDUMPHEADER("send", "Build Opaque Float");
+        DEBUGPRINTINDENT("dumpv_send");
+        DEBUGMSG(("dumpv_send", "  Float:\t%f\n", *(vp->val.floatVal)));
+        if (!agentx_realloc_build_float
+            (buf, buf_len, out_len, allow_realloc, *(vp->val.floatVal),
+             network_order)) {
+            DEBUGINDENTLESS();
+            DEBUGINDENTLESS();
+            DEBUGINDENTLESS();
+            return 0;
+        }
+        DEBUGINDENTLESS();
+        break;
+
+    case ASN_OPAQUE_DOUBLE:
+        DEBUGDUMPHEADER("send", "Build Opaque Double");
+        DEBUGPRINTINDENT("dumpv_send");
+        DEBUGMSG(("dumpv_send", "  Double:\t%lf\n", *(vp->val.doubleVal)));
+        if (!agentx_realloc_build_double
+            (buf, buf_len, out_len, allow_realloc, *(vp->val.doubleVal),
+             network_order)) {
+            DEBUGINDENTLESS();
+            DEBUGINDENTLESS();
+            DEBUGINDENTLESS();
+            return 0;
+        }
+        DEBUGINDENTLESS();
+        break;
+
+    case ASN_OPAQUE_I64:
+    case ASN_OPAQUE_U64:
+    case ASN_OPAQUE_COUNTER64:
+        /*
+         * XXX - TODO - encode as raw OPAQUE for now (so fall through
+         * here).  
+         */
+#endif
+
+    case ASN_OCTET_STR:
+    case ASN_IPADDRESS:
+    case ASN_OPAQUE:
+        if (!agentx_realloc_build_string
+            (buf, buf_len, out_len, allow_realloc, vp->val.string,
+             vp->val_len, network_order)) {
+            DEBUGINDENTLESS();
+            DEBUGINDENTLESS();
+            return 0;
+        }
+        break;
+
+    case ASN_OBJECT_ID:
+    case ASN_PRIV_EXCL_RANGE:
+    case ASN_PRIV_INCL_RANGE:
+        if (!agentx_realloc_build_oid
+            (buf, buf_len, out_len, allow_realloc, 1, vp->val.objid,
+             vp->val_len / sizeof(oid), network_order)) {
+            DEBUGINDENTLESS();
+            DEBUGINDENTLESS();
+            return 0;
+        }
+        break;
+
+    case ASN_COUNTER64:
+        if (network_order) {
+            DEBUGDUMPHEADER("send", "Build Counter64 (high, low)");
+            if (!agentx_realloc_build_int
+                (buf, buf_len, out_len, allow_realloc,
+                 vp->val.counter64->high, network_order)
+                || !agentx_realloc_build_int(buf, buf_len, out_len,
+                                             allow_realloc,
+                                             vp->val.counter64->low,
+                                             network_order)) {
+                DEBUGINDENTLESS();
+                DEBUGINDENTLESS();
+                DEBUGINDENTLESS();
+                return 0;
+            }
+        } else {
+            DEBUGDUMPHEADER("send", "Build Counter64 (low, high)");
+            if (!agentx_realloc_build_int
+                (buf, buf_len, out_len, allow_realloc,
+                 vp->val.counter64->low, network_order)
+                || !agentx_realloc_build_int(buf, buf_len, out_len,
+                                             allow_realloc,
+                                             vp->val.counter64->high,
+                                             network_order)) {
+                DEBUGINDENTLESS();
+                DEBUGINDENTLESS();
+                DEBUGINDENTLESS();
+                return 0;
+            }
+        }
+        break;
+
+    case ASN_NULL:
+    case SNMP_NOSUCHOBJECT:
+    case SNMP_NOSUCHINSTANCE:
+    case SNMP_ENDOFMIBVIEW:
+        break;
+
+    default:
+        DEBUGMSGTL(("agentx_build_varbind", "unknown type %d (0x%02x)\n",
+                    vp->type, vp->type));
+        DEBUGINDENTLESS();
+        DEBUGINDENTLESS();
+        return 0;
+    }
+    DEBUGINDENTLESS();
+    DEBUGINDENTLESS();
+    return 1;
+}
+
+int
+agentx_realloc_build_header(u_char ** buf, size_t * buf_len,
+                            size_t * out_len, int allow_realloc,
+                            netsnmp_pdu *pdu)
+{
+    size_t          ilen = *out_len;
+    const int       network_order =
+        pdu->flags & AGENTX_FLAGS_NETWORK_BYTE_ORDER;
+
+    while ((*out_len + 4) >= *buf_len) {
+        if (!(allow_realloc && snmp_realloc(buf, buf_len))) {
+            return 0;
+        }
+    }
+
+    /*
+     * First 4 bytes are version, pdu type, flags, and a 0 reserved byte.  
+     */
+
+    *(*buf + *out_len) = 1;
+    (*out_len)++;
+    *(*buf + *out_len) = pdu->command;
+    (*out_len)++;
+    *(*buf + *out_len) = (u_char) (pdu->flags & AGENTX_MSG_FLAGS_MASK);
+    (*out_len)++;
+    *(*buf + *out_len) = 0;
+    (*out_len)++;
+
+    DEBUGDUMPHEADER("send", "AgentX Header");
+    DEBUGDUMPSETUP("send", (*buf + ilen), 4);
+    DEBUGMSG(("dumpv_send", "  Version:\t%d\n", (int) *(*buf + ilen)));
+    DEBUGPRINTINDENT("dumpv_send");
+    DEBUGMSG(("dumpv_send", "  Command:\t%d (%s)\n", pdu->command,
+              agentx_cmd(pdu->command)));
+    DEBUGPRINTINDENT("dumpv_send");
+    DEBUGMSG(("dumpv_send", "  Flags:\t%02x\n", (int) *(*buf + ilen + 2)));
+
+    DEBUGDUMPHEADER("send", "Session ID");
+    if (!agentx_realloc_build_int(buf, buf_len, out_len, allow_realloc,
+                                  pdu->sessid, network_order)) {
+        DEBUGINDENTLESS();
+        DEBUGINDENTLESS();
+        return 0;
+    }
+    DEBUGINDENTLESS();
+
+    DEBUGDUMPHEADER("send", "Transaction ID");
+    if (!agentx_realloc_build_int(buf, buf_len, out_len, allow_realloc,
+                                  pdu->transid, network_order)) {
+        DEBUGINDENTLESS();
+        DEBUGINDENTLESS();
+        return 0;
+    }
+    DEBUGINDENTLESS();
+
+    DEBUGDUMPHEADER("send", "Request ID");
+    if (!agentx_realloc_build_int(buf, buf_len, out_len, allow_realloc,
+                                  pdu->reqid, network_order)) {
+        DEBUGINDENTLESS();
+        DEBUGINDENTLESS();
+        return 0;
+    }
+    DEBUGINDENTLESS();
+
+    DEBUGDUMPHEADER("send", "Dummy Length :-(");
+    if (!agentx_realloc_build_int(buf, buf_len, out_len, allow_realloc,
+                                  0, network_order)) {
+        DEBUGINDENTLESS();
+        DEBUGINDENTLESS();
+        return 0;
+    }
+    DEBUGINDENTLESS();
+
+    if (pdu->flags & AGENTX_MSG_FLAG_NON_DEFAULT_CONTEXT) {
+        DEBUGDUMPHEADER("send", "Community");
+        if (!agentx_realloc_build_string
+            (buf, buf_len, out_len, allow_realloc, pdu->community,
+             pdu->community_len, network_order)) {
+            DEBUGINDENTLESS();
+            DEBUGINDENTLESS();
+            return 0;
+        }
+        DEBUGINDENTLESS();
+    }
+
+    DEBUGINDENTLESS();
+    return 1;
+}
+
+static int
+_agentx_realloc_build(u_char ** buf, size_t * buf_len, size_t * out_len,
+                      int allow_realloc,
+                      netsnmp_session * session, netsnmp_pdu *pdu)
+{
+    size_t          ilen = *out_len, prefix_offset = 0;
+    netsnmp_variable_list *vp;
+    int             inc, i = 0;
+    const int       network_order =
+        pdu->flags & AGENTX_FLAGS_NETWORK_BYTE_ORDER;
+
+    session->s_snmp_errno = 0;
+    session->s_errno = 0;
+
+    /*
+     * Various PDU types don't include context information (RFC 2741, p. 20). 
+     */
+    switch (pdu->command) {
+    case AGENTX_MSG_OPEN:
+    case AGENTX_MSG_CLOSE:
+    case AGENTX_MSG_RESPONSE:
+    case AGENTX_MSG_COMMITSET:
+    case AGENTX_MSG_UNDOSET:
+    case AGENTX_MSG_CLEANUPSET:
+        pdu->flags &= ~(AGENTX_MSG_FLAG_NON_DEFAULT_CONTEXT);
+    }
+
+    /*
+     * Build the header (and context if appropriate).  
+     */
+    if (!agentx_realloc_build_header
+        (buf, buf_len, out_len, allow_realloc, pdu)) {
+        return 0;
+    }
+
+    /*
+     * Everything causes a response, except for agentx-Response-PDU and
+     * agentx-CleanupSet-PDU.  
+     */
+
+    pdu->flags |= UCD_MSG_FLAG_EXPECT_RESPONSE;
+
+    DEBUGDUMPHEADER("send", "AgentX Payload");
+    switch (pdu->command) {
+
+    case AGENTX_MSG_OPEN:
+        /*
+         * Timeout  
+         */
+        while ((*out_len + 4) >= *buf_len) {
+            if (!(allow_realloc && snmp_realloc(buf, buf_len))) {
+                DEBUGINDENTLESS();
+                return 0;
+            }
+        }
+        *(*buf + *out_len) = (u_char) pdu->time;
+        (*out_len)++;
+        for (i = 0; i < 3; i++) {
+            *(*buf + *out_len) = 0;
+            (*out_len)++;
+        }
+        DEBUGDUMPHEADER("send", "Open Timeout");
+        DEBUGDUMPSETUP("send", (*buf + *out_len - 4), 4);
+        DEBUGMSG(("dumpv_send", "  Timeout:\t%d\n",
+                  (int) *(*buf + *out_len - 4)));
+        DEBUGINDENTLESS();
+
+        DEBUGDUMPHEADER("send", "Open ID");
+        if (!agentx_realloc_build_oid
+            (buf, buf_len, out_len, allow_realloc, 0, pdu->variables->name,
+             pdu->variables->name_length, network_order)) {
+            DEBUGINDENTLESS();
+            DEBUGINDENTLESS();
+            return 0;
+        }
+        DEBUGINDENTLESS();
+        DEBUGDUMPHEADER("send", "Open Description");
+        if (!agentx_realloc_build_string
+            (buf, buf_len, out_len, allow_realloc,
+             pdu->variables->val.string, pdu->variables->val_len,
+             network_order)) {
+            DEBUGINDENTLESS();
+            DEBUGINDENTLESS();
+            return 0;
+        }
+        DEBUGINDENTLESS();
+        break;
+
+    case AGENTX_MSG_CLOSE:
+        /*
+         * Reason  
+         */
+        while ((*out_len + 4) >= *buf_len) {
+            if (!(allow_realloc && snmp_realloc(buf, buf_len))) {
+                DEBUGINDENTLESS();
+                return 0;
+            }
+        }
+        *(*buf + *out_len) = (u_char) pdu->errstat;
+        (*out_len)++;
+        for (i = 0; i < 3; i++) {
+            *(*buf + *out_len) = 0;
+            (*out_len)++;
+        }
+        DEBUGDUMPHEADER("send", "Close Reason");
+        DEBUGDUMPSETUP("send", (*buf + *out_len - 4), 4);
+        DEBUGMSG(("dumpv_send", "  Reason:\t%d\n",
+                  (int) *(*buf + *out_len - 4)));
+        DEBUGINDENTLESS();
+        break;
+
+    case AGENTX_MSG_REGISTER:
+    case AGENTX_MSG_UNREGISTER:
+        while ((*out_len + 4) >= *buf_len) {
+            if (!(allow_realloc && snmp_realloc(buf, buf_len))) {
+                DEBUGINDENTLESS();
+                return 0;
+            }
+        }
+        if (pdu->command == AGENTX_MSG_REGISTER) {
+            *(*buf + *out_len) = (u_char) pdu->time;
+        } else {
+            *(*buf + *out_len) = 0;
+        }
+        (*out_len)++;
+        *(*buf + *out_len) = (u_char) pdu->priority;
+        (*out_len)++;
+        *(*buf + *out_len) = (u_char) pdu->range_subid;
+        (*out_len)++;
+        *(*buf + *out_len) = (u_char) 0;
+        (*out_len)++;
+
+        DEBUGDUMPHEADER("send", "(Un)Register Header");
+        DEBUGDUMPSETUP("send", (*buf + *out_len - 4), 4);
+        if (pdu->command == AGENTX_MSG_REGISTER) {
+            DEBUGMSG(("dumpv_send", "  Timeout:\t%d\n",
+                      (int) *(*buf + *out_len - 4)));
+            DEBUGPRINTINDENT("dumpv_send");
+        }
+        DEBUGMSG(("dumpv_send", "  Priority:\t%d\n",
+                  (int) *(*buf + *out_len - 3)));
+        DEBUGPRINTINDENT("dumpv_send");
+        DEBUGMSG(("dumpv_send", "  Range SubID:\t%d\n",
+                  (int) *(*buf + *out_len - 2)));
+        DEBUGINDENTLESS();
+
+        vp = pdu->variables;
+        prefix_offset = *out_len + 1;
+        DEBUGDUMPHEADER("send", "(Un)Register Prefix");
+        if (!agentx_realloc_build_oid
+            (buf, buf_len, out_len, allow_realloc, 0, vp->name,
+             vp->name_length, network_order)) {
+
+            DEBUGINDENTLESS();
+            DEBUGINDENTLESS();
+            return 0;
+        }
+        DEBUGINDENTLESS();
+
+        if (pdu->range_subid) {
+            DEBUGDUMPHEADER("send", "(Un)Register Range");
+            if (!agentx_realloc_build_int
+                (buf, buf_len, out_len, allow_realloc,
+                 vp->val.objid[pdu->range_subid - 1], network_order)) {
+                DEBUGINDENTLESS();
+                DEBUGINDENTLESS();
+                return 0;
+            }
+            DEBUGINDENTLESS();
+        }
+        break;
+
+    case AGENTX_MSG_GETBULK:
+        DEBUGDUMPHEADER("send", "GetBulk Non-Repeaters");
+        if (!agentx_realloc_build_short
+            (buf, buf_len, out_len, allow_realloc, pdu->non_repeaters,
+             network_order)) {
+            DEBUGINDENTLESS();
+            DEBUGINDENTLESS();
+            return 0;
+        }
+        DEBUGINDENTLESS();
+
+        DEBUGDUMPHEADER("send", "GetBulk Max-Repetitions");
+        if (!agentx_realloc_build_short
+            (buf, buf_len, out_len, allow_realloc, pdu->max_repetitions,
+             network_order)) {
+            DEBUGINDENTLESS();
+            DEBUGINDENTLESS();
+            return 0;
+        }
+        DEBUGINDENTLESS();
+
+        /*
+         * Fallthrough  
+         */
+
+    case AGENTX_MSG_GET:
+    case AGENTX_MSG_GETNEXT:
+        DEBUGDUMPHEADER("send", "Get* Variable List");
+        for (vp = pdu->variables; vp != NULL; vp = vp->next_variable) {
+            inc = (vp->type == ASN_PRIV_INCL_RANGE);
+            if (!agentx_realloc_build_oid
+                (buf, buf_len, out_len, allow_realloc, inc, vp->name,
+                 vp->name_length, network_order)) {
+                DEBUGINDENTLESS();
+                DEBUGINDENTLESS();
+                return 0;
+            }
+            if (!agentx_realloc_build_oid
+                (buf, buf_len, out_len, allow_realloc, 0, vp->val.objid,
+                 vp->val_len / sizeof(oid), network_order)) {
+                DEBUGINDENTLESS();
+                DEBUGINDENTLESS();
+                return 0;
+            }
+        }
+        DEBUGINDENTLESS();
+        break;
+
+    case AGENTX_MSG_RESPONSE:
+        pdu->flags &= ~(UCD_MSG_FLAG_EXPECT_RESPONSE);
+        if (!agentx_realloc_build_int(buf, buf_len, out_len, allow_realloc,
+                                      pdu->time, network_order)) {
+            DEBUGINDENTLESS();
+            return 0;
+        }
+        DEBUGDUMPHEADER("send", "Response");
+        DEBUGDUMPSETUP("send", (*buf + *out_len - 4), 4);
+        DEBUGMSG(("dumpv_send", "  sysUpTime:\t%d\n", pdu->time));
+        DEBUGINDENTLESS();
+
+        if (!agentx_realloc_build_short
+            (buf, buf_len, out_len, allow_realloc, pdu->errstat,
+             network_order)
+            || !agentx_realloc_build_short(buf, buf_len, out_len,
+                                           allow_realloc, pdu->errindex,
+                                           network_order)) {
+            DEBUGINDENTLESS();
+            return 0;
+        }
+        DEBUGDUMPHEADER("send", "Response errors");
+        DEBUGDUMPSETUP("send", (*buf + *out_len - 4), 4);
+        DEBUGMSG(("dumpv_send", "  errstat:\t%d\n", pdu->errstat));
+        DEBUGPRINTINDENT("dumpv_send");
+        DEBUGMSG(("dumpv_send", "  errindex:\t%d\n", pdu->errindex));
+        DEBUGINDENTLESS();
+
+        /*
+         * Fallthrough  
+         */
+
+    case AGENTX_MSG_INDEX_ALLOCATE:
+    case AGENTX_MSG_INDEX_DEALLOCATE:
+    case AGENTX_MSG_NOTIFY:
+    case AGENTX_MSG_TESTSET:
+        DEBUGDUMPHEADER("send", "Get* Variable List");
+        for (vp = pdu->variables; vp != NULL; vp = vp->next_variable) {
+            if (!agentx_realloc_build_varbind
+                (buf, buf_len, out_len, allow_realloc, vp,
+                 network_order)) {
+                DEBUGINDENTLESS();
+                DEBUGINDENTLESS();
+                return 0;
+            }
+        }
+        DEBUGINDENTLESS();
+        break;
+
+    case AGENTX_MSG_COMMITSET:
+    case AGENTX_MSG_UNDOSET:
+    case AGENTX_MSG_PING:
+        /*
+         * "Empty" packet.  
+         */
+        break;
+
+    case AGENTX_MSG_CLEANUPSET:
+        pdu->flags &= ~(UCD_MSG_FLAG_EXPECT_RESPONSE);
+        break;
+
+    case AGENTX_MSG_ADD_AGENT_CAPS:
+        DEBUGDUMPHEADER("send", "AgentCaps OID");
+        if (!agentx_realloc_build_oid
+            (buf, buf_len, out_len, allow_realloc, 0, pdu->variables->name,
+             pdu->variables->name_length, network_order)) {
+            DEBUGINDENTLESS();
+            DEBUGINDENTLESS();
+            return 0;
+        }
+        DEBUGINDENTLESS();
+
+        DEBUGDUMPHEADER("send", "AgentCaps Description");
+        if (!agentx_realloc_build_string
+            (buf, buf_len, out_len, allow_realloc,
+             pdu->variables->val.string, pdu->variables->val_len,
+             network_order)) {
+            DEBUGINDENTLESS();
+            DEBUGINDENTLESS();
+            return 0;
+        }
+        DEBUGINDENTLESS();
+        break;
+
+    case AGENTX_MSG_REMOVE_AGENT_CAPS:
+        DEBUGDUMPHEADER("send", "AgentCaps OID");
+        if (!agentx_realloc_build_oid
+            (buf, buf_len, out_len, allow_realloc, 0, pdu->variables->name,
+             pdu->variables->name_length, network_order)) {
+            DEBUGINDENTLESS();
+            DEBUGINDENTLESS();
+            return 0;
+        }
+        DEBUGINDENTLESS();
+        break;
+
+    default:
+        session->s_snmp_errno = SNMPERR_UNKNOWN_PDU;
+        return 0;
+    }
+    DEBUGINDENTLESS();
+
+    /*
+     * Fix the payload length (ignoring the 20-byte header).  
+     */
+
+    agentx_build_int((*buf + 16), (*out_len - ilen) - 20, network_order);
+
+    DEBUGMSGTL(("agentx_build", "packet built okay\n"));
+    return 1;
+}
+
+int
+agentx_realloc_build(netsnmp_session * session, netsnmp_pdu *pdu,
+                     u_char ** buf, size_t * buf_len, size_t * out_len)
+{
+    if (session == NULL || buf_len == NULL ||
+        out_len == NULL || pdu == NULL || buf == NULL) {
+        return -1;
+    }
+    if (!_agentx_realloc_build(buf, buf_len, out_len, 1, session, pdu)) {
+        if (session->s_snmp_errno == 0) {
+            session->s_snmp_errno = SNMPERR_BAD_ASN1_BUILD;
+        }
+        return -1;
+    }
+
+    return 0;
+}
+
+        /***********************
+	*
+	*  Utility functions for parsing an AgentX packet
+	*
+	***********************/
+
+int
+agentx_parse_int(u_char * data, u_int network_byte_order)
+{
+    u_int           value = 0;
+
+    /*
+     *  Note - this doesn't handle 'PDP_ENDIAN' systems
+     *      If anyone needs this added, contact the coders list
+     */
+    DEBUGDUMPSETUP("recv", data, 4);
+    if (network_byte_order) {
+        memmove(&value, data, 4);
+#ifndef WORDS_BIGENDIAN
+        value = ntohl(value);
+#endif
+    } else {
+#ifndef WORDS_BIGENDIAN
+        memmove(&value, data, 4);
+#else
+        /*
+         * The equivalent of the 'ntohl()' macro,
+         * except this macro is null on big-endian systems 
+         */
+        value += data[3];
+        value <<= 8;
+        value += data[2];
+        value <<= 8;
+        value += data[1];
+        value <<= 8;
+        value += data[0];
+#endif
+    }
+    DEBUGMSG(("dumpv_recv", "  Integer:\t%ld (0x%.2X)\n", value, value));
+
+    return value;
+}
+
+
+int
+agentx_parse_short(u_char * data, u_int network_byte_order)
+{
+    u_short         value = 0;
+
+    if (network_byte_order) {
+        memmove(&value, data, 2);
+#ifndef WORDS_BIGENDIAN
+        value = ntohs(value);
+#endif
+    } else {
+#ifndef WORDS_BIGENDIAN
+        memmove(&value, data, 2);
+#else
+        /*
+         * The equivalent of the 'ntohs()' macro,
+         * except this macro is null on big-endian systems 
+         */
+        value += data[1];
+        value <<= 8;
+        value += data[0];
+#endif
+    }
+
+    DEBUGDUMPSETUP("recv", data, 2);
+    DEBUGMSG(("dumpv_recv", "  Short:\t%ld (0x%.2X)\n", value, value));
+    return value;
+}
+
+
+u_char         *
+agentx_parse_oid(u_char * data, size_t * length, int *inc,
+                 oid * oid_buf, size_t * oid_len, u_int network_byte_order)
+{
+    u_int           n_subid;
+    u_int           prefix;
+    int             i;
+    int             int_offset;
+    oid            *oid_ptr = oid_buf;
+    u_int          *int_ptr = (u_int *)oid_buf;
+    u_char         *buf_ptr = data;
+
+    if (*length < 4) {
+        DEBUGMSGTL(("agentx", "Incomplete Object ID"));
+        return NULL;
+    }
+
+    DEBUGDUMPHEADER("recv", "OID Header");
+    DEBUGDUMPSETUP("recv", data, 4);
+    DEBUGMSG(("dumpv_recv", "  # subids:\t%d (0x%.2X)\n", data[0],
+              data[0]));
+    DEBUGPRINTINDENT("dumpv_recv");
+    DEBUGMSG(("dumpv_recv", "  prefix: \t%d (0x%.2X)\n", data[1],
+              data[1]));
+    DEBUGPRINTINDENT("dumpv_recv");
+    DEBUGMSG(("dumpv_recv", "  inclusive:\t%d (0x%.2X)\n", data[2],
+              data[2]));
+
+    DEBUGINDENTLESS();
+    DEBUGDUMPHEADER("recv", "OID Segments");
+
+    n_subid = data[0];
+    prefix = data[1];
+    if (inc)
+        *inc = data[2];
+    int_offset = sizeof(oid)/4;
+
+    buf_ptr += 4;
+    *length -= 4;
+
+    DEBUGMSG(("djp", "  parse_oid\n"));
+    DEBUGMSG(("djp", "  sizeof(oid) = %d\n", sizeof(oid)));
+    if (n_subid == 0 && prefix == 0) {
+        /*
+         * Null OID 
+         */
+        *int_ptr = 0;
+        int_ptr++;
+        *int_ptr = 0;
+        int_ptr++;
+        *oid_len = 2;
+        DEBUGPRINTINDENT("dumpv_recv");
+        DEBUGMSG(("dumpv_recv", "OID: NULL (0.0)\n"));
+        DEBUGINDENTLESS();
+        return buf_ptr;
+    }
+
+
+    if (*length < 4 * n_subid) {
+        DEBUGMSGTL(("agentx", "Incomplete Object ID"));
+        return NULL;
+    }
+
+    if (prefix) {	 
+        if (sizeof(oid) == 8) {  	/* align OID values in 64 bit agent */  
+            int_ptr[0] = int_ptr[2] = int_ptr[4] = int_ptr[6] = int_ptr[8] = 0;
+        }
+        int_ptr[int_offset - 1] = 1;
+        int_ptr[(int_offset * 2) - 1] = 3;
+        int_ptr[(int_offset * 3) - 1] = 6;
+        int_ptr[(int_offset * 4) - 1] = 1;
+        int_ptr[(int_offset * 5) - 1] = prefix;
+        int_ptr = int_ptr + (int_offset * 5);
+    }
+
+    for (i = 0; i < (int) (int_offset * n_subid); i = i + int_offset) {
+        int_ptr[i] = 0;
+        int_ptr[i + (int_offset - 1)] = agentx_parse_int(buf_ptr, network_byte_order);
+        buf_ptr += 4;
+        *length -= 4;
+    }
+
+    *oid_len = (prefix ? n_subid + 5 : n_subid);
+#ifndef solaris2
+    DEBUGINDENTLESS();
+    DEBUGPRINTINDENT("dumpv_recv");
+    DEBUGMSG(("dumpv_recv", "OID: "));
+    DEBUGMSGOID(("dumpv_recv", oid_buf, *oid_len));
+    DEBUGMSG(("dumpv_recv", "\n"));
+#endif
+    return buf_ptr;
+}
+
+
+
+u_char         *
+agentx_parse_string(u_char * data, size_t * length,
+                    u_char * string, size_t * str_len,
+                    u_int network_byte_order)
+{
+    u_int           len;
+
+    if (*length < 4) {
+        DEBUGMSGTL(("agentx", "Incomplete string (too short: %d)",
+                    *length));
+        return NULL;
+    }
+
+    len = agentx_parse_int(data, network_byte_order);
+    if (*length < len + 4) {
+        DEBUGMSGTL(("agentx", "Incomplete string (still too short: %d)",
+                    *length));
+        return NULL;
+    }
+    if (len > *str_len) {
+        DEBUGMSGTL(("agentx", "String too long (too long)"));
+        return NULL;
+    }
+    memmove(string, data + 4, len);
+    string[len] = '\0';
+    *str_len = len;
+
+    len += 3;                   /* Extend the string length to include the padding */
+    len >>= 2;
+    len <<= 2;
+
+    *length -= (len + 4);
+    DEBUGDUMPSETUP("recv", data, (len + 4));
+    DEBUGIF("dumpv_recv") {
+        u_char         *buf = NULL;
+        size_t          buf_len = 0, out_len = 0;
+
+        if (sprint_realloc_asciistring(&buf, &buf_len, &out_len, 1,
+                                       string, len)) {
+            DEBUGMSG(("dumpv_recv", "String: %s\n", buf));
+        } else {
+            DEBUGMSG(("dumpv_recv", "String: %s [TRUNCATED]\n", buf));
+        }
+        if (buf != NULL) {
+            free(buf);
+        }
+    }
+    return data + (len + 4);
+}
+
+u_char         *
+agentx_parse_opaque(u_char * data, size_t * length, int *type,
+                    u_char * opaque_buf, size_t * opaque_len,
+                    u_int network_byte_order)
+{
+    union {
+        float           floatVal;
+        double          doubleVal;
+        int             intVal[2];
+        char            c[sizeof(double)];
+    } fu;
+    int             tmp;
+    u_char         *buf;
+    u_char         *cp;
+
+    cp = agentx_parse_string(data, length,
+                             opaque_buf, opaque_len, network_byte_order);
+    if (cp == NULL)
+        return NULL;
+
+    buf = opaque_buf;
+
+#ifdef OPAQUE_SPECIAL_TYPES
+    if ((buf[0] != ASN_OPAQUE_TAG1) || (*opaque_len <= 3))
+        return cp;              /* Unrecognised opaque type */
+
+    switch (buf[1]) {
+    case ASN_OPAQUE_FLOAT:
+        if ((*opaque_len != (3 + sizeof(float))) ||
+            (buf[2] != sizeof(float)))
+            return cp;          /* Encoding isn't right for FLOAT */
+
+        memcpy(&fu.c[0], &buf[3], sizeof(float));
+        fu.intVal[0] = ntohl(fu.intVal[0]);
+        *opaque_len = sizeof(float);
+        memcpy(opaque_buf, &fu.c[0], sizeof(float));
+        *type = ASN_OPAQUE_FLOAT;
+        DEBUGMSG(("dumpv_recv", "Float: %f\n", fu.floatVal));
+        return cp;
+
+    case ASN_OPAQUE_DOUBLE:
+        if ((*opaque_len != (3 + sizeof(double))) ||
+            (buf[2] != sizeof(double)))
+            return cp;          /* Encoding isn't right for DOUBLE */
+
+        memcpy(&fu.c[0], &buf[3], sizeof(double));
+        tmp = ntohl(fu.intVal[1]);
+        fu.intVal[1] = ntohl(fu.intVal[0]);
+        fu.intVal[0] = tmp;
+        *opaque_len = sizeof(double);
+        memcpy(opaque_buf, &fu.c[0], sizeof(double));
+        *type = ASN_OPAQUE_DOUBLE;
+        DEBUGMSG(("dumpv_recv", "Double: %lf\n", fu.doubleVal));
+        return cp;
+
+    case ASN_OPAQUE_I64:
+    case ASN_OPAQUE_U64:
+    case ASN_OPAQUE_COUNTER64:
+    default:
+        return cp;              /* Unrecognised opaque sub-type */
+    }
+#else
+    return cp;
+#endif
+}
+
+
+u_char         *
+agentx_parse_varbind(u_char * data, size_t * length, int *type,
+                     oid * oid_buf, size_t * oid_len,
+                     u_char * data_buf, size_t * data_len,
+                     u_int network_byte_order)
+{
+    u_char         *bufp = data;
+    u_int           int_val;
+    int            int_offset;
+    u_int          *int_ptr = (u_int *) data_buf;
+
+    DEBUGDUMPHEADER("recv", "VarBind:");
+    DEBUGDUMPHEADER("recv", "Type");
+    *type = agentx_parse_short(bufp, network_byte_order);
+    DEBUGINDENTLESS();
+    bufp += 4;
+    *length -= 4;
+
+    bufp = agentx_parse_oid(bufp, length, NULL, oid_buf, oid_len,
+                            network_byte_order);
+    if (bufp == NULL) {
+        DEBUGINDENTLESS();
+        return NULL;
+    }
+
+    switch (*type) {
+    case ASN_INTEGER:
+    case ASN_COUNTER:
+    case ASN_GAUGE:
+    case ASN_TIMETICKS:
+        int_val = agentx_parse_int(bufp, network_byte_order);
+        memmove(data_buf, &int_val, 4);
+        *data_len = 4;
+        bufp += 4;
+        *length -= 4;
+        break;
+
+    case ASN_OCTET_STR:
+    case ASN_IPADDRESS:
+        bufp = agentx_parse_string(bufp, length, data_buf, data_len,
+                                   network_byte_order);
+        break;
+
+    case ASN_OPAQUE:
+        bufp = agentx_parse_opaque(bufp, length, type, data_buf, data_len,
+                                   network_byte_order);
+        break;
+
+    case ASN_PRIV_INCL_RANGE:
+    case ASN_PRIV_EXCL_RANGE:
+    case ASN_OBJECT_ID:
+        bufp =
+            agentx_parse_oid(bufp, length, NULL, (oid *) data_buf,
+                             data_len, network_byte_order);
+        *data_len *= sizeof(oid);
+        /*
+         * 'agentx_parse_oid()' returns the number of sub_ids 
+         */
+        break;
+
+    case ASN_COUNTER64:
+        /*
+         * Set up offset to be 2 for 64-bit, 1 for 32-bit.
+         * Use this value in formulas to correctly put integer values
+         * extracted from buffer into correct place in byte buffer.
+         */
+        int_offset = sizeof(long) == 8 ? 2 : 1;
+	if (network_byte_order) {
+            /*
+             * For 64-bit, clear integers 2 & 3, then place values in 0 & 1.
+             * For 32-bit, clear integers 0 & 1, then overwrite with values.
+             * Could also put a conditional in here to skip clearing 0 & 1.
+             */
+	    int_ptr[(2 * int_offset) - 2] = 0;
+	    int_ptr[(2 * int_offset) - 1] = 0;
+	    int_ptr[0] = agentx_parse_int(bufp, network_byte_order);
+	    int_ptr[1] = agentx_parse_int(bufp + 4, network_byte_order);
+	} else {
+            /*
+             * For 64-bit, clear integers 0 & 1, then place values in 2 & 3.
+             * For 32-bit, clear integers 0 & 1, then overwrite with values.
+             * Could also put a conditional in here to skip clearing 0 & 1.
+             */
+	    int_ptr[0] = 0;
+	    int_ptr[1] = 0;
+	    int_ptr[(2 * int_offset) - 2] = agentx_parse_int(bufp + 4,
+                                                            network_byte_order);
+	    int_ptr[(2 * int_offset) - 1] = agentx_parse_int(bufp,
+                                                            network_byte_order);
+	}
+
+        /* return data_len 2*8 if 64-bit, 2*4 if 32-bit */
+	*data_len = 2 * sizeof(long);
+	bufp += 2 * sizeof(long);
+	*length -= 8;
+        break;
+
+    case ASN_NULL:
+    case SNMP_NOSUCHOBJECT:
+    case SNMP_NOSUCHINSTANCE:
+    case SNMP_ENDOFMIBVIEW:
+        /*
+         * No data associated with these types. 
+         */
+        *data_len = 0;
+        break;
+
+    default:
+        DEBUGINDENTLESS();
+        return NULL;
+    }
+    DEBUGINDENTLESS();
+    return bufp;
+}
+
+/*
+ *  AgentX header:
+ *
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * |    h.version  |   h.type      |   h.flags     |  <reserved>   |
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * |                       h.sessionID                             |
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * |                     h.transactionID                           |
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * |                       h.packetID                              |
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * |                     h.payload_length                          |
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ *
+ *    Total length = 20 bytes
+ *
+ *  If we don't seem to have the full packet, return NULL
+ *    and let the driving code go back for the rest.
+ *  Don't report this as an error, as it's quite "normal"
+ *    with a connection-oriented service.
+ *
+ *  Note that once the header has been successfully processed
+ *    (and hence we should have the full packet), any subsequent
+ *    "running out of room" is indeed an error.
+ */
+u_char         *
+agentx_parse_header(netsnmp_pdu *pdu, u_char * data, size_t * length)
+{
+    register u_char *bufp = data;
+    size_t          payload;
+
+    if (*length < 20) {         /* Incomplete header */
+        return NULL;
+    }
+
+    DEBUGDUMPHEADER("recv", "AgentX Header");
+    DEBUGDUMPHEADER("recv", "Version");
+    DEBUGDUMPSETUP("recv", bufp, 1);
+    pdu->version = AGENTX_VERSION_BASE | *bufp;
+    DEBUGMSG(("dumpv_recv", "  Version:\t%d\n", *bufp));
+    DEBUGINDENTLESS();
+    bufp++;
+
+    DEBUGDUMPHEADER("recv", "Command");
+    DEBUGDUMPSETUP("recv", bufp, 1);
+    pdu->command = *bufp;
+    DEBUGMSG(("dumpv_recv", "  Command:\t%d (%s)\n", *bufp,
+              agentx_cmd(*bufp)));
+    DEBUGINDENTLESS();
+    bufp++;
+
+    DEBUGDUMPHEADER("recv", "Flags");
+    DEBUGDUMPSETUP("recv", bufp, 1);
+    pdu->flags |= *bufp;
+    DEBUGMSG(("dumpv_recv", "  Flags:\t0x%x\n", *bufp));
+    DEBUGINDENTLESS();
+    bufp++;
+
+    DEBUGDUMPHEADER("recv", "Reserved Byte");
+    DEBUGDUMPSETUP("recv", bufp, 1);
+    DEBUGMSG(("dumpv_recv", "  Reserved:\t0x%x\n", *bufp));
+    DEBUGINDENTLESS();
+    bufp++;
+
+    DEBUGDUMPHEADER("recv", "Session ID");
+    pdu->sessid = agentx_parse_int(bufp,
+                                   pdu->
+                                   flags &
+                                   AGENTX_FLAGS_NETWORK_BYTE_ORDER);
+    DEBUGINDENTLESS();
+    bufp += 4;
+
+    DEBUGDUMPHEADER("recv", "Transaction ID");
+    pdu->transid = agentx_parse_int(bufp,
+                                    pdu->
+                                    flags &
+                                    AGENTX_FLAGS_NETWORK_BYTE_ORDER);
+    DEBUGINDENTLESS();
+    bufp += 4;
+
+    DEBUGDUMPHEADER("recv", "Packet ID");
+    pdu->reqid = agentx_parse_int(bufp,
+                                  pdu->
+                                  flags & AGENTX_FLAGS_NETWORK_BYTE_ORDER);
+    DEBUGINDENTLESS();
+    bufp += 4;
+
+    DEBUGDUMPHEADER("recv", "Payload Length");
+    payload = agentx_parse_int(bufp,
+                               pdu->
+                               flags & AGENTX_FLAGS_NETWORK_BYTE_ORDER);
+    DEBUGINDENTLESS();
+    bufp += 4;
+
+    *length -= 20;
+    if (*length != payload) {   /* Short payload */
+        return NULL;
+    }
+    return bufp;
+}
+
+
+int
+agentx_parse(netsnmp_session * session, netsnmp_pdu *pdu, u_char * data,
+             size_t len)
+{
+    register u_char *bufp = data;
+    u_char          buffer[BUFSIZ];
+    u_char         *prefix_ptr;
+    oid             oid_buffer[MAX_OID_LEN], end_oid_buf[MAX_OID_LEN];
+    size_t          buf_len = BUFSIZ;
+    size_t          oid_buf_len = MAX_OID_LEN;
+    size_t          end_oid_buf_len = MAX_OID_LEN;
+
+    int             range_bound;        /* OID-range upper bound */
+    int             inc;        /* Inclusive SearchRange flag */
+    int             type;       /* VarBind data type */
+    size_t         *length = &len;
+
+    if (pdu == NULL) {
+        /*
+         * Dump the packet in a formatted style 
+         */
+        pdu = (netsnmp_pdu *) malloc(sizeof(netsnmp_pdu));
+        free(pdu);
+        return (0);
+    }
+    if (!IS_AGENTX_VERSION(session->version))
+        return SNMPERR_BAD_VERSION;
+
+#ifndef SNMPERR_INCOMPLETE_PACKET
+    /*
+     *  Ideally, "short" packets on stream connections should
+     *    be handled specially, and the driving code set up to
+     *    keep reading until the full packet is received.
+     *
+     *  For now, lets assume that all packets are read in one go.
+     *    I've probably inflicted enough damage on the UCD library
+     *    for one week!
+     *
+     *  I'll come back to this once Wes is speaking to me again.
+     */
+#define SNMPERR_INCOMPLETE_PACKET SNMPERR_ASN_PARSE_ERR
+#endif
+
+
+    /*
+     *  Handle (common) header ....
+     */
+    bufp = agentx_parse_header(pdu, bufp, length);
+    if (bufp == NULL)
+        return SNMPERR_INCOMPLETE_PACKET;       /* i.e. wait for the rest */
+
+    /*
+     * Control PDU handling 
+     */
+    pdu->flags |= UCD_MSG_FLAG_ALWAYS_IN_VIEW;
+    pdu->flags |= UCD_MSG_FLAG_FORCE_PDU_COPY;
+    pdu->flags &= (~UCD_MSG_FLAG_RESPONSE_PDU);
+
+    /*
+     *  ... and (not-un-common) context
+     */
+    if (pdu->flags & AGENTX_MSG_FLAG_NON_DEFAULT_CONTEXT) {
+        DEBUGDUMPHEADER("recv", "Context");
+        bufp = agentx_parse_string(bufp, length, buffer, &buf_len,
+                                   pdu->
+                                   flags &
+                                   AGENTX_FLAGS_NETWORK_BYTE_ORDER);
+        DEBUGINDENTLESS();
+        if (bufp == NULL)
+            return SNMPERR_ASN_PARSE_ERR;
+
+        pdu->community_len = buf_len;
+        snmp_clone_mem((void **) &pdu->community,
+                       (void *) buffer, (unsigned) buf_len);
+        buf_len = BUFSIZ;
+    }
+
+    DEBUGDUMPHEADER("recv", "PDU");
+    DEBUGINDENTMORE();
+    switch (pdu->command) {
+    case AGENTX_MSG_OPEN:
+        pdu->time = *bufp;      /* Timeout */
+        bufp += 4;
+        *length -= 4;
+
+        /*
+         * Store subagent OID & description in a VarBind 
+         */
+        DEBUGDUMPHEADER("recv", "Subagent OID");
+        bufp = agentx_parse_oid(bufp, length, NULL,
+                                oid_buffer, &oid_buf_len,
+                                pdu->
+                                flags & AGENTX_FLAGS_NETWORK_BYTE_ORDER);
+        DEBUGINDENTLESS();
+        if (bufp == NULL) {
+            DEBUGINDENTLESS();
+            return SNMPERR_ASN_PARSE_ERR;
+        }
+        DEBUGDUMPHEADER("recv", "Subagent Description");
+        bufp = agentx_parse_string(bufp, length, buffer, &buf_len,
+                                   pdu->
+                                   flags &
+                                   AGENTX_FLAGS_NETWORK_BYTE_ORDER);
+        DEBUGINDENTLESS();
+        if (bufp == NULL) {
+            DEBUGINDENTLESS();
+            return SNMPERR_ASN_PARSE_ERR;
+        }
+        snmp_pdu_add_variable(pdu, oid_buffer, oid_buf_len,
+                              ASN_OCTET_STR, buffer, buf_len);
+
+        oid_buf_len = MAX_OID_LEN;
+        buf_len = BUFSIZ;
+        break;
+
+    case AGENTX_MSG_CLOSE:
+        pdu->errstat = *bufp;   /* Reason */
+        bufp += 4;
+        *length -= 4;
+
+        break;
+
+    case AGENTX_MSG_UNREGISTER:
+    case AGENTX_MSG_REGISTER:
+        DEBUGDUMPHEADER("recv", "Registration Header");
+        if (pdu->command == AGENTX_MSG_REGISTER) {
+            pdu->time = *bufp;  /* Timeout (Register only) */
+            DEBUGDUMPSETUP("recv", bufp, 1);
+            DEBUGMSG(("dumpv_recv", "  Timeout:     \t%d\n", *bufp));
+        }
+        bufp++;
+        pdu->priority = *bufp;
+        DEBUGDUMPSETUP("recv", bufp, 1);
+        DEBUGMSG(("dumpv_recv", "  Priority:    \t%d\n", *bufp));
+        bufp++;
+        pdu->range_subid = *bufp;
+        DEBUGDUMPSETUP("recv", bufp, 1);
+        DEBUGMSG(("dumpv_recv", "  Range Sub-Id:\t%d\n", *bufp));
+        bufp++;
+        bufp++;
+        *length -= 4;
+        DEBUGINDENTLESS();
+
+        prefix_ptr = bufp + 1;
+        DEBUGDUMPHEADER("recv", "Registration OID");
+        bufp = agentx_parse_oid(bufp, length, NULL,
+                                oid_buffer, &oid_buf_len,
+                                pdu->
+                                flags & AGENTX_FLAGS_NETWORK_BYTE_ORDER);
+        DEBUGINDENTLESS();
+        if (bufp == NULL) {
+            DEBUGINDENTLESS();
+            return SNMPERR_ASN_PARSE_ERR;
+        }
+
+        if (pdu->range_subid) {
+            range_bound = agentx_parse_int(bufp,
+                                           pdu->
+                                           flags &
+                                           AGENTX_FLAGS_NETWORK_BYTE_ORDER);
+            bufp += 4;
+            *length -= 4;
+
+            /*
+             * Construct the end-OID.  
+             */
+            end_oid_buf_len = oid_buf_len * sizeof(oid);
+            memcpy(end_oid_buf, oid_buffer, end_oid_buf_len);
+            end_oid_buf[pdu->range_subid - 1] = range_bound;
+
+            snmp_pdu_add_variable(pdu, oid_buffer, oid_buf_len,
+                                  ASN_PRIV_INCL_RANGE,
+                                  (u_char *) end_oid_buf, end_oid_buf_len);
+        } else {
+            snmp_add_null_var(pdu, oid_buffer, oid_buf_len);
+        }
+
+        oid_buf_len = MAX_OID_LEN;
+        break;
+
+    case AGENTX_MSG_GETBULK:
+        DEBUGDUMPHEADER("recv", "Non-repeaters");
+        pdu->non_repeaters = agentx_parse_short(bufp,
+                                                pdu->
+                                                flags &
+                                                AGENTX_FLAGS_NETWORK_BYTE_ORDER);
+        DEBUGINDENTLESS();
+        DEBUGDUMPHEADER("recv", "Max-repeaters");
+        pdu->max_repetitions = agentx_parse_short(bufp + 2,
+                                                  pdu->
+                                                  flags &
+                                                  AGENTX_FLAGS_NETWORK_BYTE_ORDER);
+        DEBUGINDENTLESS();
+        bufp += 4;
+        *length -= 4;
+        /*
+         * Fallthrough - SearchRange handling is the same 
+         */
+
+    case AGENTX_MSG_GETNEXT:
+    case AGENTX_MSG_GET:
+
+        /*
+         * *  SearchRange List
+         * *  Keep going while we have data left
+         */
+        DEBUGDUMPHEADER("recv", "Search Range");
+        while (*length > 0) {
+            bufp = agentx_parse_oid(bufp, length, &inc,
+                                    oid_buffer, &oid_buf_len,
+                                    pdu->
+                                    flags &
+                                    AGENTX_FLAGS_NETWORK_BYTE_ORDER);
+            if (bufp == NULL) {
+                DEBUGINDENTLESS();
+                DEBUGINDENTLESS();
+                return SNMPERR_ASN_PARSE_ERR;
+            }
+            bufp = agentx_parse_oid(bufp, length, NULL,
+                                    end_oid_buf, &end_oid_buf_len,
+                                    pdu->
+                                    flags &
+                                    AGENTX_FLAGS_NETWORK_BYTE_ORDER);
+            if (bufp == NULL) {
+                DEBUGINDENTLESS();
+                DEBUGINDENTLESS();
+                return SNMPERR_ASN_PARSE_ERR;
+            }
+            end_oid_buf_len *= sizeof(oid);
+            /*
+             * 'agentx_parse_oid()' returns the number of sub_ids 
+             */
+
+            if (inc) {
+                snmp_pdu_add_variable(pdu, oid_buffer, oid_buf_len,
+                                      ASN_PRIV_INCL_RANGE,
+                                      (u_char *) end_oid_buf,
+                                      end_oid_buf_len);
+            } else {
+                snmp_pdu_add_variable(pdu, oid_buffer, oid_buf_len,
+                                      ASN_PRIV_EXCL_RANGE,
+                                      (u_char *) end_oid_buf,
+                                      end_oid_buf_len);
+            }
+        }
+
+        DEBUGINDENTLESS();
+        oid_buf_len = MAX_OID_LEN;
+        end_oid_buf_len = MAX_OID_LEN;
+        break;
+
+
+    case AGENTX_MSG_RESPONSE:
+
+        pdu->flags |= UCD_MSG_FLAG_RESPONSE_PDU;
+
+        /*
+         * sysUpTime 
+         */
+        pdu->time = agentx_parse_int(bufp,
+                                     pdu->
+                                     flags &
+                                     AGENTX_FLAGS_NETWORK_BYTE_ORDER);
+        bufp += 4;
+        *length -= 4;
+
+        pdu->errstat = agentx_parse_short(bufp,
+                                          pdu->
+                                          flags &
+                                          AGENTX_FLAGS_NETWORK_BYTE_ORDER);
+        pdu->errindex =
+            agentx_parse_short(bufp + 2,
+                               pdu->
+                               flags & AGENTX_FLAGS_NETWORK_BYTE_ORDER);
+        bufp += 4;
+        *length -= 4;
+        /*
+         * Fallthrough - VarBind handling is the same 
+         */
+
+    case AGENTX_MSG_INDEX_ALLOCATE:
+    case AGENTX_MSG_INDEX_DEALLOCATE:
+    case AGENTX_MSG_NOTIFY:
+    case AGENTX_MSG_TESTSET:
+
+        /*
+         * *  VarBind List
+         * *  Keep going while we have data left
+         */
+
+        DEBUGDUMPHEADER("recv", "VarBindList");
+        while (*length > 0) {
+            bufp = agentx_parse_varbind(bufp, length, &type,
+                                        oid_buffer, &oid_buf_len,
+                                        buffer, &buf_len,
+                                        pdu->
+                                        flags &
+                                        AGENTX_FLAGS_NETWORK_BYTE_ORDER);
+            if (bufp == NULL) {
+                DEBUGINDENTLESS();
+                DEBUGINDENTLESS();
+                return SNMPERR_ASN_PARSE_ERR;
+            }
+            snmp_pdu_add_variable(pdu, oid_buffer, oid_buf_len,
+                                  (u_char) type, buffer, buf_len);
+
+            oid_buf_len = MAX_OID_LEN;
+            buf_len = BUFSIZ;
+        }
+        DEBUGINDENTLESS();
+        break;
+
+    case AGENTX_MSG_COMMITSET:
+    case AGENTX_MSG_UNDOSET:
+    case AGENTX_MSG_CLEANUPSET:
+    case AGENTX_MSG_PING:
+
+        /*
+         * "Empty" packet 
+         */
+        break;
+
+
+    case AGENTX_MSG_ADD_AGENT_CAPS:
+        /*
+         * Store AgentCap OID & description in a VarBind 
+         */
+        bufp = agentx_parse_oid(bufp, length, NULL,
+                                oid_buffer, &oid_buf_len,
+                                pdu->
+                                flags & AGENTX_FLAGS_NETWORK_BYTE_ORDER);
+        if (bufp == NULL)
+            return SNMPERR_ASN_PARSE_ERR;
+        bufp = agentx_parse_string(bufp, length, buffer, &buf_len,
+                                   pdu->
+                                   flags &
+                                   AGENTX_FLAGS_NETWORK_BYTE_ORDER);
+        if (bufp == NULL)
+            return SNMPERR_ASN_PARSE_ERR;
+        snmp_pdu_add_variable(pdu, oid_buffer, oid_buf_len,
+                              ASN_OCTET_STR, buffer, buf_len);
+
+        oid_buf_len = MAX_OID_LEN;
+        buf_len = BUFSIZ;
+        break;
+
+    case AGENTX_MSG_REMOVE_AGENT_CAPS:
+        /*
+         * Store AgentCap OID & description in a VarBind 
+         */
+        bufp = agentx_parse_oid(bufp, length, NULL,
+                                oid_buffer, &oid_buf_len,
+                                pdu->
+                                flags & AGENTX_FLAGS_NETWORK_BYTE_ORDER);
+        if (bufp == NULL)
+            return SNMPERR_ASN_PARSE_ERR;
+        snmp_add_null_var(pdu, oid_buffer, oid_buf_len);
+
+        oid_buf_len = MAX_OID_LEN;
+        break;
+
+    default:
+        DEBUGINDENTLESS();
+        DEBUGINDENTLESS();
+        DEBUGMSGTL(("agentx", "Unrecognised PDU type: %d\n",
+                    pdu->command));
+        return SNMPERR_UNKNOWN_PDU;
+    }
+    DEBUGINDENTLESS();
+    DEBUGINDENTLESS();
+    DEBUGINDENTLESS();
+    return SNMP_ERR_NOERROR;
+}
+
+
+
+
+#ifdef TESTING
+
+testit(netsnmp_pdu *pdu1)
+{
+    char            packet1[BUFSIZ];
+    char            packet2[BUFSIZ];
+    int             len1, len2;
+    netsnmp_pdu     pdu2;
+    netsnmp_session sess;
+
+    memset(&pdu2, 0, sizeof(netsnmp_pdu));
+    memset(packet1, 0, BUFSIZ);
+    memset(packet2, 0, BUFSIZ);
+
+    /*
+     * Encode this into a "packet" 
+     */
+    len1 = BUFSIZ;
+    if (agentx_build(&sess, pdu1, packet1, &len1) < 0) {
+        DEBUGMSGTL(("agentx", "First build failed"));
+        exit(1);
+    }
+
+    DEBUGMSGTL(("agentx", "First build succeeded:\n"));
+    xdump(packet1, len1, "Ax1> ");
+
+    /*
+     * Unpack this into a PDU 
+     */
+    len2 = len1;
+    if (agentx_parse(&pdu2, packet1, &len2, (u_char **) NULL) < 0) {
+        DEBUGMSGTL(("agentx", "First parse failed\n"));
+        exit(1);
+    }
+    DEBUGMSGTL(("agentx", "First parse succeeded:\n"));
+    if (len2 != 0)
+        DEBUGMSGTL(("agentx",
+                    "Warning - parsed packet has %d bytes left\n", len2));
+
+    /*
+     * Encode this into another "packet" 
+     */
+    len2 = BUFSIZ;
+    if (agentx_build(&sess, &pdu2, packet2, &len2) < 0) {
+        DEBUGMSGTL(("agentx", "Second build failed\n"));
+        exit(1);
+    }
+
+    DEBUGMSGTL(("agentx", "Second build succeeded:\n"));
+    xdump(packet2, len2, "Ax2> ");
+
+    /*
+     * Compare the results 
+     */
+    if (len1 != len2) {
+        DEBUGMSGTL(("agentx",
+                    "Error: first build (%d) is different to second (%d)\n",
+                    len1, len2));
+        exit(1);
+    }
+    if (memcmp(packet1, packet2, len1) != 0) {
+        DEBUGMSGTL(("agentx",
+                    "Error: first build data is different to second\n"));
+        exit(1);
+    }
+
+    DEBUGMSGTL(("agentx", "OK\n"));
+}
+
+
+
+main()
+{
+    netsnmp_pdu     pdu1;
+    oid             oid_buf[] = { 1, 3, 6, 1, 2, 1, 10 };
+    oid             oid_buf2[] = { 1, 3, 6, 1, 2, 1, 20 };
+    oid             null_oid[] = { 0, 0 };
+    char           *string = "Example string";
+    char           *context = "LUCS";
+
+
+    /*
+     * Create an example AgentX pdu structure 
+     */
+
+    memset(&pdu1, 0, sizeof(netsnmp_pdu));
+    pdu1.command = AGENTX_MSG_TESTSET;
+    pdu1.flags = 0;
+    pdu1.sessid = 16;
+    pdu1.transid = 24;
+    pdu1.reqid = 132;
+
+    pdu1.time = 10;
+    pdu1.non_repeaters = 3;
+    pdu1.max_repetitions = 32;
+    pdu1.priority = 5;
+    pdu1.range_subid = 0;
+
+    snmp_pdu_add_variable(&pdu1, oid_buf, sizeof(oid_buf) / sizeof(oid),
+                          ASN_OBJECT_ID, (char *) oid_buf2,
+                          sizeof(oid_buf2));
+    snmp_pdu_add_variable(&pdu1, oid_buf, sizeof(oid_buf) / sizeof(oid),
+                          ASN_INTEGER, (char *) &pdu1.reqid,
+                          sizeof(pdu1.reqid));
+    snmp_pdu_add_variable(&pdu1, oid_buf, sizeof(oid_buf) / sizeof(oid),
+                          ASN_OCTET_STR, (char *) string, strlen(string));
+
+    printf("Test with non-network order.....\n");
+    testit(&pdu1);
+
+    printf("\nTest with network order.....\n");
+    pdu1.flags |= AGENTX_FLAGS_NETWORK_BYTE_ORDER;
+    testit(&pdu1);
+
+    pdu1.community = context;
+    pdu1.community_len = strlen(context);
+    pdu1.flags |= AGENTX_FLAGS_NON_DEFAULT_CONTEXT;
+    printf("Test with non-default context.....\n");
+    testit(&pdu1);
+
+
+}
+#endif
+
+/*
+ * returns the proper length of an incoming agentx packet. 
+ */
+/*
+ *    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ *    |   h.version   |    h.type     |    h.flags    |  <reserved>   |
+ *    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ *    |                          h.sessionID                          |
+ *    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ *    |                        h.transactionID                        |
+ *    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ *    |                          h.packetID                           |
+ *    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ *    |                        h.payload_length                       |
+ *    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ *    20 bytes in header
+ */
+
+int
+agentx_check_packet(u_char * packet, size_t packet_len)
+{
+
+    if (packet_len < 20)
+        return 0;               /* minimum header length == 20 */
+
+    return agentx_parse_int(packet + 16,
+                            *(packet +
+                              2) & AGENTX_FLAGS_NETWORK_BYTE_ORDER) + 20;
+}
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/agentx/protocol.h tomato121/release/src/router/snmp/agent/mibgroup/agentx/protocol.h
--- tomato/release/src/router/snmp/agent/mibgroup/agentx/protocol.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/agentx/protocol.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,110 @@
+#ifndef AGENTX_PROTOCOL_H
+#define AGENTX_PROTOCOL_H
+
+#ifdef __cplusplus
+extern          "C" {
+#endif
+    /*
+     *  Definitions for Agent Extensibility Protocol (RFC 2257)
+     *
+     */
+
+#define AGENTX_PORT	705
+#define AGENTX_SOCKET	"/var/agentx/master"
+
+    /*
+     * AgentX versions 
+     */
+    /*
+     * Use values distinct from those used to represent SNMP versions 
+     */
+
+#define AGENTX_VERSION_BASE	192     /* Binary: 11xxxxxx */
+#define AGENTX_VERSION_1	(AGENTX_VERSION_BASE | 0x1)
+
+#define IS_AGENTX_VERSION(v)	(((v)&AGENTX_VERSION_BASE) == AGENTX_VERSION_BASE)
+
+
+    /*
+     * PDU types in AgentX 
+     */
+#define AGENTX_MSG_OPEN       ((u_char)1)
+#define AGENTX_MSG_CLOSE      ((u_char)2)
+#define AGENTX_MSG_REGISTER   ((u_char)3)
+#define AGENTX_MSG_UNREGISTER ((u_char)4)
+#define AGENTX_MSG_GET        ((u_char)5)
+#define AGENTX_MSG_GETNEXT    ((u_char)6)
+#define AGENTX_MSG_GETBULK    ((u_char)7)
+#define AGENTX_MSG_TESTSET    ((u_char)8)
+#define AGENTX_MSG_COMMITSET  ((u_char)9)
+#define AGENTX_MSG_UNDOSET    ((u_char)10)
+#define AGENTX_MSG_CLEANUPSET ((u_char)11)
+#define AGENTX_MSG_NOTIFY     ((u_char)12)
+#define AGENTX_MSG_PING       ((u_char)13)
+#define AGENTX_MSG_INDEX_ALLOCATE    ((u_char)14)
+#define AGENTX_MSG_INDEX_DEALLOCATE  ((u_char)15)
+#define AGENTX_MSG_ADD_AGENT_CAPS    ((u_char)16)
+#define AGENTX_MSG_REMOVE_AGENT_CAPS ((u_char)17)
+#define AGENTX_MSG_RESPONSE    ((u_char)18)
+
+
+    /*
+     * Error codes from RFC 2257 
+     */
+#define AGENTX_ERR_OPEN_FAILED          (256)
+#define AGENTX_ERR_NOT_OPEN             (257)
+#define AGENTX_ERR_INDEX_WRONG_TYPE     (258)
+#define AGENTX_ERR_INDEX_ALREADY_ALLOCATED (259)
+#define AGENTX_ERR_INDEX_NONE_AVAILABLE (260)
+#define AGENTX_ERR_INDEX_NOT_ALLOCATED  (261)
+#define AGENTX_ERR_UNSUPPORTED_CONTEXT  (262)
+#define AGENTX_ERR_DUPLICATE_REGISTRATION (263)
+#define AGENTX_ERR_UNKNOWN_REGISTRATION (264)
+#define AGENTX_ERR_UNKNOWN_AGENTCAPS    (265)
+
+    /*
+     * added in 1999 revision 
+     */
+#define AGENTX_ERR_NOERROR		SNMP_ERR_NOERROR
+#define AGENTX_ERR_PARSE_FAILED         (266)
+#define AGENTX_ERR_REQUEST_DENIED       (267)
+#define AGENTX_ERR_PROCESSING_ERROR     (268)
+
+    /*
+     * Message processing models 
+     */
+#define AGENTX_MP_MODEL_AGENTXv1        (257)
+
+
+    /*
+     * PDU Flags - see also 'UCD_MSG_FLAG_xxx' in snmp.h 
+     */
+#define AGENTX_MSG_FLAG_INSTANCE_REGISTER     0x01
+#define AGENTX_MSG_FLAG_NEW_INSTANCE          0x02
+#define AGENTX_MSG_FLAG_ANY_INSTANCE          0x04
+#define AGENTX_MSG_FLAG_NON_DEFAULT_CONTEXT   0x08
+#define AGENTX_MSG_FLAG_NETWORK_BYTE_ORDER    0x10
+
+#define AGENTX_MSG_FLAGS_MASK                 0xff
+
+    /*
+     * Session Flags - see also 'UCD_FLAGS_xxx' in snmp.h 
+     */
+#define AGENTX_FLAGS_NETWORK_BYTE_ORDER       AGENTX_MSG_FLAG_NETWORK_BYTE_ORDER
+
+
+
+    int             agentx_build(netsnmp_session *, netsnmp_pdu *,
+                                 u_char *, size_t *);
+    int             agentx_realloc_build(netsnmp_session * session,
+                                         netsnmp_pdu *pdu, u_char ** buf,
+                                         size_t * buf_len,
+                                         size_t * out_len);
+    int             agentx_parse(netsnmp_session *, netsnmp_pdu *,
+                                 u_char *, size_t);
+    int             agentx_check_packet(u_char *, size_t);
+
+#ifdef __cplusplus
+}
+#endif
+#endif                          /* AGENTX_PROTOCOL_H */
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/agentx/subagent.c tomato121/release/src/router/snmp/agent/mibgroup/agentx/subagent.c
--- tomato/release/src/router/snmp/agent/mibgroup/agentx/subagent.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/agentx/subagent.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,893 @@
+/*
+ *  AgentX sub-agent
+ */
+#include <net-snmp/net-snmp-config.h>
+
+#include <sys/types.h>
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#if TIME_WITH_SYS_TIME
+# ifdef WIN32
+#  include <sys/timeb.h>
+# else
+#  include <sys/time.h>
+# endif
+# include <time.h>
+#else
+# if HAVE_SYS_TIME_H
+#  include <sys/time.h>
+# else
+#  include <time.h>
+# endif
+#endif
+#if HAVE_WINSOCK_H
+#include <winsock.h>
+#endif
+#if HAVE_SYS_SOCKET_H
+#include <sys/socket.h>
+#endif
+#if HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+#if HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+
+#if HAVE_DMALLOC_H
+#include <dmalloc.h>
+#endif
+
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include <net-snmp/library/snmp_assert.h>
+
+#include "snmpd.h"
+#include "agentx/protocol.h"
+#include "agentx/client.h"
+#include <net-snmp/agent/agent_callbacks.h>
+#include <net-snmp/agent/agent_trap.h>
+#ifdef USING_MIBII_SYSORTABLE_MODULE
+#include "mibII/sysORTable.h"
+#endif
+
+#include "subagent.h"
+
+static SNMPCallback subagent_register_ping_alarm;
+static SNMPAlarmCallback agentx_reopen_session;
+void            agentx_register_callbacks(netsnmp_session * s);
+void            agentx_unregister_callbacks(netsnmp_session * ss);
+int             handle_subagent_response(int op, netsnmp_session * session,
+                                         int reqid, netsnmp_pdu *pdu,
+                                         void *magic);
+int             handle_subagent_set_response(int op,
+                                             netsnmp_session * session,
+                                             int reqid, netsnmp_pdu *pdu,
+                                             void *magic);
+
+typedef struct _net_snmpsubagent_magic_s {
+    int             original_command;
+    netsnmp_session *session;
+    netsnmp_variable_list *ovars;
+} ns_subagent_magic;
+
+struct agent_netsnmp_set_info {
+    int             transID;
+    int             mode;
+    int             errstat;
+    time_t          uptime;
+    netsnmp_session *sess;
+    netsnmp_variable_list *var_list;
+
+    struct agent_netsnmp_set_info *next;
+};
+
+static struct agent_netsnmp_set_info *Sets = NULL;
+
+netsnmp_session *agentx_callback_sess = NULL;
+extern int      callback_master_num;
+
+void
+init_subagent(void)
+{
+    if (agentx_callback_sess == NULL) {
+        agentx_callback_sess = netsnmp_callback_open(callback_master_num,
+                                                     handle_subagent_response,
+                                                     NULL, NULL);
+        DEBUGMSGTL(("agentx/subagent", "init_subagent sess %08x\n",
+                    agentx_callback_sess));
+    }
+}
+
+
+struct agent_netsnmp_set_info *
+save_set_vars(netsnmp_session * ss, netsnmp_pdu *pdu)
+{
+    struct agent_netsnmp_set_info *ptr;
+    struct timeval  now;
+    extern struct timeval starttime;
+
+    ptr = (struct agent_netsnmp_set_info *)
+        malloc(sizeof(struct agent_netsnmp_set_info));
+    if (ptr == NULL)
+        return NULL;
+
+    /*
+     * Save the important information
+     */
+    ptr->transID = pdu->transid;
+    ptr->sess = ss;
+    ptr->mode = SNMP_MSG_INTERNAL_SET_RESERVE1;
+    gettimeofday(&now, NULL);
+    ptr->uptime = calculate_time_diff(&now, &starttime);
+
+    ptr->var_list = snmp_clone_varbind(pdu->variables);
+    if (ptr->var_list == NULL) {
+        free(ptr);
+        return NULL;
+    }
+
+    ptr->next = Sets;
+    Sets = ptr;
+
+    return ptr;
+}
+
+struct agent_netsnmp_set_info *
+restore_set_vars(netsnmp_session * sess, netsnmp_pdu *pdu)
+{
+    struct agent_netsnmp_set_info *ptr;
+
+    for (ptr = Sets; ptr != NULL; ptr = ptr->next)
+        if (ptr->sess == sess && ptr->transID == pdu->transid)
+            break;
+
+    if (ptr == NULL || ptr->var_list == NULL)
+        return NULL;
+
+    pdu->variables = snmp_clone_varbind(ptr->var_list);
+    if (pdu->variables == NULL)
+        return NULL;
+
+    return ptr;
+}
+
+
+void
+free_set_vars(netsnmp_session * ss, netsnmp_pdu *pdu)
+{
+    struct agent_netsnmp_set_info *ptr, *prev = NULL;
+
+    for (ptr = Sets; ptr != NULL; ptr = ptr->next) {
+        if (ptr->sess == ss && ptr->transID == pdu->transid) {
+            if (prev)
+                prev->next = ptr->next;
+            else
+                Sets = ptr->next;
+            snmp_free_varbind(ptr->var_list);
+            free(ptr);
+            return;
+        }
+        prev = ptr;
+    }
+}
+
+extern netsnmp_session *main_session;   /* from snmp_agent.c */
+
+int
+handle_agentx_packet(int operation, netsnmp_session * session, int reqid,
+                     netsnmp_pdu *pdu, void *magic)
+{
+    struct agent_netsnmp_set_info *asi = NULL;
+    snmp_callback   mycallback;
+    netsnmp_pdu    *internal_pdu = NULL;
+    void           *retmagic = NULL;
+    ns_subagent_magic *smagic = NULL;
+
+    if (operation == NETSNMP_CALLBACK_OP_DISCONNECT) {
+        int             period =
+            netsnmp_ds_get_int(NETSNMP_DS_APPLICATION_ID, NETSNMP_DS_AGENT_AGENTX_PING_INTERVAL);
+        DEBUGMSGTL(("agentx/subagent",
+                    "transport disconnect indication\n"));
+        /*
+         * Deregister the ping alarm, if any, and invalidate all other
+         * references to this session.  
+         */
+        if (session->securityModel != SNMP_DEFAULT_SECMODEL) {
+            snmp_alarm_unregister(session->securityModel);
+        }
+        snmp_call_callbacks(SNMP_CALLBACK_APPLICATION,
+                            SNMPD_CALLBACK_INDEX_STOP, (void *) session);
+        agentx_unregister_callbacks(session);
+        remove_trap_session(session);
+        register_mib_detach();
+        main_session = NULL;
+        if (period != 0) {
+            /*
+             * Pings are enabled, so periodically attempt to re-establish contact 
+             * with the master agent.  Don't worry about the handle,
+             * agentx_reopen_session unregisters itself if it succeeds in talking 
+             * to the master agent.  
+             */
+            snmp_alarm_register(period, SA_REPEAT, agentx_reopen_session,
+                                NULL);
+        }
+        return 0;
+    } else if (operation != NETSNMP_CALLBACK_OP_RECEIVED_MESSAGE) {
+        DEBUGMSGTL(("agentx/subagent", "unexpected callback op %d\n",
+                    operation));
+        return 1;
+    }
+
+    /*
+     * ok, we have a pdu from the net. Modify as needed 
+     */
+
+    DEBUGMSGTL(("agentx/subagent", "handling agentx request (req=0x%x,trans="
+                "0x%x,sess=0x%x)\n", pdu->reqid,pdu->transid, pdu->sessid));
+    pdu->version = AGENTX_VERSION_1;
+    pdu->flags |= UCD_MSG_FLAG_ALWAYS_IN_VIEW;
+
+    if (pdu->command == AGENTX_MSG_GET
+        || pdu->command == AGENTX_MSG_GETNEXT
+        || pdu->command == AGENTX_MSG_GETBULK) {
+        smagic =
+            (ns_subagent_magic *) calloc(1, sizeof(ns_subagent_magic));
+        if (smagic == NULL) {
+            DEBUGMSGTL(("agentx/subagent", "couldn't malloc() smagic\n"));
+            return 1;
+        }
+        smagic->original_command = pdu->command;
+        smagic->session = session;
+        smagic->ovars = NULL;
+        retmagic = (void *) smagic;
+    }
+
+    switch (pdu->command) {
+    case AGENTX_MSG_GET:
+        DEBUGMSGTL(("agentx/subagent", "  -> get\n"));
+        pdu->command = SNMP_MSG_GET;
+        mycallback = handle_subagent_response;
+        break;
+
+    case AGENTX_MSG_GETNEXT:
+        DEBUGMSGTL(("agentx/subagent", "  -> getnext\n"));
+        pdu->command = SNMP_MSG_GETNEXT;
+
+        /*
+         * We have to save a copy of the original variable list here because
+         * if the master agent has requested scoping for some of the varbinds
+         * that information is stored there.  
+         */
+
+        smagic->ovars = snmp_clone_varbind(pdu->variables);
+        DEBUGMSGTL(("agentx/subagent", "saved variables\n"));
+        mycallback = handle_subagent_response;
+        break;
+
+    case AGENTX_MSG_GETBULK:
+        /*
+         * WWWXXX 
+         */
+        DEBUGMSGTL(("agentx/subagent", "  -> getbulk\n"));
+        pdu->command = SNMP_MSG_GETBULK;
+
+        /*
+         * We have to save a copy of the original variable list here because
+         * if the master agent has requested scoping for some of the varbinds
+         * that information is stored there.  
+         */
+
+        smagic->ovars = snmp_clone_varbind(pdu->variables);
+        DEBUGMSGTL(("agentx/subagent", "saved variables at %p\n",
+                    smagic->ovars));
+        mycallback = handle_subagent_response;
+        break;
+
+    case AGENTX_MSG_RESPONSE:
+        DEBUGMSGTL(("agentx/subagent", "  -> response\n"));
+        return 1;
+
+    case AGENTX_MSG_TESTSET:
+        /*
+         * XXXWWW we have to map this twice to both RESERVE1 and RESERVE2 
+         */
+        DEBUGMSGTL(("agentx/subagent", "  -> testset\n"));
+        asi = save_set_vars(session, pdu);
+        if (asi == NULL) {
+            snmp_log(LOG_WARNING, "save_set_vars() failed\n");
+            return 1;
+        }
+        asi->mode = pdu->command = SNMP_MSG_INTERNAL_SET_RESERVE1;
+        mycallback = handle_subagent_set_response;
+        retmagic = asi;
+        break;
+
+    case AGENTX_MSG_COMMITSET:
+        DEBUGMSGTL(("agentx/subagent", "  -> commitset\n"));
+        asi = restore_set_vars(session, pdu);
+        if (asi == NULL) {
+            snmp_log(LOG_WARNING, "restore_set_vars() failed\n");
+            return 1;
+        }
+        if (asi->mode != SNMP_MSG_INTERNAL_SET_RESERVE2) {
+            snmp_log(LOG_WARNING,
+                     "dropping bad AgentX request (wrong mode %d)\n",
+                     asi->mode);
+            return 1;
+        }
+        asi->mode = pdu->command = SNMP_MSG_INTERNAL_SET_ACTION;
+        mycallback = handle_subagent_set_response;
+        retmagic = asi;
+        break;
+
+    case AGENTX_MSG_CLEANUPSET:
+        DEBUGMSGTL(("agentx/subagent", "  -> cleanupset\n"));
+        asi = restore_set_vars(session, pdu);
+        if (asi == NULL) {
+            snmp_log(LOG_WARNING, "restore_set_vars() failed\n");
+            return 1;
+        }
+        if (asi->mode == SNMP_MSG_INTERNAL_SET_RESERVE1 ||
+            asi->mode == SNMP_MSG_INTERNAL_SET_RESERVE2) {
+            asi->mode = pdu->command = SNMP_MSG_INTERNAL_SET_FREE;
+        } else if (asi->mode == SNMP_MSG_INTERNAL_SET_ACTION) {
+            asi->mode = pdu->command = SNMP_MSG_INTERNAL_SET_COMMIT;
+        } else {
+            snmp_log(LOG_WARNING,
+                     "dropping bad AgentX request (wrong mode %d)\n",
+                     asi->mode);
+            return 1;
+        }
+        mycallback = handle_subagent_set_response;
+        retmagic = asi;
+        break;
+
+    case AGENTX_MSG_UNDOSET:
+        DEBUGMSGTL(("agentx/subagent", "  -> undoset\n"));
+        asi = restore_set_vars(session, pdu);
+        if (asi == NULL) {
+            snmp_log(LOG_WARNING, "restore_set_vars() failed\n");
+            return 1;
+        }
+        asi->mode = pdu->command = SNMP_MSG_INTERNAL_SET_UNDO;
+        mycallback = handle_subagent_set_response;
+        retmagic = asi;
+        break;
+
+    default:
+        DEBUGMSGTL(("agentx/subagent", "  -> unknown command %d (%02x)\n",
+                    pdu->command, pdu->command));
+        return 0;
+    }
+
+    /*
+     * submit the pdu to the internal handler 
+     */
+
+    /*
+     * We have to clone the PDU here, because when we return from this
+     * callback, sess_process_packet will free(pdu), but this call also
+     * free()s its argument PDU.  
+     */
+
+    internal_pdu = snmp_clone_pdu(pdu);
+    snmp_async_send(agentx_callback_sess, internal_pdu, mycallback,
+                    retmagic);
+    return 1;
+}
+
+int
+handle_subagent_response(int op, netsnmp_session * session, int reqid,
+                         netsnmp_pdu *pdu, void *magic)
+{
+    ns_subagent_magic *smagic = (ns_subagent_magic *) magic;
+    netsnmp_variable_list *u = NULL, *v = NULL;
+    int             rc = 0;
+
+    if (op != NETSNMP_CALLBACK_OP_RECEIVED_MESSAGE || magic == NULL) {
+        return 1;
+    }
+
+    pdu = snmp_clone_pdu(pdu);
+    DEBUGMSGTL(("agentx/subagent",
+                "handling AgentX response (cmd 0x%02x orig_cmd 0x%02x)\n",
+                pdu->command, smagic->original_command));
+
+    if (pdu->command == SNMP_MSG_INTERNAL_SET_FREE ||
+        pdu->command == SNMP_MSG_INTERNAL_SET_UNDO ||
+        pdu->command == SNMP_MSG_INTERNAL_SET_COMMIT) {
+        free_set_vars(smagic->session, pdu);
+    }
+
+    if (smagic->original_command == AGENTX_MSG_GETNEXT) {
+        DEBUGMSGTL(("agentx/subgaent",
+                    "do getNext scope processing %p %p\n", smagic->ovars,
+                    pdu->variables));
+        for (u = smagic->ovars, v = pdu->variables; u != NULL && v != NULL;
+             u = u->next_variable, v = v->next_variable) {
+            if (snmp_oid_compare
+                (u->val.objid, u->val_len / sizeof(oid), nullOid,
+                 nullOidLen) != 0) {
+                /*
+                 * The master agent requested scoping for this variable.  
+                 */
+                rc = snmp_oid_compare(v->name, v->name_length,
+                                      u->val.objid,
+                                      u->val_len / sizeof(oid));
+                DEBUGMSGTL(("agentx/subagent", "result "));
+                DEBUGMSGOID(("agentx/subagent", v->name, v->name_length));
+                DEBUGMSG(("agentx/subagent", " scope to "));
+                DEBUGMSGOID(("agentx/subagent",
+                             u->val.objid, u->val_len / sizeof(oid)));
+                DEBUGMSG(("agentx/subagent", " result %d\n", rc));
+
+                if (rc >= 0) {
+                    /*
+                     * The varbind is out of scope.  From RFC2741, p. 66: "If
+                     * the subagent cannot locate an appropriate variable,
+                     * v.name is set to the starting OID, and the VarBind is
+                     * set to `endOfMibView'".  
+                     */
+                    snmp_set_var_objid(v, u->name, u->name_length);
+                    snmp_set_var_typed_value(v, SNMP_ENDOFMIBVIEW, 0, 0);
+                    DEBUGMSGTL(("agentx/subagent",
+                                "scope violation -- return endOfMibView\n"));
+                }
+            } else {
+                DEBUGMSGTL(("agentx/subagent", "unscoped var\n"));
+            }
+        }
+    }
+
+    /*
+     * XXXJBPN: similar for GETBULK but the varbinds can get re-ordered I
+     * think which makes it er more difficult.  
+     */
+
+    if (smagic->ovars != NULL) {
+        snmp_free_varbind(smagic->ovars);
+    }
+
+    pdu->command = AGENTX_MSG_RESPONSE;
+    pdu->version = smagic->session->version;
+
+    if (!snmp_send(smagic->session, pdu)) {
+        snmp_free_pdu(pdu);
+    }
+    DEBUGMSGTL(("agentx/subagent", "  FINISHED\n"));
+    free(smagic);
+    return 1;
+}
+
+int
+handle_subagent_set_response(int op, netsnmp_session * session, int reqid,
+                             netsnmp_pdu *pdu, void *magic)
+{
+    netsnmp_session *retsess;
+    struct agent_netsnmp_set_info *asi;
+
+    if (op != NETSNMP_CALLBACK_OP_RECEIVED_MESSAGE || magic == NULL) {
+        return 1;
+    }
+
+    DEBUGMSGTL(("agentx/subagent",
+                "handling agentx subagent set response (mode=%d,req=0x%x,"
+                "trans=0x%x,sess=0x%x)\n",
+                pdu->command, pdu->reqid,pdu->transid, pdu->sessid));
+    pdu = snmp_clone_pdu(pdu);
+
+    asi = (struct agent_netsnmp_set_info *) magic;
+    retsess = asi->sess;
+    asi->errstat = pdu->errstat;
+
+    if (asi->mode == SNMP_MSG_INTERNAL_SET_RESERVE1) {
+        /*
+         * reloop for RESERVE2 mode, an internal only agent mode 
+         */
+        /*
+         * XXX: check exception statuses of reserve1 first 
+         */
+        if (!pdu->errstat) {
+            asi->mode = pdu->command = SNMP_MSG_INTERNAL_SET_RESERVE2;
+            snmp_async_send(agentx_callback_sess, pdu,
+                            handle_subagent_set_response, asi);
+            DEBUGMSGTL(("agentx/subagent",
+                        "  going from RESERVE1 -> RESERVE2\n"));
+            return 1;
+        }
+    } else {
+        if (asi->mode == SNMP_MSG_INTERNAL_SET_FREE ||
+            asi->mode == SNMP_MSG_INTERNAL_SET_UNDO ||
+            asi->mode == SNMP_MSG_INTERNAL_SET_COMMIT) {
+            free_set_vars(retsess, pdu);
+        }
+        pdu->variables = NULL;  /* the variables were added by us */
+    }
+
+    netsnmp_assert(retsess != NULL);
+    pdu->command = AGENTX_MSG_RESPONSE;
+    pdu->version = retsess->version;
+
+    if (!snmp_send(retsess, pdu)) {
+        snmp_free_pdu(pdu);
+    }
+    DEBUGMSGTL(("agentx/subagent", "  FINISHED\n"));
+    return 1;
+}
+
+
+
+int
+agentx_registration_callback(int majorID, int minorID, void *serverarg,
+                             void *clientarg)
+{
+    struct register_parameters *reg_parms =
+        (struct register_parameters *) serverarg;
+    netsnmp_session *agentx_ss = (netsnmp_session *) clientarg;
+
+    if (minorID == SNMPD_CALLBACK_REGISTER_OID)
+        return agentx_register(agentx_ss,
+                               reg_parms->name, reg_parms->namelen,
+                               reg_parms->priority,
+                               reg_parms->range_subid,
+                               reg_parms->range_ubound, reg_parms->timeout,
+                               reg_parms->flags);
+    else
+        return agentx_unregister(agentx_ss,
+                                 reg_parms->name, reg_parms->namelen,
+                                 reg_parms->priority,
+                                 reg_parms->range_subid,
+                                 reg_parms->range_ubound);
+}
+
+
+#ifdef USING_MIBII_SYSORTABLE_MODULE
+int
+agentx_sysOR_callback(int majorID, int minorID, void *serverarg,
+                      void *clientarg)
+{
+    struct register_sysOR_parameters *reg_parms =
+        (struct register_sysOR_parameters *) serverarg;
+    netsnmp_session *agentx_ss = (netsnmp_session *) clientarg;
+
+    if (minorID == SNMPD_CALLBACK_REG_SYSOR)
+        return agentx_add_agentcaps(agentx_ss,
+                                    reg_parms->name, reg_parms->namelen,
+                                    reg_parms->descr);
+    else
+        return agentx_remove_agentcaps(agentx_ss,
+                                       reg_parms->name,
+                                       reg_parms->namelen);
+}
+#endif
+
+
+static int
+subagent_shutdown(int majorID, int minorID, void *serverarg, void *clientarg)
+{
+    netsnmp_session *thesession = (netsnmp_session *)clientarg;
+    DEBUGMSGTL(("agentx/subagent", "shutting down session....\n"));
+    if (thesession == NULL) {
+	DEBUGMSGTL(("agentx/subagent", "Empty session to shutdown\n"));
+	main_session = NULL;
+	return 0;
+    }
+    agentx_close_session(thesession, AGENTX_CLOSE_SHUTDOWN);
+    snmp_close(thesession);
+    main_session = NULL;
+    DEBUGMSGTL(("agentx/subagent", "shut down finished.\n"));
+    return 1;
+}
+
+
+
+/*
+ * Register all the "standard" AgentX callbacks for the given session.  
+ */
+
+void
+agentx_register_callbacks(netsnmp_session * s)
+{
+    DEBUGMSGTL(("agentx/subagent",
+                "registering callbacks for session %p\n", s));
+    snmp_register_callback(SNMP_CALLBACK_LIBRARY,
+                           SNMP_CALLBACK_POST_READ_CONFIG,
+                           subagent_register_ping_alarm, s);
+    snmp_register_callback(SNMP_CALLBACK_LIBRARY, SNMP_CALLBACK_SHUTDOWN,
+                           subagent_shutdown, s);
+    snmp_register_callback(SNMP_CALLBACK_APPLICATION,
+                           SNMPD_CALLBACK_REGISTER_OID,
+                           agentx_registration_callback, s);
+    snmp_register_callback(SNMP_CALLBACK_APPLICATION,
+                           SNMPD_CALLBACK_UNREGISTER_OID,
+                           agentx_registration_callback, s);
+#ifdef USING_MIBII_SYSORTABLE_MODULE
+    snmp_register_callback(SNMP_CALLBACK_APPLICATION,
+                           SNMPD_CALLBACK_REG_SYSOR,
+                           agentx_sysOR_callback, s);
+    snmp_register_callback(SNMP_CALLBACK_APPLICATION,
+                           SNMPD_CALLBACK_UNREG_SYSOR,
+                           agentx_sysOR_callback, s);
+#endif
+}
+
+/*
+ * Unregister all the callbacks associated with this session.  
+ */
+
+void
+agentx_unregister_callbacks(netsnmp_session * ss)
+{
+    DEBUGMSGTL(("agentx/subagent",
+                "unregistering callbacks for session %p\n", ss));
+    snmp_unregister_callback(SNMP_CALLBACK_LIBRARY,
+                             SNMP_CALLBACK_POST_READ_CONFIG,
+                             subagent_register_ping_alarm, ss, 1);
+    snmp_unregister_callback(SNMP_CALLBACK_LIBRARY, SNMP_CALLBACK_SHUTDOWN,
+                             subagent_shutdown, ss, 1);
+    snmp_unregister_callback(SNMP_CALLBACK_APPLICATION,
+                             SNMPD_CALLBACK_REGISTER_OID,
+                             agentx_registration_callback, ss, 1);
+    snmp_unregister_callback(SNMP_CALLBACK_APPLICATION,
+                             SNMPD_CALLBACK_UNREGISTER_OID,
+                             agentx_registration_callback, ss, 1);
+#ifdef USING_MIBII_SYSORTABLE_MODULE
+    snmp_unregister_callback(SNMP_CALLBACK_APPLICATION,
+                             SNMPD_CALLBACK_REG_SYSOR,
+                             agentx_sysOR_callback, ss, 1);
+    snmp_unregister_callback(SNMP_CALLBACK_APPLICATION,
+                             SNMPD_CALLBACK_UNREG_SYSOR,
+                             agentx_sysOR_callback, ss, 1);
+#endif
+
+}
+
+/*
+ * Open a session to the master agent.  
+ */
+int
+subagent_open_master_session(void)
+{
+    netsnmp_session sess;
+
+    DEBUGMSGTL(("agentx/subagent", "opening session...\n"));
+
+    if (main_session) {
+        snmp_log(LOG_WARNING,
+                 "AgentX session to master agent attempted to be re-opened.");
+        return -1;
+    }
+
+    snmp_sess_init(&sess);
+    sess.version = AGENTX_VERSION_1;
+    sess.retries = SNMP_DEFAULT_RETRIES;
+    sess.timeout = SNMP_DEFAULT_TIMEOUT;
+    sess.flags |= SNMP_FLAGS_STREAM_SOCKET;
+    if (netsnmp_ds_get_string(NETSNMP_DS_APPLICATION_ID, NETSNMP_DS_AGENT_X_SOCKET)) {
+        sess.peername =
+            netsnmp_ds_get_string(NETSNMP_DS_APPLICATION_ID, NETSNMP_DS_AGENT_X_SOCKET);
+    } else {
+        sess.peername = strdup(AGENTX_SOCKET);
+    }
+
+    sess.local_port = 0;        /* client */
+    sess.remote_port = AGENTX_PORT;     /* default port */
+    sess.callback = handle_agentx_packet;
+    sess.authenticator = NULL;
+    main_session = snmp_open_ex(&sess, NULL, agentx_parse, NULL, NULL,
+                                agentx_realloc_build, agentx_check_packet);
+
+    if (main_session == NULL) {
+        /*
+         * Diagnose snmp_open errors with the input
+         * netsnmp_session pointer.  
+         */
+        if (!netsnmp_ds_get_boolean(NETSNMP_DS_APPLICATION_ID, NETSNMP_DS_AGENT_NO_CONNECTION_WARNINGS)) {
+            if (!netsnmp_ds_get_boolean(NETSNMP_DS_APPLICATION_ID, NETSNMP_DS_AGENT_NO_ROOT_ACCESS)) {
+                netsnmp_sess_log_error(LOG_WARNING,
+                                       "Error: Failed to connect to the agentx master agent",
+                                       &sess);
+            } else {
+                snmp_sess_perror
+                    ("Error: Failed to connect to the agentx master agent",
+                     &sess);
+            }
+        }
+        return -1;
+    }
+
+    if (agentx_open_session(main_session) < 0) {
+        snmp_close(main_session);
+        main_session = NULL;
+        return -1;
+    }
+
+    if (add_trap_session(main_session, AGENTX_MSG_NOTIFY, 1,
+                         AGENTX_VERSION_1)) {
+        DEBUGMSGTL(("agentx/subagent", " trap session registered OK\n"));
+    } else {
+        DEBUGMSGTL(("agentx/subagent",
+                    "trap session registration failed\n"));
+        snmp_close(main_session);
+        main_session = NULL;
+        return -1;
+    }
+
+    agentx_register_callbacks(main_session);
+
+    snmp_call_callbacks(SNMP_CALLBACK_APPLICATION,
+                        SNMPD_CALLBACK_INDEX_START, (void *) main_session);
+
+    DEBUGMSGTL(("agentx/subagent", "opening session...  DONE (%p)\n",
+                main_session));
+
+    return 0;
+}
+
+/*
+ * returns non-zero on error 
+ */
+int
+subagent_pre_init(void)
+{
+    DEBUGMSGTL(("agentx/subagent", "initializing....\n"));
+
+    /*
+     * set up callbacks to initiate master agent pings for this session 
+     */
+    netsnmp_ds_register_config(ASN_INTEGER,
+                       netsnmp_ds_get_string(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_APPTYPE),
+                       "agentxPingInterval",
+                       NETSNMP_DS_APPLICATION_ID, NETSNMP_DS_AGENT_AGENTX_PING_INTERVAL);
+
+
+    if (netsnmp_ds_get_boolean(NETSNMP_DS_APPLICATION_ID, NETSNMP_DS_AGENT_ROLE) != SUB_AGENT) {
+        return 0;
+    }
+
+    /*
+     * if a valid ping interval has been defined, call agentx_reopen_session
+     * * to try to connect to master or setup a ping alarm if it couldn't
+     * * succeed 
+     */
+    if (netsnmp_ds_get_int(NETSNMP_DS_APPLICATION_ID, NETSNMP_DS_AGENT_AGENTX_PING_INTERVAL) > 0)
+        agentx_reopen_session(0, NULL);
+    else                        /* if no ping interval was set up, just try to connect once */
+        subagent_open_master_session();
+    if (!main_session)
+        return -1;
+
+    DEBUGMSGTL(("agentx/subagent", "initializing....  DONE\n"));
+
+    return 0;
+}
+
+
+/*
+ * Alarm callback function to open a session to the master agent.  If a
+ * transport disconnection callback occurs, indicating that the master agent
+ * has died (or there has been some strange communication problem), this
+ * alarm is called repeatedly to try to re-open the connection.  
+ */
+
+void
+agentx_reopen_session(unsigned int clientreg, void *clientarg)
+{
+    DEBUGMSGTL(("agentx/subagent", "agentx_reopen_session(%d) called\n",
+                clientreg));
+
+    if (subagent_open_master_session() == 0) {
+        /*
+         * Successful.  Delete the alarm handle if one exists.  
+         */
+        if (clientreg != 0) {
+            snmp_alarm_unregister(clientreg);
+        }
+
+        /*
+         * Reregister all our nodes.  
+         */
+        register_mib_reattach();
+
+        /*
+         * Register a ping alarm (if need be).  
+         */
+        subagent_register_ping_alarm(0, 0, 0, main_session);
+    } else {
+        if (clientreg == 0) {
+            /*
+             * Register a reattach alarm for later 
+             */
+            subagent_register_ping_alarm(0, 0, 0, main_session);
+        }
+    }
+}
+
+/*
+ * If a valid session is passed in (through clientarg), register a
+ * ping handler to ping it frequently, else register an attempt to try
+ * and open it again later. 
+ */
+
+static int
+subagent_register_ping_alarm(int majorID, int minorID,
+                             void *serverarg, void *clientarg)
+{
+
+    netsnmp_session *ss = (netsnmp_session *) clientarg;
+    int             ping_interval =
+        netsnmp_ds_get_int(NETSNMP_DS_APPLICATION_ID, NETSNMP_DS_AGENT_AGENTX_PING_INTERVAL);
+
+    if (!ping_interval)         /* don't do anything if not setup properly */
+        return 0;
+
+    /*
+     * register a ping alarm, if desired 
+     */
+    if (ss) {
+        if (ss->securityModel != SNMP_DEFAULT_SECMODEL) {
+            DEBUGMSGTL(("agentx/subagent",
+                        "unregister existing alarm %d\n",
+                        ss->securityModel));
+            snmp_alarm_unregister(ss->securityModel);
+        }
+
+        DEBUGMSGTL(("agentx/subagent",
+                    "register ping alarm every %d seconds\n",
+                    ping_interval));
+        /*
+         * we re-use the securityModel parameter for an alarm stash,
+         * since agentx doesn't need it 
+         */
+        ss->securityModel = snmp_alarm_register(ping_interval, SA_REPEAT,
+                                                agentx_check_session, ss);
+    } else {
+        /*
+         * attempt to open it later instead 
+         */
+        DEBUGMSGTL(("agentx/subagent",
+                    "subagent not properly attached, postponing registration till later....\n"));
+        snmp_alarm_register(ping_interval, SA_REPEAT,
+                            agentx_reopen_session, NULL);
+    }
+    return 0;
+}
+
+/*
+ * check a session validity for connectivity to the master agent.  If
+ * not functioning, close and start attempts to reopen the session 
+ */
+void
+agentx_check_session(unsigned int clientreg, void *clientarg)
+{
+    netsnmp_session *ss = (netsnmp_session *) clientarg;
+    if (!ss) {
+        if (clientreg)
+            snmp_alarm_unregister(clientreg);
+        return;
+    }
+    DEBUGMSGTL(("agentx/subagent", "checking status of session %p\n", ss));
+
+    if (!agentx_send_ping(ss)) {
+        snmp_log(LOG_WARNING,
+                 "AgentX master agent failed to respond to ping.  Attempting to re-register.\n");
+        /*
+         * master agent disappeared?  Try and re-register.
+         * close first, just to be sure .
+         */
+        agentx_unregister_callbacks(ss);
+        agentx_close_session(ss, AGENTX_CLOSE_TIMEOUT);
+        snmp_alarm_unregister(clientreg);       /* delete ping alarm timer */
+        snmp_call_callbacks(SNMP_CALLBACK_APPLICATION,
+                            SNMPD_CALLBACK_INDEX_STOP, (void *) ss);
+        snmp_close(main_session);
+        main_session = NULL;
+        agentx_reopen_session(0, NULL);
+    } else {
+        DEBUGMSGTL(("agentx/subagent", "session %p responded to ping\n",
+                    ss));
+    }
+}
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/agentx/subagent.h tomato121/release/src/router/snmp/agent/mibgroup/agentx/subagent.h
--- tomato/release/src/router/snmp/agent/mibgroup/agentx/subagent.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/agentx/subagent.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,18 @@
+#ifndef _AGENTX_SUBAGENT_H
+#define _AGENTX_SUBAGENT_H
+
+config_require(agentx/protocol)
+config_require(agentx/client)
+config_require(agentx/agentx_config)
+
+    void             init_subagent(void);
+     int             subagent_pre_init(void);
+     int             handle_agentx_packet(int, netsnmp_session *, int,
+                                          netsnmp_pdu *, void *);
+     SNMPCallback    agentx_register_callback;
+     SNMPCallback    agentx_unregister_callback;
+     SNMPAlarmCallback agentx_check_session;
+
+     extern netsnmp_session *agentx_session;
+
+#endif                          /* _AGENTX_SUBAGENT_H */
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/agentx.h tomato121/release/src/router/snmp/agent/mibgroup/agentx.h
--- tomato/release/src/router/snmp/agent/mibgroup/agentx.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/agentx.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,6 @@
+#ifndef _AGENTX_MIBGROUP_H
+#define _AGENTX_MIBGROUP_H
+
+config_require(agentx/master)
+config_require(agentx/subagent)
+#endif                          /* _AGENTX_MIBGROUP_H */
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/AVANTCOM-EXP-80211-MIB.txt tomato121/release/src/router/snmp/agent/mibgroup/AVANTCOM-EXP-80211-MIB.txt
--- tomato/release/src/router/snmp/agent/mibgroup/AVANTCOM-EXP-80211-MIB.txt	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/AVANTCOM-EXP-80211-MIB.txt	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,1088 @@
+-- **** Copyright (c) AvantCom Corporation 2003 - 2004 ***
+-- **** All rights reserved ***
+--  __________________________________________________________________
+--  |                                                                |
+--  |      Copyright (c) 2003 - 2004  -  AvantCom Corporation        |
+--  |                                                                |
+--  |    This material is the exclusive confidential property of     |
+--  |    AvantCom Corporation. All rights, including copyrights      |
+--  |    and patent rights, are reserved. No copies of any portion   |
+--  |    are to be made by any means without the express written     |
+--  |    permission of AvantCom Corporation.                         |
+--  |________________________________________________________________|
+-- 
+-- **********************************************************************
+-- *  File Name:           AVANTCOM-EXP-80211-MIB.txt
+-- *                                                                           
+-- *  Comments:                                                                
+-- *                                                                           
+-- *  Author:              Larry Simmons                                       
+-- *                       lsimmons@avantcom.com                               
+-- *                       www.avantcom.com                                    
+-- *                                                                           
+-- *  Creation Date:       09/24/03                                            
+-- *                                                                           
+-- *   Ver    Date   Inits Modification                                        
+-- *  ----- -------- ----- ------------                                        
+-- *  0.0.1 09/24/03  LRS  created                                             
+-- **********************************************************************
+-- **********************************************************************
+-- **********************************************************************
+-- * AvantCom 802.11 Management Information Base
+-- **********************************************************************
+AVANTCOM-EXP-80211-MIB DEFINITIONS ::= BEGIN
+
+-- IMPORTS
+--     experimental
+
+   IMPORTS
+        MODULE-IDENTITY, OBJECT-TYPE, 
+        NOTIFICATION-TYPE,Integer32, Counter32  FROM SNMPv2-SMI
+        DisplayString , MacAddress, RowStatus,
+        TruthValue                              FROM SNMPv2-TC
+        MODULE-COMPLIANCE, OBJECT-GROUP, 
+        NOTIFICATION-GROUP                      FROM SNMPv2-CONF 
+        ifIndex                                 FROM RFC1213-MIB;
+
+-- **********************************************************************
+-- *  MODULE IDENTITY
+-- **********************************************************************
+    avc802dot11 MODULE-IDENTITY
+    LAST-UPDATED "200309230000Z"
+    ORGANIZATION ""
+    CONTACT-INFO 
+           "Editor: Larry Simmons
+            Postal: AvantCom Corporation
+                    PO Box 1112
+                    Sandpoint, ID 83860 USA
+               Tel: +1 208 265 7878
+            E-mail: lsimmons@avantcom.com
+                    www.avantcom.com"
+    DESCRIPTION
+        "The MIB module for definition of AvantCom 802.11 entities.
+        iso(1).org(3).dod(6).internet(1).experimental(3).avantcom(14614)"
+--  ::= { 1 3 6 1 3 14614 }
+    ::= { iso org(3) dod(6) internet(1) experimental(3) avantcom(14614) }
+
+-- **********************************************************************
+-- *  Major sections
+-- **********************************************************************
+-- groups in AVANTCOM-EXP-80211
+
+avSystem            OBJECT IDENTIFIER ::= { avc802dot11 1 }
+
+avPrism             OBJECT IDENTIFIER ::= { avc802dot11 2 }
+prClient            OBJECT IDENTIFIER ::= { avPrism     1 }
+
+avAtheros           OBJECT IDENTIFIER ::= { avc802dot11 3 }
+athMac              OBJECT IDENTIFIER ::= { avAtheros   1 }
+athPhy              OBJECT IDENTIFIER ::= { avAtheros   2 }
+
+-- **********************************************************************
+-- **********************************************************************
+-- *   AvantCom 802.11 MIB System Group
+-- **********************************************************************
+-- **********************************************************************
+sysMIBVersion OBJECT-TYPE
+    SYNTAX DisplayString
+    MAX-ACCESS not-accessible
+    STATUS current
+    DESCRIPTION 
+            "Version number of this MIB file."
+    DEFVAL { "Version 0.0.2 - 09/25/2003" }
+    ::= {  avSystem 1 }
+
+sysExpectedMIBVersion OBJECT-TYPE
+    SYNTAX DisplayString
+    MAX-ACCESS read-only
+    STATUS current
+    DESCRIPTION 
+            "MIB version number expected by the AvantCom 802.11 
+             agent software. Be certain the version number reported
+             by this object matches the version number indicated
+             in the avSystem.sysMIBVersion object."
+    ::= {  avSystem 2 }
+
+sysAgentVersion OBJECT-TYPE
+    SYNTAX DisplayString
+    MAX-ACCESS read-only
+    STATUS current
+    DESCRIPTION 
+            "Version number of the AvantCom 802.11 agent
+             software."
+    ::= {  avSystem 3 }
+
+-- **********************************************************************
+-- *   
+-- *   Prism Information using HostAP
+-- *   
+-- **********************************************************************
+-- **********************************************************************
+-- *   
+-- *   Associated Client Information
+-- *   
+-- **********************************************************************
+-- **********************************************************************
+-- *   Associated Client Detailed Information
+-- **********************************************************************
+prAssociatedClientsTable OBJECT-TYPE
+    SYNTAX    SEQUENCE OF PrAcTableEntry
+    ACCESS    not-accessible
+    STATUS    mandatory
+    DESCRIPTION
+        "Associated clients detailed information table."
+    ::= { prClient 1 }
+
+prAcTableEntry OBJECT-TYPE
+    SYNTAX    PrAcTableEntry
+    ACCESS    not-accessible
+    STATUS    mandatory
+    DESCRIPTION 
+        "Associated clients detailed information table
+         entry."
+    INDEX    { ifIndex, prAcMacAddress }
+    ::= { prAssociatedClientsTable 1 }
+
+PrAcTableEntry ::=
+    SEQUENCE {
+        ifIndex             INTEGER,
+        prAcMacAddress      MacAddress,
+        prAcStationType     INTEGER,
+        prAcListenInterval  INTEGER,
+        prAcSupports1Mbps   TruthValue,
+        prAcSupports2Mbps   TruthValue,
+        prAcSupports5Mbps   TruthValue,
+        prAcSupports11Mbps  TruthValue,
+        prAcJiffies         Integer32,
+        prAcLastAuth        Integer32,
+        prAcLastAssoc       Integer32,
+        prAcLastRx          Integer32,
+        prAcLastTx          Integer32,
+        prAcRxPackets       Integer32,
+        prAcTxPackets       Integer32,
+        prAcRxBytes         Integer32,
+        prAcTxBytes         Integer32,
+        prAcBfrCnt          Integer32,
+        prAcLastRxSilence   INTEGER,
+        prAcLastRxSignal    INTEGER,
+        prAcLastRxRate      INTEGER,
+        prAcLastRxFlow      INTEGER,
+        prAcTxRate          INTEGER,
+        prAcTx1Mbps         Integer32,
+        prAcTx2Mbps         Integer32,
+        prAcTx5Mbps         Integer32,
+        prAcTx11Mbps        Integer32,
+        prAcRx1Mbps         Integer32,
+        prAcRx2Mbps         Integer32,
+        prAcRx5Mbps         Integer32,
+        prAcRx11Mbps        Integer32
+    }
+
+prAcMacAddress OBJECT-TYPE
+    SYNTAX  MacAddress
+    ACCESS  read-only
+    STATUS  current
+    DESCRIPTION
+        "MAC address of the associated client."
+    ::= { prAcTableEntry 1 }
+    
+prAcStationType OBJECT-TYPE
+    SYNTAX INTEGER {sta(1), ap(2)}
+    ACCESS  read-only
+    STATUS  current
+    DESCRIPTION
+            "Station type, AP or STA. If the wireless adapter
+             is operating as a client rather than an AP, this
+             value will indicate an association with an AP
+             station type."
+    ::= { prAcTableEntry  2 }
+    
+prAcListenInterval OBJECT-TYPE
+    SYNTAX  INTEGER
+    ACCESS  read-only
+    STATUS  current
+    DESCRIPTION
+            "Frequency, in milliseconds, the station
+             listens to Beacon frames to monitor the
+             Traffic Indication Map (TIM)."
+    ::= { prAcTableEntry  3 }
+
+prAcSupports1Mbps OBJECT-TYPE
+    SYNTAX  TruthValue
+    ACCESS  read-only
+    STATUS  current
+    DESCRIPTION
+            "Indicates whether or not the station supports
+             a transfer rate of 1 Mbps."
+    ::= { prAcTableEntry  4 }
+
+prAcSupports2Mbps OBJECT-TYPE
+    SYNTAX  TruthValue
+    ACCESS  read-only
+    STATUS  current
+    DESCRIPTION
+            "Indicates whether or not the station supports
+             a transfer rate of 2 Mbps."
+    ::= { prAcTableEntry  5 }
+
+prAcSupports5Mbps OBJECT-TYPE
+    SYNTAX  TruthValue
+    ACCESS  read-only
+    STATUS  current
+    DESCRIPTION
+            "Indicates whether or not the station supports
+             a transfer rate of 5.5 Mbps."
+    ::= { prAcTableEntry  6 }
+
+prAcSupports11Mbps OBJECT-TYPE
+    SYNTAX  TruthValue
+    ACCESS  read-only
+    STATUS  current
+    DESCRIPTION
+            "Indicates whether or not the station supports
+             a transfer rate of 11 Mbps."
+    ::= { prAcTableEntry  7 }
+
+prAcJiffies OBJECT-TYPE
+    SYNTAX  Integer32
+    ACCESS  read-only
+    STATUS  current
+    DESCRIPTION
+            "Current tick value."
+    ::= { prAcTableEntry  8 }
+
+prAcLastAuth OBJECT-TYPE
+    SYNTAX  Integer32
+    ACCESS  read-only
+    STATUS  current
+    DESCRIPTION
+            "Tick value at last authentication."
+    ::= { prAcTableEntry  9 }
+
+prAcLastAssoc OBJECT-TYPE
+    SYNTAX  Integer32
+    ACCESS  read-only
+    STATUS  current
+    DESCRIPTION
+            "Tick value at last association."
+    ::= { prAcTableEntry  10 }
+
+prAcLastRx OBJECT-TYPE
+    SYNTAX  Integer32
+    ACCESS  read-only
+    STATUS  current
+    DESCRIPTION
+            "Tick value at last receive."
+    ::= { prAcTableEntry  11 }
+
+prAcLastTx OBJECT-TYPE
+    SYNTAX  Integer32
+    ACCESS  read-only
+    STATUS  current
+    DESCRIPTION
+            "Tick value at last transmit."
+    ::= { prAcTableEntry  12 }
+
+prAcRxPackets OBJECT-TYPE
+    SYNTAX  Integer32
+    ACCESS  read-only
+    STATUS  current
+    DESCRIPTION
+            "Number of packets received from station."
+    ::= { prAcTableEntry  13 }
+
+prAcTxPackets OBJECT-TYPE
+    SYNTAX  Integer32
+    ACCESS  read-only
+    STATUS  current
+    DESCRIPTION
+            "Number of packets transmitted to station."
+    ::= { prAcTableEntry  14 }
+
+prAcRxBytes OBJECT-TYPE
+    SYNTAX  Integer32
+    ACCESS  read-only
+    STATUS  current
+    DESCRIPTION
+            "Number of bytes received from station."
+    ::= { prAcTableEntry  15 }
+
+prAcTxBytes OBJECT-TYPE
+    SYNTAX  Integer32
+    ACCESS  read-only
+    STATUS  current
+    DESCRIPTION
+            "Number of bytes transmitted to station."
+    ::= { prAcTableEntry  16 }
+
+prAcBfrCnt OBJECT-TYPE
+    SYNTAX  Integer32
+    ACCESS  read-only
+    STATUS  current
+    DESCRIPTION
+            ""
+    ::= { prAcTableEntry  17 }
+
+prAcLastRxSilence OBJECT-TYPE
+    SYNTAX  INTEGER
+    ACCESS  read-only
+    STATUS  current
+    DESCRIPTION
+            ""
+    ::= { prAcTableEntry  18 }
+
+prAcLastRxSignal OBJECT-TYPE
+    SYNTAX  INTEGER
+    ACCESS  read-only
+    STATUS  current
+    DESCRIPTION
+            ""
+    ::= { prAcTableEntry  19 }
+
+prAcLastRxRate OBJECT-TYPE
+    SYNTAX  INTEGER
+    ACCESS  read-only
+    STATUS  current
+    DESCRIPTION
+            ""
+    ::= { prAcTableEntry  20 }
+
+prAcLastRxFlow OBJECT-TYPE
+    SYNTAX  INTEGER
+    ACCESS  read-only
+    STATUS  current
+    DESCRIPTION
+            ""
+    ::= { prAcTableEntry  21 }
+
+prAcTxRate OBJECT-TYPE
+    SYNTAX  INTEGER
+    ACCESS  read-only
+    STATUS  current
+    DESCRIPTION
+            ""
+    ::= { prAcTableEntry  22 }
+
+prAcTx1Mbps OBJECT-TYPE
+    SYNTAX  Integer32
+    ACCESS  read-only
+    STATUS  current
+    DESCRIPTION
+            "Number of packets transmitted to station 
+             at 1 Mbps."
+    ::= { prAcTableEntry  23 }
+
+prAcTx2Mbps OBJECT-TYPE
+    SYNTAX  Integer32
+    ACCESS  read-only
+    STATUS  current
+    DESCRIPTION
+            "Number of packets transmitted to station 
+             at 2 Mbps."
+    ::= { prAcTableEntry  24 }
+
+prAcTx5Mbps OBJECT-TYPE
+    SYNTAX  Integer32
+    ACCESS  read-only
+    STATUS  current
+    DESCRIPTION
+            "Number of packets transmitted to station 
+             at 5.5 Mbps."
+    ::= { prAcTableEntry  25 }
+
+prAcTx11Mbps OBJECT-TYPE
+    SYNTAX  Integer32
+    ACCESS  read-only
+    STATUS  current
+    DESCRIPTION
+            "Number of packets transmitted to station 
+             at 11 Mbps."
+    ::= { prAcTableEntry  26 }
+
+prAcRx1Mbps OBJECT-TYPE
+    SYNTAX  Integer32
+    ACCESS  read-only
+    STATUS  current
+    DESCRIPTION
+            "Number of packets recevied from station 
+             at 1 Mbps."
+    ::= { prAcTableEntry  27 }
+
+prAcRx2Mbps OBJECT-TYPE
+    SYNTAX  Integer32
+    ACCESS  read-only
+    STATUS  current
+    DESCRIPTION
+            "Number of packets recevied from station 
+             at 2 Mbps."
+    ::= { prAcTableEntry  28 }
+
+prAcRx5Mbps OBJECT-TYPE
+    SYNTAX  Integer32
+    ACCESS  read-only
+    STATUS  current
+    DESCRIPTION
+            "Number of packets recevied from station 
+             at 5.5 Mbps."
+    ::= { prAcTableEntry  29 }
+
+prAcRx11Mbps OBJECT-TYPE
+    SYNTAX  Integer32
+    ACCESS  read-only
+    STATUS  current
+    DESCRIPTION
+            "Number of packets recevied from station 
+             at 11 Mbps."
+    ::= { prAcTableEntry  30 }
+
+-- **********************************************************************
+-- *   
+-- *   Atheros Information using MadWiFi Driver
+-- *   
+-- **********************************************************************
+-- **********************************************************************
+-- *   
+-- *   MAC Information
+-- *   
+-- **********************************************************************
+-- **********************************************************************
+-- *   MAC Counters
+-- **********************************************************************
+athMacCountersTable OBJECT-TYPE
+    SYNTAX    SEQUENCE OF AmcTableEntry
+    ACCESS    not-accessible
+    STATUS    mandatory
+    DESCRIPTION
+        "MAC counters table."
+    ::= { athMac 1 }
+
+amcTableEntry OBJECT-TYPE
+    SYNTAX    AmcTableEntry
+    ACCESS    not-accessible
+    STATUS    mandatory
+    DESCRIPTION 
+        "MAC counters detailed information table
+         entry."
+    INDEX    { ifIndex }
+    ::= { athMacCountersTable 1 }
+
+AmcTableEntry ::=
+    SEQUENCE {
+        ifIndex               INTEGER,
+        amcWatchDog           Integer32,
+        amcFatalHwInterrupt   Integer32,
+        amcMissedBeacons      Integer32,
+        amcRxOverRun          Integer32,
+        amcRxEol              Integer32,
+        amcTxUnderRun         Integer32,
+        amcTxMgmtFrames       Integer32,
+        amcTxDiscards         Integer32,
+        amcTxInvalid          Integer32,
+        amcTxQueueStopped     Integer32,
+        amcTxEncapFailed      Integer32,
+        amcTxNoNode           Integer32,
+        amcTxNoDataBuffer     Integer32,
+        amcTxNoMgmtBuffer     Integer32,
+        amcTxExcessiveRetries Integer32,
+        amcTxFifoUnderRun     Integer32,
+        amcTxFiltered         Integer32,
+        amcTxShortRetries     Integer32,
+        amcTxLongRetries      Integer32,
+        amcTxBadRate          Integer32,
+        amcTxNoAck            Integer32,
+        amcTxRts              Integer32,
+        amcTxCts              Integer32,
+        amcTxShortPreamble    Integer32,
+        amcTxRssi             INTEGER,
+        amcTxRssiDelta        INTEGER,
+        amcRxDescOverRun      Integer32,
+        amcRxFrameTooShort    Integer32,
+        amcRxCrcError         Integer32,
+        amcRxFifoOverRun      Integer32,
+        amcRxCryptFailure     Integer32,
+        amcRxNoSkBuffer       Integer32,
+        amcRxRssi             INTEGER,
+        amcRxRssiDelta        INTEGER,
+        amcNoBeaconBuffer     Integer32,
+        amcCalibrations       Integer32,
+        amcFailedCalibrations Integer32,
+        amcRfGainResets       Integer32,
+        amcRateControlChecks  Integer32,
+        amcRateControlRaise   Integer32,
+        amcRateControlDrop    Integer32
+    }
+
+amcWatchDog OBJECT-TYPE
+    SYNTAX  Integer32
+    ACCESS  read-only
+    STATUS  current
+    DESCRIPTION
+            "Number of times the device was reset
+             by watchdog."
+    ::= { amcTableEntry  1 }
+
+amcFatalHwInterrupt OBJECT-TYPE
+    SYNTAX  Integer32
+    ACCESS  read-only
+    STATUS  current
+    DESCRIPTION
+            "Number of times there was a fatal
+             hardware interrupt."
+    ::= { amcTableEntry  2 }
+
+amcMissedBeacons OBJECT-TYPE
+    SYNTAX  Integer32
+    ACCESS  read-only
+    STATUS  current
+    DESCRIPTION
+            "Number of missed beacons."
+    ::= { amcTableEntry  3 }
+
+amcRxOverRun OBJECT-TYPE
+    SYNTAX  Integer32
+    ACCESS  read-only
+    STATUS  current
+    DESCRIPTION
+            "Number of receive overrun interrupts."
+    ::= { amcTableEntry  4 }
+
+amcRxEol OBJECT-TYPE
+    SYNTAX  Integer32
+    ACCESS  read-only
+    STATUS  current
+    DESCRIPTION
+            "Number of receive EOL interrupts."
+    ::= { amcTableEntry  5 }
+
+amcTxUnderRun OBJECT-TYPE
+    SYNTAX  Integer32
+    ACCESS  read-only
+    STATUS  current
+    DESCRIPTION
+            "Number of transmit underrun interrupts."
+    ::= { amcTableEntry  6 }
+
+amcTxMgmtFrames OBJECT-TYPE
+    SYNTAX  Integer32
+    ACCESS  read-only
+    STATUS  current
+    DESCRIPTION
+            "Number of managment frames transmitted."
+    ::= { amcTableEntry  7 }
+
+amcTxDiscards OBJECT-TYPE
+    SYNTAX  Integer32
+    ACCESS  read-only
+    STATUS  current
+    DESCRIPTION
+            "Number of frames discarded prior to association."
+    ::= { amcTableEntry  8 }
+    
+amcTxInvalid OBJECT-TYPE
+    SYNTAX  Integer32
+    ACCESS  read-only
+    STATUS  current
+    DESCRIPTION
+            "Number of frames discarded because device was gone."
+    ::= { amcTableEntry  9 }
+
+amcTxQueueStopped OBJECT-TYPE
+    SYNTAX  Integer32
+    ACCESS  read-only
+    STATUS  current
+    DESCRIPTION
+            "Number of times queuing stopped because the 
+             TX queue was full."
+    ::= { amcTableEntry  10 }
+
+amcTxEncapFailed OBJECT-TYPE
+    SYNTAX  Integer32
+    ACCESS  read-only
+    STATUS  current
+    DESCRIPTION
+            "Number of times TX encapsulation failed."
+    ::= { amcTableEntry  11 }
+    
+amcTxNoNode OBJECT-TYPE
+    SYNTAX  Integer32
+    ACCESS  read-only
+    STATUS  current
+    DESCRIPTION
+            "Number of times TX failed because the node
+             was missing."
+    ::= { amcTableEntry  12 }
+
+amcTxNoDataBuffer OBJECT-TYPE
+    SYNTAX  Integer32
+    ACCESS  read-only
+    STATUS  current
+    DESCRIPTION
+            "Number of times TX failed because there was
+             no data buffer available."
+    ::= { amcTableEntry  13 }
+
+amcTxNoMgmtBuffer OBJECT-TYPE
+    SYNTAX  Integer32
+    ACCESS  read-only
+    STATUS  current
+    DESCRIPTION
+            "Number of times TX failed because there was
+             no management buffer available."
+    ::= { amcTableEntry  14 }
+
+amcTxExcessiveRetries OBJECT-TYPE
+    SYNTAX  Integer32
+    ACCESS  read-only
+    STATUS  current
+    DESCRIPTION
+            "Number of times TX failed because there were
+             excessive retries."
+    ::= { amcTableEntry  15 }
+
+amcTxFifoUnderRun OBJECT-TYPE
+    SYNTAX  Integer32
+    ACCESS  read-only
+    STATUS  current
+    DESCRIPTION
+            "Number of times TX failed because there was
+             a FIFO underrun."
+    ::= { amcTableEntry  16 }
+
+amcTxFiltered OBJECT-TYPE
+    SYNTAX  Integer32
+    ACCESS  read-only
+    STATUS  current
+    DESCRIPTION
+            "Number of times TX failed because the
+             transmission was filtered."
+    ::= { amcTableEntry  17 }
+
+amcTxShortRetries OBJECT-TYPE
+    SYNTAX  Integer32
+    ACCESS  read-only
+    STATUS  current
+    DESCRIPTION
+            "Number of on-chip TX short retries."
+    ::= { amcTableEntry  18 }
+
+amcTxLongRetries OBJECT-TYPE
+    SYNTAX  Integer32
+    ACCESS  read-only
+    STATUS  current
+    DESCRIPTION
+            "Number of on-chip TX long retries."
+    ::= { amcTableEntry  19 }
+
+amcTxBadRate OBJECT-TYPE
+    SYNTAX  Integer32
+    ACCESS  read-only
+    STATUS  current
+    DESCRIPTION
+            "Number of times TX failed because the
+             transit rate was invalid."
+    ::= { amcTableEntry  20 }
+
+amcTxNoAck OBJECT-TYPE
+    SYNTAX  Integer32
+    ACCESS  read-only
+    STATUS  current
+    DESCRIPTION
+            "Number of tranmitted frames with no ACK marked."
+    ::= { amcTableEntry  21 }
+
+amcTxRts OBJECT-TYPE
+    SYNTAX  Integer32
+    ACCESS  read-only
+    STATUS  current
+    DESCRIPTION
+            "Number of tranmitted frames with RTS enabled."
+    ::= { amcTableEntry  22 }
+
+amcTxCts OBJECT-TYPE
+    SYNTAX  Integer32
+    ACCESS  read-only
+    STATUS  current
+    DESCRIPTION
+            "Number of tranmitted frames with CTS enabled."
+    ::= { amcTableEntry  23 }
+
+amcTxShortPreamble OBJECT-TYPE
+    SYNTAX  Integer32
+    ACCESS  read-only
+    STATUS  current
+    DESCRIPTION
+            "Number of times TX failed because the
+             preamble was too short."
+    ::= { amcTableEntry  24 }
+
+amcTxRssi OBJECT-TYPE
+    SYNTAX  INTEGER
+    ACCESS  read-only
+    STATUS  current
+    DESCRIPTION
+            "RSSI of last tranmitted ACK."
+    ::= { amcTableEntry  25 }
+
+amcTxRssiDelta OBJECT-TYPE
+    SYNTAX  INTEGER
+    ACCESS  read-only
+    STATUS  current
+    DESCRIPTION
+            "Change in RSSI from prior amcTxRssi."
+    ::= { amcTableEntry  26 }
+
+amcRxDescOverRun OBJECT-TYPE
+    SYNTAX  Integer32
+    ACCESS  read-only
+    STATUS  current
+    DESCRIPTION
+            "Number of receive descriptor overruns."
+    ::= { amcTableEntry  27 }
+
+amcRxFrameTooShort OBJECT-TYPE
+    SYNTAX  Integer32
+    ACCESS  read-only
+    STATUS  current
+    DESCRIPTION
+            "Number of receive failures becuase the frame
+             was too short."
+    ::= { amcTableEntry  28 }
+
+amcRxCrcError OBJECT-TYPE
+    SYNTAX  Integer32
+    ACCESS  read-only
+    STATUS  current
+    DESCRIPTION
+            "Number of receive failures becuase the CRC
+             was bad."
+    ::= { amcTableEntry  29 }
+
+amcRxFifoOverRun OBJECT-TYPE
+    SYNTAX  Integer32
+    ACCESS  read-only
+    STATUS  current
+    DESCRIPTION
+            "Number of receive failures becuase of a
+             FIFO overrun."
+    ::= { amcTableEntry  30 }
+
+amcRxCryptFailure OBJECT-TYPE
+    SYNTAX  Integer32
+    ACCESS  read-only
+    STATUS  current
+    DESCRIPTION
+            "Number of receive failures becuase of a
+             decryption failure."
+    ::= { amcTableEntry  31 }
+
+amcRxNoSkBuffer OBJECT-TYPE
+    SYNTAX  Integer32
+    ACCESS  read-only
+    STATUS  current
+    DESCRIPTION
+            "Number of receive failures becuase there
+             was no skbuff available."
+    ::= { amcTableEntry  32 }
+
+amcRxRssi OBJECT-TYPE
+    SYNTAX  INTEGER
+    ACCESS  read-only
+    STATUS  current
+    DESCRIPTION
+            "RSSI of last received frame."
+    ::= { amcTableEntry  33 }
+
+amcRxRssiDelta OBJECT-TYPE
+    SYNTAX  INTEGER
+    ACCESS  read-only
+    STATUS  current
+    DESCRIPTION
+            "Change in RSSI from prior amcRxRssi."
+    ::= { amcTableEntry  34 }
+
+amcNoBeaconBuffer OBJECT-TYPE
+    SYNTAX  Integer32
+    ACCESS  read-only
+    STATUS  current
+    DESCRIPTION
+            "Number of times there was no skbuff available
+             for a beacon."
+    ::= { amcTableEntry  35 }
+
+amcCalibrations OBJECT-TYPE
+    SYNTAX  Integer32
+    ACCESS  read-only
+    STATUS  current
+    DESCRIPTION
+            "Number of times a periodic calibration occurred."
+    ::= { amcTableEntry  36 }
+
+amcFailedCalibrations OBJECT-TYPE
+    SYNTAX  Integer32
+    ACCESS  read-only
+    STATUS  current
+    DESCRIPTION
+            "Number of times a periodic calibration failed."
+    ::= { amcTableEntry  37 }
+
+amcRfGainResets OBJECT-TYPE
+    SYNTAX  Integer32
+    ACCESS  read-only
+    STATUS  current
+    DESCRIPTION
+            "Number of periodic calibration RF gain resets."
+    ::= { amcTableEntry  38 }
+
+amcRateControlChecks OBJECT-TYPE
+    SYNTAX  Integer32
+    ACCESS  read-only
+    STATUS  current
+    DESCRIPTION
+            "Number of rate control checks."
+    ::= { amcTableEntry  39 }
+
+amcRateControlRaise OBJECT-TYPE
+    SYNTAX  Integer32
+    ACCESS  read-only
+    STATUS  current
+    DESCRIPTION
+            "Number of rate control raised the transmit rate."
+    ::= { amcTableEntry  40 }
+
+amcRateControlDrop OBJECT-TYPE
+    SYNTAX  Integer32
+    ACCESS  read-only
+    STATUS  current
+    DESCRIPTION
+            "Number of rate control dropped the transmit rate."
+    ::= { amcTableEntry  41 }
+
+-- **********************************************************************
+-- *   
+-- *   PHY Information
+-- *   
+-- **********************************************************************
+-- **********************************************************************
+-- *   PHY Counters
+-- **********************************************************************
+athPhyCountersTable OBJECT-TYPE
+    SYNTAX    SEQUENCE OF ApcTableEntry
+    ACCESS    not-accessible
+    STATUS    mandatory
+    DESCRIPTION
+        "PHY counters table."
+    ::= { athPhy 1 }
+
+apcTableEntry OBJECT-TYPE
+    SYNTAX    ApcTableEntry
+    ACCESS    not-accessible
+    STATUS    mandatory
+    DESCRIPTION 
+        "PHY counters detailed information table
+         entry."
+    INDEX    { ifIndex }
+    ::= { athPhyCountersTable 1 }
+
+ApcTableEntry ::=
+    SEQUENCE {
+        ifIndex             INTEGER,
+        apcTotalPhyErrors   Integer32,
+        apcTxUnderRun       Integer32,
+        apcTimingErrors     Integer32,
+        apcParityErrors     Integer32,
+        apcInvalidRate      Integer32,
+        apcInvalidLength    Integer32,
+        apcRadarDetected    Integer32,
+        apcInvalidService   Integer32,
+        apcTxOverrideRx     Integer32,
+
+      	-- The following are specific to the 5212
+
+        apcOfdmTiming         Integer32,
+        apcOfdmSignalParity   Integer32,
+        apcOfdmInvalidRate    Integer32,
+        apcOfdmInvalidLength  Integer32,
+        apcOfdmPowerDrop      Integer32,
+        apcOfdmService        Integer32,
+        apcOfdmRestart        Integer32,
+        apcCckTiming          Integer32,
+        apcCckHeaderCrc       Integer32,
+        apcCckInvalidRate     Integer32,
+        apcCckService         Integer32,
+        apcCckRestart         Integer32
+    }
+
+apcTotalPhyErrors OBJECT-TYPE
+    SYNTAX  Integer32
+    ACCESS  read-only
+    STATUS  current
+    DESCRIPTION
+            "Total PHY errors that have occurred."
+    ::= { apcTableEntry  1 }
+
+apcTxUnderRun OBJECT-TYPE
+    SYNTAX  Integer32
+    ACCESS  read-only
+    STATUS  current
+    DESCRIPTION
+            "Number of times a transmit underrun occurred."
+    ::= { apcTableEntry  2 }
+
+apcTimingErrors OBJECT-TYPE
+    SYNTAX  Integer32
+    ACCESS  read-only
+    STATUS  current
+    DESCRIPTION
+            "Number of timing errors."
+    ::= { apcTableEntry  3 }
+
+apcParityErrors OBJECT-TYPE
+    SYNTAX  Integer32
+    ACCESS  read-only
+    STATUS  current
+    DESCRIPTION
+            "Number of parity errors."
+    ::= { apcTableEntry  4 }
+
+apcInvalidRate OBJECT-TYPE
+    SYNTAX  Integer32
+    ACCESS  read-only
+    STATUS  current
+    DESCRIPTION
+            "Number of invalid rate errors."
+    ::= { apcTableEntry  5 }
+
+apcInvalidLength OBJECT-TYPE
+    SYNTAX  Integer32
+    ACCESS  read-only
+    STATUS  current
+    DESCRIPTION
+            "Number of invalid length errors."
+    ::= { apcTableEntry  6 }
+
+apcRadarDetected OBJECT-TYPE
+    SYNTAX  Integer32
+    ACCESS  read-only
+    STATUS  current
+    DESCRIPTION
+            "Number of times radar was detected."
+    ::= { apcTableEntry  7 }
+
+apcInvalidService OBJECT-TYPE
+    SYNTAX  Integer32
+    ACCESS  read-only
+    STATUS  current
+    DESCRIPTION
+            "Number of times an invalid service was requested."
+    ::= { apcTableEntry  8 }
+
+apcTxOverrideRx OBJECT-TYPE
+    SYNTAX  Integer32
+    ACCESS  read-only
+    STATUS  current
+    DESCRIPTION
+            "Number of times a transmit overide receive occurred."
+    ::= { apcTableEntry  9 }
+
+-- The following are specific to the 5212
+	
+apcOfdmTiming OBJECT-TYPE
+    SYNTAX  Integer32
+    ACCESS  read-only
+    STATUS  current
+    DESCRIPTION
+            ""
+    ::= { apcTableEntry  10 }
+
+apcOfdmSignalParity OBJECT-TYPE
+    SYNTAX  Integer32
+    ACCESS  read-only
+    STATUS  current
+    DESCRIPTION
+            ""
+    ::= { apcTableEntry  11 }
+
+apcOfdmInvalidRate OBJECT-TYPE
+    SYNTAX  Integer32
+    ACCESS  read-only
+    STATUS  current
+    DESCRIPTION
+            ""
+    ::= { apcTableEntry  12 }
+
+apcOfdmInvalidLength OBJECT-TYPE
+    SYNTAX  Integer32
+    ACCESS  read-only
+    STATUS  current
+    DESCRIPTION
+            ""
+    ::= { apcTableEntry  13 }
+
+apcOfdmPowerDrop OBJECT-TYPE
+    SYNTAX  Integer32
+    ACCESS  read-only
+    STATUS  current
+    DESCRIPTION
+            ""
+    ::= { apcTableEntry  14 }
+
+apcOfdmService OBJECT-TYPE
+    SYNTAX  Integer32
+    ACCESS  read-only
+    STATUS  current
+    DESCRIPTION
+            ""
+    ::= { apcTableEntry  15 }
+
+apcOfdmRestart OBJECT-TYPE
+    SYNTAX  Integer32
+    ACCESS  read-only
+    STATUS  current
+    DESCRIPTION
+            ""
+    ::= { apcTableEntry  16 }
+
+apcCckTiming OBJECT-TYPE
+    SYNTAX  Integer32
+    ACCESS  read-only
+    STATUS  current
+    DESCRIPTION
+            ""
+    ::= { apcTableEntry  17 }
+
+apcCckHeaderCrc OBJECT-TYPE
+    SYNTAX  Integer32
+    ACCESS  read-only
+    STATUS  current
+    DESCRIPTION
+            ""
+    ::= { apcTableEntry  18 }
+
+apcCckInvalidRate OBJECT-TYPE
+    SYNTAX  Integer32
+    ACCESS  read-only
+    STATUS  current
+    DESCRIPTION
+            ""
+    ::= { apcTableEntry  19 }
+
+apcCckService OBJECT-TYPE
+    SYNTAX  Integer32
+    ACCESS  read-only
+    STATUS  current
+    DESCRIPTION
+            ""
+    ::= { apcTableEntry  20 }
+
+apcCckRestart OBJECT-TYPE
+    SYNTAX  Integer32
+    ACCESS  read-only
+    STATUS  current
+    DESCRIPTION
+            ""
+    ::= { apcTableEntry  21 }
+
+-- **********************************************************************
+-- *   End of AvantCom 802.11 MIB
+-- **********************************************************************
+END
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/avc802dot11.c tomato121/release/src/router/snmp/agent/mibgroup/avc802dot11.c
--- tomato/release/src/router/snmp/agent/mibgroup/avc802dot11.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/avc802dot11.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,1796 @@
+/**** Copyright (c) AvantCom Corp 2003 - 2004 ***/
+/**** All rights reserved ***/
+/*__________________________________________________________________
+  |                                                                |
+  |         Copyright 2003 - 2004  -  AvantCom Corporation         |
+  |                                                                |
+  |    This material is the exclusive confidential property of     |
+  |    AvantCom Corporation. All rights, including copyrights      |
+  |    and patent rights, are reserved. No copies of any portion   |
+  |    are to be made by any means without the express written     |
+  |    permission of AvantCom Corporation.                         |
+  |                                                                |
+  |________________________________________________________________|
+*/ 
+/****************************************************************************
+*                                                                           *
+*  File Name:           avc802dot11.c                                       *
+*  Used By:                                                                 *
+*                                                                           *
+*  Operating System:                                                        *
+*  Purpose:                                                                 *
+*                                                                           *
+*  Comments:                                                                *
+*                                                                           *
+*  Author:              Larry Simmons                                       *
+*                       lsimmons@avantcom.com                               *
+*                       www.avantcom.com                                    *
+*                                                                           *
+*  Creation Date:       09/24/03                                            *
+*                                                                           *
+*   Ver    Date   Inits Modification                                        *
+*  ----- -------- ----- ------------                                        *
+*  0.0.1 09/24/03  LRS  created                                             *
+*  0.0.3 11/03/04  LRS  added signal/noise for Prism cards                  *
+*                  LRS  made prAcRxBytes and prAcTxBytes Counter64          *
+****************************************************************************/
+/****************************************************************************
+*                               Includes                                    *
+****************************************************************************/
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include "avc802dot11.h"
+#include "dirent.h"
+#include "iwlib.h"
+
+/****************************************************************************
+*                                Defines                                    *
+****************************************************************************/
+//#define DISPLAYWIEXT                      // display wireless ext info
+#define TABLE_SIZE   1
+//#define MINLOADFREQ 15                    // min reload frequency in seconds
+#define MINLOADFREQ 5                       // min reload frequency in seconds     // for testing
+
+#define HOSTAPPATH        "/proc/net/hostap/"
+#define MADWIFIPATH       "/proc/sys/net/"
+#define PROC_NET_DEV      "/proc/net/dev"
+
+//#define HOSTAPPATH  "/home/lsimmons/proc/net/hostap/"                            // for testing
+//#define MADWIFIPATH "/home/lsimmons/proc/sys/net/"                               // for testing
+
+#define EXPECTED_MIB_VERSION   "Version 0.0.3 - 11/03/2004"
+#define AGENT_VERSION          "Version 0.0.3 - 11/03/2004"
+
+#ifndef UCHAR
+  typedef unsigned char UCHAR;
+#endif
+
+/****************************************************************************
+*                            Private Functions                              *
+****************************************************************************/
+static void loadTables();
+static void loadPrismIfStruct ( int, char *, struct wireless_info * );
+static void loadHostAPClients();
+static void loadMadWiFiStats();
+static void initStructs();
+
+// Wireless Extensions Specific Functions
+static void loadWiExt ( int, char *, struct wireless_info * );
+static void displayWiExt ( struct wireless_info );
+
+// Linked List Functions
+static void addList ( char *, char *, int );
+static void initLists();                    // initialize all the linked lists
+static void flushLists();                   // flush all the linked lists
+static void flushList ( char * );           // flush a single linked list
+
+// Utility Functions
+static int  openSocket ( void );
+static int  mWatt2dbm ( int );
+static int  isMACAddress ( char * );
+static void strtoupper  ( char * );
+static unsigned int htoui ( char * );
+static char *htob ( char * );
+
+/****************************************************************************
+*                            Private Variables                              *
+****************************************************************************/
+static unsigned long lastLoad = 0;          // ET in secs at last table load
+
+static struct avc802dot11Node *lastNode, *newNode, *np;
+
+/****************************************************************************
+*                            External Functions                             *
+****************************************************************************/
+
+/****************************************************************************
+*   avc802dot11_variables_oid:                                              *
+*       this is the top level oid that we want to register under.  This     *
+*       is essentially a prefix, with the suffix appearing in the           *
+*       variable below.                                                     *
+****************************************************************************/
+oid avc802dot11_variables_oid[] = { 1,3,6,1,3,14614 };
+
+/****************************************************************************
+*   variable7 avc802dot11_variables:                                        *
+*     this variable defines function callbacks and type return information  *
+*     for the ieee802dot11 mib section                                      *
+****************************************************************************/
+struct variable7 avc802dot11_variables[] = {
+/*  magic number        , variable type , ro/rw , callback fn  , L, oidsuffix */
+#define   SYSEXPECTEDMIBVERSION  2
+  { SYSEXPECTEDMIBVERSION, ASN_OCTET_STR , RONLY , var_avc802dot11, 2, { 1,2 } },
+#define   SYSAGENTVERSION       3
+  { SYSAGENTVERSION     , ASN_OCTET_STR , RONLY , var_avc802dot11, 2, { 1,3 } },
+
+#define   PRACMACADDRESS        6
+  { PRACMACADDRESS      , ASN_OCTET_STR , RONLY , var_prAssociatedClientsTable, 5, { 2,1,1,1,1 } },
+#define   PRACSTATIONTYPE       7
+  { PRACSTATIONTYPE     , ASN_INTEGER   , RONLY , var_prAssociatedClientsTable, 5, { 2,1,1,1,2 } },
+#define   PRACLISTENINTERVAL    8
+  { PRACLISTENINTERVAL  , ASN_INTEGER   , RONLY , var_prAssociatedClientsTable, 5, { 2,1,1,1,3 } },
+#define   PRACSUPPORTS1MBPS     9
+  { PRACSUPPORTS1MBPS   , ASN_INTEGER   , RONLY , var_prAssociatedClientsTable, 5, { 2,1,1,1,4 } },
+#define   PRACSUPPORTS2MBPS     10
+  { PRACSUPPORTS2MBPS   , ASN_INTEGER   , RONLY , var_prAssociatedClientsTable, 5, { 2,1,1,1,5 } },
+#define   PRACSUPPORTS5MBPS     11
+  { PRACSUPPORTS5MBPS   , ASN_INTEGER   , RONLY , var_prAssociatedClientsTable, 5, { 2,1,1,1,6 } },
+#define   PRACSUPPORTS11MBPS    12
+  { PRACSUPPORTS11MBPS  , ASN_INTEGER   , RONLY , var_prAssociatedClientsTable, 5, { 2,1,1,1,7 } },
+#define   PRACJIFFIES           13
+  { PRACJIFFIES         , ASN_INTEGER   , RONLY , var_prAssociatedClientsTable, 5, { 2,1,1,1,8 } },
+#define   PRACLASTAUTH          14
+  { PRACLASTAUTH        , ASN_INTEGER   , RONLY , var_prAssociatedClientsTable, 5, { 2,1,1,1,9 } },
+#define   PRACLASTASSOC         15
+  { PRACLASTASSOC       , ASN_INTEGER   , RONLY , var_prAssociatedClientsTable, 5, { 2,1,1,1,10 } },
+#define   PRACLASTRX            16
+  { PRACLASTRX          , ASN_INTEGER   , RONLY , var_prAssociatedClientsTable, 5, { 2,1,1,1,11 } },
+#define   PRACLASTTX            17
+  { PRACLASTTX          , ASN_INTEGER   , RONLY , var_prAssociatedClientsTable, 5, { 2,1,1,1,12 } },
+#define   PRACRXPACKETS         18
+  { PRACRXPACKETS       , ASN_INTEGER   , RONLY , var_prAssociatedClientsTable, 5, { 2,1,1,1,13 } },
+#define   PRACTXPACKETS         19
+  { PRACTXPACKETS       , ASN_INTEGER   , RONLY , var_prAssociatedClientsTable, 5, { 2,1,1,1,14 } },
+#define   PRACRXBYTES           20
+  { PRACRXBYTES         , ASN_COUNTER64 , RONLY , var_prAssociatedClientsTable, 5, { 2,1,1,1,15 } },
+#define   PRACTXBYTES           21
+  { PRACTXBYTES         , ASN_COUNTER64 , RONLY , var_prAssociatedClientsTable, 5, { 2,1,1,1,16 } },
+#define   PRACBFRCNT            22
+  { PRACBFRCNT          , ASN_INTEGER   , RONLY , var_prAssociatedClientsTable, 5, { 2,1,1,1,17 } },
+#define   PRACLASTRXSILENCE     23
+  { PRACLASTRXSILENCE   , ASN_INTEGER   , RONLY , var_prAssociatedClientsTable, 5, { 2,1,1,1,18 } },
+#define   PRACLASTRXSIGNAL      24
+  { PRACLASTRXSIGNAL    , ASN_INTEGER   , RONLY , var_prAssociatedClientsTable, 5, { 2,1,1,1,19 } },
+#define   PRACLASTRXRATE        25
+  { PRACLASTRXRATE      , ASN_INTEGER   , RONLY , var_prAssociatedClientsTable, 5, { 2,1,1,1,20 } },
+#define   PRACLASTRXFLOW        26
+  { PRACLASTRXFLOW      , ASN_INTEGER   , RONLY , var_prAssociatedClientsTable, 5, { 2,1,1,1,21 } },
+#define   PRACTXRATE            27
+  { PRACTXRATE          , ASN_INTEGER   , RONLY , var_prAssociatedClientsTable, 5, { 2,1,1,1,22 } },
+#define   PRACTX1MBPS           28
+  { PRACTX1MBPS         , ASN_INTEGER   , RONLY , var_prAssociatedClientsTable, 5, { 2,1,1,1,23 } },
+#define   PRACTX2MBPS           29
+  { PRACTX2MBPS         , ASN_INTEGER   , RONLY , var_prAssociatedClientsTable, 5, { 2,1,1,1,24 } },
+#define   PRACTX5MBPS           30
+  { PRACTX5MBPS         , ASN_INTEGER   , RONLY , var_prAssociatedClientsTable, 5, { 2,1,1,1,25 } },
+#define   PRACTX11MBPS          31
+  { PRACTX11MBPS        , ASN_INTEGER   , RONLY , var_prAssociatedClientsTable, 5, { 2,1,1,1,26 } },
+#define   PRACRX1MBPS           32
+  { PRACRX1MBPS         , ASN_INTEGER   , RONLY , var_prAssociatedClientsTable, 5, { 2,1,1,1,27 } },
+#define   PRACRX2MBPS           33
+  { PRACRX2MBPS         , ASN_INTEGER   , RONLY , var_prAssociatedClientsTable, 5, { 2,1,1,1,28 } },
+#define   PRACRX5MBPS           34
+  { PRACRX5MBPS         , ASN_INTEGER   , RONLY , var_prAssociatedClientsTable, 5, { 2,1,1,1,29 } },
+#define   PRACRX11MBPS          35
+  { PRACRX11MBPS        , ASN_INTEGER   , RONLY , var_prAssociatedClientsTable, 5, { 2,1,1,1,30 } },
+
+#define   PRIFSIGNAL            38
+  { PRIFSIGNAL          , ASN_INTEGER   , RONLY , var_prInterfaceTable, 5, { 2,2,1,1,1 } },
+#define   PRIFNOISE             39
+  { PRIFNOISE           , ASN_INTEGER   , RONLY , var_prInterfaceTable, 5, { 2,2,1,1,2 } },
+#define   PRIFQUALITY           40
+  { PRIFQUALITY         , ASN_INTEGER   , RONLY , var_prInterfaceTable, 5, { 2,2,1,1,3 } },
+#define   PRIFASSOCCNT          41
+  { PRIFASSOCCNT        , ASN_INTEGER   , RONLY , var_prInterfaceTable, 5, { 2,2,1,1,4 } },
+
+#define   AMCWATCHDOG           44
+  { AMCWATCHDOG         , ASN_INTEGER   , RONLY , var_athMacCountersTable, 5, { 3,1,1,1,1 } },
+#define   AMCFATALHWINTERRUPT   45
+  { AMCFATALHWINTERRUPT , ASN_INTEGER   , RONLY , var_athMacCountersTable, 5, { 3,1,1,1,2 } },
+#define   AMCMISSEDBEACONS      46
+  { AMCMISSEDBEACONS    , ASN_INTEGER   , RONLY , var_athMacCountersTable, 5, { 3,1,1,1,3 } },
+#define   AMCRXOVERRUN          47
+  { AMCRXOVERRUN        , ASN_INTEGER   , RONLY , var_athMacCountersTable, 5, { 3,1,1,1,4 } },
+#define   AMCRXEOL              48
+  { AMCRXEOL            , ASN_INTEGER   , RONLY , var_athMacCountersTable, 5, { 3,1,1,1,5 } },
+#define   AMCTXUNDERRUN         49
+  { AMCTXUNDERRUN       , ASN_INTEGER   , RONLY , var_athMacCountersTable, 5, { 3,1,1,1,6 } },
+#define   AMCTXMGMTFRAMES       50
+  { AMCTXMGMTFRAMES     , ASN_INTEGER   , RONLY , var_athMacCountersTable, 5, { 3,1,1,1,7 } },
+#define   AMCTXDISCARDS         51
+  { AMCTXDISCARDS       , ASN_INTEGER   , RONLY , var_athMacCountersTable, 5, { 3,1,1,1,8 } },
+#define   AMCTXINVALID          52
+  { AMCTXINVALID        , ASN_INTEGER   , RONLY , var_athMacCountersTable, 5, { 3,1,1,1,9 } },
+#define   AMCTXQUEUESTOPPED     53
+  { AMCTXQUEUESTOPPED   , ASN_INTEGER   , RONLY , var_athMacCountersTable, 5, { 3,1,1,1,10 } },
+#define   AMCTXENCAPFAILED      54
+  { AMCTXENCAPFAILED    , ASN_INTEGER   , RONLY , var_athMacCountersTable, 5, { 3,1,1,1,11 } },
+#define   AMCTXNONODE           55
+  { AMCTXNONODE         , ASN_INTEGER   , RONLY , var_athMacCountersTable, 5, { 3,1,1,1,12 } },
+#define   AMCTXNODATABUFFER     56
+  { AMCTXNODATABUFFER   , ASN_INTEGER   , RONLY , var_athMacCountersTable, 5, { 3,1,1,1,13 } },
+#define   AMCTXNOMGMTBUFFER     57
+  { AMCTXNOMGMTBUFFER   , ASN_INTEGER   , RONLY , var_athMacCountersTable, 5, { 3,1,1,1,14 } },
+#define   AMCTXEXCESSIVERETRIES  58
+  { AMCTXEXCESSIVERETRIES, ASN_INTEGER   , RONLY , var_athMacCountersTable, 5, { 3,1,1,1,15 } },
+#define   AMCTXFIFOUNDERRUN     59
+  { AMCTXFIFOUNDERRUN   , ASN_INTEGER   , RONLY , var_athMacCountersTable, 5, { 3,1,1,1,16 } },
+#define   AMCTXFILTERED         60
+  { AMCTXFILTERED       , ASN_INTEGER   , RONLY , var_athMacCountersTable, 5, { 3,1,1,1,17 } },
+#define   AMCTXSHORTRETRIES     61
+  { AMCTXSHORTRETRIES   , ASN_INTEGER   , RONLY , var_athMacCountersTable, 5, { 3,1,1,1,18 } },
+#define   AMCTXLONGRETRIES      62
+  { AMCTXLONGRETRIES    , ASN_INTEGER   , RONLY , var_athMacCountersTable, 5, { 3,1,1,1,19 } },
+#define   AMCTXBADRATE          63
+  { AMCTXBADRATE        , ASN_INTEGER   , RONLY , var_athMacCountersTable, 5, { 3,1,1,1,20 } },
+#define   AMCTXNOACK            64
+  { AMCTXNOACK          , ASN_INTEGER   , RONLY , var_athMacCountersTable, 5, { 3,1,1,1,21 } },
+#define   AMCTXRTS              65
+  { AMCTXRTS            , ASN_INTEGER   , RONLY , var_athMacCountersTable, 5, { 3,1,1,1,22 } },
+#define   AMCTXCTS              66
+  { AMCTXCTS            , ASN_INTEGER   , RONLY , var_athMacCountersTable, 5, { 3,1,1,1,23 } },
+#define   AMCTXSHORTPREAMBLE    67
+  { AMCTXSHORTPREAMBLE  , ASN_INTEGER   , RONLY , var_athMacCountersTable, 5, { 3,1,1,1,24 } },
+#define   AMCTXRSSI             68
+  { AMCTXRSSI           , ASN_INTEGER   , RONLY , var_athMacCountersTable, 5, { 3,1,1,1,25 } },
+#define   AMCTXRSSIDELTA        69
+  { AMCTXRSSIDELTA      , ASN_INTEGER   , RONLY , var_athMacCountersTable, 5, { 3,1,1,1,26 } },
+#define   AMCRXDESCOVERRUN      70
+  { AMCRXDESCOVERRUN    , ASN_INTEGER   , RONLY , var_athMacCountersTable, 5, { 3,1,1,1,27 } },
+#define   AMCRXFRAMETOOSHORT    71
+  { AMCRXFRAMETOOSHORT  , ASN_INTEGER   , RONLY , var_athMacCountersTable, 5, { 3,1,1,1,28 } },
+#define   AMCRXCRCERROR         72
+  { AMCRXCRCERROR       , ASN_INTEGER   , RONLY , var_athMacCountersTable, 5, { 3,1,1,1,29 } },
+#define   AMCRXFIFOOVERRUN      73
+  { AMCRXFIFOOVERRUN    , ASN_INTEGER   , RONLY , var_athMacCountersTable, 5, { 3,1,1,1,30 } },
+#define   AMCRXCRYPTFAILURE     74
+  { AMCRXCRYPTFAILURE   , ASN_INTEGER   , RONLY , var_athMacCountersTable, 5, { 3,1,1,1,31 } },
+#define   AMCRXNOSKBUFFER       75
+  { AMCRXNOSKBUFFER     , ASN_INTEGER   , RONLY , var_athMacCountersTable, 5, { 3,1,1,1,32 } },
+#define   AMCRXRSSI             76
+  { AMCRXRSSI           , ASN_INTEGER   , RONLY , var_athMacCountersTable, 5, { 3,1,1,1,33 } },
+#define   AMCRXRSSIDELTA        77
+  { AMCRXRSSIDELTA      , ASN_INTEGER   , RONLY , var_athMacCountersTable, 5, { 3,1,1,1,34 } },
+#define   AMCNOBEACONBUFFER     78
+  { AMCNOBEACONBUFFER   , ASN_INTEGER   , RONLY , var_athMacCountersTable, 5, { 3,1,1,1,35 } },
+#define   AMCCALIBRATIONS       79
+  { AMCCALIBRATIONS     , ASN_INTEGER   , RONLY , var_athMacCountersTable, 5, { 3,1,1,1,36 } },
+#define   AMCFAILEDCALIBRATIONS  80
+  { AMCFAILEDCALIBRATIONS, ASN_INTEGER   , RONLY , var_athMacCountersTable, 5, { 3,1,1,1,37 } },
+#define   AMCRFGAINRESETS       81
+  { AMCRFGAINRESETS     , ASN_INTEGER   , RONLY , var_athMacCountersTable, 5, { 3,1,1,1,38 } },
+#define   AMCRATECONTROLCHECKS  82
+  { AMCRATECONTROLCHECKS, ASN_INTEGER   , RONLY , var_athMacCountersTable, 5, { 3,1,1,1,39 } },
+#define   AMCRATECONTROLRAISE   83
+  { AMCRATECONTROLRAISE , ASN_INTEGER   , RONLY , var_athMacCountersTable, 5, { 3,1,1,1,40 } },
+#define   AMCRATECONTROLDROP    84
+  { AMCRATECONTROLDROP  , ASN_INTEGER   , RONLY , var_athMacCountersTable, 5, { 3,1,1,1,41 } },
+
+#define   APCTOTALPHYERRORS     87
+  { APCTOTALPHYERRORS   , ASN_INTEGER   , RONLY , var_athPhyCountersTable, 5, { 3,2,1,1,1 } },
+#define   APCTXUNDERRUN         88
+  { APCTXUNDERRUN       , ASN_INTEGER   , RONLY , var_athPhyCountersTable, 5, { 3,2,1,1,2 } },
+#define   APCTIMINGERRORS       89
+  { APCTIMINGERRORS     , ASN_INTEGER   , RONLY , var_athPhyCountersTable, 5, { 3,2,1,1,3 } },
+#define   APCPARITYERRORS       90
+  { APCPARITYERRORS     , ASN_INTEGER   , RONLY , var_athPhyCountersTable, 5, { 3,2,1,1,4 } },
+#define   APCINVALIDRATE        91
+  { APCINVALIDRATE      , ASN_INTEGER   , RONLY , var_athPhyCountersTable, 5, { 3,2,1,1,5 } },
+#define   APCINVALIDLENGTH      92
+  { APCINVALIDLENGTH    , ASN_INTEGER   , RONLY , var_athPhyCountersTable, 5, { 3,2,1,1,6 } },
+#define   APCRADARDETECTED      93
+  { APCRADARDETECTED    , ASN_INTEGER   , RONLY , var_athPhyCountersTable, 5, { 3,2,1,1,7 } },
+#define   APCINVALIDSERVICE     94
+  { APCINVALIDSERVICE   , ASN_INTEGER   , RONLY , var_athPhyCountersTable, 5, { 3,2,1,1,8 } },
+#define   APCTXOVERRIDERX       95
+  { APCTXOVERRIDERX     , ASN_INTEGER   , RONLY , var_athPhyCountersTable, 5, { 3,2,1,1,9 } },
+#define   APCOFDMTIMING         96
+  { APCOFDMTIMING       , ASN_INTEGER   , RONLY , var_athPhyCountersTable, 5, { 3,2,1,1,10 } },
+#define   APCOFDMSIGNALPARITY   97
+  { APCOFDMSIGNALPARITY , ASN_INTEGER   , RONLY , var_athPhyCountersTable, 5, { 3,2,1,1,11 } },
+#define   APCOFDMINVALIDRATE    98
+  { APCOFDMINVALIDRATE  , ASN_INTEGER   , RONLY , var_athPhyCountersTable, 5, { 3,2,1,1,12 } },
+#define   APCOFDMINVALIDLENGTH  99
+  { APCOFDMINVALIDLENGTH, ASN_INTEGER   , RONLY , var_athPhyCountersTable, 5, { 3,2,1,1,13 } },
+#define   APCOFDMPOWERDROP      100
+  { APCOFDMPOWERDROP    , ASN_INTEGER   , RONLY , var_athPhyCountersTable, 5, { 3,2,1,1,14 } },
+#define   APCOFDMSERVICE        101
+  { APCOFDMSERVICE      , ASN_INTEGER   , RONLY , var_athPhyCountersTable, 5, { 3,2,1,1,15 } },
+#define   APCOFDMRESTART        102
+  { APCOFDMRESTART      , ASN_INTEGER   , RONLY , var_athPhyCountersTable, 5, { 3,2,1,1,16 } },
+#define   APCCCKTIMING          103
+  { APCCCKTIMING        , ASN_INTEGER   , RONLY , var_athPhyCountersTable, 5, { 3,2,1,1,17 } },
+#define   APCCCKHEADERCRC       104
+  { APCCCKHEADERCRC     , ASN_INTEGER   , RONLY , var_athPhyCountersTable, 5, { 3,2,1,1,18 } },
+#define   APCCCKINVALIDRATE     105
+  { APCCCKINVALIDRATE   , ASN_INTEGER   , RONLY , var_athPhyCountersTable, 5, { 3,2,1,1,19 } },
+#define   APCCCKSERVICE         106
+  { APCCCKSERVICE       , ASN_INTEGER   , RONLY , var_athPhyCountersTable, 5, { 3,2,1,1,20 } },
+#define   APCCCKRESTART         107
+  { APCCCKRESTART       , ASN_INTEGER   , RONLY , var_athPhyCountersTable, 5, { 3,2,1,1,21 } },
+
+};
+
+/*    (L = length of the oidsuffix) */
+
+/****************************************************************************
+*                                                                           *
+*          init_avc802dot11() - perform any required initialization         *
+*                                                                           *
+****************************************************************************/
+void init_avc802dot11(void) {
+
+  /* register ourselves with the agent to handle our mib tree */
+  REGISTER_MIB("avc802dot11", avc802dot11_variables, variable7,
+               avc802dot11_variables_oid);
+
+  initLists();
+}
+
+
+/****************************************************************************
+*                                                                           *
+*     shutdown_avc802dot11() - perform any required cleanup @ shutdown      *
+*                                                                           *
+****************************************************************************/
+void shutdown_avc802dot11 ( void )
+{
+  flushLists();
+}
+
+/****************************************************************************
+*                                                                           *
+*   var_avc802dot11() -                                                     *
+*                                                                           *
+****************************************************************************/
+unsigned char *
+var_avc802dot11(struct variable *vp, 
+                oid     *name, 
+                size_t  *length, 
+                int     exact, 
+                size_t  *var_len, 
+                WriteMethod **write_method)
+{
+  static unsigned char string[SPRINT_MAX_LEN];
+
+  if ( header_generic ( vp, name, length, exact, var_len, write_method )
+                                  == MATCH_FAILED )
+    return NULL;
+
+  switch ( vp->magic ) {
+
+    case SYSEXPECTEDMIBVERSION:
+      strcpy ( string, EXPECTED_MIB_VERSION );
+      *var_len = strlen ( string );
+      return ( UCHAR * ) string;
+
+    case SYSAGENTVERSION:
+      strcpy ( string, AGENT_VERSION );
+      *var_len = strlen ( string );
+      return ( UCHAR * ) string;
+
+    default:
+      ERROR_MSG ( "" );
+  }
+
+  return NULL;
+}
+
+/****************************************************************************
+*                                                                           *
+*   var_prAssociatedClientsTable() -                                        *
+*                                                                           *
+****************************************************************************/
+unsigned char *
+var_prAssociatedClientsTable ( struct variable *vp,
+                                oid     *name,
+                                size_t  *length,
+                                int     exact,
+                                size_t  *var_len,
+                                WriteMethod **write_method )
+{
+  oid rName [ MAX_OID_LEN ];                            // OID to be returned
+  int found = FALSE;
+  static char MACWork[17];
+  static struct counter64 c64;
+
+  loadTables();
+
+  memcpy (( char * ) rName, ( char * ) vp->name, ( int ) vp->namelen * sizeof ( oid ));
+  for ( np = LIST_FIRST ( &prAcList ); np != NULL; np = LIST_NEXT ( np, nodes )) {
+    prAc = ( struct prAcTbl_data * ) np->data;
+    rName[vp->namelen + 0] = prAc->ifIndex;
+    rName[vp->namelen + 1] = htoui ( &prAc->macAddress[0] );
+    rName[vp->namelen + 2] = htoui ( &prAc->macAddress[3] );
+    rName[vp->namelen + 3] = htoui ( &prAc->macAddress[6] );
+    rName[vp->namelen + 4] = htoui ( &prAc->macAddress[9] );
+    rName[vp->namelen + 5] = htoui ( &prAc->macAddress[12] );
+    rName[vp->namelen + 6] = htoui ( &prAc->macAddress[15] );
+    if ((  exact && ( snmp_oid_compare ( rName, vp->namelen + 7, name, *length ) == 0 )) ||
+        ( !exact && ( snmp_oid_compare ( rName, vp->namelen + 7, name, *length ) >  0 ))) {
+      found = TRUE;
+      break;
+    }
+  }
+
+  if ( !found  )
+    return NULL;
+
+  memcpy (( char * ) name, ( char * ) rName, ( vp->namelen + 7 ) * sizeof ( oid ));
+  *length = vp->namelen + 7;
+  *write_method = 0;
+  *var_len = sizeof ( long );
+
+  switch ( vp->magic ) {
+
+    case PRACMACADDRESS:
+      MACWork[ 0] = toupper ( prAc->macAddress[ 0] );
+      MACWork[ 1] = toupper ( prAc->macAddress[ 1] );
+      MACWork[ 2] = toupper ( prAc->macAddress[ 3] );
+      MACWork[ 3] = toupper ( prAc->macAddress[ 4] );
+      MACWork[ 4] = toupper ( prAc->macAddress[ 6] );
+      MACWork[ 5] = toupper ( prAc->macAddress[ 7] );
+      MACWork[ 6] = toupper ( prAc->macAddress[ 9] );
+      MACWork[ 7] = toupper ( prAc->macAddress[10] );
+      MACWork[ 8] = toupper ( prAc->macAddress[12] );
+      MACWork[ 9] = toupper ( prAc->macAddress[13] );
+      MACWork[10] = toupper ( prAc->macAddress[15] );
+      MACWork[11] = toupper ( prAc->macAddress[16] );
+      MACWork[12] = '\0';
+      *var_len = 6;
+      return ( UCHAR * ) htob ( MACWork );
+        
+    case PRACSTATIONTYPE:     return ( UCHAR * ) &prAc->stationType;
+    case PRACLISTENINTERVAL:  return ( UCHAR * ) &prAc->listenInterval;
+    case PRACSUPPORTS1MBPS:   return ( UCHAR * ) &prAc->supports1Mbps;
+    case PRACSUPPORTS2MBPS:   return ( UCHAR * ) &prAc->supports2Mbps;
+    case PRACSUPPORTS5MBPS:   return ( UCHAR * ) &prAc->supports5Mbps;
+    case PRACSUPPORTS11MBPS:  return ( UCHAR * ) &prAc->supports11Mbps;
+    case PRACJIFFIES:         return ( UCHAR * ) &prAc->jiffies;
+    case PRACLASTAUTH:        return ( UCHAR * ) &prAc->lastAuth;
+    case PRACLASTASSOC:       return ( UCHAR * ) &prAc->lastAssoc;
+    case PRACLASTRX:          return ( UCHAR * ) &prAc->lastRx;
+    case PRACLASTTX:          return ( UCHAR * ) &prAc->lastTx;
+    case PRACRXPACKETS:       return ( UCHAR * ) &prAc->rxPackets;
+    case PRACTXPACKETS:       return ( UCHAR * ) &prAc->txPackets;
+
+    case PRACRXBYTES:         
+      c64.high = ( unsigned long ) ( prAc->rxBytes >> 32 );
+      c64.low  = ( unsigned long ) ( prAc->rxBytes & 0xffffffff );
+     *var_len = sizeof ( c64 );
+       return ( UCHAR * ) &c64;
+
+    case PRACTXBYTES:         
+      c64.high = ( unsigned long ) ( prAc->txBytes >> 32 );
+      c64.low  = ( unsigned long ) ( prAc->txBytes & 0xffffffff );
+     *var_len = sizeof ( c64 );
+      return ( UCHAR * ) &c64;
+
+    case PRACBFRCNT:          return ( UCHAR * ) &prAc->bfrCnt;
+    case PRACLASTRXSILENCE:   return ( UCHAR * ) &prAc->lastRxSilence;
+    case PRACLASTRXSIGNAL:    return ( UCHAR * ) &prAc->lastRxSignal;
+    case PRACLASTRXRATE:      return ( UCHAR * ) &prAc->lastRxRate;
+    case PRACLASTRXFLOW:      return ( UCHAR * ) &prAc->lastRxFlow;
+    case PRACTXRATE:          return ( UCHAR * ) &prAc->txRate;
+    case PRACTX1MBPS:         return ( UCHAR * ) &prAc->tx1Mbps;
+    case PRACTX2MBPS:         return ( UCHAR * ) &prAc->tx2Mbps;
+    case PRACTX5MBPS:         return ( UCHAR * ) &prAc->tx5Mbps;
+    case PRACTX11MBPS:        return ( UCHAR * ) &prAc->tx11Mbps;
+    case PRACRX1MBPS:         return ( UCHAR * ) &prAc->rx1Mbps;
+    case PRACRX2MBPS:         return ( UCHAR * ) &prAc->rx2Mbps;
+    case PRACRX5MBPS:         return ( UCHAR * ) &prAc->rx5Mbps;
+    case PRACRX11MBPS:        return ( UCHAR * ) &prAc->rx11Mbps;
+
+    default:
+      ERROR_MSG ( "" );
+  }
+
+  return NULL;
+}
+
+
+/****************************************************************************
+*                                                                           *
+*       var_prInterfaceTable()() -                                          *
+*                                                                           *
+****************************************************************************/
+unsigned char *
+var_prInterfaceTable ( struct variable  *vp,
+    	                  oid             *name,
+    	                  size_t          *length,
+    	                  int              exact,
+    	                  size_t          *var_len,
+    	                  WriteMethod    **write_method )
+{
+  int found = FALSE;
+  oid rName [ MAX_OID_LEN ];                            // OID to be returned
+
+  loadTables();
+  memcpy (( char * ) rName, ( char * ) vp->name, ( int ) vp->namelen * sizeof ( oid ));
+  for ( np = LIST_FIRST ( &prIfList ); np != NULL; np = LIST_NEXT ( np, nodes )) {
+    prIf = ( struct prIfTbl_data * ) np->data;
+    rName[vp->namelen] = prIf->ifIndex;
+    if ((  exact && ( snmp_oid_compare ( rName, vp->namelen + 1, name, *length ) == 0 )) || 
+        ( !exact && ( snmp_oid_compare ( rName, vp->namelen + 1, name, *length ) >  0 ))) {
+      found = TRUE;
+      break;
+    }
+  }
+
+  if ( !found ) 
+    return NULL;
+
+  memcpy (( char * ) name, ( char * ) rName, ( vp->namelen + 1 ) * sizeof ( oid ));
+  *length = vp->namelen + 1;
+  *var_len = sizeof ( long );
+  *write_method = NULL;
+
+  switch ( vp->magic ) {
+
+    case PRIFSIGNAL:    return ( UCHAR * ) &prIf->signal;
+    case PRIFNOISE:     return ( UCHAR * ) &prIf->noise;
+    case PRIFQUALITY:   return ( UCHAR * ) &prIf->quality;
+    case PRIFASSOCCNT:  return ( UCHAR * ) &prIf->assocCnt;
+
+    default: 
+      ERROR_MSG("");
+  }
+
+  return NULL;
+}
+
+/****************************************************************************
+*                                                                           *
+*       var_athMacCountersTable() -                                         *
+*                                                                           *
+****************************************************************************/
+unsigned char *
+var_athMacCountersTable ( struct variable *vp,
+    	                      oid     *name,
+    	                      size_t  *length,
+    	                      int     exact,
+    	                      size_t  *var_len,
+    	                      WriteMethod **write_method)
+{
+  int found = FALSE;
+  oid rName [ MAX_OID_LEN ];                            // OID to be returned
+
+  loadTables();
+  memcpy (( char * ) rName, ( char * ) vp->name, ( int ) vp->namelen * sizeof ( oid ));
+  for ( np = LIST_FIRST ( &athMacList ); np != NULL; np = LIST_NEXT ( np, nodes )) {
+    athMac = ( struct athMacTbl_data * ) np->data;
+    rName[vp->namelen] = athMac->ifIndex;
+    if ((  exact && ( snmp_oid_compare ( rName, vp->namelen + 1, name, *length ) == 0 )) || 
+        ( !exact && ( snmp_oid_compare ( rName, vp->namelen + 1, name, *length ) >  0 ))) {
+      found = TRUE;
+      break;
+    }
+  }
+
+  if ( !found ) 
+    return NULL;
+
+  memcpy (( char * ) name, ( char * ) rName, ( vp->namelen + 1 ) * sizeof ( oid ));
+  *length = vp->namelen + 1;
+  *var_len = sizeof ( long );
+  *write_method = NULL;
+
+  switch ( vp->magic ) {
+
+    case AMCWATCHDOG:           return ( UCHAR * ) &athMac->watchDog;
+    case AMCFATALHWINTERRUPT:   return ( UCHAR * ) &athMac->fatalHwInterrupt;
+    case AMCMISSEDBEACONS:      return ( UCHAR * ) &athMac->missedBeacons;
+    case AMCRXOVERRUN:          return ( UCHAR * ) &athMac->rxOverRun;
+    case AMCRXEOL:              return ( UCHAR * ) &athMac->rxEol;
+    case AMCTXUNDERRUN:         return ( UCHAR * ) &athMac->txUnderRun;
+    case AMCTXMGMTFRAMES:       return ( UCHAR * ) &athMac->txMgmtFrames;
+    case AMCTXDISCARDS:         return ( UCHAR * ) &athMac->txDiscards;
+    case AMCTXINVALID:          return ( UCHAR * ) &athMac->txInvalid;
+    case AMCTXQUEUESTOPPED:     return ( UCHAR * ) &athMac->txQueueStopped;
+    case AMCTXENCAPFAILED:      return ( UCHAR * ) &athMac->txEncapFailed;
+    case AMCTXNONODE:           return ( UCHAR * ) &athMac->txNoNode;
+    case AMCTXNODATABUFFER:     return ( UCHAR * ) &athMac->txNoDataBuffer;
+    case AMCTXNOMGMTBUFFER:     return ( UCHAR * ) &athMac->txNoMgmtBuffer;
+    case AMCTXEXCESSIVERETRIES: return ( UCHAR * ) &athMac->txExcessiveRetries;
+    case AMCTXFIFOUNDERRUN:     return ( UCHAR * ) &athMac->txFifoUnderRun;
+    case AMCTXFILTERED:         return ( UCHAR * ) &athMac->txFiltered;
+    case AMCTXSHORTRETRIES:     return ( UCHAR * ) &athMac->txShortRetries;
+    case AMCTXLONGRETRIES:      return ( UCHAR * ) &athMac->txLongRetries;
+    case AMCTXBADRATE:          return ( UCHAR * ) &athMac->txBadRate;
+    case AMCTXNOACK:            return ( UCHAR * ) &athMac->txNoAck;
+    case AMCTXRTS:              return ( UCHAR * ) &athMac->txRts;
+    case AMCTXCTS:              return ( UCHAR * ) &athMac->txCts;
+    case AMCTXSHORTPREAMBLE:    return ( UCHAR * ) &athMac->txShortPreamble;
+    case AMCTXRSSI:             return ( UCHAR * ) &athMac->txRssi;
+    case AMCTXRSSIDELTA:        return ( UCHAR * ) &athMac->txRssiDelta;
+    case AMCRXDESCOVERRUN:      return ( UCHAR * ) &athMac->rxDescOverRun;
+    case AMCRXFRAMETOOSHORT:    return ( UCHAR * ) &athMac->rxFrameTooShort;
+    case AMCRXCRCERROR:         return ( UCHAR * ) &athMac->rxCrcError;
+    case AMCRXFIFOOVERRUN:      return ( UCHAR * ) &athMac->rxFifoOverRun;
+    case AMCRXCRYPTFAILURE:     return ( UCHAR * ) &athMac->rxCryptFailure;
+    case AMCRXNOSKBUFFER:       return ( UCHAR * ) &athMac->rxNoSkBuffer;
+    case AMCRXRSSI:             return ( UCHAR * ) &athMac->rxRssi;
+    case AMCRXRSSIDELTA:        return ( UCHAR * ) &athMac->rxRssiDelta;
+    case AMCNOBEACONBUFFER:     return ( UCHAR * ) &athMac->noBeaconBuffer;
+    case AMCCALIBRATIONS:       return ( UCHAR * ) &athMac->calibrations;
+    case AMCFAILEDCALIBRATIONS: return ( UCHAR * ) &athMac->failedCalibrations;
+    case AMCRFGAINRESETS:       return ( UCHAR * ) &athMac->rfGainResets;
+    case AMCRATECONTROLCHECKS:  return ( UCHAR * ) &athMac->rateControlChecks;
+    case AMCRATECONTROLRAISE:   return ( UCHAR * ) &athMac->rateControlRaise;
+    case AMCRATECONTROLDROP:    return ( UCHAR * ) &athMac->rateControlDrop;
+
+    default:
+      ERROR_MSG ( "" );
+  }
+
+  return NULL;
+}
+
+/****************************************************************************
+*                                                                           *
+*   var_athPhyCountersTable() -                                             *
+*                                                                           *
+****************************************************************************/
+unsigned char *
+var_athPhyCountersTable ( struct variable *vp,
+                    	    oid     *name,
+    	                    size_t  *length,
+    	                    int     exact,
+    	                    size_t  *var_len,
+    	                    WriteMethod **write_method)
+{
+  int found = FALSE;
+  oid rName [ MAX_OID_LEN ];                            // OID to be returned
+
+  loadTables();
+  memcpy (( char * ) rName, ( char * ) vp->name, ( int ) vp->namelen * sizeof ( oid ));
+  for ( np = LIST_FIRST ( &athPhyList ); np != NULL; np = LIST_NEXT ( np, nodes )) {
+    athPhy = ( struct athPhyTbl_data * ) np->data;
+    rName[vp->namelen] = athPhy->ifIndex;
+    if ((  exact && ( snmp_oid_compare ( rName, vp->namelen + 1, name, *length ) == 0 )) || 
+        ( !exact && ( snmp_oid_compare ( rName, vp->namelen + 1, name, *length ) >  0 ))) {
+      found = TRUE;
+      break;
+    }
+  }
+
+  if ( !found ) 
+    return NULL;
+
+  memcpy (( char * ) name, ( char * ) rName, ( vp->namelen + 1 ) * sizeof ( oid ));
+  *length = vp->namelen + 1;
+  *var_len = sizeof ( long );
+  *write_method = NULL;
+
+  switch ( vp->magic ) {
+
+    case APCTOTALPHYERRORS:     return ( UCHAR * ) &athPhy->totalPhyErrors;
+    case APCTXUNDERRUN:         return ( UCHAR * ) &athPhy->txUnderRun;
+    case APCTIMINGERRORS:       return ( UCHAR * ) &athPhy->timingErrors;
+    case APCPARITYERRORS:       return ( UCHAR * ) &athPhy->parityErrors;
+    case APCINVALIDRATE:        return ( UCHAR * ) &athPhy->invalidRate;
+    case APCINVALIDLENGTH:      return ( UCHAR * ) &athPhy->invalidLength;
+    case APCRADARDETECTED:      return ( UCHAR * ) &athPhy->radarDetected;
+    case APCINVALIDSERVICE:     return ( UCHAR * ) &athPhy->invalidService;
+    case APCTXOVERRIDERX:       return ( UCHAR * ) &athPhy->txOverrideRx;
+    case APCOFDMTIMING:         return ( UCHAR * ) &athPhy->OfdmTiming;
+    case APCOFDMSIGNALPARITY:   return ( UCHAR * ) &athPhy->OfdmSignalParity;
+    case APCOFDMINVALIDRATE:    return ( UCHAR * ) &athPhy->OfdmInvalidRate;
+    case APCOFDMINVALIDLENGTH:  return ( UCHAR * ) &athPhy->OfdmInvalidLength;
+    case APCOFDMPOWERDROP:      return ( UCHAR * ) &athPhy->OfdmPowerDrop;
+    case APCOFDMSERVICE:        return ( UCHAR * ) &athPhy->OfdmService;
+    case APCOFDMRESTART:        return ( UCHAR * ) &athPhy->OfdmRestart;
+    case APCCCKTIMING:          return ( UCHAR * ) &athPhy->CckTiming;
+    case APCCCKHEADERCRC:       return ( UCHAR * ) &athPhy->CckHeaderCrc;
+    case APCCCKINVALIDRATE:     return ( UCHAR * ) &athPhy->CckInvalidRate;
+    case APCCCKSERVICE:         return ( UCHAR * ) &athPhy->CckService;
+    case APCCCKRESTART:         return ( UCHAR * ) &athPhy->CckRestart;
+
+    default:
+      ERROR_MSG ( "" );
+  }
+
+  return NULL;
+}
+
+/****************************************************************************
+*                                                                           *
+*                     loadTables() - Load the Tables                        *
+*                                                                           *
+****************************************************************************/
+static void loadTables()
+{
+  int skfd;                                       // generic raw socket desc
+  struct iwreq wrq;                               // ioctl request structure
+  struct ifreq ifr;
+  struct timeval et;                              // elapsed time
+  struct wireless_info info;                      // workarea for wireless ioctl info
+  FILE *fp;
+  char  bfr[1024], ifName[1024];
+  char *s, *t;
+
+  gettimeofday ( &et, ( struct timezone * ) 0 );  // get time-of-day
+  if ( et.tv_sec < lastLoad + MINLOADFREQ )       // only reload so often
+    return;
+  lastLoad = et.tv_sec;
+
+//printf ( "%s %s\n", "avc802dot11.c", " - loadTables()" );
+  skfd = openSocket();                            // open socket
+  if ( skfd < 0 ) {
+    syslog ( LOG_ERR, "SNMP avc802dot11.loadTables() - %s\n", "socket open failure" );
+    return;
+  }
+
+  flushLists();
+
+  // find interfaces in /proc/net/dev and find the wireless interfaces
+  fp = fopen ( PROC_NET_DEV, "r" );
+  if ( fp ) {
+    while ( fgets ( bfr, sizeof ( bfr ), fp )) {
+      if ( strstr ( bfr, ":" )) {
+        s = bfr; t = ifName;
+        while ( isspace ( *s ))                     // discard white space
+          *s++;
+        while ( *s != ':' )                         // get interface name
+          *t++ = *s++;
+        *t = '\0';
+
+        // verify as a wireless device
+        memset (( char * ) &info, 0, sizeof ( struct wireless_info ));
+        strncpy ( wrq.ifr_name, ifName, IFNAMSIZ );
+        if ( ioctl ( skfd, SIOCGIWNAME, &wrq ) >= 0 ) {
+          initStructs();
+          loadWiExt ( skfd, ifName, &info );
+          displayWiExt ( info );
+          if ( strstr ( ifName, "wlan" )) 
+            loadPrismIfStruct ( skfd, ifName, &info );
+        }
+      }
+    }
+    fclose ( fp );
+  }
+
+  loadHostAPClients();
+  loadMadWiFiStats();
+}
+
+/****************************************************************************
+*                                                                           *
+*              loadHostAPClients() - Load associated clients                *
+*                                                                           *
+****************************************************************************/
+static void loadHostAPClients()
+{
+  int i;
+  DIR *dp;
+  FILE *fp;
+  char name[512], path[512], bfr[1024];
+  struct dirent *dir;
+
+  for ( i = 0; i < MAXRADIOS; i++ ) {
+    memset (( char * ) &nPrAc, 0, sizeof ( nPrAc ));
+    nPrAc.supports1Mbps = 2;                  // 2 => false
+    nPrAc.supports2Mbps = 2;
+    nPrAc.supports5Mbps = 2;
+    nPrAc.supports11Mbps = 2;
+    sprintf ( nPrAc.ifName, "wlan%d\0", i );
+    sprintf ( path, "%s/%s/", HOSTAPPATH, nPrAc.ifName );
+    dp = opendir ( path );                    // open directory
+    if ( dp ) { 
+      while  ( dir = readdir ( dp )) {        // loop thru directory entries
+        if ( isMACAddress ( dir->d_name )) {  // name look like MAC address?
+
+          sprintf ( name, "%s/%s", path, dir->d_name );
+//        printf ( " ===> %s - name: %s <=== \n", "loadTables()", name );
+
+          nPrAc.ifIndex = if_nametoindex ( nPrAc.ifName );
+//        nPrAc.ifIndex = i + 1;                              // XXX - for testing //
+          strcpy ( nPrAc.macAddress, dir->d_name );
+          strtoupper ( nPrAc.macAddress );
+          sprintf ( nPrAc.UID, "%04d %s\0", nPrAc.ifIndex, nPrAc.macAddress );
+
+          fp = fopen ( name, "r" );
+          if ( fp ) {
+            while ( !feof ( fp )) {
+              if ( fgets ( bfr, sizeof ( bfr ) - 1, fp )) {
+                strtok (( char * ) &bfr, "\n" );          // '\n' => '\0'
+//              printf ( "%s\n", bfr );
+
+                if ( strstr ( bfr, MBPS1 ))
+                  nPrAc.supports1Mbps = 1;
+                if ( strstr ( bfr, MBPS2 ))
+                  nPrAc.supports2Mbps = 1;
+                if ( strstr ( bfr, MBPS5 ))
+                  nPrAc.supports5Mbps = 1;
+                if ( strstr ( bfr, MBPS11 ))
+                  nPrAc.supports11Mbps = 1;
+
+                if ( strstr ( bfr, SILENCE ))
+                  sscanf ( bfr, "last_rx: silence=%d signal=%d rate=%d flow=%d",
+                            &nPrAc.lastRxSilence, &nPrAc.lastRxSignal,
+                            &nPrAc.lastRxRate,    &nPrAc.lastRxFlow     );
+
+                if ( strstr ( bfr, AP )) 
+                  nPrAc.stationType = 2;
+                else if ( strstr ( bfr, STA )) 
+                  nPrAc.stationType = 1;
+                else if ( strstr ( bfr, LISTENINTERVAL ))
+                  nPrAc.listenInterval = atol ( &bfr [ strlen ( LISTENINTERVAL )]);
+                else if ( strstr ( bfr, JIFFIES ))
+                  nPrAc.jiffies= atol ( &bfr [ strlen ( JIFFIES )]);
+                else if ( strstr ( bfr, LASTAUTH ))
+                  nPrAc.lastAuth= atol ( &bfr [ strlen ( LASTAUTH )]);
+                else if ( strstr ( bfr, LASTASSOC ))
+                  nPrAc.lastAssoc= atol ( &bfr [ strlen ( LASTASSOC )]);
+                else if ( strstr ( bfr, LASTRX ))
+                  nPrAc.lastRx = atol ( &bfr [ strlen ( LASTRX )]);
+                else if ( strstr ( bfr, LASTTX ))
+                  nPrAc.lastTx = atol ( &bfr [ strlen ( LASTTX )]);
+                else if ( strstr ( bfr, RXPACKETS ))
+                  nPrAc.rxPackets = atol ( &bfr [ strlen ( RXPACKETS )]);
+                else if ( strstr ( bfr, TXPACKETS ))
+                  nPrAc.txPackets = atol ( &bfr [ strlen ( TXPACKETS )]);
+                else if ( strstr ( bfr, RXBYTES ))
+                  nPrAc.rxBytes = atoll ( &bfr [ strlen ( RXBYTES )]);
+                else if ( strstr ( bfr, TXBYTES ))
+                  nPrAc.txBytes = atoll ( &bfr [ strlen ( TXBYTES )]);
+                else if ( strstr ( bfr, BFRCNT ))
+                  nPrAc.bfrCnt = atol ( &bfr [ strlen ( BFRCNT )]);
+                else if ( strstr ( bfr, TXRATE ))
+                  nPrAc.txRate = atol ( &bfr [ strlen ( TXRATE )]);
+                else if ( strstr ( bfr, TX1M ))
+                  nPrAc.tx1Mbps = atol ( &bfr [ strlen ( TX1M )]);
+                else if ( strstr ( bfr, TX2M ))
+                  nPrAc.tx2Mbps = atol ( &bfr [ strlen ( TX2M )]);
+                else if ( strstr ( bfr, TX5M ))
+                  nPrAc.tx5Mbps = atol ( &bfr [ strlen ( TX5M )]);
+                else if ( strstr ( bfr, TX11M ))
+                  nPrAc.tx11Mbps = atol ( &bfr [ strlen ( TX11M )]);
+                else if ( strstr ( bfr, RX1M ))
+                  nPrAc.rx1Mbps = atol ( &bfr [ strlen ( RX1M )]);
+                else if ( strstr ( bfr, RX2M ))
+                  nPrAc.rx2Mbps = atol ( &bfr [ strlen ( RX2M )]);
+                else if ( strstr ( bfr, RX5M ))
+                  nPrAc.rx5Mbps = atol ( &bfr [ strlen ( RX5M )]);
+                else if ( strstr ( bfr, RX11M ))
+                  nPrAc.rx11Mbps = atol ( &bfr [ strlen ( RX11M )]);
+              }
+            }
+            addList (( char * ) &prAcList, ( char * ) &nPrAc, sizeof ( nPrAc ));
+//          printf ( "ifName: %s ifIndex: %d macAddress: %s stationType: %d UID: %s\n", 
+//                      nPrAc.ifName, nPrAc.ifIndex, nPrAc.macAddress, 
+//                      nPrAc.stationType, nPrAc.UID );
+            fclose ( fp );
+          }
+        }
+      }
+      closedir ( dp );                        // close directory file
+    }
+  }
+}
+
+/****************************************************************************
+*                                                                           *
+*              loadMadWiFiStats() - load MadWiFi stats                      *
+*                                                                           *
+****************************************************************************/
+static void loadMadWiFiStats()
+{
+  int i;
+  FILE *fp;
+  char name[512], path[512], bfr[1024];
+
+//some day the driver will support more than one radio
+//for ( i = 0; i < MAXRADIOS; i++ ) {
+    memset (( char * ) &nAthMac, 0, sizeof ( nAthMac ));
+    memset (( char * ) &nAthPhy, 0, sizeof ( nAthPhy ));
+    sprintf ( nAthMac.ifName, "ath0\0" );
+    sprintf ( nAthPhy.ifName, "ath0\0" );
+    sprintf ( path, "%s/%s/", MADWIFIPATH, "ath" );
+//  sprintf ( nAthMac.ifName, "ath%d\0", i );
+//  sprintf ( nAthPhy.ifName, "ath%d\0", i );
+//  sprintf ( path, "%s/%s/", MADWIFIPATH, nAthMac.ifName );
+    sprintf ( name, "%s/%s", path, "stats" );
+//  printf ( "%s - name: %s\n", "loadMadWiFiStats()", name );
+
+    fp = fopen ( name, "r" );
+    if ( fp ) {
+
+      nAthMac.ifIndex = if_nametoindex ( nAthMac.ifName );
+      nAthPhy.ifIndex = if_nametoindex ( nAthPhy.ifName );
+//    nAthMac.ifIndex = i + 1;                              // XXX - for testing //
+//    nAthPhy.ifIndex = i + 1;                              // XXX - for testing //
+      sprintf ( nAthMac.UID, "%04d\0", nAthMac.ifIndex );
+      sprintf ( nAthPhy.UID, "%04d\0", nAthPhy.ifIndex );
+
+      while ( !feof ( fp )) {
+        if ( fgets ( bfr, sizeof ( bfr ) - 1, fp )) {
+          strtok (( char * ) &bfr, "\n" );                  // '\n' => '\0'
+//        printf ( "%s\n", bfr );
+
+          if ( strstr ( bfr, WATCHDOG ))
+            nAthMac.watchDog = atol ( &bfr [ strlen ( WATCHDOG )]);
+          else if ( strstr ( bfr, HARDWARE ))
+            nAthMac.fatalHwInterrupt = atol ( &bfr [ strlen ( HARDWARE )]);
+          else if ( strstr ( bfr, BMISS ))
+            nAthMac.missedBeacons = atol ( &bfr [ strlen ( BMISS )]);
+          else if ( strstr ( bfr, RXORN ))
+            nAthMac.rxOverRun = atol ( &bfr [ strlen ( RXORN )]);
+          else if ( strstr ( bfr, RXEOL ))
+            nAthMac.rxEol = atol ( &bfr [ strlen ( RXEOL )]);
+          else if ( strstr ( bfr, TXURN ))
+            nAthMac.txUnderRun = atol ( &bfr [ strlen ( TXURN )]);
+          else if ( strstr ( bfr, TX_MGMT ))
+            nAthMac.txMgmtFrames = atol ( &bfr [ strlen ( TX_MGMT )]);
+          else if ( strstr ( bfr, TX_DISCARD ))
+            nAthMac.txDiscards = atol ( &bfr [ strlen ( TX_DISCARD )]);
+          else if ( strstr ( bfr, TX_INVALID ))
+            nAthMac.txInvalid = atol ( &bfr [ strlen ( TX_INVALID )]);
+          else if ( strstr ( bfr, TX_QSTOP ))
+            nAthMac.txQueueStopped = atol ( &bfr [ strlen ( TX_QSTOP )]);
+          else if ( strstr ( bfr, TX_ENCAP ))
+            nAthMac.txEncapFailed = atol ( &bfr [ strlen ( TX_ENCAP )]);
+          else if ( strstr ( bfr, TX_NONODE ))
+            nAthMac.txNoNode = atol ( &bfr [ strlen ( TX_NONODE )]);
+          else if ( strstr ( bfr, TX_NOBUF ))
+            nAthMac.txNoNode = atol ( &bfr [ strlen ( TX_NOBUF )]);
+          else if ( strstr ( bfr, TX_NOBUFMGT ))
+            nAthMac.txNoMgmtBuffer = atol ( &bfr [ strlen ( TX_NOBUFMGT )]);
+          else if ( strstr ( bfr, TX_XRETRIES ))
+            nAthMac.txExcessiveRetries = atol ( &bfr [ strlen ( TX_XRETRIES )]);
+          else if ( strstr ( bfr, TX_FIFOERR ))
+            nAthMac.txFifoUnderRun = atol ( &bfr [ strlen ( TX_FIFOERR )]);
+          else if ( strstr ( bfr, TX_FILTERED ))
+            nAthMac.txFiltered = atol ( &bfr [ strlen ( TX_FILTERED )]);
+          else if ( strstr ( bfr, TX_SHORTRETRY ))
+            nAthMac.txShortRetries = atol ( &bfr [ strlen ( TX_SHORTRETRY )]);
+          else if ( strstr ( bfr, TX_LONGRETRY ))
+            nAthMac.txLongRetries = atol ( &bfr [ strlen ( TX_LONGRETRY )]);
+          else if ( strstr ( bfr, TX_BADRATE ))
+            nAthMac.txBadRate = atol ( &bfr [ strlen ( TX_BADRATE )]);
+          else if ( strstr ( bfr, TX_NOACK ))
+            nAthMac.txNoAck = atol ( &bfr [ strlen ( TX_NOACK )]);
+          else if ( strstr ( bfr, TX_RTS ))
+            nAthMac.txRts = atol ( &bfr [ strlen ( TX_RTS )]);
+          else if ( strstr ( bfr, TX_CTS ))
+            nAthMac.txCts = atol ( &bfr [ strlen ( TX_CTS )]);
+          else if ( strstr ( bfr, TX_SHORTPRE ))
+            nAthMac.txShortPreamble = atol ( &bfr [ strlen ( TX_SHORTPRE )]);
+          else if ( strstr ( bfr, TX_RSSI ))
+            nAthMac.txRssi = atol ( &bfr [ strlen ( TX_RSSI )]);
+          else if ( strstr ( bfr, TX_RSSIDELTA ))
+            nAthMac.txRssiDelta = atol ( &bfr [ strlen ( TX_RSSIDELTA )]);
+          else if ( strstr ( bfr, RX_ORN ))
+            nAthMac.rxOverRun = atol ( &bfr [ strlen ( RX_ORN )]);
+          else if ( strstr ( bfr, RX_TOOSHORT ))
+            nAthMac.rxFrameTooShort = atol ( &bfr [ strlen ( RX_TOOSHORT )]);
+          else if ( strstr ( bfr, RX_CRCERR ))
+            nAthMac.rxCrcError = atol ( &bfr [ strlen ( RX_CRCERR )]);
+          else if ( strstr ( bfr, RX_FIFOERR ))
+            nAthMac.rxFifoOverRun = atol ( &bfr [ strlen ( RX_FIFOERR )]);
+          else if ( strstr ( bfr, RX_BADCRYPT ))
+            nAthMac.rxCryptFailure = atol ( &bfr [ strlen ( RX_BADCRYPT )]);
+          else if ( strstr ( bfr, RX_BADCRYPT ))
+            nAthMac.rxCryptFailure = atol ( &bfr [ strlen ( RX_BADCRYPT )]);
+          else if ( strstr ( bfr, RX_NOBUF ))
+            nAthMac.rxNoSkBuffer = atol ( &bfr [ strlen ( RX_NOBUF )]);
+          else if ( strstr ( bfr, RX_RSSI ))
+            nAthMac.rxRssi = atol ( &bfr [ strlen ( RX_RSSI )]);
+          else if ( strstr ( bfr, RX_RSSIDELTA ))
+            nAthMac.rxRssiDelta = atol ( &bfr [ strlen ( RX_RSSIDELTA )]);
+          else if ( strstr ( bfr, BE_NOBUF ))
+            nAthMac.noBeaconBuffer = atol ( &bfr [ strlen ( BE_NOBUF )]);
+          else if ( strstr ( bfr, PER_CAL ))
+            nAthMac.calibrations = atol ( &bfr [ strlen ( PER_CAL )]);
+          else if ( strstr ( bfr, PER_CALFAIL ))
+            nAthMac.failedCalibrations = atol ( &bfr [ strlen ( PER_CALFAIL )]);
+          else if ( strstr ( bfr, PER_RFGAIN ))
+            nAthMac.rfGainResets = atol ( &bfr [ strlen ( PER_RFGAIN )]);
+          else if ( strstr ( bfr, RATE_CALLS ))
+            nAthMac.rateControlChecks = atol ( &bfr [ strlen ( RATE_CALLS )]);
+          else if ( strstr ( bfr, RATE_RAISE ))
+            nAthMac.rateControlRaise = atol ( &bfr [ strlen ( RATE_RAISE )]);
+          else if ( strstr ( bfr, RATE_DROP ))
+            nAthMac.rateControlDrop = atol ( &bfr [ strlen ( RATE_DROP )]);
+
+          else if ( strstr ( bfr, RX_PHYERR ))
+            nAthPhy.totalPhyErrors = atol ( &bfr [ strlen ( RX_PHYERR )]);
+          else if ( strstr ( bfr, PHYERR_UNDERRUN ))
+            nAthPhy.txUnderRun = atol ( &bfr [ strlen ( PHYERR_UNDERRUN )]);
+          else if ( strstr ( bfr, PHYERR_TIMING ))
+            nAthPhy.timingErrors = atol ( &bfr [ strlen ( PHYERR_TIMING )]);
+          else if ( strstr ( bfr, PHYERR_PARITY ))
+            nAthPhy.parityErrors = atol ( &bfr [ strlen ( PHYERR_PARITY )]);
+          else if ( strstr ( bfr, PHYERR_RATE ))
+            nAthPhy.invalidRate = atol ( &bfr [ strlen ( PHYERR_RATE )]);
+          else if ( strstr ( bfr, PHYERR_LENGTH ))
+            nAthPhy.invalidLength = atol ( &bfr [ strlen ( PHYERR_LENGTH )]);
+          else if ( strstr ( bfr, PHYERR_RADAR ))
+            nAthPhy.radarDetected = atol ( &bfr [ strlen ( PHYERR_RADAR )]);
+          else if ( strstr ( bfr, PHYERR_SERVICE ))
+            nAthPhy.invalidService = atol ( &bfr [ strlen ( PHYERR_SERVICE )]);
+          else if ( strstr ( bfr, PHYERR_TOR ))
+            nAthPhy.txOverrideRx = atol ( &bfr [ strlen ( PHYERR_TOR )]);
+          else if ( strstr ( bfr, PHYERR_OFDM_TIMING )) 
+            nAthPhy.OfdmTiming = atol ( &bfr [ strlen ( PHYERR_OFDM_TIMING )]);
+          else if ( strstr ( bfr, PHYERR_OFDM_SIGNAL_PARITY ))
+            nAthPhy.OfdmSignalParity = atol ( &bfr [ strlen ( PHYERR_OFDM_SIGNAL_PARITY )]);
+          else if ( strstr ( bfr, PHYERR_OFDM_RATE_ILLEGAL ))
+            nAthPhy.OfdmInvalidRate = atol ( &bfr [ strlen ( PHYERR_OFDM_RATE_ILLEGAL )]);
+          else if ( strstr ( bfr, PHYERR_OFDM_LENGTH_ILLEGAL ))
+            nAthPhy.OfdmInvalidLength = atol ( &bfr [ strlen ( PHYERR_OFDM_LENGTH_ILLEGAL )]);
+          else if ( strstr ( bfr, PHYERR_OFDM_POWER_DROP ))
+            nAthPhy.OfdmPowerDrop = atol ( &bfr [ strlen ( PHYERR_OFDM_POWER_DROP )]);
+          else if ( strstr ( bfr, PHYERR_OFDM_SERVICE ))
+            nAthPhy.OfdmService = atol ( &bfr [ strlen ( PHYERR_OFDM_SERVICE )]);
+          else if ( strstr ( bfr, PHYERR_OFDM_RESTART ))
+            nAthPhy.OfdmRestart = atol ( &bfr [ strlen ( PHYERR_OFDM_RESTART )]);
+          else if ( strstr ( bfr, PHYERR_CCK_TIMING ))
+            nAthPhy.CckTiming = atol ( &bfr [ strlen ( PHYERR_CCK_TIMING )]);
+          else if ( strstr ( bfr, PHYERR_CCK_HEADER_CRC ))
+            nAthPhy.CckHeaderCrc = atol ( &bfr [ strlen ( PHYERR_CCK_HEADER_CRC )]);
+          else if ( strstr ( bfr, PHYERR_CCK_RATE_ILLEGAL ))
+            nAthPhy.CckInvalidRate = atol ( &bfr [ strlen ( PHYERR_CCK_RATE_ILLEGAL )]);
+          else if ( strstr ( bfr, PHYERR_CCK_SERVICE ))
+            nAthPhy.CckService = atol ( &bfr [ strlen ( PHYERR_CCK_SERVICE )]);
+          else if ( strstr ( bfr, PHYERR_CCK_RESTART ))
+            nAthPhy.CckRestart = atol ( &bfr [ strlen ( PHYERR_CCK_RESTART )]);
+        }
+      }
+      fclose ( fp );
+      addList (( char * ) &athMacList, ( char * ) &nAthMac, sizeof ( nAthMac ));
+      addList (( char * ) &athPhyList, ( char * ) &nAthPhy, sizeof ( nAthPhy ));
+    }
+//}
+}
+
+/****************************************************************************
+*                                                                           *
+*         loadPrismIfStruct() - load the Prism Interface structure          *
+*                                                                           *
+****************************************************************************/
+static void 
+loadPrismIfStruct ( int skfd, char *ifName, struct wireless_info *wi )
+{
+  int rc, ifIndex = 0;
+  struct ifreq ifr;
+  char path[512];
+  DIR *dp;
+  struct dirent *dir;
+
+  strcpy ( ifr.ifr_name, ifName );
+  rc = ioctl ( skfd, SIOCGIFHWADDR, &ifr );
+  if ( rc >= 0 ) {
+    ifIndex = if_nametoindex ( ifName );
+    if ( !ifIndex ) {
+      syslog ( LOG_ERR, "SNMP %s - %s %s\n", 
+        "avc802dot11.loadPrismIfStruct()", ifName, "has no ifIndex" );
+      return;
+    }
+
+    nPrIf.ifIndex = ifIndex;
+    sprintf ( nPrIf.UID, "%04d\0", nPrIf.ifIndex );
+    strcpy ( nPrIf.ifName, ifName );
+    if ( wi->has_stats ) {
+      nPrIf.signal  = wi->stats.qual.level;
+      nPrIf.noise   = wi->stats.qual.noise;
+      nPrIf.quality = wi->stats.qual.qual;
+    }
+
+    sprintf ( path, "%s/%s/", HOSTAPPATH, nPrIf.ifName );
+    dp = opendir ( path );                    // open directory
+    if ( dp ) { 
+      while  ( dir = readdir ( dp )) {        // loop thru directory entries
+        if ( isMACAddress ( dir->d_name ))    // name look like MAC address?
+          nPrIf.assocCnt++;
+      }
+      closedir ( dp );                        // close directory file
+    }
+
+    addList (( char * ) &prIfList, ( char * ) &nPrIf, sizeof ( nPrIf ));
+  }
+}
+
+/****************************************************************************
+*                                                                           *
+*                     initStructs() - initialize structures                 *
+*                                                                           *
+****************************************************************************/
+static void initStructs()
+{
+  int i;
+
+  // Prism Interface Stucture
+  memset (( char * ) &nPrIf, 0, sizeof ( nPrIf ));
+
+  // Wireless Extensions
+  wepCurrentKey = 0;
+  haveWepCurrentKey = FALSE;
+  for ( i = 0; i < MAX_WEP_KEYS; i++ ) {
+    prWep[i].len = 0;
+    prWep[i].key[0] = '\0';
+    prWep[i].haveKey = FALSE;
+  }
+}
+
+/****************************************************************************
+*                                                                           *
+*                Wireless Extensions Specific Functions                     *
+*                                                                           *
+****************************************************************************/
+/****************************************************************************
+*                                                                           *
+*      loadWiExt() - load wireless extensions structures;                   *
+*                    use ioctl calls and read /proc/net/wireless            *
+*                                                                           *
+****************************************************************************/
+static void loadWiExt ( int skfd, char *ifname, struct wireless_info *wi )
+{
+  struct iwreq wrq;                       // ioctl request structure
+  FILE *fp;
+  char  bfr[1024];
+  char  buffer[sizeof ( iwrange ) * 2]; /* Large enough */
+  char *s, *t;
+  int i, j;
+
+  strncpy ( wrq.ifr_name, ifname, IFNAMSIZ );
+
+  /* Get wireless name */
+  if ( ioctl ( skfd, SIOCGIWNAME, &wrq ) >= 0 ) {
+    strncpy ( wi->name, wrq.u.name, IFNAMSIZ );
+    wi->name[IFNAMSIZ] = '\0';
+  }
+
+  /* Get ranges */    // NOTE: some version checking in iwlib.c
+  memset ( buffer, 0, sizeof ( buffer ));
+  wrq.u.data.pointer = ( caddr_t ) &buffer;
+  wrq.u.data.length = sizeof ( buffer );
+  wrq.u.data.flags = 0;
+  if ( ioctl ( skfd, SIOCGIWRANGE, &wrq ) >= 0 ) {
+    memcpy (( char * ) &wi->range, buffer, sizeof ( iwrange ));
+    wi->has_range = 1;
+  }
+
+  /* Get network ID */
+  if ( ioctl ( skfd, SIOCGIWNWID, &wrq ) >= 0 ) {
+    memcpy ( &wi->nwid, &wrq.u.nwid, sizeof ( iwparam ));
+    wi->has_nwid = 1;
+  }
+
+  /* Get frequency / channel */         // THIS NUMBER LOOKS FUNNY
+  if ( ioctl ( skfd, SIOCGIWFREQ, &wrq ) >= 0 ) {
+    wi->has_freq = 1;
+    wi->freq = (( double ) wrq.u.freq.m ) * pow ( 10, wrq.u.freq.e );
+  }
+
+  /* Get sensitivity */
+  if ( ioctl ( skfd, SIOCGIWSENS, &wrq ) >= 0 ) {
+    wi->has_sens = 1;
+    memcpy ( &wi->sens, &wrq.u.sens, sizeof ( iwparam ));
+  }
+
+  /* Get encryption information */
+  wrq.u.data.pointer = ( caddr_t ) &wi->key;
+  wrq.u.data.length = IW_ENCODING_TOKEN_MAX;
+  wrq.u.data.flags = 0;
+  if ( ioctl ( skfd, SIOCGIWENCODE, &wrq ) >= 0 ) {
+    wi->has_key = 1;
+    wi->key_size = wrq.u.data.length;
+    wi->key_flags = wrq.u.data.flags;
+    wepCurrentKey = wrq.u.data.flags & IW_ENCODE_INDEX;
+  }
+
+  for ( i = 0; i < wi->range.max_encoding_tokens; i++ ) {
+    wrq.u.data.pointer = ( caddr_t ) &wi->key;
+    wrq.u.data.length = IW_ENCODING_TOKEN_MAX;
+    wrq.u.data.flags = i;
+    if ( ioctl ( skfd, SIOCGIWENCODE, &wrq ) >= 0 ) {
+      if ( ( wrq.u.data.length != 0 ) &&
+          !( wrq.u.data.flags & IW_ENCODE_DISABLED )) {
+        prWep[i].len = wrq.u.data.length;
+        prWep[i].haveKey = TRUE;
+        t = prWep[i].key;
+        for ( j = 0; j < wrq.u.data.length; j++ ) {
+          if (( j & 0x1 ) == 0 && j != 0 )
+        	  strcpy ( t++, "-");
+          sprintf ( t, "%.2X", wi->key[j] );
+          t += 2;
+        }
+        t = '\0';
+      }
+    }
+  }
+
+  /* Get ESSID */
+  wrq.u.essid.pointer = ( caddr_t ) &wi->essid;
+  wrq.u.essid.length = IW_ESSID_MAX_SIZE + 1;
+  wrq.u.essid.flags = 0;
+  if ( ioctl ( skfd, SIOCGIWESSID, &wrq ) >= 0 ) {
+    wi->has_essid = 1;
+    wi->essid_on = wrq.u.data.flags;
+  }
+
+  /* Get AP address */
+  if ( ioctl ( skfd, SIOCGIWAP, &wrq ) >= 0 ) {
+    wi->has_ap_addr = 1;
+    memcpy ( &wi->ap_addr, &wrq.u.ap_addr, sizeof ( sockaddr ));
+  }
+
+  /* Get NickName */
+  wrq.u.essid.pointer = ( caddr_t ) &wi->nickname;
+  wrq.u.essid.length = IW_ESSID_MAX_SIZE + 1;
+  wrq.u.essid.flags = 0;
+  if ( ioctl ( skfd, SIOCGIWNICKN, &wrq ) >= 0 ) {
+    if ( wrq.u.data.length > 1 )
+      wi->has_nickname = 1;
+  }
+
+  /* Get bit rate */
+  if ( ioctl ( skfd, SIOCGIWRATE, &wrq ) >= 0 ) {
+    wi->has_bitrate = 1;
+    memcpy ( &wi->bitrate, &wrq.u.bitrate, sizeof ( iwparam ));
+  }
+
+  /* Get RTS threshold */
+  if ( ioctl ( skfd, SIOCGIWRTS, &wrq ) >= 0 ) {
+    wi->has_rts = 1;
+    memcpy ( &wi->rts, &wrq.u.rts, sizeof ( iwparam ));
+  }
+
+  /* Get fragmentation threshold */
+  if ( ioctl ( skfd, SIOCGIWFRAG, &wrq ) >= 0 ) {
+      wi->has_frag = 1;
+      memcpy ( &wi->frag, &wrq.u.frag, sizeof ( iwparam ));
+    }
+
+  /* Get operation mode */
+  if ( ioctl ( skfd, SIOCGIWMODE, &wrq ) >= 0 ) {
+      wi->mode = wrq.u.mode;
+      if ( wi->mode < IW_NUM_OPER_MODE && wi->mode >= 0 )
+        wi->has_mode = 1;
+  }
+
+  /* Get Power Management settings */                 // #if WIRELESS_EXT > 9
+  wrq.u.power.flags = 0;
+  if ( ioctl ( skfd, SIOCGIWPOWER, &wrq ) >= 0 ) {
+    wi->has_power = 1;
+    memcpy ( &wi->power, &wrq.u.power, sizeof ( iwparam ));
+  }
+
+  /* Get retry limit/lifetime */                      // #if WIRELESS_EXT > 10
+  if ( ioctl ( skfd, SIOCGIWRETRY, &wrq ) >= 0 ) {    
+    wi->has_retry = 1;
+    memcpy ( &wi->retry, &wrq.u.retry, sizeof ( iwparam ));
+  }
+
+  /* Get stats */                                     // #if WIRELESS_EXT > 11
+  wrq.u.data.pointer = ( caddr_t ) &wi->stats;
+  wrq.u.data.length = 0;
+  wrq.u.data.flags = 1;   /* Clear updated flag */
+  if ( ioctl ( skfd, SIOCGIWSTATS, &wrq ) < 0 )
+    wi->has_stats = 1;
+
+  if ( !wi->has_stats ) {                        // no ioctl support, go to file
+    fp = fopen ( PROC_NET_WIRELESS, "r" );
+    if ( fp ) {
+      while ( fgets ( bfr, sizeof ( bfr ), fp )) {
+        bfr [ sizeof ( bfr ) - 1 ] = '\0';        // no buffer overruns here!
+        strtok (( char * ) &bfr, "\n" );          // '\n' => '\0'
+        if ( strstr ( bfr, ifname ) && strstr ( bfr, ":" )) {
+          wi->has_stats = 1;
+          s = bfr;
+          s = strchr ( s, ':' ); s++;             /* Skip ethX:   */
+          s = strtok ( s, " " );                  /* ' ' => '\0'  */
+          sscanf ( s, "%X", &wi->stats.status ); // status 
+
+          s = strtok ( NULL, " " );               // link quality
+          if ( strchr ( s, '.' ) != NULL )
+            wi->stats.qual.updated |= 1;
+          sscanf ( s, "%d", &wi->stats.qual.qual );
+
+          s = strtok ( NULL, " " );               // signal level
+          if ( strchr ( s,'.' ) != NULL )
+            wi->stats.qual.updated |= 2;
+          sscanf ( s, "%d", &wi->stats.qual.level );
+
+          s = strtok ( NULL, " " );               // noise level
+          if ( strchr ( s, '.' ) != NULL )
+            wi->stats.qual.updated += 4;
+          sscanf ( s, "%d", &wi->stats.qual.noise );
+
+          s = strtok ( NULL, " " ); sscanf ( s, "%d", &wi->stats.discard.nwid     );
+          s = strtok ( NULL, " " ); sscanf ( s, "%d", &wi->stats.discard.code     );
+          s = strtok ( NULL, " " ); sscanf ( s, "%d", &wi->stats.discard.fragment );
+          s = strtok ( NULL, " " ); sscanf ( s, "%d", &wi->stats.discard.retries  );
+          s = strtok ( NULL, " " ); sscanf ( s, "%d", &wi->stats.discard.misc     );
+          s = strtok ( NULL, " " ); sscanf ( s, "%d", &wi->stats.miss.beacon      );
+        }
+      }
+      fclose ( fp );
+    }
+  }
+
+// printf ( "%s bfr: %s\n", "loadTables()", bfr );
+}
+
+/****************************************************************************
+*                                                                           *
+*       displayWiExt() - show what I got from Wireless Extensions           *
+*                                                                           *
+****************************************************************************/
+static void displayWiExt ( struct wireless_info info )
+{
+#ifdef DISPLAYWIEXT
+  int i;
+  char title[] = "displayWiExt() -";
+
+  printf ( "========================================================\n" );
+  printf ( "===> Wireless Extension IOCTL calls - avc802dot11.c <===\n" );
+  printf ( "========================================================\n" );
+
+  if ( strlen ( info.name ))
+    printf ( "%s name: %s\n", "SIOCGIWNAME", info.name );
+  else
+    printf ( "%s\n", "no info.name support" );
+
+  if ( info.has_nickname = 1 )
+    printf ( "%s nickname: %s\n", "SIOCGIWNICKN", info.nickname );
+  else
+    printf ( "%s %s\n", "SIOCGIWNICKN", " ===> no info.nickname support" );
+
+  if ( info.has_essid ) 
+    printf ( "%s essid_on: %d essid: %s\n", "SIOCGIWESSID", info.essid_on, info.essid );
+  else
+    printf ( "%s %s\n", "SIOCGIWESSID", " ===> no info.essid support" );
+
+  if ( info.has_range ) {
+    printf ( "%s throughput: %d\n",           "SIOCGIWRANGE", info.range.throughput );
+    printf ( "%s min_nwid: %d\n",             "SIOCGIWRANGE", info.range.min_nwid  );
+    printf ( "%s max_nwid: %d\n",             "SIOCGIWRANGE", info.range.max_nwid  );
+    printf ( "%s sensitivity: %d\n",          "SIOCGIWRANGE", info.range.sensitivity );
+    printf ( "%s num_bitrates: %d\n",         "SIOCGIWRANGE", info.range.num_bitrates );
+    for ( i = 0; i < info.range.num_bitrates; i++ ) 
+      printf ( "%s bitrate[%d]: %d\n",        "SIOCGIWRANGE", i, info.range.bitrate[i]  );
+    printf ( "%s min_rts: %d\n",              "SIOCGIWRANGE", info.range.min_rts );
+    printf ( "%s max_rts: %d\n",              "SIOCGIWRANGE", info.range.max_rts );
+    printf ( "%s min_frag: %d\n",             "SIOCGIWRANGE", info.range.min_frag );
+    printf ( "%s max_frag: %d\n",             "SIOCGIWRANGE", info.range.max_frag );
+    printf ( "%s min_pmp: %d\n",              "SIOCGIWRANGE", info.range.min_pmp );
+    printf ( "%s max_pmp: %d\n",              "SIOCGIWRANGE", info.range.max_pmp );
+    printf ( "%s min_pmt: %d\n",              "SIOCGIWRANGE", info.range.min_pmt );
+    printf ( "%s max_pmt: %d\n",              "SIOCGIWRANGE", info.range.max_pmt );
+    printf ( "%s pmp_flags: %d\n",            "SIOCGIWRANGE", info.range.pmp_flags );
+    printf ( "%s pmt_flags: %d\n",            "SIOCGIWRANGE", info.range.pmt_flags );
+    printf ( "%s pm_capa: %d\n",              "SIOCGIWRANGE", info.range.pm_capa );
+    printf ( "%s num_encoding_sizes: %d\n",   "SIOCGIWRANGE", info.range.num_encoding_sizes );
+    for ( i = 0; i < info.range.num_encoding_sizes; i++ ) 
+      printf ( "%s encoding_size[%d]: %d\n",  "SIOCGIWRANGE", i, info.range.encoding_size[i]  );
+    printf ( "%s max_encoding_tokens: %d\n",  "SIOCGIWRANGE", info.range.max_encoding_tokens );
+//  printf ( "%s encoding_login_index: %d\n", "SIOCGIWRANGE", info.range.encoding_login_index );
+    printf ( "%s txpower_capa: %d\n",         "SIOCGIWRANGE", info.range.txpower_capa );
+    printf ( "%s num_txpower: %d dBm\n",      "SIOCGIWRANGE", info.range.num_txpower );
+    for ( i = 0; i < info.range.num_txpower; i++ ) 
+      printf ( "%s txpower[%d]: %d\n",        "SIOCGIWRANGE", i, info.range.txpower[i]  );
+    printf ( "%s we_version_compiled: %d\n",  "SIOCGIWRANGE", info.range.we_version_compiled );
+    printf ( "%s we_version_source: %d\n",    "SIOCGIWRANGE", info.range.we_version_source );
+    printf ( "%s retry_capa: %d\n",           "SIOCGIWRANGE", info.range.retry_capa );
+    printf ( "%s retry_flags: %d\n",          "SIOCGIWRANGE", info.range.retry_flags );
+    printf ( "%s r_time_flags: %d\n",         "SIOCGIWRANGE", info.range.r_time_flags );
+    printf ( "%s min_retry: %d\n",            "SIOCGIWRANGE", info.range.min_retry );
+    printf ( "%s max_retry: %d\n",            "SIOCGIWRANGE", info.range.max_retry );
+    printf ( "%s min_r_time: %d\n",           "SIOCGIWRANGE", info.range.min_r_time );
+    printf ( "%s max_r_time: %d\n",           "SIOCGIWRANGE", info.range.max_r_time );
+    printf ( "%s num_channels: %d\n",         "SIOCGIWRANGE", info.range.num_channels );
+    printf ( "%s num_frequency: %d\n",        "SIOCGIWRANGE", info.range.num_frequency );
+    for ( i = 0; i < info.range.num_frequency; i++ ) 
+      printf ( "%s freq[%d].i: %d freq[%d].e: %d freq[%d].m: %d\n", "SIOCGIWRANGE", 
+                i, info.range.freq[i].i, i, info.range.freq[i].e, i, info.range.freq[i].m );
+  }
+  else
+    printf ( "%s %s\n", "SIOCGIWRANGE", " ===> no info.range support" );
+
+  if ( info.has_nwid ) 
+    printf ( "%s nwid - disabled: %d value: %X\n", "SIOCGIWNWID", info.nwid.disabled, info.nwid.value );
+  else
+    printf ( "%s %s\n", "SIOCGIWNWID", " ===> no info.nwid support" );
+
+  if ( info.has_freq ) {
+//  printf ( "%s freq: %g\n", "SIOCGIWFREQ", info.freq / GIGA );
+    printf ( "%s freq: %g\n", "SIOCGIWFREQ", info.freq );
+  }
+  else
+    printf ( "%s %s\n", "SIOCGIWFREQ", " ===> no info.freq support" );
+
+  if ( info.has_sens )
+    printf ( "%s sens: %d\n", "SIOCGIWSENS", info.sens );
+  else
+    printf ( "%s %s\n", "SIOCGIWSENS", " ===> no info.sens support" );
+
+  if ( info.has_key ) {
+    printf ( "%s key_size: %d key_flags: %d wepCurrentKey: %d\n", 
+              "SIOCGIWENCODE", info.key_size, info.key_flags, wepCurrentKey );
+    printf ( "%s MODE: %d DISABLED: %d INDEX: %d OPEN: %d RESTRICTED: %d NOKEY: %d TEMP: %d\n",
+              "SIOCGIWENCODE",                           info.key_flags & IW_ENCODE_MODE,
+              info.key_flags & IW_ENCODE_DISABLED ? 1:0, info.key_flags & IW_ENCODE_INDEX,
+              info.key_flags & IW_ENCODE_OPEN     ? 1:0, info.key_flags & IW_ENCODE_RESTRICTED ? 1:0,
+              info.key_flags & IW_ENCODE_NOKEY    ? 1:0, info.key_flags & IW_ENCODE_TEMP       ? 1:0 );
+  }
+  else
+    printf ( "%s %s\n", "SIOCGIWENCODE", " ===> no info.key support" );
+
+  for ( i = 0; i < MAX_WEP_KEYS; i++ ) {
+    if ( prWep[i].haveKey )
+      printf ( "%s prWep[%d].len: %d prWep[%d].key: %s\n", 
+                "SIOCGIWENCODE", i, prWep[i].len, i, prWep[i].key );
+  }
+
+  if ( info.has_ap_addr )
+    printf ( "%s ap_addr.sa_data: %02X:%02X:%02X:%02X:%02X:%02X ap_addr.sa_family: %d\n", 
+              "SIOCGIWAP",  ( UCHAR ) info.ap_addr.sa_data[0], ( UCHAR ) info.ap_addr.sa_data[1], 
+                            ( UCHAR ) info.ap_addr.sa_data[2], ( UCHAR ) info.ap_addr.sa_data[3], 
+                            ( UCHAR ) info.ap_addr.sa_data[4], ( UCHAR ) info.ap_addr.sa_data[5], 
+                                      info.ap_addr.sa_family );
+  else
+    printf ( "%s %s\n", "SIOCGIWAP", " ===> no ap_addr information" );
+
+  if ( info.has_bitrate )
+    printf ( "%s bitrate: %d value: %d fixed: %d disabled: %d flags: %d\n", 
+              "SIOCGIWRATE", info.bitrate, info.bitrate.value, info.bitrate.fixed, 
+                             info.bitrate.disabled, info.bitrate.flags );
+  else
+    printf ( "%s %s\n", "SIOCGIWRATE", " ===> no info.bitrate support" );
+
+  if ( info.has_rts )
+    printf ( "%s rts: %d\n", "SIOCGIWRTS", info.rts );
+  else
+    printf ( "%s %s\n", "SIOCGIWRTS", " ===> no info.rts support" );
+
+  if ( info.has_frag )
+    printf ( "%s frag: %d\n", "SIOCGIWFRAG", info.frag );
+  else
+    printf ( "%s %s\n", "SIOCGIWFRAG", " ===> no info.frag support" );
+
+  if ( info.has_mode ) 
+    printf ( "%s mode: %d\n", "SIOCGIWMODE", info.mode );
+  else
+    printf ( "%s %s\n", "SIOCGIWMODE", " ===> no info.mode support" );
+
+  if ( info.has_power ) {
+    printf ( "%s power: %d\n", "SIOCGIWPOWER", info.power );
+    printf ( "%s disabled: %d MIN: %d MAX: %d TIMEOUT: %d RELATIVE: %d\n",
+              "SIOCGIWPOWER",
+              info.power.disabled                  ? 1:0, 
+              info.power.flags & IW_POWER_MIN      ? 1:0, 
+              info.power.flags & IW_POWER_MAX      ? 1:0, 
+              info.power.flags & IW_POWER_TIMEOUT  ? 1:0, 
+              info.power.flags & IW_POWER_RELATIVE ? 1:0 ); 
+    printf ( "%s UNICAST: %d MULTICAST: %d ALL: %d FORCE: %d REPEATER: %d\n",
+              "SIOCGIWPOWER",
+              info.power.flags & IW_POWER_UNICAST_R   ? 1:0, 
+              info.power.flags & IW_POWER_MULTICAST_R ? 1:0, 
+              info.power.flags & IW_POWER_ALL_R       ? 1:0, 
+              info.power.flags & IW_POWER_FORCE_S     ? 1:0, 
+              info.power.flags & IW_POWER_REPEATER    ? 1:0 ); 
+  }
+  else
+    printf ( "%s %s\n", "SIOCGIWPOWER", " ===> no info.power support" );
+
+  if ( info.has_retry )
+    printf ( "%s retry: %d\n", "SIOCGIWRETRY", info.retry );
+  else
+    printf ( "%s %s\n", "SIOCGIWRETRY", " ===> no info.retry support" );
+
+  if ( info.has_stats ) {
+    printf ( "%s status: %d\n",           "SIOCGIWSTATS", info.stats.status           );
+    printf ( "%s qual.level: %d\n",       "SIOCGIWSTATS", info.stats.qual.level       );
+    printf ( "%s qual.noise: %d\n",       "SIOCGIWSTATS", info.stats.qual.noise       );
+    printf ( "%s qual.qual: %d\n",        "SIOCGIWSTATS", info.stats.qual.qual        );
+    printf ( "%s qual.updated: %d\n",     "SIOCGIWSTATS", info.stats.qual.updated     );
+    printf ( "%s discard.code: %d\n",     "SIOCGIWSTATS", info.stats.discard.code     );
+    printf ( "%s discard.fragment: %d\n", "SIOCGIWSTATS", info.stats.discard.fragment );
+    printf ( "%s discard.misc: %d\n",     "SIOCGIWSTATS", info.stats.discard.misc     );
+    printf ( "%s discard.nwid: %d\n",     "SIOCGIWSTATS", info.stats.discard.nwid     );
+    printf ( "%s discard.retries: %d\n",  "SIOCGIWSTATS", info.stats.discard.retries  );
+    printf ( "%s miss.beacon: %d\n",      "SIOCGIWSTATS", info.stats.miss.beacon      );
+  }
+  else
+    printf ( "%s %s\n", "SIOCGIWSTATS", " ===> no info.stats support" );
+
+  if ( info.txpower.flags & IW_TXPOW_MWATT )
+    printf ( "%s txpower1: %d dBm disabled: %d fixed: %d flags: %d\n", "SIOCGIWRANGE", 
+      mWatt2dbm ( info.txpower.value ), info.txpower.disabled, info.txpower.fixed, info.txpower.flags);
+  else
+    printf ( "%s txpower2: %d dBm disabled: %d fixed: %d flags: %d\n", "SIOCGIWRANGE", info.txpower.value, info.txpower.disabled, info.txpower.fixed, info.txpower.flags );
+
+  if ( info.has_range ) 
+    if ( info.sens.value < 0 )
+      printf ( "%s sens: %d dBm\n", "SIOCGIWRANGE", info.sens.value );
+    else
+      printf ( "%s sens: %d/%d\n", "SIOCGIWRANGE", info.sens.value, info.range.sensitivity );
+
+  if ( info.has_range && ( info.stats.qual.level != 0 ))
+      if ( info.stats.qual.level > info.range.max_qual.level )
+        /* Statistics are in dBm (absolute power measurement) */
+        printf ( "%s Quality: %d/%d Signal level: %d dBm Noise level: %d dBm\n",
+                  "SIOCGIWRANGE",
+                  info.stats.qual.qual, info.range.max_qual.qual,
+                  info.stats.qual.level - 0x100,
+                  info.stats.qual.noise - 0x100 );
+      else
+        printf (  "%s Quality: %d/%d Signal level: %d/%d Noise level: %d/%d",
+                  "SIOCGIWRANGE",
+                  info.stats.qual.qual,  info.range.max_qual.qual,
+                  info.stats.qual.level, info.range.max_qual.level,
+                  info.stats.qual.noise, info.range.max_qual.noise );
+
+#endif // #ifdef DISPLAYWIEXT
+}
+
+/****************************************************************************
+*                                                                           *
+*                        Linked List Functions                              *
+*                                                                           *
+****************************************************************************/
+/****************************************************************************
+*                                                                           *
+*                addList() - add an entry to a linked list                  *
+*                                                                           *
+****************************************************************************/
+static void 
+addList ( char *l, char *data, int len  )
+{
+  char uid[256];
+  LIST_HEAD ( , avc802dot11Node ) *list;       
+
+  // NOTE: this assumes the UID is at the begining of the 
+  //       data structure and that UIDs are strings
+  
+  list = ( LIST_HEAD ( , avc802dot11Node ) * ) l;   // NOTE: don't know how to get 
+  strcpy ( uid, data );                             //  rid of compiler warning on
+                                                    //  LISTHEAD typecast
+  // create a new node and the data that goes in it
+  newNode = malloc ( sizeof ( struct avc802dot11Node ));
+  newNode->data = malloc ( len );
+  memcpy ( newNode->data, data, len );
+
+  // this deals with an empty list
+  if ( LIST_EMPTY ( list )) {
+    LIST_INSERT_HEAD ( list, newNode, nodes );
+    return;
+  }
+
+  // this deals with UIDs that match
+  for ( np = LIST_FIRST ( list ); np != NULL; np = LIST_NEXT ( np, nodes )) {
+    if ( strncmp ( uid, np->data, strlen ( uid )) == 0 ) {                      // found matching UID
+      LIST_INSERT_AFTER ( np, newNode, nodes );
+      if ( np->data )
+        free ( np->data );
+      LIST_REMOVE ( np, nodes );
+      free ( np );
+      return;
+    }
+  }
+
+  // this deals with inserting a new UID in the list
+  for ( np = LIST_FIRST ( list ); np != NULL; np = LIST_NEXT ( np, nodes )) {
+    lastNode = np;
+    if ( strncmp ( np->data, uid, strlen ( uid )) > 0 ) {                       // old ID > new ID AND
+      LIST_INSERT_BEFORE ( np, newNode, nodes );
+      return;
+    }
+  }
+
+  // this deals with a UID that needs to go on the end of the list
+  LIST_INSERT_AFTER ( lastNode, newNode, nodes );
+
+  return;
+}
+
+/****************************************************************************
+*                                                                           *
+*              initLists() - initialize all the linked lists                *
+*                                                                           *
+****************************************************************************/
+static void initLists()
+{
+  LIST_INIT ( &prIfList   );
+  LIST_INIT ( &prAcList   );
+  LIST_INIT ( &athMacList );
+  LIST_INIT ( &athPhyList );
+}
+
+/****************************************************************************
+*                                                                           *
+*                 flushLists() - flush all linked lists                     *
+*                                                                           *
+****************************************************************************/
+static void flushLists()
+{
+  flushList (( char * ) &prIfList   );
+  flushList (( char * ) &prAcList   );
+  flushList (( char * ) &athMacList );
+  flushList (( char * ) &athPhyList );
+}
+
+/****************************************************************************
+*                                                                           *
+*                   flushList() - flush a linked list                       *
+*                                                                           *
+****************************************************************************/
+static void flushList ( char *l )
+{
+  LIST_HEAD ( , avc802dot11Node ) *list;
+  
+  list = ( LIST_HEAD ( , avc802dot11Node ) * ) l;   // NOTE: don't know how to get 
+  while ( !LIST_EMPTY ( list )) {                   //  rid of compiler warning on
+    np = LIST_FIRST ( list );                       //  LISTHEAD typecast
+    if ( np->data )
+      free ( np->data );
+    LIST_REMOVE ( np, nodes );
+    free ( np );
+  }
+}
+
+/****************************************************************************
+*                                                                           *
+*                            Utility Functions                              *
+*                                                                           *
+****************************************************************************/
+/****************************************************************************
+*                                                                           *
+*        The following two routines were taken directly from iwlib.c        *
+*                                                                           *
+****************************************************************************/
+ /*
+ * Open a socket.
+ * Depending on the protocol present, open the right socket. The socket
+ * will allow us to talk to the driver.
+ */
+static int openSocket ( void )
+{
+  static const int families[] = {
+    AF_INET, AF_IPX, AF_AX25, AF_APPLETALK
+  };
+  unsigned int  i;
+  int   sock;
+
+  /*
+   * Now pick any (exisiting) useful socket family for generic queries
+   * Note : don't open all the socket, only returns when one matches,
+   * all protocols might not be valid.
+   * Workaround by Jim Kaba <jkaba@sarnoff.com>
+   * Note : in 99% of the case, we will just open the inet_sock.
+   * The remaining 1% case are not fully correct...
+   */
+
+  /* Try all families we support */
+  for(i = 0; i < sizeof(families)/sizeof(int); ++i) {
+      /* Try to open the socket, if success returns it */
+      sock = socket(families[i], SOCK_DGRAM, 0);
+      if(sock >= 0)
+  return sock;
+  }
+
+  return -1;
+}
+
+/*------------------------------------------------------------------*/
+/*
+ * Convert a value in milliWatt to a value in dBm.
+ */
+static int mWatt2dbm ( int in )
+{
+#ifdef WE_NOLIBM
+  /* Version without libm : slower */
+  double  fin = (double) in;
+  int   res = 0;
+
+  /* Split integral and floating part to avoid accumulating rounding errors */
+  while(fin > 10.0)
+    {
+      res += 10;
+      fin /= 10.0;
+    }
+  while(fin > 1.000001) /* Eliminate rounding errors, take ceil */
+    {
+      res += 1;
+      fin /= LOG10_MAGIC;
+    }
+  return(res);
+#else /* WE_NOLIBM */
+  /* Version with libm : faster */
+  return((int) (ceil(10.0 * log10((double) in))));
+#endif  /* WE_NOLIBM */
+}
+
+/****************************************************************************
+*                                                                           *
+*        isMACAddress() - this string look kinda like a MAC address?        *
+*                                                                           *
+****************************************************************************/
+static int isMACAddress ( char *s )
+{
+
+  if ( strlen ( s ) == 17 &&
+       s[2]  == ':'       && s[5]  == ':'       &&
+       s[8]  == ':'       && s[11] == ':'       &&
+       s[14] == ':'       &&
+       isxdigit ( s[0]  ) && isxdigit ( s[1]  ) &&
+       isxdigit ( s[3]  ) && isxdigit ( s[4]  ) &&
+       isxdigit ( s[6]  ) && isxdigit ( s[7]  ) &&
+       isxdigit ( s[9]  ) && isxdigit ( s[10] ) &&
+       isxdigit ( s[12] ) && isxdigit ( s[13] ) &&
+       isxdigit ( s[15] ) && isxdigit ( s[16] ))
+    return ( TRUE );
+  else
+    return ( FALSE );
+}
+
+/****************************************************************************
+*                                                                           *
+*           strtoupper() - converts a string to upper case characters       *
+*                                                                           *
+****************************************************************************/
+static void strtoupper ( char *s )
+{
+  while ( *s ) {
+    *s = toupper ( *s );
+    *s++;
+  }
+}
+
+/****************************************************************************
+*                                                                           *
+*                 htob - converts hex string to binary                      *
+*                                                                           *
+****************************************************************************/
+static char *htob ( char *s )
+{
+    char nibl, *byt;
+    static char bin[20];
+
+    byt = bin;
+
+    while ((nibl = *s++) && nibl != ' ') {    /* While not end of string. */
+      nibl -= ( nibl > '9') ?  ('A' - 10): '0';
+      *byt = nibl << 4;                              /* place high nibble */
+      if((nibl = *s++) && nibl != ' ') {
+        nibl -= ( nibl > '9') ?  ('A' - 10): '0';
+        *byt |= nibl;                                /*  place low nibble */
+      }
+      else break;
+      ++byt;
+    }
+    *++byt = '\0';
+    return ( bin );
+}
+
+/****************************************************************************
+*                                                                           *
+*             htoui - converts hex string to unsigned integer               *
+*                                                                           *
+****************************************************************************/
+static unsigned int htoui ( char *cptr )
+{
+  unsigned int i, j = 0;
+
+  while (cptr && *cptr && isxdigit(*cptr)) {
+    i = *cptr++ - '0';
+    if (9 < i)
+      i -= 7;
+    j <<= 4;
+    j |= (i & 0x0f);
+  }
+  return ( j );
+}
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/avc802dot11.h tomato121/release/src/router/snmp/agent/mibgroup/avc802dot11.h
--- tomato/release/src/router/snmp/agent/mibgroup/avc802dot11.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/avc802dot11.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,393 @@
+/**** Copyright (c) AvantCom Corp 2003 - 2004 ***/
+/**** All rights reserved ***/
+/*__________________________________________________________________
+  |                                                                |
+  |         Copyright 2003 - 2004  -  AvantCom Corporation         |
+  |                                                                |
+  |    This material is the exclusive confidential property of     |
+  |    AvantCom Corporation. All rights, including copyrights      |
+  |    and patent rights, are reserved. No copies of any portion   |
+  |    are to be made by any means without the express written     |
+  |    permission of AvantCom Corporation.                         |
+  |                                                                |
+  |________________________________________________________________|
+*/ 
+/****************************************************************************
+*                                                                           *
+*  File Name:           avc802dot11.h                                       *
+*  Used By:                                                                 *
+*                                                                           *
+*  Operating System:                                                        *
+*  Purpose:                                                                 *
+*                                                                           *
+*  Comments:                                                                *
+*                                                                           *
+*  Author:              Larry Simmons                                       *
+*                       lsimmons@avantcom.com                               *
+*                       www.avantcom.com                                    *
+*                                                                           *
+*  Creation Date:       09/24/03                                            *
+*                                                                           *
+*   Ver    Date   Inits Modification                                        *
+*  ----- -------- ----- ------------                                        *
+*  0.0.1 09/24/03  LRS  created                                             *
+****************************************************************************/
+/* This file was generated by mib2c and is intended for use as a mib module
+  for the ucd-snmp snmpd agent. */
+#ifndef _MIBGROUP_AVC802DOT11_H
+#define _MIBGROUP_AVC802DOT11_H
+/* we may use header_generic and header_simple_table from the util_funcs module */
+
+/****************************************************************************
+*                               Includes                                    *
+****************************************************************************/
+#include <sys/queue.h>
+
+/****************************************************************************
+*                             Linked List Defines                           *
+****************************************************************************/
+// here are some Linked List MACROS I wanted to use, 
+// but curiously were not in /usr/includes/sys/queue.h
+
+#ifndef LIST_EMPTY
+  #define	LIST_EMPTY(head)	((head)->lh_first == NULL)
+#endif
+
+#ifndef LIST_NEXT
+  #define	LIST_NEXT(elm, field)	((elm)->field.le_next)
+#endif
+
+#ifndef LIST_INSERT_BEFORE
+  #define	LIST_INSERT_BEFORE(listelm, elm, field) do {			\
+	  (elm)->field.le_prev = (listelm)->field.le_prev;		\
+	  LIST_NEXT((elm), field) = (listelm);				\
+	  *(listelm)->field.le_prev = (elm);				\
+	  (listelm)->field.le_prev = &LIST_NEXT((elm), field);		\
+  } while (0)
+#endif
+
+#ifndef LIST_FIRST
+  #define	LIST_FIRST(head)	((head)->lh_first)
+#endif
+
+/****************************************************************************
+*                             802.11 MIB Defines                            *
+****************************************************************************/
+#define MAXRADIOS 16
+
+#define IFINDEX_LEN                          4
+#define IFNAME_LEN                          16
+#define MACADDR_LEN                        ( 6 * 2 ) + 5
+#define WEP_STR_LEN                         64
+#define MAX_WEP_KEYS                         4
+
+#define PRIF_UID_LEN    IFINDEX_LEN
+#define PRAC_UID_LEN    IFINDEX_LEN + 1 + MACADDR_LEN
+#define ATHMAC_UID_LEN  IFINDEX_LEN
+#define ATHPHY_UID_LEN  IFINDEX_LEN
+
+/****************************************************************************
+*                             Prism HostAP Defines                          *
+****************************************************************************/
+#define AP                          "AP="
+#define STA                         "STA="
+#define USERS                       "users="
+#define AID                         "aid="
+#define FLAGS                       "flags="
+#define AUTH                        "AUTH"
+#define ASSOC                       "ASSOC"
+#define CAPABILITY                  "capability="
+#define LISTENINTERVAL              "listen_interval="
+#define MBPS1                       "1Mbps"
+#define MBPS2                       "2Mbps"
+#define MBPS5                       "5.5Mbps"
+#define MBPS11                      "11Mbps"
+#define JIFFIES                     "jiffies="
+#define LASTAUTH                    "last_auth="
+#define LASTASSOC                   "last_assoc="
+#define LASTRX                      "last_rx="
+#define LASTTX                      "last_tx="
+#define RXPACKETS                   "rx_packets="
+#define TXPACKETS                   "tx_packets="
+#define RXBYTES                     "rx_bytes="
+#define TXBYTES                     "tx_bytes="
+#define BFRCNT                      "buffer_count="
+#define SILENCE                     "silence="
+#define SIGNAL                      "signal="
+#define RATE                        "rate="
+#define FLOW                        "flow="
+#define TXRATE                      "tx_rate="
+#define TX1M                        "tx[1M]="
+#define TX2M                        "tx[2M]="
+#define TX5M                        "tx[5.5M]="
+#define TX11M                       "tx[11M]="
+#define RX1M                        "rx[1M]="
+#define RX2M                        "rx[2M]="
+#define RX5M                        "rx[5.5M]="
+#define RX11M                       "rx[11M]="
+
+/****************************************************************************
+*                          Atheros MadWiFi Defines                          *
+****************************************************************************/
+#define WATCHDOG                    "watchdog="
+#define HARDWARE                    "hardware="
+#define BMISS                       "bmiss="
+#define RXORN                       "rxorn="
+#define RXEOL                       "rxeol="
+#define TXURN                       "txurn="
+#define TX_MGMT                     "tx_mgmt="
+#define TX_DISCARD                  "tx_discard="
+#define TX_INVALID                  "tx_invalid="
+#define TX_QSTOP                    "tx_qstop="
+#define TX_ENCAP                    "tx_encap="
+#define TX_NONODE                   "tx_nonode="
+#define TX_NOBUF                    "tx_nobuf="
+#define TX_NOBUFMGT                 "tx_nobufmgt="
+#define TX_XRETRIES                 "tx_xretries="
+#define TX_FIFOERR                  "tx_fifoerr="
+#define TX_FILTERED                 "tx_filtered="
+#define TX_SHORTRETRY               "tx_shortretry="
+#define TX_LONGRETRY                "tx_longretry="
+#define TX_BADRATE                  "tx_badrate="
+#define TX_NOACK                    "tx_noack="
+#define TX_RTS                      "tx_rts="
+#define TX_CTS                      "tx_cts="
+#define TX_SHORTPRE                 "tx_shortpre="
+#define TX_RSSI                     "tx_rssi="
+#define TX_RSSIDELTA                "tx_rssidelta="
+#define RX_ORN                      "rx_orn="
+#define RX_TOOSHORT                 "rx_tooshort="
+#define RX_CRCERR                   "rx_crcerr="
+#define RX_FIFOERR                  "rx_fifoerr="
+#define RX_BADCRYPT                 "rx_badcrypt="
+#define RX_PHYERR                   "rx_phyerr="
+#define RX_NOBUF                    "rx_nobufr="
+#define RX_RSSI                     "rx_rssi="
+#define RX_RSSIDELTA                "rx_rssidelta="
+#define BE_NOBUF                    "be_nobuf="
+#define PER_CAL                     "per_cal="
+#define PER_CALFAIL                 "per_calfail="
+#define PER_RFGAIN                  "per_rfgain="
+#define RATE_CALLS                  "rate_calls="
+#define RATE_RAISE                  "rate_raise="
+#define RATE_DROP                   "rate_drop="
+
+#define PHYERR_UNDERRUN             "PHYERR_UNDERRUN="
+#define PHYERR_TIMING               "PHYERR_TIMING="
+#define PHYERR_PARITY               "PHYERR_PARITY="
+#define PHYERR_RATE                 "PHYERR_RATE="
+#define PHYERR_LENGTH               "PHYERR_LENGTH="
+#define PHYERR_RADAR                "PHYERR_RADAR="
+#define PHYERR_SERVICE              "PHYERR_SERVICE="
+#define PHYERR_TOR                  "PHYERR_TOR="
+
+// these are specific to the 5212 
+#define PHYERR_OFDM_TIMING          "PHYERR_OFDM_TIMING="
+#define PHYERR_OFDM_SIGNAL_PARITY   "PHYERR_OFDM_SIGNAL_PARITY="
+#define PHYERR_OFDM_RATE_ILLEGAL    "PHYERR_OFDM_RATE_ILLEGAL="
+#define PHYERR_OFDM_LENGTH_ILLEGAL  "PHYERR_OFDM_LENGTH_ILLEGAL="
+#define PHYERR_OFDM_POWER_DROP      "PHYERR_OFDM_POWER_DROP="
+#define PHYERR_OFDM_SERVICE         "PHYERR_OFDM_SERVICE="
+#define PHYERR_OFDM_RESTART         "PHYERR_OFDM_RESTART="
+#define PHYERR_CCK_TIMING           "PHYERR_CCK_TIMING="
+#define PHYERR_CCK_HEADER_CRC       "PHYERR_CCK_HEADER_CRC="
+#define PHYERR_CCK_RATE_ILLEGAL     "PHYERR_CCK_RATE_ILLEGAL="
+#define PHYERR_CCK_SERVICE          "PHYERR_CCK_SERVICE="
+#define PHYERR_CCK_RESTART          "PHYERR_CCK_RESTART="
+
+/****************************************************************************
+*                           Linked List Structure                           *
+****************************************************************************/
+static struct avc802dot11Node {  
+  LIST_ENTRY ( avc802dot11Node ) nodes; 
+  char *data;                                 // pointer to data
+} *avc802dot11np;;
+
+typedef LIST_HEAD ( , avc802dot11Node ) avc802dot11List_t;
+
+/****************************************************************************
+*                           Prism MIB structures                            *
+****************************************************************************/
+/****************************************************************************
+*                Prism Interface Information MIB structure                  *
+****************************************************************************/
+static struct prIfTbl_data {
+
+  char  UID         [ PRIF_UID_LEN + 1 ];
+  char  ifName      [ IFNAME_LEN   + 1 ];    // ifName of card
+  long  ifIndex;                             // ifindex of card
+  long  signal;
+  long  noise;
+  long  quality;
+  long  assocCnt;
+
+} nPrIf, *prIf = &nPrIf;
+
+static avc802dot11List_t prIfList;
+
+/****************************************************************************
+*                   Prism Associated Clients MIB structure                  *
+****************************************************************************/
+static struct prAcTbl_data {
+
+  char  UID         [ PRAC_UID_LEN + 1 ];
+  char  ifName      [ IFNAME_LEN   + 1 ];    // ifName of card
+
+  long  ifIndex;                             // ifindex of card
+  char  macAddress  [ MACADDR_LEN  + 1 ];    // MacAddr
+
+  long  stationType;
+  long  listenInterval;
+  long  supports1Mbps;
+  long  supports2Mbps;
+  long  supports5Mbps;
+  long  supports11Mbps;
+  long  jiffies;
+  long  lastAuth;
+  long  lastAssoc;
+  long  lastRx;
+  long  lastTx;
+  unsigned long      rxPackets;
+  unsigned long      txPackets;
+  unsigned long long rxBytes;
+  unsigned long long txBytes;
+  long  bfrCnt;
+  long  lastRxSilence;
+  long  lastRxSignal;
+  long  lastRxRate;
+  long  lastRxFlow;
+  long  txRate;
+  long  tx1Mbps;
+  long  tx2Mbps;
+  long  tx5Mbps;
+  long  tx11Mbps;
+  long  rx1Mbps;
+  long  rx2Mbps;
+  long  rx5Mbps;
+  long  rx11Mbps;
+
+} nPrAc, *prAc = &nPrAc;
+
+static avc802dot11List_t prAcList;
+
+/****************************************************************************
+*                          Atheros MIB structures                           *
+****************************************************************************/
+/****************************************************************************
+*                        Atheros MAC Counters Table                         *
+****************************************************************************/
+static struct athMacTbl_data {
+
+  char  UID         [ ATHMAC_UID_LEN + 1 ];
+  char  ifName      [ IFNAME_LEN     + 1 ];  // ifName of card
+  long  ifIndex;                             // ifindex of card
+
+  long  watchDog;
+  long  fatalHwInterrupt;
+  long  missedBeacons;
+  long  rxOverRun;
+  long  rxEol;
+  long  txUnderRun;
+  long  txMgmtFrames;
+  long  txDiscards;
+  long  txInvalid;
+  long  txQueueStopped;
+  long  txEncapFailed;
+  long  txNoNode;
+  long  txNoDataBuffer;
+  long  txNoMgmtBuffer;
+  long  txExcessiveRetries;
+  long  txFifoUnderRun;
+  long  txFiltered;
+  long  txShortRetries;
+  long  txLongRetries;
+  long  txBadRate;
+  long  txNoAck;
+  long  txRts;
+  long  txCts;
+  long  txShortPreamble;
+  long  txRssi;
+  long  txRssiDelta;
+  long  rxDescOverRun;
+  long  rxFrameTooShort;
+  long  rxCrcError;
+  long  rxFifoOverRun;
+  long  rxCryptFailure;
+  long  rxNoSkBuffer;
+  long  rxRssi;
+  long  rxRssiDelta;
+  long  noBeaconBuffer;
+  long  calibrations;
+  long  failedCalibrations;
+  long  rfGainResets;
+  long  rateControlChecks;
+  long  rateControlRaise;
+  long  rateControlDrop;
+
+} nAthMac, *athMac = &nAthMac;
+
+static avc802dot11List_t athMacList;
+
+/****************************************************************************
+*                        Atheros PHY Counters Table                         *
+****************************************************************************/
+static struct athPhyTbl_data {
+
+  char  UID         [ ATHPHY_UID_LEN + 1 ];
+  char  ifName      [ IFNAME_LEN     + 1 ];  // ifName of card
+  long  ifIndex;                             // ifindex of card
+
+  long  totalPhyErrors;
+  long  txUnderRun;
+  long  timingErrors;
+  long  parityErrors;
+  long  invalidRate;
+  long  invalidLength;
+  long  radarDetected;
+  long  invalidService;
+  long  txOverrideRx;
+  long  OfdmTiming;
+  long  OfdmSignalParity;
+  long  OfdmInvalidRate;
+  long  OfdmInvalidLength;
+  long  OfdmPowerDrop;
+  long  OfdmService;
+  long  OfdmRestart;
+  long  CckTiming;
+  long  CckHeaderCrc;
+  long  CckInvalidRate;
+  long  CckService;
+  long  CckRestart;
+
+} nAthPhy, *athPhy = &nAthPhy;
+
+static avc802dot11List_t athPhyList;
+
+/****************************************************************************
+*                       Wireless Extensions Structures                      *
+****************************************************************************/
+static long wepCurrentKey;
+static long haveWepCurrentKey;
+static struct prWepTbl_data {
+
+  long len;
+  char key [ WEP_STR_LEN + 1 ];
+  long haveKey;
+
+} prWep[4];
+
+/****************************************************************************
+*                                                                           *
+****************************************************************************/
+config_require(util_funcs)
+
+/* function prototypes */
+
+void   init_avc802dot11(void);
+FindVarMethod var_avc802dot11;
+FindVarMethod var_prInterfaceTable;
+FindVarMethod var_prAssociatedClientsTable;
+FindVarMethod var_athMacCountersTable;
+FindVarMethod var_athPhyCountersTable;
+
+#endif /* _MIBGROUP_AVC802DOT11_H */
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/.cvsignore tomato121/release/src/router/snmp/agent/mibgroup/.cvsignore
--- tomato/release/src/router/snmp/agent/mibgroup/.cvsignore	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/.cvsignore	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,13 @@
+DIFFS
+Makefile
+mib_module_dot_conf.h
+mib_module_includes.h
+mib_module_inits.h
+mib_module_loads.h
+mib_module_shutdown.h
+testconfig.c
+testconfig.h
+xxx.c
+xxx.h
+.libs
+*.lo
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/disman/.cvsignore tomato121/release/src/router/snmp/agent/mibgroup/disman/.cvsignore
--- tomato/release/src/router/snmp/agent/mibgroup/disman/.cvsignore	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/disman/.cvsignore	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,3 @@
+.libs
+*.lo
+Makefile
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/disman/event-mib.h tomato121/release/src/router/snmp/agent/mibgroup/disman/event-mib.h
--- tomato/release/src/router/snmp/agent/mibgroup/disman/event-mib.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/disman/event-mib.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,12 @@
+/*
+ * wrapper for the disman event mib code files 
+ */
+config_require(disman/mteTriggerTable)
+config_require(disman/mteTriggerDeltaTable)
+config_require(disman/mteTriggerExistenceTable)
+config_require(disman/mteTriggerBooleanTable)
+config_require(disman/mteTriggerThresholdTable)
+config_require(disman/mteObjectsTable)
+config_require(disman/mteEventTable)
+config_require(disman/mteEventNotificationTable)
+config_add_mib(DISMAN-EVENT-MIB)
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/disman/mteEventNotificationTable.c tomato121/release/src/router/snmp/agent/mibgroup/disman/mteEventNotificationTable.c
--- tomato/release/src/router/snmp/agent/mibgroup/disman/mteEventNotificationTable.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/disman/mteEventNotificationTable.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,97 @@
+/*
+ * Note: this file originally auto-generated by mib2c using
+ *        : mib2c.create-dataset.conf,v 5.2 2002/07/17 14:41:53 dts12 Exp $
+ */
+
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include "mteEventNotificationTable.h"
+
+netsnmp_table_data_set *mteEventNotif_table_set;
+
+
+/** Initialize the mteEventNotificationTable table by defining its contents and how it's structured */
+void
+initialize_table_mteEventNotificationTable(void)
+{
+    static oid      mteEventNotificationTable_oid[] =
+        { 1, 3, 6, 1, 2, 1, 88, 1, 4, 3 };
+    size_t          mteEventNotificationTable_oid_len =
+        OID_LENGTH(mteEventNotificationTable_oid);
+
+    /*
+     * create the table structure itself 
+     */
+    mteEventNotif_table_set = netsnmp_create_table_data_set("mteEventNotificationTable");
+
+    /*
+     * comment this out or delete if you don't support creation of new rows 
+     */
+    mteEventNotif_table_set->allow_creation = 1;
+
+    /***************************************************
+     * Adding indexes
+     */
+    DEBUGMSGTL(("initialize_table_mteEventNotificationTable",
+                "adding indexes to table mteEventNotificationTable\n"));
+    netsnmp_table_set_add_indexes(mteEventNotif_table_set,
+                                  /* index: mteOwner */
+                                  ASN_OCTET_STR,
+                                  /* index: mteEventName */
+                                  ASN_PRIV_IMPLIED_OCTET_STR,
+                                  0);
+
+    DEBUGMSGTL(("initialize_table_mteEventNotificationTable",
+                "adding column types to table mteEventNotificationTable\n"));
+    netsnmp_table_set_multi_add_default_row(mteEventNotif_table_set,
+                                            COLUMN_MTEEVENTNOTIFICATION,
+                                            ASN_OBJECT_ID, 1, NULL, 0,
+                                            COLUMN_MTEEVENTNOTIFICATIONOBJECTSOWNER,
+                                            ASN_OCTET_STR, 1, NULL, 0,
+                                            COLUMN_MTEEVENTNOTIFICATIONOBJECTS,
+                                            ASN_OCTET_STR, 1, NULL, 0, 0);
+
+    /* keep index values around for comparisons later */
+    mteEventNotif_table_set->table->store_indexes = 1;
+    /*
+     * registering the table with the master agent 
+     */
+    /*
+     * note: if you don't need a subhandler to deal with any aspects
+     * of the request, change mteEventNotificationTable_handler to "NULL" 
+     */
+    netsnmp_register_table_data_set(netsnmp_create_handler_registration
+                                    ("mteEventNotificationTable",
+                                     mteEventNotificationTable_handler,
+                                     mteEventNotificationTable_oid,
+                                     mteEventNotificationTable_oid_len,
+                                     HANDLER_CAN_RWRITE), mteEventNotif_table_set, NULL);
+}
+
+/** Initializes the mteEventNotificationTable module */
+void
+init_mteEventNotificationTable(void)
+{
+
+    /*
+     * here we initialize all the tables we're planning on supporting 
+     */
+    initialize_table_mteEventNotificationTable();
+}
+
+/** handles requests for the mteEventNotificationTable table, if anything else needs to be done */
+int
+mteEventNotificationTable_handler(netsnmp_mib_handler *handler,
+                                  netsnmp_handler_registration *reginfo,
+                                  netsnmp_agent_request_info *reqinfo,
+                                  netsnmp_request_info *requests)
+{
+    /*
+     * perform anything here that you need to do.  The requests have
+     * already been processed by the master table_dataset handler, but
+     * this gives you chance to act on the request in some other way
+     * if need be. 
+     */
+    return SNMP_ERR_NOERROR;
+}
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/disman/mteEventNotificationTable.h tomato121/release/src/router/snmp/agent/mibgroup/disman/mteEventNotificationTable.h
--- tomato/release/src/router/snmp/agent/mibgroup/disman/mteEventNotificationTable.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/disman/mteEventNotificationTable.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,23 @@
+/*
+ * Note: this file originally auto-generated by mib2c using
+ *  : mib2c.create-dataset.conf,v 5.2 2002/07/17 14:41:53 dts12 Exp $
+ */
+#ifndef MTEEVENTNOTIFICATIONTABLE_H
+#define MTEEVENTNOTIFICATIONTABLE_H
+
+/*
+ * function declarations 
+ */
+void            init_mteEventNotificationTable(void);
+void            initialize_table_mteEventNotificationTable(void);
+Netsnmp_Node_Handler mteEventNotificationTable_handler;
+
+/*
+ * column number definitions for table mteEventNotificationTable 
+ */
+#define COLUMN_MTEEVENTNOTIFICATION		1
+#define COLUMN_MTEEVENTNOTIFICATIONOBJECTSOWNER		2
+#define COLUMN_MTEEVENTNOTIFICATIONOBJECTS		3
+
+extern netsnmp_table_data_set *mteEventNotif_table_set;
+#endif                          /* MTEEVENTNOTIFICATIONTABLE_H */
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/disman/mteEventTable.c tomato121/release/src/router/snmp/agent/mibgroup/disman/mteEventTable.c
--- tomato/release/src/router/snmp/agent/mibgroup/disman/mteEventTable.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/disman/mteEventTable.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,198 @@
+/*
+ * Note: this file originally auto-generated by mib2c using
+ *        : mib2c.create-dataset.conf,v 5.2 2002/07/17 14:41:53 dts12 Exp $
+ */
+
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include "mteTriggerTable.h"
+#include "mteEventTable.h"
+#include "mteEventNotificationTable.h"
+#include "mteObjectsTable.h"
+
+netsnmp_table_data_set *table_set = NULL;
+
+/** Initialize the mteEventTable table by defining its contents and how it's structured */
+void
+initialize_table_mteEventTable(void)
+{
+    static oid      mteEventTable_oid[] =
+        { 1, 3, 6, 1, 2, 1, 88, 1, 4, 2 };
+    size_t          mteEventTable_oid_len = OID_LENGTH(mteEventTable_oid);
+
+    /*
+     * create the table structure itself 
+     */
+    table_set = netsnmp_create_table_data_set("mteEventTable");
+
+    /*
+     * comment this out or delete if you don't support creation of new rows 
+     */
+    table_set->allow_creation = 1;
+    /* mark the row status column */
+    table_set->rowstatus_column = COLUMN_MTEEVENTENTRYSTATUS;
+
+    /***************************************************
+     * Adding indexes
+     */
+    DEBUGMSGTL(("initialize_table_mteEventTable",
+                "adding indexes to table mteEventTable\n"));
+    netsnmp_table_set_add_indexes(table_set,
+                                  ASN_OCTET_STR,   /* index: mteOwner */
+                                  ASN_PRIV_IMPLIED_OCTET_STR, /* index: mteEventName */
+                                  0);
+
+    DEBUGMSGTL(("initialize_table_mteEventTable",
+                "adding column types to table mteEventTable\n"));
+    netsnmp_table_set_multi_add_default_row(table_set,
+                                            COLUMN_MTEEVENTNAME,
+                                            ASN_OCTET_STR, 0, NULL, 0,
+                                            COLUMN_MTEEVENTCOMMENT,
+                                            ASN_OCTET_STR, 1, NULL, 0,
+                                            COLUMN_MTEEVENTACTIONS,
+                                            ASN_OCTET_STR, 1, NULL, 0,
+                                            COLUMN_MTEEVENTENABLED,
+                                            ASN_INTEGER, 1, NULL, 0,
+                                            COLUMN_MTEEVENTENTRYSTATUS,
+                                            ASN_INTEGER, 1, NULL, 0, 0);
+
+    /* keep index values around for comparisons later */
+    table_set->table->store_indexes = 1;
+    /*
+     * registering the table with the master agent 
+     */
+    /*
+     * note: if you don't need a subhandler to deal with any aspects
+     * of the request, change mteEventTable_handler to "NULL" 
+     */
+    netsnmp_register_table_data_set(netsnmp_create_handler_registration
+                                    ("mteEventTable",
+                                     mteEventTable_handler,
+                                     mteEventTable_oid,
+                                     mteEventTable_oid_len,
+                                     HANDLER_CAN_RWRITE), table_set, NULL);
+}
+
+/** Initializes the mteEventTable module */
+void
+init_mteEventTable(void)
+{
+
+    /*
+     * here we initialize all the tables we're planning on supporting 
+     */
+    initialize_table_mteEventTable();
+}
+
+/** handles requests for the mteEventTable table, if anything else needs to be done */
+int
+mteEventTable_handler(netsnmp_mib_handler *handler,
+                      netsnmp_handler_registration *reginfo,
+                      netsnmp_agent_request_info *reqinfo,
+                      netsnmp_request_info *requests)
+{
+    /*
+     * perform anything here that you need to do.  The requests have
+     * already been processed by the master table_dataset handler, but
+     * this gives you chance to act on the request in some other way
+     * if need be. 
+     */
+
+    /* XXX: on rowstatus = destroy, remove the corresponding rows from the
+       other tables: snmpEventNotificationTable and the set table */
+    return SNMP_ERR_NOERROR;
+}
+
+/*
+ * send trap 
+ */
+void
+run_mte_events(struct mteTriggerTable_data *item,
+               oid * name_oid, size_t name_oid_len,
+               const char *eventobjowner, const char *eventobjname)
+{
+    static oid      objid_snmptrap[] = { 1, 3, 6, 1, 6, 3, 1, 1, 4, 1, 0 };     /* snmpTrapIOD.0 */
+
+    netsnmp_variable_list *var_list = NULL;
+
+    netsnmp_table_row *row, *notif_row;
+    netsnmp_table_data_set_storage *col1, *tc, *no, *noo;
+
+    for(row = table_set->table->first_row; row; row = row->next) {
+        if (strcmp(row->indexes->val.string, eventobjowner) == 0 &&
+            strcmp(row->indexes->next_variable->val.string,
+                   eventobjname) == 0) {
+            /* run this event */
+            col1 = (netsnmp_table_data_set_storage *) row->data;
+            
+            tc = netsnmp_table_data_set_find_column(col1,
+                                                    COLUMN_MTEEVENTACTIONS);
+            if (!tc->data.bitstring[0] & 0x80) {
+                /* not a notification.  next! (XXX: do sets) */
+                continue;
+            }
+
+            tc = netsnmp_table_data_set_find_column(col1,
+                                                    COLUMN_MTEEVENTENABLED);
+            if (*(tc->data.integer) != 1) {
+                /* not enabled.  next! */
+                continue;
+            }
+
+            if (!mteEventNotif_table_set) {
+                /* no notification info */
+                continue;
+            }
+
+            /* send the notification */
+            var_list = NULL;
+
+            /* XXX: get notif information */
+            for(notif_row = mteEventNotif_table_set->table->first_row;
+                notif_row; notif_row = notif_row->next) {
+                if (strcmp(notif_row->indexes->val.string,
+                           eventobjowner) == 0 &&
+                    strcmp(notif_row->indexes->next_variable->val.string,
+                           eventobjname) == 0) {
+
+                    /* run this event */
+                    col1 = (netsnmp_table_data_set_storage *) notif_row->data;
+            
+                    tc = netsnmp_table_data_set_find_column(col1, COLUMN_MTEEVENTNOTIFICATION);
+                    no = netsnmp_table_data_set_find_column(col1, COLUMN_MTEEVENTNOTIFICATIONOBJECTS);
+                    noo = netsnmp_table_data_set_find_column(col1, COLUMN_MTEEVENTNOTIFICATIONOBJECTSOWNER);
+                    if (!tc)
+                        continue; /* no notification to be had. XXX: return? */
+                    
+                    /*
+                     * snmpTrap oid 
+                     */
+                    snmp_varlist_add_variable(&var_list, objid_snmptrap,
+                                              sizeof(objid_snmptrap) /
+                                              sizeof(oid),
+                                              ASN_OBJECT_ID,
+                                              (u_char *) tc->data.objid,
+                                              tc->data_len);
+
+                    /* XXX: add objects from the mteObjectsTable */
+                    if (no && no->data.string &&
+                        noo && noo->data.string && name_oid) {
+                        mte_add_objects(var_list, item,
+                                        noo->data.string,
+                                        no->data.string,
+                                        name_oid + item->mteTriggerValueIDLen,
+                                        name_oid_len - item->mteTriggerValueIDLen);
+                    }
+
+                    DEBUGMSGTL(("mteEventTable:send_events", "sending an event "));
+                    DEBUGMSGOID(("mteEventTable:send_events", tc->data.objid, tc->data_len / sizeof(oid)));
+                    DEBUGMSG(("mteEventTable:send_events", "\n"));
+                    
+                    send_v2trap(var_list);
+                    snmp_free_varbind(var_list);
+                }
+            }
+        }
+    }
+}
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/disman/mteEventTable.h tomato121/release/src/router/snmp/agent/mibgroup/disman/mteEventTable.h
--- tomato/release/src/router/snmp/agent/mibgroup/disman/mteEventTable.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/disman/mteEventTable.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,27 @@
+/*
+ * Note: this file originally auto-generated by mib2c using
+ *  : mib2c.create-dataset.conf,v 5.2 2002/07/17 14:41:53 dts12 Exp $
+ */
+#ifndef MTEEVENTTABLE_H
+#define MTEEVENTTABLE_H
+
+/*
+ * function declarations 
+ */
+void            init_mteEventTable(void);
+void            initialize_table_mteEventTable(void);
+void            run_mte_events(struct mteTriggerTable_data *item,
+	                       oid * name_oid, size_t name_oid_len,
+		               const char *eventobjowner, const char *eventobjname);
+
+Netsnmp_Node_Handler mteEventTable_handler;
+
+/*
+ * column number definitions for table mteEventTable 
+ */
+#define COLUMN_MTEEVENTNAME		1
+#define COLUMN_MTEEVENTCOMMENT		2
+#define COLUMN_MTEEVENTACTIONS		3
+#define COLUMN_MTEEVENTENABLED		4
+#define COLUMN_MTEEVENTENTRYSTATUS		5
+#endif                          /* MTEEVENTTABLE_H */
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/disman/mteObjectsTable.c tomato121/release/src/router/snmp/agent/mibgroup/disman/mteObjectsTable.c
--- tomato/release/src/router/snmp/agent/mibgroup/disman/mteObjectsTable.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/disman/mteObjectsTable.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,946 @@
+/*
+ * This file was generated by mib2c and is intended for use as
+ * a mib module for the ucd-snmp snmpd agent. 
+ */
+
+
+/*
+ * This should always be included first before anything else 
+ */
+#include <net-snmp/net-snmp-config.h>
+#if HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#if HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+
+
+/*
+ * minimal include directives 
+ */
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+#include "header_complex.h"
+#include "mteTriggerTable.h"
+#include "mteObjectsTable.h"
+
+
+/*
+ * mteObjectsTable_variables_oid:
+ *   this is the top level oid that we want to register under.  This
+ *   is essentially a prefix, with the suffix appearing in the
+ *   variable below.
+ */
+
+
+oid             mteObjectsTable_variables_oid[] =
+    { 1, 3, 6, 1, 2, 1, 88, 1, 3, 1 };
+
+
+/*
+ * variable2 mteObjectsTable_variables:
+ *   this variable defines function callbacks and type return information 
+ *   for the mteObjectsTable mib section 
+ */
+
+
+struct variable2 mteObjectsTable_variables[] = {
+    /*
+     * magic number        , variable type , ro/rw , callback fn  , L, oidsuffix 
+     */
+#define   MTEOBJECTSID          5
+    {MTEOBJECTSID, ASN_OBJECT_ID, RWRITE, var_mteObjectsTable, 2, {1, 3}},
+#define   MTEOBJECTSIDWILDCARD  6
+    {MTEOBJECTSIDWILDCARD, ASN_INTEGER, RWRITE, var_mteObjectsTable, 2,
+     {1, 4}},
+#define   MTEOBJECTSENTRYSTATUS  7
+    {MTEOBJECTSENTRYSTATUS, ASN_INTEGER, RWRITE, var_mteObjectsTable, 2,
+     {1, 5}},
+
+};
+/*
+ * (L = length of the oidsuffix) 
+ */
+
+
+/*
+ * global storage of our data, saved in and configured by header_complex() 
+ */
+static struct header_complex_index *mteObjectsTableStorage = NULL;
+
+
+
+
+/*
+ * init_mteObjectsTable():
+ *   Initialization routine.  This is called when the agent starts up.
+ *   At a minimum, registration of your variables should take place here.
+ */
+void
+init_mteObjectsTable(void)
+{
+    DEBUGMSGTL(("mteObjectsTable", "initializing...  "));
+
+
+    /*
+     * register ourselves with the agent to handle our mib tree 
+     */
+    REGISTER_MIB("mteObjectsTable", mteObjectsTable_variables, variable2,
+                 mteObjectsTable_variables_oid);
+
+
+    /*
+     * register our config handler(s) to deal with registrations 
+     */
+    snmpd_register_config_handler("mteObjectsTable", parse_mteObjectsTable,
+                                  NULL, NULL);
+
+
+    /*
+     * we need to be called back later to store our data 
+     */
+    snmp_register_callback(SNMP_CALLBACK_LIBRARY, SNMP_CALLBACK_STORE_DATA,
+                           store_mteObjectsTable, NULL);
+
+
+    /*
+     * place any other initialization junk you need here 
+     */
+
+
+    DEBUGMSGTL(("mteObjectsTable", "done.\n"));
+}
+
+
+/*
+ * mteObjectsTable_add(): adds a structure node to our data set 
+ */
+int
+mteObjectsTable_add(struct mteObjectsTable_data *thedata)
+{
+    netsnmp_variable_list *vars = NULL;
+
+
+    DEBUGMSGTL(("mteObjectsTable", "adding data...  "));
+    /*
+     * add the index variables to the varbind list, which is 
+     * used by header_complex to index the data 
+     */
+
+
+    snmp_varlist_add_variable(&vars, NULL, 0, ASN_OCTET_STR, (char *) thedata->mteOwner, thedata->mteOwnerLen); /* mteOwner */
+    snmp_varlist_add_variable(&vars, NULL, 0, ASN_OCTET_STR, (char *) thedata->mteObjectsName, thedata->mteObjectsNameLen);     /* mteObjectsName */
+    snmp_varlist_add_variable(&vars, NULL, 0, ASN_UNSIGNED, (char *) &thedata->mteObjectsIndex, sizeof(thedata->mteObjectsIndex));      /* mteObjectsIndex */
+
+
+
+    header_complex_add_data(&mteObjectsTableStorage, vars, thedata);
+    DEBUGMSGTL(("mteObjectsTable", "registered an entry\n"));
+
+
+    DEBUGMSGTL(("mteObjectsTable", "done.\n"));
+    return SNMPERR_SUCCESS;
+}
+
+
+/*
+ * parse_mteObjectsTable():
+ *   parses .conf file entries needed to configure the mib.
+ */
+void
+parse_mteObjectsTable(const char *token, char *line)
+{
+    size_t          tmpint;
+    struct mteObjectsTable_data *StorageTmp =
+        SNMP_MALLOC_STRUCT(mteObjectsTable_data);
+
+    DEBUGMSGTL(("mteObjectsTable", "parsing config...  "));
+
+
+    if (StorageTmp == NULL) {
+        config_perror("malloc failure");
+        return;
+    }
+
+
+    line =
+        read_config_read_data(ASN_OCTET_STR, line, &StorageTmp->mteOwner,
+                              &StorageTmp->mteOwnerLen);
+    if (StorageTmp->mteOwner == NULL) {
+        config_perror("invalid specification for mteOwner");
+        return;
+    }
+
+    line =
+        read_config_read_data(ASN_OCTET_STR, line,
+                              &StorageTmp->mteObjectsName,
+                              &StorageTmp->mteObjectsNameLen);
+    if (StorageTmp->mteObjectsName == NULL) {
+        config_perror("invalid specification for mteObjectsName");
+        return;
+    }
+
+    line =
+        read_config_read_data(ASN_UNSIGNED, line,
+                              &StorageTmp->mteObjectsIndex, &tmpint);
+
+    line =
+        read_config_read_data(ASN_OBJECT_ID, line,
+                              &StorageTmp->mteObjectsID,
+                              &StorageTmp->mteObjectsIDLen);
+    if (StorageTmp->mteObjectsID == NULL) {
+        config_perror("invalid specification for mteObjectsID");
+        return;
+    }
+
+    line =
+        read_config_read_data(ASN_INTEGER, line,
+                              &StorageTmp->mteObjectsIDWildcard, &tmpint);
+
+    line =
+        read_config_read_data(ASN_INTEGER, line,
+                              &StorageTmp->mteObjectsEntryStatus, &tmpint);
+
+
+
+
+    mteObjectsTable_add(StorageTmp);
+
+
+    DEBUGMSGTL(("mteObjectsTable", "done.\n"));
+}
+
+
+
+
+/*
+ * store_mteObjectsTable():
+ *   stores .conf file entries needed to configure the mib.
+ */
+int
+store_mteObjectsTable(int majorID, int minorID, void *serverarg,
+                      void *clientarg)
+{
+    char            line[SNMP_MAXBUF];
+    char           *cptr;
+    size_t          tmpint;
+    struct mteObjectsTable_data *StorageTmp;
+    struct header_complex_index *hcindex;
+
+
+    DEBUGMSGTL(("mteObjectsTable", "storing data...  "));
+
+
+    for (hcindex = mteObjectsTableStorage; hcindex != NULL;
+         hcindex = hcindex->next) {
+        StorageTmp = (struct mteObjectsTable_data *) hcindex->data;
+
+        if (StorageTmp->storagetype != ST_READONLY) {
+            memset(line, 0, sizeof(line));
+            strcat(line, "mteObjectsTable ");
+            cptr = line + strlen(line);
+
+
+            cptr =
+                read_config_store_data(ASN_OCTET_STR, cptr,
+                                       &StorageTmp->mteOwner,
+                                       &StorageTmp->mteOwnerLen);
+            cptr =
+                read_config_store_data(ASN_OCTET_STR, cptr,
+                                       &StorageTmp->mteObjectsName,
+                                       &StorageTmp->mteObjectsNameLen);
+            cptr =
+                read_config_store_data(ASN_UNSIGNED, cptr,
+                                       &StorageTmp->mteObjectsIndex,
+                                       &tmpint);
+            cptr =
+                read_config_store_data(ASN_OBJECT_ID, cptr,
+                                       &StorageTmp->mteObjectsID,
+                                       &StorageTmp->mteObjectsIDLen);
+            cptr =
+                read_config_store_data(ASN_INTEGER, cptr,
+                                       &StorageTmp->mteObjectsIDWildcard,
+                                       &tmpint);
+            cptr =
+                read_config_store_data(ASN_INTEGER, cptr,
+                                       &StorageTmp->mteObjectsEntryStatus,
+                                       &tmpint);
+
+
+
+            snmpd_store_config(line);
+        }
+    }
+    DEBUGMSGTL(("mteObjectsTable", "done.\n"));
+    return SNMPERR_SUCCESS;
+}
+
+
+
+
+/*
+ * var_mteObjectsTable():
+ *   Handle this table separately from the scalar value case.
+ *   The workings of this are basically the same as for var_mteObjectsTable above.
+ */
+unsigned char  *
+var_mteObjectsTable(struct variable *vp,
+                    oid * name,
+                    size_t * length,
+                    int exact,
+                    size_t * var_len, WriteMethod ** write_method)
+{
+
+
+    struct mteObjectsTable_data *StorageTmp = NULL;
+
+
+    DEBUGMSGTL(("mteObjectsTable",
+                "var_mteObjectsTable: Entering...  \n"));
+    /*
+     * this assumes you have registered all your data properly
+     */
+    if ((StorageTmp =
+         header_complex(mteObjectsTableStorage, vp, name, length, exact,
+                        var_len, write_method)) == NULL) {
+        if (vp->magic == MTEOBJECTSENTRYSTATUS)
+            *write_method = write_mteObjectsEntryStatus;
+        return NULL;
+    }
+
+    /*
+     * this is where we do the value assignments for the mib results.
+     */
+    switch (vp->magic) {
+
+
+    case MTEOBJECTSID:
+        *write_method = write_mteObjectsID;
+        *var_len = (StorageTmp->mteObjectsIDLen) * sizeof(oid);
+        return (u_char *) StorageTmp->mteObjectsID;
+
+    case MTEOBJECTSIDWILDCARD:
+        *write_method = write_mteObjectsIDWildcard;
+        *var_len = sizeof(StorageTmp->mteObjectsIDWildcard);
+        return (u_char *) & StorageTmp->mteObjectsIDWildcard;
+
+    case MTEOBJECTSENTRYSTATUS:
+        *write_method = write_mteObjectsEntryStatus;
+        *var_len = sizeof(StorageTmp->mteObjectsEntryStatus);
+        return (u_char *) & StorageTmp->mteObjectsEntryStatus;
+
+
+    default:
+        ERROR_MSG("");
+    }
+    return NULL;
+}
+
+
+
+
+int
+write_mteObjectsID(int action,
+                   u_char * var_val,
+                   u_char var_val_type,
+                   size_t var_val_len,
+                   u_char * statP, oid * name, size_t name_len)
+{
+    static oid     *tmpvar;
+    struct mteObjectsTable_data *StorageTmp = NULL;
+    static size_t   tmplen;
+    size_t          newlen =
+        name_len - (sizeof(mteObjectsTable_variables_oid) / sizeof(oid) +
+                    3 - 1);
+
+
+    DEBUGMSGTL(("mteObjectsTable",
+                "write_mteObjectsID entering action=%d...  \n", action));
+    if ((StorageTmp =
+         header_complex(mteObjectsTableStorage, NULL,
+                        &name[sizeof(mteObjectsTable_variables_oid) /
+                              sizeof(oid) + 3 - 1], &newlen, 1, NULL,
+                        NULL)) == NULL)
+        return SNMP_ERR_NOSUCHNAME;     /* remove if you support creation here */
+
+    if (StorageTmp && StorageTmp->storagetype == ST_READONLY) {
+        return SNMP_ERR_NOTWRITABLE;
+    }
+
+    switch (action) {
+    case RESERVE1:
+        if (var_val_type != ASN_OBJECT_ID) {
+            snmp_log(LOG_ERR, "write to mteObjectsID not ASN_OBJECT_ID\n");
+            return SNMP_ERR_WRONGTYPE;
+        }
+        break;
+
+
+    case RESERVE2:
+        /*
+         * memory reseveration, final preparation... 
+         */
+        break;
+
+
+    case FREE:
+        /*
+         * Release any resources that have been allocated 
+         */
+        break;
+
+
+    case ACTION:
+        /*
+         * The variable has been stored in objid for
+         * you to use, and you have just been asked to do something with
+         * it.  Note that anything done here must be reversable in the UNDO case 
+         */
+        tmpvar = StorageTmp->mteObjectsID;
+        tmplen = StorageTmp->mteObjectsIDLen;
+        memdup((u_char **) & StorageTmp->mteObjectsID, var_val,
+               var_val_len);
+        StorageTmp->mteObjectsIDLen = var_val_len / sizeof(oid);
+        break;
+
+
+    case UNDO:
+        /*
+         * Back out any changes made in the ACTION case 
+         */
+        SNMP_FREE(StorageTmp->mteObjectsID);
+        StorageTmp->mteObjectsID = tmpvar;
+        StorageTmp->mteObjectsIDLen = tmplen;
+        break;
+
+
+    case COMMIT:
+        /*
+         * Things are working well, so it's now safe to make the change
+         * permanently.  Make sure that anything done here can't fail! 
+         */
+        SNMP_FREE(tmpvar);
+        break;
+    }
+    return SNMP_ERR_NOERROR;
+}
+
+
+
+int
+write_mteObjectsIDWildcard(int action,
+                           u_char * var_val,
+                           u_char var_val_type,
+                           size_t var_val_len,
+                           u_char * statP, oid * name, size_t name_len)
+{
+    static int      tmpvar;
+    struct mteObjectsTable_data *StorageTmp = NULL;
+    size_t          newlen =
+        name_len - (sizeof(mteObjectsTable_variables_oid) / sizeof(oid) +
+                    3 - 1);
+
+
+    DEBUGMSGTL(("mteObjectsTable",
+                "write_mteObjectsIDWildcard entering action=%d...  \n",
+                action));
+    if ((StorageTmp =
+         header_complex(mteObjectsTableStorage, NULL,
+                        &name[sizeof(mteObjectsTable_variables_oid) /
+                              sizeof(oid) + 3 - 1], &newlen, 1, NULL,
+                        NULL)) == NULL)
+        return SNMP_ERR_NOSUCHNAME;     /* remove if you support creation here */
+
+    if (StorageTmp && StorageTmp->storagetype == ST_READONLY) {
+        return SNMP_ERR_NOTWRITABLE;
+    }
+
+    switch (action) {
+    case RESERVE1:
+        if (var_val_type != ASN_INTEGER) {
+            snmp_log(LOG_ERR,
+                     "write to mteObjectsIDWildcard not ASN_INTEGER\n");
+            return SNMP_ERR_WRONGTYPE;
+        }
+        break;
+
+
+    case RESERVE2:
+        /*
+         * memory reseveration, final preparation... 
+         */
+        break;
+
+
+    case FREE:
+        /*
+         * Release any resources that have been allocated 
+         */
+        break;
+
+
+    case ACTION:
+        /*
+         * The variable has been stored in long_ret for
+         * you to use, and you have just been asked to do something with
+         * it.  Note that anything done here must be reversable in the UNDO case 
+         */
+        tmpvar = StorageTmp->mteObjectsIDWildcard;
+        StorageTmp->mteObjectsIDWildcard = *((long *) var_val);
+        break;
+
+
+    case UNDO:
+        /*
+         * Back out any changes made in the ACTION case 
+         */
+        StorageTmp->mteObjectsIDWildcard = tmpvar;
+        break;
+
+
+    case COMMIT:
+        /*
+         * Things are working well, so it's now safe to make the change
+         * permanently.  Make sure that anything done here can't fail! 
+         */
+
+        break;
+    }
+    return SNMP_ERR_NOERROR;
+}
+
+
+
+
+
+
+int
+write_mteObjectsEntryStatus(int action,
+                            u_char * var_val,
+                            u_char var_val_type,
+                            size_t var_val_len,
+                            u_char * statP, oid * name, size_t name_len)
+{
+    struct mteObjectsTable_data *StorageTmp = NULL;
+    static struct mteObjectsTable_data *StorageNew, *StorageDel;
+    size_t          newlen =
+        name_len - (sizeof(mteObjectsTable_variables_oid) / sizeof(oid) +
+                    3 - 1);
+    static int      old_value;
+    int             set_value;
+    static netsnmp_variable_list *vars, *vp;
+    struct header_complex_index *hciptr;
+
+
+    StorageTmp =
+        header_complex(mteObjectsTableStorage, NULL,
+                       &name[sizeof(mteObjectsTable_variables_oid) /
+                             sizeof(oid) + 3 - 1], &newlen, 1, NULL, NULL);
+
+    if (var_val_type != ASN_INTEGER || var_val == NULL) {
+        snmp_log(LOG_ERR,
+                 "write to mteObjectsEntryStatus not ASN_INTEGER\n");
+        return SNMP_ERR_WRONGTYPE;
+    }
+
+    if (StorageTmp && StorageTmp->storagetype == ST_READONLY) {
+        return SNMP_ERR_NOTWRITABLE;
+    }
+
+    set_value = *((long *) var_val);
+
+
+    /*
+     * check legal range, and notReady is reserved for us, not a user 
+     */
+    if (set_value < 1 || set_value > 6 || set_value == RS_NOTREADY)
+        return SNMP_ERR_INCONSISTENTVALUE;
+
+
+    switch (action) {
+    case RESERVE1:
+        /*
+         * stage one: test validity 
+         */
+        if (StorageTmp == NULL) {
+            /*
+             * create the row now? 
+             */
+
+
+            /*
+             * ditch illegal values now 
+             */
+            if (set_value == RS_ACTIVE || set_value == RS_NOTINSERVICE)
+                return SNMP_ERR_INCONSISTENTVALUE;
+
+
+            /*
+             * destroying a non-existent row is actually legal 
+             */
+            if (set_value == RS_DESTROY) {
+                return SNMP_ERR_NOERROR;
+            }
+
+
+            /*
+             * illegal creation values 
+             */
+            if (set_value == RS_ACTIVE || set_value == RS_NOTINSERVICE) {
+                return SNMP_ERR_INCONSISTENTVALUE;
+            }
+        } else {
+            /*
+             * row exists.  Check for a valid state change 
+             */
+            if (set_value == RS_CREATEANDGO
+                || set_value == RS_CREATEANDWAIT) {
+                /*
+                 * can't create a row that exists 
+                 */
+                return SNMP_ERR_INCONSISTENTVALUE;
+            }
+            /*
+             * XXX: interaction with row storage type needed 
+             */
+        }
+        break;
+
+
+
+
+    case RESERVE2:
+        /*
+         * memory reseveration, final preparation... 
+         */
+        if (StorageTmp == NULL) {
+            /*
+             * creation 
+             */
+            vars = NULL;
+
+
+            snmp_varlist_add_variable(&vars, NULL, 0, ASN_OCTET_STR, NULL, 0);  /* mteOwner */
+            snmp_varlist_add_variable(&vars, NULL, 0, ASN_OCTET_STR, NULL, 0);  /* mteObjectsName */
+            snmp_varlist_add_variable(&vars, NULL, 0, ASN_UNSIGNED, NULL, 0);   /* mteObjectsIndex */
+
+            if (header_complex_parse_oid
+                (&
+                 (name
+                  [sizeof(mteObjectsTable_variables_oid) / sizeof(oid) +
+                   2]), newlen, vars) != SNMPERR_SUCCESS) {
+                /*
+                 * XXX: free, zero vars 
+                 */
+                return SNMP_ERR_INCONSISTENTNAME;
+            }
+            vp = vars;
+
+
+            StorageNew = SNMP_MALLOC_STRUCT(mteObjectsTable_data);
+            StorageNew->mteOwner = netsnmp_strdup_and_null(vp->val.string,
+                                                           vp->val_len);
+            StorageNew->mteOwnerLen = vp->val_len;
+            vp = vp->next_variable;
+            StorageNew->mteObjectsName  =
+                netsnmp_strdup_and_null(vp->val.string,
+                                        vp->val_len);
+            StorageNew->mteObjectsNameLen = vp->val_len;
+            vp = vp->next_variable;
+            StorageNew->mteObjectsIndex = *(vp->val.integer);
+
+            /*
+             * XXX: fill in default row values here into StorageNew 
+             */
+            StorageNew->mteObjectsID = calloc(1, sizeof(oid) * sizeof(2));      /* 0.0 */
+            StorageNew->mteObjectsIDLen = 2;
+            StorageNew->mteObjectsIDWildcard = MTEOBJECTSIDWILDCARD_FALSE;
+
+            StorageNew->mteObjectsEntryStatus = set_value;
+            /*
+             * XXX: free, zero vars, no longer needed? 
+             */
+        }
+
+
+        break;
+
+
+
+
+    case FREE:
+        /*
+         * XXX: free, zero vars 
+         */
+        /*
+         * Release any resources that have been allocated 
+         */
+        break;
+
+
+
+
+    case ACTION:
+        /*
+         * The variable has been stored in set_value for you to
+         * use, and you have just been asked to do something with
+         * it.  Note that anything done here must be reversable in
+         * the UNDO case 
+         */
+
+
+        if (StorageTmp == NULL) {
+            /*
+             * row creation, so add it 
+             */
+            if (StorageNew != NULL)
+                mteObjectsTable_add(StorageNew);
+            /*
+             * XXX: ack, and if it is NULL? 
+             */
+        } else if (set_value != RS_DESTROY) {
+            /*
+             * set the flag? 
+             */
+            old_value = StorageTmp->mteObjectsEntryStatus;
+            StorageTmp->mteObjectsEntryStatus = *((long *) var_val);
+        } else {
+            /*
+             * destroy...  extract it for now 
+             */
+            hciptr =
+                header_complex_find_entry(mteObjectsTableStorage,
+                                          StorageTmp);
+            StorageDel =
+                header_complex_extract_entry(&mteObjectsTableStorage,
+                                             hciptr);
+        }
+        break;
+
+
+
+
+    case UNDO:
+        /*
+         * Back out any changes made in the ACTION case 
+         */
+        if (StorageTmp == NULL) {
+            /*
+             * row creation, so remove it again 
+             */
+            hciptr =
+                header_complex_find_entry(mteObjectsTableStorage,
+                                          StorageTmp);
+            StorageDel =
+                header_complex_extract_entry(&mteObjectsTableStorage,
+                                             hciptr);
+            /*
+             * XXX: free it 
+             */
+        } else if (StorageDel != NULL) {
+            /*
+             * row deletion, so add it again 
+             */
+            mteObjectsTable_add(StorageDel);
+        } else {
+            StorageTmp->mteObjectsEntryStatus = old_value;
+        }
+        break;
+
+
+
+
+    case COMMIT:
+        /*
+         * Things are working well, so it's now safe to make the change
+         * permanently.  Make sure that anything done here can't fail! 
+         */
+        if (StorageDel != NULL) {
+            StorageDel = 0;
+            /*
+             * XXX: free it, its dead 
+             */
+        } else {
+            if (StorageTmp
+                && StorageTmp->mteObjectsEntryStatus == RS_CREATEANDGO) {
+                StorageTmp->mteObjectsEntryStatus = RS_ACTIVE;
+            } else if (StorageTmp &&
+                       StorageTmp->mteObjectsEntryStatus ==
+                       RS_CREATEANDWAIT) {
+                StorageTmp->mteObjectsEntryStatus = RS_NOTINSERVICE;
+            }
+        }
+        break;
+    }
+    return SNMP_ERR_NOERROR;
+}
+
+void
+mte_add_objects(netsnmp_variable_list * vars,
+                struct mteTriggerTable_data *item, const char *owner,
+                const char *name, oid * suffix, size_t suffix_len)
+{
+    struct header_complex_index *hcptr = mteObjectsTableStorage;
+
+    DEBUGMSGTL(("mteObjectsTable",
+                "Searching for objects to add for owner=%s / name=%s\n",
+                owner, name));
+
+    if (vars == NULL || item == NULL || owner == NULL || name == NULL ||
+        hcptr == NULL)
+        return;
+
+    /*
+     * get to end of variable chain 
+     */
+    while (vars->next_variable != NULL)
+        vars = vars->next_variable;
+
+
+    /*
+     * get to start of objects list 
+     */
+    while (hcptr &&
+           (strcmp(((struct mteObjectsTable_data *) hcptr->data)->mteOwner,
+                   owner) != 0 ||
+            strcmp(((struct mteObjectsTable_data *) hcptr->data)->
+                   mteObjectsName, name) != 0))
+        hcptr = hcptr->next;
+
+    /*
+     * add all objects 
+     */
+    while (hcptr &&
+           strcmp(((struct mteObjectsTable_data *) hcptr->data)->mteOwner,
+                  owner) == 0 &&
+           strcmp(((struct mteObjectsTable_data *) hcptr->data)->
+                  mteObjectsName, name) == 0) {
+        /*
+         * loop through objects 
+         */
+        netsnmp_pdu    *pdu = NULL, *response = NULL;
+        struct mteObjectsTable_data *node =
+            (struct mteObjectsTable_data *) hcptr->data;
+        oid             theoid[MAX_OID_LEN];
+        size_t          theoid_len;
+
+        /*
+         * copy in the suffix 
+         */
+        memcpy(theoid, node->mteObjectsID,
+               node->mteObjectsIDLen * sizeof(oid));
+        theoid_len = node->mteObjectsIDLen;
+        if (node->mteObjectsIDWildcard == MTEOBJECTSIDWILDCARD_TRUE &&
+            suffix && suffix_len > 0) {
+            theoid_len += suffix_len;
+            if (theoid_len > MAX_OID_LEN) {
+                break;          /* XXX: properly send trap or something? */
+            }
+
+            memcpy(&theoid[node->mteObjectsIDLen], suffix,
+                   suffix_len * sizeof(oid));
+        }
+
+        /*
+         * retrieve the value 
+         */
+        pdu = snmp_pdu_create(SNMP_MSG_GET);
+        snmp_add_null_var(pdu, theoid, theoid_len);
+        response = mte_get_response(item, pdu);
+
+        if (response) {
+            if (vars) {
+                vars->next_variable = response->variables;
+                vars = vars->next_variable;
+                DEBUGMSGTL(("mteObjectsTable", "Adding:  "));
+                DEBUGMSGOID(("mteObjectsTable", response->variables->name,
+                             response->variables->name_length));
+                DEBUGMSG(("mteObjectsTable", "\n"));
+            } else {
+                vars = response->variables;
+            }
+            /*
+             * erase response notion of the values we stole from it 
+             */
+            response->variables = NULL;
+            snmp_free_pdu(response);
+        }
+
+        /*
+         * move along 
+         */
+        hcptr = hcptr->next;
+    }
+    DEBUGMSGTL(("mteObjectsTable", "Done adding objects\n"));
+}
+
+int
+mte_add_object_to_table(const char *owner, const char *objname,
+                        oid * oidname, size_t oidname_len, int iswild)
+{
+    struct header_complex_index *hcptr = mteObjectsTableStorage, *lastnode;
+    static struct mteObjectsTable_data *StorageNew;
+
+    /*
+     * malloc initial struct 
+     */
+    StorageNew = SNMP_MALLOC_STRUCT(mteObjectsTable_data);
+    StorageNew->mteOwner = netsnmp_strdup_and_null(owner, strlen(owner));
+    StorageNew->mteOwnerLen = strlen(owner);
+    StorageNew->mteObjectsName = netsnmp_strdup_and_null(objname,
+                                                         strlen(objname));
+    StorageNew->mteObjectsNameLen = strlen(objname);
+
+    /*
+     * find the next number 
+     */
+    /*
+     * get to start of objects list 
+     */
+    while (hcptr &&
+           (strcmp(((struct mteObjectsTable_data *) hcptr->data)->mteOwner,
+                   owner) != 0 ||
+            strcmp(((struct mteObjectsTable_data *) hcptr->data)->
+                   mteObjectsName, objname) != 0))
+        hcptr = hcptr->next;
+
+    if (hcptr) {
+        /*
+         * an object existed.  Find the first one past and increment
+         * the previous number 
+         */
+        lastnode = hcptr;
+        while (hcptr &&
+               strcmp(((struct mteObjectsTable_data *) hcptr->data)->
+                      mteOwner, owner) == 0
+               && strcmp(((struct mteObjectsTable_data *) hcptr->data)->
+                         mteObjectsName, objname) == 0) {
+            lastnode = hcptr;
+            hcptr = hcptr->next;
+        }
+        StorageNew->mteObjectsIndex =
+            ((struct mteObjectsTable_data *) lastnode->data)->
+            mteObjectsIndex + 1;
+    } else {
+        StorageNew->mteObjectsIndex = 1;
+    }
+
+    /*
+     * XXX: fill in default row values here into StorageNew 
+     */
+    StorageNew->mteObjectsID = snmp_duplicate_objid(oidname, oidname_len);
+    StorageNew->mteObjectsIDLen = oidname_len;
+
+    if (iswild)
+        StorageNew->mteObjectsIDWildcard = MTEOBJECTSIDWILDCARD_TRUE;
+    else
+        StorageNew->mteObjectsIDWildcard = MTEOBJECTSIDWILDCARD_FALSE;
+
+    StorageNew->mteObjectsEntryStatus = RS_ACTIVE;
+    StorageNew->storagetype = ST_READONLY;
+    return mteObjectsTable_add(StorageNew);
+}
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/disman/mteObjectsTable.h tomato121/release/src/router/snmp/agent/mibgroup/disman/mteObjectsTable.h
--- tomato/release/src/router/snmp/agent/mibgroup/disman/mteObjectsTable.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/disman/mteObjectsTable.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,70 @@
+/*
+ * This file was generated by mib2c and is intended for use as a mib module
+ * for the ucd-snmp snmpd agent. 
+ */
+
+
+#ifndef _MIBGROUP_MTEOBJECTSTABLE_H
+#define _MIBGROUP_MTEOBJECTSTABLE_H
+
+
+/*
+ * we may use header_complex from the header_complex module 
+ */
+
+
+config_require(header_complex)
+
+
+    /*
+     * our storage structure(s) 
+     */
+     struct mteObjectsTable_data {
+
+         char           *mteOwner;
+         size_t          mteOwnerLen;
+         char           *mteObjectsName;
+         size_t          mteObjectsNameLen;
+         unsigned long   mteObjectsIndex;
+         oid            *mteObjectsID;
+         size_t          mteObjectsIDLen;
+         long            mteObjectsIDWildcard;
+         long            mteObjectsEntryStatus;
+         int             storagetype;
+     };
+
+/*
+ * enum definitions from the covered mib sections 
+ */
+
+
+#define MTEOBJECTSIDWILDCARD_TRUE                1
+#define MTEOBJECTSIDWILDCARD_FALSE               2
+
+/*
+ * function prototypes 
+ */
+
+
+     void            init_mteObjectsTable(void);
+     FindVarMethod   var_mteObjectsTable;
+     void            parse_mteObjectsTable(const char *, char *);
+     SNMPCallback    store_mteObjectsTable;
+     void            mte_add_objects(netsnmp_variable_list *,
+                                     struct mteTriggerTable_data *,
+                                     const char *, const char *, oid *,
+                                     size_t);
+     int             mte_add_object_to_table(const char *owner,
+                                             const char *objname,
+                                             oid * oidname,
+                                             size_t oidname_len,
+                                             int iswild);
+     WriteMethod     write_mteObjectsID;
+     WriteMethod     write_mteObjectsIDWildcard;
+     WriteMethod     write_mteObjectsEntryStatus;
+
+     WriteMethod     write_mteObjectsEntryStatus;
+
+
+
+#endif                          /* _MIBGROUP_MTEOBJECTSTABLE_H */
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/disman/mteTriggerBooleanTable.c tomato121/release/src/router/snmp/agent/mibgroup/disman/mteTriggerBooleanTable.c
--- tomato/release/src/router/snmp/agent/mibgroup/disman/mteTriggerBooleanTable.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/disman/mteTriggerBooleanTable.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,802 @@
+/*
+ * This file was generated by mib2c and is intended for use as
+ * a mib module for the ucd-snmp snmpd agent. 
+ */
+
+
+/*
+ * This should always be included first before anything else 
+ */
+#include <net-snmp/net-snmp-config.h>
+#if HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#if HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+
+
+/*
+ * minimal include directives 
+ */
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+#include "header_complex.h"
+#include "mteTriggerBooleanTable.h"
+#include "mteTriggerTable.h"
+
+
+/*
+ * mteTriggerBooleanTable_variables_oid:
+ *   this is the top level oid that we want to register under.  This
+ *   is essentially a prefix, with the suffix appearing in the
+ *   variable below.
+ */
+
+
+oid             mteTriggerBooleanTable_variables_oid[] =
+    { 1, 3, 6, 1, 2, 1, 88, 1, 2, 5 };
+
+
+/*
+ * variable2 mteTriggerBooleanTable_variables:
+ *   this variable defines function callbacks and type return information 
+ *   for the mteTriggerBooleanTable mib section 
+ */
+
+
+struct variable2 mteTriggerBooleanTable_variables[] = {
+    /*
+     * magic number        , variable type , ro/rw , callback fn  , L, oidsuffix 
+     */
+#define   MTETRIGGERBOOLEANCOMPARISON  3
+    {MTETRIGGERBOOLEANCOMPARISON, ASN_INTEGER, RWRITE,
+     var_mteTriggerBooleanTable, 2, {1, 1}},
+#define   MTETRIGGERBOOLEANVALUE  4
+    {MTETRIGGERBOOLEANVALUE, ASN_INTEGER, RWRITE,
+     var_mteTriggerBooleanTable, 2, {1, 2}},
+#define   MTETRIGGERBOOLEANSTARTUP  5
+    {MTETRIGGERBOOLEANSTARTUP, ASN_INTEGER, RWRITE,
+     var_mteTriggerBooleanTable, 2, {1, 3}},
+#define   MTETRIGGERBOOLEANOBJECTSOWNER  6
+    {MTETRIGGERBOOLEANOBJECTSOWNER, ASN_OCTET_STR, RWRITE,
+     var_mteTriggerBooleanTable, 2, {1, 4}},
+#define   MTETRIGGERBOOLEANOBJECTS  7
+    {MTETRIGGERBOOLEANOBJECTS, ASN_OCTET_STR, RWRITE,
+     var_mteTriggerBooleanTable, 2, {1, 5}},
+#define   MTETRIGGERBOOLEANEVENTOWNER  8
+    {MTETRIGGERBOOLEANEVENTOWNER, ASN_OCTET_STR, RWRITE,
+     var_mteTriggerBooleanTable, 2, {1, 6}},
+#define   MTETRIGGERBOOLEANEVENT  9
+    {MTETRIGGERBOOLEANEVENT, ASN_OCTET_STR, RWRITE,
+     var_mteTriggerBooleanTable, 2, {1, 7}},
+
+};
+/*
+ * (L = length of the oidsuffix) 
+ */
+
+
+/*
+ * global storage of our data, saved in and configured by header_complex() 
+ */
+extern struct header_complex_index *mteTriggerTableStorage;
+
+
+/*
+ * init_mteTriggerBooleanTable():
+ *   Initialization routine.  This is called when the agent starts up.
+ *   At a minimum, registration of your variables should take place here.
+ */
+void
+init_mteTriggerBooleanTable(void)
+{
+    DEBUGMSGTL(("mteTriggerBooleanTable", "initializing...  "));
+
+
+    /*
+     * register ourselves with the agent to handle our mib tree 
+     */
+    REGISTER_MIB("mteTriggerBooleanTable",
+                 mteTriggerBooleanTable_variables, variable2,
+                 mteTriggerBooleanTable_variables_oid);
+
+    DEBUGMSGTL(("mteTriggerBooleanTable", "done.\n"));
+}
+
+/*
+ * var_mteTriggerBooleanTable():
+ *   Handle this table separately from the scalar value case.
+ *   The workings of this are basically the same as for var_mteTriggerBooleanTable above.
+ */
+unsigned char  *
+var_mteTriggerBooleanTable(struct variable *vp,
+                           oid * name,
+                           size_t * length,
+                           int exact,
+                           size_t * var_len, WriteMethod ** write_method)
+{
+
+
+    struct mteTriggerTable_data *StorageTmp = NULL;
+
+
+    DEBUGMSGTL(("mteTriggerBooleanTable",
+                "var_mteTriggerBooleanTable: Entering...  \n"));
+    /*
+     * this assumes you have registered all your data properly
+     */
+    if ((StorageTmp =
+         header_complex(mteTriggerTableStorage, vp, name, length, exact,
+                        var_len, write_method)) == NULL)
+        return NULL;
+
+    if (!(StorageTmp->mteTriggerTest[0] & MTETRIGGERTEST_BOOLEAN))
+        return NULL;
+
+    /*
+     * this is where we do the value assignments for the mib results.
+     */
+    switch (vp->magic) {
+
+
+    case MTETRIGGERBOOLEANCOMPARISON:
+        *write_method = write_mteTriggerBooleanComparison;
+        *var_len = sizeof(StorageTmp->mteTriggerBooleanComparison);
+        return (u_char *) & StorageTmp->mteTriggerBooleanComparison;
+
+    case MTETRIGGERBOOLEANVALUE:
+        *write_method = write_mteTriggerBooleanValue;
+        *var_len = sizeof(StorageTmp->mteTriggerBooleanValue);
+        return (u_char *) & StorageTmp->mteTriggerBooleanValue;
+
+    case MTETRIGGERBOOLEANSTARTUP:
+        *write_method = write_mteTriggerBooleanStartup;
+        *var_len = sizeof(StorageTmp->mteTriggerBooleanStartup);
+        return (u_char *) & StorageTmp->mteTriggerBooleanStartup;
+
+    case MTETRIGGERBOOLEANOBJECTSOWNER:
+        *write_method = write_mteTriggerBooleanObjectsOwner;
+        *var_len = StorageTmp->mteTriggerBooleanObjectsOwnerLen;
+        return (u_char *) StorageTmp->mteTriggerBooleanObjectsOwner;
+
+    case MTETRIGGERBOOLEANOBJECTS:
+        *write_method = write_mteTriggerBooleanObjects;
+        *var_len = StorageTmp->mteTriggerBooleanObjectsLen;
+        return (u_char *) StorageTmp->mteTriggerBooleanObjects;
+
+    case MTETRIGGERBOOLEANEVENTOWNER:
+        *write_method = write_mteTriggerBooleanEventOwner;
+        *var_len = StorageTmp->mteTriggerBooleanEventOwnerLen;
+        return (u_char *) StorageTmp->mteTriggerBooleanEventOwner;
+
+    case MTETRIGGERBOOLEANEVENT:
+        *write_method = write_mteTriggerBooleanEvent;
+        *var_len = StorageTmp->mteTriggerBooleanEventLen;
+        return (u_char *) StorageTmp->mteTriggerBooleanEvent;
+
+
+    default:
+        ERROR_MSG("");
+    }
+    return NULL;
+}
+
+
+
+
+int
+write_mteTriggerBooleanComparison(int action,
+                                  u_char * var_val,
+                                  u_char var_val_type,
+                                  size_t var_val_len,
+                                  u_char * statP,
+                                  oid * name, size_t name_len)
+{
+    static int      tmpvar;
+    struct mteTriggerTable_data *StorageTmp = NULL;
+    size_t          newlen =
+        name_len -
+        (sizeof(mteTriggerBooleanTable_variables_oid) / sizeof(oid) + 3 -
+         1);
+
+
+    DEBUGMSGTL(("mteTriggerBooleanTable",
+                "write_mteTriggerBooleanComparison entering action=%d...  \n",
+                action));
+    if ((StorageTmp =
+         header_complex(mteTriggerTableStorage, NULL,
+                        &name[sizeof(mteTriggerBooleanTable_variables_oid)
+                              / sizeof(oid) + 3 - 1], &newlen, 1, NULL,
+                        NULL)) == NULL)
+        return SNMP_ERR_NOSUCHNAME;     /* remove if you support creation here */
+
+
+    switch (action) {
+    case RESERVE1:
+        if (var_val_type != ASN_INTEGER) {
+            fprintf(stderr,
+                    "write to mteTriggerBooleanComparison not ASN_INTEGER\n");
+            return SNMP_ERR_WRONGTYPE;
+        }
+        if (StorageTmp->storageType != ST_NONVOLATILE)
+            return SNMP_ERR_NOTWRITABLE;
+        break;
+
+
+    case RESERVE2:
+        /*
+         * memory reseveration, final preparation... 
+         */
+        break;
+
+
+    case FREE:
+        /*
+         * Release any resources that have been allocated 
+         */
+        break;
+
+
+    case ACTION:
+        /*
+         * The variable has been stored in long_ret for
+         * you to use, and you have just been asked to do something with
+         * it.  Note that anything done here must be reversable in the UNDO case 
+         */
+        tmpvar = StorageTmp->mteTriggerBooleanComparison;
+        StorageTmp->mteTriggerBooleanComparison = *((long *) var_val);
+        break;
+
+
+    case UNDO:
+        /*
+         * Back out any changes made in the ACTION case 
+         */
+        StorageTmp->mteTriggerBooleanComparison = tmpvar;
+        break;
+
+
+    case COMMIT:
+        /*
+         * Things are working well, so it's now safe to make the change
+         * permanently.  Make sure that anything done here can't fail! 
+         */
+
+        break;
+    }
+    return SNMP_ERR_NOERROR;
+}
+
+
+
+int
+write_mteTriggerBooleanValue(int action,
+                             u_char * var_val,
+                             u_char var_val_type,
+                             size_t var_val_len,
+                             u_char * statP, oid * name, size_t name_len)
+{
+    static int      tmpvar;
+    struct mteTriggerTable_data *StorageTmp = NULL;
+    size_t          newlen =
+        name_len -
+        (sizeof(mteTriggerBooleanTable_variables_oid) / sizeof(oid) + 3 -
+         1);
+
+
+    DEBUGMSGTL(("mteTriggerBooleanTable",
+                "write_mteTriggerBooleanValue entering action=%d...  \n",
+                action));
+    if ((StorageTmp =
+         header_complex(mteTriggerTableStorage, NULL,
+                        &name[sizeof(mteTriggerBooleanTable_variables_oid)
+                              / sizeof(oid) + 3 - 1], &newlen, 1, NULL,
+                        NULL)) == NULL)
+        return SNMP_ERR_NOSUCHNAME;     /* remove if you support creation here */
+
+
+    switch (action) {
+    case RESERVE1:
+        if (var_val_type != ASN_INTEGER) {
+            fprintf(stderr,
+                    "write to mteTriggerBooleanValue not ASN_INTEGER\n");
+            return SNMP_ERR_WRONGTYPE;
+        }
+        if (StorageTmp->storageType != ST_NONVOLATILE)
+            return SNMP_ERR_NOTWRITABLE;
+        break;
+
+
+    case RESERVE2:
+        /*
+         * memory reseveration, final preparation... 
+         */
+        break;
+
+
+    case FREE:
+        /*
+         * Release any resources that have been allocated 
+         */
+        break;
+
+
+    case ACTION:
+        /*
+         * The variable has been stored in long_ret for
+         * you to use, and you have just been asked to do something with
+         * it.  Note that anything done here must be reversable in the UNDO case 
+         */
+        tmpvar = StorageTmp->mteTriggerBooleanValue;
+        StorageTmp->mteTriggerBooleanValue = *((long *) var_val);
+        break;
+
+
+    case UNDO:
+        /*
+         * Back out any changes made in the ACTION case 
+         */
+        StorageTmp->mteTriggerBooleanValue = tmpvar;
+        break;
+
+
+    case COMMIT:
+        /*
+         * Things are working well, so it's now safe to make the change
+         * permanently.  Make sure that anything done here can't fail! 
+         */
+
+        break;
+    }
+    return SNMP_ERR_NOERROR;
+}
+
+
+
+int
+write_mteTriggerBooleanStartup(int action,
+                               u_char * var_val,
+                               u_char var_val_type,
+                               size_t var_val_len,
+                               u_char * statP, oid * name, size_t name_len)
+{
+    static int      tmpvar;
+    struct mteTriggerTable_data *StorageTmp = NULL;
+    size_t          newlen =
+        name_len -
+        (sizeof(mteTriggerBooleanTable_variables_oid) / sizeof(oid) + 3 -
+         1);
+
+
+    DEBUGMSGTL(("mteTriggerBooleanTable",
+                "write_mteTriggerBooleanStartup entering action=%d...  \n",
+                action));
+    if ((StorageTmp =
+         header_complex(mteTriggerTableStorage, NULL,
+                        &name[sizeof(mteTriggerBooleanTable_variables_oid)
+                              / sizeof(oid) + 3 - 1], &newlen, 1, NULL,
+                        NULL)) == NULL)
+        return SNMP_ERR_NOSUCHNAME;     /* remove if you support creation here */
+
+
+    switch (action) {
+    case RESERVE1:
+        if (var_val_type != ASN_INTEGER) {
+            fprintf(stderr,
+                    "write to mteTriggerBooleanStartup not ASN_INTEGER\n");
+            return SNMP_ERR_WRONGTYPE;
+        }
+        if (StorageTmp->storageType != ST_NONVOLATILE)
+            return SNMP_ERR_NOTWRITABLE;
+        break;
+
+
+    case RESERVE2:
+        /*
+         * memory reseveration, final preparation... 
+         */
+        break;
+
+
+    case FREE:
+        /*
+         * Release any resources that have been allocated 
+         */
+        break;
+
+
+    case ACTION:
+        /*
+         * The variable has been stored in long_ret for
+         * you to use, and you have just been asked to do something with
+         * it.  Note that anything done here must be reversable in the UNDO case 
+         */
+        tmpvar = StorageTmp->mteTriggerBooleanStartup;
+        StorageTmp->mteTriggerBooleanStartup = *((long *) var_val);
+        break;
+
+
+    case UNDO:
+        /*
+         * Back out any changes made in the ACTION case 
+         */
+        StorageTmp->mteTriggerBooleanStartup = tmpvar;
+        break;
+
+
+    case COMMIT:
+        /*
+         * Things are working well, so it's now safe to make the change
+         * permanently.  Make sure that anything done here can't fail! 
+         */
+
+        break;
+    }
+    return SNMP_ERR_NOERROR;
+}
+
+
+
+int
+write_mteTriggerBooleanObjectsOwner(int action,
+                                    u_char * var_val,
+                                    u_char var_val_type,
+                                    size_t var_val_len,
+                                    u_char * statP,
+                                    oid * name, size_t name_len)
+{
+    static char    *tmpvar;
+    struct mteTriggerTable_data *StorageTmp = NULL;
+    static size_t   tmplen;
+    size_t          newlen =
+        name_len -
+        (sizeof(mteTriggerBooleanTable_variables_oid) / sizeof(oid) + 3 -
+         1);
+
+
+    DEBUGMSGTL(("mteTriggerBooleanTable",
+                "write_mteTriggerBooleanObjectsOwner entering action=%d...  \n",
+                action));
+    if ((StorageTmp =
+         header_complex(mteTriggerTableStorage, NULL,
+                        &name[sizeof(mteTriggerBooleanTable_variables_oid)
+                              / sizeof(oid) + 3 - 1], &newlen, 1, NULL,
+                        NULL)) == NULL)
+        return SNMP_ERR_NOSUCHNAME;     /* remove if you support creation here */
+
+
+    switch (action) {
+    case RESERVE1:
+        if (var_val_type != ASN_OCTET_STR) {
+            fprintf(stderr,
+                    "write to mteTriggerBooleanObjectsOwner not ASN_OCTET_STR\n");
+            return SNMP_ERR_WRONGTYPE;
+        }
+        if (StorageTmp->storageType != ST_NONVOLATILE)
+            return SNMP_ERR_NOTWRITABLE;
+        break;
+
+
+    case RESERVE2:
+        /*
+         * memory reseveration, final preparation... 
+         */
+        break;
+
+
+    case FREE:
+        /*
+         * Release any resources that have been allocated 
+         */
+        break;
+
+
+    case ACTION:
+        /*
+         * The variable has been stored in string for
+         * you to use, and you have just been asked to do something with
+         * it.  Note that anything done here must be reversable in the UNDO case 
+         */
+        tmpvar = StorageTmp->mteTriggerBooleanObjectsOwner;
+        tmplen = StorageTmp->mteTriggerBooleanObjectsOwnerLen;
+        StorageTmp->mteTriggerBooleanObjectsOwner =
+            netsnmp_strdup_and_null(var_val, var_val_len);
+        StorageTmp->mteTriggerBooleanObjectsOwnerLen = var_val_len;
+        break;
+
+
+    case UNDO:
+        /*
+         * Back out any changes made in the ACTION case 
+         */
+        SNMP_FREE(StorageTmp->mteTriggerBooleanObjectsOwner);
+        StorageTmp->mteTriggerBooleanObjectsOwner = tmpvar;
+        StorageTmp->mteTriggerBooleanObjectsOwnerLen = tmplen;
+        break;
+
+
+    case COMMIT:
+        /*
+         * Things are working well, so it's now safe to make the change
+         * permanently.  Make sure that anything done here can't fail! 
+         */
+        SNMP_FREE(tmpvar);
+        break;
+    }
+    return SNMP_ERR_NOERROR;
+}
+
+
+
+int
+write_mteTriggerBooleanObjects(int action,
+                               u_char * var_val,
+                               u_char var_val_type,
+                               size_t var_val_len,
+                               u_char * statP, oid * name, size_t name_len)
+{
+    static char    *tmpvar;
+    struct mteTriggerTable_data *StorageTmp = NULL;
+    static size_t   tmplen;
+    size_t          newlen =
+        name_len -
+        (sizeof(mteTriggerBooleanTable_variables_oid) / sizeof(oid) + 3 -
+         1);
+
+
+    DEBUGMSGTL(("mteTriggerBooleanTable",
+                "write_mteTriggerBooleanObjects entering action=%d...  \n",
+                action));
+    if ((StorageTmp =
+         header_complex(mteTriggerTableStorage, NULL,
+                        &name[sizeof(mteTriggerBooleanTable_variables_oid)
+                              / sizeof(oid) + 3 - 1], &newlen, 1, NULL,
+                        NULL)) == NULL)
+        return SNMP_ERR_NOSUCHNAME;     /* remove if you support creation here */
+
+
+    switch (action) {
+    case RESERVE1:
+        if (var_val_type != ASN_OCTET_STR) {
+            fprintf(stderr,
+                    "write to mteTriggerBooleanObjects not ASN_OCTET_STR\n");
+            return SNMP_ERR_WRONGTYPE;
+        }
+        if (StorageTmp->storageType != ST_NONVOLATILE)
+            return SNMP_ERR_NOTWRITABLE;
+        break;
+
+
+    case RESERVE2:
+        /*
+         * memory reseveration, final preparation... 
+         */
+        break;
+
+
+    case FREE:
+        /*
+         * Release any resources that have been allocated 
+         */
+        break;
+
+
+    case ACTION:
+        /*
+         * The variable has been stored in string for
+         * you to use, and you have just been asked to do something with
+         * it.  Note that anything done here must be reversable in the UNDO case 
+         */
+        tmpvar = StorageTmp->mteTriggerBooleanObjects;
+        tmplen = StorageTmp->mteTriggerBooleanObjectsLen;
+        StorageTmp->mteTriggerBooleanObjects =
+            netsnmp_strdup_and_null(var_val, var_val_len);
+        StorageTmp->mteTriggerBooleanObjectsLen = var_val_len;
+        break;
+
+
+    case UNDO:
+        /*
+         * Back out any changes made in the ACTION case 
+         */
+        SNMP_FREE(StorageTmp->mteTriggerBooleanObjects);
+        StorageTmp->mteTriggerBooleanObjects = tmpvar;
+        StorageTmp->mteTriggerBooleanObjectsLen = tmplen;
+        break;
+
+
+    case COMMIT:
+        /*
+         * Things are working well, so it's now safe to make the change
+         * permanently.  Make sure that anything done here can't fail! 
+         */
+        SNMP_FREE(tmpvar);
+        break;
+    }
+    return SNMP_ERR_NOERROR;
+}
+
+
+
+int
+write_mteTriggerBooleanEventOwner(int action,
+                                  u_char * var_val,
+                                  u_char var_val_type,
+                                  size_t var_val_len,
+                                  u_char * statP,
+                                  oid * name, size_t name_len)
+{
+    static char    *tmpvar;
+    struct mteTriggerTable_data *StorageTmp = NULL;
+    static size_t   tmplen;
+    size_t          newlen =
+        name_len -
+        (sizeof(mteTriggerBooleanTable_variables_oid) / sizeof(oid) + 3 -
+         1);
+
+
+    DEBUGMSGTL(("mteTriggerBooleanTable",
+                "write_mteTriggerBooleanEventOwner entering action=%d...  \n",
+                action));
+    if ((StorageTmp =
+         header_complex(mteTriggerTableStorage, NULL,
+                        &name[sizeof(mteTriggerBooleanTable_variables_oid)
+                              / sizeof(oid) + 3 - 1], &newlen, 1, NULL,
+                        NULL)) == NULL)
+        return SNMP_ERR_NOSUCHNAME;     /* remove if you support creation here */
+
+
+    switch (action) {
+    case RESERVE1:
+        if (var_val_type != ASN_OCTET_STR) {
+            fprintf(stderr,
+                    "write to mteTriggerBooleanEventOwner not ASN_OCTET_STR\n");
+            return SNMP_ERR_WRONGTYPE;
+        }
+        if (StorageTmp->storageType != ST_NONVOLATILE)
+            return SNMP_ERR_NOTWRITABLE;
+        break;
+
+
+    case RESERVE2:
+        /*
+         * memory reseveration, final preparation... 
+         */
+        break;
+
+
+    case FREE:
+        /*
+         * Release any resources that have been allocated 
+         */
+        break;
+
+
+    case ACTION:
+        /*
+         * The variable has been stored in string for
+         * you to use, and you have just been asked to do something with
+         * it.  Note that anything done here must be reversable in the UNDO case 
+         */
+        tmpvar = StorageTmp->mteTriggerBooleanEventOwner;
+        tmplen = StorageTmp->mteTriggerBooleanEventOwnerLen;
+        StorageTmp->mteTriggerBooleanEventOwner =
+            netsnmp_strdup_and_null(var_val, var_val_len);
+        StorageTmp->mteTriggerBooleanEventOwnerLen = var_val_len;
+        break;
+
+
+    case UNDO:
+        /*
+         * Back out any changes made in the ACTION case 
+         */
+        SNMP_FREE(StorageTmp->mteTriggerBooleanEventOwner);
+        StorageTmp->mteTriggerBooleanEventOwner = tmpvar;
+        StorageTmp->mteTriggerBooleanEventOwnerLen = tmplen;
+        break;
+
+
+    case COMMIT:
+        /*
+         * Things are working well, so it's now safe to make the change
+         * permanently.  Make sure that anything done here can't fail! 
+         */
+        SNMP_FREE(tmpvar);
+        break;
+    }
+    return SNMP_ERR_NOERROR;
+}
+
+
+
+int
+write_mteTriggerBooleanEvent(int action,
+                             u_char * var_val,
+                             u_char var_val_type,
+                             size_t var_val_len,
+                             u_char * statP, oid * name, size_t name_len)
+{
+    static char    *tmpvar;
+    struct mteTriggerTable_data *StorageTmp = NULL;
+    static size_t   tmplen;
+    size_t          newlen =
+        name_len -
+        (sizeof(mteTriggerBooleanTable_variables_oid) / sizeof(oid) + 3 -
+         1);
+
+
+    DEBUGMSGTL(("mteTriggerBooleanTable",
+                "write_mteTriggerBooleanEvent entering action=%d...  \n",
+                action));
+    if ((StorageTmp =
+         header_complex(mteTriggerTableStorage, NULL,
+                        &name[sizeof(mteTriggerBooleanTable_variables_oid)
+                              / sizeof(oid) + 3 - 1], &newlen, 1, NULL,
+                        NULL)) == NULL)
+        return SNMP_ERR_NOSUCHNAME;     /* remove if you support creation here */
+
+
+    switch (action) {
+    case RESERVE1:
+        if (var_val_type != ASN_OCTET_STR) {
+            fprintf(stderr,
+                    "write to mteTriggerBooleanEvent not ASN_OCTET_STR\n");
+            return SNMP_ERR_WRONGTYPE;
+        }
+        if (StorageTmp->storageType != ST_NONVOLATILE)
+            return SNMP_ERR_NOTWRITABLE;
+        break;
+
+
+    case RESERVE2:
+        /*
+         * memory reseveration, final preparation... 
+         */
+        break;
+
+
+    case FREE:
+        /*
+         * Release any resources that have been allocated 
+         */
+        break;
+
+
+    case ACTION:
+        /*
+         * The variable has been stored in string for
+         * you to use, and you have just been asked to do something with
+         * it.  Note that anything done here must be reversable in the UNDO case 
+         */
+        tmpvar = StorageTmp->mteTriggerBooleanEvent;
+        tmplen = StorageTmp->mteTriggerBooleanEventLen;
+        StorageTmp->mteTriggerBooleanEvent =
+            netsnmp_strdup_and_null(var_val, var_val_len);
+        StorageTmp->mteTriggerBooleanEventLen = var_val_len;
+        break;
+
+
+    case UNDO:
+        /*
+         * Back out any changes made in the ACTION case 
+         */
+        SNMP_FREE(StorageTmp->mteTriggerBooleanEvent);
+        StorageTmp->mteTriggerBooleanEvent = tmpvar;
+        StorageTmp->mteTriggerBooleanEventLen = tmplen;
+        break;
+
+
+    case COMMIT:
+        /*
+         * Things are working well, so it's now safe to make the change
+         * permanently.  Make sure that anything done here can't fail! 
+         */
+        SNMP_FREE(tmpvar);
+        break;
+    }
+    return SNMP_ERR_NOERROR;
+}
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/disman/mteTriggerBooleanTable.h tomato121/release/src/router/snmp/agent/mibgroup/disman/mteTriggerBooleanTable.h
--- tomato/release/src/router/snmp/agent/mibgroup/disman/mteTriggerBooleanTable.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/disman/mteTriggerBooleanTable.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,45 @@
+/*
+ * This file was generated by mib2c and is intended for use as a mib module
+ * for the ucd-snmp snmpd agent. 
+ */
+
+
+#ifndef _MIBGROUP_MTETRIGGERBOOLEANTABLE_H
+#define _MIBGROUP_MTETRIGGERBOOLEANTABLE_H
+
+
+/*
+ * we may use header_complex from the header_complex module 
+ */
+
+
+config_require(header_complex)
+    /*
+     * enum definitions from the covered mib sections 
+     */
+#define MTETRIGGERBOOLEANCOMPARISON_UNEQUAL      1
+#define MTETRIGGERBOOLEANCOMPARISON_EQUAL        2
+#define MTETRIGGERBOOLEANCOMPARISON_LESS         3
+#define MTETRIGGERBOOLEANCOMPARISON_LESSOREQUAL  4
+#define MTETRIGGERBOOLEANCOMPARISON_GREATER      5
+#define MTETRIGGERBOOLEANCOMPARISON_GREATEROREQUAL 6
+#define MTETRIGGERBOOLEANSTARTUP_TRUE            1
+#define MTETRIGGERBOOLEANSTARTUP_FALSE           2
+    /*
+     * function prototypes 
+     */
+     void            init_mteTriggerBooleanTable(void);
+     FindVarMethod   var_mteTriggerBooleanTable;
+
+     WriteMethod     write_mteTriggerBooleanComparison;
+     WriteMethod     write_mteTriggerBooleanValue;
+     WriteMethod     write_mteTriggerBooleanStartup;
+     WriteMethod     write_mteTriggerBooleanObjectsOwner;
+     WriteMethod     write_mteTriggerBooleanObjects;
+     WriteMethod     write_mteTriggerBooleanEventOwner;
+     WriteMethod     write_mteTriggerBooleanEvent;
+
+
+
+
+#endif                          /* _MIBGROUP_MTETRIGGERBOOLEANTABLE_H */
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/disman/mteTriggerDeltaTable.c tomato121/release/src/router/snmp/agent/mibgroup/disman/mteTriggerDeltaTable.c
--- tomato/release/src/router/snmp/agent/mibgroup/disman/mteTriggerDeltaTable.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/disman/mteTriggerDeltaTable.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,416 @@
+/*
+ * This file was generated by mib2c and is intended for use as
+ * a mib module for the ucd-snmp snmpd agent. 
+ */
+
+
+/*
+ * This should always be included first before anything else 
+ */
+#include <net-snmp/net-snmp-config.h>
+#if HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#if HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+
+
+/*
+ * minimal include directives 
+ */
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+#include "header_complex.h"
+#include "mteTriggerDeltaTable.h"
+#include "mteTriggerTable.h"
+
+
+/*
+ * mteTriggerDeltaTable_variables_oid:
+ *   this is the top level oid that we want to register under.  This
+ *   is essentially a prefix, with the suffix appearing in the
+ *   variable below.
+ */
+
+
+oid             mteTriggerDeltaTable_variables_oid[] =
+    { 1, 3, 6, 1, 2, 1, 88, 1, 2, 3 };
+
+
+/*
+ * variable2 mteTriggerDeltaTable_variables:
+ *   this variable defines function callbacks and type return information 
+ *   for the mteTriggerDeltaTable mib section 
+ */
+
+
+struct variable2 mteTriggerDeltaTable_variables[] = {
+    /*
+     * magic number        , variable type , ro/rw , callback fn  , L, oidsuffix 
+     */
+#define   MTETRIGGERDELTADISCONTINUITYID  3
+    {MTETRIGGERDELTADISCONTINUITYID, ASN_OBJECT_ID, RWRITE,
+     var_mteTriggerDeltaTable, 2, {1, 1}},
+#define   MTETRIGGERDELTADISCONTINUITYIDWILDCARD  4
+    {MTETRIGGERDELTADISCONTINUITYIDWILDCARD, ASN_INTEGER, RWRITE,
+     var_mteTriggerDeltaTable, 2, {1, 2}},
+#define   MTETRIGGERDELTADISCONTINUITYIDTYPE  5
+    {MTETRIGGERDELTADISCONTINUITYIDTYPE, ASN_INTEGER, RWRITE,
+     var_mteTriggerDeltaTable, 2, {1, 3}},
+
+};
+/*
+ * (L = length of the oidsuffix) 
+ */
+
+
+/*
+ * global storage of our data, saved in and configured by header_complex() 
+ */
+extern struct header_complex_index *mteTriggerTableStorage;
+
+
+
+/*
+ * init_mteTriggerDeltaTable():
+ *   Initialization routine.  This is called when the agent starts up.
+ *   At a minimum, registration of your variables should take place here.
+ */
+void
+init_mteTriggerDeltaTable(void)
+{
+    DEBUGMSGTL(("mteTriggerDeltaTable", "initializing...  "));
+
+
+    /*
+     * register ourselves with the agent to handle our mib tree 
+     */
+    REGISTER_MIB("mteTriggerDeltaTable", mteTriggerDeltaTable_variables,
+                 variable2, mteTriggerDeltaTable_variables_oid);
+
+    DEBUGMSGTL(("mteTriggerDeltaTable", "done.\n"));
+}
+
+/*
+ * var_mteTriggerDeltaTable():
+ *   Handle this table separately from the scalar value case.
+ *   The workings of this are basically the same as for var_mteTriggerDeltaTable above.
+ */
+unsigned char  *
+var_mteTriggerDeltaTable(struct variable *vp,
+                         oid * name,
+                         size_t * length,
+                         int exact,
+                         size_t * var_len, WriteMethod ** write_method)
+{
+
+
+    struct mteTriggerTable_data *StorageTmp = NULL;
+
+
+    DEBUGMSGTL(("mteTriggerDeltaTable",
+                "var_mteTriggerDeltaTable: Entering...  \n"));
+    /*
+     * this assumes you have registered all your data properly
+     */
+    if ((StorageTmp =
+         header_complex(mteTriggerTableStorage, vp, name, length, exact,
+                        var_len, write_method)) == NULL)
+        return NULL;
+
+    /*
+     * this is where we do the value assignments for the mib results.
+     */
+    switch (vp->magic) {
+
+
+    case MTETRIGGERDELTADISCONTINUITYID:
+        *write_method = write_mteTriggerDeltaDiscontinuityID;
+        *var_len =
+            StorageTmp->mteTriggerDeltaDiscontinuityIDLen * sizeof(oid);
+        return (u_char *) StorageTmp->mteTriggerDeltaDiscontinuityID;
+
+    case MTETRIGGERDELTADISCONTINUITYIDWILDCARD:
+        *write_method = write_mteTriggerDeltaDiscontinuityIDWildcard;
+        *var_len =
+            sizeof(StorageTmp->mteTriggerDeltaDiscontinuityIDWildcard);
+        return (u_char *) & StorageTmp->
+            mteTriggerDeltaDiscontinuityIDWildcard;
+
+    case MTETRIGGERDELTADISCONTINUITYIDTYPE:
+        *write_method = write_mteTriggerDeltaDiscontinuityIDType;
+        *var_len = sizeof(StorageTmp->mteTriggerDeltaDiscontinuityIDType);
+        return (u_char *) & StorageTmp->mteTriggerDeltaDiscontinuityIDType;
+
+
+    default:
+        ERROR_MSG("");
+    }
+    return NULL;
+}
+
+
+
+
+int
+write_mteTriggerDeltaDiscontinuityID(int action,
+                                     u_char * var_val,
+                                     u_char var_val_type,
+                                     size_t var_val_len,
+                                     u_char * statP,
+                                     oid * name, size_t name_len)
+{
+    static oid     *tmpvar;
+    struct mteTriggerTable_data *StorageTmp = NULL;
+    static size_t   tmplen;
+    size_t          newlen =
+        name_len -
+        (sizeof(mteTriggerDeltaTable_variables_oid) / sizeof(oid) + 3 - 1);
+
+
+    DEBUGMSGTL(("mteTriggerDeltaTable",
+                "write_mteTriggerDeltaDiscontinuityID entering action=%d...  \n",
+                action));
+    if ((StorageTmp =
+         header_complex(mteTriggerTableStorage, NULL,
+                        &name[sizeof(mteTriggerDeltaTable_variables_oid) /
+                              sizeof(oid) + 3 - 1], &newlen, 1, NULL,
+                        NULL)) == NULL)
+        return SNMP_ERR_NOSUCHNAME;     /* remove if you support creation here */
+
+
+    switch (action) {
+    case RESERVE1:
+        if (var_val_type != ASN_OBJECT_ID) {
+            fprintf(stderr,
+                    "write to mteTriggerDeltaDiscontinuityID not ASN_OBJECT_ID\n");
+            return SNMP_ERR_WRONGTYPE;
+        }
+        if (StorageTmp->storageType != ST_NONVOLATILE)
+            return SNMP_ERR_NOTWRITABLE;
+        break;
+
+
+    case RESERVE2:
+        /*
+         * memory reseveration, final preparation... 
+         */
+        break;
+
+
+    case FREE:
+        /*
+         * Release any resources that have been allocated 
+         */
+        break;
+
+
+    case ACTION:
+        /*
+         * The variable has been stored in objid for
+         * you to use, and you have just been asked to do something with
+         * it.  Note that anything done here must be reversable in the UNDO case 
+         */
+        tmpvar = StorageTmp->mteTriggerDeltaDiscontinuityID;
+        tmplen = StorageTmp->mteTriggerDeltaDiscontinuityIDLen;
+        memdup((u_char **) & StorageTmp->mteTriggerDeltaDiscontinuityID,
+               var_val, var_val_len);
+        StorageTmp->mteTriggerDeltaDiscontinuityIDLen =
+            var_val_len / sizeof(oid);
+        break;
+
+
+    case UNDO:
+        /*
+         * Back out any changes made in the ACTION case 
+         */
+        SNMP_FREE(StorageTmp->mteTriggerDeltaDiscontinuityID);
+        StorageTmp->mteTriggerDeltaDiscontinuityID = tmpvar;
+        StorageTmp->mteTriggerDeltaDiscontinuityIDLen = tmplen;
+        break;
+
+
+    case COMMIT:
+        /*
+         * Things are working well, so it's now safe to make the change
+         * permanently.  Make sure that anything done here can't fail! 
+         */
+        SNMP_FREE(tmpvar);
+        break;
+    }
+    return SNMP_ERR_NOERROR;
+}
+
+
+
+int
+write_mteTriggerDeltaDiscontinuityIDWildcard(int action,
+                                             u_char * var_val,
+                                             u_char var_val_type,
+                                             size_t var_val_len,
+                                             u_char * statP,
+                                             oid * name, size_t name_len)
+{
+    static int      tmpvar;
+    struct mteTriggerTable_data *StorageTmp = NULL;
+    size_t          newlen =
+        name_len -
+        (sizeof(mteTriggerDeltaTable_variables_oid) / sizeof(oid) + 3 - 1);
+
+
+    DEBUGMSGTL(("mteTriggerDeltaTable",
+                "write_mteTriggerDeltaDiscontinuityIDWildcard entering action=%d...  \n",
+                action));
+    if ((StorageTmp =
+         header_complex(mteTriggerTableStorage, NULL,
+                        &name[sizeof(mteTriggerDeltaTable_variables_oid) /
+                              sizeof(oid) + 3 - 1], &newlen, 1, NULL,
+                        NULL)) == NULL)
+        return SNMP_ERR_NOSUCHNAME;     /* remove if you support creation here */
+
+
+    switch (action) {
+    case RESERVE1:
+        if (var_val_type != ASN_INTEGER) {
+            fprintf(stderr,
+                    "write to mteTriggerDeltaDiscontinuityIDWildcard not ASN_INTEGER\n");
+            return SNMP_ERR_WRONGTYPE;
+        }
+        if (StorageTmp->storageType != ST_NONVOLATILE)
+            return SNMP_ERR_NOTWRITABLE;
+        break;
+
+
+    case RESERVE2:
+        /*
+         * memory reseveration, final preparation... 
+         */
+        break;
+
+
+    case FREE:
+        /*
+         * Release any resources that have been allocated 
+         */
+        break;
+
+
+    case ACTION:
+        /*
+         * The variable has been stored in long_ret for
+         * you to use, and you have just been asked to do something with
+         * it.  Note that anything done here must be reversable in the UNDO case 
+         */
+        tmpvar = StorageTmp->mteTriggerDeltaDiscontinuityIDWildcard;
+        StorageTmp->mteTriggerDeltaDiscontinuityIDWildcard =
+            *((long *) var_val);
+        break;
+
+
+    case UNDO:
+        /*
+         * Back out any changes made in the ACTION case 
+         */
+        StorageTmp->mteTriggerDeltaDiscontinuityIDWildcard = tmpvar;
+        break;
+
+
+    case COMMIT:
+        /*
+         * Things are working well, so it's now safe to make the change
+         * permanently.  Make sure that anything done here can't fail! 
+         */
+
+        break;
+    }
+    return SNMP_ERR_NOERROR;
+}
+
+
+
+int
+write_mteTriggerDeltaDiscontinuityIDType(int action,
+                                         u_char * var_val,
+                                         u_char var_val_type,
+                                         size_t var_val_len,
+                                         u_char * statP,
+                                         oid * name, size_t name_len)
+{
+    static int      tmpvar;
+    struct mteTriggerTable_data *StorageTmp = NULL;
+    size_t          newlen =
+        name_len -
+        (sizeof(mteTriggerDeltaTable_variables_oid) / sizeof(oid) + 3 - 1);
+
+
+    DEBUGMSGTL(("mteTriggerDeltaTable",
+                "write_mteTriggerDeltaDiscontinuityIDType entering action=%d...  \n",
+                action));
+    if ((StorageTmp =
+         header_complex(mteTriggerTableStorage, NULL,
+                        &name[sizeof(mteTriggerDeltaTable_variables_oid) /
+                              sizeof(oid) + 3 - 1], &newlen, 1, NULL,
+                        NULL)) == NULL)
+        return SNMP_ERR_NOSUCHNAME;     /* remove if you support creation here */
+
+
+    switch (action) {
+    case RESERVE1:
+        if (var_val_type != ASN_INTEGER) {
+            fprintf(stderr,
+                    "write to mteTriggerDeltaDiscontinuityIDType not ASN_INTEGER\n");
+            return SNMP_ERR_WRONGTYPE;
+        }
+        if (StorageTmp->storageType != ST_NONVOLATILE)
+            return SNMP_ERR_NOTWRITABLE;
+        break;
+
+
+    case RESERVE2:
+        /*
+         * memory reseveration, final preparation... 
+         */
+        break;
+
+
+    case FREE:
+        /*
+         * Release any resources that have been allocated 
+         */
+        break;
+
+
+    case ACTION:
+        /*
+         * The variable has been stored in long_ret for
+         * you to use, and you have just been asked to do something with
+         * it.  Note that anything done here must be reversable in the UNDO case 
+         */
+        tmpvar = StorageTmp->mteTriggerDeltaDiscontinuityIDType;
+        StorageTmp->mteTriggerDeltaDiscontinuityIDType =
+            *((long *) var_val);
+        break;
+
+
+    case UNDO:
+        /*
+         * Back out any changes made in the ACTION case 
+         */
+        StorageTmp->mteTriggerDeltaDiscontinuityIDType = tmpvar;
+        break;
+
+
+    case COMMIT:
+        /*
+         * Things are working well, so it's now safe to make the change
+         * permanently.  Make sure that anything done here can't fail! 
+         */
+
+        break;
+    }
+    return SNMP_ERR_NOERROR;
+}
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/disman/mteTriggerDeltaTable.h tomato121/release/src/router/snmp/agent/mibgroup/disman/mteTriggerDeltaTable.h
--- tomato/release/src/router/snmp/agent/mibgroup/disman/mteTriggerDeltaTable.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/disman/mteTriggerDeltaTable.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,37 @@
+/*
+ * This file was generated by mib2c and is intended for use as a mib module
+ * for the ucd-snmp snmpd agent. 
+ */
+
+
+#ifndef _MIBGROUP_MTETRIGGERDELTATABLE_H
+#define _MIBGROUP_MTETRIGGERDELTATABLE_H
+
+
+/*
+ * we may use header_complex from the header_complex module 
+ */
+
+
+config_require(header_complex)
+
+
+    /*
+     * enum definitions from the covered mib sections 
+     */
+#define MTETRIGGERDELTADISCONTINUITYIDWILDCARD_TRUE 1
+#define MTETRIGGERDELTADISCONTINUITYIDWILDCARD_FALSE 2
+#define MTETRIGGERDELTADISCONTINUITYIDTYPE_TIMETICKS 1
+#define MTETRIGGERDELTADISCONTINUITYIDTYPE_TIMESTAMP 2
+#define MTETRIGGERDELTADISCONTINUITYIDTYPE_DATEANDTIME 3
+    /*
+     * function prototypes 
+     */
+     void            init_mteTriggerDeltaTable(void);
+     FindVarMethod   var_mteTriggerDeltaTable;
+
+     WriteMethod     write_mteTriggerDeltaDiscontinuityID;
+     WriteMethod     write_mteTriggerDeltaDiscontinuityIDWildcard;
+     WriteMethod     write_mteTriggerDeltaDiscontinuityIDType;
+
+#endif                          /* _MIBGROUP_MTETRIGGERDELTATABLE_H */
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/disman/mteTriggerExistenceTable.c tomato121/release/src/router/snmp/agent/mibgroup/disman/mteTriggerExistenceTable.c
--- tomato/release/src/router/snmp/agent/mibgroup/disman/mteTriggerExistenceTable.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/disman/mteTriggerExistenceTable.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,737 @@
+/*
+ * This file was generated by mib2c and is intended for use as
+ * a mib module for the ucd-snmp snmpd agent. 
+ */
+
+
+/*
+ * This should always be included first before anything else 
+ */
+#include <net-snmp/net-snmp-config.h>
+#if HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#if HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+
+
+/*
+ * minimal include directives 
+ */
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+#include "header_complex.h"
+#include "mteTriggerExistenceTable.h"
+#include "mteTriggerTable.h"
+
+
+/*
+ * mteTriggerExistenceTable_variables_oid:
+ *   this is the top level oid that we want to register under.  This
+ *   is essentially a prefix, with the suffix appearing in the
+ *   variable below.
+ */
+
+
+oid             mteTriggerExistenceTable_variables_oid[] =
+    { 1, 3, 6, 1, 2, 1, 88, 1, 2, 4 };
+
+
+/*
+ * variable2 mteTriggerExistenceTable_variables:
+ *   this variable defines function callbacks and type return information 
+ *   for the mteTriggerExistenceTable mib section 
+ */
+
+
+struct variable2 mteTriggerExistenceTable_variables[] = {
+    /*
+     * magic number        , variable type , ro/rw , callback fn  , L, oidsuffix 
+     */
+#define   MTETRIGGEREXISTENCETEST  3
+    {MTETRIGGEREXISTENCETEST, ASN_BIT_STR, RWRITE,
+     var_mteTriggerExistenceTable, 2, {1, 1}},
+#define   MTETRIGGEREXISTENCESTARTUP  4
+    {MTETRIGGEREXISTENCESTARTUP, ASN_BIT_STR, RWRITE,
+     var_mteTriggerExistenceTable, 2, {1, 2}},
+#define   MTETRIGGEREXISTENCEOBJECTSOWNER  5
+    {MTETRIGGEREXISTENCEOBJECTSOWNER, ASN_OCTET_STR, RWRITE,
+     var_mteTriggerExistenceTable, 2, {1, 3}},
+#define   MTETRIGGEREXISTENCEOBJECTS  6
+    {MTETRIGGEREXISTENCEOBJECTS, ASN_OCTET_STR, RWRITE,
+     var_mteTriggerExistenceTable, 2, {1, 4}},
+#define   MTETRIGGEREXISTENCEEVENTOWNER  7
+    {MTETRIGGEREXISTENCEEVENTOWNER, ASN_OCTET_STR, RWRITE,
+     var_mteTriggerExistenceTable, 2, {1, 5}},
+#define   MTETRIGGEREXISTENCEEVENT  8
+    {MTETRIGGEREXISTENCEEVENT, ASN_OCTET_STR, RWRITE,
+     var_mteTriggerExistenceTable, 2, {1, 6}},
+
+};
+/*
+ * (L = length of the oidsuffix) 
+ */
+
+
+/*
+ * global storage of our data, saved in and configured by header_complex() 
+ */
+extern struct header_complex_index *mteTriggerTableStorage;
+
+
+
+
+/*
+ * init_mteTriggerExistenceTable():
+ *   Initialization routine.  This is called when the agent starts up.
+ *   At a minimum, registration of your variables should take place here.
+ */
+void
+init_mteTriggerExistenceTable(void)
+{
+    DEBUGMSGTL(("mteTriggerExistenceTable", "initializing...  "));
+
+
+    /*
+     * register ourselves with the agent to handle our mib tree 
+     */
+    REGISTER_MIB("mteTriggerExistenceTable",
+                 mteTriggerExistenceTable_variables, variable2,
+                 mteTriggerExistenceTable_variables_oid);
+
+
+    /*
+     * place any other initialization junk you need here 
+     */
+
+
+    DEBUGMSGTL(("mteTriggerExistenceTable", "done.\n"));
+}
+
+/*
+ * var_mteTriggerExistenceTable():
+ *   Handle this table separately from the scalar value case.
+ *   The workings of this are basically the same as for var_mteTriggerExistenceTable above.
+ */
+unsigned char  *
+var_mteTriggerExistenceTable(struct variable *vp,
+                             oid * name,
+                             size_t * length,
+                             int exact,
+                             size_t * var_len, WriteMethod ** write_method)
+{
+
+
+    struct mteTriggerTable_data *StorageTmp = NULL;
+
+
+    DEBUGMSGTL(("mteTriggerExistenceTable",
+                "var_mteTriggerExistenceTable: Entering...  \n"));
+    /*
+     * this assumes you have registered all your data properly
+     */
+    if ((StorageTmp =
+         header_complex(mteTriggerTableStorage, vp, name, length, exact,
+                        var_len, write_method)) == NULL)
+        return NULL;
+
+    if (!(StorageTmp->mteTriggerTest[0] & MTETRIGGERTEST_EXISTENCE))
+        return NULL;
+
+    /*
+     * this is where we do the value assignments for the mib results.
+     */
+    switch (vp->magic) {
+
+
+    case MTETRIGGEREXISTENCETEST:
+        *write_method = write_mteTriggerExistenceTest;
+        *var_len = StorageTmp->mteTriggerExistenceTestLen;
+        return (u_char *) StorageTmp->mteTriggerExistenceTest;
+
+    case MTETRIGGEREXISTENCESTARTUP:
+        *write_method = write_mteTriggerExistenceStartup;
+        *var_len = StorageTmp->mteTriggerExistenceStartupLen;
+        return (u_char *) StorageTmp->mteTriggerExistenceStartup;
+
+    case MTETRIGGEREXISTENCEOBJECTSOWNER:
+        *write_method = write_mteTriggerExistenceObjectsOwner;
+        *var_len = StorageTmp->mteTriggerExistenceObjectsOwnerLen;
+        return (u_char *) StorageTmp->mteTriggerExistenceObjectsOwner;
+
+    case MTETRIGGEREXISTENCEOBJECTS:
+        *write_method = write_mteTriggerExistenceObjects;
+        *var_len = StorageTmp->mteTriggerExistenceObjectsLen;
+        return (u_char *) StorageTmp->mteTriggerExistenceObjects;
+
+    case MTETRIGGEREXISTENCEEVENTOWNER:
+        *write_method = write_mteTriggerExistenceEventOwner;
+        *var_len = StorageTmp->mteTriggerExistenceEventOwnerLen;
+        return (u_char *) StorageTmp->mteTriggerExistenceEventOwner;
+
+    case MTETRIGGEREXISTENCEEVENT:
+        *write_method = write_mteTriggerExistenceEvent;
+        *var_len = StorageTmp->mteTriggerExistenceEventLen;
+        return (u_char *) StorageTmp->mteTriggerExistenceEvent;
+
+
+    default:
+        ERROR_MSG("");
+    }
+    return NULL;
+}
+
+
+
+
+int
+write_mteTriggerExistenceTest(int action,
+                              u_char * var_val,
+                              u_char var_val_type,
+                              size_t var_val_len,
+                              u_char * statP, oid * name, size_t name_len)
+{
+    static char    *tmpvar;
+    struct mteTriggerTable_data *StorageTmp = NULL;
+    static size_t   tmplen;
+    size_t          newlen =
+        name_len -
+        (sizeof(mteTriggerExistenceTable_variables_oid) / sizeof(oid) + 3 -
+         1);
+
+
+    DEBUGMSGTL(("mteTriggerExistenceTable",
+                "write_mteTriggerExistenceTest entering action=%d...  \n",
+                action));
+    if ((StorageTmp =
+         header_complex(mteTriggerTableStorage, NULL,
+                        &name[sizeof
+                              (mteTriggerExistenceTable_variables_oid) /
+                              sizeof(oid) + 3 - 1], &newlen, 1, NULL,
+                        NULL)) == NULL)
+        return SNMP_ERR_NOSUCHNAME;     /* remove if you support creation here */
+
+
+    switch (action) {
+    case RESERVE1:
+        if (var_val_type != ASN_OCTET_STR) {
+            fprintf(stderr,
+                    "write to mteTriggerExistenceTest not ASN_OCTET_STR\n");
+            return SNMP_ERR_WRONGTYPE;
+        }
+        if (StorageTmp->storageType != ST_NONVOLATILE)
+            return SNMP_ERR_NOTWRITABLE;
+        break;
+
+
+    case RESERVE2:
+        /*
+         * memory reseveration, final preparation... 
+         */
+        break;
+
+
+    case FREE:
+        /*
+         * Release any resources that have been allocated 
+         */
+        break;
+
+
+    case ACTION:
+        /*
+         * The variable has been stored in string for
+         * you to use, and you have just been asked to do something with
+         * it.  Note that anything done here must be reversable in the UNDO case 
+         */
+        tmpvar = StorageTmp->mteTriggerExistenceTest;
+        tmplen = StorageTmp->mteTriggerExistenceTestLen;
+        memdup((u_char **) & StorageTmp->mteTriggerExistenceTest, var_val,
+               var_val_len);
+        StorageTmp->mteTriggerExistenceTestLen = var_val_len;
+        break;
+
+
+    case UNDO:
+        /*
+         * Back out any changes made in the ACTION case 
+         */
+        SNMP_FREE(StorageTmp->mteTriggerExistenceTest);
+        StorageTmp->mteTriggerExistenceTest = tmpvar;
+        StorageTmp->mteTriggerExistenceTestLen = tmplen;
+        break;
+
+
+    case COMMIT:
+        /*
+         * Things are working well, so it's now safe to make the change
+         * permanently.  Make sure that anything done here can't fail! 
+         */
+        SNMP_FREE(tmpvar);
+        break;
+    }
+    return SNMP_ERR_NOERROR;
+}
+
+
+
+int
+write_mteTriggerExistenceStartup(int action,
+                                 u_char * var_val,
+                                 u_char var_val_type,
+                                 size_t var_val_len,
+                                 u_char * statP,
+                                 oid * name, size_t name_len)
+{
+    static char    *tmpvar;
+    struct mteTriggerTable_data *StorageTmp = NULL;
+    static size_t   tmplen;
+    size_t          newlen =
+        name_len -
+        (sizeof(mteTriggerExistenceTable_variables_oid) / sizeof(oid) + 3 -
+         1);
+
+
+    DEBUGMSGTL(("mteTriggerExistenceTable",
+                "write_mteTriggerExistenceStartup entering action=%d...  \n",
+                action));
+    if ((StorageTmp =
+         header_complex(mteTriggerTableStorage, NULL,
+                        &name[sizeof
+                              (mteTriggerExistenceTable_variables_oid) /
+                              sizeof(oid) + 3 - 1], &newlen, 1, NULL,
+                        NULL)) == NULL)
+        return SNMP_ERR_NOSUCHNAME;     /* remove if you support creation here */
+
+
+    switch (action) {
+    case RESERVE1:
+        if (var_val_type != ASN_OCTET_STR) {
+            fprintf(stderr,
+                    "write to mteTriggerExistenceStartup not ASN_OCTET_STR\n");
+            return SNMP_ERR_WRONGTYPE;
+        }
+        if (StorageTmp->storageType != ST_NONVOLATILE)
+            return SNMP_ERR_NOTWRITABLE;
+        break;
+
+
+    case RESERVE2:
+        /*
+         * memory reseveration, final preparation... 
+         */
+        break;
+
+
+    case FREE:
+        /*
+         * Release any resources that have been allocated 
+         */
+        break;
+
+
+    case ACTION:
+        /*
+         * The variable has been stored in string for
+         * you to use, and you have just been asked to do something with
+         * it.  Note that anything done here must be reversable in the UNDO case 
+         */
+        tmpvar = StorageTmp->mteTriggerExistenceStartup;
+        tmplen = StorageTmp->mteTriggerExistenceStartupLen;
+        memdup((u_char **) & StorageTmp->mteTriggerExistenceStartup,
+               var_val, var_val_len);
+        StorageTmp->mteTriggerExistenceStartupLen = var_val_len;
+        break;
+
+
+    case UNDO:
+        /*
+         * Back out any changes made in the ACTION case 
+         */
+        SNMP_FREE(StorageTmp->mteTriggerExistenceStartup);
+        StorageTmp->mteTriggerExistenceStartup = tmpvar;
+        StorageTmp->mteTriggerExistenceStartupLen = tmplen;
+        break;
+
+
+    case COMMIT:
+        /*
+         * Things are working well, so it's now safe to make the change
+         * permanently.  Make sure that anything done here can't fail! 
+         */
+        SNMP_FREE(tmpvar);
+        break;
+    }
+    return SNMP_ERR_NOERROR;
+}
+
+
+
+int
+write_mteTriggerExistenceObjectsOwner(int action,
+                                      u_char * var_val,
+                                      u_char var_val_type,
+                                      size_t var_val_len,
+                                      u_char * statP,
+                                      oid * name, size_t name_len)
+{
+    static char    *tmpvar;
+    struct mteTriggerTable_data *StorageTmp = NULL;
+    static size_t   tmplen;
+    size_t          newlen =
+        name_len -
+        (sizeof(mteTriggerExistenceTable_variables_oid) / sizeof(oid) + 3 -
+         1);
+
+
+    DEBUGMSGTL(("mteTriggerExistenceTable",
+                "write_mteTriggerExistenceObjectsOwner entering action=%d...  \n",
+                action));
+    if ((StorageTmp =
+         header_complex(mteTriggerTableStorage, NULL,
+                        &name[sizeof
+                              (mteTriggerExistenceTable_variables_oid) /
+                              sizeof(oid) + 3 - 1], &newlen, 1, NULL,
+                        NULL)) == NULL)
+        return SNMP_ERR_NOSUCHNAME;     /* remove if you support creation here */
+
+
+    switch (action) {
+    case RESERVE1:
+        if (var_val_type != ASN_OCTET_STR) {
+            fprintf(stderr,
+                    "write to mteTriggerExistenceObjectsOwner not ASN_OCTET_STR\n");
+            return SNMP_ERR_WRONGTYPE;
+        }
+        if (StorageTmp->storageType != ST_NONVOLATILE)
+            return SNMP_ERR_NOTWRITABLE;
+        break;
+
+
+    case RESERVE2:
+        /*
+         * memory reseveration, final preparation... 
+         */
+        break;
+
+
+    case FREE:
+        /*
+         * Release any resources that have been allocated 
+         */
+        break;
+
+
+    case ACTION:
+        /*
+         * The variable has been stored in string for
+         * you to use, and you have just been asked to do something with
+         * it.  Note that anything done here must be reversable in the UNDO case 
+         */
+        tmpvar = StorageTmp->mteTriggerExistenceObjectsOwner;
+        tmplen = StorageTmp->mteTriggerExistenceObjectsOwnerLen;
+        memdup((u_char **) & StorageTmp->mteTriggerExistenceObjectsOwner,
+               var_val, var_val_len);
+        StorageTmp->mteTriggerExistenceObjectsOwnerLen = var_val_len;
+        break;
+
+
+    case UNDO:
+        /*
+         * Back out any changes made in the ACTION case 
+         */
+        SNMP_FREE(StorageTmp->mteTriggerExistenceObjectsOwner);
+        StorageTmp->mteTriggerExistenceObjectsOwner = tmpvar;
+        StorageTmp->mteTriggerExistenceObjectsOwnerLen = tmplen;
+        break;
+
+
+    case COMMIT:
+        /*
+         * Things are working well, so it's now safe to make the change
+         * permanently.  Make sure that anything done here can't fail! 
+         */
+        SNMP_FREE(tmpvar);
+        break;
+    }
+    return SNMP_ERR_NOERROR;
+}
+
+
+
+int
+write_mteTriggerExistenceObjects(int action,
+                                 u_char * var_val,
+                                 u_char var_val_type,
+                                 size_t var_val_len,
+                                 u_char * statP,
+                                 oid * name, size_t name_len)
+{
+    static char    *tmpvar;
+    struct mteTriggerTable_data *StorageTmp = NULL;
+    static size_t   tmplen;
+    size_t          newlen =
+        name_len -
+        (sizeof(mteTriggerExistenceTable_variables_oid) / sizeof(oid) + 3 -
+         1);
+
+
+    DEBUGMSGTL(("mteTriggerExistenceTable",
+                "write_mteTriggerExistenceObjects entering action=%d...  \n",
+                action));
+    if ((StorageTmp =
+         header_complex(mteTriggerTableStorage, NULL,
+                        &name[sizeof
+                              (mteTriggerExistenceTable_variables_oid) /
+                              sizeof(oid) + 3 - 1], &newlen, 1, NULL,
+                        NULL)) == NULL)
+        return SNMP_ERR_NOSUCHNAME;     /* remove if you support creation here */
+
+
+    switch (action) {
+    case RESERVE1:
+        if (var_val_type != ASN_OCTET_STR) {
+            fprintf(stderr,
+                    "write to mteTriggerExistenceObjects not ASN_OCTET_STR\n");
+            return SNMP_ERR_WRONGTYPE;
+        }
+        if (StorageTmp->storageType != ST_NONVOLATILE)
+            return SNMP_ERR_NOTWRITABLE;
+        break;
+
+
+    case RESERVE2:
+        /*
+         * memory reseveration, final preparation... 
+         */
+        break;
+
+
+    case FREE:
+        /*
+         * Release any resources that have been allocated 
+         */
+        break;
+
+
+    case ACTION:
+        /*
+         * The variable has been stored in string for
+         * you to use, and you have just been asked to do something with
+         * it.  Note that anything done here must be reversable in the UNDO case 
+         */
+        tmpvar = StorageTmp->mteTriggerExistenceObjects;
+        tmplen = StorageTmp->mteTriggerExistenceObjectsLen;
+        memdup((u_char **) & StorageTmp->mteTriggerExistenceObjects,
+               var_val, var_val_len);
+        StorageTmp->mteTriggerExistenceObjectsLen = var_val_len;
+        break;
+
+
+    case UNDO:
+        /*
+         * Back out any changes made in the ACTION case 
+         */
+        SNMP_FREE(StorageTmp->mteTriggerExistenceObjects);
+        StorageTmp->mteTriggerExistenceObjects = tmpvar;
+        StorageTmp->mteTriggerExistenceObjectsLen = tmplen;
+        break;
+
+
+    case COMMIT:
+        /*
+         * Things are working well, so it's now safe to make the change
+         * permanently.  Make sure that anything done here can't fail! 
+         */
+        SNMP_FREE(tmpvar);
+        break;
+    }
+    return SNMP_ERR_NOERROR;
+}
+
+
+
+int
+write_mteTriggerExistenceEventOwner(int action,
+                                    u_char * var_val,
+                                    u_char var_val_type,
+                                    size_t var_val_len,
+                                    u_char * statP,
+                                    oid * name, size_t name_len)
+{
+    static char    *tmpvar;
+    struct mteTriggerTable_data *StorageTmp = NULL;
+    static size_t   tmplen;
+    size_t          newlen =
+        name_len -
+        (sizeof(mteTriggerExistenceTable_variables_oid) / sizeof(oid) + 3 -
+         1);
+
+
+    DEBUGMSGTL(("mteTriggerExistenceTable",
+                "write_mteTriggerExistenceEventOwner entering action=%d...  \n",
+                action));
+    if ((StorageTmp =
+         header_complex(mteTriggerTableStorage, NULL,
+                        &name[sizeof
+                              (mteTriggerExistenceTable_variables_oid) /
+                              sizeof(oid) + 3 - 1], &newlen, 1, NULL,
+                        NULL)) == NULL)
+        return SNMP_ERR_NOSUCHNAME;     /* remove if you support creation here */
+
+
+    switch (action) {
+    case RESERVE1:
+        if (var_val_type != ASN_OCTET_STR) {
+            fprintf(stderr,
+                    "write to mteTriggerExistenceEventOwner not ASN_OCTET_STR\n");
+            return SNMP_ERR_WRONGTYPE;
+        }
+        if (StorageTmp->storageType != ST_NONVOLATILE)
+            return SNMP_ERR_NOTWRITABLE;
+        break;
+
+
+    case RESERVE2:
+        /*
+         * memory reseveration, final preparation... 
+         */
+        break;
+
+
+    case FREE:
+        /*
+         * Release any resources that have been allocated 
+         */
+        break;
+
+
+    case ACTION:
+        /*
+         * The variable has been stored in string for
+         * you to use, and you have just been asked to do something with
+         * it.  Note that anything done here must be reversable in the UNDO case 
+         */
+        tmpvar = StorageTmp->mteTriggerExistenceEventOwner;
+        tmplen = StorageTmp->mteTriggerExistenceEventOwnerLen;
+        memdup((u_char **) & StorageTmp->mteTriggerExistenceEventOwner,
+               var_val, var_val_len);
+        StorageTmp->mteTriggerExistenceEventOwnerLen = var_val_len;
+        break;
+
+
+    case UNDO:
+        /*
+         * Back out any changes made in the ACTION case 
+         */
+        SNMP_FREE(StorageTmp->mteTriggerExistenceEventOwner);
+        StorageTmp->mteTriggerExistenceEventOwner = tmpvar;
+        StorageTmp->mteTriggerExistenceEventOwnerLen = tmplen;
+        break;
+
+
+    case COMMIT:
+        /*
+         * Things are working well, so it's now safe to make the change
+         * permanently.  Make sure that anything done here can't fail! 
+         */
+        SNMP_FREE(tmpvar);
+        break;
+    }
+    return SNMP_ERR_NOERROR;
+}
+
+
+
+int
+write_mteTriggerExistenceEvent(int action,
+                               u_char * var_val,
+                               u_char var_val_type,
+                               size_t var_val_len,
+                               u_char * statP, oid * name, size_t name_len)
+{
+    static char    *tmpvar;
+    struct mteTriggerTable_data *StorageTmp = NULL;
+    static size_t   tmplen;
+    size_t          newlen =
+        name_len -
+        (sizeof(mteTriggerExistenceTable_variables_oid) / sizeof(oid) + 3 -
+         1);
+
+
+    DEBUGMSGTL(("mteTriggerExistenceTable",
+                "write_mteTriggerExistenceEvent entering action=%d...  \n",
+                action));
+    if ((StorageTmp =
+         header_complex(mteTriggerTableStorage, NULL,
+                        &name[sizeof
+                              (mteTriggerExistenceTable_variables_oid) /
+                              sizeof(oid) + 3 - 1], &newlen, 1, NULL,
+                        NULL)) == NULL)
+        return SNMP_ERR_NOSUCHNAME;     /* remove if you support creation here */
+
+
+    switch (action) {
+    case RESERVE1:
+        if (var_val_type != ASN_OCTET_STR) {
+            fprintf(stderr,
+                    "write to mteTriggerExistenceEvent not ASN_OCTET_STR\n");
+            return SNMP_ERR_WRONGTYPE;
+        }
+        if (StorageTmp->storageType != ST_NONVOLATILE)
+            return SNMP_ERR_NOTWRITABLE;
+        break;
+
+
+    case RESERVE2:
+        /*
+         * memory reseveration, final preparation... 
+         */
+        break;
+
+
+    case FREE:
+        /*
+         * Release any resources that have been allocated 
+         */
+        break;
+
+
+    case ACTION:
+        /*
+         * The variable has been stored in string for
+         * you to use, and you have just been asked to do something with
+         * it.  Note that anything done here must be reversable in the UNDO case 
+         */
+        tmpvar = StorageTmp->mteTriggerExistenceEvent;
+        tmplen = StorageTmp->mteTriggerExistenceEventLen;
+        memdup((u_char **) & StorageTmp->mteTriggerExistenceEvent, var_val,
+               var_val_len);
+        StorageTmp->mteTriggerExistenceEventLen = var_val_len;
+        break;
+
+
+    case UNDO:
+        /*
+         * Back out any changes made in the ACTION case 
+         */
+        SNMP_FREE(StorageTmp->mteTriggerExistenceEvent);
+        StorageTmp->mteTriggerExistenceEvent = tmpvar;
+        StorageTmp->mteTriggerExistenceEventLen = tmplen;
+        break;
+
+
+    case COMMIT:
+        /*
+         * Things are working well, so it's now safe to make the change
+         * permanently.  Make sure that anything done here can't fail! 
+         */
+        SNMP_FREE(tmpvar);
+        break;
+    }
+    return SNMP_ERR_NOERROR;
+}
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/disman/mteTriggerExistenceTable.h tomato121/release/src/router/snmp/agent/mibgroup/disman/mteTriggerExistenceTable.h
--- tomato/release/src/router/snmp/agent/mibgroup/disman/mteTriggerExistenceTable.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/disman/mteTriggerExistenceTable.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,39 @@
+/*
+ * This file was generated by mib2c and is intended for use as a mib module
+ * for the ucd-snmp snmpd agent. 
+ */
+
+
+#ifndef _MIBGROUP_MTETRIGGEREXISTENCETABLE_H
+#define _MIBGROUP_MTETRIGGEREXISTENCETABLE_H
+
+
+/*
+ * we may use header_complex from the header_complex module 
+ */
+
+
+config_require(header_complex)
+
+    /*
+     * enum definitions from the covered mib sections 
+     */
+#define MTETRIGGEREXISTENCETEST_PRESENT          0x80
+#define MTETRIGGEREXISTENCETEST_ABSENT           0x40
+#define MTETRIGGEREXISTENCETEST_CHANGED          0x20
+#define MTETRIGGEREXISTENCESTARTUP_PRESENT       0x80
+#define MTETRIGGEREXISTENCESTARTUP_ABSENT        0x40
+    /*
+     * function prototypes 
+     */
+     void            init_mteTriggerExistenceTable(void);
+     FindVarMethod   var_mteTriggerExistenceTable;
+
+     WriteMethod     write_mteTriggerExistenceTest;
+     WriteMethod     write_mteTriggerExistenceStartup;
+     WriteMethod     write_mteTriggerExistenceObjectsOwner;
+     WriteMethod     write_mteTriggerExistenceObjects;
+     WriteMethod     write_mteTriggerExistenceEventOwner;
+     WriteMethod     write_mteTriggerExistenceEvent;
+
+#endif                          /* _MIBGROUP_MTETRIGGEREXISTENCETABLE_H */
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/disman/mteTriggerTable.c tomato121/release/src/router/snmp/agent/mibgroup/disman/mteTriggerTable.c
--- tomato/release/src/router/snmp/agent/mibgroup/disman/mteTriggerTable.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/disman/mteTriggerTable.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,3653 @@
+/*
+ * This file was generated by mib2c and is intended for use as
+ * a mib module for the ucd-snmp snmpd agent. 
+ */
+
+
+/*
+ * This should always be included first before anything else 
+ */
+#include <net-snmp/net-snmp-config.h>
+#if HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#if HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+#ifdef HAVE_LIMITS_H
+#include <limits.h>
+#endif
+
+
+/*
+ * minimal include directives 
+ */
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+#include "header_complex.h"
+#include "mteTriggerTable.h"
+#include "mteTriggerBooleanTable.h"
+#include "mteTriggerDeltaTable.h"
+#include "mteTriggerExistenceTable.h"
+#include "mteTriggerThresholdTable.h"
+#include "mteEventTable.h"
+#include "mteObjectsTable.h"
+
+/*
+ * mteTriggerTable_variables_oid:
+ *   this is the top level oid that we want to register under.  This
+ *   is essentially a prefix, with the suffix appearing in the
+ *   variable below.
+ */
+
+/*
+ * trap definitions 
+ */
+oid             mteTriggerFired[] = { 1, 3, 6, 1, 2, 1, 88, 2, 0, 1 };
+oid             mteTriggerRising[] = { 1, 3, 6, 1, 2, 1, 88, 2, 0, 2 };
+oid             mteTriggerFalling[] = { 1, 3, 6, 1, 2, 1, 88, 2, 0, 3 };
+oid             mteTriggerFailure[] = { 1, 3, 6, 1, 2, 1, 88, 2, 0, 4 };
+oid             mteEventSetFailure[] = { 1, 3, 6, 1, 2, 1, 88, 2, 0, 5 };
+
+/*
+ * trap objects 
+ */
+oid             mteHotTrigger[] = { 1, 3, 6, 1, 2, 1, 88, 2, 1, 1 };
+oid             mteHotTargetName[] = { 1, 3, 6, 1, 2, 1, 88, 2, 1, 2 };
+oid             mteHotContextName[] = { 1, 3, 6, 1, 2, 1, 88, 2, 1, 3 };
+oid             mteHotOID[] = { 1, 3, 6, 1, 2, 1, 88, 2, 1, 4 };
+oid             mteHotValue[] = { 1, 3, 6, 1, 2, 1, 88, 2, 1, 5 };
+oid             mteFailedReason[] = { 1, 3, 6, 1, 2, 1, 88, 2, 1, 6 };
+
+/*
+ * For discontinuity checking.  
+ */
+oid             sysUpTimeInstance[] = { 1, 3, 6, 1, 2, 1, 1, 3, 0 };
+
+oid             mteTriggerTable_variables_oid[] =
+    { 1, 3, 6, 1, 2, 1, 88, 1, 2, 2 };
+
+
+/*
+ * variable2 mteTriggerTable_variables:
+ *   this variable defines function callbacks and type return information 
+ *   for the mteTriggerTable mib section 
+ */
+
+
+struct variable2 mteTriggerTable_variables[] = {
+    /*
+     * magic number        , variable type , ro/rw , callback fn  , L, oidsuffix 
+     */
+#define   MTETRIGGERCOMMENT     5
+    {MTETRIGGERCOMMENT, ASN_OCTET_STR, RWRITE, var_mteTriggerTable, 2,
+     {1, 3}},
+#define   MTETRIGGERTEST        6
+    {MTETRIGGERTEST, ASN_OCTET_STR, RWRITE, var_mteTriggerTable, 2, {1, 4}},
+#define   MTETRIGGERSAMPLETYPE  7
+    {MTETRIGGERSAMPLETYPE, ASN_INTEGER, RWRITE, var_mteTriggerTable, 2,
+     {1, 5}},
+#define   MTETRIGGERVALUEID     8
+    {MTETRIGGERVALUEID, ASN_OBJECT_ID, RWRITE, var_mteTriggerTable, 2,
+     {1, 6}},
+#define   MTETRIGGERVALUEIDWILDCARD  9
+    {MTETRIGGERVALUEIDWILDCARD, ASN_INTEGER, RWRITE, var_mteTriggerTable,
+     2, {1, 7}},
+#define   MTETRIGGERTARGETTAG   10
+    {MTETRIGGERTARGETTAG, ASN_OCTET_STR, RWRITE, var_mteTriggerTable, 2,
+     {1, 8}},
+#define   MTETRIGGERCONTEXTNAME  11
+    {MTETRIGGERCONTEXTNAME, ASN_OCTET_STR, RWRITE, var_mteTriggerTable, 2,
+     {1, 9}},
+#define   MTETRIGGERCONTEXTNAMEWILDCARD  12
+    {MTETRIGGERCONTEXTNAMEWILDCARD, ASN_INTEGER, RWRITE,
+     var_mteTriggerTable, 2, {1, 10}},
+#define   MTETRIGGERFREQUENCY   13
+    {MTETRIGGERFREQUENCY, ASN_UNSIGNED, RWRITE, var_mteTriggerTable, 2,
+     {1, 11}},
+#define   MTETRIGGEROBJECTSOWNER  14
+    {MTETRIGGEROBJECTSOWNER, ASN_OCTET_STR, RWRITE, var_mteTriggerTable, 2,
+     {1, 12}},
+#define   MTETRIGGEROBJECTS     15
+    {MTETRIGGEROBJECTS, ASN_OCTET_STR, RWRITE, var_mteTriggerTable, 2,
+     {1, 13}},
+#define   MTETRIGGERENABLED     16
+    {MTETRIGGERENABLED, ASN_INTEGER, RWRITE, var_mteTriggerTable, 2,
+     {1, 14}},
+#define   MTETRIGGERENTRYSTATUS  17
+    {MTETRIGGERENTRYSTATUS, ASN_INTEGER, RWRITE, var_mteTriggerTable, 2,
+     {1, 15}},
+
+};
+/*
+ * (L = length of the oidsuffix) 
+ */
+
+
+/*
+ * global storage of our data, saved in and configured by header_complex() 
+ */
+struct header_complex_index *mteTriggerTableStorage = NULL;
+
+netsnmp_session *mte_callback_sess = NULL;
+extern int      callback_master_num;
+
+/*
+ * init_mteTriggerTable():
+ *   Initialization routine.  This is called when the agent starts up.
+ *   At a minimum, registration of your variables should take place here.
+ */
+void
+init_mteTriggerTable(void)
+{
+    DEBUGMSGTL(("mteTriggerTable", "initializing...  "));
+
+
+    /*
+     * register ourselves with the agent to handle our mib tree 
+     */
+    REGISTER_MIB("mteTriggerTable", mteTriggerTable_variables, variable2,
+                 mteTriggerTable_variables_oid);
+
+
+    /*
+     * register our config handler(s) to deal with registrations 
+     */
+    snmpd_register_config_handler("mteTriggerTable", parse_mteTriggerTable,
+                                  NULL, NULL);
+
+    snmpd_register_config_handler("monitor", parse_simple_monitor, NULL,
+                                  "[options] monitor_expression [see \"man snmpd.conf\"]");
+    snmpd_register_config_handler("defaultMonitors",
+                                  parse_default_monitors, NULL, "yes|no");
+    netsnmp_ds_register_config(ASN_OCTET_STR, "snmpd", "agentSecName",
+                       NETSNMP_DS_APPLICATION_ID, NETSNMP_DS_AGENT_INTERNAL_SECNAME);
+
+    /*
+     * we need to be called back later to store our data 
+     */
+    snmp_register_callback(SNMP_CALLBACK_LIBRARY, SNMP_CALLBACK_STORE_DATA,
+                           store_mteTriggerTable, NULL);
+
+
+    /*
+     * place any other initialization junk you need here 
+     */
+    se_add_pair_to_slist("mteBooleanOperators", strdup("!="),
+                         MTETRIGGERBOOLEANCOMPARISON_UNEQUAL);
+    se_add_pair_to_slist("mteBooleanOperators", strdup("=="),
+                         MTETRIGGERBOOLEANCOMPARISON_EQUAL);
+    se_add_pair_to_slist("mteBooleanOperators", strdup("<"),
+                         MTETRIGGERBOOLEANCOMPARISON_LESS);
+    se_add_pair_to_slist("mteBooleanOperators", strdup("<="),
+                         MTETRIGGERBOOLEANCOMPARISON_LESSOREQUAL);
+    se_add_pair_to_slist("mteBooleanOperators", strdup(">"),
+                         MTETRIGGERBOOLEANCOMPARISON_GREATER);
+    se_add_pair_to_slist("mteBooleanOperators", strdup(">="),
+                         MTETRIGGERBOOLEANCOMPARISON_GREATEROREQUAL);
+
+    /*
+     * open a 'callback' session to the main agent 
+     */
+    if (mte_callback_sess == NULL) {
+        mte_callback_sess = netsnmp_callback_open(callback_master_num,
+                                                  NULL, NULL, NULL);
+        DEBUGMSGTL(("mteTriggerTable", "created callback session = %08x\n",
+                    mte_callback_sess));
+    }
+    DEBUGMSGTL(("mteTriggerTable", "done.\n"));
+}
+
+struct mteTriggerTable_data *
+create_mteTriggerTable_data(void)
+{
+    struct mteTriggerTable_data *StorageNew;
+
+    StorageNew = SNMP_MALLOC_STRUCT(mteTriggerTable_data);
+
+    /*
+     * fill in default row values here into StorageNew 
+     */
+    /*
+     * fill in values for all tables (even if not
+     * appropriate), since its easier to do here than anywhere
+     * else 
+     */
+    StorageNew->mteTriggerComment = strdup("");
+    StorageNew->mteTriggerTest = strdup("");
+    StorageNew->mteTriggerTest[0] |= (char) MTETRIGGERTEST_BOOLEAN;
+    StorageNew->mteTriggerTestLen = 1;
+    StorageNew->mteTriggerSampleType = MTETRIGGERSAMPLETYPE_ABSOLUTEVALUE;
+    StorageNew->mteTriggerValueID = calloc(1, sizeof(oid) * sizeof(2)); /* 0.0 */
+    StorageNew->mteTriggerValueIDLen = 2;
+    StorageNew->mteTriggerValueIDWildcard =
+        MTETRIGGERVALUEIDWILDCARD_FALSE;
+    StorageNew->mteTriggerTargetTag = strdup("");
+    StorageNew->mteTriggerContextName = strdup("");
+    StorageNew->mteTriggerContextNameWildcard =
+        MTETRIGGERCONTEXTNAMEWILDCARD_FALSE;
+    StorageNew->mteTriggerFrequency = 600;
+    StorageNew->mteTriggerObjectsOwner = strdup("");
+    StorageNew->mteTriggerObjects = strdup("");
+    StorageNew->mteTriggerEnabled = MTETRIGGERENABLED_FALSE;
+    memdup((unsigned char **)
+           &(StorageNew->mteTriggerDeltaDiscontinuityID),
+           (unsigned char *) sysUpTimeInstance, sizeof(sysUpTimeInstance));
+    StorageNew->mteTriggerDeltaDiscontinuityIDLen =
+        sizeof(sysUpTimeInstance) / sizeof(oid);
+    StorageNew->mteTriggerDeltaDiscontinuityIDWildcard = TV_FALSE;
+    StorageNew->mteTriggerDeltaDiscontinuityIDType =
+        MTETRIGGERDELTADISCONTINUITYIDTYPE_TIMETICKS;
+    StorageNew->mteTriggerExistenceTest = strdup("");
+    StorageNew->mteTriggerExistenceTest[0] =
+        (char) (MTETRIGGEREXISTENCETEST_PRESENT |
+                MTETRIGGEREXISTENCETEST_ABSENT);
+    StorageNew->mteTriggerExistenceTestLen = 1;
+    StorageNew->mteTriggerExistenceStartup = strdup("");
+    StorageNew->mteTriggerExistenceStartup[0] =
+        (char) (MTETRIGGEREXISTENCESTARTUP_PRESENT);
+    StorageNew->mteTriggerExistenceStartupLen = 1;
+    StorageNew->mteTriggerExistenceObjectsOwner = strdup("");
+    StorageNew->mteTriggerExistenceObjects = strdup("");
+    StorageNew->mteTriggerExistenceEventOwner = strdup("");
+    StorageNew->mteTriggerExistenceEvent = strdup("");
+    StorageNew->mteTriggerBooleanComparison =
+        MTETRIGGERBOOLEANCOMPARISON_UNEQUAL;
+    StorageNew->mteTriggerBooleanStartup = MTETRIGGERBOOLEANSTARTUP_TRUE;
+    StorageNew->mteTriggerBooleanObjectsOwner = strdup("");
+    StorageNew->mteTriggerBooleanObjects = strdup("");
+    StorageNew->mteTriggerBooleanEventOwner = strdup("");
+    StorageNew->mteTriggerBooleanEvent = strdup("");
+    StorageNew->mteTriggerThresholdStartup =
+        MTETRIGGERTHRESHOLDSTARTUP_RISINGORFALLING;
+    StorageNew->mteTriggerThresholdObjectsOwner = strdup("");
+    StorageNew->mteTriggerThresholdObjects = strdup("");
+    StorageNew->mteTriggerThresholdRisingEventOwner = strdup("");
+    StorageNew->mteTriggerThresholdRisingEvent = strdup("");
+    StorageNew->mteTriggerThresholdFallingEventOwner = strdup("");
+    StorageNew->mteTriggerThresholdFallingEvent = strdup("");
+    StorageNew->mteTriggerThresholdDeltaRisingEventOwner = strdup("");
+    StorageNew->mteTriggerThresholdDeltaRisingEvent = strdup("");
+    StorageNew->mteTriggerThresholdDeltaFallingEventOwner = strdup("");
+    StorageNew->mteTriggerThresholdDeltaFallingEvent = strdup("");
+    StorageNew->lastboolresult = -1;
+    StorageNew->storageType = ST_NONVOLATILE;
+    StorageNew->prevDiscoTicks = 0;
+    StorageNew->prevUptimeTicks = 0;
+    return StorageNew;
+}
+
+/*
+ * mteTriggerTable_add(): adds a structure node to our data set 
+ */
+int
+mteTriggerTable_add(struct mteTriggerTable_data *thedata)
+{
+    netsnmp_variable_list *vars = NULL;
+
+
+    DEBUGMSGTL(("mteTriggerTable", "adding data...  "));
+    /*
+     * add the index variables to the varbind list, which is 
+     * used by header_complex to index the data 
+     */
+
+
+    snmp_varlist_add_variable(&vars, NULL, 0, ASN_OCTET_STR, (char *) thedata->mteOwner, thedata->mteOwnerLen); /* mteOwner */
+    snmp_varlist_add_variable(&vars, NULL, 0, ASN_PRIV_IMPLIED_OCTET_STR, (char *) thedata->mteTriggerName, thedata->mteTriggerNameLen);        /* mteTriggerName */
+
+
+
+    header_complex_add_data(&mteTriggerTableStorage, vars, thedata);
+    DEBUGMSGTL(("mteTriggerTable", "registered an entry\n"));
+
+
+    DEBUGMSGTL(("mteTriggerTable", "done.\n"));
+    return SNMPERR_SUCCESS;
+}
+
+
+#define MTE_PROCESS_LINE(line) \
+  snprintf(buf, SPRINT_MAX_LEN, "-u %s %s", mte_default_user, line); \
+  parse_simple_monitor("monitor", buf);
+
+void
+parse_default_monitors(const char *token, char *line)
+{
+    char            buf[SPRINT_MAX_LEN];
+    char           *mte_default_user =
+        netsnmp_ds_get_string(NETSNMP_DS_APPLICATION_ID, NETSNMP_DS_AGENT_INTERNAL_SECNAME);
+
+    if (strncmp(line, "yes", 3) == 0) {
+
+        DEBUGMSGTL(("mteTriggerTable", "registering default monitors\n"));
+
+        if (mte_default_user == NULL) {
+            config_perror
+                ("You must specify a user name first using the agentSecName token\n");
+            return;
+        }
+
+        /*
+         * we don't include many additional objects here as most of
+         * the error messages are complete with the needed
+         * information 
+         */
+        MTE_PROCESS_LINE
+            ("-o prNames -o prErrMessage \"process table\" prErrorFlag != 0");
+        MTE_PROCESS_LINE
+            ("-o memErrorName -o memSwapErrorMsg \"memory\" memSwapError != 0");
+        MTE_PROCESS_LINE
+            ("-o extNames -o extOutput \"extTable\" extResult != 0");
+        MTE_PROCESS_LINE
+            ("-o dskPath -o dskErrorMsg \"dskTable\" dskErrorFlag != 0");
+        MTE_PROCESS_LINE
+            ("-o laNames -o laErrMessage  \"laTable\" laErrorFlag != 0");
+        MTE_PROCESS_LINE
+            ("-o fileName -o fileErrorMsg  \"fileTable\" fileErrorFlag != 0");
+        /*
+         * this one is not *all* that useful, because the error is
+         * only kept for 30 seconds at most.  Maybe scan it every 30
+         * seconds, but I'm not doing so without seeking other peoples
+         * opinions first. 
+         */
+        MTE_PROCESS_LINE
+            ("-o snmperrErrMessage  \"snmperrs\" snmperrErrorFlag != 0");
+    }
+}
+
+static int      monitor_call_count = 0;
+void
+parse_simple_monitor(const char *token, char *line)
+{
+    char            buf[SPRINT_MAX_LEN], *cp, ebuf[SPRINT_MAX_LEN];
+    oid             obuf[MAX_OID_LEN];
+    size_t          obufLen;
+    struct mteTriggerTable_data *StorageNew;
+
+    monitor_call_count++;
+
+    StorageNew = create_mteTriggerTable_data();
+    StorageNew->storageType = ST_READONLY;
+    StorageNew->mteTriggerEnabled = MTETRIGGERENABLED_TRUE;
+    StorageNew->mteTriggerEntryStatus = RS_ACTIVE;
+    StorageNew->mteTriggerValueIDWildcard = MTETRIGGERVALUEIDWILDCARD_TRUE;
+    StorageNew->mteTriggerBooleanStartup = MTETRIGGERBOOLEANSTARTUP_TRUE;
+    StorageNew->mteTriggerThresholdStartup =
+        MTETRIGGERTHRESHOLDSTARTUP_RISINGORFALLING;
+    /*
+     * owner = snmpd.conf, why not? 
+     */
+    StorageNew->mteOwner = strdup("snmpd.conf");
+    StorageNew->mteOwnerLen = strlen(StorageNew->mteOwner);
+    StorageNew->pdu_version = SNMP_VERSION_3;
+    StorageNew->pdu_securityModel = SNMP_SEC_MODEL_USM;
+    StorageNew->pdu_securityLevel = SNMP_SEC_LEVEL_AUTHNOPRIV;
+
+    cp = line;
+
+    while (cp && *cp == '-') {
+        cp = copy_nword(cp, buf, sizeof(buf));
+        switch (buf[1]) {
+        case 'r':
+            if (cp) {
+                cp = copy_nword(cp, buf, sizeof(buf));
+                StorageNew->mteTriggerFrequency = strtoul(buf, NULL, 0);
+            } else {
+                config_perror("No parameter after -r given\n");
+                /*
+                 * XXX: free StorageNew 
+                 */
+                return;
+            }
+            break;
+        case 'u':
+            if (cp) {
+                cp = copy_nword(cp, buf, sizeof(buf));
+                StorageNew->pdu_securityName = strdup(buf);
+                StorageNew->pdu_securityNameLen = strlen(buf);
+            } else {
+                config_perror("No parameter after -u given\n");
+                /*
+                 * XXX: free StorageNew 
+                 */
+                return;
+            }
+            break;
+        case 'o':
+            /*
+             * oid 
+             */
+            cp = copy_nword(cp, buf, sizeof(buf));
+            obufLen = MAX_OID_LEN;
+            if (!snmp_parse_oid(buf, obuf, &obufLen)) {
+                sprintf(ebuf, "unable to parse oid: %s", buf);
+                config_perror(ebuf);
+                /*
+                 * XXX: free StorageNew 
+                 */
+                return;
+            }
+            sprintf(buf, "snmpd.conf%d", monitor_call_count);
+            mte_add_object_to_table("snmpd.conf", buf, obuf, obufLen, 1);
+
+            if (StorageNew->mteTriggerObjectsOwnerLen == 0) {
+                SNMP_FREE(StorageNew->mteTriggerObjectsOwner);
+                StorageNew->mteTriggerObjectsOwner = strdup("snmpd.conf");
+                StorageNew->mteTriggerObjectsOwnerLen =
+                    strlen("snmpd.conf");
+            }
+
+            if (StorageNew->mteTriggerObjectsLen == 0) {
+                SNMP_FREE(StorageNew->mteTriggerObjects);
+                StorageNew->mteTriggerObjects = strdup(buf);
+                StorageNew->mteTriggerObjectsLen = strlen(buf);
+            }
+            break;
+        }
+    }
+
+    if (StorageNew->pdu_securityNameLen == 0) {
+        char           *mte_default_user =
+            netsnmp_ds_get_string(NETSNMP_DS_APPLICATION_ID, NETSNMP_DS_AGENT_INTERNAL_SECNAME);
+        if (mte_default_user) {
+            StorageNew->pdu_securityName = strdup(mte_default_user);
+            StorageNew->pdu_securityNameLen = strlen(mte_default_user);
+        } else {
+            config_perror("-u USER parameter required\n");
+            /*
+             * XXX: free StorageNew 
+             */
+            return;
+        }
+    }
+
+    /*
+     * name 
+     */
+    cp = copy_nword(cp, buf, sizeof(buf));
+    if (!cp) {
+        config_perror("illegal monitor: no name specified");
+        /*
+         * XXX: free StorageNew 
+         */
+        return;
+    }
+
+    StorageNew->mteTriggerName = strdup(buf);
+    StorageNew->mteTriggerNameLen = strlen(StorageNew->mteTriggerName);
+
+    /*
+     * oid 
+     */
+    cp = copy_nword(cp, buf, sizeof(buf));
+    obufLen = MAX_OID_LEN;
+    if (!snmp_parse_oid(buf, obuf, &obufLen)) {
+        sprintf(ebuf, "unable to parse oid: %s", buf);
+        config_perror(ebuf);
+        /*
+         * XXX: free StorageNew 
+         */
+        return;
+    }
+    if (StorageNew->mteTriggerValueID)
+        free(StorageNew->mteTriggerValueID);
+    StorageNew->mteTriggerValueID = snmp_duplicate_objid(obuf, obufLen);
+    StorageNew->mteTriggerValueIDLen = obufLen;
+
+        /*
+         * if nothing beyond here, it's an existence test 
+         */
+        if (!cp) {
+            StorageNew->mteTriggerTest[0] = MTETRIGGERTEST_EXISTENCE;
+            mteTriggerTable_add(StorageNew);
+            return;
+        }
+
+        /*
+         * assume boolean (need to deal with threshold statements) 
+         */
+        cp = copy_nword(cp, buf, sizeof(buf));
+        if ((StorageNew->mteTriggerBooleanComparison =
+             se_find_value_in_slist("mteBooleanOperators", buf)) == -1) {
+            config_perror("illegal boolean operator");
+            return;
+        }
+
+        /*
+         * XXX: add threshold 
+         */
+        StorageNew->mteTriggerTest[0] = MTETRIGGERTEST_BOOLEAN;
+        if (!cp) {
+            config_perror("no comparison value specified");
+            /*
+             * XXX: free StorageNew 
+             */
+            return;
+        }
+
+        cp = copy_nword(cp, buf, sizeof(buf));
+        StorageNew->mteTriggerBooleanValue = strtol(buf, NULL, 0);
+
+    mteTriggerTable_add(StorageNew);
+    mte_enable_trigger(StorageNew);
+
+    DEBUGMSGTL(("mteTriggerTable", "added simple monitor: %s\n",
+                StorageNew->mteTriggerName));
+}
+
+
+/*
+ * parse_mteTriggerTable():
+ *   parses .conf file entries needed to configure the mib.
+ */
+void
+parse_mteTriggerTable(const char *token, char *line)
+{
+    size_t          tmpint;
+    oid            *tmpoid = NULL;
+    struct mteTriggerTable_data *StorageTmp =
+        SNMP_MALLOC_STRUCT(mteTriggerTable_data);
+
+    DEBUGMSGTL(("mteTriggerTable", "parsing config...  "));
+
+    if (StorageTmp == NULL) {
+        config_perror("malloc failure");
+        return;
+    }
+
+    line =
+        read_config_read_data(ASN_OCTET_STR, line, &StorageTmp->mteOwner,
+                              &StorageTmp->mteOwnerLen);
+    if (StorageTmp->mteOwner == NULL) {
+        config_perror("invalid specification for mteOwner");
+        return;
+    }
+
+    line =
+        read_config_read_data(ASN_OCTET_STR, line,
+                              &StorageTmp->mteTriggerName,
+                              &StorageTmp->mteTriggerNameLen);
+    if (StorageTmp->mteTriggerName == NULL) {
+        config_perror("invalid specification for mteTriggerName");
+        return;
+    }
+
+    line =
+        read_config_read_data(ASN_OCTET_STR, line,
+                              &StorageTmp->mteTriggerComment,
+                              &StorageTmp->mteTriggerCommentLen);
+    if (StorageTmp->mteTriggerComment == NULL) {
+        config_perror("invalid specification for mteTriggerComment");
+        return;
+    }
+
+    line =
+        read_config_read_data(ASN_OCTET_STR, line,
+                              &StorageTmp->mteTriggerTest,
+                              &StorageTmp->mteTriggerTestLen);
+    if (StorageTmp->mteTriggerTest == NULL) {
+        config_perror("invalid specification for mteTriggerTest");
+        return;
+    }
+
+    line =
+        read_config_read_data(ASN_INTEGER, line,
+                              &StorageTmp->mteTriggerSampleType, &tmpint);
+
+    line =
+        read_config_read_data(ASN_OBJECT_ID, line,
+                              &StorageTmp->mteTriggerValueID,
+                              &StorageTmp->mteTriggerValueIDLen);
+    if (StorageTmp->mteTriggerValueID == NULL) {
+        config_perror("invalid specification for mteTriggerValueID");
+        return;
+    }
+
+    line =
+        read_config_read_data(ASN_INTEGER, line,
+                              &StorageTmp->mteTriggerValueIDWildcard,
+                              &tmpint);
+
+    line =
+        read_config_read_data(ASN_OCTET_STR, line,
+                              &StorageTmp->mteTriggerTargetTag,
+                              &StorageTmp->mteTriggerTargetTagLen);
+    if (StorageTmp->mteTriggerTargetTag == NULL) {
+        config_perror("invalid specification for mteTriggerTargetTag");
+        return;
+    }
+
+    line =
+        read_config_read_data(ASN_OCTET_STR, line,
+                              &StorageTmp->mteTriggerContextName,
+                              &StorageTmp->mteTriggerContextNameLen);
+    if (StorageTmp->mteTriggerContextName == NULL) {
+        config_perror("invalid specification for mteTriggerContextName");
+        return;
+    }
+
+    line =
+        read_config_read_data(ASN_INTEGER, line,
+                              &StorageTmp->mteTriggerContextNameWildcard,
+                              &tmpint);
+
+    line =
+        read_config_read_data(ASN_UNSIGNED, line,
+                              &StorageTmp->mteTriggerFrequency, &tmpint);
+
+    line =
+        read_config_read_data(ASN_OCTET_STR, line,
+                              &StorageTmp->mteTriggerObjectsOwner,
+                              &StorageTmp->mteTriggerObjectsOwnerLen);
+    if (StorageTmp->mteTriggerObjectsOwner == NULL) {
+        config_perror("invalid specification for mteTriggerObjectsOwner");
+        return;
+    }
+
+    line =
+        read_config_read_data(ASN_OCTET_STR, line,
+                              &StorageTmp->mteTriggerObjects,
+                              &StorageTmp->mteTriggerObjectsLen);
+    if (StorageTmp->mteTriggerObjects == NULL) {
+        config_perror("invalid specification for mteTriggerObjects");
+        return;
+    }
+
+    line =
+        read_config_read_data(ASN_INTEGER, line,
+                              &StorageTmp->mteTriggerEnabled, &tmpint);
+
+    line =
+        read_config_read_data(ASN_INTEGER, line,
+                              &StorageTmp->mteTriggerEntryStatus, &tmpint);
+
+    /*
+     * delta table 
+     */
+    line =
+        read_config_read_data(ASN_OBJECT_ID, line,
+                              &StorageTmp->mteTriggerDeltaDiscontinuityID,
+                              &StorageTmp->
+                              mteTriggerDeltaDiscontinuityIDLen);
+    if (StorageTmp->mteTriggerDeltaDiscontinuityID == NULL) {
+        config_perror
+            ("invalid specification for mteTriggerDeltaDiscontinuityID");
+        return;
+    }
+
+    line =
+        read_config_read_data(ASN_INTEGER, line,
+                              &StorageTmp->
+                              mteTriggerDeltaDiscontinuityIDWildcard,
+                              &tmpint);
+
+    line =
+        read_config_read_data(ASN_INTEGER, line,
+                              &StorageTmp->
+                              mteTriggerDeltaDiscontinuityIDType, &tmpint);
+
+    /*
+     * existence table 
+     */
+    line =
+        read_config_read_data(ASN_OCTET_STR, line,
+                              &StorageTmp->mteTriggerExistenceTest,
+                              &StorageTmp->mteTriggerExistenceTestLen);
+    if (StorageTmp->mteTriggerExistenceTest == NULL) {
+        config_perror("invalid specification for mteTriggerExistenceTest");
+        return;
+    }
+
+    line =
+        read_config_read_data(ASN_OCTET_STR, line,
+                              &StorageTmp->mteTriggerExistenceStartup,
+                              &StorageTmp->mteTriggerExistenceStartupLen);
+    if (StorageTmp->mteTriggerExistenceStartup == NULL) {
+        config_perror
+            ("invalid specification for mteTriggerExistenceStartup");
+        return;
+    }
+
+    line =
+        read_config_read_data(ASN_OCTET_STR, line,
+                              &StorageTmp->mteTriggerExistenceObjectsOwner,
+                              &StorageTmp->
+                              mteTriggerExistenceObjectsOwnerLen);
+    if (StorageTmp->mteTriggerExistenceObjectsOwner == NULL) {
+        config_perror
+            ("invalid specification for mteTriggerExistenceObjectsOwner");
+        return;
+    }
+
+    line =
+        read_config_read_data(ASN_OCTET_STR, line,
+                              &StorageTmp->mteTriggerExistenceObjects,
+                              &StorageTmp->mteTriggerExistenceObjectsLen);
+    if (StorageTmp->mteTriggerExistenceObjects == NULL) {
+        config_perror
+            ("invalid specification for mteTriggerExistenceObjects");
+        return;
+    }
+
+    line =
+        read_config_read_data(ASN_OCTET_STR, line,
+                              &StorageTmp->mteTriggerExistenceEventOwner,
+                              &StorageTmp->
+                              mteTriggerExistenceEventOwnerLen);
+    if (StorageTmp->mteTriggerExistenceEventOwner == NULL) {
+        config_perror
+            ("invalid specification for mteTriggerExistenceEventOwner");
+        return;
+    }
+
+    line =
+        read_config_read_data(ASN_OCTET_STR, line,
+                              &StorageTmp->mteTriggerExistenceEvent,
+                              &StorageTmp->mteTriggerExistenceEventLen);
+    if (StorageTmp->mteTriggerExistenceEvent == NULL) {
+        config_perror
+            ("invalid specification for mteTriggerExistenceEvent");
+        return;
+    }
+
+    /*
+     * boolean table 
+     */
+    line =
+        read_config_read_data(ASN_INTEGER, line,
+                              &StorageTmp->mteTriggerBooleanComparison,
+                              &tmpint);
+
+    line =
+        read_config_read_data(ASN_INTEGER, line,
+                              &StorageTmp->mteTriggerBooleanValue,
+                              &tmpint);
+
+    line =
+        read_config_read_data(ASN_INTEGER, line,
+                              &StorageTmp->mteTriggerBooleanStartup,
+                              &tmpint);
+
+    line =
+        read_config_read_data(ASN_OCTET_STR, line,
+                              &StorageTmp->mteTriggerBooleanObjectsOwner,
+                              &StorageTmp->
+                              mteTriggerBooleanObjectsOwnerLen);
+    if (StorageTmp->mteTriggerBooleanObjectsOwner == NULL) {
+        config_perror
+            ("invalid specification for mteTriggerBooleanObjectsOwner");
+        return;
+    }
+
+    line =
+        read_config_read_data(ASN_OCTET_STR, line,
+                              &StorageTmp->mteTriggerBooleanObjects,
+                              &StorageTmp->mteTriggerBooleanObjectsLen);
+    if (StorageTmp->mteTriggerBooleanObjects == NULL) {
+        config_perror
+            ("invalid specification for mteTriggerBooleanObjects");
+        return;
+    }
+
+    line =
+        read_config_read_data(ASN_OCTET_STR, line,
+                              &StorageTmp->mteTriggerBooleanEventOwner,
+                              &StorageTmp->mteTriggerBooleanEventOwnerLen);
+    if (StorageTmp->mteTriggerBooleanEventOwner == NULL) {
+        config_perror
+            ("invalid specification for mteTriggerBooleanEventOwner");
+        return;
+    }
+
+    line =
+        read_config_read_data(ASN_OCTET_STR, line,
+                              &StorageTmp->mteTriggerBooleanEvent,
+                              &StorageTmp->mteTriggerBooleanEventLen);
+    if (StorageTmp->mteTriggerBooleanEvent == NULL) {
+        config_perror("invalid specification for mteTriggerBooleanEvent");
+        return;
+    }
+
+    /*
+     * threshold table 
+     */
+    line =
+        read_config_read_data(ASN_INTEGER, line,
+                              &StorageTmp->mteTriggerThresholdStartup,
+                              &tmpint);
+
+    line =
+        read_config_read_data(ASN_INTEGER, line,
+                              &StorageTmp->mteTriggerThresholdRising,
+                              &tmpint);
+
+    line =
+        read_config_read_data(ASN_INTEGER, line,
+                              &StorageTmp->mteTriggerThresholdFalling,
+                              &tmpint);
+
+    line =
+        read_config_read_data(ASN_INTEGER, line,
+                              &StorageTmp->mteTriggerThresholdDeltaRising,
+                              &tmpint);
+
+    line =
+        read_config_read_data(ASN_INTEGER, line,
+                              &StorageTmp->mteTriggerThresholdDeltaFalling,
+                              &tmpint);
+
+    line =
+        read_config_read_data(ASN_OCTET_STR, line,
+                              &StorageTmp->mteTriggerThresholdObjectsOwner,
+                              &StorageTmp->
+                              mteTriggerThresholdObjectsOwnerLen);
+    if (StorageTmp->mteTriggerThresholdObjectsOwner == NULL) {
+        config_perror
+            ("invalid specification for mteTriggerThresholdObjectsOwner");
+        return;
+    }
+
+    line =
+        read_config_read_data(ASN_OCTET_STR, line,
+                              &StorageTmp->mteTriggerThresholdObjects,
+                              &StorageTmp->mteTriggerThresholdObjectsLen);
+    if (StorageTmp->mteTriggerThresholdObjects == NULL) {
+        config_perror
+            ("invalid specification for mteTriggerThresholdObjects");
+        return;
+    }
+
+    line =
+        read_config_read_data(ASN_OCTET_STR, line,
+                              &StorageTmp->
+                              mteTriggerThresholdRisingEventOwner,
+                              &StorageTmp->
+                              mteTriggerThresholdRisingEventOwnerLen);
+    if (StorageTmp->mteTriggerThresholdRisingEventOwner == NULL) {
+        config_perror
+            ("invalid specification for mteTriggerThresholdRisingEventOwner");
+        return;
+    }
+
+    line =
+        read_config_read_data(ASN_OCTET_STR, line,
+                              &StorageTmp->mteTriggerThresholdRisingEvent,
+                              &StorageTmp->
+                              mteTriggerThresholdRisingEventLen);
+    if (StorageTmp->mteTriggerThresholdRisingEvent == NULL) {
+        config_perror
+            ("invalid specification for mteTriggerThresholdRisingEvent");
+        return;
+    }
+
+    line =
+        read_config_read_data(ASN_OCTET_STR, line,
+                              &StorageTmp->
+                              mteTriggerThresholdFallingEventOwner,
+                              &StorageTmp->
+                              mteTriggerThresholdFallingEventOwnerLen);
+    if (StorageTmp->mteTriggerThresholdFallingEventOwner == NULL) {
+        config_perror
+            ("invalid specification for mteTriggerThresholdFallingEventOwner");
+        return;
+    }
+
+    line =
+        read_config_read_data(ASN_OCTET_STR, line,
+                              &StorageTmp->mteTriggerThresholdFallingEvent,
+                              &StorageTmp->
+                              mteTriggerThresholdFallingEventLen);
+    if (StorageTmp->mteTriggerThresholdFallingEvent == NULL) {
+        config_perror
+            ("invalid specification for mteTriggerThresholdFallingEvent");
+        return;
+    }
+
+    line =
+        read_config_read_data(ASN_OCTET_STR, line,
+                              &StorageTmp->
+                              mteTriggerThresholdDeltaRisingEventOwner,
+                              &StorageTmp->
+                              mteTriggerThresholdDeltaRisingEventOwnerLen);
+    if (StorageTmp->mteTriggerThresholdDeltaRisingEventOwner == NULL) {
+        config_perror
+            ("invalid specification for mteTriggerThresholdDeltaRisingEventOwner");
+        return;
+    }
+
+    line =
+        read_config_read_data(ASN_OCTET_STR, line,
+                              &StorageTmp->
+                              mteTriggerThresholdDeltaRisingEvent,
+                              &StorageTmp->
+                              mteTriggerThresholdDeltaRisingEventLen);
+    if (StorageTmp->mteTriggerThresholdDeltaRisingEvent == NULL) {
+        config_perror
+            ("invalid specification for mteTriggerThresholdDeltaRisingEvent");
+        return;
+    }
+
+    line =
+        read_config_read_data(ASN_OCTET_STR, line,
+                              &StorageTmp->
+                              mteTriggerThresholdDeltaFallingEventOwner,
+                              &StorageTmp->
+                              mteTriggerThresholdDeltaFallingEventOwnerLen);
+    if (StorageTmp->mteTriggerThresholdDeltaFallingEventOwner == NULL) {
+        config_perror
+            ("invalid specification for mteTriggerThresholdDeltaFallingEventOwner");
+        return;
+    }
+
+    line =
+        read_config_read_data(ASN_OCTET_STR, line,
+                              &StorageTmp->
+                              mteTriggerThresholdDeltaFallingEvent,
+                              &StorageTmp->
+                              mteTriggerThresholdDeltaFallingEventLen);
+    if (StorageTmp->mteTriggerThresholdDeltaFallingEvent == NULL) {
+        config_perror
+            ("invalid specification for mteTriggerThresholdDeltaFallingEvent");
+        return;
+    }
+
+    /*
+     * local internal variables 
+     */
+    line =
+        read_config_read_data(ASN_INTEGER, line,
+                              &StorageTmp->have_copied_auth_info, &tmpint);
+    if (StorageTmp->have_copied_auth_info) {
+        line =
+            read_config_read_data(ASN_INTEGER, line,
+                                  &StorageTmp->pdu_version, &tmpint);
+        line =
+            read_config_read_data(ASN_INTEGER, line,
+                                  &StorageTmp->pdu_securityModel, &tmpint);
+        line =
+            read_config_read_data(ASN_INTEGER, line,
+                                  &StorageTmp->pdu_securityLevel, &tmpint);
+        line =
+            read_config_read_data(ASN_OBJECT_ID, line, &tmpoid, &tmpint);
+        if (!netsnmp_tdomain_support
+            (tmpoid, tmpint, &StorageTmp->pdu_tDomain,
+             &StorageTmp->pdu_tDomainLen)) {
+            config_perror
+                ("unsupported transport domain for mteTriggerEntry");
+            return;
+        }
+        if (tmpoid != NULL) {
+            free(tmpoid);
+        }
+
+        /*
+         * can be NULL?  Yes.  
+         */
+        line = read_config_read_data(ASN_OCTET_STR, line,
+                                     &(StorageTmp->pdu_transport),
+                                     &StorageTmp->pdu_transportLen);
+
+        line =
+            read_config_read_data(ASN_OCTET_STR, line,
+                                  &StorageTmp->pdu_community,
+                                  &StorageTmp->pdu_community_len);
+        if (StorageTmp->pdu_community == NULL) {
+            config_perror("invalid specification for pdu_community");
+            return;
+        }
+        line =
+            read_config_read_data(ASN_OCTET_STR, line,
+                                  &StorageTmp->pdu_securityName,
+                                  &StorageTmp->pdu_securityNameLen);
+        if (StorageTmp->pdu_securityName == NULL) {
+            config_perror("invalid specification for pdu_securityName");
+            return;
+        }
+    }
+    StorageTmp->storageType = ST_NONVOLATILE;   /* the only type stored */
+
+    mteTriggerTable_add(StorageTmp);
+
+    /*
+     * technically this is too early 
+     */
+    if (StorageTmp->mteTriggerEnabled == MTETRIGGERENABLED_TRUE &&
+        StorageTmp->mteTriggerEntryStatus == RS_ACTIVE)
+        mte_enable_trigger(StorageTmp);
+
+    DEBUGMSGTL(("mteTriggerTable", "done.\n"));
+}
+
+
+
+
+/*
+ * store_mteTriggerTable():
+ *   stores .conf file entries needed to configure the mib.
+ */
+int
+store_mteTriggerTable(int majorID, int minorID, void *serverarg,
+                      void *clientarg)
+{
+    char            line[SNMP_MAXBUF];
+    char           *cptr;
+    size_t          tmpint;
+    struct mteTriggerTable_data *StorageTmp;
+    struct header_complex_index *hcindex;
+
+    DEBUGMSGTL(("mteTriggerTable", "storing data...  "));
+
+    for (hcindex = mteTriggerTableStorage; hcindex != NULL;
+         hcindex = hcindex->next) {
+        StorageTmp = (struct mteTriggerTable_data *) hcindex->data;
+
+
+        if (StorageTmp->storageType == ST_NONVOLATILE) {
+
+            memset(line, 0, sizeof(line));
+            strcat(line, "mteTriggerTable ");
+            cptr = line + strlen(line);
+
+            cptr =
+                read_config_store_data(ASN_OCTET_STR, cptr,
+                                       &StorageTmp->mteOwner,
+                                       &StorageTmp->mteOwnerLen);
+            cptr =
+                read_config_store_data(ASN_OCTET_STR, cptr,
+                                       &StorageTmp->mteTriggerName,
+                                       &StorageTmp->mteTriggerNameLen);
+            cptr =
+                read_config_store_data(ASN_OCTET_STR, cptr,
+                                       &StorageTmp->mteTriggerComment,
+                                       &StorageTmp->mteTriggerCommentLen);
+            cptr =
+                read_config_store_data(ASN_OCTET_STR, cptr,
+                                       &StorageTmp->mteTriggerTest,
+                                       &StorageTmp->mteTriggerTestLen);
+            cptr =
+                read_config_store_data(ASN_INTEGER, cptr,
+                                       &StorageTmp->mteTriggerSampleType,
+                                       &tmpint);
+            cptr =
+                read_config_store_data(ASN_OBJECT_ID, cptr,
+                                       &StorageTmp->mteTriggerValueID,
+                                       &StorageTmp->mteTriggerValueIDLen);
+            cptr =
+                read_config_store_data(ASN_INTEGER, cptr,
+                                       &StorageTmp->
+                                       mteTriggerValueIDWildcard, &tmpint);
+            cptr =
+                read_config_store_data(ASN_OCTET_STR, cptr,
+                                       &StorageTmp->mteTriggerTargetTag,
+                                       &StorageTmp->
+                                       mteTriggerTargetTagLen);
+            cptr =
+                read_config_store_data(ASN_OCTET_STR, cptr,
+                                       &StorageTmp->mteTriggerContextName,
+                                       &StorageTmp->
+                                       mteTriggerContextNameLen);
+            cptr =
+                read_config_store_data(ASN_INTEGER, cptr,
+                                       &StorageTmp->
+                                       mteTriggerContextNameWildcard,
+                                       &tmpint);
+            cptr =
+                read_config_store_data(ASN_UNSIGNED, cptr,
+                                       &StorageTmp->mteTriggerFrequency,
+                                       &tmpint);
+            cptr =
+                read_config_store_data(ASN_OCTET_STR, cptr,
+                                       &StorageTmp->mteTriggerObjectsOwner,
+                                       &StorageTmp->
+                                       mteTriggerObjectsOwnerLen);
+            cptr =
+                read_config_store_data(ASN_OCTET_STR, cptr,
+                                       &StorageTmp->mteTriggerObjects,
+                                       &StorageTmp->mteTriggerObjectsLen);
+            cptr =
+                read_config_store_data(ASN_INTEGER, cptr,
+                                       &StorageTmp->mteTriggerEnabled,
+                                       &tmpint);
+            cptr =
+                read_config_store_data(ASN_INTEGER, cptr,
+                                       &StorageTmp->mteTriggerEntryStatus,
+                                       &tmpint);
+
+            /*
+             * delta table 
+             */
+            cptr =
+                read_config_store_data(ASN_OBJECT_ID, cptr,
+                                       &StorageTmp->
+                                       mteTriggerDeltaDiscontinuityID,
+                                       &StorageTmp->
+                                       mteTriggerDeltaDiscontinuityIDLen);
+            cptr =
+                read_config_store_data(ASN_INTEGER, cptr,
+                                       &StorageTmp->
+                                       mteTriggerDeltaDiscontinuityIDWildcard,
+                                       &tmpint);
+            cptr =
+                read_config_store_data(ASN_INTEGER, cptr,
+                                       &StorageTmp->
+                                       mteTriggerDeltaDiscontinuityIDType,
+                                       &tmpint);
+
+            /*
+             * existence table 
+             */
+            cptr =
+                read_config_store_data(ASN_OCTET_STR, cptr,
+                                       &StorageTmp->
+                                       mteTriggerExistenceTest,
+                                       &StorageTmp->
+                                       mteTriggerExistenceTestLen);
+            cptr =
+                read_config_store_data(ASN_OCTET_STR, cptr,
+                                       &StorageTmp->
+                                       mteTriggerExistenceStartup,
+                                       &StorageTmp->
+                                       mteTriggerExistenceStartupLen);
+            cptr =
+                read_config_store_data(ASN_OCTET_STR, cptr,
+                                       &StorageTmp->
+                                       mteTriggerExistenceObjectsOwner,
+                                       &StorageTmp->
+                                       mteTriggerExistenceObjectsOwnerLen);
+            cptr =
+                read_config_store_data(ASN_OCTET_STR, cptr,
+                                       &StorageTmp->
+                                       mteTriggerExistenceObjects,
+                                       &StorageTmp->
+                                       mteTriggerExistenceObjectsLen);
+            cptr =
+                read_config_store_data(ASN_OCTET_STR, cptr,
+                                       &StorageTmp->
+                                       mteTriggerExistenceEventOwner,
+                                       &StorageTmp->
+                                       mteTriggerExistenceEventOwnerLen);
+            cptr =
+                read_config_store_data(ASN_OCTET_STR, cptr,
+                                       &StorageTmp->
+                                       mteTriggerExistenceEvent,
+                                       &StorageTmp->
+                                       mteTriggerExistenceEventLen);
+
+            /*
+             * boolean table 
+             */
+            cptr =
+                read_config_store_data(ASN_INTEGER, cptr,
+                                       &StorageTmp->
+                                       mteTriggerBooleanComparison,
+                                       &tmpint);
+            cptr =
+                read_config_store_data(ASN_INTEGER, cptr,
+                                       &StorageTmp->mteTriggerBooleanValue,
+                                       &tmpint);
+            cptr =
+                read_config_store_data(ASN_INTEGER, cptr,
+                                       &StorageTmp->
+                                       mteTriggerBooleanStartup, &tmpint);
+            cptr =
+                read_config_store_data(ASN_OCTET_STR, cptr,
+                                       &StorageTmp->
+                                       mteTriggerBooleanObjectsOwner,
+                                       &StorageTmp->
+                                       mteTriggerBooleanObjectsOwnerLen);
+            cptr =
+                read_config_store_data(ASN_OCTET_STR, cptr,
+                                       &StorageTmp->
+                                       mteTriggerBooleanObjects,
+                                       &StorageTmp->
+                                       mteTriggerBooleanObjectsLen);
+            cptr =
+                read_config_store_data(ASN_OCTET_STR, cptr,
+                                       &StorageTmp->
+                                       mteTriggerBooleanEventOwner,
+                                       &StorageTmp->
+                                       mteTriggerBooleanEventOwnerLen);
+            cptr =
+                read_config_store_data(ASN_OCTET_STR, cptr,
+                                       &StorageTmp->mteTriggerBooleanEvent,
+                                       &StorageTmp->
+                                       mteTriggerBooleanEventLen);
+
+            /*
+             * threshold table 
+             */
+            cptr =
+                read_config_store_data(ASN_INTEGER, cptr,
+                                       &StorageTmp->
+                                       mteTriggerThresholdStartup,
+                                       &tmpint);
+            cptr =
+                read_config_store_data(ASN_INTEGER, cptr,
+                                       &StorageTmp->
+                                       mteTriggerThresholdRising, &tmpint);
+            cptr =
+                read_config_store_data(ASN_INTEGER, cptr,
+                                       &StorageTmp->
+                                       mteTriggerThresholdFalling,
+                                       &tmpint);
+            cptr =
+                read_config_store_data(ASN_INTEGER, cptr,
+                                       &StorageTmp->
+                                       mteTriggerThresholdDeltaRising,
+                                       &tmpint);
+            cptr =
+                read_config_store_data(ASN_INTEGER, cptr,
+                                       &StorageTmp->
+                                       mteTriggerThresholdDeltaFalling,
+                                       &tmpint);
+            cptr =
+                read_config_store_data(ASN_OCTET_STR, cptr,
+                                       &StorageTmp->
+                                       mteTriggerThresholdObjectsOwner,
+                                       &StorageTmp->
+                                       mteTriggerThresholdObjectsOwnerLen);
+            cptr =
+                read_config_store_data(ASN_OCTET_STR, cptr,
+                                       &StorageTmp->
+                                       mteTriggerThresholdObjects,
+                                       &StorageTmp->
+                                       mteTriggerThresholdObjectsLen);
+            cptr =
+                read_config_store_data(ASN_OCTET_STR, cptr,
+                                       &StorageTmp->
+                                       mteTriggerThresholdRisingEventOwner,
+                                       &StorageTmp->
+                                       mteTriggerThresholdRisingEventOwnerLen);
+            cptr =
+                read_config_store_data(ASN_OCTET_STR, cptr,
+                                       &StorageTmp->
+                                       mteTriggerThresholdRisingEvent,
+                                       &StorageTmp->
+                                       mteTriggerThresholdRisingEventLen);
+            cptr =
+                read_config_store_data(ASN_OCTET_STR, cptr,
+                                       &StorageTmp->
+                                       mteTriggerThresholdFallingEventOwner,
+                                       &StorageTmp->
+                                       mteTriggerThresholdFallingEventOwnerLen);
+            cptr =
+                read_config_store_data(ASN_OCTET_STR, cptr,
+                                       &StorageTmp->
+                                       mteTriggerThresholdFallingEvent,
+                                       &StorageTmp->
+                                       mteTriggerThresholdFallingEventLen);
+            cptr =
+                read_config_store_data(ASN_OCTET_STR, cptr,
+                                       &StorageTmp->
+                                       mteTriggerThresholdDeltaRisingEventOwner,
+                                       &StorageTmp->
+                                       mteTriggerThresholdDeltaRisingEventOwnerLen);
+            cptr =
+                read_config_store_data(ASN_OCTET_STR, cptr,
+                                       &StorageTmp->
+                                       mteTriggerThresholdDeltaRisingEvent,
+                                       &StorageTmp->
+                                       mteTriggerThresholdDeltaRisingEventLen);
+            cptr =
+                read_config_store_data(ASN_OCTET_STR, cptr,
+                                       &StorageTmp->
+                                       mteTriggerThresholdDeltaFallingEventOwner,
+                                       &StorageTmp->
+                                       mteTriggerThresholdDeltaFallingEventOwnerLen);
+            cptr =
+                read_config_store_data(ASN_OCTET_STR, cptr,
+                                       &StorageTmp->
+                                       mteTriggerThresholdDeltaFallingEvent,
+                                       &StorageTmp->
+                                       mteTriggerThresholdDeltaFallingEventLen);
+
+            /*
+             * local internal variables 
+             */
+            cptr =
+                read_config_store_data(ASN_INTEGER, cptr,
+                                       &StorageTmp->have_copied_auth_info,
+                                       &tmpint);
+            if (StorageTmp->have_copied_auth_info) {
+                cptr =
+                    read_config_store_data(ASN_INTEGER, cptr,
+                                           &StorageTmp->pdu_version,
+                                           &tmpint);
+                cptr =
+                    read_config_store_data(ASN_INTEGER, cptr,
+                                           &StorageTmp->pdu_securityModel,
+                                           &tmpint);
+                cptr =
+                    read_config_store_data(ASN_INTEGER, cptr,
+                                           &StorageTmp->pdu_securityLevel,
+                                           &tmpint);
+                cptr =
+                    read_config_store_data(ASN_OBJECT_ID, cptr,
+                                           &StorageTmp->pdu_tDomain,
+                                           &StorageTmp->pdu_tDomainLen);
+                cptr =
+                    read_config_store_data(ASN_OCTET_STR, cptr,
+                                           &StorageTmp->pdu_transport,
+                                           &StorageTmp->pdu_transportLen);
+                cptr =
+                    read_config_store_data(ASN_OCTET_STR, cptr,
+                                           &StorageTmp->pdu_community,
+                                           &StorageTmp->pdu_community_len);
+                cptr =
+                    read_config_store_data(ASN_OCTET_STR, cptr,
+                                           &StorageTmp->pdu_securityName,
+                                           &StorageTmp->
+                                           pdu_securityNameLen);
+            }
+
+            snmpd_store_config(line);
+        }
+    }
+    DEBUGMSGTL(("mteTriggerTable", "done.\n"));
+    return SNMPERR_SUCCESS;
+}
+
+
+
+
+/*
+ * var_mteTriggerTable():
+ *   Handle this table separately from the scalar value case.
+ *   The workings of this are basically the same as for var_mteTriggerTable above.
+ */
+unsigned char  *
+var_mteTriggerTable(struct variable *vp,
+                    oid * name,
+                    size_t * length,
+                    int exact,
+                    size_t * var_len, WriteMethod ** write_method)
+{
+
+
+    struct mteTriggerTable_data *StorageTmp = NULL;
+
+
+    DEBUGMSGTL(("mteTriggerTable",
+                "var_mteTriggerTable: Entering...  \n"));
+    /*
+     * this assumes you have registered all your data properly
+     */
+    if ((StorageTmp =
+         header_complex(mteTriggerTableStorage, vp, name, length, exact,
+                        var_len, write_method)) == NULL) {
+        if (vp->magic == MTETRIGGERENTRYSTATUS)
+            *write_method = write_mteTriggerEntryStatus;
+        return NULL;
+    }
+
+
+    /*
+     * this is where we do the value assignments for the mib results.
+     */
+    switch (vp->magic) {
+
+
+    case MTETRIGGERCOMMENT:
+        *write_method = write_mteTriggerComment;
+        *var_len = StorageTmp->mteTriggerCommentLen;
+        return (u_char *) StorageTmp->mteTriggerComment;
+
+    case MTETRIGGERTEST:
+        *write_method = write_mteTriggerTest;
+        *var_len = StorageTmp->mteTriggerTestLen;
+        return (u_char *) StorageTmp->mteTriggerTest;
+
+    case MTETRIGGERSAMPLETYPE:
+        *write_method = write_mteTriggerSampleType;
+        *var_len = sizeof(StorageTmp->mteTriggerSampleType);
+        return (u_char *) & StorageTmp->mteTriggerSampleType;
+
+    case MTETRIGGERVALUEID:
+        *write_method = write_mteTriggerValueID;
+        *var_len = StorageTmp->mteTriggerValueIDLen * sizeof(oid);
+        return (u_char *) StorageTmp->mteTriggerValueID;
+
+    case MTETRIGGERVALUEIDWILDCARD:
+        *write_method = write_mteTriggerValueIDWildcard;
+        *var_len = sizeof(StorageTmp->mteTriggerValueIDWildcard);
+        return (u_char *) & StorageTmp->mteTriggerValueIDWildcard;
+
+    case MTETRIGGERTARGETTAG:
+        *write_method = write_mteTriggerTargetTag;
+        *var_len = StorageTmp->mteTriggerTargetTagLen;
+        return (u_char *) StorageTmp->mteTriggerTargetTag;
+
+    case MTETRIGGERCONTEXTNAME:
+        *write_method = write_mteTriggerContextName;
+        *var_len = StorageTmp->mteTriggerContextNameLen;
+        return (u_char *) StorageTmp->mteTriggerContextName;
+
+    case MTETRIGGERCONTEXTNAMEWILDCARD:
+        *write_method = write_mteTriggerContextNameWildcard;
+        *var_len = sizeof(StorageTmp->mteTriggerContextNameWildcard);
+        return (u_char *) & StorageTmp->mteTriggerContextNameWildcard;
+
+    case MTETRIGGERFREQUENCY:
+        *write_method = write_mteTriggerFrequency;
+        *var_len = sizeof(StorageTmp->mteTriggerFrequency);
+        return (u_char *) & StorageTmp->mteTriggerFrequency;
+
+    case MTETRIGGEROBJECTSOWNER:
+        *write_method = write_mteTriggerObjectsOwner;
+        *var_len = StorageTmp->mteTriggerObjectsOwnerLen;
+        return (u_char *) StorageTmp->mteTriggerObjectsOwner;
+
+    case MTETRIGGEROBJECTS:
+        *write_method = write_mteTriggerObjects;
+        *var_len = StorageTmp->mteTriggerObjectsLen;
+        return (u_char *) StorageTmp->mteTriggerObjects;
+
+    case MTETRIGGERENABLED:
+        *write_method = write_mteTriggerEnabled;
+        *var_len = sizeof(StorageTmp->mteTriggerEnabled);
+        return (u_char *) & StorageTmp->mteTriggerEnabled;
+
+    case MTETRIGGERENTRYSTATUS:
+        *write_method = write_mteTriggerEntryStatus;
+        *var_len = sizeof(StorageTmp->mteTriggerEntryStatus);
+        return (u_char *) & StorageTmp->mteTriggerEntryStatus;
+
+
+    default:
+        ERROR_MSG("");
+    }
+    return NULL;
+}
+
+
+
+
+int
+write_mteTriggerComment(int action,
+                        u_char * var_val,
+                        u_char var_val_type,
+                        size_t var_val_len,
+                        u_char * statP, oid * name, size_t name_len)
+{
+    static char    *tmpvar;
+    struct mteTriggerTable_data *StorageTmp = NULL;
+    static size_t   tmplen;
+    size_t          newlen =
+        name_len - (sizeof(mteTriggerTable_variables_oid) / sizeof(oid) +
+                    3 - 1);
+
+
+    DEBUGMSGTL(("mteTriggerTable",
+                "write_mteTriggerComment entering action=%d...  \n",
+                action));
+    if ((StorageTmp =
+         header_complex(mteTriggerTableStorage, NULL,
+                        &name[sizeof(mteTriggerTable_variables_oid) /
+                              sizeof(oid) + 3 - 1], &newlen, 1, NULL,
+                        NULL)) == NULL)
+        return SNMP_ERR_NOSUCHNAME;     /* remove if you support creation here */
+
+
+    switch (action) {
+    case RESERVE1:
+        if (var_val_type != ASN_OCTET_STR) {
+            snmp_log(LOG_ERR,
+                     "write to mteTriggerComment not ASN_OCTET_STR\n");
+            return SNMP_ERR_WRONGTYPE;
+        }
+        if (StorageTmp->storageType != ST_NONVOLATILE)
+            return SNMP_ERR_NOTWRITABLE;
+
+        break;
+
+
+    case RESERVE2:
+        /*
+         * memory reseveration, final preparation... 
+         */
+        break;
+
+
+    case FREE:
+        /*
+         * Release any resources that have been allocated 
+         */
+        break;
+
+
+    case ACTION:
+        /*
+         * The variable has been stored in string for
+         * you to use, and you have just been asked to do something with
+         * it.  Note that anything done here must be reversable in the UNDO case 
+         */
+        tmpvar = StorageTmp->mteTriggerComment;
+        tmplen = StorageTmp->mteTriggerCommentLen;
+        memdup((u_char **) & StorageTmp->mteTriggerComment, var_val,
+               var_val_len);
+        StorageTmp->mteTriggerCommentLen = var_val_len;
+        break;
+
+
+    case UNDO:
+        /*
+         * Back out any changes made in the ACTION case 
+         */
+        SNMP_FREE(StorageTmp->mteTriggerComment);
+        StorageTmp->mteTriggerComment = tmpvar;
+        StorageTmp->mteTriggerCommentLen = tmplen;
+        break;
+
+
+    case COMMIT:
+        /*
+         * Things are working well, so it's now safe to make the change
+         * permanently.  Make sure that anything done here can't fail! 
+         */
+        SNMP_FREE(tmpvar);
+        break;
+    }
+    return SNMP_ERR_NOERROR;
+}
+
+
+
+int
+write_mteTriggerTest(int action,
+                     u_char * var_val,
+                     u_char var_val_type,
+                     size_t var_val_len,
+                     u_char * statP, oid * name, size_t name_len)
+{
+    static char    *tmpvar;
+    struct mteTriggerTable_data *StorageTmp = NULL;
+    static size_t   tmplen;
+    size_t          newlen =
+        name_len - (sizeof(mteTriggerTable_variables_oid) / sizeof(oid) +
+                    3 - 1);
+
+
+    DEBUGMSGTL(("mteTriggerTable",
+                "write_mteTriggerTest entering action=%d...  \n", action));
+    if ((StorageTmp =
+         header_complex(mteTriggerTableStorage, NULL,
+                        &name[sizeof(mteTriggerTable_variables_oid) /
+                              sizeof(oid) + 3 - 1], &newlen, 1, NULL,
+                        NULL)) == NULL)
+        return SNMP_ERR_NOSUCHNAME;     /* remove if you support creation here */
+
+
+    switch (action) {
+    case RESERVE1:
+        if (var_val_type != ASN_OCTET_STR) {
+            snmp_log(LOG_ERR, "write to mteTriggerTest not ASN_OCTET_STR\n");
+            return SNMP_ERR_WRONGTYPE;
+        }
+        if (StorageTmp->storageType != ST_NONVOLATILE)
+            return SNMP_ERR_NOTWRITABLE;
+        break;
+
+
+    case RESERVE2:
+        /*
+         * memory reseveration, final preparation... 
+         */
+        break;
+
+
+    case FREE:
+        /*
+         * Release any resources that have been allocated 
+         */
+        break;
+
+
+    case ACTION:
+        /*
+         * The variable has been stored in string for
+         * you to use, and you have just been asked to do something with
+         * it.  Note that anything done here must be reversable in the UNDO case 
+         */
+        tmpvar = StorageTmp->mteTriggerTest;
+        tmplen = StorageTmp->mteTriggerTestLen;
+        memdup((u_char **) & StorageTmp->mteTriggerTest, var_val,
+               var_val_len);
+        StorageTmp->mteTriggerTestLen = var_val_len;
+        break;
+
+
+    case UNDO:
+        /*
+         * Back out any changes made in the ACTION case 
+         */
+        SNMP_FREE(StorageTmp->mteTriggerTest);
+        StorageTmp->mteTriggerTest = tmpvar;
+        StorageTmp->mteTriggerTestLen = tmplen;
+        break;
+
+
+    case COMMIT:
+        /*
+         * Things are working well, so it's now safe to make the change
+         * permanently.  Make sure that anything done here can't fail! 
+         */
+        SNMP_FREE(tmpvar);
+        break;
+    }
+    return SNMP_ERR_NOERROR;
+}
+
+
+
+int
+write_mteTriggerSampleType(int action,
+                           u_char * var_val,
+                           u_char var_val_type,
+                           size_t var_val_len,
+                           u_char * statP, oid * name, size_t name_len)
+{
+    static int      tmpvar;
+    struct mteTriggerTable_data *StorageTmp = NULL;
+    size_t          newlen =
+        name_len - (sizeof(mteTriggerTable_variables_oid) / sizeof(oid) +
+                    3 - 1);
+
+
+    DEBUGMSGTL(("mteTriggerTable",
+                "write_mteTriggerSampleType entering action=%d...  \n",
+                action));
+    if ((StorageTmp =
+         header_complex(mteTriggerTableStorage, NULL,
+                        &name[sizeof(mteTriggerTable_variables_oid) /
+                              sizeof(oid) + 3 - 1], &newlen, 1, NULL,
+                        NULL)) == NULL)
+        return SNMP_ERR_NOSUCHNAME;     /* remove if you support creation here */
+
+
+    switch (action) {
+    case RESERVE1:
+        if (var_val_type != ASN_INTEGER) {
+            snmp_log(LOG_ERR,
+                     "write to mteTriggerSampleType not ASN_INTEGER\n");
+            return SNMP_ERR_WRONGTYPE;
+        }
+        if (StorageTmp->storageType != ST_NONVOLATILE)
+            return SNMP_ERR_NOTWRITABLE;
+        break;
+
+
+    case RESERVE2:
+        /*
+         * memory reseveration, final preparation... 
+         */
+        break;
+
+
+    case FREE:
+        /*
+         * Release any resources that have been allocated 
+         */
+        break;
+
+
+    case ACTION:
+        /*
+         * The variable has been stored in long_ret for
+         * you to use, and you have just been asked to do something with
+         * it.  Note that anything done here must be reversable in the UNDO case 
+         */
+        tmpvar = StorageTmp->mteTriggerSampleType;
+        StorageTmp->mteTriggerSampleType = *((long *) var_val);
+        break;
+
+
+    case UNDO:
+        /*
+         * Back out any changes made in the ACTION case 
+         */
+        StorageTmp->mteTriggerSampleType = tmpvar;
+        break;
+
+
+    case COMMIT:
+        /*
+         * Things are working well, so it's now safe to make the change
+         * permanently.  Make sure that anything done here can't fail! 
+         */
+
+        break;
+    }
+    return SNMP_ERR_NOERROR;
+}
+
+
+
+int
+write_mteTriggerValueID(int action,
+                        u_char * var_val,
+                        u_char var_val_type,
+                        size_t var_val_len,
+                        u_char * statP, oid * name, size_t name_len)
+{
+    static oid     *tmpvar;
+    struct mteTriggerTable_data *StorageTmp = NULL;
+    static size_t   tmplen;
+    size_t          newlen =
+        name_len - (sizeof(mteTriggerTable_variables_oid) / sizeof(oid) +
+                    3 - 1);
+
+
+    DEBUGMSGTL(("mteTriggerTable",
+                "write_mteTriggerValueID entering action=%d...  \n",
+                action));
+    if ((StorageTmp =
+         header_complex(mteTriggerTableStorage, NULL,
+                        &name[sizeof(mteTriggerTable_variables_oid) /
+                              sizeof(oid) + 3 - 1], &newlen, 1, NULL,
+                        NULL)) == NULL)
+        return SNMP_ERR_NOSUCHNAME;     /* remove if you support creation here */
+
+
+    switch (action) {
+    case RESERVE1:
+        if (var_val_type != ASN_OBJECT_ID) {
+            snmp_log(LOG_ERR,
+                     "write to mteTriggerValueID not ASN_OBJECT_ID\n");
+            return SNMP_ERR_WRONGTYPE;
+        }
+        if (StorageTmp->storageType != ST_NONVOLATILE)
+            return SNMP_ERR_NOTWRITABLE;
+        break;
+
+
+    case RESERVE2:
+        /*
+         * memory reseveration, final preparation... 
+         */
+        break;
+
+
+    case FREE:
+        /*
+         * Release any resources that have been allocated 
+         */
+        break;
+
+
+    case ACTION:
+        /*
+         * The variable has been stored in objid for
+         * you to use, and you have just been asked to do something with
+         * it.  Note that anything done here must be reversable in the UNDO case 
+         */
+        tmpvar = StorageTmp->mteTriggerValueID;
+        tmplen = StorageTmp->mteTriggerValueIDLen;
+        memdup((u_char **) & StorageTmp->mteTriggerValueID, var_val,
+               var_val_len);
+        StorageTmp->mteTriggerValueIDLen = var_val_len / sizeof(oid);
+        break;
+
+
+    case UNDO:
+        /*
+         * Back out any changes made in the ACTION case 
+         */
+        SNMP_FREE(StorageTmp->mteTriggerValueID);
+        StorageTmp->mteTriggerValueID = tmpvar;
+        StorageTmp->mteTriggerValueIDLen = tmplen;
+        break;
+
+
+    case COMMIT:
+        /*
+         * Things are working well, so it's now safe to make the change
+         * permanently.  Make sure that anything done here can't fail! 
+         */
+
+        /*
+         * XXX: if the valueID has actually changed, shouldn't we dump any
+         * previous values, as these are from a different object?  
+         */
+        SNMP_FREE(tmpvar);
+        break;
+    }
+    return SNMP_ERR_NOERROR;
+}
+
+
+
+int
+write_mteTriggerValueIDWildcard(int action,
+                                u_char * var_val,
+                                u_char var_val_type,
+                                size_t var_val_len,
+                                u_char * statP,
+                                oid * name, size_t name_len)
+{
+    static int      tmpvar;
+    struct mteTriggerTable_data *StorageTmp = NULL;
+    size_t          newlen =
+        name_len - (sizeof(mteTriggerTable_variables_oid) / sizeof(oid) +
+                    3 - 1);
+
+
+    DEBUGMSGTL(("mteTriggerTable",
+                "write_mteTriggerValueIDWildcard entering action=%d...  \n",
+                action));
+    if ((StorageTmp =
+         header_complex(mteTriggerTableStorage, NULL,
+                        &name[sizeof(mteTriggerTable_variables_oid) /
+                              sizeof(oid) + 3 - 1], &newlen, 1, NULL,
+                        NULL)) == NULL)
+        return SNMP_ERR_NOSUCHNAME;     /* remove if you support creation here */
+
+
+    switch (action) {
+    case RESERVE1:
+        if (var_val_type != ASN_INTEGER) {
+            snmp_log(LOG_ERR,
+                     "write to mteTriggerValueIDWildcard not ASN_INTEGER\n");
+            return SNMP_ERR_WRONGTYPE;
+        }
+        if (StorageTmp->storageType != ST_NONVOLATILE)
+            return SNMP_ERR_NOTWRITABLE;
+        break;
+
+
+    case RESERVE2:
+        /*
+         * memory reseveration, final preparation... 
+         */
+        break;
+
+
+    case FREE:
+        /*
+         * Release any resources that have been allocated 
+         */
+        break;
+
+
+    case ACTION:
+        /*
+         * The variable has been stored in long_ret for
+         * you to use, and you have just been asked to do something with
+         * it.  Note that anything done here must be reversable in the UNDO case 
+         */
+        tmpvar = StorageTmp->mteTriggerValueIDWildcard;
+        StorageTmp->mteTriggerValueIDWildcard = *((long *) var_val);
+        break;
+
+
+    case UNDO:
+        /*
+         * Back out any changes made in the ACTION case 
+         */
+        StorageTmp->mteTriggerValueIDWildcard = tmpvar;
+        break;
+
+
+    case COMMIT:
+        /*
+         * Things are working well, so it's now safe to make the change
+         * permanently.  Make sure that anything done here can't fail! 
+         */
+
+        break;
+    }
+    return SNMP_ERR_NOERROR;
+}
+
+
+
+int
+write_mteTriggerTargetTag(int action,
+                          u_char * var_val,
+                          u_char var_val_type,
+                          size_t var_val_len,
+                          u_char * statP, oid * name, size_t name_len)
+{
+    static char    *tmpvar;
+    struct mteTriggerTable_data *StorageTmp = NULL;
+    static size_t   tmplen;
+    size_t          newlen =
+        name_len - (sizeof(mteTriggerTable_variables_oid) / sizeof(oid) +
+                    3 - 1);
+
+
+    DEBUGMSGTL(("mteTriggerTable",
+                "write_mteTriggerTargetTag entering action=%d...  \n",
+                action));
+    if ((StorageTmp =
+         header_complex(mteTriggerTableStorage, NULL,
+                        &name[sizeof(mteTriggerTable_variables_oid) /
+                              sizeof(oid) + 3 - 1], &newlen, 1, NULL,
+                        NULL)) == NULL)
+        return SNMP_ERR_NOSUCHNAME;     /* remove if you support creation here */
+
+
+    switch (action) {
+    case RESERVE1:
+        if (var_val_type != ASN_OCTET_STR) {
+            snmp_log(LOG_ERR,
+                     "write to mteTriggerTargetTag not ASN_OCTET_STR\n");
+            return SNMP_ERR_WRONGTYPE;
+        }
+        if (StorageTmp->storageType != ST_NONVOLATILE)
+            return SNMP_ERR_NOTWRITABLE;
+        break;
+
+
+    case RESERVE2:
+        /*
+         * memory reseveration, final preparation... 
+         */
+        break;
+
+
+    case FREE:
+        /*
+         * Release any resources that have been allocated 
+         */
+        break;
+
+
+    case ACTION:
+        /*
+         * The variable has been stored in string for
+         * you to use, and you have just been asked to do something with
+         * it.  Note that anything done here must be reversable in the UNDO case 
+         */
+        tmpvar = StorageTmp->mteTriggerTargetTag;
+        tmplen = StorageTmp->mteTriggerTargetTagLen;
+        memdup((u_char **) & StorageTmp->mteTriggerTargetTag, var_val,
+               var_val_len);
+        StorageTmp->mteTriggerTargetTagLen = var_val_len;
+        break;
+
+
+    case UNDO:
+        /*
+         * Back out any changes made in the ACTION case 
+         */
+        SNMP_FREE(StorageTmp->mteTriggerTargetTag);
+        StorageTmp->mteTriggerTargetTag = tmpvar;
+        StorageTmp->mteTriggerTargetTagLen = tmplen;
+        break;
+
+
+    case COMMIT:
+        /*
+         * Things are working well, so it's now safe to make the change
+         * permanently.  Make sure that anything done here can't fail! 
+         */
+        SNMP_FREE(tmpvar);
+        break;
+    }
+    return SNMP_ERR_NOERROR;
+}
+
+
+
+int
+write_mteTriggerContextName(int action,
+                            u_char * var_val,
+                            u_char var_val_type,
+                            size_t var_val_len,
+                            u_char * statP, oid * name, size_t name_len)
+{
+    static char    *tmpvar;
+    struct mteTriggerTable_data *StorageTmp = NULL;
+    static size_t   tmplen;
+    size_t          newlen =
+        name_len - (sizeof(mteTriggerTable_variables_oid) / sizeof(oid) +
+                    3 - 1);
+
+
+    DEBUGMSGTL(("mteTriggerTable",
+                "write_mteTriggerContextName entering action=%d...  \n",
+                action));
+    if ((StorageTmp =
+         header_complex(mteTriggerTableStorage, NULL,
+                        &name[sizeof(mteTriggerTable_variables_oid) /
+                              sizeof(oid) + 3 - 1], &newlen, 1, NULL,
+                        NULL)) == NULL)
+        return SNMP_ERR_NOSUCHNAME;     /* remove if you support creation here */
+
+
+    switch (action) {
+    case RESERVE1:
+        if (var_val_type != ASN_OCTET_STR) {
+            snmp_log(LOG_ERR,
+                     "write to mteTriggerContextName not ASN_OCTET_STR\n");
+            return SNMP_ERR_WRONGTYPE;
+        }
+        if (StorageTmp->storageType != ST_NONVOLATILE)
+            return SNMP_ERR_NOTWRITABLE;
+        break;
+
+
+    case RESERVE2:
+        /*
+         * memory reseveration, final preparation... 
+         */
+        break;
+
+
+    case FREE:
+        /*
+         * Release any resources that have been allocated 
+         */
+        break;
+
+
+    case ACTION:
+        /*
+         * The variable has been stored in string for
+         * you to use, and you have just been asked to do something with
+         * it.  Note that anything done here must be reversable in the UNDO case 
+         */
+        tmpvar = StorageTmp->mteTriggerContextName;
+        tmplen = StorageTmp->mteTriggerContextNameLen;
+        memdup((u_char **) & StorageTmp->mteTriggerContextName, var_val,
+               var_val_len);
+        StorageTmp->mteTriggerContextNameLen = var_val_len;
+        break;
+
+
+    case UNDO:
+        /*
+         * Back out any changes made in the ACTION case 
+         */
+        SNMP_FREE(StorageTmp->mteTriggerContextName);
+        StorageTmp->mteTriggerContextName = tmpvar;
+        StorageTmp->mteTriggerContextNameLen = tmplen;
+        break;
+
+
+    case COMMIT:
+        /*
+         * Things are working well, so it's now safe to make the change
+         * permanently.  Make sure that anything done here can't fail! 
+         */
+        SNMP_FREE(tmpvar);
+        break;
+    }
+    return SNMP_ERR_NOERROR;
+}
+
+
+
+int
+write_mteTriggerContextNameWildcard(int action,
+                                    u_char * var_val,
+                                    u_char var_val_type,
+                                    size_t var_val_len,
+                                    u_char * statP,
+                                    oid * name, size_t name_len)
+{
+    static int      tmpvar;
+    struct mteTriggerTable_data *StorageTmp = NULL;
+    size_t          newlen =
+        name_len - (sizeof(mteTriggerTable_variables_oid) / sizeof(oid) +
+                    3 - 1);
+
+
+    DEBUGMSGTL(("mteTriggerTable",
+                "write_mteTriggerContextNameWildcard entering action=%d...  \n",
+                action));
+    if ((StorageTmp =
+         header_complex(mteTriggerTableStorage, NULL,
+                        &name[sizeof(mteTriggerTable_variables_oid) /
+                              sizeof(oid) + 3 - 1], &newlen, 1, NULL,
+                        NULL)) == NULL)
+        return SNMP_ERR_NOSUCHNAME;     /* remove if you support creation here */
+
+
+    switch (action) {
+    case RESERVE1:
+        if (var_val_type != ASN_INTEGER) {
+            snmp_log(LOG_ERR,
+                     "write to mteTriggerContextNameWildcard not ASN_INTEGER\n");
+            return SNMP_ERR_WRONGTYPE;
+        }
+        if (StorageTmp->storageType != ST_NONVOLATILE)
+            return SNMP_ERR_NOTWRITABLE;
+        break;
+
+
+    case RESERVE2:
+        /*
+         * memory reseveration, final preparation... 
+         */
+        break;
+
+
+    case FREE:
+        /*
+         * Release any resources that have been allocated 
+         */
+        break;
+
+
+    case ACTION:
+        /*
+         * The variable has been stored in long_ret for
+         * you to use, and you have just been asked to do something with
+         * it.  Note that anything done here must be reversable in the UNDO case 
+         */
+        tmpvar = StorageTmp->mteTriggerContextNameWildcard;
+        StorageTmp->mteTriggerContextNameWildcard = *((long *) var_val);
+        break;
+
+
+    case UNDO:
+        /*
+         * Back out any changes made in the ACTION case 
+         */
+        StorageTmp->mteTriggerContextNameWildcard = tmpvar;
+        break;
+
+
+    case COMMIT:
+        /*
+         * Things are working well, so it's now safe to make the change
+         * permanently.  Make sure that anything done here can't fail! 
+         */
+
+        break;
+    }
+    return SNMP_ERR_NOERROR;
+}
+
+
+
+int
+write_mteTriggerFrequency(int action,
+                          u_char * var_val,
+                          u_char var_val_type,
+                          size_t var_val_len,
+                          u_char * statP, oid * name, size_t name_len)
+{
+    static int      tmpvar;
+    struct mteTriggerTable_data *StorageTmp = NULL;
+    size_t          newlen =
+        name_len - (sizeof(mteTriggerTable_variables_oid) / sizeof(oid) +
+                    3 - 1);
+
+
+    DEBUGMSGTL(("mteTriggerTable",
+                "write_mteTriggerFrequency entering action=%d...  \n",
+                action));
+    if ((StorageTmp =
+         header_complex(mteTriggerTableStorage, NULL,
+                        &name[sizeof(mteTriggerTable_variables_oid) /
+                              sizeof(oid) + 3 - 1], &newlen, 1, NULL,
+                        NULL)) == NULL)
+        return SNMP_ERR_NOSUCHNAME;     /* remove if you support creation here */
+
+
+    switch (action) {
+    case RESERVE1:
+        if (var_val_type != ASN_UNSIGNED) {
+            snmp_log(LOG_ERR,
+                     "write to mteTriggerFrequency not ASN_UNSIGNED\n");
+            return SNMP_ERR_WRONGTYPE;
+        }
+        if (StorageTmp->storageType != ST_NONVOLATILE)
+            return SNMP_ERR_NOTWRITABLE;
+        break;
+
+
+    case RESERVE2:
+        /*
+         * memory reseveration, final preparation... 
+         */
+        break;
+
+
+    case FREE:
+        /*
+         * Release any resources that have been allocated 
+         */
+        break;
+
+
+    case ACTION:
+        /*
+         * The variable has been stored in ulong_ret for
+         * you to use, and you have just been asked to do something with
+         * it.  Note that anything done here must be reversable in the UNDO case 
+         */
+        tmpvar = StorageTmp->mteTriggerFrequency;
+        StorageTmp->mteTriggerFrequency = *((unsigned long *) var_val);
+        break;
+
+
+    case UNDO:
+        /*
+         * Back out any changes made in the ACTION case 
+         */
+        StorageTmp->mteTriggerFrequency = tmpvar;
+        break;
+
+
+    case COMMIT:
+        /*
+         * Things are working well, so it's now safe to make the change
+         * permanently.  Make sure that anything done here can't fail! 
+         */
+        if (StorageTmp->mteTriggerEnabled == MTETRIGGERENABLED_TRUE &&
+            StorageTmp->mteTriggerEntryStatus == RS_ACTIVE)
+            mte_enable_trigger(StorageTmp);
+
+        break;
+    }
+    return SNMP_ERR_NOERROR;
+}
+
+
+
+int
+write_mteTriggerObjectsOwner(int action,
+                             u_char * var_val,
+                             u_char var_val_type,
+                             size_t var_val_len,
+                             u_char * statP, oid * name, size_t name_len)
+{
+    static char    *tmpvar;
+    struct mteTriggerTable_data *StorageTmp = NULL;
+    static size_t   tmplen;
+    size_t          newlen =
+        name_len - (sizeof(mteTriggerTable_variables_oid) / sizeof(oid) +
+                    3 - 1);
+
+
+    DEBUGMSGTL(("mteTriggerTable",
+                "write_mteTriggerObjectsOwner entering action=%d...  \n",
+                action));
+    if ((StorageTmp =
+         header_complex(mteTriggerTableStorage, NULL,
+                        &name[sizeof(mteTriggerTable_variables_oid) /
+                              sizeof(oid) + 3 - 1], &newlen, 1, NULL,
+                        NULL)) == NULL)
+        return SNMP_ERR_NOSUCHNAME;     /* remove if you support creation here */
+
+
+    switch (action) {
+    case RESERVE1:
+        if (var_val_type != ASN_OCTET_STR) {
+            snmp_log(LOG_ERR,
+                     "write to mteTriggerObjectsOwner not ASN_OCTET_STR\n");
+            return SNMP_ERR_WRONGTYPE;
+        }
+        if (StorageTmp->storageType != ST_NONVOLATILE)
+            return SNMP_ERR_NOTWRITABLE;
+        break;
+
+
+    case RESERVE2:
+        /*
+         * memory reseveration, final preparation... 
+         */
+        break;
+
+
+    case FREE:
+        /*
+         * Release any resources that have been allocated 
+         */
+        break;
+
+
+    case ACTION:
+        /*
+         * The variable has been stored in string for
+         * you to use, and you have just been asked to do something with
+         * it.  Note that anything done here must be reversable in the UNDO case 
+         */
+        tmpvar = StorageTmp->mteTriggerObjectsOwner;
+        tmplen = StorageTmp->mteTriggerObjectsOwnerLen;
+        memdup((u_char **) & StorageTmp->mteTriggerObjectsOwner, var_val,
+               var_val_len);
+        StorageTmp->mteTriggerObjectsOwnerLen = var_val_len;
+        break;
+
+
+    case UNDO:
+        /*
+         * Back out any changes made in the ACTION case 
+         */
+        SNMP_FREE(StorageTmp->mteTriggerObjectsOwner);
+        StorageTmp->mteTriggerObjectsOwner = tmpvar;
+        StorageTmp->mteTriggerObjectsOwnerLen = tmplen;
+        break;
+
+
+    case COMMIT:
+        /*
+         * Things are working well, so it's now safe to make the change
+         * permanently.  Make sure that anything done here can't fail! 
+         */
+        SNMP_FREE(tmpvar);
+        break;
+    }
+    return SNMP_ERR_NOERROR;
+}
+
+
+
+int
+write_mteTriggerObjects(int action,
+                        u_char * var_val,
+                        u_char var_val_type,
+                        size_t var_val_len,
+                        u_char * statP, oid * name, size_t name_len)
+{
+    static char    *tmpvar;
+    struct mteTriggerTable_data *StorageTmp = NULL;
+    static size_t   tmplen;
+    size_t          newlen =
+        name_len - (sizeof(mteTriggerTable_variables_oid) / sizeof(oid) +
+                    3 - 1);
+
+
+    DEBUGMSGTL(("mteTriggerTable",
+                "write_mteTriggerObjects entering action=%d...  \n",
+                action));
+    if ((StorageTmp =
+         header_complex(mteTriggerTableStorage, NULL,
+                        &name[sizeof(mteTriggerTable_variables_oid) /
+                              sizeof(oid) + 3 - 1], &newlen, 1, NULL,
+                        NULL)) == NULL)
+        return SNMP_ERR_NOSUCHNAME;     /* remove if you support creation here */
+
+
+    switch (action) {
+    case RESERVE1:
+        if (var_val_type != ASN_OCTET_STR) {
+            snmp_log(LOG_ERR,
+                     "write to mteTriggerObjects not ASN_OCTET_STR\n");
+            return SNMP_ERR_WRONGTYPE;
+        }
+        if (StorageTmp->storageType != ST_NONVOLATILE)
+            return SNMP_ERR_NOTWRITABLE;
+        break;
+
+
+    case RESERVE2:
+        /*
+         * memory reseveration, final preparation... 
+         */
+        break;
+
+
+    case FREE:
+        /*
+         * Release any resources that have been allocated 
+         */
+        break;
+
+
+    case ACTION:
+        /*
+         * The variable has been stored in string for
+         * you to use, and you have just been asked to do something with
+         * it.  Note that anything done here must be reversable in the UNDO case 
+         */
+        tmpvar = StorageTmp->mteTriggerObjects;
+        tmplen = StorageTmp->mteTriggerObjectsLen;
+        memdup((u_char **) & StorageTmp->mteTriggerObjects, var_val,
+               var_val_len);
+        StorageTmp->mteTriggerObjectsLen = var_val_len;
+        break;
+
+
+    case UNDO:
+        /*
+         * Back out any changes made in the ACTION case 
+         */
+        SNMP_FREE(StorageTmp->mteTriggerObjects);
+        StorageTmp->mteTriggerObjects = tmpvar;
+        StorageTmp->mteTriggerObjectsLen = tmplen;
+        break;
+
+
+    case COMMIT:
+        /*
+         * Things are working well, so it's now safe to make the change
+         * permanently.  Make sure that anything done here can't fail! 
+         */
+        SNMP_FREE(tmpvar);
+        break;
+    }
+    return SNMP_ERR_NOERROR;
+}
+
+
+
+int
+write_mteTriggerEnabled(int action,
+                        u_char * var_val,
+                        u_char var_val_type,
+                        size_t var_val_len,
+                        u_char * statP, oid * name, size_t name_len)
+{
+    static int      tmpvar;
+    struct mteTriggerTable_data *StorageTmp = NULL;
+    size_t          newlen =
+        name_len - (sizeof(mteTriggerTable_variables_oid) / sizeof(oid) +
+                    3 - 1);
+
+
+    DEBUGMSGTL(("mteTriggerTable",
+                "write_mteTriggerEnabled entering action=%d...  \n",
+                action));
+    if ((StorageTmp =
+         header_complex(mteTriggerTableStorage, NULL,
+                        &name[sizeof(mteTriggerTable_variables_oid) /
+                              sizeof(oid) + 3 - 1], &newlen, 1, NULL,
+                        NULL)) == NULL)
+        return SNMP_ERR_NOSUCHNAME;     /* remove if you support creation here */
+
+
+    switch (action) {
+    case RESERVE1:
+        if (var_val_type != ASN_INTEGER) {
+            snmp_log(LOG_ERR,
+                     "write to mteTriggerEnabled not ASN_INTEGER\n");
+            return SNMP_ERR_WRONGTYPE;
+        }
+        if (StorageTmp->storageType != ST_NONVOLATILE)
+            return SNMP_ERR_NOTWRITABLE;
+        break;
+
+
+    case RESERVE2:
+        /*
+         * memory reseveration, final preparation... 
+         */
+        break;
+
+
+    case FREE:
+        /*
+         * Release any resources that have been allocated 
+         */
+        break;
+
+
+    case ACTION:
+        /*
+         * The variable has been stored in long_ret for
+         * you to use, and you have just been asked to do something with
+         * it.  Note that anything done here must be reversable in the UNDO case 
+         */
+        tmpvar = StorageTmp->mteTriggerEnabled;
+        StorageTmp->mteTriggerEnabled = *((long *) var_val);
+        break;
+
+
+    case UNDO:
+        /*
+         * Back out any changes made in the ACTION case 
+         */
+        StorageTmp->mteTriggerEnabled = tmpvar;
+        break;
+
+
+    case COMMIT:
+        /*
+         * Things are working well, so it's now safe to make the change
+         * permanently.  Make sure that anything done here can't fail! 
+         */
+        if (StorageTmp->mteTriggerEnabled == MTETRIGGERENABLED_TRUE &&
+            StorageTmp->mteTriggerEntryStatus == RS_ACTIVE)
+            mte_enable_trigger(StorageTmp);
+        else if (StorageTmp->mteTriggerEnabled == MTETRIGGERENABLED_FALSE)
+            mte_disable_trigger(StorageTmp);
+
+
+        break;
+    }
+    return SNMP_ERR_NOERROR;
+}
+
+
+
+
+
+
+int
+write_mteTriggerEntryStatus(int action,
+                            u_char * var_val,
+                            u_char var_val_type,
+                            size_t var_val_len,
+                            u_char * statP, oid * name, size_t name_len)
+{
+    struct mteTriggerTable_data *StorageTmp = NULL;
+    static struct mteTriggerTable_data *StorageNew, *StorageDel;
+    size_t          newlen =
+        name_len - (sizeof(mteTriggerTable_variables_oid) / sizeof(oid) +
+                    3 - 1);
+    static int      old_value;
+    int             set_value;
+    static netsnmp_variable_list *vars, *vp;
+    struct header_complex_index *hciptr;
+
+    StorageTmp =
+        header_complex(mteTriggerTableStorage, NULL,
+                       &name[sizeof(mteTriggerTable_variables_oid) /
+                             sizeof(oid) + 3 - 1], &newlen, 1, NULL, NULL);
+
+
+
+
+    if (var_val_type != ASN_INTEGER || var_val == NULL) {
+        snmp_log(LOG_ERR,
+                 "write to mteTriggerEntryStatus not ASN_INTEGER\n");
+        return SNMP_ERR_WRONGTYPE;
+    }
+    set_value = *((long *) var_val);
+
+
+    /*
+     * check legal range, and notReady is reserved for us, not a user 
+     */
+    if (set_value < 1 || set_value > 6 || set_value == RS_NOTREADY)
+        return SNMP_ERR_INCONSISTENTVALUE;
+
+
+    switch (action) {
+    case RESERVE1:
+        /*
+         * stage one: test validity 
+         */
+        if (StorageTmp == NULL) {
+            /*
+             * create the row now? 
+             */
+
+
+            /*
+             * ditch illegal values now 
+             */
+            if (set_value == RS_ACTIVE || set_value == RS_NOTINSERVICE)
+                return SNMP_ERR_INCONSISTENTVALUE;
+
+
+            /*
+             * destroying a non-existent row is actually legal 
+             */
+            if (set_value == RS_DESTROY) {
+                return SNMP_ERR_NOERROR;
+            }
+
+
+            /*
+             * illegal creation values 
+             */
+            if (set_value == RS_ACTIVE || set_value == RS_NOTINSERVICE) {
+                return SNMP_ERR_INCONSISTENTVALUE;
+            }
+        } else {
+            /*
+             * row exists.  Check for a valid state change 
+             */
+            if (set_value == RS_CREATEANDGO
+                || set_value == RS_CREATEANDWAIT) {
+                /*
+                 * can't create a row that exists 
+                 */
+                return SNMP_ERR_INCONSISTENTVALUE;
+            }
+
+            if (StorageTmp->mteTriggerEntryStatus == RS_ACTIVE &&
+                set_value != RS_DESTROY) {
+                /*
+                 * "Once made active an entry may not be modified except to 
+                 * delete it."  XXX: doesn't this in fact apply to ALL
+                 * columns of the table and not just this one?  
+                 */
+                return SNMP_ERR_INCONSISTENTVALUE;
+            }
+            if (StorageTmp->storageType != ST_NONVOLATILE)
+                return SNMP_ERR_NOTWRITABLE;
+        }
+        break;
+
+
+
+
+    case RESERVE2:
+        /*
+         * memory reseveration, final preparation... 
+         */
+        if (StorageTmp == NULL) {
+            /*
+             * creation 
+             */
+            vars = NULL;
+
+
+            snmp_varlist_add_variable(&vars, NULL, 0, ASN_OCTET_STR, NULL, 0);  /* mteOwner */
+            snmp_varlist_add_variable(&vars, NULL, 0, ASN_PRIV_IMPLIED_OCTET_STR, NULL, 0);     /* mteTriggerName */
+
+
+
+            if (header_complex_parse_oid
+                (&
+                 (name
+                  [sizeof(mteTriggerTable_variables_oid) / sizeof(oid) +
+                   2]), newlen, vars) != SNMPERR_SUCCESS) {
+                /*
+                 * XXX: free, zero vars 
+                 */
+                return SNMP_ERR_INCONSISTENTNAME;
+            }
+            vp = vars;
+
+
+            StorageNew = create_mteTriggerTable_data();
+
+            StorageNew->mteOwner = malloc(vp->val_len + 1);
+            memcpy(StorageNew->mteOwner, vp->val.string, vp->val_len);
+            StorageNew->mteOwner[vp->val_len] = '\0';
+            StorageNew->mteOwnerLen = vp->val_len;
+
+            vp = vp->next_variable;
+            StorageNew->mteTriggerName = malloc(vp->val_len + 1);
+            memcpy(StorageNew->mteTriggerName, vp->val.string,
+                   vp->val_len);
+            StorageNew->mteTriggerName[vp->val_len] = '\0';
+            StorageNew->mteTriggerNameLen = vp->val_len;
+
+            vp = vp->next_variable;
+
+            StorageNew->mteTriggerEntryStatus = set_value;
+
+        }
+
+
+        break;
+
+
+
+
+    case FREE:
+        /*
+         * XXX: free, zero vars 
+         */
+        /*
+         * Release any resources that have been allocated 
+         */
+        break;
+
+
+
+
+    case ACTION:
+        /*
+         * The variable has been stored in set_value for you to
+         * use, and you have just been asked to do something with
+         * it.  Note that anything done here must be reversable in
+         * the UNDO case 
+         */
+
+
+        if (StorageTmp == NULL) {
+            /*
+             * row creation, so add it 
+             */
+            if (StorageNew != NULL)
+                mteTriggerTable_add(StorageNew);
+            /*
+             * XXX: ack, and if it is NULL? 
+             */
+        } else if (set_value != RS_DESTROY) {
+            /*
+             * set the flag? 
+             */
+            old_value = StorageTmp->mteTriggerEntryStatus;
+            StorageTmp->mteTriggerEntryStatus = *((long *) var_val);
+        } else {
+            /*
+             * destroy...  extract it for now 
+             */
+            hciptr =
+                header_complex_find_entry(mteTriggerTableStorage,
+                                          StorageTmp);
+            StorageDel =
+                header_complex_extract_entry(&mteTriggerTableStorage,
+                                             hciptr);
+        }
+        break;
+
+
+
+
+    case UNDO:
+        /*
+         * Back out any changes made in the ACTION case 
+         */
+        if (StorageTmp == NULL) {
+            /*
+             * row creation, so remove it again 
+             */
+            hciptr =
+                header_complex_find_entry(mteTriggerTableStorage,
+                                          StorageTmp);
+            StorageDel =
+                header_complex_extract_entry(&mteTriggerTableStorage,
+                                             hciptr);
+            /*
+             * XXX: free it 
+             */
+        } else if (StorageDel != NULL) {
+            /*
+             * row deletion, so add it again 
+             */
+            mteTriggerTable_add(StorageDel);
+        } else {
+            StorageTmp->mteTriggerEntryStatus = old_value;
+        }
+        break;
+
+
+
+
+    case COMMIT:
+        /*
+         * Things are working well, so it's now safe to make the change
+         * permanently.  Make sure that anything done here can't fail! 
+         */
+        if (StorageDel != NULL) {
+            mte_disable_trigger(StorageDel);
+            StorageDel = 0;
+            /*
+             * XXX: free it, its dead 
+             */
+        } else {
+            if (StorageTmp
+                && StorageTmp->mteTriggerEntryStatus == RS_CREATEANDGO) {
+                StorageTmp->mteTriggerEntryStatus = RS_ACTIVE;
+            } else if (StorageTmp &&
+                       StorageTmp->mteTriggerEntryStatus ==
+                       RS_CREATEANDWAIT) {
+                StorageTmp->mteTriggerEntryStatus = RS_NOTINSERVICE;
+            }
+        }
+        if (StorageTmp &&
+            StorageTmp->mteTriggerEntryStatus == RS_ACTIVE &&
+            !StorageTmp->have_copied_auth_info) {
+
+            netsnmp_agent_session *asp =
+                netsnmp_get_current_agent_session();
+            netsnmp_pdu    *pdu = NULL;
+
+            if (!asp) {
+                snmp_log(LOG_ERR,
+                         "snmpTriggerTable: can't get master session for authentication params\n");
+            } else {
+                pdu = asp->orig_pdu;
+                if (!pdu) {
+                    snmp_log(LOG_ERR,
+                             "snmpTriggerTable: can't get master pdu for authentication params\n");
+                }
+            }
+
+            if (pdu) {
+                DEBUGMSGTL(("mteTriggerTest", "copying PDU auth info\n"));
+                StorageTmp->pdu_version = pdu->version;
+                StorageTmp->pdu_securityModel = pdu->securityModel;
+                StorageTmp->pdu_securityLevel = pdu->securityLevel;
+                StorageTmp->pdu_tDomain = pdu->tDomain;
+                StorageTmp->pdu_tDomainLen = pdu->tDomainLen;
+                if (pdu->transport_data != NULL) {
+                    StorageTmp->pdu_transport =
+                        malloc(pdu->transport_data_length);
+                    memcpy(StorageTmp->pdu_transport, pdu->transport_data,
+                           pdu->transport_data_length);
+                }
+                StorageTmp->pdu_transportLen = pdu->transport_data_length;
+                if (pdu->community) {
+                    StorageTmp->pdu_community =
+                        calloc(1, pdu->community_len + 1);
+                    memcpy(StorageTmp->pdu_community, pdu->community,
+                           pdu->community_len);
+                    StorageTmp->pdu_community_len = pdu->community_len;
+                } else {
+                    StorageTmp->pdu_community = NULL;
+                    StorageTmp->pdu_community_len = 0;
+                }
+                if (pdu->securityName) {
+                    StorageTmp->pdu_securityName =
+                        calloc(1, pdu->securityNameLen + 1);
+                    memcpy(StorageTmp->pdu_securityName, pdu->securityName,
+                           pdu->securityNameLen);
+                    StorageTmp->pdu_securityNameLen = pdu->securityNameLen;
+                } else {
+                    StorageTmp->pdu_securityName = NULL;
+                    StorageTmp->pdu_securityNameLen = 0;
+                }
+                StorageTmp->have_copied_auth_info = 1;
+            }
+        }
+
+        if (StorageTmp &&
+            StorageTmp->mteTriggerEnabled == MTETRIGGERENABLED_TRUE &&
+            StorageTmp->mteTriggerEntryStatus == RS_ACTIVE)
+            mte_enable_trigger(StorageTmp);
+        break;
+    }
+    return SNMP_ERR_NOERROR;
+}
+
+/*
+ * send trap 
+ */
+void
+send_mte_trap(struct mteTriggerTable_data *item,
+              oid * trap_oid, size_t trap_oid_len,
+              oid * name_oid, size_t name_oid_len,
+              long *value, const char *objowner, const char *objname,
+              const char *reason)
+{
+    static oid      objid_snmptrap[] = { 1, 3, 6, 1, 6, 3, 1, 1, 4, 1, 0 };     /* snmpTrapIOD.0 */
+
+    netsnmp_variable_list *var_list = NULL;
+
+    /*
+     * snmpTrap oid 
+     */
+    snmp_varlist_add_variable(&var_list, objid_snmptrap,
+                              sizeof(objid_snmptrap) / sizeof(oid),
+                              ASN_OBJECT_ID, (u_char *) trap_oid,
+                              trap_oid_len * sizeof(oid));
+
+    /*
+     * mteHotTrigger 
+     */
+    snmp_varlist_add_variable(&var_list, mteHotTrigger,
+                              sizeof(mteHotTrigger) / sizeof(oid),
+                              ASN_OCTET_STR,
+                              (u_char *) item->mteTriggerName,
+                              item->mteTriggerNameLen);
+
+    /*
+     * mteHotTargetName 
+     */
+    snmp_varlist_add_variable(&var_list, mteHotTargetName, sizeof(mteHotTargetName) / sizeof(oid), ASN_OCTET_STR, (u_char *) item->mteTriggerTargetTag, /*XXX: targetName,not tag */
+                              item->mteTriggerTargetTagLen);    /*XXX */
+
+    /*
+     * mteHotContextName 
+     */
+    snmp_varlist_add_variable(&var_list, mteHotContextName,
+                              sizeof(mteHotContextName) / sizeof(oid),
+                              ASN_OCTET_STR,
+                              (u_char *) item->mteTriggerContextName,
+                              item->mteTriggerContextNameLen);
+
+    snmp_varlist_add_variable(&var_list, mteHotOID,
+                              sizeof(mteHotOID) / sizeof(oid),
+                              ASN_OBJECT_ID, (u_char *) name_oid,
+                              sizeof(oid) * name_oid_len);
+
+    if (trap_oid == mteTriggerFailure || trap_oid == mteEventSetFailure) {
+        /*
+         * mteFailedReason  
+         */
+        snmp_varlist_add_variable(&var_list, mteFailedReason,
+                                  sizeof(mteFailedReason) / sizeof(oid),
+                                  ASN_INTEGER, (u_char *) value,
+                                  sizeof(value));
+    } else {
+        /*
+         * mteHotValue  
+         */
+        snmp_varlist_add_variable(&var_list, mteHotValue,
+                                  sizeof(mteHotValue) / sizeof(oid),
+                                  ASN_INTEGER, (u_char *) value,
+                                  sizeof(value));
+    }
+
+    /*
+     * add in traps from main table 
+     */
+    mte_add_objects(var_list, item, item->mteTriggerObjectsOwner,
+                    item->mteTriggerObjects,
+                    name_oid + item->mteTriggerValueIDLen,
+                    name_oid_len - item->mteTriggerValueIDLen);
+    /*
+     * add in traps from sub table 
+     */
+    mte_add_objects(var_list, item, objowner, objname,
+                    name_oid + item->mteTriggerValueIDLen,
+                    name_oid_len - item->mteTriggerValueIDLen);
+
+    /*
+     * XXX: stuff based on event table 
+     */
+    DEBUGMSGTL(("mteTriggerTest:send_mte_trap", "sending the trap (%s): ",
+                reason));
+    DEBUGMSGOID(("mteTriggerTest:send_mte_trap", name_oid, name_oid_len));
+    DEBUGMSG(("mteTriggerTest:send_mte_trap", " = %ld\n", *value));
+
+    send_v2trap(var_list);
+    snmp_free_varbind(var_list);
+}
+
+void
+last_state_clean(void *data)
+{
+    struct last_state *cleanme = (struct last_state *) data;
+    SNMP_FREE(cleanme->value);
+    SNMP_FREE(cleanme);
+}
+
+/*
+ * retrieves requested info in pdu from the current target 
+ */
+netsnmp_pdu    *
+mte_get_response(struct mteTriggerTable_data *item, netsnmp_pdu *pdu)
+{
+    netsnmp_pdu    *response = NULL;
+    int             status = 0;
+    char            buf[SPRINT_MAX_LEN];
+
+    /*
+     * local agent check 
+     */
+    pdu->errstat = SNMPERR_SUCCESS;
+    pdu->errindex = 0;
+    pdu->version = item->pdu_version;
+    pdu->securityModel = item->pdu_securityModel;
+    pdu->securityLevel = item->pdu_securityLevel;
+    pdu->tDomain = item->pdu_tDomain;
+    pdu->tDomainLen = item->pdu_tDomainLen;
+    memdup((u_char **) & pdu->transport_data, item->pdu_transport,
+           item->pdu_transportLen);
+    pdu->transport_data_length = item->pdu_transportLen;
+    memdup(&pdu->community, item->pdu_community, item->pdu_community_len);
+    pdu->community_len = item->pdu_community_len;
+    memdup((u_char **) & pdu->contextName, item->mteTriggerContextName,
+           item->mteTriggerContextNameLen);
+    pdu->contextNameLen = item->mteTriggerContextNameLen;
+    memdup((u_char **) & pdu->securityName, item->pdu_securityName,
+           item->pdu_securityNameLen);
+    pdu->securityNameLen = item->pdu_securityNameLen;
+    DEBUGMSGTL(("mteTriggerTable",
+                "accessing locally with secName \"%s\" community \"%s\"\n",
+                item->pdu_securityName ? (char *) item->
+                pdu_securityName : "[NIL]",
+                item->pdu_community ? (char *) item->
+                pdu_community : "[NIL]"));
+
+    if (item->mteTriggerTargetTagLen == 0) {
+        /*
+         * send to the local agent 
+         */
+
+        status = snmp_synch_response(mte_callback_sess, pdu, &response);
+
+        if (status != SNMP_ERR_NOERROR ||
+            response->errstat != SNMP_ERR_NOERROR) {
+            /*
+             * xxx 
+             */
+            char           *errstr;
+            snmp_error(mte_callback_sess, 0, 0, &errstr);
+            if (response) {
+                DEBUGMSGTL(("mteTriggerTable",
+                            "Error received: status=%d, sess_error=%s, pduerr=%d/%s, pdu version=%d\n",
+                            status, errstr,
+                            response->errstat,
+                            snmp_api_errstring(response->errstat),
+                            response->version));
+            } else {
+                DEBUGMSGTL(("mteTriggerTable",
+                            "Error received: status=%d, sess_error=%s [no response pointer]\n",
+                            status, errstr));
+            }
+            if (errstr)
+                free(errstr);
+            return NULL;        /* XXX: proper failure, trap sent, etc */
+        }
+    } else {
+        /*
+         * remote target list 
+         */
+        /*
+         * XXX 
+         */
+    }
+    if (response->variables)
+        snprint_variable(buf, sizeof(buf), response->variables->name,
+                         response->variables->name_length,
+                         response->variables);
+    else
+        strcpy(buf, "empty");
+    buf[sizeof(buf) - 1] = '\0';
+    DEBUGMSGTL(("mteTriggerTable", "got a variables: %s\n", buf));
+    return response;
+}
+
+
+/*
+ * Return 1 if `type' is an integer type; specifically, to quote RFC 2981,
+ * p. 13, "anything that ends up encoded for transmission (that is, in BER,
+ * not ASN.1) as an integer".  Return 0 for all other types.  
+ */
+
+int
+mte_is_integer_type(unsigned char type)
+{
+    switch (type) {
+    case ASN_INTEGER:
+    case ASN_COUNTER:
+    case ASN_GAUGE:
+    case ASN_TIMETICKS:
+    case ASN_UINTEGER:
+    case ASN_COUNTER64:
+#ifdef OPAQUE_SPECIAL_TYPES
+    case ASN_OPAQUE_COUNTER64:
+    case ASN_OPAQUE_U64:
+    case ASN_OPAQUE_I64:
+#endif                          /* OPAQUE_SPECIAL_TYPES */
+        return 1;
+    default:
+        return 0;
+    }
+}
+
+
+
+/*
+ * Return 0 if the discontinuity object was checked and no discontinuity has
+ * occurred, 1 if the discontinuity object was checked and a discontinuity
+ * has occurred or -1 if the discontinuity object is not accessible.  
+ */
+
+int
+mte_discontinuity_occurred(struct mteTriggerTable_data *item)
+{
+    netsnmp_pdu    *pdu = NULL, *response = NULL;
+    unsigned long   discoTicks = 0;     /*  cool var name  */
+
+    if (item->mteTriggerDeltaDiscontinuityIDLen == 0 ||
+        (snmp_oid_compare(item->mteTriggerDeltaDiscontinuityID,
+                          item->mteTriggerDeltaDiscontinuityIDLen,
+                          sysUpTimeInstance,
+                          sizeof(sysUpTimeInstance) / sizeof(oid)) == 0)) {
+        DEBUGMSGTL(("mte_disco",
+                    "discoID either zero-length or sysUpTimeInstance\n"));
+    } else {
+        if (item->mteTriggerValueIDWildcard == TV_TRUE) {
+            pdu = snmp_pdu_create(SNMP_MSG_GETNEXT);
+        } else {
+            pdu = snmp_pdu_create(SNMP_MSG_GET);
+        }
+        snmp_add_null_var(pdu, item->mteTriggerDeltaDiscontinuityID,
+                          item->mteTriggerDeltaDiscontinuityIDLen);
+        response = mte_get_response(item, pdu);
+        if (response == NULL) {
+            /*
+             * XXX:  send a mteTriggerFailure notification with the appropriate
+             * error code here.  
+             */
+            /*
+             * "If the object identified is not accessible the sample attempt is in 
+             * error, with the error code as from an SNMP request."  
+             */
+            DEBUGMSGTL(("mte_disco", "failure (auth?) getting discoID\n"));
+            return -1;
+        } else {
+            if (item->mteTriggerDeltaDiscontinuityIDType ==
+                MTETRIGGERDELTADISCONTINUITYIDTYPE_TIMETICKS ||
+                item->mteTriggerDeltaDiscontinuityIDType ==
+                MTETRIGGERDELTADISCONTINUITYIDTYPE_TIMESTAMP) {
+                if (response->errstat == SNMPERR_SUCCESS) {
+                    if (response->variables != NULL &&
+                        response->variables->type == ASN_TIMETICKS) {
+                        DEBUGMSGTL(("mte_disco",
+                                    "got ASN_TIMETICKS-valued variable\n"));
+                        discoTicks =
+                            *((unsigned long *) response->variables->val.
+                              integer);
+                        if (item->prevDiscoTicks != 0) {
+                            if (discoTicks != item->prevDiscoTicks) {
+                                /*
+                                 * Danger Will Robinson: there has been a discontinuity!  
+                                 */
+                                DEBUGMSGTL(("mte_disco",
+                                            "a discontinuity has occurred\n"));
+                                item->prevDiscoTicks = discoTicks;
+                                snmp_free_pdu(response);
+                                return 1;
+                            }
+                        }
+                        item->prevDiscoTicks = discoTicks;
+                    } else {
+                        /*
+                         * XXX: send a mteTriggerFailure notification with the
+                         * appropriate error code here.  
+                         */
+                        if (response->variables != NULL &&
+                            (response->variables->type == SNMP_NOSUCHOBJECT
+                             || response->variables->type ==
+                             SNMP_NOSUCHINSTANCE
+                             || response->variables->type ==
+                             SNMP_ENDOFMIBVIEW)) {
+                            /*
+                             * noSuchName I guess.  
+                             */
+                        } else {
+                            /*
+                             * badType.  
+                             */
+                        }
+                        DEBUGMSGTL(("mte_disco",
+                                    "failure getting discoID\n"));
+                        snmp_free_pdu(response);
+                        return -1;
+                    }
+                } else {
+                    /*
+                     * XXX: send a mteTriggerFailure notification with the appropriate
+                     * error code (just use response->errstat) here.  
+                     */
+                    DEBUGMSGTL(("mte_disco", "failure getting discoID\n"));
+                    snmp_free_pdu(response);
+                    return -1;
+                }
+            } else {
+                /*
+                 * Don't handle dateAndTime type queries yet.  
+                 */
+                DEBUGMSGTL(("mte_disco",
+                            "dateAndTime query UNIMPLEMENTED\n"));
+            }
+            snmp_free_pdu(response);
+        }
+    }
+
+    /*
+     * "...if this object does not point to sysUpTime discontinuity checking
+     * MUST still check sysUpTime for an overall discontinuity."  
+     */
+    if (snmp_oid_compare(item->mteTriggerDeltaDiscontinuityID,
+                         item->mteTriggerDeltaDiscontinuityIDLen,
+                         sysUpTimeInstance,
+                         sizeof(sysUpTimeInstance) / sizeof(oid)) != 0) {
+        DEBUGMSGTL(("mte_disco", "discoID != sysUpTimeInstance\n"));
+        /*
+         * At the moment we only support checking the local system so there's no
+         * point doing anything extra here.  
+         */
+    }
+
+    /*
+     * Well if we got all the way to here, then there has been neither a
+     * discontinuity nor an error.  
+     */
+    DEBUGMSGTL(("mte_disco", "no discontinuity\n"));
+    return 0;
+}
+
+
+void
+mte_run_trigger(unsigned int clientreg, void *clientarg)
+{
+
+    struct mteTriggerTable_data *item =
+        (struct mteTriggerTable_data *) clientarg;
+    netsnmp_pdu    *pdu = NULL, *response = NULL;
+    char            buf[SPRINT_MAX_LEN];
+    int             msg_type = SNMP_MSG_GET, disco;
+
+    oid            *next_oid;
+    size_t          next_oid_len;
+    long           *value, *old_value, x;
+    struct last_state *laststate;
+    char            lastbool = 0, boolresult = 0, lastthresh = 0, senttrap = 0;
+
+    if (!item) {
+        /*
+         * ack 
+         */
+        snmp_alarm_unregister(clientreg);
+        return;
+    }
+    DEBUGMSGTL(("mteTriggertable", "Running trigger for %s/%s\n",
+                item->mteOwner, item->mteTriggerName));
+
+    next_oid = item->mteTriggerValueID;
+    next_oid_len = item->mteTriggerValueIDLen;
+    if (item->mteTriggerValueIDWildcard == TV_TRUE)
+        msg_type = SNMP_MSG_GETNEXT;
+
+    item->hc_storage_old = item->hc_storage;
+    item->hc_storage = NULL;
+    do {
+        pdu = snmp_pdu_create(msg_type);
+        snmp_add_null_var(pdu, next_oid, next_oid_len);
+        response = mte_get_response(item, pdu);
+        if (!response)
+            break;              /* XXX: proper failure */
+
+        if (item->mteTriggerValueIDWildcard == TV_TRUE &&
+            ((response->variables->type >= SNMP_NOSUCHOBJECT &&
+              response->variables->type <= SNMP_ENDOFMIBVIEW) ||
+             snmp_oid_compare(item->mteTriggerValueID,
+                              item->mteTriggerValueIDLen,
+                              response->variables->name,
+                              item->mteTriggerValueIDLen) != 0)) {
+            DEBUGMSGTL(("mteTriggerTable",
+                        "DONE, last varbind processed\n"));
+            snmp_free_pdu(response);
+            break;
+        }
+
+        /*
+         * shorter pointers 
+         */
+        next_oid = response->variables->name;
+        next_oid_len = response->variables->name_length;
+
+        /*
+         * Send a "bad type" notification if the type of the target object is 
+         * non-INTEGER and the test type is either `boolean' or `threshold'
+         * (which want to do arithmetic).  
+         */
+        if (((item->mteTriggerTest[0] & MTETRIGGERTEST_BOOLEAN) ||
+             (item->mteTriggerTest[0] & MTETRIGGERTEST_THRESHOLD)) &&
+            response->errstat == SNMPERR_SUCCESS &&
+            !mte_is_integer_type(response->variables->type)) {
+            long            failure = MTE_FAILURE_BADTYPE;
+            send_mte_trap(item, mteTriggerFailure,
+                          sizeof(mteTriggerFailure) / sizeof(oid),
+                          next_oid, next_oid_len, &failure,
+                          NULL, NULL, "failure: bad type");
+            snmp_free_pdu(response);
+            /*
+             * RFC2981, p.15: "If the value syntax of those objects
+             * [returned by a getNext-style match] is not usable, that
+             * results in a `badType' error THAT TERMINATES THE SCAN."
+             * (my emphasis).  
+             */
+            break;
+        }
+
+        /*
+         * Clone the value.  XXX: What happens if it's an unsigned type? Or a
+         * 64-bit type, or an OCTET STRING for the sake of argument.  Do
+         * everything in 64-bit arithmetic perhaps?  Generate "bad type"
+         * notifications for non-INTEGER cases (except for existence).  
+         */
+        if (response->errstat == SNMPERR_SUCCESS &&
+            response->variables->val.integer)
+            memdup((unsigned char **) &value,
+                   (unsigned char *) response->variables->val.integer,
+                   sizeof(*response->variables->val.integer));
+        else
+            value = NULL;
+
+        snprint_variable(buf, sizeof(buf),
+                         next_oid, next_oid_len, response->variables);
+        buf[sizeof(buf) - 1] = '\0';
+        DEBUGMSGTL(("mteTriggerTable", "received %s (type %d)\n", buf,
+                    response->variables->type));
+
+        /*
+         * see if we have old values for this 
+         */
+        laststate = header_complex_get_from_oid(item->hc_storage_old,
+                                                next_oid, next_oid_len);
+        if (laststate) {
+            old_value = laststate->value;
+            lastbool = laststate->lastbool;
+            lastthresh = laststate->lastthreshold;
+        } else {
+            old_value = NULL;
+            lastthresh = MTE_THRESHOLD_BEGIN;
+        }
+
+        /*
+         * deal with existence tests 
+         */
+        if (item->mteTriggerTest[0] & MTETRIGGERTEST_EXISTENCE) {
+            if ((item->mteTriggerExistenceTest[0] &
+                 MTETRIGGEREXISTENCETEST_PRESENT)
+                && value && !old_value &&
+                (item->started ||
+                 (item->mteTriggerExistenceStartup[0] &
+                  MTETRIGGEREXISTENCESTARTUP_PRESENT))) {
+                /*
+                 * XXX: if mteTriggerExistenceTest is not "present", for
+                 * example, and then turned on when has been previously
+                 * off, do we respect the value of the last known
+                 * existence status? 
+                 */
+                send_mte_trap(item, mteTriggerFired,
+                              sizeof(mteTriggerFired) / sizeof(oid),
+                              next_oid, next_oid_len,
+                              value, item->mteTriggerExistenceObjectsOwner,
+                              item->mteTriggerExistenceObjects,
+                              "existence: present");
+                run_mte_events(item, next_oid, next_oid_len,
+                               item->mteTriggerExistenceEventOwner,
+                               item->mteTriggerExistenceEvent);
+                senttrap = 1;
+            }
+
+            if ((item->mteTriggerExistenceTest[0] &
+                 MTETRIGGEREXISTENCETEST_CHANGED)
+                && value && old_value && *old_value != *value) {
+                /*
+                 * XXX: if mteTriggerExistenceTest is not "present", for
+                 * example, and then turned on when has been previously
+                 * off, do we respect the value of the last known
+                 * existence status? 
+                 */
+                send_mte_trap(item, mteTriggerFired,
+                              sizeof(mteTriggerFired) / sizeof(oid),
+                              next_oid, next_oid_len,
+                              value, item->mteTriggerExistenceObjectsOwner,
+                              item->mteTriggerExistenceObjects,
+                              "existence: changed");
+                run_mte_events(item, next_oid, next_oid_len,
+                               item->mteTriggerExistenceEventOwner,
+                               item->mteTriggerExistenceEvent);
+                senttrap = 1;
+            }
+        }
+
+        /*
+         * Deal with boolean tests.  
+         */
+        if ((item->mteTriggerTest[0] & MTETRIGGERTEST_BOOLEAN) &&
+            ((item->mteTriggerSampleType ==
+              MTETRIGGERSAMPLETYPE_ABSOLUTEVALUE && value)
+             || (item->mteTriggerSampleType ==
+                 MTETRIGGERSAMPLETYPE_DELTAVALUE && value && old_value))) {
+            if (item->mteTriggerSampleType ==
+                MTETRIGGERSAMPLETYPE_DELTAVALUE) {
+                /*
+                 * XXX: Must check the discontinuity OID here.  
+                 */
+                disco = mte_discontinuity_occurred(item);
+                if (disco == -1) {
+                    /*
+                     * An error notification has already been sent; just bail
+                     * out now.  
+                     */
+                    /*
+                     * XXX: should save values here?  
+                     */
+                    return;
+                } else if (disco == 1) {
+                    /*
+                     * A discontinuity has occurred; the right thing to do here
+                     * depends on the exact type.  FOR NOW, assume long.  
+                     */
+                    x = *((long *) value) + (INT_MAX -
+                                             *((long *) old_value));
+                } else {
+                    x = *((long *) value) - *((long *) old_value);
+                }
+            } else {
+                x = *((long *) value);
+            }
+
+            switch (item->mteTriggerBooleanComparison) {
+            case MTETRIGGERBOOLEANCOMPARISON_UNEQUAL:
+                boolresult = (x != item->mteTriggerBooleanValue);
+                break;
+
+            case MTETRIGGERBOOLEANCOMPARISON_EQUAL:
+                boolresult = (x == item->mteTriggerBooleanValue);
+                break;
+
+            case MTETRIGGERBOOLEANCOMPARISON_LESS:
+                boolresult = (x < item->mteTriggerBooleanValue);
+                break;
+
+            case MTETRIGGERBOOLEANCOMPARISON_LESSOREQUAL:
+                boolresult = (x <= item->mteTriggerBooleanValue);
+                break;
+
+            case MTETRIGGERBOOLEANCOMPARISON_GREATER:
+                boolresult = (x > item->mteTriggerBooleanValue);
+                break;
+
+            case MTETRIGGERBOOLEANCOMPARISON_GREATEROREQUAL:
+                boolresult = (x >= item->mteTriggerBooleanValue);
+                break;
+
+            default:
+                snmp_log(LOG_WARNING,
+                         "illegal value in mteTriggerBooleanComparison object: %d",
+                         item->mteTriggerBooleanComparison);
+                boolresult = item->lastboolresult;      /* to fail next test */
+            }
+
+            if (boolresult &&
+                ((item->mteTriggerBooleanStartup ==
+                  MTETRIGGERBOOLEANSTARTUP_TRUE
+                  && lastbool == -1) || lastbool != boolresult)) {
+                send_mte_trap(item, mteTriggerFired,
+                              sizeof(mteTriggerFired) / sizeof(oid),
+                              next_oid, next_oid_len,
+                              &x, item->mteTriggerBooleanObjectsOwner,
+                              item->mteTriggerBooleanObjects,
+                              "boolean: true");
+                run_mte_events(item, next_oid, next_oid_len,
+                               item->mteTriggerBooleanEventOwner,
+                               item->mteTriggerBooleanEvent);
+                senttrap = 1;
+            }
+
+            DEBUGMSGTL(("mteTriggerTable",
+                        "value: %d %ld %lu x: %d %ld %lu\n", *value,
+                        *value, *value, x, x, x));
+
+            DEBUGMSGTL(("mteTriggerTable",
+                        "boolean result: x=%d %s configured=%d = %d\n",
+                        x,
+                        se_find_label_in_slist("mteBooleanOperators",
+                                               item->
+                                               mteTriggerBooleanComparison),
+                        item->mteTriggerBooleanValue, boolresult));
+        }
+
+        /*
+         * Deal with threshold tests.  XXX: doesn't handle "delta-type"
+         * sampling.  
+         */
+        if ((item->mteTriggerTest[0] & MTETRIGGERTEST_THRESHOLD) &&
+            ((item->mteTriggerSampleType ==
+              MTETRIGGERSAMPLETYPE_ABSOLUTEVALUE && value)
+             || (item->mteTriggerSampleType ==
+                 MTETRIGGERSAMPLETYPE_DELTAVALUE && value && old_value))) {
+            /*
+             * XXX: correct intepretation of mteTriggerThresholdStartup? 
+             */
+            /*
+             * only fires when passed and just set to active?  What
+             * about a newly discovered node that is past a
+             * threshold once we've been active for a turn at least? 
+             */
+            /*
+             * XXX: Check notions of > vs >= 
+             */
+            if (((item->started == MTE_STARTED && laststate &&
+                  lastthresh == MTE_THRESHOLD_LOW) ||
+                 (item->started != MTE_STARTED &&
+                  (item->mteTriggerThresholdStartup ==
+                   MTETRIGGERTHRESHOLDSTARTUP_RISING
+                   || item->mteTriggerThresholdStartup ==
+                   MTETRIGGERTHRESHOLDSTARTUP_RISINGORFALLING)))
+                && (*value >= item->mteTriggerThresholdRising)) {
+                send_mte_trap(item, mteTriggerRising,
+                              sizeof(mteTriggerRising) / sizeof(oid),
+                              next_oid, next_oid_len, value,
+                              item->mteTriggerThresholdObjectsOwner,
+                              item->mteTriggerThresholdObjects,
+                              "threshold: rising");
+                run_mte_events(item, next_oid, next_oid_len,
+                               item->mteTriggerThresholdRisingEventOwner,
+                               item->mteTriggerThresholdRisingEvent);
+                senttrap = 1;
+            }
+            if (((item->started == MTE_STARTED && laststate &&
+                  lastthresh == MTE_THRESHOLD_HIGH) ||
+                 (item->started != MTE_STARTED &&
+                  (item->mteTriggerThresholdStartup ==
+                   MTETRIGGERTHRESHOLDSTARTUP_FALLING
+                   || item->mteTriggerThresholdStartup ==
+                   MTETRIGGERTHRESHOLDSTARTUP_RISINGORFALLING)))
+                && (*value <= item->mteTriggerThresholdFalling)) {
+                send_mte_trap(item, mteTriggerFalling,
+                              sizeof(mteTriggerFalling) / sizeof(oid),
+                              next_oid, next_oid_len, value,
+                              item->mteTriggerThresholdObjectsOwner,
+                              item->mteTriggerThresholdObjects,
+                              "threshold: falling");
+                run_mte_events(item, next_oid, next_oid_len,
+                               item->mteTriggerThresholdFallingEventOwner,
+                               item->mteTriggerThresholdFallingEvent);
+                senttrap = 1;
+            }
+
+        }
+
+        if (value) {
+            struct last_state *new_last_state =
+                SNMP_MALLOC_STRUCT(last_state);
+            new_last_state->value = value;
+            new_last_state->lastbool = boolresult;
+            header_complex_add_data_by_oid(&item->hc_storage, next_oid,
+                                           next_oid_len, new_last_state);
+
+            /*
+             * set our notion of the current known threshold state 
+             */
+            if (lastthresh == MTE_THRESHOLD_LOW &&
+                *value >= item->mteTriggerThresholdRising &&
+                *value > item->mteTriggerThresholdFalling)
+                new_last_state->lastthreshold = MTE_THRESHOLD_HIGH;
+            else if (lastthresh == MTE_THRESHOLD_HIGH &&
+                     *value < item->mteTriggerThresholdRising &&
+                     *value <= item->mteTriggerThresholdFalling)
+                new_last_state->lastthreshold = MTE_THRESHOLD_LOW;
+            else if (lastthresh == MTE_THRESHOLD_BEGIN) {
+                if (*value >= item->mteTriggerThresholdRising)
+                    new_last_state->lastthreshold = MTE_THRESHOLD_HIGH;
+                else if (*value <= item->mteTriggerThresholdFalling)
+                    new_last_state->lastthreshold = MTE_THRESHOLD_LOW;
+                /*
+                 * XXX: else???  in between?  undefined? 
+                 */
+            } else {
+                new_last_state->lastthreshold = lastthresh;
+            }
+        }
+
+        /*
+         * extract from old hc storage 
+         */
+        if (laststate) {
+            header_complex_extract_entry(&item->hc_storage_old,
+                                         header_complex_find_entry(item->
+                                                                   hc_storage_old,
+                                                                   (void *)
+                                                                   laststate));
+            last_state_clean(laststate);
+        }
+
+        /*
+         * We are now done with the response PDU.  
+         */
+        if (senttrap) 
+            senttrap = 0;
+        else
+            snmp_free_pdu(response);
+    } while (item->mteTriggerValueIDWildcard == TV_TRUE);
+
+    /*
+     * loop through old values for DNE cases 
+     */
+    if (item->mteTriggerExistenceTest[0] & MTETRIGGEREXISTENCETEST_ABSENT) {
+
+        struct header_complex_index *iter;
+
+        /*
+         * XXX: broken 
+         */
+        if ((item->mteTriggerExistenceStartup[0] &
+             MTETRIGGEREXISTENCESTARTUP_ABSENT)) {
+            /*
+             * XXX: send trap that nothing was found? 
+             */
+            /*
+             * only if !wild? (see mib)
+             */
+        }
+        for (iter = item->hc_storage_old; iter; iter = iter->next) {
+            laststate = (struct last_state *) iter->data;
+            send_mte_trap(item, mteTriggerFired,
+                          sizeof(mteTriggerFired) / sizeof(oid),
+                          iter->name, iter->namelen, laststate->value,
+                          item->mteTriggerExistenceObjectsOwner,
+                          item->mteTriggerExistenceObjects,
+                          "existence: absent");
+        }
+        header_complex_free_all(item->hc_storage_old, last_state_clean);
+        item->hc_storage_old = NULL;
+    }
+
+    item->started = MTE_STARTED;
+}
+
+
+/*
+ * handling routines 
+ */
+void
+mte_enable_trigger(struct mteTriggerTable_data *item)
+{
+    if (!item)
+        return;
+
+    if (item->alarmreg)
+        snmp_alarm_unregister(item->alarmreg);
+
+    if (item->mteTriggerFrequency > 0) {
+        DEBUGMSGTL(("mteTriggertable", "Enabling trigger for %s/%s @ %u\n",
+                    item->mteOwner, item->mteTriggerName,
+                    item->mteTriggerFrequency));
+        item->alarmreg =
+            snmp_alarm_register(item->mteTriggerFrequency, SA_REPEAT,
+                                mte_run_trigger, item);
+    }
+}
+
+void
+mte_disable_trigger(struct mteTriggerTable_data *item)
+{
+    if (!item)
+        return;
+
+    if (item->alarmreg) {
+        DEBUGMSGTL(("mteTriggertable", "Disabling trigger for %s/%s\n",
+                    item->mteOwner, item->mteTriggerName));
+        snmp_alarm_unregister(item->alarmreg);
+        item->alarmreg = 0;
+    }
+    item->started = MTE_NOTSTARTED;
+}
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/disman/mteTriggerTable.h tomato121/release/src/router/snmp/agent/mibgroup/disman/mteTriggerTable.h
--- tomato/release/src/router/snmp/agent/mibgroup/disman/mteTriggerTable.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/disman/mteTriggerTable.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,249 @@
+/*
+ * This file was generated by mib2c and is intended for use as a mib module
+ * for the ucd-snmp snmpd agent. 
+ */
+
+
+#ifndef _MIBGROUP_MTETRIGGERTABLE_H
+#define _MIBGROUP_MTETRIGGERTABLE_H
+
+
+/*
+ * we may use header_complex from the header_complex module 
+ */
+
+
+config_require(header_complex)
+
+    /*
+     * our storage structure(s) 
+     */
+     struct mteTriggerTable_data {
+
+
+         char           *mteOwner;
+         size_t          mteOwnerLen;
+         char           *mteTriggerName;
+         size_t          mteTriggerNameLen;
+         char           *mteTriggerComment;
+         size_t          mteTriggerCommentLen;
+         char           *mteTriggerTest;
+         size_t          mteTriggerTestLen;
+         long            mteTriggerSampleType;
+         oid            *mteTriggerValueID;
+         size_t          mteTriggerValueIDLen;
+         long            mteTriggerValueIDWildcard;
+         char           *mteTriggerTargetTag;
+         size_t          mteTriggerTargetTagLen;
+         char           *mteTriggerContextName;
+         size_t          mteTriggerContextNameLen;
+         long            mteTriggerContextNameWildcard;
+         unsigned long   mteTriggerFrequency;
+         char           *mteTriggerObjectsOwner;
+         size_t          mteTriggerObjectsOwnerLen;
+         char           *mteTriggerObjects;
+         size_t          mteTriggerObjectsLen;
+         long            mteTriggerEnabled;
+         long            mteTriggerEntryStatus;
+
+         /*
+          * delta table 
+          */
+         oid            *mteTriggerDeltaDiscontinuityID;
+         size_t          mteTriggerDeltaDiscontinuityIDLen;
+         long            mteTriggerDeltaDiscontinuityIDWildcard;
+         long            mteTriggerDeltaDiscontinuityIDType;
+         unsigned long   prevDiscoTicks;
+         unsigned long   prevUptimeTicks;
+
+         /*
+          * existence table 
+          */
+         char           *mteTriggerExistenceTest;
+         size_t          mteTriggerExistenceTestLen;
+         char           *mteTriggerExistenceStartup;
+         size_t          mteTriggerExistenceStartupLen;
+         char           *mteTriggerExistenceObjectsOwner;
+         size_t          mteTriggerExistenceObjectsOwnerLen;
+         char           *mteTriggerExistenceObjects;
+         size_t          mteTriggerExistenceObjectsLen;
+         char           *mteTriggerExistenceEventOwner;
+         size_t          mteTriggerExistenceEventOwnerLen;
+         char           *mteTriggerExistenceEvent;
+         size_t          mteTriggerExistenceEventLen;
+
+         /*
+          * boolean table 
+          */
+         long            mteTriggerBooleanComparison;
+         long            mteTriggerBooleanValue;
+         long            mteTriggerBooleanStartup;
+         char           *mteTriggerBooleanObjectsOwner;
+         size_t          mteTriggerBooleanObjectsOwnerLen;
+         char           *mteTriggerBooleanObjects;
+         size_t          mteTriggerBooleanObjectsLen;
+         char           *mteTriggerBooleanEventOwner;
+         size_t          mteTriggerBooleanEventOwnerLen;
+         char           *mteTriggerBooleanEvent;
+         size_t          mteTriggerBooleanEventLen;
+
+         /*
+          * threshold table 
+          */
+         long            mteTriggerThresholdStartup;
+         long            mteTriggerThresholdRising;
+         long            mteTriggerThresholdFalling;
+         long            mteTriggerThresholdDeltaRising;
+         long            mteTriggerThresholdDeltaFalling;
+         char           *mteTriggerThresholdObjectsOwner;
+         size_t          mteTriggerThresholdObjectsOwnerLen;
+         char           *mteTriggerThresholdObjects;
+         size_t          mteTriggerThresholdObjectsLen;
+         char           *mteTriggerThresholdRisingEventOwner;
+         size_t          mteTriggerThresholdRisingEventOwnerLen;
+         char           *mteTriggerThresholdRisingEvent;
+         size_t          mteTriggerThresholdRisingEventLen;
+         char           *mteTriggerThresholdFallingEventOwner;
+         size_t          mteTriggerThresholdFallingEventOwnerLen;
+         char           *mteTriggerThresholdFallingEvent;
+         size_t          mteTriggerThresholdFallingEventLen;
+         char           *mteTriggerThresholdDeltaRisingEventOwner;
+         size_t          mteTriggerThresholdDeltaRisingEventOwnerLen;
+         char           *mteTriggerThresholdDeltaRisingEvent;
+         size_t          mteTriggerThresholdDeltaRisingEventLen;
+         char           *mteTriggerThresholdDeltaFallingEventOwner;
+         size_t          mteTriggerThresholdDeltaFallingEventOwnerLen;
+         char           *mteTriggerThresholdDeltaFallingEvent;
+         size_t          mteTriggerThresholdDeltaFallingEventLen;
+
+         /*
+          * internal variables 
+          */
+         int             storageType;
+         unsigned int    alarmreg;
+         int             lastboolresult;
+         int             started;
+         long            lastvalue;
+         struct header_complex_index *hc_storage, *hc_storage_old;
+         unsigned long   threshold_state;
+
+         /*
+          * pdu auth contents 
+          */
+         long            have_copied_auth_info;
+         long            pdu_version;
+         long            pdu_securityModel;
+         long            pdu_securityLevel;
+         void           *pdu_transport;
+         size_t          pdu_transportLen;
+         const oid      *pdu_tDomain;
+         size_t          pdu_tDomainLen;
+         u_char         *pdu_community;
+         size_t          pdu_community_len;
+         char           *pdu_contextName;
+         size_t          pdu_contextNameLen;
+         char           *pdu_securityName;
+         size_t          pdu_securityNameLen;
+     };
+
+     struct last_state {
+         long           *value;
+         char            lastbool;
+         char            lastthreshold;
+     };
+
+
+/*
+ * enum definitions from the covered mib sections 
+ */
+
+
+
+
+
+
+
+#define MTETRIGGERTEST_EXISTENCE                 0x80
+#define MTETRIGGERTEST_BOOLEAN                   0x40
+#define MTETRIGGERTEST_THRESHOLD                 0x20
+
+#define MTETRIGGERSAMPLETYPE_ABSOLUTEVALUE       1
+#define MTETRIGGERSAMPLETYPE_DELTAVALUE          2
+
+
+/*
+ * What's wrong with using the regular TruthValue definitions TV_TRUE 
+ * and TV_FALSE (snmp-tc.h) which are up to 77% shorter?  
+ */
+
+#define MTETRIGGERVALUEIDWILDCARD_TRUE           1
+#define MTETRIGGERVALUEIDWILDCARD_FALSE          2
+
+
+
+#define MTETRIGGERCONTEXTNAMEWILDCARD_TRUE       1
+#define MTETRIGGERCONTEXTNAMEWILDCARD_FALSE      2
+
+
+
+
+#define MTETRIGGERENABLED_TRUE                   1
+#define MTETRIGGERENABLED_FALSE                  2
+
+#define MTE_NOTSTARTED 0
+#define MTE_STARTED 1
+
+#define MTE_THRESHOLD_BEGIN  0
+#define MTE_THRESHOLD_HIGH   1
+#define MTE_THRESHOLD_LOW    2
+
+/*
+ * Just the first (MTE-specific) groups of errors defined here;
+ * others are numerically equal to the regular SNMP errors.  
+ */
+
+#define MTE_FAILURE_LOCALRESOURCELACK		-1
+#define MTE_FAILURE_BADDESTINATION		-2
+#define MTE_FAILURE_DESTINATIONUNREACHABLE	-3
+#define MTE_FAILURE_NORESPONSE			-4
+#define MTE_FAILURE_BADTYPE			-5
+#define MTE_FAILURE_SAMPLEOVERRUN		-6
+
+
+/*
+ * function prototypes 
+ */
+
+
+     void            init_mteTriggerTable(void);
+     FindVarMethod   var_mteTriggerTable;
+     void            parse_mteTriggerTable(const char *, char *);
+     void            parse_simple_monitor(const char *, char *);
+     void            parse_default_monitors(const char *, char *);
+     SNMPCallback    store_mteTriggerTable;
+     netsnmp_pdu    *mte_get_response(struct mteTriggerTable_data *,
+                                      netsnmp_pdu *);
+
+
+     WriteMethod     write_mteTriggerComment;
+     WriteMethod     write_mteTriggerTest;
+     WriteMethod     write_mteTriggerSampleType;
+     WriteMethod     write_mteTriggerValueID;
+     WriteMethod     write_mteTriggerValueIDWildcard;
+     WriteMethod     write_mteTriggerTargetTag;
+     WriteMethod     write_mteTriggerContextName;
+     WriteMethod     write_mteTriggerContextNameWildcard;
+     WriteMethod     write_mteTriggerFrequency;
+     WriteMethod     write_mteTriggerObjectsOwner;
+     WriteMethod     write_mteTriggerObjects;
+     WriteMethod     write_mteTriggerEnabled;
+     WriteMethod     write_mteTriggerEntryStatus;
+
+     WriteMethod     write_mteTriggerEntryStatus;
+
+     void            mte_enable_trigger(struct mteTriggerTable_data *item);
+     void            mte_disable_trigger(struct mteTriggerTable_data
+                                         *item);
+     SNMPAlarmCallback mte_run_trigger;
+
+#endif                          /* _MIBGROUP_MTETRIGGERTABLE_H */
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/disman/mteTriggerThresholdTable.c tomato121/release/src/router/snmp/agent/mibgroup/disman/mteTriggerThresholdTable.c
--- tomato/release/src/router/snmp/agent/mibgroup/disman/mteTriggerThresholdTable.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/disman/mteTriggerThresholdTable.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,1611 @@
+/*
+ * This file was generated by mib2c and is intended for use as
+ * a mib module for the ucd-snmp snmpd agent. 
+ */
+
+
+/*
+ * This should always be included first before anything else 
+ */
+#include <net-snmp/net-snmp-config.h>
+#if HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#if HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+
+
+/*
+ * minimal include directives 
+ */
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+#include "header_complex.h"
+#include "mteTriggerThresholdTable.h"
+#include "mteTriggerTable.h"
+
+
+/*
+ * mteTriggerThresholdTable_variables_oid:
+ *   this is the top level oid that we want to register under.  This
+ *   is essentially a prefix, with the suffix appearing in the
+ *   variable below.
+ */
+
+
+oid             mteTriggerThresholdTable_variables_oid[] =
+    { 1, 3, 6, 1, 2, 1, 88, 1, 2, 6 };
+
+
+/*
+ * variable2 mteTriggerThresholdTable_variables:
+ *   this variable defines function callbacks and type return information 
+ *   for the mteTriggerThresholdTable mib section 
+ */
+
+
+struct variable2 mteTriggerThresholdTable_variables[] = {
+    /*
+     * magic number        , variable type , ro/rw , callback fn  , L, oidsuffix 
+     */
+#define   MTETRIGGERTHRESHOLDSTARTUP  3
+    {MTETRIGGERTHRESHOLDSTARTUP, ASN_INTEGER, RWRITE,
+     var_mteTriggerThresholdTable, 2, {1, 1}},
+#define   MTETRIGGERTHRESHOLDRISING  4
+    {MTETRIGGERTHRESHOLDRISING, ASN_INTEGER, RWRITE,
+     var_mteTriggerThresholdTable, 2, {1, 2}},
+#define   MTETRIGGERTHRESHOLDFALLING  5
+    {MTETRIGGERTHRESHOLDFALLING, ASN_INTEGER, RWRITE,
+     var_mteTriggerThresholdTable, 2, {1, 3}},
+#define   MTETRIGGERTHRESHOLDDELTARISING  6
+    {MTETRIGGERTHRESHOLDDELTARISING, ASN_INTEGER, RWRITE,
+     var_mteTriggerThresholdTable, 2, {1, 4}},
+#define   MTETRIGGERTHRESHOLDDELTAFALLING  7
+    {MTETRIGGERTHRESHOLDDELTAFALLING, ASN_INTEGER, RWRITE,
+     var_mteTriggerThresholdTable, 2, {1, 5}},
+#define   MTETRIGGERTHRESHOLDOBJECTSOWNER  8
+    {MTETRIGGERTHRESHOLDOBJECTSOWNER, ASN_OCTET_STR, RWRITE,
+     var_mteTriggerThresholdTable, 2, {1, 6}},
+#define   MTETRIGGERTHRESHOLDOBJECTS  9
+    {MTETRIGGERTHRESHOLDOBJECTS, ASN_OCTET_STR, RWRITE,
+     var_mteTriggerThresholdTable, 2, {1, 7}},
+#define   MTETRIGGERTHRESHOLDRISINGEVENTOWNER  10
+    {MTETRIGGERTHRESHOLDRISINGEVENTOWNER, ASN_OCTET_STR, RWRITE,
+     var_mteTriggerThresholdTable, 2, {1, 8}},
+#define   MTETRIGGERTHRESHOLDRISINGEVENT  11
+    {MTETRIGGERTHRESHOLDRISINGEVENT, ASN_OCTET_STR, RWRITE,
+     var_mteTriggerThresholdTable, 2, {1, 9}},
+#define   MTETRIGGERTHRESHOLDFALLINGEVENTOWNER  12
+    {MTETRIGGERTHRESHOLDFALLINGEVENTOWNER, ASN_OCTET_STR, RWRITE,
+     var_mteTriggerThresholdTable, 2, {1, 10}},
+#define   MTETRIGGERTHRESHOLDFALLINGEVENT  13
+    {MTETRIGGERTHRESHOLDFALLINGEVENT, ASN_OCTET_STR, RWRITE,
+     var_mteTriggerThresholdTable, 2, {1, 11}},
+#define   MTETRIGGERTHRESHOLDDELTARISINGEVENTOWNER  14
+    {MTETRIGGERTHRESHOLDDELTARISINGEVENTOWNER, ASN_OCTET_STR, RWRITE,
+     var_mteTriggerThresholdTable, 2, {1, 12}},
+#define   MTETRIGGERTHRESHOLDDELTARISINGEVENT  15
+    {MTETRIGGERTHRESHOLDDELTARISINGEVENT, ASN_OCTET_STR, RWRITE,
+     var_mteTriggerThresholdTable, 2, {1, 13}},
+#define   MTETRIGGERTHRESHOLDDELTAFALLINGEVENTOWNER  16
+    {MTETRIGGERTHRESHOLDDELTAFALLINGEVENTOWNER, ASN_OCTET_STR, RWRITE,
+     var_mteTriggerThresholdTable, 2, {1, 14}},
+#define   MTETRIGGERTHRESHOLDDELTAFALLINGEVENT  17
+    {MTETRIGGERTHRESHOLDDELTAFALLINGEVENT, ASN_OCTET_STR, RWRITE,
+     var_mteTriggerThresholdTable, 2, {1, 15}},
+
+};
+/*
+ * (L = length of the oidsuffix) 
+ */
+
+
+/*
+ * global storage of our data, saved in and configured by header_complex() 
+ */
+extern struct header_complex_index *mteTriggerTableStorage;
+
+
+/*
+ * init_mteTriggerThresholdTable():
+ *   Initialization routine.  This is called when the agent starts up.
+ *   At a minimum, registration of your variables should take place here.
+ */
+void
+init_mteTriggerThresholdTable(void)
+{
+    DEBUGMSGTL(("mteTriggerThresholdTable", "initializing...  "));
+
+
+    /*
+     * register ourselves with the agent to handle our mib tree 
+     */
+    REGISTER_MIB("mteTriggerThresholdTable",
+                 mteTriggerThresholdTable_variables, variable2,
+                 mteTriggerThresholdTable_variables_oid);
+
+
+    DEBUGMSGTL(("mteTriggerThresholdTable", "done.\n"));
+}
+
+/*
+ * var_mteTriggerThresholdTable():
+ *   Handle this table separately from the scalar value case.
+ *   The workings of this are basically the same as for var_mteTriggerThresholdTable above.
+ */
+unsigned char  *
+var_mteTriggerThresholdTable(struct variable *vp,
+                             oid * name,
+                             size_t * length,
+                             int exact,
+                             size_t * var_len, WriteMethod ** write_method)
+{
+
+
+    struct mteTriggerTable_data *StorageTmp = NULL;
+
+
+    DEBUGMSGTL(("mteTriggerThresholdTable",
+                "var_mteTriggerThresholdTable: Entering...  \n"));
+    /*
+     * this assumes you have registered all your data properly
+     */
+    if ((StorageTmp =
+         header_complex(mteTriggerTableStorage, vp, name, length, exact,
+                        var_len, write_method)) == NULL)
+        return NULL;
+
+
+    if (!(StorageTmp->mteTriggerTest[0] & MTETRIGGERTEST_THRESHOLD))
+        return NULL;
+
+    /*
+     * this is where we do the value assignments for the mib results.
+     */
+    switch (vp->magic) {
+
+
+    case MTETRIGGERTHRESHOLDSTARTUP:
+        *write_method = write_mteTriggerThresholdStartup;
+        *var_len = sizeof(StorageTmp->mteTriggerThresholdStartup);
+        return (u_char *) & StorageTmp->mteTriggerThresholdStartup;
+
+    case MTETRIGGERTHRESHOLDRISING:
+        *write_method = write_mteTriggerThresholdRising;
+        *var_len = sizeof(StorageTmp->mteTriggerThresholdRising);
+        return (u_char *) & StorageTmp->mteTriggerThresholdRising;
+
+    case MTETRIGGERTHRESHOLDFALLING:
+        *write_method = write_mteTriggerThresholdFalling;
+        *var_len = sizeof(StorageTmp->mteTriggerThresholdFalling);
+        return (u_char *) & StorageTmp->mteTriggerThresholdFalling;
+
+    case MTETRIGGERTHRESHOLDDELTARISING:
+        *write_method = write_mteTriggerThresholdDeltaRising;
+        *var_len = sizeof(StorageTmp->mteTriggerThresholdDeltaRising);
+        return (u_char *) & StorageTmp->mteTriggerThresholdDeltaRising;
+
+    case MTETRIGGERTHRESHOLDDELTAFALLING:
+        *write_method = write_mteTriggerThresholdDeltaFalling;
+        *var_len = sizeof(StorageTmp->mteTriggerThresholdDeltaFalling);
+        return (u_char *) & StorageTmp->mteTriggerThresholdDeltaFalling;
+
+    case MTETRIGGERTHRESHOLDOBJECTSOWNER:
+        *write_method = write_mteTriggerThresholdObjectsOwner;
+        *var_len = StorageTmp->mteTriggerThresholdObjectsOwnerLen;
+        return (u_char *) StorageTmp->mteTriggerThresholdObjectsOwner;
+
+    case MTETRIGGERTHRESHOLDOBJECTS:
+        *write_method = write_mteTriggerThresholdObjects;
+        *var_len = StorageTmp->mteTriggerThresholdObjectsLen;
+        return (u_char *) StorageTmp->mteTriggerThresholdObjects;
+
+    case MTETRIGGERTHRESHOLDRISINGEVENTOWNER:
+        *write_method = write_mteTriggerThresholdRisingEventOwner;
+        *var_len = StorageTmp->mteTriggerThresholdRisingEventOwnerLen;
+        return (u_char *) StorageTmp->mteTriggerThresholdRisingEventOwner;
+
+    case MTETRIGGERTHRESHOLDRISINGEVENT:
+        *write_method = write_mteTriggerThresholdRisingEvent;
+        *var_len = StorageTmp->mteTriggerThresholdRisingEventLen;
+        return (u_char *) StorageTmp->mteTriggerThresholdRisingEvent;
+
+    case MTETRIGGERTHRESHOLDFALLINGEVENTOWNER:
+        *write_method = write_mteTriggerThresholdFallingEventOwner;
+        *var_len = StorageTmp->mteTriggerThresholdFallingEventOwnerLen;
+        return (u_char *) StorageTmp->mteTriggerThresholdFallingEventOwner;
+
+    case MTETRIGGERTHRESHOLDFALLINGEVENT:
+        *write_method = write_mteTriggerThresholdFallingEvent;
+        *var_len = StorageTmp->mteTriggerThresholdFallingEventLen;
+        return (u_char *) StorageTmp->mteTriggerThresholdFallingEvent;
+
+    case MTETRIGGERTHRESHOLDDELTARISINGEVENTOWNER:
+        *write_method = write_mteTriggerThresholdDeltaRisingEventOwner;
+        *var_len = StorageTmp->mteTriggerThresholdDeltaRisingEventOwnerLen;
+        return (u_char *) StorageTmp->
+            mteTriggerThresholdDeltaRisingEventOwner;
+
+    case MTETRIGGERTHRESHOLDDELTARISINGEVENT:
+        *write_method = write_mteTriggerThresholdDeltaRisingEvent;
+        *var_len = StorageTmp->mteTriggerThresholdDeltaRisingEventLen;
+        return (u_char *) StorageTmp->mteTriggerThresholdDeltaRisingEvent;
+
+    case MTETRIGGERTHRESHOLDDELTAFALLINGEVENTOWNER:
+        *write_method = write_mteTriggerThresholdDeltaFallingEventOwner;
+        *var_len =
+            StorageTmp->mteTriggerThresholdDeltaFallingEventOwnerLen;
+        return (u_char *) StorageTmp->
+            mteTriggerThresholdDeltaFallingEventOwner;
+
+    case MTETRIGGERTHRESHOLDDELTAFALLINGEVENT:
+        *write_method = write_mteTriggerThresholdDeltaFallingEvent;
+        *var_len = StorageTmp->mteTriggerThresholdDeltaFallingEventLen;
+        return (u_char *) StorageTmp->mteTriggerThresholdDeltaFallingEvent;
+
+
+    default:
+        ERROR_MSG("");
+    }
+    return NULL;
+}
+
+
+
+
+int
+write_mteTriggerThresholdStartup(int action,
+                                 u_char * var_val,
+                                 u_char var_val_type,
+                                 size_t var_val_len,
+                                 u_char * statP,
+                                 oid * name, size_t name_len)
+{
+    static int      tmpvar;
+    struct mteTriggerTable_data *StorageTmp = NULL;
+    size_t          newlen =
+        name_len -
+        (sizeof(mteTriggerThresholdTable_variables_oid) / sizeof(oid) + 3 -
+         1);
+
+
+    DEBUGMSGTL(("mteTriggerThresholdTable",
+                "write_mteTriggerThresholdStartup entering action=%d...  \n",
+                action));
+    if ((StorageTmp =
+         header_complex(mteTriggerTableStorage, NULL,
+                        &name[sizeof
+                              (mteTriggerThresholdTable_variables_oid) /
+                              sizeof(oid) + 3 - 1], &newlen, 1, NULL,
+                        NULL)) == NULL)
+        return SNMP_ERR_NOSUCHNAME;     /* remove if you support creation here */
+
+
+    switch (action) {
+    case RESERVE1:
+        if (var_val_type != ASN_INTEGER) {
+            fprintf(stderr,
+                    "write to mteTriggerThresholdStartup not ASN_INTEGER\n");
+            return SNMP_ERR_WRONGTYPE;
+        }
+        if (StorageTmp->storageType != ST_NONVOLATILE)
+            return SNMP_ERR_NOTWRITABLE;
+        break;
+
+
+    case RESERVE2:
+        /*
+         * memory reseveration, final preparation... 
+         */
+        break;
+
+
+    case FREE:
+        /*
+         * Release any resources that have been allocated 
+         */
+        break;
+
+
+    case ACTION:
+        /*
+         * The variable has been stored in long_ret for
+         * you to use, and you have just been asked to do something with
+         * it.  Note that anything done here must be reversable in the UNDO case 
+         */
+        tmpvar = StorageTmp->mteTriggerThresholdStartup;
+        StorageTmp->mteTriggerThresholdStartup = *((long *) var_val);
+        break;
+
+
+    case UNDO:
+        /*
+         * Back out any changes made in the ACTION case 
+         */
+        StorageTmp->mteTriggerThresholdStartup = tmpvar;
+        break;
+
+
+    case COMMIT:
+        /*
+         * Things are working well, so it's now safe to make the change
+         * permanently.  Make sure that anything done here can't fail! 
+         */
+
+        break;
+    }
+    return SNMP_ERR_NOERROR;
+}
+
+
+
+int
+write_mteTriggerThresholdRising(int action,
+                                u_char * var_val,
+                                u_char var_val_type,
+                                size_t var_val_len,
+                                u_char * statP,
+                                oid * name, size_t name_len)
+{
+    static int      tmpvar;
+    struct mteTriggerTable_data *StorageTmp = NULL;
+    size_t          newlen =
+        name_len -
+        (sizeof(mteTriggerThresholdTable_variables_oid) / sizeof(oid) + 3 -
+         1);
+
+
+    DEBUGMSGTL(("mteTriggerThresholdTable",
+                "write_mteTriggerThresholdRising entering action=%d...  \n",
+                action));
+    if ((StorageTmp =
+         header_complex(mteTriggerTableStorage, NULL,
+                        &name[sizeof
+                              (mteTriggerThresholdTable_variables_oid) /
+                              sizeof(oid) + 3 - 1], &newlen, 1, NULL,
+                        NULL)) == NULL)
+        return SNMP_ERR_NOSUCHNAME;     /* remove if you support creation here */
+
+
+    switch (action) {
+    case RESERVE1:
+        if (var_val_type != ASN_INTEGER) {
+            fprintf(stderr,
+                    "write to mteTriggerThresholdRising not ASN_INTEGER\n");
+            return SNMP_ERR_WRONGTYPE;
+        }
+        if (StorageTmp->storageType != ST_NONVOLATILE)
+            return SNMP_ERR_NOTWRITABLE;
+        break;
+
+
+    case RESERVE2:
+        /*
+         * memory reseveration, final preparation... 
+         */
+        break;
+
+
+    case FREE:
+        /*
+         * Release any resources that have been allocated 
+         */
+        break;
+
+
+    case ACTION:
+        /*
+         * The variable has been stored in long_ret for
+         * you to use, and you have just been asked to do something with
+         * it.  Note that anything done here must be reversable in the UNDO case 
+         */
+        tmpvar = StorageTmp->mteTriggerThresholdRising;
+        StorageTmp->mteTriggerThresholdRising = *((long *) var_val);
+        break;
+
+
+    case UNDO:
+        /*
+         * Back out any changes made in the ACTION case 
+         */
+        StorageTmp->mteTriggerThresholdRising = tmpvar;
+        break;
+
+
+    case COMMIT:
+        /*
+         * Things are working well, so it's now safe to make the change
+         * permanently.  Make sure that anything done here can't fail! 
+         */
+
+        break;
+    }
+    return SNMP_ERR_NOERROR;
+}
+
+
+
+int
+write_mteTriggerThresholdFalling(int action,
+                                 u_char * var_val,
+                                 u_char var_val_type,
+                                 size_t var_val_len,
+                                 u_char * statP,
+                                 oid * name, size_t name_len)
+{
+    static int      tmpvar;
+    struct mteTriggerTable_data *StorageTmp = NULL;
+    size_t          newlen =
+        name_len -
+        (sizeof(mteTriggerThresholdTable_variables_oid) / sizeof(oid) + 3 -
+         1);
+
+
+    DEBUGMSGTL(("mteTriggerThresholdTable",
+                "write_mteTriggerThresholdFalling entering action=%d...  \n",
+                action));
+    if ((StorageTmp =
+         header_complex(mteTriggerTableStorage, NULL,
+                        &name[sizeof
+                              (mteTriggerThresholdTable_variables_oid) /
+                              sizeof(oid) + 3 - 1], &newlen, 1, NULL,
+                        NULL)) == NULL)
+        return SNMP_ERR_NOSUCHNAME;     /* remove if you support creation here */
+
+
+    switch (action) {
+    case RESERVE1:
+        if (var_val_type != ASN_INTEGER) {
+            fprintf(stderr,
+                    "write to mteTriggerThresholdFalling not ASN_INTEGER\n");
+            return SNMP_ERR_WRONGTYPE;
+        }
+        if (StorageTmp->storageType != ST_NONVOLATILE)
+            return SNMP_ERR_NOTWRITABLE;
+        break;
+
+
+    case RESERVE2:
+        /*
+         * memory reseveration, final preparation... 
+         */
+        break;
+
+
+    case FREE:
+        /*
+         * Release any resources that have been allocated 
+         */
+        break;
+
+
+    case ACTION:
+        /*
+         * The variable has been stored in long_ret for
+         * you to use, and you have just been asked to do something with
+         * it.  Note that anything done here must be reversable in the UNDO case 
+         */
+        tmpvar = StorageTmp->mteTriggerThresholdFalling;
+        StorageTmp->mteTriggerThresholdFalling = *((long *) var_val);
+        break;
+
+
+    case UNDO:
+        /*
+         * Back out any changes made in the ACTION case 
+         */
+        StorageTmp->mteTriggerThresholdFalling = tmpvar;
+        break;
+
+
+    case COMMIT:
+        /*
+         * Things are working well, so it's now safe to make the change
+         * permanently.  Make sure that anything done here can't fail! 
+         */
+
+        break;
+    }
+    return SNMP_ERR_NOERROR;
+}
+
+
+
+int
+write_mteTriggerThresholdDeltaRising(int action,
+                                     u_char * var_val,
+                                     u_char var_val_type,
+                                     size_t var_val_len,
+                                     u_char * statP,
+                                     oid * name, size_t name_len)
+{
+    static int      tmpvar;
+    struct mteTriggerTable_data *StorageTmp = NULL;
+    size_t          newlen =
+        name_len -
+        (sizeof(mteTriggerThresholdTable_variables_oid) / sizeof(oid) + 3 -
+         1);
+
+
+    DEBUGMSGTL(("mteTriggerThresholdTable",
+                "write_mteTriggerThresholdDeltaRising entering action=%d...  \n",
+                action));
+    if ((StorageTmp =
+         header_complex(mteTriggerTableStorage, NULL,
+                        &name[sizeof
+                              (mteTriggerThresholdTable_variables_oid) /
+                              sizeof(oid) + 3 - 1], &newlen, 1, NULL,
+                        NULL)) == NULL)
+        return SNMP_ERR_NOSUCHNAME;     /* remove if you support creation here */
+
+
+    switch (action) {
+    case RESERVE1:
+        if (var_val_type != ASN_INTEGER) {
+            fprintf(stderr,
+                    "write to mteTriggerThresholdDeltaRising not ASN_INTEGER\n");
+            return SNMP_ERR_WRONGTYPE;
+        }
+        if (StorageTmp->storageType != ST_NONVOLATILE)
+            return SNMP_ERR_NOTWRITABLE;
+        break;
+
+
+    case RESERVE2:
+        /*
+         * memory reseveration, final preparation... 
+         */
+        break;
+
+
+    case FREE:
+        /*
+         * Release any resources that have been allocated 
+         */
+        break;
+
+
+    case ACTION:
+        /*
+         * The variable has been stored in long_ret for
+         * you to use, and you have just been asked to do something with
+         * it.  Note that anything done here must be reversable in the UNDO case 
+         */
+        tmpvar = StorageTmp->mteTriggerThresholdDeltaRising;
+        StorageTmp->mteTriggerThresholdDeltaRising = *((long *) var_val);
+        break;
+
+
+    case UNDO:
+        /*
+         * Back out any changes made in the ACTION case 
+         */
+        StorageTmp->mteTriggerThresholdDeltaRising = tmpvar;
+        break;
+
+
+    case COMMIT:
+        /*
+         * Things are working well, so it's now safe to make the change
+         * permanently.  Make sure that anything done here can't fail! 
+         */
+
+        break;
+    }
+    return SNMP_ERR_NOERROR;
+}
+
+
+
+int
+write_mteTriggerThresholdDeltaFalling(int action,
+                                      u_char * var_val,
+                                      u_char var_val_type,
+                                      size_t var_val_len,
+                                      u_char * statP,
+                                      oid * name, size_t name_len)
+{
+    static int      tmpvar;
+    struct mteTriggerTable_data *StorageTmp = NULL;
+    size_t          newlen =
+        name_len -
+        (sizeof(mteTriggerThresholdTable_variables_oid) / sizeof(oid) + 3 -
+         1);
+
+
+    DEBUGMSGTL(("mteTriggerThresholdTable",
+                "write_mteTriggerThresholdDeltaFalling entering action=%d...  \n",
+                action));
+    if ((StorageTmp =
+         header_complex(mteTriggerTableStorage, NULL,
+                        &name[sizeof
+                              (mteTriggerThresholdTable_variables_oid) /
+                              sizeof(oid) + 3 - 1], &newlen, 1, NULL,
+                        NULL)) == NULL)
+        return SNMP_ERR_NOSUCHNAME;     /* remove if you support creation here */
+
+
+    switch (action) {
+    case RESERVE1:
+        if (var_val_type != ASN_INTEGER) {
+            fprintf(stderr,
+                    "write to mteTriggerThresholdDeltaFalling not ASN_INTEGER\n");
+            return SNMP_ERR_WRONGTYPE;
+        }
+        if (StorageTmp->storageType != ST_NONVOLATILE)
+            return SNMP_ERR_NOTWRITABLE;
+        break;
+
+
+    case RESERVE2:
+        /*
+         * memory reseveration, final preparation... 
+         */
+        break;
+
+
+    case FREE:
+        /*
+         * Release any resources that have been allocated 
+         */
+        break;
+
+
+    case ACTION:
+        /*
+         * The variable has been stored in long_ret for
+         * you to use, and you have just been asked to do something with
+         * it.  Note that anything done here must be reversable in the UNDO case 
+         */
+        tmpvar = StorageTmp->mteTriggerThresholdDeltaFalling;
+        StorageTmp->mteTriggerThresholdDeltaFalling = *((long *) var_val);
+        break;
+
+
+    case UNDO:
+        /*
+         * Back out any changes made in the ACTION case 
+         */
+        StorageTmp->mteTriggerThresholdDeltaFalling = tmpvar;
+        break;
+
+
+    case COMMIT:
+        /*
+         * Things are working well, so it's now safe to make the change
+         * permanently.  Make sure that anything done here can't fail! 
+         */
+
+        break;
+    }
+    return SNMP_ERR_NOERROR;
+}
+
+
+
+int
+write_mteTriggerThresholdObjectsOwner(int action,
+                                      u_char * var_val,
+                                      u_char var_val_type,
+                                      size_t var_val_len,
+                                      u_char * statP,
+                                      oid * name, size_t name_len)
+{
+    static char    *tmpvar;
+    struct mteTriggerTable_data *StorageTmp = NULL;
+    static size_t   tmplen;
+    size_t          newlen =
+        name_len -
+        (sizeof(mteTriggerThresholdTable_variables_oid) / sizeof(oid) + 3 -
+         1);
+
+
+    DEBUGMSGTL(("mteTriggerThresholdTable",
+                "write_mteTriggerThresholdObjectsOwner entering action=%d...  \n",
+                action));
+    if ((StorageTmp =
+         header_complex(mteTriggerTableStorage, NULL,
+                        &name[sizeof
+                              (mteTriggerThresholdTable_variables_oid) /
+                              sizeof(oid) + 3 - 1], &newlen, 1, NULL,
+                        NULL)) == NULL)
+        return SNMP_ERR_NOSUCHNAME;     /* remove if you support creation here */
+
+
+    switch (action) {
+    case RESERVE1:
+        if (var_val_type != ASN_OCTET_STR) {
+            fprintf(stderr,
+                    "write to mteTriggerThresholdObjectsOwner not ASN_OCTET_STR\n");
+            return SNMP_ERR_WRONGTYPE;
+        }
+        if (StorageTmp->storageType != ST_NONVOLATILE)
+            return SNMP_ERR_NOTWRITABLE;
+        break;
+
+
+    case RESERVE2:
+        /*
+         * memory reseveration, final preparation... 
+         */
+        break;
+
+
+    case FREE:
+        /*
+         * Release any resources that have been allocated 
+         */
+        break;
+
+
+    case ACTION:
+        /*
+         * The variable has been stored in string for
+         * you to use, and you have just been asked to do something with
+         * it.  Note that anything done here must be reversable in the UNDO case 
+         */
+        tmpvar = StorageTmp->mteTriggerThresholdObjectsOwner;
+        tmplen = StorageTmp->mteTriggerThresholdObjectsOwnerLen;
+        memdup((u_char **) & StorageTmp->mteTriggerThresholdObjectsOwner,
+               var_val, var_val_len);
+        StorageTmp->mteTriggerThresholdObjectsOwnerLen = var_val_len;
+        break;
+
+
+    case UNDO:
+        /*
+         * Back out any changes made in the ACTION case 
+         */
+        SNMP_FREE(StorageTmp->mteTriggerThresholdObjectsOwner);
+        StorageTmp->mteTriggerThresholdObjectsOwner = tmpvar;
+        StorageTmp->mteTriggerThresholdObjectsOwnerLen = tmplen;
+        break;
+
+
+    case COMMIT:
+        /*
+         * Things are working well, so it's now safe to make the change
+         * permanently.  Make sure that anything done here can't fail! 
+         */
+        SNMP_FREE(tmpvar);
+        break;
+    }
+    return SNMP_ERR_NOERROR;
+}
+
+
+
+int
+write_mteTriggerThresholdObjects(int action,
+                                 u_char * var_val,
+                                 u_char var_val_type,
+                                 size_t var_val_len,
+                                 u_char * statP,
+                                 oid * name, size_t name_len)
+{
+    static char    *tmpvar;
+    struct mteTriggerTable_data *StorageTmp = NULL;
+    static size_t   tmplen;
+    size_t          newlen =
+        name_len -
+        (sizeof(mteTriggerThresholdTable_variables_oid) / sizeof(oid) + 3 -
+         1);
+
+
+    DEBUGMSGTL(("mteTriggerThresholdTable",
+                "write_mteTriggerThresholdObjects entering action=%d...  \n",
+                action));
+    if ((StorageTmp =
+         header_complex(mteTriggerTableStorage, NULL,
+                        &name[sizeof
+                              (mteTriggerThresholdTable_variables_oid) /
+                              sizeof(oid) + 3 - 1], &newlen, 1, NULL,
+                        NULL)) == NULL)
+        return SNMP_ERR_NOSUCHNAME;     /* remove if you support creation here */
+
+
+    switch (action) {
+    case RESERVE1:
+        if (var_val_type != ASN_OCTET_STR) {
+            fprintf(stderr,
+                    "write to mteTriggerThresholdObjects not ASN_OCTET_STR\n");
+            return SNMP_ERR_WRONGTYPE;
+        }
+        if (StorageTmp->storageType != ST_NONVOLATILE)
+            return SNMP_ERR_NOTWRITABLE;
+        break;
+
+
+    case RESERVE2:
+        /*
+         * memory reseveration, final preparation... 
+         */
+        break;
+
+
+    case FREE:
+        /*
+         * Release any resources that have been allocated 
+         */
+        break;
+
+
+    case ACTION:
+        /*
+         * The variable has been stored in string for
+         * you to use, and you have just been asked to do something with
+         * it.  Note that anything done here must be reversable in the UNDO case 
+         */
+        tmpvar = StorageTmp->mteTriggerThresholdObjects;
+        tmplen = StorageTmp->mteTriggerThresholdObjectsLen;
+        memdup((u_char **) & StorageTmp->mteTriggerThresholdObjects,
+               var_val, var_val_len);
+        StorageTmp->mteTriggerThresholdObjectsLen = var_val_len;
+        break;
+
+
+    case UNDO:
+        /*
+         * Back out any changes made in the ACTION case 
+         */
+        SNMP_FREE(StorageTmp->mteTriggerThresholdObjects);
+        StorageTmp->mteTriggerThresholdObjects = tmpvar;
+        StorageTmp->mteTriggerThresholdObjectsLen = tmplen;
+        break;
+
+
+    case COMMIT:
+        /*
+         * Things are working well, so it's now safe to make the change
+         * permanently.  Make sure that anything done here can't fail! 
+         */
+        SNMP_FREE(tmpvar);
+        break;
+    }
+    return SNMP_ERR_NOERROR;
+}
+
+
+
+int
+write_mteTriggerThresholdRisingEventOwner(int action,
+                                          u_char * var_val,
+                                          u_char var_val_type,
+                                          size_t var_val_len,
+                                          u_char * statP,
+                                          oid * name, size_t name_len)
+{
+    static char    *tmpvar;
+    struct mteTriggerTable_data *StorageTmp = NULL;
+    static size_t   tmplen;
+    size_t          newlen =
+        name_len -
+        (sizeof(mteTriggerThresholdTable_variables_oid) / sizeof(oid) + 3 -
+         1);
+
+
+    DEBUGMSGTL(("mteTriggerThresholdTable",
+                "write_mteTriggerThresholdRisingEventOwner entering action=%d...  \n",
+                action));
+    if ((StorageTmp =
+         header_complex(mteTriggerTableStorage, NULL,
+                        &name[sizeof
+                              (mteTriggerThresholdTable_variables_oid) /
+                              sizeof(oid) + 3 - 1], &newlen, 1, NULL,
+                        NULL)) == NULL)
+        return SNMP_ERR_NOSUCHNAME;     /* remove if you support creation here */
+
+
+    switch (action) {
+    case RESERVE1:
+        if (var_val_type != ASN_OCTET_STR) {
+            fprintf(stderr,
+                    "write to mteTriggerThresholdRisingEventOwner not ASN_OCTET_STR\n");
+            return SNMP_ERR_WRONGTYPE;
+        }
+        if (StorageTmp->storageType != ST_NONVOLATILE)
+            return SNMP_ERR_NOTWRITABLE;
+        break;
+
+
+    case RESERVE2:
+        /*
+         * memory reseveration, final preparation... 
+         */
+        break;
+
+
+    case FREE:
+        /*
+         * Release any resources that have been allocated 
+         */
+        break;
+
+
+    case ACTION:
+        /*
+         * The variable has been stored in string for
+         * you to use, and you have just been asked to do something with
+         * it.  Note that anything done here must be reversable in the UNDO case 
+         */
+        tmpvar = StorageTmp->mteTriggerThresholdRisingEventOwner;
+        tmplen = StorageTmp->mteTriggerThresholdRisingEventOwnerLen;
+        memdup((u_char **) & StorageTmp->
+               mteTriggerThresholdRisingEventOwner, var_val, var_val_len);
+        StorageTmp->mteTriggerThresholdRisingEventOwnerLen = var_val_len;
+        break;
+
+
+    case UNDO:
+        /*
+         * Back out any changes made in the ACTION case 
+         */
+        SNMP_FREE(StorageTmp->mteTriggerThresholdRisingEventOwner);
+        StorageTmp->mteTriggerThresholdRisingEventOwner = tmpvar;
+        StorageTmp->mteTriggerThresholdRisingEventOwnerLen = tmplen;
+        break;
+
+
+    case COMMIT:
+        /*
+         * Things are working well, so it's now safe to make the change
+         * permanently.  Make sure that anything done here can't fail! 
+         */
+        SNMP_FREE(tmpvar);
+        break;
+    }
+    return SNMP_ERR_NOERROR;
+}
+
+
+
+int
+write_mteTriggerThresholdRisingEvent(int action,
+                                     u_char * var_val,
+                                     u_char var_val_type,
+                                     size_t var_val_len,
+                                     u_char * statP,
+                                     oid * name, size_t name_len)
+{
+    static char    *tmpvar;
+    struct mteTriggerTable_data *StorageTmp = NULL;
+    static size_t   tmplen;
+    size_t          newlen =
+        name_len -
+        (sizeof(mteTriggerThresholdTable_variables_oid) / sizeof(oid) + 3 -
+         1);
+
+
+    DEBUGMSGTL(("mteTriggerThresholdTable",
+                "write_mteTriggerThresholdRisingEvent entering action=%d...  \n",
+                action));
+    if ((StorageTmp =
+         header_complex(mteTriggerTableStorage, NULL,
+                        &name[sizeof
+                              (mteTriggerThresholdTable_variables_oid) /
+                              sizeof(oid) + 3 - 1], &newlen, 1, NULL,
+                        NULL)) == NULL)
+        return SNMP_ERR_NOSUCHNAME;     /* remove if you support creation here */
+
+
+    switch (action) {
+    case RESERVE1:
+        if (var_val_type != ASN_OCTET_STR) {
+            fprintf(stderr,
+                    "write to mteTriggerThresholdRisingEvent not ASN_OCTET_STR\n");
+            return SNMP_ERR_WRONGTYPE;
+        }
+        if (StorageTmp->storageType != ST_NONVOLATILE)
+            return SNMP_ERR_NOTWRITABLE;
+        break;
+
+
+    case RESERVE2:
+        /*
+         * memory reseveration, final preparation... 
+         */
+        break;
+
+
+    case FREE:
+        /*
+         * Release any resources that have been allocated 
+         */
+        break;
+
+
+    case ACTION:
+        /*
+         * The variable has been stored in string for
+         * you to use, and you have just been asked to do something with
+         * it.  Note that anything done here must be reversable in the UNDO case 
+         */
+        tmpvar = StorageTmp->mteTriggerThresholdRisingEvent;
+        tmplen = StorageTmp->mteTriggerThresholdRisingEventLen;
+        memdup((u_char **) & StorageTmp->mteTriggerThresholdRisingEvent,
+               var_val, var_val_len);
+        StorageTmp->mteTriggerThresholdRisingEventLen = var_val_len;
+        break;
+
+
+    case UNDO:
+        /*
+         * Back out any changes made in the ACTION case 
+         */
+        SNMP_FREE(StorageTmp->mteTriggerThresholdRisingEvent);
+        StorageTmp->mteTriggerThresholdRisingEvent = tmpvar;
+        StorageTmp->mteTriggerThresholdRisingEventLen = tmplen;
+        break;
+
+
+    case COMMIT:
+        /*
+         * Things are working well, so it's now safe to make the change
+         * permanently.  Make sure that anything done here can't fail! 
+         */
+        SNMP_FREE(tmpvar);
+        break;
+    }
+    return SNMP_ERR_NOERROR;
+}
+
+
+
+int
+write_mteTriggerThresholdFallingEventOwner(int action,
+                                           u_char * var_val,
+                                           u_char var_val_type,
+                                           size_t var_val_len,
+                                           u_char * statP,
+                                           oid * name, size_t name_len)
+{
+    static char    *tmpvar;
+    struct mteTriggerTable_data *StorageTmp = NULL;
+    static size_t   tmplen;
+    size_t          newlen =
+        name_len -
+        (sizeof(mteTriggerThresholdTable_variables_oid) / sizeof(oid) + 3 -
+         1);
+
+
+    DEBUGMSGTL(("mteTriggerThresholdTable",
+                "write_mteTriggerThresholdFallingEventOwner entering action=%d...  \n",
+                action));
+    if ((StorageTmp =
+         header_complex(mteTriggerTableStorage, NULL,
+                        &name[sizeof
+                              (mteTriggerThresholdTable_variables_oid) /
+                              sizeof(oid) + 3 - 1], &newlen, 1, NULL,
+                        NULL)) == NULL)
+        return SNMP_ERR_NOSUCHNAME;     /* remove if you support creation here */
+
+
+    switch (action) {
+    case RESERVE1:
+        if (var_val_type != ASN_OCTET_STR) {
+            fprintf(stderr,
+                    "write to mteTriggerThresholdFallingEventOwner not ASN_OCTET_STR\n");
+            return SNMP_ERR_WRONGTYPE;
+        }
+        if (StorageTmp->storageType != ST_NONVOLATILE)
+            return SNMP_ERR_NOTWRITABLE;
+        break;
+
+
+    case RESERVE2:
+        /*
+         * memory reseveration, final preparation... 
+         */
+        break;
+
+
+    case FREE:
+        /*
+         * Release any resources that have been allocated 
+         */
+        break;
+
+
+    case ACTION:
+        /*
+         * The variable has been stored in string for
+         * you to use, and you have just been asked to do something with
+         * it.  Note that anything done here must be reversable in the UNDO case 
+         */
+        tmpvar = StorageTmp->mteTriggerThresholdFallingEventOwner;
+        tmplen = StorageTmp->mteTriggerThresholdFallingEventOwnerLen;
+        memdup((u_char **) & StorageTmp->
+               mteTriggerThresholdFallingEventOwner, var_val, var_val_len);
+        StorageTmp->mteTriggerThresholdFallingEventOwnerLen = var_val_len;
+        break;
+
+
+    case UNDO:
+        /*
+         * Back out any changes made in the ACTION case 
+         */
+        SNMP_FREE(StorageTmp->mteTriggerThresholdFallingEventOwner);
+        StorageTmp->mteTriggerThresholdFallingEventOwner = tmpvar;
+        StorageTmp->mteTriggerThresholdFallingEventOwnerLen = tmplen;
+        break;
+
+
+    case COMMIT:
+        /*
+         * Things are working well, so it's now safe to make the change
+         * permanently.  Make sure that anything done here can't fail! 
+         */
+        SNMP_FREE(tmpvar);
+        break;
+    }
+    return SNMP_ERR_NOERROR;
+}
+
+
+
+int
+write_mteTriggerThresholdFallingEvent(int action,
+                                      u_char * var_val,
+                                      u_char var_val_type,
+                                      size_t var_val_len,
+                                      u_char * statP,
+                                      oid * name, size_t name_len)
+{
+    static char    *tmpvar;
+    struct mteTriggerTable_data *StorageTmp = NULL;
+    static size_t   tmplen;
+    size_t          newlen =
+        name_len -
+        (sizeof(mteTriggerThresholdTable_variables_oid) / sizeof(oid) + 3 -
+         1);
+
+
+    DEBUGMSGTL(("mteTriggerThresholdTable",
+                "write_mteTriggerThresholdFallingEvent entering action=%d...  \n",
+                action));
+    if ((StorageTmp =
+         header_complex(mteTriggerTableStorage, NULL,
+                        &name[sizeof
+                              (mteTriggerThresholdTable_variables_oid) /
+                              sizeof(oid) + 3 - 1], &newlen, 1, NULL,
+                        NULL)) == NULL)
+        return SNMP_ERR_NOSUCHNAME;     /* remove if you support creation here */
+
+
+    switch (action) {
+    case RESERVE1:
+        if (var_val_type != ASN_OCTET_STR) {
+            fprintf(stderr,
+                    "write to mteTriggerThresholdFallingEvent not ASN_OCTET_STR\n");
+            return SNMP_ERR_WRONGTYPE;
+        }
+        if (StorageTmp->storageType != ST_NONVOLATILE)
+            return SNMP_ERR_NOTWRITABLE;
+        break;
+
+
+    case RESERVE2:
+        /*
+         * memory reseveration, final preparation... 
+         */
+        break;
+
+
+    case FREE:
+        /*
+         * Release any resources that have been allocated 
+         */
+        break;
+
+
+    case ACTION:
+        /*
+         * The variable has been stored in string for
+         * you to use, and you have just been asked to do something with
+         * it.  Note that anything done here must be reversable in the UNDO case 
+         */
+        tmpvar = StorageTmp->mteTriggerThresholdFallingEvent;
+        tmplen = StorageTmp->mteTriggerThresholdFallingEventLen;
+        memdup((u_char **) & StorageTmp->mteTriggerThresholdFallingEvent,
+               var_val, var_val_len);
+        StorageTmp->mteTriggerThresholdFallingEventLen = var_val_len;
+        break;
+
+
+    case UNDO:
+        /*
+         * Back out any changes made in the ACTION case 
+         */
+        SNMP_FREE(StorageTmp->mteTriggerThresholdFallingEvent);
+        StorageTmp->mteTriggerThresholdFallingEvent = tmpvar;
+        StorageTmp->mteTriggerThresholdFallingEventLen = tmplen;
+        break;
+
+
+    case COMMIT:
+        /*
+         * Things are working well, so it's now safe to make the change
+         * permanently.  Make sure that anything done here can't fail! 
+         */
+        SNMP_FREE(tmpvar);
+        break;
+    }
+    return SNMP_ERR_NOERROR;
+}
+
+
+
+int
+write_mteTriggerThresholdDeltaRisingEventOwner(int action,
+                                               u_char * var_val,
+                                               u_char var_val_type,
+                                               size_t var_val_len,
+                                               u_char * statP,
+                                               oid * name, size_t name_len)
+{
+    static char    *tmpvar;
+    struct mteTriggerTable_data *StorageTmp = NULL;
+    static size_t   tmplen;
+    size_t          newlen =
+        name_len -
+        (sizeof(mteTriggerThresholdTable_variables_oid) / sizeof(oid) + 3 -
+         1);
+
+
+    DEBUGMSGTL(("mteTriggerThresholdTable",
+                "write_mteTriggerThresholdDeltaRisingEventOwner entering action=%d...  \n",
+                action));
+    if ((StorageTmp =
+         header_complex(mteTriggerTableStorage, NULL,
+                        &name[sizeof
+                              (mteTriggerThresholdTable_variables_oid) /
+                              sizeof(oid) + 3 - 1], &newlen, 1, NULL,
+                        NULL)) == NULL)
+        return SNMP_ERR_NOSUCHNAME;     /* remove if you support creation here */
+
+
+    switch (action) {
+    case RESERVE1:
+        if (var_val_type != ASN_OCTET_STR) {
+            fprintf(stderr,
+                    "write to mteTriggerThresholdDeltaRisingEventOwner not ASN_OCTET_STR\n");
+            return SNMP_ERR_WRONGTYPE;
+        }
+        if (StorageTmp->storageType != ST_NONVOLATILE)
+            return SNMP_ERR_NOTWRITABLE;
+        break;
+
+
+    case RESERVE2:
+        /*
+         * memory reseveration, final preparation... 
+         */
+        break;
+
+
+    case FREE:
+        /*
+         * Release any resources that have been allocated 
+         */
+        break;
+
+
+    case ACTION:
+        /*
+         * The variable has been stored in string for
+         * you to use, and you have just been asked to do something with
+         * it.  Note that anything done here must be reversable in the UNDO case 
+         */
+        tmpvar = StorageTmp->mteTriggerThresholdDeltaRisingEventOwner;
+        tmplen = StorageTmp->mteTriggerThresholdDeltaRisingEventOwnerLen;
+        memdup((u_char **) & StorageTmp->
+               mteTriggerThresholdDeltaRisingEventOwner, var_val,
+               var_val_len);
+        StorageTmp->mteTriggerThresholdDeltaRisingEventOwnerLen =
+            var_val_len;
+        break;
+
+
+    case UNDO:
+        /*
+         * Back out any changes made in the ACTION case 
+         */
+        SNMP_FREE(StorageTmp->mteTriggerThresholdDeltaRisingEventOwner);
+        StorageTmp->mteTriggerThresholdDeltaRisingEventOwner = tmpvar;
+        StorageTmp->mteTriggerThresholdDeltaRisingEventOwnerLen = tmplen;
+        break;
+
+
+    case COMMIT:
+        /*
+         * Things are working well, so it's now safe to make the change
+         * permanently.  Make sure that anything done here can't fail! 
+         */
+        SNMP_FREE(tmpvar);
+        break;
+    }
+    return SNMP_ERR_NOERROR;
+}
+
+
+
+int
+write_mteTriggerThresholdDeltaRisingEvent(int action,
+                                          u_char * var_val,
+                                          u_char var_val_type,
+                                          size_t var_val_len,
+                                          u_char * statP,
+                                          oid * name, size_t name_len)
+{
+    static char    *tmpvar;
+    struct mteTriggerTable_data *StorageTmp = NULL;
+    static size_t   tmplen;
+    size_t          newlen =
+        name_len -
+        (sizeof(mteTriggerThresholdTable_variables_oid) / sizeof(oid) + 3 -
+         1);
+
+
+    DEBUGMSGTL(("mteTriggerThresholdTable",
+                "write_mteTriggerThresholdDeltaRisingEvent entering action=%d...  \n",
+                action));
+    if ((StorageTmp =
+         header_complex(mteTriggerTableStorage, NULL,
+                        &name[sizeof
+                              (mteTriggerThresholdTable_variables_oid) /
+                              sizeof(oid) + 3 - 1], &newlen, 1, NULL,
+                        NULL)) == NULL)
+        return SNMP_ERR_NOSUCHNAME;     /* remove if you support creation here */
+
+
+    switch (action) {
+    case RESERVE1:
+        if (var_val_type != ASN_OCTET_STR) {
+            fprintf(stderr,
+                    "write to mteTriggerThresholdDeltaRisingEvent not ASN_OCTET_STR\n");
+            return SNMP_ERR_WRONGTYPE;
+        }
+        if (StorageTmp->storageType != ST_NONVOLATILE)
+            return SNMP_ERR_NOTWRITABLE;
+        break;
+
+
+    case RESERVE2:
+        /*
+         * memory reseveration, final preparation... 
+         */
+        break;
+
+
+    case FREE:
+        /*
+         * Release any resources that have been allocated 
+         */
+        break;
+
+
+    case ACTION:
+        /*
+         * The variable has been stored in string for
+         * you to use, and you have just been asked to do something with
+         * it.  Note that anything done here must be reversable in the UNDO case 
+         */
+        tmpvar = StorageTmp->mteTriggerThresholdDeltaRisingEvent;
+        tmplen = StorageTmp->mteTriggerThresholdDeltaRisingEventLen;
+        memdup((u_char **) & StorageTmp->
+               mteTriggerThresholdDeltaRisingEvent, var_val, var_val_len);
+        StorageTmp->mteTriggerThresholdDeltaRisingEventLen = var_val_len;
+        break;
+
+
+    case UNDO:
+        /*
+         * Back out any changes made in the ACTION case 
+         */
+        SNMP_FREE(StorageTmp->mteTriggerThresholdDeltaRisingEvent);
+        StorageTmp->mteTriggerThresholdDeltaRisingEvent = tmpvar;
+        StorageTmp->mteTriggerThresholdDeltaRisingEventLen = tmplen;
+        break;
+
+
+    case COMMIT:
+        /*
+         * Things are working well, so it's now safe to make the change
+         * permanently.  Make sure that anything done here can't fail! 
+         */
+        SNMP_FREE(tmpvar);
+        break;
+    }
+    return SNMP_ERR_NOERROR;
+}
+
+
+
+int
+write_mteTriggerThresholdDeltaFallingEventOwner(int action,
+                                                u_char * var_val,
+                                                u_char var_val_type,
+                                                size_t var_val_len,
+                                                u_char * statP,
+                                                oid * name,
+                                                size_t name_len)
+{
+    static char    *tmpvar;
+    struct mteTriggerTable_data *StorageTmp = NULL;
+    static size_t   tmplen;
+    size_t          newlen =
+        name_len -
+        (sizeof(mteTriggerThresholdTable_variables_oid) / sizeof(oid) + 3 -
+         1);
+
+
+    DEBUGMSGTL(("mteTriggerThresholdTable",
+                "write_mteTriggerThresholdDeltaFallingEventOwner entering action=%d...  \n",
+                action));
+    if ((StorageTmp =
+         header_complex(mteTriggerTableStorage, NULL,
+                        &name[sizeof
+                              (mteTriggerThresholdTable_variables_oid) /
+                              sizeof(oid) + 3 - 1], &newlen, 1, NULL,
+                        NULL)) == NULL)
+        return SNMP_ERR_NOSUCHNAME;     /* remove if you support creation here */
+
+
+    switch (action) {
+    case RESERVE1:
+        if (var_val_type != ASN_OCTET_STR) {
+            fprintf(stderr,
+                    "write to mteTriggerThresholdDeltaFallingEventOwner not ASN_OCTET_STR\n");
+            return SNMP_ERR_WRONGTYPE;
+        }
+        if (StorageTmp->storageType != ST_NONVOLATILE)
+            return SNMP_ERR_NOTWRITABLE;
+        break;
+
+
+    case RESERVE2:
+        /*
+         * memory reseveration, final preparation... 
+         */
+        break;
+
+
+    case FREE:
+        /*
+         * Release any resources that have been allocated 
+         */
+        break;
+
+
+    case ACTION:
+        /*
+         * The variable has been stored in string for
+         * you to use, and you have just been asked to do something with
+         * it.  Note that anything done here must be reversable in the UNDO case 
+         */
+        tmpvar = StorageTmp->mteTriggerThresholdDeltaFallingEventOwner;
+        tmplen = StorageTmp->mteTriggerThresholdDeltaFallingEventOwnerLen;
+        memdup((u_char **) & StorageTmp->
+               mteTriggerThresholdDeltaFallingEventOwner, var_val,
+               var_val_len);
+        StorageTmp->mteTriggerThresholdDeltaFallingEventOwnerLen =
+            var_val_len;
+        break;
+
+
+    case UNDO:
+        /*
+         * Back out any changes made in the ACTION case 
+         */
+        SNMP_FREE(StorageTmp->mteTriggerThresholdDeltaFallingEventOwner);
+        StorageTmp->mteTriggerThresholdDeltaFallingEventOwner = tmpvar;
+        StorageTmp->mteTriggerThresholdDeltaFallingEventOwnerLen = tmplen;
+        break;
+
+
+    case COMMIT:
+        /*
+         * Things are working well, so it's now safe to make the change
+         * permanently.  Make sure that anything done here can't fail! 
+         */
+        SNMP_FREE(tmpvar);
+        break;
+    }
+    return SNMP_ERR_NOERROR;
+}
+
+
+
+int
+write_mteTriggerThresholdDeltaFallingEvent(int action,
+                                           u_char * var_val,
+                                           u_char var_val_type,
+                                           size_t var_val_len,
+                                           u_char * statP,
+                                           oid * name, size_t name_len)
+{
+    static char    *tmpvar;
+    struct mteTriggerTable_data *StorageTmp = NULL;
+    static size_t   tmplen;
+    size_t          newlen =
+        name_len -
+        (sizeof(mteTriggerThresholdTable_variables_oid) / sizeof(oid) + 3 -
+         1);
+
+
+    DEBUGMSGTL(("mteTriggerThresholdTable",
+                "write_mteTriggerThresholdDeltaFallingEvent entering action=%d...  \n",
+                action));
+    if ((StorageTmp =
+         header_complex(mteTriggerTableStorage, NULL,
+                        &name[sizeof
+                              (mteTriggerThresholdTable_variables_oid) /
+                              sizeof(oid) + 3 - 1], &newlen, 1, NULL,
+                        NULL)) == NULL)
+        return SNMP_ERR_NOSUCHNAME;     /* remove if you support creation here */
+
+
+    switch (action) {
+    case RESERVE1:
+        if (var_val_type != ASN_OCTET_STR) {
+            fprintf(stderr,
+                    "write to mteTriggerThresholdDeltaFallingEvent not ASN_OCTET_STR\n");
+            return SNMP_ERR_WRONGTYPE;
+        }
+        if (StorageTmp->storageType != ST_NONVOLATILE)
+            return SNMP_ERR_NOTWRITABLE;
+        break;
+
+
+    case RESERVE2:
+        /*
+         * memory reseveration, final preparation... 
+         */
+        break;
+
+
+    case FREE:
+        /*
+         * Release any resources that have been allocated 
+         */
+        break;
+
+
+    case ACTION:
+        /*
+         * The variable has been stored in string for
+         * you to use, and you have just been asked to do something with
+         * it.  Note that anything done here must be reversable in the UNDO case 
+         */
+        tmpvar = StorageTmp->mteTriggerThresholdDeltaFallingEvent;
+        tmplen = StorageTmp->mteTriggerThresholdDeltaFallingEventLen;
+        memdup((u_char **) & StorageTmp->
+               mteTriggerThresholdDeltaFallingEvent, var_val, var_val_len);
+        StorageTmp->mteTriggerThresholdDeltaFallingEventLen = var_val_len;
+        break;
+
+
+    case UNDO:
+        /*
+         * Back out any changes made in the ACTION case 
+         */
+        SNMP_FREE(StorageTmp->mteTriggerThresholdDeltaFallingEvent);
+        StorageTmp->mteTriggerThresholdDeltaFallingEvent = tmpvar;
+        StorageTmp->mteTriggerThresholdDeltaFallingEventLen = tmplen;
+        break;
+
+
+    case COMMIT:
+        /*
+         * Things are working well, so it's now safe to make the change
+         * permanently.  Make sure that anything done here can't fail! 
+         */
+        SNMP_FREE(tmpvar);
+        break;
+    }
+    return SNMP_ERR_NOERROR;
+}
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/disman/mteTriggerThresholdTable.h tomato121/release/src/router/snmp/agent/mibgroup/disman/mteTriggerThresholdTable.h
--- tomato/release/src/router/snmp/agent/mibgroup/disman/mteTriggerThresholdTable.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/disman/mteTriggerThresholdTable.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,46 @@
+/*
+ * This file was generated by mib2c and is intended for use as a mib module
+ * for the ucd-snmp snmpd agent. 
+ */
+
+
+#ifndef _MIBGROUP_MTETRIGGERTHRESHOLDTABLE_H
+#define _MIBGROUP_MTETRIGGERTHRESHOLDTABLE_H
+
+
+/*
+ * we may use header_complex from the header_complex module 
+ */
+
+
+config_require(header_complex)
+
+    /*
+     * enum definitions from the covered mib sections 
+     */
+#define MTETRIGGERTHRESHOLDSTARTUP_RISING        1
+#define MTETRIGGERTHRESHOLDSTARTUP_FALLING       2
+#define MTETRIGGERTHRESHOLDSTARTUP_RISINGORFALLING 3
+    /*
+     * function prototypes 
+     */
+     void            init_mteTriggerThresholdTable(void);
+     FindVarMethod   var_mteTriggerThresholdTable;
+
+     WriteMethod     write_mteTriggerThresholdStartup;
+     WriteMethod     write_mteTriggerThresholdRising;
+     WriteMethod     write_mteTriggerThresholdFalling;
+     WriteMethod     write_mteTriggerThresholdDeltaRising;
+     WriteMethod     write_mteTriggerThresholdDeltaFalling;
+     WriteMethod     write_mteTriggerThresholdObjectsOwner;
+     WriteMethod     write_mteTriggerThresholdObjects;
+     WriteMethod     write_mteTriggerThresholdRisingEventOwner;
+     WriteMethod     write_mteTriggerThresholdRisingEvent;
+     WriteMethod     write_mteTriggerThresholdFallingEventOwner;
+     WriteMethod     write_mteTriggerThresholdFallingEvent;
+     WriteMethod     write_mteTriggerThresholdDeltaRisingEventOwner;
+     WriteMethod     write_mteTriggerThresholdDeltaRisingEvent;
+     WriteMethod     write_mteTriggerThresholdDeltaFallingEventOwner;
+     WriteMethod     write_mteTriggerThresholdDeltaFallingEvent;
+
+#endif                          /* _MIBGROUP_MTETRIGGERTHRESHOLDTABLE_H */
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/dummy/.cvsignore tomato121/release/src/router/snmp/agent/mibgroup/dummy/.cvsignore
--- tomato/release/src/router/snmp/agent/mibgroup/dummy/.cvsignore	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/dummy/.cvsignore	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,2 @@
+.libs
+*.lo
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/examples/.cvsignore tomato121/release/src/router/snmp/agent/mibgroup/examples/.cvsignore
--- tomato/release/src/router/snmp/agent/mibgroup/examples/.cvsignore	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/examples/.cvsignore	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,3 @@
+.libs
+*.lo
+Makefile
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/examples/data_set.c tomato121/release/src/router/snmp/agent/mibgroup/examples/data_set.c
--- tomato/release/src/router/snmp/agent/mibgroup/examples/data_set.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/examples/data_set.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,206 @@
+/**  @example data_set.c
+ *  This example creates a table full of information and stores all
+ *  that information within the agent's memory.  The "table_dataset"
+ *  helper routines take care of handling all aspects of SNMP requests
+ *  as they come in (yay!).
+ *
+ *  The exmaple we are instrumenting is an otherwise-useless table
+ *  containing the names of IETF working group chairs.  Obviously,
+ *  this data isn't all that useful from a network management point of
+ *  view but this example only demonstrates how to use and store data.
+ *  For more useful examples (but more complex), check out the
+ *  apps/notification_log.c file which implements parts of the
+ *  NOTIFICATION-LOG-MIB for logging incoming SNMP notifications.
+ *
+ *  Much of this code could be automatically generated by running
+ *  mib2c as follows:
+ *
+ *    - mib2c -c mib2c.create-dataset.conf netSnmpIETFWGTable
+ *
+ *  The table is defined roughly as follows:
+ *
+ *  <pre>
+ *    % snmptranslate -m NET-SNMP-EXAMPLES-MIB -Tp -IR netSnmpIETFWGTable
+ *    |+--netSnmpIETFWGTable(1)
+ *    |   |
+ *    |   +--netSnmpIETFWGEntry(1)
+ *    |      |  Index: nsIETFWGName
+ *    |      |
+ *    |      +-- ---- String    nsIETFWGName(1)
+ *    |      |        Size: 1..32
+ *    |      +-- CR-- String    nsIETFWGChair1(2)
+ *    |      +-- CR-- String    nsIETFWGChair2(3)
+ *  </pre>
+ *
+ *  If this module is compiled into an agent, you should be able to
+ *  issue snmp commands that look something like (valid authentication
+ *  information not shown in these commands):
+ *
+ *  <pre>
+ *      % snmpwalk localhost netSnmpIETFWGTable
+ *      nsIETFWGChair1."snmpv3" = "Russ Mundy"
+ *      nsIETFWGChair2."snmpv3" = "David Harrington"
+ *
+ *      % snmpset localhost nsIETFWGChair1.\"sming\" = "David Durham"
+ *      nsIETFWGChair1."sming" = "David Durham"
+ *  
+ *      % snmpwalk localhost netSnmpIETFWGTable
+ *      nsIETFWGChair1."sming" = "David Durham"
+ *      nsIETFWGChair1."snmpv3" = "Russ Mundy"
+ *      nsIETFWGChair2."snmpv3" = "David Harrington"
+ *
+ *      In your snmpd.conf file, put the following line:
+ *      add_row netSnmpIETFWGTable eos "Glenn Waters" "Dale Francisco"
+ *
+ *      % snmpwalk localhost netSnmpIETFWGTable
+ *      nsIETFWGChair1.\"eos\" = "Glenn Waters"
+ *      nsIETFWGChair1.\"snmpv3\" = "Russ Mundy"
+ *      nsIETFWGChair2.\"eos\" = "Dale Francisco"
+ *      nsIETFWGChair2.\"snmpv3\" = "David Harrington"
+ *  </pre>
+ */
+
+/*
+ * start be including the appropriate header files 
+ */
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+/*
+ * our initialization routine, automatically called by the agent 
+ */
+/*
+ * (to get called, the function name must match init_FILENAME() 
+ */
+void
+init_data_set(void)
+{
+    netsnmp_table_data_set *table_set;
+    netsnmp_table_row *row;
+
+    /*
+     * the OID we want to register our integer at.  This should be the
+     * * OID node for the entire table.  In our case this is the
+     * * netSnmpIETFWGTable oid definition 
+     */
+    oid             my_registration_oid[] =
+        { 1, 3, 6, 1, 4, 1, 8072, 2, 2, 1 };
+
+    /*
+     * a debugging statement.  Run the agent with -Dexample_data_set to see
+     * * the output of this debugging statement. 
+     */
+    DEBUGMSGTL(("example_data_set",
+                "Initalizing example dataset table\n"));
+
+    /*
+     * It's going to be the "working group chairs" table, since I'm
+     * * sitting at an IETF convention while I'm writing this.
+     * *
+     * *  column 1 = index = string = WG name
+     * *  column 2 = string = chair #1
+     * *  column 3 = string = chair #2  (most WGs have 2 chairs now)
+     */
+
+    table_set = netsnmp_create_table_data_set("netSnmpIETFWGTable");
+
+    /*
+     * allow the creation of new rows via SNMP SETs 
+     */
+    table_set->allow_creation = 1;
+
+    /*
+     * set up what a row "should" look like, starting with the index 
+     */
+    netsnmp_table_dataset_add_index(table_set, ASN_OCTET_STR);
+
+    /*
+     * define what the columns should look like.  both are octet strings here 
+     */
+    netsnmp_table_set_multi_add_default_row(table_set,
+                                            /*
+                                             * column 2 = OCTET STRING,
+                                             * writable = 1,
+                                             * default value = NULL,
+                                             * default value len = 0 
+                                             */
+                                            2, ASN_OCTET_STR, 1, NULL, 0,
+                                            /*
+                                             * similar 
+                                             */
+                                            3, ASN_OCTET_STR, 1, NULL, 0,
+                                            0 /* done */ );
+
+    /*
+     * register the table 
+     */
+    /*
+     * if we wanted to handle specific data in a specific way, or note
+     * * when requests came in we could change the NULL below to a valid
+     * * handler method in which we could over ride the default
+     * * behaviour of the table_dataset helper 
+     */
+    netsnmp_register_table_data_set(netsnmp_create_handler_registration
+                                    ("netSnmpIETFWGTable", NULL,
+                                     my_registration_oid,
+                                     OID_LENGTH(my_registration_oid),
+                                     HANDLER_CAN_RWRITE), table_set, NULL);
+
+
+    /*
+     * create the a row for the table, and add the data 
+     */
+    row = netsnmp_create_table_data_row();
+    /*
+     * set the index to the IETF WG name "snmpv3" 
+     */
+    netsnmp_table_row_add_index(row, ASN_OCTET_STR, "snmpv3",
+                                strlen("snmpv3"));
+
+
+    /*
+     * set column 2 to be the WG chair name "Russ Mundy" 
+     */
+    netsnmp_set_row_column(row, 2, ASN_OCTET_STR,
+                           "Russ Mundy", strlen("Russ Mundy"));
+    netsnmp_mark_row_column_writable(row, 2, 1);        /* make writable via SETs */
+
+    /*
+     * set column 3 to be the WG chair name "David Harrington" 
+     */
+    netsnmp_set_row_column(row, 3, ASN_OCTET_STR, "David Harrington",
+                           strlen("David Harrington"));
+    netsnmp_mark_row_column_writable(row, 3, 1);        /* make writable via SETs */
+
+    /*
+     * add the row to the table 
+     */
+    netsnmp_table_dataset_add_row(table_set, row);
+
+#ifdef ADD_MORE_DATA
+    /*
+     * add the data, for the second row 
+     */
+    row = netsnmp_create_table_data_row();
+    netsnmp_table_row_add_index(row, ASN_OCTET_STR, "snmpconf",
+                                strlen("snmpconf"));
+    netsnmp_set_row_column(row, 2, ASN_OCTET_STR, "David Partain",
+                           strlen("David Partain"));
+    netsnmp_mark_row_column_writable(row, 2, 1);        /* make writable */
+    netsnmp_set_row_column(row, 3, ASN_OCTET_STR, "Jon Saperia",
+                           strlen("Jon Saperia"));
+    netsnmp_mark_row_column_writable(row, 3, 1);        /* make writable */
+    netsnmp_table_dataset_add_row(table_set, row);
+#endif
+
+    /*
+     * Finally, this actually allows the "add_row" token it the
+     * * snmpd.conf file to add rows to this table.
+     * * Example snmpd.conf line:
+     * *   add_row netSnmpIETFWGTable eos "Glenn Waters" "Dale Francisco"
+     */
+    netsnmp_register_auto_data_table(table_set, NULL);
+
+    DEBUGMSGTL(("example_data_set", "Done initializing.\n"));
+}
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/examples/data_set.h tomato121/release/src/router/snmp/agent/mibgroup/examples/data_set.h
--- tomato/release/src/router/snmp/agent/mibgroup/examples/data_set.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/examples/data_set.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,6 @@
+#ifndef DATA_SET_H
+#define DATA_SET_H
+
+void            init_data_set(void);
+
+#endif                          /* DATA_SET_H */
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/examples/delayed_instance.c tomato121/release/src/router/snmp/agent/mibgroup/examples/delayed_instance.c
--- tomato/release/src/router/snmp/agent/mibgroup/examples/delayed_instance.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/examples/delayed_instance.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,256 @@
+/**  @example delayed_instance.c
+ *  This example implements the netSnmpExampleSleeper object.
+ *
+ *  It demonstrates 2 things:
+ *
+ *  - The instance helper, which is a way of registering an exact OID
+ *    such that GENEXT requests are handled entirely by the helper.
+ *
+ *  - how to implement objects which normally would block the agent as
+ *    it waits for external events in such a way that the agent can
+ *    continue responding to other requests while this implementation
+ *    waits.
+ *
+ *  - Added bonus: normally the nsTransactionTable is empty, since
+ *    there aren't any outstanding requests generally.  When accessed,
+ *    this module will create some however.  Try setting
+ *    netSnmpExampleSleeper.0 to 10 and then accessing it (use
+ *    "snmpget -t 15 ..." to access it), and then walk the
+ *    nsTransactionTable from another shell to see that not only is
+ *    the walk not blocked, but that the nsTransactionTable is not
+ *    empty.
+ *
+ */
+
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+#include "delayed_instance.h"
+
+static u_long   delay_time = 1;
+
+void
+init_delayed_instance(void)
+{
+    static oid      my_delayed_oid[] =
+        { 1, 3, 6, 1, 4, 1, 8072, 2, 1, 2, 0 };
+    /*
+     * delayed handler test
+     */
+    netsnmp_handler_registration *my_test;
+
+    my_test =
+        netsnmp_create_handler_registration("delayed_instance_example",
+                                            delayed_instance_handler,
+                                            my_delayed_oid,
+                                            OID_LENGTH(my_delayed_oid),
+                                            HANDLER_CAN_RWRITE);
+
+    netsnmp_register_instance(my_test);
+}
+
+#define DELAYED_INSTANCE_SET_NAME "test_delayed"
+
+int
+delayed_instance_handler(netsnmp_mib_handler *handler,
+                         netsnmp_handler_registration *reginfo,
+                         netsnmp_agent_request_info *reqinfo,
+                         netsnmp_request_info *requests)
+{
+
+    DEBUGMSGTL(("delayed_instance", "Got request, mode = %d:\n",
+                reqinfo->mode));
+
+    switch (reqinfo->mode) {
+        /*
+         * here we merely mention that we'll answer this request
+         * later.  we don't actually care about the mode type in this
+         * example, but for certain cases you may, so I'll leave in the
+         * otherwise useless switch and case statements 
+         */
+
+    default:
+        /*
+         * mark this variable as something that can't be handled now.
+         * We'll answer it later. 
+         */
+        requests->delegated = 1;
+
+        /*
+         * register an alarm to update the results at a later
+         * time.  Normally, we might have to query something else
+         * (like an external request sent to a different network
+         * or system socket, etc), but for this example we'll do
+         * something really simply and just insert an alarm for a
+         * certain period of time 
+         */
+        snmp_alarm_register(delay_time, /* seconds */
+                            0,  /* dont repeat. */
+                            return_delayed_response,    /* the function
+                                                         * to call */
+                            /*
+                             * here we create a "cache" of useful
+                             * information that we'll want later
+                             * on.  This argument is passed back
+                             * to us in the callback function for
+                             * an alarm 
+                             */
+                            (void *)
+                            netsnmp_create_delegated_cache(handler,
+                                                           reginfo,
+                                                           reqinfo,
+                                                           requests,
+                                                           NULL));
+        break;
+
+    }
+
+    return SNMP_ERR_NOERROR;
+}
+
+void
+return_delayed_response(unsigned int clientreg, void *clientarg)
+{
+    /*
+     * extract the cache from the passed argument 
+     */
+    netsnmp_delegated_cache *cache = (netsnmp_delegated_cache *) clientarg;
+
+    netsnmp_request_info *requests;
+    netsnmp_agent_request_info *reqinfo;
+    u_long         *delay_time_cache = NULL;
+
+    /*
+     * here we double check that the cache we created earlier is still
+     * * valid.  If not, the request timed out for some reason and we
+     * * don't need to keep processing things.  Should never happen, but
+     * * this double checks. 
+     */
+    cache = netsnmp_handler_check_cache(cache);
+
+    if (!cache) {
+        snmp_log(LOG_ERR, "illegal call to return delayed response\n");
+        return;
+    }
+
+    /*
+     * re-establish the previous pointers we are used to having 
+     */
+    reqinfo = cache->reqinfo;
+    requests = cache->requests;
+
+    DEBUGMSGTL(("delayed_instance",
+                "continuing delayed request, mode = %d\n",
+                cache->reqinfo->mode));
+
+    /*
+     * mention that it's no longer delegated, and we've now answered
+     * the query (which we'll do down below). 
+     */
+    requests->delegated = 0;
+
+    switch (cache->reqinfo->mode) {
+        /*
+         * registering as an instance means we don't need to deal with
+         * getnext processing, so we don't handle it here at all.
+         * 
+         * However, since the instance handler already reset the mode
+         * back to GETNEXT from the faked GET mode, we need to do the
+         * same thing in both cases.  This should be fixed in future
+         * versions of net-snmp hopefully. 
+         */
+
+    case MODE_GET:
+    case MODE_GETNEXT:
+        /*
+         * return the currend delay time 
+         */
+        snmp_set_var_typed_value(cache->requests->requestvb,
+                                 ASN_INTEGER,
+                                 (u_char *) & delay_time,
+                                 sizeof(delay_time));
+        break;
+
+    case MODE_SET_RESERVE1:
+        /*
+         * check type 
+         */
+        if (requests->requestvb->type != ASN_INTEGER) {
+            /*
+             * not an integer.  Bad dog, no bone. 
+             */
+            netsnmp_set_request_error(reqinfo, requests,
+                                      SNMP_ERR_WRONGTYPE);
+            /*
+             * we don't need the cache any longer 
+             */
+            netsnmp_free_delegated_cache(cache);
+            return;
+        }
+        break;
+
+    case MODE_SET_RESERVE2:
+        /*
+         * store old value for UNDO support in the future. 
+         */
+        memdup((u_char **) & delay_time_cache,
+               (u_char *) & delay_time, sizeof(delay_time));
+
+        /*
+         * malloc failed 
+         */
+        if (delay_time_cache == NULL) {
+            netsnmp_set_request_error(reqinfo, requests,
+                                      SNMP_ERR_RESOURCEUNAVAILABLE);
+            netsnmp_free_delegated_cache(cache);
+            return;
+        }
+
+        /*
+         * Add our temporary information to the request itself.
+         * This is then retrivable later.  The free function
+         * passed auto-frees it when the request is later
+         * deleted.  
+         */
+        netsnmp_request_add_list_data(requests,
+                                      netsnmp_create_data_list
+                                      (DELAYED_INSTANCE_SET_NAME,
+                                       delay_time_cache, free));
+        break;
+
+    case MODE_SET_ACTION:
+        /*
+         * update current value 
+         */
+        delay_time = *(requests->requestvb->val.integer);
+        DEBUGMSGTL(("testhandler", "updated delay_time -> %d\n",
+                    delay_time));
+        break;
+
+    case MODE_SET_UNDO:
+        /*
+         * ack, something somewhere failed.  We reset back to the
+         * previously old value by extracting the previosuly
+         * stored information back out of the request 
+         */
+        delay_time =
+            *((u_long *) netsnmp_request_get_list_data(requests,
+                                                       DELAYED_INSTANCE_SET_NAME));
+        break;
+
+    case MODE_SET_COMMIT:
+    case MODE_SET_FREE:
+        /*
+         * the only thing to do here is free the old memdup'ed
+         * value, but it's auto-freed by the datalist recovery, so
+         * we don't have anything to actually do here 
+         */
+        break;
+    }
+
+    /*
+     * free the information cache 
+     */
+    netsnmp_free_delegated_cache(cache);
+}
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/examples/delayed_instance.h tomato121/release/src/router/snmp/agent/mibgroup/examples/delayed_instance.h
--- tomato/release/src/router/snmp/agent/mibgroup/examples/delayed_instance.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/examples/delayed_instance.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,3 @@
+Netsnmp_Node_Handler delayed_instance_handler;
+void            init_delayed_instance(void);
+SNMPAlarmCallback return_delayed_response;
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/examples/example.c tomato121/release/src/router/snmp/agent/mibgroup/examples/example.c
--- tomato/release/src/router/snmp/agent/mibgroup/examples/example.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/examples/example.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,746 @@
+/*
+ *  Template MIB group implementation - example.c
+ *
+ */
+
+/*
+ * include important headers 
+ */
+#include <net-snmp/net-snmp-config.h>
+#if HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#if HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+
+/*
+ * needed by util_funcs.h 
+ */
+#if TIME_WITH_SYS_TIME
+# ifdef WIN32
+#  include <sys/timeb.h>
+# else
+#  include <sys/time.h>
+# endif
+# include <time.h>
+#else
+# if HAVE_SYS_TIME_H
+#  include <sys/time.h>
+# else
+#  include <time.h>
+# endif
+#endif
+
+#if HAVE_WINSOCK_H
+#include <winsock.h>
+#endif
+#if HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+/*
+ * header_generic() comes from here 
+ */
+#include "util_funcs.h"
+
+/*
+ * include our .h file 
+ */
+#include "example.h"
+
+
+   /*
+    *  Certain objects can be set via configuration file directives.
+    *  These variables hold the values for such objects, as they need to
+    *   be accessible to both the config handlers, and the callback routine.
+    */
+#define EXAMPLE_STR_LEN	300
+#define EXAMPLE_STR_DEFAULT	"life the universe and everything"
+int             example_int = 42;
+char            example_str[EXAMPLE_STR_LEN];
+
+        /*
+         * Forward declarations for the config handlers 
+         */
+void            example_parse_config_exampleint(const char *token,
+                                                char *cptr);
+void            example_parse_config_examplestr(const char *token,
+                                                char *cptr);
+void            example_free_config_exampleint(void);
+void            example_free_config_examplestr(void);
+
+
+        /*********************
+	 *
+	 *  Initialisation & common implementation functions
+	 *
+	 *********************/
+
+    /*
+     * This array structure defines a representation of the
+     *  MIB being implemented.
+     *
+     * The type of the array is 'struct variableN', where N is
+     *  large enough to contain the longest OID sub-component
+     *  being loaded.  This will normally be the maximum value
+     *  of the fifth field in each line.  In this case, the second
+     *  and third entries are both of size 2, so we're using
+     *  'struct variable2'
+     *
+     * The supported values for N are listed in <agent/var_struct.h>
+     *  If the value you need is not listed there, simply use the
+     *  next largest that is.
+     *
+     * The format of each line is as follows
+     *  (using the first entry as an example):
+     *      1: EXAMPLESTRING:
+     *          The magic number defined in the example header file.
+     *          This is passed to the callback routine and is used
+     *            to determine which object is being queried.
+     *      2: ASN_OCTET_STR:
+     *          The type of the object.
+     *          Valid types are listed in <snmp_impl.h>
+     *      3: RONLY (or RWRITE):
+     *          Whether this object can be SET or not.
+     *      4: var_example:
+     *          The callback routine, used when the object is queried.
+     *          This will usually be the same for all objects in a module
+     *            and is typically defined later in this file.
+     *      5: 1:
+     *          The length of the OID sub-component (the next field)
+     *      6: {1}:
+     *          The OID sub-components of this entry.
+     *          In other words, the bits of the full OID that differ
+     *            between the various entries of this array.
+     *          This value is appended to the common prefix (defined later)
+     *            to obtain the full OID of each entry.
+     */
+struct variable2 example_variables[] = {
+    {EXAMPLESTRING, ASN_OCTET_STR, RONLY, var_example, 1, {1}},
+    {EXAMPLEINTEGER, ASN_INTEGER, RWRITE, var_example, 2, {2, 1}},
+    {EXAMPLEOBJECTID, ASN_OBJECT_ID, RONLY, var_example, 2, {2, 2}},
+    {EXAMPLETIMETICKS, ASN_TIMETICKS, RONLY, var_example, 1, {3}},
+    {EXAMPLEIPADDRESS, ASN_IPADDRESS, RONLY, var_example, 1, {4}},
+    {EXAMPLECOUNTER, ASN_COUNTER, RONLY, var_example, 1, {5}},
+    {EXAMPLEGAUGE, ASN_GAUGE, RONLY, var_example, 1, {6}},
+    {EXAMPLETRIGGERTRAP, ASN_INTEGER, RWRITE, var_example, 1, {7}},
+    {EXAMPLETRIGGERTRAP2, ASN_INTEGER, RWRITE, var_example, 1, {8}}
+};
+
+    /*
+     * This array defines the OID of the top of the mib tree that we're
+     *  registering underneath.
+     * Note that this needs to be the correct size for the OID being 
+     *  registered, so that the length of the OID can be calculated.
+     *  The format given here is the simplest way to achieve this.
+     */
+oid             example_variables_oid[] = { 1, 3, 6, 1, 4, 1, 2021, 254 };
+
+
+
+    /*
+     * This function is called at the time the agent starts up
+     *  to do any initializations that might be required.
+     *
+     * In theory it is optional and can be omitted if no
+     *  initialization is needed.  In practise, every module
+     *  will need to register itself (or the objects being
+     *  implemented will not appear in the MIB tree), and this
+     *  registration is typically done here.
+     *
+     * If this function is added or removed, you must re-run
+     *  the configure script, to detect this change.
+     */
+void
+init_example(void)
+{
+    /*
+     * Register ourselves with the agent to handle our mib tree.
+     * The arguments are:
+     *    descr:   A short description of the mib group being loaded.
+     *    var:     The variable structure to load.
+     *                  (the name of the variable structure defined above)
+     *    vartype: The type of this variable structure
+     *    theoid:  The OID pointer this MIB is being registered underneath.
+     */
+    REGISTER_MIB("example", example_variables, variable2,
+                 example_variables_oid);
+
+
+    /*
+     *  Register config handlers for the two objects that can be set
+     *   via configuration file directive.
+     *  Also set a default value for the string object.  Note that the
+     *   example integer variable was initialised above.
+     */
+    strncpy(example_str, EXAMPLE_STR_DEFAULT, EXAMPLE_STR_LEN);
+
+    snmpd_register_config_handler("exampleint",
+                                  example_parse_config_exampleint,
+                                  example_free_config_exampleint,
+                                  "exampleint value");
+    snmpd_register_config_handler("examplestr",
+                                  example_parse_config_examplestr,
+                                  example_free_config_examplestr,
+                                  "examplestr value");
+    snmpd_register_config_handler("examplestring",
+                                  example_parse_config_examplestr,
+                                  example_free_config_examplestr,
+                                  "examplestring value");
+
+    /*
+     * One common requirement is to read values from the kernel.
+     * This is usually initialised here, to speed up access when the
+     *  information is read in, as a response to an incoming request.
+     *
+     * This module doesn't actually use this mechanism,
+     * so this call is commented out here.
+     */
+    /*
+     * auto_nlist( "example_symbol", 0, 0 ); 
+     */
+}
+
+        /*********************
+	 *
+	 *  Configuration file handling functions
+	 *
+	 *********************/
+
+void
+example_parse_config_exampleint(const char *token, char *cptr)
+{
+    example_int = atoi(cptr);
+}
+
+void
+example_parse_config_examplestr(const char *token, char *cptr)
+{
+    /*
+     * Make sure the string fits in the space allocated for it.
+     */
+    if (strlen(cptr) < EXAMPLE_STR_LEN)
+        strcpy(example_str, cptr);
+    else {
+        /*
+         * Truncate the string if necessary.
+         * An alternative approach would be to log an error,
+         *  and discard this value altogether.
+         */
+        strncpy(example_str, cptr, EXAMPLE_STR_LEN - 4);
+        example_str[EXAMPLE_STR_LEN - 4] = 0;
+        strcat(example_str, "...");
+        example_str[EXAMPLE_STR_LEN - 1] = 0;
+    }
+}
+
+        /*
+         * We don't need to do anything special when closing down 
+         */
+void
+example_free_config_exampleint(void)
+{
+}
+
+void
+example_free_config_examplestr(void)
+{
+}
+
+        /*********************
+	 *
+	 *  System specific implementation functions
+	 *
+	 *********************/
+
+    /*
+     * Define the callback function used in the example_variables structure.
+     * This is called whenever an incoming request refers to an object
+     *  within this sub-tree.
+     *
+     * Four of the parameters are used to pass information in.
+     * These are:
+     *    vp      The entry from the 'example_variables' array for the
+     *             object being queried.
+     *    name    The OID from the request.
+     *    length  The length of this OID.
+     *    exact   A flag to indicate whether this is an 'exact' request
+     *             (GET/SET) or an 'inexact' one (GETNEXT/GETBULK).
+     *
+     * Four of the parameters are used to pass information back out.
+     * These are:
+     *    name     The OID being returned.
+     *    length   The length of this OID.
+     *    var_len  The length of the answer being returned.
+     *    write_method   A pointer to the SET function for this object.
+     *
+     * Note that name & length serve a dual purpose in both roles.
+     */
+
+u_char         *
+var_example(struct variable *vp,
+            oid * name,
+            size_t * length,
+            int exact, size_t * var_len, WriteMethod ** write_method)
+{
+    /*
+     *  The result returned from this function needs to be a pointer to
+     *    static data (so that it can be accessed from outside).
+     *  Define suitable variables for any type of data we may return.
+     */
+    static char     string[EXAMPLE_STR_LEN];    /* for EXAMPLESTRING   */
+    static oid      oid_ret[8]; /* for EXAMPLEOBJECTID */
+    static long     long_ret;   /* for everything else */
+
+    /*
+     * Before returning an answer, we need to check that the request
+     *  refers to a valid instance of this object.  The utility routine
+     *  'header_generic' can be used to do this for scalar objects.
+     *
+     * This routine 'header_simple_table' does the same thing for "simple"
+     *  tables. (See the AGENT.txt file for the definition of a simple table).
+     *
+     * Both these utility routines also set up default values for the
+     *  return arguments (assuming the check succeeded).
+     * The name and length are set suitably for the current object,
+     *  var_len assumes that the result is an integer of some form,
+     *  and write_method assumes that the object cannot be set.
+     *
+     * If these assumptions are correct, this callback routine simply
+     * needs to return a pointer to the appropriate value (using 'long_ret').
+     * Otherwise, 'var_len' and/or 'write_method' should be set suitably.
+     */
+    DEBUGMSGTL(("example", "var_example entered\n"));
+    if (header_generic(vp, name, length, exact, var_len, write_method) ==
+        MATCH_FAILED)
+        return NULL;
+
+
+    /*
+     * Many object will need to obtain data from the operating system in
+     *  order to return the appropriate value.  Typically, this is done
+     *  here - immediately following the 'header' call, and before the
+     *  switch statement. This is particularly appropriate if a single 
+     *  interface call can return data for all the objects supported.
+     *
+     * This example module does not rely on external data, so no such
+     *  calls are needed in this case.  
+     */
+
+    /*
+     * Now use the magic number from the variable pointer 'vp' to
+     *  select the particular object being queried.
+     * In each case, one of the static objects is set up with the
+     *  appropriate information, and returned mapped to a 'u_char *'
+     */
+    switch (vp->magic) {
+    case EXAMPLESTRING:
+        sprintf(string, example_str);
+        /*
+         * Note that the assumption that the answer will be an
+         *  integer does not hold true in this case, so the length
+         *  of the answer needs to be set explicitly.           
+         */
+        *var_len = strlen(string);
+        return (u_char *) string;
+
+    case EXAMPLEINTEGER:
+        /*
+         * Here the length assumption is correct, but the
+         *  object is writeable, so we need to set the
+         *  write_method pointer as well as the current value.
+         */
+        long_ret = example_int;
+        *write_method = write_exampleint;
+        return (u_char *) & long_ret;
+
+    case EXAMPLEOBJECTID:
+        oid_ret[0] = 1;
+        oid_ret[1] = 3;
+        oid_ret[2] = 6;
+        oid_ret[3] = 1;
+        oid_ret[4] = 4;
+        oid_ret[5] = oid_ret[6] = oid_ret[7] = 42;
+        /*
+         * Again, the assumption regarding the answer length is wrong.
+         */
+        *var_len = 8 * sizeof(oid);
+        return (u_char *) oid_ret;
+
+    case EXAMPLETIMETICKS:
+        /*
+         * Here both assumptions are correct,
+         *  so we just need to set up the answer.
+         */
+        long_ret = 363136200;   /* 42 days, 42 minutes and 42.0 seconds */
+        return (u_char *) & long_ret;
+
+    case EXAMPLEIPADDRESS:
+        /*
+         * ipaddresses get returned as a long.  ick 
+         */
+        /*
+         * we're returning 127.0.0.1 
+         */
+        long_ret = ntohl(INADDR_LOOPBACK);
+        return (u_char *) & long_ret;
+
+    case EXAMPLECOUNTER:
+        long_ret = 42;
+        return (u_char *) & long_ret;
+
+    case EXAMPLEGAUGE:
+        long_ret = 42;          /* Do we detect a theme running through these answers? */
+        return (u_char *) & long_ret;
+
+    case EXAMPLETRIGGERTRAP:
+        /*
+         * This object is essentially "write-only".
+         * It only exists to trigger the sending of a trap.
+         * Reading it will always return 0.
+         */
+        long_ret = 0;
+        *write_method = write_exampletrap;
+        return (u_char *) & long_ret;
+
+    case EXAMPLETRIGGERTRAP2:
+        /*
+         * This object is essentially "write-only".
+         * It only exists to trigger the sending of a v2 trap.
+         * Reading it will always return 0.
+         */
+        long_ret = 0;
+        *write_method = write_exampletrap2;
+        return (u_char *) & long_ret;
+
+    default:
+        /*
+         *  This will only be triggered if there's a problem with
+         *   the coding of the module.  SNMP requests that reference
+         *   a non-existant OID will be directed elsewhere.
+         *  If this branch is reached, log an error, so that
+         *   the problem can be investigated.
+         */
+        DEBUGMSGTL(("snmpd", "unknown sub-id %d in examples/var_example\n",
+                    vp->magic));
+    }
+    /*
+     * If we fall through to here, fail by returning NULL.
+     * This is essentially a continuation of the 'default' case above.
+     */
+    return NULL;
+}
+
+        /*********************
+	 *
+	 *  Writeable object SET handling routines
+	 *
+	 *********************/
+int
+write_exampleint(int action,
+                 u_char * var_val,
+                 u_char var_val_type,
+                 size_t var_val_len,
+                 u_char * statP, oid * name, size_t name_len)
+{
+    /*
+     * Define an arbitrary maximum permissible value 
+     */
+#define MAX_EXAMPLE_INT	100
+    static long     intval;
+    static long     old_intval;
+
+    switch (action) {
+    case RESERVE1:
+        /*
+         *  Check that the value being set is acceptable
+         */
+        if (var_val_type != ASN_INTEGER) {
+            DEBUGMSGTL(("example", "%x not integer type", var_val_type));
+            return SNMP_ERR_WRONGTYPE;
+        }
+        if (var_val_len > sizeof(long)) {
+            DEBUGMSGTL(("example", "wrong length %x", var_val_len));
+            return SNMP_ERR_WRONGLENGTH;
+        }
+
+        intval = *((long *) var_val);
+        if (intval > MAX_EXAMPLE_INT) {
+            DEBUGMSGTL(("example", "wrong value %x", intval));
+            return SNMP_ERR_WRONGVALUE;
+        }
+        break;
+
+    case RESERVE2:
+        /*
+         *  This is conventially where any necesary
+         *   resources are allocated (e.g. calls to malloc)
+         *  Here, we are using static variables
+         *   so don't need to worry about this.
+         */
+        break;
+
+    case FREE:
+        /*
+         *  This is where any of the above resources
+         *   are freed again (because one of the other
+         *   values being SET failed for some reason).
+         *  Again, since we are using static variables
+         *   we don't need to worry about this either.
+         */
+        break;
+
+    case ACTION:
+        /*
+         *  Set the variable as requested.
+         *   Note that this may need to be reversed,
+         *   so save any information needed to do this.
+         */
+        old_intval = example_int;
+        example_int = intval;
+        break;
+
+    case UNDO:
+        /*
+         *  Something failed, so re-set the
+         *   variable to its previous value
+         *  (and free any allocated resources).
+         */
+        example_int = old_intval;
+        break;
+
+    case COMMIT:
+        /*
+         *  Everything worked, so we can discard any
+         *   saved information, and make the change
+         *   permanent (e.g. write to the config file).
+         *  We also free any allocated resources.
+         *
+         *  In this case, there's nothing to do.
+         */
+        break;
+
+    }
+    return SNMP_ERR_NOERROR;
+}
+
+int
+write_exampletrap(int action,
+                  u_char * var_val,
+                  u_char var_val_type,
+                  size_t var_val_len,
+                  u_char * statP, oid * name, size_t name_len)
+{
+    long            intval;
+
+    DEBUGMSGTL(("example", "write_exampletrap entered: action=%d\n",
+                action));
+    switch (action) {
+    case RESERVE1:
+        /*
+         *  The only acceptable value is the integer 1
+         */
+        if (var_val_type != ASN_INTEGER) {
+            DEBUGMSGTL(("example", "%x not integer type", var_val_type));
+            return SNMP_ERR_WRONGTYPE;
+        }
+        if (var_val_len > sizeof(long)) {
+            DEBUGMSGTL(("example", "wrong length %x", var_val_len));
+            return SNMP_ERR_WRONGLENGTH;
+        }
+
+        intval = *((long *) var_val);
+        if (intval != 1) {
+            DEBUGMSGTL(("example", "wrong value %x", intval));
+            return SNMP_ERR_WRONGVALUE;
+        }
+        break;
+
+    case RESERVE2:
+        /*
+         * No resources are required.... 
+         */
+        break;
+
+    case FREE:
+        /*
+         * ... so no resources need be freed 
+         */
+        break;
+
+    case ACTION:
+        /*
+         *  Having triggered the sending of a trap,
+         *   it would be impossible to revoke this,
+         *   so we can't actually invoke the action here.
+         */
+        break;
+
+    case UNDO:
+        /*
+         * We haven't done anything yet,
+         * so there's nothing to undo 
+         */
+        break;
+
+    case COMMIT:
+        /*
+         *  Everything else worked, so it's now safe
+         *   to trigger the trap.
+         *  Note that this is *only* acceptable since
+         *   the trap sending routines are "failsafe".
+         *  (In fact, they can fail, but they return no
+         *   indication of this, which is the next best thing!)
+         */
+        DEBUGMSGTL(("example", "write_exampletrap sending the trap\n",
+                    action));
+        send_easy_trap(SNMP_TRAP_ENTERPRISESPECIFIC, 99);
+        DEBUGMSGTL(("example", "write_exampletrap trap sent\n", action));
+        break;
+
+    }
+    return SNMP_ERR_NOERROR;
+}
+
+/*
+ * this documents how to send a SNMPv2 (and higher) trap via the
+ * send_v2trap() API.
+ * 
+ * Coding SNMP-v2 Trap:
+ * 
+ * The SNMPv2-Trap PDU contains at least a pair of object names and
+ * values: - sysUpTime.0 whose value is the time in hundredths of a
+ * second since the netwok management portion of system was last
+ * reinitialized.  - snmpTrapOID.0 which is part of the trap group SNMPv2
+ * MIB whose value is the object-id of the specific trap you have defined
+ * in your own MIB.  Other variables can be added to caracterize the
+ * trap.
+ * 
+ * The function send_v2trap adds automaticallys the two objects but the
+ * value of snmpTrapOID.0 is 0.0 by default. If you want to add your trap
+ * name, you have to reconstruct this object and to add your own
+ * variable.
+ * 
+ */
+
+
+
+int
+write_exampletrap2(int action,
+                   u_char * var_val,
+                   u_char var_val_type,
+                   size_t var_val_len,
+                   u_char * statP, oid * name, size_t name_len)
+{
+    long            intval;
+
+    /*
+     * these variales will be used when we send the trap 
+     */
+    oid             objid_snmptrap[] = { 1, 3, 6, 1, 6, 3, 1, 1, 4, 1, 0 };     /* snmpTrapOID.0 */
+    oid             demo_trap[] = { 1, 3, 6, 1, 4, 1, 2021, 13, 990 };  /*demo-trap */
+    oid             example_string_oid[] =
+        { 1, 3, 6, 1, 4, 1, 2021, 254, 1, 0 };
+    static netsnmp_variable_list var_trap;
+    static netsnmp_variable_list var_obj;
+
+    DEBUGMSGTL(("example", "write_exampletrap2 entered: action=%d\n",
+                action));
+    switch (action) {
+    case RESERVE1:
+        /*
+         *  The only acceptable value is the integer 1
+         */
+        if (var_val_type != ASN_INTEGER) {
+            DEBUGMSGTL(("example", "%x not integer type", var_val_type));
+            return SNMP_ERR_WRONGTYPE;
+        }
+        if (var_val_len > sizeof(long)) {
+            DEBUGMSGTL(("example", "wrong length %x", var_val_len));
+            return SNMP_ERR_WRONGLENGTH;
+        }
+
+        intval = *((long *) var_val);
+        if (intval != 1) {
+            DEBUGMSGTL(("example", "wrong value %x", intval));
+            return SNMP_ERR_WRONGVALUE;
+        }
+        break;
+
+    case RESERVE2:
+        /*
+         * No resources are required.... 
+         */
+        break;
+
+    case FREE:
+        /*
+         * ... so no resources need be freed 
+         */
+        break;
+
+    case ACTION:
+        /*
+         *  Having triggered the sending of a trap,
+         *   it would be impossible to revoke this,
+         *   so we can't actually invoke the action here.
+         */
+        break;
+
+    case UNDO:
+        /*
+         * We haven't done anything yet,
+         * so there's nothing to undo 
+         */
+        break;
+
+    case COMMIT:
+        /*
+         *  Everything else worked, so it's now safe
+         *   to trigger the trap.
+         *  Note that this is *only* acceptable since
+         *   the trap sending routines are "failsafe".
+         *  (In fact, they can fail, but they return no
+         *   indication of this, which is the next best thing!)
+         */
+
+        /*
+         * trap definition objects 
+         */
+
+        var_trap.next_variable = &var_obj;      /* next variable */
+        var_trap.name = objid_snmptrap; /* snmpTrapOID.0 */
+        var_trap.name_length = sizeof(objid_snmptrap) / sizeof(oid);    /* number of sub-ids */
+        var_trap.type = ASN_OBJECT_ID;
+        var_trap.val.objid = demo_trap; /* demo-trap objid */
+        var_trap.val_len = sizeof(demo_trap);   /* length in bytes (not number of subids!) */
+
+
+        /*
+         * additional objects 
+         */
+
+
+        var_obj.next_variable = NULL;   /* No more variables after this one */
+        var_obj.name = example_string_oid;
+        var_obj.name_length = sizeof(example_string_oid) / sizeof(oid); /* number of sub-ids */
+        var_obj.type = ASN_OCTET_STR;   /* type of variable */
+        var_obj.val.string = example_str;       /* value */
+        var_obj.val_len = strlen(example_str);
+        DEBUGMSGTL(("example", "write_exampletrap2 sending the v2 trap\n",
+                    action));
+        send_v2trap(&var_trap);
+        DEBUGMSGTL(("example", "write_exampletrap2 v2 trap sent\n",
+                    action));
+
+        break;
+
+    }
+    return SNMP_ERR_NOERROR;
+}
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/examples/example.h tomato121/release/src/router/snmp/agent/mibgroup/examples/example.h
--- tomato/release/src/router/snmp/agent/mibgroup/examples/example.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/examples/example.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,59 @@
+/*
+ *  Template MIB group interface - example.h
+ *
+ */
+
+/*
+ * Don't include ourselves twice 
+ */
+#ifndef _MIBGROUP_EXAMPLE_H
+#define _MIBGROUP_EXAMPLE_H
+
+    /*
+     * We use 'header_generic' from the util_funcs module,
+     *  so make sure this module is included in the agent.
+     */
+config_require(util_funcs)
+
+
+    /*
+     * Declare our publically-visible functions.
+     * Typically, these will include the initialization and shutdown functions,
+     *  the main request callback routine and any writeable object methods.
+     *
+     * Function prototypes are provided for the callback routine ('FindVarMethod')
+     *  and writeable object methods ('WriteMethod').
+     */
+     extern void     init_example(void);
+     extern FindVarMethod var_example;
+     extern WriteMethod write_exampleint;
+     extern WriteMethod write_exampletrap;
+     extern WriteMethod write_exampletrap2;
+
+
+    /*
+     * Magic number definitions.
+     * These must be unique for each object implemented within a
+     *  single mib module callback routine.
+     *
+     * Typically, these will be the last OID sub-component for
+     *  each entry, or integers incrementing from 1.
+     *  (which may well result in the same values anyway).
+     *
+     * Here, the second and third objects are form a 'sub-table' and
+     *   the magic numbers are chosen to match these OID sub-components.
+     * This is purely for programmer convenience.
+     * All that really matters is that the numbers are unique.
+     */
+
+#define	EXAMPLESTRING		1
+#define EXAMPLEINTEGER		21
+#define	EXAMPLEOBJECTID         22
+#define EXAMPLETIMETICKS	3
+#define	EXAMPLEIPADDRESS        4
+#define EXAMPLECOUNTER		5
+#define	EXAMPLEGAUGE            6
+#define	EXAMPLETRIGGERTRAP      7
+#define	EXAMPLETRIGGERTRAP2     8
+
+#endif                          /* _MIBGROUP_EXAMPLE_H */
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/examples/Makefile.dlmod tomato121/release/src/router/snmp/agent/mibgroup/examples/Makefile.dlmod
--- tomato/release/src/router/snmp/agent/mibgroup/examples/Makefile.dlmod	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/examples/Makefile.dlmod	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,34 @@
+#
+# Makefile for dynamically loadable module `example'
+#
+#DLMODDIR	= $(libdir)/snmp/dlmod
+#UCDTOPDIR	= $(top_srcdir)
+DLMODDIR	= /usr/local/lib/snmp/dlmod
+UCDTOPDIR	= /usr/home/strauss/src/ucd-snmp-ibr
+TARG		= example.so
+OBJS		= example.o
+CC		= gcc
+CFLAGS		= -I$(UCDTOPDIR) -I$(UCDTOPDIR)/snmplib -I$(UCDTOPDIR)/agent -I$(UCDTOPDIR)/agent/mibgroup -shared -fPIC
+#LD		= ld
+#LDFLAGS		= -G -o
+LD		= gcc -shared -o
+LDFLAGS		= 
+INSTALL		= install
+LIBS		= 
+
+all: $(TARG)
+
+.c.o:
+	$(CC) $(CFLAGS) -o $@ -c $<
+
+$(TARG): $(OBJS)
+	$(LD) $(LDFLAGS) $@ $(OBJS) $(LIBS)
+
+clean:
+	rm -f $(OBJS) $(TARG)
+
+install: all installdirs
+	$(INSTALL) $(TARG) $(DLMODDIR)
+
+installdirs:
+	@$(SHELL) $(UCDTOPDIR)/mkinstalldirs $(DLMODDIR)
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/examples/notification.c tomato121/release/src/router/snmp/agent/mibgroup/examples/notification.c
--- tomato/release/src/router/snmp/agent/mibgroup/examples/notification.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/examples/notification.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,120 @@
+/** @example notification.c
+ *  This example shows how to send a notification from inside the
+ *  agent.  In this case we do something really boring to decide
+ *  whether to send a notification or not: we simply sleep for 30
+ *  seconds and send it, then we sleep for 30 more and send it again.
+ *  We do this through the snmp_alarm mechanisms (which are safe to
+ *  use within the agent.  Don't use the system alarm() call, it won't
+ *  work properly).  Normally, you would probably want to do something
+ *  to test whether or not to send an alarm, based on the type of mib
+ *  module you were creating.
+ *
+ *  When this module is compiled into the agent (run configure with
+ *  --with-mib-modules="examples/notification") then it should send
+ *  out traps, which when received by the snmptrapd demon will look
+ *  roughly like:
+ *
+ *  2002-05-08 08:57:05 localhost.localdomain [udp:127.0.0.1:32865]:
+ *      sysUpTimeInstance = Timeticks: (3803) 0:00:38.03        snmpTrapOID.0 = OID: netSnmpExampleNotification
+ *
+ */
+
+/*
+ * start be including the appropriate header files 
+ */
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+/*
+ * contains prototypes 
+ */
+#include "notification.h"
+
+/*
+ * our alarm prototype 
+ */
+
+
+/*
+ * our initialization routine
+ * (to get called, the function name must match init_FILENAME() 
+ */
+void
+init_notification(void)
+{
+    DEBUGMSGTL(("example_notification",
+                "initializing (setting callback alarm)\n"));
+    snmp_alarm_register(30,     /* seconds */
+                        SA_REPEAT,      /* repeat (every 30 seconds). */
+                        send_example_notification,      /* our callback */
+                        NULL    /* no callback data needed */
+        );
+}
+
+/** here we send a SNMP v2 trap (which can be sent through snmpv3 and
+ *  snmpv1 as well) and send it out. */
+void
+send_example_notification(unsigned int clientreg, void *clientarg)
+{
+    /*
+     * define the OID for the notification we're going to send
+     * NET-SNMP-EXAMPLES-MIB::netSnmpExampleNotification 
+     */
+    oid             notification_oid[] =
+        { 1, 3, 6, 1, 4, 1, 8072, 2, 3, 1 };
+    size_t          notification_oid_len = OID_LENGTH(notification_oid);
+
+    /*
+     * In the notification, we have to assign our notification OID to
+     * the snmpTrapOID.0 object. Here is it's definition. 
+     */
+    oid             objid_snmptrap[] = { 1, 3, 6, 1, 6, 3, 1, 1, 4, 1, 0 };
+    size_t          objid_snmptrap_len = OID_LENGTH(objid_snmptrap);
+
+    /*
+     * here is where we store the variables to be sent in the trap 
+     */
+    netsnmp_variable_list *notification_vars = NULL;
+
+    DEBUGMSGTL(("example_notification", "defining the trap\n"));
+
+    /*
+     * add in the trap definition object 
+     */
+    snmp_varlist_add_variable(&notification_vars,
+                              /*
+                               * the snmpTrapOID.0 variable 
+                               */
+                              objid_snmptrap, objid_snmptrap_len,
+                              /*
+                               * value type is an OID 
+                               */
+                              ASN_OBJECT_ID,
+                              /*
+                               * value contents is our notification OID 
+                               */
+                              (u_char *) notification_oid,
+                              /*
+                               * size in bytes = oid length * sizeof(oid) 
+                               */
+                              notification_oid_len * sizeof(oid));
+
+    /*
+     * if we wanted to insert additional objects, we'd do it here 
+     */
+
+    /*
+     * send the trap out.  This will send it to all registered
+     * receivers (see the "SETTING UP TRAP AND/OR INFORM DESTINATIONS"
+     * section of the snmpd.conf manual page. 
+     */
+    DEBUGMSGTL(("example_notification", "sending the trap\n"));
+    send_v2trap(notification_vars);
+
+    /*
+     * free the created notification variable list 
+     */
+    DEBUGMSGTL(("example_notification", "cleaning up\n"));
+    snmp_free_varbind(notification_vars);
+}
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/examples/notification.h tomato121/release/src/router/snmp/agent/mibgroup/examples/notification.h
--- tomato/release/src/router/snmp/agent/mibgroup/examples/notification.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/examples/notification.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,8 @@
+#ifndef NOTIFICATION_H
+#define NOTIFICATION_H
+
+/* prototypes for the example */
+void init_notification(void);
+SNMPAlarmCallback send_example_notification;
+
+#endif /* NOTIFICATION_H */
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/examples/scalar_int.c tomato121/release/src/router/snmp/agent/mibgroup/examples/scalar_int.c
--- tomato/release/src/router/snmp/agent/mibgroup/examples/scalar_int.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/examples/scalar_int.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,77 @@
+/**  @example scalar_int.c
+ *  This example creates some scalar registrations that allows
+ *  some simple variables to be accessed via SNMP.  In a more
+ *  realistic example, it is likely that these variables would also be
+ *  manipulated in other ways outside of SNMP gets/sets.
+ *
+ *  If this module is compiled into an agent, you should be able to
+ *  issue snmp commands that look something like (authentication
+ *  information not shown in these commands):
+ *
+ *  - snmpget localhost netSnmpExampleInteger.0
+ *  - netSnmpExampleScalars = 42
+ *
+ *  - snmpset localhost netSnmpExampleInteger.0 = 1234
+ *  - netSnmpExampleScalars = 1234
+ *  
+ *  - snmpget localhost netSnmpExampleInteger.0
+ *  - netSnmpExampleScalars = 1234
+ *
+ */
+
+/*
+ * start be including the appropriate header files 
+ */
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+/*
+ * Then, we declare the variables we want to be accessed 
+ */
+static int      example1 = 42;  /* default value */
+
+/*
+ * our initialization routine, automatically called by the agent 
+ * (to get called, the function name must match init_FILENAME())
+ */
+void
+init_scalar_int(void)
+{
+    /*
+     * the OID we want to register our integer at.  This should be a
+     * fully qualified instance.  In our case, it's a scalar at:
+     * NET-SNMP-EXAMPLES-MIB::netSnmpExampleInteger.0 (note the
+     * trailing 0 which is required for any instantiation of any
+     * scalar object) 
+     */
+    oid             my_registration_oid[] =
+        { 1, 3, 6, 1, 4, 1, 8072, 2, 1, 1, 0 };
+
+    /*
+     * a debugging statement.  Run the agent with -Dexample_scalar_int to see
+     * the output of this debugging statement. 
+     */
+    DEBUGMSGTL(("example_scalar_int",
+                "Initalizing example scalar int.  Default value = %d\n",
+                example1));
+
+    /*
+     * the line below registers our "example1" variable above as
+     * accessible and makes it writable.  A read only version of the
+     * same registration would merely call
+     * register_read_only_int_instance() instead.
+     * 
+     * If we wanted a callback when the value was retrieved or set
+     * (even though the details of doing this are handled for you),
+     * you could change the NULL pointer below to a valid handler
+     * function. 
+     */
+    netsnmp_register_int_instance("my example int variable",
+                                  my_registration_oid,
+                                  OID_LENGTH(my_registration_oid),
+                                  &example1, NULL);
+
+    DEBUGMSGTL(("example_scalar_int",
+                "Done initalizing example scalar int\n"));
+}
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/examples/scalar_int.h tomato121/release/src/router/snmp/agent/mibgroup/examples/scalar_int.h
--- tomato/release/src/router/snmp/agent/mibgroup/examples/scalar_int.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/examples/scalar_int.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,6 @@
+#ifndef SCALAR_INT_H
+#define SCALAR_INT_H
+
+void            init_example_scalar(void);
+
+#endif                          /* SCALAR_INT_H */
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/examples/ucdDemoPublic.c tomato121/release/src/router/snmp/agent/mibgroup/examples/ucdDemoPublic.c
--- tomato/release/src/router/snmp/agent/mibgroup/examples/ucdDemoPublic.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/examples/ucdDemoPublic.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,228 @@
+/*
+ * ucdDemoPublic.c 
+ */
+
+#include <net-snmp/net-snmp-config.h>
+#if HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#if HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+
+#if TIME_WITH_SYS_TIME
+# ifdef WIN32
+#  include <sys/timeb.h>
+# else
+#  include <sys/time.h>
+# endif
+# include <time.h>
+#else
+# if HAVE_SYS_TIME_H
+#  include <sys/time.h>
+# else
+#  include <time.h>
+# endif
+#endif
+
+#if HAVE_WINSOCK_H
+#include <winsock.h>
+#endif
+
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+#include "util_funcs.h"
+#include "ucdDemoPublic.h"
+
+#define MYMAX 1024
+#define MAXUSERS 10
+
+int             num = 0;
+static char     demoUsers[MAXUSERS][MYMAX + 1];
+static char     demopass[MYMAX + 1];
+
+void
+ucdDemo_parse_user(const char *word, char *line)
+{
+    if (num == MAXUSERS)
+        return;
+
+    if (strlen(line) > MYMAX)
+        return;
+
+    strcpy(demoUsers[num++], line);
+}
+
+
+void
+ucdDemo_parse_userpass(const char *word, char *line)
+{
+    if (strlen(line) > MYMAX)
+        return;
+
+    strcpy(demopass, line);
+}
+
+/*
+ * this variable defines function callbacks and type return information 
+ * for the ucdDemoPublic mib 
+ */
+
+struct variable2 ucdDemoPublic_variables[] = {
+    {UCDDEMORESETKEYS, ASN_INTEGER, RWRITE, var_ucdDemoPublic, 1, {1}},
+    {UCDDEMOPUBLICSTRING, ASN_OCTET_STR, RWRITE, var_ucdDemoPublic, 1,
+     {2}},
+    {UCDDEMOUSERLIST, ASN_OCTET_STR, RWRITE, var_ucdDemoPublic, 1, {3}},
+    {UCDDEMOPASSPHRASE, ASN_OCTET_STR, RWRITE, var_ucdDemoPublic, 1, {4}},
+
+};
+
+/*
+ * Define the OID pointer to the top of the mib tree that we're
+ * registering underneath 
+ */
+oid             ucdDemoPublic_variables_oid[] =
+    { 1, 3, 6, 1, 4, 1, 2021, 14, 1, 1 };
+
+void
+init_ucdDemoPublic(void)
+{
+    REGISTER_MIB("examples/ucdDemoPublic", ucdDemoPublic_variables,
+                 variable2, ucdDemoPublic_variables_oid);
+    snmpd_register_config_handler("demoUser",
+                                  ucdDemo_parse_user, NULL, "USER");
+    snmpd_register_config_handler("demoPass",
+                                  ucdDemo_parse_userpass, NULL,
+                                  "PASSPHASE");
+}
+
+unsigned char   publicString[MYMAX + 1];
+
+unsigned char  *
+var_ucdDemoPublic(struct variable *vp,
+                  oid * name,
+                  size_t * length,
+                  int exact, size_t * var_len, WriteMethod ** write_method)
+{
+    static long     long_ret;
+    static char     string[MYMAX + 1], *cp;
+    int             i;
+
+    *write_method = 0;          /* assume it isnt writable for the time being */
+    *var_len = sizeof(long_ret);        /* assume an integer and change later if not */
+
+    if (header_generic(vp, name, length, exact, var_len, write_method))
+        return 0;
+
+    /*
+     * this is where we do the value assignments for the mib results. 
+     */
+    switch (vp->magic) {
+
+    case UCDDEMORESETKEYS:
+        *write_method = write_ucdDemoResetKeys;
+        long_ret = 0;
+        return (unsigned char *) &long_ret;
+
+    case UCDDEMOPUBLICSTRING:
+        *write_method = write_ucdDemoPublicString;
+        *var_len = strlen(publicString);
+        return (unsigned char *) publicString;
+
+    case UCDDEMOUSERLIST:
+        cp = string;
+        for (i = 0; i < num; i++) {
+            snprintf(cp, sizeof(string)-strlen(string), " %s", demoUsers[i]);
+            string[MYMAX] = 0;
+            cp = cp + strlen(cp);
+        }
+        *var_len = strlen(string);
+        return (unsigned char *) string;
+
+    case UCDDEMOPASSPHRASE:
+        *var_len = strlen(demopass);
+        return (unsigned char *) demopass;
+
+    default:
+        DEBUGMSGTL(("snmpd", "unknown sub-id %d in var_ucdDemoPublic\n",
+                    vp->magic));
+    }
+    return 0;
+}
+
+int
+write_ucdDemoResetKeys(int action,
+                       u_char * var_val,
+                       u_char var_val_type,
+                       size_t var_val_len,
+                       u_char * statP, oid * name, size_t name_len)
+{
+    /*
+     * variables we may use later 
+     */
+    static long     long_ret;
+    unsigned char  *engineID;
+    size_t          engineIDLen;
+    int             i;
+    struct usmUser *user;
+
+    if (var_val_type != ASN_INTEGER) {
+        DEBUGMSGTL(("ucdDemoPublic",
+                    "write to ucdDemoResetKeys not ASN_INTEGER\n"));
+        return SNMP_ERR_WRONGTYPE;
+    }
+    if (var_val_len > sizeof(long_ret)) {
+        DEBUGMSGTL(("ucdDemoPublic",
+                    "write to ucdDemoResetKeys: bad length\n"));
+        return SNMP_ERR_WRONGLENGTH;
+    }
+    if (action == COMMIT) {
+        long_ret = *((long *) var_val);
+        if (long_ret == 1) {
+            engineID = snmpv3_generate_engineID(&engineIDLen);
+            for (i = 0; i < num; i++) {
+                user = usm_get_user(engineID, engineIDLen, demoUsers[i]);
+                if (user) {
+                    usm_set_user_password(user, "userSetAuthPass",
+                                          demopass);
+                    usm_set_user_password(user, "userSetPrivPass",
+                                          demopass);
+                }
+            }
+            /*
+             * reset the keys 
+             */
+        }
+    }
+    return SNMP_ERR_NOERROR;
+}
+
+int
+write_ucdDemoPublicString(int action,
+                          u_char * var_val,
+                          u_char var_val_type,
+                          size_t var_val_len,
+                          u_char * statP, oid * name, size_t name_len)
+{
+    if (var_val_type != ASN_OCTET_STR) {
+        DEBUGMSGTL(("ucdDemoPublic",
+                    "write to ucdDemoPublicString not ASN_OCTET_STR\n"));
+        return SNMP_ERR_WRONGTYPE;
+    }
+    if (var_val_len > MYMAX) {
+        DEBUGMSGTL(("ucdDemoPublic",
+                    "write to ucdDemoPublicString: bad length\n"));
+        return SNMP_ERR_WRONGLENGTH;
+    }
+    if (action == COMMIT) {
+        if (var_val_len != 0) {
+            strcpy(publicString, var_val);
+            publicString[var_val_len] = '\0';
+        } else
+            publicString[0] = '\0';
+    }
+    return SNMP_ERR_NOERROR;
+}
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/examples/ucdDemoPublic.cmds tomato121/release/src/router/snmp/agent/mibgroup/examples/ucdDemoPublic.cmds
--- tomato/release/src/router/snmp/agent/mibgroup/examples/ucdDemoPublic.cmds	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/examples/ucdDemoPublic.cmds	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,8 @@
+#!/bin/sh
+
+snmpusm -e 800007e501d0d6a623 -v 3 -p 1633 localhost create noAuthUser
+snmpusm -e 800007e501d0d6a623 -v 3 -p 1633 localhost create MD5DESUser templateMD5
+snmpusm -e 800007e501d0d6a623 -v 3 -p 1633 localhost create SHADESUser templateSHA
+snmpusm -e 800007e501d0d6a623 -v 3 -p 1633 localhost create MD5User templateMD5
+snmpusm -e 800007e501d0d6a623 -v 3 -p 1633 localhost create SHAUser templateSHA
+snmpset -R -v 3 -p 1633 localhost usmUserPrivProtocol.9.128.0.7.229.1.208.214.166.35.7.77.68.53.85.115.101.114 o .1.3.6.1.6.3.10.1.2.1 usmUserPrivProtocol.9.128.0.7.229.1.208.214.166.35.7.83.72.65.85.115.101.114 o .1.3.6.1.6.3.10.1.2.1
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/examples/ucdDemoPublic.conf tomato121/release/src/router/snmp/agent/mibgroup/examples/ucdDemoPublic.conf
--- tomato/release/src/router/snmp/agent/mibgroup/examples/ucdDemoPublic.conf	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/examples/ucdDemoPublic.conf	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,27 @@
+group demogroup usm noAuthUser
+group demogroup usm MD5User
+group demogroup usm SHAUser
+group demogroup usm MD5DESUser
+group demogroup usm SHADESUser
+
+view demoview included .1.3.6.1.4.1.2021.14.1.1
+view demoview included .1.2.6.1.2.1.1
+
+view demowrite included .1.3.6.1.4.1.2021.14.1.1
+
+view demowrite included .1.3.6.1.6.3.12.1.2.2.1.10.9.128.0.7.229.1.208.214.166.35.7.77.68.53.85.115.101.114
+view demowrite included .1.3.6.1.6.3.12.1.2.2.1.10.9.128.0.7.229.1.208.214.166.35.7.83.72.65.85.115.101.114
+view demowrite included .1.3.6.1.6.3.12.1.2.2.1.10.9.128.0.7.229.1.208.214.166.35.10.77.68.53.68.69.83.85.115.101.114
+view demowrite included .1.3.6.1.6.3.12.1.2.2.1.10.9.128.0.7.229.1.208.214.166.35.10.83.72.65.68.69.83.85.115.101.114
+view demowrite included .1.3.6.1.6.3.12.1.2.2.1.10.9.128.0.7.229.1.208.214.166.35.10.110.111.65.117.116.104.85.115.101.114
+
+access demogroup "" any noauth prefix demoview demowrite none
+
+demoUser noAuthUser
+demoUser MD5User
+demoUser MD5DESUser
+demoUser SHAUser
+demoUser SHADESUser
+demoPass The Net-SNMP Demo Password
+
+
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/examples/ucdDemoPublic.h tomato121/release/src/router/snmp/agent/mibgroup/examples/ucdDemoPublic.h
--- tomato/release/src/router/snmp/agent/mibgroup/examples/ucdDemoPublic.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/examples/ucdDemoPublic.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,30 @@
+/*
+ * ucdDemoPublic.h 
+ */
+
+#ifndef _MIBGROUP_UCDDEMOPUBLIC_H
+#define _MIBGROUP_UCDDEMOPUBLIC_H
+
+/*
+ * we use header_generic and checkmib from the util_funcs module 
+ */
+
+config_require(util_funcs)
+
+    /*
+     * Magic number definitions: 
+     */
+#define   UCDDEMORESETKEYS      1
+#define   UCDDEMOPUBLICSTRING   2
+#define   UCDDEMOUSERLIST       3
+#define   UCDDEMOPASSPHRASE     4
+    /*
+     * function definitions 
+     */
+     extern void     init_ucdDemoPublic(void);
+     extern FindVarMethod var_ucdDemoPublic;
+     WriteMethod     write_ucdDemoResetKeys;
+     WriteMethod     write_ucdDemoPublicString;
+
+
+#endif                          /* _MIBGROUP_UCDDEMOPUBLIC_H */
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/examples.h tomato121/release/src/router/snmp/agent/mibgroup/examples.h
--- tomato/release/src/router/snmp/agent/mibgroup/examples.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/examples.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,3 @@
+config_require(examples/scalar_int)
+config_require(examples/data_set)
+config_require(examples/delayed_instance)
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/header_complex.c tomato121/release/src/router/snmp/agent/mibgroup/header_complex.c
--- tomato/release/src/router/snmp/agent/mibgroup/header_complex.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/header_complex.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,582 @@
+/*
+ * header complex:  More complex storage and data sorting for mib modules 
+ */
+
+#include <net-snmp/net-snmp-config.h>
+
+#include <sys/types.h>
+#if HAVE_WINSOCK_H
+#include <winsock.h>
+#endif
+#if HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#if HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include "header_complex.h"
+
+int
+header_complex_generate_varoid(netsnmp_variable_list * var)
+{
+    int             i;
+
+    if (var->name == NULL) {
+        /*
+         * assume cached value is correct 
+         */
+        switch (var->type) {
+        case ASN_INTEGER:
+        case ASN_COUNTER:
+        case ASN_GAUGE:
+        case ASN_TIMETICKS:
+            var->name_length = 1;
+            var->name = (oid *) malloc(sizeof(oid));
+            if (var->name == NULL)
+                return SNMPERR_GENERR;
+            var->name[0] = *(var->val.integer);
+            break;
+
+        case ASN_PRIV_IMPLIED_OBJECT_ID:
+            var->name_length = var->val_len / sizeof(oid);
+            var->name = (oid *) malloc(sizeof(oid) * (var->name_length));
+            if (var->name == NULL)
+                return SNMPERR_GENERR;
+
+            for (i = 0; i < (int) var->name_length; i++)
+                var->name[i] = var->val.objid[i];
+            break;
+
+        case ASN_OBJECT_ID:
+            var->name_length = var->val_len / sizeof(oid) + 1;
+            var->name = (oid *) malloc(sizeof(oid) * (var->name_length));
+            if (var->name == NULL)
+                return SNMPERR_GENERR;
+
+            var->name[0] = var->name_length - 1;
+            for (i = 0; i < (int) var->name_length - 1; i++)
+                var->name[i + 1] = var->val.objid[i];
+            break;
+
+        case ASN_PRIV_IMPLIED_OCTET_STR:
+            var->name_length = var->val_len;
+            var->name = (oid *) malloc(sizeof(oid) * (var->name_length));
+            if (var->name == NULL)
+                return SNMPERR_GENERR;
+
+            for (i = 0; i < (int) var->val_len; i++)
+                var->name[i] = (oid) var->val.string[i];
+            break;
+
+        case ASN_OPAQUE:
+        case ASN_OCTET_STR:
+            var->name_length = var->val_len + 1;
+            var->name = (oid *) malloc(sizeof(oid) * (var->name_length));
+            if (var->name == NULL)
+                return SNMPERR_GENERR;
+
+            var->name[0] = (oid) var->val_len;
+            for (i = 0; i < (int) var->val_len; i++)
+                var->name[i + 1] = (oid) var->val.string[i];
+            break;
+
+        default:
+            DEBUGMSGTL(("header_complex_generate_varoid",
+                        "invalid asn type: %d\n", var->type));
+            return SNMPERR_GENERR;
+        }
+    }
+    if (var->name_length > MAX_OID_LEN) {
+        DEBUGMSGTL(("header_complex_generate_varoid",
+                    "Something terribly wrong, namelen = %d\n",
+                    var->name_length));
+        return SNMPERR_GENERR;
+    }
+
+    return SNMPERR_SUCCESS;
+}
+
+/*
+ * header_complex_parse_oid(): parses an index to the usmTable to
+ * break it down into a engineID component and a name component.
+ * The results are stored in the data pointer, as a varbindlist:
+ * 
+ * 
+ * returns 1 if an error is encountered, or 0 if successful.
+ */
+int
+header_complex_parse_oid(oid * oidIndex, size_t oidLen,
+                         netsnmp_variable_list * data)
+{
+    netsnmp_variable_list *var = data;
+    int             i, itmp;
+
+    while (var && oidLen > 0) {
+        switch (var->type) {
+        case ASN_INTEGER:
+        case ASN_COUNTER:
+        case ASN_GAUGE:
+        case ASN_TIMETICKS:
+            var->val.integer = (long *) calloc(1, sizeof(long));
+            if (var->val.string == NULL)
+                return SNMPERR_GENERR;
+
+            *var->val.integer = (long) *oidIndex++;
+            var->val_len = sizeof(long);
+            oidLen--;
+            DEBUGMSGTL(("header_complex_parse_oid",
+                        "Parsed int(%d): %d\n", var->type,
+                        *var->val.integer));
+            break;
+
+        case ASN_OBJECT_ID:
+        case ASN_PRIV_IMPLIED_OBJECT_ID:
+            if (var->type == ASN_PRIV_IMPLIED_OBJECT_ID) {
+                itmp = oidLen;
+            } else {
+                itmp = (long) *oidIndex++;
+                oidLen--;
+                if (itmp > (int) oidLen)
+                    return SNMPERR_GENERR;
+            }
+
+            if (itmp == 0)
+                break;          /* zero length strings shouldn't malloc */
+
+            var->val_len = itmp * sizeof(oid);
+            var->val.objid = (oid *) calloc(1, var->val_len);
+            if (var->val.objid == NULL)
+                return SNMPERR_GENERR;
+
+            for (i = 0; i < itmp; i++)
+                var->val.objid[i] = (u_char) * oidIndex++;
+            oidLen -= itmp;
+
+            DEBUGMSGTL(("header_complex_parse_oid", "Parsed oid: "));
+            DEBUGMSGOID(("header_complex_parse_oid", var->val.objid,
+                         var->val_len / sizeof(oid)));
+            DEBUGMSG(("header_complex_parse_oid", "\n"));
+            break;
+
+        case ASN_OPAQUE:
+        case ASN_OCTET_STR:
+        case ASN_PRIV_IMPLIED_OCTET_STR:
+            if (var->type == ASN_PRIV_IMPLIED_OCTET_STR) {
+                itmp = oidLen;
+            } else {
+                itmp = (long) *oidIndex++;
+                oidLen--;
+                if (itmp > (int) oidLen)
+                    return SNMPERR_GENERR;
+            }
+
+            if (itmp == 0)
+                break;          /* zero length strings shouldn't malloc */
+
+            /*
+             * malloc by size+1 to allow a null to be appended. 
+             */
+            var->val_len = itmp;
+            var->val.string = (u_char *) calloc(1, itmp + 1);
+            if (var->val.string == NULL)
+                return SNMPERR_GENERR;
+
+            for (i = 0; i < itmp; i++)
+                var->val.string[i] = (u_char) * oidIndex++;
+            var->val.string[itmp] = '\0';
+            oidLen -= itmp;
+
+            DEBUGMSGTL(("header_complex_parse_oid",
+                        "Parsed str(%d): %s\n", var->type,
+                        var->val.string));
+            break;
+
+        default:
+            DEBUGMSGTL(("header_complex_parse_oid",
+                        "invalid asn type: %d\n", var->type));
+            return SNMPERR_GENERR;
+        }
+        var = var->next_variable;
+    }
+    if (var != NULL || oidLen > 0)
+        return SNMPERR_GENERR;
+    return SNMPERR_SUCCESS;
+}
+
+
+void
+header_complex_generate_oid(oid * name, /* out */
+                            size_t * length,    /* out */
+                            oid * prefix,
+                            size_t prefix_len,
+                            netsnmp_variable_list * data)
+{
+
+    oid            *oidptr;
+    netsnmp_variable_list *var;
+
+    if (prefix) {
+        memcpy(name, prefix, prefix_len * sizeof(oid));
+        oidptr = (name + (prefix_len));
+        *length = prefix_len;
+    } else {
+        oidptr = name;
+        *length = 0;
+    }
+
+    for (var = data; var != NULL; var = var->next_variable) {
+        header_complex_generate_varoid(var);
+        memcpy(oidptr, var->name, sizeof(oid) * var->name_length);
+        oidptr = oidptr + var->name_length;
+        *length += var->name_length;
+    }
+
+    DEBUGMSGTL(("header_complex_generate_oid", "generated: "));
+    DEBUGMSGOID(("header_complex_generate_oid", name, *length));
+    DEBUGMSG(("header_complex_generate_oid", "\n"));
+}
+
+/*
+ * finds the data in "datalist" stored at "index" 
+ */
+void           *
+header_complex_get(struct header_complex_index *datalist,
+                   netsnmp_variable_list * index)
+{
+    oid             searchfor[MAX_OID_LEN];
+    size_t          searchfor_len;
+
+    header_complex_generate_oid(searchfor,      /* out */
+                                &searchfor_len, /* out */
+                                NULL, 0, index);
+    return header_complex_get_from_oid(datalist, searchfor, searchfor_len);
+}
+
+void           *
+header_complex_get_from_oid(struct header_complex_index *datalist,
+                            oid * searchfor, size_t searchfor_len)
+{
+    struct header_complex_index *nptr;
+    for (nptr = datalist; nptr != NULL; nptr = nptr->next) {
+        if (netsnmp_oid_equals(searchfor, searchfor_len,
+                             nptr->name, nptr->namelen) == 0)
+            return nptr->data;
+    }
+    return NULL;
+}
+
+
+void           *
+header_complex(struct header_complex_index *datalist,
+               struct variable *vp,
+               oid * name,
+               size_t * length,
+               int exact, size_t * var_len, WriteMethod ** write_method)
+{
+
+    struct header_complex_index *nptr, *found = NULL;
+    oid             indexOid[MAX_OID_LEN];
+    size_t          len;
+    int             result;
+
+    /*
+     * set up some nice defaults for the user 
+     */
+    if (write_method)
+        *write_method = NULL;
+    if (var_len)
+        *var_len = sizeof(long);
+
+    for (nptr = datalist; nptr != NULL && found == NULL; nptr = nptr->next) {
+        if (vp) {
+            memcpy(indexOid, vp->name, vp->namelen * sizeof(oid));
+            memcpy(indexOid + vp->namelen, nptr->name,
+                   nptr->namelen * sizeof(oid));
+            len = vp->namelen + nptr->namelen;
+        } else {
+            memcpy(indexOid, nptr->name, nptr->namelen * sizeof(oid));
+            len = nptr->namelen;
+        }
+        result = snmp_oid_compare(name, *length, indexOid, len);
+        DEBUGMSGTL(("header_complex", "Checking: "));
+        DEBUGMSGOID(("header_complex", indexOid, len));
+        DEBUGMSG(("header_complex", "\n"));
+
+        if (exact) {
+            if (result == 0) {
+                found = nptr;
+            }
+        } else {
+            if (result == 0) {
+                /*
+                 * found an exact match.  Need the next one for !exact 
+                 */
+                if (nptr->next)
+                    found = nptr->next;
+            } else if (result == -1) {
+                found = nptr;
+            }
+        }
+    }
+    if (found) {
+        if (vp) {
+            memcpy(name, vp->name, vp->namelen * sizeof(oid));
+            memcpy(name + vp->namelen, found->name,
+                   found->namelen * sizeof(oid));
+            *length = vp->namelen + found->namelen;
+        } else {
+            memcpy(name, found->name, found->namelen * sizeof(oid));
+            *length = found->namelen;
+        }
+        return found->data;
+    }
+
+    return NULL;
+}
+
+struct header_complex_index *
+header_complex_add_data(struct header_complex_index **thedata,
+                        netsnmp_variable_list * var, void *data)
+{
+    oid             newoid[MAX_OID_LEN];
+    size_t          newoid_len;
+    struct header_complex_index *ret;
+
+    if (thedata == NULL || var == NULL || data == NULL)
+        return NULL;
+
+    header_complex_generate_oid(newoid, &newoid_len, NULL, 0, var);
+    ret =
+        header_complex_add_data_by_oid(thedata, newoid, newoid_len, data);
+    /*
+     * free the variable list, but not the enclosed data!  it's not ours! 
+     */
+    snmp_free_varbind(var);
+    return (ret);
+}
+
+struct header_complex_index *
+header_complex_add_data_by_oid(struct header_complex_index **thedata,
+                               oid * newoid, size_t newoid_len, void *data)
+{
+    struct header_complex_index *hciptrn, *hciptrp, *ourself;
+
+    if (thedata == NULL || newoid == NULL || data == NULL)
+        return NULL;
+
+    for (hciptrn = *thedata, hciptrp = NULL;
+         hciptrn != NULL; hciptrp = hciptrn, hciptrn = hciptrn->next)
+        /*
+         * XXX: check for == and error (overlapping table entries) 
+         */
+        if (snmp_oid_compare
+            (hciptrn->name, hciptrn->namelen, newoid, newoid_len)
+            > 0)
+            break;
+
+    /*
+     * nptr should now point to the spot that we need to add ourselves
+     * in front of, and pptr should be our new 'prev'. 
+     */
+
+    /*
+     * create ourselves 
+     */
+    ourself = (struct header_complex_index *)
+        SNMP_MALLOC_STRUCT(header_complex_index);
+
+    /*
+     * change our pointers 
+     */
+    ourself->prev = hciptrp;
+    ourself->next = hciptrn;
+
+    if (ourself->next)
+        ourself->next->prev = ourself;
+
+    if (ourself->prev)
+        ourself->prev->next = ourself;
+
+    ourself->data = data;
+    ourself->name = snmp_duplicate_objid(newoid, newoid_len);
+    ourself->namelen = newoid_len;
+
+    /*
+     * rewind to the head of the list and return it (since the new head
+     * could be us, we need to notify the above routine who the head now is. 
+     */
+    for (hciptrp = ourself; hciptrp->prev != NULL;
+         hciptrp = hciptrp->prev);
+
+    *thedata = hciptrp;
+    DEBUGMSGTL(("header_complex_add_data", "adding something...\n"));
+
+    return hciptrp;
+}
+
+/*
+ * extracts an entry from the storage space (removing it from future
+ * accesses) and returns the data stored there
+ * 
+ * Modifies "thetop" pointer as needed (and if present) if were
+ * extracting the first node.
+ */
+
+void           *
+header_complex_extract_entry(struct header_complex_index **thetop,
+                             struct header_complex_index *thespot)
+{
+    struct header_complex_index *hciptrp, *hciptrn;
+    void           *retdata = thespot->data;
+
+    if (thespot == NULL) {
+        DEBUGMSGTL(("header_complex_extract_entry",
+                    "Null pointer asked to be extracted\n"));
+        return NULL;
+    }
+
+    hciptrp = thespot->prev;
+    hciptrn = thespot->next;
+
+    if (hciptrp)
+        hciptrp->next = hciptrn;
+    else if (thetop)
+        *thetop = hciptrn;
+
+    if (hciptrn)
+        hciptrn->prev = hciptrp;
+
+    if (thespot->name)
+        free(thespot->name);
+
+    free(thespot);
+    return retdata;
+}
+
+/*
+ * wipe out a single entry 
+ */
+void
+header_complex_free_entry(struct header_complex_index *theentry,
+                          HeaderComplexCleaner * cleaner)
+{
+    void           *data;
+    data = header_complex_extract_entry(NULL, theentry);
+    (*cleaner) (data);
+}
+
+/*
+ * completely wipe out all entries in our data store 
+ */
+void
+header_complex_free_all(struct header_complex_index *thestuff,
+                        HeaderComplexCleaner * cleaner)
+{
+    struct header_complex_index *hciptr, *hciptrn;
+
+    for (hciptr = thestuff; hciptr != NULL; hciptr = hciptrn) {
+        hciptrn = hciptr->next; /* need to extract this before deleting it */
+        header_complex_free_entry(hciptr, cleaner);
+    }
+}
+
+struct header_complex_index *
+header_complex_find_entry(struct header_complex_index *thestuff,
+                          void *theentry)
+{
+    struct header_complex_index *hciptr;
+
+    for (hciptr = thestuff; hciptr != NULL && hciptr->data != theentry;
+         hciptr = hciptr->next);
+    return hciptr;
+}
+
+#ifdef TESTING
+
+void
+header_complex_dump(struct header_complex_index *thestuff)
+{
+    struct header_complex_index *hciptr;
+    oid             oidsave[MAX_OID_LEN];
+    size_t          len;
+
+    for (hciptr = thestuff; hciptr != NULL; hciptr = hciptr->next) {
+        DEBUGMSGTL(("header_complex_dump", "var:  "));
+        header_complex_generate_oid(oidsave, &len, NULL, 0, hciptr->);
+        DEBUGMSGOID(("header_complex_dump", oidsave, len));
+        DEBUGMSG(("header_complex_dump", "\n"));
+    }
+}
+
+main()
+{
+    oid             oidsave[MAX_OID_LEN];
+    int             len = MAX_OID_LEN, len2;
+    netsnmp_variable_list *vars;
+    long            ltmp = 4242, ltmp2 = 88, ltmp3 = 1, ltmp4 = 4200;
+    oid             ourprefix[] = { 1, 2, 3, 4 };
+    oid             testparse[] = { 4, 116, 101, 115, 116, 4200 };
+    int             ret;
+
+    char           *string = "wes", *string2 = "dawn", *string3 = "test";
+
+    struct header_complex_index *thestorage = NULL;
+
+    debug_register_tokens("header_complex");
+    snmp_set_do_debugging(1);
+
+    vars = NULL;
+    len2 = sizeof(ltmp);
+    snmp_varlist_add_variable(&vars, NULL, 0, ASN_INTEGER, (char *) &ltmp,
+                              len2);
+    header_complex_add_data(&thestorage, vars, ourprefix);
+
+    vars = NULL;
+    len2 = strlen(string);
+    snmp_varlist_add_variable(&vars, NULL, 0, ASN_OCTET_STR, string, len2);
+    header_complex_add_data(&thestorage, vars, ourprefix);
+
+    vars = NULL;
+    len2 = sizeof(ltmp2);
+    snmp_varlist_add_variable(&vars, NULL, 0, ASN_INTEGER, (char *) &ltmp2,
+                              len2);
+    header_complex_add_data(&thestorage, vars, ourprefix);
+
+    vars = NULL;
+    len2 = strlen(string2);
+    snmp_varlist_add_variable(&vars, NULL, 0, ASN_OCTET_STR, string2,
+                              len2);
+    header_complex_add_data(&thestorage, vars, ourprefix);
+
+    vars = NULL;
+    len2 = sizeof(ltmp3);
+    snmp_varlist_add_variable(&vars, NULL, 0, ASN_INTEGER, (char *) &ltmp3,
+                              len2);
+    header_complex_add_data(&thestorage, vars, ourprefix);
+
+    vars = NULL;
+    len2 = strlen(string3);
+    snmp_varlist_add_variable(&vars, NULL, 0, ASN_OCTET_STR, string3,
+                              len2);
+    len2 = sizeof(ltmp4);
+    snmp_varlist_add_variable(&vars, NULL, 0, ASN_INTEGER, (char *) &ltmp4,
+                              len2);
+    header_complex_add_data(&thestorage, vars, ourprefix);
+
+    header_complex_dump(thestorage);
+
+    vars = NULL;
+    snmp_varlist_add_variable(&vars, NULL, 0, ASN_OCTET_STR, NULL, 0);
+    snmp_varlist_add_variable(&vars, NULL, 0, ASN_INTEGER, NULL, 0);
+    ret =
+        header_complex_parse_oid(testparse,
+                                 sizeof(testparse) / sizeof(oid), vars);
+    DEBUGMSGTL(("header_complex_test", "parse returned %d...\n", ret));
+
+}
+#endif
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/header_complex.h tomato121/release/src/router/snmp/agent/mibgroup/header_complex.h
--- tomato/release/src/router/snmp/agent/mibgroup/header_complex.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/header_complex.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,72 @@
+/*
+ *  header_complex.h:  More complex storage and data sorting for mib modules
+ */
+#ifndef _MIBGROUP_HEADER_COMPLEX_H
+#define _MIBGROUP_HEADER_COMPLEX_H
+
+struct header_complex_index {
+    oid            *name;
+    size_t          namelen;
+    void           *data;
+    struct header_complex_index *next;
+    struct header_complex_index *prev;
+};
+
+/*
+ * Function pointer called by the header_comlpex functions when a client pointer (void * to us) needs to be cleaned. 
+ */
+
+typedef void    (HeaderComplexCleaner) (void *);
+void           *header_complex(struct header_complex_index *datalist,
+                               struct variable *vp, oid * name,
+                               size_t * length, int exact,
+                               size_t * var_len,
+                               WriteMethod ** write_method);
+
+int             header_complex_generate_varoid(netsnmp_variable_list *
+                                               var);
+int             header_complex_parse_oid(oid * oidIndex, size_t oidLen,
+                                         netsnmp_variable_list * data);
+void            header_complex_generate_oid(oid * name, size_t * length,
+                                            oid * prefix,
+                                            size_t prefix_len,
+                                            netsnmp_variable_list * data);
+void            header_complex_free_all(struct header_complex_index
+                                        *thestuff,
+                                        HeaderComplexCleaner * cleaner);
+void            header_complex_free_entry(struct header_complex_index
+                                          *theentry,
+                                          HeaderComplexCleaner * cleaner);
+void           *header_complex_extract_entry(struct header_complex_index
+                                             **thetop,
+                                             struct header_complex_index
+                                             *thespot);
+struct header_complex_index *header_complex_find_entry(struct
+                                                       header_complex_index
+                                                       *thestuff,
+                                                       void *entry);
+
+void           *header_complex_get(struct header_complex_index *datalist,
+                                   netsnmp_variable_list * index);
+void           *header_complex_get_from_oid(struct header_complex_index
+                                            *datalist, oid * searchfor,
+                                            size_t searchfdor_len);
+
+struct header_complex_index *header_complex_add_data(struct
+                                                     header_complex_index
+                                                     **thedata,
+                                                     netsnmp_variable_list
+                                                     * var, void *data);
+
+/*
+ * Note: newoid is copied/cloned for you 
+ */
+struct header_complex_index *header_complex_add_data_by_oid(struct
+                                                            header_complex_index
+                                                            **thedata,
+                                                            oid * newoid,
+                                                            size_t
+                                                            newoid_len,
+                                                            void *data);
+
+#endif                          /* _MIBGROUP_HEADER_COMPLEX_H */
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/host/.cvsignore tomato121/release/src/router/snmp/agent/mibgroup/host/.cvsignore
--- tomato/release/src/router/snmp/agent/mibgroup/host/.cvsignore	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/host/.cvsignore	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,2 @@
+.libs
+*.lo
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/host/hr_device.c tomato121/release/src/router/snmp/agent/mibgroup/host/hr_device.c
--- tomato/release/src/router/snmp/agent/mibgroup/host/hr_device.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/host/hr_device.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,329 @@
+/*
+ *  Host Resources MIB - Device group implementation - hr_device.c
+ *
+ */
+
+#include <net-snmp/net-snmp-config.h>
+#if HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+
+#include "host_res.h"
+#include "hr_device.h"
+
+        /*********************
+	 *
+	 *  Kernel & interface information,
+	 *   and internal forward declarations
+	 *
+	 *********************/
+
+int             Get_Next_Device(void);
+
+PFV             init_device[HRDEV_TYPE_MAX];
+PFIV            next_device[HRDEV_TYPE_MAX];
+PFV             save_device[HRDEV_TYPE_MAX];
+int             dev_idx_inc[HRDEV_TYPE_MAX];
+
+PFS             device_descr[HRDEV_TYPE_MAX];
+PFO             device_prodid[HRDEV_TYPE_MAX];
+PFI             device_status[HRDEV_TYPE_MAX];
+PFI             device_errors[HRDEV_TYPE_MAX];
+
+int             current_type;
+
+void            Init_Device(void);
+int             header_hrdevice(struct variable *, oid *, size_t *, int,
+                                size_t *, WriteMethod **);
+
+
+        /*********************
+	 *
+	 *  Initialisation & common implementation functions
+	 *
+	 *********************/
+
+#define	HRDEV_INDEX		1
+#define	HRDEV_TYPE		2
+#define	HRDEV_DESCR		3
+#define	HRDEV_ID		4
+#define	HRDEV_STATUS		5
+#define	HRDEV_ERRORS		6
+
+struct variable4 hrdevice_variables[] = {
+    {HRDEV_INDEX, ASN_INTEGER, RONLY, var_hrdevice, 2, {1, 1}},
+    {HRDEV_TYPE, ASN_OBJECT_ID, RONLY, var_hrdevice, 2, {1, 2}},
+    {HRDEV_DESCR, ASN_OCTET_STR, RONLY, var_hrdevice, 2, {1, 3}},
+    {HRDEV_ID, ASN_OBJECT_ID, RONLY, var_hrdevice, 2, {1, 4}},
+    {HRDEV_STATUS, ASN_INTEGER, RONLY, var_hrdevice, 2, {1, 5}},
+    {HRDEV_ERRORS, ASN_COUNTER, RONLY, var_hrdevice, 2, {1, 6}}
+};
+oid             hrdevice_variables_oid[] = { 1, 3, 6, 1, 2, 1, 25, 3, 2 };
+
+
+void
+init_hr_device(void)
+{
+    int             i;
+
+    /*
+     * Initially assume no devices
+     *    Insert pointers to initialisation/get_next routines
+     *    for particular device types as they are implemented
+     *      (set up in the appropriate 'init_*()' routine )
+     */
+
+    for (i = 0; i < HRDEV_TYPE_MAX; ++i) {
+        init_device[i] = NULL;
+        next_device[i] = NULL;
+        save_device[i] = NULL;
+        dev_idx_inc[i] = 0;     /* Assume random indices */
+
+        device_descr[i] = NULL;
+        device_prodid[i] = NULL;
+        device_status[i] = NULL;
+        device_errors[i] = NULL;
+    }
+
+    REGISTER_MIB("host/hr_device", hrdevice_variables, variable4,
+                 hrdevice_variables_oid);
+}
+
+
+/*
+ * header_hrdevice(...
+ * Arguments:
+ * vp     IN      - pointer to variable entry that points here
+ * name    IN/OUT  - IN/name requested, OUT/name found
+ * length  IN/OUT  - length of IN/OUT oid's 
+ * exact   IN      - TRUE if an exact match was requested
+ * var_len OUT     - length of variable or 0 if function returned
+ * write_method
+ * 
+ */
+
+int
+header_hrdevice(struct variable *vp,
+                oid * name,
+                size_t * length,
+                int exact, size_t * var_len, WriteMethod ** write_method)
+{
+#define HRDEV_ENTRY_NAME_LENGTH	11
+    oid             newname[MAX_OID_LEN];
+    int             dev_idx, LowIndex = -1, LowType = -1;
+    int             result;
+
+    DEBUGMSGTL(("host/hr_device", "var_hrdevice: "));
+    DEBUGMSGOID(("host/hr_device", name, *length));
+    DEBUGMSG(("host/hr_device", " %d\n", exact));
+
+    memcpy((char *) newname, (char *) vp->name,
+           (int) vp->namelen * sizeof(oid));
+
+
+    /*
+     *  Find the "next" device entry.
+     *  If we're in the middle of the table, then there's
+     *     no point in examining earlier types of devices,
+     *     so set the starting type to that of the variable
+     *     being queried.
+     *  If we've moved from one column of the table to another,
+     *     then we need to start at the beginning again.
+     *     (i.e. the 'compare' fails to match)
+     *  Similarly if we're at the start of the table
+     *     (i.e. *length is too short to be a full instance)
+     */
+
+    if ((snmp_oid_compare(vp->name, vp->namelen, name, vp->namelen) == 0)
+        && (*length > HRDEV_ENTRY_NAME_LENGTH))
+        current_type = (name[HRDEV_ENTRY_NAME_LENGTH] >> HRDEV_TYPE_SHIFT);
+    else
+        current_type = 0;
+
+    Init_Device();
+    for (;;) {
+        dev_idx = Get_Next_Device();
+        DEBUGMSG(("host/hr_device", "(index %d ....", dev_idx));
+        if (dev_idx == -1)
+            break;
+        if (LowType != -1 && LowType < (dev_idx >> HRDEV_TYPE_SHIFT))
+            break;
+        newname[HRDEV_ENTRY_NAME_LENGTH] = dev_idx;
+        DEBUGMSGOID(("host/hr_device", newname, *length));
+        DEBUGMSG(("host/hr_device", "\n"));
+        result = snmp_oid_compare(name, *length, newname, vp->namelen + 1);
+        if (exact && (result == 0)) {
+            if (save_device[current_type] != NULL)
+                (*save_device[current_type]) ();
+            LowIndex = dev_idx;
+            break;
+        }
+        if ((!exact && (result < 0)) &&
+            (LowIndex == -1 || dev_idx < LowIndex)) {
+            if (save_device[current_type] != NULL)
+                (*save_device[current_type]) ();
+            LowIndex = dev_idx;
+            LowType = (dev_idx >> HRDEV_TYPE_SHIFT);
+            if (dev_idx_inc[LowType])   /* Increasing indices => now done */
+                break;
+        }
+
+    }
+
+    if (LowIndex == -1) {
+        DEBUGMSGTL(("host/hr_device", "... index out of range\n"));
+        return (MATCH_FAILED);
+    }
+
+    newname[HRDEV_ENTRY_NAME_LENGTH] = LowIndex;
+    memcpy((char *) name, (char *) newname,
+           ((int) vp->namelen + 1) * sizeof(oid));
+    *length = vp->namelen + 1;
+    *write_method = 0;
+    *var_len = sizeof(long);    /* default to 'long' results */
+
+    DEBUGMSGTL(("host/hr_device", "... get device stats "));
+    DEBUGMSGOID(("host/hr_device", name, *length));
+    DEBUGMSG(("host/hr_device", "\n"));
+
+    return LowIndex;
+}
+
+
+oid             device_type_id[] = { 1, 3, 6, 1, 2, 1, 25, 3, 1, 99 };  /* hrDeviceType99 */
+int             device_type_len =
+    sizeof(device_type_id) / sizeof(device_type_id[0]);
+
+
+        /*********************
+	 *
+	 *  System specific implementation functions
+	 *
+	 *********************/
+
+
+u_char         *
+var_hrdevice(struct variable *vp,
+             oid * name,
+             size_t * length,
+             int exact, size_t * var_len, WriteMethod ** write_method)
+{
+    int             dev_idx, type;
+    oid            *oid_p;
+    static char     string[100];
+
+    dev_idx =
+        header_hrdevice(vp, name, length, exact, var_len, write_method);
+    if (dev_idx == MATCH_FAILED)
+        return NULL;
+
+    type = (dev_idx >> HRDEV_TYPE_SHIFT);
+
+    switch (vp->magic) {
+    case HRDEV_INDEX:
+        long_return = dev_idx;
+        return (u_char *) & long_return;
+    case HRDEV_TYPE:
+        device_type_id[device_type_len - 1] = type;
+        *var_len = sizeof(device_type_id);
+        return (u_char *) device_type_id;
+    case HRDEV_DESCR:
+        if (device_descr[type] != NULL) {
+            strncpy(string, ((*device_descr[type]) (dev_idx)),
+                    sizeof(string)-1);
+            string[ sizeof(string)-1] = 0;
+        } else
+#if NO_DUMMY_VALUES
+            return NULL;
+#else
+            sprintf(string, "a black box of some sort");
+#endif
+        *var_len = strlen(string);
+        return (u_char *) string;
+    case HRDEV_ID:
+        if (device_prodid[type] != NULL)
+            oid_p = ((*device_prodid[type]) (dev_idx, var_len));
+        else {
+            oid_p = nullOid;
+            *var_len = nullOidLen;
+        }
+        return (u_char *) oid_p;
+    case HRDEV_STATUS:
+        if (device_status[type] != NULL)
+            long_return = ((*device_status[type]) (dev_idx));
+        else
+#if NO_DUMMY_VALUES
+            return NULL;
+#else
+            long_return = 2;    /* Assume running */
+#endif
+        return (u_char *) & long_return;
+    case HRDEV_ERRORS:
+        if (device_errors[type] != NULL)
+            long_return = (*device_errors[type]) (dev_idx);
+        else
+#if NO_DUMMY_VALUES
+            return NULL;
+#else
+            long_return = 0;    /* Assume OK */
+#endif
+        return (u_char *) & long_return;
+    default:
+        DEBUGMSGTL(("snmpd", "unknown sub-id %d in var_hrdevice\n",
+                    vp->magic));
+    }
+    return NULL;
+}
+
+
+        /*********************
+	 *
+	 *  Internal implementation functions
+	 *
+	 *********************/
+
+
+void
+Init_Device(void)
+{
+    /*
+     *  Find the first non-NULL initialisation function
+     *    and call it
+     */
+    while (current_type < HRDEV_TYPE_MAX &&
+           init_device[current_type] == NULL)
+        if (++current_type >= HRDEV_TYPE_MAX)
+            return;
+    (*init_device[current_type]) ();
+}
+
+int
+Get_Next_Device(void)
+{
+    int             result = -1;
+
+    /*
+     *  Call the 'next device' function for the current
+     *    type of device
+     *
+     *  TODO:  save the necessary information about that device
+     */
+    if (current_type < HRDEV_TYPE_MAX && next_device[current_type] != NULL)
+        result = (*next_device[current_type]) ();
+
+    /*
+     *  No more devices of the current type.
+     *  Try the next type (if any)
+     */
+    if (result == -1) {
+        if (++current_type >= HRDEV_TYPE_MAX) {
+            current_type = 0;
+            return -1;
+        }
+        Init_Device();
+        return Get_Next_Device();
+    }
+    return result;
+}
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/host/hr_device.h tomato121/release/src/router/snmp/agent/mibgroup/host/hr_device.h
--- tomato/release/src/router/snmp/agent/mibgroup/host/hr_device.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/host/hr_device.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,11 @@
+/*
+ *  Host Resources MIB - device group interface - hr_device.h
+ *
+ */
+#ifndef _MIBGROUP_HRDEVICE_H
+#define _MIBGROUP_HRDEVICE_H
+
+extern void     init_hr_device(void);
+extern FindVarMethod var_hrdevice;
+
+#endif                          /* _MIBGROUP_HRDEVICE_H */
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/host/hr_disk.c tomato121/release/src/router/snmp/agent/mibgroup/host/hr_disk.c
--- tomato/release/src/router/snmp/agent/mibgroup/host/hr_disk.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/host/hr_disk.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,996 @@
+/*
+ *  Host Resources MIB - disk device group implementation - hr_disk.c
+ *
+ */
+
+#include <net-snmp/net-snmp-config.h>
+#include "host_res.h"
+#include "hr_disk.h"
+#if HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+
+#include <fcntl.h>
+#if HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#if HAVE_KVM_H
+#include <kvm.h>
+#endif
+#if HAVE_DIRENT_H
+#include <dirent.h>
+#else
+# define dirent direct
+# if HAVE_SYS_NDIR_H
+#  include <sys/ndir.h>
+# endif
+# if HAVE_SYS_DIR_H
+#  include <sys/dir.h>
+# endif
+# if HAVE_NDIR_H
+#  include <ndir.h>
+# endif
+#endif
+#if HAVE_SYS_IOCTL_H
+#include <sys/ioctl.h>
+#endif
+
+#if HAVE_SYS_DKIO_H
+#include <sys/dkio.h>
+#endif
+#if HAVE_SYS_DISKIO_H           /* HP-UX only ? */
+#include <sys/diskio.h>
+#endif
+#if HAVE_LINUX_HDREG_H
+#include <linux/hdreg.h>
+#endif
+#if HAVE_SYS_DISKLABEL_H
+#define DKTYPENAMES
+#include <sys/disklabel.h>
+#endif
+#if TIME_WITH_SYS_TIME
+# include <sys/time.h>
+# include <time.h>
+#else
+# if HAVE_SYS_TIME_H
+#  include <sys/time.h>
+# else
+#  include <time.h>
+# endif
+#endif
+
+#if HAVE_LIMITS_H
+#include <limits.h>
+#endif
+
+#ifdef linux
+/*
+ * define BLKGETSIZE from <linux/fs.h>:
+ * Note: cannot include this file completely due to errors with redefinition
+ * of structures (at least with older linux versions) --jsf
+ */
+#define BLKGETSIZE _IO(0x12,96) /* return device size */
+#endif
+
+#include <net-snmp/agent/agent_read_config.h>
+#include <net-snmp/library/read_config.h>
+
+#define HRD_MONOTONICALLY_INCREASING
+
+        /*********************
+	 *
+	 *  Kernel & interface information,
+	 *   and internal forward declarations
+	 *
+	 *********************/
+
+void            Init_HR_Disk(void);
+int             Get_Next_HR_Disk(void);
+int             Get_Next_HR_Disk_Partition(char *, int);
+static void     Add_HR_Disk_entry(const char *, int, int, int, int,
+                                  const char *, int, int);
+static void     Save_HR_Disk_General(void);
+static void     Save_HR_Disk_Specific(void);
+static int      Query_Disk(int, const char *);
+static int      Is_It_Writeable(void);
+static int      What_Type_Disk(void);
+static int      Is_It_Removeable(void);
+static const char *describe_disk(int);
+
+int             header_hrdisk(struct variable *, oid *, size_t *, int,
+                              size_t *, WriteMethod **);
+
+static int      HRD_type_index;
+static int      HRD_index;
+static char     HRD_savedModel[40];
+static long     HRD_savedCapacity = 1044;
+static int      HRD_savedFlags;
+static time_t   HRD_history[HRDEV_TYPE_MASK];
+
+#ifdef DIOC_DESCRIBE
+static disk_describe_type HRD_info;
+static capacity_type HRD_cap;
+
+static int      HRD_savedIntf_type;
+static int      HRD_savedDev_type;
+#endif
+
+#ifdef DKIOCINFO
+static struct dk_cinfo HRD_info;
+static struct dk_geom HRD_cap;
+
+static int      HRD_savedCtrl_type;
+#endif
+
+#ifdef HAVE_LINUX_HDREG_H
+static struct hd_driveid HRD_info;
+#endif
+
+#ifdef DIOCGDINFO
+static struct disklabel HRD_info;
+#endif
+
+static void     parse_disk_config(const char *, char *);
+static void     free_disk_config(void);
+
+        /*********************
+	 *
+	 *  Initialisation & common implementation functions
+	 *
+	 *********************/
+
+#define	HRDISK_ACCESS		1
+#define	HRDISK_MEDIA		2
+#define	HRDISK_REMOVEABLE	3
+#define	HRDISK_CAPACITY		4
+
+struct variable4 hrdisk_variables[] = {
+    {HRDISK_ACCESS, ASN_INTEGER, RONLY, var_hrdisk, 2, {1, 1}},
+    {HRDISK_MEDIA, ASN_INTEGER, RONLY, var_hrdisk, 2, {1, 2}},
+    {HRDISK_REMOVEABLE, ASN_INTEGER, RONLY, var_hrdisk, 2, {1, 3}},
+    {HRDISK_CAPACITY, ASN_INTEGER, RONLY, var_hrdisk, 2, {1, 4}}
+};
+oid             hrdisk_variables_oid[] = { 1, 3, 6, 1, 2, 1, 25, 3, 6 };
+
+
+void
+init_hr_disk(void)
+{
+    int             i;
+
+    init_device[HRDEV_DISK] = Init_HR_Disk;
+    next_device[HRDEV_DISK] = Get_Next_HR_Disk;
+    save_device[HRDEV_DISK] = Save_HR_Disk_General;
+#ifdef HRD_MONOTONICALLY_INCREASING
+    dev_idx_inc[HRDEV_DISK] = 1;
+#endif
+
+#if defined(linux)
+    Add_HR_Disk_entry("/dev/hd%c%d", -1, -1, 'a', 'l', "/dev/hd%c", 1, 15);
+    Add_HR_Disk_entry("/dev/sd%c%d", -1, -1, 'a', 'p', "/dev/sd%c", 1, 15);
+    Add_HR_Disk_entry("/dev/md%d", -1, -1, 0, 3, "/dev/md%d", 0, 0);
+    Add_HR_Disk_entry("/dev/fd%d", -1, -1, 0, 1, "/dev/fd%d", 0, 0);
+#elif defined(hpux)
+#if defined(hpux10) || defined(hpux11)
+    Add_HR_Disk_entry("/dev/rdsk/c%dt%xd%d", 0, 1, 0, 15,
+                      "/dev/rdsk/c%dt%xd0", 0, 4);
+#else                           /* hpux9 */
+    Add_HR_Disk_entry("/dev/rdsk/c%dd%xs%d", 201, 201, 0, 15,
+                      "/dev/rdsk/c%dd%xs0", 0, 4);
+#endif
+#elif defined(solaris2)
+    Add_HR_Disk_entry("/dev/rdsk/c%dt%dd0s%d", 0, 1, 0, 15,
+                      "/dev/rdsk/c%dt%dd0s0", 0, 7);
+    Add_HR_Disk_entry("/dev/rdsk/c%dd%ds%d", 0, 1, 0, 15,
+                      "/dev/rdsk/c%dd%ds0", 0, 7);
+#elif defined(freebsd4) || defined(freebsd5)
+    Add_HR_Disk_entry("/dev/ad%ds%d%c", 0, 1, 1, 4, "/dev/ad%ds%d", 'a', 'h');
+    Add_HR_Disk_entry("/dev/da%ds%d%c", 0, 1, 1, 4, "/dev/da%ds%d", 'a', 'h');
+#elif defined(freebsd3)
+    Add_HR_Disk_entry("/dev/wd%ds%d%c", 0, 1, 1, 4, "/dev/wd%ds%d", 'a',
+                      'h');
+    Add_HR_Disk_entry("/dev/sd%ds%d%c", 0, 1, 1, 4, "/dev/sd%ds%d", 'a',
+                      'h');
+#elif defined(freebsd2)
+    Add_HR_Disk_entry("/dev/wd%d%c", -1, -1, 0, 3, "/dev/wd%d", 'a', 'h');
+    Add_HR_Disk_entry("/dev/sd%d%c", -1, -1, 0, 3, "/dev/sd%d", 'a', 'h');
+#elif defined(netbsd1)
+    Add_HR_Disk_entry("/dev/wd%d%c", -1, -1, 0, 3, "/dev/wd%dc", 'a', 'h');
+    Add_HR_Disk_entry("/dev/sd%d%c", -1, -1, 0, 3, "/dev/sd%dc", 'a', 'h');
+#endif
+
+    device_descr[HRDEV_DISK] = describe_disk;
+    HRD_savedModel[0] = '\0';
+    HRD_savedCapacity = 0;
+
+    for (i = 0; i < HRDEV_TYPE_MASK; ++i)
+        HRD_history[i] = -1;
+
+    REGISTER_MIB("host/hr_disk", hrdisk_variables, variable4,
+                 hrdisk_variables_oid);
+
+    snmpd_register_config_handler("ignoredisk", parse_disk_config,
+                                  free_disk_config, "name");
+}
+
+#define ITEM_STRING	1
+#define ITEM_SET	2
+#define ITEM_STAR	3
+#define ITEM_ANY	4
+
+typedef unsigned char details_set[32];
+
+typedef struct _conf_disk_item {
+    int             item_type;  /* ITEM_STRING, ITEM_SET, ITEM_STAR, ITEM_ANY */
+    void           *item_details;       /* content depends upon item_type */
+    struct _conf_disk_item *item_next;
+} conf_disk_item;
+
+typedef struct _conf_disk_list {
+    conf_disk_item *list_item;
+    struct _conf_disk_list *list_next;
+} conf_disk_list;
+static conf_disk_list *conf_list;
+
+static int      match_disk_config(const char *);
+static int      match_disk_config_item(const char *, conf_disk_item *);
+
+static void
+parse_disk_config(const char *token, char *cptr)
+{
+    conf_disk_list *d_new;
+    conf_disk_item *di_curr;
+    details_set    *d_set;
+    char           *name, *p, *d_str, c;
+    unsigned int    i, neg, c1, c2;
+
+    name = strtok(cptr, " \t");
+    if (!name) {
+        config_perror("Missing NAME parameter");
+        return;
+    }
+    d_new = (conf_disk_list *) malloc(sizeof(conf_disk_list));
+    if (!d_new) {
+        config_perror("Out of memory");
+        return;
+    }
+    di_curr = (conf_disk_item *) malloc(sizeof(conf_disk_item));
+    if (!di_curr) {
+        config_perror("Out of memory");
+        return;
+    }
+    d_new->list_item = di_curr;
+    for (;;) {
+        if (*name == '?') {
+            di_curr->item_type = ITEM_ANY;
+            di_curr->item_details = (void *) 0;
+            name++;
+        } else if (*name == '*') {
+            di_curr->item_type = ITEM_STAR;
+            di_curr->item_details = (void *) 0;
+            name++;
+        } else if (*name == '[') {
+            d_set = (details_set *) malloc(sizeof(details_set));
+            if (!d_set) {
+                config_perror("Out of memory");
+                return;
+            }
+            for (i = 0; i < sizeof(details_set); i++)
+                (*d_set)[i] = (unsigned char) 0;
+            name++;
+            if (*name == '^' || *name == '!') {
+                neg = 1;
+                name++;
+            } else {
+                neg = 0;
+            }
+            while (*name && *name != ']') {
+                c1 = ((unsigned int) *name++) & 0xff;
+                if (*name == '-' && *(name + 1) != ']') {
+                    name++;
+                    c2 = ((unsigned int) *name++) & 0xff;
+                } else {
+                    c2 = c1;
+                }
+                for (i = c1; i <= c2; i++)
+                    (*d_set)[i / 8] |= (unsigned char) (1 << (i % 8));
+            }
+            if (*name != ']') {
+                config_perror
+                    ("Syntax error in NAME: invalid set specified");
+                return;
+            }
+            if (neg) {
+                for (i = 0; i < sizeof(details_set); i++)
+                    (*d_set)[i] = (*d_set)[i] ^ (unsigned char) 0xff;
+            }
+            di_curr->item_type = ITEM_SET;
+            di_curr->item_details = (void *) d_set;
+            name++;
+        } else {
+            for (p = name;
+                 *p != '\0' && *p != '?' && *p != '*' && *p != '['; p++);
+            c = *p;
+            *p = '\0';
+            d_str = (char *) malloc(strlen(name) + 1);
+            if (!d_str) {
+                config_perror("Out of memory");
+                return;
+            }
+            strcpy(d_str, name);
+            *p = c;
+            di_curr->item_type = ITEM_STRING;
+            di_curr->item_details = (void *) d_str;
+            name = p;
+        }
+        if (!*name) {
+            di_curr->item_next = (conf_disk_item *) 0;
+            break;
+        }
+        di_curr->item_next =
+            (conf_disk_item *) malloc(sizeof(conf_disk_item));
+        if (!di_curr->item_next) {
+            config_perror("Out of memory");
+            return;
+        }
+        di_curr = di_curr->item_next;
+    }
+    d_new->list_next = conf_list;
+    conf_list = d_new;
+}
+
+static void
+free_disk_config(void)
+{
+    conf_disk_list *d_ptr = conf_list, *d_next;
+    conf_disk_item *di_ptr, *di_next;
+
+    while (d_ptr) {
+        d_next = d_ptr->list_next;
+        di_ptr = d_ptr->list_item;
+        while (di_ptr) {
+            di_next = di_ptr->item_next;
+            if (di_ptr->item_details)
+                free(di_ptr->item_details);
+            free((void *) di_ptr);
+            di_ptr = di_next;
+        }
+        free((void *) d_ptr);
+        d_ptr = d_next;
+    }
+    conf_list = (conf_disk_list *) 0;
+}
+
+static int
+match_disk_config_item(const char *name, conf_disk_item * di_ptr)
+{
+    int             result = 0;
+    size_t          len;
+    details_set    *d_set;
+    unsigned int    c;
+
+    if (di_ptr) {
+        switch (di_ptr->item_type) {
+        case ITEM_STRING:
+            len = strlen((const char *) di_ptr->item_details);
+            if (!strncmp(name, (const char *) di_ptr->item_details, len))
+                result = match_disk_config_item(name + len,
+                                                di_ptr->item_next);
+            break;
+        case ITEM_SET:
+            if (*name) {
+                d_set = (details_set *) di_ptr->item_details;
+                c = ((unsigned int) *name) & 0xff;
+                if ((*d_set)[c / 8] & (unsigned char) (1 << (c % 8)))
+                    result = match_disk_config_item(name + 1,
+                                                    di_ptr->item_next);
+            }
+            break;
+        case ITEM_STAR:
+            if (di_ptr->item_next) {
+                for (; !result && *name; name++)
+                    result = match_disk_config_item(name,
+                                                    di_ptr->item_next);
+            } else {
+                result = 1;
+            }
+            break;
+        case ITEM_ANY:
+            if (*name)
+                result = match_disk_config_item(name + 1,
+                                                di_ptr->item_next);
+            break;
+        }
+    } else {
+        if (*name == '\0')
+            result = 1;
+    }
+
+    return result;
+}
+
+static int
+match_disk_config(const char *name)
+{
+    conf_disk_list *d_ptr = conf_list;
+
+    while (d_ptr) {
+        if (match_disk_config_item(name, d_ptr->list_item))
+            return 1;           /* match found in ignorelist */
+        d_ptr = d_ptr->list_next;
+    }
+
+    /*
+     * no match in ignorelist 
+     */
+    return 0;
+}
+
+/*
+ * header_hrdisk(...
+ * Arguments:
+ * vp     IN      - pointer to variable entry that points here
+ * name    IN/OUT  - IN/name requested, OUT/name found
+ * length  IN/OUT  - length of IN/OUT oid's 
+ * exact   IN      - TRUE if an exact match was requested
+ * var_len OUT     - length of variable or 0 if function returned
+ * write_method
+ */
+
+int
+header_hrdisk(struct variable *vp,
+              oid * name,
+              size_t * length,
+              int exact, size_t * var_len, WriteMethod ** write_method)
+{
+#define HRDISK_ENTRY_NAME_LENGTH	11
+    oid             newname[MAX_OID_LEN];
+    int             disk_idx, LowIndex = -1;
+    int             result;
+
+    DEBUGMSGTL(("host/hr_disk", "var_hrdisk: "));
+    DEBUGMSGOID(("host/hr_disk", name, *length));
+    DEBUGMSG(("host/hr_disk", " %d\n", exact));
+
+    memcpy((char *) newname, (char *) vp->name,
+           (int) vp->namelen * sizeof(oid));
+    /*
+     * Find "next" disk entry 
+     */
+
+    Init_HR_Disk();
+    for (;;) {
+        disk_idx = Get_Next_HR_Disk();
+        if (disk_idx == -1)
+            break;
+        newname[HRDISK_ENTRY_NAME_LENGTH] = disk_idx;
+        result =
+            snmp_oid_compare(name, *length, newname,
+                             (int) vp->namelen + 1);
+        if (exact && (result == 0)) {
+            LowIndex = disk_idx;
+            Save_HR_Disk_Specific();
+            break;
+        }
+        if ((!exact && (result < 0)) &&
+            (LowIndex == -1 || disk_idx < LowIndex)) {
+            LowIndex = disk_idx;
+            Save_HR_Disk_Specific();
+#ifdef HRD_MONOTONICALLY_INCREASING
+            break;
+#endif
+        }
+    }
+
+    if (LowIndex == -1) {
+        DEBUGMSGTL(("host/hr_disk", "... index out of range\n"));
+        return (MATCH_FAILED);
+    }
+
+    newname[HRDISK_ENTRY_NAME_LENGTH] = LowIndex;
+    memcpy((char *) name, (char *) newname,
+           ((int) vp->namelen + 1) * sizeof(oid));
+    *length = vp->namelen + 1;
+    *write_method = 0;
+    *var_len = sizeof(long);    /* default to 'long' results */
+
+    DEBUGMSGTL(("host/hr_disk", "... get disk stats "));
+    DEBUGMSGOID(("host/hr_disk", name, *length));
+    DEBUGMSG(("host/hr_disk", "\n"));
+
+    return LowIndex;
+}
+
+
+        /*********************
+	 *
+	 *  System specific implementation functions
+	 *
+	 *********************/
+
+
+u_char         *
+var_hrdisk(struct variable * vp,
+           oid * name,
+           size_t * length,
+           int exact, size_t * var_len, WriteMethod ** write_method)
+{
+    int             disk_idx;
+
+    disk_idx =
+        header_hrdisk(vp, name, length, exact, var_len, write_method);
+    if (disk_idx == MATCH_FAILED)
+        return NULL;
+
+
+    switch (vp->magic) {
+    case HRDISK_ACCESS:
+        long_return = Is_It_Writeable();
+        return (u_char *) & long_return;
+    case HRDISK_MEDIA:
+        long_return = What_Type_Disk();
+        return (u_char *) & long_return;
+    case HRDISK_REMOVEABLE:
+        long_return = Is_It_Removeable();
+        return (u_char *) & long_return;
+    case HRDISK_CAPACITY:
+        long_return = HRD_savedCapacity;
+        return (u_char *) & long_return;
+    default:
+        DEBUGMSGTL(("snmpd", "unknown sub-id %d in var_hrdisk\n",
+                    vp->magic));
+    }
+    return NULL;
+}
+
+
+        /*********************
+	 *
+	 *  Internal implementation functions
+	 *
+	 *********************/
+
+#define MAX_NUMBER_DISK_TYPES	16      /* probably should be a variable */
+#define MAX_DISKS_PER_TYPE	15      /* SCSI disks - not a hard limit */
+#define	HRDISK_TYPE_SHIFT	4       /* log2 (MAX_DISKS_PER_TYPE+1) */
+
+typedef struct {
+    const char     *disk_devpart_string;        /* printf() format disk part. name */
+    short           disk_controller;    /* controller id or -1 if NA */
+    short           disk_device_first;  /* first device id */
+    short           disk_device_last;   /* last device id */
+    const char     *disk_devfull_string;        /* printf() format full disk name */
+    short           disk_partition_first;       /* first partition id */
+    short           disk_partition_last;        /* last partition id */
+} HRD_disk_t;
+
+static HRD_disk_t disk_devices[MAX_NUMBER_DISK_TYPES];
+static int      HR_number_disk_types = 0;
+
+static void
+Add_HR_Disk_entry(const char *devpart_string,
+                  int first_ctl,
+                  int last_ctl,
+                  int first_dev,
+                  int last_dev,
+                  const char *devfull_string,
+                  int first_partn, int last_partn)
+{
+    while (first_ctl <= last_ctl) {
+        disk_devices[HR_number_disk_types].disk_devpart_string =
+            devpart_string;
+        disk_devices[HR_number_disk_types].disk_controller = first_ctl;
+        disk_devices[HR_number_disk_types].disk_device_first = first_dev;
+        disk_devices[HR_number_disk_types].disk_device_last = last_dev;
+        disk_devices[HR_number_disk_types].disk_devfull_string =
+            devfull_string;
+        disk_devices[HR_number_disk_types].disk_partition_first =
+            first_partn;
+        disk_devices[HR_number_disk_types].disk_partition_last =
+            last_partn;
+
+        /*
+         * Split long runs of disks into separate "types"
+         */
+        while (last_dev - first_dev > MAX_DISKS_PER_TYPE) {
+            first_dev = first_dev + MAX_DISKS_PER_TYPE;
+            disk_devices[HR_number_disk_types].disk_device_last =
+                first_dev - 1;
+            HR_number_disk_types++;
+
+            disk_devices[HR_number_disk_types].disk_devpart_string =
+                devpart_string;
+            disk_devices[HR_number_disk_types].disk_controller = first_ctl;
+            disk_devices[HR_number_disk_types].disk_device_first =
+                first_dev;
+            disk_devices[HR_number_disk_types].disk_device_last = last_dev;
+            disk_devices[HR_number_disk_types].disk_devfull_string =
+                devfull_string;
+            disk_devices[HR_number_disk_types].disk_partition_first =
+                first_partn;
+            disk_devices[HR_number_disk_types].disk_partition_last =
+                last_partn;
+        }
+
+        first_ctl++;
+        HR_number_disk_types++;
+    }
+}
+
+void
+Init_HR_Disk(void)
+{
+    HRD_type_index = 0;
+    HRD_index = -1;
+    DEBUGMSGTL(("host/hr_disk", "Init_Disk\n"));
+}
+
+int
+Get_Next_HR_Disk(void)
+{
+    char            string[100];
+    int             fd, result;
+    int             iindex;
+    int             max_disks;
+    time_t          now;
+
+    HRD_index++;
+    (void *) time(&now);
+    DEBUGMSGTL(("host/hr_disk", "Next_Disk type %d of %d\n",
+                HRD_type_index, HR_number_disk_types));
+    while (HRD_type_index < HR_number_disk_types) {
+        max_disks = disk_devices[HRD_type_index].disk_device_last -
+            disk_devices[HRD_type_index].disk_device_first + 1;
+        DEBUGMSGTL(("host/hr_disk", "Next_Disk max %d of type %d\n",
+                    max_disks, HRD_type_index));
+
+        while (HRD_index < max_disks) {
+            iindex = (HRD_type_index << HRDISK_TYPE_SHIFT) + HRD_index;
+
+            /*
+             * Check to see whether this device
+             *   has been probed for 'recently'
+             *   and skip if so.
+             * This has a *major* impact on run
+             *   times (by a factor of 10!)
+             */
+            if ((HRD_history[iindex] > 0) &&
+                ((now - HRD_history[iindex]) < 60)) {
+                HRD_index++;
+                continue;
+            }
+
+            /*
+             * Construct the full device name in "string" 
+             */
+            if (disk_devices[HRD_type_index].disk_controller != -1) {
+                snprintf(string, sizeof(string),
+                        disk_devices[HRD_type_index].disk_devfull_string,
+                        disk_devices[HRD_type_index].disk_controller,
+                        disk_devices[HRD_type_index].disk_device_first +
+                        HRD_index);
+            } else {
+                snprintf(string, sizeof(string),
+                        disk_devices[HRD_type_index].disk_devfull_string,
+                        disk_devices[HRD_type_index].disk_device_first +
+                        HRD_index);
+            }
+            string[ sizeof(string)-1 ] = 0;
+
+            DEBUGMSGTL(("host/hr_disk", "Get_Next_HR_Disk: %s (%d/%d)\n",
+                        string, HRD_type_index, HRD_index));
+
+            if (HRD_history[iindex] == -1) {
+                /*
+                 * check whether this device is in the "ignoredisk" list in
+                 * the config file. if yes this device will be marked as
+                 * invalid for the future, i.e. it won't ever be checked
+                 * again.
+                 */
+                if (match_disk_config(string)) {
+                    /*
+                     * device name matches entry in ignoredisk list 
+                     */
+                    DEBUGMSGTL(("host/hr_disk",
+                                "Get_Next_HR_Disk: %s ignored\n", string));
+                    HRD_history[iindex] = LONG_MAX;
+                    HRD_index++;
+                    continue;
+                }
+            }
+
+            /*
+             * use O_NDELAY to avoid CDROM spin-up and media detection
+             * * (too slow) --okir 
+             */
+            /*
+             * at least with HP-UX 11.0 this doesn't seem to work properly
+             * * when accessing an empty CDROM device --jsf 
+             */
+#ifdef O_NDELAY                 /* I'm sure everything has it, but just in case...  --Wes */
+            fd = open(string, O_RDONLY | O_NDELAY);
+#else
+            fd = open(string, O_RDONLY);
+#endif
+            if (fd != -1) {
+                result = Query_Disk(fd, string);
+                close(fd);
+                if (result != -1) {
+                    HRD_history[iindex] = 0;
+                    return ((HRDEV_DISK << HRDEV_TYPE_SHIFT) + iindex);
+                }
+            }
+            HRD_history[iindex] = now;
+            HRD_index++;
+        }
+        HRD_type_index++;
+        HRD_index = 0;
+    }
+    HRD_index = -1;
+    return -1;
+}
+
+int
+Get_Next_HR_Disk_Partition(char *string, int HRP_index)
+{
+    DEBUGMSGTL(("host/hr_disk", "Next_Partition type %d/%d:%d\n",
+                HRD_type_index, HRD_type_index, HRP_index));
+
+    /*
+     * no more partition names => return -1 
+     */
+    if (disk_devices[HRD_type_index].disk_partition_last -
+        disk_devices[HRD_type_index].disk_partition_first + 1
+        <= HRP_index) {
+        return -1;
+    }
+
+    /*
+     * Construct the partition name in "string" 
+     */
+    if (disk_devices[HRD_type_index].disk_controller != -1) {
+        snprintf(string, sizeof(string),
+                disk_devices[HRD_type_index].disk_devpart_string,
+                disk_devices[HRD_type_index].disk_controller,
+                disk_devices[HRD_type_index].disk_device_first + HRD_index,
+                disk_devices[HRD_type_index].disk_partition_first +
+                HRP_index);
+    } else {
+        snprintf(string, sizeof(string),
+                disk_devices[HRD_type_index].disk_devpart_string,
+                disk_devices[HRD_type_index].disk_device_first + HRD_index,
+                disk_devices[HRD_type_index].disk_partition_first +
+                HRP_index);
+    }
+    string[ sizeof(string)-1 ] = 0;
+
+    DEBUGMSGTL(("host/hr_disk",
+                "Get_Next_HR_Disk_Partition: %s (%d/%d:%d)\n", string,
+                HRD_type_index, HRD_index, HRP_index));
+
+    return 0;
+}
+
+static void
+Save_HR_Disk_Specific(void)
+{
+#ifdef DIOC_DESCRIBE
+    HRD_savedIntf_type = HRD_info.intf_type;
+    HRD_savedDev_type = HRD_info.dev_type;
+    HRD_savedFlags = HRD_info.flags;
+    HRD_savedCapacity = HRD_cap.lba / 2;
+#endif
+#ifdef DKIOCINFO
+    HRD_savedCtrl_type = HRD_info.dki_ctype;
+    HRD_savedFlags = HRD_info.dki_flags;
+    HRD_savedCapacity = HRD_cap.dkg_ncyl * HRD_cap.dkg_nhead * HRD_cap.dkg_nsect / 2;   /* ??? */
+#endif
+#ifdef HAVE_LINUX_HDREG_H
+    HRD_savedCapacity = HRD_info.lba_capacity / 2;
+    HRD_savedFlags = HRD_info.config;
+#endif
+#ifdef DIOCGDINFO
+    HRD_savedCapacity = HRD_info.d_secperunit / 2;
+#endif
+}
+
+static void
+Save_HR_Disk_General(void)
+{
+#ifdef DIOC_DESCRIBE
+    strncpy(HRD_savedModel, HRD_info.model_num, sizeof(HRD_savedModel)-1);
+    HRD_savedModel[ sizeof(HRD_savedModel)-1 ] = 0;
+#endif
+#ifdef DKIOCINFO
+    strncpy(HRD_savedModel, HRD_info.dki_dname, sizeof(HRD_savedModel)-1);
+    HRD_savedModel[ sizeof(HRD_savedModel)-1 ] = 0;
+#endif
+#ifdef HAVE_LINUX_HDREG_H
+    strncpy(HRD_savedModel, (const char *) HRD_info.model,
+                    sizeof(HRD_savedModel)-1);
+    HRD_savedModel[ sizeof(HRD_savedModel)-1 ] = 0;
+#endif
+#ifdef DIOCGDINFO
+    strncpy(HRD_savedModel, dktypenames[HRD_info.d_type],
+                    sizeof(HRD_savedModel)-1);
+    HRD_savedModel[ sizeof(HRD_savedModel)-1 ] = 0;
+#endif
+}
+
+static const char *
+describe_disk(int idx)
+{
+    if (HRD_savedModel[0] == '\0')
+        return ("some sort of disk");
+    else
+        return (HRD_savedModel);
+}
+
+
+static int
+Query_Disk(int fd, const char *devfull)
+{
+    int             result = -1;
+
+#ifdef DIOC_DESCRIBE
+    result = ioctl(fd, DIOC_DESCRIBE, &HRD_info);
+    if (result != -1)
+        result = ioctl(fd, DIOC_CAPACITY, &HRD_cap);
+#endif
+
+#ifdef DKIOCINFO
+    result = ioctl(fd, DKIOCINFO, &HRD_info);
+    if (result != -1)
+        result = ioctl(fd, DKIOCGGEOM, &HRD_cap);
+#endif
+
+#ifdef HAVE_LINUX_HDREG_H
+    if (HRD_type_index == 0)    /* IDE hard disk */
+        result = ioctl(fd, HDIO_GET_IDENTITY, &HRD_info);
+    else if (HRD_type_index <= 2) {     /* SCSI hard disk and md devices */
+        long            h;
+        result = ioctl(fd, BLKGETSIZE, &h);
+        if (result != -1 && HRD_type_index == 2 && h == 0L)
+            result = -1;        /* ignore empty md devices */
+        if (result != -1) {
+            HRD_info.lba_capacity = h;
+            if (HRD_type_index == 1)
+                snprintf( HRD_info.model, sizeof(HRD_info.model)-1,
+                         "SCSI disk (%s)", devfull);
+            else
+                snprintf( HRD_info.model, sizeof(HRD_info.model)-1,
+                        "RAID disk (%s)", devfull);
+            HRD_info.model[ sizeof(HRD_info.model)-1 ] = 0;
+            HRD_info.config = 0;
+        }
+    }
+#endif
+
+#ifdef DIOCGDINFO
+    result = ioctl(fd, DIOCGDINFO, &HRD_info);
+#endif
+
+    return (result);
+}
+
+
+static int
+Is_It_Writeable(void)
+{
+#ifdef DIOC_DESCRIBE
+    if ((HRD_savedFlags & WRITE_PROTECT_FLAG) ||
+        (HRD_savedDev_type == CDROM_DEV_TYPE))
+        return (2);             /* read only */
+#endif
+
+#ifdef DKIOCINFO
+    if (HRD_savedCtrl_type == DKC_CDROM)
+        return (2);             /* read only */
+#endif
+
+    return (1);                 /* read-write */
+}
+
+static int
+What_Type_Disk(void)
+{
+#ifdef DIOC_DESCRIBE
+    switch (HRD_savedDev_type) {
+    case DISK_DEV_TYPE:
+        if (HRD_savedIntf_type == PC_FDC_INTF)
+            return (4);         /* Floppy Disk */
+        else
+            return (3);         /* Hard Disk */
+        break;
+    case CDROM_DEV_TYPE:
+        return (5);             /* Optical RO */
+        break;
+    case WORM_DEV_TYPE:
+        return (6);             /* Optical WORM */
+        break;
+    case MO_DEV_TYPE:
+        return (7);             /* Optical R/W */
+        break;
+    default:
+        return (2);             /* Unknown */
+        break;
+    }
+#endif
+
+#ifdef DKIOCINFO
+    switch (HRD_savedCtrl_type) {
+    case DKC_WDC2880:
+    case DKC_DSD5215:
+#ifdef DKC_XY450
+    case DKC_XY450:
+#endif
+    case DKC_ACB4000:
+    case DKC_MD21:
+#ifdef DKC_XD7053
+    case DKC_XD7053:
+#endif
+    case DKC_SCSI_CCS:
+#ifdef DKC_PANTHER
+    case DKC_PANTHER:
+#endif
+#ifdef DKC_CDC_9057
+    case DKC_CDC_9057:
+#endif
+#ifdef DKC_FJ_M1060
+    case DKC_FJ_M1060:
+#endif
+    case DKC_DIRECT:
+    case DKC_PCMCIA_ATA:
+        return (3);             /* Hard Disk */
+        break;
+    case DKC_NCRFLOPPY:
+    case DKC_SMSFLOPPY:
+    case DKC_INTEL82077:
+        return (4);             /* Floppy Disk */
+        break;
+    case DKC_CDROM:
+        return (5);             /* Optical RO */
+        break;
+    case DKC_PCMCIA_MEM:
+        return (8);             /* RAM disk */
+        break;
+    case DKC_MD:               /* "meta-disk" driver */
+        return (1);             /* Other */
+        break;
+    }
+#endif
+
+
+    return (2);                 /* Unknown */
+}
+
+static int
+Is_It_Removeable(void)
+{
+#ifdef DIOC_DESCRIBE
+    if ((HRD_savedIntf_type == PC_FDC_INTF) ||
+        (HRD_savedDev_type == WORM_DEV_TYPE) ||
+        (HRD_savedDev_type == MO_DEV_TYPE) ||
+        (HRD_savedDev_type == CDROM_DEV_TYPE))
+        return (1);             /* true */
+#endif
+
+#ifdef DKIOCINFO
+    if ((HRD_savedCtrl_type == DKC_CDROM) ||
+        (HRD_savedCtrl_type == DKC_NCRFLOPPY) ||
+        (HRD_savedCtrl_type == DKC_SMSFLOPPY) ||
+        (HRD_savedCtrl_type == DKC_INTEL82077) ||
+        (HRD_savedCtrl_type == DKC_PCMCIA_MEM) ||
+        (HRD_savedCtrl_type == DKC_PCMCIA_ATA))
+        return (1);             /* true */
+#endif
+
+#ifdef HAVE_LINUX_HDREG_H
+    if (HRD_savedFlags & 0x80)
+        return (1);             /* true */
+#endif
+
+    return (2);                 /* false */
+}
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/host/hr_disk.h tomato121/release/src/router/snmp/agent/mibgroup/host/hr_disk.h
--- tomato/release/src/router/snmp/agent/mibgroup/host/hr_disk.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/host/hr_disk.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,15 @@
+/*
+ *  Host Resources MIB - disk device group interface - hr_disk.h
+ *
+ */
+#ifndef _MIBGROUP_HRDISK_H
+#define _MIBGROUP_HRDISK_H
+
+extern void     init_hr_disk(void);
+extern void     Init_HR_Disk(void);
+extern int      Get_Next_HR_Disk(void);
+extern int      Get_Next_HR_Disk_Partition(char *, int);
+extern FindVarMethod var_hrdisk;
+
+
+#endif                          /* _MIBGROUP_HRDISK_H */
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/host/hr_filesys.c tomato121/release/src/router/snmp/agent/mibgroup/host/hr_filesys.c
--- tomato/release/src/router/snmp/agent/mibgroup/host/hr_filesys.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/host/hr_filesys.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,795 @@
+/*
+ *  Host Resources MIB - File System device group implementation - hr_filesys.c
+ *
+ */
+
+#include <net-snmp/net-snmp-config.h>
+#include "host_res.h"
+#include "hr_filesys.h"
+#include <net-snmp/utilities.h>
+
+#if HAVE_MNTENT_H
+#include <mntent.h>
+#endif
+#if HAVE_SYS_MNTENT_H
+#include <sys/mntent.h>
+#endif
+#if HAVE_SYS_MNTTAB_H
+#include <sys/mnttab.h>
+#endif
+#if HAVE_SYS_STATVFS_H
+#include <sys/statvfs.h>
+#endif
+#if HAVE_SYS_VFS_H
+#include <sys/vfs.h>
+#endif
+#ifdef HAVE_SYS_PARAM_H
+#include <sys/param.h>
+#endif
+#ifdef HAVE_SYS_MOUNT_H
+#include <sys/mount.h>
+#endif
+
+#include <ctype.h>
+#if HAVE_STRING_H
+#include <string.h>
+#endif
+#if HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+
+#if defined(bsdi4) || defined(freebsd3) || defined(freebsd4) || defined(freebsd5)
+#if HAVE_GETFSSTAT
+#if defined(MFSNAMELEN)
+#define MOUNT_NFS	"nfs"
+#define MNTTYPE_UFS	"ufs"
+#define BerkelyFS
+#define MNTTYPE_FFS	"ffs"
+#define MNTTYPE_NFS	"nfs"
+#define MNTTYPE_NFS3	"nfs"
+#define MNTTYPE_MFS	"mfs"
+#define MNTTYPE_MSDOS	"msdos"
+#define MNTTYPE_LFS	"lfs"
+#define MNTTYPE_FDESC	"fdesc"
+#define MNTTYPE_PORTAL	"portal"
+#define MNTTYPE_NULL	"null"
+#define MNTTYPE_UMAP	"umap"
+#define MNTTYPE_KERNFS	"kernfs"
+#define MNTTYPE_PROCFS	"procfs"
+#define MNTTYPE_AFS	"afs"
+#define MNTTYPE_CD9660	"cd9660"
+#define MNTTYPE_UNION	"union"
+#define MNTTYPE_ADOSFS	"adosfs"
+#define MNTTYPE_EXT2FS	"ext2fs"
+#define MNTTYPE_CFS	"coda"
+#define MNTTYPE_NTFS	"ntfs"
+#endif
+#endif
+#endif                          /* freebsd3 */
+
+#define HRFS_MONOTONICALLY_INCREASING
+
+        /*********************
+	 *
+	 *  Kernel & interface information,
+	 *   and internal forward declarations
+	 *
+	 *********************/
+
+#ifdef solaris2
+
+struct mnttab   HRFS_entry_struct;
+struct mnttab  *HRFS_entry = &HRFS_entry_struct;
+#define	HRFS_name	mnt_special
+#define	HRFS_mount	mnt_mountp
+#define	HRFS_type	mnt_fstype
+#define	HRFS_statfs	statvfs
+
+#elif defined(HAVE_GETFSSTAT)
+static struct statfs *fsstats = 0;
+static int      fscount;
+struct statfs  *HRFS_entry;
+#define HRFS_statfs	statfs
+#ifdef MFSNAMELEN
+#define HRFS_type	f_fstypename
+#else
+#define HRFS_type	f_type
+#endif
+#define HRFS_mount	f_mntonname
+#define HRFS_name	f_mntfromname
+
+#elif defined(dynix)
+
+struct mntent  *HRFS_entry;
+#define	HRFS_name	mnt_fsname
+#define	HRFS_mount	mnt_dir
+#define	HRFS_type	mnt_type
+#define	HRFS_statfs	statvfs
+
+#else
+
+struct mntent  *HRFS_entry;
+#define	HRFS_name	mnt_fsname
+#define	HRFS_mount	mnt_dir
+#define	HRFS_type	mnt_type
+#define	HRFS_statfs	statfs
+
+#ifdef linux
+#define MNTTYPE_CD9660	"iso9660"
+#define MNTTYPE_EXT2FS	"ext2"
+#define MNTTYPE_EXT3FS	"ext3"
+#define MNTTYPE_SMBFS	"smbfs"
+#define MNTTYPE_MSDOS	"msdos"
+#define MNTTYPE_FAT32	"vfat"
+#define MNTTYPE_NTFS	"ntfs"
+#endif	/* linux */
+
+#endif
+
+#define	FULL_DUMP	0
+#define	PART_DUMP	1
+
+
+extern void     Init_HR_FileSys(void);
+extern int      Get_Next_HR_FileSys(void);
+char           *cook_device(char *);
+static u_char  *when_dumped(char *filesys, int level, size_t * length);
+int             header_hrfilesys(struct variable *, oid *, size_t *, int,
+                                 size_t *, WriteMethod **);
+
+        /*********************
+	 *
+	 *  Initialisation & common implementation functions
+	 *
+	 *********************/
+
+#define HRFSYS_INDEX		1
+#define HRFSYS_MOUNT		2
+#define HRFSYS_RMOUNT		3
+#define HRFSYS_TYPE		4
+#define HRFSYS_ACCESS		5
+#define HRFSYS_BOOT		6
+#define HRFSYS_STOREIDX		7
+#define HRFSYS_FULLDUMP		8
+#define HRFSYS_PARTDUMP		9
+
+struct variable4 hrfsys_variables[] = {
+    {HRFSYS_INDEX, ASN_INTEGER, RONLY, var_hrfilesys, 2, {1, 1}},
+    {HRFSYS_MOUNT, ASN_OCTET_STR, RONLY, var_hrfilesys, 2, {1, 2}},
+    {HRFSYS_RMOUNT, ASN_OCTET_STR, RONLY, var_hrfilesys, 2, {1, 3}},
+    {HRFSYS_TYPE, ASN_OBJECT_ID, RONLY, var_hrfilesys, 2, {1, 4}},
+    {HRFSYS_ACCESS, ASN_INTEGER, RONLY, var_hrfilesys, 2, {1, 5}},
+    {HRFSYS_BOOT, ASN_INTEGER, RONLY, var_hrfilesys, 2, {1, 6}},
+    {HRFSYS_STOREIDX, ASN_INTEGER, RONLY, var_hrfilesys, 2, {1, 7}},
+    {HRFSYS_FULLDUMP, ASN_OCTET_STR, RONLY, var_hrfilesys, 2, {1, 8}},
+    {HRFSYS_PARTDUMP, ASN_OCTET_STR, RONLY, var_hrfilesys, 2, {1, 9}},
+};
+oid             hrfsys_variables_oid[] = { 1, 3, 6, 1, 2, 1, 25, 3, 8 };
+
+void
+init_hr_filesys(void)
+{
+    REGISTER_MIB("host/hr_filesys", hrfsys_variables, variable4,
+                 hrfsys_variables_oid);
+}
+
+/*
+ * header_hrfilesys(...
+ * Arguments:
+ * vp     IN      - pointer to variable entry that points here
+ * name    IN/OUT  - IN/name requested, OUT/name found
+ * length  IN/OUT  - length of IN/OUT oid's 
+ * exact   IN      - TRUE if an exact match was requested
+ * var_len OUT     - length of variable or 0 if function returned
+ * write_method
+ * 
+ */
+
+int
+header_hrfilesys(struct variable *vp,
+                 oid * name,
+                 size_t * length,
+                 int exact, size_t * var_len, WriteMethod ** write_method)
+{
+#define HRFSYS_ENTRY_NAME_LENGTH	11
+    oid             newname[MAX_OID_LEN];
+    int             fsys_idx, LowIndex = -1;
+    int             result;
+
+    DEBUGMSGTL(("host/hr_filesys", "var_hrfilesys: "));
+    DEBUGMSGOID(("host/hr_filesys", name, *length));
+    DEBUGMSG(("host/hr_filesys", " %d\n", exact));
+
+    memcpy((char *) newname, (char *) vp->name, vp->namelen * sizeof(oid));
+    /*
+     * Find "next" file system entry 
+     */
+
+    Init_HR_FileSys();
+    for (;;) {
+        fsys_idx = Get_Next_HR_FileSys();
+        if (fsys_idx == -1)
+            break;
+        newname[HRFSYS_ENTRY_NAME_LENGTH] = fsys_idx;
+        result = snmp_oid_compare(name, *length, newname, vp->namelen + 1);
+        if (exact && (result == 0)) {
+            LowIndex = fsys_idx;
+            break;
+        }
+        if ((!exact && (result < 0)) &&
+            (LowIndex == -1 || fsys_idx < LowIndex)) {
+            LowIndex = fsys_idx;
+#ifdef HRFS_MONOTONICALLY_INCREASING
+            break;
+#endif
+        }
+    }
+
+    if (LowIndex == -1) {
+        DEBUGMSGTL(("host/hr_filesys", "... index out of range\n"));
+        return (MATCH_FAILED);
+    }
+
+    memcpy((char *) name, (char *) newname,
+           (vp->namelen + 1) * sizeof(oid));
+    *length = vp->namelen + 1;
+    *write_method = 0;
+    *var_len = sizeof(long);    /* default to 'long' results */
+
+    DEBUGMSGTL(("host/hr_filesys", "... get filesys stats "));
+    DEBUGMSGOID(("host/hr_filesys", name, *length));
+    DEBUGMSG(("host/hr_filesys", "\n"));
+
+    return LowIndex;
+}
+
+
+oid             fsys_type_id[] = { 1, 3, 6, 1, 2, 1, 25, 3, 9, 1 };     /* hrFSOther */
+int             fsys_type_len =
+    sizeof(fsys_type_id) / sizeof(fsys_type_id[0]);
+
+        /*********************
+	 *
+	 *  System specific implementation functions
+	 *
+	 *********************/
+
+
+u_char         *
+var_hrfilesys(struct variable *vp,
+              oid * name,
+              size_t * length,
+              int exact, size_t * var_len, WriteMethod ** write_method)
+{
+    int             fsys_idx;
+    static char     string[100];
+    char           *mnt_type;
+
+    fsys_idx =
+        header_hrfilesys(vp, name, length, exact, var_len, write_method);
+    if (fsys_idx == MATCH_FAILED)
+        return NULL;
+
+
+    switch (vp->magic) {
+    case HRFSYS_INDEX:
+        long_return = fsys_idx;
+        return (u_char *) & long_return;
+    case HRFSYS_MOUNT:
+        snprintf(string, sizeof(string), HRFS_entry->HRFS_mount);
+        string[ sizeof(string)-1 ] = 0;
+        *var_len = strlen(string);
+        return (u_char *) string;
+    case HRFSYS_RMOUNT:
+        if (Check_HR_FileSys_NFS()) {
+            snprintf(string, sizeof(string), HRFS_entry->HRFS_name);
+            string[ sizeof(string)-1 ] = 0;
+        } else
+            string[0] = '\0';
+        *var_len = strlen(string);
+        return (u_char *) string;
+
+    case HRFSYS_TYPE:
+        if (Check_HR_FileSys_NFS())
+            fsys_type_id[fsys_type_len - 1] = 14;
+        else {
+        /*
+         * Not sufficient to identity the file
+         *   type precisely, but it's a start.
+         */
+#if HAVE_GETFSSTAT && !defined(MFSNAMELEN)
+        switch (HRFS_entry->HRFS_type) {
+        case MOUNT_UFS:
+            fsys_type_id[fsys_type_len - 1] = 3;
+            break;
+        case MOUNT_NFS:
+            fsys_type_id[fsys_type_len - 1] = 14;
+            break;
+        case MOUNT_MFS:
+            fsys_type_id[fsys_type_len - 1] = 8;
+            break;
+        case MOUNT_MSDOS:
+            fsys_type_id[fsys_type_len - 1] = 5;
+            break;
+        case MOUNT_LFS:
+            fsys_type_id[fsys_type_len - 1] = 1;
+            break;
+        case MOUNT_LOFS:
+            fsys_type_id[fsys_type_len - 1] = 1;
+            break;
+        case MOUNT_FDESC:
+            fsys_type_id[fsys_type_len - 1] = 1;
+            break;
+        case MOUNT_PORTAL:
+            fsys_type_id[fsys_type_len - 1] = 1;
+            break;
+        case MOUNT_NULL:
+            fsys_type_id[fsys_type_len - 1] = 1;
+            break;
+        case MOUNT_UMAP:
+            fsys_type_id[fsys_type_len - 1] = 1;
+            break;
+        case MOUNT_KERNFS:
+            fsys_type_id[fsys_type_len - 1] = 1;
+            break;
+        case MOUNT_PROCFS:
+            fsys_type_id[fsys_type_len - 1] = 1;
+            break;
+        case MOUNT_AFS:
+            fsys_type_id[fsys_type_len - 1] = 16;
+            break;
+        case MOUNT_CD9660:
+            fsys_type_id[fsys_type_len - 1] = 12;
+            break;
+        case MOUNT_UNION:
+            fsys_type_id[fsys_type_len - 1] = 1;
+            break;
+        case MOUNT_DEVFS:
+            fsys_type_id[fsys_type_len - 1] = 1;
+            break;
+#ifdef MOUNT_EXT2FS
+        case MOUNT_EXT2FS:
+            fsys_type_id[fsys_type_len - 1] = 23;
+            break;
+#endif
+#ifdef MOUNT_TFS
+        case MOUNT_TFS:
+            fsys_type_id[fsys_type_len - 1] = 15;
+            break;
+#endif
+        }
+#else
+        mnt_type = HRFS_entry->HRFS_type;
+        if (mnt_type == NULL)
+            fsys_type_id[fsys_type_len - 1] = 2;        /* unknown */
+#ifdef MNTTYPE_HFS
+        else if (!strcmp(mnt_type, MNTTYPE_HFS))
+#ifdef BerkelyFS
+            fsys_type_id[fsys_type_len - 1] = 3;
+#else                           /* SysV */
+            fsys_type_id[fsys_type_len - 1] = 4;
+#endif
+#endif
+#ifdef MNTTYPE_UFS
+        else if (!strcmp(mnt_type, MNTTYPE_UFS))
+#if defined(BerkelyFS) && !defined(MNTTYPE_HFS)
+            fsys_type_id[fsys_type_len - 1] = 3;
+#else                           /* SysV */
+            fsys_type_id[fsys_type_len - 1] = 4;        /* or 3? XXX */
+#endif
+#endif
+#ifdef MNTTYPE_SYSV
+        else if (!strcmp(mnt_type, MNTTYPE_SYSV))
+            fsys_type_id[fsys_type_len - 1] = 4;
+#endif
+#ifdef MNTTYPE_PC
+        else if (!strcmp(mnt_type, MNTTYPE_PC))
+            fsys_type_id[fsys_type_len - 1] = 5;
+#endif
+#ifdef MNTTYPE_MSDOS
+        else if (!strcmp(mnt_type, MNTTYPE_MSDOS))
+            fsys_type_id[fsys_type_len - 1] = 5;
+#endif
+#ifdef MNTTYPE_FAT32
+        else if (!strcmp(mnt_type, MNTTYPE_FAT32))
+            fsys_type_id[fsys_type_len - 1] = 22;
+#endif
+#ifdef MNTTYPE_CDFS
+        else if (!strcmp(mnt_type, MNTTYPE_CDFS))
+#ifdef RockRidge
+            fsys_type_id[fsys_type_len - 1] = 13;
+#else                           /* ISO 9660 */
+            fsys_type_id[fsys_type_len - 1] = 12;
+#endif
+#endif
+#ifdef MNTTYPE_ISO9660
+        else if (!strcmp(mnt_type, MNTTYPE_ISO9660))
+            fsys_type_id[fsys_type_len - 1] = 12;
+#endif
+#ifdef MNTTYPE_CD9660
+        else if (!strcmp(mnt_type, MNTTYPE_CD9660))
+            fsys_type_id[fsys_type_len - 1] = 12;
+#endif
+#ifdef MNTTYPE_SMBFS
+        else if (!strcmp(mnt_type, MNTTYPE_SMBFS))
+            fsys_type_id[fsys_type_len - 1] = 1;
+#endif
+#ifdef MNTTYPE_NFS
+        else if (!strcmp(mnt_type, MNTTYPE_NFS))
+            fsys_type_id[fsys_type_len - 1] = 14;
+#endif
+#ifdef MNTTYPE_NFS3
+        else if (!strcmp(mnt_type, MNTTYPE_NFS3))
+            fsys_type_id[fsys_type_len - 1] = 14;
+#endif
+#ifdef MNTTYPE_MFS
+        else if (!strcmp(mnt_type, MNTTYPE_MFS))
+            fsys_type_id[fsys_type_len - 1] = 8;
+#endif
+#ifdef MNTTYPE_EXT2FS
+        else if (!strcmp(mnt_type, MNTTYPE_EXT2FS))
+            fsys_type_id[fsys_type_len - 1] = 23;
+#endif
+#ifdef MNTTYPE_EXT3FS
+        else if (!strcmp(mnt_type, MNTTYPE_EXT3FS))
+            fsys_type_id[fsys_type_len - 1] = 23;
+#endif
+#ifdef MNTTYPE_NTFS
+        else if (!strcmp(mnt_type, MNTTYPE_NTFS))
+            fsys_type_id[fsys_type_len - 1] = 9;
+#endif
+        else
+            fsys_type_id[fsys_type_len - 1] = 1;        /* Other */
+#endif                          /* HAVE_GETFSSTAT */
+        }
+
+        *var_len = sizeof(fsys_type_id);
+        return (u_char *) fsys_type_id;
+
+    case HRFSYS_ACCESS:
+#if HAVE_GETFSSTAT
+        long_return = HRFS_entry->f_flags & MNT_RDONLY ? 2 : 1;
+#elif defined(cygwin)
+        long_return = 1;
+#else
+        if (hasmntopt(HRFS_entry, "ro") != NULL)
+            long_return = 2;    /* Read Only */
+        else
+            long_return = 1;    /* Read-Write */
+#endif
+        return (u_char *) & long_return;
+    case HRFSYS_BOOT:
+        if (HRFS_entry->HRFS_mount[0] == '/' &&
+            HRFS_entry->HRFS_mount[1] == 0)
+            long_return = 1;    /* root is probably bootable! */
+        else
+            long_return = 2;    /* others probably aren't */
+        return (u_char *) & long_return;
+    case HRFSYS_STOREIDX:
+        long_return = fsys_idx; /* Use the same indices */
+        return (u_char *) & long_return;
+    case HRFSYS_FULLDUMP:
+        return when_dumped(HRFS_entry->HRFS_name, FULL_DUMP, var_len);
+    case HRFSYS_PARTDUMP:
+        return when_dumped(HRFS_entry->HRFS_name, PART_DUMP, var_len);
+    default:
+        DEBUGMSGTL(("snmpd", "unknown sub-id %d in var_hrfilesys\n",
+                    vp->magic));
+    }
+    return NULL;
+}
+
+
+        /*********************
+	 *
+	 *  Internal implementation functions
+	 *
+	 *********************/
+
+static int      HRFS_index;
+#ifndef HAVE_GETFSSTAT
+static FILE    *fp;
+#endif
+
+void
+Init_HR_FileSys(void)
+{
+#if HAVE_GETFSSTAT
+    fscount = getfsstat(NULL, 0, MNT_NOWAIT);
+    if (fsstats)
+        free((char *) fsstats);
+    fsstats = NULL;
+    fsstats = malloc(fscount * sizeof(*fsstats));
+    getfsstat(fsstats, fscount * sizeof(*fsstats), MNT_NOWAIT);
+    HRFS_index = 0;
+#else
+    HRFS_index = 1;
+    if (fp != NULL)
+        fclose(fp);
+    fp = fopen(ETC_MNTTAB, "r");
+#endif
+}
+
+const char     *HRFS_ignores[] = {
+#ifdef MNTTYPE_IGNORE
+    MNTTYPE_IGNORE,
+#endif
+#ifdef MNTTYPE_SWAP
+    MNTTYPE_SWAP,
+#endif
+#ifdef MNTTYPE_PROC
+    MNTTYPE_PROC,
+#endif
+#ifdef MNTTYPE_AUTOFS
+    MNTTYPE_AUTOFS,
+#endif
+    "autofs",
+#ifdef linux
+    "devpts",
+    "devfs",
+    "usbdevfs",
+    "tmpfs",
+    "shm",
+#endif
+#ifdef solaris2
+    "fd",
+#endif
+    0
+};
+
+int
+Get_Next_HR_FileSys(void)
+{
+#if HAVE_GETFSSTAT
+    if (HRFS_index >= fscount)
+        return -1;
+    HRFS_entry = fsstats + HRFS_index;
+    return ++HRFS_index;
+#else
+    const char    **cpp;
+    /*
+     * XXX - According to RFC 1514, hrFSIndex must
+     *   "remain constant at least from one re-initialization
+     *    of the agent to the next re-initialization."
+     *
+     *  This simple-minded counter doesn't handle filesystems
+     *    being un-mounted and re-mounted.
+     *  Options for fixing this include:
+     *       - keeping a history of previous indices used
+     *       - calculating the index from filesystem
+     *              specific information
+     *
+     *  Note: this index is also used as hrStorageIndex
+     *     which is assumed to be less than HRS_TYPE_FS_MAX
+     *     This assumption may well be broken if the second
+     *     option above is followed.  Consider indexing the
+     *     non-filesystem-based storage entries first in this
+     *     case, and assume hrStorageIndex > HRS_TYPE_FS_MIN
+     *     (for file-system based storage entries)
+     *
+     *  But at least this gets us started.
+     */
+
+    if (fp == NULL)
+        return -1;
+
+#ifdef solaris2
+    if (getmntent(fp, HRFS_entry) != 0)
+        return -1;
+#else
+    HRFS_entry = getmntent(fp);
+    if (HRFS_entry == NULL)
+        return -1;
+#endif                          /* solaris2 */
+
+    for (cpp = HRFS_ignores; *cpp != NULL; ++cpp)
+        if (!strcmp(HRFS_entry->HRFS_type, *cpp))
+            return Get_Next_HR_FileSys();
+
+    return HRFS_index++;
+#endif                          /* HAVE_GETFSSTAT */
+}
+
+/*
+ * this function checks whether the current file system (info can be found
+ * in HRFS_entry) is a Network file system
+ * HRFS_entry must be valid prior to calling this function
+ * returns 1 if Network file system, 0 otherwise
+ */
+int
+Check_HR_FileSys_NFS (void)
+{
+#if HAVE_GETFSSTAT
+#if defined(MFSNAMELEN)
+    if (!strcmp(HRFS_entry->HRFS_type, MOUNT_NFS))
+#else
+    if (HRFS_entry->HRFS_type == MOUNT_NFS)
+#endif
+#else /* HAVE_GETFSSTAT */
+    if ( HRFS_entry->HRFS_type != NULL && (
+#if defined(MNTTYPE_NFS)
+	!strcmp( HRFS_entry->HRFS_type, MNTTYPE_NFS) ||
+#else
+	!strcmp( HRFS_entry->HRFS_type, "nfs") ||
+#endif
+#if defined(MNTTYPE_NFS3)
+	    !strcmp( HRFS_entry->HRFS_type, MNTTYPE_NFS3) ||
+#endif
+#if defined(MNTTYPE_SMBFS)
+	    !strcmp( HRFS_entry->HRFS_type, MNTTYPE_SMBFS) ||
+#endif
+#if defined(MNTTYPE_LOFS)
+	    !strcmp( HRFS_entry->HRFS_type, MNTTYPE_LOFS) ||
+#endif
+	    /*
+	     * MVFS is Rational ClearCase's view file system
+	     * it is similiar to NFS file systems in that it is mounted
+	     * locally or remotely from the ClearCase server
+	     */
+	    !strcmp( HRFS_entry->HRFS_type, "mvfs")))
+#endif /* HAVE_GETFSSTAT */
+	return 1;	/* Network file system */
+
+    return 0;		/* no Network file system */
+}
+
+void
+End_HR_FileSys(void)
+{
+#ifdef HAVE_GETFSSTAT
+    if (fsstats)
+        free((char *) fsstats);
+    fsstats = NULL;
+#else
+    if (fp != NULL)
+        fclose(fp);
+    fp = NULL;
+#endif
+}
+
+
+static u_char  *
+when_dumped(char *filesys, int level, size_t * length)
+{
+    time_t          dumpdate = 0, tmp;
+    FILE           *dump_fp;
+    char            line[100];
+    char           *cp1, *cp2, *cp3;
+
+    /*
+     * Look for the relevent entries in /etc/dumpdates
+     *
+     * This is complicated by the fact that disks are
+     *   mounted using block devices, but dumps are
+     *   done via the raw character devices.
+     * Thus the device names in /etc/dumpdates and
+     *   /etc/mnttab don't match.
+     *   These comparisons are therefore made using the
+     *   final portion of the device name only.
+     */
+
+    if (*filesys == '\0')       /* No filesystem name? */
+        return date_n_time(NULL, length);
+    cp1 = strrchr(filesys, '/');        /* Find the last element of the current FS */
+
+    if (cp1 == NULL)
+        cp1 = filesys;
+
+    if ((dump_fp = fopen("/etc/dumpdates", "r")) == NULL)
+        return date_n_time(NULL, length);
+
+    while (fgets(line, sizeof(line), dump_fp) != NULL) {
+        cp2 = strchr(line, ' ');        /* Start by looking at the device name only */
+        if (cp2 != NULL) {
+            *cp2 = '\0';
+            cp3 = strrchr(line, '/');   /* and find the last element */
+            if (cp3 == NULL)
+                cp3 = line;
+
+            if (strcmp(cp1, cp3) != 0)  /* Wrong FS */
+                continue;
+
+            ++cp2;
+            while (isspace(*cp2))
+                ++cp2;          /* Now find the dump level */
+
+            if (level == FULL_DUMP) {
+                if (*(cp2++) != '0')
+                    continue;   /* Not interested in partial dumps */
+                while (isspace(*cp2))
+                    ++cp2;
+
+                dumpdate = ctime_to_timet(cp2);
+                fclose(dump_fp);
+                return date_n_time(&dumpdate, length);
+            } else {            /* Partial Dump */
+                if (*(cp2++) == '0')
+                    continue;   /* Not interested in full dumps */
+                while (isspace(*cp2))
+                    ++cp2;
+
+                tmp = ctime_to_timet(cp2);
+                if (tmp > dumpdate)
+                    dumpdate = tmp;     /* Remember the 'latest' partial dump */
+            }
+        }
+    }
+
+    fclose(dump_fp);
+
+    return date_n_time(&dumpdate, length);
+}
+
+
+#define RAW_DEVICE_PREFIX	"/dev/rdsk"
+#define COOKED_DEVICE_PREFIX	"/dev/dsk"
+
+char           *
+cook_device(char *dev)
+{
+    static char     cooked_dev[SNMP_MAXPATH+1];
+
+    if (!strncmp(dev, RAW_DEVICE_PREFIX, strlen(RAW_DEVICE_PREFIX))) {
+        strncpy(cooked_dev, COOKED_DEVICE_PREFIX, sizeof(cooked_dev)-1);
+        cooked_dev[ sizeof(cooked_dev)-1 ] = 0;
+        strncat(cooked_dev, dev + strlen(RAW_DEVICE_PREFIX),
+                sizeof(cooked_dev)-strlen(cooked_dev)-1);
+        cooked_dev[ sizeof(cooked_dev)-1 ] = 0;
+    } else {
+        strncpy(cooked_dev, dev, sizeof(cooked_dev)-1);
+        cooked_dev[ sizeof(cooked_dev)-1 ] = 0;
+    }
+
+    return (cooked_dev);
+}
+
+
+int
+Get_FSIndex(char *dev)
+{
+    int             iindex;
+
+    Init_HR_FileSys();
+
+    while ((iindex = Get_Next_HR_FileSys()) != -1)
+        if (!strcmp(HRFS_entry->HRFS_name, cook_device(dev))) {
+            End_HR_FileSys();
+            return iindex;
+        }
+
+    End_HR_FileSys();
+    return 0;
+}
+
+long
+Get_FSSize(char *dev)
+{
+    struct HRFS_statfs statfs_buf;
+
+    Init_HR_FileSys();
+
+    while (Get_Next_HR_FileSys() != -1)
+        if (!strcmp(HRFS_entry->HRFS_name, cook_device(dev))) {
+            End_HR_FileSys();
+
+            if (HRFS_statfs(HRFS_entry->HRFS_mount, &statfs_buf) != -1)
+  		/*
+  		 * with large file systems the following calculation produces
+  		 * an overflow:
+  		 * (statfs_buf.f_blocks*statfs_buf.f_bsize)/1024
+  		 *
+  		 * assumption: f_bsize is either 512 or a multiple of 1024
+  		 * in case of 512 (f_blocks/2) is returned
+  		 * otherwise (f_blocks*(f_bsize/1024)) is returned
+  		 */
+  		if (statfs_buf.f_bsize == 512)
+  		    return (statfs_buf.f_blocks/2);
+                else
+  		    return (statfs_buf.f_blocks*(statfs_buf.f_bsize/1024));
+            else
+                return -1;
+        }
+
+    End_HR_FileSys();
+    return 0;
+}
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/host/hr_filesys.h tomato121/release/src/router/snmp/agent/mibgroup/host/hr_filesys.h
--- tomato/release/src/router/snmp/agent/mibgroup/host/hr_filesys.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/host/hr_filesys.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,18 @@
+/*
+ *  Host Resources MIB - file system device group interface - hr_filesys.h
+ *
+ */
+#ifndef _MIBGROUP_HRFSYS_H
+#define _MIBGROUP_HRFSYS_H
+
+extern void     init_hr_filesys(void);
+extern void     Init_HR_FileSys(void);
+extern FindVarMethod var_hrfilesys;
+extern int      Get_Next_HR_FileSys(void);
+extern int      Check_HR_FileSys_NFS(void);
+
+extern int      Get_FSIndex(char *);
+extern long     Get_FSSize(char *);     /* Temporary */
+
+
+#endif                          /* _MIBGROUP_HRFSYS_H */
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/host/hr_network.c tomato121/release/src/router/snmp/agent/mibgroup/host/hr_network.c
--- tomato/release/src/router/snmp/agent/mibgroup/host/hr_network.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/host/hr_network.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,269 @@
+/*
+ *  Host Resources MIB - network device group implementation - hr_network.c
+ *
+ */
+
+#include <net-snmp/net-snmp-config.h>
+#if HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+
+#ifdef hpux11
+#include <sys/mib.h>
+#include <netinet/mib_kern.h>
+#endif
+
+#include "host_res.h"
+#include "mibII/interfaces.h"
+#include "hr_network.h"
+
+
+        /*********************
+	 *
+	 *  Kernel & interface information,
+	 *   and internal forward declarations
+	 *
+	 *********************/
+
+void            Init_HR_Network(void);
+int             Get_Next_HR_Network(void);
+void            Save_HR_Network_Info(void);
+
+const char     *describe_networkIF(int);
+int             network_status(int);
+int             network_errors(int);
+int             header_hrnet(struct variable *, oid *, size_t *, int,
+                             size_t *, WriteMethod **);
+
+#define HRN_MONOTONICALLY_INCREASING
+
+        /*********************
+	 *
+	 *  Initialisation & common implementation functions
+	 *
+	 *********************/
+
+#define	HRNET_IFINDEX		1
+
+struct variable4 hrnet_variables[] = {
+    {HRNET_IFINDEX, ASN_INTEGER, RONLY, var_hrnet, 2, {1, 1}}
+};
+oid             hrnet_variables_oid[] = { 1, 3, 6, 1, 2, 1, 25, 3, 4 };
+
+
+void
+init_hr_network(void)
+{
+    init_device[HRDEV_NETWORK] = Init_HR_Network;
+    next_device[HRDEV_NETWORK] = Get_Next_HR_Network;
+    save_device[HRDEV_NETWORK] = Save_HR_Network_Info;
+#ifdef HRN_MONOTONICALLY_INCREASING
+    dev_idx_inc[HRDEV_NETWORK] = 1;
+#endif
+
+    device_descr[HRDEV_NETWORK] = describe_networkIF;
+    device_status[HRDEV_NETWORK] = network_status;
+    device_errors[HRDEV_NETWORK] = network_errors;
+
+    REGISTER_MIB("host/hr_network", hrnet_variables, variable4,
+                 hrnet_variables_oid);
+}
+
+/*
+ * header_hrnet(...
+ * Arguments:
+ * vp     IN      - pointer to variable entry that points here
+ * name    IN/OUT  - IN/name requested, OUT/name found
+ * length  IN/OUT  - length of IN/OUT oid's 
+ * exact   IN      - TRUE if an exact match was requested
+ * var_len OUT     - length of variable or 0 if function returned
+ * write_method
+ * 
+ */
+
+int
+header_hrnet(struct variable *vp,
+             oid * name,
+             size_t * length,
+             int exact, size_t * var_len, WriteMethod ** write_method)
+{
+#define HRNET_ENTRY_NAME_LENGTH	11
+    oid             newname[MAX_OID_LEN];
+    int             net_idx;
+    int             result;
+    int             LowIndex = -1;
+
+    DEBUGMSGTL(("host/hr_network", "var_hrnet: "));
+    DEBUGMSGOID(("host/hr_network", name, *length));
+    DEBUGMSG(("host/hr_network", " %d\n", exact));
+
+    memcpy((char *) newname, (char *) vp->name, vp->namelen * sizeof(oid));
+    /*
+     * Find "next" net entry 
+     */
+
+    Init_HR_Network();
+    for (;;) {
+        net_idx = Get_Next_HR_Network();
+        if (net_idx == -1)
+            break;
+        newname[HRNET_ENTRY_NAME_LENGTH] = net_idx;
+        result = snmp_oid_compare(name, *length, newname, vp->namelen + 1);
+        if (exact && (result == 0)) {
+            LowIndex = net_idx;
+            break;
+        }
+        if (!exact && (result < 0) &&
+            (LowIndex == -1 || net_idx < LowIndex)) {
+            LowIndex = net_idx;
+#ifdef HRN_MONOTONICALLY_INCREASING
+            break;
+#endif
+        }
+    }
+
+    if (LowIndex == -1) {
+        DEBUGMSGTL(("host/hr_network", "... index out of range\n"));
+        return (MATCH_FAILED);
+    }
+
+    newname[HRNET_ENTRY_NAME_LENGTH] = LowIndex;
+    memcpy((char *) name, (char *) newname,
+           (vp->namelen + 1) * sizeof(oid));
+    *length = vp->namelen + 1;
+    *write_method = 0;
+    *var_len = sizeof(long);    /* default to 'long' results */
+
+    DEBUGMSGTL(("host/hr_network", "... get net stats "));
+    DEBUGMSGOID(("host/hr_network", name, *length));
+    DEBUGMSG(("host/hr_network", "\n"));
+    return LowIndex;
+}
+
+
+        /*********************
+	 *
+	 *  System specific implementation functions
+	 *
+	 *********************/
+
+
+u_char         *
+var_hrnet(struct variable * vp,
+          oid * name,
+          size_t * length,
+          int exact, size_t * var_len, WriteMethod ** write_method)
+{
+    int             net_idx;
+
+    net_idx = header_hrnet(vp, name, length, exact, var_len, write_method);
+    if (net_idx == MATCH_FAILED)
+        return NULL;
+
+
+    switch (vp->magic) {
+    case HRNET_IFINDEX:
+        long_return = net_idx & ((1 << HRDEV_TYPE_SHIFT) - 1);
+        return (u_char *) & long_return;
+    default:
+        DEBUGMSGTL(("snmpd", "unknown sub-id %d in var_hrnet\n",
+                    vp->magic));
+    }
+    return NULL;
+}
+
+
+        /*********************
+	 *
+	 *  Internal implementation functions
+	 *
+	 *********************/
+
+
+#ifndef solaris2
+static short    HRN_index;
+#endif
+#ifdef hpux11
+static char     HRN_name[MAX_PHYSADDR_LEN];
+static nmapi_phystat HRN_ifnet;
+#define M_Interface_Scan_Next(a, b, c, d)	Interface_Scan_Next(a, b, c)
+#else                           /* hpux11 */
+static char     HRN_name[16];
+static struct ifnet HRN_ifnet;
+#define M_Interface_Scan_Next(a, b, c, d)	Interface_Scan_Next(a, b, c, d)
+#endif
+
+#ifdef hpux11
+static char     HRN_savedName[MAX_PHYSADDR_LEN];
+#else
+static char     HRN_savedName[16];
+#endif
+static u_short  HRN_savedFlags;
+static int      HRN_savedErrors;
+
+
+void
+Init_HR_Network(void)
+{
+#ifndef solaris2
+    Interface_Scan_Init();
+#endif
+}
+
+int
+Get_Next_HR_Network(void)
+{
+#ifndef solaris2
+    if (M_Interface_Scan_Next(&HRN_index, HRN_name, &HRN_ifnet, NULL))
+        return (HRDEV_NETWORK << HRDEV_TYPE_SHIFT) + HRN_index;
+    else
+#endif
+        return -1;
+}
+
+void
+Save_HR_Network_Info(void)
+{
+    strcpy(HRN_savedName, HRN_name);
+#ifdef hpux11
+    HRN_savedFlags = HRN_ifnet.if_entry.ifOper;
+    HRN_savedErrors = HRN_ifnet.if_entry.ifInErrors +
+        HRN_ifnet.if_entry.ifOutErrors;
+#else                           /* hpux11 */
+    HRN_savedFlags = HRN_ifnet.if_flags;
+    HRN_savedErrors = HRN_ifnet.if_ierrors + HRN_ifnet.if_oerrors;
+#endif                          /* hpux11 */
+}
+
+
+const char     *
+describe_networkIF(int idx)
+{
+    static char     string[100];
+
+    snprintf(string, sizeof(string)-1, "network interface %s", HRN_savedName);
+    string[ sizeof(string)-1 ] = 0;
+    return string;
+}
+
+
+int
+network_status(int idx)
+{
+#ifdef hpux11
+    if (HRN_savedFlags == LINK_UP)
+#else
+    if (HRN_savedFlags & IFF_UP)
+#endif
+        return 2;               /* running */
+    else
+        return 5;               /* down */
+}
+
+int
+network_errors(int idx)
+{
+    return HRN_savedErrors;
+}
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/host/hr_network.h tomato121/release/src/router/snmp/agent/mibgroup/host/hr_network.h
--- tomato/release/src/router/snmp/agent/mibgroup/host/hr_network.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/host/hr_network.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,12 @@
+/*
+ *  Host Resources MIB - network device group interface - hr_network.h
+ *
+ */
+#ifndef _MIBGROUP_HRNET_H
+#define _MIBGROUP_HRNET_H
+
+extern void     init_hr_network(void);
+extern FindVarMethod var_hrnet;
+
+config_require(mibII/interfaces)
+#endif                          /* _MIBGROUP_HRNET_H */
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/host/hr_other.c tomato121/release/src/router/snmp/agent/mibgroup/host/hr_other.c
--- tomato/release/src/router/snmp/agent/mibgroup/host/hr_other.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/host/hr_other.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,119 @@
+/*
+ *  Host Resources MIB - other device implementation - hr_other.c
+ *
+ */
+
+#include <net-snmp/net-snmp-config.h>
+
+#include "host_res.h"
+#include "hr_other.h"
+
+#if HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+
+
+void            Init_HR_CPU(void);
+int             Get_Next_HR_CPU(void);
+const char     *describe_cpu(int);
+
+void            Init_HR_CoProc(void);
+int             Get_Next_HR_CoProc(void);
+const char     *describe_coproc(int);
+
+void
+init_hr_other(void)
+{
+    init_device[HRDEV_PROC] = Init_HR_CPU;
+    next_device[HRDEV_PROC] = Get_Next_HR_CPU;
+    device_descr[HRDEV_PROC] = describe_cpu;
+
+    init_device[HRDEV_COPROC] = Init_HR_CoProc;
+    next_device[HRDEV_COPROC] = Get_Next_HR_CoProc;
+    device_descr[HRDEV_COPROC] = describe_coproc;
+}
+
+
+static int      done_CPU;
+
+void
+Init_HR_CPU(void)
+{
+    done_CPU = 0;
+}
+
+int
+Get_Next_HR_CPU(void)
+{
+    /*
+     * Assumes a single CPU system
+     * I think it's safe to assume at least one! 
+     */
+    if (done_CPU != 1) {
+        done_CPU = 1;
+        return (HRDEV_PROC << HRDEV_TYPE_SHIFT);
+    } else
+        return -1;
+}
+
+const char     *
+describe_cpu(int idx)
+{
+#ifdef _SC_CPU_VERSION
+    int             result;
+
+    result = sysconf(_SC_CPU_VERSION);
+    switch (result) {
+    case CPU_HP_MC68020:
+        return (" Motorola MC68020 ");
+    case CPU_HP_MC68030:
+        return (" Motorola MC68030 ");
+    case CPU_HP_MC68040:
+        return (" Motorola MC68040 ");
+    case CPU_PA_RISC1_0:
+        return (" HP PA-RISC 1.0 ");
+    case CPU_PA_RISC1_1:
+        return (" HP PA-RISC 1.1 ");
+    case CPU_PA_RISC1_2:
+        return (" HP PA-RISC 1.2 ");
+    case CPU_PA_RISC2_0:
+        return (" HP PA-RISC 2.0 ");
+    default:
+        return ("An electronic chip with an HP label");
+
+    }
+#else
+    return ("An electronic chip that makes the computer work.");
+#endif
+}
+
+
+
+static int      done_coProc;
+
+void
+Init_HR_CoProc(void)
+{
+    done_coProc = 0;
+}
+
+int
+Get_Next_HR_CoProc(void)
+{
+    /*
+     * How to identify the presence of a co-processor ? 
+     */
+
+    if (done_coProc != 1) {
+        done_coProc = 1;
+        return (HRDEV_COPROC << HRDEV_TYPE_SHIFT);
+    } else
+        return -1;
+}
+
+
+const char     *
+describe_coproc(int idx)
+{
+    return ("Guessing that there's a floating point co-processor");
+}
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/host/hr_other.h tomato121/release/src/router/snmp/agent/mibgroup/host/hr_other.h
--- tomato/release/src/router/snmp/agent/mibgroup/host/hr_other.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/host/hr_other.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1 @@
+void            init_hr_other(void);
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/host/hr_partition.c tomato121/release/src/router/snmp/agent/mibgroup/host/hr_partition.c
--- tomato/release/src/router/snmp/agent/mibgroup/host/hr_partition.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/host/hr_partition.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,308 @@
+
+/*
+ *  Host Resources MIB - partition device group implementation - hr_partition.c
+ *
+ */
+
+#include <net-snmp/net-snmp-config.h>
+#include <fcntl.h>
+#if HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+#if HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#include <errno.h>
+
+#include "host_res.h"
+#include "hr_partition.h"
+#include "hr_filesys.h"
+#include "hr_disk.h"
+
+#include <sys/stat.h>
+
+#define HRP_MONOTONICALLY_INCREASING
+
+        /*********************
+	 *
+	 *  Kernel & interface information,
+	 *   and internal forward declarations
+	 *
+	 *********************/
+
+static int      HRP_savedDiskIndex;
+static int      HRP_savedPartIndex;
+static char     HRP_savedName[100];
+
+static int      HRP_DiskIndex;
+
+static void     Save_HR_Partition(int, int);
+
+
+        /*********************
+	 *
+	 *  Initialisation & common implementation functions
+	 *
+	 *********************/
+
+static void     Init_HR_Partition(void);
+static int      Get_Next_HR_Partition(void);
+int             header_hrpartition(struct variable *, oid *, size_t *, int,
+                                   size_t *, WriteMethod **);
+
+
+#define	HRPART_INDEX		1
+#define	HRPART_LABEL		2
+#define	HRPART_ID		3
+#define	HRPART_SIZE		4
+#define	HRPART_FSIDX		5
+
+struct variable4 hrpartition_variables[] = {
+    {HRPART_INDEX, ASN_INTEGER, RONLY, var_hrpartition, 2, {1, 1}},
+    {HRPART_LABEL, ASN_OCTET_STR, RONLY, var_hrpartition, 2, {1, 2}},
+    {HRPART_ID, ASN_OCTET_STR, RONLY, var_hrpartition, 2, {1, 3}},
+    {HRPART_SIZE, ASN_INTEGER, RONLY, var_hrpartition, 2, {1, 4}},
+    {HRPART_FSIDX, ASN_INTEGER, RONLY, var_hrpartition, 2, {1, 5}}
+};
+oid             hrpartition_variables_oid[] =
+    { 1, 3, 6, 1, 2, 1, 25, 3, 7 };
+
+
+void
+init_hr_partition(void)
+{
+    REGISTER_MIB("host/hr_partition", hrpartition_variables, variable4,
+                 hrpartition_variables_oid);
+}
+
+
+/*
+ * header_hrpartition(...
+ * Arguments:
+ * vp     IN      - pointer to variable entry that points here
+ * name    IN/OUT  - IN/name requested, OUT/name found
+ * length  IN/OUT  - length of IN/OUT oid's 
+ * exact   IN      - TRUE if an exact match was requested
+ * var_len OUT     - length of variable or 0 if function returned
+ * write_method
+ * 
+ */
+
+int
+header_hrpartition(struct variable *vp,
+                   oid * name,
+                   size_t * length,
+                   int exact,
+                   size_t * var_len, WriteMethod ** write_method)
+{
+#define HRPART_DISK_NAME_LENGTH		11
+#define HRPART_ENTRY_NAME_LENGTH	12
+    oid             newname[MAX_OID_LEN];
+    int             part_idx, LowDiskIndex = -1, LowPartIndex = -1;
+    int             result;
+
+    DEBUGMSGTL(("host/hr_partition", "var_hrpartition: "));
+    DEBUGMSGOID(("host/hr_partition", name, *length));
+    DEBUGMSG(("host/hr_partition", " %d\n", exact));
+
+    memcpy((char *) newname, (char *) vp->name,
+           (int) vp->namelen * sizeof(oid));
+    /*
+     * Find "next" partition entry 
+     */
+
+    Init_HR_Disk();
+    Init_HR_Partition();
+
+    /*
+     *  Find the "next" disk and partition entries.
+     *  If we're in the middle of the table, then there's
+     *     no point in examining earlier disks, so set the
+     *     starting disk to that of the variable being queried.
+     *
+     *  If we've moved from one column of the table to another,
+     *     then we need to start at the beginning again.
+     *     (i.e. the 'compare' fails to match)
+     *  Similarly if we're at the start of the table
+     *     (i.e. *length is too short to be a full instance)
+     */
+
+    if ((snmp_oid_compare(vp->name, vp->namelen, name, vp->namelen) == 0)
+        && (*length > HRPART_DISK_NAME_LENGTH)) {
+        LowDiskIndex =
+            (name[HRPART_DISK_NAME_LENGTH] &
+             ((1 << HRDEV_TYPE_SHIFT) - 1));
+
+        while (HRP_DiskIndex < LowDiskIndex) {
+            Init_HR_Partition();        /* moves to next disk */
+            if (HRP_DiskIndex == -1)
+                return (MATCH_FAILED);
+        }
+    }
+
+    for (;;) {
+        part_idx = Get_Next_HR_Partition();
+        if (part_idx == 0)
+            break;
+        newname[HRPART_DISK_NAME_LENGTH] =
+            (HRDEV_DISK << HRDEV_TYPE_SHIFT) + HRP_DiskIndex;
+        newname[HRPART_ENTRY_NAME_LENGTH] = part_idx;
+        result = snmp_oid_compare(name, *length, newname, vp->namelen + 2);
+        if (exact && (result == 0)) {
+            Save_HR_Partition(HRP_DiskIndex, part_idx);
+            LowDiskIndex = HRP_DiskIndex;
+            LowPartIndex = part_idx;
+            break;
+        }
+        if (!exact && (result < 0)) {
+            if (LowPartIndex == -1) {
+                Save_HR_Partition(HRP_DiskIndex, part_idx);
+                LowDiskIndex = HRP_DiskIndex;
+                LowPartIndex = part_idx;
+            } else if (LowDiskIndex < HRP_DiskIndex)
+                break;
+            else if (part_idx < LowPartIndex) {
+                Save_HR_Partition(HRP_DiskIndex, part_idx);
+                LowDiskIndex = HRP_DiskIndex;
+                LowPartIndex = part_idx;
+            }
+#ifdef HRP_MONOTONICALLY_INCREASING
+            break;
+#endif
+        }
+    }
+
+    if (LowPartIndex == -1) {
+        DEBUGMSGTL(("host/hr_partition", "... index out of range\n"));
+        return (MATCH_FAILED);
+    }
+
+    newname[HRPART_DISK_NAME_LENGTH] =
+        (HRDEV_DISK << HRDEV_TYPE_SHIFT) + LowDiskIndex;
+    newname[HRPART_ENTRY_NAME_LENGTH] = LowPartIndex;
+    memcpy((char *) name, (char *) newname,
+           ((int) vp->namelen + 2) * sizeof(oid));
+    *length = vp->namelen + 2;
+    *write_method = 0;
+    *var_len = sizeof(long);    /* default to 'long' results */
+
+    DEBUGMSGTL(("host/hr_partition", "... get partition stats "));
+    DEBUGMSGOID(("host/hr_partition", name, *length));
+    DEBUGMSG(("host/hr_partition", "\n"));
+    return LowPartIndex;
+}
+
+
+        /*********************
+	 *
+	 *  System specific implementation functions
+	 *
+	 *********************/
+
+
+u_char         *
+var_hrpartition(struct variable * vp,
+                oid * name,
+                size_t * length,
+                int exact, size_t * var_len, WriteMethod ** write_method)
+{
+    int             part_idx;
+    static char     string[100];
+    struct stat     stat_buf;
+
+    part_idx =
+        header_hrpartition(vp, name, length, exact, var_len, write_method);
+    if (part_idx == MATCH_FAILED)
+        return NULL;
+
+    if (stat(HRP_savedName, &stat_buf) == -1)
+        return NULL;
+
+    switch (vp->magic) {
+    case HRPART_INDEX:
+        long_return = part_idx;
+        return (u_char *) & long_return;
+    case HRPART_LABEL:
+        *var_len = strlen(HRP_savedName);
+        return (u_char *) HRP_savedName;
+    case HRPART_ID:            /* Use the device number */
+        sprintf(string, "0x%x", (int) stat_buf.st_rdev);
+        *var_len = strlen(string);
+        return (u_char *) string;
+    case HRPART_SIZE:
+        /*
+         * XXX - based on single partition assumption 
+         */
+        long_return = Get_FSSize(HRP_savedName);
+        return (u_char *) & long_return;
+    case HRPART_FSIDX:
+        long_return = Get_FSIndex(HRP_savedName);
+        return (u_char *) & long_return;
+    default:
+        DEBUGMSGTL(("snmpd", "unknown sub-id %d in var_hrpartition\n",
+                    vp->magic));
+    }
+    return NULL;
+}
+
+
+        /*********************
+	 *
+	 *  Internal implementation functions
+	 *
+	 *********************/
+
+static int      HRP_index;
+
+static void
+Init_HR_Partition(void)
+{
+    HRP_DiskIndex = Get_Next_HR_Disk();
+    if (HRP_DiskIndex != -1)
+        HRP_DiskIndex &= ((1 << HRDEV_TYPE_SHIFT) - 1);
+
+    HRP_index = -1;
+}
+
+static int
+Get_Next_HR_Partition(void)
+{
+    char            string[100];
+    int             fd;
+
+    if (HRP_DiskIndex == -1) {
+        return 0;
+    }
+
+    HRP_index++;
+    while (Get_Next_HR_Disk_Partition(string, HRP_index) != -1) {
+        DEBUGMSGTL(("host/hr_partition",
+                    "Get_Next_HR_Partition: %s (:%d)\n",
+                    string, HRP_index));
+
+        fd = open(string, O_RDONLY);
+        if (fd != -1) {
+            close(fd);
+            return HRP_index + 1;
+        } else if (errno == EBUSY) {
+            return HRP_index + 1;
+        }
+        HRP_index++;
+    }
+
+    /*
+     * Finished with this disk, try the next
+     */
+    Init_HR_Partition();
+    return (Get_Next_HR_Partition());
+}
+
+static void
+Save_HR_Partition(int disk_idx, int part_idx)
+{
+    HRP_savedDiskIndex = disk_idx;
+    HRP_savedPartIndex = part_idx;
+    (void) Get_Next_HR_Disk_Partition(HRP_savedName, HRP_index);
+}
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/host/hr_partition.h tomato121/release/src/router/snmp/agent/mibgroup/host/hr_partition.h
--- tomato/release/src/router/snmp/agent/mibgroup/host/hr_partition.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/host/hr_partition.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,12 @@
+/*
+ *  Host Resources MIB - partition device group interface - hr_partition.h
+ *
+ */
+#ifndef _MIBGROUP_HRPART_H
+#define _MIBGROUP_HRPART_H
+
+extern void     init_hr_partition(void);
+extern FindVarMethod var_hrpartition;
+
+
+#endif                          /* _MIBGROUP_HRPART_H */
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/host/hr_print.c tomato121/release/src/router/snmp/agent/mibgroup/host/hr_print.c
--- tomato/release/src/router/snmp/agent/mibgroup/host/hr_print.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/host/hr_print.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,359 @@
+/*
+ *  Host Resources MIB - printer device group implementation - hr_print.c
+ *
+ */
+
+#include <net-snmp/net-snmp-config.h>
+#if HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+#if HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#include "host_res.h"
+#include "hr_print.h"
+#include "struct.h"
+#include "util_funcs.h"
+
+#define HRPRINT_MONOTONICALLY_INCREASING
+
+        /*********************
+	 *
+	 *  Kernel & interface information,
+	 *   and internal forward declarations
+	 *
+	 *********************/
+
+void            Init_HR_Print(void);
+int             Get_Next_HR_Print(void);
+void            Save_HR_Print(void);
+const char     *describe_printer(int);
+int             printer_status(int);
+int             printer_detail_status(int);
+int             printer_errors(int);
+int             header_hrprint(struct variable *, oid *, size_t *, int,
+                               size_t *, WriteMethod **);
+FILE           *run_lpstat(int *);
+
+
+        /*********************
+	 *
+	 *  Initialisation & common implementation functions
+	 *
+	 *********************/
+
+#define	HRPRINT_STATUS		1
+#define	HRPRINT_ERROR		2
+
+struct variable4 hrprint_variables[] = {
+    {HRPRINT_STATUS, ASN_INTEGER, RONLY, var_hrprint, 2, {1, 1}},
+    {HRPRINT_ERROR, ASN_OCTET_STR, RONLY, var_hrprint, 2, {1, 2}}
+};
+oid             hrprint_variables_oid[] = { 1, 3, 6, 1, 2, 1, 25, 3, 5 };
+
+
+void
+init_hr_print(void)
+{
+    init_device[HRDEV_PRINTER] = Init_HR_Print;
+    next_device[HRDEV_PRINTER] = Get_Next_HR_Print;
+    /*
+     * save_device[ HRDEV_PRINTER ] = Save_HR_Print;        
+     */
+#ifdef HRPRINT_MONOTONICALLY_INCREASING
+    dev_idx_inc[HRDEV_PRINTER] = 1;
+#endif
+
+    device_descr[HRDEV_PRINTER] = describe_printer;
+    device_status[HRDEV_PRINTER] = printer_status;
+    device_errors[HRDEV_PRINTER] = printer_errors;
+
+    REGISTER_MIB("host/hr_print", hrprint_variables, variable4,
+                 hrprint_variables_oid);
+}
+
+/*
+ * header_hrprint(...
+ * Arguments:
+ * vp     IN      - pointer to variable entry that points here
+ * name    IN/OUT  - IN/name requested, OUT/name found
+ * length  IN/OUT  - length of IN/OUT oid's 
+ * exact   IN      - TRUE if an exact match was requested
+ * var_len OUT     - length of variable or 0 if function returned
+ * write_method
+ * 
+ */
+int
+header_hrprint(struct variable *vp,
+               oid * name,
+               size_t * length,
+               int exact, size_t * var_len, WriteMethod ** write_method)
+{
+#define HRPRINT_ENTRY_NAME_LENGTH	11
+    oid             newname[MAX_OID_LEN];
+    int             print_idx, LowIndex = -1;
+    int             result;
+
+    DEBUGMSGTL(("host/hr_print", "var_hrprint: "));
+    DEBUGMSGOID(("host/hr_print", name, *length));
+    DEBUGMSG(("host/hr_print", " %d\n", exact));
+
+    memcpy((char *) newname, (char *) vp->name, vp->namelen * sizeof(oid));
+    /*
+     * Find "next" print entry 
+     */
+
+    Init_HR_Print();
+    for (;;) {
+        print_idx = Get_Next_HR_Print();
+        if (print_idx == -1)
+            break;
+        newname[HRPRINT_ENTRY_NAME_LENGTH] = print_idx;
+        result = snmp_oid_compare(name, *length, newname, vp->namelen + 1);
+        if (exact && (result == 0)) {
+            LowIndex = print_idx;
+            /*
+             * Save printer status information 
+             */
+            break;
+        }
+        if ((!exact && (result < 0)) &&
+            (LowIndex == -1 || print_idx < LowIndex)) {
+            LowIndex = print_idx;
+            /*
+             * Save printer status information 
+             */
+#ifdef HRPRINT_MONOTONICALLY_INCREASING
+            break;
+#endif
+        }
+    }
+
+    if (LowIndex == -1) {
+        DEBUGMSGTL(("host/hr_print", "... index out of range\n"));
+        return (MATCH_FAILED);
+    }
+
+    memcpy((char *) name, (char *) newname,
+           (vp->namelen + 1) * sizeof(oid));
+    *length = vp->namelen + 1;
+    *write_method = 0;
+    *var_len = sizeof(long);    /* default to 'long' results */
+
+    DEBUGMSGTL(("host/hr_print", "... get print stats "));
+    DEBUGMSGOID(("host/hr_print", name, *length));
+    DEBUGMSG(("host/hr_print", "\n"));
+    return LowIndex;
+}
+
+
+        /*********************
+	 *
+	 *  System specific implementation functions
+	 *
+	 *********************/
+
+
+u_char         *
+var_hrprint(struct variable * vp,
+            oid * name,
+            size_t * length,
+            int exact, size_t * var_len, WriteMethod ** write_method)
+{
+    int             print_idx;
+
+    print_idx =
+        header_hrprint(vp, name, length, exact, var_len, write_method);
+    if (print_idx == MATCH_FAILED)
+        return NULL;
+
+
+    switch (vp->magic) {
+    case HRPRINT_STATUS:
+        long_return = printer_detail_status(print_idx);
+        return (u_char *) & long_return;
+    case HRPRINT_ERROR:
+#if NO_DUMMY_VALUES
+        return NULL;
+#endif
+        long_return = 0;        /* Null string */
+        return (u_char *) & long_return;
+    default:
+        DEBUGMSGTL(("host/hr_print", "unknown sub-id %d in var_hrprint\n",
+                    vp->magic));
+    }
+    return NULL;
+}
+
+
+        /*********************
+	 *
+	 *  Internal implementation functions
+	 *
+	 *********************/
+
+static int      HRP_index;
+static char   **HRP_name;
+static int      HRP_names, HRP_maxnames;
+
+void
+Init_HR_Print(void)
+{
+#if HAVE_LPSTAT || HAVE_CGETNEXT || HAVE_PRINTCAP
+    int             i, fd;
+#if HAVE_LPSTAT
+    FILE           *p;
+#elif HAVE_CGETNEXT
+    const char     *caps[] = { "/etc/printcap", NULL };
+#elif HAVE_PRINTCAP
+    FILE           *p;
+#endif
+
+    if (HRP_name) {
+        for (i = 0; i < HRP_names; i++)
+            free(HRP_name[i]);
+        HRP_names = 0;
+    } else {
+        HRP_maxnames = 5;
+        HRP_name = (char **) calloc(HRP_maxnames, sizeof(char *));
+        if (!HRP_name)
+            return;
+    }
+
+#if HAVE_LPSTAT
+    if ((p = run_lpstat(&fd)) != NULL) {
+        char            buf[BUFSIZ], ptr[BUFSIZ];
+        while (fgets(buf, sizeof buf, p)) {
+            sscanf(buf, "%*s %*s %[^:]", ptr);
+#elif HAVE_CGETNEXT
+    {
+        char           *buf = NULL, *ptr;
+        while (cgetnext(&buf, caps)) {
+            if ((ptr = strchr(buf, ':')))
+                *ptr = 0;
+            if ((ptr = strchr(buf, '|')))
+                *ptr = 0;
+            ptr = buf;
+#elif HAVE_PRINTCAP
+    if ((p = fopen("/etc/printcap", "r")) != NULL) {
+        char            buf[BUFSIZ], *ptr;
+        while (fgets(buf, sizeof buf, p)) {
+            buf[strlen(buf) - 1] = 0;
+            if (buf[0] == '#' || buf[0] == 0 || buf[0] == ' '
+                || buf[0] == '\t')
+                continue;
+            if ((ptr = strchr(buf, '\\')))
+                *ptr = 0;
+            if ((ptr = strchr(buf, ':')))
+                *ptr = 0;
+            if ((ptr = strchr(buf, '|')))
+                *ptr = 0;
+            ptr = buf;
+#endif
+            if (HRP_names == HRP_maxnames) {
+                char          **tmp;
+                HRP_maxnames += 5;
+                tmp = (char **) calloc(HRP_maxnames, sizeof(char *));
+                if (!tmp)
+                    goto finish;
+                memcpy(tmp, HRP_name, HRP_names * sizeof(char *));
+                HRP_name = tmp;
+            }
+            HRP_name[HRP_names++] = strdup(ptr);
+#if HAVE_CGETNEXT
+            if (buf)
+                free(buf);
+#endif
+        }
+finish:
+#if HAVE_LPSTAT
+        fclose(p);
+        close(fd);
+#elif HAVE_CGETNEXT
+        cgetclose();
+#elif HAVE_PRINTCAP
+        fclose(p);
+#endif
+    }
+#endif                          /* HAVE_anything */
+
+    HRP_index = 0;
+}
+
+int
+Get_Next_HR_Print(void)
+{
+    /*
+     * The initial implementation system
+     *   has no printers attached, and I've
+     *   no real idea how to detect them,
+     *   so don't bother.
+     */
+    if (HRP_index < HRP_names)  /* No printer */
+        return (HRDEV_PRINTER << HRDEV_TYPE_SHIFT) + HRP_index++;
+    else
+        return -1;
+}
+
+const char     *
+describe_printer(int idx)
+{
+    DEBUGMSGTL(("host/hr_print", "describe p: %d/%d %s\n", HRP_index, idx,
+                HRP_name[HRP_index - 1]));
+    return HRP_name[HRP_index - 1];
+}
+
+int
+printer_status(int idx)
+{
+    /*
+     * hrDeviceStatus OBJECT-TYPE
+     * SYNTAX     INTEGER {
+     * unknown(1), running(2), warning(3), testing(4), down(5)
+     * }
+     */
+
+    return 1;                   /* unknown */
+}
+
+int
+printer_detail_status(int idx)
+{
+    /*
+     * hrPrinterStatus OBJECT-TYPE
+     * SYNTAX     INTEGER {
+     * other(1), unknown(2), idle(3), printing(4), warmup(5)
+     * }
+     */
+
+    return 2;                   /* unknown */
+}
+
+int
+printer_errors(int idx)
+{
+    return 0;
+}
+
+#ifdef        HAVE_LPSTAT
+/*
+ * Run the lpstat command. If compiled with EXCACHE support, this
+ * will actually cache the output for a while which helps a lot
+ * with snmpbulkwalk (in fact, it keeps the client from exiting
+ * due to timeouts).
+ */
+FILE           *
+run_lpstat(int *fd)
+{
+    struct extensible ex;
+
+    memset(&ex, 0, sizeof(ex));
+    strcpy(ex.command, LPSTAT_PATH " -v");
+    if ((*fd = get_exec_output(&ex)) < 0)
+        return NULL;
+
+    return fdopen(*fd, "r");
+}
+#endif
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/host/hr_print.h tomato121/release/src/router/snmp/agent/mibgroup/host/hr_print.h
--- tomato/release/src/router/snmp/agent/mibgroup/host/hr_print.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/host/hr_print.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,12 @@
+/*
+ *  Host Resources MIB - printer device group interface - hr_print.h
+ *
+ */
+#ifndef _MIBGROUP_HRPRINT_H
+#define _MIBGROUP_HRPRINT_H
+
+extern void     init_hr_print(void);
+extern FindVarMethod var_hrprint;
+
+
+#endif                          /* _MIBGROUP_HRPRINT_H */
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/host/hr_proc.c tomato121/release/src/router/snmp/agent/mibgroup/host/hr_proc.c
--- tomato/release/src/router/snmp/agent/mibgroup/host/hr_proc.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/host/hr_proc.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,213 @@
+/*
+ *  Host Resources MIB - proc processor group implementation - hr_proc.c
+ *
+ */
+
+#include <net-snmp/net-snmp-config.h>
+#if HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#if HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+
+#include "host_res.h"
+#include "hr_proc.h"
+#include <net-snmp/agent/auto_nlist.h>
+#include <net-snmp/agent/agent_read_config.h>
+#include "ucd-snmp/loadave.h"
+
+#define HRPROC_MONOTONICALLY_INCREASING
+
+        /*********************
+	 *
+	 *  Kernel & interface information,
+	 *   and internal forward declarations
+	 *
+	 *********************/
+
+extern void     Init_HR_Proc(void);
+extern int      Get_Next_HR_Proc(void);
+int             header_hrproc(struct variable *, oid *, size_t *, int,
+                              size_t *, WriteMethod **);
+
+        /*********************
+	 *
+	 *  Initialisation & common implementation functions
+	 *
+	 *********************/
+
+
+#define	HRPROC_ID		1
+#define	HRPROC_LOAD		2
+
+struct variable4 hrproc_variables[] = {
+    {HRPROC_ID, ASN_OBJECT_ID, RONLY, var_hrproc, 2, {1, 1}},
+    {HRPROC_LOAD, ASN_INTEGER, RONLY, var_hrproc, 2, {1, 2}}
+};
+oid             hrproc_variables_oid[] = { 1, 3, 6, 1, 2, 1, 25, 3, 3 };
+
+
+void
+init_hr_proc(void)
+{
+    init_device[HRDEV_PROC] = Init_HR_Proc;
+    next_device[HRDEV_PROC] = Get_Next_HR_Proc;
+#ifdef HRPROC_MONOTONICALLY_INCREASING
+    dev_idx_inc[HRDEV_PROC] = 1;
+#endif
+
+    REGISTER_MIB("host/hr_proc", hrproc_variables, variable4,
+                 hrproc_variables_oid);
+}
+
+/*
+ * header_hrproc(...
+ * Arguments:
+ * vp     IN      - pointer to variable entry that points here
+ * name    IN/OUT  - IN/name requested, OUT/name found
+ * length  IN/OUT  - length of IN/OUT oid's 
+ * exact   IN      - TRUE if an exact match was requested
+ * var_len OUT     - length of variable or 0 if function returned
+ * write_method
+ * 
+ */
+
+int
+header_hrproc(struct variable *vp,
+              oid * name,
+              size_t * length,
+              int exact, size_t * var_len, WriteMethod ** write_method)
+{
+#define HRPROC_ENTRY_NAME_LENGTH	11
+    oid             newname[MAX_OID_LEN];
+    int             proc_idx, LowIndex = -1;
+    int             result;
+
+    DEBUGMSGTL(("host/hr_proc", "var_hrproc: "));
+    DEBUGMSGOID(("host/hr_proc", name, *length));
+    DEBUGMSG(("host/hr_proc", " %d\n", exact));
+
+    memcpy((char *) newname, (char *) vp->name, vp->namelen * sizeof(oid));
+    /*
+     * Find "next" proc entry 
+     */
+
+    Init_HR_Proc();
+    for (;;) {
+        proc_idx = Get_Next_HR_Proc();
+        if (proc_idx == -1)
+            break;
+        newname[HRPROC_ENTRY_NAME_LENGTH] = proc_idx;
+        result = snmp_oid_compare(name, *length, newname, vp->namelen + 1);
+        if (exact && (result == 0)) {
+            LowIndex = proc_idx;
+            /*
+             * Save processor status information 
+             */
+            break;
+        }
+        if ((!exact && (result < 0)) &&
+            (LowIndex == -1 || proc_idx < LowIndex)) {
+            LowIndex = proc_idx;
+            /*
+             * Save processor status information 
+             */
+#ifdef HRPROC_MONOTONICALLY_INCREASING
+            break;
+#endif
+        }
+    }
+
+    if (LowIndex == -1) {
+        DEBUGMSGTL(("host/hr_proc", "... index out of range\n"));
+        return (MATCH_FAILED);
+    }
+
+    memcpy((char *) name, (char *) newname,
+           (vp->namelen + 1) * sizeof(oid));
+    *length = vp->namelen + 1;
+    *write_method = 0;
+    *var_len = sizeof(long);    /* default to 'long' results */
+
+    DEBUGMSGTL(("host/hr_proc", "... get proc stats "));
+    DEBUGMSGOID(("host/hr_proc", name, *length));
+    DEBUGMSG(("host/hr_proc", "\n"));
+    return LowIndex;
+}
+
+
+        /*********************
+	 *
+	 *  System specific implementation functions
+	 *
+	 *********************/
+
+
+u_char         *
+var_hrproc(struct variable * vp,
+           oid * name,
+           size_t * length,
+           int exact, size_t * var_len, WriteMethod ** write_method)
+{
+    int             proc_idx;
+    double          avenrun[3];
+
+    proc_idx =
+        header_hrproc(vp, name, length, exact, var_len, write_method);
+    if (proc_idx == MATCH_FAILED)
+        return NULL;
+    if (try_getloadavg(&avenrun[0], sizeof(avenrun) / sizeof(avenrun[0]))
+        == -1)
+        return NULL;
+
+    switch (vp->magic) {
+    case HRPROC_ID:
+        *var_len = nullOidLen;
+        return (u_char *) nullOid;
+    case HRPROC_LOAD:
+#if NO_DUMMY_VALUES
+        return NULL;
+#endif
+        long_return = avenrun[0] * 100; /* 1 minute average */
+        if (long_return > 100)
+            long_return = 100;
+        return (u_char *) & long_return;
+    default:
+        DEBUGMSGTL(("snmpd", "unknown sub-id %d in var_hrproc\n",
+                    vp->magic));
+    }
+    return NULL;
+}
+
+
+        /*********************
+	 *
+	 *  Internal implementation functions
+	 *
+	 *********************/
+
+static int      HRP_index;
+
+void
+Init_HR_Proc(void)
+{
+    HRP_index = 1;
+}
+
+int
+Get_Next_HR_Proc(void)
+{
+    /*
+     * Silly question time:
+     *   How do you detect processors?
+     *   Assume we've just got one.
+     */
+
+    if (HRP_index < 2)
+        return (HRDEV_PROC << HRDEV_TYPE_SHIFT) + HRP_index++;
+    else
+        return -1;
+}
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/host/hr_proc.h tomato121/release/src/router/snmp/agent/mibgroup/host/hr_proc.h
--- tomato/release/src/router/snmp/agent/mibgroup/host/hr_proc.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/host/hr_proc.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,13 @@
+/*
+ *  Host Resources MIB - processor device group interface - hr_proc.h
+ *
+ */
+#ifndef _MIBGROUP_HRPROC_H
+#define _MIBGROUP_HRPROC_H
+
+config_require(ucd-snmp/loadave)
+
+extern void     init_hr_proc(void);
+extern FindVarMethod var_hrproc;
+
+#endif                          /* _MIBGROUP_HRPROC_H */
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/host/hr_storage.c tomato121/release/src/router/snmp/agent/mibgroup/host/hr_storage.c
--- tomato/release/src/router/snmp/agent/mibgroup/host/hr_storage.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/host/hr_storage.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,845 @@
+/*
+ *  Host Resources MIB - storage group implementation - hr_storage.c
+ *
+ */
+
+#include <net-snmp/net-snmp-config.h>
+#include <sys/types.h>
+#include <sys/param.h>
+#if HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#if TIME_WITH_SYS_TIME
+# ifdef WIN32
+#  include <sys/timeb.h>
+# else
+#  include <sys/time.h>
+# endif
+# include <time.h>
+#else
+# if HAVE_SYS_TIME_H
+#  include <sys/time.h>
+# else
+#  include <time.h>
+# endif
+#endif
+#ifndef dynix
+#if HAVE_SYS_VM_H
+#include <sys/vm.h>
+#if (!defined(KERNEL) || defined(MACH_USER_API)) && defined(HAVE_SYS_VMMETER_H) /*OS X does not #include <sys/vmmeter.h> if (defined(KERNEL) && !defined(MACH_USER_API)) */
+#include <sys/vmmeter.h>
+#endif
+#else
+#if HAVE_VM_VM_H
+#include <vm/vm.h>
+#if HAVE_MACHINE_TYPES_H
+#include <machine/types.h>
+#endif
+#if HAVE_SYS_VMMETER_H
+#include <sys/vmmeter.h>
+#endif
+#if HAVE_VM_VM_PARAM_H
+#include <vm/vm_param.h>
+#endif
+#else
+#if HAVE_SYS_VMPARAM_H
+#include <sys/vmparam.h>
+#endif
+#if HAVE_SYS_VMMAC_H
+#include <sys/vmmac.h>
+#endif
+#if HAVE_SYS_VMMETER_H
+#include <sys/vmmeter.h>
+#endif
+#if HAVE_SYS_VMSYSTM_H
+#include <sys/vmsystm.h>
+#endif
+#endif                          /* vm/vm.h */
+#endif                          /* sys/vm.h */
+#if HAVE_SYS_POOL_H
+#if defined(MBPOOL_SYMBOL) && defined(MCLPOOL_SYMBOL)
+#define __POOL_EXPOSE
+#include <sys/pool.h>
+#else
+#undef HAVE_SYS_POOL_H
+#endif
+#endif
+#if HAVE_SYS_MBUF_H
+#include <sys/mbuf.h>
+#endif
+#if HAVE_SYS_SYSCTL_H
+#include <sys/sysctl.h>
+#if defined(CTL_HW) && defined(HW_PAGESIZE)
+#define USE_SYSCTL
+#endif
+#if defined(CTL_VM) && defined(VM_METER)
+#define USE_SYSCTL_VM
+#endif
+#endif
+#endif                          /* ifndef dynix */
+
+#include "host_res.h"
+#include "hr_storage.h"
+#include "hr_filesys.h"
+#include <net-snmp/agent/auto_nlist.h>
+
+#if HAVE_MNTENT_H
+#include <mntent.h>
+#endif
+#if HAVE_SYS_MNTTAB_H
+#include <sys/mnttab.h>
+#endif
+#if HAVE_SYS_STATVFS_H
+#include <sys/statvfs.h>
+#endif
+#if HAVE_SYS_VFS_H
+#include <sys/vfs.h>
+#endif
+#if HAVE_SYS_MOUNT_H
+#ifdef __osf__
+#undef m_next
+#undef m_data
+#endif
+#include <sys/mount.h>
+#endif
+#ifdef HAVE_MACHINE_PARAM_H
+#include <machine/param.h>
+#endif
+#include <sys/stat.h>
+
+#if defined(hpux10) || defined(hpux11)
+#include <sys/pstat.h>
+#endif
+#if defined(solaris2)
+#if HAVE_SYS_SWAP_H
+#include <sys/swap.h>
+#endif
+#endif
+
+#if HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+
+#include <net-snmp/utilities.h>
+#include <net-snmp/output_api.h>
+
+#if solaris2
+#include "kernel_sunos5.h"
+#endif
+
+#include <net-snmp/agent/agent_read_config.h>
+#include <net-snmp/library/read_config.h>
+
+#define HRSTORE_MONOTONICALLY_INCREASING
+
+        /*********************
+	 *
+	 *  Kernel & interface information,
+	 *   and internal forward declarations
+	 *
+	 *********************/
+
+
+#ifdef solaris2
+
+extern struct mnttab *HRFS_entry;
+#define HRFS_mount	mnt_mountp
+#define HRFS_statfs	statvfs
+
+#elif defined(HAVE_STATVFS)
+
+extern struct mntent *HRFS_entry;
+extern int      fscount;
+#define HRFS_statfs	statvfs
+#define HRFS_mount	mnt_dir
+
+#elif defined(HAVE_GETFSSTAT)
+
+extern struct statfs *HRFS_entry;
+extern int      fscount;
+#define HRFS_statfs	statfs
+#define HRFS_mount	f_mntonname
+
+#else
+
+extern struct mntent *HRFS_entry;
+#define HRFS_mount	mnt_dir
+#define HRFS_statfs	statfs
+
+#endif
+
+static int      physmem, pagesize;
+static void parse_storage_config(const char *, char *);
+
+        /*********************
+	 *
+	 *  Initialisation & common implementation functions
+	 *
+	 *********************/
+int             Get_Next_HR_Store(void);
+void            Init_HR_Store(void);
+int             header_hrstore(struct variable *, oid *, size_t *, int,
+                               size_t *, WriteMethod **);
+int             header_hrstoreEntry(struct variable *, oid *, size_t *,
+                                    int, size_t *, WriteMethod **);
+
+#ifdef linux
+int             linux_mem(int, int);
+#endif
+
+#ifdef solaris2
+void            sol_get_swapinfo(int *, int *);
+#endif
+
+#define	HRSTORE_MEMSIZE		1
+#define	HRSTORE_INDEX		2
+#define	HRSTORE_TYPE		3
+#define	HRSTORE_DESCR		4
+#define	HRSTORE_UNITS		5
+#define	HRSTORE_SIZE		6
+#define	HRSTORE_USED		7
+#define	HRSTORE_FAILS		8
+
+struct variable4 hrstore_variables[] = {
+    {HRSTORE_MEMSIZE, ASN_INTEGER, RONLY, var_hrstore, 1, {2}},
+    {HRSTORE_INDEX, ASN_INTEGER, RONLY, var_hrstore, 3, {3, 1, 1}},
+    {HRSTORE_TYPE, ASN_OBJECT_ID, RONLY, var_hrstore, 3, {3, 1, 2}},
+    {HRSTORE_DESCR, ASN_OCTET_STR, RONLY, var_hrstore, 3, {3, 1, 3}},
+    {HRSTORE_UNITS, ASN_INTEGER, RONLY, var_hrstore, 3, {3, 1, 4}},
+    {HRSTORE_SIZE, ASN_INTEGER, RONLY, var_hrstore, 3, {3, 1, 5}},
+    {HRSTORE_USED, ASN_INTEGER, RONLY, var_hrstore, 3, {3, 1, 6}},
+    {HRSTORE_FAILS, ASN_COUNTER, RONLY, var_hrstore, 3, {3, 1, 7}}
+};
+oid             hrstore_variables_oid[] = { 1, 3, 6, 1, 2, 1, 25, 2 };
+
+
+void
+init_hr_storage(void)
+{
+#ifdef USE_SYSCTL
+    int             mib[2];
+    size_t          len;
+#elif defined(hpux10) || defined(hpux11)
+    struct pst_static pst_buf;
+#endif
+
+#ifdef USE_SYSCTL
+    mib[0] = CTL_HW;
+    mib[1] = HW_PHYSMEM;
+    len = sizeof(physmem);
+    if (sysctl(mib, 2, &physmem, &len, NULL, 0) == -1)
+        snmp_log_perror("sysctl: physmem");
+    mib[1] = HW_PAGESIZE;
+    len = sizeof(pagesize);
+    if (sysctl(mib, 2, &pagesize, &len, NULL, 0) == -1)
+        snmp_log_perror("sysctl: pagesize");
+    physmem /= pagesize;
+#elif defined(hpux10) || defined(hpux11)
+    if (pstat_getstatic(&pst_buf, sizeof(struct pst_static), 1, 0) < 0) {
+        perror("pstat_getstatic");
+    } else {
+        physmem = pst_buf.physical_memory;
+        pagesize = pst_buf.page_size;
+    }
+#else                           /* !USE_SYSCTL && !hpux10 && !hpux11 */
+#ifdef HAVE_GETPAGESIZE
+    pagesize = getpagesize();
+#elif defined(_SC_PAGESIZE)
+    pagesize = sysconf(_SC_PAGESIZE);
+#elif defined(PGSHIFT)
+    pagesize = 1 << PGSHIFT;
+#elif defined(PAGE_SHIFT)
+    pagesize = 1 << PAGE_SHIFT;
+#elif defined(PAGE_SIZE)
+    pagesize = PAGE_SIZE;
+#elif defined(linux)
+    {
+        struct stat     kc_buf;
+        stat("/proc/kcore", &kc_buf);
+        pagesize = kc_buf.st_size / 1024;       /* 4K too large ? */
+    }
+#else
+    pagesize = PAGESIZE;
+#endif
+#ifdef _SC_PHYS_PAGES
+    physmem = sysconf(_SC_PHYS_PAGES);
+#else
+#ifdef dynix
+    physmem = sysconf(_SC_PHYSMEM);
+#else
+    auto_nlist(PHYSMEM_SYMBOL, (char *) &physmem, sizeof(physmem));
+#endif
+#endif
+#endif                          /* !USE_SYSCTL && !hpux10 && !hpux11 */
+#ifdef TOTAL_MEMORY_SYMBOL
+    auto_nlist(TOTAL_MEMORY_SYMBOL, 0, 0);
+#endif
+#ifdef MBSTAT_SYMBOL
+    auto_nlist(MBSTAT_SYMBOL, 0, 0);
+#endif
+
+    REGISTER_MIB("host/hr_storage", hrstore_variables, variable4,
+                 hrstore_variables_oid);
+
+    snmpd_register_config_handler("storageUseNFS", parse_storage_config, NULL,
+	"1 | 2\t\t(1 = enable, 2 = disable)");
+}
+
+static int storageUseNFS = 0;	/* initially disabled */
+
+static void
+parse_storage_config(const char *token, char *cptr)
+{
+    char *val;
+    int ival;
+
+    val = strtok(cptr, " \t");
+    if (!val) {
+        config_perror("Missing FLAG parameter in storageUseNFS");
+        return;
+    }
+    ival = atoi(val);
+    if (ival < 1 || ival > 2) {
+        config_perror("storageUseNFS must be 1 or 2");
+        return;
+    }
+    storageUseNFS = (ival == 1) ? 1 : 0;
+}
+
+/*
+ * header_hrstore(...
+ * Arguments:
+ * vp     IN      - pointer to variable entry that points here
+ * name    IN/OUT  - IN/name requested, OUT/name found
+ * length  IN/OUT  - length of IN/OUT oid's 
+ * exact   IN      - TRUE if an exact match was requested
+ * var_len OUT     - length of variable or 0 if function returned
+ * write_method
+ * 
+ */
+
+int
+header_hrstore(struct variable *vp,
+               oid * name,
+               size_t * length,
+               int exact, size_t * var_len, WriteMethod ** write_method)
+{
+#define HRSTORE_NAME_LENGTH	9
+    oid             newname[MAX_OID_LEN];
+    int             result;
+
+    DEBUGMSGTL(("host/hr_storage", "var_hrstore: "));
+    DEBUGMSGOID(("host/hr_storage", name, *length));
+    DEBUGMSG(("host/hr_storage", " %d\n", exact));
+
+    memcpy((char *) newname, (char *) vp->name, vp->namelen * sizeof(oid));
+    newname[HRSTORE_NAME_LENGTH] = 0;
+    result = snmp_oid_compare(name, *length, newname, vp->namelen + 1);
+    if ((exact && (result != 0)) || (!exact && (result >= 0)))
+        return (MATCH_FAILED);
+    memcpy((char *) name, (char *) newname,
+           (vp->namelen + 1) * sizeof(oid));
+    *length = vp->namelen + 1;
+
+    *write_method = 0;
+    *var_len = sizeof(long);    /* default to 'long' results */
+    return (MATCH_SUCCEEDED);
+}
+
+int
+header_hrstoreEntry(struct variable *vp,
+                    oid * name,
+                    size_t * length,
+                    int exact,
+                    size_t * var_len, WriteMethod ** write_method)
+{
+#define HRSTORE_ENTRY_NAME_LENGTH	11
+    oid             newname[MAX_OID_LEN];
+    int             storage_idx, LowIndex = -1;
+    int             result;
+
+    DEBUGMSGTL(("host/hr_storage", "var_hrstoreEntry: "));
+    DEBUGMSGOID(("host/hr_storage", name, *length));
+    DEBUGMSG(("host/hr_storage", " %d\n", exact));
+
+    memcpy((char *) newname, (char *) vp->name,
+           (int) vp->namelen * sizeof(oid));
+    /*
+     * Find "next" storage entry 
+     */
+
+    Init_HR_Store();
+    for (;;) {
+        storage_idx = Get_Next_HR_Store();
+        DEBUGMSG(("host/hr_storage", "(index %d ....", storage_idx));
+        if (storage_idx == -1)
+            break;
+        newname[HRSTORE_ENTRY_NAME_LENGTH] = storage_idx;
+        DEBUGMSGOID(("host/hr_storage", newname, *length));
+        DEBUGMSG(("host/hr_storage", "\n"));
+        result = snmp_oid_compare(name, *length, newname, vp->namelen + 1);
+        if (exact && (result == 0)) {
+            LowIndex = storage_idx;
+            /*
+             * Save storage status information 
+             */
+            break;
+        }
+        if ((!exact && (result < 0)) &&
+            (LowIndex == -1 || storage_idx < LowIndex)) {
+            LowIndex = storage_idx;
+            /*
+             * Save storage status information 
+             */
+#ifdef HRSTORE_MONOTONICALLY_INCREASING
+            break;
+#endif
+        }
+    }
+
+    if (LowIndex == -1) {
+        DEBUGMSGTL(("host/hr_storage", "... index out of range\n"));
+        return (MATCH_FAILED);
+    }
+
+    memcpy((char *) name, (char *) newname,
+           ((int) vp->namelen + 1) * sizeof(oid));
+    *length = vp->namelen + 1;
+    *write_method = 0;
+    *var_len = sizeof(long);    /* default to 'long' results */
+
+    DEBUGMSGTL(("host/hr_storage", "... get storage stats "));
+    DEBUGMSGOID(("host/hr_storage", name, *length));
+    DEBUGMSG(("host/hr_storage", "\n"));
+    return LowIndex;
+}
+
+oid             storage_type_id[] = { 1, 3, 6, 1, 2, 1, 25, 2, 1, 1 };  /* hrStorageOther */
+int             storage_type_len =
+    sizeof(storage_type_id) / sizeof(storage_type_id[0]);
+
+        /*********************
+	 *
+	 *  System specific implementation functions
+	 *
+	 *********************/
+
+static const char *hrs_descr[] = {
+    NULL,
+    "Real Memory",              /* HRS_TYPE_MEM */
+    "Swap Space",               /* HRS_TYPE_SWAP */
+    "Memory Buffers"            /* HRS_TYPE_MBUF */
+};
+
+
+
+u_char         *
+var_hrstore(struct variable *vp,
+            oid * name,
+            size_t * length,
+            int exact, size_t * var_len, WriteMethod ** write_method)
+{
+    int             store_idx = 0;
+#if !defined(linux)
+#if defined(solaris2)
+    int             freemem;
+    int             swap_total, swap_used;
+#elif defined(hpux10) || defined(hpux11)
+    struct pst_dynamic pst_buf;
+#elif defined(TOTAL_MEMORY_SYMBOL) || defined(USE_SYSCTL_VM)
+    struct vmtotal  memory_totals;
+#endif
+#if HAVE_SYS_POOL_H
+    struct pool     mbpool, mclpool;
+    int             i;
+#endif
+#ifdef MBSTAT_SYMBOL
+    struct mbstat   mbstat;
+#endif
+#endif                          /* !linux */
+    static char     string[100];
+    struct HRFS_statfs stat_buf;
+
+    if (vp->magic == HRSTORE_MEMSIZE) {
+        if (header_hrstore(vp, name, length, exact, var_len, write_method)
+            == MATCH_FAILED)
+            return NULL;
+    } else {
+
+        store_idx =
+            header_hrstoreEntry(vp, name, length, exact, var_len,
+                                write_method);
+        if (store_idx == MATCH_FAILED)
+            return NULL;
+
+        if (store_idx < HRS_TYPE_FS_MAX) {
+            if (HRFS_statfs(HRFS_entry->HRFS_mount, &stat_buf) < 0)
+                return NULL;
+        }
+#if !defined(linux) && !defined(solaris2)
+        else
+            switch (store_idx) {
+            case HRS_TYPE_MEM:
+            case HRS_TYPE_SWAP:
+#ifdef USE_SYSCTL_VM
+                {
+                    int             mib[2];
+                    size_t          len = sizeof(memory_totals);
+                    mib[0] = CTL_VM;
+                    mib[1] = VM_METER;
+                    sysctl(mib, 2, &memory_totals, &len, NULL, 0);
+                }
+#elif defined(hpux10) || defined(hpux11)
+                pstat_getdynamic(&pst_buf, sizeof(struct pst_dynamic), 1, 0);
+#elif defined(TOTAL_MEMORY_SYMBOL)
+                auto_nlist(TOTAL_MEMORY_SYMBOL, (char *) &memory_totals,
+                           sizeof(struct vmtotal));
+#endif
+                break;
+#if !defined(hpux10) && !defined(hpux11)
+            case HRS_TYPE_MBUF:
+#if HAVE_SYS_POOL_H
+                auto_nlist(MBPOOL_SYMBOL, (char *) &mbpool,
+                           sizeof(mbpool));
+                auto_nlist(MCLPOOL_SYMBOL, (char *) &mclpool,
+                           sizeof(mclpool));
+#endif
+#ifdef MBSTAT_SYMBOL
+                auto_nlist(MBSTAT_SYMBOL, (char *) &mbstat,
+                           sizeof(mbstat));
+#endif
+                break;
+#endif      /* !hpux10 && !hpux11 */
+            default:
+                break;
+            }
+#endif                          /* !linux && !solaris2 */
+    }
+
+
+
+    switch (vp->magic) {
+    case HRSTORE_MEMSIZE:
+        long_return = physmem * (pagesize / 1024);
+        return (u_char *) & long_return;
+
+    case HRSTORE_INDEX:
+        long_return = store_idx;
+        return (u_char *) & long_return;
+    case HRSTORE_TYPE:
+        if (store_idx < HRS_TYPE_FS_MAX)
+            if (storageUseNFS && Check_HR_FileSys_NFS())
+                storage_type_id[storage_type_len - 1] = 10;     /* Network Disk */
+            else
+                storage_type_id[storage_type_len - 1] = 4;      /* Assume fixed */
+        else
+            switch (store_idx) {
+            case HRS_TYPE_MEM:
+                storage_type_id[storage_type_len - 1] = 2;      /* RAM */
+                break;
+            case HRS_TYPE_SWAP:
+                storage_type_id[storage_type_len - 1] = 3;      /* Virtual Mem */
+                break;
+            case HRS_TYPE_MBUF:
+                storage_type_id[storage_type_len - 1] = 1;      /* Other */
+                break;
+            default:
+                storage_type_id[storage_type_len - 1] = 1;      /* Other */
+                break;
+            }
+        *var_len = sizeof(storage_type_id);
+        return (u_char *) storage_type_id;
+    case HRSTORE_DESCR:
+        if (store_idx < HRS_TYPE_FS_MAX) {
+            strncpy(string, HRFS_entry->HRFS_mount, sizeof(string)-1);
+            string[ sizeof(string)-1 ] = 0;
+            *var_len = strlen(string);
+            return (u_char *) string;
+        } else {
+            store_idx = store_idx - HRS_TYPE_FS_MAX;
+            *var_len = strlen(hrs_descr[store_idx]);
+            return (u_char *) hrs_descr[store_idx];
+        }
+    case HRSTORE_UNITS:
+        if (store_idx < HRS_TYPE_FS_MAX)
+#if STRUCT_STATVFS_HAS_F_FRSIZE
+            long_return = stat_buf.f_frsize;
+#else
+            long_return = stat_buf.f_bsize;
+#endif
+        else
+            switch (store_idx) {
+            case HRS_TYPE_MEM:
+            case HRS_TYPE_SWAP:
+#if defined(USE_SYSCTL) || defined(solaris2)
+                long_return = pagesize;
+#elif defined(NBPG)
+                long_return = NBPG;
+#else
+                long_return = 1024;     /* Report in Kb */
+#endif
+                break;
+            case HRS_TYPE_MBUF:
+#ifdef MSIZE
+                long_return = MSIZE;
+#else
+                long_return = 256;
+#endif
+                break;
+            default:
+#if NO_DUMMY_VALUES
+                return NULL;
+#endif
+                long_return = 1024;     /* As likely as any! */
+                break;
+            }
+        return (u_char *) & long_return;
+    case HRSTORE_SIZE:
+        if (store_idx < HRS_TYPE_FS_MAX)
+            long_return = stat_buf.f_blocks;
+        else
+            switch (store_idx) {
+#if defined(linux)
+            case HRS_TYPE_MEM:
+            case HRS_TYPE_SWAP:
+                long_return = linux_mem(store_idx, HRSTORE_SIZE);
+                break;
+#elif defined(solaris2)
+            case HRS_TYPE_MEM:
+                long_return = physmem;
+                break;
+            case HRS_TYPE_SWAP:
+                sol_get_swapinfo(&swap_total, &swap_used);
+                long_return = swap_total;
+                break;
+#elif defined(hpux10) || defined(hpux11)
+            case HRS_TYPE_MEM:
+                long_return = pst_buf.psd_rm;
+                break;
+            case HRS_TYPE_SWAP:
+                long_return = pst_buf.psd_vm;
+                break;
+#elif defined(TOTAL_MEMORY_SYMBOL) || defined(USE_SYSCTL_VM)
+            case HRS_TYPE_MEM:
+                long_return = memory_totals.t_rm;
+                break;
+            case HRS_TYPE_SWAP:
+                long_return = memory_totals.t_vm;
+                break;
+#else               /* !linux && !solaris2 && !hpux10 && !hpux11 && ... */
+            case HRS_TYPE_MEM:
+                long_return = physmem;
+                break;
+            case HRS_TYPE_SWAP:
+#if NO_DUMMY_VALUES
+                return NULL;
+#endif
+                long_return = 0;
+                break;
+            case HRS_TYPE_MBUF:
+#if HAVE_SYS_POOL_H
+                long_return = 0;
+                for (i = 0;
+                     i <
+                     sizeof(mbstat.m_mtypes) / sizeof(mbstat.m_mtypes[0]);
+                     i++)
+                    long_return += mbstat.m_mtypes[i];
+#elif defined(MBSTAT_SYMBOL)
+                long_return = mbstat.m_mbufs;
+#elif defined(NO_DUMMY_VALUES)
+                return NULL;
+#else
+                long_return = 0;
+#endif
+                break;
+#endif              /* !linux && !solaris2 && !hpux10 && !hpux11 && ... */
+            default:
+#if NO_DUMMY_VALUES
+                return NULL;
+#endif
+                long_return = 1024;
+                break;
+            }
+        return (u_char *) & long_return;
+    case HRSTORE_USED:
+        if (store_idx < HRS_TYPE_FS_MAX)
+            long_return = (stat_buf.f_blocks - stat_buf.f_bfree);
+        else
+            switch (store_idx) {
+#if defined(linux)
+            case HRS_TYPE_MEM:
+            case HRS_TYPE_SWAP:
+                long_return = linux_mem(store_idx, HRSTORE_USED);
+                break;
+#elif defined(solaris2)
+            case HRS_TYPE_MEM:
+                getKstatInt("unix", "system_pages", "freemem", &freemem);
+                long_return = physmem - freemem;
+                break;
+            case HRS_TYPE_SWAP:
+                sol_get_swapinfo(&swap_total, &swap_used);
+                long_return = swap_used;
+                break;
+#elif defined(hpux10) || defined(hpux11)
+            case HRS_TYPE_MEM:
+                long_return = pst_buf.psd_arm;
+                break;
+            case HRS_TYPE_SWAP:
+                long_return = pst_buf.psd_avm;
+                break;
+#elif defined(TOTAL_MEMORY_SYMBOL) || defined(USE_SYSCTL_VM)
+            case HRS_TYPE_MEM:
+                long_return = memory_totals.t_arm;
+                break;
+            case HRS_TYPE_SWAP:
+                long_return = memory_totals.t_avm;
+                break;
+#endif              /* linux || solaris2 || hpux10 || hpux11 || ... */
+
+#if !defined(linux) && !defined(solaris2) && !defined(hpux10) && !defined(hpux11)
+            case HRS_TYPE_MBUF:
+#if HAVE_SYS_POOL_H
+                long_return = (mbpool.pr_nget - mbpool.pr_nput)
+                    * mbpool.pr_size + (mclpool.pr_nget - mclpool.pr_nput)
+                    * mclpool.pr_size;
+#elif defined(MBSTAT_SYMBOL)
+                long_return = mbstat.m_clusters - mbstat.m_clfree;      /* unlikely, but... */
+#elif defined(NO_DUMMY_VALUES)
+                return NULL;
+#else
+                long_return = 0;
+#endif
+                break;
+#endif                      /* !linux && !solaris2 && !hpux10 && !hpux11 && ... */
+            default:
+#if NO_DUMMY_VALUES
+                return NULL;
+#endif
+                long_return = 1024;
+                break;
+            }
+        return (u_char *) & long_return;
+    case HRSTORE_FAILS:
+        if (store_idx < HRS_TYPE_FS_MAX)
+            long_return = 0;
+        else
+            switch (store_idx) {
+            case HRS_TYPE_MEM:
+            case HRS_TYPE_SWAP:
+#if NO_DUMMY_VALUES
+                return NULL;
+#endif
+                long_return = 0;
+                break;
+#if !defined(linux) && !defined(solaris2) && !defined(hpux10) && !defined(hpux11)  && defined(MBSTAT_SYMBOL)
+            case HRS_TYPE_MBUF:
+                long_return = mbstat.m_drops;
+                break;
+#endif                          /* !linux && !solaris2 && !hpux10 && !hpux11 && MBSTAT_SYMBOL */
+            default:
+#if NO_DUMMY_VALUES
+                return NULL;
+#endif
+                long_return = 0;
+                break;
+            }
+        return (u_char *) & long_return;
+    default:
+        DEBUGMSGTL(("snmpd", "unknown sub-id %d in var_hrstore\n",
+                    vp->magic));
+    }
+    return NULL;
+}
+
+
+        /*********************
+	 *
+	 *  Internal implementation functions
+	 *
+	 *********************/
+
+static int      FS_storage;
+static int      HRS_index;
+
+void
+Init_HR_Store(void)
+{
+    HRS_index = -1;
+    Init_HR_FileSys();
+    FS_storage = 1;             /* Start with file-based storage */
+}
+
+int
+Get_Next_HR_Store(void)
+{
+    /*
+     * File-based storage 
+     */
+    long_return = -1;
+    if (FS_storage == 1) {
+        HRS_index = Get_Next_HR_FileSys();
+
+        if (HRS_index >= 0)
+            return HRS_index;
+        FS_storage = 0;         /* End of filesystems */
+        HRS_index = HRS_TYPE_FS_MAX;
+    }
+
+    /*
+     * 'Other' storage types 
+     */
+    ++HRS_index;
+#if !defined(solaris2) && !defined(hpux10) && !defined(hpux11)
+    if (HRS_index < HRS_TYPE_MAX)
+        return HRS_index;
+    else
+#else
+    if (HRS_index < HRS_TYPE_MBUF)
+        return HRS_index;
+    else
+#endif
+        return -1;
+}
+
+#ifdef linux
+int
+linux_mem(int mem_type, int size_or_used)
+{
+    FILE           *fp;
+    char            buf[100];
+    int             size = -1, used = -1;
+
+    if ((fp = fopen("/proc/meminfo", "r")) == NULL)
+        return -1;
+
+    while (fgets(buf, sizeof(buf), fp) != NULL) {
+        if ((!strncmp(buf, "Mem:", 4) && mem_type == HRS_TYPE_MEM) ||
+            (!strncmp(buf, "Swap:", 5) && mem_type == HRS_TYPE_SWAP)) {
+            sscanf(buf, "%*s %d %d", &size, &used);
+            break;
+        }
+    }
+
+    fclose(fp);
+    return (size_or_used == HRSTORE_SIZE ? size : used) / 1024;
+
+}
+#endif
+
+#ifdef solaris2
+void
+sol_get_swapinfo(int *totalP, int *usedP)
+{
+    struct anoninfo ainfo;
+
+    if (swapctl(SC_AINFO, &ainfo) < 0) {
+        *totalP = *usedP = 0;
+        return;
+    }
+
+    *totalP = ainfo.ani_max;
+    *usedP = ainfo.ani_resv;
+}
+#endif                          /* solaris2 */
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/host/hr_storage.h tomato121/release/src/router/snmp/agent/mibgroup/host/hr_storage.h
--- tomato/release/src/router/snmp/agent/mibgroup/host/hr_storage.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/host/hr_storage.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,21 @@
+/*
+ *  Host Resources MIB - storage group interface - hr_system.h
+ *
+ */
+#ifndef _MIBGROUP_HRSTORAGE_H
+#define _MIBGROUP_HRSTORAGE_H
+
+extern void     init_hr_storage(void);
+extern FindVarMethod var_hrstore;
+
+#define	HRS_TYPE_FS_MAX		100     /* Maximum # of filesystems supported */
+
+#define	HRS_TYPE_MEM		101     /* incrementally from FS_MAX */
+#define	HRS_TYPE_SWAP		102
+#define	HRS_TYPE_MBUF		103
+                                        /*
+                                         * etc, etc, etc 
+                                         */
+#define	HRS_TYPE_MAX		104     /* one greater than largest type */
+
+#endif                          /* _MIBGROUP_HRSTORAGE_H */
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/host/hr_swinst.c tomato121/release/src/router/snmp/agent/mibgroup/host/hr_swinst.c
--- tomato/release/src/router/snmp/agent/mibgroup/host/hr_swinst.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/host/hr_swinst.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,687 @@
+/*
+ *  Host Resources MIB - Installed Software group implementation - hr_swinst.c
+ *
+ */
+
+#include <net-snmp/net-snmp-config.h>
+
+#if HAVE_SYS_PARAM_H
+#include <sys/param.h>
+#endif
+#include <sys/stat.h>
+#if TIME_WITH_SYS_TIME
+# include <sys/time.h>
+# include <time.h>
+#else
+# if HAVE_SYS_TIME_H
+#  include <sys/time.h>
+# else
+#  include <time.h>
+# endif
+#endif
+#if HAVE_DIRENT_H
+#include <dirent.h>
+#else
+# define dirent direct
+# if HAVE_SYS_NDIR_H
+#  include <sys/ndir.h>
+# endif
+# if HAVE_SYS_DIR_H
+#  include <sys/dir.h>
+# endif
+# if HAVE_NDIR_H
+#  include <ndir.h>
+# endif
+#endif
+#ifdef HAVE_PKGLOCS_H
+#include <pkglocs.h>
+#endif
+#ifdef HAVE_PKGINFO_H
+#include <pkginfo.h>
+#endif
+
+#ifdef HAVE_LIBRPM
+#include <rpm/rpmlib.h>
+#include <rpm/header.h>
+#include <fcntl.h>
+#endif
+
+#ifdef HAVE_RPMGETPATH
+#include <rpm/rpmmacro.h>
+#endif
+
+#if HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+
+#include "host_res.h"
+#include "hr_swinst.h"
+#include <net-snmp/utilities.h>
+
+#define HRSWINST_MONOTONICALLY_INCREASING
+
+        /*********************
+	 *
+	 *  Kernel & interface information,
+	 *   and internal forward declarations
+	 *
+	 *********************/
+
+/*
+ * Reorganize the global data into a single static structure.
+ *
+ *      Old                     New
+ *======================================================
+ *      HRSW_directory          swi->swi_directory
+ *      HRSW_name[100]          swi->swi_name[SNMP_MAXPATH]
+ *      HRSW_index              swi->swi_index
+ *
+ *                              swi->swi_dbpath         (RPM only)
+ *                              swi->swi_maxrec         (RPM only)
+ *                              swi->swi_nrec           (RPM only)
+ *                              swi->swi_recs           (RPM only)
+ *      rpm_db                  swi->swi_rpmdb          (RPM only)
+ *                              swi->swi_h              (RPM only)
+ *                              swi->swi_prevx          (RPM only)
+ *
+ *      dp                      swi->swi_dp
+ *      de_p                    swi->swi_dep
+ */
+typedef struct {
+#if HAVE_LIBRPM
+    char           *swi_directory;
+#else
+    const char     *swi_directory;
+#endif
+    char            swi_name[SNMP_MAXPATH];     /* XXX longest file name */
+    int             swi_index;
+
+#if HAVE_LIBRPM
+    const char     *swi_dbpath;
+
+    time_t          swi_timestamp;      /* modify time on database */
+    int             swi_maxrec; /* no. of allocations */
+    int             swi_nrec;   /* no. of valid offsets */
+    int            *swi_recs;   /* db record offsets */
+    rpmdb           swi_rpmdb;
+    Header          swi_h;
+    int             swi_prevx;
+#else
+    DIR            *swi_dp;
+    struct dirent  *swi_dep;
+#endif
+
+} SWI_t;
+
+static SWI_t    _myswi = { NULL, "", 0 };       /* XXX static for now */
+
+int             header_hrswinst(struct variable *, oid *, size_t *, int,
+                                size_t *, WriteMethod **);
+int             header_hrswInstEntry(struct variable *, oid *, size_t *,
+                                     int, size_t *, WriteMethod **);
+
+extern struct timeval starttime;
+
+        /*********************
+	 *
+	 *  Initialisation & common implementation functions
+	 *
+	 *********************/
+extern void     Init_HR_SWInst(void);
+extern int      Get_Next_HR_SWInst(void);
+extern void     End_HR_SWInst(void);
+extern void     Save_HR_SW_info(int ix);
+
+#ifdef HAVE_LIBRPM
+static void     Mark_HRSW_token(void);
+static void     Release_HRSW_token(void);
+#else
+#define	Mark_HRSW_token()
+#define	Release_HRSW_token()
+#endif
+
+
+#define	HRSWINST_CHANGE		1
+#define	HRSWINST_UPDATE		2
+#define	HRSWINST_INDEX		3
+#define	HRSWINST_NAME		4
+#define	HRSWINST_ID		5
+#define	HRSWINST_TYPE		6
+#define	HRSWINST_DATE		7
+
+struct variable4 hrswinst_variables[] = {
+    {HRSWINST_CHANGE, ASN_TIMETICKS, RONLY, var_hrswinst, 1, {1}},
+    {HRSWINST_UPDATE, ASN_TIMETICKS, RONLY, var_hrswinst, 1, {2}},
+    {HRSWINST_INDEX, ASN_INTEGER, RONLY, var_hrswinst, 3, {3, 1, 1}},
+    {HRSWINST_NAME, ASN_OCTET_STR, RONLY, var_hrswinst, 3, {3, 1, 2}},
+    {HRSWINST_ID, ASN_OBJECT_ID, RONLY, var_hrswinst, 3, {3, 1, 3}},
+    {HRSWINST_TYPE, ASN_INTEGER, RONLY, var_hrswinst, 3, {3, 1, 4}},
+    {HRSWINST_DATE, ASN_OCTET_STR, RONLY, var_hrswinst, 3, {3, 1, 5}}
+};
+oid             hrswinst_variables_oid[] = { 1, 3, 6, 1, 2, 1, 25, 6 };
+
+
+#ifdef PKGLOC                   /* Description from HRSW_dir/.../pkginfo: DESC= */
+#define	_PATH_HRSW_directory	PKGLOC
+#endif
+#ifdef hpux9                    /* Description from HRSW_dir/.../index:   fd: */
+#define	_PATH_HRSW_directory	"/system"
+#endif
+#ifdef hpux10                   /* Description from HRSW_dir/.../pfiles/INDEX: title */
+#define	_PATH_HRSW_directory	"/var/adm/sw/products"
+#endif
+#ifdef hpux11                   /* Description from HRSW_dir/.../pfiles/INDEX: title */
+#define	_PATH_HRSW_directory	"/var/adm/sw/products"
+#endif
+#ifdef freebsd2
+#define	_PATH_HRSW_directory	"/var/db/pkg"
+#endif
+
+void
+init_hr_swinst(void)
+{
+#if defined(HAVE_LIBRPM) || defined(_PATH_HRSW_directory)
+    SWI_t          *swi = &_myswi;      /* XXX static for now */
+#endif
+#ifdef HAVE_LIBRPM
+    struct stat     stat_buf;
+#endif
+
+    /*
+     * Read settings from config file,
+     * or take system-specific defaults 
+     */
+
+#ifdef HAVE_LIBRPM
+    if (swi->swi_directory == NULL) {
+        char            path[SNMP_MAXPATH];
+
+        /*
+         * XXX distinguish between rpm-2.5.x and rpm-2.9x 
+         */
+#ifdef HAVE_RPMGETPATH
+        rpmReadConfigFiles(NULL, NULL);
+        swi->swi_dbpath = rpmGetPath("%{_dbpath}", NULL);
+#else
+        rpmReadConfigFiles(NULL, NULL, NULL, 0);
+        swi->swi_dbpath = rpmGetVar(RPMVAR_DBPATH);
+#endif
+        if (swi->swi_directory != NULL)
+            free(swi->swi_directory);
+        snprintf(path, sizeof(path), "%s/Packages", swi->swi_dbpath);
+        if (stat(path, &stat_buf) == -1)
+            snprintf(path, sizeof(path), "%s/packages.rpm", swi->swi_dbpath);
+        path[ sizeof(path)-1 ] = 0;
+        swi->swi_directory = strdup(path);
+    }
+#else
+#  ifdef _PATH_HRSW_directory
+    if (swi->swi_directory == NULL) {
+        swi->swi_directory = _PATH_HRSW_directory;
+    }
+    strcpy(swi->swi_name, "[installed name]");  /* default name */
+#  else
+    /*
+     * XXX SunOS4 package directory is ?? -MJS 
+     */
+    return;                     /* packages not known - don't register */
+#  endif
+#endif
+
+    REGISTER_MIB("host/hr_swinst", hrswinst_variables, variable4,
+                 hrswinst_variables_oid);
+}
+
+/*
+ * header_hrswinst(...
+ * Arguments:
+ * vp     IN      - pointer to variable entry that points here
+ * name    IN/OUT  - IN/name requested, OUT/name found
+ * length  IN/OUT  - length of IN/OUT oid's 
+ * exact   IN      - TRUE if an exact match was requested
+ * var_len OUT     - length of variable or 0 if function returned
+ * write_method
+ */
+
+int
+header_hrswinst(struct variable *vp,
+                oid * name,
+                size_t * length,
+                int exact, size_t * var_len, WriteMethod ** write_method)
+{
+#define HRSWINST_NAME_LENGTH	9
+    oid             newname[MAX_OID_LEN];
+    int             result;
+
+    DEBUGMSGTL(("host/hr_swinst", "var_hrswinst: "));
+    DEBUGMSGOID(("host/hr_swinst", name, *length));
+    DEBUGMSG(("host/hr_swinst", " %d\n", exact));
+
+    memcpy((char *) newname, (char *) vp->name, vp->namelen * sizeof(oid));
+    newname[HRSWINST_NAME_LENGTH] = 0;
+    result = snmp_oid_compare(name, *length, newname, vp->namelen + 1);
+    if ((exact && (result != 0)) || (!exact && (result >= 0)))
+        return (MATCH_FAILED);
+    memcpy((char *) name, (char *) newname,
+           (vp->namelen + 1) * sizeof(oid));
+    *length = vp->namelen + 1;
+
+    *write_method = 0;
+    *var_len = sizeof(long);    /* default to 'long' results */
+    return (MATCH_SUCCEEDED);
+}
+
+int
+header_hrswInstEntry(struct variable *vp,
+                     oid * name,
+                     size_t * length,
+                     int exact,
+                     size_t * var_len, WriteMethod ** write_method)
+{
+#define HRSWINST_ENTRY_NAME_LENGTH	11
+    oid             newname[MAX_OID_LEN];
+    int             swinst_idx, LowIndex = -1;
+    int             result;
+
+    DEBUGMSGTL(("host/hr_swinst", "var_hrswinstEntry: "));
+    DEBUGMSGOID(("host/hr_swinst", name, *length));
+    DEBUGMSG(("host/hr_swinst", " %d\n", exact));
+
+    memcpy((char *) newname, (char *) vp->name, vp->namelen * sizeof(oid));
+    /*
+     * Find "next" installed software entry 
+     */
+
+    Init_HR_SWInst();
+    while ((swinst_idx = Get_Next_HR_SWInst()) != -1) {
+        DEBUGMSG(("host/hr_swinst", "(index %d ....", swinst_idx));
+
+        newname[HRSWINST_ENTRY_NAME_LENGTH] = swinst_idx;
+        DEBUGMSGOID(("host/hr_swinst", newname, *length));
+        DEBUGMSG(("host/hr_swinst", "\n"));
+        result = snmp_oid_compare(name, *length, newname, vp->namelen + 1);
+        if (exact && (result == 0)) {
+            LowIndex = swinst_idx;
+            Save_HR_SW_info(LowIndex);
+            break;
+        }
+        if ((!exact && (result < 0)) &&
+            (LowIndex == -1 || swinst_idx < LowIndex)) {
+            LowIndex = swinst_idx;
+            Save_HR_SW_info(LowIndex);
+#ifdef HRSWINST_MONOTONICALLY_INCREASING
+            break;
+#endif
+        }
+    }
+
+    Mark_HRSW_token();
+    End_HR_SWInst();
+
+    if (LowIndex == -1) {
+        DEBUGMSGTL(("host/hr_swinst", "... index out of range\n"));
+        return (MATCH_FAILED);
+    }
+
+    memcpy((char *) name, (char *) newname,
+           (vp->namelen + 1) * sizeof(oid));
+    *length = vp->namelen + 1;
+    *write_method = 0;
+    *var_len = sizeof(long);    /* default to 'long' results */
+
+    DEBUGMSGTL(("host/hr_inst", "... get installed S/W stats "));
+    DEBUGMSGOID(("host/hr_inst", name, *length));
+    DEBUGMSG(("host/hr_inst", "\n"));
+    return LowIndex;
+}
+
+        /*********************
+	 *
+	 *  System specific implementation functions
+	 *
+	 *********************/
+
+
+u_char         *
+var_hrswinst(struct variable * vp,
+             oid * name,
+             size_t * length,
+             int exact, size_t * var_len, WriteMethod ** write_method)
+{
+    SWI_t          *swi = &_myswi;      /* XXX static for now */
+    int             sw_idx = 0;
+    static char     string[SNMP_MAXPATH];
+    u_char         *ret = NULL;
+    struct stat     stat_buf;
+
+    if (vp->magic < HRSWINST_INDEX) {
+        if (header_hrswinst(vp, name, length, exact, var_len, write_method)
+            == MATCH_FAILED)
+            return NULL;
+    } else {
+
+        sw_idx =
+            header_hrswInstEntry(vp, name, length, exact, var_len,
+                                 write_method);
+        if (sw_idx == MATCH_FAILED)
+            return NULL;
+    }
+
+    switch (vp->magic) {
+    case HRSWINST_CHANGE:
+    case HRSWINST_UPDATE:
+        string[0] = '\0';
+
+        if (swi->swi_directory != NULL) {
+            strncpy(string, swi->swi_directory, sizeof(string));
+            string[ sizeof(string)-1 ] = 0;
+        }
+
+        if (*string && (stat(string, &stat_buf) != -1)) {
+            if (stat_buf.st_mtime > starttime.tv_sec)
+                /*
+                 * changed 'recently' - i.e. since this agent started 
+                 */
+                long_return = (stat_buf.st_mtime - starttime.tv_sec) * 100;
+            else
+                long_return = 0;        /* predates this agent */
+        } else
+#if NO_DUMMY_VALUES
+            return NULL;
+#else
+            long_return = 363136200;
+#endif
+        ret = (u_char *) & long_return;
+        break;
+
+    case HRSWINST_INDEX:
+        long_return = sw_idx;
+        ret = (u_char *) & long_return;
+        break;
+    case HRSWINST_NAME:
+        {
+            strncpy(string, swi->swi_name, sizeof(string) - 1);
+            /*
+             * This will be unchanged from the initial "null"
+             * value, if swi->swi_name is not defined 
+             */
+            string[sizeof(string) - 1] = '\0';
+            *var_len = strlen(string);
+            ret = (u_char *) string;
+        }
+        break;
+    case HRSWINST_ID:
+        *var_len = nullOidLen;
+        ret = (u_char *) nullOid;
+        break;
+    case HRSWINST_TYPE:
+        {
+#ifdef HAVE_PKGINFO
+            /*
+             * at least on solaris2 this works 
+             */
+            char           *catg = pkgparam(swi->swi_name, "CATEGORY");
+
+            if (catg == NULL) {
+                long_return = 1;        /*  unknown  */
+            } else {
+                if (strstr(catg, "system") != NULL) {
+                    long_return = 2;    /*  operatingSystem  */
+                } else if (strstr(catg, "application") != NULL) {
+                    long_return = 4;    /*  applcation  */
+                } else {
+                    long_return = 1;    /*  unknown  */
+                }
+                free(catg);
+            }
+#else
+            long_return = 1;    /* unknown */
+#endif
+            ret = (u_char *) & long_return;
+        }
+        break;
+    case HRSWINST_DATE:
+        {
+#ifdef HAVE_LIBRPM
+            int_32         *rpm_data;
+            headerGetEntry(swi->swi_h, RPMTAG_INSTALLTIME, NULL,
+                           (void **) &rpm_data, NULL);
+            if (rpm_data != NULL) {
+                time_t          installTime = *rpm_data;
+                ret = date_n_time(&installTime, var_len);
+            } else {
+                ret = date_n_time(0, var_len);
+            }
+#else
+            if (swi->swi_directory != NULL) {
+                snprintf(string, sizeof(string), "%s/%s",
+                         swi->swi_directory, swi->swi_name);
+                string[ sizeof(string)-1 ] = 0;
+                stat(string, &stat_buf);
+                ret = date_n_time(&stat_buf.st_mtime, var_len);
+            } else {
+#if NO_DUMMY_VALUES
+                return NULL;
+#endif
+                sprintf(string, "back in the mists of time");
+                *var_len = strlen(string);
+                ret = (u_char *) string;
+            }
+#endif
+        }
+        break;
+    default:
+        DEBUGMSGTL(("snmpd", "unknown sub-id %d in var_hrswinst\n",
+                    vp->magic));
+        ret = NULL;
+        break;
+    }
+    Release_HRSW_token();
+    return ret;
+}
+
+
+        /*********************
+	 *
+	 *  Internal implementation functions
+	 *
+	 *********************/
+
+#ifdef	HAVE_LIBRPM
+static void
+Check_HRSW_cache(void *xxx)
+{
+    SWI_t          *swi = (SWI_t *) xxx;
+
+    /*
+     * Make sure cache is up-to-date 
+     */
+    if (swi->swi_recs != NULL) {
+        struct stat     sb;
+        lstat(swi->swi_directory, &sb);
+        if (swi->swi_timestamp == sb.st_mtime)
+            return;
+        swi->swi_timestamp = sb.st_mtime;
+    }
+
+    /*
+     * Get header offsets 
+     */
+    {
+        int             ix = 0;
+        int             offset;
+
+#if defined(RPMDBI_PACKAGES)
+        rpmdbMatchIterator mi = NULL;
+        Header          h;
+        mi = rpmdbInitIterator(swi->swi_rpmdb, RPMDBI_PACKAGES, NULL, 0);
+        while ((h = rpmdbNextIterator(mi)) != NULL) {
+            offset = rpmdbGetIteratorOffset(mi);
+#else
+        for (offset = rpmdbFirstRecNum(swi->swi_rpmdb);
+             offset != 0;
+             offset = rpmdbNextRecNum(swi->swi_rpmdb, offset)) {
+#endif
+
+            if (ix >= swi->swi_maxrec) {
+                swi->swi_maxrec += 256;
+                swi->swi_recs = (swi->swi_recs == NULL)
+                    ? (int *) malloc(swi->swi_maxrec * sizeof(int))
+                    : (int *) realloc(swi->swi_recs,
+                                      swi->swi_maxrec * sizeof(int));
+            }
+            swi->swi_recs[ix++] = offset;
+
+#if !defined(RPMDBI_PACKAGES)
+        }
+#else
+        }
+        rpmdbFreeIterator(mi);
+#endif
+
+        swi->swi_nrec = ix;
+    }
+}
+#endif                          /* HAVE_LIBRPM */
+
+void
+Init_HR_SWInst(void)
+{
+    SWI_t          *swi = &_myswi;      /* XXX static for now */
+    swi->swi_index = 0;
+
+#ifdef HAVE_LIBRPM
+    if (swi->swi_rpmdb != NULL)
+        return;
+    if (rpmdbOpen("", &swi->swi_rpmdb, O_RDONLY, 0644) != 0)
+        swi->swi_index = -1;
+    Check_HRSW_cache(swi);
+#else
+    if (swi->swi_directory != NULL) {
+        if (swi->swi_dp != NULL) {
+            closedir(swi->swi_dp);
+            swi->swi_dp = NULL;
+        }
+        if ((swi->swi_dp = opendir(swi->swi_directory)) == NULL)
+            swi->swi_index = -1;
+    } else
+        swi->swi_index = -1;
+#endif
+}
+
+int
+Get_Next_HR_SWInst(void)
+{
+    SWI_t          *swi = &_myswi;      /* XXX static for now */
+
+    if (swi->swi_index == -1)
+        return -1;
+
+#ifdef HAVE_LIBRPM
+    /*
+     * XXX Watchout: index starts with 1 
+     */
+    if (0 <= swi->swi_index && swi->swi_index < swi->swi_nrec)
+        return ++swi->swi_index;
+#else
+    if (swi->swi_directory != NULL) {
+        while ((swi->swi_dep = readdir(swi->swi_dp)) != NULL) {
+            if (swi->swi_dep->d_name[0] == '.')
+                continue;
+
+            /*
+             * Ought to check for "properly-formed" entry 
+             */
+
+            return ++swi->swi_index;
+        }
+    }
+#endif
+
+    return -1;
+}
+
+void
+Save_HR_SW_info(int ix)
+{
+    SWI_t          *swi = &_myswi;      /* XXX static for now */
+
+#ifdef HAVE_LIBRPM
+    /*
+     * XXX Watchout: ix starts with 1 
+     */
+    if (1 <= ix && ix <= swi->swi_nrec && ix != swi->swi_prevx) {
+        int             offset;
+        Header          h;
+        char           *n, *v, *r;
+
+        offset = swi->swi_recs[ix - 1];
+
+#if defined(RPMDBI_PACKAGES)
+        {
+            rpmdbMatchIterator mi;
+            mi = rpmdbInitIterator(swi->swi_rpmdb, RPMDBI_PACKAGES,
+                                   &offset, sizeof(offset));
+            if ((h = rpmdbNextIterator(mi)) != NULL)
+                h = headerLink(h);
+            rpmdbFreeIterator(mi);
+        }
+#else
+        h = rpmdbGetRecord(swi->swi_rpmdb, offset);
+#endif
+
+        if (h == NULL)
+            return;
+        if (swi->swi_h != NULL)
+            headerFree(swi->swi_h);
+        swi->swi_h = h;
+        swi->swi_prevx = ix;
+
+        headerGetEntry(swi->swi_h, RPMTAG_NAME, NULL, (void **) &n, NULL);
+        headerGetEntry(swi->swi_h, RPMTAG_VERSION, NULL, (void **) &v,
+                       NULL);
+        headerGetEntry(swi->swi_h, RPMTAG_RELEASE, NULL, (void **) &r,
+                       NULL);
+        snprintf(swi->swi_name, sizeof(swi->swi_name), "%s-%s-%s", n, v, r);
+        swi->swi_name[ sizeof(swi->swi_name)-1 ] = 0;
+    }
+#else
+    snprintf(swi->swi_name, sizeof(swi->swi_name), swi->swi_dep->d_name);
+    swi->swi_name[ sizeof(swi->swi_name)-1 ] = 0;
+#endif
+}
+
+#ifdef	HAVE_LIBRPM
+void
+Mark_HRSW_token(void)
+{
+}
+
+void
+Release_HRSW_token(void)
+{
+    SWI_t          *swi = &_myswi;      /* XXX static for now */
+    if (swi != NULL && swi->swi_h) {
+        headerFree(swi->swi_h);
+        swi->swi_h = NULL;
+        swi->swi_prevx = -1;
+    }
+}
+#endif                          /* HAVE_LIBRPM */
+
+void
+End_HR_SWInst(void)
+{
+    SWI_t          *swi = &_myswi;      /* XXX static for now */
+
+#ifdef HAVE_LIBRPM
+    rpmdbClose(swi->swi_rpmdb); /* or only on finishing ? */
+    swi->swi_rpmdb = NULL;
+#else
+    if (swi->swi_dp != NULL)
+        closedir(swi->swi_dp);
+    swi->swi_dp = NULL;
+#endif
+}
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/host/hr_swinst.h tomato121/release/src/router/snmp/agent/mibgroup/host/hr_swinst.h
--- tomato/release/src/router/snmp/agent/mibgroup/host/hr_swinst.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/host/hr_swinst.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,12 @@
+/*
+ *  Host Resources MIB - Running Software group interface - hr_swinst.h
+ *
+ */
+#ifndef _MIBGROUP_HRSWINST_H
+#define _MIBGROUP_HRSWINST_H
+
+extern void     init_hr_swinst(void);
+extern FindVarMethod var_hrswinst;
+
+
+#endif                          /* _MIBGROUP_HRSWINST_H */
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/host/hr_swrun.c tomato121/release/src/router/snmp/agent/mibgroup/host/hr_swrun.c
--- tomato/release/src/router/snmp/agent/mibgroup/host/hr_swrun.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/host/hr_swrun.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,1349 @@
+/*
+ *  Host Resources MIB - Running Software group implementation - hr_swrun.c
+ *      (also includes Running Software Performance group )
+ *
+ */
+
+#include <net-snmp/net-snmp-config.h>
+#if HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#include <fcntl.h>
+#if HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+
+#include <sys/param.h>
+#include <ctype.h>
+#if HAVE_SYS_PSTAT_H
+#include <sys/pstat.h>
+#endif
+#if HAVE_SYS_USER_H
+#ifdef solaris2
+#define _KMEMUSER
+#endif
+#include <sys/user.h>
+#endif
+#if HAVE_SYS_PROC_H
+#include <sys/proc.h>
+#endif
+#if HAVE_KVM_H
+#include <kvm.h>
+#endif
+#if HAVE_SYS_SYSCTL_H
+#include <sys/sysctl.h>
+#endif
+#if HAVE_DIRENT_H && !defined(cygwin)
+#include <dirent.h>
+#else
+# define dirent direct
+# if HAVE_SYS_NDIR_H
+#  include <sys/ndir.h>
+# endif
+# if HAVE_SYS_DIR_H
+#  include <sys/dir.h>
+# endif
+# if HAVE_NDIR_H
+#  include <ndir.h>
+# endif
+#endif
+#ifdef cygwin
+#include <windows.h>
+#include <sys/cygwin.h>
+#include <tlhelp32.h>
+#include <psapi.h>
+#endif
+
+#if _SLASH_PROC_METHOD_
+#include <procfs.h>
+#endif
+
+#if HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+
+#include <stdio.h>
+
+#include <net-snmp/output_api.h>
+#include "host_res.h"
+#include "hr_swrun.h"
+#include <net-snmp/agent/auto_nlist.h>
+#include "kernel.h"
+#if solaris2
+#include "kernel_sunos5.h"
+#endif
+
+        /*********************
+	 *
+	 *  Initialisation & common implementation functions
+	 *
+	 *********************/
+void            Init_HR_SWRun(void);
+int             Get_Next_HR_SWRun(void);
+void            End_HR_SWRun(void);
+int             header_hrswrun(struct variable *, oid *, size_t *, int,
+                               size_t *, WriteMethod **);
+int             header_hrswrunEntry(struct variable *, oid *, size_t *,
+                                    int, size_t *, WriteMethod **);
+
+#ifdef dynix
+pid_t           nextproc;
+static prpsinfo_t lowpsinfo, mypsinfo;
+#endif
+#ifdef cygwin
+static struct external_pinfo *curproc;
+static struct external_pinfo lowproc;
+#elif !defined(linux)
+static int      LowProcIndex;
+#endif
+#if defined(hpux10) || defined(hpux11)
+struct pst_status *proc_table;
+struct pst_dynamic pst_dyn;
+#elif HAVE_KVM_GETPROCS
+struct kinfo_proc *proc_table;
+#elif defined(solaris2)
+int            *proc_table;
+#else
+struct proc    *proc_table;
+#endif
+#ifndef dynix
+int             current_proc_entry;
+#endif
+
+
+#define	HRSWRUN_OSINDEX		1
+
+#define	HRSWRUN_INDEX		2
+#define	HRSWRUN_NAME		3
+#define	HRSWRUN_ID		4
+#define	HRSWRUN_PATH		5
+#define	HRSWRUN_PARAMS		6
+#define	HRSWRUN_TYPE		7
+#define	HRSWRUN_STATUS		8
+
+#define	HRSWRUNPERF_CPU		9
+#define	HRSWRUNPERF_MEM		10
+
+struct variable4 hrswrun_variables[] = {
+    {HRSWRUN_OSINDEX, ASN_INTEGER, RONLY, var_hrswrun, 1, {1}},
+    {HRSWRUN_INDEX, ASN_INTEGER, RONLY, var_hrswrun, 3, {2, 1, 1}},
+    {HRSWRUN_NAME, ASN_OCTET_STR, RONLY, var_hrswrun, 3, {2, 1, 2}},
+    {HRSWRUN_ID, ASN_OBJECT_ID, RONLY, var_hrswrun, 3, {2, 1, 3}},
+    {HRSWRUN_PATH, ASN_OCTET_STR, RONLY, var_hrswrun, 3, {2, 1, 4}},
+    {HRSWRUN_PARAMS, ASN_OCTET_STR, RONLY, var_hrswrun, 3, {2, 1, 5}},
+    {HRSWRUN_TYPE, ASN_INTEGER, RONLY, var_hrswrun, 3, {2, 1, 6}},
+    {HRSWRUN_STATUS, ASN_INTEGER, RONLY, var_hrswrun, 3, {2, 1, 7}}
+};
+
+struct variable4 hrswrunperf_variables[] = {
+    {HRSWRUNPERF_CPU, ASN_INTEGER, RONLY, var_hrswrun, 3, {1, 1, 1}},
+    {HRSWRUNPERF_MEM, ASN_INTEGER, RONLY, var_hrswrun, 3, {1, 1, 2}}
+};
+
+oid             hrswrun_variables_oid[] = { 1, 3, 6, 1, 2, 1, 25, 4 };
+oid             hrswrunperf_variables_oid[] = { 1, 3, 6, 1, 2, 1, 25, 5 };
+
+#ifdef cygwin
+
+/*
+ * a lot of this is "stolen" from cygwin ps.cc
+ */
+
+typedef         BOOL(WINAPI * ENUMPROCESSMODULES) (HANDLE hProcess,
+                                                   HMODULE * lphModule,
+                                                   DWORD cb,
+                                                   LPDWORD lpcbNeeded);
+
+typedef         DWORD(WINAPI * GETMODULEFILENAME) (HANDLE hProcess,
+                                                   HMODULE hModule,
+                                                   LPTSTR lpstrFIleName,
+                                                   DWORD nSize);
+
+typedef         DWORD(WINAPI * GETPROCESSMEMORYINFO) (HANDLE hProcess,
+                                                      PPROCESS_MEMORY_COUNTERS
+                                                      pmc, DWORD nSize);
+
+typedef         HANDLE(WINAPI * CREATESNAPSHOT) (DWORD dwFlags,
+                                                 DWORD th32ProcessID);
+
+typedef         BOOL(WINAPI * PROCESSWALK) (HANDLE hSnapshot,
+                                            LPPROCESSENTRY32 lppe);
+
+ENUMPROCESSMODULES myEnumProcessModules;
+GETMODULEFILENAME myGetModuleFileNameEx;
+CREATESNAPSHOT  myCreateToolhelp32Snapshot;
+PROCESSWALK     myProcess32First;
+PROCESSWALK     myProcess32Next;
+GETPROCESSMEMORYINFO myGetProcessMemoryInfo = NULL;
+cygwin_getinfo_types query = CW_GETPINFO;
+
+static BOOL WINAPI
+dummyprocessmodules(HANDLE hProcess,
+                    HMODULE * lphModule, DWORD cb, LPDWORD lpcbNeeded)
+{
+    lphModule[0] = (HMODULE) * lpcbNeeded;
+    *lpcbNeeded = 1;
+    return 1;
+}
+
+static DWORD WINAPI
+GetModuleFileNameEx95(HANDLE hProcess,
+                      HMODULE hModule, LPTSTR lpstrFileName, DWORD n)
+{
+    HANDLE          h;
+    DWORD           pid = (DWORD) hModule;
+    PROCESSENTRY32  proc;
+
+    h = myCreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
+    if (!h)
+        return 0;
+    proc.dwSize = sizeof(proc);
+    if (myProcess32First(h, &proc))
+        do
+            if (proc.th32ProcessID == pid) {
+                CloseHandle(h);
+                strcpy(lpstrFileName, proc.szExeFile);
+                return 1;
+            }
+        while (myProcess32Next(h, &proc));
+    CloseHandle(h);
+    return 0;
+}
+
+#define FACTOR (0x19db1ded53ea710LL)
+#define NSPERSEC 10000000LL
+#define NSPERMSEC 10000LL
+
+static time_t   __stdcall
+to_time_t(PFILETIME ptr)
+{
+    long            rem;
+    long long       x =
+        ((long long) ptr->dwHighDateTime << 32) +
+        ((unsigned) ptr->dwLowDateTime);
+    x -= FACTOR;
+    rem = x % NSPERSEC;
+    rem += NSPERSEC / 2;
+    x /= NSPERSEC;
+    x += rem / NSPERSEC;
+    return x;
+}
+
+static long
+to_msec(PFILETIME ptr)
+{
+    long long       x =
+        ((long long) ptr->dwHighDateTime << 32) +
+        (unsigned) ptr->dwLowDateTime;
+    x /= NSPERMSEC;
+    return x;
+}
+
+#endif                          /* cygwin */
+
+
+void
+init_hr_swrun(void)
+{
+#ifdef cygwin
+    OSVERSIONINFO   ver;
+    HMODULE         h;
+
+    memset(&ver, 0, sizeof ver);
+    ver.dwOSVersionInfoSize = sizeof ver;
+    GetVersionEx(&ver);
+
+    if (ver.dwPlatformId == VER_PLATFORM_WIN32_NT) {
+        h = LoadLibrary("psapi.dll");
+        if (h) {
+            myEnumProcessModules =
+                (ENUMPROCESSMODULES) GetProcAddress(h,
+                                                    "EnumProcessModules");
+            myGetModuleFileNameEx =
+                (GETMODULEFILENAME) GetProcAddress(h,
+                                                   "GetModuleFileNameExA");
+            myGetProcessMemoryInfo =
+                (GETPROCESSMEMORYINFO) GetProcAddress(h,
+                                                      "GetProcessMemoryInfo");
+            if (myEnumProcessModules && myGetModuleFileNameEx)
+                query = CW_GETPINFO_FULL;
+            else
+                snmp_log(LOG_ERR, "hr_swrun failed NT init\n");
+        } else
+            snmp_log(LOG_ERR, "hr_swrun failed to load psapi.dll\n");
+    } else {
+        h = GetModuleHandle("KERNEL32.DLL");
+        myCreateToolhelp32Snapshot =
+            (CREATESNAPSHOT) GetProcAddress(h, "CreateToolhelp32Snapshot");
+        myProcess32First =
+            (PROCESSWALK) GetProcAddress(h, "Process32First");
+        myProcess32Next = (PROCESSWALK) GetProcAddress(h, "Process32Next");
+        myEnumProcessModules = dummyprocessmodules;
+        myGetModuleFileNameEx = GetModuleFileNameEx95;
+        if (myCreateToolhelp32Snapshot && myProcess32First
+            && myProcess32Next)
+#if 0
+            /*
+             * This doesn't work after all on Win98 SE 
+             */
+            query = CW_GETPINFO_FULL;
+#else
+            query = CW_GETPINFO;
+#endif
+        else
+            snmp_log(LOG_ERR, "hr_swrun failed non-NT init\n");
+    }
+#endif                          /* cygwin */
+#ifdef PROC_SYMBOL
+    auto_nlist(PROC_SYMBOL, 0, 0);
+#endif
+#ifdef NPROC_SYMBOL
+    auto_nlist(NPROC_SYMBOL, 0, 0);
+#endif
+
+    proc_table = 0;
+
+    REGISTER_MIB("host/hr_swrun", hrswrun_variables, variable4,
+                 hrswrun_variables_oid);
+    REGISTER_MIB("host/hr_swrun", hrswrunperf_variables, variable4,
+                 hrswrunperf_variables_oid);
+}
+
+/*
+ * header_hrswrun(...
+ * Arguments:
+ * vp     IN      - pointer to variable entry that points here
+ * name    IN/OUT  - IN/name requested, OUT/name found
+ * length  IN/OUT  - length of IN/OUT oid's 
+ * exact   IN      - TRUE if an exact match was requested
+ * var_len OUT     - length of variable or 0 if function returned
+ * write_method
+ * 
+ */
+
+int
+header_hrswrun(struct variable *vp,
+               oid * name,
+               size_t * length,
+               int exact, size_t * var_len, WriteMethod ** write_method)
+{
+#define HRSWRUN_NAME_LENGTH	9
+    oid             newname[MAX_OID_LEN];
+    int             result;
+
+    DEBUGMSGTL(("host/hr_swrun", "var_hrswrun: "));
+    DEBUGMSGOID(("host/hr_swrun", name, *length));
+    DEBUGMSG(("host/hr_swrun", " %d\n", exact));
+
+    memcpy((char *) newname, (char *) vp->name, vp->namelen * sizeof(oid));
+    newname[HRSWRUN_NAME_LENGTH] = 0;
+    result = snmp_oid_compare(name, *length, newname, vp->namelen + 1);
+    if ((exact && (result != 0)) || (!exact && (result >= 0)))
+        return (MATCH_FAILED);
+    memcpy((char *) name, (char *) newname,
+           (vp->namelen + 1) * sizeof(oid));
+    *length = vp->namelen + 1;
+
+    *write_method = 0;
+    *var_len = sizeof(long);    /* default to 'long' results */
+    return (MATCH_SUCCEEDED);
+}
+
+int
+header_hrswrunEntry(struct variable *vp,
+                    oid * name,
+                    size_t * length,
+                    int exact,
+                    size_t * var_len, WriteMethod ** write_method)
+{
+#define HRSWRUN_ENTRY_NAME_LENGTH	11
+    oid             newname[MAX_OID_LEN];
+    int             pid, LowPid = -1;
+    int             result;
+
+    DEBUGMSGTL(("host/hr_swrun", "var_hrswrunEntry: "));
+    DEBUGMSGOID(("host/hr_swrun", name, *length));
+    DEBUGMSG(("host/hr_swrun", " %d\n", exact));
+
+    memcpy((char *) newname, (char *) vp->name, vp->namelen * sizeof(oid));
+
+    /*
+     *  Find the "next" running process
+     */
+    Init_HR_SWRun();
+    for (;;) {
+        pid = Get_Next_HR_SWRun();
+#ifndef linux
+#ifndef dynix
+        DEBUGMSG(("host/hr_swrun",
+                  "(index %d (entry #%d) ....", pid, current_proc_entry));
+#else
+        DEBUGMSG(("host/hr_swrun", "pid %d; nextproc %d ....", pid,
+                  nextproc));
+#endif
+#endif
+        if (pid == -1)
+            break;
+        newname[HRSWRUN_ENTRY_NAME_LENGTH] = pid;
+        DEBUGMSGOID(("host/hr_swrun", newname, *length));
+        DEBUGMSG(("host/hr_swrun", "\n"));
+        result = snmp_oid_compare(name, *length, newname, vp->namelen + 1);
+        if (exact && (result == 0)) {
+            LowPid = pid;
+#ifdef cygwin
+            lowproc = *curproc;
+#elif  dynix
+            memcpy(&lowpsinfo, &mypsinfo, sizeof(prpsinfo_t));
+#elif !defined(linux)
+            LowProcIndex = current_proc_entry - 1;
+#endif
+            DEBUGMSGTL(("host/hr_swrun", " saved\n"));
+            /*
+             * Save process status information 
+             */
+            break;
+        }
+        if ((!exact && (result < 0)) && (LowPid == -1 || pid < LowPid)) {
+            LowPid = pid;
+#ifdef cygwin
+            lowproc = *curproc;
+#elif !defined(linux)
+            LowProcIndex = current_proc_entry - 1;
+#endif
+            /*
+             * Save process status information 
+             */
+            DEBUGMSG(("host/hr_swrun", " saved"));
+        }
+        DEBUGMSG(("host/hr_swrun", "\n"));
+    }
+    End_HR_SWRun();
+
+    if (LowPid == -1) {
+        DEBUGMSGTL(("host/hr_swrun", "... index out of range\n"));
+        return (MATCH_FAILED);
+    }
+
+    newname[HRSWRUN_ENTRY_NAME_LENGTH] = LowPid;
+    memcpy((char *) name, (char *) newname,
+           (vp->namelen + 1) * sizeof(oid));
+    *length = vp->namelen + 1;
+    *write_method = 0;
+    *var_len = sizeof(long);    /* default to 'long' results */
+
+    DEBUGMSGTL(("host/hr_swrun", "... get process stats "));
+    DEBUGMSGOID(("host/hr_swrun", name, *length));
+    DEBUGMSG(("host/hr_swrun", "\n"));
+    return LowPid;
+}
+
+        /*********************
+	 *
+	 *  System specific implementation functions
+	 *
+	 *********************/
+
+
+u_char         *
+var_hrswrun(struct variable * vp,
+            oid * name,
+            size_t * length,
+            int exact, size_t * var_len, WriteMethod ** write_method)
+{
+    int             pid = 0;
+    static char     string[256];
+#ifdef HAVE_SYS_PSTAT_H
+    struct pst_status proc_buf;
+#elif defined(solaris2)
+#if _SLASH_PROC_METHOD_
+    static psinfo_t psinfo;
+    static psinfo_t *proc_buf;
+    int             procfd;
+    char            procfn[sizeof "/proc/00000/psinfo"];
+#else
+    static struct proc *proc_buf;
+    char           *cp1;
+#endif                          /* _SLASH_PROC_METHOD_ */
+    static time_t   when = 0;
+    time_t          now;
+    static int      oldpid = -1;
+#endif
+#if HAVE_KVM_GETPROCS
+    char          **argv;
+#endif
+#ifdef linux
+    FILE           *fp;
+    char            buf[256];
+    int             i;
+#endif
+    char           *cp;
+
+    if (vp->magic == HRSWRUN_OSINDEX) {
+        if (header_hrswrun(vp, name, length, exact, var_len, write_method)
+            == MATCH_FAILED)
+            return NULL;
+    } else {
+
+        pid =
+            header_hrswrunEntry(vp, name, length, exact, var_len,
+                                write_method);
+        if (pid == MATCH_FAILED)
+            return NULL;
+    }
+
+#ifdef HAVE_SYS_PSTAT_H
+    if (pstat_getproc(&proc_buf, sizeof(struct pst_status), 0, pid) == -1)
+        return NULL;
+#elif defined(solaris2)
+    time(&now);
+    if (pid == oldpid) {
+        if (now != when)
+            oldpid = -1;
+    }
+    if (oldpid != pid || proc_buf == NULL) {
+#if _SLASH_PROC_METHOD_
+        proc_buf = &psinfo;
+        sprintf(procfn, "/proc/%.5d/psinfo", pid);
+        if ((procfd = open(procfn, O_RDONLY)) != -1) {
+            if (read(procfd, proc_buf, sizeof(*proc_buf)) !=
+                sizeof(*proc_buf))
+                abort();
+            close(procfd);
+        } else
+            proc_buf = NULL;
+#else
+        if (kd == NULL)
+            return NULL;
+        if ((proc_buf = kvm_getproc(kd, pid)) == NULL)
+            return NULL;
+#endif
+        oldpid = pid;
+        when = now;
+    }
+#endif
+
+    switch (vp->magic) {
+    case HRSWRUN_OSINDEX:
+#if NO_DUMMY_VALUES
+        return NULL;
+#else
+        long_return = 1;        /* Probably! */
+        return (u_char *) & long_return;
+#endif
+
+    case HRSWRUN_INDEX:
+        long_return = pid;
+        return (u_char *) & long_return;
+    case HRSWRUN_NAME:
+#ifdef HAVE_SYS_PSTAT_H
+        snprintf(string, sizeof(string), "%s", proc_buf.pst_cmd);
+        string[ sizeof(string)-1 ] = 0;
+        cp = strchr(string, ' ');
+        if (cp != NULL)
+            *cp = '\0';
+#elif defined(dynix)
+        snprintf(string, sizeof(string), "%s", lowpsinfo.pr_fname);
+        string[ sizeof(string)-1 ] = 0;
+        cp = strchr(string, ' ');
+        if (cp != NULL)
+            *cp = '\0';
+#elif defined(solaris2)
+#if _SLASH_PROC_METHOD_
+        if (proc_buf)
+            strncpy(string, proc_buf->pr_fname, sizeof(string));
+        else
+            strcpy(string, "<exited>");
+        string[ sizeof(string)-1 ] = 0;
+#else
+        strncpy(string, proc_buf->p_user.u_comm, sizeof(string));
+        string[ sizeof(string)-1 ] = 0;
+#endif
+#elif HAVE_KVM_GETPROCS
+        strcpy(string, proc_table[LowProcIndex].kp_proc.p_comm);
+#elif defined(linux)
+        sprintf(string, "/proc/%d/status", pid);
+        if ((fp = fopen(string, "r")) == NULL)
+            return NULL;
+        fgets(buf, sizeof(buf), fp);    /* Name: process name */
+        cp = buf;
+        while (*cp != ':')
+            ++cp;
+        ++cp;
+        while (isspace(*cp))
+            ++cp;
+        strcpy(string, cp);
+        fclose(fp);
+#elif defined(cygwin)
+        if (lowproc.process_state & (PID_ZOMBIE | PID_EXITED))
+            strcpy(string, "<defunct>");
+        else if (lowproc.ppid) {
+            cygwin_conv_to_posix_path(lowproc.progname, string);
+            cp = strrchr(string, '/');
+            if (cp)
+                strcpy(string, cp + 1);
+        } else if (query == CW_GETPINFO_FULL) {
+            DWORD           n = lowproc.dwProcessId & 0xffff;
+            HANDLE          h =
+                OpenProcess(PROCESS_QUERY_INFORMATION | PROCESS_VM_READ,
+                            FALSE, n);
+
+            if (h) {
+                HMODULE         hm[1000];
+                if (!myEnumProcessModules(h, hm, sizeof hm, &n)) {
+                    snmp_log(LOG_DEBUG, "no module handle for %lu\n", n);
+                    n = 0;
+                }
+                if (n
+                    && myGetModuleFileNameEx(h, hm[0], string,
+                                             sizeof string)) {
+                    cp = strrchr(string, '\\');
+                    if (cp)
+                        strcpy(string, cp + 1);
+                } else
+                    strcpy(string, "*** unknown");
+                CloseHandle(h);
+            } else {
+                snmp_log(LOG_INFO, "no process handle for %lu\n", n);
+                strcpy(string, "** unknown");
+            }
+        } else
+            strcpy(string, "* unknown");
+        cp = strchr(string, '\0') - 4;
+        if (cp > string && strcasecmp(cp, ".exe") == 0)
+            *cp = '\0';
+#else
+#if NO_DUMMY_VALUES
+        return NULL;
+#endif
+        sprintf(string, "process name");
+#endif
+        *var_len = strlen(string);
+        /*
+         * remove trailing newline 
+         */
+        if (*var_len) {
+            cp = string + *var_len - 1;
+            if (*cp == '\n')
+                --(*var_len);
+        }
+        return (u_char *) string;
+    case HRSWRUN_ID:
+        *var_len = nullOidLen;
+        return (u_char *) nullOid;
+    case HRSWRUN_PATH:
+#ifdef HAVE_SYS_PSTAT_H
+        /*
+         * Path not available - use argv[0] 
+         */
+        sprintf(string, "%s", proc_buf.pst_cmd);
+        cp = strchr(string, ' ');
+        if (cp != NULL)
+            *cp = '\0';
+#elif defined(dynix)
+        /*
+         * Path not available - use argv[0] 
+         */
+        sprintf(string, "%s", lowpsinfo.pr_psargs);
+        cp = strchr(string, ' ');
+        if (cp != NULL)
+            *cp = '\0';
+#elif defined(solaris2)
+#ifdef _SLASH_PROC_METHOD_
+        if (proc_buf)
+            strcpy(string, proc_buf->pr_psargs);
+        else
+            sprintf(string, "<exited>");
+        cp = strchr(string, ' ');
+        if (cp)
+            *cp = 0;
+#else
+        cp = proc_buf->p_user.u_psargs;
+        cp1 = string;
+        while (*cp && *cp != ' ')
+            *cp1++ = *cp++;
+        *cp1 = 0;
+#endif
+#elif HAVE_KVM_GETPROCS
+        strcpy(string, proc_table[LowProcIndex].kp_proc.p_comm);
+#elif defined(linux)
+        sprintf(string, "/proc/%d/cmdline", pid);
+        if ((fp = fopen(string, "r")) == NULL)
+            return NULL;
+        if (fgets(buf, sizeof(buf) - 1, fp))    /* argv[0] '\0' argv[1] '\0' .... */
+            strcpy(string, buf);
+        else {
+            /*
+             * swapped out - no cmdline 
+             */
+            fclose(fp);
+            sprintf(string, "/proc/%d/status", pid);
+            if ((fp = fopen(string, "r")) == NULL)
+                return NULL;
+            fgets(buf, sizeof(buf), fp);        /* Name: process name */
+            cp = strchr(buf, ':');
+            ++cp;
+            while (isspace(*cp))
+                ++cp;
+            strcpy(string, cp);
+            cp = strchr(string, '\n');
+            if (cp)
+                *cp = 0;
+        }
+        fclose(fp);
+#elif defined(cygwin)
+        if (lowproc.process_state & (PID_ZOMBIE | PID_EXITED))
+            strcpy(string, "<defunct>");
+        else if (lowproc.ppid)
+            cygwin_conv_to_posix_path(lowproc.progname, string);
+        else if (query == CW_GETPINFO_FULL) {
+            DWORD           n = lowproc.dwProcessId & 0xFFFF;
+            HANDLE          h =
+                OpenProcess(PROCESS_QUERY_INFORMATION | PROCESS_VM_READ,
+                            FALSE, n);
+            if (h) {
+                HMODULE         hm[1000];
+                if (!myEnumProcessModules(h, hm, sizeof hm, &n))
+                    n = 0;
+                if (!n
+                    || !myGetModuleFileNameEx(h, hm[0], string,
+                                              sizeof string))
+                    strcpy(string, "*** unknown");
+                CloseHandle(h);
+            } else
+                strcpy(string, "** unknown");
+        } else
+            strcpy(string, "* unknown");
+#else
+#if NO_DUMMY_VALUES
+        return NULL;
+#endif
+        sprintf(string, "/bin/wombat");
+#endif
+        *var_len = strlen(string);
+        return (u_char *) string;
+    case HRSWRUN_PARAMS:
+#ifdef HAVE_SYS_PSTAT_H
+        cp = strchr(proc_buf.pst_cmd, ' ');
+        if (cp != NULL) {
+            cp++;
+            sprintf(string, "%s", cp);
+        } else
+            string[0] = '\0';
+#elif defined(dynix)
+        cp = strchr(lowpsinfo.pr_psargs, ' ');
+        if (cp != NULL) {
+            cp++;
+            sprintf(string, "%s", cp);
+        } else
+            string[0] = '\0';
+#elif defined(solaris2)
+#ifdef _SLASH_PROC_METHOD_
+        if (proc_buf) {
+            cp = strchr(proc_buf->pr_psargs, ' ');
+            if (cp)
+                strcpy(string, cp + 1);
+            else
+                string[0] = 0;
+        } else
+            string[0] = 0;
+#else
+        cp = proc_buf->p_user.u_psargs;
+        while (*cp && *cp != ' ')
+            cp++;
+        if (*cp == ' ')
+            cp++;
+        strcpy(string, cp);
+#endif
+#elif HAVE_KVM_GETPROCS
+        string[0] = 0;
+        argv = kvm_getargv(kd, proc_table + LowProcIndex, sizeof(string));
+        if (argv)
+            argv++;
+        while (argv && *argv) {
+            if (string[0] != 0)
+                strcat(string, " ");
+            strcat(string, *argv);
+            argv++;
+        }
+#elif defined(linux)
+        sprintf(string, "/proc/%d/cmdline", pid);
+        if ((fp = fopen(string, "r")) == NULL)
+            return NULL;
+        memset(buf, 0, sizeof(buf));
+
+        /*
+         * argv[0] '\0' argv[1] '\0' .... 
+         */
+        if (!fgets(buf, sizeof(buf) - 2, fp)) {
+            /*
+             * maybe be empty (even argv[0] is missing) 
+             */
+            string[0] = '\0';
+            *var_len = 0;
+            fclose(fp);
+            return string;
+        }
+
+        /*
+         * Skip over argv[0] 
+         */
+        cp = buf;
+        while (*cp)
+            ++cp;
+        ++cp;
+        /*
+         * Now join together separate arguments. 
+         */
+        while (1) {
+            while (*cp)
+                ++cp;
+            if (*(cp + 1) == '\0')
+                break;          /* '\0''\0' => End of command line */
+            *cp = ' ';
+        }
+
+        cp = buf;
+        while (*cp)
+            ++cp;
+        ++cp;
+        strcpy(string, cp);
+        fclose(fp);
+#elif defined(cygwin)
+        string[0] = 0;
+#else
+#if NO_DUMMY_VALUES
+        return NULL;
+#endif
+        sprintf(string, "-h -q -v");
+#endif
+        *var_len = strlen(string);
+        return (u_char *) string;
+    case HRSWRUN_TYPE:
+#ifdef PID_MAXSYS
+        if (pid < PID_MAXSYS)
+            long_return = 2;    /* operatingSystem */
+        else
+#endif
+            long_return = 4;    /* application */
+        return (u_char *) & long_return;
+    case HRSWRUN_STATUS:
+#if defined(cygwin)
+        if (lowproc.process_state & PID_STOPPED)
+            long_return = 3;    /* notRunnable */
+        else if (lowproc.process_state & PID_ZOMBIE)
+            long_return = 4;    /* invalid */
+        else
+            long_return = 1;    /* running */
+#elif !defined(linux)
+#if defined(hpux10) || defined(hpux11)
+        switch (proc_table[LowProcIndex].pst_stat) {
+        case PS_STOP:
+            long_return = 3;    /* notRunnable */
+            break;
+        case PS_SLEEP:
+            long_return = 2;    /* runnable */
+            break;
+        case PS_RUN:
+            long_return = 1;    /* running */
+            break;
+        case PS_ZOMBIE:
+        case PS_IDLE:
+        case PS_OTHER:
+        default:
+            long_return = 4;    /* invalid */
+            break;
+        }
+#else
+#if HAVE_KVM_GETPROCS
+        switch (proc_table[LowProcIndex].kp_proc.p_stat) {
+#elif defined(dynix)
+        switch (lowpsinfo.pr_state) {
+#elif defined(solaris2)
+#if _SLASH_PROC_METHOD_
+        switch (proc_buf ? proc_buf->pr_lwp.pr_state : SIDL) {
+#else
+        switch (proc_buf->p_stat) {
+#endif
+#else
+        switch (proc_table[LowProcIndex].p_stat) {
+#endif
+        case SSTOP:
+            long_return = 3;    /* notRunnable */
+            break;
+        case 0:
+#ifdef SSWAP
+        case SSWAP:
+#endif
+#ifdef SSLEEP
+        case SSLEEP:
+#endif
+#ifdef SWAIT
+        case SWAIT:
+#endif
+            long_return = 2;    /* runnable */
+            break;
+#ifdef SACTIVE
+        case SACTIVE:
+#endif
+#ifdef SRUN
+        case SRUN:
+#endif
+#ifdef SONPROC
+        case SONPROC:
+#endif
+            long_return = 1;    /* running */
+            break;
+        case SIDL:
+        case SZOMB:
+        default:
+            long_return = 4;    /* invalid */
+            break;
+        }
+#endif
+#else
+        sprintf(string, "/proc/%d/stat", pid);
+        if ((fp = fopen(string, "r")) != NULL) {
+            fgets(buf, sizeof(buf), fp);
+            cp = buf;
+            for (i = 0; i < 2; ++i) {   /* skip two fields */
+                while (*cp != ' ')
+                    ++cp;
+                ++cp;
+            }
+
+            switch (*cp) {
+            case 'R':
+                long_return = 1;        /* running */
+                break;
+            case 'S':
+                long_return = 2;        /* runnable */
+                break;
+            case 'D':
+            case 'T':
+                long_return = 3;        /* notRunnable */
+                break;
+            case 'Z':
+            default:
+                long_return = 4;        /* invalid */
+                break;
+            }
+            fclose(fp);
+        } else
+            long_return = 4;    /* invalid */
+#endif
+        return (u_char *) & long_return;
+
+    case HRSWRUNPERF_CPU:
+#ifdef HAVE_SYS_PSTAT_H
+        long_return = proc_buf.pst_cptickstotal;
+        /*
+         * Not convinced this is right, but....
+         */
+#elif defined(dynix)
+        long_return = lowpsinfo.pr_time.tv_sec * 100 +
+            lowpsinfo.pr_time.tv_nsec / 10000000;
+#elif defined(solaris2)
+#if _SLASH_PROC_METHOD_
+        long_return = proc_buf ? proc_buf->pr_time.tv_sec * 100 +
+            proc_buf->pr_time.tv_nsec / 10000000 : 0;
+#else
+        long_return = proc_buf->p_utime * 100 + proc_buf->p_stime * 100;
+#endif
+#elif HAVE_KVM_GETPROCS
+        long_return = proc_table[LowProcIndex].kp_proc.p_uticks +
+            proc_table[LowProcIndex].kp_proc.p_sticks +
+            proc_table[LowProcIndex].kp_proc.p_iticks;
+#elif defined(linux)
+        sprintf(string, "/proc/%d/stat", pid);
+        if ((fp = fopen(string, "r")) == NULL)
+            return NULL;
+        fgets(buf, sizeof(buf), fp);
+        cp = buf;
+        for (i = 0; i < 13; ++i) {      /* skip 13 fields */
+            while (*cp != ' ')
+                ++cp;
+            ++cp;
+        }
+
+        long_return = atoi(cp); /* utime */
+
+        while (*cp != ' ')
+            ++cp;
+        ++cp;
+        long_return += atoi(cp);        /* + stime */
+        fclose(fp);
+#elif defined(sunos4)
+        long_return = proc_table[LowProcIndex].p_time;
+#elif defined(cygwin)
+        {
+            DWORD           n = lowproc.dwProcessId;
+            HANDLE          h =
+                OpenProcess(PROCESS_QUERY_INFORMATION | PROCESS_VM_READ,
+                            FALSE, n);
+            FILETIME        ct, et, kt, ut;
+
+            if (h) {
+                if (GetProcessTimes(h, &ct, &et, &kt, &ut))
+                    long_return = (to_msec(&kt) + to_msec(&ut)) / 10;
+                else {
+                    snmp_log(LOG_INFO, "no process times for %lu (%lu)\n",
+                             lowproc.pid, n);
+                    long_return = 0;
+                }
+                CloseHandle(h);
+            } else {
+                snmp_log(LOG_INFO, "no process handle for %lu (%lu)\n",
+                         lowproc.pid, n);
+                long_return = 0;
+            }
+        }
+#elif defined(aix4)
+        long_return = proc_table[LowProcIndex].p_ru.ru_utime.tv_sec * 100 +
+            proc_table[LowProcIndex].p_ru.ru_utime.tv_usec / 10000 +
+            proc_table[LowProcIndex].p_ru.ru_stime.tv_sec * 100 +
+            proc_table[LowProcIndex].p_ru.ru_stime.tv_usec / 10000;
+#else
+        long_return = proc_table[LowProcIndex].p_utime.tv_sec * 100 +
+            proc_table[LowProcIndex].p_utime.tv_usec / 10000 +
+            proc_table[LowProcIndex].p_stime.tv_sec * 100 +
+            proc_table[LowProcIndex].p_stime.tv_usec / 10000;
+#endif
+        return (u_char *) & long_return;
+    case HRSWRUNPERF_MEM:
+#ifdef HAVE_SYS_PSTAT_H
+        long_return = (proc_buf.pst_rssize << PGSHIFT) / 1024;
+#elif defined(dynix)
+        long_return = (lowpsinfo.pr_rssize * MMU_PAGESIZE) / 1024;
+#elif defined(solaris2)
+#if _SLASH_PROC_METHOD_
+        long_return = proc_buf ? proc_buf->pr_rssize : 0;
+#else
+        long_return = proc_buf->p_swrss;
+#endif
+#elif HAVE_KVM_GETPROCS
+#if defined(freebsd3) && !defined(darwin)
+        long_return =
+            proc_table[LowProcIndex].kp_eproc.e_vm.vm_map.size / 1024;
+#else
+        long_return = proc_table[LowProcIndex].kp_eproc.e_vm.vm_tsize +
+            proc_table[LowProcIndex].kp_eproc.e_vm.vm_ssize +
+            proc_table[LowProcIndex].kp_eproc.e_vm.vm_dsize;
+        long_return = long_return * (getpagesize() / 1024);
+#endif
+#elif defined(linux)
+        sprintf(string, "/proc/%d/stat", pid);
+        if ((fp = fopen(string, "r")) == NULL)
+            return NULL;
+        fgets(buf, sizeof(buf), fp);
+        cp = buf;
+        for (i = 0; i < 23; ++i) {      /* skip 23 fields */
+            while (*cp != ' ')
+                ++cp;
+            ++cp;
+        }
+        long_return = atoi(cp) * (getpagesize() / 1024);        /* rss */
+        fclose(fp);
+#elif defined(cygwin)
+        {
+            DWORD           n = lowproc.dwProcessId;
+            HANDLE          h =
+                OpenProcess(PROCESS_QUERY_INFORMATION | PROCESS_VM_READ,
+                            FALSE, n);
+            PROCESS_MEMORY_COUNTERS pmc;
+
+            if (h) {
+                if (myGetProcessMemoryInfo
+                    && myGetProcessMemoryInfo(h, &pmc, sizeof pmc))
+                    long_return = pmc.WorkingSetSize / 1024;
+                else {
+                    snmp_log(LOG_INFO, "no process times for %lu (%lu)\n",
+                             lowproc.pid, n);
+                    long_return = 0;
+                }
+                CloseHandle(h);
+            } else {
+                snmp_log(LOG_INFO, "no process handle for %lu (%lu)\n",
+                         lowproc.pid, n);
+                long_return = 0;
+            }
+        }
+#else
+#if NO_DUMMY_VALUES
+        return NULL;
+#endif
+        long_return = 16 * 1024;        /* XXX - 16M! */
+#endif
+        return (u_char *) & long_return;
+    default:
+        DEBUGMSGTL(("snmpd", "unknown sub-id %d in var_hrswrun\n",
+                    vp->magic));
+    }
+    return NULL;
+}
+
+
+        /*********************
+	 *
+	 *  Internal implementation functions
+	 *
+	 *********************/
+
+#if defined(linux)
+
+DIR            *procdir = NULL;
+struct dirent  *procentry_p;
+
+void
+Init_HR_SWRun(void)
+{
+    if (procdir != NULL)
+        closedir(procdir);
+    procdir = opendir("/proc");
+}
+
+int
+Get_Next_HR_SWRun(void)
+{
+    int             pid;
+    procentry_p = readdir(procdir);
+
+    if (procentry_p == NULL)
+        return -1;
+
+    pid = atoi(procentry_p->d_name);
+    if (pid == 0)
+        return (Get_Next_HR_SWRun());
+    return pid;
+}
+
+void
+End_HR_SWRun(void)
+{
+    if (procdir)
+        closedir(procdir);
+    procdir = NULL;
+}
+
+#elif defined(cygwin)
+
+static pid_t    curpid;
+
+void
+Init_HR_SWRun(void)
+{
+    cygwin_internal(CW_LOCK_PINFO, 1000);
+    curpid = 0;
+}
+
+int
+Get_Next_HR_SWRun(void)
+{
+    curproc =
+        (struct external_pinfo *) cygwin_internal(query,
+                                                  curpid | CW_NEXTPID);
+    if (curproc)
+        curpid = curproc->pid;
+    else {
+        curpid = -1;
+    }
+    return curpid;
+}
+
+void
+End_HR_SWRun(void)
+{
+    cygwin_internal(CW_UNLOCK_PINFO);
+}
+
+#elif defined(dynix)
+
+void
+Init_HR_SWRun(void)
+{
+    nextproc = 0;
+}
+
+int
+Get_Next_HR_SWRun(void)
+{
+    getprpsinfo_t  *select = 0;
+
+    DEBUGMSGTL(("host/hr_swrun::GetNextHR_SWRun",
+                "nextproc == %d... &nextproc = %u\n", nextproc,
+                &nextproc));
+    if ((nextproc = getprpsinfo(nextproc, select, &mypsinfo)) < 0) {
+        return -1;
+    } else {
+        DEBUGMSGTL(("host/hr_swrun::GetNextHR_SWRun",
+                    "getprpsinfo returned %d\n", nextproc));
+        return mypsinfo.pr_pid;
+    }
+
+}
+
+void
+End_HR_SWRun(void)
+{
+    /*
+     * just a stub... because it's declared 
+     */
+}
+
+#else                           /* linux */
+
+static int      nproc;
+
+void
+Init_HR_SWRun(void)
+{
+    size_t          bytes;
+    static time_t   iwhen = 0;
+    time_t          now;
+
+    time(&now);
+    if (now == iwhen) {
+        current_proc_entry = 0;
+        return;
+    }
+    iwhen = now;
+
+#if defined(hpux10) || defined(hpux11)
+    pstat_getdynamic(&pst_dyn, sizeof(struct pst_dynamic), 1, 0);
+    nproc = pst_dyn.psd_activeprocs;
+    bytes = nproc * sizeof(struct pst_status);
+    if ((proc_table =
+         (struct pst_status *) realloc(proc_table, bytes)) == NULL) {
+        current_proc_entry = nproc + 1;
+        return;
+    }
+    pstat_getproc(proc_table, sizeof(struct pst_status), nproc, 0);
+
+#elif defined(solaris2)
+    if (!getKstatInt("unix", "system_misc", "nproc", &nproc)) {
+        current_proc_entry = nproc + 1;
+        return;
+    }
+    bytes = nproc * sizeof(int);
+    if ((proc_table = (int *) realloc(proc_table, bytes)) == NULL) {
+        current_proc_entry = nproc + 1;
+        return;
+    }
+    {
+        DIR            *f;
+        struct dirent  *dp;
+#if _SLASH_PROC_METHOD_ == 0
+        if (kd == NULL) {
+            current_proc_entry = nproc + 1;
+            return;
+        }
+#endif
+        f = opendir("/proc");
+        current_proc_entry = 0;
+        while ((dp = readdir(f)) != NULL && current_proc_entry < nproc)
+            if (dp->d_name[0] != '.')
+                proc_table[current_proc_entry++] = atoi(dp->d_name);
+        closedir(f);
+    }
+#elif HAVE_KVM_GETPROCS
+    {
+        if (kd == NULL) {
+            nproc = 0;
+            return;
+        }
+        proc_table = kvm_getprocs(kd, KERN_PROC_ALL, 0, &nproc);
+    }
+#else
+
+    current_proc_entry = 1;
+#ifndef bsdi2
+    nproc = 0;
+
+    if (auto_nlist(NPROC_SYMBOL, (char *) &nproc, sizeof(int)) == 0) {
+        snmp_log_perror("Init_HR_SWRun-auto_nlist NPROC");
+        return;
+    }
+#endif
+    bytes = nproc * sizeof(struct proc);
+
+    if (proc_table)
+        free((char *) proc_table);
+    if ((proc_table = (struct proc *) malloc(bytes)) == NULL) {
+        nproc = 0;
+        snmp_log_perror("Init_HR_SWRun-malloc");
+        return;
+    }
+
+    {
+        int             proc_table_base;
+        if (auto_nlist
+            (PROC_SYMBOL, (char *) &proc_table_base,
+             sizeof(proc_table_base)) == 0) {
+            nproc = 0;
+            snmp_log_perror("Init_HR_SWRun-auto_nlist PROC");
+            return;
+        }
+        if (klookup(proc_table_base, (char *) proc_table, bytes) == 0) {
+            nproc = 0;
+            snmp_log_perror("Init_HR_SWRun-klookup");
+            return;
+        }
+    }
+#endif
+    current_proc_entry = 0;
+}
+
+int
+Get_Next_HR_SWRun(void)
+{
+    while (current_proc_entry < nproc) {
+#if defined(hpux10) || defined(hpux11)
+        return proc_table[current_proc_entry++].pst_pid;
+#elif defined(solaris2)
+        return proc_table[current_proc_entry++];
+#elif HAVE_KVM_GETPROCS
+        if (proc_table[current_proc_entry].kp_proc.p_stat != 0)
+            return proc_table[current_proc_entry++].kp_proc.p_pid;
+#else
+        if (proc_table[current_proc_entry].p_stat != 0)
+            return proc_table[current_proc_entry++].p_pid;
+        else
+            ++current_proc_entry;
+#endif
+
+    }
+    return -1;
+}
+
+void
+End_HR_SWRun(void)
+{
+    current_proc_entry = nproc + 1;
+}
+#endif
+
+int
+count_processes(void)
+{
+#if !(defined(linux) || defined(cygwin)) || defined(hpux10) || defined(hpux11) || defined(solaris2) || HAVE_KVM_GETPROCS
+    int             i;
+#endif
+    int             total = 0;
+
+    Init_HR_SWRun();
+#if defined(hpux10) || defined(hpux11) || HAVE_KVM_GETPROCS || defined(solaris2)
+    total = nproc;
+#else
+#if !defined(linux) && !defined(cygwin) && !defined(dynix)
+    for (i = 0; i < nproc; ++i) {
+        if (proc_table[i].p_stat != 0)
+#else
+    while (Get_Next_HR_SWRun() != -1) {
+#endif
+        ++total;
+    }
+#endif                          /* !hpux10 && !hpux11 && !HAVE_KVM_GETPROCS && !solaris2 */
+    End_HR_SWRun();
+    return total;
+}
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/host/hr_swrun.h tomato121/release/src/router/snmp/agent/mibgroup/host/hr_swrun.h
--- tomato/release/src/router/snmp/agent/mibgroup/host/hr_swrun.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/host/hr_swrun.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,13 @@
+/*
+ *  Host Resources MIB - Running Software group interface - hr_swrun.h
+ *      (also includes Running Software Performance group )
+ *
+ */
+#ifndef _MIBGROUP_HRSWRUN_H
+#define _MIBGROUP_HRSWRUN_H
+
+extern void     init_hr_swrun(void);
+extern FindVarMethod var_hrswrun;
+
+
+#endif                          /* _MIBGROUP_HRSWRUN_H */
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/host/hr_system.c tomato121/release/src/router/snmp/agent/mibgroup/host/hr_system.c
--- tomato/release/src/router/snmp/agent/mibgroup/host/hr_system.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/host/hr_system.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,321 @@
+/*
+ *  Host Resources MIB - system group implementation - hr_system.c
+ *
+ */
+
+#include <net-snmp/net-snmp-config.h>
+#if HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+#include "host.h"
+#include "host_res.h"
+#include "hr_system.h"
+#include <net-snmp/agent/auto_nlist.h>
+
+#ifdef HAVE_SYS_PROC_H
+#include <sys/param.h>
+#include "sys/proc.h"
+#endif
+#if HAVE_UTMPX_H
+#include <utmpx.h>
+#else
+#include <utmp.h>
+#endif
+
+#ifdef linux
+#ifdef HAVE_LINUX_TASKS_H
+#include <linux/tasks.h>
+#else
+/*
+ * If this file doesn't exist, then there is no hard limit on the number
+ * of processes, so return 0 for hrSystemMaxProcesses.  
+ */
+#define NR_TASKS	0
+#endif
+#endif
+
+#if defined(hpux10) || defined(hpux11)
+#include <sys/pstat.h>
+#endif
+
+#ifdef HAVE_SYS_SYSCTL_H
+#include <sys/sysctl.h>
+#endif
+
+#if !defined(UTMP_FILE) && defined(_PATH_UTMP)
+#define UTMP_FILE _PATH_UTMP
+#endif
+
+#if defined(UTMP_FILE) && !HAVE_UTMPX_H
+void            setutent(void);
+void            endutent(void);
+struct utmp    *getutent(void);
+#endif                          /* UTMP_FILE */
+
+
+        /*********************
+	 *
+	 *  Kernel & interface information,
+	 *   and internal forward declarations
+	 *
+	 *********************/
+
+static int      get_load_dev(void);
+static int      count_users(void);
+extern int      count_processes(void);
+
+
+        /*********************
+	 *
+	 *  Initialisation & common implementation functions
+	 *
+	 *********************/
+
+#define	HRSYS_UPTIME		1
+#define	HRSYS_DATE		2
+#define	HRSYS_LOAD_DEV		3
+#define	HRSYS_LOAD_PARAM	4
+#define	HRSYS_USERS		5
+#define	HRSYS_PROCS		6
+#define	HRSYS_MAXPROCS		7
+
+struct variable2 hrsystem_variables[] = {
+    {HRSYS_UPTIME, ASN_TIMETICKS, RONLY, var_hrsys, 1, {1}},
+    {HRSYS_DATE, ASN_OCTET_STR, RONLY, var_hrsys, 1, {2}},
+    {HRSYS_LOAD_DEV, ASN_INTEGER, RONLY, var_hrsys, 1, {3}},
+    {HRSYS_LOAD_PARAM, ASN_OCTET_STR, RONLY, var_hrsys, 1, {4}},
+    {HRSYS_USERS, ASN_GAUGE, RONLY, var_hrsys, 1, {5}},
+    {HRSYS_PROCS, ASN_GAUGE, RONLY, var_hrsys, 1, {6}},
+    {HRSYS_MAXPROCS, ASN_INTEGER, RONLY, var_hrsys, 1, {7}}
+};
+oid             hrsystem_variables_oid[] = { 1, 3, 6, 1, 2, 1, 25, 1 };
+
+
+void
+init_hr_system(void)
+{
+#ifdef NPROC_SYMBOL
+    auto_nlist(NPROC_SYMBOL, 0, 0);
+#endif
+
+    REGISTER_MIB("host/hr_system", hrsystem_variables, variable2,
+                 hrsystem_variables_oid);
+}
+
+/*
+ * header_hrsys(...
+ * Arguments:
+ * vp     IN      - pointer to variable entry that points here
+ * name    IN/OUT  - IN/name requested, OUT/name found
+ * length  IN/OUT  - length of IN/OUT oid's 
+ * exact   IN      - TRUE if an exact match was requested
+ * var_len OUT     - length of variable or 0 if function returned
+ * write_method
+ */
+
+int
+header_hrsys(struct variable *vp,
+             oid * name,
+             size_t * length,
+             int exact, size_t * var_len, WriteMethod ** write_method)
+{
+#define HRSYS_NAME_LENGTH	9
+    oid             newname[MAX_OID_LEN];
+    int             result;
+
+    DEBUGMSGTL(("host/hr_system", "var_hrsys: "));
+    DEBUGMSGOID(("host/hr_system", name, *length));
+    DEBUGMSG(("host/hr_system", " %d\n", exact));
+
+    memcpy((char *) newname, (char *) vp->name, vp->namelen * sizeof(oid));
+    newname[HRSYS_NAME_LENGTH] = 0;
+    result = snmp_oid_compare(name, *length, newname, vp->namelen + 1);
+    if ((exact && (result != 0)) || (!exact && (result >= 0)))
+        return (MATCH_FAILED);
+    memcpy((char *) name, (char *) newname,
+           (vp->namelen + 1) * sizeof(oid));
+    *length = vp->namelen + 1;
+
+    *write_method = 0;
+    *var_len = sizeof(long);    /* default to 'long' results */
+    return (MATCH_SUCCEEDED);
+}
+
+
+        /*********************
+	 *
+	 *  System specific implementation functions
+	 *
+	 *********************/
+
+u_char         *
+var_hrsys(struct variable * vp,
+          oid * name,
+          size_t * length,
+          int exact, size_t * var_len, WriteMethod ** write_method)
+{
+    static char     string[100];
+    time_t          now;
+#ifndef NR_TASKS
+    int             nproc = 0;
+#endif
+#ifdef linux
+    FILE           *fp;
+#endif
+#if CAN_USE_SYSCTL && defined(CTL_KERN) && defined(KERN_MAXPROC)
+    static int      maxproc_mib[] = { CTL_KERN, KERN_MAXPROC };
+    int             buf_size;
+#endif
+#if defined(hpux10) || defined(hpux11)
+    struct pst_static pst_buf;
+#endif
+
+    if (header_hrsys(vp, name, length, exact, var_len, write_method) ==
+        MATCH_FAILED)
+        return NULL;
+
+    switch (vp->magic) {
+    case HRSYS_UPTIME:
+        long_return = get_uptime();
+        return (u_char *) & long_return;
+    case HRSYS_DATE:
+        (void *) time(&now);
+        return (u_char *) date_n_time(&now, var_len);
+    case HRSYS_LOAD_DEV:
+        long_return = get_load_dev();
+        return (u_char *) & long_return;
+    case HRSYS_LOAD_PARAM:
+#ifdef linux
+        fp = fopen("/proc/cmdline", "r");
+        fgets(string, sizeof(string), fp);
+        fclose(fp);
+#else
+#if NO_DUMMY_VALUES
+        return NULL;
+#endif
+        sprintf(string, "ask Dave");    /* XXX */
+#endif
+        *var_len = strlen(string);
+        return (u_char *) string;
+    case HRSYS_USERS:
+        long_return = count_users();
+        return (u_char *) & long_return;
+    case HRSYS_PROCS:
+#if USING_HOST_HR_SWRUN_MODULE
+        long_return = count_processes();
+#else
+#if NO_DUMMY_VALUES
+        return NULL;
+#endif
+        long_return = 0;
+#endif
+        return (u_char *) & long_return;
+    case HRSYS_MAXPROCS:
+#if defined(NR_TASKS)
+        long_return = NR_TASKS; /* <linux/tasks.h> */
+#elif CAN_USE_SYSCTL && defined(CTL_KERN) && defined(KERN_MAXPROC)
+        buf_size = sizeof(nproc);
+        if (sysctl(maxproc_mib, 2, &nproc, &buf_size, NULL, 0) < 0)
+            return NULL;
+        long_return = nproc;
+#elif defined(hpux10) || defined(hpux11)
+        pstat_getstatic(&pst_buf, sizeof(struct pst_static), 1, 0);
+        long_return = pst_buf.max_proc;
+#elif defined(NPROC_SYMBOL)
+        auto_nlist(NPROC_SYMBOL, (char *) &nproc, sizeof(int));
+        long_return = nproc;
+#else
+#if NO_DUMMY_VALUES
+        return NULL;
+#endif
+        long_return = 0;
+#endif
+        return (u_char *) & long_return;
+    default:
+        DEBUGMSGTL(("snmpd", "unknown sub-id %d in var_hrsys\n",
+                    vp->magic));
+    }
+    return NULL;
+}
+
+
+        /*********************
+	 *
+	 *  Internal implementation functions
+	 *
+	 *********************/
+
+                /*
+                 *  Return the DeviceIndex corresponding
+                 *   to the boot device
+                 */
+static int
+get_load_dev(void)
+{
+    return (HRDEV_DISK << HRDEV_TYPE_SHIFT);    /* XXX */
+}
+
+static int
+count_users(void)
+{
+    int             total = 0;
+#if HAVE_UTMPX_H
+#define setutent setutxent
+#define getutent getutxent
+#define endutent endutxent
+    struct utmpx   *utmp_p;
+#else
+    struct utmp    *utmp_p;
+#endif
+
+    setutent();
+    while ((utmp_p = getutent()) != NULL) {
+#ifndef UTMP_HAS_NO_TYPE
+        if (utmp_p->ut_type == USER_PROCESS)
+#endif
+            ++total;
+    }
+    endutent();
+    return total;
+}
+
+#if defined(UTMP_FILE) && !HAVE_UTMPX_H
+
+static FILE    *utmp_file;
+static struct utmp utmp_rec;
+
+void
+setutent(void)
+{
+    if (utmp_file)
+        fclose(utmp_file);
+    utmp_file = fopen(UTMP_FILE, "r");
+}
+
+void
+endutent(void)
+{
+    if (utmp_file) {
+        fclose(utmp_file);
+        utmp_file = NULL;
+    }
+}
+
+struct utmp    *
+getutent(void)
+{
+    if (!utmp_file)
+        return NULL;
+    while (fread(&utmp_rec, sizeof(utmp_rec), 1, utmp_file) == 1)
+        if (*utmp_rec.ut_name && *utmp_rec.ut_line)
+            return &utmp_rec;
+    return NULL;
+}
+
+#endif                          /* UTMP_FILE */
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/host/hr_system.h tomato121/release/src/router/snmp/agent/mibgroup/host/hr_system.h
--- tomato/release/src/router/snmp/agent/mibgroup/host/hr_system.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/host/hr_system.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,12 @@
+/*
+ *  Host Resources MIB - system group interface - hr_system.h
+ *
+ */
+#ifndef _MIBGROUP_HRSYSTEM_H
+#define _MIBGROUP_HRSYSTEM_H
+
+extern void     init_hr_system(void);
+extern FindVarMethod var_hrsys;
+
+
+#endif                          /* _MIBGROUP_HRSYSTEM_H */
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/host.h tomato121/release/src/router/snmp/agent/mibgroup/host.h
--- tomato/release/src/router/snmp/agent/mibgroup/host.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/host.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,85 @@
+/*
+ *  Host Resources 'wrapper' interface
+ *	calls the per-group interfaces from 'hr_*.h'
+ */
+
+	config_require(host/hr_system)
+	config_require(host/hr_storage)
+	config_require(host/hr_device)
+	config_require(host/hr_other)
+	config_require(host/hr_proc)
+	config_require(host/hr_network)
+	config_require(host/hr_print)
+	config_require(host/hr_disk)
+	config_require(host/hr_partition)
+	config_require(host/hr_filesys)
+	config_require(host/hr_swrun)
+	config_require(host/hr_swinst)
+
+/* add the host resources mib to the default mibs to load */
+config_add_mib(HOST-RESOURCES-MIB)
+config_add_mib(HOST-RESOURCES-TYPES)
+
+/*********************************************
+ *
+ *   A few words about the design of the Host Resources
+ *     implementation - particularly as regards the hrDevice
+ *     group and hrDeviceIndex.  This (and hrStorageIndex) make 
+ *     use of the non-consecutive nature of SNMP instance identifiers.
+ *
+ *   hrDeviceIndex is structured in a 'major/minor' form,
+ *     with the high end indicating the type of device
+ *     (following the enumerations of hrDeviceType) and the low
+ *     end being used to differentiate between devices of that type.
+ *
+ *   The implementation of walking through the available devices
+ *     uses a pair of arrays of functions - indexed by hrDeviceType
+ *     These are used to perform any initialisation needed for that
+ *     type of device, and to step through the instances of that type. 
+ *   This latter 'get_next' routing returns the hrDeviceIndex (including
+ *     the hrDeviceType major number), or -1 if there are no further
+ *     instances of that type.
+ *   When all devices of a particular type have been processed, the
+ *     initialisation function for the next device type is called,
+ *     and so on until all devices have been proceesed.
+ *   
+ *   Similar arrays are used to provide type-specific functions to
+ *     return the "common" device information (description, ID, status
+ *     and error count), and to save any internal structures needed
+ *     to provide these.
+ *   A final array is used to indicate whether hrDeviceIndexes are
+ *     returned in a random order, or strictly increasing.  In the
+ *     latter case, this allows the search for a particular index to
+ *     terminate as soon as the 'next' device is reached, without needing
+ *     to check the rest of them.  Similarly, once a particular type of
+ *     device has been scanned, further types will not be examined unless
+ *     a suitable index has not yet been found.
+ *
+ *   The index used for hrFSIndex is also used as hrStorageIndex,
+ *     for those storage areas corresponding to filestore.
+ *     Additional storage areas (such as memory or swap space) are
+ *     distinguished by index values greater than a defined constant.
+ *     Currently these are individually defined entries, but other
+ *     ranges could be implemented similarly.
+ *   If hrFSIndex was re-implemented to reflect internal identifiers,
+ *     it would be possible to reverse the sense of the current
+ *     implementation, with non-filestore storage having indices
+ *     less than a defined constant, rather than greater.
+ *
+ *
+ *   Much of the detailed implementation of this group (as opposed to
+ *     the implementation infrastructure outlined about) is likely to
+ *     be very system-specific.
+ *   The initial implementation (for HP-UX 9 and Linux) should be
+ *     regarded as a 'proof of concept' example, rather than as
+ *     finished, releasable code.  This particularly hold for the
+ *     disk device discovery code, which is gross in the extreme,
+ *     and should never have seen the light of day!
+ *   Hopefully this can be ripped out and given a quiet burial as
+ *     soon as is decently possible.  
+ *
+ *   Now it's up to the rest of you to hammer this into some sort of
+ *     sensible shape.
+ *                                Dave Shield
+ *   
+ *********************************************/
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/host_res.h tomato121/release/src/router/snmp/agent/mibgroup/host_res.h
--- tomato/release/src/router/snmp/agent/mibgroup/host_res.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/host_res.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,84 @@
+/*
+ *  Host Resources
+ *      Device index manipulation data
+ */
+
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#include <sys/types.h>
+#if HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/snmp_agent.h>
+#include <net-snmp/agent/agent_handler.h>
+#include <net-snmp/agent/snmp_vars.h>
+#include <net-snmp/agent/var_struct.h>
+
+#if defined(IFNET_NEEDS_KERNEL) && !defined(_KERNEL)
+#define _KERNEL 1
+#define _I_DEFINED_KERNEL
+#endif
+#include <sys/socket.h>
+#include <net/if.h>
+#ifdef _I_DEFINED_KERNEL
+#undef _KERNEL
+#endif
+#if HAVE_NET_IF_VAR_H
+#include <net/if_var.h>
+#endif
+#if HAVE_NETINET_IN_VAR_H
+#ifdef HAVE_SYS_QUEUE_H
+#include <sys/queue.h>
+#endif
+#include <netinet/in_var.h>
+#endif
+
+/*
+ * #include "snmp_vars.linux.h" 
+ */
+
+                /*
+                 * Deliberately set to the same values as hrDeviceTypes 
+                 */
+#define	HRDEV_OTHER	1
+#define	HRDEV_UNKNOWN	2
+#define	HRDEV_PROC	3
+#define	HRDEV_NETWORK	4
+#define	HRDEV_PRINTER	5
+#define	HRDEV_DISK	6
+#define	HRDEV_VIDEO	10
+#define	HRDEV_AUDIO	11
+#define	HRDEV_COPROC	12
+#define	HRDEV_KEYBOARD	13
+#define	HRDEV_MODEM	14
+#define	HRDEV_PARALLEL	15
+#define	HRDEV_POINTER	16
+#define	HRDEV_SERIAL	17
+#define	HRDEV_TAPE	18
+#define	HRDEV_CLOCK	19
+#define	HRDEV_VMEM	20
+#define	HRDEV_NVMEM	21
+
+#define	HRDEV_TYPE_MAX	22      /* one greater than largest device type */
+#define	HRDEV_TYPE_SHIFT  8
+#define	HRDEV_TYPE_MASK 0xff
+
+typedef void    (*PFV) (void);
+typedef int     (*PFI) (int);
+typedef int     (*PFIV) (void);
+typedef const char *(*PFS) (int);
+typedef oid    *(*PFO) (int, size_t *);
+
+extern PFV      init_device[];  /* Routines for stepping through devices */
+extern PFIV     next_device[];
+extern PFV      save_device[];
+extern int      dev_idx_inc[];  /* Flag - are indices returned in strictly
+                                 * increasing order */
+
+extern PFS      device_descr[]; /* Return data for a particular device */
+extern PFO      device_prodid[];
+extern PFI      device_status[];
+extern PFI      device_errors[];
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/ieee802dot11.c tomato121/release/src/router/snmp/agent/mibgroup/ieee802dot11.c
--- tomato/release/src/router/snmp/agent/mibgroup/ieee802dot11.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/ieee802dot11.c	2008-04-21 19:40:45.000000000 +1000
@@ -0,0 +1,4916 @@
+/****************************************************************************
+*                                                                           *
+*  File Name:           ieee802dot11.c                                      *
+*  Used By:                                                                 *
+*                                                                           *
+*  Operating System:                                                        *
+*  Purpose:                                                                 *
+*                                                                           *
+*  Comments:                                                                *
+*                                                                           *
+*  Author:              Larry Simmons                                       *
+*                       lsimmons@avantcom.com                               *
+*                       www.avantcom.com                                    *
+*                                                                           *
+*  Creation Date:       09/02/03                                            *
+*                                                                           *
+*   Ver    Date   Inits Modification                                        *
+*  ----- -------- ----- ------------                                        *
+*  0.0.1 09/02/03  LRS  created                                             *
+*  0.0.2 09/24/03  LRS  wouldn't build after fresh ./configure              *
+****************************************************************************/
+/****************************************************************************
+*                               Includes                                    *
+****************************************************************************/
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include "../../../../linux/linux/include/linux/wireless.h"
+#include "ieee802dot11.h"
+#include "iwlib.h"
+
+/****************************************************************************
+*                                Defines                                    *
+****************************************************************************/
+#define DISPLAYWIEXT                        // display wireless ext info
+#define TABLE_SIZE   1
+//#define MINLOADFREQ 15                    // min reload frequency in seconds
+#define MINLOADFREQ 5                       // min reload frequency in seconds      // for testing
+#define PROC_NET_DEV      "/proc/net/dev"
+#define PROC_NET_WIRELESS "/proc/net/wireless"
+
+#ifndef UCHAR
+  typedef unsigned char UCHAR;
+#endif
+
+/****************************************************************************
+*                            Private Functions                              *
+****************************************************************************/
+static void loadTables();
+static void loadWiExt ( int, char *, struct wireless_info * );
+static void load80211Structs ( int, char *, struct wireless_info * );
+static void initStructs();
+
+// Wireless Extensions Specific Functions
+static void loadWiExtTo80211Structs ( int, char *, struct wireless_info * );
+static void displayWiExt ( struct wireless_info );
+
+// Linked List Functions
+static void addList ( char *, char *, int );
+static void initLists();                    // initialize all the linked lists
+static void flushLists();                   // flush all the linked lists
+static void flushList ( char * );           // flush a single linked list
+
+// Utility Functions
+static int  openSocket ( void );
+static int  mWatt2dbm ( int );
+static char *htob ( char * );
+static int  hasChanged ( char *, int );
+
+/****************************************************************************
+*                            Private Variables                              *
+****************************************************************************/
+static unsigned long lastLoad = 0;          // ET in secs at last table load
+
+static struct avNode *lastNode, *newNode, *np;
+
+/****************************************************************************
+*                            External Functions                             *
+****************************************************************************/
+
+/****************************************************************************
+*   ieee802dot11_variables_oid:                                             *
+*       this is the top level oid that we want to register under.  This     *
+*       is essentially a prefix, with the suffix appearing in the           *
+*       variable below.                                                     *
+****************************************************************************/
+oid ieee802dot11_variables_oid[] = { 1,2,840,10036 };
+
+/****************************************************************************
+*   variable7 ieee802dot11_variables:                                       *
+*     this variable defines function callbacks and type return information  *
+*     for the ieee802dot11 mib section                                      *
+****************************************************************************/
+struct variable7 ieee802dot11_variables[] = {
+/*  magic number        , variable type , ro/rw , callback fn  , L, oidsuffix */
+#define   DOT11STATIONID        3
+  { DOT11STATIONID      , ASN_OCTET_STR , RWRITE, var_dot11StationConfigTable, 4, { 1,1,1,1 } },
+#define   DOT11MEDIUMOCCUPANCYLIMIT  4
+  { DOT11MEDIUMOCCUPANCYLIMIT, ASN_INTEGER   , RWRITE, var_dot11StationConfigTable, 4, { 1,1,1,2 } },
+#define   DOT11CFPOLLABLE       5
+  { DOT11CFPOLLABLE     , ASN_INTEGER   , RONLY , var_dot11StationConfigTable, 4, { 1,1,1,3 } },
+#define   DOT11CFPPERIOD        6
+  { DOT11CFPPERIOD      , ASN_INTEGER   , RWRITE, var_dot11StationConfigTable, 4, { 1,1,1,4 } },
+#define   DOT11CFPMAXDURATION   7
+  { DOT11CFPMAXDURATION , ASN_INTEGER   , RWRITE, var_dot11StationConfigTable, 4, { 1,1,1,5 } },
+#define   DOT11AUTHENTICATIONRESPONSETIMEOUT  8
+  { DOT11AUTHENTICATIONRESPONSETIMEOUT, ASN_INTEGER   , RWRITE, var_dot11StationConfigTable, 4, { 1,1,1,6 } },
+#define   DOT11PRIVACYOPTIONIMPLEMENTED  9
+  { DOT11PRIVACYOPTIONIMPLEMENTED, ASN_INTEGER   , RONLY , var_dot11StationConfigTable, 4, { 1,1,1,7 } },
+#define   DOT11POWERMANAGEMENTMODE  10
+  { DOT11POWERMANAGEMENTMODE, ASN_INTEGER   , RWRITE, var_dot11StationConfigTable, 4, { 1,1,1,8 } },
+#define   DOT11DESIREDSSID      11
+  { DOT11DESIREDSSID    , ASN_OCTET_STR , RWRITE, var_dot11StationConfigTable, 4, { 1,1,1,9 } },
+#define   DOT11DESIREDBSSTYPE   12
+  { DOT11DESIREDBSSTYPE , ASN_INTEGER   , RWRITE, var_dot11StationConfigTable, 4, { 1,1,1,10 } },
+#define   DOT11OPERATIONALRATESET  13
+  { DOT11OPERATIONALRATESET, ASN_OCTET_STR , RWRITE, var_dot11StationConfigTable, 4, { 1,1,1,11 } },
+#define   DOT11BEACONPERIOD     14
+  { DOT11BEACONPERIOD   , ASN_INTEGER   , RWRITE, var_dot11StationConfigTable, 4, { 1,1,1,12 } },
+#define   DOT11DTIMPERIOD       15
+  { DOT11DTIMPERIOD     , ASN_INTEGER   , RWRITE, var_dot11StationConfigTable, 4, { 1,1,1,13 } },
+#define   DOT11ASSOCIATIONRESPONSETIMEOUT  16
+  { DOT11ASSOCIATIONRESPONSETIMEOUT, ASN_INTEGER   , RWRITE, var_dot11StationConfigTable, 4, { 1,1,1,14 } },
+#define   DOT11DISASSOCIATEREASON  17
+  { DOT11DISASSOCIATEREASON, ASN_INTEGER   , RONLY , var_dot11StationConfigTable, 4, { 1,1,1,15 } },
+#define   DOT11DISASSOCIATESTATION  18
+  { DOT11DISASSOCIATESTATION, ASN_OCTET_STR , RONLY , var_dot11StationConfigTable, 4, { 1,1,1,16 } },
+#define   DOT11DEAUTHENTICATEREASON  19
+  { DOT11DEAUTHENTICATEREASON, ASN_INTEGER   , RONLY , var_dot11StationConfigTable, 4, { 1,1,1,17 } },
+#define   DOT11DEAUTHENTICATESTATION  20
+  { DOT11DEAUTHENTICATESTATION, ASN_OCTET_STR , RONLY , var_dot11StationConfigTable, 4, { 1,1,1,18 } },
+#define   DOT11AUTHENTICATEFAILSTATUS  21
+  { DOT11AUTHENTICATEFAILSTATUS, ASN_INTEGER   , RONLY , var_dot11StationConfigTable, 4, { 1,1,1,19 } },
+#define   DOT11AUTHENTICATEFAILSTATION  22
+  { DOT11AUTHENTICATEFAILSTATION, ASN_OCTET_STR , RONLY , var_dot11StationConfigTable, 4, { 1,1,1,20 } },
+
+#define   DOT11AUTHENTICATIONALGORITHM  26
+  { DOT11AUTHENTICATIONALGORITHM, ASN_INTEGER   , RONLY , var_dot11AuthenticationAlgorithmsTable, 4, { 1,2,1,2 } },
+#define   DOT11AUTHENTICATIONALGORITHMSENABLE  27
+  { DOT11AUTHENTICATIONALGORITHMSENABLE, ASN_INTEGER   , RWRITE, var_dot11AuthenticationAlgorithmsTable, 4, { 1,2,1,3 } },
+
+#define   DOT11WEPDEFAULTKEYVALUE  31
+  { DOT11WEPDEFAULTKEYVALUE, ASN_OCTET_STR , RWRITE, var_dot11WEPDefaultKeysTable, 4, { 1,3,1,2 } },
+
+#define   DOT11WEPKEYMAPPINGADDRESS  35
+  { DOT11WEPKEYMAPPINGADDRESS, ASN_OCTET_STR , RWRITE, var_dot11WEPKeyMappingsTable, 4, { 1,4,1,2 } },
+#define   DOT11WEPKEYMAPPINGWEPON  36
+  { DOT11WEPKEYMAPPINGWEPON, ASN_INTEGER   , RWRITE, var_dot11WEPKeyMappingsTable, 4, { 1,4,1,3 } },
+#define   DOT11WEPKEYMAPPINGVALUE  37
+  { DOT11WEPKEYMAPPINGVALUE, ASN_OCTET_STR , RWRITE, var_dot11WEPKeyMappingsTable, 4, { 1,4,1,4 } },
+#define   DOT11WEPKEYMAPPINGSTATUS  38
+  { DOT11WEPKEYMAPPINGSTATUS, ASN_INTEGER   , RWRITE, var_dot11WEPKeyMappingsTable, 4, { 1,4,1,5 } },
+
+#define   DOT11PRIVACYINVOKED   41
+  { DOT11PRIVACYINVOKED , ASN_INTEGER   , RWRITE, var_dot11PrivacyTable, 4, { 1,5,1,1 } },
+#define   DOT11WEPDEFAULTKEYID  42
+  { DOT11WEPDEFAULTKEYID, ASN_INTEGER   , RWRITE, var_dot11PrivacyTable, 4, { 1,5,1,2 } },
+#define   DOT11WEPKEYMAPPINGLENGTH  43
+  { DOT11WEPKEYMAPPINGLENGTH, ASN_INTEGER   , RWRITE, var_dot11PrivacyTable, 4, { 1,5,1,3 } },
+#define   DOT11EXCLUDEUNENCRYPTED  44
+  { DOT11EXCLUDEUNENCRYPTED, ASN_INTEGER   , RWRITE, var_dot11PrivacyTable, 4, { 1,5,1,4 } },
+#define   DOT11WEPICVERRORCOUNT  45
+  { DOT11WEPICVERRORCOUNT, ASN_COUNTER   , RONLY , var_dot11PrivacyTable, 4, { 1,5,1,5 } },
+#define   DOT11WEPEXCLUDEDCOUNT  46
+  { DOT11WEPEXCLUDEDCOUNT, ASN_COUNTER   , RONLY , var_dot11PrivacyTable, 4, { 1,5,1,6 } },
+
+#define   DOT11MACADDRESS       49
+  { DOT11MACADDRESS     , ASN_OCTET_STR , RONLY , var_dot11OperationTable, 4, { 2,1,1,1 } },
+#define   DOT11RTSTHRESHOLD     50
+  { DOT11RTSTHRESHOLD   , ASN_INTEGER   , RWRITE, var_dot11OperationTable, 4, { 2,1,1,2 } },
+#define   DOT11SHORTRETRYLIMIT  51
+  { DOT11SHORTRETRYLIMIT, ASN_INTEGER   , RWRITE, var_dot11OperationTable, 4, { 2,1,1,3 } },
+#define   DOT11LONGRETRYLIMIT   52
+  { DOT11LONGRETRYLIMIT , ASN_INTEGER   , RWRITE, var_dot11OperationTable, 4, { 2,1,1,4 } },
+#define   DOT11FRAGMENTATIONTHRESHOLD  53
+  { DOT11FRAGMENTATIONTHRESHOLD, ASN_INTEGER   , RWRITE, var_dot11OperationTable, 4, { 2,1,1,5 } },
+#define   DOT11MAXTRANSMITMSDULIFETIME  54
+  { DOT11MAXTRANSMITMSDULIFETIME, ASN_INTEGER   , RWRITE, var_dot11OperationTable, 4, { 2,1,1,6 } },
+#define   DOT11MAXRECEIVELIFETIME  55
+  { DOT11MAXRECEIVELIFETIME, ASN_INTEGER   , RWRITE, var_dot11OperationTable, 4, { 2,1,1,7 } },
+#define   DOT11MANUFACTURERID   56
+  { DOT11MANUFACTURERID , ASN_OCTET_STR , RONLY , var_dot11OperationTable, 4, { 2,1,1,8 } },
+#define   DOT11PRODUCTID        57
+  { DOT11PRODUCTID      , ASN_OCTET_STR , RONLY , var_dot11OperationTable, 4, { 2,1,1,9 } },
+
+#define   DOT11TRANSMITTEDFRAGMENTCOUNT  60
+  { DOT11TRANSMITTEDFRAGMENTCOUNT, ASN_COUNTER   , RONLY , var_dot11CountersTable, 4, { 2,2,1,1 } },
+#define   DOT11MULTICASTTRANSMITTEDFRAMECOUNT  61
+  { DOT11MULTICASTTRANSMITTEDFRAMECOUNT, ASN_COUNTER   , RONLY , var_dot11CountersTable, 4, { 2,2,1,2 } },
+#define   DOT11FAILEDCOUNT      62
+  { DOT11FAILEDCOUNT    , ASN_COUNTER   , RONLY , var_dot11CountersTable, 4, { 2,2,1,3 } },
+#define   DOT11RETRYCOUNT       63
+  { DOT11RETRYCOUNT     , ASN_COUNTER   , RONLY , var_dot11CountersTable, 4, { 2,2,1,4 } },
+#define   DOT11MULTIPLERETRYCOUNT  64
+  { DOT11MULTIPLERETRYCOUNT, ASN_COUNTER   , RONLY , var_dot11CountersTable, 4, { 2,2,1,5 } },
+#define   DOT11FRAMEDUPLICATECOUNT  65
+  { DOT11FRAMEDUPLICATECOUNT, ASN_COUNTER   , RONLY , var_dot11CountersTable, 4, { 2,2,1,6 } },
+#define   DOT11RTSSUCCESSCOUNT  66
+  { DOT11RTSSUCCESSCOUNT, ASN_COUNTER   , RONLY , var_dot11CountersTable, 4, { 2,2,1,7 } },
+#define   DOT11RTSFAILURECOUNT  67
+  { DOT11RTSFAILURECOUNT, ASN_COUNTER   , RONLY , var_dot11CountersTable, 4, { 2,2,1,8 } },
+#define   DOT11ACKFAILURECOUNT  68
+  { DOT11ACKFAILURECOUNT, ASN_COUNTER   , RONLY , var_dot11CountersTable, 4, { 2,2,1,9 } },
+#define   DOT11RECEIVEDFRAGMENTCOUNT  69
+  { DOT11RECEIVEDFRAGMENTCOUNT, ASN_COUNTER   , RONLY , var_dot11CountersTable, 4, { 2,2,1,10 } },
+#define   DOT11MULTICASTRECEIVEDFRAMECOUNT  70
+  { DOT11MULTICASTRECEIVEDFRAMECOUNT, ASN_COUNTER   , RONLY , var_dot11CountersTable, 4, { 2,2,1,11 } },
+#define   DOT11FCSERRORCOUNT    71
+  { DOT11FCSERRORCOUNT  , ASN_COUNTER   , RONLY , var_dot11CountersTable, 4, { 2,2,1,12 } },
+#define   DOT11TRANSMITTEDFRAMECOUNT  72
+  { DOT11TRANSMITTEDFRAMECOUNT, ASN_COUNTER   , RONLY , var_dot11CountersTable, 4, { 2,2,1,13 } },
+#define   DOT11WEPUNDECRYPTABLECOUNT  73
+  { DOT11WEPUNDECRYPTABLECOUNT, ASN_COUNTER   , RONLY , var_dot11CountersTable, 4, { 2,2,1,14 } },
+
+#define   DOT11ADDRESS          77
+  { DOT11ADDRESS        , ASN_OCTET_STR , RWRITE, var_dot11GroupAddressesTable, 4, { 2,3,1,2 } },
+#define   DOT11GROUPADDRESSESSTATUS  78
+  { DOT11GROUPADDRESSESSTATUS, ASN_INTEGER   , RWRITE, var_dot11GroupAddressesTable, 4, { 2,3,1,3 } },
+
+#define   DOT11RESOURCETYPEIDNAME  79
+  { DOT11RESOURCETYPEIDNAME, ASN_OCTET_STR , RONLY , var_ieee802dot11, 3, { 3,1,1 } },
+#define   DOT11MANUFACTUREROUI  82
+  { DOT11MANUFACTUREROUI, ASN_OCTET_STR , RONLY , var_dot11ResourceInfoTable, 5, { 3,1,2,1,1 } },
+#define   DOT11MANUFACTURERNAME  83
+  { DOT11MANUFACTURERNAME, ASN_OCTET_STR , RONLY , var_dot11ResourceInfoTable, 5, { 3,1,2,1,2 } },
+#define   DOT11MANUFACTURERPRODUCTNAME  84
+  { DOT11MANUFACTURERPRODUCTNAME, ASN_OCTET_STR , RONLY , var_dot11ResourceInfoTable, 5, { 3,1,2,1,3 } },
+#define   DOT11MANUFACTURERPRODUCTVERSION  85
+  { DOT11MANUFACTURERPRODUCTVERSION, ASN_OCTET_STR , RONLY , var_dot11ResourceInfoTable, 5, { 3,1,2,1,4 } },
+
+#define   DOT11PHYTYPE          88
+  { DOT11PHYTYPE        , ASN_INTEGER   , RONLY , var_dot11PhyOperationTable, 4, { 4,1,1,1 } },
+#define   DOT11CURRENTREGDOMAIN  89
+  { DOT11CURRENTREGDOMAIN, ASN_INTEGER   , RWRITE, var_dot11PhyOperationTable, 4, { 4,1,1,2 } },
+#define   DOT11TEMPTYPE         90
+  { DOT11TEMPTYPE       , ASN_INTEGER   , RONLY , var_dot11PhyOperationTable, 4, { 4,1,1,3 } },
+#define   DOT11CURRENTTXANTENNA  93
+  { DOT11CURRENTTXANTENNA, ASN_INTEGER   , RWRITE, var_dot11PhyAntennaTable, 4, { 4,2,1,1 } },
+#define   DOT11DIVERSITYSUPPORT  94
+  { DOT11DIVERSITYSUPPORT, ASN_INTEGER   , RONLY , var_dot11PhyAntennaTable, 4, { 4,2,1,2 } },
+#define   DOT11CURRENTRXANTENNA  95
+  { DOT11CURRENTRXANTENNA, ASN_INTEGER   , RWRITE, var_dot11PhyAntennaTable, 4, { 4,2,1,3 } },
+#define   DOT11NUMBERSUPPORTEDPOWERLEVELS  98
+  { DOT11NUMBERSUPPORTEDPOWERLEVELS, ASN_INTEGER   , RONLY , var_dot11PhyTxPowerTable, 4, { 4,3,1,1 } },
+#define   DOT11TXPOWERLEVEL1    99
+  { DOT11TXPOWERLEVEL1  , ASN_INTEGER   , RONLY , var_dot11PhyTxPowerTable, 4, { 4,3,1,2 } },
+#define   DOT11TXPOWERLEVEL2    100
+  { DOT11TXPOWERLEVEL2  , ASN_INTEGER   , RONLY , var_dot11PhyTxPowerTable, 4, { 4,3,1,3 } },
+#define   DOT11TXPOWERLEVEL3    101
+  { DOT11TXPOWERLEVEL3  , ASN_INTEGER   , RONLY , var_dot11PhyTxPowerTable, 4, { 4,3,1,4 } },
+#define   DOT11TXPOWERLEVEL4    102
+  { DOT11TXPOWERLEVEL4  , ASN_INTEGER   , RONLY , var_dot11PhyTxPowerTable, 4, { 4,3,1,5 } },
+#define   DOT11TXPOWERLEVEL5    103
+  { DOT11TXPOWERLEVEL5  , ASN_INTEGER   , RONLY , var_dot11PhyTxPowerTable, 4, { 4,3,1,6 } },
+#define   DOT11TXPOWERLEVEL6    104
+  { DOT11TXPOWERLEVEL6  , ASN_INTEGER   , RONLY , var_dot11PhyTxPowerTable, 4, { 4,3,1,7 } },
+#define   DOT11TXPOWERLEVEL7    105
+  { DOT11TXPOWERLEVEL7  , ASN_INTEGER   , RONLY , var_dot11PhyTxPowerTable, 4, { 4,3,1,8 } },
+#define   DOT11TXPOWERLEVEL8    106
+  { DOT11TXPOWERLEVEL8  , ASN_INTEGER   , RONLY , var_dot11PhyTxPowerTable, 4, { 4,3,1,9 } },
+#define   DOT11CURRENTTXPOWERLEVEL  107
+  { DOT11CURRENTTXPOWERLEVEL, ASN_INTEGER   , RWRITE, var_dot11PhyTxPowerTable, 4, { 4,3,1,10 } },
+
+#define   DOT11HOPTIME          110
+  { DOT11HOPTIME        , ASN_INTEGER   , RONLY , var_dot11PhyFHSSTable, 4, { 4,4,1,1 } },
+#define   DOT11CURRENTCHANNELNUMBER  111
+  { DOT11CURRENTCHANNELNUMBER, ASN_INTEGER   , RWRITE, var_dot11PhyFHSSTable, 4, { 4,4,1,2 } },
+#define   DOT11MAXDWELLTIME     112
+  { DOT11MAXDWELLTIME   , ASN_INTEGER   , RONLY , var_dot11PhyFHSSTable, 4, { 4,4,1,3 } },
+#define   DOT11CURRENTDWELLTIME  113
+  { DOT11CURRENTDWELLTIME, ASN_INTEGER   , RWRITE, var_dot11PhyFHSSTable, 4, { 4,4,1,4 } },
+#define   DOT11CURRENTSET       114
+  { DOT11CURRENTSET     , ASN_INTEGER   , RWRITE, var_dot11PhyFHSSTable, 4, { 4,4,1,5 } },
+#define   DOT11CURRENTPATTERN   115
+  { DOT11CURRENTPATTERN , ASN_INTEGER   , RWRITE, var_dot11PhyFHSSTable, 4, { 4,4,1,6 } },
+#define   DOT11CURRENTINDEX     116
+  { DOT11CURRENTINDEX   , ASN_INTEGER   , RWRITE, var_dot11PhyFHSSTable, 4, { 4,4,1,7 } },
+
+#define   DOT11CURRENTCHANNEL   119
+  { DOT11CURRENTCHANNEL , ASN_INTEGER   , RWRITE, var_dot11PhyDSSSTable, 4, { 4,5,1,1 } },
+#define   DOT11CCAMODESUPPORTED  120
+  { DOT11CCAMODESUPPORTED, ASN_INTEGER   , RONLY , var_dot11PhyDSSSTable, 4, { 4,5,1,2 } },
+#define   DOT11CURRENTCCAMODE   121
+  { DOT11CURRENTCCAMODE , ASN_INTEGER   , RWRITE, var_dot11PhyDSSSTable, 4, { 4,5,1,3 } },
+#define   DOT11EDTHRESHOLD      122
+  { DOT11EDTHRESHOLD    , ASN_INTEGER   , RWRITE, var_dot11PhyDSSSTable, 4, { 4,5,1,4 } },
+
+#define   DOT11CCAWATCHDOGTIMERMAX  125
+  { DOT11CCAWATCHDOGTIMERMAX, ASN_INTEGER   , RWRITE, var_dot11PhyIRTable, 4, { 4,6,1,1 } },
+#define   DOT11CCAWATCHDOGCOUNTMAX  126
+  { DOT11CCAWATCHDOGCOUNTMAX, ASN_INTEGER   , RWRITE, var_dot11PhyIRTable, 4, { 4,6,1,2 } },
+#define   DOT11CCAWATCHDOGTIMERMIN  127
+  { DOT11CCAWATCHDOGTIMERMIN, ASN_INTEGER   , RWRITE, var_dot11PhyIRTable, 4, { 4,6,1,3 } },
+#define   DOT11CCAWATCHDOGCOUNTMIN  128
+  { DOT11CCAWATCHDOGCOUNTMIN, ASN_INTEGER   , RWRITE, var_dot11PhyIRTable, 4, { 4,6,1,4 } },
+
+#define   DOT11REGDOMAINSSUPPORTVALUE  132
+  { DOT11REGDOMAINSSUPPORTVALUE, ASN_INTEGER   , RONLY , var_dot11RegDomainsSupportedTable, 4, { 4,7,1,2 } },
+
+#define   DOT11SUPPORTEDTXANTENNA  136
+  { DOT11SUPPORTEDTXANTENNA, ASN_INTEGER   , RWRITE, var_dot11AntennasListTable, 4, { 4,8,1,2 } },
+#define   DOT11SUPPORTEDRXANTENNA  137
+  { DOT11SUPPORTEDRXANTENNA, ASN_INTEGER   , RWRITE, var_dot11AntennasListTable, 4, { 4,8,1,3 } },
+#define   DOT11DIVERSITYSELECTIONRX  138
+  { DOT11DIVERSITYSELECTIONRX, ASN_INTEGER   , RWRITE, var_dot11AntennasListTable, 4, { 4,8,1,4 } },
+
+#define   DOT11SUPPORTEDDATARATESTXVALUE  142
+  { DOT11SUPPORTEDDATARATESTXVALUE, ASN_INTEGER   , RONLY , var_dot11SupportedDataRatesTxTable, 4, { 4,9,1,2 } },
+
+#define   DOT11SUPPORTEDDATARATESRXVALUE  146
+  { DOT11SUPPORTEDDATARATESRXVALUE, ASN_INTEGER   , RONLY , var_dot11SupportedDataRatesRxTable, 4, { 4,10,1,2 } },
+};
+// ( L = length of the oidsuffix )
+
+/****************************************************************************
+*                                                                           *
+*         init_ieee802dot11() - perform any required initialization         *
+*                                                                           *
+****************************************************************************/
+void init_ieee802dot11 ( void ) {
+
+  /* register ourselves with the agent to handle our mib tree */
+  REGISTER_MIB("ieee802dot11", ieee802dot11_variables, variable7,
+               ieee802dot11_variables_oid);
+
+  initLists();
+}
+
+/****************************************************************************
+*                                                                           *
+*    shutdown_ieee802dot11() - perform any required cleanup @ shutdown      *
+*                                                                           *
+****************************************************************************/
+void shutdown_ieee802dot11 ( void )
+{
+  flushLists();
+}
+
+/****************************************************************************
+*                                                                           *
+*   var_ieee802dot11() -                                                    *
+*                                                                           *
+****************************************************************************/
+unsigned char *
+var_ieee802dot11 ( struct variable *vp, 
+                    oid     *name, 
+                    size_t  *length, 
+                    int     exact, 
+                    size_t  *var_len, 
+                    WriteMethod **write_method)
+{
+  loadTables();                                               
+
+  if ( header_generic ( vp, name, length, exact,var_len,write_method )
+                                  == MATCH_FAILED )
+    return NULL;
+
+  switch ( vp->magic ) {
+
+    case DOT11RESOURCETYPEIDNAME:
+      if ( !haveResourceTypeIDName )
+        return NULL;
+      *var_len = strlen ( resourceTypeIDName );
+      return ( UCHAR * ) resourceTypeIDName;
+
+    default:
+      ERROR_MSG ( "" );
+  }
+
+  return NULL;
+}
+
+/****************************************************************************
+*                                                                           *
+*  var_dot11StationConfigTable() - return a variable value from the table   *
+*                                                                           *
+****************************************************************************/
+unsigned char *
+var_dot11StationConfigTable ( struct variable *vp,
+                              oid     *name,
+                              size_t  *length,
+                              int     exact,
+                              size_t  *var_len,
+                              WriteMethod **write_method )
+{
+  int found = FALSE;
+  oid rName [ MAX_OID_LEN ];                            // OID to be returned
+  static char MACWork[17];
+
+  loadTables();
+  memcpy (( char * ) rName, ( char * ) vp->name, ( int ) vp->namelen * sizeof ( oid ));
+  for ( np = LIST_FIRST ( &scList ); np != NULL; np = LIST_NEXT ( np, nodes )) {
+    sc = ( struct scTbl_data * ) np->data;
+    rName[vp->namelen] = sc->ifIndex;
+    if ((  exact && ( snmp_oid_compare ( rName, vp->namelen + 1, name, *length ) == 0 )) || 
+        ( !exact && ( snmp_oid_compare ( rName, vp->namelen + 1, name, *length ) >  0 ))) {
+
+      switch ( vp->magic ) {      // found requested OID, now check for requested variable
+        case DOT11STATIONID: 
+          if ( sc->haveStationID                     ) found = TRUE; break;
+        case DOT11MEDIUMOCCUPANCYLIMIT:
+          if ( sc->haveMediumOccupancyLimit          ) found = TRUE; break;
+        case DOT11CFPOLLABLE:
+          if ( sc->haveCFPPollable                   ) found = TRUE; break;
+        case DOT11CFPPERIOD:
+          if ( sc->haveCFPPeriod                     ) found = TRUE; break;
+        case DOT11CFPMAXDURATION:
+          if ( sc->haveMaxDuration                   ) found = TRUE; break;
+        case DOT11AUTHENTICATIONRESPONSETIMEOUT:
+          if ( sc->haveAuthenticationResponseTimeOut ) found = TRUE; break;
+        case DOT11PRIVACYOPTIONIMPLEMENTED:
+          if ( sc->havePrivacyOptionImplemented      ) found = TRUE; break;
+        case DOT11POWERMANAGEMENTMODE:
+          if ( sc->havePowerManagementMode           ) found = TRUE; break;
+        case DOT11DESIREDSSID:
+          if ( sc->haveDesiredSSID                   ) found = TRUE; break;
+        case DOT11DESIREDBSSTYPE:
+          if ( sc->haveDesiredBSSType                ) found = TRUE; break;
+        case DOT11OPERATIONALRATESET:
+          if ( sc->haveOperationalRateSet            ) found = TRUE; break;
+        case DOT11BEACONPERIOD: 
+          if ( sc->haveBeaconPeriod                  ) found = TRUE; break;
+        case DOT11DTIMPERIOD:
+          if ( sc->haveDTIMPeriod                    ) found = TRUE; break;
+        case DOT11ASSOCIATIONRESPONSETIMEOUT:
+          if ( sc->haveAssociationResponseTimeOut    ) found = TRUE; break;
+        case DOT11DISASSOCIATEREASON:
+          if ( sc->disAssociationReason              ) found = TRUE; break;
+        case DOT11DISASSOCIATESTATION:
+          if ( sc->haveDisAssociationStation         ) found = TRUE; break;
+        case DOT11DEAUTHENTICATEREASON:
+          if ( sc->deAuthenticationReason            ) found = TRUE; break;
+        case DOT11DEAUTHENTICATESTATION:
+          if ( sc->haveDeAuthenticationStation       ) found = TRUE; break;
+        case DOT11AUTHENTICATEFAILSTATUS:
+          if ( sc->authenticateFailStatus            ) found = TRUE; break;
+        case DOT11AUTHENTICATEFAILSTATION:
+          if ( sc->haveAuthenticateFailStation       ) found = TRUE; break;
+      }
+    }
+    if ( found )
+      break;
+  }
+
+  if ( !found ) 
+    return NULL;
+
+  memcpy (( char * ) name, ( char * ) rName, ( vp->namelen + 1 ) * sizeof ( oid ));
+  *length = vp->namelen + 1;
+  *var_len = sizeof ( long );
+  *write_method = NULL;
+
+  switch ( vp->magic ) {
+
+    case DOT11STATIONID: 
+//    *write_method = write_dot11StationID;
+      MACWork[ 0] = sc->stationID [ 0];
+      MACWork[ 1] = sc->stationID [ 1];
+      MACWork[ 2] = sc->stationID [ 3];
+      MACWork[ 3] = sc->stationID [ 4];
+      MACWork[ 4] = sc->stationID [ 6];
+      MACWork[ 5] = sc->stationID [ 7];
+      MACWork[ 6] = sc->stationID [ 9];
+      MACWork[ 7] = sc->stationID [10];
+      MACWork[ 8] = sc->stationID [12];
+      MACWork[ 9] = sc->stationID [13];
+      MACWork[10] = sc->stationID [15];
+      MACWork[11] = sc->stationID [16];
+      MACWork[12] = '\0';
+      *var_len = 6;
+      return ( UCHAR * ) htob ( MACWork );
+
+    case DOT11MEDIUMOCCUPANCYLIMIT:
+//    *write_method = write_dot11MediumOccupancyLimit;
+      sc->mediumOccupancyLimit = 5;
+      return ( UCHAR * ) &sc->mediumOccupancyLimit;
+
+    case DOT11CFPOLLABLE:
+      return ( UCHAR * ) &sc->CFPPollable;
+
+    case DOT11CFPPERIOD:
+//    *write_method = write_dot11CFPPeriod;
+      return ( UCHAR * ) &sc->CFPPeriod;
+
+    case DOT11CFPMAXDURATION:
+//    *write_method = write_dot11CFPMaxDuration;
+      return ( UCHAR * ) &sc->maxDuration;
+
+    case DOT11AUTHENTICATIONRESPONSETIMEOUT:
+//    *write_method = write_dot11AuthenticationResponseTimeOut;
+      return ( UCHAR * ) &sc->authenticationResponseTimeOut;
+
+    case DOT11PRIVACYOPTIONIMPLEMENTED:
+      return ( UCHAR * ) &sc->privacyOptionImplemented;
+
+    case DOT11POWERMANAGEMENTMODE:
+//    *write_method = write_dot11PowerManagementMode;
+      return ( UCHAR * ) &sc->powerManagementMode;
+
+    case DOT11DESIREDSSID:
+//    *write_method = write_dot11DesiredSSID;
+      *var_len = strlen ( sc->desiredSSID );
+      return ( UCHAR * ) sc->desiredSSID;
+
+    case DOT11DESIREDBSSTYPE:
+//    *write_method = write_dot11DesiredBSSType;
+      return ( UCHAR * ) &sc->desiredBSSType;
+
+    case DOT11OPERATIONALRATESET:
+//    *write_method = write_dot11OperationalRateSet;
+      *var_len = strlen ( sc->operationalRateSet );
+      return ( UCHAR * ) sc->operationalRateSet;
+
+    case DOT11BEACONPERIOD: 
+//    *write_method = write_dot11BeaconPeriod;
+      return ( UCHAR * ) &sc->beaconPeriod;
+
+    case DOT11DTIMPERIOD:
+//    *write_method = write_dot11DTIMPeriod;
+      return ( UCHAR * ) &sc->DTIMPeriod;
+
+    case DOT11ASSOCIATIONRESPONSETIMEOUT:
+//    *write_method = write_dot11AssociationResponseTimeOut;
+      return ( UCHAR * ) &sc->associationResponseTimeOut;
+
+    case DOT11DISASSOCIATEREASON:
+      return ( UCHAR * ) &sc->disAssociationReason;
+
+    case DOT11DISASSOCIATESTATION:
+      MACWork[ 0] = sc->disAssociationStation[ 0];
+      MACWork[ 1] = sc->disAssociationStation[ 1];
+      MACWork[ 2] = sc->disAssociationStation[ 3];
+      MACWork[ 3] = sc->disAssociationStation[ 4];
+      MACWork[ 4] = sc->disAssociationStation[ 6];
+      MACWork[ 5] = sc->disAssociationStation[ 7];
+      MACWork[ 6] = sc->disAssociationStation[ 9];
+      MACWork[ 7] = sc->disAssociationStation[10];
+      MACWork[ 8] = sc->disAssociationStation[12];
+      MACWork[ 9] = sc->disAssociationStation[13];
+      MACWork[10] = sc->disAssociationStation[15];
+      MACWork[11] = sc->disAssociationStation[16];
+      MACWork[12] = '\0';
+      *var_len = 6;
+      return ( UCHAR * ) htob ( MACWork );
+
+    case DOT11DEAUTHENTICATEREASON:
+      return ( UCHAR * ) &sc->deAuthenticationReason;
+
+    case DOT11DEAUTHENTICATESTATION:
+      MACWork[ 0] = sc->deAuthenticationStation[ 0];
+      MACWork[ 1] = sc->deAuthenticationStation[ 1];
+      MACWork[ 2] = sc->deAuthenticationStation[ 3];
+      MACWork[ 3] = sc->deAuthenticationStation[ 4];
+      MACWork[ 4] = sc->deAuthenticationStation[ 6];
+      MACWork[ 5] = sc->deAuthenticationStation[ 7];
+      MACWork[ 6] = sc->deAuthenticationStation[ 9];
+      MACWork[ 7] = sc->deAuthenticationStation[10];
+      MACWork[ 8] = sc->deAuthenticationStation[12];
+      MACWork[ 9] = sc->deAuthenticationStation[13];
+      MACWork[10] = sc->deAuthenticationStation[15];
+      MACWork[11] = sc->deAuthenticationStation[16];
+      MACWork[12] = '\0';
+      *var_len = 6;
+      return ( UCHAR * ) htob ( MACWork );
+
+    case DOT11AUTHENTICATEFAILSTATUS:
+      return ( UCHAR * ) &sc->authenticateFailStatus;
+
+    case DOT11AUTHENTICATEFAILSTATION:
+      MACWork[ 0] = sc->authenticateFailStation[ 0];
+      MACWork[ 1] = sc->authenticateFailStation[ 1];
+      MACWork[ 2] = sc->authenticateFailStation[ 3];
+      MACWork[ 3] = sc->authenticateFailStation[ 4];
+      MACWork[ 4] = sc->authenticateFailStation[ 6];
+      MACWork[ 5] = sc->authenticateFailStation[ 7];
+      MACWork[ 6] = sc->authenticateFailStation[ 9];
+      MACWork[ 7] = sc->authenticateFailStation[10];
+      MACWork[ 8] = sc->authenticateFailStation[12];
+      MACWork[ 9] = sc->authenticateFailStation[13];
+      MACWork[10] = sc->authenticateFailStation[15];
+      MACWork[11] = sc->authenticateFailStation[16];
+      MACWork[12] = '\0';
+      *var_len = 6;
+      return ( UCHAR * ) htob ( MACWork );
+
+    default:
+      ERROR_MSG ( "" );
+  }
+
+  return NULL;
+}
+
+/****************************************************************************
+*                                                                           *
+*  var_dot11AuthenticationAlgorithmsTable() -                               *
+*                                                                           *
+****************************************************************************/
+unsigned char *
+var_dot11AuthenticationAlgorithmsTable (  struct variable *vp,
+                                          oid     *name,
+                                          size_t  *length,
+                                          int     exact,
+                                          size_t  *var_len,
+                                          WriteMethod **write_method )
+{
+  int found = FALSE;
+  oid rName [ MAX_OID_LEN ];                            // OID to be returned
+
+  loadTables();
+  memcpy (( char * ) rName, ( char * ) vp->name, ( int ) vp->namelen * sizeof ( oid ));
+  for ( np = LIST_FIRST ( &aaList ); np != NULL; np = LIST_NEXT ( np, nodes )) {
+    aa = ( struct aaTbl_data * ) np->data;
+    rName[vp->namelen + 0] = aa->ifIndex;
+    rName[vp->namelen + 1] = aa->authenticationAlgorithmsIndex;
+    if ((  exact && ( snmp_oid_compare ( rName, vp->namelen + 2, name, *length ) == 0 )) ||
+        ( !exact && ( snmp_oid_compare ( rName, vp->namelen + 2, name, *length ) >  0 ))) {
+      switch ( vp->magic ) {
+        case DOT11AUTHENTICATIONALGORITHM:
+          if ( aa->haveAuthenticationAlgorithm    ) found = TRUE; break;
+        case DOT11AUTHENTICATIONALGORITHMSENABLE:
+          if ( aa->authenticationAlgorithmsEnable ) found = TRUE; break;
+      }
+    }
+    if ( found )
+      break;
+  }
+
+  if ( !found ) 
+    return NULL;
+
+  memcpy (( char * ) name, ( char * ) rName, ( vp->namelen + 2 ) * sizeof ( oid ));
+  *length = vp->namelen + 2;
+  *var_len = sizeof ( long );
+  *write_method = NULL;
+
+  switch ( vp->magic ) {
+
+    case DOT11AUTHENTICATIONALGORITHM:
+      return ( UCHAR * ) &aa->authenticationAlgorithm;
+        
+    case DOT11AUTHENTICATIONALGORITHMSENABLE:
+//    *write_method = write_dot11AuthenticationAlgorithmsEnable;
+      return ( UCHAR * ) &aa->authenticationAlgorithmsEnable;
+
+    default:
+      ERROR_MSG ( "" );
+  }
+
+  return NULL;
+}
+
+/****************************************************************************
+*                                                                           *
+*  var_dot11WEPDefaultKeysTable() -                                         *
+*                                                                           *
+****************************************************************************/
+unsigned char *
+var_dot11WEPDefaultKeysTable ( struct variable *vp,
+                                oid     *name,
+                                size_t  *length,
+                                int     exact,
+                                size_t  *var_len,
+                                WriteMethod **write_method )
+{
+  int found = FALSE;
+  oid rName [ MAX_OID_LEN ];                            // OID to be returned
+
+  loadTables();
+  memcpy (( char * ) rName, ( char * ) vp->name, ( int ) vp->namelen * sizeof ( oid ));
+  for ( np = LIST_FIRST ( &dfList ); np != NULL; np = LIST_NEXT ( np, nodes )) {
+    df = ( struct dfTbl_data * ) np->data;
+    rName[vp->namelen + 0] = df->ifIndex;
+    rName[vp->namelen + 1] = df->WEPDefaultKeyIndex;
+    if ((  exact && ( snmp_oid_compare ( rName, vp->namelen + 2, name, *length ) == 0 )) ||
+        ( !exact && ( snmp_oid_compare ( rName, vp->namelen + 2, name, *length ) >  0 ))) {
+      switch ( vp->magic ) {
+        case DOT11WEPDEFAULTKEYVALUE:
+          if ( df->haveWEPDefaultKeyValue ) found = TRUE; break;
+      }          
+    }          
+    if ( found )
+      break;
+  }
+
+  if ( !found ) 
+    return NULL;
+
+  memcpy (( char * ) name, ( char * ) rName, ( vp->namelen + 2 ) * sizeof ( oid ));
+  *length = vp->namelen + 2;
+  *var_len = sizeof ( long );
+  *write_method = NULL;
+
+  switch ( vp->magic ) {
+
+    case DOT11WEPDEFAULTKEYVALUE:
+//    *write_method = write_dot11WEPDefaultKeyValue;
+      *var_len = strlen ( df->WEPDefaultKeyValue );
+      return ( UCHAR * ) df->WEPDefaultKeyValue;
+
+    default:
+      ERROR_MSG ( "" );
+  }
+
+  return NULL;
+}
+
+/****************************************************************************
+*                                                                           *
+*  var_dot11WEPKeyMappingsTable() -                                         *
+*                                                                           *
+****************************************************************************/
+unsigned char *
+var_dot11WEPKeyMappingsTable ( struct variable *vp,
+                                oid     *name,
+                                size_t  *length,
+                                int     exact,
+                                size_t  *var_len,
+                                WriteMethod **write_method)
+{
+  static char MACWork[17];
+  int found = FALSE;
+  oid rName [ MAX_OID_LEN ];                            // OID to be returned
+
+  loadTables();
+  memcpy (( char * ) rName, ( char * ) vp->name, ( int ) vp->namelen * sizeof ( oid ));
+  for ( np = LIST_FIRST ( &kmList ); np != NULL; np = LIST_NEXT ( np, nodes )) {
+    km = ( struct kmTbl_data * ) np->data;
+    rName[vp->namelen + 0] = km->ifIndex;
+    rName[vp->namelen + 1] = km->WEPKeyMappingIndex;
+    if ((  exact && ( snmp_oid_compare ( rName, vp->namelen + 2, name, *length ) == 0 )) ||
+        ( !exact && ( snmp_oid_compare ( rName, vp->namelen + 2, name, *length ) >  0 ))) {
+      switch ( vp->magic ) {
+        case DOT11WEPKEYMAPPINGADDRESS:
+          if ( km->haveWEPKeyMappingAddress ) found = TRUE; break;
+        case DOT11WEPKEYMAPPINGWEPON:
+          if ( km->haveWEPKeyMappingWEPOn   ) found = TRUE; break;
+        case DOT11WEPKEYMAPPINGVALUE:
+          if ( km->haveWEPKeyMappingValue   ) found = TRUE; break;
+        case DOT11WEPKEYMAPPINGSTATUS:
+          if ( km->haveWEPKeyMappingStatus  ) found = TRUE; break; 
+      }
+    }
+    if ( found )
+      break;
+  }
+
+  if ( !found ) 
+    return NULL;
+
+  memcpy (( char * ) name, ( char * ) rName, ( vp->namelen + 2 ) * sizeof ( oid ));
+  *length = vp->namelen + 2;
+  *var_len = sizeof ( long );
+  *write_method = NULL;
+
+  switch ( vp->magic ) {
+
+    case DOT11WEPKEYMAPPINGADDRESS:
+//    *write_method = write_dot11WEPKeyMappingAddress;
+      MACWork[ 0] = km->WEPKeyMappingAddress[ 0];
+      MACWork[ 1] = km->WEPKeyMappingAddress[ 1];
+      MACWork[ 2] = km->WEPKeyMappingAddress[ 3];
+      MACWork[ 3] = km->WEPKeyMappingAddress[ 4];
+      MACWork[ 4] = km->WEPKeyMappingAddress[ 6];
+      MACWork[ 5] = km->WEPKeyMappingAddress[ 7];
+      MACWork[ 6] = km->WEPKeyMappingAddress[ 9];
+      MACWork[ 7] = km->WEPKeyMappingAddress[10];
+      MACWork[ 8] = km->WEPKeyMappingAddress[12];
+      MACWork[ 9] = km->WEPKeyMappingAddress[13];
+      MACWork[10] = km->WEPKeyMappingAddress[15];
+      MACWork[11] = km->WEPKeyMappingAddress[16];
+      MACWork[12] = '\0';
+      *var_len = 6;
+      return ( UCHAR * ) htob ( MACWork );
+
+    case DOT11WEPKEYMAPPINGWEPON:
+//    *write_method = write_dot11WEPKeyMappingWEPOn;
+      return ( UCHAR * ) &km->WEPKeyMappingWEPOn;
+
+    case DOT11WEPKEYMAPPINGVALUE:
+//    *write_method = write_dot11WEPKeyMappingValue;
+      *var_len = strlen ( km->WEPKeyMappingValue );
+      return ( UCHAR * ) km->WEPKeyMappingValue;
+
+    case DOT11WEPKEYMAPPINGSTATUS:
+//    *write_method = write_dot11WEPKeyMappingStatus;
+      return ( UCHAR * ) &km->WEPKeyMappingStatus;
+
+    default:
+      ERROR_MSG ( "" );
+  }
+  return NULL;
+}
+
+/****************************************************************************
+*                                                                           *
+*   var_dot11PrivacyTable() -                                               *
+*                                                                           *
+****************************************************************************/
+unsigned char *
+var_dot11PrivacyTable ( struct variable *vp,
+                        oid     *name,
+                        size_t  *length,
+                        int     exact,
+                        size_t  *var_len,
+                        WriteMethod **write_method )
+{
+  int found = FALSE;
+  oid rName [ MAX_OID_LEN ];                            // OID to be returned
+
+  loadTables();
+  memcpy (( char * ) rName, ( char * ) vp->name, ( int ) vp->namelen * sizeof ( oid ));
+  for ( np = LIST_FIRST ( &prList ); np != NULL; np = LIST_NEXT ( np, nodes )) {
+    pr = ( struct prTbl_data * ) np->data;
+    rName[vp->namelen] = pr->ifIndex;
+    if ((  exact && ( snmp_oid_compare ( rName, vp->namelen + 1, name, *length ) == 0 )) ||
+        ( !exact && ( snmp_oid_compare ( rName, vp->namelen + 1, name, *length ) >  0 ))) {
+      switch ( vp->magic ) {
+        case DOT11PRIVACYINVOKED:
+          if ( pr->havePrivacyInvoked      ) found = TRUE; break;
+        case DOT11WEPDEFAULTKEYID:
+          if ( pr->haveWEPDefaultKeyID     ) found = TRUE; break;
+        case DOT11WEPKEYMAPPINGLENGTH:
+          if ( pr->haveWEPKeyMappingLength ) found = TRUE; break;
+        case DOT11EXCLUDEUNENCRYPTED:
+          if ( pr->haveExcludeUnencrypted  ) found = TRUE; break;
+        case DOT11WEPICVERRORCOUNT:
+          if ( pr->haveWEPICVErrorCount    ) found = TRUE; break;
+        case DOT11WEPEXCLUDEDCOUNT:
+          if ( pr->haveWEPExcludedCount    ) found = TRUE; break;
+      }      
+    }
+    if ( found )
+      break;
+  }
+
+  if ( !found ) 
+    return NULL;
+
+  memcpy (( char * ) name, ( char * ) rName, ( vp->namelen + 1 ) * sizeof ( oid ));
+  *length = vp->namelen + 1;
+  *var_len = sizeof ( long );
+  *write_method = NULL;
+
+  switch ( vp->magic ) {
+
+    case DOT11PRIVACYINVOKED:
+//    *write_method = write_dot11PrivacyInvoked;
+      return ( UCHAR * ) &pr->privacyInvoked;
+
+    case DOT11WEPDEFAULTKEYID:
+//    *write_method = write_dot11WEPDefaultKeyID;
+      return ( UCHAR * ) &pr->WEPDefaultKeyID;
+
+    case DOT11WEPKEYMAPPINGLENGTH:
+//    *write_method = write_dot11WEPKeyMappingLength;
+      return ( UCHAR * ) &pr->WEPKeyMappingLength;
+
+    case DOT11EXCLUDEUNENCRYPTED:
+//    *write_method = write_dot11ExcludeUnencrypted;
+      return ( UCHAR * ) &pr->excludeUnencrypted;
+
+    case DOT11WEPICVERRORCOUNT:
+      return ( UCHAR * ) &pr->WEPICVErrorCount;
+        
+    case DOT11WEPEXCLUDEDCOUNT:
+      return ( UCHAR * ) &pr->WEPExcludedCount;
+        
+    default:
+      ERROR_MSG ( "" );
+  }
+
+  return NULL;
+}
+
+/****************************************************************************
+*                                                                           *
+*   var_dot11OperationTable() -                                             *
+*                                                                           *
+****************************************************************************/
+unsigned char *
+var_dot11OperationTable ( struct variable *vp,
+                          oid     *name,
+                          size_t  *length,
+                          int     exact,
+                          size_t  *var_len,
+                          WriteMethod **write_method )
+{
+  int found = FALSE;
+  oid rName [ MAX_OID_LEN ];                            // OID to be returned
+  static char MACWork[17];
+
+  loadTables();
+  memcpy (( char * ) rName, ( char * ) vp->name, ( int ) vp->namelen * sizeof ( oid ));
+  for ( np = LIST_FIRST ( &opList ); np != NULL; np = LIST_NEXT ( np, nodes )) {
+    op = ( struct opTbl_data * ) np->data;
+    rName[vp->namelen] = op->ifIndex;
+    if ((  exact && ( snmp_oid_compare ( rName, vp->namelen + 1, name, *length ) == 0 )) ||
+        ( !exact && ( snmp_oid_compare ( rName, vp->namelen + 1, name, *length ) >  0 ))) {
+
+      switch ( vp->magic ) {      // found requested OID, now check for requested variable
+        case DOT11MACADDRESS:             
+          if ( op->haveMACAddress              ) found = TRUE; break;
+        case DOT11RTSTHRESHOLD:           
+          if ( op->haveRTSThreshold            ) found = TRUE; break;
+        case DOT11SHORTRETRYLIMIT: 
+          if ( op->haveShortRetryLimit         ) found = TRUE; break;
+        case DOT11LONGRETRYLIMIT:
+          if ( op->haveLongRetryLimit          ) found = TRUE; break;
+        case DOT11FRAGMENTATIONTHRESHOLD: 
+          if ( op->haveFragmentationThreshold  ) found = TRUE; break;
+        case DOT11MAXTRANSMITMSDULIFETIME: 
+          if ( op->haveMaxTransmitMSDULifetime ) found = TRUE; break;
+        case DOT11MAXRECEIVELIFETIME:
+          if ( op->haveMaxReceiveLifetime      ) found = TRUE; break;
+        case DOT11MANUFACTURERID:
+          if ( op->haveManufacturerID          ) found = TRUE; break;
+        case DOT11PRODUCTID:
+          if ( op->haveProductID               ) found = TRUE; break;
+      }
+    }
+    if ( found ) 
+      break;
+  }
+
+  if ( !found )
+    return NULL;
+
+  memcpy (( char * ) name, ( char * ) rName, ( vp->namelen + 1 ) * sizeof ( oid ));
+  *length = vp->namelen + 1;
+  *var_len = sizeof ( long );
+  *write_method = NULL;
+
+  switch ( vp->magic ) {
+
+    case DOT11MACADDRESS:
+      MACWork[ 0] = op->MACAddress[ 0];
+      MACWork[ 1] = op->MACAddress[ 1];
+      MACWork[ 2] = op->MACAddress[ 3];
+      MACWork[ 3] = op->MACAddress[ 4];
+      MACWork[ 4] = op->MACAddress[ 6];
+      MACWork[ 5] = op->MACAddress[ 7];
+      MACWork[ 6] = op->MACAddress[ 9];
+      MACWork[ 7] = op->MACAddress[10];
+      MACWork[ 8] = op->MACAddress[12];
+      MACWork[ 9] = op->MACAddress[13];
+      MACWork[10] = op->MACAddress[15];
+      MACWork[11] = op->MACAddress[16];
+      MACWork[12] = '\0';
+      *var_len = 6;
+      return ( UCHAR * ) htob ( MACWork );
+        
+    case DOT11RTSTHRESHOLD:
+//    *write_method = write_dot11RTSThreshold;
+      return ( UCHAR * ) &op->RTSThreshold;
+
+    case DOT11SHORTRETRYLIMIT:
+//    *write_method = write_dot11ShortRetryLimit;
+      return ( UCHAR * ) &op->shortRetryLimit;
+
+    case DOT11LONGRETRYLIMIT:
+//    *write_method = write_dot11LongRetryLimit;
+      return ( UCHAR * ) &op->longRetryLimit;
+
+    case DOT11FRAGMENTATIONTHRESHOLD:
+//    *write_method = write_dot11FragmentationThreshold;
+      return ( UCHAR * ) &op->fragmentationThreshold;
+
+    case DOT11MAXTRANSMITMSDULIFETIME:
+//    *write_method = write_dot11MaxTransmitMSDULifetime;
+      return ( UCHAR * ) &op->maxTransmitMSDULifetime;
+
+    case DOT11MAXRECEIVELIFETIME:
+//    *write_method = write_dot11MaxReceiveLifetime;
+      return ( UCHAR * ) &op->maxReceiveLifetime;
+
+    case DOT11MANUFACTURERID:
+      *var_len = strlen ( op->manufacturerID );
+      return ( UCHAR * ) op->manufacturerID;
+
+    case DOT11PRODUCTID:
+      *var_len = strlen ( op->productID );
+      return ( UCHAR * ) op->productID;
+        
+    default:
+      ERROR_MSG ( "" );
+  }
+
+  return NULL;
+}
+
+/****************************************************************************
+*                                                                           *
+*   var_dot11CountersTable() -                                              *
+*                                                                           *
+****************************************************************************/
+unsigned char *
+var_dot11CountersTable(struct variable *vp,
+          oid     *name,
+          size_t  *length,
+          int     exact,
+          size_t  *var_len,
+          WriteMethod **write_method)
+{
+  int found = FALSE;
+  oid rName [ MAX_OID_LEN ];                            // OID to be returned
+
+  loadTables();
+  memcpy (( char * ) rName, ( char * ) vp->name, ( int ) vp->namelen * sizeof ( oid ));
+  for ( np = LIST_FIRST ( &coList ); np != NULL; np = LIST_NEXT ( np, nodes )) {
+    co = ( struct coTbl_data * ) np->data;
+    rName[vp->namelen] = co->ifIndex;
+    if ((  exact && ( snmp_oid_compare ( rName, vp->namelen + 1, name, *length ) == 0 )) ||
+        ( !exact && ( snmp_oid_compare ( rName, vp->namelen + 1, name, *length ) >  0 ))) {
+      switch ( vp->magic ) {
+        case DOT11TRANSMITTEDFRAGMENTCOUNT:
+          if ( co->haveTransmittedFragmentCount    ) found = TRUE; break;
+        case DOT11MULTICASTTRANSMITTEDFRAMECOUNT:
+          if ( co->haveTransmittedFrameCount       ) found = TRUE; break;
+        case DOT11FAILEDCOUNT:
+          if ( co->haveFailedCount                 ) found = TRUE; break;
+        case DOT11RETRYCOUNT:
+          if ( co->haveRetryCount                  ) found = TRUE; break;
+        case DOT11MULTIPLERETRYCOUNT:
+          if ( co->haveMultipleRetryCount          ) found = TRUE; break;
+        case DOT11FRAMEDUPLICATECOUNT:
+          if ( co->haveFrameDuplicateCount         ) found = TRUE; break;
+        case DOT11RTSSUCCESSCOUNT:
+          if ( co->haveRTSSuccessCount             ) found = TRUE; break;
+        case DOT11RTSFAILURECOUNT:
+          if ( co->haveRTSFailureCount             ) found = TRUE; break;
+        case DOT11ACKFAILURECOUNT:
+          if ( co->haveACKFailureCount             ) found = TRUE; break;
+        case DOT11RECEIVEDFRAGMENTCOUNT:
+          if ( co->haveReceivedFragmentCount       ) found = TRUE; break;
+        case DOT11MULTICASTRECEIVEDFRAMECOUNT:
+          if ( co->haveMulticastReceivedFrameCount ) found = TRUE; break;
+        case DOT11FCSERRORCOUNT:
+          if ( co->haveFCSErrorCount               ) found = TRUE; break;
+        case DOT11TRANSMITTEDFRAMECOUNT:
+          if ( co->haveTransmittedFrameCount       ) found = TRUE; break;
+        case DOT11WEPUNDECRYPTABLECOUNT:
+          if ( co->haveWEPUndecryptableCount       ) found = TRUE; break;
+      }
+    }
+    if ( found )
+      break;
+  }
+
+  if ( !found ) 
+    return NULL;
+
+  memcpy (( char * ) name, ( char * ) rName, ( vp->namelen + 1 ) * sizeof ( oid ));
+  *length = vp->namelen + 1;
+  *var_len = sizeof ( long );
+  *write_method = NULL;
+
+  switch ( vp->magic ) {
+
+    case DOT11TRANSMITTEDFRAGMENTCOUNT:       return ( UCHAR * ) &co->transmittedFragmentCount;
+    case DOT11MULTICASTTRANSMITTEDFRAMECOUNT: return ( UCHAR * ) &co->transmittedFrameCount;
+    case DOT11FAILEDCOUNT:                    return ( UCHAR * ) &co->failedCount;
+    case DOT11RETRYCOUNT:                     return ( UCHAR * ) &co->retryCount;
+    case DOT11MULTIPLERETRYCOUNT:             return ( UCHAR * ) &co->multipleRetryCount;
+    case DOT11FRAMEDUPLICATECOUNT:            return ( UCHAR * ) &co->frameDuplicateCount;
+    case DOT11RTSSUCCESSCOUNT:                return ( UCHAR * ) &co->RTSSuccessCount;
+    case DOT11RTSFAILURECOUNT:                return ( UCHAR * ) &co->RTSFailureCount;
+    case DOT11ACKFAILURECOUNT:                return ( UCHAR * ) &co->ACKFailureCount;
+    case DOT11RECEIVEDFRAGMENTCOUNT:          return ( UCHAR * ) &co->receivedFragmentCount;
+    case DOT11MULTICASTRECEIVEDFRAMECOUNT:    return ( UCHAR * ) &co->multicastReceivedFrameCount;
+    case DOT11FCSERRORCOUNT:                  return ( UCHAR * ) &co->FCSErrorCount;
+    case DOT11TRANSMITTEDFRAMECOUNT:          return ( UCHAR * ) &co->transmittedFrameCount;
+    case DOT11WEPUNDECRYPTABLECOUNT:          return ( UCHAR * ) &co->WEPUndecryptableCount;
+        
+    default:
+      ERROR_MSG ( "" );
+  }
+
+  return NULL;
+}
+
+/****************************************************************************
+*                                                                           *
+*   var_dot11GroupAddressesTable() -                                        *
+*                                                                           *
+****************************************************************************/
+unsigned char *
+var_dot11GroupAddressesTable(struct variable *vp,
+          oid     *name,
+          size_t  *length,
+          int     exact,
+          size_t  *var_len,
+          WriteMethod **write_method)
+{
+  static char MACWork[17];
+  int found = FALSE;
+  oid rName [ MAX_OID_LEN ];                            // OID to be returned
+
+  loadTables();
+  memcpy (( char * ) rName, ( char * ) vp->name, ( int ) vp->namelen * sizeof ( oid ));
+  for ( np = LIST_FIRST ( &gaList ); np != NULL; np = LIST_NEXT ( np, nodes )) {
+    ga = ( struct gaTbl_data * ) np->data;
+    rName[vp->namelen + 0] = ga->ifIndex;
+    rName[vp->namelen + 1] = ga->groupAddressesIndex;
+    if ((  exact && ( snmp_oid_compare ( rName, vp->namelen + 2, name, *length ) == 0 )) ||
+        ( !exact && ( snmp_oid_compare ( rName, vp->namelen + 2, name, *length ) >  0 ))) {
+      switch ( vp->magic ) {
+        case DOT11ADDRESS:
+          if ( ga->haveAddress              ) found = TRUE; break;
+        case DOT11GROUPADDRESSESSTATUS:
+          if ( ga->haveGroupAddressesStatus ) found = TRUE; break;
+      }
+    }
+    if ( found )
+      break;
+  }
+
+  if ( !found ) 
+    return NULL;
+
+  memcpy (( char * ) name, ( char * ) rName, ( vp->namelen + 2 ) * sizeof ( oid ));
+  *length = vp->namelen + 2;
+  *var_len = sizeof ( long );
+  *write_method = NULL;
+
+  switch ( vp->magic ) {
+
+    case DOT11ADDRESS:
+//    *write_method = write_dot11Address;
+      MACWork[ 0] = ga->address[ 0];
+      MACWork[ 1] = ga->address[ 1];
+      MACWork[ 2] = ga->address[ 3];
+      MACWork[ 3] = ga->address[ 4];
+      MACWork[ 4] = ga->address[ 6];
+      MACWork[ 5] = ga->address[ 7];
+      MACWork[ 6] = ga->address[ 9];
+      MACWork[ 7] = ga->address[10];
+      MACWork[ 8] = ga->address[12];
+      MACWork[ 9] = ga->address[13];
+      MACWork[10] = ga->address[15];
+      MACWork[11] = ga->address[16];
+      MACWork[12] = '\0';
+      *var_len = 6;
+      return ( UCHAR * ) htob ( MACWork );
+
+    case DOT11GROUPADDRESSESSTATUS:
+//    *write_method = write_dot11GroupAddressesStatus;
+      return ( UCHAR * ) &ga->groupAddressesStatus;
+
+    default:
+      ERROR_MSG ( "" );
+  }
+  return NULL;
+}
+
+/****************************************************************************
+*                                                                           *
+*   var_dot11ResourceInfoTable() -                                          *
+*                                                                           *
+****************************************************************************/
+unsigned char *
+var_dot11ResourceInfoTable ( struct variable *vp,
+                              oid     *name,
+                              size_t  *length,
+                              int     exact,
+                              size_t  *var_len,
+                              WriteMethod **write_method )
+{
+  int found = FALSE;
+  oid rName [ MAX_OID_LEN ];                            // OID to be returned
+
+  loadTables();
+  memcpy (( char * ) rName, ( char * ) vp->name, ( int ) vp->namelen * sizeof ( oid ));
+  for ( np = LIST_FIRST ( &riList ); np != NULL; np = LIST_NEXT ( np, nodes )) {
+    ri = ( struct riTbl_data * ) np->data;
+    rName[vp->namelen] = ri->ifIndex;
+    if ((  exact && ( snmp_oid_compare ( rName, vp->namelen + 1, name, *length ) == 0 )) ||
+        ( !exact && ( snmp_oid_compare ( rName, vp->namelen + 1, name, *length ) >  0 ))) {
+      switch ( vp->magic ) {
+        case DOT11MANUFACTUREROUI:
+          if ( ri->haveManufacturerOUI            ) found = TRUE; break;
+        case DOT11MANUFACTURERNAME:
+          if ( ri->haveManufacturerName           ) found = TRUE; break;
+        case DOT11MANUFACTURERPRODUCTNAME:
+          if ( ri->haveManufacturerProductName    ) found = TRUE; break;
+        case DOT11MANUFACTURERPRODUCTVERSION:
+          if ( ri->haveManufacturerProductVersion ) found = TRUE; break;
+      }
+    }
+    if ( found )
+      break;
+  }
+
+  if ( !found ) 
+    return NULL;
+
+  memcpy (( char * ) name, ( char * ) rName, ( vp->namelen + 1 ) * sizeof ( oid ));
+  *length = vp->namelen + 1;
+  *var_len = sizeof ( long );
+  *write_method = NULL;
+
+  switch ( vp->magic ) {
+
+    case DOT11MANUFACTUREROUI:
+      *var_len = strlen ( ri->manufacturerOUI );
+      return ( UCHAR * ) ri->manufacturerOUI;
+        
+    case DOT11MANUFACTURERNAME:
+      *var_len = strlen ( ri->manufacturerName );
+      return ( UCHAR * ) ri->manufacturerName;
+        
+    case DOT11MANUFACTURERPRODUCTNAME:
+      *var_len = strlen ( ri->manufacturerProductName );
+      return ( UCHAR * ) ri->manufacturerProductName;
+        
+    case DOT11MANUFACTURERPRODUCTVERSION:
+      *var_len = strlen ( ri->manufacturerProductVersion );
+      return ( UCHAR * ) ri->manufacturerProductVersion;
+        
+    default: 
+      ERROR_MSG ( "" );
+  }
+
+  return NULL;
+}
+
+/****************************************************************************
+*                                                                           *
+*   var_dot11PhyOperationTable() -                                          *
+*                                                                           *
+****************************************************************************/
+unsigned char *
+var_dot11PhyOperationTable ( struct variable *vp,
+                              oid     *name,
+                              size_t  *length,
+                              int     exact,
+                              size_t  *var_len,
+                              WriteMethod **write_method )
+{
+  int found = FALSE;
+  oid rName [ MAX_OID_LEN ];                            // OID to be returned
+
+  loadTables();
+  memcpy (( char * ) rName, ( char * ) vp->name, ( int ) vp->namelen * sizeof ( oid ));
+  for ( np = LIST_FIRST ( &poList ); np != NULL; np = LIST_NEXT ( np, nodes )) {
+    po = ( struct poTbl_data * ) np->data;
+    rName[vp->namelen] = po->ifIndex;
+    if ((  exact && ( snmp_oid_compare ( rName, vp->namelen + 1, name, *length ) == 0 )) ||
+        ( !exact && ( snmp_oid_compare ( rName, vp->namelen + 1, name, *length ) >  0 ))) {
+      switch ( vp->magic ) {
+        case DOT11PHYTYPE:
+          if ( po->havePHYType          ) found = TRUE; break;
+        case DOT11CURRENTREGDOMAIN:
+          if ( po->haveCurrentRegDomain ) found = TRUE; break;
+        case DOT11TEMPTYPE:
+          if ( po->haveTempType         ) found = TRUE; break;
+      }
+    }
+    if ( found )
+      break;
+  }
+
+  if ( !found ) 
+    return NULL;
+
+  memcpy (( char * ) name, ( char * ) rName, ( vp->namelen + 1 ) * sizeof ( oid ));
+  *length = vp->namelen + 1;
+  *var_len = sizeof ( long );
+  *write_method = NULL;
+
+  switch ( vp->magic ) {
+
+    case DOT11PHYTYPE:
+      return ( UCHAR * ) &po->PHYType;
+        
+    case DOT11CURRENTREGDOMAIN:
+//    *write_method = write_dot11CurrentRegDomain;
+      return ( UCHAR * ) &po->currentRegDomain;
+
+    case DOT11TEMPTYPE:
+      return ( UCHAR * ) &po->tempType;
+        
+    default:
+      ERROR_MSG ( "" );
+  }
+
+  return NULL;
+}
+
+/****************************************************************************
+*                                                                           *
+*   var_dot11PhyAntennaTable() -                                            *
+*                                                                           *
+****************************************************************************/
+unsigned char *
+var_dot11PhyAntennaTable ( struct variable *vp,
+                            oid     *name,
+                            size_t  *length,
+                            int     exact,
+                            size_t  *var_len,
+                            WriteMethod **write_method )
+{
+  int found = FALSE;
+  oid rName [ MAX_OID_LEN ];                            // OID to be returned
+
+  loadTables();
+  memcpy (( char * ) rName, ( char * ) vp->name, ( int ) vp->namelen * sizeof ( oid ));
+  for ( np = LIST_FIRST ( &paList ); np != NULL; np = LIST_NEXT ( np, nodes )) {
+    pa = ( struct paTbl_data * ) np->data;
+    rName[vp->namelen] = pa->ifIndex;
+    if ((  exact && ( snmp_oid_compare ( rName, vp->namelen + 1, name, *length ) == 0 )) ||
+        ( !exact && ( snmp_oid_compare ( rName, vp->namelen + 1, name, *length ) >  0 ))) {
+      switch ( vp->magic ) {
+        case DOT11CURRENTTXANTENNA:
+          if ( pa->haveCurrentTxAntenna ) found = TRUE; break;
+        case DOT11DIVERSITYSUPPORT:
+          if ( pa->haveDiversitySupport ) found = TRUE; break;
+        case DOT11CURRENTRXANTENNA:
+          if ( pa->haveCurrentRxAntenna ) found = TRUE; break;
+      }
+    }
+    if ( found )
+      break;
+  }
+
+  if ( !found ) 
+    return NULL;
+
+  memcpy (( char * ) name, ( char * ) rName, ( vp->namelen + 1 ) * sizeof ( oid ));
+  *length = vp->namelen + 1;
+  *var_len = sizeof ( long );
+  *write_method = NULL;
+
+  switch ( vp->magic ) {
+
+    case DOT11CURRENTTXANTENNA:
+//    *write_method = write_dot11CurrentTxAntenna;
+      return ( UCHAR * ) &pa->currentTxAntenna;
+
+    case DOT11DIVERSITYSUPPORT:
+      return ( UCHAR * ) &pa->diversitySupport;
+        
+    case DOT11CURRENTRXANTENNA:
+//    *write_method = write_dot11CurrentRxAntenna;
+      return ( UCHAR * ) &pa->currentRxAntenna;
+
+    default:
+      ERROR_MSG ( "" );
+  }
+  return NULL;
+}
+
+/****************************************************************************
+*                                                                           *
+*   var_dot11PhyTxPowerTable() -                                            *
+*                                                                           *
+****************************************************************************/
+unsigned char *
+var_dot11PhyTxPowerTable ( struct variable *vp,
+                            oid     *name,
+                            size_t  *length,
+                            int     exact,
+                            size_t  *var_len,
+                            WriteMethod **write_method )
+{
+  int found = FALSE;
+  oid rName [ MAX_OID_LEN ];                            // OID to be returned
+
+  loadTables();
+  memcpy (( char * ) rName, ( char * ) vp->name, ( int ) vp->namelen * sizeof ( oid ));
+  for ( np = LIST_FIRST ( &ptList ); np != NULL; np = LIST_NEXT ( np, nodes )) {
+    pt = ( struct ptTbl_data * ) np->data;
+    rName[vp->namelen] = pt->ifIndex;
+    if ((  exact && ( snmp_oid_compare ( rName, vp->namelen + 1, name, *length ) == 0 )) ||
+        ( !exact && ( snmp_oid_compare ( rName, vp->namelen + 1, name, *length ) >  0 ))) {
+      switch ( vp->magic ) {
+        case DOT11NUMBERSUPPORTEDPOWERLEVELS:
+          if ( pt->haveNumberSupportedPowerLevels ) found = TRUE; break;
+        case DOT11TXPOWERLEVEL1:
+          if ( pt->haveTxPowerLevel1   ) found = TRUE; break;
+        case DOT11TXPOWERLEVEL2:
+          if ( pt->haveTxPowerLevel2   ) found = TRUE; break;
+        case DOT11TXPOWERLEVEL3:
+          if ( pt->haveTxPowerLevel3   ) found = TRUE; break;
+        case DOT11TXPOWERLEVEL4:
+          if ( pt->haveTxPowerLevel4   ) found = TRUE; break;
+        case DOT11TXPOWERLEVEL5:
+          if ( pt->haveTxPowerLevel5   ) found = TRUE; break;
+        case DOT11TXPOWERLEVEL6:
+          if ( pt->haveTxPowerLevel6   ) found = TRUE; break;
+        case DOT11TXPOWERLEVEL7:
+          if ( pt->haveTxPowerLevel7   ) found = TRUE; break;
+        case DOT11TXPOWERLEVEL8:
+          if ( pt->haveTxPowerLevel8   ) found = TRUE; break;
+        case DOT11CURRENTTXPOWERLEVEL:
+          if ( pt->currentTxPowerLevel ) found = TRUE; break;
+      }
+    }
+    if ( found )
+      break;
+  }
+
+  if ( !found ) 
+    return NULL;
+
+  memcpy (( char * ) name, ( char * ) rName, ( vp->namelen + 1 ) * sizeof ( oid ));
+  *length = vp->namelen + 1;
+  *var_len = sizeof ( long );
+  *write_method = NULL;
+
+  switch ( vp->magic ) {
+
+    case DOT11NUMBERSUPPORTEDPOWERLEVELS: 
+      return ( UCHAR * ) &pt->numberSupportedPowerLevels;
+
+    case DOT11TXPOWERLEVEL1: return ( UCHAR * ) &pt->TxPowerLevel1;
+    case DOT11TXPOWERLEVEL2: return ( UCHAR * ) &pt->TxPowerLevel2;
+    case DOT11TXPOWERLEVEL3: return ( UCHAR * ) &pt->TxPowerLevel3;
+    case DOT11TXPOWERLEVEL4: return ( UCHAR * ) &pt->TxPowerLevel4;
+    case DOT11TXPOWERLEVEL5: return ( UCHAR * ) &pt->TxPowerLevel5;
+    case DOT11TXPOWERLEVEL6: return ( UCHAR * ) &pt->TxPowerLevel6;
+    case DOT11TXPOWERLEVEL7: return ( UCHAR * ) &pt->TxPowerLevel7;
+    case DOT11TXPOWERLEVEL8: return ( UCHAR * ) &pt->TxPowerLevel8;
+        
+    case DOT11CURRENTTXPOWERLEVEL:
+//    *write_method = write_dot11CurrentTxPowerLevel;
+      return ( UCHAR * ) &pt->currentTxPowerLevel;
+
+    default:
+      ERROR_MSG ( "" );
+  }
+
+  return NULL;
+}
+
+/****************************************************************************
+*                                                                           *
+*     var_dot11PhyFHSSTable() -                                             *
+*                                                                           *
+****************************************************************************/
+unsigned char *
+var_dot11PhyFHSSTable ( struct variable *vp,
+                        oid     *name,
+                        size_t  *length,
+                        int     exact,
+                        size_t  *var_len,
+                        WriteMethod **write_method )
+{
+  int found = FALSE;
+  oid rName [ MAX_OID_LEN ];                            // OID to be returned
+
+  loadTables();
+  memcpy (( char * ) rName, ( char * ) vp->name, ( int ) vp->namelen * sizeof ( oid ));
+  for ( np = LIST_FIRST ( &pfList ); np != NULL; np = LIST_NEXT ( np, nodes )) {
+    pf = ( struct pfTbl_data * ) np->data;
+    rName[vp->namelen] = pf->ifIndex;
+    if ((  exact && ( snmp_oid_compare ( rName, vp->namelen + 1, name, *length ) == 0 )) ||
+        ( !exact && ( snmp_oid_compare ( rName, vp->namelen + 1, name, *length ) >  0 ))) {
+      switch ( vp->magic ) {
+        case DOT11HOPTIME:
+          if ( pf->haveHopTime              ) found = TRUE; break;
+        case DOT11CURRENTCHANNELNUMBER:
+          if ( pf->haveCurrentChannelNumber ) found = TRUE; break;
+        case DOT11MAXDWELLTIME:
+          if ( pf->haveMaxDwellTime         ) found = TRUE; break;
+        case DOT11CURRENTDWELLTIME:
+          if ( pf->haveCurrentDwellTime     ) found = TRUE; break;
+        case DOT11CURRENTSET:
+          if ( pf->haveCurrentSet           ) found = TRUE; break;
+        case DOT11CURRENTPATTERN:
+          if ( pf->haveCurrentPattern       ) found = TRUE; break;
+        case DOT11CURRENTINDEX:
+          if ( pf->haveCurrentIndex         ) found = TRUE; break;
+      }
+    }
+    if ( found )
+      break;
+  }
+
+  if ( !found ) 
+    return NULL;
+
+  memcpy (( char * ) name, ( char * ) rName, ( vp->namelen + 1 ) * sizeof ( oid ));
+  *length = vp->namelen + 1;
+  *var_len = sizeof ( long );
+  *write_method = NULL;
+
+  switch ( vp->magic ) {
+
+    case DOT11HOPTIME:
+      return ( UCHAR * ) &pf->hopTime;
+        
+    case DOT11CURRENTCHANNELNUMBER:
+//    *write_method = write_dot11CurrentChannelNumber;
+      return ( UCHAR * ) &pf->currentChannelNumber;
+
+    case DOT11MAXDWELLTIME:
+      return ( UCHAR * ) &pf->maxDwellTime;
+        
+    case DOT11CURRENTDWELLTIME:
+//    *write_method = write_dot11CurrentDwellTime;
+      return ( UCHAR * ) &pf->currentDwellTime;
+
+    case DOT11CURRENTSET:
+//    *write_method = write_dot11CurrentSet;
+      return ( UCHAR * ) &pf->currentSet;
+
+    case DOT11CURRENTPATTERN:
+//    *write_method = write_dot11CurrentPattern;
+      return ( UCHAR * ) &pf->currentPattern;
+
+    case DOT11CURRENTINDEX:
+//    *write_method = write_dot11CurrentIndex;
+      return ( UCHAR * ) &pf->currentIndex;
+
+    default:
+      ERROR_MSG ( "" );
+  }
+
+  return NULL;
+}
+
+/****************************************************************************
+*                                                                           *
+*     var_dot11PhyDSSSTable() -                                             *
+*                                                                           *
+****************************************************************************/
+unsigned char *
+var_dot11PhyDSSSTable ( struct variable *vp,
+                        oid     *name,
+                        size_t  *length,
+                        int     exact,
+                        size_t  *var_len,
+                        WriteMethod **write_method )
+{
+  int found = FALSE;
+  oid rName [ MAX_OID_LEN ];                            // OID to be returned
+
+  loadTables();
+  memcpy (( char * ) rName, ( char * ) vp->name, ( int ) vp->namelen * sizeof ( oid ));
+  for ( np = LIST_FIRST ( &pdList ); np != NULL; np = LIST_NEXT ( np, nodes )) {
+    pd = ( struct pdTbl_data * ) np->data;
+    rName[vp->namelen] = pd->ifIndex;
+    if ((  exact && ( snmp_oid_compare ( rName, vp->namelen + 1, name, *length ) == 0 )) ||
+        ( !exact && ( snmp_oid_compare ( rName, vp->namelen + 1, name, *length ) >  0 ))) {
+      switch ( vp->magic ) {
+        case DOT11CURRENTCHANNEL:
+          if ( pd->haveCurrentChannel   ) found = TRUE; break;
+        case DOT11CCAMODESUPPORTED:
+          if ( pd->haveCCAModeSupported ) found = TRUE; break;
+        case DOT11CURRENTCCAMODE:
+          if ( pd->haveCurrentCCAMode   ) found = TRUE; break;
+        case DOT11EDTHRESHOLD:
+          if ( pd->haveEDThreshold      ) found = TRUE; break;
+      }
+    }
+    if ( found )
+      break;
+  }
+
+  if ( !found ) 
+    return NULL;
+
+  memcpy (( char * ) name, ( char * ) rName, ( vp->namelen + 1 ) * sizeof ( oid ));
+  *length = vp->namelen + 1;
+  *var_len = sizeof ( long );
+  *write_method = NULL;
+
+  switch ( vp->magic ) {
+
+    case DOT11CURRENTCHANNEL:
+//    *write_method = write_dot11CurrentChannel;
+      return ( UCHAR * ) &pd->currentChannel;
+
+    case DOT11CCAMODESUPPORTED:
+      return ( UCHAR * ) &pd->CCAModeSupported;
+        
+    case DOT11CURRENTCCAMODE:
+//    *write_method = write_dot11CurrentCCAMode;
+      return ( UCHAR * ) &pd->currentCCAMode;
+
+    case DOT11EDTHRESHOLD:
+//    *write_method = write_dot11EDThreshold;
+      return ( UCHAR * ) &pd->EDThreshold;
+
+    default:
+      ERROR_MSG ( "" );
+  }
+
+  return NULL;
+}
+
+/****************************************************************************
+*                                                                           *
+*     var_dot11PhyIRTable() -                                             *
+*                                                                           *
+****************************************************************************/
+unsigned char *
+var_dot11PhyIRTable ( struct variable *vp,
+                      oid     *name,
+                      size_t  *length,
+                      int     exact,
+                      size_t  *var_len,
+                      WriteMethod **write_method)
+{
+
+  int found = FALSE;
+  oid rName [ MAX_OID_LEN ];                            // OID to be returned
+
+  loadTables();
+  memcpy (( char * ) rName, ( char * ) vp->name, ( int ) vp->namelen * sizeof ( oid ));
+  for ( np = LIST_FIRST ( &piList ); np != NULL; np = LIST_NEXT ( np, nodes )) {
+    pi = ( struct piTbl_data * ) np->data;
+    rName[vp->namelen] = pi->ifIndex;
+    if ((  exact && ( snmp_oid_compare ( rName, vp->namelen + 1, name, *length ) == 0 )) ||
+        ( !exact && ( snmp_oid_compare ( rName, vp->namelen + 1, name, *length ) >  0 ))) {
+      switch ( vp->magic ) {
+        case DOT11CCAWATCHDOGTIMERMAX:
+          if ( pi->CCAWatchdogTimerMax ) found = TRUE; break;
+        case DOT11CCAWATCHDOGCOUNTMAX:
+          if ( pi->CCAWatchdogCountMax ) found = TRUE; break;
+        case DOT11CCAWATCHDOGTIMERMIN:
+          if ( pi->CCAWatchdogTimerMin ) found = TRUE; break;
+        case DOT11CCAWATCHDOGCOUNTMIN:
+          if ( pi->CCAWatchdogCountMin ) found = TRUE; break;
+      }
+    }
+    if ( found )
+      break;
+  }
+
+  if ( !found ) 
+    return NULL;
+
+  memcpy (( char * ) name, ( char * ) rName, ( vp->namelen + 1 ) * sizeof ( oid ));
+  *length = vp->namelen + 1;
+  *var_len = sizeof ( long );
+  *write_method = NULL;
+
+  switch ( vp->magic ) {
+
+    case DOT11CCAWATCHDOGTIMERMAX:
+//    *write_method = write_dot11CCAWatchdogTimerMax;
+      return ( UCHAR * ) &pi->CCAWatchdogTimerMax;
+
+    case DOT11CCAWATCHDOGCOUNTMAX:
+//   *write_method = write_dot11CCAWatchdogCountMax;
+      return ( UCHAR * ) &pi->CCAWatchdogCountMax;
+
+    case DOT11CCAWATCHDOGTIMERMIN:
+//    *write_method = write_dot11CCAWatchdogTimerMin;
+      return ( UCHAR * ) &pi->CCAWatchdogTimerMin;
+
+    case DOT11CCAWATCHDOGCOUNTMIN:
+//    *write_method = write_dot11CCAWatchdogCountMin;
+      return ( UCHAR * ) &pi->CCAWatchdogCountMin;
+
+    default:
+      ERROR_MSG ( "" );
+  }
+
+  return NULL;
+}
+
+/****************************************************************************
+*                                                                           *
+*     var_dot11RegDomainsSupportedTable() -                                 *
+*                                                                           *
+****************************************************************************/
+unsigned char *
+var_dot11RegDomainsSupportedTable ( struct variable *vp,
+                                    oid     *name,
+                                    size_t  *length,
+                                    int     exact,
+                                    size_t  *var_len,
+                                    WriteMethod **write_method)
+{
+  int found = FALSE;
+  oid rName [ MAX_OID_LEN ];                            // OID to be returned
+
+  loadTables();
+  memcpy (( char * ) rName, ( char * ) vp->name, ( int ) vp->namelen * sizeof ( oid ));
+  for ( np = LIST_FIRST ( &rdList ); np != NULL; np = LIST_NEXT ( np, nodes )) {
+    rd = ( struct rdTbl_data * ) np->data;
+    rName[vp->namelen + 0] = rd->ifIndex;
+    rName[vp->namelen + 1] = rd->regDomainsSupportIndex;
+    if ((  exact && ( snmp_oid_compare ( rName, vp->namelen + 2, name, *length ) == 0 )) ||
+        ( !exact && ( snmp_oid_compare ( rName, vp->namelen + 2, name, *length ) >  0 ))) {
+      switch ( vp->magic ) {
+        case DOT11REGDOMAINSSUPPORTVALUE:
+          if ( rd->haveRegDomainsSupportValue ) found = TRUE; break;
+      }
+    }
+    if ( found )
+      break;
+  }
+
+  if ( !found ) 
+    return NULL;
+
+  memcpy (( char * ) name, ( char * ) rName, ( vp->namelen + 2 ) * sizeof ( oid ));
+  *length = vp->namelen + 2;
+  *var_len = sizeof ( long );
+  *write_method = NULL;
+
+  switch ( vp->magic ) {
+
+    case DOT11REGDOMAINSSUPPORTVALUE:
+      return ( UCHAR * ) &rd->regDomainsSupportValue;
+        
+    default:
+      ERROR_MSG ( "" );
+  }
+
+  return NULL;
+}
+
+/****************************************************************************
+*                                                                           *
+*     var_dot11AntennasListTable() -                                        *
+*                                                                           *
+****************************************************************************/
+unsigned char *
+var_dot11AntennasListTable(struct variable *vp,
+          oid     *name,
+          size_t  *length,
+          int     exact,
+          size_t  *var_len,
+          WriteMethod **write_method)
+{
+  int found = FALSE;
+  oid rName [ MAX_OID_LEN ];                            // OID to be returned
+
+  loadTables();
+  memcpy (( char * ) rName, ( char * ) vp->name, ( int ) vp->namelen * sizeof ( oid ));
+  for ( np = LIST_FIRST ( &alList ); np != NULL; np = LIST_NEXT ( np, nodes )) {
+    al = ( struct alTbl_data * ) np->data;
+    rName[vp->namelen + 0] = al->ifIndex;
+    rName[vp->namelen + 1] = al->antennaListIndex;
+    if ((  exact && ( snmp_oid_compare ( rName, vp->namelen + 2, name, *length ) == 0 )) ||
+        ( !exact && ( snmp_oid_compare ( rName, vp->namelen + 2, name, *length ) >  0 ))) {
+      switch ( vp->magic ) {
+        case DOT11SUPPORTEDTXANTENNA:
+          if ( al->haveSupportedTxAntenna   ) found = TRUE; break;
+        case DOT11SUPPORTEDRXANTENNA:
+          if ( al->haveSupportedRxAntenna   ) found = TRUE; break;
+        case DOT11DIVERSITYSELECTIONRX:
+          if ( al->haveDiversitySelectionRx ) found = TRUE; break;
+      }
+    }
+    if ( found )
+      break;
+  }
+
+  if ( !found ) 
+    return NULL;
+
+  memcpy (( char * ) name, ( char * ) rName, ( vp->namelen + 2 ) * sizeof ( oid ));
+  *length = vp->namelen + 2;
+  *var_len = sizeof ( long );
+  *write_method = NULL;
+
+  switch ( vp->magic ) {
+
+    case DOT11SUPPORTEDTXANTENNA:
+//    *write_method = write_dot11SupportedTxAntenna;
+      return ( UCHAR * ) &al->supportedTxAntenna;
+
+    case DOT11SUPPORTEDRXANTENNA:
+//    *write_method = write_dot11SupportedRxAntenna;
+      return ( UCHAR * ) &al->supportedRxAntenna;
+
+    case DOT11DIVERSITYSELECTIONRX:
+//    *write_method = write_dot11DiversitySelectionRx;
+      return ( UCHAR * ) &al->diversitySelectionRx;
+
+    default:
+      ERROR_MSG ( "" );
+  }
+
+  return NULL;
+}
+
+/****************************************************************************
+*                                                                           *
+*     var_dot11SupportedDataRatesTxTable() -                                *
+*                                                                           *
+****************************************************************************/
+unsigned char *
+var_dot11SupportedDataRatesTxTable ( struct variable *vp,
+                                      oid     *name,
+                                      size_t  *length,
+                                      int     exact,
+                                      size_t  *var_len,
+                                      WriteMethod **write_method )
+{
+  int found = FALSE;
+  oid rName [ MAX_OID_LEN ];                            // OID to be returned
+
+  loadTables();
+  memcpy (( char * ) rName, ( char * ) vp->name, ( int ) vp->namelen * sizeof ( oid ));
+  for ( np = LIST_FIRST ( &rtList ); np != NULL; np = LIST_NEXT ( np, nodes )) {
+    rt = ( struct rtTbl_data * ) np->data;
+    rName[vp->namelen + 0] = rt->ifIndex;
+    rName[vp->namelen + 1] = rt->supportedDataRatesTxIndex;
+    if ((  exact && ( snmp_oid_compare ( rName, vp->namelen + 2, name, *length ) == 0 )) ||
+        ( !exact && ( snmp_oid_compare ( rName, vp->namelen + 2, name, *length ) >  0 ))) {
+      switch ( vp->magic ) {
+         case DOT11SUPPORTEDDATARATESTXVALUE:
+          if ( rt->haveSupportedDataRatesTxValue ) found = TRUE; break;
+      }
+    }
+    if ( found )
+      break;
+  }
+
+  if ( !found ) 
+    return NULL;
+
+  memcpy (( char * ) name, ( char * ) rName, ( vp->namelen + 2 ) * sizeof ( oid ));
+  *length = vp->namelen + 2;
+  *var_len = sizeof ( long );
+  *write_method = NULL;
+
+  switch ( vp->magic ) {
+
+    case DOT11SUPPORTEDDATARATESTXVALUE:
+      return ( UCHAR * ) &rt->supportedDataRatesTxValue;
+        
+    default:
+      ERROR_MSG ( "" );
+  }
+
+  return NULL;
+}
+
+/****************************************************************************
+*                                                                           *
+*     var_dot11SupportedDataRatesRxTable() -                                *
+*                                                                           *
+****************************************************************************/
+unsigned char *
+var_dot11SupportedDataRatesRxTable ( struct variable *vp,
+                                      oid     *name,
+                                      size_t  *length,
+                                      int     exact,
+                                      size_t  *var_len,
+                                      WriteMethod **write_method )
+{
+  int found = FALSE;
+  oid rName [ MAX_OID_LEN ];                            // OID to be returned
+
+  loadTables();
+  memcpy (( char * ) rName, ( char * ) vp->name, ( int ) vp->namelen * sizeof ( oid ));
+  for ( np = LIST_FIRST ( &rrList ); np != NULL; np = LIST_NEXT ( np, nodes )) {
+    rr = ( struct rrTbl_data * ) np->data;
+    rName[vp->namelen + 0] = rr->ifIndex;
+    rName[vp->namelen + 1] = rr->supportedDataRatesRxIndex;
+    if ((  exact && ( snmp_oid_compare ( rName, vp->namelen + 2, name, *length ) == 0 )) ||
+        ( !exact && ( snmp_oid_compare ( rName, vp->namelen + 2, name, *length ) >  0 ))) {
+      switch ( vp->magic ) {
+        case DOT11SUPPORTEDDATARATESRXVALUE:
+          if ( rr->haveSupportedDataRatesRxValue ) found = TRUE; break;
+      }
+    }
+    if ( found )
+      break;
+  }
+
+  if ( !found ) 
+    return NULL;
+
+  memcpy (( char * ) name, ( char * ) rName, ( vp->namelen + 2 ) * sizeof ( oid ));
+  *length = vp->namelen + 2;
+  *var_len = sizeof ( long );
+  *write_method = NULL;
+
+  switch ( vp->magic ) {
+
+    case DOT11SUPPORTEDDATARATESRXVALUE:
+      return ( UCHAR * ) &rr->supportedDataRatesRxValue;
+        
+    default:
+      ERROR_MSG ( "" );
+  }
+
+  return NULL;
+}
+
+/****************************************************************************
+*                                                                           *
+****************************************************************************/
+int
+write_dot11StationID(int      action,
+            u_char   *var_val,
+            u_char   var_val_type,
+            size_t   var_val_len,
+            u_char   *statP,
+            oid      *name,
+            size_t   name_len)
+{
+  static unsigned char string[SPRINT_MAX_LEN];
+  int size;
+
+  switch ( action ) {
+
+    case RESERVE1:
+      if ( var_val_type != ASN_OCTET_STR ) {
+        fprintf ( stderr, "write to dot11StationID not ASN_OCTET_STR\n" );
+        return SNMP_ERR_WRONGTYPE;
+      }
+      if ( var_val_len > sizeof ( string )) {
+        fprintf ( stderr,"write to dot11StationID: bad length\n" );
+        return SNMP_ERR_WRONGLENGTH;
+      }
+      break;
+
+    case RESERVE2:
+    case FREE:
+    case ACTION:
+    case UNDO:
+      break;
+
+    case COMMIT:
+      break;
+  }
+
+  return SNMP_ERR_NOERROR;
+}
+
+/****************************************************************************
+*                                                                           *
+****************************************************************************/
+int
+write_dot11MediumOccupancyLimit(int      action,
+            u_char   *var_val,
+            u_char   var_val_type,
+            size_t   var_val_len,
+            u_char   *statP,
+            oid      *name,
+            size_t   name_len)
+{
+  static long *long_ret;
+  int size;
+
+  switch ( action ) {
+
+    case RESERVE1:
+      if ( var_val_type != ASN_INTEGER ) {
+        fprintf ( stderr, "write to dot11MediumOccupancyLimit not ASN_INTEGER\n" );
+        return SNMP_ERR_WRONGTYPE;
+      }
+      if ( var_val_len > sizeof ( long_ret )){
+        fprintf ( stderr,"write to dot11MediumOccupancyLimit: bad length\n" );
+        return SNMP_ERR_WRONGLENGTH;
+      }
+      break;
+
+    case RESERVE2:
+    case FREE:
+    case ACTION:
+    case UNDO:
+      break;
+
+    case COMMIT:
+      break;
+  }
+
+  return SNMP_ERR_NOERROR;
+}
+
+/****************************************************************************
+*                                                                           *
+****************************************************************************/
+int
+write_dot11CFPPeriod(int      action,
+            u_char   *var_val,
+            u_char   var_val_type,
+            size_t   var_val_len,
+            u_char   *statP,
+            oid      *name,
+            size_t   name_len)
+{
+  static long *long_ret;
+  int size;
+
+  switch ( action ) {
+
+    case RESERVE1:
+      if ( var_val_type != ASN_INTEGER ) {
+        fprintf ( stderr, "write to dot11CFPPeriod not ASN_INTEGER\n" );
+        return SNMP_ERR_WRONGTYPE;
+      }
+      if ( var_val_len > sizeof ( long_ret )){
+        fprintf ( stderr, "write to dot11CFPPeriod: bad length\n" );
+        return SNMP_ERR_WRONGLENGTH;
+      }
+      break;
+
+    case RESERVE2:
+    case FREE:
+    case ACTION:
+    case UNDO:
+      break;
+
+    case COMMIT:
+      break;
+  }
+
+  return SNMP_ERR_NOERROR;
+}
+
+/****************************************************************************
+*                                                                           *
+****************************************************************************/
+int
+write_dot11CFPMaxDuration(int      action,
+            u_char   *var_val,
+            u_char   var_val_type,
+            size_t   var_val_len,
+            u_char   *statP,
+            oid      *name,
+            size_t   name_len)
+{
+  static long *long_ret;
+  int size;
+
+  switch ( action ) {
+
+    case RESERVE1:
+      if ( var_val_type != ASN_INTEGER ) {
+        fprintf ( stderr, "write to dot11CFPMaxDuration not ASN_INTEGER\n" );
+        return SNMP_ERR_WRONGTYPE;
+      }
+      if ( var_val_len > sizeof ( long_ret )){
+        fprintf ( stderr, "write to dot11CFPMaxDuration: bad length\n" );
+        return SNMP_ERR_WRONGLENGTH;
+      }
+      break;
+
+    case RESERVE2:
+    case FREE:
+    case ACTION:
+    case UNDO:
+      break;
+
+    case COMMIT:
+      break;
+  }
+
+  return SNMP_ERR_NOERROR;
+}
+
+/****************************************************************************
+*                                                                           *
+****************************************************************************/
+int
+write_dot11AuthenticationResponseTimeOut(int      action,
+            u_char   *var_val,
+            u_char   var_val_type,
+            size_t   var_val_len,
+            u_char   *statP,
+            oid      *name,
+            size_t   name_len)
+{
+  static long *long_ret;
+  int size;
+
+  switch ( action ) {
+
+    case RESERVE1:
+      if ( var_val_type != ASN_INTEGER ) {
+        fprintf ( stderr, "write to dot11AuthenticationResponseTimeOut not ASN_INTEGER\n" );
+        return SNMP_ERR_WRONGTYPE;
+      }
+      if ( var_val_len > sizeof ( long_ret )){
+        fprintf ( stderr, "write to dot11AuthenticationResponseTimeOut: bad length\n" );
+        return SNMP_ERR_WRONGLENGTH;
+      }
+      break;
+
+    case RESERVE2:
+    case FREE:
+    case ACTION:
+    case UNDO:
+      break;
+
+    case COMMIT:
+      break;
+  }
+
+  return SNMP_ERR_NOERROR;
+}
+
+/****************************************************************************
+*                                                                           *
+****************************************************************************/
+int
+write_dot11PowerManagementMode(int      action,
+            u_char   *var_val,
+            u_char   var_val_type,
+            size_t   var_val_len,
+            u_char   *statP,
+            oid      *name,
+            size_t   name_len)
+{
+  static long *long_ret;
+  int size;
+
+  switch ( action ) {
+
+    case RESERVE1:
+      if ( var_val_type != ASN_INTEGER ) {
+        fprintf ( stderr, "write to dot11PowerManagementMode not ASN_INTEGER\n" );
+        return SNMP_ERR_WRONGTYPE;
+      }
+      if ( var_val_len > sizeof ( long_ret )) {
+        fprintf ( stderr, "write to dot11PowerManagementMode: bad length\n" );
+        return SNMP_ERR_WRONGLENGTH;
+      }
+      break;
+
+    case RESERVE2:
+    case FREE:
+    case ACTION:
+    case UNDO:
+      break;
+
+    case COMMIT:
+      break;
+  }
+
+  return SNMP_ERR_NOERROR;
+}
+
+/****************************************************************************
+*                                                                           *
+****************************************************************************/
+int
+write_dot11DesiredSSID(int      action,
+            u_char   *var_val,
+            u_char   var_val_type,
+            size_t   var_val_len,
+            u_char   *statP,
+            oid      *name,
+            size_t   name_len)
+{
+  static unsigned char string[SPRINT_MAX_LEN];
+  int size;
+
+  switch ( action ) {
+
+    case RESERVE1:
+      if ( var_val_type != ASN_OCTET_STR ) {
+        fprintf ( stderr, "write to dot11DesiredSSID not ASN_OCTET_STR\n" );
+        return SNMP_ERR_WRONGTYPE;
+      }
+      if ( var_val_len > sizeof ( string )){
+        fprintf ( stderr, "write to dot11DesiredSSID: bad length\n" );
+        return SNMP_ERR_WRONGLENGTH;
+      }
+      break;
+
+    case RESERVE2:
+    case FREE:
+    case ACTION:
+    case UNDO:
+      break;
+
+    case COMMIT:
+      break;
+  }
+
+  return SNMP_ERR_NOERROR;
+}
+
+/****************************************************************************
+*                                                                           *
+****************************************************************************/
+int
+write_dot11DesiredBSSType(int      action,
+            u_char   *var_val,
+            u_char   var_val_type,
+            size_t   var_val_len,
+            u_char   *statP,
+            oid      *name,
+            size_t   name_len)
+{
+  static long *long_ret;
+  int size;
+
+  switch ( action ) {
+
+    case RESERVE1:
+      if ( var_val_type != ASN_INTEGER ) {
+        fprintf ( stderr, "write to dot11DesiredBSSType not ASN_INTEGER\n" );
+        return SNMP_ERR_WRONGTYPE;
+      }
+      if ( var_val_len > sizeof ( long_ret )){
+        fprintf ( stderr, "write to dot11DesiredBSSType: bad length\n" );
+        return SNMP_ERR_WRONGLENGTH;
+      }
+      break;
+
+    case RESERVE2:
+    case FREE:
+    case ACTION:
+    case UNDO:
+      break;
+
+    case COMMIT:
+      break;
+  }
+
+  return SNMP_ERR_NOERROR;
+}
+
+/****************************************************************************
+*                                                                           *
+****************************************************************************/
+int
+write_dot11OperationalRateSet(int      action,
+            u_char   *var_val,
+            u_char   var_val_type,
+            size_t   var_val_len,
+            u_char   *statP,
+            oid      *name,
+            size_t   name_len)
+{
+  static unsigned char string[SPRINT_MAX_LEN];
+  int size;
+
+  switch ( action ) {
+
+    case RESERVE1:
+      if ( var_val_type != ASN_OCTET_STR ) {
+        fprintf ( stderr, "write to dot11OperationalRateSet not ASN_OCTET_STR\n" );
+        return SNMP_ERR_WRONGTYPE;
+      }
+      if ( var_val_len > sizeof ( string )){
+        fprintf ( stderr, "write to dot11OperationalRateSet: bad length\n" );
+        return SNMP_ERR_WRONGLENGTH;
+      }
+      break;
+
+    case RESERVE2:
+    case FREE:
+    case ACTION:
+    case UNDO:
+      break;
+
+    case COMMIT:
+      break;
+  }
+
+  return SNMP_ERR_NOERROR;
+}
+
+/****************************************************************************
+*                                                                           *
+****************************************************************************/
+int
+write_dot11BeaconPeriod(int      action,
+            u_char   *var_val,
+            u_char   var_val_type,
+            size_t   var_val_len,
+            u_char   *statP,
+            oid      *name,
+            size_t   name_len)
+{
+  static long *long_ret;
+  int size;
+
+  switch ( action ) {
+
+    case RESERVE1:
+      if ( var_val_type != ASN_INTEGER ) {
+        fprintf ( stderr, "write to dot11BeaconPeriod not ASN_INTEGER\n" );
+        return SNMP_ERR_WRONGTYPE;
+      }
+      if ( var_val_len > sizeof ( long_ret )){
+        fprintf ( stderr,"write to dot11BeaconPeriod: bad length\n" );
+        return SNMP_ERR_WRONGLENGTH;
+      }
+      break;
+
+    case RESERVE2:
+    case FREE:
+    case ACTION:
+    case UNDO:
+      break;
+
+    case COMMIT:
+      break;
+  }
+
+  return SNMP_ERR_NOERROR;
+}
+
+/****************************************************************************
+*                                                                           *
+****************************************************************************/
+int
+write_dot11DTIMPeriod(int      action,
+            u_char   *var_val,
+            u_char   var_val_type,
+            size_t   var_val_len,
+            u_char   *statP,
+            oid      *name,
+            size_t   name_len)
+{
+  static long *long_ret;
+  int size;
+
+  switch ( action ) {
+
+    case RESERVE1:
+      if ( var_val_type != ASN_INTEGER ) {
+        fprintf ( stderr, "write to dot11DTIMPeriod not ASN_INTEGER\n" );
+        return SNMP_ERR_WRONGTYPE;
+      }
+      if ( var_val_len > sizeof ( long_ret )){
+        fprintf ( stderr,"write to dot11DTIMPeriod: bad length\n" );
+        return SNMP_ERR_WRONGLENGTH;
+      }
+      break;
+
+    case RESERVE2:
+    case FREE:
+    case ACTION:
+    case UNDO:
+      break;
+
+    case COMMIT:
+      break;
+  }
+
+  return SNMP_ERR_NOERROR;
+}
+
+/****************************************************************************
+*                                                                           *
+****************************************************************************/
+int
+write_dot11AssociationResponseTimeOut(int      action,
+            u_char   *var_val,
+            u_char   var_val_type,
+            size_t   var_val_len,
+            u_char   *statP,
+            oid      *name,
+            size_t   name_len)
+{
+  static long *long_ret;
+  int size;
+
+  switch ( action ) {
+
+    case RESERVE1:
+      if ( var_val_type != ASN_INTEGER ) {
+        fprintf ( stderr, "write to dot11AssociationResponseTimeOut not ASN_INTEGER\n" );
+        return SNMP_ERR_WRONGTYPE;
+      }
+      if ( var_val_len > sizeof ( long_ret )) {
+        fprintf ( stderr,"write to dot11AssociationResponseTimeOut: bad length\n" );
+        return SNMP_ERR_WRONGLENGTH;
+      }
+      break;
+
+    case RESERVE2:
+    case FREE:
+    case ACTION:
+    case UNDO:
+      break;
+
+    case COMMIT:
+      break;
+  }
+
+  return SNMP_ERR_NOERROR;
+}
+
+/****************************************************************************
+*                                                                           *
+****************************************************************************/
+int
+write_dot11AuthenticationAlgorithmsEnable(int      action,
+            u_char   *var_val,
+            u_char   var_val_type,
+            size_t   var_val_len,
+            u_char   *statP,
+            oid      *name,
+            size_t   name_len)
+{
+  static long *long_ret;
+  int size;
+
+  switch ( action ) {
+
+    case RESERVE1:
+      if ( var_val_type != ASN_INTEGER ) {
+        fprintf ( stderr, "write to dot11AuthenticationAlgorithmsEnable not ASN_INTEGER\n" );
+        return SNMP_ERR_WRONGTYPE;
+      }
+      if ( var_val_len > sizeof ( long_ret )){
+        fprintf ( stderr,"write to dot11AuthenticationAlgorithmsEnable: bad length\n" );
+        return SNMP_ERR_WRONGLENGTH;
+      }
+      break;
+
+    case RESERVE2:
+    case FREE:
+    case ACTION:
+    case UNDO:
+      break;
+
+    case COMMIT:
+      break;
+  }
+
+  return SNMP_ERR_NOERROR;
+}
+
+/****************************************************************************
+*                                                                           *
+****************************************************************************/
+int
+write_dot11WEPDefaultKeyValue(int      action,
+            u_char   *var_val,
+            u_char   var_val_type,
+            size_t   var_val_len,
+            u_char   *statP,
+            oid      *name,
+            size_t   name_len)
+{
+  static unsigned char string[SPRINT_MAX_LEN];
+  int size;
+
+  switch ( action ) {
+
+    case RESERVE1:
+      if ( var_val_type != ASN_OCTET_STR ) {
+        fprintf ( stderr, "write to dot11WEPDefaultKeyValue not ASN_OCTET_STR\n" );
+        return SNMP_ERR_WRONGTYPE;
+      }
+      if ( var_val_len > sizeof ( string )){
+        fprintf ( stderr,"write to dot11WEPDefaultKeyValue: bad length\n" );
+        return SNMP_ERR_WRONGLENGTH;
+      }
+      break;
+
+    case RESERVE2:
+    case FREE:
+    case ACTION:
+    case UNDO:
+      break;
+
+    case COMMIT:
+      break;
+  }
+
+  return SNMP_ERR_NOERROR;
+}
+
+/****************************************************************************
+*                                                                           *
+****************************************************************************/
+int
+write_dot11WEPKeyMappingAddress(int      action,
+            u_char   *var_val,
+            u_char   var_val_type,
+            size_t   var_val_len,
+            u_char   *statP,
+            oid      *name,
+            size_t   name_len)
+{
+  static unsigned char string[SPRINT_MAX_LEN];
+  int size;
+
+  switch ( action ) {
+
+    case RESERVE1:
+      if ( var_val_type != ASN_OCTET_STR ) {
+        fprintf ( stderr, "write to dot11WEPKeyMappingAddress not ASN_OCTET_STR\n" );
+        return SNMP_ERR_WRONGTYPE;
+      }
+      if ( var_val_len > sizeof ( string )) {
+        fprintf ( stderr,"write to dot11WEPKeyMappingAddress: bad length\n" );
+        return SNMP_ERR_WRONGLENGTH;
+      }
+      break;
+
+    case RESERVE2:
+    case FREE:
+    case ACTION:
+    case UNDO:
+      break;
+
+    case COMMIT:
+      break;
+  }
+
+  return SNMP_ERR_NOERROR;
+}
+
+/****************************************************************************
+*                                                                           *
+****************************************************************************/
+int
+write_dot11WEPKeyMappingWEPOn(int      action,
+            u_char   *var_val,
+            u_char   var_val_type,
+            size_t   var_val_len,
+            u_char   *statP,
+            oid      *name,
+            size_t   name_len)
+{
+  static long *long_ret;
+  int size;
+
+  switch ( action ) {
+
+    case RESERVE1:
+      if ( var_val_type != ASN_INTEGER ) {
+        fprintf ( stderr, "write to dot11WEPKeyMappingWEPOn not ASN_INTEGER\n" );
+        return SNMP_ERR_WRONGTYPE;
+      }
+      if ( var_val_len > sizeof ( long_ret )){
+        fprintf ( stderr, "write to dot11WEPKeyMappingWEPOn: bad length\n" );
+        return SNMP_ERR_WRONGLENGTH;
+      }
+      break;
+
+    case RESERVE2:
+    case FREE:
+    case ACTION:
+    case UNDO:
+      break;
+
+    case COMMIT:
+      break;
+  }
+
+  return SNMP_ERR_NOERROR;
+}
+
+/****************************************************************************
+*                                                                           *
+****************************************************************************/
+int
+write_dot11WEPKeyMappingValue(int      action,
+            u_char   *var_val,
+            u_char   var_val_type,
+            size_t   var_val_len,
+            u_char   *statP,
+            oid      *name,
+            size_t   name_len)
+{
+  static unsigned char string[SPRINT_MAX_LEN];
+  int size;
+
+  switch ( action ) {
+
+    case RESERVE1:
+      if ( var_val_type != ASN_OCTET_STR ) {
+        fprintf ( stderr, "write to dot11WEPKeyMappingValue not ASN_OCTET_STR\n" );
+        return SNMP_ERR_WRONGTYPE;
+      }
+      if ( var_val_len > sizeof ( string )) {
+        fprintf ( stderr, "write to dot11WEPKeyMappingValue: bad length\n" );
+        return SNMP_ERR_WRONGLENGTH;
+      }
+      break;
+
+    case RESERVE2:
+    case FREE:
+    case ACTION:
+    case UNDO:
+      break;
+
+    case COMMIT:
+      break;
+  }
+
+  return SNMP_ERR_NOERROR;
+}
+
+/****************************************************************************
+*                                                                           *
+****************************************************************************/
+int
+write_dot11WEPKeyMappingStatus(int      action,
+            u_char   *var_val,
+            u_char   var_val_type,
+            size_t   var_val_len,
+            u_char   *statP,
+            oid      *name,
+            size_t   name_len)
+{
+  static long *long_ret;
+  int size;
+
+  switch ( action ) {
+    case RESERVE1:
+      if ( var_val_type != ASN_INTEGER ) {
+        fprintf ( stderr, "write to dot11WEPKeyMappingStatus not ASN_INTEGER\n" );
+        return SNMP_ERR_WRONGTYPE;
+      }
+      if ( var_val_len > sizeof ( long_ret )){
+        fprintf ( stderr, "write to dot11WEPKeyMappingStatus: bad length\n" );
+        return SNMP_ERR_WRONGLENGTH;
+      }
+      break;
+
+    case RESERVE2:
+    case FREE:
+    case ACTION:
+    case UNDO:
+      break;
+
+    case COMMIT:
+      break;
+  }
+
+  return SNMP_ERR_NOERROR;
+}
+
+/****************************************************************************
+*                                                                           *
+****************************************************************************/
+int
+write_dot11PrivacyInvoked(int      action,
+            u_char   *var_val,
+            u_char   var_val_type,
+            size_t   var_val_len,
+            u_char   *statP,
+            oid      *name,
+            size_t   name_len)
+{
+  static long *long_ret;
+  int size;
+
+  switch ( action ) {
+
+    case RESERVE1:
+      if ( var_val_type != ASN_INTEGER ) {
+        fprintf ( stderr, "write to dot11PrivacyInvoked not ASN_INTEGER\n" );
+        return SNMP_ERR_WRONGTYPE;
+      }
+      if ( var_val_len > sizeof ( long_ret )){
+        fprintf ( stderr, "write to dot11PrivacyInvoked: bad length\n" );
+        return SNMP_ERR_WRONGLENGTH;
+      }
+      break;
+
+    case RESERVE2:
+    case FREE:
+    case ACTION:
+    case UNDO:
+      break;
+
+    case COMMIT:
+      break;
+  }
+
+  return SNMP_ERR_NOERROR;
+}
+
+/****************************************************************************
+*                                                                           *
+****************************************************************************/
+int
+write_dot11WEPDefaultKeyID(int      action,
+            u_char   *var_val,
+            u_char   var_val_type,
+            size_t   var_val_len,
+            u_char   *statP,
+            oid      *name,
+            size_t   name_len)
+{
+  static long *long_ret;
+  int size;
+
+  switch ( action ) {
+
+    case RESERVE1:
+      if ( var_val_type != ASN_INTEGER ) {
+        fprintf ( stderr, "write to dot11WEPDefaultKeyID not ASN_INTEGER\n" );
+        return SNMP_ERR_WRONGTYPE;
+      }
+      if ( var_val_len > sizeof ( long_ret )){
+        fprintf ( stderr, "write to dot11WEPDefaultKeyID: bad length\n" );
+        return SNMP_ERR_WRONGLENGTH;
+      }
+      break;
+
+    case RESERVE2:
+    case FREE:
+    case ACTION:
+    case UNDO:
+      break;
+
+    case COMMIT:
+      break;
+  }
+
+  return SNMP_ERR_NOERROR;
+}
+
+/****************************************************************************
+*                                                                           *
+****************************************************************************/
+int
+write_dot11WEPKeyMappingLength(int      action,
+            u_char   *var_val,
+            u_char   var_val_type,
+            size_t   var_val_len,
+            u_char   *statP,
+            oid      *name,
+            size_t   name_len)
+{
+  static long *long_ret;
+  int size;
+
+  switch ( action ) {
+
+    case RESERVE1:
+      if ( var_val_type != ASN_INTEGER ) {
+        fprintf ( stderr, "write to dot11WEPKeyMappingLength not ASN_INTEGER\n" );
+        return SNMP_ERR_WRONGTYPE;
+      }
+      if ( var_val_len > sizeof ( long_ret )){
+        fprintf ( stderr, "write to dot11WEPKeyMappingLength: bad length\n" );
+        return SNMP_ERR_WRONGLENGTH;
+      }
+      break;
+
+    case RESERVE2:
+    case FREE:
+    case ACTION:
+    case UNDO:
+      break;
+
+    case COMMIT:
+      break;
+  }
+
+  return SNMP_ERR_NOERROR;
+}
+
+/****************************************************************************
+*                                                                           *
+****************************************************************************/
+int
+write_dot11ExcludeUnencrypted(int      action,
+            u_char   *var_val,
+            u_char   var_val_type,
+            size_t   var_val_len,
+            u_char   *statP,
+            oid      *name,
+            size_t   name_len)
+{
+  static long *long_ret;
+  int size;
+
+  switch ( action ) {
+
+    case RESERVE1:
+      if ( var_val_type != ASN_INTEGER ) {
+        fprintf ( stderr, "write to dot11ExcludeUnencrypted not ASN_INTEGER\n" );
+        return SNMP_ERR_WRONGTYPE;
+      }
+      if ( var_val_len > sizeof ( long_ret )){
+        fprintf ( stderr,"write to dot11ExcludeUnencrypted: bad length\n" );
+        return SNMP_ERR_WRONGLENGTH;
+      }
+      break;
+
+    case RESERVE2:
+    case FREE:
+    case ACTION:
+    case UNDO:
+      break;
+
+    case COMMIT:
+      break;
+  }
+
+  return SNMP_ERR_NOERROR;
+}
+
+/****************************************************************************
+*                                                                           *
+****************************************************************************/
+int
+write_dot11RTSThreshold(int      action,
+            u_char   *var_val,
+            u_char   var_val_type,
+            size_t   var_val_len,
+            u_char   *statP,
+            oid      *name,
+            size_t   name_len)
+{
+  static long *long_ret;
+  int size;
+
+  switch ( action ) {
+
+    case RESERVE1:
+      if ( var_val_type != ASN_INTEGER ){
+        fprintf ( stderr, "write to dot11RTSThreshold not ASN_INTEGER\n" );
+        return SNMP_ERR_WRONGTYPE;
+      }
+      if ( var_val_len > sizeof ( long_ret )){
+        fprintf ( stderr, "write to dot11RTSThreshold: bad length\n" );
+        return SNMP_ERR_WRONGLENGTH;
+      }
+      break;
+
+    case RESERVE2:
+    case FREE:
+    case ACTION:
+    case UNDO:
+      break;
+
+    case COMMIT:
+      break;
+  }
+
+  return SNMP_ERR_NOERROR;
+}
+
+/****************************************************************************
+*                                                                           *
+****************************************************************************/
+int
+write_dot11ShortRetryLimit(int      action,
+            u_char   *var_val,
+            u_char   var_val_type,
+            size_t   var_val_len,
+            u_char   *statP,
+            oid      *name,
+            size_t   name_len)
+{
+  static long *long_ret;
+  int size;
+
+  switch ( action ) {
+
+    case RESERVE1:
+      if ( var_val_type != ASN_INTEGER ) {
+        fprintf ( stderr, "write to dot11ShortRetryLimit not ASN_INTEGER\n" );
+        return SNMP_ERR_WRONGTYPE;
+      }
+      if ( var_val_len > sizeof ( long_ret )){
+        fprintf ( stderr, "write to dot11ShortRetryLimit: bad length\n" );
+        return SNMP_ERR_WRONGLENGTH;
+      }
+      break;
+
+    case RESERVE2:
+    case FREE:
+    case ACTION:
+    case UNDO:
+      break;
+
+    case COMMIT:
+      break;
+  }
+
+  return SNMP_ERR_NOERROR;
+}
+
+/****************************************************************************
+*                                                                           *
+****************************************************************************/
+int
+write_dot11LongRetryLimit(int      action,
+            u_char   *var_val,
+            u_char   var_val_type,
+            size_t   var_val_len,
+            u_char   *statP,
+            oid      *name,
+            size_t   name_len)
+{
+  static long *long_ret;
+  int size;
+
+  switch ( action ) {
+
+    case RESERVE1:
+      if ( var_val_type != ASN_INTEGER ) {
+        fprintf ( stderr, "write to dot11LongRetryLimit not ASN_INTEGER\n" );
+        return SNMP_ERR_WRONGTYPE;
+      }
+      if ( var_val_len > sizeof ( long_ret )){
+        fprintf ( stderr,"write to dot11LongRetryLimit: bad length\n" );
+        return SNMP_ERR_WRONGLENGTH;
+      }
+      break;
+
+    case RESERVE2:
+    case FREE:
+    case ACTION:
+    case UNDO:
+      break;
+
+    case COMMIT:
+      break;
+  }
+
+  return SNMP_ERR_NOERROR;
+}
+
+/****************************************************************************
+*                                                                           *
+****************************************************************************/
+int
+write_dot11FragmentationThreshold(int      action,
+            u_char   *var_val,
+            u_char   var_val_type,
+            size_t   var_val_len,
+            u_char   *statP,
+            oid      *name,
+            size_t   name_len)
+{
+  static long *long_ret;
+  int size;
+
+  switch ( action ) {
+
+    case RESERVE1:
+      if ( var_val_type != ASN_INTEGER ) {
+        fprintf ( stderr, "write to dot11FragmentationThreshold not ASN_INTEGER\n" );
+        return SNMP_ERR_WRONGTYPE;
+      }
+      if ( var_val_len > sizeof ( long_ret )){
+        fprintf ( stderr,"write to dot11FragmentationThreshold: bad length\n" );
+        return SNMP_ERR_WRONGLENGTH;
+      }
+      break;
+
+    case RESERVE2:
+    case FREE:
+    case ACTION:
+    case UNDO:
+      break;
+
+    case COMMIT:
+      break;
+  }
+
+  return SNMP_ERR_NOERROR;
+}
+
+/****************************************************************************
+*                                                                           *
+****************************************************************************/
+int
+write_dot11MaxTransmitMSDULifetime(int      action,
+            u_char   *var_val,
+            u_char   var_val_type,
+            size_t   var_val_len,
+            u_char   *statP,
+            oid      *name,
+            size_t   name_len)
+{
+  static long *long_ret;
+  int size;
+
+  switch ( action ) {
+
+    case RESERVE1:
+      if ( var_val_type != ASN_INTEGER ) {
+        fprintf ( stderr, "write to dot11MaxTransmitMSDULifetime not ASN_INTEGER\n" );
+        return SNMP_ERR_WRONGTYPE;
+      }
+      if ( var_val_len > sizeof ( long_ret )){
+        fprintf ( stderr, "write to dot11MaxTransmitMSDULifetime: bad length\n" );
+        return SNMP_ERR_WRONGLENGTH;
+      }
+      break;
+
+    case RESERVE2:
+    case FREE:
+    case ACTION:
+    case UNDO:
+      break;
+
+    case COMMIT:
+
+      break;
+  }
+
+  return SNMP_ERR_NOERROR;
+}
+
+/****************************************************************************
+*                                                                           *
+****************************************************************************/
+int
+write_dot11MaxReceiveLifetime(int      action,
+            u_char   *var_val,
+            u_char   var_val_type,
+            size_t   var_val_len,
+            u_char   *statP,
+            oid      *name,
+            size_t   name_len)
+{
+  static long *long_ret;
+  int size;
+
+  switch ( action ) {
+
+    case RESERVE1:
+      if ( var_val_type != ASN_INTEGER ) {
+        fprintf ( stderr, "write to dot11MaxReceiveLifetime not ASN_INTEGER\n" );
+        return SNMP_ERR_WRONGTYPE;
+      }
+      if ( var_val_len > sizeof ( long_ret )){
+        fprintf ( stderr, "write to dot11MaxReceiveLifetime: bad length\n" );
+        return SNMP_ERR_WRONGLENGTH;
+      }
+      break;
+
+    case RESERVE2:
+    case FREE:
+    case ACTION:
+    case UNDO:
+      break;
+
+    case COMMIT:
+      break;
+  }
+
+  return SNMP_ERR_NOERROR;
+}
+
+/****************************************************************************
+*                                                                           *
+****************************************************************************/
+int
+write_dot11Address(int      action,
+            u_char   *var_val,
+            u_char   var_val_type,
+            size_t   var_val_len,
+            u_char   *statP,
+            oid      *name,
+            size_t   name_len)
+{
+  static unsigned char string[SPRINT_MAX_LEN];
+  int size;
+
+  switch ( action ) {
+
+    case RESERVE1:
+      if ( var_val_type != ASN_OCTET_STR ) {
+        fprintf ( stderr, "write to dot11Address not ASN_OCTET_STR\n" );
+        return SNMP_ERR_WRONGTYPE;
+      }
+      if ( var_val_len > sizeof ( string )){
+        fprintf ( stderr, "write to dot11Address: bad length\n" );
+        return SNMP_ERR_WRONGLENGTH;
+      }
+      break;
+
+    case RESERVE2:
+    case FREE:
+    case ACTION:
+    case UNDO:
+      break;
+
+    case COMMIT:
+      break;
+  }
+
+  return SNMP_ERR_NOERROR;
+}
+
+/****************************************************************************
+*                                                                           *
+****************************************************************************/
+int
+write_dot11GroupAddressesStatus(int      action,
+            u_char   *var_val,
+            u_char   var_val_type,
+            size_t   var_val_len,
+            u_char   *statP,
+            oid      *name,
+            size_t   name_len)
+{
+  static long *long_ret;
+  int size;
+
+  switch ( action ) {
+
+    case RESERVE1:
+      if ( var_val_type != ASN_INTEGER ) {
+        fprintf ( stderr, "write to dot11GroupAddressesStatus not ASN_INTEGER\n" );
+        return SNMP_ERR_WRONGTYPE;
+      }
+      if ( var_val_len > sizeof ( long_ret )){
+        fprintf ( stderr,"write to dot11GroupAddressesStatus: bad length\n" );
+        return SNMP_ERR_WRONGLENGTH;
+      }
+      break;
+
+    case RESERVE2:
+    case FREE:
+    case ACTION:
+    case UNDO:
+      break;
+
+    case COMMIT:
+      break;
+  }
+
+  return SNMP_ERR_NOERROR;
+}
+
+/****************************************************************************
+*                                                                           *
+****************************************************************************/
+int
+write_dot11CurrentRegDomain(int      action,
+            u_char   *var_val,
+            u_char   var_val_type,
+            size_t   var_val_len,
+            u_char   *statP,
+            oid      *name,
+            size_t   name_len)
+{
+  static long *long_ret;
+  int size;
+
+  switch ( action ) {
+
+    case RESERVE1:
+      if ( var_val_type != ASN_INTEGER ) {
+        fprintf ( stderr, "write to dot11CurrentRegDomain not ASN_INTEGER\n" );
+        return SNMP_ERR_WRONGTYPE;
+      }
+      if ( var_val_len > sizeof ( long_ret )){
+        fprintf ( stderr, "write to dot11CurrentRegDomain: bad length\n" );
+        return SNMP_ERR_WRONGLENGTH;
+      }
+      break;
+
+    case RESERVE2:
+    case FREE:
+    case ACTION:
+    case UNDO:
+      break;
+
+    case COMMIT:
+      break;
+  }
+
+  return SNMP_ERR_NOERROR;
+}
+
+/****************************************************************************
+*                                                                           *
+****************************************************************************/
+int
+write_dot11CurrentTxAntenna(int      action,
+            u_char   *var_val,
+            u_char   var_val_type,
+            size_t   var_val_len,
+            u_char   *statP,
+            oid      *name,
+            size_t   name_len)
+{
+  static long *long_ret;
+  int size;
+
+  switch ( action ) {
+
+    case RESERVE1:
+      if ( var_val_type != ASN_INTEGER ) {
+        fprintf ( stderr, "write to dot11CurrentTxAntenna not ASN_INTEGER\n" );
+        return SNMP_ERR_WRONGTYPE;
+      }
+      if ( var_val_len > sizeof ( long_ret )){
+        fprintf ( stderr, "write to dot11CurrentTxAntenna: bad length\n" );
+        return SNMP_ERR_WRONGLENGTH;
+      }
+      break;
+
+    case RESERVE2:
+    case FREE:
+    case ACTION:
+    case UNDO:
+      break;
+
+    case COMMIT:
+      break;
+  }
+
+  return SNMP_ERR_NOERROR;
+}
+
+/****************************************************************************
+*                                                                           *
+****************************************************************************/
+int
+write_dot11CurrentRxAntenna(int      action,
+            u_char   *var_val,
+            u_char   var_val_type,
+            size_t   var_val_len,
+            u_char   *statP,
+            oid      *name,
+            size_t   name_len)
+{
+  static long *long_ret;
+  int size;
+
+  switch ( action ) {
+
+    case RESERVE1:
+      if ( var_val_type != ASN_INTEGER ) {
+        fprintf ( stderr, "write to dot11CurrentRxAntenna not ASN_INTEGER\n" );
+        return SNMP_ERR_WRONGTYPE;
+      }
+      if ( var_val_len > sizeof ( long_ret )){
+        fprintf ( stderr,"write to dot11CurrentRxAntenna: bad length\n" );
+        return SNMP_ERR_WRONGLENGTH;
+      }
+      break;
+
+    case RESERVE2:
+    case FREE:
+    case ACTION:
+    case UNDO:
+      break;
+
+    case COMMIT:
+      break;
+
+  }
+
+  return SNMP_ERR_NOERROR;
+}
+
+/****************************************************************************
+*                                                                           *
+****************************************************************************/
+int
+write_dot11CurrentTxPowerLevel(int      action,
+            u_char   *var_val,
+            u_char   var_val_type,
+            size_t   var_val_len,
+            u_char   *statP,
+            oid      *name,
+            size_t   name_len)
+{
+  static long *long_ret;
+  int size;
+
+  switch ( action ) {
+
+    case RESERVE1:
+      if ( var_val_type != ASN_INTEGER ) {
+        fprintf ( stderr, "write to dot11CurrentTxPowerLevel not ASN_INTEGER\n" );
+        return SNMP_ERR_WRONGTYPE;
+      }
+      if ( var_val_len > sizeof ( long_ret )){
+        fprintf ( stderr, "write to dot11CurrentTxPowerLevel: bad length\n" );
+        return SNMP_ERR_WRONGLENGTH;
+      }
+      break;
+
+    case RESERVE2:
+    case FREE:
+    case ACTION:
+    case UNDO:
+      break;
+
+    case COMMIT:
+      break;
+  }
+
+  return SNMP_ERR_NOERROR;
+}
+
+/****************************************************************************
+*                                                                           *
+****************************************************************************/
+int
+write_dot11CurrentChannelNumber(int      action,
+            u_char   *var_val,
+            u_char   var_val_type,
+            size_t   var_val_len,
+            u_char   *statP,
+            oid      *name,
+            size_t   name_len)
+{
+  static long *long_ret;
+  int size;
+
+  switch ( action ) {
+
+    case RESERVE1:
+      if ( var_val_type != ASN_INTEGER ) {
+        fprintf ( stderr, "write to dot11CurrentChannelNumber not ASN_INTEGER\n" );
+        return SNMP_ERR_WRONGTYPE;
+      }
+      if ( var_val_len > sizeof ( long_ret )){
+        fprintf ( stderr,"write to dot11CurrentChannelNumber: bad length\n" );
+        return SNMP_ERR_WRONGLENGTH;
+      }
+      break;
+
+    case RESERVE2:
+    case FREE:
+    case ACTION:
+    case UNDO:
+      break;
+
+    case COMMIT:
+      break;
+  }
+
+  return SNMP_ERR_NOERROR;
+}
+
+/****************************************************************************
+*                                                                           *
+****************************************************************************/
+int
+write_dot11CurrentDwellTime(int      action,
+            u_char   *var_val,
+            u_char   var_val_type,
+            size_t   var_val_len,
+            u_char   *statP,
+            oid      *name,
+            size_t   name_len)
+{
+  static long *long_ret;
+  int size;
+
+  switch ( action ) {
+
+    case RESERVE1:
+      if ( var_val_type != ASN_INTEGER ) {
+        fprintf ( stderr, "write to dot11CurrentDwellTime not ASN_INTEGER\n" );
+        return SNMP_ERR_WRONGTYPE;
+      }
+      if ( var_val_len > sizeof ( long_ret )){
+        fprintf ( stderr, "write to dot11CurrentDwellTime: bad length\n" );
+        return SNMP_ERR_WRONGLENGTH;
+      }
+      break;
+
+    case RESERVE2:
+    case FREE:
+    case ACTION:
+    case UNDO:
+      break;
+
+    case COMMIT:
+      break;
+  }
+
+  return SNMP_ERR_NOERROR;
+}
+
+/****************************************************************************
+*                                                                           *
+****************************************************************************/
+int
+write_dot11CurrentSet(int      action,
+            u_char   *var_val,
+            u_char   var_val_type,
+            size_t   var_val_len,
+            u_char   *statP,
+            oid      *name,
+            size_t   name_len)
+{
+  static long *long_ret;
+  int size;
+
+  switch ( action ) {
+
+    case RESERVE1:
+      if ( var_val_type != ASN_INTEGER ) {
+        fprintf ( stderr, "write to dot11CurrentSet not ASN_INTEGER\n" );
+        return SNMP_ERR_WRONGTYPE;
+      }
+      if ( var_val_len > sizeof ( long_ret )){
+        fprintf ( stderr, "write to dot11CurrentSet: bad length\n" );
+        return SNMP_ERR_WRONGLENGTH;
+      }
+      break;
+
+    case RESERVE2:
+    case FREE:
+    case ACTION:
+    case UNDO:
+      break;
+
+    case COMMIT:
+      break;
+  }
+
+  return SNMP_ERR_NOERROR;
+}
+
+/****************************************************************************
+*                                                                           *
+****************************************************************************/
+int
+write_dot11CurrentPattern(int      action,
+            u_char   *var_val,
+            u_char   var_val_type,
+            size_t   var_val_len,
+            u_char   *statP,
+            oid      *name,
+            size_t   name_len)
+{
+  static long *long_ret;
+  int size;
+
+  switch ( action ) {
+
+    case RESERVE1:
+      if ( var_val_type != ASN_INTEGER ) {
+        fprintf ( stderr, "write to dot11CurrentPattern not ASN_INTEGER\n" );
+        return SNMP_ERR_WRONGTYPE;
+      }
+      if ( var_val_len > sizeof ( long_ret )){
+        fprintf ( stderr, "write to dot11CurrentPattern: bad length\n" );
+        return SNMP_ERR_WRONGLENGTH;
+      }
+      break;
+
+    case RESERVE2:
+    case FREE:
+    case ACTION:
+    case UNDO:
+      break;
+
+    case COMMIT:
+      break;
+  }
+
+  return SNMP_ERR_NOERROR;
+}
+
+/****************************************************************************
+*                                                                           *
+****************************************************************************/
+int
+write_dot11CurrentIndex(int      action,
+            u_char   *var_val,
+            u_char   var_val_type,
+            size_t   var_val_len,
+            u_char   *statP,
+            oid      *name,
+            size_t   name_len)
+{
+  static long *long_ret;
+  int size;
+
+  switch ( action ) {
+
+    case RESERVE1:
+      if ( var_val_type != ASN_INTEGER ) {
+        fprintf ( stderr, "write to dot11CurrentIndex not ASN_INTEGER\n" );
+        return SNMP_ERR_WRONGTYPE;
+      }
+      if ( var_val_len > sizeof ( long_ret )){
+        fprintf ( stderr, "write to dot11CurrentIndex: bad length\n" );
+        return SNMP_ERR_WRONGLENGTH;
+      }
+      break;
+
+    case RESERVE2:
+    case FREE:
+    case ACTION:
+    case UNDO:
+      break;
+
+    case COMMIT:
+      break;
+  }
+
+  return SNMP_ERR_NOERROR;
+}
+
+/****************************************************************************
+*                                                                           *
+****************************************************************************/
+int
+write_dot11CurrentChannel(int      action,
+            u_char   *var_val,
+            u_char   var_val_type,
+            size_t   var_val_len,
+            u_char   *statP,
+            oid      *name,
+            size_t   name_len)
+{
+  static long *long_ret;
+  int size;
+
+  switch ( action ) {
+
+    case RESERVE1:
+      if ( var_val_type != ASN_INTEGER ) {
+        fprintf ( stderr, "write to dot11CurrentChannel not ASN_INTEGER\n" );
+        return SNMP_ERR_WRONGTYPE;
+      }
+      if ( var_val_len > sizeof ( long_ret )){
+        fprintf ( stderr, "write to dot11CurrentChannel: bad length\n" );
+        return SNMP_ERR_WRONGLENGTH;
+      }
+      break;
+
+    case RESERVE2:
+    case FREE:
+    case ACTION:
+    case UNDO:
+      break;
+
+    case COMMIT:
+      break;
+  }
+
+  return SNMP_ERR_NOERROR;
+}
+
+/****************************************************************************
+*                                                                           *
+****************************************************************************/
+int
+write_dot11CurrentCCAMode(int      action,
+            u_char   *var_val,
+            u_char   var_val_type,
+            size_t   var_val_len,
+            u_char   *statP,
+            oid      *name,
+            size_t   name_len)
+{
+  static long *long_ret;
+  int size;
+
+  switch ( action ) {
+
+    case RESERVE1:
+      if ( var_val_type != ASN_INTEGER ) {
+        fprintf ( stderr, "write to dot11CurrentCCAMode not ASN_INTEGER\n" );
+        return SNMP_ERR_WRONGTYPE;
+      }
+      if ( var_val_len > sizeof ( long_ret )){
+        fprintf ( stderr,"write to dot11CurrentCCAMode: bad length\n" );
+        return SNMP_ERR_WRONGLENGTH;
+      }
+      break;
+
+    case RESERVE2:
+    case FREE:
+    case ACTION:
+    case UNDO:
+      break;
+
+    case COMMIT:
+      break;
+  }
+
+  return SNMP_ERR_NOERROR;
+}
+
+/****************************************************************************
+*                                                                           *
+****************************************************************************/
+int
+write_dot11EDThreshold(int      action,
+            u_char   *var_val,
+            u_char   var_val_type,
+            size_t   var_val_len,
+            u_char   *statP,
+            oid      *name,
+            size_t   name_len)
+{
+  static long *long_ret;
+  int size;
+
+  switch ( action ) {
+
+    case RESERVE1:
+      if ( var_val_type != ASN_INTEGER ) {
+        fprintf ( stderr, "write to dot11EDThreshold not ASN_INTEGER\n" );
+        return SNMP_ERR_WRONGTYPE;
+      }
+      if ( var_val_len > sizeof ( long_ret )){
+        fprintf ( stderr, "write to dot11EDThreshold: bad length\n" );
+        return SNMP_ERR_WRONGLENGTH;
+      }
+      break;
+
+    case RESERVE2:
+    case FREE:
+    case ACTION:
+    case UNDO:
+      break;
+
+    case COMMIT:
+      break;
+  }
+
+  return SNMP_ERR_NOERROR;
+}
+
+/****************************************************************************
+*                                                                           *
+****************************************************************************/
+int
+write_dot11CCAWatchdogTimerMax(int      action,
+            u_char   *var_val,
+            u_char   var_val_type,
+            size_t   var_val_len,
+            u_char   *statP,
+            oid      *name,
+            size_t   name_len)
+{
+  static long *long_ret;
+  int size;
+
+  switch ( action ) {
+
+    case RESERVE1:
+      if ( var_val_type != ASN_INTEGER ) {
+        fprintf ( stderr, "write to dot11CCAWatchdogTimerMax not ASN_INTEGER\n" );
+        return SNMP_ERR_WRONGTYPE;
+      }
+      if ( var_val_len > sizeof ( long_ret )){
+        fprintf ( stderr, "write to dot11CCAWatchdogTimerMax: bad length\n" );
+        return SNMP_ERR_WRONGLENGTH;
+      }
+      break;
+
+    case RESERVE2:
+    case FREE:
+    case ACTION:
+    case UNDO:
+      break;
+
+    case COMMIT:
+      break;
+  }
+
+  return SNMP_ERR_NOERROR;
+}
+
+/****************************************************************************
+*                                                                           *
+****************************************************************************/
+int
+write_dot11CCAWatchdogCountMax(int      action,
+            u_char   *var_val,
+            u_char   var_val_type,
+            size_t   var_val_len,
+            u_char   *statP,
+            oid      *name,
+            size_t   name_len)
+{
+  static long *long_ret;
+  int size;
+
+  switch ( action ) {
+
+    case RESERVE1:
+      if ( var_val_type != ASN_INTEGER ) {
+        fprintf ( stderr, "write to dot11CCAWatchdogCountMax not ASN_INTEGER\n" );
+        return SNMP_ERR_WRONGTYPE;
+      }
+      if ( var_val_len > sizeof ( long_ret )){
+        fprintf ( stderr, "write to dot11CCAWatchdogCountMax: bad length\n" );
+        return SNMP_ERR_WRONGLENGTH;
+      }
+      break;
+
+    case RESERVE2:
+    case FREE:
+    case ACTION:
+    case UNDO:
+      break;
+
+    case COMMIT:
+      break;
+  }
+
+  return SNMP_ERR_NOERROR;
+}
+
+/****************************************************************************
+*                                                                           *
+****************************************************************************/
+int
+write_dot11CCAWatchdogTimerMin(int      action,
+            u_char   *var_val,
+            u_char   var_val_type,
+            size_t   var_val_len,
+            u_char   *statP,
+            oid      *name,
+            size_t   name_len)
+{
+  static long *long_ret;
+  int size;
+
+  switch ( action ) {
+
+    case RESERVE1:
+      if ( var_val_type != ASN_INTEGER ) {
+        fprintf ( stderr, "write to dot11CCAWatchdogTimerMin not ASN_INTEGER\n" );
+        return SNMP_ERR_WRONGTYPE;
+      }
+      if ( var_val_len > sizeof ( long_ret )){
+        fprintf ( stderr, "write to dot11CCAWatchdogTimerMin: bad length\n" );
+        return SNMP_ERR_WRONGLENGTH;
+      }
+      break;
+
+    case RESERVE2:
+    case FREE:
+    case ACTION:
+    case UNDO:
+      break;
+
+    case COMMIT:
+      break;
+  }
+
+  return SNMP_ERR_NOERROR;
+}
+
+/****************************************************************************
+*                                                                           *
+****************************************************************************/
+int
+write_dot11CCAWatchdogCountMin(int      action,
+            u_char   *var_val,
+            u_char   var_val_type,
+            size_t   var_val_len,
+            u_char   *statP,
+            oid      *name,
+            size_t   name_len)
+{
+  static long *long_ret;
+  int size;
+
+  switch ( action ) {
+
+    case RESERVE1:
+      if ( var_val_type != ASN_INTEGER ) {
+        fprintf ( stderr, "write to dot11CCAWatchdogCountMin not ASN_INTEGER\n" );
+        return SNMP_ERR_WRONGTYPE;
+      }
+      if ( var_val_len > sizeof ( long_ret )){
+        fprintf ( stderr, "write to dot11CCAWatchdogCountMin: bad length\n" );
+        return SNMP_ERR_WRONGLENGTH;
+      }
+      break;
+
+    case RESERVE2:
+    case FREE:
+    case ACTION:
+    case UNDO:
+      break;
+
+    case COMMIT:
+      break;
+  }
+
+  return SNMP_ERR_NOERROR;
+}
+
+/****************************************************************************
+*                                                                           *
+****************************************************************************/
+int
+write_dot11SupportedTxAntenna(int      action,
+            u_char   *var_val,
+            u_char   var_val_type,
+            size_t   var_val_len,
+            u_char   *statP,
+            oid      *name,
+            size_t   name_len)
+{
+  static long *long_ret;
+  int size;
+
+  switch ( action ) {
+
+    case RESERVE1:
+      if ( var_val_type != ASN_INTEGER ) {
+        fprintf ( stderr, "write to dot11SupportedTxAntenna not ASN_INTEGER\n" );
+        return SNMP_ERR_WRONGTYPE;
+      }
+      if ( var_val_len > sizeof ( long_ret )){
+        fprintf ( stderr, "write to dot11SupportedTxAntenna: bad length\n" );
+        return SNMP_ERR_WRONGLENGTH;
+      }
+      break;
+
+    case RESERVE2:
+    case FREE:
+    case ACTION:
+    case UNDO:
+      break;
+
+    case COMMIT:
+      break;
+  }
+
+  return SNMP_ERR_NOERROR;
+}
+
+/****************************************************************************
+*                                                                           *
+****************************************************************************/
+int
+write_dot11SupportedRxAntenna(int      action,
+            u_char   *var_val,
+            u_char   var_val_type,
+            size_t   var_val_len,
+            u_char   *statP,
+            oid      *name,
+            size_t   name_len)
+{
+  static long *long_ret;
+  int size;
+
+  switch ( action ) {
+
+    case RESERVE1:
+      if ( var_val_type != ASN_INTEGER ) {
+        fprintf ( stderr, "write to dot11SupportedRxAntenna not ASN_INTEGER\n" );
+        return SNMP_ERR_WRONGTYPE;
+      }
+      if ( var_val_len > sizeof ( long_ret )){
+        fprintf ( stderr,"write to dot11SupportedRxAntenna: bad length\n" );
+        return SNMP_ERR_WRONGLENGTH;
+      }
+      break;
+
+    case RESERVE2:
+    case FREE:
+    case ACTION:
+    case UNDO:
+      break;
+
+    case COMMIT:
+      break;
+  }
+
+  return SNMP_ERR_NOERROR;
+}
+
+/****************************************************************************
+*                                                                           *
+****************************************************************************/
+int
+write_dot11DiversitySelectionRx(int      action,
+            u_char   *var_val,
+            u_char   var_val_type,
+            size_t   var_val_len,
+            u_char   *statP,
+            oid      *name,
+            size_t   name_len)
+{
+  static long *long_ret;
+  int size;
+
+  switch ( action ) {
+
+    case RESERVE1:
+      if ( var_val_type != ASN_INTEGER ) {
+        fprintf ( stderr, "write to dot11DiversitySelectionRx not ASN_INTEGER\n" );
+        return SNMP_ERR_WRONGTYPE;
+      }
+      if ( var_val_len > sizeof ( long_ret )){
+        fprintf ( stderr, "write to dot11DiversitySelectionRx: bad length\n" );
+        return SNMP_ERR_WRONGLENGTH;
+      }
+      break;
+
+    case RESERVE2:
+    case FREE:
+    case ACTION:
+    case UNDO:
+      break;
+
+    case COMMIT:
+      break;
+  }
+
+  return SNMP_ERR_NOERROR;
+}
+
+/****************************************************************************
+*                                                                           *
+*                      loadTables() - Load the Tables                       *
+*                                                                           *
+****************************************************************************/
+static void loadTables()
+{
+  int skfd;                               // generic raw socket desc
+  struct iwreq wrq;                       // ioctl request structure
+  struct ifreq ifr;
+  struct timeval et;                      // elapsed time
+  struct wireless_info info;              // workarea for wireless ioctl information
+  FILE *fp;
+  char  bfr[1024], ifName[1024];
+  char *s, *t;
+
+  gettimeofday ( &et, ( struct timezone * ) 0 );  // get time-of-day
+  if ( et.tv_sec < lastLoad + MINLOADFREQ )       // only reload so often
+    return;
+  lastLoad = et.tv_sec;
+
+  skfd = openSocket();                            // open socket
+  if ( skfd < 0 ) {
+    syslog ( LOG_ERR, "SNMP ieee802dot11.loadTables() - %s\n", "socket open failure" );
+    return;
+  }
+
+  flushLists();
+
+  // find interfaces in /proc/net/dev and find the wireless interfaces
+  fp = fopen ( PROC_NET_DEV, "r" );
+  if ( fp ) {
+    while ( fgets ( bfr, sizeof ( bfr ), fp )) {
+      if ( strstr ( bfr, ":" )) {
+        s = bfr; t = ifName;
+        while ( isspace ( *s ))                     // discard white space
+          *s++;
+        while ( *s != ':' )                         // get interface name
+          *t++ = *s++;
+        *t = '\0';
+
+        // verify as a wireless device
+        memset (( char * ) &info, 0, sizeof ( struct wireless_info ));
+        strncpy ( wrq.ifr_name, ifName, IFNAMSIZ );
+        if ( ioctl ( skfd, SIOCGIWNAME, &wrq ) >= 0 ) {
+          printf ( "%s ifName: %s\n", "loadTables() -", ifName );
+          initStructs();
+          loadWiExt( skfd, ifName, &info );
+          displayWiExt ( info );
+          load80211Structs ( skfd, ifName, &info );
+        }
+      }
+    }
+    fclose ( fp );
+  }
+
+  close ( skfd );
+}
+
+/****************************************************************************
+*                                                                           *
+*              load80211Structs() - load the 802.11 structures              *
+*                                                                           *
+****************************************************************************/
+static void 
+load80211Structs ( int skfd, char *ifName, struct wireless_info *wi )
+{
+  int rc, ifIndex = 0;
+  struct ifreq ifr;
+  char  MACAddress [ MACADDR_LEN + 1 ];
+
+  strcpy ( ifr.ifr_name, ifName );
+  rc = ioctl ( skfd, SIOCGIFHWADDR, &ifr );
+  if ( rc >= 0 ) {
+
+    sprintf ( MACAddress, "%02X:%02X:%02X:%02X:%02X:%02X\0", 
+                 ( UCHAR ) ifr.ifr_hwaddr.sa_data[0], ( UCHAR ) ifr.ifr_hwaddr.sa_data[1], 
+                 ( UCHAR ) ifr.ifr_hwaddr.sa_data[2], ( UCHAR ) ifr.ifr_hwaddr.sa_data[3], 
+                 ( UCHAR ) ifr.ifr_hwaddr.sa_data[4], ( UCHAR ) ifr.ifr_hwaddr.sa_data[5] );
+
+    nSc.haveStationID = TRUE;
+    strcpy  ( nSc.stationID, MACAddress );
+    nOp.haveMACAddress = TRUE;
+    strcpy  ( nOp.MACAddress, MACAddress );
+    nRi.haveManufacturerOUI = TRUE;
+    strncpy ( nRi.manufacturerOUI, MACAddress, MAN_OUI_LEN ); 
+
+    ifIndex = if_nametoindex ( ifName );
+    if ( !ifIndex ) {
+      syslog ( LOG_ERR, "SNMP %s - %s %s\n", 
+        "ieee802dot11.load80211Structs()", ifName, "has no ifIndex" );
+      return;
+    }
+
+    loadWiExtTo80211Structs ( ifIndex, ifName, wi );
+
+    if ( hasChanged (( char * ) &nSc, sizeof ( nSc ))) {
+      nSc.ifIndex = ifIndex;
+      sprintf ( nSc.UID, "%04d\0", nSc.ifIndex );
+      strcpy ( nSc.ifName, ifName );
+      addList (( char * ) &scList, ( char * ) &nSc, sizeof ( nSc ));
+    }
+
+    if ( hasChanged (( char * ) &nPr, sizeof ( nPr ))) {
+      nPr.ifIndex = ifIndex;
+      sprintf ( nPr.UID, "%04d\0", nPr.ifIndex );
+      strcpy ( nPr.ifName, ifName );
+      addList (( char * ) &prList, ( char * ) &nPr, sizeof ( nPr ));
+    }
+
+    if ( hasChanged (( char * ) &nOp, sizeof ( nOp ))) {
+      nOp.ifIndex = ifIndex;
+      sprintf ( nOp.UID, "%04d\0", nOp.ifIndex );
+      strcpy ( nOp.ifName, ifName );
+      addList (( char * ) &opList, ( char * ) &nOp, sizeof ( nOp ));
+    }
+
+    if ( hasChanged (( char * ) &nCo, sizeof ( nCo ))) {
+      nCo.ifIndex = ifIndex;
+      sprintf ( nCo.UID, "%04d\0", nCo.ifIndex );
+      strcpy ( nCo.ifName, ifName );
+      addList (( char * ) &coList, ( char * ) &nCo, sizeof ( nCo ));
+    }
+
+    if ( hasChanged (( char * ) &nRi, sizeof ( nRi ))) {
+      nRi.ifIndex = ifIndex;
+      sprintf ( nRi.UID, "%04d\0", nRi.ifIndex );
+      strcpy ( nRi.ifName, ifName );
+      addList (( char * ) &riList, ( char * ) &nRi, sizeof ( nRi ));
+    }
+
+    if ( hasChanged (( char * ) &nPo, sizeof ( nPo ))) {
+      nPo.ifIndex = ifIndex;
+      sprintf ( nPo.UID, "%04d\0", nPo.ifIndex );
+      strcpy ( nPo.ifName, ifName );
+      addList (( char * ) &poList, ( char * ) &nPo, sizeof ( nPo ));
+    }
+
+    if ( hasChanged (( char * ) &nPa, sizeof ( nPa ))) {
+      nPa.ifIndex = ifIndex;
+      sprintf ( nPa.UID, "%04d\0", nPa.ifIndex );
+      strcpy ( nPa.ifName, ifName );
+      addList (( char * ) &paList, ( char * ) &nPa, sizeof ( nPa ));
+    }
+
+    if ( hasChanged (( char * ) &nPt, sizeof ( nPt ))) {
+      nPt.ifIndex = ifIndex;
+      sprintf ( nPt.UID, "%04d\0", nPt.ifIndex );
+      strcpy ( nPt.ifName, ifName );
+      addList (( char * ) &ptList, ( char * ) &nPt, sizeof ( nPt ));
+    }
+
+    if ( hasChanged (( char * ) &nPf, sizeof ( nPf ))) {
+      nPf.ifIndex = ifIndex;
+      sprintf ( nPf.UID, "%04d\0", nPf.ifIndex );
+      strcpy ( nPf.ifName, ifName );
+      addList (( char * ) &pfList, ( char * ) &nPf, sizeof ( nPf ));
+    }
+
+    if ( hasChanged (( char * ) &nPd, sizeof ( nPd ))) {
+      nPd.ifIndex = ifIndex;
+      sprintf ( nPd.UID, "%04d\0", nPd.ifIndex );
+      strcpy ( nPd.ifName, ifName );
+      addList (( char * ) &pdList, ( char * ) &nPd, sizeof ( nPd ));
+    }
+
+    if ( hasChanged (( char * ) &nPi, sizeof ( nPi ))) {
+      nPi.ifIndex = ifIndex;
+      sprintf ( nPi.UID, "%04d\0", nPi.ifIndex );
+      strcpy ( nPi.ifName, ifName );
+      addList (( char * ) &piList, ( char * ) &nPi, sizeof ( nPi ));
+    }
+  }
+
+//printf ( "%s - ifIndex: %d ifName: %s UID: %s\n", 
+//         "load80211Structs() - HASCHANGED", ifIndex, ifName, nSc.UID );
+}
+
+/****************************************************************************
+*                                                                           *
+*                     initStructs() - initialize structures                 *
+*                                                                           *
+****************************************************************************/
+static void initStructs()
+{
+  int i;
+
+  // 802.11 MIB Stuctures
+  memset (( char * ) &nSc, 0, sizeof ( nSc ));  memset (( char * ) &nAa, 0, sizeof ( nAa ));
+  memset (( char * ) &nDf, 0, sizeof ( nDf ));  memset (( char * ) &nKm, 0, sizeof ( nKm ));
+  memset (( char * ) &nPr, 0, sizeof ( nPr ));  memset (( char * ) &nOp, 0, sizeof ( nOp ));
+  memset (( char * ) &nCo, 0, sizeof ( nCo ));  memset (( char * ) &nGa, 0, sizeof ( nGa ));
+  memset (( char * ) &nRi, 0, sizeof ( nRi ));  memset (( char * ) &nPo, 0, sizeof ( nPo ));
+  memset (( char * ) &nPa, 0, sizeof ( nPa ));  memset (( char * ) &nPt, 0, sizeof ( nPt ));
+  memset (( char * ) &nPf, 0, sizeof ( nPf ));  memset (( char * ) &nPd, 0, sizeof ( nPd ));
+  memset (( char * ) &nPi, 0, sizeof ( nPi ));  memset (( char * ) &nRd, 0, sizeof ( nRd ));
+  memset (( char * ) &nAl, 0, sizeof ( nAl ));  memset (( char * ) &nRt, 0, sizeof ( nRt ));
+  memset (( char * ) &nRr, 0, sizeof ( nRr ));
+
+  // Wireless Extensions
+  wepCurrentKey = 0;
+  haveWepCurrentKey = FALSE;
+  for ( i = 0; i < MAX_WEP_KEYS; i++ ) {
+    wep[i].len = 0;
+    wep[i].key[0] = '\0';
+    wep[i].haveKey = FALSE;
+  }
+}
+
+/****************************************************************************
+*                                                                           *
+*                Wireless Extensions Specific Functions                     *
+*                                                                           *
+****************************************************************************/
+/****************************************************************************
+*                                                                           *
+* loadWiExtTo80211Structs() - load wireless extensions to 802.11 structures *
+*                                                                           *
+****************************************************************************/
+static void 
+loadWiExtTo80211Structs ( int ifIndex, char *ifName, struct wireless_info *wi )
+{
+  int i, j = 0;
+
+  // dot11Smt Group
+  // dot11StationConfigTable
+  nSc.havePrivacyOptionImplemented = TRUE;
+  nSc.privacyOptionImplemented = 1;           // assume we support WEP
+
+  if ( wi->has_power ) {
+    nSc.havePowerManagementMode = TRUE;
+    nSc.powerManagementMode = 1;              // assume power is active
+    if ( !wi->power.disabled && 
+          wi->power.flags & IW_POWER_MIN )
+      nSc.powerManagementMode = 2;            // power save mode
+  }
+
+  if ( wi->has_essid && strlen ( wi->essid )) {
+    nSc.haveDesiredSSID = TRUE;
+    strcpy ( nSc.desiredSSID, wi->essid ); 
+  }
+
+  if ( wi->has_mode ) {
+    nSc.haveDesiredBSSType = TRUE;
+    if ( wi->mode == IW_MODE_ADHOC ) 
+      nSc.desiredBSSType = 2;         // independent
+    else if ( wi->has_ap_addr )
+      nSc.desiredBSSType = 1;         // infrastructure
+    else
+      nSc.desiredBSSType = 3;         // any
+  }
+
+  if ( wi->has_range ) {
+    for ( i = 0; i < wi->range.num_bitrates && j < 126; i++ ) {
+      nSc.haveOperationalRateSet = TRUE;
+      nSc.operationalRateSet[j++] = ( char ) ( wi->range.bitrate[i] / 500000L );
+    }
+  }
+
+  // dot11AuthenticationAlgorithmsTable
+  nAa.haveAuthenticationAlgorithm = TRUE;           // it's a rule to always have 
+  nAa.haveAuthenticationAlgorithmsEnable = TRUE;    //    'open' supported
+  nAa.ifIndex = ifIndex;
+  nAa.authenticationAlgorithmsIndex = 1;            // index number one
+  nAa.authenticationAlgorithm = 1;                  // 1 => open key
+  sprintf ( nAa.UID, "%04d%04d\0", nAa.ifIndex, nAa.authenticationAlgorithmsIndex );
+  nAa.authenticationAlgorithmsEnable = 1;           // enabled by default
+  if ( ( wi->has_key                        ) &&
+       ( wi->key_size  != 0                 ) &&
+      !( wi->key_flags & IW_ENCODE_DISABLED ))
+    nAa.authenticationAlgorithmsEnable = 2;
+  addList (( char * ) &aaList, ( char * ) &nAa, sizeof ( nAa ));
+
+  nAa.haveAuthenticationAlgorithm = TRUE;           // I'm gonna assume we always support WEP
+  nAa.haveAuthenticationAlgorithmsEnable = TRUE;
+  nAa.ifIndex = ifIndex;
+  nAa.authenticationAlgorithmsIndex = 2;            // index number 2
+  nAa.authenticationAlgorithm = 2;                  // 2 => shared key
+  sprintf ( nAa.UID, "%04d%04d\0", nAa.ifIndex, nAa.authenticationAlgorithmsIndex );
+  nAa.authenticationAlgorithmsEnable = 2;
+  if ( ( wi->has_key                        ) &&
+       ( wi->key_size  != 0                 ) &&
+      !( wi->key_flags & IW_ENCODE_DISABLED ))
+    nAa.authenticationAlgorithmsEnable = 1;         // disabled by default
+  addList (( char * ) &aaList, ( char * ) &nAa, sizeof ( nAa ));
+
+  //dot11WEPDefaultKeysTable
+  if ( wi->has_range ) {
+    for ( i = 0; i < MAX_WEP_KEYS; i++ ) {
+      nDf.haveWEPDefaultKeyValue = TRUE;
+      nDf.ifIndex = ifIndex;
+      nDf.WEPDefaultKeyIndex = i + 1;               // index number
+      sprintf ( nDf.UID, "%04d%04d\0", nDf.ifIndex, nDf.WEPDefaultKeyIndex );
+      if ( wep[i].haveKey )
+        strcpy ( nDf.WEPDefaultKeyValue, "*****" );
+      else
+        nDf.WEPDefaultKeyValue[0] = '\0';
+      addList (( char * ) &dfList, ( char * ) &nDf, sizeof ( nDf ));
+    }
+  }
+
+  // dot11PrivacyTable
+  nPr.havePrivacyInvoked = TRUE;
+  nPr.privacyInvoked = 2;                   // 2 => FALSE
+  nPr.haveWEPDefaultKeyID = TRUE;
+  nPr.WEPDefaultKeyID = 0;
+  nPr.haveExcludeUnencrypted = TRUE;
+  nPr.excludeUnencrypted = 2;               // 2 => FALSE
+  if ( wi->has_range ) {
+    if ( ( wi->key_size != 0 ) &&
+        !( wi->key_flags & IW_ENCODE_DISABLED )) {
+       nPr.privacyInvoked = 1;
+       if ( wi->key_flags & IW_ENCODE_RESTRICTED )
+          nPr.excludeUnencrypted = 1;
+       nPr.WEPDefaultKeyID = wepCurrentKey;
+    }
+  }
+
+  // dot11Mac Group
+  // dot11OperationTable
+  if ( wi->has_range ) {
+    nOp.haveRTSThreshold = TRUE;
+    nOp.RTSThreshold = wi->range.max_rts;
+  }
+
+  if ( wi->has_frag && wi->frag.value ) {
+    nOp.haveFragmentationThreshold = TRUE;
+    nOp.fragmentationThreshold = wi->frag.value;
+  }
+
+  // dot11Phy Group
+  // dot11PhyOperationTable
+  if ( strstr ( wi->name, "IEEE 802.11-FS"      )) nPo.PHYType = 1;   // So what if I
+  if ( strstr ( wi->name, "IEEE 802.11-DS"      )) nPo.PHYType = 2;   // made up a couple?
+  if ( strstr ( wi->name, "IEEE 802.11-IR"      )) nPo.PHYType = 3;   
+  if ( strstr ( wi->name, "IEEE 802.11-OFDM"    )) nPo.PHYType = 4;   // 802.11a
+  if ( strstr ( wi->name, "IEEE 802.11-OFDM/DS" )) nPo.PHYType = 5;   // 802.11g
+  if ( strstr ( wi->name, "IEEE 802.11-TURBO"   )) nPo.PHYType = 6;   // Atheros TURBO mode
+  if ( nPo.PHYType ) nPo.havePHYType = TRUE;
+
+  // dot11PhyDSSSTable
+  if ( wi->has_range ) { // && wi->freq <= ( double ) 2483000000 ) {  // DSSS frequencies only
+    for ( i = 0; i < wi->range.num_frequency; i++ ) {
+      if ((( double ) ( wi->range.freq[i].e * 10 ) * ( double ) wi->range.freq[i].m ) == wi->freq ) {
+        nPd.haveCurrentChannel = TRUE;
+        nPd.currentChannel = wi->range.freq[i].i; 
+      }
+    }
+  }
+
+  // dot11SupportedDataRatesTxTable
+  if ( wi->has_range ) {
+    for ( i = 0; i < wi->range.num_bitrates; i++ ) {
+      nRt.ifIndex = ifIndex;
+      nRt.supportedDataRatesTxIndex = i + 1;
+      nRt.supportedDataRatesTxValue = wi->range.bitrate[i] / 500000L;
+      nRt.haveSupportedDataRatesTxValue = TRUE;
+      sprintf ( nRt.UID, "%04d%04d\0", nRt.ifIndex, nRt.supportedDataRatesTxIndex );
+      strcpy ( nRt.ifName, ifName );
+      addList (( char * ) &rtList, ( char * ) &nRt, sizeof ( nRt ));
+    }
+  }
+
+  // dot11SupportedDataRatesRxTable
+  if ( wi->has_range ) {
+    for ( i = 0; i < wi->range.num_bitrates; i++ ) {
+      nRr.ifIndex = ifIndex;
+      nRr.supportedDataRatesRxIndex = i + 1;
+      nRr.supportedDataRatesRxValue = wi->range.bitrate[i] / 500000L;
+      nRr.haveSupportedDataRatesRxValue = TRUE;
+      sprintf ( nRr.UID, "%04d%04d\0", nRr.ifIndex, nRr.supportedDataRatesRxIndex );
+      strcpy ( nRr.ifName, ifName );
+      addList (( char * ) &rrList, ( char * ) &nRr, sizeof ( nRr ));
+    }
+  }
+
+//printf ( "%s max_encoding_tokens: %d\n", 
+//          "loadWiExtTo80211Structs() - ", wi->range.max_encoding_tokens );
+}
+
+/****************************************************************************
+*                                                                           *
+*      loadWiExt() - load wireless extensions structures;                   *
+*                    use ioctl calls and read /proc/net/wireless            *
+*                                                                           *
+****************************************************************************/
+static void loadWiExt ( int skfd, char *ifname, struct wireless_info *wi )
+{
+  struct iwreq wrq;                       // ioctl request structure
+  FILE *fp;
+  char  bfr[1024];
+  char  buffer[sizeof ( iwrange ) * 2]; /* Large enough */
+  char *s, *t;
+  int i, j;
+
+  strncpy ( wrq.ifr_name, ifname, IFNAMSIZ );
+
+  /* Get wireless name */
+  if ( ioctl ( skfd, SIOCGIWNAME, &wrq ) >= 0 ) {
+    strncpy ( wi->name, wrq.u.name, IFNAMSIZ );
+    wi->name[IFNAMSIZ] = '\0';
+  }
+
+  /* Get ranges */    // NOTE: some version checking in iwlib.c
+  memset ( buffer, 0, sizeof ( buffer ));
+  wrq.u.data.pointer = ( caddr_t ) &buffer;
+  wrq.u.data.length = sizeof ( buffer );
+  wrq.u.data.flags = 0;
+  if ( ioctl ( skfd, SIOCGIWRANGE, &wrq ) >= 0 ) {
+    memcpy (( char * ) &wi->range, buffer, sizeof ( iwrange ));
+    wi->has_range = 1;
+  }
+
+  /* Get network ID */
+  if ( ioctl ( skfd, SIOCGIWNWID, &wrq ) >= 0 ) {
+    memcpy ( &wi->nwid, &wrq.u.nwid, sizeof ( iwparam ));
+    wi->has_nwid = 1;
+  }
+
+  /* Get frequency / channel */         // THIS NUMBER LOOKS FUNNY
+  if ( ioctl ( skfd, SIOCGIWFREQ, &wrq ) >= 0 ) {
+    wi->has_freq = 1;
+    wi->freq = (( double ) wrq.u.freq.m ) * pow ( 10, wrq.u.freq.e );
+  }
+
+  /* Get sensitivity */
+  if ( ioctl ( skfd, SIOCGIWSENS, &wrq ) >= 0 ) {
+    wi->has_sens = 1;
+    memcpy ( &wi->sens, &wrq.u.sens, sizeof ( iwparam ));
+  }
+
+  /* Get encryption information */
+  wrq.u.data.pointer = ( caddr_t ) &wi->key;
+  wrq.u.data.length = IW_ENCODING_TOKEN_MAX;
+  wrq.u.data.flags = 0;
+  if ( ioctl ( skfd, SIOCGIWENCODE, &wrq ) >= 0 ) {
+    wi->has_key = 1;
+    wi->key_size = wrq.u.data.length;
+    wi->key_flags = wrq.u.data.flags;
+    wepCurrentKey = wrq.u.data.flags & IW_ENCODE_INDEX;
+  }
+
+  for ( i = 0; i < wi->range.max_encoding_tokens; i++ ) {
+    wrq.u.data.pointer = ( caddr_t ) &wi->key;
+    wrq.u.data.length = IW_ENCODING_TOKEN_MAX;
+    wrq.u.data.flags = i;
+    if ( ioctl ( skfd, SIOCGIWENCODE, &wrq ) >= 0 ) {
+      if ( ( wrq.u.data.length != 0 ) &&
+          !( wrq.u.data.flags & IW_ENCODE_DISABLED )) {
+        wep[i].len = wrq.u.data.length;
+        wep[i].haveKey = TRUE;
+        t = wep[i].key;
+        for ( j = 0; j < wrq.u.data.length; j++ ) {
+          if (( j & 0x1 ) == 0 && j != 0 )
+        	  strcpy ( t++, "-");
+          sprintf ( t, "%.2X", wi->key[j] );
+          t += 2;
+        }
+        t = '\0';
+      }
+    }
+  }
+
+  /* Get ESSID */
+  wrq.u.essid.pointer = ( caddr_t ) &wi->essid;
+  wrq.u.essid.length = IW_ESSID_MAX_SIZE + 1;
+  wrq.u.essid.flags = 0;
+  if ( ioctl ( skfd, SIOCGIWESSID, &wrq ) >= 0 ) {
+    wi->has_essid = 1;
+    wi->essid_on = wrq.u.data.flags;
+  }
+
+  /* Get AP address */
+  if ( ioctl ( skfd, SIOCGIWAP, &wrq ) >= 0 ) {
+    wi->has_ap_addr = 1;
+    memcpy ( &wi->ap_addr, &wrq.u.ap_addr, sizeof ( sockaddr ));
+  }
+
+  /* Get NickName */
+  wrq.u.essid.pointer = ( caddr_t ) &wi->nickname;
+  wrq.u.essid.length = IW_ESSID_MAX_SIZE + 1;
+  wrq.u.essid.flags = 0;
+  if ( ioctl ( skfd, SIOCGIWNICKN, &wrq ) >= 0 ) {
+    if ( wrq.u.data.length > 1 )
+      wi->has_nickname = 1;
+  }
+
+  /* Get bit rate */
+  if ( ioctl ( skfd, SIOCGIWRATE, &wrq ) >= 0 ) {
+    wi->has_bitrate = 1;
+    memcpy ( &wi->bitrate, &wrq.u.bitrate, sizeof ( iwparam ));
+  }
+
+  /* Get RTS threshold */
+  if ( ioctl ( skfd, SIOCGIWRTS, &wrq ) >= 0 ) {
+    wi->has_rts = 1;
+    memcpy ( &wi->rts, &wrq.u.rts, sizeof ( iwparam ));
+  }
+
+  /* Get fragmentation threshold */
+  if ( ioctl ( skfd, SIOCGIWFRAG, &wrq ) >= 0 ) {
+      wi->has_frag = 1;
+      memcpy ( &wi->frag, &wrq.u.frag, sizeof ( iwparam ));
+    }
+
+  /* Get operation mode */
+  if ( ioctl ( skfd, SIOCGIWMODE, &wrq ) >= 0 ) {
+      wi->mode = wrq.u.mode;
+      if ( wi->mode < IW_NUM_OPER_MODE && wi->mode >= 0 )
+        wi->has_mode = 1;
+  }
+
+  /* Get Power Management settings */                 // #if WIRELESS_EXT > 9
+  wrq.u.power.flags = 0;
+  if ( ioctl ( skfd, SIOCGIWPOWER, &wrq ) >= 0 ) {
+    wi->has_power = 1;
+    memcpy ( &wi->power, &wrq.u.power, sizeof ( iwparam ));
+  }
+
+  /* Get retry limit/lifetime */                      // #if WIRELESS_EXT > 10
+  if ( ioctl ( skfd, SIOCGIWRETRY, &wrq ) >= 0 ) {    
+    wi->has_retry = 1;
+    memcpy ( &wi->retry, &wrq.u.retry, sizeof ( iwparam ));
+  }
+
+  /* Get stats */                                     // #if WIRELESS_EXT > 11
+  wrq.u.data.pointer = ( caddr_t ) &wi->stats;
+  wrq.u.data.length = 0;
+  wrq.u.data.flags = 1;   /* Clear updated flag */
+  if ( ioctl ( skfd, SIOCGIWSTATS, &wrq ) < 0 )
+    wi->has_stats = 1;
+
+  if ( !wi->has_stats ) {                        // no ioctl support, go to file
+    fp = fopen ( PROC_NET_WIRELESS, "r" );
+    if ( fp ) {
+      while ( fgets ( bfr, sizeof ( bfr ), fp )) {
+        bfr [ sizeof ( bfr ) - 1 ] = '\0';        // no buffer overruns here!
+        strtok (( char * ) &bfr, "\n" );          // '\n' => '\0'
+        if ( strstr ( bfr, ifname ) && strstr ( bfr, ":" )) {
+          wi->has_stats = 1;
+          s = bfr;
+          s = strchr ( s, ':' ); s++;             /* Skip ethX:   */
+          s = strtok ( s, " " );                  /* ' ' => '\0'  */
+          sscanf ( s, "%X", &wi->stats.status ); // status 
+
+          s = strtok ( NULL, " " );               // link quality
+          if ( strchr ( s, '.' ) != NULL )
+            wi->stats.qual.updated |= 1;
+          sscanf ( s, "%d", &wi->stats.qual.qual );
+
+          s = strtok ( NULL, " " );               // signal level
+          if ( strchr ( s,'.' ) != NULL )
+            wi->stats.qual.updated |= 2;
+          sscanf ( s, "%d", &wi->stats.qual.level );
+
+          s = strtok ( NULL, " " );               // noise level
+          if ( strchr ( s, '.' ) != NULL )
+            wi->stats.qual.updated += 4;
+          sscanf ( s, "%d", &wi->stats.qual.noise );
+
+          s = strtok ( NULL, " " ); sscanf ( s, "%d", &wi->stats.discard.nwid     );
+          s = strtok ( NULL, " " ); sscanf ( s, "%d", &wi->stats.discard.code     );
+          s = strtok ( NULL, " " ); sscanf ( s, "%d", &wi->stats.discard.fragment );
+          s = strtok ( NULL, " " ); sscanf ( s, "%d", &wi->stats.discard.retries  );
+          s = strtok ( NULL, " " ); sscanf ( s, "%d", &wi->stats.discard.misc     );
+          s = strtok ( NULL, " " ); sscanf ( s, "%d", &wi->stats.miss.beacon      );
+        }
+      }
+      fclose ( fp );
+    }
+  }
+
+// printf ( "%s bfr: %s\n", "loadTables()", bfr );
+}
+
+/****************************************************************************
+*                                                                           *
+*       displayWiExt() - show what I got from Wireless Extensions           *
+*                                                                           *
+****************************************************************************/
+static void displayWiExt ( struct wireless_info info )
+{
+#ifdef DISPLAYWIEXT
+  int i;
+  char title[] = "displayWiExt() -";
+
+  printf ( "========================================\n" );
+  printf ( "===> Wireless Extension IOCTL calls <===\n" );
+  printf ( "========================================\n" );
+
+  if ( strlen ( info.name ))
+    printf ( "%s name: %s\n", "SIOCGIWNAME", info.name );
+  else
+    printf ( "%s\n", "no info.name support" );
+
+  if ( info.has_nickname = 1 )
+    printf ( "%s nickname: %s\n", "SIOCGIWNICKN", info.nickname );
+  else
+    printf ( "%s %s\n", "SIOCGIWNICKN", " ===> no info.nickname support" );
+
+  if ( info.has_essid ) 
+    printf ( "%s essid_on: %d essid: %s\n", "SIOCGIWESSID", info.essid_on, info.essid );
+  else
+    printf ( "%s %s\n", "SIOCGIWESSID", " ===> no info.essid support" );
+
+  if ( info.has_range ) {
+    printf ( "%s throughput: %d\n",           "SIOCGIWRANGE", info.range.throughput );
+    printf ( "%s min_nwid: %d\n",             "SIOCGIWRANGE", info.range.min_nwid  );
+    printf ( "%s max_nwid: %d\n",             "SIOCGIWRANGE", info.range.max_nwid  );
+    printf ( "%s sensitivity: %d\n",          "SIOCGIWRANGE", info.range.sensitivity );
+    printf ( "%s num_bitrates: %d\n",         "SIOCGIWRANGE", info.range.num_bitrates );
+    for ( i = 0; i < info.range.num_bitrates; i++ ) 
+      printf ( "%s bitrate[%d]: %d\n",        "SIOCGIWRANGE", i, info.range.bitrate[i]  );
+    printf ( "%s min_rts: %d\n",              "SIOCGIWRANGE", info.range.min_rts );
+    printf ( "%s max_rts: %d\n",              "SIOCGIWRANGE", info.range.max_rts );
+    printf ( "%s min_frag: %d\n",             "SIOCGIWRANGE", info.range.min_frag );
+    printf ( "%s max_frag: %d\n",             "SIOCGIWRANGE", info.range.max_frag );
+    printf ( "%s min_pmp: %d\n",              "SIOCGIWRANGE", info.range.min_pmp );
+    printf ( "%s max_pmp: %d\n",              "SIOCGIWRANGE", info.range.max_pmp );
+    printf ( "%s min_pmt: %d\n",              "SIOCGIWRANGE", info.range.min_pmt );
+    printf ( "%s max_pmt: %d\n",              "SIOCGIWRANGE", info.range.max_pmt );
+    printf ( "%s pmp_flags: %d\n",            "SIOCGIWRANGE", info.range.pmp_flags );
+    printf ( "%s pmt_flags: %d\n",            "SIOCGIWRANGE", info.range.pmt_flags );
+    printf ( "%s pm_capa: %d\n",              "SIOCGIWRANGE", info.range.pm_capa );
+    printf ( "%s num_encoding_sizes: %d\n",   "SIOCGIWRANGE", info.range.num_encoding_sizes );
+    for ( i = 0; i < info.range.num_encoding_sizes; i++ ) 
+      printf ( "%s encoding_size[%d]: %d\n",  "SIOCGIWRANGE", i, info.range.encoding_size[i]  );
+    printf ( "%s max_encoding_tokens: %d\n",  "SIOCGIWRANGE", info.range.max_encoding_tokens );
+//  printf ( "%s encoding_login_index: %d\n", "SIOCGIWRANGE", info.range.encoding_login_index );
+    printf ( "%s txpower_capa: %d\n",         "SIOCGIWRANGE", info.range.txpower_capa );
+    printf ( "%s num_txpower: %d dBm\n",      "SIOCGIWRANGE", info.range.num_txpower );
+    for ( i = 0; i < info.range.num_txpower; i++ ) 
+      printf ( "%s txpower[%d]: %d\n",        "SIOCGIWRANGE", i, info.range.txpower[i]  );
+    printf ( "%s we_version_compiled: %d\n",  "SIOCGIWRANGE", info.range.we_version_compiled );
+    printf ( "%s we_version_source: %d\n",    "SIOCGIWRANGE", info.range.we_version_source );
+    printf ( "%s retry_capa: %d\n",           "SIOCGIWRANGE", info.range.retry_capa );
+    printf ( "%s retry_flags: %d\n",          "SIOCGIWRANGE", info.range.retry_flags );
+    printf ( "%s r_time_flags: %d\n",         "SIOCGIWRANGE", info.range.r_time_flags );
+    printf ( "%s min_retry: %d\n",            "SIOCGIWRANGE", info.range.min_retry );
+    printf ( "%s max_retry: %d\n",            "SIOCGIWRANGE", info.range.max_retry );
+    printf ( "%s min_r_time: %d\n",           "SIOCGIWRANGE", info.range.min_r_time );
+    printf ( "%s max_r_time: %d\n",           "SIOCGIWRANGE", info.range.max_r_time );
+    printf ( "%s num_channels: %d\n",         "SIOCGIWRANGE", info.range.num_channels );
+    printf ( "%s num_frequency: %d\n",        "SIOCGIWRANGE", info.range.num_frequency );
+    for ( i = 0; i < info.range.num_frequency; i++ ) 
+      printf ( "%s freq[%d].i: %d freq[%d].e: %d freq[%d].m: %d\n", "SIOCGIWRANGE", 
+                i, info.range.freq[i].i, i, info.range.freq[i].e, i, info.range.freq[i].m );
+  }
+  else
+    printf ( "%s %s\n", "SIOCGIWRANGE", " ===> no info.range support" );
+
+  if ( info.has_nwid ) 
+    printf ( "%s nwid - disabled: %d value: %X\n", "SIOCGIWNWID", info.nwid.disabled, info.nwid.value );
+  else
+    printf ( "%s %s\n", "SIOCGIWNWID", " ===> no info.nwid support" );
+
+  if ( info.has_freq ) {
+//  printf ( "%s freq: %g\n", "SIOCGIWFREQ", info.freq / GIGA );
+    printf ( "%s freq: %g\n", "SIOCGIWFREQ", info.freq );
+  }
+  else
+    printf ( "%s %s\n", "SIOCGIWFREQ", " ===> no info.freq support" );
+
+  if ( info.has_sens )
+    printf ( "%s sens: %d\n", "SIOCGIWSENS", info.sens );
+  else
+    printf ( "%s %s\n", "SIOCGIWSENS", " ===> no info.sens support" );
+
+  if ( info.has_key ) {
+    printf ( "%s key_size: %d key_flags: %d wepCurrentKey: %d\n", 
+              "SIOCGIWENCODE", info.key_size, info.key_flags, wepCurrentKey );
+    printf ( "%s MODE: %d DISABLED: %d INDEX: %d OPEN: %d RESTRICTED: %d NOKEY: %d TEMP: %d\n",
+              "SIOCGIWENCODE",                           info.key_flags & IW_ENCODE_MODE,
+              info.key_flags & IW_ENCODE_DISABLED ? 1:0, info.key_flags & IW_ENCODE_INDEX,
+              info.key_flags & IW_ENCODE_OPEN     ? 1:0, info.key_flags & IW_ENCODE_RESTRICTED ? 1:0,
+              info.key_flags & IW_ENCODE_NOKEY    ? 1:0, info.key_flags & IW_ENCODE_TEMP       ? 1:0 );
+  }
+  else
+    printf ( "%s %s\n", "SIOCGIWENCODE", " ===> no info.key support" );
+
+  for ( i = 0; i < MAX_WEP_KEYS; i++ ) {
+    if ( wep[i].haveKey )
+      printf ( "%s wep[%d].len: %d wep[%d].key: %s\n", 
+                "SIOCGIWENCODE", i, wep[i].len, i, wep[i].key );
+  }
+
+  if ( info.has_ap_addr )
+    printf ( "%s ap_addr.sa_data: %02X:%02X:%02X:%02X:%02X:%02X ap_addr.sa_family: %d\n", 
+              "SIOCGIWAP",  ( UCHAR ) info.ap_addr.sa_data[0], ( UCHAR ) info.ap_addr.sa_data[1], 
+                            ( UCHAR ) info.ap_addr.sa_data[2], ( UCHAR ) info.ap_addr.sa_data[3], 
+                            ( UCHAR ) info.ap_addr.sa_data[4], ( UCHAR ) info.ap_addr.sa_data[5], 
+                                      info.ap_addr.sa_family );
+  else
+    printf ( "%s %s\n", "SIOCGIWAP", " ===> no ap_addr information" );
+
+  if ( info.has_bitrate )
+    printf ( "%s bitrate: %d value: %d fixed: %d disabled: %d flags: %d\n", 
+              "SIOCGIWRATE", info.bitrate, info.bitrate.value, info.bitrate.fixed, 
+                             info.bitrate.disabled, info.bitrate.flags );
+  else
+    printf ( "%s %s\n", "SIOCGIWRATE", " ===> no info.bitrate support" );
+
+  if ( info.has_rts )
+    printf ( "%s rts: %d\n", "SIOCGIWRTS", info.rts );
+  else
+    printf ( "%s %s\n", "SIOCGIWRTS", " ===> no info.rts support" );
+
+  if ( info.has_frag )
+    printf ( "%s frag: %d\n", "SIOCGIWFRAG", info.frag );
+  else
+    printf ( "%s %s\n", "SIOCGIWFRAG", " ===> no info.frag support" );
+
+  if ( info.has_mode ) 
+    printf ( "%s mode: %d\n", "SIOCGIWMODE", info.mode );
+  else
+    printf ( "%s %s\n", "SIOCGIWMODE", " ===> no info.mode support" );
+
+  if ( info.has_power ) {
+    printf ( "%s power: %d\n", "SIOCGIWPOWER", info.power );
+    printf ( "%s disabled: %d MIN: %d MAX: %d TIMEOUT: %d RELATIVE: %d\n",
+              "SIOCGIWPOWER",
+              info.power.disabled                  ? 1:0, 
+              info.power.flags & IW_POWER_MIN      ? 1:0, 
+              info.power.flags & IW_POWER_MAX      ? 1:0, 
+              info.power.flags & IW_POWER_TIMEOUT  ? 1:0, 
+              info.power.flags & IW_POWER_RELATIVE ? 1:0 ); 
+    printf ( "%s UNICAST: %d MULTICAST: %d ALL: %d FORCE: %d REPEATER: %d\n",
+              "SIOCGIWPOWER",
+              info.power.flags & IW_POWER_UNICAST_R   ? 1:0, 
+              info.power.flags & IW_POWER_MULTICAST_R ? 1:0, 
+              info.power.flags & IW_POWER_ALL_R       ? 1:0, 
+              info.power.flags & IW_POWER_FORCE_S     ? 1:0, 
+              info.power.flags & IW_POWER_REPEATER    ? 1:0 ); 
+  }
+  else
+    printf ( "%s %s\n", "SIOCGIWPOWER", " ===> no info.power support" );
+
+  if ( info.has_retry )
+    printf ( "%s retry: %d\n", "SIOCGIWRETRY", info.retry );
+  else
+    printf ( "%s %s\n", "SIOCGIWRETRY", " ===> no info.retry support" );
+
+  if ( info.has_stats ) {
+    printf ( "%s status: %d\n",           "SIOCGIWSTATS", info.stats.status           );
+    printf ( "%s qual.level: %d\n",       "SIOCGIWSTATS", info.stats.qual.level       );
+    printf ( "%s qual.noise: %d\n",       "SIOCGIWSTATS", info.stats.qual.noise       );
+    printf ( "%s qual.qual: %d\n",        "SIOCGIWSTATS", info.stats.qual.qual        );
+    printf ( "%s qual.updated: %d\n",     "SIOCGIWSTATS", info.stats.qual.updated     );
+    printf ( "%s discard.code: %d\n",     "SIOCGIWSTATS", info.stats.discard.code     );
+    printf ( "%s discard.fragment: %d\n", "SIOCGIWSTATS", info.stats.discard.fragment );
+    printf ( "%s discard.misc: %d\n",     "SIOCGIWSTATS", info.stats.discard.misc     );
+    printf ( "%s discard.nwid: %d\n",     "SIOCGIWSTATS", info.stats.discard.nwid     );
+    printf ( "%s discard.retries: %d\n",  "SIOCGIWSTATS", info.stats.discard.retries  );
+    printf ( "%s miss.beacon: %d\n",      "SIOCGIWSTATS", info.stats.miss.beacon      );
+  }
+  else
+    printf ( "%s %s\n", "SIOCGIWSTATS", " ===> no info.stats support" );
+
+  if ( info.txpower.flags & IW_TXPOW_MWATT )
+    printf ( "%s txpower1: %d dBm disabled: %d fixed: %d flags: %d\n", "SIOCGIWRANGE", 
+      mWatt2dbm ( info.txpower.value ), info.txpower.disabled, info.txpower.fixed, info.txpower.flags);
+  else
+    printf ( "%s txpower2: %d dBm disabled: %d fixed: %d flags: %d\n", "SIOCGIWRANGE", info.txpower.value, info.txpower.disabled, info.txpower.fixed, info.txpower.flags );
+
+  if ( info.has_range ) 
+    if ( info.sens.value < 0 )
+      printf ( "%s sens: %d dBm\n", "SIOCGIWRANGE", info.sens.value );
+    else
+      printf ( "%s sens: %d/%d\n", "SIOCGIWRANGE", info.sens.value, info.range.sensitivity );
+
+  if ( info.has_range && ( info.stats.qual.level != 0 ))
+      if ( info.stats.qual.level > info.range.max_qual.level )
+        /* Statistics are in dBm (absolute power measurement) */
+        printf ( "%s Quality: %d/%d Signal level: %d dBm Noise level: %d dBm\n",
+                  "SIOCGIWRANGE",
+                  info.stats.qual.qual, info.range.max_qual.qual,
+                  info.stats.qual.level - 0x100,
+                  info.stats.qual.noise - 0x100 );
+      else
+        printf (  "%s Quality: %d/%d Signal level: %d/%d Noise level: %d/%d",
+                  "SIOCGIWRANGE",
+                  info.stats.qual.qual,  info.range.max_qual.qual,
+                  info.stats.qual.level, info.range.max_qual.level,
+                  info.stats.qual.noise, info.range.max_qual.noise );
+
+#endif // #ifdef DISPLAYWIEXT
+}
+
+/****************************************************************************
+*                                                                           *
+*                        Linked List Functions                              *
+*                                                                           *
+****************************************************************************/
+/****************************************************************************
+*                                                                           *
+*                addList() - add an entry to a linked list                  *
+*                                                                           *
+****************************************************************************/
+static void 
+addList ( char *l, char *data, int len  )
+{
+  char uid[256];
+  LIST_HEAD ( , avNode ) *list;       
+
+  // NOTE: this assumes the UID is at the begining of the 
+  //       data structure and that UIDs are strings
+  
+  list = ( LIST_HEAD ( , avNode ) * ) l;            // NOTE: don't know how to get 
+  strcpy ( uid, data );                             //  rid of compiler warning on
+                                                    //  LISTHEAD typecast
+  // create a new node and the data that goes in it
+  newNode = malloc ( sizeof ( struct avNode ));
+  newNode->data = malloc ( len );
+  memcpy ( newNode->data, data, len );
+
+  // this deals with an empty list
+  if ( LIST_EMPTY ( list )) {
+    LIST_INSERT_HEAD ( list, newNode, nodes );
+    return;
+  }
+
+  // this deals with UIDs that match
+  for ( np = LIST_FIRST ( list ); np != NULL; np = LIST_NEXT ( np, nodes )) {
+    if ( strncmp ( uid, np->data, strlen ( uid )) == 0 ) {                      // found matching UID
+      LIST_INSERT_AFTER ( np, newNode, nodes );
+      if ( np->data )
+        free ( np->data );
+      LIST_REMOVE ( np, nodes );
+      free ( np );
+      return;
+    }
+  }
+
+  // this deals with inserting a new UID in the list
+  for ( np = LIST_FIRST ( list ); np != NULL; np = LIST_NEXT ( np, nodes )) {
+    lastNode = np;
+    if ( strncmp ( np->data, uid, strlen ( uid )) > 0 ) {                       // old ID > new ID AND
+      LIST_INSERT_BEFORE ( np, newNode, nodes );
+      return;
+    }
+  }
+
+  // this deals with a UID that needs to go on the end of the list
+  LIST_INSERT_AFTER ( lastNode, newNode, nodes );
+
+  return;
+}
+
+/****************************************************************************
+*                                                                           *
+*              initLists() - initialize all the linked lists                *
+*                                                                           *
+****************************************************************************/
+static void initLists()
+{
+  LIST_INIT ( &scList );  LIST_INIT ( &aaList );  LIST_INIT ( &dfList );
+  LIST_INIT ( &kmList );  LIST_INIT ( &prList );
+  LIST_INIT ( &opList );  LIST_INIT ( &coList );
+  LIST_INIT ( &gaList );  LIST_INIT ( &riList );  LIST_INIT ( &poList );
+  LIST_INIT ( &paList );  LIST_INIT ( &ptList );  LIST_INIT ( &pfList );
+  LIST_INIT ( &pdList );  LIST_INIT ( &piList );  LIST_INIT ( &rdList );
+  LIST_INIT ( &alList );  LIST_INIT ( &rtList );  LIST_INIT ( &rrList );
+}
+/****************************************************************************
+*                                                                           *
+*                 flushLists() - flush all linked lists                     *
+*                                                                           *
+****************************************************************************/
+static void flushLists()
+{
+  flushList (( char * ) &scList );  flushList (( char * ) &aaList );
+  flushList (( char * ) &dfList );  flushList (( char * ) &kmList );
+  flushList (( char * ) &prList );
+  flushList (( char * ) &opList );  flushList (( char * ) &coList );
+  flushList (( char * ) &gaList );  flushList (( char * ) &riList );
+  flushList (( char * ) &poList );  flushList (( char * ) &paList );
+  flushList (( char * ) &ptList );  flushList (( char * ) &pfList );
+  flushList (( char * ) &pdList );  flushList (( char * ) &piList );
+  flushList (( char * ) &rdList );  flushList (( char * ) &alList );
+  flushList (( char * ) &rtList );  flushList (( char * ) &rrList );
+}
+
+/****************************************************************************
+*                                                                           *
+*                   flushList() - flush a linked list                       *
+*                                                                           *
+****************************************************************************/
+static void flushList ( char *l )
+{
+  LIST_HEAD ( , avNode ) *list;
+  
+  list = ( LIST_HEAD ( , avNode ) * ) l;    // NOTE: don't know how to get 
+  while ( !LIST_EMPTY ( list )) {           //  rid of compiler warning on
+    np = LIST_FIRST ( list );               //  LISTHEAD typecast
+    if ( np->data )
+      free ( np->data );
+    LIST_REMOVE ( np, nodes );
+    free ( np );
+  }
+}
+
+/****************************************************************************
+*                                                                           *
+*                            Utility Functions                              *
+*                                                                           *
+****************************************************************************/
+/****************************************************************************
+*                                                                           *
+*        The following two routines were taken directly from iwlib.c        *
+*                                                                           *
+****************************************************************************/
+ /*
+ * Open a socket.
+ * Depending on the protocol present, open the right socket. The socket
+ * will allow us to talk to the driver.
+ */
+static int openSocket ( void )
+{
+  static const int families[] = {
+    AF_INET, AF_IPX, AF_AX25, AF_APPLETALK
+  };
+  unsigned int  i;
+  int   sock;
+
+  /*
+   * Now pick any (exisiting) useful socket family for generic queries
+   * Note : don't open all the socket, only returns when one matches,
+   * all protocols might not be valid.
+   * Workaround by Jim Kaba <jkaba@sarnoff.com>
+   * Note : in 99% of the case, we will just open the inet_sock.
+   * The remaining 1% case are not fully correct...
+   */
+
+  /* Try all families we support */
+  for(i = 0; i < sizeof(families)/sizeof(int); ++i) {
+      /* Try to open the socket, if success returns it */
+      sock = socket(families[i], SOCK_DGRAM, 0);
+      if(sock >= 0)
+  return sock;
+  }
+
+  return -1;
+}
+
+/*------------------------------------------------------------------*/
+/*
+ * Convert a value in milliWatt to a value in dBm.
+ */
+static int mWatt2dbm ( int in )
+{
+#ifdef WE_NOLIBM
+  /* Version without libm : slower */
+  double  fin = (double) in;
+  int   res = 0;
+
+  /* Split integral and floating part to avoid accumulating rounding errors */
+  while(fin > 10.0)
+    {
+      res += 10;
+      fin /= 10.0;
+    }
+  while(fin > 1.000001) /* Eliminate rounding errors, take ceil */
+    {
+      res += 1;
+      fin /= LOG10_MAGIC;
+    }
+  return(res);
+#else /* WE_NOLIBM */
+  /* Version with libm : faster */
+  return((int) (ceil(10.0 * log10((double) in))));
+#endif  /* WE_NOLIBM */
+}
+
+/****************************************************************************
+*                                                                           *
+*                 htob - converts hex string to binary                      *
+*                                                                           *
+****************************************************************************/
+static char *htob ( char *s )
+{
+    char nibl, *byt;
+    static char bin[20];
+
+    byt = bin;
+
+    while ((nibl = *s++) && nibl != ' ') {    /* While not end of string. */
+      nibl -= ( nibl > '9') ?  ('A' - 10): '0';
+      *byt = nibl << 4;                              /* place high nibble */
+      if((nibl = *s++) && nibl != ' ') {
+        nibl -= ( nibl > '9') ?  ('A' - 10): '0';
+        *byt |= nibl;                                /*  place low nibble */
+      }
+      else break;
+      ++byt;
+    }
+    *++byt = '\0';
+    return ( bin );
+}
+
+/****************************************************************************
+*                                                                           *
+*           hasChanged() - see if area has been changed from NULLs          *
+*                                                                           *
+****************************************************************************/
+static int hasChanged ( char *loc, int len )
+{
+  char *wrk;
+  int changed = TRUE;
+
+  wrk = malloc ( len );
+  memset ( wrk, 0, len );
+  if ( memcmp ( loc, wrk, len ) == 0 )
+    changed = FALSE;
+  free ( wrk );
+
+  return ( changed );
+}
+
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/ieee802dot11.h tomato121/release/src/router/snmp/agent/mibgroup/ieee802dot11.h
--- tomato/release/src/router/snmp/agent/mibgroup/ieee802dot11.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/ieee802dot11.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,730 @@
+/****************************************************************************
+*                                                                           *
+*  File Name:           ieee802dot11.h                                      *
+*  Used By:                                                                 *
+*                                                                           *
+*  Operating System:                                                        *
+*  Purpose:                                                                 *
+*                                                                           *
+*  Comments:                                                                *
+*                                                                           *
+*  Author:              Larry Simmons                                       *
+*                       lsimmons@avantcom.com                               *
+*                       www.avantcom.com                                    *
+*                                                                           *
+*  Creation Date:       09/02/03                                            *
+*                                                                           *
+*   Ver    Date   Inits Modification                                        *
+*  ----- -------- ----- ------------                                        *
+*  0.0.1 09/02/03  LRS  created                                             *
+*  0.0.2 09/24/03  LRS  wouldn't build after fresh ./configure              *
+****************************************************************************/
+/* This file was generated by mib2c and is intended for use as a mib module
+  for the ucd-snmp snmpd agent. */
+#ifndef _MIBGROUP_IEEE802DOT11_H
+#define _MIBGROUP_IEEE802DOT11_H
+/* we may use header_generic and header_simple_table from the util_funcs module */
+
+/****************************************************************************
+*                               Includes                                    *
+****************************************************************************/
+#include <sys/queue.h>
+
+/****************************************************************************
+*                             Linked List Defines                           *
+****************************************************************************/
+// here are some Linked List MACROS I wanted to use, 
+// but curiously were not in /usr/includes/sys/queue.h
+
+#ifndef LIST_EMPTY
+  #define	LIST_EMPTY(head)	((head)->lh_first == NULL)
+#endif
+
+#ifndef LIST_NEXT
+  #define	LIST_NEXT(elm, field)	((elm)->field.le_next)
+#endif
+
+#ifndef LIST_INSERT_BEFORE
+  #define	LIST_INSERT_BEFORE(listelm, elm, field) do {			\
+	  (elm)->field.le_prev = (listelm)->field.le_prev;		\
+	  LIST_NEXT((elm), field) = (listelm);				\
+	  *(listelm)->field.le_prev = (elm);				\
+	  (listelm)->field.le_prev = &LIST_NEXT((elm), field);		\
+  } while (0)
+#endif
+
+#ifndef LIST_FIRST
+  #define	LIST_FIRST(head)	((head)->lh_first)
+#endif
+
+/****************************************************************************
+*                             802.11 MIB Defines                            *
+****************************************************************************/
+#define SYS_STRING_LEN                     256
+#define MACADDR_LEN                        ( 6 * 2 ) + 5
+#define OPER_RATE_SET_LEN                  126
+#define MAN_OUI_LEN                        ( 3 * 2 ) + 2
+#define WEP_STR_LEN                         64
+#define SNMP_STR_LEN                       128
+#define TEXT_LEN                            80
+#define IFINDEX_LEN                          4
+#define IFNAME_LEN                          16
+#define MAX_WEP_KEYS                         4
+
+#define AUTHENICATION_ALGORITHMS_INDEX_LEN   4
+#define WEP_DEFAULT_KEY_INDEX_LEN            4
+#define WEP_KEY_MAPPING_INDEX_LEN            4
+#define GROUP_ADDRESS_INDEX_LEN              4
+#define REG_DOMAIN_SUPPORT_INDEX_LEN         4
+#define ANTENNA_LIST_INDEX_LEN               4
+#define SUPPORTED_DATA_RATES_TX_INDEX_LEN    4
+#define SUPPORTED_DATA_RATES_RX_INDEX_LEN    4
+
+#define SC_UID_LEN  IFINDEX_LEN
+#define AA_UID_LEN  IFINDEX_LEN + AUTHENICATION_ALGORITHMS_INDEX_LEN
+#define DF_UID_LEN  IFINDEX_LEN + WEP_DEFAULT_KEY_INDEX_LEN
+#define KM_UID_LEN  IFINDEX_LEN + WEP_KEY_MAPPING_INDEX_LEN
+#define PR_UID_LEN  IFINDEX_LEN
+#define OP_UID_LEN  IFINDEX_LEN
+#define CO_UID_LEN  IFINDEX_LEN
+#define GA_UID_LEN  IFINDEX_LEN + GROUP_ADDRESS_INDEX_LEN
+#define RI_UID_LEN  IFINDEX_LEN
+#define PO_UID_LEN  IFINDEX_LEN
+#define PA_UID_LEN  IFINDEX_LEN
+#define PT_UID_LEN  IFINDEX_LEN
+#define PF_UID_LEN  IFINDEX_LEN
+#define PD_UID_LEN  IFINDEX_LEN
+#define PI_UID_LEN  IFINDEX_LEN
+#define RD_UID_LEN  IFINDEX_LEN + REG_DOMAIN_SUPPORT_INDEX_LEN
+#define AL_UID_LEN  IFINDEX_LEN + ANTENNA_LIST_INDEX_LEN
+#define RT_UID_LEN  IFINDEX_LEN + SUPPORTED_DATA_RATES_TX_INDEX_LEN
+#define RR_UID_LEN  IFINDEX_LEN + SUPPORTED_DATA_RATES_RX_INDEX_LEN
+
+/****************************************************************************
+*                           Linked List Structure                           *
+****************************************************************************/
+static struct avNode {  
+  LIST_ENTRY ( avNode ) nodes; 
+  char *data;                                 // pointer to data
+};
+
+typedef LIST_HEAD ( , avNode ) avList_t;
+
+/****************************************************************************
+*                          802.11 MIB structures                            *
+****************************************************************************/
+/****************************************************************************
+*                             dot11Smt Group                                *
+****************************************************************************/
+/****************************************************************************
+*                          dot11StationConfigTable                          *
+****************************************************************************/
+static struct scTbl_data {
+
+  char  UID       [ SC_UID_LEN + 1 ];               // unique ID
+  char  ifName    [ IFNAME_LEN + 1 ];               // ifName of card
+
+  long  ifIndex;                                    // ifindex of card
+
+  char  stationID [ MACADDR_LEN + 1 ];              // Default actual MacAddr
+  long  mediumOccupancyLimit;
+  long  CFPPollable;
+  long  CFPPeriod;
+  long  maxDuration;
+  long  authenticationResponseTimeOut;
+  long  privacyOptionImplemented;
+  long  powerManagementMode;
+  char  desiredSSID             [ SNMP_STR_LEN + 1 ];
+  long  desiredBSSType;
+  char  operationalRateSet      [ OPER_RATE_SET_LEN + 1];
+  long  beaconPeriod;
+  long  DTIMPeriod;
+  long  associationResponseTimeOut;
+  long  disAssociationReason;
+  char  disAssociationStation   [ MACADDR_LEN + 1 ];
+  long  deAuthenticationReason;
+  char  deAuthenticationStation [ MACADDR_LEN + 1 ];
+  long  authenticateFailStatus;
+  char  authenticateFailStation [ MACADDR_LEN + 1 ];
+
+  long  haveStationID;
+  long  haveMediumOccupancyLimit;
+  long  haveCFPPollable;
+  long  haveCFPPeriod;
+  long  haveMaxDuration;
+  long  haveAuthenticationResponseTimeOut;
+  long  havePrivacyOptionImplemented;
+  long  havePowerManagementMode;
+  long  haveDesiredSSID;
+  long  haveDesiredBSSType;
+  long  haveOperationalRateSet;
+  long  haveBeaconPeriod;
+  long  haveDTIMPeriod;
+  long  haveAssociationResponseTimeOut;
+  long  haveDisAssociationReason;
+  long  haveDisAssociationStation;
+  long  haveDeAuthenticationReason;
+  long  haveDeAuthenticationStation;
+  long  haveAuthenticateFailStatus;
+  long  haveAuthenticateFailStation;
+
+} nSc, *sc = &nSc;
+
+static avList_t scList;
+
+/****************************************************************************
+*                    dot11AuthenticationAlgorithmsTable                     *
+****************************************************************************/
+static struct aaTbl_data {
+
+  char  UID       [ AA_UID_LEN + 1 ];
+  char  ifName    [ IFNAME_LEN + 1 ];               // ifName of card
+
+  long  ifIndex;                                    // ifindex of card
+  long  authenticationAlgorithmsIndex;
+
+  long  authenticationAlgorithm;
+  long  authenticationAlgorithmsEnable;
+
+  long  haveAuthenticationAlgorithm;
+  long  haveAuthenticationAlgorithmsEnable;
+
+} nAa, *aa = &nAa;
+
+static avList_t aaList;
+
+/****************************************************************************
+*                           dot11WEPDefaultKeysTable                        *
+****************************************************************************/
+static struct dfTbl_data {
+
+  char  UID       [ DF_UID_LEN + 1 ];
+  char  ifName    [ IFNAME_LEN + 1 ];
+
+  long  ifIndex;                                    // ifindex of card
+  long  WEPDefaultKeyIndex;
+
+  char  WEPDefaultKeyValue [ WEP_STR_LEN + 1 ];
+  long  haveWEPDefaultKeyValue;
+
+} nDf, *df = &nDf;
+
+static avList_t dfList;
+
+/****************************************************************************
+*                          dot11WEPKeyMappingsTable                         *
+****************************************************************************/
+static struct kmTbl_data {
+
+  char  UID       [ KM_UID_LEN + 1 ];
+  char  ifName    [ IFNAME_LEN + 1 ];
+
+  long  ifIndex;
+  long  WEPKeyMappingIndex;
+
+  char  WEPKeyMappingAddress  [ MACADDR_LEN + 1 ];
+  long  WEPKeyMappingWEPOn;
+  char  WEPKeyMappingValue    [ WEP_STR_LEN + 1 ];
+  long  WEPKeyMappingStatus;
+
+  long  haveWEPKeyMappingIndex;
+  long  haveWEPKeyMappingAddress;
+  long  haveWEPKeyMappingWEPOn;
+  long  haveWEPKeyMappingValue;
+  long  haveWEPKeyMappingStatus;
+
+} nKm, *km = &nKm;
+
+static avList_t kmList;
+
+/****************************************************************************
+*                                dot11PrivacyTable                          *
+****************************************************************************/
+static struct prTbl_data {
+
+  char          UID       [ PR_UID_LEN + 1 ];
+  char          ifName    [ IFNAME_LEN + 1 ];
+
+  long          ifIndex;
+
+  long          privacyInvoked;
+  long          WEPDefaultKeyID;
+  long          WEPKeyMappingLength;
+  long          excludeUnencrypted;
+  unsigned long WEPICVErrorCount;
+  unsigned long WEPExcludedCount;
+
+  long          havePrivacyInvoked;
+  long          haveWEPDefaultKeyID;
+  long          haveWEPKeyMappingLength;
+  long          haveExcludeUnencrypted;
+  long          haveWEPICVErrorCount;
+  long          haveWEPExcludedCount;
+
+} nPr, *pr = &nPr;
+
+static avList_t prList;
+
+/****************************************************************************
+*                               dot11Mac Group                              *
+****************************************************************************/
+/****************************************************************************
+*                              dot11OperationTable                          *
+****************************************************************************/
+static struct opTbl_data {
+
+  char  UID       [ OP_UID_LEN + 1 ];                 // unique ID
+  char  ifName    [ IFNAME_LEN + 1 ];                 // ifName of card
+
+  long  ifIndex;                                      // ifindex of card
+
+  char  MACAddress      [ MACADDR_LEN + 1 ];
+  long  RTSThreshold;
+  long  shortRetryLimit;
+  long  longRetryLimit;
+  long  fragmentationThreshold;
+  long  maxTransmitMSDULifetime;
+  long  maxReceiveLifetime;
+  char  manufacturerID  [ SNMP_STR_LEN + 1 ];
+  char  productID       [ SNMP_STR_LEN + 1 ];
+
+  long  haveMACAddress;
+  long  haveRTSThreshold;
+  long  haveShortRetryLimit;
+  long  haveLongRetryLimit;
+  long  haveFragmentationThreshold;
+  long  haveMaxTransmitMSDULifetime;
+  long  haveMaxReceiveLifetime;
+  long  haveManufacturerID;
+  long  haveProductID;
+
+} nOp, *op = &nOp;
+
+static avList_t opList;
+
+/****************************************************************************
+*                            dot11CountersTable                             *
+****************************************************************************/
+static struct coTbl_data {
+
+  char          UID       [ CO_UID_LEN + 1 ];     // unique ID
+  char          ifName    [ IFNAME_LEN + 1 ];     // ifName of card
+
+  long          ifIndex;                          // ifindex of card
+
+  unsigned long  transmittedFragmentCount;
+  unsigned long  multicastTransmittedFrameCount;
+  unsigned long  failedCount;
+  unsigned long  retryCount;
+  unsigned long  multipleRetryCount;
+  unsigned long  frameDuplicateCount;
+  unsigned long  RTSSuccessCount;
+  unsigned long  RTSFailureCount;
+  unsigned long  ACKFailureCount;
+  unsigned long  receivedFragmentCount;
+  unsigned long  multicastReceivedFrameCount;
+  unsigned long  FCSErrorCount;
+  unsigned long  transmittedFrameCount;
+  unsigned long  WEPUndecryptableCount;
+
+  long           haveTransmittedFragmentCount;
+  long           haveMulticastTransmittedFrameCount;
+  long           haveFailedCount;
+  long           haveRetryCount;
+  long           haveMultipleRetryCount;
+  long           haveFrameDuplicateCount;
+  long           haveRTSSuccessCount;
+  long           haveRTSFailureCount;
+  long           haveACKFailureCount;
+  long           haveReceivedFragmentCount;
+  long           haveMulticastReceivedFrameCount;
+  long           haveFCSErrorCount;
+  long           haveTransmittedFrameCount;
+  long           haveWEPUndecryptableCount;
+
+} nCo, *co = &nCo;
+
+static avList_t coList;
+
+/****************************************************************************
+*                        dot11GroupAddressesTable                           *
+****************************************************************************/
+static struct gaTbl_data {
+
+  char  UID       [ GA_UID_LEN + 1 ];
+  char  ifName    [ IFNAME_LEN + 1 ];
+
+  long  ifIndex;                                    // ifindex of card
+  long  groupAddressesIndex;
+
+  char  address   [ MACADDR_LEN + 1 ];
+  long  groupAddressesStatus;
+
+  long  haveAddress;
+  long  haveGroupAddressesStatus;
+
+} nGa, *ga = &nGa;
+
+static avList_t gaList;
+
+/****************************************************************************
+*                               dot11Res Group                              *
+****************************************************************************/
+static char  resourceTypeIDName[] = "RTID";
+static long  haveResourceTypeIDName = 1;
+
+/****************************************************************************
+*                           dot11ResourceInfoTable                          *
+****************************************************************************/
+static struct riTbl_data {
+
+  char  UID       [ RI_UID_LEN + 1 ];               // unique ID
+  char  ifName    [ IFNAME_LEN + 1 ];               // ifName of card
+
+  long  ifIndex;                                    // ifindex of card
+
+  char  manufacturerOUI            [ MAN_OUI_LEN    + 1 ];
+  char  manufacturerName           [ SYS_STRING_LEN + 1 ];
+  char  manufacturerProductName    [ SYS_STRING_LEN + 1 ];
+  char  manufacturerProductVersion [ SYS_STRING_LEN + 1 ];
+
+  char  haveManufacturerOUI;
+  char  haveManufacturerName;
+  char  haveManufacturerProductName;
+  char  haveManufacturerProductVersion;
+
+} nRi, *ri = &nRi;
+
+static avList_t riList;
+
+/****************************************************************************
+*                               dot11Phy Group                              *
+****************************************************************************/
+/****************************************************************************
+*                           dot11PhyOperationTable                          *
+****************************************************************************/
+static struct poTbl_data {
+
+  char  UID       [ PO_UID_LEN + 1 ];               // unique ID
+  char  ifName    [ IFNAME_LEN + 1 ];               // ifName of card
+
+  long  ifIndex;                                    // ifindex of card
+
+  long  PHYType;
+  long  currentRegDomain;
+  long  tempType;
+
+  long  havePHYType;
+  long  haveCurrentRegDomain;
+  long  haveTempType;
+
+} nPo, *po = &nPo;
+
+static avList_t poList;
+
+/****************************************************************************
+*                           dot11PhyAntennaEntry                            *
+****************************************************************************/
+static struct paTbl_data {
+
+  char  UID       [ PA_UID_LEN + 1 ];               // unique ID
+  char  ifName    [ IFNAME_LEN + 1 ];               // ifName of card
+
+  long  ifIndex;                                    // ifindex of card
+
+  long  currentTxAntenna;
+  long  diversitySupport;
+  long  currentRxAntenna;
+
+  long  haveCurrentTxAntenna;
+  long  haveDiversitySupport;
+  long  haveCurrentRxAntenna;
+
+} nPa, *pa = &nPa;
+
+static avList_t paList;
+
+/****************************************************************************
+*                             dot11PhyTxPowerTable                          *
+****************************************************************************/
+static struct ptTbl_data {
+
+  char  UID       [ PT_UID_LEN + 1 ];               // unique ID
+  char  ifName    [ IFNAME_LEN + 1 ];               // ifName of card
+
+  long  ifIndex;                                    // ifindex of card
+
+  long  numberSupportedPowerLevels;
+  long  TxPowerLevel1;
+  long  TxPowerLevel2;
+  long  TxPowerLevel3;
+  long  TxPowerLevel4;
+  long  TxPowerLevel5;
+  long  TxPowerLevel6;
+  long  TxPowerLevel7;
+  long  TxPowerLevel8;
+  long  currentTxPowerLevel;
+
+  long  haveNumberSupportedPowerLevels;
+  long  haveTxPowerLevel1;
+  long  haveTxPowerLevel2;
+  long  haveTxPowerLevel3;
+  long  haveTxPowerLevel4;
+  long  haveTxPowerLevel5;
+  long  haveTxPowerLevel6;
+  long  haveTxPowerLevel7;
+  long  haveTxPowerLevel8;
+  long  haveCurrentTxPowerLevel ;
+
+} nPt, *pt = &nPt;
+
+static avList_t ptList;
+
+/****************************************************************************
+*                               dot11PhyFHSSTable                           *
+****************************************************************************/
+static struct pfTbl_data {
+
+  char  UID       [ PF_UID_LEN + 1 ];              // unique ID
+  char  ifName    [ IFNAME_LEN + 1 ];              // ifName of card
+
+  long  ifIndex;                                    // ifindex of card
+
+  long  hopTime;
+  long  currentChannelNumber;
+  long  maxDwellTime;
+  long  currentDwellTime;
+  long  currentSet;
+  long  currentPattern;
+  long  currentIndex;
+
+  long  haveHopTime;
+  long  haveCurrentChannelNumber;
+  long  haveMaxDwellTime;
+  long  haveCurrentDwellTime;
+  long  haveCurrentSet;
+  long  haveCurrentPattern;
+  long  haveCurrentIndex;
+
+} nPf, *pf = &nPf;
+
+static avList_t pfList;
+
+/****************************************************************************
+*                              dot11PhyDSSSTable                            *
+****************************************************************************/
+static struct pdTbl_data {
+
+  char  UID       [ PD_UID_LEN + 1 ];               // unique ID
+  char  ifName    [ IFNAME_LEN + 1 ];               // ifName of card
+
+  long  ifIndex;                                    // ifindex of card
+
+  long  currentChannel;
+  long  CCAModeSupported;
+  long  currentCCAMode;
+  long  EDThreshold;
+
+  long  haveCurrentChannel;
+  long  haveCCAModeSupported ;
+  long  haveCurrentCCAMode;
+  long  haveEDThreshold;
+
+} nPd, *pd = &nPd;
+
+static avList_t pdList;
+
+/****************************************************************************
+*                              dot11PhyIRTable                              *
+****************************************************************************/
+static struct piTbl_data {
+
+  char  UID       [ PI_UID_LEN + 1 ];               // unique ID
+  char  ifName    [ IFNAME_LEN + 1 ];               // ifName of card
+
+  long  ifIndex;                                    // ifindex of card
+
+  long  CCAWatchdogTimerMax;
+  long  CCAWatchdogCountMax;
+  long  CCAWatchdogTimerMin;
+  long  CCAWatchdogCountMin;
+
+  long  haveCCAWatchdogTimerMax;
+  long  haveCCAWatchdogCountMax;
+  long  haveCCAWatchdogTimerMin;
+  long  haveCCAWatchdogCountMin;
+
+} nPi, *pi = &nPi;
+
+static avList_t piList;
+
+/****************************************************************************
+*                      dot11RegDomainsSupportedTable                        *
+****************************************************************************/
+static struct rdTbl_data {
+
+  char  UID       [ RD_UID_LEN + 1 ];
+  char  ifName    [ IFNAME_LEN + 1 ];
+
+  long  ifIndex;                                    // ifindex of card
+  long  regDomainsSupportIndex;
+
+  long  regDomainsSupportValue;
+  long  haveRegDomainsSupportValue;
+
+} nRd, *rd = &nRd;
+
+static avList_t rdList;
+
+/****************************************************************************
+*                             dot11AntennasListTable                        *
+****************************************************************************/
+static struct alTbl_data {
+
+  char  UID       [ AL_UID_LEN + 1 ];
+  char  ifName    [ IFNAME_LEN + 1 ];
+
+  long  ifIndex;                                    // ifindex of card
+  long  antennaListIndex;
+
+  long  supportedTxAntenna;
+  long  supportedRxAntenna;
+  long  diversitySelectionRx ;
+
+  long  haveSupportedTxAntenna;
+  long  haveSupportedRxAntenna;
+  long  haveDiversitySelectionRx ;
+
+} nAl, *al = &nAl;
+
+static avList_t alList;
+
+/****************************************************************************
+*                    dot11SupportedDataRatesTxTable                         *
+****************************************************************************/
+static struct rtTbl_data {
+
+  char  UID       [ RT_UID_LEN + 1 ];
+  char  ifName    [ IFNAME_LEN + 1 ];
+
+  long  ifIndex;                                    // ifindex of card
+  long  supportedDataRatesTxIndex;
+
+  long  supportedDataRatesTxValue;
+  long  haveSupportedDataRatesTxValue;
+
+} nRt, *rt = &nRt;
+
+static avList_t rtList;
+
+/****************************************************************************
+*                    dot11SupportedDataRatesRxTable                         *
+****************************************************************************/
+static struct rrTbl_data {
+
+  char  UID       [ RR_UID_LEN + 1 ];
+  char  ifName    [ IFNAME_LEN + 1 ];
+
+  long  ifIndex;                                    // ifindex of card
+  long  supportedDataRatesRxIndex;
+
+  long  supportedDataRatesRxValue;
+  long  haveSupportedDataRatesRxValue;
+
+} nRr, *rr = &nRr;
+
+static avList_t rrList;
+
+/****************************************************************************
+*                       Wireless Extensions Structures                      *
+****************************************************************************/
+static long wepCurrentKey;
+static long haveWepCurrentKey;
+static struct wepTbl_data {
+
+  long len;
+  char key [ WEP_STR_LEN + 1 ];
+  long haveKey;
+
+} wep[4];
+
+/****************************************************************************
+*                                                                           *
+****************************************************************************/
+config_require(util_funcs)
+
+/* function prototypes */
+
+void   init_ieee802dot11 ( void );
+FindVarMethod var_ieee802dot11;
+FindVarMethod var_dot11StationConfigTable;
+FindVarMethod var_dot11AuthenticationAlgorithmsTable;
+FindVarMethod var_dot11WEPDefaultKeysTable;
+FindVarMethod var_dot11WEPKeyMappingsTable;
+FindVarMethod var_dot11PrivacyTable;
+FindVarMethod var_dot11OperationTable;
+FindVarMethod var_dot11CountersTable;
+FindVarMethod var_dot11GroupAddressesTable;
+FindVarMethod var_dot11ResourceInfoTable;
+FindVarMethod var_dot11PhyOperationTable;
+FindVarMethod var_dot11PhyAntennaTable;
+FindVarMethod var_dot11PhyTxPowerTable;
+FindVarMethod var_dot11PhyFHSSTable;
+FindVarMethod var_dot11PhyDSSSTable;
+FindVarMethod var_dot11PhyIRTable;
+FindVarMethod var_dot11RegDomainsSupportedTable;
+FindVarMethod var_dot11AntennasListTable;
+FindVarMethod var_dot11SupportedDataRatesTxTable;
+FindVarMethod var_dot11SupportedDataRatesRxTable;
+
+WriteMethod write_dot11StationID;
+WriteMethod write_dot11MediumOccupancyLimit;
+WriteMethod write_dot11CFPPeriod;
+WriteMethod write_dot11CFPMaxDuration;
+WriteMethod write_dot11AuthenticationResponseTimeOut;
+WriteMethod write_dot11PowerManagementMode;
+WriteMethod write_dot11DesiredSSID;
+WriteMethod write_dot11DesiredBSSType;
+WriteMethod write_dot11OperationalRateSet;
+WriteMethod write_dot11BeaconPeriod;
+WriteMethod write_dot11DTIMPeriod;
+WriteMethod write_dot11AssociationResponseTimeOut;
+WriteMethod write_dot11AuthenticationAlgorithmsEnable;
+WriteMethod write_dot11WEPDefaultKeyValue;
+WriteMethod write_dot11WEPKeyMappingAddress;
+WriteMethod write_dot11WEPKeyMappingWEPOn;
+WriteMethod write_dot11WEPKeyMappingValue;
+WriteMethod write_dot11WEPKeyMappingStatus;
+WriteMethod write_dot11PrivacyInvoked;
+WriteMethod write_dot11WEPDefaultKeyID;
+WriteMethod write_dot11WEPKeyMappingLength;
+WriteMethod write_dot11ExcludeUnencrypted;
+WriteMethod write_dot11RTSThreshold;
+WriteMethod write_dot11ShortRetryLimit;
+WriteMethod write_dot11LongRetryLimit;
+WriteMethod write_dot11FragmentationThreshold;
+WriteMethod write_dot11MaxTransmitMSDULifetime;
+WriteMethod write_dot11MaxReceiveLifetime;
+WriteMethod write_dot11Address;
+WriteMethod write_dot11GroupAddressesStatus;
+WriteMethod write_dot11CurrentRegDomain;
+WriteMethod write_dot11CurrentTxAntenna;
+WriteMethod write_dot11CurrentRxAntenna;
+WriteMethod write_dot11CurrentTxPowerLevel;
+WriteMethod write_dot11CurrentChannelNumber;
+WriteMethod write_dot11CurrentDwellTime;
+WriteMethod write_dot11CurrentSet;
+WriteMethod write_dot11CurrentPattern;
+WriteMethod write_dot11CurrentIndex;
+WriteMethod write_dot11CurrentChannel;
+WriteMethod write_dot11CurrentCCAMode;
+WriteMethod write_dot11EDThreshold;
+WriteMethod write_dot11CCAWatchdogTimerMax;
+WriteMethod write_dot11CCAWatchdogCountMax;
+WriteMethod write_dot11CCAWatchdogTimerMin;
+WriteMethod write_dot11CCAWatchdogCountMin;
+WriteMethod write_dot11SupportedTxAntenna;
+WriteMethod write_dot11SupportedRxAntenna;
+WriteMethod write_dot11DiversitySelectionRx;
+
+#endif /* _MIBGROUP_IEEE802DOT11_H */
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/ipfwchains/.cvsignore tomato121/release/src/router/snmp/agent/mibgroup/ipfwchains/.cvsignore
--- tomato/release/src/router/snmp/agent/mibgroup/ipfwchains/.cvsignore	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/ipfwchains/.cvsignore	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,2 @@
+.libs
+*.lo
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/ipfwchains/README tomato121/release/src/router/snmp/agent/mibgroup/ipfwchains/README
--- tomato/release/src/router/snmp/agent/mibgroup/ipfwchains/README	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/ipfwchains/README	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,4 @@
+Due to GPL restrictions in the most current version of the mib module, 
+the ipfchains package is now distributed separately.  You can get it
+from ftp://ftp.freesnmp.com/mirrors/ucd-snmp/contrib/ucd-ipchains.tar.gz
+instead.
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/iwlib.h tomato121/release/src/router/snmp/agent/mibgroup/iwlib.h
--- tomato/release/src/router/snmp/agent/mibgroup/iwlib.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/iwlib.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,502 @@
+/*
+ *	Wireless Tools
+ *
+ *		Jean II - HPLB 97->99 - HPL 99->02
+ *
+ * Common header for the Wireless Extension library...
+ *
+ * This file is released under the GPL license.
+ *     Copyright (c) 1997-2002 Jean Tourrilhes <jt@hpl.hp.com>
+ */
+
+#ifndef IWLIB_H
+#define IWLIB_H
+
+/*#include "CHANGELOG.h"*/
+
+/***************************** INCLUDES *****************************/
+
+/* Standard headers */
+#include <sys/types.h>
+#include <sys/ioctl.h>
+#include <stdio.h>
+#include <math.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <ctype.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <netdb.h>		/* gethostbyname, getnetbyname */
+#include <net/ethernet.h>	/* struct ether_addr */
+#include <sys/time.h>		/* struct timeval */
+#include <unistd.h>
+
+/* This is our header selection. Try to hide the mess and the misery :-(
+ * Don't look, you would go blind ;-) */
+
+#ifndef LINUX_VERSION_CODE
+#include <linux/version.h>
+#endif
+
+/* Kernel headers 2.4.X + Glibc 2.2 - Mandrake 8.0, Debian 2.3, RH 7.1
+ * Kernel headers 2.2.X + Glibc 2.2 - Slackware 8.0 */
+#if defined(__GLIBC__) \
+    && __GLIBC__ == 2 \
+    && __GLIBC_MINOR__ >= 2 \
+    && LINUX_VERSION_CODE >= KERNEL_VERSION(2,2,0)
+//#define GLIBC22_HEADERS
+#define GENERIC_HEADERS
+
+/* Kernel headers 2.4.X + Glibc 2.1 - Debian 2.2 upgraded, RH 7.0
+ * Kernel headers 2.2.X + Glibc 2.1 - Debian 2.2, RH 6.1 */
+#elif defined(__GLIBC__) \
+      && __GLIBC__ == 2 \
+      && __GLIBC_MINOR__ == 1 \
+      && LINUX_VERSION_CODE >= KERNEL_VERSION(2,2,0)
+//#define GLIBC_HEADERS
+#define GENERIC_HEADERS
+
+/* Kernel headers 2.2.X + Glibc 2.0 - Debian 2.1 */
+#elif defined(__GLIBC__) \
+      && __GLIBC__ == 2 \
+      && __GLIBC_MINOR__ == 0 \
+      && LINUX_VERSION_CODE >= KERNEL_VERSION(2,0,0) \
+      && LINUX_VERSION_CODE < KERNEL_VERSION(2,1,0)
+#define GLIBC_HEADERS
+#define KLUDGE_HEADERS
+
+/* Note : is it really worth supporting kernel 2.0.X, knowing that
+ * we require WE v9, which is only available in 2.2.X and higher ?
+ * I guess one could use 2.0.x with an upgraded wireless.h... */
+
+/* Kernel headers 2.0.X + Glibc 2.0 - Debian 2.0, RH 5 */
+#elif defined(__GLIBC__) \
+      && __GLIBC__ == 2 \
+      && __GLIBC_MINOR__ == 0 \
+      && LINUX_VERSION_CODE < KERNEL_VERSION(2,1,0) \
+      && LINUX_VERSION_CODE >= KERNEL_VERSION(2,0,0)
+#define GLIBC_HEADERS
+
+/* Kernel headers 2.0.X + libc5 - old systems */
+#elif defined(_LINUX_C_LIB_VERSION_MAJOR) \
+      && _LINUX_C_LIB_VERSION_MAJOR == 5 \
+      && LINUX_VERSION_CODE >= KERNEL_VERSION(2,0,0) \
+      && LINUX_VERSION_CODE < KERNEL_VERSION(2,1,0)
+#define LIBC5_HEADERS
+
+/* Unsupported combination */
+#else
+#error "Your kernel/libc combination is not supported"
+#endif
+
+#ifdef GENERIC_HEADERS 
+/* Proposed by Dr. Michael Rietz <rietz@mail.amps.de>, 27.3.2 */
+/* If this works for all, it might be more stable on the long term - Jean II */
+#include <net/if_arp.h>		/* For ARPHRD_ETHER */
+#include <sys/socket.h>		/* For AF_INET & struct sockaddr */
+#include <netinet/in.h>         /* For struct sockaddr_in */
+#include <netinet/if_ether.h>
+#endif /* GENERIC_HEADERS */    
+
+#ifdef GLIBC22_HEADERS 
+/* Added by Ross G. Miller <Ross_Miller@baylor.edu>, 3/28/01 */
+#include <linux/if_arp.h> 	/* For ARPHRD_ETHER */
+#include <linux/socket.h>	/* For AF_INET & struct sockaddr */
+#include <sys/socket.h>
+#endif /* GLIBC22_HEADERS */    
+
+#ifdef KLUDGE_HEADERS
+#include <socketbits.h>
+#endif	/* KLUDGE_HEADERS */
+
+#ifdef GLIBC_HEADERS
+#include <linux/if_arp.h>	/* For ARPHRD_ETHER */
+#include <linux/socket.h>	/* For AF_INET & struct sockaddr */
+#include <linux/in.h>		/* For struct sockaddr_in */
+#endif	/* KLUDGE_HEADERS || GLIBC_HEADERS */
+
+#ifdef LIBC5_HEADERS
+#include <sys/socket.h>		/* For AF_INET & struct sockaddr & socket() */
+#include <linux/if_arp.h>	/* For ARPHRD_ETHER */
+#include <linux/in.h>		/* For struct sockaddr_in */
+#endif	/* LIBC5_HEADERS */
+
+/* Those 3 headers were previously included in wireless.h */
+#include <linux/types.h>		/* for "caddr_t" et al		*/
+#include <linux/socket.h>		/* for "struct sockaddr" et al	*/
+#include <linux/if.h>			/* for IFNAMSIZ and co... */
+
+#ifdef WEXT_HEADER
+/* Private copy of Wireless extensions */
+#include WEXT_HEADER
+#else	/* !WEXT_HEADER */
+/* System wide Wireless extensions */
+#include <linux/wireless.h>
+#endif	/* !WEXT_HEADER */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/****************************** DEBUG ******************************/
+
+
+/************************ CONSTANTS & MACROS ************************/
+
+/* Paths */
+#define PROC_NET_WIRELESS	"/proc/net/wireless"
+#define PROC_NET_DEV		"/proc/net/dev"
+
+/* Some usefull constants */
+#define KILO	1e3
+#define MEGA	1e6
+#define GIGA	1e9
+/* For doing log10/exp10 without libm */
+#define LOG10_MAGIC	1.25892541179
+
+/* Backward compatibility for Wireless Extension 9 */
+#ifndef IW_POWER_MODIFIER
+#define IW_POWER_MODIFIER	0x000F	/* Modify a parameter */
+#define IW_POWER_MIN		0x0001	/* Value is a minimum  */
+#define IW_POWER_MAX		0x0002	/* Value is a maximum */
+#define IW_POWER_RELATIVE	0x0004	/* Value is not in seconds/ms/us */
+#endif /* IW_POWER_MODIFIER */
+
+#ifndef IW_ENCODE_NOKEY
+#define IW_ENCODE_NOKEY         0x0800  /* Key is write only, so not here */
+#define IW_ENCODE_MODE		0xF000	/* Modes defined below */
+#endif /* IW_ENCODE_NOKEY */
+#ifndef IW_ENCODE_TEMP
+#define IW_ENCODE_TEMP		0x0400  /* Temporary key */
+#endif /* IW_ENCODE_TEMP */
+
+/* More backward compatibility */
+#ifndef SIOCSIWCOMMIT
+#define SIOCSIWCOMMIT	SIOCSIWNAME
+#endif /* SIOCSIWCOMMIT */
+
+/****************************** TYPES ******************************/
+
+/* Shortcuts */
+typedef struct iw_statistics	iwstats;
+typedef struct iw_range		iwrange;
+typedef struct iw_param		iwparam;
+typedef struct iw_freq		iwfreq;
+typedef struct iw_quality	iwqual;
+typedef struct iw_priv_args	iwprivargs;
+typedef struct sockaddr		sockaddr;
+
+/* Structure for storing all wireless information for each device
+ * This is pretty exhaustive... */
+typedef struct wireless_info
+{
+  char		name[IFNAMSIZ + 1];	/* Wireless/protocol name */
+  int		has_nwid;
+  iwparam	nwid;			/* Network ID */
+  int		has_freq;
+  double	freq;			/* Frequency/channel */
+  int		has_sens;
+  iwparam	sens;			/* sensitivity */
+  int		has_key;
+  unsigned char	key[IW_ENCODING_TOKEN_MAX];	/* Encoding key used */
+  int		key_size;		/* Number of bytes */
+  int		key_flags;		/* Various flags */
+  int		has_essid;
+  int		essid_on;
+  char		essid[IW_ESSID_MAX_SIZE + 1];	/* ESSID (extended network) */
+  int		has_nickname;
+  char		nickname[IW_ESSID_MAX_SIZE + 1]; /* NickName */
+  int		has_ap_addr;
+  sockaddr	ap_addr;		/* Access point address */
+  int		has_bitrate;
+  iwparam	bitrate;		/* Bit rate in bps */
+  int		has_rts;
+  iwparam	rts;			/* RTS threshold in bytes */
+  int		has_frag;
+  iwparam	frag;			/* Fragmentation threshold in bytes */
+  int		has_mode;
+  int		mode;			/* Operation mode */
+  int		has_power;
+  iwparam	power;			/* Power management parameters */
+  int		has_txpower;
+  iwparam	txpower;		/* Transmit Power in dBm */
+  int		has_retry;
+  iwparam	retry;			/* Retry limit or lifetime */
+
+  /* Stats */
+  iwstats	stats;
+  int		has_stats;
+  iwrange	range;
+  int		has_range;
+} wireless_info;
+
+/* Structure for storing all wireless information for each device
+ * This is a cut down version of the one above, containing only
+ * the things *truly* needed to configure a card.
+ * Don't add other junk, I'll remove it... */
+typedef struct wireless_config
+{
+  char		name[IFNAMSIZ + 1];	/* Wireless/protocol name */
+  int		has_nwid;
+  iwparam	nwid;			/* Network ID */
+  int		has_freq;
+  double	freq;			/* Frequency/channel */
+  int		has_key;
+  unsigned char	key[IW_ENCODING_TOKEN_MAX];	/* Encoding key used */
+  int		key_size;		/* Number of bytes */
+  int		key_flags;		/* Various flags */
+  int		has_essid;
+  int		essid_on;
+  char		essid[IW_ESSID_MAX_SIZE + 1];	/* ESSID (extended network) */
+  int		has_mode;
+  int		mode;			/* Operation mode */
+} wireless_config;
+
+typedef struct stream_descr
+{
+  char *	end;		/* End of the stream */
+  char *	current;	/* Current event in stream of events */
+  char *	value;		/* Current value in event */
+} stream_descr;
+
+/* Prototype for handling display of each single interface on the
+ * system - see iw_enum_devices() */
+typedef int (*iw_enum_handler)(int	skfd,
+			       char *	ifname,
+			       char *	args[],
+			       int	count);
+
+/**************************** PROTOTYPES ****************************/
+/*
+ * All the functions in iwcommon.c
+ */
+
+/* ---------------------- SOCKET SUBROUTINES -----------------------*/
+int
+	iw_sockets_open(void);
+void
+	iw_enum_devices(int		skfd,
+			iw_enum_handler fn,
+			char *		args[],
+			int		count);
+/* --------------------- WIRELESS SUBROUTINES ----------------------*/
+int
+	iw_get_range_info(int		skfd,
+			  char *	ifname,
+			  iwrange *	range);
+int
+	iw_print_version_info(char *	toolname);
+int
+	iw_get_priv_info(int		skfd,
+			 char *		ifname,
+			 iwprivargs *	priv,
+			 int		maxpriv);
+int
+	iw_get_basic_config(int			skfd,
+			    char *		ifname,
+			    wireless_config *	info);
+int
+	iw_set_basic_config(int			skfd,
+			    char *		ifname,
+			    wireless_config *	info);
+/* --------------------- PROTOCOL SUBROUTINES --------------------- */
+int
+	iw_protocol_compare(char *	protocol1,
+			    char *	protocol2);
+/* -------------------- FREQUENCY SUBROUTINES --------------------- */
+void
+	iw_float2freq(double	in,
+		   iwfreq *	out);
+double
+	iw_freq2float(iwfreq *	in);
+void
+	iw_print_freq(char *	buffer,
+		      double	freq);
+int
+	iw_freq_to_channel(double		freq,
+			   struct iw_range *	range);
+void
+	iw_print_bitrate(char *	buffer,
+			 int	bitrate);
+/* ---------------------- POWER SUBROUTINES ----------------------- */
+int
+	iw_dbm2mwatt(int	in);
+int
+	iw_mwatt2dbm(int	in);
+/* -------------------- STATISTICS SUBROUTINES -------------------- */
+int
+	iw_get_stats(int	skfd,
+		     char *	ifname,
+		     iwstats *	stats);
+void
+	iw_print_stats(char *		buffer,
+		       iwqual *		qual,
+		       iwrange *	range,
+		       int		has_range);
+/* --------------------- ENCODING SUBROUTINES --------------------- */
+void
+	iw_print_key(char *		buffer,
+		     unsigned char *	key,
+		     int		key_size,
+		     int		key_flags);
+int
+	iw_in_key(char *		input,
+		  unsigned char *	key);
+int
+	iw_in_key_full(int		skfd,
+		       char *		ifname,
+		       char *		input,
+		       unsigned char *	key,
+		       __u16 *		flags);
+/* ----------------- POWER MANAGEMENT SUBROUTINES ----------------- */
+void
+	iw_print_pm_value(char *	buffer,
+			  int		value,
+			  int		flags);
+void
+	iw_print_pm_mode(char *		buffer,
+			 int		flags);
+/* --------------- RETRY LIMIT/LIFETIME SUBROUTINES --------------- */
+#if WIRELESS_EXT > 10
+void
+	iw_print_retry_value(char *	buffer,
+			     int	value,
+			     int	flags);
+#endif
+/* ----------------------- TIME SUBROUTINES ----------------------- */
+void
+	iw_print_timeval(char *			buffer,
+			 const struct timeval *	time);
+/* --------------------- ADDRESS SUBROUTINES ---------------------- */
+int
+	iw_check_mac_addr_type(int	skfd,
+			       char *	ifname);
+int
+	iw_check_if_addr_type(int	skfd,
+			      char *	ifname);
+#if 0
+int
+	iw_check_addr_type(int		skfd,
+			   char *	ifname);
+#endif
+void
+	iw_ether_ntop(const struct ether_addr* eth, char* buf);
+char*
+	iw_ether_ntoa(const struct ether_addr* eth);
+int
+	iw_ether_aton(const char* bufp, struct ether_addr* eth);
+int
+	iw_in_inet(char *bufp, struct sockaddr *sap);
+int
+	iw_in_addr(int			skfd,
+		   char *		ifname,
+		   char *		bufp,
+		   struct sockaddr *	sap);
+/* ----------------------- MISC SUBROUTINES ------------------------ */
+int
+	iw_get_priv_size(int		args);
+
+#if WIRELESS_EXT > 13
+/* ---------------------- EVENT SUBROUTINES ---------------------- */
+void
+	iw_init_event_stream(struct stream_descr *	stream,
+			     char *			data,
+			     int			len);
+int
+	iw_extract_event_stream(struct stream_descr *	stream,
+				struct iw_event *	iwe);
+#endif /* WIRELESS_EXT > 13 */
+
+/**************************** VARIABLES ****************************/
+
+extern const char * const	iw_operation_mode[];
+#define IW_NUM_OPER_MODE	7
+
+/************************* INLINE FUNTIONS *************************/
+/*
+ * Functions that are so simple that it's more efficient inlining them
+ */
+
+/*
+ * Note : I've defined wrapper for the ioctl request so that
+ * it will be easier to migrate to other kernel API if needed
+ */
+
+/*------------------------------------------------------------------*/
+/*
+ * Wrapper to push some Wireless Parameter in the driver
+ */
+static inline int
+iw_set_ext(int			skfd,		/* Socket to the kernel */
+	   char *		ifname,		/* Device name */
+	   int			request,	/* WE ID */
+	   struct iwreq *	pwrq)		/* Fixed part of the request */
+{
+  /* Set device name */
+  strncpy(pwrq->ifr_name, ifname, IFNAMSIZ);
+  /* Do the request */
+  return(ioctl(skfd, request, pwrq));
+}
+
+/*------------------------------------------------------------------*/
+/*
+ * Wrapper to extract some Wireless Parameter out of the driver
+ */
+static inline int
+iw_get_ext(int			skfd,		/* Socket to the kernel */
+	   char *		ifname,		/* Device name */
+	   int			request,	/* WE ID */
+	   struct iwreq *	pwrq)		/* Fixed part of the request */
+{
+  /* Set device name */
+  strncpy(pwrq->ifr_name, ifname, IFNAMSIZ);
+  /* Do the request */
+  return(ioctl(skfd, request, pwrq));
+}
+
+/*------------------------------------------------------------------*/
+/* Backwards compatability
+ * Actually, those form are much easier to use when dealing with
+ * struct sockaddr... */
+static inline char*
+iw_pr_ether(char* bufp, const unsigned char* addr)
+{
+  iw_ether_ntop((const struct ether_addr *) addr, bufp);
+  return bufp;
+}
+/* Backwards compatability */
+static inline int
+iw_in_ether(const char *bufp, struct sockaddr *sap)
+{
+  sap->sa_family = ARPHRD_ETHER;
+  return iw_ether_aton(bufp, (struct ether_addr *) sap->sa_data) ? 0 : -1;
+}
+
+/*------------------------------------------------------------------*/
+/*
+ * Create an Ethernet broadcast address
+ */
+static inline void
+iw_broad_ether(struct sockaddr *sap)
+{
+  sap->sa_family = ARPHRD_ETHER;
+  memset((char *) sap->sa_data, 0xFF, ETH_ALEN);
+}
+
+/*------------------------------------------------------------------*/
+/*
+ * Create an Ethernet NULL address
+ */
+static inline void
+iw_null_ether(struct sockaddr *sap)
+{
+  sap->sa_family = ARPHRD_ETHER;
+  memset((char *) sap->sa_data, 0x00, ETH_ALEN);
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif	/* IWLIB_H */
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/kernel_sunos5.c tomato121/release/src/router/snmp/agent/mibgroup/kernel_sunos5.c
--- tomato/release/src/router/snmp/agent/mibgroup/kernel_sunos5.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/kernel_sunos5.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,1244 @@
+/*- This is a -*- C -*- compatible code file
+ *
+ * Code for SUNOS5_INSTRUMENTATION
+ *
+ * This file contains includes of standard and local system header files,
+ * includes of other application header files, global variable definitions,
+ * static variable definitions, static function prototypes, and function
+ * definitions.
+ *
+ * This file contains function to obtain statistics from SunOS 5.x kernel
+ *
+ */
+
+#include <net-snmp/net-snmp-config.h>
+#ifdef solaris2
+/*-
+ * Includes of standard ANSI C header files 
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+
+/*-
+ * Includes of system header files (wrapped in duplicate include prevention)
+ */
+
+#include <fcntl.h>
+#include <stropts.h>
+#include <sys/types.h>
+#include <kvm.h>
+#include <sys/fcntl.h>
+#include <kstat.h>
+#include <errno.h>
+#include <time.h>
+
+#include <sys/sockio.h>
+#include <sys/socket.h>
+#include <sys/stream.h>
+#include <sys/stropts.h>
+#include <sys/tihdr.h>
+#include <sys/tiuser.h>
+#include <inet/common.h>
+#include <inet/mib2.h>
+#include <inet/ip.h>
+#include <net/if.h>
+#include <netinet/in.h>
+
+/*-
+ * Includes of local application header files 
+ */
+
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+#include "kernel_sunos5.h"
+
+kstat_ctl_t    *kstat_fd = 0;
+
+/*-
+ * Global variable definitions (with initialization)
+ */
+
+/*-
+ * Static variable definitions (with initialization)
+ */
+
+static
+mibcache        Mibcache[MIBCACHE_SIZE] = {
+    {MIB_SYSTEM, 0, (void *) -1, 0, 0, 0, 0},
+    {MIB_INTERFACES, 10 * sizeof(mib2_ifEntry_t), (void *) -1, 0, 10, 0,
+     0},
+    {MIB_AT, 0, (void *) -1, 0, 0, 0, 0},
+    {MIB_IP, sizeof(mib2_ip_t), (void *) -1, 0, 20, 0, 0},
+    {MIB_IP_ADDR, 20 * sizeof(mib2_ipAddrEntry_t), (void *) -1, 0, 20, 0,
+     0},
+    {MIB_IP_ROUTE, 200 * sizeof(mib2_ipRouteEntry_t), (void *) -1, 0, 10,
+     0, 0},
+    {MIB_IP_NET, 100 * sizeof(mib2_ipNetToMediaEntry_t), (void *) -1, 0,
+     100, 0, 0},
+    {MIB_ICMP, sizeof(mib2_icmp_t), (void *) -1, 0, 20, 0, 0},
+    {MIB_TCP, sizeof(mib2_tcp_t), (void *) -1, 0, 20, 0, 0},
+    {MIB_TCP_CONN, 1000 * sizeof(mib2_tcpConnEntry_t), (void *) -1, 0, 15,
+     0, 0},
+    {MIB_UDP, sizeof(mib2_udp_t), (void *) -1, 0, 15, 0, 0},
+    {MIB_UDP_LISTEN, 1000 * sizeof(mib2_udpEntry_t), (void *) -1, 0, 15, 0,
+     0},
+    {MIB_EGP, 0, (void *) -1, 0, 0, 0, 0},
+    {MIB_CMOT, 0, (void *) -1, 0, 0, 0, 0},
+    {MIB_TRANSMISSION, 0, (void *) -1, 0, 0, 0, 0},
+    {MIB_SNMP, 0, (void *) -1, 0, 0, 0, 0},
+    {0},
+};
+
+static
+mibmap          Mibmap[MIBCACHE_SIZE] = {
+    {MIB2_SYSTEM, 0,},
+    {MIB2_INTERFACES, 0,},
+    {MIB2_AT, 0,},
+    {MIB2_IP, 0,},
+    {MIB2_IP, MIB2_IP_20,},
+    {MIB2_IP, MIB2_IP_21,},
+    {MIB2_IP, MIB2_IP_22,},
+    {MIB2_ICMP, 0,},
+    {MIB2_TCP, 0,},
+    {MIB2_TCP, MIB2_TCP_13,},
+    {MIB2_UDP, 0,},
+    {MIB2_UDP, MIB2_UDP_5},
+    {MIB2_EGP, 0,},
+    {MIB2_CMOT, 0,},
+    {MIB2_TRANSMISSION, 0,},
+    {MIB2_SNMP, 0,},
+    {0},
+};
+
+static int      sd = -1;        /* /dev/ip stream descriptor. */
+
+/*-
+ * Static function prototypes (use void as argument type if there are none)
+ */
+
+static found_e
+getentry(req_e req_type, void *bufaddr, size_t len, size_t entrysize,
+         void *resp, int (*comp)(void *, void *), void *arg);
+
+static int
+getmib(int groupname, int subgroupname, void *statbuf, size_t size,
+       size_t entrysize, req_e req_type, void *resp, size_t *length,
+       int (*comp)(void *, void *), void *arg);
+
+static int
+getif(mib2_ifEntry_t *ifbuf, size_t size, req_e req_type, mib2_ifEntry_t *resp,
+      size_t *length, int (*comp)(void *, void *), void *arg);
+
+static int
+Name_cmp(void *, void *);
+
+static void
+init_mibcache_element(mibcache * cp);
+
+#define	STREAM_DEV	"/dev/ip"
+#define	BUFSIZE		40960   /* Buffer for  messages (should be modulo(pagesize) */
+
+/*-
+ * Function definitions
+ */
+
+#ifdef _STDC_COMPAT
+#ifdef __cplusplus
+extern          "C" {
+#endif
+#endif
+
+/*
+ * I profiled snmpd using Quantify on a Solaris 7 box, and it turned out that
+ * the calls to time() in getMibstat() were taking 18% of the total execution
+ * time of snmpd when doing simple walks over the whole tree.  I guess it must
+ * be difficult for Sun hardware to tell the time or something ;-).  Anyway,
+ * this seemed like it was negating the point of having the cache, so I have
+ * changed the code so that it runs a periodic alarm to age the cache entries
+ * instead.  The meaning of the cache_ttl and cache_time members has changed to
+ * support this.  cache_ttl is now the value that cache_time gets reset to when
+ * we fetch a value from the kernel; cache_time then ticks down to zero in
+ * steps of period (see below).  When it reaches zero, the cache entry is no
+ * longer valid and we fetch a new one.  The effect of this is the same as the
+ * previous code, but more efficient (because it's not calling time() for every
+ * variable fetched) when you are walking the tables.  jbpn, 20020226.
+ */
+
+static void
+kernel_sunos5_cache_age(unsigned int regnumber, void *data)
+{
+    int i = 0, period = (int)data;
+
+    for (i = 0; i < MIBCACHE_SIZE; i++) {
+	DEBUGMSGTL(("kernel_sunos5", "cache[%d] time %ld ttl %d\n", i,
+		    Mibcache[i].cache_time, Mibcache[i].cache_ttl));
+	if (Mibcache[i].cache_time < period) {
+	    Mibcache[i].cache_time = 0;
+	} else {
+	    Mibcache[i].cache_time -= period;
+	}
+    }
+}
+
+void
+init_kernel_sunos5(void)
+{
+    static int creg   = 0;
+    const  int period = 5;
+
+    if (creg == 0) {
+	creg = snmp_alarm_register(period, SA_REPEAT, kernel_sunos5_cache_age,
+				   (void *)period);
+	DEBUGMSGTL(("kernel_sunos5", "registered alarm %d with period %ds\n", 
+		    creg, period));
+    }
+}
+
+/*
+ * Get various kernel statistics using undocumented Solaris kstat interface.
+ * We need it mainly for getting network interface statistics, although it is
+ * generic enough to be used for any purpose.  It knows about kstat_headers
+ * module names and by the name of the statistics it tries to figure out the
+ * rest of necessary information.  Returns 0 in case of success and < 0 if
+ * there were any errors.
+ 
+ * 
+ * NOTE: To use this function correctly you have to know the actual type of the
+ * value to be returned, so you may build the test program, figure out the type
+ * and use it. Exposing kstat data types to upper layers doesn't seem to be
+ * reasonable. In any case I'd expect more reasonable kstat interface. :-(
+ */
+
+
+int
+getKstatInt(const char *classname, const char *statname, 
+	    const char *varname, int *value)
+{
+    kstat_ctl_t    *ksc;
+    kstat_t        *ks;
+    kid_t           kid;
+    kstat_named_t  *named;
+    int             ret = 0;        /* fail unless ... */
+
+    if (kstat_fd == 0) {
+	kstat_fd = kstat_open();
+	if (kstat_fd == 0) {
+	    snmp_log(LOG_ERR, "kstat_open(): failed\n");
+	}
+    }
+    if ((ksc = kstat_fd) == NULL) {
+	goto Return;
+    }
+    ks = kstat_lookup(ksc, classname, -1, statname);
+    if (ks == NULL) {
+	goto Return;
+    }
+    kid = kstat_read(ksc, ks, NULL);
+    if (kid == -1) {
+	goto Return;
+    }
+    named = kstat_data_lookup(ks, varname);
+    if (named == NULL) {
+	goto Return;
+    }
+
+    ret = 1;                /* maybe successful */
+    switch (named->data_type) {
+#ifdef KSTAT_DATA_INT32         /* Solaris 2.6 and up */
+    case KSTAT_DATA_INT32:
+	*value = named->value.i32;
+	break;
+    case KSTAT_DATA_UINT32:
+	*value = named->value.ui32;
+	break;
+    case KSTAT_DATA_INT64:
+	*value = named->value.i64;
+	break;
+    case KSTAT_DATA_UINT64:
+	*value = named->value.ui64;
+	break;
+#else
+    case KSTAT_DATA_LONG:
+	*value = named->value.l;
+	break;
+    case KSTAT_DATA_ULONG:
+	*value = named->value.ul;
+	break;
+    case KSTAT_DATA_LONGLONG:
+	*value = named->value.ll;
+	break;
+    case KSTAT_DATA_ULONGLONG:
+	*value = named->value.ull;
+	break;
+#endif
+    default:
+	DEBUGMSGTL(("kernel_sunos5", 
+		    "non-int type in kstat data: \"%s\" \"%s\" \"%s\" %d\n",
+		    classname, statname, varname, named->data_type));
+	ret = 0;            /* fail */
+	break;
+    }
+ Return:
+    return ret;
+}
+
+int
+getKstat(const char *statname, const char *varname, void *value)
+{
+    kstat_ctl_t    *ksc;
+    kstat_t        *ks, *kstat_data;
+    kstat_named_t  *d;
+    size_t          i, instance;
+    char            module_name[64];
+    int             ret;
+    u_longlong_t    val;    /* The largest value */
+    void           *v;
+
+    if (value == NULL) {      /* Pretty useless but ... */
+	v = (void *) &val;
+    } else {
+	v = value;
+    }
+
+    if (kstat_fd == 0) {
+	kstat_fd = kstat_open();
+	if (kstat_fd == 0) {
+	    snmp_log(LOG_ERR, "kstat_open(): failed\n");
+	}
+    }
+    if ((ksc = kstat_fd) == NULL) {
+	ret = -10;
+	goto Return;        /* kstat errors */
+    }
+    if (statname == NULL || varname == NULL) {
+	ret = -20;
+	goto Return;
+    }
+
+    /*
+     * First, get "kstat_headers" statistics. It should
+     * contain all available modules. 
+     */
+
+    if ((ks = kstat_lookup(ksc, "unix", 0, "kstat_headers")) == NULL) {
+	ret = -10;
+	goto Return;        /* kstat errors */
+    }
+    if (kstat_read(ksc, ks, NULL) <= 0) {
+	ret = -10;
+	goto Return;        /* kstat errors */
+    }
+    kstat_data = ks->ks_data;
+    
+    /*
+     * Now, look for the name of our stat in the headers buf 
+     */
+    for (i = 0; i < ks->ks_ndata; i++) {
+	DEBUGMSGTL(("kernel_sunos5",
+		    "module: %s instance: %d name: %s class: %s type: %d flags: %x\n",
+		    kstat_data[i].ks_module, kstat_data[i].ks_instance,
+		    kstat_data[i].ks_name, kstat_data[i].ks_class,
+		    kstat_data[i].ks_type, kstat_data[i].ks_flags));
+	if (strcmp(statname, kstat_data[i].ks_name) == 0) {
+	    strcpy(module_name, kstat_data[i].ks_module);
+	    instance = kstat_data[i].ks_instance;
+	    break;
+	}
+    }
+    
+    if (i == ks->ks_ndata) {
+	ret = -1;
+	goto Return;        /* Not found */
+    }
+    
+    /*
+     * Get the named statistics 
+     */
+    if ((ks = kstat_lookup(ksc, module_name, instance, statname)) == NULL) {
+	ret = -10;
+	goto Return;        /* kstat errors */
+    }
+
+    if (kstat_read(ksc, ks, NULL) <= 0) {
+	ret = -10;
+	goto Return;        /* kstat errors */
+    }
+    /*
+     * This function expects only name/value type of statistics, so if it is
+     * not the case return an error
+     */
+    if (ks->ks_type != KSTAT_TYPE_NAMED) {
+	ret = -2;
+	goto Return;        /* Invalid stat type */
+    }
+    
+    for (i = 0, d = KSTAT_NAMED_PTR(ks); i < ks->ks_ndata; i++, d++) {
+	DEBUGMSGTL(("kernel_sunos5", "variable: \"%s\" (type %d)\n", 
+		    d->name, d->data_type));
+
+	if (strcmp(d->name, varname) == 0) {
+	    switch (d->data_type) {
+	    case KSTAT_DATA_CHAR:
+		*(char *)v = (int)d->value.c;
+		DEBUGMSGTL(("kernel_sunos5", "value: %d\n", (int)d->value.c));
+		break;
+#ifdef KSTAT_DATA_INT32         /* Solaris 2.6 and up */
+	    case KSTAT_DATA_INT32:
+		*(Counter *)v = d->value.i32;
+		DEBUGMSGTL(("kernel_sunos5", "value: %d\n", d->value.i32));
+		break;
+	    case KSTAT_DATA_UINT32:
+		*(Counter *)v = d->value.ui32;
+		DEBUGMSGTL(("kernel_sunos5", "value: %u\n", d->value.ui32));
+		break;
+	    case KSTAT_DATA_INT64:
+		*(int64_t *)v = d->value.i64;
+		DEBUGMSGTL(("kernel_sunos5", "value: %ld\n", d->value.i64));
+		break;
+	    case KSTAT_DATA_UINT64:
+		*(uint64_t *)v = d->value.ui64;
+		DEBUGMSGTL(("kernel_sunos5", "value: %lu\n", d->value.ui64));
+		break;
+#else
+	    case KSTAT_DATA_LONG:
+		*(Counter *)v = d->value.l;
+		DEBUGMSGTL(("kernel_sunos5", "value: %ld\n", d->value.l));
+		break;
+	    case KSTAT_DATA_ULONG:
+		*(Counter *)v = d->value.ul;
+		DEBUGMSGTL(("kernel_sunos5", "value: %lu\n", d->value.ul));
+		break;
+	    case KSTAT_DATA_LONGLONG:
+		*(Counter *)v = d->value.ll;
+		DEBUGMSGTL(("kernel_sunos5", "value: %lld\n",
+			    (long)d->value.ll));
+		break;
+	    case KSTAT_DATA_ULONGLONG:
+		*(Counter *)v = d->value.ull;
+		DEBUGMSGTL(("kernel_sunos5", "value: %llu\n",
+			    (unsigned long)d->value.ull));
+		break;
+#endif
+	    case KSTAT_DATA_FLOAT:
+		*(float *)v = d->value.f;
+		DEBUGMSGTL(("kernel_sunos5", "value: %f\n", d->value.f));
+		break;
+	    case KSTAT_DATA_DOUBLE:
+		*(double *)v = d->value.d;
+		DEBUGMSGTL(("kernel_sunos5", "value: %f\n", d->value.d));
+		break;
+	    default:
+		DEBUGMSGTL(("kernel_sunos5",
+			    "UNKNOWN TYPE %d (stat \"%s\" var \"%s\")\n",
+			    d->data_type, statname, varname));
+		ret = -3;
+		goto Return;        /* Invalid data type */
+	    }
+	    ret = 0;        /* Success  */
+	    goto Return;
+	}
+    }
+    ret = -4;               /* Name not found */
+ Return:
+    return ret;
+}
+
+
+/*
+ * get MIB-II statistics. It maintaines a simple cache which buffers the last
+ * read block of MIB statistics (which may contain the whole table). It calls
+ * *comp to compare every entry with an entry pointed by arg. *comp should
+ * return 0 if comparison is successful.  Req_type may be GET_FIRST, GET_EXACT,
+ * GET_NEXT.  If search is successful getMibstat returns 0, otherwise 1.
+ */
+int
+getMibstat(mibgroup_e grid, void *resp, size_t entrysize,
+	   req_e req_type, int (*comp) (void *, void *), void *arg)
+{
+    int             ret, rc = -1, mibgr, mibtb, cache_valid;
+    size_t          length;
+    mibcache       *cachep;
+    found_e         result = NOT_FOUND;
+    void           *ep;
+
+    /*
+     * We assume that Mibcache is initialized in mibgroup_e enum order so we
+     * don't check the validity of index here.
+     */
+
+    DEBUGMSGTL(("kernel_sunos5", "getMibstat (%d, *, %d, %d, *, *)\n",
+		grid, entrysize, req_type));
+    cachep = &Mibcache[grid];
+    mibgr = Mibmap[grid].group;
+    mibtb = Mibmap[grid].table;
+
+    if (cachep->cache_addr == (void *) -1)  /* Hasn't been initialized yet */
+	init_mibcache_element(cachep);
+    if (cachep->cache_size == 0) {  /* Memory allocation problems */
+	cachep->cache_addr = resp;  /* So use caller supplied address instead of cache */
+	cachep->cache_size = entrysize;
+	cachep->cache_last_found = 0;
+    }
+    if (req_type != GET_NEXT)
+	cachep->cache_last_found = 0;
+
+    cache_valid = (cachep->cache_time > 0);
+
+    DEBUGMSGTL(("kernel_sunos5","... cache_valid %d time %ld ttl %d now %ld\n",
+		cache_valid, cachep->cache_time, cachep->cache_ttl,
+		time(NULL)));
+    if (cache_valid) {
+	/*
+	 * Is it really? 
+	 */
+	if (cachep->cache_comp != (void *)comp || cachep->cache_arg != arg) {
+	    cache_valid = 0;        /* Nope. */
+	}
+    }
+
+    if (cache_valid) {
+	/*
+	 * Entry is valid, let's try to find a match 
+	 */
+
+	if (req_type == GET_NEXT) {
+	    result = getentry(req_type,
+			      (void *)((char *)cachep->cache_addr +
+				       (cachep->cache_last_found * entrysize)),
+			      cachep->cache_length -
+			      (cachep->cache_last_found * entrysize),
+			      entrysize, &ep, comp, arg);
+            } else {
+                result = getentry(req_type, cachep->cache_addr,
+				  cachep->cache_length, entrysize, &ep, comp,
+				  arg);
+            }
+    }
+
+    if ((cache_valid == 0) || (result == NOT_FOUND) ||
+	(result == NEED_NEXT && cachep->cache_flags & CACHE_MOREDATA)) {
+	/*
+	 * Either the cache is old, or we haven't found anything, or need the
+	 * next item which hasn't been read yet.  In any case, fill the cache
+	 * up and try to find our entry.
+	 */
+
+	if (grid == MIB_INTERFACES) {
+	    rc = getif((mib2_ifEntry_t *) cachep->cache_addr,
+		       cachep->cache_size, req_type,
+		       (mib2_ifEntry_t *) & ep, &length, comp, arg);
+	} else {
+	    rc = getmib(mibgr, mibtb, cachep->cache_addr,
+			cachep->cache_size, entrysize, req_type, &ep,
+			&length, comp, arg);
+	}
+
+	if (rc >= 0) {      /* Cache has been filled up */
+	    cachep->cache_time = cachep->cache_ttl;
+	    cachep->cache_length = length;
+	    if (rc == 1)    /* Found but there are more unread data */
+		cachep->cache_flags |= CACHE_MOREDATA;
+	    else {
+		cachep->cache_flags &= ~CACHE_MOREDATA;
+                if (rc > 1)  {
+                    cachep->cache_time = 0;
+                    }
+                 }
+	    cachep->cache_comp = (void *) comp;
+	    cachep->cache_arg = arg;
+	} else {
+	    cachep->cache_comp = NULL;
+	    cachep->cache_arg = NULL;
+	}
+    }
+    DEBUGMSGTL(("kernel_sunos5", "... result %d rc %d\n", result, rc));
+    
+    if (result == FOUND || rc == 0 || rc == 1) {
+	/*
+	 * Entry has been found, deliver it 
+	 */
+	if (resp != NULL) {
+	    memcpy(resp, ep, entrysize);
+	}
+	ret = 0;
+	cachep->cache_last_found =
+	    ((char *)ep - (char *)cachep->cache_addr) / entrysize;
+    } else {
+	ret = 1;            /* Not found */
+    }
+    DEBUGMSGTL(("kernel_sunos5", "... getMibstat returns %d\n", ret));
+    return ret;
+}
+
+/*
+ * Get a MIB-II entry from the buffer buffaddr, which satisfies the criterion,
+ * computed by (*comp), which gets arg as the first argument and pointer to the
+ * current position in the buffer as the second. If found entry is pointed by
+ * resp.
+ */
+
+static found_e
+getentry(req_e req_type, void *bufaddr, size_t len,
+	 size_t entrysize, void *resp, int (*comp)(void *, void *),
+	 void *arg)
+{
+    void *bp = bufaddr, **rp = resp;
+    int previous_found = 0;
+    
+    /*
+     * Here we have to perform address arithmetic with pointer to void. Ugly...
+     */
+
+    for (; len > 0; len -= entrysize, bp = (char *) bp + entrysize) {
+	if (rp != (void *) NULL) {
+	    *rp = bp;
+	}
+
+	if (req_type == GET_FIRST || (req_type == GET_NEXT && previous_found)){
+	    return FOUND;
+	}
+
+	if ((*comp)(arg, bp) == 0) {
+	    if (req_type == GET_EXACT) {
+		return FOUND;
+	    } else {        /* GET_NEXT */
+		previous_found++;
+		continue;
+	    }
+	}
+    }
+
+    if (previous_found) {
+	return NEED_NEXT;
+    } else {
+	return NOT_FOUND;
+    }
+}
+
+/*
+ * Initialize a cache element. It allocates the memory and sets the time stamp
+ * to invalidate the element.
+ */
+static void
+init_mibcache_element(mibcache * cp)
+{
+    if (cp == (mibcache *)NULL) {
+	return;
+    }
+    if (cp->cache_size) {
+	cp->cache_addr = malloc(cp->cache_size);
+    }
+    cp->cache_time = 0;
+    cp->cache_comp = NULL;
+    cp->cache_arg = NULL;
+}
+
+/*
+ * Get MIB-II statistics from the Solaris kernel.  It uses undocumented
+ * interface to TCP/IP streams modules, which provides extended MIB-II for the
+ * following groups: ip, icmp, tcp, udp, egp.
+ 
+ * 
+ * Usage: groupname, subgroupname are from <inet/mib2.h>, 
+ *        size%sizeof(statbuf) == 0,
+ *        entrysize should be exact size of MIB-II entry,
+ *        req_type:
+ *                   GET_FIRST - get the first entry in the buffer
+ *                   GET_EXACT - get exact match
+ *                   GET_NEXT  - get next entry after the exact match
+ * 
+ * (*comp) is a compare function, provided by the caller, which gets arg as the
+ * first argument and pointer to the current entry as th second. If compared,
+ * should return 0 and found entry will be pointed by resp.
+ * 
+ * If search is successful and no more data to read, it returns 0,
+ * if successful and there is more data -- 1,
+ * if not found and end of data -- 2, any other errors -- < 0
+ * (negative error numbers are pretty random).
+ * 
+ * NOTE: needs to be protected by a mutex in reentrant environment 
+ */
+
+static int
+getmib(int groupname, int subgroupname, void *statbuf, size_t size,
+       size_t entrysize, req_e req_type, void *resp,
+       size_t *length, int (*comp)(void *, void *), void *arg)
+{
+    int             rc, ret = 0, flags;
+    char            buf[BUFSIZE];
+    struct strbuf   strbuf;
+    struct T_optmgmt_req *tor = (struct T_optmgmt_req *) buf;
+    struct T_optmgmt_ack *toa = (struct T_optmgmt_ack *) buf;
+    struct T_error_ack *tea = (struct T_error_ack *) buf;
+    struct opthdr  *req;
+    found_e         result = FOUND;
+
+    DEBUGMSGTL(("kernel_sunos5", "...... getmib (%d, %d, ...)\n",
+		groupname, subgroupname));
+
+    /*
+     * Open the stream driver and push all MIB-related modules 
+     */
+
+    if (sd == -1) {         /* First time */
+	if ((sd = open(STREAM_DEV, O_RDWR)) == -1) {
+	    ret = -1;
+	    goto Return;
+	}
+	if (ioctl(sd, I_PUSH, "arp") == -1) {
+	    ret = -1;
+	    goto Return;
+	}
+	if (ioctl(sd, I_PUSH, "tcp") == -1) {
+	    ret = -1;
+	    goto Return;
+	}
+	if (ioctl(sd, I_PUSH, "udp") == -1) {
+	    ret = -1;
+	    goto Return;
+	}
+	DEBUGMSGTL(("kernel_sunos5", "...... modules pushed OK\n"));
+    }
+
+    /*
+     * First, use bigger buffer, to accelerate skipping unwanted messages
+     */
+
+    strbuf.buf = buf;
+    strbuf.maxlen = BUFSIZE;
+    
+    tor->PRIM_type = T_OPTMGMT_REQ;
+    tor->OPT_offset = sizeof(struct T_optmgmt_req);
+    tor->OPT_length = sizeof(struct opthdr);
+#ifdef MI_T_CURRENT
+    tor->MGMT_flags = MI_T_CURRENT; /* Solaris < 2.6 */
+#else
+    tor->MGMT_flags = T_CURRENT;    /* Solaris 2.6 */
+#endif
+    req = (struct opthdr *)(tor + 1);
+    req->level = groupname;
+    req->name = subgroupname;
+    req->len = 0;
+    strbuf.len = tor->OPT_length + tor->OPT_offset;
+    flags = 0;
+    if ((rc = putmsg(sd, &strbuf, NULL, flags))) {
+	ret = -2;
+	goto Return;
+    }
+
+    req = (struct opthdr *) (toa + 1);
+    for (;;) {
+	flags = 0;
+	if ((rc = getmsg(sd, &strbuf, NULL, &flags)) == -1) {
+	    ret = -EIO;
+	    break;
+	}
+	if (rc == 0 && strbuf.len >= sizeof(struct T_optmgmt_ack) &&
+	    toa->PRIM_type  == T_OPTMGMT_ACK &&
+	    toa->MGMT_flags == T_SUCCESS && req->len == 0) {
+	    ret = 2;
+	    break;
+	}
+	if (strbuf.len >= sizeof(struct T_error_ack) &&
+	    tea->PRIM_type == T_ERROR_ACK) {
+	    /* Protocol error */
+	    ret = -((tea->TLI_error == TSYSERR) ? tea->UNIX_error : EPROTO);
+	    break;
+	}
+	if (rc != MOREDATA || strbuf.len < sizeof(struct T_optmgmt_ack) ||
+	    toa->PRIM_type != T_OPTMGMT_ACK ||
+	    toa->MGMT_flags != T_SUCCESS) {
+	    ret = -ENOMSG;  /* No more messages */
+	    break;
+	}
+
+	/*
+	 * The order in which we get the statistics is determined by the kernel
+	 * and not by the group name, so we have to loop until we get the
+	 * required statistics.
+	 */
+
+	if (req->level != groupname || req->name != subgroupname) {
+	    strbuf.maxlen = BUFSIZE;
+	    strbuf.buf = buf;
+	    do {
+		rc = getmsg(sd, NULL, &strbuf, &flags);
+	    } while (rc == MOREDATA);
+	    continue;
+	}
+        
+	/*
+	 * Now when we found our stat, switch buffer to a caller-provided
+	 * one. Manipulating the size of it one can control performance,
+	 * reducing the number of getmsg calls
+	 */
+
+	strbuf.buf = statbuf;
+	strbuf.maxlen = size;
+	strbuf.len = 0;
+	flags = 0;
+	do {
+	    rc = getmsg(sd, NULL, &strbuf, &flags);
+	    switch (rc) {
+	    case -1:
+		rc = -ENOSR;
+		goto Return;
+
+	    default:
+		rc = -ENODATA;
+		goto Return;
+
+	    case MOREDATA:
+	    case 0:
+		if (req_type == GET_NEXT && result == NEED_NEXT)
+		    /*
+		     * End of buffer, so "next" is the first item in the next
+		     * buffer  
+		     */
+		    req_type = GET_FIRST;
+		result = getentry(req_type, (void *) strbuf.buf, strbuf.len,
+				  entrysize, resp, comp, arg);
+		*length = strbuf.len;       /* To use in caller for cacheing */
+		break;
+	    }
+	} while (rc == MOREDATA && result != FOUND);
+
+	if (result == FOUND) {      /* Search is successful */
+	    if (rc != MOREDATA) {
+		ret = 0;    /* Found and no more data */
+	    } else {
+		ret = 1;    /* Found and there is another unread data block */
+	    }
+	    break;
+	} else {            /* Restore buffers, continue search */
+	    strbuf.buf = buf;
+	    strbuf.maxlen = BUFSIZE;
+	}
+    }
+ Return:
+    ioctl(sd, I_FLUSH, FLUSHRW);
+    DEBUGMSGTL(("kernel_sunos5", "...... getmib returns %d\n", ret));
+    return ret;
+}
+  
+/*
+ * Get info for interfaces group. Mimics getmib interface as much as possible
+ * to be substituted later if SunSoft decides to extend its mib2 interface.
+ */
+static int
+getif(mib2_ifEntry_t *ifbuf, size_t size, req_e req_type,
+      mib2_ifEntry_t *resp,  size_t *length, int (*comp)(void *, void *),
+      void *arg)
+{
+    int             i, ret, idx = 1;
+    int             ifsd;
+    static char    *buf = NULL;
+    static int      bufsize = 0;
+    struct ifconf   ifconf;
+    struct ifreq   *ifrp;
+    mib2_ifEntry_t *ifp;
+    mib2_ipNetToMediaEntry_t Media;
+    int             nentries = size / sizeof(mib2_ifEntry_t);
+    found_e         result = NOT_FOUND;
+
+    if ((ifsd = socket(AF_INET, SOCK_DGRAM, 0)) < 0) {
+	return -1;
+    }
+
+    if (!buf) {
+	bufsize = 10240;
+	buf = malloc(bufsize);
+	if (!buf) {
+	    ret = -1;
+	    goto Return;
+	}
+    }
+
+    ifconf.ifc_buf = buf;
+    ifconf.ifc_len = bufsize;
+    while (ioctl(ifsd, SIOCGIFCONF, &ifconf) == -1) {
+	bufsize += 10240;
+	free(buf);
+	buf = malloc(bufsize);
+	if (!buf) {
+	    ret = -1;
+	    goto Return;
+	}
+	ifconf.ifc_buf = buf;
+	ifconf.ifc_len = bufsize;
+    }
+
+ Again:
+    for (i = 0, ifp = (mib2_ifEntry_t *) ifbuf, ifrp = ifconf.ifc_req;
+	 ((char *) ifrp < ((char *) ifconf.ifc_buf + ifconf.ifc_len))
+             && (i < nentries); i++, ifp++, ifrp++, idx++) {
+
+	DEBUGMSGTL(("kernel_sunos5", "...... getif %s\n", ifrp->ifr_name));
+
+	if (ioctl(ifsd, SIOCGIFFLAGS, ifrp) < 0) {
+	    ret = -1;
+	    DEBUGMSGTL(("kernel_sunos5", "...... SIOCGIFFLAGS failed\n"));
+	    goto Return;
+	}
+
+	memset(ifp, 0, sizeof(mib2_ifEntry_t));
+	ifp->ifIndex = idx;
+	ifp->ifDescr.o_length = strlen(ifrp->ifr_name);
+	strcpy(ifp->ifDescr.o_bytes, ifrp->ifr_name);
+	ifp->ifAdminStatus = (ifrp->ifr_flags & IFF_RUNNING) ? 1 : 2;
+	ifp->ifOperStatus = (ifrp->ifr_flags & IFF_UP) ? 1 : 2;
+	ifp->ifLastChange = 0;      /* Who knows ...  */
+
+	if (ioctl(ifsd, SIOCGIFMTU, ifrp) < 0) {
+	    ret = -1;
+	    DEBUGMSGTL(("kernel_sunos5", "...... SIOCGIFMTU failed\n"));
+	    goto Return;
+	}
+	ifp->ifMtu = ifrp->ifr_metric;
+	ifp->ifType = 1;
+	ifp->ifSpeed = 0;
+
+	if ((getKstatInt(NULL,ifrp->ifr_name, "ifspeed", &ifp->ifSpeed) == 0) &&
+	    (ifp->ifSpeed != 0)) {
+	    /*
+	     * check for SunOS patch with half implemented ifSpeed 
+	     */
+	    if (ifp->ifSpeed < 10000) {
+                    ifp->ifSpeed *= 1000000;
+	    }
+	} else if (getKstatInt(NULL,ifrp->ifr_name, "ifSpeed", &ifp->ifSpeed) == 0) {
+	    /*
+	     * this is good 
+	     */
+	}
+
+	switch (ifrp->ifr_name[0]) {
+	case 'l':          /* le / lo / lane (ATM LAN Emulation) */
+	    if (ifrp->ifr_name[1] == 'o') {
+		if (!ifp->ifSpeed)
+		    ifp->ifSpeed = 127000000;
+		ifp->ifType = 24;
+	    } else if (ifrp->ifr_name[1] == 'e') {
+		if (!ifp->ifSpeed)
+		    ifp->ifSpeed = 10000000;
+		ifp->ifType = 6;
+	    } else if (ifrp->ifr_name[1] == 'a') {
+		if (!ifp->ifSpeed)
+		    ifp->ifSpeed = 155000000;
+		ifp->ifType = 37;
+	    }
+	    break;
+
+	case 'g':          /* ge (gigabit ethernet card)  */
+	    if (!ifp->ifSpeed)
+		ifp->ifSpeed = 1000000000;
+	    ifp->ifType = 6;
+	    break;
+
+	case 'h':          /* hme (SBus card) */
+	case 'e':          /* eri (PCI card) */
+	case 'b':          /* be */
+	case 'd':          /* dmfe -- found on netra X1 */
+	    if (!ifp->ifSpeed)
+		ifp->ifSpeed = 100000000;
+	    ifp->ifType = 6;
+	    break;
+
+	case 'f':          /* fa (Fore ATM */
+	    if (!ifp->ifSpeed)
+		ifp->ifSpeed = 155000000;
+	    ifp->ifType = 37;
+	    break;
+
+	case 'q':         /* qe (QuadEther)/qa (Fore ATM)/qfe (QuadFastEther)*/
+	    if (ifrp->ifr_name[1] == 'a') {
+		if (!ifp->ifSpeed)
+		    ifp->ifSpeed = 155000000;
+		ifp->ifType = 37;
+	    } else if (ifrp->ifr_name[1] == 'e') {
+		if (!ifp->ifSpeed)
+		    ifp->ifSpeed = 10000000;
+		ifp->ifType = 6;
+	    } else if (ifrp->ifr_name[1] == 'f') {
+		if (!ifp->ifSpeed)
+		    ifp->ifSpeed = 100000000;
+		ifp->ifType = 6;
+	    }
+	    break;
+	}
+
+	if (!strchr(ifrp->ifr_name, ':')) {
+	    Counter l_tmp;
+
+	    if (getKstatInt(NULL,ifrp->ifr_name, "ipackets", &ifp->ifInUcastPkts) < 0){
+		ret = -1;
+		goto Return;
+	    }
+            
+	    if (getKstatInt(NULL,ifrp->ifr_name, "rbytes", &ifp->ifInOctets) < 0) {
+                    ifp->ifInOctets = ifp->ifInUcastPkts * 308; /* XXX */
+	    }
+            
+	    if (getKstatInt(NULL,ifrp->ifr_name, "opackets",&ifp->ifOutUcastPkts) < 0){
+		ret = -1;
+		goto Return;
+	    }
+            
+	    if (getKstatInt(NULL,ifrp->ifr_name, "obytes", &ifp->ifOutOctets) < 0) {
+		ifp->ifOutOctets = ifp->ifOutUcastPkts * 308;       /* XXX */
+	    }
+
+	    if (ifp->ifType == 24)  /* Loopback */
+		continue;
+
+	    if (getKstatInt(NULL,ifrp->ifr_name, "ierrors", &ifp->ifInErrors) < 0) {
+		ret = -1;
+		goto Return;
+	    }
+
+	    if (getKstatInt(NULL,ifrp->ifr_name, "oerrors", &ifp->ifOutErrors) < 0) {
+		ret = -1;
+		goto Return;
+	    }
+
+	    if (getKstatInt(NULL,ifrp->ifr_name, "brdcstrcv",&ifp->ifInNUcastPkts)==0&&
+		getKstatInt(NULL,ifrp->ifr_name, "multircv", &l_tmp) == 0) {
+		ifp->ifInNUcastPkts += l_tmp;
+	    }
+
+	    if (getKstatInt(NULL,ifrp->ifr_name,"brdcstxmt",&ifp->ifOutNUcastPkts)==0&&
+		getKstatInt(NULL,ifrp->ifr_name, "multixmt", &l_tmp) == 0) {
+		ifp->ifOutNUcastPkts += l_tmp;
+	    }
+	}
+
+	/*
+	 * An attempt to determine the physical address of the interface.
+	 * There should be a more elegant solution using DLPI, but "the margin
+	 * is too small to put it here ..."
+	 */
+
+	if (ioctl(ifsd, SIOCGIFADDR, ifrp) < 0) {
+	    ret = -1;
+	    goto Return;
+	}
+
+	if (getMibstat(MIB_IP_NET, &Media, sizeof(mib2_ipNetToMediaEntry_t),
+		       GET_EXACT, &Name_cmp, ifrp) == 0) {
+	    ifp->ifPhysAddress = Media.ipNetToMediaPhysAddress;
+	}
+    }
+
+    if ((req_type == GET_NEXT) && (result == NEED_NEXT)) {
+            /*
+             * End of buffer, so "next" is the first item in the next buffer 
+             */
+            req_type = GET_FIRST;
+    }
+
+    result = getentry(req_type, (void *) ifbuf, size, sizeof(mib2_ifEntry_t),
+		      (void *)resp, comp, arg);
+
+    if ((result != FOUND) && (i == nentries) && 
+	((char *)ifrp < (char *)ifconf.ifc_buf + ifconf.ifc_len)) {
+	/*
+	 * We reached the end of supplied buffer, but there is
+	 * some more stuff to read, so continue.
+	 */
+	ifconf.ifc_len -= i * sizeof(struct ifreq);
+	ifconf.ifc_req = ifrp;
+	goto Again;
+    }
+
+    if (result != FOUND) {
+            ret = 2;
+    } else {
+	if ((char *)ifrp < (char *)ifconf.ifc_buf + ifconf.ifc_len) {
+	    ret = 1;        /* Found and more data to fetch */
+	} else {
+	    ret = 0;        /* Found and no more data */
+	}
+	*length = i * sizeof(mib2_ifEntry_t);       /* Actual cache length */
+    }
+
+ Return:
+    close(ifsd);
+    return ret;
+}
+
+/*
+ * Always TRUE. May be used as a comparison function in getMibstat
+ * to obtain the whole table (GET_FIRST should be used) 
+ */
+int
+Get_everything(void *x, void *y)
+{
+    return 0;             /* Always TRUE */
+}
+
+/*
+ * Compare name and IP address of the interface to ARP table entry.
+ * Needed to obtain the physical address of the interface in getif.
+ */
+static int
+Name_cmp(void *ifrp, void *ep)
+{
+    struct sockaddr_in *s = (struct sockaddr_in *)
+	                                   &(((struct ifreq *)ifrp)->ifr_addr);
+    mib2_ipNetToMediaEntry_t *Ep = (mib2_ipNetToMediaEntry_t *)ep;
+
+    if ((strncmp(Ep->ipNetToMediaIfIndex.o_bytes,
+		 ((struct ifreq *)ifrp)->ifr_name,
+		 Ep->ipNetToMediaIfIndex.o_length) == 0) &&
+	(s->sin_addr.s_addr == Ep->ipNetToMediaNetAddress)) {
+	return 0;
+    } else {
+	return 1;
+    }
+}	
+
+#ifdef _STDC_COMPAT
+#ifdef __cplusplus
+}
+#endif
+#endif
+
+#ifdef _GETKSTAT_TEST
+
+int
+main(int argc, char **argv)
+{
+    int             rc = 0;
+    u_long          val = 0;
+
+    if (argc != 3) {
+        snmp_log(LOG_ERR, "Usage: %s stat_name var_name\n", argv[0]);
+        exit(1);
+    }
+
+    snmp_set_do_debugging(1);
+    rc = getKstat(argv[1], argv[2], &val);
+
+    if (rc == 0)
+        snmp_log(LOG_ERR, "%s = %lu\n", argv[2], val);
+    else
+        snmp_log(LOG_ERR, "rc =%d\n", rc);
+    return 0;
+}
+#endif /*_GETKSTAT_TEST */
+
+#ifdef _GETMIBSTAT_TEST
+
+int
+ip20comp(void *ifname, void *ipp)
+{
+    return (strncmp((char *) ifname,
+                    ((mib2_ipAddrEntry_t *) ipp)->ipAdEntIfIndex.o_bytes,
+                    ((mib2_ipAddrEntry_t *) ipp)->ipAdEntIfIndex.
+                    o_length));
+}
+
+int
+ARP_Cmp_Addr(void *addr, void *ep)
+{
+    DEBUGMSGTL(("kernel_sunos5", "ARP: %lx <> %lx\n",
+                ((mib2_ipNetToMediaEntry_t *) ep)->ipNetToMediaNetAddress,
+                *(IpAddress *) addr));
+    if (((mib2_ipNetToMediaEntry_t *) ep)->ipNetToMediaNetAddress ==
+        *(IpAddress *)addr) {
+        return 0;
+    } else {
+        return 1;
+    }
+}
+
+int
+IF_cmp(void *addr, void *ep)
+{
+    if (((mib2_ifEntry_t *)ep)->ifIndex ==((mib2_ifEntry_t *)addr)->ifIndex) {
+        return 0;
+    } else {
+        return 1;
+    }
+}
+
+int
+main(int argc, char **argv)
+{
+    int             rc = 0, i, idx;
+    mib2_ipAddrEntry_t ipbuf, *ipp = &ipbuf;
+    mib2_ipNetToMediaEntry_t entry, *ep = &entry;
+    mib2_ifEntry_t  ifstat;
+    req_e           req_type;
+    IpAddress       LastAddr = 0;
+
+    if (argc != 3) {
+        snmp_log(LOG_ERR,
+                 "Usage: %s if_name req_type (0 first, 1 exact, 2 next) \n",
+                 argv[0]);
+        exit(1);
+    }
+
+    switch (atoi(argv[2])) {
+    case 0:
+        req_type = GET_FIRST;
+        break;
+    case 1:
+        req_type = GET_EXACT;
+        break;
+    case 2:
+        req_type = GET_NEXT;
+        break;
+    };
+
+    snmp_set_do_debugging(0);
+    while ((rc =
+            getMibstat(MIB_INTERFACES, &ifstat, sizeof(mib2_ifEntry_t),
+                       req_type, &IF_cmp, &idx)) == 0) {
+        idx = ifstat.ifIndex;
+        DEBUGMSGTL(("kernel_sunos5", "Ifname = %s\n",
+                    ifstat.ifDescr.o_bytes));
+        req_type = GET_NEXT;
+    }
+    rc = getMibstat(MIB_IP_ADDR, &ipbuf, sizeof(mib2_ipAddrEntry_t),
+                    req_type, ip20comp, argv[1]);
+
+    if (rc == 0)
+        DEBUGMSGTL(("kernel_sunos5", "mtu = %ld\n",
+                    ipp->ipAdEntInfo.ae_mtu));
+    else
+        DEBUGMSGTL(("kernel_sunos5", "rc =%d\n", rc));
+
+    while ((rc =
+            getMibstat(MIB_IP_NET, &entry,
+                       sizeof(mib2_ipNetToMediaEntry_t), req_type,
+                       &ARP_Cmp_Addr, &LastAddr)) == 0) {
+        LastAddr = ep->ipNetToMediaNetAddress;
+        DEBUGMSGTL(("kernel_sunos5", "Ipaddr = %lX\n", (u_long) LastAddr));
+        req_type = GET_NEXT;
+    }
+    return 0;
+}
+#endif /*_GETMIBSTAT_TEST */
+#endif                          /* SUNOS5 */
+
+
+/*-
+ * These variables describe the formatting of this file.  If you don't like the
+ * template defaults, feel free to change them here (not in your .emacs file).
+ *
+ * Local Variables:
+ * comment-column: 32
+ * c-indent-level: 4
+ * c-continued-statement-offset: 4
+ * c-brace-offset: -4
+ * c-argdecl-indent: 0
+ * c-label-offset: -4
+ * fill-column: 79
+ * fill-prefix: " * "
+ * End:
+ */
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/kernel_sunos5.h tomato121/release/src/router/snmp/agent/mibgroup/kernel_sunos5.h
--- tomato/release/src/router/snmp/agent/mibgroup/kernel_sunos5.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/kernel_sunos5.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,175 @@
+/*- This is a -*- C -*- compatible header file
+ *
+ * Generic public interface for SUNOS5_INSTRUMENTATION
+ *
+ * This file contains manifest constants (#defines), macros, enumerations,
+ * public structure definitions, static const definitions, global variable
+ * declarations, and function prototypes.
+ *
+ * This file contains types and structures for SunOS 5.x instrumentation
+ *
+ */
+
+#include <inet/mib2.h>
+
+#define	COPY_IPADDR(fp, from, tp, to) 					\
+	fp = from;							\
+	tp = to;							\
+	*tp++ = *fp++;							\
+	*tp++ = *fp++;							\
+	*tp++ = *fp++;							\
+	*tp++ = *fp++;
+
+#ifndef ZZ_SUNOS5_INSTR         /* duplicate include prevention */
+#define ZZ_SUNOS5_INSTR
+
+
+/*-
+ * Manifest constants
+ */
+
+#define KSTAT_DATA_MAX	100     /* Maximum number of kstat entries. To be changed later  */
+#define MIBCACHE_SIZE	20      /* Number of MIB cache entries */
+
+/*-
+ * Macros
+ */
+#define	CACHE_MOREDATA	0x001   /* There are unread data outside cache */
+
+/*-
+ * Enumeration types
+ */
+
+typedef enum { GET_FIRST, GET_EXACT, GET_NEXT } req_e;
+typedef enum { FOUND, NOT_FOUND, NEED_NEXT } found_e;
+
+typedef enum {
+    MIB_SYSTEM = 0,
+    MIB_INTERFACES = 1,
+    MIB_AT = 2,
+    MIB_IP = 3,
+    MIB_IP_ADDR = 4,
+    MIB_IP_ROUTE = 5,
+    MIB_IP_NET = 6,
+    MIB_ICMP = 7,
+    MIB_TCP = 8,
+    MIB_TCP_CONN = 9,
+    MIB_UDP = 10,
+    MIB_UDP_LISTEN = 11,
+    MIB_EGP = 12,
+    MIB_CMOT = 13,
+    MIB_TRANSMISSION = 14,
+    MIB_SNMP = 15
+} mibgroup_e;
+
+/*-
+ * Structure definitions (use "typedef struct foo {} foo;" form)
+ */
+
+/*
+ * MIB-II cache. Simple buffering scheme - last read block is in the cache 
+ */
+
+typedef struct mibcache {
+    mibgroup_e      cache_groupid;      /* MIB-II group */
+    size_t          cache_size; /* Size of this cache table in bytes */
+    void           *cache_addr; /* Pointer to real cache memory */
+    size_t          cache_length;       /* Useful length in bytes */
+    size_t          cache_ttl;  /* Time this type of cache entry stays valid */
+    time_t          cache_time; /* CURRENT time left for this cache entry */
+    int             cache_flags;        /* Cache state */
+    int             cache_last_found;   /* Index of last cache element that was found */
+    void           *cache_comp; /* Compare routine used to set the cache */
+    void           *cache_arg;  /* Argument for compare routine used to set the cache */
+} mibcache;
+
+/*
+ * Mapping between mibgroup_t, mibtable_t and mib2.h defines 
+ */
+
+typedef struct mibmap {
+    int             group;      /* mib2.h group name */
+    int             table;      /* mib2.h table name */
+} mibmap;
+
+/*
+ * Structures, missing in <inet/mib2.h> 
+ */
+typedef unsigned long TimeTicks;
+
+typedef struct mib2_ifEntry {
+    int             ifIndex;    /* ifEntry 1 */
+    DeviceName      ifDescr;    /* ifEntry 2 */
+    int             ifType;     /* ifEntry 3 */
+    int             ifMtu;      /* ifEntry 4 */
+    Gauge           ifSpeed;    /* ifEntry 5 */
+    PhysAddress     ifPhysAddress;      /* ifEntry 6 */
+    int             ifAdminStatus;      /* ifEntry 7 */
+    int             ifOperStatus;       /* ifEntry 8 */
+    TimeTicks       ifLastChange;       /* ifEntry 9 */
+    Counter         ifInOctets; /* ifEntry 10 */
+    Counter         ifInUcastPkts;      /* ifEntry 11 */
+    Counter         ifInNUcastPkts;     /* ifEntry 12 */
+    Counter         ifInDiscards;       /* ifEntry 13 */
+    Counter         ifInErrors; /* ifEntry 14 */
+    Counter         ifInUnknownProtos;  /* ifEntry 15 */
+    Counter         ifOutOctets;        /* ifEntry 16 */
+    Counter         ifOutUcastPkts;     /* ifEntry 17 */
+    Counter         ifOutNUcastPkts;    /* ifEntry 18 */
+    Counter         ifOutDiscards;      /* ifEntry 19 */
+    Counter         ifOutErrors;        /* ifEntry 20 */
+    Gauge           ifOutQLen;  /* ifEntry 21 */
+    int             ifSpecific; /* ifEntry 22 */
+} mib2_ifEntry_t;
+
+/*-
+ * Static const definitions (must be declared static and initialized)
+ */
+
+
+/*-
+ * Global variable declarations (using extern and without initialization)
+ */
+
+/*-
+ * Function prototypes (use void as argument type if there are no arguments)
+ */
+
+#ifdef _STDC_COMPAT
+#ifdef __cplusplus
+extern          "C" {
+#endif
+#endif
+    void            init_kernel_sunos5(void);
+
+    int             getKstat(const char *statname, const char *varname,
+                             void *value);
+    int             getMibstat(mibgroup_e grid, void *resp,
+                               size_t entrysize, req_e req_type,
+                               int (*comp) (void *, void *), void *arg);
+    int             Get_everything(void *, void *);
+    int             getKstatInt(const char *classname,
+                                const char *statname, const char *varname,
+                                int *value);
+
+#ifdef _STDC_COMPAT
+#ifdef __cplusplus
+}
+#endif
+#endif
+/*-
+ * These variables describe the formatting of this file.  If you don't like the
+ * template defaults, feel free to change them here (not in your .emacs file).
+ *
+ * Local Variables:
+ * comment-column: 32
+ * c-indent-level: 4
+ * c-continued-statement-offset: 4
+ * c-brace-offset: -4
+ * c-argdecl-indent: 0
+ * c-label-offset: -4
+ * fill-column: 79
+ * fill-prefix: " * "
+ * End:
+ */
+#endif
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/libnetlink.h tomato121/release/src/router/snmp/agent/mibgroup/libnetlink.h
--- tomato/release/src/router/snmp/agent/mibgroup/libnetlink.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/libnetlink.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,30 @@
+#ifndef __LIBNETLINK_H__
+#define __LIBNETLINK_H__ 1
+
+#include <asm/types.h>
+#include <linux/netlink.h>
+#include <linux/rtnetlink.h>
+
+struct rtnl_handle
+{
+	int			fd;
+	struct sockaddr_nl	local;
+	struct sockaddr_nl	peer;
+	__u32			seq;
+	__u32			dump;
+};
+
+extern int rtnl_open(struct rtnl_handle *rth, unsigned subscriptions);
+extern void rtnl_close(struct rtnl_handle *rth);
+extern int rtnl_wilddump_request(struct rtnl_handle *rth, int fam, int type);
+extern int rtnl_dump_request(struct rtnl_handle *rth, int type, void *req, int len);
+extern int rtnl_dump_filter(struct rtnl_handle *rth,
+			    int (*filter)(struct sockaddr_nl *, struct nlmsghdr *n, void *),
+			    void *arg1,
+			    int (*junk)(struct sockaddr_nl *,struct nlmsghdr *n, void *),
+			    void *arg2);
+
+extern int parse_rtattr(struct rtattr *tb[], int max, struct rtattr *rta, int len);
+
+#endif /* __LIBNETLINK_H__ */
+
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/ll_map.h tomato121/release/src/router/snmp/agent/mibgroup/ll_map.h
--- tomato/release/src/router/snmp/agent/mibgroup/ll_map.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/ll_map.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,10 @@
+#ifndef __LL_MAP_H__
+#define __LL_MAP_H__ 1
+
+extern int ll_remember_index(struct sockaddr_nl *who, struct nlmsghdr *n, void *arg);
+extern int ll_init_map(struct rtnl_handle *rth);
+extern int ll_name_to_index(char *name);
+extern const char *ll_index_to_name(int idx);
+extern const char *ll_idx_n2a(int idx, char *buf);
+
+#endif /* __LL_MAP_H__ */
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/Makefile.depend tomato121/release/src/router/snmp/agent/mibgroup/Makefile.depend
--- tomato/release/src/router/snmp/agent/mibgroup/Makefile.depend	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/Makefile.depend	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,9222 @@
+# DO NOT DELETE THIS LINE -- make depend depends on it.
+
+./header_complex.lo: ../../include/net-snmp/net-snmp-config.h
+./header_complex.lo: ../../include/net-snmp/system/linux.h
+./header_complex.lo: ../../include/net-snmp/system/sysv.h
+./header_complex.lo: ../../include/net-snmp/system/generic.h
+./header_complex.lo: ../../include/net-snmp/machine/generic.h
+./header_complex.lo: ../../include/net-snmp/net-snmp-includes.h
+./header_complex.lo: ../../include/net-snmp/definitions.h
+./header_complex.lo: ../../include/net-snmp/types.h
+./header_complex.lo: ../../include/net-snmp/library/snmp_api.h
+./header_complex.lo: ../../include/net-snmp/library/asn1.h
+./header_complex.lo: ../../include/net-snmp/library/snmp_impl.h
+./header_complex.lo: ../../include/net-snmp/library/snmp.h
+./header_complex.lo: ../../include/net-snmp/library/snmp-tc.h
+./header_complex.lo: ../../include/net-snmp/utilities.h
+./header_complex.lo: ../../include/net-snmp/library/snmp_client.h
+./header_complex.lo: ../../include/net-snmp/library/getopt.h
+./header_complex.lo: ../../include/net-snmp/library/system.h
+./header_complex.lo: ../../include/net-snmp/library/tools.h
+./header_complex.lo: ../../include/net-snmp/library/int64.h
+./header_complex.lo: ../../include/net-snmp/library/mt_support.h
+./header_complex.lo: ../../include/net-snmp/library/snmp_alarm.h
+./header_complex.lo: ../../include/net-snmp/library/data_list.h
+./header_complex.lo: ../../include/net-snmp/library/callback.h
+./header_complex.lo: ../../include/net-snmp/library/oid_stash.h
+./header_complex.lo: ../../include/net-snmp/library/check_varbind.h
+./header_complex.lo: ../../include/net-snmp/version.h
+./header_complex.lo: ../../include/net-snmp/session_api.h
+./header_complex.lo: ../../include/net-snmp/library/snmp_transport.h
+./header_complex.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./header_complex.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./header_complex.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./header_complex.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./header_complex.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./header_complex.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./header_complex.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./header_complex.lo: ../../include/net-snmp/library/ucd_compat.h
+./header_complex.lo: ../../include/net-snmp/pdu_api.h
+./header_complex.lo: ../../include/net-snmp/mib_api.h
+./header_complex.lo: ../../include/net-snmp/library/mib.h
+./header_complex.lo: ../../include/net-snmp/library/parse.h
+./header_complex.lo: ../../include/net-snmp/varbind_api.h
+./header_complex.lo: ../../include/net-snmp/config_api.h
+./header_complex.lo: ../../include/net-snmp/library/read_config.h
+./header_complex.lo: ../../include/net-snmp/library/default_store.h
+./header_complex.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./header_complex.lo: ../../include/net-snmp/library/snmp_enum.h
+./header_complex.lo: ../../include/net-snmp/library/vacm.h
+./header_complex.lo: ../../include/net-snmp/output_api.h
+./header_complex.lo: ../../include/net-snmp/library/snmp_debug.h
+./header_complex.lo: ../../include/net-snmp/library/snmp_logging.h
+./header_complex.lo: ../../include/net-snmp/snmpv3_api.h
+./header_complex.lo: ../../include/net-snmp/library/snmpv3.h
+./header_complex.lo: ../../include/net-snmp/library/transform_oids.h
+./header_complex.lo: ../../include/net-snmp/library/keytools.h
+./header_complex.lo: ../../include/net-snmp/library/scapi.h
+./header_complex.lo: ../../include/net-snmp/library/lcd_time.h
+./header_complex.lo: ../../include/net-snmp/library/snmp_secmod.h
+./header_complex.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./header_complex.lo: ../../include/net-snmp/library/snmpusm.h
+./header_complex.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./header_complex.lo: ../../include/net-snmp/agent/snmp_agent.h
+./header_complex.lo: ../../include/net-snmp/agent/snmp_vars.h
+./header_complex.lo: ../../include/net-snmp/agent/agent_handler.h
+./header_complex.lo: ../../include/net-snmp/agent/var_struct.h
+./header_complex.lo: ../../include/net-snmp/agent/agent_registry.h
+./header_complex.lo: ../../include/net-snmp/agent/ds_agent.h
+./header_complex.lo: ../../include/net-snmp/agent/agent_read_config.h
+./header_complex.lo: ../../include/net-snmp/agent/agent_trap.h
+./header_complex.lo: ../../include/net-snmp/agent/all_helpers.h
+./header_complex.lo: ../../include/net-snmp/agent/instance.h
+./header_complex.lo: ../../include/net-snmp/agent/multiplexer.h
+./header_complex.lo: ../../include/net-snmp/agent/null.h
+./header_complex.lo: ../../include/net-snmp/agent/debug_handler.h
+./header_complex.lo: ../../include/net-snmp/agent/old_api.h
+./header_complex.lo: ../../include/net-snmp/agent/read_only.h
+./header_complex.lo: ../../include/net-snmp/agent/serialize.h
+./header_complex.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./header_complex.lo: ../../include/net-snmp/agent/mode_end_call.h
+./header_complex.lo: ../../include/net-snmp/agent/table.h
+./header_complex.lo: ../../include/net-snmp/agent/table_data.h
+./header_complex.lo: ../../include/net-snmp/agent/table_dataset.h
+./header_complex.lo: ../../include/net-snmp/agent/table_iterator.h
+./header_complex.lo: ../../include/net-snmp/agent/mib_module_config.h
+./header_complex.lo: header_complex.h
+./kernel_sunos5.lo: ../../include/net-snmp/net-snmp-config.h
+./kernel_sunos5.lo: ../../include/net-snmp/system/linux.h
+./kernel_sunos5.lo: ../../include/net-snmp/system/sysv.h
+./kernel_sunos5.lo: ../../include/net-snmp/system/generic.h
+./kernel_sunos5.lo: ../../include/net-snmp/machine/generic.h
+./testhandler.lo: ../../include/net-snmp/net-snmp-config.h
+./testhandler.lo: ../../include/net-snmp/system/linux.h
+./testhandler.lo: ../../include/net-snmp/system/sysv.h
+./testhandler.lo: ../../include/net-snmp/system/generic.h
+./testhandler.lo: ../../include/net-snmp/machine/generic.h
+./testhandler.lo: ../../include/net-snmp/net-snmp-includes.h
+./testhandler.lo: ../../include/net-snmp/definitions.h
+./testhandler.lo: ../../include/net-snmp/types.h
+./testhandler.lo: ../../include/net-snmp/library/snmp_api.h
+./testhandler.lo: ../../include/net-snmp/library/asn1.h
+./testhandler.lo: ../../include/net-snmp/library/snmp_impl.h
+./testhandler.lo: ../../include/net-snmp/library/snmp.h
+./testhandler.lo: ../../include/net-snmp/library/snmp-tc.h
+./testhandler.lo: ../../include/net-snmp/utilities.h
+./testhandler.lo: ../../include/net-snmp/library/snmp_client.h
+./testhandler.lo: ../../include/net-snmp/library/getopt.h
+./testhandler.lo: ../../include/net-snmp/library/system.h
+./testhandler.lo: ../../include/net-snmp/library/tools.h
+./testhandler.lo: ../../include/net-snmp/library/int64.h
+./testhandler.lo: ../../include/net-snmp/library/mt_support.h
+./testhandler.lo: ../../include/net-snmp/library/snmp_alarm.h
+./testhandler.lo: ../../include/net-snmp/library/data_list.h
+./testhandler.lo: ../../include/net-snmp/library/callback.h
+./testhandler.lo: ../../include/net-snmp/library/oid_stash.h
+./testhandler.lo: ../../include/net-snmp/library/check_varbind.h
+./testhandler.lo: ../../include/net-snmp/version.h
+./testhandler.lo: ../../include/net-snmp/session_api.h
+./testhandler.lo: ../../include/net-snmp/library/snmp_transport.h
+./testhandler.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./testhandler.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./testhandler.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./testhandler.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./testhandler.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./testhandler.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./testhandler.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./testhandler.lo: ../../include/net-snmp/library/ucd_compat.h
+./testhandler.lo: ../../include/net-snmp/pdu_api.h
+./testhandler.lo: ../../include/net-snmp/mib_api.h
+./testhandler.lo: ../../include/net-snmp/library/mib.h
+./testhandler.lo: ../../include/net-snmp/library/parse.h
+./testhandler.lo: ../../include/net-snmp/varbind_api.h
+./testhandler.lo: ../../include/net-snmp/config_api.h
+./testhandler.lo: ../../include/net-snmp/library/read_config.h
+./testhandler.lo: ../../include/net-snmp/library/default_store.h
+./testhandler.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./testhandler.lo: ../../include/net-snmp/library/snmp_enum.h
+./testhandler.lo: ../../include/net-snmp/library/vacm.h
+./testhandler.lo: ../../include/net-snmp/output_api.h
+./testhandler.lo: ../../include/net-snmp/library/snmp_debug.h
+./testhandler.lo: ../../include/net-snmp/library/snmp_logging.h
+./testhandler.lo: ../../include/net-snmp/snmpv3_api.h
+./testhandler.lo: ../../include/net-snmp/library/snmpv3.h
+./testhandler.lo: ../../include/net-snmp/library/transform_oids.h
+./testhandler.lo: ../../include/net-snmp/library/keytools.h
+./testhandler.lo: ../../include/net-snmp/library/scapi.h
+./testhandler.lo: ../../include/net-snmp/library/lcd_time.h
+./testhandler.lo: ../../include/net-snmp/library/snmp_secmod.h
+./testhandler.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./testhandler.lo: ../../include/net-snmp/library/snmpusm.h
+./testhandler.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./testhandler.lo: ../../include/net-snmp/agent/snmp_agent.h
+./testhandler.lo: ../../include/net-snmp/agent/snmp_vars.h
+./testhandler.lo: ../../include/net-snmp/agent/agent_handler.h
+./testhandler.lo: ../../include/net-snmp/agent/var_struct.h
+./testhandler.lo: ../../include/net-snmp/agent/agent_registry.h
+./testhandler.lo: ../../include/net-snmp/agent/ds_agent.h
+./testhandler.lo: ../../include/net-snmp/agent/agent_read_config.h
+./testhandler.lo: ../../include/net-snmp/agent/agent_trap.h
+./testhandler.lo: ../../include/net-snmp/agent/all_helpers.h
+./testhandler.lo: ../../include/net-snmp/agent/instance.h
+./testhandler.lo: ../../include/net-snmp/agent/multiplexer.h
+./testhandler.lo: ../../include/net-snmp/agent/null.h
+./testhandler.lo: ../../include/net-snmp/agent/debug_handler.h
+./testhandler.lo: ../../include/net-snmp/agent/old_api.h
+./testhandler.lo: ../../include/net-snmp/agent/read_only.h
+./testhandler.lo: ../../include/net-snmp/agent/serialize.h
+./testhandler.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./testhandler.lo: ../../include/net-snmp/agent/mode_end_call.h
+./testhandler.lo: ../../include/net-snmp/agent/table.h
+./testhandler.lo: ../../include/net-snmp/agent/table_data.h
+./testhandler.lo: ../../include/net-snmp/agent/table_dataset.h
+./testhandler.lo: ../../include/net-snmp/agent/table_iterator.h
+./testhandler.lo: ../../include/net-snmp/agent/mib_module_config.h
+./testhandler.lo: testhandler.h
+./util_funcs.lo: ../../include/net-snmp/net-snmp-config.h
+./util_funcs.lo: ../../include/net-snmp/system/linux.h
+./util_funcs.lo: ../../include/net-snmp/system/sysv.h
+./util_funcs.lo: ../../include/net-snmp/system/generic.h
+./util_funcs.lo: ../../include/net-snmp/machine/generic.h
+./util_funcs.lo: ../../include/net-snmp/net-snmp-includes.h
+./util_funcs.lo: ../../include/net-snmp/definitions.h
+./util_funcs.lo: ../../include/net-snmp/types.h
+./util_funcs.lo: ../../include/net-snmp/library/snmp_api.h
+./util_funcs.lo: ../../include/net-snmp/library/asn1.h
+./util_funcs.lo: ../../include/net-snmp/library/snmp_impl.h
+./util_funcs.lo: ../../include/net-snmp/library/snmp.h
+./util_funcs.lo: ../../include/net-snmp/library/snmp-tc.h
+./util_funcs.lo: ../../include/net-snmp/utilities.h
+./util_funcs.lo: ../../include/net-snmp/library/snmp_client.h
+./util_funcs.lo: ../../include/net-snmp/library/getopt.h
+./util_funcs.lo: ../../include/net-snmp/library/system.h
+./util_funcs.lo: ../../include/net-snmp/library/tools.h
+./util_funcs.lo: ../../include/net-snmp/library/int64.h
+./util_funcs.lo: ../../include/net-snmp/library/mt_support.h
+./util_funcs.lo: ../../include/net-snmp/library/snmp_alarm.h
+./util_funcs.lo: ../../include/net-snmp/library/data_list.h
+./util_funcs.lo: ../../include/net-snmp/library/callback.h
+./util_funcs.lo: ../../include/net-snmp/library/oid_stash.h
+./util_funcs.lo: ../../include/net-snmp/library/check_varbind.h
+./util_funcs.lo: ../../include/net-snmp/version.h
+./util_funcs.lo: ../../include/net-snmp/session_api.h
+./util_funcs.lo: ../../include/net-snmp/library/snmp_transport.h
+./util_funcs.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./util_funcs.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./util_funcs.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./util_funcs.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./util_funcs.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./util_funcs.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./util_funcs.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./util_funcs.lo: ../../include/net-snmp/library/ucd_compat.h
+./util_funcs.lo: ../../include/net-snmp/pdu_api.h
+./util_funcs.lo: ../../include/net-snmp/mib_api.h
+./util_funcs.lo: ../../include/net-snmp/library/mib.h
+./util_funcs.lo: ../../include/net-snmp/library/parse.h
+./util_funcs.lo: ../../include/net-snmp/varbind_api.h
+./util_funcs.lo: ../../include/net-snmp/config_api.h
+./util_funcs.lo: ../../include/net-snmp/library/read_config.h
+./util_funcs.lo: ../../include/net-snmp/library/default_store.h
+./util_funcs.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./util_funcs.lo: ../../include/net-snmp/library/snmp_enum.h
+./util_funcs.lo: ../../include/net-snmp/library/vacm.h
+./util_funcs.lo: ../../include/net-snmp/output_api.h
+./util_funcs.lo: ../../include/net-snmp/library/snmp_debug.h
+./util_funcs.lo: ../../include/net-snmp/library/snmp_logging.h
+./util_funcs.lo: ../../include/net-snmp/snmpv3_api.h
+./util_funcs.lo: ../../include/net-snmp/library/snmpv3.h
+./util_funcs.lo: ../../include/net-snmp/library/transform_oids.h
+./util_funcs.lo: ../../include/net-snmp/library/keytools.h
+./util_funcs.lo: ../../include/net-snmp/library/scapi.h
+./util_funcs.lo: ../../include/net-snmp/library/lcd_time.h
+./util_funcs.lo: ../../include/net-snmp/library/snmp_secmod.h
+./util_funcs.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./util_funcs.lo: ../../include/net-snmp/library/snmpusm.h
+./util_funcs.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./util_funcs.lo: ../../include/net-snmp/agent/snmp_agent.h
+./util_funcs.lo: ../../include/net-snmp/agent/snmp_vars.h
+./util_funcs.lo: ../../include/net-snmp/agent/agent_handler.h
+./util_funcs.lo: ../../include/net-snmp/agent/var_struct.h
+./util_funcs.lo: ../../include/net-snmp/agent/agent_registry.h
+./util_funcs.lo: ../../include/net-snmp/agent/ds_agent.h
+./util_funcs.lo: ../../include/net-snmp/agent/agent_read_config.h
+./util_funcs.lo: ../../include/net-snmp/agent/agent_trap.h
+./util_funcs.lo: ../../include/net-snmp/agent/all_helpers.h
+./util_funcs.lo: ../../include/net-snmp/agent/instance.h
+./util_funcs.lo: ../../include/net-snmp/agent/multiplexer.h
+./util_funcs.lo: ../../include/net-snmp/agent/null.h
+./util_funcs.lo: ../../include/net-snmp/agent/debug_handler.h
+./util_funcs.lo: ../../include/net-snmp/agent/old_api.h
+./util_funcs.lo: ../../include/net-snmp/agent/read_only.h
+./util_funcs.lo: ../../include/net-snmp/agent/serialize.h
+./util_funcs.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./util_funcs.lo: ../../include/net-snmp/agent/mode_end_call.h
+./util_funcs.lo: ../../include/net-snmp/agent/table.h
+./util_funcs.lo: ../../include/net-snmp/agent/table_data.h
+./util_funcs.lo: ../../include/net-snmp/agent/table_dataset.h
+./util_funcs.lo: ../../include/net-snmp/agent/table_iterator.h
+./util_funcs.lo: ../../include/net-snmp/agent/mib_module_config.h struct.h
+./util_funcs.lo: util_funcs.h ucd-snmp/errormib.h mibdefs.h
+./agent/nsModuleTable.lo: ../../include/net-snmp/net-snmp-config.h
+./agent/nsModuleTable.lo: ../../include/net-snmp/system/linux.h
+./agent/nsModuleTable.lo: ../../include/net-snmp/system/sysv.h
+./agent/nsModuleTable.lo: ../../include/net-snmp/system/generic.h
+./agent/nsModuleTable.lo: ../../include/net-snmp/machine/generic.h
+./agent/nsModuleTable.lo: ../../include/net-snmp/net-snmp-includes.h
+./agent/nsModuleTable.lo: ../../include/net-snmp/definitions.h
+./agent/nsModuleTable.lo: ../../include/net-snmp/types.h
+./agent/nsModuleTable.lo: ../../include/net-snmp/library/snmp_api.h
+./agent/nsModuleTable.lo: ../../include/net-snmp/library/asn1.h
+./agent/nsModuleTable.lo: ../../include/net-snmp/library/snmp_impl.h
+./agent/nsModuleTable.lo: ../../include/net-snmp/library/snmp.h
+./agent/nsModuleTable.lo: ../../include/net-snmp/library/snmp-tc.h
+./agent/nsModuleTable.lo: ../../include/net-snmp/utilities.h
+./agent/nsModuleTable.lo: ../../include/net-snmp/library/snmp_client.h
+./agent/nsModuleTable.lo: ../../include/net-snmp/library/getopt.h
+./agent/nsModuleTable.lo: ../../include/net-snmp/library/system.h
+./agent/nsModuleTable.lo: ../../include/net-snmp/library/tools.h
+./agent/nsModuleTable.lo: ../../include/net-snmp/library/int64.h
+./agent/nsModuleTable.lo: ../../include/net-snmp/library/mt_support.h
+./agent/nsModuleTable.lo: ../../include/net-snmp/library/snmp_alarm.h
+./agent/nsModuleTable.lo: ../../include/net-snmp/library/data_list.h
+./agent/nsModuleTable.lo: ../../include/net-snmp/library/callback.h
+./agent/nsModuleTable.lo: ../../include/net-snmp/library/oid_stash.h
+./agent/nsModuleTable.lo: ../../include/net-snmp/library/check_varbind.h
+./agent/nsModuleTable.lo: ../../include/net-snmp/version.h
+./agent/nsModuleTable.lo: ../../include/net-snmp/session_api.h
+./agent/nsModuleTable.lo: ../../include/net-snmp/library/snmp_transport.h
+./agent/nsModuleTable.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./agent/nsModuleTable.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./agent/nsModuleTable.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./agent/nsModuleTable.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./agent/nsModuleTable.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./agent/nsModuleTable.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./agent/nsModuleTable.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./agent/nsModuleTable.lo: ../../include/net-snmp/library/ucd_compat.h
+./agent/nsModuleTable.lo: ../../include/net-snmp/pdu_api.h
+./agent/nsModuleTable.lo: ../../include/net-snmp/mib_api.h
+./agent/nsModuleTable.lo: ../../include/net-snmp/library/mib.h
+./agent/nsModuleTable.lo: ../../include/net-snmp/library/parse.h
+./agent/nsModuleTable.lo: ../../include/net-snmp/varbind_api.h
+./agent/nsModuleTable.lo: ../../include/net-snmp/config_api.h
+./agent/nsModuleTable.lo: ../../include/net-snmp/library/read_config.h
+./agent/nsModuleTable.lo: ../../include/net-snmp/library/default_store.h
+./agent/nsModuleTable.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./agent/nsModuleTable.lo: ../../include/net-snmp/library/snmp_enum.h
+./agent/nsModuleTable.lo: ../../include/net-snmp/library/vacm.h
+./agent/nsModuleTable.lo: ../../include/net-snmp/output_api.h
+./agent/nsModuleTable.lo: ../../include/net-snmp/library/snmp_debug.h
+./agent/nsModuleTable.lo: ../../include/net-snmp/library/snmp_logging.h
+./agent/nsModuleTable.lo: ../../include/net-snmp/snmpv3_api.h
+./agent/nsModuleTable.lo: ../../include/net-snmp/library/snmpv3.h
+./agent/nsModuleTable.lo: ../../include/net-snmp/library/transform_oids.h
+./agent/nsModuleTable.lo: ../../include/net-snmp/library/keytools.h
+./agent/nsModuleTable.lo: ../../include/net-snmp/library/scapi.h
+./agent/nsModuleTable.lo: ../../include/net-snmp/library/lcd_time.h
+./agent/nsModuleTable.lo: ../../include/net-snmp/library/snmp_secmod.h
+./agent/nsModuleTable.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./agent/nsModuleTable.lo: ../../include/net-snmp/library/snmpusm.h
+./agent/nsModuleTable.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./agent/nsModuleTable.lo: ../../include/net-snmp/agent/snmp_agent.h
+./agent/nsModuleTable.lo: ../../include/net-snmp/agent/snmp_vars.h
+./agent/nsModuleTable.lo: ../../include/net-snmp/agent/agent_handler.h
+./agent/nsModuleTable.lo: ../../include/net-snmp/agent/var_struct.h
+./agent/nsModuleTable.lo: ../../include/net-snmp/agent/agent_registry.h
+./agent/nsModuleTable.lo: ../../include/net-snmp/agent/ds_agent.h
+./agent/nsModuleTable.lo: ../../include/net-snmp/agent/agent_read_config.h
+./agent/nsModuleTable.lo: ../../include/net-snmp/agent/agent_trap.h
+./agent/nsModuleTable.lo: ../../include/net-snmp/agent/all_helpers.h
+./agent/nsModuleTable.lo: ../../include/net-snmp/agent/instance.h
+./agent/nsModuleTable.lo: ../../include/net-snmp/agent/multiplexer.h
+./agent/nsModuleTable.lo: ../../include/net-snmp/agent/null.h
+./agent/nsModuleTable.lo: ../../include/net-snmp/agent/debug_handler.h
+./agent/nsModuleTable.lo: ../../include/net-snmp/agent/old_api.h
+./agent/nsModuleTable.lo: ../../include/net-snmp/agent/read_only.h
+./agent/nsModuleTable.lo: ../../include/net-snmp/agent/serialize.h
+./agent/nsModuleTable.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./agent/nsModuleTable.lo: ../../include/net-snmp/agent/mode_end_call.h
+./agent/nsModuleTable.lo: ../../include/net-snmp/agent/table.h
+./agent/nsModuleTable.lo: ../../include/net-snmp/agent/table_data.h
+./agent/nsModuleTable.lo: ../../include/net-snmp/agent/table_dataset.h
+./agent/nsModuleTable.lo: ../../include/net-snmp/agent/table_iterator.h
+./agent/nsModuleTable.lo: ../../include/net-snmp/agent/mib_module_config.h
+./agent/nsModuleTable.lo: ./agent/nsModuleTable.h
+./agent/nsTransactionTable.lo: ../../include/net-snmp/net-snmp-config.h
+./agent/nsTransactionTable.lo: ../../include/net-snmp/system/linux.h
+./agent/nsTransactionTable.lo: ../../include/net-snmp/system/sysv.h
+./agent/nsTransactionTable.lo: ../../include/net-snmp/system/generic.h
+./agent/nsTransactionTable.lo: ../../include/net-snmp/machine/generic.h
+./agent/nsTransactionTable.lo: ../../include/net-snmp/net-snmp-includes.h
+./agent/nsTransactionTable.lo: ../../include/net-snmp/definitions.h
+./agent/nsTransactionTable.lo: ../../include/net-snmp/types.h
+./agent/nsTransactionTable.lo: ../../include/net-snmp/library/snmp_api.h
+./agent/nsTransactionTable.lo: ../../include/net-snmp/library/asn1.h
+./agent/nsTransactionTable.lo: ../../include/net-snmp/library/snmp_impl.h
+./agent/nsTransactionTable.lo: ../../include/net-snmp/library/snmp.h
+./agent/nsTransactionTable.lo: ../../include/net-snmp/library/snmp-tc.h
+./agent/nsTransactionTable.lo: ../../include/net-snmp/utilities.h
+./agent/nsTransactionTable.lo: ../../include/net-snmp/library/snmp_client.h
+./agent/nsTransactionTable.lo: ../../include/net-snmp/library/getopt.h
+./agent/nsTransactionTable.lo: ../../include/net-snmp/library/system.h
+./agent/nsTransactionTable.lo: ../../include/net-snmp/library/tools.h
+./agent/nsTransactionTable.lo: ../../include/net-snmp/library/int64.h
+./agent/nsTransactionTable.lo: ../../include/net-snmp/library/mt_support.h
+./agent/nsTransactionTable.lo: ../../include/net-snmp/library/snmp_alarm.h
+./agent/nsTransactionTable.lo: ../../include/net-snmp/library/data_list.h
+./agent/nsTransactionTable.lo: ../../include/net-snmp/library/callback.h
+./agent/nsTransactionTable.lo: ../../include/net-snmp/library/oid_stash.h
+./agent/nsTransactionTable.lo: ../../include/net-snmp/library/check_varbind.h
+./agent/nsTransactionTable.lo: ../../include/net-snmp/version.h
+./agent/nsTransactionTable.lo: ../../include/net-snmp/session_api.h
+./agent/nsTransactionTable.lo: ../../include/net-snmp/library/snmp_transport.h
+./agent/nsTransactionTable.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./agent/nsTransactionTable.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./agent/nsTransactionTable.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./agent/nsTransactionTable.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./agent/nsTransactionTable.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./agent/nsTransactionTable.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./agent/nsTransactionTable.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./agent/nsTransactionTable.lo: ../../include/net-snmp/library/ucd_compat.h
+./agent/nsTransactionTable.lo: ../../include/net-snmp/pdu_api.h
+./agent/nsTransactionTable.lo: ../../include/net-snmp/mib_api.h
+./agent/nsTransactionTable.lo: ../../include/net-snmp/library/mib.h
+./agent/nsTransactionTable.lo: ../../include/net-snmp/library/parse.h
+./agent/nsTransactionTable.lo: ../../include/net-snmp/varbind_api.h
+./agent/nsTransactionTable.lo: ../../include/net-snmp/config_api.h
+./agent/nsTransactionTable.lo: ../../include/net-snmp/library/read_config.h
+./agent/nsTransactionTable.lo: ../../include/net-snmp/library/default_store.h
+./agent/nsTransactionTable.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./agent/nsTransactionTable.lo: ../../include/net-snmp/library/snmp_enum.h
+./agent/nsTransactionTable.lo: ../../include/net-snmp/library/vacm.h
+./agent/nsTransactionTable.lo: ../../include/net-snmp/output_api.h
+./agent/nsTransactionTable.lo: ../../include/net-snmp/library/snmp_debug.h
+./agent/nsTransactionTable.lo: ../../include/net-snmp/library/snmp_logging.h
+./agent/nsTransactionTable.lo: ../../include/net-snmp/snmpv3_api.h
+./agent/nsTransactionTable.lo: ../../include/net-snmp/library/snmpv3.h
+./agent/nsTransactionTable.lo: ../../include/net-snmp/library/transform_oids.h
+./agent/nsTransactionTable.lo: ../../include/net-snmp/library/keytools.h
+./agent/nsTransactionTable.lo: ../../include/net-snmp/library/scapi.h
+./agent/nsTransactionTable.lo: ../../include/net-snmp/library/lcd_time.h
+./agent/nsTransactionTable.lo: ../../include/net-snmp/library/snmp_secmod.h
+./agent/nsTransactionTable.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./agent/nsTransactionTable.lo: ../../include/net-snmp/library/snmpusm.h
+./agent/nsTransactionTable.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./agent/nsTransactionTable.lo: ../../include/net-snmp/agent/snmp_agent.h
+./agent/nsTransactionTable.lo: ../../include/net-snmp/agent/snmp_vars.h
+./agent/nsTransactionTable.lo: ../../include/net-snmp/agent/agent_handler.h
+./agent/nsTransactionTable.lo: ../../include/net-snmp/agent/var_struct.h
+./agent/nsTransactionTable.lo: ../../include/net-snmp/agent/agent_registry.h
+./agent/nsTransactionTable.lo: ../../include/net-snmp/agent/ds_agent.h
+./agent/nsTransactionTable.lo: ../../include/net-snmp/agent/agent_read_config.h
+./agent/nsTransactionTable.lo: ../../include/net-snmp/agent/agent_trap.h
+./agent/nsTransactionTable.lo: ../../include/net-snmp/agent/all_helpers.h
+./agent/nsTransactionTable.lo: ../../include/net-snmp/agent/instance.h
+./agent/nsTransactionTable.lo: ../../include/net-snmp/agent/multiplexer.h
+./agent/nsTransactionTable.lo: ../../include/net-snmp/agent/null.h
+./agent/nsTransactionTable.lo: ../../include/net-snmp/agent/debug_handler.h
+./agent/nsTransactionTable.lo: ../../include/net-snmp/agent/old_api.h
+./agent/nsTransactionTable.lo: ../../include/net-snmp/agent/read_only.h
+./agent/nsTransactionTable.lo: ../../include/net-snmp/agent/serialize.h
+./agent/nsTransactionTable.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./agent/nsTransactionTable.lo: ../../include/net-snmp/agent/mode_end_call.h
+./agent/nsTransactionTable.lo: ../../include/net-snmp/agent/table.h
+./agent/nsTransactionTable.lo: ../../include/net-snmp/agent/table_data.h
+./agent/nsTransactionTable.lo: ../../include/net-snmp/agent/table_dataset.h
+./agent/nsTransactionTable.lo: ../../include/net-snmp/agent/table_iterator.h
+./agent/nsTransactionTable.lo: ../../include/net-snmp/agent/mib_module_config.h
+./agent/nsTransactionTable.lo: ./agent/nsTransactionTable.h
+./agentx/agentx_config.lo: ../../include/net-snmp/net-snmp-config.h
+./agentx/agentx_config.lo: ../../include/net-snmp/system/linux.h
+./agentx/agentx_config.lo: ../../include/net-snmp/system/sysv.h
+./agentx/agentx_config.lo: ../../include/net-snmp/system/generic.h
+./agentx/agentx_config.lo: ../../include/net-snmp/machine/generic.h
+./agentx/agentx_config.lo: ../../include/net-snmp/net-snmp-includes.h
+./agentx/agentx_config.lo: ../../include/net-snmp/definitions.h
+./agentx/agentx_config.lo: ../../include/net-snmp/types.h
+./agentx/agentx_config.lo: ../../include/net-snmp/library/snmp_api.h
+./agentx/agentx_config.lo: ../../include/net-snmp/library/asn1.h
+./agentx/agentx_config.lo: ../../include/net-snmp/library/snmp_impl.h
+./agentx/agentx_config.lo: ../../include/net-snmp/library/snmp.h
+./agentx/agentx_config.lo: ../../include/net-snmp/library/snmp-tc.h
+./agentx/agentx_config.lo: ../../include/net-snmp/utilities.h
+./agentx/agentx_config.lo: ../../include/net-snmp/library/snmp_client.h
+./agentx/agentx_config.lo: ../../include/net-snmp/library/getopt.h
+./agentx/agentx_config.lo: ../../include/net-snmp/library/system.h
+./agentx/agentx_config.lo: ../../include/net-snmp/library/tools.h
+./agentx/agentx_config.lo: ../../include/net-snmp/library/int64.h
+./agentx/agentx_config.lo: ../../include/net-snmp/library/mt_support.h
+./agentx/agentx_config.lo: ../../include/net-snmp/library/snmp_alarm.h
+./agentx/agentx_config.lo: ../../include/net-snmp/library/data_list.h
+./agentx/agentx_config.lo: ../../include/net-snmp/library/callback.h
+./agentx/agentx_config.lo: ../../include/net-snmp/library/oid_stash.h
+./agentx/agentx_config.lo: ../../include/net-snmp/library/check_varbind.h
+./agentx/agentx_config.lo: ../../include/net-snmp/version.h
+./agentx/agentx_config.lo: ../../include/net-snmp/session_api.h
+./agentx/agentx_config.lo: ../../include/net-snmp/library/snmp_transport.h
+./agentx/agentx_config.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./agentx/agentx_config.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./agentx/agentx_config.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./agentx/agentx_config.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./agentx/agentx_config.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./agentx/agentx_config.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./agentx/agentx_config.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./agentx/agentx_config.lo: ../../include/net-snmp/library/ucd_compat.h
+./agentx/agentx_config.lo: ../../include/net-snmp/pdu_api.h
+./agentx/agentx_config.lo: ../../include/net-snmp/mib_api.h
+./agentx/agentx_config.lo: ../../include/net-snmp/library/mib.h
+./agentx/agentx_config.lo: ../../include/net-snmp/library/parse.h
+./agentx/agentx_config.lo: ../../include/net-snmp/varbind_api.h
+./agentx/agentx_config.lo: ../../include/net-snmp/config_api.h
+./agentx/agentx_config.lo: ../../include/net-snmp/library/read_config.h
+./agentx/agentx_config.lo: ../../include/net-snmp/library/default_store.h
+./agentx/agentx_config.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./agentx/agentx_config.lo: ../../include/net-snmp/library/snmp_enum.h
+./agentx/agentx_config.lo: ../../include/net-snmp/library/vacm.h
+./agentx/agentx_config.lo: ../../include/net-snmp/output_api.h
+./agentx/agentx_config.lo: ../../include/net-snmp/library/snmp_debug.h
+./agentx/agentx_config.lo: ../../include/net-snmp/library/snmp_logging.h
+./agentx/agentx_config.lo: ../../include/net-snmp/snmpv3_api.h
+./agentx/agentx_config.lo: ../../include/net-snmp/library/snmpv3.h
+./agentx/agentx_config.lo: ../../include/net-snmp/library/transform_oids.h
+./agentx/agentx_config.lo: ../../include/net-snmp/library/keytools.h
+./agentx/agentx_config.lo: ../../include/net-snmp/library/scapi.h
+./agentx/agentx_config.lo: ../../include/net-snmp/library/lcd_time.h
+./agentx/agentx_config.lo: ../../include/net-snmp/library/snmp_secmod.h
+./agentx/agentx_config.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./agentx/agentx_config.lo: ../../include/net-snmp/library/snmpusm.h
+./agentx/agentx_config.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./agentx/agentx_config.lo: ../../include/net-snmp/agent/snmp_agent.h
+./agentx/agentx_config.lo: ../../include/net-snmp/agent/snmp_vars.h
+./agentx/agentx_config.lo: ../../include/net-snmp/agent/agent_handler.h
+./agentx/agentx_config.lo: ../../include/net-snmp/agent/var_struct.h
+./agentx/agentx_config.lo: ../../include/net-snmp/agent/agent_registry.h
+./agentx/agentx_config.lo: ../../include/net-snmp/agent/ds_agent.h
+./agentx/agentx_config.lo: ../../include/net-snmp/agent/agent_read_config.h
+./agentx/agentx_config.lo: ../../include/net-snmp/agent/agent_trap.h
+./agentx/agentx_config.lo: ../../include/net-snmp/agent/all_helpers.h
+./agentx/agentx_config.lo: ../../include/net-snmp/agent/instance.h
+./agentx/agentx_config.lo: ../../include/net-snmp/agent/multiplexer.h
+./agentx/agentx_config.lo: ../../include/net-snmp/agent/null.h
+./agentx/agentx_config.lo: ../../include/net-snmp/agent/debug_handler.h
+./agentx/agentx_config.lo: ../../include/net-snmp/agent/old_api.h
+./agentx/agentx_config.lo: ../../include/net-snmp/agent/read_only.h
+./agentx/agentx_config.lo: ../../include/net-snmp/agent/serialize.h
+./agentx/agentx_config.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./agentx/agentx_config.lo: ../../include/net-snmp/agent/mode_end_call.h
+./agentx/agentx_config.lo: ../../include/net-snmp/agent/table.h
+./agentx/agentx_config.lo: ../../include/net-snmp/agent/table_data.h
+./agentx/agentx_config.lo: ../../include/net-snmp/agent/table_dataset.h
+./agentx/agentx_config.lo: ../../include/net-snmp/agent/table_iterator.h
+./agentx/agentx_config.lo: ../../include/net-snmp/agent/mib_module_config.h
+./agentx/agentx_config.lo: ./../snmpd.h agentx/agentx_config.h
+./agentx/client.lo: ../../include/net-snmp/net-snmp-config.h
+./agentx/client.lo: ../../include/net-snmp/system/linux.h
+./agentx/client.lo: ../../include/net-snmp/system/sysv.h
+./agentx/client.lo: ../../include/net-snmp/system/generic.h
+./agentx/client.lo: ../../include/net-snmp/machine/generic.h
+./agentx/client.lo: ../../include/net-snmp/net-snmp-includes.h
+./agentx/client.lo: ../../include/net-snmp/definitions.h
+./agentx/client.lo: ../../include/net-snmp/types.h
+./agentx/client.lo: ../../include/net-snmp/library/snmp_api.h
+./agentx/client.lo: ../../include/net-snmp/library/asn1.h
+./agentx/client.lo: ../../include/net-snmp/library/snmp_impl.h
+./agentx/client.lo: ../../include/net-snmp/library/snmp.h
+./agentx/client.lo: ../../include/net-snmp/library/snmp-tc.h
+./agentx/client.lo: ../../include/net-snmp/utilities.h
+./agentx/client.lo: ../../include/net-snmp/library/snmp_client.h
+./agentx/client.lo: ../../include/net-snmp/library/getopt.h
+./agentx/client.lo: ../../include/net-snmp/library/system.h
+./agentx/client.lo: ../../include/net-snmp/library/tools.h
+./agentx/client.lo: ../../include/net-snmp/library/int64.h
+./agentx/client.lo: ../../include/net-snmp/library/mt_support.h
+./agentx/client.lo: ../../include/net-snmp/library/snmp_alarm.h
+./agentx/client.lo: ../../include/net-snmp/library/data_list.h
+./agentx/client.lo: ../../include/net-snmp/library/callback.h
+./agentx/client.lo: ../../include/net-snmp/library/oid_stash.h
+./agentx/client.lo: ../../include/net-snmp/library/check_varbind.h
+./agentx/client.lo: ../../include/net-snmp/version.h
+./agentx/client.lo: ../../include/net-snmp/session_api.h
+./agentx/client.lo: ../../include/net-snmp/library/snmp_transport.h
+./agentx/client.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./agentx/client.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./agentx/client.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./agentx/client.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./agentx/client.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./agentx/client.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./agentx/client.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./agentx/client.lo: ../../include/net-snmp/library/ucd_compat.h
+./agentx/client.lo: ../../include/net-snmp/pdu_api.h
+./agentx/client.lo: ../../include/net-snmp/mib_api.h
+./agentx/client.lo: ../../include/net-snmp/library/mib.h
+./agentx/client.lo: ../../include/net-snmp/library/parse.h
+./agentx/client.lo: ../../include/net-snmp/varbind_api.h
+./agentx/client.lo: ../../include/net-snmp/config_api.h
+./agentx/client.lo: ../../include/net-snmp/library/read_config.h
+./agentx/client.lo: ../../include/net-snmp/library/default_store.h
+./agentx/client.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./agentx/client.lo: ../../include/net-snmp/library/snmp_enum.h
+./agentx/client.lo: ../../include/net-snmp/library/vacm.h
+./agentx/client.lo: ../../include/net-snmp/output_api.h
+./agentx/client.lo: ../../include/net-snmp/library/snmp_debug.h
+./agentx/client.lo: ../../include/net-snmp/library/snmp_logging.h
+./agentx/client.lo: ../../include/net-snmp/snmpv3_api.h
+./agentx/client.lo: ../../include/net-snmp/library/snmpv3.h
+./agentx/client.lo: ../../include/net-snmp/library/transform_oids.h
+./agentx/client.lo: ../../include/net-snmp/library/keytools.h
+./agentx/client.lo: ../../include/net-snmp/library/scapi.h
+./agentx/client.lo: ../../include/net-snmp/library/lcd_time.h
+./agentx/client.lo: ../../include/net-snmp/library/snmp_secmod.h
+./agentx/client.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./agentx/client.lo: ../../include/net-snmp/library/snmpusm.h
+./agentx/client.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./agentx/client.lo: ../../include/net-snmp/agent/snmp_agent.h
+./agentx/client.lo: ../../include/net-snmp/agent/snmp_vars.h
+./agentx/client.lo: ../../include/net-snmp/agent/agent_handler.h
+./agentx/client.lo: ../../include/net-snmp/agent/var_struct.h
+./agentx/client.lo: ../../include/net-snmp/agent/agent_registry.h
+./agentx/client.lo: ../../include/net-snmp/agent/ds_agent.h
+./agentx/client.lo: ../../include/net-snmp/agent/agent_read_config.h
+./agentx/client.lo: ../../include/net-snmp/agent/agent_trap.h
+./agentx/client.lo: ../../include/net-snmp/agent/all_helpers.h
+./agentx/client.lo: ../../include/net-snmp/agent/instance.h
+./agentx/client.lo: ../../include/net-snmp/agent/multiplexer.h
+./agentx/client.lo: ../../include/net-snmp/agent/null.h
+./agentx/client.lo: ../../include/net-snmp/agent/debug_handler.h
+./agentx/client.lo: ../../include/net-snmp/agent/old_api.h
+./agentx/client.lo: ../../include/net-snmp/agent/read_only.h
+./agentx/client.lo: ../../include/net-snmp/agent/serialize.h
+./agentx/client.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./agentx/client.lo: ../../include/net-snmp/agent/mode_end_call.h
+./agentx/client.lo: ../../include/net-snmp/agent/table.h
+./agentx/client.lo: ../../include/net-snmp/agent/table_data.h
+./agentx/client.lo: ../../include/net-snmp/agent/table_dataset.h
+./agentx/client.lo: ../../include/net-snmp/agent/table_iterator.h
+./agentx/client.lo: ../../include/net-snmp/agent/mib_module_config.h
+./agentx/client.lo: ../../include/net-snmp/agent/agent_index.h
+./agentx/client.lo: agentx/protocol.h agentx/client.h agentx/subagent.h
+./agentx/master_admin.lo: ../../include/net-snmp/net-snmp-config.h
+./agentx/master_admin.lo: ../../include/net-snmp/system/linux.h
+./agentx/master_admin.lo: ../../include/net-snmp/system/sysv.h
+./agentx/master_admin.lo: ../../include/net-snmp/system/generic.h
+./agentx/master_admin.lo: ../../include/net-snmp/machine/generic.h
+./agentx/master_admin.lo: ../../include/net-snmp/net-snmp-includes.h
+./agentx/master_admin.lo: ../../include/net-snmp/definitions.h
+./agentx/master_admin.lo: ../../include/net-snmp/types.h
+./agentx/master_admin.lo: ../../include/net-snmp/library/snmp_api.h
+./agentx/master_admin.lo: ../../include/net-snmp/library/asn1.h
+./agentx/master_admin.lo: ../../include/net-snmp/library/snmp_impl.h
+./agentx/master_admin.lo: ../../include/net-snmp/library/snmp.h
+./agentx/master_admin.lo: ../../include/net-snmp/library/snmp-tc.h
+./agentx/master_admin.lo: ../../include/net-snmp/utilities.h
+./agentx/master_admin.lo: ../../include/net-snmp/library/snmp_client.h
+./agentx/master_admin.lo: ../../include/net-snmp/library/getopt.h
+./agentx/master_admin.lo: ../../include/net-snmp/library/system.h
+./agentx/master_admin.lo: ../../include/net-snmp/library/tools.h
+./agentx/master_admin.lo: ../../include/net-snmp/library/int64.h
+./agentx/master_admin.lo: ../../include/net-snmp/library/mt_support.h
+./agentx/master_admin.lo: ../../include/net-snmp/library/snmp_alarm.h
+./agentx/master_admin.lo: ../../include/net-snmp/library/data_list.h
+./agentx/master_admin.lo: ../../include/net-snmp/library/callback.h
+./agentx/master_admin.lo: ../../include/net-snmp/library/oid_stash.h
+./agentx/master_admin.lo: ../../include/net-snmp/library/check_varbind.h
+./agentx/master_admin.lo: ../../include/net-snmp/version.h
+./agentx/master_admin.lo: ../../include/net-snmp/session_api.h
+./agentx/master_admin.lo: ../../include/net-snmp/library/snmp_transport.h
+./agentx/master_admin.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./agentx/master_admin.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./agentx/master_admin.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./agentx/master_admin.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./agentx/master_admin.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./agentx/master_admin.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./agentx/master_admin.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./agentx/master_admin.lo: ../../include/net-snmp/library/ucd_compat.h
+./agentx/master_admin.lo: ../../include/net-snmp/pdu_api.h
+./agentx/master_admin.lo: ../../include/net-snmp/mib_api.h
+./agentx/master_admin.lo: ../../include/net-snmp/library/mib.h
+./agentx/master_admin.lo: ../../include/net-snmp/library/parse.h
+./agentx/master_admin.lo: ../../include/net-snmp/varbind_api.h
+./agentx/master_admin.lo: ../../include/net-snmp/config_api.h
+./agentx/master_admin.lo: ../../include/net-snmp/library/read_config.h
+./agentx/master_admin.lo: ../../include/net-snmp/library/default_store.h
+./agentx/master_admin.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./agentx/master_admin.lo: ../../include/net-snmp/library/snmp_enum.h
+./agentx/master_admin.lo: ../../include/net-snmp/library/vacm.h
+./agentx/master_admin.lo: ../../include/net-snmp/output_api.h
+./agentx/master_admin.lo: ../../include/net-snmp/library/snmp_debug.h
+./agentx/master_admin.lo: ../../include/net-snmp/library/snmp_logging.h
+./agentx/master_admin.lo: ../../include/net-snmp/snmpv3_api.h
+./agentx/master_admin.lo: ../../include/net-snmp/library/snmpv3.h
+./agentx/master_admin.lo: ../../include/net-snmp/library/transform_oids.h
+./agentx/master_admin.lo: ../../include/net-snmp/library/keytools.h
+./agentx/master_admin.lo: ../../include/net-snmp/library/scapi.h
+./agentx/master_admin.lo: ../../include/net-snmp/library/lcd_time.h
+./agentx/master_admin.lo: ../../include/net-snmp/library/snmp_secmod.h
+./agentx/master_admin.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./agentx/master_admin.lo: ../../include/net-snmp/library/snmpusm.h
+./agentx/master_admin.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./agentx/master_admin.lo: ../../include/net-snmp/agent/snmp_agent.h
+./agentx/master_admin.lo: ../../include/net-snmp/agent/snmp_vars.h
+./agentx/master_admin.lo: ../../include/net-snmp/agent/agent_handler.h
+./agentx/master_admin.lo: ../../include/net-snmp/agent/var_struct.h
+./agentx/master_admin.lo: ../../include/net-snmp/agent/agent_registry.h
+./agentx/master_admin.lo: ../../include/net-snmp/agent/ds_agent.h
+./agentx/master_admin.lo: ../../include/net-snmp/agent/agent_read_config.h
+./agentx/master_admin.lo: ../../include/net-snmp/agent/agent_trap.h
+./agentx/master_admin.lo: ../../include/net-snmp/agent/all_helpers.h
+./agentx/master_admin.lo: ../../include/net-snmp/agent/instance.h
+./agentx/master_admin.lo: ../../include/net-snmp/agent/multiplexer.h
+./agentx/master_admin.lo: ../../include/net-snmp/agent/null.h
+./agentx/master_admin.lo: ../../include/net-snmp/agent/debug_handler.h
+./agentx/master_admin.lo: ../../include/net-snmp/agent/old_api.h
+./agentx/master_admin.lo: ../../include/net-snmp/agent/read_only.h
+./agentx/master_admin.lo: ../../include/net-snmp/agent/serialize.h
+./agentx/master_admin.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./agentx/master_admin.lo: ../../include/net-snmp/agent/mode_end_call.h
+./agentx/master_admin.lo: ../../include/net-snmp/agent/table.h
+./agentx/master_admin.lo: ../../include/net-snmp/agent/table_data.h
+./agentx/master_admin.lo: ../../include/net-snmp/agent/table_dataset.h
+./agentx/master_admin.lo: ../../include/net-snmp/agent/table_iterator.h
+./agentx/master_admin.lo: ../../include/net-snmp/agent/mib_module_config.h
+./agentx/master_admin.lo: agentx/protocol.h agentx/client.h
+./agentx/master_admin.lo: ../../include/net-snmp/agent/agent_index.h
+./agentx/master_admin.lo: mibII/sysORTable.h ./agentx/master.h
+./agentx/master.lo: ../../include/net-snmp/net-snmp-config.h
+./agentx/master.lo: ../../include/net-snmp/system/linux.h
+./agentx/master.lo: ../../include/net-snmp/system/sysv.h
+./agentx/master.lo: ../../include/net-snmp/system/generic.h
+./agentx/master.lo: ../../include/net-snmp/machine/generic.h
+./agentx/master.lo: ../../include/net-snmp/net-snmp-includes.h
+./agentx/master.lo: ../../include/net-snmp/definitions.h
+./agentx/master.lo: ../../include/net-snmp/types.h
+./agentx/master.lo: ../../include/net-snmp/library/snmp_api.h
+./agentx/master.lo: ../../include/net-snmp/library/asn1.h
+./agentx/master.lo: ../../include/net-snmp/library/snmp_impl.h
+./agentx/master.lo: ../../include/net-snmp/library/snmp.h
+./agentx/master.lo: ../../include/net-snmp/library/snmp-tc.h
+./agentx/master.lo: ../../include/net-snmp/utilities.h
+./agentx/master.lo: ../../include/net-snmp/library/snmp_client.h
+./agentx/master.lo: ../../include/net-snmp/library/getopt.h
+./agentx/master.lo: ../../include/net-snmp/library/system.h
+./agentx/master.lo: ../../include/net-snmp/library/tools.h
+./agentx/master.lo: ../../include/net-snmp/library/int64.h
+./agentx/master.lo: ../../include/net-snmp/library/mt_support.h
+./agentx/master.lo: ../../include/net-snmp/library/snmp_alarm.h
+./agentx/master.lo: ../../include/net-snmp/library/data_list.h
+./agentx/master.lo: ../../include/net-snmp/library/callback.h
+./agentx/master.lo: ../../include/net-snmp/library/oid_stash.h
+./agentx/master.lo: ../../include/net-snmp/library/check_varbind.h
+./agentx/master.lo: ../../include/net-snmp/version.h
+./agentx/master.lo: ../../include/net-snmp/session_api.h
+./agentx/master.lo: ../../include/net-snmp/library/snmp_transport.h
+./agentx/master.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./agentx/master.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./agentx/master.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./agentx/master.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./agentx/master.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./agentx/master.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./agentx/master.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./agentx/master.lo: ../../include/net-snmp/library/ucd_compat.h
+./agentx/master.lo: ../../include/net-snmp/pdu_api.h
+./agentx/master.lo: ../../include/net-snmp/mib_api.h
+./agentx/master.lo: ../../include/net-snmp/library/mib.h
+./agentx/master.lo: ../../include/net-snmp/library/parse.h
+./agentx/master.lo: ../../include/net-snmp/varbind_api.h
+./agentx/master.lo: ../../include/net-snmp/config_api.h
+./agentx/master.lo: ../../include/net-snmp/library/read_config.h
+./agentx/master.lo: ../../include/net-snmp/library/default_store.h
+./agentx/master.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./agentx/master.lo: ../../include/net-snmp/library/snmp_enum.h
+./agentx/master.lo: ../../include/net-snmp/library/vacm.h
+./agentx/master.lo: ../../include/net-snmp/output_api.h
+./agentx/master.lo: ../../include/net-snmp/library/snmp_debug.h
+./agentx/master.lo: ../../include/net-snmp/library/snmp_logging.h
+./agentx/master.lo: ../../include/net-snmp/snmpv3_api.h
+./agentx/master.lo: ../../include/net-snmp/library/snmpv3.h
+./agentx/master.lo: ../../include/net-snmp/library/transform_oids.h
+./agentx/master.lo: ../../include/net-snmp/library/keytools.h
+./agentx/master.lo: ../../include/net-snmp/library/scapi.h
+./agentx/master.lo: ../../include/net-snmp/library/lcd_time.h
+./agentx/master.lo: ../../include/net-snmp/library/snmp_secmod.h
+./agentx/master.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./agentx/master.lo: ../../include/net-snmp/library/snmpusm.h
+./agentx/master.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./agentx/master.lo: ../../include/net-snmp/agent/snmp_agent.h
+./agentx/master.lo: ../../include/net-snmp/agent/snmp_vars.h
+./agentx/master.lo: ../../include/net-snmp/agent/agent_handler.h
+./agentx/master.lo: ../../include/net-snmp/agent/var_struct.h
+./agentx/master.lo: ../../include/net-snmp/agent/agent_registry.h
+./agentx/master.lo: ../../include/net-snmp/agent/ds_agent.h
+./agentx/master.lo: ../../include/net-snmp/agent/agent_read_config.h
+./agentx/master.lo: ../../include/net-snmp/agent/agent_trap.h
+./agentx/master.lo: ../../include/net-snmp/agent/all_helpers.h
+./agentx/master.lo: ../../include/net-snmp/agent/instance.h
+./agentx/master.lo: ../../include/net-snmp/agent/multiplexer.h
+./agentx/master.lo: ../../include/net-snmp/agent/null.h
+./agentx/master.lo: ../../include/net-snmp/agent/debug_handler.h
+./agentx/master.lo: ../../include/net-snmp/agent/old_api.h
+./agentx/master.lo: ../../include/net-snmp/agent/read_only.h
+./agentx/master.lo: ../../include/net-snmp/agent/serialize.h
+./agentx/master.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./agentx/master.lo: ../../include/net-snmp/agent/mode_end_call.h
+./agentx/master.lo: ../../include/net-snmp/agent/table.h
+./agentx/master.lo: ../../include/net-snmp/agent/table_data.h
+./agentx/master.lo: ../../include/net-snmp/agent/table_dataset.h
+./agentx/master.lo: ../../include/net-snmp/agent/table_iterator.h
+./agentx/master.lo: ../../include/net-snmp/agent/mib_module_config.h
+./agentx/master.lo: ./../snmpd.h agentx/protocol.h agentx/master_admin.h
+./agentx/protocol.lo: ../../include/net-snmp/net-snmp-config.h
+./agentx/protocol.lo: ../../include/net-snmp/system/linux.h
+./agentx/protocol.lo: ../../include/net-snmp/system/sysv.h
+./agentx/protocol.lo: ../../include/net-snmp/system/generic.h
+./agentx/protocol.lo: ../../include/net-snmp/machine/generic.h
+./agentx/protocol.lo: ../../include/net-snmp/net-snmp-includes.h
+./agentx/protocol.lo: ../../include/net-snmp/definitions.h
+./agentx/protocol.lo: ../../include/net-snmp/types.h
+./agentx/protocol.lo: ../../include/net-snmp/library/snmp_api.h
+./agentx/protocol.lo: ../../include/net-snmp/library/asn1.h
+./agentx/protocol.lo: ../../include/net-snmp/library/snmp_impl.h
+./agentx/protocol.lo: ../../include/net-snmp/library/snmp.h
+./agentx/protocol.lo: ../../include/net-snmp/library/snmp-tc.h
+./agentx/protocol.lo: ../../include/net-snmp/utilities.h
+./agentx/protocol.lo: ../../include/net-snmp/library/snmp_client.h
+./agentx/protocol.lo: ../../include/net-snmp/library/getopt.h
+./agentx/protocol.lo: ../../include/net-snmp/library/system.h
+./agentx/protocol.lo: ../../include/net-snmp/library/tools.h
+./agentx/protocol.lo: ../../include/net-snmp/library/int64.h
+./agentx/protocol.lo: ../../include/net-snmp/library/mt_support.h
+./agentx/protocol.lo: ../../include/net-snmp/library/snmp_alarm.h
+./agentx/protocol.lo: ../../include/net-snmp/library/data_list.h
+./agentx/protocol.lo: ../../include/net-snmp/library/callback.h
+./agentx/protocol.lo: ../../include/net-snmp/library/oid_stash.h
+./agentx/protocol.lo: ../../include/net-snmp/library/check_varbind.h
+./agentx/protocol.lo: ../../include/net-snmp/version.h
+./agentx/protocol.lo: ../../include/net-snmp/session_api.h
+./agentx/protocol.lo: ../../include/net-snmp/library/snmp_transport.h
+./agentx/protocol.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./agentx/protocol.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./agentx/protocol.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./agentx/protocol.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./agentx/protocol.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./agentx/protocol.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./agentx/protocol.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./agentx/protocol.lo: ../../include/net-snmp/library/ucd_compat.h
+./agentx/protocol.lo: ../../include/net-snmp/pdu_api.h
+./agentx/protocol.lo: ../../include/net-snmp/mib_api.h
+./agentx/protocol.lo: ../../include/net-snmp/library/mib.h
+./agentx/protocol.lo: ../../include/net-snmp/library/parse.h
+./agentx/protocol.lo: ../../include/net-snmp/varbind_api.h
+./agentx/protocol.lo: ../../include/net-snmp/config_api.h
+./agentx/protocol.lo: ../../include/net-snmp/library/read_config.h
+./agentx/protocol.lo: ../../include/net-snmp/library/default_store.h
+./agentx/protocol.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./agentx/protocol.lo: ../../include/net-snmp/library/snmp_enum.h
+./agentx/protocol.lo: ../../include/net-snmp/library/vacm.h
+./agentx/protocol.lo: ../../include/net-snmp/output_api.h
+./agentx/protocol.lo: ../../include/net-snmp/library/snmp_debug.h
+./agentx/protocol.lo: ../../include/net-snmp/library/snmp_logging.h
+./agentx/protocol.lo: ../../include/net-snmp/snmpv3_api.h
+./agentx/protocol.lo: ../../include/net-snmp/library/snmpv3.h
+./agentx/protocol.lo: ../../include/net-snmp/library/transform_oids.h
+./agentx/protocol.lo: ../../include/net-snmp/library/keytools.h
+./agentx/protocol.lo: ../../include/net-snmp/library/scapi.h
+./agentx/protocol.lo: ../../include/net-snmp/library/lcd_time.h
+./agentx/protocol.lo: ../../include/net-snmp/library/snmp_secmod.h
+./agentx/protocol.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./agentx/protocol.lo: ../../include/net-snmp/library/snmpusm.h
+./agentx/protocol.lo: agentx/protocol.h
+./agentx/subagent.lo: ../../include/net-snmp/net-snmp-config.h
+./agentx/subagent.lo: ../../include/net-snmp/system/linux.h
+./agentx/subagent.lo: ../../include/net-snmp/system/sysv.h
+./agentx/subagent.lo: ../../include/net-snmp/system/generic.h
+./agentx/subagent.lo: ../../include/net-snmp/machine/generic.h
+./agentx/subagent.lo: ../../include/net-snmp/net-snmp-includes.h
+./agentx/subagent.lo: ../../include/net-snmp/definitions.h
+./agentx/subagent.lo: ../../include/net-snmp/types.h
+./agentx/subagent.lo: ../../include/net-snmp/library/snmp_api.h
+./agentx/subagent.lo: ../../include/net-snmp/library/asn1.h
+./agentx/subagent.lo: ../../include/net-snmp/library/snmp_impl.h
+./agentx/subagent.lo: ../../include/net-snmp/library/snmp.h
+./agentx/subagent.lo: ../../include/net-snmp/library/snmp-tc.h
+./agentx/subagent.lo: ../../include/net-snmp/utilities.h
+./agentx/subagent.lo: ../../include/net-snmp/library/snmp_client.h
+./agentx/subagent.lo: ../../include/net-snmp/library/getopt.h
+./agentx/subagent.lo: ../../include/net-snmp/library/system.h
+./agentx/subagent.lo: ../../include/net-snmp/library/tools.h
+./agentx/subagent.lo: ../../include/net-snmp/library/int64.h
+./agentx/subagent.lo: ../../include/net-snmp/library/mt_support.h
+./agentx/subagent.lo: ../../include/net-snmp/library/snmp_alarm.h
+./agentx/subagent.lo: ../../include/net-snmp/library/data_list.h
+./agentx/subagent.lo: ../../include/net-snmp/library/callback.h
+./agentx/subagent.lo: ../../include/net-snmp/library/oid_stash.h
+./agentx/subagent.lo: ../../include/net-snmp/library/check_varbind.h
+./agentx/subagent.lo: ../../include/net-snmp/version.h
+./agentx/subagent.lo: ../../include/net-snmp/session_api.h
+./agentx/subagent.lo: ../../include/net-snmp/library/snmp_transport.h
+./agentx/subagent.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./agentx/subagent.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./agentx/subagent.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./agentx/subagent.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./agentx/subagent.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./agentx/subagent.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./agentx/subagent.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./agentx/subagent.lo: ../../include/net-snmp/library/ucd_compat.h
+./agentx/subagent.lo: ../../include/net-snmp/pdu_api.h
+./agentx/subagent.lo: ../../include/net-snmp/mib_api.h
+./agentx/subagent.lo: ../../include/net-snmp/library/mib.h
+./agentx/subagent.lo: ../../include/net-snmp/library/parse.h
+./agentx/subagent.lo: ../../include/net-snmp/varbind_api.h
+./agentx/subagent.lo: ../../include/net-snmp/config_api.h
+./agentx/subagent.lo: ../../include/net-snmp/library/read_config.h
+./agentx/subagent.lo: ../../include/net-snmp/library/default_store.h
+./agentx/subagent.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./agentx/subagent.lo: ../../include/net-snmp/library/snmp_enum.h
+./agentx/subagent.lo: ../../include/net-snmp/library/vacm.h
+./agentx/subagent.lo: ../../include/net-snmp/output_api.h
+./agentx/subagent.lo: ../../include/net-snmp/library/snmp_debug.h
+./agentx/subagent.lo: ../../include/net-snmp/library/snmp_logging.h
+./agentx/subagent.lo: ../../include/net-snmp/snmpv3_api.h
+./agentx/subagent.lo: ../../include/net-snmp/library/snmpv3.h
+./agentx/subagent.lo: ../../include/net-snmp/library/transform_oids.h
+./agentx/subagent.lo: ../../include/net-snmp/library/keytools.h
+./agentx/subagent.lo: ../../include/net-snmp/library/scapi.h
+./agentx/subagent.lo: ../../include/net-snmp/library/lcd_time.h
+./agentx/subagent.lo: ../../include/net-snmp/library/snmp_secmod.h
+./agentx/subagent.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./agentx/subagent.lo: ../../include/net-snmp/library/snmpusm.h
+./agentx/subagent.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./agentx/subagent.lo: ../../include/net-snmp/agent/snmp_agent.h
+./agentx/subagent.lo: ../../include/net-snmp/agent/snmp_vars.h
+./agentx/subagent.lo: ../../include/net-snmp/agent/agent_handler.h
+./agentx/subagent.lo: ../../include/net-snmp/agent/var_struct.h
+./agentx/subagent.lo: ../../include/net-snmp/agent/agent_registry.h
+./agentx/subagent.lo: ../../include/net-snmp/agent/ds_agent.h
+./agentx/subagent.lo: ../../include/net-snmp/agent/agent_read_config.h
+./agentx/subagent.lo: ../../include/net-snmp/agent/agent_trap.h
+./agentx/subagent.lo: ../../include/net-snmp/agent/all_helpers.h
+./agentx/subagent.lo: ../../include/net-snmp/agent/instance.h
+./agentx/subagent.lo: ../../include/net-snmp/agent/multiplexer.h
+./agentx/subagent.lo: ../../include/net-snmp/agent/null.h
+./agentx/subagent.lo: ../../include/net-snmp/agent/debug_handler.h
+./agentx/subagent.lo: ../../include/net-snmp/agent/old_api.h
+./agentx/subagent.lo: ../../include/net-snmp/agent/read_only.h
+./agentx/subagent.lo: ../../include/net-snmp/agent/serialize.h
+./agentx/subagent.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./agentx/subagent.lo: ../../include/net-snmp/agent/mode_end_call.h
+./agentx/subagent.lo: ../../include/net-snmp/agent/table.h
+./agentx/subagent.lo: ../../include/net-snmp/agent/table_data.h
+./agentx/subagent.lo: ../../include/net-snmp/agent/table_dataset.h
+./agentx/subagent.lo: ../../include/net-snmp/agent/table_iterator.h
+./agentx/subagent.lo: ../../include/net-snmp/agent/mib_module_config.h
+./agentx/subagent.lo: ../../include/net-snmp/library/snmp_assert.h
+./agentx/subagent.lo: ./../snmpd.h agentx/protocol.h agentx/client.h
+./agentx/subagent.lo: ../../include/net-snmp/agent/agent_callbacks.h
+./agentx/subagent.lo: mibII/sysORTable.h ./agentx/subagent.h
+./disman/mteEventNotificationTable.lo: ../../include/net-snmp/net-snmp-config.h
+./disman/mteEventNotificationTable.lo: ../../include/net-snmp/system/linux.h
+./disman/mteEventNotificationTable.lo: ../../include/net-snmp/system/sysv.h
+./disman/mteEventNotificationTable.lo: ../../include/net-snmp/system/generic.h
+./disman/mteEventNotificationTable.lo: ../../include/net-snmp/machine/generic.h
+./disman/mteEventNotificationTable.lo: ../../include/net-snmp/net-snmp-includes.h
+./disman/mteEventNotificationTable.lo: ../../include/net-snmp/definitions.h
+./disman/mteEventNotificationTable.lo: ../../include/net-snmp/types.h
+./disman/mteEventNotificationTable.lo: ../../include/net-snmp/library/snmp_api.h
+./disman/mteEventNotificationTable.lo: ../../include/net-snmp/library/asn1.h
+./disman/mteEventNotificationTable.lo: ../../include/net-snmp/library/snmp_impl.h
+./disman/mteEventNotificationTable.lo: ../../include/net-snmp/library/snmp.h
+./disman/mteEventNotificationTable.lo: ../../include/net-snmp/library/snmp-tc.h
+./disman/mteEventNotificationTable.lo: ../../include/net-snmp/utilities.h
+./disman/mteEventNotificationTable.lo: ../../include/net-snmp/library/snmp_client.h
+./disman/mteEventNotificationTable.lo: ../../include/net-snmp/library/getopt.h
+./disman/mteEventNotificationTable.lo: ../../include/net-snmp/library/system.h
+./disman/mteEventNotificationTable.lo: ../../include/net-snmp/library/tools.h
+./disman/mteEventNotificationTable.lo: ../../include/net-snmp/library/int64.h
+./disman/mteEventNotificationTable.lo: ../../include/net-snmp/library/mt_support.h
+./disman/mteEventNotificationTable.lo: ../../include/net-snmp/library/snmp_alarm.h
+./disman/mteEventNotificationTable.lo: ../../include/net-snmp/library/data_list.h
+./disman/mteEventNotificationTable.lo: ../../include/net-snmp/library/callback.h
+./disman/mteEventNotificationTable.lo: ../../include/net-snmp/library/oid_stash.h
+./disman/mteEventNotificationTable.lo: ../../include/net-snmp/library/check_varbind.h
+./disman/mteEventNotificationTable.lo: ../../include/net-snmp/version.h
+./disman/mteEventNotificationTable.lo: ../../include/net-snmp/session_api.h
+./disman/mteEventNotificationTable.lo: ../../include/net-snmp/library/snmp_transport.h
+./disman/mteEventNotificationTable.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./disman/mteEventNotificationTable.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./disman/mteEventNotificationTable.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./disman/mteEventNotificationTable.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./disman/mteEventNotificationTable.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./disman/mteEventNotificationTable.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./disman/mteEventNotificationTable.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./disman/mteEventNotificationTable.lo: ../../include/net-snmp/library/ucd_compat.h
+./disman/mteEventNotificationTable.lo: ../../include/net-snmp/pdu_api.h
+./disman/mteEventNotificationTable.lo: ../../include/net-snmp/mib_api.h
+./disman/mteEventNotificationTable.lo: ../../include/net-snmp/library/mib.h
+./disman/mteEventNotificationTable.lo: ../../include/net-snmp/library/parse.h
+./disman/mteEventNotificationTable.lo: ../../include/net-snmp/varbind_api.h
+./disman/mteEventNotificationTable.lo: ../../include/net-snmp/config_api.h
+./disman/mteEventNotificationTable.lo: ../../include/net-snmp/library/read_config.h
+./disman/mteEventNotificationTable.lo: ../../include/net-snmp/library/default_store.h
+./disman/mteEventNotificationTable.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./disman/mteEventNotificationTable.lo: ../../include/net-snmp/library/snmp_enum.h
+./disman/mteEventNotificationTable.lo: ../../include/net-snmp/library/vacm.h
+./disman/mteEventNotificationTable.lo: ../../include/net-snmp/output_api.h
+./disman/mteEventNotificationTable.lo: ../../include/net-snmp/library/snmp_debug.h
+./disman/mteEventNotificationTable.lo: ../../include/net-snmp/library/snmp_logging.h
+./disman/mteEventNotificationTable.lo: ../../include/net-snmp/snmpv3_api.h
+./disman/mteEventNotificationTable.lo: ../../include/net-snmp/library/snmpv3.h
+./disman/mteEventNotificationTable.lo: ../../include/net-snmp/library/transform_oids.h
+./disman/mteEventNotificationTable.lo: ../../include/net-snmp/library/keytools.h
+./disman/mteEventNotificationTable.lo: ../../include/net-snmp/library/scapi.h
+./disman/mteEventNotificationTable.lo: ../../include/net-snmp/library/lcd_time.h
+./disman/mteEventNotificationTable.lo: ../../include/net-snmp/library/snmp_secmod.h
+./disman/mteEventNotificationTable.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./disman/mteEventNotificationTable.lo: ../../include/net-snmp/library/snmpusm.h
+./disman/mteEventNotificationTable.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./disman/mteEventNotificationTable.lo: ../../include/net-snmp/agent/snmp_agent.h
+./disman/mteEventNotificationTable.lo: ../../include/net-snmp/agent/snmp_vars.h
+./disman/mteEventNotificationTable.lo: ../../include/net-snmp/agent/agent_handler.h
+./disman/mteEventNotificationTable.lo: ../../include/net-snmp/agent/var_struct.h
+./disman/mteEventNotificationTable.lo: ../../include/net-snmp/agent/agent_registry.h
+./disman/mteEventNotificationTable.lo: ../../include/net-snmp/agent/ds_agent.h
+./disman/mteEventNotificationTable.lo: ../../include/net-snmp/agent/agent_read_config.h
+./disman/mteEventNotificationTable.lo: ../../include/net-snmp/agent/agent_trap.h
+./disman/mteEventNotificationTable.lo: ../../include/net-snmp/agent/all_helpers.h
+./disman/mteEventNotificationTable.lo: ../../include/net-snmp/agent/instance.h
+./disman/mteEventNotificationTable.lo: ../../include/net-snmp/agent/multiplexer.h
+./disman/mteEventNotificationTable.lo: ../../include/net-snmp/agent/null.h
+./disman/mteEventNotificationTable.lo: ../../include/net-snmp/agent/debug_handler.h
+./disman/mteEventNotificationTable.lo: ../../include/net-snmp/agent/old_api.h
+./disman/mteEventNotificationTable.lo: ../../include/net-snmp/agent/read_only.h
+./disman/mteEventNotificationTable.lo: ../../include/net-snmp/agent/serialize.h
+./disman/mteEventNotificationTable.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./disman/mteEventNotificationTable.lo: ../../include/net-snmp/agent/mode_end_call.h
+./disman/mteEventNotificationTable.lo: ../../include/net-snmp/agent/table.h
+./disman/mteEventNotificationTable.lo: ../../include/net-snmp/agent/table_data.h
+./disman/mteEventNotificationTable.lo: ../../include/net-snmp/agent/table_dataset.h
+./disman/mteEventNotificationTable.lo: ../../include/net-snmp/agent/table_iterator.h
+./disman/mteEventNotificationTable.lo: ../../include/net-snmp/agent/mib_module_config.h
+./disman/mteEventNotificationTable.lo: ./disman/mteEventNotificationTable.h
+./disman/mteEventTable.lo: ../../include/net-snmp/net-snmp-config.h
+./disman/mteEventTable.lo: ../../include/net-snmp/system/linux.h
+./disman/mteEventTable.lo: ../../include/net-snmp/system/sysv.h
+./disman/mteEventTable.lo: ../../include/net-snmp/system/generic.h
+./disman/mteEventTable.lo: ../../include/net-snmp/machine/generic.h
+./disman/mteEventTable.lo: ../../include/net-snmp/net-snmp-includes.h
+./disman/mteEventTable.lo: ../../include/net-snmp/definitions.h
+./disman/mteEventTable.lo: ../../include/net-snmp/types.h
+./disman/mteEventTable.lo: ../../include/net-snmp/library/snmp_api.h
+./disman/mteEventTable.lo: ../../include/net-snmp/library/asn1.h
+./disman/mteEventTable.lo: ../../include/net-snmp/library/snmp_impl.h
+./disman/mteEventTable.lo: ../../include/net-snmp/library/snmp.h
+./disman/mteEventTable.lo: ../../include/net-snmp/library/snmp-tc.h
+./disman/mteEventTable.lo: ../../include/net-snmp/utilities.h
+./disman/mteEventTable.lo: ../../include/net-snmp/library/snmp_client.h
+./disman/mteEventTable.lo: ../../include/net-snmp/library/getopt.h
+./disman/mteEventTable.lo: ../../include/net-snmp/library/system.h
+./disman/mteEventTable.lo: ../../include/net-snmp/library/tools.h
+./disman/mteEventTable.lo: ../../include/net-snmp/library/int64.h
+./disman/mteEventTable.lo: ../../include/net-snmp/library/mt_support.h
+./disman/mteEventTable.lo: ../../include/net-snmp/library/snmp_alarm.h
+./disman/mteEventTable.lo: ../../include/net-snmp/library/data_list.h
+./disman/mteEventTable.lo: ../../include/net-snmp/library/callback.h
+./disman/mteEventTable.lo: ../../include/net-snmp/library/oid_stash.h
+./disman/mteEventTable.lo: ../../include/net-snmp/library/check_varbind.h
+./disman/mteEventTable.lo: ../../include/net-snmp/version.h
+./disman/mteEventTable.lo: ../../include/net-snmp/session_api.h
+./disman/mteEventTable.lo: ../../include/net-snmp/library/snmp_transport.h
+./disman/mteEventTable.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./disman/mteEventTable.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./disman/mteEventTable.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./disman/mteEventTable.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./disman/mteEventTable.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./disman/mteEventTable.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./disman/mteEventTable.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./disman/mteEventTable.lo: ../../include/net-snmp/library/ucd_compat.h
+./disman/mteEventTable.lo: ../../include/net-snmp/pdu_api.h
+./disman/mteEventTable.lo: ../../include/net-snmp/mib_api.h
+./disman/mteEventTable.lo: ../../include/net-snmp/library/mib.h
+./disman/mteEventTable.lo: ../../include/net-snmp/library/parse.h
+./disman/mteEventTable.lo: ../../include/net-snmp/varbind_api.h
+./disman/mteEventTable.lo: ../../include/net-snmp/config_api.h
+./disman/mteEventTable.lo: ../../include/net-snmp/library/read_config.h
+./disman/mteEventTable.lo: ../../include/net-snmp/library/default_store.h
+./disman/mteEventTable.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./disman/mteEventTable.lo: ../../include/net-snmp/library/snmp_enum.h
+./disman/mteEventTable.lo: ../../include/net-snmp/library/vacm.h
+./disman/mteEventTable.lo: ../../include/net-snmp/output_api.h
+./disman/mteEventTable.lo: ../../include/net-snmp/library/snmp_debug.h
+./disman/mteEventTable.lo: ../../include/net-snmp/library/snmp_logging.h
+./disman/mteEventTable.lo: ../../include/net-snmp/snmpv3_api.h
+./disman/mteEventTable.lo: ../../include/net-snmp/library/snmpv3.h
+./disman/mteEventTable.lo: ../../include/net-snmp/library/transform_oids.h
+./disman/mteEventTable.lo: ../../include/net-snmp/library/keytools.h
+./disman/mteEventTable.lo: ../../include/net-snmp/library/scapi.h
+./disman/mteEventTable.lo: ../../include/net-snmp/library/lcd_time.h
+./disman/mteEventTable.lo: ../../include/net-snmp/library/snmp_secmod.h
+./disman/mteEventTable.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./disman/mteEventTable.lo: ../../include/net-snmp/library/snmpusm.h
+./disman/mteEventTable.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./disman/mteEventTable.lo: ../../include/net-snmp/agent/snmp_agent.h
+./disman/mteEventTable.lo: ../../include/net-snmp/agent/snmp_vars.h
+./disman/mteEventTable.lo: ../../include/net-snmp/agent/agent_handler.h
+./disman/mteEventTable.lo: ../../include/net-snmp/agent/var_struct.h
+./disman/mteEventTable.lo: ../../include/net-snmp/agent/agent_registry.h
+./disman/mteEventTable.lo: ../../include/net-snmp/agent/ds_agent.h
+./disman/mteEventTable.lo: ../../include/net-snmp/agent/agent_read_config.h
+./disman/mteEventTable.lo: ../../include/net-snmp/agent/agent_trap.h
+./disman/mteEventTable.lo: ../../include/net-snmp/agent/all_helpers.h
+./disman/mteEventTable.lo: ../../include/net-snmp/agent/instance.h
+./disman/mteEventTable.lo: ../../include/net-snmp/agent/multiplexer.h
+./disman/mteEventTable.lo: ../../include/net-snmp/agent/null.h
+./disman/mteEventTable.lo: ../../include/net-snmp/agent/debug_handler.h
+./disman/mteEventTable.lo: ../../include/net-snmp/agent/old_api.h
+./disman/mteEventTable.lo: ../../include/net-snmp/agent/read_only.h
+./disman/mteEventTable.lo: ../../include/net-snmp/agent/serialize.h
+./disman/mteEventTable.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./disman/mteEventTable.lo: ../../include/net-snmp/agent/mode_end_call.h
+./disman/mteEventTable.lo: ../../include/net-snmp/agent/table.h
+./disman/mteEventTable.lo: ../../include/net-snmp/agent/table_data.h
+./disman/mteEventTable.lo: ../../include/net-snmp/agent/table_dataset.h
+./disman/mteEventTable.lo: ../../include/net-snmp/agent/table_iterator.h
+./disman/mteEventTable.lo: ../../include/net-snmp/agent/mib_module_config.h
+./disman/mteEventTable.lo: ./disman/mteTriggerTable.h
+./disman/mteEventTable.lo: ./disman/mteEventTable.h
+./disman/mteEventTable.lo: ./disman/mteEventNotificationTable.h
+./disman/mteEventTable.lo: ./disman/mteObjectsTable.h
+./disman/mteObjectsTable.lo: ../../include/net-snmp/net-snmp-config.h
+./disman/mteObjectsTable.lo: ../../include/net-snmp/system/linux.h
+./disman/mteObjectsTable.lo: ../../include/net-snmp/system/sysv.h
+./disman/mteObjectsTable.lo: ../../include/net-snmp/system/generic.h
+./disman/mteObjectsTable.lo: ../../include/net-snmp/machine/generic.h
+./disman/mteObjectsTable.lo: ../../include/net-snmp/net-snmp-includes.h
+./disman/mteObjectsTable.lo: ../../include/net-snmp/definitions.h
+./disman/mteObjectsTable.lo: ../../include/net-snmp/types.h
+./disman/mteObjectsTable.lo: ../../include/net-snmp/library/snmp_api.h
+./disman/mteObjectsTable.lo: ../../include/net-snmp/library/asn1.h
+./disman/mteObjectsTable.lo: ../../include/net-snmp/library/snmp_impl.h
+./disman/mteObjectsTable.lo: ../../include/net-snmp/library/snmp.h
+./disman/mteObjectsTable.lo: ../../include/net-snmp/library/snmp-tc.h
+./disman/mteObjectsTable.lo: ../../include/net-snmp/utilities.h
+./disman/mteObjectsTable.lo: ../../include/net-snmp/library/snmp_client.h
+./disman/mteObjectsTable.lo: ../../include/net-snmp/library/getopt.h
+./disman/mteObjectsTable.lo: ../../include/net-snmp/library/system.h
+./disman/mteObjectsTable.lo: ../../include/net-snmp/library/tools.h
+./disman/mteObjectsTable.lo: ../../include/net-snmp/library/int64.h
+./disman/mteObjectsTable.lo: ../../include/net-snmp/library/mt_support.h
+./disman/mteObjectsTable.lo: ../../include/net-snmp/library/snmp_alarm.h
+./disman/mteObjectsTable.lo: ../../include/net-snmp/library/data_list.h
+./disman/mteObjectsTable.lo: ../../include/net-snmp/library/callback.h
+./disman/mteObjectsTable.lo: ../../include/net-snmp/library/oid_stash.h
+./disman/mteObjectsTable.lo: ../../include/net-snmp/library/check_varbind.h
+./disman/mteObjectsTable.lo: ../../include/net-snmp/version.h
+./disman/mteObjectsTable.lo: ../../include/net-snmp/session_api.h
+./disman/mteObjectsTable.lo: ../../include/net-snmp/library/snmp_transport.h
+./disman/mteObjectsTable.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./disman/mteObjectsTable.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./disman/mteObjectsTable.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./disman/mteObjectsTable.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./disman/mteObjectsTable.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./disman/mteObjectsTable.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./disman/mteObjectsTable.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./disman/mteObjectsTable.lo: ../../include/net-snmp/library/ucd_compat.h
+./disman/mteObjectsTable.lo: ../../include/net-snmp/pdu_api.h
+./disman/mteObjectsTable.lo: ../../include/net-snmp/mib_api.h
+./disman/mteObjectsTable.lo: ../../include/net-snmp/library/mib.h
+./disman/mteObjectsTable.lo: ../../include/net-snmp/library/parse.h
+./disman/mteObjectsTable.lo: ../../include/net-snmp/varbind_api.h
+./disman/mteObjectsTable.lo: ../../include/net-snmp/config_api.h
+./disman/mteObjectsTable.lo: ../../include/net-snmp/library/read_config.h
+./disman/mteObjectsTable.lo: ../../include/net-snmp/library/default_store.h
+./disman/mteObjectsTable.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./disman/mteObjectsTable.lo: ../../include/net-snmp/library/snmp_enum.h
+./disman/mteObjectsTable.lo: ../../include/net-snmp/library/vacm.h
+./disman/mteObjectsTable.lo: ../../include/net-snmp/output_api.h
+./disman/mteObjectsTable.lo: ../../include/net-snmp/library/snmp_debug.h
+./disman/mteObjectsTable.lo: ../../include/net-snmp/library/snmp_logging.h
+./disman/mteObjectsTable.lo: ../../include/net-snmp/snmpv3_api.h
+./disman/mteObjectsTable.lo: ../../include/net-snmp/library/snmpv3.h
+./disman/mteObjectsTable.lo: ../../include/net-snmp/library/transform_oids.h
+./disman/mteObjectsTable.lo: ../../include/net-snmp/library/keytools.h
+./disman/mteObjectsTable.lo: ../../include/net-snmp/library/scapi.h
+./disman/mteObjectsTable.lo: ../../include/net-snmp/library/lcd_time.h
+./disman/mteObjectsTable.lo: ../../include/net-snmp/library/snmp_secmod.h
+./disman/mteObjectsTable.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./disman/mteObjectsTable.lo: ../../include/net-snmp/library/snmpusm.h
+./disman/mteObjectsTable.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./disman/mteObjectsTable.lo: ../../include/net-snmp/agent/snmp_agent.h
+./disman/mteObjectsTable.lo: ../../include/net-snmp/agent/snmp_vars.h
+./disman/mteObjectsTable.lo: ../../include/net-snmp/agent/agent_handler.h
+./disman/mteObjectsTable.lo: ../../include/net-snmp/agent/var_struct.h
+./disman/mteObjectsTable.lo: ../../include/net-snmp/agent/agent_registry.h
+./disman/mteObjectsTable.lo: ../../include/net-snmp/agent/ds_agent.h
+./disman/mteObjectsTable.lo: ../../include/net-snmp/agent/agent_read_config.h
+./disman/mteObjectsTable.lo: ../../include/net-snmp/agent/agent_trap.h
+./disman/mteObjectsTable.lo: ../../include/net-snmp/agent/all_helpers.h
+./disman/mteObjectsTable.lo: ../../include/net-snmp/agent/instance.h
+./disman/mteObjectsTable.lo: ../../include/net-snmp/agent/multiplexer.h
+./disman/mteObjectsTable.lo: ../../include/net-snmp/agent/null.h
+./disman/mteObjectsTable.lo: ../../include/net-snmp/agent/debug_handler.h
+./disman/mteObjectsTable.lo: ../../include/net-snmp/agent/old_api.h
+./disman/mteObjectsTable.lo: ../../include/net-snmp/agent/read_only.h
+./disman/mteObjectsTable.lo: ../../include/net-snmp/agent/serialize.h
+./disman/mteObjectsTable.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./disman/mteObjectsTable.lo: ../../include/net-snmp/agent/mode_end_call.h
+./disman/mteObjectsTable.lo: ../../include/net-snmp/agent/table.h
+./disman/mteObjectsTable.lo: ../../include/net-snmp/agent/table_data.h
+./disman/mteObjectsTable.lo: ../../include/net-snmp/agent/table_dataset.h
+./disman/mteObjectsTable.lo: ../../include/net-snmp/agent/table_iterator.h
+./disman/mteObjectsTable.lo: ../../include/net-snmp/agent/mib_module_config.h
+./disman/mteObjectsTable.lo: header_complex.h ./disman/mteTriggerTable.h
+./disman/mteObjectsTable.lo: ./disman/mteObjectsTable.h
+./disman/mteTriggerBooleanTable.lo: ../../include/net-snmp/net-snmp-config.h
+./disman/mteTriggerBooleanTable.lo: ../../include/net-snmp/system/linux.h
+./disman/mteTriggerBooleanTable.lo: ../../include/net-snmp/system/sysv.h
+./disman/mteTriggerBooleanTable.lo: ../../include/net-snmp/system/generic.h
+./disman/mteTriggerBooleanTable.lo: ../../include/net-snmp/machine/generic.h
+./disman/mteTriggerBooleanTable.lo: ../../include/net-snmp/net-snmp-includes.h
+./disman/mteTriggerBooleanTable.lo: ../../include/net-snmp/definitions.h
+./disman/mteTriggerBooleanTable.lo: ../../include/net-snmp/types.h
+./disman/mteTriggerBooleanTable.lo: ../../include/net-snmp/library/snmp_api.h
+./disman/mteTriggerBooleanTable.lo: ../../include/net-snmp/library/asn1.h
+./disman/mteTriggerBooleanTable.lo: ../../include/net-snmp/library/snmp_impl.h
+./disman/mteTriggerBooleanTable.lo: ../../include/net-snmp/library/snmp.h
+./disman/mteTriggerBooleanTable.lo: ../../include/net-snmp/library/snmp-tc.h
+./disman/mteTriggerBooleanTable.lo: ../../include/net-snmp/utilities.h
+./disman/mteTriggerBooleanTable.lo: ../../include/net-snmp/library/snmp_client.h
+./disman/mteTriggerBooleanTable.lo: ../../include/net-snmp/library/getopt.h
+./disman/mteTriggerBooleanTable.lo: ../../include/net-snmp/library/system.h
+./disman/mteTriggerBooleanTable.lo: ../../include/net-snmp/library/tools.h
+./disman/mteTriggerBooleanTable.lo: ../../include/net-snmp/library/int64.h
+./disman/mteTriggerBooleanTable.lo: ../../include/net-snmp/library/mt_support.h
+./disman/mteTriggerBooleanTable.lo: ../../include/net-snmp/library/snmp_alarm.h
+./disman/mteTriggerBooleanTable.lo: ../../include/net-snmp/library/data_list.h
+./disman/mteTriggerBooleanTable.lo: ../../include/net-snmp/library/callback.h
+./disman/mteTriggerBooleanTable.lo: ../../include/net-snmp/library/oid_stash.h
+./disman/mteTriggerBooleanTable.lo: ../../include/net-snmp/library/check_varbind.h
+./disman/mteTriggerBooleanTable.lo: ../../include/net-snmp/version.h
+./disman/mteTriggerBooleanTable.lo: ../../include/net-snmp/session_api.h
+./disman/mteTriggerBooleanTable.lo: ../../include/net-snmp/library/snmp_transport.h
+./disman/mteTriggerBooleanTable.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./disman/mteTriggerBooleanTable.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./disman/mteTriggerBooleanTable.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./disman/mteTriggerBooleanTable.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./disman/mteTriggerBooleanTable.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./disman/mteTriggerBooleanTable.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./disman/mteTriggerBooleanTable.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./disman/mteTriggerBooleanTable.lo: ../../include/net-snmp/library/ucd_compat.h
+./disman/mteTriggerBooleanTable.lo: ../../include/net-snmp/pdu_api.h
+./disman/mteTriggerBooleanTable.lo: ../../include/net-snmp/mib_api.h
+./disman/mteTriggerBooleanTable.lo: ../../include/net-snmp/library/mib.h
+./disman/mteTriggerBooleanTable.lo: ../../include/net-snmp/library/parse.h
+./disman/mteTriggerBooleanTable.lo: ../../include/net-snmp/varbind_api.h
+./disman/mteTriggerBooleanTable.lo: ../../include/net-snmp/config_api.h
+./disman/mteTriggerBooleanTable.lo: ../../include/net-snmp/library/read_config.h
+./disman/mteTriggerBooleanTable.lo: ../../include/net-snmp/library/default_store.h
+./disman/mteTriggerBooleanTable.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./disman/mteTriggerBooleanTable.lo: ../../include/net-snmp/library/snmp_enum.h
+./disman/mteTriggerBooleanTable.lo: ../../include/net-snmp/library/vacm.h
+./disman/mteTriggerBooleanTable.lo: ../../include/net-snmp/output_api.h
+./disman/mteTriggerBooleanTable.lo: ../../include/net-snmp/library/snmp_debug.h
+./disman/mteTriggerBooleanTable.lo: ../../include/net-snmp/library/snmp_logging.h
+./disman/mteTriggerBooleanTable.lo: ../../include/net-snmp/snmpv3_api.h
+./disman/mteTriggerBooleanTable.lo: ../../include/net-snmp/library/snmpv3.h
+./disman/mteTriggerBooleanTable.lo: ../../include/net-snmp/library/transform_oids.h
+./disman/mteTriggerBooleanTable.lo: ../../include/net-snmp/library/keytools.h
+./disman/mteTriggerBooleanTable.lo: ../../include/net-snmp/library/scapi.h
+./disman/mteTriggerBooleanTable.lo: ../../include/net-snmp/library/lcd_time.h
+./disman/mteTriggerBooleanTable.lo: ../../include/net-snmp/library/snmp_secmod.h
+./disman/mteTriggerBooleanTable.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./disman/mteTriggerBooleanTable.lo: ../../include/net-snmp/library/snmpusm.h
+./disman/mteTriggerBooleanTable.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./disman/mteTriggerBooleanTable.lo: ../../include/net-snmp/agent/snmp_agent.h
+./disman/mteTriggerBooleanTable.lo: ../../include/net-snmp/agent/snmp_vars.h
+./disman/mteTriggerBooleanTable.lo: ../../include/net-snmp/agent/agent_handler.h
+./disman/mteTriggerBooleanTable.lo: ../../include/net-snmp/agent/var_struct.h
+./disman/mteTriggerBooleanTable.lo: ../../include/net-snmp/agent/agent_registry.h
+./disman/mteTriggerBooleanTable.lo: ../../include/net-snmp/agent/ds_agent.h
+./disman/mteTriggerBooleanTable.lo: ../../include/net-snmp/agent/agent_read_config.h
+./disman/mteTriggerBooleanTable.lo: ../../include/net-snmp/agent/agent_trap.h
+./disman/mteTriggerBooleanTable.lo: ../../include/net-snmp/agent/all_helpers.h
+./disman/mteTriggerBooleanTable.lo: ../../include/net-snmp/agent/instance.h
+./disman/mteTriggerBooleanTable.lo: ../../include/net-snmp/agent/multiplexer.h
+./disman/mteTriggerBooleanTable.lo: ../../include/net-snmp/agent/null.h
+./disman/mteTriggerBooleanTable.lo: ../../include/net-snmp/agent/debug_handler.h
+./disman/mteTriggerBooleanTable.lo: ../../include/net-snmp/agent/old_api.h
+./disman/mteTriggerBooleanTable.lo: ../../include/net-snmp/agent/read_only.h
+./disman/mteTriggerBooleanTable.lo: ../../include/net-snmp/agent/serialize.h
+./disman/mteTriggerBooleanTable.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./disman/mteTriggerBooleanTable.lo: ../../include/net-snmp/agent/mode_end_call.h
+./disman/mteTriggerBooleanTable.lo: ../../include/net-snmp/agent/table.h
+./disman/mteTriggerBooleanTable.lo: ../../include/net-snmp/agent/table_data.h
+./disman/mteTriggerBooleanTable.lo: ../../include/net-snmp/agent/table_dataset.h
+./disman/mteTriggerBooleanTable.lo: ../../include/net-snmp/agent/table_iterator.h
+./disman/mteTriggerBooleanTable.lo: ../../include/net-snmp/agent/mib_module_config.h
+./disman/mteTriggerBooleanTable.lo: header_complex.h
+./disman/mteTriggerBooleanTable.lo: ./disman/mteTriggerBooleanTable.h
+./disman/mteTriggerBooleanTable.lo: ./disman/mteTriggerTable.h
+./disman/mteTriggerDeltaTable.lo: ../../include/net-snmp/net-snmp-config.h
+./disman/mteTriggerDeltaTable.lo: ../../include/net-snmp/system/linux.h
+./disman/mteTriggerDeltaTable.lo: ../../include/net-snmp/system/sysv.h
+./disman/mteTriggerDeltaTable.lo: ../../include/net-snmp/system/generic.h
+./disman/mteTriggerDeltaTable.lo: ../../include/net-snmp/machine/generic.h
+./disman/mteTriggerDeltaTable.lo: ../../include/net-snmp/net-snmp-includes.h
+./disman/mteTriggerDeltaTable.lo: ../../include/net-snmp/definitions.h
+./disman/mteTriggerDeltaTable.lo: ../../include/net-snmp/types.h
+./disman/mteTriggerDeltaTable.lo: ../../include/net-snmp/library/snmp_api.h
+./disman/mteTriggerDeltaTable.lo: ../../include/net-snmp/library/asn1.h
+./disman/mteTriggerDeltaTable.lo: ../../include/net-snmp/library/snmp_impl.h
+./disman/mteTriggerDeltaTable.lo: ../../include/net-snmp/library/snmp.h
+./disman/mteTriggerDeltaTable.lo: ../../include/net-snmp/library/snmp-tc.h
+./disman/mteTriggerDeltaTable.lo: ../../include/net-snmp/utilities.h
+./disman/mteTriggerDeltaTable.lo: ../../include/net-snmp/library/snmp_client.h
+./disman/mteTriggerDeltaTable.lo: ../../include/net-snmp/library/getopt.h
+./disman/mteTriggerDeltaTable.lo: ../../include/net-snmp/library/system.h
+./disman/mteTriggerDeltaTable.lo: ../../include/net-snmp/library/tools.h
+./disman/mteTriggerDeltaTable.lo: ../../include/net-snmp/library/int64.h
+./disman/mteTriggerDeltaTable.lo: ../../include/net-snmp/library/mt_support.h
+./disman/mteTriggerDeltaTable.lo: ../../include/net-snmp/library/snmp_alarm.h
+./disman/mteTriggerDeltaTable.lo: ../../include/net-snmp/library/data_list.h
+./disman/mteTriggerDeltaTable.lo: ../../include/net-snmp/library/callback.h
+./disman/mteTriggerDeltaTable.lo: ../../include/net-snmp/library/oid_stash.h
+./disman/mteTriggerDeltaTable.lo: ../../include/net-snmp/library/check_varbind.h
+./disman/mteTriggerDeltaTable.lo: ../../include/net-snmp/version.h
+./disman/mteTriggerDeltaTable.lo: ../../include/net-snmp/session_api.h
+./disman/mteTriggerDeltaTable.lo: ../../include/net-snmp/library/snmp_transport.h
+./disman/mteTriggerDeltaTable.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./disman/mteTriggerDeltaTable.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./disman/mteTriggerDeltaTable.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./disman/mteTriggerDeltaTable.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./disman/mteTriggerDeltaTable.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./disman/mteTriggerDeltaTable.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./disman/mteTriggerDeltaTable.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./disman/mteTriggerDeltaTable.lo: ../../include/net-snmp/library/ucd_compat.h
+./disman/mteTriggerDeltaTable.lo: ../../include/net-snmp/pdu_api.h
+./disman/mteTriggerDeltaTable.lo: ../../include/net-snmp/mib_api.h
+./disman/mteTriggerDeltaTable.lo: ../../include/net-snmp/library/mib.h
+./disman/mteTriggerDeltaTable.lo: ../../include/net-snmp/library/parse.h
+./disman/mteTriggerDeltaTable.lo: ../../include/net-snmp/varbind_api.h
+./disman/mteTriggerDeltaTable.lo: ../../include/net-snmp/config_api.h
+./disman/mteTriggerDeltaTable.lo: ../../include/net-snmp/library/read_config.h
+./disman/mteTriggerDeltaTable.lo: ../../include/net-snmp/library/default_store.h
+./disman/mteTriggerDeltaTable.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./disman/mteTriggerDeltaTable.lo: ../../include/net-snmp/library/snmp_enum.h
+./disman/mteTriggerDeltaTable.lo: ../../include/net-snmp/library/vacm.h
+./disman/mteTriggerDeltaTable.lo: ../../include/net-snmp/output_api.h
+./disman/mteTriggerDeltaTable.lo: ../../include/net-snmp/library/snmp_debug.h
+./disman/mteTriggerDeltaTable.lo: ../../include/net-snmp/library/snmp_logging.h
+./disman/mteTriggerDeltaTable.lo: ../../include/net-snmp/snmpv3_api.h
+./disman/mteTriggerDeltaTable.lo: ../../include/net-snmp/library/snmpv3.h
+./disman/mteTriggerDeltaTable.lo: ../../include/net-snmp/library/transform_oids.h
+./disman/mteTriggerDeltaTable.lo: ../../include/net-snmp/library/keytools.h
+./disman/mteTriggerDeltaTable.lo: ../../include/net-snmp/library/scapi.h
+./disman/mteTriggerDeltaTable.lo: ../../include/net-snmp/library/lcd_time.h
+./disman/mteTriggerDeltaTable.lo: ../../include/net-snmp/library/snmp_secmod.h
+./disman/mteTriggerDeltaTable.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./disman/mteTriggerDeltaTable.lo: ../../include/net-snmp/library/snmpusm.h
+./disman/mteTriggerDeltaTable.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./disman/mteTriggerDeltaTable.lo: ../../include/net-snmp/agent/snmp_agent.h
+./disman/mteTriggerDeltaTable.lo: ../../include/net-snmp/agent/snmp_vars.h
+./disman/mteTriggerDeltaTable.lo: ../../include/net-snmp/agent/agent_handler.h
+./disman/mteTriggerDeltaTable.lo: ../../include/net-snmp/agent/var_struct.h
+./disman/mteTriggerDeltaTable.lo: ../../include/net-snmp/agent/agent_registry.h
+./disman/mteTriggerDeltaTable.lo: ../../include/net-snmp/agent/ds_agent.h
+./disman/mteTriggerDeltaTable.lo: ../../include/net-snmp/agent/agent_read_config.h
+./disman/mteTriggerDeltaTable.lo: ../../include/net-snmp/agent/agent_trap.h
+./disman/mteTriggerDeltaTable.lo: ../../include/net-snmp/agent/all_helpers.h
+./disman/mteTriggerDeltaTable.lo: ../../include/net-snmp/agent/instance.h
+./disman/mteTriggerDeltaTable.lo: ../../include/net-snmp/agent/multiplexer.h
+./disman/mteTriggerDeltaTable.lo: ../../include/net-snmp/agent/null.h
+./disman/mteTriggerDeltaTable.lo: ../../include/net-snmp/agent/debug_handler.h
+./disman/mteTriggerDeltaTable.lo: ../../include/net-snmp/agent/old_api.h
+./disman/mteTriggerDeltaTable.lo: ../../include/net-snmp/agent/read_only.h
+./disman/mteTriggerDeltaTable.lo: ../../include/net-snmp/agent/serialize.h
+./disman/mteTriggerDeltaTable.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./disman/mteTriggerDeltaTable.lo: ../../include/net-snmp/agent/mode_end_call.h
+./disman/mteTriggerDeltaTable.lo: ../../include/net-snmp/agent/table.h
+./disman/mteTriggerDeltaTable.lo: ../../include/net-snmp/agent/table_data.h
+./disman/mteTriggerDeltaTable.lo: ../../include/net-snmp/agent/table_dataset.h
+./disman/mteTriggerDeltaTable.lo: ../../include/net-snmp/agent/table_iterator.h
+./disman/mteTriggerDeltaTable.lo: ../../include/net-snmp/agent/mib_module_config.h
+./disman/mteTriggerDeltaTable.lo: header_complex.h
+./disman/mteTriggerDeltaTable.lo: ./disman/mteTriggerDeltaTable.h
+./disman/mteTriggerDeltaTable.lo: ./disman/mteTriggerTable.h
+./disman/mteTriggerExistenceTable.lo: ../../include/net-snmp/net-snmp-config.h
+./disman/mteTriggerExistenceTable.lo: ../../include/net-snmp/system/linux.h
+./disman/mteTriggerExistenceTable.lo: ../../include/net-snmp/system/sysv.h
+./disman/mteTriggerExistenceTable.lo: ../../include/net-snmp/system/generic.h
+./disman/mteTriggerExistenceTable.lo: ../../include/net-snmp/machine/generic.h
+./disman/mteTriggerExistenceTable.lo: ../../include/net-snmp/net-snmp-includes.h
+./disman/mteTriggerExistenceTable.lo: ../../include/net-snmp/definitions.h
+./disman/mteTriggerExistenceTable.lo: ../../include/net-snmp/types.h
+./disman/mteTriggerExistenceTable.lo: ../../include/net-snmp/library/snmp_api.h
+./disman/mteTriggerExistenceTable.lo: ../../include/net-snmp/library/asn1.h
+./disman/mteTriggerExistenceTable.lo: ../../include/net-snmp/library/snmp_impl.h
+./disman/mteTriggerExistenceTable.lo: ../../include/net-snmp/library/snmp.h
+./disman/mteTriggerExistenceTable.lo: ../../include/net-snmp/library/snmp-tc.h
+./disman/mteTriggerExistenceTable.lo: ../../include/net-snmp/utilities.h
+./disman/mteTriggerExistenceTable.lo: ../../include/net-snmp/library/snmp_client.h
+./disman/mteTriggerExistenceTable.lo: ../../include/net-snmp/library/getopt.h
+./disman/mteTriggerExistenceTable.lo: ../../include/net-snmp/library/system.h
+./disman/mteTriggerExistenceTable.lo: ../../include/net-snmp/library/tools.h
+./disman/mteTriggerExistenceTable.lo: ../../include/net-snmp/library/int64.h
+./disman/mteTriggerExistenceTable.lo: ../../include/net-snmp/library/mt_support.h
+./disman/mteTriggerExistenceTable.lo: ../../include/net-snmp/library/snmp_alarm.h
+./disman/mteTriggerExistenceTable.lo: ../../include/net-snmp/library/data_list.h
+./disman/mteTriggerExistenceTable.lo: ../../include/net-snmp/library/callback.h
+./disman/mteTriggerExistenceTable.lo: ../../include/net-snmp/library/oid_stash.h
+./disman/mteTriggerExistenceTable.lo: ../../include/net-snmp/library/check_varbind.h
+./disman/mteTriggerExistenceTable.lo: ../../include/net-snmp/version.h
+./disman/mteTriggerExistenceTable.lo: ../../include/net-snmp/session_api.h
+./disman/mteTriggerExistenceTable.lo: ../../include/net-snmp/library/snmp_transport.h
+./disman/mteTriggerExistenceTable.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./disman/mteTriggerExistenceTable.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./disman/mteTriggerExistenceTable.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./disman/mteTriggerExistenceTable.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./disman/mteTriggerExistenceTable.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./disman/mteTriggerExistenceTable.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./disman/mteTriggerExistenceTable.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./disman/mteTriggerExistenceTable.lo: ../../include/net-snmp/library/ucd_compat.h
+./disman/mteTriggerExistenceTable.lo: ../../include/net-snmp/pdu_api.h
+./disman/mteTriggerExistenceTable.lo: ../../include/net-snmp/mib_api.h
+./disman/mteTriggerExistenceTable.lo: ../../include/net-snmp/library/mib.h
+./disman/mteTriggerExistenceTable.lo: ../../include/net-snmp/library/parse.h
+./disman/mteTriggerExistenceTable.lo: ../../include/net-snmp/varbind_api.h
+./disman/mteTriggerExistenceTable.lo: ../../include/net-snmp/config_api.h
+./disman/mteTriggerExistenceTable.lo: ../../include/net-snmp/library/read_config.h
+./disman/mteTriggerExistenceTable.lo: ../../include/net-snmp/library/default_store.h
+./disman/mteTriggerExistenceTable.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./disman/mteTriggerExistenceTable.lo: ../../include/net-snmp/library/snmp_enum.h
+./disman/mteTriggerExistenceTable.lo: ../../include/net-snmp/library/vacm.h
+./disman/mteTriggerExistenceTable.lo: ../../include/net-snmp/output_api.h
+./disman/mteTriggerExistenceTable.lo: ../../include/net-snmp/library/snmp_debug.h
+./disman/mteTriggerExistenceTable.lo: ../../include/net-snmp/library/snmp_logging.h
+./disman/mteTriggerExistenceTable.lo: ../../include/net-snmp/snmpv3_api.h
+./disman/mteTriggerExistenceTable.lo: ../../include/net-snmp/library/snmpv3.h
+./disman/mteTriggerExistenceTable.lo: ../../include/net-snmp/library/transform_oids.h
+./disman/mteTriggerExistenceTable.lo: ../../include/net-snmp/library/keytools.h
+./disman/mteTriggerExistenceTable.lo: ../../include/net-snmp/library/scapi.h
+./disman/mteTriggerExistenceTable.lo: ../../include/net-snmp/library/lcd_time.h
+./disman/mteTriggerExistenceTable.lo: ../../include/net-snmp/library/snmp_secmod.h
+./disman/mteTriggerExistenceTable.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./disman/mteTriggerExistenceTable.lo: ../../include/net-snmp/library/snmpusm.h
+./disman/mteTriggerExistenceTable.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./disman/mteTriggerExistenceTable.lo: ../../include/net-snmp/agent/snmp_agent.h
+./disman/mteTriggerExistenceTable.lo: ../../include/net-snmp/agent/snmp_vars.h
+./disman/mteTriggerExistenceTable.lo: ../../include/net-snmp/agent/agent_handler.h
+./disman/mteTriggerExistenceTable.lo: ../../include/net-snmp/agent/var_struct.h
+./disman/mteTriggerExistenceTable.lo: ../../include/net-snmp/agent/agent_registry.h
+./disman/mteTriggerExistenceTable.lo: ../../include/net-snmp/agent/ds_agent.h
+./disman/mteTriggerExistenceTable.lo: ../../include/net-snmp/agent/agent_read_config.h
+./disman/mteTriggerExistenceTable.lo: ../../include/net-snmp/agent/agent_trap.h
+./disman/mteTriggerExistenceTable.lo: ../../include/net-snmp/agent/all_helpers.h
+./disman/mteTriggerExistenceTable.lo: ../../include/net-snmp/agent/instance.h
+./disman/mteTriggerExistenceTable.lo: ../../include/net-snmp/agent/multiplexer.h
+./disman/mteTriggerExistenceTable.lo: ../../include/net-snmp/agent/null.h
+./disman/mteTriggerExistenceTable.lo: ../../include/net-snmp/agent/debug_handler.h
+./disman/mteTriggerExistenceTable.lo: ../../include/net-snmp/agent/old_api.h
+./disman/mteTriggerExistenceTable.lo: ../../include/net-snmp/agent/read_only.h
+./disman/mteTriggerExistenceTable.lo: ../../include/net-snmp/agent/serialize.h
+./disman/mteTriggerExistenceTable.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./disman/mteTriggerExistenceTable.lo: ../../include/net-snmp/agent/mode_end_call.h
+./disman/mteTriggerExistenceTable.lo: ../../include/net-snmp/agent/table.h
+./disman/mteTriggerExistenceTable.lo: ../../include/net-snmp/agent/table_data.h
+./disman/mteTriggerExistenceTable.lo: ../../include/net-snmp/agent/table_dataset.h
+./disman/mteTriggerExistenceTable.lo: ../../include/net-snmp/agent/table_iterator.h
+./disman/mteTriggerExistenceTable.lo: ../../include/net-snmp/agent/mib_module_config.h
+./disman/mteTriggerExistenceTable.lo: header_complex.h
+./disman/mteTriggerExistenceTable.lo: ./disman/mteTriggerExistenceTable.h
+./disman/mteTriggerExistenceTable.lo: ./disman/mteTriggerTable.h
+./disman/mteTriggerTable.lo: ../../include/net-snmp/net-snmp-config.h
+./disman/mteTriggerTable.lo: ../../include/net-snmp/system/linux.h
+./disman/mteTriggerTable.lo: ../../include/net-snmp/system/sysv.h
+./disman/mteTriggerTable.lo: ../../include/net-snmp/system/generic.h
+./disman/mteTriggerTable.lo: ../../include/net-snmp/machine/generic.h
+./disman/mteTriggerTable.lo: ../../include/net-snmp/net-snmp-includes.h
+./disman/mteTriggerTable.lo: ../../include/net-snmp/definitions.h
+./disman/mteTriggerTable.lo: ../../include/net-snmp/types.h
+./disman/mteTriggerTable.lo: ../../include/net-snmp/library/snmp_api.h
+./disman/mteTriggerTable.lo: ../../include/net-snmp/library/asn1.h
+./disman/mteTriggerTable.lo: ../../include/net-snmp/library/snmp_impl.h
+./disman/mteTriggerTable.lo: ../../include/net-snmp/library/snmp.h
+./disman/mteTriggerTable.lo: ../../include/net-snmp/library/snmp-tc.h
+./disman/mteTriggerTable.lo: ../../include/net-snmp/utilities.h
+./disman/mteTriggerTable.lo: ../../include/net-snmp/library/snmp_client.h
+./disman/mteTriggerTable.lo: ../../include/net-snmp/library/getopt.h
+./disman/mteTriggerTable.lo: ../../include/net-snmp/library/system.h
+./disman/mteTriggerTable.lo: ../../include/net-snmp/library/tools.h
+./disman/mteTriggerTable.lo: ../../include/net-snmp/library/int64.h
+./disman/mteTriggerTable.lo: ../../include/net-snmp/library/mt_support.h
+./disman/mteTriggerTable.lo: ../../include/net-snmp/library/snmp_alarm.h
+./disman/mteTriggerTable.lo: ../../include/net-snmp/library/data_list.h
+./disman/mteTriggerTable.lo: ../../include/net-snmp/library/callback.h
+./disman/mteTriggerTable.lo: ../../include/net-snmp/library/oid_stash.h
+./disman/mteTriggerTable.lo: ../../include/net-snmp/library/check_varbind.h
+./disman/mteTriggerTable.lo: ../../include/net-snmp/version.h
+./disman/mteTriggerTable.lo: ../../include/net-snmp/session_api.h
+./disman/mteTriggerTable.lo: ../../include/net-snmp/library/snmp_transport.h
+./disman/mteTriggerTable.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./disman/mteTriggerTable.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./disman/mteTriggerTable.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./disman/mteTriggerTable.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./disman/mteTriggerTable.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./disman/mteTriggerTable.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./disman/mteTriggerTable.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./disman/mteTriggerTable.lo: ../../include/net-snmp/library/ucd_compat.h
+./disman/mteTriggerTable.lo: ../../include/net-snmp/pdu_api.h
+./disman/mteTriggerTable.lo: ../../include/net-snmp/mib_api.h
+./disman/mteTriggerTable.lo: ../../include/net-snmp/library/mib.h
+./disman/mteTriggerTable.lo: ../../include/net-snmp/library/parse.h
+./disman/mteTriggerTable.lo: ../../include/net-snmp/varbind_api.h
+./disman/mteTriggerTable.lo: ../../include/net-snmp/config_api.h
+./disman/mteTriggerTable.lo: ../../include/net-snmp/library/read_config.h
+./disman/mteTriggerTable.lo: ../../include/net-snmp/library/default_store.h
+./disman/mteTriggerTable.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./disman/mteTriggerTable.lo: ../../include/net-snmp/library/snmp_enum.h
+./disman/mteTriggerTable.lo: ../../include/net-snmp/library/vacm.h
+./disman/mteTriggerTable.lo: ../../include/net-snmp/output_api.h
+./disman/mteTriggerTable.lo: ../../include/net-snmp/library/snmp_debug.h
+./disman/mteTriggerTable.lo: ../../include/net-snmp/library/snmp_logging.h
+./disman/mteTriggerTable.lo: ../../include/net-snmp/snmpv3_api.h
+./disman/mteTriggerTable.lo: ../../include/net-snmp/library/snmpv3.h
+./disman/mteTriggerTable.lo: ../../include/net-snmp/library/transform_oids.h
+./disman/mteTriggerTable.lo: ../../include/net-snmp/library/keytools.h
+./disman/mteTriggerTable.lo: ../../include/net-snmp/library/scapi.h
+./disman/mteTriggerTable.lo: ../../include/net-snmp/library/lcd_time.h
+./disman/mteTriggerTable.lo: ../../include/net-snmp/library/snmp_secmod.h
+./disman/mteTriggerTable.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./disman/mteTriggerTable.lo: ../../include/net-snmp/library/snmpusm.h
+./disman/mteTriggerTable.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./disman/mteTriggerTable.lo: ../../include/net-snmp/agent/snmp_agent.h
+./disman/mteTriggerTable.lo: ../../include/net-snmp/agent/snmp_vars.h
+./disman/mteTriggerTable.lo: ../../include/net-snmp/agent/agent_handler.h
+./disman/mteTriggerTable.lo: ../../include/net-snmp/agent/var_struct.h
+./disman/mteTriggerTable.lo: ../../include/net-snmp/agent/agent_registry.h
+./disman/mteTriggerTable.lo: ../../include/net-snmp/agent/ds_agent.h
+./disman/mteTriggerTable.lo: ../../include/net-snmp/agent/agent_read_config.h
+./disman/mteTriggerTable.lo: ../../include/net-snmp/agent/agent_trap.h
+./disman/mteTriggerTable.lo: ../../include/net-snmp/agent/all_helpers.h
+./disman/mteTriggerTable.lo: ../../include/net-snmp/agent/instance.h
+./disman/mteTriggerTable.lo: ../../include/net-snmp/agent/multiplexer.h
+./disman/mteTriggerTable.lo: ../../include/net-snmp/agent/null.h
+./disman/mteTriggerTable.lo: ../../include/net-snmp/agent/debug_handler.h
+./disman/mteTriggerTable.lo: ../../include/net-snmp/agent/old_api.h
+./disman/mteTriggerTable.lo: ../../include/net-snmp/agent/read_only.h
+./disman/mteTriggerTable.lo: ../../include/net-snmp/agent/serialize.h
+./disman/mteTriggerTable.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./disman/mteTriggerTable.lo: ../../include/net-snmp/agent/mode_end_call.h
+./disman/mteTriggerTable.lo: ../../include/net-snmp/agent/table.h
+./disman/mteTriggerTable.lo: ../../include/net-snmp/agent/table_data.h
+./disman/mteTriggerTable.lo: ../../include/net-snmp/agent/table_dataset.h
+./disman/mteTriggerTable.lo: ../../include/net-snmp/agent/table_iterator.h
+./disman/mteTriggerTable.lo: ../../include/net-snmp/agent/mib_module_config.h
+./disman/mteTriggerTable.lo: header_complex.h ./disman/mteTriggerTable.h
+./disman/mteTriggerTable.lo: ./disman/mteTriggerBooleanTable.h
+./disman/mteTriggerTable.lo: ./disman/mteTriggerDeltaTable.h
+./disman/mteTriggerTable.lo: ./disman/mteTriggerExistenceTable.h
+./disman/mteTriggerTable.lo: ./disman/mteTriggerThresholdTable.h
+./disman/mteTriggerTable.lo: ./disman/mteEventTable.h
+./disman/mteTriggerTable.lo: ./disman/mteObjectsTable.h
+./disman/mteTriggerThresholdTable.lo: ../../include/net-snmp/net-snmp-config.h
+./disman/mteTriggerThresholdTable.lo: ../../include/net-snmp/system/linux.h
+./disman/mteTriggerThresholdTable.lo: ../../include/net-snmp/system/sysv.h
+./disman/mteTriggerThresholdTable.lo: ../../include/net-snmp/system/generic.h
+./disman/mteTriggerThresholdTable.lo: ../../include/net-snmp/machine/generic.h
+./disman/mteTriggerThresholdTable.lo: ../../include/net-snmp/net-snmp-includes.h
+./disman/mteTriggerThresholdTable.lo: ../../include/net-snmp/definitions.h
+./disman/mteTriggerThresholdTable.lo: ../../include/net-snmp/types.h
+./disman/mteTriggerThresholdTable.lo: ../../include/net-snmp/library/snmp_api.h
+./disman/mteTriggerThresholdTable.lo: ../../include/net-snmp/library/asn1.h
+./disman/mteTriggerThresholdTable.lo: ../../include/net-snmp/library/snmp_impl.h
+./disman/mteTriggerThresholdTable.lo: ../../include/net-snmp/library/snmp.h
+./disman/mteTriggerThresholdTable.lo: ../../include/net-snmp/library/snmp-tc.h
+./disman/mteTriggerThresholdTable.lo: ../../include/net-snmp/utilities.h
+./disman/mteTriggerThresholdTable.lo: ../../include/net-snmp/library/snmp_client.h
+./disman/mteTriggerThresholdTable.lo: ../../include/net-snmp/library/getopt.h
+./disman/mteTriggerThresholdTable.lo: ../../include/net-snmp/library/system.h
+./disman/mteTriggerThresholdTable.lo: ../../include/net-snmp/library/tools.h
+./disman/mteTriggerThresholdTable.lo: ../../include/net-snmp/library/int64.h
+./disman/mteTriggerThresholdTable.lo: ../../include/net-snmp/library/mt_support.h
+./disman/mteTriggerThresholdTable.lo: ../../include/net-snmp/library/snmp_alarm.h
+./disman/mteTriggerThresholdTable.lo: ../../include/net-snmp/library/data_list.h
+./disman/mteTriggerThresholdTable.lo: ../../include/net-snmp/library/callback.h
+./disman/mteTriggerThresholdTable.lo: ../../include/net-snmp/library/oid_stash.h
+./disman/mteTriggerThresholdTable.lo: ../../include/net-snmp/library/check_varbind.h
+./disman/mteTriggerThresholdTable.lo: ../../include/net-snmp/version.h
+./disman/mteTriggerThresholdTable.lo: ../../include/net-snmp/session_api.h
+./disman/mteTriggerThresholdTable.lo: ../../include/net-snmp/library/snmp_transport.h
+./disman/mteTriggerThresholdTable.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./disman/mteTriggerThresholdTable.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./disman/mteTriggerThresholdTable.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./disman/mteTriggerThresholdTable.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./disman/mteTriggerThresholdTable.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./disman/mteTriggerThresholdTable.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./disman/mteTriggerThresholdTable.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./disman/mteTriggerThresholdTable.lo: ../../include/net-snmp/library/ucd_compat.h
+./disman/mteTriggerThresholdTable.lo: ../../include/net-snmp/pdu_api.h
+./disman/mteTriggerThresholdTable.lo: ../../include/net-snmp/mib_api.h
+./disman/mteTriggerThresholdTable.lo: ../../include/net-snmp/library/mib.h
+./disman/mteTriggerThresholdTable.lo: ../../include/net-snmp/library/parse.h
+./disman/mteTriggerThresholdTable.lo: ../../include/net-snmp/varbind_api.h
+./disman/mteTriggerThresholdTable.lo: ../../include/net-snmp/config_api.h
+./disman/mteTriggerThresholdTable.lo: ../../include/net-snmp/library/read_config.h
+./disman/mteTriggerThresholdTable.lo: ../../include/net-snmp/library/default_store.h
+./disman/mteTriggerThresholdTable.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./disman/mteTriggerThresholdTable.lo: ../../include/net-snmp/library/snmp_enum.h
+./disman/mteTriggerThresholdTable.lo: ../../include/net-snmp/library/vacm.h
+./disman/mteTriggerThresholdTable.lo: ../../include/net-snmp/output_api.h
+./disman/mteTriggerThresholdTable.lo: ../../include/net-snmp/library/snmp_debug.h
+./disman/mteTriggerThresholdTable.lo: ../../include/net-snmp/library/snmp_logging.h
+./disman/mteTriggerThresholdTable.lo: ../../include/net-snmp/snmpv3_api.h
+./disman/mteTriggerThresholdTable.lo: ../../include/net-snmp/library/snmpv3.h
+./disman/mteTriggerThresholdTable.lo: ../../include/net-snmp/library/transform_oids.h
+./disman/mteTriggerThresholdTable.lo: ../../include/net-snmp/library/keytools.h
+./disman/mteTriggerThresholdTable.lo: ../../include/net-snmp/library/scapi.h
+./disman/mteTriggerThresholdTable.lo: ../../include/net-snmp/library/lcd_time.h
+./disman/mteTriggerThresholdTable.lo: ../../include/net-snmp/library/snmp_secmod.h
+./disman/mteTriggerThresholdTable.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./disman/mteTriggerThresholdTable.lo: ../../include/net-snmp/library/snmpusm.h
+./disman/mteTriggerThresholdTable.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./disman/mteTriggerThresholdTable.lo: ../../include/net-snmp/agent/snmp_agent.h
+./disman/mteTriggerThresholdTable.lo: ../../include/net-snmp/agent/snmp_vars.h
+./disman/mteTriggerThresholdTable.lo: ../../include/net-snmp/agent/agent_handler.h
+./disman/mteTriggerThresholdTable.lo: ../../include/net-snmp/agent/var_struct.h
+./disman/mteTriggerThresholdTable.lo: ../../include/net-snmp/agent/agent_registry.h
+./disman/mteTriggerThresholdTable.lo: ../../include/net-snmp/agent/ds_agent.h
+./disman/mteTriggerThresholdTable.lo: ../../include/net-snmp/agent/agent_read_config.h
+./disman/mteTriggerThresholdTable.lo: ../../include/net-snmp/agent/agent_trap.h
+./disman/mteTriggerThresholdTable.lo: ../../include/net-snmp/agent/all_helpers.h
+./disman/mteTriggerThresholdTable.lo: ../../include/net-snmp/agent/instance.h
+./disman/mteTriggerThresholdTable.lo: ../../include/net-snmp/agent/multiplexer.h
+./disman/mteTriggerThresholdTable.lo: ../../include/net-snmp/agent/null.h
+./disman/mteTriggerThresholdTable.lo: ../../include/net-snmp/agent/debug_handler.h
+./disman/mteTriggerThresholdTable.lo: ../../include/net-snmp/agent/old_api.h
+./disman/mteTriggerThresholdTable.lo: ../../include/net-snmp/agent/read_only.h
+./disman/mteTriggerThresholdTable.lo: ../../include/net-snmp/agent/serialize.h
+./disman/mteTriggerThresholdTable.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./disman/mteTriggerThresholdTable.lo: ../../include/net-snmp/agent/mode_end_call.h
+./disman/mteTriggerThresholdTable.lo: ../../include/net-snmp/agent/table.h
+./disman/mteTriggerThresholdTable.lo: ../../include/net-snmp/agent/table_data.h
+./disman/mteTriggerThresholdTable.lo: ../../include/net-snmp/agent/table_dataset.h
+./disman/mteTriggerThresholdTable.lo: ../../include/net-snmp/agent/table_iterator.h
+./disman/mteTriggerThresholdTable.lo: ../../include/net-snmp/agent/mib_module_config.h
+./disman/mteTriggerThresholdTable.lo: header_complex.h
+./disman/mteTriggerThresholdTable.lo: ./disman/mteTriggerThresholdTable.h
+./disman/mteTriggerThresholdTable.lo: ./disman/mteTriggerTable.h
+./examples/data_set.lo: ../../include/net-snmp/net-snmp-config.h
+./examples/data_set.lo: ../../include/net-snmp/system/linux.h
+./examples/data_set.lo: ../../include/net-snmp/system/sysv.h
+./examples/data_set.lo: ../../include/net-snmp/system/generic.h
+./examples/data_set.lo: ../../include/net-snmp/machine/generic.h
+./examples/data_set.lo: ../../include/net-snmp/net-snmp-includes.h
+./examples/data_set.lo: ../../include/net-snmp/definitions.h
+./examples/data_set.lo: ../../include/net-snmp/types.h
+./examples/data_set.lo: ../../include/net-snmp/library/snmp_api.h
+./examples/data_set.lo: ../../include/net-snmp/library/asn1.h
+./examples/data_set.lo: ../../include/net-snmp/library/snmp_impl.h
+./examples/data_set.lo: ../../include/net-snmp/library/snmp.h
+./examples/data_set.lo: ../../include/net-snmp/library/snmp-tc.h
+./examples/data_set.lo: ../../include/net-snmp/utilities.h
+./examples/data_set.lo: ../../include/net-snmp/library/snmp_client.h
+./examples/data_set.lo: ../../include/net-snmp/library/getopt.h
+./examples/data_set.lo: ../../include/net-snmp/library/system.h
+./examples/data_set.lo: ../../include/net-snmp/library/tools.h
+./examples/data_set.lo: ../../include/net-snmp/library/int64.h
+./examples/data_set.lo: ../../include/net-snmp/library/mt_support.h
+./examples/data_set.lo: ../../include/net-snmp/library/snmp_alarm.h
+./examples/data_set.lo: ../../include/net-snmp/library/data_list.h
+./examples/data_set.lo: ../../include/net-snmp/library/callback.h
+./examples/data_set.lo: ../../include/net-snmp/library/oid_stash.h
+./examples/data_set.lo: ../../include/net-snmp/library/check_varbind.h
+./examples/data_set.lo: ../../include/net-snmp/version.h
+./examples/data_set.lo: ../../include/net-snmp/session_api.h
+./examples/data_set.lo: ../../include/net-snmp/library/snmp_transport.h
+./examples/data_set.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./examples/data_set.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./examples/data_set.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./examples/data_set.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./examples/data_set.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./examples/data_set.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./examples/data_set.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./examples/data_set.lo: ../../include/net-snmp/library/ucd_compat.h
+./examples/data_set.lo: ../../include/net-snmp/pdu_api.h
+./examples/data_set.lo: ../../include/net-snmp/mib_api.h
+./examples/data_set.lo: ../../include/net-snmp/library/mib.h
+./examples/data_set.lo: ../../include/net-snmp/library/parse.h
+./examples/data_set.lo: ../../include/net-snmp/varbind_api.h
+./examples/data_set.lo: ../../include/net-snmp/config_api.h
+./examples/data_set.lo: ../../include/net-snmp/library/read_config.h
+./examples/data_set.lo: ../../include/net-snmp/library/default_store.h
+./examples/data_set.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./examples/data_set.lo: ../../include/net-snmp/library/snmp_enum.h
+./examples/data_set.lo: ../../include/net-snmp/library/vacm.h
+./examples/data_set.lo: ../../include/net-snmp/output_api.h
+./examples/data_set.lo: ../../include/net-snmp/library/snmp_debug.h
+./examples/data_set.lo: ../../include/net-snmp/library/snmp_logging.h
+./examples/data_set.lo: ../../include/net-snmp/snmpv3_api.h
+./examples/data_set.lo: ../../include/net-snmp/library/snmpv3.h
+./examples/data_set.lo: ../../include/net-snmp/library/transform_oids.h
+./examples/data_set.lo: ../../include/net-snmp/library/keytools.h
+./examples/data_set.lo: ../../include/net-snmp/library/scapi.h
+./examples/data_set.lo: ../../include/net-snmp/library/lcd_time.h
+./examples/data_set.lo: ../../include/net-snmp/library/snmp_secmod.h
+./examples/data_set.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./examples/data_set.lo: ../../include/net-snmp/library/snmpusm.h
+./examples/data_set.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./examples/data_set.lo: ../../include/net-snmp/agent/snmp_agent.h
+./examples/data_set.lo: ../../include/net-snmp/agent/snmp_vars.h
+./examples/data_set.lo: ../../include/net-snmp/agent/agent_handler.h
+./examples/data_set.lo: ../../include/net-snmp/agent/var_struct.h
+./examples/data_set.lo: ../../include/net-snmp/agent/agent_registry.h
+./examples/data_set.lo: ../../include/net-snmp/agent/ds_agent.h
+./examples/data_set.lo: ../../include/net-snmp/agent/agent_read_config.h
+./examples/data_set.lo: ../../include/net-snmp/agent/agent_trap.h
+./examples/data_set.lo: ../../include/net-snmp/agent/all_helpers.h
+./examples/data_set.lo: ../../include/net-snmp/agent/instance.h
+./examples/data_set.lo: ../../include/net-snmp/agent/multiplexer.h
+./examples/data_set.lo: ../../include/net-snmp/agent/null.h
+./examples/data_set.lo: ../../include/net-snmp/agent/debug_handler.h
+./examples/data_set.lo: ../../include/net-snmp/agent/old_api.h
+./examples/data_set.lo: ../../include/net-snmp/agent/read_only.h
+./examples/data_set.lo: ../../include/net-snmp/agent/serialize.h
+./examples/data_set.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./examples/data_set.lo: ../../include/net-snmp/agent/mode_end_call.h
+./examples/data_set.lo: ../../include/net-snmp/agent/table.h
+./examples/data_set.lo: ../../include/net-snmp/agent/table_data.h
+./examples/data_set.lo: ../../include/net-snmp/agent/table_dataset.h
+./examples/data_set.lo: ../../include/net-snmp/agent/table_iterator.h
+./examples/data_set.lo: ../../include/net-snmp/agent/mib_module_config.h
+./examples/delayed_instance.lo: ../../include/net-snmp/net-snmp-config.h
+./examples/delayed_instance.lo: ../../include/net-snmp/system/linux.h
+./examples/delayed_instance.lo: ../../include/net-snmp/system/sysv.h
+./examples/delayed_instance.lo: ../../include/net-snmp/system/generic.h
+./examples/delayed_instance.lo: ../../include/net-snmp/machine/generic.h
+./examples/delayed_instance.lo: ../../include/net-snmp/net-snmp-includes.h
+./examples/delayed_instance.lo: ../../include/net-snmp/definitions.h
+./examples/delayed_instance.lo: ../../include/net-snmp/types.h
+./examples/delayed_instance.lo: ../../include/net-snmp/library/snmp_api.h
+./examples/delayed_instance.lo: ../../include/net-snmp/library/asn1.h
+./examples/delayed_instance.lo: ../../include/net-snmp/library/snmp_impl.h
+./examples/delayed_instance.lo: ../../include/net-snmp/library/snmp.h
+./examples/delayed_instance.lo: ../../include/net-snmp/library/snmp-tc.h
+./examples/delayed_instance.lo: ../../include/net-snmp/utilities.h
+./examples/delayed_instance.lo: ../../include/net-snmp/library/snmp_client.h
+./examples/delayed_instance.lo: ../../include/net-snmp/library/getopt.h
+./examples/delayed_instance.lo: ../../include/net-snmp/library/system.h
+./examples/delayed_instance.lo: ../../include/net-snmp/library/tools.h
+./examples/delayed_instance.lo: ../../include/net-snmp/library/int64.h
+./examples/delayed_instance.lo: ../../include/net-snmp/library/mt_support.h
+./examples/delayed_instance.lo: ../../include/net-snmp/library/snmp_alarm.h
+./examples/delayed_instance.lo: ../../include/net-snmp/library/data_list.h
+./examples/delayed_instance.lo: ../../include/net-snmp/library/callback.h
+./examples/delayed_instance.lo: ../../include/net-snmp/library/oid_stash.h
+./examples/delayed_instance.lo: ../../include/net-snmp/library/check_varbind.h
+./examples/delayed_instance.lo: ../../include/net-snmp/version.h
+./examples/delayed_instance.lo: ../../include/net-snmp/session_api.h
+./examples/delayed_instance.lo: ../../include/net-snmp/library/snmp_transport.h
+./examples/delayed_instance.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./examples/delayed_instance.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./examples/delayed_instance.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./examples/delayed_instance.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./examples/delayed_instance.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./examples/delayed_instance.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./examples/delayed_instance.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./examples/delayed_instance.lo: ../../include/net-snmp/library/ucd_compat.h
+./examples/delayed_instance.lo: ../../include/net-snmp/pdu_api.h
+./examples/delayed_instance.lo: ../../include/net-snmp/mib_api.h
+./examples/delayed_instance.lo: ../../include/net-snmp/library/mib.h
+./examples/delayed_instance.lo: ../../include/net-snmp/library/parse.h
+./examples/delayed_instance.lo: ../../include/net-snmp/varbind_api.h
+./examples/delayed_instance.lo: ../../include/net-snmp/config_api.h
+./examples/delayed_instance.lo: ../../include/net-snmp/library/read_config.h
+./examples/delayed_instance.lo: ../../include/net-snmp/library/default_store.h
+./examples/delayed_instance.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./examples/delayed_instance.lo: ../../include/net-snmp/library/snmp_enum.h
+./examples/delayed_instance.lo: ../../include/net-snmp/library/vacm.h
+./examples/delayed_instance.lo: ../../include/net-snmp/output_api.h
+./examples/delayed_instance.lo: ../../include/net-snmp/library/snmp_debug.h
+./examples/delayed_instance.lo: ../../include/net-snmp/library/snmp_logging.h
+./examples/delayed_instance.lo: ../../include/net-snmp/snmpv3_api.h
+./examples/delayed_instance.lo: ../../include/net-snmp/library/snmpv3.h
+./examples/delayed_instance.lo: ../../include/net-snmp/library/transform_oids.h
+./examples/delayed_instance.lo: ../../include/net-snmp/library/keytools.h
+./examples/delayed_instance.lo: ../../include/net-snmp/library/scapi.h
+./examples/delayed_instance.lo: ../../include/net-snmp/library/lcd_time.h
+./examples/delayed_instance.lo: ../../include/net-snmp/library/snmp_secmod.h
+./examples/delayed_instance.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./examples/delayed_instance.lo: ../../include/net-snmp/library/snmpusm.h
+./examples/delayed_instance.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./examples/delayed_instance.lo: ../../include/net-snmp/agent/snmp_agent.h
+./examples/delayed_instance.lo: ../../include/net-snmp/agent/snmp_vars.h
+./examples/delayed_instance.lo: ../../include/net-snmp/agent/agent_handler.h
+./examples/delayed_instance.lo: ../../include/net-snmp/agent/var_struct.h
+./examples/delayed_instance.lo: ../../include/net-snmp/agent/agent_registry.h
+./examples/delayed_instance.lo: ../../include/net-snmp/agent/ds_agent.h
+./examples/delayed_instance.lo: ../../include/net-snmp/agent/agent_read_config.h
+./examples/delayed_instance.lo: ../../include/net-snmp/agent/agent_trap.h
+./examples/delayed_instance.lo: ../../include/net-snmp/agent/all_helpers.h
+./examples/delayed_instance.lo: ../../include/net-snmp/agent/instance.h
+./examples/delayed_instance.lo: ../../include/net-snmp/agent/multiplexer.h
+./examples/delayed_instance.lo: ../../include/net-snmp/agent/null.h
+./examples/delayed_instance.lo: ../../include/net-snmp/agent/debug_handler.h
+./examples/delayed_instance.lo: ../../include/net-snmp/agent/old_api.h
+./examples/delayed_instance.lo: ../../include/net-snmp/agent/read_only.h
+./examples/delayed_instance.lo: ../../include/net-snmp/agent/serialize.h
+./examples/delayed_instance.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./examples/delayed_instance.lo: ../../include/net-snmp/agent/mode_end_call.h
+./examples/delayed_instance.lo: ../../include/net-snmp/agent/table.h
+./examples/delayed_instance.lo: ../../include/net-snmp/agent/table_data.h
+./examples/delayed_instance.lo: ../../include/net-snmp/agent/table_dataset.h
+./examples/delayed_instance.lo: ../../include/net-snmp/agent/table_iterator.h
+./examples/delayed_instance.lo: ../../include/net-snmp/agent/mib_module_config.h
+./examples/delayed_instance.lo: ./examples/delayed_instance.h
+./examples/example.lo: ../../include/net-snmp/net-snmp-config.h
+./examples/example.lo: ../../include/net-snmp/system/linux.h
+./examples/example.lo: ../../include/net-snmp/system/sysv.h
+./examples/example.lo: ../../include/net-snmp/system/generic.h
+./examples/example.lo: ../../include/net-snmp/machine/generic.h
+./examples/example.lo: ../../include/net-snmp/net-snmp-includes.h
+./examples/example.lo: ../../include/net-snmp/definitions.h
+./examples/example.lo: ../../include/net-snmp/types.h
+./examples/example.lo: ../../include/net-snmp/library/snmp_api.h
+./examples/example.lo: ../../include/net-snmp/library/asn1.h
+./examples/example.lo: ../../include/net-snmp/library/snmp_impl.h
+./examples/example.lo: ../../include/net-snmp/library/snmp.h
+./examples/example.lo: ../../include/net-snmp/library/snmp-tc.h
+./examples/example.lo: ../../include/net-snmp/utilities.h
+./examples/example.lo: ../../include/net-snmp/library/snmp_client.h
+./examples/example.lo: ../../include/net-snmp/library/getopt.h
+./examples/example.lo: ../../include/net-snmp/library/system.h
+./examples/example.lo: ../../include/net-snmp/library/tools.h
+./examples/example.lo: ../../include/net-snmp/library/int64.h
+./examples/example.lo: ../../include/net-snmp/library/mt_support.h
+./examples/example.lo: ../../include/net-snmp/library/snmp_alarm.h
+./examples/example.lo: ../../include/net-snmp/library/data_list.h
+./examples/example.lo: ../../include/net-snmp/library/callback.h
+./examples/example.lo: ../../include/net-snmp/library/oid_stash.h
+./examples/example.lo: ../../include/net-snmp/library/check_varbind.h
+./examples/example.lo: ../../include/net-snmp/version.h
+./examples/example.lo: ../../include/net-snmp/session_api.h
+./examples/example.lo: ../../include/net-snmp/library/snmp_transport.h
+./examples/example.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./examples/example.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./examples/example.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./examples/example.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./examples/example.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./examples/example.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./examples/example.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./examples/example.lo: ../../include/net-snmp/library/ucd_compat.h
+./examples/example.lo: ../../include/net-snmp/pdu_api.h
+./examples/example.lo: ../../include/net-snmp/mib_api.h
+./examples/example.lo: ../../include/net-snmp/library/mib.h
+./examples/example.lo: ../../include/net-snmp/library/parse.h
+./examples/example.lo: ../../include/net-snmp/varbind_api.h
+./examples/example.lo: ../../include/net-snmp/config_api.h
+./examples/example.lo: ../../include/net-snmp/library/read_config.h
+./examples/example.lo: ../../include/net-snmp/library/default_store.h
+./examples/example.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./examples/example.lo: ../../include/net-snmp/library/snmp_enum.h
+./examples/example.lo: ../../include/net-snmp/library/vacm.h
+./examples/example.lo: ../../include/net-snmp/output_api.h
+./examples/example.lo: ../../include/net-snmp/library/snmp_debug.h
+./examples/example.lo: ../../include/net-snmp/library/snmp_logging.h
+./examples/example.lo: ../../include/net-snmp/snmpv3_api.h
+./examples/example.lo: ../../include/net-snmp/library/snmpv3.h
+./examples/example.lo: ../../include/net-snmp/library/transform_oids.h
+./examples/example.lo: ../../include/net-snmp/library/keytools.h
+./examples/example.lo: ../../include/net-snmp/library/scapi.h
+./examples/example.lo: ../../include/net-snmp/library/lcd_time.h
+./examples/example.lo: ../../include/net-snmp/library/snmp_secmod.h
+./examples/example.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./examples/example.lo: ../../include/net-snmp/library/snmpusm.h
+./examples/example.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./examples/example.lo: ../../include/net-snmp/agent/snmp_agent.h
+./examples/example.lo: ../../include/net-snmp/agent/snmp_vars.h
+./examples/example.lo: ../../include/net-snmp/agent/agent_handler.h
+./examples/example.lo: ../../include/net-snmp/agent/var_struct.h
+./examples/example.lo: ../../include/net-snmp/agent/agent_registry.h
+./examples/example.lo: ../../include/net-snmp/agent/ds_agent.h
+./examples/example.lo: ../../include/net-snmp/agent/agent_read_config.h
+./examples/example.lo: ../../include/net-snmp/agent/agent_trap.h
+./examples/example.lo: ../../include/net-snmp/agent/all_helpers.h
+./examples/example.lo: ../../include/net-snmp/agent/instance.h
+./examples/example.lo: ../../include/net-snmp/agent/multiplexer.h
+./examples/example.lo: ../../include/net-snmp/agent/null.h
+./examples/example.lo: ../../include/net-snmp/agent/debug_handler.h
+./examples/example.lo: ../../include/net-snmp/agent/old_api.h
+./examples/example.lo: ../../include/net-snmp/agent/read_only.h
+./examples/example.lo: ../../include/net-snmp/agent/serialize.h
+./examples/example.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./examples/example.lo: ../../include/net-snmp/agent/mode_end_call.h
+./examples/example.lo: ../../include/net-snmp/agent/table.h
+./examples/example.lo: ../../include/net-snmp/agent/table_data.h
+./examples/example.lo: ../../include/net-snmp/agent/table_dataset.h
+./examples/example.lo: ../../include/net-snmp/agent/table_iterator.h
+./examples/example.lo: ../../include/net-snmp/agent/mib_module_config.h
+./examples/example.lo: util_funcs.h struct.h ./examples/example.h
+./examples/notification.lo: ../../include/net-snmp/net-snmp-config.h
+./examples/notification.lo: ../../include/net-snmp/system/linux.h
+./examples/notification.lo: ../../include/net-snmp/system/sysv.h
+./examples/notification.lo: ../../include/net-snmp/system/generic.h
+./examples/notification.lo: ../../include/net-snmp/machine/generic.h
+./examples/notification.lo: ../../include/net-snmp/net-snmp-includes.h
+./examples/notification.lo: ../../include/net-snmp/definitions.h
+./examples/notification.lo: ../../include/net-snmp/types.h
+./examples/notification.lo: ../../include/net-snmp/library/snmp_api.h
+./examples/notification.lo: ../../include/net-snmp/library/asn1.h
+./examples/notification.lo: ../../include/net-snmp/library/snmp_impl.h
+./examples/notification.lo: ../../include/net-snmp/library/snmp.h
+./examples/notification.lo: ../../include/net-snmp/library/snmp-tc.h
+./examples/notification.lo: ../../include/net-snmp/utilities.h
+./examples/notification.lo: ../../include/net-snmp/library/snmp_client.h
+./examples/notification.lo: ../../include/net-snmp/library/getopt.h
+./examples/notification.lo: ../../include/net-snmp/library/system.h
+./examples/notification.lo: ../../include/net-snmp/library/tools.h
+./examples/notification.lo: ../../include/net-snmp/library/int64.h
+./examples/notification.lo: ../../include/net-snmp/library/mt_support.h
+./examples/notification.lo: ../../include/net-snmp/library/snmp_alarm.h
+./examples/notification.lo: ../../include/net-snmp/library/data_list.h
+./examples/notification.lo: ../../include/net-snmp/library/callback.h
+./examples/notification.lo: ../../include/net-snmp/library/oid_stash.h
+./examples/notification.lo: ../../include/net-snmp/library/check_varbind.h
+./examples/notification.lo: ../../include/net-snmp/version.h
+./examples/notification.lo: ../../include/net-snmp/session_api.h
+./examples/notification.lo: ../../include/net-snmp/library/snmp_transport.h
+./examples/notification.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./examples/notification.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./examples/notification.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./examples/notification.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./examples/notification.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./examples/notification.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./examples/notification.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./examples/notification.lo: ../../include/net-snmp/library/ucd_compat.h
+./examples/notification.lo: ../../include/net-snmp/pdu_api.h
+./examples/notification.lo: ../../include/net-snmp/mib_api.h
+./examples/notification.lo: ../../include/net-snmp/library/mib.h
+./examples/notification.lo: ../../include/net-snmp/library/parse.h
+./examples/notification.lo: ../../include/net-snmp/varbind_api.h
+./examples/notification.lo: ../../include/net-snmp/config_api.h
+./examples/notification.lo: ../../include/net-snmp/library/read_config.h
+./examples/notification.lo: ../../include/net-snmp/library/default_store.h
+./examples/notification.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./examples/notification.lo: ../../include/net-snmp/library/snmp_enum.h
+./examples/notification.lo: ../../include/net-snmp/library/vacm.h
+./examples/notification.lo: ../../include/net-snmp/output_api.h
+./examples/notification.lo: ../../include/net-snmp/library/snmp_debug.h
+./examples/notification.lo: ../../include/net-snmp/library/snmp_logging.h
+./examples/notification.lo: ../../include/net-snmp/snmpv3_api.h
+./examples/notification.lo: ../../include/net-snmp/library/snmpv3.h
+./examples/notification.lo: ../../include/net-snmp/library/transform_oids.h
+./examples/notification.lo: ../../include/net-snmp/library/keytools.h
+./examples/notification.lo: ../../include/net-snmp/library/scapi.h
+./examples/notification.lo: ../../include/net-snmp/library/lcd_time.h
+./examples/notification.lo: ../../include/net-snmp/library/snmp_secmod.h
+./examples/notification.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./examples/notification.lo: ../../include/net-snmp/library/snmpusm.h
+./examples/notification.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./examples/notification.lo: ../../include/net-snmp/agent/snmp_agent.h
+./examples/notification.lo: ../../include/net-snmp/agent/snmp_vars.h
+./examples/notification.lo: ../../include/net-snmp/agent/agent_handler.h
+./examples/notification.lo: ../../include/net-snmp/agent/var_struct.h
+./examples/notification.lo: ../../include/net-snmp/agent/agent_registry.h
+./examples/notification.lo: ../../include/net-snmp/agent/ds_agent.h
+./examples/notification.lo: ../../include/net-snmp/agent/agent_read_config.h
+./examples/notification.lo: ../../include/net-snmp/agent/agent_trap.h
+./examples/notification.lo: ../../include/net-snmp/agent/all_helpers.h
+./examples/notification.lo: ../../include/net-snmp/agent/instance.h
+./examples/notification.lo: ../../include/net-snmp/agent/multiplexer.h
+./examples/notification.lo: ../../include/net-snmp/agent/null.h
+./examples/notification.lo: ../../include/net-snmp/agent/debug_handler.h
+./examples/notification.lo: ../../include/net-snmp/agent/old_api.h
+./examples/notification.lo: ../../include/net-snmp/agent/read_only.h
+./examples/notification.lo: ../../include/net-snmp/agent/serialize.h
+./examples/notification.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./examples/notification.lo: ../../include/net-snmp/agent/mode_end_call.h
+./examples/notification.lo: ../../include/net-snmp/agent/table.h
+./examples/notification.lo: ../../include/net-snmp/agent/table_data.h
+./examples/notification.lo: ../../include/net-snmp/agent/table_dataset.h
+./examples/notification.lo: ../../include/net-snmp/agent/table_iterator.h
+./examples/notification.lo: ../../include/net-snmp/agent/mib_module_config.h
+./examples/notification.lo: notification.h
+./examples/scalar_int.lo: ../../include/net-snmp/net-snmp-config.h
+./examples/scalar_int.lo: ../../include/net-snmp/system/linux.h
+./examples/scalar_int.lo: ../../include/net-snmp/system/sysv.h
+./examples/scalar_int.lo: ../../include/net-snmp/system/generic.h
+./examples/scalar_int.lo: ../../include/net-snmp/machine/generic.h
+./examples/scalar_int.lo: ../../include/net-snmp/net-snmp-includes.h
+./examples/scalar_int.lo: ../../include/net-snmp/definitions.h
+./examples/scalar_int.lo: ../../include/net-snmp/types.h
+./examples/scalar_int.lo: ../../include/net-snmp/library/snmp_api.h
+./examples/scalar_int.lo: ../../include/net-snmp/library/asn1.h
+./examples/scalar_int.lo: ../../include/net-snmp/library/snmp_impl.h
+./examples/scalar_int.lo: ../../include/net-snmp/library/snmp.h
+./examples/scalar_int.lo: ../../include/net-snmp/library/snmp-tc.h
+./examples/scalar_int.lo: ../../include/net-snmp/utilities.h
+./examples/scalar_int.lo: ../../include/net-snmp/library/snmp_client.h
+./examples/scalar_int.lo: ../../include/net-snmp/library/getopt.h
+./examples/scalar_int.lo: ../../include/net-snmp/library/system.h
+./examples/scalar_int.lo: ../../include/net-snmp/library/tools.h
+./examples/scalar_int.lo: ../../include/net-snmp/library/int64.h
+./examples/scalar_int.lo: ../../include/net-snmp/library/mt_support.h
+./examples/scalar_int.lo: ../../include/net-snmp/library/snmp_alarm.h
+./examples/scalar_int.lo: ../../include/net-snmp/library/data_list.h
+./examples/scalar_int.lo: ../../include/net-snmp/library/callback.h
+./examples/scalar_int.lo: ../../include/net-snmp/library/oid_stash.h
+./examples/scalar_int.lo: ../../include/net-snmp/library/check_varbind.h
+./examples/scalar_int.lo: ../../include/net-snmp/version.h
+./examples/scalar_int.lo: ../../include/net-snmp/session_api.h
+./examples/scalar_int.lo: ../../include/net-snmp/library/snmp_transport.h
+./examples/scalar_int.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./examples/scalar_int.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./examples/scalar_int.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./examples/scalar_int.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./examples/scalar_int.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./examples/scalar_int.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./examples/scalar_int.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./examples/scalar_int.lo: ../../include/net-snmp/library/ucd_compat.h
+./examples/scalar_int.lo: ../../include/net-snmp/pdu_api.h
+./examples/scalar_int.lo: ../../include/net-snmp/mib_api.h
+./examples/scalar_int.lo: ../../include/net-snmp/library/mib.h
+./examples/scalar_int.lo: ../../include/net-snmp/library/parse.h
+./examples/scalar_int.lo: ../../include/net-snmp/varbind_api.h
+./examples/scalar_int.lo: ../../include/net-snmp/config_api.h
+./examples/scalar_int.lo: ../../include/net-snmp/library/read_config.h
+./examples/scalar_int.lo: ../../include/net-snmp/library/default_store.h
+./examples/scalar_int.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./examples/scalar_int.lo: ../../include/net-snmp/library/snmp_enum.h
+./examples/scalar_int.lo: ../../include/net-snmp/library/vacm.h
+./examples/scalar_int.lo: ../../include/net-snmp/output_api.h
+./examples/scalar_int.lo: ../../include/net-snmp/library/snmp_debug.h
+./examples/scalar_int.lo: ../../include/net-snmp/library/snmp_logging.h
+./examples/scalar_int.lo: ../../include/net-snmp/snmpv3_api.h
+./examples/scalar_int.lo: ../../include/net-snmp/library/snmpv3.h
+./examples/scalar_int.lo: ../../include/net-snmp/library/transform_oids.h
+./examples/scalar_int.lo: ../../include/net-snmp/library/keytools.h
+./examples/scalar_int.lo: ../../include/net-snmp/library/scapi.h
+./examples/scalar_int.lo: ../../include/net-snmp/library/lcd_time.h
+./examples/scalar_int.lo: ../../include/net-snmp/library/snmp_secmod.h
+./examples/scalar_int.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./examples/scalar_int.lo: ../../include/net-snmp/library/snmpusm.h
+./examples/scalar_int.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./examples/scalar_int.lo: ../../include/net-snmp/agent/snmp_agent.h
+./examples/scalar_int.lo: ../../include/net-snmp/agent/snmp_vars.h
+./examples/scalar_int.lo: ../../include/net-snmp/agent/agent_handler.h
+./examples/scalar_int.lo: ../../include/net-snmp/agent/var_struct.h
+./examples/scalar_int.lo: ../../include/net-snmp/agent/agent_registry.h
+./examples/scalar_int.lo: ../../include/net-snmp/agent/ds_agent.h
+./examples/scalar_int.lo: ../../include/net-snmp/agent/agent_read_config.h
+./examples/scalar_int.lo: ../../include/net-snmp/agent/agent_trap.h
+./examples/scalar_int.lo: ../../include/net-snmp/agent/all_helpers.h
+./examples/scalar_int.lo: ../../include/net-snmp/agent/instance.h
+./examples/scalar_int.lo: ../../include/net-snmp/agent/multiplexer.h
+./examples/scalar_int.lo: ../../include/net-snmp/agent/null.h
+./examples/scalar_int.lo: ../../include/net-snmp/agent/debug_handler.h
+./examples/scalar_int.lo: ../../include/net-snmp/agent/old_api.h
+./examples/scalar_int.lo: ../../include/net-snmp/agent/read_only.h
+./examples/scalar_int.lo: ../../include/net-snmp/agent/serialize.h
+./examples/scalar_int.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./examples/scalar_int.lo: ../../include/net-snmp/agent/mode_end_call.h
+./examples/scalar_int.lo: ../../include/net-snmp/agent/table.h
+./examples/scalar_int.lo: ../../include/net-snmp/agent/table_data.h
+./examples/scalar_int.lo: ../../include/net-snmp/agent/table_dataset.h
+./examples/scalar_int.lo: ../../include/net-snmp/agent/table_iterator.h
+./examples/scalar_int.lo: ../../include/net-snmp/agent/mib_module_config.h
+./examples/ucdDemoPublic.lo: ../../include/net-snmp/net-snmp-config.h
+./examples/ucdDemoPublic.lo: ../../include/net-snmp/system/linux.h
+./examples/ucdDemoPublic.lo: ../../include/net-snmp/system/sysv.h
+./examples/ucdDemoPublic.lo: ../../include/net-snmp/system/generic.h
+./examples/ucdDemoPublic.lo: ../../include/net-snmp/machine/generic.h
+./examples/ucdDemoPublic.lo: ../../include/net-snmp/net-snmp-includes.h
+./examples/ucdDemoPublic.lo: ../../include/net-snmp/definitions.h
+./examples/ucdDemoPublic.lo: ../../include/net-snmp/types.h
+./examples/ucdDemoPublic.lo: ../../include/net-snmp/library/snmp_api.h
+./examples/ucdDemoPublic.lo: ../../include/net-snmp/library/asn1.h
+./examples/ucdDemoPublic.lo: ../../include/net-snmp/library/snmp_impl.h
+./examples/ucdDemoPublic.lo: ../../include/net-snmp/library/snmp.h
+./examples/ucdDemoPublic.lo: ../../include/net-snmp/library/snmp-tc.h
+./examples/ucdDemoPublic.lo: ../../include/net-snmp/utilities.h
+./examples/ucdDemoPublic.lo: ../../include/net-snmp/library/snmp_client.h
+./examples/ucdDemoPublic.lo: ../../include/net-snmp/library/getopt.h
+./examples/ucdDemoPublic.lo: ../../include/net-snmp/library/system.h
+./examples/ucdDemoPublic.lo: ../../include/net-snmp/library/tools.h
+./examples/ucdDemoPublic.lo: ../../include/net-snmp/library/int64.h
+./examples/ucdDemoPublic.lo: ../../include/net-snmp/library/mt_support.h
+./examples/ucdDemoPublic.lo: ../../include/net-snmp/library/snmp_alarm.h
+./examples/ucdDemoPublic.lo: ../../include/net-snmp/library/data_list.h
+./examples/ucdDemoPublic.lo: ../../include/net-snmp/library/callback.h
+./examples/ucdDemoPublic.lo: ../../include/net-snmp/library/oid_stash.h
+./examples/ucdDemoPublic.lo: ../../include/net-snmp/library/check_varbind.h
+./examples/ucdDemoPublic.lo: ../../include/net-snmp/version.h
+./examples/ucdDemoPublic.lo: ../../include/net-snmp/session_api.h
+./examples/ucdDemoPublic.lo: ../../include/net-snmp/library/snmp_transport.h
+./examples/ucdDemoPublic.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./examples/ucdDemoPublic.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./examples/ucdDemoPublic.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./examples/ucdDemoPublic.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./examples/ucdDemoPublic.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./examples/ucdDemoPublic.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./examples/ucdDemoPublic.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./examples/ucdDemoPublic.lo: ../../include/net-snmp/library/ucd_compat.h
+./examples/ucdDemoPublic.lo: ../../include/net-snmp/pdu_api.h
+./examples/ucdDemoPublic.lo: ../../include/net-snmp/mib_api.h
+./examples/ucdDemoPublic.lo: ../../include/net-snmp/library/mib.h
+./examples/ucdDemoPublic.lo: ../../include/net-snmp/library/parse.h
+./examples/ucdDemoPublic.lo: ../../include/net-snmp/varbind_api.h
+./examples/ucdDemoPublic.lo: ../../include/net-snmp/config_api.h
+./examples/ucdDemoPublic.lo: ../../include/net-snmp/library/read_config.h
+./examples/ucdDemoPublic.lo: ../../include/net-snmp/library/default_store.h
+./examples/ucdDemoPublic.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./examples/ucdDemoPublic.lo: ../../include/net-snmp/library/snmp_enum.h
+./examples/ucdDemoPublic.lo: ../../include/net-snmp/library/vacm.h
+./examples/ucdDemoPublic.lo: ../../include/net-snmp/output_api.h
+./examples/ucdDemoPublic.lo: ../../include/net-snmp/library/snmp_debug.h
+./examples/ucdDemoPublic.lo: ../../include/net-snmp/library/snmp_logging.h
+./examples/ucdDemoPublic.lo: ../../include/net-snmp/snmpv3_api.h
+./examples/ucdDemoPublic.lo: ../../include/net-snmp/library/snmpv3.h
+./examples/ucdDemoPublic.lo: ../../include/net-snmp/library/transform_oids.h
+./examples/ucdDemoPublic.lo: ../../include/net-snmp/library/keytools.h
+./examples/ucdDemoPublic.lo: ../../include/net-snmp/library/scapi.h
+./examples/ucdDemoPublic.lo: ../../include/net-snmp/library/lcd_time.h
+./examples/ucdDemoPublic.lo: ../../include/net-snmp/library/snmp_secmod.h
+./examples/ucdDemoPublic.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./examples/ucdDemoPublic.lo: ../../include/net-snmp/library/snmpusm.h
+./examples/ucdDemoPublic.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./examples/ucdDemoPublic.lo: ../../include/net-snmp/agent/snmp_agent.h
+./examples/ucdDemoPublic.lo: ../../include/net-snmp/agent/snmp_vars.h
+./examples/ucdDemoPublic.lo: ../../include/net-snmp/agent/agent_handler.h
+./examples/ucdDemoPublic.lo: ../../include/net-snmp/agent/var_struct.h
+./examples/ucdDemoPublic.lo: ../../include/net-snmp/agent/agent_registry.h
+./examples/ucdDemoPublic.lo: ../../include/net-snmp/agent/ds_agent.h
+./examples/ucdDemoPublic.lo: ../../include/net-snmp/agent/agent_read_config.h
+./examples/ucdDemoPublic.lo: ../../include/net-snmp/agent/agent_trap.h
+./examples/ucdDemoPublic.lo: ../../include/net-snmp/agent/all_helpers.h
+./examples/ucdDemoPublic.lo: ../../include/net-snmp/agent/instance.h
+./examples/ucdDemoPublic.lo: ../../include/net-snmp/agent/multiplexer.h
+./examples/ucdDemoPublic.lo: ../../include/net-snmp/agent/null.h
+./examples/ucdDemoPublic.lo: ../../include/net-snmp/agent/debug_handler.h
+./examples/ucdDemoPublic.lo: ../../include/net-snmp/agent/old_api.h
+./examples/ucdDemoPublic.lo: ../../include/net-snmp/agent/read_only.h
+./examples/ucdDemoPublic.lo: ../../include/net-snmp/agent/serialize.h
+./examples/ucdDemoPublic.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./examples/ucdDemoPublic.lo: ../../include/net-snmp/agent/mode_end_call.h
+./examples/ucdDemoPublic.lo: ../../include/net-snmp/agent/table.h
+./examples/ucdDemoPublic.lo: ../../include/net-snmp/agent/table_data.h
+./examples/ucdDemoPublic.lo: ../../include/net-snmp/agent/table_dataset.h
+./examples/ucdDemoPublic.lo: ../../include/net-snmp/agent/table_iterator.h
+./examples/ucdDemoPublic.lo: ../../include/net-snmp/agent/mib_module_config.h
+./examples/ucdDemoPublic.lo: util_funcs.h struct.h ./examples/ucdDemoPublic.h
+./host/hr_device.lo: ../../include/net-snmp/net-snmp-config.h
+./host/hr_device.lo: ../../include/net-snmp/system/linux.h
+./host/hr_device.lo: ../../include/net-snmp/system/sysv.h
+./host/hr_device.lo: ../../include/net-snmp/system/generic.h
+./host/hr_device.lo: ../../include/net-snmp/machine/generic.h
+./host/hr_device.lo:  host_res.h 
+./host/hr_device.lo: ../../include/net-snmp/net-snmp-includes.h
+./host/hr_device.lo: ../../include/net-snmp/definitions.h
+./host/hr_device.lo: ../../include/net-snmp/types.h
+./host/hr_device.lo: ../../include/net-snmp/library/snmp_api.h
+./host/hr_device.lo: ../../include/net-snmp/library/asn1.h
+./host/hr_device.lo: ../../include/net-snmp/library/snmp_impl.h
+./host/hr_device.lo: ../../include/net-snmp/library/snmp.h
+./host/hr_device.lo: ../../include/net-snmp/library/snmp-tc.h
+./host/hr_device.lo: ../../include/net-snmp/utilities.h
+./host/hr_device.lo: ../../include/net-snmp/library/snmp_client.h
+./host/hr_device.lo: ../../include/net-snmp/library/getopt.h
+./host/hr_device.lo: ../../include/net-snmp/library/system.h
+./host/hr_device.lo: ../../include/net-snmp/library/tools.h
+./host/hr_device.lo: ../../include/net-snmp/library/int64.h
+./host/hr_device.lo: ../../include/net-snmp/library/mt_support.h
+./host/hr_device.lo: ../../include/net-snmp/library/snmp_alarm.h
+./host/hr_device.lo: ../../include/net-snmp/library/data_list.h
+./host/hr_device.lo: ../../include/net-snmp/library/callback.h
+./host/hr_device.lo: ../../include/net-snmp/library/oid_stash.h
+./host/hr_device.lo: ../../include/net-snmp/library/check_varbind.h
+./host/hr_device.lo: ../../include/net-snmp/version.h
+./host/hr_device.lo: ../../include/net-snmp/session_api.h
+./host/hr_device.lo: ../../include/net-snmp/library/snmp_transport.h
+./host/hr_device.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./host/hr_device.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./host/hr_device.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./host/hr_device.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./host/hr_device.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./host/hr_device.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./host/hr_device.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./host/hr_device.lo: ../../include/net-snmp/library/ucd_compat.h
+./host/hr_device.lo: ../../include/net-snmp/pdu_api.h
+./host/hr_device.lo: ../../include/net-snmp/mib_api.h
+./host/hr_device.lo: ../../include/net-snmp/library/mib.h
+./host/hr_device.lo: ../../include/net-snmp/library/parse.h
+./host/hr_device.lo: ../../include/net-snmp/varbind_api.h
+./host/hr_device.lo: ../../include/net-snmp/config_api.h
+./host/hr_device.lo: ../../include/net-snmp/library/read_config.h
+./host/hr_device.lo: ../../include/net-snmp/library/default_store.h
+./host/hr_device.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./host/hr_device.lo: ../../include/net-snmp/library/snmp_enum.h
+./host/hr_device.lo: ../../include/net-snmp/library/vacm.h
+./host/hr_device.lo: ../../include/net-snmp/output_api.h
+./host/hr_device.lo: ../../include/net-snmp/library/snmp_debug.h
+./host/hr_device.lo: ../../include/net-snmp/library/snmp_logging.h
+./host/hr_device.lo: ../../include/net-snmp/snmpv3_api.h
+./host/hr_device.lo: ../../include/net-snmp/library/snmpv3.h
+./host/hr_device.lo: ../../include/net-snmp/library/transform_oids.h
+./host/hr_device.lo: ../../include/net-snmp/library/keytools.h
+./host/hr_device.lo: ../../include/net-snmp/library/scapi.h
+./host/hr_device.lo: ../../include/net-snmp/library/lcd_time.h
+./host/hr_device.lo: ../../include/net-snmp/library/snmp_secmod.h
+./host/hr_device.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./host/hr_device.lo: ../../include/net-snmp/library/snmpusm.h
+./host/hr_device.lo: ../../include/net-snmp/agent/snmp_agent.h
+./host/hr_device.lo: ../../include/net-snmp/agent/agent_handler.h
+./host/hr_device.lo: ../../include/net-snmp/agent/snmp_vars.h
+./host/hr_device.lo: ../../include/net-snmp/agent/var_struct.h
+./host/hr_device.lo: ../../include/net-snmp/agent/agent_registry.h
+./host/hr_device.lo:  ./host/hr_device.h
+./host/hr_disk.lo: ../../include/net-snmp/net-snmp-config.h
+./host/hr_disk.lo: ../../include/net-snmp/system/linux.h
+./host/hr_disk.lo: ../../include/net-snmp/system/sysv.h
+./host/hr_disk.lo: ../../include/net-snmp/system/generic.h
+./host/hr_disk.lo: ../../include/net-snmp/machine/generic.h host_res.h
+./host/hr_disk.lo: ../../include/net-snmp/net-snmp-includes.h
+./host/hr_disk.lo: ../../include/net-snmp/definitions.h
+./host/hr_disk.lo: ../../include/net-snmp/types.h
+./host/hr_disk.lo: ../../include/net-snmp/library/snmp_api.h
+./host/hr_disk.lo: ../../include/net-snmp/library/asn1.h
+./host/hr_disk.lo: ../../include/net-snmp/library/snmp_impl.h
+./host/hr_disk.lo: ../../include/net-snmp/library/snmp.h
+./host/hr_disk.lo: ../../include/net-snmp/library/snmp-tc.h
+./host/hr_disk.lo: ../../include/net-snmp/utilities.h
+./host/hr_disk.lo: ../../include/net-snmp/library/snmp_client.h
+./host/hr_disk.lo: ../../include/net-snmp/library/getopt.h
+./host/hr_disk.lo: ../../include/net-snmp/library/system.h
+./host/hr_disk.lo: ../../include/net-snmp/library/tools.h
+./host/hr_disk.lo: ../../include/net-snmp/library/int64.h
+./host/hr_disk.lo: ../../include/net-snmp/library/mt_support.h
+./host/hr_disk.lo: ../../include/net-snmp/library/snmp_alarm.h
+./host/hr_disk.lo: ../../include/net-snmp/library/data_list.h
+./host/hr_disk.lo: ../../include/net-snmp/library/callback.h
+./host/hr_disk.lo: ../../include/net-snmp/library/oid_stash.h
+./host/hr_disk.lo: ../../include/net-snmp/library/check_varbind.h
+./host/hr_disk.lo: ../../include/net-snmp/version.h
+./host/hr_disk.lo: ../../include/net-snmp/session_api.h
+./host/hr_disk.lo: ../../include/net-snmp/library/snmp_transport.h
+./host/hr_disk.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./host/hr_disk.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./host/hr_disk.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./host/hr_disk.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./host/hr_disk.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./host/hr_disk.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./host/hr_disk.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./host/hr_disk.lo: ../../include/net-snmp/library/ucd_compat.h
+./host/hr_disk.lo: ../../include/net-snmp/pdu_api.h
+./host/hr_disk.lo: ../../include/net-snmp/mib_api.h
+./host/hr_disk.lo: ../../include/net-snmp/library/mib.h
+./host/hr_disk.lo: ../../include/net-snmp/library/parse.h
+./host/hr_disk.lo: ../../include/net-snmp/varbind_api.h
+./host/hr_disk.lo: ../../include/net-snmp/config_api.h
+./host/hr_disk.lo: ../../include/net-snmp/library/read_config.h
+./host/hr_disk.lo: ../../include/net-snmp/library/default_store.h
+./host/hr_disk.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./host/hr_disk.lo: ../../include/net-snmp/library/snmp_enum.h
+./host/hr_disk.lo: ../../include/net-snmp/library/vacm.h
+./host/hr_disk.lo: ../../include/net-snmp/output_api.h
+./host/hr_disk.lo: ../../include/net-snmp/library/snmp_debug.h
+./host/hr_disk.lo: ../../include/net-snmp/library/snmp_logging.h
+./host/hr_disk.lo: ../../include/net-snmp/snmpv3_api.h
+./host/hr_disk.lo: ../../include/net-snmp/library/snmpv3.h
+./host/hr_disk.lo: ../../include/net-snmp/library/transform_oids.h
+./host/hr_disk.lo: ../../include/net-snmp/library/keytools.h
+./host/hr_disk.lo: ../../include/net-snmp/library/scapi.h
+./host/hr_disk.lo: ../../include/net-snmp/library/lcd_time.h
+./host/hr_disk.lo: ../../include/net-snmp/library/snmp_secmod.h
+./host/hr_disk.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./host/hr_disk.lo: ../../include/net-snmp/library/snmpusm.h
+./host/hr_disk.lo: ../../include/net-snmp/agent/snmp_agent.h
+./host/hr_disk.lo: ../../include/net-snmp/agent/agent_handler.h
+./host/hr_disk.lo: ../../include/net-snmp/agent/snmp_vars.h
+./host/hr_disk.lo: ../../include/net-snmp/agent/var_struct.h
+./host/hr_disk.lo: ../../include/net-snmp/agent/agent_registry.h
+./host/hr_disk.lo:  ./host/hr_disk.h
+./host/hr_disk.lo: ../../include/net-snmp/agent/agent_read_config.h
+./host/hr_filesys.lo: ../../include/net-snmp/net-snmp-config.h
+./host/hr_filesys.lo: ../../include/net-snmp/system/linux.h
+./host/hr_filesys.lo: ../../include/net-snmp/system/sysv.h
+./host/hr_filesys.lo: ../../include/net-snmp/system/generic.h
+./host/hr_filesys.lo: ../../include/net-snmp/machine/generic.h host_res.h
+./host/hr_filesys.lo: ../../include/net-snmp/net-snmp-includes.h
+./host/hr_filesys.lo: ../../include/net-snmp/definitions.h
+./host/hr_filesys.lo: ../../include/net-snmp/types.h
+./host/hr_filesys.lo: ../../include/net-snmp/library/snmp_api.h
+./host/hr_filesys.lo: ../../include/net-snmp/library/asn1.h
+./host/hr_filesys.lo: ../../include/net-snmp/library/snmp_impl.h
+./host/hr_filesys.lo: ../../include/net-snmp/library/snmp.h
+./host/hr_filesys.lo: ../../include/net-snmp/library/snmp-tc.h
+./host/hr_filesys.lo: ../../include/net-snmp/utilities.h
+./host/hr_filesys.lo: ../../include/net-snmp/library/snmp_client.h
+./host/hr_filesys.lo: ../../include/net-snmp/library/getopt.h
+./host/hr_filesys.lo: ../../include/net-snmp/library/system.h
+./host/hr_filesys.lo: ../../include/net-snmp/library/tools.h
+./host/hr_filesys.lo: ../../include/net-snmp/library/int64.h
+./host/hr_filesys.lo: ../../include/net-snmp/library/mt_support.h
+./host/hr_filesys.lo: ../../include/net-snmp/library/snmp_alarm.h
+./host/hr_filesys.lo: ../../include/net-snmp/library/data_list.h
+./host/hr_filesys.lo: ../../include/net-snmp/library/callback.h
+./host/hr_filesys.lo: ../../include/net-snmp/library/oid_stash.h
+./host/hr_filesys.lo: ../../include/net-snmp/library/check_varbind.h
+./host/hr_filesys.lo: ../../include/net-snmp/version.h
+./host/hr_filesys.lo: ../../include/net-snmp/session_api.h
+./host/hr_filesys.lo: ../../include/net-snmp/library/snmp_transport.h
+./host/hr_filesys.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./host/hr_filesys.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./host/hr_filesys.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./host/hr_filesys.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./host/hr_filesys.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./host/hr_filesys.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./host/hr_filesys.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./host/hr_filesys.lo: ../../include/net-snmp/library/ucd_compat.h
+./host/hr_filesys.lo: ../../include/net-snmp/pdu_api.h
+./host/hr_filesys.lo: ../../include/net-snmp/mib_api.h
+./host/hr_filesys.lo: ../../include/net-snmp/library/mib.h
+./host/hr_filesys.lo: ../../include/net-snmp/library/parse.h
+./host/hr_filesys.lo: ../../include/net-snmp/varbind_api.h
+./host/hr_filesys.lo: ../../include/net-snmp/config_api.h
+./host/hr_filesys.lo: ../../include/net-snmp/library/read_config.h
+./host/hr_filesys.lo: ../../include/net-snmp/library/default_store.h
+./host/hr_filesys.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./host/hr_filesys.lo: ../../include/net-snmp/library/snmp_enum.h
+./host/hr_filesys.lo: ../../include/net-snmp/library/vacm.h
+./host/hr_filesys.lo: ../../include/net-snmp/output_api.h
+./host/hr_filesys.lo: ../../include/net-snmp/library/snmp_debug.h
+./host/hr_filesys.lo: ../../include/net-snmp/library/snmp_logging.h
+./host/hr_filesys.lo: ../../include/net-snmp/snmpv3_api.h
+./host/hr_filesys.lo: ../../include/net-snmp/library/snmpv3.h
+./host/hr_filesys.lo: ../../include/net-snmp/library/transform_oids.h
+./host/hr_filesys.lo: ../../include/net-snmp/library/keytools.h
+./host/hr_filesys.lo: ../../include/net-snmp/library/scapi.h
+./host/hr_filesys.lo: ../../include/net-snmp/library/lcd_time.h
+./host/hr_filesys.lo: ../../include/net-snmp/library/snmp_secmod.h
+./host/hr_filesys.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./host/hr_filesys.lo: ../../include/net-snmp/library/snmpusm.h
+./host/hr_filesys.lo: ../../include/net-snmp/agent/snmp_agent.h
+./host/hr_filesys.lo: ../../include/net-snmp/agent/agent_handler.h
+./host/hr_filesys.lo: ../../include/net-snmp/agent/snmp_vars.h
+./host/hr_filesys.lo: ../../include/net-snmp/agent/var_struct.h
+./host/hr_filesys.lo: ../../include/net-snmp/agent/agent_registry.h
+./host/hr_filesys.lo:  ./host/hr_filesys.h
+./host/hr_network.lo: ../../include/net-snmp/net-snmp-config.h
+./host/hr_network.lo: ../../include/net-snmp/system/linux.h
+./host/hr_network.lo: ../../include/net-snmp/system/sysv.h
+./host/hr_network.lo: ../../include/net-snmp/system/generic.h
+./host/hr_network.lo: ../../include/net-snmp/machine/generic.h
+./host/hr_network.lo:  host_res.h 
+./host/hr_network.lo: ../../include/net-snmp/net-snmp-includes.h
+./host/hr_network.lo: ../../include/net-snmp/definitions.h
+./host/hr_network.lo: ../../include/net-snmp/types.h
+./host/hr_network.lo: ../../include/net-snmp/library/snmp_api.h
+./host/hr_network.lo: ../../include/net-snmp/library/asn1.h
+./host/hr_network.lo: ../../include/net-snmp/library/snmp_impl.h
+./host/hr_network.lo: ../../include/net-snmp/library/snmp.h
+./host/hr_network.lo: ../../include/net-snmp/library/snmp-tc.h
+./host/hr_network.lo: ../../include/net-snmp/utilities.h
+./host/hr_network.lo: ../../include/net-snmp/library/snmp_client.h
+./host/hr_network.lo: ../../include/net-snmp/library/getopt.h
+./host/hr_network.lo: ../../include/net-snmp/library/system.h
+./host/hr_network.lo: ../../include/net-snmp/library/tools.h
+./host/hr_network.lo: ../../include/net-snmp/library/int64.h
+./host/hr_network.lo: ../../include/net-snmp/library/mt_support.h
+./host/hr_network.lo: ../../include/net-snmp/library/snmp_alarm.h
+./host/hr_network.lo: ../../include/net-snmp/library/data_list.h
+./host/hr_network.lo: ../../include/net-snmp/library/callback.h
+./host/hr_network.lo: ../../include/net-snmp/library/oid_stash.h
+./host/hr_network.lo: ../../include/net-snmp/library/check_varbind.h
+./host/hr_network.lo: ../../include/net-snmp/version.h
+./host/hr_network.lo: ../../include/net-snmp/session_api.h
+./host/hr_network.lo: ../../include/net-snmp/library/snmp_transport.h
+./host/hr_network.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./host/hr_network.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./host/hr_network.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./host/hr_network.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./host/hr_network.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./host/hr_network.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./host/hr_network.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./host/hr_network.lo: ../../include/net-snmp/library/ucd_compat.h
+./host/hr_network.lo: ../../include/net-snmp/pdu_api.h
+./host/hr_network.lo: ../../include/net-snmp/mib_api.h
+./host/hr_network.lo: ../../include/net-snmp/library/mib.h
+./host/hr_network.lo: ../../include/net-snmp/library/parse.h
+./host/hr_network.lo: ../../include/net-snmp/varbind_api.h
+./host/hr_network.lo: ../../include/net-snmp/config_api.h
+./host/hr_network.lo: ../../include/net-snmp/library/read_config.h
+./host/hr_network.lo: ../../include/net-snmp/library/default_store.h
+./host/hr_network.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./host/hr_network.lo: ../../include/net-snmp/library/snmp_enum.h
+./host/hr_network.lo: ../../include/net-snmp/library/vacm.h
+./host/hr_network.lo: ../../include/net-snmp/output_api.h
+./host/hr_network.lo: ../../include/net-snmp/library/snmp_debug.h
+./host/hr_network.lo: ../../include/net-snmp/library/snmp_logging.h
+./host/hr_network.lo: ../../include/net-snmp/snmpv3_api.h
+./host/hr_network.lo: ../../include/net-snmp/library/snmpv3.h
+./host/hr_network.lo: ../../include/net-snmp/library/transform_oids.h
+./host/hr_network.lo: ../../include/net-snmp/library/keytools.h
+./host/hr_network.lo: ../../include/net-snmp/library/scapi.h
+./host/hr_network.lo: ../../include/net-snmp/library/lcd_time.h
+./host/hr_network.lo: ../../include/net-snmp/library/snmp_secmod.h
+./host/hr_network.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./host/hr_network.lo: ../../include/net-snmp/library/snmpusm.h
+./host/hr_network.lo: ../../include/net-snmp/agent/snmp_agent.h
+./host/hr_network.lo: ../../include/net-snmp/agent/agent_handler.h
+./host/hr_network.lo: ../../include/net-snmp/agent/snmp_vars.h
+./host/hr_network.lo: ../../include/net-snmp/agent/var_struct.h
+./host/hr_network.lo: ../../include/net-snmp/agent/agent_registry.h
+./host/hr_network.lo:  mibII/interfaces.h
+./host/hr_network.lo: ./host/hr_network.h
+./host/hr_other.lo: ../../include/net-snmp/net-snmp-config.h
+./host/hr_other.lo: ../../include/net-snmp/system/linux.h
+./host/hr_other.lo: ../../include/net-snmp/system/sysv.h
+./host/hr_other.lo: ../../include/net-snmp/system/generic.h
+./host/hr_other.lo: ../../include/net-snmp/machine/generic.h host_res.h
+./host/hr_other.lo: ../../include/net-snmp/net-snmp-includes.h
+./host/hr_other.lo: ../../include/net-snmp/definitions.h
+./host/hr_other.lo: ../../include/net-snmp/types.h
+./host/hr_other.lo: ../../include/net-snmp/library/snmp_api.h
+./host/hr_other.lo: ../../include/net-snmp/library/asn1.h
+./host/hr_other.lo: ../../include/net-snmp/library/snmp_impl.h
+./host/hr_other.lo: ../../include/net-snmp/library/snmp.h
+./host/hr_other.lo: ../../include/net-snmp/library/snmp-tc.h
+./host/hr_other.lo: ../../include/net-snmp/utilities.h
+./host/hr_other.lo: ../../include/net-snmp/library/snmp_client.h
+./host/hr_other.lo: ../../include/net-snmp/library/getopt.h
+./host/hr_other.lo: ../../include/net-snmp/library/system.h
+./host/hr_other.lo: ../../include/net-snmp/library/tools.h
+./host/hr_other.lo: ../../include/net-snmp/library/int64.h
+./host/hr_other.lo: ../../include/net-snmp/library/mt_support.h
+./host/hr_other.lo: ../../include/net-snmp/library/snmp_alarm.h
+./host/hr_other.lo: ../../include/net-snmp/library/data_list.h
+./host/hr_other.lo: ../../include/net-snmp/library/callback.h
+./host/hr_other.lo: ../../include/net-snmp/library/oid_stash.h
+./host/hr_other.lo: ../../include/net-snmp/library/check_varbind.h
+./host/hr_other.lo: ../../include/net-snmp/version.h
+./host/hr_other.lo: ../../include/net-snmp/session_api.h
+./host/hr_other.lo: ../../include/net-snmp/library/snmp_transport.h
+./host/hr_other.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./host/hr_other.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./host/hr_other.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./host/hr_other.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./host/hr_other.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./host/hr_other.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./host/hr_other.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./host/hr_other.lo: ../../include/net-snmp/library/ucd_compat.h
+./host/hr_other.lo: ../../include/net-snmp/pdu_api.h
+./host/hr_other.lo: ../../include/net-snmp/mib_api.h
+./host/hr_other.lo: ../../include/net-snmp/library/mib.h
+./host/hr_other.lo: ../../include/net-snmp/library/parse.h
+./host/hr_other.lo: ../../include/net-snmp/varbind_api.h
+./host/hr_other.lo: ../../include/net-snmp/config_api.h
+./host/hr_other.lo: ../../include/net-snmp/library/read_config.h
+./host/hr_other.lo: ../../include/net-snmp/library/default_store.h
+./host/hr_other.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./host/hr_other.lo: ../../include/net-snmp/library/snmp_enum.h
+./host/hr_other.lo: ../../include/net-snmp/library/vacm.h
+./host/hr_other.lo: ../../include/net-snmp/output_api.h
+./host/hr_other.lo: ../../include/net-snmp/library/snmp_debug.h
+./host/hr_other.lo: ../../include/net-snmp/library/snmp_logging.h
+./host/hr_other.lo: ../../include/net-snmp/snmpv3_api.h
+./host/hr_other.lo: ../../include/net-snmp/library/snmpv3.h
+./host/hr_other.lo: ../../include/net-snmp/library/transform_oids.h
+./host/hr_other.lo: ../../include/net-snmp/library/keytools.h
+./host/hr_other.lo: ../../include/net-snmp/library/scapi.h
+./host/hr_other.lo: ../../include/net-snmp/library/lcd_time.h
+./host/hr_other.lo: ../../include/net-snmp/library/snmp_secmod.h
+./host/hr_other.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./host/hr_other.lo: ../../include/net-snmp/library/snmpusm.h
+./host/hr_other.lo: ../../include/net-snmp/agent/snmp_agent.h
+./host/hr_other.lo: ../../include/net-snmp/agent/agent_handler.h
+./host/hr_other.lo: ../../include/net-snmp/agent/snmp_vars.h
+./host/hr_other.lo: ../../include/net-snmp/agent/var_struct.h
+./host/hr_other.lo: ../../include/net-snmp/agent/agent_registry.h
+./host/hr_other.lo:  ./host/hr_other.h
+./host/hr_partition.lo: ../../include/net-snmp/net-snmp-config.h
+./host/hr_partition.lo: ../../include/net-snmp/system/linux.h
+./host/hr_partition.lo: ../../include/net-snmp/system/sysv.h
+./host/hr_partition.lo: ../../include/net-snmp/system/generic.h
+./host/hr_partition.lo: ../../include/net-snmp/machine/generic.h
+./host/hr_partition.lo: host_res.h 
+./host/hr_partition.lo: ../../include/net-snmp/net-snmp-includes.h
+./host/hr_partition.lo: ../../include/net-snmp/definitions.h
+./host/hr_partition.lo: ../../include/net-snmp/types.h
+./host/hr_partition.lo: ../../include/net-snmp/library/snmp_api.h
+./host/hr_partition.lo: ../../include/net-snmp/library/asn1.h
+./host/hr_partition.lo: ../../include/net-snmp/library/snmp_impl.h
+./host/hr_partition.lo: ../../include/net-snmp/library/snmp.h
+./host/hr_partition.lo: ../../include/net-snmp/library/snmp-tc.h
+./host/hr_partition.lo: ../../include/net-snmp/utilities.h
+./host/hr_partition.lo: ../../include/net-snmp/library/snmp_client.h
+./host/hr_partition.lo: ../../include/net-snmp/library/getopt.h
+./host/hr_partition.lo: ../../include/net-snmp/library/system.h
+./host/hr_partition.lo: ../../include/net-snmp/library/tools.h
+./host/hr_partition.lo: ../../include/net-snmp/library/int64.h
+./host/hr_partition.lo: ../../include/net-snmp/library/mt_support.h
+./host/hr_partition.lo: ../../include/net-snmp/library/snmp_alarm.h
+./host/hr_partition.lo: ../../include/net-snmp/library/data_list.h
+./host/hr_partition.lo: ../../include/net-snmp/library/callback.h
+./host/hr_partition.lo: ../../include/net-snmp/library/oid_stash.h
+./host/hr_partition.lo: ../../include/net-snmp/library/check_varbind.h
+./host/hr_partition.lo: ../../include/net-snmp/version.h
+./host/hr_partition.lo: ../../include/net-snmp/session_api.h
+./host/hr_partition.lo: ../../include/net-snmp/library/snmp_transport.h
+./host/hr_partition.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./host/hr_partition.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./host/hr_partition.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./host/hr_partition.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./host/hr_partition.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./host/hr_partition.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./host/hr_partition.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./host/hr_partition.lo: ../../include/net-snmp/library/ucd_compat.h
+./host/hr_partition.lo: ../../include/net-snmp/pdu_api.h
+./host/hr_partition.lo: ../../include/net-snmp/mib_api.h
+./host/hr_partition.lo: ../../include/net-snmp/library/mib.h
+./host/hr_partition.lo: ../../include/net-snmp/library/parse.h
+./host/hr_partition.lo: ../../include/net-snmp/varbind_api.h
+./host/hr_partition.lo: ../../include/net-snmp/config_api.h
+./host/hr_partition.lo: ../../include/net-snmp/library/read_config.h
+./host/hr_partition.lo: ../../include/net-snmp/library/default_store.h
+./host/hr_partition.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./host/hr_partition.lo: ../../include/net-snmp/library/snmp_enum.h
+./host/hr_partition.lo: ../../include/net-snmp/library/vacm.h
+./host/hr_partition.lo: ../../include/net-snmp/output_api.h
+./host/hr_partition.lo: ../../include/net-snmp/library/snmp_debug.h
+./host/hr_partition.lo: ../../include/net-snmp/library/snmp_logging.h
+./host/hr_partition.lo: ../../include/net-snmp/snmpv3_api.h
+./host/hr_partition.lo: ../../include/net-snmp/library/snmpv3.h
+./host/hr_partition.lo: ../../include/net-snmp/library/transform_oids.h
+./host/hr_partition.lo: ../../include/net-snmp/library/keytools.h
+./host/hr_partition.lo: ../../include/net-snmp/library/scapi.h
+./host/hr_partition.lo: ../../include/net-snmp/library/lcd_time.h
+./host/hr_partition.lo: ../../include/net-snmp/library/snmp_secmod.h
+./host/hr_partition.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./host/hr_partition.lo: ../../include/net-snmp/library/snmpusm.h
+./host/hr_partition.lo: ../../include/net-snmp/agent/snmp_agent.h
+./host/hr_partition.lo: ../../include/net-snmp/agent/agent_handler.h
+./host/hr_partition.lo: ../../include/net-snmp/agent/snmp_vars.h
+./host/hr_partition.lo: ../../include/net-snmp/agent/var_struct.h
+./host/hr_partition.lo: ../../include/net-snmp/agent/agent_registry.h
+./host/hr_partition.lo:  ./host/hr_partition.h
+./host/hr_partition.lo: ./host/hr_filesys.h ./host/hr_disk.h
+./host/hr_print.lo: ../../include/net-snmp/net-snmp-config.h
+./host/hr_print.lo: ../../include/net-snmp/system/linux.h
+./host/hr_print.lo: ../../include/net-snmp/system/sysv.h
+./host/hr_print.lo: ../../include/net-snmp/system/generic.h
+./host/hr_print.lo: ../../include/net-snmp/machine/generic.h
+./host/hr_print.lo: host_res.h 
+./host/hr_print.lo: ../../include/net-snmp/net-snmp-includes.h
+./host/hr_print.lo: ../../include/net-snmp/definitions.h
+./host/hr_print.lo: ../../include/net-snmp/types.h
+./host/hr_print.lo: ../../include/net-snmp/library/snmp_api.h
+./host/hr_print.lo: ../../include/net-snmp/library/asn1.h
+./host/hr_print.lo: ../../include/net-snmp/library/snmp_impl.h
+./host/hr_print.lo: ../../include/net-snmp/library/snmp.h
+./host/hr_print.lo: ../../include/net-snmp/library/snmp-tc.h
+./host/hr_print.lo: ../../include/net-snmp/utilities.h
+./host/hr_print.lo: ../../include/net-snmp/library/snmp_client.h
+./host/hr_print.lo: ../../include/net-snmp/library/getopt.h
+./host/hr_print.lo: ../../include/net-snmp/library/system.h
+./host/hr_print.lo: ../../include/net-snmp/library/tools.h
+./host/hr_print.lo: ../../include/net-snmp/library/int64.h
+./host/hr_print.lo: ../../include/net-snmp/library/mt_support.h
+./host/hr_print.lo: ../../include/net-snmp/library/snmp_alarm.h
+./host/hr_print.lo: ../../include/net-snmp/library/data_list.h
+./host/hr_print.lo: ../../include/net-snmp/library/callback.h
+./host/hr_print.lo: ../../include/net-snmp/library/oid_stash.h
+./host/hr_print.lo: ../../include/net-snmp/library/check_varbind.h
+./host/hr_print.lo: ../../include/net-snmp/version.h
+./host/hr_print.lo: ../../include/net-snmp/session_api.h
+./host/hr_print.lo: ../../include/net-snmp/library/snmp_transport.h
+./host/hr_print.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./host/hr_print.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./host/hr_print.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./host/hr_print.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./host/hr_print.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./host/hr_print.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./host/hr_print.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./host/hr_print.lo: ../../include/net-snmp/library/ucd_compat.h
+./host/hr_print.lo: ../../include/net-snmp/pdu_api.h
+./host/hr_print.lo: ../../include/net-snmp/mib_api.h
+./host/hr_print.lo: ../../include/net-snmp/library/mib.h
+./host/hr_print.lo: ../../include/net-snmp/library/parse.h
+./host/hr_print.lo: ../../include/net-snmp/varbind_api.h
+./host/hr_print.lo: ../../include/net-snmp/config_api.h
+./host/hr_print.lo: ../../include/net-snmp/library/read_config.h
+./host/hr_print.lo: ../../include/net-snmp/library/default_store.h
+./host/hr_print.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./host/hr_print.lo: ../../include/net-snmp/library/snmp_enum.h
+./host/hr_print.lo: ../../include/net-snmp/library/vacm.h
+./host/hr_print.lo: ../../include/net-snmp/output_api.h
+./host/hr_print.lo: ../../include/net-snmp/library/snmp_debug.h
+./host/hr_print.lo: ../../include/net-snmp/library/snmp_logging.h
+./host/hr_print.lo: ../../include/net-snmp/snmpv3_api.h
+./host/hr_print.lo: ../../include/net-snmp/library/snmpv3.h
+./host/hr_print.lo: ../../include/net-snmp/library/transform_oids.h
+./host/hr_print.lo: ../../include/net-snmp/library/keytools.h
+./host/hr_print.lo: ../../include/net-snmp/library/scapi.h
+./host/hr_print.lo: ../../include/net-snmp/library/lcd_time.h
+./host/hr_print.lo: ../../include/net-snmp/library/snmp_secmod.h
+./host/hr_print.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./host/hr_print.lo: ../../include/net-snmp/library/snmpusm.h
+./host/hr_print.lo: ../../include/net-snmp/agent/snmp_agent.h
+./host/hr_print.lo: ../../include/net-snmp/agent/agent_handler.h
+./host/hr_print.lo: ../../include/net-snmp/agent/snmp_vars.h
+./host/hr_print.lo: ../../include/net-snmp/agent/var_struct.h
+./host/hr_print.lo: ../../include/net-snmp/agent/agent_registry.h
+./host/hr_print.lo:  ./host/hr_print.h struct.h
+./host/hr_print.lo: util_funcs.h
+./host/hr_proc.lo: ../../include/net-snmp/net-snmp-config.h
+./host/hr_proc.lo: ../../include/net-snmp/system/linux.h
+./host/hr_proc.lo: ../../include/net-snmp/system/sysv.h
+./host/hr_proc.lo: ../../include/net-snmp/system/generic.h
+./host/hr_proc.lo: ../../include/net-snmp/machine/generic.h
+./host/hr_proc.lo:   host_res.h
+./host/hr_proc.lo: ../../include/net-snmp/net-snmp-includes.h
+./host/hr_proc.lo: ../../include/net-snmp/definitions.h
+./host/hr_proc.lo: ../../include/net-snmp/types.h
+./host/hr_proc.lo: ../../include/net-snmp/library/snmp_api.h
+./host/hr_proc.lo: ../../include/net-snmp/library/asn1.h
+./host/hr_proc.lo: ../../include/net-snmp/library/snmp_impl.h
+./host/hr_proc.lo: ../../include/net-snmp/library/snmp.h
+./host/hr_proc.lo: ../../include/net-snmp/library/snmp-tc.h
+./host/hr_proc.lo: ../../include/net-snmp/utilities.h
+./host/hr_proc.lo: ../../include/net-snmp/library/snmp_client.h
+./host/hr_proc.lo: ../../include/net-snmp/library/getopt.h
+./host/hr_proc.lo: ../../include/net-snmp/library/system.h
+./host/hr_proc.lo: ../../include/net-snmp/library/tools.h
+./host/hr_proc.lo: ../../include/net-snmp/library/int64.h
+./host/hr_proc.lo: ../../include/net-snmp/library/mt_support.h
+./host/hr_proc.lo: ../../include/net-snmp/library/snmp_alarm.h
+./host/hr_proc.lo: ../../include/net-snmp/library/data_list.h
+./host/hr_proc.lo: ../../include/net-snmp/library/callback.h
+./host/hr_proc.lo: ../../include/net-snmp/library/oid_stash.h
+./host/hr_proc.lo: ../../include/net-snmp/library/check_varbind.h
+./host/hr_proc.lo: ../../include/net-snmp/version.h
+./host/hr_proc.lo: ../../include/net-snmp/session_api.h
+./host/hr_proc.lo: ../../include/net-snmp/library/snmp_transport.h
+./host/hr_proc.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./host/hr_proc.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./host/hr_proc.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./host/hr_proc.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./host/hr_proc.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./host/hr_proc.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./host/hr_proc.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./host/hr_proc.lo: ../../include/net-snmp/library/ucd_compat.h
+./host/hr_proc.lo: ../../include/net-snmp/pdu_api.h
+./host/hr_proc.lo: ../../include/net-snmp/mib_api.h
+./host/hr_proc.lo: ../../include/net-snmp/library/mib.h
+./host/hr_proc.lo: ../../include/net-snmp/library/parse.h
+./host/hr_proc.lo: ../../include/net-snmp/varbind_api.h
+./host/hr_proc.lo: ../../include/net-snmp/config_api.h
+./host/hr_proc.lo: ../../include/net-snmp/library/read_config.h
+./host/hr_proc.lo: ../../include/net-snmp/library/default_store.h
+./host/hr_proc.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./host/hr_proc.lo: ../../include/net-snmp/library/snmp_enum.h
+./host/hr_proc.lo: ../../include/net-snmp/library/vacm.h
+./host/hr_proc.lo: ../../include/net-snmp/output_api.h
+./host/hr_proc.lo: ../../include/net-snmp/library/snmp_debug.h
+./host/hr_proc.lo: ../../include/net-snmp/library/snmp_logging.h
+./host/hr_proc.lo: ../../include/net-snmp/snmpv3_api.h
+./host/hr_proc.lo: ../../include/net-snmp/library/snmpv3.h
+./host/hr_proc.lo: ../../include/net-snmp/library/transform_oids.h
+./host/hr_proc.lo: ../../include/net-snmp/library/keytools.h
+./host/hr_proc.lo: ../../include/net-snmp/library/scapi.h
+./host/hr_proc.lo: ../../include/net-snmp/library/lcd_time.h
+./host/hr_proc.lo: ../../include/net-snmp/library/snmp_secmod.h
+./host/hr_proc.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./host/hr_proc.lo: ../../include/net-snmp/library/snmpusm.h
+./host/hr_proc.lo: ../../include/net-snmp/agent/snmp_agent.h
+./host/hr_proc.lo: ../../include/net-snmp/agent/agent_handler.h
+./host/hr_proc.lo: ../../include/net-snmp/agent/snmp_vars.h
+./host/hr_proc.lo: ../../include/net-snmp/agent/var_struct.h
+./host/hr_proc.lo: ../../include/net-snmp/agent/agent_registry.h
+./host/hr_proc.lo:  ./host/hr_proc.h
+./host/hr_proc.lo: ../../include/net-snmp/agent/auto_nlist.h
+./host/hr_proc.lo: ../../include/net-snmp/agent/agent_read_config.h
+./host/hr_proc.lo: ucd-snmp/loadave.h mibdefs.h
+./host/hr_storage.lo: ../../include/net-snmp/net-snmp-config.h
+./host/hr_storage.lo: ../../include/net-snmp/system/linux.h
+./host/hr_storage.lo: ../../include/net-snmp/system/sysv.h
+./host/hr_storage.lo: ../../include/net-snmp/system/generic.h
+./host/hr_storage.lo: ../../include/net-snmp/machine/generic.h
+./host/hr_storage.lo: host_res.h 
+./host/hr_storage.lo: ../../include/net-snmp/net-snmp-includes.h
+./host/hr_storage.lo: ../../include/net-snmp/definitions.h
+./host/hr_storage.lo: ../../include/net-snmp/types.h
+./host/hr_storage.lo: ../../include/net-snmp/library/snmp_api.h
+./host/hr_storage.lo: ../../include/net-snmp/library/asn1.h
+./host/hr_storage.lo: ../../include/net-snmp/library/snmp_impl.h
+./host/hr_storage.lo: ../../include/net-snmp/library/snmp.h
+./host/hr_storage.lo: ../../include/net-snmp/library/snmp-tc.h
+./host/hr_storage.lo: ../../include/net-snmp/utilities.h
+./host/hr_storage.lo: ../../include/net-snmp/library/snmp_client.h
+./host/hr_storage.lo: ../../include/net-snmp/library/getopt.h
+./host/hr_storage.lo: ../../include/net-snmp/library/system.h
+./host/hr_storage.lo: ../../include/net-snmp/library/tools.h
+./host/hr_storage.lo: ../../include/net-snmp/library/int64.h
+./host/hr_storage.lo: ../../include/net-snmp/library/mt_support.h
+./host/hr_storage.lo: ../../include/net-snmp/library/snmp_alarm.h
+./host/hr_storage.lo: ../../include/net-snmp/library/data_list.h
+./host/hr_storage.lo: ../../include/net-snmp/library/callback.h
+./host/hr_storage.lo: ../../include/net-snmp/library/oid_stash.h
+./host/hr_storage.lo: ../../include/net-snmp/library/check_varbind.h
+./host/hr_storage.lo: ../../include/net-snmp/version.h
+./host/hr_storage.lo: ../../include/net-snmp/session_api.h
+./host/hr_storage.lo: ../../include/net-snmp/library/snmp_transport.h
+./host/hr_storage.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./host/hr_storage.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./host/hr_storage.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./host/hr_storage.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./host/hr_storage.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./host/hr_storage.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./host/hr_storage.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./host/hr_storage.lo: ../../include/net-snmp/library/ucd_compat.h
+./host/hr_storage.lo: ../../include/net-snmp/pdu_api.h
+./host/hr_storage.lo: ../../include/net-snmp/mib_api.h
+./host/hr_storage.lo: ../../include/net-snmp/library/mib.h
+./host/hr_storage.lo: ../../include/net-snmp/library/parse.h
+./host/hr_storage.lo: ../../include/net-snmp/varbind_api.h
+./host/hr_storage.lo: ../../include/net-snmp/config_api.h
+./host/hr_storage.lo: ../../include/net-snmp/library/read_config.h
+./host/hr_storage.lo: ../../include/net-snmp/library/default_store.h
+./host/hr_storage.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./host/hr_storage.lo: ../../include/net-snmp/library/snmp_enum.h
+./host/hr_storage.lo: ../../include/net-snmp/library/vacm.h
+./host/hr_storage.lo: ../../include/net-snmp/output_api.h
+./host/hr_storage.lo: ../../include/net-snmp/library/snmp_debug.h
+./host/hr_storage.lo: ../../include/net-snmp/library/snmp_logging.h
+./host/hr_storage.lo: ../../include/net-snmp/snmpv3_api.h
+./host/hr_storage.lo: ../../include/net-snmp/library/snmpv3.h
+./host/hr_storage.lo: ../../include/net-snmp/library/transform_oids.h
+./host/hr_storage.lo: ../../include/net-snmp/library/keytools.h
+./host/hr_storage.lo: ../../include/net-snmp/library/scapi.h
+./host/hr_storage.lo: ../../include/net-snmp/library/lcd_time.h
+./host/hr_storage.lo: ../../include/net-snmp/library/snmp_secmod.h
+./host/hr_storage.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./host/hr_storage.lo: ../../include/net-snmp/library/snmpusm.h
+./host/hr_storage.lo: ../../include/net-snmp/agent/snmp_agent.h
+./host/hr_storage.lo: ../../include/net-snmp/agent/agent_handler.h
+./host/hr_storage.lo: ../../include/net-snmp/agent/snmp_vars.h
+./host/hr_storage.lo: ../../include/net-snmp/agent/var_struct.h
+./host/hr_storage.lo: ../../include/net-snmp/agent/agent_registry.h
+./host/hr_storage.lo:  ./host/hr_storage.h
+./host/hr_storage.lo: ./host/hr_filesys.h
+./host/hr_storage.lo: ../../include/net-snmp/agent/auto_nlist.h
+./host/hr_storage.lo: ../../include/net-snmp/agent/agent_read_config.h
+./host/hr_swinst.lo: ../../include/net-snmp/net-snmp-config.h
+./host/hr_swinst.lo: ../../include/net-snmp/system/linux.h
+./host/hr_swinst.lo: ../../include/net-snmp/system/sysv.h
+./host/hr_swinst.lo: ../../include/net-snmp/system/generic.h
+./host/hr_swinst.lo: ../../include/net-snmp/machine/generic.h
+./host/hr_swinst.lo:  host_res.h
+./host/hr_swinst.lo: ../../include/net-snmp/net-snmp-includes.h
+./host/hr_swinst.lo: ../../include/net-snmp/definitions.h
+./host/hr_swinst.lo: ../../include/net-snmp/types.h
+./host/hr_swinst.lo: ../../include/net-snmp/library/snmp_api.h
+./host/hr_swinst.lo: ../../include/net-snmp/library/asn1.h
+./host/hr_swinst.lo: ../../include/net-snmp/library/snmp_impl.h
+./host/hr_swinst.lo: ../../include/net-snmp/library/snmp.h
+./host/hr_swinst.lo: ../../include/net-snmp/library/snmp-tc.h
+./host/hr_swinst.lo: ../../include/net-snmp/utilities.h
+./host/hr_swinst.lo: ../../include/net-snmp/library/snmp_client.h
+./host/hr_swinst.lo: ../../include/net-snmp/library/getopt.h
+./host/hr_swinst.lo: ../../include/net-snmp/library/system.h
+./host/hr_swinst.lo: ../../include/net-snmp/library/tools.h
+./host/hr_swinst.lo: ../../include/net-snmp/library/int64.h
+./host/hr_swinst.lo: ../../include/net-snmp/library/mt_support.h
+./host/hr_swinst.lo: ../../include/net-snmp/library/snmp_alarm.h
+./host/hr_swinst.lo: ../../include/net-snmp/library/data_list.h
+./host/hr_swinst.lo: ../../include/net-snmp/library/callback.h
+./host/hr_swinst.lo: ../../include/net-snmp/library/oid_stash.h
+./host/hr_swinst.lo: ../../include/net-snmp/library/check_varbind.h
+./host/hr_swinst.lo: ../../include/net-snmp/version.h
+./host/hr_swinst.lo: ../../include/net-snmp/session_api.h
+./host/hr_swinst.lo: ../../include/net-snmp/library/snmp_transport.h
+./host/hr_swinst.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./host/hr_swinst.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./host/hr_swinst.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./host/hr_swinst.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./host/hr_swinst.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./host/hr_swinst.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./host/hr_swinst.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./host/hr_swinst.lo: ../../include/net-snmp/library/ucd_compat.h
+./host/hr_swinst.lo: ../../include/net-snmp/pdu_api.h
+./host/hr_swinst.lo: ../../include/net-snmp/mib_api.h
+./host/hr_swinst.lo: ../../include/net-snmp/library/mib.h
+./host/hr_swinst.lo: ../../include/net-snmp/library/parse.h
+./host/hr_swinst.lo: ../../include/net-snmp/varbind_api.h
+./host/hr_swinst.lo: ../../include/net-snmp/config_api.h
+./host/hr_swinst.lo: ../../include/net-snmp/library/read_config.h
+./host/hr_swinst.lo: ../../include/net-snmp/library/default_store.h
+./host/hr_swinst.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./host/hr_swinst.lo: ../../include/net-snmp/library/snmp_enum.h
+./host/hr_swinst.lo: ../../include/net-snmp/library/vacm.h
+./host/hr_swinst.lo: ../../include/net-snmp/output_api.h
+./host/hr_swinst.lo: ../../include/net-snmp/library/snmp_debug.h
+./host/hr_swinst.lo: ../../include/net-snmp/library/snmp_logging.h
+./host/hr_swinst.lo: ../../include/net-snmp/snmpv3_api.h
+./host/hr_swinst.lo: ../../include/net-snmp/library/snmpv3.h
+./host/hr_swinst.lo: ../../include/net-snmp/library/transform_oids.h
+./host/hr_swinst.lo: ../../include/net-snmp/library/keytools.h
+./host/hr_swinst.lo: ../../include/net-snmp/library/scapi.h
+./host/hr_swinst.lo: ../../include/net-snmp/library/lcd_time.h
+./host/hr_swinst.lo: ../../include/net-snmp/library/snmp_secmod.h
+./host/hr_swinst.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./host/hr_swinst.lo: ../../include/net-snmp/library/snmpusm.h
+./host/hr_swinst.lo: ../../include/net-snmp/agent/snmp_agent.h
+./host/hr_swinst.lo: ../../include/net-snmp/agent/agent_handler.h
+./host/hr_swinst.lo: ../../include/net-snmp/agent/snmp_vars.h
+./host/hr_swinst.lo: ../../include/net-snmp/agent/var_struct.h
+./host/hr_swinst.lo: ../../include/net-snmp/agent/agent_registry.h
+./host/hr_swinst.lo:  ./host/hr_swinst.h
+./host/hr_swrun.lo: ../../include/net-snmp/net-snmp-config.h
+./host/hr_swrun.lo: ../../include/net-snmp/system/linux.h
+./host/hr_swrun.lo: ../../include/net-snmp/system/sysv.h
+./host/hr_swrun.lo: ../../include/net-snmp/system/generic.h
+./host/hr_swrun.lo: ../../include/net-snmp/machine/generic.h
+./host/hr_swrun.lo: ../../include/net-snmp/output_api.h
+./host/hr_swrun.lo: ../../include/net-snmp/types.h 
+./host/hr_swrun.lo: ../../include/net-snmp/definitions.h
+./host/hr_swrun.lo: ../../include/net-snmp/library/snmp_api.h
+./host/hr_swrun.lo: ../../include/net-snmp/library/asn1.h
+./host/hr_swrun.lo: ../../include/net-snmp/library/snmp_impl.h
+./host/hr_swrun.lo: ../../include/net-snmp/library/snmp.h
+./host/hr_swrun.lo: ../../include/net-snmp/library/snmp-tc.h
+./host/hr_swrun.lo: ../../include/net-snmp/library/snmp_client.h
+./host/hr_swrun.lo: ../../include/net-snmp/library/snmp_debug.h
+./host/hr_swrun.lo: ../../include/net-snmp/library/snmp_logging.h
+./host/hr_swrun.lo: host_res.h ../../include/net-snmp/net-snmp-includes.h
+./host/hr_swrun.lo: ../../include/net-snmp/utilities.h
+./host/hr_swrun.lo: ../../include/net-snmp/library/getopt.h
+./host/hr_swrun.lo: ../../include/net-snmp/library/system.h
+./host/hr_swrun.lo: ../../include/net-snmp/library/tools.h
+./host/hr_swrun.lo: ../../include/net-snmp/library/int64.h
+./host/hr_swrun.lo: ../../include/net-snmp/library/mt_support.h
+./host/hr_swrun.lo: ../../include/net-snmp/library/snmp_alarm.h
+./host/hr_swrun.lo: ../../include/net-snmp/library/data_list.h
+./host/hr_swrun.lo: ../../include/net-snmp/library/callback.h
+./host/hr_swrun.lo: ../../include/net-snmp/library/oid_stash.h
+./host/hr_swrun.lo: ../../include/net-snmp/library/check_varbind.h
+./host/hr_swrun.lo: ../../include/net-snmp/version.h
+./host/hr_swrun.lo: ../../include/net-snmp/session_api.h
+./host/hr_swrun.lo: ../../include/net-snmp/library/snmp_transport.h
+./host/hr_swrun.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./host/hr_swrun.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./host/hr_swrun.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./host/hr_swrun.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./host/hr_swrun.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./host/hr_swrun.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./host/hr_swrun.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./host/hr_swrun.lo: ../../include/net-snmp/library/ucd_compat.h
+./host/hr_swrun.lo: ../../include/net-snmp/pdu_api.h
+./host/hr_swrun.lo: ../../include/net-snmp/mib_api.h
+./host/hr_swrun.lo: ../../include/net-snmp/library/mib.h
+./host/hr_swrun.lo: ../../include/net-snmp/library/parse.h
+./host/hr_swrun.lo: ../../include/net-snmp/varbind_api.h
+./host/hr_swrun.lo: ../../include/net-snmp/config_api.h
+./host/hr_swrun.lo: ../../include/net-snmp/library/read_config.h
+./host/hr_swrun.lo: ../../include/net-snmp/library/default_store.h
+./host/hr_swrun.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./host/hr_swrun.lo: ../../include/net-snmp/library/snmp_enum.h
+./host/hr_swrun.lo: ../../include/net-snmp/library/vacm.h
+./host/hr_swrun.lo: ../../include/net-snmp/snmpv3_api.h
+./host/hr_swrun.lo: ../../include/net-snmp/library/snmpv3.h
+./host/hr_swrun.lo: ../../include/net-snmp/library/transform_oids.h
+./host/hr_swrun.lo: ../../include/net-snmp/library/keytools.h
+./host/hr_swrun.lo: ../../include/net-snmp/library/scapi.h
+./host/hr_swrun.lo: ../../include/net-snmp/library/lcd_time.h
+./host/hr_swrun.lo: ../../include/net-snmp/library/snmp_secmod.h
+./host/hr_swrun.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./host/hr_swrun.lo: ../../include/net-snmp/library/snmpusm.h
+./host/hr_swrun.lo: ../../include/net-snmp/agent/snmp_agent.h
+./host/hr_swrun.lo: ../../include/net-snmp/agent/agent_handler.h
+./host/hr_swrun.lo: ../../include/net-snmp/agent/snmp_vars.h
+./host/hr_swrun.lo: ../../include/net-snmp/agent/var_struct.h
+./host/hr_swrun.lo: ../../include/net-snmp/agent/agent_registry.h
+./host/hr_swrun.lo:  ./host/hr_swrun.h
+./host/hr_swrun.lo: ../../include/net-snmp/agent/auto_nlist.h ./../kernel.h
+./host/hr_system.lo: ../../include/net-snmp/net-snmp-config.h
+./host/hr_system.lo: ../../include/net-snmp/system/linux.h
+./host/hr_system.lo: ../../include/net-snmp/system/sysv.h
+./host/hr_system.lo: ../../include/net-snmp/system/generic.h
+./host/hr_system.lo: ../../include/net-snmp/machine/generic.h
+./host/hr_system.lo: ../../include/net-snmp/net-snmp-includes.h
+./host/hr_system.lo: ../../include/net-snmp/definitions.h
+./host/hr_system.lo: ../../include/net-snmp/types.h
+./host/hr_system.lo: ../../include/net-snmp/library/snmp_api.h
+./host/hr_system.lo: ../../include/net-snmp/library/asn1.h
+./host/hr_system.lo: ../../include/net-snmp/library/snmp_impl.h
+./host/hr_system.lo: ../../include/net-snmp/library/snmp.h
+./host/hr_system.lo: ../../include/net-snmp/library/snmp-tc.h
+./host/hr_system.lo: ../../include/net-snmp/utilities.h
+./host/hr_system.lo: ../../include/net-snmp/library/snmp_client.h
+./host/hr_system.lo: ../../include/net-snmp/library/getopt.h
+./host/hr_system.lo: ../../include/net-snmp/library/system.h
+./host/hr_system.lo: ../../include/net-snmp/library/tools.h
+./host/hr_system.lo: ../../include/net-snmp/library/int64.h
+./host/hr_system.lo: ../../include/net-snmp/library/mt_support.h
+./host/hr_system.lo: ../../include/net-snmp/library/snmp_alarm.h
+./host/hr_system.lo: ../../include/net-snmp/library/data_list.h
+./host/hr_system.lo: ../../include/net-snmp/library/callback.h
+./host/hr_system.lo: ../../include/net-snmp/library/oid_stash.h
+./host/hr_system.lo: ../../include/net-snmp/library/check_varbind.h
+./host/hr_system.lo: ../../include/net-snmp/version.h
+./host/hr_system.lo: ../../include/net-snmp/session_api.h
+./host/hr_system.lo: ../../include/net-snmp/library/snmp_transport.h
+./host/hr_system.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./host/hr_system.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./host/hr_system.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./host/hr_system.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./host/hr_system.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./host/hr_system.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./host/hr_system.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./host/hr_system.lo: ../../include/net-snmp/library/ucd_compat.h
+./host/hr_system.lo: ../../include/net-snmp/pdu_api.h
+./host/hr_system.lo: ../../include/net-snmp/mib_api.h
+./host/hr_system.lo: ../../include/net-snmp/library/mib.h
+./host/hr_system.lo: ../../include/net-snmp/library/parse.h
+./host/hr_system.lo: ../../include/net-snmp/varbind_api.h
+./host/hr_system.lo: ../../include/net-snmp/config_api.h
+./host/hr_system.lo: ../../include/net-snmp/library/read_config.h
+./host/hr_system.lo: ../../include/net-snmp/library/default_store.h
+./host/hr_system.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./host/hr_system.lo: ../../include/net-snmp/library/snmp_enum.h
+./host/hr_system.lo: ../../include/net-snmp/library/vacm.h
+./host/hr_system.lo: ../../include/net-snmp/output_api.h
+./host/hr_system.lo: ../../include/net-snmp/library/snmp_debug.h
+./host/hr_system.lo: ../../include/net-snmp/library/snmp_logging.h
+./host/hr_system.lo: ../../include/net-snmp/snmpv3_api.h
+./host/hr_system.lo: ../../include/net-snmp/library/snmpv3.h
+./host/hr_system.lo: ../../include/net-snmp/library/transform_oids.h
+./host/hr_system.lo: ../../include/net-snmp/library/keytools.h
+./host/hr_system.lo: ../../include/net-snmp/library/scapi.h
+./host/hr_system.lo: ../../include/net-snmp/library/lcd_time.h
+./host/hr_system.lo: ../../include/net-snmp/library/snmp_secmod.h
+./host/hr_system.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./host/hr_system.lo: ../../include/net-snmp/library/snmpusm.h
+./host/hr_system.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./host/hr_system.lo: ../../include/net-snmp/agent/snmp_agent.h
+./host/hr_system.lo: ../../include/net-snmp/agent/snmp_vars.h
+./host/hr_system.lo: ../../include/net-snmp/agent/agent_handler.h
+./host/hr_system.lo: ../../include/net-snmp/agent/var_struct.h
+./host/hr_system.lo: ../../include/net-snmp/agent/agent_registry.h
+./host/hr_system.lo: ../../include/net-snmp/agent/ds_agent.h
+./host/hr_system.lo: ../../include/net-snmp/agent/agent_read_config.h
+./host/hr_system.lo: ../../include/net-snmp/agent/agent_trap.h
+./host/hr_system.lo: ../../include/net-snmp/agent/all_helpers.h
+./host/hr_system.lo: ../../include/net-snmp/agent/instance.h
+./host/hr_system.lo: ../../include/net-snmp/agent/multiplexer.h
+./host/hr_system.lo: ../../include/net-snmp/agent/null.h
+./host/hr_system.lo: ../../include/net-snmp/agent/debug_handler.h
+./host/hr_system.lo: ../../include/net-snmp/agent/old_api.h
+./host/hr_system.lo: ../../include/net-snmp/agent/read_only.h
+./host/hr_system.lo: ../../include/net-snmp/agent/serialize.h
+./host/hr_system.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./host/hr_system.lo: ../../include/net-snmp/agent/mode_end_call.h
+./host/hr_system.lo: ../../include/net-snmp/agent/table.h
+./host/hr_system.lo: ../../include/net-snmp/agent/table_data.h
+./host/hr_system.lo: ../../include/net-snmp/agent/table_dataset.h
+./host/hr_system.lo: ../../include/net-snmp/agent/table_iterator.h
+./host/hr_system.lo: ../../include/net-snmp/agent/mib_module_config.h host.h
+./host/hr_system.lo: host_res.h  ./host/hr_system.h
+./host/hr_system.lo: ../../include/net-snmp/agent/auto_nlist.h
+./mibII/at.lo: ../../include/net-snmp/net-snmp-config.h
+./mibII/at.lo: ../../include/net-snmp/system/linux.h
+./mibII/at.lo: ../../include/net-snmp/system/sysv.h
+./mibII/at.lo: ../../include/net-snmp/system/generic.h
+./mibII/at.lo: ../../include/net-snmp/machine/generic.h 
+./mibII/at.lo: ../../include/net-snmp/net-snmp-includes.h
+./mibII/at.lo: ../../include/net-snmp/definitions.h
+./mibII/at.lo: ../../include/net-snmp/types.h
+./mibII/at.lo: ../../include/net-snmp/library/snmp_api.h
+./mibII/at.lo: ../../include/net-snmp/library/asn1.h
+./mibII/at.lo: ../../include/net-snmp/library/snmp_impl.h
+./mibII/at.lo: ../../include/net-snmp/library/snmp.h
+./mibII/at.lo: ../../include/net-snmp/library/snmp-tc.h
+./mibII/at.lo: ../../include/net-snmp/utilities.h
+./mibII/at.lo: ../../include/net-snmp/library/snmp_client.h
+./mibII/at.lo: ../../include/net-snmp/library/getopt.h
+./mibII/at.lo: ../../include/net-snmp/library/system.h
+./mibII/at.lo: ../../include/net-snmp/library/tools.h
+./mibII/at.lo: ../../include/net-snmp/library/int64.h
+./mibII/at.lo: ../../include/net-snmp/library/mt_support.h
+./mibII/at.lo: ../../include/net-snmp/library/snmp_alarm.h
+./mibII/at.lo: ../../include/net-snmp/library/data_list.h
+./mibII/at.lo: ../../include/net-snmp/library/callback.h
+./mibII/at.lo: ../../include/net-snmp/library/oid_stash.h
+./mibII/at.lo: ../../include/net-snmp/library/check_varbind.h
+./mibII/at.lo: ../../include/net-snmp/version.h
+./mibII/at.lo: ../../include/net-snmp/session_api.h
+./mibII/at.lo: ../../include/net-snmp/library/snmp_transport.h
+./mibII/at.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./mibII/at.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./mibII/at.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./mibII/at.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./mibII/at.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./mibII/at.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./mibII/at.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./mibII/at.lo: ../../include/net-snmp/library/ucd_compat.h
+./mibII/at.lo: ../../include/net-snmp/pdu_api.h
+./mibII/at.lo: ../../include/net-snmp/mib_api.h
+./mibII/at.lo: ../../include/net-snmp/library/mib.h
+./mibII/at.lo: ../../include/net-snmp/library/parse.h
+./mibII/at.lo: ../../include/net-snmp/varbind_api.h
+./mibII/at.lo: ../../include/net-snmp/config_api.h
+./mibII/at.lo: ../../include/net-snmp/library/read_config.h
+./mibII/at.lo: ../../include/net-snmp/library/default_store.h
+./mibII/at.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./mibII/at.lo: ../../include/net-snmp/library/snmp_enum.h
+./mibII/at.lo: ../../include/net-snmp/library/vacm.h
+./mibII/at.lo: ../../include/net-snmp/output_api.h
+./mibII/at.lo: ../../include/net-snmp/library/snmp_debug.h
+./mibII/at.lo: ../../include/net-snmp/library/snmp_logging.h
+./mibII/at.lo: ../../include/net-snmp/snmpv3_api.h
+./mibII/at.lo: ../../include/net-snmp/library/snmpv3.h
+./mibII/at.lo: ../../include/net-snmp/library/transform_oids.h
+./mibII/at.lo: ../../include/net-snmp/library/keytools.h
+./mibII/at.lo: ../../include/net-snmp/library/scapi.h
+./mibII/at.lo: ../../include/net-snmp/library/lcd_time.h
+./mibII/at.lo: ../../include/net-snmp/library/snmp_secmod.h
+./mibII/at.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./mibII/at.lo: ../../include/net-snmp/library/snmpusm.h
+./mibII/at.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./mibII/at.lo: ../../include/net-snmp/agent/snmp_agent.h
+./mibII/at.lo: ../../include/net-snmp/agent/snmp_vars.h
+./mibII/at.lo: ../../include/net-snmp/agent/agent_handler.h
+./mibII/at.lo: ../../include/net-snmp/agent/var_struct.h
+./mibII/at.lo: ../../include/net-snmp/agent/agent_registry.h
+./mibII/at.lo: ../../include/net-snmp/agent/ds_agent.h
+./mibII/at.lo: ../../include/net-snmp/agent/agent_read_config.h
+./mibII/at.lo: ../../include/net-snmp/agent/agent_trap.h
+./mibII/at.lo: ../../include/net-snmp/agent/all_helpers.h
+./mibII/at.lo: ../../include/net-snmp/agent/instance.h
+./mibII/at.lo: ../../include/net-snmp/agent/multiplexer.h
+./mibII/at.lo: ../../include/net-snmp/agent/null.h
+./mibII/at.lo: ../../include/net-snmp/agent/debug_handler.h
+./mibII/at.lo: ../../include/net-snmp/agent/old_api.h
+./mibII/at.lo: ../../include/net-snmp/agent/read_only.h
+./mibII/at.lo: ../../include/net-snmp/agent/serialize.h
+./mibII/at.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./mibII/at.lo: ../../include/net-snmp/agent/mode_end_call.h
+./mibII/at.lo: ../../include/net-snmp/agent/table.h
+./mibII/at.lo: ../../include/net-snmp/agent/table_data.h
+./mibII/at.lo: ../../include/net-snmp/agent/table_dataset.h
+./mibII/at.lo: ../../include/net-snmp/agent/table_iterator.h
+./mibII/at.lo: ../../include/net-snmp/agent/mib_module_config.h
+./mibII/at.lo: ../../include/net-snmp/agent/auto_nlist.h ./mibII/at.h
+./mibII/at.lo: ./mibII/interfaces.h
+./mibII/icmp.lo: ../../include/net-snmp/net-snmp-config.h
+./mibII/icmp.lo: ../../include/net-snmp/system/linux.h
+./mibII/icmp.lo: ../../include/net-snmp/system/sysv.h
+./mibII/icmp.lo: ../../include/net-snmp/system/generic.h
+./mibII/icmp.lo: ../../include/net-snmp/machine/generic.h
+./mibII/icmp.lo: ../../include/net-snmp/net-snmp-includes.h
+./mibII/icmp.lo: ../../include/net-snmp/definitions.h
+./mibII/icmp.lo: ../../include/net-snmp/types.h
+./mibII/icmp.lo: ../../include/net-snmp/library/snmp_api.h
+./mibII/icmp.lo: ../../include/net-snmp/library/asn1.h
+./mibII/icmp.lo: ../../include/net-snmp/library/snmp_impl.h
+./mibII/icmp.lo: ../../include/net-snmp/library/snmp.h
+./mibII/icmp.lo: ../../include/net-snmp/library/snmp-tc.h
+./mibII/icmp.lo: ../../include/net-snmp/utilities.h
+./mibII/icmp.lo: ../../include/net-snmp/library/snmp_client.h
+./mibII/icmp.lo: ../../include/net-snmp/library/getopt.h
+./mibII/icmp.lo: ../../include/net-snmp/library/system.h
+./mibII/icmp.lo: ../../include/net-snmp/library/tools.h
+./mibII/icmp.lo: ../../include/net-snmp/library/int64.h
+./mibII/icmp.lo: ../../include/net-snmp/library/mt_support.h
+./mibII/icmp.lo: ../../include/net-snmp/library/snmp_alarm.h
+./mibII/icmp.lo: ../../include/net-snmp/library/data_list.h
+./mibII/icmp.lo: ../../include/net-snmp/library/callback.h
+./mibII/icmp.lo: ../../include/net-snmp/library/oid_stash.h
+./mibII/icmp.lo: ../../include/net-snmp/library/check_varbind.h
+./mibII/icmp.lo: ../../include/net-snmp/version.h
+./mibII/icmp.lo: ../../include/net-snmp/session_api.h
+./mibII/icmp.lo: ../../include/net-snmp/library/snmp_transport.h
+./mibII/icmp.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./mibII/icmp.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./mibII/icmp.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./mibII/icmp.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./mibII/icmp.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./mibII/icmp.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./mibII/icmp.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./mibII/icmp.lo: ../../include/net-snmp/library/ucd_compat.h
+./mibII/icmp.lo: ../../include/net-snmp/pdu_api.h
+./mibII/icmp.lo: ../../include/net-snmp/mib_api.h
+./mibII/icmp.lo: ../../include/net-snmp/library/mib.h
+./mibII/icmp.lo: ../../include/net-snmp/library/parse.h
+./mibII/icmp.lo: ../../include/net-snmp/varbind_api.h
+./mibII/icmp.lo: ../../include/net-snmp/config_api.h
+./mibII/icmp.lo: ../../include/net-snmp/library/read_config.h
+./mibII/icmp.lo: ../../include/net-snmp/library/default_store.h
+./mibII/icmp.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./mibII/icmp.lo: ../../include/net-snmp/library/snmp_enum.h
+./mibII/icmp.lo: ../../include/net-snmp/library/vacm.h
+./mibII/icmp.lo: ../../include/net-snmp/output_api.h
+./mibII/icmp.lo: ../../include/net-snmp/library/snmp_debug.h
+./mibII/icmp.lo: ../../include/net-snmp/library/snmp_logging.h
+./mibII/icmp.lo: ../../include/net-snmp/snmpv3_api.h
+./mibII/icmp.lo: ../../include/net-snmp/library/snmpv3.h
+./mibII/icmp.lo: ../../include/net-snmp/library/transform_oids.h
+./mibII/icmp.lo: ../../include/net-snmp/library/keytools.h
+./mibII/icmp.lo: ../../include/net-snmp/library/scapi.h
+./mibII/icmp.lo: ../../include/net-snmp/library/lcd_time.h
+./mibII/icmp.lo: ../../include/net-snmp/library/snmp_secmod.h
+./mibII/icmp.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./mibII/icmp.lo: ../../include/net-snmp/library/snmpusm.h
+./mibII/icmp.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./mibII/icmp.lo: ../../include/net-snmp/agent/snmp_agent.h
+./mibII/icmp.lo: ../../include/net-snmp/agent/snmp_vars.h
+./mibII/icmp.lo: ../../include/net-snmp/agent/agent_handler.h
+./mibII/icmp.lo: ../../include/net-snmp/agent/var_struct.h
+./mibII/icmp.lo: ../../include/net-snmp/agent/agent_registry.h
+./mibII/icmp.lo: ../../include/net-snmp/agent/ds_agent.h
+./mibII/icmp.lo: ../../include/net-snmp/agent/agent_read_config.h
+./mibII/icmp.lo: ../../include/net-snmp/agent/agent_trap.h
+./mibII/icmp.lo: ../../include/net-snmp/agent/all_helpers.h
+./mibII/icmp.lo: ../../include/net-snmp/agent/instance.h
+./mibII/icmp.lo: ../../include/net-snmp/agent/multiplexer.h
+./mibII/icmp.lo: ../../include/net-snmp/agent/null.h
+./mibII/icmp.lo: ../../include/net-snmp/agent/debug_handler.h
+./mibII/icmp.lo: ../../include/net-snmp/agent/old_api.h
+./mibII/icmp.lo: ../../include/net-snmp/agent/read_only.h
+./mibII/icmp.lo: ../../include/net-snmp/agent/serialize.h
+./mibII/icmp.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./mibII/icmp.lo: ../../include/net-snmp/agent/mode_end_call.h
+./mibII/icmp.lo: ../../include/net-snmp/agent/table.h
+./mibII/icmp.lo: ../../include/net-snmp/agent/table_data.h
+./mibII/icmp.lo: ../../include/net-snmp/agent/table_dataset.h
+./mibII/icmp.lo: ../../include/net-snmp/agent/table_iterator.h
+./mibII/icmp.lo: ../../include/net-snmp/agent/mib_module_config.h
+./mibII/icmp.lo: ../../include/net-snmp/agent/auto_nlist.h util_funcs.h
+./mibII/icmp.lo: struct.h ./mibII/icmp.h ./mibII/sysORTable.h
+./mibII/interfaces.lo: ../../include/net-snmp/net-snmp-config.h
+./mibII/interfaces.lo: ../../include/net-snmp/system/linux.h
+./mibII/interfaces.lo: ../../include/net-snmp/system/sysv.h
+./mibII/interfaces.lo: ../../include/net-snmp/system/generic.h
+./mibII/interfaces.lo: ../../include/net-snmp/machine/generic.h
+./mibII/interfaces.lo: ./../kernel.h 
+./mibII/interfaces.lo: ../../include/net-snmp/net-snmp-includes.h
+./mibII/interfaces.lo: ../../include/net-snmp/definitions.h
+./mibII/interfaces.lo: ../../include/net-snmp/types.h
+./mibII/interfaces.lo: ../../include/net-snmp/library/snmp_api.h
+./mibII/interfaces.lo: ../../include/net-snmp/library/asn1.h
+./mibII/interfaces.lo: ../../include/net-snmp/library/snmp_impl.h
+./mibII/interfaces.lo: ../../include/net-snmp/library/snmp.h
+./mibII/interfaces.lo: ../../include/net-snmp/library/snmp-tc.h
+./mibII/interfaces.lo: ../../include/net-snmp/utilities.h
+./mibII/interfaces.lo: ../../include/net-snmp/library/snmp_client.h
+./mibII/interfaces.lo: ../../include/net-snmp/library/getopt.h
+./mibII/interfaces.lo: ../../include/net-snmp/library/system.h
+./mibII/interfaces.lo: ../../include/net-snmp/library/tools.h
+./mibII/interfaces.lo: ../../include/net-snmp/library/int64.h
+./mibII/interfaces.lo: ../../include/net-snmp/library/mt_support.h
+./mibII/interfaces.lo: ../../include/net-snmp/library/snmp_alarm.h
+./mibII/interfaces.lo: ../../include/net-snmp/library/data_list.h
+./mibII/interfaces.lo: ../../include/net-snmp/library/callback.h
+./mibII/interfaces.lo: ../../include/net-snmp/library/oid_stash.h
+./mibII/interfaces.lo: ../../include/net-snmp/library/check_varbind.h
+./mibII/interfaces.lo: ../../include/net-snmp/version.h
+./mibII/interfaces.lo: ../../include/net-snmp/session_api.h
+./mibII/interfaces.lo: ../../include/net-snmp/library/snmp_transport.h
+./mibII/interfaces.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./mibII/interfaces.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./mibII/interfaces.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./mibII/interfaces.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./mibII/interfaces.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./mibII/interfaces.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./mibII/interfaces.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./mibII/interfaces.lo: ../../include/net-snmp/library/ucd_compat.h
+./mibII/interfaces.lo: ../../include/net-snmp/pdu_api.h
+./mibII/interfaces.lo: ../../include/net-snmp/mib_api.h
+./mibII/interfaces.lo: ../../include/net-snmp/library/mib.h
+./mibII/interfaces.lo: ../../include/net-snmp/library/parse.h
+./mibII/interfaces.lo: ../../include/net-snmp/varbind_api.h
+./mibII/interfaces.lo: ../../include/net-snmp/config_api.h
+./mibII/interfaces.lo: ../../include/net-snmp/library/read_config.h
+./mibII/interfaces.lo: ../../include/net-snmp/library/default_store.h
+./mibII/interfaces.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./mibII/interfaces.lo: ../../include/net-snmp/library/snmp_enum.h
+./mibII/interfaces.lo: ../../include/net-snmp/library/vacm.h
+./mibII/interfaces.lo: ../../include/net-snmp/output_api.h
+./mibII/interfaces.lo: ../../include/net-snmp/library/snmp_debug.h
+./mibII/interfaces.lo: ../../include/net-snmp/library/snmp_logging.h
+./mibII/interfaces.lo: ../../include/net-snmp/snmpv3_api.h
+./mibII/interfaces.lo: ../../include/net-snmp/library/snmpv3.h
+./mibII/interfaces.lo: ../../include/net-snmp/library/transform_oids.h
+./mibII/interfaces.lo: ../../include/net-snmp/library/keytools.h
+./mibII/interfaces.lo: ../../include/net-snmp/library/scapi.h
+./mibII/interfaces.lo: ../../include/net-snmp/library/lcd_time.h
+./mibII/interfaces.lo: ../../include/net-snmp/library/snmp_secmod.h
+./mibII/interfaces.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./mibII/interfaces.lo: ../../include/net-snmp/library/snmpusm.h
+./mibII/interfaces.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./mibII/interfaces.lo: ../../include/net-snmp/agent/snmp_agent.h
+./mibII/interfaces.lo: ../../include/net-snmp/agent/snmp_vars.h
+./mibII/interfaces.lo: ../../include/net-snmp/agent/agent_handler.h
+./mibII/interfaces.lo: ../../include/net-snmp/agent/var_struct.h
+./mibII/interfaces.lo: ../../include/net-snmp/agent/agent_registry.h
+./mibII/interfaces.lo: ../../include/net-snmp/agent/ds_agent.h
+./mibII/interfaces.lo: ../../include/net-snmp/agent/agent_read_config.h
+./mibII/interfaces.lo: ../../include/net-snmp/agent/agent_trap.h
+./mibII/interfaces.lo: ../../include/net-snmp/agent/all_helpers.h
+./mibII/interfaces.lo: ../../include/net-snmp/agent/instance.h
+./mibII/interfaces.lo: ../../include/net-snmp/agent/multiplexer.h
+./mibII/interfaces.lo: ../../include/net-snmp/agent/null.h
+./mibII/interfaces.lo: ../../include/net-snmp/agent/debug_handler.h
+./mibII/interfaces.lo: ../../include/net-snmp/agent/old_api.h
+./mibII/interfaces.lo: ../../include/net-snmp/agent/read_only.h
+./mibII/interfaces.lo: ../../include/net-snmp/agent/serialize.h
+./mibII/interfaces.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./mibII/interfaces.lo: ../../include/net-snmp/agent/mode_end_call.h
+./mibII/interfaces.lo: ../../include/net-snmp/agent/table.h
+./mibII/interfaces.lo: ../../include/net-snmp/agent/table_data.h
+./mibII/interfaces.lo: ../../include/net-snmp/agent/table_dataset.h
+./mibII/interfaces.lo: ../../include/net-snmp/agent/table_iterator.h
+./mibII/interfaces.lo: ../../include/net-snmp/agent/mib_module_config.h
+./mibII/interfaces.lo: ../../include/net-snmp/agent/auto_nlist.h
+./mibII/interfaces.lo: ./mibII/interfaces.h struct.h util_funcs.h
+./mibII/interfaces.lo: ./mibII/sysORTable.h
+./mibII/ipAddr.lo: ../../include/net-snmp/net-snmp-config.h
+./mibII/ipAddr.lo: ../../include/net-snmp/system/linux.h
+./mibII/ipAddr.lo: ../../include/net-snmp/system/sysv.h
+./mibII/ipAddr.lo: ../../include/net-snmp/system/generic.h
+./mibII/ipAddr.lo: ../../include/net-snmp/machine/generic.h
+./mibII/ipAddr.lo:  ./../kernel.h
+./mibII/ipAddr.lo: ../../include/net-snmp/net-snmp-includes.h
+./mibII/ipAddr.lo: ../../include/net-snmp/definitions.h
+./mibII/ipAddr.lo: ../../include/net-snmp/types.h
+./mibII/ipAddr.lo: ../../include/net-snmp/library/snmp_api.h
+./mibII/ipAddr.lo: ../../include/net-snmp/library/asn1.h
+./mibII/ipAddr.lo: ../../include/net-snmp/library/snmp_impl.h
+./mibII/ipAddr.lo: ../../include/net-snmp/library/snmp.h
+./mibII/ipAddr.lo: ../../include/net-snmp/library/snmp-tc.h
+./mibII/ipAddr.lo: ../../include/net-snmp/utilities.h
+./mibII/ipAddr.lo: ../../include/net-snmp/library/snmp_client.h
+./mibII/ipAddr.lo: ../../include/net-snmp/library/getopt.h
+./mibII/ipAddr.lo: ../../include/net-snmp/library/system.h
+./mibII/ipAddr.lo: ../../include/net-snmp/library/tools.h
+./mibII/ipAddr.lo: ../../include/net-snmp/library/int64.h
+./mibII/ipAddr.lo: ../../include/net-snmp/library/mt_support.h
+./mibII/ipAddr.lo: ../../include/net-snmp/library/snmp_alarm.h
+./mibII/ipAddr.lo: ../../include/net-snmp/library/data_list.h
+./mibII/ipAddr.lo: ../../include/net-snmp/library/callback.h
+./mibII/ipAddr.lo: ../../include/net-snmp/library/oid_stash.h
+./mibII/ipAddr.lo: ../../include/net-snmp/library/check_varbind.h
+./mibII/ipAddr.lo: ../../include/net-snmp/version.h
+./mibII/ipAddr.lo: ../../include/net-snmp/session_api.h
+./mibII/ipAddr.lo: ../../include/net-snmp/library/snmp_transport.h
+./mibII/ipAddr.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./mibII/ipAddr.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./mibII/ipAddr.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./mibII/ipAddr.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./mibII/ipAddr.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./mibII/ipAddr.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./mibII/ipAddr.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./mibII/ipAddr.lo: ../../include/net-snmp/library/ucd_compat.h
+./mibII/ipAddr.lo: ../../include/net-snmp/pdu_api.h
+./mibII/ipAddr.lo: ../../include/net-snmp/mib_api.h
+./mibII/ipAddr.lo: ../../include/net-snmp/library/mib.h
+./mibII/ipAddr.lo: ../../include/net-snmp/library/parse.h
+./mibII/ipAddr.lo: ../../include/net-snmp/varbind_api.h
+./mibII/ipAddr.lo: ../../include/net-snmp/config_api.h
+./mibII/ipAddr.lo: ../../include/net-snmp/library/read_config.h
+./mibII/ipAddr.lo: ../../include/net-snmp/library/default_store.h
+./mibII/ipAddr.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./mibII/ipAddr.lo: ../../include/net-snmp/library/snmp_enum.h
+./mibII/ipAddr.lo: ../../include/net-snmp/library/vacm.h
+./mibII/ipAddr.lo: ../../include/net-snmp/output_api.h
+./mibII/ipAddr.lo: ../../include/net-snmp/library/snmp_debug.h
+./mibII/ipAddr.lo: ../../include/net-snmp/library/snmp_logging.h
+./mibII/ipAddr.lo: ../../include/net-snmp/snmpv3_api.h
+./mibII/ipAddr.lo: ../../include/net-snmp/library/snmpv3.h
+./mibII/ipAddr.lo: ../../include/net-snmp/library/transform_oids.h
+./mibII/ipAddr.lo: ../../include/net-snmp/library/keytools.h
+./mibII/ipAddr.lo: ../../include/net-snmp/library/scapi.h
+./mibII/ipAddr.lo: ../../include/net-snmp/library/lcd_time.h
+./mibII/ipAddr.lo: ../../include/net-snmp/library/snmp_secmod.h
+./mibII/ipAddr.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./mibII/ipAddr.lo: ../../include/net-snmp/library/snmpusm.h
+./mibII/ipAddr.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./mibII/ipAddr.lo: ../../include/net-snmp/agent/snmp_agent.h
+./mibII/ipAddr.lo: ../../include/net-snmp/agent/snmp_vars.h
+./mibII/ipAddr.lo: ../../include/net-snmp/agent/agent_handler.h
+./mibII/ipAddr.lo: ../../include/net-snmp/agent/var_struct.h
+./mibII/ipAddr.lo: ../../include/net-snmp/agent/agent_registry.h
+./mibII/ipAddr.lo: ../../include/net-snmp/agent/ds_agent.h
+./mibII/ipAddr.lo: ../../include/net-snmp/agent/agent_read_config.h
+./mibII/ipAddr.lo: ../../include/net-snmp/agent/agent_trap.h
+./mibII/ipAddr.lo: ../../include/net-snmp/agent/all_helpers.h
+./mibII/ipAddr.lo: ../../include/net-snmp/agent/instance.h
+./mibII/ipAddr.lo: ../../include/net-snmp/agent/multiplexer.h
+./mibII/ipAddr.lo: ../../include/net-snmp/agent/null.h
+./mibII/ipAddr.lo: ../../include/net-snmp/agent/debug_handler.h
+./mibII/ipAddr.lo: ../../include/net-snmp/agent/old_api.h
+./mibII/ipAddr.lo: ../../include/net-snmp/agent/read_only.h
+./mibII/ipAddr.lo: ../../include/net-snmp/agent/serialize.h
+./mibII/ipAddr.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./mibII/ipAddr.lo: ../../include/net-snmp/agent/mode_end_call.h
+./mibII/ipAddr.lo: ../../include/net-snmp/agent/table.h
+./mibII/ipAddr.lo: ../../include/net-snmp/agent/table_data.h
+./mibII/ipAddr.lo: ../../include/net-snmp/agent/table_dataset.h
+./mibII/ipAddr.lo: ../../include/net-snmp/agent/table_iterator.h
+./mibII/ipAddr.lo: ../../include/net-snmp/agent/mib_module_config.h
+./mibII/ipAddr.lo: ../../include/net-snmp/agent/auto_nlist.h ./mibII/ip.h
+./mibII/ipAddr.lo: ./mibII/var_route.h ./mibII/route_write.h ./mibII/at.h
+./mibII/ipAddr.lo: ./mibII/interfaces.h ./mibII/sysORTable.h
+./mibII/ip.lo: ../../include/net-snmp/net-snmp-config.h
+./mibII/ip.lo: ../../include/net-snmp/system/linux.h
+./mibII/ip.lo: ../../include/net-snmp/system/sysv.h
+./mibII/ip.lo: ../../include/net-snmp/system/generic.h
+./mibII/ip.lo: ../../include/net-snmp/machine/generic.h
+./mibII/ip.lo: ../../include/net-snmp/net-snmp-includes.h
+./mibII/ip.lo:  ../../include/net-snmp/definitions.h
+./mibII/ip.lo: ../../include/net-snmp/types.h
+./mibII/ip.lo: ../../include/net-snmp/library/snmp_api.h
+./mibII/ip.lo: ../../include/net-snmp/library/asn1.h
+./mibII/ip.lo: ../../include/net-snmp/library/snmp_impl.h
+./mibII/ip.lo: ../../include/net-snmp/library/snmp.h
+./mibII/ip.lo: ../../include/net-snmp/library/snmp-tc.h
+./mibII/ip.lo: ../../include/net-snmp/utilities.h
+./mibII/ip.lo: ../../include/net-snmp/library/snmp_client.h
+./mibII/ip.lo: ../../include/net-snmp/library/getopt.h
+./mibII/ip.lo: ../../include/net-snmp/library/system.h
+./mibII/ip.lo: ../../include/net-snmp/library/tools.h
+./mibII/ip.lo: ../../include/net-snmp/library/int64.h
+./mibII/ip.lo: ../../include/net-snmp/library/mt_support.h
+./mibII/ip.lo: ../../include/net-snmp/library/snmp_alarm.h
+./mibII/ip.lo: ../../include/net-snmp/library/data_list.h
+./mibII/ip.lo: ../../include/net-snmp/library/callback.h
+./mibII/ip.lo: ../../include/net-snmp/library/oid_stash.h
+./mibII/ip.lo: ../../include/net-snmp/library/check_varbind.h
+./mibII/ip.lo: ../../include/net-snmp/version.h
+./mibII/ip.lo: ../../include/net-snmp/session_api.h
+./mibII/ip.lo: ../../include/net-snmp/library/snmp_transport.h
+./mibII/ip.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./mibII/ip.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./mibII/ip.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./mibII/ip.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./mibII/ip.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./mibII/ip.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./mibII/ip.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./mibII/ip.lo: ../../include/net-snmp/library/ucd_compat.h
+./mibII/ip.lo: ../../include/net-snmp/pdu_api.h
+./mibII/ip.lo: ../../include/net-snmp/mib_api.h
+./mibII/ip.lo: ../../include/net-snmp/library/mib.h
+./mibII/ip.lo: ../../include/net-snmp/library/parse.h
+./mibII/ip.lo: ../../include/net-snmp/varbind_api.h
+./mibII/ip.lo: ../../include/net-snmp/config_api.h
+./mibII/ip.lo: ../../include/net-snmp/library/read_config.h
+./mibII/ip.lo: ../../include/net-snmp/library/default_store.h
+./mibII/ip.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./mibII/ip.lo: ../../include/net-snmp/library/snmp_enum.h
+./mibII/ip.lo: ../../include/net-snmp/library/vacm.h
+./mibII/ip.lo: ../../include/net-snmp/output_api.h
+./mibII/ip.lo: ../../include/net-snmp/library/snmp_debug.h
+./mibII/ip.lo: ../../include/net-snmp/library/snmp_logging.h
+./mibII/ip.lo: ../../include/net-snmp/snmpv3_api.h
+./mibII/ip.lo: ../../include/net-snmp/library/snmpv3.h
+./mibII/ip.lo: ../../include/net-snmp/library/transform_oids.h
+./mibII/ip.lo: ../../include/net-snmp/library/keytools.h
+./mibII/ip.lo: ../../include/net-snmp/library/scapi.h
+./mibII/ip.lo: ../../include/net-snmp/library/lcd_time.h
+./mibII/ip.lo: ../../include/net-snmp/library/snmp_secmod.h
+./mibII/ip.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./mibII/ip.lo: ../../include/net-snmp/library/snmpusm.h
+./mibII/ip.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./mibII/ip.lo: ../../include/net-snmp/agent/snmp_agent.h
+./mibII/ip.lo: ../../include/net-snmp/agent/snmp_vars.h
+./mibII/ip.lo: ../../include/net-snmp/agent/agent_handler.h
+./mibII/ip.lo: ../../include/net-snmp/agent/var_struct.h
+./mibII/ip.lo: ../../include/net-snmp/agent/agent_registry.h
+./mibII/ip.lo: ../../include/net-snmp/agent/ds_agent.h
+./mibII/ip.lo: ../../include/net-snmp/agent/agent_read_config.h
+./mibII/ip.lo: ../../include/net-snmp/agent/agent_trap.h
+./mibII/ip.lo: ../../include/net-snmp/agent/all_helpers.h
+./mibII/ip.lo: ../../include/net-snmp/agent/instance.h
+./mibII/ip.lo: ../../include/net-snmp/agent/multiplexer.h
+./mibII/ip.lo: ../../include/net-snmp/agent/null.h
+./mibII/ip.lo: ../../include/net-snmp/agent/debug_handler.h
+./mibII/ip.lo: ../../include/net-snmp/agent/old_api.h
+./mibII/ip.lo: ../../include/net-snmp/agent/read_only.h
+./mibII/ip.lo: ../../include/net-snmp/agent/serialize.h
+./mibII/ip.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./mibII/ip.lo: ../../include/net-snmp/agent/mode_end_call.h
+./mibII/ip.lo: ../../include/net-snmp/agent/table.h
+./mibII/ip.lo: ../../include/net-snmp/agent/table_data.h
+./mibII/ip.lo: ../../include/net-snmp/agent/table_dataset.h
+./mibII/ip.lo: ../../include/net-snmp/agent/table_iterator.h
+./mibII/ip.lo: ../../include/net-snmp/agent/mib_module_config.h
+./mibII/ip.lo: ../../include/net-snmp/agent/auto_nlist.h ./../kernel.h
+./mibII/ip.lo: util_funcs.h struct.h ./mibII/ip.h ./mibII/var_route.h
+./mibII/ip.lo: ./mibII/route_write.h ./mibII/at.h ./mibII/ipAddr.h
+./mibII/ip.lo: ./mibII/interfaces.h ./mibII/sysORTable.h
+./mibII/ipv6.lo: ../../include/net-snmp/net-snmp-config.h
+./mibII/ipv6.lo: ../../include/net-snmp/system/linux.h
+./mibII/ipv6.lo: ../../include/net-snmp/system/sysv.h
+./mibII/ipv6.lo: ../../include/net-snmp/system/generic.h
+./mibII/ipv6.lo: ../../include/net-snmp/machine/generic.h
+./mibII/ipv6.lo: ../../include/net-snmp/net-snmp-includes.h
+./mibII/ipv6.lo:  ../../include/net-snmp/definitions.h
+./mibII/ipv6.lo: ../../include/net-snmp/types.h
+./mibII/ipv6.lo: ../../include/net-snmp/library/snmp_api.h
+./mibII/ipv6.lo: ../../include/net-snmp/library/asn1.h
+./mibII/ipv6.lo: ../../include/net-snmp/library/snmp_impl.h
+./mibII/ipv6.lo: ../../include/net-snmp/library/snmp.h
+./mibII/ipv6.lo: ../../include/net-snmp/library/snmp-tc.h
+./mibII/ipv6.lo: ../../include/net-snmp/utilities.h
+./mibII/ipv6.lo: ../../include/net-snmp/library/snmp_client.h
+./mibII/ipv6.lo: ../../include/net-snmp/library/getopt.h
+./mibII/ipv6.lo: ../../include/net-snmp/library/system.h
+./mibII/ipv6.lo: ../../include/net-snmp/library/tools.h
+./mibII/ipv6.lo: ../../include/net-snmp/library/int64.h
+./mibII/ipv6.lo: ../../include/net-snmp/library/mt_support.h
+./mibII/ipv6.lo: ../../include/net-snmp/library/snmp_alarm.h
+./mibII/ipv6.lo: ../../include/net-snmp/library/data_list.h
+./mibII/ipv6.lo: ../../include/net-snmp/library/callback.h
+./mibII/ipv6.lo: ../../include/net-snmp/library/oid_stash.h
+./mibII/ipv6.lo: ../../include/net-snmp/library/check_varbind.h
+./mibII/ipv6.lo: ../../include/net-snmp/version.h
+./mibII/ipv6.lo: ../../include/net-snmp/session_api.h
+./mibII/ipv6.lo: ../../include/net-snmp/library/snmp_transport.h
+./mibII/ipv6.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./mibII/ipv6.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./mibII/ipv6.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./mibII/ipv6.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./mibII/ipv6.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./mibII/ipv6.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./mibII/ipv6.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./mibII/ipv6.lo: ../../include/net-snmp/library/ucd_compat.h
+./mibII/ipv6.lo: ../../include/net-snmp/pdu_api.h
+./mibII/ipv6.lo: ../../include/net-snmp/mib_api.h
+./mibII/ipv6.lo: ../../include/net-snmp/library/mib.h
+./mibII/ipv6.lo: ../../include/net-snmp/library/parse.h
+./mibII/ipv6.lo: ../../include/net-snmp/varbind_api.h
+./mibII/ipv6.lo: ../../include/net-snmp/config_api.h
+./mibII/ipv6.lo: ../../include/net-snmp/library/read_config.h
+./mibII/ipv6.lo: ../../include/net-snmp/library/default_store.h
+./mibII/ipv6.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./mibII/ipv6.lo: ../../include/net-snmp/library/snmp_enum.h
+./mibII/ipv6.lo: ../../include/net-snmp/library/vacm.h
+./mibII/ipv6.lo: ../../include/net-snmp/output_api.h
+./mibII/ipv6.lo: ../../include/net-snmp/library/snmp_debug.h
+./mibII/ipv6.lo: ../../include/net-snmp/library/snmp_logging.h
+./mibII/ipv6.lo: ../../include/net-snmp/snmpv3_api.h
+./mibII/ipv6.lo: ../../include/net-snmp/library/snmpv3.h
+./mibII/ipv6.lo: ../../include/net-snmp/library/transform_oids.h
+./mibII/ipv6.lo: ../../include/net-snmp/library/keytools.h
+./mibII/ipv6.lo: ../../include/net-snmp/library/scapi.h
+./mibII/ipv6.lo: ../../include/net-snmp/library/lcd_time.h
+./mibII/ipv6.lo: ../../include/net-snmp/library/snmp_secmod.h
+./mibII/ipv6.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./mibII/ipv6.lo: ../../include/net-snmp/library/snmpusm.h
+./mibII/ipv6.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./mibII/ipv6.lo: ../../include/net-snmp/agent/snmp_agent.h
+./mibII/ipv6.lo: ../../include/net-snmp/agent/snmp_vars.h
+./mibII/ipv6.lo: ../../include/net-snmp/agent/agent_handler.h
+./mibII/ipv6.lo: ../../include/net-snmp/agent/var_struct.h
+./mibII/ipv6.lo: ../../include/net-snmp/agent/agent_registry.h
+./mibII/ipv6.lo: ../../include/net-snmp/agent/ds_agent.h
+./mibII/ipv6.lo: ../../include/net-snmp/agent/agent_read_config.h
+./mibII/ipv6.lo: ../../include/net-snmp/agent/agent_trap.h
+./mibII/ipv6.lo: ../../include/net-snmp/agent/all_helpers.h
+./mibII/ipv6.lo: ../../include/net-snmp/agent/instance.h
+./mibII/ipv6.lo: ../../include/net-snmp/agent/multiplexer.h
+./mibII/ipv6.lo: ../../include/net-snmp/agent/null.h
+./mibII/ipv6.lo: ../../include/net-snmp/agent/debug_handler.h
+./mibII/ipv6.lo: ../../include/net-snmp/agent/old_api.h
+./mibII/ipv6.lo: ../../include/net-snmp/agent/read_only.h
+./mibII/ipv6.lo: ../../include/net-snmp/agent/serialize.h
+./mibII/ipv6.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./mibII/ipv6.lo: ../../include/net-snmp/agent/mode_end_call.h
+./mibII/ipv6.lo: ../../include/net-snmp/agent/table.h
+./mibII/ipv6.lo: ../../include/net-snmp/agent/table_data.h
+./mibII/ipv6.lo: ../../include/net-snmp/agent/table_dataset.h
+./mibII/ipv6.lo: ../../include/net-snmp/agent/table_iterator.h
+./mibII/ipv6.lo: ../../include/net-snmp/agent/mib_module_config.h
+./mibII/ipv6.lo: ../../include/net-snmp/agent/auto_nlist.h ./../kernel.h
+./mibII/ipv6.lo: util_funcs.h struct.h ./mibII/ipv6.h ./mibII/var_route.h
+./mibII/ipv6.lo: ./mibII/route_write.h ./mibII/at.h ./mibII/interfaces.h
+./mibII/kernel_linux.lo: ../../include/net-snmp/net-snmp-config.h
+./mibII/kernel_linux.lo: ../../include/net-snmp/system/linux.h
+./mibII/kernel_linux.lo: ../../include/net-snmp/system/sysv.h
+./mibII/kernel_linux.lo: ../../include/net-snmp/system/generic.h
+./mibII/kernel_linux.lo: ../../include/net-snmp/machine/generic.h
+./mibII/kernel_linux.lo: ../../include/net-snmp/net-snmp-includes.h
+./mibII/kernel_linux.lo: ../../include/net-snmp/definitions.h
+./mibII/kernel_linux.lo: ../../include/net-snmp/types.h
+./mibII/kernel_linux.lo: ../../include/net-snmp/library/snmp_api.h
+./mibII/kernel_linux.lo: ../../include/net-snmp/library/asn1.h
+./mibII/kernel_linux.lo: ../../include/net-snmp/library/snmp_impl.h
+./mibII/kernel_linux.lo: ../../include/net-snmp/library/snmp.h
+./mibII/kernel_linux.lo: ../../include/net-snmp/library/snmp-tc.h
+./mibII/kernel_linux.lo: ../../include/net-snmp/utilities.h
+./mibII/kernel_linux.lo: ../../include/net-snmp/library/snmp_client.h
+./mibII/kernel_linux.lo: ../../include/net-snmp/library/getopt.h
+./mibII/kernel_linux.lo: ../../include/net-snmp/library/system.h
+./mibII/kernel_linux.lo: ../../include/net-snmp/library/tools.h
+./mibII/kernel_linux.lo: ../../include/net-snmp/library/int64.h
+./mibII/kernel_linux.lo: ../../include/net-snmp/library/mt_support.h
+./mibII/kernel_linux.lo: ../../include/net-snmp/library/snmp_alarm.h
+./mibII/kernel_linux.lo: ../../include/net-snmp/library/data_list.h
+./mibII/kernel_linux.lo: ../../include/net-snmp/library/callback.h
+./mibII/kernel_linux.lo: ../../include/net-snmp/library/oid_stash.h
+./mibII/kernel_linux.lo: ../../include/net-snmp/library/check_varbind.h
+./mibII/kernel_linux.lo: ../../include/net-snmp/version.h
+./mibII/kernel_linux.lo: ../../include/net-snmp/session_api.h
+./mibII/kernel_linux.lo: ../../include/net-snmp/library/snmp_transport.h
+./mibII/kernel_linux.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./mibII/kernel_linux.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./mibII/kernel_linux.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./mibII/kernel_linux.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./mibII/kernel_linux.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./mibII/kernel_linux.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./mibII/kernel_linux.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./mibII/kernel_linux.lo: ../../include/net-snmp/library/ucd_compat.h
+./mibII/kernel_linux.lo: ../../include/net-snmp/pdu_api.h
+./mibII/kernel_linux.lo: ../../include/net-snmp/mib_api.h
+./mibII/kernel_linux.lo: ../../include/net-snmp/library/mib.h
+./mibII/kernel_linux.lo: ../../include/net-snmp/library/parse.h
+./mibII/kernel_linux.lo: ../../include/net-snmp/varbind_api.h
+./mibII/kernel_linux.lo: ../../include/net-snmp/config_api.h
+./mibII/kernel_linux.lo: ../../include/net-snmp/library/read_config.h
+./mibII/kernel_linux.lo: ../../include/net-snmp/library/default_store.h
+./mibII/kernel_linux.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./mibII/kernel_linux.lo: ../../include/net-snmp/library/snmp_enum.h
+./mibII/kernel_linux.lo: ../../include/net-snmp/library/vacm.h
+./mibII/kernel_linux.lo: ../../include/net-snmp/output_api.h
+./mibII/kernel_linux.lo: ../../include/net-snmp/library/snmp_debug.h
+./mibII/kernel_linux.lo: ../../include/net-snmp/library/snmp_logging.h
+./mibII/kernel_linux.lo: ../../include/net-snmp/snmpv3_api.h
+./mibII/kernel_linux.lo: ../../include/net-snmp/library/snmpv3.h
+./mibII/kernel_linux.lo: ../../include/net-snmp/library/transform_oids.h
+./mibII/kernel_linux.lo: ../../include/net-snmp/library/keytools.h
+./mibII/kernel_linux.lo: ../../include/net-snmp/library/scapi.h
+./mibII/kernel_linux.lo: ../../include/net-snmp/library/lcd_time.h
+./mibII/kernel_linux.lo: ../../include/net-snmp/library/snmp_secmod.h
+./mibII/kernel_linux.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./mibII/kernel_linux.lo: ../../include/net-snmp/library/snmpusm.h
+./mibII/kernel_linux.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./mibII/kernel_linux.lo: ../../include/net-snmp/agent/snmp_agent.h
+./mibII/kernel_linux.lo: ../../include/net-snmp/agent/snmp_vars.h
+./mibII/kernel_linux.lo: ../../include/net-snmp/agent/agent_handler.h
+./mibII/kernel_linux.lo: ../../include/net-snmp/agent/var_struct.h
+./mibII/kernel_linux.lo: ../../include/net-snmp/agent/agent_registry.h
+./mibII/kernel_linux.lo: ../../include/net-snmp/agent/ds_agent.h
+./mibII/kernel_linux.lo: ../../include/net-snmp/agent/agent_read_config.h
+./mibII/kernel_linux.lo: ../../include/net-snmp/agent/agent_trap.h
+./mibII/kernel_linux.lo: ../../include/net-snmp/agent/all_helpers.h
+./mibII/kernel_linux.lo: ../../include/net-snmp/agent/instance.h
+./mibII/kernel_linux.lo: ../../include/net-snmp/agent/multiplexer.h
+./mibII/kernel_linux.lo: ../../include/net-snmp/agent/null.h
+./mibII/kernel_linux.lo: ../../include/net-snmp/agent/debug_handler.h
+./mibII/kernel_linux.lo: ../../include/net-snmp/agent/old_api.h
+./mibII/kernel_linux.lo: ../../include/net-snmp/agent/read_only.h
+./mibII/kernel_linux.lo: ../../include/net-snmp/agent/serialize.h
+./mibII/kernel_linux.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./mibII/kernel_linux.lo: ../../include/net-snmp/agent/mode_end_call.h
+./mibII/kernel_linux.lo: ../../include/net-snmp/agent/table.h
+./mibII/kernel_linux.lo: ../../include/net-snmp/agent/table_data.h
+./mibII/kernel_linux.lo: ../../include/net-snmp/agent/table_dataset.h
+./mibII/kernel_linux.lo: ../../include/net-snmp/agent/table_iterator.h
+./mibII/kernel_linux.lo: ../../include/net-snmp/agent/mib_module_config.h
+./mibII/kernel_linux.lo: util_funcs.h struct.h 
+./mibII/kernel_linux.lo: ./mibII/kernel_linux.h
+./mibII/mta_sendmail.lo: ../../include/net-snmp/net-snmp-config.h
+./mibII/mta_sendmail.lo: ../../include/net-snmp/system/linux.h
+./mibII/mta_sendmail.lo: ../../include/net-snmp/system/sysv.h
+./mibII/mta_sendmail.lo: ../../include/net-snmp/system/generic.h
+./mibII/mta_sendmail.lo: ../../include/net-snmp/machine/generic.h
+./mibII/mta_sendmail.lo: ../../include/net-snmp/net-snmp-includes.h
+./mibII/mta_sendmail.lo: ../../include/net-snmp/definitions.h
+./mibII/mta_sendmail.lo: ../../include/net-snmp/types.h
+./mibII/mta_sendmail.lo: ../../include/net-snmp/library/snmp_api.h
+./mibII/mta_sendmail.lo: ../../include/net-snmp/library/asn1.h
+./mibII/mta_sendmail.lo: ../../include/net-snmp/library/snmp_impl.h
+./mibII/mta_sendmail.lo: ../../include/net-snmp/library/snmp.h
+./mibII/mta_sendmail.lo: ../../include/net-snmp/library/snmp-tc.h
+./mibII/mta_sendmail.lo: ../../include/net-snmp/utilities.h
+./mibII/mta_sendmail.lo: ../../include/net-snmp/library/snmp_client.h
+./mibII/mta_sendmail.lo: ../../include/net-snmp/library/getopt.h
+./mibII/mta_sendmail.lo: ../../include/net-snmp/library/system.h
+./mibII/mta_sendmail.lo: ../../include/net-snmp/library/tools.h
+./mibII/mta_sendmail.lo: ../../include/net-snmp/library/int64.h
+./mibII/mta_sendmail.lo: ../../include/net-snmp/library/mt_support.h
+./mibII/mta_sendmail.lo: ../../include/net-snmp/library/snmp_alarm.h
+./mibII/mta_sendmail.lo: ../../include/net-snmp/library/data_list.h
+./mibII/mta_sendmail.lo: ../../include/net-snmp/library/callback.h
+./mibII/mta_sendmail.lo: ../../include/net-snmp/library/oid_stash.h
+./mibII/mta_sendmail.lo: ../../include/net-snmp/library/check_varbind.h
+./mibII/mta_sendmail.lo: ../../include/net-snmp/version.h
+./mibII/mta_sendmail.lo: ../../include/net-snmp/session_api.h
+./mibII/mta_sendmail.lo: ../../include/net-snmp/library/snmp_transport.h
+./mibII/mta_sendmail.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./mibII/mta_sendmail.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./mibII/mta_sendmail.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./mibII/mta_sendmail.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./mibII/mta_sendmail.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./mibII/mta_sendmail.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./mibII/mta_sendmail.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./mibII/mta_sendmail.lo: ../../include/net-snmp/library/ucd_compat.h
+./mibII/mta_sendmail.lo: ../../include/net-snmp/pdu_api.h
+./mibII/mta_sendmail.lo: ../../include/net-snmp/mib_api.h
+./mibII/mta_sendmail.lo: ../../include/net-snmp/library/mib.h
+./mibII/mta_sendmail.lo: ../../include/net-snmp/library/parse.h
+./mibII/mta_sendmail.lo: ../../include/net-snmp/varbind_api.h
+./mibII/mta_sendmail.lo: ../../include/net-snmp/config_api.h
+./mibII/mta_sendmail.lo: ../../include/net-snmp/library/read_config.h
+./mibII/mta_sendmail.lo: ../../include/net-snmp/library/default_store.h
+./mibII/mta_sendmail.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./mibII/mta_sendmail.lo: ../../include/net-snmp/library/snmp_enum.h
+./mibII/mta_sendmail.lo: ../../include/net-snmp/library/vacm.h
+./mibII/mta_sendmail.lo: ../../include/net-snmp/output_api.h
+./mibII/mta_sendmail.lo: ../../include/net-snmp/library/snmp_debug.h
+./mibII/mta_sendmail.lo: ../../include/net-snmp/library/snmp_logging.h
+./mibII/mta_sendmail.lo: ../../include/net-snmp/snmpv3_api.h
+./mibII/mta_sendmail.lo: ../../include/net-snmp/library/snmpv3.h
+./mibII/mta_sendmail.lo: ../../include/net-snmp/library/transform_oids.h
+./mibII/mta_sendmail.lo: ../../include/net-snmp/library/keytools.h
+./mibII/mta_sendmail.lo: ../../include/net-snmp/library/scapi.h
+./mibII/mta_sendmail.lo: ../../include/net-snmp/library/lcd_time.h
+./mibII/mta_sendmail.lo: ../../include/net-snmp/library/snmp_secmod.h
+./mibII/mta_sendmail.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./mibII/mta_sendmail.lo: ../../include/net-snmp/library/snmpusm.h
+./mibII/mta_sendmail.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./mibII/mta_sendmail.lo: ../../include/net-snmp/agent/snmp_agent.h
+./mibII/mta_sendmail.lo: ../../include/net-snmp/agent/snmp_vars.h
+./mibII/mta_sendmail.lo: ../../include/net-snmp/agent/agent_handler.h
+./mibII/mta_sendmail.lo: ../../include/net-snmp/agent/var_struct.h
+./mibII/mta_sendmail.lo: ../../include/net-snmp/agent/agent_registry.h
+./mibII/mta_sendmail.lo: ../../include/net-snmp/agent/ds_agent.h
+./mibII/mta_sendmail.lo: ../../include/net-snmp/agent/agent_read_config.h
+./mibII/mta_sendmail.lo: ../../include/net-snmp/agent/agent_trap.h
+./mibII/mta_sendmail.lo: ../../include/net-snmp/agent/all_helpers.h
+./mibII/mta_sendmail.lo: ../../include/net-snmp/agent/instance.h
+./mibII/mta_sendmail.lo: ../../include/net-snmp/agent/multiplexer.h
+./mibII/mta_sendmail.lo: ../../include/net-snmp/agent/null.h
+./mibII/mta_sendmail.lo: ../../include/net-snmp/agent/debug_handler.h
+./mibII/mta_sendmail.lo: ../../include/net-snmp/agent/old_api.h
+./mibII/mta_sendmail.lo: ../../include/net-snmp/agent/read_only.h
+./mibII/mta_sendmail.lo: ../../include/net-snmp/agent/serialize.h
+./mibII/mta_sendmail.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./mibII/mta_sendmail.lo: ../../include/net-snmp/agent/mode_end_call.h
+./mibII/mta_sendmail.lo: ../../include/net-snmp/agent/table.h
+./mibII/mta_sendmail.lo: ../../include/net-snmp/agent/table_data.h
+./mibII/mta_sendmail.lo: ../../include/net-snmp/agent/table_dataset.h
+./mibII/mta_sendmail.lo: ../../include/net-snmp/agent/table_iterator.h
+./mibII/mta_sendmail.lo: ../../include/net-snmp/agent/mib_module_config.h
+./mibII/mta_sendmail.lo: ./mibII/mta_sendmail.h 
+./mibII/route_write.lo: ../../include/net-snmp/net-snmp-config.h
+./mibII/route_write.lo: ../../include/net-snmp/system/linux.h
+./mibII/route_write.lo: ../../include/net-snmp/system/sysv.h
+./mibII/route_write.lo: ../../include/net-snmp/system/generic.h
+./mibII/route_write.lo: ../../include/net-snmp/machine/generic.h
+./mibII/route_write.lo: ../../include/net-snmp/net-snmp-includes.h
+./mibII/route_write.lo: ../../include/net-snmp/definitions.h
+./mibII/route_write.lo: ../../include/net-snmp/types.h
+./mibII/route_write.lo: ../../include/net-snmp/library/snmp_api.h
+./mibII/route_write.lo: ../../include/net-snmp/library/asn1.h
+./mibII/route_write.lo: ../../include/net-snmp/library/snmp_impl.h
+./mibII/route_write.lo: ../../include/net-snmp/library/snmp.h
+./mibII/route_write.lo: ../../include/net-snmp/library/snmp-tc.h
+./mibII/route_write.lo: ../../include/net-snmp/utilities.h
+./mibII/route_write.lo: ../../include/net-snmp/library/snmp_client.h
+./mibII/route_write.lo: ../../include/net-snmp/library/getopt.h
+./mibII/route_write.lo: ../../include/net-snmp/library/system.h
+./mibII/route_write.lo: ../../include/net-snmp/library/tools.h
+./mibII/route_write.lo: ../../include/net-snmp/library/int64.h
+./mibII/route_write.lo: ../../include/net-snmp/library/mt_support.h
+./mibII/route_write.lo: ../../include/net-snmp/library/snmp_alarm.h
+./mibII/route_write.lo: ../../include/net-snmp/library/data_list.h
+./mibII/route_write.lo: ../../include/net-snmp/library/callback.h
+./mibII/route_write.lo: ../../include/net-snmp/library/oid_stash.h
+./mibII/route_write.lo: ../../include/net-snmp/library/check_varbind.h
+./mibII/route_write.lo: ../../include/net-snmp/version.h
+./mibII/route_write.lo: ../../include/net-snmp/session_api.h
+./mibII/route_write.lo: ../../include/net-snmp/library/snmp_transport.h
+./mibII/route_write.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./mibII/route_write.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./mibII/route_write.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./mibII/route_write.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./mibII/route_write.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./mibII/route_write.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./mibII/route_write.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./mibII/route_write.lo: ../../include/net-snmp/library/ucd_compat.h
+./mibII/route_write.lo: ../../include/net-snmp/pdu_api.h
+./mibII/route_write.lo: ../../include/net-snmp/mib_api.h
+./mibII/route_write.lo: ../../include/net-snmp/library/mib.h
+./mibII/route_write.lo: ../../include/net-snmp/library/parse.h
+./mibII/route_write.lo: ../../include/net-snmp/varbind_api.h
+./mibII/route_write.lo: ../../include/net-snmp/config_api.h
+./mibII/route_write.lo: ../../include/net-snmp/library/read_config.h
+./mibII/route_write.lo: ../../include/net-snmp/library/default_store.h
+./mibII/route_write.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./mibII/route_write.lo: ../../include/net-snmp/library/snmp_enum.h
+./mibII/route_write.lo: ../../include/net-snmp/library/vacm.h
+./mibII/route_write.lo: ../../include/net-snmp/output_api.h
+./mibII/route_write.lo: ../../include/net-snmp/library/snmp_debug.h
+./mibII/route_write.lo: ../../include/net-snmp/library/snmp_logging.h
+./mibII/route_write.lo: ../../include/net-snmp/snmpv3_api.h
+./mibII/route_write.lo: ../../include/net-snmp/library/snmpv3.h
+./mibII/route_write.lo: ../../include/net-snmp/library/transform_oids.h
+./mibII/route_write.lo: ../../include/net-snmp/library/keytools.h
+./mibII/route_write.lo: ../../include/net-snmp/library/scapi.h
+./mibII/route_write.lo: ../../include/net-snmp/library/lcd_time.h
+./mibII/route_write.lo: ../../include/net-snmp/library/snmp_secmod.h
+./mibII/route_write.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./mibII/route_write.lo: ../../include/net-snmp/library/snmpusm.h
+./mibII/route_write.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./mibII/route_write.lo: ../../include/net-snmp/agent/snmp_agent.h
+./mibII/route_write.lo: ../../include/net-snmp/agent/snmp_vars.h
+./mibII/route_write.lo: ../../include/net-snmp/agent/agent_handler.h
+./mibII/route_write.lo: ../../include/net-snmp/agent/var_struct.h
+./mibII/route_write.lo: ../../include/net-snmp/agent/agent_registry.h
+./mibII/route_write.lo: ../../include/net-snmp/agent/ds_agent.h
+./mibII/route_write.lo: ../../include/net-snmp/agent/agent_read_config.h
+./mibII/route_write.lo: ../../include/net-snmp/agent/agent_trap.h
+./mibII/route_write.lo: ../../include/net-snmp/agent/all_helpers.h
+./mibII/route_write.lo: ../../include/net-snmp/agent/instance.h
+./mibII/route_write.lo: ../../include/net-snmp/agent/multiplexer.h
+./mibII/route_write.lo: ../../include/net-snmp/agent/null.h
+./mibII/route_write.lo: ../../include/net-snmp/agent/debug_handler.h
+./mibII/route_write.lo: ../../include/net-snmp/agent/old_api.h
+./mibII/route_write.lo: ../../include/net-snmp/agent/read_only.h
+./mibII/route_write.lo: ../../include/net-snmp/agent/serialize.h
+./mibII/route_write.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./mibII/route_write.lo: ../../include/net-snmp/agent/mode_end_call.h
+./mibII/route_write.lo: ../../include/net-snmp/agent/table.h
+./mibII/route_write.lo: ../../include/net-snmp/agent/table_data.h
+./mibII/route_write.lo: ../../include/net-snmp/agent/table_dataset.h
+./mibII/route_write.lo: ../../include/net-snmp/agent/table_iterator.h
+./mibII/route_write.lo: ../../include/net-snmp/agent/mib_module_config.h
+./mibII/route_write.lo: ./mibII/ip.h ./mibII/var_route.h
+./mibII/route_write.lo: ./mibII/route_write.h ./mibII/at.h
+./mibII/setSerialNo.lo: ../../include/net-snmp/net-snmp-config.h
+./mibII/setSerialNo.lo: ../../include/net-snmp/system/linux.h
+./mibII/setSerialNo.lo: ../../include/net-snmp/system/sysv.h
+./mibII/setSerialNo.lo: ../../include/net-snmp/system/generic.h
+./mibII/setSerialNo.lo: ../../include/net-snmp/machine/generic.h
+./mibII/setSerialNo.lo: ../../include/net-snmp/net-snmp-includes.h
+./mibII/setSerialNo.lo: ../../include/net-snmp/definitions.h
+./mibII/setSerialNo.lo: ../../include/net-snmp/types.h
+./mibII/setSerialNo.lo: ../../include/net-snmp/library/snmp_api.h
+./mibII/setSerialNo.lo: ../../include/net-snmp/library/asn1.h
+./mibII/setSerialNo.lo: ../../include/net-snmp/library/snmp_impl.h
+./mibII/setSerialNo.lo: ../../include/net-snmp/library/snmp.h
+./mibII/setSerialNo.lo: ../../include/net-snmp/library/snmp-tc.h
+./mibII/setSerialNo.lo: ../../include/net-snmp/utilities.h
+./mibII/setSerialNo.lo: ../../include/net-snmp/library/snmp_client.h
+./mibII/setSerialNo.lo: ../../include/net-snmp/library/getopt.h
+./mibII/setSerialNo.lo: ../../include/net-snmp/library/system.h
+./mibII/setSerialNo.lo: ../../include/net-snmp/library/tools.h
+./mibII/setSerialNo.lo: ../../include/net-snmp/library/int64.h
+./mibII/setSerialNo.lo: ../../include/net-snmp/library/mt_support.h
+./mibII/setSerialNo.lo: ../../include/net-snmp/library/snmp_alarm.h
+./mibII/setSerialNo.lo: ../../include/net-snmp/library/data_list.h
+./mibII/setSerialNo.lo: ../../include/net-snmp/library/callback.h
+./mibII/setSerialNo.lo: ../../include/net-snmp/library/oid_stash.h
+./mibII/setSerialNo.lo: ../../include/net-snmp/library/check_varbind.h
+./mibII/setSerialNo.lo: ../../include/net-snmp/version.h
+./mibII/setSerialNo.lo: ../../include/net-snmp/session_api.h
+./mibII/setSerialNo.lo: ../../include/net-snmp/library/snmp_transport.h
+./mibII/setSerialNo.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./mibII/setSerialNo.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./mibII/setSerialNo.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./mibII/setSerialNo.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./mibII/setSerialNo.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./mibII/setSerialNo.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./mibII/setSerialNo.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./mibII/setSerialNo.lo: ../../include/net-snmp/library/ucd_compat.h
+./mibII/setSerialNo.lo: ../../include/net-snmp/pdu_api.h
+./mibII/setSerialNo.lo: ../../include/net-snmp/mib_api.h
+./mibII/setSerialNo.lo: ../../include/net-snmp/library/mib.h
+./mibII/setSerialNo.lo: ../../include/net-snmp/library/parse.h
+./mibII/setSerialNo.lo: ../../include/net-snmp/varbind_api.h
+./mibII/setSerialNo.lo: ../../include/net-snmp/config_api.h
+./mibII/setSerialNo.lo: ../../include/net-snmp/library/read_config.h
+./mibII/setSerialNo.lo: ../../include/net-snmp/library/default_store.h
+./mibII/setSerialNo.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./mibII/setSerialNo.lo: ../../include/net-snmp/library/snmp_enum.h
+./mibII/setSerialNo.lo: ../../include/net-snmp/library/vacm.h
+./mibII/setSerialNo.lo: ../../include/net-snmp/output_api.h
+./mibII/setSerialNo.lo: ../../include/net-snmp/library/snmp_debug.h
+./mibII/setSerialNo.lo: ../../include/net-snmp/library/snmp_logging.h
+./mibII/setSerialNo.lo: ../../include/net-snmp/snmpv3_api.h
+./mibII/setSerialNo.lo: ../../include/net-snmp/library/snmpv3.h
+./mibII/setSerialNo.lo: ../../include/net-snmp/library/transform_oids.h
+./mibII/setSerialNo.lo: ../../include/net-snmp/library/keytools.h
+./mibII/setSerialNo.lo: ../../include/net-snmp/library/scapi.h
+./mibII/setSerialNo.lo: ../../include/net-snmp/library/lcd_time.h
+./mibII/setSerialNo.lo: ../../include/net-snmp/library/snmp_secmod.h
+./mibII/setSerialNo.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./mibII/setSerialNo.lo: ../../include/net-snmp/library/snmpusm.h
+./mibII/setSerialNo.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./mibII/setSerialNo.lo: ../../include/net-snmp/agent/snmp_agent.h
+./mibII/setSerialNo.lo: ../../include/net-snmp/agent/snmp_vars.h
+./mibII/setSerialNo.lo: ../../include/net-snmp/agent/agent_handler.h
+./mibII/setSerialNo.lo: ../../include/net-snmp/agent/var_struct.h
+./mibII/setSerialNo.lo: ../../include/net-snmp/agent/agent_registry.h
+./mibII/setSerialNo.lo: ../../include/net-snmp/agent/ds_agent.h
+./mibII/setSerialNo.lo: ../../include/net-snmp/agent/agent_read_config.h
+./mibII/setSerialNo.lo: ../../include/net-snmp/agent/agent_trap.h
+./mibII/setSerialNo.lo: ../../include/net-snmp/agent/all_helpers.h
+./mibII/setSerialNo.lo: ../../include/net-snmp/agent/instance.h
+./mibII/setSerialNo.lo: ../../include/net-snmp/agent/multiplexer.h
+./mibII/setSerialNo.lo: ../../include/net-snmp/agent/null.h
+./mibII/setSerialNo.lo: ../../include/net-snmp/agent/debug_handler.h
+./mibII/setSerialNo.lo: ../../include/net-snmp/agent/old_api.h
+./mibII/setSerialNo.lo: ../../include/net-snmp/agent/read_only.h
+./mibII/setSerialNo.lo: ../../include/net-snmp/agent/serialize.h
+./mibII/setSerialNo.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./mibII/setSerialNo.lo: ../../include/net-snmp/agent/mode_end_call.h
+./mibII/setSerialNo.lo: ../../include/net-snmp/agent/table.h
+./mibII/setSerialNo.lo: ../../include/net-snmp/agent/table_data.h
+./mibII/setSerialNo.lo: ../../include/net-snmp/agent/table_dataset.h
+./mibII/setSerialNo.lo: ../../include/net-snmp/agent/table_iterator.h
+./mibII/setSerialNo.lo: ../../include/net-snmp/agent/mib_module_config.h
+./mibII/setSerialNo.lo: ./mibII/setSerialNo.h
+./mibII/snmp_mib.lo: ../../include/net-snmp/net-snmp-config.h
+./mibII/snmp_mib.lo: ../../include/net-snmp/system/linux.h
+./mibII/snmp_mib.lo: ../../include/net-snmp/system/sysv.h
+./mibII/snmp_mib.lo: ../../include/net-snmp/system/generic.h
+./mibII/snmp_mib.lo: ../../include/net-snmp/machine/generic.h
+./mibII/snmp_mib.lo: ../../include/net-snmp/net-snmp-includes.h
+./mibII/snmp_mib.lo: ../../include/net-snmp/definitions.h
+./mibII/snmp_mib.lo: ../../include/net-snmp/types.h
+./mibII/snmp_mib.lo: ../../include/net-snmp/library/snmp_api.h
+./mibII/snmp_mib.lo: ../../include/net-snmp/library/asn1.h
+./mibII/snmp_mib.lo: ../../include/net-snmp/library/snmp_impl.h
+./mibII/snmp_mib.lo: ../../include/net-snmp/library/snmp.h
+./mibII/snmp_mib.lo: ../../include/net-snmp/library/snmp-tc.h
+./mibII/snmp_mib.lo: ../../include/net-snmp/utilities.h
+./mibII/snmp_mib.lo: ../../include/net-snmp/library/snmp_client.h
+./mibII/snmp_mib.lo: ../../include/net-snmp/library/getopt.h
+./mibII/snmp_mib.lo: ../../include/net-snmp/library/system.h
+./mibII/snmp_mib.lo: ../../include/net-snmp/library/tools.h
+./mibII/snmp_mib.lo: ../../include/net-snmp/library/int64.h
+./mibII/snmp_mib.lo: ../../include/net-snmp/library/mt_support.h
+./mibII/snmp_mib.lo: ../../include/net-snmp/library/snmp_alarm.h
+./mibII/snmp_mib.lo: ../../include/net-snmp/library/data_list.h
+./mibII/snmp_mib.lo: ../../include/net-snmp/library/callback.h
+./mibII/snmp_mib.lo: ../../include/net-snmp/library/oid_stash.h
+./mibII/snmp_mib.lo: ../../include/net-snmp/library/check_varbind.h
+./mibII/snmp_mib.lo: ../../include/net-snmp/version.h
+./mibII/snmp_mib.lo: ../../include/net-snmp/session_api.h
+./mibII/snmp_mib.lo: ../../include/net-snmp/library/snmp_transport.h
+./mibII/snmp_mib.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./mibII/snmp_mib.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./mibII/snmp_mib.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./mibII/snmp_mib.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./mibII/snmp_mib.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./mibII/snmp_mib.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./mibII/snmp_mib.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./mibII/snmp_mib.lo: ../../include/net-snmp/library/ucd_compat.h
+./mibII/snmp_mib.lo: ../../include/net-snmp/pdu_api.h
+./mibII/snmp_mib.lo: ../../include/net-snmp/mib_api.h
+./mibII/snmp_mib.lo: ../../include/net-snmp/library/mib.h
+./mibII/snmp_mib.lo: ../../include/net-snmp/library/parse.h
+./mibII/snmp_mib.lo: ../../include/net-snmp/varbind_api.h
+./mibII/snmp_mib.lo: ../../include/net-snmp/config_api.h
+./mibII/snmp_mib.lo: ../../include/net-snmp/library/read_config.h
+./mibII/snmp_mib.lo: ../../include/net-snmp/library/default_store.h
+./mibII/snmp_mib.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./mibII/snmp_mib.lo: ../../include/net-snmp/library/snmp_enum.h
+./mibII/snmp_mib.lo: ../../include/net-snmp/library/vacm.h
+./mibII/snmp_mib.lo: ../../include/net-snmp/output_api.h
+./mibII/snmp_mib.lo: ../../include/net-snmp/library/snmp_debug.h
+./mibII/snmp_mib.lo: ../../include/net-snmp/library/snmp_logging.h
+./mibII/snmp_mib.lo: ../../include/net-snmp/snmpv3_api.h
+./mibII/snmp_mib.lo: ../../include/net-snmp/library/snmpv3.h
+./mibII/snmp_mib.lo: ../../include/net-snmp/library/transform_oids.h
+./mibII/snmp_mib.lo: ../../include/net-snmp/library/keytools.h
+./mibII/snmp_mib.lo: ../../include/net-snmp/library/scapi.h
+./mibII/snmp_mib.lo: ../../include/net-snmp/library/lcd_time.h
+./mibII/snmp_mib.lo: ../../include/net-snmp/library/snmp_secmod.h
+./mibII/snmp_mib.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./mibII/snmp_mib.lo: ../../include/net-snmp/library/snmpusm.h
+./mibII/snmp_mib.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./mibII/snmp_mib.lo: ../../include/net-snmp/agent/snmp_agent.h
+./mibII/snmp_mib.lo: ../../include/net-snmp/agent/snmp_vars.h
+./mibII/snmp_mib.lo: ../../include/net-snmp/agent/agent_handler.h
+./mibII/snmp_mib.lo: ../../include/net-snmp/agent/var_struct.h
+./mibII/snmp_mib.lo: ../../include/net-snmp/agent/agent_registry.h
+./mibII/snmp_mib.lo: ../../include/net-snmp/agent/ds_agent.h
+./mibII/snmp_mib.lo: ../../include/net-snmp/agent/agent_read_config.h
+./mibII/snmp_mib.lo: ../../include/net-snmp/agent/agent_trap.h
+./mibII/snmp_mib.lo: ../../include/net-snmp/agent/all_helpers.h
+./mibII/snmp_mib.lo: ../../include/net-snmp/agent/instance.h
+./mibII/snmp_mib.lo: ../../include/net-snmp/agent/multiplexer.h
+./mibII/snmp_mib.lo: ../../include/net-snmp/agent/null.h
+./mibII/snmp_mib.lo: ../../include/net-snmp/agent/debug_handler.h
+./mibII/snmp_mib.lo: ../../include/net-snmp/agent/old_api.h
+./mibII/snmp_mib.lo: ../../include/net-snmp/agent/read_only.h
+./mibII/snmp_mib.lo: ../../include/net-snmp/agent/serialize.h
+./mibII/snmp_mib.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./mibII/snmp_mib.lo: ../../include/net-snmp/agent/mode_end_call.h
+./mibII/snmp_mib.lo: ../../include/net-snmp/agent/table.h
+./mibII/snmp_mib.lo: ../../include/net-snmp/agent/table_data.h
+./mibII/snmp_mib.lo: ../../include/net-snmp/agent/table_dataset.h
+./mibII/snmp_mib.lo: ../../include/net-snmp/agent/table_iterator.h
+./mibII/snmp_mib.lo: ../../include/net-snmp/agent/mib_module_config.h
+./mibII/snmp_mib.lo: util_funcs.h struct.h ./mibII/snmp_mib.h
+./mibII/snmp_mib.lo: ./mibII/sysORTable.h
+./mibII/sysORTable.lo: ../../include/net-snmp/net-snmp-config.h
+./mibII/sysORTable.lo: ../../include/net-snmp/system/linux.h
+./mibII/sysORTable.lo: ../../include/net-snmp/system/sysv.h
+./mibII/sysORTable.lo: ../../include/net-snmp/system/generic.h
+./mibII/sysORTable.lo: ../../include/net-snmp/machine/generic.h
+./mibII/sysORTable.lo: ../../include/net-snmp/net-snmp-includes.h
+./mibII/sysORTable.lo: ../../include/net-snmp/definitions.h
+./mibII/sysORTable.lo: ../../include/net-snmp/types.h
+./mibII/sysORTable.lo: ../../include/net-snmp/library/snmp_api.h
+./mibII/sysORTable.lo: ../../include/net-snmp/library/asn1.h
+./mibII/sysORTable.lo: ../../include/net-snmp/library/snmp_impl.h
+./mibII/sysORTable.lo: ../../include/net-snmp/library/snmp.h
+./mibII/sysORTable.lo: ../../include/net-snmp/library/snmp-tc.h
+./mibII/sysORTable.lo: ../../include/net-snmp/utilities.h
+./mibII/sysORTable.lo: ../../include/net-snmp/library/snmp_client.h
+./mibII/sysORTable.lo: ../../include/net-snmp/library/getopt.h
+./mibII/sysORTable.lo: ../../include/net-snmp/library/system.h
+./mibII/sysORTable.lo: ../../include/net-snmp/library/tools.h
+./mibII/sysORTable.lo: ../../include/net-snmp/library/int64.h
+./mibII/sysORTable.lo: ../../include/net-snmp/library/mt_support.h
+./mibII/sysORTable.lo: ../../include/net-snmp/library/snmp_alarm.h
+./mibII/sysORTable.lo: ../../include/net-snmp/library/data_list.h
+./mibII/sysORTable.lo: ../../include/net-snmp/library/callback.h
+./mibII/sysORTable.lo: ../../include/net-snmp/library/oid_stash.h
+./mibII/sysORTable.lo: ../../include/net-snmp/library/check_varbind.h
+./mibII/sysORTable.lo: ../../include/net-snmp/version.h
+./mibII/sysORTable.lo: ../../include/net-snmp/session_api.h
+./mibII/sysORTable.lo: ../../include/net-snmp/library/snmp_transport.h
+./mibII/sysORTable.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./mibII/sysORTable.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./mibII/sysORTable.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./mibII/sysORTable.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./mibII/sysORTable.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./mibII/sysORTable.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./mibII/sysORTable.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./mibII/sysORTable.lo: ../../include/net-snmp/library/ucd_compat.h
+./mibII/sysORTable.lo: ../../include/net-snmp/pdu_api.h
+./mibII/sysORTable.lo: ../../include/net-snmp/mib_api.h
+./mibII/sysORTable.lo: ../../include/net-snmp/library/mib.h
+./mibII/sysORTable.lo: ../../include/net-snmp/library/parse.h
+./mibII/sysORTable.lo: ../../include/net-snmp/varbind_api.h
+./mibII/sysORTable.lo: ../../include/net-snmp/config_api.h
+./mibII/sysORTable.lo: ../../include/net-snmp/library/read_config.h
+./mibII/sysORTable.lo: ../../include/net-snmp/library/default_store.h
+./mibII/sysORTable.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./mibII/sysORTable.lo: ../../include/net-snmp/library/snmp_enum.h
+./mibII/sysORTable.lo: ../../include/net-snmp/library/vacm.h
+./mibII/sysORTable.lo: ../../include/net-snmp/output_api.h
+./mibII/sysORTable.lo: ../../include/net-snmp/library/snmp_debug.h
+./mibII/sysORTable.lo: ../../include/net-snmp/library/snmp_logging.h
+./mibII/sysORTable.lo: ../../include/net-snmp/snmpv3_api.h
+./mibII/sysORTable.lo: ../../include/net-snmp/library/snmpv3.h
+./mibII/sysORTable.lo: ../../include/net-snmp/library/transform_oids.h
+./mibII/sysORTable.lo: ../../include/net-snmp/library/keytools.h
+./mibII/sysORTable.lo: ../../include/net-snmp/library/scapi.h
+./mibII/sysORTable.lo: ../../include/net-snmp/library/lcd_time.h
+./mibII/sysORTable.lo: ../../include/net-snmp/library/snmp_secmod.h
+./mibII/sysORTable.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./mibII/sysORTable.lo: ../../include/net-snmp/library/snmpusm.h
+./mibII/sysORTable.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./mibII/sysORTable.lo: ../../include/net-snmp/agent/snmp_agent.h
+./mibII/sysORTable.lo: ../../include/net-snmp/agent/snmp_vars.h
+./mibII/sysORTable.lo: ../../include/net-snmp/agent/agent_handler.h
+./mibII/sysORTable.lo: ../../include/net-snmp/agent/var_struct.h
+./mibII/sysORTable.lo: ../../include/net-snmp/agent/agent_registry.h
+./mibII/sysORTable.lo: ../../include/net-snmp/agent/ds_agent.h
+./mibII/sysORTable.lo: ../../include/net-snmp/agent/agent_read_config.h
+./mibII/sysORTable.lo: ../../include/net-snmp/agent/agent_trap.h
+./mibII/sysORTable.lo: ../../include/net-snmp/agent/all_helpers.h
+./mibII/sysORTable.lo: ../../include/net-snmp/agent/instance.h
+./mibII/sysORTable.lo: ../../include/net-snmp/agent/multiplexer.h
+./mibII/sysORTable.lo: ../../include/net-snmp/agent/null.h
+./mibII/sysORTable.lo: ../../include/net-snmp/agent/debug_handler.h
+./mibII/sysORTable.lo: ../../include/net-snmp/agent/old_api.h
+./mibII/sysORTable.lo: ../../include/net-snmp/agent/read_only.h
+./mibII/sysORTable.lo: ../../include/net-snmp/agent/serialize.h
+./mibII/sysORTable.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./mibII/sysORTable.lo: ../../include/net-snmp/agent/mode_end_call.h
+./mibII/sysORTable.lo: ../../include/net-snmp/agent/table.h
+./mibII/sysORTable.lo: ../../include/net-snmp/agent/table_data.h
+./mibII/sysORTable.lo: ../../include/net-snmp/agent/table_dataset.h
+./mibII/sysORTable.lo: ../../include/net-snmp/agent/table_iterator.h
+./mibII/sysORTable.lo: ../../include/net-snmp/agent/mib_module_config.h
+./mibII/sysORTable.lo: ../../include/net-snmp/agent/agent_callbacks.h
+./mibII/sysORTable.lo: struct.h util_funcs.h ./mibII/sysORTable.h
+./mibII/sysORTable.lo: ./../snmpd.h agentx/subagent.h agentx/client.h
+./mibII/system_mib.lo: ../../include/net-snmp/net-snmp-config.h
+./mibII/system_mib.lo: ../../include/net-snmp/system/linux.h
+./mibII/system_mib.lo: ../../include/net-snmp/system/sysv.h
+./mibII/system_mib.lo: ../../include/net-snmp/system/generic.h
+./mibII/system_mib.lo: ../../include/net-snmp/machine/generic.h
+./mibII/system_mib.lo: ../../include/net-snmp/net-snmp-includes.h
+./mibII/system_mib.lo: ../../include/net-snmp/definitions.h
+./mibII/system_mib.lo: ../../include/net-snmp/types.h
+./mibII/system_mib.lo: ../../include/net-snmp/library/snmp_api.h
+./mibII/system_mib.lo: ../../include/net-snmp/library/asn1.h
+./mibII/system_mib.lo: ../../include/net-snmp/library/snmp_impl.h
+./mibII/system_mib.lo: ../../include/net-snmp/library/snmp.h
+./mibII/system_mib.lo: ../../include/net-snmp/library/snmp-tc.h
+./mibII/system_mib.lo: ../../include/net-snmp/utilities.h
+./mibII/system_mib.lo: ../../include/net-snmp/library/snmp_client.h
+./mibII/system_mib.lo: ../../include/net-snmp/library/getopt.h
+./mibII/system_mib.lo: ../../include/net-snmp/library/system.h
+./mibII/system_mib.lo: ../../include/net-snmp/library/tools.h
+./mibII/system_mib.lo: ../../include/net-snmp/library/int64.h
+./mibII/system_mib.lo: ../../include/net-snmp/library/mt_support.h
+./mibII/system_mib.lo: ../../include/net-snmp/library/snmp_alarm.h
+./mibII/system_mib.lo: ../../include/net-snmp/library/data_list.h
+./mibII/system_mib.lo: ../../include/net-snmp/library/callback.h
+./mibII/system_mib.lo: ../../include/net-snmp/library/oid_stash.h
+./mibII/system_mib.lo: ../../include/net-snmp/library/check_varbind.h
+./mibII/system_mib.lo: ../../include/net-snmp/version.h
+./mibII/system_mib.lo: ../../include/net-snmp/session_api.h
+./mibII/system_mib.lo: ../../include/net-snmp/library/snmp_transport.h
+./mibII/system_mib.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./mibII/system_mib.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./mibII/system_mib.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./mibII/system_mib.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./mibII/system_mib.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./mibII/system_mib.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./mibII/system_mib.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./mibII/system_mib.lo: ../../include/net-snmp/library/ucd_compat.h
+./mibII/system_mib.lo: ../../include/net-snmp/pdu_api.h
+./mibII/system_mib.lo: ../../include/net-snmp/mib_api.h
+./mibII/system_mib.lo: ../../include/net-snmp/library/mib.h
+./mibII/system_mib.lo: ../../include/net-snmp/library/parse.h
+./mibII/system_mib.lo: ../../include/net-snmp/varbind_api.h
+./mibII/system_mib.lo: ../../include/net-snmp/config_api.h
+./mibII/system_mib.lo: ../../include/net-snmp/library/read_config.h
+./mibII/system_mib.lo: ../../include/net-snmp/library/default_store.h
+./mibII/system_mib.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./mibII/system_mib.lo: ../../include/net-snmp/library/snmp_enum.h
+./mibII/system_mib.lo: ../../include/net-snmp/library/vacm.h
+./mibII/system_mib.lo: ../../include/net-snmp/output_api.h
+./mibII/system_mib.lo: ../../include/net-snmp/library/snmp_debug.h
+./mibII/system_mib.lo: ../../include/net-snmp/library/snmp_logging.h
+./mibII/system_mib.lo: ../../include/net-snmp/snmpv3_api.h
+./mibII/system_mib.lo: ../../include/net-snmp/library/snmpv3.h
+./mibII/system_mib.lo: ../../include/net-snmp/library/transform_oids.h
+./mibII/system_mib.lo: ../../include/net-snmp/library/keytools.h
+./mibII/system_mib.lo: ../../include/net-snmp/library/scapi.h
+./mibII/system_mib.lo: ../../include/net-snmp/library/lcd_time.h
+./mibII/system_mib.lo: ../../include/net-snmp/library/snmp_secmod.h
+./mibII/system_mib.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./mibII/system_mib.lo: ../../include/net-snmp/library/snmpusm.h
+./mibII/system_mib.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./mibII/system_mib.lo: ../../include/net-snmp/agent/snmp_agent.h
+./mibII/system_mib.lo: ../../include/net-snmp/agent/snmp_vars.h
+./mibII/system_mib.lo: ../../include/net-snmp/agent/agent_handler.h
+./mibII/system_mib.lo: ../../include/net-snmp/agent/var_struct.h
+./mibII/system_mib.lo: ../../include/net-snmp/agent/agent_registry.h
+./mibII/system_mib.lo: ../../include/net-snmp/agent/ds_agent.h
+./mibII/system_mib.lo: ../../include/net-snmp/agent/agent_read_config.h
+./mibII/system_mib.lo: ../../include/net-snmp/agent/agent_trap.h
+./mibII/system_mib.lo: ../../include/net-snmp/agent/all_helpers.h
+./mibII/system_mib.lo: ../../include/net-snmp/agent/instance.h
+./mibII/system_mib.lo: ../../include/net-snmp/agent/multiplexer.h
+./mibII/system_mib.lo: ../../include/net-snmp/agent/null.h
+./mibII/system_mib.lo: ../../include/net-snmp/agent/debug_handler.h
+./mibII/system_mib.lo: ../../include/net-snmp/agent/old_api.h
+./mibII/system_mib.lo: ../../include/net-snmp/agent/read_only.h
+./mibII/system_mib.lo: ../../include/net-snmp/agent/serialize.h
+./mibII/system_mib.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./mibII/system_mib.lo: ../../include/net-snmp/agent/mode_end_call.h
+./mibII/system_mib.lo: ../../include/net-snmp/agent/table.h
+./mibII/system_mib.lo: ../../include/net-snmp/agent/table_data.h
+./mibII/system_mib.lo: ../../include/net-snmp/agent/table_dataset.h
+./mibII/system_mib.lo: ../../include/net-snmp/agent/table_iterator.h
+./mibII/system_mib.lo: ../../include/net-snmp/agent/mib_module_config.h
+./mibII/system_mib.lo: util_funcs.h struct.h ./mibII/system_mib.h
+./mibII/system_mib.lo: ./mibII/sysORTable.h
+./mibII/tcp.lo: ../../include/net-snmp/net-snmp-config.h
+./mibII/tcp.lo: ../../include/net-snmp/system/linux.h
+./mibII/tcp.lo: ../../include/net-snmp/system/sysv.h
+./mibII/tcp.lo: ../../include/net-snmp/system/generic.h
+./mibII/tcp.lo: ../../include/net-snmp/machine/generic.h
+./mibII/tcp.lo: ../../include/net-snmp/net-snmp-includes.h
+./mibII/tcp.lo: ../../include/net-snmp/definitions.h
+./mibII/tcp.lo: ../../include/net-snmp/types.h
+./mibII/tcp.lo: ../../include/net-snmp/library/snmp_api.h
+./mibII/tcp.lo: ../../include/net-snmp/library/asn1.h
+./mibII/tcp.lo: ../../include/net-snmp/library/snmp_impl.h
+./mibII/tcp.lo: ../../include/net-snmp/library/snmp.h
+./mibII/tcp.lo: ../../include/net-snmp/library/snmp-tc.h
+./mibII/tcp.lo: ../../include/net-snmp/utilities.h
+./mibII/tcp.lo: ../../include/net-snmp/library/snmp_client.h
+./mibII/tcp.lo: ../../include/net-snmp/library/getopt.h
+./mibII/tcp.lo: ../../include/net-snmp/library/system.h
+./mibII/tcp.lo: ../../include/net-snmp/library/tools.h
+./mibII/tcp.lo: ../../include/net-snmp/library/int64.h
+./mibII/tcp.lo: ../../include/net-snmp/library/mt_support.h
+./mibII/tcp.lo: ../../include/net-snmp/library/snmp_alarm.h
+./mibII/tcp.lo: ../../include/net-snmp/library/data_list.h
+./mibII/tcp.lo: ../../include/net-snmp/library/callback.h
+./mibII/tcp.lo: ../../include/net-snmp/library/oid_stash.h
+./mibII/tcp.lo: ../../include/net-snmp/library/check_varbind.h
+./mibII/tcp.lo: ../../include/net-snmp/version.h
+./mibII/tcp.lo: ../../include/net-snmp/session_api.h
+./mibII/tcp.lo: ../../include/net-snmp/library/snmp_transport.h
+./mibII/tcp.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./mibII/tcp.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./mibII/tcp.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./mibII/tcp.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./mibII/tcp.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./mibII/tcp.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./mibII/tcp.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./mibII/tcp.lo: ../../include/net-snmp/library/ucd_compat.h
+./mibII/tcp.lo: ../../include/net-snmp/pdu_api.h
+./mibII/tcp.lo: ../../include/net-snmp/mib_api.h
+./mibII/tcp.lo: ../../include/net-snmp/library/mib.h
+./mibII/tcp.lo: ../../include/net-snmp/library/parse.h
+./mibII/tcp.lo: ../../include/net-snmp/varbind_api.h
+./mibII/tcp.lo: ../../include/net-snmp/config_api.h
+./mibII/tcp.lo: ../../include/net-snmp/library/read_config.h
+./mibII/tcp.lo: ../../include/net-snmp/library/default_store.h
+./mibII/tcp.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./mibII/tcp.lo: ../../include/net-snmp/library/snmp_enum.h
+./mibII/tcp.lo: ../../include/net-snmp/library/vacm.h
+./mibII/tcp.lo: ../../include/net-snmp/output_api.h
+./mibII/tcp.lo: ../../include/net-snmp/library/snmp_debug.h
+./mibII/tcp.lo: ../../include/net-snmp/library/snmp_logging.h
+./mibII/tcp.lo: ../../include/net-snmp/snmpv3_api.h
+./mibII/tcp.lo: ../../include/net-snmp/library/snmpv3.h
+./mibII/tcp.lo: ../../include/net-snmp/library/transform_oids.h
+./mibII/tcp.lo: ../../include/net-snmp/library/keytools.h
+./mibII/tcp.lo: ../../include/net-snmp/library/scapi.h
+./mibII/tcp.lo: ../../include/net-snmp/library/lcd_time.h
+./mibII/tcp.lo: ../../include/net-snmp/library/snmp_secmod.h
+./mibII/tcp.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./mibII/tcp.lo: ../../include/net-snmp/library/snmpusm.h
+./mibII/tcp.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./mibII/tcp.lo: ../../include/net-snmp/agent/snmp_agent.h
+./mibII/tcp.lo: ../../include/net-snmp/agent/snmp_vars.h
+./mibII/tcp.lo: ../../include/net-snmp/agent/agent_handler.h
+./mibII/tcp.lo: ../../include/net-snmp/agent/var_struct.h
+./mibII/tcp.lo: ../../include/net-snmp/agent/agent_registry.h
+./mibII/tcp.lo: ../../include/net-snmp/agent/ds_agent.h
+./mibII/tcp.lo: ../../include/net-snmp/agent/agent_read_config.h
+./mibII/tcp.lo: ../../include/net-snmp/agent/agent_trap.h
+./mibII/tcp.lo: ../../include/net-snmp/agent/all_helpers.h
+./mibII/tcp.lo: ../../include/net-snmp/agent/instance.h
+./mibII/tcp.lo: ../../include/net-snmp/agent/multiplexer.h
+./mibII/tcp.lo: ../../include/net-snmp/agent/null.h
+./mibII/tcp.lo: ../../include/net-snmp/agent/debug_handler.h
+./mibII/tcp.lo: ../../include/net-snmp/agent/old_api.h
+./mibII/tcp.lo: ../../include/net-snmp/agent/read_only.h
+./mibII/tcp.lo: ../../include/net-snmp/agent/serialize.h
+./mibII/tcp.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./mibII/tcp.lo: ../../include/net-snmp/agent/mode_end_call.h
+./mibII/tcp.lo: ../../include/net-snmp/agent/table.h
+./mibII/tcp.lo: ../../include/net-snmp/agent/table_data.h
+./mibII/tcp.lo: ../../include/net-snmp/agent/table_dataset.h
+./mibII/tcp.lo: ../../include/net-snmp/agent/table_iterator.h
+./mibII/tcp.lo: ../../include/net-snmp/agent/mib_module_config.h
+./mibII/tcp.lo: ../../include/net-snmp/agent/auto_nlist.h ./../kernel.h
+./mibII/tcp.lo: util_funcs.h struct.h ./mibII/tcp.h ./mibII/tcpTable.h
+./mibII/tcp.lo: ./mibII/sysORTable.h
+./mibII/tcpTable.lo: ../../include/net-snmp/net-snmp-config.h
+./mibII/tcpTable.lo: ../../include/net-snmp/system/linux.h
+./mibII/tcpTable.lo: ../../include/net-snmp/system/sysv.h
+./mibII/tcpTable.lo: ../../include/net-snmp/system/generic.h
+./mibII/tcpTable.lo: ../../include/net-snmp/machine/generic.h
+./mibII/tcpTable.lo:  ./../kernel.h
+./mibII/tcpTable.lo: ../../include/net-snmp/net-snmp-includes.h
+./mibII/tcpTable.lo: ../../include/net-snmp/definitions.h
+./mibII/tcpTable.lo: ../../include/net-snmp/types.h
+./mibII/tcpTable.lo: ../../include/net-snmp/library/snmp_api.h
+./mibII/tcpTable.lo: ../../include/net-snmp/library/asn1.h
+./mibII/tcpTable.lo: ../../include/net-snmp/library/snmp_impl.h
+./mibII/tcpTable.lo: ../../include/net-snmp/library/snmp.h
+./mibII/tcpTable.lo: ../../include/net-snmp/library/snmp-tc.h
+./mibII/tcpTable.lo: ../../include/net-snmp/utilities.h
+./mibII/tcpTable.lo: ../../include/net-snmp/library/snmp_client.h
+./mibII/tcpTable.lo: ../../include/net-snmp/library/getopt.h
+./mibII/tcpTable.lo: ../../include/net-snmp/library/system.h
+./mibII/tcpTable.lo: ../../include/net-snmp/library/tools.h
+./mibII/tcpTable.lo: ../../include/net-snmp/library/int64.h
+./mibII/tcpTable.lo: ../../include/net-snmp/library/mt_support.h
+./mibII/tcpTable.lo: ../../include/net-snmp/library/snmp_alarm.h
+./mibII/tcpTable.lo: ../../include/net-snmp/library/data_list.h
+./mibII/tcpTable.lo: ../../include/net-snmp/library/callback.h
+./mibII/tcpTable.lo: ../../include/net-snmp/library/oid_stash.h
+./mibII/tcpTable.lo: ../../include/net-snmp/library/check_varbind.h
+./mibII/tcpTable.lo: ../../include/net-snmp/version.h
+./mibII/tcpTable.lo: ../../include/net-snmp/session_api.h
+./mibII/tcpTable.lo: ../../include/net-snmp/library/snmp_transport.h
+./mibII/tcpTable.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./mibII/tcpTable.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./mibII/tcpTable.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./mibII/tcpTable.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./mibII/tcpTable.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./mibII/tcpTable.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./mibII/tcpTable.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./mibII/tcpTable.lo: ../../include/net-snmp/library/ucd_compat.h
+./mibII/tcpTable.lo: ../../include/net-snmp/pdu_api.h
+./mibII/tcpTable.lo: ../../include/net-snmp/mib_api.h
+./mibII/tcpTable.lo: ../../include/net-snmp/library/mib.h
+./mibII/tcpTable.lo: ../../include/net-snmp/library/parse.h
+./mibII/tcpTable.lo: ../../include/net-snmp/varbind_api.h
+./mibII/tcpTable.lo: ../../include/net-snmp/config_api.h
+./mibII/tcpTable.lo: ../../include/net-snmp/library/read_config.h
+./mibII/tcpTable.lo: ../../include/net-snmp/library/default_store.h
+./mibII/tcpTable.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./mibII/tcpTable.lo: ../../include/net-snmp/library/snmp_enum.h
+./mibII/tcpTable.lo: ../../include/net-snmp/library/vacm.h
+./mibII/tcpTable.lo: ../../include/net-snmp/output_api.h
+./mibII/tcpTable.lo: ../../include/net-snmp/library/snmp_debug.h
+./mibII/tcpTable.lo: ../../include/net-snmp/library/snmp_logging.h
+./mibII/tcpTable.lo: ../../include/net-snmp/snmpv3_api.h
+./mibII/tcpTable.lo: ../../include/net-snmp/library/snmpv3.h
+./mibII/tcpTable.lo: ../../include/net-snmp/library/transform_oids.h
+./mibII/tcpTable.lo: ../../include/net-snmp/library/keytools.h
+./mibII/tcpTable.lo: ../../include/net-snmp/library/scapi.h
+./mibII/tcpTable.lo: ../../include/net-snmp/library/lcd_time.h
+./mibII/tcpTable.lo: ../../include/net-snmp/library/snmp_secmod.h
+./mibII/tcpTable.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./mibII/tcpTable.lo: ../../include/net-snmp/library/snmpusm.h
+./mibII/tcpTable.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./mibII/tcpTable.lo: ../../include/net-snmp/agent/snmp_agent.h
+./mibII/tcpTable.lo: ../../include/net-snmp/agent/snmp_vars.h
+./mibII/tcpTable.lo: ../../include/net-snmp/agent/agent_handler.h
+./mibII/tcpTable.lo: ../../include/net-snmp/agent/var_struct.h
+./mibII/tcpTable.lo: ../../include/net-snmp/agent/agent_registry.h
+./mibII/tcpTable.lo: ../../include/net-snmp/agent/ds_agent.h
+./mibII/tcpTable.lo: ../../include/net-snmp/agent/agent_read_config.h
+./mibII/tcpTable.lo: ../../include/net-snmp/agent/agent_trap.h
+./mibII/tcpTable.lo: ../../include/net-snmp/agent/all_helpers.h
+./mibII/tcpTable.lo: ../../include/net-snmp/agent/instance.h
+./mibII/tcpTable.lo: ../../include/net-snmp/agent/multiplexer.h
+./mibII/tcpTable.lo: ../../include/net-snmp/agent/null.h
+./mibII/tcpTable.lo: ../../include/net-snmp/agent/debug_handler.h
+./mibII/tcpTable.lo: ../../include/net-snmp/agent/old_api.h
+./mibII/tcpTable.lo: ../../include/net-snmp/agent/read_only.h
+./mibII/tcpTable.lo: ../../include/net-snmp/agent/serialize.h
+./mibII/tcpTable.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./mibII/tcpTable.lo: ../../include/net-snmp/agent/mode_end_call.h
+./mibII/tcpTable.lo: ../../include/net-snmp/agent/table.h
+./mibII/tcpTable.lo: ../../include/net-snmp/agent/table_data.h
+./mibII/tcpTable.lo: ../../include/net-snmp/agent/table_dataset.h
+./mibII/tcpTable.lo: ../../include/net-snmp/agent/table_iterator.h
+./mibII/tcpTable.lo: ../../include/net-snmp/agent/mib_module_config.h
+./mibII/tcpTable.lo: ../../include/net-snmp/agent/auto_nlist.h ./mibII/tcp.h
+./mibII/tcpTable.lo: ./mibII/tcpTable.h
+./mibII/tmp.lo: ../../include/net-snmp/net-snmp-config.h
+./mibII/tmp.lo: ../../include/net-snmp/system/linux.h
+./mibII/tmp.lo: ../../include/net-snmp/system/sysv.h
+./mibII/tmp.lo: ../../include/net-snmp/system/generic.h
+./mibII/tmp.lo: ../../include/net-snmp/machine/generic.h
+./mibII/tmp.lo:  ./../kernel.h
+./mibII/tmp.lo: ../../include/net-snmp/net-snmp-includes.h
+./mibII/tmp.lo: ../../include/net-snmp/definitions.h
+./mibII/tmp.lo: ../../include/net-snmp/types.h
+./mibII/tmp.lo: ../../include/net-snmp/library/snmp_api.h
+./mibII/tmp.lo: ../../include/net-snmp/library/asn1.h
+./mibII/tmp.lo: ../../include/net-snmp/library/snmp_impl.h
+./mibII/tmp.lo: ../../include/net-snmp/library/snmp.h
+./mibII/tmp.lo: ../../include/net-snmp/library/snmp-tc.h
+./mibII/tmp.lo: ../../include/net-snmp/utilities.h
+./mibII/tmp.lo: ../../include/net-snmp/library/snmp_client.h
+./mibII/tmp.lo: ../../include/net-snmp/library/getopt.h
+./mibII/tmp.lo: ../../include/net-snmp/library/system.h
+./mibII/tmp.lo: ../../include/net-snmp/library/tools.h
+./mibII/tmp.lo: ../../include/net-snmp/library/int64.h
+./mibII/tmp.lo: ../../include/net-snmp/library/mt_support.h
+./mibII/tmp.lo: ../../include/net-snmp/library/snmp_alarm.h
+./mibII/tmp.lo: ../../include/net-snmp/library/data_list.h
+./mibII/tmp.lo: ../../include/net-snmp/library/callback.h
+./mibII/tmp.lo: ../../include/net-snmp/library/oid_stash.h
+./mibII/tmp.lo: ../../include/net-snmp/library/check_varbind.h
+./mibII/tmp.lo: ../../include/net-snmp/version.h
+./mibII/tmp.lo: ../../include/net-snmp/session_api.h
+./mibII/tmp.lo: ../../include/net-snmp/library/snmp_transport.h
+./mibII/tmp.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./mibII/tmp.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./mibII/tmp.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./mibII/tmp.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./mibII/tmp.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./mibII/tmp.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./mibII/tmp.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./mibII/tmp.lo: ../../include/net-snmp/library/ucd_compat.h
+./mibII/tmp.lo: ../../include/net-snmp/pdu_api.h
+./mibII/tmp.lo: ../../include/net-snmp/mib_api.h
+./mibII/tmp.lo: ../../include/net-snmp/library/mib.h
+./mibII/tmp.lo: ../../include/net-snmp/library/parse.h
+./mibII/tmp.lo: ../../include/net-snmp/varbind_api.h
+./mibII/tmp.lo: ../../include/net-snmp/config_api.h
+./mibII/tmp.lo: ../../include/net-snmp/library/read_config.h
+./mibII/tmp.lo: ../../include/net-snmp/library/default_store.h
+./mibII/tmp.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./mibII/tmp.lo: ../../include/net-snmp/library/snmp_enum.h
+./mibII/tmp.lo: ../../include/net-snmp/library/vacm.h
+./mibII/tmp.lo: ../../include/net-snmp/output_api.h
+./mibII/tmp.lo: ../../include/net-snmp/library/snmp_debug.h
+./mibII/tmp.lo: ../../include/net-snmp/library/snmp_logging.h
+./mibII/tmp.lo: ../../include/net-snmp/snmpv3_api.h
+./mibII/tmp.lo: ../../include/net-snmp/library/snmpv3.h
+./mibII/tmp.lo: ../../include/net-snmp/library/transform_oids.h
+./mibII/tmp.lo: ../../include/net-snmp/library/keytools.h
+./mibII/tmp.lo: ../../include/net-snmp/library/scapi.h
+./mibII/tmp.lo: ../../include/net-snmp/library/lcd_time.h
+./mibII/tmp.lo: ../../include/net-snmp/library/snmp_secmod.h
+./mibII/tmp.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./mibII/tmp.lo: ../../include/net-snmp/library/snmpusm.h
+./mibII/tmp.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./mibII/tmp.lo: ../../include/net-snmp/agent/snmp_agent.h
+./mibII/tmp.lo: ../../include/net-snmp/agent/snmp_vars.h
+./mibII/tmp.lo: ../../include/net-snmp/agent/agent_handler.h
+./mibII/tmp.lo: ../../include/net-snmp/agent/var_struct.h
+./mibII/tmp.lo: ../../include/net-snmp/agent/agent_registry.h
+./mibII/tmp.lo: ../../include/net-snmp/agent/ds_agent.h
+./mibII/tmp.lo: ../../include/net-snmp/agent/agent_read_config.h
+./mibII/tmp.lo: ../../include/net-snmp/agent/agent_trap.h
+./mibII/tmp.lo: ../../include/net-snmp/agent/all_helpers.h
+./mibII/tmp.lo: ../../include/net-snmp/agent/instance.h
+./mibII/tmp.lo: ../../include/net-snmp/agent/multiplexer.h
+./mibII/tmp.lo: ../../include/net-snmp/agent/null.h
+./mibII/tmp.lo: ../../include/net-snmp/agent/debug_handler.h
+./mibII/tmp.lo: ../../include/net-snmp/agent/old_api.h
+./mibII/tmp.lo: ../../include/net-snmp/agent/read_only.h
+./mibII/tmp.lo: ../../include/net-snmp/agent/serialize.h
+./mibII/tmp.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./mibII/tmp.lo: ../../include/net-snmp/agent/mode_end_call.h
+./mibII/tmp.lo: ../../include/net-snmp/agent/table.h
+./mibII/tmp.lo: ../../include/net-snmp/agent/table_data.h
+./mibII/tmp.lo: ../../include/net-snmp/agent/table_dataset.h
+./mibII/tmp.lo: ../../include/net-snmp/agent/table_iterator.h
+./mibII/tmp.lo: ../../include/net-snmp/agent/mib_module_config.h
+./mibII/tmp.lo: ../../include/net-snmp/agent/auto_nlist.h
+./mibII/tmp.lo: ./mibII/interfaces.h struct.h util_funcs.h
+./mibII/tmp.lo: ./mibII/sysORTable.h
+./mibII/udp.lo: ../../include/net-snmp/net-snmp-config.h
+./mibII/udp.lo: ../../include/net-snmp/system/linux.h
+./mibII/udp.lo: ../../include/net-snmp/system/sysv.h
+./mibII/udp.lo: ../../include/net-snmp/system/generic.h
+./mibII/udp.lo: ../../include/net-snmp/machine/generic.h
+./mibII/udp.lo: ../../include/net-snmp/net-snmp-includes.h
+./mibII/udp.lo: ../../include/net-snmp/definitions.h
+./mibII/udp.lo: ../../include/net-snmp/types.h
+./mibII/udp.lo: ../../include/net-snmp/library/snmp_api.h
+./mibII/udp.lo: ../../include/net-snmp/library/asn1.h
+./mibII/udp.lo: ../../include/net-snmp/library/snmp_impl.h
+./mibII/udp.lo: ../../include/net-snmp/library/snmp.h
+./mibII/udp.lo: ../../include/net-snmp/library/snmp-tc.h
+./mibII/udp.lo: ../../include/net-snmp/utilities.h
+./mibII/udp.lo: ../../include/net-snmp/library/snmp_client.h
+./mibII/udp.lo: ../../include/net-snmp/library/getopt.h
+./mibII/udp.lo: ../../include/net-snmp/library/system.h
+./mibII/udp.lo: ../../include/net-snmp/library/tools.h
+./mibII/udp.lo: ../../include/net-snmp/library/int64.h
+./mibII/udp.lo: ../../include/net-snmp/library/mt_support.h
+./mibII/udp.lo: ../../include/net-snmp/library/snmp_alarm.h
+./mibII/udp.lo: ../../include/net-snmp/library/data_list.h
+./mibII/udp.lo: ../../include/net-snmp/library/callback.h
+./mibII/udp.lo: ../../include/net-snmp/library/oid_stash.h
+./mibII/udp.lo: ../../include/net-snmp/library/check_varbind.h
+./mibII/udp.lo: ../../include/net-snmp/version.h
+./mibII/udp.lo: ../../include/net-snmp/session_api.h
+./mibII/udp.lo: ../../include/net-snmp/library/snmp_transport.h
+./mibII/udp.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./mibII/udp.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./mibII/udp.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./mibII/udp.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./mibII/udp.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./mibII/udp.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./mibII/udp.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./mibII/udp.lo: ../../include/net-snmp/library/ucd_compat.h
+./mibII/udp.lo: ../../include/net-snmp/pdu_api.h
+./mibII/udp.lo: ../../include/net-snmp/mib_api.h
+./mibII/udp.lo: ../../include/net-snmp/library/mib.h
+./mibII/udp.lo: ../../include/net-snmp/library/parse.h
+./mibII/udp.lo: ../../include/net-snmp/varbind_api.h
+./mibII/udp.lo: ../../include/net-snmp/config_api.h
+./mibII/udp.lo: ../../include/net-snmp/library/read_config.h
+./mibII/udp.lo: ../../include/net-snmp/library/default_store.h
+./mibII/udp.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./mibII/udp.lo: ../../include/net-snmp/library/snmp_enum.h
+./mibII/udp.lo: ../../include/net-snmp/library/vacm.h
+./mibII/udp.lo: ../../include/net-snmp/output_api.h
+./mibII/udp.lo: ../../include/net-snmp/library/snmp_debug.h
+./mibII/udp.lo: ../../include/net-snmp/library/snmp_logging.h
+./mibII/udp.lo: ../../include/net-snmp/snmpv3_api.h
+./mibII/udp.lo: ../../include/net-snmp/library/snmpv3.h
+./mibII/udp.lo: ../../include/net-snmp/library/transform_oids.h
+./mibII/udp.lo: ../../include/net-snmp/library/keytools.h
+./mibII/udp.lo: ../../include/net-snmp/library/scapi.h
+./mibII/udp.lo: ../../include/net-snmp/library/lcd_time.h
+./mibII/udp.lo: ../../include/net-snmp/library/snmp_secmod.h
+./mibII/udp.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./mibII/udp.lo: ../../include/net-snmp/library/snmpusm.h
+./mibII/udp.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./mibII/udp.lo: ../../include/net-snmp/agent/snmp_agent.h
+./mibII/udp.lo: ../../include/net-snmp/agent/snmp_vars.h
+./mibII/udp.lo: ../../include/net-snmp/agent/agent_handler.h
+./mibII/udp.lo: ../../include/net-snmp/agent/var_struct.h
+./mibII/udp.lo: ../../include/net-snmp/agent/agent_registry.h
+./mibII/udp.lo: ../../include/net-snmp/agent/ds_agent.h
+./mibII/udp.lo: ../../include/net-snmp/agent/agent_read_config.h
+./mibII/udp.lo: ../../include/net-snmp/agent/agent_trap.h
+./mibII/udp.lo: ../../include/net-snmp/agent/all_helpers.h
+./mibII/udp.lo: ../../include/net-snmp/agent/instance.h
+./mibII/udp.lo: ../../include/net-snmp/agent/multiplexer.h
+./mibII/udp.lo: ../../include/net-snmp/agent/null.h
+./mibII/udp.lo: ../../include/net-snmp/agent/debug_handler.h
+./mibII/udp.lo: ../../include/net-snmp/agent/old_api.h
+./mibII/udp.lo: ../../include/net-snmp/agent/read_only.h
+./mibII/udp.lo: ../../include/net-snmp/agent/serialize.h
+./mibII/udp.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./mibII/udp.lo: ../../include/net-snmp/agent/mode_end_call.h
+./mibII/udp.lo: ../../include/net-snmp/agent/table.h
+./mibII/udp.lo: ../../include/net-snmp/agent/table_data.h
+./mibII/udp.lo: ../../include/net-snmp/agent/table_dataset.h
+./mibII/udp.lo: ../../include/net-snmp/agent/table_iterator.h
+./mibII/udp.lo: ../../include/net-snmp/agent/mib_module_config.h
+./mibII/udp.lo: ../../include/net-snmp/agent/auto_nlist.h util_funcs.h
+./mibII/udp.lo: struct.h ./../kernel.h ./mibII/udp.h ./mibII/udpTable.h
+./mibII/udp.lo: ./mibII/sysORTable.h
+./mibII/udpTable.lo: ../../include/net-snmp/net-snmp-config.h
+./mibII/udpTable.lo: ../../include/net-snmp/system/linux.h
+./mibII/udpTable.lo: ../../include/net-snmp/system/sysv.h
+./mibII/udpTable.lo: ../../include/net-snmp/system/generic.h
+./mibII/udpTable.lo: ../../include/net-snmp/machine/generic.h
+./mibII/udpTable.lo: ./../kernel.h ../../include/net-snmp/net-snmp-includes.h
+./mibII/udpTable.lo: ../../include/net-snmp/definitions.h
+./mibII/udpTable.lo: ../../include/net-snmp/types.h
+./mibII/udpTable.lo: ../../include/net-snmp/library/snmp_api.h
+./mibII/udpTable.lo: ../../include/net-snmp/library/asn1.h
+./mibII/udpTable.lo: ../../include/net-snmp/library/snmp_impl.h
+./mibII/udpTable.lo: ../../include/net-snmp/library/snmp.h
+./mibII/udpTable.lo: ../../include/net-snmp/library/snmp-tc.h
+./mibII/udpTable.lo: ../../include/net-snmp/utilities.h
+./mibII/udpTable.lo: ../../include/net-snmp/library/snmp_client.h
+./mibII/udpTable.lo: ../../include/net-snmp/library/getopt.h
+./mibII/udpTable.lo: ../../include/net-snmp/library/system.h
+./mibII/udpTable.lo: ../../include/net-snmp/library/tools.h
+./mibII/udpTable.lo: ../../include/net-snmp/library/int64.h
+./mibII/udpTable.lo: ../../include/net-snmp/library/mt_support.h
+./mibII/udpTable.lo: ../../include/net-snmp/library/snmp_alarm.h
+./mibII/udpTable.lo: ../../include/net-snmp/library/data_list.h
+./mibII/udpTable.lo: ../../include/net-snmp/library/callback.h
+./mibII/udpTable.lo: ../../include/net-snmp/library/oid_stash.h
+./mibII/udpTable.lo: ../../include/net-snmp/library/check_varbind.h
+./mibII/udpTable.lo: ../../include/net-snmp/version.h
+./mibII/udpTable.lo: ../../include/net-snmp/session_api.h
+./mibII/udpTable.lo: ../../include/net-snmp/library/snmp_transport.h
+./mibII/udpTable.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./mibII/udpTable.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./mibII/udpTable.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./mibII/udpTable.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./mibII/udpTable.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./mibII/udpTable.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./mibII/udpTable.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./mibII/udpTable.lo: ../../include/net-snmp/library/ucd_compat.h
+./mibII/udpTable.lo: ../../include/net-snmp/pdu_api.h
+./mibII/udpTable.lo: ../../include/net-snmp/mib_api.h
+./mibII/udpTable.lo: ../../include/net-snmp/library/mib.h
+./mibII/udpTable.lo: ../../include/net-snmp/library/parse.h
+./mibII/udpTable.lo: ../../include/net-snmp/varbind_api.h
+./mibII/udpTable.lo: ../../include/net-snmp/config_api.h
+./mibII/udpTable.lo: ../../include/net-snmp/library/read_config.h
+./mibII/udpTable.lo: ../../include/net-snmp/library/default_store.h
+./mibII/udpTable.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./mibII/udpTable.lo: ../../include/net-snmp/library/snmp_enum.h
+./mibII/udpTable.lo: ../../include/net-snmp/library/vacm.h
+./mibII/udpTable.lo: ../../include/net-snmp/output_api.h
+./mibII/udpTable.lo: ../../include/net-snmp/library/snmp_debug.h
+./mibII/udpTable.lo: ../../include/net-snmp/library/snmp_logging.h
+./mibII/udpTable.lo: ../../include/net-snmp/snmpv3_api.h
+./mibII/udpTable.lo: ../../include/net-snmp/library/snmpv3.h
+./mibII/udpTable.lo: ../../include/net-snmp/library/transform_oids.h
+./mibII/udpTable.lo: ../../include/net-snmp/library/keytools.h
+./mibII/udpTable.lo: ../../include/net-snmp/library/scapi.h
+./mibII/udpTable.lo: ../../include/net-snmp/library/lcd_time.h
+./mibII/udpTable.lo: ../../include/net-snmp/library/snmp_secmod.h
+./mibII/udpTable.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./mibII/udpTable.lo: ../../include/net-snmp/library/snmpusm.h
+./mibII/udpTable.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./mibII/udpTable.lo: ../../include/net-snmp/agent/snmp_agent.h
+./mibII/udpTable.lo: ../../include/net-snmp/agent/snmp_vars.h
+./mibII/udpTable.lo: ../../include/net-snmp/agent/agent_handler.h
+./mibII/udpTable.lo: ../../include/net-snmp/agent/var_struct.h
+./mibII/udpTable.lo: ../../include/net-snmp/agent/agent_registry.h
+./mibII/udpTable.lo: ../../include/net-snmp/agent/ds_agent.h
+./mibII/udpTable.lo: ../../include/net-snmp/agent/agent_read_config.h
+./mibII/udpTable.lo: ../../include/net-snmp/agent/agent_trap.h
+./mibII/udpTable.lo: ../../include/net-snmp/agent/all_helpers.h
+./mibII/udpTable.lo: ../../include/net-snmp/agent/instance.h
+./mibII/udpTable.lo: ../../include/net-snmp/agent/multiplexer.h
+./mibII/udpTable.lo: ../../include/net-snmp/agent/null.h
+./mibII/udpTable.lo: ../../include/net-snmp/agent/debug_handler.h
+./mibII/udpTable.lo: ../../include/net-snmp/agent/old_api.h
+./mibII/udpTable.lo: ../../include/net-snmp/agent/read_only.h
+./mibII/udpTable.lo: ../../include/net-snmp/agent/serialize.h
+./mibII/udpTable.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./mibII/udpTable.lo: ../../include/net-snmp/agent/mode_end_call.h
+./mibII/udpTable.lo: ../../include/net-snmp/agent/table.h
+./mibII/udpTable.lo: ../../include/net-snmp/agent/table_data.h
+./mibII/udpTable.lo: ../../include/net-snmp/agent/table_dataset.h
+./mibII/udpTable.lo: ../../include/net-snmp/agent/table_iterator.h
+./mibII/udpTable.lo: ../../include/net-snmp/agent/mib_module_config.h
+./mibII/udpTable.lo: ../../include/net-snmp/agent/auto_nlist.h ./mibII/udp.h
+./mibII/udpTable.lo: ./mibII/udpTable.h ./mibII/sysORTable.h
+./mibII/vacm_context.lo: ../../include/net-snmp/net-snmp-config.h
+./mibII/vacm_context.lo: ../../include/net-snmp/system/linux.h
+./mibII/vacm_context.lo: ../../include/net-snmp/system/sysv.h
+./mibII/vacm_context.lo: ../../include/net-snmp/system/generic.h
+./mibII/vacm_context.lo: ../../include/net-snmp/machine/generic.h
+./mibII/vacm_context.lo: ../../include/net-snmp/net-snmp-includes.h
+./mibII/vacm_context.lo: ../../include/net-snmp/definitions.h
+./mibII/vacm_context.lo: ../../include/net-snmp/types.h
+./mibII/vacm_context.lo: ../../include/net-snmp/library/snmp_api.h
+./mibII/vacm_context.lo: ../../include/net-snmp/library/asn1.h
+./mibII/vacm_context.lo: ../../include/net-snmp/library/snmp_impl.h
+./mibII/vacm_context.lo: ../../include/net-snmp/library/snmp.h
+./mibII/vacm_context.lo: ../../include/net-snmp/library/snmp-tc.h
+./mibII/vacm_context.lo: ../../include/net-snmp/utilities.h
+./mibII/vacm_context.lo: ../../include/net-snmp/library/snmp_client.h
+./mibII/vacm_context.lo: ../../include/net-snmp/library/getopt.h
+./mibII/vacm_context.lo: ../../include/net-snmp/library/system.h
+./mibII/vacm_context.lo: ../../include/net-snmp/library/tools.h
+./mibII/vacm_context.lo: ../../include/net-snmp/library/int64.h
+./mibII/vacm_context.lo: ../../include/net-snmp/library/mt_support.h
+./mibII/vacm_context.lo: ../../include/net-snmp/library/snmp_alarm.h
+./mibII/vacm_context.lo: ../../include/net-snmp/library/data_list.h
+./mibII/vacm_context.lo: ../../include/net-snmp/library/callback.h
+./mibII/vacm_context.lo: ../../include/net-snmp/library/oid_stash.h
+./mibII/vacm_context.lo: ../../include/net-snmp/library/check_varbind.h
+./mibII/vacm_context.lo: ../../include/net-snmp/version.h
+./mibII/vacm_context.lo: ../../include/net-snmp/session_api.h
+./mibII/vacm_context.lo: ../../include/net-snmp/library/snmp_transport.h
+./mibII/vacm_context.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./mibII/vacm_context.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./mibII/vacm_context.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./mibII/vacm_context.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./mibII/vacm_context.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./mibII/vacm_context.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./mibII/vacm_context.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./mibII/vacm_context.lo: ../../include/net-snmp/library/ucd_compat.h
+./mibII/vacm_context.lo: ../../include/net-snmp/pdu_api.h
+./mibII/vacm_context.lo: ../../include/net-snmp/mib_api.h
+./mibII/vacm_context.lo: ../../include/net-snmp/library/mib.h
+./mibII/vacm_context.lo: ../../include/net-snmp/library/parse.h
+./mibII/vacm_context.lo: ../../include/net-snmp/varbind_api.h
+./mibII/vacm_context.lo: ../../include/net-snmp/config_api.h
+./mibII/vacm_context.lo: ../../include/net-snmp/library/read_config.h
+./mibII/vacm_context.lo: ../../include/net-snmp/library/default_store.h
+./mibII/vacm_context.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./mibII/vacm_context.lo: ../../include/net-snmp/library/snmp_enum.h
+./mibII/vacm_context.lo: ../../include/net-snmp/library/vacm.h
+./mibII/vacm_context.lo: ../../include/net-snmp/output_api.h
+./mibII/vacm_context.lo: ../../include/net-snmp/library/snmp_debug.h
+./mibII/vacm_context.lo: ../../include/net-snmp/library/snmp_logging.h
+./mibII/vacm_context.lo: ../../include/net-snmp/snmpv3_api.h
+./mibII/vacm_context.lo: ../../include/net-snmp/library/snmpv3.h
+./mibII/vacm_context.lo: ../../include/net-snmp/library/transform_oids.h
+./mibII/vacm_context.lo: ../../include/net-snmp/library/keytools.h
+./mibII/vacm_context.lo: ../../include/net-snmp/library/scapi.h
+./mibII/vacm_context.lo: ../../include/net-snmp/library/lcd_time.h
+./mibII/vacm_context.lo: ../../include/net-snmp/library/snmp_secmod.h
+./mibII/vacm_context.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./mibII/vacm_context.lo: ../../include/net-snmp/library/snmpusm.h
+./mibII/vacm_context.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./mibII/vacm_context.lo: ../../include/net-snmp/agent/snmp_agent.h
+./mibII/vacm_context.lo: ../../include/net-snmp/agent/snmp_vars.h
+./mibII/vacm_context.lo: ../../include/net-snmp/agent/agent_handler.h
+./mibII/vacm_context.lo: ../../include/net-snmp/agent/var_struct.h
+./mibII/vacm_context.lo: ../../include/net-snmp/agent/agent_registry.h
+./mibII/vacm_context.lo: ../../include/net-snmp/agent/ds_agent.h
+./mibII/vacm_context.lo: ../../include/net-snmp/agent/agent_read_config.h
+./mibII/vacm_context.lo: ../../include/net-snmp/agent/agent_trap.h
+./mibII/vacm_context.lo: ../../include/net-snmp/agent/all_helpers.h
+./mibII/vacm_context.lo: ../../include/net-snmp/agent/instance.h
+./mibII/vacm_context.lo: ../../include/net-snmp/agent/multiplexer.h
+./mibII/vacm_context.lo: ../../include/net-snmp/agent/null.h
+./mibII/vacm_context.lo: ../../include/net-snmp/agent/debug_handler.h
+./mibII/vacm_context.lo: ../../include/net-snmp/agent/old_api.h
+./mibII/vacm_context.lo: ../../include/net-snmp/agent/read_only.h
+./mibII/vacm_context.lo: ../../include/net-snmp/agent/serialize.h
+./mibII/vacm_context.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./mibII/vacm_context.lo: ../../include/net-snmp/agent/mode_end_call.h
+./mibII/vacm_context.lo: ../../include/net-snmp/agent/table.h
+./mibII/vacm_context.lo: ../../include/net-snmp/agent/table_data.h
+./mibII/vacm_context.lo: ../../include/net-snmp/agent/table_dataset.h
+./mibII/vacm_context.lo: ../../include/net-snmp/agent/table_iterator.h
+./mibII/vacm_context.lo: ../../include/net-snmp/agent/mib_module_config.h
+./mibII/vacm_context.lo: ./mibII/vacm_context.h
+./mibII/vacm_vars.lo: ../../include/net-snmp/net-snmp-config.h
+./mibII/vacm_vars.lo: ../../include/net-snmp/system/linux.h
+./mibII/vacm_vars.lo: ../../include/net-snmp/system/sysv.h
+./mibII/vacm_vars.lo: ../../include/net-snmp/system/generic.h
+./mibII/vacm_vars.lo: ../../include/net-snmp/machine/generic.h
+./mibII/vacm_vars.lo: ../../include/net-snmp/net-snmp-includes.h
+./mibII/vacm_vars.lo: ../../include/net-snmp/definitions.h
+./mibII/vacm_vars.lo: ../../include/net-snmp/types.h
+./mibII/vacm_vars.lo: ../../include/net-snmp/library/snmp_api.h
+./mibII/vacm_vars.lo: ../../include/net-snmp/library/asn1.h
+./mibII/vacm_vars.lo: ../../include/net-snmp/library/snmp_impl.h
+./mibII/vacm_vars.lo: ../../include/net-snmp/library/snmp.h
+./mibII/vacm_vars.lo: ../../include/net-snmp/library/snmp-tc.h
+./mibII/vacm_vars.lo: ../../include/net-snmp/utilities.h
+./mibII/vacm_vars.lo: ../../include/net-snmp/library/snmp_client.h
+./mibII/vacm_vars.lo: ../../include/net-snmp/library/getopt.h
+./mibII/vacm_vars.lo: ../../include/net-snmp/library/system.h
+./mibII/vacm_vars.lo: ../../include/net-snmp/library/tools.h
+./mibII/vacm_vars.lo: ../../include/net-snmp/library/int64.h
+./mibII/vacm_vars.lo: ../../include/net-snmp/library/mt_support.h
+./mibII/vacm_vars.lo: ../../include/net-snmp/library/snmp_alarm.h
+./mibII/vacm_vars.lo: ../../include/net-snmp/library/data_list.h
+./mibII/vacm_vars.lo: ../../include/net-snmp/library/callback.h
+./mibII/vacm_vars.lo: ../../include/net-snmp/library/oid_stash.h
+./mibII/vacm_vars.lo: ../../include/net-snmp/library/check_varbind.h
+./mibII/vacm_vars.lo: ../../include/net-snmp/version.h
+./mibII/vacm_vars.lo: ../../include/net-snmp/session_api.h
+./mibII/vacm_vars.lo: ../../include/net-snmp/library/snmp_transport.h
+./mibII/vacm_vars.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./mibII/vacm_vars.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./mibII/vacm_vars.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./mibII/vacm_vars.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./mibII/vacm_vars.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./mibII/vacm_vars.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./mibII/vacm_vars.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./mibII/vacm_vars.lo: ../../include/net-snmp/library/ucd_compat.h
+./mibII/vacm_vars.lo: ../../include/net-snmp/pdu_api.h
+./mibII/vacm_vars.lo: ../../include/net-snmp/mib_api.h
+./mibII/vacm_vars.lo: ../../include/net-snmp/library/mib.h
+./mibII/vacm_vars.lo: ../../include/net-snmp/library/parse.h
+./mibII/vacm_vars.lo: ../../include/net-snmp/varbind_api.h
+./mibII/vacm_vars.lo: ../../include/net-snmp/config_api.h
+./mibII/vacm_vars.lo: ../../include/net-snmp/library/read_config.h
+./mibII/vacm_vars.lo: ../../include/net-snmp/library/default_store.h
+./mibII/vacm_vars.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./mibII/vacm_vars.lo: ../../include/net-snmp/library/snmp_enum.h
+./mibII/vacm_vars.lo: ../../include/net-snmp/library/vacm.h
+./mibII/vacm_vars.lo: ../../include/net-snmp/output_api.h
+./mibII/vacm_vars.lo: ../../include/net-snmp/library/snmp_debug.h
+./mibII/vacm_vars.lo: ../../include/net-snmp/library/snmp_logging.h
+./mibII/vacm_vars.lo: ../../include/net-snmp/snmpv3_api.h
+./mibII/vacm_vars.lo: ../../include/net-snmp/library/snmpv3.h
+./mibII/vacm_vars.lo: ../../include/net-snmp/library/transform_oids.h
+./mibII/vacm_vars.lo: ../../include/net-snmp/library/keytools.h
+./mibII/vacm_vars.lo: ../../include/net-snmp/library/scapi.h
+./mibII/vacm_vars.lo: ../../include/net-snmp/library/lcd_time.h
+./mibII/vacm_vars.lo: ../../include/net-snmp/library/snmp_secmod.h
+./mibII/vacm_vars.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./mibII/vacm_vars.lo: ../../include/net-snmp/library/snmpusm.h
+./mibII/vacm_vars.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./mibII/vacm_vars.lo: ../../include/net-snmp/agent/snmp_agent.h
+./mibII/vacm_vars.lo: ../../include/net-snmp/agent/snmp_vars.h
+./mibII/vacm_vars.lo: ../../include/net-snmp/agent/agent_handler.h
+./mibII/vacm_vars.lo: ../../include/net-snmp/agent/var_struct.h
+./mibII/vacm_vars.lo: ../../include/net-snmp/agent/agent_registry.h
+./mibII/vacm_vars.lo: ../../include/net-snmp/agent/ds_agent.h
+./mibII/vacm_vars.lo: ../../include/net-snmp/agent/agent_read_config.h
+./mibII/vacm_vars.lo: ../../include/net-snmp/agent/agent_trap.h
+./mibII/vacm_vars.lo: ../../include/net-snmp/agent/all_helpers.h
+./mibII/vacm_vars.lo: ../../include/net-snmp/agent/instance.h
+./mibII/vacm_vars.lo: ../../include/net-snmp/agent/multiplexer.h
+./mibII/vacm_vars.lo: ../../include/net-snmp/agent/null.h
+./mibII/vacm_vars.lo: ../../include/net-snmp/agent/debug_handler.h
+./mibII/vacm_vars.lo: ../../include/net-snmp/agent/old_api.h
+./mibII/vacm_vars.lo: ../../include/net-snmp/agent/read_only.h
+./mibII/vacm_vars.lo: ../../include/net-snmp/agent/serialize.h
+./mibII/vacm_vars.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./mibII/vacm_vars.lo: ../../include/net-snmp/agent/mode_end_call.h
+./mibII/vacm_vars.lo: ../../include/net-snmp/agent/table.h
+./mibII/vacm_vars.lo: ../../include/net-snmp/agent/table_data.h
+./mibII/vacm_vars.lo: ../../include/net-snmp/agent/table_dataset.h
+./mibII/vacm_vars.lo: ../../include/net-snmp/agent/table_iterator.h
+./mibII/vacm_vars.lo: ../../include/net-snmp/agent/mib_module_config.h
+./mibII/vacm_vars.lo: ../../include/net-snmp/agent/agent_callbacks.h
+./mibII/vacm_vars.lo: ./mibII/vacm_vars.h util_funcs.h struct.h
+./mibII/vacm_vars.lo: ./mibII/sysORTable.h
+./mibII/var_route.lo: ../../include/net-snmp/net-snmp-config.h
+./mibII/var_route.lo: ../../include/net-snmp/system/linux.h
+./mibII/var_route.lo: ../../include/net-snmp/system/sysv.h
+./mibII/var_route.lo: ../../include/net-snmp/system/generic.h
+./mibII/var_route.lo: ../../include/net-snmp/machine/generic.h
+./mibII/var_route.lo: ../../include/net-snmp/net-snmp-includes.h
+./mibII/var_route.lo: ../../include/net-snmp/definitions.h
+./mibII/var_route.lo: ../../include/net-snmp/types.h
+./mibII/var_route.lo: ../../include/net-snmp/library/snmp_api.h
+./mibII/var_route.lo: ../../include/net-snmp/library/asn1.h
+./mibII/var_route.lo: ../../include/net-snmp/library/snmp_impl.h
+./mibII/var_route.lo: ../../include/net-snmp/library/snmp.h
+./mibII/var_route.lo: ../../include/net-snmp/library/snmp-tc.h
+./mibII/var_route.lo: ../../include/net-snmp/utilities.h
+./mibII/var_route.lo: ../../include/net-snmp/library/snmp_client.h
+./mibII/var_route.lo: ../../include/net-snmp/library/getopt.h
+./mibII/var_route.lo: ../../include/net-snmp/library/system.h
+./mibII/var_route.lo: ../../include/net-snmp/library/tools.h
+./mibII/var_route.lo: ../../include/net-snmp/library/int64.h
+./mibII/var_route.lo: ../../include/net-snmp/library/mt_support.h
+./mibII/var_route.lo: ../../include/net-snmp/library/snmp_alarm.h
+./mibII/var_route.lo: ../../include/net-snmp/library/data_list.h
+./mibII/var_route.lo: ../../include/net-snmp/library/callback.h
+./mibII/var_route.lo: ../../include/net-snmp/library/oid_stash.h
+./mibII/var_route.lo: ../../include/net-snmp/library/check_varbind.h
+./mibII/var_route.lo: ../../include/net-snmp/version.h
+./mibII/var_route.lo: ../../include/net-snmp/session_api.h
+./mibII/var_route.lo: ../../include/net-snmp/library/snmp_transport.h
+./mibII/var_route.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./mibII/var_route.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./mibII/var_route.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./mibII/var_route.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./mibII/var_route.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./mibII/var_route.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./mibII/var_route.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./mibII/var_route.lo: ../../include/net-snmp/library/ucd_compat.h
+./mibII/var_route.lo: ../../include/net-snmp/pdu_api.h
+./mibII/var_route.lo: ../../include/net-snmp/mib_api.h
+./mibII/var_route.lo: ../../include/net-snmp/library/mib.h
+./mibII/var_route.lo: ../../include/net-snmp/library/parse.h
+./mibII/var_route.lo: ../../include/net-snmp/varbind_api.h
+./mibII/var_route.lo: ../../include/net-snmp/config_api.h
+./mibII/var_route.lo: ../../include/net-snmp/library/read_config.h
+./mibII/var_route.lo: ../../include/net-snmp/library/default_store.h
+./mibII/var_route.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./mibII/var_route.lo: ../../include/net-snmp/library/snmp_enum.h
+./mibII/var_route.lo: ../../include/net-snmp/library/vacm.h
+./mibII/var_route.lo: ../../include/net-snmp/output_api.h
+./mibII/var_route.lo: ../../include/net-snmp/library/snmp_debug.h
+./mibII/var_route.lo: ../../include/net-snmp/library/snmp_logging.h
+./mibII/var_route.lo: ../../include/net-snmp/snmpv3_api.h
+./mibII/var_route.lo: ../../include/net-snmp/library/snmpv3.h
+./mibII/var_route.lo: ../../include/net-snmp/library/transform_oids.h
+./mibII/var_route.lo: ../../include/net-snmp/library/keytools.h
+./mibII/var_route.lo: ../../include/net-snmp/library/scapi.h
+./mibII/var_route.lo: ../../include/net-snmp/library/lcd_time.h
+./mibII/var_route.lo: ../../include/net-snmp/library/snmp_secmod.h
+./mibII/var_route.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./mibII/var_route.lo: ../../include/net-snmp/library/snmpusm.h
+./mibII/var_route.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./mibII/var_route.lo: ../../include/net-snmp/agent/snmp_agent.h
+./mibII/var_route.lo: ../../include/net-snmp/agent/snmp_vars.h
+./mibII/var_route.lo: ../../include/net-snmp/agent/agent_handler.h
+./mibII/var_route.lo: ../../include/net-snmp/agent/var_struct.h
+./mibII/var_route.lo: ../../include/net-snmp/agent/agent_registry.h
+./mibII/var_route.lo: ../../include/net-snmp/agent/ds_agent.h
+./mibII/var_route.lo: ../../include/net-snmp/agent/agent_read_config.h
+./mibII/var_route.lo: ../../include/net-snmp/agent/agent_trap.h
+./mibII/var_route.lo: ../../include/net-snmp/agent/all_helpers.h
+./mibII/var_route.lo: ../../include/net-snmp/agent/instance.h
+./mibII/var_route.lo: ../../include/net-snmp/agent/multiplexer.h
+./mibII/var_route.lo: ../../include/net-snmp/agent/null.h
+./mibII/var_route.lo: ../../include/net-snmp/agent/debug_handler.h
+./mibII/var_route.lo: ../../include/net-snmp/agent/old_api.h
+./mibII/var_route.lo: ../../include/net-snmp/agent/read_only.h
+./mibII/var_route.lo: ../../include/net-snmp/agent/serialize.h
+./mibII/var_route.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./mibII/var_route.lo: ../../include/net-snmp/agent/mode_end_call.h
+./mibII/var_route.lo: ../../include/net-snmp/agent/table.h
+./mibII/var_route.lo: ../../include/net-snmp/agent/table_data.h
+./mibII/var_route.lo: ../../include/net-snmp/agent/table_dataset.h
+./mibII/var_route.lo: ../../include/net-snmp/agent/table_iterator.h
+./mibII/var_route.lo: ../../include/net-snmp/agent/mib_module_config.h
+./mibII/var_route.lo: ../../include/net-snmp/agent/auto_nlist.h ./mibII/ip.h
+./mibII/var_route.lo: ./mibII/var_route.h ./mibII/route_write.h ./mibII/at.h
+./mibII/var_route.lo: ./../kernel.h ./mibII/interfaces.h struct.h
+./mibII/var_route.lo: util_funcs.h
+./misc/dlmod.lo: ../../include/net-snmp/net-snmp-config.h
+./misc/dlmod.lo: ../../include/net-snmp/system/linux.h
+./misc/dlmod.lo: ../../include/net-snmp/system/sysv.h
+./misc/dlmod.lo: ../../include/net-snmp/system/generic.h
+./misc/dlmod.lo: ../../include/net-snmp/machine/generic.h
+./misc/dlmod.lo: ../../include/net-snmp/net-snmp-includes.h
+./misc/dlmod.lo:  ../../include/net-snmp/definitions.h
+./misc/dlmod.lo: ../../include/net-snmp/types.h
+./misc/dlmod.lo: ../../include/net-snmp/library/snmp_api.h
+./misc/dlmod.lo: ../../include/net-snmp/library/asn1.h
+./misc/dlmod.lo: ../../include/net-snmp/library/snmp_impl.h
+./misc/dlmod.lo: ../../include/net-snmp/library/snmp.h
+./misc/dlmod.lo: ../../include/net-snmp/library/snmp-tc.h
+./misc/dlmod.lo: ../../include/net-snmp/utilities.h
+./misc/dlmod.lo: ../../include/net-snmp/library/snmp_client.h
+./misc/dlmod.lo: ../../include/net-snmp/library/getopt.h
+./misc/dlmod.lo: ../../include/net-snmp/library/system.h
+./misc/dlmod.lo: ../../include/net-snmp/library/tools.h
+./misc/dlmod.lo: ../../include/net-snmp/library/int64.h
+./misc/dlmod.lo: ../../include/net-snmp/library/mt_support.h
+./misc/dlmod.lo: ../../include/net-snmp/library/snmp_alarm.h
+./misc/dlmod.lo: ../../include/net-snmp/library/data_list.h
+./misc/dlmod.lo: ../../include/net-snmp/library/callback.h
+./misc/dlmod.lo: ../../include/net-snmp/library/oid_stash.h
+./misc/dlmod.lo: ../../include/net-snmp/library/check_varbind.h
+./misc/dlmod.lo: ../../include/net-snmp/version.h
+./misc/dlmod.lo: ../../include/net-snmp/session_api.h
+./misc/dlmod.lo: ../../include/net-snmp/library/snmp_transport.h
+./misc/dlmod.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./misc/dlmod.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./misc/dlmod.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./misc/dlmod.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./misc/dlmod.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./misc/dlmod.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./misc/dlmod.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./misc/dlmod.lo: ../../include/net-snmp/library/ucd_compat.h
+./misc/dlmod.lo: ../../include/net-snmp/pdu_api.h
+./misc/dlmod.lo: ../../include/net-snmp/mib_api.h
+./misc/dlmod.lo: ../../include/net-snmp/library/mib.h
+./misc/dlmod.lo: ../../include/net-snmp/library/parse.h
+./misc/dlmod.lo: ../../include/net-snmp/varbind_api.h
+./misc/dlmod.lo: ../../include/net-snmp/config_api.h
+./misc/dlmod.lo: ../../include/net-snmp/library/read_config.h
+./misc/dlmod.lo: ../../include/net-snmp/library/default_store.h
+./misc/dlmod.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./misc/dlmod.lo: ../../include/net-snmp/library/snmp_enum.h
+./misc/dlmod.lo: ../../include/net-snmp/library/vacm.h
+./misc/dlmod.lo: ../../include/net-snmp/output_api.h
+./misc/dlmod.lo: ../../include/net-snmp/library/snmp_debug.h
+./misc/dlmod.lo: ../../include/net-snmp/library/snmp_logging.h
+./misc/dlmod.lo: ../../include/net-snmp/snmpv3_api.h
+./misc/dlmod.lo: ../../include/net-snmp/library/snmpv3.h
+./misc/dlmod.lo: ../../include/net-snmp/library/transform_oids.h
+./misc/dlmod.lo: ../../include/net-snmp/library/keytools.h
+./misc/dlmod.lo: ../../include/net-snmp/library/scapi.h
+./misc/dlmod.lo: ../../include/net-snmp/library/lcd_time.h
+./misc/dlmod.lo: ../../include/net-snmp/library/snmp_secmod.h
+./misc/dlmod.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./misc/dlmod.lo: ../../include/net-snmp/library/snmpusm.h
+./misc/dlmod.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./misc/dlmod.lo: ../../include/net-snmp/agent/snmp_agent.h
+./misc/dlmod.lo: ../../include/net-snmp/agent/snmp_vars.h
+./misc/dlmod.lo: ../../include/net-snmp/agent/agent_handler.h
+./misc/dlmod.lo: ../../include/net-snmp/agent/var_struct.h
+./misc/dlmod.lo: ../../include/net-snmp/agent/agent_registry.h
+./misc/dlmod.lo: ../../include/net-snmp/agent/ds_agent.h
+./misc/dlmod.lo: ../../include/net-snmp/agent/agent_read_config.h
+./misc/dlmod.lo: ../../include/net-snmp/agent/agent_trap.h
+./misc/dlmod.lo: ../../include/net-snmp/agent/all_helpers.h
+./misc/dlmod.lo: ../../include/net-snmp/agent/instance.h
+./misc/dlmod.lo: ../../include/net-snmp/agent/multiplexer.h
+./misc/dlmod.lo: ../../include/net-snmp/agent/null.h
+./misc/dlmod.lo: ../../include/net-snmp/agent/debug_handler.h
+./misc/dlmod.lo: ../../include/net-snmp/agent/old_api.h
+./misc/dlmod.lo: ../../include/net-snmp/agent/read_only.h
+./misc/dlmod.lo: ../../include/net-snmp/agent/serialize.h
+./misc/dlmod.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./misc/dlmod.lo: ../../include/net-snmp/agent/mode_end_call.h
+./misc/dlmod.lo: ../../include/net-snmp/agent/table.h
+./misc/dlmod.lo: ../../include/net-snmp/agent/table_data.h
+./misc/dlmod.lo: ../../include/net-snmp/agent/table_dataset.h
+./misc/dlmod.lo: ../../include/net-snmp/agent/table_iterator.h
+./misc/dlmod.lo: ../../include/net-snmp/agent/mib_module_config.h struct.h
+./misc/dlmod.lo: ./misc/dlmod.h mibdefs.h
+./misc/ipfwacc.lo: ../../include/net-snmp/net-snmp-config.h
+./misc/ipfwacc.lo: ../../include/net-snmp/system/linux.h
+./misc/ipfwacc.lo: ../../include/net-snmp/system/sysv.h
+./misc/ipfwacc.lo: ../../include/net-snmp/system/generic.h
+./misc/ipfwacc.lo: ../../include/net-snmp/machine/generic.h
+./misc/ipfwacc.lo: ../../include/net-snmp/net-snmp-includes.h
+./misc/ipfwacc.lo: ../../include/net-snmp/definitions.h
+./misc/ipfwacc.lo: ../../include/net-snmp/types.h
+./misc/ipfwacc.lo: ../../include/net-snmp/library/snmp_api.h
+./misc/ipfwacc.lo: ../../include/net-snmp/library/asn1.h
+./misc/ipfwacc.lo: ../../include/net-snmp/library/snmp_impl.h
+./misc/ipfwacc.lo: ../../include/net-snmp/library/snmp.h
+./misc/ipfwacc.lo: ../../include/net-snmp/library/snmp-tc.h
+./misc/ipfwacc.lo: ../../include/net-snmp/utilities.h
+./misc/ipfwacc.lo: ../../include/net-snmp/library/snmp_client.h
+./misc/ipfwacc.lo: ../../include/net-snmp/library/getopt.h
+./misc/ipfwacc.lo: ../../include/net-snmp/library/system.h
+./misc/ipfwacc.lo: ../../include/net-snmp/library/tools.h
+./misc/ipfwacc.lo: ../../include/net-snmp/library/int64.h
+./misc/ipfwacc.lo: ../../include/net-snmp/library/mt_support.h
+./misc/ipfwacc.lo: ../../include/net-snmp/library/snmp_alarm.h
+./misc/ipfwacc.lo: ../../include/net-snmp/library/data_list.h
+./misc/ipfwacc.lo: ../../include/net-snmp/library/callback.h
+./misc/ipfwacc.lo: ../../include/net-snmp/library/oid_stash.h
+./misc/ipfwacc.lo: ../../include/net-snmp/library/check_varbind.h
+./misc/ipfwacc.lo: ../../include/net-snmp/version.h
+./misc/ipfwacc.lo: ../../include/net-snmp/session_api.h
+./misc/ipfwacc.lo: ../../include/net-snmp/library/snmp_transport.h
+./misc/ipfwacc.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./misc/ipfwacc.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./misc/ipfwacc.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./misc/ipfwacc.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./misc/ipfwacc.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./misc/ipfwacc.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./misc/ipfwacc.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./misc/ipfwacc.lo: ../../include/net-snmp/library/ucd_compat.h
+./misc/ipfwacc.lo: ../../include/net-snmp/pdu_api.h
+./misc/ipfwacc.lo: ../../include/net-snmp/mib_api.h
+./misc/ipfwacc.lo: ../../include/net-snmp/library/mib.h
+./misc/ipfwacc.lo: ../../include/net-snmp/library/parse.h
+./misc/ipfwacc.lo: ../../include/net-snmp/varbind_api.h
+./misc/ipfwacc.lo: ../../include/net-snmp/config_api.h
+./misc/ipfwacc.lo: ../../include/net-snmp/library/read_config.h
+./misc/ipfwacc.lo: ../../include/net-snmp/library/default_store.h
+./misc/ipfwacc.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./misc/ipfwacc.lo: ../../include/net-snmp/library/snmp_enum.h
+./misc/ipfwacc.lo: ../../include/net-snmp/library/vacm.h
+./misc/ipfwacc.lo: ../../include/net-snmp/output_api.h
+./misc/ipfwacc.lo: ../../include/net-snmp/library/snmp_debug.h
+./misc/ipfwacc.lo: ../../include/net-snmp/library/snmp_logging.h
+./misc/ipfwacc.lo: ../../include/net-snmp/snmpv3_api.h
+./misc/ipfwacc.lo: ../../include/net-snmp/library/snmpv3.h
+./misc/ipfwacc.lo: ../../include/net-snmp/library/transform_oids.h
+./misc/ipfwacc.lo: ../../include/net-snmp/library/keytools.h
+./misc/ipfwacc.lo: ../../include/net-snmp/library/scapi.h
+./misc/ipfwacc.lo: ../../include/net-snmp/library/lcd_time.h
+./misc/ipfwacc.lo: ../../include/net-snmp/library/snmp_secmod.h
+./misc/ipfwacc.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./misc/ipfwacc.lo: ../../include/net-snmp/library/snmpusm.h
+./misc/ipfwacc.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./misc/ipfwacc.lo: ../../include/net-snmp/agent/snmp_agent.h
+./misc/ipfwacc.lo: ../../include/net-snmp/agent/snmp_vars.h
+./misc/ipfwacc.lo: ../../include/net-snmp/agent/agent_handler.h
+./misc/ipfwacc.lo: ../../include/net-snmp/agent/var_struct.h
+./misc/ipfwacc.lo: ../../include/net-snmp/agent/agent_registry.h
+./misc/ipfwacc.lo: ../../include/net-snmp/agent/ds_agent.h
+./misc/ipfwacc.lo: ../../include/net-snmp/agent/agent_read_config.h
+./misc/ipfwacc.lo: ../../include/net-snmp/agent/agent_trap.h
+./misc/ipfwacc.lo: ../../include/net-snmp/agent/all_helpers.h
+./misc/ipfwacc.lo: ../../include/net-snmp/agent/instance.h
+./misc/ipfwacc.lo: ../../include/net-snmp/agent/multiplexer.h
+./misc/ipfwacc.lo: ../../include/net-snmp/agent/null.h
+./misc/ipfwacc.lo: ../../include/net-snmp/agent/debug_handler.h
+./misc/ipfwacc.lo: ../../include/net-snmp/agent/old_api.h
+./misc/ipfwacc.lo: ../../include/net-snmp/agent/read_only.h
+./misc/ipfwacc.lo: ../../include/net-snmp/agent/serialize.h
+./misc/ipfwacc.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./misc/ipfwacc.lo: ../../include/net-snmp/agent/mode_end_call.h
+./misc/ipfwacc.lo: ../../include/net-snmp/agent/table.h
+./misc/ipfwacc.lo: ../../include/net-snmp/agent/table_data.h
+./misc/ipfwacc.lo: ../../include/net-snmp/agent/table_dataset.h
+./misc/ipfwacc.lo: ../../include/net-snmp/agent/table_iterator.h
+./misc/ipfwacc.lo: ../../include/net-snmp/agent/mib_module_config.h
+./misc/ipfwacc.lo: util_funcs.h struct.h ./misc/ipfwacc.h
+./notification/snmpNotifyFilterProfileTable.lo: ../../include/net-snmp/net-snmp-config.h
+./notification/snmpNotifyFilterProfileTable.lo: ../../include/net-snmp/system/linux.h
+./notification/snmpNotifyFilterProfileTable.lo: ../../include/net-snmp/system/sysv.h
+./notification/snmpNotifyFilterProfileTable.lo: ../../include/net-snmp/system/generic.h
+./notification/snmpNotifyFilterProfileTable.lo: ../../include/net-snmp/machine/generic.h
+./notification/snmpNotifyFilterProfileTable.lo: ../../include/net-snmp/net-snmp-includes.h
+./notification/snmpNotifyFilterProfileTable.lo: ../../include/net-snmp/definitions.h
+./notification/snmpNotifyFilterProfileTable.lo: ../../include/net-snmp/types.h
+./notification/snmpNotifyFilterProfileTable.lo: ../../include/net-snmp/library/snmp_api.h
+./notification/snmpNotifyFilterProfileTable.lo: ../../include/net-snmp/library/asn1.h
+./notification/snmpNotifyFilterProfileTable.lo: ../../include/net-snmp/library/snmp_impl.h
+./notification/snmpNotifyFilterProfileTable.lo: ../../include/net-snmp/library/snmp.h
+./notification/snmpNotifyFilterProfileTable.lo: ../../include/net-snmp/library/snmp-tc.h
+./notification/snmpNotifyFilterProfileTable.lo: ../../include/net-snmp/utilities.h
+./notification/snmpNotifyFilterProfileTable.lo: ../../include/net-snmp/library/snmp_client.h
+./notification/snmpNotifyFilterProfileTable.lo: ../../include/net-snmp/library/getopt.h
+./notification/snmpNotifyFilterProfileTable.lo: ../../include/net-snmp/library/system.h
+./notification/snmpNotifyFilterProfileTable.lo: ../../include/net-snmp/library/tools.h
+./notification/snmpNotifyFilterProfileTable.lo: ../../include/net-snmp/library/int64.h
+./notification/snmpNotifyFilterProfileTable.lo: ../../include/net-snmp/library/mt_support.h
+./notification/snmpNotifyFilterProfileTable.lo: ../../include/net-snmp/library/snmp_alarm.h
+./notification/snmpNotifyFilterProfileTable.lo: ../../include/net-snmp/library/data_list.h
+./notification/snmpNotifyFilterProfileTable.lo: ../../include/net-snmp/library/callback.h
+./notification/snmpNotifyFilterProfileTable.lo: ../../include/net-snmp/library/oid_stash.h
+./notification/snmpNotifyFilterProfileTable.lo: ../../include/net-snmp/library/check_varbind.h
+./notification/snmpNotifyFilterProfileTable.lo: ../../include/net-snmp/version.h
+./notification/snmpNotifyFilterProfileTable.lo: ../../include/net-snmp/session_api.h
+./notification/snmpNotifyFilterProfileTable.lo: ../../include/net-snmp/library/snmp_transport.h
+./notification/snmpNotifyFilterProfileTable.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./notification/snmpNotifyFilterProfileTable.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./notification/snmpNotifyFilterProfileTable.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./notification/snmpNotifyFilterProfileTable.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./notification/snmpNotifyFilterProfileTable.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./notification/snmpNotifyFilterProfileTable.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./notification/snmpNotifyFilterProfileTable.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./notification/snmpNotifyFilterProfileTable.lo: ../../include/net-snmp/library/ucd_compat.h
+./notification/snmpNotifyFilterProfileTable.lo: ../../include/net-snmp/pdu_api.h
+./notification/snmpNotifyFilterProfileTable.lo: ../../include/net-snmp/mib_api.h
+./notification/snmpNotifyFilterProfileTable.lo: ../../include/net-snmp/library/mib.h
+./notification/snmpNotifyFilterProfileTable.lo: ../../include/net-snmp/library/parse.h
+./notification/snmpNotifyFilterProfileTable.lo: ../../include/net-snmp/varbind_api.h
+./notification/snmpNotifyFilterProfileTable.lo: ../../include/net-snmp/config_api.h
+./notification/snmpNotifyFilterProfileTable.lo: ../../include/net-snmp/library/read_config.h
+./notification/snmpNotifyFilterProfileTable.lo: ../../include/net-snmp/library/default_store.h
+./notification/snmpNotifyFilterProfileTable.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./notification/snmpNotifyFilterProfileTable.lo: ../../include/net-snmp/library/snmp_enum.h
+./notification/snmpNotifyFilterProfileTable.lo: ../../include/net-snmp/library/vacm.h
+./notification/snmpNotifyFilterProfileTable.lo: ../../include/net-snmp/output_api.h
+./notification/snmpNotifyFilterProfileTable.lo: ../../include/net-snmp/library/snmp_debug.h
+./notification/snmpNotifyFilterProfileTable.lo: ../../include/net-snmp/library/snmp_logging.h
+./notification/snmpNotifyFilterProfileTable.lo: ../../include/net-snmp/snmpv3_api.h
+./notification/snmpNotifyFilterProfileTable.lo: ../../include/net-snmp/library/snmpv3.h
+./notification/snmpNotifyFilterProfileTable.lo: ../../include/net-snmp/library/transform_oids.h
+./notification/snmpNotifyFilterProfileTable.lo: ../../include/net-snmp/library/keytools.h
+./notification/snmpNotifyFilterProfileTable.lo: ../../include/net-snmp/library/scapi.h
+./notification/snmpNotifyFilterProfileTable.lo: ../../include/net-snmp/library/lcd_time.h
+./notification/snmpNotifyFilterProfileTable.lo: ../../include/net-snmp/library/snmp_secmod.h
+./notification/snmpNotifyFilterProfileTable.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./notification/snmpNotifyFilterProfileTable.lo: ../../include/net-snmp/library/snmpusm.h
+./notification/snmpNotifyFilterProfileTable.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./notification/snmpNotifyFilterProfileTable.lo: ../../include/net-snmp/agent/snmp_agent.h
+./notification/snmpNotifyFilterProfileTable.lo: ../../include/net-snmp/agent/snmp_vars.h
+./notification/snmpNotifyFilterProfileTable.lo: ../../include/net-snmp/agent/agent_handler.h
+./notification/snmpNotifyFilterProfileTable.lo: ../../include/net-snmp/agent/var_struct.h
+./notification/snmpNotifyFilterProfileTable.lo: ../../include/net-snmp/agent/agent_registry.h
+./notification/snmpNotifyFilterProfileTable.lo: ../../include/net-snmp/agent/ds_agent.h
+./notification/snmpNotifyFilterProfileTable.lo: ../../include/net-snmp/agent/agent_read_config.h
+./notification/snmpNotifyFilterProfileTable.lo: ../../include/net-snmp/agent/agent_trap.h
+./notification/snmpNotifyFilterProfileTable.lo: ../../include/net-snmp/agent/all_helpers.h
+./notification/snmpNotifyFilterProfileTable.lo: ../../include/net-snmp/agent/instance.h
+./notification/snmpNotifyFilterProfileTable.lo: ../../include/net-snmp/agent/multiplexer.h
+./notification/snmpNotifyFilterProfileTable.lo: ../../include/net-snmp/agent/null.h
+./notification/snmpNotifyFilterProfileTable.lo: ../../include/net-snmp/agent/debug_handler.h
+./notification/snmpNotifyFilterProfileTable.lo: ../../include/net-snmp/agent/old_api.h
+./notification/snmpNotifyFilterProfileTable.lo: ../../include/net-snmp/agent/read_only.h
+./notification/snmpNotifyFilterProfileTable.lo: ../../include/net-snmp/agent/serialize.h
+./notification/snmpNotifyFilterProfileTable.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./notification/snmpNotifyFilterProfileTable.lo: ../../include/net-snmp/agent/mode_end_call.h
+./notification/snmpNotifyFilterProfileTable.lo: ../../include/net-snmp/agent/table.h
+./notification/snmpNotifyFilterProfileTable.lo: ../../include/net-snmp/agent/table_data.h
+./notification/snmpNotifyFilterProfileTable.lo: ../../include/net-snmp/agent/table_dataset.h
+./notification/snmpNotifyFilterProfileTable.lo: ../../include/net-snmp/agent/table_iterator.h
+./notification/snmpNotifyFilterProfileTable.lo: ../../include/net-snmp/agent/mib_module_config.h
+./notification/snmpNotifyFilterProfileTable.lo: header_complex.h
+./notification/snmpNotifyFilterProfileTable.lo: ./notification/snmpNotifyFilterProfileTable.h
+./notification/snmpNotifyFilterTable.lo: ../../include/net-snmp/net-snmp-config.h
+./notification/snmpNotifyFilterTable.lo: ../../include/net-snmp/system/linux.h
+./notification/snmpNotifyFilterTable.lo: ../../include/net-snmp/system/sysv.h
+./notification/snmpNotifyFilterTable.lo: ../../include/net-snmp/system/generic.h
+./notification/snmpNotifyFilterTable.lo: ../../include/net-snmp/machine/generic.h
+./notification/snmpNotifyFilterTable.lo: ../../include/net-snmp/net-snmp-includes.h
+./notification/snmpNotifyFilterTable.lo: ../../include/net-snmp/definitions.h
+./notification/snmpNotifyFilterTable.lo: ../../include/net-snmp/types.h
+./notification/snmpNotifyFilterTable.lo: ../../include/net-snmp/library/snmp_api.h
+./notification/snmpNotifyFilterTable.lo: ../../include/net-snmp/library/asn1.h
+./notification/snmpNotifyFilterTable.lo: ../../include/net-snmp/library/snmp_impl.h
+./notification/snmpNotifyFilterTable.lo: ../../include/net-snmp/library/snmp.h
+./notification/snmpNotifyFilterTable.lo: ../../include/net-snmp/library/snmp-tc.h
+./notification/snmpNotifyFilterTable.lo: ../../include/net-snmp/utilities.h
+./notification/snmpNotifyFilterTable.lo: ../../include/net-snmp/library/snmp_client.h
+./notification/snmpNotifyFilterTable.lo: ../../include/net-snmp/library/getopt.h
+./notification/snmpNotifyFilterTable.lo: ../../include/net-snmp/library/system.h
+./notification/snmpNotifyFilterTable.lo: ../../include/net-snmp/library/tools.h
+./notification/snmpNotifyFilterTable.lo: ../../include/net-snmp/library/int64.h
+./notification/snmpNotifyFilterTable.lo: ../../include/net-snmp/library/mt_support.h
+./notification/snmpNotifyFilterTable.lo: ../../include/net-snmp/library/snmp_alarm.h
+./notification/snmpNotifyFilterTable.lo: ../../include/net-snmp/library/data_list.h
+./notification/snmpNotifyFilterTable.lo: ../../include/net-snmp/library/callback.h
+./notification/snmpNotifyFilterTable.lo: ../../include/net-snmp/library/oid_stash.h
+./notification/snmpNotifyFilterTable.lo: ../../include/net-snmp/library/check_varbind.h
+./notification/snmpNotifyFilterTable.lo: ../../include/net-snmp/version.h
+./notification/snmpNotifyFilterTable.lo: ../../include/net-snmp/session_api.h
+./notification/snmpNotifyFilterTable.lo: ../../include/net-snmp/library/snmp_transport.h
+./notification/snmpNotifyFilterTable.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./notification/snmpNotifyFilterTable.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./notification/snmpNotifyFilterTable.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./notification/snmpNotifyFilterTable.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./notification/snmpNotifyFilterTable.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./notification/snmpNotifyFilterTable.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./notification/snmpNotifyFilterTable.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./notification/snmpNotifyFilterTable.lo: ../../include/net-snmp/library/ucd_compat.h
+./notification/snmpNotifyFilterTable.lo: ../../include/net-snmp/pdu_api.h
+./notification/snmpNotifyFilterTable.lo: ../../include/net-snmp/mib_api.h
+./notification/snmpNotifyFilterTable.lo: ../../include/net-snmp/library/mib.h
+./notification/snmpNotifyFilterTable.lo: ../../include/net-snmp/library/parse.h
+./notification/snmpNotifyFilterTable.lo: ../../include/net-snmp/varbind_api.h
+./notification/snmpNotifyFilterTable.lo: ../../include/net-snmp/config_api.h
+./notification/snmpNotifyFilterTable.lo: ../../include/net-snmp/library/read_config.h
+./notification/snmpNotifyFilterTable.lo: ../../include/net-snmp/library/default_store.h
+./notification/snmpNotifyFilterTable.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./notification/snmpNotifyFilterTable.lo: ../../include/net-snmp/library/snmp_enum.h
+./notification/snmpNotifyFilterTable.lo: ../../include/net-snmp/library/vacm.h
+./notification/snmpNotifyFilterTable.lo: ../../include/net-snmp/output_api.h
+./notification/snmpNotifyFilterTable.lo: ../../include/net-snmp/library/snmp_debug.h
+./notification/snmpNotifyFilterTable.lo: ../../include/net-snmp/library/snmp_logging.h
+./notification/snmpNotifyFilterTable.lo: ../../include/net-snmp/snmpv3_api.h
+./notification/snmpNotifyFilterTable.lo: ../../include/net-snmp/library/snmpv3.h
+./notification/snmpNotifyFilterTable.lo: ../../include/net-snmp/library/transform_oids.h
+./notification/snmpNotifyFilterTable.lo: ../../include/net-snmp/library/keytools.h
+./notification/snmpNotifyFilterTable.lo: ../../include/net-snmp/library/scapi.h
+./notification/snmpNotifyFilterTable.lo: ../../include/net-snmp/library/lcd_time.h
+./notification/snmpNotifyFilterTable.lo: ../../include/net-snmp/library/snmp_secmod.h
+./notification/snmpNotifyFilterTable.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./notification/snmpNotifyFilterTable.lo: ../../include/net-snmp/library/snmpusm.h
+./notification/snmpNotifyFilterTable.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./notification/snmpNotifyFilterTable.lo: ../../include/net-snmp/agent/snmp_agent.h
+./notification/snmpNotifyFilterTable.lo: ../../include/net-snmp/agent/snmp_vars.h
+./notification/snmpNotifyFilterTable.lo: ../../include/net-snmp/agent/agent_handler.h
+./notification/snmpNotifyFilterTable.lo: ../../include/net-snmp/agent/var_struct.h
+./notification/snmpNotifyFilterTable.lo: ../../include/net-snmp/agent/agent_registry.h
+./notification/snmpNotifyFilterTable.lo: ../../include/net-snmp/agent/ds_agent.h
+./notification/snmpNotifyFilterTable.lo: ../../include/net-snmp/agent/agent_read_config.h
+./notification/snmpNotifyFilterTable.lo: ../../include/net-snmp/agent/agent_trap.h
+./notification/snmpNotifyFilterTable.lo: ../../include/net-snmp/agent/all_helpers.h
+./notification/snmpNotifyFilterTable.lo: ../../include/net-snmp/agent/instance.h
+./notification/snmpNotifyFilterTable.lo: ../../include/net-snmp/agent/multiplexer.h
+./notification/snmpNotifyFilterTable.lo: ../../include/net-snmp/agent/null.h
+./notification/snmpNotifyFilterTable.lo: ../../include/net-snmp/agent/debug_handler.h
+./notification/snmpNotifyFilterTable.lo: ../../include/net-snmp/agent/old_api.h
+./notification/snmpNotifyFilterTable.lo: ../../include/net-snmp/agent/read_only.h
+./notification/snmpNotifyFilterTable.lo: ../../include/net-snmp/agent/serialize.h
+./notification/snmpNotifyFilterTable.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./notification/snmpNotifyFilterTable.lo: ../../include/net-snmp/agent/mode_end_call.h
+./notification/snmpNotifyFilterTable.lo: ../../include/net-snmp/agent/table.h
+./notification/snmpNotifyFilterTable.lo: ../../include/net-snmp/agent/table_data.h
+./notification/snmpNotifyFilterTable.lo: ../../include/net-snmp/agent/table_dataset.h
+./notification/snmpNotifyFilterTable.lo: ../../include/net-snmp/agent/table_iterator.h
+./notification/snmpNotifyFilterTable.lo: ../../include/net-snmp/agent/mib_module_config.h
+./notification/snmpNotifyFilterTable.lo: header_complex.h
+./notification/snmpNotifyFilterTable.lo: ./notification/snmpNotifyFilterTable.h
+./notification/snmpNotifyTable.lo: ../../include/net-snmp/net-snmp-config.h
+./notification/snmpNotifyTable.lo: ../../include/net-snmp/system/linux.h
+./notification/snmpNotifyTable.lo: ../../include/net-snmp/system/sysv.h
+./notification/snmpNotifyTable.lo: ../../include/net-snmp/system/generic.h
+./notification/snmpNotifyTable.lo: ../../include/net-snmp/machine/generic.h
+./notification/snmpNotifyTable.lo: ../../include/net-snmp/net-snmp-includes.h
+./notification/snmpNotifyTable.lo: ../../include/net-snmp/definitions.h
+./notification/snmpNotifyTable.lo: ../../include/net-snmp/types.h
+./notification/snmpNotifyTable.lo: ../../include/net-snmp/library/snmp_api.h
+./notification/snmpNotifyTable.lo: ../../include/net-snmp/library/asn1.h
+./notification/snmpNotifyTable.lo: ../../include/net-snmp/library/snmp_impl.h
+./notification/snmpNotifyTable.lo: ../../include/net-snmp/library/snmp.h
+./notification/snmpNotifyTable.lo: ../../include/net-snmp/library/snmp-tc.h
+./notification/snmpNotifyTable.lo: ../../include/net-snmp/utilities.h
+./notification/snmpNotifyTable.lo: ../../include/net-snmp/library/snmp_client.h
+./notification/snmpNotifyTable.lo: ../../include/net-snmp/library/getopt.h
+./notification/snmpNotifyTable.lo: ../../include/net-snmp/library/system.h
+./notification/snmpNotifyTable.lo: ../../include/net-snmp/library/tools.h
+./notification/snmpNotifyTable.lo: ../../include/net-snmp/library/int64.h
+./notification/snmpNotifyTable.lo: ../../include/net-snmp/library/mt_support.h
+./notification/snmpNotifyTable.lo: ../../include/net-snmp/library/snmp_alarm.h
+./notification/snmpNotifyTable.lo: ../../include/net-snmp/library/data_list.h
+./notification/snmpNotifyTable.lo: ../../include/net-snmp/library/callback.h
+./notification/snmpNotifyTable.lo: ../../include/net-snmp/library/oid_stash.h
+./notification/snmpNotifyTable.lo: ../../include/net-snmp/library/check_varbind.h
+./notification/snmpNotifyTable.lo: ../../include/net-snmp/version.h
+./notification/snmpNotifyTable.lo: ../../include/net-snmp/session_api.h
+./notification/snmpNotifyTable.lo: ../../include/net-snmp/library/snmp_transport.h
+./notification/snmpNotifyTable.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./notification/snmpNotifyTable.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./notification/snmpNotifyTable.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./notification/snmpNotifyTable.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./notification/snmpNotifyTable.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./notification/snmpNotifyTable.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./notification/snmpNotifyTable.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./notification/snmpNotifyTable.lo: ../../include/net-snmp/library/ucd_compat.h
+./notification/snmpNotifyTable.lo: ../../include/net-snmp/pdu_api.h
+./notification/snmpNotifyTable.lo: ../../include/net-snmp/mib_api.h
+./notification/snmpNotifyTable.lo: ../../include/net-snmp/library/mib.h
+./notification/snmpNotifyTable.lo: ../../include/net-snmp/library/parse.h
+./notification/snmpNotifyTable.lo: ../../include/net-snmp/varbind_api.h
+./notification/snmpNotifyTable.lo: ../../include/net-snmp/config_api.h
+./notification/snmpNotifyTable.lo: ../../include/net-snmp/library/read_config.h
+./notification/snmpNotifyTable.lo: ../../include/net-snmp/library/default_store.h
+./notification/snmpNotifyTable.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./notification/snmpNotifyTable.lo: ../../include/net-snmp/library/snmp_enum.h
+./notification/snmpNotifyTable.lo: ../../include/net-snmp/library/vacm.h
+./notification/snmpNotifyTable.lo: ../../include/net-snmp/output_api.h
+./notification/snmpNotifyTable.lo: ../../include/net-snmp/library/snmp_debug.h
+./notification/snmpNotifyTable.lo: ../../include/net-snmp/library/snmp_logging.h
+./notification/snmpNotifyTable.lo: ../../include/net-snmp/snmpv3_api.h
+./notification/snmpNotifyTable.lo: ../../include/net-snmp/library/snmpv3.h
+./notification/snmpNotifyTable.lo: ../../include/net-snmp/library/transform_oids.h
+./notification/snmpNotifyTable.lo: ../../include/net-snmp/library/keytools.h
+./notification/snmpNotifyTable.lo: ../../include/net-snmp/library/scapi.h
+./notification/snmpNotifyTable.lo: ../../include/net-snmp/library/lcd_time.h
+./notification/snmpNotifyTable.lo: ../../include/net-snmp/library/snmp_secmod.h
+./notification/snmpNotifyTable.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./notification/snmpNotifyTable.lo: ../../include/net-snmp/library/snmpusm.h
+./notification/snmpNotifyTable.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./notification/snmpNotifyTable.lo: ../../include/net-snmp/agent/snmp_agent.h
+./notification/snmpNotifyTable.lo: ../../include/net-snmp/agent/snmp_vars.h
+./notification/snmpNotifyTable.lo: ../../include/net-snmp/agent/agent_handler.h
+./notification/snmpNotifyTable.lo: ../../include/net-snmp/agent/var_struct.h
+./notification/snmpNotifyTable.lo: ../../include/net-snmp/agent/agent_registry.h
+./notification/snmpNotifyTable.lo: ../../include/net-snmp/agent/ds_agent.h
+./notification/snmpNotifyTable.lo: ../../include/net-snmp/agent/agent_read_config.h
+./notification/snmpNotifyTable.lo: ../../include/net-snmp/agent/agent_trap.h
+./notification/snmpNotifyTable.lo: ../../include/net-snmp/agent/all_helpers.h
+./notification/snmpNotifyTable.lo: ../../include/net-snmp/agent/instance.h
+./notification/snmpNotifyTable.lo: ../../include/net-snmp/agent/multiplexer.h
+./notification/snmpNotifyTable.lo: ../../include/net-snmp/agent/null.h
+./notification/snmpNotifyTable.lo: ../../include/net-snmp/agent/debug_handler.h
+./notification/snmpNotifyTable.lo: ../../include/net-snmp/agent/old_api.h
+./notification/snmpNotifyTable.lo: ../../include/net-snmp/agent/read_only.h
+./notification/snmpNotifyTable.lo: ../../include/net-snmp/agent/serialize.h
+./notification/snmpNotifyTable.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./notification/snmpNotifyTable.lo: ../../include/net-snmp/agent/mode_end_call.h
+./notification/snmpNotifyTable.lo: ../../include/net-snmp/agent/table.h
+./notification/snmpNotifyTable.lo: ../../include/net-snmp/agent/table_data.h
+./notification/snmpNotifyTable.lo: ../../include/net-snmp/agent/table_dataset.h
+./notification/snmpNotifyTable.lo: ../../include/net-snmp/agent/table_iterator.h
+./notification/snmpNotifyTable.lo: ../../include/net-snmp/agent/mib_module_config.h
+./notification/snmpNotifyTable.lo: header_complex.h
+./notification/snmpNotifyTable.lo: ./notification/snmpNotifyTable.h
+./notification/snmpNotifyTable.lo: target/snmpTargetParamsEntry.h
+./notification/snmpNotifyTable.lo: target/snmpTargetAddrEntry.h
+./notification/snmpNotifyTable.lo: target/target.h
+./notification/snmpNotifyTable.lo: ../../include/net-snmp/agent/agent_callbacks.h
+./Rmon/agutil.lo: ../../include/net-snmp/net-snmp-config.h
+./Rmon/agutil.lo: ../../include/net-snmp/system/linux.h
+./Rmon/agutil.lo: ../../include/net-snmp/system/sysv.h
+./Rmon/agutil.lo: ../../include/net-snmp/system/generic.h
+./Rmon/agutil.lo: ../../include/net-snmp/machine/generic.h
+./Rmon/agutil.lo: ../../include/net-snmp/net-snmp-includes.h
+./Rmon/agutil.lo: ../../include/net-snmp/definitions.h
+./Rmon/agutil.lo: ../../include/net-snmp/types.h
+./Rmon/agutil.lo: ../../include/net-snmp/library/snmp_api.h
+./Rmon/agutil.lo: ../../include/net-snmp/library/asn1.h
+./Rmon/agutil.lo: ../../include/net-snmp/library/snmp_impl.h
+./Rmon/agutil.lo: ../../include/net-snmp/library/snmp.h
+./Rmon/agutil.lo: ../../include/net-snmp/library/snmp-tc.h
+./Rmon/agutil.lo: ../../include/net-snmp/utilities.h
+./Rmon/agutil.lo: ../../include/net-snmp/library/snmp_client.h
+./Rmon/agutil.lo: ../../include/net-snmp/library/getopt.h
+./Rmon/agutil.lo: ../../include/net-snmp/library/system.h
+./Rmon/agutil.lo: ../../include/net-snmp/library/tools.h
+./Rmon/agutil.lo: ../../include/net-snmp/library/int64.h
+./Rmon/agutil.lo: ../../include/net-snmp/library/mt_support.h
+./Rmon/agutil.lo: ../../include/net-snmp/library/snmp_alarm.h
+./Rmon/agutil.lo: ../../include/net-snmp/library/data_list.h
+./Rmon/agutil.lo: ../../include/net-snmp/library/callback.h
+./Rmon/agutil.lo: ../../include/net-snmp/library/oid_stash.h
+./Rmon/agutil.lo: ../../include/net-snmp/library/check_varbind.h
+./Rmon/agutil.lo: ../../include/net-snmp/version.h
+./Rmon/agutil.lo: ../../include/net-snmp/session_api.h
+./Rmon/agutil.lo: ../../include/net-snmp/library/snmp_transport.h
+./Rmon/agutil.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./Rmon/agutil.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./Rmon/agutil.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./Rmon/agutil.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./Rmon/agutil.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./Rmon/agutil.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./Rmon/agutil.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./Rmon/agutil.lo: ../../include/net-snmp/library/ucd_compat.h
+./Rmon/agutil.lo: ../../include/net-snmp/pdu_api.h
+./Rmon/agutil.lo: ../../include/net-snmp/mib_api.h
+./Rmon/agutil.lo: ../../include/net-snmp/library/mib.h
+./Rmon/agutil.lo: ../../include/net-snmp/library/parse.h
+./Rmon/agutil.lo: ../../include/net-snmp/varbind_api.h
+./Rmon/agutil.lo: ../../include/net-snmp/config_api.h
+./Rmon/agutil.lo: ../../include/net-snmp/library/read_config.h
+./Rmon/agutil.lo: ../../include/net-snmp/library/default_store.h
+./Rmon/agutil.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./Rmon/agutil.lo: ../../include/net-snmp/library/snmp_enum.h
+./Rmon/agutil.lo: ../../include/net-snmp/library/vacm.h
+./Rmon/agutil.lo: ../../include/net-snmp/output_api.h
+./Rmon/agutil.lo: ../../include/net-snmp/library/snmp_debug.h
+./Rmon/agutil.lo: ../../include/net-snmp/library/snmp_logging.h
+./Rmon/agutil.lo: ../../include/net-snmp/snmpv3_api.h
+./Rmon/agutil.lo: ../../include/net-snmp/library/snmpv3.h
+./Rmon/agutil.lo: ../../include/net-snmp/library/transform_oids.h
+./Rmon/agutil.lo: ../../include/net-snmp/library/keytools.h
+./Rmon/agutil.lo: ../../include/net-snmp/library/scapi.h
+./Rmon/agutil.lo: ../../include/net-snmp/library/lcd_time.h
+./Rmon/agutil.lo: ../../include/net-snmp/library/snmp_secmod.h
+./Rmon/agutil.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./Rmon/agutil.lo: ../../include/net-snmp/library/snmpusm.h
+./Rmon/agutil.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./Rmon/agutil.lo: ../../include/net-snmp/agent/snmp_agent.h
+./Rmon/agutil.lo: ../../include/net-snmp/agent/snmp_vars.h
+./Rmon/agutil.lo: ../../include/net-snmp/agent/agent_handler.h
+./Rmon/agutil.lo: ../../include/net-snmp/agent/var_struct.h
+./Rmon/agutil.lo: ../../include/net-snmp/agent/agent_registry.h
+./Rmon/agutil.lo: ../../include/net-snmp/agent/ds_agent.h
+./Rmon/agutil.lo: ../../include/net-snmp/agent/agent_read_config.h
+./Rmon/agutil.lo: ../../include/net-snmp/agent/agent_trap.h
+./Rmon/agutil.lo: ../../include/net-snmp/agent/all_helpers.h
+./Rmon/agutil.lo: ../../include/net-snmp/agent/instance.h
+./Rmon/agutil.lo: ../../include/net-snmp/agent/multiplexer.h
+./Rmon/agutil.lo: ../../include/net-snmp/agent/null.h
+./Rmon/agutil.lo: ../../include/net-snmp/agent/debug_handler.h
+./Rmon/agutil.lo: ../../include/net-snmp/agent/old_api.h
+./Rmon/agutil.lo: ../../include/net-snmp/agent/read_only.h
+./Rmon/agutil.lo: ../../include/net-snmp/agent/serialize.h
+./Rmon/agutil.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./Rmon/agutil.lo: ../../include/net-snmp/agent/mode_end_call.h
+./Rmon/agutil.lo: ../../include/net-snmp/agent/table.h
+./Rmon/agutil.lo: ../../include/net-snmp/agent/table_data.h
+./Rmon/agutil.lo: ../../include/net-snmp/agent/table_dataset.h
+./Rmon/agutil.lo: ../../include/net-snmp/agent/table_iterator.h
+./Rmon/agutil.lo: ../../include/net-snmp/agent/mib_module_config.h
+./Rmon/agutil.lo: util_funcs.h struct.h ./Rmon/agutil.h ./Rmon/agutil_api.h
+./Rmon/alarm.lo: ../../include/net-snmp/net-snmp-config.h
+./Rmon/alarm.lo: ../../include/net-snmp/system/linux.h
+./Rmon/alarm.lo: ../../include/net-snmp/system/sysv.h
+./Rmon/alarm.lo: ../../include/net-snmp/system/generic.h
+./Rmon/alarm.lo: ../../include/net-snmp/machine/generic.h
+./Rmon/alarm.lo: ../../include/net-snmp/net-snmp-includes.h
+./Rmon/alarm.lo: ../../include/net-snmp/definitions.h
+./Rmon/alarm.lo: ../../include/net-snmp/types.h
+./Rmon/alarm.lo: ../../include/net-snmp/library/snmp_api.h
+./Rmon/alarm.lo: ../../include/net-snmp/library/asn1.h
+./Rmon/alarm.lo: ../../include/net-snmp/library/snmp_impl.h
+./Rmon/alarm.lo: ../../include/net-snmp/library/snmp.h
+./Rmon/alarm.lo: ../../include/net-snmp/library/snmp-tc.h
+./Rmon/alarm.lo: ../../include/net-snmp/utilities.h
+./Rmon/alarm.lo: ../../include/net-snmp/library/snmp_client.h
+./Rmon/alarm.lo: ../../include/net-snmp/library/getopt.h
+./Rmon/alarm.lo: ../../include/net-snmp/library/system.h
+./Rmon/alarm.lo: ../../include/net-snmp/library/tools.h
+./Rmon/alarm.lo: ../../include/net-snmp/library/int64.h
+./Rmon/alarm.lo: ../../include/net-snmp/library/mt_support.h
+./Rmon/alarm.lo: ../../include/net-snmp/library/snmp_alarm.h
+./Rmon/alarm.lo: ../../include/net-snmp/library/data_list.h
+./Rmon/alarm.lo: ../../include/net-snmp/library/callback.h
+./Rmon/alarm.lo: ../../include/net-snmp/library/oid_stash.h
+./Rmon/alarm.lo: ../../include/net-snmp/library/check_varbind.h
+./Rmon/alarm.lo: ../../include/net-snmp/version.h
+./Rmon/alarm.lo: ../../include/net-snmp/session_api.h
+./Rmon/alarm.lo: ../../include/net-snmp/library/snmp_transport.h
+./Rmon/alarm.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./Rmon/alarm.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./Rmon/alarm.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./Rmon/alarm.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./Rmon/alarm.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./Rmon/alarm.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./Rmon/alarm.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./Rmon/alarm.lo: ../../include/net-snmp/library/ucd_compat.h
+./Rmon/alarm.lo: ../../include/net-snmp/pdu_api.h
+./Rmon/alarm.lo: ../../include/net-snmp/mib_api.h
+./Rmon/alarm.lo: ../../include/net-snmp/library/mib.h
+./Rmon/alarm.lo: ../../include/net-snmp/library/parse.h
+./Rmon/alarm.lo: ../../include/net-snmp/varbind_api.h
+./Rmon/alarm.lo: ../../include/net-snmp/config_api.h
+./Rmon/alarm.lo: ../../include/net-snmp/library/read_config.h
+./Rmon/alarm.lo: ../../include/net-snmp/library/default_store.h
+./Rmon/alarm.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./Rmon/alarm.lo: ../../include/net-snmp/library/snmp_enum.h
+./Rmon/alarm.lo: ../../include/net-snmp/library/vacm.h
+./Rmon/alarm.lo: ../../include/net-snmp/output_api.h
+./Rmon/alarm.lo: ../../include/net-snmp/library/snmp_debug.h
+./Rmon/alarm.lo: ../../include/net-snmp/library/snmp_logging.h
+./Rmon/alarm.lo: ../../include/net-snmp/snmpv3_api.h
+./Rmon/alarm.lo: ../../include/net-snmp/library/snmpv3.h
+./Rmon/alarm.lo: ../../include/net-snmp/library/transform_oids.h
+./Rmon/alarm.lo: ../../include/net-snmp/library/keytools.h
+./Rmon/alarm.lo: ../../include/net-snmp/library/scapi.h
+./Rmon/alarm.lo: ../../include/net-snmp/library/lcd_time.h
+./Rmon/alarm.lo: ../../include/net-snmp/library/snmp_secmod.h
+./Rmon/alarm.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./Rmon/alarm.lo: ../../include/net-snmp/library/snmpusm.h
+./Rmon/alarm.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./Rmon/alarm.lo: ../../include/net-snmp/agent/snmp_agent.h
+./Rmon/alarm.lo: ../../include/net-snmp/agent/snmp_vars.h
+./Rmon/alarm.lo: ../../include/net-snmp/agent/agent_handler.h
+./Rmon/alarm.lo: ../../include/net-snmp/agent/var_struct.h
+./Rmon/alarm.lo: ../../include/net-snmp/agent/agent_registry.h
+./Rmon/alarm.lo: ../../include/net-snmp/agent/ds_agent.h
+./Rmon/alarm.lo: ../../include/net-snmp/agent/agent_read_config.h
+./Rmon/alarm.lo: ../../include/net-snmp/agent/agent_trap.h
+./Rmon/alarm.lo: ../../include/net-snmp/agent/all_helpers.h
+./Rmon/alarm.lo: ../../include/net-snmp/agent/instance.h
+./Rmon/alarm.lo: ../../include/net-snmp/agent/multiplexer.h
+./Rmon/alarm.lo: ../../include/net-snmp/agent/null.h
+./Rmon/alarm.lo: ../../include/net-snmp/agent/debug_handler.h
+./Rmon/alarm.lo: ../../include/net-snmp/agent/old_api.h
+./Rmon/alarm.lo: ../../include/net-snmp/agent/read_only.h
+./Rmon/alarm.lo: ../../include/net-snmp/agent/serialize.h
+./Rmon/alarm.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./Rmon/alarm.lo: ../../include/net-snmp/agent/mode_end_call.h
+./Rmon/alarm.lo: ../../include/net-snmp/agent/table.h
+./Rmon/alarm.lo: ../../include/net-snmp/agent/table_data.h
+./Rmon/alarm.lo: ../../include/net-snmp/agent/table_dataset.h
+./Rmon/alarm.lo: ../../include/net-snmp/agent/table_iterator.h
+./Rmon/alarm.lo: ../../include/net-snmp/agent/mib_module_config.h
+./Rmon/alarm.lo: util_funcs.h struct.h ./Rmon/alarm.h ./Rmon/agutil_api.h
+./Rmon/alarm.lo: ./Rmon/row_api.h
+./Rmon/event.lo: ../../include/net-snmp/net-snmp-config.h
+./Rmon/event.lo: ../../include/net-snmp/system/linux.h
+./Rmon/event.lo: ../../include/net-snmp/system/sysv.h
+./Rmon/event.lo: ../../include/net-snmp/system/generic.h
+./Rmon/event.lo: ../../include/net-snmp/machine/generic.h
+./Rmon/event.lo: ../../include/net-snmp/net-snmp-includes.h
+./Rmon/event.lo: ../../include/net-snmp/definitions.h
+./Rmon/event.lo: ../../include/net-snmp/types.h
+./Rmon/event.lo: ../../include/net-snmp/library/snmp_api.h
+./Rmon/event.lo: ../../include/net-snmp/library/asn1.h
+./Rmon/event.lo: ../../include/net-snmp/library/snmp_impl.h
+./Rmon/event.lo: ../../include/net-snmp/library/snmp.h
+./Rmon/event.lo: ../../include/net-snmp/library/snmp-tc.h
+./Rmon/event.lo: ../../include/net-snmp/utilities.h
+./Rmon/event.lo: ../../include/net-snmp/library/snmp_client.h
+./Rmon/event.lo: ../../include/net-snmp/library/getopt.h
+./Rmon/event.lo: ../../include/net-snmp/library/system.h
+./Rmon/event.lo: ../../include/net-snmp/library/tools.h
+./Rmon/event.lo: ../../include/net-snmp/library/int64.h
+./Rmon/event.lo: ../../include/net-snmp/library/mt_support.h
+./Rmon/event.lo: ../../include/net-snmp/library/snmp_alarm.h
+./Rmon/event.lo: ../../include/net-snmp/library/data_list.h
+./Rmon/event.lo: ../../include/net-snmp/library/callback.h
+./Rmon/event.lo: ../../include/net-snmp/library/oid_stash.h
+./Rmon/event.lo: ../../include/net-snmp/library/check_varbind.h
+./Rmon/event.lo: ../../include/net-snmp/version.h
+./Rmon/event.lo: ../../include/net-snmp/session_api.h
+./Rmon/event.lo: ../../include/net-snmp/library/snmp_transport.h
+./Rmon/event.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./Rmon/event.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./Rmon/event.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./Rmon/event.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./Rmon/event.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./Rmon/event.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./Rmon/event.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./Rmon/event.lo: ../../include/net-snmp/library/ucd_compat.h
+./Rmon/event.lo: ../../include/net-snmp/pdu_api.h
+./Rmon/event.lo: ../../include/net-snmp/mib_api.h
+./Rmon/event.lo: ../../include/net-snmp/library/mib.h
+./Rmon/event.lo: ../../include/net-snmp/library/parse.h
+./Rmon/event.lo: ../../include/net-snmp/varbind_api.h
+./Rmon/event.lo: ../../include/net-snmp/config_api.h
+./Rmon/event.lo: ../../include/net-snmp/library/read_config.h
+./Rmon/event.lo: ../../include/net-snmp/library/default_store.h
+./Rmon/event.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./Rmon/event.lo: ../../include/net-snmp/library/snmp_enum.h
+./Rmon/event.lo: ../../include/net-snmp/library/vacm.h
+./Rmon/event.lo: ../../include/net-snmp/output_api.h
+./Rmon/event.lo: ../../include/net-snmp/library/snmp_debug.h
+./Rmon/event.lo: ../../include/net-snmp/library/snmp_logging.h
+./Rmon/event.lo: ../../include/net-snmp/snmpv3_api.h
+./Rmon/event.lo: ../../include/net-snmp/library/snmpv3.h
+./Rmon/event.lo: ../../include/net-snmp/library/transform_oids.h
+./Rmon/event.lo: ../../include/net-snmp/library/keytools.h
+./Rmon/event.lo: ../../include/net-snmp/library/scapi.h
+./Rmon/event.lo: ../../include/net-snmp/library/lcd_time.h
+./Rmon/event.lo: ../../include/net-snmp/library/snmp_secmod.h
+./Rmon/event.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./Rmon/event.lo: ../../include/net-snmp/library/snmpusm.h
+./Rmon/event.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./Rmon/event.lo: ../../include/net-snmp/agent/snmp_agent.h
+./Rmon/event.lo: ../../include/net-snmp/agent/snmp_vars.h
+./Rmon/event.lo: ../../include/net-snmp/agent/agent_handler.h
+./Rmon/event.lo: ../../include/net-snmp/agent/var_struct.h
+./Rmon/event.lo: ../../include/net-snmp/agent/agent_registry.h
+./Rmon/event.lo: ../../include/net-snmp/agent/ds_agent.h
+./Rmon/event.lo: ../../include/net-snmp/agent/agent_read_config.h
+./Rmon/event.lo: ../../include/net-snmp/agent/agent_trap.h
+./Rmon/event.lo: ../../include/net-snmp/agent/all_helpers.h
+./Rmon/event.lo: ../../include/net-snmp/agent/instance.h
+./Rmon/event.lo: ../../include/net-snmp/agent/multiplexer.h
+./Rmon/event.lo: ../../include/net-snmp/agent/null.h
+./Rmon/event.lo: ../../include/net-snmp/agent/debug_handler.h
+./Rmon/event.lo: ../../include/net-snmp/agent/old_api.h
+./Rmon/event.lo: ../../include/net-snmp/agent/read_only.h
+./Rmon/event.lo: ../../include/net-snmp/agent/serialize.h
+./Rmon/event.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./Rmon/event.lo: ../../include/net-snmp/agent/mode_end_call.h
+./Rmon/event.lo: ../../include/net-snmp/agent/table.h
+./Rmon/event.lo: ../../include/net-snmp/agent/table_data.h
+./Rmon/event.lo: ../../include/net-snmp/agent/table_dataset.h
+./Rmon/event.lo: ../../include/net-snmp/agent/table_iterator.h
+./Rmon/event.lo: ../../include/net-snmp/agent/mib_module_config.h
+./Rmon/event.lo: util_funcs.h struct.h ./Rmon/event.h ./Rmon/agutil_api.h
+./Rmon/event.lo: ./Rmon/row_api.h
+./Rmon/history.lo: ../../include/net-snmp/net-snmp-config.h
+./Rmon/history.lo: ../../include/net-snmp/system/linux.h
+./Rmon/history.lo: ../../include/net-snmp/system/sysv.h
+./Rmon/history.lo: ../../include/net-snmp/system/generic.h
+./Rmon/history.lo: ../../include/net-snmp/machine/generic.h
+./Rmon/history.lo: ../../include/net-snmp/net-snmp-includes.h
+./Rmon/history.lo: ../../include/net-snmp/definitions.h
+./Rmon/history.lo: ../../include/net-snmp/types.h
+./Rmon/history.lo: ../../include/net-snmp/library/snmp_api.h
+./Rmon/history.lo: ../../include/net-snmp/library/asn1.h
+./Rmon/history.lo: ../../include/net-snmp/library/snmp_impl.h
+./Rmon/history.lo: ../../include/net-snmp/library/snmp.h
+./Rmon/history.lo: ../../include/net-snmp/library/snmp-tc.h
+./Rmon/history.lo: ../../include/net-snmp/utilities.h
+./Rmon/history.lo: ../../include/net-snmp/library/snmp_client.h
+./Rmon/history.lo: ../../include/net-snmp/library/getopt.h
+./Rmon/history.lo: ../../include/net-snmp/library/system.h
+./Rmon/history.lo: ../../include/net-snmp/library/tools.h
+./Rmon/history.lo: ../../include/net-snmp/library/int64.h
+./Rmon/history.lo: ../../include/net-snmp/library/mt_support.h
+./Rmon/history.lo: ../../include/net-snmp/library/snmp_alarm.h
+./Rmon/history.lo: ../../include/net-snmp/library/data_list.h
+./Rmon/history.lo: ../../include/net-snmp/library/callback.h
+./Rmon/history.lo: ../../include/net-snmp/library/oid_stash.h
+./Rmon/history.lo: ../../include/net-snmp/library/check_varbind.h
+./Rmon/history.lo: ../../include/net-snmp/version.h
+./Rmon/history.lo: ../../include/net-snmp/session_api.h
+./Rmon/history.lo: ../../include/net-snmp/library/snmp_transport.h
+./Rmon/history.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./Rmon/history.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./Rmon/history.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./Rmon/history.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./Rmon/history.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./Rmon/history.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./Rmon/history.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./Rmon/history.lo: ../../include/net-snmp/library/ucd_compat.h
+./Rmon/history.lo: ../../include/net-snmp/pdu_api.h
+./Rmon/history.lo: ../../include/net-snmp/mib_api.h
+./Rmon/history.lo: ../../include/net-snmp/library/mib.h
+./Rmon/history.lo: ../../include/net-snmp/library/parse.h
+./Rmon/history.lo: ../../include/net-snmp/varbind_api.h
+./Rmon/history.lo: ../../include/net-snmp/config_api.h
+./Rmon/history.lo: ../../include/net-snmp/library/read_config.h
+./Rmon/history.lo: ../../include/net-snmp/library/default_store.h
+./Rmon/history.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./Rmon/history.lo: ../../include/net-snmp/library/snmp_enum.h
+./Rmon/history.lo: ../../include/net-snmp/library/vacm.h
+./Rmon/history.lo: ../../include/net-snmp/output_api.h
+./Rmon/history.lo: ../../include/net-snmp/library/snmp_debug.h
+./Rmon/history.lo: ../../include/net-snmp/library/snmp_logging.h
+./Rmon/history.lo: ../../include/net-snmp/snmpv3_api.h
+./Rmon/history.lo: ../../include/net-snmp/library/snmpv3.h
+./Rmon/history.lo: ../../include/net-snmp/library/transform_oids.h
+./Rmon/history.lo: ../../include/net-snmp/library/keytools.h
+./Rmon/history.lo: ../../include/net-snmp/library/scapi.h
+./Rmon/history.lo: ../../include/net-snmp/library/lcd_time.h
+./Rmon/history.lo: ../../include/net-snmp/library/snmp_secmod.h
+./Rmon/history.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./Rmon/history.lo: ../../include/net-snmp/library/snmpusm.h
+./Rmon/history.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./Rmon/history.lo: ../../include/net-snmp/agent/snmp_agent.h
+./Rmon/history.lo: ../../include/net-snmp/agent/snmp_vars.h
+./Rmon/history.lo: ../../include/net-snmp/agent/agent_handler.h
+./Rmon/history.lo: ../../include/net-snmp/agent/var_struct.h
+./Rmon/history.lo: ../../include/net-snmp/agent/agent_registry.h
+./Rmon/history.lo: ../../include/net-snmp/agent/ds_agent.h
+./Rmon/history.lo: ../../include/net-snmp/agent/agent_read_config.h
+./Rmon/history.lo: ../../include/net-snmp/agent/agent_trap.h
+./Rmon/history.lo: ../../include/net-snmp/agent/all_helpers.h
+./Rmon/history.lo: ../../include/net-snmp/agent/instance.h
+./Rmon/history.lo: ../../include/net-snmp/agent/multiplexer.h
+./Rmon/history.lo: ../../include/net-snmp/agent/null.h
+./Rmon/history.lo: ../../include/net-snmp/agent/debug_handler.h
+./Rmon/history.lo: ../../include/net-snmp/agent/old_api.h
+./Rmon/history.lo: ../../include/net-snmp/agent/read_only.h
+./Rmon/history.lo: ../../include/net-snmp/agent/serialize.h
+./Rmon/history.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./Rmon/history.lo: ../../include/net-snmp/agent/mode_end_call.h
+./Rmon/history.lo: ../../include/net-snmp/agent/table.h
+./Rmon/history.lo: ../../include/net-snmp/agent/table_data.h
+./Rmon/history.lo: ../../include/net-snmp/agent/table_dataset.h
+./Rmon/history.lo: ../../include/net-snmp/agent/table_iterator.h
+./Rmon/history.lo: ../../include/net-snmp/agent/mib_module_config.h
+./Rmon/history.lo: util_funcs.h struct.h ./Rmon/history.h ./Rmon/agutil_api.h
+./Rmon/history.lo: ./Rmon/row_api.h
+./Rmon/rows.lo: ../../include/net-snmp/net-snmp-config.h
+./Rmon/rows.lo: ../../include/net-snmp/system/linux.h
+./Rmon/rows.lo: ../../include/net-snmp/system/sysv.h
+./Rmon/rows.lo: ../../include/net-snmp/system/generic.h
+./Rmon/rows.lo: ../../include/net-snmp/machine/generic.h
+./Rmon/rows.lo: ../../include/net-snmp/net-snmp-includes.h
+./Rmon/rows.lo:  ../../include/net-snmp/definitions.h
+./Rmon/rows.lo: ../../include/net-snmp/types.h
+./Rmon/rows.lo: ../../include/net-snmp/library/snmp_api.h
+./Rmon/rows.lo: ../../include/net-snmp/library/asn1.h
+./Rmon/rows.lo: ../../include/net-snmp/library/snmp_impl.h
+./Rmon/rows.lo: ../../include/net-snmp/library/snmp.h
+./Rmon/rows.lo: ../../include/net-snmp/library/snmp-tc.h
+./Rmon/rows.lo: ../../include/net-snmp/utilities.h
+./Rmon/rows.lo: ../../include/net-snmp/library/snmp_client.h
+./Rmon/rows.lo: ../../include/net-snmp/library/getopt.h
+./Rmon/rows.lo: ../../include/net-snmp/library/system.h
+./Rmon/rows.lo: ../../include/net-snmp/library/tools.h
+./Rmon/rows.lo: ../../include/net-snmp/library/int64.h
+./Rmon/rows.lo: ../../include/net-snmp/library/mt_support.h
+./Rmon/rows.lo: ../../include/net-snmp/library/snmp_alarm.h
+./Rmon/rows.lo: ../../include/net-snmp/library/data_list.h
+./Rmon/rows.lo: ../../include/net-snmp/library/callback.h
+./Rmon/rows.lo: ../../include/net-snmp/library/oid_stash.h
+./Rmon/rows.lo: ../../include/net-snmp/library/check_varbind.h
+./Rmon/rows.lo: ../../include/net-snmp/version.h
+./Rmon/rows.lo: ../../include/net-snmp/session_api.h
+./Rmon/rows.lo: ../../include/net-snmp/library/snmp_transport.h
+./Rmon/rows.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./Rmon/rows.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./Rmon/rows.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./Rmon/rows.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./Rmon/rows.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./Rmon/rows.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./Rmon/rows.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./Rmon/rows.lo: ../../include/net-snmp/library/ucd_compat.h
+./Rmon/rows.lo: ../../include/net-snmp/pdu_api.h
+./Rmon/rows.lo: ../../include/net-snmp/mib_api.h
+./Rmon/rows.lo: ../../include/net-snmp/library/mib.h
+./Rmon/rows.lo: ../../include/net-snmp/library/parse.h
+./Rmon/rows.lo: ../../include/net-snmp/varbind_api.h
+./Rmon/rows.lo: ../../include/net-snmp/config_api.h
+./Rmon/rows.lo: ../../include/net-snmp/library/read_config.h
+./Rmon/rows.lo: ../../include/net-snmp/library/default_store.h
+./Rmon/rows.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./Rmon/rows.lo: ../../include/net-snmp/library/snmp_enum.h
+./Rmon/rows.lo: ../../include/net-snmp/library/vacm.h
+./Rmon/rows.lo: ../../include/net-snmp/output_api.h
+./Rmon/rows.lo: ../../include/net-snmp/library/snmp_debug.h
+./Rmon/rows.lo: ../../include/net-snmp/library/snmp_logging.h
+./Rmon/rows.lo: ../../include/net-snmp/snmpv3_api.h
+./Rmon/rows.lo: ../../include/net-snmp/library/snmpv3.h
+./Rmon/rows.lo: ../../include/net-snmp/library/transform_oids.h
+./Rmon/rows.lo: ../../include/net-snmp/library/keytools.h
+./Rmon/rows.lo: ../../include/net-snmp/library/scapi.h
+./Rmon/rows.lo: ../../include/net-snmp/library/lcd_time.h
+./Rmon/rows.lo: ../../include/net-snmp/library/snmp_secmod.h
+./Rmon/rows.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./Rmon/rows.lo: ../../include/net-snmp/library/snmpusm.h
+./Rmon/rows.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./Rmon/rows.lo: ../../include/net-snmp/agent/snmp_agent.h
+./Rmon/rows.lo: ../../include/net-snmp/agent/snmp_vars.h
+./Rmon/rows.lo: ../../include/net-snmp/agent/agent_handler.h
+./Rmon/rows.lo: ../../include/net-snmp/agent/var_struct.h
+./Rmon/rows.lo: ../../include/net-snmp/agent/agent_registry.h
+./Rmon/rows.lo: ../../include/net-snmp/agent/ds_agent.h
+./Rmon/rows.lo: ../../include/net-snmp/agent/agent_read_config.h
+./Rmon/rows.lo: ../../include/net-snmp/agent/agent_trap.h
+./Rmon/rows.lo: ../../include/net-snmp/agent/all_helpers.h
+./Rmon/rows.lo: ../../include/net-snmp/agent/instance.h
+./Rmon/rows.lo: ../../include/net-snmp/agent/multiplexer.h
+./Rmon/rows.lo: ../../include/net-snmp/agent/null.h
+./Rmon/rows.lo: ../../include/net-snmp/agent/debug_handler.h
+./Rmon/rows.lo: ../../include/net-snmp/agent/old_api.h
+./Rmon/rows.lo: ../../include/net-snmp/agent/read_only.h
+./Rmon/rows.lo: ../../include/net-snmp/agent/serialize.h
+./Rmon/rows.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./Rmon/rows.lo: ../../include/net-snmp/agent/mode_end_call.h
+./Rmon/rows.lo: ../../include/net-snmp/agent/table.h
+./Rmon/rows.lo: ../../include/net-snmp/agent/table_data.h
+./Rmon/rows.lo: ../../include/net-snmp/agent/table_dataset.h
+./Rmon/rows.lo: ../../include/net-snmp/agent/table_iterator.h
+./Rmon/rows.lo: ../../include/net-snmp/agent/mib_module_config.h util_funcs.h
+./Rmon/rows.lo: struct.h ./Rmon/agutil_api.h ./Rmon/rows.h ./Rmon/row_api.h
+./Rmon/statistics.lo: ../../include/net-snmp/net-snmp-config.h
+./Rmon/statistics.lo: ../../include/net-snmp/system/linux.h
+./Rmon/statistics.lo: ../../include/net-snmp/system/sysv.h
+./Rmon/statistics.lo: ../../include/net-snmp/system/generic.h
+./Rmon/statistics.lo: ../../include/net-snmp/machine/generic.h
+./Rmon/statistics.lo: ../../include/net-snmp/net-snmp-includes.h
+./Rmon/statistics.lo: ../../include/net-snmp/definitions.h
+./Rmon/statistics.lo: ../../include/net-snmp/types.h
+./Rmon/statistics.lo: ../../include/net-snmp/library/snmp_api.h
+./Rmon/statistics.lo: ../../include/net-snmp/library/asn1.h
+./Rmon/statistics.lo: ../../include/net-snmp/library/snmp_impl.h
+./Rmon/statistics.lo: ../../include/net-snmp/library/snmp.h
+./Rmon/statistics.lo: ../../include/net-snmp/library/snmp-tc.h
+./Rmon/statistics.lo: ../../include/net-snmp/utilities.h
+./Rmon/statistics.lo: ../../include/net-snmp/library/snmp_client.h
+./Rmon/statistics.lo: ../../include/net-snmp/library/getopt.h
+./Rmon/statistics.lo: ../../include/net-snmp/library/system.h
+./Rmon/statistics.lo: ../../include/net-snmp/library/tools.h
+./Rmon/statistics.lo: ../../include/net-snmp/library/int64.h
+./Rmon/statistics.lo: ../../include/net-snmp/library/mt_support.h
+./Rmon/statistics.lo: ../../include/net-snmp/library/snmp_alarm.h
+./Rmon/statistics.lo: ../../include/net-snmp/library/data_list.h
+./Rmon/statistics.lo: ../../include/net-snmp/library/callback.h
+./Rmon/statistics.lo: ../../include/net-snmp/library/oid_stash.h
+./Rmon/statistics.lo: ../../include/net-snmp/library/check_varbind.h
+./Rmon/statistics.lo: ../../include/net-snmp/version.h
+./Rmon/statistics.lo: ../../include/net-snmp/session_api.h
+./Rmon/statistics.lo: ../../include/net-snmp/library/snmp_transport.h
+./Rmon/statistics.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./Rmon/statistics.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./Rmon/statistics.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./Rmon/statistics.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./Rmon/statistics.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./Rmon/statistics.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./Rmon/statistics.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./Rmon/statistics.lo: ../../include/net-snmp/library/ucd_compat.h
+./Rmon/statistics.lo: ../../include/net-snmp/pdu_api.h
+./Rmon/statistics.lo: ../../include/net-snmp/mib_api.h
+./Rmon/statistics.lo: ../../include/net-snmp/library/mib.h
+./Rmon/statistics.lo: ../../include/net-snmp/library/parse.h
+./Rmon/statistics.lo: ../../include/net-snmp/varbind_api.h
+./Rmon/statistics.lo: ../../include/net-snmp/config_api.h
+./Rmon/statistics.lo: ../../include/net-snmp/library/read_config.h
+./Rmon/statistics.lo: ../../include/net-snmp/library/default_store.h
+./Rmon/statistics.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./Rmon/statistics.lo: ../../include/net-snmp/library/snmp_enum.h
+./Rmon/statistics.lo: ../../include/net-snmp/library/vacm.h
+./Rmon/statistics.lo: ../../include/net-snmp/output_api.h
+./Rmon/statistics.lo: ../../include/net-snmp/library/snmp_debug.h
+./Rmon/statistics.lo: ../../include/net-snmp/library/snmp_logging.h
+./Rmon/statistics.lo: ../../include/net-snmp/snmpv3_api.h
+./Rmon/statistics.lo: ../../include/net-snmp/library/snmpv3.h
+./Rmon/statistics.lo: ../../include/net-snmp/library/transform_oids.h
+./Rmon/statistics.lo: ../../include/net-snmp/library/keytools.h
+./Rmon/statistics.lo: ../../include/net-snmp/library/scapi.h
+./Rmon/statistics.lo: ../../include/net-snmp/library/lcd_time.h
+./Rmon/statistics.lo: ../../include/net-snmp/library/snmp_secmod.h
+./Rmon/statistics.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./Rmon/statistics.lo: ../../include/net-snmp/library/snmpusm.h
+./Rmon/statistics.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./Rmon/statistics.lo: ../../include/net-snmp/agent/snmp_agent.h
+./Rmon/statistics.lo: ../../include/net-snmp/agent/snmp_vars.h
+./Rmon/statistics.lo: ../../include/net-snmp/agent/agent_handler.h
+./Rmon/statistics.lo: ../../include/net-snmp/agent/var_struct.h
+./Rmon/statistics.lo: ../../include/net-snmp/agent/agent_registry.h
+./Rmon/statistics.lo: ../../include/net-snmp/agent/ds_agent.h
+./Rmon/statistics.lo: ../../include/net-snmp/agent/agent_read_config.h
+./Rmon/statistics.lo: ../../include/net-snmp/agent/agent_trap.h
+./Rmon/statistics.lo: ../../include/net-snmp/agent/all_helpers.h
+./Rmon/statistics.lo: ../../include/net-snmp/agent/instance.h
+./Rmon/statistics.lo: ../../include/net-snmp/agent/multiplexer.h
+./Rmon/statistics.lo: ../../include/net-snmp/agent/null.h
+./Rmon/statistics.lo: ../../include/net-snmp/agent/debug_handler.h
+./Rmon/statistics.lo: ../../include/net-snmp/agent/old_api.h
+./Rmon/statistics.lo: ../../include/net-snmp/agent/read_only.h
+./Rmon/statistics.lo: ../../include/net-snmp/agent/serialize.h
+./Rmon/statistics.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./Rmon/statistics.lo: ../../include/net-snmp/agent/mode_end_call.h
+./Rmon/statistics.lo: ../../include/net-snmp/agent/table.h
+./Rmon/statistics.lo: ../../include/net-snmp/agent/table_data.h
+./Rmon/statistics.lo: ../../include/net-snmp/agent/table_dataset.h
+./Rmon/statistics.lo: ../../include/net-snmp/agent/table_iterator.h
+./Rmon/statistics.lo: ../../include/net-snmp/agent/mib_module_config.h
+./Rmon/statistics.lo: util_funcs.h struct.h ./Rmon/statistics.h
+./Rmon/statistics.lo: ./Rmon/agutil_api.h ./Rmon/row_api.h
+./smux/smux.lo: ../../include/net-snmp/net-snmp-config.h
+./smux/smux.lo: ../../include/net-snmp/system/linux.h
+./smux/smux.lo: ../../include/net-snmp/system/sysv.h
+./smux/smux.lo: ../../include/net-snmp/system/generic.h
+./smux/smux.lo: ../../include/net-snmp/machine/generic.h
+./smux/smux.lo: ../../include/net-snmp/net-snmp-includes.h
+./smux/smux.lo: ../../include/net-snmp/definitions.h
+./smux/smux.lo: ../../include/net-snmp/types.h
+./smux/smux.lo: ../../include/net-snmp/library/snmp_api.h
+./smux/smux.lo: ../../include/net-snmp/library/asn1.h
+./smux/smux.lo: ../../include/net-snmp/library/snmp_impl.h
+./smux/smux.lo: ../../include/net-snmp/library/snmp.h
+./smux/smux.lo: ../../include/net-snmp/library/snmp-tc.h
+./smux/smux.lo: ../../include/net-snmp/utilities.h
+./smux/smux.lo: ../../include/net-snmp/library/snmp_client.h
+./smux/smux.lo: ../../include/net-snmp/library/getopt.h
+./smux/smux.lo: ../../include/net-snmp/library/system.h
+./smux/smux.lo: ../../include/net-snmp/library/tools.h
+./smux/smux.lo: ../../include/net-snmp/library/int64.h
+./smux/smux.lo: ../../include/net-snmp/library/mt_support.h
+./smux/smux.lo: ../../include/net-snmp/library/snmp_alarm.h
+./smux/smux.lo: ../../include/net-snmp/library/data_list.h
+./smux/smux.lo: ../../include/net-snmp/library/callback.h
+./smux/smux.lo: ../../include/net-snmp/library/oid_stash.h
+./smux/smux.lo: ../../include/net-snmp/library/check_varbind.h
+./smux/smux.lo: ../../include/net-snmp/version.h
+./smux/smux.lo: ../../include/net-snmp/session_api.h
+./smux/smux.lo: ../../include/net-snmp/library/snmp_transport.h
+./smux/smux.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./smux/smux.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./smux/smux.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./smux/smux.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./smux/smux.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./smux/smux.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./smux/smux.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./smux/smux.lo: ../../include/net-snmp/library/ucd_compat.h
+./smux/smux.lo: ../../include/net-snmp/pdu_api.h
+./smux/smux.lo: ../../include/net-snmp/mib_api.h
+./smux/smux.lo: ../../include/net-snmp/library/mib.h
+./smux/smux.lo: ../../include/net-snmp/library/parse.h
+./smux/smux.lo: ../../include/net-snmp/varbind_api.h
+./smux/smux.lo: ../../include/net-snmp/config_api.h
+./smux/smux.lo: ../../include/net-snmp/library/read_config.h
+./smux/smux.lo: ../../include/net-snmp/library/default_store.h
+./smux/smux.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./smux/smux.lo: ../../include/net-snmp/library/snmp_enum.h
+./smux/smux.lo: ../../include/net-snmp/library/vacm.h
+./smux/smux.lo: ../../include/net-snmp/output_api.h
+./smux/smux.lo: ../../include/net-snmp/library/snmp_debug.h
+./smux/smux.lo: ../../include/net-snmp/library/snmp_logging.h
+./smux/smux.lo: ../../include/net-snmp/snmpv3_api.h
+./smux/smux.lo: ../../include/net-snmp/library/snmpv3.h
+./smux/smux.lo: ../../include/net-snmp/library/transform_oids.h
+./smux/smux.lo: ../../include/net-snmp/library/keytools.h
+./smux/smux.lo: ../../include/net-snmp/library/scapi.h
+./smux/smux.lo: ../../include/net-snmp/library/lcd_time.h
+./smux/smux.lo: ../../include/net-snmp/library/snmp_secmod.h
+./smux/smux.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./smux/smux.lo: ../../include/net-snmp/library/snmpusm.h
+./smux/smux.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./smux/smux.lo: ../../include/net-snmp/agent/snmp_agent.h
+./smux/smux.lo: ../../include/net-snmp/agent/snmp_vars.h
+./smux/smux.lo: ../../include/net-snmp/agent/agent_handler.h
+./smux/smux.lo: ../../include/net-snmp/agent/var_struct.h
+./smux/smux.lo: ../../include/net-snmp/agent/agent_registry.h
+./smux/smux.lo: ../../include/net-snmp/agent/ds_agent.h
+./smux/smux.lo: ../../include/net-snmp/agent/agent_read_config.h
+./smux/smux.lo: ../../include/net-snmp/agent/agent_trap.h
+./smux/smux.lo: ../../include/net-snmp/agent/all_helpers.h
+./smux/smux.lo: ../../include/net-snmp/agent/instance.h
+./smux/smux.lo: ../../include/net-snmp/agent/multiplexer.h
+./smux/smux.lo: ../../include/net-snmp/agent/null.h
+./smux/smux.lo: ../../include/net-snmp/agent/debug_handler.h
+./smux/smux.lo: ../../include/net-snmp/agent/old_api.h
+./smux/smux.lo: ../../include/net-snmp/agent/read_only.h
+./smux/smux.lo: ../../include/net-snmp/agent/serialize.h
+./smux/smux.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./smux/smux.lo: ../../include/net-snmp/agent/mode_end_call.h
+./smux/smux.lo: ../../include/net-snmp/agent/table.h
+./smux/smux.lo: ../../include/net-snmp/agent/table_data.h
+./smux/smux.lo: ../../include/net-snmp/agent/table_dataset.h
+./smux/smux.lo: ../../include/net-snmp/agent/table_iterator.h
+./smux/smux.lo: ../../include/net-snmp/agent/mib_module_config.h smux.h
+./smux/smux.lo: util_funcs.h struct.h mibdefs.h ./../snmpd.h
+./smux/snmp_bgp.lo: ../../include/net-snmp/net-snmp-config.h
+./smux/snmp_bgp.lo: ../../include/net-snmp/system/linux.h
+./smux/snmp_bgp.lo: ../../include/net-snmp/system/sysv.h
+./smux/snmp_bgp.lo: ../../include/net-snmp/system/generic.h
+./smux/snmp_bgp.lo: ../../include/net-snmp/machine/generic.h
+./smux/snmp_bgp.lo: ../../include/net-snmp/net-snmp-includes.h
+./smux/snmp_bgp.lo: ../../include/net-snmp/definitions.h
+./smux/snmp_bgp.lo: ../../include/net-snmp/types.h
+./smux/snmp_bgp.lo: ../../include/net-snmp/library/snmp_api.h
+./smux/snmp_bgp.lo: ../../include/net-snmp/library/asn1.h
+./smux/snmp_bgp.lo: ../../include/net-snmp/library/snmp_impl.h
+./smux/snmp_bgp.lo: ../../include/net-snmp/library/snmp.h
+./smux/snmp_bgp.lo: ../../include/net-snmp/library/snmp-tc.h
+./smux/snmp_bgp.lo: ../../include/net-snmp/utilities.h
+./smux/snmp_bgp.lo: ../../include/net-snmp/library/snmp_client.h
+./smux/snmp_bgp.lo: ../../include/net-snmp/library/getopt.h
+./smux/snmp_bgp.lo: ../../include/net-snmp/library/system.h
+./smux/snmp_bgp.lo: ../../include/net-snmp/library/tools.h
+./smux/snmp_bgp.lo: ../../include/net-snmp/library/int64.h
+./smux/snmp_bgp.lo: ../../include/net-snmp/library/mt_support.h
+./smux/snmp_bgp.lo: ../../include/net-snmp/library/snmp_alarm.h
+./smux/snmp_bgp.lo: ../../include/net-snmp/library/data_list.h
+./smux/snmp_bgp.lo: ../../include/net-snmp/library/callback.h
+./smux/snmp_bgp.lo: ../../include/net-snmp/library/oid_stash.h
+./smux/snmp_bgp.lo: ../../include/net-snmp/library/check_varbind.h
+./smux/snmp_bgp.lo: ../../include/net-snmp/version.h
+./smux/snmp_bgp.lo: ../../include/net-snmp/session_api.h
+./smux/snmp_bgp.lo: ../../include/net-snmp/library/snmp_transport.h
+./smux/snmp_bgp.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./smux/snmp_bgp.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./smux/snmp_bgp.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./smux/snmp_bgp.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./smux/snmp_bgp.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./smux/snmp_bgp.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./smux/snmp_bgp.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./smux/snmp_bgp.lo: ../../include/net-snmp/library/ucd_compat.h
+./smux/snmp_bgp.lo: ../../include/net-snmp/pdu_api.h
+./smux/snmp_bgp.lo: ../../include/net-snmp/mib_api.h
+./smux/snmp_bgp.lo: ../../include/net-snmp/library/mib.h
+./smux/snmp_bgp.lo: ../../include/net-snmp/library/parse.h
+./smux/snmp_bgp.lo: ../../include/net-snmp/varbind_api.h
+./smux/snmp_bgp.lo: ../../include/net-snmp/config_api.h
+./smux/snmp_bgp.lo: ../../include/net-snmp/library/read_config.h
+./smux/snmp_bgp.lo: ../../include/net-snmp/library/default_store.h
+./smux/snmp_bgp.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./smux/snmp_bgp.lo: ../../include/net-snmp/library/snmp_enum.h
+./smux/snmp_bgp.lo: ../../include/net-snmp/library/vacm.h
+./smux/snmp_bgp.lo: ../../include/net-snmp/output_api.h
+./smux/snmp_bgp.lo: ../../include/net-snmp/library/snmp_debug.h
+./smux/snmp_bgp.lo: ../../include/net-snmp/library/snmp_logging.h
+./smux/snmp_bgp.lo: ../../include/net-snmp/snmpv3_api.h
+./smux/snmp_bgp.lo: ../../include/net-snmp/library/snmpv3.h
+./smux/snmp_bgp.lo: ../../include/net-snmp/library/transform_oids.h
+./smux/snmp_bgp.lo: ../../include/net-snmp/library/keytools.h
+./smux/snmp_bgp.lo: ../../include/net-snmp/library/scapi.h
+./smux/snmp_bgp.lo: ../../include/net-snmp/library/lcd_time.h
+./smux/snmp_bgp.lo: ../../include/net-snmp/library/snmp_secmod.h
+./smux/snmp_bgp.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./smux/snmp_bgp.lo: ../../include/net-snmp/library/snmpusm.h
+./smux/snmp_bgp.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./smux/snmp_bgp.lo: ../../include/net-snmp/agent/snmp_agent.h
+./smux/snmp_bgp.lo: ../../include/net-snmp/agent/snmp_vars.h
+./smux/snmp_bgp.lo: ../../include/net-snmp/agent/agent_handler.h
+./smux/snmp_bgp.lo: ../../include/net-snmp/agent/var_struct.h
+./smux/snmp_bgp.lo: ../../include/net-snmp/agent/agent_registry.h
+./smux/snmp_bgp.lo: ../../include/net-snmp/agent/ds_agent.h
+./smux/snmp_bgp.lo: ../../include/net-snmp/agent/agent_read_config.h
+./smux/snmp_bgp.lo: ../../include/net-snmp/agent/agent_trap.h
+./smux/snmp_bgp.lo: ../../include/net-snmp/agent/all_helpers.h
+./smux/snmp_bgp.lo: ../../include/net-snmp/agent/instance.h
+./smux/snmp_bgp.lo: ../../include/net-snmp/agent/multiplexer.h
+./smux/snmp_bgp.lo: ../../include/net-snmp/agent/null.h
+./smux/snmp_bgp.lo: ../../include/net-snmp/agent/debug_handler.h
+./smux/snmp_bgp.lo: ../../include/net-snmp/agent/old_api.h
+./smux/snmp_bgp.lo: ../../include/net-snmp/agent/read_only.h
+./smux/snmp_bgp.lo: ../../include/net-snmp/agent/serialize.h
+./smux/snmp_bgp.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./smux/snmp_bgp.lo: ../../include/net-snmp/agent/mode_end_call.h
+./smux/snmp_bgp.lo: ../../include/net-snmp/agent/table.h
+./smux/snmp_bgp.lo: ../../include/net-snmp/agent/table_data.h
+./smux/snmp_bgp.lo: ../../include/net-snmp/agent/table_dataset.h
+./smux/snmp_bgp.lo: ../../include/net-snmp/agent/table_iterator.h
+./smux/snmp_bgp.lo: ../../include/net-snmp/agent/mib_module_config.h smux.h
+./smux/snmp_bgp.lo: ./smux/snmp_bgp.h
+./smux/snmp_ospf.lo: ../../include/net-snmp/net-snmp-config.h
+./smux/snmp_ospf.lo: ../../include/net-snmp/system/linux.h
+./smux/snmp_ospf.lo: ../../include/net-snmp/system/sysv.h
+./smux/snmp_ospf.lo: ../../include/net-snmp/system/generic.h
+./smux/snmp_ospf.lo: ../../include/net-snmp/machine/generic.h
+./smux/snmp_ospf.lo: ../../include/net-snmp/net-snmp-includes.h
+./smux/snmp_ospf.lo: ../../include/net-snmp/definitions.h
+./smux/snmp_ospf.lo: ../../include/net-snmp/types.h
+./smux/snmp_ospf.lo: ../../include/net-snmp/library/snmp_api.h
+./smux/snmp_ospf.lo: ../../include/net-snmp/library/asn1.h
+./smux/snmp_ospf.lo: ../../include/net-snmp/library/snmp_impl.h
+./smux/snmp_ospf.lo: ../../include/net-snmp/library/snmp.h
+./smux/snmp_ospf.lo: ../../include/net-snmp/library/snmp-tc.h
+./smux/snmp_ospf.lo: ../../include/net-snmp/utilities.h
+./smux/snmp_ospf.lo: ../../include/net-snmp/library/snmp_client.h
+./smux/snmp_ospf.lo: ../../include/net-snmp/library/getopt.h
+./smux/snmp_ospf.lo: ../../include/net-snmp/library/system.h
+./smux/snmp_ospf.lo: ../../include/net-snmp/library/tools.h
+./smux/snmp_ospf.lo: ../../include/net-snmp/library/int64.h
+./smux/snmp_ospf.lo: ../../include/net-snmp/library/mt_support.h
+./smux/snmp_ospf.lo: ../../include/net-snmp/library/snmp_alarm.h
+./smux/snmp_ospf.lo: ../../include/net-snmp/library/data_list.h
+./smux/snmp_ospf.lo: ../../include/net-snmp/library/callback.h
+./smux/snmp_ospf.lo: ../../include/net-snmp/library/oid_stash.h
+./smux/snmp_ospf.lo: ../../include/net-snmp/library/check_varbind.h
+./smux/snmp_ospf.lo: ../../include/net-snmp/version.h
+./smux/snmp_ospf.lo: ../../include/net-snmp/session_api.h
+./smux/snmp_ospf.lo: ../../include/net-snmp/library/snmp_transport.h
+./smux/snmp_ospf.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./smux/snmp_ospf.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./smux/snmp_ospf.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./smux/snmp_ospf.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./smux/snmp_ospf.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./smux/snmp_ospf.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./smux/snmp_ospf.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./smux/snmp_ospf.lo: ../../include/net-snmp/library/ucd_compat.h
+./smux/snmp_ospf.lo: ../../include/net-snmp/pdu_api.h
+./smux/snmp_ospf.lo: ../../include/net-snmp/mib_api.h
+./smux/snmp_ospf.lo: ../../include/net-snmp/library/mib.h
+./smux/snmp_ospf.lo: ../../include/net-snmp/library/parse.h
+./smux/snmp_ospf.lo: ../../include/net-snmp/varbind_api.h
+./smux/snmp_ospf.lo: ../../include/net-snmp/config_api.h
+./smux/snmp_ospf.lo: ../../include/net-snmp/library/read_config.h
+./smux/snmp_ospf.lo: ../../include/net-snmp/library/default_store.h
+./smux/snmp_ospf.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./smux/snmp_ospf.lo: ../../include/net-snmp/library/snmp_enum.h
+./smux/snmp_ospf.lo: ../../include/net-snmp/library/vacm.h
+./smux/snmp_ospf.lo: ../../include/net-snmp/output_api.h
+./smux/snmp_ospf.lo: ../../include/net-snmp/library/snmp_debug.h
+./smux/snmp_ospf.lo: ../../include/net-snmp/library/snmp_logging.h
+./smux/snmp_ospf.lo: ../../include/net-snmp/snmpv3_api.h
+./smux/snmp_ospf.lo: ../../include/net-snmp/library/snmpv3.h
+./smux/snmp_ospf.lo: ../../include/net-snmp/library/transform_oids.h
+./smux/snmp_ospf.lo: ../../include/net-snmp/library/keytools.h
+./smux/snmp_ospf.lo: ../../include/net-snmp/library/scapi.h
+./smux/snmp_ospf.lo: ../../include/net-snmp/library/lcd_time.h
+./smux/snmp_ospf.lo: ../../include/net-snmp/library/snmp_secmod.h
+./smux/snmp_ospf.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./smux/snmp_ospf.lo: ../../include/net-snmp/library/snmpusm.h
+./smux/snmp_ospf.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./smux/snmp_ospf.lo: ../../include/net-snmp/agent/snmp_agent.h
+./smux/snmp_ospf.lo: ../../include/net-snmp/agent/snmp_vars.h
+./smux/snmp_ospf.lo: ../../include/net-snmp/agent/agent_handler.h
+./smux/snmp_ospf.lo: ../../include/net-snmp/agent/var_struct.h
+./smux/snmp_ospf.lo: ../../include/net-snmp/agent/agent_registry.h
+./smux/snmp_ospf.lo: ../../include/net-snmp/agent/ds_agent.h
+./smux/snmp_ospf.lo: ../../include/net-snmp/agent/agent_read_config.h
+./smux/snmp_ospf.lo: ../../include/net-snmp/agent/agent_trap.h
+./smux/snmp_ospf.lo: ../../include/net-snmp/agent/all_helpers.h
+./smux/snmp_ospf.lo: ../../include/net-snmp/agent/instance.h
+./smux/snmp_ospf.lo: ../../include/net-snmp/agent/multiplexer.h
+./smux/snmp_ospf.lo: ../../include/net-snmp/agent/null.h
+./smux/snmp_ospf.lo: ../../include/net-snmp/agent/debug_handler.h
+./smux/snmp_ospf.lo: ../../include/net-snmp/agent/old_api.h
+./smux/snmp_ospf.lo: ../../include/net-snmp/agent/read_only.h
+./smux/snmp_ospf.lo: ../../include/net-snmp/agent/serialize.h
+./smux/snmp_ospf.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./smux/snmp_ospf.lo: ../../include/net-snmp/agent/mode_end_call.h
+./smux/snmp_ospf.lo: ../../include/net-snmp/agent/table.h
+./smux/snmp_ospf.lo: ../../include/net-snmp/agent/table_data.h
+./smux/snmp_ospf.lo: ../../include/net-snmp/agent/table_dataset.h
+./smux/snmp_ospf.lo: ../../include/net-snmp/agent/table_iterator.h
+./smux/snmp_ospf.lo: ../../include/net-snmp/agent/mib_module_config.h smux.h
+./smux/snmp_ospf.lo: ./smux/snmp_ospf.h
+./smux/snmp_rip2.lo: ../../include/net-snmp/net-snmp-config.h
+./smux/snmp_rip2.lo: ../../include/net-snmp/system/linux.h
+./smux/snmp_rip2.lo: ../../include/net-snmp/system/sysv.h
+./smux/snmp_rip2.lo: ../../include/net-snmp/system/generic.h
+./smux/snmp_rip2.lo: ../../include/net-snmp/machine/generic.h
+./smux/snmp_rip2.lo: ../../include/net-snmp/net-snmp-includes.h
+./smux/snmp_rip2.lo: ../../include/net-snmp/definitions.h
+./smux/snmp_rip2.lo: ../../include/net-snmp/types.h
+./smux/snmp_rip2.lo: ../../include/net-snmp/library/snmp_api.h
+./smux/snmp_rip2.lo: ../../include/net-snmp/library/asn1.h
+./smux/snmp_rip2.lo: ../../include/net-snmp/library/snmp_impl.h
+./smux/snmp_rip2.lo: ../../include/net-snmp/library/snmp.h
+./smux/snmp_rip2.lo: ../../include/net-snmp/library/snmp-tc.h
+./smux/snmp_rip2.lo: ../../include/net-snmp/utilities.h
+./smux/snmp_rip2.lo: ../../include/net-snmp/library/snmp_client.h
+./smux/snmp_rip2.lo: ../../include/net-snmp/library/getopt.h
+./smux/snmp_rip2.lo: ../../include/net-snmp/library/system.h
+./smux/snmp_rip2.lo: ../../include/net-snmp/library/tools.h
+./smux/snmp_rip2.lo: ../../include/net-snmp/library/int64.h
+./smux/snmp_rip2.lo: ../../include/net-snmp/library/mt_support.h
+./smux/snmp_rip2.lo: ../../include/net-snmp/library/snmp_alarm.h
+./smux/snmp_rip2.lo: ../../include/net-snmp/library/data_list.h
+./smux/snmp_rip2.lo: ../../include/net-snmp/library/callback.h
+./smux/snmp_rip2.lo: ../../include/net-snmp/library/oid_stash.h
+./smux/snmp_rip2.lo: ../../include/net-snmp/library/check_varbind.h
+./smux/snmp_rip2.lo: ../../include/net-snmp/version.h
+./smux/snmp_rip2.lo: ../../include/net-snmp/session_api.h
+./smux/snmp_rip2.lo: ../../include/net-snmp/library/snmp_transport.h
+./smux/snmp_rip2.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./smux/snmp_rip2.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./smux/snmp_rip2.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./smux/snmp_rip2.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./smux/snmp_rip2.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./smux/snmp_rip2.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./smux/snmp_rip2.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./smux/snmp_rip2.lo: ../../include/net-snmp/library/ucd_compat.h
+./smux/snmp_rip2.lo: ../../include/net-snmp/pdu_api.h
+./smux/snmp_rip2.lo: ../../include/net-snmp/mib_api.h
+./smux/snmp_rip2.lo: ../../include/net-snmp/library/mib.h
+./smux/snmp_rip2.lo: ../../include/net-snmp/library/parse.h
+./smux/snmp_rip2.lo: ../../include/net-snmp/varbind_api.h
+./smux/snmp_rip2.lo: ../../include/net-snmp/config_api.h
+./smux/snmp_rip2.lo: ../../include/net-snmp/library/read_config.h
+./smux/snmp_rip2.lo: ../../include/net-snmp/library/default_store.h
+./smux/snmp_rip2.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./smux/snmp_rip2.lo: ../../include/net-snmp/library/snmp_enum.h
+./smux/snmp_rip2.lo: ../../include/net-snmp/library/vacm.h
+./smux/snmp_rip2.lo: ../../include/net-snmp/output_api.h
+./smux/snmp_rip2.lo: ../../include/net-snmp/library/snmp_debug.h
+./smux/snmp_rip2.lo: ../../include/net-snmp/library/snmp_logging.h
+./smux/snmp_rip2.lo: ../../include/net-snmp/snmpv3_api.h
+./smux/snmp_rip2.lo: ../../include/net-snmp/library/snmpv3.h
+./smux/snmp_rip2.lo: ../../include/net-snmp/library/transform_oids.h
+./smux/snmp_rip2.lo: ../../include/net-snmp/library/keytools.h
+./smux/snmp_rip2.lo: ../../include/net-snmp/library/scapi.h
+./smux/snmp_rip2.lo: ../../include/net-snmp/library/lcd_time.h
+./smux/snmp_rip2.lo: ../../include/net-snmp/library/snmp_secmod.h
+./smux/snmp_rip2.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./smux/snmp_rip2.lo: ../../include/net-snmp/library/snmpusm.h
+./smux/snmp_rip2.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./smux/snmp_rip2.lo: ../../include/net-snmp/agent/snmp_agent.h
+./smux/snmp_rip2.lo: ../../include/net-snmp/agent/snmp_vars.h
+./smux/snmp_rip2.lo: ../../include/net-snmp/agent/agent_handler.h
+./smux/snmp_rip2.lo: ../../include/net-snmp/agent/var_struct.h
+./smux/snmp_rip2.lo: ../../include/net-snmp/agent/agent_registry.h
+./smux/snmp_rip2.lo: ../../include/net-snmp/agent/ds_agent.h
+./smux/snmp_rip2.lo: ../../include/net-snmp/agent/agent_read_config.h
+./smux/snmp_rip2.lo: ../../include/net-snmp/agent/agent_trap.h
+./smux/snmp_rip2.lo: ../../include/net-snmp/agent/all_helpers.h
+./smux/snmp_rip2.lo: ../../include/net-snmp/agent/instance.h
+./smux/snmp_rip2.lo: ../../include/net-snmp/agent/multiplexer.h
+./smux/snmp_rip2.lo: ../../include/net-snmp/agent/null.h
+./smux/snmp_rip2.lo: ../../include/net-snmp/agent/debug_handler.h
+./smux/snmp_rip2.lo: ../../include/net-snmp/agent/old_api.h
+./smux/snmp_rip2.lo: ../../include/net-snmp/agent/read_only.h
+./smux/snmp_rip2.lo: ../../include/net-snmp/agent/serialize.h
+./smux/snmp_rip2.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./smux/snmp_rip2.lo: ../../include/net-snmp/agent/mode_end_call.h
+./smux/snmp_rip2.lo: ../../include/net-snmp/agent/table.h
+./smux/snmp_rip2.lo: ../../include/net-snmp/agent/table_data.h
+./smux/snmp_rip2.lo: ../../include/net-snmp/agent/table_dataset.h
+./smux/snmp_rip2.lo: ../../include/net-snmp/agent/table_iterator.h
+./smux/snmp_rip2.lo: ../../include/net-snmp/agent/mib_module_config.h smux.h
+./smux/snmp_rip2.lo: ./smux/snmp_rip2.h
+./snmpv3/snmpEngine.lo: ../../include/net-snmp/net-snmp-config.h
+./snmpv3/snmpEngine.lo: ../../include/net-snmp/system/linux.h
+./snmpv3/snmpEngine.lo: ../../include/net-snmp/system/sysv.h
+./snmpv3/snmpEngine.lo: ../../include/net-snmp/system/generic.h
+./snmpv3/snmpEngine.lo: ../../include/net-snmp/machine/generic.h
+./snmpv3/snmpEngine.lo: ../../include/net-snmp/net-snmp-includes.h
+./snmpv3/snmpEngine.lo: ../../include/net-snmp/definitions.h
+./snmpv3/snmpEngine.lo: ../../include/net-snmp/types.h
+./snmpv3/snmpEngine.lo: ../../include/net-snmp/library/snmp_api.h
+./snmpv3/snmpEngine.lo: ../../include/net-snmp/library/asn1.h
+./snmpv3/snmpEngine.lo: ../../include/net-snmp/library/snmp_impl.h
+./snmpv3/snmpEngine.lo: ../../include/net-snmp/library/snmp.h
+./snmpv3/snmpEngine.lo: ../../include/net-snmp/library/snmp-tc.h
+./snmpv3/snmpEngine.lo: ../../include/net-snmp/utilities.h
+./snmpv3/snmpEngine.lo: ../../include/net-snmp/library/snmp_client.h
+./snmpv3/snmpEngine.lo: ../../include/net-snmp/library/getopt.h
+./snmpv3/snmpEngine.lo: ../../include/net-snmp/library/system.h
+./snmpv3/snmpEngine.lo: ../../include/net-snmp/library/tools.h
+./snmpv3/snmpEngine.lo: ../../include/net-snmp/library/int64.h
+./snmpv3/snmpEngine.lo: ../../include/net-snmp/library/mt_support.h
+./snmpv3/snmpEngine.lo: ../../include/net-snmp/library/snmp_alarm.h
+./snmpv3/snmpEngine.lo: ../../include/net-snmp/library/data_list.h
+./snmpv3/snmpEngine.lo: ../../include/net-snmp/library/callback.h
+./snmpv3/snmpEngine.lo: ../../include/net-snmp/library/oid_stash.h
+./snmpv3/snmpEngine.lo: ../../include/net-snmp/library/check_varbind.h
+./snmpv3/snmpEngine.lo: ../../include/net-snmp/version.h
+./snmpv3/snmpEngine.lo: ../../include/net-snmp/session_api.h
+./snmpv3/snmpEngine.lo: ../../include/net-snmp/library/snmp_transport.h
+./snmpv3/snmpEngine.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./snmpv3/snmpEngine.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./snmpv3/snmpEngine.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./snmpv3/snmpEngine.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./snmpv3/snmpEngine.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./snmpv3/snmpEngine.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./snmpv3/snmpEngine.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./snmpv3/snmpEngine.lo: ../../include/net-snmp/library/ucd_compat.h
+./snmpv3/snmpEngine.lo: ../../include/net-snmp/pdu_api.h
+./snmpv3/snmpEngine.lo: ../../include/net-snmp/mib_api.h
+./snmpv3/snmpEngine.lo: ../../include/net-snmp/library/mib.h
+./snmpv3/snmpEngine.lo: ../../include/net-snmp/library/parse.h
+./snmpv3/snmpEngine.lo: ../../include/net-snmp/varbind_api.h
+./snmpv3/snmpEngine.lo: ../../include/net-snmp/config_api.h
+./snmpv3/snmpEngine.lo: ../../include/net-snmp/library/read_config.h
+./snmpv3/snmpEngine.lo: ../../include/net-snmp/library/default_store.h
+./snmpv3/snmpEngine.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./snmpv3/snmpEngine.lo: ../../include/net-snmp/library/snmp_enum.h
+./snmpv3/snmpEngine.lo: ../../include/net-snmp/library/vacm.h
+./snmpv3/snmpEngine.lo: ../../include/net-snmp/output_api.h
+./snmpv3/snmpEngine.lo: ../../include/net-snmp/library/snmp_debug.h
+./snmpv3/snmpEngine.lo: ../../include/net-snmp/library/snmp_logging.h
+./snmpv3/snmpEngine.lo: ../../include/net-snmp/snmpv3_api.h
+./snmpv3/snmpEngine.lo: ../../include/net-snmp/library/snmpv3.h
+./snmpv3/snmpEngine.lo: ../../include/net-snmp/library/transform_oids.h
+./snmpv3/snmpEngine.lo: ../../include/net-snmp/library/keytools.h
+./snmpv3/snmpEngine.lo: ../../include/net-snmp/library/scapi.h
+./snmpv3/snmpEngine.lo: ../../include/net-snmp/library/lcd_time.h
+./snmpv3/snmpEngine.lo: ../../include/net-snmp/library/snmp_secmod.h
+./snmpv3/snmpEngine.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./snmpv3/snmpEngine.lo: ../../include/net-snmp/library/snmpusm.h
+./snmpv3/snmpEngine.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./snmpv3/snmpEngine.lo: ../../include/net-snmp/agent/snmp_agent.h
+./snmpv3/snmpEngine.lo: ../../include/net-snmp/agent/snmp_vars.h
+./snmpv3/snmpEngine.lo: ../../include/net-snmp/agent/agent_handler.h
+./snmpv3/snmpEngine.lo: ../../include/net-snmp/agent/var_struct.h
+./snmpv3/snmpEngine.lo: ../../include/net-snmp/agent/agent_registry.h
+./snmpv3/snmpEngine.lo: ../../include/net-snmp/agent/ds_agent.h
+./snmpv3/snmpEngine.lo: ../../include/net-snmp/agent/agent_read_config.h
+./snmpv3/snmpEngine.lo: ../../include/net-snmp/agent/agent_trap.h
+./snmpv3/snmpEngine.lo: ../../include/net-snmp/agent/all_helpers.h
+./snmpv3/snmpEngine.lo: ../../include/net-snmp/agent/instance.h
+./snmpv3/snmpEngine.lo: ../../include/net-snmp/agent/multiplexer.h
+./snmpv3/snmpEngine.lo: ../../include/net-snmp/agent/null.h
+./snmpv3/snmpEngine.lo: ../../include/net-snmp/agent/debug_handler.h
+./snmpv3/snmpEngine.lo: ../../include/net-snmp/agent/old_api.h
+./snmpv3/snmpEngine.lo: ../../include/net-snmp/agent/read_only.h
+./snmpv3/snmpEngine.lo: ../../include/net-snmp/agent/serialize.h
+./snmpv3/snmpEngine.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./snmpv3/snmpEngine.lo: ../../include/net-snmp/agent/mode_end_call.h
+./snmpv3/snmpEngine.lo: ../../include/net-snmp/agent/table.h
+./snmpv3/snmpEngine.lo: ../../include/net-snmp/agent/table_data.h
+./snmpv3/snmpEngine.lo: ../../include/net-snmp/agent/table_dataset.h
+./snmpv3/snmpEngine.lo: ../../include/net-snmp/agent/table_iterator.h
+./snmpv3/snmpEngine.lo: ../../include/net-snmp/agent/mib_module_config.h
+./snmpv3/snmpEngine.lo: util_funcs.h struct.h mibII/sysORTable.h
+./snmpv3/snmpEngine.lo: ./snmpv3/snmpEngine.h
+./snmpv3/snmpMPDStats.lo: ../../include/net-snmp/net-snmp-config.h
+./snmpv3/snmpMPDStats.lo: ../../include/net-snmp/system/linux.h
+./snmpv3/snmpMPDStats.lo: ../../include/net-snmp/system/sysv.h
+./snmpv3/snmpMPDStats.lo: ../../include/net-snmp/system/generic.h
+./snmpv3/snmpMPDStats.lo: ../../include/net-snmp/machine/generic.h
+./snmpv3/snmpMPDStats.lo: ../../include/net-snmp/net-snmp-includes.h
+./snmpv3/snmpMPDStats.lo: ../../include/net-snmp/definitions.h
+./snmpv3/snmpMPDStats.lo: ../../include/net-snmp/types.h
+./snmpv3/snmpMPDStats.lo: ../../include/net-snmp/library/snmp_api.h
+./snmpv3/snmpMPDStats.lo: ../../include/net-snmp/library/asn1.h
+./snmpv3/snmpMPDStats.lo: ../../include/net-snmp/library/snmp_impl.h
+./snmpv3/snmpMPDStats.lo: ../../include/net-snmp/library/snmp.h
+./snmpv3/snmpMPDStats.lo: ../../include/net-snmp/library/snmp-tc.h
+./snmpv3/snmpMPDStats.lo: ../../include/net-snmp/utilities.h
+./snmpv3/snmpMPDStats.lo: ../../include/net-snmp/library/snmp_client.h
+./snmpv3/snmpMPDStats.lo: ../../include/net-snmp/library/getopt.h
+./snmpv3/snmpMPDStats.lo: ../../include/net-snmp/library/system.h
+./snmpv3/snmpMPDStats.lo: ../../include/net-snmp/library/tools.h
+./snmpv3/snmpMPDStats.lo: ../../include/net-snmp/library/int64.h
+./snmpv3/snmpMPDStats.lo: ../../include/net-snmp/library/mt_support.h
+./snmpv3/snmpMPDStats.lo: ../../include/net-snmp/library/snmp_alarm.h
+./snmpv3/snmpMPDStats.lo: ../../include/net-snmp/library/data_list.h
+./snmpv3/snmpMPDStats.lo: ../../include/net-snmp/library/callback.h
+./snmpv3/snmpMPDStats.lo: ../../include/net-snmp/library/oid_stash.h
+./snmpv3/snmpMPDStats.lo: ../../include/net-snmp/library/check_varbind.h
+./snmpv3/snmpMPDStats.lo: ../../include/net-snmp/version.h
+./snmpv3/snmpMPDStats.lo: ../../include/net-snmp/session_api.h
+./snmpv3/snmpMPDStats.lo: ../../include/net-snmp/library/snmp_transport.h
+./snmpv3/snmpMPDStats.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./snmpv3/snmpMPDStats.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./snmpv3/snmpMPDStats.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./snmpv3/snmpMPDStats.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./snmpv3/snmpMPDStats.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./snmpv3/snmpMPDStats.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./snmpv3/snmpMPDStats.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./snmpv3/snmpMPDStats.lo: ../../include/net-snmp/library/ucd_compat.h
+./snmpv3/snmpMPDStats.lo: ../../include/net-snmp/pdu_api.h
+./snmpv3/snmpMPDStats.lo: ../../include/net-snmp/mib_api.h
+./snmpv3/snmpMPDStats.lo: ../../include/net-snmp/library/mib.h
+./snmpv3/snmpMPDStats.lo: ../../include/net-snmp/library/parse.h
+./snmpv3/snmpMPDStats.lo: ../../include/net-snmp/varbind_api.h
+./snmpv3/snmpMPDStats.lo: ../../include/net-snmp/config_api.h
+./snmpv3/snmpMPDStats.lo: ../../include/net-snmp/library/read_config.h
+./snmpv3/snmpMPDStats.lo: ../../include/net-snmp/library/default_store.h
+./snmpv3/snmpMPDStats.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./snmpv3/snmpMPDStats.lo: ../../include/net-snmp/library/snmp_enum.h
+./snmpv3/snmpMPDStats.lo: ../../include/net-snmp/library/vacm.h
+./snmpv3/snmpMPDStats.lo: ../../include/net-snmp/output_api.h
+./snmpv3/snmpMPDStats.lo: ../../include/net-snmp/library/snmp_debug.h
+./snmpv3/snmpMPDStats.lo: ../../include/net-snmp/library/snmp_logging.h
+./snmpv3/snmpMPDStats.lo: ../../include/net-snmp/snmpv3_api.h
+./snmpv3/snmpMPDStats.lo: ../../include/net-snmp/library/snmpv3.h
+./snmpv3/snmpMPDStats.lo: ../../include/net-snmp/library/transform_oids.h
+./snmpv3/snmpMPDStats.lo: ../../include/net-snmp/library/keytools.h
+./snmpv3/snmpMPDStats.lo: ../../include/net-snmp/library/scapi.h
+./snmpv3/snmpMPDStats.lo: ../../include/net-snmp/library/lcd_time.h
+./snmpv3/snmpMPDStats.lo: ../../include/net-snmp/library/snmp_secmod.h
+./snmpv3/snmpMPDStats.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./snmpv3/snmpMPDStats.lo: ../../include/net-snmp/library/snmpusm.h
+./snmpv3/snmpMPDStats.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./snmpv3/snmpMPDStats.lo: ../../include/net-snmp/agent/snmp_agent.h
+./snmpv3/snmpMPDStats.lo: ../../include/net-snmp/agent/snmp_vars.h
+./snmpv3/snmpMPDStats.lo: ../../include/net-snmp/agent/agent_handler.h
+./snmpv3/snmpMPDStats.lo: ../../include/net-snmp/agent/var_struct.h
+./snmpv3/snmpMPDStats.lo: ../../include/net-snmp/agent/agent_registry.h
+./snmpv3/snmpMPDStats.lo: ../../include/net-snmp/agent/ds_agent.h
+./snmpv3/snmpMPDStats.lo: ../../include/net-snmp/agent/agent_read_config.h
+./snmpv3/snmpMPDStats.lo: ../../include/net-snmp/agent/agent_trap.h
+./snmpv3/snmpMPDStats.lo: ../../include/net-snmp/agent/all_helpers.h
+./snmpv3/snmpMPDStats.lo: ../../include/net-snmp/agent/instance.h
+./snmpv3/snmpMPDStats.lo: ../../include/net-snmp/agent/multiplexer.h
+./snmpv3/snmpMPDStats.lo: ../../include/net-snmp/agent/null.h
+./snmpv3/snmpMPDStats.lo: ../../include/net-snmp/agent/debug_handler.h
+./snmpv3/snmpMPDStats.lo: ../../include/net-snmp/agent/old_api.h
+./snmpv3/snmpMPDStats.lo: ../../include/net-snmp/agent/read_only.h
+./snmpv3/snmpMPDStats.lo: ../../include/net-snmp/agent/serialize.h
+./snmpv3/snmpMPDStats.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./snmpv3/snmpMPDStats.lo: ../../include/net-snmp/agent/mode_end_call.h
+./snmpv3/snmpMPDStats.lo: ../../include/net-snmp/agent/table.h
+./snmpv3/snmpMPDStats.lo: ../../include/net-snmp/agent/table_data.h
+./snmpv3/snmpMPDStats.lo: ../../include/net-snmp/agent/table_dataset.h
+./snmpv3/snmpMPDStats.lo: ../../include/net-snmp/agent/table_iterator.h
+./snmpv3/snmpMPDStats.lo: ../../include/net-snmp/agent/mib_module_config.h
+./snmpv3/snmpMPDStats.lo: mibII/sysORTable.h ./snmpv3/snmpMPDStats.h
+./snmpv3/snmpMPDStats.lo: util_funcs.h struct.h
+./snmpv3/usmStats.lo: ../../include/net-snmp/net-snmp-config.h
+./snmpv3/usmStats.lo: ../../include/net-snmp/system/linux.h
+./snmpv3/usmStats.lo: ../../include/net-snmp/system/sysv.h
+./snmpv3/usmStats.lo: ../../include/net-snmp/system/generic.h
+./snmpv3/usmStats.lo: ../../include/net-snmp/machine/generic.h
+./snmpv3/usmStats.lo: ../../include/net-snmp/net-snmp-includes.h
+./snmpv3/usmStats.lo: ../../include/net-snmp/definitions.h
+./snmpv3/usmStats.lo: ../../include/net-snmp/types.h
+./snmpv3/usmStats.lo: ../../include/net-snmp/library/snmp_api.h
+./snmpv3/usmStats.lo: ../../include/net-snmp/library/asn1.h
+./snmpv3/usmStats.lo: ../../include/net-snmp/library/snmp_impl.h
+./snmpv3/usmStats.lo: ../../include/net-snmp/library/snmp.h
+./snmpv3/usmStats.lo: ../../include/net-snmp/library/snmp-tc.h
+./snmpv3/usmStats.lo: ../../include/net-snmp/utilities.h
+./snmpv3/usmStats.lo: ../../include/net-snmp/library/snmp_client.h
+./snmpv3/usmStats.lo: ../../include/net-snmp/library/getopt.h
+./snmpv3/usmStats.lo: ../../include/net-snmp/library/system.h
+./snmpv3/usmStats.lo: ../../include/net-snmp/library/tools.h
+./snmpv3/usmStats.lo: ../../include/net-snmp/library/int64.h
+./snmpv3/usmStats.lo: ../../include/net-snmp/library/mt_support.h
+./snmpv3/usmStats.lo: ../../include/net-snmp/library/snmp_alarm.h
+./snmpv3/usmStats.lo: ../../include/net-snmp/library/data_list.h
+./snmpv3/usmStats.lo: ../../include/net-snmp/library/callback.h
+./snmpv3/usmStats.lo: ../../include/net-snmp/library/oid_stash.h
+./snmpv3/usmStats.lo: ../../include/net-snmp/library/check_varbind.h
+./snmpv3/usmStats.lo: ../../include/net-snmp/version.h
+./snmpv3/usmStats.lo: ../../include/net-snmp/session_api.h
+./snmpv3/usmStats.lo: ../../include/net-snmp/library/snmp_transport.h
+./snmpv3/usmStats.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./snmpv3/usmStats.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./snmpv3/usmStats.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./snmpv3/usmStats.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./snmpv3/usmStats.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./snmpv3/usmStats.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./snmpv3/usmStats.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./snmpv3/usmStats.lo: ../../include/net-snmp/library/ucd_compat.h
+./snmpv3/usmStats.lo: ../../include/net-snmp/pdu_api.h
+./snmpv3/usmStats.lo: ../../include/net-snmp/mib_api.h
+./snmpv3/usmStats.lo: ../../include/net-snmp/library/mib.h
+./snmpv3/usmStats.lo: ../../include/net-snmp/library/parse.h
+./snmpv3/usmStats.lo: ../../include/net-snmp/varbind_api.h
+./snmpv3/usmStats.lo: ../../include/net-snmp/config_api.h
+./snmpv3/usmStats.lo: ../../include/net-snmp/library/read_config.h
+./snmpv3/usmStats.lo: ../../include/net-snmp/library/default_store.h
+./snmpv3/usmStats.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./snmpv3/usmStats.lo: ../../include/net-snmp/library/snmp_enum.h
+./snmpv3/usmStats.lo: ../../include/net-snmp/library/vacm.h
+./snmpv3/usmStats.lo: ../../include/net-snmp/output_api.h
+./snmpv3/usmStats.lo: ../../include/net-snmp/library/snmp_debug.h
+./snmpv3/usmStats.lo: ../../include/net-snmp/library/snmp_logging.h
+./snmpv3/usmStats.lo: ../../include/net-snmp/snmpv3_api.h
+./snmpv3/usmStats.lo: ../../include/net-snmp/library/snmpv3.h
+./snmpv3/usmStats.lo: ../../include/net-snmp/library/transform_oids.h
+./snmpv3/usmStats.lo: ../../include/net-snmp/library/keytools.h
+./snmpv3/usmStats.lo: ../../include/net-snmp/library/scapi.h
+./snmpv3/usmStats.lo: ../../include/net-snmp/library/lcd_time.h
+./snmpv3/usmStats.lo: ../../include/net-snmp/library/snmp_secmod.h
+./snmpv3/usmStats.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./snmpv3/usmStats.lo: ../../include/net-snmp/library/snmpusm.h
+./snmpv3/usmStats.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./snmpv3/usmStats.lo: ../../include/net-snmp/agent/snmp_agent.h
+./snmpv3/usmStats.lo: ../../include/net-snmp/agent/snmp_vars.h
+./snmpv3/usmStats.lo: ../../include/net-snmp/agent/agent_handler.h
+./snmpv3/usmStats.lo: ../../include/net-snmp/agent/var_struct.h
+./snmpv3/usmStats.lo: ../../include/net-snmp/agent/agent_registry.h
+./snmpv3/usmStats.lo: ../../include/net-snmp/agent/ds_agent.h
+./snmpv3/usmStats.lo: ../../include/net-snmp/agent/agent_read_config.h
+./snmpv3/usmStats.lo: ../../include/net-snmp/agent/agent_trap.h
+./snmpv3/usmStats.lo: ../../include/net-snmp/agent/all_helpers.h
+./snmpv3/usmStats.lo: ../../include/net-snmp/agent/instance.h
+./snmpv3/usmStats.lo: ../../include/net-snmp/agent/multiplexer.h
+./snmpv3/usmStats.lo: ../../include/net-snmp/agent/null.h
+./snmpv3/usmStats.lo: ../../include/net-snmp/agent/debug_handler.h
+./snmpv3/usmStats.lo: ../../include/net-snmp/agent/old_api.h
+./snmpv3/usmStats.lo: ../../include/net-snmp/agent/read_only.h
+./snmpv3/usmStats.lo: ../../include/net-snmp/agent/serialize.h
+./snmpv3/usmStats.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./snmpv3/usmStats.lo: ../../include/net-snmp/agent/mode_end_call.h
+./snmpv3/usmStats.lo: ../../include/net-snmp/agent/table.h
+./snmpv3/usmStats.lo: ../../include/net-snmp/agent/table_data.h
+./snmpv3/usmStats.lo: ../../include/net-snmp/agent/table_dataset.h
+./snmpv3/usmStats.lo: ../../include/net-snmp/agent/table_iterator.h
+./snmpv3/usmStats.lo: ../../include/net-snmp/agent/mib_module_config.h
+./snmpv3/usmStats.lo: util_funcs.h struct.h mibII/sysORTable.h
+./snmpv3/usmStats.lo: ./snmpv3/usmStats.h
+./snmpv3/usmUser.lo: ../../include/net-snmp/net-snmp-config.h
+./snmpv3/usmUser.lo: ../../include/net-snmp/system/linux.h
+./snmpv3/usmUser.lo: ../../include/net-snmp/system/sysv.h
+./snmpv3/usmUser.lo: ../../include/net-snmp/system/generic.h
+./snmpv3/usmUser.lo: ../../include/net-snmp/machine/generic.h
+./snmpv3/usmUser.lo: ../../include/net-snmp/net-snmp-includes.h
+./snmpv3/usmUser.lo: ../../include/net-snmp/definitions.h
+./snmpv3/usmUser.lo: ../../include/net-snmp/types.h
+./snmpv3/usmUser.lo: ../../include/net-snmp/library/snmp_api.h
+./snmpv3/usmUser.lo: ../../include/net-snmp/library/asn1.h
+./snmpv3/usmUser.lo: ../../include/net-snmp/library/snmp_impl.h
+./snmpv3/usmUser.lo: ../../include/net-snmp/library/snmp.h
+./snmpv3/usmUser.lo: ../../include/net-snmp/library/snmp-tc.h
+./snmpv3/usmUser.lo: ../../include/net-snmp/utilities.h
+./snmpv3/usmUser.lo: ../../include/net-snmp/library/snmp_client.h
+./snmpv3/usmUser.lo: ../../include/net-snmp/library/getopt.h
+./snmpv3/usmUser.lo: ../../include/net-snmp/library/system.h
+./snmpv3/usmUser.lo: ../../include/net-snmp/library/tools.h
+./snmpv3/usmUser.lo: ../../include/net-snmp/library/int64.h
+./snmpv3/usmUser.lo: ../../include/net-snmp/library/mt_support.h
+./snmpv3/usmUser.lo: ../../include/net-snmp/library/snmp_alarm.h
+./snmpv3/usmUser.lo: ../../include/net-snmp/library/data_list.h
+./snmpv3/usmUser.lo: ../../include/net-snmp/library/callback.h
+./snmpv3/usmUser.lo: ../../include/net-snmp/library/oid_stash.h
+./snmpv3/usmUser.lo: ../../include/net-snmp/library/check_varbind.h
+./snmpv3/usmUser.lo: ../../include/net-snmp/version.h
+./snmpv3/usmUser.lo: ../../include/net-snmp/session_api.h
+./snmpv3/usmUser.lo: ../../include/net-snmp/library/snmp_transport.h
+./snmpv3/usmUser.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./snmpv3/usmUser.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./snmpv3/usmUser.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./snmpv3/usmUser.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./snmpv3/usmUser.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./snmpv3/usmUser.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./snmpv3/usmUser.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./snmpv3/usmUser.lo: ../../include/net-snmp/library/ucd_compat.h
+./snmpv3/usmUser.lo: ../../include/net-snmp/pdu_api.h
+./snmpv3/usmUser.lo: ../../include/net-snmp/mib_api.h
+./snmpv3/usmUser.lo: ../../include/net-snmp/library/mib.h
+./snmpv3/usmUser.lo: ../../include/net-snmp/library/parse.h
+./snmpv3/usmUser.lo: ../../include/net-snmp/varbind_api.h
+./snmpv3/usmUser.lo: ../../include/net-snmp/config_api.h
+./snmpv3/usmUser.lo: ../../include/net-snmp/library/read_config.h
+./snmpv3/usmUser.lo: ../../include/net-snmp/library/default_store.h
+./snmpv3/usmUser.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./snmpv3/usmUser.lo: ../../include/net-snmp/library/snmp_enum.h
+./snmpv3/usmUser.lo: ../../include/net-snmp/library/vacm.h
+./snmpv3/usmUser.lo: ../../include/net-snmp/output_api.h
+./snmpv3/usmUser.lo: ../../include/net-snmp/library/snmp_debug.h
+./snmpv3/usmUser.lo: ../../include/net-snmp/library/snmp_logging.h
+./snmpv3/usmUser.lo: ../../include/net-snmp/snmpv3_api.h
+./snmpv3/usmUser.lo: ../../include/net-snmp/library/snmpv3.h
+./snmpv3/usmUser.lo: ../../include/net-snmp/library/transform_oids.h
+./snmpv3/usmUser.lo: ../../include/net-snmp/library/keytools.h
+./snmpv3/usmUser.lo: ../../include/net-snmp/library/scapi.h
+./snmpv3/usmUser.lo: ../../include/net-snmp/library/lcd_time.h
+./snmpv3/usmUser.lo: ../../include/net-snmp/library/snmp_secmod.h
+./snmpv3/usmUser.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./snmpv3/usmUser.lo: ../../include/net-snmp/library/snmpusm.h
+./snmpv3/usmUser.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./snmpv3/usmUser.lo: ../../include/net-snmp/agent/snmp_agent.h
+./snmpv3/usmUser.lo: ../../include/net-snmp/agent/snmp_vars.h
+./snmpv3/usmUser.lo: ../../include/net-snmp/agent/agent_handler.h
+./snmpv3/usmUser.lo: ../../include/net-snmp/agent/var_struct.h
+./snmpv3/usmUser.lo: ../../include/net-snmp/agent/agent_registry.h
+./snmpv3/usmUser.lo: ../../include/net-snmp/agent/ds_agent.h
+./snmpv3/usmUser.lo: ../../include/net-snmp/agent/agent_read_config.h
+./snmpv3/usmUser.lo: ../../include/net-snmp/agent/agent_trap.h
+./snmpv3/usmUser.lo: ../../include/net-snmp/agent/all_helpers.h
+./snmpv3/usmUser.lo: ../../include/net-snmp/agent/instance.h
+./snmpv3/usmUser.lo: ../../include/net-snmp/agent/multiplexer.h
+./snmpv3/usmUser.lo: ../../include/net-snmp/agent/null.h
+./snmpv3/usmUser.lo: ../../include/net-snmp/agent/debug_handler.h
+./snmpv3/usmUser.lo: ../../include/net-snmp/agent/old_api.h
+./snmpv3/usmUser.lo: ../../include/net-snmp/agent/read_only.h
+./snmpv3/usmUser.lo: ../../include/net-snmp/agent/serialize.h
+./snmpv3/usmUser.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./snmpv3/usmUser.lo: ../../include/net-snmp/agent/mode_end_call.h
+./snmpv3/usmUser.lo: ../../include/net-snmp/agent/table.h
+./snmpv3/usmUser.lo: ../../include/net-snmp/agent/table_data.h
+./snmpv3/usmUser.lo: ../../include/net-snmp/agent/table_dataset.h
+./snmpv3/usmUser.lo: ../../include/net-snmp/agent/table_iterator.h
+./snmpv3/usmUser.lo: ../../include/net-snmp/agent/mib_module_config.h
+./snmpv3/usmUser.lo: util_funcs.h struct.h ./snmpv3/usmUser.h
+./target/snmpTargetAddrEntry.lo: ../../include/net-snmp/net-snmp-config.h
+./target/snmpTargetAddrEntry.lo: ../../include/net-snmp/system/linux.h
+./target/snmpTargetAddrEntry.lo: ../../include/net-snmp/system/sysv.h
+./target/snmpTargetAddrEntry.lo: ../../include/net-snmp/system/generic.h
+./target/snmpTargetAddrEntry.lo: ../../include/net-snmp/machine/generic.h
+./target/snmpTargetAddrEntry.lo: ../../include/net-snmp/net-snmp-includes.h
+./target/snmpTargetAddrEntry.lo: ../../include/net-snmp/definitions.h
+./target/snmpTargetAddrEntry.lo: ../../include/net-snmp/types.h
+./target/snmpTargetAddrEntry.lo: ../../include/net-snmp/library/snmp_api.h
+./target/snmpTargetAddrEntry.lo: ../../include/net-snmp/library/asn1.h
+./target/snmpTargetAddrEntry.lo: ../../include/net-snmp/library/snmp_impl.h
+./target/snmpTargetAddrEntry.lo: ../../include/net-snmp/library/snmp.h
+./target/snmpTargetAddrEntry.lo: ../../include/net-snmp/library/snmp-tc.h
+./target/snmpTargetAddrEntry.lo: ../../include/net-snmp/utilities.h
+./target/snmpTargetAddrEntry.lo: ../../include/net-snmp/library/snmp_client.h
+./target/snmpTargetAddrEntry.lo: ../../include/net-snmp/library/getopt.h
+./target/snmpTargetAddrEntry.lo: ../../include/net-snmp/library/system.h
+./target/snmpTargetAddrEntry.lo: ../../include/net-snmp/library/tools.h
+./target/snmpTargetAddrEntry.lo: ../../include/net-snmp/library/int64.h
+./target/snmpTargetAddrEntry.lo: ../../include/net-snmp/library/mt_support.h
+./target/snmpTargetAddrEntry.lo: ../../include/net-snmp/library/snmp_alarm.h
+./target/snmpTargetAddrEntry.lo: ../../include/net-snmp/library/data_list.h
+./target/snmpTargetAddrEntry.lo: ../../include/net-snmp/library/callback.h
+./target/snmpTargetAddrEntry.lo: ../../include/net-snmp/library/oid_stash.h
+./target/snmpTargetAddrEntry.lo: ../../include/net-snmp/library/check_varbind.h
+./target/snmpTargetAddrEntry.lo: ../../include/net-snmp/version.h
+./target/snmpTargetAddrEntry.lo: ../../include/net-snmp/session_api.h
+./target/snmpTargetAddrEntry.lo: ../../include/net-snmp/library/snmp_transport.h
+./target/snmpTargetAddrEntry.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./target/snmpTargetAddrEntry.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./target/snmpTargetAddrEntry.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./target/snmpTargetAddrEntry.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./target/snmpTargetAddrEntry.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./target/snmpTargetAddrEntry.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./target/snmpTargetAddrEntry.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./target/snmpTargetAddrEntry.lo: ../../include/net-snmp/library/ucd_compat.h
+./target/snmpTargetAddrEntry.lo: ../../include/net-snmp/pdu_api.h
+./target/snmpTargetAddrEntry.lo: ../../include/net-snmp/mib_api.h
+./target/snmpTargetAddrEntry.lo: ../../include/net-snmp/library/mib.h
+./target/snmpTargetAddrEntry.lo: ../../include/net-snmp/library/parse.h
+./target/snmpTargetAddrEntry.lo: ../../include/net-snmp/varbind_api.h
+./target/snmpTargetAddrEntry.lo: ../../include/net-snmp/config_api.h
+./target/snmpTargetAddrEntry.lo: ../../include/net-snmp/library/read_config.h
+./target/snmpTargetAddrEntry.lo: ../../include/net-snmp/library/default_store.h
+./target/snmpTargetAddrEntry.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./target/snmpTargetAddrEntry.lo: ../../include/net-snmp/library/snmp_enum.h
+./target/snmpTargetAddrEntry.lo: ../../include/net-snmp/library/vacm.h
+./target/snmpTargetAddrEntry.lo: ../../include/net-snmp/output_api.h
+./target/snmpTargetAddrEntry.lo: ../../include/net-snmp/library/snmp_debug.h
+./target/snmpTargetAddrEntry.lo: ../../include/net-snmp/library/snmp_logging.h
+./target/snmpTargetAddrEntry.lo: ../../include/net-snmp/snmpv3_api.h
+./target/snmpTargetAddrEntry.lo: ../../include/net-snmp/library/snmpv3.h
+./target/snmpTargetAddrEntry.lo: ../../include/net-snmp/library/transform_oids.h
+./target/snmpTargetAddrEntry.lo: ../../include/net-snmp/library/keytools.h
+./target/snmpTargetAddrEntry.lo: ../../include/net-snmp/library/scapi.h
+./target/snmpTargetAddrEntry.lo: ../../include/net-snmp/library/lcd_time.h
+./target/snmpTargetAddrEntry.lo: ../../include/net-snmp/library/snmp_secmod.h
+./target/snmpTargetAddrEntry.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./target/snmpTargetAddrEntry.lo: ../../include/net-snmp/library/snmpusm.h
+./target/snmpTargetAddrEntry.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./target/snmpTargetAddrEntry.lo: ../../include/net-snmp/agent/snmp_agent.h
+./target/snmpTargetAddrEntry.lo: ../../include/net-snmp/agent/snmp_vars.h
+./target/snmpTargetAddrEntry.lo: ../../include/net-snmp/agent/agent_handler.h
+./target/snmpTargetAddrEntry.lo: ../../include/net-snmp/agent/var_struct.h
+./target/snmpTargetAddrEntry.lo: ../../include/net-snmp/agent/agent_registry.h
+./target/snmpTargetAddrEntry.lo: ../../include/net-snmp/agent/ds_agent.h
+./target/snmpTargetAddrEntry.lo: ../../include/net-snmp/agent/agent_read_config.h
+./target/snmpTargetAddrEntry.lo: ../../include/net-snmp/agent/agent_trap.h
+./target/snmpTargetAddrEntry.lo: ../../include/net-snmp/agent/all_helpers.h
+./target/snmpTargetAddrEntry.lo: ../../include/net-snmp/agent/instance.h
+./target/snmpTargetAddrEntry.lo: ../../include/net-snmp/agent/multiplexer.h
+./target/snmpTargetAddrEntry.lo: ../../include/net-snmp/agent/null.h
+./target/snmpTargetAddrEntry.lo: ../../include/net-snmp/agent/debug_handler.h
+./target/snmpTargetAddrEntry.lo: ../../include/net-snmp/agent/old_api.h
+./target/snmpTargetAddrEntry.lo: ../../include/net-snmp/agent/read_only.h
+./target/snmpTargetAddrEntry.lo: ../../include/net-snmp/agent/serialize.h
+./target/snmpTargetAddrEntry.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./target/snmpTargetAddrEntry.lo: ../../include/net-snmp/agent/mode_end_call.h
+./target/snmpTargetAddrEntry.lo: ../../include/net-snmp/agent/table.h
+./target/snmpTargetAddrEntry.lo: ../../include/net-snmp/agent/table_data.h
+./target/snmpTargetAddrEntry.lo: ../../include/net-snmp/agent/table_dataset.h
+./target/snmpTargetAddrEntry.lo: ../../include/net-snmp/agent/table_iterator.h
+./target/snmpTargetAddrEntry.lo: ../../include/net-snmp/agent/mib_module_config.h
+./target/snmpTargetAddrEntry.lo: ./target/snmpTargetAddrEntry.h util_funcs.h
+./target/snmpTargetAddrEntry.lo: struct.h
+./target/snmpTargetParamsEntry.lo: ../../include/net-snmp/net-snmp-config.h
+./target/snmpTargetParamsEntry.lo: ../../include/net-snmp/system/linux.h
+./target/snmpTargetParamsEntry.lo: ../../include/net-snmp/system/sysv.h
+./target/snmpTargetParamsEntry.lo: ../../include/net-snmp/system/generic.h
+./target/snmpTargetParamsEntry.lo: ../../include/net-snmp/machine/generic.h
+./target/snmpTargetParamsEntry.lo: ../../include/net-snmp/net-snmp-includes.h
+./target/snmpTargetParamsEntry.lo: ../../include/net-snmp/definitions.h
+./target/snmpTargetParamsEntry.lo: ../../include/net-snmp/types.h
+./target/snmpTargetParamsEntry.lo: ../../include/net-snmp/library/snmp_api.h
+./target/snmpTargetParamsEntry.lo: ../../include/net-snmp/library/asn1.h
+./target/snmpTargetParamsEntry.lo: ../../include/net-snmp/library/snmp_impl.h
+./target/snmpTargetParamsEntry.lo: ../../include/net-snmp/library/snmp.h
+./target/snmpTargetParamsEntry.lo: ../../include/net-snmp/library/snmp-tc.h
+./target/snmpTargetParamsEntry.lo: ../../include/net-snmp/utilities.h
+./target/snmpTargetParamsEntry.lo: ../../include/net-snmp/library/snmp_client.h
+./target/snmpTargetParamsEntry.lo: ../../include/net-snmp/library/getopt.h
+./target/snmpTargetParamsEntry.lo: ../../include/net-snmp/library/system.h
+./target/snmpTargetParamsEntry.lo: ../../include/net-snmp/library/tools.h
+./target/snmpTargetParamsEntry.lo: ../../include/net-snmp/library/int64.h
+./target/snmpTargetParamsEntry.lo: ../../include/net-snmp/library/mt_support.h
+./target/snmpTargetParamsEntry.lo: ../../include/net-snmp/library/snmp_alarm.h
+./target/snmpTargetParamsEntry.lo: ../../include/net-snmp/library/data_list.h
+./target/snmpTargetParamsEntry.lo: ../../include/net-snmp/library/callback.h
+./target/snmpTargetParamsEntry.lo: ../../include/net-snmp/library/oid_stash.h
+./target/snmpTargetParamsEntry.lo: ../../include/net-snmp/library/check_varbind.h
+./target/snmpTargetParamsEntry.lo: ../../include/net-snmp/version.h
+./target/snmpTargetParamsEntry.lo: ../../include/net-snmp/session_api.h
+./target/snmpTargetParamsEntry.lo: ../../include/net-snmp/library/snmp_transport.h
+./target/snmpTargetParamsEntry.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./target/snmpTargetParamsEntry.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./target/snmpTargetParamsEntry.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./target/snmpTargetParamsEntry.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./target/snmpTargetParamsEntry.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./target/snmpTargetParamsEntry.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./target/snmpTargetParamsEntry.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./target/snmpTargetParamsEntry.lo: ../../include/net-snmp/library/ucd_compat.h
+./target/snmpTargetParamsEntry.lo: ../../include/net-snmp/pdu_api.h
+./target/snmpTargetParamsEntry.lo: ../../include/net-snmp/mib_api.h
+./target/snmpTargetParamsEntry.lo: ../../include/net-snmp/library/mib.h
+./target/snmpTargetParamsEntry.lo: ../../include/net-snmp/library/parse.h
+./target/snmpTargetParamsEntry.lo: ../../include/net-snmp/varbind_api.h
+./target/snmpTargetParamsEntry.lo: ../../include/net-snmp/config_api.h
+./target/snmpTargetParamsEntry.lo: ../../include/net-snmp/library/read_config.h
+./target/snmpTargetParamsEntry.lo: ../../include/net-snmp/library/default_store.h
+./target/snmpTargetParamsEntry.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./target/snmpTargetParamsEntry.lo: ../../include/net-snmp/library/snmp_enum.h
+./target/snmpTargetParamsEntry.lo: ../../include/net-snmp/library/vacm.h
+./target/snmpTargetParamsEntry.lo: ../../include/net-snmp/output_api.h
+./target/snmpTargetParamsEntry.lo: ../../include/net-snmp/library/snmp_debug.h
+./target/snmpTargetParamsEntry.lo: ../../include/net-snmp/library/snmp_logging.h
+./target/snmpTargetParamsEntry.lo: ../../include/net-snmp/snmpv3_api.h
+./target/snmpTargetParamsEntry.lo: ../../include/net-snmp/library/snmpv3.h
+./target/snmpTargetParamsEntry.lo: ../../include/net-snmp/library/transform_oids.h
+./target/snmpTargetParamsEntry.lo: ../../include/net-snmp/library/keytools.h
+./target/snmpTargetParamsEntry.lo: ../../include/net-snmp/library/scapi.h
+./target/snmpTargetParamsEntry.lo: ../../include/net-snmp/library/lcd_time.h
+./target/snmpTargetParamsEntry.lo: ../../include/net-snmp/library/snmp_secmod.h
+./target/snmpTargetParamsEntry.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./target/snmpTargetParamsEntry.lo: ../../include/net-snmp/library/snmpusm.h
+./target/snmpTargetParamsEntry.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./target/snmpTargetParamsEntry.lo: ../../include/net-snmp/agent/snmp_agent.h
+./target/snmpTargetParamsEntry.lo: ../../include/net-snmp/agent/snmp_vars.h
+./target/snmpTargetParamsEntry.lo: ../../include/net-snmp/agent/agent_handler.h
+./target/snmpTargetParamsEntry.lo: ../../include/net-snmp/agent/var_struct.h
+./target/snmpTargetParamsEntry.lo: ../../include/net-snmp/agent/agent_registry.h
+./target/snmpTargetParamsEntry.lo: ../../include/net-snmp/agent/ds_agent.h
+./target/snmpTargetParamsEntry.lo: ../../include/net-snmp/agent/agent_read_config.h
+./target/snmpTargetParamsEntry.lo: ../../include/net-snmp/agent/agent_trap.h
+./target/snmpTargetParamsEntry.lo: ../../include/net-snmp/agent/all_helpers.h
+./target/snmpTargetParamsEntry.lo: ../../include/net-snmp/agent/instance.h
+./target/snmpTargetParamsEntry.lo: ../../include/net-snmp/agent/multiplexer.h
+./target/snmpTargetParamsEntry.lo: ../../include/net-snmp/agent/null.h
+./target/snmpTargetParamsEntry.lo: ../../include/net-snmp/agent/debug_handler.h
+./target/snmpTargetParamsEntry.lo: ../../include/net-snmp/agent/old_api.h
+./target/snmpTargetParamsEntry.lo: ../../include/net-snmp/agent/read_only.h
+./target/snmpTargetParamsEntry.lo: ../../include/net-snmp/agent/serialize.h
+./target/snmpTargetParamsEntry.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./target/snmpTargetParamsEntry.lo: ../../include/net-snmp/agent/mode_end_call.h
+./target/snmpTargetParamsEntry.lo: ../../include/net-snmp/agent/table.h
+./target/snmpTargetParamsEntry.lo: ../../include/net-snmp/agent/table_data.h
+./target/snmpTargetParamsEntry.lo: ../../include/net-snmp/agent/table_dataset.h
+./target/snmpTargetParamsEntry.lo: ../../include/net-snmp/agent/table_iterator.h
+./target/snmpTargetParamsEntry.lo: ../../include/net-snmp/agent/mib_module_config.h
+./target/snmpTargetParamsEntry.lo: ./target/snmpTargetParamsEntry.h
+./target/target.lo: ../../include/net-snmp/net-snmp-config.h
+./target/target.lo: ../../include/net-snmp/system/linux.h
+./target/target.lo: ../../include/net-snmp/system/sysv.h
+./target/target.lo: ../../include/net-snmp/system/generic.h
+./target/target.lo: ../../include/net-snmp/machine/generic.h
+./target/target.lo: ../../include/net-snmp/net-snmp-includes.h
+./target/target.lo: ../../include/net-snmp/definitions.h
+./target/target.lo: ../../include/net-snmp/types.h
+./target/target.lo: ../../include/net-snmp/library/snmp_api.h
+./target/target.lo: ../../include/net-snmp/library/asn1.h
+./target/target.lo: ../../include/net-snmp/library/snmp_impl.h
+./target/target.lo: ../../include/net-snmp/library/snmp.h
+./target/target.lo: ../../include/net-snmp/library/snmp-tc.h
+./target/target.lo: ../../include/net-snmp/utilities.h
+./target/target.lo: ../../include/net-snmp/library/snmp_client.h
+./target/target.lo: ../../include/net-snmp/library/getopt.h
+./target/target.lo: ../../include/net-snmp/library/system.h
+./target/target.lo: ../../include/net-snmp/library/tools.h
+./target/target.lo: ../../include/net-snmp/library/int64.h
+./target/target.lo: ../../include/net-snmp/library/mt_support.h
+./target/target.lo: ../../include/net-snmp/library/snmp_alarm.h
+./target/target.lo: ../../include/net-snmp/library/data_list.h
+./target/target.lo: ../../include/net-snmp/library/callback.h
+./target/target.lo: ../../include/net-snmp/library/oid_stash.h
+./target/target.lo: ../../include/net-snmp/library/check_varbind.h
+./target/target.lo: ../../include/net-snmp/version.h
+./target/target.lo: ../../include/net-snmp/session_api.h
+./target/target.lo: ../../include/net-snmp/library/snmp_transport.h
+./target/target.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./target/target.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./target/target.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./target/target.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./target/target.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./target/target.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./target/target.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./target/target.lo: ../../include/net-snmp/library/ucd_compat.h
+./target/target.lo: ../../include/net-snmp/pdu_api.h
+./target/target.lo: ../../include/net-snmp/mib_api.h
+./target/target.lo: ../../include/net-snmp/library/mib.h
+./target/target.lo: ../../include/net-snmp/library/parse.h
+./target/target.lo: ../../include/net-snmp/varbind_api.h
+./target/target.lo: ../../include/net-snmp/config_api.h
+./target/target.lo: ../../include/net-snmp/library/read_config.h
+./target/target.lo: ../../include/net-snmp/library/default_store.h
+./target/target.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./target/target.lo: ../../include/net-snmp/library/snmp_enum.h
+./target/target.lo: ../../include/net-snmp/library/vacm.h
+./target/target.lo: ../../include/net-snmp/output_api.h
+./target/target.lo: ../../include/net-snmp/library/snmp_debug.h
+./target/target.lo: ../../include/net-snmp/library/snmp_logging.h
+./target/target.lo: ../../include/net-snmp/snmpv3_api.h
+./target/target.lo: ../../include/net-snmp/library/snmpv3.h
+./target/target.lo: ../../include/net-snmp/library/transform_oids.h
+./target/target.lo: ../../include/net-snmp/library/keytools.h
+./target/target.lo: ../../include/net-snmp/library/scapi.h
+./target/target.lo: ../../include/net-snmp/library/lcd_time.h
+./target/target.lo: ../../include/net-snmp/library/snmp_secmod.h
+./target/target.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./target/target.lo: ../../include/net-snmp/library/snmpusm.h
+./target/target.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./target/target.lo: ../../include/net-snmp/agent/snmp_agent.h
+./target/target.lo: ../../include/net-snmp/agent/snmp_vars.h
+./target/target.lo: ../../include/net-snmp/agent/agent_handler.h
+./target/target.lo: ../../include/net-snmp/agent/var_struct.h
+./target/target.lo: ../../include/net-snmp/agent/agent_registry.h
+./target/target.lo: ../../include/net-snmp/agent/ds_agent.h
+./target/target.lo: ../../include/net-snmp/agent/agent_read_config.h
+./target/target.lo: ../../include/net-snmp/agent/agent_trap.h
+./target/target.lo: ../../include/net-snmp/agent/all_helpers.h
+./target/target.lo: ../../include/net-snmp/agent/instance.h
+./target/target.lo: ../../include/net-snmp/agent/multiplexer.h
+./target/target.lo: ../../include/net-snmp/agent/null.h
+./target/target.lo: ../../include/net-snmp/agent/debug_handler.h
+./target/target.lo: ../../include/net-snmp/agent/old_api.h
+./target/target.lo: ../../include/net-snmp/agent/read_only.h
+./target/target.lo: ../../include/net-snmp/agent/serialize.h
+./target/target.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./target/target.lo: ../../include/net-snmp/agent/mode_end_call.h
+./target/target.lo: ../../include/net-snmp/agent/table.h
+./target/target.lo: ../../include/net-snmp/agent/table_data.h
+./target/target.lo: ../../include/net-snmp/agent/table_dataset.h
+./target/target.lo: ../../include/net-snmp/agent/table_iterator.h
+./target/target.lo: ../../include/net-snmp/agent/mib_module_config.h
+./target/target.lo: ./target/snmpTargetAddrEntry.h
+./target/target.lo: ./target/snmpTargetParamsEntry.h target.h
+./target/target_counters.lo: ../../include/net-snmp/net-snmp-config.h
+./target/target_counters.lo: ../../include/net-snmp/system/linux.h
+./target/target_counters.lo: ../../include/net-snmp/system/sysv.h
+./target/target_counters.lo: ../../include/net-snmp/system/generic.h
+./target/target_counters.lo: ../../include/net-snmp/machine/generic.h
+./target/target_counters.lo: ../../include/net-snmp/net-snmp-includes.h
+./target/target_counters.lo: ../../include/net-snmp/definitions.h
+./target/target_counters.lo: ../../include/net-snmp/types.h
+./target/target_counters.lo: ../../include/net-snmp/library/snmp_api.h
+./target/target_counters.lo: ../../include/net-snmp/library/asn1.h
+./target/target_counters.lo: ../../include/net-snmp/library/snmp_impl.h
+./target/target_counters.lo: ../../include/net-snmp/library/snmp.h
+./target/target_counters.lo: ../../include/net-snmp/library/snmp-tc.h
+./target/target_counters.lo: ../../include/net-snmp/utilities.h
+./target/target_counters.lo: ../../include/net-snmp/library/snmp_client.h
+./target/target_counters.lo: ../../include/net-snmp/library/getopt.h
+./target/target_counters.lo: ../../include/net-snmp/library/system.h
+./target/target_counters.lo: ../../include/net-snmp/library/tools.h
+./target/target_counters.lo: ../../include/net-snmp/library/int64.h
+./target/target_counters.lo: ../../include/net-snmp/library/mt_support.h
+./target/target_counters.lo: ../../include/net-snmp/library/snmp_alarm.h
+./target/target_counters.lo: ../../include/net-snmp/library/data_list.h
+./target/target_counters.lo: ../../include/net-snmp/library/callback.h
+./target/target_counters.lo: ../../include/net-snmp/library/oid_stash.h
+./target/target_counters.lo: ../../include/net-snmp/library/check_varbind.h
+./target/target_counters.lo: ../../include/net-snmp/version.h
+./target/target_counters.lo: ../../include/net-snmp/session_api.h
+./target/target_counters.lo: ../../include/net-snmp/library/snmp_transport.h
+./target/target_counters.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./target/target_counters.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./target/target_counters.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./target/target_counters.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./target/target_counters.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./target/target_counters.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./target/target_counters.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./target/target_counters.lo: ../../include/net-snmp/library/ucd_compat.h
+./target/target_counters.lo: ../../include/net-snmp/pdu_api.h
+./target/target_counters.lo: ../../include/net-snmp/mib_api.h
+./target/target_counters.lo: ../../include/net-snmp/library/mib.h
+./target/target_counters.lo: ../../include/net-snmp/library/parse.h
+./target/target_counters.lo: ../../include/net-snmp/varbind_api.h
+./target/target_counters.lo: ../../include/net-snmp/config_api.h
+./target/target_counters.lo: ../../include/net-snmp/library/read_config.h
+./target/target_counters.lo: ../../include/net-snmp/library/default_store.h
+./target/target_counters.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./target/target_counters.lo: ../../include/net-snmp/library/snmp_enum.h
+./target/target_counters.lo: ../../include/net-snmp/library/vacm.h
+./target/target_counters.lo: ../../include/net-snmp/output_api.h
+./target/target_counters.lo: ../../include/net-snmp/library/snmp_debug.h
+./target/target_counters.lo: ../../include/net-snmp/library/snmp_logging.h
+./target/target_counters.lo: ../../include/net-snmp/snmpv3_api.h
+./target/target_counters.lo: ../../include/net-snmp/library/snmpv3.h
+./target/target_counters.lo: ../../include/net-snmp/library/transform_oids.h
+./target/target_counters.lo: ../../include/net-snmp/library/keytools.h
+./target/target_counters.lo: ../../include/net-snmp/library/scapi.h
+./target/target_counters.lo: ../../include/net-snmp/library/lcd_time.h
+./target/target_counters.lo: ../../include/net-snmp/library/snmp_secmod.h
+./target/target_counters.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./target/target_counters.lo: ../../include/net-snmp/library/snmpusm.h
+./target/target_counters.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./target/target_counters.lo: ../../include/net-snmp/agent/snmp_agent.h
+./target/target_counters.lo: ../../include/net-snmp/agent/snmp_vars.h
+./target/target_counters.lo: ../../include/net-snmp/agent/agent_handler.h
+./target/target_counters.lo: ../../include/net-snmp/agent/var_struct.h
+./target/target_counters.lo: ../../include/net-snmp/agent/agent_registry.h
+./target/target_counters.lo: ../../include/net-snmp/agent/ds_agent.h
+./target/target_counters.lo: ../../include/net-snmp/agent/agent_read_config.h
+./target/target_counters.lo: ../../include/net-snmp/agent/agent_trap.h
+./target/target_counters.lo: ../../include/net-snmp/agent/all_helpers.h
+./target/target_counters.lo: ../../include/net-snmp/agent/instance.h
+./target/target_counters.lo: ../../include/net-snmp/agent/multiplexer.h
+./target/target_counters.lo: ../../include/net-snmp/agent/null.h
+./target/target_counters.lo: ../../include/net-snmp/agent/debug_handler.h
+./target/target_counters.lo: ../../include/net-snmp/agent/old_api.h
+./target/target_counters.lo: ../../include/net-snmp/agent/read_only.h
+./target/target_counters.lo: ../../include/net-snmp/agent/serialize.h
+./target/target_counters.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./target/target_counters.lo: ../../include/net-snmp/agent/mode_end_call.h
+./target/target_counters.lo: ../../include/net-snmp/agent/table.h
+./target/target_counters.lo: ../../include/net-snmp/agent/table_data.h
+./target/target_counters.lo: ../../include/net-snmp/agent/table_dataset.h
+./target/target_counters.lo: ../../include/net-snmp/agent/table_iterator.h
+./target/target_counters.lo: ../../include/net-snmp/agent/mib_module_config.h
+./target/target_counters.lo: ./target/target_counters.h
+./tunnel/tunnel.lo: ../../include/net-snmp/net-snmp-config.h
+./tunnel/tunnel.lo: ../../include/net-snmp/system/linux.h
+./tunnel/tunnel.lo: ../../include/net-snmp/system/sysv.h
+./tunnel/tunnel.lo: ../../include/net-snmp/system/generic.h
+./tunnel/tunnel.lo: ../../include/net-snmp/machine/generic.h
+./tunnel/tunnel.lo: ../../include/net-snmp/net-snmp-includes.h
+./tunnel/tunnel.lo: ../../include/net-snmp/definitions.h
+./tunnel/tunnel.lo: ../../include/net-snmp/types.h
+./tunnel/tunnel.lo: ../../include/net-snmp/library/snmp_api.h
+./tunnel/tunnel.lo: ../../include/net-snmp/library/asn1.h
+./tunnel/tunnel.lo: ../../include/net-snmp/library/snmp_impl.h
+./tunnel/tunnel.lo: ../../include/net-snmp/library/snmp.h
+./tunnel/tunnel.lo: ../../include/net-snmp/library/snmp-tc.h
+./tunnel/tunnel.lo: ../../include/net-snmp/utilities.h
+./tunnel/tunnel.lo: ../../include/net-snmp/library/snmp_client.h
+./tunnel/tunnel.lo: ../../include/net-snmp/library/getopt.h
+./tunnel/tunnel.lo: ../../include/net-snmp/library/system.h
+./tunnel/tunnel.lo: ../../include/net-snmp/library/tools.h
+./tunnel/tunnel.lo: ../../include/net-snmp/library/int64.h
+./tunnel/tunnel.lo: ../../include/net-snmp/library/mt_support.h
+./tunnel/tunnel.lo: ../../include/net-snmp/library/snmp_alarm.h
+./tunnel/tunnel.lo: ../../include/net-snmp/library/data_list.h
+./tunnel/tunnel.lo: ../../include/net-snmp/library/callback.h
+./tunnel/tunnel.lo: ../../include/net-snmp/library/oid_stash.h
+./tunnel/tunnel.lo: ../../include/net-snmp/library/check_varbind.h
+./tunnel/tunnel.lo: ../../include/net-snmp/version.h
+./tunnel/tunnel.lo: ../../include/net-snmp/session_api.h
+./tunnel/tunnel.lo: ../../include/net-snmp/library/snmp_transport.h
+./tunnel/tunnel.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./tunnel/tunnel.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./tunnel/tunnel.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./tunnel/tunnel.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./tunnel/tunnel.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./tunnel/tunnel.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./tunnel/tunnel.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./tunnel/tunnel.lo: ../../include/net-snmp/library/ucd_compat.h
+./tunnel/tunnel.lo: ../../include/net-snmp/pdu_api.h
+./tunnel/tunnel.lo: ../../include/net-snmp/mib_api.h
+./tunnel/tunnel.lo: ../../include/net-snmp/library/mib.h
+./tunnel/tunnel.lo: ../../include/net-snmp/library/parse.h
+./tunnel/tunnel.lo: ../../include/net-snmp/varbind_api.h
+./tunnel/tunnel.lo: ../../include/net-snmp/config_api.h
+./tunnel/tunnel.lo: ../../include/net-snmp/library/read_config.h
+./tunnel/tunnel.lo: ../../include/net-snmp/library/default_store.h
+./tunnel/tunnel.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./tunnel/tunnel.lo: ../../include/net-snmp/library/snmp_enum.h
+./tunnel/tunnel.lo: ../../include/net-snmp/library/vacm.h
+./tunnel/tunnel.lo: ../../include/net-snmp/output_api.h
+./tunnel/tunnel.lo: ../../include/net-snmp/library/snmp_debug.h
+./tunnel/tunnel.lo: ../../include/net-snmp/library/snmp_logging.h
+./tunnel/tunnel.lo: ../../include/net-snmp/snmpv3_api.h
+./tunnel/tunnel.lo: ../../include/net-snmp/library/snmpv3.h
+./tunnel/tunnel.lo: ../../include/net-snmp/library/transform_oids.h
+./tunnel/tunnel.lo: ../../include/net-snmp/library/keytools.h
+./tunnel/tunnel.lo: ../../include/net-snmp/library/scapi.h
+./tunnel/tunnel.lo: ../../include/net-snmp/library/lcd_time.h
+./tunnel/tunnel.lo: ../../include/net-snmp/library/snmp_secmod.h
+./tunnel/tunnel.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./tunnel/tunnel.lo: ../../include/net-snmp/library/snmpusm.h
+./tunnel/tunnel.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./tunnel/tunnel.lo: ../../include/net-snmp/agent/snmp_agent.h
+./tunnel/tunnel.lo: ../../include/net-snmp/agent/snmp_vars.h
+./tunnel/tunnel.lo: ../../include/net-snmp/agent/agent_handler.h
+./tunnel/tunnel.lo: ../../include/net-snmp/agent/var_struct.h
+./tunnel/tunnel.lo: ../../include/net-snmp/agent/agent_registry.h
+./tunnel/tunnel.lo: ../../include/net-snmp/agent/ds_agent.h
+./tunnel/tunnel.lo: ../../include/net-snmp/agent/agent_read_config.h
+./tunnel/tunnel.lo: ../../include/net-snmp/agent/agent_trap.h
+./tunnel/tunnel.lo: ../../include/net-snmp/agent/all_helpers.h
+./tunnel/tunnel.lo: ../../include/net-snmp/agent/instance.h
+./tunnel/tunnel.lo: ../../include/net-snmp/agent/multiplexer.h
+./tunnel/tunnel.lo: ../../include/net-snmp/agent/null.h
+./tunnel/tunnel.lo: ../../include/net-snmp/agent/debug_handler.h
+./tunnel/tunnel.lo: ../../include/net-snmp/agent/old_api.h
+./tunnel/tunnel.lo: ../../include/net-snmp/agent/read_only.h
+./tunnel/tunnel.lo: ../../include/net-snmp/agent/serialize.h
+./tunnel/tunnel.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./tunnel/tunnel.lo: ../../include/net-snmp/agent/mode_end_call.h
+./tunnel/tunnel.lo: ../../include/net-snmp/agent/table.h
+./tunnel/tunnel.lo: ../../include/net-snmp/agent/table_data.h
+./tunnel/tunnel.lo: ../../include/net-snmp/agent/table_dataset.h
+./tunnel/tunnel.lo: ../../include/net-snmp/agent/table_iterator.h
+./tunnel/tunnel.lo: ../../include/net-snmp/agent/mib_module_config.h
+./tunnel/tunnel.lo: util_funcs.h struct.h tunnel.h
+./ucd-snmp/disk.lo: ../../include/net-snmp/net-snmp-config.h
+./ucd-snmp/disk.lo: ../../include/net-snmp/system/linux.h
+./ucd-snmp/disk.lo: ../../include/net-snmp/system/sysv.h
+./ucd-snmp/disk.lo: ../../include/net-snmp/system/generic.h
+./ucd-snmp/disk.lo: ../../include/net-snmp/machine/generic.h
+./ucd-snmp/disk.lo: ../../include/net-snmp/net-snmp-includes.h
+./ucd-snmp/disk.lo: ../../include/net-snmp/definitions.h
+./ucd-snmp/disk.lo: ../../include/net-snmp/types.h
+./ucd-snmp/disk.lo: ../../include/net-snmp/library/snmp_api.h
+./ucd-snmp/disk.lo: ../../include/net-snmp/library/asn1.h
+./ucd-snmp/disk.lo: ../../include/net-snmp/library/snmp_impl.h
+./ucd-snmp/disk.lo: ../../include/net-snmp/library/snmp.h
+./ucd-snmp/disk.lo: ../../include/net-snmp/library/snmp-tc.h
+./ucd-snmp/disk.lo: ../../include/net-snmp/utilities.h
+./ucd-snmp/disk.lo: ../../include/net-snmp/library/snmp_client.h
+./ucd-snmp/disk.lo: ../../include/net-snmp/library/getopt.h
+./ucd-snmp/disk.lo: ../../include/net-snmp/library/system.h
+./ucd-snmp/disk.lo: ../../include/net-snmp/library/tools.h
+./ucd-snmp/disk.lo: ../../include/net-snmp/library/int64.h
+./ucd-snmp/disk.lo: ../../include/net-snmp/library/mt_support.h
+./ucd-snmp/disk.lo: ../../include/net-snmp/library/snmp_alarm.h
+./ucd-snmp/disk.lo: ../../include/net-snmp/library/data_list.h
+./ucd-snmp/disk.lo: ../../include/net-snmp/library/callback.h
+./ucd-snmp/disk.lo: ../../include/net-snmp/library/oid_stash.h
+./ucd-snmp/disk.lo: ../../include/net-snmp/library/check_varbind.h
+./ucd-snmp/disk.lo: ../../include/net-snmp/version.h
+./ucd-snmp/disk.lo: ../../include/net-snmp/session_api.h
+./ucd-snmp/disk.lo: ../../include/net-snmp/library/snmp_transport.h
+./ucd-snmp/disk.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./ucd-snmp/disk.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./ucd-snmp/disk.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./ucd-snmp/disk.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./ucd-snmp/disk.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./ucd-snmp/disk.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./ucd-snmp/disk.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./ucd-snmp/disk.lo: ../../include/net-snmp/library/ucd_compat.h
+./ucd-snmp/disk.lo: ../../include/net-snmp/pdu_api.h
+./ucd-snmp/disk.lo: ../../include/net-snmp/mib_api.h
+./ucd-snmp/disk.lo: ../../include/net-snmp/library/mib.h
+./ucd-snmp/disk.lo: ../../include/net-snmp/library/parse.h
+./ucd-snmp/disk.lo: ../../include/net-snmp/varbind_api.h
+./ucd-snmp/disk.lo: ../../include/net-snmp/config_api.h
+./ucd-snmp/disk.lo: ../../include/net-snmp/library/read_config.h
+./ucd-snmp/disk.lo: ../../include/net-snmp/library/default_store.h
+./ucd-snmp/disk.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./ucd-snmp/disk.lo: ../../include/net-snmp/library/snmp_enum.h
+./ucd-snmp/disk.lo: ../../include/net-snmp/library/vacm.h
+./ucd-snmp/disk.lo: ../../include/net-snmp/output_api.h
+./ucd-snmp/disk.lo: ../../include/net-snmp/library/snmp_debug.h
+./ucd-snmp/disk.lo: ../../include/net-snmp/library/snmp_logging.h
+./ucd-snmp/disk.lo: ../../include/net-snmp/snmpv3_api.h
+./ucd-snmp/disk.lo: ../../include/net-snmp/library/snmpv3.h
+./ucd-snmp/disk.lo: ../../include/net-snmp/library/transform_oids.h
+./ucd-snmp/disk.lo: ../../include/net-snmp/library/keytools.h
+./ucd-snmp/disk.lo: ../../include/net-snmp/library/scapi.h
+./ucd-snmp/disk.lo: ../../include/net-snmp/library/lcd_time.h
+./ucd-snmp/disk.lo: ../../include/net-snmp/library/snmp_secmod.h
+./ucd-snmp/disk.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./ucd-snmp/disk.lo: ../../include/net-snmp/library/snmpusm.h
+./ucd-snmp/disk.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./ucd-snmp/disk.lo: ../../include/net-snmp/agent/snmp_agent.h
+./ucd-snmp/disk.lo: ../../include/net-snmp/agent/snmp_vars.h
+./ucd-snmp/disk.lo: ../../include/net-snmp/agent/agent_handler.h
+./ucd-snmp/disk.lo: ../../include/net-snmp/agent/var_struct.h
+./ucd-snmp/disk.lo: ../../include/net-snmp/agent/agent_registry.h
+./ucd-snmp/disk.lo: ../../include/net-snmp/agent/ds_agent.h
+./ucd-snmp/disk.lo: ../../include/net-snmp/agent/agent_read_config.h
+./ucd-snmp/disk.lo: ../../include/net-snmp/agent/agent_trap.h
+./ucd-snmp/disk.lo: ../../include/net-snmp/agent/all_helpers.h
+./ucd-snmp/disk.lo: ../../include/net-snmp/agent/instance.h
+./ucd-snmp/disk.lo: ../../include/net-snmp/agent/multiplexer.h
+./ucd-snmp/disk.lo: ../../include/net-snmp/agent/null.h
+./ucd-snmp/disk.lo: ../../include/net-snmp/agent/debug_handler.h
+./ucd-snmp/disk.lo: ../../include/net-snmp/agent/old_api.h
+./ucd-snmp/disk.lo: ../../include/net-snmp/agent/read_only.h
+./ucd-snmp/disk.lo: ../../include/net-snmp/agent/serialize.h
+./ucd-snmp/disk.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./ucd-snmp/disk.lo: ../../include/net-snmp/agent/mode_end_call.h
+./ucd-snmp/disk.lo: ../../include/net-snmp/agent/table.h
+./ucd-snmp/disk.lo: ../../include/net-snmp/agent/table_data.h
+./ucd-snmp/disk.lo: ../../include/net-snmp/agent/table_dataset.h
+./ucd-snmp/disk.lo: ../../include/net-snmp/agent/table_iterator.h
+./ucd-snmp/disk.lo: ../../include/net-snmp/agent/mib_module_config.h
+./ucd-snmp/disk.lo: ../../include/net-snmp/agent/auto_nlist.h struct.h
+./ucd-snmp/disk.lo: ./ucd-snmp/disk.h mibdefs.h util_funcs.h
+./ucd-snmp/disk.lo: ./ucd-snmp/errormib.h
+./ucd-snmp/diskio.lo: ../../include/net-snmp/net-snmp-config.h
+./ucd-snmp/diskio.lo: ../../include/net-snmp/system/linux.h
+./ucd-snmp/diskio.lo: ../../include/net-snmp/system/sysv.h
+./ucd-snmp/diskio.lo: ../../include/net-snmp/system/generic.h
+./ucd-snmp/diskio.lo: ../../include/net-snmp/machine/generic.h
+./ucd-snmp/diskio.lo: ../../include/net-snmp/net-snmp-includes.h
+./ucd-snmp/diskio.lo: ../../include/net-snmp/definitions.h
+./ucd-snmp/diskio.lo: ../../include/net-snmp/types.h
+./ucd-snmp/diskio.lo: ../../include/net-snmp/library/snmp_api.h
+./ucd-snmp/diskio.lo: ../../include/net-snmp/library/asn1.h
+./ucd-snmp/diskio.lo: ../../include/net-snmp/library/snmp_impl.h
+./ucd-snmp/diskio.lo: ../../include/net-snmp/library/snmp.h
+./ucd-snmp/diskio.lo: ../../include/net-snmp/library/snmp-tc.h
+./ucd-snmp/diskio.lo: ../../include/net-snmp/utilities.h
+./ucd-snmp/diskio.lo: ../../include/net-snmp/library/snmp_client.h
+./ucd-snmp/diskio.lo: ../../include/net-snmp/library/getopt.h
+./ucd-snmp/diskio.lo: ../../include/net-snmp/library/system.h
+./ucd-snmp/diskio.lo: ../../include/net-snmp/library/tools.h
+./ucd-snmp/diskio.lo: ../../include/net-snmp/library/int64.h
+./ucd-snmp/diskio.lo: ../../include/net-snmp/library/mt_support.h
+./ucd-snmp/diskio.lo: ../../include/net-snmp/library/snmp_alarm.h
+./ucd-snmp/diskio.lo: ../../include/net-snmp/library/data_list.h
+./ucd-snmp/diskio.lo: ../../include/net-snmp/library/callback.h
+./ucd-snmp/diskio.lo: ../../include/net-snmp/library/oid_stash.h
+./ucd-snmp/diskio.lo: ../../include/net-snmp/library/check_varbind.h
+./ucd-snmp/diskio.lo: ../../include/net-snmp/version.h
+./ucd-snmp/diskio.lo: ../../include/net-snmp/session_api.h
+./ucd-snmp/diskio.lo: ../../include/net-snmp/library/snmp_transport.h
+./ucd-snmp/diskio.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./ucd-snmp/diskio.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./ucd-snmp/diskio.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./ucd-snmp/diskio.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./ucd-snmp/diskio.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./ucd-snmp/diskio.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./ucd-snmp/diskio.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./ucd-snmp/diskio.lo: ../../include/net-snmp/library/ucd_compat.h
+./ucd-snmp/diskio.lo: ../../include/net-snmp/pdu_api.h
+./ucd-snmp/diskio.lo: ../../include/net-snmp/mib_api.h
+./ucd-snmp/diskio.lo: ../../include/net-snmp/library/mib.h
+./ucd-snmp/diskio.lo: ../../include/net-snmp/library/parse.h
+./ucd-snmp/diskio.lo: ../../include/net-snmp/varbind_api.h
+./ucd-snmp/diskio.lo: ../../include/net-snmp/config_api.h
+./ucd-snmp/diskio.lo: ../../include/net-snmp/library/read_config.h
+./ucd-snmp/diskio.lo: ../../include/net-snmp/library/default_store.h
+./ucd-snmp/diskio.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./ucd-snmp/diskio.lo: ../../include/net-snmp/library/snmp_enum.h
+./ucd-snmp/diskio.lo: ../../include/net-snmp/library/vacm.h
+./ucd-snmp/diskio.lo: ../../include/net-snmp/output_api.h
+./ucd-snmp/diskio.lo: ../../include/net-snmp/library/snmp_debug.h
+./ucd-snmp/diskio.lo: ../../include/net-snmp/library/snmp_logging.h
+./ucd-snmp/diskio.lo: ../../include/net-snmp/snmpv3_api.h
+./ucd-snmp/diskio.lo: ../../include/net-snmp/library/snmpv3.h
+./ucd-snmp/diskio.lo: ../../include/net-snmp/library/transform_oids.h
+./ucd-snmp/diskio.lo: ../../include/net-snmp/library/keytools.h
+./ucd-snmp/diskio.lo: ../../include/net-snmp/library/scapi.h
+./ucd-snmp/diskio.lo: ../../include/net-snmp/library/lcd_time.h
+./ucd-snmp/diskio.lo: ../../include/net-snmp/library/snmp_secmod.h
+./ucd-snmp/diskio.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./ucd-snmp/diskio.lo: ../../include/net-snmp/library/snmpusm.h
+./ucd-snmp/diskio.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./ucd-snmp/diskio.lo: ../../include/net-snmp/agent/snmp_agent.h
+./ucd-snmp/diskio.lo: ../../include/net-snmp/agent/snmp_vars.h
+./ucd-snmp/diskio.lo: ../../include/net-snmp/agent/agent_handler.h
+./ucd-snmp/diskio.lo: ../../include/net-snmp/agent/var_struct.h
+./ucd-snmp/diskio.lo: ../../include/net-snmp/agent/agent_registry.h
+./ucd-snmp/diskio.lo: ../../include/net-snmp/agent/ds_agent.h
+./ucd-snmp/diskio.lo: ../../include/net-snmp/agent/agent_read_config.h
+./ucd-snmp/diskio.lo: ../../include/net-snmp/agent/agent_trap.h
+./ucd-snmp/diskio.lo: ../../include/net-snmp/agent/all_helpers.h
+./ucd-snmp/diskio.lo: ../../include/net-snmp/agent/instance.h
+./ucd-snmp/diskio.lo: ../../include/net-snmp/agent/multiplexer.h
+./ucd-snmp/diskio.lo: ../../include/net-snmp/agent/null.h
+./ucd-snmp/diskio.lo: ../../include/net-snmp/agent/debug_handler.h
+./ucd-snmp/diskio.lo: ../../include/net-snmp/agent/old_api.h
+./ucd-snmp/diskio.lo: ../../include/net-snmp/agent/read_only.h
+./ucd-snmp/diskio.lo: ../../include/net-snmp/agent/serialize.h
+./ucd-snmp/diskio.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./ucd-snmp/diskio.lo: ../../include/net-snmp/agent/mode_end_call.h
+./ucd-snmp/diskio.lo: ../../include/net-snmp/agent/table.h
+./ucd-snmp/diskio.lo: ../../include/net-snmp/agent/table_data.h
+./ucd-snmp/diskio.lo: ../../include/net-snmp/agent/table_dataset.h
+./ucd-snmp/diskio.lo: ../../include/net-snmp/agent/table_iterator.h
+./ucd-snmp/diskio.lo: ../../include/net-snmp/agent/mib_module_config.h
+./ucd-snmp/diskio.lo: util_funcs.h struct.h ./ucd-snmp/diskio.h
+./ucd-snmp/dlmod.lo: ../../include/net-snmp/net-snmp-config.h
+./ucd-snmp/dlmod.lo: ../../include/net-snmp/system/linux.h
+./ucd-snmp/dlmod.lo: ../../include/net-snmp/system/sysv.h
+./ucd-snmp/dlmod.lo: ../../include/net-snmp/system/generic.h
+./ucd-snmp/dlmod.lo: ../../include/net-snmp/machine/generic.h
+./ucd-snmp/dlmod.lo: ../../include/net-snmp/net-snmp-includes.h
+./ucd-snmp/dlmod.lo: ../../include/net-snmp/definitions.h
+./ucd-snmp/dlmod.lo: ../../include/net-snmp/types.h
+./ucd-snmp/dlmod.lo: ../../include/net-snmp/library/snmp_api.h
+./ucd-snmp/dlmod.lo: ../../include/net-snmp/library/asn1.h
+./ucd-snmp/dlmod.lo: ../../include/net-snmp/library/snmp_impl.h
+./ucd-snmp/dlmod.lo: ../../include/net-snmp/library/snmp.h
+./ucd-snmp/dlmod.lo: ../../include/net-snmp/library/snmp-tc.h
+./ucd-snmp/dlmod.lo: ../../include/net-snmp/utilities.h
+./ucd-snmp/dlmod.lo: ../../include/net-snmp/library/snmp_client.h
+./ucd-snmp/dlmod.lo: ../../include/net-snmp/library/getopt.h
+./ucd-snmp/dlmod.lo: ../../include/net-snmp/library/system.h
+./ucd-snmp/dlmod.lo: ../../include/net-snmp/library/tools.h
+./ucd-snmp/dlmod.lo: ../../include/net-snmp/library/int64.h
+./ucd-snmp/dlmod.lo: ../../include/net-snmp/library/mt_support.h
+./ucd-snmp/dlmod.lo: ../../include/net-snmp/library/snmp_alarm.h
+./ucd-snmp/dlmod.lo: ../../include/net-snmp/library/data_list.h
+./ucd-snmp/dlmod.lo: ../../include/net-snmp/library/callback.h
+./ucd-snmp/dlmod.lo: ../../include/net-snmp/library/oid_stash.h
+./ucd-snmp/dlmod.lo: ../../include/net-snmp/library/check_varbind.h
+./ucd-snmp/dlmod.lo: ../../include/net-snmp/version.h
+./ucd-snmp/dlmod.lo: ../../include/net-snmp/session_api.h
+./ucd-snmp/dlmod.lo: ../../include/net-snmp/library/snmp_transport.h
+./ucd-snmp/dlmod.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./ucd-snmp/dlmod.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./ucd-snmp/dlmod.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./ucd-snmp/dlmod.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./ucd-snmp/dlmod.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./ucd-snmp/dlmod.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./ucd-snmp/dlmod.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./ucd-snmp/dlmod.lo: ../../include/net-snmp/library/ucd_compat.h
+./ucd-snmp/dlmod.lo: ../../include/net-snmp/pdu_api.h
+./ucd-snmp/dlmod.lo: ../../include/net-snmp/mib_api.h
+./ucd-snmp/dlmod.lo: ../../include/net-snmp/library/mib.h
+./ucd-snmp/dlmod.lo: ../../include/net-snmp/library/parse.h
+./ucd-snmp/dlmod.lo: ../../include/net-snmp/varbind_api.h
+./ucd-snmp/dlmod.lo: ../../include/net-snmp/config_api.h
+./ucd-snmp/dlmod.lo: ../../include/net-snmp/library/read_config.h
+./ucd-snmp/dlmod.lo: ../../include/net-snmp/library/default_store.h
+./ucd-snmp/dlmod.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./ucd-snmp/dlmod.lo: ../../include/net-snmp/library/snmp_enum.h
+./ucd-snmp/dlmod.lo: ../../include/net-snmp/library/vacm.h
+./ucd-snmp/dlmod.lo: ../../include/net-snmp/output_api.h
+./ucd-snmp/dlmod.lo: ../../include/net-snmp/library/snmp_debug.h
+./ucd-snmp/dlmod.lo: ../../include/net-snmp/library/snmp_logging.h
+./ucd-snmp/dlmod.lo: ../../include/net-snmp/snmpv3_api.h
+./ucd-snmp/dlmod.lo: ../../include/net-snmp/library/snmpv3.h
+./ucd-snmp/dlmod.lo: ../../include/net-snmp/library/transform_oids.h
+./ucd-snmp/dlmod.lo: ../../include/net-snmp/library/keytools.h
+./ucd-snmp/dlmod.lo: ../../include/net-snmp/library/scapi.h
+./ucd-snmp/dlmod.lo: ../../include/net-snmp/library/lcd_time.h
+./ucd-snmp/dlmod.lo: ../../include/net-snmp/library/snmp_secmod.h
+./ucd-snmp/dlmod.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./ucd-snmp/dlmod.lo: ../../include/net-snmp/library/snmpusm.h
+./ucd-snmp/dlmod.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./ucd-snmp/dlmod.lo: ../../include/net-snmp/agent/snmp_agent.h
+./ucd-snmp/dlmod.lo: ../../include/net-snmp/agent/snmp_vars.h
+./ucd-snmp/dlmod.lo: ../../include/net-snmp/agent/agent_handler.h
+./ucd-snmp/dlmod.lo: ../../include/net-snmp/agent/var_struct.h
+./ucd-snmp/dlmod.lo: ../../include/net-snmp/agent/agent_registry.h
+./ucd-snmp/dlmod.lo: ../../include/net-snmp/agent/ds_agent.h
+./ucd-snmp/dlmod.lo: ../../include/net-snmp/agent/agent_read_config.h
+./ucd-snmp/dlmod.lo: ../../include/net-snmp/agent/agent_trap.h
+./ucd-snmp/dlmod.lo: ../../include/net-snmp/agent/all_helpers.h
+./ucd-snmp/dlmod.lo: ../../include/net-snmp/agent/instance.h
+./ucd-snmp/dlmod.lo: ../../include/net-snmp/agent/multiplexer.h
+./ucd-snmp/dlmod.lo: ../../include/net-snmp/agent/null.h
+./ucd-snmp/dlmod.lo: ../../include/net-snmp/agent/debug_handler.h
+./ucd-snmp/dlmod.lo: ../../include/net-snmp/agent/old_api.h
+./ucd-snmp/dlmod.lo: ../../include/net-snmp/agent/read_only.h
+./ucd-snmp/dlmod.lo: ../../include/net-snmp/agent/serialize.h
+./ucd-snmp/dlmod.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./ucd-snmp/dlmod.lo: ../../include/net-snmp/agent/mode_end_call.h
+./ucd-snmp/dlmod.lo: ../../include/net-snmp/agent/table.h
+./ucd-snmp/dlmod.lo: ../../include/net-snmp/agent/table_data.h
+./ucd-snmp/dlmod.lo: ../../include/net-snmp/agent/table_dataset.h
+./ucd-snmp/dlmod.lo: ../../include/net-snmp/agent/table_iterator.h
+./ucd-snmp/dlmod.lo: ../../include/net-snmp/agent/mib_module_config.h
+./ucd-snmp/dlmod.lo: struct.h util_funcs.h 
+./ucd-snmp/dlmod.lo:  ./misc/dlmod.h mibdefs.h
+./ucd-snmp/errormib.lo: ../../include/net-snmp/net-snmp-config.h
+./ucd-snmp/errormib.lo: ../../include/net-snmp/system/linux.h
+./ucd-snmp/errormib.lo: ../../include/net-snmp/system/sysv.h
+./ucd-snmp/errormib.lo: ../../include/net-snmp/system/generic.h
+./ucd-snmp/errormib.lo: ../../include/net-snmp/machine/generic.h
+./ucd-snmp/errormib.lo: ../../include/net-snmp/net-snmp-includes.h
+./ucd-snmp/errormib.lo: ../../include/net-snmp/definitions.h
+./ucd-snmp/errormib.lo: ../../include/net-snmp/types.h
+./ucd-snmp/errormib.lo: ../../include/net-snmp/library/snmp_api.h
+./ucd-snmp/errormib.lo: ../../include/net-snmp/library/asn1.h
+./ucd-snmp/errormib.lo: ../../include/net-snmp/library/snmp_impl.h
+./ucd-snmp/errormib.lo: ../../include/net-snmp/library/snmp.h
+./ucd-snmp/errormib.lo: ../../include/net-snmp/library/snmp-tc.h
+./ucd-snmp/errormib.lo: ../../include/net-snmp/utilities.h
+./ucd-snmp/errormib.lo: ../../include/net-snmp/library/snmp_client.h
+./ucd-snmp/errormib.lo: ../../include/net-snmp/library/getopt.h
+./ucd-snmp/errormib.lo: ../../include/net-snmp/library/system.h
+./ucd-snmp/errormib.lo: ../../include/net-snmp/library/tools.h
+./ucd-snmp/errormib.lo: ../../include/net-snmp/library/int64.h
+./ucd-snmp/errormib.lo: ../../include/net-snmp/library/mt_support.h
+./ucd-snmp/errormib.lo: ../../include/net-snmp/library/snmp_alarm.h
+./ucd-snmp/errormib.lo: ../../include/net-snmp/library/data_list.h
+./ucd-snmp/errormib.lo: ../../include/net-snmp/library/callback.h
+./ucd-snmp/errormib.lo: ../../include/net-snmp/library/oid_stash.h
+./ucd-snmp/errormib.lo: ../../include/net-snmp/library/check_varbind.h
+./ucd-snmp/errormib.lo: ../../include/net-snmp/version.h
+./ucd-snmp/errormib.lo: ../../include/net-snmp/session_api.h
+./ucd-snmp/errormib.lo: ../../include/net-snmp/library/snmp_transport.h
+./ucd-snmp/errormib.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./ucd-snmp/errormib.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./ucd-snmp/errormib.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./ucd-snmp/errormib.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./ucd-snmp/errormib.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./ucd-snmp/errormib.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./ucd-snmp/errormib.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./ucd-snmp/errormib.lo: ../../include/net-snmp/library/ucd_compat.h
+./ucd-snmp/errormib.lo: ../../include/net-snmp/pdu_api.h
+./ucd-snmp/errormib.lo: ../../include/net-snmp/mib_api.h
+./ucd-snmp/errormib.lo: ../../include/net-snmp/library/mib.h
+./ucd-snmp/errormib.lo: ../../include/net-snmp/library/parse.h
+./ucd-snmp/errormib.lo: ../../include/net-snmp/varbind_api.h
+./ucd-snmp/errormib.lo: ../../include/net-snmp/config_api.h
+./ucd-snmp/errormib.lo: ../../include/net-snmp/library/read_config.h
+./ucd-snmp/errormib.lo: ../../include/net-snmp/library/default_store.h
+./ucd-snmp/errormib.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./ucd-snmp/errormib.lo: ../../include/net-snmp/library/snmp_enum.h
+./ucd-snmp/errormib.lo: ../../include/net-snmp/library/vacm.h
+./ucd-snmp/errormib.lo: ../../include/net-snmp/output_api.h
+./ucd-snmp/errormib.lo: ../../include/net-snmp/library/snmp_debug.h
+./ucd-snmp/errormib.lo: ../../include/net-snmp/library/snmp_logging.h
+./ucd-snmp/errormib.lo: ../../include/net-snmp/snmpv3_api.h
+./ucd-snmp/errormib.lo: ../../include/net-snmp/library/snmpv3.h
+./ucd-snmp/errormib.lo: ../../include/net-snmp/library/transform_oids.h
+./ucd-snmp/errormib.lo: ../../include/net-snmp/library/keytools.h
+./ucd-snmp/errormib.lo: ../../include/net-snmp/library/scapi.h
+./ucd-snmp/errormib.lo: ../../include/net-snmp/library/lcd_time.h
+./ucd-snmp/errormib.lo: ../../include/net-snmp/library/snmp_secmod.h
+./ucd-snmp/errormib.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./ucd-snmp/errormib.lo: ../../include/net-snmp/library/snmpusm.h
+./ucd-snmp/errormib.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./ucd-snmp/errormib.lo: ../../include/net-snmp/agent/snmp_agent.h
+./ucd-snmp/errormib.lo: ../../include/net-snmp/agent/snmp_vars.h
+./ucd-snmp/errormib.lo: ../../include/net-snmp/agent/agent_handler.h
+./ucd-snmp/errormib.lo: ../../include/net-snmp/agent/var_struct.h
+./ucd-snmp/errormib.lo: ../../include/net-snmp/agent/agent_registry.h
+./ucd-snmp/errormib.lo: ../../include/net-snmp/agent/ds_agent.h
+./ucd-snmp/errormib.lo: ../../include/net-snmp/agent/agent_read_config.h
+./ucd-snmp/errormib.lo: ../../include/net-snmp/agent/agent_trap.h
+./ucd-snmp/errormib.lo: ../../include/net-snmp/agent/all_helpers.h
+./ucd-snmp/errormib.lo: ../../include/net-snmp/agent/instance.h
+./ucd-snmp/errormib.lo: ../../include/net-snmp/agent/multiplexer.h
+./ucd-snmp/errormib.lo: ../../include/net-snmp/agent/null.h
+./ucd-snmp/errormib.lo: ../../include/net-snmp/agent/debug_handler.h
+./ucd-snmp/errormib.lo: ../../include/net-snmp/agent/old_api.h
+./ucd-snmp/errormib.lo: ../../include/net-snmp/agent/read_only.h
+./ucd-snmp/errormib.lo: ../../include/net-snmp/agent/serialize.h
+./ucd-snmp/errormib.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./ucd-snmp/errormib.lo: ../../include/net-snmp/agent/mode_end_call.h
+./ucd-snmp/errormib.lo: ../../include/net-snmp/agent/table.h
+./ucd-snmp/errormib.lo: ../../include/net-snmp/agent/table_data.h
+./ucd-snmp/errormib.lo: ../../include/net-snmp/agent/table_dataset.h
+./ucd-snmp/errormib.lo: ../../include/net-snmp/agent/table_iterator.h
+./ucd-snmp/errormib.lo: ../../include/net-snmp/agent/mib_module_config.h
+./ucd-snmp/errormib.lo: ../../include/net-snmp/agent/auto_nlist.h struct.h
+./ucd-snmp/errormib.lo: ./ucd-snmp/errormib.h mibdefs.h util_funcs.h
+./ucd-snmp/extensible.lo: ../../include/net-snmp/net-snmp-config.h
+./ucd-snmp/extensible.lo: ../../include/net-snmp/system/linux.h
+./ucd-snmp/extensible.lo: ../../include/net-snmp/system/sysv.h
+./ucd-snmp/extensible.lo: ../../include/net-snmp/system/generic.h
+./ucd-snmp/extensible.lo: ../../include/net-snmp/machine/generic.h
+./ucd-snmp/extensible.lo: ../../include/net-snmp/net-snmp-includes.h
+./ucd-snmp/extensible.lo: ../../include/net-snmp/definitions.h
+./ucd-snmp/extensible.lo: ../../include/net-snmp/types.h
+./ucd-snmp/extensible.lo: ../../include/net-snmp/library/snmp_api.h
+./ucd-snmp/extensible.lo: ../../include/net-snmp/library/asn1.h
+./ucd-snmp/extensible.lo: ../../include/net-snmp/library/snmp_impl.h
+./ucd-snmp/extensible.lo: ../../include/net-snmp/library/snmp.h
+./ucd-snmp/extensible.lo: ../../include/net-snmp/library/snmp-tc.h
+./ucd-snmp/extensible.lo: ../../include/net-snmp/utilities.h
+./ucd-snmp/extensible.lo: ../../include/net-snmp/library/snmp_client.h
+./ucd-snmp/extensible.lo: ../../include/net-snmp/library/getopt.h
+./ucd-snmp/extensible.lo: ../../include/net-snmp/library/system.h
+./ucd-snmp/extensible.lo: ../../include/net-snmp/library/tools.h
+./ucd-snmp/extensible.lo: ../../include/net-snmp/library/int64.h
+./ucd-snmp/extensible.lo: ../../include/net-snmp/library/mt_support.h
+./ucd-snmp/extensible.lo: ../../include/net-snmp/library/snmp_alarm.h
+./ucd-snmp/extensible.lo: ../../include/net-snmp/library/data_list.h
+./ucd-snmp/extensible.lo: ../../include/net-snmp/library/callback.h
+./ucd-snmp/extensible.lo: ../../include/net-snmp/library/oid_stash.h
+./ucd-snmp/extensible.lo: ../../include/net-snmp/library/check_varbind.h
+./ucd-snmp/extensible.lo: ../../include/net-snmp/version.h
+./ucd-snmp/extensible.lo: ../../include/net-snmp/session_api.h
+./ucd-snmp/extensible.lo: ../../include/net-snmp/library/snmp_transport.h
+./ucd-snmp/extensible.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./ucd-snmp/extensible.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./ucd-snmp/extensible.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./ucd-snmp/extensible.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./ucd-snmp/extensible.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./ucd-snmp/extensible.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./ucd-snmp/extensible.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./ucd-snmp/extensible.lo: ../../include/net-snmp/library/ucd_compat.h
+./ucd-snmp/extensible.lo: ../../include/net-snmp/pdu_api.h
+./ucd-snmp/extensible.lo: ../../include/net-snmp/mib_api.h
+./ucd-snmp/extensible.lo: ../../include/net-snmp/library/mib.h
+./ucd-snmp/extensible.lo: ../../include/net-snmp/library/parse.h
+./ucd-snmp/extensible.lo: ../../include/net-snmp/varbind_api.h
+./ucd-snmp/extensible.lo: ../../include/net-snmp/config_api.h
+./ucd-snmp/extensible.lo: ../../include/net-snmp/library/read_config.h
+./ucd-snmp/extensible.lo: ../../include/net-snmp/library/default_store.h
+./ucd-snmp/extensible.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./ucd-snmp/extensible.lo: ../../include/net-snmp/library/snmp_enum.h
+./ucd-snmp/extensible.lo: ../../include/net-snmp/library/vacm.h
+./ucd-snmp/extensible.lo: ../../include/net-snmp/output_api.h
+./ucd-snmp/extensible.lo: ../../include/net-snmp/library/snmp_debug.h
+./ucd-snmp/extensible.lo: ../../include/net-snmp/library/snmp_logging.h
+./ucd-snmp/extensible.lo: ../../include/net-snmp/snmpv3_api.h
+./ucd-snmp/extensible.lo: ../../include/net-snmp/library/snmpv3.h
+./ucd-snmp/extensible.lo: ../../include/net-snmp/library/transform_oids.h
+./ucd-snmp/extensible.lo: ../../include/net-snmp/library/keytools.h
+./ucd-snmp/extensible.lo: ../../include/net-snmp/library/scapi.h
+./ucd-snmp/extensible.lo: ../../include/net-snmp/library/lcd_time.h
+./ucd-snmp/extensible.lo: ../../include/net-snmp/library/snmp_secmod.h
+./ucd-snmp/extensible.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./ucd-snmp/extensible.lo: ../../include/net-snmp/library/snmpusm.h
+./ucd-snmp/extensible.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./ucd-snmp/extensible.lo: ../../include/net-snmp/agent/snmp_agent.h
+./ucd-snmp/extensible.lo: ../../include/net-snmp/agent/snmp_vars.h
+./ucd-snmp/extensible.lo: ../../include/net-snmp/agent/agent_handler.h
+./ucd-snmp/extensible.lo: ../../include/net-snmp/agent/var_struct.h
+./ucd-snmp/extensible.lo: ../../include/net-snmp/agent/agent_registry.h
+./ucd-snmp/extensible.lo: ../../include/net-snmp/agent/ds_agent.h
+./ucd-snmp/extensible.lo: ../../include/net-snmp/agent/agent_read_config.h
+./ucd-snmp/extensible.lo: ../../include/net-snmp/agent/agent_trap.h
+./ucd-snmp/extensible.lo: ../../include/net-snmp/agent/all_helpers.h
+./ucd-snmp/extensible.lo: ../../include/net-snmp/agent/instance.h
+./ucd-snmp/extensible.lo: ../../include/net-snmp/agent/multiplexer.h
+./ucd-snmp/extensible.lo: ../../include/net-snmp/agent/null.h
+./ucd-snmp/extensible.lo: ../../include/net-snmp/agent/debug_handler.h
+./ucd-snmp/extensible.lo: ../../include/net-snmp/agent/old_api.h
+./ucd-snmp/extensible.lo: ../../include/net-snmp/agent/read_only.h
+./ucd-snmp/extensible.lo: ../../include/net-snmp/agent/serialize.h
+./ucd-snmp/extensible.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./ucd-snmp/extensible.lo: ../../include/net-snmp/agent/mode_end_call.h
+./ucd-snmp/extensible.lo: ../../include/net-snmp/agent/table.h
+./ucd-snmp/extensible.lo: ../../include/net-snmp/agent/table_data.h
+./ucd-snmp/extensible.lo: ../../include/net-snmp/agent/table_dataset.h
+./ucd-snmp/extensible.lo: ../../include/net-snmp/agent/table_iterator.h
+./ucd-snmp/extensible.lo: ../../include/net-snmp/agent/mib_module_config.h
+./ucd-snmp/extensible.lo: ../../include/net-snmp/agent/auto_nlist.h struct.h
+./ucd-snmp/extensible.lo: ./ucd-snmp/extensible.h mibdefs.h util_funcs.h
+./ucd-snmp/file.lo: ../../include/net-snmp/net-snmp-config.h
+./ucd-snmp/file.lo: ../../include/net-snmp/system/linux.h
+./ucd-snmp/file.lo: ../../include/net-snmp/system/sysv.h
+./ucd-snmp/file.lo: ../../include/net-snmp/system/generic.h
+./ucd-snmp/file.lo: ../../include/net-snmp/machine/generic.h
+./ucd-snmp/file.lo: ../../include/net-snmp/net-snmp-includes.h
+./ucd-snmp/file.lo: ../../include/net-snmp/definitions.h
+./ucd-snmp/file.lo: ../../include/net-snmp/types.h
+./ucd-snmp/file.lo: ../../include/net-snmp/library/snmp_api.h
+./ucd-snmp/file.lo: ../../include/net-snmp/library/asn1.h
+./ucd-snmp/file.lo: ../../include/net-snmp/library/snmp_impl.h
+./ucd-snmp/file.lo: ../../include/net-snmp/library/snmp.h
+./ucd-snmp/file.lo: ../../include/net-snmp/library/snmp-tc.h
+./ucd-snmp/file.lo: ../../include/net-snmp/utilities.h
+./ucd-snmp/file.lo: ../../include/net-snmp/library/snmp_client.h
+./ucd-snmp/file.lo: ../../include/net-snmp/library/getopt.h
+./ucd-snmp/file.lo: ../../include/net-snmp/library/system.h
+./ucd-snmp/file.lo: ../../include/net-snmp/library/tools.h
+./ucd-snmp/file.lo: ../../include/net-snmp/library/int64.h
+./ucd-snmp/file.lo: ../../include/net-snmp/library/mt_support.h
+./ucd-snmp/file.lo: ../../include/net-snmp/library/snmp_alarm.h
+./ucd-snmp/file.lo: ../../include/net-snmp/library/data_list.h
+./ucd-snmp/file.lo: ../../include/net-snmp/library/callback.h
+./ucd-snmp/file.lo: ../../include/net-snmp/library/oid_stash.h
+./ucd-snmp/file.lo: ../../include/net-snmp/library/check_varbind.h
+./ucd-snmp/file.lo: ../../include/net-snmp/version.h
+./ucd-snmp/file.lo: ../../include/net-snmp/session_api.h
+./ucd-snmp/file.lo: ../../include/net-snmp/library/snmp_transport.h
+./ucd-snmp/file.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./ucd-snmp/file.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./ucd-snmp/file.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./ucd-snmp/file.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./ucd-snmp/file.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./ucd-snmp/file.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./ucd-snmp/file.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./ucd-snmp/file.lo: ../../include/net-snmp/library/ucd_compat.h
+./ucd-snmp/file.lo: ../../include/net-snmp/pdu_api.h
+./ucd-snmp/file.lo: ../../include/net-snmp/mib_api.h
+./ucd-snmp/file.lo: ../../include/net-snmp/library/mib.h
+./ucd-snmp/file.lo: ../../include/net-snmp/library/parse.h
+./ucd-snmp/file.lo: ../../include/net-snmp/varbind_api.h
+./ucd-snmp/file.lo: ../../include/net-snmp/config_api.h
+./ucd-snmp/file.lo: ../../include/net-snmp/library/read_config.h
+./ucd-snmp/file.lo: ../../include/net-snmp/library/default_store.h
+./ucd-snmp/file.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./ucd-snmp/file.lo: ../../include/net-snmp/library/snmp_enum.h
+./ucd-snmp/file.lo: ../../include/net-snmp/library/vacm.h
+./ucd-snmp/file.lo: ../../include/net-snmp/output_api.h
+./ucd-snmp/file.lo: ../../include/net-snmp/library/snmp_debug.h
+./ucd-snmp/file.lo: ../../include/net-snmp/library/snmp_logging.h
+./ucd-snmp/file.lo: ../../include/net-snmp/snmpv3_api.h
+./ucd-snmp/file.lo: ../../include/net-snmp/library/snmpv3.h
+./ucd-snmp/file.lo: ../../include/net-snmp/library/transform_oids.h
+./ucd-snmp/file.lo: ../../include/net-snmp/library/keytools.h
+./ucd-snmp/file.lo: ../../include/net-snmp/library/scapi.h
+./ucd-snmp/file.lo: ../../include/net-snmp/library/lcd_time.h
+./ucd-snmp/file.lo: ../../include/net-snmp/library/snmp_secmod.h
+./ucd-snmp/file.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./ucd-snmp/file.lo: ../../include/net-snmp/library/snmpusm.h
+./ucd-snmp/file.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./ucd-snmp/file.lo: ../../include/net-snmp/agent/snmp_agent.h
+./ucd-snmp/file.lo: ../../include/net-snmp/agent/snmp_vars.h
+./ucd-snmp/file.lo: ../../include/net-snmp/agent/agent_handler.h
+./ucd-snmp/file.lo: ../../include/net-snmp/agent/var_struct.h
+./ucd-snmp/file.lo: ../../include/net-snmp/agent/agent_registry.h
+./ucd-snmp/file.lo: ../../include/net-snmp/agent/ds_agent.h
+./ucd-snmp/file.lo: ../../include/net-snmp/agent/agent_read_config.h
+./ucd-snmp/file.lo: ../../include/net-snmp/agent/agent_trap.h
+./ucd-snmp/file.lo: ../../include/net-snmp/agent/all_helpers.h
+./ucd-snmp/file.lo: ../../include/net-snmp/agent/instance.h
+./ucd-snmp/file.lo: ../../include/net-snmp/agent/multiplexer.h
+./ucd-snmp/file.lo: ../../include/net-snmp/agent/null.h
+./ucd-snmp/file.lo: ../../include/net-snmp/agent/debug_handler.h
+./ucd-snmp/file.lo: ../../include/net-snmp/agent/old_api.h
+./ucd-snmp/file.lo: ../../include/net-snmp/agent/read_only.h
+./ucd-snmp/file.lo: ../../include/net-snmp/agent/serialize.h
+./ucd-snmp/file.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./ucd-snmp/file.lo: ../../include/net-snmp/agent/mode_end_call.h
+./ucd-snmp/file.lo: ../../include/net-snmp/agent/table.h
+./ucd-snmp/file.lo: ../../include/net-snmp/agent/table_data.h
+./ucd-snmp/file.lo: ../../include/net-snmp/agent/table_dataset.h
+./ucd-snmp/file.lo: ../../include/net-snmp/agent/table_iterator.h
+./ucd-snmp/file.lo: ../../include/net-snmp/agent/mib_module_config.h struct.h
+./ucd-snmp/file.lo: ./ucd-snmp/file.h mibdefs.h util_funcs.h
+./ucd-snmp/hpux.lo: ../../include/net-snmp/net-snmp-config.h
+./ucd-snmp/hpux.lo: ../../include/net-snmp/system/linux.h
+./ucd-snmp/hpux.lo: ../../include/net-snmp/system/sysv.h
+./ucd-snmp/hpux.lo: ../../include/net-snmp/system/generic.h
+./ucd-snmp/hpux.lo: ../../include/net-snmp/machine/generic.h
+./ucd-snmp/hpux.lo: ../../include/net-snmp/net-snmp-includes.h
+./ucd-snmp/hpux.lo: ../../include/net-snmp/definitions.h
+./ucd-snmp/hpux.lo: ../../include/net-snmp/types.h
+./ucd-snmp/hpux.lo: ../../include/net-snmp/library/snmp_api.h
+./ucd-snmp/hpux.lo: ../../include/net-snmp/library/asn1.h
+./ucd-snmp/hpux.lo: ../../include/net-snmp/library/snmp_impl.h
+./ucd-snmp/hpux.lo: ../../include/net-snmp/library/snmp.h
+./ucd-snmp/hpux.lo: ../../include/net-snmp/library/snmp-tc.h
+./ucd-snmp/hpux.lo: ../../include/net-snmp/utilities.h
+./ucd-snmp/hpux.lo: ../../include/net-snmp/library/snmp_client.h
+./ucd-snmp/hpux.lo: ../../include/net-snmp/library/getopt.h
+./ucd-snmp/hpux.lo: ../../include/net-snmp/library/system.h
+./ucd-snmp/hpux.lo: ../../include/net-snmp/library/tools.h
+./ucd-snmp/hpux.lo: ../../include/net-snmp/library/int64.h
+./ucd-snmp/hpux.lo: ../../include/net-snmp/library/mt_support.h
+./ucd-snmp/hpux.lo: ../../include/net-snmp/library/snmp_alarm.h
+./ucd-snmp/hpux.lo: ../../include/net-snmp/library/data_list.h
+./ucd-snmp/hpux.lo: ../../include/net-snmp/library/callback.h
+./ucd-snmp/hpux.lo: ../../include/net-snmp/library/oid_stash.h
+./ucd-snmp/hpux.lo: ../../include/net-snmp/library/check_varbind.h
+./ucd-snmp/hpux.lo: ../../include/net-snmp/version.h
+./ucd-snmp/hpux.lo: ../../include/net-snmp/session_api.h
+./ucd-snmp/hpux.lo: ../../include/net-snmp/library/snmp_transport.h
+./ucd-snmp/hpux.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./ucd-snmp/hpux.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./ucd-snmp/hpux.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./ucd-snmp/hpux.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./ucd-snmp/hpux.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./ucd-snmp/hpux.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./ucd-snmp/hpux.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./ucd-snmp/hpux.lo: ../../include/net-snmp/library/ucd_compat.h
+./ucd-snmp/hpux.lo: ../../include/net-snmp/pdu_api.h
+./ucd-snmp/hpux.lo: ../../include/net-snmp/mib_api.h
+./ucd-snmp/hpux.lo: ../../include/net-snmp/library/mib.h
+./ucd-snmp/hpux.lo: ../../include/net-snmp/library/parse.h
+./ucd-snmp/hpux.lo: ../../include/net-snmp/varbind_api.h
+./ucd-snmp/hpux.lo: ../../include/net-snmp/config_api.h
+./ucd-snmp/hpux.lo: ../../include/net-snmp/library/read_config.h
+./ucd-snmp/hpux.lo: ../../include/net-snmp/library/default_store.h
+./ucd-snmp/hpux.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./ucd-snmp/hpux.lo: ../../include/net-snmp/library/snmp_enum.h
+./ucd-snmp/hpux.lo: ../../include/net-snmp/library/vacm.h
+./ucd-snmp/hpux.lo: ../../include/net-snmp/output_api.h
+./ucd-snmp/hpux.lo: ../../include/net-snmp/library/snmp_debug.h
+./ucd-snmp/hpux.lo: ../../include/net-snmp/library/snmp_logging.h
+./ucd-snmp/hpux.lo: ../../include/net-snmp/snmpv3_api.h
+./ucd-snmp/hpux.lo: ../../include/net-snmp/library/snmpv3.h
+./ucd-snmp/hpux.lo: ../../include/net-snmp/library/transform_oids.h
+./ucd-snmp/hpux.lo: ../../include/net-snmp/library/keytools.h
+./ucd-snmp/hpux.lo: ../../include/net-snmp/library/scapi.h
+./ucd-snmp/hpux.lo: ../../include/net-snmp/library/lcd_time.h
+./ucd-snmp/hpux.lo: ../../include/net-snmp/library/snmp_secmod.h
+./ucd-snmp/hpux.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./ucd-snmp/hpux.lo: ../../include/net-snmp/library/snmpusm.h
+./ucd-snmp/hpux.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./ucd-snmp/hpux.lo: ../../include/net-snmp/agent/snmp_agent.h
+./ucd-snmp/hpux.lo: ../../include/net-snmp/agent/snmp_vars.h
+./ucd-snmp/hpux.lo: ../../include/net-snmp/agent/agent_handler.h
+./ucd-snmp/hpux.lo: ../../include/net-snmp/agent/var_struct.h
+./ucd-snmp/hpux.lo: ../../include/net-snmp/agent/agent_registry.h
+./ucd-snmp/hpux.lo: ../../include/net-snmp/agent/ds_agent.h
+./ucd-snmp/hpux.lo: ../../include/net-snmp/agent/agent_read_config.h
+./ucd-snmp/hpux.lo: ../../include/net-snmp/agent/agent_trap.h
+./ucd-snmp/hpux.lo: ../../include/net-snmp/agent/all_helpers.h
+./ucd-snmp/hpux.lo: ../../include/net-snmp/agent/instance.h
+./ucd-snmp/hpux.lo: ../../include/net-snmp/agent/multiplexer.h
+./ucd-snmp/hpux.lo: ../../include/net-snmp/agent/null.h
+./ucd-snmp/hpux.lo: ../../include/net-snmp/agent/debug_handler.h
+./ucd-snmp/hpux.lo: ../../include/net-snmp/agent/old_api.h
+./ucd-snmp/hpux.lo: ../../include/net-snmp/agent/read_only.h
+./ucd-snmp/hpux.lo: ../../include/net-snmp/agent/serialize.h
+./ucd-snmp/hpux.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./ucd-snmp/hpux.lo: ../../include/net-snmp/agent/mode_end_call.h
+./ucd-snmp/hpux.lo: ../../include/net-snmp/agent/table.h
+./ucd-snmp/hpux.lo: ../../include/net-snmp/agent/table_data.h
+./ucd-snmp/hpux.lo: ../../include/net-snmp/agent/table_dataset.h
+./ucd-snmp/hpux.lo: ../../include/net-snmp/agent/table_iterator.h
+./ucd-snmp/hpux.lo: ../../include/net-snmp/agent/mib_module_config.h
+./ucd-snmp/hpux.lo: ./ucd-snmp/hpux.h mibdefs.h
+./ucd-snmp/lmSensors.lo: ../../include/net-snmp/net-snmp-config.h
+./ucd-snmp/lmSensors.lo: ../../include/net-snmp/system/linux.h
+./ucd-snmp/lmSensors.lo: ../../include/net-snmp/system/sysv.h
+./ucd-snmp/lmSensors.lo: ../../include/net-snmp/system/generic.h
+./ucd-snmp/lmSensors.lo: ../../include/net-snmp/machine/generic.h
+./ucd-snmp/lmSensors.lo: ../../include/net-snmp/net-snmp-includes.h
+./ucd-snmp/lmSensors.lo: ../../include/net-snmp/definitions.h
+./ucd-snmp/lmSensors.lo: ../../include/net-snmp/types.h
+./ucd-snmp/lmSensors.lo: ../../include/net-snmp/library/snmp_api.h
+./ucd-snmp/lmSensors.lo: ../../include/net-snmp/library/asn1.h
+./ucd-snmp/lmSensors.lo: ../../include/net-snmp/library/snmp_impl.h
+./ucd-snmp/lmSensors.lo: ../../include/net-snmp/library/snmp.h
+./ucd-snmp/lmSensors.lo: ../../include/net-snmp/library/snmp-tc.h
+./ucd-snmp/lmSensors.lo: ../../include/net-snmp/utilities.h
+./ucd-snmp/lmSensors.lo: ../../include/net-snmp/library/snmp_client.h
+./ucd-snmp/lmSensors.lo: ../../include/net-snmp/library/getopt.h
+./ucd-snmp/lmSensors.lo: ../../include/net-snmp/library/system.h
+./ucd-snmp/lmSensors.lo: ../../include/net-snmp/library/tools.h
+./ucd-snmp/lmSensors.lo: ../../include/net-snmp/library/int64.h
+./ucd-snmp/lmSensors.lo: ../../include/net-snmp/library/mt_support.h
+./ucd-snmp/lmSensors.lo: ../../include/net-snmp/library/snmp_alarm.h
+./ucd-snmp/lmSensors.lo: ../../include/net-snmp/library/data_list.h
+./ucd-snmp/lmSensors.lo: ../../include/net-snmp/library/callback.h
+./ucd-snmp/lmSensors.lo: ../../include/net-snmp/library/oid_stash.h
+./ucd-snmp/lmSensors.lo: ../../include/net-snmp/library/check_varbind.h
+./ucd-snmp/lmSensors.lo: ../../include/net-snmp/version.h
+./ucd-snmp/lmSensors.lo: ../../include/net-snmp/session_api.h
+./ucd-snmp/lmSensors.lo: ../../include/net-snmp/library/snmp_transport.h
+./ucd-snmp/lmSensors.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./ucd-snmp/lmSensors.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./ucd-snmp/lmSensors.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./ucd-snmp/lmSensors.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./ucd-snmp/lmSensors.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./ucd-snmp/lmSensors.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./ucd-snmp/lmSensors.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./ucd-snmp/lmSensors.lo: ../../include/net-snmp/library/ucd_compat.h
+./ucd-snmp/lmSensors.lo: ../../include/net-snmp/pdu_api.h
+./ucd-snmp/lmSensors.lo: ../../include/net-snmp/mib_api.h
+./ucd-snmp/lmSensors.lo: ../../include/net-snmp/library/mib.h
+./ucd-snmp/lmSensors.lo: ../../include/net-snmp/library/parse.h
+./ucd-snmp/lmSensors.lo: ../../include/net-snmp/varbind_api.h
+./ucd-snmp/lmSensors.lo: ../../include/net-snmp/config_api.h
+./ucd-snmp/lmSensors.lo: ../../include/net-snmp/library/read_config.h
+./ucd-snmp/lmSensors.lo: ../../include/net-snmp/library/default_store.h
+./ucd-snmp/lmSensors.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./ucd-snmp/lmSensors.lo: ../../include/net-snmp/library/snmp_enum.h
+./ucd-snmp/lmSensors.lo: ../../include/net-snmp/library/vacm.h
+./ucd-snmp/lmSensors.lo: ../../include/net-snmp/output_api.h
+./ucd-snmp/lmSensors.lo: ../../include/net-snmp/library/snmp_debug.h
+./ucd-snmp/lmSensors.lo: ../../include/net-snmp/library/snmp_logging.h
+./ucd-snmp/lmSensors.lo: ../../include/net-snmp/snmpv3_api.h
+./ucd-snmp/lmSensors.lo: ../../include/net-snmp/library/snmpv3.h
+./ucd-snmp/lmSensors.lo: ../../include/net-snmp/library/transform_oids.h
+./ucd-snmp/lmSensors.lo: ../../include/net-snmp/library/keytools.h
+./ucd-snmp/lmSensors.lo: ../../include/net-snmp/library/scapi.h
+./ucd-snmp/lmSensors.lo: ../../include/net-snmp/library/lcd_time.h
+./ucd-snmp/lmSensors.lo: ../../include/net-snmp/library/snmp_secmod.h
+./ucd-snmp/lmSensors.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./ucd-snmp/lmSensors.lo: ../../include/net-snmp/library/snmpusm.h
+./ucd-snmp/lmSensors.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./ucd-snmp/lmSensors.lo: ../../include/net-snmp/agent/snmp_agent.h
+./ucd-snmp/lmSensors.lo: ../../include/net-snmp/agent/snmp_vars.h
+./ucd-snmp/lmSensors.lo: ../../include/net-snmp/agent/agent_handler.h
+./ucd-snmp/lmSensors.lo: ../../include/net-snmp/agent/var_struct.h
+./ucd-snmp/lmSensors.lo: ../../include/net-snmp/agent/agent_registry.h
+./ucd-snmp/lmSensors.lo: ../../include/net-snmp/agent/ds_agent.h
+./ucd-snmp/lmSensors.lo: ../../include/net-snmp/agent/agent_read_config.h
+./ucd-snmp/lmSensors.lo: ../../include/net-snmp/agent/agent_trap.h
+./ucd-snmp/lmSensors.lo: ../../include/net-snmp/agent/all_helpers.h
+./ucd-snmp/lmSensors.lo: ../../include/net-snmp/agent/instance.h
+./ucd-snmp/lmSensors.lo: ../../include/net-snmp/agent/multiplexer.h
+./ucd-snmp/lmSensors.lo: ../../include/net-snmp/agent/null.h
+./ucd-snmp/lmSensors.lo: ../../include/net-snmp/agent/debug_handler.h
+./ucd-snmp/lmSensors.lo: ../../include/net-snmp/agent/old_api.h
+./ucd-snmp/lmSensors.lo: ../../include/net-snmp/agent/read_only.h
+./ucd-snmp/lmSensors.lo: ../../include/net-snmp/agent/serialize.h
+./ucd-snmp/lmSensors.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./ucd-snmp/lmSensors.lo: ../../include/net-snmp/agent/mode_end_call.h
+./ucd-snmp/lmSensors.lo: ../../include/net-snmp/agent/table.h
+./ucd-snmp/lmSensors.lo: ../../include/net-snmp/agent/table_data.h
+./ucd-snmp/lmSensors.lo: ../../include/net-snmp/agent/table_dataset.h
+./ucd-snmp/lmSensors.lo: ../../include/net-snmp/agent/table_iterator.h
+./ucd-snmp/lmSensors.lo: ../../include/net-snmp/agent/mib_module_config.h
+./ucd-snmp/lmSensors.lo: util_funcs.h struct.h ./ucd-snmp/lmSensors.h
+./ucd-snmp/loadave.lo: ../../include/net-snmp/net-snmp-config.h
+./ucd-snmp/loadave.lo: ../../include/net-snmp/system/linux.h
+./ucd-snmp/loadave.lo: ../../include/net-snmp/system/sysv.h
+./ucd-snmp/loadave.lo: ../../include/net-snmp/system/generic.h
+./ucd-snmp/loadave.lo: ../../include/net-snmp/machine/generic.h
+./ucd-snmp/loadave.lo: ../../include/net-snmp/net-snmp-includes.h
+./ucd-snmp/loadave.lo: ../../include/net-snmp/definitions.h
+./ucd-snmp/loadave.lo: ../../include/net-snmp/types.h
+./ucd-snmp/loadave.lo: ../../include/net-snmp/library/snmp_api.h
+./ucd-snmp/loadave.lo: ../../include/net-snmp/library/asn1.h
+./ucd-snmp/loadave.lo: ../../include/net-snmp/library/snmp_impl.h
+./ucd-snmp/loadave.lo: ../../include/net-snmp/library/snmp.h
+./ucd-snmp/loadave.lo: ../../include/net-snmp/library/snmp-tc.h
+./ucd-snmp/loadave.lo: ../../include/net-snmp/utilities.h
+./ucd-snmp/loadave.lo: ../../include/net-snmp/library/snmp_client.h
+./ucd-snmp/loadave.lo: ../../include/net-snmp/library/getopt.h
+./ucd-snmp/loadave.lo: ../../include/net-snmp/library/system.h
+./ucd-snmp/loadave.lo: ../../include/net-snmp/library/tools.h
+./ucd-snmp/loadave.lo: ../../include/net-snmp/library/int64.h
+./ucd-snmp/loadave.lo: ../../include/net-snmp/library/mt_support.h
+./ucd-snmp/loadave.lo: ../../include/net-snmp/library/snmp_alarm.h
+./ucd-snmp/loadave.lo: ../../include/net-snmp/library/data_list.h
+./ucd-snmp/loadave.lo: ../../include/net-snmp/library/callback.h
+./ucd-snmp/loadave.lo: ../../include/net-snmp/library/oid_stash.h
+./ucd-snmp/loadave.lo: ../../include/net-snmp/library/check_varbind.h
+./ucd-snmp/loadave.lo: ../../include/net-snmp/version.h
+./ucd-snmp/loadave.lo: ../../include/net-snmp/session_api.h
+./ucd-snmp/loadave.lo: ../../include/net-snmp/library/snmp_transport.h
+./ucd-snmp/loadave.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./ucd-snmp/loadave.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./ucd-snmp/loadave.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./ucd-snmp/loadave.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./ucd-snmp/loadave.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./ucd-snmp/loadave.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./ucd-snmp/loadave.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./ucd-snmp/loadave.lo: ../../include/net-snmp/library/ucd_compat.h
+./ucd-snmp/loadave.lo: ../../include/net-snmp/pdu_api.h
+./ucd-snmp/loadave.lo: ../../include/net-snmp/mib_api.h
+./ucd-snmp/loadave.lo: ../../include/net-snmp/library/mib.h
+./ucd-snmp/loadave.lo: ../../include/net-snmp/library/parse.h
+./ucd-snmp/loadave.lo: ../../include/net-snmp/varbind_api.h
+./ucd-snmp/loadave.lo: ../../include/net-snmp/config_api.h
+./ucd-snmp/loadave.lo: ../../include/net-snmp/library/read_config.h
+./ucd-snmp/loadave.lo: ../../include/net-snmp/library/default_store.h
+./ucd-snmp/loadave.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./ucd-snmp/loadave.lo: ../../include/net-snmp/library/snmp_enum.h
+./ucd-snmp/loadave.lo: ../../include/net-snmp/library/vacm.h
+./ucd-snmp/loadave.lo: ../../include/net-snmp/output_api.h
+./ucd-snmp/loadave.lo: ../../include/net-snmp/library/snmp_debug.h
+./ucd-snmp/loadave.lo: ../../include/net-snmp/library/snmp_logging.h
+./ucd-snmp/loadave.lo: ../../include/net-snmp/snmpv3_api.h
+./ucd-snmp/loadave.lo: ../../include/net-snmp/library/snmpv3.h
+./ucd-snmp/loadave.lo: ../../include/net-snmp/library/transform_oids.h
+./ucd-snmp/loadave.lo: ../../include/net-snmp/library/keytools.h
+./ucd-snmp/loadave.lo: ../../include/net-snmp/library/scapi.h
+./ucd-snmp/loadave.lo: ../../include/net-snmp/library/lcd_time.h
+./ucd-snmp/loadave.lo: ../../include/net-snmp/library/snmp_secmod.h
+./ucd-snmp/loadave.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./ucd-snmp/loadave.lo: ../../include/net-snmp/library/snmpusm.h
+./ucd-snmp/loadave.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./ucd-snmp/loadave.lo: ../../include/net-snmp/agent/snmp_agent.h
+./ucd-snmp/loadave.lo: ../../include/net-snmp/agent/snmp_vars.h
+./ucd-snmp/loadave.lo: ../../include/net-snmp/agent/agent_handler.h
+./ucd-snmp/loadave.lo: ../../include/net-snmp/agent/var_struct.h
+./ucd-snmp/loadave.lo: ../../include/net-snmp/agent/agent_registry.h
+./ucd-snmp/loadave.lo: ../../include/net-snmp/agent/ds_agent.h
+./ucd-snmp/loadave.lo: ../../include/net-snmp/agent/agent_read_config.h
+./ucd-snmp/loadave.lo: ../../include/net-snmp/agent/agent_trap.h
+./ucd-snmp/loadave.lo: ../../include/net-snmp/agent/all_helpers.h
+./ucd-snmp/loadave.lo: ../../include/net-snmp/agent/instance.h
+./ucd-snmp/loadave.lo: ../../include/net-snmp/agent/multiplexer.h
+./ucd-snmp/loadave.lo: ../../include/net-snmp/agent/null.h
+./ucd-snmp/loadave.lo: ../../include/net-snmp/agent/debug_handler.h
+./ucd-snmp/loadave.lo: ../../include/net-snmp/agent/old_api.h
+./ucd-snmp/loadave.lo: ../../include/net-snmp/agent/read_only.h
+./ucd-snmp/loadave.lo: ../../include/net-snmp/agent/serialize.h
+./ucd-snmp/loadave.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./ucd-snmp/loadave.lo: ../../include/net-snmp/agent/mode_end_call.h
+./ucd-snmp/loadave.lo: ../../include/net-snmp/agent/table.h
+./ucd-snmp/loadave.lo: ../../include/net-snmp/agent/table_data.h
+./ucd-snmp/loadave.lo: ../../include/net-snmp/agent/table_dataset.h
+./ucd-snmp/loadave.lo: ../../include/net-snmp/agent/table_iterator.h
+./ucd-snmp/loadave.lo: ../../include/net-snmp/agent/mib_module_config.h
+./ucd-snmp/loadave.lo: ../../include/net-snmp/agent/auto_nlist.h struct.h
+./ucd-snmp/loadave.lo: ./ucd-snmp/loadave.h mibdefs.h util_funcs.h
+./ucd-snmp/loadave.lo: ./../kernel.h
+./ucd-snmp/logmatch.lo: ../../include/net-snmp/net-snmp-config.h
+./ucd-snmp/logmatch.lo: ../../include/net-snmp/system/linux.h
+./ucd-snmp/logmatch.lo: ../../include/net-snmp/system/sysv.h
+./ucd-snmp/logmatch.lo: ../../include/net-snmp/system/generic.h
+./ucd-snmp/logmatch.lo: ../../include/net-snmp/machine/generic.h
+./ucd-snmp/logmatch.lo: ../../include/net-snmp/net-snmp-includes.h
+./ucd-snmp/logmatch.lo: ../../include/net-snmp/definitions.h
+./ucd-snmp/logmatch.lo: ../../include/net-snmp/types.h
+./ucd-snmp/logmatch.lo: ../../include/net-snmp/library/snmp_api.h
+./ucd-snmp/logmatch.lo: ../../include/net-snmp/library/asn1.h
+./ucd-snmp/logmatch.lo: ../../include/net-snmp/library/snmp_impl.h
+./ucd-snmp/logmatch.lo: ../../include/net-snmp/library/snmp.h
+./ucd-snmp/logmatch.lo: ../../include/net-snmp/library/snmp-tc.h
+./ucd-snmp/logmatch.lo: ../../include/net-snmp/utilities.h
+./ucd-snmp/logmatch.lo: ../../include/net-snmp/library/snmp_client.h
+./ucd-snmp/logmatch.lo: ../../include/net-snmp/library/getopt.h
+./ucd-snmp/logmatch.lo: ../../include/net-snmp/library/system.h
+./ucd-snmp/logmatch.lo: ../../include/net-snmp/library/tools.h
+./ucd-snmp/logmatch.lo: ../../include/net-snmp/library/int64.h
+./ucd-snmp/logmatch.lo: ../../include/net-snmp/library/mt_support.h
+./ucd-snmp/logmatch.lo: ../../include/net-snmp/library/snmp_alarm.h
+./ucd-snmp/logmatch.lo: ../../include/net-snmp/library/data_list.h
+./ucd-snmp/logmatch.lo: ../../include/net-snmp/library/callback.h
+./ucd-snmp/logmatch.lo: ../../include/net-snmp/library/oid_stash.h
+./ucd-snmp/logmatch.lo: ../../include/net-snmp/library/check_varbind.h
+./ucd-snmp/logmatch.lo: ../../include/net-snmp/version.h
+./ucd-snmp/logmatch.lo: ../../include/net-snmp/session_api.h
+./ucd-snmp/logmatch.lo: ../../include/net-snmp/library/snmp_transport.h
+./ucd-snmp/logmatch.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./ucd-snmp/logmatch.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./ucd-snmp/logmatch.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./ucd-snmp/logmatch.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./ucd-snmp/logmatch.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./ucd-snmp/logmatch.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./ucd-snmp/logmatch.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./ucd-snmp/logmatch.lo: ../../include/net-snmp/library/ucd_compat.h
+./ucd-snmp/logmatch.lo: ../../include/net-snmp/pdu_api.h
+./ucd-snmp/logmatch.lo: ../../include/net-snmp/mib_api.h
+./ucd-snmp/logmatch.lo: ../../include/net-snmp/library/mib.h
+./ucd-snmp/logmatch.lo: ../../include/net-snmp/library/parse.h
+./ucd-snmp/logmatch.lo: ../../include/net-snmp/varbind_api.h
+./ucd-snmp/logmatch.lo: ../../include/net-snmp/config_api.h
+./ucd-snmp/logmatch.lo: ../../include/net-snmp/library/read_config.h
+./ucd-snmp/logmatch.lo: ../../include/net-snmp/library/default_store.h
+./ucd-snmp/logmatch.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./ucd-snmp/logmatch.lo: ../../include/net-snmp/library/snmp_enum.h
+./ucd-snmp/logmatch.lo: ../../include/net-snmp/library/vacm.h
+./ucd-snmp/logmatch.lo: ../../include/net-snmp/output_api.h
+./ucd-snmp/logmatch.lo: ../../include/net-snmp/library/snmp_debug.h
+./ucd-snmp/logmatch.lo: ../../include/net-snmp/library/snmp_logging.h
+./ucd-snmp/logmatch.lo: ../../include/net-snmp/snmpv3_api.h
+./ucd-snmp/logmatch.lo: ../../include/net-snmp/library/snmpv3.h
+./ucd-snmp/logmatch.lo: ../../include/net-snmp/library/transform_oids.h
+./ucd-snmp/logmatch.lo: ../../include/net-snmp/library/keytools.h
+./ucd-snmp/logmatch.lo: ../../include/net-snmp/library/scapi.h
+./ucd-snmp/logmatch.lo: ../../include/net-snmp/library/lcd_time.h
+./ucd-snmp/logmatch.lo: ../../include/net-snmp/library/snmp_secmod.h
+./ucd-snmp/logmatch.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./ucd-snmp/logmatch.lo: ../../include/net-snmp/library/snmpusm.h
+./ucd-snmp/logmatch.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./ucd-snmp/logmatch.lo: ../../include/net-snmp/agent/snmp_agent.h
+./ucd-snmp/logmatch.lo: ../../include/net-snmp/agent/snmp_vars.h
+./ucd-snmp/logmatch.lo: ../../include/net-snmp/agent/agent_handler.h
+./ucd-snmp/logmatch.lo: ../../include/net-snmp/agent/var_struct.h
+./ucd-snmp/logmatch.lo: ../../include/net-snmp/agent/agent_registry.h
+./ucd-snmp/logmatch.lo: ../../include/net-snmp/agent/ds_agent.h
+./ucd-snmp/logmatch.lo: ../../include/net-snmp/agent/agent_read_config.h
+./ucd-snmp/logmatch.lo: ../../include/net-snmp/agent/agent_trap.h
+./ucd-snmp/logmatch.lo: ../../include/net-snmp/agent/all_helpers.h
+./ucd-snmp/logmatch.lo: ../../include/net-snmp/agent/instance.h
+./ucd-snmp/logmatch.lo: ../../include/net-snmp/agent/multiplexer.h
+./ucd-snmp/logmatch.lo: ../../include/net-snmp/agent/null.h
+./ucd-snmp/logmatch.lo: ../../include/net-snmp/agent/debug_handler.h
+./ucd-snmp/logmatch.lo: ../../include/net-snmp/agent/old_api.h
+./ucd-snmp/logmatch.lo: ../../include/net-snmp/agent/read_only.h
+./ucd-snmp/logmatch.lo: ../../include/net-snmp/agent/serialize.h
+./ucd-snmp/logmatch.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./ucd-snmp/logmatch.lo: ../../include/net-snmp/agent/mode_end_call.h
+./ucd-snmp/logmatch.lo: ../../include/net-snmp/agent/table.h
+./ucd-snmp/logmatch.lo: ../../include/net-snmp/agent/table_data.h
+./ucd-snmp/logmatch.lo: ../../include/net-snmp/agent/table_dataset.h
+./ucd-snmp/logmatch.lo: ../../include/net-snmp/agent/table_iterator.h
+./ucd-snmp/logmatch.lo: ../../include/net-snmp/agent/mib_module_config.h
+./ucd-snmp/logmatch.lo: struct.h util_funcs.h ./ucd-snmp/logmatch.h mibdefs.h
+./ucd-snmp/memory.lo: ../../include/net-snmp/net-snmp-config.h
+./ucd-snmp/memory.lo: ../../include/net-snmp/system/linux.h
+./ucd-snmp/memory.lo: ../../include/net-snmp/system/sysv.h
+./ucd-snmp/memory.lo: ../../include/net-snmp/system/generic.h
+./ucd-snmp/memory.lo: ../../include/net-snmp/machine/generic.h
+./ucd-snmp/memory.lo: ../../include/net-snmp/net-snmp-includes.h
+./ucd-snmp/memory.lo: ../../include/net-snmp/definitions.h
+./ucd-snmp/memory.lo: ../../include/net-snmp/types.h
+./ucd-snmp/memory.lo: ../../include/net-snmp/library/snmp_api.h
+./ucd-snmp/memory.lo: ../../include/net-snmp/library/asn1.h
+./ucd-snmp/memory.lo: ../../include/net-snmp/library/snmp_impl.h
+./ucd-snmp/memory.lo: ../../include/net-snmp/library/snmp.h
+./ucd-snmp/memory.lo: ../../include/net-snmp/library/snmp-tc.h
+./ucd-snmp/memory.lo: ../../include/net-snmp/utilities.h
+./ucd-snmp/memory.lo: ../../include/net-snmp/library/snmp_client.h
+./ucd-snmp/memory.lo: ../../include/net-snmp/library/getopt.h
+./ucd-snmp/memory.lo: ../../include/net-snmp/library/system.h
+./ucd-snmp/memory.lo: ../../include/net-snmp/library/tools.h
+./ucd-snmp/memory.lo: ../../include/net-snmp/library/int64.h
+./ucd-snmp/memory.lo: ../../include/net-snmp/library/mt_support.h
+./ucd-snmp/memory.lo: ../../include/net-snmp/library/snmp_alarm.h
+./ucd-snmp/memory.lo: ../../include/net-snmp/library/data_list.h
+./ucd-snmp/memory.lo: ../../include/net-snmp/library/callback.h
+./ucd-snmp/memory.lo: ../../include/net-snmp/library/oid_stash.h
+./ucd-snmp/memory.lo: ../../include/net-snmp/library/check_varbind.h
+./ucd-snmp/memory.lo: ../../include/net-snmp/version.h
+./ucd-snmp/memory.lo: ../../include/net-snmp/session_api.h
+./ucd-snmp/memory.lo: ../../include/net-snmp/library/snmp_transport.h
+./ucd-snmp/memory.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./ucd-snmp/memory.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./ucd-snmp/memory.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./ucd-snmp/memory.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./ucd-snmp/memory.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./ucd-snmp/memory.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./ucd-snmp/memory.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./ucd-snmp/memory.lo: ../../include/net-snmp/library/ucd_compat.h
+./ucd-snmp/memory.lo: ../../include/net-snmp/pdu_api.h
+./ucd-snmp/memory.lo: ../../include/net-snmp/mib_api.h
+./ucd-snmp/memory.lo: ../../include/net-snmp/library/mib.h
+./ucd-snmp/memory.lo: ../../include/net-snmp/library/parse.h
+./ucd-snmp/memory.lo: ../../include/net-snmp/varbind_api.h
+./ucd-snmp/memory.lo: ../../include/net-snmp/config_api.h
+./ucd-snmp/memory.lo: ../../include/net-snmp/library/read_config.h
+./ucd-snmp/memory.lo: ../../include/net-snmp/library/default_store.h
+./ucd-snmp/memory.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./ucd-snmp/memory.lo: ../../include/net-snmp/library/snmp_enum.h
+./ucd-snmp/memory.lo: ../../include/net-snmp/library/vacm.h
+./ucd-snmp/memory.lo: ../../include/net-snmp/output_api.h
+./ucd-snmp/memory.lo: ../../include/net-snmp/library/snmp_debug.h
+./ucd-snmp/memory.lo: ../../include/net-snmp/library/snmp_logging.h
+./ucd-snmp/memory.lo: ../../include/net-snmp/snmpv3_api.h
+./ucd-snmp/memory.lo: ../../include/net-snmp/library/snmpv3.h
+./ucd-snmp/memory.lo: ../../include/net-snmp/library/transform_oids.h
+./ucd-snmp/memory.lo: ../../include/net-snmp/library/keytools.h
+./ucd-snmp/memory.lo: ../../include/net-snmp/library/scapi.h
+./ucd-snmp/memory.lo: ../../include/net-snmp/library/lcd_time.h
+./ucd-snmp/memory.lo: ../../include/net-snmp/library/snmp_secmod.h
+./ucd-snmp/memory.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./ucd-snmp/memory.lo: ../../include/net-snmp/library/snmpusm.h
+./ucd-snmp/memory.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./ucd-snmp/memory.lo: ../../include/net-snmp/agent/snmp_agent.h
+./ucd-snmp/memory.lo: ../../include/net-snmp/agent/snmp_vars.h
+./ucd-snmp/memory.lo: ../../include/net-snmp/agent/agent_handler.h
+./ucd-snmp/memory.lo: ../../include/net-snmp/agent/var_struct.h
+./ucd-snmp/memory.lo: ../../include/net-snmp/agent/agent_registry.h
+./ucd-snmp/memory.lo: ../../include/net-snmp/agent/ds_agent.h
+./ucd-snmp/memory.lo: ../../include/net-snmp/agent/agent_read_config.h
+./ucd-snmp/memory.lo: ../../include/net-snmp/agent/agent_trap.h
+./ucd-snmp/memory.lo: ../../include/net-snmp/agent/all_helpers.h
+./ucd-snmp/memory.lo: ../../include/net-snmp/agent/instance.h
+./ucd-snmp/memory.lo: ../../include/net-snmp/agent/multiplexer.h
+./ucd-snmp/memory.lo: ../../include/net-snmp/agent/null.h
+./ucd-snmp/memory.lo: ../../include/net-snmp/agent/debug_handler.h
+./ucd-snmp/memory.lo: ../../include/net-snmp/agent/old_api.h
+./ucd-snmp/memory.lo: ../../include/net-snmp/agent/read_only.h
+./ucd-snmp/memory.lo: ../../include/net-snmp/agent/serialize.h
+./ucd-snmp/memory.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./ucd-snmp/memory.lo: ../../include/net-snmp/agent/mode_end_call.h
+./ucd-snmp/memory.lo: ../../include/net-snmp/agent/table.h
+./ucd-snmp/memory.lo: ../../include/net-snmp/agent/table_data.h
+./ucd-snmp/memory.lo: ../../include/net-snmp/agent/table_dataset.h
+./ucd-snmp/memory.lo: ../../include/net-snmp/agent/table_iterator.h
+./ucd-snmp/memory.lo: ../../include/net-snmp/agent/mib_module_config.h
+./ucd-snmp/memory.lo: ../../include/net-snmp/agent/auto_nlist.h mibdefs.h
+./ucd-snmp/memory.lo: struct.h util_funcs.h ./ucd-snmp/memory.h
+./ucd-snmp/memory_dynix.lo: ../../include/net-snmp/net-snmp-config.h
+./ucd-snmp/memory_dynix.lo: ../../include/net-snmp/system/linux.h
+./ucd-snmp/memory_dynix.lo: ../../include/net-snmp/system/sysv.h
+./ucd-snmp/memory_dynix.lo: ../../include/net-snmp/system/generic.h
+./ucd-snmp/memory_dynix.lo: ../../include/net-snmp/machine/generic.h
+./ucd-snmp/memory_dynix.lo: ../../include/net-snmp/net-snmp-includes.h
+./ucd-snmp/memory_dynix.lo: ../../include/net-snmp/definitions.h
+./ucd-snmp/memory_dynix.lo: ../../include/net-snmp/types.h
+./ucd-snmp/memory_dynix.lo: ../../include/net-snmp/library/snmp_api.h
+./ucd-snmp/memory_dynix.lo: ../../include/net-snmp/library/asn1.h
+./ucd-snmp/memory_dynix.lo: ../../include/net-snmp/library/snmp_impl.h
+./ucd-snmp/memory_dynix.lo: ../../include/net-snmp/library/snmp.h
+./ucd-snmp/memory_dynix.lo: ../../include/net-snmp/library/snmp-tc.h
+./ucd-snmp/memory_dynix.lo: ../../include/net-snmp/utilities.h
+./ucd-snmp/memory_dynix.lo: ../../include/net-snmp/library/snmp_client.h
+./ucd-snmp/memory_dynix.lo: ../../include/net-snmp/library/getopt.h
+./ucd-snmp/memory_dynix.lo: ../../include/net-snmp/library/system.h
+./ucd-snmp/memory_dynix.lo: ../../include/net-snmp/library/tools.h
+./ucd-snmp/memory_dynix.lo: ../../include/net-snmp/library/int64.h
+./ucd-snmp/memory_dynix.lo: ../../include/net-snmp/library/mt_support.h
+./ucd-snmp/memory_dynix.lo: ../../include/net-snmp/library/snmp_alarm.h
+./ucd-snmp/memory_dynix.lo: ../../include/net-snmp/library/data_list.h
+./ucd-snmp/memory_dynix.lo: ../../include/net-snmp/library/callback.h
+./ucd-snmp/memory_dynix.lo: ../../include/net-snmp/library/oid_stash.h
+./ucd-snmp/memory_dynix.lo: ../../include/net-snmp/library/check_varbind.h
+./ucd-snmp/memory_dynix.lo: ../../include/net-snmp/version.h
+./ucd-snmp/memory_dynix.lo: ../../include/net-snmp/session_api.h
+./ucd-snmp/memory_dynix.lo: ../../include/net-snmp/library/snmp_transport.h
+./ucd-snmp/memory_dynix.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./ucd-snmp/memory_dynix.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./ucd-snmp/memory_dynix.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./ucd-snmp/memory_dynix.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./ucd-snmp/memory_dynix.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./ucd-snmp/memory_dynix.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./ucd-snmp/memory_dynix.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./ucd-snmp/memory_dynix.lo: ../../include/net-snmp/library/ucd_compat.h
+./ucd-snmp/memory_dynix.lo: ../../include/net-snmp/pdu_api.h
+./ucd-snmp/memory_dynix.lo: ../../include/net-snmp/mib_api.h
+./ucd-snmp/memory_dynix.lo: ../../include/net-snmp/library/mib.h
+./ucd-snmp/memory_dynix.lo: ../../include/net-snmp/library/parse.h
+./ucd-snmp/memory_dynix.lo: ../../include/net-snmp/varbind_api.h
+./ucd-snmp/memory_dynix.lo: ../../include/net-snmp/config_api.h
+./ucd-snmp/memory_dynix.lo: ../../include/net-snmp/library/read_config.h
+./ucd-snmp/memory_dynix.lo: ../../include/net-snmp/library/default_store.h
+./ucd-snmp/memory_dynix.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./ucd-snmp/memory_dynix.lo: ../../include/net-snmp/library/snmp_enum.h
+./ucd-snmp/memory_dynix.lo: ../../include/net-snmp/library/vacm.h
+./ucd-snmp/memory_dynix.lo: ../../include/net-snmp/output_api.h
+./ucd-snmp/memory_dynix.lo: ../../include/net-snmp/library/snmp_debug.h
+./ucd-snmp/memory_dynix.lo: ../../include/net-snmp/library/snmp_logging.h
+./ucd-snmp/memory_dynix.lo: ../../include/net-snmp/snmpv3_api.h
+./ucd-snmp/memory_dynix.lo: ../../include/net-snmp/library/snmpv3.h
+./ucd-snmp/memory_dynix.lo: ../../include/net-snmp/library/transform_oids.h
+./ucd-snmp/memory_dynix.lo: ../../include/net-snmp/library/keytools.h
+./ucd-snmp/memory_dynix.lo: ../../include/net-snmp/library/scapi.h
+./ucd-snmp/memory_dynix.lo: ../../include/net-snmp/library/lcd_time.h
+./ucd-snmp/memory_dynix.lo: ../../include/net-snmp/library/snmp_secmod.h
+./ucd-snmp/memory_dynix.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./ucd-snmp/memory_dynix.lo: ../../include/net-snmp/library/snmpusm.h
+./ucd-snmp/memory_dynix.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./ucd-snmp/memory_dynix.lo: ../../include/net-snmp/agent/snmp_agent.h
+./ucd-snmp/memory_dynix.lo: ../../include/net-snmp/agent/snmp_vars.h
+./ucd-snmp/memory_dynix.lo: ../../include/net-snmp/agent/agent_handler.h
+./ucd-snmp/memory_dynix.lo: ../../include/net-snmp/agent/var_struct.h
+./ucd-snmp/memory_dynix.lo: ../../include/net-snmp/agent/agent_registry.h
+./ucd-snmp/memory_dynix.lo: ../../include/net-snmp/agent/ds_agent.h
+./ucd-snmp/memory_dynix.lo: ../../include/net-snmp/agent/agent_read_config.h
+./ucd-snmp/memory_dynix.lo: ../../include/net-snmp/agent/agent_trap.h
+./ucd-snmp/memory_dynix.lo: ../../include/net-snmp/agent/all_helpers.h
+./ucd-snmp/memory_dynix.lo: ../../include/net-snmp/agent/instance.h
+./ucd-snmp/memory_dynix.lo: ../../include/net-snmp/agent/multiplexer.h
+./ucd-snmp/memory_dynix.lo: ../../include/net-snmp/agent/null.h
+./ucd-snmp/memory_dynix.lo: ../../include/net-snmp/agent/debug_handler.h
+./ucd-snmp/memory_dynix.lo: ../../include/net-snmp/agent/old_api.h
+./ucd-snmp/memory_dynix.lo: ../../include/net-snmp/agent/read_only.h
+./ucd-snmp/memory_dynix.lo: ../../include/net-snmp/agent/serialize.h
+./ucd-snmp/memory_dynix.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./ucd-snmp/memory_dynix.lo: ../../include/net-snmp/agent/mode_end_call.h
+./ucd-snmp/memory_dynix.lo: ../../include/net-snmp/agent/table.h
+./ucd-snmp/memory_dynix.lo: ../../include/net-snmp/agent/table_data.h
+./ucd-snmp/memory_dynix.lo: ../../include/net-snmp/agent/table_dataset.h
+./ucd-snmp/memory_dynix.lo: ../../include/net-snmp/agent/table_iterator.h
+./ucd-snmp/memory_dynix.lo: ../../include/net-snmp/agent/mib_module_config.h
+./ucd-snmp/memory_dynix.lo: ../../include/net-snmp/agent/auto_nlist.h
+./ucd-snmp/memory_dynix.lo: util_funcs.h struct.h ./ucd-snmp/memory.h
+./ucd-snmp/memory_dynix.lo: mibdefs.h ./ucd-snmp/memory_dynix.h
+./ucd-snmp/memory_freebsd2.lo: ../../include/net-snmp/net-snmp-config.h
+./ucd-snmp/memory_freebsd2.lo: ../../include/net-snmp/system/linux.h
+./ucd-snmp/memory_freebsd2.lo: ../../include/net-snmp/system/sysv.h
+./ucd-snmp/memory_freebsd2.lo: ../../include/net-snmp/system/generic.h
+./ucd-snmp/memory_freebsd2.lo: ../../include/net-snmp/machine/generic.h
+./ucd-snmp/memory_freebsd2.lo: ../../include/net-snmp/net-snmp-includes.h
+./ucd-snmp/memory_freebsd2.lo: ../../include/net-snmp/definitions.h
+./ucd-snmp/memory_freebsd2.lo: ../../include/net-snmp/types.h
+./ucd-snmp/memory_freebsd2.lo: ../../include/net-snmp/library/snmp_api.h
+./ucd-snmp/memory_freebsd2.lo: ../../include/net-snmp/library/asn1.h
+./ucd-snmp/memory_freebsd2.lo: ../../include/net-snmp/library/snmp_impl.h
+./ucd-snmp/memory_freebsd2.lo: ../../include/net-snmp/library/snmp.h
+./ucd-snmp/memory_freebsd2.lo: ../../include/net-snmp/library/snmp-tc.h
+./ucd-snmp/memory_freebsd2.lo: ../../include/net-snmp/utilities.h
+./ucd-snmp/memory_freebsd2.lo: ../../include/net-snmp/library/snmp_client.h
+./ucd-snmp/memory_freebsd2.lo: ../../include/net-snmp/library/getopt.h
+./ucd-snmp/memory_freebsd2.lo: ../../include/net-snmp/library/system.h
+./ucd-snmp/memory_freebsd2.lo: ../../include/net-snmp/library/tools.h
+./ucd-snmp/memory_freebsd2.lo: ../../include/net-snmp/library/int64.h
+./ucd-snmp/memory_freebsd2.lo: ../../include/net-snmp/library/mt_support.h
+./ucd-snmp/memory_freebsd2.lo: ../../include/net-snmp/library/snmp_alarm.h
+./ucd-snmp/memory_freebsd2.lo: ../../include/net-snmp/library/data_list.h
+./ucd-snmp/memory_freebsd2.lo: ../../include/net-snmp/library/callback.h
+./ucd-snmp/memory_freebsd2.lo: ../../include/net-snmp/library/oid_stash.h
+./ucd-snmp/memory_freebsd2.lo: ../../include/net-snmp/library/check_varbind.h
+./ucd-snmp/memory_freebsd2.lo: ../../include/net-snmp/version.h
+./ucd-snmp/memory_freebsd2.lo: ../../include/net-snmp/session_api.h
+./ucd-snmp/memory_freebsd2.lo: ../../include/net-snmp/library/snmp_transport.h
+./ucd-snmp/memory_freebsd2.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./ucd-snmp/memory_freebsd2.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./ucd-snmp/memory_freebsd2.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./ucd-snmp/memory_freebsd2.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./ucd-snmp/memory_freebsd2.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./ucd-snmp/memory_freebsd2.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./ucd-snmp/memory_freebsd2.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./ucd-snmp/memory_freebsd2.lo: ../../include/net-snmp/library/ucd_compat.h
+./ucd-snmp/memory_freebsd2.lo: ../../include/net-snmp/pdu_api.h
+./ucd-snmp/memory_freebsd2.lo: ../../include/net-snmp/mib_api.h
+./ucd-snmp/memory_freebsd2.lo: ../../include/net-snmp/library/mib.h
+./ucd-snmp/memory_freebsd2.lo: ../../include/net-snmp/library/parse.h
+./ucd-snmp/memory_freebsd2.lo: ../../include/net-snmp/varbind_api.h
+./ucd-snmp/memory_freebsd2.lo: ../../include/net-snmp/config_api.h
+./ucd-snmp/memory_freebsd2.lo: ../../include/net-snmp/library/read_config.h
+./ucd-snmp/memory_freebsd2.lo: ../../include/net-snmp/library/default_store.h
+./ucd-snmp/memory_freebsd2.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./ucd-snmp/memory_freebsd2.lo: ../../include/net-snmp/library/snmp_enum.h
+./ucd-snmp/memory_freebsd2.lo: ../../include/net-snmp/library/vacm.h
+./ucd-snmp/memory_freebsd2.lo: ../../include/net-snmp/output_api.h
+./ucd-snmp/memory_freebsd2.lo: ../../include/net-snmp/library/snmp_debug.h
+./ucd-snmp/memory_freebsd2.lo: ../../include/net-snmp/library/snmp_logging.h
+./ucd-snmp/memory_freebsd2.lo: ../../include/net-snmp/snmpv3_api.h
+./ucd-snmp/memory_freebsd2.lo: ../../include/net-snmp/library/snmpv3.h
+./ucd-snmp/memory_freebsd2.lo: ../../include/net-snmp/library/transform_oids.h
+./ucd-snmp/memory_freebsd2.lo: ../../include/net-snmp/library/keytools.h
+./ucd-snmp/memory_freebsd2.lo: ../../include/net-snmp/library/scapi.h
+./ucd-snmp/memory_freebsd2.lo: ../../include/net-snmp/library/lcd_time.h
+./ucd-snmp/memory_freebsd2.lo: ../../include/net-snmp/library/snmp_secmod.h
+./ucd-snmp/memory_freebsd2.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./ucd-snmp/memory_freebsd2.lo: ../../include/net-snmp/library/snmpusm.h
+./ucd-snmp/memory_freebsd2.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./ucd-snmp/memory_freebsd2.lo: ../../include/net-snmp/agent/snmp_agent.h
+./ucd-snmp/memory_freebsd2.lo: ../../include/net-snmp/agent/snmp_vars.h
+./ucd-snmp/memory_freebsd2.lo: ../../include/net-snmp/agent/agent_handler.h
+./ucd-snmp/memory_freebsd2.lo: ../../include/net-snmp/agent/var_struct.h
+./ucd-snmp/memory_freebsd2.lo: ../../include/net-snmp/agent/agent_registry.h
+./ucd-snmp/memory_freebsd2.lo: ../../include/net-snmp/agent/ds_agent.h
+./ucd-snmp/memory_freebsd2.lo: ../../include/net-snmp/agent/agent_read_config.h
+./ucd-snmp/memory_freebsd2.lo: ../../include/net-snmp/agent/agent_trap.h
+./ucd-snmp/memory_freebsd2.lo: ../../include/net-snmp/agent/all_helpers.h
+./ucd-snmp/memory_freebsd2.lo: ../../include/net-snmp/agent/instance.h
+./ucd-snmp/memory_freebsd2.lo: ../../include/net-snmp/agent/multiplexer.h
+./ucd-snmp/memory_freebsd2.lo: ../../include/net-snmp/agent/null.h
+./ucd-snmp/memory_freebsd2.lo: ../../include/net-snmp/agent/debug_handler.h
+./ucd-snmp/memory_freebsd2.lo: ../../include/net-snmp/agent/old_api.h
+./ucd-snmp/memory_freebsd2.lo: ../../include/net-snmp/agent/read_only.h
+./ucd-snmp/memory_freebsd2.lo: ../../include/net-snmp/agent/serialize.h
+./ucd-snmp/memory_freebsd2.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./ucd-snmp/memory_freebsd2.lo: ../../include/net-snmp/agent/mode_end_call.h
+./ucd-snmp/memory_freebsd2.lo: ../../include/net-snmp/agent/table.h
+./ucd-snmp/memory_freebsd2.lo: ../../include/net-snmp/agent/table_data.h
+./ucd-snmp/memory_freebsd2.lo: ../../include/net-snmp/agent/table_dataset.h
+./ucd-snmp/memory_freebsd2.lo: ../../include/net-snmp/agent/table_iterator.h
+./ucd-snmp/memory_freebsd2.lo: ../../include/net-snmp/agent/mib_module_config.h
+./ucd-snmp/memory_freebsd2.lo: ../../include/net-snmp/agent/auto_nlist.h
+./ucd-snmp/memory_freebsd2.lo: util_funcs.h struct.h ./ucd-snmp/memory.h
+./ucd-snmp/memory_freebsd2.lo: mibdefs.h ./ucd-snmp/memory_freebsd2.h
+./ucd-snmp/memory_hpux.lo: ../../include/net-snmp/net-snmp-config.h
+./ucd-snmp/memory_hpux.lo: ../../include/net-snmp/system/linux.h
+./ucd-snmp/memory_hpux.lo: ../../include/net-snmp/system/sysv.h
+./ucd-snmp/memory_hpux.lo: ../../include/net-snmp/system/generic.h
+./ucd-snmp/memory_hpux.lo: ../../include/net-snmp/machine/generic.h
+./ucd-snmp/memory_hpux.lo: ../../include/net-snmp/net-snmp-includes.h
+./ucd-snmp/memory_hpux.lo: ../../include/net-snmp/definitions.h
+./ucd-snmp/memory_hpux.lo: ../../include/net-snmp/types.h
+./ucd-snmp/memory_hpux.lo: ../../include/net-snmp/library/snmp_api.h
+./ucd-snmp/memory_hpux.lo: ../../include/net-snmp/library/asn1.h
+./ucd-snmp/memory_hpux.lo: ../../include/net-snmp/library/snmp_impl.h
+./ucd-snmp/memory_hpux.lo: ../../include/net-snmp/library/snmp.h
+./ucd-snmp/memory_hpux.lo: ../../include/net-snmp/library/snmp-tc.h
+./ucd-snmp/memory_hpux.lo: ../../include/net-snmp/utilities.h
+./ucd-snmp/memory_hpux.lo: ../../include/net-snmp/library/snmp_client.h
+./ucd-snmp/memory_hpux.lo: ../../include/net-snmp/library/getopt.h
+./ucd-snmp/memory_hpux.lo: ../../include/net-snmp/library/system.h
+./ucd-snmp/memory_hpux.lo: ../../include/net-snmp/library/tools.h
+./ucd-snmp/memory_hpux.lo: ../../include/net-snmp/library/int64.h
+./ucd-snmp/memory_hpux.lo: ../../include/net-snmp/library/mt_support.h
+./ucd-snmp/memory_hpux.lo: ../../include/net-snmp/library/snmp_alarm.h
+./ucd-snmp/memory_hpux.lo: ../../include/net-snmp/library/data_list.h
+./ucd-snmp/memory_hpux.lo: ../../include/net-snmp/library/callback.h
+./ucd-snmp/memory_hpux.lo: ../../include/net-snmp/library/oid_stash.h
+./ucd-snmp/memory_hpux.lo: ../../include/net-snmp/library/check_varbind.h
+./ucd-snmp/memory_hpux.lo: ../../include/net-snmp/version.h
+./ucd-snmp/memory_hpux.lo: ../../include/net-snmp/session_api.h
+./ucd-snmp/memory_hpux.lo: ../../include/net-snmp/library/snmp_transport.h
+./ucd-snmp/memory_hpux.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./ucd-snmp/memory_hpux.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./ucd-snmp/memory_hpux.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./ucd-snmp/memory_hpux.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./ucd-snmp/memory_hpux.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./ucd-snmp/memory_hpux.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./ucd-snmp/memory_hpux.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./ucd-snmp/memory_hpux.lo: ../../include/net-snmp/library/ucd_compat.h
+./ucd-snmp/memory_hpux.lo: ../../include/net-snmp/pdu_api.h
+./ucd-snmp/memory_hpux.lo: ../../include/net-snmp/mib_api.h
+./ucd-snmp/memory_hpux.lo: ../../include/net-snmp/library/mib.h
+./ucd-snmp/memory_hpux.lo: ../../include/net-snmp/library/parse.h
+./ucd-snmp/memory_hpux.lo: ../../include/net-snmp/varbind_api.h
+./ucd-snmp/memory_hpux.lo: ../../include/net-snmp/config_api.h
+./ucd-snmp/memory_hpux.lo: ../../include/net-snmp/library/read_config.h
+./ucd-snmp/memory_hpux.lo: ../../include/net-snmp/library/default_store.h
+./ucd-snmp/memory_hpux.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./ucd-snmp/memory_hpux.lo: ../../include/net-snmp/library/snmp_enum.h
+./ucd-snmp/memory_hpux.lo: ../../include/net-snmp/library/vacm.h
+./ucd-snmp/memory_hpux.lo: ../../include/net-snmp/output_api.h
+./ucd-snmp/memory_hpux.lo: ../../include/net-snmp/library/snmp_debug.h
+./ucd-snmp/memory_hpux.lo: ../../include/net-snmp/library/snmp_logging.h
+./ucd-snmp/memory_hpux.lo: ../../include/net-snmp/snmpv3_api.h
+./ucd-snmp/memory_hpux.lo: ../../include/net-snmp/library/snmpv3.h
+./ucd-snmp/memory_hpux.lo: ../../include/net-snmp/library/transform_oids.h
+./ucd-snmp/memory_hpux.lo: ../../include/net-snmp/library/keytools.h
+./ucd-snmp/memory_hpux.lo: ../../include/net-snmp/library/scapi.h
+./ucd-snmp/memory_hpux.lo: ../../include/net-snmp/library/lcd_time.h
+./ucd-snmp/memory_hpux.lo: ../../include/net-snmp/library/snmp_secmod.h
+./ucd-snmp/memory_hpux.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./ucd-snmp/memory_hpux.lo: ../../include/net-snmp/library/snmpusm.h
+./ucd-snmp/memory_hpux.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./ucd-snmp/memory_hpux.lo: ../../include/net-snmp/agent/snmp_agent.h
+./ucd-snmp/memory_hpux.lo: ../../include/net-snmp/agent/snmp_vars.h
+./ucd-snmp/memory_hpux.lo: ../../include/net-snmp/agent/agent_handler.h
+./ucd-snmp/memory_hpux.lo: ../../include/net-snmp/agent/var_struct.h
+./ucd-snmp/memory_hpux.lo: ../../include/net-snmp/agent/agent_registry.h
+./ucd-snmp/memory_hpux.lo: ../../include/net-snmp/agent/ds_agent.h
+./ucd-snmp/memory_hpux.lo: ../../include/net-snmp/agent/agent_read_config.h
+./ucd-snmp/memory_hpux.lo: ../../include/net-snmp/agent/agent_trap.h
+./ucd-snmp/memory_hpux.lo: ../../include/net-snmp/agent/all_helpers.h
+./ucd-snmp/memory_hpux.lo: ../../include/net-snmp/agent/instance.h
+./ucd-snmp/memory_hpux.lo: ../../include/net-snmp/agent/multiplexer.h
+./ucd-snmp/memory_hpux.lo: ../../include/net-snmp/agent/null.h
+./ucd-snmp/memory_hpux.lo: ../../include/net-snmp/agent/debug_handler.h
+./ucd-snmp/memory_hpux.lo: ../../include/net-snmp/agent/old_api.h
+./ucd-snmp/memory_hpux.lo: ../../include/net-snmp/agent/read_only.h
+./ucd-snmp/memory_hpux.lo: ../../include/net-snmp/agent/serialize.h
+./ucd-snmp/memory_hpux.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./ucd-snmp/memory_hpux.lo: ../../include/net-snmp/agent/mode_end_call.h
+./ucd-snmp/memory_hpux.lo: ../../include/net-snmp/agent/table.h
+./ucd-snmp/memory_hpux.lo: ../../include/net-snmp/agent/table_data.h
+./ucd-snmp/memory_hpux.lo: ../../include/net-snmp/agent/table_dataset.h
+./ucd-snmp/memory_hpux.lo: ../../include/net-snmp/agent/table_iterator.h
+./ucd-snmp/memory_hpux.lo: ../../include/net-snmp/agent/mib_module_config.h
+./ucd-snmp/memory_hpux.lo: ../../include/net-snmp/agent/auto_nlist.h
+./ucd-snmp/memory_hpux.lo: ./ucd-snmp/memory.h mibdefs.h
+./ucd-snmp/memory_hpux.lo: ./ucd-snmp/memory_hpux.h
+./ucd-snmp/memory_netbsd1.lo: ../../include/net-snmp/net-snmp-config.h
+./ucd-snmp/memory_netbsd1.lo: ../../include/net-snmp/system/linux.h
+./ucd-snmp/memory_netbsd1.lo: ../../include/net-snmp/system/sysv.h
+./ucd-snmp/memory_netbsd1.lo: ../../include/net-snmp/system/generic.h
+./ucd-snmp/memory_netbsd1.lo: ../../include/net-snmp/machine/generic.h
+./ucd-snmp/memory_netbsd1.lo: ../../include/net-snmp/net-snmp-includes.h
+./ucd-snmp/memory_netbsd1.lo: ../../include/net-snmp/definitions.h
+./ucd-snmp/memory_netbsd1.lo: ../../include/net-snmp/types.h
+./ucd-snmp/memory_netbsd1.lo: ../../include/net-snmp/library/snmp_api.h
+./ucd-snmp/memory_netbsd1.lo: ../../include/net-snmp/library/asn1.h
+./ucd-snmp/memory_netbsd1.lo: ../../include/net-snmp/library/snmp_impl.h
+./ucd-snmp/memory_netbsd1.lo: ../../include/net-snmp/library/snmp.h
+./ucd-snmp/memory_netbsd1.lo: ../../include/net-snmp/library/snmp-tc.h
+./ucd-snmp/memory_netbsd1.lo: ../../include/net-snmp/utilities.h
+./ucd-snmp/memory_netbsd1.lo: ../../include/net-snmp/library/snmp_client.h
+./ucd-snmp/memory_netbsd1.lo: ../../include/net-snmp/library/getopt.h
+./ucd-snmp/memory_netbsd1.lo: ../../include/net-snmp/library/system.h
+./ucd-snmp/memory_netbsd1.lo: ../../include/net-snmp/library/tools.h
+./ucd-snmp/memory_netbsd1.lo: ../../include/net-snmp/library/int64.h
+./ucd-snmp/memory_netbsd1.lo: ../../include/net-snmp/library/mt_support.h
+./ucd-snmp/memory_netbsd1.lo: ../../include/net-snmp/library/snmp_alarm.h
+./ucd-snmp/memory_netbsd1.lo: ../../include/net-snmp/library/data_list.h
+./ucd-snmp/memory_netbsd1.lo: ../../include/net-snmp/library/callback.h
+./ucd-snmp/memory_netbsd1.lo: ../../include/net-snmp/library/oid_stash.h
+./ucd-snmp/memory_netbsd1.lo: ../../include/net-snmp/library/check_varbind.h
+./ucd-snmp/memory_netbsd1.lo: ../../include/net-snmp/version.h
+./ucd-snmp/memory_netbsd1.lo: ../../include/net-snmp/session_api.h
+./ucd-snmp/memory_netbsd1.lo: ../../include/net-snmp/library/snmp_transport.h
+./ucd-snmp/memory_netbsd1.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./ucd-snmp/memory_netbsd1.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./ucd-snmp/memory_netbsd1.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./ucd-snmp/memory_netbsd1.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./ucd-snmp/memory_netbsd1.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./ucd-snmp/memory_netbsd1.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./ucd-snmp/memory_netbsd1.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./ucd-snmp/memory_netbsd1.lo: ../../include/net-snmp/library/ucd_compat.h
+./ucd-snmp/memory_netbsd1.lo: ../../include/net-snmp/pdu_api.h
+./ucd-snmp/memory_netbsd1.lo: ../../include/net-snmp/mib_api.h
+./ucd-snmp/memory_netbsd1.lo: ../../include/net-snmp/library/mib.h
+./ucd-snmp/memory_netbsd1.lo: ../../include/net-snmp/library/parse.h
+./ucd-snmp/memory_netbsd1.lo: ../../include/net-snmp/varbind_api.h
+./ucd-snmp/memory_netbsd1.lo: ../../include/net-snmp/config_api.h
+./ucd-snmp/memory_netbsd1.lo: ../../include/net-snmp/library/read_config.h
+./ucd-snmp/memory_netbsd1.lo: ../../include/net-snmp/library/default_store.h
+./ucd-snmp/memory_netbsd1.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./ucd-snmp/memory_netbsd1.lo: ../../include/net-snmp/library/snmp_enum.h
+./ucd-snmp/memory_netbsd1.lo: ../../include/net-snmp/library/vacm.h
+./ucd-snmp/memory_netbsd1.lo: ../../include/net-snmp/output_api.h
+./ucd-snmp/memory_netbsd1.lo: ../../include/net-snmp/library/snmp_debug.h
+./ucd-snmp/memory_netbsd1.lo: ../../include/net-snmp/library/snmp_logging.h
+./ucd-snmp/memory_netbsd1.lo: ../../include/net-snmp/snmpv3_api.h
+./ucd-snmp/memory_netbsd1.lo: ../../include/net-snmp/library/snmpv3.h
+./ucd-snmp/memory_netbsd1.lo: ../../include/net-snmp/library/transform_oids.h
+./ucd-snmp/memory_netbsd1.lo: ../../include/net-snmp/library/keytools.h
+./ucd-snmp/memory_netbsd1.lo: ../../include/net-snmp/library/scapi.h
+./ucd-snmp/memory_netbsd1.lo: ../../include/net-snmp/library/lcd_time.h
+./ucd-snmp/memory_netbsd1.lo: ../../include/net-snmp/library/snmp_secmod.h
+./ucd-snmp/memory_netbsd1.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./ucd-snmp/memory_netbsd1.lo: ../../include/net-snmp/library/snmpusm.h
+./ucd-snmp/memory_netbsd1.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./ucd-snmp/memory_netbsd1.lo: ../../include/net-snmp/agent/snmp_agent.h
+./ucd-snmp/memory_netbsd1.lo: ../../include/net-snmp/agent/snmp_vars.h
+./ucd-snmp/memory_netbsd1.lo: ../../include/net-snmp/agent/agent_handler.h
+./ucd-snmp/memory_netbsd1.lo: ../../include/net-snmp/agent/var_struct.h
+./ucd-snmp/memory_netbsd1.lo: ../../include/net-snmp/agent/agent_registry.h
+./ucd-snmp/memory_netbsd1.lo: ../../include/net-snmp/agent/ds_agent.h
+./ucd-snmp/memory_netbsd1.lo: ../../include/net-snmp/agent/agent_read_config.h
+./ucd-snmp/memory_netbsd1.lo: ../../include/net-snmp/agent/agent_trap.h
+./ucd-snmp/memory_netbsd1.lo: ../../include/net-snmp/agent/all_helpers.h
+./ucd-snmp/memory_netbsd1.lo: ../../include/net-snmp/agent/instance.h
+./ucd-snmp/memory_netbsd1.lo: ../../include/net-snmp/agent/multiplexer.h
+./ucd-snmp/memory_netbsd1.lo: ../../include/net-snmp/agent/null.h
+./ucd-snmp/memory_netbsd1.lo: ../../include/net-snmp/agent/debug_handler.h
+./ucd-snmp/memory_netbsd1.lo: ../../include/net-snmp/agent/old_api.h
+./ucd-snmp/memory_netbsd1.lo: ../../include/net-snmp/agent/read_only.h
+./ucd-snmp/memory_netbsd1.lo: ../../include/net-snmp/agent/serialize.h
+./ucd-snmp/memory_netbsd1.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./ucd-snmp/memory_netbsd1.lo: ../../include/net-snmp/agent/mode_end_call.h
+./ucd-snmp/memory_netbsd1.lo: ../../include/net-snmp/agent/table.h
+./ucd-snmp/memory_netbsd1.lo: ../../include/net-snmp/agent/table_data.h
+./ucd-snmp/memory_netbsd1.lo: ../../include/net-snmp/agent/table_dataset.h
+./ucd-snmp/memory_netbsd1.lo: ../../include/net-snmp/agent/table_iterator.h
+./ucd-snmp/memory_netbsd1.lo: ../../include/net-snmp/agent/mib_module_config.h
+./ucd-snmp/memory_netbsd1.lo: ../../include/net-snmp/agent/auto_nlist.h
+./ucd-snmp/memory_netbsd1.lo: util_funcs.h struct.h ./ucd-snmp/memory.h
+./ucd-snmp/memory_netbsd1.lo: mibdefs.h ./ucd-snmp/memory_netbsd1.h
+./ucd-snmp/memory_solaris2.lo: ../../include/net-snmp/net-snmp-config.h
+./ucd-snmp/memory_solaris2.lo: ../../include/net-snmp/system/linux.h
+./ucd-snmp/memory_solaris2.lo: ../../include/net-snmp/system/sysv.h
+./ucd-snmp/memory_solaris2.lo: ../../include/net-snmp/system/generic.h
+./ucd-snmp/memory_solaris2.lo: ../../include/net-snmp/machine/generic.h
+./ucd-snmp/memory_solaris2.lo: ../../include/net-snmp/net-snmp-includes.h
+./ucd-snmp/memory_solaris2.lo: ../../include/net-snmp/definitions.h
+./ucd-snmp/memory_solaris2.lo: ../../include/net-snmp/types.h
+./ucd-snmp/memory_solaris2.lo: ../../include/net-snmp/library/snmp_api.h
+./ucd-snmp/memory_solaris2.lo: ../../include/net-snmp/library/asn1.h
+./ucd-snmp/memory_solaris2.lo: ../../include/net-snmp/library/snmp_impl.h
+./ucd-snmp/memory_solaris2.lo: ../../include/net-snmp/library/snmp.h
+./ucd-snmp/memory_solaris2.lo: ../../include/net-snmp/library/snmp-tc.h
+./ucd-snmp/memory_solaris2.lo: ../../include/net-snmp/utilities.h
+./ucd-snmp/memory_solaris2.lo: ../../include/net-snmp/library/snmp_client.h
+./ucd-snmp/memory_solaris2.lo: ../../include/net-snmp/library/getopt.h
+./ucd-snmp/memory_solaris2.lo: ../../include/net-snmp/library/system.h
+./ucd-snmp/memory_solaris2.lo: ../../include/net-snmp/library/tools.h
+./ucd-snmp/memory_solaris2.lo: ../../include/net-snmp/library/int64.h
+./ucd-snmp/memory_solaris2.lo: ../../include/net-snmp/library/mt_support.h
+./ucd-snmp/memory_solaris2.lo: ../../include/net-snmp/library/snmp_alarm.h
+./ucd-snmp/memory_solaris2.lo: ../../include/net-snmp/library/data_list.h
+./ucd-snmp/memory_solaris2.lo: ../../include/net-snmp/library/callback.h
+./ucd-snmp/memory_solaris2.lo: ../../include/net-snmp/library/oid_stash.h
+./ucd-snmp/memory_solaris2.lo: ../../include/net-snmp/library/check_varbind.h
+./ucd-snmp/memory_solaris2.lo: ../../include/net-snmp/version.h
+./ucd-snmp/memory_solaris2.lo: ../../include/net-snmp/session_api.h
+./ucd-snmp/memory_solaris2.lo: ../../include/net-snmp/library/snmp_transport.h
+./ucd-snmp/memory_solaris2.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./ucd-snmp/memory_solaris2.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./ucd-snmp/memory_solaris2.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./ucd-snmp/memory_solaris2.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./ucd-snmp/memory_solaris2.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./ucd-snmp/memory_solaris2.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./ucd-snmp/memory_solaris2.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./ucd-snmp/memory_solaris2.lo: ../../include/net-snmp/library/ucd_compat.h
+./ucd-snmp/memory_solaris2.lo: ../../include/net-snmp/pdu_api.h
+./ucd-snmp/memory_solaris2.lo: ../../include/net-snmp/mib_api.h
+./ucd-snmp/memory_solaris2.lo: ../../include/net-snmp/library/mib.h
+./ucd-snmp/memory_solaris2.lo: ../../include/net-snmp/library/parse.h
+./ucd-snmp/memory_solaris2.lo: ../../include/net-snmp/varbind_api.h
+./ucd-snmp/memory_solaris2.lo: ../../include/net-snmp/config_api.h
+./ucd-snmp/memory_solaris2.lo: ../../include/net-snmp/library/read_config.h
+./ucd-snmp/memory_solaris2.lo: ../../include/net-snmp/library/default_store.h
+./ucd-snmp/memory_solaris2.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./ucd-snmp/memory_solaris2.lo: ../../include/net-snmp/library/snmp_enum.h
+./ucd-snmp/memory_solaris2.lo: ../../include/net-snmp/library/vacm.h
+./ucd-snmp/memory_solaris2.lo: ../../include/net-snmp/output_api.h
+./ucd-snmp/memory_solaris2.lo: ../../include/net-snmp/library/snmp_debug.h
+./ucd-snmp/memory_solaris2.lo: ../../include/net-snmp/library/snmp_logging.h
+./ucd-snmp/memory_solaris2.lo: ../../include/net-snmp/snmpv3_api.h
+./ucd-snmp/memory_solaris2.lo: ../../include/net-snmp/library/snmpv3.h
+./ucd-snmp/memory_solaris2.lo: ../../include/net-snmp/library/transform_oids.h
+./ucd-snmp/memory_solaris2.lo: ../../include/net-snmp/library/keytools.h
+./ucd-snmp/memory_solaris2.lo: ../../include/net-snmp/library/scapi.h
+./ucd-snmp/memory_solaris2.lo: ../../include/net-snmp/library/lcd_time.h
+./ucd-snmp/memory_solaris2.lo: ../../include/net-snmp/library/snmp_secmod.h
+./ucd-snmp/memory_solaris2.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./ucd-snmp/memory_solaris2.lo: ../../include/net-snmp/library/snmpusm.h
+./ucd-snmp/memory_solaris2.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./ucd-snmp/memory_solaris2.lo: ../../include/net-snmp/agent/snmp_agent.h
+./ucd-snmp/memory_solaris2.lo: ../../include/net-snmp/agent/snmp_vars.h
+./ucd-snmp/memory_solaris2.lo: ../../include/net-snmp/agent/agent_handler.h
+./ucd-snmp/memory_solaris2.lo: ../../include/net-snmp/agent/var_struct.h
+./ucd-snmp/memory_solaris2.lo: ../../include/net-snmp/agent/agent_registry.h
+./ucd-snmp/memory_solaris2.lo: ../../include/net-snmp/agent/ds_agent.h
+./ucd-snmp/memory_solaris2.lo: ../../include/net-snmp/agent/agent_read_config.h
+./ucd-snmp/memory_solaris2.lo: ../../include/net-snmp/agent/agent_trap.h
+./ucd-snmp/memory_solaris2.lo: ../../include/net-snmp/agent/all_helpers.h
+./ucd-snmp/memory_solaris2.lo: ../../include/net-snmp/agent/instance.h
+./ucd-snmp/memory_solaris2.lo: ../../include/net-snmp/agent/multiplexer.h
+./ucd-snmp/memory_solaris2.lo: ../../include/net-snmp/agent/null.h
+./ucd-snmp/memory_solaris2.lo: ../../include/net-snmp/agent/debug_handler.h
+./ucd-snmp/memory_solaris2.lo: ../../include/net-snmp/agent/old_api.h
+./ucd-snmp/memory_solaris2.lo: ../../include/net-snmp/agent/read_only.h
+./ucd-snmp/memory_solaris2.lo: ../../include/net-snmp/agent/serialize.h
+./ucd-snmp/memory_solaris2.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./ucd-snmp/memory_solaris2.lo: ../../include/net-snmp/agent/mode_end_call.h
+./ucd-snmp/memory_solaris2.lo: ../../include/net-snmp/agent/table.h
+./ucd-snmp/memory_solaris2.lo: ../../include/net-snmp/agent/table_data.h
+./ucd-snmp/memory_solaris2.lo: ../../include/net-snmp/agent/table_dataset.h
+./ucd-snmp/memory_solaris2.lo: ../../include/net-snmp/agent/table_iterator.h
+./ucd-snmp/memory_solaris2.lo: ../../include/net-snmp/agent/mib_module_config.h
+./ucd-snmp/memory_solaris2.lo: ../../include/net-snmp/agent/auto_nlist.h
+./ucd-snmp/memory_solaris2.lo: util_funcs.h struct.h ./ucd-snmp/memory.h
+./ucd-snmp/memory_solaris2.lo: mibdefs.h ./ucd-snmp/memory_solaris2.h
+./ucd-snmp/pass.lo: ../../include/net-snmp/net-snmp-config.h
+./ucd-snmp/pass.lo: ../../include/net-snmp/system/linux.h
+./ucd-snmp/pass.lo: ../../include/net-snmp/system/sysv.h
+./ucd-snmp/pass.lo: ../../include/net-snmp/system/generic.h
+./ucd-snmp/pass.lo: ../../include/net-snmp/machine/generic.h
+./ucd-snmp/pass.lo: ../../include/net-snmp/net-snmp-includes.h
+./ucd-snmp/pass.lo: ../../include/net-snmp/definitions.h
+./ucd-snmp/pass.lo: ../../include/net-snmp/types.h
+./ucd-snmp/pass.lo: ../../include/net-snmp/library/snmp_api.h
+./ucd-snmp/pass.lo: ../../include/net-snmp/library/asn1.h
+./ucd-snmp/pass.lo: ../../include/net-snmp/library/snmp_impl.h
+./ucd-snmp/pass.lo: ../../include/net-snmp/library/snmp.h
+./ucd-snmp/pass.lo: ../../include/net-snmp/library/snmp-tc.h
+./ucd-snmp/pass.lo: ../../include/net-snmp/utilities.h
+./ucd-snmp/pass.lo: ../../include/net-snmp/library/snmp_client.h
+./ucd-snmp/pass.lo: ../../include/net-snmp/library/getopt.h
+./ucd-snmp/pass.lo: ../../include/net-snmp/library/system.h
+./ucd-snmp/pass.lo: ../../include/net-snmp/library/tools.h
+./ucd-snmp/pass.lo: ../../include/net-snmp/library/int64.h
+./ucd-snmp/pass.lo: ../../include/net-snmp/library/mt_support.h
+./ucd-snmp/pass.lo: ../../include/net-snmp/library/snmp_alarm.h
+./ucd-snmp/pass.lo: ../../include/net-snmp/library/data_list.h
+./ucd-snmp/pass.lo: ../../include/net-snmp/library/callback.h
+./ucd-snmp/pass.lo: ../../include/net-snmp/library/oid_stash.h
+./ucd-snmp/pass.lo: ../../include/net-snmp/library/check_varbind.h
+./ucd-snmp/pass.lo: ../../include/net-snmp/version.h
+./ucd-snmp/pass.lo: ../../include/net-snmp/session_api.h
+./ucd-snmp/pass.lo: ../../include/net-snmp/library/snmp_transport.h
+./ucd-snmp/pass.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./ucd-snmp/pass.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./ucd-snmp/pass.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./ucd-snmp/pass.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./ucd-snmp/pass.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./ucd-snmp/pass.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./ucd-snmp/pass.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./ucd-snmp/pass.lo: ../../include/net-snmp/library/ucd_compat.h
+./ucd-snmp/pass.lo: ../../include/net-snmp/pdu_api.h
+./ucd-snmp/pass.lo: ../../include/net-snmp/mib_api.h
+./ucd-snmp/pass.lo: ../../include/net-snmp/library/mib.h
+./ucd-snmp/pass.lo: ../../include/net-snmp/library/parse.h
+./ucd-snmp/pass.lo: ../../include/net-snmp/varbind_api.h
+./ucd-snmp/pass.lo: ../../include/net-snmp/config_api.h
+./ucd-snmp/pass.lo: ../../include/net-snmp/library/read_config.h
+./ucd-snmp/pass.lo: ../../include/net-snmp/library/default_store.h
+./ucd-snmp/pass.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./ucd-snmp/pass.lo: ../../include/net-snmp/library/snmp_enum.h
+./ucd-snmp/pass.lo: ../../include/net-snmp/library/vacm.h
+./ucd-snmp/pass.lo: ../../include/net-snmp/output_api.h
+./ucd-snmp/pass.lo: ../../include/net-snmp/library/snmp_debug.h
+./ucd-snmp/pass.lo: ../../include/net-snmp/library/snmp_logging.h
+./ucd-snmp/pass.lo: ../../include/net-snmp/snmpv3_api.h
+./ucd-snmp/pass.lo: ../../include/net-snmp/library/snmpv3.h
+./ucd-snmp/pass.lo: ../../include/net-snmp/library/transform_oids.h
+./ucd-snmp/pass.lo: ../../include/net-snmp/library/keytools.h
+./ucd-snmp/pass.lo: ../../include/net-snmp/library/scapi.h
+./ucd-snmp/pass.lo: ../../include/net-snmp/library/lcd_time.h
+./ucd-snmp/pass.lo: ../../include/net-snmp/library/snmp_secmod.h
+./ucd-snmp/pass.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./ucd-snmp/pass.lo: ../../include/net-snmp/library/snmpusm.h
+./ucd-snmp/pass.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./ucd-snmp/pass.lo: ../../include/net-snmp/agent/snmp_agent.h
+./ucd-snmp/pass.lo: ../../include/net-snmp/agent/snmp_vars.h
+./ucd-snmp/pass.lo: ../../include/net-snmp/agent/agent_handler.h
+./ucd-snmp/pass.lo: ../../include/net-snmp/agent/var_struct.h
+./ucd-snmp/pass.lo: ../../include/net-snmp/agent/agent_registry.h
+./ucd-snmp/pass.lo: ../../include/net-snmp/agent/ds_agent.h
+./ucd-snmp/pass.lo: ../../include/net-snmp/agent/agent_read_config.h
+./ucd-snmp/pass.lo: ../../include/net-snmp/agent/agent_trap.h
+./ucd-snmp/pass.lo: ../../include/net-snmp/agent/all_helpers.h
+./ucd-snmp/pass.lo: ../../include/net-snmp/agent/instance.h
+./ucd-snmp/pass.lo: ../../include/net-snmp/agent/multiplexer.h
+./ucd-snmp/pass.lo: ../../include/net-snmp/agent/null.h
+./ucd-snmp/pass.lo: ../../include/net-snmp/agent/debug_handler.h
+./ucd-snmp/pass.lo: ../../include/net-snmp/agent/old_api.h
+./ucd-snmp/pass.lo: ../../include/net-snmp/agent/read_only.h
+./ucd-snmp/pass.lo: ../../include/net-snmp/agent/serialize.h
+./ucd-snmp/pass.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./ucd-snmp/pass.lo: ../../include/net-snmp/agent/mode_end_call.h
+./ucd-snmp/pass.lo: ../../include/net-snmp/agent/table.h
+./ucd-snmp/pass.lo: ../../include/net-snmp/agent/table_data.h
+./ucd-snmp/pass.lo: ../../include/net-snmp/agent/table_dataset.h
+./ucd-snmp/pass.lo: ../../include/net-snmp/agent/table_iterator.h
+./ucd-snmp/pass.lo: ../../include/net-snmp/agent/mib_module_config.h struct.h
+./ucd-snmp/pass.lo: ./ucd-snmp/pass.h mibdefs.h ./ucd-snmp/extensible.h
+./ucd-snmp/pass.lo: util_funcs.h
+./ucd-snmp/pass_persist.lo: ../../include/net-snmp/net-snmp-config.h
+./ucd-snmp/pass_persist.lo: ../../include/net-snmp/system/linux.h
+./ucd-snmp/pass_persist.lo: ../../include/net-snmp/system/sysv.h
+./ucd-snmp/pass_persist.lo: ../../include/net-snmp/system/generic.h
+./ucd-snmp/pass_persist.lo: ../../include/net-snmp/machine/generic.h
+./ucd-snmp/pass_persist.lo: ../../include/net-snmp/net-snmp-includes.h
+./ucd-snmp/pass_persist.lo: ../../include/net-snmp/definitions.h
+./ucd-snmp/pass_persist.lo: ../../include/net-snmp/types.h
+./ucd-snmp/pass_persist.lo: ../../include/net-snmp/library/snmp_api.h
+./ucd-snmp/pass_persist.lo: ../../include/net-snmp/library/asn1.h
+./ucd-snmp/pass_persist.lo: ../../include/net-snmp/library/snmp_impl.h
+./ucd-snmp/pass_persist.lo: ../../include/net-snmp/library/snmp.h
+./ucd-snmp/pass_persist.lo: ../../include/net-snmp/library/snmp-tc.h
+./ucd-snmp/pass_persist.lo: ../../include/net-snmp/utilities.h
+./ucd-snmp/pass_persist.lo: ../../include/net-snmp/library/snmp_client.h
+./ucd-snmp/pass_persist.lo: ../../include/net-snmp/library/getopt.h
+./ucd-snmp/pass_persist.lo: ../../include/net-snmp/library/system.h
+./ucd-snmp/pass_persist.lo: ../../include/net-snmp/library/tools.h
+./ucd-snmp/pass_persist.lo: ../../include/net-snmp/library/int64.h
+./ucd-snmp/pass_persist.lo: ../../include/net-snmp/library/mt_support.h
+./ucd-snmp/pass_persist.lo: ../../include/net-snmp/library/snmp_alarm.h
+./ucd-snmp/pass_persist.lo: ../../include/net-snmp/library/data_list.h
+./ucd-snmp/pass_persist.lo: ../../include/net-snmp/library/callback.h
+./ucd-snmp/pass_persist.lo: ../../include/net-snmp/library/oid_stash.h
+./ucd-snmp/pass_persist.lo: ../../include/net-snmp/library/check_varbind.h
+./ucd-snmp/pass_persist.lo: ../../include/net-snmp/version.h
+./ucd-snmp/pass_persist.lo: ../../include/net-snmp/session_api.h
+./ucd-snmp/pass_persist.lo: ../../include/net-snmp/library/snmp_transport.h
+./ucd-snmp/pass_persist.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./ucd-snmp/pass_persist.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./ucd-snmp/pass_persist.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./ucd-snmp/pass_persist.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./ucd-snmp/pass_persist.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./ucd-snmp/pass_persist.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./ucd-snmp/pass_persist.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./ucd-snmp/pass_persist.lo: ../../include/net-snmp/library/ucd_compat.h
+./ucd-snmp/pass_persist.lo: ../../include/net-snmp/pdu_api.h
+./ucd-snmp/pass_persist.lo: ../../include/net-snmp/mib_api.h
+./ucd-snmp/pass_persist.lo: ../../include/net-snmp/library/mib.h
+./ucd-snmp/pass_persist.lo: ../../include/net-snmp/library/parse.h
+./ucd-snmp/pass_persist.lo: ../../include/net-snmp/varbind_api.h
+./ucd-snmp/pass_persist.lo: ../../include/net-snmp/config_api.h
+./ucd-snmp/pass_persist.lo: ../../include/net-snmp/library/read_config.h
+./ucd-snmp/pass_persist.lo: ../../include/net-snmp/library/default_store.h
+./ucd-snmp/pass_persist.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./ucd-snmp/pass_persist.lo: ../../include/net-snmp/library/snmp_enum.h
+./ucd-snmp/pass_persist.lo: ../../include/net-snmp/library/vacm.h
+./ucd-snmp/pass_persist.lo: ../../include/net-snmp/output_api.h
+./ucd-snmp/pass_persist.lo: ../../include/net-snmp/library/snmp_debug.h
+./ucd-snmp/pass_persist.lo: ../../include/net-snmp/library/snmp_logging.h
+./ucd-snmp/pass_persist.lo: ../../include/net-snmp/snmpv3_api.h
+./ucd-snmp/pass_persist.lo: ../../include/net-snmp/library/snmpv3.h
+./ucd-snmp/pass_persist.lo: ../../include/net-snmp/library/transform_oids.h
+./ucd-snmp/pass_persist.lo: ../../include/net-snmp/library/keytools.h
+./ucd-snmp/pass_persist.lo: ../../include/net-snmp/library/scapi.h
+./ucd-snmp/pass_persist.lo: ../../include/net-snmp/library/lcd_time.h
+./ucd-snmp/pass_persist.lo: ../../include/net-snmp/library/snmp_secmod.h
+./ucd-snmp/pass_persist.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./ucd-snmp/pass_persist.lo: ../../include/net-snmp/library/snmpusm.h
+./ucd-snmp/pass_persist.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./ucd-snmp/pass_persist.lo: ../../include/net-snmp/agent/snmp_agent.h
+./ucd-snmp/pass_persist.lo: ../../include/net-snmp/agent/snmp_vars.h
+./ucd-snmp/pass_persist.lo: ../../include/net-snmp/agent/agent_handler.h
+./ucd-snmp/pass_persist.lo: ../../include/net-snmp/agent/var_struct.h
+./ucd-snmp/pass_persist.lo: ../../include/net-snmp/agent/agent_registry.h
+./ucd-snmp/pass_persist.lo: ../../include/net-snmp/agent/ds_agent.h
+./ucd-snmp/pass_persist.lo: ../../include/net-snmp/agent/agent_read_config.h
+./ucd-snmp/pass_persist.lo: ../../include/net-snmp/agent/agent_trap.h
+./ucd-snmp/pass_persist.lo: ../../include/net-snmp/agent/all_helpers.h
+./ucd-snmp/pass_persist.lo: ../../include/net-snmp/agent/instance.h
+./ucd-snmp/pass_persist.lo: ../../include/net-snmp/agent/multiplexer.h
+./ucd-snmp/pass_persist.lo: ../../include/net-snmp/agent/null.h
+./ucd-snmp/pass_persist.lo: ../../include/net-snmp/agent/debug_handler.h
+./ucd-snmp/pass_persist.lo: ../../include/net-snmp/agent/old_api.h
+./ucd-snmp/pass_persist.lo: ../../include/net-snmp/agent/read_only.h
+./ucd-snmp/pass_persist.lo: ../../include/net-snmp/agent/serialize.h
+./ucd-snmp/pass_persist.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./ucd-snmp/pass_persist.lo: ../../include/net-snmp/agent/mode_end_call.h
+./ucd-snmp/pass_persist.lo: ../../include/net-snmp/agent/table.h
+./ucd-snmp/pass_persist.lo: ../../include/net-snmp/agent/table_data.h
+./ucd-snmp/pass_persist.lo: ../../include/net-snmp/agent/table_dataset.h
+./ucd-snmp/pass_persist.lo: ../../include/net-snmp/agent/table_iterator.h
+./ucd-snmp/pass_persist.lo: ../../include/net-snmp/agent/mib_module_config.h
+./ucd-snmp/pass_persist.lo: struct.h ./ucd-snmp/pass_persist.h mibdefs.h
+./ucd-snmp/pass_persist.lo: ./ucd-snmp/extensible.h util_funcs.h
+./ucd-snmp/proc.lo: ../../include/net-snmp/net-snmp-config.h
+./ucd-snmp/proc.lo: ../../include/net-snmp/system/linux.h
+./ucd-snmp/proc.lo: ../../include/net-snmp/system/sysv.h
+./ucd-snmp/proc.lo: ../../include/net-snmp/system/generic.h
+./ucd-snmp/proc.lo: ../../include/net-snmp/machine/generic.h
+./ucd-snmp/proc.lo: ../../include/net-snmp/net-snmp-includes.h
+./ucd-snmp/proc.lo: ../../include/net-snmp/definitions.h
+./ucd-snmp/proc.lo: ../../include/net-snmp/types.h
+./ucd-snmp/proc.lo: ../../include/net-snmp/library/snmp_api.h
+./ucd-snmp/proc.lo: ../../include/net-snmp/library/asn1.h
+./ucd-snmp/proc.lo: ../../include/net-snmp/library/snmp_impl.h
+./ucd-snmp/proc.lo: ../../include/net-snmp/library/snmp.h
+./ucd-snmp/proc.lo: ../../include/net-snmp/library/snmp-tc.h
+./ucd-snmp/proc.lo: ../../include/net-snmp/utilities.h
+./ucd-snmp/proc.lo: ../../include/net-snmp/library/snmp_client.h
+./ucd-snmp/proc.lo: ../../include/net-snmp/library/getopt.h
+./ucd-snmp/proc.lo: ../../include/net-snmp/library/system.h
+./ucd-snmp/proc.lo: ../../include/net-snmp/library/tools.h
+./ucd-snmp/proc.lo: ../../include/net-snmp/library/int64.h
+./ucd-snmp/proc.lo: ../../include/net-snmp/library/mt_support.h
+./ucd-snmp/proc.lo: ../../include/net-snmp/library/snmp_alarm.h
+./ucd-snmp/proc.lo: ../../include/net-snmp/library/data_list.h
+./ucd-snmp/proc.lo: ../../include/net-snmp/library/callback.h
+./ucd-snmp/proc.lo: ../../include/net-snmp/library/oid_stash.h
+./ucd-snmp/proc.lo: ../../include/net-snmp/library/check_varbind.h
+./ucd-snmp/proc.lo: ../../include/net-snmp/version.h
+./ucd-snmp/proc.lo: ../../include/net-snmp/session_api.h
+./ucd-snmp/proc.lo: ../../include/net-snmp/library/snmp_transport.h
+./ucd-snmp/proc.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./ucd-snmp/proc.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./ucd-snmp/proc.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./ucd-snmp/proc.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./ucd-snmp/proc.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./ucd-snmp/proc.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./ucd-snmp/proc.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./ucd-snmp/proc.lo: ../../include/net-snmp/library/ucd_compat.h
+./ucd-snmp/proc.lo: ../../include/net-snmp/pdu_api.h
+./ucd-snmp/proc.lo: ../../include/net-snmp/mib_api.h
+./ucd-snmp/proc.lo: ../../include/net-snmp/library/mib.h
+./ucd-snmp/proc.lo: ../../include/net-snmp/library/parse.h
+./ucd-snmp/proc.lo: ../../include/net-snmp/varbind_api.h
+./ucd-snmp/proc.lo: ../../include/net-snmp/config_api.h
+./ucd-snmp/proc.lo: ../../include/net-snmp/library/read_config.h
+./ucd-snmp/proc.lo: ../../include/net-snmp/library/default_store.h
+./ucd-snmp/proc.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./ucd-snmp/proc.lo: ../../include/net-snmp/library/snmp_enum.h
+./ucd-snmp/proc.lo: ../../include/net-snmp/library/vacm.h
+./ucd-snmp/proc.lo: ../../include/net-snmp/output_api.h
+./ucd-snmp/proc.lo: ../../include/net-snmp/library/snmp_debug.h
+./ucd-snmp/proc.lo: ../../include/net-snmp/library/snmp_logging.h
+./ucd-snmp/proc.lo: ../../include/net-snmp/snmpv3_api.h
+./ucd-snmp/proc.lo: ../../include/net-snmp/library/snmpv3.h
+./ucd-snmp/proc.lo: ../../include/net-snmp/library/transform_oids.h
+./ucd-snmp/proc.lo: ../../include/net-snmp/library/keytools.h
+./ucd-snmp/proc.lo: ../../include/net-snmp/library/scapi.h
+./ucd-snmp/proc.lo: ../../include/net-snmp/library/lcd_time.h
+./ucd-snmp/proc.lo: ../../include/net-snmp/library/snmp_secmod.h
+./ucd-snmp/proc.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./ucd-snmp/proc.lo: ../../include/net-snmp/library/snmpusm.h
+./ucd-snmp/proc.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./ucd-snmp/proc.lo: ../../include/net-snmp/agent/snmp_agent.h
+./ucd-snmp/proc.lo: ../../include/net-snmp/agent/snmp_vars.h
+./ucd-snmp/proc.lo: ../../include/net-snmp/agent/agent_handler.h
+./ucd-snmp/proc.lo: ../../include/net-snmp/agent/var_struct.h
+./ucd-snmp/proc.lo: ../../include/net-snmp/agent/agent_registry.h
+./ucd-snmp/proc.lo: ../../include/net-snmp/agent/ds_agent.h
+./ucd-snmp/proc.lo: ../../include/net-snmp/agent/agent_read_config.h
+./ucd-snmp/proc.lo: ../../include/net-snmp/agent/agent_trap.h
+./ucd-snmp/proc.lo: ../../include/net-snmp/agent/all_helpers.h
+./ucd-snmp/proc.lo: ../../include/net-snmp/agent/instance.h
+./ucd-snmp/proc.lo: ../../include/net-snmp/agent/multiplexer.h
+./ucd-snmp/proc.lo: ../../include/net-snmp/agent/null.h
+./ucd-snmp/proc.lo: ../../include/net-snmp/agent/debug_handler.h
+./ucd-snmp/proc.lo: ../../include/net-snmp/agent/old_api.h
+./ucd-snmp/proc.lo: ../../include/net-snmp/agent/read_only.h
+./ucd-snmp/proc.lo: ../../include/net-snmp/agent/serialize.h
+./ucd-snmp/proc.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./ucd-snmp/proc.lo: ../../include/net-snmp/agent/mode_end_call.h
+./ucd-snmp/proc.lo: ../../include/net-snmp/agent/table.h
+./ucd-snmp/proc.lo: ../../include/net-snmp/agent/table_data.h
+./ucd-snmp/proc.lo: ../../include/net-snmp/agent/table_dataset.h
+./ucd-snmp/proc.lo: ../../include/net-snmp/agent/table_iterator.h
+./ucd-snmp/proc.lo: ../../include/net-snmp/agent/mib_module_config.h struct.h
+./ucd-snmp/proc.lo: ./ucd-snmp/proc.h mibdefs.h ./ucd-snmp/errormib.h
+./ucd-snmp/proc.lo: util_funcs.h ./../kernel.h
+./ucd-snmp/proxy.lo: ../../include/net-snmp/net-snmp-config.h
+./ucd-snmp/proxy.lo: ../../include/net-snmp/system/linux.h
+./ucd-snmp/proxy.lo: ../../include/net-snmp/system/sysv.h
+./ucd-snmp/proxy.lo: ../../include/net-snmp/system/generic.h
+./ucd-snmp/proxy.lo: ../../include/net-snmp/machine/generic.h
+./ucd-snmp/proxy.lo: ../../include/net-snmp/net-snmp-includes.h
+./ucd-snmp/proxy.lo: ../../include/net-snmp/definitions.h
+./ucd-snmp/proxy.lo: ../../include/net-snmp/types.h
+./ucd-snmp/proxy.lo: ../../include/net-snmp/library/snmp_api.h
+./ucd-snmp/proxy.lo: ../../include/net-snmp/library/asn1.h
+./ucd-snmp/proxy.lo: ../../include/net-snmp/library/snmp_impl.h
+./ucd-snmp/proxy.lo: ../../include/net-snmp/library/snmp.h
+./ucd-snmp/proxy.lo: ../../include/net-snmp/library/snmp-tc.h
+./ucd-snmp/proxy.lo: ../../include/net-snmp/utilities.h
+./ucd-snmp/proxy.lo: ../../include/net-snmp/library/snmp_client.h
+./ucd-snmp/proxy.lo: ../../include/net-snmp/library/getopt.h
+./ucd-snmp/proxy.lo: ../../include/net-snmp/library/system.h
+./ucd-snmp/proxy.lo: ../../include/net-snmp/library/tools.h
+./ucd-snmp/proxy.lo: ../../include/net-snmp/library/int64.h
+./ucd-snmp/proxy.lo: ../../include/net-snmp/library/mt_support.h
+./ucd-snmp/proxy.lo: ../../include/net-snmp/library/snmp_alarm.h
+./ucd-snmp/proxy.lo: ../../include/net-snmp/library/data_list.h
+./ucd-snmp/proxy.lo: ../../include/net-snmp/library/callback.h
+./ucd-snmp/proxy.lo: ../../include/net-snmp/library/oid_stash.h
+./ucd-snmp/proxy.lo: ../../include/net-snmp/library/check_varbind.h
+./ucd-snmp/proxy.lo: ../../include/net-snmp/version.h
+./ucd-snmp/proxy.lo: ../../include/net-snmp/session_api.h
+./ucd-snmp/proxy.lo: ../../include/net-snmp/library/snmp_transport.h
+./ucd-snmp/proxy.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./ucd-snmp/proxy.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./ucd-snmp/proxy.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./ucd-snmp/proxy.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./ucd-snmp/proxy.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./ucd-snmp/proxy.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./ucd-snmp/proxy.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./ucd-snmp/proxy.lo: ../../include/net-snmp/library/ucd_compat.h
+./ucd-snmp/proxy.lo: ../../include/net-snmp/pdu_api.h
+./ucd-snmp/proxy.lo: ../../include/net-snmp/mib_api.h
+./ucd-snmp/proxy.lo: ../../include/net-snmp/library/mib.h
+./ucd-snmp/proxy.lo: ../../include/net-snmp/library/parse.h
+./ucd-snmp/proxy.lo: ../../include/net-snmp/varbind_api.h
+./ucd-snmp/proxy.lo: ../../include/net-snmp/config_api.h
+./ucd-snmp/proxy.lo: ../../include/net-snmp/library/read_config.h
+./ucd-snmp/proxy.lo: ../../include/net-snmp/library/default_store.h
+./ucd-snmp/proxy.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./ucd-snmp/proxy.lo: ../../include/net-snmp/library/snmp_enum.h
+./ucd-snmp/proxy.lo: ../../include/net-snmp/library/vacm.h
+./ucd-snmp/proxy.lo: ../../include/net-snmp/output_api.h
+./ucd-snmp/proxy.lo: ../../include/net-snmp/library/snmp_debug.h
+./ucd-snmp/proxy.lo: ../../include/net-snmp/library/snmp_logging.h
+./ucd-snmp/proxy.lo: ../../include/net-snmp/snmpv3_api.h
+./ucd-snmp/proxy.lo: ../../include/net-snmp/library/snmpv3.h
+./ucd-snmp/proxy.lo: ../../include/net-snmp/library/transform_oids.h
+./ucd-snmp/proxy.lo: ../../include/net-snmp/library/keytools.h
+./ucd-snmp/proxy.lo: ../../include/net-snmp/library/scapi.h
+./ucd-snmp/proxy.lo: ../../include/net-snmp/library/lcd_time.h
+./ucd-snmp/proxy.lo: ../../include/net-snmp/library/snmp_secmod.h
+./ucd-snmp/proxy.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./ucd-snmp/proxy.lo: ../../include/net-snmp/library/snmpusm.h
+./ucd-snmp/proxy.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./ucd-snmp/proxy.lo: ../../include/net-snmp/agent/snmp_agent.h
+./ucd-snmp/proxy.lo: ../../include/net-snmp/agent/snmp_vars.h
+./ucd-snmp/proxy.lo: ../../include/net-snmp/agent/agent_handler.h
+./ucd-snmp/proxy.lo: ../../include/net-snmp/agent/var_struct.h
+./ucd-snmp/proxy.lo: ../../include/net-snmp/agent/agent_registry.h
+./ucd-snmp/proxy.lo: ../../include/net-snmp/agent/ds_agent.h
+./ucd-snmp/proxy.lo: ../../include/net-snmp/agent/agent_read_config.h
+./ucd-snmp/proxy.lo: ../../include/net-snmp/agent/agent_trap.h
+./ucd-snmp/proxy.lo: ../../include/net-snmp/agent/all_helpers.h
+./ucd-snmp/proxy.lo: ../../include/net-snmp/agent/instance.h
+./ucd-snmp/proxy.lo: ../../include/net-snmp/agent/multiplexer.h
+./ucd-snmp/proxy.lo: ../../include/net-snmp/agent/null.h
+./ucd-snmp/proxy.lo: ../../include/net-snmp/agent/debug_handler.h
+./ucd-snmp/proxy.lo: ../../include/net-snmp/agent/old_api.h
+./ucd-snmp/proxy.lo: ../../include/net-snmp/agent/read_only.h
+./ucd-snmp/proxy.lo: ../../include/net-snmp/agent/serialize.h
+./ucd-snmp/proxy.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./ucd-snmp/proxy.lo: ../../include/net-snmp/agent/mode_end_call.h
+./ucd-snmp/proxy.lo: ../../include/net-snmp/agent/table.h
+./ucd-snmp/proxy.lo: ../../include/net-snmp/agent/table_data.h
+./ucd-snmp/proxy.lo: ../../include/net-snmp/agent/table_dataset.h
+./ucd-snmp/proxy.lo: ../../include/net-snmp/agent/table_iterator.h
+./ucd-snmp/proxy.lo: ../../include/net-snmp/agent/mib_module_config.h
+./ucd-snmp/proxy.lo: ./ucd-snmp/proxy.h
+./ucd-snmp/versioninfo.lo: ../../include/net-snmp/net-snmp-config.h
+./ucd-snmp/versioninfo.lo: ../../include/net-snmp/system/linux.h
+./ucd-snmp/versioninfo.lo: ../../include/net-snmp/system/sysv.h
+./ucd-snmp/versioninfo.lo: ../../include/net-snmp/system/generic.h
+./ucd-snmp/versioninfo.lo: ../../include/net-snmp/machine/generic.h
+./ucd-snmp/versioninfo.lo: ../../include/net-snmp/net-snmp-includes.h
+./ucd-snmp/versioninfo.lo: ../../include/net-snmp/definitions.h
+./ucd-snmp/versioninfo.lo: ../../include/net-snmp/types.h
+./ucd-snmp/versioninfo.lo: ../../include/net-snmp/library/snmp_api.h
+./ucd-snmp/versioninfo.lo: ../../include/net-snmp/library/asn1.h
+./ucd-snmp/versioninfo.lo: ../../include/net-snmp/library/snmp_impl.h
+./ucd-snmp/versioninfo.lo: ../../include/net-snmp/library/snmp.h
+./ucd-snmp/versioninfo.lo: ../../include/net-snmp/library/snmp-tc.h
+./ucd-snmp/versioninfo.lo: ../../include/net-snmp/utilities.h
+./ucd-snmp/versioninfo.lo: ../../include/net-snmp/library/snmp_client.h
+./ucd-snmp/versioninfo.lo: ../../include/net-snmp/library/getopt.h
+./ucd-snmp/versioninfo.lo: ../../include/net-snmp/library/system.h
+./ucd-snmp/versioninfo.lo: ../../include/net-snmp/library/tools.h
+./ucd-snmp/versioninfo.lo: ../../include/net-snmp/library/int64.h
+./ucd-snmp/versioninfo.lo: ../../include/net-snmp/library/mt_support.h
+./ucd-snmp/versioninfo.lo: ../../include/net-snmp/library/snmp_alarm.h
+./ucd-snmp/versioninfo.lo: ../../include/net-snmp/library/data_list.h
+./ucd-snmp/versioninfo.lo: ../../include/net-snmp/library/callback.h
+./ucd-snmp/versioninfo.lo: ../../include/net-snmp/library/oid_stash.h
+./ucd-snmp/versioninfo.lo: ../../include/net-snmp/library/check_varbind.h
+./ucd-snmp/versioninfo.lo: ../../include/net-snmp/version.h
+./ucd-snmp/versioninfo.lo: ../../include/net-snmp/session_api.h
+./ucd-snmp/versioninfo.lo: ../../include/net-snmp/library/snmp_transport.h
+./ucd-snmp/versioninfo.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./ucd-snmp/versioninfo.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./ucd-snmp/versioninfo.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./ucd-snmp/versioninfo.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./ucd-snmp/versioninfo.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./ucd-snmp/versioninfo.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./ucd-snmp/versioninfo.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./ucd-snmp/versioninfo.lo: ../../include/net-snmp/library/ucd_compat.h
+./ucd-snmp/versioninfo.lo: ../../include/net-snmp/pdu_api.h
+./ucd-snmp/versioninfo.lo: ../../include/net-snmp/mib_api.h
+./ucd-snmp/versioninfo.lo: ../../include/net-snmp/library/mib.h
+./ucd-snmp/versioninfo.lo: ../../include/net-snmp/library/parse.h
+./ucd-snmp/versioninfo.lo: ../../include/net-snmp/varbind_api.h
+./ucd-snmp/versioninfo.lo: ../../include/net-snmp/config_api.h
+./ucd-snmp/versioninfo.lo: ../../include/net-snmp/library/read_config.h
+./ucd-snmp/versioninfo.lo: ../../include/net-snmp/library/default_store.h
+./ucd-snmp/versioninfo.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./ucd-snmp/versioninfo.lo: ../../include/net-snmp/library/snmp_enum.h
+./ucd-snmp/versioninfo.lo: ../../include/net-snmp/library/vacm.h
+./ucd-snmp/versioninfo.lo: ../../include/net-snmp/output_api.h
+./ucd-snmp/versioninfo.lo: ../../include/net-snmp/library/snmp_debug.h
+./ucd-snmp/versioninfo.lo: ../../include/net-snmp/library/snmp_logging.h
+./ucd-snmp/versioninfo.lo: ../../include/net-snmp/snmpv3_api.h
+./ucd-snmp/versioninfo.lo: ../../include/net-snmp/library/snmpv3.h
+./ucd-snmp/versioninfo.lo: ../../include/net-snmp/library/transform_oids.h
+./ucd-snmp/versioninfo.lo: ../../include/net-snmp/library/keytools.h
+./ucd-snmp/versioninfo.lo: ../../include/net-snmp/library/scapi.h
+./ucd-snmp/versioninfo.lo: ../../include/net-snmp/library/lcd_time.h
+./ucd-snmp/versioninfo.lo: ../../include/net-snmp/library/snmp_secmod.h
+./ucd-snmp/versioninfo.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./ucd-snmp/versioninfo.lo: ../../include/net-snmp/library/snmpusm.h
+./ucd-snmp/versioninfo.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./ucd-snmp/versioninfo.lo: ../../include/net-snmp/agent/snmp_agent.h
+./ucd-snmp/versioninfo.lo: ../../include/net-snmp/agent/snmp_vars.h
+./ucd-snmp/versioninfo.lo: ../../include/net-snmp/agent/agent_handler.h
+./ucd-snmp/versioninfo.lo: ../../include/net-snmp/agent/var_struct.h
+./ucd-snmp/versioninfo.lo: ../../include/net-snmp/agent/agent_registry.h
+./ucd-snmp/versioninfo.lo: ../../include/net-snmp/agent/ds_agent.h
+./ucd-snmp/versioninfo.lo: ../../include/net-snmp/agent/agent_read_config.h
+./ucd-snmp/versioninfo.lo: ../../include/net-snmp/agent/agent_trap.h
+./ucd-snmp/versioninfo.lo: ../../include/net-snmp/agent/all_helpers.h
+./ucd-snmp/versioninfo.lo: ../../include/net-snmp/agent/instance.h
+./ucd-snmp/versioninfo.lo: ../../include/net-snmp/agent/multiplexer.h
+./ucd-snmp/versioninfo.lo: ../../include/net-snmp/agent/null.h
+./ucd-snmp/versioninfo.lo: ../../include/net-snmp/agent/debug_handler.h
+./ucd-snmp/versioninfo.lo: ../../include/net-snmp/agent/old_api.h
+./ucd-snmp/versioninfo.lo: ../../include/net-snmp/agent/read_only.h
+./ucd-snmp/versioninfo.lo: ../../include/net-snmp/agent/serialize.h
+./ucd-snmp/versioninfo.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./ucd-snmp/versioninfo.lo: ../../include/net-snmp/agent/mode_end_call.h
+./ucd-snmp/versioninfo.lo: ../../include/net-snmp/agent/table.h
+./ucd-snmp/versioninfo.lo: ../../include/net-snmp/agent/table_data.h
+./ucd-snmp/versioninfo.lo: ../../include/net-snmp/agent/table_dataset.h
+./ucd-snmp/versioninfo.lo: ../../include/net-snmp/agent/table_iterator.h
+./ucd-snmp/versioninfo.lo: ../../include/net-snmp/agent/mib_module_config.h
+./ucd-snmp/versioninfo.lo: struct.h ./ucd-snmp/versioninfo.h mibdefs.h
+./ucd-snmp/versioninfo.lo: util_funcs.h
+./ucd-snmp/vmstat_bsdi4.lo: ../../include/net-snmp/net-snmp-config.h
+./ucd-snmp/vmstat_bsdi4.lo: ../../include/net-snmp/system/linux.h
+./ucd-snmp/vmstat_bsdi4.lo: ../../include/net-snmp/system/sysv.h
+./ucd-snmp/vmstat_bsdi4.lo: ../../include/net-snmp/system/generic.h
+./ucd-snmp/vmstat_bsdi4.lo: ../../include/net-snmp/machine/generic.h
+./ucd-snmp/vmstat_bsdi4.lo: ../../include/net-snmp/net-snmp-includes.h
+./ucd-snmp/vmstat_bsdi4.lo: ../../include/net-snmp/definitions.h
+./ucd-snmp/vmstat_bsdi4.lo: ../../include/net-snmp/types.h
+./ucd-snmp/vmstat_bsdi4.lo: ../../include/net-snmp/library/snmp_api.h
+./ucd-snmp/vmstat_bsdi4.lo: ../../include/net-snmp/library/asn1.h
+./ucd-snmp/vmstat_bsdi4.lo: ../../include/net-snmp/library/snmp_impl.h
+./ucd-snmp/vmstat_bsdi4.lo: ../../include/net-snmp/library/snmp.h
+./ucd-snmp/vmstat_bsdi4.lo: ../../include/net-snmp/library/snmp-tc.h
+./ucd-snmp/vmstat_bsdi4.lo: ../../include/net-snmp/utilities.h
+./ucd-snmp/vmstat_bsdi4.lo: ../../include/net-snmp/library/snmp_client.h
+./ucd-snmp/vmstat_bsdi4.lo: ../../include/net-snmp/library/getopt.h
+./ucd-snmp/vmstat_bsdi4.lo: ../../include/net-snmp/library/system.h
+./ucd-snmp/vmstat_bsdi4.lo: ../../include/net-snmp/library/tools.h
+./ucd-snmp/vmstat_bsdi4.lo: ../../include/net-snmp/library/int64.h
+./ucd-snmp/vmstat_bsdi4.lo: ../../include/net-snmp/library/mt_support.h
+./ucd-snmp/vmstat_bsdi4.lo: ../../include/net-snmp/library/snmp_alarm.h
+./ucd-snmp/vmstat_bsdi4.lo: ../../include/net-snmp/library/data_list.h
+./ucd-snmp/vmstat_bsdi4.lo: ../../include/net-snmp/library/callback.h
+./ucd-snmp/vmstat_bsdi4.lo: ../../include/net-snmp/library/oid_stash.h
+./ucd-snmp/vmstat_bsdi4.lo: ../../include/net-snmp/library/check_varbind.h
+./ucd-snmp/vmstat_bsdi4.lo: ../../include/net-snmp/version.h
+./ucd-snmp/vmstat_bsdi4.lo: ../../include/net-snmp/session_api.h
+./ucd-snmp/vmstat_bsdi4.lo: ../../include/net-snmp/library/snmp_transport.h
+./ucd-snmp/vmstat_bsdi4.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./ucd-snmp/vmstat_bsdi4.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./ucd-snmp/vmstat_bsdi4.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./ucd-snmp/vmstat_bsdi4.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./ucd-snmp/vmstat_bsdi4.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./ucd-snmp/vmstat_bsdi4.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./ucd-snmp/vmstat_bsdi4.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./ucd-snmp/vmstat_bsdi4.lo: ../../include/net-snmp/library/ucd_compat.h
+./ucd-snmp/vmstat_bsdi4.lo: ../../include/net-snmp/pdu_api.h
+./ucd-snmp/vmstat_bsdi4.lo: ../../include/net-snmp/mib_api.h
+./ucd-snmp/vmstat_bsdi4.lo: ../../include/net-snmp/library/mib.h
+./ucd-snmp/vmstat_bsdi4.lo: ../../include/net-snmp/library/parse.h
+./ucd-snmp/vmstat_bsdi4.lo: ../../include/net-snmp/varbind_api.h
+./ucd-snmp/vmstat_bsdi4.lo: ../../include/net-snmp/config_api.h
+./ucd-snmp/vmstat_bsdi4.lo: ../../include/net-snmp/library/read_config.h
+./ucd-snmp/vmstat_bsdi4.lo: ../../include/net-snmp/library/default_store.h
+./ucd-snmp/vmstat_bsdi4.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./ucd-snmp/vmstat_bsdi4.lo: ../../include/net-snmp/library/snmp_enum.h
+./ucd-snmp/vmstat_bsdi4.lo: ../../include/net-snmp/library/vacm.h
+./ucd-snmp/vmstat_bsdi4.lo: ../../include/net-snmp/output_api.h
+./ucd-snmp/vmstat_bsdi4.lo: ../../include/net-snmp/library/snmp_debug.h
+./ucd-snmp/vmstat_bsdi4.lo: ../../include/net-snmp/library/snmp_logging.h
+./ucd-snmp/vmstat_bsdi4.lo: ../../include/net-snmp/snmpv3_api.h
+./ucd-snmp/vmstat_bsdi4.lo: ../../include/net-snmp/library/snmpv3.h
+./ucd-snmp/vmstat_bsdi4.lo: ../../include/net-snmp/library/transform_oids.h
+./ucd-snmp/vmstat_bsdi4.lo: ../../include/net-snmp/library/keytools.h
+./ucd-snmp/vmstat_bsdi4.lo: ../../include/net-snmp/library/scapi.h
+./ucd-snmp/vmstat_bsdi4.lo: ../../include/net-snmp/library/lcd_time.h
+./ucd-snmp/vmstat_bsdi4.lo: ../../include/net-snmp/library/snmp_secmod.h
+./ucd-snmp/vmstat_bsdi4.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./ucd-snmp/vmstat_bsdi4.lo: ../../include/net-snmp/library/snmpusm.h
+./ucd-snmp/vmstat_bsdi4.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./ucd-snmp/vmstat_bsdi4.lo: ../../include/net-snmp/agent/snmp_agent.h
+./ucd-snmp/vmstat_bsdi4.lo: ../../include/net-snmp/agent/snmp_vars.h
+./ucd-snmp/vmstat_bsdi4.lo: ../../include/net-snmp/agent/agent_handler.h
+./ucd-snmp/vmstat_bsdi4.lo: ../../include/net-snmp/agent/var_struct.h
+./ucd-snmp/vmstat_bsdi4.lo: ../../include/net-snmp/agent/agent_registry.h
+./ucd-snmp/vmstat_bsdi4.lo: ../../include/net-snmp/agent/ds_agent.h
+./ucd-snmp/vmstat_bsdi4.lo: ../../include/net-snmp/agent/agent_read_config.h
+./ucd-snmp/vmstat_bsdi4.lo: ../../include/net-snmp/agent/agent_trap.h
+./ucd-snmp/vmstat_bsdi4.lo: ../../include/net-snmp/agent/all_helpers.h
+./ucd-snmp/vmstat_bsdi4.lo: ../../include/net-snmp/agent/instance.h
+./ucd-snmp/vmstat_bsdi4.lo: ../../include/net-snmp/agent/multiplexer.h
+./ucd-snmp/vmstat_bsdi4.lo: ../../include/net-snmp/agent/null.h
+./ucd-snmp/vmstat_bsdi4.lo: ../../include/net-snmp/agent/debug_handler.h
+./ucd-snmp/vmstat_bsdi4.lo: ../../include/net-snmp/agent/old_api.h
+./ucd-snmp/vmstat_bsdi4.lo: ../../include/net-snmp/agent/read_only.h
+./ucd-snmp/vmstat_bsdi4.lo: ../../include/net-snmp/agent/serialize.h
+./ucd-snmp/vmstat_bsdi4.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./ucd-snmp/vmstat_bsdi4.lo: ../../include/net-snmp/agent/mode_end_call.h
+./ucd-snmp/vmstat_bsdi4.lo: ../../include/net-snmp/agent/table.h
+./ucd-snmp/vmstat_bsdi4.lo: ../../include/net-snmp/agent/table_data.h
+./ucd-snmp/vmstat_bsdi4.lo: ../../include/net-snmp/agent/table_dataset.h
+./ucd-snmp/vmstat_bsdi4.lo: ../../include/net-snmp/agent/table_iterator.h
+./ucd-snmp/vmstat_bsdi4.lo: ../../include/net-snmp/agent/mib_module_config.h
+./ucd-snmp/vmstat_bsdi4.lo: ../../include/net-snmp/agent/auto_nlist.h
+./ucd-snmp/vmstat_bsdi4.lo: util_funcs.h struct.h ./ucd-snmp/vmstat.h
+./ucd-snmp/vmstat_bsdi4.lo: mibdefs.h
+./ucd-snmp/vmstat.lo: ../../include/net-snmp/net-snmp-config.h
+./ucd-snmp/vmstat.lo: ../../include/net-snmp/system/linux.h
+./ucd-snmp/vmstat.lo: ../../include/net-snmp/system/sysv.h
+./ucd-snmp/vmstat.lo: ../../include/net-snmp/system/generic.h
+./ucd-snmp/vmstat.lo: ../../include/net-snmp/machine/generic.h
+./ucd-snmp/vmstat.lo: ../../include/net-snmp/net-snmp-includes.h
+./ucd-snmp/vmstat.lo: ../../include/net-snmp/definitions.h
+./ucd-snmp/vmstat.lo: ../../include/net-snmp/types.h
+./ucd-snmp/vmstat.lo: ../../include/net-snmp/library/snmp_api.h
+./ucd-snmp/vmstat.lo: ../../include/net-snmp/library/asn1.h
+./ucd-snmp/vmstat.lo: ../../include/net-snmp/library/snmp_impl.h
+./ucd-snmp/vmstat.lo: ../../include/net-snmp/library/snmp.h
+./ucd-snmp/vmstat.lo: ../../include/net-snmp/library/snmp-tc.h
+./ucd-snmp/vmstat.lo: ../../include/net-snmp/utilities.h
+./ucd-snmp/vmstat.lo: ../../include/net-snmp/library/snmp_client.h
+./ucd-snmp/vmstat.lo: ../../include/net-snmp/library/getopt.h
+./ucd-snmp/vmstat.lo: ../../include/net-snmp/library/system.h
+./ucd-snmp/vmstat.lo: ../../include/net-snmp/library/tools.h
+./ucd-snmp/vmstat.lo: ../../include/net-snmp/library/int64.h
+./ucd-snmp/vmstat.lo: ../../include/net-snmp/library/mt_support.h
+./ucd-snmp/vmstat.lo: ../../include/net-snmp/library/snmp_alarm.h
+./ucd-snmp/vmstat.lo: ../../include/net-snmp/library/data_list.h
+./ucd-snmp/vmstat.lo: ../../include/net-snmp/library/callback.h
+./ucd-snmp/vmstat.lo: ../../include/net-snmp/library/oid_stash.h
+./ucd-snmp/vmstat.lo: ../../include/net-snmp/library/check_varbind.h
+./ucd-snmp/vmstat.lo: ../../include/net-snmp/version.h
+./ucd-snmp/vmstat.lo: ../../include/net-snmp/session_api.h
+./ucd-snmp/vmstat.lo: ../../include/net-snmp/library/snmp_transport.h
+./ucd-snmp/vmstat.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./ucd-snmp/vmstat.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./ucd-snmp/vmstat.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./ucd-snmp/vmstat.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./ucd-snmp/vmstat.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./ucd-snmp/vmstat.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./ucd-snmp/vmstat.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./ucd-snmp/vmstat.lo: ../../include/net-snmp/library/ucd_compat.h
+./ucd-snmp/vmstat.lo: ../../include/net-snmp/pdu_api.h
+./ucd-snmp/vmstat.lo: ../../include/net-snmp/mib_api.h
+./ucd-snmp/vmstat.lo: ../../include/net-snmp/library/mib.h
+./ucd-snmp/vmstat.lo: ../../include/net-snmp/library/parse.h
+./ucd-snmp/vmstat.lo: ../../include/net-snmp/varbind_api.h
+./ucd-snmp/vmstat.lo: ../../include/net-snmp/config_api.h
+./ucd-snmp/vmstat.lo: ../../include/net-snmp/library/read_config.h
+./ucd-snmp/vmstat.lo: ../../include/net-snmp/library/default_store.h
+./ucd-snmp/vmstat.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./ucd-snmp/vmstat.lo: ../../include/net-snmp/library/snmp_enum.h
+./ucd-snmp/vmstat.lo: ../../include/net-snmp/library/vacm.h
+./ucd-snmp/vmstat.lo: ../../include/net-snmp/output_api.h
+./ucd-snmp/vmstat.lo: ../../include/net-snmp/library/snmp_debug.h
+./ucd-snmp/vmstat.lo: ../../include/net-snmp/library/snmp_logging.h
+./ucd-snmp/vmstat.lo: ../../include/net-snmp/snmpv3_api.h
+./ucd-snmp/vmstat.lo: ../../include/net-snmp/library/snmpv3.h
+./ucd-snmp/vmstat.lo: ../../include/net-snmp/library/transform_oids.h
+./ucd-snmp/vmstat.lo: ../../include/net-snmp/library/keytools.h
+./ucd-snmp/vmstat.lo: ../../include/net-snmp/library/scapi.h
+./ucd-snmp/vmstat.lo: ../../include/net-snmp/library/lcd_time.h
+./ucd-snmp/vmstat.lo: ../../include/net-snmp/library/snmp_secmod.h
+./ucd-snmp/vmstat.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./ucd-snmp/vmstat.lo: ../../include/net-snmp/library/snmpusm.h
+./ucd-snmp/vmstat.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./ucd-snmp/vmstat.lo: ../../include/net-snmp/agent/snmp_agent.h
+./ucd-snmp/vmstat.lo: ../../include/net-snmp/agent/snmp_vars.h
+./ucd-snmp/vmstat.lo: ../../include/net-snmp/agent/agent_handler.h
+./ucd-snmp/vmstat.lo: ../../include/net-snmp/agent/var_struct.h
+./ucd-snmp/vmstat.lo: ../../include/net-snmp/agent/agent_registry.h
+./ucd-snmp/vmstat.lo: ../../include/net-snmp/agent/ds_agent.h
+./ucd-snmp/vmstat.lo: ../../include/net-snmp/agent/agent_read_config.h
+./ucd-snmp/vmstat.lo: ../../include/net-snmp/agent/agent_trap.h
+./ucd-snmp/vmstat.lo: ../../include/net-snmp/agent/all_helpers.h
+./ucd-snmp/vmstat.lo: ../../include/net-snmp/agent/instance.h
+./ucd-snmp/vmstat.lo: ../../include/net-snmp/agent/multiplexer.h
+./ucd-snmp/vmstat.lo: ../../include/net-snmp/agent/null.h
+./ucd-snmp/vmstat.lo: ../../include/net-snmp/agent/debug_handler.h
+./ucd-snmp/vmstat.lo: ../../include/net-snmp/agent/old_api.h
+./ucd-snmp/vmstat.lo: ../../include/net-snmp/agent/read_only.h
+./ucd-snmp/vmstat.lo: ../../include/net-snmp/agent/serialize.h
+./ucd-snmp/vmstat.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./ucd-snmp/vmstat.lo: ../../include/net-snmp/agent/mode_end_call.h
+./ucd-snmp/vmstat.lo: ../../include/net-snmp/agent/table.h
+./ucd-snmp/vmstat.lo: ../../include/net-snmp/agent/table_data.h
+./ucd-snmp/vmstat.lo: ../../include/net-snmp/agent/table_dataset.h
+./ucd-snmp/vmstat.lo: ../../include/net-snmp/agent/table_iterator.h
+./ucd-snmp/vmstat.lo: ../../include/net-snmp/agent/mib_module_config.h
+./ucd-snmp/vmstat.lo: ../../include/net-snmp/agent/auto_nlist.h mibdefs.h
+./ucd-snmp/vmstat.lo: struct.h util_funcs.h ./ucd-snmp/vmstat.h
+./ucd-snmp/vmstat_dynix.lo: ../../include/net-snmp/net-snmp-config.h
+./ucd-snmp/vmstat_dynix.lo: ../../include/net-snmp/system/linux.h
+./ucd-snmp/vmstat_dynix.lo: ../../include/net-snmp/system/sysv.h
+./ucd-snmp/vmstat_dynix.lo: ../../include/net-snmp/system/generic.h
+./ucd-snmp/vmstat_dynix.lo: ../../include/net-snmp/machine/generic.h
+./ucd-snmp/vmstat_dynix.lo: ../../include/net-snmp/net-snmp-includes.h
+./ucd-snmp/vmstat_dynix.lo: ../../include/net-snmp/definitions.h
+./ucd-snmp/vmstat_dynix.lo: ../../include/net-snmp/types.h
+./ucd-snmp/vmstat_dynix.lo: ../../include/net-snmp/library/snmp_api.h
+./ucd-snmp/vmstat_dynix.lo: ../../include/net-snmp/library/asn1.h
+./ucd-snmp/vmstat_dynix.lo: ../../include/net-snmp/library/snmp_impl.h
+./ucd-snmp/vmstat_dynix.lo: ../../include/net-snmp/library/snmp.h
+./ucd-snmp/vmstat_dynix.lo: ../../include/net-snmp/library/snmp-tc.h
+./ucd-snmp/vmstat_dynix.lo: ../../include/net-snmp/utilities.h
+./ucd-snmp/vmstat_dynix.lo: ../../include/net-snmp/library/snmp_client.h
+./ucd-snmp/vmstat_dynix.lo: ../../include/net-snmp/library/getopt.h
+./ucd-snmp/vmstat_dynix.lo: ../../include/net-snmp/library/system.h
+./ucd-snmp/vmstat_dynix.lo: ../../include/net-snmp/library/tools.h
+./ucd-snmp/vmstat_dynix.lo: ../../include/net-snmp/library/int64.h
+./ucd-snmp/vmstat_dynix.lo: ../../include/net-snmp/library/mt_support.h
+./ucd-snmp/vmstat_dynix.lo: ../../include/net-snmp/library/snmp_alarm.h
+./ucd-snmp/vmstat_dynix.lo: ../../include/net-snmp/library/data_list.h
+./ucd-snmp/vmstat_dynix.lo: ../../include/net-snmp/library/callback.h
+./ucd-snmp/vmstat_dynix.lo: ../../include/net-snmp/library/oid_stash.h
+./ucd-snmp/vmstat_dynix.lo: ../../include/net-snmp/library/check_varbind.h
+./ucd-snmp/vmstat_dynix.lo: ../../include/net-snmp/version.h
+./ucd-snmp/vmstat_dynix.lo: ../../include/net-snmp/session_api.h
+./ucd-snmp/vmstat_dynix.lo: ../../include/net-snmp/library/snmp_transport.h
+./ucd-snmp/vmstat_dynix.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./ucd-snmp/vmstat_dynix.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./ucd-snmp/vmstat_dynix.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./ucd-snmp/vmstat_dynix.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./ucd-snmp/vmstat_dynix.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./ucd-snmp/vmstat_dynix.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./ucd-snmp/vmstat_dynix.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./ucd-snmp/vmstat_dynix.lo: ../../include/net-snmp/library/ucd_compat.h
+./ucd-snmp/vmstat_dynix.lo: ../../include/net-snmp/pdu_api.h
+./ucd-snmp/vmstat_dynix.lo: ../../include/net-snmp/mib_api.h
+./ucd-snmp/vmstat_dynix.lo: ../../include/net-snmp/library/mib.h
+./ucd-snmp/vmstat_dynix.lo: ../../include/net-snmp/library/parse.h
+./ucd-snmp/vmstat_dynix.lo: ../../include/net-snmp/varbind_api.h
+./ucd-snmp/vmstat_dynix.lo: ../../include/net-snmp/config_api.h
+./ucd-snmp/vmstat_dynix.lo: ../../include/net-snmp/library/read_config.h
+./ucd-snmp/vmstat_dynix.lo: ../../include/net-snmp/library/default_store.h
+./ucd-snmp/vmstat_dynix.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./ucd-snmp/vmstat_dynix.lo: ../../include/net-snmp/library/snmp_enum.h
+./ucd-snmp/vmstat_dynix.lo: ../../include/net-snmp/library/vacm.h
+./ucd-snmp/vmstat_dynix.lo: ../../include/net-snmp/output_api.h
+./ucd-snmp/vmstat_dynix.lo: ../../include/net-snmp/library/snmp_debug.h
+./ucd-snmp/vmstat_dynix.lo: ../../include/net-snmp/library/snmp_logging.h
+./ucd-snmp/vmstat_dynix.lo: ../../include/net-snmp/snmpv3_api.h
+./ucd-snmp/vmstat_dynix.lo: ../../include/net-snmp/library/snmpv3.h
+./ucd-snmp/vmstat_dynix.lo: ../../include/net-snmp/library/transform_oids.h
+./ucd-snmp/vmstat_dynix.lo: ../../include/net-snmp/library/keytools.h
+./ucd-snmp/vmstat_dynix.lo: ../../include/net-snmp/library/scapi.h
+./ucd-snmp/vmstat_dynix.lo: ../../include/net-snmp/library/lcd_time.h
+./ucd-snmp/vmstat_dynix.lo: ../../include/net-snmp/library/snmp_secmod.h
+./ucd-snmp/vmstat_dynix.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./ucd-snmp/vmstat_dynix.lo: ../../include/net-snmp/library/snmpusm.h
+./ucd-snmp/vmstat_dynix.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./ucd-snmp/vmstat_dynix.lo: ../../include/net-snmp/agent/snmp_agent.h
+./ucd-snmp/vmstat_dynix.lo: ../../include/net-snmp/agent/snmp_vars.h
+./ucd-snmp/vmstat_dynix.lo: ../../include/net-snmp/agent/agent_handler.h
+./ucd-snmp/vmstat_dynix.lo: ../../include/net-snmp/agent/var_struct.h
+./ucd-snmp/vmstat_dynix.lo: ../../include/net-snmp/agent/agent_registry.h
+./ucd-snmp/vmstat_dynix.lo: ../../include/net-snmp/agent/ds_agent.h
+./ucd-snmp/vmstat_dynix.lo: ../../include/net-snmp/agent/agent_read_config.h
+./ucd-snmp/vmstat_dynix.lo: ../../include/net-snmp/agent/agent_trap.h
+./ucd-snmp/vmstat_dynix.lo: ../../include/net-snmp/agent/all_helpers.h
+./ucd-snmp/vmstat_dynix.lo: ../../include/net-snmp/agent/instance.h
+./ucd-snmp/vmstat_dynix.lo: ../../include/net-snmp/agent/multiplexer.h
+./ucd-snmp/vmstat_dynix.lo: ../../include/net-snmp/agent/null.h
+./ucd-snmp/vmstat_dynix.lo: ../../include/net-snmp/agent/debug_handler.h
+./ucd-snmp/vmstat_dynix.lo: ../../include/net-snmp/agent/old_api.h
+./ucd-snmp/vmstat_dynix.lo: ../../include/net-snmp/agent/read_only.h
+./ucd-snmp/vmstat_dynix.lo: ../../include/net-snmp/agent/serialize.h
+./ucd-snmp/vmstat_dynix.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./ucd-snmp/vmstat_dynix.lo: ../../include/net-snmp/agent/mode_end_call.h
+./ucd-snmp/vmstat_dynix.lo: ../../include/net-snmp/agent/table.h
+./ucd-snmp/vmstat_dynix.lo: ../../include/net-snmp/agent/table_data.h
+./ucd-snmp/vmstat_dynix.lo: ../../include/net-snmp/agent/table_dataset.h
+./ucd-snmp/vmstat_dynix.lo: ../../include/net-snmp/agent/table_iterator.h
+./ucd-snmp/vmstat_dynix.lo: ../../include/net-snmp/agent/mib_module_config.h
+./ucd-snmp/vmstat_dynix.lo: mibdefs.h util_funcs.h struct.h
+./ucd-snmp/vmstat_dynix.lo: ./ucd-snmp/vmstat.h ./ucd-snmp/vmstat_dynix.h
+./ucd-snmp/vmstat_freebsd2.lo: ../../include/net-snmp/net-snmp-config.h
+./ucd-snmp/vmstat_freebsd2.lo: ../../include/net-snmp/system/linux.h
+./ucd-snmp/vmstat_freebsd2.lo: ../../include/net-snmp/system/sysv.h
+./ucd-snmp/vmstat_freebsd2.lo: ../../include/net-snmp/system/generic.h
+./ucd-snmp/vmstat_freebsd2.lo: ../../include/net-snmp/machine/generic.h
+./ucd-snmp/vmstat_freebsd2.lo: ../../include/net-snmp/net-snmp-includes.h
+./ucd-snmp/vmstat_freebsd2.lo: ../../include/net-snmp/definitions.h
+./ucd-snmp/vmstat_freebsd2.lo: ../../include/net-snmp/types.h
+./ucd-snmp/vmstat_freebsd2.lo: ../../include/net-snmp/library/snmp_api.h
+./ucd-snmp/vmstat_freebsd2.lo: ../../include/net-snmp/library/asn1.h
+./ucd-snmp/vmstat_freebsd2.lo: ../../include/net-snmp/library/snmp_impl.h
+./ucd-snmp/vmstat_freebsd2.lo: ../../include/net-snmp/library/snmp.h
+./ucd-snmp/vmstat_freebsd2.lo: ../../include/net-snmp/library/snmp-tc.h
+./ucd-snmp/vmstat_freebsd2.lo: ../../include/net-snmp/utilities.h
+./ucd-snmp/vmstat_freebsd2.lo: ../../include/net-snmp/library/snmp_client.h
+./ucd-snmp/vmstat_freebsd2.lo: ../../include/net-snmp/library/getopt.h
+./ucd-snmp/vmstat_freebsd2.lo: ../../include/net-snmp/library/system.h
+./ucd-snmp/vmstat_freebsd2.lo: ../../include/net-snmp/library/tools.h
+./ucd-snmp/vmstat_freebsd2.lo: ../../include/net-snmp/library/int64.h
+./ucd-snmp/vmstat_freebsd2.lo: ../../include/net-snmp/library/mt_support.h
+./ucd-snmp/vmstat_freebsd2.lo: ../../include/net-snmp/library/snmp_alarm.h
+./ucd-snmp/vmstat_freebsd2.lo: ../../include/net-snmp/library/data_list.h
+./ucd-snmp/vmstat_freebsd2.lo: ../../include/net-snmp/library/callback.h
+./ucd-snmp/vmstat_freebsd2.lo: ../../include/net-snmp/library/oid_stash.h
+./ucd-snmp/vmstat_freebsd2.lo: ../../include/net-snmp/library/check_varbind.h
+./ucd-snmp/vmstat_freebsd2.lo: ../../include/net-snmp/version.h
+./ucd-snmp/vmstat_freebsd2.lo: ../../include/net-snmp/session_api.h
+./ucd-snmp/vmstat_freebsd2.lo: ../../include/net-snmp/library/snmp_transport.h
+./ucd-snmp/vmstat_freebsd2.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./ucd-snmp/vmstat_freebsd2.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./ucd-snmp/vmstat_freebsd2.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./ucd-snmp/vmstat_freebsd2.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./ucd-snmp/vmstat_freebsd2.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./ucd-snmp/vmstat_freebsd2.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./ucd-snmp/vmstat_freebsd2.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./ucd-snmp/vmstat_freebsd2.lo: ../../include/net-snmp/library/ucd_compat.h
+./ucd-snmp/vmstat_freebsd2.lo: ../../include/net-snmp/pdu_api.h
+./ucd-snmp/vmstat_freebsd2.lo: ../../include/net-snmp/mib_api.h
+./ucd-snmp/vmstat_freebsd2.lo: ../../include/net-snmp/library/mib.h
+./ucd-snmp/vmstat_freebsd2.lo: ../../include/net-snmp/library/parse.h
+./ucd-snmp/vmstat_freebsd2.lo: ../../include/net-snmp/varbind_api.h
+./ucd-snmp/vmstat_freebsd2.lo: ../../include/net-snmp/config_api.h
+./ucd-snmp/vmstat_freebsd2.lo: ../../include/net-snmp/library/read_config.h
+./ucd-snmp/vmstat_freebsd2.lo: ../../include/net-snmp/library/default_store.h
+./ucd-snmp/vmstat_freebsd2.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./ucd-snmp/vmstat_freebsd2.lo: ../../include/net-snmp/library/snmp_enum.h
+./ucd-snmp/vmstat_freebsd2.lo: ../../include/net-snmp/library/vacm.h
+./ucd-snmp/vmstat_freebsd2.lo: ../../include/net-snmp/output_api.h
+./ucd-snmp/vmstat_freebsd2.lo: ../../include/net-snmp/library/snmp_debug.h
+./ucd-snmp/vmstat_freebsd2.lo: ../../include/net-snmp/library/snmp_logging.h
+./ucd-snmp/vmstat_freebsd2.lo: ../../include/net-snmp/snmpv3_api.h
+./ucd-snmp/vmstat_freebsd2.lo: ../../include/net-snmp/library/snmpv3.h
+./ucd-snmp/vmstat_freebsd2.lo: ../../include/net-snmp/library/transform_oids.h
+./ucd-snmp/vmstat_freebsd2.lo: ../../include/net-snmp/library/keytools.h
+./ucd-snmp/vmstat_freebsd2.lo: ../../include/net-snmp/library/scapi.h
+./ucd-snmp/vmstat_freebsd2.lo: ../../include/net-snmp/library/lcd_time.h
+./ucd-snmp/vmstat_freebsd2.lo: ../../include/net-snmp/library/snmp_secmod.h
+./ucd-snmp/vmstat_freebsd2.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./ucd-snmp/vmstat_freebsd2.lo: ../../include/net-snmp/library/snmpusm.h
+./ucd-snmp/vmstat_freebsd2.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./ucd-snmp/vmstat_freebsd2.lo: ../../include/net-snmp/agent/snmp_agent.h
+./ucd-snmp/vmstat_freebsd2.lo: ../../include/net-snmp/agent/snmp_vars.h
+./ucd-snmp/vmstat_freebsd2.lo: ../../include/net-snmp/agent/agent_handler.h
+./ucd-snmp/vmstat_freebsd2.lo: ../../include/net-snmp/agent/var_struct.h
+./ucd-snmp/vmstat_freebsd2.lo: ../../include/net-snmp/agent/agent_registry.h
+./ucd-snmp/vmstat_freebsd2.lo: ../../include/net-snmp/agent/ds_agent.h
+./ucd-snmp/vmstat_freebsd2.lo: ../../include/net-snmp/agent/agent_read_config.h
+./ucd-snmp/vmstat_freebsd2.lo: ../../include/net-snmp/agent/agent_trap.h
+./ucd-snmp/vmstat_freebsd2.lo: ../../include/net-snmp/agent/all_helpers.h
+./ucd-snmp/vmstat_freebsd2.lo: ../../include/net-snmp/agent/instance.h
+./ucd-snmp/vmstat_freebsd2.lo: ../../include/net-snmp/agent/multiplexer.h
+./ucd-snmp/vmstat_freebsd2.lo: ../../include/net-snmp/agent/null.h
+./ucd-snmp/vmstat_freebsd2.lo: ../../include/net-snmp/agent/debug_handler.h
+./ucd-snmp/vmstat_freebsd2.lo: ../../include/net-snmp/agent/old_api.h
+./ucd-snmp/vmstat_freebsd2.lo: ../../include/net-snmp/agent/read_only.h
+./ucd-snmp/vmstat_freebsd2.lo: ../../include/net-snmp/agent/serialize.h
+./ucd-snmp/vmstat_freebsd2.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./ucd-snmp/vmstat_freebsd2.lo: ../../include/net-snmp/agent/mode_end_call.h
+./ucd-snmp/vmstat_freebsd2.lo: ../../include/net-snmp/agent/table.h
+./ucd-snmp/vmstat_freebsd2.lo: ../../include/net-snmp/agent/table_data.h
+./ucd-snmp/vmstat_freebsd2.lo: ../../include/net-snmp/agent/table_dataset.h
+./ucd-snmp/vmstat_freebsd2.lo: ../../include/net-snmp/agent/table_iterator.h
+./ucd-snmp/vmstat_freebsd2.lo: ../../include/net-snmp/agent/mib_module_config.h
+./ucd-snmp/vmstat_freebsd2.lo: ../../include/net-snmp/agent/auto_nlist.h
+./ucd-snmp/vmstat_freebsd2.lo: util_funcs.h struct.h ./ucd-snmp/vmstat.h
+./ucd-snmp/vmstat_freebsd2.lo: mibdefs.h ./ucd-snmp/vmstat_freebsd2.h
+./ucd-snmp/vmstat_hpux.lo: ../../include/net-snmp/net-snmp-config.h
+./ucd-snmp/vmstat_hpux.lo: ../../include/net-snmp/system/linux.h
+./ucd-snmp/vmstat_hpux.lo: ../../include/net-snmp/system/sysv.h
+./ucd-snmp/vmstat_hpux.lo: ../../include/net-snmp/system/generic.h
+./ucd-snmp/vmstat_hpux.lo: ../../include/net-snmp/machine/generic.h
+./ucd-snmp/vmstat_hpux.lo: ../../include/net-snmp/net-snmp-includes.h
+./ucd-snmp/vmstat_hpux.lo: ../../include/net-snmp/definitions.h
+./ucd-snmp/vmstat_hpux.lo: ../../include/net-snmp/types.h
+./ucd-snmp/vmstat_hpux.lo: ../../include/net-snmp/library/snmp_api.h
+./ucd-snmp/vmstat_hpux.lo: ../../include/net-snmp/library/asn1.h
+./ucd-snmp/vmstat_hpux.lo: ../../include/net-snmp/library/snmp_impl.h
+./ucd-snmp/vmstat_hpux.lo: ../../include/net-snmp/library/snmp.h
+./ucd-snmp/vmstat_hpux.lo: ../../include/net-snmp/library/snmp-tc.h
+./ucd-snmp/vmstat_hpux.lo: ../../include/net-snmp/utilities.h
+./ucd-snmp/vmstat_hpux.lo: ../../include/net-snmp/library/snmp_client.h
+./ucd-snmp/vmstat_hpux.lo: ../../include/net-snmp/library/getopt.h
+./ucd-snmp/vmstat_hpux.lo: ../../include/net-snmp/library/system.h
+./ucd-snmp/vmstat_hpux.lo: ../../include/net-snmp/library/tools.h
+./ucd-snmp/vmstat_hpux.lo: ../../include/net-snmp/library/int64.h
+./ucd-snmp/vmstat_hpux.lo: ../../include/net-snmp/library/mt_support.h
+./ucd-snmp/vmstat_hpux.lo: ../../include/net-snmp/library/snmp_alarm.h
+./ucd-snmp/vmstat_hpux.lo: ../../include/net-snmp/library/data_list.h
+./ucd-snmp/vmstat_hpux.lo: ../../include/net-snmp/library/callback.h
+./ucd-snmp/vmstat_hpux.lo: ../../include/net-snmp/library/oid_stash.h
+./ucd-snmp/vmstat_hpux.lo: ../../include/net-snmp/library/check_varbind.h
+./ucd-snmp/vmstat_hpux.lo: ../../include/net-snmp/version.h
+./ucd-snmp/vmstat_hpux.lo: ../../include/net-snmp/session_api.h
+./ucd-snmp/vmstat_hpux.lo: ../../include/net-snmp/library/snmp_transport.h
+./ucd-snmp/vmstat_hpux.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./ucd-snmp/vmstat_hpux.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./ucd-snmp/vmstat_hpux.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./ucd-snmp/vmstat_hpux.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./ucd-snmp/vmstat_hpux.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./ucd-snmp/vmstat_hpux.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./ucd-snmp/vmstat_hpux.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./ucd-snmp/vmstat_hpux.lo: ../../include/net-snmp/library/ucd_compat.h
+./ucd-snmp/vmstat_hpux.lo: ../../include/net-snmp/pdu_api.h
+./ucd-snmp/vmstat_hpux.lo: ../../include/net-snmp/mib_api.h
+./ucd-snmp/vmstat_hpux.lo: ../../include/net-snmp/library/mib.h
+./ucd-snmp/vmstat_hpux.lo: ../../include/net-snmp/library/parse.h
+./ucd-snmp/vmstat_hpux.lo: ../../include/net-snmp/varbind_api.h
+./ucd-snmp/vmstat_hpux.lo: ../../include/net-snmp/config_api.h
+./ucd-snmp/vmstat_hpux.lo: ../../include/net-snmp/library/read_config.h
+./ucd-snmp/vmstat_hpux.lo: ../../include/net-snmp/library/default_store.h
+./ucd-snmp/vmstat_hpux.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./ucd-snmp/vmstat_hpux.lo: ../../include/net-snmp/library/snmp_enum.h
+./ucd-snmp/vmstat_hpux.lo: ../../include/net-snmp/library/vacm.h
+./ucd-snmp/vmstat_hpux.lo: ../../include/net-snmp/output_api.h
+./ucd-snmp/vmstat_hpux.lo: ../../include/net-snmp/library/snmp_debug.h
+./ucd-snmp/vmstat_hpux.lo: ../../include/net-snmp/library/snmp_logging.h
+./ucd-snmp/vmstat_hpux.lo: ../../include/net-snmp/snmpv3_api.h
+./ucd-snmp/vmstat_hpux.lo: ../../include/net-snmp/library/snmpv3.h
+./ucd-snmp/vmstat_hpux.lo: ../../include/net-snmp/library/transform_oids.h
+./ucd-snmp/vmstat_hpux.lo: ../../include/net-snmp/library/keytools.h
+./ucd-snmp/vmstat_hpux.lo: ../../include/net-snmp/library/scapi.h
+./ucd-snmp/vmstat_hpux.lo: ../../include/net-snmp/library/lcd_time.h
+./ucd-snmp/vmstat_hpux.lo: ../../include/net-snmp/library/snmp_secmod.h
+./ucd-snmp/vmstat_hpux.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./ucd-snmp/vmstat_hpux.lo: ../../include/net-snmp/library/snmpusm.h
+./ucd-snmp/vmstat_hpux.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./ucd-snmp/vmstat_hpux.lo: ../../include/net-snmp/agent/snmp_agent.h
+./ucd-snmp/vmstat_hpux.lo: ../../include/net-snmp/agent/snmp_vars.h
+./ucd-snmp/vmstat_hpux.lo: ../../include/net-snmp/agent/agent_handler.h
+./ucd-snmp/vmstat_hpux.lo: ../../include/net-snmp/agent/var_struct.h
+./ucd-snmp/vmstat_hpux.lo: ../../include/net-snmp/agent/agent_registry.h
+./ucd-snmp/vmstat_hpux.lo: ../../include/net-snmp/agent/ds_agent.h
+./ucd-snmp/vmstat_hpux.lo: ../../include/net-snmp/agent/agent_read_config.h
+./ucd-snmp/vmstat_hpux.lo: ../../include/net-snmp/agent/agent_trap.h
+./ucd-snmp/vmstat_hpux.lo: ../../include/net-snmp/agent/all_helpers.h
+./ucd-snmp/vmstat_hpux.lo: ../../include/net-snmp/agent/instance.h
+./ucd-snmp/vmstat_hpux.lo: ../../include/net-snmp/agent/multiplexer.h
+./ucd-snmp/vmstat_hpux.lo: ../../include/net-snmp/agent/null.h
+./ucd-snmp/vmstat_hpux.lo: ../../include/net-snmp/agent/debug_handler.h
+./ucd-snmp/vmstat_hpux.lo: ../../include/net-snmp/agent/old_api.h
+./ucd-snmp/vmstat_hpux.lo: ../../include/net-snmp/agent/read_only.h
+./ucd-snmp/vmstat_hpux.lo: ../../include/net-snmp/agent/serialize.h
+./ucd-snmp/vmstat_hpux.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./ucd-snmp/vmstat_hpux.lo: ../../include/net-snmp/agent/mode_end_call.h
+./ucd-snmp/vmstat_hpux.lo: ../../include/net-snmp/agent/table.h
+./ucd-snmp/vmstat_hpux.lo: ../../include/net-snmp/agent/table_data.h
+./ucd-snmp/vmstat_hpux.lo: ../../include/net-snmp/agent/table_dataset.h
+./ucd-snmp/vmstat_hpux.lo: ../../include/net-snmp/agent/table_iterator.h
+./ucd-snmp/vmstat_hpux.lo: ../../include/net-snmp/agent/mib_module_config.h
+./ucd-snmp/vmstat_hpux.lo: mibdefs.h util_funcs.h struct.h
+./ucd-snmp/vmstat_hpux.lo: ./ucd-snmp/vmstat.h ./ucd-snmp/vmstat_hpux.h
+./ucd-snmp/vmstat_netbsd1.lo: ../../include/net-snmp/net-snmp-config.h
+./ucd-snmp/vmstat_netbsd1.lo: ../../include/net-snmp/system/linux.h
+./ucd-snmp/vmstat_netbsd1.lo: ../../include/net-snmp/system/sysv.h
+./ucd-snmp/vmstat_netbsd1.lo: ../../include/net-snmp/system/generic.h
+./ucd-snmp/vmstat_netbsd1.lo: ../../include/net-snmp/machine/generic.h
+./ucd-snmp/vmstat_netbsd1.lo: ../../include/net-snmp/net-snmp-includes.h
+./ucd-snmp/vmstat_netbsd1.lo: ../../include/net-snmp/definitions.h
+./ucd-snmp/vmstat_netbsd1.lo: ../../include/net-snmp/types.h
+./ucd-snmp/vmstat_netbsd1.lo: ../../include/net-snmp/library/snmp_api.h
+./ucd-snmp/vmstat_netbsd1.lo: ../../include/net-snmp/library/asn1.h
+./ucd-snmp/vmstat_netbsd1.lo: ../../include/net-snmp/library/snmp_impl.h
+./ucd-snmp/vmstat_netbsd1.lo: ../../include/net-snmp/library/snmp.h
+./ucd-snmp/vmstat_netbsd1.lo: ../../include/net-snmp/library/snmp-tc.h
+./ucd-snmp/vmstat_netbsd1.lo: ../../include/net-snmp/utilities.h
+./ucd-snmp/vmstat_netbsd1.lo: ../../include/net-snmp/library/snmp_client.h
+./ucd-snmp/vmstat_netbsd1.lo: ../../include/net-snmp/library/getopt.h
+./ucd-snmp/vmstat_netbsd1.lo: ../../include/net-snmp/library/system.h
+./ucd-snmp/vmstat_netbsd1.lo: ../../include/net-snmp/library/tools.h
+./ucd-snmp/vmstat_netbsd1.lo: ../../include/net-snmp/library/int64.h
+./ucd-snmp/vmstat_netbsd1.lo: ../../include/net-snmp/library/mt_support.h
+./ucd-snmp/vmstat_netbsd1.lo: ../../include/net-snmp/library/snmp_alarm.h
+./ucd-snmp/vmstat_netbsd1.lo: ../../include/net-snmp/library/data_list.h
+./ucd-snmp/vmstat_netbsd1.lo: ../../include/net-snmp/library/callback.h
+./ucd-snmp/vmstat_netbsd1.lo: ../../include/net-snmp/library/oid_stash.h
+./ucd-snmp/vmstat_netbsd1.lo: ../../include/net-snmp/library/check_varbind.h
+./ucd-snmp/vmstat_netbsd1.lo: ../../include/net-snmp/version.h
+./ucd-snmp/vmstat_netbsd1.lo: ../../include/net-snmp/session_api.h
+./ucd-snmp/vmstat_netbsd1.lo: ../../include/net-snmp/library/snmp_transport.h
+./ucd-snmp/vmstat_netbsd1.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./ucd-snmp/vmstat_netbsd1.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./ucd-snmp/vmstat_netbsd1.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./ucd-snmp/vmstat_netbsd1.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./ucd-snmp/vmstat_netbsd1.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./ucd-snmp/vmstat_netbsd1.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./ucd-snmp/vmstat_netbsd1.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./ucd-snmp/vmstat_netbsd1.lo: ../../include/net-snmp/library/ucd_compat.h
+./ucd-snmp/vmstat_netbsd1.lo: ../../include/net-snmp/pdu_api.h
+./ucd-snmp/vmstat_netbsd1.lo: ../../include/net-snmp/mib_api.h
+./ucd-snmp/vmstat_netbsd1.lo: ../../include/net-snmp/library/mib.h
+./ucd-snmp/vmstat_netbsd1.lo: ../../include/net-snmp/library/parse.h
+./ucd-snmp/vmstat_netbsd1.lo: ../../include/net-snmp/varbind_api.h
+./ucd-snmp/vmstat_netbsd1.lo: ../../include/net-snmp/config_api.h
+./ucd-snmp/vmstat_netbsd1.lo: ../../include/net-snmp/library/read_config.h
+./ucd-snmp/vmstat_netbsd1.lo: ../../include/net-snmp/library/default_store.h
+./ucd-snmp/vmstat_netbsd1.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./ucd-snmp/vmstat_netbsd1.lo: ../../include/net-snmp/library/snmp_enum.h
+./ucd-snmp/vmstat_netbsd1.lo: ../../include/net-snmp/library/vacm.h
+./ucd-snmp/vmstat_netbsd1.lo: ../../include/net-snmp/output_api.h
+./ucd-snmp/vmstat_netbsd1.lo: ../../include/net-snmp/library/snmp_debug.h
+./ucd-snmp/vmstat_netbsd1.lo: ../../include/net-snmp/library/snmp_logging.h
+./ucd-snmp/vmstat_netbsd1.lo: ../../include/net-snmp/snmpv3_api.h
+./ucd-snmp/vmstat_netbsd1.lo: ../../include/net-snmp/library/snmpv3.h
+./ucd-snmp/vmstat_netbsd1.lo: ../../include/net-snmp/library/transform_oids.h
+./ucd-snmp/vmstat_netbsd1.lo: ../../include/net-snmp/library/keytools.h
+./ucd-snmp/vmstat_netbsd1.lo: ../../include/net-snmp/library/scapi.h
+./ucd-snmp/vmstat_netbsd1.lo: ../../include/net-snmp/library/lcd_time.h
+./ucd-snmp/vmstat_netbsd1.lo: ../../include/net-snmp/library/snmp_secmod.h
+./ucd-snmp/vmstat_netbsd1.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./ucd-snmp/vmstat_netbsd1.lo: ../../include/net-snmp/library/snmpusm.h
+./ucd-snmp/vmstat_netbsd1.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./ucd-snmp/vmstat_netbsd1.lo: ../../include/net-snmp/agent/snmp_agent.h
+./ucd-snmp/vmstat_netbsd1.lo: ../../include/net-snmp/agent/snmp_vars.h
+./ucd-snmp/vmstat_netbsd1.lo: ../../include/net-snmp/agent/agent_handler.h
+./ucd-snmp/vmstat_netbsd1.lo: ../../include/net-snmp/agent/var_struct.h
+./ucd-snmp/vmstat_netbsd1.lo: ../../include/net-snmp/agent/agent_registry.h
+./ucd-snmp/vmstat_netbsd1.lo: ../../include/net-snmp/agent/ds_agent.h
+./ucd-snmp/vmstat_netbsd1.lo: ../../include/net-snmp/agent/agent_read_config.h
+./ucd-snmp/vmstat_netbsd1.lo: ../../include/net-snmp/agent/agent_trap.h
+./ucd-snmp/vmstat_netbsd1.lo: ../../include/net-snmp/agent/all_helpers.h
+./ucd-snmp/vmstat_netbsd1.lo: ../../include/net-snmp/agent/instance.h
+./ucd-snmp/vmstat_netbsd1.lo: ../../include/net-snmp/agent/multiplexer.h
+./ucd-snmp/vmstat_netbsd1.lo: ../../include/net-snmp/agent/null.h
+./ucd-snmp/vmstat_netbsd1.lo: ../../include/net-snmp/agent/debug_handler.h
+./ucd-snmp/vmstat_netbsd1.lo: ../../include/net-snmp/agent/old_api.h
+./ucd-snmp/vmstat_netbsd1.lo: ../../include/net-snmp/agent/read_only.h
+./ucd-snmp/vmstat_netbsd1.lo: ../../include/net-snmp/agent/serialize.h
+./ucd-snmp/vmstat_netbsd1.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./ucd-snmp/vmstat_netbsd1.lo: ../../include/net-snmp/agent/mode_end_call.h
+./ucd-snmp/vmstat_netbsd1.lo: ../../include/net-snmp/agent/table.h
+./ucd-snmp/vmstat_netbsd1.lo: ../../include/net-snmp/agent/table_data.h
+./ucd-snmp/vmstat_netbsd1.lo: ../../include/net-snmp/agent/table_dataset.h
+./ucd-snmp/vmstat_netbsd1.lo: ../../include/net-snmp/agent/table_iterator.h
+./ucd-snmp/vmstat_netbsd1.lo: ../../include/net-snmp/agent/mib_module_config.h
+./ucd-snmp/vmstat_netbsd1.lo: ../../include/net-snmp/agent/auto_nlist.h
+./ucd-snmp/vmstat_netbsd1.lo: util_funcs.h struct.h ./ucd-snmp/vmstat.h
+./ucd-snmp/vmstat_netbsd1.lo: mibdefs.h
+./ucd-snmp/vmstat_solaris2.lo: ../../include/net-snmp/net-snmp-config.h
+./ucd-snmp/vmstat_solaris2.lo: ../../include/net-snmp/system/linux.h
+./ucd-snmp/vmstat_solaris2.lo: ../../include/net-snmp/system/sysv.h
+./ucd-snmp/vmstat_solaris2.lo: ../../include/net-snmp/system/generic.h
+./ucd-snmp/vmstat_solaris2.lo: ../../include/net-snmp/machine/generic.h
+./ucd-snmp/vmstat_solaris2.lo: ../../include/net-snmp/net-snmp-includes.h
+./ucd-snmp/vmstat_solaris2.lo: ../../include/net-snmp/definitions.h
+./ucd-snmp/vmstat_solaris2.lo: ../../include/net-snmp/types.h
+./ucd-snmp/vmstat_solaris2.lo: ../../include/net-snmp/library/snmp_api.h
+./ucd-snmp/vmstat_solaris2.lo: ../../include/net-snmp/library/asn1.h
+./ucd-snmp/vmstat_solaris2.lo: ../../include/net-snmp/library/snmp_impl.h
+./ucd-snmp/vmstat_solaris2.lo: ../../include/net-snmp/library/snmp.h
+./ucd-snmp/vmstat_solaris2.lo: ../../include/net-snmp/library/snmp-tc.h
+./ucd-snmp/vmstat_solaris2.lo: ../../include/net-snmp/utilities.h
+./ucd-snmp/vmstat_solaris2.lo: ../../include/net-snmp/library/snmp_client.h
+./ucd-snmp/vmstat_solaris2.lo: ../../include/net-snmp/library/getopt.h
+./ucd-snmp/vmstat_solaris2.lo: ../../include/net-snmp/library/system.h
+./ucd-snmp/vmstat_solaris2.lo: ../../include/net-snmp/library/tools.h
+./ucd-snmp/vmstat_solaris2.lo: ../../include/net-snmp/library/int64.h
+./ucd-snmp/vmstat_solaris2.lo: ../../include/net-snmp/library/mt_support.h
+./ucd-snmp/vmstat_solaris2.lo: ../../include/net-snmp/library/snmp_alarm.h
+./ucd-snmp/vmstat_solaris2.lo: ../../include/net-snmp/library/data_list.h
+./ucd-snmp/vmstat_solaris2.lo: ../../include/net-snmp/library/callback.h
+./ucd-snmp/vmstat_solaris2.lo: ../../include/net-snmp/library/oid_stash.h
+./ucd-snmp/vmstat_solaris2.lo: ../../include/net-snmp/library/check_varbind.h
+./ucd-snmp/vmstat_solaris2.lo: ../../include/net-snmp/version.h
+./ucd-snmp/vmstat_solaris2.lo: ../../include/net-snmp/session_api.h
+./ucd-snmp/vmstat_solaris2.lo: ../../include/net-snmp/library/snmp_transport.h
+./ucd-snmp/vmstat_solaris2.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./ucd-snmp/vmstat_solaris2.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./ucd-snmp/vmstat_solaris2.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./ucd-snmp/vmstat_solaris2.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./ucd-snmp/vmstat_solaris2.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./ucd-snmp/vmstat_solaris2.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./ucd-snmp/vmstat_solaris2.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./ucd-snmp/vmstat_solaris2.lo: ../../include/net-snmp/library/ucd_compat.h
+./ucd-snmp/vmstat_solaris2.lo: ../../include/net-snmp/pdu_api.h
+./ucd-snmp/vmstat_solaris2.lo: ../../include/net-snmp/mib_api.h
+./ucd-snmp/vmstat_solaris2.lo: ../../include/net-snmp/library/mib.h
+./ucd-snmp/vmstat_solaris2.lo: ../../include/net-snmp/library/parse.h
+./ucd-snmp/vmstat_solaris2.lo: ../../include/net-snmp/varbind_api.h
+./ucd-snmp/vmstat_solaris2.lo: ../../include/net-snmp/config_api.h
+./ucd-snmp/vmstat_solaris2.lo: ../../include/net-snmp/library/read_config.h
+./ucd-snmp/vmstat_solaris2.lo: ../../include/net-snmp/library/default_store.h
+./ucd-snmp/vmstat_solaris2.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./ucd-snmp/vmstat_solaris2.lo: ../../include/net-snmp/library/snmp_enum.h
+./ucd-snmp/vmstat_solaris2.lo: ../../include/net-snmp/library/vacm.h
+./ucd-snmp/vmstat_solaris2.lo: ../../include/net-snmp/output_api.h
+./ucd-snmp/vmstat_solaris2.lo: ../../include/net-snmp/library/snmp_debug.h
+./ucd-snmp/vmstat_solaris2.lo: ../../include/net-snmp/library/snmp_logging.h
+./ucd-snmp/vmstat_solaris2.lo: ../../include/net-snmp/snmpv3_api.h
+./ucd-snmp/vmstat_solaris2.lo: ../../include/net-snmp/library/snmpv3.h
+./ucd-snmp/vmstat_solaris2.lo: ../../include/net-snmp/library/transform_oids.h
+./ucd-snmp/vmstat_solaris2.lo: ../../include/net-snmp/library/keytools.h
+./ucd-snmp/vmstat_solaris2.lo: ../../include/net-snmp/library/scapi.h
+./ucd-snmp/vmstat_solaris2.lo: ../../include/net-snmp/library/lcd_time.h
+./ucd-snmp/vmstat_solaris2.lo: ../../include/net-snmp/library/snmp_secmod.h
+./ucd-snmp/vmstat_solaris2.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./ucd-snmp/vmstat_solaris2.lo: ../../include/net-snmp/library/snmpusm.h
+./ucd-snmp/vmstat_solaris2.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./ucd-snmp/vmstat_solaris2.lo: ../../include/net-snmp/agent/snmp_agent.h
+./ucd-snmp/vmstat_solaris2.lo: ../../include/net-snmp/agent/snmp_vars.h
+./ucd-snmp/vmstat_solaris2.lo: ../../include/net-snmp/agent/agent_handler.h
+./ucd-snmp/vmstat_solaris2.lo: ../../include/net-snmp/agent/var_struct.h
+./ucd-snmp/vmstat_solaris2.lo: ../../include/net-snmp/agent/agent_registry.h
+./ucd-snmp/vmstat_solaris2.lo: ../../include/net-snmp/agent/ds_agent.h
+./ucd-snmp/vmstat_solaris2.lo: ../../include/net-snmp/agent/agent_read_config.h
+./ucd-snmp/vmstat_solaris2.lo: ../../include/net-snmp/agent/agent_trap.h
+./ucd-snmp/vmstat_solaris2.lo: ../../include/net-snmp/agent/all_helpers.h
+./ucd-snmp/vmstat_solaris2.lo: ../../include/net-snmp/agent/instance.h
+./ucd-snmp/vmstat_solaris2.lo: ../../include/net-snmp/agent/multiplexer.h
+./ucd-snmp/vmstat_solaris2.lo: ../../include/net-snmp/agent/null.h
+./ucd-snmp/vmstat_solaris2.lo: ../../include/net-snmp/agent/debug_handler.h
+./ucd-snmp/vmstat_solaris2.lo: ../../include/net-snmp/agent/old_api.h
+./ucd-snmp/vmstat_solaris2.lo: ../../include/net-snmp/agent/read_only.h
+./ucd-snmp/vmstat_solaris2.lo: ../../include/net-snmp/agent/serialize.h
+./ucd-snmp/vmstat_solaris2.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./ucd-snmp/vmstat_solaris2.lo: ../../include/net-snmp/agent/mode_end_call.h
+./ucd-snmp/vmstat_solaris2.lo: ../../include/net-snmp/agent/table.h
+./ucd-snmp/vmstat_solaris2.lo: ../../include/net-snmp/agent/table_data.h
+./ucd-snmp/vmstat_solaris2.lo: ../../include/net-snmp/agent/table_dataset.h
+./ucd-snmp/vmstat_solaris2.lo: ../../include/net-snmp/agent/table_iterator.h
+./ucd-snmp/vmstat_solaris2.lo: ../../include/net-snmp/agent/mib_module_config.h
+./ucd-snmp/vmstat_solaris2.lo: mibdefs.h util_funcs.h struct.h
+./ucd-snmp/vmstat_solaris2.lo: ./ucd-snmp/vmstat.h
+./ucd-snmp/vmstat_solaris2.lo: ./ucd-snmp/vmstat_solaris2.h
+./utilities/override.lo: ../../include/net-snmp/net-snmp-config.h
+./utilities/override.lo: ../../include/net-snmp/system/linux.h
+./utilities/override.lo: ../../include/net-snmp/system/sysv.h
+./utilities/override.lo: ../../include/net-snmp/system/generic.h
+./utilities/override.lo: ../../include/net-snmp/machine/generic.h
+./utilities/override.lo: ../../include/net-snmp/net-snmp-includes.h
+./utilities/override.lo: ../../include/net-snmp/definitions.h
+./utilities/override.lo: ../../include/net-snmp/types.h
+./utilities/override.lo: ../../include/net-snmp/library/snmp_api.h
+./utilities/override.lo: ../../include/net-snmp/library/asn1.h
+./utilities/override.lo: ../../include/net-snmp/library/snmp_impl.h
+./utilities/override.lo: ../../include/net-snmp/library/snmp.h
+./utilities/override.lo: ../../include/net-snmp/library/snmp-tc.h
+./utilities/override.lo: ../../include/net-snmp/utilities.h
+./utilities/override.lo: ../../include/net-snmp/library/snmp_client.h
+./utilities/override.lo: ../../include/net-snmp/library/getopt.h
+./utilities/override.lo: ../../include/net-snmp/library/system.h
+./utilities/override.lo: ../../include/net-snmp/library/tools.h
+./utilities/override.lo: ../../include/net-snmp/library/int64.h
+./utilities/override.lo: ../../include/net-snmp/library/mt_support.h
+./utilities/override.lo: ../../include/net-snmp/library/snmp_alarm.h
+./utilities/override.lo: ../../include/net-snmp/library/data_list.h
+./utilities/override.lo: ../../include/net-snmp/library/callback.h
+./utilities/override.lo: ../../include/net-snmp/library/oid_stash.h
+./utilities/override.lo: ../../include/net-snmp/library/check_varbind.h
+./utilities/override.lo: ../../include/net-snmp/version.h
+./utilities/override.lo: ../../include/net-snmp/session_api.h
+./utilities/override.lo: ../../include/net-snmp/library/snmp_transport.h
+./utilities/override.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./utilities/override.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./utilities/override.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./utilities/override.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./utilities/override.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./utilities/override.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./utilities/override.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./utilities/override.lo: ../../include/net-snmp/library/ucd_compat.h
+./utilities/override.lo: ../../include/net-snmp/pdu_api.h
+./utilities/override.lo: ../../include/net-snmp/mib_api.h
+./utilities/override.lo: ../../include/net-snmp/library/mib.h
+./utilities/override.lo: ../../include/net-snmp/library/parse.h
+./utilities/override.lo: ../../include/net-snmp/varbind_api.h
+./utilities/override.lo: ../../include/net-snmp/config_api.h
+./utilities/override.lo: ../../include/net-snmp/library/read_config.h
+./utilities/override.lo: ../../include/net-snmp/library/default_store.h
+./utilities/override.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./utilities/override.lo: ../../include/net-snmp/library/snmp_enum.h
+./utilities/override.lo: ../../include/net-snmp/library/vacm.h
+./utilities/override.lo: ../../include/net-snmp/output_api.h
+./utilities/override.lo: ../../include/net-snmp/library/snmp_debug.h
+./utilities/override.lo: ../../include/net-snmp/library/snmp_logging.h
+./utilities/override.lo: ../../include/net-snmp/snmpv3_api.h
+./utilities/override.lo: ../../include/net-snmp/library/snmpv3.h
+./utilities/override.lo: ../../include/net-snmp/library/transform_oids.h
+./utilities/override.lo: ../../include/net-snmp/library/keytools.h
+./utilities/override.lo: ../../include/net-snmp/library/scapi.h
+./utilities/override.lo: ../../include/net-snmp/library/lcd_time.h
+./utilities/override.lo: ../../include/net-snmp/library/snmp_secmod.h
+./utilities/override.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./utilities/override.lo: ../../include/net-snmp/library/snmpusm.h
+./utilities/override.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./utilities/override.lo: ../../include/net-snmp/agent/snmp_agent.h
+./utilities/override.lo: ../../include/net-snmp/agent/snmp_vars.h
+./utilities/override.lo: ../../include/net-snmp/agent/agent_handler.h
+./utilities/override.lo: ../../include/net-snmp/agent/var_struct.h
+./utilities/override.lo: ../../include/net-snmp/agent/agent_registry.h
+./utilities/override.lo: ../../include/net-snmp/agent/ds_agent.h
+./utilities/override.lo: ../../include/net-snmp/agent/agent_read_config.h
+./utilities/override.lo: ../../include/net-snmp/agent/agent_trap.h
+./utilities/override.lo: ../../include/net-snmp/agent/all_helpers.h
+./utilities/override.lo: ../../include/net-snmp/agent/instance.h
+./utilities/override.lo: ../../include/net-snmp/agent/multiplexer.h
+./utilities/override.lo: ../../include/net-snmp/agent/null.h
+./utilities/override.lo: ../../include/net-snmp/agent/debug_handler.h
+./utilities/override.lo: ../../include/net-snmp/agent/old_api.h
+./utilities/override.lo: ../../include/net-snmp/agent/read_only.h
+./utilities/override.lo: ../../include/net-snmp/agent/serialize.h
+./utilities/override.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./utilities/override.lo: ../../include/net-snmp/agent/mode_end_call.h
+./utilities/override.lo: ../../include/net-snmp/agent/table.h
+./utilities/override.lo: ../../include/net-snmp/agent/table_data.h
+./utilities/override.lo: ../../include/net-snmp/agent/table_dataset.h
+./utilities/override.lo: ../../include/net-snmp/agent/table_iterator.h
+./utilities/override.lo: ../../include/net-snmp/agent/mib_module_config.h
+./utilities/override.lo: util_funcs.h struct.h
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/Makefile.in tomato121/release/src/router/snmp/agent/mibgroup/Makefile.in
--- tomato/release/src/router/snmp/agent/mibgroup/Makefile.in	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/Makefile.in	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,18 @@
+top_builddir=../..
+
+CPPFLAGS=-I../../include -I$(top_srcdir)/include \
+	-I. -I../.. -I$(srcdir) -I$(srcdir)/../.. \
+	-I$(srcdir)/../../snmplib -I$(srcdir)/.. -I.. @CPPFLAGS@ $(LIB_CFLAGS)
+
+# Need a special .c -> .o definition here to make sure we place the
+# object files in the sub directory.
+
+.c.o:
+	$(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $<
+
+OBJS = @module_list_o@
+LOBJS = @module_list_lo@
+SRCS = @module_list_c@
+
+all: standardall $(LOBJS)
+
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/mibdefs.h tomato121/release/src/router/snmp/agent/mibgroup/mibdefs.h
--- tomato/release/src/router/snmp/agent/mibgroup/mibdefs.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/mibdefs.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,14 @@
+/*
+ * 2 global mib defs:
+ * ERRORFLAG:  A binary flag to signal an error condition.
+ * Also used as exit code.
+ * ERRORMSG:  A text message describing what caused the above condition,
+ * Also used as the single line return message from programs 
+ */
+
+#define MIBINDEX 1
+#define ERRORNAME 2
+#define ERRORFLAG 100
+#define ERRORMSG 101
+#define ERRORFIX 102
+#define ERRORFIXCMD 103
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/mibII/at.c tomato121/release/src/router/snmp/agent/mibgroup/mibII/at.c
--- tomato/release/src/router/snmp/agent/mibgroup/mibII/at.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/mibII/at.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,1216 @@
+#undef CAN_USE_SYSCTL
+/*
+ *  Template MIB group implementation - at.c
+ *
+ */
+
+#include <net-snmp/net-snmp-config.h>
+#if HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+#if HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#if defined(IFNET_NEEDS_KERNEL) && !defined(_KERNEL)
+#define _KERNEL 1
+#define _I_DEFINED_KERNEL
+#endif
+#include <sys/types.h>
+#if TIME_WITH_SYS_TIME
+# ifdef WIN32
+#  include <sys/timeb.h>
+# else
+# include <sys/time.h>
+# endif
+# include <time.h>
+#else
+# if HAVE_SYS_TIME_H
+#  include <sys/time.h>
+# else
+#  include <time.h>
+# endif
+#endif
+#if HAVE_SYS_SOCKET_H
+#include <sys/socket.h>
+#endif
+
+#if HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+#if HAVE_NET_IF_H
+#include <net/if.h>
+#endif
+#if HAVE_NET_IF_VAR_H
+#include <net/if_var.h>
+#endif
+#ifdef _I_DEFINED_KERNEL
+#undef _KERNEL
+#endif
+
+#if HAVE_NETINET_IF_ETHER_H
+#include <netinet/if_ether.h>
+#endif
+#if HAVE_INET_MIB2_H
+#include <inet/mib2.h>
+#endif
+#if HAVE_SYS_PARAM_H
+#include <sys/param.h>
+#endif
+#if HAVE_SYS_SYSCTL_H
+#include <sys/sysctl.h>
+#endif
+#if HAVE_NET_IF_DL_H
+#ifndef dynix
+#include <net/if_dl.h>
+#else
+#include <sys/net/if_dl.h>
+#endif
+#endif
+#if HAVE_SYS_STREAM_H
+#include <sys/stream.h>
+#endif
+#if HAVE_NET_ROUTE_H
+#include <net/route.h>
+#endif
+#ifdef solaris2
+#include "kernel_sunos5.h"
+#endif
+#if HAVE_WINSOCK_H
+#include <winsock.h>
+#endif
+#if HAVE_DMALLOC_H
+#include <dmalloc.h>
+#endif
+
+#ifdef hpux11
+#include <sys/mib.h>
+#include <netinet/mib_kern.h>
+#endif                          /* hpux11 */
+
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include <net-snmp/agent/auto_nlist.h>
+
+#include "at.h"
+#include "interfaces.h"
+
+#if defined(HAVE_SYS_SYSCTL_H) && !defined(CAN_USE_SYSCTL)
+# if defined(RTF_LLINFO) && !defined(irix6)
+#  define CAN_USE_SYSCTL 1
+# endif
+#endif
+
+#ifdef cygwin
+#define WIN32
+#include <windows.h>
+#endif
+
+        /*********************
+	 *
+	 *  Kernel & interface information,
+	 *   and internal forward declarations
+	 *
+	 *********************/
+
+#ifndef WIN32
+#ifndef solaris2
+static void     ARP_Scan_Init(void);
+#ifdef ARP_SCAN_FOUR_ARGUMENTS
+static int      ARP_Scan_Next(u_long *, char *, u_long *, u_short *);
+#else
+static int      ARP_Scan_Next(u_long *, char *, u_long *);
+#endif
+#endif
+#endif
+
+        /*********************
+	 *
+	 *  Public interface functions
+	 *
+	 *********************/
+
+/*
+ * define the structure we're going to ask the agent to register our
+ * information at 
+ */
+struct variable1 at_variables[] = {
+    {ATIFINDEX, ASN_INTEGER, RONLY, var_atEntry, 1, {1}},
+    {ATPHYSADDRESS, ASN_OCTET_STR, RONLY, var_atEntry, 1, {2}},
+    {ATNETADDRESS, ASN_IPADDRESS, RONLY, var_atEntry, 1, {3}}
+};
+
+/*
+ * Define the OID pointer to the top of the mib tree that we're
+ * registering underneath 
+ */
+oid             at_variables_oid[] = { SNMP_OID_MIB2, 3, 1, 1 };
+
+void
+init_at(void)
+{
+    /*
+     * register ourselves with the agent to handle our mib tree 
+     */
+    REGISTER_MIB("mibII/at", at_variables, variable1, at_variables_oid);
+#ifdef solaris2
+    init_kernel_sunos5();
+#endif
+}
+
+#ifndef WIN32
+#ifndef solaris2
+
+/*
+ * var_atEntry(...
+ * Arguments:
+ * vp     IN      - pointer to variable entry that points here
+ * name    IN/OUT  - IN/name requested, OUT/name found
+ * length  IN/OUT  - length of IN/OUT oid's 
+ * exact   IN      - TRUE if an exact match was requested
+ * var_len OUT     - length of variable or 0 if function returned
+ * write_method
+ * 
+ */
+
+u_char         *
+var_atEntry(struct variable *vp,
+            oid * name,
+            size_t * length,
+            int exact, size_t * var_len, WriteMethod ** write_method)
+{
+    /*
+     * Address Translation table object identifier is of form:
+     * 1.3.6.1.2.1.3.1.1.1.interface.1.A.B.C.D,  where A.B.C.D is IP address.
+     * Interface is at offset 10,
+     * IPADDR starts at offset 12.
+     *
+     * IP Net to Media table object identifier is of form:
+     * 1.3.6.1.2.1.4.22.1.1.1.interface.A.B.C.D,  where A.B.C.D is IP address.
+     * Interface is at offset 10,
+     * IPADDR starts at offset 11.
+     */
+    u_char         *cp;
+    oid            *op;
+    oid             lowest[16];
+    oid             current[16];
+    static char     PhysAddr[6], LowPhysAddr[6];
+    u_long          Addr, LowAddr, foundone;
+#ifdef ARP_SCAN_FOUR_ARGUMENTS
+    u_short         ifIndex, lowIfIndex = 0;
+#endif                          /* ARP_SCAN_FOUR_ARGUMENTS */
+    u_long          ifType, lowIfType = 0;
+
+    int             oid_length;
+
+    /*
+     * fill in object part of name for current (less sizeof instance part) 
+     */
+    memcpy((char *) current, (char *) vp->name,
+           (int) vp->namelen * sizeof(oid));
+
+    if (current[6] == 3) {      /* AT group oid */
+        oid_length = 16;
+    } else {                    /* IP NetToMedia group oid */
+        oid_length = 15;
+    }
+
+    LowAddr = 0;                /* Don't have one yet */
+    foundone = 0;
+    ARP_Scan_Init();
+    for (;;) {
+#ifdef ARP_SCAN_FOUR_ARGUMENTS
+        if (ARP_Scan_Next(&Addr, PhysAddr, &ifType, &ifIndex) == 0)
+            break;
+        current[10] = ifIndex;
+
+        if (current[6] == 3) {  /* AT group oid */
+            current[11] = 1;
+            op = current + 12;
+        } else {                /* IP NetToMedia group oid */
+            op = current + 11;
+        }
+#else                           /* ARP_SCAN_FOUR_ARGUMENTS */
+        if (ARP_Scan_Next(&Addr, PhysAddr, &ifType) == 0)
+            break;
+        current[10] = 1;
+
+        if (current[6] == 3) {  /* AT group oid */
+            current[11] = 1;
+            op = current + 12;
+        } else {                /* IP NetToMedia group oid */
+            op = current + 11;
+        }
+#endif                          /* ARP_SCAN_FOUR_ARGUMENTS */
+        cp = (u_char *) & Addr;
+        *op++ = *cp++;
+        *op++ = *cp++;
+        *op++ = *cp++;
+        *op++ = *cp++;
+
+        if (exact) {
+            if (snmp_oid_compare(current, oid_length, name, *length) == 0) {
+                memcpy((char *) lowest, (char *) current,
+                       oid_length * sizeof(oid));
+                LowAddr = Addr;
+                foundone = 1;
+#ifdef ARP_SCAN_FOUR_ARGUMENTS
+                lowIfIndex = ifIndex;
+#endif                          /*  ARP_SCAN_FOUR_ARGUMENTS */
+                memcpy(LowPhysAddr, PhysAddr, sizeof(PhysAddr));
+                lowIfType = ifType;
+                break;          /* no need to search further */
+            }
+        } else {
+            if ((snmp_oid_compare(current, oid_length, name, *length) > 0)
+                && ((foundone == 0)
+                    ||
+                    (snmp_oid_compare
+                     (current, oid_length, lowest, oid_length) < 0))) {
+                /*
+                 * if new one is greater than input and closer to input than
+                 * previous lowest, save this one as the "next" one.
+                 */
+                memcpy((char *) lowest, (char *) current,
+                       oid_length * sizeof(oid));
+                LowAddr = Addr;
+                foundone = 1;
+#ifdef ARP_SCAN_FOUR_ARGUMENTS
+                lowIfIndex = ifIndex;
+#endif                          /*  ARP_SCAN_FOUR_ARGUMENTS */
+                memcpy(LowPhysAddr, PhysAddr, sizeof(PhysAddr));
+                lowIfType = ifType;
+            }
+        }
+    }
+    if (foundone == 0)
+        return (NULL);
+
+    memcpy((char *) name, (char *) lowest, oid_length * sizeof(oid));
+    *length = oid_length;
+    *write_method = 0;
+    switch (vp->magic) {
+    case IPMEDIAIFINDEX:       /* also ATIFINDEX */
+        *var_len = sizeof long_return;
+#ifdef ARP_SCAN_FOUR_ARGUMENTS
+        long_return = lowIfIndex;
+#else                           /* ARP_SCAN_FOUR_ARGUMENTS */
+#if NO_DUMMY_VALUES
+        return NULL;
+#endif
+        long_return = 1;        /* XXX */
+#endif                          /* ARP_SCAN_FOUR_ARGUMENTS */
+        return (u_char *) & long_return;
+    case IPMEDIAPHYSADDRESS:   /* also ATPHYSADDRESS */
+        *var_len = sizeof(LowPhysAddr);
+        return (u_char *) LowPhysAddr;
+    case IPMEDIANETADDRESS:    /* also ATNETADDRESS */
+        *var_len = sizeof long_return;
+        long_return = LowAddr;
+        return (u_char *) & long_return;
+    case IPMEDIATYPE:
+        *var_len = sizeof long_return;
+        long_return = lowIfType;
+        return (u_char *) & long_return;
+    default:
+        DEBUGMSGTL(("snmpd", "unknown sub-id %d in var_atEntry\n",
+                    vp->magic));
+    }
+    return NULL;
+}
+#else                           /* solaris2 */
+
+typedef struct if_ip {
+    int             ifIdx;
+    IpAddress       ipAddr;
+} if_ip_t;
+
+static int
+AT_Cmp(void *addr, void *ep)
+{
+    mib2_ipNetToMediaEntry_t *mp = (mib2_ipNetToMediaEntry_t *) ep;
+    int             ret = -1;
+    DEBUGMSGTL(("mibII/at", "......... AT_Cmp %lx<>%lx %d<>%d (%.5s)\n",
+                mp->ipNetToMediaNetAddress, ((if_ip_t *) addr)->ipAddr,
+                ((if_ip_t *) addr)->ifIdx,
+                Interface_Index_By_Name(mp->ipNetToMediaIfIndex.o_bytes,
+                                        mp->ipNetToMediaIfIndex.o_length),
+                mp->ipNetToMediaIfIndex.o_bytes));
+    if (mp->ipNetToMediaNetAddress != ((if_ip_t *) addr)->ipAddr)
+        ret = 1;
+    else if (((if_ip_t *) addr)->ifIdx !=
+             Interface_Index_By_Name(mp->ipNetToMediaIfIndex.o_bytes,
+                                     mp->ipNetToMediaIfIndex.o_length))
+        ret = 1;
+    else
+        ret = 0;
+    DEBUGMSGTL(("mibII/at", "......... AT_Cmp returns %d\n", ret));
+    return ret;
+}
+
+u_char         *
+var_atEntry(struct variable * vp,
+            oid * name,
+            size_t * length,
+            int exact, size_t * var_len, WriteMethod ** write_method)
+{
+    /*
+     * object identifier is of form:
+     * 1.3.6.1.2.1.3.1.1.1.interface.1.A.B.C.D,  where A.B.C.D is IP address.
+     * Interface is at offset 10,
+     * IPADDR starts at offset 12.
+     */
+#define AT_MAX_NAME_LENGTH	16
+#define AT_IFINDEX_OFF	10
+    u_char         *cp;
+    oid            *op;
+    oid             lowest[AT_MAX_NAME_LENGTH];
+    oid             current[AT_MAX_NAME_LENGTH];
+    if_ip_t         NextAddr;
+    mib2_ipNetToMediaEntry_t entry, Lowentry;
+    int             Found = 0;
+    req_e           req_type;
+    int             offset, olength;
+
+    /*
+     * fill in object part of name for current (less sizeof instance part) 
+     */
+
+    DEBUGMSGTL(("mibII/at", "var_atEntry: "));
+    DEBUGMSGOID(("mibII/at", vp->name, vp->namelen));
+    DEBUGMSG(("mibII/at", " %d\n", exact));
+
+    memset(&Lowentry, 0, sizeof(Lowentry));
+    memcpy((char *) current, (char *) vp->name, vp->namelen * sizeof(oid));
+    lowest[0] = 1024;
+    for (NextAddr.ipAddr = (u_long) - 1, NextAddr.ifIdx = 255, req_type =
+         GET_FIRST;;
+         NextAddr.ipAddr = entry.ipNetToMediaNetAddress, NextAddr.ifIdx =
+         current[AT_IFINDEX_OFF], req_type = GET_NEXT) {
+        if (getMibstat
+            (MIB_IP_NET, &entry, sizeof(mib2_ipNetToMediaEntry_t),
+             req_type, &AT_Cmp, &NextAddr) != 0)
+            break;
+        current[AT_IFINDEX_OFF] =
+            Interface_Index_By_Name(entry.ipNetToMediaIfIndex.o_bytes,
+                                    entry.ipNetToMediaIfIndex.o_length);
+        if (current[6] == 3) {  /* AT group oid */
+            current[AT_IFINDEX_OFF + 1] = 1;
+            offset = AT_IFINDEX_OFF + 2;
+            olength = AT_IFINDEX_OFF + 6;
+        } else {
+            offset = AT_IFINDEX_OFF + 1;
+            olength = AT_IFINDEX_OFF + 5;
+        }
+        COPY_IPADDR(cp, (u_char *) & entry.ipNetToMediaNetAddress, op,
+                    current + offset);
+        if (exact) {
+            if (snmp_oid_compare(current, olength, name, *length) == 0) {
+                memcpy((char *) lowest, (char *) current,
+                       olength * sizeof(oid));
+                Lowentry = entry;
+                Found++;
+                break;          /* no need to search further */
+            }
+        } else {
+            if (snmp_oid_compare(current, olength, name, *length) > 0
+                && snmp_oid_compare(current, olength, lowest,
+                                    *length) < 0) {
+                /*
+                 * if new one is greater than input and closer to input than
+                 * previous lowest, and is not equal to it, save this one as the "next" one.
+                 */
+                memcpy((char *) lowest, (char *) current,
+                       olength * sizeof(oid));
+                Lowentry = entry;
+                Found++;
+            }
+        }
+    }
+    DEBUGMSGTL(("mibII/at", "... Found = %d\n", Found));
+    if (Found == 0)
+        return (NULL);
+    memcpy((char *) name, (char *) lowest, olength * sizeof(oid));
+    *length = olength;
+    *write_method = 0;
+    switch (vp->magic) {
+    case IPMEDIAIFINDEX:
+        *var_len = sizeof long_return;
+        long_return =
+            Interface_Index_By_Name(Lowentry.ipNetToMediaIfIndex.o_bytes,
+                                    Lowentry.ipNetToMediaIfIndex.o_length);
+        return (u_char *) & long_return;
+    case IPMEDIAPHYSADDRESS:
+        *var_len = Lowentry.ipNetToMediaPhysAddress.o_length;
+        (void) memcpy(return_buf, Lowentry.ipNetToMediaPhysAddress.o_bytes,
+                      *var_len);
+        return (u_char *) return_buf;
+    case IPMEDIANETADDRESS:
+        *var_len = sizeof long_return;
+        long_return = Lowentry.ipNetToMediaNetAddress;
+        return (u_char *) & long_return;
+    case IPMEDIATYPE:
+        *var_len = sizeof long_return;
+        long_return = Lowentry.ipNetToMediaType;
+        return (u_char *) & long_return;
+    default:
+        DEBUGMSGTL(("snmpd", "unknown sub-id %d in var_atEntry\n",
+                    vp->magic));
+    }
+    return NULL;
+}
+#endif                          /* solaris2 */
+
+
+        /*********************
+	 *
+	 *  Internal implementation functions
+	 *
+	 *********************/
+
+#ifndef solaris2
+
+static int      arptab_size, arptab_current;
+#if CAN_USE_SYSCTL
+static char    *lim, *rtnext;
+static char    *at = 0;
+#else
+#ifdef STRUCT_ARPHD_HAS_AT_NEXT
+static struct arphd *at = 0;
+static struct arptab *at_ptr, at_entry;
+static struct arpcom at_com;
+#elif defined(hpux11)
+static mib_ipNetToMediaEnt *at = (mib_ipNetToMediaEnt *) 0;
+#else
+
+/*
+ * at used to be allocated every time we needed to look at the arp cache.
+ * This cause us to parse /proc/net/arp twice for each request and didn't
+ * allow us to filter things like we'd like to.  So now we use it 
+ * semi-statically.  We initialize it to size 0 and if we need more room
+ * we realloc room for ARP_CACHE_INCR more entries in the table.
+ * We never release what we've taken . . .
+ */
+#define ARP_CACHE_INCR 1024
+static struct arptab *at = NULL;
+static int      arptab_curr_max_size = 0;
+
+#endif
+#endif                          /* CAN_USE_SYSCTL */
+
+static void
+ARP_Scan_Init(void)
+{
+#ifndef CAN_USE_SYSCTL
+#ifndef linux
+#ifdef hpux11
+
+    int             fd;
+    struct nmparms  p;
+    int             val;
+    unsigned int    ulen;
+    int             ret;
+
+    if (at)
+        free(at);
+    at = (mib_ipNetToMediaEnt *) 0;
+    arptab_size = 0;
+
+    if ((fd = open_mib("/dev/ip", O_RDONLY, 0, NM_ASYNC_OFF)) >= 0) {
+        p.objid = ID_ipNetToMediaTableNum;
+        p.buffer = (void *) &val;
+        ulen = sizeof(int);
+        p.len = &ulen;
+        if ((ret = get_mib_info(fd, &p)) == 0)
+            arptab_size = val;
+
+        if (arptab_size > 0) {
+            ulen = (unsigned) arptab_size *sizeof(mib_ipNetToMediaEnt);
+            at = (mib_ipNetToMediaEnt *) malloc(ulen);
+            p.objid = ID_ipNetToMediaTable;
+            p.buffer = (void *) at;
+            p.len = &ulen;
+            if ((ret = get_mib_info(fd, &p)) < 0)
+                arptab_size = 0;
+        }
+
+        close_mib(fd);
+    }
+
+    arptab_current = 0;
+
+#else                           /* hpux11 */
+
+    if (!at) {
+        auto_nlist(ARPTAB_SIZE_SYMBOL, (char *) &arptab_size,
+                   sizeof arptab_size);
+#ifdef STRUCT_ARPHD_HAS_AT_NEXT
+        at = (struct arphd *) malloc(arptab_size * sizeof(struct arphd));
+#else
+        at = (struct arptab *) malloc(arptab_size * sizeof(struct arptab));
+#endif
+    }
+#ifdef STRUCT_ARPHD_HAS_AT_NEXT
+    auto_nlist(ARPTAB_SYMBOL, (char *) at,
+               arptab_size * sizeof(struct arphd));
+    at_ptr = at[0].at_next;
+#else
+    auto_nlist(ARPTAB_SYMBOL, (char *) at,
+               arptab_size * sizeof(struct arptab));
+#endif
+    arptab_current = 0;
+
+#endif                          /* hpux11 */
+#else                           /* linux */
+
+    static time_t   tm = 0;     /* Time of last scan */
+    FILE           *in;
+    int             i;
+    char            line[128];
+    int             za, zb, zc, zd, ze, zf, zg, zh, zi, zj;
+    char            ifname[21];
+
+    arptab_current = 0;         /* Anytime this is called we need to reset 'current' */
+
+    if (time(NULL) < tm + 1) {  /*Our cool one second cache implementation :-) */
+        return;
+    }
+
+    in = fopen("/proc/net/arp", "r");
+    if (!in) {
+        snmp_log(LOG_ERR, "snmpd: Cannot open /proc/net/arp\n");
+        arptab_size = 0;
+        return;
+    }
+
+    /*
+     * Get rid of the header line 
+     */
+    fgets(line, sizeof(line), in);
+
+    i = 0;
+    while (fgets(line, sizeof(line), in)) {
+        u_long          tmp_a;
+        int             tmp_flags;
+        if (i >= arptab_curr_max_size) {
+            struct arptab  *newtab = (struct arptab *)
+                realloc(at, (sizeof(struct arptab) *
+                             (arptab_curr_max_size + ARP_CACHE_INCR)));
+            if (newtab == at) {
+                snmp_log(LOG_ERR,
+                         "Error allocating more space for arpcache.  "
+                         "Cache will continue to be limited to %d entries",
+                         arptab_curr_max_size);
+                break;
+            } else {
+                arptab_curr_max_size += ARP_CACHE_INCR;
+                at = newtab;
+            }
+        }
+        if (12 !=
+            sscanf(line,
+                   "%d.%d.%d.%d 0x%*x 0x%x %x:%x:%x:%x:%x:%x %*[^ ] %20s\n",
+                   &za, &zb, &zc, &zd, &tmp_flags, &ze, &zf, &zg, &zh, &zi,
+                   &zj, ifname)) {
+            snmp_log(LOG_ERR, "Bad line in /proc/net/arp: %s", line);
+            continue;
+        }
+        /*
+         * Invalidated entries have their flag set to 0.
+         * * We want to ignore them 
+         */
+        if (tmp_flags == 0) {
+            continue;
+        }
+        at[i].at_flags = tmp_flags;
+        at[i].at_enaddr[0] = ze;
+        at[i].at_enaddr[1] = zf;
+        at[i].at_enaddr[2] = zg;
+        at[i].at_enaddr[3] = zh;
+        at[i].at_enaddr[4] = zi;
+        at[i].at_enaddr[5] = zj;
+        tmp_a = ((u_long) za << 24) |
+            ((u_long) zb << 16) | ((u_long) zc << 8) | ((u_long) zd);
+        at[i].at_iaddr.s_addr = htonl(tmp_a);
+        at[i].if_index = Interface_Index_By_Name(ifname, strlen(ifname));
+        i++;
+    }
+    arptab_size = i;
+
+    fclose(in);
+    time(&tm);
+#endif                          /* linux */
+#else                           /* CAN_USE_SYSCTL */
+
+    int             mib[6];
+    size_t          needed;
+
+    mib[0] = CTL_NET;
+    mib[1] = PF_ROUTE;
+    mib[2] = 0;
+    mib[3] = AF_INET;
+    mib[4] = NET_RT_FLAGS;
+    mib[5] = RTF_LLINFO;
+
+    if (at)
+        free(at);
+    rtnext = lim = at = 0;
+
+    if (sysctl(mib, 6, NULL, &needed, NULL, 0) < 0)
+        snmp_log_perror("route-sysctl-estimate");
+    else {
+        if ((at = malloc(needed ? needed : 1)) == NULL)
+            snmp_log_perror("malloc");
+        else {
+            if (sysctl(mib, 6, at, &needed, NULL, 0) < 0)
+                snmp_log_perror("actual retrieval of routing table");
+            else {
+                lim = at + needed;
+                rtnext = at;
+            }
+        }
+    }
+
+#endif                          /* CAN_USE_SYSCTL */
+}
+
+#ifdef ARP_SCAN_FOUR_ARGUMENTS
+static int
+ARP_Scan_Next(u_long * IPAddr, char *PhysAddr, u_long * ifType,
+              u_short * ifIndex)
+#else
+static int
+ARP_Scan_Next(u_long * IPAddr, char *PhysAddr, u_long * ifType)
+#endif
+{
+#ifndef CAN_USE_SYSCTL
+#ifdef linux
+    if (arptab_current < arptab_size) {
+        /*
+         * copy values 
+         */
+        *IPAddr = at[arptab_current].at_iaddr.s_addr;
+        *ifType =
+            (at[arptab_current].
+             at_flags & ATF_PERM) ? 4 /*static */ : 3 /*dynamic */ ;
+        //*ifIndex = at[arptab_current].if_index;
+        memcpy(PhysAddr, &at[arptab_current].at_enaddr,
+               sizeof(at[arptab_current].at_enaddr));
+
+        /*
+         * increment to point next entry 
+         */
+        arptab_current++;
+        /*
+         * return success 
+         */
+        return (1);
+    }
+#elif defined(hpux11)
+    if (arptab_current < arptab_size) {
+        /*
+         * copy values 
+         */
+        *IPAddr = at[arptab_current].NetAddr;
+        memcpy(PhysAddr, at[arptab_current].PhysAddr.o_bytes,
+               at[arptab_current].PhysAddr.o_length);
+        *ifType = at[arptab_current].Type;
+        *ifIndex = at[arptab_current].IfIndex;
+        /*
+         * increment to point next entry 
+         */
+        arptab_current++;
+        /*
+         * return success 
+         */
+        return (1);
+    }
+#elif !defined(ARP_SCAN_FOUR_ARGUMENTS) || defined(hpux)
+    register struct arptab *atab;
+
+    while (arptab_current < arptab_size) {
+#ifdef STRUCT_ARPHD_HAS_AT_NEXT
+        /*
+         * The arp table is an array of linked lists of arptab entries.
+         * Unused slots have pointers back to the array entry itself 
+         */
+
+        if (at_ptr == (auto_nlist_value(ARPTAB_SYMBOL) +
+                       arptab_current * sizeof(struct arphd))) {
+            /*
+             * Usused 
+             */
+            arptab_current++;
+            at_ptr = at[arptab_current].at_next;
+            continue;
+        }
+
+        klookup(at_ptr, (char *) &at_entry, sizeof(struct arptab));
+        klookup(at_entry.at_ac, (char *) &at_com, sizeof(struct arpcom));
+
+        at_ptr = at_entry.at_next;
+        atab = &at_entry;
+        *ifIndex = at_com.ac_if.if_index;       /* not strictly ARPHD */
+#else                           /* STRUCT_ARPHD_HAS_AT_NEXT */
+        atab = &at[arptab_current++];
+#endif                          /* STRUCT_ARPHD_HAS_AT_NEXT */
+        if (!(atab->at_flags & ATF_COM))
+            continue;
+        *ifType = (atab->at_flags & ATF_PERM) ? 4 : 3;
+        *IPAddr = atab->at_iaddr.s_addr;
+#if defined (sunV3) || defined(sparc) || defined(hpux)
+        memcpy(PhysAddr, (char *) &atab->at_enaddr,
+               sizeof(atab->at_enaddr));
+#endif
+#if defined(mips) || defined(ibm032)
+        memcpy(PhysAddr, (char *) atab->at_enaddr,
+               sizeof(atab->at_enaddr));
+#endif
+        return (1);
+    }
+#endif                          /* linux || hpux11 || !ARP_SCAN_FOUR_ARGUMENTS || hpux */
+
+    return 0;                   /* we need someone with an irix box to fix this section */
+
+#else                           /* !CAN_USE_SYSCTL */
+    struct rt_msghdr *rtm;
+    struct sockaddr_inarp *sin;
+    struct sockaddr_dl *sdl;
+
+    while (rtnext < lim) {
+        rtm = (struct rt_msghdr *) rtnext;
+        sin = (struct sockaddr_inarp *) (rtm + 1);
+        sdl = (struct sockaddr_dl *) (sin + 1);
+        rtnext += rtm->rtm_msglen;
+        if (sdl->sdl_alen) {
+            *IPAddr = sin->sin_addr.s_addr;
+            memcpy(PhysAddr, (char *) LLADDR(sdl), sdl->sdl_alen);
+            *ifIndex = sdl->sdl_index;
+            *ifType = 1;        /* XXX */
+            return (1);
+        }
+    }
+    return (0);                 /* "EOF" */
+#endif                          /* !CAN_USE_SYSCTL */
+}
+#endif                          /* solaris2 */
+
+#else                           /* WIN32 */
+#include <iphlpapi.h>
+
+extern WriteMethod write_arp;
+MIB_IPNETROW   *arp_row = NULL;
+int             create_flag = 0;
+
+u_char         *
+var_atEntry(struct variable *vp,
+            oid * name,
+            size_t * length,
+            int exact, size_t * var_len, WriteMethod ** write_method)
+{
+    /*
+     * Address Translation table object identifier is of form:
+     * 1.3.6.1.2.1.3.1.?.interface.1.A.B.C.D,  where A.B.C.D is IP address.
+     * Interface is at offset 10,
+     * IPADDR starts at offset 12.
+     *
+     * IP Net to Media table object identifier is of form:
+     * 1.3.6.1.2.1.4.22.1.?.interface.A.B.C.D,  where A.B.C.D is IP address.
+     * Interface is at offset 10,
+     * IPADDR starts at offset 11.
+     */
+    u_char         *cp;
+    oid            *op;
+    oid             lowest[16];
+    oid             current[16];
+    int             oid_length;
+    int             lowState = -1;      /* Don't have one yet */
+    PMIB_IPNETTABLE pIpNetTable = NULL;
+    DWORD           status = NO_ERROR;
+    DWORD           dwActualSize = 0;
+    UINT            i;
+    u_char          dest_addr[4];
+
+    /*
+     * fill in object part of name for current (less sizeof instance part) 
+     */
+    memcpy((char *) current, (char *) vp->name,
+           (int) vp->namelen * sizeof(oid));
+
+    if (current[6] == 3) {      /* AT group oid */
+        oid_length = 16;
+    } else {                    /* IP NetToMedia group oid */
+        oid_length = 15;
+    }
+
+    status = GetIpNetTable(pIpNetTable, &dwActualSize, TRUE);
+    if (status == ERROR_INSUFFICIENT_BUFFER) {
+        pIpNetTable = (PMIB_IPNETTABLE) malloc(dwActualSize);
+        if (pIpNetTable != NULL) {
+            /*
+             * Get the sorted IpNet Table 
+             */
+            status = GetIpNetTable(pIpNetTable, &dwActualSize, TRUE);
+        }
+    }
+
+
+    if (status == NO_ERROR) {
+        for (i = 0; i < pIpNetTable->dwNumEntries; ++i) {
+            current[10] = pIpNetTable->table[i].dwIndex;
+
+
+            if (current[6] == 3) {      /* AT group oid */
+                current[11] = 1;
+                op = current + 12;
+            } else {            /* IP NetToMedia group oid */
+                op = current + 11;
+            }
+            cp = (u_char *) & pIpNetTable->table[i].dwAddr;
+            *op++ = *cp++;
+            *op++ = *cp++;
+            *op++ = *cp++;
+            *op++ = *cp++;
+
+            if (exact) {
+                if (snmp_oid_compare(current, oid_length, name, *length) ==
+                    0) {
+                    memcpy((char *) lowest, (char *) current,
+                           oid_length * sizeof(oid));
+                    lowState = 0;
+                    break;      /* no need to search further */
+                }
+            } else {
+                if (snmp_oid_compare(current, oid_length, name, *length) >
+                    0) {
+                    memcpy((char *) lowest, (char *) current,
+                           oid_length * sizeof(oid));
+                    lowState = 0;
+                    break;      /* As the table is sorted, no need to search further */
+                }
+            }
+        }
+    }
+    if (arp_row == NULL) {
+        /*
+         * Free allocated memory in case of SET request's FREE phase 
+         */
+        arp_row = (PMIB_IPNETROW) malloc(sizeof(MIB_IPNETROW));
+    }
+
+    if (lowState < 0 || status != NO_ERROR) {
+        /*
+         * for creation of new row, only ipNetToMediaTable case is considered 
+         */
+        if (*length == 15 || *length == 16) {
+            create_flag = 1;
+            *write_method = write_arp;
+            arp_row->dwIndex = name[10];
+
+            if (*length == 15) {        /* ipNetToMediaTable */
+                i = 11;
+            } else {            /* at Table */
+
+                i = 12;
+            }
+
+            dest_addr[0] = (u_char) name[i];
+            dest_addr[1] = (u_char) name[i + 1];
+            dest_addr[2] = (u_char) name[i + 2];
+            dest_addr[3] = (u_char) name[i + 3];
+            arp_row->dwAddr = *((DWORD *) dest_addr);
+
+            arp_row->dwType = 4;        /* Static */
+            arp_row->dwPhysAddrLen = 0;
+        }
+        free(pIpNetTable);
+        return (NULL);
+    }
+
+    create_flag = 0;
+    memcpy((char *) name, (char *) lowest, oid_length * sizeof(oid));
+    *length = oid_length;
+    *write_method = write_arp;
+    *arp_row = pIpNetTable->table[i];
+
+    switch (vp->magic) {
+    case IPMEDIAIFINDEX:       /* also ATIFINDEX */
+        *var_len = sizeof long_return;
+        long_return = pIpNetTable->table[i].dwIndex;
+        free(pIpNetTable);
+        return (u_char *) & long_return;
+    case IPMEDIAPHYSADDRESS:   /* also ATPHYSADDRESS */
+        *var_len = pIpNetTable->table[i].dwPhysAddrLen;
+        memcpy(return_buf, pIpNetTable->table[i].bPhysAddr, *var_len);
+        free(pIpNetTable);
+        return (u_char *) return_buf;
+    case IPMEDIANETADDRESS:    /* also ATNETADDRESS */
+        *var_len = sizeof long_return;
+        long_return = pIpNetTable->table[i].dwAddr;
+        free(pIpNetTable);
+        return (u_char *) & long_return;
+    case IPMEDIATYPE:
+        *var_len = sizeof long_return;
+        long_return = pIpNetTable->table[i].dwType;
+        free(pIpNetTable);
+        return (u_char *) & long_return;
+    default:
+        DEBUGMSGTL(("snmpd", "unknown sub-id %d in var_atEntry\n",
+                    vp->magic));
+    }
+    return NULL;
+}
+
+int
+write_arp(int action,
+          u_char * var_val,
+          u_char var_val_type,
+          size_t var_val_len, u_char * statP, oid * name, size_t length)
+{
+    int             var, retval = SNMP_ERR_NOERROR;
+    static PMIB_IPNETROW oldarp_row = NULL;
+    MIB_IPNETROW    temp_row;
+    DWORD           status = NO_ERROR;
+
+    /*
+     * IP Net to Media table object identifier is of form:
+     * 1.3.6.1.2.1.4.22.1.?.interface.A.B.C.D,  where A.B.C.D is IP address.
+     * Interface is at offset 10,
+     * IPADDR starts at offset 11.
+     */
+
+    if (name[6] == 3) {         /* AT group oid */
+        if (length != 16) {
+            snmp_log(LOG_ERR, "length error\n");
+            return SNMP_ERR_NOCREATION;
+        }
+    } else {                    /* IP NetToMedia group oid */
+        if (length != 15) {
+            snmp_log(LOG_ERR, "length error\n");
+            return SNMP_ERR_NOCREATION;
+        }
+    }
+
+
+    /*
+     * #define for ipNetToMediaTable entries are 1 less than corresponding sub-id in MIB
+     * * i.e. IPMEDIAIFINDEX defined as 0, but ipNetToMediaIfIndex registered as 1
+     */
+    var = name[9] - 1;
+    switch (action) {
+    case RESERVE1:
+        switch (var) {
+        case IPMEDIAIFINDEX:
+            if (var_val_type != ASN_INTEGER) {
+                snmp_log(LOG_ERR, "not integer\n");
+                return SNMP_ERR_WRONGTYPE;
+            }
+            if ((*((int *) var_val)) < 0) {
+                snmp_log(LOG_ERR, "invalid media ifIndex");
+                return SNMP_ERR_WRONGVALUE;
+            }
+            if (var_val_len > sizeof(int)) {
+                snmp_log(LOG_ERR, "bad length\n");
+                return SNMP_ERR_WRONGLENGTH;
+            }
+            break;
+        case IPMEDIANETADDRESS:
+            if (var_val_type != ASN_IPADDRESS) {
+                snmp_log(LOG_ERR, "not IP Address\n");
+                return SNMP_ERR_WRONGTYPE;
+            }
+            if ((*((int *) var_val)) < 0) {
+                snmp_log(LOG_ERR, "invalid media net address");
+                return SNMP_ERR_WRONGVALUE;
+            }
+            if (var_val_len > sizeof(DWORD)) {
+                snmp_log(LOG_ERR, "bad length\n");
+                return SNMP_ERR_WRONGLENGTH;
+            }
+            break;
+        case IPMEDIATYPE:
+            if (var_val_type != ASN_INTEGER) {
+                snmp_log(LOG_ERR, "not integer\n");
+                return SNMP_ERR_WRONGTYPE;
+            }
+            if ((*((int *) var_val)) < 1 || (*((int *) var_val)) > 4) {
+                snmp_log(LOG_ERR, "invalid media type");
+                return SNMP_ERR_WRONGVALUE;
+            }
+            if (var_val_len > sizeof(int)) {
+                snmp_log(LOG_ERR, "bad length\n");
+                return SNMP_ERR_WRONGLENGTH;
+            }
+            break;
+        case IPMEDIAPHYSADDRESS:
+            if (var_val_type != ASN_OCTET_STR) {
+                snmp_log(LOG_ERR, "not octet str");
+                return SNMP_ERR_WRONGTYPE;
+            }
+            if (var_val_len != 6) {
+                snmp_log(LOG_ERR, "not correct ipAddress length: %d",
+                         var_val_len);
+                return SNMP_ERR_WRONGLENGTH;
+            }
+            break;
+        default:
+            DEBUGMSGTL(("snmpd", "unknown sub-id %d in write_rte\n",
+                        var + 1));
+            return SNMP_ERR_NOTWRITABLE;
+        }
+        break;
+    case RESERVE2:
+        /*
+         * Save the old value, in case of UNDO 
+         */
+        if (oldarp_row == NULL) {
+            oldarp_row = (PMIB_IPNETROW) malloc(sizeof(MIB_IPNETROW));
+            *oldarp_row = *arp_row;
+        }
+        break;
+    case ACTION:               /* Perform the SET action (if reversible) */
+        switch (var) {
+
+        case IPMEDIAIFINDEX:
+            temp_row = *arp_row;
+            arp_row->dwIndex = *((int *) var_val);
+            /*
+             * In case of new entry, physical address is mandatory.
+             * * SetIpNetEntry will be done in COMMIT case 
+             */
+            if (!create_flag) {
+                if (SetIpNetEntry(arp_row) != NO_ERROR) {
+                    arp_row->dwIndex = temp_row.dwIndex;
+                    retval = SNMP_ERR_COMMITFAILED;
+                }
+                /*
+                 * Don't know yet, whether change in ifIndex creates new row or not 
+                 */
+                /*
+                 * else{ 
+                 */
+                /*
+                 * temp_row.dwType = 2; 
+                 */
+                /*
+                 * if(SetIpNetEntry(&temp_row) != NO_ERROR) 
+                 */
+                /*
+                 * retval = SNMP_ERR_COMMITFAILED; 
+                 */
+                /*
+                 * } 
+                 */
+            }
+            break;
+        case IPMEDIANETADDRESS:
+            temp_row = *arp_row;
+            arp_row->dwAddr = *((int *) var_val);
+            if (!create_flag) {
+                if (SetIpNetEntry(arp_row) != NO_ERROR) {
+                    arp_row->dwAddr = oldarp_row->dwAddr;
+                    retval = SNMP_ERR_COMMITFAILED;
+                } else {
+                    temp_row.dwType = 2;
+                    if (SetIpNetEntry(&temp_row) != NO_ERROR) {
+                        snmp_log(LOG_ERR,
+                                 "Failed in ACTION, while deleting old row \n");
+                        retval = SNMP_ERR_COMMITFAILED;
+                    }
+                }
+            }
+            break;
+        case IPMEDIATYPE:
+            arp_row->dwType = *((int *) var_val);
+            if (!create_flag) {
+                if (SetIpNetEntry(arp_row) != NO_ERROR)
+                    retval = SNMP_ERR_COMMITFAILED;
+            }
+            break;
+        case IPMEDIAPHYSADDRESS:
+            memcpy(arp_row->bPhysAddr, var_val, var_val_len);
+            arp_row->dwPhysAddrLen = var_val_len;
+            if (!create_flag) {
+                if (SetIpNetEntry(arp_row) != NO_ERROR)
+                    retval = SNMP_ERR_COMMITFAILED;
+            }
+            break;
+        default:
+            DEBUGMSGTL(("snmpd", "unknown sub-id %d in write_arp\n",
+                        var + 1));
+            retval = SNMP_ERR_NOTWRITABLE;
+        }
+        return retval;
+    case UNDO:
+        /*
+         * Reverse the SET action and free resources 
+         */
+        if (oldarp_row != NULL) {
+            /*
+             * UNDO the changes done for existing entry. 
+             */
+            if (!create_flag) {
+                if ((status = SetIpNetEntry(oldarp_row)) != NO_ERROR) {
+                    snmp_log(LOG_ERR, "Error in case UNDO, status : %d\n",
+                             status);
+                    retval = SNMP_ERR_UNDOFAILED;
+                }
+            }
+
+            if (oldarp_row->dwAddr != arp_row->dwAddr) {
+                arp_row->dwType = 2;    /*If row was added/created delete that row */
+
+                if ((status = SetIpNetEntry(arp_row)) != NO_ERROR) {
+                    snmp_log(LOG_ERR,
+                             "Error while deleting added row, status : %d\n",
+                             status);
+                    retval = SNMP_ERR_UNDOFAILED;
+                }
+            }
+            free(oldarp_row);
+            oldarp_row = NULL;
+            free(arp_row);
+            arp_row = NULL;
+            return retval;
+        }
+        break;
+    case COMMIT:
+        /*
+         * if new entry and physical address specified, create new entry 
+         */
+        if (create_flag) {
+            if (arp_row->dwPhysAddrLen != 0) {
+                if ((status = CreateIpNetEntry(arp_row)) != NO_ERROR) {
+                    snmp_log(LOG_ERR,
+                             "Inside COMMIT: CreateIpNetEntry failed, status %d\n",
+                             status);
+                    retval = SNMP_ERR_COMMITFAILED;
+                }
+            } else {
+                /*
+                 * For new entry, physical address must be set. 
+                 */
+                snmp_log(LOG_ERR,
+                         "Can't create new entry without physical address\n");
+                retval = SNMP_ERR_WRONGVALUE;
+            }
+            /*
+             * unset the create_flag, so that CreateIpNetEntry called only once 
+             */
+            create_flag = 0;
+        }
+
+    case FREE:
+        /*
+         * Free any resources allocated 
+         */
+        free(oldarp_row);
+        oldarp_row = NULL;
+        free(arp_row);
+        arp_row = NULL;
+        break;
+    }
+    return retval;
+}
+#endif                          /* WIN32 */
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/mibII/at.h tomato121/release/src/router/snmp/agent/mibgroup/mibII/at.h
--- tomato/release/src/router/snmp/agent/mibgroup/mibII/at.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/mibII/at.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,45 @@
+/*
+ *  Template MIB group interface - at.h
+ *
+ */
+
+#ifndef _MIBGROUP_AT_H
+#define _MIBGROUP_AT_H
+
+config_arch_require(solaris2, kernel_sunos5)
+
+     extern void     init_at(void);
+     extern FindVarMethod var_atEntry;
+
+
+#define ATIFINDEX	0
+#define ATPHYSADDRESS	1
+#define ATNETADDRESS	2
+
+#define IPMEDIAIFINDEX          0
+#define IPMEDIAPHYSADDRESS      1
+#define IPMEDIANETADDRESS       2
+#define IPMEDIATYPE             3
+
+/*
+ * in case its missing: 
+ */
+#ifndef ATF_PERM
+# define ATF_PERM	0x04
+#endif                          /*  ATF_PERM */
+#ifndef ATF_COM
+# define ATF_COM	0x02
+#endif                          /*  ATF_COM */
+
+#if defined(linux) || defined(irix6)
+/*
+ * arp struct to pass flags, hw-addr and ip-addr in bsd manner:
+ */
+     struct arptab {
+         int             at_flags;
+         char            at_enaddr[6];
+         struct in_addr  at_iaddr;
+         int             if_index;
+     };
+#endif
+#endif                          /* _MIBGROUP_AT_H */
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/mibII/.cvsignore tomato121/release/src/router/snmp/agent/mibgroup/mibII/.cvsignore
--- tomato/release/src/router/snmp/agent/mibgroup/mibII/.cvsignore	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/mibII/.cvsignore	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,3 @@
+.libs
+*.lo
+Makefile
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/mibII/icmp.c tomato121/release/src/router/snmp/agent/mibgroup/mibII/icmp.c
--- tomato/release/src/router/snmp/agent/mibgroup/mibII/icmp.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/mibII/icmp.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,640 @@
+/*
+ *  ICMP MIB group implementation - icmp.c
+ *
+ */
+
+#include <net-snmp/net-snmp-config.h>
+
+#if defined(IFNET_NEEDS_KERNEL) && !defined(_KERNEL)
+#define _KERNEL 1
+#define _I_DEFINED_KERNEL
+#endif
+#if HAVE_SYS_PARAM_H
+#include <sys/param.h>
+#endif
+#if HAVE_SYS_SOCKET_H
+#include <sys/socket.h>
+#endif
+
+#if HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+#if HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+#if HAVE_SYS_SYSMP_H
+#include <sys/sysmp.h>
+#endif
+#if HAVE_SYS_TCPIPSTATS_H
+#include <sys/tcpipstats.h>
+#endif
+#if HAVE_NET_IF_H
+#include <net/if.h>
+#endif
+#if HAVE_NET_IF_VAR_H
+#include <net/if_var.h>
+#endif
+#ifdef _I_DEFINED_KERNEL
+#undef _KERNEL
+#endif
+#if HAVE_NETINET_IN_SYSTM_H
+#include <netinet/in_systm.h>
+#endif
+#if HAVE_NETINET_IP_H
+#include <netinet/ip.h>
+#endif
+
+#if HAVE_NETINET_IP_ICMP_H
+#include <netinet/ip_icmp.h>
+#endif
+#if HAVE_NETINET_ICMP_VAR_H
+#include <netinet/icmp_var.h>
+#endif
+
+#if HAVE_SYS_SYSCTL_H
+#include <sys/sysctl.h>
+#endif
+#if HAVE_INET_MIB2_H
+#include <inet/mib2.h>
+#endif
+
+#if HAVE_WINSOCK_H
+#include <winsock.h>
+#endif
+
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include <net-snmp/agent/auto_nlist.h>
+
+#ifdef solaris2
+#include "kernel_sunos5.h"
+#endif
+#ifdef linux
+#include "kernel_linux.h"
+#endif
+
+#include "util_funcs.h"
+
+#ifdef hpux
+#include <sys/mib.h>
+#include <netinet/mib_kern.h>
+#endif                          /* hpux */
+
+#include "icmp.h"
+#include "sysORTable.h"
+
+#if HAVE_DMALLOC_H
+#include <dmalloc.h>
+#endif
+
+#ifndef MIB_STATS_CACHE_TIMEOUT
+#define MIB_STATS_CACHE_TIMEOUT	5
+#endif
+#ifndef ICMP_STATS_CACHE_TIMEOUT
+#define ICMP_STATS_CACHE_TIMEOUT	MIB_STATS_CACHE_TIMEOUT
+#endif
+marker_t        icmp_stats_cache_marker = NULL;
+
+        /*********************
+	 *
+	 *  Kernel & interface information,
+	 *   and internal forward declarations
+	 *
+	 *********************/
+
+
+        /*********************
+	 *
+	 *  Initialisation & common implementation functions
+	 *
+	 *********************/
+
+
+/*
+ * define the structure we're going to ask the agent to register our
+ * information at 
+ */
+struct variable1 icmp_variables[] = {
+    {ICMPINMSGS, ASN_COUNTER, RONLY, var_icmp, 1, {1}},
+    {ICMPINERRORS, ASN_COUNTER, RONLY, var_icmp, 1, {2}},
+    {ICMPINDESTUNREACHS, ASN_COUNTER, RONLY, var_icmp, 1, {3}},
+    {ICMPINTIMEEXCDS, ASN_COUNTER, RONLY, var_icmp, 1, {4}},
+    {ICMPINPARMPROBS, ASN_COUNTER, RONLY, var_icmp, 1, {5}},
+    {ICMPINSRCQUENCHS, ASN_COUNTER, RONLY, var_icmp, 1, {6}},
+    {ICMPINREDIRECTS, ASN_COUNTER, RONLY, var_icmp, 1, {7}},
+    {ICMPINECHOS, ASN_COUNTER, RONLY, var_icmp, 1, {8}},
+    {ICMPINECHOREPS, ASN_COUNTER, RONLY, var_icmp, 1, {9}},
+    {ICMPINTIMESTAMPS, ASN_COUNTER, RONLY, var_icmp, 1, {10}},
+    {ICMPINTIMESTAMPREPS, ASN_COUNTER, RONLY, var_icmp, 1, {11}},
+    {ICMPINADDRMASKS, ASN_COUNTER, RONLY, var_icmp, 1, {12}},
+    {ICMPINADDRMASKREPS, ASN_COUNTER, RONLY, var_icmp, 1, {13}},
+    {ICMPOUTMSGS, ASN_COUNTER, RONLY, var_icmp, 1, {14}},
+    {ICMPOUTERRORS, ASN_COUNTER, RONLY, var_icmp, 1, {15}},
+    {ICMPOUTDESTUNREACHS, ASN_COUNTER, RONLY, var_icmp, 1, {16}},
+    {ICMPOUTTIMEEXCDS, ASN_COUNTER, RONLY, var_icmp, 1, {17}},
+    {ICMPOUTPARMPROBS, ASN_COUNTER, RONLY, var_icmp, 1, {18}},
+    {ICMPOUTSRCQUENCHS, ASN_COUNTER, RONLY, var_icmp, 1, {19}},
+    {ICMPOUTREDIRECTS, ASN_COUNTER, RONLY, var_icmp, 1, {20}},
+    {ICMPOUTECHOS, ASN_COUNTER, RONLY, var_icmp, 1, {21}},
+    {ICMPOUTECHOREPS, ASN_COUNTER, RONLY, var_icmp, 1, {22}},
+    {ICMPOUTTIMESTAMPS, ASN_COUNTER, RONLY, var_icmp, 1, {23}},
+    {ICMPOUTTIMESTAMPREPS, ASN_COUNTER, RONLY, var_icmp, 1, {24}},
+    {ICMPOUTADDRMASKS, ASN_COUNTER, RONLY, var_icmp, 1, {25}},
+    {ICMPOUTADDRMASKREPS, ASN_COUNTER, RONLY, var_icmp, 1, {26}}
+};
+
+/*
+ * Define the OID pointer to the top of the mib tree that we're
+ * registering underneath 
+ */
+oid             icmp_variables_oid[] = { SNMP_OID_MIB2, 5 };
+#ifdef USING_MIBII_IP_MODULE
+extern oid      ip_module_oid[];
+extern int      ip_module_oid_len;
+extern int      ip_module_count;
+#endif
+
+void
+init_icmp(void)
+{
+    /*
+     * register ourselves with the agent to handle our mib tree 
+     */
+    REGISTER_MIB("mibII/icmp", icmp_variables, variable1,
+                 icmp_variables_oid);
+
+#ifdef USING_MIBII_IP_MODULE
+    if (++ip_module_count == 2)
+        REGISTER_SYSOR_TABLE(ip_module_oid, ip_module_oid_len,
+                             "The MIB module for managing IP and ICMP implementations");
+#endif
+
+#ifdef ICMPSTAT_SYMBOL
+    auto_nlist(ICMPSTAT_SYMBOL, 0, 0);
+#endif
+#ifdef solaris2
+    init_kernel_sunos5();
+#endif
+}
+
+
+        /*********************
+	 *
+	 *  System specific implementation functions
+	 *
+	 *********************/
+
+#ifdef linux
+#define ICMP_STAT_STRUCTURE	struct icmp_mib
+#define USES_SNMP_DESIGNED_ICMPSTAT
+#undef ICMPSTAT_SYMBOL
+#endif
+
+#ifdef solaris2
+#define ICMP_STAT_STRUCTURE	mib2_icmp_t
+#define USES_SNMP_DESIGNED_ICMPSTAT
+#endif
+
+#ifdef cygwin
+#define WIN32
+#include <windows.h>
+#endif
+
+#ifdef hpux11
+#define ICMP_STAT_STRUCTURE	int
+#endif
+
+#ifdef WIN32
+#include <iphlpapi.h>
+#define ICMP_STAT_STRUCTURE MIB_ICMP
+#endif
+
+#ifdef HAVE_SYS_ICMPIPSTATS_H
+#define ICMP_STAT_STRUCTURE	struct kna
+#define USES_TRADITIONAL_ICMPSTAT
+#endif
+
+#if !defined(ICMP_STAT_STRUCTURE)
+#define ICMP_STAT_STRUCTURE	struct icmpstat
+#define USES_TRADITIONAL_ICMPSTAT
+#endif
+
+long            read_icmp_stat(ICMP_STAT_STRUCTURE *, int);
+
+
+u_char         *
+var_icmp(struct variable *vp,
+         oid * name,
+         size_t * length,
+         int exact, size_t * var_len, WriteMethod ** write_method)
+{
+    static ICMP_STAT_STRUCTURE icmpstat;
+    static long     ret_value;
+#ifdef USES_TRADITIONAL_ICMPSTAT
+    int             i;
+#endif
+
+    if (header_generic(vp, name, length, exact, var_len, write_method) ==
+        MATCH_FAILED)
+        return NULL;
+
+    ret_value = read_icmp_stat(&icmpstat, vp->magic);
+    if (ret_value < 0)
+        return NULL;
+
+#ifdef HAVE_SYS_TCPIPSTATS_H
+    /*
+     * This actually reads statistics for *all* the groups together,
+     * so we need to isolate the ICMP-specific bits.  
+     */
+#ifndef NO_DOUBLE_ICMPSTAT
+#define icmpstat          icmpstat.icmpstat
+#endif                          /* NO_ICMPSTATICMPSTAT */
+#endif
+
+
+    switch (vp->magic) {
+#ifdef USES_SNMP_DESIGNED_ICMPSTAT
+    case ICMPINMSGS:
+        return (u_char *) & icmpstat.icmpInMsgs;
+    case ICMPINERRORS:
+        return (u_char *) & icmpstat.icmpInErrors;
+    case ICMPINDESTUNREACHS:
+        return (u_char *) & icmpstat.icmpInDestUnreachs;
+    case ICMPINTIMEEXCDS:
+        return (u_char *) & icmpstat.icmpInTimeExcds;
+    case ICMPINPARMPROBS:
+        return (u_char *) & icmpstat.icmpInParmProbs;
+    case ICMPINSRCQUENCHS:
+        return (u_char *) & icmpstat.icmpInSrcQuenchs;
+    case ICMPINREDIRECTS:
+        return (u_char *) & icmpstat.icmpInRedirects;
+    case ICMPINECHOS:
+        return (u_char *) & icmpstat.icmpInEchos;
+    case ICMPINECHOREPS:
+        return (u_char *) & icmpstat.icmpInEchoReps;
+    case ICMPINTIMESTAMPS:
+        return (u_char *) & icmpstat.icmpInTimestamps;
+    case ICMPINTIMESTAMPREPS:
+        return (u_char *) & icmpstat.icmpInTimestampReps;
+    case ICMPINADDRMASKS:
+        return (u_char *) & icmpstat.icmpInAddrMasks;
+    case ICMPINADDRMASKREPS:
+        return (u_char *) & icmpstat.icmpInAddrMaskReps;
+    case ICMPOUTMSGS:
+        return (u_char *) & icmpstat.icmpOutMsgs;
+    case ICMPOUTERRORS:
+        return (u_char *) & icmpstat.icmpOutErrors;
+    case ICMPOUTDESTUNREACHS:
+        return (u_char *) & icmpstat.icmpOutDestUnreachs;
+    case ICMPOUTTIMEEXCDS:
+        return (u_char *) & icmpstat.icmpOutTimeExcds;
+    case ICMPOUTPARMPROBS:
+        return (u_char *) & icmpstat.icmpOutParmProbs;
+    case ICMPOUTSRCQUENCHS:
+        return (u_char *) & icmpstat.icmpOutSrcQuenchs;
+    case ICMPOUTREDIRECTS:
+        return (u_char *) & icmpstat.icmpOutRedirects;
+    case ICMPOUTECHOS:
+        return (u_char *) & icmpstat.icmpOutEchos;
+    case ICMPOUTECHOREPS:
+        return (u_char *) & icmpstat.icmpOutEchoReps;
+    case ICMPOUTTIMESTAMPS:
+        return (u_char *) & icmpstat.icmpOutTimestamps;
+    case ICMPOUTTIMESTAMPREPS:
+        return (u_char *) & icmpstat.icmpOutTimestampReps;
+    case ICMPOUTADDRMASKS:
+        return (u_char *) & icmpstat.icmpOutAddrMasks;
+    case ICMPOUTADDRMASKREPS:
+        return (u_char *) & icmpstat.icmpOutAddrMaskReps;
+#endif                          /* USES_SNMP_DESIGNED_ICMPSTAT */
+
+#ifdef USES_TRADITIONAL_ICMPSTAT
+
+    case ICMPINMSGS:
+        long_return = icmpstat.icps_badcode +
+            icmpstat.icps_tooshort +
+            icmpstat.icps_checksum + icmpstat.icps_badlen;
+        for (i = 0; i <= ICMP_MAXTYPE; i++)
+            long_return += icmpstat.icps_inhist[i];
+        return (u_char *) & long_return;
+    case ICMPINERRORS:
+        long_return = icmpstat.icps_badcode +
+            icmpstat.icps_tooshort +
+            icmpstat.icps_checksum + icmpstat.icps_badlen;
+        return (u_char *) & long_return;
+    case ICMPINDESTUNREACHS:
+        return (u_char *) & icmpstat.icps_inhist[ICMP_UNREACH];
+    case ICMPINTIMEEXCDS:
+        return (u_char *) & icmpstat.icps_inhist[ICMP_TIMXCEED];
+    case ICMPINPARMPROBS:
+        return (u_char *) & icmpstat.icps_inhist[ICMP_PARAMPROB];
+    case ICMPINSRCQUENCHS:
+        return (u_char *) & icmpstat.icps_inhist[ICMP_SOURCEQUENCH];
+    case ICMPINREDIRECTS:
+        return (u_char *) & icmpstat.icps_inhist[ICMP_REDIRECT];
+    case ICMPINECHOS:
+        return (u_char *) & icmpstat.icps_inhist[ICMP_ECHO];
+    case ICMPINECHOREPS:
+        return (u_char *) & icmpstat.icps_inhist[ICMP_ECHOREPLY];
+    case ICMPINTIMESTAMPS:
+        return (u_char *) & icmpstat.icps_inhist[ICMP_TSTAMP];
+    case ICMPINTIMESTAMPREPS:
+        return (u_char *) & icmpstat.icps_inhist[ICMP_TSTAMPREPLY];
+    case ICMPINADDRMASKS:
+        return (u_char *) & icmpstat.icps_inhist[ICMP_MASKREQ];
+    case ICMPINADDRMASKREPS:
+        return (u_char *) & icmpstat.icps_inhist[ICMP_MASKREPLY];
+    case ICMPOUTMSGS:
+        long_return = icmpstat.icps_oldshort + icmpstat.icps_oldicmp;
+        for (i = 0; i <= ICMP_MAXTYPE; i++)
+            long_return += icmpstat.icps_outhist[i];
+        return (u_char *) & long_return;
+    case ICMPOUTERRORS:
+        long_return = icmpstat.icps_oldshort + icmpstat.icps_oldicmp;
+        return (u_char *) & long_return;
+    case ICMPOUTDESTUNREACHS:
+        return (u_char *) & icmpstat.icps_outhist[ICMP_UNREACH];
+    case ICMPOUTTIMEEXCDS:
+        return (u_char *) & icmpstat.icps_outhist[ICMP_TIMXCEED];
+    case ICMPOUTPARMPROBS:
+        return (u_char *) & icmpstat.icps_outhist[ICMP_PARAMPROB];
+    case ICMPOUTSRCQUENCHS:
+        return (u_char *) & icmpstat.icps_outhist[ICMP_SOURCEQUENCH];
+    case ICMPOUTREDIRECTS:
+        return (u_char *) & icmpstat.icps_outhist[ICMP_REDIRECT];
+    case ICMPOUTECHOS:
+        return (u_char *) & icmpstat.icps_outhist[ICMP_ECHO];
+    case ICMPOUTECHOREPS:
+        return (u_char *) & icmpstat.icps_outhist[ICMP_ECHOREPLY];
+    case ICMPOUTTIMESTAMPS:
+        return (u_char *) & icmpstat.icps_outhist[ICMP_TSTAMP];
+    case ICMPOUTTIMESTAMPREPS:
+        return (u_char *) & icmpstat.icps_outhist[ICMP_TSTAMPREPLY];
+    case ICMPOUTADDRMASKS:
+        return (u_char *) & icmpstat.icps_outhist[ICMP_MASKREQ];
+    case ICMPOUTADDRMASKREPS:
+        return (u_char *) & icmpstat.icps_outhist[ICMP_MASKREPLY];
+#endif                          /* USES_TRADITIONAL_ICMPSTAT */
+
+#ifdef hpux11
+    case ICMPINMSGS:
+    case ICMPINERRORS:
+    case ICMPINDESTUNREACHS:
+    case ICMPINTIMEEXCDS:
+    case ICMPINPARMPROBS:
+    case ICMPINSRCQUENCHS:
+    case ICMPINREDIRECTS:
+    case ICMPINECHOS:
+    case ICMPINECHOREPS:
+    case ICMPINTIMESTAMPS:
+    case ICMPINTIMESTAMPREPS:
+    case ICMPINADDRMASKS:
+    case ICMPINADDRMASKREPS:
+    case ICMPOUTMSGS:
+    case ICMPOUTERRORS:
+    case ICMPOUTDESTUNREACHS:
+    case ICMPOUTTIMEEXCDS:
+    case ICMPOUTPARMPROBS:
+    case ICMPOUTSRCQUENCHS:
+    case ICMPOUTREDIRECTS:
+    case ICMPOUTECHOS:
+    case ICMPOUTECHOREPS:
+    case ICMPOUTTIMESTAMPS:
+    case ICMPOUTTIMESTAMPREPS:
+    case ICMPOUTADDRMASKS:
+    case ICMPOUTADDRMASKREPS:
+        long_return = icmpstat;
+        return (u_char *) & long_return;
+#endif                          /* hpux11 */
+
+#ifdef WIN32
+    case ICMPINMSGS:
+        return (u_char *) & icmpstat.stats.icmpInStats.dwMsgs;
+    case ICMPINERRORS:
+        return (u_char *) & icmpstat.stats.icmpInStats.dwErrors;
+    case ICMPINDESTUNREACHS:
+        return (u_char *) & icmpstat.stats.icmpInStats.dwDestUnreachs;
+    case ICMPINTIMEEXCDS:
+        return (u_char *) & icmpstat.stats.icmpInStats.dwTimeExcds;
+    case ICMPINPARMPROBS:
+        return (u_char *) & icmpstat.stats.icmpInStats.dwParmProbs;
+    case ICMPINSRCQUENCHS:
+        return (u_char *) & icmpstat.stats.icmpInStats.dwSrcQuenchs;
+    case ICMPINREDIRECTS:
+        return (u_char *) & icmpstat.stats.icmpInStats.dwRedirects;
+    case ICMPINECHOS:
+        return (u_char *) & icmpstat.stats.icmpInStats.dwEchos;
+    case ICMPINECHOREPS:
+        return (u_char *) & icmpstat.stats.icmpInStats.dwEchoReps;
+    case ICMPINTIMESTAMPS:
+        return (u_char *) & icmpstat.stats.icmpInStats.dwTimestamps;
+    case ICMPINTIMESTAMPREPS:
+        return (u_char *) & icmpstat.stats.icmpInStats.dwTimestampReps;
+    case ICMPINADDRMASKS:
+        return (u_char *) & icmpstat.stats.icmpInStats.dwAddrMasks;
+    case ICMPINADDRMASKREPS:
+        return (u_char *) & icmpstat.stats.icmpInStats.dwAddrMaskReps;
+    case ICMPOUTMSGS:
+        return (u_char *) & icmpstat.stats.icmpOutStats.dwMsgs;
+    case ICMPOUTERRORS:
+        return (u_char *) & icmpstat.stats.icmpOutStats.dwErrors;
+    case ICMPOUTDESTUNREACHS:
+        return (u_char *) & icmpstat.stats.icmpOutStats.dwDestUnreachs;
+    case ICMPOUTTIMEEXCDS:
+        return (u_char *) & icmpstat.stats.icmpOutStats.dwTimeExcds;
+    case ICMPOUTPARMPROBS:
+        return (u_char *) & icmpstat.stats.icmpOutStats.dwParmProbs;
+    case ICMPOUTSRCQUENCHS:
+        return (u_char *) & icmpstat.stats.icmpOutStats.dwSrcQuenchs;
+    case ICMPOUTREDIRECTS:
+        return (u_char *) & icmpstat.stats.icmpOutStats.dwRedirects;
+    case ICMPOUTECHOS:
+        return (u_char *) & icmpstat.stats.icmpOutStats.dwEchos;
+    case ICMPOUTECHOREPS:
+        return (u_char *) & icmpstat.stats.icmpOutStats.dwEchoReps;
+    case ICMPOUTTIMESTAMPS:
+        return (u_char *) & icmpstat.stats.icmpOutStats.dwTimestamps;
+    case ICMPOUTTIMESTAMPREPS:
+        return (u_char *) & icmpstat.stats.icmpOutStats.dwTimestampReps;
+    case ICMPOUTADDRMASKS:
+        return (u_char *) & icmpstat.stats.icmpOutStats.dwAddrMasks;
+    case ICMPOUTADDRMASKREPS:
+        return (u_char *) & icmpstat.stats.icmpOutStats.dwAddrMaskReps;
+#endif                          /* WIN32 */
+
+    default:
+        DEBUGMSGTL(("snmpd", "unknown sub-id %d in var_icmp\n",
+                    vp->magic));
+    }
+
+    return NULL;
+}
+
+
+        /*********************
+	 *
+	 *  Internal implementation functions
+	 *
+	 *********************/
+
+long
+read_icmp_stat(ICMP_STAT_STRUCTURE * icmpstat, int magic)
+{
+#ifdef hpux11
+    int             fd;
+    struct nmparms  p;
+    unsigned int    ulen;
+    int             ret;
+
+    if ((fd = open_mib("/dev/ip", O_RDONLY, 0, NM_ASYNC_OFF)) < 0)
+        return (-1);            /* error */
+
+    switch (magic) {
+    case ICMPINMSGS:
+        p.objid = ID_icmpInMsgs;
+        break;
+    case ICMPINERRORS:
+        p.objid = ID_icmpInErrors;
+        break;
+    case ICMPINDESTUNREACHS:
+        p.objid = ID_icmpInDestUnreachs;
+        break;
+    case ICMPINTIMEEXCDS:
+        p.objid = ID_icmpInTimeExcds;
+        break;
+    case ICMPINPARMPROBS:
+        p.objid = ID_icmpInParmProbs;
+        break;
+    case ICMPINSRCQUENCHS:
+        p.objid = ID_icmpInSrcQuenchs;
+        break;
+    case ICMPINREDIRECTS:
+        p.objid = ID_icmpInRedirects;
+        break;
+    case ICMPINECHOS:
+        p.objid = ID_icmpInEchos;
+        break;
+    case ICMPINECHOREPS:
+        p.objid = ID_icmpInEchoReps;
+        break;
+    case ICMPINTIMESTAMPS:
+        p.objid = ID_icmpInTimestamps;
+        break;
+    case ICMPINTIMESTAMPREPS:
+        p.objid = ID_icmpInTimestampReps;
+        break;
+    case ICMPINADDRMASKS:
+        p.objid = ID_icmpInAddrMasks;
+        break;
+    case ICMPINADDRMASKREPS:
+        p.objid = ID_icmpInAddrMaskReps;
+        break;
+    case ICMPOUTMSGS:
+        p.objid = ID_icmpOutMsgs;
+        break;
+    case ICMPOUTERRORS:
+        p.objid = ID_icmpOutErrors;
+        break;
+    case ICMPOUTDESTUNREACHS:
+        p.objid = ID_icmpOutDestUnreachs;
+        break;
+    case ICMPOUTTIMEEXCDS:
+        p.objid = ID_icmpOutTimeExcds;
+        break;
+    case ICMPOUTPARMPROBS:
+        p.objid = ID_icmpOutParmProbs;
+        break;
+    case ICMPOUTSRCQUENCHS:
+        p.objid = ID_icmpOutSrcQuenchs;
+        break;
+    case ICMPOUTREDIRECTS:
+        p.objid = ID_icmpOutRedirects;
+        break;
+    case ICMPOUTECHOS:
+        p.objid = ID_icmpOutEchos;
+        break;
+    case ICMPOUTECHOREPS:
+        p.objid = ID_icmpOutEchoReps;
+        break;
+    case ICMPOUTTIMESTAMPS:
+        p.objid = ID_icmpOutTimestamps;
+        break;
+    case ICMPOUTTIMESTAMPREPS:
+        p.objid = ID_icmpOutTimestampReps;
+        break;
+    case ICMPOUTADDRMASKS:
+        p.objid = ID_icmpOutAddrMasks;
+        break;
+    case ICMPOUTADDRMASKREPS:
+        p.objid = ID_icmpOutAddrMaskReps;
+        break;
+    default:
+        *icmpstat = 0;
+        close_mib(fd);
+        return (0);
+    }
+
+    p.buffer = (void *) icmpstat;
+    ulen = sizeof(ICMP_STAT_STRUCTURE);
+    p.len = &ulen;
+    ret = get_mib_info(fd, &p);
+    close_mib(fd);
+
+    return (ret);               /* 0: ok, < 0: error */
+#else                           /* hpux11 */
+    long            ret_value = -1;
+#if (defined(CAN_USE_SYSCTL) && defined(ICMPCTL_STATS))
+    static int      sname[4] =
+        { CTL_NET, PF_INET, IPPROTO_ICMP, ICMPCTL_STATS };
+    size_t          len = sizeof(*icmpstat);
+#endif
+
+    if (icmp_stats_cache_marker &&
+        (!atime_ready
+         (icmp_stats_cache_marker, ICMP_STATS_CACHE_TIMEOUT * 1000)))
+        return 0;
+
+    if (icmp_stats_cache_marker)
+        atime_setMarker(icmp_stats_cache_marker);
+    else
+        icmp_stats_cache_marker = atime_newMarker();
+
+
+#ifdef linux
+    ret_value = linux_read_icmp_stat(icmpstat);
+#endif
+
+#ifdef solaris2
+    ret_value =
+        getMibstat(MIB_ICMP, icmpstat, sizeof(mib2_icmp_t), GET_FIRST,
+                   &Get_everything, NULL);
+#endif
+
+#ifdef WIN32
+    ret_value = GetIcmpStatistics(icmpstat);
+#endif
+
+#ifdef HAVE_SYS_TCPIPSTATS_H
+    ret_value =
+        sysmp(MP_SAGET, MPSA_TCPIPSTATS, icmpstat, sizeof *icmpstat);
+#endif
+
+#if defined(CAN_USE_SYSCTL) && defined(ICMPCTL_STATS)
+    ret_value = sysctl(sname, 4, icmpstat, &len, 0, 0);
+#endif
+
+#ifdef ICMPSTAT_SYMBOL
+    if (auto_nlist(ICMPSTAT_SYMBOL, (char *) icmpstat, sizeof(*icmpstat)))
+        ret_value = 0;
+#endif
+
+    if (ret_value == -1) {
+        free(icmp_stats_cache_marker);
+        icmp_stats_cache_marker = NULL;
+    }
+    return ret_value;
+#endif                          /* hpux11 */
+}
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/mibII/icmp.h tomato121/release/src/router/snmp/agent/mibgroup/mibII/icmp.h
--- tomato/release/src/router/snmp/agent/mibgroup/mibII/icmp.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/mibII/icmp.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,41 @@
+/*
+ *  ICMP MIB group interface - icmp.h
+ *
+ */
+#ifndef _MIBGROUP_ICMP_H
+#define _MIBGROUP_ICMP_H
+
+config_arch_require(solaris2, kernel_sunos5)
+config_arch_require(linux, mibII/kernel_linux)
+
+extern void     init_icmp(void);
+extern FindVarMethod var_icmp;
+
+#define ICMPINMSGS	     0
+#define ICMPINERRORS	     1
+#define ICMPINDESTUNREACHS   2
+#define ICMPINTIMEEXCDS      3
+#define ICMPINPARMPROBS      4
+#define ICMPINSRCQUENCHS     5
+#define ICMPINREDIRECTS      6
+#define ICMPINECHOS	     7
+#define ICMPINECHOREPS	     8
+#define ICMPINTIMESTAMPS     9
+#define ICMPINTIMESTAMPREPS 10
+#define ICMPINADDRMASKS     11
+#define ICMPINADDRMASKREPS  12
+#define ICMPOUTMSGS	    13
+#define ICMPOUTERRORS	    14
+#define ICMPOUTDESTUNREACHS 15
+#define ICMPOUTTIMEEXCDS    16
+#define ICMPOUTPARMPROBS    17
+#define ICMPOUTSRCQUENCHS   18
+#define ICMPOUTREDIRECTS    19
+#define ICMPOUTECHOS	    20
+#define ICMPOUTECHOREPS     21
+#define ICMPOUTTIMESTAMPS   22
+#define ICMPOUTTIMESTAMPREPS 23
+#define ICMPOUTADDRMASKS    24
+#define ICMPOUTADDRMASKREPS 25
+
+#endif                          /* _MIBGROUP_ICMP_H */
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/mibII/interfaces.c tomato121/release/src/router/snmp/agent/mibgroup/mibII/interfaces.c
--- tomato/release/src/router/snmp/agent/mibgroup/mibII/interfaces.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/mibII/interfaces.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,2860 @@
+/*
+ *  Interfaces MIB group implementation - interfaces.c
+ *
+ */
+
+#include <net-snmp/net-snmp-config.h>
+
+#if defined(IFNET_NEEDS_KERNEL) && !defined(_KERNEL) && !defined(IFNET_NEEDS_KERNEL_LATE)
+#define _KERNEL 1
+#define _I_DEFINED_KERNEL
+#endif
+
+#if HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+
+#if HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#if HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#if HAVE_SYS_PARAM_H
+#include <sys/param.h>
+#endif
+#include <sys/types.h>
+#if HAVE_WINSOCK_H
+#include <winsock.h>
+#endif
+#if defined(IFNET_NEEDS_KERNEL) && !defined(_KERNEL) && defined(IFNET_NEEDS_KERNEL_LATE)
+#define _KERNEL 1
+#define _I_DEFINED_KERNEL
+#endif
+#if HAVE_SYS_SOCKET_H
+#include <sys/socket.h>
+#endif
+#ifndef STREAM_NEEDS_KERNEL_ISLANDS
+#if HAVE_SYS_STREAM_H
+#include <sys/stream.h>
+#endif
+#endif
+#if HAVE_SYS_SOCKETVAR_H
+#include <sys/socketvar.h>
+#endif
+
+#if TIME_WITH_SYS_TIME
+# ifdef WIN32
+#  include <sys/timeb.h>
+# else
+# include <sys/time.h>
+# endif
+# include <time.h>
+#else
+# if HAVE_SYS_TIME_H
+#  include <sys/time.h>
+# else
+#  include <time.h>
+# endif
+#endif
+#if HAVE_SYS_SOCKIO_H
+#include <sys/sockio.h>
+#endif
+#if HAVE_FCNTL_H
+#include <fcntl.h>
+#endif
+#if HAVE_SYS_IOCTL_H
+#include <sys/ioctl.h>
+#endif
+#if HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+#if HAVE_NET_IF_H
+#include <net/if.h>
+#endif
+#if HAVE_NET_IF_VAR_H
+#include <net/if_var.h>
+#endif
+#ifdef _I_DEFINED_KERNEL
+#undef _KERNEL
+#endif
+#ifdef STREAM_NEEDS_KERNEL_ISLANDS
+#if HAVE_SYS_STREAM_H
+#include <sys/stream.h>
+#endif
+#endif
+#if HAVE_NET_ROUTE_H
+#include <net/route.h>
+#endif
+#if HAVE_NETINET_IN_SYSTM_H
+#include <netinet/in_systm.h>
+#endif
+#if HAVE_SYS_HASHING_H
+#include <sys/hashing.h>
+#endif
+#if HAVE_NETINET_IN_VAR_H
+#include <netinet/in_var.h>
+#endif
+#if HAVE_NETINET_IP_H
+#include <netinet/ip.h>
+#endif
+#ifdef INET6
+#if HAVE_NETINET_IP6_H
+#include <netinet/ip6.h>
+#endif
+#endif
+#if HAVE_SYS_QUEUE_H
+#include <sys/queue.h>
+#endif
+#if HAVE_NETINET_IP_VAR_H
+#include <netinet/ip_var.h>
+#endif
+#ifdef INET6
+#if HAVE_NETINET6_IP6_VAR_H
+#include <netinet6/ip6_var.h>
+#endif
+#endif
+#if HAVE_NETINET_IN_PCB_H
+#include <netinet/in_pcb.h>
+#endif
+#if HAVE_NETINET_IF_ETHER_H
+#include <netinet/if_ether.h>
+#endif
+#if HAVE_NET_IF_TYPES_H
+#include <net/if_types.h>
+#endif
+#if HAVE_NET_IF_DL_H
+#ifndef dynix
+#include <net/if_dl.h>
+#else
+#include <sys/net/if_dl.h>
+#endif
+#endif
+#if HAVE_INET_MIB2_H
+#include <inet/mib2.h>
+#endif
+#if HAVE_IOCTLS_H
+#include <ioctls.h>
+#endif
+
+#if HAVE_DMALLOC_H
+#include <dmalloc.h>
+#endif
+
+#ifdef solaris2
+# include <errno.h>
+#include "kernel_sunos5.h"
+#else
+#include "kernel.h"
+#endif
+
+#ifdef hpux
+#include <sys/mib.h>
+#include <netinet/mib_kern.h>
+#endif                          /* hpux */
+
+#ifdef cygwin
+#define WIN32
+#include <windows.h>
+#endif
+
+#if HAVE_SYS_SYSCTL_H
+#include <sys/sysctl.h>
+
+#if defined(freebsd3) || defined(freebsd4) || defined(freebsd5)
+#    define USE_SYSCTL_IFLIST
+#else
+# if defined(CTL_NET) && !defined(freebsd2) && !defined(netbsd1)
+#  ifdef PF_ROUTE
+#   ifdef NET_RT_IFLIST
+#    ifndef netbsd1
+#     define USE_SYSCTL_IFLIST
+#    endif
+#   endif
+#  endif
+# endif
+#endif                          /* defined(freebsd3) */
+#endif                          /* HAVE_SYS_SYSCTL_H */
+
+#if HAVE_OSRELDATE_H
+#include <osreldate.h>
+#endif
+#ifdef CAN_USE_SYSCTL
+#include <sys/sysctl.h>
+#endif
+
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include <net-snmp/agent/auto_nlist.h>
+
+#include "interfaces.h"
+#include "struct.h"
+#include "util_funcs.h"
+#include "sysORTable.h"
+
+extern struct timeval starttime;
+
+static void     parse_interface_config(const char *, char *);
+static void     free_interface_config(void);
+
+struct variable3 interfaces_variables[] = {
+    {IFNUMBER, ASN_INTEGER, RONLY, var_interfaces, 1, {1}},
+    {IFINDEX, ASN_INTEGER, RONLY, var_ifEntry, 3, {2, 1, 1}},
+    {IFDESCR, ASN_OCTET_STR, RONLY, var_ifEntry, 3, {2, 1, 2}},
+    {IFTYPE, ASN_INTEGER, RONLY, var_ifEntry, 3, {2, 1, 3}},
+    {IFMTU, ASN_INTEGER, RONLY, var_ifEntry, 3, {2, 1, 4}},
+    {IFSPEED, ASN_GAUGE, RONLY, var_ifEntry, 3, {2, 1, 5}},
+    {IFPHYSADDRESS, ASN_OCTET_STR, RONLY, var_ifEntry, 3, {2, 1, 6}},
+#ifdef WIN32
+    {IFADMINSTATUS, ASN_INTEGER, RWRITE, var_ifEntry, 3, {2, 1, 7}},
+#else
+    {IFADMINSTATUS, ASN_INTEGER, RONLY, var_ifEntry, 3, {2, 1, 7}},
+#endif
+    {IFOPERSTATUS, ASN_INTEGER, RONLY, var_ifEntry, 3, {2, 1, 8}},
+    {IFLASTCHANGE, ASN_TIMETICKS, RONLY, var_ifEntry, 3, {2, 1, 9}},
+    {IFINOCTETS, ASN_COUNTER, RONLY, var_ifEntry, 3, {2, 1, 10}},
+    {IFINUCASTPKTS, ASN_COUNTER, RONLY, var_ifEntry, 3, {2, 1, 11}},
+    {IFINNUCASTPKTS, ASN_COUNTER, RONLY, var_ifEntry, 3, {2, 1, 12}},
+    {IFINDISCARDS, ASN_COUNTER, RONLY, var_ifEntry, 3, {2, 1, 13}},
+    {IFINERRORS, ASN_COUNTER, RONLY, var_ifEntry, 3, {2, 1, 14}},
+    {IFINUNKNOWNPROTOS, ASN_COUNTER, RONLY, var_ifEntry, 3, {2, 1, 15}},
+    {IFOUTOCTETS, ASN_COUNTER, RONLY, var_ifEntry, 3, {2, 1, 16}},
+    {IFOUTUCASTPKTS, ASN_COUNTER, RONLY, var_ifEntry, 3, {2, 1, 17}},
+    {IFOUTNUCASTPKTS, ASN_COUNTER, RONLY, var_ifEntry, 3, {2, 1, 18}},
+    {IFOUTDISCARDS, ASN_COUNTER, RONLY, var_ifEntry, 3, {2, 1, 19}},
+    {IFOUTERRORS, ASN_COUNTER, RONLY, var_ifEntry, 3, {2, 1, 20}},
+    {IFOUTQLEN, ASN_GAUGE, RONLY, var_ifEntry, 3, {2, 1, 21}},
+    {IFSPECIFIC, ASN_OBJECT_ID, RONLY, var_ifEntry, 3, {2, 1, 22}}
+};
+
+/*
+ * Define the OID pointer to the top of the mib tree that we're
+ * registering underneath, and the OID of the MIB module 
+ */
+oid             interfaces_variables_oid[] = { SNMP_OID_MIB2, 2 };
+oid             interfaces_module_oid[] = { SNMP_OID_MIB2, 31 };
+
+void
+init_interfaces(void)
+{
+    /*
+     * register ourselves with the agent to handle our mib tree 
+     */
+    REGISTER_MIB("mibII/interfaces", interfaces_variables, variable3,
+                 interfaces_variables_oid);
+    REGISTER_SYSOR_ENTRY(interfaces_module_oid,
+                         "The MIB module to describe generic objects for network interface sub-layers");
+
+    snmpd_register_config_handler("interface", parse_interface_config,
+                                  free_interface_config,
+                                  "name type speed");
+
+#ifndef USE_SYSCTL_IFLIST
+#if HAVE_NET_IF_MIB_H
+    init_interfaces_setup();
+#endif
+#endif
+#ifdef solaris2
+    init_kernel_sunos5();
+#endif
+}
+
+#ifdef linux
+/*
+ * if_type_from_name
+ * Return interface type using the interface name as a clue.
+ * Returns 1 to imply "other" type if name not recognized. 
+ */
+static int
+if_type_from_name(const char *pcch)
+{
+    typedef struct _match_if {
+        int             mi_type;
+        const char     *mi_name;
+    }              *pmatch_if, match_if;
+
+    static match_if lmatch_if[] = {
+        {24, "lo"},
+        {6, "eth"},
+        {9, "tr"},
+        {23, "ppp"},
+        {28, "sl"},
+        {0, 0}                  /* end of list */
+    };
+
+    int             ii, len;
+    register pmatch_if pm;
+
+    for (ii = 0, pm = lmatch_if; pm->mi_name; pm++) {
+        len = strlen(pm->mi_name);
+        if (0 == strncmp(pcch, pm->mi_name, len)) {
+            return (pm->mi_type);
+        }
+    }
+    return (1);                 /* in case search fails */
+}
+#endif
+
+
+typedef struct _conf_if_list {
+    char           *name;
+    int             type;
+    u_long          speed;
+    struct _conf_if_list *next;
+} conf_if_list;
+
+static conf_if_list *conf_list;
+#ifdef linux
+static struct ifnet *ifnetaddr_list;
+#endif
+
+static void
+parse_interface_config(const char *token, char *cptr)
+{
+    conf_if_list   *if_ptr, *if_new;
+    char           *name, *type, *speed, *ecp;
+
+    name = strtok(cptr, " \t");
+    if (!name) {
+        config_perror("Missing NAME parameter");
+        return;
+    }
+    type = strtok(NULL, " \t");
+    if (!type) {
+        config_perror("Missing TYPE parameter");
+        return;
+    }
+    speed = strtok(NULL, " \t");
+    if (!speed) {
+        config_perror("Missing SPEED parameter");
+        return;
+    }
+    if_ptr = conf_list;
+    while (if_ptr)
+        if (strcmp(if_ptr->name, name))
+            if_ptr = if_ptr->next;
+        else
+            break;
+    if (if_ptr)
+        config_pwarn("Duplicate interface specification");
+    if_new = (conf_if_list *) malloc(sizeof(conf_if_list));
+    if (!if_new) {
+        config_perror("Out of memory");
+        return;
+    }
+    if_new->speed = strtoul(speed, &ecp, 0);
+    if (*ecp) {
+        config_perror("Bad SPEED value");
+        free(if_new);
+        return;
+    }
+    if_new->type = strtol(type, &ecp, 0);
+    if (*ecp || if_new->type < 0) {
+        config_perror("Bad TYPE");
+        free(if_new);
+        return;
+    }
+    if_new->name = strdup(name);
+    if (!if_new->name) {
+        config_perror("Out of memory");
+        free(if_new);
+        return;
+    }
+    if_new->next = conf_list;
+    conf_list = if_new;
+}
+
+static void
+free_interface_config(void)
+{
+    conf_if_list   *if_ptr = conf_list, *if_next;
+    while (if_ptr) {
+        if_next = if_ptr->next;
+        free(if_ptr->name);
+        free(if_ptr);
+        if_ptr = if_next;
+    }
+    conf_list = NULL;
+}
+
+
+
+/*
+ * header_ifEntry(...
+ * Arguments:
+ * vp     IN      - pointer to variable entry that points here
+ * name    IN/OUT  - IN/name requested, OUT/name found
+ * length  IN/OUT  - length of IN/OUT oid's 
+ * exact   IN      - TRUE if an exact match was requested
+ * var_len OUT     - length of variable or 0 if function returned
+ * write_method
+ * 
+ */
+#ifndef WIN32
+static int
+header_ifEntry(struct variable *vp,
+               oid * name,
+               size_t * length,
+               int exact, size_t * var_len, WriteMethod ** write_method)
+{
+#define IFENTRY_NAME_LENGTH	10
+    oid             newname[MAX_OID_LEN];
+    register int    interface;
+    int             result, count;
+
+    DEBUGMSGTL(("mibII/interfaces", "var_ifEntry: "));
+    DEBUGMSGOID(("mibII/interfaces", name, *length));
+    DEBUGMSG(("mibII/interfaces", " %d\n", exact));
+
+    memcpy((char *) newname, (char *) vp->name,
+           (int) vp->namelen * sizeof(oid));
+    /*
+     * find "next" interface 
+     */
+    count = Interface_Scan_Get_Count();
+    for (interface = 1; interface <= count; interface++) {
+        newname[IFENTRY_NAME_LENGTH] = (oid) interface;
+        result =
+            snmp_oid_compare(name, *length, newname,
+                             (int) vp->namelen + 1);
+        if ((exact && (result == 0)) || (!exact && (result < 0)))
+            break;
+    }
+    if (interface > count) {
+        DEBUGMSGTL(("mibII/interfaces", "... index out of range\n"));
+        return MATCH_FAILED;
+    }
+
+
+    memcpy((char *) name, (char *) newname,
+           ((int) vp->namelen + 1) * sizeof(oid));
+    *length = vp->namelen + 1;
+    *write_method = 0;
+    *var_len = sizeof(long);    /* default to 'long' results */
+
+    DEBUGMSGTL(("mibII/interfaces", "... get I/F stats "));
+    DEBUGMSGOID(("mibII/interfaces", name, *length));
+    DEBUGMSG(("mibII/interfaces", "\n"));
+
+    return interface;
+}
+
+
+
+u_char         *
+var_interfaces(struct variable * vp,
+               oid * name,
+               size_t * length,
+               int exact, size_t * var_len, WriteMethod ** write_method)
+{
+    if (header_generic(vp, name, length, exact, var_len, write_method) ==
+        MATCH_FAILED)
+        return NULL;
+
+    switch (vp->magic) {
+    case IFNUMBER:
+        long_return = Interface_Scan_Get_Count();
+        return (u_char *) & long_return;
+    default:
+        DEBUGMSGTL(("snmpd", "unknown sub-id %d in var_interfaces\n",
+                    vp->magic));
+    }
+    return NULL;
+}
+
+#ifdef USE_SYSCTL_IFLIST
+
+static u_char  *if_list = 0;
+static const u_char *if_list_end;
+static size_t   if_list_size = 0;
+
+struct small_ifaddr {
+    struct in_addr  sifa_addr;
+    struct in_addr  sifa_netmask;
+    struct in_addr  sifa_broadcast;
+};
+
+extern const struct sockaddr *get_address(const void *, int, int);
+extern const struct in_addr *get_in_address(const void *, int, int);
+static int      Interface_Scan_By_Index(int, struct if_msghdr *, char *,
+                                        struct small_ifaddr *);
+static int      Interface_Get_Ether_By_Index(int, u_char *);
+
+static int
+Interface_Scan_By_Index(int iindex,
+                        struct if_msghdr *if_msg,
+                        char *if_name, struct small_ifaddr *sifa)
+{
+    u_char         *cp;
+    struct if_msghdr *ifp;
+    int             have_ifinfo = 0, have_addr = 0;
+
+    memset(sifa, 0, sizeof(*sifa));
+    for (cp = if_list; cp < if_list_end; cp += ifp->ifm_msglen) {
+        ifp = (struct if_msghdr *) cp;
+        DEBUGMSGTL(("mibII/interfaces", "ifm_type = %d, ifm_index = %d\n",
+                    ifp->ifm_type, ifp->ifm_index));
+
+        switch (ifp->ifm_type) {
+        case RTM_IFINFO:
+            {
+                const struct sockaddr *a;
+
+                if (ifp->ifm_index == iindex) {
+                    a = get_address(ifp + 1, ifp->ifm_addrs, RTA_IFP);
+                    if (a == NULL)
+                        return 0;
+                    strncpy(if_name,
+                            ((const struct sockaddr_in *) a)->sin_zero,
+                            ((const u_char *) a)[5]);
+                    if_name[((const u_char *) a)[5]] = 0;
+                    *if_msg = *ifp;
+                    ++have_ifinfo;
+                }
+            }
+            break;
+        case RTM_NEWADDR:
+            {
+                struct ifa_msghdr *ifap = (struct ifa_msghdr *) cp;
+
+                if (ifap->ifam_index == iindex) {
+                    const struct in_addr *ia;
+
+                    /*
+                     * I don't know why the normal get_address() doesn't
+                     * work on IRIX 6.2.  Maybe this has to do with the
+                     * existence of struct sockaddr_new.  Hopefully, on
+                     * other systems we can simply use get_in_address
+                     * three times, with (ifap+1) as the starting
+                     * address. 
+                     */
+
+                    sifa->sifa_netmask =
+                        *((struct in_addr *) ((char *) (ifap + 1) + 4));
+                    ia = get_in_address((char *) (ifap + 1) + 8,
+                                        ifap->ifam_addrs &=
+                                        ~RTA_NETMASK, RTA_IFA);
+                    if (ia == NULL)
+                        return 0;
+
+                    sifa->sifa_addr = *ia;
+                    ia = get_in_address((char *) (ifap + 1) + 8,
+                                        ifap->ifam_addrs &= ~RTA_NETMASK,
+                                        RTA_BRD);
+                    if (ia == NULL)
+                        return 0;
+
+                    sifa->sifa_broadcast = *ia;
+                    ++have_addr;
+                }
+            }
+            break;
+        default:
+            DEBUGMSGTL(("mibII/interfaces",
+                        "routing socket: unknown message type %d\n",
+                        ifp->ifm_type));
+        }
+    }
+    if (have_ifinfo && have_addr) {
+        return 0;
+    } else if (have_ifinfo && !(if_msg->ifm_flags & IFF_UP))
+        return 0;
+    else {
+        return -1;
+    }
+}
+
+int
+Interface_Scan_Get_Count(void)
+{
+    u_char         *cp;
+    struct if_msghdr *ifp;
+    long            n = 0;
+
+    Interface_Scan_Init();
+
+    if (if_list_size) {
+        for (cp = if_list, n = 0; cp < if_list_end; cp += ifp->ifm_msglen) {
+            ifp = (struct if_msghdr *) cp;
+    
+            if (ifp->ifm_type == RTM_IFINFO) {
+                ++n;
+            }
+        }
+    }
+    return n;
+}
+
+void
+Interface_Scan_Init(void)
+{
+    int             name[] = { CTL_NET, PF_ROUTE, 0, 0, NET_RT_IFLIST, 0 };
+    size_t          size;
+
+    if (sysctl(name, sizeof(name) / sizeof(int), 0, &size, 0, 0) == -1) {
+        snmp_log(LOG_ERR, "sysctl size fail\n");
+    } else {
+        if (if_list == 0 || if_list_size < size) {
+            if (if_list != 0) {
+                free(if_list);
+            }
+            if_list      = NULL;
+            if_list_size = 0;
+            if_list_end  = 0;
+            if ((if_list = malloc(size)) == NULL) {
+                snmp_log(LOG_ERR,
+                         "out of memory allocating route table (size = %d)\n", size);
+                return;
+            }
+            if_list_size = size;
+        } else {
+            size = if_list_size;
+        }
+        if (sysctl(name, sizeof(name) / sizeof(int),
+                   if_list, &size, 0, 0) == -1) {
+            snmp_log(LOG_ERR, "sysctl get fail\n");
+        }
+        if_list_end = if_list + size;
+    }
+}
+
+u_char         *
+var_ifEntry(struct variable *vp,
+            oid * name,
+            size_t * length,
+            int exact, size_t * var_len, WriteMethod ** write_method)
+{
+    int             interface;
+    struct if_msghdr if_msg;
+    static char     if_name[100];
+    struct small_ifaddr sifa;
+    char           *cp;
+
+    interface =
+        header_ifEntry(vp, name, length, exact, var_len, write_method);
+    if (interface == MATCH_FAILED)
+        return NULL;
+
+    if (Interface_Scan_By_Index(interface, &if_msg, if_name, &sifa) != 0)
+        return NULL;
+
+    switch (vp->magic) {
+    case IFINDEX:
+        long_return = interface;
+        return (u_char *) & long_return;
+    case IFDESCR:
+        cp = if_name;
+        *var_len = strlen(if_name);
+        return (u_char *) cp;
+    case IFTYPE:
+        long_return = (long) if_msg.ifm_data.ifi_type;
+        return (u_char *) & long_return;
+    case IFMTU:
+        long_return = (long) if_msg.ifm_data.ifi_mtu;
+        return (u_char *) & long_return;
+    case IFSPEED:
+#if STRUCT_IFNET_HAS_IF_BAUDRATE_IFS_VALUE
+        long_return = (u_long) if_msg.ifm_data.ifi_baudrate.ifs_value <<
+            if_msg.ifm_data.ifi_baudrate.ifs_log2;
+#else
+        long_return = (u_long) if_msg.ifm_data.ifi_baudrate;
+#endif
+        return (u_char *) & long_return;
+    case IFPHYSADDRESS:
+        /*
+         * XXX 
+         */
+        return NULL;
+    case IFADMINSTATUS:
+        long_return = if_msg.ifm_flags & IFF_UP ? 1 : 2;
+        return (u_char *) & long_return;
+    case IFOPERSTATUS:
+        long_return = if_msg.ifm_flags & IFF_RUNNING ? 1 : 2;
+        return (u_char *) & long_return;
+        /*
+         * ifLastChange 
+         */
+    case IFINOCTETS:
+        long_return = (u_long) if_msg.ifm_data.ifi_ibytes;
+        return (u_char *) & long_return;
+    case IFINUCASTPKTS:
+        long_return =
+            (u_long) if_msg.ifm_data.ifi_ipackets -
+            if_msg.ifm_data.ifi_imcasts;
+        return (u_char *) & long_return;
+    case IFINNUCASTPKTS:
+        long_return = (u_long) if_msg.ifm_data.ifi_imcasts;
+        return (u_char *) & long_return;
+    case IFINDISCARDS:
+        long_return = (u_long) if_msg.ifm_data.ifi_iqdrops;
+        return (u_char *) & long_return;
+    case IFINERRORS:
+        long_return = (u_long) if_msg.ifm_data.ifi_ierrors;
+        return (u_char *) & long_return;
+    case IFINUNKNOWNPROTOS:
+        long_return = (u_long) if_msg.ifm_data.ifi_noproto;
+        return (u_char *) & long_return;
+    case IFOUTOCTETS:
+        long_return = (u_long) if_msg.ifm_data.ifi_obytes;
+        return (u_char *) & long_return;
+    case IFOUTUCASTPKTS:
+        long_return =
+            (u_long) if_msg.ifm_data.ifi_opackets -
+            if_msg.ifm_data.ifi_omcasts;
+        return (u_char *) & long_return;
+    case IFOUTNUCASTPKTS:
+        long_return = (u_long) if_msg.ifm_data.ifi_omcasts;
+        return (u_char *) & long_return;
+    case IFOUTDISCARDS:
+#ifdef if_odrops
+        long_return = (u_long) if_msg.ifm_data.ifi_odrops;
+#else
+#if NO_DUMMY_VALUES
+        return NULL;
+#endif
+        long_return = 0;
+#endif
+        return (u_char *) & long_return;
+    case IFOUTERRORS:
+        long_return = (u_long) if_msg.ifm_data.ifi_oerrors;
+        return (u_char *) & long_return;
+    case IFLASTCHANGE:
+#ifdef irix6
+        long_return = 0;
+#else
+        if (if_msg.ifm_data.ifi_lastchange.tv_sec == 0 &&
+            if_msg.ifm_data.ifi_lastchange.tv_usec == 0)
+            long_return = 0;
+        else if (if_msg.ifm_data.ifi_lastchange.tv_sec < starttime.tv_sec)
+            long_return = 0;
+        else {
+            long_return = (u_long)
+                ((if_msg.ifm_data.ifi_lastchange.tv_sec -
+                  starttime.tv_sec) * 100 +
+                 (if_msg.ifm_data.ifi_lastchange.tv_usec -
+                  starttime.tv_usec) / 10000);
+        }
+#endif
+        return (u_char *) & long_return;
+    default:
+        return 0;
+    }
+}
+
+int
+Interface_Scan_Next(short *Index,
+                    char *Name,
+                    struct ifnet *Retifnet, struct in_ifaddr *Retin_ifaddr)
+{
+    return 0;
+}
+
+#else                           /* not USE_SYSCTL_IFLIST */
+
+        /*********************
+	 *
+	 *  Kernel & interface information,
+	 *   and internal forward declarations
+	 *
+	 *********************/
+
+#ifndef HAVE_NET_IF_MIB_H
+
+#ifndef solaris2
+#ifndef hpux11
+static int      Interface_Scan_By_Index(int, char *, struct ifnet *,
+                                        struct in_ifaddr *);
+static int      Interface_Get_Ether_By_Index(int, u_char *);
+#else
+static int      Interface_Scan_By_Index(int, char *, nmapi_phystat *);
+#endif
+#endif
+
+
+
+        /*********************
+	 *
+	 *  System specific implementation functions
+	 *
+	 *********************/
+
+
+#ifndef solaris2
+#ifndef hpux
+
+u_char         *
+var_ifEntry(struct variable *vp,
+            oid * name,
+            size_t * length,
+            int exact, size_t * var_len, WriteMethod ** write_method)
+{
+    static struct ifnet ifnet;
+    int             interface;
+    static struct in_ifaddr in_ifaddr;
+    static char     Name[16];
+    char           *cp;
+    conf_if_list   *if_ptr = conf_list;
+#if STRUCT_IFNET_HAS_IF_LASTCHANGE_TV_SEC
+    struct timeval  now;
+#endif
+
+    interface =
+        header_ifEntry(vp, name, length, exact, var_len, write_method);
+    if (interface == MATCH_FAILED)
+        return NULL;
+
+    Interface_Scan_By_Index(interface, Name, &ifnet, &in_ifaddr);
+    while (if_ptr && strcmp(Name, if_ptr->name))
+        if_ptr = if_ptr->next;
+
+    switch (vp->magic) {
+    case IFINDEX:
+        long_return = interface;
+        return (u_char *) & long_return;
+    case IFDESCR:
+        cp = Name;
+        *var_len = strlen(cp);
+        return (u_char *) cp;
+    case IFTYPE:
+        if (if_ptr)
+            long_return = if_ptr->type;
+        else {
+#if STRUCT_IFNET_HAS_IF_TYPE
+            long_return = ifnet.if_type;
+#else
+            long_return = 1;    /* OTHER */
+#endif
+        }
+        return (u_char *) & long_return;
+    case IFMTU:{
+            long_return = (long) ifnet.if_mtu;
+            return (u_char *) & long_return;
+        }
+    case IFSPEED:
+        if (if_ptr)
+            long_return = if_ptr->speed;
+        else {
+#if STRUCT_IFNET_HAS_IF_BAUDRATE
+            long_return = ifnet.if_baudrate;
+#elif STRUCT_IFNET_HAS_IF_SPEED
+            long_return = ifnet.if_speed;
+#elif STRUCT_IFNET_HAS_IF_TYPE && defined(IFT_ETHER)
+            if (ifnet.if_type == IFT_ETHER)
+                long_return = 10000000;
+            if (ifnet.if_type == IFT_P10)
+                long_return = 10000000;
+            if (ifnet.if_type == IFT_P80)
+                long_return = 80000000;
+            if (ifnet.if_type == IFT_ISDNBASIC)
+                long_return = 64000;    /* EDSS1 only */
+            if (ifnet.if_type == IFT_ISDNPRIMARY)
+                long_return = 64000 * 30;
+#else
+#if NO_DUMMY_VALUES
+            return NULL;
+#endif
+            long_return = (u_long) 10000000;
+#endif
+        }
+        return (u_char *) & long_return;
+    case IFPHYSADDRESS:
+        Interface_Get_Ether_By_Index(interface, return_buf);
+        *var_len = 6;
+        if ((return_buf[0] == 0) && (return_buf[1] == 0) &&
+            (return_buf[2] == 0) && (return_buf[3] == 0) &&
+            (return_buf[4] == 0) && (return_buf[5] == 0))
+            *var_len = 0;
+        return (u_char *) return_buf;
+    case IFADMINSTATUS:
+        long_return = ifnet.if_flags & IFF_UP ? 1 : 2;
+        return (u_char *) & long_return;
+    case IFOPERSTATUS:
+        long_return = ifnet.if_flags & IFF_RUNNING ? 1 : 2;
+        return (u_char *) & long_return;
+    case IFLASTCHANGE:
+#if defined(STRUCT_IFNET_HAS_IF_LASTCHANGE_TV_SEC) && !(defined(freebsd2) && __FreeBSD_version < 199607)
+        /*
+         * XXX - SNMP's ifLastchange is time when op. status changed
+         * * FreeBSD's if_lastchange is time when packet was input or output
+         * * (at least in 2.1.0-RELEASE. Changed in later versions of the kernel?)
+         */
+        /*
+         * FreeBSD's if_lastchange before the 2.1.5 release is the time when
+         * * a packet was last input or output.  In the 2.1.5 and later releases,
+         * * this is fixed, thus the 199607 comparison.
+         */
+        if (ifnet.if_lastchange.tv_sec == 0 &&
+            ifnet.if_lastchange.tv_usec == 0)
+            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);
+        }
+#else
+#if NO_DUMMY_VALUES
+        return NULL;
+#endif
+        long_return = 0;        /* XXX */
+#endif
+        return (u_char *) & long_return;
+    case IFINOCTETS:
+#ifdef STRUCT_IFNET_HAS_IF_IBYTES
+        long_return = (u_long) ifnet.if_ibytes;
+#else
+#if NO_DUMMY_VALUES
+        return NULL;
+#endif
+        long_return = (u_long) ifnet.if_ipackets * 308; /* XXX */
+#endif
+        return (u_char *) & long_return;
+    case IFINUCASTPKTS:
+        {
+            long_return = (u_long) ifnet.if_ipackets;
+#if STRUCT_IFNET_HAS_IF_IMCASTS
+            long_return -= (u_long) ifnet.if_imcasts;
+#endif
+        }
+        return (u_char *) & long_return;
+    case IFINNUCASTPKTS:
+#if STRUCT_IFNET_HAS_IF_IMCASTS
+        long_return = (u_long) ifnet.if_imcasts;
+#else
+#if NO_DUMMY_VALUES
+        return NULL;
+#endif
+        long_return = (u_long) 0;       /* XXX */
+#endif
+        return (u_char *) & long_return;
+    case IFINDISCARDS:
+#if STRUCT_IFNET_HAS_IF_IQDROPS
+        long_return = (u_long) ifnet.if_iqdrops;
+#else
+#if NO_DUMMY_VALUES
+        return NULL;
+#endif
+        long_return = (u_long) 0;       /* XXX */
+#endif
+        return (u_char *) & long_return;
+    case IFINERRORS:
+        long_return = (u_long) ifnet.if_ierrors;
+        return (u_char *) & long_return;
+    case IFINUNKNOWNPROTOS:
+#if STRUCT_IFNET_HAS_IF_NOPROTO
+        long_return = (u_long) ifnet.if_noproto;
+#else
+#if NO_DUMMY_VALUES
+        return NULL;
+#endif
+        long_return = (u_long) 0;       /* XXX */
+#endif
+        return (u_char *) & long_return;
+    case IFOUTOCTETS:
+#ifdef STRUCT_IFNET_HAS_IF_OBYTES
+        long_return = (u_long) ifnet.if_obytes;
+#else
+#if NO_DUMMY_VALUES
+        return NULL;
+#endif
+        long_return = (u_long) ifnet.if_opackets * 308; /* XXX */
+#endif
+        return (u_char *) & long_return;
+    case IFOUTUCASTPKTS:
+        {
+            long_return = (u_long) ifnet.if_opackets;
+#if STRUCT_IFNET_HAS_IF_OMCASTS
+            long_return -= (u_long) ifnet.if_omcasts;
+#endif
+        }
+        return (u_char *) & long_return;
+    case IFOUTNUCASTPKTS:
+#if STRUCT_IFNET_HAS_IF_OMCASTS
+        long_return = (u_long) ifnet.if_omcasts;
+#else
+#if NO_DUMMY_VALUES
+        return NULL;
+#endif
+        long_return = (u_long) 0;       /* XXX */
+#endif
+        return (u_char *) & long_return;
+    case IFOUTDISCARDS:
+        long_return = ifnet.if_snd.ifq_drops;
+        return (u_char *) & long_return;
+    case IFOUTERRORS:
+        long_return = ifnet.if_oerrors;
+        return (u_char *) & long_return;
+    case IFOUTQLEN:
+        long_return = ifnet.if_snd.ifq_len;
+        return (u_char *) & long_return;
+    case IFSPECIFIC:
+        *var_len = nullOidLen;
+        return (u_char *) nullOid;
+    default:
+        DEBUGMSGTL(("snmpd", "unknown sub-id %d in var_ifEntry\n",
+                    vp->magic));
+    }
+    return NULL;
+}
+
+#else                           /* hpux */
+
+u_char         *
+var_ifEntry(struct variable *vp,
+            oid * name,
+            size_t * length,
+            int exact, size_t * var_len, WriteMethod ** write_method)
+{
+#if defined(hpux11)
+    static nmapi_phystat ifnet;
+#else
+    static struct ifnet ifnet;
+#endif
+    register int    interface;
+#if !defined(hpux11)
+    static struct in_ifaddr in_ifaddrVar;
+#endif
+#if defined(hpux11)
+    static char     Name[MAX_PHYSADDR_LEN];
+#else
+    static char     Name[16];
+#endif
+    register char  *cp;
+#if STRUCT_IFNET_HAS_IF_LASTCHANGE_TV_SEC
+    struct timeval  now;
+#endif
+#if !defined(hpux11)
+    struct nmparms  hp_nmparms;
+    static mib_ifEntry hp_ifEntry;
+    int             hp_fd;
+    int             hp_len = sizeof(hp_ifEntry);
+#endif
+
+
+    interface =
+        header_ifEntry(vp, name, length, exact, var_len, write_method);
+    if (interface == MATCH_FAILED)
+        return NULL;
+
+#if defined(hpux11)
+    Interface_Scan_By_Index(interface, Name, &ifnet);
+#else
+    Interface_Scan_By_Index(interface, Name, &ifnet, &in_ifaddrVar);
+#endif
+
+#if !defined(hpux11)
+    /*
+     * Additional information about the interfaces is available under
+     * HP-UX through the network management interface '/dev/netman'
+     */
+    hp_ifEntry.ifIndex = interface;
+    hp_nmparms.objid = ID_ifEntry;
+    hp_nmparms.buffer = (char *) &hp_ifEntry;
+    hp_nmparms.len = &hp_len;
+    if ((hp_fd = open("/dev/netman", O_RDONLY)) != -1) {
+        if (ioctl(hp_fd, NMIOGET, &hp_nmparms) != -1) {
+            close(hp_fd);
+        } else {
+            close(hp_fd);
+            hp_fd = -1;         /* failed */
+        }
+    }
+#endif
+
+    switch (vp->magic) {
+    case IFINDEX:
+        long_return = interface;
+        return (u_char *) & long_return;
+    case IFDESCR:
+#if defined(hpux11)
+        cp = ifnet.if_entry.ifDescr;
+#else
+        if (hp_fd != -1)
+            cp = hp_ifEntry.ifDescr;
+        else
+            cp = Name;
+#endif
+        *var_len = strlen(cp);
+        return (u_char *) cp;
+    case IFTYPE:
+#if defined(hpux11)
+        long_return = ifnet.if_entry.ifType;
+#else
+        if (hp_fd != -1)
+            long_return = hp_ifEntry.ifType;
+        else
+            long_return = 1;    /* OTHER */
+#endif
+        return (u_char *) & long_return;
+    case IFMTU:{
+#if defined(hpux11)
+            long_return = (long) ifnet.if_entry.ifMtu;
+#else
+            long_return = (long) ifnet.if_mtu;
+#endif
+            return (u_char *) & long_return;
+        }
+    case IFSPEED:
+#if defined(hpux11)
+        long_return = ifnet.if_entry.ifSpeed;
+#else
+        if (hp_fd != -1)
+            long_return = hp_ifEntry.ifSpeed;
+        else
+            long_return = (u_long) 1;   /* OTHER */
+#endif
+        return (u_char *) & long_return;
+    case IFPHYSADDRESS:
+#if defined(hpux11)
+        *var_len = ifnet.if_entry.ifPhysAddress.o_length;
+        return (u_char *) ifnet.if_entry.ifPhysAddress.o_bytes;
+#else
+        Interface_Get_Ether_By_Index(interface, return_buf);
+        *var_len = 6;
+        if ((return_buf[0] == 0) && (return_buf[1] == 0) &&
+            (return_buf[2] == 0) && (return_buf[3] == 0) &&
+            (return_buf[4] == 0) && (return_buf[5] == 0))
+            *var_len = 0;
+        return (u_char *) return_buf;
+#endif
+    case IFADMINSTATUS:
+#if defined(hpux11)
+        long_return = ifnet.if_entry.ifAdmin;
+#else
+        long_return = ifnet.if_flags & IFF_UP ? 1 : 2;
+#endif
+        return (u_char *) & long_return;
+    case IFOPERSTATUS:
+#if defined(hpux11)
+        long_return = ifnet.if_entry.ifOper;
+#else
+        long_return = ifnet.if_flags & IFF_RUNNING ? 1 : 2;
+#endif
+        return (u_char *) & long_return;
+    case IFLASTCHANGE:
+#if defined(hpux11)
+        long_return = ifnet.if_entry.ifLastChange;
+#else
+        if (hp_fd != -1)
+            long_return = hp_ifEntry.ifLastChange;
+        else
+            long_return = 0;    /* XXX */
+#endif
+        return (u_char *) & long_return;
+    case IFINOCTETS:
+#if defined(hpux11)
+        long_return = ifnet.if_entry.ifInOctets;
+#else
+        if (hp_fd != -1)
+            long_return = hp_ifEntry.ifInOctets;
+        else
+            long_return = (u_long) ifnet.if_ipackets * 308;     /* XXX */
+#endif
+        return (u_char *) & long_return;
+    case IFINUCASTPKTS:
+#if defined(hpux11)
+        long_return = ifnet.if_entry.ifInUcastPkts;
+#else
+        if (hp_fd != -1)
+            long_return = hp_ifEntry.ifInUcastPkts;
+        else
+            long_return = (u_long) ifnet.if_ipackets;
+#endif
+        return (u_char *) & long_return;
+    case IFINNUCASTPKTS:
+#if defined(hpux11)
+        long_return = ifnet.if_entry.ifInNUcastPkts;
+#else
+        if (hp_fd != -1)
+            long_return = hp_ifEntry.ifInNUcastPkts;
+        else
+            long_return = (u_long) 0;   /* XXX */
+#endif
+        return (u_char *) & long_return;
+    case IFINDISCARDS:
+#if defined(hpux11)
+        long_return = ifnet.if_entry.ifInDiscards;
+#else
+        if (hp_fd != -1)
+            long_return = hp_ifEntry.ifInDiscards;
+        else
+            long_return = (u_long) 0;   /* XXX */
+#endif
+        return (u_char *) & long_return;
+    case IFINERRORS:
+#if defined(hpux11)
+        long_return = ifnet.if_entry.ifInErrors;
+#else
+        long_return = ifnet.if_ierrors;
+#endif
+        return (u_char *) & long_return;
+    case IFINUNKNOWNPROTOS:
+#if defined(hpux11)
+        long_return = ifnet.if_entry.ifInUnknownProtos;
+#else
+        if (hp_fd != -1)
+            long_return = hp_ifEntry.ifInUnknownProtos;
+        else
+            long_return = (u_long) 0;   /* XXX */
+#endif
+        return (u_char *) & long_return;
+    case IFOUTOCTETS:
+#if defined(hpux11)
+        long_return = ifnet.if_entry.ifOutOctets;
+#else
+        if (hp_fd != -1)
+            long_return = hp_ifEntry.ifOutOctets;
+        else
+            long_return = (u_long) ifnet.if_opackets * 308;     /* XXX */
+#endif
+        return (u_char *) & long_return;
+    case IFOUTUCASTPKTS:
+#if defined(hpux11)
+        long_return = ifnet.if_entry.ifOutUcastPkts;
+#else
+        if (hp_fd != -1)
+            long_return = hp_ifEntry.ifOutUcastPkts;
+        else
+            long_return = (u_long) ifnet.if_opackets;
+#endif
+        return (u_char *) & long_return;
+    case IFOUTNUCASTPKTS:
+#if defined(hpux11)
+        long_return = ifnet.if_entry.ifOutNUcastPkts;
+#else
+        if (hp_fd != -1)
+            long_return = hp_ifEntry.ifOutNUcastPkts;
+        else
+            long_return = (u_long) 0;   /* XXX */
+#endif
+        return (u_char *) & long_return;
+    case IFOUTDISCARDS:
+#if defined(hpux11)
+        long_return = ifnet.if_entry.ifOutDiscards;
+#else
+        long_return = ifnet.if_snd.ifq_drops;
+#endif
+        return (u_char *) & long_return;
+    case IFOUTERRORS:
+#if defined(hpux11)
+        long_return = ifnet.if_entry.ifOutErrors;
+#else
+        long_return = ifnet.if_oerrors;
+#endif
+        return (u_char *) & long_return;
+    case IFOUTQLEN:
+#if defined(hpux11)
+        long_return = ifnet.if_entry.ifOutQlen;
+#else
+        long_return = ifnet.if_snd.ifq_len;
+#endif
+        return (u_char *) & long_return;
+    case IFSPECIFIC:
+        *var_len = nullOidLen;
+        return (u_char *) nullOid;
+    default:
+        DEBUGMSGTL(("snmpd", "unknown sub-id %d in var_ifEntry\n",
+                    vp->magic));
+    }
+    return NULL;
+}
+
+#endif                          /* hpux */
+#else                           /* solaris2 */
+
+static int
+IF_cmp(void *addr, void *ep)
+{
+    DEBUGMSGTL(("mibII/interfaces", "... IF_cmp %d %d\n",
+                ((mib2_ifEntry_t *) ep)->ifIndex,
+                ((mib2_ifEntry_t *) addr)->ifIndex));
+    if (((mib2_ifEntry_t *) ep)->ifIndex ==
+        ((mib2_ifEntry_t *) addr)->ifIndex)
+        return (0);
+    else
+        return (1);
+}
+
+u_char         *
+var_ifEntry(struct variable * vp,
+            oid * name,
+            size_t * length,
+            int exact, size_t * var_len, WriteMethod ** write_method)
+{
+    int             interface;
+    mib2_ifEntry_t  ifstat;
+
+
+    interface =
+        header_ifEntry(vp, name, length, exact, var_len, write_method);
+    if (interface == MATCH_FAILED)
+        return NULL;
+
+    if (getMibstat(MIB_INTERFACES, &ifstat, sizeof(mib2_ifEntry_t),
+                   GET_EXACT, &IF_cmp, &interface) != 0) {
+        DEBUGMSGTL(("mibII/interfaces", "... no mib stats\n"));
+        return NULL;
+    }
+    switch (vp->magic) {
+    case IFINDEX:
+        long_return = ifstat.ifIndex;
+        return (u_char *) & long_return;
+    case IFDESCR:
+        *var_len = ifstat.ifDescr.o_length;
+        (void) memcpy(return_buf, ifstat.ifDescr.o_bytes, *var_len);
+        return (u_char *) return_buf;
+    case IFTYPE:
+        long_return = (u_long) ifstat.ifType;
+        return (u_char *) & long_return;
+    case IFMTU:
+        long_return = (u_long) ifstat.ifMtu;
+        return (u_char *) & long_return;
+    case IFSPEED:
+        long_return = (u_long) ifstat.ifSpeed;
+        return (u_char *) & long_return;
+    case IFPHYSADDRESS:
+        *var_len = ifstat.ifPhysAddress.o_length;
+        (void) memcpy(return_buf, ifstat.ifPhysAddress.o_bytes, *var_len);
+        return (u_char *) return_buf;
+    case IFADMINSTATUS:
+        long_return = (u_long) ifstat.ifAdminStatus;
+        return (u_char *) & long_return;
+    case IFOPERSTATUS:
+        long_return = (u_long) ifstat.ifOperStatus;
+        return (u_char *) & long_return;
+    case IFLASTCHANGE:
+        long_return = (u_long) ifstat.ifLastChange;
+        return (u_char *) & long_return;
+    case IFINOCTETS:
+        long_return = (u_long) ifstat.ifInOctets;
+        return (u_char *) & long_return;
+    case IFINUCASTPKTS:
+        long_return = (u_long) ifstat.ifInUcastPkts;
+        return (u_char *) & long_return;
+    case IFINNUCASTPKTS:
+        long_return = (u_long) ifstat.ifInNUcastPkts;
+        return (u_char *) & long_return;
+    case IFINDISCARDS:
+        long_return = (u_long) ifstat.ifInDiscards;
+        return (u_char *) & long_return;
+    case IFINERRORS:
+        long_return = (u_long) ifstat.ifInErrors;
+        return (u_char *) & long_return;
+    case IFINUNKNOWNPROTOS:
+        long_return = (u_long) ifstat.ifInUnknownProtos;
+        return (u_char *) & long_return;
+    case IFOUTOCTETS:
+        long_return = (u_long) ifstat.ifOutOctets;
+        return (u_char *) & long_return;
+    case IFOUTUCASTPKTS:
+        long_return = (u_long) ifstat.ifOutUcastPkts;
+        return (u_char *) & long_return;
+    case IFOUTNUCASTPKTS:
+        long_return = (u_long) ifstat.ifOutNUcastPkts;
+        return (u_char *) & long_return;
+    case IFOUTDISCARDS:
+        long_return = (u_long) ifstat.ifOutDiscards;
+        return (u_char *) & long_return;
+    case IFOUTERRORS:
+        long_return = (u_long) ifstat.ifOutErrors;
+        return (u_char *) & long_return;
+    case IFOUTQLEN:
+        long_return = (u_long) ifstat.ifOutQLen;
+        return (u_char *) & long_return;
+    default:
+        DEBUGMSGTL(("snmpd", "unknown sub-id %d in var_ifEntry\n",
+                    vp->magic));
+    }
+    return NULL;
+}
+
+#endif                          /* solaris2 */
+
+
+
+        /*********************
+	 *
+	 *  Internal implementation functions
+	 *
+	 *********************/
+
+
+#ifndef solaris2
+
+#if !defined(sunV3) && !defined(linux) && !defined(hpux11)
+static struct in_ifaddr savein_ifaddr;
+#endif
+#if !defined(hpux11)
+static struct ifnet *ifnetaddr, saveifnet, *saveifnetaddr;
+static char     saveName[16];
+#endif
+static int      saveIndex = 0;
+
+/**
+* Determines network interface speed. It is system specific. Only linux
+* realization is made. 
+*/
+unsigned int getIfSpeed(int fd, struct ifreq ifr){
+	unsigned int retspeed = 10000000;
+#ifdef linux
+/* the code is based on mii-diag utility by Donald Becker
+* see ftp://ftp.scyld.com/pub/diag/mii-diag.c
+*/
+	ushort *data = (ushort *)(&ifr.ifr_data);
+	unsigned int *data32 = (unsigned int *)(&ifr.ifr_data);
+	unsigned phy_id;
+	unsigned char new_ioctl_nums = 0;
+	int mii_reg, i;
+	ushort mii_val[32];
+	ushort bmcr, bmsr, new_bmsr, nway_advert, lkpar;
+	const unsigned int media_speeds[] = {10000000, 10000000, 100000000, 100000000, 10000000, 0};	
+/* It corresponds to "10baseT", "10baseT-FD", "100baseTx", "100baseTx-FD", "100baseT4", "Flow-control", 0, */
+
+
+	data[0] = 0;
+
+	if (ioctl(fd, 0x8947, &ifr) >= 0) {
+		new_ioctl_nums = 1;
+	} else if (ioctl(fd, SIOCDEVPRIVATE, &ifr) >= 0) {
+		new_ioctl_nums = 0;
+	} else {
+		DEBUGMSGTL(("mibII/interfaces", "SIOCGMIIPHY on %s failed\n", ifr.ifr_name));
+		return retspeed;
+	}
+/* Begin getting mii register values */
+	phy_id = data[0];
+	for (mii_reg = 0; mii_reg < 8; mii_reg++){
+		data[0] = phy_id;
+		data[1] = mii_reg;
+		if(ioctl(fd, new_ioctl_nums ? 0x8948 : SIOCDEVPRIVATE+1, &ifr) <0){
+			DEBUGMSGTL(("mibII/interfaces", "SIOCGMIIREG on %s failed\n", ifr.ifr_name));
+		}
+		mii_val[mii_reg] = data[3];		
+	}
+/*Parsing of mii values*/
+/*Invalid basic mode control register*/
+	if (mii_val[0] == 0xffff  ||  mii_val[1] == 0x0000) {
+		DEBUGMSGTL(("mibII/interfaces", "No MII transceiver present!.\n"));
+		return retspeed;
+	}
+	/* Descriptive rename. */
+	bmcr = mii_val[0]; 	  /*basic mode control register*/
+	bmsr = mii_val[1]; 	  /* basic mode status register*/
+	nway_advert = mii_val[4]; /* autonegotiation advertisement*/
+	lkpar = mii_val[5]; 	  /*link partner ability*/
+	
+/*Check for link existence, returns 0 if link is absent*/
+	if ((bmsr & 0x0016) != 0x0004){
+		DEBUGMSGTL(("mibII/interfaces", "No link...\n"));
+		retspeed = 0;
+		return retspeed;
+	}
+	
+	if(!(bmcr & 0x1000) ){
+		DEBUGMSGTL(("mibII/interfaces", "Auto-negotiation disabled.\n"));
+		retspeed = bmcr & 0x2000 ? 100000000 : 10000000;
+		return retspeed;
+	}
+/* Link partner got our advertised abilities */	
+	if (lkpar & 0x4000) {
+		int negotiated = nway_advert & lkpar & 0x3e0;
+		int max_capability = 0;
+		/* Scan for the highest negotiated capability, highest priority
+		   (100baseTx-FDX) to lowest (10baseT-HDX). */
+		int media_priority[] = {8, 9, 7, 6, 5}; 	/* media_names[i-5] */
+		for (i = 0; media_priority[i]; i++){
+			if (negotiated & (1 << media_priority[i])) {
+				max_capability = media_priority[i];
+				break;
+			}
+		}
+		if (max_capability)
+			retspeed = media_speeds[max_capability - 5];
+		else
+			DEBUGMSGTL(("mibII/interfaces", "No common media type was autonegotiated!\n"));
+	}
+	return retspeed;
+#else /*!linux*/			   
+	return retspeed;
+#endif 
+}
+
+
+void
+Interface_Scan_Init(void)
+{
+#ifdef linux
+    char            line[256], ifname_buf[64], *ifname, *ptr;
+    struct ifreq    ifrq;
+    struct ifnet  **ifnetaddr_ptr;
+    FILE           *devin;
+    unsigned long   rec_pkt, rec_oct, rec_err, rec_drop;
+    unsigned long   snd_pkt, snd_oct, snd_err, snd_drop, coll;
+    int             i, fd;
+    conf_if_list   *if_ptr;
+    const char     *scan_line_2_2 =
+        "%lu %lu %lu %lu %*lu %*lu %*lu %*lu %lu %lu %lu %lu %*lu %lu";
+    const char     *scan_line_2_0 =
+        "%lu %lu %*lu %*lu %*lu %lu %lu %*lu %*lu %lu";
+    const char     *scan_line_to_use;
+
+#endif
+
+#if !defined(hpux11)
+    auto_nlist(IFNET_SYMBOL, (char *) &ifnetaddr, sizeof(ifnetaddr));
+#endif
+    saveIndex = 0;
+
+#ifdef linux
+    /*
+     * free old list: 
+     */
+    while (ifnetaddr_list) {
+        struct ifnet   *old = ifnetaddr_list;
+        ifnetaddr_list = ifnetaddr_list->if_next;
+        free(old->if_name);
+        free(old->if_unit);
+        free(old);
+    }
+
+    ifnetaddr = 0;
+    ifnetaddr_ptr = &ifnetaddr_list;
+
+    if ((fd = socket(AF_INET, SOCK_DGRAM, 0)) < 0) {
+        DEBUGMSGTL(("snmpd",
+                    "socket open failure in Interface_Scan_Init\n"));
+        return; /** exit (1); **/
+    }
+
+    /*
+     * build up ifnetaddr list by hand: 
+     */
+
+    /*
+     * at least linux v1.3.53 says EMFILE without reason... 
+     */
+    if (!(devin = fopen("/proc/net/dev", "r"))) {
+        close(fd);
+        snmp_log(LOG_ERR, "cannot open /proc/net/dev - continuing...\n");
+        return; /** exit (1); **/
+    }
+
+    i = 0;
+
+    /*
+     * read the second line (a header) and determine the fields we
+     * should read from.  This should be done in a better way by
+     * actually looking for the field names we want.  But thats too
+     * much work for today.  -- Wes 
+     */
+    fgets(line, sizeof(line), devin);
+    fgets(line, sizeof(line), devin);
+    if (strstr(line, "compressed")) {
+        scan_line_to_use = scan_line_2_2;
+        DEBUGMSGTL(("mibII/interfaces",
+                    "using linux 2.2 kernel /proc/net/dev\n"));
+    } else {
+        scan_line_to_use = scan_line_2_0;
+        DEBUGMSGTL(("mibII/interfaces",
+                    "using linux 2.0 kernel /proc/net/dev\n"));
+    }
+
+
+    while (fgets(line, sizeof(line), devin)) {
+        struct ifnet   *nnew;
+        char           *stats, *ifstart = line;
+
+        if (line[strlen(line) - 1] == '\n')
+            line[strlen(line) - 1] = '\0';
+
+        while (*ifstart && *ifstart == ' ')
+            ifstart++;
+
+        if (!*ifstart || ((stats = strrchr(ifstart, ':')) == NULL)) {
+            snmp_log(LOG_ERR,
+                     "/proc/net/dev data format error, line ==|%s|", line);
+            continue;
+        }
+        if ((scan_line_to_use == scan_line_2_2) && ((stats - line) < 6)) {
+            snmp_log(LOG_ERR,
+                     "/proc/net/dev data format error, line ==|%s|", line);
+        }
+
+        *stats   = 0;
+        strncpy(ifname_buf, ifstart, sizeof(ifname_buf));
+        ifname_buf[ sizeof(ifname_buf)-1 ] = 0;
+        *stats++ = ':';
+        while (*stats == ' ')
+            stats++;
+
+        if ((scan_line_to_use == scan_line_2_2 &&
+             sscanf(stats, scan_line_to_use, &rec_oct, &rec_pkt, &rec_err,
+                    &rec_drop, &snd_oct, &snd_pkt, &snd_err, &snd_drop,
+                    &coll) != 9) || (scan_line_to_use == scan_line_2_0
+                                     && sscanf(stats, scan_line_to_use,
+                                               &rec_pkt, &rec_err,
+                                               &snd_pkt, &snd_err,
+                                               &coll) != 5)) {
+            if ((scan_line_to_use == scan_line_2_2)
+                && !strstr(line, "No statistics available"))
+                snmp_log(LOG_ERR,
+                         "/proc/net/dev data format error, line ==|%s|",
+                         line);
+            continue;
+        }
+
+        nnew = (struct ifnet *) calloc(1, sizeof(struct ifnet));
+        if (nnew == NULL)
+            break;              /* alloc error */
+
+        /*
+         * chain in: 
+         */
+        *ifnetaddr_ptr = nnew;
+        ifnetaddr_ptr = &nnew->if_next;
+        i++;
+
+        /*
+         * linux previous to 1.3.~13 may miss transmitted loopback pkts: 
+         */
+        if (!strcmp(ifname_buf, "lo") && rec_pkt > 0 && !snd_pkt)
+            snd_pkt = rec_pkt;
+
+        nnew->if_ipackets = rec_pkt;
+        nnew->if_ierrors = rec_err;
+        nnew->if_opackets = snd_pkt;
+        nnew->if_oerrors = snd_err;
+        nnew->if_collisions = coll;
+        if (scan_line_to_use == scan_line_2_2) {
+            nnew->if_ibytes = rec_oct;
+            nnew->if_obytes = snd_oct;
+            nnew->if_iqdrops = rec_drop;
+            nnew->if_snd.ifq_drops = snd_drop;
+        } else {
+            nnew->if_ibytes = rec_pkt * 308;
+            nnew->if_obytes = snd_pkt * 308;
+        }
+
+        /*
+         * ifnames are given as ``   eth0'': split in ``eth'' and ``0'': 
+         */
+        for (ifname = ifname_buf; *ifname && *ifname == ' '; ifname++);
+
+        /*
+         * set name and interface# : 
+         */
+        nnew->if_name = (char *) strdup(ifname);
+        for (ptr = nnew->if_name; *ptr && (*ptr < '0' || *ptr > '9');
+             ptr++);
+        nnew->if_unit = strdup(*ptr ? ptr : "");
+        *ptr = 0;
+
+        strncpy(ifrq.ifr_name, ifname, sizeof(ifrq.ifr_name));
+        ifrq.ifr_name[ sizeof(ifrq.ifr_name)-1 ] = 0;
+        if (ioctl(fd, SIOCGIFADDR, &ifrq) < 0)
+            memset((char *) &nnew->if_addr, 0, sizeof(nnew->if_addr));
+        else
+            nnew->if_addr = ifrq.ifr_addr;
+
+        strncpy(ifrq.ifr_name, ifname, sizeof(ifrq.ifr_name));
+        ifrq.ifr_name[ sizeof(ifrq.ifr_name)-1 ] = 0;
+        if (ioctl(fd, SIOCGIFBRDADDR, &ifrq) < 0)
+            memset((char *) &nnew->ifu_broadaddr, 0,
+                   sizeof(nnew->ifu_broadaddr));
+        else
+            nnew->ifu_broadaddr = ifrq.ifr_broadaddr;
+
+        strncpy(ifrq.ifr_name, ifname, sizeof(ifrq.ifr_name));
+        ifrq.ifr_name[ sizeof(ifrq.ifr_name)-1 ] = 0;
+        if (ioctl(fd, SIOCGIFNETMASK, &ifrq) < 0)
+            memset((char *) &nnew->ia_subnetmask, 0,
+                   sizeof(nnew->ia_subnetmask));
+        else
+            nnew->ia_subnetmask = ifrq.ifr_netmask;
+
+        strncpy(ifrq.ifr_name, ifname, sizeof(ifrq.ifr_name));
+        ifrq.ifr_name[ sizeof(ifrq.ifr_name)-1 ] = 0;
+        nnew->if_flags = ioctl(fd, SIOCGIFFLAGS, &ifrq) < 0
+            ? 0 : ifrq.ifr_flags;
+
+        nnew->if_type = 0;
+
+        strncpy(ifrq.ifr_name, ifname, sizeof(ifrq.ifr_name));
+        ifrq.ifr_name[ sizeof(ifrq.ifr_name)-1 ] = 0;
+        if (ioctl(fd, SIOCGIFHWADDR, &ifrq) < 0)
+            memset(nnew->if_hwaddr, (0), 6);
+        else {
+            memcpy(nnew->if_hwaddr, ifrq.ifr_hwaddr.sa_data, 6);
+
+#ifdef ARPHRD_LOOPBACK
+            switch (ifrq.ifr_hwaddr.sa_family) {
+            case ARPHRD_ETHER:
+                nnew->if_type = 6;
+                break;
+            case ARPHRD_TUNNEL:
+            case ARPHRD_TUNNEL6:
+#ifdef ARPHRD_IPGRE
+            case ARPHRD_IPGRE:
+#endif
+            case ARPHRD_SIT:
+                nnew->if_type = 131;
+                break;          /* tunnel */
+            case ARPHRD_SLIP:
+            case ARPHRD_CSLIP:
+            case ARPHRD_SLIP6:
+            case ARPHRD_CSLIP6:
+                nnew->if_type = 28;
+                break;          /* slip */
+            case ARPHRD_PPP:
+                nnew->if_type = 23;
+                break;          /* ppp */
+            case ARPHRD_LOOPBACK:
+                nnew->if_type = 24;
+                break;          /* softwareLoopback */
+            case ARPHRD_FDDI:
+                nnew->if_type = 15;
+                break;
+            case ARPHRD_ARCNET:
+                nnew->if_type = 35;
+                break;
+            case ARPHRD_LOCALTLK:
+                nnew->if_type = 42;
+                break;
+#ifdef ARPHRD_HIPPI
+            case ARPHRD_HIPPI:
+                nnew->if_type = 47;
+                break;
+#endif
+#ifdef ARPHRD_ATM
+            case ARPHRD_ATM:
+                nnew->if_type = 37;
+                break;
+#endif
+                /*
+                 * XXX: more if_arp.h:ARPHDR_xxx to IANAifType mappings... 
+                 */
+            }
+#endif
+        }
+
+        strncpy(ifrq.ifr_name, ifname, sizeof(ifrq.ifr_name));
+        ifrq.ifr_name[ sizeof(ifrq.ifr_name)-1 ] = 0;
+        nnew->if_metric = ioctl(fd, SIOCGIFMETRIC, &ifrq) < 0
+            ? 0 : ifrq.ifr_metric;
+
+#ifdef SIOCGIFMTU
+        strncpy(ifrq.ifr_name, ifname, sizeof(ifrq.ifr_name));
+        ifrq.ifr_name[ sizeof(ifrq.ifr_name)-1 ] = 0;
+        nnew->if_mtu = (ioctl(fd, SIOCGIFMTU, &ifrq) < 0)
+            ? 0 : ifrq.ifr_mtu;
+#else
+        nnew->if_mtu = 0;
+#endif
+
+        for (if_ptr = conf_list; if_ptr; if_ptr = if_ptr->next)
+            if (!strcmp(if_ptr->name, ifname))
+                break;
+
+        if (if_ptr) {
+            nnew->if_type = if_ptr->type;
+            nnew->if_speed = if_ptr->speed;
+        } else {
+            /*
+             * do only guess if_type from name, if we could not read
+             * * it before from SIOCGIFHWADDR 
+             */
+            if (!nnew->if_type)
+                nnew->if_type = if_type_from_name(nnew->if_name);
+            nnew->if_speed = nnew->if_type == 6 ? getIfSpeed(fd, ifrq) :
+                nnew->if_type == 24 ? 10000000 :
+                nnew->if_type == 9 ? 4000000 : 0;
+            /*Zero speed means link problem*/
+            if(nnew->if_speed == 0 && nnew->if_flags & IFF_UP){
+                nnew->if_flags &= ~IFF_RUNNING;
+            }
+        }
+
+    }                           /* while (fgets ... */
+
+    ifnetaddr = ifnetaddr_list;
+
+    if (snmp_get_do_debugging()) {
+        {
+            struct ifnet   *x = ifnetaddr;
+            DEBUGMSGTL(("mibII/interfaces", "* see: known interfaces:"));
+            while (x) {
+                DEBUGMSG(("mibII/interfaces", " %s", x->if_name));
+                x = x->if_next;
+            }
+            DEBUGMSG(("mibII/interfaces", "\n"));
+        }                       /* XXX */
+    }
+
+    fclose(devin);
+    close(fd);
+#endif                          /* linux */
+}
+
+
+
+#if defined(sunV3) || defined(linux)
+/*
+ * **  4.2 BSD doesn't have ifaddr
+ * **  
+ */
+int
+Interface_Scan_Next(short *Index,
+                    char *Name,
+                    struct ifnet *Retifnet, struct in_ifaddr *dummy)
+{
+    struct ifnet    ifnet;
+    register char  *cp;
+
+    while (ifnetaddr) {
+        /*
+         *      Get the "ifnet" structure and extract the device name
+         */
+#ifndef linux
+        klookup((unsigned long) ifnetaddr, (char *) &ifnet, sizeof ifnet);
+        klookup((unsigned long) ifnet.if_name, (char *) saveName,
+                sizeof saveName);
+#else
+        ifnet = *ifnetaddr;
+        strncpy(saveName, ifnet.if_name, sizeof(saveName));
+#endif
+        if (strcmp(saveName, "ip") == 0) {
+            ifnetaddr = ifnet.if_next;
+            continue;
+        }
+
+
+
+        saveName[sizeof(saveName) - 1] = '\0';
+        cp = (char *) strchr(saveName, '\0');
+#ifdef linux
+        strncat(cp, ifnet.if_unit, sizeof(saveName)-strlen(saveName)-1);
+        saveName[sizeof(saveName) - 1] = '\0';
+#else
+        string_append_int(cp, ifnet.if_unit);
+#endif
+        if (1 || strcmp(saveName, "lo0") != 0) {        /* XXX */
+
+            if (Index)
+                *Index = ++saveIndex;
+            if (Retifnet)
+                *Retifnet = ifnet;
+            if (Name)
+                strcpy(Name, saveName);
+            saveifnet = ifnet;
+            saveifnetaddr = ifnetaddr;
+            ifnetaddr = ifnet.if_next;
+
+            return (1);         /* DONE */
+        }
+        ifnetaddr = ifnet.if_next;
+    }
+    return (0);                 /* EOF */
+}
+
+#ifdef linux
+int
+Interface_Index_By_Name(char *Name, int Len)
+{
+    short           ifIndex = 0;
+    char            ifName[20];
+
+    Interface_Scan_Init();
+    while (Interface_Scan_Next(&ifIndex, ifName, NULL, NULL)
+           && strcmp(Name, ifName));
+    return ifIndex;
+}
+#endif
+
+
+#else                           /* sunV3 || linux */
+
+#if defined(netbsd1) || defined(openbsd2)
+#define ia_next ia_list.tqe_next
+#define if_next if_list.tqe_next
+#endif
+
+#if defined(hpux11)
+
+int
+Interface_Scan_Next(short *Index, char *Name, nmapi_phystat * Retifnet)
+{
+    static nmapi_phystat *if_ptr = (nmapi_phystat *) 0;
+    int             count = Interface_Scan_Get_Count();
+    unsigned int    ulen;
+    int             ret;
+
+    if (!if_ptr) {
+        if (count)
+            if_ptr =
+                (nmapi_phystat *) malloc(sizeof(nmapi_phystat) * count);
+        else
+            return (0);         /* EOF */
+    }
+
+    if (saveIndex >= count)
+        return (0);             /* EOF */
+
+    ulen = (unsigned int) count *sizeof(nmapi_phystat);
+    if ((ret = get_physical_stat(if_ptr, &ulen)) < 0)
+        return (0);             /* EOF */
+
+    if (Retifnet)
+        *Retifnet = if_ptr[saveIndex];
+    if (Name)
+        strcpy(Name, if_ptr[saveIndex].nm_device);
+    saveIndex++;
+    if (Index)
+        *Index = saveIndex;
+    return (1);                 /* DONE */
+}
+
+#else                           /* hpux11 */
+
+int
+Interface_Scan_Next(short *Index,
+                    char *Name,
+                    struct ifnet *Retifnet, struct in_ifaddr *Retin_ifaddr)
+{
+    struct ifnet    ifnet;
+    struct in_ifaddr *ia, in_ifaddr;
+    short           has_ipaddr = 0;
+#if !STRUCT_IFNET_HAS_IF_XNAME
+    register char  *cp;
+#endif
+
+    while (ifnetaddr) {
+        /*
+         *      Get the "ifnet" structure and extract the device name
+         */
+        klookup((unsigned long) ifnetaddr, (char *) &ifnet, sizeof ifnet);
+#if STRUCT_IFNET_HAS_IF_XNAME
+#if defined(netbsd1) || defined(openbsd2)
+        strncpy(saveName, ifnet.if_xname, sizeof saveName);
+#else
+        klookup((unsigned long) ifnet.if_xname, (char *) saveName,
+                sizeof saveName);
+#endif
+        saveName[sizeof(saveName) - 1] = '\0';
+#else
+        klookup((unsigned long) ifnet.if_name, (char *) saveName,
+                sizeof saveName);
+
+        saveName[sizeof(saveName) - 1] = '\0';
+        cp = strchr(saveName, '\0');
+        string_append_int(cp, ifnet.if_unit);
+#endif
+        if (1 || strcmp(saveName, "lo0") != 0) {        /* XXX */
+            /*
+             *  Try to find an address for this interface
+             */
+
+            auto_nlist(IFADDR_SYMBOL, (char *) &ia, sizeof(ia));
+#ifdef netbsd1
+            ia = (struct in_ifaddr *) ifnet.if_addrlist.tqh_first;
+#endif
+            while (ia) {
+                klookup((unsigned long) ia, (char *) &in_ifaddr,
+                        sizeof(in_ifaddr));
+                {
+#ifdef netbsd1
+#define CP(x)	((char *)(x))
+                    char           *cp;
+                    struct sockaddr *sa;
+                    cp = (CP(in_ifaddr.ia_ifa.ifa_addr) - CP(ia)) +
+                        CP(&in_ifaddr);
+                    sa = (struct sockaddr *) cp;
+
+                    if (sa->sa_family == AF_INET)
+#endif
+                        if (in_ifaddr.ia_ifp == ifnetaddr) {
+                            has_ipaddr = 1;     /* this IF has IP-address */
+                            break;
+                        }
+                }
+#ifdef netbsd1
+                ia = (struct in_ifaddr *) in_ifaddr.ia_ifa.ifa_list.
+                    tqe_next;
+#else
+                ia = in_ifaddr.ia_next;
+#endif
+            }
+
+#if !defined(netbsd1) && !defined(freebsd2) && !defined(openbsd2) && !defined(STRUCT_IFNET_HAS_IF_ADDRLIST)
+            ifnet.if_addrlist = (struct ifaddr *) ia;   /* WRONG DATA TYPE; ONLY A FLAG */
+#endif
+            /*
+             * ifnet.if_addrlist = (struct ifaddr *)&ia->ia_ifa;   
+             *
+             * WRONG DATA TYPE; ONLY A FLAG 
+             */
+
+            if (Index)
+                *Index = ++saveIndex;
+            if (Retifnet)
+                *Retifnet = ifnet;
+            if (Retin_ifaddr && has_ipaddr)     /* assign the in_ifaddr only
+                                                 * if the IF has IP-address */
+                *Retin_ifaddr = in_ifaddr;
+            if (Name)
+                strcpy(Name, saveName);
+            saveifnet = ifnet;
+            saveifnetaddr = ifnetaddr;
+            savein_ifaddr = in_ifaddr;
+            ifnetaddr = ifnet.if_next;
+
+            return (1);         /* DONE */
+        }
+        ifnetaddr = ifnet.if_next;
+    }
+    return (0);                 /* EOF */
+}
+
+#endif                          /* hpux11 */
+
+#endif                          /* sunV3 || linux */
+
+#if defined(hpux11)
+
+static int
+Interface_Scan_By_Index(int Index, char *Name, nmapi_phystat * Retifnet)
+{
+    short           i;
+
+    Interface_Scan_Init();
+    while (Interface_Scan_Next(&i, Name, Retifnet)) {
+        if (i == Index)
+            break;
+    }
+    if (i != Index)
+        return (-1);            /* Error, doesn't exist */
+    return (0);                 /* DONE */
+}
+
+#else                           /* hpux11 */
+
+static int
+Interface_Scan_By_Index(int Index,
+                        char *Name,
+                        struct ifnet *Retifnet,
+                        struct in_ifaddr *Retin_ifaddr)
+{
+    short           i;
+
+    Interface_Scan_Init();
+    while (Interface_Scan_Next(&i, Name, Retifnet, Retin_ifaddr)) {
+        if (i == Index)
+            break;
+    }
+    if (i != Index)
+        return (-1);            /* Error, doesn't exist */
+    return (0);                 /* DONE */
+}
+
+#endif                          /* hpux11 */
+
+static int      Interface_Count = 0;
+
+#if defined(hpux11)
+
+static int
+Interface_Scan_Get_Count(void)
+{
+    if (!Interface_Count) {
+        int             fd;
+        struct nmparms  p;
+        int             val;
+        unsigned int    ulen;
+        int             ret;
+
+        if ((fd = open_mib("/dev/ip", O_RDONLY, 0, NM_ASYNC_OFF)) >= 0) {
+            p.objid = ID_ifNumber;
+            p.buffer = (void *) &val;
+            ulen = sizeof(int);
+            p.len = &ulen;
+            if ((ret = get_mib_info(fd, &p)) == 0)
+                Interface_Count = val;
+            close_mib(fd);
+        }
+    }
+    return (Interface_Count);
+}
+
+#else                           /* hpux11 */
+
+static time_t   scan_time = 0;
+
+int
+Interface_Scan_Get_Count(void)
+{
+    time_t          time_now = time(NULL);
+
+    if (!Interface_Count || (time_now > scan_time + 60)) {
+        scan_time = time_now;
+        Interface_Scan_Init();
+        Interface_Count = 0;
+        while (Interface_Scan_Next(NULL, NULL, NULL, NULL) != 0) {
+            Interface_Count++;
+        }
+    }
+    return (Interface_Count);
+}
+
+
+static int
+Interface_Get_Ether_By_Index(int Index, u_char * EtherAddr)
+{
+    short           i;
+#if !(defined(linux) || defined(netbsd1) || defined(bsdi2) || defined(openbsd2))
+    struct arpcom   arpcom;
+#else                           /* is linux or netbsd1 */
+    struct arpcom {
+        char            ac_enaddr[6];
+    } arpcom;
+#if defined(netbsd1) || defined(bsdi2) || defined(openbsd2)
+    struct sockaddr_dl sadl;
+    struct ifaddr   ifaddr;
+    u_long          ifaddraddr;
+#endif
+#endif
+
+#if defined(mips) || defined(hpux) || defined(osf4) || defined(osf3)
+    memset(arpcom.ac_enaddr, 0, sizeof(arpcom.ac_enaddr));
+#else
+    memset(&arpcom.ac_enaddr, 0, sizeof(arpcom.ac_enaddr));
+#endif
+    memset(EtherAddr, 0, sizeof(arpcom.ac_enaddr));
+
+    if (saveIndex != Index) {   /* Optimization! */
+
+        Interface_Scan_Init();
+
+        while (Interface_Scan_Next((short *) &i, NULL, NULL, NULL) != 0) {
+            if (i == Index)
+                break;
+        }
+        if (i != Index)
+            return (-1);        /* Error, doesn't exist */
+    }
+#ifdef freebsd2
+    if (saveifnet.if_type != IFT_ETHER) {
+        return (0);             /* Not an ethernet if */
+    }
+#endif
+    /*
+     *  the arpcom structure is an extended ifnet structure which
+     *  contains the ethernet address.
+     */
+#ifndef linux
+#if !(defined(netbsd1) || defined(bsdi2) || defined(openbsd2))
+    klookup((unsigned long) saveifnetaddr, (char *) &arpcom,
+            sizeof arpcom);
+#else                           /* netbsd1 or bsdi2 or openbsd2 */
+
+#if defined(netbsd1) || defined(openbsd2)
+#define if_addrlist if_addrlist.tqh_first
+#define ifa_next    ifa_list.tqe_next
+#endif
+
+    ifaddraddr = (unsigned long) saveifnet.if_addrlist;
+    while (ifaddraddr) {
+        klookup(ifaddraddr, (char *) &ifaddr, sizeof ifaddr);
+        klookup((unsigned long) ifaddr.ifa_addr, (char *) &sadl,
+                sizeof sadl);
+        if (sadl.sdl_family == AF_LINK
+            && (saveifnet.if_type == IFT_ETHER
+                || saveifnet.if_type == IFT_ISO88025
+                || saveifnet.if_type == IFT_FDDI)) {
+            memcpy(arpcom.ac_enaddr, sadl.sdl_data + sadl.sdl_nlen,
+                   sizeof(arpcom.ac_enaddr));
+            break;
+        }
+        ifaddraddr = (unsigned long) ifaddr.ifa_next;
+    }
+#endif                          /* netbsd1 or bsdi2 or openbsd2 */
+
+#else                           /* linux */
+    memcpy(arpcom.ac_enaddr, saveifnetaddr->if_hwaddr, 6);
+#endif
+    if (strncmp("lo", saveName, 2) == 0) {
+        /*
+         *  Loopback doesn't have a HW addr, so return 00:00:00:00:00:00
+         */
+        memset(EtherAddr, 0, sizeof(arpcom.ac_enaddr));
+
+    } else {
+
+#if defined(mips) || defined(hpux) || defined(osf4) || defined(osf3)
+        memcpy(EtherAddr, (char *) arpcom.ac_enaddr,
+               sizeof(arpcom.ac_enaddr));
+#else
+        memcpy(EtherAddr, (char *) &arpcom.ac_enaddr,
+               sizeof(arpcom.ac_enaddr));
+#endif
+
+
+    }
+    return (0);                 /* DONE */
+}
+
+#endif                          /* hpux11 */
+
+#else                           /* solaris2 */
+
+int
+Interface_Scan_Get_Count(void)
+{
+    int             i, sd;
+
+    if ((sd = socket(AF_INET, SOCK_DGRAM, 0)) < 0)
+        return (0);
+    if (ioctl(sd, SIOCGIFNUM, &i) == -1) {
+        close(sd);
+        return (0);
+    } else {
+        close(sd);
+        return (i);
+    }
+}
+
+int
+Interface_Index_By_Name(char *Name, int Len)
+{
+    int             i, sd, lastlen = 0, interfaces = 0;
+    struct ifconf   ifc;
+    struct ifreq   *ifrp = NULL;
+    char           *buf = NULL;
+
+    if (Name == 0) {
+        return 0;
+    }
+    if ((sd = socket(AF_INET, SOCK_DGRAM, 0)) < 0) {
+        return 0;
+    }
+
+    /*
+     * Cope with lots of interfaces and brokenness of ioctl SIOCGIFCONF
+     * on some platforms; see W. R. Stevens, ``Unix Network Programming
+     * Volume I'', p.435.  
+     */
+
+    for (i = 8;; i += 8) {
+        buf = calloc(i, sizeof(struct ifreq));
+        if (buf == NULL) {
+            close(sd);
+            return 0;
+        }
+        ifc.ifc_len = i * sizeof(struct ifreq);
+        ifc.ifc_buf = (caddr_t) buf;
+
+        if (ioctl(sd, SIOCGIFCONF, (char *) &ifc) < 0) {
+            if (errno != EINVAL || lastlen != 0) {
+                /*
+                 * Something has gone genuinely wrong.  
+                 */
+                free(buf);
+                close(sd);
+                return 0;
+            }
+            /*
+             * Otherwise, it could just be that the buffer is too small.  
+             */
+        } else {
+            if (ifc.ifc_len == lastlen) {
+                /*
+                 * The length is the same as the last time; we're done.  
+                 */
+                break;
+            }
+            lastlen = ifc.ifc_len;
+        }
+        free(buf);
+    }
+
+    ifrp = ifc.ifc_req;
+    interfaces = (ifc.ifc_len / sizeof(struct ifreq)) + 1;
+
+    for (i = 1; i < interfaces; i++, ifrp++) {
+        if (strncmp(ifrp->ifr_name, Name, Len) == 0) {
+            free(buf);
+            close(sd);
+            return i;
+        }
+    }
+
+    free(buf);
+    close(sd);
+    return 0;
+}
+
+#endif                          /* solaris2 */
+
+#else                           /* HAVE_NET_IF_MIB_H */
+
+/*
+ * This code attempts to do the right thing for FreeBSD.  Note that
+ * the statistics could be gathered through use of of the
+ * net.route.0.link.iflist.0 sysctl (which we already use to get the
+ * hardware address of the interfaces), rather than using the ifmib
+ * code, but eventually I will implement dot3Stats and we will have to
+ * use the ifmib interface.  ifmib is also a much more natural way of
+ * mapping the SNMP MIB onto sysctl(3).
+ */
+
+#include <net/if.h>
+#include <net/if_dl.h>
+#include <net/if_mib.h>
+#include <net/route.h>
+
+static int      header_interfaces(struct variable *, oid *, size_t *, int,
+                                  size_t *, WriteMethod ** write);
+static int      header_ifEntry(struct variable *, oid *, size_t *, int,
+                               size_t *, WriteMethod ** write);
+u_char         *var_ifEntry(struct variable *, oid *, size_t *, int,
+                            size_t *, WriteMethod ** write);
+
+static char    *physaddrbuf;
+static int      nphysaddrs;
+struct sockaddr_dl **physaddrs;
+
+void
+init_interfaces_setup(void)
+{
+    int             naddrs, ilen, bit;
+    static int      mib[6]
+    = { CTL_NET, PF_ROUTE, 0, AF_LINK, NET_RT_IFLIST, 0 };
+    char           *cp;
+    size_t          len;
+    struct rt_msghdr *rtm;
+    struct if_msghdr *ifm;
+    struct ifa_msghdr *ifam;
+    struct sockaddr *sa;
+
+    naddrs = 0;
+    if (physaddrs)
+        free(physaddrs);
+    if (physaddrbuf)
+        free(physaddrbuf);
+    physaddrbuf = 0;
+    physaddrs = 0;
+    nphysaddrs = 0;
+    len = 0;
+    if (sysctl(mib, 6, 0, &len, 0, 0) < 0)
+        return;
+
+    cp = physaddrbuf = malloc(len);
+    if (physaddrbuf == 0)
+        return;
+    if (sysctl(mib, 6, physaddrbuf, &len, 0, 0) < 0) {
+        free(physaddrbuf);
+        physaddrbuf = 0;
+        return;
+    }
+
+  loop:
+    ilen = len;
+    cp = physaddrbuf;
+    while (ilen > 0) {
+        rtm = (struct rt_msghdr *) cp;
+        if (rtm->rtm_version != RTM_VERSION || rtm->rtm_type != RTM_IFINFO) {
+            free(physaddrs);
+            physaddrs = 0;
+            free(physaddrbuf);
+            physaddrbuf = 0;
+        }
+        ifm = (struct if_msghdr *) rtm;
+#if defined(freebsd3) || defined(freebsd4) || defined(freebsd5)
+        if (physaddrs != 0)
+            physaddrs[naddrs] = (void *) (ifm + 1);
+        naddrs++;
+#endif
+        ilen -= ifm->ifm_msglen;
+        cp += ifm->ifm_msglen;
+        rtm = (struct rt_msghdr *) cp;
+        while (ilen > 0 && rtm->rtm_type == RTM_NEWADDR) {
+#if defined(freebsd3) || defined(freebsd4) || defined(freebsd5)
+            ilen -= rtm->rtm_msglen;
+            cp += rtm->rtm_msglen;
+#else
+            int             is_alias = 0;
+            ifam = (struct ifa_msghdr *) rtm;
+            ilen -= sizeof(*ifam);
+            cp += sizeof(*ifam);
+            sa = (struct sockaddr *) cp;
+#define ROUND(x) (((x) + sizeof(long) - 1) & ~sizeof(long))
+            for (bit = 1; bit && ilen > 0; bit <<= 1) {
+                if (!(ifam->ifam_addrs & bit))
+                    continue;
+                ilen -= ROUND(sa->sa_len);
+                cp += ROUND(sa->sa_len);
+
+                if (bit == RTA_IFA) {
+                    if (physaddrs)
+#define satosdl(sa) ((struct sockaddr_dl *)(sa))
+                        physaddrs[naddrs++]
+                            = satosdl(sa);
+                    else
+                        naddrs++;
+                }
+                sa = (struct sockaddr *) cp;
+            }
+#endif
+            rtm = (struct rt_msghdr *) cp;
+        }
+    }
+    if (physaddrs) {
+        nphysaddrs = naddrs;
+        return;
+    }
+    physaddrs = malloc(naddrs * sizeof(*physaddrs));
+    if (physaddrs == 0)
+        return;
+    naddrs = 0;
+    goto loop;
+
+}
+
+static int
+get_phys_address(int iindex, char **ap, int *len)
+{
+    int             i;
+    int             once = 1;
+
+    do {
+        for (i = 0; i < nphysaddrs; i++) {
+            if (physaddrs[i]->sdl_index == iindex)
+                break;
+        }
+        if (i < nphysaddrs)
+            break;
+        init_interfaces_setup();
+    } while (once--);
+
+    if (i < nphysaddrs) {
+        *ap = LLADDR(physaddrs[i]);
+        *len = physaddrs[i]->sdl_alen;
+        return 0;
+    }
+    return -1;
+}
+
+int
+Interface_Scan_Get_Count(void)
+{
+    static int      count_oid[5] = { CTL_NET, PF_LINK, NETLINK_GENERIC,
+        IFMIB_SYSTEM, IFMIB_IFCOUNT
+    };
+    size_t          len;
+    int             count;
+
+    len = sizeof count;
+    if (sysctl(count_oid, 5, &count, &len, (void *) 0, (size_t) 0) < 0)
+        return -1;
+    return count;
+}
+
+
+u_char         *
+var_ifEntry(struct variable * vp,
+            oid * name,
+            size_t * length,
+            int exact, size_t * var_len, WriteMethod ** write_method)
+{
+    int             interface;
+    static int      sname[6] = { CTL_NET, PF_LINK, NETLINK_GENERIC,
+        IFMIB_IFDATA, 0, IFDATA_GENERAL
+    };
+    static struct ifmibdata ifmd;
+    size_t          len;
+    char           *cp;
+
+    interface = header_ifEntry(vp, name, length, exact, var_len,
+                               write_method);
+    if (interface == MATCH_FAILED)
+        return NULL;
+
+    sname[4] = interface;
+    len = sizeof ifmd;
+    if (sysctl(sname, 6, &ifmd, &len, 0, 0) < 0)
+        return NULL;
+
+    switch (vp->magic) {
+    case IFINDEX:
+        long_return = interface;
+        return (u_char *) & long_return;
+    case IFDESCR:
+        cp = ifmd.ifmd_name;
+        *var_len = strlen(cp);
+        return (u_char *) cp;
+    case IFTYPE:
+        long_return = ifmd.ifmd_data.ifi_type;
+        return (u_char *) & long_return;
+    case IFMTU:
+        long_return = (long) ifmd.ifmd_data.ifi_mtu;
+        return (u_char *) & long_return;
+    case IFSPEED:
+        long_return = ifmd.ifmd_data.ifi_baudrate;
+        return (u_char *) & long_return;
+    case IFPHYSADDRESS:
+        {
+            char           *cp;
+            if (get_phys_address(interface, &cp, var_len))
+                return NULL;
+            else
+                return cp;
+        }
+    case IFADMINSTATUS:
+        long_return = ifmd.ifmd_flags & IFF_UP ? 1 : 2;
+        return (u_char *) & long_return;
+    case IFOPERSTATUS:
+        long_return = ifmd.ifmd_flags & IFF_RUNNING ? 1 : 2;
+        return (u_char *) & long_return;
+    case IFLASTCHANGE:
+        if (ifmd.ifmd_data.ifi_lastchange.tv_sec == 0 &&
+            ifmd.ifmd_data.ifi_lastchange.tv_usec == 0) {
+            long_return = 0;
+        } else if (ifmd.ifmd_data.ifi_lastchange.tv_sec < starttime.tv_sec) {
+            long_return = 0;
+        } else {
+            long_return = (u_long)
+                ((ifmd.ifmd_data.ifi_lastchange.tv_sec -
+                  starttime.tv_sec) * 100 +
+                 ((ifmd.ifmd_data.ifi_lastchange.tv_usec -
+                   starttime.tv_usec) / 10000));
+        }
+        return (u_char *) & long_return;
+    case IFINOCTETS:
+        long_return = (u_long) ifmd.ifmd_data.ifi_ibytes;
+        return (u_char *) & long_return;
+    case IFINUCASTPKTS:
+        long_return = (u_long) ifmd.ifmd_data.ifi_ipackets;
+        long_return -= (u_long) ifmd.ifmd_data.ifi_imcasts;
+        return (u_char *) & long_return;
+    case IFINNUCASTPKTS:
+        long_return = (u_long) ifmd.ifmd_data.ifi_imcasts;
+        return (u_char *) & long_return;
+    case IFINDISCARDS:
+        long_return = (u_long) ifmd.ifmd_data.ifi_iqdrops;
+        return (u_char *) & long_return;
+    case IFINERRORS:
+        long_return = ifmd.ifmd_data.ifi_ierrors;
+        return (u_char *) & long_return;
+    case IFINUNKNOWNPROTOS:
+        long_return = (u_long) ifmd.ifmd_data.ifi_noproto;
+        return (u_char *) & long_return;
+    case IFOUTOCTETS:
+        long_return = (u_long) ifmd.ifmd_data.ifi_obytes;
+        return (u_char *) & long_return;
+    case IFOUTUCASTPKTS:
+        long_return = (u_long) ifmd.ifmd_data.ifi_opackets;
+        long_return -= (u_long) ifmd.ifmd_data.ifi_omcasts;
+        return (u_char *) & long_return;
+    case IFOUTNUCASTPKTS:
+        long_return = (u_long) ifmd.ifmd_data.ifi_omcasts;
+        return (u_char *) & long_return;
+    case IFOUTDISCARDS:
+        long_return = ifmd.ifmd_snd_drops;
+        return (u_char *) & long_return;
+    case IFOUTERRORS:
+        long_return = ifmd.ifmd_data.ifi_oerrors;
+        return (u_char *) & long_return;
+    case IFOUTQLEN:
+        long_return = ifmd.ifmd_snd_len;
+        return (u_char *) & long_return;
+    case IFSPECIFIC:
+        *var_len = nullOidLen;
+        return (u_char *) nullOid;
+    default:
+        DEBUGMSGTL(("snmpd", "unknown sub-id %d in var_ifEntry\n",
+                    vp->magic));
+    }
+    return NULL;
+}
+
+#endif                          /* HAVE_NET_IF_MIB_H */
+#endif                          /* !USE_SYSCTL_IFLIST */
+
+#else                           /* WIN32 */
+#include <iphlpapi.h>
+
+WriteMethod     writeIfEntry;
+long            admin_status = 0;
+long            oldadmin_status = 0;
+
+static int
+header_ifEntry(struct variable *vp,
+               oid * name,
+               size_t * length,
+               int exact, size_t * var_len, WriteMethod ** write_method)
+{
+#define IFENTRY_NAME_LENGTH	10
+    oid             newname[MAX_OID_LEN];
+    register int    ifIndex;
+    int             result, count;
+    DWORD           status = NO_ERROR;
+    DWORD           statusRetry = NO_ERROR;
+    DWORD           dwActualSize = 0;
+    PMIB_IFTABLE    pIfTable = NULL;
+
+    DEBUGMSGTL(("mibII/interfaces", "var_ifEntry: "));
+    DEBUGMSGOID(("mibII/interfaces", name, *length));
+    DEBUGMSG(("mibII/interfaces", " %d\n", exact));
+
+    memcpy((char *) newname, (char *) vp->name,
+           (int) vp->namelen * sizeof(oid));
+    /*
+     * find "next" ifIndex 
+     */
+
+
+    /*
+     * query for buffer size needed 
+     */
+    status = GetIfTable(pIfTable, &dwActualSize, TRUE);
+
+    if (status == ERROR_INSUFFICIENT_BUFFER) {
+        /*
+         * need more space 
+         */
+        pIfTable = (PMIB_IFTABLE) malloc(dwActualSize);
+        if (pIfTable != NULL) {
+            /*
+             * Get the sorted IF table 
+             */
+            GetIfTable(pIfTable, &dwActualSize, TRUE);
+        }
+    }
+    count = pIfTable->dwNumEntries;
+    for (ifIndex = 0; ifIndex < count; ifIndex++) {
+        newname[IFENTRY_NAME_LENGTH] =
+            (oid) pIfTable->table[ifIndex].dwIndex;
+        result =
+            snmp_oid_compare(name, *length, newname,
+                             (int) vp->namelen + 1);
+        if ((exact && (result == 0)) || (!exact && (result < 0)))
+            break;
+    }
+    if (ifIndex > count) {
+        DEBUGMSGTL(("mibII/interfaces", "... index out of range\n"));
+        return MATCH_FAILED;
+    }
+
+
+    memcpy((char *) name, (char *) newname,
+           ((int) vp->namelen + 1) * sizeof(oid));
+    *length = vp->namelen + 1;
+    *write_method = 0;
+    *var_len = sizeof(long);    /* default to 'long' results */
+
+    DEBUGMSGTL(("mibII/interfaces", "... get I/F stats "));
+    DEBUGMSGOID(("mibII/interfaces", name, *length));
+    DEBUGMSG(("mibII/interfaces", "\n"));
+
+    count = pIfTable->table[ifIndex].dwIndex;
+    free(pIfTable);
+    return count;
+}
+
+
+
+u_char         *
+var_interfaces(struct variable * vp,
+               oid * name,
+               size_t * length,
+               int exact, size_t * var_len, WriteMethod ** write_method)
+{
+    if (header_generic(vp, name, length, exact, var_len, write_method) ==
+        MATCH_FAILED)
+        return NULL;
+
+    switch (vp->magic) {
+    case IFNUMBER:
+        GetNumberOfInterfaces(&long_return);
+        return (u_char *) & long_return;
+    default:
+        DEBUGMSGTL(("snmpd", "unknown sub-id %d in var_interfaces\n",
+                    vp->magic));
+    }
+    return NULL;
+}
+
+u_char         *
+var_ifEntry(struct variable * vp,
+            oid * name,
+            size_t * length,
+            int exact, size_t * var_len, WriteMethod ** write_method)
+{
+    int             ifIndex;
+    static char     Name[16];
+    conf_if_list   *if_ptr = conf_list;
+    static MIB_IFROW ifRow;
+
+    ifIndex =
+        header_ifEntry(vp, name, length, exact, var_len, write_method);
+    if (ifIndex == MATCH_FAILED)
+        return NULL;
+
+    /*
+     * Get the If Table Row by passing index as argument 
+     */
+    ifRow.dwIndex = ifIndex;
+    if (GetIfEntry(&ifRow) != NO_ERROR)
+        return NULL;
+    switch (vp->magic) {
+    case IFINDEX:
+        long_return = ifIndex;
+        return (u_char *) & long_return;
+    case IFDESCR:
+        *var_len = ifRow.dwDescrLen;
+        return (u_char *) ifRow.bDescr;
+    case IFTYPE:
+        long_return = ifRow.dwType;
+        return (u_char *) & long_return;
+    case IFMTU:
+        long_return = (long) ifRow.dwMtu;
+        return (u_char *) & long_return;
+    case IFSPEED:
+        long_return = (long) ifRow.dwSpeed;
+        return (u_char *) & long_return;
+    case IFPHYSADDRESS:
+        *var_len = ifRow.dwPhysAddrLen;
+        memcpy(return_buf, ifRow.bPhysAddr, *var_len);
+        return (u_char *) return_buf;
+    case IFADMINSTATUS:
+        long_return = ifRow.dwAdminStatus;
+        admin_status = long_return;
+        *write_method = writeIfEntry;
+        return (u_char *) & long_return;
+    case IFOPERSTATUS:
+        long_return = ifRow.dwOperStatus;
+        return (u_char *) & long_return;
+    case IFLASTCHANGE:
+        long_return = ifRow.dwLastChange;
+        return (u_char *) & long_return;
+    case IFINOCTETS:
+        long_return = ifRow.dwInOctets;
+        return (u_char *) & long_return;
+    case IFINUCASTPKTS:
+        long_return = ifRow.dwInUcastPkts;
+        return (u_char *) & long_return;
+    case IFINNUCASTPKTS:
+        long_return = ifRow.dwInNUcastPkts;
+        return (u_char *) & long_return;
+    case IFINDISCARDS:
+        long_return = ifRow.dwInDiscards;
+        return (u_char *) & long_return;
+    case IFINERRORS:
+        long_return = ifRow.dwInErrors;
+        return (u_char *) & long_return;
+    case IFINUNKNOWNPROTOS:
+        long_return = ifRow.dwInUnknownProtos;
+        return (u_char *) & long_return;
+    case IFOUTOCTETS:
+        long_return = ifRow.dwOutOctets;
+        return (u_char *) & long_return;
+    case IFOUTUCASTPKTS:
+        long_return = ifRow.dwOutUcastPkts;
+        return (u_char *) & long_return;
+    case IFOUTNUCASTPKTS:
+        long_return = ifRow.dwOutNUcastPkts;
+        return (u_char *) & long_return;
+    case IFOUTDISCARDS:
+        long_return = ifRow.dwOutDiscards;
+        return (u_char *) & long_return;
+    case IFOUTERRORS:
+        long_return = ifRow.dwOutErrors;
+        return (u_char *) & long_return;
+    case IFOUTQLEN:
+        long_return = ifRow.dwOutQLen;
+        return (u_char *) & long_return;
+    case IFSPECIFIC:
+        *var_len = nullOidLen;
+        return (u_char *) nullOid;
+    default:
+        DEBUGMSGTL(("snmpd", "unknown sub-id %d in var_ifEntry\n",
+                    vp->magic));
+    }
+    return NULL;
+}
+
+
+int
+writeIfEntry(int action,
+             u_char * var_val,
+             u_char var_val_type,
+             size_t var_val_len,
+             u_char * statP, oid * name, size_t name_len)
+{
+    MIB_IFROW       ifEntryRow;
+    if ((char) name[9] != IFADMINSTATUS) {
+        return SNMP_ERR_NOTWRITABLE;
+    }
+
+    switch (action) {
+    case RESERVE1:             /* Check values for acceptability */
+        if (var_val_type != ASN_INTEGER) {
+            snmp_log(LOG_ERR, "not integer\n");
+            return SNMP_ERR_WRONGTYPE;
+        }
+        if (var_val_len > sizeof(int)) {
+            snmp_log(LOG_ERR, "bad length\n");
+            return SNMP_ERR_WRONGLENGTH;
+        }
+
+        /*
+         * The dwAdminStatus member can be MIB_IF_ADMIN_STATUS_UP or MIB_IF_ADMIN_STATUS_DOWN 
+         */
+        if (!(((int) (*var_val) == MIB_IF_ADMIN_STATUS_UP) ||
+              ((int) (*var_val) == MIB_IF_ADMIN_STATUS_DOWN))) {
+            snmp_log(LOG_ERR, "not supported admin state\n");
+            return SNMP_ERR_WRONGVALUE;
+        }
+        break;
+
+    case RESERVE2:             /* Allocate memory and similar resources */
+        break;
+
+    case ACTION:
+        /*
+         * Save the old value, in case of UNDO 
+         */
+
+        oldadmin_status = admin_status;
+        admin_status = (int) *var_val;
+        break;
+
+    case UNDO:                 /* Reverse the SET action and free resources */
+        admin_status = oldadmin_status;
+        break;
+
+    case COMMIT:               /* Confirm the SET, performing any irreversible actions,
+                                 * and free resources */
+        ifEntryRow.dwIndex = (int) name[10];
+        ifEntryRow.dwAdminStatus = admin_status;
+        /*
+         * Only UP and DOWN status are supported. Thats why done in COMMIT 
+         */
+        if (SetIfEntry(&ifEntryRow) != NO_ERROR) {
+            snmp_log(LOG_ERR,
+                     "Error in writeIfEntry case COMMIT with index: %d & adminStatus %d\n",
+                     ifEntryRow.dwIndex, ifEntryRow.dwAdminStatus);
+            return SNMP_ERR_COMMITFAILED;
+        }
+
+    case FREE:                 /* Free any resources allocated */
+        /*
+         * No resources have been allocated 
+         */
+        break;
+    }
+    return SNMP_ERR_NOERROR;
+}                               /* end of writeIfEntry */
+#endif                          /* WIN32 */
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/mibII/interfaces.h tomato121/release/src/router/snmp/agent/mibgroup/mibII/interfaces.h
--- tomato/release/src/router/snmp/agent/mibgroup/mibII/interfaces.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/mibII/interfaces.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,99 @@
+/*
+ *  Interfaces MIB group interface - interfaces.h
+ *
+ */
+#ifndef _MIBGROUP_INTERFACES_H
+#define _MIBGROUP_INTERFACES_H
+
+config_require(util_funcs)
+    config_arch_require(solaris2, kernel_sunos5)
+#ifdef hpux11
+#include <sys/mib.h>
+#else
+     struct in_ifaddr;
+     struct ifnet;
+#endif
+
+     int             Interface_Scan_Get_Count(void);
+     int             Interface_Index_By_Name(char *, int);
+     void            Interface_Scan_Init(void);
+#if defined(linux) || defined(sunV3)
+     struct in_ifaddr {
+         int             dummy;
+     };
+#endif
+#if defined(hpux11)
+     int             Interface_Scan_Next(short *, char *, nmapi_phystat *);
+#else
+     int             Interface_Scan_Next(short *, char *, struct ifnet *,
+                                         struct in_ifaddr *);
+#endif
+
+     void            init_interfaces(void);
+     extern FindVarMethod var_interfaces;
+     extern FindVarMethod var_ifEntry;
+
+#define IFNUMBER        0
+#define IFINDEX         1
+#define IFDESCR         2
+#define IFTYPE          3
+#define IFMTU           4
+#define IFSPEED         5
+#define IFPHYSADDRESS   6
+#define IFADMINSTATUS   7
+#define IFOPERSTATUS    8
+#define IFLASTCHANGE    9
+#define IFINOCTETS      10
+#define IFINUCASTPKTS   11
+#define IFINNUCASTPKTS  12
+#define IFINDISCARDS    13
+#define IFINERRORS      14
+#define IFINUNKNOWNPROTOS 15
+#define IFOUTOCTETS     16
+#define IFOUTUCASTPKTS  17
+#define IFOUTNUCASTPKTS 18
+#define IFOUTDISCARDS   19
+#define IFOUTERRORS     20
+#define IFOUTQLEN       21
+#define IFSPECIFIC      22
+
+#ifdef linux
+/*
+ * this struct ifnet is cloned from the generic type and somewhat modified.
+ * it will not work for other un*x'es...
+ */
+
+     struct ifnet {
+         char           *if_name;       /* name, e.g. ``en'' or ``lo'' */
+         char           *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 */
+         u_long          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 */
+         u_long          if_ibytes;     /* octets received on interface */
+         u_long          if_ipackets;   /* packets received on interface */
+         u_long          if_ierrors;    /* input errors on interface */
+         u_long          if_iqdrops;    /* input queue overruns */
+         u_long          if_obytes;     /* octets sent on interface */
+         u_long          if_opackets;   /* packets sent on interface */
+         u_long          if_oerrors;    /* output errors on interface */
+         u_long          if_collisions; /* collisions on csma interfaces */
+         /*
+          * end statistics 
+          */
+         struct ifnet   *if_next;
+     };
+#endif
+#endif                          /* _MIBGROUP_INTERFACES_H */
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/mibII/ipAddr.c tomato121/release/src/router/snmp/agent/mibgroup/mibII/ipAddr.c
--- tomato/release/src/router/snmp/agent/mibgroup/mibII/ipAddr.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/mibII/ipAddr.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,1037 @@
+/*
+ *  IP MIB group implementation - ip.c
+ *
+ */
+
+#include <net-snmp/net-snmp-config.h>
+
+#if defined(IFNET_NEEDS_KERNEL) && !defined(_KERNEL)
+#define _KERNEL 1
+#define _I_DEFINED_KERNEL
+#endif
+#if HAVE_SYS_PARAM_H
+#include <sys/param.h>
+#endif
+#if HAVE_UNISTD_H
+#ifdef irix6
+#define _STANDALONE 1
+#endif
+#include <unistd.h>
+#endif
+#if HAVE_SYS_SOCKET_H
+#include <sys/socket.h>
+#endif
+
+#if HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+#include <sys/types.h>
+#if HAVE_WINSOCK_H
+#include <winsock.h>
+#endif
+#if HAVE_SYS_SYSCTL_H
+#ifdef _I_DEFINED_KERNEL
+#undef _KERNEL
+#endif
+#include <sys/sysctl.h>
+#ifdef _I_DEFINED_KERNEL
+#define _KERNEL 1
+#endif
+#endif
+#if HAVE_SYS_SYSMP_H
+#include <sys/sysmp.h>
+#endif
+#if HAVE_SYS_TCPIPSTATS_H
+#include <sys/tcpipstats.h>
+#endif
+#if HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+#if HAVE_NET_IF_H
+#include <net/if.h>
+#endif
+#if HAVE_NET_IF_VAR_H
+#include <net/if_var.h>
+#endif
+#ifdef _I_DEFINED_KERNEL
+#undef _KERNEL
+#endif
+#if HAVE_NETINET_IN_SYSTM_H
+#include <netinet/in_systm.h>
+#endif
+#if HAVE_SYS_HASHING_H
+#include <sys/hashing.h>
+#endif
+#if HAVE_NETINET_IN_VAR_H
+#include <netinet/in_var.h>
+#endif
+#if HAVE_NETINET_IP_H
+#include <netinet/ip.h>
+#endif
+#if HAVE_NETINET_IP_VAR_H
+#include <netinet/ip_var.h>
+#endif
+#if HAVE_INET_MIB2_H
+#include <inet/mib2.h>
+#endif
+#if HAVE_SYS_STREAM_H
+#include <sys/stream.h>
+#endif
+#if HAVE_NET_ROUTE_H
+#include <net/route.h>
+#endif
+#if HAVE_SYSLOG_H
+#include <syslog.h>
+#endif
+#if HAVE_SYS_IOCTL_H
+#include <sys/ioctl.h>
+#endif
+
+#if defined(MIB_IPCOUNTER_SYMBOL) || defined(hpux11)
+#include <sys/mib.h>
+#include <netinet/mib_kern.h>
+#endif                          /* MIB_IPCOUNTER_SYMBOL || hpux11 */
+
+#ifdef solaris2
+#include "kernel_sunos5.h"
+#else
+#include "kernel.h"
+#endif
+
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include <net-snmp/agent/auto_nlist.h>
+
+#include "ip.h"
+#include "interfaces.h"
+#include "sysORTable.h"
+
+#ifdef cygwin
+#define WIN32
+#include <windows.h>
+#endif
+
+        /*********************
+	 *
+	 *  Kernel & interface information,
+	 *   and internal forward declarations
+	 *
+	 *********************/
+
+        /*********************
+	 *
+	 *  Initialisation & common implementation functions
+	 *
+	 *********************/
+
+        /*********************
+	 *
+	 *  System specific implementation functions
+	 *
+	 *********************/
+
+#ifndef WIN32
+
+#if !defined(CAN_USE_SYSCTL) || !defined(IPCTL_STATS)
+#ifndef solaris2
+
+#if defined(freebsd2) || defined(hpux11) || defined(linux)
+static void     Address_Scan_Init(void);
+#ifdef freebsd2
+static int      Address_Scan_Next(short *, struct in_ifaddr *);
+#else
+#ifdef linux
+static struct ifconf ifc;
+static int      Address_Scan_Next(short *, struct ifnet *);
+#else
+static int      Address_Scan_Next(short *, mib_ipAdEnt *);
+#endif
+#endif
+#endif
+
+/*
+ * var_ipAddrEntry(...
+ * Arguments:
+ * vp     IN      - pointer to variable entry that points here
+ * name    IN/OUT  - IN/name requested, OUT/name found
+ * length  IN/OUT  - length of IN/OUT oid's 
+ * exact   IN      - TRUE if an exact match was requested
+ * var_len OUT     - length of variable or 0 if function returned
+ * write_method
+ * 
+ */
+
+u_char         *
+var_ipAddrEntry(struct variable *vp,
+                oid * name,
+                size_t * length,
+                int exact, size_t * var_len, WriteMethod ** write_method)
+{
+    /*
+     * object identifier is of form:
+     * 1.3.6.1.2.1.4.20.1.?.A.B.C.D,  where A.B.C.D is IP address.
+     * IPADDR starts at offset 10.
+     */
+    oid             lowest[14];
+    oid             current[14], *op;
+    u_char         *cp;
+    int             lowinterface = 0;
+#ifndef freebsd2
+    short           interface;
+#endif
+#ifdef hpux11
+    static mib_ipAdEnt in_ifaddr, lowin_ifaddr;
+#else
+#if !defined(linux) && !defined(sunV3)
+    static struct in_ifaddr in_ifaddr, lowin_ifaddr;
+#else
+    static struct ifnet lowin_ifnet;
+#endif
+    static struct ifnet ifnet;
+#endif                          /* hpux11 */
+
+    /*
+     * fill in object part of name for current (less sizeof instance part) 
+     */
+
+    memcpy((char *) current, (char *) vp->name,
+           (int) vp->namelen * sizeof(oid));
+
+#if !defined(freebsd2) && !defined(hpux11) && !defined(linux)
+    Interface_Scan_Init();
+#else
+    Address_Scan_Init();
+#endif
+    for (;;) {
+
+#if !defined(freebsd2) && !defined(hpux11) && !defined(linux)
+        if (Interface_Scan_Next(&interface, NULL, &ifnet, &in_ifaddr) == 0)
+            break;
+#ifdef STRUCT_IFNET_HAS_IF_ADDRLIST
+        if (ifnet.if_addrlist == 0)
+            continue;           /* No address found for interface */
+#endif
+#else                           /* !freebsd2 && !hpux11 */
+#if defined(linux)
+        if (Address_Scan_Next(&interface, &ifnet) == 0)
+            break;
+#else
+        if (Address_Scan_Next(&interface, &in_ifaddr) == 0)
+            break;
+#endif
+#endif                          /* !freebsd2 && !hpux11 && !linux */
+
+#ifdef hpux11
+        cp = (u_char *) & in_ifaddr.Addr;
+#elif defined(linux) || defined(sunV3)
+        cp = (u_char *) & (((struct sockaddr_in *) &(ifnet.if_addr))->
+                           sin_addr.s_addr);
+#else
+        cp = (u_char *) & (((struct sockaddr_in *) &(in_ifaddr.ia_addr))->
+                           sin_addr.s_addr);
+#endif
+
+        op = current + 10;
+        *op++ = *cp++;
+        *op++ = *cp++;
+        *op++ = *cp++;
+        *op++ = *cp++;
+        if (exact) {
+            if (snmp_oid_compare(current, 14, name, *length) == 0) {
+                memcpy((char *) lowest, (char *) current,
+                       14 * sizeof(oid));
+                lowinterface = interface;
+#if defined(linux) || defined(sunV3)
+                lowin_ifnet = ifnet;
+#else
+                lowin_ifaddr = in_ifaddr;
+#endif
+                break;          /* no need to search further */
+            }
+        } else {
+            if ((snmp_oid_compare(current, 14, name, *length) > 0) &&
+                (!lowinterface
+                 || (snmp_oid_compare(current, 14, lowest, 14) < 0))) {
+                /*
+                 * if new one is greater than input and closer to input than
+                 * previous lowest, save this one as the "next" one.
+                 */
+                lowinterface = interface;
+#if defined(linux) || defined(sunV3)
+                lowin_ifnet = ifnet;
+#else
+                lowin_ifaddr = in_ifaddr;
+#endif
+                memcpy((char *) lowest, (char *) current,
+                       14 * sizeof(oid));
+            }
+        }
+    }
+
+#if defined(linux)
+    free(ifc.ifc_buf);
+#endif
+
+    if (!lowinterface)
+        return (NULL);
+    memcpy((char *) name, (char *) lowest, 14 * sizeof(oid));
+    *length = 14;
+    *write_method = 0;
+    *var_len = sizeof(long_return);
+    switch (vp->magic) {
+    case IPADADDR:
+#ifdef hpux11
+        long_return = lowin_ifaddr.Addr;
+        return (u_char *) & long_return;
+#elif defined(linux) || defined(sunV3)
+        return (u_char *) & ((struct sockaddr_in *) &lowin_ifnet.if_addr)->
+            sin_addr.s_addr;
+#else
+        return (u_char *) & ((struct sockaddr_in *) &lowin_ifaddr.
+                             ia_addr)->sin_addr.s_addr;
+#endif
+    case IPADIFINDEX:
+        long_return = lowinterface;
+        return (u_char *) & long_return;
+    case IPADNETMASK:
+#ifdef hpux11
+        long_return = lowin_ifaddr.NetMask;
+        return (u_char *) & long_return;
+#elif defined(linux)
+        return (u_char *) & ((struct sockaddr_in *) &lowin_ifnet.
+                             ia_subnetmask)->sin_addr.s_addr;
+#elif !defined(sunV3)
+        long_return = lowin_ifaddr.ia_subnetmask;
+        return (u_char *) & long_return;
+#endif
+    case IPADBCASTADDR:
+#ifdef hpux11
+        long_return = lowin_ifaddr.BcastAddr;
+#elif defined(linux) || defined(sunV3)
+        long_return =
+            ntohl(((struct sockaddr_in *) &lowin_ifnet.ifu_broadaddr)->
+                  sin_addr.s_addr) & 1;
+#elif defined(netbsd1)
+        long_return =
+            ((struct sockaddr_in *) &lowin_ifaddr.ia_broadaddr)->sin_addr.
+            s_addr & 1;
+#else
+        long_return =
+            ntohl(((struct sockaddr_in *) &lowin_ifaddr.ia_broadaddr)->
+                  sin_addr.s_addr) & 1;
+#endif
+        return (u_char *) & long_return;
+    case IPADREASMMAX:
+#ifdef hpux11
+        long_return = lowin_ifaddr.ReasmMaxSize;
+        return (u_char *) & long_return;
+#elif defined(NO_DUMMY_VALUES)
+        return NULL;
+#else
+        long_return = -1;
+        return (u_char *) & long_return;
+#endif
+    default:
+        DEBUGMSGTL(("snmpd", "unknown sub-id %d in var_ipAddrEntry\n",
+                    vp->magic));
+    }
+    return NULL;
+}
+
+#ifdef freebsd2
+static struct in_ifaddr *in_ifaddraddr;
+
+static void
+Address_Scan_Init(void)
+{
+    auto_nlist(IFADDR_SYMBOL, (char *) &in_ifaddraddr,
+               sizeof(in_ifaddraddr));
+}
+
+/*
+ * NB: Index is the number of the corresponding interface, not of the address 
+ */
+static int
+Address_Scan_Next(Index, Retin_ifaddr)
+     short          *Index;
+     struct in_ifaddr *Retin_ifaddr;
+{
+    struct in_ifaddr in_ifaddr;
+    struct ifnet    ifnet, *ifnetaddr;  /* NOTA: same name as another one */
+    short           iindex = 1;
+
+    while (in_ifaddraddr) {
+        /*
+         *      Get the "in_ifaddr" structure
+         */
+        klookup((unsigned long) in_ifaddraddr, (char *) &in_ifaddr,
+                sizeof in_ifaddr);
+        in_ifaddraddr = in_ifaddr.ia_next;
+
+        if (Retin_ifaddr)
+            *Retin_ifaddr = in_ifaddr;
+
+        /*
+         * Now, more difficult, find the index of the interface to which
+         * this address belongs
+         */
+
+        auto_nlist(IFNET_SYMBOL, (char *) &ifnetaddr, sizeof(ifnetaddr));
+        while (ifnetaddr && ifnetaddr != in_ifaddr.ia_ifp) {
+            klookup((unsigned long) ifnetaddr, (char *) &ifnet,
+                    sizeof ifnet);
+            ifnetaddr = ifnet.if_next;
+            iindex++;
+        }
+
+        /*
+         * XXX - might not find it? 
+         */
+
+        if (Index)
+            *Index = iindex;
+
+        return (1);             /* DONE */
+    }
+    return (0);                 /* EOF */
+}
+
+#elif defined(hpux11)
+
+static int      iptab_size, iptab_current;
+static mib_ipAdEnt *ip = (mib_ipAdEnt *) 0;
+
+static void
+Address_Scan_Init(void)
+{
+    int             fd;
+    struct nmparms  p;
+    int             val;
+    unsigned int    ulen;
+    int             ret;
+
+    if (ip)
+        free(ip);
+    ip = (mib_ipAdEnt *) 0;
+    iptab_size = 0;
+
+    if ((fd = open_mib("/dev/ip", O_RDONLY, 0, NM_ASYNC_OFF)) >= 0) {
+        p.objid = ID_ipAddrNumEnt;
+        p.buffer = (void *) &val;
+        ulen = sizeof(int);
+        p.len = &ulen;
+        if ((ret = get_mib_info(fd, &p)) == 0)
+            iptab_size = val;
+
+        if (iptab_size > 0) {
+            ulen = (unsigned) iptab_size *sizeof(mib_ipAdEnt);
+            ip = (mib_ipAdEnt *) malloc(ulen);
+            p.objid = ID_ipAddrTable;
+            p.buffer = (void *) ip;
+            p.len = &ulen;
+            if ((ret = get_mib_info(fd, &p)) < 0)
+                iptab_size = 0;
+        }
+
+        close_mib(fd);
+    }
+
+    iptab_current = 0;
+}
+
+/*
+ * NB: Index is the number of the corresponding interface, not of the address 
+ */
+static int
+Address_Scan_Next(Index, Retin_ifaddr)
+     short          *Index;
+     mib_ipAdEnt    *Retin_ifaddr;
+{
+    if (iptab_current < iptab_size) {
+        /*
+         * copy values 
+         */
+        *Index = ip[iptab_current].IfIndex;
+        *Retin_ifaddr = ip[iptab_current];
+        /*
+         * increment to point to next entry 
+         */
+        iptab_current++;
+        /*
+         * return success 
+         */
+        return (1);
+    }
+
+    /*
+     * return done 
+     */
+    return (0);
+}
+
+#elif defined(linux)
+static struct ifreq *ifr;
+static int ifr_counter;
+
+static void
+Address_Scan_Init(void)
+{
+    int num_interfaces = 0;
+    int fd;
+
+    /* get info about all interfaces */
+
+    ifc.ifc_len = 0;
+    ifc.ifc_buf = NULL;
+    ifr_counter = 0;
+
+    do
+    {
+	num_interfaces += 16;
+
+	ifc.ifc_len = sizeof(struct ifreq) * num_interfaces;
+	ifc.ifc_buf = (char*) realloc(ifc.ifc_buf, ifc.ifc_len);
+	
+	if ((fd = socket(AF_INET, SOCK_DGRAM, 0)) < 0)
+	{
+	    DEBUGMSGTL(("snmpd", "socket open failure in Address_Scan_Init\n"));
+	    return;
+	} else {
+	    if (ioctl(fd, SIOCGIFCONF, &ifc) < 0)
+	    {
+		ifr=NULL;
+		close(fd);
+	   	return;
+	    }
+	    close(fd);
+	}
+    }
+    while (ifc.ifc_len >= (sizeof(struct ifreq) * num_interfaces));
+    
+    ifr = ifc.ifc_req;
+    close(fd);
+}
+
+/*
+ * NB: Index is the number of the corresponding interface, not of the address 
+ */
+static int
+Address_Scan_Next(Index, Retifnet)
+    short          *Index;
+    struct ifnet   *Retifnet;
+
+{
+    struct ifnet   ifnet_store;
+    int fd;
+    if ((fd = socket(AF_INET, SOCK_DGRAM, 0)) < 0)
+    {
+	DEBUGMSGTL(("snmpd", "socket open failure in Address_Scan_Next\n"));
+	return(0);
+    }
+
+    while (ifr) {
+	
+	ifnet_store.if_addr = ifr->ifr_addr;
+
+        if (Retifnet)
+	{
+	    Retifnet->if_addr = ifr->ifr_addr;
+	    
+	    if (ioctl(fd, SIOCGIFBRDADDR, ifr) < 0)
+	    {
+		memset((char *) &Retifnet->ifu_broadaddr, 0, sizeof(Retifnet->ifu_broadaddr));
+	    }
+	    else
+		Retifnet->ifu_broadaddr = ifr->ifr_broadaddr;
+
+	    ifr->ifr_addr = Retifnet->if_addr;
+	    if (ioctl(fd, SIOCGIFNETMASK, ifr) < 0)
+	    {
+		memset((char *) &Retifnet->ia_subnetmask, 0, sizeof(Retifnet->ia_subnetmask));
+	    }
+	    else
+		Retifnet->ia_subnetmask = ifr->ifr_netmask;
+
+	}
+
+        if (Index)
+	{
+	    ifr->ifr_addr = ifnet_store.if_addr;
+	    if (ioctl(fd, SIOCGIFINDEX, ifr) < 0)
+	    {
+	        *Index = -1;
+	    }
+	    else
+        	*Index = ifr->ifr_ifindex;
+	}
+	
+	ifr++;
+	ifr_counter+=sizeof(struct ifreq);
+	if (ifr_counter >= ifc.ifc_len)
+	{
+	    ifr = NULL;	/* beyond the end */
+	}
+
+        close(fd);
+        return (1);             /* DONE */
+    }
+    close(fd);
+    return (0);                 /* EOF */
+}
+
+#endif                          /* freebsd,hpux11,linux */
+
+#else                           /* solaris2 */
+
+
+static int
+IP_Cmp(void *addr, void *ep)
+{
+    if (((mib2_ipAddrEntry_t *) ep)->ipAdEntAddr == *(IpAddress *) addr)
+        return (0);
+    else
+        return (1);
+}
+
+u_char         *
+var_ipAddrEntry(struct variable * vp,
+                oid * name,
+                size_t * length,
+                int exact, size_t * var_len, WriteMethod ** write_method)
+{
+    /*
+     * object identifier is of form:
+     * 1.3.6.1.2.1.4.20.1.?.A.B.C.D,  where A.B.C.D is IP address.
+     * IPADDR starts at offset 10.
+     */
+#define IP_ADDRNAME_LENGTH	14
+#define IP_ADDRINDEX_OFF	10
+    oid             lowest[IP_ADDRNAME_LENGTH];
+    oid             current[IP_ADDRNAME_LENGTH], *op;
+    u_char         *cp;
+    IpAddress       NextAddr;
+    mib2_ipAddrEntry_t entry, Lowentry;
+    int             Found = 0;
+    req_e           req_type;
+
+    /*
+     * fill in object part of name for current (less sizeof instance part) 
+     */
+
+    DEBUGMSGTL(("mibII/ip", "var_ipAddrEntry: "));
+    DEBUGMSGOID(("mibII/ip", name, *length));
+    DEBUGMSG(("mibII/ip", " %d\n", exact));
+
+    memset(&Lowentry, 0, sizeof(Lowentry));
+    memcpy((char *) current, (char *) vp->name,
+           (int) vp->namelen * sizeof(oid));
+    if (*length == IP_ADDRNAME_LENGTH)  /* Assume that the input name is the lowest */
+        memcpy((char *) lowest, (char *) name,
+               IP_ADDRNAME_LENGTH * sizeof(oid));
+    for (NextAddr = (u_long) - 1, req_type = GET_FIRST;;
+         NextAddr = entry.ipAdEntAddr, req_type = GET_NEXT) {
+        if (getMibstat
+            (MIB_IP_ADDR, &entry, sizeof(mib2_ipAddrEntry_t), req_type,
+             &IP_Cmp, &NextAddr) != 0)
+            break;
+        COPY_IPADDR(cp, (u_char *) & entry.ipAdEntAddr, op,
+                    current + IP_ADDRINDEX_OFF);
+        if (exact) {
+            if (snmp_oid_compare
+                (current, IP_ADDRNAME_LENGTH, name, *length) == 0) {
+                memcpy((char *) lowest, (char *) current,
+                       IP_ADDRNAME_LENGTH * sizeof(oid));
+                Lowentry = entry;
+                Found++;
+                break;          /* no need to search further */
+            }
+        } else {
+            if ((snmp_oid_compare
+                 (current, IP_ADDRNAME_LENGTH, name, *length) > 0)
+                && (((NextAddr == (u_long) - 1))
+                    ||
+                    (snmp_oid_compare
+                     (current, IP_ADDRNAME_LENGTH, lowest,
+                      IP_ADDRNAME_LENGTH) < 0)
+                    ||
+                    (snmp_oid_compare
+                     (name, *length, lowest, IP_ADDRNAME_LENGTH) == 0))) {
+                /*
+                 * if new one is greater than input and closer to input than
+                 * previous lowest, and is not equal to it, save this one as the "next" one.
+                 */
+                Lowentry = entry;
+                Found++;
+                memcpy((char *) lowest, (char *) current,
+                       IP_ADDRNAME_LENGTH * sizeof(oid));
+            }
+        }
+    }
+    DEBUGMSGTL(("mibII/ip", "... Found = %d\n", Found));
+    if (Found == 0)
+        return (NULL);
+    memcpy((char *) name, (char *) lowest,
+           IP_ADDRNAME_LENGTH * sizeof(oid));
+    *length = IP_ADDRNAME_LENGTH;
+    *write_method = 0;
+    *var_len = sizeof(long_return);
+    switch (vp->magic) {
+    case IPADADDR:
+        long_return = Lowentry.ipAdEntAddr;
+        return (u_char *) & long_return;
+    case IPADIFINDEX:
+        long_return =
+            Interface_Index_By_Name(Lowentry.ipAdEntIfIndex.o_bytes,
+                                    Lowentry.ipAdEntIfIndex.o_length);
+        return (u_char *) & long_return;
+    case IPADNETMASK:
+        long_return = Lowentry.ipAdEntNetMask;
+        return (u_char *) & long_return;
+    case IPADBCASTADDR:
+        long_return = Lowentry.ipAdEntBcastAddr;
+        return (u_char *) & long_return;
+    default:
+        DEBUGMSGTL(("snmpd", "unknown sub-id %d in var_ipAddrEntry\n",
+                    vp->magic));
+    }
+    return NULL;
+}
+
+#endif                          /* solaris2 */
+
+
+
+        /*********************
+	 *
+	 *  Internal implementation functions
+	 *
+	 *********************/
+
+
+#else                           /* CAN_USE_SYSCTL && IPCTL_STATS */
+
+/*
+ * Ideally, this would be combined with the code in interfaces.c.
+ * Even separate, it's still better than what went before.
+ */
+struct iflist {
+    int             flags;
+    int             index;
+    struct in_addr  addr;
+    struct in_addr  mask;
+    struct in_addr  bcast;
+};
+static struct iflist *ifs;
+static int      nifs;
+
+static void
+get_iflist(void)
+{
+    int             naddrs, bit;
+    static int      mib[6]
+    = { CTL_NET, PF_ROUTE, 0, AF_INET, NET_RT_IFLIST, 0 };
+    char           *cp, *ifbuf;
+    size_t          len;
+    struct rt_msghdr *rtm;
+    struct if_msghdr *ifm;
+    struct ifa_msghdr *ifam;
+    struct sockaddr *sa;
+    int             flags;
+
+    naddrs = 0;
+    if (ifs)
+        free(ifs);
+    ifs = 0;
+    nifs = 0;
+    len = 0;
+    if (sysctl(mib, 6, 0, &len, 0, 0) < 0)
+        return;
+
+    ifbuf = malloc(len);
+    if (ifbuf == 0)
+        return;
+    if (sysctl(mib, 6, ifbuf, &len, 0, 0) < 0) {
+        syslog(LOG_WARNING, "sysctl net-route-iflist: %m");
+        free(ifbuf);
+        return;
+    }
+
+  loop:
+    cp = ifbuf;
+    while (cp < &ifbuf[len]) {
+        int             gotaddr;
+
+        gotaddr = 0;
+        rtm = (struct rt_msghdr *) cp;
+        if (rtm->rtm_version != RTM_VERSION || rtm->rtm_type != RTM_IFINFO) {
+            free(ifs);
+            ifs = 0;
+            nifs = 0;
+            free(ifbuf);
+            return;
+        }
+        ifm = (struct if_msghdr *) rtm;
+        flags = ifm->ifm_flags;
+        cp += ifm->ifm_msglen;
+        rtm = (struct rt_msghdr *) cp;
+        while (cp < &ifbuf[len] && rtm->rtm_type == RTM_NEWADDR) {
+            ifam = (struct ifa_msghdr *) rtm;
+            cp += sizeof(*ifam);
+            /*
+             * from route.c 
+             */
+#define ROUND(a) \
+        ((a) > 0 ? (1 + (((a) - 1) | (sizeof(long) - 1))) : sizeof(long))
+            for (bit = 1; bit && cp < &ifbuf[len]; bit <<= 1) {
+                if (!(ifam->ifam_addrs & bit))
+                    continue;
+                sa = (struct sockaddr *) cp;
+                cp += ROUND(sa->sa_len);
+
+                /*
+                 * Netmasks are returned as bit
+                 * strings of type AF_UNSPEC.  The
+                 * others are pretty ok.
+                 */
+                if (bit == RTA_IFA) {
+#define satosin(sa) ((struct sockaddr_in *)(sa))
+                    if (ifs) {
+                        ifs[naddrs].addr = satosin(sa)->sin_addr;
+                        ifs[naddrs].index = ifam->ifam_index;
+                        ifs[naddrs].flags = flags;
+                    }
+                    gotaddr = 1;
+                } else if (bit == RTA_NETMASK) {
+                    if (ifs)
+                        ifs[naddrs].mask = satosin(sa)->sin_addr;
+                } else if (bit == RTA_BRD) {
+                    if (ifs)
+                        ifs[naddrs].bcast = satosin(sa)->sin_addr;
+                }
+            }
+            if (gotaddr)
+                naddrs++;
+            cp = (char *) rtm + rtm->rtm_msglen;
+            rtm = (struct rt_msghdr *) cp;
+        }
+    }
+    if (ifs) {
+        nifs = naddrs;
+        free(ifbuf);
+        return;
+    }
+    ifs = malloc(naddrs * sizeof(*ifs));
+    if (ifs == 0) {
+        free(ifbuf);
+        return;
+    }
+    naddrs = 0;
+    goto loop;
+}
+
+u_char         *
+var_ipAddrEntry(struct variable *vp,
+                oid * name,
+                size_t * length,
+                int exact, size_t * var_len, WriteMethod ** write_method)
+{
+    /*
+     * object identifier is of form:
+     * 1.3.6.1.2.1.4.20.1.?.A.B.C.D,  where A.B.C.D is IP address.
+     * IPADDR starts at offset 10.
+     */
+    oid             lowest[14];
+    oid             current[14], *op;
+    u_char         *cp;
+    int             lowinterface = -1;
+    int             i, interface;
+
+    /*
+     * fill in object part of name for current (less sizeof instance part) 
+     */
+    memcpy(current, vp->name, (int) vp->namelen * sizeof(oid));
+
+    /*
+     * Get interface table from kernel.
+     */
+    get_iflist();
+
+    for (i = 0; i < nifs; i++) {
+        op = &current[10];
+        cp = (u_char *) & ifs[i].addr;
+        *op++ = *cp++;
+        *op++ = *cp++;
+        *op++ = *cp++;
+        *op++ = *cp++;
+        if (exact) {
+            if (snmp_oid_compare(current, 14, name, *length) == 0) {
+                memcpy(lowest, current, 14 * sizeof(oid));
+                lowinterface = i;
+                break;          /* no need to search further */
+            }
+        } else {
+            if ((snmp_oid_compare(current, 14, name, *length) > 0) &&
+                (lowinterface < 0
+                 || (snmp_oid_compare(current, 14, lowest, 14) < 0))) {
+                /*
+                 * if new one is greater than input
+                 * and closer to input than previous
+                 * lowest, save this one as the "next"
+                 * one.  
+                 */
+                lowinterface = i;
+                memcpy(lowest, current, 14 * sizeof(oid));
+            }
+        }
+    }
+
+    if (lowinterface < 0)
+        return NULL;
+    i = lowinterface;
+    memcpy(name, lowest, 14 * sizeof(oid));
+    *length = 14;
+    *write_method = 0;
+    *var_len = sizeof(long_return);
+    switch (vp->magic) {
+    case IPADADDR:
+        long_return = ifs[i].addr.s_addr;
+        return (u_char *) & long_return;
+
+    case IPADIFINDEX:
+        long_return = ifs[i].index;
+        return (u_char *) & long_return;
+
+    case IPADNETMASK:
+        long_return = ifs[i].mask.s_addr;
+        return (u_char *) & long_return;
+
+    case IPADBCASTADDR:
+        long_return = ntohl(ifs[i].bcast.s_addr) & 1;
+        return (u_char *) & long_return;
+
+    case IPADREASMMAX:
+#if NO_DUMMY_VALUES
+        return NULL;
+#else
+        long_return = -1;
+        return (u_char *) & long_return;
+#endif
+
+    default:
+        DEBUGMSGTL(("snmpd", "unknown sub-id %d in var_ipAddrEntry\n",
+                    vp->magic));
+    }
+    return NULL;
+}
+
+#endif                          /* CAN_USE_SYSCTL && IPCTL_STATS */
+
+#else                           /* WIN32 */
+#include <iphlpapi.h>
+u_char         *
+var_ipAddrEntry(struct variable *vp,
+                oid * name,
+                size_t * length,
+                int exact, size_t * var_len, WriteMethod ** write_method)
+{
+    /*
+     * object identifier is of form:
+     * 1.3.6.1.2.1.4.20.1.?.A.B.C.D,  where A.B.C.D is IP address.
+     * IPADDR starts at offset 10.
+     */
+    oid             lowest[14];
+    oid             current[14], *op;
+    u_char         *cp;
+    int             lowinterface = -1;
+    int             i;
+    PMIB_IPADDRTABLE pIpAddrTable = NULL;
+    DWORD           status = NO_ERROR;
+    DWORD           statusRetry = NO_ERROR;
+    DWORD           dwActualSize = 0;
+
+    /*
+     * fill in object part of name for current (less sizeof instance part) 
+     */
+    memcpy(current, vp->name, (int) vp->namelen * sizeof(oid));
+
+    /*
+     * Get interface table from kernel.
+     */
+    status = GetIpAddrTable(pIpAddrTable, &dwActualSize, TRUE);
+    if (status == ERROR_INSUFFICIENT_BUFFER) {
+        pIpAddrTable = (PMIB_IPADDRTABLE) malloc(dwActualSize);
+        if (pIpAddrTable != NULL) {
+            statusRetry =
+                GetIpAddrTable(pIpAddrTable, &dwActualSize, TRUE);
+        }
+    }
+
+    if (statusRetry == NO_ERROR || status == NO_ERROR) {
+
+        for (i = 0; i < (int) pIpAddrTable->dwNumEntries; ++i) {
+            op = &current[10];
+            cp = (u_char *) & pIpAddrTable->table[i].dwAddr;
+            *op++ = *cp++;
+            *op++ = *cp++;
+            *op++ = *cp++;
+            *op++ = *cp++;
+            if (exact) {
+                if (snmp_oid_compare(current, 14, name, *length) == 0) {
+                    memcpy(lowest, current, 14 * sizeof(oid));
+                    lowinterface = i;
+                    break;      /* no need to search further */
+                }
+            } else {
+                if (snmp_oid_compare(current, 14, name, *length) > 0) {
+
+                    lowinterface = i;
+                    memcpy(lowest, current, 14 * sizeof(oid));
+                    break;      /* Since the table is sorted, no need to search further  */
+                }
+            }
+        }
+    }
+
+    if (lowinterface < 0) {
+        free(pIpAddrTable);
+        return NULL;
+    }
+    i = lowinterface;
+    memcpy(name, lowest, 14 * sizeof(oid));
+    *length = 14;
+    *write_method = 0;
+    *var_len = sizeof(long_return);
+    switch (vp->magic) {
+    case IPADADDR:
+        long_return = pIpAddrTable->table[i].dwAddr;
+        return (u_char *) & long_return;
+
+    case IPADIFINDEX:
+        long_return = pIpAddrTable->table[i].dwIndex;
+        free(pIpAddrTable);
+        return (u_char *) & long_return;
+
+    case IPADNETMASK:
+        long_return = pIpAddrTable->table[i].dwMask;
+        free(pIpAddrTable);
+        return (u_char *) & long_return;
+
+    case IPADBCASTADDR:
+        long_return = pIpAddrTable->table[i].dwBCastAddr;
+        free(pIpAddrTable);
+        return (u_char *) & long_return;
+
+    case IPADREASMMAX:
+        long_return = pIpAddrTable->table[i].dwReasmSize;
+        free(pIpAddrTable);
+        return (u_char *) & long_return;
+
+    default:
+        DEBUGMSGTL(("snmpd", "unknown sub-id %d in var_ipAddrEntry\n",
+                    vp->magic));
+    }
+    return NULL;
+}
+#endif                          /* WIN32 */
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/mibII/ipAddr.h tomato121/release/src/router/snmp/agent/mibgroup/mibII/ipAddr.h
--- tomato/release/src/router/snmp/agent/mibgroup/mibII/ipAddr.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/mibII/ipAddr.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,12 @@
+/*
+ *  Template MIB group interface - ipAddr.h
+ *
+ */
+#ifndef _MIBGROUP_IPADDR_H
+#define _MIBGROUP_IPADDR_H
+
+config_require(mibII/ip util_funcs)
+
+     extern FindVarMethod var_ipAddrEntry;
+
+#endif                          /* _MIBGROUP_IPADDR_H */
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/mibII/ip.c tomato121/release/src/router/snmp/agent/mibgroup/mibII/ip.c
--- tomato/release/src/router/snmp/agent/mibgroup/mibII/ip.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/mibII/ip.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,840 @@
+/*
+ *  IP MIB group implementation - ip.c
+ *
+ */
+
+#include <net-snmp/net-snmp-config.h>
+
+#if defined(IFNET_NEEDS_KERNEL) && !defined(_KERNEL)
+#define _KERNEL 1
+#define _I_DEFINED_KERNEL
+#endif
+#if HAVE_SYS_PARAM_H
+#include <sys/param.h>
+#endif
+#if HAVE_SYS_SOCKET_H
+#include <sys/socket.h>
+#endif
+
+#if HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+#if HAVE_WINSOCK_H
+#include <winsock.h>
+#endif
+#if HAVE_SYS_SYSCTL_H
+#ifdef _I_DEFINED_KERNEL
+#undef _KERNEL
+#endif
+#include <sys/sysctl.h>
+#ifdef _I_DEFINED_KERNEL
+#define _KERNEL 1
+#endif
+#endif
+#if HAVE_SYS_SYSMP_H
+#include <sys/sysmp.h>
+#endif
+#if HAVE_SYS_TCPIPSTATS_H
+#include <sys/tcpipstats.h>
+#endif
+#if HAVE_NET_IF_H
+#include <net/if.h>
+#endif
+#if HAVE_NET_IF_VAR_H
+#include <net/if_var.h>
+#endif
+#ifdef _I_DEFINED_KERNEL
+#undef _KERNEL
+#endif
+#if HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+#if HAVE_NETINET_IN_SYSTM_H
+#include <netinet/in_systm.h>
+#endif
+#if HAVE_SYS_HASHING_H
+#include <sys/hashing.h>
+#endif
+#if HAVE_NETINET_IN_VAR_H
+#include <netinet/in_var.h>
+#endif
+#if HAVE_NETINET_IP_H
+#include <netinet/ip.h>
+#endif
+#if HAVE_NETINET_IP_VAR_H
+#include <netinet/ip_var.h>
+#endif
+#if HAVE_INET_MIB2_H
+#include <inet/mib2.h>
+#endif
+#if HAVE_SYS_STREAM_H
+#include <sys/stream.h>
+#endif
+#if HAVE_NET_ROUTE_H
+#include <net/route.h>
+#endif
+#if HAVE_SYSLOG_H
+#include <syslog.h>
+#endif
+
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include <net-snmp/agent/auto_nlist.h>
+
+#ifdef solaris2
+#include "kernel_sunos5.h"
+#else
+#include "kernel.h"
+#endif
+#ifdef linux
+#include "kernel_linux.h"
+#endif
+
+#if defined(MIB_IPCOUNTER_SYMBOL) || defined(hpux11)
+#include <sys/mib.h>
+#include <netinet/mib_kern.h>
+#endif                          /* MIB_IPCOUNTER_SYMBOL || hpux11 */
+
+#include "util_funcs.h"
+#include "ip.h"
+#include "ipAddr.h"
+#include "interfaces.h"
+#include "sysORTable.h"
+
+#ifdef cygwin
+#define WIN32
+#include <windows.h>
+#endif
+
+#ifndef MIB_STATS_CACHE_TIMEOUT
+#define MIB_STATS_CACHE_TIMEOUT	5
+#endif
+#ifndef IP_STATS_CACHE_TIMEOUT
+#define IP_STATS_CACHE_TIMEOUT	MIB_STATS_CACHE_TIMEOUT
+#endif
+marker_t        ip_stats_cache_marker = NULL;
+
+        /*********************
+	 *
+	 *  Kernel & interface information,
+	 *   and internal forward declarations
+	 *
+	 *********************/
+
+
+        /*********************
+	 *
+	 *  Initialisation & common implementation functions
+	 *
+	 *********************/
+
+extern void     init_routes(void);
+
+
+/*
+ * define the structure we're going to ask the agent to register our
+ * information at 
+ */
+struct variable3 ip_variables[] = {
+#ifdef WIN32
+    {IPFORWARDING, ASN_INTEGER, RWRITE, var_ip, 1, {1}},
+    {IPDEFAULTTTL, ASN_INTEGER, RWRITE, var_ip, 1, {2}},
+#else
+    {IPFORWARDING, ASN_INTEGER, RONLY, var_ip, 1, {1}},
+    {IPDEFAULTTTL, ASN_INTEGER, RONLY, var_ip, 1, {2}},
+#endif
+#ifndef sunV3
+    {IPINRECEIVES, ASN_COUNTER, RONLY, var_ip, 1, {3}},
+#endif
+    {IPINHDRERRORS, ASN_COUNTER, RONLY, var_ip, 1, {4}},
+#ifndef sunV3
+    {IPINADDRERRORS, ASN_COUNTER, RONLY, var_ip, 1, {5}},
+    {IPFORWDATAGRAMS, ASN_COUNTER, RONLY, var_ip, 1, {6}},
+#endif
+    {IPINUNKNOWNPROTOS, ASN_COUNTER, RONLY, var_ip, 1, {7}},
+#ifndef sunV3
+    {IPINDISCARDS, ASN_COUNTER, RONLY, var_ip, 1, {8}},
+    {IPINDELIVERS, ASN_COUNTER, RONLY, var_ip, 1, {9}},
+#endif
+    {IPOUTREQUESTS, ASN_COUNTER, RONLY, var_ip, 1, {10}},
+    {IPOUTDISCARDS, ASN_COUNTER, RONLY, var_ip, 1, {11}},
+    {IPOUTNOROUTES, ASN_COUNTER, RONLY, var_ip, 1, {12}},
+    {IPREASMTIMEOUT, ASN_INTEGER, RONLY, var_ip, 1, {13}},
+#ifndef sunV3
+    {IPREASMREQDS, ASN_COUNTER, RONLY, var_ip, 1, {14}},
+    {IPREASMOKS, ASN_COUNTER, RONLY, var_ip, 1, {15}},
+    {IPREASMFAILS, ASN_COUNTER, RONLY, var_ip, 1, {16}},
+#endif
+    {IPFRAGOKS, ASN_COUNTER, RONLY, var_ip, 1, {17}},
+    {IPFRAGFAILS, ASN_COUNTER, RONLY, var_ip, 1, {18}},
+    {IPFRAGCREATES, ASN_COUNTER, RONLY, var_ip, 1, {19}},
+    {IPADADDR, ASN_IPADDRESS, RONLY, var_ipAddrEntry, 3, {20, 1, 1}},
+    {IPADIFINDEX, ASN_INTEGER, RONLY, var_ipAddrEntry, 3, {20, 1, 2}},
+#ifndef sunV3
+    {IPADNETMASK, ASN_IPADDRESS, RONLY, var_ipAddrEntry, 3, {20, 1, 3}},
+#endif
+    {IPADBCASTADDR, ASN_INTEGER, RONLY, var_ipAddrEntry, 3, {20, 1, 4}},
+    {IPADREASMMAX, ASN_INTEGER, RONLY, var_ipAddrEntry, 3, {20, 1, 5}},
+    {IPROUTEDEST, ASN_IPADDRESS, RWRITE, var_ipRouteEntry, 3, {21, 1, 1}},
+    {IPROUTEIFINDEX, ASN_INTEGER, RWRITE, var_ipRouteEntry, 3, {21, 1, 2}},
+    {IPROUTEMETRIC1, ASN_INTEGER, RWRITE, var_ipRouteEntry, 3, {21, 1, 3}},
+    {IPROUTEMETRIC2, ASN_INTEGER, RWRITE, var_ipRouteEntry, 3, {21, 1, 4}},
+    {IPROUTEMETRIC3, ASN_INTEGER, RWRITE, var_ipRouteEntry, 3, {21, 1, 5}},
+    {IPROUTEMETRIC4, ASN_INTEGER, RWRITE, var_ipRouteEntry, 3, {21, 1, 6}},
+    {IPROUTENEXTHOP, ASN_IPADDRESS, RWRITE, var_ipRouteEntry, 3,
+     {21, 1, 7}},
+    {IPROUTETYPE, ASN_INTEGER, RWRITE, var_ipRouteEntry, 3, {21, 1, 8}},
+    {IPROUTEPROTO, ASN_INTEGER, RONLY, var_ipRouteEntry, 3, {21, 1, 9}},
+    {IPROUTEAGE, ASN_INTEGER, RWRITE, var_ipRouteEntry, 3, {21, 1, 10}},
+    {IPROUTEMASK, ASN_IPADDRESS, RWRITE, var_ipRouteEntry, 3, {21, 1, 11}},
+    {IPROUTEMETRIC5, ASN_INTEGER, RWRITE, var_ipRouteEntry, 3,
+     {21, 1, 12}},
+    {IPROUTEINFO, ASN_OBJECT_ID, RONLY, var_ipRouteEntry, 3, {21, 1, 13}},
+#ifdef USING_MIBII_AT_MODULE
+#ifdef WIN32
+    {IPMEDIAIFINDEX, ASN_INTEGER, RWRITE, var_atEntry, 3, {22, 1, 1}},
+    {IPMEDIAPHYSADDRESS, ASN_OCTET_STR, RWRITE, var_atEntry, 3,
+     {22, 1, 2}},
+    {IPMEDIANETADDRESS, ASN_IPADDRESS, RWRITE, var_atEntry, 3, {22, 1, 3}},
+    {IPMEDIATYPE, ASN_INTEGER, RWRITE, var_atEntry, 3, {22, 1, 4}},
+#else
+    {IPMEDIAIFINDEX, ASN_INTEGER, RONLY, var_atEntry, 3, {22, 1, 1}},
+    {IPMEDIAPHYSADDRESS, ASN_OCTET_STR, RONLY, var_atEntry, 3, {22, 1, 2}},
+    {IPMEDIANETADDRESS, ASN_IPADDRESS, RONLY, var_atEntry, 3, {22, 1, 3}},
+    {IPMEDIATYPE, ASN_INTEGER, RONLY, var_atEntry, 3, {22, 1, 4}},
+#endif
+#endif
+    {IPROUTEDISCARDS, ASN_COUNTER, RONLY, var_ip, 1, {23}}
+};
+
+/*
+ * Define the OID pointer to the top of the mib tree that we're
+ * registering underneath, and the OID of the MIB module 
+ */
+oid             ip_variables_oid[] = { SNMP_OID_MIB2, 4 };
+oid             ip_module_oid[] = { SNMP_OID_MIB2, 4 };
+oid             ip_module_oid_len = sizeof(ip_module_oid) / sizeof(oid);
+int             ip_module_count = 0;    /* Need to liaise with icmp.c */
+
+void
+init_ip(void)
+{
+    /*
+     * register ourselves with the agent to handle our mib tree 
+     */
+    REGISTER_MIB("mibII/ip", ip_variables, variable3, ip_variables_oid);
+    if (++ip_module_count == 2)
+        REGISTER_SYSOR_ENTRY(ip_module_oid,
+                             "The MIB module for managing IP and ICMP implementations");
+
+
+    /*
+     * for speed optimization, we call this now to do the lookup 
+     */
+#ifdef IPSTAT_SYMBOL
+    auto_nlist(IPSTAT_SYMBOL, 0, 0);
+#endif
+#ifdef IP_FORWARDING_SYMBOL
+    auto_nlist(IP_FORWARDING_SYMBOL, 0, 0);
+#endif
+#ifdef TCP_TTL_SYMBOL
+    auto_nlist(TCP_TTL_SYMBOL, 0, 0);
+#endif
+#ifdef MIB_IPCOUNTER_SYMBOL
+    auto_nlist(MIB_IPCOUNTER_SYMBOL, 0, 0);
+#endif
+#ifdef solaris2
+    init_kernel_sunos5();
+#endif
+}
+
+
+        /*********************
+	 *
+	 *  System specific implementation functions
+	 *
+	 *********************/
+
+#ifdef linux
+#define IP_STAT_STRUCTURE	struct ip_mib
+#define	USES_SNMP_DESIGNED_IPSTAT
+#endif
+
+#ifdef solaris2
+#define IP_STAT_STRUCTURE	mib2_ip_t
+#define	USES_SNMP_DESIGNED_IPSTAT
+#endif
+
+#ifdef hpux11
+#define IP_STAT_STRUCTURE	int
+#endif
+
+#ifdef HAVE_SYS_TCPIPSTATS_H
+#define IP_STAT_STRUCTURE	struct kna
+#define	USES_TRADITIONAL_IPSTAT
+#endif
+
+#ifdef WIN32
+#include <iphlpapi.h>
+#define IP_STAT_STRUCTURE MIB_IPSTATS
+WriteMethod     writeIpStats;
+long            ipForwarding;
+long            oldipForwarding;
+long            ipTTL, oldipTTL;
+#endif                          /* WIN32 */
+
+#if !defined(IP_STAT_STRUCTURE)
+#define IP_STAT_STRUCTURE	struct ipstat
+#define	USES_TRADITIONAL_IPSTAT
+#endif
+
+long            read_ip_stat(IP_STAT_STRUCTURE *, int);
+
+u_char         *
+var_ip(struct variable *vp,
+       oid * name,
+       size_t * length,
+       int exact, size_t * var_len, WriteMethod ** write_method)
+{
+    static IP_STAT_STRUCTURE ipstat;
+    static long     ret_value;
+
+    if (header_generic(vp, name, length, exact, var_len, write_method) ==
+        MATCH_FAILED)
+        return NULL;
+
+    ret_value = read_ip_stat(&ipstat, vp->magic);
+    if (ret_value < 0)
+        return NULL;
+
+#ifdef HAVE_SYS_TCPIPSTATS_H
+    /*
+     * This actually reads statistics for *all* the groups together,
+     * so we need to isolate the IP-specific bits.  
+     */
+#define	ipstat		ipstat.ipstat
+#endif
+
+    switch (vp->magic) {
+#ifdef USES_SNMP_DESIGNED_IPSTAT
+    case IPFORWARDING:
+        return (u_char *) & ipstat.ipForwarding;
+    case IPDEFAULTTTL:
+        return (u_char *) & ipstat.ipDefaultTTL;
+    case IPINRECEIVES:
+        return (u_char *) & ipstat.ipInReceives;
+    case IPINHDRERRORS:
+        return (u_char *) & ipstat.ipInHdrErrors;
+    case IPINADDRERRORS:
+        return (u_char *) & ipstat.ipInAddrErrors;
+    case IPFORWDATAGRAMS:
+        return (u_char *) & ipstat.ipForwDatagrams;
+    case IPINUNKNOWNPROTOS:
+        return (u_char *) & ipstat.ipInUnknownProtos;
+    case IPINDISCARDS:
+        return (u_char *) & ipstat.ipInDiscards;
+    case IPINDELIVERS:
+        return (u_char *) & ipstat.ipInDelivers;
+    case IPOUTREQUESTS:
+        return (u_char *) & ipstat.ipOutRequests;
+    case IPOUTDISCARDS:
+        return (u_char *) & ipstat.ipOutDiscards;
+    case IPOUTNOROUTES:
+        return (u_char *) & ipstat.ipOutNoRoutes;
+    case IPREASMTIMEOUT:
+        return (u_char *) & ipstat.ipReasmTimeout;
+    case IPREASMREQDS:
+        return (u_char *) & ipstat.ipReasmReqds;
+    case IPREASMOKS:
+        return (u_char *) & ipstat.ipReasmOKs;
+    case IPREASMFAILS:
+        return (u_char *) & ipstat.ipReasmFails;
+    case IPFRAGOKS:
+        return (u_char *) & ipstat.ipFragOKs;
+    case IPFRAGFAILS:
+        return (u_char *) & ipstat.ipFragFails;
+    case IPFRAGCREATES:
+        return (u_char *) & ipstat.ipFragCreates;
+    case IPROUTEDISCARDS:
+        return (u_char *) & ipstat.ipRoutingDiscards;
+#endif
+
+
+
+#ifdef USES_TRADITIONAL_IPSTAT
+    case IPFORWARDING:
+        return (u_char *) & ret_value;
+    case IPDEFAULTTTL:
+        return (u_char *) & ret_value;
+    case IPINRECEIVES:
+        long_return = ipstat.ips_total;
+        return (u_char *) & long_return;
+    case IPINHDRERRORS:
+        long_return = ipstat.ips_badsum
+            + ipstat.ips_tooshort
+            + ipstat.ips_toosmall + ipstat.ips_badhlen + ipstat.ips_badlen;
+        return (u_char *) & long_return;
+    case IPINADDRERRORS:
+        long_return = ipstat.ips_cantforward;
+        return (u_char *) & long_return;
+    case IPFORWDATAGRAMS:
+        long_return = ipstat.ips_forward;
+        return (u_char *) & long_return;
+    case IPINUNKNOWNPROTOS:
+#if STRUCT_IPSTAT_HAS_IPS_NOPROTO
+        long_return = ipstat.ips_noproto;
+        return (u_char *) & long_return;
+#else
+        return NULL;
+#endif
+    case IPINDISCARDS:
+#if STRUCT_IPSTAT_HAS_IPS_FRAGDROPPED
+        long_return = ipstat.ips_fragdropped;   /* ?? */
+        return (u_char *) & long_return;
+#else
+        return NULL;
+#endif
+    case IPINDELIVERS:
+#if STRUCT_IPSTAT_HAS_IPS_DELIVERED
+        long_return = ipstat.ips_delivered;
+        return (u_char *) & long_return;
+#else
+        return NULL;
+#endif
+    case IPOUTREQUESTS:
+#if STRUCT_IPSTAT_HAS_IPS_LOCALOUT
+        long_return = ipstat.ips_localout;
+        return (u_char *) & long_return;
+#else
+        return NULL;
+#endif
+    case IPOUTDISCARDS:
+#if STRUCT_IPSTAT_HAS_IPS_ODROPPED
+        long_return = ipstat.ips_odropped;
+        return (u_char *) & long_return;
+#else
+        return NULL;
+#endif
+    case IPOUTNOROUTES:
+        /*
+         * XXX: how to calculate this (counts dropped routes, not packets)?
+         * ipstat.ips_cantforward isn't right, as it counts packets.
+         * ipstat.ips_noroute is also incorrect.
+         */
+        return NULL;
+    case IPREASMTIMEOUT:
+        long_return = IPFRAGTTL;
+        return (u_char *) & long_return;
+    case IPREASMREQDS:
+        long_return = ipstat.ips_fragments;
+        return (u_char *) & long_return;
+    case IPREASMOKS:
+#if STRUCT_IPSTAT_HAS_IPS_REASSEMBLED
+        long_return = ipstat.ips_reassembled;
+        return (u_char *) & long_return;
+#else
+        return NULL;
+#endif
+    case IPREASMFAILS:
+        long_return = ipstat.ips_fragdropped + ipstat.ips_fragtimeout;
+        return (u_char *) & long_return;
+    case IPFRAGOKS:            /* XXX */
+        long_return = ipstat.ips_fragments
+            - (ipstat.ips_fragdropped + ipstat.ips_fragtimeout);
+        return (u_char *) & long_return;
+    case IPFRAGFAILS:
+#if STRUCT_IPSTAT_HAS_IPS_CANTFRAG
+        long_return = ipstat.ips_cantfrag;
+        return (u_char *) & long_return;
+#else
+        return NULL;
+#endif
+    case IPFRAGCREATES:
+#if STRUCT_IPSTAT_HAS_IPS_OFRAGMENTS
+        long_return = ipstat.ips_ofragments;
+        return (u_char *) & long_return;
+#else
+        return NULL;
+#endif
+    case IPROUTEDISCARDS:
+#if STRUCT_IPSTAT_HAS_IPS_NOROUTE
+        long_return = ipstat.ips_noroute;
+        return (u_char *) & long_return;
+#else
+        return NULL;
+#endif
+
+#endif                          /* USE_TRADITIONAL_IPSTAT */
+#ifdef WIN32
+    case IPFORWARDING:
+        *write_method = writeIpStats;
+        ipForwarding = ipstat.dwForwarding;
+        return (u_char *) & ipstat.dwForwarding;
+    case IPDEFAULTTTL:
+        *write_method = writeIpStats;
+        ipTTL = ipstat.dwDefaultTTL;
+        return (u_char *) & ipstat.dwDefaultTTL;
+    case IPINRECEIVES:
+        return (u_char *) & ipstat.dwInReceives;
+    case IPINHDRERRORS:
+        return (u_char *) & ipstat.dwInHdrErrors;
+    case IPINADDRERRORS:
+        return (u_char *) & ipstat.dwInAddrErrors;
+    case IPFORWDATAGRAMS:
+        return (u_char *) & ipstat.dwForwDatagrams;
+    case IPINUNKNOWNPROTOS:
+        return (u_char *) & ipstat.dwInUnknownProtos;
+    case IPINDISCARDS:
+        return (u_char *) & ipstat.dwInDiscards;
+    case IPINDELIVERS:
+        return (u_char *) & ipstat.dwInDelivers;
+    case IPOUTREQUESTS:
+        return (u_char *) & ipstat.dwOutRequests;
+    case IPOUTDISCARDS:
+        return (u_char *) & ipstat.dwOutDiscards;
+    case IPOUTNOROUTES:
+        return (u_char *) & ipstat.dwOutNoRoutes;
+    case IPREASMTIMEOUT:
+        return (u_char *) & ipstat.dwReasmTimeout;
+    case IPREASMREQDS:
+        return (u_char *) & ipstat.dwReasmReqds;
+    case IPREASMOKS:
+        return (u_char *) & ipstat.dwReasmOks;
+    case IPREASMFAILS:
+        return (u_char *) & ipstat.dwReasmFails;
+    case IPFRAGOKS:
+        return (u_char *) & ipstat.dwFragOks;
+    case IPFRAGFAILS:
+        return (u_char *) & ipstat.dwFragFails;
+    case IPFRAGCREATES:
+        return (u_char *) & ipstat.dwFragCreates;
+    case IPROUTEDISCARDS:
+        return (u_char *) & ipstat.dwRoutingDiscards;
+#endif                          /* WIN32 */
+
+    default:
+        DEBUGMSGTL(("snmpd", "unknown sub-id %d in var_ip\n", vp->magic));
+    }
+    return NULL;
+
+#ifdef HAVE_SYS_TCPIPSTATS_H
+#undef	ipstat
+#endif
+}
+
+
+
+        /*********************
+	 *
+	 *  Internal implementation functions
+	 *
+	 *********************/
+
+long
+read_ip_stat(IP_STAT_STRUCTURE * ipstat, int magic)
+{
+    long            ret_value = 0;
+#if (defined(CAN_USE_SYSCTL) && defined(IPCTL_STATS))
+    int             i;
+#endif
+#if !(defined (linux) || defined(solaris2))
+    static int      ttl, forward;
+#endif
+#ifdef hpux11
+    int             fd;
+    struct nmparms  p;
+    unsigned int    ulen;
+#endif
+
+#if (defined(CAN_USE_SYSCTL) && defined(IPCTL_STATS))
+    static int      sname[4] = { CTL_NET, PF_INET, IPPROTO_IP, 0 };
+    size_t          len;
+#endif
+
+#ifdef hpux11
+    if ((fd = open_mib("/dev/ip", O_RDONLY, 0, NM_ASYNC_OFF)) < 0)
+        return (-1);            /* error */
+
+    switch (magic) {
+    case IPFORWARDING:
+        p.objid = ID_ipForwarding;
+        break;
+    case IPDEFAULTTTL:
+        p.objid = ID_ipDefaultTTL;
+        break;
+    case IPINRECEIVES:
+        p.objid = ID_ipInReceives;
+        break;
+    case IPINHDRERRORS:
+        p.objid = ID_ipInHdrErrors;
+        break;
+    case IPINADDRERRORS:
+        p.objid = ID_ipInAddrErrors;
+        break;
+    case IPFORWDATAGRAMS:
+        p.objid = ID_ipForwDatagrams;
+        break;
+    case IPINUNKNOWNPROTOS:
+        p.objid = ID_ipInUnknownProtos;
+        break;
+    case IPINDISCARDS:
+        p.objid = ID_ipInDiscards;
+        break;
+    case IPINDELIVERS:
+        p.objid = ID_ipInDelivers;
+        break;
+    case IPOUTREQUESTS:
+        p.objid = ID_ipOutRequests;
+        break;
+    case IPOUTDISCARDS:
+        p.objid = ID_ipOutDiscards;
+        break;
+    case IPOUTNOROUTES:
+        p.objid = ID_ipOutNoRoutes;
+        break;
+    case IPREASMTIMEOUT:
+        p.objid = ID_ipReasmTimeout;
+        break;
+    case IPREASMREQDS:
+        p.objid = ID_ipReasmReqds;
+        break;
+    case IPREASMOKS:
+        p.objid = ID_ipReasmOKs;
+        break;
+    case IPREASMFAILS:
+        p.objid = ID_ipReasmFails;
+        break;
+    case IPFRAGOKS:
+        p.objid = ID_ipFragOKs;
+        break;
+    case IPFRAGFAILS:
+        p.objid = ID_ipFragFails;
+        break;
+    case IPFRAGCREATES:
+        p.objid = ID_ipFragCreates;
+        break;
+    case IPROUTEDISCARDS:
+        p.objid = ID_ipRoutingDiscards;
+        break;
+    default:
+        *ipstat = 0;
+        close_mib(fd);
+        return (0);
+    }
+
+    p.buffer = (void *) ipstat;
+    ulen = sizeof(IP_STAT_STRUCTURE);
+    p.len = &ulen;
+    ret_value = get_mib_info(fd, &p);
+    close_mib(fd);
+
+    return (ret_value);         /* 0: ok, < 0: error */
+#else                           /* hpux11 */
+
+
+    if (ip_stats_cache_marker &&
+        (!atime_ready
+         (ip_stats_cache_marker, IP_STATS_CACHE_TIMEOUT * 1000)))
+#if !(defined(linux) || defined(solaris2))
+        return ((magic == IPFORWARDING ? forward :
+                 (magic == IPDEFAULTTTL ? ttl : 0)));
+#else
+        return 0;
+#endif
+
+    if (ip_stats_cache_marker)
+        atime_setMarker(ip_stats_cache_marker);
+    else
+        ip_stats_cache_marker = atime_newMarker();
+
+
+#ifdef linux
+    ret_value = linux_read_ip_stat(ipstat);
+#endif
+
+#ifdef solaris2
+    ret_value =
+        getMibstat(MIB_IP, ipstat, sizeof(mib2_ip_t), GET_FIRST,
+                   &Get_everything, NULL);
+#endif
+
+#ifdef WIN32
+    ret_value = GetIpStatistics(ipstat);
+#endif
+
+#if !(defined(linux) || defined(solaris2) || defined(WIN32))
+    if (magic == IPFORWARDING) {
+
+#if defined(CAN_USE_SYSCTL) && defined(IPCTL_STATS)
+        len = sizeof i;
+        sname[3] = IPCTL_FORWARDING;
+        if (sysctl(sname, 4, &i, &len, 0, 0) < 0)
+            forward = -1;
+        else
+            forward = (i ? 1    /* GATEWAY */
+                       : 2 /* HOST    */ );
+#else
+        if (!auto_nlist
+            (IP_FORWARDING_SYMBOL, (char *) &ret_value, sizeof(ret_value)))
+            forward = -1;
+        else
+            forward = (ret_value ? 1    /* GATEWAY */
+                       : 2 /* HOST    */ );
+#endif
+        if (forward == -1) {
+            free(ip_stats_cache_marker);
+            ip_stats_cache_marker = NULL;
+        }
+        return forward;
+    }
+
+    if (magic == IPDEFAULTTTL) {
+
+#if (defined(CAN_USE_SYSCTL) && defined(IPCTL_STATS))
+        len = sizeof i;
+        sname[3] = IPCTL_DEFTTL;
+        if (sysctl(sname, 4, &i, &len, 0, 0) < 0)
+            ttl = -1;
+        else
+            ttl = i;
+#else
+        if (!auto_nlist
+            (TCP_TTL_SYMBOL, (char *) &ret_value, sizeof(ret_value)))
+            ttl = -1;
+        else
+            ttl = ret_value;
+#endif
+        if (ttl == -1) {
+            free(ip_stats_cache_marker);
+            ip_stats_cache_marker = NULL;
+        }
+        return ttl;
+    }
+
+#ifdef HAVE_SYS_TCPIPSTATS_H
+    ret_value = sysmp(MP_SAGET, MPSA_TCPIPSTATS, ipstat, sizeof *ipstat);
+#endif
+
+#if (defined(CAN_USE_SYSCTL) && defined(IPCTL_STATS))
+    len = sizeof *ipstat;
+    sname[3] = IPCTL_STATS;
+    ret_value = sysctl(sname, 4, ipstat, &len, 0, 0);
+#endif
+#ifdef IPSTAT_SYMBOL
+    if (auto_nlist(IPSTAT_SYMBOL, (char *) ipstat, sizeof(*ipstat)))
+        ret_value = 0;
+#endif
+#endif                          /* !(defined(linux) || defined(solaris2)) */
+
+    if (ret_value == -1) {
+        free(ip_stats_cache_marker);
+        ip_stats_cache_marker = NULL;
+    }
+    return ret_value;
+#endif                          /* hpux11 */
+}
+
+#ifdef WIN32
+int
+writeIpStats(int action,
+             u_char * var_val,
+             u_char var_val_type,
+             size_t var_val_len,
+             u_char * statP, oid * name, size_t name_len)
+{
+    long           *buf, *oldbuf;
+    MIB_IPSTATS     ipStats;
+    int             var;
+    int             retval = SNMP_ERR_NOERROR;
+    /*
+     * #define for ip scalar objects are 1 less than corresponding sub-id in MIB
+     * * i.e. IPFORWARDING defined as 0, but ipForwarding registered as 1
+     */
+    var = name[7] - 1;
+    switch (var) {
+    case IPFORWARDING:
+        buf = &ipForwarding;
+        oldbuf = &oldipForwarding;
+        break;
+    case IPDEFAULTTTL:
+        buf = &ipTTL;
+        oldbuf = &oldipTTL;
+        break;
+    default:
+        return SNMP_ERR_NOTWRITABLE;
+    }
+
+    switch (action) {
+    case RESERVE1:             /* Check values for acceptability */
+        if (var_val_type != ASN_INTEGER) {
+            snmp_log(LOG_ERR, "not integer\n");
+            return SNMP_ERR_WRONGTYPE;
+        }
+        if (var_val_len > sizeof(int)) {
+            snmp_log(LOG_ERR, "bad length\n");
+            return SNMP_ERR_WRONGLENGTH;
+        }
+        switch (var) {
+        case IPFORWARDING:
+            if (((int) *var_val < 1) || ((int) *var_val > 2)) {
+                snmp_log(LOG_ERR, "not supported ip forwarding : %d\n",
+                         *var_val);
+                return SNMP_ERR_WRONGVALUE;
+            }
+            break;
+        case IPDEFAULTTTL:
+            if ((int) *var_val < 0) {
+                snmp_log(LOG_ERR, "not supported ip Default : %d\n",
+                         (int) *var_val);
+                return SNMP_ERR_WRONGVALUE;
+            }
+        }
+        break;
+
+    case RESERVE2:             /* Allocate memory and similar resources */
+        break;
+
+    case ACTION:
+        /*
+         * Save the old value, in case of UNDO 
+         */
+
+        *oldbuf = *buf;
+        *buf = (int) *var_val;
+        break;
+
+    case UNDO:                 /* Reverse the SET action and free resources */
+        *buf = *oldbuf;
+        break;
+
+    case COMMIT:               /* Confirm the SET, performing any irreversible actions,
+                                 * and free resources */
+        switch (var) {
+        case IPFORWARDING:
+            /*
+             * Currently windows supports only ON->OFF 
+             */
+            ipStats.dwForwarding = *buf;
+            ipStats.dwDefaultTTL = MIB_USE_CURRENT_TTL;
+            if (SetIpStatistics(&ipStats) != NO_ERROR) {
+                retval = SNMP_ERR_COMMITFAILED;
+                snmp_log(LOG_ERR,
+                         "Can't set ipForwarding, supports only enable->disable \n");
+            }
+            break;
+        case IPDEFAULTTTL:
+            if (SetIpTTL((UINT) * buf) != NO_ERROR) {
+                retval = SNMP_ERR_COMMITFAILED;
+                snmp_log(LOG_ERR, "Can't set ipDefaultTTL\n");
+            }
+            break;
+        }
+
+    case FREE:                 /* Free any resources allocated */
+        break;
+    }
+    return retval;
+}                               /* end of writeIpStats */
+#endif                          /* WIN32 */
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/mibII/ip.h tomato121/release/src/router/snmp/agent/mibgroup/mibII/ip.h
--- tomato/release/src/router/snmp/agent/mibgroup/mibII/ip.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/mibII/ip.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,69 @@
+/*
+ *  Template MIB group interface - ip.h
+ *
+ */
+
+#ifndef _MIBGROUP_IP_H
+#define _MIBGROUP_IP_H
+
+
+config_require(mibII/interfaces mibII/ipAddr mibII/at mibII/var_route mibII/route_write)
+config_arch_require(solaris2, kernel_sunos5)
+config_arch_require(linux, mibII/kernel_linux)
+#include "var_route.h"
+#include "route_write.h"
+extern void     init_ip(void);
+extern FindVarMethod var_ip;
+
+#ifdef USING_MIBII_AT_MODULE
+#include "at.h"                 /* for var_atEntry() */
+#endif
+
+
+#define IPFORWARDING	0
+#define IPDEFAULTTTL	1
+#define IPINRECEIVES	2
+#define IPINHDRERRORS	3
+#define IPINADDRERRORS	4
+#define IPFORWDATAGRAMS 5
+#define IPINUNKNOWNPROTOS 6
+#define IPINDISCARDS	7
+#define IPINDELIVERS	8
+#define IPOUTREQUESTS	9
+#define IPOUTDISCARDS	10
+#define IPOUTNOROUTES	11
+#define IPREASMTIMEOUT	12
+#define IPREASMREQDS	13
+#define IPREASMOKS	14
+#define IPREASMFAILS	15
+#define IPFRAGOKS	16
+#define IPFRAGFAILS	17
+#define IPFRAGCREATES	18
+#define IPROUTEDISCARDS	19
+
+#define IPADADDR	1
+#define IPADIFINDEX	2
+#define IPADNETMASK	3
+#define IPADBCASTADDR	4
+#define IPADREASMMAX	5
+
+#define IPROUTEDEST	0
+#define IPROUTEIFINDEX	1
+#define IPROUTEMETRIC1	2
+#define IPROUTEMETRIC2	3
+#define IPROUTEMETRIC3	4
+#define IPROUTEMETRIC4	5
+#define IPROUTENEXTHOP	6
+#define IPROUTETYPE	7
+#define IPROUTEPROTO	8
+#define IPROUTEAGE	9
+#define IPROUTEMASK	10
+#define IPROUTEMETRIC5	11
+#define IPROUTEINFO	12
+
+#define IPMEDIAIFINDEX		0
+#define IPMEDIAPHYSADDRESS	1
+#define IPMEDIANETADDRESS	2
+#define IPMEDIATYPE		3
+
+#endif                          /* _MIBGROUP_IP_H */
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/mibII/ipv6.c tomato121/release/src/router/snmp/agent/mibgroup/mibII/ipv6.c
--- tomato/release/src/router/snmp/agent/mibgroup/mibII/ipv6.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/mibII/ipv6.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,2093 @@
+/*
+ *  IP MIB group implementation - ipv6.c
+ *
+ */
+
+#include <net-snmp/net-snmp-config.h>
+#if defined(IFNET_NEEDS_KERNEL) && !defined(_KERNEL)
+#define _KERNEL 1
+#define _I_DEFINED_KERNEL
+#endif
+#include <sys/types.h>
+#include <sys/param.h>
+#include <sys/socket.h>
+#if defined(__FreeBSD__) && __FreeBSD__ >= 3
+# if HAVE_SYS_SOCKETVAR_H
+#  include <sys/socketvar.h>
+# endif
+#endif
+
+#if STDC_HEADERS
+#include <string.h>
+#include <stdlib.h>
+#else
+#if HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#endif
+#if HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#if HAVE_SYS_IOCTL_H
+#include <sys/ioctl.h>
+#endif
+#if HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+#if HAVE_SYS_SYSCTL_H
+#ifdef _I_DEFINED_KERNEL
+#undef _KERNEL
+#endif
+#include <sys/sysctl.h>
+#ifdef _I_DEFINED_KERNEL
+#define _KERNEL 1
+#endif
+#endif
+#if HAVE_SYS_SYSMP_H
+#include <sys/sysmp.h>
+#endif
+#if HAVE_SYS_TCPIPSTATS_H
+#include <sys/tcpipstats.h>
+#endif
+#include <net/if.h>
+#if HAVE_NET_IF_VAR_H
+#include <net/if_var.h>
+#endif
+#if HAVE_NET_IF_DL_H
+#include <net/if_dl.h>
+#endif
+#ifdef HAVE_NET_IF_MIB_H
+#include <net/if_mib.h>
+#endif
+#ifdef _I_DEFINED_KERNEL
+#undef _KERNEL
+#endif
+#include <netinet/in_systm.h>
+#if HAVE_SYS_HASHING_H
+#include <sys/hashing.h>
+#endif
+#if HAVE_SYS_SOCKIO_H
+#include <sys/sockio.h>
+#endif
+#if HAVE_NETINET6_IN6_VAR_H
+#include <netinet6/in6_var.h>
+#endif
+#include <netinet/ip6.h>
+#if HAVE_NETINET_IP_VAR_H
+# include <netinet/ip_var.h>
+#endif
+#if HAVE_NETINET6_IP6_VAR_H
+# include <netinet6/ip6_var.h>
+#endif
+#include <net/route.h>
+#if defined(__FreeBSD__) && __FreeBSD__ >= 3
+# if HAVE_NETINET_IN_PCB_H
+#  include <netinet/in_pcb.h>
+# endif
+#endif
+#if HAVE_NETINET6_IN6_PCB_H
+# include <netinet6/in6_pcb.h>
+#endif
+#if HAVE_NETINET6_TCP6_H
+# define TCP6
+#endif
+#ifndef TCP6
+# if HAVE_NETINET_TCP_H
+#  include <netinet/tcp.h>
+# endif
+# if HAVE_NETINET_TCP_TIMER_H
+#  include <netinet/tcp_timer.h>
+# endif
+# if HAVE_NETINET_TCP_VAR_H
+#  include <netinet/tcp_var.h>
+# endif
+# if HAVE_NETINET_TCP_FSM_H
+#  include <netinet/tcp_fsm.h>
+# endif
+#endif
+#if HAVE_NETINET6_TCP6_H
+# include <netinet6/tcp6.h>
+#endif
+#if HAVE_NETINET6_TCP6_TIMER_H
+#include <netinet6/tcp6_timer.h>
+#endif
+#if HAVE_NETINET6_TCP6_VAR_H
+#include <netinet6/tcp6_var.h>
+#endif
+#if HAVE_NETINET6_TCP6_FSM_H
+#include <netinet6/tcp6_fsm.h>
+#endif
+#if HAVE_INET_MIB2_H
+#include <inet/mib2.h>
+#endif
+#ifdef HAVE_SYSLOG_H
+#include <syslog.h>
+#endif
+
+#ifdef MIB_IPCOUNTER_SYMBOL
+#include <sys/mib.h>
+#include <netinet/mib_kern.h>
+#endif                          /* MIB_IPCOUNTER_SYMBOL */
+
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include <net-snmp/agent/auto_nlist.h>
+
+#include "kernel.h"
+#include "util_funcs.h"
+#include "ipv6.h"
+#include "interfaces.h"
+
+static int header_ipv6
+__P((register struct variable *, oid *, size_t *, int, size_t *,
+     WriteMethod **));
+static int header_ipv6_scan
+__P((register struct variable *, oid *, size_t *, int, size_t *,
+     WriteMethod **, int, int));
+static int if_initialize __P((void));
+static int if_maxifindex __P((void));
+static char    *if_getname __P((int));
+static int if_getindex __P((const char *));
+
+struct variable3 ipv6_variables[] = {
+    {IPV6FORWARDING, ASN_INTEGER, RONLY, var_ipv6, 1, {1}},
+    {IPV6DEFAULTHOPLIMIT, ASN_INTEGER, RONLY, var_ipv6, 1, {2}},
+    {IPV6INTERFACES, ASN_GAUGE, RONLY, var_ipv6, 1, {3}},
+    {IPV6IFTBLLASTCHG, ASN_TIMETICKS, RONLY, var_ipv6, 1, {4}},
+
+    {IPV6IFDESCR, ASN_OCTET_STR, RONLY, var_ifv6Entry, 3, {5, 1, 2}},
+    {IPV6IFLOWLAYER, ASN_OBJECT_ID, RONLY, var_ifv6Entry, 3, {5, 1, 3}},
+    {IPV6IFEFFECTMTU, ASN_UNSIGNED, RONLY, var_ifv6Entry, 3, {5, 1, 4}},
+    {IPV6IFREASMMAXSIZE, ASN_UNSIGNED, RONLY, var_ifv6Entry, 3, {5, 1, 5}},
+
+    {IPV6IFTOKEN, ASN_OCTET_STR, RONLY, var_ifv6Entry, 3, {5, 1, 6}},
+    {IPV6IFTOKENLEN, ASN_INTEGER, RONLY, var_ifv6Entry, 3, {5, 1, 7}},
+    {IPV6IFPHYSADDRESS, ASN_OCTET_STR, RONLY, var_ifv6Entry, 3, {5, 1, 8}},
+    {IPV6IFADMSTATUS, ASN_INTEGER, RONLY, var_ifv6Entry, 3, {5, 1, 9}},
+    {IPV6IFOPERSTATUS, ASN_INTEGER, RONLY, var_ifv6Entry, 3, {5, 1, 10}},
+    {IPV6IFLASTCHANGE, ASN_TIMETICKS, RONLY, var_ifv6Entry, 3, {5, 1, 11}},
+
+    {IPV6IFSTATSINRCVS, ASN_COUNTER, RONLY, var_ifv6Entry, 3, {6, 1, 1}},
+    {IPV6IFSTATSINHDRERRS, ASN_COUNTER, RONLY, var_ifv6Entry, 3,
+     {6, 1, 2}},
+    {IPV6IFSTATSTOOBIGERRS, ASN_COUNTER, RONLY, var_ifv6Entry, 3,
+     {6, 1, 3}},
+    {IPV6IFSTATSINNOROUTES, ASN_COUNTER, RONLY, var_ifv6Entry, 3,
+     {6, 1, 4}},
+    {IPV6IFSTATSINADDRERRS, ASN_COUNTER, RONLY, var_ifv6Entry, 3,
+     {6, 1, 5}},
+    {IPV6IFSTATSINUNKNOWPROTS, ASN_COUNTER, RONLY, var_ifv6Entry, 3,
+     {6, 1, 6}},
+    {IPV6IFSTATSINTRUNCATPKTS, ASN_COUNTER, RONLY, var_ifv6Entry, 3,
+     {6, 1, 7}},
+    {IPV6IFSTATSINDISCARDS, ASN_COUNTER, RONLY, var_ifv6Entry, 3,
+     {6, 1, 8}},
+    {IPV6IFSTATSINDELIVERS, ASN_COUNTER, RONLY, var_ifv6Entry, 3,
+     {6, 1, 9}},
+    {IPV6IFSTATSOUTFORWDATAS, ASN_COUNTER, RONLY, var_ifv6Entry, 3,
+     {6, 1, 10}},
+    {IPV6IFSTATSOUTREQS, ASN_COUNTER, RONLY, var_ifv6Entry, 3, {6, 1, 11}},
+    {IPV6IFSTATSOUTDISCARDS, ASN_COUNTER, RONLY, var_ifv6Entry, 3,
+     {6, 1, 12}},
+    {IPV6IFSTATSOUTFRAGOKS, ASN_COUNTER, RONLY, var_ifv6Entry, 3,
+     {6, 1, 13}},
+    {IPV6IFSTATSOUTFRAGFAILS, ASN_COUNTER, RONLY, var_ifv6Entry, 3,
+     {6, 1, 14}},
+    {IPV6IFSTATSOUTFRAGCREATS, ASN_COUNTER, RONLY, var_ifv6Entry, 3,
+     {6, 1, 15}},
+    {IPV6IFSTATSOUTREASMREQS, ASN_COUNTER, RONLY, var_ifv6Entry, 3,
+     {6, 1, 16}},
+    {IPV6IFSTATSOUTREASMOKS, ASN_COUNTER, RONLY, var_ifv6Entry, 3,
+     {6, 1, 17}},
+    {IPV6IFSTATSOUTREASMFAILS, ASN_COUNTER, RONLY, var_ifv6Entry, 3,
+     {6, 1, 18}},
+    {IPV6IFSTATSINMCASTPKTS, ASN_COUNTER, RONLY, var_ifv6Entry, 3,
+     {6, 1, 19}},
+    {IPV6IFSTATSOUTMCASTPKTS, ASN_COUNTER, RONLY, var_ifv6Entry, 3,
+     {6, 1, 20}},
+
+#if 0
+    {IPV6ADDRPREFIXONLINKFLG, INTEGER, RONLY, var_ipv6AddrEntry, 3,
+     {7, 1, 3}},
+    {IPV6ADDRPREFIXAUTONOMOUSFLAG, INTEGER, RONLY, var_ipv6AddrEntry, 3,
+     {7, 1, 4}},
+    {IPV6ADDRPREFIXADVPREFERLIFE, UNSIGNED32, RONLY, var_ipv6AddrEntry, 3,
+     {7, 1, 5}},
+    {IPV6ADDRPREFIXVALIDLIFE, UNSIGNED32, RONLY, var_ipv6AddrEntry, 3,
+     {7, 1, 6}},
+
+    {IPV6ADDRPFXLEN, INTEGER, RONLY, var_ipv6AddrEntry, 3, {8, 1, 2}},
+    {IPV6ADDRTYPE, INTEGER, RONLY, var_ipv6AddrEntry, 3, {8, 1, 3}},
+    {IPV6ADDRANYCASTFLAG, INTEGER, RONLY, var_ipv6AddrEntry, 3, {8, 1, 4}},
+    {IPV6ADDRSTATUS, INTEGER, RONLY, var_ipv6AddrEntry, 3, {8, 1, 5}},
+
+    {IPV6ROUTEIFINDEX, IpV6IFINDEX, RONLY, var_ipv6RouteEntry, 3,
+     {11, 1, 4}},
+    {IPV6ROUTENEXTHOP, IpV6ADDRESS, RONLY, var_ipv6RouteEntry, 3,
+     {11, 1, 5}},
+    {IPV6ROUTETYPE, INTEGER, RONLY, var_ipv6RouteEntry, 3, {11, 1, 6}},
+    {IPV6ROUTEPROTOCOL, INTEGER, RONLY, var_ipv6RouteEntry, 3, {11, 1, 7}},
+    {IPV6ROUTEPOLICY, UNSIGNED32, RONLY, var_ipv6RouteEntry, 3,
+     {11, 1, 8}},
+    {IPV6ROUTEAGE, UNSIGNED32, RONLY, var_ipv6RouteEntry, 3, {11, 1, 9}},
+    {IPV6ROUTENEXTHOPRDI, UNSIGNED32, RONLY, var_ipv6RouteEntry, 3,
+     {11, 1, 10}},
+    {IPV6ROUTEMETRIC, UNSIGNED32, RONLY, var_ipv6RouteEntry, 3,
+     {11, 1, 11}},
+    {IPV6ROUTEWEIGHT, UNSIGNED32, RONLY, var_ipv6RouteEntry, 3,
+     {11, 1, 12}},
+    {IPV6ROUTEINFO, OBJID, RONLY, var_ipv6RouteEntry, 3, {11, 1, 13}},
+    {IPV6ROUTEVALID, INTEGER, RONLY, var_ipv6RouteEntry, 3, {11, 1, 14}},
+
+    {IPV6NETTOMEDIAPHYADDR, STRING, RONLY, var_ndpEntry, 3, {12, 1, 2}},
+    {IPV6NETTOMEDIATYPE, INTEGER, RONLY, var_ndpEntry, 3, {12, 1, 3}},
+    {IPV6NETTOMEDIASTATE, INTEGER, RONLY, var_ndpEntry, 3, {12, 1, 4}},
+    {IPV6NETTOMEDIALASTUPDATE, TIMETICKS, RONLY, var_ndpEntry, 3,
+     {12, 1, 5}},
+    {IPV6NETTOMEDIAVALID, INTEGER, RONLY, var_ndpEntry, 3, {12, 1, 6}},
+#endif
+};
+oid             ipv6_variables_oid[] = { SNMP_OID_MIB2, 55, 1 };
+#if 0
+config_load_mib(MIB .55 .1, 8, ipv6_variables)
+    config_add_mib(IPV6 - TC)
+    config_add_mib(IPV6 - MIB)
+#endif
+     struct variable3 ipv6icmp_variables[] = {
+         {IPV6IFICMPINMSG, ASN_COUNTER, RONLY, var_icmpv6Entry, 3,
+          {1, 1, 1}},
+         {IPV6IFICMPINERRORS, ASN_COUNTER, RONLY, var_icmpv6Entry, 3,
+          {1, 1, 2}},
+         {IPV6IFICMPINDSTUNRCHS, ASN_COUNTER, RONLY, var_icmpv6Entry, 3,
+          {1, 1, 3}},
+         {IPV6IFICMPINADMPROHS, ASN_COUNTER, RONLY, var_icmpv6Entry, 3,
+          {1, 1, 4}},
+         {IPV6IFICMPINTIMEXCDS, ASN_COUNTER, RONLY, var_icmpv6Entry, 3,
+          {1, 1, 5}},
+         {IPV6IFICMPINPARMPROBS, ASN_COUNTER, RONLY, var_icmpv6Entry, 3,
+          {1, 1, 6}},
+         {IPV6IFICMPINPKTTOOBIGS, ASN_COUNTER, RONLY, var_icmpv6Entry, 3,
+          {1, 1, 7}},
+         {IPV6IFICMPINECHOS, ASN_COUNTER, RONLY, var_icmpv6Entry, 3,
+          {1, 1, 8}},
+         {IPV6IFICMPINECHOREPS, ASN_COUNTER, RONLY, var_icmpv6Entry, 3,
+          {1, 1, 9}},
+         {IPV6IFICMPINRTRSLICITS, ASN_COUNTER, RONLY, var_icmpv6Entry, 3,
+          {1, 1, 10}},
+         {IPV6IFICMPINRTRADVS, ASN_COUNTER, RONLY, var_icmpv6Entry, 3,
+          {1, 1, 11}},
+         {IPV6IFICMPINNBRSLICITS, ASN_COUNTER, RONLY, var_icmpv6Entry, 3,
+          {1, 1, 12}},
+         {IPV6IFICMPINNBRADVS, ASN_COUNTER, RONLY, var_icmpv6Entry, 3,
+          {1, 1, 13}},
+         {IPV6IFICMPINREDIRECTS, ASN_COUNTER, RONLY, var_icmpv6Entry, 3,
+          {1, 1, 14}},
+         {IPV6IFICMPINGRPMEQERYS, ASN_COUNTER, RONLY, var_icmpv6Entry, 3,
+          {1, 1, 15}},
+         {IPV6IFICMPINGRPMERSPS, ASN_COUNTER, RONLY, var_icmpv6Entry, 3,
+          {1, 1, 16}},
+         {IPV6IFICMPINGRPMEREDCS, ASN_COUNTER, RONLY, var_icmpv6Entry, 3,
+          {1, 1, 17}},
+         {IPV6IFICMPOUTMSG, ASN_COUNTER, RONLY, var_icmpv6Entry, 3,
+          {1, 1, 18}},
+         {IPV6IFICMPOUTERRORS, ASN_COUNTER, RONLY, var_icmpv6Entry, 3,
+          {1, 1, 19}},
+         {IPV6IFICMPOUTDSTUNRCHS, ASN_COUNTER, RONLY, var_icmpv6Entry, 3,
+          {1, 1, 20}},
+         {IPV6IFICMPOUTADMPROHS, ASN_COUNTER, RONLY, var_icmpv6Entry, 3,
+          {1, 1, 21}},
+         {IPV6IFICMPOUTTIMEXCDS, ASN_COUNTER, RONLY, var_icmpv6Entry, 3,
+          {1, 1, 22}},
+         {IPV6IFICMPOUTPARMPROBS, ASN_COUNTER, RONLY, var_icmpv6Entry, 3,
+          {1, 1, 23}},
+         {IPV6IFICMPOUTPKTTOOBIGS, ASN_COUNTER, RONLY, var_icmpv6Entry, 3,
+          {1, 1, 24}},
+         {IPV6IFICMPOUTECHOS, ASN_COUNTER, RONLY, var_icmpv6Entry, 3,
+          {1, 1, 25}},
+         {IPV6IFICMPOUTECHOREPS, ASN_COUNTER, RONLY, var_icmpv6Entry, 3,
+          {1, 1, 26}},
+         {IPV6IFICMPOUTRTRSLICITS, ASN_COUNTER, RONLY, var_icmpv6Entry, 3,
+          {1, 1, 27}},
+         {IPV6IFICMPOUTRTRADVS, ASN_COUNTER, RONLY, var_icmpv6Entry, 3,
+          {1, 1, 28}},
+         {IPV6IFICMPOUTNBRSLICITS, ASN_COUNTER, RONLY, var_icmpv6Entry, 3,
+          {1, 1, 29}},
+         {IPV6IFICMPOUTNBRADVS, ASN_COUNTER, RONLY, var_icmpv6Entry, 3,
+          {1, 1, 30}},
+         {IPV6IFICMPOUTREDIRECTS, ASN_COUNTER, RONLY, var_icmpv6Entry, 3,
+          {1, 1, 31}},
+         {IPV6IFICMPOUTGRPMEQERYS, ASN_COUNTER, RONLY, var_icmpv6Entry, 3,
+          {1, 1, 32}},
+         {IPV6IFICMPOUTGRPMERSPS, ASN_COUNTER, RONLY, var_icmpv6Entry, 3,
+          {1, 1, 33}},
+         {IPV6IFICMPOUTGRPMEREDCS, ASN_COUNTER, RONLY, var_icmpv6Entry, 3,
+          {1, 1, 34}}
+     };
+oid             ipv6icmp_variables_oid[] = { 1, 3, 6, 1, 2, 1, 56, 1 };
+#if 0
+config_load_mib(MIB .56 .1, 8, ipv6icmp_variables)
+    config_add_mib(IPV6 - ICMP - MIB)
+#endif
+     struct variable2 ipv6udp_variables[] = {
+         {IPV6UDPLOCALADDRESS, ASN_OCTET_STR, RONLY, var_udp6, 2, {1, 1}},
+         {IPV6UDPLOCALPORT, ASN_INTEGER, RONLY, var_udp6, 2, {1, 2}},
+         {IPV6UDPIFINDEX, ASN_INTEGER, RONLY, var_udp6, 2, {1, 3}}
+     };
+oid             ipv6udp_variables_oid[] = { 1, 3, 6, 1, 2, 1, 7, 6 };
+#if 0
+config_load_mib(1.3 .6 .1 .3 .87 .1, 7, ipv6udp_variables)
+    config_add_mib(IPV6 - UDP - MIB)
+#endif
+     struct variable2 ipv6tcp_variables[] = {
+         {IPV6TCPLOCALADDR, ASN_OCTET_STR, RONLY, var_tcp6, 2, {1, 1}},
+         {IPV6TCPLOCALPORT, ASN_INTEGER, RONLY, var_tcp6, 2, {1, 2}},
+         {IPV6TCPREMOTEADDR, ASN_OCTET_STR, RONLY, var_tcp6, 2, {1, 3}},
+         {IPV6TCPREMOTEPORT, ASN_INTEGER, RONLY, var_tcp6, 2, {1, 4}},
+         {IPV6TCPIFINDEX, ASN_INTEGER, RONLY, var_tcp6, 2, {1, 5}},
+         {IPV6TCPCONNSTATE, ASN_INTEGER, RONLY, var_tcp6, 2, {1, 6}},
+     };
+oid             ipv6tcp_variables_oid[] = { 1, 3, 6, 1, 2, 1, 6, 16 };
+#if 0
+config_load_mib(1.3 .6 .1 .3 .86 .1, 7, ipv6tcp_variables)
+    config_add_mib(IPV6 - TCP - MIB)
+#endif
+     void
+                     init_ipv6()
+{
+    /*
+     * register ourselves with the agent to handle our mib tree 
+     */
+    REGISTER_MIB("mibII/ipv6", ipv6_variables, variable3,
+                 ipv6_variables_oid);
+    REGISTER_MIB("mibII/icmpv6", ipv6icmp_variables, variable3,
+                 ipv6icmp_variables_oid);
+    REGISTER_MIB("mibII/ipv6udp", ipv6udp_variables, variable2,
+                 ipv6udp_variables_oid);
+    REGISTER_MIB("mibII/ipv6tcp", ipv6tcp_variables, variable2,
+                 ipv6tcp_variables_oid);
+}
+
+static int
+header_ipv6(register struct variable *vp,
+            /*
+             * IN - pointer to variable entry that points here 
+             */
+            oid * name,         /* IN/OUT - input name requested, output name found */
+            size_t * length,    /* IN/OUT - length of input and output oid's */
+            int exact,          /* IN - TRUE if an exact match was requested */
+            size_t * var_len,   /* OUT - length of variable or 0 if function returned */
+            WriteMethod ** write_method)
+{
+    oid             newname[MAX_OID_LEN];
+    int             result;
+
+    DEBUGMSGTL(("mibII/ipv6", "header_ipv6: "));
+    DEBUGMSGOID(("mibII/ipv6", name, *length));
+    DEBUGMSG(("mibII/ipv6", " %d\n", exact));
+
+    memcpy((char *) newname, (char *) vp->name,
+           (int) vp->namelen * sizeof(oid));
+    newname[(int) vp->namelen] = 0;
+    result =
+        snmp_oid_compare(name, *length, newname, (int) vp->namelen + 1);
+    if ((exact && (result != 0)) || (!exact && (result >= 0)))
+        return (MATCH_FAILED);
+    memcpy((char *) name, (char *) newname,
+           ((int) vp->namelen + 1) * sizeof(oid));
+    *length = vp->namelen + 1;
+
+    *write_method = 0;
+    *var_len = sizeof(long);    /* default to 'long' results */
+    return (MATCH_SUCCEEDED);
+}
+
+static int
+header_ipv6_scan(register struct variable *vp,
+                 /*
+                  * IN - pointer to variable entry that points here 
+                  */
+                 oid * name,    /* IN/OUT - input name requested, output name found */
+                 size_t * length,       /* IN/OUT - length of input and output oid's */
+                 int exact,     /* IN - TRUE if an exact match was requested */
+                 size_t * var_len,      /* OUT - length of variable or 0 if function returned */
+                 WriteMethod ** write_method, int from, int to)
+{
+    oid             newname[MAX_OID_LEN];
+    int             result;
+    int             i;
+
+    DEBUGMSGTL(("mibII/ipv6", "header_ipv6_scan: "));
+    DEBUGMSGOID(("mibII/ipv6", name, *length));
+    DEBUGMSG(("mibII/ipv6", " %d\n", exact));
+
+    memcpy((char *) newname, (char *) vp->name,
+           (int) vp->namelen * sizeof(oid));
+    for (i = from; i <= to; i++) {
+        newname[(int) vp->namelen] = i;
+        result =
+            snmp_oid_compare(name, *length, newname,
+                             (int) vp->namelen + 1);
+        if (((exact && result == 0) || (!exact && result < 0))
+            && if_getname(i))
+            break;
+    }
+    if (to < i)
+        return (MATCH_FAILED);
+    memcpy((char *) name, (char *) newname,
+           ((int) vp->namelen + 1) * sizeof(oid));
+    *length = vp->namelen + 1;
+    *write_method = 0;
+    *var_len = sizeof(long);    /* default to 'long' results */
+    return (MATCH_SUCCEEDED);
+}
+
+static struct if_nameindex *ifnames = NULL;
+
+#ifdef linux
+static void     linux_if_freenameindex(struct if_nameindex *);
+static struct if_nameindex *linux_if_nameindex(void);
+#endif
+
+static int
+if_initialize(void)
+{
+#ifndef HAVE_IF_NAMEINDEX
+    return -1;
+#else
+#ifndef linux
+    if (ifnames)
+        if_freenameindex(ifnames);
+    ifnames = if_nameindex();
+#else
+    if (ifnames)
+        linux_if_freenameindex(ifnames);
+    ifnames = linux_if_nameindex();
+#endif
+    if (!ifnames) {
+        ERROR_MSG("if_nameindex() failed");
+        return -1;
+    }
+    return 0;
+#endif
+}
+
+static int
+if_maxifindex(void)
+{
+#ifndef HAVE_IF_NAMEINDEX
+    return -1;
+#else
+    struct if_nameindex *p;
+    int             max = 0;
+
+    if (!ifnames) {
+        if (if_initialize() < 0)
+            return -1;
+    }
+    for (p = ifnames; p && p->if_index; p++) {
+        if (max < p->if_index)
+            max = p->if_index;
+    }
+    return max;
+#endif
+}
+
+static int
+if_countifindex(void)
+{
+#ifndef HAVE_IF_NAMEINDEX
+    return -1;
+#else
+    struct if_nameindex *p;
+    int             count = 0;
+
+    if (!ifnames) {
+        if (if_initialize() < 0)
+            return -1;
+    }
+    for (p = ifnames; p && p->if_index; p++) {
+        count++;
+    }
+    return count;
+#endif
+}
+
+static char    *
+if_getname(int idx)
+{
+#ifndef HAVE_IF_NAMEINDEX
+    return NULL;
+#else
+    struct if_nameindex *p;
+    int             max = -1;
+
+    if (!ifnames) {
+        if (if_initialize() < 0)
+            return NULL;
+    }
+    for (p = ifnames; p && p->if_index; p++) {
+        if (p->if_index == idx)
+            return p->if_name;
+    }
+    return NULL;
+#endif
+}
+
+static int
+if_getindex(const char *name)
+{
+#ifndef HAVE_IF_NAMEINDEX
+    return -1;
+#else
+    struct if_nameindex *p;
+
+    if (!ifnames) {
+        if (if_initialize() < 0)
+            return -1;
+    }
+    for (p = ifnames; p && p->if_index; p++) {
+        if (strcmp(name, p->if_name) == 0)
+            return p->if_index;
+    }
+    return -1;
+#endif
+}
+
+/*------------------------------------------------------------*/
+#ifndef linux
+/*
+ * KAME dependent part 
+ */
+static int
+if_getifnet(int idx, struct ifnet *result)
+{
+    caddr_t         q;
+    struct ifnet    tmp;
+
+    if (!auto_nlist("ifnet", (char *) &q, sizeof(q)))
+        return -1;
+    while (q) {
+        klookup((u_long) q, (char *) &tmp, sizeof(tmp));
+        if (idx == tmp.if_index) {
+            memcpy(result, &tmp, sizeof(tmp));
+            return 0;
+        }
+#if defined(__FreeBSD__) && 3 <= __FreeBSD__
+        q = (caddr_t) TAILQ_NEXT(&tmp, if_link);
+#else
+# if defined(__NetBSD__) || defined(__OpenBSD__)
+        q = (caddr_t) TAILQ_NEXT(&tmp, if_list);
+# else
+        q = (caddr_t) tmp.if_next;
+# endif
+#endif
+    }
+    return -1;
+}
+
+#ifdef HAVE_NET_IF_MIB_H
+#if defined(HAVE_SYS_SYSCTL_H) && defined(CTL_NET)
+static int
+if_getifmibdata(int idx, struct ifmibdata *result)
+{
+    int             mib[6] = {
+        CTL_NET, PF_LINK, NETLINK_GENERIC, IFMIB_IFDATA, 0, IFDATA_GENERAL
+    };
+    int             len;
+    struct ifmibdata tmp;
+
+    mib[4] = idx;
+    len = sizeof(struct ifmibdata);
+    if (sysctl(mib, sizeof(mib) / sizeof(mib[0]), &tmp, &len, 0, 0) < 0)
+        return -1;
+    memcpy(result, &tmp, sizeof(tmp));
+    return 0;
+}
+#endif
+#endif                          /*HAVE_NET_IF_MIB_H */
+
+#ifdef __KAME__
+#define IPV6_FORWARDING_SYMBOL	"ip6_forwarding"
+#define IPV6_DEFHLIM_SYMBOL	"ip6_defhlim"
+#endif
+
+u_char         *
+var_ipv6(register struct variable * vp,
+         oid * name,
+         size_t * length,
+         int exact, size_t * var_len, WriteMethod ** write_method)
+{
+    int             i;
+
+    if (header_ipv6(vp, name, length, exact, var_len, write_method)
+        == MATCH_FAILED) {
+        return NULL;
+    }
+#if defined(HAVE_SYS_SYSCTL_H) && defined(CTL_NET)
+    /*
+     * try with sysctl routines 
+     */
+    {
+        int             name[] = { CTL_NET, PF_INET6, IPPROTO_IPV6, 0 };
+        const char     *namestr = NULL;
+        int             result;
+        int             resultsiz;
+
+        resultsiz = sizeof(result);
+        switch (vp->magic) {
+        case IPV6FORWARDING:
+            name[3] = IPV6CTL_FORWARDING;
+            namestr = "IPV6CTL_FORWARDING";
+            if (sysctl
+                (name, sizeof(name) / sizeof(name[0]), &result, &resultsiz,
+                 0, 0) < 0) {
+                DEBUGMSGTL(("mibII/ipv6",
+                            "sysctl(CTL_NET, PF_INET6, IPPROTO_IPV6, %s)\n",
+                            namestr));
+                break;
+            } else {
+                if (result)
+                    long_return = 1;    /* GATEWAY */
+                else
+                    long_return = 2;    /* HOST */
+                return (u_char *) & long_return;
+            }
+            break;
+        case IPV6DEFAULTHOPLIMIT:
+            name[3] = IPV6CTL_DEFHLIM;
+            namestr = "IPV6CTL_DEFHLIM";
+            if (sysctl
+                (name, sizeof(name) / sizeof(name[0]), &result, &resultsiz,
+                 0, 0) < 0) {
+                DEBUGMSGTL(("mibII/ipv6",
+                            "sysctl(CTL_NET, PF_INET6, IPPROTO_IPV6, %s)\n",
+                            namestr));
+                break;
+            } else {
+                long_return = result;
+                return (u_char *) & long_return;
+            }
+        }
+    }
+#endif                          /* not (HAVE_SYS_SYSCTL_H && CTL_NET) */
+
+    /*
+     * try looking into the kernel variable 
+     */
+    switch (vp->magic) {
+#ifdef IPV6_FORWARDING_SYMBOL
+    case IPV6FORWARDING:
+        if (auto_nlist(IPV6_FORWARDING_SYMBOL, (char *) &i, sizeof(i))) {
+            if (i)
+                long_return = 1;
+            /*GATEWAY*/
+            else
+                long_return = 2;
+            /*HOST*/ return (u_char *) & long_return;
+        }
+        break;
+#endif
+#ifdef IPV6_DEFHLIM_SYMBOL
+    case IPV6DEFAULTHOPLIMIT:
+        if (auto_nlist(IPV6_DEFHLIM_SYMBOL, (char *) &i, sizeof(i))) {
+            long_return = i;
+            return (u_char *) & long_return;
+        }
+        break;
+#endif
+    case IPV6INTERFACES:
+#ifdef HAVE_IF_NAMEINDEX
+        /*
+         * not really the right answer... we must count IPv6 capable
+         * interfaces only.
+         */
+        long_return = if_countifindex();
+        if (long_return < 0)
+            break;
+        return (u_char *) & long_return;
+#endif
+        break;
+#if 0
+    case IPV6IFTBLLASTCHG:
+        long_return = 0;
+        /*XXX*/ return (u_char *) & long_return;
+#endif
+    default:
+        break;
+    }
+    ERROR_MSG("");
+    return NULL;
+}
+
+u_char         *
+var_ifv6Entry(register struct variable * vp,
+              oid * name,
+              size_t * length,
+              int exact, size_t * var_len, WriteMethod ** write_method)
+{
+#ifndef HAVE_IF_NAMEINDEX
+    return NULL;
+#else
+    int             interface;
+    int             max;
+    char           *p;
+
+    max = if_maxifindex();
+    if (max < 0)
+        return NULL;
+
+    if (header_ipv6_scan
+        (vp, name, length, exact, var_len, write_method, 1, max)
+        == MATCH_FAILED) {
+        return NULL;
+    }
+    interface = name[*length - 1];
+    DEBUGMSGTL(("mibII/ipv6", "interface: %d(%s)\n",
+                interface, if_getname(interface)));
+    if (interface > max)
+        return NULL;
+
+    switch (vp->magic) {
+    case IPV6IFDESCR:
+        p = if_getname(interface);
+        if (p) {
+            *var_len = strlen(p);
+            return p;
+        }
+        break;
+    case IPV6IFLOWLAYER:
+        /*
+         * should check if type, this is a hard one... 
+         */
+        *var_len = nullOidLen;
+        return (u_char *) nullOid;
+    case IPV6IFEFFECTMTU:
+        {
+#if defined(SIOCGIFMTU) && !defined(__OpenBSD__)
+            struct ifreq    ifr;
+            int             s;
+
+            memset(&ifr, 0, sizeof(ifr));
+            ifr.ifr_addr.sa_family = AF_INET6;
+            strncpy(ifr.ifr_name, if_getname(interface),
+                    sizeof(ifr.ifr_name));
+            if ((s = socket(ifr.ifr_addr.sa_family, SOCK_DGRAM, 0)) < 0)
+                break;
+            if (ioctl(s, SIOCGIFMTU, (caddr_t) & ifr) < 0) {
+                close(s);
+                break;
+            }
+            long_return = ifr.ifr_mtu;
+            close(s);
+            return (u_char *) & long_return;
+#else
+            break;
+#endif
+        }
+#if 0                           /*not yet */
+    case IPV6IFREASMMAXSIZE:
+        /*
+         * I dunno what the spec means for this MIB 
+         */
+    case IPV6IFTOKEN:
+    case IPV6IFTOKENLEN:
+#endif
+    case IPV6IFPHYSADDRESS:
+        {
+            struct ifnet    ifnet;
+            struct ifaddr   ifaddr;
+            static struct sockaddr_dl sdl;
+            caddr_t         ifa;
+
+            if (if_getifnet(interface, &ifnet) < 0)
+                break;
+#if defined(__FreeBSD__) && 3 <= __FreeBSD__
+            ifa = (caddr_t) TAILQ_FIRST(&ifnet.if_addrhead);
+#else
+# if defined(__NetBSD__) || defined(__OpenBSD__)
+            ifa = (caddr_t) TAILQ_FIRST(&ifnet.if_addrlist);
+# else
+            ifa = (caddr_t) ifnet.if_addrlist;
+# endif
+#endif
+            while (ifa) {
+                klookup((u_long) ifa, (char *) &ifaddr, sizeof(ifaddr));
+                klookup((u_long) ifaddr.ifa_addr, (char *) &sdl,
+                        sizeof(sdl));
+                if (sdl.sdl_family == AF_LINK) {
+                    if (sizeof(sdl.sdl_data) < sdl.sdl_nlen + sdl.sdl_alen) {
+                        ERROR_MSG("sdl_alen too long for interface\n");
+                        break;
+                    }
+                    *var_len = sdl.sdl_alen;
+                    return (u_char *) (sdl.sdl_data + sdl.sdl_nlen);
+                }
+#if defined(__FreeBSD__) && 3 <= __FreeBSD__
+                ifa = (caddr_t) TAILQ_NEXT(&ifaddr, ifa_link);
+#else
+# if defined(__NetBSD__) || defined(__OpenBSD__)
+                ifa = (caddr_t) TAILQ_NEXT(&ifaddr, ifa_list);
+# else
+                ifa = (caddr_t) ifaddr.ifa_next;
+# endif
+#endif
+            }
+
+            /*
+             * no physical address found 
+             */
+            *var_len = 0;
+            return NULL;
+        }
+    case IPV6IFADMSTATUS:
+        {
+            struct ifnet    ifnet;
+
+            if (if_getifnet(interface, &ifnet) < 0)
+                break;
+            long_return = (ifnet.if_flags & IFF_RUNNING) ? 1 : 2;
+            return (u_char *) & long_return;
+        }
+    case IPV6IFOPERSTATUS:
+        {
+            struct ifnet    ifnet;
+
+            if (if_getifnet(interface, &ifnet) < 0)
+                break;
+            long_return = (ifnet.if_flags & IFF_UP) ? 1 : 2;
+            return (u_char *) & long_return;
+        }
+#if 0                           /*untrustable value returned... */
+    case IPV6IFLASTCHANGE:
+        {
+            struct timeval  lastchange;
+            struct timeval  now;
+            int             gotanswer;
+
+            gotanswer = 0;
+            lastchange.tv_sec = lastchange.tv_usec = 0;
+#ifdef HAVE_NET_IF_MIB_H
+            if (!gotanswer) {
+                struct ifmibdata ifmd;
+
+                if (if_getifmibdata(interface, &ifmd) < 0);
+                else {
+                    lastchange = ifmd.ifmd_data.ifi_lastchange;
+                    gotanswer++;
+                }
+            }
+#endif
+#ifdef STRUCT_IFNET_HAS_IF_LASTCHANGE_TV_SEC
+            if (!gotanswer) {
+                struct ifnet    ifnet;
+
+                if (if_getifnet(interface, &ifnet) < 0);
+                else {
+                    lastchange = ifnet.if_lastchange;
+                    gotanswer++;
+                }
+            }
+#endif
+            DEBUGMSGTL(("mibII/ipv6", "lastchange = { %d.%06d }\n",
+                        lastchange.tv_sec, lastchange.tv_usec));
+            if (lastchange.tv_sec == 0 && lastchange.tv_usec == 0)
+                long_return = 0;
+            else {
+                gettimeofday(&now, (struct timezone *) NULL);
+                long_return =
+                    (u_long) ((now.tv_sec - lastchange.tv_sec) * 100);
+                long_return +=
+                    (u_long) ((now.tv_usec - lastchange.tv_usec) / 10000);
+            }
+            return (u_char *) & long_return;
+        }
+#endif                          /*0 */
+
+#ifdef SIOCGIFSTAT_IN6
+    case IPV6IFSTATSINRCVS:
+    case IPV6IFSTATSINHDRERRS:
+    case IPV6IFSTATSTOOBIGERRS:
+    case IPV6IFSTATSINNOROUTES:
+    case IPV6IFSTATSINADDRERRS:
+    case IPV6IFSTATSINUNKNOWPROTS:
+    case IPV6IFSTATSINTRUNCATPKTS:
+    case IPV6IFSTATSINDISCARDS:
+    case IPV6IFSTATSINDELIVERS:
+    case IPV6IFSTATSOUTFORWDATAS:
+    case IPV6IFSTATSOUTREQS:
+    case IPV6IFSTATSOUTDISCARDS:
+    case IPV6IFSTATSOUTFRAGOKS:
+    case IPV6IFSTATSOUTFRAGFAILS:
+    case IPV6IFSTATSOUTFRAGCREATS:
+    case IPV6IFSTATSOUTREASMREQS:
+    case IPV6IFSTATSOUTREASMOKS:
+    case IPV6IFSTATSOUTREASMFAILS:
+    case IPV6IFSTATSINMCASTPKTS:
+    case IPV6IFSTATSOUTMCASTPKTS:
+        {
+            struct in6_ifstat *ifs6;
+            struct in6_ifreq ifr;
+            int             s;
+
+            memset(&ifr, 0, sizeof(ifr));
+            strncpy(ifr.ifr_name, if_getname(interface),
+                    sizeof(ifr.ifr_name));
+            if ((s = socket(AF_INET6, SOCK_DGRAM, 0)) < 0)
+                break;
+            if (ioctl(s, SIOCGIFSTAT_IN6, (caddr_t) & ifr) < 0) {
+                extern int      errno;
+                close(s);
+                break;
+            }
+            close(s);
+            ifs6 = &ifr.ifr_ifru.ifru_stat;
+            switch (vp->magic) {
+            case IPV6IFSTATSINRCVS:
+                long_return = ifs6->ifs6_in_receive;
+                break;
+            case IPV6IFSTATSINHDRERRS:
+                long_return = ifs6->ifs6_in_hdrerr;
+                break;
+            case IPV6IFSTATSTOOBIGERRS:
+                long_return = ifs6->ifs6_in_toobig;
+                break;
+            case IPV6IFSTATSINNOROUTES:
+                long_return = ifs6->ifs6_in_noroute;
+                break;
+            case IPV6IFSTATSINADDRERRS:
+                long_return = ifs6->ifs6_in_addrerr;
+                break;
+            case IPV6IFSTATSINUNKNOWPROTS:
+                long_return = ifs6->ifs6_in_protounknown;
+                break;
+            case IPV6IFSTATSINTRUNCATPKTS:
+                long_return = ifs6->ifs6_in_truncated;
+                break;
+            case IPV6IFSTATSINDISCARDS:
+                long_return = ifs6->ifs6_in_discard;
+                break;
+            case IPV6IFSTATSINDELIVERS:
+                long_return = ifs6->ifs6_in_deliver;
+                break;
+            case IPV6IFSTATSOUTFORWDATAS:
+                long_return = ifs6->ifs6_out_forward;
+                break;
+            case IPV6IFSTATSOUTREQS:
+                long_return = ifs6->ifs6_out_request;
+                break;
+            case IPV6IFSTATSOUTDISCARDS:
+                long_return = ifs6->ifs6_out_discard;
+                break;
+            case IPV6IFSTATSOUTFRAGOKS:
+                long_return = ifs6->ifs6_out_fragok;
+                break;
+            case IPV6IFSTATSOUTFRAGFAILS:
+                long_return = ifs6->ifs6_out_fragfail;
+                break;
+            case IPV6IFSTATSOUTFRAGCREATS:
+                long_return = ifs6->ifs6_out_fragcreat;
+                break;
+            case IPV6IFSTATSOUTREASMREQS:
+                long_return = ifs6->ifs6_reass_reqd;
+                break;
+            case IPV6IFSTATSOUTREASMOKS:
+                long_return = ifs6->ifs6_reass_ok;
+                break;
+            case IPV6IFSTATSOUTREASMFAILS:
+                long_return = ifs6->ifs6_reass_fail;
+                break;
+            case IPV6IFSTATSINMCASTPKTS:
+                long_return = ifs6->ifs6_in_mcast;
+                break;
+            case IPV6IFSTATSOUTMCASTPKTS:
+                long_return = ifs6->ifs6_out_mcast;
+                break;
+            default:
+                return NULL;
+            }
+            return (u_char *) & long_return;
+        }
+#endif
+    default:
+        break;
+    }
+    return NULL;
+#endif
+}
+
+u_char         *
+var_icmpv6Entry(register struct variable * vp,
+                oid * name,
+                size_t * length,
+                int exact, size_t * var_len, WriteMethod ** write_method)
+{
+#ifndef HAVE_IF_NAMEINDEX
+    return NULL;
+#else
+    int             interface;
+    int             max;
+    char           *p;
+
+    max = if_maxifindex();
+    if (max < 0)
+        return NULL;
+
+    if (header_ipv6_scan
+        (vp, name, length, exact, var_len, write_method, 1, max)
+        == MATCH_FAILED) {
+        return NULL;
+    }
+    interface = name[*length - 1];
+    DEBUGMSGTL(("mibII/ipv6", "interface: %d(%s)\n",
+                interface, if_getname(interface)));
+    if (interface >= max)
+        return NULL;
+
+    switch (vp->magic) {
+#ifdef SIOCGIFSTAT_ICMP6
+    case IPV6IFICMPINMSG:
+    case IPV6IFICMPINERRORS:
+    case IPV6IFICMPINDSTUNRCHS:
+    case IPV6IFICMPINADMPROHS:
+    case IPV6IFICMPINTIMEXCDS:
+    case IPV6IFICMPINPARMPROBS:
+    case IPV6IFICMPINPKTTOOBIGS:
+    case IPV6IFICMPINECHOS:
+    case IPV6IFICMPINECHOREPS:
+    case IPV6IFICMPINRTRSLICITS:
+    case IPV6IFICMPINRTRADVS:
+    case IPV6IFICMPINNBRSLICITS:
+    case IPV6IFICMPINNBRADVS:
+    case IPV6IFICMPINREDIRECTS:
+    case IPV6IFICMPINGRPMEQERYS:
+    case IPV6IFICMPINGRPMERSPS:
+    case IPV6IFICMPINGRPMEREDCS:
+    case IPV6IFICMPOUTMSG:
+    case IPV6IFICMPOUTERRORS:
+    case IPV6IFICMPOUTDSTUNRCHS:
+    case IPV6IFICMPOUTADMPROHS:
+    case IPV6IFICMPOUTTIMEXCDS:
+    case IPV6IFICMPOUTPARMPROBS:
+    case IPV6IFICMPOUTPKTTOOBIGS:
+    case IPV6IFICMPOUTECHOS:
+    case IPV6IFICMPOUTECHOREPS:
+    case IPV6IFICMPOUTRTRSLICITS:
+    case IPV6IFICMPOUTRTRADVS:
+    case IPV6IFICMPOUTNBRSLICITS:
+    case IPV6IFICMPOUTNBRADVS:
+    case IPV6IFICMPOUTREDIRECTS:
+    case IPV6IFICMPOUTGRPMEQERYS:
+    case IPV6IFICMPOUTGRPMERSPS:
+    case IPV6IFICMPOUTGRPMEREDCS:
+        {
+            struct icmp6_ifstat *ifs6;
+            struct in6_ifreq ifr;
+            int             s;
+
+            memset(&ifr, 0, sizeof(ifr));
+            strncpy(ifr.ifr_name, if_getname(interface),
+                    sizeof(ifr.ifr_name));
+            if ((s = socket(AF_INET6, SOCK_DGRAM, 0)) < 0)
+                break;
+            if (ioctl(s, SIOCGIFSTAT_ICMP6, (caddr_t) & ifr) < 0) {
+                extern int      errno;
+                close(s);
+                break;
+            }
+            close(s);
+            ifs6 = &ifr.ifr_ifru.ifru_icmp6stat;
+            switch (vp->magic) {
+            case IPV6IFICMPINMSG:
+                long_return = ifs6->ifs6_in_msg;
+                break;
+            case IPV6IFICMPINERRORS:
+                long_return = ifs6->ifs6_in_error;
+                break;
+            case IPV6IFICMPINDSTUNRCHS:
+                long_return = ifs6->ifs6_in_dstunreach;
+                break;
+            case IPV6IFICMPINADMPROHS:
+                long_return = ifs6->ifs6_in_adminprohib;
+                break;
+            case IPV6IFICMPINTIMEXCDS:
+                long_return = ifs6->ifs6_in_timeexceed;
+                break;
+            case IPV6IFICMPINPARMPROBS:
+                long_return = ifs6->ifs6_in_paramprob;
+                break;
+            case IPV6IFICMPINPKTTOOBIGS:
+                long_return = ifs6->ifs6_in_pkttoobig;
+                break;
+            case IPV6IFICMPINECHOS:
+                long_return = ifs6->ifs6_in_echo;
+                break;
+            case IPV6IFICMPINECHOREPS:
+                long_return = ifs6->ifs6_in_echoreply;
+                break;
+            case IPV6IFICMPINRTRSLICITS:
+                long_return = ifs6->ifs6_in_routersolicit;
+                break;
+            case IPV6IFICMPINRTRADVS:
+                long_return = ifs6->ifs6_in_routeradvert;
+                break;
+            case IPV6IFICMPINNBRSLICITS:
+                long_return = ifs6->ifs6_in_neighborsolicit;
+                break;
+            case IPV6IFICMPINNBRADVS:
+                long_return = ifs6->ifs6_in_neighboradvert;
+                break;
+            case IPV6IFICMPINREDIRECTS:
+                long_return = ifs6->ifs6_in_redirect;
+                break;
+            case IPV6IFICMPINGRPMEQERYS:
+                long_return = ifs6->ifs6_in_mldquery;
+                break;
+            case IPV6IFICMPINGRPMERSPS:
+                long_return = ifs6->ifs6_in_mldreport;
+                break;
+            case IPV6IFICMPINGRPMEREDCS:
+                long_return = ifs6->ifs6_in_mlddone;
+                break;
+            case IPV6IFICMPOUTMSG:
+                long_return = ifs6->ifs6_out_msg;
+                break;
+            case IPV6IFICMPOUTERRORS:
+                long_return = ifs6->ifs6_out_error;
+                break;
+            case IPV6IFICMPOUTDSTUNRCHS:
+                long_return = ifs6->ifs6_out_dstunreach;
+                break;
+            case IPV6IFICMPOUTADMPROHS:
+                long_return = ifs6->ifs6_out_adminprohib;
+                break;
+            case IPV6IFICMPOUTTIMEXCDS:
+                long_return = ifs6->ifs6_out_timeexceed;
+                break;
+            case IPV6IFICMPOUTPARMPROBS:
+                long_return = ifs6->ifs6_out_paramprob;
+                break;
+            case IPV6IFICMPOUTPKTTOOBIGS:
+                long_return = ifs6->ifs6_out_pkttoobig;
+                break;
+            case IPV6IFICMPOUTECHOS:
+                long_return = ifs6->ifs6_out_echo;
+                break;
+            case IPV6IFICMPOUTECHOREPS:
+                long_return = ifs6->ifs6_out_echoreply;
+                break;
+            case IPV6IFICMPOUTRTRSLICITS:
+                long_return = ifs6->ifs6_out_routersolicit;
+                break;
+            case IPV6IFICMPOUTRTRADVS:
+                long_return = ifs6->ifs6_out_routeradvert;
+                break;
+            case IPV6IFICMPOUTNBRSLICITS:
+                long_return = ifs6->ifs6_out_neighborsolicit;
+                break;
+            case IPV6IFICMPOUTNBRADVS:
+                long_return = ifs6->ifs6_out_neighboradvert;
+                break;
+            case IPV6IFICMPOUTREDIRECTS:
+                long_return = ifs6->ifs6_out_redirect;
+                break;
+            case IPV6IFICMPOUTGRPMEQERYS:
+                long_return = ifs6->ifs6_out_mldquery;
+                break;
+            case IPV6IFICMPOUTGRPMERSPS:
+                long_return = ifs6->ifs6_out_mldreport;
+                break;
+            case IPV6IFICMPOUTGRPMEREDCS:
+                long_return = ifs6->ifs6_out_mlddone;
+                break;
+            default:
+                return NULL;
+            }
+            return (u_char *) & long_return;
+        }
+#endif
+    default:
+        break;
+    }
+    return NULL;
+#endif
+}
+
+u_char         *
+var_udp6(register struct variable * vp,
+         oid * name,
+         size_t * length,
+         int exact, size_t * var_len, WriteMethod ** write_method)
+{
+    oid             newname[MAX_OID_LEN];
+    oid             tmp1[MAX_OID_LEN], tmp2[MAX_OID_LEN];
+    int             result;
+    int             i, j;
+    caddr_t         p;
+    static struct in6pcb in6pcb, udb6;
+    int             found, hitnext;
+#if defined(__FreeBSD__) && __FreeBSD__ >= 3
+    char           *sysctl_buf;
+    struct xinpgen *xig, *oxig;
+#endif                          /* defined(__FreeBSD__) && __FreeBSD__ >= 3 */
+
+    DEBUGMSGTL(("mibII/ipv6", "var_udp6: "));
+    DEBUGMSGOID(("mibII/ipv6", name, *length));
+    DEBUGMSG(("mibII/ipv6", " %d\n", exact));
+
+#if !(defined(__FreeBSD__) && __FreeBSD__ >= 3)
+    if (!auto_nlist("udb6", (char *) &udb6, sizeof(udb6)))
+        return NULL;
+    p = (caddr_t) udb6.in6p_next;
+#else
+    {
+        const char     *udblist = "net.inet.udp.pcblist";
+        int             len;
+
+        if (sysctlbyname(udblist, 0, &len, 0, 0) < 0)
+            return NULL;
+        if ((sysctl_buf = malloc(len)) == NULL)
+            return NULL;
+        if (sysctlbyname(udblist, sysctl_buf, &len, 0, 0) < 0) {
+            free(sysctl_buf);
+            return NULL;
+        }
+        oxig = (struct xinpgen *) sysctl_buf;
+        xig = (struct xinpgen *) ((char *) oxig + oxig->xig_len);
+    }
+#endif
+    found = hitnext = 0;
+    memcpy((char *) newname, (char *) vp->name,
+           (int) vp->namelen * sizeof(oid));
+    DEBUGMSGTL(("mibII/ipv6", "start: p=%x\n", p));
+    while (
+#if !(defined(__FreeBSD__) && __FreeBSD__ >= 3)
+              p && (u_long) p != auto_nlist_value("udb6")
+#else
+              xig->xig_len > sizeof(struct xinpgen)
+#endif
+        ) {
+        DEBUGMSGTL(("mibII/ipv6", "looping: p=%x\n", p));
+
+#if !(defined(__FreeBSD__) && __FreeBSD__ >= 3)
+        klookup((u_long) p, (char *) &in6pcb, sizeof(in6pcb));
+#else
+        in6pcb = ((struct xinpcb *) xig)->xi_inp;
+#endif
+        j = (int) vp->namelen;
+        for (i = 0; i < sizeof(struct in6_addr); i++)
+            newname[j++] = in6pcb.in6p_laddr.s6_addr[i];
+        newname[j++] = ntohs(in6pcb.in6p_lport);
+        if (IN6_IS_ADDR_LINKLOCAL(&in6pcb.in6p_laddr))
+            newname[j++] =
+                ntohs(*(u_int16_t *) & in6pcb.in6p_laddr.s6_addr[2]);
+        else
+            newname[j++] = 0;
+        /*XXX*/
+            DEBUGMSGTL(("mibII/ipv6", "var_udp6 new: %d %d ",
+                        (int) vp->namelen, j));
+        DEBUGMSGOID(("mibII/ipv6", newname, j));
+        DEBUGMSG(("mibII/ipv6", " %d\n", exact));
+
+        if (exact) {
+            result = snmp_oid_compare(name, *length, newname, j);
+            if (result == 0) {
+                found++;
+                break;
+            }
+        } else {
+            /*
+             * tcb entries may not be ordered as SNMP scanning code expect.
+             * Therefore, we'll do a guess...
+             * 1. "name" has the previously matched entry.
+             *    If "name" is UDP6 MIBs, take the item that is right next
+             *    to the item exactly matches to "name".
+             * 2. Otherwise, it is the very first time we entered to UDP6 MIBs.
+             */
+            memcpy(tmp1, name, vp->namelen * sizeof(oid));
+            memcpy(tmp2, newname, vp->namelen * sizeof(oid));
+            tmp1[vp->namelen] = 0;
+            tmp2[vp->namelen] = 0;
+            if (*length == j
+                && snmp_oid_compare(tmp1, vp->namelen, tmp2,
+                                    vp->namelen) == 0) {
+                if (!hitnext) {
+                    result = snmp_oid_compare(name, *length, newname, j);
+                    if (result == 0)
+                        hitnext++;
+                } else {
+                    found++;
+                    break;
+                }
+            } else {
+                if (snmp_oid_compare(name, *length, newname, j) < 0) {
+                    found++;
+                    break;
+                }
+            }
+        }
+#if !(defined(__FreeBSD__) && __FreeBSD__ >= 3)
+        p = (caddr_t) in6pcb.in6p_next;
+#else
+        xig = (struct xinpgen *) ((char *) xig + xig->xig_len);
+#endif
+    }
+#if defined(__FreeBSD__) && __FreeBSD__ >= 3
+    free(sysctl_buf);
+#endif                          /* defined(__FreeBSD__) && __FreeBSD__ >= 3 */
+    if (!found)
+        return NULL;
+    *length = j;
+    memcpy((char *) name, (char *) newname, *length * sizeof(oid));
+    *write_method = 0;
+    *var_len = sizeof(long);    /* default to 'long' results */
+
+
+    /*
+     * try looking into the kernel variable 
+     */
+    switch (vp->magic) {
+    case IPV6UDPLOCALADDRESS:
+        *var_len = sizeof(struct in6_addr);
+        return in6pcb.in6p_laddr.s6_addr;
+    case IPV6UDPLOCALPORT:
+        long_return = ntohs(in6pcb.in6p_lport);
+        return (u_char *) & long_return;
+    case IPV6UDPIFINDEX:
+        if (IN6_IS_ADDR_LINKLOCAL(&in6pcb.in6p_laddr))
+            long_return =
+                ntohs(*(u_int16_t *) & in6pcb.in6p_laddr.s6_addr[2]);
+        else
+            long_return = 0;
+        /*XXX*/ return (u_char *) & long_return;
+    default:
+        break;
+    }
+    ERROR_MSG("");
+    return NULL;
+}
+
+#ifdef TCP6
+u_char         *
+var_tcp6(register struct variable * vp,
+         oid * name,
+         size_t * length,
+         int exact, size_t * var_len, WriteMethod ** write_method)
+{
+    oid             newname[MAX_OID_LEN];
+    oid             tmp1[MAX_OID_LEN], tmp2[MAX_OID_LEN];
+    int             result;
+    int             i, j;
+    caddr_t         p;
+    static struct in6pcb in6pcb, tcb6;
+    struct tcp6cb   tcp6cb;
+    int             found, hitnext;
+    static int      tcp6statemap[TCP6_NSTATES];
+    static int      initialized = 0;
+#if defined(__FreeBSD__) && __FreeBSD__ >= 3
+    char           *sysctl_buf;
+    struct xinpgen *xig, *oxig;
+#endif                          /* defined(__FreeBSD__) && __FreeBSD__ >= 3 */
+
+    if (!initialized) {
+        tcp6statemap[TCP6S_CLOSED] = 1;
+        tcp6statemap[TCP6S_LISTEN] = 2;
+        tcp6statemap[TCP6S_SYN_SENT] = 3;
+        tcp6statemap[TCP6S_SYN_RECEIVED] = 4;
+        tcp6statemap[TCP6S_ESTABLISHED] = 5;
+        tcp6statemap[TCP6S_CLOSE_WAIT] = 8;
+        tcp6statemap[TCP6S_FIN_WAIT_1] = 6;
+        tcp6statemap[TCP6S_CLOSING] = 10;
+        tcp6statemap[TCP6S_LAST_ACK] = 9;
+        tcp6statemap[TCP6S_FIN_WAIT_2] = 7;
+        tcp6statemap[TCP6S_TIME_WAIT] = 11;
+        initialized++;
+    }
+
+    DEBUGMSGTL(("mibII/ipv6", "var_tcp6: "));
+    DEBUGMSGOID(("mibII/ipv6", name, *length));
+    DEBUGMSG(("mibII/ipv6", " %d\n", exact));
+
+#if !(defined(__FreeBSD__) && __FreeBSD__ >= 3)
+    if (!auto_nlist("tcb6", (char *) &tcb6, sizeof(tcb6)))
+        return NULL;
+    p = (caddr_t) tcb6.in6p_next;
+#else
+    {
+        const char     *tcblist = "net.inet.tcp.pcblist";
+        int             len;
+
+        if (sysctlbyname(tcblist, 0, &len, 0, 0) < 0)
+            return NULL;
+        if ((sysctl_buf = malloc(len)) == NULL)
+            return NULL;
+        if (sysctlbyname(tcblist, sysctl_buf, &len, 0, 0) < 0) {
+            free(sysctl_buf);
+            return NULL;
+        }
+        oxig = (struct xinpgen *) sysctl_buf;
+        xig = (struct xinpgen *) ((char *) oxig + oxig->xig_len);
+    }
+#endif
+
+    found = hitnext = 0;
+    memcpy((char *) newname, (char *) vp->name,
+           (int) vp->namelen * sizeof(oid));
+    while (
+#if !(defined(__FreeBSD__) && __FreeBSD__ >= 3)
+              p && (u_long) p != auto_nlist_value("tcb6")
+#else
+              xig->xig_len > sizeof(struct xinpgen)
+#endif
+        ) {
+        DEBUGMSGTL(("mibII/ipv6", "looping: p=%x\n", p));
+
+#if !(defined(__FreeBSD__) && __FreeBSD__ >= 3)
+        if (klookup((u_long) p, (char *) &in6pcb, sizeof(in6pcb)) < 0) {
+            DEBUGMSGTL(("mibII/ipv6", "klookup fail for in6pcb at %x\n",
+                        p));
+            break;
+        }
+#else
+        in6pcb = ((struct xinpcb *) xig)->xi_inp;
+#endif
+        if (klookup
+            ((u_long) in6pcb.in6p_ppcb, (char *) &tcp6cb, sizeof(tcp6cb))
+            < 0) {
+            DEBUGMSGTL(("mibII/ipv6", "klookup fail for tcp6cb at %x\n",
+                        in6pcb.in6p_ppcb));
+            break;
+        }
+        j = (int) vp->namelen;
+        for (i = 0; i < sizeof(struct in6_addr); i++)
+            newname[j++] = in6pcb.in6p_laddr.s6_addr[i];
+        newname[j++] = ntohs(in6pcb.in6p_lport);
+        for (i = 0; i < sizeof(struct in6_addr); i++)
+            newname[j++] = in6pcb.in6p_faddr.s6_addr[i];
+        newname[j++] = ntohs(in6pcb.in6p_fport);
+        if (IN6_IS_ADDR_LINKLOCAL(&in6pcb.in6p_laddr))
+            newname[j++] =
+                ntohs(*(u_int16_t *) & in6pcb.in6p_laddr.s6_addr[2]);
+        else
+            newname[j++] = 0;
+        /*XXX*/ newname[j++] = tcp6statemap[tcp6cb.t_state];
+
+        DEBUGMSGTL(("mibII/ipv6", "var_tcp6 newname: "));
+        DEBUGMSGOID(("mibII/ipv6", newname, *length));
+        DEBUGMSG(("mibII/ipv6", "\nvar_tcp6 oldname: "));
+        DEBUGMSGOID(("mibII/ipv6", name, *length));
+        DEBUGMSG(("mibII/ipv6", " %d\n", exact));
+
+#if 1                           /* this is very odd but sometimes happen, and cause infinite loop */
+        if (ntohs(in6pcb.in6p_lport) == 0)
+            goto skip;
+#endif
+        if (exact) {
+            result = snmp_oid_compare(name, *length, newname, j);
+            if (result == 0) {
+                found++;
+                break;
+            }
+        } else {
+            /*
+             * tcb entries may not be ordered as SNMP scanning code expect.
+             * Therefore, we'll do a guess...
+             * 1. "name" has the previously matched entry.
+             *    If "name" is TCP6 MIBs, take the item that is right next
+             *    to the item exactly matches to "name".
+             * 2. Otherwise, it is the very first time we entered to TCP6 MIBs.
+             */
+            memcpy(tmp1, name, vp->namelen * sizeof(oid));
+            memcpy(tmp2, newname, vp->namelen * sizeof(oid));
+            tmp1[vp->namelen] = 0;
+            tmp2[vp->namelen] = 0;
+            if (*length == j
+                && snmp_oid_compare(tmp1, vp->namelen, tmp2,
+                                    vp->namelen) == 0) {
+                if (!hitnext) {
+                    result = snmp_oid_compare(name, *length, newname, j);
+                    if (result == 0)
+                        hitnext++;
+                } else {
+                    found++;
+                    break;
+                }
+            } else {
+                if (snmp_oid_compare(name, *length, newname, j) < 0) {
+                    found++;
+                    break;
+                }
+            }
+        }
+
+      skip:
+#if !(defined(__FreeBSD__) && __FreeBSD__ >= 3)
+        p = (caddr_t) in6pcb.in6p_next;
+#else
+        xig = (struct xinpgen *) ((char *) xig + xig->xig_len);
+#endif
+    }
+#if defined(__FreeBSD__) && __FreeBSD__ >= 3
+    free(sysctl_buf);
+#endif
+    DEBUGMSGTL(("mibII/ipv6", "found=%d\n", found));
+    if (!found)
+        return NULL;
+    *length = j;
+    memcpy((char *) name, (char *) newname, *length * sizeof(oid));
+    *write_method = 0;
+    *var_len = sizeof(long);    /* default to 'long' results */
+
+    /*
+     * try looking into the kernel variable 
+     */
+    DEBUGMSGTL(("mibII/ipv6", "magic=%d\n", vp->magic));
+    switch (vp->magic) {
+    case IPV6TCPLOCALADDR:
+        *var_len = sizeof(struct in6_addr);
+        return (u_char *) & in6pcb.in6p_laddr.s6_addr[0];
+    case IPV6TCPLOCALPORT:
+        long_return = ntohs(in6pcb.in6p_lport);
+        return (u_char *) & long_return;
+    case IPV6TCPREMOTEADDR:
+        *var_len = sizeof(struct in6_addr);
+        return (u_char *) & in6pcb.in6p_faddr.s6_addr[0];
+    case IPV6TCPREMOTEPORT:
+        long_return = ntohs(in6pcb.in6p_fport);
+        return (u_char *) & long_return;
+    case IPV6TCPIFINDEX:
+        if (IN6_IS_ADDR_LINKLOCAL(&in6pcb.in6p_laddr))
+            long_return =
+                ntohs(*(u_int16_t *) & in6pcb.in6p_laddr.s6_addr[2]);
+        else
+            long_return = 0;
+        /*XXX*/ return (u_char *) & long_return;
+    case IPV6TCPCONNSTATE:
+        long_return = tcp6statemap[tcp6cb.t_state];
+        return (u_char *) & long_return;
+    default:
+        break;
+    }
+    ERROR_MSG("");
+    return NULL;
+}
+#else
+u_char         *
+var_tcp6(register struct variable * vp,
+         oid * name,
+         size_t * length,
+         int exact, size_t * var_len, WriteMethod ** write_method)
+{
+    oid             newname[MAX_OID_LEN];
+    oid             tmp1[MAX_OID_LEN], tmp2[MAX_OID_LEN];
+    int             result;
+    int             i, j;
+    caddr_t         p;
+    static struct in6pcb in6pcb, tcb6;
+    struct tcpcb    tcpcb;
+    int             found, hitnext;
+    static int      tcpstatemap[TCP_NSTATES];
+    static int      initialized = 0;
+#if defined(__FreeBSD__) && __FreeBSD__ >= 3
+    char           *sysctl_buf;
+    struct xinpgen *xig, *oxig;
+#endif                          /* defined(__FreeBSD__) && __FreeBSD__ >= 3 */
+
+    if (!initialized) {
+        tcpstatemap[TCPS_CLOSED] = 1;
+        tcpstatemap[TCPS_LISTEN] = 2;
+        tcpstatemap[TCPS_SYN_SENT] = 3;
+        tcpstatemap[TCPS_SYN_RECEIVED] = 4;
+        tcpstatemap[TCPS_ESTABLISHED] = 5;
+        tcpstatemap[TCPS_CLOSE_WAIT] = 8;
+        tcpstatemap[TCPS_FIN_WAIT_1] = 6;
+        tcpstatemap[TCPS_CLOSING] = 10;
+        tcpstatemap[TCPS_LAST_ACK] = 9;
+        tcpstatemap[TCPS_FIN_WAIT_2] = 7;
+        tcpstatemap[TCPS_TIME_WAIT] = 11;
+        initialized++;
+    }
+
+    DEBUGMSGTL(("mibII/ipv6", "var_tcp6: "));
+    DEBUGMSGOID(("mibII/ipv6", name, *length));
+    DEBUGMSG(("mibII/ipv6", " %d\n", exact));
+
+#if !(defined(__FreeBSD__) && __FreeBSD__ >= 3)
+    if (!auto_nlist("tcb6", (char *) &tcb6, sizeof(tcb6)))
+        return NULL;
+    p = (caddr_t) tcb6.in6p_next;
+#else
+    {
+        const char     *tcblist = "net.inet.tcp.pcblist";
+        int             len;
+
+        if (sysctlbyname(tcblist, 0, &len, 0, 0) < 0)
+            return NULL;
+        if ((sysctl_buf = malloc(len)) == NULL)
+            return NULL;
+        if (sysctlbyname(tcblist, sysctl_buf, &len, 0, 0) < 0) {
+            free(sysctl_buf);
+            return NULL;
+        }
+        oxig = (struct xinpgen *) sysctl_buf;
+        xig = (struct xinpgen *) ((char *) oxig + oxig->xig_len);
+    }
+#endif
+
+    found = hitnext = 0;
+    memcpy((char *) newname, (char *) vp->name,
+           (int) vp->namelen * sizeof(oid));
+    while (
+#if !(defined(__FreeBSD__) && __FreeBSD__ >= 3)
+              p && (u_long) p != auto_nlist_value("tcb6")
+#else
+              xig->xig_len > sizeof(struct xinpgen)
+#endif
+        ) {
+        DEBUGMSGTL(("mibII/ipv6", "looping: p=%x\n", p));
+
+#if !(defined(__FreeBSD__) && __FreeBSD__ >= 3)
+        if (klookup((u_long) p, (char *) &in6pcb, sizeof(in6pcb)) < 0)
+#else
+        in6pcb = ((struct xinpcb *) xig)->xi_inp;
+#endif
+        {
+            DEBUGMSGTL(("mibII/ipv6", "klookup fail for in6pcb at %x\n",
+                        p));
+            break;
+        }
+        if (klookup
+            ((u_long) in6pcb.in6p_ppcb, (char *) &tcpcb, sizeof(tcpcb))
+            < 0) {
+            DEBUGMSGTL(("mibII/ipv6", "klookup fail for tcpcb at %x\n",
+                        in6pcb.in6p_ppcb));
+            break;
+        }
+        j = (int) vp->namelen;
+        for (i = 0; i < sizeof(struct in6_addr); i++)
+            newname[j++] = in6pcb.in6p_laddr.s6_addr[i];
+        newname[j++] = ntohs(in6pcb.in6p_lport);
+        for (i = 0; i < sizeof(struct in6_addr); i++)
+            newname[j++] = in6pcb.in6p_faddr.s6_addr[i];
+        newname[j++] = ntohs(in6pcb.in6p_fport);
+        if (IN6_IS_ADDR_LINKLOCAL(&in6pcb.in6p_laddr))
+            newname[j++] =
+                ntohs(*(u_int16_t *) & in6pcb.in6p_laddr.s6_addr[2]);
+        else
+            newname[j++] = 0;
+        /*XXX*/ newname[j++] = tcpstatemap[tcpcb.t_state];
+
+        DEBUGMSGTL(("mibII/ipv6", "var_tcp6 newname: "));
+        DEBUGMSGOID(("mibII/ipv6", newname, *length));
+        DEBUGMSG(("mibII/ipv6", "\nvar_tcp6 oldname: "));
+        DEBUGMSGOID(("mibII/ipv6", name, *length));
+        DEBUGMSG(("mibII/ipv6", " %d\n", exact));
+
+#if 1                           /* this is very odd but sometimes happen, and cause infinite loop */
+        if (ntohs(in6pcb.in6p_lport) == 0)
+            goto skip;
+#endif
+        if (exact) {
+            result = snmp_oid_compare(name, *length, newname, j);
+            if (result == 0) {
+                found++;
+                break;
+            }
+        } else {
+            /*
+             * tcb entries may not be ordered as SNMP scanning code expect.
+             * Therefore, we'll do a guess...
+             * 1. "name" has the previously matched entry.
+             *    If "name" is TCP6 MIBs, take the item that is right next
+             *    to the item exactly matches to "name".
+             * 2. Otherwise, it is the very first time we entered to TCP6 MIBs.
+             */
+            memcpy(tmp1, name, vp->namelen * sizeof(oid));
+            memcpy(tmp2, newname, vp->namelen * sizeof(oid));
+            tmp1[vp->namelen] = 0;
+            tmp2[vp->namelen] = 0;
+            if (*length == j
+                && snmp_oid_compare(tmp1, vp->namelen, tmp2,
+                                    vp->namelen) == 0) {
+                if (!hitnext) {
+                    result = snmp_oid_compare(name, *length, newname, j);
+                    if (result == 0)
+                        hitnext++;
+                } else {
+                    found++;
+                    break;
+                }
+            } else {
+                if (snmp_oid_compare(name, *length, newname, j) < 0) {
+                    found++;
+                    break;
+                }
+            }
+        }
+
+      skip:
+#if !(defined(__FreeBSD__) && __FreeBSD__ >= 3)
+        p = (caddr_t) in6pcb.in6p_next;
+#else
+        xig = (struct xinpgen *) ((char *) xig + xig->xig_len);
+#endif
+    }
+    DEBUGMSGTL(("mibII/ipv6", "found=%d\n", found));
+    if (!found)
+        return NULL;
+    *length = j;
+    memcpy((char *) name, (char *) newname, *length * sizeof(oid));
+    *write_method = 0;
+    *var_len = sizeof(long);    /* default to 'long' results */
+
+    /*
+     * try looking into the kernel variable 
+     */
+    DEBUGMSGTL(("mibII/ipv6", "magic=%d\n", vp->magic));
+    switch (vp->magic) {
+    case IPV6TCPLOCALADDR:
+        *var_len = sizeof(struct in6_addr);
+        return (u_char *) & in6pcb.in6p_laddr.s6_addr[0];
+    case IPV6TCPLOCALPORT:
+        long_return = ntohs(in6pcb.in6p_lport);
+        return (u_char *) & long_return;
+    case IPV6TCPREMOTEADDR:
+        *var_len = sizeof(struct in6_addr);
+        return (u_char *) & in6pcb.in6p_faddr.s6_addr[0];
+    case IPV6TCPREMOTEPORT:
+        long_return = ntohs(in6pcb.in6p_fport);
+        return (u_char *) & long_return;
+    case IPV6TCPIFINDEX:
+        if (IN6_IS_ADDR_LINKLOCAL(&in6pcb.in6p_laddr))
+            long_return =
+                ntohs(*(u_int16_t *) & in6pcb.in6p_laddr.s6_addr[2]);
+        else
+            long_return = 0;
+        /*XXX*/ return (u_char *) & long_return;
+    case IPV6TCPCONNSTATE:
+        long_return = tcpstatemap[tcpcb.t_state];
+        return (u_char *) & long_return;
+    default:
+        break;
+    }
+    ERROR_MSG("");
+    return NULL;
+}
+
+#endif                          /*TCP6 */
+
+#else                           /* !linux / linux */
+
+/*
+ * Linux dependent part 
+ */
+static unsigned long
+linux_read_ip6_stat_ulong(const char *file)
+{
+    FILE           *f;
+    unsigned long   value;
+    f = fopen(file, "r");
+    if (!f)
+        return 0;
+    if (fscanf(f, "%lu", &value) != 1) {
+        fclose(f);
+        return 0;
+    }
+    fclose(f);
+    return value;
+}
+
+void
+linux_read_ip6_stat(struct ip6_mib *ip6stat)
+{
+    if (!ip6stat)
+        return;
+    memset(ip6stat, 0, sizeof(*ip6stat));
+    ip6stat->Ipv6Forwarding =
+        linux_read_ip6_stat_ulong
+        ("/proc/sys/net/ipv6/conf/all/forwarding");
+    ip6stat->Ipv6DefaultHopLimit =
+        linux_read_ip6_stat_ulong
+        ("/proc/sys/net/ipv6/conf/default/hop_limit");
+}
+
+u_char         *
+var_ipv6(register struct variable *vp,
+         oid * name,
+         size_t * length,
+         int exact, size_t * var_len, WriteMethod ** write_method)
+{
+    int             i;
+    static struct ip6_mib ip6stat;
+
+    if (header_ipv6(vp, name, length, exact, var_len, write_method)
+        == MATCH_FAILED) {
+        return NULL;
+    }
+    linux_read_ip6_stat(&ip6stat);
+
+    switch (vp->magic) {
+    case IPV6DEFAULTHOPLIMIT:
+        return (u_char *) & ip6stat.Ipv6DefaultHopLimit;
+    case IPV6FORWARDING:
+        return (u_char *) & ip6stat.Ipv6Forwarding;
+    case IPV6INTERFACES:
+#ifdef HAVE_IF_NAMEINDEX
+        long_return = if_countifindex();
+        if (long_return < 0)
+            break;
+        return (u_char *) & long_return;
+#endif
+        break;
+    default:
+        DEBUGMSGTL(("snmpd", "unknonw sub-id %d in var_ipv6\n",
+                    vp->magic));
+    }
+    return NULL;
+}
+
+u_char         *
+var_ifv6Entry(register struct variable * vp,
+              oid * name,
+              size_t * length,
+              int exact, size_t * var_len, WriteMethod ** write_method)
+{
+#ifndef HAVE_IF_NAMEINDEX
+    return NULL;
+#else
+    int             interface;
+    int             max;
+    char           *p;
+    struct ifreq    ifr;
+    int             s;
+
+    max = if_maxifindex();
+    if (max < 0)
+        return NULL;
+
+    if (header_ipv6_scan
+        (vp, name, length, exact, var_len, write_method, 1, max)
+        == MATCH_FAILED) {
+        return NULL;
+    }
+    interface = name[*length - 1];
+    DEBUGMSGTL(("mibII/ipv6", "interface: %d(%s)\n",
+                interface, if_getname(interface)));
+    if (interface > max)
+        return NULL;
+
+    switch (vp->magic) {
+    case IPV6IFDESCR:
+        p = if_getname(interface);
+        if (p) {
+            *var_len = strlen(p);
+            return p;
+        }
+        break;
+    case IPV6IFLOWLAYER:
+        /*
+         * should check if type, this is a hard one... 
+         */
+        *var_len = nullOidLen;
+        return (u_char *) nullOid;
+    case IPV6IFEFFECTMTU:
+        {
+            p = if_getname(interface);
+            if (!p)
+                break;
+            memset(&ifr, 0, sizeof(ifr));
+            ifr.ifr_addr.sa_family = AF_INET6;
+            strncpy(ifr.ifr_name, p, sizeof(ifr.ifr_name));
+            if ((s = socket(ifr.ifr_addr.sa_family, SOCK_DGRAM, 0)) < 0)
+                break;
+            if (ioctl(s, SIOCGIFMTU, (caddr_t) & ifr) < 0) {
+                close(s);
+                break;
+            }
+            long_return = ifr.ifr_mtu;
+            close(s);
+            return (u_char *) & long_return;
+        }
+    case IPV6IFPHYSADDRESS:
+        {
+            static struct ifreq buf;
+            int             ok = 0;
+            p = if_getname(interface);
+            if (!p)
+                break;
+            memset(&ifr, 0, sizeof(ifr));
+            ifr.ifr_addr.sa_family = AF_INET6;
+            strncpy(ifr.ifr_name, p, sizeof(ifr.ifr_name));
+            if ((s = socket(ifr.ifr_addr.sa_family, SOCK_DGRAM, 0)) < 0)
+                break;
+            if (ioctl(s, SIOCGIFHWADDR, &ifr) < 0) {
+                memset(buf.ifr_hwaddr.sa_data, 0,
+                       sizeof(buf.ifr_hwaddr.sa_data));
+                *var_len = 0;
+            } else {
+                memcpy(buf.ifr_hwaddr.sa_data, ifr.ifr_hwaddr.sa_data, 6);
+                *var_len = (buf.ifr_hwaddr.sa_data[0] |
+                            buf.ifr_hwaddr.sa_data[1] |
+                            buf.ifr_hwaddr.sa_data[2] |
+                            buf.ifr_hwaddr.sa_data[3] |
+                            buf.ifr_hwaddr.sa_data[4] |
+                            buf.ifr_hwaddr.sa_data[5]) ? 6 : 0;
+                ok = 1;
+            }
+            close(s);
+            return (ok ? ((u_char *) & buf.ifr_hwaddr.sa_data) : NULL);
+        }
+    case IPV6IFADMSTATUS:
+    case IPV6IFOPERSTATUS:
+        {
+            int             flag = 0;
+            p = if_getname(interface);
+            if (!p)
+                break;
+            memset(&ifr, 0, sizeof(ifr));
+            ifr.ifr_addr.sa_family = AF_INET6;
+            strncpy(ifr.ifr_name, p, sizeof(ifr.ifr_name));
+            if ((s = socket(ifr.ifr_addr.sa_family, SOCK_DGRAM, 0)) < 0)
+                break;
+            if (ioctl(s, SIOCGIFFLAGS, &ifr) < 0) {
+                close(s);
+                break;
+            }
+            switch (vp->magic) {
+            case IPV6IFADMSTATUS:
+                flag = IFF_RUNNING;
+                break;
+            case IPV6IFOPERSTATUS:
+                flag = IFF_UP;
+                break;
+            }
+            long_return = (ifr.ifr_flags & flag) ? 1 : 2;
+            close(s);
+            return (u_char *) & long_return;
+        }
+    }
+    return NULL;
+#endif
+}
+
+u_char         *
+var_icmpv6Entry(register struct variable * vp,
+                oid * name,
+                size_t * length,
+                int exact, size_t * var_len, WriteMethod ** write_method)
+{
+    return NULL;
+}
+
+u_char         *
+var_udp6(register struct variable * vp,
+         oid * name,
+         size_t * length,
+         int exact, size_t * var_len, WriteMethod ** write_method)
+{
+    return NULL;
+}
+
+u_char         *
+var_tcp6(register struct variable * vp,
+         oid * name,
+         size_t * length,
+         int exact, size_t * var_len, WriteMethod ** write_method)
+{
+    return NULL;
+}
+
+/*
+ * misc functions (against broken kernels ) 
+ */
+void
+linux_if_freenameindex(struct if_nameindex *ifndx)
+{
+    int             i;
+    if (!ifndx)
+        return;
+    for (i = 1; ifndx[i].if_index; i++) {
+        free(ifndx[i].if_name);
+    }
+    free(ifndx);
+}
+
+#define linux_freeinternalnameindex(ifni, max)  { \
+  int i; 					\
+  for (i=1; i<=max; i++){			\
+    if (ifni[i].if_name) free(ifni[i].if_name);	\
+  }						\
+  free(ifni);					\
+}
+
+#define LINUX_PROC_NET_IFINET6 "/proc/net/if_inet6"
+struct if_nameindex *
+linux_if_nameindex(void)
+{
+    FILE           *f;
+    unsigned long   if_index;
+    char            if_name[256];
+    struct if_nameindex *ifndx = NULL, *iflist = NULL, *new;
+    int             i, j;
+    int             maxidx, if_count = 0;
+
+    f = fopen(LINUX_PROC_NET_IFINET6, "r");
+    if (f) {
+        if_count = 0;
+        maxidx = -1;
+        while (!feof(f)) {
+            if (fscanf(f, "%*s %lx %*x %*x %*x %s",
+                       &if_index, if_name) != 2)
+                continue;
+            if (if_index == 0)
+                continue;
+            if_name[sizeof(if_name) - 1] = '\0';
+            if (maxidx < 0 || maxidx < if_index) {
+
+                new =
+                    realloc(iflist,
+                            (sizeof(struct if_nameindex)) * (if_index +
+                                                             2));
+                if (!new) {
+                    linux_freeinternalnameindex(iflist, if_index);
+                    if_count = 0;
+                    iflist = NULL;
+                    break;
+                }
+                iflist = new;
+                for (i = maxidx + 1; i <= if_index; i++)
+                    memset(&iflist[i], 0, sizeof(struct if_nameindex));
+                memset(&iflist[if_index + 1], 0,
+                       sizeof(struct if_nameindex));
+                maxidx = if_index;
+            }
+            if (iflist[if_index].if_index == 0) {
+                if_count++;
+                iflist[if_index].if_index = if_index;
+                iflist[if_index].if_name = strdup(if_name);
+                if (!iflist[if_index].if_name) {
+                    linux_freeinternalnameindex(iflist, if_index);
+                    if_count = 0;
+                    iflist = NULL;
+                    break;
+                }
+            }
+        }
+        fclose(f);
+        if (if_count > 0) {
+            ifndx = malloc(sizeof(struct if_nameindex) * (if_count + 1));
+            j = 0;
+            for (i = 1; i <= maxidx; i++) {
+                if (iflist[i].if_index > 0 && *iflist[i].if_name) {
+                    memcpy(&ifndx[j++], &iflist[i],
+                           sizeof(struct if_nameindex));
+                }
+            }
+            ifndx[j].if_index = 0;
+            ifndx[j].if_name = NULL;
+        }
+        free(iflist);
+    }
+    return (ifndx);
+}
+
+#endif                          /* linux */
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/mibII/ipv6.c.ipv6-sock-close tomato121/release/src/router/snmp/agent/mibgroup/mibII/ipv6.c.ipv6-sock-close
--- tomato/release/src/router/snmp/agent/mibgroup/mibII/ipv6.c.ipv6-sock-close	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/mibII/ipv6.c.ipv6-sock-close	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,2092 @@
+/*
+ *  IP MIB group implementation - ipv6.c
+ *
+ */
+
+#include <net-snmp/net-snmp-config.h>
+#if defined(IFNET_NEEDS_KERNEL) && !defined(_KERNEL)
+#define _KERNEL 1
+#define _I_DEFINED_KERNEL
+#endif
+#include <sys/types.h>
+#include <sys/param.h>
+#include <sys/socket.h>
+#if defined(__FreeBSD__) && __FreeBSD__ >= 3
+# if HAVE_SYS_SOCKETVAR_H
+#  include <sys/socketvar.h>
+# endif
+#endif
+
+#if STDC_HEADERS
+#include <string.h>
+#include <stdlib.h>
+#else
+#if HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#endif
+#if HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#if HAVE_SYS_IOCTL_H
+#include <sys/ioctl.h>
+#endif
+#if HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+#if HAVE_SYS_SYSCTL_H
+#ifdef _I_DEFINED_KERNEL
+#undef _KERNEL
+#endif
+#include <sys/sysctl.h>
+#ifdef _I_DEFINED_KERNEL
+#define _KERNEL 1
+#endif
+#endif
+#if HAVE_SYS_SYSMP_H
+#include <sys/sysmp.h>
+#endif
+#if HAVE_SYS_TCPIPSTATS_H
+#include <sys/tcpipstats.h>
+#endif
+#include <net/if.h>
+#if HAVE_NET_IF_VAR_H
+#include <net/if_var.h>
+#endif
+#if HAVE_NET_IF_DL_H
+#include <net/if_dl.h>
+#endif
+#ifdef HAVE_NET_IF_MIB_H
+#include <net/if_mib.h>
+#endif
+#ifdef _I_DEFINED_KERNEL
+#undef _KERNEL
+#endif
+#include <netinet/in_systm.h>
+#if HAVE_SYS_HASHING_H
+#include <sys/hashing.h>
+#endif
+#if HAVE_SYS_SOCKIO_H
+#include <sys/sockio.h>
+#endif
+#if HAVE_NETINET6_IN6_VAR_H
+#include <netinet6/in6_var.h>
+#endif
+#include <netinet/ip6.h>
+#if HAVE_NETINET_IP_VAR_H
+# include <netinet/ip_var.h>
+#endif
+#if HAVE_NETINET6_IP6_VAR_H
+# include <netinet6/ip6_var.h>
+#endif
+#include <net/route.h>
+#if defined(__FreeBSD__) && __FreeBSD__ >= 3
+# if HAVE_NETINET_IN_PCB_H
+#  include <netinet/in_pcb.h>
+# endif
+#endif
+#if HAVE_NETINET6_IN6_PCB_H
+# include <netinet6/in6_pcb.h>
+#endif
+#if HAVE_NETINET6_TCP6_H
+# define TCP6
+#endif
+#ifndef TCP6
+# if HAVE_NETINET_TCP_H
+#  include <netinet/tcp.h>
+# endif
+# if HAVE_NETINET_TCP_TIMER_H
+#  include <netinet/tcp_timer.h>
+# endif
+# if HAVE_NETINET_TCP_VAR_H
+#  include <netinet/tcp_var.h>
+# endif
+# if HAVE_NETINET_TCP_FSM_H
+#  include <netinet/tcp_fsm.h>
+# endif
+#endif
+#if HAVE_NETINET6_TCP6_H
+# include <netinet6/tcp6.h>
+#endif
+#if HAVE_NETINET6_TCP6_TIMER_H
+#include <netinet6/tcp6_timer.h>
+#endif
+#if HAVE_NETINET6_TCP6_VAR_H
+#include <netinet6/tcp6_var.h>
+#endif
+#if HAVE_NETINET6_TCP6_FSM_H
+#include <netinet6/tcp6_fsm.h>
+#endif
+#if HAVE_INET_MIB2_H
+#include <inet/mib2.h>
+#endif
+#ifdef HAVE_SYSLOG_H
+#include <syslog.h>
+#endif
+
+#ifdef MIB_IPCOUNTER_SYMBOL
+#include <sys/mib.h>
+#include <netinet/mib_kern.h>
+#endif                          /* MIB_IPCOUNTER_SYMBOL */
+
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include <net-snmp/agent/auto_nlist.h>
+
+#include "kernel.h"
+#include "util_funcs.h"
+#include "ipv6.h"
+#include "interfaces.h"
+
+static int header_ipv6
+__P((register struct variable *, oid *, size_t *, int, size_t *,
+     WriteMethod **));
+static int header_ipv6_scan
+__P((register struct variable *, oid *, size_t *, int, size_t *,
+     WriteMethod **, int, int));
+static int if_initialize __P((void));
+static int if_maxifindex __P((void));
+static char    *if_getname __P((int));
+static int if_getindex __P((const char *));
+
+struct variable3 ipv6_variables[] = {
+    {IPV6FORWARDING, ASN_INTEGER, RONLY, var_ipv6, 1, {1}},
+    {IPV6DEFAULTHOPLIMIT, ASN_INTEGER, RONLY, var_ipv6, 1, {2}},
+    {IPV6INTERFACES, ASN_GAUGE, RONLY, var_ipv6, 1, {3}},
+    {IPV6IFTBLLASTCHG, ASN_TIMETICKS, RONLY, var_ipv6, 1, {4}},
+
+    {IPV6IFDESCR, ASN_OCTET_STR, RONLY, var_ifv6Entry, 3, {5, 1, 2}},
+    {IPV6IFLOWLAYER, ASN_OBJECT_ID, RONLY, var_ifv6Entry, 3, {5, 1, 3}},
+    {IPV6IFEFFECTMTU, ASN_UNSIGNED, RONLY, var_ifv6Entry, 3, {5, 1, 4}},
+    {IPV6IFREASMMAXSIZE, ASN_UNSIGNED, RONLY, var_ifv6Entry, 3, {5, 1, 5}},
+
+    {IPV6IFTOKEN, ASN_OCTET_STR, RONLY, var_ifv6Entry, 3, {5, 1, 6}},
+    {IPV6IFTOKENLEN, ASN_INTEGER, RONLY, var_ifv6Entry, 3, {5, 1, 7}},
+    {IPV6IFPHYSADDRESS, ASN_OCTET_STR, RONLY, var_ifv6Entry, 3, {5, 1, 8}},
+    {IPV6IFADMSTATUS, ASN_INTEGER, RONLY, var_ifv6Entry, 3, {5, 1, 9}},
+    {IPV6IFOPERSTATUS, ASN_INTEGER, RONLY, var_ifv6Entry, 3, {5, 1, 10}},
+    {IPV6IFLASTCHANGE, ASN_TIMETICKS, RONLY, var_ifv6Entry, 3, {5, 1, 11}},
+
+    {IPV6IFSTATSINRCVS, ASN_COUNTER, RONLY, var_ifv6Entry, 3, {6, 1, 1}},
+    {IPV6IFSTATSINHDRERRS, ASN_COUNTER, RONLY, var_ifv6Entry, 3,
+     {6, 1, 2}},
+    {IPV6IFSTATSTOOBIGERRS, ASN_COUNTER, RONLY, var_ifv6Entry, 3,
+     {6, 1, 3}},
+    {IPV6IFSTATSINNOROUTES, ASN_COUNTER, RONLY, var_ifv6Entry, 3,
+     {6, 1, 4}},
+    {IPV6IFSTATSINADDRERRS, ASN_COUNTER, RONLY, var_ifv6Entry, 3,
+     {6, 1, 5}},
+    {IPV6IFSTATSINUNKNOWPROTS, ASN_COUNTER, RONLY, var_ifv6Entry, 3,
+     {6, 1, 6}},
+    {IPV6IFSTATSINTRUNCATPKTS, ASN_COUNTER, RONLY, var_ifv6Entry, 3,
+     {6, 1, 7}},
+    {IPV6IFSTATSINDISCARDS, ASN_COUNTER, RONLY, var_ifv6Entry, 3,
+     {6, 1, 8}},
+    {IPV6IFSTATSINDELIVERS, ASN_COUNTER, RONLY, var_ifv6Entry, 3,
+     {6, 1, 9}},
+    {IPV6IFSTATSOUTFORWDATAS, ASN_COUNTER, RONLY, var_ifv6Entry, 3,
+     {6, 1, 10}},
+    {IPV6IFSTATSOUTREQS, ASN_COUNTER, RONLY, var_ifv6Entry, 3, {6, 1, 11}},
+    {IPV6IFSTATSOUTDISCARDS, ASN_COUNTER, RONLY, var_ifv6Entry, 3,
+     {6, 1, 12}},
+    {IPV6IFSTATSOUTFRAGOKS, ASN_COUNTER, RONLY, var_ifv6Entry, 3,
+     {6, 1, 13}},
+    {IPV6IFSTATSOUTFRAGFAILS, ASN_COUNTER, RONLY, var_ifv6Entry, 3,
+     {6, 1, 14}},
+    {IPV6IFSTATSOUTFRAGCREATS, ASN_COUNTER, RONLY, var_ifv6Entry, 3,
+     {6, 1, 15}},
+    {IPV6IFSTATSOUTREASMREQS, ASN_COUNTER, RONLY, var_ifv6Entry, 3,
+     {6, 1, 16}},
+    {IPV6IFSTATSOUTREASMOKS, ASN_COUNTER, RONLY, var_ifv6Entry, 3,
+     {6, 1, 17}},
+    {IPV6IFSTATSOUTREASMFAILS, ASN_COUNTER, RONLY, var_ifv6Entry, 3,
+     {6, 1, 18}},
+    {IPV6IFSTATSINMCASTPKTS, ASN_COUNTER, RONLY, var_ifv6Entry, 3,
+     {6, 1, 19}},
+    {IPV6IFSTATSOUTMCASTPKTS, ASN_COUNTER, RONLY, var_ifv6Entry, 3,
+     {6, 1, 20}},
+
+#if 0
+    {IPV6ADDRPREFIXONLINKFLG, INTEGER, RONLY, var_ipv6AddrEntry, 3,
+     {7, 1, 3}},
+    {IPV6ADDRPREFIXAUTONOMOUSFLAG, INTEGER, RONLY, var_ipv6AddrEntry, 3,
+     {7, 1, 4}},
+    {IPV6ADDRPREFIXADVPREFERLIFE, UNSIGNED32, RONLY, var_ipv6AddrEntry, 3,
+     {7, 1, 5}},
+    {IPV6ADDRPREFIXVALIDLIFE, UNSIGNED32, RONLY, var_ipv6AddrEntry, 3,
+     {7, 1, 6}},
+
+    {IPV6ADDRPFXLEN, INTEGER, RONLY, var_ipv6AddrEntry, 3, {8, 1, 2}},
+    {IPV6ADDRTYPE, INTEGER, RONLY, var_ipv6AddrEntry, 3, {8, 1, 3}},
+    {IPV6ADDRANYCASTFLAG, INTEGER, RONLY, var_ipv6AddrEntry, 3, {8, 1, 4}},
+    {IPV6ADDRSTATUS, INTEGER, RONLY, var_ipv6AddrEntry, 3, {8, 1, 5}},
+
+    {IPV6ROUTEIFINDEX, IpV6IFINDEX, RONLY, var_ipv6RouteEntry, 3,
+     {11, 1, 4}},
+    {IPV6ROUTENEXTHOP, IpV6ADDRESS, RONLY, var_ipv6RouteEntry, 3,
+     {11, 1, 5}},
+    {IPV6ROUTETYPE, INTEGER, RONLY, var_ipv6RouteEntry, 3, {11, 1, 6}},
+    {IPV6ROUTEPROTOCOL, INTEGER, RONLY, var_ipv6RouteEntry, 3, {11, 1, 7}},
+    {IPV6ROUTEPOLICY, UNSIGNED32, RONLY, var_ipv6RouteEntry, 3,
+     {11, 1, 8}},
+    {IPV6ROUTEAGE, UNSIGNED32, RONLY, var_ipv6RouteEntry, 3, {11, 1, 9}},
+    {IPV6ROUTENEXTHOPRDI, UNSIGNED32, RONLY, var_ipv6RouteEntry, 3,
+     {11, 1, 10}},
+    {IPV6ROUTEMETRIC, UNSIGNED32, RONLY, var_ipv6RouteEntry, 3,
+     {11, 1, 11}},
+    {IPV6ROUTEWEIGHT, UNSIGNED32, RONLY, var_ipv6RouteEntry, 3,
+     {11, 1, 12}},
+    {IPV6ROUTEINFO, OBJID, RONLY, var_ipv6RouteEntry, 3, {11, 1, 13}},
+    {IPV6ROUTEVALID, INTEGER, RONLY, var_ipv6RouteEntry, 3, {11, 1, 14}},
+
+    {IPV6NETTOMEDIAPHYADDR, STRING, RONLY, var_ndpEntry, 3, {12, 1, 2}},
+    {IPV6NETTOMEDIATYPE, INTEGER, RONLY, var_ndpEntry, 3, {12, 1, 3}},
+    {IPV6NETTOMEDIASTATE, INTEGER, RONLY, var_ndpEntry, 3, {12, 1, 4}},
+    {IPV6NETTOMEDIALASTUPDATE, TIMETICKS, RONLY, var_ndpEntry, 3,
+     {12, 1, 5}},
+    {IPV6NETTOMEDIAVALID, INTEGER, RONLY, var_ndpEntry, 3, {12, 1, 6}},
+#endif
+};
+oid             ipv6_variables_oid[] = { SNMP_OID_MIB2, 55, 1 };
+#if 0
+config_load_mib(MIB .55 .1, 8, ipv6_variables)
+    config_add_mib(IPV6 - TC)
+    config_add_mib(IPV6 - MIB)
+#endif
+     struct variable3 ipv6icmp_variables[] = {
+         {IPV6IFICMPINMSG, ASN_COUNTER, RONLY, var_icmpv6Entry, 3,
+          {1, 1, 1}},
+         {IPV6IFICMPINERRORS, ASN_COUNTER, RONLY, var_icmpv6Entry, 3,
+          {1, 1, 2}},
+         {IPV6IFICMPINDSTUNRCHS, ASN_COUNTER, RONLY, var_icmpv6Entry, 3,
+          {1, 1, 3}},
+         {IPV6IFICMPINADMPROHS, ASN_COUNTER, RONLY, var_icmpv6Entry, 3,
+          {1, 1, 4}},
+         {IPV6IFICMPINTIMEXCDS, ASN_COUNTER, RONLY, var_icmpv6Entry, 3,
+          {1, 1, 5}},
+         {IPV6IFICMPINPARMPROBS, ASN_COUNTER, RONLY, var_icmpv6Entry, 3,
+          {1, 1, 6}},
+         {IPV6IFICMPINPKTTOOBIGS, ASN_COUNTER, RONLY, var_icmpv6Entry, 3,
+          {1, 1, 7}},
+         {IPV6IFICMPINECHOS, ASN_COUNTER, RONLY, var_icmpv6Entry, 3,
+          {1, 1, 8}},
+         {IPV6IFICMPINECHOREPS, ASN_COUNTER, RONLY, var_icmpv6Entry, 3,
+          {1, 1, 9}},
+         {IPV6IFICMPINRTRSLICITS, ASN_COUNTER, RONLY, var_icmpv6Entry, 3,
+          {1, 1, 10}},
+         {IPV6IFICMPINRTRADVS, ASN_COUNTER, RONLY, var_icmpv6Entry, 3,
+          {1, 1, 11}},
+         {IPV6IFICMPINNBRSLICITS, ASN_COUNTER, RONLY, var_icmpv6Entry, 3,
+          {1, 1, 12}},
+         {IPV6IFICMPINNBRADVS, ASN_COUNTER, RONLY, var_icmpv6Entry, 3,
+          {1, 1, 13}},
+         {IPV6IFICMPINREDIRECTS, ASN_COUNTER, RONLY, var_icmpv6Entry, 3,
+          {1, 1, 14}},
+         {IPV6IFICMPINGRPMEQERYS, ASN_COUNTER, RONLY, var_icmpv6Entry, 3,
+          {1, 1, 15}},
+         {IPV6IFICMPINGRPMERSPS, ASN_COUNTER, RONLY, var_icmpv6Entry, 3,
+          {1, 1, 16}},
+         {IPV6IFICMPINGRPMEREDCS, ASN_COUNTER, RONLY, var_icmpv6Entry, 3,
+          {1, 1, 17}},
+         {IPV6IFICMPOUTMSG, ASN_COUNTER, RONLY, var_icmpv6Entry, 3,
+          {1, 1, 18}},
+         {IPV6IFICMPOUTERRORS, ASN_COUNTER, RONLY, var_icmpv6Entry, 3,
+          {1, 1, 19}},
+         {IPV6IFICMPOUTDSTUNRCHS, ASN_COUNTER, RONLY, var_icmpv6Entry, 3,
+          {1, 1, 20}},
+         {IPV6IFICMPOUTADMPROHS, ASN_COUNTER, RONLY, var_icmpv6Entry, 3,
+          {1, 1, 21}},
+         {IPV6IFICMPOUTTIMEXCDS, ASN_COUNTER, RONLY, var_icmpv6Entry, 3,
+          {1, 1, 22}},
+         {IPV6IFICMPOUTPARMPROBS, ASN_COUNTER, RONLY, var_icmpv6Entry, 3,
+          {1, 1, 23}},
+         {IPV6IFICMPOUTPKTTOOBIGS, ASN_COUNTER, RONLY, var_icmpv6Entry, 3,
+          {1, 1, 24}},
+         {IPV6IFICMPOUTECHOS, ASN_COUNTER, RONLY, var_icmpv6Entry, 3,
+          {1, 1, 25}},
+         {IPV6IFICMPOUTECHOREPS, ASN_COUNTER, RONLY, var_icmpv6Entry, 3,
+          {1, 1, 26}},
+         {IPV6IFICMPOUTRTRSLICITS, ASN_COUNTER, RONLY, var_icmpv6Entry, 3,
+          {1, 1, 27}},
+         {IPV6IFICMPOUTRTRADVS, ASN_COUNTER, RONLY, var_icmpv6Entry, 3,
+          {1, 1, 28}},
+         {IPV6IFICMPOUTNBRSLICITS, ASN_COUNTER, RONLY, var_icmpv6Entry, 3,
+          {1, 1, 29}},
+         {IPV6IFICMPOUTNBRADVS, ASN_COUNTER, RONLY, var_icmpv6Entry, 3,
+          {1, 1, 30}},
+         {IPV6IFICMPOUTREDIRECTS, ASN_COUNTER, RONLY, var_icmpv6Entry, 3,
+          {1, 1, 31}},
+         {IPV6IFICMPOUTGRPMEQERYS, ASN_COUNTER, RONLY, var_icmpv6Entry, 3,
+          {1, 1, 32}},
+         {IPV6IFICMPOUTGRPMERSPS, ASN_COUNTER, RONLY, var_icmpv6Entry, 3,
+          {1, 1, 33}},
+         {IPV6IFICMPOUTGRPMEREDCS, ASN_COUNTER, RONLY, var_icmpv6Entry, 3,
+          {1, 1, 34}}
+     };
+oid             ipv6icmp_variables_oid[] = { 1, 3, 6, 1, 2, 1, 56, 1 };
+#if 0
+config_load_mib(MIB .56 .1, 8, ipv6icmp_variables)
+    config_add_mib(IPV6 - ICMP - MIB)
+#endif
+     struct variable2 ipv6udp_variables[] = {
+         {IPV6UDPLOCALADDRESS, ASN_OCTET_STR, RONLY, var_udp6, 2, {1, 1}},
+         {IPV6UDPLOCALPORT, ASN_INTEGER, RONLY, var_udp6, 2, {1, 2}},
+         {IPV6UDPIFINDEX, ASN_INTEGER, RONLY, var_udp6, 2, {1, 3}}
+     };
+oid             ipv6udp_variables_oid[] = { 1, 3, 6, 1, 2, 1, 7, 6 };
+#if 0
+config_load_mib(1.3 .6 .1 .3 .87 .1, 7, ipv6udp_variables)
+    config_add_mib(IPV6 - UDP - MIB)
+#endif
+     struct variable2 ipv6tcp_variables[] = {
+         {IPV6TCPLOCALADDR, ASN_OCTET_STR, RONLY, var_tcp6, 2, {1, 1}},
+         {IPV6TCPLOCALPORT, ASN_INTEGER, RONLY, var_tcp6, 2, {1, 2}},
+         {IPV6TCPREMOTEADDR, ASN_OCTET_STR, RONLY, var_tcp6, 2, {1, 3}},
+         {IPV6TCPREMOTEPORT, ASN_INTEGER, RONLY, var_tcp6, 2, {1, 4}},
+         {IPV6TCPIFINDEX, ASN_INTEGER, RONLY, var_tcp6, 2, {1, 5}},
+         {IPV6TCPCONNSTATE, ASN_INTEGER, RONLY, var_tcp6, 2, {1, 6}},
+     };
+oid             ipv6tcp_variables_oid[] = { 1, 3, 6, 1, 2, 1, 6, 16 };
+#if 0
+config_load_mib(1.3 .6 .1 .3 .86 .1, 7, ipv6tcp_variables)
+    config_add_mib(IPV6 - TCP - MIB)
+#endif
+     void
+                     init_ipv6()
+{
+    /*
+     * register ourselves with the agent to handle our mib tree 
+     */
+    REGISTER_MIB("mibII/ipv6", ipv6_variables, variable3,
+                 ipv6_variables_oid);
+    REGISTER_MIB("mibII/icmpv6", ipv6icmp_variables, variable3,
+                 ipv6icmp_variables_oid);
+    REGISTER_MIB("mibII/ipv6udp", ipv6udp_variables, variable2,
+                 ipv6udp_variables_oid);
+    REGISTER_MIB("mibII/ipv6tcp", ipv6tcp_variables, variable2,
+                 ipv6tcp_variables_oid);
+}
+
+static int
+header_ipv6(register struct variable *vp,
+            /*
+             * IN - pointer to variable entry that points here 
+             */
+            oid * name,         /* IN/OUT - input name requested, output name found */
+            size_t * length,    /* IN/OUT - length of input and output oid's */
+            int exact,          /* IN - TRUE if an exact match was requested */
+            size_t * var_len,   /* OUT - length of variable or 0 if function returned */
+            WriteMethod ** write_method)
+{
+    oid             newname[MAX_OID_LEN];
+    int             result;
+
+    DEBUGMSGTL(("mibII/ipv6", "header_ipv6: "));
+    DEBUGMSGOID(("mibII/ipv6", name, *length));
+    DEBUGMSG(("mibII/ipv6", " %d\n", exact));
+
+    memcpy((char *) newname, (char *) vp->name,
+           (int) vp->namelen * sizeof(oid));
+    newname[(int) vp->namelen] = 0;
+    result =
+        snmp_oid_compare(name, *length, newname, (int) vp->namelen + 1);
+    if ((exact && (result != 0)) || (!exact && (result >= 0)))
+        return (MATCH_FAILED);
+    memcpy((char *) name, (char *) newname,
+           ((int) vp->namelen + 1) * sizeof(oid));
+    *length = vp->namelen + 1;
+
+    *write_method = 0;
+    *var_len = sizeof(long);    /* default to 'long' results */
+    return (MATCH_SUCCEEDED);
+}
+
+static int
+header_ipv6_scan(register struct variable *vp,
+                 /*
+                  * IN - pointer to variable entry that points here 
+                  */
+                 oid * name,    /* IN/OUT - input name requested, output name found */
+                 size_t * length,       /* IN/OUT - length of input and output oid's */
+                 int exact,     /* IN - TRUE if an exact match was requested */
+                 size_t * var_len,      /* OUT - length of variable or 0 if function returned */
+                 WriteMethod ** write_method, int from, int to)
+{
+    oid             newname[MAX_OID_LEN];
+    int             result;
+    int             i;
+
+    DEBUGMSGTL(("mibII/ipv6", "header_ipv6_scan: "));
+    DEBUGMSGOID(("mibII/ipv6", name, *length));
+    DEBUGMSG(("mibII/ipv6", " %d\n", exact));
+
+    memcpy((char *) newname, (char *) vp->name,
+           (int) vp->namelen * sizeof(oid));
+    for (i = from; i <= to; i++) {
+        newname[(int) vp->namelen] = i;
+        result =
+            snmp_oid_compare(name, *length, newname,
+                             (int) vp->namelen + 1);
+        if (((exact && result == 0) || (!exact && result < 0))
+            && if_getname(i))
+            break;
+    }
+    if (to < i)
+        return (MATCH_FAILED);
+    memcpy((char *) name, (char *) newname,
+           ((int) vp->namelen + 1) * sizeof(oid));
+    *length = vp->namelen + 1;
+    *write_method = 0;
+    *var_len = sizeof(long);    /* default to 'long' results */
+    return (MATCH_SUCCEEDED);
+}
+
+static struct if_nameindex *ifnames = NULL;
+
+#ifdef linux
+static void     linux_if_freenameindex(struct if_nameindex *);
+static struct if_nameindex *linux_if_nameindex(void);
+#endif
+
+static int
+if_initialize(void)
+{
+#ifndef HAVE_IF_NAMEINDEX
+    return -1;
+#else
+#ifndef linux
+    if (ifnames)
+        if_freenameindex(ifnames);
+    ifnames = if_nameindex();
+#else
+    if (ifnames)
+        linux_if_freenameindex(ifnames);
+    ifnames = linux_if_nameindex();
+#endif
+    if (!ifnames) {
+        ERROR_MSG("if_nameindex() failed");
+        return -1;
+    }
+    return 0;
+#endif
+}
+
+static int
+if_maxifindex(void)
+{
+#ifndef HAVE_IF_NAMEINDEX
+    return -1;
+#else
+    struct if_nameindex *p;
+    int             max = 0;
+
+    if (!ifnames) {
+        if (if_initialize() < 0)
+            return -1;
+    }
+    for (p = ifnames; p && p->if_index; p++) {
+        if (max < p->if_index)
+            max = p->if_index;
+    }
+    return max;
+#endif
+}
+
+static int
+if_countifindex(void)
+{
+#ifndef HAVE_IF_NAMEINDEX
+    return -1;
+#else
+    struct if_nameindex *p;
+    int             count = 0;
+
+    if (!ifnames) {
+        if (if_initialize() < 0)
+            return -1;
+    }
+    for (p = ifnames; p && p->if_index; p++) {
+        count++;
+    }
+    return count;
+#endif
+}
+
+static char    *
+if_getname(int idx)
+{
+#ifndef HAVE_IF_NAMEINDEX
+    return NULL;
+#else
+    struct if_nameindex *p;
+    int             max = -1;
+
+    if (!ifnames) {
+        if (if_initialize() < 0)
+            return NULL;
+    }
+    for (p = ifnames; p && p->if_index; p++) {
+        if (p->if_index == idx)
+            return p->if_name;
+    }
+    return NULL;
+#endif
+}
+
+static int
+if_getindex(const char *name)
+{
+#ifndef HAVE_IF_NAMEINDEX
+    return -1;
+#else
+    struct if_nameindex *p;
+
+    if (!ifnames) {
+        if (if_initialize() < 0)
+            return -1;
+    }
+    for (p = ifnames; p && p->if_index; p++) {
+        if (strcmp(name, p->if_name) == 0)
+            return p->if_index;
+    }
+    return -1;
+#endif
+}
+
+/*------------------------------------------------------------*/
+#ifndef linux
+/*
+ * KAME dependent part 
+ */
+static int
+if_getifnet(int idx, struct ifnet *result)
+{
+    caddr_t         q;
+    struct ifnet    tmp;
+
+    if (!auto_nlist("ifnet", (char *) &q, sizeof(q)))
+        return -1;
+    while (q) {
+        klookup((u_long) q, (char *) &tmp, sizeof(tmp));
+        if (idx == tmp.if_index) {
+            memcpy(result, &tmp, sizeof(tmp));
+            return 0;
+        }
+#if defined(__FreeBSD__) && 3 <= __FreeBSD__
+        q = (caddr_t) TAILQ_NEXT(&tmp, if_link);
+#else
+# if defined(__NetBSD__) || defined(__OpenBSD__)
+        q = (caddr_t) TAILQ_NEXT(&tmp, if_list);
+# else
+        q = (caddr_t) tmp.if_next;
+# endif
+#endif
+    }
+    return -1;
+}
+
+#ifdef HAVE_NET_IF_MIB_H
+#if defined(HAVE_SYS_SYSCTL_H) && defined(CTL_NET)
+static int
+if_getifmibdata(int idx, struct ifmibdata *result)
+{
+    int             mib[6] = {
+        CTL_NET, PF_LINK, NETLINK_GENERIC, IFMIB_IFDATA, 0, IFDATA_GENERAL
+    };
+    int             len;
+    struct ifmibdata tmp;
+
+    mib[4] = idx;
+    len = sizeof(struct ifmibdata);
+    if (sysctl(mib, sizeof(mib) / sizeof(mib[0]), &tmp, &len, 0, 0) < 0)
+        return -1;
+    memcpy(result, &tmp, sizeof(tmp));
+    return 0;
+}
+#endif
+#endif                          /*HAVE_NET_IF_MIB_H */
+
+#ifdef __KAME__
+#define IPV6_FORWARDING_SYMBOL	"ip6_forwarding"
+#define IPV6_DEFHLIM_SYMBOL	"ip6_defhlim"
+#endif
+
+u_char         *
+var_ipv6(register struct variable * vp,
+         oid * name,
+         size_t * length,
+         int exact, size_t * var_len, WriteMethod ** write_method)
+{
+    int             i;
+
+    if (header_ipv6(vp, name, length, exact, var_len, write_method)
+        == MATCH_FAILED) {
+        return NULL;
+    }
+#if defined(HAVE_SYS_SYSCTL_H) && defined(CTL_NET)
+    /*
+     * try with sysctl routines 
+     */
+    {
+        int             name[] = { CTL_NET, PF_INET6, IPPROTO_IPV6, 0 };
+        const char     *namestr = NULL;
+        int             result;
+        int             resultsiz;
+
+        resultsiz = sizeof(result);
+        switch (vp->magic) {
+        case IPV6FORWARDING:
+            name[3] = IPV6CTL_FORWARDING;
+            namestr = "IPV6CTL_FORWARDING";
+            if (sysctl
+                (name, sizeof(name) / sizeof(name[0]), &result, &resultsiz,
+                 0, 0) < 0) {
+                DEBUGMSGTL(("mibII/ipv6",
+                            "sysctl(CTL_NET, PF_INET6, IPPROTO_IPV6, %s)\n",
+                            namestr));
+                break;
+            } else {
+                if (result)
+                    long_return = 1;    /* GATEWAY */
+                else
+                    long_return = 2;    /* HOST */
+                return (u_char *) & long_return;
+            }
+            break;
+        case IPV6DEFAULTHOPLIMIT:
+            name[3] = IPV6CTL_DEFHLIM;
+            namestr = "IPV6CTL_DEFHLIM";
+            if (sysctl
+                (name, sizeof(name) / sizeof(name[0]), &result, &resultsiz,
+                 0, 0) < 0) {
+                DEBUGMSGTL(("mibII/ipv6",
+                            "sysctl(CTL_NET, PF_INET6, IPPROTO_IPV6, %s)\n",
+                            namestr));
+                break;
+            } else {
+                long_return = result;
+                return (u_char *) & long_return;
+            }
+        }
+    }
+#endif                          /* not (HAVE_SYS_SYSCTL_H && CTL_NET) */
+
+    /*
+     * try looking into the kernel variable 
+     */
+    switch (vp->magic) {
+#ifdef IPV6_FORWARDING_SYMBOL
+    case IPV6FORWARDING:
+        if (auto_nlist(IPV6_FORWARDING_SYMBOL, (char *) &i, sizeof(i))) {
+            if (i)
+                long_return = 1;
+            /*GATEWAY*/
+            else
+                long_return = 2;
+            /*HOST*/ return (u_char *) & long_return;
+        }
+        break;
+#endif
+#ifdef IPV6_DEFHLIM_SYMBOL
+    case IPV6DEFAULTHOPLIMIT:
+        if (auto_nlist(IPV6_DEFHLIM_SYMBOL, (char *) &i, sizeof(i))) {
+            long_return = i;
+            return (u_char *) & long_return;
+        }
+        break;
+#endif
+    case IPV6INTERFACES:
+#ifdef HAVE_IF_NAMEINDEX
+        /*
+         * not really the right answer... we must count IPv6 capable
+         * interfaces only.
+         */
+        long_return = if_countifindex();
+        if (long_return < 0)
+            break;
+        return (u_char *) & long_return;
+#endif
+        break;
+#if 0
+    case IPV6IFTBLLASTCHG:
+        long_return = 0;
+        /*XXX*/ return (u_char *) & long_return;
+#endif
+    default:
+        break;
+    }
+    ERROR_MSG("");
+    return NULL;
+}
+
+u_char         *
+var_ifv6Entry(register struct variable * vp,
+              oid * name,
+              size_t * length,
+              int exact, size_t * var_len, WriteMethod ** write_method)
+{
+#ifndef HAVE_IF_NAMEINDEX
+    return NULL;
+#else
+    int             interface;
+    int             max;
+    char           *p;
+
+    max = if_maxifindex();
+    if (max < 0)
+        return NULL;
+
+    if (header_ipv6_scan
+        (vp, name, length, exact, var_len, write_method, 1, max)
+        == MATCH_FAILED) {
+        return NULL;
+    }
+    interface = name[*length - 1];
+    DEBUGMSGTL(("mibII/ipv6", "interface: %d(%s)\n",
+                interface, if_getname(interface)));
+    if (interface > max)
+        return NULL;
+
+    switch (vp->magic) {
+    case IPV6IFDESCR:
+        p = if_getname(interface);
+        if (p) {
+            *var_len = strlen(p);
+            return p;
+        }
+        break;
+    case IPV6IFLOWLAYER:
+        /*
+         * should check if type, this is a hard one... 
+         */
+        *var_len = nullOidLen;
+        return (u_char *) nullOid;
+    case IPV6IFEFFECTMTU:
+        {
+#if defined(SIOCGIFMTU) && !defined(__OpenBSD__)
+            struct ifreq    ifr;
+            int             s;
+
+            memset(&ifr, 0, sizeof(ifr));
+            ifr.ifr_addr.sa_family = AF_INET6;
+            strncpy(ifr.ifr_name, if_getname(interface),
+                    sizeof(ifr.ifr_name));
+            if ((s = socket(ifr.ifr_addr.sa_family, SOCK_DGRAM, 0)) < 0)
+                break;
+            if (ioctl(s, SIOCGIFMTU, (caddr_t) & ifr) < 0) {
+                close(s);
+                break;
+            }
+            long_return = ifr.ifr_mtu;
+            close(s);
+            return (u_char *) & long_return;
+#else
+            break;
+#endif
+        }
+#if 0                           /*not yet */
+    case IPV6IFREASMMAXSIZE:
+        /*
+         * I dunno what the spec means for this MIB 
+         */
+    case IPV6IFTOKEN:
+    case IPV6IFTOKENLEN:
+#endif
+    case IPV6IFPHYSADDRESS:
+        {
+            struct ifnet    ifnet;
+            struct ifaddr   ifaddr;
+            static struct sockaddr_dl sdl;
+            caddr_t         ifa;
+
+            if (if_getifnet(interface, &ifnet) < 0)
+                break;
+#if defined(__FreeBSD__) && 3 <= __FreeBSD__
+            ifa = (caddr_t) TAILQ_FIRST(&ifnet.if_addrhead);
+#else
+# if defined(__NetBSD__) || defined(__OpenBSD__)
+            ifa = (caddr_t) TAILQ_FIRST(&ifnet.if_addrlist);
+# else
+            ifa = (caddr_t) ifnet.if_addrlist;
+# endif
+#endif
+            while (ifa) {
+                klookup((u_long) ifa, (char *) &ifaddr, sizeof(ifaddr));
+                klookup((u_long) ifaddr.ifa_addr, (char *) &sdl,
+                        sizeof(sdl));
+                if (sdl.sdl_family == AF_LINK) {
+                    if (sizeof(sdl.sdl_data) < sdl.sdl_nlen + sdl.sdl_alen) {
+                        ERROR_MSG("sdl_alen too long for interface\n");
+                        break;
+                    }
+                    *var_len = sdl.sdl_alen;
+                    return (u_char *) (sdl.sdl_data + sdl.sdl_nlen);
+                }
+#if defined(__FreeBSD__) && 3 <= __FreeBSD__
+                ifa = (caddr_t) TAILQ_NEXT(&ifaddr, ifa_link);
+#else
+# if defined(__NetBSD__) || defined(__OpenBSD__)
+                ifa = (caddr_t) TAILQ_NEXT(&ifaddr, ifa_list);
+# else
+                ifa = (caddr_t) ifaddr.ifa_next;
+# endif
+#endif
+            }
+
+            /*
+             * no physical address found 
+             */
+            *var_len = 0;
+            return NULL;
+        }
+    case IPV6IFADMSTATUS:
+        {
+            struct ifnet    ifnet;
+
+            if (if_getifnet(interface, &ifnet) < 0)
+                break;
+            long_return = (ifnet.if_flags & IFF_RUNNING) ? 1 : 2;
+            return (u_char *) & long_return;
+        }
+    case IPV6IFOPERSTATUS:
+        {
+            struct ifnet    ifnet;
+
+            if (if_getifnet(interface, &ifnet) < 0)
+                break;
+            long_return = (ifnet.if_flags & IFF_UP) ? 1 : 2;
+            return (u_char *) & long_return;
+        }
+#if 0                           /*untrustable value returned... */
+    case IPV6IFLASTCHANGE:
+        {
+            struct timeval  lastchange;
+            struct timeval  now;
+            int             gotanswer;
+
+            gotanswer = 0;
+            lastchange.tv_sec = lastchange.tv_usec = 0;
+#ifdef HAVE_NET_IF_MIB_H
+            if (!gotanswer) {
+                struct ifmibdata ifmd;
+
+                if (if_getifmibdata(interface, &ifmd) < 0);
+                else {
+                    lastchange = ifmd.ifmd_data.ifi_lastchange;
+                    gotanswer++;
+                }
+            }
+#endif
+#ifdef STRUCT_IFNET_HAS_IF_LASTCHANGE_TV_SEC
+            if (!gotanswer) {
+                struct ifnet    ifnet;
+
+                if (if_getifnet(interface, &ifnet) < 0);
+                else {
+                    lastchange = ifnet.if_lastchange;
+                    gotanswer++;
+                }
+            }
+#endif
+            DEBUGMSGTL(("mibII/ipv6", "lastchange = { %d.%06d }\n",
+                        lastchange.tv_sec, lastchange.tv_usec));
+            if (lastchange.tv_sec == 0 && lastchange.tv_usec == 0)
+                long_return = 0;
+            else {
+                gettimeofday(&now, (struct timezone *) NULL);
+                long_return =
+                    (u_long) ((now.tv_sec - lastchange.tv_sec) * 100);
+                long_return +=
+                    (u_long) ((now.tv_usec - lastchange.tv_usec) / 10000);
+            }
+            return (u_char *) & long_return;
+        }
+#endif                          /*0 */
+
+#ifdef SIOCGIFSTAT_IN6
+    case IPV6IFSTATSINRCVS:
+    case IPV6IFSTATSINHDRERRS:
+    case IPV6IFSTATSTOOBIGERRS:
+    case IPV6IFSTATSINNOROUTES:
+    case IPV6IFSTATSINADDRERRS:
+    case IPV6IFSTATSINUNKNOWPROTS:
+    case IPV6IFSTATSINTRUNCATPKTS:
+    case IPV6IFSTATSINDISCARDS:
+    case IPV6IFSTATSINDELIVERS:
+    case IPV6IFSTATSOUTFORWDATAS:
+    case IPV6IFSTATSOUTREQS:
+    case IPV6IFSTATSOUTDISCARDS:
+    case IPV6IFSTATSOUTFRAGOKS:
+    case IPV6IFSTATSOUTFRAGFAILS:
+    case IPV6IFSTATSOUTFRAGCREATS:
+    case IPV6IFSTATSOUTREASMREQS:
+    case IPV6IFSTATSOUTREASMOKS:
+    case IPV6IFSTATSOUTREASMFAILS:
+    case IPV6IFSTATSINMCASTPKTS:
+    case IPV6IFSTATSOUTMCASTPKTS:
+        {
+            struct in6_ifstat *ifs6;
+            struct in6_ifreq ifr;
+            int             s;
+
+            memset(&ifr, 0, sizeof(ifr));
+            strncpy(ifr.ifr_name, if_getname(interface),
+                    sizeof(ifr.ifr_name));
+            if ((s = socket(AF_INET6, SOCK_DGRAM, 0)) < 0)
+                break;
+            if (ioctl(s, SIOCGIFSTAT_IN6, (caddr_t) & ifr) < 0) {
+                extern int      errno;
+                close(s);
+                break;
+            }
+            close(s);
+            ifs6 = &ifr.ifr_ifru.ifru_stat;
+            switch (vp->magic) {
+            case IPV6IFSTATSINRCVS:
+                long_return = ifs6->ifs6_in_receive;
+                break;
+            case IPV6IFSTATSINHDRERRS:
+                long_return = ifs6->ifs6_in_hdrerr;
+                break;
+            case IPV6IFSTATSTOOBIGERRS:
+                long_return = ifs6->ifs6_in_toobig;
+                break;
+            case IPV6IFSTATSINNOROUTES:
+                long_return = ifs6->ifs6_in_noroute;
+                break;
+            case IPV6IFSTATSINADDRERRS:
+                long_return = ifs6->ifs6_in_addrerr;
+                break;
+            case IPV6IFSTATSINUNKNOWPROTS:
+                long_return = ifs6->ifs6_in_protounknown;
+                break;
+            case IPV6IFSTATSINTRUNCATPKTS:
+                long_return = ifs6->ifs6_in_truncated;
+                break;
+            case IPV6IFSTATSINDISCARDS:
+                long_return = ifs6->ifs6_in_discard;
+                break;
+            case IPV6IFSTATSINDELIVERS:
+                long_return = ifs6->ifs6_in_deliver;
+                break;
+            case IPV6IFSTATSOUTFORWDATAS:
+                long_return = ifs6->ifs6_out_forward;
+                break;
+            case IPV6IFSTATSOUTREQS:
+                long_return = ifs6->ifs6_out_request;
+                break;
+            case IPV6IFSTATSOUTDISCARDS:
+                long_return = ifs6->ifs6_out_discard;
+                break;
+            case IPV6IFSTATSOUTFRAGOKS:
+                long_return = ifs6->ifs6_out_fragok;
+                break;
+            case IPV6IFSTATSOUTFRAGFAILS:
+                long_return = ifs6->ifs6_out_fragfail;
+                break;
+            case IPV6IFSTATSOUTFRAGCREATS:
+                long_return = ifs6->ifs6_out_fragcreat;
+                break;
+            case IPV6IFSTATSOUTREASMREQS:
+                long_return = ifs6->ifs6_reass_reqd;
+                break;
+            case IPV6IFSTATSOUTREASMOKS:
+                long_return = ifs6->ifs6_reass_ok;
+                break;
+            case IPV6IFSTATSOUTREASMFAILS:
+                long_return = ifs6->ifs6_reass_fail;
+                break;
+            case IPV6IFSTATSINMCASTPKTS:
+                long_return = ifs6->ifs6_in_mcast;
+                break;
+            case IPV6IFSTATSOUTMCASTPKTS:
+                long_return = ifs6->ifs6_out_mcast;
+                break;
+            default:
+                return NULL;
+            }
+            return (u_char *) & long_return;
+        }
+#endif
+    default:
+        break;
+    }
+    return NULL;
+#endif
+}
+
+u_char         *
+var_icmpv6Entry(register struct variable * vp,
+                oid * name,
+                size_t * length,
+                int exact, size_t * var_len, WriteMethod ** write_method)
+{
+#ifndef HAVE_IF_NAMEINDEX
+    return NULL;
+#else
+    int             interface;
+    int             max;
+    char           *p;
+
+    max = if_maxifindex();
+    if (max < 0)
+        return NULL;
+
+    if (header_ipv6_scan
+        (vp, name, length, exact, var_len, write_method, 1, max)
+        == MATCH_FAILED) {
+        return NULL;
+    }
+    interface = name[*length - 1];
+    DEBUGMSGTL(("mibII/ipv6", "interface: %d(%s)\n",
+                interface, if_getname(interface)));
+    if (interface >= max)
+        return NULL;
+
+    switch (vp->magic) {
+#ifdef SIOCGIFSTAT_ICMP6
+    case IPV6IFICMPINMSG:
+    case IPV6IFICMPINERRORS:
+    case IPV6IFICMPINDSTUNRCHS:
+    case IPV6IFICMPINADMPROHS:
+    case IPV6IFICMPINTIMEXCDS:
+    case IPV6IFICMPINPARMPROBS:
+    case IPV6IFICMPINPKTTOOBIGS:
+    case IPV6IFICMPINECHOS:
+    case IPV6IFICMPINECHOREPS:
+    case IPV6IFICMPINRTRSLICITS:
+    case IPV6IFICMPINRTRADVS:
+    case IPV6IFICMPINNBRSLICITS:
+    case IPV6IFICMPINNBRADVS:
+    case IPV6IFICMPINREDIRECTS:
+    case IPV6IFICMPINGRPMEQERYS:
+    case IPV6IFICMPINGRPMERSPS:
+    case IPV6IFICMPINGRPMEREDCS:
+    case IPV6IFICMPOUTMSG:
+    case IPV6IFICMPOUTERRORS:
+    case IPV6IFICMPOUTDSTUNRCHS:
+    case IPV6IFICMPOUTADMPROHS:
+    case IPV6IFICMPOUTTIMEXCDS:
+    case IPV6IFICMPOUTPARMPROBS:
+    case IPV6IFICMPOUTPKTTOOBIGS:
+    case IPV6IFICMPOUTECHOS:
+    case IPV6IFICMPOUTECHOREPS:
+    case IPV6IFICMPOUTRTRSLICITS:
+    case IPV6IFICMPOUTRTRADVS:
+    case IPV6IFICMPOUTNBRSLICITS:
+    case IPV6IFICMPOUTNBRADVS:
+    case IPV6IFICMPOUTREDIRECTS:
+    case IPV6IFICMPOUTGRPMEQERYS:
+    case IPV6IFICMPOUTGRPMERSPS:
+    case IPV6IFICMPOUTGRPMEREDCS:
+        {
+            struct icmp6_ifstat *ifs6;
+            struct in6_ifreq ifr;
+            int             s;
+
+            memset(&ifr, 0, sizeof(ifr));
+            strncpy(ifr.ifr_name, if_getname(interface),
+                    sizeof(ifr.ifr_name));
+            if ((s = socket(AF_INET6, SOCK_DGRAM, 0)) < 0)
+                break;
+            if (ioctl(s, SIOCGIFSTAT_ICMP6, (caddr_t) & ifr) < 0) {
+                extern int      errno;
+                close(s);
+                break;
+            }
+            close(s);
+            ifs6 = &ifr.ifr_ifru.ifru_icmp6stat;
+            switch (vp->magic) {
+            case IPV6IFICMPINMSG:
+                long_return = ifs6->ifs6_in_msg;
+                break;
+            case IPV6IFICMPINERRORS:
+                long_return = ifs6->ifs6_in_error;
+                break;
+            case IPV6IFICMPINDSTUNRCHS:
+                long_return = ifs6->ifs6_in_dstunreach;
+                break;
+            case IPV6IFICMPINADMPROHS:
+                long_return = ifs6->ifs6_in_adminprohib;
+                break;
+            case IPV6IFICMPINTIMEXCDS:
+                long_return = ifs6->ifs6_in_timeexceed;
+                break;
+            case IPV6IFICMPINPARMPROBS:
+                long_return = ifs6->ifs6_in_paramprob;
+                break;
+            case IPV6IFICMPINPKTTOOBIGS:
+                long_return = ifs6->ifs6_in_pkttoobig;
+                break;
+            case IPV6IFICMPINECHOS:
+                long_return = ifs6->ifs6_in_echo;
+                break;
+            case IPV6IFICMPINECHOREPS:
+                long_return = ifs6->ifs6_in_echoreply;
+                break;
+            case IPV6IFICMPINRTRSLICITS:
+                long_return = ifs6->ifs6_in_routersolicit;
+                break;
+            case IPV6IFICMPINRTRADVS:
+                long_return = ifs6->ifs6_in_routeradvert;
+                break;
+            case IPV6IFICMPINNBRSLICITS:
+                long_return = ifs6->ifs6_in_neighborsolicit;
+                break;
+            case IPV6IFICMPINNBRADVS:
+                long_return = ifs6->ifs6_in_neighboradvert;
+                break;
+            case IPV6IFICMPINREDIRECTS:
+                long_return = ifs6->ifs6_in_redirect;
+                break;
+            case IPV6IFICMPINGRPMEQERYS:
+                long_return = ifs6->ifs6_in_mldquery;
+                break;
+            case IPV6IFICMPINGRPMERSPS:
+                long_return = ifs6->ifs6_in_mldreport;
+                break;
+            case IPV6IFICMPINGRPMEREDCS:
+                long_return = ifs6->ifs6_in_mlddone;
+                break;
+            case IPV6IFICMPOUTMSG:
+                long_return = ifs6->ifs6_out_msg;
+                break;
+            case IPV6IFICMPOUTERRORS:
+                long_return = ifs6->ifs6_out_error;
+                break;
+            case IPV6IFICMPOUTDSTUNRCHS:
+                long_return = ifs6->ifs6_out_dstunreach;
+                break;
+            case IPV6IFICMPOUTADMPROHS:
+                long_return = ifs6->ifs6_out_adminprohib;
+                break;
+            case IPV6IFICMPOUTTIMEXCDS:
+                long_return = ifs6->ifs6_out_timeexceed;
+                break;
+            case IPV6IFICMPOUTPARMPROBS:
+                long_return = ifs6->ifs6_out_paramprob;
+                break;
+            case IPV6IFICMPOUTPKTTOOBIGS:
+                long_return = ifs6->ifs6_out_pkttoobig;
+                break;
+            case IPV6IFICMPOUTECHOS:
+                long_return = ifs6->ifs6_out_echo;
+                break;
+            case IPV6IFICMPOUTECHOREPS:
+                long_return = ifs6->ifs6_out_echoreply;
+                break;
+            case IPV6IFICMPOUTRTRSLICITS:
+                long_return = ifs6->ifs6_out_routersolicit;
+                break;
+            case IPV6IFICMPOUTRTRADVS:
+                long_return = ifs6->ifs6_out_routeradvert;
+                break;
+            case IPV6IFICMPOUTNBRSLICITS:
+                long_return = ifs6->ifs6_out_neighborsolicit;
+                break;
+            case IPV6IFICMPOUTNBRADVS:
+                long_return = ifs6->ifs6_out_neighboradvert;
+                break;
+            case IPV6IFICMPOUTREDIRECTS:
+                long_return = ifs6->ifs6_out_redirect;
+                break;
+            case IPV6IFICMPOUTGRPMEQERYS:
+                long_return = ifs6->ifs6_out_mldquery;
+                break;
+            case IPV6IFICMPOUTGRPMERSPS:
+                long_return = ifs6->ifs6_out_mldreport;
+                break;
+            case IPV6IFICMPOUTGRPMEREDCS:
+                long_return = ifs6->ifs6_out_mlddone;
+                break;
+            default:
+                return NULL;
+            }
+            return (u_char *) & long_return;
+        }
+#endif
+    default:
+        break;
+    }
+    return NULL;
+#endif
+}
+
+u_char         *
+var_udp6(register struct variable * vp,
+         oid * name,
+         size_t * length,
+         int exact, size_t * var_len, WriteMethod ** write_method)
+{
+    oid             newname[MAX_OID_LEN];
+    oid             tmp1[MAX_OID_LEN], tmp2[MAX_OID_LEN];
+    int             result;
+    int             i, j;
+    caddr_t         p;
+    static struct in6pcb in6pcb, udb6;
+    int             found, hitnext;
+#if defined(__FreeBSD__) && __FreeBSD__ >= 3
+    char           *sysctl_buf;
+    struct xinpgen *xig, *oxig;
+#endif                          /* defined(__FreeBSD__) && __FreeBSD__ >= 3 */
+
+    DEBUGMSGTL(("mibII/ipv6", "var_udp6: "));
+    DEBUGMSGOID(("mibII/ipv6", name, *length));
+    DEBUGMSG(("mibII/ipv6", " %d\n", exact));
+
+#if !(defined(__FreeBSD__) && __FreeBSD__ >= 3)
+    if (!auto_nlist("udb6", (char *) &udb6, sizeof(udb6)))
+        return NULL;
+    p = (caddr_t) udb6.in6p_next;
+#else
+    {
+        const char     *udblist = "net.inet.udp.pcblist";
+        int             len;
+
+        if (sysctlbyname(udblist, 0, &len, 0, 0) < 0)
+            return NULL;
+        if ((sysctl_buf = malloc(len)) == NULL)
+            return NULL;
+        if (sysctlbyname(udblist, sysctl_buf, &len, 0, 0) < 0) {
+            free(sysctl_buf);
+            return NULL;
+        }
+        oxig = (struct xinpgen *) sysctl_buf;
+        xig = (struct xinpgen *) ((char *) oxig + oxig->xig_len);
+    }
+#endif
+    found = hitnext = 0;
+    memcpy((char *) newname, (char *) vp->name,
+           (int) vp->namelen * sizeof(oid));
+    DEBUGMSGTL(("mibII/ipv6", "start: p=%x\n", p));
+    while (
+#if !(defined(__FreeBSD__) && __FreeBSD__ >= 3)
+              p && (u_long) p != auto_nlist_value("udb6")
+#else
+              xig->xig_len > sizeof(struct xinpgen)
+#endif
+        ) {
+        DEBUGMSGTL(("mibII/ipv6", "looping: p=%x\n", p));
+
+#if !(defined(__FreeBSD__) && __FreeBSD__ >= 3)
+        klookup((u_long) p, (char *) &in6pcb, sizeof(in6pcb));
+#else
+        in6pcb = ((struct xinpcb *) xig)->xi_inp;
+#endif
+        j = (int) vp->namelen;
+        for (i = 0; i < sizeof(struct in6_addr); i++)
+            newname[j++] = in6pcb.in6p_laddr.s6_addr[i];
+        newname[j++] = ntohs(in6pcb.in6p_lport);
+        if (IN6_IS_ADDR_LINKLOCAL(&in6pcb.in6p_laddr))
+            newname[j++] =
+                ntohs(*(u_int16_t *) & in6pcb.in6p_laddr.s6_addr[2]);
+        else
+            newname[j++] = 0;
+        /*XXX*/
+            DEBUGMSGTL(("mibII/ipv6", "var_udp6 new: %d %d ",
+                        (int) vp->namelen, j));
+        DEBUGMSGOID(("mibII/ipv6", newname, j));
+        DEBUGMSG(("mibII/ipv6", " %d\n", exact));
+
+        if (exact) {
+            result = snmp_oid_compare(name, *length, newname, j);
+            if (result == 0) {
+                found++;
+                break;
+            }
+        } else {
+            /*
+             * tcb entries may not be ordered as SNMP scanning code expect.
+             * Therefore, we'll do a guess...
+             * 1. "name" has the previously matched entry.
+             *    If "name" is UDP6 MIBs, take the item that is right next
+             *    to the item exactly matches to "name".
+             * 2. Otherwise, it is the very first time we entered to UDP6 MIBs.
+             */
+            memcpy(tmp1, name, vp->namelen * sizeof(oid));
+            memcpy(tmp2, newname, vp->namelen * sizeof(oid));
+            tmp1[vp->namelen] = 0;
+            tmp2[vp->namelen] = 0;
+            if (*length == j
+                && snmp_oid_compare(tmp1, vp->namelen, tmp2,
+                                    vp->namelen) == 0) {
+                if (!hitnext) {
+                    result = snmp_oid_compare(name, *length, newname, j);
+                    if (result == 0)
+                        hitnext++;
+                } else {
+                    found++;
+                    break;
+                }
+            } else {
+                if (snmp_oid_compare(name, *length, newname, j) < 0) {
+                    found++;
+                    break;
+                }
+            }
+        }
+#if !(defined(__FreeBSD__) && __FreeBSD__ >= 3)
+        p = (caddr_t) in6pcb.in6p_next;
+#else
+        xig = (struct xinpgen *) ((char *) xig + xig->xig_len);
+#endif
+    }
+#if defined(__FreeBSD__) && __FreeBSD__ >= 3
+    free(sysctl_buf);
+#endif                          /* defined(__FreeBSD__) && __FreeBSD__ >= 3 */
+    if (!found)
+        return NULL;
+    *length = j;
+    memcpy((char *) name, (char *) newname, *length * sizeof(oid));
+    *write_method = 0;
+    *var_len = sizeof(long);    /* default to 'long' results */
+
+
+    /*
+     * try looking into the kernel variable 
+     */
+    switch (vp->magic) {
+    case IPV6UDPLOCALADDRESS:
+        *var_len = sizeof(struct in6_addr);
+        return in6pcb.in6p_laddr.s6_addr;
+    case IPV6UDPLOCALPORT:
+        long_return = ntohs(in6pcb.in6p_lport);
+        return (u_char *) & long_return;
+    case IPV6UDPIFINDEX:
+        if (IN6_IS_ADDR_LINKLOCAL(&in6pcb.in6p_laddr))
+            long_return =
+                ntohs(*(u_int16_t *) & in6pcb.in6p_laddr.s6_addr[2]);
+        else
+            long_return = 0;
+        /*XXX*/ return (u_char *) & long_return;
+    default:
+        break;
+    }
+    ERROR_MSG("");
+    return NULL;
+}
+
+#ifdef TCP6
+u_char         *
+var_tcp6(register struct variable * vp,
+         oid * name,
+         size_t * length,
+         int exact, size_t * var_len, WriteMethod ** write_method)
+{
+    oid             newname[MAX_OID_LEN];
+    oid             tmp1[MAX_OID_LEN], tmp2[MAX_OID_LEN];
+    int             result;
+    int             i, j;
+    caddr_t         p;
+    static struct in6pcb in6pcb, tcb6;
+    struct tcp6cb   tcp6cb;
+    int             found, hitnext;
+    static int      tcp6statemap[TCP6_NSTATES];
+    static int      initialized = 0;
+#if defined(__FreeBSD__) && __FreeBSD__ >= 3
+    char           *sysctl_buf;
+    struct xinpgen *xig, *oxig;
+#endif                          /* defined(__FreeBSD__) && __FreeBSD__ >= 3 */
+
+    if (!initialized) {
+        tcp6statemap[TCP6S_CLOSED] = 1;
+        tcp6statemap[TCP6S_LISTEN] = 2;
+        tcp6statemap[TCP6S_SYN_SENT] = 3;
+        tcp6statemap[TCP6S_SYN_RECEIVED] = 4;
+        tcp6statemap[TCP6S_ESTABLISHED] = 5;
+        tcp6statemap[TCP6S_CLOSE_WAIT] = 8;
+        tcp6statemap[TCP6S_FIN_WAIT_1] = 6;
+        tcp6statemap[TCP6S_CLOSING] = 10;
+        tcp6statemap[TCP6S_LAST_ACK] = 9;
+        tcp6statemap[TCP6S_FIN_WAIT_2] = 7;
+        tcp6statemap[TCP6S_TIME_WAIT] = 11;
+        initialized++;
+    }
+
+    DEBUGMSGTL(("mibII/ipv6", "var_tcp6: "));
+    DEBUGMSGOID(("mibII/ipv6", name, *length));
+    DEBUGMSG(("mibII/ipv6", " %d\n", exact));
+
+#if !(defined(__FreeBSD__) && __FreeBSD__ >= 3)
+    if (!auto_nlist("tcb6", (char *) &tcb6, sizeof(tcb6)))
+        return NULL;
+    p = (caddr_t) tcb6.in6p_next;
+#else
+    {
+        const char     *tcblist = "net.inet.tcp.pcblist";
+        int             len;
+
+        if (sysctlbyname(tcblist, 0, &len, 0, 0) < 0)
+            return NULL;
+        if ((sysctl_buf = malloc(len)) == NULL)
+            return NULL;
+        if (sysctlbyname(tcblist, sysctl_buf, &len, 0, 0) < 0) {
+            free(sysctl_buf);
+            return NULL;
+        }
+        oxig = (struct xinpgen *) sysctl_buf;
+        xig = (struct xinpgen *) ((char *) oxig + oxig->xig_len);
+    }
+#endif
+
+    found = hitnext = 0;
+    memcpy((char *) newname, (char *) vp->name,
+           (int) vp->namelen * sizeof(oid));
+    while (
+#if !(defined(__FreeBSD__) && __FreeBSD__ >= 3)
+              p && (u_long) p != auto_nlist_value("tcb6")
+#else
+              xig->xig_len > sizeof(struct xinpgen)
+#endif
+        ) {
+        DEBUGMSGTL(("mibII/ipv6", "looping: p=%x\n", p));
+
+#if !(defined(__FreeBSD__) && __FreeBSD__ >= 3)
+        if (klookup((u_long) p, (char *) &in6pcb, sizeof(in6pcb)) < 0) {
+            DEBUGMSGTL(("mibII/ipv6", "klookup fail for in6pcb at %x\n",
+                        p));
+            break;
+        }
+#else
+        in6pcb = ((struct xinpcb *) xig)->xi_inp;
+#endif
+        if (klookup
+            ((u_long) in6pcb.in6p_ppcb, (char *) &tcp6cb, sizeof(tcp6cb))
+            < 0) {
+            DEBUGMSGTL(("mibII/ipv6", "klookup fail for tcp6cb at %x\n",
+                        in6pcb.in6p_ppcb));
+            break;
+        }
+        j = (int) vp->namelen;
+        for (i = 0; i < sizeof(struct in6_addr); i++)
+            newname[j++] = in6pcb.in6p_laddr.s6_addr[i];
+        newname[j++] = ntohs(in6pcb.in6p_lport);
+        for (i = 0; i < sizeof(struct in6_addr); i++)
+            newname[j++] = in6pcb.in6p_faddr.s6_addr[i];
+        newname[j++] = ntohs(in6pcb.in6p_fport);
+        if (IN6_IS_ADDR_LINKLOCAL(&in6pcb.in6p_laddr))
+            newname[j++] =
+                ntohs(*(u_int16_t *) & in6pcb.in6p_laddr.s6_addr[2]);
+        else
+            newname[j++] = 0;
+        /*XXX*/ newname[j++] = tcp6statemap[tcp6cb.t_state];
+
+        DEBUGMSGTL(("mibII/ipv6", "var_tcp6 newname: "));
+        DEBUGMSGOID(("mibII/ipv6", newname, *length));
+        DEBUGMSG(("mibII/ipv6", "\nvar_tcp6 oldname: "));
+        DEBUGMSGOID(("mibII/ipv6", name, *length));
+        DEBUGMSG(("mibII/ipv6", " %d\n", exact));
+
+#if 1                           /* this is very odd but sometimes happen, and cause infinite loop */
+        if (ntohs(in6pcb.in6p_lport) == 0)
+            goto skip;
+#endif
+        if (exact) {
+            result = snmp_oid_compare(name, *length, newname, j);
+            if (result == 0) {
+                found++;
+                break;
+            }
+        } else {
+            /*
+             * tcb entries may not be ordered as SNMP scanning code expect.
+             * Therefore, we'll do a guess...
+             * 1. "name" has the previously matched entry.
+             *    If "name" is TCP6 MIBs, take the item that is right next
+             *    to the item exactly matches to "name".
+             * 2. Otherwise, it is the very first time we entered to TCP6 MIBs.
+             */
+            memcpy(tmp1, name, vp->namelen * sizeof(oid));
+            memcpy(tmp2, newname, vp->namelen * sizeof(oid));
+            tmp1[vp->namelen] = 0;
+            tmp2[vp->namelen] = 0;
+            if (*length == j
+                && snmp_oid_compare(tmp1, vp->namelen, tmp2,
+                                    vp->namelen) == 0) {
+                if (!hitnext) {
+                    result = snmp_oid_compare(name, *length, newname, j);
+                    if (result == 0)
+                        hitnext++;
+                } else {
+                    found++;
+                    break;
+                }
+            } else {
+                if (snmp_oid_compare(name, *length, newname, j) < 0) {
+                    found++;
+                    break;
+                }
+            }
+        }
+
+      skip:
+#if !(defined(__FreeBSD__) && __FreeBSD__ >= 3)
+        p = (caddr_t) in6pcb.in6p_next;
+#else
+        xig = (struct xinpgen *) ((char *) xig + xig->xig_len);
+#endif
+    }
+#if defined(__FreeBSD__) && __FreeBSD__ >= 3
+    free(sysctl_buf);
+#endif
+    DEBUGMSGTL(("mibII/ipv6", "found=%d\n", found));
+    if (!found)
+        return NULL;
+    *length = j;
+    memcpy((char *) name, (char *) newname, *length * sizeof(oid));
+    *write_method = 0;
+    *var_len = sizeof(long);    /* default to 'long' results */
+
+    /*
+     * try looking into the kernel variable 
+     */
+    DEBUGMSGTL(("mibII/ipv6", "magic=%d\n", vp->magic));
+    switch (vp->magic) {
+    case IPV6TCPLOCALADDR:
+        *var_len = sizeof(struct in6_addr);
+        return (u_char *) & in6pcb.in6p_laddr.s6_addr[0];
+    case IPV6TCPLOCALPORT:
+        long_return = ntohs(in6pcb.in6p_lport);
+        return (u_char *) & long_return;
+    case IPV6TCPREMOTEADDR:
+        *var_len = sizeof(struct in6_addr);
+        return (u_char *) & in6pcb.in6p_faddr.s6_addr[0];
+    case IPV6TCPREMOTEPORT:
+        long_return = ntohs(in6pcb.in6p_fport);
+        return (u_char *) & long_return;
+    case IPV6TCPIFINDEX:
+        if (IN6_IS_ADDR_LINKLOCAL(&in6pcb.in6p_laddr))
+            long_return =
+                ntohs(*(u_int16_t *) & in6pcb.in6p_laddr.s6_addr[2]);
+        else
+            long_return = 0;
+        /*XXX*/ return (u_char *) & long_return;
+    case IPV6TCPCONNSTATE:
+        long_return = tcp6statemap[tcp6cb.t_state];
+        return (u_char *) & long_return;
+    default:
+        break;
+    }
+    ERROR_MSG("");
+    return NULL;
+}
+#else
+u_char         *
+var_tcp6(register struct variable * vp,
+         oid * name,
+         size_t * length,
+         int exact, size_t * var_len, WriteMethod ** write_method)
+{
+    oid             newname[MAX_OID_LEN];
+    oid             tmp1[MAX_OID_LEN], tmp2[MAX_OID_LEN];
+    int             result;
+    int             i, j;
+    caddr_t         p;
+    static struct in6pcb in6pcb, tcb6;
+    struct tcpcb    tcpcb;
+    int             found, hitnext;
+    static int      tcpstatemap[TCP_NSTATES];
+    static int      initialized = 0;
+#if defined(__FreeBSD__) && __FreeBSD__ >= 3
+    char           *sysctl_buf;
+    struct xinpgen *xig, *oxig;
+#endif                          /* defined(__FreeBSD__) && __FreeBSD__ >= 3 */
+
+    if (!initialized) {
+        tcpstatemap[TCPS_CLOSED] = 1;
+        tcpstatemap[TCPS_LISTEN] = 2;
+        tcpstatemap[TCPS_SYN_SENT] = 3;
+        tcpstatemap[TCPS_SYN_RECEIVED] = 4;
+        tcpstatemap[TCPS_ESTABLISHED] = 5;
+        tcpstatemap[TCPS_CLOSE_WAIT] = 8;
+        tcpstatemap[TCPS_FIN_WAIT_1] = 6;
+        tcpstatemap[TCPS_CLOSING] = 10;
+        tcpstatemap[TCPS_LAST_ACK] = 9;
+        tcpstatemap[TCPS_FIN_WAIT_2] = 7;
+        tcpstatemap[TCPS_TIME_WAIT] = 11;
+        initialized++;
+    }
+
+    DEBUGMSGTL(("mibII/ipv6", "var_tcp6: "));
+    DEBUGMSGOID(("mibII/ipv6", name, *length));
+    DEBUGMSG(("mibII/ipv6", " %d\n", exact));
+
+#if !(defined(__FreeBSD__) && __FreeBSD__ >= 3)
+    if (!auto_nlist("tcb6", (char *) &tcb6, sizeof(tcb6)))
+        return NULL;
+    p = (caddr_t) tcb6.in6p_next;
+#else
+    {
+        const char     *tcblist = "net.inet.tcp.pcblist";
+        int             len;
+
+        if (sysctlbyname(tcblist, 0, &len, 0, 0) < 0)
+            return NULL;
+        if ((sysctl_buf = malloc(len)) == NULL)
+            return NULL;
+        if (sysctlbyname(tcblist, sysctl_buf, &len, 0, 0) < 0) {
+            free(sysctl_buf);
+            return NULL;
+        }
+        oxig = (struct xinpgen *) sysctl_buf;
+        xig = (struct xinpgen *) ((char *) oxig + oxig->xig_len);
+    }
+#endif
+
+    found = hitnext = 0;
+    memcpy((char *) newname, (char *) vp->name,
+           (int) vp->namelen * sizeof(oid));
+    while (
+#if !(defined(__FreeBSD__) && __FreeBSD__ >= 3)
+              p && (u_long) p != auto_nlist_value("tcb6")
+#else
+              xig->xig_len > sizeof(struct xinpgen)
+#endif
+        ) {
+        DEBUGMSGTL(("mibII/ipv6", "looping: p=%x\n", p));
+
+#if !(defined(__FreeBSD__) && __FreeBSD__ >= 3)
+        if (klookup((u_long) p, (char *) &in6pcb, sizeof(in6pcb)) < 0)
+#else
+        in6pcb = ((struct xinpcb *) xig)->xi_inp;
+#endif
+        {
+            DEBUGMSGTL(("mibII/ipv6", "klookup fail for in6pcb at %x\n",
+                        p));
+            break;
+        }
+        if (klookup
+            ((u_long) in6pcb.in6p_ppcb, (char *) &tcpcb, sizeof(tcpcb))
+            < 0) {
+            DEBUGMSGTL(("mibII/ipv6", "klookup fail for tcpcb at %x\n",
+                        in6pcb.in6p_ppcb));
+            break;
+        }
+        j = (int) vp->namelen;
+        for (i = 0; i < sizeof(struct in6_addr); i++)
+            newname[j++] = in6pcb.in6p_laddr.s6_addr[i];
+        newname[j++] = ntohs(in6pcb.in6p_lport);
+        for (i = 0; i < sizeof(struct in6_addr); i++)
+            newname[j++] = in6pcb.in6p_faddr.s6_addr[i];
+        newname[j++] = ntohs(in6pcb.in6p_fport);
+        if (IN6_IS_ADDR_LINKLOCAL(&in6pcb.in6p_laddr))
+            newname[j++] =
+                ntohs(*(u_int16_t *) & in6pcb.in6p_laddr.s6_addr[2]);
+        else
+            newname[j++] = 0;
+        /*XXX*/ newname[j++] = tcpstatemap[tcpcb.t_state];
+
+        DEBUGMSGTL(("mibII/ipv6", "var_tcp6 newname: "));
+        DEBUGMSGOID(("mibII/ipv6", newname, *length));
+        DEBUGMSG(("mibII/ipv6", "\nvar_tcp6 oldname: "));
+        DEBUGMSGOID(("mibII/ipv6", name, *length));
+        DEBUGMSG(("mibII/ipv6", " %d\n", exact));
+
+#if 1                           /* this is very odd but sometimes happen, and cause infinite loop */
+        if (ntohs(in6pcb.in6p_lport) == 0)
+            goto skip;
+#endif
+        if (exact) {
+            result = snmp_oid_compare(name, *length, newname, j);
+            if (result == 0) {
+                found++;
+                break;
+            }
+        } else {
+            /*
+             * tcb entries may not be ordered as SNMP scanning code expect.
+             * Therefore, we'll do a guess...
+             * 1. "name" has the previously matched entry.
+             *    If "name" is TCP6 MIBs, take the item that is right next
+             *    to the item exactly matches to "name".
+             * 2. Otherwise, it is the very first time we entered to TCP6 MIBs.
+             */
+            memcpy(tmp1, name, vp->namelen * sizeof(oid));
+            memcpy(tmp2, newname, vp->namelen * sizeof(oid));
+            tmp1[vp->namelen] = 0;
+            tmp2[vp->namelen] = 0;
+            if (*length == j
+                && snmp_oid_compare(tmp1, vp->namelen, tmp2,
+                                    vp->namelen) == 0) {
+                if (!hitnext) {
+                    result = snmp_oid_compare(name, *length, newname, j);
+                    if (result == 0)
+                        hitnext++;
+                } else {
+                    found++;
+                    break;
+                }
+            } else {
+                if (snmp_oid_compare(name, *length, newname, j) < 0) {
+                    found++;
+                    break;
+                }
+            }
+        }
+
+      skip:
+#if !(defined(__FreeBSD__) && __FreeBSD__ >= 3)
+        p = (caddr_t) in6pcb.in6p_next;
+#else
+        xig = (struct xinpgen *) ((char *) xig + xig->xig_len);
+#endif
+    }
+    DEBUGMSGTL(("mibII/ipv6", "found=%d\n", found));
+    if (!found)
+        return NULL;
+    *length = j;
+    memcpy((char *) name, (char *) newname, *length * sizeof(oid));
+    *write_method = 0;
+    *var_len = sizeof(long);    /* default to 'long' results */
+
+    /*
+     * try looking into the kernel variable 
+     */
+    DEBUGMSGTL(("mibII/ipv6", "magic=%d\n", vp->magic));
+    switch (vp->magic) {
+    case IPV6TCPLOCALADDR:
+        *var_len = sizeof(struct in6_addr);
+        return (u_char *) & in6pcb.in6p_laddr.s6_addr[0];
+    case IPV6TCPLOCALPORT:
+        long_return = ntohs(in6pcb.in6p_lport);
+        return (u_char *) & long_return;
+    case IPV6TCPREMOTEADDR:
+        *var_len = sizeof(struct in6_addr);
+        return (u_char *) & in6pcb.in6p_faddr.s6_addr[0];
+    case IPV6TCPREMOTEPORT:
+        long_return = ntohs(in6pcb.in6p_fport);
+        return (u_char *) & long_return;
+    case IPV6TCPIFINDEX:
+        if (IN6_IS_ADDR_LINKLOCAL(&in6pcb.in6p_laddr))
+            long_return =
+                ntohs(*(u_int16_t *) & in6pcb.in6p_laddr.s6_addr[2]);
+        else
+            long_return = 0;
+        /*XXX*/ return (u_char *) & long_return;
+    case IPV6TCPCONNSTATE:
+        long_return = tcpstatemap[tcpcb.t_state];
+        return (u_char *) & long_return;
+    default:
+        break;
+    }
+    ERROR_MSG("");
+    return NULL;
+}
+
+#endif                          /*TCP6 */
+
+#else                           /* !linux / linux */
+
+/*
+ * Linux dependent part 
+ */
+static unsigned long
+linux_read_ip6_stat_ulong(const char *file)
+{
+    FILE           *f;
+    unsigned long   value;
+    f = fopen(file, "r");
+    if (!f)
+        return 0;
+    if (fscanf(f, "%lu", &value) != 1) {
+        fclose(f);
+        return 0;
+    }
+    fclose(f);
+    return value;
+}
+
+void
+linux_read_ip6_stat(struct ip6_mib *ip6stat)
+{
+    if (!ip6stat)
+        return;
+    memset(ip6stat, 0, sizeof(*ip6stat));
+    ip6stat->Ipv6Forwarding =
+        linux_read_ip6_stat_ulong
+        ("/proc/sys/net/ipv6/conf/all/forwarding");
+    ip6stat->Ipv6DefaultHopLimit =
+        linux_read_ip6_stat_ulong
+        ("/proc/sys/net/ipv6/conf/default/hop_limit");
+}
+
+u_char         *
+var_ipv6(register struct variable *vp,
+         oid * name,
+         size_t * length,
+         int exact, size_t * var_len, WriteMethod ** write_method)
+{
+    int             i;
+    static struct ip6_mib ip6stat;
+
+    if (header_ipv6(vp, name, length, exact, var_len, write_method)
+        == MATCH_FAILED) {
+        return NULL;
+    }
+    linux_read_ip6_stat(&ip6stat);
+
+    switch (vp->magic) {
+    case IPV6DEFAULTHOPLIMIT:
+        return (u_char *) & ip6stat.Ipv6DefaultHopLimit;
+    case IPV6FORWARDING:
+        return (u_char *) & ip6stat.Ipv6Forwarding;
+    case IPV6INTERFACES:
+#ifdef HAVE_IF_NAMEINDEX
+        long_return = if_countifindex();
+        if (long_return < 0)
+            break;
+        return (u_char *) & long_return;
+#endif
+        break;
+    default:
+        DEBUGMSGTL(("snmpd", "unknonw sub-id %d in var_ipv6\n",
+                    vp->magic));
+    }
+    return NULL;
+}
+
+u_char         *
+var_ifv6Entry(register struct variable * vp,
+              oid * name,
+              size_t * length,
+              int exact, size_t * var_len, WriteMethod ** write_method)
+{
+#ifndef HAVE_IF_NAMEINDEX
+    return NULL;
+#else
+    int             interface;
+    int             max;
+    char           *p;
+    struct ifreq    ifr;
+    int             s;
+
+    max = if_maxifindex();
+    if (max < 0)
+        return NULL;
+
+    if (header_ipv6_scan
+        (vp, name, length, exact, var_len, write_method, 1, max)
+        == MATCH_FAILED) {
+        return NULL;
+    }
+    interface = name[*length - 1];
+    DEBUGMSGTL(("mibII/ipv6", "interface: %d(%s)\n",
+                interface, if_getname(interface)));
+    if (interface > max)
+        return NULL;
+
+    switch (vp->magic) {
+    case IPV6IFDESCR:
+        p = if_getname(interface);
+        if (p) {
+            *var_len = strlen(p);
+            return p;
+        }
+        break;
+    case IPV6IFLOWLAYER:
+        /*
+         * should check if type, this is a hard one... 
+         */
+        *var_len = nullOidLen;
+        return (u_char *) nullOid;
+    case IPV6IFEFFECTMTU:
+        {
+            p = if_getname(interface);
+            if (!p)
+                break;
+            memset(&ifr, 0, sizeof(ifr));
+            ifr.ifr_addr.sa_family = AF_INET6;
+            strncpy(ifr.ifr_name, p, sizeof(ifr.ifr_name));
+            if ((s = socket(ifr.ifr_addr.sa_family, SOCK_DGRAM, 0)) < 0)
+                break;
+            if (ioctl(s, SIOCGIFMTU, (caddr_t) & ifr) < 0) {
+                close(s);
+                break;
+            }
+            long_return = ifr.ifr_mtu;
+            close(s);
+            return (u_char *) & long_return;
+        }
+    case IPV6IFPHYSADDRESS:
+        {
+            static struct ifreq buf;
+            int             ok = 0;
+            p = if_getname(interface);
+            if (!p)
+                break;
+            memset(&ifr, 0, sizeof(ifr));
+            ifr.ifr_addr.sa_family = AF_INET6;
+            strncpy(ifr.ifr_name, p, sizeof(ifr.ifr_name));
+            if ((s = socket(ifr.ifr_addr.sa_family, SOCK_DGRAM, 0)) < 0)
+                break;
+            if (ioctl(s, SIOCGIFHWADDR, &ifr) < 0) {
+                memset(buf.ifr_hwaddr.sa_data, 0,
+                       sizeof(buf.ifr_hwaddr.sa_data));
+                *var_len = 0;
+            } else {
+                memcpy(buf.ifr_hwaddr.sa_data, ifr.ifr_hwaddr.sa_data, 6);
+                *var_len = (buf.ifr_hwaddr.sa_data[0] |
+                            buf.ifr_hwaddr.sa_data[1] |
+                            buf.ifr_hwaddr.sa_data[2] |
+                            buf.ifr_hwaddr.sa_data[3] |
+                            buf.ifr_hwaddr.sa_data[4] |
+                            buf.ifr_hwaddr.sa_data[5]) ? 6 : 0;
+                ok = 1;
+            }
+            close(s);
+            return (ok ? ((u_char *) & buf.ifr_hwaddr.sa_data) : NULL);
+        }
+    case IPV6IFADMSTATUS:
+    case IPV6IFOPERSTATUS:
+        {
+            int             flag = 0;
+            p = if_getname(interface);
+            if (!p)
+                break;
+            memset(&ifr, 0, sizeof(ifr));
+            ifr.ifr_addr.sa_family = AF_INET6;
+            strncpy(ifr.ifr_name, p, sizeof(ifr.ifr_name));
+            if ((s = socket(ifr.ifr_addr.sa_family, SOCK_DGRAM, 0)) < 0)
+                break;
+            if (ioctl(s, SIOCGIFFLAGS, &ifr) < 0) {
+                close(s);
+                break;
+            }
+            switch (vp->magic) {
+            case IPV6IFADMSTATUS:
+                flag = IFF_RUNNING;
+                break;
+            case IPV6IFOPERSTATUS:
+                flag = IFF_UP;
+                break;
+            }
+            long_return = (ifr.ifr_flags & flag) ? 1 : 2;
+            return (u_char *) & long_return;
+        }
+    }
+    return NULL;
+#endif
+}
+
+u_char         *
+var_icmpv6Entry(register struct variable * vp,
+                oid * name,
+                size_t * length,
+                int exact, size_t * var_len, WriteMethod ** write_method)
+{
+    return NULL;
+}
+
+u_char         *
+var_udp6(register struct variable * vp,
+         oid * name,
+         size_t * length,
+         int exact, size_t * var_len, WriteMethod ** write_method)
+{
+    return NULL;
+}
+
+u_char         *
+var_tcp6(register struct variable * vp,
+         oid * name,
+         size_t * length,
+         int exact, size_t * var_len, WriteMethod ** write_method)
+{
+    return NULL;
+}
+
+/*
+ * misc functions (against broken kernels ) 
+ */
+void
+linux_if_freenameindex(struct if_nameindex *ifndx)
+{
+    int             i;
+    if (!ifndx)
+        return;
+    for (i = 1; ifndx[i].if_index; i++) {
+        free(ifndx[i].if_name);
+    }
+    free(ifndx);
+}
+
+#define linux_freeinternalnameindex(ifni, max)  { \
+  int i; 					\
+  for (i=1; i<=max; i++){			\
+    if (ifni[i].if_name) free(ifni[i].if_name);	\
+  }						\
+  free(ifni);					\
+}
+
+#define LINUX_PROC_NET_IFINET6 "/proc/net/if_inet6"
+struct if_nameindex *
+linux_if_nameindex(void)
+{
+    FILE           *f;
+    unsigned long   if_index;
+    char            if_name[256];
+    struct if_nameindex *ifndx = NULL, *iflist = NULL, *new;
+    int             i, j;
+    int             maxidx, if_count = 0;
+
+    f = fopen(LINUX_PROC_NET_IFINET6, "r");
+    if (f) {
+        if_count = 0;
+        maxidx = -1;
+        while (!feof(f)) {
+            if (fscanf(f, "%*s %lx %*x %*x %*x %s",
+                       &if_index, if_name) != 2)
+                continue;
+            if (if_index == 0)
+                continue;
+            if_name[sizeof(if_name) - 1] = '\0';
+            if (maxidx < 0 || maxidx < if_index) {
+
+                new =
+                    realloc(iflist,
+                            (sizeof(struct if_nameindex)) * (if_index +
+                                                             2));
+                if (!new) {
+                    linux_freeinternalnameindex(iflist, if_index);
+                    if_count = 0;
+                    iflist = NULL;
+                    break;
+                }
+                iflist = new;
+                for (i = maxidx + 1; i <= if_index; i++)
+                    memset(&iflist[i], 0, sizeof(struct if_nameindex));
+                memset(&iflist[if_index + 1], 0,
+                       sizeof(struct if_nameindex));
+                maxidx = if_index;
+            }
+            if (iflist[if_index].if_index == 0) {
+                if_count++;
+                iflist[if_index].if_index = if_index;
+                iflist[if_index].if_name = strdup(if_name);
+                if (!iflist[if_index].if_name) {
+                    linux_freeinternalnameindex(iflist, if_index);
+                    if_count = 0;
+                    iflist = NULL;
+                    break;
+                }
+            }
+        }
+        fclose(f);
+        if (if_count > 0) {
+            ifndx = malloc(sizeof(struct if_nameindex) * (if_count + 1));
+            j = 0;
+            for (i = 1; i <= maxidx; i++) {
+                if (iflist[i].if_index > 0 && *iflist[i].if_name) {
+                    memcpy(&ifndx[j++], &iflist[i],
+                           sizeof(struct if_nameindex));
+                }
+            }
+            ifndx[j].if_index = 0;
+            ifndx[j].if_name = NULL;
+        }
+        free(iflist);
+    }
+    return (ifndx);
+}
+
+#endif                          /* linux */
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/mibII/ipv6.h tomato121/release/src/router/snmp/agent/mibgroup/mibII/ipv6.h
--- tomato/release/src/router/snmp/agent/mibgroup/mibII/ipv6.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/mibII/ipv6.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,144 @@
+/*
+ *  Template MIB group interface - ipv6.h
+ *
+ */
+
+#ifndef _MIBGROUP_IPV6_H
+#define _MIBGROUP_IPV6_H
+
+#ifdef linux
+struct ip6_mib {
+    unsigned long   Ipv6DefaultHopLimit;
+    unsigned long   Ipv6Forwarding;
+};
+#endif
+
+config_require(mibII/interfaces mibII/at mibII/var_route mibII/route_write)
+config_add_mib(IPV6-ICMP-MIB:IPV6-MIB:IPV6-TCP-MIB:IPV6-UDP-MIB)
+config_arch_require(solaris2, kernel_sunos5)
+#include "var_route.h"
+#include "route_write.h"
+extern void     init_ipv6(void);
+extern FindVarMethod var_ipv6;
+extern FindVarMethod var_ifv6Entry;
+extern FindVarMethod var_icmpv6Entry;
+extern FindVarMethod var_udp6;
+extern FindVarMethod var_tcp6;
+
+#include "at.h"                 /* for var_atEntry() */
+
+#define IPV6FORWARDING		1
+#define IPV6DEFAULTHOPLIMIT	2
+#define IPV6INTERFACES		3
+#define IPV6IFTBLLASTCHG	4
+
+#define IPV6IFDESCR		2
+#define IPV6IFLOWLAYER		3
+#define IPV6IFEFFECTMTU		4
+#define IPV6IFREASMMAXSIZE	5
+#define IPV6IFTOKEN		6
+#define IPV6IFTOKENLEN		7
+#define IPV6IFPHYSADDRESS	8
+#define IPV6IFADMSTATUS		9
+#define IPV6IFOPERSTATUS	10
+#define IPV6IFLASTCHANGE	11
+
+#define IPV6IFSTATSINRCVS	12
+#define IPV6IFSTATSINHDRERRS	13
+#define IPV6IFSTATSTOOBIGERRS	14
+#define IPV6IFSTATSINNOROUTES	15
+#define IPV6IFSTATSINADDRERRS	16
+#define IPV6IFSTATSINUNKNOWPROTS	17
+#define IPV6IFSTATSINTRUNCATPKTS	18
+#define IPV6IFSTATSINDISCARDS	19
+#define IPV6IFSTATSINDELIVERS	20
+#define IPV6IFSTATSOUTFORWDATAS	21
+#define IPV6IFSTATSOUTREQS	22
+#define IPV6IFSTATSOUTDISCARDS	23
+#define IPV6IFSTATSOUTFRAGOKS	24
+#define IPV6IFSTATSOUTFRAGFAILS	25
+#define IPV6IFSTATSOUTFRAGCREATS	26
+#define IPV6IFSTATSOUTREASMREQS	27
+#define IPV6IFSTATSOUTREASMOKS	28
+#define IPV6IFSTATSOUTREASMFAILS	29
+#define IPV6IFSTATSINMCASTPKTS	30
+#define IPV6IFSTATSOUTMCASTPKTS	31
+
+#define IPV6ADDRPREFIXONLINKFLG	3
+#define IPV6ADDRPREFIXAUTONOMOUSFLAG	4
+#define IPV6ADDRPREFIXADVPREFERLIFE	5
+#define IPV6ADDRPREFIXVALIDLIFE	6
+
+#define IPV6ADDRPFXLEN		7
+#define IPV6ADDRTYPE		8
+#define IPV6ADDRANYCASTFLAG	9
+#define IPV6ADDRSTATUS		10
+
+#define IPV6INSTALLEDROUTES	5
+#define IPV6DISCARDEDROUTES	6
+
+#define IPV6ROUTEIFINDEX	4
+#define IPV6ROUTENEXTHOP	5
+#define IPV6ROUTETYPE		6
+#define IPV6ROUTEPROTOCOL	7
+#define IPV6ROUTEPOLICY		8
+#define IPV6ROUTEAGE		9
+#define IPV6ROUTENEXTHOPRDI	10
+#define IPV6ROUTEMETRIC		11
+#define IPV6ROUTEWEIGHT		12
+#define IPV6ROUTEINFO		13
+#define IPV6ROUTEVALID		14
+
+#define IPV6NETTOMEDIAPHYADDR	2
+#define IPV6NETTOMEDIATYPE	3
+#define IPV6NETTOMEDIASTATE	4
+#define IPV6NETTOMEDIALASTUPDATE	5
+#define IPV6NETTOMEDIAVALID	6
+
+#define IPV6IFICMPINMSG		1
+#define IPV6IFICMPINERRORS	2
+#define IPV6IFICMPINDSTUNRCHS	3
+#define IPV6IFICMPINADMPROHS	4
+#define IPV6IFICMPINTIMEXCDS	5
+#define IPV6IFICMPINPARMPROBS	6
+#define IPV6IFICMPINPKTTOOBIGS	7
+#define IPV6IFICMPINECHOS	8
+#define IPV6IFICMPINECHOREPS	9
+#define IPV6IFICMPINRTRSLICITS	10
+#define IPV6IFICMPINRTRADVS	11
+#define IPV6IFICMPINNBRSLICITS	12
+#define IPV6IFICMPINNBRADVS	13
+#define IPV6IFICMPINREDIRECTS	14
+#define IPV6IFICMPINGRPMEQERYS	15
+#define IPV6IFICMPINGRPMERSPS	16
+#define IPV6IFICMPINGRPMEREDCS	17
+#define IPV6IFICMPOUTMSG	18
+#define IPV6IFICMPOUTERRORS	19
+#define IPV6IFICMPOUTDSTUNRCHS	20
+#define IPV6IFICMPOUTADMPROHS	21
+#define IPV6IFICMPOUTTIMEXCDS	22
+#define IPV6IFICMPOUTPARMPROBS	23
+#define IPV6IFICMPOUTPKTTOOBIGS	24
+#define IPV6IFICMPOUTECHOS	25
+#define IPV6IFICMPOUTECHOREPS	26
+#define IPV6IFICMPOUTRTRSLICITS	27
+#define IPV6IFICMPOUTRTRADVS	28
+#define IPV6IFICMPOUTNBRSLICITS	29
+#define IPV6IFICMPOUTNBRADVS	30
+#define IPV6IFICMPOUTREDIRECTS	31
+#define IPV6IFICMPOUTGRPMEQERYS	32
+#define IPV6IFICMPOUTGRPMERSPS	33
+#define IPV6IFICMPOUTGRPMEREDCS	34
+
+#define IPV6UDPLOCALADDRESS	1
+#define IPV6UDPLOCALPORT	2
+#define IPV6UDPIFINDEX		3
+
+#define IPV6TCPLOCALADDR	1
+#define IPV6TCPLOCALPORT	2
+#define IPV6TCPREMOTEADDR	3
+#define IPV6TCPREMOTEPORT	4
+#define IPV6TCPIFINDEX		5
+#define IPV6TCPCONNSTATE	6
+
+#endif                          /* _MIBGROUP_IPV6_H */
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/mibII/kernel_linux.c tomato121/release/src/router/snmp/agent/mibgroup/mibII/kernel_linux.c
--- tomato/release/src/router/snmp/agent/mibgroup/mibII/kernel_linux.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/mibII/kernel_linux.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,207 @@
+/*
+ *  Linux kernel interface
+ *
+ */
+
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+#include "util_funcs.h"
+
+#if HAVE_STRING_H
+#include <string.h>
+#endif
+#include <sys/types.h>
+#if HAVE_SYS_PARAM_H
+#include <sys/param.h>
+#endif
+
+#include "kernel_linux.h"
+
+struct ip_mib   cached_ip_mib;
+struct icmp_mib cached_icmp_mib;
+struct tcp_mib  cached_tcp_mib;
+struct udp_mib  cached_udp_mib;
+
+#define IP_STATS_LINE	"Ip: %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu"
+#define ICMP_STATS_LINE	"Icmp: %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu"
+#define TCP_STATS_LINE	"Tcp: %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu"
+#define UDP_STATS_LINE	"Udp: %lu %lu %lu %lu"
+
+#define IP_STATS_PREFIX_LEN	4
+#define ICMP_STATS_PREFIX_LEN	6
+#define TCP_STATS_PREFIX_LEN	5
+#define UDP_STATS_PREFIX_LEN	5
+
+#ifndef MIB_STATS_CACHE_TIMEOUT
+#define MIB_STATS_CACHE_TIMEOUT	5
+#endif
+#ifndef LINUX_STATS_CACHE_TIMEOUT
+#define LINUX_STATS_CACHE_TIMEOUT	MIB_STATS_CACHE_TIMEOUT
+#endif
+marker_t        linux_mibII_stats_cache_marker = NULL;
+
+int
+linux_read_mibII_stats(void)
+{
+    FILE           *in = fopen("/proc/net/snmp", "r");
+    char            line[1024];
+
+    if (!in) {
+        free(linux_mibII_stats_cache_marker);
+        linux_mibII_stats_cache_marker = NULL;
+        return -1;
+    }
+
+    if (linux_mibII_stats_cache_marker &&
+        (!atime_ready
+         (linux_mibII_stats_cache_marker,
+          LINUX_STATS_CACHE_TIMEOUT * 1000))) {
+        fclose(in);
+        return 0;
+    }
+
+    if (linux_mibII_stats_cache_marker)
+        atime_setMarker(linux_mibII_stats_cache_marker);
+    else
+        linux_mibII_stats_cache_marker = atime_newMarker();
+
+
+    while (line == fgets(line, sizeof(line), in)) {
+        if (!strncmp(line, IP_STATS_LINE, IP_STATS_PREFIX_LEN)) {
+            sscanf(line, IP_STATS_LINE,
+                   &cached_ip_mib.ipForwarding,
+                   &cached_ip_mib.ipDefaultTTL,
+                   &cached_ip_mib.ipInReceives,
+                   &cached_ip_mib.ipInHdrErrors,
+                   &cached_ip_mib.ipInAddrErrors,
+                   &cached_ip_mib.ipForwDatagrams,
+                   &cached_ip_mib.ipInUnknownProtos,
+                   &cached_ip_mib.ipInDiscards,
+                   &cached_ip_mib.ipInDelivers,
+                   &cached_ip_mib.ipOutRequests,
+                   &cached_ip_mib.ipOutDiscards,
+                   &cached_ip_mib.ipOutNoRoutes,
+                   &cached_ip_mib.ipReasmTimeout,
+                   &cached_ip_mib.ipReasmReqds,
+                   &cached_ip_mib.ipReasmOKs,
+                   &cached_ip_mib.ipReasmFails,
+                   &cached_ip_mib.ipFragOKs,
+                   &cached_ip_mib.ipFragFails,
+                   &cached_ip_mib.ipFragCreates);
+            cached_ip_mib.ipRoutingDiscards = 0;        /* XXX */
+        } else if (!strncmp(line, ICMP_STATS_LINE, ICMP_STATS_PREFIX_LEN)) {
+            sscanf(line, ICMP_STATS_LINE,
+                   &cached_icmp_mib.icmpInMsgs,
+                   &cached_icmp_mib.icmpInErrors,
+                   &cached_icmp_mib.icmpInDestUnreachs,
+                   &cached_icmp_mib.icmpInTimeExcds,
+                   &cached_icmp_mib.icmpInParmProbs,
+                   &cached_icmp_mib.icmpInSrcQuenchs,
+                   &cached_icmp_mib.icmpInRedirects,
+                   &cached_icmp_mib.icmpInEchos,
+                   &cached_icmp_mib.icmpInEchoReps,
+                   &cached_icmp_mib.icmpInTimestamps,
+                   &cached_icmp_mib.icmpInTimestampReps,
+                   &cached_icmp_mib.icmpInAddrMasks,
+                   &cached_icmp_mib.icmpInAddrMaskReps,
+                   &cached_icmp_mib.icmpOutMsgs,
+                   &cached_icmp_mib.icmpOutErrors,
+                   &cached_icmp_mib.icmpOutDestUnreachs,
+                   &cached_icmp_mib.icmpOutTimeExcds,
+                   &cached_icmp_mib.icmpOutParmProbs,
+                   &cached_icmp_mib.icmpOutSrcQuenchs,
+                   &cached_icmp_mib.icmpOutRedirects,
+                   &cached_icmp_mib.icmpOutEchos,
+                   &cached_icmp_mib.icmpOutEchoReps,
+                   &cached_icmp_mib.icmpOutTimestamps,
+                   &cached_icmp_mib.icmpOutTimestampReps,
+                   &cached_icmp_mib.icmpOutAddrMasks,
+                   &cached_icmp_mib.icmpOutAddrMaskReps);
+        } else if (!strncmp(line, TCP_STATS_LINE, TCP_STATS_PREFIX_LEN)) {
+            int             ret = sscanf(line, TCP_STATS_LINE,
+                                         &cached_tcp_mib.tcpRtoAlgorithm,
+                                         &cached_tcp_mib.tcpRtoMin,
+                                         &cached_tcp_mib.tcpRtoMax,
+                                         &cached_tcp_mib.tcpMaxConn,
+                                         &cached_tcp_mib.tcpActiveOpens,
+                                         &cached_tcp_mib.tcpPassiveOpens,
+                                         &cached_tcp_mib.tcpAttemptFails,
+                                         &cached_tcp_mib.tcpEstabResets,
+                                         &cached_tcp_mib.tcpCurrEstab,
+                                         &cached_tcp_mib.tcpInSegs,
+                                         &cached_tcp_mib.tcpOutSegs,
+                                         &cached_tcp_mib.tcpRetransSegs,
+                                         &cached_tcp_mib.tcpInErrs,
+                                         &cached_tcp_mib.tcpOutRsts);
+            cached_tcp_mib.tcpInErrsValid = (ret > 12) ? 1 : 0;
+            cached_tcp_mib.tcpOutRstsValid = (ret > 13) ? 1 : 0;
+        } else if (!strncmp(line, UDP_STATS_LINE, UDP_STATS_PREFIX_LEN)) {
+            sscanf(line, UDP_STATS_LINE,
+                   &cached_udp_mib.udpInDatagrams,
+                   &cached_udp_mib.udpNoPorts,
+                   &cached_udp_mib.udpInErrors,
+                   &cached_udp_mib.udpOutDatagrams);
+        }
+    }
+    fclose(in);
+
+    /*
+     * Tweak illegal values:
+     *
+     * valid values for ipForwarding are 1 == yup, 2 == nope
+     * a 0 is forbidden, so patch:
+     */
+    if (!cached_ip_mib.ipForwarding)
+        cached_ip_mib.ipForwarding = 2;
+
+    /*
+     * 0 is illegal for tcpRtoAlgorithm
+     * so assume `other' algorithm:
+     */
+    if (!cached_tcp_mib.tcpRtoAlgorithm)
+        cached_tcp_mib.tcpRtoAlgorithm = 1;
+    return 0;
+}
+
+int
+linux_read_ip_stat(struct ip_mib *ipstat)
+{
+    memset((char *) ipstat, (0), sizeof(*ipstat));
+    if (linux_read_mibII_stats() == -1)
+        return -1;
+    memcpy((char *) ipstat, (char *) &cached_ip_mib, sizeof(*ipstat));
+    return 0;
+}
+
+int
+linux_read_icmp_stat(struct icmp_mib *icmpstat)
+{
+    memset((char *) icmpstat, (0), sizeof(*icmpstat));
+    if (linux_read_mibII_stats() == -1)
+        return -1;
+    memcpy((char *) icmpstat, (char *) &cached_icmp_mib,
+           sizeof(*icmpstat));
+    return 0;
+}
+
+int
+linux_read_tcp_stat(struct tcp_mib *tcpstat)
+{
+    memset((char *) tcpstat, (0), sizeof(*tcpstat));
+    if (linux_read_mibII_stats() == -1)
+        return -1;
+    memcpy((char *) tcpstat, (char *) &cached_tcp_mib, sizeof(*tcpstat));
+    return 0;
+}
+
+int
+linux_read_udp_stat(struct udp_mib *udpstat)
+{
+    memset((char *) udpstat, (0), sizeof(*udpstat));
+    if (linux_read_mibII_stats() == -1)
+        return -1;
+    memcpy((char *) udpstat, (char *) &cached_udp_mib, sizeof(*udpstat));
+    return 0;
+}
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/mibII/kernel_linux.h tomato121/release/src/router/snmp/agent/mibgroup/mibII/kernel_linux.h
--- tomato/release/src/router/snmp/agent/mibgroup/mibII/kernel_linux.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/mibII/kernel_linux.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,94 @@
+/*
+ *  MIB statistics gathering routines
+ *      for Linux architecture
+ */
+
+#ifndef _MIBGROUP_KERNEL_LINUX_H
+#define _MIBGROUP_KERNEL_LINUX_H
+
+struct ip_mib {
+    unsigned long   ipForwarding;
+    unsigned long   ipDefaultTTL;
+    unsigned long   ipInReceives;
+    unsigned long   ipInHdrErrors;
+    unsigned long   ipInAddrErrors;
+    unsigned long   ipForwDatagrams;
+    unsigned long   ipInUnknownProtos;
+    unsigned long   ipInDiscards;
+    unsigned long   ipInDelivers;
+    unsigned long   ipOutRequests;
+    unsigned long   ipOutDiscards;
+    unsigned long   ipOutNoRoutes;
+    unsigned long   ipReasmTimeout;
+    unsigned long   ipReasmReqds;
+    unsigned long   ipReasmOKs;
+    unsigned long   ipReasmFails;
+    unsigned long   ipFragOKs;
+    unsigned long   ipFragFails;
+    unsigned long   ipFragCreates;
+    unsigned long   ipRoutingDiscards;
+};
+
+struct icmp_mib {
+    unsigned long   icmpInMsgs;
+    unsigned long   icmpInErrors;
+    unsigned long   icmpInDestUnreachs;
+    unsigned long   icmpInTimeExcds;
+    unsigned long   icmpInParmProbs;
+    unsigned long   icmpInSrcQuenchs;
+    unsigned long   icmpInRedirects;
+    unsigned long   icmpInEchos;
+    unsigned long   icmpInEchoReps;
+    unsigned long   icmpInTimestamps;
+    unsigned long   icmpInTimestampReps;
+    unsigned long   icmpInAddrMasks;
+    unsigned long   icmpInAddrMaskReps;
+    unsigned long   icmpOutMsgs;
+    unsigned long   icmpOutErrors;
+    unsigned long   icmpOutDestUnreachs;
+    unsigned long   icmpOutTimeExcds;
+    unsigned long   icmpOutParmProbs;
+    unsigned long   icmpOutSrcQuenchs;
+    unsigned long   icmpOutRedirects;
+    unsigned long   icmpOutEchos;
+    unsigned long   icmpOutEchoReps;
+    unsigned long   icmpOutTimestamps;
+    unsigned long   icmpOutTimestampReps;
+    unsigned long   icmpOutAddrMasks;
+    unsigned long   icmpOutAddrMaskReps;
+};
+
+struct udp_mib {
+    unsigned long   udpInDatagrams;
+    unsigned long   udpNoPorts;
+    unsigned long   udpInErrors;
+    unsigned long   udpOutDatagrams;
+};
+
+struct tcp_mib {
+    unsigned long   tcpRtoAlgorithm;
+    unsigned long   tcpRtoMin;
+    unsigned long   tcpRtoMax;
+    unsigned long   tcpMaxConn;
+    unsigned long   tcpActiveOpens;
+    unsigned long   tcpPassiveOpens;
+    unsigned long   tcpAttemptFails;
+    unsigned long   tcpEstabResets;
+    unsigned long   tcpCurrEstab;
+    unsigned long   tcpInSegs;
+    unsigned long   tcpOutSegs;
+    unsigned long   tcpRetransSegs;
+    unsigned long   tcpInErrs;
+    unsigned long   tcpOutRsts;
+    short           tcpInErrsValid;
+    short           tcpOutRstsValid;
+};
+
+
+int             linux_read_ip_stat(struct ip_mib *);
+int             linux_read_icmp_stat(struct icmp_mib *);
+int             linux_read_udp_stat(struct udp_mib *);
+int             linux_read_tcp_stat(struct tcp_mib *);
+extern marker_t linux_mibII_stats_cache_marker;
+
+#endif                          /* _MIBGROUP_KERNEL_LINUX_H */
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/mibII/mta_sendmail.c tomato121/release/src/router/snmp/agent/mibgroup/mibII/mta_sendmail.c
--- tomato/release/src/router/snmp/agent/mibgroup/mibII/mta_sendmail.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/mibII/mta_sendmail.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,1496 @@
+/*
+ *  MTA-MIB implementation for sendmail - mibII/mta_sendmail.c
+ *  Christoph Mammitzsch <Christoph.Mammitzsch@tu-clausthal.de>
+ *
+ * todo: put queue directory into description?
+ *
+ *  13.02.2002:
+ *    - support sendmail 8.12 queue groups
+ *
+ *
+ *  05.04.2000:
+ *
+ *    - supports sendmail 8.10.0 statistics files now
+ *    - function read_option has been removed
+ *
+ *  12.04.2000:
+ *
+ *    - renamed configuration tokens:
+ *        sendmail config        -> sendmail_config
+ *        sendmail stats         -> sendmail_stats
+ *        sendmail queue         -> sendmail_queue
+ *        sendmail index         -> sendmail_index
+ *        sendmail statcachetime -> sendmail_stats_t
+ *        sendmail dircacetime   -> sendmail_queue_t
+ *
+ *    - now using snmpd_register_config_handler instead of config_parse_dot_conf
+ *
+ *  15.04.2000:
+ *
+ *    - introduced new function print_error
+ *    - changed open_sendmailst and read_sendmailcf to use the new function
+ *    - changed calls to open_sendmailst and read_sendmailcf
+ *    - added some error handling to calls to chdir(), close() and closedir()
+ *
+ */
+
+
+/** "include files" */
+#ifdef __lint
+# define SNMP_NO_DEBUGGING 1    /* keeps lint from complaining about the DEBUGMSG* macros */
+#endif
+
+#include <net-snmp/net-snmp-config.h>
+
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+#include "mta_sendmail.h"
+
+#include <sys/types.h>
+
+#include <stdio.h>
+
+#include <ctype.h>
+
+#ifdef HAVE_STRING_H
+# include <string.h>
+#else
+# include <strings.h>
+#endif
+
+#if HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+
+#ifdef HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#ifdef HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_DIRENT_H
+#include <dirent.h>
+#else
+# define dirent direct
+# if HAVE_SYS_NDIR_H
+#  include <sys/ndir.h>
+# endif
+# if HAVE_SYS_DIR_H
+#  include <sys/dir.h>
+# endif
+# if HAVE_NDIR_H
+#  include <ndir.h>
+# endif
+#endif
+
+#ifdef HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if TIME_WITH_SYS_TIME
+# include <sys/time.h>
+# include <time.h>
+#else
+# if HAVE_SYS_TIME_H
+#  include <sys/time.h>
+# else
+#  include <time.h>
+# endif
+#endif
+
+#if HAVE_STDARG_H
+#include <stdarg.h>
+#else
+#include <varargs.h>
+#endif
+
+#include <errno.h>
+
+ /**/
+/** "macros and variables for registering the OID tree" */
+    /*
+     * prefix for all OIDs 
+     */
+
+static FindVarMethod var_mtaEntry;
+static FindVarMethod var_mtaGroupEntry;
+
+static oid      mta_variables_oid[] = { 1, 3, 6, 1, 2, 1, 28 };
+
+/*
+ * bits that indicate what's needed to compute the value 
+ */
+#define   NEEDS_STATS   (1 << 6)
+#define   NEEDS_DIR     (1 << 7)
+#define   NEEDS         (NEEDS_STATS | NEEDS_DIR)
+
+/*
+ * symbolic names for the magic values 
+ */
+enum {
+    MTARECEIVEDMESSAGES = 3 | NEEDS_STATS,
+    MTASTOREDMESSAGES = 4 | NEEDS_DIR,
+    MTATRANSMITTEDMESSAGES = 5 | NEEDS_STATS,
+    MTARECEIVEDVOLUME = 6 | NEEDS_STATS,
+    MTASTOREDVOLUME = 7 | NEEDS_DIR,
+    MTATRANSMITTEDVOLUME = 8 | NEEDS_STATS,
+    MTAGROUPSTOREDMESSAGES = 17 | NEEDS_DIR,
+    MTAGROUPSTOREDVOLUME = 18 | NEEDS_DIR,
+    MTAGROUPRECEIVEDMESSAGES = 19 | NEEDS_STATS,
+    MTAGROUPREJECTEDMESSAGES = 20 | NEEDS_STATS,
+    MTAGROUPTRANSMITTEDMESSAGES = 22 | NEEDS_STATS,
+    MTAGROUPRECEIVEDVOLUME = 23 | NEEDS_STATS,
+    MTAGROUPTRANSMITTEDVOLUME = 25 | NEEDS_STATS,
+    MTAGROUPNAME = 43,
+    MTAGROUPHIERARCHY = 49,
+};
+
+/*
+ * structure that tells the agent, which function returns what values 
+ */
+static struct variable3 mta_variables[] = {
+    {MTARECEIVEDMESSAGES, ASN_COUNTER, RONLY, var_mtaEntry, 3, {1, 1, 1}},
+    {MTASTOREDMESSAGES, ASN_GAUGE, RONLY, var_mtaEntry, 3, {1, 1, 2}},
+    {MTATRANSMITTEDMESSAGES, ASN_COUNTER, RONLY, var_mtaEntry, 3,
+     {1, 1, 3}},
+    {MTARECEIVEDVOLUME, ASN_COUNTER, RONLY, var_mtaEntry, 3, {1, 1, 4}},
+    {MTASTOREDVOLUME, ASN_GAUGE, RONLY, var_mtaEntry, 3, {1, 1, 5}},
+    {MTATRANSMITTEDVOLUME, ASN_COUNTER, RONLY, var_mtaEntry, 3, {1, 1, 6}},
+
+    {MTAGROUPRECEIVEDMESSAGES, ASN_COUNTER, RONLY, var_mtaGroupEntry, 3,
+     {2, 1, 2}},
+    {MTAGROUPREJECTEDMESSAGES, ASN_COUNTER, RONLY, var_mtaGroupEntry, 3,
+     {2, 1, 3}},
+    {MTAGROUPSTOREDMESSAGES, ASN_GAUGE, RONLY, var_mtaGroupEntry, 3,
+     {2, 1, 4}},
+    {MTAGROUPTRANSMITTEDMESSAGES, ASN_COUNTER, RONLY, var_mtaGroupEntry, 3,
+     {2, 1, 5}},
+    {MTAGROUPRECEIVEDVOLUME, ASN_COUNTER, RONLY, var_mtaGroupEntry, 3,
+     {2, 1, 6}},
+    {MTAGROUPSTOREDVOLUME, ASN_GAUGE, RONLY, var_mtaGroupEntry, 3,
+     {2, 1, 7}},
+    {MTAGROUPTRANSMITTEDVOLUME, ASN_COUNTER, RONLY, var_mtaGroupEntry, 3,
+     {2, 1, 8}},
+    {MTAGROUPNAME, ASN_OCTET_STR, RONLY, var_mtaGroupEntry, 3, {2, 1, 25}},
+    {MTAGROUPHIERARCHY, ASN_INTEGER, RONLY, var_mtaGroupEntry, 3,
+     {2, 1, 31}},
+};
+ /**/
+/** "other macros and structures" */
+    /*
+     * for boolean values 
+     */
+#ifndef FALSE
+#define FALSE 0
+#endif
+#ifndef TRUE
+#define TRUE  1
+#endif
+#ifndef BOOL
+#define BOOL  short
+#endif
+    /*
+     * important constants 
+     */
+#define FILENAMELEN     200     /* maximum length for filenames */
+#define MAXMAILERS       25     /* maximum number of mailers (copied from the sendmail sources) */
+#define MAXQUEUEGROUPS   50     /* maximum # of queue groups (copied from sendmail) */
+#define MNAMELEN         20     /* maximum length of mailernames (copied from the sendmail sources) */
+#define STAT_VERSION_8_9  2     /* version of sendmail V8.9.x statistics files (copied from the sendmail sources) */
+#define STAT_VERSION_8_10 3     /* version of sendmail V8.10.x statistics files (copied from the sendmail sources) */
+#define STAT_MAGIC  0x1B1DE     /* magic value to identify statistics files from sendmail V8.9.x or higher (copied from the sendmail sources) */
+    /*
+     * structure of sendmail.st file from sendmail V8.10.x (copied from the sendmail sources) 
+     */
+    struct statisticsV8_10 {
+    int             stat_magic; /* magic number */
+    int             stat_version;       /* stat file version */
+    time_t          stat_itime; /* file initialization time */
+    short           stat_size;  /* size of this structure */
+    long            stat_cf;    /* # from connections */
+    long            stat_ct;    /* # to connections */
+    long            stat_cr;    /* # rejected connections */
+    long            stat_nf[MAXMAILERS];        /* # msgs from each mailer */
+    long            stat_bf[MAXMAILERS];        /* kbytes from each mailer */
+    long            stat_nt[MAXMAILERS];        /* # msgs to each mailer */
+    long            stat_bt[MAXMAILERS];        /* kbytes to each mailer */
+    long            stat_nr[MAXMAILERS];        /* # rejects by each mailer */
+    long            stat_nd[MAXMAILERS];        /* # discards by each mailer */
+};
+
+/*
+ * structure of sendmail.st file from sendmail V8.9.x (copied from the sendmail sources) 
+ */
+struct statisticsV8_9 {
+    int             stat_magic; /* magic number */
+    int             stat_version;       /* stat file version */
+    time_t          stat_itime; /* file initialization time */
+    short           stat_size;  /* size of this structure */
+    long            stat_nf[MAXMAILERS];        /* # msgs from each mailer */
+    long            stat_bf[MAXMAILERS];        /* kbytes from each mailer */
+    long            stat_nt[MAXMAILERS];        /* # msgs to each mailer */
+    long            stat_bt[MAXMAILERS];        /* kbytes to each mailer */
+    long            stat_nr[MAXMAILERS];        /* # rejects by each mailer */
+    long            stat_nd[MAXMAILERS];        /* # discards by each mailer */
+};
+
+/*
+ * structure of sendmail.st file from sendmail V8.8.x (copied from the sendmail sources) 
+ */
+struct statisticsV8_8 {
+    time_t          stat_itime; /* file initialization time */
+    short           stat_size;  /* size of this structure */
+    long            stat_nf[MAXMAILERS];        /* # msgs from each mailer */
+    long            stat_bf[MAXMAILERS];        /* kbytes from each mailer */
+    long            stat_nt[MAXMAILERS];        /* # msgs to each mailer */
+    long            stat_bt[MAXMAILERS];        /* kbytes to each mailer */
+};
+ /**/
+    /*
+     * queue groups (strictly a sendmail 8.12+ thing 
+     */
+    struct QDir {
+    char            dir[FILENAMELEN + 1];
+    struct QDir    *next;
+};
+
+struct QGrp {
+    char           *name;       /* name of queuegroup */
+
+    time_t          last;       /* last time we counted */
+    int             count;      /* # of files */
+    int             size;       /* size of files */
+
+    struct QDir    *dirs;       /* directories in queue group */
+};
+
+/** "static variables" */
+
+/*
+ * a list of all the queue groups, NULL terminated 
+ */
+static struct QGrp qgrps[MAXQUEUEGROUPS];
+static int      nqgrps = 0;
+
+static char     sendmailst_fn[FILENAMELEN + 1]; /* name of statistics file */
+static int      sendmailst_fh = -1;     /* filehandle for statistics file */
+static char     sendmailcf_fn[FILENAMELEN + 1]; /* name of sendmails config file */
+static char     mailernames[MAXMAILERS][MNAMELEN + 1];  /* array of mailer names */
+static int      mailers = MAXMAILERS;   /* number of mailer names in array */
+
+static long    *stat_nf;        /* pointer to stat_nf array within the statistics structure */
+static long    *stat_bf;        /* pointer to stat_bf array within the statistics structure */
+static long    *stat_nt;        /* pointer to stat_nt array within the statistics structure */
+static long    *stat_bt;        /* pointer to stat_bt array within the statistics structure */
+static long    *stat_nr;        /* pointer to stat_nr array within the statistics structure,
+                                 * only valid for statistics files from sendmail >=V8.9.0    */
+static long    *stat_nd;        /* pointer to stat_nd array within the statistics structure,
+                                 * only valid for statistics files from sendmail >=V8.9.0    */
+static int      stats_size;     /* size of statistics structure */
+static long     stats[sizeof(struct statisticsV8_10) / sizeof(long) + 1];       /* buffer for statistics structure */
+static time_t   lastreadstats;  /* time stats file has been read */
+static long     applindex = 1;  /* ApplIndex value for OIDs */
+static long     stat_cache_time = 5;    /* time (in seconds) to wait before reading stats file again */
+static long     dir_cache_time = 10;    /* time (in seconds) to wait before scanning queue directoy again */
+
+ /**/
+/** static void print_error(int priority, BOOL config, BOOL config_only, char *function, char *format, ...)
+ *
+ *  Description:
+ *
+ *    Called to print errors. It uses the config_perror or the snmp_log function
+ *    depending on whether the config parameter is TRUE or FALSE.
+ *
+ *  Parameters:
+ *
+ *    priority:    priority to be used when calling the snmp_log function
+ *
+ *    config:      indicates whether this function has been called during the
+ *                 configuration process or not. If set to TRUE, the function
+ *                 config_perror will be used to report the error.
+ *
+ *    config_only: if set to TRUE, the error will only be printed when function
+ *                 has been called during the configuration process.
+ *
+ *    function:    name of the calling function. Used when printing via snmp_log.
+ *
+ *    format:      format string for the error message
+ *
+ *    ...:         additional parameters to insert into the error message string
+ *
+ */
+#if HAVE_STDARG_H
+    static void
+print_error(int priority, BOOL config, BOOL config_only,
+            const char *function, const char *format, ...)
+#else
+    static void
+print_error(va_alist)
+     va_dcl
+#endif
+{
+    va_list         ap;
+    char            buffer[2 * FILENAMELEN + 200];      /* I know, that's not perfectly safe, but since I don't use more
+                                                         * than two filenames in one error message, that should be enough */
+
+#if HAVE_STDARG_H
+    va_start(ap, format);
+#else
+    int             priority;
+    BOOL            config;
+    BOOL            config_only;
+    const char     *function;
+    const char     *format;
+
+    va_start(ap);
+    priority = va_arg(ap, int);
+    config = va_arg(ap, BOOL);
+    config_only = va_arg(ap, BOOL);
+    function = va_arg(ap, char *);
+    format = va_arg(ap, char *);
+#endif
+
+    vsnprintf(buffer, sizeof(buffer), format, ap);
+
+    if (config) {
+        config_perror(buffer);
+    } else if (!config_only) {
+        snmp_log(priority, "%s: %s\n", function, buffer);
+    }
+    va_end(ap);
+}
+
+ /**/
+/** static void open_sendmailst(BOOL config)
+ *
+ *  Description:
+ *
+ *    Closes old sendmail.st file, then tries to open the new sendmail.st file
+ *    and guess it's version. If it succeeds, it initializes the stat_*
+ *    pointers and the stats_size variable.
+ *
+ *  Parameters:
+ *
+ *    config: TRUE if function has been called during the configuration process
+ *
+ *  Returns:
+ *
+ *    nothing
+ *
+ */
+    static void
+open_sendmailst(BOOL config)
+{
+    int             filelen;
+
+    if (sendmailst_fh != -1) {
+        while (close(sendmailst_fh) == -1 && errno == EINTR) {
+            /*
+             * do nothing 
+             */
+        }
+    }
+
+    sendmailst_fh = open(sendmailst_fn, O_RDONLY);
+
+    if (sendmailst_fh == -1) {
+        print_error(LOG_ERR, config, TRUE,
+                    "mibII/mta_sendmail.c:open_sendmailst",
+                    "could not open file \"%s\"\n", sendmailst_fn);
+        return;
+    }
+
+    filelen = read(sendmailst_fh, (void *) &stats, sizeof stats);
+
+    if (((struct statisticsV8_10 *) stats)->stat_magic == STAT_MAGIC) {
+        if (((struct statisticsV8_10 *) stats)->stat_version ==
+            STAT_VERSION_8_10
+            && ((struct statisticsV8_10 *) stats)->stat_size ==
+            sizeof(struct statisticsV8_10)
+            && filelen == sizeof(struct statisticsV8_10)) {
+            DEBUGMSGTL(("mibII/mta_sendmail.c:open_sendmailst",
+                        "looks like file \"%s\" has been created by sendmail V8.10.0 or newer\n",
+                        sendmailst_fn));
+            stat_nf = (((struct statisticsV8_10 *) stats)->stat_nf);
+            stat_bf = (((struct statisticsV8_10 *) stats)->stat_bf);
+            stat_nt = (((struct statisticsV8_10 *) stats)->stat_nt);
+            stat_bt = (((struct statisticsV8_10 *) stats)->stat_bt);
+            stat_nr = (((struct statisticsV8_10 *) stats)->stat_nr);
+            stat_nd = (((struct statisticsV8_10 *) stats)->stat_nd);
+            stats_size = sizeof(struct statisticsV8_10);
+        } else if (((struct statisticsV8_9 *) stats)->stat_version ==
+                   STAT_VERSION_8_9
+                   && ((struct statisticsV8_9 *) stats)->stat_size ==
+                   sizeof(struct statisticsV8_9)
+                   && filelen == sizeof(struct statisticsV8_9)) {
+            DEBUGMSGTL(("mibII/mta_sendmail.c:open_sendmailst",
+                        "looks like file \"%s\" has been created by sendmail V8.9.x\n",
+                        sendmailst_fn));
+            stat_nf = (((struct statisticsV8_9 *) stats)->stat_nf);
+            stat_bf = (((struct statisticsV8_9 *) stats)->stat_bf);
+            stat_nt = (((struct statisticsV8_9 *) stats)->stat_nt);
+            stat_bt = (((struct statisticsV8_9 *) stats)->stat_bt);
+            stat_nr = (((struct statisticsV8_9 *) stats)->stat_nr);
+            stat_nd = (((struct statisticsV8_9 *) stats)->stat_nd);
+            stats_size = sizeof(struct statisticsV8_9);
+        } else {
+            print_error(LOG_WARNING, config, FALSE,
+                        "mibII/mta_sendmail.c:open_sendmailst",
+                        "could not guess version of statistics file \"%s\"\n",
+                        sendmailst_fn);
+            while (close(sendmailst_fh) == -1 && errno == EINTR) {
+                /*
+                 * do nothing 
+                 */
+            }
+            sendmailst_fh = -1;
+        }
+    } else {
+        if (((struct statisticsV8_8 *) stats)->stat_size ==
+            sizeof(struct statisticsV8_8)
+            && filelen == sizeof(struct statisticsV8_8)) {
+            DEBUGMSGTL(("mibII/mta_sendmail.c:open_sendmailst",
+                        "looks like file \"%s\" has been created by sendmail V8.8.x\n",
+                        sendmailst_fn));
+            stat_nf = (((struct statisticsV8_8 *) stats)->stat_nf);
+            stat_bf = (((struct statisticsV8_8 *) stats)->stat_bf);
+            stat_nt = (((struct statisticsV8_8 *) stats)->stat_nt);
+            stat_bt = (((struct statisticsV8_8 *) stats)->stat_bt);
+            stat_nr = (long *) NULL;
+            stat_nd = (long *) NULL;
+            stats_size = sizeof(struct statisticsV8_8);
+        } else {
+            print_error(LOG_WARNING, config, FALSE,
+                        "mibII/mta_sendmail.c:open_sendmailst",
+                        "could not guess version of statistics file \"%s\"\n",
+                        sendmailst_fn);
+            while (close(sendmailst_fh) == -1 && errno == EINTR) {
+                /*
+                 * do nothing 
+                 */
+            }
+            sendmailst_fh = -1;
+        }
+    }
+}
+
+ /**/ static void
+count_queuegroup(struct QGrp *qg)
+{
+    struct QDir    *d;
+    char            cwd[200];
+    time_t          current_time = time(NULL);
+
+    if (current_time <= (qg->last + dir_cache_time)) {
+        return;
+    }
+
+    if (getcwd(cwd, sizeof cwd) == NULL) {
+        snmp_log(LOG_ERR,
+                 "mibII/mta_sendmail.c:count_queuegroup: could not get current working directory\n");
+        return;
+    }
+
+    qg->count = 0;
+    qg->size = 0;
+
+    for (d = qg->dirs; d != NULL; d = d->next) {
+        DIR            *dp;
+        struct dirent  *dirp;
+        struct stat     filestat;
+
+        if (chdir(d->dir) != 0)
+            continue;
+        dp = opendir(".");
+        if (dp == NULL)
+            continue;
+        while ((dirp = readdir(dp)) != NULL) {
+            if (dirp->d_name[0] == 'd' && dirp->d_name[1] == 'f') {
+                if (stat(dirp->d_name, &filestat) == 0) {
+                    qg->size += (filestat.st_size + 999) / 1000;
+                }
+            } else if (dirp->d_name[0] == 'q' && dirp->d_name[1] == 'f') {
+                qg->count++;
+            }
+        }
+        closedir(dp);
+    }
+
+    qg->last = current_time;
+
+    chdir(cwd);
+}
+
+/** static void add_queuegroup(const char *name, const char *path)
+ *
+ * Description:
+ *
+ *   Adds a queuegroup of 'name' with root path 'path' to the static
+ *   list of queue groups.  if 'path' ends in a *, we expand it out to
+ *   all matching subdirs.  also look for 'qf' subdirectories.
+ *
+ * Parameters:
+ *
+ *   qgname: name of the queuegroup discovered
+ *   path: path of queuegroup discovered
+ */
+static void
+add_queuegroup(const char *name, char *path)
+{
+    char            parentdir[FILENAMELEN];
+    char           *p;
+    struct QDir    *new = NULL;
+    struct QDir    *subdir = NULL;
+    DIR            *dp;
+    struct dirent  *dirp;
+
+    if (nqgrps == MAXQUEUEGROUPS) {
+        /*
+         * xxx error 
+         */
+        return;
+    }
+
+    if (strlen(path) > FILENAMELEN - 10) {
+        /*
+         * xxx error 
+         */
+        return;
+    }
+
+    p = path + strlen(path) - 1;
+    if (*p == '*') {            /* multiple queue dirs */
+        /*
+         * remove * 
+         */
+        *p = '\0';
+
+        strcpy(parentdir, path);
+        /*
+         * remove last directory component from parentdir 
+         */
+        for (p = parentdir + strlen(parentdir) - 1; p >= parentdir; p--) {
+            if (*p == '/') {
+                *p = '\0';
+                break;
+            }
+        }
+
+        if (p < parentdir) {
+            /*
+             * no trailing / ?!? 
+             */
+
+            /*
+             * xxx error 
+             */
+            return;
+        }
+        p++;
+
+        /*
+         * p is now the prefix we need to match 
+         */
+        if ((dp = opendir(parentdir)) == NULL) {
+            /*
+             * xxx can't open parentdir 
+             */
+            return;
+        }
+
+        while ((dirp = readdir(dp)) != NULL) {
+            if (!strncmp(dirp->d_name, p, strlen(p)) &&
+                dirp->d_name[0] != '.') {
+                /*
+                 * match, add it to the list 
+                 */
+
+                /*
+                 * single queue directory 
+                 */
+                subdir = (struct QDir *) malloc(sizeof(struct QDir));
+                snprintf(subdir->dir, FILENAMELEN - 5, "%s/%s", parentdir,
+                         dirp->d_name);
+                subdir->next = new;
+                new = subdir;
+            }
+        }
+
+        closedir(dp);
+    } else {
+        /*
+         * single queue directory 
+         */
+        new = (struct QDir *) malloc(sizeof(struct QDir));
+        strcpy(new->dir, path);
+        new->next = NULL;
+    }
+
+    /*
+     * check 'new' for /qf directories 
+     */
+    for (subdir = new; subdir != NULL; subdir = subdir->next) {
+        char            qf[FILENAMELEN + 1];
+
+        snprintf(qf, FILENAMELEN, "%s/qf", subdir->dir);
+        if ((dp = opendir(qf)) != NULL) {
+            /*
+             * it exists ! 
+             */
+            strcpy(subdir->dir, qf);
+            closedir(dp);
+        }
+    }
+
+    /*
+     * we now have the list of directories in 'new'; create the queuegroup
+     * object 
+     */
+    qgrps[nqgrps].name = strdup(name);
+    qgrps[nqgrps].last = 0;
+    qgrps[nqgrps].count = 0;
+    qgrps[nqgrps].size = 0;
+    qgrps[nqgrps].dirs = new;
+
+    nqgrps++;
+}
+
+/** static BOOL read_sendmailcf(BOOL config)
+ *
+ *  Description:
+ *
+ *    Tries to open the file named in sendmailcf_fn and to get the names of
+ *    the mailers, the status file and the mailqueue directories.
+ *
+ *  Parameters:
+ *
+ *    config: TRUE if function has been called during the configuration process
+ *
+ *  Returns:
+ *
+ *    TRUE  : config file has been successfully opened
+ *
+ *    FALSE : could not open config file
+ *
+ */
+
+static BOOL
+read_sendmailcf(BOOL config)
+{
+    FILE           *sendmailcf_fp;
+    char            line[500];
+    char           *filename;
+    char           *qgname, *p;
+    int             linenr;
+    int             linelen;
+    int             found_sendmailst = FALSE;
+    int             i;
+
+
+    sendmailcf_fp = fopen(sendmailcf_fn, "r");
+    if (sendmailcf_fp == NULL) {
+        print_error(LOG_ERR, config, TRUE,
+                    "mibII/mta_sendmail.c:read_sendmailcf",
+                    "could not open file \"%s\"\n", sendmailcf_fn);
+        return FALSE;
+    }
+
+    /*
+     * initializes the standard mailers, which aren't necessarily mentioned in the sendmail.cf file 
+     */
+    strcpy(mailernames[0], "prog");
+    strcpy(mailernames[1], "*file*");
+    strcpy(mailernames[2], "*include*");
+    mailers = 3;
+
+    /*
+     * reset queuegroups 
+     */
+
+    linenr = 1;
+    while (fgets(line, sizeof line, sendmailcf_fp) != NULL) {
+        linelen = strlen(line);
+
+        if (line[linelen - 1] != '\n') {
+            print_error(LOG_WARNING, config, FALSE,
+                        "mibII/mta_sendmail.c:read_sendmailcf",
+                        "line %d in config file \"%s\" is too long\n",
+                        linenr, sendmailcf_fn);
+            while (fgets(line, sizeof line, sendmailcf_fp) != NULL && line[strlen(line) - 1] != '\n') { /* skip rest of the line */
+                /*
+                 * nothing to do 
+                 */
+            }
+            linenr++;
+            continue;
+        }
+
+        line[--linelen] = '\0';
+
+        switch (line[0]) {
+
+        case 'M':
+
+            if (mailers < MAXMAILERS) {
+                for (i = 1;
+                     line[i] != ',' && !isspace(line[i]) && line[i] != '\0'
+                     && i <= MNAMELEN; i++) {
+                    mailernames[mailers][i - 1] = line[i];
+                }
+                mailernames[mailers][i - 1] = '\0';
+
+                DEBUGMSGTL(("mibII/mta_sendmail.c:read_sendmailcf",
+                            "found mailer \"%s\"\n",
+                            mailernames[mailers]));
+
+                for (i = 0;
+                     i < mailers
+                     && strcmp(mailernames[mailers], mailernames[i]) != 0;
+                     i++) {
+                    /*
+                     * nothing to do 
+                     */
+                }
+
+                if (i == mailers) {
+                    mailers++;
+                } else {
+                    if (i < 3) {
+                        DEBUGMSGTL(("mibII/mta_sendmail.c:read_sendmailcf",
+                                    "mailer \"%s\" already existed, but since it's one of the predefined mailers, that's probably nothing to worry about\n",
+                                    mailernames[mailers]));
+                    } else {
+                        DEBUGMSGTL(("mibII/mta_sendmail.c:read_sendmailcf",
+                                    "mailer \"%s\" already existed\n",
+                                    mailernames[mailers]));
+                    }
+                    mailernames[mailers][0] = '\0';
+                }
+            } else {
+                print_error(LOG_WARNING, config, FALSE,
+                            "mibII/mta_sendmail.c:read_sendmailcf",
+                            "found too many mailers in config file \"%s\"\n",
+                            sendmailcf_fn);
+            }
+
+
+            break;
+
+        case 'O':
+            switch (line[1]) {
+            case ' ':
+                /*
+                 * long option 
+                 */
+                if (strncasecmp(line + 2, "StatusFile", 10) == 0) {
+                    filename = line + 12;
+                } else if (strncasecmp(line + 2, "QueueDirectory", 14) ==
+                           0) {
+                    filename = line + 16;
+                } else {
+                    /*
+                     * not an option we care about 
+                     */
+                    break;
+                }
+
+                /*
+                 * make sure it's the end of the option 
+                 */
+                if (*filename != ' ' && *filename != '=')
+                    break;
+
+                /*
+                 * skip WS 
+                 */
+                while (*filename == ' ')
+                    filename++;
+
+                /*
+                 * must be O <option> = <file> 
+                 */
+                if (*filename++ != '=') {
+                    print_error(LOG_WARNING, config, FALSE,
+                                "mibII/mta_sendmail.c:read_sendmailcf",
+                                "line %d in config file \"%s\" ist missing an '='\n",
+                                linenr, sendmailcf_fn);
+                    break;
+                }
+
+                /*
+                 * skip WS 
+                 */
+                while (*filename == ' ')
+                    filename++;
+
+                if (strlen(filename) > FILENAMELEN) {
+                    print_error(LOG_WARNING, config, FALSE,
+                                "mibII/mta_sendmail.c:read_sendmailcf",
+                                "line %d config file \"%s\" contains a filename that's too long\n",
+                                linenr, sendmailcf_fn);
+                    break;
+                }
+
+                if (strncasecmp(line + 2, "StatusFile", 10) == 0) {
+                    strncpy(sendmailst_fn, filename, sizeof(sendmailst_fn));
+                    sendmailst_fn[ sizeof(sendmailst_fn)-1 ] = 0;
+                    found_sendmailst = TRUE;
+                    DEBUGMSGTL(("mibII/mta_sendmail.c:read_sendmailcf",
+                                "found statatistics file \"%s\"\n",
+                                sendmailst_fn));
+                } else if (strncasecmp(line + 2, "QueueDirectory", 14) ==
+                           0) {
+                    add_queuegroup("mqueue", filename);
+                } else {
+                    print_error(LOG_CRIT, config, FALSE,
+                                "mibII/mta_sendmail.c:read_sendmailcf",
+                                "This shouldn't happen.\n");
+                    abort();
+                }
+                break;
+
+            case 'S':
+                if (strlen(line + 2) > FILENAMELEN) {
+                    print_error(LOG_WARNING, config, FALSE,
+                                "mibII/mta_sendmail.c:read_sendmailcf",
+                                "line %d config file \"%s\" contains a filename that's too long\n",
+                                linenr, sendmailcf_fn);
+                    break;
+                }
+                strcpy(sendmailst_fn, line + 2);
+                found_sendmailst = TRUE;
+                DEBUGMSGTL(("mibII/mta_sendmail.c:read_sendmailcf",
+                            "found statatistics file \"%s\"\n",
+                            sendmailst_fn));
+                break;
+
+            case 'Q':
+                if (strlen(line + 2) > FILENAMELEN) {
+                    print_error(LOG_WARNING, config, FALSE,
+                                "mibII/mta_sendmail.c:read_sendmailcf",
+                                "line %d config file \"%s\" contains a filename that's too long\n",
+                                linenr, sendmailcf_fn);
+                    break;
+                }
+
+                add_queuegroup("mqueue", line + 2);
+                break;
+            }
+            break;
+
+        case 'Q':
+            /*
+             * found a queue group 
+             */
+            p = qgname = line + 1;
+            while (*p && *p != ',') {
+                p++;
+            }
+            if (*p == '\0') {
+                print_error(LOG_WARNING, config, FALSE,
+                            "mibII/mta_sendmail.c:read_sendmailcf",
+                            "line %d config file \"%s\" contains a weird queuegroup\n",
+                            linenr, sendmailcf_fn);
+                break;
+            }
+
+            /*
+             * look for the directory 
+             */
+            filename = NULL;
+            *p++ = '\0';
+            while (*p != '\0') {
+                /*
+                 * skip WS 
+                 */
+                while (*p && *p == ' ')
+                    p++;
+
+                if (*p == 'P') {        /* found path */
+                    while (*p && *p != '=')
+                        p++;
+                    if (*p++ != '=') {
+                        print_error(LOG_WARNING, config, FALSE,
+                                    "mibII/mta_sendmail.c:read_sendmailcf",
+                                    "line %d config file \"%s\" contains a weird queuegroup\n",
+                                    linenr, sendmailcf_fn);
+                        break;
+                    }
+                    filename = p;
+
+                    /*
+                     * find next ',', turn into \0 
+                     */
+                    while (*p && *p != ',')
+                        p++;
+                    *p = '\0';
+                }
+
+                /*
+                 * skip to next , 
+                 */
+                while (*p && *p != ',')
+                    p++;
+            }
+
+            /*
+             * we found a directory 
+             */
+            if (filename) {
+                add_queuegroup(qgname, filename);
+            } else {
+                print_error(LOG_WARNING, config, FALSE,
+                            "mibII/mta_sendmail.c:read_sendmailcf",
+                            "line %d config file \"%s\" contains a weird queuegroup: no directory\n",
+                            linenr, sendmailcf_fn);
+            }
+
+            break;
+        }
+
+        linenr++;
+    }
+
+    for (i = 0; i < 10 && fclose(sendmailcf_fp) != 0; i++) {
+        /*
+         * nothing to do 
+         */
+    }
+
+    for (i = mailers; i < MAXMAILERS; i++) {
+        mailernames[i][0] = '\0';
+    }
+
+    if (found_sendmailst) {
+        open_sendmailst(config);
+    }
+
+    return TRUE;
+}
+
+ /**/
+/** static void mta_sendmail_parse_config(const char* token, char *line)
+ *
+ *  Description:
+ *
+ *    Called by the agent for each configuration line that belongs to this module.
+ *    The possible tokens are:
+ *
+ *    sendmail_config  - filename of the sendmail configutarion file
+ *    sendmail_stats   - filename of the sendmail statistics file
+ *    sendmail_queue   - name of the sendmail mailqueue directory
+ *    sendmail_index   - the ApplIndex to use for the table
+ *    sendmail_stats_t - the time (in seconds) to cache statistics
+ *    sendmail_queue_t - the time (in seconds) to cache the directory scanning results
+ *
+ *    For "sendmail_config", "sendmail_stats" and "sendmail_queue", the copy_nword
+ *    function is used to copy the filename.
+ *
+ *  Parameters:
+ *
+ *    token: first word of the line
+ *
+ *    line:  rest of the line
+ *
+ *  Returns:
+ *
+ *    nothing
+ *
+ */
+    static void
+mta_sendmail_parse_config(const char *token, char *line)
+{
+    if (strlen(line) > FILENAMELEN) {   /* Might give some false alarm, but better to be safe than sorry */
+        config_perror("line too long");
+        return;
+    }
+
+    if (strcasecmp(token, "sendmail_stats") == 0) {
+        while (isspace(*line)) {
+            line++;
+        }
+        copy_nword(line, sendmailst_fn, sizeof(sendmailst_fn));
+
+        open_sendmailst(TRUE);
+
+        if (sendmailst_fh == -1) {
+            char            str[FILENAMELEN + 50];
+            sprintf(str, "couldn't open file \"%s\"", sendmailst_fn);
+            config_perror(str);
+            return;
+        }
+
+        DEBUGMSGTL(("mibII/mta_sendmail.c:mta_sendmail_parse_config",
+                    "opened statistics file \"%s\"\n", sendmailst_fn));
+        return;
+    } else if (strcasecmp(token, "sendmail_config") == 0) {
+        while (isspace(*line)) {
+            line++;
+        }
+        copy_nword(line, sendmailcf_fn, sizeof(sendmailcf_fn));
+
+        read_sendmailcf(TRUE);
+
+        DEBUGMSGTL(("mibII/mta_sendmail.c:mta_sendmail_parse_config",
+                    "read config file \"%s\"\n", sendmailcf_fn));
+        return;
+    } else if (strcasecmp(token, "sendmail_queue") == 0) {
+        while (isspace(*line)) {
+            line++;
+        }
+        add_queuegroup("mqueue", line);
+
+        return;
+    } else if (strcasecmp(token, "sendmail_index") == 0) {
+        while (isspace(*line)) {
+            line++;
+        }
+        applindex = atol(line);
+        if (applindex < 1) {
+            config_perror("invalid index number");
+            applindex = 1;
+        }
+    } else if (strcasecmp(token, "sendmail_stats_t") == 0) {
+        while (isspace(*line)) {
+            line++;
+        }
+        stat_cache_time = atol(line);
+        if (stat_cache_time < 1) {
+            config_perror("invalid cache time");
+            applindex = 5;
+        }
+    } else if (strcasecmp(token, "sendmail_queue_t") == 0) {
+        while (isspace(*line)) {
+            line++;
+        }
+        dir_cache_time = atol(line);
+        if (dir_cache_time < 1) {
+            config_perror("invalid cache time");
+            applindex = 10;
+        }
+    } else {
+        config_perror
+            ("mibII/mta_sendmail.c says: What should I do with that token? Did you ./configure the agent properly?");
+    }
+
+    return;
+}
+
+ /**/
+/** void init_mta_sendmail(void)
+ *
+ *  Description:
+ *
+ *    Called by the agent to initialize the module. The function will register
+ *    the OID tree and the config handler and try some default values for the
+ *    sendmail.cf and sendmail.st files and for the mailqueue directory.
+ *
+ *  Parameters:
+ *
+ *    none
+ *
+ *  Returns:
+ *
+ *    nothing
+ *
+ */
+    void
+init_mta_sendmail(void)
+{
+    REGISTER_MIB("mibII/mta_sendmail", mta_variables, variable3,
+                 mta_variables_oid);
+
+    snmpd_register_config_handler("sendmail_config",
+                                  mta_sendmail_parse_config, NULL, "file");
+    snmpd_register_config_handler("sendmail_stats",
+                                  mta_sendmail_parse_config, NULL, "file");
+    snmpd_register_config_handler("sendmail_queue",
+                                  mta_sendmail_parse_config, NULL,
+                                  "directory");
+    snmpd_register_config_handler("sendmail_index",
+                                  mta_sendmail_parse_config, NULL,
+                                  "integer");
+    snmpd_register_config_handler("sendmail_stats_t",
+                                  mta_sendmail_parse_config, NULL,
+                                  "cachetime/sec");
+    snmpd_register_config_handler("sendmail_queue_t",
+                                  mta_sendmail_parse_config, NULL,
+                                  "cachetime/sec");
+
+    strcpy(sendmailcf_fn, "/etc/mail/sendmail.cf");
+    if (read_sendmailcf(FALSE) == FALSE) {
+        strcpy(sendmailcf_fn, "/etc/sendmail.cf");
+        read_sendmailcf(FALSE);
+    }
+
+    if (sendmailst_fh == -1) {
+        strcpy(sendmailst_fn, "/etc/mail/statistics");
+        open_sendmailst(FALSE);
+        if (sendmailst_fh == -1) {
+            strcpy(sendmailst_fn, "/etc/mail/sendmail.st");
+            open_sendmailst(FALSE);
+        }
+    }
+
+}
+
+ /**/
+/** unsigned char *var_mtaEntry(struct variable *vp, oid *name, size_t *length, int exact, size_t *var_len, WriteMethod **write_method)
+ *
+ *  Description:
+ *
+ *    Called by the agent in order to get the values for the mtaTable.
+ *
+ *  Parameters:
+ *
+ *    see agent documentation
+ *
+ *  Returns:
+ *
+ *    see agent documentation
+ *
+ */
+unsigned char  *
+var_mtaEntry(struct variable *vp,
+             oid * name,
+             size_t * length,
+             int exact, size_t * var_len, WriteMethod ** write_method)
+{
+
+
+    static long     long_ret;
+    auto int        i;
+    auto int        result;
+    auto time_t     current_time;
+    int             global_count = 0;
+    int             global_size = 0;
+
+    if (exact) {
+        if (*length != vp->namelen + 1) {
+            return NULL;
+        }
+        result =
+            snmp_oid_compare(name, *length - 1, vp->name, vp->namelen);
+        if (result != 0 || name[*length - 1] != applindex) {
+            return NULL;
+        }
+    } else {
+        if (*length <= vp->namelen) {
+            result = -1;
+        } else {
+            result =
+                snmp_oid_compare(name, *length - 1, vp->name, vp->namelen);
+        }
+        if (result > 0) {
+            return NULL;
+        }
+        if (result == 0 && name[*length - 1] >= applindex) {
+            return NULL;
+        }
+        if (result < 0) {
+            memcpy(name, vp->name, (int) vp->namelen * (int) sizeof *name);
+            *length = vp->namelen + 1;
+        }
+        name[vp->namelen] = applindex;
+    }
+
+    *write_method = (WriteMethod *) NULL;
+    *var_len = sizeof(long);    /* default to 'long' results */
+
+    if (vp->magic & NEEDS_STATS) {
+        if (sendmailst_fh == -1)
+            return NULL;
+        current_time = time(NULL);
+        if (current_time == (time_t) - 1
+            || current_time > lastreadstats + stat_cache_time) {
+            if (lseek(sendmailst_fh, 0, SEEK_SET) == -1) {
+                snmp_log(LOG_ERR,
+                         "mibII/mta_sendmail.c:var_mtaEntry: could not rewind to the beginning of file \"%s\"\n",
+                         sendmailst_fn);
+                return NULL;
+            }
+            if (read(sendmailst_fh, (void *) &stats, stats_size) !=
+                stats_size) {
+                snmp_log(LOG_ERR,
+                         "mibII/mta_sendmail.c:var_mtaEntry: could not read from statistics file \"%s\"\n",
+                         sendmailst_fn);
+                return NULL;
+            }
+            if (current_time != (time_t) - 1) {
+                lastreadstats = current_time;
+            }
+        }
+    }
+
+    if (vp->magic & NEEDS_DIR) {
+        global_count = 0;
+        global_size = 0;
+        /*
+         * count all queue group messages 
+         */
+        for (i = 0; i < nqgrps; i++) {
+            count_queuegroup(&qgrps[i]);
+            global_count += qgrps[i].count;
+            global_size += qgrps[i].size;
+        }
+    }
+
+    switch (vp->magic) {
+
+    case MTARECEIVEDMESSAGES:
+
+        long_ret = 0;
+        for (i = 0; i < MAXMAILERS; i++) {
+            long_ret += stat_nf[i];
+        }
+        return (unsigned char *) &long_ret;
+
+    case MTASTOREDMESSAGES:
+
+        long_ret = global_count;
+        return (unsigned char *) &long_ret;
+
+    case MTATRANSMITTEDMESSAGES:
+
+        long_ret = 0;
+        for (i = 0; i < MAXMAILERS; i++) {
+            long_ret += stat_nt[i];
+        }
+        return (unsigned char *) &long_ret;
+
+    case MTARECEIVEDVOLUME:
+
+        long_ret = 0;
+        for (i = 0; i < MAXMAILERS; i++) {
+            long_ret += stat_bf[i];
+        }
+        return (unsigned char *) &long_ret;
+
+    case MTASTOREDVOLUME:
+
+        long_ret = global_size;
+        return (unsigned char *) &long_ret;
+
+    case MTATRANSMITTEDVOLUME:
+
+        long_ret = 0;
+        for (i = 0; i < MAXMAILERS; i++) {
+            long_ret += stat_bt[i];
+        }
+        return (unsigned char *) &long_ret;
+
+    default:
+        snmp_log(LOG_ERR,
+                 "mibII/mta_sendmail.c:mtaEntry: unknown magic value\n");
+    }
+    return NULL;
+}
+
+ /**/
+/** unsigned char *var_mtaGroupEntry(struct variable *vp, oid *name, size_t *length, int exact, size_t *var_len, WriteMethod **write_method)
+ *
+ *  Description:
+ *
+ *    Called by the agent in order to get the values for the mtaGroupTable.
+ *
+ *  Parameters:
+ *
+ *    see agent documentation
+ *
+ *  Returns:
+ *
+ *    see agent documentation
+ *
+ */
+unsigned char  *
+var_mtaGroupEntry(struct variable *vp,
+                  oid * name,
+                  size_t * length,
+                  int exact, size_t * var_len, WriteMethod ** write_method)
+{
+    static long     long_ret;
+    auto long       row;
+    auto int        result;
+    auto time_t     current_time;
+
+
+    if (exact) {
+        if (*length != vp->namelen + 2) {
+            return NULL;
+        }
+        result =
+            snmp_oid_compare(name, *length - 2, vp->name, vp->namelen);
+        if (result != 0 || name[*length - 2] != applindex
+            || name[*length - 1] <= 0
+            || name[*length - 1] > mailers + nqgrps) {
+            return NULL;
+        }
+    } else {
+        if (*length < vp->namelen) {
+            result = -1;
+        } else {
+            result =
+                snmp_oid_compare(name, vp->namelen, vp->name, vp->namelen);
+        }
+
+        if (result > 0) {
+            /*
+             * OID prefix too large 
+             */
+            return NULL;
+        }
+
+        if (result == 0) {
+            /*
+             * OID prefix matches exactly,... 
+             */
+            if (*length > vp->namelen && name[vp->namelen] > applindex) {
+                /*
+                 * ... but ApplIndex too large 
+                 */
+                return NULL;
+            }
+            if (*length > vp->namelen && name[vp->namelen] == applindex) {
+                /*
+                 * ... ApplIndex ok,... 
+                 */
+                if (*length > vp->namelen + 1
+                    && name[vp->namelen + 1] >= 1) {
+                    if (name[vp->namelen + 1] >= mailers + nqgrps) {
+                        /*
+                         * ... but mailernr too large 
+                         */
+                        return NULL;
+                    } else {
+                        name[vp->namelen + 1]++;
+                    }
+                } else {
+                    name[vp->namelen + 1] = 1;
+                }
+            } else {
+                name[vp->namelen] = applindex;
+                name[vp->namelen + 1] = 1;
+            }
+        } else {                /* OID prefix too small */
+            memcpy(name, vp->name, (int) vp->namelen * (int) sizeof *name);
+            name[vp->namelen] = applindex;
+            name[vp->namelen + 1] = 1;
+        }
+        *length = vp->namelen + 2;
+    }
+
+    *write_method = 0;
+    *var_len = sizeof(long);    /* default to 'long' results */
+
+    if (vp->magic & NEEDS_STATS) {
+        if (sendmailst_fh == -1)
+            return NULL;
+        current_time = time(NULL);
+        if (current_time == (time_t) - 1 ||
+            current_time > lastreadstats + stat_cache_time) {
+            if (lseek(sendmailst_fh, 0, SEEK_SET) == -1) {
+                snmp_log(LOG_ERR,
+                         "mibII/mta_sendmail.c:var_mtaGroupEntry: could not rewind to beginning of file \"%s\"\n",
+                         sendmailst_fn);
+                return NULL;
+            }
+            if (read(sendmailst_fh, (void *) &stats, stats_size) !=
+                stats_size) {
+                snmp_log(LOG_ERR,
+                         "mibII/mta_sendmail.c:var_mtaGroupEntry: could not read statistics file \"%s\"\n",
+                         sendmailst_fn);
+                return NULL;
+            }
+            if (current_time != (time_t) - 1) {
+                lastreadstats = current_time;
+            }
+        }
+    }
+
+    row = name[*length - 1] - 1;
+
+    /*
+     * if this is a mailer but we're asking for queue-group only info, 
+     * bump there 
+     */
+    if (!exact && row < mailers && (vp->magic == MTAGROUPSTOREDMESSAGES ||
+                                    vp->magic == MTAGROUPSTOREDVOLUME)) {
+        row = mailers;
+        name[*length - 1] = row + 1;
+    }
+
+    if (row < mailers) {
+        switch (vp->magic) {
+        case MTAGROUPRECEIVEDMESSAGES:
+            long_ret = (long) stat_nf[row];
+            return (unsigned char *) &long_ret;
+
+        case MTAGROUPREJECTEDMESSAGES:
+            if (stat_nr != NULL && stat_nd != NULL) {
+                long_ret = (long) (stat_nr[row] + stat_nd[row]);        /* Number of rejected plus number of discarded messages */
+                return (unsigned char *) &long_ret;
+            } else {
+                return NULL;
+            }
+
+        case MTAGROUPTRANSMITTEDMESSAGES:
+            long_ret = (long) stat_nt[row];
+            return (unsigned char *) &long_ret;
+
+        case MTAGROUPRECEIVEDVOLUME:
+            long_ret = (long) stat_bf[row];
+            return (unsigned char *) &long_ret;
+
+        case MTAGROUPTRANSMITTEDVOLUME:
+            long_ret = (long) stat_bt[row];
+            return (unsigned char *) &long_ret;
+
+        case MTAGROUPNAME:
+            *var_len = strlen(mailernames[row]);
+            return (unsigned char *) (*var_len >
+                                      0 ? mailernames[row] : NULL);
+
+        case MTAGROUPHIERARCHY:
+            long_ret = (long) -1;
+            return (unsigned char *) &long_ret;
+
+        default:
+            return NULL;
+        }
+    } else {
+        /*
+         * this is the queue group part of the table 
+         */
+        row -= mailers;
+        switch (vp->magic) {
+        case MTAGROUPSTOREDMESSAGES:
+            count_queuegroup(&qgrps[row]);
+            long_ret = (long) qgrps[row].count;
+            return (unsigned char *) &long_ret;
+
+        case MTAGROUPSTOREDVOLUME:
+            count_queuegroup(&qgrps[row]);
+            long_ret = (long) qgrps[row].size;
+            return (unsigned char *) &long_ret;
+
+        case MTAGROUPNAME:
+            *var_len = strlen(qgrps[row].name);
+            return (unsigned char *) (*var_len >
+                                      0 ? qgrps[row].name : NULL);
+
+        case MTAGROUPHIERARCHY:
+            long_ret = (long) -2;
+            return (unsigned char *) &long_ret;
+
+        default:
+            return NULL;
+        }
+
+    }
+    return NULL;
+}
+
+ /**/
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/mibII/mta_sendmail.h tomato121/release/src/router/snmp/agent/mibgroup/mibII/mta_sendmail.h
--- tomato/release/src/router/snmp/agent/mibgroup/mibII/mta_sendmail.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/mibII/mta_sendmail.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,9 @@
+#ifndef _MIBGROUP_MTA_H
+#define _MIBGROUP_MTA_H
+
+config_add_mib(MTA-MIB)
+config_add_mib(NETWORK-SERVICES-MIB)
+
+     void            init_mta_sendmail(void);
+
+#endif                          /* _MIBGROUP_MTA_H */
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/mibII/route_write.c tomato121/release/src/router/snmp/agent/mibgroup/mibII/route_write.c
--- tomato/release/src/router/snmp/agent/mibgroup/mibII/route_write.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/mibII/route_write.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,762 @@
+#include <net-snmp/net-snmp-config.h>
+
+#include <sys/types.h>
+#if HAVE_SYS_PARAM_H
+#include <sys/param.h>
+#endif
+#if HAVE_SYS_FILE_H
+#include <sys/file.h>
+#endif
+#if HAVE_SYS_SOCKET_H
+#include <sys/socket.h>
+#endif
+#if HAVE_SYS_SOCKIO_H
+#include <sys/sockio.h>
+#endif
+#if HAVE_SYS_IOCTL_H
+#include <sys/ioctl.h>
+#endif
+#if HAVE_SYS_MBUF_H
+#include <sys/mbuf.h>
+#endif
+
+
+#if HAVE_SYS_STREAM_H
+#include <sys/stream.h>
+#endif
+#if HAVE_NET_ROUTE_H
+#include <net/route.h>
+#endif
+#if HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+#if HAVE_ARPA_INET_H
+#include <arpa/inet.h>
+#endif
+#if HAVE_NETDB_H
+#include <netdb.h>
+#endif
+
+#include <errno.h>
+#if HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#include <stdio.h>
+#include <ctype.h>
+#if HAVE_STRING_H
+#include <string.h>
+#endif
+#if HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+
+#if HAVE_WINSOCK_H
+#include <winsock.h>
+#endif
+
+#if HAVE_DMALLOC_H
+#include <dmalloc.h>
+#endif
+
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+#include "ip.h"
+#include "route_write.h"
+
+#ifdef cygwin
+#define WIN32
+#include <windows.h>
+#endif
+
+#ifndef WIN32
+
+#ifndef STRUCT_RTENTRY_HAS_RT_DST
+#define rt_dst rt_nodes->rn_key
+#endif
+#ifndef STRUCT_RTENTRY_HAS_RT_HASH
+#define rt_hash rt_pad1
+#endif
+
+#ifdef irix6
+#define SIOCADDRT SIOCADDMULTI
+#define SIOCDELRT SIOCDELMULTI
+#endif
+
+int
+addRoute(u_long dstip, u_long gwip, u_long iff, u_short flags)
+{
+#ifndef dynix
+    struct sockaddr_in dst;
+    struct sockaddr_in gateway;
+    int             s;
+    RTENTRY         route;
+
+    s = socket(AF_INET, SOCK_RAW, 0);
+    if (s < 0) {
+        snmp_log_perror("socket");
+        return 0;
+    }
+
+
+    flags |= RTF_UP;
+
+    dst.sin_family = AF_INET;
+    dst.sin_addr.s_addr = htonl(dstip);
+
+
+    gateway.sin_family = AF_INET;
+    gateway.sin_addr.s_addr = htonl(gwip);
+
+    memcpy(&route.rt_dst, &dst, sizeof(struct sockaddr_in));
+    memcpy(&route.rt_gateway, &gateway, sizeof(struct sockaddr_in));
+
+    route.rt_flags = flags;
+#ifndef RTENTRY_4_4
+    route.rt_hash = iff;
+#endif
+#ifdef irix6
+    return 0;
+#else
+    return (ioctl(s, SIOCADDRT, (caddr_t) & route));
+#endif
+
+#else                           /* dynix */
+    /*
+     *  Throws up the following errors:
+     *
+     * "mibII/route_write.c", line 113: undefined struct/union member: rt_nodes
+     * "mibII/route_write.c", line 113: undefined struct/union member: rn_key
+     * "mibII/route_write.c", line 113: left operand of "->" must be pointer to struct/union
+     * "mibII/route_write.c", line 118: undefined struct/union member: rt_pad1
+     * "mibII/route_write.c", line 123: undefined symbol: SIOCADDRT
+     * "mibII/route_write.c", line 155: undefined struct/union member: rt_nodes
+     * "mibII/route_write.c", line 155: undefined struct/union member: rn_key
+     * "mibII/route_write.c", line 155: left operand of "->" must be pointer to struct/union
+     * "mibII/route_write.c", line 160: undefined struct/union member: rt_pad1
+     * "mibII/route_write.c", line 166: undefined symbol: SIOCDELRT
+     */
+    return 0;
+#endif
+
+}
+
+
+
+int
+delRoute(u_long dstip, u_long gwip, u_long iff, u_short flags)
+{
+#ifndef dynix
+
+    struct sockaddr_in dst;
+    struct sockaddr_in gateway;
+    int             s;
+    RTENTRY         route;
+
+    s = socket(AF_INET, SOCK_RAW, 0);
+    if (s < 0) {
+        snmp_log_perror("socket");
+        return 0;
+    }
+
+
+    flags |= RTF_UP;
+
+    dst.sin_family = AF_INET;
+    dst.sin_addr.s_addr = htonl(dstip);
+
+
+    gateway.sin_family = AF_INET;
+    gateway.sin_addr.s_addr = htonl(gwip);
+
+    memcpy(&route.rt_dst, &dst, sizeof(struct sockaddr_in));
+    memcpy(&route.rt_gateway, &gateway, sizeof(struct sockaddr_in));
+
+    route.rt_flags = flags;
+#ifndef RTENTRY_4_4
+    route.rt_hash = iff;
+#endif
+
+#ifdef irix6
+    return 0;
+#else
+    return (ioctl(s, SIOCDELRT, (caddr_t) & route));
+#endif
+
+#else                           /* dynix */
+    /*
+     * See 'addRoute' for the list of errors.
+     */
+    return 0;
+#endif
+}
+
+
+#ifndef STRUCT_RTENTRY_HAS_RT_DST
+#undef rt_dst
+#endif
+
+
+#define  MAX_CACHE   8
+
+struct rtent {
+
+    u_long          in_use;
+    u_long          old_dst;
+    u_long          old_nextIR;
+    u_long          old_ifix;
+    u_long          old_flags;
+
+    u_long          rt_dst;     /*  main entries    */
+    u_long          rt_ifix;
+    u_long          rt_metric1;
+    u_long          rt_nextIR;
+    u_long          rt_type;
+    u_long          rt_proto;
+
+
+    u_long          xx_dst;     /*  shadow entries  */
+    u_long          xx_ifix;
+    u_long          xx_metric1;
+    u_long          xx_nextIR;
+    u_long          xx_type;
+    u_long          xx_proto;
+};
+
+struct rtent    rtcache[MAX_CACHE];
+
+struct rtent   *
+findCacheRTE(u_long dst)
+{
+    int             i;
+
+    for (i = 0; i < MAX_CACHE; i++) {
+
+        if (rtcache[i].in_use && (rtcache[i].rt_dst == dst)) {  /* valid & match? */
+            return (&rtcache[i]);
+        }
+    }
+    return 0;
+}
+
+struct rtent   *
+newCacheRTE(void)
+{
+
+    int             i;
+
+    for (i = 0; i < MAX_CACHE; i++) {
+
+        if (!rtcache[i].in_use) {
+            rtcache[i].in_use = 1;
+            return (&rtcache[i]);
+        }
+    }
+    return 0;
+
+}
+
+int
+delCacheRTE(u_long dst)
+{
+    struct rtent   *rt;
+
+    rt = findCacheRTE(dst);
+    if (!rt) {
+        return 0;
+    }
+
+    rt->in_use = 0;
+    return 1;
+}
+
+
+struct rtent   *
+cacheKernelRTE(u_long dst)
+{
+    return 0;                   /* for now */
+    /*
+     * ...... 
+     */
+}
+
+/*
+ * If statP is non-NULL, the referenced object is at that location.
+ * If statP is NULL and ap is non-NULL, the instance exists, but not this variable.
+ * If statP is NULL and ap is NULL, then neither this instance nor the variable exists.
+ */
+
+int
+write_rte(int action,
+          u_char * var_val,
+          u_char var_val_type,
+          size_t var_val_len, u_char * statP, oid * name, size_t length)
+{
+    struct rtent   *rp;
+    int             var;
+    long            val;
+    u_long          dst;
+    char            buf[8];
+    u_short         flags;
+    int             oldty;
+
+    /*
+     * object identifier is of form:
+     * 1.3.6.1.2.1.4.21.1.X.A.B.C.D ,  where A.B.C.D is IP address.
+     * IPADDR starts at offset 10.
+     */
+
+    if (length != 14) {
+        snmp_log(LOG_ERR, "length error\n");
+        return SNMP_ERR_NOCREATION;
+    }
+
+    var = name[9];
+
+    dst = *((u_long *) & name[10]);
+
+    rp = findCacheRTE(dst);
+
+    if (!rp) {
+        rp = cacheKernelRTE(dst);
+    }
+
+
+    if (action == RESERVE1 && !rp) {
+
+        rp = newCacheRTE();
+        if (!rp) {
+            snmp_log(LOG_ERR, "newCacheRTE");
+            return SNMP_ERR_RESOURCEUNAVAILABLE;
+        }
+        rp->rt_type = rp->xx_type = 2;
+
+    } else if (action == COMMIT) {
+
+
+    } else if (action == FREE) {
+        if (rp->rt_type == 2) { /* was invalid before */
+            delCacheRTE(dst);
+        }
+    }
+
+
+
+
+    switch (var) {
+
+    case IPROUTEDEST:
+
+        if (action == RESERVE1) {
+
+            if (var_val_type != ASN_OCTET_STR) {
+                snmp_log(LOG_ERR, "not octet");
+                return SNMP_ERR_WRONGTYPE;
+            }
+
+            memcpy(buf, var_val, (var_val_len > 8) ? 8 : var_val_len);
+
+            if (var_val_type != ASN_OCTET_STR) {
+                snmp_log(LOG_ERR, "not octet2");
+                return SNMP_ERR_WRONGTYPE;
+            }
+
+            rp->xx_dst = *((u_long *) buf);
+
+
+        } else if (action == COMMIT) {
+            rp->rt_dst = rp->xx_dst;
+        }
+        break;
+
+    case IPROUTEMETRIC1:
+
+        if (action == RESERVE1) {
+            if (var_val_type != ASN_INTEGER) {
+                snmp_log(LOG_ERR, "not int1");
+                return SNMP_ERR_WRONGTYPE;
+            }
+
+            val = *((long *) var_val);
+
+            if (val < -1) {
+                snmp_log(LOG_ERR, "not right1");
+                return SNMP_ERR_WRONGVALUE;
+            }
+
+            rp->xx_metric1 = val;
+
+        } else if (action == RESERVE2) {
+
+            if ((rp->xx_metric1 == 1) && (rp->xx_type != 4)) {
+                snmp_log(LOG_ERR, "reserve2 failed\n");
+                return SNMP_ERR_WRONGVALUE;
+            }
+
+        } else if (action == COMMIT) {
+            rp->rt_metric1 = rp->xx_metric1;
+        }
+        break;
+
+    case IPROUTEIFINDEX:
+
+        if (action == RESERVE1) {
+            if (var_val_type != ASN_INTEGER) {
+                snmp_log(LOG_ERR, "not right2");
+                return SNMP_ERR_WRONGTYPE;
+            }
+
+            val = *((long *) var_val);
+
+            if (val <= 0) {
+                snmp_log(LOG_ERR, "not right3");
+                return SNMP_ERR_WRONGVALUE;
+            }
+
+            rp->xx_ifix = val;
+
+        } else if (action == COMMIT) {
+            rp->rt_ifix = rp->xx_ifix;
+        }
+        break;
+
+    case IPROUTENEXTHOP:
+
+        if (action == RESERVE1) {
+
+            if (var_val_type != ASN_OCTET_STR) {
+                snmp_log(LOG_ERR, "not right4");
+                return SNMP_ERR_WRONGTYPE;
+            }
+
+            memcpy(buf, var_val, (var_val_len > 8) ? 8 : var_val_len);
+
+            if (var_val_type != ASN_OCTET_STR) {
+                snmp_log(LOG_ERR, "not right5");
+                return SNMP_ERR_WRONGTYPE;
+            }
+
+            rp->xx_nextIR = *((u_long *) buf);
+
+        } else if (action == COMMIT) {
+            rp->rt_nextIR = rp->xx_nextIR;
+        }
+
+
+    case IPROUTETYPE:
+
+        /*
+         *  flag meaning:
+         *
+         *  IPROUTEPROTO (rt_proto): none: (cant set == 3 (netmgmt)) 
+         *
+         *  IPROUTEMETRIC1:  1 iff gateway, 0 otherwise
+         *  IPROUTETYPE:     4 iff gateway, 3 otherwise
+         */
+
+        if (action == RESERVE1) {
+            if (var_val_type != ASN_INTEGER) {
+                return SNMP_ERR_WRONGTYPE;
+            }
+
+            val = *((long *) var_val);
+
+            if ((val < 2) || (val > 4)) {       /* only accept invalid, direct, indirect */
+                snmp_log(LOG_ERR, "not right6");
+                return SNMP_ERR_WRONGVALUE;
+            }
+
+            rp->xx_type = val;
+
+        } else if (action == COMMIT) {
+
+            oldty = rp->rt_type;
+            rp->rt_type = rp->xx_type;
+
+            if (rp->rt_type == 2) {     /* invalid, so delete from kernel */
+
+                if (delRoute
+                    (rp->rt_dst, rp->rt_nextIR, rp->rt_ifix,
+                     rp->old_flags) < 0) {
+                    snmp_log_perror("delRoute");
+                }
+
+            } else {
+
+                /*
+                 * it must be valid now, so flush to kernel 
+                 */
+
+                if (oldty != 2) {       /* was the old entry valid ?  */
+                    if (delRoute
+                        (rp->old_dst, rp->old_nextIR, rp->old_ifix,
+                         rp->old_flags) < 0) {
+                        snmp_log_perror("delRoute");
+                    }
+                }
+
+                /*
+                 * not invalid, so remove from cache 
+                 */
+
+                flags = (rp->rt_type == 4 ? RTF_GATEWAY : 0);
+
+                if (addRoute(rp->rt_dst, rp->rt_nextIR, rp->rt_ifix, flags)
+                    < 0) {
+                    snmp_log_perror("addRoute");
+                }
+
+                delCacheRTE(rp->rt_type);
+            }
+        }
+        break;
+
+
+    case IPROUTEPROTO:
+
+    default:
+        DEBUGMSGTL(("snmpd", "unknown sub-id %d in write_rte\n", var));
+        return SNMP_ERR_NOCREATION;
+
+
+    }
+
+    return SNMP_ERR_NOERROR;
+}
+
+#else                           /* WIN32 */
+#include <iphlpapi.h>
+
+extern PMIB_IPFORWARDROW route_row;
+extern int      create_flag;
+
+int
+write_rte(int action,
+          u_char * var_val,
+          u_char var_val_type,
+          size_t var_val_len, u_char * statP, oid * name, size_t length)
+{
+    int             var, retval = NO_ERROR;
+    static PMIB_IPFORWARDROW oldroute_row = NULL;
+    static int      mask_flag = 0, nexthop_flag = 0;
+    static int      index_flag = 0, metric_flag = 0;
+    static int      dest_flag = 0;
+    DWORD           status = NO_ERROR;
+    /*
+     * object identifier is of form:
+     * 1.3.6.1.2.1.4.21.1.X.A.B.C.D ,  where A.B.C.D is IP address.
+     * IPADDR starts at offset 10.
+     */
+
+    if (length != 14) {
+        snmp_log(LOG_ERR, "length error\n");
+        return SNMP_ERR_NOCREATION;
+    }
+    /*
+     * #define for ipRouteTable entries are 1 less than corresponding sub-id in MIB
+     * * i.e. IPROUTEDEST defined as 0, but ipRouteDest registered as 1
+     */
+    var = name[9] - 1;
+
+    switch (action) {
+    case RESERVE1:
+        switch (var) {
+        case IPROUTEMETRIC1:
+        case IPROUTEMETRIC2:
+        case IPROUTEMETRIC3:
+        case IPROUTEMETRIC4:
+        case IPROUTEMETRIC5:
+        case IPROUTETYPE:
+        case IPROUTEAGE:
+        case IPROUTEIFINDEX:
+            if (var_val_type != ASN_INTEGER) {
+                snmp_log(LOG_ERR, "not integer\n");
+                return SNMP_ERR_WRONGTYPE;
+            }
+            if (var_val_len > sizeof(int)) {
+                snmp_log(LOG_ERR, "bad length\n");
+                return SNMP_ERR_WRONGLENGTH;
+            }
+            if (var == IPROUTETYPE) {
+                if ((*((int *) var_val)) < 2 || (*((int *) var_val)) > 4) {
+                    snmp_log(LOG_ERR, "invalid ipRouteType\n");
+                    return SNMP_ERR_WRONGVALUE;
+                }
+            } else if ((var == IPROUTEIFINDEX) || (var == IPROUTEAGE)) {
+                if ((*((int *) var_val)) < 0) {
+                    snmp_log(LOG_ERR, "invalid ipRouteIfIndex\n");
+                    return SNMP_ERR_WRONGVALUE;
+                }
+            } else {
+                if ((*((int *) var_val)) < -1) {
+                    snmp_log(LOG_ERR, "not right1");
+                    return SNMP_ERR_WRONGVALUE;
+                }
+            }
+            break;
+        case IPROUTENEXTHOP:
+        case IPROUTEMASK:
+        case IPROUTEDEST:
+            if (var_val_type != ASN_IPADDRESS) {
+                snmp_log(LOG_ERR, "not right4");
+                return SNMP_ERR_WRONGTYPE;
+            }
+            if (var_val_len != 4) {
+                snmp_log(LOG_ERR, "incorrect ipAddress length");
+                return SNMP_ERR_WRONGLENGTH;
+            }
+            break;
+        default:
+            DEBUGMSGTL(("snmpd", "unknown sub-id %d in write_rte\n",
+                        var + 1));
+            retval = SNMP_ERR_NOTWRITABLE;
+        }
+        break;
+
+    case RESERVE2:
+        /*
+         * Save the old value, in case of UNDO 
+         */
+        if (oldroute_row == NULL) {
+            oldroute_row =
+                (PMIB_IPFORWARDROW) malloc(sizeof(MIB_IPFORWARDROW));
+            *oldroute_row = *route_row;
+        }
+        break;
+
+    case ACTION:               /* Perform the SET action (if reversible) */
+        switch (var) {
+        case IPROUTEMETRIC1:
+            metric_flag = 1;
+            route_row->dwForwardMetric1 = *((int *) var_val);
+            break;
+        case IPROUTEMETRIC2:
+            route_row->dwForwardMetric2 = *((int *) var_val);
+            break;
+        case IPROUTEMETRIC3:
+            route_row->dwForwardMetric3 = *((int *) var_val);
+            break;
+        case IPROUTEMETRIC4:
+            route_row->dwForwardMetric4 = *((int *) var_val);
+            break;
+        case IPROUTEMETRIC5:
+            route_row->dwForwardMetric5 = *((int *) var_val);
+            break;
+        case IPROUTETYPE:
+            route_row->dwForwardType = *((int *) var_val);
+            break;
+        case IPROUTEAGE:
+            /*
+             * Irrespective of suppied value, this will be set with 0.
+             * * As row will be updated and this field gives the number of 
+             * * seconds since this route was last updated
+             */
+            route_row->dwForwardAge = *((int *) var_val);
+            break;
+        case IPROUTEIFINDEX:
+            index_flag = 1;
+            route_row->dwForwardIfIndex = *((int *) var_val);
+            break;
+
+        case IPROUTENEXTHOP:
+            nexthop_flag = 1;
+            route_row->dwForwardNextHop = *((DWORD *) var_val);
+            break;
+        case IPROUTEMASK:
+            mask_flag = 1;
+            route_row->dwForwardMask = *((DWORD *) var_val);
+            break;
+        case IPROUTEDEST:
+            dest_flag = 1;
+            route_row->dwForwardDest = *((DWORD *) var_val);
+            break;
+        default:
+            DEBUGMSGTL(("snmpd", "unknown sub-id %d in write_rte\n",
+                        var + 1));
+            retval = SNMP_ERR_NOTWRITABLE;
+        }
+        return retval;
+    case UNDO:
+        /*
+         * Reverse the SET action and free resources 
+         */
+        if (oldroute_row) {
+            *route_row = *oldroute_row;
+            free(oldroute_row);
+            oldroute_row = NULL;
+            free(route_row);
+            route_row = NULL;
+        }
+        break;
+
+    case COMMIT:
+        /*
+         * When this case entered 'route_row' will have user supplied values for asked entries. 
+         * * Thats why it is enough if we call SetIpForwardEntry/CreateIpForwardEntry only once 
+         * * SetIpForwardENtry is not done in ACTION phase, as that will reset ipRouteAge on success
+         * * and if any varbind fails, then we can't UNDO the change for ipROuteAge. 
+         */
+        if (route_row) {
+            if (!create_flag) {
+
+                if (SetIpForwardEntry(route_row) != NO_ERROR) {
+                    snmp_log(LOG_ERR,
+                             "Can't set route table's row with specified value\n");
+                    retval = SNMP_ERR_COMMITFAILED;
+                } else {
+                    /*
+                     * SET on IpRouteNextHop, IpRouteMask & ipRouteDest creates new row. 
+                     * *If Set succeeds, then delete the old row.
+                     * * Don't know yet whether SET on ipRouteIfIndex creates new row.
+                     * * If it creates then index_flag should be added to following if statement
+                     */
+
+                    if (dest_flag || nexthop_flag || mask_flag) {
+                        oldroute_row->dwForwardType = 2;
+                        if (SetIpForwardEntry(oldroute_row) != NO_ERROR) {
+                            snmp_log(LOG_ERR,
+                                     "Set on ipRouteTable created new row, but failed to delete the old row\n");
+                            retval = SNMP_ERR_GENERR;
+                        }
+                    }
+                }
+            }
+            /*
+             * Only if create_flag, mask, nexthop, ifIndex and metric are specified, create new entry 
+             */
+            if (create_flag) {
+                if (mask_flag && nexthop_flag && metric_flag && index_flag) {
+                    if ((status =
+                         CreateIpForwardEntry(route_row)) != NO_ERROR) {
+                        snmp_log(LOG_ERR,
+                                 "Inside COMMIT: CreateIpNetEntry failed, status %d\n",
+                                 status);
+                        retval = SNMP_ERR_COMMITFAILED;
+                    }
+                } else {
+                    /*
+                     * For new entry, mask, nexthop, ifIndex and metric must be supplied 
+                     */
+                    snmp_log(LOG_ERR,
+                             "case COMMIT, can't create without index, mask, nextHop and metric\n");
+                    retval = SNMP_ERR_WRONGVALUE;
+                }
+            }
+        }
+
+    case FREE:
+        /*
+         * Free any resources allocated 
+         */
+        free(oldroute_row);
+        oldroute_row = NULL;
+        free(route_row);
+        route_row = NULL;
+        mask_flag = nexthop_flag = metric_flag = index_flag = dest_flag =
+            0;
+        break;
+    }
+    return retval;
+}
+
+#endif                          /* WIN32 */
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/mibII/route_write.h tomato121/release/src/router/snmp/agent/mibgroup/mibII/route_write.h
--- tomato/release/src/router/snmp/agent/mibgroup/mibII/route_write.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/mibII/route_write.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,18 @@
+/*
+ *  Template MIB group interface - route_write.h
+ *
+ */
+#ifndef _MIBGROUP_ROUTE_WRITE_H
+#define _MIBGROUP_ROUTE_WRITE_H
+
+config_require(mibII/ip)
+
+     int             addRoute(u_long, u_long, u_long, u_short);
+     int             delRoute(u_long, u_long, u_long, u_short);
+     struct rtent   *findCacheRTE(u_long);
+     struct rtent   *newCacheRTE(void);
+     int             delCacheRTE(u_long);
+     struct rtent   *cacheKernelRTE(u_long);
+     WriteMethod     write_rte;
+
+#endif                          /* _MIBGROUP_ROUTE_WRITE_H */
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/mibII/setSerialNo.c tomato121/release/src/router/snmp/agent/mibgroup/mibII/setSerialNo.c
--- tomato/release/src/router/snmp/agent/mibgroup/mibII/setSerialNo.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/mibII/setSerialNo.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,77 @@
+/**  
+ *  This file implements the snmpSetSerialNo TestAndIncr counter
+ */
+
+/*
+ * start be including the appropriate header files 
+ */
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+#include "setSerialNo.h"
+
+/*
+ * Then, we declare the variables we want to be accessed 
+ */
+static long     setserialno = 0;        /* default value */
+
+/*
+ * our initialization routine, automatically called by the agent 
+ */
+/*
+ * (to get called, the function name must match init_FILENAME() 
+ */
+void
+init_setSerialNo(void)
+{
+    oid             my_registration_oid[] =
+        { 1, 3, 6, 1, 6, 3, 1, 1, 6, 1, 0 };
+
+    /*
+     * a debugging statement.  Run the agent with -Dscalar_int to see
+     * the output of this debugging statement. 
+     */
+    DEBUGMSGTL(("snmpSetSerialNo",
+                "Initalizing SnmpSetSerialNo to %d\n", setserialno));
+
+    netsnmp_register_long_instance("snmpSetSerialNo",
+                                   my_registration_oid,
+                                   OID_LENGTH(my_registration_oid),
+                                   &setserialno,
+                                   netsnmp_setserialno_handler);
+
+    DEBUGMSGTL(("scalar_int", "Done initalizing example scalar int\n"));
+}
+
+/*
+ * additional support for the given node.  Everything else (value
+ * retrival, undo support, etc) is handled by the instance helper for
+ * us. 
+ */
+int
+netsnmp_setserialno_handler(netsnmp_mib_handler *handler,
+                            netsnmp_handler_registration *reginfo,
+                            netsnmp_agent_request_info *reqinfo,
+                            netsnmp_request_info *requests)
+{
+    switch (reqinfo->mode) {
+    case MODE_SET_RESERVE1:
+        /*
+         * the set value must be exactly the same as the current value 
+         */
+        if (*(requests->requestvb->val.integer) != setserialno)
+            netsnmp_set_request_error(reqinfo, requests,
+                                      SNMP_ERR_WRONGVALUE);
+        break;
+
+    case MODE_SET_ACTION:
+        /*
+         * we actually increment the value once when it's set. 
+         */
+        setserialno++;
+        break;
+
+    }
+    return SNMP_ERR_NOERROR;
+}
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/mibII/setSerialNo.h tomato121/release/src/router/snmp/agent/mibgroup/mibII/setSerialNo.h
--- tomato/release/src/router/snmp/agent/mibgroup/mibII/setSerialNo.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/mibII/setSerialNo.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,7 @@
+#ifndef SETSERIALNO_H
+#define SETSERIALNO_H
+
+Netsnmp_Node_Handler netsnmp_setserialno_handler;
+void            init_setSerialNo(void);
+
+#endif                          /* SETSERIALNO_H */
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/mibII/snmp_mib.c tomato121/release/src/router/snmp/agent/mibgroup/mibII/snmp_mib.c
--- tomato/release/src/router/snmp/agent/mibgroup/mibII/snmp_mib.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/mibII/snmp_mib.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,251 @@
+/*
+ *  SNMPv1 MIB group implementation - snmp.c
+ *
+ */
+
+#include <net-snmp/net-snmp-config.h>
+#include <sys/types.h>
+#if HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+#if HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+
+#if HAVE_WINSOCK_H
+#include <winsock.h>
+#endif
+
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+#include "util_funcs.h"
+#include "snmp_mib.h"
+#include "sysORTable.h"
+
+
+        /*********************
+	 *
+	 *  Kernel & interface information,
+	 *   and internal forward declarations
+	 *
+	 *********************/
+
+extern int      snmp_enableauthentraps;
+extern int      snmp_enableauthentrapsset;
+int             old_snmp_enableauthentraps;
+
+/*********************
+ *
+ *  Initialisation & common implementation functions
+ *
+ *********************/
+
+/*
+ * define the structure we're going to ask the agent to register our
+ * information at 
+ */
+struct variable1 snmp_variables[] = {
+    {SNMPINPKTS, ASN_COUNTER, RONLY, var_snmp, 1, {1}},
+    {SNMPOUTPKTS, ASN_COUNTER, RONLY, var_snmp, 1, {2}},
+    {SNMPINBADVERSIONS, ASN_COUNTER, RONLY, var_snmp, 1, {3}},
+    {SNMPINBADCOMMUNITYNAMES, ASN_COUNTER, RONLY, var_snmp, 1, {4}},
+    {SNMPINBADCOMMUNITYUSES, ASN_COUNTER, RONLY, var_snmp, 1, {5}},
+    {SNMPINASNPARSEERRORS, ASN_COUNTER, RONLY, var_snmp, 1, {6}},
+    {SNMPINTOOBIGS, ASN_COUNTER, RONLY, var_snmp, 1, {8}},
+    {SNMPINNOSUCHNAMES, ASN_COUNTER, RONLY, var_snmp, 1, {9}},
+    {SNMPINBADVALUES, ASN_COUNTER, RONLY, var_snmp, 1, {10}},
+    {SNMPINREADONLYS, ASN_COUNTER, RONLY, var_snmp, 1, {11}},
+    {SNMPINGENERRS, ASN_COUNTER, RONLY, var_snmp, 1, {12}},
+    {SNMPINTOTALREQVARS, ASN_COUNTER, RONLY, var_snmp, 1, {13}},
+    {SNMPINTOTALSETVARS, ASN_COUNTER, RONLY, var_snmp, 1, {14}},
+    {SNMPINGETREQUESTS, ASN_COUNTER, RONLY, var_snmp, 1, {15}},
+    {SNMPINGETNEXTS, ASN_COUNTER, RONLY, var_snmp, 1, {16}},
+    {SNMPINSETREQUESTS, ASN_COUNTER, RONLY, var_snmp, 1, {17}},
+    {SNMPINGETRESPONSES, ASN_COUNTER, RONLY, var_snmp, 1, {18}},
+    {SNMPINTRAPS, ASN_COUNTER, RONLY, var_snmp, 1, {19}},
+    {SNMPOUTTOOBIGS, ASN_COUNTER, RONLY, var_snmp, 1, {20}},
+    {SNMPOUTNOSUCHNAMES, ASN_COUNTER, RONLY, var_snmp, 1, {21}},
+    {SNMPOUTBADVALUES, ASN_COUNTER, RONLY, var_snmp, 1, {22}},
+    {SNMPOUTGENERRS, ASN_COUNTER, RONLY, var_snmp, 1, {24}},
+    {SNMPOUTGETREQUESTS, ASN_COUNTER, RONLY, var_snmp, 1, {25}},
+    {SNMPOUTGETNEXTS, ASN_COUNTER, RONLY, var_snmp, 1, {26}},
+    {SNMPOUTSETREQUESTS, ASN_COUNTER, RONLY, var_snmp, 1, {27}},
+    {SNMPOUTGETRESPONSES, ASN_COUNTER, RONLY, var_snmp, 1, {28}},
+    {SNMPOUTTRAPS, ASN_COUNTER, RONLY, var_snmp, 1, {29}},
+    {SNMPENABLEAUTHENTRAPS, ASN_INTEGER, RWRITE, var_snmp, 1, {30}},
+    {SNMPSILENTDROPS, ASN_COUNTER, RONLY, var_snmp, 1, {31}},
+    {SNMPPROXYDROPS, ASN_COUNTER, RONLY, var_snmp, 1, {32}}
+};
+
+/*
+ * Define the OID pointer to the top of the mib tree that we're
+ * registering underneath 
+ */
+oid             snmp_variables_oid[] = { SNMP_OID_MIB2, 11 };
+#ifdef USING_MIBII_SYSTEM_MIB_MODULE
+extern oid      system_module_oid[];
+extern int      system_module_oid_len;
+extern int      system_module_count;
+#endif
+
+static int
+snmp_enableauthentraps_store(int a, int b, void *c, void *d)
+{
+    char            line[SNMP_MAXBUF_SMALL];
+
+    if (snmp_enableauthentrapsset > 0) {
+        snprintf(line, SNMP_MAXBUF_SMALL, "pauthtrapenable %d",
+                 snmp_enableauthentraps);
+        snmpd_store_config(line);
+    }
+    return 0;
+}
+
+void
+init_snmp_mib(void)
+{
+    /*
+     * register ourselves with the agent to handle our mib tree 
+     */
+    REGISTER_MIB("mibII/snmp", snmp_variables, variable1,
+                 snmp_variables_oid);
+
+#ifdef USING_MIBII_SYSTEM_MIB_MODULE
+    if (++system_module_count == 3)
+        REGISTER_SYSOR_TABLE(system_module_oid, system_module_oid_len,
+                             "The MIB module for SNMPv2 entities");
+#endif
+    snmp_register_callback(SNMP_CALLBACK_LIBRARY, SNMP_CALLBACK_STORE_DATA,
+                           snmp_enableauthentraps_store, NULL);
+}
+
+/*
+ * header_snmp(...
+ * Arguments:
+ * vp     IN      - pointer to variable entry that points here
+ * name    IN/OUT  - IN/name requested, OUT/name found
+ * length  IN/OUT  - length of IN/OUT oid's 
+ * exact   IN      - TRUE if an exact match was requested
+ * var_len OUT     - length of variable or 0 if function returned
+ * write_method
+ * 
+ */
+
+        /*********************
+	 *
+	 *  System specific implementation functions
+	 *	(actually common!)
+	 *
+	 *********************/
+
+
+u_char         *
+var_snmp(struct variable *vp,
+         oid * name,
+         size_t * length,
+         int exact, size_t * var_len, WriteMethod ** write_method)
+{
+    static long     long_ret;
+
+    *write_method = 0;          /* assume it isnt writable for the time being */
+    *var_len = sizeof(long_ret);        /* assume an integer and change later if not */
+
+    if (header_generic(vp, name, length, exact, var_len, write_method)
+        == MATCH_FAILED)
+        return NULL;
+
+    /*
+     * this is where we do the value assignments for the mib results. 
+     */
+    if (vp->magic == SNMPENABLEAUTHENTRAPS) {
+        *write_method = write_snmp;
+        long_return = snmp_enableauthentraps;
+        return (u_char *) & long_return;
+    } else if ((vp->magic >= 1)
+               && (vp->magic <=
+                   (STAT_SNMP_STATS_END - STAT_SNMP_STATS_START + 1))) {
+        long_ret =
+            snmp_get_statistic(vp->magic + STAT_SNMP_STATS_START - 1);
+        return (unsigned char *) &long_ret;
+    }
+    return NULL;
+}
+
+/*
+ * only for snmpEnableAuthenTraps:
+ */
+
+int
+write_snmp(int action,
+           u_char * var_val,
+           u_char var_val_type,
+           size_t var_val_len, u_char * statP, oid * name, size_t name_len)
+{
+    long            intval = 0;
+
+    switch (action) {
+    case RESERVE1:             /* Check values for acceptability */
+        if (var_val_type != ASN_INTEGER) {
+            DEBUGMSGTL(("mibII/snmp_mib", "%x not integer type",
+                        var_val_type));
+            return SNMP_ERR_WRONGTYPE;
+        }
+
+        intval = *((long *) var_val);
+        if (intval != 1 && intval != 2) {
+            DEBUGMSGTL(("mibII/snmp_mib", "not valid %x\n", intval));
+            return SNMP_ERR_WRONGVALUE;
+        }
+        if (snmp_enableauthentrapsset < 0) {
+            /*
+             * The object is set in a read-only configuration file.  
+             */
+            return SNMP_ERR_NOTWRITABLE;
+        }
+        break;
+
+    case RESERVE2:             /* Allocate memory and similar resources */
+
+        /*
+         * Using static variables, so nothing needs to be done 
+         */
+        break;
+
+    case ACTION:               /* Perform the SET action (if reversible) */
+
+        /*
+         * Save the old value, in case of UNDO 
+         */
+        intval = *((long *) var_val);
+        old_snmp_enableauthentraps = snmp_enableauthentraps;
+        snmp_enableauthentraps = intval;
+        break;
+
+    case UNDO:                 /* Reverse the SET action and free resources */
+
+        snmp_enableauthentraps = old_snmp_enableauthentraps;
+        break;
+
+    case COMMIT:
+        snmp_enableauthentrapsset = 1;
+        snmp_save_persistent(netsnmp_ds_get_string(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_APPTYPE));
+        (void) snmp_call_callbacks(SNMP_CALLBACK_LIBRARY,
+                                   SNMP_CALLBACK_STORE_DATA, NULL);
+        snmp_clean_persistent(netsnmp_ds_get_string
+                              (NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_APPTYPE));
+        break;
+
+    case FREE:                 /* Free any resources allocated */
+        break;
+    }
+    return SNMP_ERR_NOERROR;
+}
+
+/*********************
+ *
+ *  Internal implementation functions
+ *
+ *********************/
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/mibII/snmp_mib.h tomato121/release/src/router/snmp/agent/mibgroup/mibII/snmp_mib.h
--- tomato/release/src/router/snmp/agent/mibgroup/mibII/snmp_mib.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/mibII/snmp_mib.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,83 @@
+/*
+ *  SNMP MIB group interface - snmp.h
+ *
+ */
+#ifndef _MIBGROUP_SNMP_H
+#define _MIBGROUP_SNMP_H
+
+struct variable;
+
+extern FindVarMethod var_snmp;
+extern WriteMethod write_snmp;
+
+void            init_snmp_mib(void);
+
+extern int      snmp_inpkts;    /*  1 - current */
+extern int      snmp_outpkts;   /*  2 - obsolete */
+extern int      snmp_inbadversions;     /*  3 - current */
+extern int      snmp_inbadcommunitynames;       /*  4 - current */
+extern int      snmp_inbadcommunityuses;        /*  5 - current */
+extern int      snmp_inasnparseerrors;  /*  6 - current */
+extern int      snmp_intoobigs; /*  8 - obsolete */
+extern int      snmp_innosuchnames;     /*  9 - obsolete */
+extern int      snmp_inbadvalues;       /* 10 - obsolete */
+extern int      snmp_inreadonlys;       /* 11 - obsolete */
+extern int      snmp_ingenerrs; /* 12 - obsolete */
+extern int      snmp_intotalreqvars;    /* 13 - obsolete */
+extern int      snmp_intotalsetvars;    /* 14 - obsolete */
+extern int      snmp_ingetrequests;     /* 15 - obsolete */
+extern int      snmp_ingetnexts;        /* 16 - obsolete */
+extern int      snmp_insetrequests;     /* 17 - obsolete */
+extern int      snmp_ingetresponses;    /* 18 - obsolete */
+extern int      snmp_intraps;   /* 19 - obsolete */
+extern int      snmp_outtoobigs;        /* 20 - obsolete */
+extern int      snmp_outnosuchnames;    /* 21 - obsolete */
+extern int      snmp_outbadvalues;      /* 22 - obsolete */
+extern int      snmp_outgenerrs;        /* 24 - obsolete */
+extern int      snmp_outgetrequests;    /* 25 - obsolete */
+extern int      snmp_outgetnexts;       /* 26 - obsolete */
+extern int      snmp_outsetrequests;    /* 27 - obsolete */
+extern int      snmp_outgetresponses;   /* 28 - obsolete */
+extern int      snmp_outtraps;  /* 29 - obsolete */
+extern int      snmp_enableauthentraps; /* 30 - current */
+extern int      snmp_silentdrops;       /* 31 - current */
+extern int      snmp_proxydrops;        /* 32 - current */
+
+extern char    *snmp_trapsink;
+extern char    *snmp_trapcommunity;
+
+
+#define SNMPINPKTS		1
+#define SNMPOUTPKTS		2
+#define SNMPINBADVERSIONS	3
+#define SNMPINBADCOMMUNITYNAMES	4
+#define SNMPINBADCOMMUNITYUSES	5
+#define SNMPINASNPARSEERRORS	6
+#define SNMPINBADTYPES		7
+#define SNMPINTOOBIGS		8
+#define SNMPINNOSUCHNAMES	9
+#define SNMPINBADVALUES		10
+#define SNMPINREADONLYS		11
+#define SNMPINGENERRS		12
+#define SNMPINTOTALREQVARS	13
+#define SNMPINTOTALSETVARS	14
+#define SNMPINGETREQUESTS	15
+#define SNMPINGETNEXTS		16
+#define SNMPINSETREQUESTS	17
+#define SNMPINGETRESPONSES	18
+#define SNMPINTRAPS		19
+#define SNMPOUTTOOBIGS		20
+#define SNMPOUTNOSUCHNAMES	21
+#define SNMPOUTBADVALUES	22
+#define SNMPOUTREADONLYS	23
+#define SNMPOUTGENERRS		24
+#define SNMPOUTGETREQUESTS	25
+#define SNMPOUTGETNEXTS		26
+#define SNMPOUTSETREQUESTS	27
+#define SNMPOUTGETRESPONSES	28
+#define SNMPOUTTRAPS		29
+#define SNMPENABLEAUTHENTRAPS	30
+#define SNMPSILENTDROPS		31
+#define SNMPPROXYDROPS		32
+
+#endif                          /* _MIBGROUP_SNMP_H */
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/mibII/sysORTable.c tomato121/release/src/router/snmp/agent/mibgroup/mibII/sysORTable.c
--- tomato/release/src/router/snmp/agent/mibgroup/mibII/sysORTable.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/mibII/sysORTable.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,292 @@
+/*
+ *  Template MIB group implementation - sysORTable.c
+ *
+ */
+#include <net-snmp/net-snmp-config.h>
+#if HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#include <sys/types.h>
+#if TIME_WITH_SYS_TIME
+# ifdef WIN32
+#  include <sys/timeb.h>
+# else
+#  include <sys/time.h>
+# endif
+# include <time.h>
+#else
+# if HAVE_SYS_TIME_H
+#  include <sys/time.h>
+# else
+#  include <time.h>
+# endif
+#endif
+#if HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+
+#if HAVE_WINSOCK_H
+#include <winsock.h>
+#endif
+#if HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+
+#if HAVE_DMALLOC_H
+#include <dmalloc.h>
+#endif
+
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include <net-snmp/agent/agent_callbacks.h>
+
+#include "struct.h"
+#include "util_funcs.h"
+#include "sysORTable.h"
+#include "snmpd.h"
+
+#ifdef USING_AGENTX_SUBAGENT_MODULE
+#include "agentx/subagent.h"
+#include "agentx/client.h"
+#endif
+
+
+struct timeval  sysOR_lastchange;
+static struct sysORTable *table = NULL;
+static int      numEntries = 0;
+
+/*
+ * define the structure we're going to ask the agent to register our
+ * information at 
+ */
+struct variable1 sysORTable_variables[] = {
+    {SYSORTABLEID, ASN_OBJECT_ID, RONLY, var_sysORTable, 1, {2}},
+    {SYSORTABLEDESCR, ASN_OCTET_STR, RONLY, var_sysORTable, 1, {3}},
+    {SYSORTABLEUPTIME, ASN_TIMETICKS, RONLY, var_sysORTable, 1, {4}}
+};
+
+/*
+ * Define the OID pointer to the top of the mib tree that we're
+ * registering underneath 
+ */
+oid             sysORTable_variables_oid[] = { SNMP_OID_MIB2, 1, 9, 1 };
+#ifdef USING_MIBII_SYSTEM_MIB_MODULE
+extern oid      system_module_oid[];
+extern int      system_module_oid_len;
+extern int      system_module_count;
+#endif
+
+void
+init_sysORTable(void)
+{
+    /*
+     * register ourselves with the agent to handle our mib tree 
+     */
+
+#ifdef USING_AGENTX_SUBAGENT_MODULE
+    if (netsnmp_ds_get_boolean(NETSNMP_DS_APPLICATION_ID, NETSNMP_DS_AGENT_ROLE) == MASTER_AGENT)
+        (void) register_mib_priority("mibII/sysORTable",
+                                     (struct variable *)
+                                     sysORTable_variables,
+                                     sizeof(struct variable1),
+                                     sizeof(sysORTable_variables) /
+                                     sizeof(struct variable1),
+                                     sysORTable_variables_oid,
+                                     sizeof(sysORTable_variables_oid) /
+                                     sizeof(oid), 1);
+    else
+#endif
+        REGISTER_MIB("mibII/sysORTable", sysORTable_variables, variable1,
+                     sysORTable_variables_oid);
+
+#ifdef USING_MIBII_SYSTEM_MIB_MODULE
+    if (++system_module_count == 3)
+        REGISTER_SYSOR_TABLE(system_module_oid, system_module_oid_len,
+                             "The MIB module for SNMPv2 entities");
+#endif
+
+    gettimeofday(&sysOR_lastchange, NULL);
+}
+
+        /*********************
+	 *
+	 *  System specific implementation functions
+	 *
+	 *********************/
+
+u_char         *
+var_sysORTable(struct variable *vp,
+               oid * name,
+               size_t * length,
+               int exact, size_t * var_len, WriteMethod ** write_method)
+{
+    unsigned long   i = 0;
+    static unsigned long ret;
+    struct sysORTable *ptr = table;
+
+    if (header_simple_table
+        (vp, name, length, exact, var_len, write_method, numEntries))
+        return NULL;
+
+    for (i = 1; ptr != NULL && i < name[*length - 1]; ptr = ptr->next, i++) {
+        DEBUGMSGTL(("mibII/sysORTable", "sysORTable -- %lu != %lu\n",
+                    i, name[*length - 1]));
+    }
+    if (ptr == NULL) {
+        DEBUGMSGTL(("mibII/sysORTable", "sysORTable -- no match: %lu\n",
+                    i));
+        return NULL;
+    }
+    DEBUGMSGTL(("mibII/sysORTable", "sysORTable -- match: %lu\n", i));
+
+    switch (vp->magic) {
+    case SYSORTABLEID:
+        *var_len = ptr->OR_oidlen * sizeof(ptr->OR_oid[0]);
+        return (u_char *) ptr->OR_oid;
+
+    case SYSORTABLEDESCR:
+        *var_len = strlen(ptr->OR_descr);
+        return (u_char *) ptr->OR_descr;
+
+    case SYSORTABLEUPTIME:
+        ret = netsnmp_timeval_uptime(&ptr->OR_uptime);
+        return (u_char *) & ret;
+
+    default:
+        DEBUGMSGTL(("snmpd", "unknown sub-id %d in var_sysORTable\n",
+                    vp->magic));
+    }
+    return NULL;
+}
+
+
+int
+register_sysORTable_sess(oid * oidin,
+                         size_t oidlen,
+                         const char *descr, netsnmp_session * ss)
+{
+    struct sysORTable **ptr = &table;
+    struct register_sysOR_parameters reg_sysOR_parms;
+
+    DEBUGMSGTL(("mibII/sysORTable", "sysORTable registering: "));
+    DEBUGMSGOID(("mibII/sysORTable", oidin, oidlen));
+    DEBUGMSG(("mibII/sysORTable", "\n"));
+
+    while (*ptr != NULL)
+        ptr = &((*ptr)->next);
+    *ptr = (struct sysORTable *) malloc(sizeof(struct sysORTable));
+    if (*ptr == NULL) {
+        return SYS_ORTABLE_REGISTRATION_FAILED;
+    }
+    (*ptr)->OR_descr = (char *) malloc(strlen(descr) + 1);
+    if ((*ptr)->OR_descr == NULL) {
+        free(*ptr);
+        return SYS_ORTABLE_REGISTRATION_FAILED;
+    }
+    strcpy((*ptr)->OR_descr, descr);
+    (*ptr)->OR_oidlen = oidlen;
+    (*ptr)->OR_oid = (oid *) malloc(sizeof(oid) * oidlen);
+    if ((*ptr)->OR_oid == NULL) {
+        free(*ptr);
+        free((*ptr)->OR_descr);
+        return SYS_ORTABLE_REGISTRATION_FAILED;
+    }
+    memcpy((*ptr)->OR_oid, oidin, sizeof(oid) * oidlen);
+    gettimeofday(&((*ptr)->OR_uptime), NULL);
+    gettimeofday(&(sysOR_lastchange), NULL);
+    (*ptr)->OR_sess = ss;
+    (*ptr)->next = NULL;
+    numEntries++;
+
+    reg_sysOR_parms.name = oidin;
+    reg_sysOR_parms.namelen = oidlen;
+    reg_sysOR_parms.descr = descr;
+    snmp_call_callbacks(SNMP_CALLBACK_APPLICATION,
+                        SNMPD_CALLBACK_REG_SYSOR, &reg_sysOR_parms);
+
+    return SYS_ORTABLE_REGISTERED_OK;
+}
+
+int
+register_sysORTable(oid * oidin, size_t oidlen, const char *descr)
+{
+    return register_sysORTable_sess(oidin, oidlen, descr, NULL);
+}
+
+
+
+int
+unregister_sysORTable_sess(oid * oidin,
+                           size_t oidlen, netsnmp_session * ss)
+{
+    struct sysORTable **ptr = &table, *prev = NULL;
+    int             found = SYS_ORTABLE_NO_SUCH_REGISTRATION;
+    struct register_sysOR_parameters reg_sysOR_parms;
+
+    DEBUGMSGTL(("mibII/sysORTable", "sysORTable unregistering: "));
+    DEBUGMSGOID(("mibII/sysORTable", oidin, oidlen));
+    DEBUGMSG(("mibII/sysORTable", "\n"));
+
+    while (*ptr != NULL) {
+        if (snmp_oid_compare
+            (oidin, oidlen, (*ptr)->OR_oid, (*ptr)->OR_oidlen) == 0) {
+            if ((*ptr)->OR_sess != ss)
+                continue;       /* different session */
+            if (prev == NULL)
+                table = (*ptr)->next;
+            else
+                prev->next = (*ptr)->next;
+
+            free((*ptr)->OR_descr);
+            free((*ptr)->OR_oid);
+            free((*ptr));
+            numEntries--;
+            gettimeofday(&(sysOR_lastchange), NULL);
+            found = SYS_ORTABLE_UNREGISTERED_OK;
+            break;
+        }
+        prev = *ptr;
+        ptr = &((*ptr)->next);
+    }
+
+    reg_sysOR_parms.name = oidin;
+    reg_sysOR_parms.namelen = oidlen;
+    snmp_call_callbacks(SNMP_CALLBACK_APPLICATION,
+                        SNMPD_CALLBACK_UNREG_SYSOR, &reg_sysOR_parms);
+
+    return found;
+}
+
+
+int
+unregister_sysORTable(oid * oidin, size_t oidlen)
+{
+    return unregister_sysORTable_sess(oidin, oidlen, NULL);
+}
+
+void
+unregister_sysORTable_by_session(netsnmp_session * ss)
+{
+    struct sysORTable *ptr = table, *prev = NULL, *next;
+
+    while (ptr != NULL) {
+        next = ptr->next;
+        if (((ss->flags & SNMP_FLAGS_SUBSESSION) && ptr->OR_sess == ss) ||
+            (!(ss->flags & SNMP_FLAGS_SUBSESSION) && ptr->OR_sess &&
+             ptr->OR_sess->subsession == ss)) {
+            if (prev == NULL)
+                table = next;
+            else
+                prev->next = next;
+            free(ptr->OR_descr);
+            free(ptr->OR_oid);
+            free(ptr);
+            numEntries--;
+            gettimeofday(&(sysOR_lastchange), NULL);
+        } else
+            prev = ptr;
+        ptr = next;
+    }
+}
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/mibII/sysORTable.h tomato121/release/src/router/snmp/agent/mibgroup/mibII/sysORTable.h
--- tomato/release/src/router/snmp/agent/mibgroup/mibII/sysORTable.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/mibII/sysORTable.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,56 @@
+/*
+ *  Template MIB group interface - sysORTable.h
+ *
+ */
+#ifndef _MIBGROUP_SYSORTABLE_H
+#define _MIBGROUP_SYSORTABLE_H
+
+config_require(util_funcs)
+
+     struct sysORTable {
+         char           *OR_descr;
+         oid            *OR_oid;
+         size_t          OR_oidlen;
+         struct timeval  OR_uptime;
+         netsnmp_session *OR_sess;
+         struct sysORTable *next;
+     };
+
+     struct register_sysOR_parameters {
+         oid            *name;
+         int             namelen;
+         const char     *descr;
+     };
+
+     extern void     init_sysORTable(void);
+     extern FindVarMethod var_sysORTable;
+     extern FindVarMethod var_sysORLastChange;
+     extern int      register_sysORTable(oid *, size_t, const char *);
+     extern int      unregister_sysORTable(oid *, size_t);
+     extern int      register_sysORTable_sess(oid *, size_t, const char *,
+                                              netsnmp_session *);
+     extern int      unregister_sysORTable_sess(oid *, size_t,
+                                                netsnmp_session *);
+     extern void     unregister_sysORTable_by_session(netsnmp_session *);
+
+#define	SYSORTABLEINDEX		        1
+#define	SYSORTABLEID		        2
+#define	SYSORTABLEDESCR		        3
+#define	SYSORTABLEUPTIME	        4
+
+#define SYS_ORTABLE_REGISTERED_OK              0
+#define SYS_ORTABLE_REGISTRATION_FAILED       -1
+#define SYS_ORTABLE_UNREGISTERED_OK            0
+#define SYS_ORTABLE_NO_SUCH_REGISTRATION      -1
+
+#ifdef  USING_MIBII_SYSORTABLE_MODULE
+#define REGISTER_SYSOR_ENTRY(theoid, descr)                      \
+  (void)register_sysORTable(theoid, sizeof(theoid)/sizeof(oid), descr);
+#define REGISTER_SYSOR_TABLE(theoid, len, descr)                      \
+  (void)register_sysORTable(theoid, len, descr);
+
+#else
+#define REGISTER_SYSOR_ENTRY(x,y)
+#define REGISTER_SYSOR_TABLE(x,y)
+#endif                          /* USING_MIBII_SYSORTABLE_MODULE */
+#endif                          /* _MIBGROUP_SYSORTABLE_H */
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/mibII/system_mib.c tomato121/release/src/router/snmp/agent/mibgroup/mibII/system_mib.c
--- tomato/release/src/router/snmp/agent/mibgroup/mibII/system_mib.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/mibII/system_mib.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,603 @@
+/*
+ *  System MIB group implementation - system.c
+ *
+ */
+
+#include <net-snmp/net-snmp-config.h>
+
+#if HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#if HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+#include <sys/types.h>
+#if HAVE_WINSOCK_H
+#include <winsock.h>
+#endif
+
+#ifdef HAVE_SYS_TIME_H
+#include <sys/time.h>
+#endif
+
+#include <ctype.h>
+#if HAVE_UTSNAME_H
+#include <utsname.h>
+#else
+#if HAVE_SYS_UTSNAME_H
+#include <sys/utsname.h>
+#endif
+#endif
+#if HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+
+#if HAVE_DMALLOC_H
+#include <dmalloc.h>
+#endif
+
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+#include "util_funcs.h"
+#include "system_mib.h"
+#include "struct.h"
+#include "sysORTable.h"
+
+
+        /*********************
+	 *
+	 *  Kernel & interface information,
+	 *   and internal forward declarations
+	 *
+	 *********************/
+
+#define SYS_STRING_LEN	256
+char            version_descr[SYS_STRING_LEN] = VERS_DESC;
+char            sysContact[SYS_STRING_LEN] = SYS_CONTACT;
+char            sysName[SYS_STRING_LEN] = SYS_NAME;
+char            sysLocation[SYS_STRING_LEN] = SYS_LOC;
+oid             sysObjectID[MAX_OID_LEN];
+int             sysObjectIDLength;
+oid             version_sysoid[] = { SYSTEM_MIB };
+
+char            oldversion_descr[SYS_STRING_LEN];
+char            oldsysContact[SYS_STRING_LEN];
+char            oldsysName[SYS_STRING_LEN];
+char            oldsysLocation[SYS_STRING_LEN];
+
+int             sysServices = 72;
+int             sysServicesConfiged = 0;
+
+extern oid      version_id[];
+extern int      version_id_len;
+
+static int      sysContactSet = 0, sysLocationSet = 0, sysNameSet = 0;
+
+WriteMethod     writeSystem;
+int             header_system(struct variable *, oid *, size_t *, int,
+                              size_t *, WriteMethod **);
+
+        /*********************
+	 *
+	 *  snmpd.conf config parsing
+	 *
+	 *********************/
+
+void
+system_parse_config_sysdescr(const char *token, char *cptr)
+{
+    char            tmpbuf[1024];
+
+    if (strlen(cptr) >= sizeof(version_descr)) {
+        snprintf(tmpbuf,
+                 sizeof(tmpbuf),
+                 "sysdescr token too long (must be < %d):\n\t%s",
+                 sizeof(version_descr),
+                 cptr);
+        config_perror(tmpbuf);
+    } else if (strcmp(cptr, "\"\"") == 0) {
+        version_descr[0] = '\0';
+    } else {
+        strcpy(version_descr, cptr);
+    }
+}
+
+void
+system_parse_config_sysloc(const char *token, char *cptr)
+{
+    char            tmpbuf[1024];
+
+    if (strlen(cptr) >= sizeof(sysLocation)) {
+        snprintf(tmpbuf, 1024,
+                 "syslocation token too long (must be < %d):\n\t%s",
+                 sizeof(sysLocation), cptr);
+        config_perror(tmpbuf);
+    }
+
+    if (strcmp(token, "psyslocation") == 0) {
+        if (sysLocationSet < 0) {
+            /*
+             * This is bogus (and shouldn't happen anyway) -- the sysLocation
+             * is already configured read-only.  
+             */
+            snmp_log(LOG_WARNING,
+                     "ignoring attempted override of read-only sysLocation.0\n");
+            return;
+        } else {
+            sysLocationSet++;
+        }
+    } else {
+        if (sysLocationSet > 0) {
+            /*
+             * This is bogus (and shouldn't happen anyway) -- we already read a
+             * persistent value of sysLocation, which we should ignore in
+             * favour of this one.  
+             */
+            snmp_log(LOG_WARNING,
+                     "ignoring attempted override of read-only sysLocation.0\n");
+            /*
+             * Fall through and copy in this value.  
+             */
+        }
+        sysLocationSet = -1;
+    }
+
+    if (strcmp(cptr, "\"\"") == 0) {
+        sysLocation[0] = '\0';
+    } else if (strlen(cptr) < sizeof(sysLocation)) {
+        strcpy(sysLocation, cptr);
+    }
+}
+
+void
+system_parse_config_syscon(const char *token, char *cptr)
+{
+    char            tmpbuf[1024];
+
+    if (strlen(cptr) >= sizeof(sysContact)) {
+        snprintf(tmpbuf, 1024,
+                 "syscontact token too long (must be < %d):\n\t%s",
+                 sizeof(sysContact), cptr);
+        config_perror(tmpbuf);
+    }
+
+    if (strcmp(token, "psyscontact") == 0) {
+        if (sysContactSet < 0) {
+            /*
+             * This is bogus (and shouldn't happen anyway) -- the sysContact
+             * is already configured read-only.  
+             */
+            snmp_log(LOG_WARNING,
+                     "ignoring attempted override of read-only sysContact.0\n");
+            return;
+        } else {
+            sysContactSet++;
+        }
+    } else {
+        if (sysContactSet > 0) {
+            /*
+             * This is bogus (and shouldn't happen anyway) -- we already read a
+             * persistent value of sysContact, which we should ignore in favour
+             * of this one.  
+             */
+            snmp_log(LOG_WARNING,
+                     "ignoring attempted override of read-only sysContact.0\n");
+            /*
+             * Fall through and copy in this value.  
+             */
+        }
+        sysContactSet = -1;
+    }
+
+    if (strcmp(cptr, "\"\"") == 0) {
+        sysContact[0] = '\0';
+    } else if (strlen(cptr) < sizeof(sysContact)) {
+        strcpy(sysContact, cptr);
+    }
+}
+
+void
+system_parse_config_sysname(const char *token, char *cptr)
+{
+    char            tmpbuf[1024];
+
+    if (strlen(cptr) >= sizeof(sysName)) {
+        snprintf(tmpbuf, 1024,
+                 "sysname token too long (must be < %d):\n\t%s",
+                 sizeof(sysName), cptr);
+        config_perror(tmpbuf);
+    }
+
+    if (strcmp(token, "psysname") == 0) {
+        if (sysNameSet < 0) {
+            /*
+             * This is bogus (and shouldn't happen anyway) -- the sysName
+             * is already configured read-only.  
+             */
+            snmp_log(LOG_WARNING,
+                     "ignoring attempted override of read-only sysName.0\n");
+            return;
+        } else {
+            sysNameSet++;
+        }
+    } else {
+        if (sysNameSet > 0) {
+            /*
+             * This is bogus (and shouldn't happen anyway) -- we already read a
+             * persistent value of sysName, which we should ignore in favour
+             * of this one.  
+             */
+            snmp_log(LOG_WARNING,
+                     "ignoring attempted override of read-only sysName.0\n");
+            /*
+             * Fall through and copy in this value.  
+             */
+        }
+        sysNameSet = -1;
+    }
+
+    if (strcmp(cptr, "\"\"") == 0) {
+        sysName[0] = '\0';
+    } else if (strlen(cptr) < sizeof(sysName)) {
+        strcpy(sysName, cptr);
+    }
+}
+
+void
+system_parse_config_sysServices(const char *token, char *cptr)
+{
+    sysServices = atoi(cptr);
+    sysServicesConfiged = 1;
+}
+
+void system_parse_config_sysObjectID(const char *token, char *cptr)
+{
+    char tmpbuf[1024];
+
+    sysObjectIDLength = MAX_OID_LEN;
+    if (!read_objid(cptr, sysObjectID, &sysObjectIDLength)) {
+        snprintf(tmpbuf,
+                 sizeof(tmpbuf),
+                 "sysobjectid token not a parsable OID:\n\t%s",
+                 cptr);
+        config_perror(tmpbuf);
+        memcpy(sysObjectID, version_sysoid, sizeof(version_sysoid));
+        sysObjectIDLength = OID_LENGTH(version_sysoid);
+    }
+}
+
+
+        /*********************
+	 *
+	 *  Initialisation & common implementation functions
+	 *
+	 *********************/
+
+/*
+ * define the structure we're going to ask the agent to register our
+ * information at 
+ */
+struct variable1 system_variables[] = {
+    {VERSION_DESCR, ASN_OCTET_STR, RONLY, var_system, 1, {1}},
+    {VERSIONID, ASN_OBJECT_ID, RONLY, var_system, 1, {2}},
+    {UPTIME, ASN_TIMETICKS, RONLY, var_system, 1, {3}},
+    {SYSCONTACT, ASN_OCTET_STR, RWRITE, var_system, 1, {4}},
+    {SYSTEMNAME, ASN_OCTET_STR, RWRITE, var_system, 1, {5}},
+    {SYSLOCATION, ASN_OCTET_STR, RWRITE, var_system, 1, {6}},
+    {SYSSERVICES, ASN_INTEGER, RONLY, var_system, 1, {7}},
+    {SYSORLASTCHANGE, ASN_TIMETICKS, RONLY, var_system, 1, {8}}
+};
+/*
+ * Define the OID pointer to the top of the mib tree that we're
+ * registering underneath 
+ */
+oid             system_variables_oid[] = { SNMP_OID_MIB2, 1 };
+oid             system_module_oid[] = { SNMP_OID_SNMPMODULES, 1 };
+int             system_module_oid_len =
+    sizeof(system_module_oid) / sizeof(oid);
+int             system_module_count = 0;
+
+static int
+system_store(int a, int b, void *c, void *d)
+{
+    char            line[SNMP_MAXBUF_SMALL];
+
+    if (sysLocationSet > 0) {
+        snprintf(line, SNMP_MAXBUF_SMALL, "psyslocation %s", sysLocation);
+        snmpd_store_config(line);
+    }
+    if (sysContactSet > 0) {
+        snprintf(line, SNMP_MAXBUF_SMALL, "psyscontact %s", sysContact);
+        snmpd_store_config(line);
+    }
+    if (sysNameSet > 0) {
+        snprintf(line, SNMP_MAXBUF_SMALL, "psysname %s", sysName);
+        snmpd_store_config(line);
+    }
+
+    return 0;
+}
+
+void
+init_system_mib(void)
+{
+
+#ifdef HAVE_UNAME
+    struct utsname  utsName;
+
+    uname(&utsName);
+    snprintf(version_descr, sizeof(version_descr),
+            "%s %s %s %s %s", utsName.sysname,
+            utsName.nodename, utsName.release, utsName.version,
+            utsName.machine);
+    version_descr[ sizeof(version_descr)-1 ] = 0;
+#else
+#if HAVE_EXECV
+    struct extensible extmp;
+
+    /*
+     * set default values of system stuff 
+     */
+    sprintf(extmp.command, "%s -a", UNAMEPROG);
+    /*
+     * setup defaults 
+     */
+    extmp.type = EXECPROC;
+    extmp.next = NULL;
+    exec_command(&extmp);
+    strncpy(version_descr, extmp.output, sizeof(version_descr));
+    version_descr[sizeof(version_descr) - 1] = 0;
+    version_descr[strlen(version_descr) - 1] = 0;       /* chomp new line */
+#else
+    strcpy(version_descr, "unknown");
+#endif
+#endif
+
+#ifdef HAVE_GETHOSTNAME
+    gethostname(sysName, sizeof(sysName));
+#else
+#ifdef HAVE_UNAME
+    strncpy(sysName, utsName.nodename, sizeof(sysName));
+#else
+#if HAVE_EXECV
+    sprintf(extmp.command, "%s -n", UNAMEPROG);
+    /*
+     * setup defaults 
+     */
+    extmp.type = EXECPROC;
+    extmp.next = NULL;
+    exec_command(&extmp);
+    strncpy(sysName, extmp.output, sizeof(sysName));
+    sysName[strlen(sysName) - 1] = 0;   /* chomp new line */
+#else
+    strcpy(sysName, "unknown");
+#endif                          /* HAVE_EXECV */
+#endif                          /* HAVE_UNAME */
+#endif                          /* HAVE_GETHOSTNAME */
+
+    /* default sysObjectID */
+    memcpy(sysObjectID, version_sysoid, sizeof(version_sysoid));
+    sysObjectIDLength = OID_LENGTH(version_sysoid);
+
+    /*
+     * register ourselves with the agent to handle our mib tree 
+     */
+    REGISTER_MIB("mibII/system", system_variables, variable1,
+                 system_variables_oid);
+
+    if (++system_module_count == 3)
+        REGISTER_SYSOR_ENTRY(system_module_oid,
+                             "The MIB module for SNMPv2 entities");
+
+    sysContactSet = sysLocationSet = sysNameSet = 0;
+
+    /*
+     * register our config handlers 
+     */
+    snmpd_register_config_handler("sysdescr",
+                                  system_parse_config_sysdescr, NULL,
+                                  "description");
+    snmpd_register_config_handler("syslocation",
+                                  system_parse_config_sysloc, NULL,
+                                  "location");
+    snmpd_register_config_handler("syscontact", system_parse_config_syscon,
+                                  NULL, "contact-name");
+    snmpd_register_config_handler("sysname", system_parse_config_sysname,
+                                  NULL, "node-name");
+    snmpd_register_config_handler("psyslocation",
+                                  system_parse_config_sysloc, NULL, NULL);
+    snmpd_register_config_handler("psyscontact",
+                                  system_parse_config_syscon, NULL, NULL);
+    snmpd_register_config_handler("psysname", system_parse_config_sysname,
+                                  NULL, NULL);
+    snmpd_register_config_handler("sysservices",
+                                  system_parse_config_sysServices, NULL,
+                                  "NUMBER");
+    snmpd_register_config_handler("sysobjectid",
+                                  system_parse_config_sysObjectID, NULL,
+                                  "OID");
+    snmp_register_callback(SNMP_CALLBACK_LIBRARY, SNMP_CALLBACK_STORE_DATA,
+                           system_store, NULL);
+
+}
+
+
+        /*********************
+	 *
+	 *  System specific implementation functions
+	 *
+	 *********************/
+
+#ifdef USING_MIBII_SYSORTABLE_MODULE
+extern struct timeval sysOR_lastchange;
+#endif
+
+u_char         *
+var_system(struct variable *vp,
+           oid * name,
+           size_t * length,
+           int exact, size_t * var_len, WriteMethod ** write_method)
+{
+    static u_long   ulret;
+
+    if (header_generic(vp, name, length, exact, var_len, write_method) ==
+        MATCH_FAILED)
+        return NULL;
+
+    switch (vp->magic) {
+    case VERSION_DESCR:
+        *var_len = strlen(version_descr);
+        return (u_char *) version_descr;
+    case VERSIONID:
+        *var_len = sysObjectIDLength * sizeof(sysObjectID[0]);
+        return (u_char *)sysObjectID;
+    case UPTIME:
+        ulret = netsnmp_get_agent_uptime();
+        return ((u_char *) & ulret);
+    case SYSCONTACT:
+        *var_len = strlen(sysContact);
+        *write_method = writeSystem;
+        return (u_char *) sysContact;
+    case SYSTEMNAME:
+        *var_len = strlen(sysName);
+        *write_method = writeSystem;
+        return (u_char *) sysName;
+    case SYSLOCATION:
+        *var_len = strlen(sysLocation);
+        *write_method = writeSystem;
+        return (u_char *) sysLocation;
+    case SYSSERVICES:
+#if NO_DUMMY_VALUES
+        if (!sysServicesConfiged)
+            return NULL;
+#endif
+        long_return = sysServices;
+        return (u_char *) & long_return;
+
+#ifdef USING_MIBII_SYSORTABLE_MODULE
+    case SYSORLASTCHANGE:
+        ulret = netsnmp_timeval_uptime(&sysOR_lastchange);
+        return ((u_char *) & ulret);
+#endif
+
+    default:
+        DEBUGMSGTL(("snmpd", "unknown sub-id %d in var_system\n",
+                    vp->magic));
+    }
+    return NULL;
+}
+
+
+
+int
+writeSystem(int action,
+            u_char * var_val,
+            u_char var_val_type,
+            size_t var_val_len,
+            u_char * statP, oid * name, size_t name_len)
+{
+    u_char         *cp;
+    char           *buf = NULL, *oldbuf = NULL;
+    int             count, *setvar = NULL;
+
+    switch ((char) name[7]) {
+    case SYSCONTACT:
+        buf = sysContact;
+        oldbuf = oldsysContact;
+        setvar = &sysContactSet;
+        break;
+    case SYSTEMNAME:
+        buf = sysName;
+        oldbuf = oldsysName;
+        setvar = &sysNameSet;
+        break;
+    case SYSLOCATION:
+        buf = sysLocation;
+        oldbuf = oldsysLocation;
+        setvar = &sysLocationSet;
+        break;
+    default:
+        return SNMP_ERR_GENERR; /* ??? */
+    }
+
+    switch (action) {
+    case RESERVE1:             /* Check values for acceptability */
+        if (var_val_type != ASN_OCTET_STR) {
+            snmp_log(LOG_ERR, "not string\n");
+            return SNMP_ERR_WRONGTYPE;
+        }
+        if (var_val_len > sizeof(sysLocation) - 1) {
+            snmp_log(LOG_ERR, "bad length\n");
+            return SNMP_ERR_WRONGLENGTH;
+        }
+
+        for (cp = var_val, count = 0; count < (int) var_val_len;
+             count++, cp++) {
+            if (!isprint(*cp)) {
+                snmp_log(LOG_ERR, "not print %x\n", *cp);
+                return SNMP_ERR_WRONGVALUE;
+            }
+        }
+        if (setvar != NULL && *setvar < 0) {
+            /*
+             * The object is set in a read-only configuration file.  
+             */
+            return SNMP_ERR_NOTWRITABLE;
+        }
+        break;
+
+    case RESERVE2:             /* Allocate memory and similar resources */
+
+        /*
+         * Using static strings, so nothing needs to be done 
+         */
+        break;
+
+    case ACTION:               /* Perform the SET action (if reversible) */
+
+        /*
+         * Save the old value, in case of UNDO 
+         */
+        strcpy(oldbuf, buf);
+        memcpy(buf, var_val, var_val_len);
+        buf[var_val_len] = 0;
+        break;
+
+    case UNDO:                 /* Reverse the SET action and free resources */
+
+        strcpy(buf, oldbuf);
+        oldbuf[0] = 0;
+        break;
+
+    case COMMIT:
+        if (setvar != NULL) {
+            *setvar = 1;
+        }
+        snmp_save_persistent(netsnmp_ds_get_string(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_APPTYPE));
+        (void) snmp_call_callbacks(SNMP_CALLBACK_LIBRARY,
+                                   SNMP_CALLBACK_STORE_DATA, NULL);
+        snmp_clean_persistent(netsnmp_ds_get_string
+                              (NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_APPTYPE));
+
+    case FREE:                 /* Free any resources allocated */
+
+        /*
+         * No resources have been allocated, but "empty" the 'oldbuf' 
+         */
+        oldbuf[0] = 0;
+        break;
+    }
+    return SNMP_ERR_NOERROR;
+}                               /* end of writeSystem */
+
+        /*********************
+	 *
+	 *  Internal implementation functions - None
+	 *
+	 *********************/
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/mibII/system_mib.h tomato121/release/src/router/snmp/agent/mibgroup/mibII/system_mib.h
--- tomato/release/src/router/snmp/agent/mibgroup/mibII/system_mib.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/mibII/system_mib.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,31 @@
+/*
+ *  System MIB group interface - system.h
+ *
+ */
+#ifndef _MIBGROUP_SYSTEM_MIB_H
+#define _MIBGROUP_SYSTEM_MIB_H
+
+config_require(util_funcs)
+
+     extern char     version_descr[];
+
+     void            init_system_mib(void);
+     extern FindVarMethod var_system;
+
+/*
+ * config file parsing routines 
+ */
+     void            system_parse_config_sysloc(const char *, char *);
+     void            system_parse_config_syscon(const char *, char *);
+     void            system_parse_config_sysname(const char *, char *);
+
+#define	VERSION_DESCR		1
+#define	VERSIONID		2
+#define	UPTIME			3
+#define SYSCONTACT		4
+#define SYSTEMNAME		5
+#define SYSLOCATION		6
+#define SYSSERVICES		7
+#define SYSORLASTCHANGE		8
+
+#endif                          /* _MIBGROUP_SYSTEM_MIB_H */
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/mibII/tcp.c tomato121/release/src/router/snmp/agent/mibgroup/mibII/tcp.c
--- tomato/release/src/router/snmp/agent/mibgroup/mibII/tcp.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/mibII/tcp.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,596 @@
+
+/*
+ *  TCP MIB group implementation - tcp.c
+ *
+ */
+
+#include <net-snmp/net-snmp-config.h>
+
+#if HAVE_STRING_H
+#include <string.h>
+#endif
+#if HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#if HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+
+#if HAVE_SYS_PARAM_H
+#include <sys/param.h>
+#endif
+#if HAVE_SYS_PROTOSW_H
+#include <sys/protosw.h>
+#endif
+
+#if HAVE_SYS_SYSMP_H
+#include <sys/sysmp.h>
+#endif
+#if defined(IFNET_NEEDS_KERNEL) && !defined(_KERNEL)
+#define _KERNEL 1
+#define _I_DEFINED_KERNEL
+#endif
+#if HAVE_SYS_SOCKET_H
+#include <sys/socket.h>
+#endif
+#if HAVE_WINSOCK_H
+#include <winsock.h>
+#endif
+#if HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+#if HAVE_NET_IF_H
+#include <net/if.h>
+#endif
+#if HAVE_NET_IF_VAR_H
+#include <net/if_var.h>
+#endif
+#ifdef _I_DEFINED_KERNEL
+#undef _KERNEL
+#endif
+#if HAVE_SYS_STREAM_H
+#include <sys/stream.h>
+#endif
+#if HAVE_NET_ROUTE_H
+#include <net/route.h>
+#endif
+#if HAVE_NETINET_IN_SYSTM_H
+#include <netinet/in_systm.h>
+#endif
+#if HAVE_NETINET_IP_H
+#include <netinet/ip.h>
+#endif
+#if HAVE_SYS_QUEUE_H
+#include <sys/queue.h>
+#endif
+#if HAVE_NETINET_IP_VAR_H
+#include <netinet/ip_var.h>
+#endif
+#ifdef INET6
+#if HAVE_NETINET6_IP6_VAR_H
+#include <netinet6/ip6_var.h>
+#endif
+#endif
+#if HAVE_SYS_SOCKETVAR_H
+#include <sys/socketvar.h>
+#endif
+#if HAVE_NETINET_IN_PCB_H
+#include <netinet/in_pcb.h>
+#endif
+#if HAVE_INET_MIB2_H
+#include <inet/mib2.h>
+#endif
+
+#if HAVE_SYS_SYSCTL_H
+#include <sys/sysctl.h>
+#endif
+#if HAVE_ARPA_INET_H
+#include <arpa/inet.h>
+#endif
+
+#if defined(osf4) || defined(aix4) || defined(hpux10)
+/*
+ * these are undefed to remove a stupid warning on osf compilers
+ * because they get redefined with a slightly different notation of the
+ * same value.  -- Wes 
+ */
+#undef TCP_NODELAY
+#undef TCP_MAXSEG
+#endif
+#if HAVE_NETINET_TCP_H
+#include <netinet/tcp.h>
+#endif
+#if HAVE_NETINET_TCPIP_H
+#include <netinet/tcpip.h>
+#endif
+#if HAVE_NETINET_TCP_TIMER_H
+#include <netinet/tcp_timer.h>
+#endif
+#if HAVE_NETINET_TCP_VAR_H
+#include <netinet/tcp_var.h>
+#endif
+#if HAVE_NETINET_TCP_FSM_H
+#include <netinet/tcp_fsm.h>
+#endif
+#if HAVE_SYS_TCPIPSTATS_H
+#include <sys/tcpipstats.h>
+#endif
+
+#if HAVE_DMALLOC_H
+#include <dmalloc.h>
+#endif
+
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include <net-snmp/agent/auto_nlist.h>
+
+#ifdef solaris2
+#include "kernel_sunos5.h"
+#else
+#include "kernel.h"
+#endif
+#ifdef linux
+#include "kernel_linux.h"
+#endif
+#include "util_funcs.h"
+
+#ifdef hpux
+#include <sys/mib.h>
+#include <netinet/mib_kern.h>
+#endif                          /* hpux */
+
+#ifdef cygwin
+#define WIN32
+#include <windows.h>
+#endif
+
+#include "tcp.h"
+#include "tcpTable.h"
+#include "sysORTable.h"
+
+#ifndef MIB_STATS_CACHE_TIMEOUT
+#define MIB_STATS_CACHE_TIMEOUT	5
+#endif
+#ifndef TCP_STATS_CACHE_TIMEOUT
+#define TCP_STATS_CACHE_TIMEOUT	MIB_STATS_CACHE_TIMEOUT
+#endif
+marker_t        tcp_stats_cache_marker = NULL;
+
+        /*********************
+	 *
+	 *  Kernel & interface information,
+	 *   and internal forward declarations
+	 *
+	 *********************/
+
+#ifdef freebsd4
+static unsigned int hz;
+#endif
+
+        /*********************
+	 *
+	 *  Initialisation & common implementation functions
+	 *
+	 *********************/
+
+struct variable3 tcp_variables[] = {
+    {TCPRTOALGORITHM, ASN_INTEGER, RONLY, var_tcp, 1, {1}},
+    {TCPRTOMIN, ASN_INTEGER, RONLY, var_tcp, 1, {2}},
+#ifndef sunV3
+    {TCPRTOMAX, ASN_INTEGER, RONLY, var_tcp, 1, {3}},
+#endif
+    {TCPMAXCONN, ASN_INTEGER, RONLY, var_tcp, 1, {4}},
+#ifndef sunV3
+    {TCPACTIVEOPENS, ASN_COUNTER, RONLY, var_tcp, 1, {5}},
+    {TCPPASSIVEOPENS, ASN_COUNTER, RONLY, var_tcp, 1, {6}},
+    {TCPATTEMPTFAILS, ASN_COUNTER, RONLY, var_tcp, 1, {7}},
+    {TCPESTABRESETS, ASN_COUNTER, RONLY, var_tcp, 1, {8}},
+#endif
+    {TCPCURRESTAB, ASN_GAUGE, RONLY, var_tcp, 1, {9}},
+#ifndef sunV3
+    {TCPINSEGS, ASN_COUNTER, RONLY, var_tcp, 1, {10}},
+    {TCPOUTSEGS, ASN_COUNTER, RONLY, var_tcp, 1, {11}},
+    {TCPRETRANSSEGS, ASN_COUNTER, RONLY, var_tcp, 1, {12}},
+#endif
+#ifdef WIN32
+    {TCPCONNSTATE, ASN_INTEGER, RWRITE, var_tcpEntry, 3, {13, 1, 1}},
+#else
+    {TCPCONNSTATE, ASN_INTEGER, RONLY, var_tcpEntry, 3, {13, 1, 1}},
+#endif
+    {TCPCONNLOCALADDRESS, ASN_IPADDRESS, RONLY, var_tcpEntry, 3,
+     {13, 1, 2}},
+    {TCPCONNLOCALPORT, ASN_INTEGER, RONLY, var_tcpEntry, 3, {13, 1, 3}},
+    {TCPCONNREMADDRESS, ASN_IPADDRESS, RONLY, var_tcpEntry, 3, {13, 1, 4}},
+    {TCPCONNREMPORT, ASN_INTEGER, RONLY, var_tcpEntry, 3, {13, 1, 5}},
+    {TCPINERRS, ASN_COUNTER, RONLY, var_tcp, 1, {14}},
+    {TCPOUTRSTS, ASN_COUNTER, RONLY, var_tcp, 1, {15}}
+};
+
+/*
+ * Define the OID pointer to the top of the mib tree that we're
+ * registering underneath, and the OID for the MIB module 
+ */
+oid             tcp_variables_oid[] = { SNMP_OID_MIB2, 6 };
+oid             tcp_module_oid[] = { SNMP_OID_MIB2, 49 };
+
+void
+init_tcp(void)
+{
+    /*
+     * register ourselves with the agent to handle our mib tree 
+     */
+    REGISTER_MIB("mibII/tcp", tcp_variables, variable3,
+                 tcp_variables_oid);
+    REGISTER_SYSOR_ENTRY(tcp_module_oid,
+                         "The MIB module for managing TCP implementations");
+
+#ifdef TCPSTAT_SYMBOL
+    auto_nlist(TCPSTAT_SYMBOL, 0, 0);
+#endif
+#ifdef TCP_SYMBOL
+    auto_nlist(TCP_SYMBOL, 0, 0);
+#endif
+#if freebsd4
+    hz = sysconf(_SC_CLK_TCK);  /* get ticks/s from system */
+#endif
+#ifdef solaris2
+    init_kernel_sunos5();
+#endif
+}
+
+
+        /*********************
+	 *
+	 *  System specific implementation functions
+	 *
+	 *********************/
+
+#ifdef linux
+#define TCP_STAT_STRUCTURE	struct tcp_mib
+#define USES_SNMP_DESIGNED_TCPSTAT
+#undef TCPSTAT_SYMBOL
+#endif
+
+#ifdef solaris2
+#define TCP_STAT_STRUCTURE	mib2_tcp_t
+#define USES_SNMP_DESIGNED_TCPSTAT
+#endif
+
+#ifdef hpux11
+#define TCP_STAT_STRUCTURE	int
+#endif
+
+#ifdef WIN32
+#include <iphlpapi.h>
+#define TCP_STAT_STRUCTURE     MIB_TCPSTATS
+#endif
+
+#ifdef HAVE_SYS_TCPIPSTATS_H
+#define TCP_STAT_STRUCTURE	struct kna
+#define USES_TRADITIONAL_TCPSTAT
+#endif
+
+#if !defined(TCP_STAT_STRUCTURE)
+#define TCP_STAT_STRUCTURE	struct tcpstat
+#define USES_TRADITIONAL_TCPSTAT
+#endif
+
+long            read_tcp_stat(TCP_STAT_STRUCTURE *, int);
+
+
+u_char         *
+var_tcp(struct variable *vp,
+        oid * name,
+        size_t * length,
+        int exact, size_t * var_len, WriteMethod ** write_method)
+{
+    static TCP_STAT_STRUCTURE tcpstat;
+    static long     ret_value;
+#ifdef TCPTV_NEEDS_HZ
+    /*
+     * I don't know of any such system now, but maybe they'll figure
+     * it out some day.
+     */
+    int             hz = 1000;
+#endif
+
+    if (header_generic(vp, name, length, exact, var_len, write_method) ==
+        MATCH_FAILED)
+        return NULL;
+
+    ret_value = read_tcp_stat(&tcpstat, vp->magic);
+    if (ret_value < 0)
+        return NULL;
+
+#ifdef HAVE_SYS_TCPIPSTATS_H
+    /*
+     * This actually reads statistics for *all* the groups together,
+     * so we need to isolate the TCP-specific bits.  
+     */
+#define tcpstat          tcpstat.tcpstat
+#endif
+
+    switch (vp->magic) {
+#ifdef USES_SNMP_DESIGNED_TCPSTAT
+    case TCPRTOALGORITHM:
+        return (u_char *) & tcpstat.tcpRtoAlgorithm;
+    case TCPRTOMIN:
+        return (u_char *) & tcpstat.tcpRtoMin;
+    case TCPRTOMAX:
+        return (u_char *) & tcpstat.tcpRtoMax;
+    case TCPMAXCONN:
+        return (u_char *) & tcpstat.tcpMaxConn;
+    case TCPACTIVEOPENS:
+        return (u_char *) & tcpstat.tcpActiveOpens;
+    case TCPPASSIVEOPENS:
+        return (u_char *) & tcpstat.tcpPassiveOpens;
+    case TCPATTEMPTFAILS:
+        return (u_char *) & tcpstat.tcpAttemptFails;
+    case TCPESTABRESETS:
+        return (u_char *) & tcpstat.tcpEstabResets;
+    case TCPCURRESTAB:
+        return (u_char *) & tcpstat.tcpCurrEstab;
+    case TCPINSEGS:
+        return (u_char *) & tcpstat.tcpInSegs;
+    case TCPOUTSEGS:
+        return (u_char *) & tcpstat.tcpOutSegs;
+    case TCPRETRANSSEGS:
+        return (u_char *) & tcpstat.tcpRetransSegs;
+    case TCPINERRS:
+#ifdef solaris2
+        return (u_char *) & ret_value;
+#elif defined(linux)
+        if (tcpstat.tcpInErrsValid)
+            return (u_char *) & tcpstat.tcpInErrs;
+        return NULL;
+#else
+        return NULL;
+#endif
+    case TCPOUTRSTS:
+#ifdef linux
+        if (tcpstat.tcpOutRstsValid)
+            return (u_char *) & tcpstat.tcpOutRsts;
+        return NULL;
+#else
+        return NULL;
+#endif
+#endif
+
+#ifdef USES_TRADITIONAL_TCPSTAT
+    case TCPRTOALGORITHM:      /* Assume Van Jacobsen's algorithm */
+        long_return = 4;
+        return (u_char *) & long_return;
+    case TCPRTOMIN:
+#ifdef TCPTV_NEEDS_HZ
+        long_return = TCPTV_MIN;
+#else
+        long_return = TCPTV_MIN / PR_SLOWHZ * 1000;
+#endif
+        return (u_char *) & long_return;
+    case TCPRTOMAX:
+#ifdef TCPTV_NEEDS_HZ
+        long_return = TCPTV_REXMTMAX;
+#else
+        long_return = TCPTV_REXMTMAX / PR_SLOWHZ * 1000;
+#endif
+        return (u_char *) & long_return;
+    case TCPMAXCONN:
+        return NULL;
+    case TCPACTIVEOPENS:
+        return (u_char *) & tcpstat.tcps_connattempt;
+    case TCPPASSIVEOPENS:
+        return (u_char *) & tcpstat.tcps_accepts;
+        /*
+         * NB:  tcps_drops is actually the sum of the two MIB
+         *      counters tcpAttemptFails and tcpEstabResets.
+         */
+    case TCPATTEMPTFAILS:
+        return (u_char *) & tcpstat.tcps_conndrops;
+    case TCPESTABRESETS:
+        return (u_char *) & tcpstat.tcps_drops;
+    case TCPCURRESTAB:
+        long_return = TCP_Count_Connections();
+        return (u_char *) & long_return;
+    case TCPINSEGS:
+        return (u_char *) & tcpstat.tcps_rcvtotal;
+    case TCPOUTSEGS:
+        /*
+         * RFC 1213 defines this as the number of segments sent
+         * "excluding those containing only retransmitted octets"
+         */
+        long_return = tcpstat.tcps_sndtotal - tcpstat.tcps_sndrexmitpack;
+        return (u_char *) & long_return;
+    case TCPRETRANSSEGS:
+        return (u_char *) & tcpstat.tcps_sndrexmitpack;
+    case TCPINERRS:
+        long_return = tcpstat.tcps_rcvbadsum + tcpstat.tcps_rcvbadoff
+#ifdef STRUCT_TCPSTAT_HAS_TCPS_RCVMEMDROP
+            + tcpstat.tcps_rcvmemdrop
+#endif
+            + tcpstat.tcps_rcvshort;
+        return (u_char *) & long_return;
+    case TCPOUTRSTS:
+        long_return = tcpstat.tcps_sndctrl - tcpstat.tcps_closed;
+        return (u_char *) & long_return;
+#endif
+#ifdef WIN32
+    case TCPRTOALGORITHM:
+        return (u_char *) & tcpstat.dwRtoAlgorithm;
+    case TCPRTOMIN:
+        return (u_char *) & tcpstat.dwRtoMin;
+    case TCPRTOMAX:
+        return (u_char *) & tcpstat.dwRtoMax;
+    case TCPMAXCONN:
+        return (u_char *) & tcpstat.dwMaxConn;
+    case TCPACTIVEOPENS:
+        return (u_char *) & tcpstat.dwActiveOpens;
+    case TCPPASSIVEOPENS:
+        return (u_char *) & tcpstat.dwPassiveOpens;
+    case TCPATTEMPTFAILS:
+        return (u_char *) & tcpstat.dwAttemptFails;
+    case TCPESTABRESETS:
+        return (u_char *) & tcpstat.dwEstabResets;
+    case TCPCURRESTAB:
+        return (u_char *) & tcpstat.dwCurrEstab;
+    case TCPINSEGS:
+        return (u_char *) & tcpstat.dwInSegs;
+    case TCPOUTSEGS:
+        return (u_char *) & tcpstat.dwOutSegs;
+    case TCPRETRANSSEGS:
+        return (u_char *) & tcpstat.dwRetransSegs;
+    case TCPINERRS:
+        return (u_char *) & tcpstat.dwInErrs;
+    case TCPOUTRSTS:
+        return (u_char *) & tcpstat.dwOutRsts;
+#endif
+    default:
+        DEBUGMSGTL(("snmpd", "unknown sub-id %d in var_tcp\n", vp->magic));
+    }
+    return NULL;
+
+#ifdef HAVE_SYS_TCPIPSTATS_H
+#undef tcpstat
+#endif
+}
+
+
+        /*********************
+	 *
+	 *  Internal implementation functions
+	 *
+	 *********************/
+
+long
+read_tcp_stat(TCP_STAT_STRUCTURE * tcpstat, int magic)
+{
+    long            ret_value = -1;
+#if (defined(CAN_USE_SYSCTL) && defined(TCPCTL_STATS))
+    static int      sname[4] =
+        { CTL_NET, PF_INET, IPPROTO_TCP, TCPCTL_STATS };
+    size_t          len = sizeof(*tcpstat);
+#endif
+#ifdef solaris2
+    static mib2_ip_t ipstat;
+#endif
+#ifdef hpux11
+    int             fd;
+    struct nmparms  p;
+    unsigned int    ulen;
+    int             ret;
+
+    if ((fd = open_mib("/dev/ip", O_RDONLY, 0, NM_ASYNC_OFF)) < 0)
+        return (-1);            /* error */
+
+    switch (magic) {
+    case TCPRTOALGORITHM:
+        p.objid = ID_tcpRtoAlgorithm;
+        break;
+    case TCPRTOMIN:
+        p.objid = ID_tcpRtoMin;
+        break;
+    case TCPRTOMAX:
+        p.objid = ID_tcpRtoMax;
+        break;
+    case TCPMAXCONN:
+        p.objid = ID_tcpMaxConn;
+        break;
+    case TCPACTIVEOPENS:
+        p.objid = ID_tcpActiveOpens;
+        break;
+    case TCPPASSIVEOPENS:
+        p.objid = ID_tcpPassiveOpens;
+        break;
+    case TCPATTEMPTFAILS:
+        p.objid = ID_tcpAttemptFails;
+        break;
+    case TCPESTABRESETS:
+        p.objid = ID_tcpEstabResets;
+        break;
+    case TCPCURRESTAB:
+        p.objid = ID_tcpCurrEstab;
+        break;
+    case TCPINSEGS:
+        p.objid = ID_tcpInSegs;
+        break;
+    case TCPOUTSEGS:
+        p.objid = ID_tcpOutSegs;
+        break;
+    case TCPRETRANSSEGS:
+        p.objid = ID_tcpRetransSegs;
+        break;
+    case TCPINERRS:
+        p.objid = ID_tcpInErrs;
+        break;
+    case TCPOUTRSTS:
+        p.objid = ID_tcpOutRsts;
+        break;
+    default:
+        *tcpstat = 0;
+        close_mib(fd);
+        return (0);
+    }
+
+    p.buffer = (void *) tcpstat;
+    ulen = sizeof(TCP_STAT_STRUCTURE);
+    p.len = &ulen;
+    ret_value = get_mib_info(fd, &p);
+    close_mib(fd);
+
+    return (ret_value);         /* 0: ok, < 0: error */
+#else                           /* hpux11 */
+
+    if (tcp_stats_cache_marker &&
+        (!atime_ready
+         (tcp_stats_cache_marker, TCP_STATS_CACHE_TIMEOUT * 1000)))
+#ifdef solaris2
+        return (magic == TCPINERRS ? ipstat.tcpInErrs : 0);
+#else
+        return 0;
+#endif
+
+    if (tcp_stats_cache_marker)
+        atime_setMarker(tcp_stats_cache_marker);
+    else
+        tcp_stats_cache_marker = atime_newMarker();
+
+#ifdef linux
+    ret_value = linux_read_tcp_stat(tcpstat);
+#endif
+
+#ifdef solaris2
+    if (magic == TCPINERRS) {
+        if (getMibstat
+            (MIB_IP, &ipstat, sizeof(mib2_ip_t), GET_FIRST,
+             &Get_everything, NULL) < 0)
+            ret_value = -1;
+        else
+            ret_value = ipstat.tcpInErrs;
+    } else
+        ret_value = getMibstat(MIB_TCP, tcpstat, sizeof(mib2_tcp_t),
+                               GET_FIRST, &Get_everything, NULL);
+#endif
+
+#ifdef WIN32
+    ret_value = GetTcpStatistics(tcpstat);
+#endif
+
+#ifdef HAVE_SYS_TCPIPSTATS_H
+    ret_value = sysmp(MP_SAGET, MPSA_TCPIPSTATS, tcpstat, sizeof *tcpstat);
+#endif
+
+#if defined(CAN_USE_SYSCTL) && defined(TCPCTL_STATS)
+    ret_value = sysctl(sname, 4, tcpstat, &len, 0, 0);
+#endif
+
+#ifdef TCPSTAT_SYMBOL
+    if (auto_nlist(TCPSTAT_SYMBOL, (char *) tcpstat, sizeof(*tcpstat)))
+        ret_value = 0;
+#endif
+
+    if (ret_value == -1) {
+        free(tcp_stats_cache_marker);
+        tcp_stats_cache_marker = NULL;
+    }
+    return ret_value;
+#endif                          /* hpux11 */
+}
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/mibII/tcp.h tomato121/release/src/router/snmp/agent/mibgroup/mibII/tcp.h
--- tomato/release/src/router/snmp/agent/mibgroup/mibII/tcp.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/mibII/tcp.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,37 @@
+/*
+ *  TCP MIB group interface - tcp.h
+ *
+ */
+#ifndef _MIBGROUP_TCP_H
+#define _MIBGROUP_TCP_H
+
+
+config_require(mibII/tcpTable util_funcs)
+config_arch_require(solaris2, kernel_sunos5)
+config_arch_require(linux, mibII/kernel_linux)
+
+extern void     init_tcp(void);
+extern FindVarMethod var_tcp;
+
+
+#define TCPRTOALGORITHM      1
+#define TCPRTOMIN	     2
+#define TCPRTOMAX	     3
+#define TCPMAXCONN	     4
+#define TCPACTIVEOPENS	     5
+#define TCPPASSIVEOPENS      6
+#define TCPATTEMPTFAILS      7
+#define TCPESTABRESETS	     8
+#define TCPCURRESTAB	     9
+#define TCPINSEGS	    10
+#define TCPOUTSEGS	    11
+#define TCPRETRANSSEGS	    12
+#define TCPCONNSTATE	    13
+#define TCPCONNLOCALADDRESS 14
+#define TCPCONNLOCALPORT    15
+#define TCPCONNREMADDRESS   16
+#define TCPCONNREMPORT	    17
+#define TCPINERRS           18
+#define TCPOUTRSTS          19
+
+#endif                          /* _MIBGROUP_TCP_H */
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/mibII/tcpTable.c tomato121/release/src/router/snmp/agent/mibgroup/mibII/tcpTable.c
--- tomato/release/src/router/snmp/agent/mibgroup/mibII/tcpTable.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/mibII/tcpTable.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,996 @@
+
+/*
+ *  TCP MIB group implementation - tcp.c
+ *
+ */
+
+#include <net-snmp/net-snmp-config.h>
+
+#if HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#if HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+
+#if HAVE_SYS_PARAM_H
+#include <sys/param.h>
+#endif
+#if HAVE_SYS_PROTOSW_H
+#include <sys/protosw.h>
+#endif
+
+#if HAVE_SYS_SYSMP_H
+#include <sys/sysmp.h>
+#endif
+#if defined(IFNET_NEEDS_KERNEL) && !defined(_KERNEL)
+#define _KERNEL 1
+#define _I_DEFINED_KERNEL
+#endif
+#if HAVE_SYS_SOCKET_H
+#include <sys/socket.h>
+#endif
+#if HAVE_WINSOCK_H
+#include <winsock.h>
+#endif
+#if HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+#if HAVE_NET_IF_H
+#include <net/if.h>
+#endif
+#if HAVE_NET_IF_VAR_H
+#include <net/if_var.h>
+#endif
+#ifdef _I_DEFINED_KERNEL
+#undef _KERNEL
+#endif
+#if HAVE_SYS_STREAM_H
+#include <sys/stream.h>
+#endif
+#if HAVE_NET_ROUTE_H
+#include <net/route.h>
+#endif
+#if HAVE_NETINET_IN_SYSTM_H
+#include <netinet/in_systm.h>
+#endif
+#if HAVE_NETINET_IP_H
+#include <netinet/ip.h>
+#endif
+#if HAVE_SYS_QUEUE_H
+#include <sys/queue.h>
+#endif
+#if HAVE_NETINET_IP_VAR_H
+#include <netinet/ip_var.h>
+#endif
+#ifdef INET6
+#if HAVE_NETINET6_IP6_VAR_H
+#include <netinet6/ip6_var.h>
+#endif
+#endif
+#if HAVE_SYS_SOCKETVAR_H
+#include <sys/socketvar.h>
+#endif
+#if HAVE_NETINET_IN_PCB_H
+#include <netinet/in_pcb.h>
+#endif
+#if HAVE_INET_MIB2_H
+#include <inet/mib2.h>
+#endif
+#ifdef solaris2
+#include "kernel_sunos5.h"
+#else
+#include "kernel.h"
+#endif
+
+#if HAVE_SYS_SYSCTL_H
+#include <sys/sysctl.h>
+#endif
+#if HAVE_ARPA_INET_H
+#include <arpa/inet.h>
+#endif
+
+#if defined(osf4) || defined(aix4) || defined(hpux10)
+/*
+ * these are undefed to remove a stupid warning on osf compilers
+ * because they get redefined with a slightly different notation of the
+ * same value.  -- Wes 
+ */
+#undef TCP_NODELAY
+#undef TCP_MAXSEG
+#endif
+#if HAVE_NETINET_TCP_H
+#include <netinet/tcp.h>
+#endif
+#if HAVE_NETINET_TCPIP_H
+#include <netinet/tcpip.h>
+#endif
+#if HAVE_NETINET_TCP_TIMER_H
+#include <netinet/tcp_timer.h>
+#endif
+#if HAVE_NETINET_TCP_VAR_H
+#include <netinet/tcp_var.h>
+#endif
+#if HAVE_NETINET_TCP_FSM_H
+#include <netinet/tcp_fsm.h>
+#endif
+#if HAVE_SYS_TCPIPSTATS_H
+#include <sys/tcpipstats.h>
+#endif
+
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include <net-snmp/agent/auto_nlist.h>
+
+#ifdef hpux
+#include <sys/mib.h>
+#include <netinet/mib_kern.h>
+#endif                          /* hpux */
+
+#ifdef cygwin
+#define WIN32
+#include <windows.h>
+#endif
+
+#include "tcp.h"
+#include "tcpTable.h"
+
+#if HAVE_DMALLOC_H
+#include <dmalloc.h>
+#endif
+
+        /*********************
+	 *
+	 *  Kernel & interface information,
+	 *   and internal forward declarations
+	 *
+	 *********************/
+
+
+        /*********************
+	 *
+	 *  Initialisation & common implementation functions
+	 *
+	 *********************/
+
+
+        /*********************
+	 *
+	 *  System specific implementation functions
+	 *
+	 *********************/
+#ifndef WIN32
+#ifndef solaris2
+
+u_char         *
+var_tcpEntry(struct variable *vp,
+             oid * name,
+             size_t * length,
+             int exact, size_t * var_len, WriteMethod ** write_method)
+{
+    int             i;
+    oid             newname[MAX_OID_LEN], lowest[MAX_OID_LEN], *op;
+    u_char         *cp;
+#ifdef hpux11
+    int             LowState;
+    static mib_tcpConnEnt tcp, Lowtcp;
+#else
+    int             State, LowState;
+    static struct inpcb inpcb, Lowinpcb;
+#endif
+
+    /*
+     *  Allow for a kernel w/o TCP
+     */
+#ifdef TCPSTAT_SYMBOL
+#if !defined(linux) && !defined(hpux11)
+    if (auto_nlist_value(TCPSTAT_SYMBOL) == -1)
+        return (NULL);
+#endif
+#endif
+
+    memcpy((char *) newname, (char *) vp->name,
+           (int) vp->namelen * sizeof(oid));
+    lowest[0] = 9999;
+
+    /*
+     * find "next" connection 
+     */
+#ifndef hpux11
+  Again:
+#endif
+    LowState = -1;              /* Don't have one yet */
+    TCP_Scan_Init();
+    for (;;) {
+#ifdef hpux11
+        if ((i = TCP_Scan_Next(&tcp)) == 0)
+            break;              /* Done */
+        cp = (u_char *) & tcp.LocalAddress;
+#else                           /* hpux11 */
+        if ((i = TCP_Scan_Next(&State, &inpcb)) < 0)
+            goto Again;
+        if (i == 0)
+            break;              /* Done */
+        cp = (u_char *) & inpcb.inp_laddr.s_addr;
+#endif                          /* hpux11 */
+        op = newname + 10;
+        *op++ = *cp++;
+        *op++ = *cp++;
+        *op++ = *cp++;
+        *op++ = *cp++;
+
+#ifdef hpux11
+        newname[14] = (unsigned short) tcp.LocalPort;
+#else
+        newname[14] = ntohs(inpcb.inp_lport);
+#endif
+
+#ifdef hpux11
+        cp = (u_char *) & tcp.RemAddress;
+#else
+        cp = (u_char *) & inpcb.inp_faddr.s_addr;
+#endif
+        op = newname + 15;
+        *op++ = *cp++;
+        *op++ = *cp++;
+        *op++ = *cp++;
+        *op++ = *cp++;
+
+#ifdef hpux11
+        newname[19] = (unsigned short) tcp.RemPort;
+#else
+        newname[19] = ntohs(inpcb.inp_fport);
+#endif
+
+        if (exact) {
+            if (snmp_oid_compare(newname, 20, name, *length) == 0) {
+                memcpy((char *) lowest, (char *) newname,
+                       20 * sizeof(oid));
+#ifdef hpux11
+                LowState = tcp.State;
+                Lowtcp = tcp;
+#else                           /* hpux11 */
+                LowState = State;
+                Lowinpcb = inpcb;
+#endif                          /* hpux11 */
+                break;          /* no need to search further */
+            }
+        } else {
+            if (snmp_oid_compare(newname, 20, name, *length) > 0 &&
+                snmp_oid_compare(newname, 20, lowest, 20) < 0) {
+                /*
+                 * if new one is greater than input and closer to input than
+                 * previous lowest, save this one as the "next" one.
+                 */
+                memcpy((char *) lowest, (char *) newname,
+                       20 * sizeof(oid));
+#ifdef hpux11
+                LowState = tcp.State;
+                Lowtcp = tcp;
+#else                           /* hpux11 */
+                LowState = State;
+                Lowinpcb = inpcb;
+#endif                          /* hpux11 */
+            }
+        }
+    }
+    if (LowState < 0)
+        return (NULL);
+    memcpy((char *) name, (char *) lowest,
+           (vp->namelen + 10) * sizeof(oid));
+    *length = vp->namelen + 10;
+    *write_method = 0;
+    *var_len = sizeof(long);
+    switch (vp->magic) {
+    case TCPCONNSTATE:{
+#ifdef hpux11
+            long_return = LowState;
+            return (u_char *) & long_return;
+#else                           /* hpux11 */
+#ifndef hpux
+            static int      StateMap[] =
+                { 1, 2, 3, 4, 5, 8, 6, 10, 9, 7, 11 };
+#else
+            static int      StateMap[] =
+                { 1, 2, 3, -1, 4, 5, 8, 6, 10, 9, 7, 11 };
+#endif
+            long_return = StateMap[LowState];
+            return (u_char *) & StateMap[LowState];
+#endif                          /* hpux11 */
+        }
+    case TCPCONNLOCALADDRESS:
+#ifdef hpux11
+        return (u_char *) & Lowtcp.LocalAddress;
+#else
+        return (u_char *) & Lowinpcb.inp_laddr.s_addr;
+#endif
+    case TCPCONNLOCALPORT:
+#ifdef hpux11
+        long_return = (unsigned short) Lowtcp.LocalPort;
+#else
+        long_return = ntohs(Lowinpcb.inp_lport);
+#endif
+        return (u_char *) & long_return;
+    case TCPCONNREMADDRESS:
+#ifdef hpux11
+        return (u_char *) & Lowtcp.RemAddress;
+#else
+        return (u_char *) & Lowinpcb.inp_faddr.s_addr;
+#endif
+    case TCPCONNREMPORT:
+#ifdef hpux11
+        long_return = (unsigned short) Lowtcp.RemPort;
+#else
+        long_return = ntohs(Lowinpcb.inp_fport);
+#endif
+        return (u_char *) & long_return;
+    }
+    return NULL;
+}
+
+#else                           /* solaris2 - tcp */
+
+
+static int
+TCP_Cmp(void *addr, void *ep)
+{
+    if (memcmp((mib2_tcpConnEntry_t *) ep, (mib2_tcpConnEntry_t *) addr,
+               sizeof(mib2_tcpConnEntry_t)) == 0)
+        return (0);
+    else
+        return (1);
+}
+
+
+u_char         *
+var_tcpEntry(struct variable * vp,
+             oid * name,
+             size_t * length,
+             int exact, size_t * var_len, WriteMethod ** write_method)
+{
+    oid             newname[MAX_OID_LEN], lowest[MAX_OID_LEN], *op;
+    u_char         *cp;
+
+#define TCP_CONN_LENGTH	20
+#define TCP_LOCADDR_OFF	10
+#define TCP_LOCPORT_OFF	14
+#define TCP_REMADDR_OFF	15
+#define TCP_REMPORT_OFF	19
+    mib2_tcpConnEntry_t Lowentry, Nextentry, entry;
+    req_e           req_type;
+    int             Found = 0;
+
+    memset(&Lowentry, 0, sizeof(Lowentry));
+    memcpy((char *) newname, (char *) vp->name, vp->namelen * sizeof(oid));
+    if (*length == TCP_CONN_LENGTH)     /* Assume that the input name is the lowest */
+        memcpy((char *) lowest, (char *) name,
+               TCP_CONN_LENGTH * sizeof(oid));
+    for (Nextentry.tcpConnLocalAddress = (u_long) - 1, req_type =
+         GET_FIRST;; Nextentry = entry, req_type = GET_NEXT) {
+        if (getMibstat
+            (MIB_TCP_CONN, &entry, sizeof(mib2_tcpConnEntry_t), req_type,
+             &TCP_Cmp, &entry) != 0)
+            break;
+        COPY_IPADDR(cp, (u_char *) & entry.tcpConnLocalAddress, op,
+                    newname + TCP_LOCADDR_OFF);
+        newname[TCP_LOCPORT_OFF] = entry.tcpConnLocalPort;
+        COPY_IPADDR(cp, (u_char *) & entry.tcpConnRemAddress, op,
+                    newname + TCP_REMADDR_OFF);
+        newname[TCP_REMPORT_OFF] = entry.tcpConnRemPort;
+
+        if (exact) {
+            if (snmp_oid_compare(newname, TCP_CONN_LENGTH, name, *length)
+                == 0) {
+                memcpy((char *) lowest, (char *) newname,
+                       TCP_CONN_LENGTH * sizeof(oid));
+                Lowentry = entry;
+                Found++;
+                break;          /* no need to search further */
+            }
+        } else {
+            if ((snmp_oid_compare(newname, TCP_CONN_LENGTH, name, *length)
+                 > 0) && ((Nextentry.tcpConnLocalAddress == (u_long) - 1)
+                          ||
+                          (snmp_oid_compare
+                           (newname, TCP_CONN_LENGTH, lowest,
+                            TCP_CONN_LENGTH) < 0)
+                          ||
+                          (snmp_oid_compare
+                           (name, *length, lowest,
+                            TCP_CONN_LENGTH) == 0))) {
+
+                /*
+                 * if new one is greater than input and closer to input than
+                 * * previous lowest, and is not equal to it, save this one as the "next" one.
+                 */
+                memcpy((char *) lowest, (char *) newname,
+                       TCP_CONN_LENGTH * sizeof(oid));
+                Lowentry = entry;
+                Found++;
+            }
+        }
+    }
+    if (Found == 0)
+        return (NULL);
+    memcpy((char *) name, (char *) lowest,
+           (vp->namelen + TCP_CONN_LENGTH -
+            TCP_LOCADDR_OFF) * sizeof(oid));
+    *length = vp->namelen + TCP_CONN_LENGTH - TCP_LOCADDR_OFF;
+    *write_method = 0;
+    *var_len = sizeof(long);
+    switch (vp->magic) {
+    case TCPCONNSTATE:
+        long_return = Lowentry.tcpConnState;
+        return (u_char *) & long_return;
+    case TCPCONNLOCALADDRESS:
+        long_return = Lowentry.tcpConnLocalAddress;
+        return (u_char *) & long_return;
+    case TCPCONNLOCALPORT:
+        long_return = Lowentry.tcpConnLocalPort;
+        return (u_char *) & long_return;
+    case TCPCONNREMADDRESS:
+        long_return = Lowentry.tcpConnRemAddress;
+        return (u_char *) & long_return;
+    case TCPCONNREMPORT:
+        long_return = Lowentry.tcpConnRemPort;
+        return (u_char *) & long_return;
+    default:
+        DEBUGMSGTL(("snmpd", "unknown sub-id %d in var_tcpEntry\n",
+                    vp->magic));
+        return (NULL);
+    }
+}
+
+#endif                          /* solaris2 - tcp */
+
+
+        /*********************
+	 *
+	 *  Internal implementation functions
+	 *
+	 *********************/
+
+
+#ifndef solaris2
+#if !defined(linux) && !defined(hpux11)
+/*
+ *      Print INTERNET connections
+ */
+
+int
+TCP_Count_Connections(void)
+{
+    int             Established;
+    struct inpcb    cb;
+    register struct inpcb *next;
+#if !(defined(freebsd2) || defined(netbsd2) || defined(openbsd2))
+    register struct inpcb *prev;
+#endif
+    struct inpcb    inpcb;
+    struct tcpcb    tcpcb;
+
+  Again:                       /*
+                                 *      Prepare to scan the control blocks
+                                 */
+    Established = 0;
+
+    auto_nlist(TCP_SYMBOL, (char *) &cb, sizeof(struct inpcb));
+    inpcb = cb;
+#if !(defined(freebsd2) || defined(netbsd1) || defined(openbsd2))
+    prev = (struct inpcb *) auto_nlist_value(TCP_SYMBOL);
+#endif                          /*  !(defined(freebsd2) || defined(netbsd1) || defined(openbsd2)) */
+    /*
+     *      Scan the control blocks
+     */
+#if defined(freebsd2) || defined(netbsd1) || defined(openbsd2)
+    while ((inpcb.INP_NEXT_SYMBOL != NULL)
+           && (inpcb.INP_NEXT_SYMBOL !=
+               (struct inpcb *) auto_nlist_value(TCP_SYMBOL)))
+#else                           /*  defined(freebsd2) || defined(netbsd1) || defined(openbsd2) */
+    while (inpcb.INP_NEXT_SYMBOL !=
+           (struct inpcb *) auto_nlist_value(TCP_SYMBOL))
+#endif                          /*  defined(freebsd2) || defined(netbsd1) */
+    {
+        next = inpcb.INP_NEXT_SYMBOL;
+
+        if ((klookup((unsigned long) next, (char *) &inpcb, sizeof(inpcb))
+             == 0)) {
+            snmp_log_perror("TCP_Count_Connections - inpcb");
+            break;
+        }
+#if !(defined(freebsd2) || defined(netbsd1) || defined(openbsd2))
+        if (inpcb.INP_PREV_SYMBOL != prev) {    /* ??? */
+            sleep(1);
+            goto Again;
+        }
+#endif                          /*  !(defined(freebsd2) || defined(netbsd1) || defined(openbsd2)) */
+        if (inet_lnaof(inpcb.inp_laddr) == INADDR_ANY) {
+#if !(defined(freebsd2) || defined(netbsd1) || defined(openbsd2))
+            prev = next;
+#endif                          /*  !(defined(freebsd2) || defined(netbsd1) || defined(openbsd2)) */
+            continue;
+        }
+        if (klookup
+            ((unsigned long) inpcb.inp_ppcb, (char *) &tcpcb,
+             sizeof(tcpcb)) == 0) {
+            snmp_log_perror("TCP_Count_Connections - tcpcb");
+            break;
+        }
+
+        if ((tcpcb.t_state == TCPS_ESTABLISHED) ||
+            (tcpcb.t_state == TCPS_CLOSE_WAIT))
+            Established++;
+#if !(defined(freebsd2) || defined(netbsd1) || defined(openbsd2))
+        prev = next;
+#endif                          /*  !(defined(freebsd2) || defined(netbsd1) || defined(openbsd2)) */
+    }
+    return (Established);
+}
+#endif                          /* !linux && !hpux11 */
+
+#ifdef hpux11
+static int      tcptab_size, tcptab_current;
+static mib_tcpConnEnt *tcp = (mib_tcpConnEnt *) 0;
+#else
+static struct inpcb tcp_inpcb, *tcp_prev;
+#ifdef PCB_TABLE
+static struct inpcb *tcp_next, *tcp_head;
+#endif
+#ifdef linux
+static struct inpcb *inpcb_list;
+#endif
+#endif
+
+#if defined(CAN_USE_SYSCTL) && defined(TCPCTL_PCBLIST)
+static char    *tcpcb_buf = NULL;
+static struct xinpgen *xig = NULL;
+#endif                          /* !defined(CAN_USE_SYSCTL) || !define(TCPCTL_PCBLIST) */
+
+void
+TCP_Scan_Init(void)
+{
+#ifdef hpux11
+
+    int             fd;
+    struct nmparms  p;
+    int             val;
+    unsigned int    ulen;
+    int             ret;
+
+    if (tcp)
+        free(tcp);
+    tcp = (mib_tcpConnEnt *) 0;
+    tcptab_size = 0;
+
+    if ((fd = open_mib("/dev/ip", O_RDONLY, 0, NM_ASYNC_OFF)) >= 0) {
+        p.objid = ID_tcpConnNumEnt;
+        p.buffer = (void *) &val;
+        ulen = sizeof(int);
+        p.len = &ulen;
+        if ((ret = get_mib_info(fd, &p)) == 0)
+            tcptab_size = val;
+
+        if (tcptab_size > 0) {
+            ulen = (unsigned) tcptab_size *sizeof(mib_tcpConnEnt);
+            tcp = (mib_tcpConnEnt *) malloc(ulen);
+            p.objid = ID_tcpConnTable;
+            p.buffer = (void *) tcp;
+            p.len = &ulen;
+            if ((ret = get_mib_info(fd, &p)) < 0)
+                tcptab_size = 0;
+        }
+
+        close_mib(fd);
+    }
+
+    tcptab_current = 0;
+
+#else                           /* hpux11 */
+
+#if !defined(CAN_USE_SYSCTL) || !defined(TCPCTL_PCBLIST)
+#ifdef PCB_TABLE
+    struct inpcbtable table;
+#endif
+#ifndef linux
+#ifdef PCB_TABLE
+    auto_nlist(TCP_SYMBOL, (char *) &table, sizeof(table));
+    tcp_head = tcp_prev =
+        (struct inpcb *) &((struct inpcbtable *)
+                           auto_nlist_value(TCP_SYMBOL))->inpt_queue.
+        cqh_first;
+    tcp_next = table.inpt_queue.cqh_first;
+#else                           /* PCB_TABLE */
+    auto_nlist(TCP_SYMBOL, (char *) &tcp_inpcb, sizeof(tcp_inpcb));
+#if !(defined(freebsd2) || defined(netbsd1) || defined(openbsd2))
+    tcp_prev = (struct inpcb *) auto_nlist_value(TCP_SYMBOL);
+#endif
+#endif                          /* PCB_TABLE */
+#else                           /* linux */
+    FILE           *in;
+    char            line[256];
+    struct inpcb  **pp;
+    struct timeval  now;
+    static unsigned long Time_Of_Last_Reload = 0;
+
+    /*
+     * save some cpu-cycles, and reload after 5 secs...
+     */
+    gettimeofday(&now, (struct timezone *) 0);
+    if (Time_Of_Last_Reload + 5 > now.tv_sec) {
+        tcp_prev = inpcb_list;
+        return;
+    }
+    Time_Of_Last_Reload = now.tv_sec;
+
+
+    if (!(in = fopen("/proc/net/tcp", "r"))) {
+        snmp_log(LOG_ERR, "snmpd: cannot open /proc/net/tcp ...\n");
+        tcp_prev = NULL;
+        return;
+    }
+
+    /*
+     * free old chain: 
+     */
+    while (inpcb_list) {
+        struct inpcb   *p = inpcb_list;
+        inpcb_list = inpcb_list->INP_NEXT_SYMBOL;
+        free(p);
+    }
+
+    /*
+     * scan proc-file and append: 
+     */
+
+    pp = &inpcb_list;
+
+    while (line == fgets(line, sizeof(line), in)) {
+        struct inpcb    pcb, *nnew;
+        static int      linux_states[12] =
+            { 0, 4, 2, 3, 6, 9, 10, 0, 5, 8, 1, 7 };
+        int             state, lp, fp, uid;
+
+        if (6 != sscanf(line,
+                        "%*d: %x:%x %x:%x %x %*X:%*X %*X:%*X %*X %d",
+                        &pcb.inp_laddr.s_addr, &lp,
+                        &pcb.inp_faddr.s_addr, &fp, &state, &uid))
+            continue;
+
+        pcb.inp_lport = htons((unsigned short) lp);
+        pcb.inp_fport = htons((unsigned short) fp);
+
+        pcb.inp_state = (state & 0xf) < 12 ? linux_states[state & 0xf] : 1;
+        pcb.uid = uid;
+
+        nnew = (struct inpcb *) malloc(sizeof(struct inpcb));
+        if (nnew == NULL)
+            break;
+        *nnew = pcb;
+        nnew->INP_NEXT_SYMBOL = 0;
+
+        *pp = nnew;
+        pp = &nnew->INP_NEXT_SYMBOL;
+    }
+
+    fclose(in);
+
+    /*
+     * first entry to go: 
+     */
+    tcp_prev = inpcb_list;
+
+#endif                          /* linux */
+#else                           /*  !defined(CAN_USE_SYSCTL) || !defined(TCPCTL_PCBLIST) */
+    {
+        size_t          len;
+        int             sname[] =
+            { CTL_NET, PF_INET, IPPROTO_TCP, TCPCTL_PCBLIST };
+
+        if (tcpcb_buf) {
+            free(tcpcb_buf);
+            tcpcb_buf = NULL;
+        }
+        xig = NULL;
+
+        len = 0;
+        if (sysctl(sname, 4, 0, &len, 0, 0) < 0) {
+            return;
+        }
+        if ((tcpcb_buf = malloc(len)) == NULL) {
+            return;
+        }
+        if (sysctl(sname, 4, tcpcb_buf, &len, 0, 0) < 0) {
+            free(tcpcb_buf);
+            tcpcb_buf = NULL;
+            return;
+        }
+
+        xig = (struct xinpgen *) tcpcb_buf;
+        xig = (struct xinpgen *) ((char *) xig + xig->xig_len);
+        return;
+    }
+#endif                          /*  !defined(CAN_USE_SYSCTL) || !defined(TCPCTL_PCBLIST) */
+#endif                          /* hpux11 */
+}
+
+#ifdef hpux11
+int
+TCP_Scan_Next(mib_tcpConnEnt * RetTcp)
+{
+    if (tcptab_current < tcptab_size) {
+        /*
+         * copy values 
+         */
+        *RetTcp = tcp[tcptab_current];
+        /*
+         * increment to point to next entry 
+         */
+        tcptab_current++;
+        /*
+         * return success 
+         */
+        return (1);
+    }
+
+    /*
+     * return done 
+     */
+    return (0);
+}
+#else                           /* hpux11 */
+int
+TCP_Scan_Next(int *State, struct inpcb *RetInPcb)
+{
+#if !defined(CAN_USE_SYSCTL) || !defined(TCPCTL_PCBLIST)
+    register struct inpcb *next;
+#ifndef linux
+    struct tcpcb    tcpcb;
+
+#ifdef PCB_TABLE
+    if (tcp_next == tcp_head)
+#elif defined(freebsd2) || defined(netbsd1) || defined(openbsd2)
+    if (tcp_inpcb.INP_NEXT_SYMBOL == NULL ||
+        tcp_inpcb.INP_NEXT_SYMBOL ==
+        (struct inpcb *) auto_nlist_value(TCP_SYMBOL))
+#else
+    if (tcp_inpcb.INP_NEXT_SYMBOL ==
+        (struct inpcb *) auto_nlist_value(TCP_SYMBOL))
+#endif
+    {
+        return (0);             /* "EOF" */
+    }
+#ifdef PCB_TABLE
+    klookup((unsigned long) tcp_next, (char *) &tcp_inpcb,
+            sizeof(tcp_inpcb));
+    tcp_next = tcp_inpcb.inp_queue.cqe_next;
+#else
+    next = tcp_inpcb.INP_NEXT_SYMBOL;
+    klookup((unsigned long) next, (char *) &tcp_inpcb, sizeof(tcp_inpcb));
+#if !(defined(netbsd1) || defined(freebsd2)) || defined(openbsd2)
+    if (tcp_inpcb.INP_PREV_SYMBOL != tcp_prev)  /* ??? */
+        return (-1);            /* "FAILURE" */
+#endif                          /*  !(defined(netbsd1) || defined(freebsd2) || defined(openbsd2)) */
+#endif                          /* PCB_TABLE */
+    klookup((int) tcp_inpcb.inp_ppcb, (char *) &tcpcb, sizeof(tcpcb));
+    *State = tcpcb.t_state;
+#else                           /* linux */
+    if (!tcp_prev)
+        return 0;
+
+    tcp_inpcb = *tcp_prev;
+    *State = tcp_inpcb.inp_state;
+    next = tcp_inpcb.INP_NEXT_SYMBOL;
+#endif
+
+    *RetInPcb = tcp_inpcb;
+#if !(defined(netbsd1) || defined(freebsd2) || defined(openbsd2))
+    tcp_prev = next;
+#endif
+#else                           /*  !defined(CAN_USE_SYSCTL) || !defined(TCPCTL_PCBLIST) */
+    /*
+     * Are we done? 
+     */
+    if ((xig == NULL) || (xig->xig_len <= sizeof(struct xinpgen)))
+        return (0);
+
+    *State = ((struct xtcpcb *) xig)->xt_tp.t_state;
+    *RetInPcb = ((struct xtcpcb *) xig)->xt_inp;
+
+    /*
+     * Prepare for Next read 
+     */
+    xig = (struct xinpgen *) ((char *) xig + xig->xig_len);
+#endif                          /*  !defined(CAN_USE_SYSCTL) || !defined(TCPCTL_PCBLIST) */
+    return (1);                 /* "OK" */
+}
+#endif                          /* hpux11 */
+#endif                          /* solaris2 */
+
+#else                           /* WIN32 */
+#include <iphlpapi.h>
+WriteMethod     writeTcpEntry;
+MIB_TCPROW      tcp_row;
+u_char         *
+var_tcpEntry(struct variable *vp,
+             oid * name,
+             size_t * length,
+             int exact, size_t * var_len, WriteMethod ** write_method)
+{
+    oid             newname[MAX_OID_LEN], lowest[MAX_OID_LEN], *op;
+    u_char         *cp;
+    int             LowState = -1;
+    static PMIB_TCPTABLE pTcpTable = NULL;
+    DWORD           status = NO_ERROR;
+    DWORD           dwActualSize = 0;
+    UINT            i;
+    struct timeval  now;
+    static long     Time_Of_Last_Reload = 0;
+
+    memcpy((char *) newname, (char *) vp->name,
+           (int) vp->namelen * sizeof(oid));
+
+    /*
+     * save some cpu-cycles, and reload after 5 secs...
+     */
+    gettimeofday(&now, (struct timezone *) 0);
+    if ((Time_Of_Last_Reload + 5 <= now.tv_sec) || (pTcpTable == NULL)) {
+        if (pTcpTable != NULL)
+            free(pTcpTable);
+        Time_Of_Last_Reload = now.tv_sec;
+        /*
+         * query for buffer size needed 
+         */
+        status = GetTcpTable(pTcpTable, &dwActualSize, TRUE);
+        if (status == ERROR_INSUFFICIENT_BUFFER) {
+            pTcpTable = (PMIB_TCPTABLE) malloc(dwActualSize);
+            if (pTcpTable != NULL) {
+                /*
+                 * Get the sorted TCP table 
+                 */
+                status = GetTcpTable(pTcpTable, &dwActualSize, TRUE);
+            }
+        }
+    }
+
+    if (status == NO_ERROR) {
+        for (i = 0; i < pTcpTable->dwNumEntries; ++i) {
+
+            cp = (u_char *) & pTcpTable->table[i].dwLocalAddr;
+            op = newname + 10;
+            *op++ = *cp++;
+            *op++ = *cp++;
+            *op++ = *cp++;
+            *op++ = *cp++;
+
+            newname[14] =
+                ntohs((unsigned short) (0x0000FFFF & pTcpTable->table[i].
+                                        dwLocalPort));
+
+            cp = (u_char *) & pTcpTable->table[i].dwRemoteAddr;
+            op = newname + 15;
+            *op++ = *cp++;
+            *op++ = *cp++;
+            *op++ = *cp++;
+            *op++ = *cp++;
+
+            newname[19] =
+                ntohs((unsigned short) (0x0000FFFF & pTcpTable->table[i].
+                                        dwRemotePort));
+
+            if (exact) {
+                if (snmp_oid_compare(newname, 20, name, *length) == 0) {
+                    memcpy((char *) lowest, (char *) newname,
+                           20 * sizeof(oid));
+                    LowState = i;
+                    break;      /* no need to search further */
+                }
+            } else {
+                if (snmp_oid_compare(newname, 20, name, *length) > 0) {
+                    memcpy((char *) lowest, (char *) newname,
+                           20 * sizeof(oid));
+                    LowState = i;
+                    break;      /* As the table is sorted, no need to search further */
+                }
+            }
+        }
+    }
+    if ((LowState < 0) || (status != NO_ERROR))
+        return (NULL);
+    memcpy((char *) name, (char *) lowest,
+           (vp->namelen + 10) * sizeof(oid));
+    *length = vp->namelen + 10;
+    *write_method = 0;
+    *var_len = sizeof(long);
+    switch (vp->magic) {
+    case TCPCONNSTATE:
+        *write_method = writeTcpEntry;
+        tcp_row = pTcpTable->table[i];
+        return (u_char *) & pTcpTable->table[i].dwState;
+
+    case TCPCONNLOCALADDRESS:
+        return (u_char *) & pTcpTable->table[i].dwLocalAddr;
+    case TCPCONNLOCALPORT:
+        long_return =
+            ntohs((unsigned short) (0x0000FFFF & pTcpTable->table[i].
+                                    dwLocalPort));
+        return (u_char *) & long_return;
+    case TCPCONNREMADDRESS:
+        return (u_char *) & pTcpTable->table[i].dwRemoteAddr;
+    case TCPCONNREMPORT:
+        long_return =
+            ntohs((unsigned short) (0x0000FFFF & pTcpTable->table[i].
+                                    dwRemotePort));
+        return (u_char *) & long_return;
+    default:
+        DEBUGMSGTL(("snmpd", "unknown sub-id %d in var_tcpEntry\n",
+                    vp->magic));
+    }
+    return NULL;
+}
+
+int
+writeTcpEntry(int action,
+              u_char * var_val,
+              u_char var_val_type,
+              size_t var_val_len,
+              u_char * statP, oid * name, size_t name_len)
+{
+    static int      oldbuf;
+    DWORD           status = NO_ERROR;
+    /*
+     * Only tcpConnState is writable 
+     */
+    if ((char) name[9] != 1)
+        return SNMP_ERR_NOTWRITABLE;
+
+    switch (action) {
+    case RESERVE1:             /* Check values for acceptability */
+        if (var_val_type != ASN_INTEGER) {
+            snmp_log(LOG_ERR, "not integer\n");
+            return SNMP_ERR_WRONGTYPE;
+        }
+        if (var_val_len > sizeof(int)) {
+            snmp_log(LOG_ERR, "bad length\n");
+            return SNMP_ERR_WRONGLENGTH;
+        }
+        if ((int) (*var_val) != MIB_TCP_STATE_DELETE_TCB) {
+            snmp_log(LOG_ERR, "not supported admin state\n");
+            return SNMP_ERR_WRONGVALUE;
+        }
+        break;
+
+    case RESERVE2:             /* Allocate memory and similar resources */
+        /*
+         * Using static strings, so nothing needs to be done 
+         */
+
+        break;
+
+    case ACTION:
+        /*
+         * Save the old value, in case of UNDO 
+         */
+        oldbuf = tcp_row.dwState;
+        tcp_row.dwState = (int) *var_val;
+        break;
+
+    case UNDO:                 /* Reverse the SET action and free resources */
+        tcp_row.dwState = oldbuf;
+        break;
+
+    case COMMIT:               /* Confirm the SET, performing any irreversible actions,
+                                 * and free resources */
+        if ((status = SetTcpEntry(&tcp_row)) != NO_ERROR) {
+            snmp_log(LOG_ERR,
+                     "Error while trying to write connState %d, status = %d \n",
+                     tcp_row.dwState, status);
+            return SNMP_ERR_COMMITFAILED;
+        }
+    case FREE:                 /* Free any resources allocated */
+        break;
+    }
+    return SNMP_ERR_NOERROR;
+}                               /* end of writeTcpEntry */
+#endif                          /* WIN32 */
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/mibII/tcpTable.c.walk tomato121/release/src/router/snmp/agent/mibgroup/mibII/tcpTable.c.walk
--- tomato/release/src/router/snmp/agent/mibgroup/mibII/tcpTable.c.walk	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/mibII/tcpTable.c.walk	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,995 @@
+
+/*
+ *  TCP MIB group implementation - tcp.c
+ *
+ */
+
+#include <net-snmp/net-snmp-config.h>
+
+#if HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#if HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+
+#if HAVE_SYS_PARAM_H
+#include <sys/param.h>
+#endif
+#if HAVE_SYS_PROTOSW_H
+#include <sys/protosw.h>
+#endif
+
+#if HAVE_SYS_SYSMP_H
+#include <sys/sysmp.h>
+#endif
+#if defined(IFNET_NEEDS_KERNEL) && !defined(_KERNEL)
+#define _KERNEL 1
+#define _I_DEFINED_KERNEL
+#endif
+#if HAVE_SYS_SOCKET_H
+#include <sys/socket.h>
+#endif
+#if HAVE_WINSOCK_H
+#include <winsock.h>
+#endif
+#if HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+#if HAVE_NET_IF_H
+#include <net/if.h>
+#endif
+#if HAVE_NET_IF_VAR_H
+#include <net/if_var.h>
+#endif
+#ifdef _I_DEFINED_KERNEL
+#undef _KERNEL
+#endif
+#if HAVE_SYS_STREAM_H
+#include <sys/stream.h>
+#endif
+#if HAVE_NET_ROUTE_H
+#include <net/route.h>
+#endif
+#if HAVE_NETINET_IN_SYSTM_H
+#include <netinet/in_systm.h>
+#endif
+#if HAVE_NETINET_IP_H
+#include <netinet/ip.h>
+#endif
+#if HAVE_SYS_QUEUE_H
+#include <sys/queue.h>
+#endif
+#if HAVE_NETINET_IP_VAR_H
+#include <netinet/ip_var.h>
+#endif
+#ifdef INET6
+#if HAVE_NETINET6_IP6_VAR_H
+#include <netinet6/ip6_var.h>
+#endif
+#endif
+#if HAVE_SYS_SOCKETVAR_H
+#include <sys/socketvar.h>
+#endif
+#if HAVE_NETINET_IN_PCB_H
+#include <netinet/in_pcb.h>
+#endif
+#if HAVE_INET_MIB2_H
+#include <inet/mib2.h>
+#endif
+#ifdef solaris2
+#include "kernel_sunos5.h"
+#else
+#include "kernel.h"
+#endif
+
+#if HAVE_SYS_SYSCTL_H
+#include <sys/sysctl.h>
+#endif
+#if HAVE_ARPA_INET_H
+#include <arpa/inet.h>
+#endif
+
+#if defined(osf4) || defined(aix4) || defined(hpux10)
+/*
+ * these are undefed to remove a stupid warning on osf compilers
+ * because they get redefined with a slightly different notation of the
+ * same value.  -- Wes 
+ */
+#undef TCP_NODELAY
+#undef TCP_MAXSEG
+#endif
+#if HAVE_NETINET_TCP_H
+#include <netinet/tcp.h>
+#endif
+#if HAVE_NETINET_TCPIP_H
+#include <netinet/tcpip.h>
+#endif
+#if HAVE_NETINET_TCP_TIMER_H
+#include <netinet/tcp_timer.h>
+#endif
+#if HAVE_NETINET_TCP_VAR_H
+#include <netinet/tcp_var.h>
+#endif
+#if HAVE_NETINET_TCP_FSM_H
+#include <netinet/tcp_fsm.h>
+#endif
+#if HAVE_SYS_TCPIPSTATS_H
+#include <sys/tcpipstats.h>
+#endif
+
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include <net-snmp/agent/auto_nlist.h>
+
+#ifdef hpux
+#include <sys/mib.h>
+#include <netinet/mib_kern.h>
+#endif                          /* hpux */
+
+#ifdef cygwin
+#define WIN32
+#include <windows.h>
+#endif
+
+#include "tcp.h"
+#include "tcpTable.h"
+
+#if HAVE_DMALLOC_H
+#include <dmalloc.h>
+#endif
+
+        /*********************
+	 *
+	 *  Kernel & interface information,
+	 *   and internal forward declarations
+	 *
+	 *********************/
+
+
+        /*********************
+	 *
+	 *  Initialisation & common implementation functions
+	 *
+	 *********************/
+
+
+        /*********************
+	 *
+	 *  System specific implementation functions
+	 *
+	 *********************/
+#ifndef WIN32
+#ifndef solaris2
+
+u_char         *
+var_tcpEntry(struct variable *vp,
+             oid * name,
+             size_t * length,
+             int exact, size_t * var_len, WriteMethod ** write_method)
+{
+    int             i;
+    oid             newname[MAX_OID_LEN], lowest[MAX_OID_LEN], *op;
+    u_char         *cp;
+#ifdef hpux11
+    int             LowState;
+    static mib_tcpConnEnt tcp, Lowtcp;
+#else
+    int             State, LowState;
+    static struct inpcb inpcb, Lowinpcb;
+#endif
+
+    /*
+     *  Allow for a kernel w/o TCP
+     */
+#ifdef TCPSTAT_SYMBOL
+#if !defined(linux) && !defined(hpux11)
+    if (auto_nlist_value(TCPSTAT_SYMBOL) == -1)
+        return (NULL);
+#endif
+#endif
+
+    memcpy((char *) newname, (char *) vp->name,
+           (int) vp->namelen * sizeof(oid));
+    lowest[0] = 9999;
+
+    /*
+     * find "next" connection 
+     */
+#ifndef hpux11
+  Again:
+#endif
+    LowState = -1;              /* Don't have one yet */
+    TCP_Scan_Init();
+    for (;;) {
+#ifdef hpux11
+        if ((i = TCP_Scan_Next(&tcp)) == 0)
+            break;              /* Done */
+        cp = (u_char *) & tcp.LocalAddress;
+#else                           /* hpux11 */
+        if ((i = TCP_Scan_Next(&State, &inpcb)) < 0)
+            goto Again;
+        if (i == 0)
+            break;              /* Done */
+        cp = (u_char *) & inpcb.inp_laddr.s_addr;
+#endif                          /* hpux11 */
+        op = newname + 10;
+        *op++ = *cp++;
+        *op++ = *cp++;
+        *op++ = *cp++;
+        *op++ = *cp++;
+
+#ifdef hpux11
+        newname[14] = (unsigned short) tcp.LocalPort;
+#else
+        newname[14] = ntohs(inpcb.inp_lport);
+#endif
+
+#ifdef hpux11
+        cp = (u_char *) & tcp.RemAddress;
+#else
+        cp = (u_char *) & inpcb.inp_faddr.s_addr;
+#endif
+        op = newname + 15;
+        *op++ = *cp++;
+        *op++ = *cp++;
+        *op++ = *cp++;
+        *op++ = *cp++;
+
+#ifdef hpux11
+        newname[19] = (unsigned short) tcp.RemPort;
+#else
+        newname[19] = ntohs(inpcb.inp_fport);
+#endif
+
+        if (exact) {
+            if (snmp_oid_compare(newname, 20, name, *length) == 0) {
+                memcpy((char *) lowest, (char *) newname,
+                       20 * sizeof(oid));
+#ifdef hpux11
+                LowState = tcp.State;
+                Lowtcp = tcp;
+#else                           /* hpux11 */
+                LowState = State;
+                Lowinpcb = inpcb;
+#endif                          /* hpux11 */
+                break;          /* no need to search further */
+            }
+        } else {
+            if (snmp_oid_compare(newname, 20, name, *length) > 0 &&
+                snmp_oid_compare(newname, 20, lowest, 20) < 0) {
+                /*
+                 * if new one is greater than input and closer to input than
+                 * previous lowest, save this one as the "next" one.
+                 */
+                memcpy((char *) lowest, (char *) newname,
+                       20 * sizeof(oid));
+#ifdef hpux11
+                LowState = tcp.State;
+                Lowtcp = tcp;
+#else                           /* hpux11 */
+                LowState = State;
+                Lowinpcb = inpcb;
+#endif                          /* hpux11 */
+            }
+        }
+    }
+    if (LowState < 0)
+        return (NULL);
+    memcpy((char *) name, (char *) lowest,
+           (vp->namelen + 10) * sizeof(oid));
+    *length = vp->namelen + 10;
+    *write_method = 0;
+    *var_len = sizeof(long);
+    switch (vp->magic) {
+    case TCPCONNSTATE:{
+#ifdef hpux11
+            long_return = LowState;
+            return (u_char *) & long_return;
+#else                           /* hpux11 */
+#ifndef hpux
+            static int      StateMap[] =
+                { 1, 2, 3, 4, 5, 8, 6, 10, 9, 7, 11 };
+#else
+            static int      StateMap[] =
+                { 1, 2, 3, -1, 4, 5, 8, 6, 10, 9, 7, 11 };
+#endif
+            return (u_char *) & StateMap[LowState];
+#endif                          /* hpux11 */
+        }
+    case TCPCONNLOCALADDRESS:
+#ifdef hpux11
+        return (u_char *) & Lowtcp.LocalAddress;
+#else
+        return (u_char *) & Lowinpcb.inp_laddr.s_addr;
+#endif
+    case TCPCONNLOCALPORT:
+#ifdef hpux11
+        long_return = (unsigned short) Lowtcp.LocalPort;
+#else
+        long_return = ntohs(Lowinpcb.inp_lport);
+#endif
+        return (u_char *) & long_return;
+    case TCPCONNREMADDRESS:
+#ifdef hpux11
+        return (u_char *) & Lowtcp.RemAddress;
+#else
+        return (u_char *) & Lowinpcb.inp_faddr.s_addr;
+#endif
+    case TCPCONNREMPORT:
+#ifdef hpux11
+        long_return = (unsigned short) Lowtcp.RemPort;
+#else
+        long_return = ntohs(Lowinpcb.inp_fport);
+#endif
+        return (u_char *) & long_return;
+    }
+    return NULL;
+}
+
+#else                           /* solaris2 - tcp */
+
+
+static int
+TCP_Cmp(void *addr, void *ep)
+{
+    if (memcmp((mib2_tcpConnEntry_t *) ep, (mib2_tcpConnEntry_t *) addr,
+               sizeof(mib2_tcpConnEntry_t)) == 0)
+        return (0);
+    else
+        return (1);
+}
+
+
+u_char         *
+var_tcpEntry(struct variable * vp,
+             oid * name,
+             size_t * length,
+             int exact, size_t * var_len, WriteMethod ** write_method)
+{
+    oid             newname[MAX_OID_LEN], lowest[MAX_OID_LEN], *op;
+    u_char         *cp;
+
+#define TCP_CONN_LENGTH	20
+#define TCP_LOCADDR_OFF	10
+#define TCP_LOCPORT_OFF	14
+#define TCP_REMADDR_OFF	15
+#define TCP_REMPORT_OFF	19
+    mib2_tcpConnEntry_t Lowentry, Nextentry, entry;
+    req_e           req_type;
+    int             Found = 0;
+
+    memset(&Lowentry, 0, sizeof(Lowentry));
+    memcpy((char *) newname, (char *) vp->name, vp->namelen * sizeof(oid));
+    if (*length == TCP_CONN_LENGTH)     /* Assume that the input name is the lowest */
+        memcpy((char *) lowest, (char *) name,
+               TCP_CONN_LENGTH * sizeof(oid));
+    for (Nextentry.tcpConnLocalAddress = (u_long) - 1, req_type =
+         GET_FIRST;; Nextentry = entry, req_type = GET_NEXT) {
+        if (getMibstat
+            (MIB_TCP_CONN, &entry, sizeof(mib2_tcpConnEntry_t), req_type,
+             &TCP_Cmp, &entry) != 0)
+            break;
+        COPY_IPADDR(cp, (u_char *) & entry.tcpConnLocalAddress, op,
+                    newname + TCP_LOCADDR_OFF);
+        newname[TCP_LOCPORT_OFF] = entry.tcpConnLocalPort;
+        COPY_IPADDR(cp, (u_char *) & entry.tcpConnRemAddress, op,
+                    newname + TCP_REMADDR_OFF);
+        newname[TCP_REMPORT_OFF] = entry.tcpConnRemPort;
+
+        if (exact) {
+            if (snmp_oid_compare(newname, TCP_CONN_LENGTH, name, *length)
+                == 0) {
+                memcpy((char *) lowest, (char *) newname,
+                       TCP_CONN_LENGTH * sizeof(oid));
+                Lowentry = entry;
+                Found++;
+                break;          /* no need to search further */
+            }
+        } else {
+            if ((snmp_oid_compare(newname, TCP_CONN_LENGTH, name, *length)
+                 > 0) && ((Nextentry.tcpConnLocalAddress == (u_long) - 1)
+                          ||
+                          (snmp_oid_compare
+                           (newname, TCP_CONN_LENGTH, lowest,
+                            TCP_CONN_LENGTH) < 0)
+                          ||
+                          (snmp_oid_compare
+                           (name, *length, lowest,
+                            TCP_CONN_LENGTH) == 0))) {
+
+                /*
+                 * if new one is greater than input and closer to input than
+                 * * previous lowest, and is not equal to it, save this one as the "next" one.
+                 */
+                memcpy((char *) lowest, (char *) newname,
+                       TCP_CONN_LENGTH * sizeof(oid));
+                Lowentry = entry;
+                Found++;
+            }
+        }
+    }
+    if (Found == 0)
+        return (NULL);
+    memcpy((char *) name, (char *) lowest,
+           (vp->namelen + TCP_CONN_LENGTH -
+            TCP_LOCADDR_OFF) * sizeof(oid));
+    *length = vp->namelen + TCP_CONN_LENGTH - TCP_LOCADDR_OFF;
+    *write_method = 0;
+    *var_len = sizeof(long);
+    switch (vp->magic) {
+    case TCPCONNSTATE:
+        long_return = Lowentry.tcpConnState;
+        return (u_char *) & long_return;
+    case TCPCONNLOCALADDRESS:
+        long_return = Lowentry.tcpConnLocalAddress;
+        return (u_char *) & long_return;
+    case TCPCONNLOCALPORT:
+        long_return = Lowentry.tcpConnLocalPort;
+        return (u_char *) & long_return;
+    case TCPCONNREMADDRESS:
+        long_return = Lowentry.tcpConnRemAddress;
+        return (u_char *) & long_return;
+    case TCPCONNREMPORT:
+        long_return = Lowentry.tcpConnRemPort;
+        return (u_char *) & long_return;
+    default:
+        DEBUGMSGTL(("snmpd", "unknown sub-id %d in var_tcpEntry\n",
+                    vp->magic));
+        return (NULL);
+    }
+}
+
+#endif                          /* solaris2 - tcp */
+
+
+        /*********************
+	 *
+	 *  Internal implementation functions
+	 *
+	 *********************/
+
+
+#ifndef solaris2
+#if !defined(linux) && !defined(hpux11)
+/*
+ *      Print INTERNET connections
+ */
+
+int
+TCP_Count_Connections(void)
+{
+    int             Established;
+    struct inpcb    cb;
+    register struct inpcb *next;
+#if !(defined(freebsd2) || defined(netbsd2) || defined(openbsd2))
+    register struct inpcb *prev;
+#endif
+    struct inpcb    inpcb;
+    struct tcpcb    tcpcb;
+
+  Again:                       /*
+                                 *      Prepare to scan the control blocks
+                                 */
+    Established = 0;
+
+    auto_nlist(TCP_SYMBOL, (char *) &cb, sizeof(struct inpcb));
+    inpcb = cb;
+#if !(defined(freebsd2) || defined(netbsd1) || defined(openbsd2))
+    prev = (struct inpcb *) auto_nlist_value(TCP_SYMBOL);
+#endif                          /*  !(defined(freebsd2) || defined(netbsd1) || defined(openbsd2)) */
+    /*
+     *      Scan the control blocks
+     */
+#if defined(freebsd2) || defined(netbsd1) || defined(openbsd2)
+    while ((inpcb.INP_NEXT_SYMBOL != NULL)
+           && (inpcb.INP_NEXT_SYMBOL !=
+               (struct inpcb *) auto_nlist_value(TCP_SYMBOL)))
+#else                           /*  defined(freebsd2) || defined(netbsd1) || defined(openbsd2) */
+    while (inpcb.INP_NEXT_SYMBOL !=
+           (struct inpcb *) auto_nlist_value(TCP_SYMBOL))
+#endif                          /*  defined(freebsd2) || defined(netbsd1) */
+    {
+        next = inpcb.INP_NEXT_SYMBOL;
+
+        if ((klookup((unsigned long) next, (char *) &inpcb, sizeof(inpcb))
+             == 0)) {
+            snmp_log_perror("TCP_Count_Connections - inpcb");
+            break;
+        }
+#if !(defined(freebsd2) || defined(netbsd1) || defined(openbsd2))
+        if (inpcb.INP_PREV_SYMBOL != prev) {    /* ??? */
+            sleep(1);
+            goto Again;
+        }
+#endif                          /*  !(defined(freebsd2) || defined(netbsd1) || defined(openbsd2)) */
+        if (inet_lnaof(inpcb.inp_laddr) == INADDR_ANY) {
+#if !(defined(freebsd2) || defined(netbsd1) || defined(openbsd2))
+            prev = next;
+#endif                          /*  !(defined(freebsd2) || defined(netbsd1) || defined(openbsd2)) */
+            continue;
+        }
+        if (klookup
+            ((unsigned long) inpcb.inp_ppcb, (char *) &tcpcb,
+             sizeof(tcpcb)) == 0) {
+            snmp_log_perror("TCP_Count_Connections - tcpcb");
+            break;
+        }
+
+        if ((tcpcb.t_state == TCPS_ESTABLISHED) ||
+            (tcpcb.t_state == TCPS_CLOSE_WAIT))
+            Established++;
+#if !(defined(freebsd2) || defined(netbsd1) || defined(openbsd2))
+        prev = next;
+#endif                          /*  !(defined(freebsd2) || defined(netbsd1) || defined(openbsd2)) */
+    }
+    return (Established);
+}
+#endif                          /* !linux && !hpux11 */
+
+#ifdef hpux11
+static int      tcptab_size, tcptab_current;
+static mib_tcpConnEnt *tcp = (mib_tcpConnEnt *) 0;
+#else
+static struct inpcb tcp_inpcb, *tcp_prev;
+#ifdef PCB_TABLE
+static struct inpcb *tcp_next, *tcp_head;
+#endif
+#ifdef linux
+static struct inpcb *inpcb_list;
+#endif
+#endif
+
+#if defined(CAN_USE_SYSCTL) && defined(TCPCTL_PCBLIST)
+static char    *tcpcb_buf = NULL;
+static struct xinpgen *xig = NULL;
+#endif                          /* !defined(CAN_USE_SYSCTL) || !define(TCPCTL_PCBLIST) */
+
+void
+TCP_Scan_Init(void)
+{
+#ifdef hpux11
+
+    int             fd;
+    struct nmparms  p;
+    int             val;
+    unsigned int    ulen;
+    int             ret;
+
+    if (tcp)
+        free(tcp);
+    tcp = (mib_tcpConnEnt *) 0;
+    tcptab_size = 0;
+
+    if ((fd = open_mib("/dev/ip", O_RDONLY, 0, NM_ASYNC_OFF)) >= 0) {
+        p.objid = ID_tcpConnNumEnt;
+        p.buffer = (void *) &val;
+        ulen = sizeof(int);
+        p.len = &ulen;
+        if ((ret = get_mib_info(fd, &p)) == 0)
+            tcptab_size = val;
+
+        if (tcptab_size > 0) {
+            ulen = (unsigned) tcptab_size *sizeof(mib_tcpConnEnt);
+            tcp = (mib_tcpConnEnt *) malloc(ulen);
+            p.objid = ID_tcpConnTable;
+            p.buffer = (void *) tcp;
+            p.len = &ulen;
+            if ((ret = get_mib_info(fd, &p)) < 0)
+                tcptab_size = 0;
+        }
+
+        close_mib(fd);
+    }
+
+    tcptab_current = 0;
+
+#else                           /* hpux11 */
+
+#if !defined(CAN_USE_SYSCTL) || !defined(TCPCTL_PCBLIST)
+#ifdef PCB_TABLE
+    struct inpcbtable table;
+#endif
+#ifndef linux
+#ifdef PCB_TABLE
+    auto_nlist(TCP_SYMBOL, (char *) &table, sizeof(table));
+    tcp_head = tcp_prev =
+        (struct inpcb *) &((struct inpcbtable *)
+                           auto_nlist_value(TCP_SYMBOL))->inpt_queue.
+        cqh_first;
+    tcp_next = table.inpt_queue.cqh_first;
+#else                           /* PCB_TABLE */
+    auto_nlist(TCP_SYMBOL, (char *) &tcp_inpcb, sizeof(tcp_inpcb));
+#if !(defined(freebsd2) || defined(netbsd1) || defined(openbsd2))
+    tcp_prev = (struct inpcb *) auto_nlist_value(TCP_SYMBOL);
+#endif
+#endif                          /* PCB_TABLE */
+#else                           /* linux */
+    FILE           *in;
+    char            line[256];
+    struct inpcb  **pp;
+    struct timeval  now;
+    static unsigned long Time_Of_Last_Reload = 0;
+
+    /*
+     * save some cpu-cycles, and reload after 5 secs...
+     */
+    gettimeofday(&now, (struct timezone *) 0);
+    if (Time_Of_Last_Reload + 5 > now.tv_sec) {
+        tcp_prev = inpcb_list;
+        return;
+    }
+    Time_Of_Last_Reload = now.tv_sec;
+
+
+    if (!(in = fopen("/proc/net/tcp", "r"))) {
+        snmp_log(LOG_ERR, "snmpd: cannot open /proc/net/tcp ...\n");
+        tcp_prev = NULL;
+        return;
+    }
+
+    /*
+     * free old chain: 
+     */
+    while (inpcb_list) {
+        struct inpcb   *p = inpcb_list;
+        inpcb_list = inpcb_list->INP_NEXT_SYMBOL;
+        free(p);
+    }
+
+    /*
+     * scan proc-file and append: 
+     */
+
+    pp = &inpcb_list;
+
+    while (line == fgets(line, sizeof(line), in)) {
+        struct inpcb    pcb, *nnew;
+        static int      linux_states[12] =
+            { 0, 4, 2, 3, 6, 9, 10, 0, 5, 8, 1, 7 };
+        int             state, lp, fp, uid;
+
+        if (6 != sscanf(line,
+                        "%*d: %x:%x %x:%x %x %*X:%*X %*X:%*X %*X %d",
+                        &pcb.inp_laddr.s_addr, &lp,
+                        &pcb.inp_faddr.s_addr, &fp, &state, &uid))
+            continue;
+
+        pcb.inp_lport = htons((unsigned short) lp);
+        pcb.inp_fport = htons((unsigned short) fp);
+
+        pcb.inp_state = (state & 0xf) < 12 ? linux_states[state & 0xf] : 1;
+        pcb.uid = uid;
+
+        nnew = (struct inpcb *) malloc(sizeof(struct inpcb));
+        if (nnew == NULL)
+            break;
+        *nnew = pcb;
+        nnew->INP_NEXT_SYMBOL = 0;
+
+        *pp = nnew;
+        pp = &nnew->INP_NEXT_SYMBOL;
+    }
+
+    fclose(in);
+
+    /*
+     * first entry to go: 
+     */
+    tcp_prev = inpcb_list;
+
+#endif                          /* linux */
+#else                           /*  !defined(CAN_USE_SYSCTL) || !defined(TCPCTL_PCBLIST) */
+    {
+        size_t          len;
+        int             sname[] =
+            { CTL_NET, PF_INET, IPPROTO_TCP, TCPCTL_PCBLIST };
+
+        if (tcpcb_buf) {
+            free(tcpcb_buf);
+            tcpcb_buf = NULL;
+        }
+        xig = NULL;
+
+        len = 0;
+        if (sysctl(sname, 4, 0, &len, 0, 0) < 0) {
+            return;
+        }
+        if ((tcpcb_buf = malloc(len)) == NULL) {
+            return;
+        }
+        if (sysctl(sname, 4, tcpcb_buf, &len, 0, 0) < 0) {
+            free(tcpcb_buf);
+            tcpcb_buf = NULL;
+            return;
+        }
+
+        xig = (struct xinpgen *) tcpcb_buf;
+        xig = (struct xinpgen *) ((char *) xig + xig->xig_len);
+        return;
+    }
+#endif                          /*  !defined(CAN_USE_SYSCTL) || !defined(TCPCTL_PCBLIST) */
+#endif                          /* hpux11 */
+}
+
+#ifdef hpux11
+int
+TCP_Scan_Next(mib_tcpConnEnt * RetTcp)
+{
+    if (tcptab_current < tcptab_size) {
+        /*
+         * copy values 
+         */
+        *RetTcp = tcp[tcptab_current];
+        /*
+         * increment to point to next entry 
+         */
+        tcptab_current++;
+        /*
+         * return success 
+         */
+        return (1);
+    }
+
+    /*
+     * return done 
+     */
+    return (0);
+}
+#else                           /* hpux11 */
+int
+TCP_Scan_Next(int *State, struct inpcb *RetInPcb)
+{
+#if !defined(CAN_USE_SYSCTL) || !defined(TCPCTL_PCBLIST)
+    register struct inpcb *next;
+#ifndef linux
+    struct tcpcb    tcpcb;
+
+#ifdef PCB_TABLE
+    if (tcp_next == tcp_head)
+#elif defined(freebsd2) || defined(netbsd1) || defined(openbsd2)
+    if (tcp_inpcb.INP_NEXT_SYMBOL == NULL ||
+        tcp_inpcb.INP_NEXT_SYMBOL ==
+        (struct inpcb *) auto_nlist_value(TCP_SYMBOL))
+#else
+    if (tcp_inpcb.INP_NEXT_SYMBOL ==
+        (struct inpcb *) auto_nlist_value(TCP_SYMBOL))
+#endif
+    {
+        return (0);             /* "EOF" */
+    }
+#ifdef PCB_TABLE
+    klookup((unsigned long) tcp_next, (char *) &tcp_inpcb,
+            sizeof(tcp_inpcb));
+    tcp_next = tcp_inpcb.inp_queue.cqe_next;
+#else
+    next = tcp_inpcb.INP_NEXT_SYMBOL;
+    klookup((unsigned long) next, (char *) &tcp_inpcb, sizeof(tcp_inpcb));
+#if !(defined(netbsd1) || defined(freebsd2)) || defined(openbsd2)
+    if (tcp_inpcb.INP_PREV_SYMBOL != tcp_prev)  /* ??? */
+        return (-1);            /* "FAILURE" */
+#endif                          /*  !(defined(netbsd1) || defined(freebsd2) || defined(openbsd2)) */
+#endif                          /* PCB_TABLE */
+    klookup((int) tcp_inpcb.inp_ppcb, (char *) &tcpcb, sizeof(tcpcb));
+    *State = tcpcb.t_state;
+#else                           /* linux */
+    if (!tcp_prev)
+        return 0;
+
+    tcp_inpcb = *tcp_prev;
+    *State = tcp_inpcb.inp_state;
+    next = tcp_inpcb.INP_NEXT_SYMBOL;
+#endif
+
+    *RetInPcb = tcp_inpcb;
+#if !(defined(netbsd1) || defined(freebsd2) || defined(openbsd2))
+    tcp_prev = next;
+#endif
+#else                           /*  !defined(CAN_USE_SYSCTL) || !defined(TCPCTL_PCBLIST) */
+    /*
+     * Are we done? 
+     */
+    if ((xig == NULL) || (xig->xig_len <= sizeof(struct xinpgen)))
+        return (0);
+
+    *State = ((struct xtcpcb *) xig)->xt_tp.t_state;
+    *RetInPcb = ((struct xtcpcb *) xig)->xt_inp;
+
+    /*
+     * Prepare for Next read 
+     */
+    xig = (struct xinpgen *) ((char *) xig + xig->xig_len);
+#endif                          /*  !defined(CAN_USE_SYSCTL) || !defined(TCPCTL_PCBLIST) */
+    return (1);                 /* "OK" */
+}
+#endif                          /* hpux11 */
+#endif                          /* solaris2 */
+
+#else                           /* WIN32 */
+#include <iphlpapi.h>
+WriteMethod     writeTcpEntry;
+MIB_TCPROW      tcp_row;
+u_char         *
+var_tcpEntry(struct variable *vp,
+             oid * name,
+             size_t * length,
+             int exact, size_t * var_len, WriteMethod ** write_method)
+{
+    oid             newname[MAX_OID_LEN], lowest[MAX_OID_LEN], *op;
+    u_char         *cp;
+    int             LowState = -1;
+    static PMIB_TCPTABLE pTcpTable = NULL;
+    DWORD           status = NO_ERROR;
+    DWORD           dwActualSize = 0;
+    UINT            i;
+    struct timeval  now;
+    static long     Time_Of_Last_Reload = 0;
+
+    memcpy((char *) newname, (char *) vp->name,
+           (int) vp->namelen * sizeof(oid));
+
+    /*
+     * save some cpu-cycles, and reload after 5 secs...
+     */
+    gettimeofday(&now, (struct timezone *) 0);
+    if ((Time_Of_Last_Reload + 5 <= now.tv_sec) || (pTcpTable == NULL)) {
+        if (pTcpTable != NULL)
+            free(pTcpTable);
+        Time_Of_Last_Reload = now.tv_sec;
+        /*
+         * query for buffer size needed 
+         */
+        status = GetTcpTable(pTcpTable, &dwActualSize, TRUE);
+        if (status == ERROR_INSUFFICIENT_BUFFER) {
+            pTcpTable = (PMIB_TCPTABLE) malloc(dwActualSize);
+            if (pTcpTable != NULL) {
+                /*
+                 * Get the sorted TCP table 
+                 */
+                status = GetTcpTable(pTcpTable, &dwActualSize, TRUE);
+            }
+        }
+    }
+
+    if (status == NO_ERROR) {
+        for (i = 0; i < pTcpTable->dwNumEntries; ++i) {
+
+            cp = (u_char *) & pTcpTable->table[i].dwLocalAddr;
+            op = newname + 10;
+            *op++ = *cp++;
+            *op++ = *cp++;
+            *op++ = *cp++;
+            *op++ = *cp++;
+
+            newname[14] =
+                ntohs((unsigned short) (0x0000FFFF & pTcpTable->table[i].
+                                        dwLocalPort));
+
+            cp = (u_char *) & pTcpTable->table[i].dwRemoteAddr;
+            op = newname + 15;
+            *op++ = *cp++;
+            *op++ = *cp++;
+            *op++ = *cp++;
+            *op++ = *cp++;
+
+            newname[19] =
+                ntohs((unsigned short) (0x0000FFFF & pTcpTable->table[i].
+                                        dwRemotePort));
+
+            if (exact) {
+                if (snmp_oid_compare(newname, 20, name, *length) == 0) {
+                    memcpy((char *) lowest, (char *) newname,
+                           20 * sizeof(oid));
+                    LowState = i;
+                    break;      /* no need to search further */
+                }
+            } else {
+                if (snmp_oid_compare(newname, 20, name, *length) > 0) {
+                    memcpy((char *) lowest, (char *) newname,
+                           20 * sizeof(oid));
+                    LowState = i;
+                    break;      /* As the table is sorted, no need to search further */
+                }
+            }
+        }
+    }
+    if ((LowState < 0) || (status != NO_ERROR))
+        return (NULL);
+    memcpy((char *) name, (char *) lowest,
+           (vp->namelen + 10) * sizeof(oid));
+    *length = vp->namelen + 10;
+    *write_method = 0;
+    *var_len = sizeof(long);
+    switch (vp->magic) {
+    case TCPCONNSTATE:
+        *write_method = writeTcpEntry;
+        tcp_row = pTcpTable->table[i];
+        return (u_char *) & pTcpTable->table[i].dwState;
+
+    case TCPCONNLOCALADDRESS:
+        return (u_char *) & pTcpTable->table[i].dwLocalAddr;
+    case TCPCONNLOCALPORT:
+        long_return =
+            ntohs((unsigned short) (0x0000FFFF & pTcpTable->table[i].
+                                    dwLocalPort));
+        return (u_char *) & long_return;
+    case TCPCONNREMADDRESS:
+        return (u_char *) & pTcpTable->table[i].dwRemoteAddr;
+    case TCPCONNREMPORT:
+        long_return =
+            ntohs((unsigned short) (0x0000FFFF & pTcpTable->table[i].
+                                    dwRemotePort));
+        return (u_char *) & long_return;
+    default:
+        DEBUGMSGTL(("snmpd", "unknown sub-id %d in var_tcpEntry\n",
+                    vp->magic));
+    }
+    return NULL;
+}
+
+int
+writeTcpEntry(int action,
+              u_char * var_val,
+              u_char var_val_type,
+              size_t var_val_len,
+              u_char * statP, oid * name, size_t name_len)
+{
+    static int      oldbuf;
+    DWORD           status = NO_ERROR;
+    /*
+     * Only tcpConnState is writable 
+     */
+    if ((char) name[9] != 1)
+        return SNMP_ERR_NOTWRITABLE;
+
+    switch (action) {
+    case RESERVE1:             /* Check values for acceptability */
+        if (var_val_type != ASN_INTEGER) {
+            snmp_log(LOG_ERR, "not integer\n");
+            return SNMP_ERR_WRONGTYPE;
+        }
+        if (var_val_len > sizeof(int)) {
+            snmp_log(LOG_ERR, "bad length\n");
+            return SNMP_ERR_WRONGLENGTH;
+        }
+        if ((int) (*var_val) != MIB_TCP_STATE_DELETE_TCB) {
+            snmp_log(LOG_ERR, "not supported admin state\n");
+            return SNMP_ERR_WRONGVALUE;
+        }
+        break;
+
+    case RESERVE2:             /* Allocate memory and similar resources */
+        /*
+         * Using static strings, so nothing needs to be done 
+         */
+
+        break;
+
+    case ACTION:
+        /*
+         * Save the old value, in case of UNDO 
+         */
+        oldbuf = tcp_row.dwState;
+        tcp_row.dwState = (int) *var_val;
+        break;
+
+    case UNDO:                 /* Reverse the SET action and free resources */
+        tcp_row.dwState = oldbuf;
+        break;
+
+    case COMMIT:               /* Confirm the SET, performing any irreversible actions,
+                                 * and free resources */
+        if ((status = SetTcpEntry(&tcp_row)) != NO_ERROR) {
+            snmp_log(LOG_ERR,
+                     "Error while trying to write connState %d, status = %d \n",
+                     tcp_row.dwState, status);
+            return SNMP_ERR_COMMITFAILED;
+        }
+    case FREE:                 /* Free any resources allocated */
+        break;
+    }
+    return SNMP_ERR_NOERROR;
+}                               /* end of writeTcpEntry */
+#endif                          /* WIN32 */
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/mibII/tcpTable.h tomato121/release/src/router/snmp/agent/mibgroup/mibII/tcpTable.h
--- tomato/release/src/router/snmp/agent/mibgroup/mibII/tcpTable.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/mibII/tcpTable.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,42 @@
+/*
+ *  TCP MIB group interface - tcp.h
+ *
+ */
+#ifndef _MIBGROUP_TCPTABLE_H
+#define _MIBGROUP_TCPTABLE_H
+
+#ifdef linux
+struct inpcb {
+    struct inpcb   *inp_next;   /* pointers to other pcb's */
+    struct in_addr  inp_faddr;  /* foreign host table entry */
+    u_short         inp_fport;  /* foreign port */
+    struct in_addr  inp_laddr;  /* local host table entry */
+    u_short         inp_lport;  /* local port */
+    int             inp_state;
+    int             uid;        /* owner of the connection */
+};
+#endif
+
+#ifdef hpux11
+#include <sys/mib.h>
+#endif
+
+#ifndef solaris2
+#if !defined(linux) && !defined(hpux11)
+extern int      TCP_Count_Connections(void);
+#endif
+extern void     TCP_Scan_Init(void);
+#ifdef hpux11
+extern int      TCP_Scan_Next(mib_tcpConnEnt *);
+#else
+struct inpcb;
+extern int      TCP_Scan_Next(int *, struct inpcb *);
+#endif
+#endif
+
+config_arch_require(solaris2, kernel_sunos5)
+config_require(mibII/tcp util_funcs)
+
+     extern FindVarMethod var_tcpEntry;
+
+#endif                          /* _MIBGROUP_TCPTABLE_H */
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/mibII/udp.c tomato121/release/src/router/snmp/agent/mibgroup/mibII/udp.c
--- tomato/release/src/router/snmp/agent/mibgroup/mibII/udp.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/mibII/udp.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,441 @@
+/*
+ *  UDP MIB group implementation - udp.c
+ *
+ */
+
+#include <net-snmp/net-snmp-config.h>
+
+#if HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+#include <sys/types.h>
+#if HAVE_WINSOCK_H
+#include <winsock.h>
+#endif
+
+#if HAVE_SYS_PARAM_H
+#include <sys/param.h>
+#endif
+
+#if HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+#if HAVE_SYS_SYSMP_H
+#include <sys/sysmp.h>
+#endif
+#if HAVE_SYS_TCPIPSTATS_H
+#include <sys/tcpipstats.h>
+#endif
+#if defined(IFNET_NEEDS_KERNEL) && !defined(_KERNEL)
+#define _KERNEL 1
+#define _I_DEFINED_KERNEL
+#endif
+#if HAVE_SYS_SOCKET_H
+#include <sys/socket.h>
+#endif
+#if HAVE_NET_IF_H
+#include <net/if.h>
+#endif
+#if HAVE_NET_IF_VAR_H
+#include <net/if_var.h>
+#endif
+#ifdef _I_DEFINED_KERNEL
+#undef _KERNEL
+#endif
+
+#if HAVE_SYS_STREAM_H
+#include <sys/stream.h>
+#endif
+#if HAVE_NET_ROUTE_H
+#include <net/route.h>
+#endif
+#if HAVE_NETINET_IN_SYSTM_H
+#include <netinet/in_systm.h>
+#endif
+#if HAVE_NETINET_IP_H
+#include <netinet/ip.h>
+#endif
+#if HAVE_SYS_QUEUE_H
+#include <sys/queue.h>
+#endif
+#if HAVE_SYS_SOCKETVAR_H
+#include <sys/socketvar.h>
+#endif
+#if HAVE_NETINET_IP_VAR_H
+#include <netinet/ip_var.h>
+#endif
+#ifdef INET6
+#if HAVE_NETINET6_IP6_VAR_H
+#include <netinet6/ip6_var.h>
+#endif
+#endif
+#if HAVE_NETINET_IN_PCB_H
+#include <netinet/in_pcb.h>
+#endif
+#ifdef HAVE_NETINET_UDP_H
+#include <netinet/udp.h>
+#endif
+#if HAVE_NETINET_UDP_VAR_H
+#include <netinet/udp_var.h>
+#endif
+#if HAVE_INET_MIB2_H
+#include <inet/mib2.h>
+#endif
+
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include <net-snmp/agent/auto_nlist.h>
+
+#include "util_funcs.h"
+
+#ifdef solaris2
+#include "kernel_sunos5.h"
+#else
+#include "kernel.h"
+#endif
+
+#ifdef linux
+#include "kernel_linux.h"
+#endif
+
+#ifdef cygwin
+#define WIN32
+#include <windows.h>
+#endif
+
+#ifdef hpux
+#include <sys/mib.h>
+#include <netinet/mib_kern.h>
+#endif                          /* hpux */
+
+#ifdef linux
+#include "tcp.h"
+#endif
+#include "udp.h"
+#include "udpTable.h"
+#include "sysORTable.h"
+
+#ifdef CAN_USE_SYSCTL
+#include <sys/sysctl.h>
+#endif
+
+#if HAVE_DMALLOC_H
+#include <dmalloc.h>
+#endif
+
+#ifndef MIB_STATS_CACHE_TIMEOUT
+#define MIB_STATS_CACHE_TIMEOUT	5
+#endif
+#ifndef UDP_STATS_CACHE_TIMEOUT
+#define UDP_STATS_CACHE_TIMEOUT	MIB_STATS_CACHE_TIMEOUT
+#endif
+marker_t        udp_stats_cache_marker = NULL;
+
+        /*********************
+	 *
+	 *  Kernel & interface information,
+	 *   and internal forward declarations
+	 *
+	 *********************/
+
+
+        /*********************
+	 *
+	 *  Initialisation & common implementation functions
+	 *
+	 *********************/
+
+struct variable3 udp_variables[] = {
+    {UDPINDATAGRAMS, ASN_COUNTER, RONLY, var_udp, 1, {1}},
+    {UDPNOPORTS, ASN_COUNTER, RONLY, var_udp, 1, {2}},
+    {UDPINERRORS, ASN_COUNTER, RONLY, var_udp, 1, {3}},
+    {UDPOUTDATAGRAMS, ASN_COUNTER, RONLY, var_udp, 1, {4}},
+    {UDPLOCALADDRESS, ASN_IPADDRESS, RONLY, var_udpEntry, 3, {5, 1, 1}},
+    {UDPLOCALPORT, ASN_INTEGER, RONLY, var_udpEntry, 3, {5, 1, 2}}
+};
+
+/*
+ * Define the OID pointer to the top of the mib tree that we're
+ * registering underneath, and the OID for the MIB module 
+ */
+oid             udp_variables_oid[] = { SNMP_OID_MIB2, 7 };
+oid             udp_module_oid[] = { SNMP_OID_MIB2, 50 };
+
+void
+init_udp(void)
+{
+
+    /*
+     * register ourselves with the agent to handle our mib tree 
+     */
+    REGISTER_MIB("mibII/udp", udp_variables, variable3, udp_variables_oid);
+    REGISTER_SYSOR_ENTRY(udp_module_oid,
+                         "The MIB module for managing UDP implementations");
+
+#ifdef UDPSTAT_SYMBOL
+    auto_nlist(UDPSTAT_SYMBOL, 0, 0);
+#endif
+#ifdef UDB_SYMBOL
+    auto_nlist(UDB_SYMBOL, 0, 0);
+#endif
+#ifdef solaris2
+    init_kernel_sunos5();
+#endif
+}
+
+
+        /*********************
+	 *
+	 *  System specific implementation functions
+	 *
+	 *********************/
+
+#ifdef linux
+#define UDP_STAT_STRUCTURE	struct udp_mib
+#define USES_SNMP_DESIGNED_UDPSTAT
+#undef UDPSTAT_SYMBOL
+#endif
+
+#ifdef solaris2
+#define UDP_STAT_STRUCTURE	mib2_udp_t
+#define USES_SNMP_DESIGNED_UDPSTAT
+#endif
+
+#ifdef hpux11
+#define UDP_STAT_STRUCTURE	int
+#endif
+
+#ifdef WIN32
+#include <iphlpapi.h>
+#define UDP_STAT_STRUCTURE MIB_UDPSTATS
+#endif
+
+#ifdef HAVE_SYS_TCPIPSTATS_H
+#define UDP_STAT_STRUCTURE	struct kna
+#define USES_TRADITIONAL_UDPSTAT
+#endif
+
+
+#if !defined(UDP_STAT_STRUCTURE)
+#define UDP_STAT_STRUCTURE	struct udpstat
+#define USES_TRADITIONAL_UDPSTAT
+#endif
+
+long            read_udp_stat(UDP_STAT_STRUCTURE *, int);
+
+u_char         *
+var_udp(struct variable *vp,
+        oid * name,
+        size_t * length,
+        int exact, size_t * var_len, WriteMethod ** write_method)
+{
+    static UDP_STAT_STRUCTURE udpstat;
+    static long     ret_value;
+
+    if (header_generic(vp, name, length, exact, var_len, write_method) ==
+        MATCH_FAILED)
+        return NULL;
+
+    ret_value = read_udp_stat(&udpstat, vp->magic);
+    if (ret_value < 0)
+        return NULL;
+
+#ifdef HAVE_SYS_TCPIPSTATS_H
+    /*
+     * This actually reads statistics for *all* the groups together,
+     * so we need to isolate the UDP-specific bits.  
+     */
+#define udpstat          udpstat.udpstat
+#endif
+
+    /*
+     *        Get the UDP statistics from the kernel...
+     */
+
+
+    switch (vp->magic) {
+#ifdef USES_SNMP_DESIGNED_UDPSTAT
+    case UDPINDATAGRAMS:
+        return (u_char *) & udpstat.udpInDatagrams;
+    case UDPNOPORTS:
+#ifdef solaris2
+        /*
+         * Solaris keeps the count of UDP No Port errors in
+         * the IP Mib structure, so this value is returned
+         * via the return value of the read_udp_stats routine 
+         */
+        return (u_char *) & ret_value;
+#else
+        return (u_char *) & udpstat.udpNoPorts;
+#endif
+    case UDPOUTDATAGRAMS:
+        return (u_char *) & udpstat.udpOutDatagrams;
+    case UDPINERRORS:
+        return (u_char *) & udpstat.udpInErrors;
+#endif                          /* SNMP_DESIGNED_UDPSTAT */
+
+
+#ifdef USES_TRADITIONAL_UDPSTAT
+    case UDPINDATAGRAMS:
+#if STRUCT_UDPSTAT_HAS_UDPS_IPACKETS
+        return (u_char *) & udpstat.udps_ipackets;
+#else
+        return NULL;
+#endif
+    case UDPNOPORTS:
+#if STRUCT_UDPSTAT_HAS_UDPS_NOPORT
+        return (u_char *) & udpstat.udps_noport;
+#else
+        return NULL;
+#endif
+    case UDPOUTDATAGRAMS:
+#if STRUCT_UDPSTAT_HAS_UDPS_OPACKETS
+        return (u_char *) & udpstat.udps_opackets;
+#else
+        return NULL;
+#endif
+    case UDPINERRORS:
+        long_return = udpstat.udps_hdrops + udpstat.udps_badsum +
+#ifdef STRUCT_UDPSTAT_HAS_UDPS_DISCARD
+            udpstat.udps_discard +
+#endif
+#ifdef STRUCT_UDPSTAT_HAS_UDPS_FULLSOCK
+            udpstat.udps_fullsock +
+#endif
+            udpstat.udps_badlen;
+        return (u_char *) & long_return;
+
+#endif                          /* USES_TRADITIONAL_UDPSTAT */
+#ifdef WIN32
+    case UDPINDATAGRAMS:
+        return (u_char *) & udpstat.dwInDatagrams;
+    case UDPNOPORTS:
+        return (u_char *) & udpstat.dwNoPorts;
+    case UDPOUTDATAGRAMS:
+        return (u_char *) & udpstat.dwOutDatagrams;
+    case UDPINERRORS:
+        return (u_char *) & udpstat.dwInErrors;
+#endif                          /* WIN32 */
+
+    default:
+        DEBUGMSGTL(("snmpd", "unknown sub-id %d in var_udp\n", vp->magic));
+    }
+    return NULL;
+
+#ifdef HAVE_SYS_TCPIPSTATS_H
+#undef udpstat
+#endif
+}
+
+        /*********************
+	 *
+	 *  Internal implementation functions
+	 *
+	 *********************/
+
+long
+read_udp_stat(UDP_STAT_STRUCTURE * udpstat, int magic)
+{
+    long            ret_value = -1;
+#if (defined(CAN_USE_SYSCTL) && defined(UDPCTL_STATS))
+    static int      sname[4] =
+        { CTL_NET, PF_INET, IPPROTO_UDP, UDPCTL_STATS };
+    size_t          len = sizeof(*udpstat);
+#endif
+#ifdef solaris2
+    static mib2_ip_t ipstat;
+#endif
+
+#ifdef hpux11
+    int             fd;
+    struct nmparms  p;
+    unsigned int    ulen;
+
+    if ((fd = open_mib("/dev/ip", O_RDONLY, 0, NM_ASYNC_OFF)) < 0)
+        return (-1);            /* error */
+
+    switch (magic) {
+    case UDPINDATAGRAMS:
+        p.objid = ID_udpInDatagrams;
+        break;
+    case UDPNOPORTS:
+        p.objid = ID_udpNoPorts;
+        break;
+    case UDPOUTDATAGRAMS:
+        p.objid = ID_udpOutDatagrams;
+        break;
+    case UDPINERRORS:
+        p.objid = ID_udpInErrors;
+        break;
+    default:
+        *udpstat = 0;
+        close_mib(fd);
+        return (0);
+    }
+
+    p.buffer = (void *) udpstat;
+    ulen = sizeof(UDP_STAT_STRUCTURE);
+    p.len = &ulen;
+    ret_value = get_mib_info(fd, &p);
+    close_mib(fd);
+
+    return (ret_value);         /* 0: ok, < 0: error */
+#else                           /* hpux11 */
+
+    if (udp_stats_cache_marker &&
+        (!atime_ready
+         (udp_stats_cache_marker, UDP_STATS_CACHE_TIMEOUT * 1000)))
+#ifdef solaris2
+        return (magic == UDPNOPORTS ? ipstat.udpNoPorts : 0);
+#else
+        return 0;
+#endif
+
+    if (udp_stats_cache_marker)
+        atime_setMarker(udp_stats_cache_marker);
+    else
+        udp_stats_cache_marker = atime_newMarker();
+
+#ifdef linux
+    ret_value = linux_read_udp_stat(udpstat);
+#endif
+
+#ifdef WIN32
+    ret_value = GetUdpStatistics(udpstat);
+#endif
+
+#ifdef solaris2
+    if (magic == UDPNOPORTS) {
+        if (getMibstat
+            (MIB_IP, &ipstat, sizeof(mib2_ip_t), GET_FIRST,
+             &Get_everything, NULL) < 0)
+            ret_value = -1;
+        else
+            ret_value = ipstat.udpNoPorts;
+    } else
+        ret_value = getMibstat(MIB_UDP, udpstat, sizeof(mib2_udp_t),
+                               GET_FIRST, &Get_everything, NULL);
+#endif
+
+#ifdef HAVE_SYS_TCPIPSTATS_H
+    ret_value = sysmp(MP_SAGET, MPSA_TCPIPSTATS, udpstat, sizeof *udpstat);
+#endif
+
+#if defined(CAN_USE_SYSCTL) && defined(UDPCTL_STATS)
+    ret_value = sysctl(sname, 4, udpstat, &len, 0, 0);
+#endif
+
+#ifdef UDPSTAT_SYMBOL
+    if (auto_nlist(UDPSTAT_SYMBOL, (char *) udpstat, sizeof(*udpstat)))
+        ret_value = 0;
+#endif
+
+    if (ret_value == -1) {
+        free(udp_stats_cache_marker);
+        udp_stats_cache_marker = NULL;
+    }
+    return ret_value;
+#endif                          /* hpux11 */
+}
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/mibII/udp.h tomato121/release/src/router/snmp/agent/mibgroup/mibII/udp.h
--- tomato/release/src/router/snmp/agent/mibgroup/mibII/udp.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/mibII/udp.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,24 @@
+/*
+ *  Template MIB group interface - udp.h
+ *
+ */
+#ifndef _MIBGROUP_UDP_H
+#define _MIBGROUP_UDP_H
+
+
+config_require(mibII/udpTable util_funcs)
+config_arch_require(solaris2, kernel_sunos5)
+config_arch_require(linux, mibII/kernel_linux)
+
+extern void     init_udp(void);
+extern FindVarMethod var_udp;
+
+
+#define UDPINDATAGRAMS	    0
+#define UDPNOPORTS	    1
+#define UDPINERRORS	    2
+#define UDPOUTDATAGRAMS     3
+#define UDPLOCALADDRESS     4
+#define UDPLOCALPORT	    5
+
+#endif                          /* _MIBGROUP_UDP_H */
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/mibII/udpTable.c tomato121/release/src/router/snmp/agent/mibgroup/mibII/udpTable.c
--- tomato/release/src/router/snmp/agent/mibgroup/mibII/udpTable.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/mibII/udpTable.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,747 @@
+/*
+ *  UDP MIB group Table implementation - udpTable.c
+ *
+ */
+
+#include <net-snmp/net-snmp-config.h>
+
+#if HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+#include <sys/types.h>
+#if HAVE_WINSOCK_H
+#include <winsock.h>
+#endif
+
+#if HAVE_SYS_PARAM_H
+#include <sys/param.h>
+#endif
+
+#if HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+#if HAVE_SYS_SYSMP_H
+#include <sys/sysmp.h>
+#endif
+#if HAVE_SYS_TCPIPSTATS_H
+#include <sys/tcpipstats.h>
+#endif
+#if defined(IFNET_NEEDS_KERNEL) && !defined(_KERNEL)
+#define _KERNEL 1
+#define _I_DEFINED_KERNEL
+#endif
+#if HAVE_SYS_SOCKET_H
+#include <sys/socket.h>
+#endif
+#if HAVE_NET_IF_H
+#include <net/if.h>
+#endif
+#if HAVE_NET_IF_VAR_H
+#include <net/if_var.h>
+#endif
+#ifdef _I_DEFINED_KERNEL
+#undef _KERNEL
+#endif
+
+#if HAVE_SYS_STREAM_H
+#include <sys/stream.h>
+#endif
+#if HAVE_NET_ROUTE_H
+#include <net/route.h>
+#endif
+#if HAVE_NETINET_IN_SYSTM_H
+#include <netinet/in_systm.h>
+#endif
+#if HAVE_NETINET_IP_H
+#include <netinet/ip.h>
+#endif
+#if HAVE_SYS_QUEUE_H
+#include <sys/queue.h>
+#endif
+#if HAVE_SYS_SOCKETVAR_H
+#include <sys/socketvar.h>
+#endif
+#if HAVE_NETINET_IP_VAR_H
+#include <netinet/ip_var.h>
+#endif
+#ifdef INET6
+#if HAVE_NETINET6_IP6_VAR_H
+#include <netinet6/ip6_var.h>
+#endif
+#endif
+#if HAVE_NETINET_IN_PCB_H
+#include <netinet/in_pcb.h>
+#endif
+#if HAVE_NETINET_UDP_H
+#include <netinet/udp.h>
+#endif
+#if HAVE_NETINET_UDP_VAR_H
+#include <netinet/udp_var.h>
+#endif
+#if HAVE_INET_MIB2_H
+#include <inet/mib2.h>
+#endif
+
+#ifdef solaris2
+#include "kernel_sunos5.h"
+#else
+#include "kernel.h"
+#endif
+
+#ifdef cygwin
+#define WIN32
+#include <windows.h>
+#endif
+
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include <net-snmp/agent/auto_nlist.h>
+
+#ifdef hpux
+#include <sys/mib.h>
+#include <netinet/mib_kern.h>
+#endif                          /* hpux */
+
+#ifdef linux
+#include "tcpTable.h"
+#endif
+#include "udp.h"
+#include "udpTable.h"
+#include "sysORTable.h"
+
+#ifdef CAN_USE_SYSCTL
+#include <sys/sysctl.h>
+#endif
+
+#if HAVE_DMALLOC_H
+#include <dmalloc.h>
+#endif
+
+        /*********************
+	 *
+	 *  Kernel & interface information,
+	 *   and internal forward declarations
+	 *
+	 *********************/
+
+#ifndef solaris2
+static void     UDP_Scan_Init(void);
+#ifdef hpux11
+static int      UDP_Scan_Next(mib_udpLsnEnt *);
+#else
+static int      UDP_Scan_Next(struct inpcb *);
+#endif
+#endif
+
+        /*********************
+	 *
+	 *  Initialisation & common implementation functions
+	 *
+	 *********************/
+
+
+        /*********************
+	 *
+	 *  System specific implementation functions
+	 *
+	 *********************/
+
+#ifndef WIN32
+#ifndef solaris2
+
+u_char         *
+var_udpEntry(struct variable *vp,
+             oid * name,
+             size_t * length,
+             int exact, size_t * var_len, WriteMethod ** write_method)
+{
+    int             i;
+    oid             newname[MAX_OID_LEN], lowest[MAX_OID_LEN], *op;
+    u_char         *cp;
+    int             LowState;
+#ifdef hpux11
+    static mib_udpLsnEnt udp, Lowudp;
+#else
+    static struct inpcb inpcb, Lowinpcb;
+#endif
+
+    memcpy((char *) newname, (char *) vp->name,
+           (int) vp->namelen * sizeof(oid));
+    /*
+     * find the "next" pseudo-connection 
+     */
+#ifndef hpux11
+  Again:
+#endif
+    LowState = -1;              /* UDP doesn't have 'State', but it's a useful flag */
+    UDP_Scan_Init();
+    for (;;) {
+#ifdef hpux11
+        if ((i = UDP_Scan_Next(&udp)) == 0)
+            break;              /* Done */
+        cp = (u_char *) & udp.LocalAddress;
+#else                           /* hpux11 */
+        if ((i = UDP_Scan_Next(&inpcb)) < 0)
+            goto Again;
+        if (i == 0)
+            break;              /* Done */
+        cp = (u_char *) & inpcb.inp_laddr.s_addr;
+#endif                          /* hpux11 */
+        op = newname + 10;
+        *op++ = *cp++;
+        *op++ = *cp++;
+        *op++ = *cp++;
+        *op++ = *cp++;
+
+#ifdef hpux11
+        newname[14] = (unsigned short) udp.LocalPort;
+#else
+        newname[14] = ntohs(inpcb.inp_lport);
+#endif
+
+        if (exact) {
+            if (snmp_oid_compare(newname, 15, name, *length) == 0) {
+                memcpy((char *) lowest, (char *) newname,
+                       15 * sizeof(oid));
+                LowState = 0;
+#ifdef hpux11
+                Lowudp = udp;
+#else
+                Lowinpcb = inpcb;
+#endif
+                break;          /* no need to search further */
+            }
+        } else {
+            if ((snmp_oid_compare(newname, 15, name, *length) > 0) &&
+                ((LowState < 0)
+                 || (snmp_oid_compare(newname, 15, lowest, 15) < 0))) {
+                /*
+                 * if new one is greater than input and closer to input than
+                 * previous lowest, save this one as the "next" one.
+                 */
+                memcpy((char *) lowest, (char *) newname,
+                       15 * sizeof(oid));
+                LowState = 0;
+#ifdef hpux11
+                Lowudp = udp;
+#else
+                Lowinpcb = inpcb;
+#endif
+            }
+        }
+    }
+    if (LowState < 0)
+        return (NULL);
+    memcpy((char *) name, (char *) lowest,
+           ((int) vp->namelen + 10) * sizeof(oid));
+    *length = vp->namelen + 5;
+    *write_method = 0;
+    *var_len = sizeof(long);
+    switch (vp->magic) {
+    case UDPLOCALADDRESS:
+#ifdef hpux11
+        return (u_char *) & Lowudp.LocalAddress;
+#else
+        return (u_char *) & Lowinpcb.inp_laddr.s_addr;
+#endif
+    case UDPLOCALPORT:
+#ifdef hpux11
+        long_return = (unsigned short) Lowudp.LocalPort;
+#else
+        long_return = ntohs(Lowinpcb.inp_lport);
+#endif
+        return (u_char *) & long_return;
+    default:
+        DEBUGMSGTL(("snmpd", "unknown sub-id %d in var_udpEntry\n",
+                    vp->magic));
+    }
+    return NULL;
+}
+
+#else                           /* solaris2 - udp */
+
+static int
+UDP_Cmp(void *addr, void *ep)
+{
+    if (memcmp((mib2_udpEntry_t *) ep, (mib2_udpEntry_t *) addr,
+               sizeof(mib2_udpEntry_t)) == 0)
+        return (0);
+    else
+        return (1);
+}
+
+u_char         *
+var_udpEntry(struct variable * vp,
+             oid * name,
+             size_t * length,
+             int exact, size_t * var_len, WriteMethod ** write_method)
+{
+    oid             newname[MAX_OID_LEN], lowest[MAX_OID_LEN], *op;
+    u_char         *cp;
+
+#define UDP_LISTEN_LENGTH 15
+#define UDP_LOCADDR_OFF   10
+#define UDP_LOCPORT_OFF   14
+    mib2_udpEntry_t Lowentry, Nextentry, entry;
+    req_e           req_type;
+    int             Found = 0;
+
+    memset(&Lowentry, 0, sizeof(Lowentry));
+    memcpy((char *) newname, (char *) vp->name, vp->namelen * sizeof(oid));
+    if (*length == UDP_LISTEN_LENGTH)   /* Assume that the input name is the lowest */
+        memcpy((char *) lowest, (char *) name,
+               UDP_LISTEN_LENGTH * sizeof(oid));
+    for (Nextentry.udpLocalAddress = (u_long) - 1, req_type = GET_FIRST;;
+         req_type = GET_NEXT) {
+        if (getMibstat
+            (MIB_UDP_LISTEN, &entry, sizeof(mib2_udpEntry_t), req_type,
+             &UDP_Cmp, &entry) != 0)
+            break;
+        if (entry.udpEntryInfo.ue_state != MIB2_UDP_idle)
+            continue;           /* we only want to get listen ports */
+        COPY_IPADDR(cp, (u_char *) & entry.udpLocalAddress, op,
+                    newname + UDP_LOCADDR_OFF);
+        newname[UDP_LOCPORT_OFF] = entry.udpLocalPort;
+
+        if (exact) {
+            if (snmp_oid_compare(newname, UDP_LISTEN_LENGTH, name, *length)
+                == 0) {
+                memcpy((char *) lowest, (char *) newname,
+                       UDP_LISTEN_LENGTH * sizeof(oid));
+                Lowentry = entry;
+                Found++;
+                break;          /* no need to search further */
+            }
+        } else {
+            if ((snmp_oid_compare
+                 (newname, UDP_LISTEN_LENGTH, name, *length) > 0)
+                && ((Nextentry.udpLocalAddress == (u_long) - 1)
+                    ||
+                    (snmp_oid_compare
+                     (newname, UDP_LISTEN_LENGTH, lowest,
+                      UDP_LISTEN_LENGTH) < 0)
+                    ||
+                    (snmp_oid_compare
+                     (name, *length, lowest, UDP_LISTEN_LENGTH) == 0))) {
+                /*
+                 * if new one is greater than input and closer to input than
+                 * * previous lowest, and is not equal to it, save this one as
+                 * * the "next" one.
+                 */
+                memcpy((char *) lowest, (char *) newname,
+                       UDP_LISTEN_LENGTH * sizeof(oid));
+                Lowentry = entry;
+                Found++;
+            }
+        }
+        Nextentry = entry;
+    }
+    if (Found == 0)
+        return (NULL);
+    memcpy((char *) name, (char *) lowest,
+           (vp->namelen + UDP_LISTEN_LENGTH -
+            UDP_LOCADDR_OFF) * sizeof(oid));
+    *length = vp->namelen + UDP_LISTEN_LENGTH - UDP_LOCADDR_OFF;
+    *write_method = 0;
+    *var_len = sizeof(long);
+    switch (vp->magic) {
+    case UDPLOCALADDRESS:
+        long_return = Lowentry.udpLocalAddress;
+        return (u_char *) & long_return;
+    case UDPLOCALPORT:
+        long_return = Lowentry.udpLocalPort;
+        return (u_char *) & long_return;
+    default:
+        DEBUGMSGTL(("snmpd", "unknown sub-id %d in var_udpEntry\n",
+                    vp->magic));
+    }
+    return NULL;
+}
+#endif                          /* solaris2 - udp */
+
+
+        /*********************
+	 *
+	 *  Internal implementation functions
+	 *
+	 *********************/
+
+#ifdef linux
+static struct inpcb *udp_inpcb_list;
+#endif
+
+#ifndef solaris2
+
+#ifdef hpux11
+static int      udptab_size, udptab_current;
+static mib_udpLsnEnt *udp = (mib_udpLsnEnt *) 0;
+#else                           /* hpux11 */
+static struct inpcb udp_inpcb, *udp_prev;
+#ifdef PCB_TABLE
+static struct inpcb *udp_head, *udp_next;
+#endif
+#if defined(CAN_USE_SYSCTL) && defined(UDPCTL_PCBLIST)
+static char    *udpcb_buf = NULL;
+static struct xinpgen *xig = NULL;
+#endif                          /* !defined(CAN_USE_SYSCTL) || !define(UDPCTL_PCBLIST) */
+#endif                          /* hpux11 */
+
+
+static void
+UDP_Scan_Init(void)
+{
+#ifdef hpux11
+
+    int             fd;
+    struct nmparms  p;
+    int             val;
+    unsigned int    ulen;
+    int             ret;
+
+    if (udp)
+        free(udp);
+    udp = (mib_udpLsnEnt *) 0;
+    udptab_size = 0;
+
+    if ((fd = open_mib("/dev/ip", O_RDONLY, 0, NM_ASYNC_OFF)) >= 0) {
+        p.objid = ID_udpLsnNumEnt;
+        p.buffer = (void *) &val;
+        ulen = sizeof(int);
+        p.len = &ulen;
+        if ((ret = get_mib_info(fd, &p)) == 0)
+            udptab_size = val;
+
+        if (udptab_size > 0) {
+            ulen = (unsigned) udptab_size *sizeof(mib_udpLsnEnt);
+            udp = (mib_udpLsnEnt *) malloc(ulen);
+            p.objid = ID_udpLsnTable;
+            p.buffer = (void *) udp;
+            p.len = &ulen;
+            if ((ret = get_mib_info(fd, &p)) < 0)
+                udptab_size = 0;
+        }
+
+        close_mib(fd);
+    }
+
+    udptab_current = 0;
+
+#else                           /* hpux11 */
+
+#if !defined(CAN_USE_SYSCTL) || !defined(UDPCTL_PCBLIST)
+#ifdef PCB_TABLE
+    struct inpcbtable table;
+#endif
+#ifndef linux
+#ifdef PCB_TABLE
+    auto_nlist(UDB_SYMBOL, (char *) &table, sizeof(table));
+    udp_next = table.inpt_queue.cqh_first;
+    udp_head = udp_prev =
+        (struct inpcb *) &((struct inpcbtable *)
+                           auto_nlist_value(UDB_SYMBOL))->inpt_queue.
+        cqh_first;
+#else
+    auto_nlist(UDB_SYMBOL, (char *) &udp_inpcb, sizeof(udp_inpcb));
+#if !(defined(freebsd2) || defined(netbsd1) || defined(openbsd2))
+    udp_prev = (struct inpcb *) auto_nlist_value(UDB_SYMBOL);
+#endif
+#endif
+#else                           /* linux */
+    FILE           *in;
+    char            line[256];
+    struct inpcb  **pp;
+    struct timeval  now;
+    static unsigned long Time_Of_Last_Reload = 0;
+
+    /*
+     * save some cpu-cycles, and reload after 5 secs...
+     */
+    gettimeofday(&now, (struct timezone *) 0);
+    if (Time_Of_Last_Reload + 5 > now.tv_sec) {
+        udp_prev = udp_inpcb_list;
+        return;
+    }
+    Time_Of_Last_Reload = now.tv_sec;
+
+
+    if (!(in = fopen("/proc/net/udp", "r"))) {
+        snmp_log(LOG_ERR, "snmpd: cannot open /proc/net/udp ...\n");
+        udp_prev = 0;
+        return;
+    }
+
+    /*
+     * free old chain: 
+     */
+    while (udp_inpcb_list) {
+        struct inpcb   *p = udp_inpcb_list;
+        udp_inpcb_list = udp_inpcb_list->inp_next;
+        free(p);
+    }
+
+    /*
+     * scan proc-file and append: 
+     */
+
+    pp = &udp_inpcb_list;
+
+    while (line == fgets(line, sizeof(line), in)) {
+        struct inpcb    pcb, *nnew;
+        unsigned int    state, lport;
+
+        if (3 != sscanf(line, "%*d: %x:%x %*x:%*x %x",
+                        &pcb.inp_laddr.s_addr, &lport, &state))
+            continue;
+
+        if (state != 7)         /* fix me:  UDP_LISTEN ??? */
+            continue;
+
+        pcb.inp_lport = htons((unsigned short) (lport));
+        pcb.inp_fport = htons(pcb.inp_fport);
+
+        nnew = (struct inpcb *) malloc(sizeof(struct inpcb));
+        if (nnew == NULL)
+            break;
+        *nnew = pcb;
+        nnew->inp_next = 0;
+
+        *pp = nnew;
+        pp = &nnew->inp_next;
+    }
+
+    fclose(in);
+
+    /*
+     * first entry to go: 
+     */
+    udp_prev = udp_inpcb_list;
+#endif                          /*linux */
+#else                           /*  !defined(CAN_USE_SYSCTL) || !defined(UDPCTL_PCBLIST) */
+    {
+        size_t          len;
+        int             sname[] =
+            { CTL_NET, PF_INET, IPPROTO_UDP, UDPCTL_PCBLIST };
+
+        if (udpcb_buf) {
+            free(udpcb_buf);
+            udpcb_buf = NULL;
+        }
+        xig = NULL;
+
+        len = 0;
+        if (sysctl(sname, 4, 0, &len, 0, 0) < 0) {
+            return;
+        }
+        if ((udpcb_buf = malloc(len)) == NULL) {
+            return;
+        }
+        if (sysctl(sname, 4, udpcb_buf, &len, 0, 0) < 0) {
+            free(udpcb_buf);
+            udpcb_buf = NULL;
+            return;
+        }
+
+        xig = (struct xinpgen *) udpcb_buf;
+        xig = (struct xinpgen *) ((char *) xig + xig->xig_len);
+        return;
+    }
+#endif                          /*  !defined(CAN_USE_SYSCTL) || !defined(UDPCTL_PCBLIST) */
+
+#endif                          /* hpux11 */
+}
+
+#ifdef hpux11
+static int
+UDP_Scan_Next(mib_udpLsnEnt * RetUdp)
+{
+    if (udptab_current < udptab_size) {
+        /*
+         * copy values 
+         */
+        *RetUdp = udp[udptab_current];
+        /*
+         * increment to point to next entry 
+         */
+        udptab_current++;
+        /*
+         * return success 
+         */
+        return (1);
+    }
+
+    /*
+     * return done 
+     */
+    return (0);
+}
+#else                           /* hpux11 */
+static int
+UDP_Scan_Next(struct inpcb *RetInPcb)
+{
+#if !defined(CAN_USE_SYSCTL) || !defined(UDPCTL_PCBLIST)
+    register struct inpcb *next;
+
+#ifndef linux
+#ifdef PCB_TABLE
+    if (udp_next == udp_head)
+        return 0;
+#else
+    if ((udp_inpcb.INP_NEXT_SYMBOL == NULL) ||
+        (udp_inpcb.INP_NEXT_SYMBOL ==
+         (struct inpcb *) auto_nlist_value(UDB_SYMBOL))) {
+        return (0);             /* "EOF" */
+    }
+#endif
+
+#ifdef PCB_TABLE
+    klookup((unsigned long) udp_next, (char *) &udp_inpcb,
+            sizeof(udp_inpcb));
+    udp_next = udp_inpcb.inp_queue.cqe_next;
+#else
+    next = udp_inpcb.INP_NEXT_SYMBOL;
+
+    klookup((unsigned long) next, (char *) &udp_inpcb, sizeof(udp_inpcb));
+#if !(defined(netbsd1) || defined(freebsd2) || defined(linux) || defined(openbsd2))
+    if (udp_inpcb.INP_PREV_SYMBOL != udp_prev)  /* ??? */
+        return (-1);            /* "FAILURE" */
+#endif
+#endif
+    *RetInPcb = udp_inpcb;
+#if !(defined(netbsd1) || defined(freebsd2) || defined(openbsd2))
+    udp_prev = next;
+#endif
+#else                           /* linux */
+    if (!udp_prev)
+        return 0;
+
+    udp_inpcb = *udp_prev;
+    next = udp_inpcb.inp_next;
+    *RetInPcb = udp_inpcb;
+    udp_prev = next;
+#endif                          /* linux */
+#else                           /*  !defined(CAN_USE_SYSCTL) || !defined(UDPCTL_PCBLIST) */
+    /*
+     * Are we done? 
+     */
+    if ((xig == NULL) || (xig->xig_len <= sizeof(struct xinpgen)))
+        return (0);
+
+    *RetInPcb = ((struct xinpcb *) xig)->xi_inp;
+
+    /*
+     * Prepare for Next read 
+     */
+    xig = (struct xinpgen *) ((char *) xig + xig->xig_len);
+#endif                          /*  !defined(CAN_USE_SYSCTL) || !defined(UDPCTL_PCBLIST) */
+    return (1);                 /* "OK" */
+}
+#endif                          /* hpux11 */
+#endif                          /* solaris2 */
+
+#else                           /* WIN32 */
+#include <iphlpapi.h>
+
+u_char         *
+var_udpEntry(struct variable *vp,
+             oid * name,
+             size_t * length,
+             int exact, size_t * var_len, WriteMethod ** write_method)
+{
+    oid             newname[MAX_OID_LEN], lowest[MAX_OID_LEN], *op;
+    u_char         *cp;
+    int             LowState = -1;
+    static PMIB_UDPTABLE pUdpTable = NULL;
+    DWORD           status = NO_ERROR;
+    DWORD           dwActualSize = 0;
+    UINT            i;
+    struct timeval  now;
+    static long     Time_Of_Last_Reload = 0;
+    struct in_addr  inadLocal;
+    memcpy((char *) newname, (char *) vp->name,
+           (int) vp->namelen * sizeof(oid));
+
+    /*
+     * save some cpu-cycles, and reload after 5 secs...
+     */
+    gettimeofday(&now, (struct timezone *) 0);
+    if ((Time_Of_Last_Reload + 5 <= now.tv_sec) || (pUdpTable == NULL)) {
+        if (pUdpTable != NULL)
+            free(pUdpTable);
+        Time_Of_Last_Reload = now.tv_sec;
+        /*
+         * query for the buffer size needed 
+         */
+        status = GetUdpTable(pUdpTable, &dwActualSize, TRUE);
+        if (status == ERROR_INSUFFICIENT_BUFFER) {
+            pUdpTable = (PMIB_UDPTABLE) malloc(dwActualSize);
+            if (pUdpTable != NULL) {
+                /*
+                 * Get the sorted UDP table 
+                 */
+                status = GetUdpTable(pUdpTable, &dwActualSize, TRUE);
+
+            }
+        }
+    }
+    if (status == NO_ERROR) {
+        for (i = 0; i < pUdpTable->dwNumEntries; ++i) {
+            inadLocal.s_addr = pUdpTable->table[i].dwLocalAddr;
+            cp = (u_char *) & pUdpTable->table[i].dwLocalAddr;
+
+            op = newname + 10;
+            *op++ = *cp++;
+            *op++ = *cp++;
+            *op++ = *cp++;
+            *op++ = *cp++;
+
+            newname[14] =
+                ntohs((unsigned short) (0x0000FFFF & pUdpTable->table[i].
+                                        dwLocalPort));
+
+            if (exact) {
+                if (snmp_oid_compare(newname, 15, name, *length) == 0) {
+                    memcpy((char *) lowest, (char *) newname,
+                           15 * sizeof(oid));
+                    LowState = 0;
+                    break;      /* no need to search further */
+                }
+            } else {
+                if (snmp_oid_compare(newname, 15, name, *length) > 0) {
+                    memcpy((char *) lowest, (char *) newname,
+                           15 * sizeof(oid));
+                    LowState = 0;
+                    inadLocal.s_addr = pUdpTable->table[i].dwLocalAddr;
+                    break;      /* As the table is sorted, no need to search further */
+                }
+            }
+        }
+    }
+
+    if (LowState < 0) {
+        free(pUdpTable);
+        pUdpTable = NULL;
+        return (NULL);
+    }
+    memcpy((char *) name, (char *) lowest,
+           ((int) vp->namelen + 10) * sizeof(oid));
+    *length = vp->namelen + 5;
+    *write_method = 0;
+    *var_len = sizeof(long);
+    switch (vp->magic) {
+    case UDPLOCALADDRESS:
+        return (u_char *) & pUdpTable->table[i].dwLocalAddr;
+    case UDPLOCALPORT:
+        long_return =
+            ntohs((unsigned short) (0x0000FFFF & pUdpTable->table[i].
+                                    dwLocalPort));
+        return (u_char *) & long_return;
+    default:
+        DEBUGMSGTL(("snmpd", "unknown sub-id %d in var_udpEntry\n",
+                    vp->magic));
+    }
+    return NULL;
+}
+
+#endif                          /* WIN32 */
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/mibII/udpTable.h tomato121/release/src/router/snmp/agent/mibgroup/mibII/udpTable.h
--- tomato/release/src/router/snmp/agent/mibgroup/mibII/udpTable.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/mibII/udpTable.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,13 @@
+/*
+ *  Template MIB group interface - udp.h
+ *
+ */
+#ifndef _MIBGROUP_UDPTABLE_H
+#define _MIBGROUP_UDPTABLE_H
+
+config_arch_require(solaris2, kernel_sunos5)
+config_require(mibII/ip util_funcs)
+
+     extern FindVarMethod var_udpEntry;
+
+#endif                          /* _MIBGROUP_UDPTABLE_H */
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/mibII/vacm_context.c tomato121/release/src/router/snmp/agent/mibgroup/mibII/vacm_context.c
--- tomato/release/src/router/snmp/agent/mibgroup/mibII/vacm_context.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/mibII/vacm_context.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,167 @@
+#include <net-snmp/net-snmp-config.h>
+
+#if HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include <net-snmp/agent/table.h>
+#include <net-snmp/agent/table_iterator.h>
+
+#include "vacm_context.h"
+
+static oid      vacm_context_oid[] = { 1, 3, 6, 1, 6, 3, 16, 1, 1 };
+
+#define CONTEXTNAME_COLUMN 1
+
+/*
+ * return the index data from the first node in the agent's
+ * subtree_context_cache list.
+ */
+netsnmp_variable_list *
+get_first_context(void **my_loop_context, void **my_data_context,
+                  netsnmp_variable_list * put_data,
+                  netsnmp_iterator_info *iinfo)
+{
+    subtree_context_cache *context_ptr;
+    context_ptr = get_top_context_cache();
+
+    if (!context_ptr)
+        return NULL;
+
+    *my_loop_context = context_ptr;
+    *my_data_context = context_ptr;
+
+    snmp_set_var_value(put_data, context_ptr->context_name,
+                       strlen(context_ptr->context_name));
+    return put_data;
+}
+
+/*
+ * return the next index data from the first node in the agent's
+ * subtree_context_cache list.
+ */
+netsnmp_variable_list *
+get_next_context(void **my_loop_context,
+                 void **my_data_context,
+                 netsnmp_variable_list * put_data,
+                 netsnmp_iterator_info *iinfo)
+{
+    subtree_context_cache *context_ptr;
+
+    if (!my_loop_context || !*my_loop_context)
+        return NULL;
+
+    context_ptr = (subtree_context_cache *) (*my_loop_context);
+    context_ptr = context_ptr->next;
+    *my_loop_context = context_ptr;
+    *my_data_context = context_ptr;
+
+    if (!context_ptr)
+        return NULL;
+
+    snmp_set_var_value(put_data, context_ptr->context_name,
+                       strlen(context_ptr->context_name));
+    return put_data;
+}
+
+void
+init_vacm_context(void)
+{
+    /*
+     * table vacm_context
+     */
+    netsnmp_handler_registration *my_handler;
+    netsnmp_table_registration_info *table_info;
+    netsnmp_iterator_info *iinfo;
+
+    my_handler = netsnmp_create_handler_registration("vacm_context",
+                                                     vacm_context_handler,
+                                                     vacm_context_oid,
+                                                     sizeof
+                                                     (vacm_context_oid) /
+                                                     sizeof(oid),
+                                                     HANDLER_CAN_RONLY);
+
+    if (!my_handler)
+        return;
+
+    table_info = SNMP_MALLOC_TYPEDEF(netsnmp_table_registration_info);
+    iinfo = SNMP_MALLOC_TYPEDEF(netsnmp_iterator_info);
+
+    if (!table_info || !iinfo)
+        return;
+
+    netsnmp_table_helper_add_index(table_info, ASN_OCTET_STR)
+        table_info->min_column = 1;
+    table_info->max_column = 1;
+    iinfo->get_first_data_point = get_first_context;
+    iinfo->get_next_data_point = get_next_context;
+    iinfo->table_reginfo = table_info;
+    netsnmp_register_table_iterator(my_handler, iinfo);
+}
+
+/*
+ * returns a list of known context names
+ */
+
+int
+vacm_context_handler(netsnmp_mib_handler *handler,
+                     netsnmp_handler_registration *reginfo,
+                     netsnmp_agent_request_info *reqinfo,
+                     netsnmp_request_info *requests)
+{
+    subtree_context_cache *context_ptr;
+
+    while (requests) {
+        netsnmp_variable_list *var = requests->requestvb;
+
+        if (requests->processed != 0)
+            continue;
+
+
+        context_ptr = (subtree_context_cache *)
+            netsnmp_extract_iterator_context(requests);
+
+        if (context_ptr == NULL) {
+            snmp_log(LOG_ERR,
+                     "vacm_context_handler called without data\n");
+            requests = requests->next;
+            continue;
+        }
+
+        switch (reqinfo->mode) {
+        case MODE_GET:
+            /*
+             * if here we should have a context_ptr passed in already 
+             */
+            /*
+             * only one column should ever reach us, so don't check it 
+             */
+            snmp_set_var_typed_value(var, ASN_OCTET_STR,
+                                     context_ptr->context_name,
+                                     strlen(context_ptr->context_name));
+
+            break;
+
+        default:
+            /*
+             * We should never get here, getnext already have been
+             * handled by the table_iterator and we're read_only 
+             */
+            snmp_log(LOG_ERR,
+                     "vacm_context table accessed as mode=%d.  We're improperly registered!",
+                     reqinfo->mode);
+            break;
+
+
+        }
+
+        requests = requests->next;
+    }
+
+    return SNMP_ERR_NOERROR;
+}
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/mibII/vacm_context.h tomato121/release/src/router/snmp/agent/mibgroup/mibII/vacm_context.h
--- tomato/release/src/router/snmp/agent/mibgroup/mibII/vacm_context.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/mibII/vacm_context.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,6 @@
+/*
+ * testhandler.h 
+ */
+
+void            init_vacm_context(void);
+Netsnmp_Node_Handler vacm_context_handler;
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/mibII/vacm_vars.c tomato121/release/src/router/snmp/agent/mibgroup/mibII/vacm_vars.c
--- tomato/release/src/router/snmp/agent/mibgroup/mibII/vacm_vars.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/mibII/vacm_vars.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,2638 @@
+/*
+ * SNMPv3 View-based Access Control Model
+ */
+
+#include <net-snmp/net-snmp-config.h>
+
+#if HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#if HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#if HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+#if HAVE_MALLOC_H
+#include <malloc.h>
+#endif
+#include <ctype.h>
+#include <sys/types.h>
+#if HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+#if HAVE_ARPA_INET_H
+#include <arpa/inet.h>
+#endif
+
+#if HAVE_DMALLOC_H
+#include <dmalloc.h>
+#endif
+
+#if HAVE_NETDB_H
+#include <netdb.h>
+#endif
+#if HAVE_WINSOCK_H
+#include <winsock.h>
+#endif
+
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+#include <net-snmp/agent/agent_callbacks.h>
+#include "vacm_vars.h"
+#include "util_funcs.h"
+
+#ifdef USING_MIBII_SYSORTABLE_MODULE
+#if TIME_WITH_SYS_TIME
+# ifdef WIN32
+#  include <sys/timeb.h>
+# else
+#  include <sys/time.h>
+# endif
+# include <time.h>
+#else
+# if HAVE_SYS_TIME_H
+#  include <sys/time.h>
+# else
+#  include <time.h>
+# endif
+#endif
+#include "sysORTable.h"
+#endif
+static unsigned int vacmViewSpinLock = 0;
+
+void
+init_vacm_vars(void)
+{
+
+#ifdef USING_MIBII_SYSORTABLE_MODULE
+    static oid      reg[] = { SNMP_OID_SNMPMODULES, 16, 2, 2, 1 };
+#endif
+
+#define PRIVRW	(SNMPV2ANY | 0x5000)
+
+    struct variable1 vacm_sec2group[] = {
+        {SECURITYGROUP, ASN_OCTET_STR, RWRITE, var_vacm_sec2group, 1, {3}},
+        {SECURITYSTORAGE, ASN_INTEGER, RWRITE, var_vacm_sec2group, 1, {4}},
+        {SECURITYSTATUS, ASN_INTEGER, RWRITE, var_vacm_sec2group, 1, {5}},
+    };
+
+    struct variable1 vacm_access[] = {
+        {ACCESSMATCH, ASN_INTEGER, RWRITE, var_vacm_access, 1, {4}},
+        {ACCESSREAD, ASN_OCTET_STR, RWRITE, var_vacm_access, 1, {5}},
+        {ACCESSWRITE, ASN_OCTET_STR, RWRITE, var_vacm_access, 1, {6}},
+        {ACCESSNOTIFY, ASN_OCTET_STR, RWRITE, var_vacm_access, 1, {7}},
+        {ACCESSSTORAGE, ASN_INTEGER, RWRITE, var_vacm_access, 1, {8}},
+        {ACCESSSTATUS, ASN_INTEGER, RWRITE, var_vacm_access, 1, {9}},
+    };
+
+    struct variable3 vacm_view[] = {
+        {VACMVIEWSPINLOCK, ASN_INTEGER, RWRITE, var_vacm_view, 1, {1}},
+        {VIEWMASK, ASN_OCTET_STR, RWRITE, var_vacm_view, 3, {2, 1, 3}},
+        {VIEWTYPE, ASN_INTEGER, RWRITE, var_vacm_view, 3, {2, 1, 4}},
+        {VIEWSTORAGE, ASN_INTEGER, RWRITE, var_vacm_view, 3, {2, 1, 5}},
+        {VIEWSTATUS, ASN_INTEGER, RWRITE, var_vacm_view, 3, {2, 1, 6}},
+    };
+
+    /*
+     * Define the OID pointer to the top of the mib tree that we're
+     * registering underneath 
+     */
+    oid             vacm_sec2group_oid[] = { OID_VACMGROUPENTRY };
+    oid             vacm_access_oid[] = { OID_VACMACCESSENTRY };
+    oid             vacm_view_oid[] = { OID_VACMMIBVIEWS };
+
+    /*
+     * we need to be called back later 
+     */
+    snmp_register_callback(SNMP_CALLBACK_LIBRARY, SNMP_CALLBACK_STORE_DATA,
+                           store_vacm, NULL);
+
+    /*
+     * register ourselves with the agent to handle our mib tree 
+     */
+    REGISTER_MIB("mibII/vacm:sec2group", vacm_sec2group, variable1,
+                 vacm_sec2group_oid);
+    REGISTER_MIB("mibII/vacm:access", vacm_access, variable1,
+                 vacm_access_oid);
+    REGISTER_MIB("mibII/vacm:view", vacm_view, variable3, vacm_view_oid);
+    snmpd_register_config_handler("group", vacm_parse_group,
+                                  vacm_free_group,
+                                  "name v1|v2c|usm|... security");
+    snmpd_register_config_handler("access", vacm_parse_access,
+                                  vacm_free_access,
+                                  "name context model level prefx read write notify");
+    snmpd_register_config_handler("view", vacm_parse_view, vacm_free_view,
+                                  "name type subtree [mask]");
+    snmpd_register_config_handler("rwcommunity", vacm_parse_simple, NULL,
+                                  "community [default|hostname|network/bits] [oid]");
+    snmpd_register_config_handler("rocommunity", vacm_parse_simple, NULL,
+                                  "community [default|hostname|network/bits] [oid]");
+#ifdef SNMP_TRANSPORT_UDPIPV6_DOMAIN
+    snmpd_register_config_handler("rwcommunity6", vacm_parse_simple, NULL,
+                                  "community [default|hostname|network/bits] [oid]");
+    snmpd_register_config_handler("rocommunity6", vacm_parse_simple, NULL,
+                                  "community [default|hostname|network/bits] [oid]");
+#endif
+    snmpd_register_config_handler("rwuser", vacm_parse_simple, NULL,
+                                  "user [noauth|auth|priv] [oid]");
+    snmpd_register_config_handler("rouser", vacm_parse_simple, NULL,
+                                  "user [noauth|auth|priv] [oid]");
+    snmpd_register_config_handler("vacmView", vacm_parse_config_view, NULL,
+                                  NULL);
+    snmpd_register_config_handler("vacmGroup", vacm_parse_config_group,
+                                  NULL, NULL);
+    snmpd_register_config_handler("vacmAccess", vacm_parse_config_access,
+                                  NULL, NULL);
+
+
+#ifdef USING_MIBII_SYSORTABLE_MODULE
+    register_sysORTable(reg, 10,
+                        "View-based Access Control Model for SNMP.");
+#endif
+
+    /*
+     * register ourselves to handle access control 
+     */
+    snmp_register_callback(SNMP_CALLBACK_APPLICATION,
+                           SNMPD_CALLBACK_ACM_CHECK, vacm_in_view_callback,
+                           NULL);
+    snmp_register_callback(SNMP_CALLBACK_APPLICATION,
+                           SNMPD_CALLBACK_ACM_CHECK_INITIAL,
+                           vacm_in_view_callback, NULL);
+    snmp_register_callback(SNMP_CALLBACK_APPLICATION,
+                           SNMPD_CALLBACK_ACM_CHECK_SUBTREE,
+                           vacm_in_view_callback, NULL);
+    snmp_register_callback(SNMP_CALLBACK_LIBRARY,
+                           SNMP_CALLBACK_POST_READ_CONFIG,
+                           vacm_warn_if_not_configured, NULL);
+}
+
+
+
+void
+vacm_parse_group(const char *token, char *param)
+{
+    char           *group, *model, *security;
+    int             imodel;
+    struct vacm_groupEntry *gp = NULL;
+
+    group = strtok(param, " \t\n");
+    model = strtok(NULL, " \t\n");
+    security = strtok(NULL, " \t\n");
+
+    if (group == NULL || *group == 0) {
+        config_perror("missing GROUP parameter");
+        return;
+    }
+    if (model == NULL || *model == 0) {
+        config_perror("missing MODEL parameter");
+        return;
+    }
+    if (security == NULL || *security == 0) {
+        config_perror("missing SECURITY parameter");
+        return;
+    }
+    if (strcasecmp(model, "v1") == 0)
+        imodel = SNMP_SEC_MODEL_SNMPv1;
+    else if (strcasecmp(model, "v2c") == 0)
+        imodel = SNMP_SEC_MODEL_SNMPv2c;
+    else if (strcasecmp(model, "any") == 0) {
+        config_perror
+            ("bad security model \"any\" should be: v1, v2c, usm or a registered security plugin name - installing anyway");
+        imodel = SNMP_SEC_MODEL_ANY;
+    } else {
+        if ((imodel = se_find_value_in_slist("snmp_secmods", model)) ==
+            SE_DNE) {
+            config_perror
+                ("bad security model, should be: v1, v2c or usm or a registered security plugin name");
+            return;
+        }
+    }
+    if (strlen(security) + 1 > sizeof(gp->groupName)) {
+        config_perror("security name too long");
+        return;
+    }
+    gp = vacm_createGroupEntry(imodel, security);
+    if (!gp) {
+        config_perror("failed to create group entry");
+        return;
+    }
+    strncpy(gp->groupName, group, sizeof(gp->groupName));
+    gp->groupName[ sizeof(gp->groupName)-1 ] = 0;
+    gp->storageType = SNMP_STORAGE_PERMANENT;
+    gp->status = SNMP_ROW_ACTIVE;
+    free(gp->reserved);
+    gp->reserved = NULL;
+}
+
+void
+vacm_free_group(void)
+{
+    vacm_destroyAllGroupEntries();
+}
+
+void
+vacm_parse_access(const char *token, char *param)
+{
+    char           *name, *context, *model, *level, *prefix, *readView,
+        *writeView, *notify;
+    int             imodel, ilevel, iprefix;
+    struct vacm_accessEntry *ap;
+
+    name = strtok(param, " \t\n");
+    if (!name) {
+        config_perror("missing NAME parameter");
+        return;
+    }
+    context = strtok(NULL, " \t\n");
+    if (!context) {
+        config_perror("missing CONTEXT parameter");
+        return;
+    }
+    model = strtok(NULL, " \t\n");
+    if (!model) {
+        config_perror("missing MODEL parameter");
+        return;
+    }
+    level = strtok(NULL, " \t\n");
+    if (!level) {
+        config_perror("missing LEVEL parameter");
+        return;
+    }
+    prefix = strtok(NULL, " \t\n");
+    if (!prefix) {
+        config_perror("missing PREFIX parameter");
+        return;
+    }
+    readView = strtok(NULL, " \t\n");
+    if (!readView) {
+        config_perror("missing readView parameter");
+        return;
+    }
+    writeView = strtok(NULL, " \t\n");
+    if (!writeView) {
+        config_perror("missing writeView parameter");
+        return;
+    }
+    notify = strtok(NULL, " \t\n");
+    if (!notify) {
+        config_perror("missing notifyView parameter");
+        return;
+    }
+    if (strcmp(context, "\"\"") == 0)
+        *context = 0;
+    if (strcasecmp(model, "any") == 0)
+        imodel = SNMP_SEC_MODEL_ANY;
+    else if (strcasecmp(model, "v1") == 0)
+        imodel = SNMP_SEC_MODEL_SNMPv1;
+    else if (strcasecmp(model, "v2c") == 0)
+        imodel = SNMP_SEC_MODEL_SNMPv2c;
+    else {
+        if ((imodel = se_find_value_in_slist("snmp_secmods", model)) ==
+            SE_DNE) {
+            config_perror
+                ("bad security model, should be: v1, v2c or usm or a registered security plugin name");
+            return;
+        }
+    }
+    if (strcasecmp(level, "noauth") == 0)
+        ilevel = SNMP_SEC_LEVEL_NOAUTH;
+    else if (strcasecmp(level, "noauthnopriv") == 0)
+        ilevel = SNMP_SEC_LEVEL_NOAUTH;
+    else if (strcasecmp(level, "auth") == 0)
+        ilevel = SNMP_SEC_LEVEL_AUTHNOPRIV;
+    else if (strcasecmp(level, "authnopriv") == 0)
+        ilevel = SNMP_SEC_LEVEL_AUTHNOPRIV;
+    else if (strcasecmp(level, "priv") == 0)
+        ilevel = SNMP_SEC_LEVEL_AUTHPRIV;
+    else if (strcasecmp(level, "authpriv") == 0)
+        ilevel = SNMP_SEC_LEVEL_AUTHPRIV;
+    else {
+        config_perror
+            ("bad security level (noauthnopriv, authnopriv, authpriv)");
+        return;
+    }
+    if (strcmp(prefix, "exact") == 0)
+        iprefix = 1;
+    else if (strcmp(prefix, "prefix") == 0)
+        iprefix = 2;
+    else if (strcmp(prefix, "0") == 0) {
+        config_perror
+            ("bad prefix match parameter \"0\", should be: exact or prefix - installing anyway");
+        iprefix = 1;
+    } else {
+        config_perror
+            ("bad prefix match parameter, should be: exact or prefix");
+        return;
+    }
+    if (strlen(readView) + 1 > sizeof(ap->readView)) {
+        config_perror("readView too long");
+        return;
+    }
+    if (strlen(writeView) + 1 > sizeof(ap->writeView)) {
+        config_perror("writeView too long");
+        return;
+    }
+    if (strlen(notify) + 1 > sizeof(ap->notifyView)) {
+        config_perror("notifyView too long");
+        return;
+    }
+    ap = vacm_createAccessEntry(name, context, imodel, ilevel);
+    if (!ap) {
+        config_perror("failed to create access entry");
+        return;
+    }
+    strcpy(ap->readView, readView);
+    strcpy(ap->writeView, writeView);
+    strcpy(ap->notifyView, notify);
+    ap->contextMatch = iprefix;
+    ap->storageType = SNMP_STORAGE_PERMANENT;
+    ap->status = SNMP_ROW_ACTIVE;
+    free(ap->reserved);
+    ap->reserved = NULL;
+}
+
+void
+vacm_free_access(void)
+{
+    vacm_destroyAllAccessEntries();
+}
+
+void
+vacm_parse_view(const char *token, char *param)
+{
+    char           *name, *type, *subtree, *mask;
+    int             inclexcl;
+    struct vacm_viewEntry *vp;
+    oid             suboid[MAX_OID_LEN];
+    size_t          suboid_len = 0;
+    u_char          viewMask[sizeof(vp->viewMask)];
+    int             i;
+
+    name = strtok(param, " \t\n");
+    if (!name) {
+        config_perror("missing NAME parameter");
+        return;
+    }
+    type = strtok(NULL, " \n\t");
+    if (!type) {
+        config_perror("missing TYPE parameter");
+        return;
+    }
+    subtree = strtok(NULL, " \t\n");
+    if (!subtree) {
+        config_perror("missing SUBTREE parameter");
+        return;
+    }
+    mask = strtok(NULL, " \t\n");
+
+    if (strcmp(type, "included") == 0)
+        inclexcl = SNMP_VIEW_INCLUDED;
+    else if (strcmp(type, "excluded") == 0)
+        inclexcl = SNMP_VIEW_EXCLUDED;
+    else {
+        config_perror("TYPE must be included/excluded?");
+        return;
+    }
+    suboid_len = MAX_OID_LEN;
+    if (!snmp_parse_oid(subtree, suboid, &suboid_len)) {
+        config_perror("bad SUBTREE object id");
+        return;
+    }
+    if (mask) {
+        int             val;
+        i = 0;
+        for (mask = strtok(mask, ".:"); mask; mask = strtok(NULL, ".:")) {
+            if (i >= sizeof(viewMask)) {
+                config_perror("MASK too long");
+                return;
+            }
+            if (sscanf(mask, "%x", &val) == 0) {
+                config_perror("invalid MASK");
+                return;
+            }
+            viewMask[i] = val;
+            i++;
+        }
+    } else {
+        for (i = 0; i < sizeof(viewMask); i++)
+            viewMask[i] = 0xff;
+    }
+    vp = vacm_createViewEntry(name, suboid, suboid_len);
+    if (!vp) {
+        config_perror("failed to create view entry");
+        return;
+    }
+    memcpy(vp->viewMask, viewMask, sizeof(viewMask));
+    vp->viewType = inclexcl;
+    vp->viewStorageType = SNMP_STORAGE_PERMANENT;
+    vp->viewStatus = SNMP_ROW_ACTIVE;
+    free(vp->reserved);
+    vp->reserved = NULL;
+}
+
+void
+vacm_free_view(void)
+{
+    vacm_destroyAllViewEntries();
+}
+
+void
+vacm_parse_simple(const char *token, char *confline)
+{
+    char            line[SPRINT_MAX_LEN];
+    char            community[COMMUNITY_MAX_LEN];
+    char            theoid[SPRINT_MAX_LEN];
+    char            viewname[SPRINT_MAX_LEN];
+    char            addressname[SPRINT_MAX_LEN];
+    const char     *rw = "none";
+    char            model[SPRINT_MAX_LEN];
+    char           *cp;
+    static int      num = 0;
+    char            secname[SPRINT_MAX_LEN];
+    char            authtype[SPRINT_MAX_LEN];
+
+    /*
+     * init 
+     */
+    strcpy(model, "any");
+
+    /*
+     * community name or user name 
+     */
+    cp = copy_nword(confline, community, sizeof(community));
+
+    if (strcmp(token, "rouser") == 0 || strcmp(token, "rwuser") == 0) {
+        /*
+         * maybe security model type 
+         */
+        if (strcmp(community, "-s") == 0) {
+            /*
+             * -s model ... 
+             */
+            if (cp)
+                cp = copy_nword(cp, model, sizeof(authtype));
+            if (!cp) {
+                config_perror("illegal line");
+                return;
+            }
+            if (cp)
+                cp = copy_nword(cp, community, sizeof(community));
+        } else {
+            strcpy(model, "usm");
+        }
+        /*
+         * authentication type 
+         */
+        if (cp && *cp)
+            cp = copy_nword(cp, authtype, sizeof(authtype));
+        else
+            strcpy(authtype, "auth");
+        DEBUGMSGTL((token, "setting auth type: \"%s\"\n", authtype));
+    } else {
+        /*
+         * source address 
+         */
+        if (cp && *cp) {
+            cp = copy_nword(cp, addressname, sizeof(addressname));
+        } else {
+            strcpy(addressname, "default");
+        }
+        /*
+         * authtype has to be noauth 
+         */
+        strcpy(authtype, "noauth");
+    }
+
+    /*
+     * oid they can touch 
+     */
+    if (cp && *cp) {
+        cp = copy_nword(cp, theoid, sizeof(theoid));
+    } else {
+        strcpy(theoid, ".1");
+    }
+
+    if (strcmp(token, "rwcommunity") == 0 || strcmp(token, "rwuser") == 0)
+        rw = viewname;
+#ifdef SNMP_TRANSPORT_UDPIPV6_DOMAIN
+    if (strcmp(token, "rwcommunity6") == 0)
+        rw = viewname;
+#endif
+
+    if (strcmp(token, "rwcommunity") == 0
+        || strcmp(token, "rocommunity") == 0) {
+        /*
+         * com2sec mapping 
+         */
+        /*
+         * com2sec anonymousSecNameNUM    ADDRESS  COMMUNITY 
+         */
+        sprintf(secname, "anonymousSecName%03d", num);
+        snprintf(line, sizeof(line), "%s %s %s",
+                 secname, addressname, community);
+        line[ sizeof(line)-1 ] = 0;
+        DEBUGMSGTL((token, "passing: %s %s\n", "com2sec", line));
+        netsnmp_udp_parse_security("com2sec", line);
+
+        /*
+         * sec->group mapping 
+         */
+        /*
+         * group   anonymousGroupNameNUM  any      anonymousSecNameNUM 
+         */
+        snprintf(line, sizeof(line),
+                 "anonymousGroupName%03d v1 %s", num, secname);
+        line[ sizeof(line)-1 ] = 0;
+        DEBUGMSGTL((token, "passing: %s %s\n", "group", line));
+        vacm_parse_group("group", line);
+        snprintf(line, sizeof(line),
+                 "anonymousGroupName%03d v2c %s", num, secname);
+        line[ sizeof(line)-1 ] = 0;
+        DEBUGMSGTL((token, "passing: %s %s\n", "group", line));
+        vacm_parse_group("group", line);
+#ifdef SNMP_TRANSPORT_UDPIPV6_DOMAIN
+    } else if (strcmp(token, "rwcommunity6") == 0
+               || strcmp(token, "rocommunity6") == 0) {
+        /*
+         * com2sec6 mapping 
+         */
+        /*
+         * com2sec6 anonymousSecNameNUM    ADDRESS  COMMUNITY 
+         */
+        sprintf(secname, "anonymousSecName%03d", num);
+        snprintf(line, sizeof(line), "%s %s %s",
+                 secname, addressname, community);
+        line[ sizeof(line)-1 ] = 0;
+        DEBUGMSGTL((token, "passing: %s %s\n", "com2sec6", line));
+        netsnmp_udp6_parse_security("com2sec6", line);
+
+        /*
+         * sec->group mapping 
+         */
+        /*
+         * group   anonymousGroupNameNUM  any      anonymousSecNameNUM 
+         */
+        snprintf(line, sizeof(line),
+                 "anonymousGroupName%03d v1 %s", num, secname);
+        line[ sizeof(line)-1 ] = 0;
+        DEBUGMSGTL((token, "passing: %s %s\n", "group", line));
+        vacm_parse_group("group", line);
+        snprintf(line, sizeof(line),
+                 "anonymousGroupName%03d v2c %s", num, secname);
+        line[ sizeof(line)-1 ] = 0;
+        DEBUGMSGTL((token, "passing: %s %s\n", "group", line));
+        vacm_parse_group("group", line);
+#endif
+    } else {
+        strncpy(secname, community, sizeof(secname));
+        secname[ sizeof(secname)-1 ] = 0;
+
+        /*
+         * sec->group mapping 
+         */
+        /*
+         * group   anonymousGroupNameNUM  any      anonymousSecNameNUM 
+         */
+        snprintf(line, sizeof(line),
+                 "anonymousGroupName%03d %s %s", num, model, secname);
+        line[ sizeof(line)-1 ] = 0;
+        DEBUGMSGTL((token, "passing: %s %s\n", "group", line));
+        vacm_parse_group("group", line);
+    }
+
+    /*
+     * view definition 
+     */
+    /*
+     * view    anonymousViewNUM       included OID 
+     */
+    sprintf(viewname, "anonymousView%03d", num);
+    snprintf(line, sizeof(line), "%s included %s", viewname, theoid);
+    line[ sizeof(line)-1 ] = 0;
+    DEBUGMSGTL((token, "passing: %s %s\n", "view", line));
+    vacm_parse_view("view", line);
+
+    /*
+     * map everything together 
+     */
+    /*
+     * access  anonymousGroupNameNUM  "" MODEL AUTHTYPE prefix anonymousViewNUM [none/anonymousViewNUM] [none/anonymousViewNUM] 
+     */
+    snprintf(line, sizeof(line),
+            "anonymousGroupName%03d  \"\" %s %s prefix %s %s %s",
+            num, model, authtype, viewname, rw, rw);
+    line[ sizeof(line)-1 ] = 0;
+    DEBUGMSGTL((token, "passing: %s %s\n", "access", line));
+    vacm_parse_access("access", line);
+    num++;
+}
+
+int
+vacm_warn_if_not_configured(int majorID, int minorID, void *serverarg,
+                            void *clientarg)
+{
+    const char * name = netsnmp_ds_get_string(NETSNMP_DS_LIBRARY_ID, 
+                                        NETSNMP_DS_LIB_APPTYPE);
+    if (NULL==name)
+        name = "snmpd";
+    
+    if (!vacm_is_configured()) {
+        snmp_log(LOG_WARNING,
+                 "Warning: no access control information configured.\n  It's "
+                 "unlikely this agent can serve any useful purpose in this "
+                 "state.\n  Run \"snmpconf -g basic_setup\" to help you "
+                 "configure the %s.conf file for this agent.\n", name );
+    }
+    return SNMP_ERR_NOERROR;
+}
+
+int
+vacm_in_view_callback(int majorID, int minorID, void *serverarg,
+                      void *clientarg)
+{
+    struct view_parameters *view_parms =
+        (struct view_parameters *) serverarg;
+    int             retval;
+
+    if (view_parms == NULL)
+        return 1;
+    retval = vacm_in_view(view_parms->pdu, view_parms->name,
+                          view_parms->namelen, view_parms->check_subtree);
+    if (retval != 0)
+        view_parms->errorcode = retval;
+    return retval;
+}
+
+
+/*******************************************************************-o-******
+ * vacm_in_view
+ *
+ * Parameters:
+ *	*pdu
+ *	*name
+ *	 namelen
+ *       check_subtree
+ *      
+ * Returns:
+ *	0	On success.
+ *	1	Missing security name.
+ *	2	Missing group
+ *	3	Missing access
+ *	4	Missing view
+ *	5	Not in view
+ *      6       No Such Context
+ *      7       When testing an entire subtree, UNKNOWN (ie, the entire
+ *              subtree has both allowed and disallowed portions)
+ *
+ * Debug output listed as follows:
+ *	<securityName> <groupName> <viewName> <viewType>
+ */
+int
+vacm_in_view(netsnmp_pdu *pdu, oid * name, size_t namelen,
+             int check_subtree)
+{
+    struct vacm_accessEntry *ap;
+    struct vacm_groupEntry *gp;
+    struct vacm_viewEntry *vp;
+    char           *vn;
+    char           *sn = NULL;
+    /*
+     * len defined by the vacmContextName object 
+     */
+#define CONTEXTNAMEINDEXLEN 32
+    char            contextNameIndex[CONTEXTNAMEINDEXLEN + 1];
+
+    if (pdu->version == SNMP_VERSION_1 || pdu->version == SNMP_VERSION_2c) {
+        if (snmp_get_do_debugging()) {
+            char           *buf;
+            if (pdu->community) {
+                buf = (char *) malloc(1 + pdu->community_len);
+                memcpy(buf, pdu->community, pdu->community_len);
+                buf[pdu->community_len] = '\0';
+            } else {
+                DEBUGMSGTL(("mibII/vacm_vars", "NULL community"));
+                buf = strdup("NULL");
+            }
+
+            DEBUGMSGTL(("mibII/vacm_vars",
+                        "vacm_in_view: ver=%d, community=%s\n",
+                        pdu->version, buf));
+            free(buf);
+        }
+
+        /*
+         * Okay, if this PDU was received from a UDP or a TCP transport then
+         * ask the transport abstraction layer to map its source address and
+         * community string to a security name for us.  
+         */
+
+        if (pdu->tDomain == netsnmpUDPDomain
+#if SNMP_TRANSPORT_TCP_DOMAIN
+            || pdu->tDomain == netsnmp_snmpTCPDomain
+#endif
+            ) {
+            if (!netsnmp_udp_getSecName(pdu->transport_data,
+                                        pdu->transport_data_length,
+                                        (char *) pdu->community,
+                                        pdu->community_len, &sn)) {
+                /*
+                 * There are no com2sec entries.  
+                 */
+                sn = NULL;
+            }
+#ifdef SNMP_TRANSPORT_UDPIPV6_DOMAIN
+        } else if (pdu->tDomain == netsnmp_UDPIPv6Domain
+#ifdef SNMP_TRANSPORT_TCPIPV6_DOMAIN
+                   || pdu->tDomain == netsnmp_TCPIPv6Domain
+#endif
+            ) {
+            if (!netsnmp_udp6_getSecName(pdu->transport_data,
+                                         pdu->transport_data_length,
+                                         (char *) pdu->community,
+                                         pdu->community_len, &sn)
+                && !vacm_is_configured()) {
+                /*
+                 * There are no com2sec entries.  
+                 */
+                DEBUGMSGTL(("mibII/vacm_vars",
+                            "vacm_in_view: accepted with no com2sec entries\n"));
+                switch (pdu->command) {
+                case SNMP_MSG_GET:
+                case SNMP_MSG_GETNEXT:
+                case SNMP_MSG_GETBULK:
+                    return 0;
+                default:
+                    return 1;
+                }
+            }
+#endif
+        } else {
+            /*
+             * Map other <community, transport-address> pairs to security names
+             * here.  For now just let non-IPv4 transport always succeed.
+             * 
+             * WHAAAATTTT.  No, we don't let non-IPv4 transports
+             * succeed!  You must fix this to make it usable, sorry.
+             * From a security standpoint this is insane. -- Wes
+             */
+            /** @todo alternate com2sec mappings for non v4 transports.
+                Should be implemented via registration */
+            sn = NULL;
+        }
+
+    } else if (find_sec_mod(pdu->securityModel)) {
+        /*
+         * any legal defined v3 security model 
+         */
+        DEBUGMSG(("mibII/vacm_vars",
+                  "vacm_in_view: ver=%d, model=%d, secName=%s\n",
+                  pdu->version, pdu->securityModel, pdu->securityName));
+        sn = pdu->securityName;
+    } else {
+        sn = NULL;
+    }
+
+    if (sn == NULL) {
+        snmp_increment_statistic(STAT_SNMPINBADCOMMUNITYNAMES);
+        return 1;
+    }
+
+    if (pdu->contextNameLen > CONTEXTNAMEINDEXLEN) {
+        DEBUGMSGTL(("mibII/vacm_vars",
+                    "vacm_in_view: bad ctxt length %d\n",
+                    pdu->contextNameLen));
+        return 6;
+    }
+    /*
+     * NULL termination of the pdu field is ugly here.  Do in PDU parsing? 
+     */
+    if (pdu->contextName)
+        strncpy(contextNameIndex, pdu->contextName, pdu->contextNameLen);
+    else
+        contextNameIndex[0] = '\0';
+
+    contextNameIndex[pdu->contextNameLen] = '\0';
+    if (!netsnmp_subtree_find_first(contextNameIndex)) {
+        /*
+         * rfc2575 section 3.2, step 1
+         * no such context here; return no such context error 
+         */
+        DEBUGMSGTL(("mibII/vacm_vars", "vacm_in_view: no such ctxt \"%s\"\n",
+                    contextNameIndex));
+        return 6;
+    }
+
+    DEBUGMSGTL(("mibII/vacm_vars", "vacm_in_view: sn=%s", sn));
+
+    gp = vacm_getGroupEntry(pdu->securityModel, sn);
+    if (gp == NULL) {
+        DEBUGMSG(("mibII/vacm_vars", "\n"));
+        return 2;
+    }
+    DEBUGMSG(("mibII/vacm_vars", ", gn=%s", gp->groupName));
+
+    ap = vacm_getAccessEntry(gp->groupName, contextNameIndex,
+                             pdu->securityModel, pdu->securityLevel);
+    if (ap == NULL) {
+        DEBUGMSG(("mibII/vacm_vars", "\n"));
+        return 3;
+    }
+
+    if (name == 0) {            /* only check the setup of the vacm for the request */
+        DEBUGMSG(("mibII/vacm_vars", ", Done checking setup\n"));
+        return 0;
+    }
+
+    switch (pdu->command) {
+    case SNMP_MSG_GET:
+    case SNMP_MSG_GETNEXT:
+    case SNMP_MSG_GETBULK:
+        vn = ap->readView;
+        break;
+    case SNMP_MSG_SET:
+        vn = ap->writeView;
+        break;
+    case SNMP_MSG_TRAP:
+    case SNMP_MSG_TRAP2:
+    case SNMP_MSG_INFORM:
+        vn = ap->notifyView;
+        break;
+    default:
+        snmp_log(LOG_ERR, "bad msg type in vacm_in_view: %d\n",
+                 pdu->command);
+        vn = ap->readView;
+    }
+    DEBUGMSG(("mibII/vacm_vars", ", vn=%s", vn));
+
+    if (check_subtree) {
+        DEBUGMSG(("mibII/vacm_vars", "\n"));
+        return vacm_checkSubtree(vn, name, namelen);
+    }
+
+    vp = vacm_getViewEntry(vn, name, namelen, VACM_MODE_FIND);
+
+    if (vp == NULL) {
+        DEBUGMSG(("mibII/vacm_vars", "\n"));
+        return 4;
+    }
+    DEBUGMSG(("mibII/vacm_vars", ", vt=%d\n", vp->viewType));
+
+    if (vp->viewType == SNMP_VIEW_EXCLUDED) {
+        if (pdu->version == SNMP_VERSION_1
+            || pdu->version == SNMP_VERSION_2c) {
+            snmp_increment_statistic(STAT_SNMPINBADCOMMUNITYUSES);
+        }
+        return 5;
+    }
+
+    return 0;
+
+}                               /* end vacm_in_view() */
+
+
+u_char         *
+var_vacm_sec2group(struct variable * vp,
+                   oid * name,
+                   size_t * length,
+                   int exact,
+                   size_t * var_len, WriteMethod ** write_method)
+{
+    struct vacm_groupEntry *gp;
+    oid            *groupSubtree;
+    int             groupSubtreeLen;
+    int             secmodel;
+    char            secname[VACMSTRINGLEN], *cp;
+
+    /*
+     * Set up write_method first, in case we return NULL before getting to
+     * the switch (vp->magic) below.  In some of these cases, we still want
+     * to call the appropriate write_method, if only to have it return the
+     * appropriate error.  
+     */
+
+    switch (vp->magic) {
+    case SECURITYGROUP:
+        *write_method = write_vacmGroupName;
+        break;
+    case SECURITYSTORAGE:
+        *write_method = write_vacmSecurityToGroupStorageType;
+        break;
+    case SECURITYSTATUS:
+        *write_method = write_vacmSecurityToGroupStatus;
+        break;
+    default:
+        *write_method = NULL;
+    }
+
+    if (memcmp(name, vp->name, sizeof(oid) * vp->namelen) != 0) {
+        memcpy(name, vp->name, sizeof(oid) * vp->namelen);
+        *length = vp->namelen;
+    }
+    if (exact) {
+        if (*length < 13)
+            return NULL;
+
+        secmodel = name[11];
+        groupSubtree = name + 13;
+        groupSubtreeLen = *length - 13;
+        cp = secname;
+        while (groupSubtreeLen-- > 0) {
+            if (*groupSubtree > 255)
+                return 0;       /* illegal value */
+            if (cp - secname > VACM_MAX_STRING)
+                return 0;
+            *cp++ = (char) *groupSubtree++;
+        }
+        *cp = 0;
+
+        gp = vacm_getGroupEntry(secmodel, secname);
+    } else {
+        secmodel = *length > 11 ? name[11] : 0;
+        groupSubtree = name + 12;
+        groupSubtreeLen = *length - 12;
+        cp = secname;
+        while (groupSubtreeLen-- > 0) {
+            if (*groupSubtree > 255)
+                return 0;       /* illegal value */
+            if (cp - secname > VACM_MAX_STRING)
+                return 0;
+            *cp++ = (char) *groupSubtree++;
+        }
+        *cp = 0;
+        vacm_scanGroupInit();
+        while ((gp = vacm_scanGroupNext()) != NULL) {
+            if (gp->securityModel > secmodel ||
+                (gp->securityModel == secmodel
+                 && strcmp(gp->securityName, secname) > 0))
+                break;
+        }
+        if (gp) {
+            name[11] = gp->securityModel;
+            *length = 12;
+            cp = gp->securityName;
+            while (*cp) {
+                name[(*length)++] = *cp++;
+            }
+        }
+    }
+
+    if (gp == NULL) {
+        return NULL;
+    }
+
+    *var_len = sizeof(long_return);
+    switch (vp->magic) {
+    case SECURITYMODEL:
+        long_return = gp->securityModel;
+        return (u_char *) & long_return;
+
+    case SECURITYNAME:
+        *var_len = gp->securityName[0];
+        return (u_char *) & gp->securityName[1];
+
+    case SECURITYGROUP:
+        *var_len = strlen(gp->groupName);
+        return (u_char *) gp->groupName;
+
+    case SECURITYSTORAGE:
+        long_return = gp->storageType;
+        return (u_char *) & long_return;
+
+    case SECURITYSTATUS:
+        long_return = gp->status;
+        return (u_char *) & long_return;
+
+    default:
+        break;
+    }
+    return NULL;
+}
+
+u_char         *
+var_vacm_access(struct variable * vp,
+                oid * name,
+                size_t * length,
+                int exact, size_t * var_len, WriteMethod ** write_method)
+{
+    struct vacm_accessEntry *gp;
+    int             secmodel, seclevel;
+    char            groupName[VACMSTRINGLEN] = { 0 };
+    char            contextPrefix[VACMSTRINGLEN] = { 0 };
+    oid            *op;
+    unsigned long   len, i = 0;
+    char           *cp;
+    int             cmp;
+
+    /*
+     * Set up write_method first, in case we return NULL before getting to
+     * the switch (vp->magic) below.  In some of these cases, we still want
+     * to call the appropriate write_method, if only to have it return the
+     * appropriate error.  
+     */
+
+    switch (vp->magic) {
+    case ACCESSMATCH:
+        *write_method = write_vacmAccessContextMatch;
+        break;
+    case ACCESSREAD:
+        *write_method = write_vacmAccessReadViewName;
+        break;
+    case ACCESSWRITE:
+        *write_method = write_vacmAccessWriteViewName;
+        break;
+    case ACCESSNOTIFY:
+        *write_method = write_vacmAccessNotifyViewName;
+        break;
+    case ACCESSSTORAGE:
+        *write_method = write_vacmAccessStorageType;
+        break;
+    case ACCESSSTATUS:
+        *write_method = write_vacmAccessStatus;
+        break;
+    default:
+        *write_method = NULL;
+    }
+
+    if (memcmp(name, vp->name, sizeof(oid) * vp->namelen) != 0) {
+        memcpy(name, vp->name, sizeof(oid) * vp->namelen);
+        *length = vp->namelen;
+    }
+
+    if (exact) {
+        if (*length < 15)
+            return NULL;
+
+        op = name + 11;
+        len = *op++;
+        if (len > VACM_MAX_STRING)
+            return 0;
+        cp = groupName;
+        while (len-- > 0) {
+            if (*op > 255)
+                return 0;       /* illegal value */
+            *cp++ = (char) *op++;
+        }
+        *cp = 0;
+        len = *op++;
+        if (len > VACM_MAX_STRING)
+            return 0;
+        cp = contextPrefix;
+        while (len-- > 0) {
+            if (*op > 255)
+                return 0;       /* illegal value */
+            *cp++ = (char) *op++;
+        }
+        *cp = 0;
+        secmodel = *op++;
+        seclevel = *op++;
+        if (op != name + *length) {
+            return NULL;
+        }
+
+        gp = vacm_getAccessEntry(groupName, contextPrefix, secmodel,
+                                 seclevel);
+    } else {
+        secmodel = seclevel = 0;
+        groupName[0] = 0;
+        contextPrefix[0] = 0;
+        op = name + 11;
+        if (op >= name + *length) {
+        } else {
+            len = *op;
+            if (len > VACM_MAX_STRING)
+                return 0;
+            cp = groupName;
+            for (i = 0; i <= len; i++) {
+                if (*op > 255) {
+                    return 0;   /* illegal value */
+                }
+                *cp++ = (char) *op++;
+            }
+            *cp = 0;
+        }
+        if (op >= name + *length) {
+        } else {
+            len = *op;
+            if (len > VACM_MAX_STRING)
+                return 0;
+            cp = contextPrefix;
+            for (i = 0; i <= len; i++) {
+                if (*op > 255) {
+                    return 0;   /* illegal value */
+                }
+                *cp++ = (char) *op++;
+            }
+            *cp = 0;
+        }
+        if (op >= name + *length) {
+        } else {
+            secmodel = *op++;
+        }
+        if (op >= name + *length) {
+        } else {
+            seclevel = *op++;
+        }
+        vacm_scanAccessInit();
+        while ((gp = vacm_scanAccessNext()) != NULL) {
+            cmp = strcmp(gp->groupName, groupName);
+            if (cmp > 0)
+                break;
+            if (cmp < 0)
+                continue;
+            cmp = strcmp(gp->contextPrefix, contextPrefix);
+            if (cmp > 0)
+                break;
+            if (cmp < 0)
+                continue;
+            if (gp->securityModel > secmodel)
+                break;
+            if (gp->securityModel < secmodel)
+                continue;
+            if (gp->securityLevel > seclevel)
+                break;
+        }
+        if (gp) {
+            *length = 11;
+            cp = gp->groupName;
+            do {
+                name[(*length)++] = *cp++;
+            } while (*cp);
+            cp = gp->contextPrefix;
+            do {
+                name[(*length)++] = *cp++;
+            } while (*cp);
+            name[(*length)++] = gp->securityModel;
+            name[(*length)++] = gp->securityLevel;
+        }
+    }
+
+    if (!gp) {
+        return NULL;
+    }
+
+    *var_len = sizeof(long_return);
+    switch (vp->magic) {
+    case ACCESSMATCH:
+        long_return = gp->contextMatch;
+        return (u_char *) & long_return;
+
+    case ACCESSLEVEL:
+        long_return = gp->securityLevel;
+        return (u_char *) & long_return;
+
+    case ACCESSMODEL:
+        long_return = gp->securityModel;
+        return (u_char *) & long_return;
+
+    case ACCESSPREFIX:
+        *var_len = *gp->contextPrefix;
+        return (u_char *) & gp->contextPrefix[1];
+
+    case ACCESSREAD:
+        *var_len = strlen(gp->readView);
+        return (u_char *) gp->readView;
+
+    case ACCESSWRITE:
+        *var_len = strlen(gp->writeView);
+        return (u_char *) gp->writeView;
+
+    case ACCESSNOTIFY:
+        *var_len = strlen(gp->notifyView);
+        return (u_char *) gp->notifyView;
+
+    case ACCESSSTORAGE:
+        long_return = gp->storageType;
+        return (u_char *) & long_return;
+
+    case ACCESSSTATUS:
+        long_return = gp->status;
+        return (u_char *) & long_return;
+    }
+    return NULL;
+}
+
+u_char         *
+var_vacm_view(struct variable * vp,
+              oid * name,
+              size_t * length,
+              int exact, size_t * var_len, WriteMethod ** write_method)
+{
+    struct vacm_viewEntry *gp = NULL;
+    char            viewName[VACMSTRINGLEN] = { 0 };
+    oid             subtree[MAX_OID_LEN] = { 0 };
+    size_t          subtreeLen = 0;
+    oid            *op, *op1;
+    unsigned long   len = 0, i = 0;
+    char           *cp;
+    int             cmp, cmp2;
+
+    /*
+     * Set up write_method first, in case we return NULL before getting to
+     * the switch (vp->magic) below.  In some of these cases, we still want
+     * to call the appropriate write_method, if only to have it return the
+     * appropriate error.  
+     */
+
+    switch (vp->magic) {
+    case VIEWMASK:
+        *write_method = write_vacmViewMask;
+        break;
+    case VIEWTYPE:
+        *write_method = write_vacmViewType;
+        break;
+    case VIEWSTORAGE:
+        *write_method = write_vacmViewStorageType;
+        break;
+    case VIEWSTATUS:
+        *write_method = write_vacmViewStatus;
+        break;
+    default:
+        *write_method = NULL;
+    }
+
+    *var_len = sizeof(long_return);
+    if (vp->magic != VACMVIEWSPINLOCK) {
+        if (memcmp(name, vp->name, sizeof(oid) * vp->namelen) != 0) {
+            memcpy(name, vp->name, sizeof(oid) * vp->namelen);
+            *length = vp->namelen;
+        }
+
+        if (exact) {
+            if (*length < 15)
+                return NULL;
+
+            op = name + 12;
+            len = *op++;
+            if (len > VACM_MAX_STRING)
+                return 0;
+            cp = viewName;
+            while (len-- > 0) {
+                if (*op > 255)
+                    return 0;
+                *cp++ = (char) *op++;
+            }
+            *cp = 0;
+            subtree[0] = len = *op++;
+            subtreeLen = 1;
+            if (len > MAX_OID_LEN)
+                return 0;
+            op1 = &(subtree[1]);
+            while (len-- > 0) {
+                *op1++ = (op != name + *length) ? *op++ : 0;
+                subtreeLen++;
+            }
+            if (op != name + *length) {
+                return NULL;
+            }
+
+            gp = vacm_getViewEntry(viewName, subtree, subtreeLen,
+                                   VACM_MODE_IGNORE_MASK);
+            if (gp != NULL) {
+                if (gp->viewSubtreeLen != subtreeLen) {
+                    gp = NULL;
+                }
+            }
+        } else {
+            viewName[0] = 0;
+            op = name + 12;
+            if (op >= name + *length) {
+            } else {
+                len = *op;
+                if (len > VACM_MAX_STRING)
+                    return 0;
+                cp = viewName;
+                for (i = 0; i <= len && op < name + *length; i++) {
+                    if (*op > 255) {
+                        return 0;
+                    }
+                    *cp++ = (char) *op++;
+                }
+                *cp = 0;
+            }
+            if (op >= name + *length) {
+            } else {
+                len = *op++;
+                op1 = subtree;
+                *op1++ = len;
+                subtreeLen++;
+                for (i = 0; i <= len && op < name + *length; i++) {
+                    *op1++ = *op++;
+                    subtreeLen++;
+                }
+            }
+            vacm_scanViewInit();
+            while ((gp = vacm_scanViewNext()) != NULL) {
+                cmp = strcmp(gp->viewName, viewName);
+                cmp2 =
+                    snmp_oid_compare(gp->viewSubtree, gp->viewSubtreeLen,
+                                     subtree, subtreeLen);
+                if (cmp == 0 && cmp2 > 0)
+                    break;
+                if (cmp > 0)
+                    break;
+            }
+            if (gp) {
+                *length = 12;
+                cp = gp->viewName;
+                do {
+                    name[(*length)++] = *cp++;
+                } while (*cp);
+                op1 = gp->viewSubtree;
+                len = gp->viewSubtreeLen;
+                while (len-- > 0) {
+                    name[(*length)++] = *op1++;
+                }
+            }
+        }
+
+        if (gp == NULL) {
+            return NULL;
+        }
+    } else {
+        if (header_generic(vp, name, length, exact, var_len, write_method)) {
+            return NULL;
+        }
+    }                           /*endif -- vp->magic != VACMVIEWSPINLOCK */
+
+    switch (vp->magic) {
+    case VACMVIEWSPINLOCK:
+        *write_method = write_vacmViewSpinLock;
+        long_return = vacmViewSpinLock;
+        return (u_char *) & long_return;
+
+    case VIEWNAME:
+        *var_len = gp->viewName[0];
+        return (u_char *) & gp->viewName[1];
+
+    case VIEWSUBTREE:
+        *var_len = gp->viewSubtreeLen * sizeof(oid);
+        return (u_char *) gp->viewSubtree;
+
+    case VIEWMASK:
+        *var_len = (gp->viewSubtreeLen + 7) / 8;
+        return (u_char *) gp->viewMask;
+
+    case VIEWTYPE:
+        long_return = gp->viewType;
+        return (u_char *) & long_return;
+
+    case VIEWSTORAGE:
+        long_return = gp->viewStorageType;
+        return (u_char *) & long_return;
+
+    case VIEWSTATUS:
+        long_return = gp->viewStatus;
+        return (u_char *) & long_return;
+    }
+    return NULL;
+}
+
+oid            *
+sec2group_generate_OID(oid * prefix, size_t prefixLen,
+                       struct vacm_groupEntry * geptr, size_t * length)
+{
+    oid            *indexOid;
+    int             i, securityNameLen;
+
+    securityNameLen = strlen(geptr->securityName);
+
+    *length = 2 + securityNameLen + prefixLen;
+    indexOid = (oid *) malloc(*length * sizeof(oid));
+    if (indexOid) {
+        memmove(indexOid, prefix, prefixLen * sizeof(oid));
+
+        indexOid[prefixLen] = geptr->securityModel;
+
+        indexOid[prefixLen + 1] = securityNameLen;
+        for (i = 0; i < securityNameLen; i++)
+            indexOid[prefixLen + 2 + i] = (oid) geptr->securityName[i];
+
+    }
+    return indexOid;
+
+}
+
+int
+sec2group_parse_oid(oid * oidIndex, size_t oidLen,
+                    int *model, unsigned char **name, size_t * nameLen)
+{
+    int             nameL;
+    int             i;
+
+    /*
+     * first check the validity of the oid 
+     */
+    if ((oidLen <= 0) || (!oidIndex)) {
+        return 1;
+    }
+    nameL = oidIndex[1];        /* the initial name length */
+    if ((int) oidLen != nameL + 2) {
+        return 1;
+    }
+
+    /*
+     * its valid, malloc the space and store the results 
+     */
+    if (name == NULL) {
+        return 1;
+    }
+
+    *name = (unsigned char *) malloc(nameL + 1);
+    if (*name == NULL) {
+        return 1;
+    }
+
+    *model = oidIndex[0];
+    *nameLen = nameL;
+
+
+    for (i = 0; i < nameL; i++) {
+        if (oidIndex[i + 2] > 255) {
+            free(*name);
+            return 1;
+        }
+        name[0][i] = (unsigned char) oidIndex[i + 2];
+    }
+    name[0][nameL] = 0;
+
+    return 0;
+
+}
+
+struct vacm_groupEntry *
+sec2group_parse_groupEntry(oid * name, size_t name_len)
+{
+    struct vacm_groupEntry *geptr;
+
+    char           *newName;
+    int             model;
+    size_t          nameLen;
+
+    /*
+     * get the name and engineID out of the incoming oid 
+     */
+    if (sec2group_parse_oid
+        (&name[SEC2GROUP_MIB_LENGTH], name_len - SEC2GROUP_MIB_LENGTH,
+         &model, (u_char **) & newName, &nameLen))
+        return NULL;
+
+    /*
+     * Now see if a user exists with these index values 
+     */
+    geptr = vacm_getGroupEntry(model, newName);
+    free(newName);
+
+    return geptr;
+
+}                               /* end vacm_parse_groupEntry() */
+
+int
+write_vacmGroupName(int action,
+                    u_char * var_val,
+                    u_char var_val_type,
+                    size_t var_val_len,
+                    u_char * statP, oid * name, size_t name_len)
+{
+    static unsigned char string[VACMSTRINGLEN];
+    struct vacm_groupEntry *geptr;
+    static int      resetOnFail;
+
+    if (action == RESERVE1) {
+        resetOnFail = 0;
+        if (var_val_type != ASN_OCTET_STR) {
+            return SNMP_ERR_WRONGTYPE;
+        }
+        if (var_val_len < 1 || var_val_len > 32) {
+            return SNMP_ERR_WRONGLENGTH;
+        }
+    } else if (action == RESERVE2) {
+        if ((geptr = sec2group_parse_groupEntry(name, name_len)) == NULL) {
+            return SNMP_ERR_INCONSISTENTNAME;
+        } else {
+            resetOnFail = 1;
+            memcpy(string, geptr->groupName, VACMSTRINGLEN);
+            memcpy(geptr->groupName, var_val, var_val_len);
+            geptr->groupName[var_val_len] = 0;
+            if (geptr->status == RS_NOTREADY) {
+                geptr->status = RS_NOTINSERVICE;
+            }
+        }
+    } else if (action == FREE) {
+        /*
+         * Try to undo the SET here (abnormal usage of FREE clause)  
+         */
+        if ((geptr = sec2group_parse_groupEntry(name, name_len)) != NULL &&
+            resetOnFail) {
+            memcpy(geptr->groupName, string, VACMSTRINGLEN);
+        }
+    }
+    return SNMP_ERR_NOERROR;
+}
+
+int
+write_vacmSecurityToGroupStorageType(int action,
+                                     u_char * var_val,
+                                     u_char var_val_type,
+                                     size_t var_val_len,
+                                     u_char * statP,
+                                     oid * name, size_t name_len)
+{
+    /*
+     * variables we may use later 
+     */
+    static long     long_ret;
+    struct vacm_groupEntry *geptr;
+
+    if (var_val_type != ASN_INTEGER) {
+        return SNMP_ERR_WRONGTYPE;
+    }
+    if (var_val_len > sizeof(long_ret)) {
+        return SNMP_ERR_WRONGLENGTH;
+    }
+    if (action == COMMIT) {
+        /*
+         * don't allow creations here 
+         */
+        if ((geptr = sec2group_parse_groupEntry(name, name_len)) == NULL) {
+            return SNMP_ERR_NOSUCHNAME;
+        }
+        long_ret = *((long *) var_val);
+        if ((long_ret == ST_VOLATILE || long_ret == ST_NONVOLATILE) &&
+            (geptr->storageType == ST_VOLATILE ||
+             geptr->storageType == ST_NONVOLATILE)) {
+            geptr->storageType = long_ret;
+        } else if (long_ret == geptr->storageType) {
+            return SNMP_ERR_NOERROR;
+        } else {
+            return SNMP_ERR_INCONSISTENTVALUE;
+        }
+    }
+    return SNMP_ERR_NOERROR;
+}
+
+
+int
+write_vacmSecurityToGroupStatus(int action,
+                                u_char * var_val,
+                                u_char var_val_type,
+                                size_t var_val_len,
+                                u_char * statP,
+                                oid * name, size_t name_len)
+{
+    static long     long_ret;
+    int             model;
+    char           *newName;
+    size_t          nameLen;
+    struct vacm_groupEntry *geptr;
+
+    if (action == RESERVE1) {
+        if (var_val_type != ASN_INTEGER) {
+            return SNMP_ERR_WRONGTYPE;
+        }
+        if (var_val_len != sizeof(long_ret)) {
+            return SNMP_ERR_WRONGLENGTH;
+        }
+        long_ret = *((long *) var_val);
+        if (long_ret == RS_NOTREADY || long_ret < 1 || long_ret > 6) {
+            return SNMP_ERR_WRONGVALUE;
+        }
+
+        /*
+         * See if we can parse the oid for model/name first.  
+         */
+
+        if (sec2group_parse_oid(&name[SEC2GROUP_MIB_LENGTH],
+                                name_len - SEC2GROUP_MIB_LENGTH,
+                                &model, (u_char **) & newName, &nameLen)) {
+            return SNMP_ERR_INCONSISTENTNAME;
+        }
+
+        if (model < 1 || nameLen < 1 || nameLen > 32) {
+            free(newName);
+            return SNMP_ERR_NOCREATION;
+        }
+
+        /*
+         * Now see if a group already exists with these index values.  
+         */
+        geptr = vacm_getGroupEntry(model, newName);
+
+        if (geptr != NULL) {
+            if (long_ret == RS_CREATEANDGO || long_ret == RS_CREATEANDWAIT) {
+                free(newName);
+                long_ret = RS_NOTREADY;
+                return SNMP_ERR_INCONSISTENTVALUE;
+            }
+        } else {
+            if (long_ret == RS_ACTIVE || long_ret == RS_NOTINSERVICE) {
+                free(newName);
+                return SNMP_ERR_INCONSISTENTVALUE;
+            }
+            if (long_ret == RS_CREATEANDGO || long_ret == RS_CREATEANDWAIT) {
+
+                /*
+                 * Generate a new group entry.  
+                 */
+                if ((geptr =
+                     vacm_createGroupEntry(model, newName)) == NULL) {
+                    free(newName);
+                    return SNMP_ERR_GENERR;
+                }
+
+                /*
+                 * Set defaults.  
+                 */
+                geptr->storageType = ST_NONVOLATILE;
+                geptr->status = RS_NOTREADY;
+            }
+        }
+        free(newName);
+    } else if (action == ACTION) {
+        sec2group_parse_oid(&name[SEC2GROUP_MIB_LENGTH],
+                            name_len - SEC2GROUP_MIB_LENGTH,
+                            &model, (u_char **) & newName, &nameLen);
+
+        geptr = vacm_getGroupEntry(model, newName);
+
+        if (geptr != NULL) {
+            if (long_ret == RS_CREATEANDGO || long_ret == RS_ACTIVE) {
+                /*
+                 * Check that all the mandatory objects have been set by now,
+                 * otherwise return inconsistentValue.  
+                 */
+                if (geptr->groupName[0] == 0) {
+                    free(newName);
+                    return SNMP_ERR_INCONSISTENTVALUE;
+                }
+                geptr->status = RS_ACTIVE;
+            } else if (long_ret == RS_CREATEANDWAIT) {
+                if (geptr->groupName[0] != 0) {
+                    geptr->status = RS_NOTINSERVICE;
+                }
+            } else if (long_ret == RS_NOTINSERVICE) {
+                if (geptr->status == RS_ACTIVE) {
+                    geptr->status = RS_NOTINSERVICE;
+                } else if (geptr->status == RS_NOTREADY) {
+                    free(newName);
+                    return SNMP_ERR_INCONSISTENTVALUE;
+                }
+            }
+        }
+        free(newName);
+    } else if (action == COMMIT) {
+        sec2group_parse_oid(&name[SEC2GROUP_MIB_LENGTH],
+                            name_len - SEC2GROUP_MIB_LENGTH,
+                            &model, (u_char **) & newName, &nameLen);
+
+        geptr = vacm_getGroupEntry(model, newName);
+
+        if (geptr != NULL) {
+            if (long_ret == RS_DESTROY) {
+                vacm_destroyGroupEntry(model, newName);
+            }
+        }
+        free(newName);
+    } else if (action == UNDO) {
+        if (long_ret == RS_CREATEANDGO || long_ret == RS_CREATEANDWAIT) {
+            sec2group_parse_oid(&name[SEC2GROUP_MIB_LENGTH],
+                                name_len - SEC2GROUP_MIB_LENGTH,
+                                &model, (u_char **) & newName, &nameLen);
+
+            geptr = vacm_getGroupEntry(model, newName);
+
+            if (geptr != NULL) {
+                vacm_destroyGroupEntry(model, newName);
+            }
+            free(newName);
+        }
+    }
+
+    return SNMP_ERR_NOERROR;
+}
+
+oid            *
+access_generate_OID(oid * prefix, size_t prefixLen,
+                    struct vacm_accessEntry * aptr, size_t * length)
+{
+    oid            *indexOid;
+    int             i, groupNameLen, contextPrefixLen;
+
+    groupNameLen = strlen(aptr->groupName);
+    contextPrefixLen = strlen(aptr->contextPrefix);
+
+    *length = 4 + groupNameLen + contextPrefixLen + prefixLen;
+    indexOid = (oid *) malloc(*length * sizeof(oid));
+    if (indexOid) {
+        memmove(indexOid, prefix, prefixLen * sizeof(oid));
+
+        indexOid[prefixLen] = groupNameLen;
+        for (i = 0; i < groupNameLen; i++)
+            indexOid[groupNameLen + 1 + i] = (oid) aptr->groupName[i];
+
+        indexOid[prefixLen + groupNameLen + 1] = contextPrefixLen;
+        for (i = 0; i < contextPrefixLen; i++)
+            indexOid[prefixLen + groupNameLen + 2 + i] =
+                (oid) aptr->contextPrefix[i];
+
+        indexOid[prefixLen + groupNameLen + contextPrefixLen + 3] =
+            aptr->securityModel;
+        indexOid[prefixLen + groupNameLen + contextPrefixLen + 4] =
+            aptr->securityLevel;
+
+    }
+    return indexOid;
+
+}
+
+int
+access_parse_oid(oid * oidIndex, size_t oidLen,
+                 unsigned char **groupName, size_t * groupNameLen,
+                 unsigned char **contextPrefix, size_t * contextPrefixLen,
+                 int *model, int *level)
+{
+    int             groupNameL, contextPrefixL;
+    int             i;
+
+    /*
+     * first check the validity of the oid 
+     */
+    if ((oidLen <= 0) || (!oidIndex)) {
+        return 1;
+    }
+    groupNameL = oidIndex[0];
+    contextPrefixL = oidIndex[groupNameL + 1];  /* the initial name length */
+    if ((int) oidLen != groupNameL + contextPrefixL + 4) {
+        return 1;
+    }
+
+    /*
+     * its valid, malloc the space and store the results 
+     */
+    if (contextPrefix == NULL || groupName == NULL) {
+        return 1;
+    }
+
+    *groupName = (unsigned char *) malloc(groupNameL + 1);
+    if (*groupName == NULL) {
+        return 1;
+    }
+
+    *contextPrefix = (unsigned char *) malloc(contextPrefixL + 1);
+    if (*contextPrefix == NULL) {
+        free(*groupName);
+        return 1;
+    }
+
+    *contextPrefixLen = contextPrefixL;
+    *groupNameLen = groupNameL;
+
+    for (i = 0; i < groupNameL; i++) {
+        if (oidIndex[i + 1] > 255) {
+            free(*groupName);
+            free(*contextPrefix);
+            return 1;
+        }
+        groupName[0][i] = (unsigned char) oidIndex[i + 1];
+    }
+    groupName[0][groupNameL] = 0;
+
+
+    for (i = 0; i < contextPrefixL; i++) {
+        if (oidIndex[i + groupNameL + 2] > 255) {
+            free(*groupName);
+            free(*contextPrefix);
+            return 1;
+        }
+        contextPrefix[0][i] = (unsigned char) oidIndex[i + groupNameL + 2];
+    }
+    contextPrefix[0][contextPrefixL] = 0;
+
+    *model = oidIndex[groupNameL + contextPrefixL + 2];
+    *level = oidIndex[groupNameL + contextPrefixL + 3];
+
+    return 0;
+
+}
+
+struct vacm_accessEntry *
+access_parse_accessEntry(oid * name, size_t name_len)
+{
+    struct vacm_accessEntry *aptr;
+
+    char           *newGroupName;
+    char           *newContextPrefix;
+    int             model, level;
+    size_t          groupNameLen, contextPrefixLen;
+
+    /*
+     * get the name and engineID out of the incoming oid 
+     */
+    if (access_parse_oid
+        (&name[ACCESS_MIB_LENGTH], name_len - ACCESS_MIB_LENGTH,
+         (u_char **) & newGroupName, &groupNameLen,
+         (u_char **) & newContextPrefix, &contextPrefixLen, &model,
+         &level))
+        return NULL;
+
+    /*
+     * Now see if a user exists with these index values 
+     */
+    aptr =
+        vacm_getAccessEntry(newGroupName, newContextPrefix, model, level);
+    free(newContextPrefix);
+    free(newGroupName);
+
+    return aptr;
+
+}                               /* end vacm_parse_accessEntry() */
+
+int
+write_vacmAccessStatus(int action,
+                       u_char * var_val,
+                       u_char var_val_type,
+                       size_t var_val_len,
+                       u_char * statP, oid * name, size_t name_len)
+{
+    static long     long_ret;
+    int             model, level;
+    char           *newGroupName, *newContextPrefix;
+    size_t          groupNameLen, contextPrefixLen;
+    struct vacm_accessEntry *aptr = NULL;
+
+    if (action == RESERVE1) {
+        if (var_val_type != ASN_INTEGER) {
+            return SNMP_ERR_WRONGTYPE;
+        }
+        if (var_val_len != sizeof(long_ret)) {
+            return SNMP_ERR_WRONGLENGTH;
+        }
+        long_ret = *((long *) var_val);
+        if (long_ret == RS_NOTREADY || long_ret < 1 || long_ret > 6) {
+            return SNMP_ERR_WRONGVALUE;
+        }
+
+        /*
+         * See if we can parse the oid for model/name first.  
+         */
+        if (access_parse_oid(&name[ACCESS_MIB_LENGTH],
+                             name_len - ACCESS_MIB_LENGTH,
+                             (u_char **) & newGroupName, &groupNameLen,
+                             (u_char **) & newContextPrefix,
+                             &contextPrefixLen, &model, &level)) {
+            return SNMP_ERR_INCONSISTENTNAME;
+        }
+
+        if (model < 0 || groupNameLen < 1 || groupNameLen > 32 ||
+            contextPrefixLen > 32) {
+            free(newGroupName);
+            free(newContextPrefix);
+            return SNMP_ERR_NOCREATION;
+        }
+
+        /*
+         * Now see if a group already exists with these index values.  
+         */
+        aptr =
+            vacm_getAccessEntry(newGroupName, newContextPrefix, model,
+                                level);
+
+        if (aptr != NULL) {
+            if (long_ret == RS_CREATEANDGO || long_ret == RS_CREATEANDWAIT) {
+                free(newGroupName);
+                free(newContextPrefix);
+                return SNMP_ERR_INCONSISTENTVALUE;
+            }
+        } else {
+            if (long_ret == RS_ACTIVE || long_ret == RS_NOTINSERVICE) {
+                free(newGroupName);
+                free(newContextPrefix);
+                return SNMP_ERR_INCONSISTENTVALUE;
+            }
+            if (long_ret == RS_CREATEANDGO || long_ret == RS_CREATEANDWAIT) {
+                if ((aptr = vacm_createAccessEntry(newGroupName,
+                                                   newContextPrefix,
+                                                   model,
+                                                   level)) == NULL) {
+                    free(newGroupName);
+                    free(newContextPrefix);
+                    return SNMP_ERR_GENERR;
+                }
+
+                /*
+                 * Set defaults.  
+                 */
+                aptr->contextMatch = 1; /*  exact(1) is the DEFVAL  */
+                aptr->storageType = ST_NONVOLATILE;
+                aptr->status = RS_NOTREADY;
+            }
+        }
+        free(newGroupName);
+        free(newContextPrefix);
+    } else if (action == ACTION) {
+        access_parse_oid(&name[ACCESS_MIB_LENGTH],
+                         name_len - ACCESS_MIB_LENGTH,
+                         (u_char **) & newGroupName, &groupNameLen,
+                         (u_char **) & newContextPrefix, &contextPrefixLen,
+                         &model, &level);
+        aptr =
+            vacm_getAccessEntry(newGroupName, newContextPrefix, model,
+                                level);
+
+        if (aptr != NULL) {
+            if (long_ret == RS_CREATEANDGO || long_ret == RS_ACTIVE) {
+                aptr->status = RS_ACTIVE;
+            } else if (long_ret == RS_CREATEANDWAIT) {
+                aptr->status = RS_NOTINSERVICE;
+            } else if (long_ret == RS_NOTINSERVICE) {
+                if (aptr->status == RS_ACTIVE) {
+                    aptr->status = RS_NOTINSERVICE;
+                } else if (aptr->status == RS_NOTREADY) {
+                    free(newGroupName);
+                    free(newContextPrefix);
+                    return SNMP_ERR_INCONSISTENTVALUE;
+                }
+            }
+        }
+        free(newGroupName);
+        free(newContextPrefix);
+    } else if (action == COMMIT) {
+        access_parse_oid(&name[ACCESS_MIB_LENGTH],
+                         name_len - ACCESS_MIB_LENGTH,
+                         (u_char **) & newGroupName, &groupNameLen,
+                         (u_char **) & newContextPrefix, &contextPrefixLen,
+                         &model, &level);
+        aptr =
+            vacm_getAccessEntry(newGroupName, newContextPrefix, model,
+                                level);
+
+        if (aptr) {
+            if (long_ret == RS_DESTROY) {
+                vacm_destroyAccessEntry(newGroupName, newContextPrefix,
+                                        model, level);
+            }
+        }
+        free(newGroupName);
+        free(newContextPrefix);
+    } else if (action == UNDO) {
+        if (long_ret == RS_CREATEANDGO || long_ret == RS_CREATEANDWAIT) {
+            access_parse_oid(&name[ACCESS_MIB_LENGTH],
+                             name_len - ACCESS_MIB_LENGTH,
+                             (u_char **) & newGroupName, &groupNameLen,
+                             (u_char **) & newContextPrefix,
+                             &contextPrefixLen, &model, &level);
+            aptr =
+                vacm_getAccessEntry(newGroupName, newContextPrefix, model,
+                                    level);
+            if (aptr != NULL) {
+                vacm_destroyAccessEntry(newGroupName, newContextPrefix,
+                                        model, level);
+            }
+        }
+        free(newGroupName);
+        free(newContextPrefix);
+    }
+
+    return SNMP_ERR_NOERROR;
+}
+
+int
+write_vacmAccessStorageType(int action,
+                            u_char * var_val,
+                            u_char var_val_type,
+                            size_t var_val_len,
+                            u_char * statP, oid * name, size_t name_len)
+{
+    /*
+     * variables we may use later 
+     */
+    static long     long_ret;
+    struct vacm_accessEntry *aptr;
+
+    if (var_val_type != ASN_INTEGER) {
+        DEBUGMSGTL(("mibII/vacm_vars",
+                    "write to vacmSecurityToGroupStorageType not ASN_INTEGER\n"));
+        return SNMP_ERR_WRONGTYPE;
+    }
+    if (var_val_len > sizeof(long_ret)) {
+        DEBUGMSGTL(("mibII/vacm_vars",
+                    "write to vacmSecurityToGroupStorageType: bad length\n"));
+        return SNMP_ERR_WRONGLENGTH;
+    }
+    if (action == COMMIT) {
+        /*
+         * don't allow creations here 
+         */
+        if ((aptr = access_parse_accessEntry(name, name_len)) == NULL) {
+            return SNMP_ERR_NOSUCHNAME;
+        }
+        long_ret = *((long *) var_val);
+        /*
+         * if ((long_ret == ST_VOLATILE || long_ret == ST_NONVOLATILE) &&
+         * (aptr->storageType == ST_VOLATILE ||
+         * aptr->storageType == ST_NONVOLATILE)) 
+         */
+        /*
+         * This version only supports volatile storage
+         */
+        if (long_ret == aptr->storageType) {
+            return SNMP_ERR_NOERROR;
+        } else {
+            return SNMP_ERR_INCONSISTENTVALUE;
+        }
+    }
+    return SNMP_ERR_NOERROR;
+}
+
+int
+write_vacmAccessContextMatch(int action,
+                             u_char * var_val,
+                             u_char var_val_type,
+                             size_t var_val_len,
+                             u_char * statP, oid * name, size_t name_len)
+{
+    /*
+     * variables we may use later 
+     */
+    static long     long_ret;
+    struct vacm_accessEntry *aptr;
+
+    if (var_val_type != ASN_INTEGER) {
+        DEBUGMSGTL(("mibII/vacm_vars",
+                    "write to vacmAccessContextMatch not ASN_INTEGER\n"));
+        return SNMP_ERR_WRONGTYPE;
+    }
+    if (var_val_len > sizeof(long_ret)) {
+        DEBUGMSGTL(("mibII/vacm_vars",
+                    "write to vacmAccessContextMatch: bad length\n"));
+        return SNMP_ERR_WRONGLENGTH;
+    }
+    if (action == COMMIT) {
+        /*
+         * don't allow creations here 
+         */
+        if ((aptr = access_parse_accessEntry(name, name_len)) == NULL) {
+            return SNMP_ERR_NOSUCHNAME;
+        }
+        long_ret = *((long *) var_val);
+        if (long_ret == CM_EXACT || long_ret == CM_PREFIX) {
+            aptr->contextMatch = long_ret;
+        } else {
+            return SNMP_ERR_WRONGVALUE;
+        }
+    }
+    return SNMP_ERR_NOERROR;
+}
+
+int
+write_vacmAccessReadViewName(int action,
+                             u_char * var_val,
+                             u_char var_val_type,
+                             size_t var_val_len,
+                             u_char * statP, oid * name, size_t name_len)
+{
+    static unsigned char string[VACMSTRINGLEN];
+    struct vacm_accessEntry *aptr = NULL;
+    static int      resetOnFail;
+
+    if (action == RESERVE1) {
+        resetOnFail = 0;
+        if (var_val_type != ASN_OCTET_STR) {
+            DEBUGMSGTL(("mibII/vacm_vars",
+                        "write to vacmAccessReadViewName not ASN_OCTET_STR\n"));
+            return SNMP_ERR_WRONGTYPE;
+        }
+        if (var_val_len > 32) {
+            DEBUGMSGTL(("mibII/vacm_vars",
+                        "write to vacmAccessReadViewName: bad length\n"));
+            return SNMP_ERR_WRONGLENGTH;
+        }
+    } else if (action == RESERVE2) {
+        if ((aptr = access_parse_accessEntry(name, name_len)) == NULL) {
+            return SNMP_ERR_INCONSISTENTNAME;
+        } else {
+            resetOnFail = 1;
+            memcpy(string, aptr->readView, VACMSTRINGLEN);
+            memcpy(aptr->readView, var_val, var_val_len);
+            aptr->readView[var_val_len] = 0;
+        }
+    } else if (action == FREE) {
+        /*
+         * Try to undo the SET here (abnormal usage of FREE clause)  
+         */
+        if ((aptr = access_parse_accessEntry(name, name_len)) != NULL &&
+            resetOnFail) {
+            memcpy(aptr->readView, string, var_val_len);
+        }
+    }
+    return SNMP_ERR_NOERROR;
+}
+
+int
+write_vacmAccessWriteViewName(int action,
+                              u_char * var_val,
+                              u_char var_val_type,
+                              size_t var_val_len,
+                              u_char * statP, oid * name, size_t name_len)
+{
+    static unsigned char string[VACMSTRINGLEN];
+    struct vacm_accessEntry *aptr = NULL;
+    static int      resetOnFail;
+
+    if (action == RESERVE1) {
+        resetOnFail = 0;
+        if (var_val_type != ASN_OCTET_STR) {
+            DEBUGMSGTL(("mibII/vacm_vars",
+                        "write to vacmAccessWriteViewName not ASN_OCTET_STR\n"));
+            return SNMP_ERR_WRONGTYPE;
+        }
+        if (var_val_len > 32) {
+            DEBUGMSGTL(("mibII/vacm_vars",
+                        "write to vacmAccessWriteViewName: bad length\n"));
+            return SNMP_ERR_WRONGLENGTH;
+        }
+    } else if (action == RESERVE2) {
+        if ((aptr = access_parse_accessEntry(name, name_len)) == NULL) {
+            return SNMP_ERR_INCONSISTENTNAME;
+        } else {
+            resetOnFail = 1;
+            memcpy(string, aptr->writeView, VACMSTRINGLEN);
+            memcpy(aptr->writeView, var_val, var_val_len);
+            aptr->writeView[var_val_len] = 0;
+        }
+    } else if (action == FREE) {
+        /*
+         * Try to undo the SET here (abnormal usage of FREE clause)  
+         */
+        if ((aptr = access_parse_accessEntry(name, name_len)) != NULL &&
+            resetOnFail) {
+            memcpy(aptr->writeView, string, var_val_len);
+        }
+    }
+    return SNMP_ERR_NOERROR;
+}
+
+int
+write_vacmAccessNotifyViewName(int action,
+                               u_char * var_val,
+                               u_char var_val_type,
+                               size_t var_val_len,
+                               u_char * statP, oid * name, size_t name_len)
+{
+    static unsigned char string[VACMSTRINGLEN];
+    struct vacm_accessEntry *aptr = NULL;
+    static int      resetOnFail;
+
+    if (action == RESERVE1) {
+        resetOnFail = 0;
+        if (var_val_type != ASN_OCTET_STR) {
+            DEBUGMSGTL(("mibII/vacm_vars",
+                        "write to vacmAccessNotifyViewName not ASN_OCTET_STR\n"));
+            return SNMP_ERR_WRONGTYPE;
+        }
+        if (var_val_len > 32) {
+            DEBUGMSGTL(("mibII/vacm_vars",
+                        "write to vacmAccessNotifyViewName: bad length\n"));
+            return SNMP_ERR_WRONGLENGTH;
+        }
+    } else if (action == RESERVE2) {
+        if ((aptr = access_parse_accessEntry(name, name_len)) == NULL) {
+            return SNMP_ERR_INCONSISTENTNAME;
+        } else {
+            resetOnFail = 1;
+            memcpy(string, aptr->notifyView, VACMSTRINGLEN);
+            memcpy(aptr->notifyView, var_val, var_val_len);
+            aptr->notifyView[var_val_len] = 0;
+        }
+    } else if (action == FREE) {
+        /*
+         * Try to undo the SET here (abnormal usage of FREE clause)  
+         */
+        if ((aptr = access_parse_accessEntry(name, name_len)) != NULL &&
+            resetOnFail) {
+            memcpy(aptr->notifyView, string, var_val_len);
+        }
+    }
+    return SNMP_ERR_NOERROR;
+}
+
+int
+view_parse_oid(oid * oidIndex, size_t oidLen,
+               unsigned char **viewName, size_t * viewNameLen,
+               oid ** subtree, size_t * subtreeLen)
+{
+    int             viewNameL, subtreeL, i;
+
+    /*
+     * first check the validity of the oid 
+     */
+    if ((oidLen <= 0) || (!oidIndex)) {
+        return SNMP_ERR_INCONSISTENTNAME;
+    }
+    viewNameL = oidIndex[0];
+    subtreeL = oidLen - viewNameL - 1;  /* the initial name length */
+
+    /*
+     * its valid, malloc the space and store the results 
+     */
+    if (viewName == NULL || subtree == NULL) {
+        return SNMP_ERR_RESOURCEUNAVAILABLE;
+    }
+
+    if (subtreeL < 0) {
+        return SNMP_ERR_NOCREATION;
+    }
+
+    *viewName = (unsigned char *) malloc(viewNameL + 1);
+
+    if (*viewName == NULL) {
+        return SNMP_ERR_RESOURCEUNAVAILABLE;
+    }
+
+    *subtree = (oid *) malloc(subtreeL * sizeof(oid));
+    if (*subtree == NULL) {
+        free(*viewName);
+        return SNMP_ERR_RESOURCEUNAVAILABLE;
+    }
+
+    *subtreeLen = subtreeL;
+    *viewNameLen = viewNameL;
+
+    for (i = 0; i < viewNameL; i++) {
+        if (oidIndex[i + 1] > 255) {
+            free(*viewName);
+            free(*subtree);
+            return SNMP_ERR_INCONSISTENTNAME;
+        }
+        viewName[0][i] = (unsigned char) oidIndex[i + 1];
+    }
+    viewName[0][viewNameL] = 0;
+
+    for (i = 0; i < subtreeL; i++) {
+	if (oidIndex[i + viewNameL + 1] > 255) {
+	    free(*viewName);
+	    free(*subtree);
+	    return SNMP_ERR_INCONSISTENTNAME;
+	}
+        subtree[0][i] = (oid) oidIndex[i + viewNameL + 1];
+    }
+
+    return 0;
+}
+
+oid            *
+view_generate_OID(oid * prefix, size_t prefixLen,
+                  struct vacm_viewEntry * vptr, size_t * length)
+{
+    oid            *indexOid;
+    int             i, viewNameLen, viewSubtreeLen;
+
+    viewNameLen = strlen(vptr->viewName);
+    viewSubtreeLen = vptr->viewSubtreeLen;
+
+    *length = 2 + viewNameLen + viewSubtreeLen + prefixLen;
+    indexOid = (oid *) malloc(*length * sizeof(oid));
+    if (indexOid) {
+        memmove(indexOid, prefix, prefixLen * sizeof(oid));
+
+        indexOid[prefixLen] = viewNameLen;
+        for (i = 0; i < viewNameLen; i++)
+            indexOid[viewNameLen + 1 + i] = (oid) vptr->viewName[i];
+
+        indexOid[prefixLen + viewNameLen + 1] = viewSubtreeLen;
+        for (i = 0; i < viewSubtreeLen; i++)
+            indexOid[prefixLen + viewNameLen + 2 + i] =
+                (oid) vptr->viewSubtree[i];
+
+    }
+    return indexOid;
+
+}
+
+struct vacm_viewEntry *
+view_parse_viewEntry(oid * name, size_t name_len)
+{
+    struct vacm_viewEntry *vptr;
+
+    char           *newViewName;
+    oid            *newViewSubtree;
+    size_t          viewNameLen, viewSubtreeLen;
+
+    if (view_parse_oid(&name[VIEW_MIB_LENGTH], name_len - VIEW_MIB_LENGTH,
+                       (u_char **) & newViewName, &viewNameLen,
+                       (oid **) & newViewSubtree, &viewSubtreeLen))
+        return NULL;
+
+    vptr =
+        vacm_getViewEntry(newViewName, newViewSubtree, viewSubtreeLen,
+                          VACM_MODE_IGNORE_MASK);
+    free(newViewName);
+    free(newViewSubtree);
+
+    return vptr;
+
+}                               /* end vacm_parse_viewEntry() */
+
+int
+write_vacmViewStatus(int action,
+                     u_char * var_val,
+                     u_char var_val_type,
+                     size_t var_val_len,
+                     u_char * statP, oid * name, size_t name_len)
+{
+    static long     long_ret;
+    char           *newViewName;
+    oid            *newViewSubtree;
+    size_t          viewNameLen, viewSubtreeLen;
+    struct vacm_viewEntry *vptr;
+    int             rc = 0;
+
+    if (action == RESERVE1) {
+        if (var_val_type != ASN_INTEGER) {
+            return SNMP_ERR_WRONGTYPE;
+        }
+        if (var_val_len != sizeof(long_ret)) {
+            return SNMP_ERR_WRONGLENGTH;
+        }
+        long_ret = *((long *) var_val);
+        if (long_ret == RS_NOTREADY || long_ret < 1 || long_ret > 6) {
+            return SNMP_ERR_WRONGVALUE;
+        }
+
+        /*
+         * See if we can parse the oid for model/name first.  
+         */
+        if ((rc =
+             view_parse_oid(&name[VIEW_MIB_LENGTH],
+                            name_len - VIEW_MIB_LENGTH,
+                            (u_char **) & newViewName, &viewNameLen,
+                            (oid **) & newViewSubtree, &viewSubtreeLen))) {
+            return rc;
+        }
+
+        if (viewNameLen < 1 || viewNameLen > 32) {
+            free(newViewName);
+            free(newViewSubtree);
+            return SNMP_ERR_NOCREATION;
+        }
+
+        /*
+         * Now see if a group already exists with these index values.  
+         */
+        vptr =
+            vacm_getViewEntry(newViewName, newViewSubtree, viewSubtreeLen,
+                              VACM_MODE_IGNORE_MASK);
+
+        if (vptr != NULL) {
+            if (long_ret == RS_CREATEANDGO || long_ret == RS_CREATEANDWAIT) {
+                free(newViewName);
+                free(newViewSubtree);
+                long_ret = RS_NOTREADY;
+                return SNMP_ERR_INCONSISTENTVALUE;
+            }
+        } else {
+            if (long_ret == RS_ACTIVE || long_ret == RS_NOTINSERVICE) {
+                free(newViewName);
+                free(newViewSubtree);
+                return SNMP_ERR_INCONSISTENTVALUE;
+            }
+            if (long_ret == RS_CREATEANDGO || long_ret == RS_CREATEANDWAIT) {
+
+                /*
+                 * Generate a new group entry.  
+                 */
+                if ((vptr =
+                     vacm_createViewEntry(newViewName, &newViewSubtree[1],
+                                          viewSubtreeLen - 1)) == NULL) {
+                    free(newViewName);
+                    free(newViewSubtree);
+                    return SNMP_ERR_GENERR;
+                }
+
+                /*
+                 * Set defaults.  
+                 */
+                vptr->viewStorageType = ST_NONVOLATILE;
+                vptr->viewStatus = RS_NOTREADY;
+                vptr->viewType = SNMP_VIEW_INCLUDED;
+            }
+        }
+        free(newViewName);
+        free(newViewSubtree);
+    } else if (action == ACTION) {
+        view_parse_oid(&name[VIEW_MIB_LENGTH], name_len - VIEW_MIB_LENGTH,
+                       (u_char **) & newViewName, &viewNameLen,
+                       (oid **) & newViewSubtree, &viewSubtreeLen);
+
+        vptr =
+            vacm_getViewEntry(newViewName, newViewSubtree, viewSubtreeLen,
+                              VACM_MODE_IGNORE_MASK);
+
+        if (vptr != NULL) {
+            if (long_ret == RS_CREATEANDGO || long_ret == RS_ACTIVE) {
+                vptr->viewStatus = RS_ACTIVE;
+            } else if (long_ret == RS_CREATEANDWAIT) {
+                vptr->viewStatus = RS_NOTINSERVICE;
+            } else if (long_ret == RS_NOTINSERVICE) {
+                if (vptr->viewStatus == RS_ACTIVE) {
+                    vptr->viewStatus = RS_NOTINSERVICE;
+                } else if (vptr->viewStatus == RS_NOTREADY) {
+                    free(newViewName);
+                    free(newViewSubtree);
+                    return SNMP_ERR_INCONSISTENTVALUE;
+                }
+            }
+        }
+        free(newViewName);
+        free(newViewSubtree);
+    } else if (action == COMMIT) {
+        view_parse_oid(&name[VIEW_MIB_LENGTH], name_len - VIEW_MIB_LENGTH,
+                       (u_char **) & newViewName, &viewNameLen,
+                       (oid **) & newViewSubtree, &viewSubtreeLen);
+
+        vptr =
+            vacm_getViewEntry(newViewName, newViewSubtree, viewSubtreeLen,
+                              VACM_MODE_IGNORE_MASK);
+
+        if (vptr != NULL) {
+            if (long_ret == RS_DESTROY) {
+                vacm_destroyViewEntry(newViewName, newViewSubtree,
+                                      viewSubtreeLen);
+            }
+        }
+        free(newViewName);
+        free(newViewSubtree);
+    } else if (action == UNDO) {
+        if (long_ret == RS_CREATEANDGO || long_ret == RS_CREATEANDWAIT) {
+            view_parse_oid(&name[VIEW_MIB_LENGTH],
+                           name_len - VIEW_MIB_LENGTH,
+                           (u_char **) & newViewName, &viewNameLen,
+                           (oid **) & newViewSubtree, &viewSubtreeLen);
+
+            vptr = vacm_getViewEntry(newViewName, newViewSubtree,
+                                     viewSubtreeLen, VACM_MODE_IGNORE_MASK);
+
+            if (vptr != NULL) {
+                vacm_destroyViewEntry(newViewName, newViewSubtree,
+                                      viewSubtreeLen);
+            }
+            free(newViewName);
+            free(newViewSubtree);
+        }
+    }
+
+    return SNMP_ERR_NOERROR;
+}
+
+int
+write_vacmViewStorageType(int action,
+                          u_char * var_val,
+                          u_char var_val_type,
+                          size_t var_val_len,
+                          u_char * statP, oid * name, size_t name_len)
+{
+    long            newValue = *((long *) var_val);
+    static long     oldValue;
+    struct vacm_viewEntry *vptr = NULL;
+
+    if (action == RESERVE1) {
+        if (var_val_type != ASN_INTEGER) {
+            return SNMP_ERR_WRONGTYPE;
+        }
+        if (var_val_len != sizeof(long)) {
+            return SNMP_ERR_WRONGLENGTH;
+        }
+    } else if (action == RESERVE2) {
+        if ((vptr = view_parse_viewEntry(name, name_len)) == NULL) {
+            return SNMP_ERR_INCONSISTENTNAME;
+        } else {
+            if ((newValue == ST_VOLATILE || newValue == ST_NONVOLATILE) &&
+                (vptr->viewStorageType == ST_VOLATILE ||
+                 vptr->viewStorageType == ST_NONVOLATILE)) {
+                oldValue = vptr->viewStorageType;
+                vptr->viewStorageType = newValue;
+            } else if (newValue == vptr->viewStorageType) {
+                return SNMP_ERR_NOERROR;
+            } else {
+                return SNMP_ERR_INCONSISTENTVALUE;
+            }
+        }
+    } else if (action == UNDO) {
+        if ((vptr = view_parse_viewEntry(name, name_len)) != NULL) {
+            vptr->viewStorageType = oldValue;
+        }
+    }
+
+    return SNMP_ERR_NOERROR;
+}
+
+int
+write_vacmViewMask(int action,
+                   u_char * var_val,
+                   u_char var_val_type,
+                   size_t var_val_len,
+                   u_char * statP, oid * name, size_t name_len)
+{
+    static unsigned char string[VACMSTRINGLEN];
+    static long     length;
+    struct vacm_viewEntry *vptr = NULL;
+
+    if (action == RESERVE1) {
+        if (var_val_type != ASN_OCTET_STR) {
+            return SNMP_ERR_WRONGTYPE;
+        }
+        if (var_val_len > 16) {
+            return SNMP_ERR_WRONGLENGTH;
+        }
+    } else if (action == RESERVE2) {
+        if ((vptr = view_parse_viewEntry(name, name_len)) == NULL) {
+            return SNMP_ERR_INCONSISTENTNAME;
+        } else {
+            memcpy(string, vptr->viewMask, vptr->viewMaskLen);
+            length = vptr->viewMaskLen;
+            memcpy(vptr->viewMask, var_val, var_val_len);
+            vptr->viewMaskLen = var_val_len;
+        }
+    } else if (action == FREE) {
+        if ((vptr = view_parse_viewEntry(name, name_len)) != NULL) {
+            memcpy(vptr->viewMask, string, length);
+            vptr->viewMaskLen = length;
+        }
+    }
+    return SNMP_ERR_NOERROR;
+}
+
+int
+write_vacmViewType(int action,
+                   u_char * var_val,
+                   u_char var_val_type,
+                   size_t var_val_len,
+                   u_char * statP, oid * name, size_t name_len)
+{
+    long            newValue = *((long *) var_val);
+    static long     oldValue;
+    struct vacm_viewEntry *vptr = NULL;
+
+    if (action == RESERVE1) {
+        if (var_val_type != ASN_INTEGER) {
+            return SNMP_ERR_WRONGTYPE;
+        }
+        if (var_val_len != sizeof(long)) {
+            return SNMP_ERR_WRONGLENGTH;
+        }
+        if (newValue < 1 || newValue > 2) {
+            return SNMP_ERR_WRONGVALUE;
+        }
+    } else if (action == RESERVE2) {
+        if ((vptr = view_parse_viewEntry(name, name_len)) == NULL) {
+            return SNMP_ERR_INCONSISTENTNAME;
+        } else {
+            oldValue = vptr->viewType;
+            vptr->viewType = newValue;
+        }
+    } else if (action == UNDO) {
+        if ((vptr = view_parse_viewEntry(name, name_len)) != NULL) {
+            vptr->viewType = oldValue;
+        }
+    }
+
+    return SNMP_ERR_NOERROR;
+}
+
+int
+write_vacmViewSpinLock(int action,
+                       u_char * var_val,
+                       u_char var_val_type,
+                       size_t var_val_len,
+                       u_char * statP, oid * name, size_t name_len)
+{
+    static long     long_ret;
+
+    if (action == RESERVE1) {
+        if (var_val_type != ASN_INTEGER) {
+            DEBUGMSGTL(("mibII/vacm_vars",
+                        "write to vacmViewSpinLock not ASN_INTEGER\n"));
+            return SNMP_ERR_WRONGTYPE;
+        }
+        if (var_val_len != sizeof(long_ret)) {
+            DEBUGMSGTL(("mibII/vacm_vars",
+                        "write to vacmViewSpinLock: bad length\n"));
+            return SNMP_ERR_WRONGLENGTH;
+        }
+        long_ret = *((long *) var_val);
+        if (long_ret != (long) vacmViewSpinLock) {
+            return SNMP_ERR_INCONSISTENTVALUE;
+        }
+    } else if (action == COMMIT) {
+        if (vacmViewSpinLock == 2147483647) {
+            vacmViewSpinLock = 0;
+        } else {
+            vacmViewSpinLock++;
+        }
+    }
+    return SNMP_ERR_NOERROR;
+}
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/mibII/vacm_vars.h tomato121/release/src/router/snmp/agent/mibgroup/mibII/vacm_vars.h
--- tomato/release/src/router/snmp/agent/mibgroup/mibII/vacm_vars.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/mibII/vacm_vars.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,105 @@
+/*
+ * SNMPv3 View-based Access Control Model
+ */
+
+#ifndef _MIBGROUP_VACM_H
+#define _MIBGROUP_VACM_H
+
+#include <net-snmp/library/vacm.h>
+
+config_require(util_funcs)
+config_require(mibII/vacm_context)
+config_add_mib(SNMP-VIEW-BASED-ACM-MIB)
+config_add_mib(SNMP-COMMUNITY-MIB)
+
+     void            init_vacm_vars(void);
+     void            vacm_free_group(void);
+     void            vacm_free_access(void);
+     void            vacm_free_view(void);
+     void            vacm_parse_group(const char *, char *);
+     void            vacm_parse_access(const char *, char *);
+     void            vacm_parse_view(const char *, char *);
+     void            vacm_parse_simple(const char *, char *);
+
+     SNMPCallback    vacm_in_view_callback;
+     SNMPCallback    vacm_warn_if_not_configured;
+
+     int             vacm_in_view(netsnmp_pdu *, oid *, size_t, int);
+
+     extern FindVarMethod var_vacm_sec2group;
+     extern FindVarMethod var_vacm_access;
+     extern FindVarMethod var_vacm_view;
+
+     WriteMethod     write_vacmGroupName;
+     WriteMethod     write_vacmSecurityToGroupStatus;
+     WriteMethod     write_vacmSecurityToGroupStorageType;
+
+     WriteMethod     write_vacmAccessContextMatch;
+     WriteMethod     write_vacmAccessNotifyViewName;
+     WriteMethod     write_vacmAccessReadViewName;
+     WriteMethod     write_vacmAccessWriteViewName;
+     WriteMethod     write_vacmAccessStatus;
+     WriteMethod     write_vacmAccessStorageType;
+
+     WriteMethod     write_vacmViewSpinLock;
+     WriteMethod     write_vacmViewMask;
+     WriteMethod     write_vacmViewStatus;
+     WriteMethod     write_vacmViewStorageType;
+     WriteMethod     write_vacmViewType;
+
+
+     oid            *access_generate_OID(oid * prefix, size_t prefixLen,
+                                         struct vacm_accessEntry *aptr,
+                                         size_t * length);
+     struct vacm_accessEntry *access_parse_accessEntry(oid * name,
+                                                       size_t name_len);
+     int             access_parse_oid(oid * oidIndex, size_t oidLen,
+                                      unsigned char **groupName,
+                                      size_t * groupNameLen,
+                                      unsigned char **contextPrefix,
+                                      size_t * contextPrefixLen,
+                                      int *model, int *level);
+
+     oid            *sec2group_generate_OID(oid * prefix, size_t prefixLen,
+                                            struct vacm_groupEntry *geptr,
+                                            size_t * length);
+     int             sec2group_parse_oid(oid * oidIndex, size_t oidLen,
+                                         int *model, unsigned char **name,
+                                         size_t * nameLen);
+     struct vacm_groupEntry *sec2group_parse_groupEntry(oid * name,
+                                                        size_t name_len);
+
+     oid            *view_generate_OID(oid * prefix, size_t prefixLen,
+                                       struct vacm_viewEntry *vptr,
+                                       size_t * length);
+     int             view_parse_oid(oid * oidIndex, size_t oidLen,
+                                    unsigned char **viewName,
+                                    size_t * viewNameLen, oid ** subtree,
+                                    size_t * subtreeLen);
+     struct vacm_viewEntry *view_parse_viewEntry(oid * name,
+                                                 size_t name_len);
+
+
+
+#define OID_SNMPVACMMIB		SNMP_OID_SNMPMODULES, 16
+#define OID_VACMMIBOBJECTS	OID_SNMPVACMMIB, 1
+
+#define OID_VACMCONTEXTTABLE	OID_VACMMIBOBJECTS, 1
+#define OID_VACMCONTEXTENTRY	OID_VACMCONTEXTTABLE, 1
+
+#define OID_VACMGROUPTABLE	OID_VACMMIBOBJECTS, 2
+#define OID_VACMGROUPENTRY	OID_VACMGROUPTABLE, 1
+
+#define OID_VACMACCESSTABLE	OID_VACMMIBOBJECTS, 4
+#define OID_VACMACCESSENTRY	OID_VACMACCESSTABLE, 1
+
+#define OID_VACMMIBVIEWS	OID_VACMMIBOBJECTS, 5
+#define OID_VACMVIEWTABLE	OID_VACMMIBVIEWS, 2
+#define OID_VACMVIEWENTRY	OID_VACMVIEWTABLE, 1
+#define SEC2GROUP_MIB_LENGTH 11
+#define ACCESS_MIB_LENGTH 11
+#define VIEW_MIB_LENGTH 12
+#define CM_EXACT 1
+#define CM_PREFIX 2
+
+#endif                          /* _MIBGROUP_VACM_H */
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/mibII/var_route.c tomato121/release/src/router/snmp/agent/mibgroup/mibII/var_route.c
--- tomato/release/src/router/snmp/agent/mibgroup/mibII/var_route.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/mibII/var_route.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,2202 @@
+#undef CAN_USE_SYSCTL
+/*
+ * snmp_var_route.c - return a pointer to the named variable.
+ *
+ *
+ */
+/***********************************************************
+	Copyright 1988, 1989 by Carnegie Mellon University
+	Copyright 1989	TGV, Incorporated
+
+		      All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of CMU and TGV not be used
+in advertising or publicity pertaining to distribution of the software
+without specific, written prior permission.
+
+CMU AND TGV DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+EVENT SHALL CMU OR TGV BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
+USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
+OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+PERFORMANCE OF THIS SOFTWARE.
+******************************************************************/
+/*
+ * additions, fixes and enhancements for Linux by Erik Schoenfelder
+ * (schoenfr@ibr.cs.tu-bs.de) 1994/1995.
+ * Linux additions taken from CMU to UCD stack by Jennifer Bray of Origin
+ * (jbray@origin-at.co.uk) 1997
+ * Support for system({CTL_NET,PF_ROUTE,...) by Simon Leinen
+ * (simon@switch.ch) 1997
+ */
+
+#include <net-snmp/net-snmp-config.h>
+
+#if !defined(CAN_USE_SYSCTL)
+
+#define GATEWAY                 /* MultiNet is always configured this way! */
+#include <stdio.h>
+#include <sys/types.h>
+#if HAVE_SYS_PARAM_H
+#include <sys/param.h>
+#endif
+#if HAVE_SYS_SOCKET_H
+#include <sys/socket.h>
+#endif
+#if TIME_WITH_SYS_TIME
+# ifdef WIN32
+#  include <sys/timeb.h>
+# else
+# include <sys/time.h>
+# endif
+# include <time.h>
+#else
+# if HAVE_SYS_TIME_H
+#  include <sys/time.h>
+# else
+#  include <time.h>
+# endif
+#endif
+#if HAVE_SYS_SELECT_H
+#include <sys/select.h>
+#endif
+#if HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+#if HAVE_ARPA_INET_H
+#include <arpa/inet.h>
+#endif
+#if HAVE_SYSLOG_H
+#include <syslog.h>
+#endif
+#if HAVE_MACHINE_PARAM_H
+#include <machine/param.h>
+#endif
+#if HAVE_SYS_MBUF_H
+#include <sys/mbuf.h>
+#endif
+#if HAVE_NET_IF_H
+#include <net/if.h>
+#endif
+#ifdef HAVE_NET_IF_VAR_H
+#include <net/if_var.h>
+#endif
+#if HAVE_SYS_HASHING_H
+#include <sys/hashing.h>
+#endif
+#if HAVE_NETINET_IN_VAR_H
+#include <netinet/in_var.h>
+#endif
+#define KERNEL                  /* to get routehash and RTHASHSIZ */
+#if HAVE_SYS_STREAM_H
+#include <sys/stream.h>
+#endif
+#if HAVE_NET_ROUTE_H
+#include <net/route.h>
+#endif
+#undef	KERNEL
+#ifdef RTENTRY_4_4
+#ifndef STRUCT_RTENTRY_HAS_RT_UNIT
+#define rt_unit rt_refcnt       /* Reuse this field for device # */
+#endif
+#ifndef STRUCT_RTENTRY_HAS_RT_DST
+#define rt_dst rt_nodes->rn_key
+#endif
+#else                           /* RTENTRY_4_3 */
+#ifndef STRUCT_RTENTRY_HAS_RT_DST
+#define rt_dst rt_nodes->rn_key
+#endif
+#ifndef STRUCT_RTENTRY_HAS_RT_HASH
+#define rt_hash rt_pad1
+#endif
+#ifndef STRUCT_RTENTRY_HAS_RT_REFCNT
+#ifndef hpux10
+#define rt_refcnt rt_pad2
+#endif
+#endif
+#ifndef STRUCT_RTENTRY_HAS_RT_USE
+#define rt_use rt_pad3
+#endif
+#ifndef STRUCT_RTENTRY_HAS_RT_UNIT
+#define rt_unit rt_refcnt       /* Reuse this field for device # */
+#endif
+#endif
+#ifndef NULL
+#define NULL 0
+#endif
+#if HAVE_KVM_OPENFILES
+#include <fcntl.h>
+#endif
+#if HAVE_KVM_H
+#include <kvm.h>
+#endif
+
+#if HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+#if HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#if HAVE_INET_MIB2_H
+#include <inet/mib2.h>
+#endif
+#if HAVE_SYS_SYSCTL_H
+#include <sys/sysctl.h>
+#endif
+#if HAVE_NET_IF_DL_H
+#ifndef dynix
+#include <net/if_dl.h>
+#else
+#include <sys/net/if_dl.h>
+#endif
+#endif
+
+#if HAVE_WINSOCK_H
+#include <winsock.h>
+#endif
+
+#if HAVE_NLIST_H
+#include <nlist.h>
+#endif
+
+#if solaris2
+#include "kernel_sunos5.h"
+#endif
+
+#ifdef HAVE_SYS_SYSCTL_H
+# ifdef CTL_NET
+#  ifdef PF_ROUTE
+#   ifdef NET_RT_DUMP
+#    define USE_SYSCTL_ROUTE_DUMP
+#   endif
+#  endif
+# endif
+#endif
+
+#if HAVE_DMALLOC_H
+#include <dmalloc.h>
+#endif
+
+#ifdef cygwin
+#define WIN32
+#include <windows.h>
+#endif
+
+#define CACHE_TIME (120)        /* Seconds */
+
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include <net-snmp/agent/auto_nlist.h>
+
+#include "ip.h"
+#include "kernel.h"
+#include "interfaces.h"
+#include "struct.h"
+#include "util_funcs.h"
+
+#ifndef  MIN
+#define  MIN(a,b)                     (((a) < (b)) ? (a) : (b))
+#endif
+
+#ifdef hpux11
+#include <sys/mib.h>
+#include <netinet/mib_kern.h>
+#endif                          /* hpux */
+
+extern WriteMethod write_rte;
+
+#ifndef WIN32
+
+#ifdef USE_SYSCTL_ROUTE_DUMP
+
+static void     Route_Scan_Reload(void);
+
+static unsigned char *all_routes = 0;
+static unsigned char *all_routes_end;
+static size_t   all_routes_size;
+
+extern const struct sockaddr *get_address(const void *, int, int);
+extern const struct in_addr *get_in_address(const void *, int, int);
+
+/*
+ * var_ipRouteEntry(...
+ * Arguments:
+ * vp           IN      - pointer to variable entry that points here
+ * name          IN/OUT  - IN/name requested, OUT/name found
+ * length        IN/OUT  - length of IN/OUT oid's 
+ * exact         IN      - TRUE if an exact match was requested
+ * var_len       OUT     - length of variable or 0 if function returned
+ * write_method  out     - pointer to function to set variable, otherwise 0
+ */
+u_char         *
+var_ipRouteEntry(struct variable *vp,
+                 oid * name,
+                 size_t * length,
+                 int exact, size_t * var_len, WriteMethod ** write_method)
+{
+    /*
+     * object identifier is of form:
+     * 1.3.6.1.2.1.4.21.1.1.A.B.C.D,  where A.B.C.D is IP address.
+     * IPADDR starts at offset 10.
+     */
+    struct rt_msghdr *rtp, *saveRtp = 0;
+    register int    Save_Valid, result;
+    static int      saveNameLen = 0, saveExact = 0;
+    static oid      saveName[MAX_OID_LEN], Current[MAX_OID_LEN];
+    u_char         *cp;
+    u_char         *ap;
+    oid            *op;
+#if 0
+  /** 
+  ** this optimisation fails, if there is only a single route avail.
+  ** it is a very special case, but better leave it out ...
+  **/
+#if 0
+    if (rtsize <= 1)
+        Save_Valid = 0;
+    else
+#endif                          /* 0 */
+        /*
+         *  OPTIMIZATION:
+         *
+         *  If the name was the same as the last name, with the possible
+         *  exception of the [9]th token, then don't read the routing table
+         *
+         */
+
+    if ((saveNameLen == *length) && (saveExact == exact)) {
+        register int    temp = name[9];
+        name[9] = 0;
+        Save_Valid =
+            (snmp_oid_compare(name, *length, saveName, saveNameLen) == 0);
+        name[9] = temp;
+    } else
+        Save_Valid = 0;
+
+    if (Save_Valid && saveRtp) {
+        register int    temp = name[9]; /* Fix up 'lowest' found entry */
+        memcpy((char *) name, (char *) Current, 14 * sizeof(oid));
+        name[9] = temp;
+        *length = 14;
+        rtp = saveRtp;
+    } else {
+#endif                          /* 0 */
+        /*
+         * fill in object part of name for current (less sizeof instance part) 
+         */
+
+        memcpy((char *) Current, (char *) vp->name,
+               (int) (vp->namelen) * sizeof(oid));
+
+#if 0
+        /*
+         *  Only reload if this is the start of a wildcard
+         */
+        if (*length < 14) {
+            Route_Scan_Reload();
+        }
+#else
+        Route_Scan_Reload();
+#endif
+        for (ap = all_routes; ap < all_routes_end; ap += rtp->rtm_msglen) {
+            rtp = (struct rt_msghdr *) ap;
+            if (rtp->rtm_type == 0)
+                break;
+            if (rtp->rtm_version != RTM_VERSION) {
+                snmp_log(LOG_ERR,
+                         "routing socket message version mismatch (%d instead of %d)\n",
+                         rtp->rtm_version, RTM_VERSION);
+                break;
+            }
+            if (rtp->rtm_type != RTM_GET) {
+                snmp_log(LOG_ERR,
+                         "routing socket returned message other than GET (%d)\n",
+                         rtp->rtm_type);
+                continue;
+            }
+            if (!(rtp->rtm_addrs & RTA_DST))
+                continue;
+            cp = (u_char *) get_in_address((struct sockaddr *) (rtp + 1),
+                                           rtp->rtm_addrs, RTA_DST);
+            if (cp == NULL)
+                return NULL;
+
+            op = Current + 10;
+            *op++ = *cp++;
+            *op++ = *cp++;
+            *op++ = *cp++;
+            *op++ = *cp++;
+
+            result = snmp_oid_compare(name, *length, Current, 14);
+            if ((exact && (result == 0)) || (!exact && (result < 0)))
+                break;
+        }
+        if (ap >= all_routes_end || rtp->rtm_type == 0)
+            return 0;
+        /*
+         *  Save in the 'cache'
+         */
+        memcpy((char *) saveName, (char *) name,
+               SNMP_MIN(*length, MAX_OID_LEN) * sizeof(oid));
+        saveName[9] = '\0';
+        saveNameLen = *length;
+        saveExact = exact;
+        saveRtp = rtp;
+        /*
+         *  Return the name
+         */
+        memcpy((char *) name, (char *) Current, 14 * sizeof(oid));
+        *length = 14;
+#if 0
+    }
+#endif                          /* 0 */
+
+    *write_method = write_rte;
+    *var_len = sizeof(long_return);
+
+    switch (vp->magic) {
+    case IPROUTEDEST:
+        return (u_char *) get_in_address((struct sockaddr *) (rtp + 1),
+                                         rtp->rtm_addrs, RTA_DST);
+    case IPROUTEIFINDEX:
+        long_return = (u_long) rtp->rtm_index;
+        return (u_char *) & long_return;
+    case IPROUTEMETRIC1:
+        long_return = (rtp->rtm_flags & RTF_UP) ? 1 : 0;
+        return (u_char *) & long_return;
+    case IPROUTEMETRIC2:
+#if NO_DUMMY_VALUES
+        return NULL;
+#endif
+        long_return = -1;
+        return (u_char *) & long_return;
+    case IPROUTEMETRIC3:
+#if NO_DUMMY_VALUES
+        return NULL;
+#endif
+        long_return = -1;
+        return (u_char *) & long_return;
+    case IPROUTEMETRIC4:
+#if NO_DUMMY_VALUES
+        return NULL;
+#endif
+        long_return = -1;
+        return (u_char *) & long_return;
+    case IPROUTEMETRIC5:
+#if NO_DUMMY_VALUES
+        return NULL;
+#endif
+        long_return = -1;
+        return (u_char *) & long_return;
+    case IPROUTENEXTHOP:
+        return (u_char *) get_in_address((struct sockaddr *) (rtp + 1),
+                                         rtp->rtm_addrs, RTA_GATEWAY);
+    case IPROUTETYPE:
+        if (rtp->rtm_flags & RTF_UP) {
+            if (rtp->rtm_flags & RTF_GATEWAY) {
+                long_return = 4;        /*  indirect(4)  */
+            } else {
+                long_return = 3;        /*  direct(3)  */
+            }
+        } else {
+            long_return = 2;    /*  invalid(2)  */
+        }
+        return (u_char *) & long_return;
+    case IPROUTEPROTO:
+        long_return = (rtp->rtm_flags & RTF_DYNAMIC)
+            ? 10 : (rtp->rtm_flags & RTF_STATIC)
+            ? 2 : (rtp->rtm_flags & RTF_DYNAMIC) ? 4 : 1;
+        return (u_char *) & long_return;
+    case IPROUTEAGE:
+#if NO_DUMMY_VALUES
+        return NULL;
+#endif
+        long_return = 0;
+        return (u_char *) & long_return;
+    case IPROUTEMASK:
+        if (rtp->rtm_flags & RTF_HOST) {
+            long_return = 0x00000001;
+            return (u_char *) & long_return;
+        } else {
+            return (u_char *) get_in_address((struct sockaddr *) (rtp + 1),
+                                             rtp->rtm_addrs, RTA_NETMASK);
+        }
+    case IPROUTEINFO:
+        *var_len = nullOidLen;
+        return (u_char *) nullOid;
+    default:
+        DEBUGMSGTL(("snmpd", "unknown sub-id %d in var_ipRouteEntry\n",
+                    vp->magic));
+    }
+    return NULL;
+}
+
+#else                           /* not USE_SYSCTL_ROUTE_DUMP */
+
+static void     Route_Scan_Reload(void);
+
+#ifdef hpux11
+static int      rtsize = 0;
+static mib_ipRouteEnt *rt = (mib_ipRouteEnt *) 0;
+#else                           /* hpux11 */
+static RTENTRY **rthead = 0;
+static int      rtsize = 0, rtallocate = 0;
+#endif                          /* hpux11 */
+
+#if !(defined(linux) || defined(solaris2) || defined(hpux11))
+#define NUM_ROUTE_SYMBOLS 2
+static char    *route_symbols[] = {
+    RTHOST_SYMBOL,
+    RTNET_SYMBOL
+};
+#endif
+#endif
+
+#ifdef USE_SYSCTL_ROUTE_DUMP
+
+void
+init_var_route(void)
+{
+#ifdef solaris2
+    init_kernel_sunos5();
+#endif
+}
+
+static void
+Route_Scan_Reload(void)
+{
+    size_t          size = 0;
+    int             name[] = { CTL_NET, PF_ROUTE, 0, 0, NET_RT_DUMP, 0 };
+
+    if (sysctl(name, sizeof(name) / sizeof(int), 0, &size, 0, 0) == -1) {
+        snmp_log(LOG_ERR, "sysctl(CTL_NET,PF_ROUTE,0,0,NET_RT_DUMP,0)\n");
+    } else {
+        if (all_routes == 0 || all_routes_size < size) {
+            if (all_routes != 0) {
+                free(all_routes);
+                all_routes = 0;
+            }
+            if ((all_routes = malloc(size)) == 0) {
+                snmp_log(LOG_ERR,
+                         "out of memory allocating route table\n");
+            }
+            all_routes_size = size;
+        } else {
+            size = all_routes_size;
+        }
+        if (sysctl(name, sizeof(name) / sizeof(int),
+                   all_routes, &size, 0, 0) == -1) {
+            snmp_log(LOG_ERR,
+                     "sysctl(CTL_NET,PF_ROUTE,0,0,NET_RT_DUMP,0)\n");
+        }
+        all_routes_end = all_routes + size;
+    }
+}
+
+#else                           /* not USE_SYSCTL_ROUTE_DUMP */
+
+void
+init_var_route(void)
+{
+#ifdef RTTABLES_SYMBOL
+    auto_nlist(RTTABLES_SYMBOL, 0, 0);
+#endif
+#ifdef RTHASHSIZE_SYMBOL
+    auto_nlist(RTHASHSIZE_SYMBOL, 0, 0);
+#endif
+#ifdef RTHOST_SYMBOL
+    auto_nlist(RTHOST_SYMBOL, 0, 0);
+#endif
+#ifdef RTNET_SYMBOL
+    auto_nlist(RTNET_SYMBOL, 0, 0);
+#endif
+}
+
+#ifndef solaris2
+
+#if NEED_KLGETSA
+static union {
+    struct sockaddr_in sin;
+    u_short         data[128];
+} klgetsatmp;
+
+struct sockaddr_in *
+klgetsa(struct sockaddr_in *dst)
+{
+    klookup((u_long) dst, (char *) &klgetsatmp.sin, sizeof klgetsatmp.sin);
+    if (klgetsatmp.sin.sin_len > sizeof(klgetsatmp.sin))
+        klookup((u_long) dst, (char *) &klgetsatmp.sin,
+                klgetsatmp.sin.sin_len);
+    return (&klgetsatmp.sin);
+}
+#endif
+
+u_char         *
+var_ipRouteEntry(struct variable * vp,
+                 oid * name,
+                 size_t * length,
+                 int exact, size_t * var_len, WriteMethod ** write_method)
+{
+    /*
+     * object identifier is of form:
+     * 1.3.6.1.2.1.4.21.1.1.A.B.C.D,  where A.B.C.D is IP address.
+     * IPADDR starts at offset 10.
+     */
+    register int    Save_Valid, result, RtIndex;
+    static int      saveNameLen = 0, saveExact = 0, saveRtIndex = 0;
+    static oid      saveName[MAX_OID_LEN], Current[MAX_OID_LEN];
+    u_char         *cp;
+    oid            *op;
+#if NEED_KLGETSA
+    struct sockaddr_in *sa;
+#endif
+#if !defined(linux) && !defined(hpux11)
+    struct ifnet    rt_ifnet;
+    struct in_ifaddr rt_ifnetaddr;
+#endif
+    /** 
+     ** this optimisation fails, if there is only a single route avail.
+     ** it is a very special case, but better leave it out ...
+     **/
+#if NO_DUMMY_VALUES
+    saveNameLen = 0;
+#endif
+    if (rtsize <= 1)
+        Save_Valid = 0;
+    else
+        /*
+         *  OPTIMIZATION:
+         *
+         *  If the name was the same as the last name, with the possible
+         *  exception of the [9]th token, then don't read the routing table
+         *
+         */
+
+    if ((saveNameLen == *length) && (saveExact == exact)) {
+        register int    temp = name[9];
+        name[9] = 0;
+        Save_Valid =
+            (snmp_oid_compare(name, *length, saveName, saveNameLen) == 0);
+        name[9] = temp;
+    } else
+        Save_Valid = 0;
+
+    if (Save_Valid) {
+        register int    temp = name[9]; /* Fix up 'lowest' found entry */
+        memcpy((char *) name, (char *) Current, 14 * sizeof(oid));
+        name[9] = temp;
+        *length = 14;
+        RtIndex = saveRtIndex;
+    } else {
+        /*
+         * fill in object part of name for current (less sizeof instance part) 
+         */
+
+        memcpy((char *) Current, (char *) vp->name,
+               (int) (vp->namelen) * sizeof(oid));
+
+#if 0
+        /*
+         *  Only reload if this is the start of a wildcard
+         */
+        if (*length < 14) {
+            Route_Scan_Reload();
+        }
+#else
+        Route_Scan_Reload();
+#endif
+        for (RtIndex = 0; RtIndex < rtsize; RtIndex++) {
+#if NEED_KLGETSA
+            sa = klgetsa((struct sockaddr_in *) rthead[RtIndex]->rt_dst);
+            cp = (u_char *) & (sa->sin_addr.s_addr);
+#elif defined(hpux11)
+            cp = (u_char *) & rt[RtIndex].Dest;
+#else
+            cp = (u_char *) &
+                (((struct sockaddr_in *) &(rthead[RtIndex]->rt_dst))->
+                 sin_addr.s_addr);
+#endif
+            op = Current + 10;
+            *op++ = *cp++;
+            *op++ = *cp++;
+            *op++ = *cp++;
+            *op++ = *cp++;
+
+            result = snmp_oid_compare(name, *length, Current, 14);
+            if ((exact && (result == 0)) || (!exact && (result < 0)))
+                break;
+        }
+        if (RtIndex >= rtsize)
+            return (NULL);
+        /*
+         *  Save in the 'cache'
+         */
+        memcpy((char *) saveName, (char *) name,
+               SNMP_MIN(*length, MAX_OID_LEN) * sizeof(oid));
+        saveName[9] = 0;
+        saveNameLen = *length;
+        saveExact = exact;
+        saveRtIndex = RtIndex;
+        /*
+         *  Return the name
+         */
+        memcpy((char *) name, (char *) Current, 14 * sizeof(oid));
+        *length = 14;
+    }
+
+    *write_method = write_rte;
+    *var_len = sizeof(long_return);
+
+    switch (vp->magic) {
+    case IPROUTEDEST:
+#if NEED_KLGETSA
+        sa = klgetsa((struct sockaddr_in *) rthead[RtIndex]->rt_dst);
+        return (u_char *) & (sa->sin_addr.s_addr);
+#elif defined(hpux11)
+        long_return = rt[RtIndex].Dest;
+        return (u_char *) & long_return;
+#else
+        return (u_char *) & ((struct sockaddr_in *) &rthead[RtIndex]->
+                             rt_dst)->sin_addr.s_addr;
+#endif
+    case IPROUTEIFINDEX:
+#ifdef hpux11
+        long_return = rt[RtIndex].IfIndex;
+#else
+        long_return = (u_long) rthead[RtIndex]->rt_unit;
+#endif
+        return (u_char *) & long_return;
+    case IPROUTEMETRIC1:
+#ifdef hpux11
+        long_return = rt[RtIndex].Metric1;
+#else
+        long_return = (rthead[RtIndex]->rt_flags & RTF_GATEWAY) ? 1 : 0;
+#endif
+        return (u_char *) & long_return;
+    case IPROUTEMETRIC2:
+#ifdef hpux11
+        long_return = rt[RtIndex].Metric2;
+        return (u_char *) & long_return;
+#elif defined(NO_DUMMY_VALUES)
+        return NULL;
+#endif
+        long_return = -1;
+        return (u_char *) & long_return;
+    case IPROUTEMETRIC3:
+#ifdef hpux11
+        long_return = rt[RtIndex].Metric3;
+        return (u_char *) & long_return;
+#elif defined(NO_DUMMY_VALUES)
+        return NULL;
+#endif
+        long_return = -1;
+        return (u_char *) & long_return;
+    case IPROUTEMETRIC4:
+#ifdef hpux11
+        long_return = rt[RtIndex].Metric4;
+        return (u_char *) & long_return;
+#elif defined(NO_DUMMY_VALUES)
+        return NULL;
+#endif
+        long_return = -1;
+        return (u_char *) & long_return;
+    case IPROUTEMETRIC5:
+#if NO_DUMMY_VALUES
+        return NULL;
+#endif
+        long_return = -1;
+        return (u_char *) & long_return;
+    case IPROUTENEXTHOP:
+#if NEED_KLGETSA
+        sa = klgetsa((struct sockaddr_in *) rthead[RtIndex]->rt_gateway);
+        return (u_char *) & (sa->sin_addr.s_addr);
+#elif defined(hpux11)
+        long_return = rt[RtIndex].NextHop;
+        return (u_char *) & long_return;
+#else
+        return (u_char *) & ((struct sockaddr_in *) &rthead[RtIndex]->
+                             rt_gateway)->sin_addr.s_addr;
+#endif                          /* *bsd */
+    case IPROUTETYPE:
+#ifdef hpux11
+        long_return = rt[RtIndex].Type;
+#else
+        if (rthead[RtIndex]->rt_flags & RTF_UP) {
+            if (rthead[RtIndex]->rt_flags & RTF_GATEWAY) {
+                long_return = 4;        /*  indirect(4)  */
+            } else {
+                long_return = 3;        /*  direct(3)  */
+            }
+        } else {
+            long_return = 2;    /*  invalid(2)  */
+        }
+#endif
+        return (u_char *) & long_return;
+    case IPROUTEPROTO:
+#ifdef hpux11
+        long_return = rt[RtIndex].Proto;
+#else
+        long_return = (rthead[RtIndex]->rt_flags & RTF_DYNAMIC) ? 4 : 2;
+#endif
+        return (u_char *) & long_return;
+    case IPROUTEAGE:
+#ifdef hpux11
+        long_return = rt[RtIndex].Age;
+        return (u_char *) & long_return;
+#elif defined(NO_DUMMY_VALUES)
+        return NULL;
+#endif
+        long_return = 0;
+        return (u_char *) & long_return;
+    case IPROUTEMASK:
+#if NEED_KLGETSA
+        /*
+         * XXX - Almost certainly not right
+         * but I don't have a suitable system to test this on 
+         */
+#if NO_DUMMY_VALUES
+        return NULL;
+#endif
+        long_return = 0;
+#elif defined(hpux11)
+        long_return = rt[RtIndex].Mask;
+        return (u_char *) & long_return;
+#else                           /* !NEED_KLGETSA && !hpux11 */
+        if (((struct sockaddr_in *) &rthead[RtIndex]->rt_dst)->sin_addr.
+            s_addr == 0)
+            long_return = 0;    /* Default route */
+        else {
+#ifndef linux
+            klookup((unsigned long) rthead[RtIndex]->rt_ifp,
+                    (char *) &rt_ifnet, sizeof(rt_ifnet));
+            klookup((unsigned long) rt_ifnet.if_addrlist,
+                    (char *) &rt_ifnetaddr, sizeof(rt_ifnetaddr));
+
+            long_return = rt_ifnetaddr.ia_subnetmask;
+#else                           /* linux */
+            cp = (u_char *) &
+                (((struct sockaddr_in *) &(rthead[RtIndex]->rt_dst))->
+                 sin_addr.s_addr);
+            return (u_char *) &
+                (((struct sockaddr_in *) &(rthead[RtIndex]->rt_genmask))->
+                 sin_addr.s_addr);
+#endif                          /* linux */
+        }
+#endif                          /* NEED_KLGETSA */
+        return (u_char *) & long_return;
+    case IPROUTEINFO:
+        *var_len = nullOidLen;
+        return (u_char *) nullOid;
+    default:
+        DEBUGMSGTL(("snmpd", "unknown sub-id %d in var_ipRouteEntry\n",
+                    vp->magic));
+    }
+    return NULL;
+}
+
+#else                           /* solaris2 */
+
+static int
+IP_Cmp_Route(void *addr, void *ep)
+{
+    mib2_ipRouteEntry_t *Ep = ep, *Addr = addr;
+
+    if ((Ep->ipRouteDest == Addr->ipRouteDest) &&
+        (Ep->ipRouteNextHop == Addr->ipRouteNextHop) &&
+        (Ep->ipRouteType == Addr->ipRouteType) &&
+        (Ep->ipRouteProto == Addr->ipRouteProto) &&
+        (Ep->ipRouteMask == Addr->ipRouteMask) &&
+        (Ep->ipRouteInfo.re_max_frag == Addr->ipRouteInfo.re_max_frag) &&
+        (Ep->ipRouteInfo.re_rtt == Addr->ipRouteInfo.re_rtt) &&
+        (Ep->ipRouteInfo.re_ref == Addr->ipRouteInfo.re_ref) &&
+        (Ep->ipRouteInfo.re_frag_flag == Addr->ipRouteInfo.re_frag_flag) &&
+        (Ep->ipRouteInfo.re_src_addr == Addr->ipRouteInfo.re_src_addr) &&
+        (Ep->ipRouteInfo.re_ire_type == Addr->ipRouteInfo.re_ire_type) &&
+        (Ep->ipRouteInfo.re_obpkt == Addr->ipRouteInfo.re_obpkt) &&
+        (Ep->ipRouteInfo.re_ibpkt == Addr->ipRouteInfo.re_ibpkt)
+        )
+        return (0);
+    else
+        return (1);             /* Not found */
+}
+
+u_char         *
+var_ipRouteEntry(struct variable * vp,
+                 oid * name,
+                 size_t * length,
+                 int exact, size_t * var_len, WriteMethod ** write_method)
+{
+    /*
+     * object identifier is of form:
+     * 1.3.6.1.2.1.4.21.1.1.A.B.C.D,  where A.B.C.D is IP address.
+     * IPADDR starts at offset 10.
+     */
+#define IP_ROUTENAME_LENGTH	14
+#define	IP_ROUTEADDR_OFF	10
+    oid             current[IP_ROUTENAME_LENGTH],
+        lowest[IP_ROUTENAME_LENGTH];
+    u_char         *cp;
+    oid            *op;
+    mib2_ipRouteEntry_t Lowentry, Nextentry, entry;
+    int             Found = 0;
+    req_e           req_type;
+
+    /*
+     * fill in object part of name for current (less sizeof instance part) 
+     */
+
+    memcpy((char *) current, (char *) vp->name, vp->namelen * sizeof(oid));
+    if (*length == IP_ROUTENAME_LENGTH) /* Assume that the input name is the lowest */
+        memcpy((char *) lowest, (char *) name,
+               IP_ROUTENAME_LENGTH * sizeof(oid));
+    else
+        name[IP_ROUTEADDR_OFF] = (oid) - 1;     /* Grhhh: to prevent accidental comparison :-( */
+    for (Nextentry.ipRouteDest = (u_long) - 2, req_type = GET_FIRST;;
+         Nextentry = entry, req_type = GET_NEXT) {
+        if (getMibstat(MIB_IP_ROUTE, &entry, sizeof(mib2_ipRouteEntry_t),
+                       req_type, &IP_Cmp_Route, &Nextentry) != 0)
+            break;
+        COPY_IPADDR(cp, (u_char *) & entry.ipRouteDest, op,
+                    current + IP_ROUTEADDR_OFF);
+        if (exact) {
+            if (snmp_oid_compare
+                (current, IP_ROUTENAME_LENGTH, name, *length) == 0) {
+                memcpy((char *) lowest, (char *) current,
+                       IP_ROUTENAME_LENGTH * sizeof(oid));
+                Lowentry = entry;
+                Found++;
+                break;          /* no need to search further */
+            }
+        } else {
+            if ((snmp_oid_compare
+                 (current, IP_ROUTENAME_LENGTH, name, *length) > 0)
+                && ((Nextentry.ipRouteDest == (u_long) - 2)
+                    ||
+                    (snmp_oid_compare
+                     (current, IP_ROUTENAME_LENGTH, lowest,
+                      IP_ROUTENAME_LENGTH) < 0)
+                    ||
+                    (snmp_oid_compare
+                     (name, IP_ROUTENAME_LENGTH, lowest,
+                      IP_ROUTENAME_LENGTH) == 0))) {
+
+                /*
+                 * if new one is greater than input and closer to input than
+                 * * previous lowest, and is not equal to it, save this one as the "next" one.
+                 */
+                memcpy((char *) lowest, (char *) current,
+                       IP_ROUTENAME_LENGTH * sizeof(oid));
+                Lowentry = entry;
+                Found++;
+            }
+        }
+    }
+    if (Found == 0)
+        return (NULL);
+    memcpy((char *) name, (char *) lowest,
+           IP_ROUTENAME_LENGTH * sizeof(oid));
+    *length = IP_ROUTENAME_LENGTH;
+    *write_method = write_rte;
+    *var_len = sizeof(long_return);
+
+    switch (vp->magic) {
+    case IPROUTEDEST:
+        long_return = Lowentry.ipRouteDest;
+        return (u_char *) & long_return;
+    case IPROUTEIFINDEX:
+        long_return =
+            Interface_Index_By_Name(Lowentry.ipRouteIfIndex.o_bytes,
+                                    Lowentry.ipRouteIfIndex.o_length);
+        return (u_char *) & long_return;
+    case IPROUTEMETRIC1:
+        long_return = Lowentry.ipRouteMetric1;
+        return (u_char *) & long_return;
+    case IPROUTEMETRIC2:
+        long_return = Lowentry.ipRouteMetric2;
+        return (u_char *) & long_return;
+    case IPROUTEMETRIC3:
+        long_return = Lowentry.ipRouteMetric3;
+        return (u_char *) & long_return;
+    case IPROUTEMETRIC4:
+        long_return = Lowentry.ipRouteMetric4;
+        return (u_char *) & long_return;
+    case IPROUTENEXTHOP:
+        long_return = Lowentry.ipRouteNextHop;
+        return (u_char *) & long_return;
+    case IPROUTETYPE:
+        long_return = Lowentry.ipRouteType;
+        return (u_char *) & long_return;
+    case IPROUTEPROTO:
+        long_return = Lowentry.ipRouteProto;
+        if (long_return == -1)
+            long_return = 1;
+        return (u_char *) & long_return;
+    case IPROUTEAGE:
+        long_return = Lowentry.ipRouteAge;
+        return (u_char *) & long_return;
+    case IPROUTEMASK:
+        long_return = Lowentry.ipRouteMask;
+        return (u_char *) & long_return;
+    default:
+        DEBUGMSGTL(("snmpd", "unknown sub-id %d in var_ipRouteEntry\n",
+                    vp->magic));
+    };
+    return NULL;
+}
+
+#endif                          /* solaris2 - var_IProute */
+
+#ifndef solaris2
+static int      qsort_compare(const void *, const void *);
+#endif
+
+#if defined(RTENTRY_4_4) || defined(RTENTRY_RT_NEXT)
+
+#if defined(RTENTRY_4_4) && !defined(hpux11)
+void
+load_rtentries(struct radix_node *pt)
+{
+    struct radix_node node;
+    RTENTRY         rt;
+    struct ifnet    ifnet;
+    char            name[16], temp[16];
+#if !STRUCT_IFNET_HAS_IF_XNAME
+    register char  *cp;
+#endif
+
+    if (!klookup
+        ((unsigned long) pt, (char *) &node, sizeof(struct radix_node))) {
+        DEBUGMSGTL(("mibII/var_route", "Fail\n"));
+        return;
+    }
+    if (node.rn_b >= 0) {
+        load_rtentries(node.rn_r);
+        load_rtentries(node.rn_l);
+    } else {
+        if (node.rn_flags & RNF_ROOT) {
+            /*
+             * root node 
+             */
+            if (node.rn_dupedkey)
+                load_rtentries(node.rn_dupedkey);
+            return;
+        }
+        /*
+         * get the route 
+         */
+        klookup((unsigned long) pt, (char *) &rt, sizeof(RTENTRY));
+
+        if (rt.rt_ifp != 0) {
+            klookup((unsigned long) rt.rt_ifp, (char *) &ifnet,
+                    sizeof(ifnet));
+#if STRUCT_IFNET_HAS_IF_XNAME
+#if defined(netbsd1) || defined(openbsd2)
+            strncpy(name, ifnet.if_xname, sizeof name);
+#else
+            klookup((unsigned long) ifnet.if_xname, name, sizeof name);
+#endif
+            name[sizeof(name) - 1] = '\0';
+#else
+            klookup((unsigned long) ifnet.if_name, name, sizeof name);
+            name[sizeof(name) - 1] = '\0';
+            cp = (char *) strchr(name, '\0');
+            string_append_int(cp, ifnet.if_unit);
+#endif
+            Interface_Scan_Init();
+            rt.rt_unit = 0;
+            while (Interface_Scan_Next
+                   ((short *) &(rt.rt_unit), temp, NULL, NULL) != 0) {
+                if (strcmp(name, temp) == 0)
+                    break;
+            }
+        }
+#if CHECK_RT_FLAGS
+        if (((rt.rt_flags & RTF_CLONING) != RTF_CLONING)
+            && ((rt.rt_flags & RTF_LLINFO) != RTF_LLINFO)) {
+#endif
+            /*
+             * check for space and malloc 
+             */
+            if (rtsize >= rtallocate) {
+                rthead =
+                    (RTENTRY **) realloc((char *) rthead,
+                                         2 * rtallocate *
+                                         sizeof(RTENTRY *));
+                memset((char *) &rthead[rtallocate], (0),
+                       rtallocate * sizeof(RTENTRY *));
+
+                rtallocate *= 2;
+            }
+            if (!rthead[rtsize])
+                rthead[rtsize] = (RTENTRY *) malloc(sizeof(RTENTRY));
+            /*
+             *      Add this to the database
+             */
+            memcpy((char *) rthead[rtsize], (char *) &rt, sizeof(RTENTRY));
+            rtsize++;
+#if CHECK_RT_FLAGS
+        }
+#endif
+
+        if (node.rn_dupedkey)
+            load_rtentries(node.rn_dupedkey);
+    }
+}
+#endif                          /* RTENTRY_4_4 && !hpux11 */
+
+static void
+Route_Scan_Reload(void)
+{
+#ifdef hpux11
+
+    int             fd;
+    struct nmparms  p;
+    int             val;
+    unsigned int    ulen;
+    int             ret;
+
+    if (rt)
+        free(rt);
+    rt = (mib_ipRouteEnt *) 0;
+    rtsize = 0;
+
+    if ((fd = open_mib("/dev/ip", O_RDONLY, 0, NM_ASYNC_OFF)) >= 0) {
+        p.objid = ID_ipRouteNumEnt;
+        p.buffer = (void *) &val;
+        ulen = sizeof(int);
+        p.len = &ulen;
+        if ((ret = get_mib_info(fd, &p)) == 0)
+            rtsize = val;
+
+        if (rtsize > 0) {
+            ulen = (unsigned) rtsize *sizeof(mib_ipRouteEnt);
+            rt = (mib_ipRouteEnt *) malloc(ulen);
+            p.objid = ID_ipRouteTable;
+            p.buffer = (void *) rt;
+            p.len = &ulen;
+            if ((ret = get_mib_info(fd, &p)) < 0)
+                rtsize = 0;
+        }
+
+        close_mib(fd);
+    }
+
+    /*
+     *  Sort it!
+     */
+    qsort((char *) rt, rtsize, sizeof(rt[0]),
+#ifdef __STDC__
+          (int (*)(const void *, const void *)) qsort_compare
+#else
+          qsort_compare
+#endif
+        );
+
+#else                           /* hpux11 */
+#if defined(RTENTRY_4_4)
+    struct radix_node_head head, *rt_table[AF_MAX + 1];
+    int             i;
+#else
+    RTENTRY       **routehash, mb;
+    register RTENTRY *m;
+    RTENTRY        *rt;
+    struct ifnet    ifnet;
+    int             i, table;
+    register char  *cp;
+    char            name[16], temp[16];
+    int             hashsize;
+#endif
+    static int      Time_Of_Last_Reload = 0;
+    struct timeval  now;
+
+    gettimeofday(&now, (struct timezone *) 0);
+    if (Time_Of_Last_Reload + CACHE_TIME > now.tv_sec)
+        return;
+    Time_Of_Last_Reload = now.tv_sec;
+
+    /*
+     * *  Makes sure we have SOME space allocated for new routing entries
+     */
+    if (!rthead) {
+        rthead = (RTENTRY **) malloc(100 * sizeof(RTENTRY *));
+        if (!rthead) {
+            snmp_log(LOG_ERR, "route table malloc fail\n");
+            return;
+        }
+        memset((char *) rthead, (0), 100 * sizeof(RTENTRY *));
+        rtallocate = 100;
+    }
+
+    /*
+     * reset the routing table size to zero -- was a CMU memory leak 
+     */
+    rtsize = 0;
+
+#ifdef RTENTRY_4_4
+    /*
+     * rtentry is a BSD 4.4 compat 
+     */
+
+#if !defined(AF_UNSPEC)
+#define AF_UNSPEC AF_INET
+#endif
+
+    auto_nlist(RTTABLES_SYMBOL, (char *) rt_table, sizeof(rt_table));
+    for (i = 0; i <= AF_MAX; i++) {
+        if (rt_table[i] == 0)
+            continue;
+        if (klookup
+            ((unsigned long) rt_table[i], (char *) &head, sizeof(head))) {
+            load_rtentries(head.rnh_treetop);
+        }
+    }
+
+#else                           /* rtentry is a BSD 4.3 compat */
+    for (table = 0; table < NUM_ROUTE_SYMBOLS; table++) {
+        auto_nlist(RTHASHSIZE_SYMBOL, (char *) &hashsize,
+                   sizeof(hashsize));
+        routehash = (RTENTRY **) malloc(hashsize * sizeof(struct mbuf *));
+        auto_nlist(route_symbols[table], (char *) routehash,
+                   hashsize * sizeof(struct mbuf *));
+        for (i = 0; i < hashsize; i++) {
+            if (routehash[i] == 0)
+                continue;
+            m = routehash[i];
+            while (m) {
+                /*
+                 *      Dig the route out of the kernel...
+                 */
+                klookup(m, (char *) &mb, sizeof(mb));
+                m = mb.rt_next;
+
+                rt = &mb;
+                if (rt->rt_ifp != 0) {
+                    klookup(rt->rt_ifp, (char *) &ifnet, sizeof(ifnet));
+                    klookup(ifnet.if_name, name, 16);
+                    name[15] = '\0';
+                    cp = (char *) strchr(name, '\0');
+                    string_append_int(cp, ifnet.if_unit);
+
+                    Interface_Scan_Init();
+                    while (Interface_Scan_Next
+                           ((short *) &rt->rt_unit, temp, NULL,
+                            NULL) != 0) {
+                        if (strcmp(name, temp) == 0)
+                            break;
+                    }
+                }
+                /*
+                 *      Allocate a block to hold it and add it to the database
+                 */
+                if (rtsize >= rtallocate) {
+                    rthead =
+                        (RTENTRY **) realloc((char *) rthead,
+                                             2 * rtallocate *
+                                             sizeof(RTENTRY *));
+                    memset((char *) &rthead[rtallocate], (0),
+                           rtallocate * sizeof(RTENTRY *));
+
+                    rtallocate *= 2;
+                }
+                if (!rthead[rtsize])
+                    rthead[rtsize] = (RTENTRY *) malloc(sizeof(RTENTRY));
+                /*
+                 *      Add this to the database
+                 */
+                memcpy((char *) rthead[rtsize], (char *) rt,
+                       sizeof(RTENTRY));
+                rtsize++;
+            }
+        }
+        free(routehash);
+    }
+#endif
+    /*
+     *  Sort it!
+     */
+    qsort((char *) rthead, rtsize, sizeof(rthead[0]),
+#ifdef __STDC__
+          (int (*)(const void *, const void *)) qsort_compare
+#else
+          qsort_compare
+#endif
+        );
+#endif                          /* hpux11 */
+}
+
+#else
+
+#if HAVE_SYS_MBUF_H
+static void
+Route_Scan_Reload(void)
+{
+    struct mbuf   **routehash, mb;
+    register struct mbuf *m;
+    struct ifnet    ifnet;
+    RTENTRY        *rt;
+    int             i, table;
+    register char  *cp;
+    char            name[16], temp[16];
+    static int      Time_Of_Last_Reload = 0;
+    struct timeval  now;
+    int             hashsize;
+
+    gettimeofday(&now, (struct timezone *) 0);
+    if (Time_Of_Last_Reload + CACHE_TIME > now.tv_sec)
+        return;
+    Time_Of_Last_Reload = now.tv_sec;
+
+    /*
+     *  Makes sure we have SOME space allocated for new routing entries
+     */
+    if (!rthead) {
+        rthead = (RTENTRY **) malloc(100 * sizeof(RTENTRY *));
+        if (!rthead) {
+            snmp_log(LOG_ERR, "route table malloc fail\n");
+            return;
+        }
+        memset((char *) rthead, (0), 100 * sizeof(RTENTRY *));
+        rtallocate = 100;
+    }
+
+    /*
+     * reset the routing table size to zero -- was a CMU memory leak 
+     */
+    rtsize = 0;
+
+    for (table = 0; table < NUM_ROUTE_SYMBOLS; table++) {
+#ifdef sunV3
+        hashsize = RTHASHSIZ;
+#else
+        auto_nlist(RTHASHSIZE_SYMBOL, (char *) &hashsize,
+                   sizeof(hashsize));
+#endif
+        routehash =
+            (struct mbuf **) malloc(hashsize * sizeof(struct mbuf *));
+        auto_nlist(route_symbols[table], (char *) routehash,
+                   hashsize * sizeof(struct mbuf *));
+        for (i = 0; i < hashsize; i++) {
+            if (routehash[i] == 0)
+                continue;
+            m = routehash[i];
+            while (m) {
+                /*
+                 *  Dig the route out of the kernel...
+                 */
+                klookup((unsigned long) m, (char *) &mb, sizeof(mb));
+                m = mb.m_next;
+                rt = mtod(&mb, RTENTRY *);
+
+                if (rt->rt_ifp != 0) {
+
+                    klookup((unsigned long) rt->rt_ifp, (char *) &ifnet,
+                            sizeof(ifnet));
+                    klookup((unsigned long) ifnet.if_name, name, 16);
+                    name[15] = '\0';
+                    cp = (char *) strchr(name, '\0');
+                    string_append_int(cp, ifnet.if_unit);
+                    if (strcmp(name, "lo0") == 0)
+                        continue;
+
+                    Interface_Scan_Init();
+                    while (Interface_Scan_Next
+                           ((short *) &rt->rt_unit, temp, NULL,
+                            NULL) != 0) {
+                        if (strcmp(name, temp) == 0)
+                            break;
+                    }
+                }
+                /*
+                 *  Allocate a block to hold it and add it to the database
+                 */
+                if (rtsize >= rtallocate) {
+                    rthead =
+                        (RTENTRY **) realloc((char *) rthead,
+                                             2 * rtallocate *
+                                             sizeof(RTENTRY *));
+                    memset((char *) &rthead[rtallocate], (0),
+                           rtallocate * sizeof(RTENTRY *));
+
+                    rtallocate *= 2;
+                }
+                if (!rthead[rtsize])
+                    rthead[rtsize] = (RTENTRY *) malloc(sizeof(RTENTRY));
+                /*
+                 * *      Add this to the database
+                 */
+                memcpy((char *) rthead[rtsize], (char *) rt,
+                       sizeof(RTENTRY));
+                rtsize++;
+            }
+        }
+        free(routehash);
+    }
+    /*
+     *  Sort it!
+     */
+    qsort((char *) rthead, rtsize, sizeof(rthead[0]), qsort_compare);
+}
+#else
+#ifdef linux
+static void
+Route_Scan_Reload(void)
+{
+    FILE           *in;
+    char            line[256];
+    struct rtentry *rt;
+    char            name[16], temp[16];
+    static int      Time_Of_Last_Reload = 0;
+    struct timeval  now;
+
+    /*
+     * allow 20 seconds in cache: 
+     */
+    gettimeofday(&now, (struct timezone *) 0);
+    if (Time_Of_Last_Reload + 20 > now.tv_sec)
+        return;
+    Time_Of_Last_Reload = now.tv_sec;
+
+    /*
+     *  Makes sure we have SOME space allocated for new routing entries
+     */
+    if (!rthead) {
+        rthead = (struct rtentry **) calloc(100, sizeof(struct rtentry *));
+        if (!rthead) {
+            snmp_log(LOG_ERR, "route table malloc fail\n");
+            return;
+        }
+        rtallocate = 100;
+    }
+
+    /*
+     * fetch routes from the proc file-system:
+     */
+
+    rtsize = 0;
+
+    if (!(in = fopen("/proc/net/route", "r"))) {
+        snmp_log(LOG_ERR, "cannot open /proc/net/route - burps\n");
+        return;
+    }
+
+    while (fgets(line, sizeof(line), in)) {
+        struct rtentry  rtent;
+        char            rtent_name[32];
+        int             refcnt, flags, metric;
+        unsigned        use;
+
+        rt = &rtent;
+        memset((char *) rt, (0), sizeof(*rt));
+        rt->rt_dev = rtent_name;
+
+        /*
+         * as with 1.99.14:
+         * Iface Dest GW Flags RefCnt Use Metric Mask MTU Win IRTT
+         * eth0 0A0A0A0A 00000000 05 0 0 0 FFFFFFFF 1500 0 0 
+         */
+        if (8 != sscanf(line, "%s %x %x %x %u %d %d %x %*d %*d %*d\n",
+                        rt->rt_dev,
+                        &(((struct sockaddr_in *) &(rtent.rt_dst))->
+                          sin_addr.s_addr),
+                        &(((struct sockaddr_in *) &(rtent.rt_gateway))->
+                          sin_addr.s_addr),
+                        /*
+                         * XXX: fix type of the args 
+                         */
+                        &flags, &refcnt, &use, &metric,
+                        &(((struct sockaddr_in *) &(rtent.rt_genmask))->
+                          sin_addr.s_addr)))
+            continue;
+
+        strncpy(name, rt->rt_dev, sizeof(name));
+        name[ sizeof(name)-1 ] = 0;
+        /*
+         * linux says ``lo'', but the interface is stored as ``lo0'': 
+         */
+        if (!strcmp(name, "lo"))
+            strcat(name, "0");
+
+        rt->rt_flags = flags, rt->rt_refcnt = refcnt;
+        rt->rt_use = use, rt->rt_metric = metric;
+
+        Interface_Scan_Init();
+        while (Interface_Scan_Next
+               ((short *) &rt->rt_unit, temp, NULL, NULL) != 0)
+            if (strcmp(name, temp) == 0)
+                break;
+
+        /*
+         *  Allocate a block to hold it and add it to the database
+         */
+        if (rtsize >= rtallocate) {
+            rthead = (struct rtentry **) realloc((char *) rthead,
+                                                 2 * rtallocate *
+                                                 sizeof(struct rtentry *));
+            memset(&rthead[rtallocate], 0,
+                   rtallocate * sizeof(struct rtentry *));
+            rtallocate *= 2;
+        }
+        if (!rthead[rtsize])
+            rthead[rtsize] =
+                (struct rtentry *) malloc(sizeof(struct rtentry));
+        /*
+         *  Add this to the database
+         */
+        memcpy((char *) rthead[rtsize], (char *) rt,
+               sizeof(struct rtentry));
+        rtsize++;
+    }
+
+    fclose(in);
+
+    /*
+     *  Sort it!
+     */
+    qsort((char *) rthead, rtsize, sizeof(rthead[0]), qsort_compare);
+}
+#endif
+#endif
+#endif
+
+
+#ifndef solaris2
+/*
+ *      Create a host table
+ */
+#ifdef hpux11
+static int
+qsort_compare(const void *v1, const void *v2)
+{
+    mib_ipRouteEnt * const *r1 = (mib_ipRouteEnt * const *) v1;
+    mib_ipRouteEnt * const *r2 = (mib_ipRouteEnt * const *) v2;
+    /*
+     *      Do the comparison
+     */
+    if ((*r1)->Dest == (*r2)->Dest)
+        return (0);
+    if ((*r1)->Dest  > (*r2)->Dest)
+        return (1);
+    return (-1);
+}
+#else
+static int
+qsort_compare(const void *v1, const void *v2)
+{
+    RTENTRY * const *r1 = (RTENTRY * const *) v1;
+    RTENTRY * const *r2 = (RTENTRY * const *) v2;
+#if NEED_KLGETSA
+    register u_long dst1 =
+        ntohl(klgetsa((const struct sockaddr_in *) (*r1)->rt_dst)->
+              sin_addr.s_addr);
+    register u_long dst2 =
+        ntohl(klgetsa((const struct sockaddr_in *) (*r2)->rt_dst)->
+              sin_addr.s_addr);
+#else
+    register u_long dst1 =
+        ntohl(((const struct sockaddr_in *) &((*r1)->rt_dst))->sin_addr.
+              s_addr);
+    register u_long dst2 =
+        ntohl(((const struct sockaddr_in *) &((*r2)->rt_dst))->sin_addr.
+              s_addr);
+#endif                          /* NEED_KLGETSA */
+
+    /*
+     *      Do the comparison
+     */
+    if (dst1 == dst2)
+        return (0);
+    if (dst1 > dst2)
+        return (1);
+    return (-1);
+}
+#endif                          /* hpux11 */
+#endif                          /* not USE_SYSCTL_ROUTE_DUMP */
+
+#endif                          /* solaris2 */
+
+#else                           /* WIN32 */
+#include <iphlpapi.h>
+#ifndef MIB_IPPROTO_NETMGMT
+#define MIB_IPPROTO_NETMGMT 3
+#endif
+
+PMIB_IPFORWARDROW route_row;
+int             create_flag;
+void
+init_var_route(void)
+{
+}
+
+u_char         *
+var_ipRouteEntry(struct variable *vp,
+                 oid * name,
+                 size_t * length,
+                 int exact, size_t * var_len, WriteMethod ** write_method)
+{
+    /*
+     * object identifier is of form:
+     * 1.3.6.1.2.1.4.21.1.?.A.B.C.D,  where A.B.C.D is IP address.
+     * IPADDR starts at offset 10.
+     */
+    register int    Save_Valid, result, RtIndex;
+    static int      saveNameLen = 0, saveExact = 0, saveRtIndex =
+        0, rtsize = 0;
+    static oid      saveName[MAX_OID_LEN], Current[MAX_OID_LEN];
+    u_char         *cp;
+    oid            *op;
+    DWORD           status = NO_ERROR;
+    DWORD           dwActualSize = 0;
+    static PMIB_IPFORWARDTABLE pIpRtrTable = NULL;
+    struct timeval  now;
+    static long     Time_Of_Last_Reload = 0;
+    u_char          dest_addr[4];
+    MIB_IPFORWARDROW temp_row;
+
+
+    /** 
+     ** this optimisation fails, if there is only a single route avail.
+     ** it is a very special case, but better leave it out ...
+     **/
+#if NO_DUMMY_VALUES
+    saveNameLen = 0;
+#endif
+    if (route_row == NULL) {
+        /*
+         * Free allocated memory in case of SET request's FREE phase 
+         */
+        route_row = (PMIB_IPFORWARDROW) malloc(sizeof(MIB_IPFORWARDROW));
+    }
+    gettimeofday(&now, (struct timezone *) 0);
+    if ((rtsize <= 1) || (Time_Of_Last_Reload + 5 <= now.tv_sec))
+        Save_Valid = 0;
+    else
+        /*
+         *  OPTIMIZATION:
+         *
+         *  If the name was the same as the last name, with the possible
+         *  exception of the [9]th token, then don't read the routing table
+         *
+         */
+
+    if ((saveNameLen == (int) *length) && (saveExact == exact)) {
+        register int    temp = name[9];
+        name[9] = 0;
+        Save_Valid =
+            (snmp_oid_compare(name, *length, saveName, saveNameLen) == 0);
+        name[9] = temp;
+    } else
+        Save_Valid = 0;
+
+    if (Save_Valid) {
+        register int    temp = name[9]; /* Fix up 'lowest' found entry */
+        memcpy((char *) name, (char *) Current, 14 * sizeof(oid));
+        name[9] = temp;
+        *length = 14;
+        RtIndex = saveRtIndex;
+    } else {
+        /*
+         * fill in object part of name for current(less sizeof instance part) 
+         */
+
+        memcpy((char *) Current, (char *) vp->name,
+               (int) (vp->namelen) * sizeof(oid));
+
+
+        if ((Time_Of_Last_Reload + 5 <= now.tv_sec)
+            || (pIpRtrTable == NULL)) {
+            if (pIpRtrTable != NULL)
+                free(pIpRtrTable);
+            Time_Of_Last_Reload = now.tv_sec;
+            /*
+             * query for buffer size needed 
+             */
+            status = GetIpForwardTable(pIpRtrTable, &dwActualSize, TRUE);
+            if (status == ERROR_INSUFFICIENT_BUFFER) {
+                pIpRtrTable = (PMIB_IPFORWARDTABLE) malloc(dwActualSize);
+                if (pIpRtrTable != NULL) {
+                    /*
+                     * Get the sorted IP Route Table 
+                     */
+                    status =
+                        GetIpForwardTable(pIpRtrTable, &dwActualSize,
+                                          TRUE);
+                }
+            }
+        }
+        if (status == NO_ERROR) {
+            rtsize = pIpRtrTable->dwNumEntries;
+            for (RtIndex = 0; RtIndex < rtsize; RtIndex++) {
+                cp = (u_char *) & pIpRtrTable->table[RtIndex].
+                    dwForwardDest;
+                op = Current + 10;
+                *op++ = *cp++;
+                *op++ = *cp++;
+                *op++ = *cp++;
+                *op++ = *cp++;
+
+                result = snmp_oid_compare(name, *length, Current, 14);
+                if ((exact && (result == 0)) || (!exact && (result < 0)))
+                    break;
+            }
+        }
+        if (RtIndex >= rtsize) {
+            /*
+             * for creation of new row, only ipNetToMediaTable case is considered 
+             */
+            if (*length == 14) {
+                create_flag = 1;
+                *write_method = write_rte;
+                dest_addr[0] = (u_char) name[10];
+                dest_addr[1] = (u_char) name[11];
+                dest_addr[2] = (u_char) name[12];
+                dest_addr[3] = (u_char) name[13];
+                temp_row.dwForwardDest = *((DWORD *) dest_addr);
+                temp_row.dwForwardPolicy = 0;
+                temp_row.dwForwardProto = MIB_IPPROTO_NETMGMT;
+                *route_row = temp_row;
+            }
+            free(pIpRtrTable);
+            pIpRtrTable = NULL;
+            rtsize = 0;
+            return (NULL);
+        }
+        create_flag = 0;
+        /*
+         *  Save in the 'cache'
+         */
+        memcpy((char *) saveName, (char *) name,
+               SNMP_MIN(*length, MAX_OID_LEN) * sizeof(oid));
+        saveName[9] = 0;
+        saveNameLen = *length;
+        saveExact = exact;
+        saveRtIndex = RtIndex;
+
+        /*
+         *  Return the name
+         */
+        memcpy((char *) name, (char *) Current, 14 * sizeof(oid));
+        *length = 14;
+    }
+    *var_len = sizeof(long_return);
+    *route_row = pIpRtrTable->table[RtIndex];
+
+    switch (vp->magic) {
+    case IPROUTEDEST:
+        *write_method = write_rte;
+        long_return = pIpRtrTable->table[RtIndex].dwForwardDest;
+        return (u_char *) & long_return;
+    case IPROUTEIFINDEX:
+        *write_method = write_rte;
+        long_return = pIpRtrTable->table[RtIndex].dwForwardIfIndex;
+        return (u_char *) & long_return;
+    case IPROUTEMETRIC1:
+        *write_method = write_rte;
+        long_return = pIpRtrTable->table[RtIndex].dwForwardMetric1;
+        return (u_char *) & long_return;
+    case IPROUTEMETRIC2:
+        *write_method = write_rte;
+        long_return = pIpRtrTable->table[RtIndex].dwForwardMetric2;
+        return (u_char *) & long_return;
+    case IPROUTEMETRIC3:
+        *write_method = write_rte;
+        long_return = pIpRtrTable->table[RtIndex].dwForwardMetric3;
+        return (u_char *) & long_return;
+    case IPROUTEMETRIC4:
+        *write_method = write_rte;
+        long_return = pIpRtrTable->table[RtIndex].dwForwardMetric4;
+        return (u_char *) & long_return;
+    case IPROUTEMETRIC5:
+        *write_method = write_rte;
+        long_return = pIpRtrTable->table[RtIndex].dwForwardMetric5;
+        return (u_char *) & long_return;
+    case IPROUTENEXTHOP:
+        *write_method = write_rte;
+        long_return = pIpRtrTable->table[RtIndex].dwForwardNextHop;
+        return (u_char *) & long_return;
+    case IPROUTETYPE:
+        *write_method = write_rte;
+        long_return = pIpRtrTable->table[RtIndex].dwForwardType;
+        return (u_char *) & long_return;
+    case IPROUTEPROTO:
+        long_return = pIpRtrTable->table[RtIndex].dwForwardProto;
+        return (u_char *) & long_return;
+    case IPROUTEAGE:
+        *write_method = write_rte;
+        long_return = pIpRtrTable->table[RtIndex].dwForwardAge;
+        return (u_char *) & long_return;
+    case IPROUTEMASK:
+        *write_method = write_rte;
+        long_return = pIpRtrTable->table[RtIndex].dwForwardMask;
+        return (u_char *) & long_return;
+    case IPROUTEINFO:
+        *var_len = nullOidLen;
+        return (u_char *) nullOid;
+    default:
+        DEBUGMSGTL(("snmpd", "unknown sub-id %d in var_ipRouteEntry\n",
+                    vp->magic));
+    }
+    return NULL;
+}
+
+#endif                          /* WIN32 */
+
+#else                           /* CAN_USE_SYSCTL */
+
+#include <stddef.h>
+#include <stdlib.h>
+#include <syslog.h>
+#include <time.h>
+
+#include <sys/types.h>
+#include <sys/param.h>
+#include <sys/queue.h>
+#include <sys/socket.h>
+#include <sys/sysctl.h>
+#if HAVE_SYS_TIME_H
+#include <sys/time.h>
+#endif
+
+#include <net/if_dl.h>
+#if HAVE_SYS_STREAM_H
+#include <sys/stream.h>
+#endif
+#include <net/route.h>
+#include <netinet/in.h>
+
+#define CACHE_TIME (120)        /* Seconds */
+
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+#include "ip.h"
+#include "kernel.h"
+#include "interfaces.h"
+#include "struct.h"
+#include "util_funcs.h"
+
+static
+TAILQ_HEAD(, snmprt)
+    rthead;
+     static char    *rtbuf;
+     static size_t   rtbuflen;
+     static time_t   lasttime;
+
+     struct snmprt {
+         TAILQ_ENTRY(snmprt) link;
+         struct rt_msghdr *hdr;
+         struct in_addr  dest;
+         struct in_addr  gateway;
+         struct in_addr  netmask;
+         int             index;
+         struct in_addr  ifa;
+     };
+
+     static void
+                     rtmsg(struct rt_msghdr *rtm)
+{
+    struct snmprt  *rt;
+    struct sockaddr *sa;
+    int             bit, gotdest, gotmask;
+
+    rt = malloc(sizeof *rt);
+    if (rt == 0)
+        return;
+    rt->hdr = rtm;
+    rt->ifa.s_addr = 0;
+    rt->dest = rt->gateway = rt->netmask = rt->ifa;
+    rt->index = rtm->rtm_index;
+
+    gotdest = gotmask = 0;
+    sa = (struct sockaddr *) (rtm + 1);
+    for (bit = 1; ((char *) sa < (char *) rtm + rtm->rtm_msglen) && bit;
+         bit <<= 1) {
+        if ((rtm->rtm_addrs & bit) == 0)
+            continue;
+        switch (bit) {
+        case RTA_DST:
+#define satosin(sa) ((struct sockaddr_in *)(sa))
+            rt->dest = satosin(sa)->sin_addr;
+            gotdest = 1;
+            break;
+        case RTA_GATEWAY:
+            if (sa->sa_family == AF_INET)
+                rt->gateway = satosin(sa)->sin_addr;
+            break;
+        case RTA_NETMASK:
+            if (sa->sa_len >= offsetof(struct sockaddr_in, sin_addr))
+                                rt->netmask = satosin(sa)->sin_addr;
+            gotmask = 1;
+            break;
+        case RTA_IFA:
+            if (sa->sa_family == AF_INET)
+                rt->ifa = satosin(sa)->sin_addr;
+            break;
+        }
+        /*
+         * from rtsock.c 
+         */
+#define ROUNDUP(a) \
+        ((a) > 0 ? (1 + (((a) - 1) | (sizeof(long) - 1))) : sizeof(long))
+        sa = (struct sockaddr *) ((char *) sa + ROUNDUP(sa->sa_len));
+    }
+    if (!gotdest) {
+        /*
+         * XXX can't happen if code above is correct 
+         */
+        snmp_log(LOG_ERR, "route no dest?\n");
+        free(rt);
+    } else {
+        /*
+         * If no mask provided, it was a host route. 
+         */
+        if (!gotmask)
+            rt->netmask.s_addr = ~0;
+        TAILQ_INSERT_TAIL(&rthead, rt, link);
+    }
+}
+
+static int
+suck_krt(int force)
+{
+    time_t          now;
+    struct snmprt  *rt, *next;
+    size_t          len;
+    static int      name[6] =
+        { CTL_NET, PF_ROUTE, 0, AF_INET, NET_RT_DUMP, 0 };
+    char           *cp;
+    struct rt_msghdr *rtm;
+
+    time(&now);
+    if (now < (lasttime + CACHE_TIME) && !force)
+        return 0;
+    lasttime = now;
+
+    for (rt = rthead.tqh_first; rt; rt = next) {
+        next = rt->link.tqe_next;
+        free(rt);
+    }
+    TAILQ_INIT(&rthead);
+
+    if (sysctl(name, 6, 0, &len, 0, 0) < 0) {
+        syslog(LOG_WARNING, "sysctl net-route-dump: %m");
+        return -1;
+    }
+
+    if (len > rtbuflen) {
+        char           *newbuf;
+        newbuf = realloc(rtbuf, len);
+        if (newbuf == 0)
+            return -1;
+        rtbuf = newbuf;
+        rtbuflen = len;
+    }
+
+    if (sysctl(name, 6, rtbuf, &len, 0, 0) < 0) {
+        syslog(LOG_WARNING, "sysctl net-route-dump: %m");
+        return -1;
+    }
+
+    cp = rtbuf;
+    while (cp < rtbuf + len) {
+        rtm = (struct rt_msghdr *) cp;
+        /*
+         * NB:
+         * You might want to exclude routes with RTF_WASCLONED
+         * set.  This keeps the cloned host routes (and thus also
+         * ARP entries) out of the routing table.  Thus, it also
+         * presents management stations with an incomplete view.
+         * I believe that it should be possible for a management
+         * station to examine (and perhaps delete) such routes.
+         */
+        if (rtm->rtm_version == RTM_VERSION && rtm->rtm_type == RTM_GET)
+            rtmsg(rtm);
+        cp += rtm->rtm_msglen;
+    }
+    return 0;
+}
+
+u_char         *
+var_ipRouteEntry(struct variable * vp,
+                 oid * name,
+                 size_t * length,
+                 int exact, size_t * var_len, WriteMethod ** write_method)
+{
+    /*
+     * object identifier is of form:
+     * 1.3.6.1.2.1.4.21.1.1.A.B.C.D,  where A.B.C.D is IP address.
+     * IPADDR starts at offset 10.
+     */
+    int             Save_Valid, result;
+    u_char         *cp;
+    oid            *op;
+    struct snmprt  *rt;
+    static struct snmprt *savert;
+    static int      saveNameLen, saveExact;
+    static oid      saveName[14], Current[14];
+
+#if 0
+    /*
+     *      OPTIMIZATION:
+     *
+     *      If the name was the same as the last name, with the possible
+     *      exception of the [9]th token, then don't read the routing table
+     *
+     */
+
+    if ((saveNameLen == *length) && (saveExact == exact)) {
+        int             temp = name[9];
+        name[9] = 0;
+        Save_Valid =
+            !snmp_oid_compare(name, *length, saveName, saveNameLen);
+        name[9] = temp;
+    } else {
+        Save_Valid = 0;
+    }
+#else
+    Save_Valid = 0;
+#endif
+
+    if (Save_Valid) {
+        int             temp = name[9];
+        memcpy(name, Current, 14 * sizeof(oid));
+        name[9] = temp;
+        *length = 14;
+        rt = savert;
+    } else {
+        /*
+         * fill in object part of name for current
+         * (less sizeof instance part) 
+         */
+
+        memcpy(Current, vp->name, SNMP_MIN(sizeof(Current), (int)(vp->namelen) * sizeof(oid)));
+
+        suck_krt(0);
+
+        for (rt = rthead.tqh_first; rt; rt = rt->link.tqe_next) {
+            op = Current + 10;
+            cp = (u_char *) & rt->dest;
+            *op++ = *cp++;
+            *op++ = *cp++;
+            *op++ = *cp++;
+            *op++ = *cp++;
+            result = snmp_oid_compare(name, *length, Current, 14);
+            if ((exact && (result == 0))
+                || (!exact && (result < 0)))
+                break;
+        }
+        if (rt == NULL)
+            return NULL;
+
+        /*
+         *  Save in the 'cache'
+         */
+        memcpy(saveName, name, SNMP_MIN(sizeof(saveName), *length * sizeof(oid)));
+        saveName[9] = 0;
+        saveNameLen = *length;
+        saveExact = exact;
+        savert = rt;
+
+        /*
+         *  Return the name
+         */
+        memcpy(name, Current, 14 * sizeof(oid));
+        *length = 14;
+    }
+
+    *write_method = write_rte;
+    *var_len = sizeof long_return;
+
+    switch (vp->magic) {
+    case IPROUTEDEST:
+        long_return = rt->dest.s_addr;
+        return (u_char *) & long_return;
+
+    case IPROUTEIFINDEX:
+        long_return = rt->index;
+        return (u_char *) & long_return;
+
+    case IPROUTEMETRIC1:
+        long_return = (rt->hdr->rtm_flags & RTF_GATEWAY) ? 1 : 0;
+        return (u_char *) & long_return;
+    case IPROUTEMETRIC2:
+        long_return = rt->hdr->rtm_rmx.rmx_rtt;
+        return (u_char *) & long_return;
+    case IPROUTEMETRIC3:
+        long_return = rt->hdr->rtm_rmx.rmx_rttvar;
+        return (u_char *) & long_return;
+    case IPROUTEMETRIC4:
+        long_return = rt->hdr->rtm_rmx.rmx_ssthresh;
+        return (u_char *) & long_return;
+    case IPROUTEMETRIC5:
+        long_return = rt->hdr->rtm_rmx.rmx_mtu;
+        return (u_char *) & long_return;
+
+    case IPROUTENEXTHOP:
+        if (rt->gateway.s_addr == 0 && rt->ifa.s_addr == 0)
+            long_return = 0;
+        else if (rt->gateway.s_addr == 0)
+            long_return = rt->ifa.s_addr;
+        else
+            long_return = rt->gateway.s_addr;
+        return (u_char *) & long_return;
+
+    case IPROUTETYPE:
+        if (rt->hdr->rtm_flags & RTF_UP) {
+            if (rt->hdr->rtm_flags & RTF_GATEWAY) {
+                long_return = 4;        /*  indirect(4)  */
+            } else {
+                long_return = 3;        /*  direct(3)  */
+            }
+        } else {
+            long_return = 2;    /*  invalid(2)  */
+        }
+        return (u_char *) & long_return;
+
+    case IPROUTEPROTO:
+        long_return = (rt->hdr->rtm_flags & RTF_DYNAMIC) ? 4 : 2;
+        return (u_char *) & long_return;
+
+    case IPROUTEAGE:
+#if NO_DUMMY_VALUES
+        return NULL;
+#endif
+        long_return = 0;
+        return (u_char *) & long_return;
+
+    case IPROUTEMASK:
+        long_return = rt->netmask.s_addr;
+        return (u_char *) & long_return;
+
+    case IPROUTEINFO:
+        *var_len = nullOidLen;
+        return (u_char *) nullOid;
+    default:
+        DEBUGMSGTL(("snmpd", "unknown sub-id %d in var_ipRouteEntry\n",
+                    vp->magic));
+    }
+    return NULL;
+}
+
+void
+init_var_route(void)
+{
+    ;
+}
+
+#endif                          /* CAN_USE_SYSCTL */
+
+#if defined(HAVE_SYS_SYSCTL_H) && !defined(linux)
+/*
+ * get_address()
+ * 
+ * Traverse the address structures after a routing socket message and
+ * extract a specific one.
+ * 
+ * Some of this is peculiar to IRIX 6.2, which doesn't have sa_len in
+ * the sockaddr structure yet.  With sa_len, skipping an address entry
+ * would be much easier.
+ */
+#include <sys/un.h>
+
+/*
+ * returns the length of a socket structure 
+ */
+
+size_t
+snmp_socket_length(int family)
+{
+    size_t          length;
+
+    switch (family) {
+#ifndef cygwin
+#ifndef WIN32
+#ifdef AF_UNIX
+    case AF_UNIX:
+        length = sizeof(struct sockaddr_un);
+        break;
+#endif                          /* AF_UNIX */
+#endif
+#endif
+
+#ifndef aix3
+#ifdef AF_LINK
+    case AF_LINK:
+#ifdef _MAX_SA_LEN
+        length = _MAX_SA_LEN;
+#elif SOCK_MAXADDRLEN
+        length = SOCK_MAXADDRLEN;
+#else
+        length = sizeof(struct sockaddr_dl);
+#endif
+        break;
+#endif                          /* AF_LINK */
+#endif
+
+    case AF_INET:
+        length = sizeof(struct sockaddr_in);
+        break;
+    default:
+        length = sizeof(struct sockaddr);
+        break;
+    }
+
+    return length;
+}
+
+const struct sockaddr *
+get_address(const void *_ap, int addresses, int wanted)
+{
+    const struct sockaddr *ap = (const struct sockaddr *) _ap;
+    int             iindex;
+    int             bitmask;
+
+    for (iindex = 0, bitmask = 1;
+         iindex < RTAX_MAX; ++iindex, bitmask <<= 1) {
+        if (bitmask == wanted) {
+            if (bitmask & addresses) {
+                return ap;
+            } else {
+                return 0;
+            }
+        } else if (bitmask & addresses) {
+            unsigned        length =
+                (unsigned) snmp_socket_length(ap->sa_family);
+            while (length % sizeof(long) != 0)
+                ++length;
+            ap = (const struct sockaddr *) ((const char *) ap + length);
+        }
+    }
+    return 0;
+}
+
+/*
+ * get_in_address()
+ * 
+ * Convenience function for the special case of get_address where an
+ * AF_INET address is desired, and we're only interested in the in_addr
+ * part.
+ */
+const struct in_addr *
+get_in_address(const void *ap, int addresses, int wanted)
+{
+    const struct sockaddr_in *a;
+
+    a = (const struct sockaddr_in *) get_address(ap, addresses, wanted);
+    if (a == NULL)
+        return NULL;
+
+    if (a->sin_family != AF_INET) {
+        DEBUGMSGTL(("snmpd",
+                    "unknown socket family %d [AF_INET expected] in var_ipRouteEntry.\n",
+                    a->sin_family));
+    }
+    return &a->sin_addr;
+}
+#endif                          /* HAVE_SYS_SYSCTL_H */
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/mibII/var_route.h tomato121/release/src/router/snmp/agent/mibgroup/mibII/var_route.h
--- tomato/release/src/router/snmp/agent/mibgroup/mibII/var_route.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/mibII/var_route.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,22 @@
+/*
+ *  Template MIB group interface - var_route.h
+ *
+ */
+#ifndef _MIBGROUP_VAR_ROUTE_H
+#define _MIBGROUP_VAR_ROUTE_H
+
+config_require(mibII/ip util_funcs)
+    config_arch_require(solaris2, kernel_sunos5)
+
+     void            init_var_route(void);
+#if defined(RTENTRY_4_4) && !defined(hpux11)
+     struct radix_node;
+     void            load_rtentries(struct radix_node *);
+#endif
+#if defined(freebsd2) || defined(netbsd1) || defined(bsdi2) || defined(openbsd2)
+     struct sockaddr_in *klgetsa(struct sockaddr_in *);
+#endif
+
+     extern FindVarMethod var_ipRouteEntry;
+
+#endif                          /* _MIBGROUP_VAR_ROUTE_H */
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/mibII.h tomato121/release/src/router/snmp/agent/mibgroup/mibII.h
--- tomato/release/src/router/snmp/agent/mibgroup/mibII.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/mibII.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,15 @@
+/*
+ * module to include the modules relavent to the mib-II mib(s) 
+ */
+
+config_require(mibII/system_mib)
+config_require(mibII/sysORTable)
+config_require(mibII/at)
+config_require(mibII/interfaces)
+config_require(mibII/snmp_mib)
+config_require(mibII/tcp)
+config_require(mibII/icmp)
+config_require(mibII/ip)
+config_require(mibII/udp)
+config_require(mibII/vacm_vars)
+config_require(mibII/setSerialNo)
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/mibincl.h tomato121/release/src/router/snmp/agent/mibgroup/mibincl.h
--- tomato/release/src/router/snmp/agent/mibgroup/mibincl.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/mibincl.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,52 @@
+/*
+ * mibincl.h
+ */
+
+#include <stdio.h>
+#include <sys/types.h>
+
+#if HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#if HAVE_MALLOC_H
+#include <malloc.h>
+#endif
+#if TIME_WITH_SYS_TIME
+# ifdef WIN32
+#  include <sys/timeb.h>
+# else
+#  include <sys/time.h>
+# endif
+# include <time.h>
+#else
+# if HAVE_SYS_TIME_H
+#  include <sys/time.h>
+# else
+#  include <time.h>
+# endif
+#endif
+
+#include <net-snmp/agent/mib_module_config.h>
+
+#include <net-snmp/library/asn1.h>
+#include <net-snmp/library/snmp_api.h>
+#include <net-snmp/library/snmp_impl.h>
+#include <net-snmp/library/snmp_client.h>
+
+#include <net-snmp/agent/snmp_vars.h>
+#include <net-snmp/agent/agent_read_config.h>
+#include <net-snmp/agent/agent_handler.h>
+#include <net-snmp/agent/agent_registry.h>
+#include <net-snmp/agent/var_struct.h>
+
+#include <net-snmp/library/snmp.h>
+#include <net-snmp/library/mib.h>
+#include <net-snmp/library/snmp_debug.h>
+#include <net-snmp/library/snmp_logging.h>
+#include <net-snmp/library/snmp_alarm.h>
+#include <net-snmp/library/read_config.h>
+#include <net-snmp/library/tools.h>
+#include <net-snmp/agent/agent_trap.h>
+#include <net-snmp/library/callback.h>
+#define u_char unsigned char
+#define u_short unsigned short
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/misc/.cvsignore tomato121/release/src/router/snmp/agent/mibgroup/misc/.cvsignore
--- tomato/release/src/router/snmp/agent/mibgroup/misc/.cvsignore	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/misc/.cvsignore	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,2 @@
+.libs
+*.lo
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/misc/dlmod.c tomato121/release/src/router/snmp/agent/mibgroup/misc/dlmod.c
--- tomato/release/src/router/snmp/agent/mibgroup/misc/dlmod.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/misc/dlmod.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,282 @@
+#include <net-snmp/net-snmp-config.h>
+
+#if HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#include <stdio.h>
+#if HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+#if HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#include <ctype.h>
+#if HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+
+#include <dlfcn.h>
+
+
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+#include "struct.h"
+
+#include "dlmod.h"
+
+static struct dlmod *dlmods = NULL;
+
+int             dlmod_next_index = 1;
+
+static void     dlmod_parse_config(char *, char *);
+static void     dlmod_free_config(void);
+static char     dlmod_path[1024];
+
+void
+init_dlmod(void)
+{
+    char           *p;
+    int             l;
+
+    snmpd_register_config_handler("dlmod", dlmod_parse_config,
+                                  dlmod_free_config, "dlmod-file-to-load");
+
+    p = getenv("SNMP_DLMOD_PATH");
+    strncpy(dlmod_path, DLMOD_DEFAULT_PATH, sizeof(dlmod_path));
+    if (p) {
+        if (p[0] == '+') {
+            l = strlen(dlmod_path);
+            if (dlmod_path[l - 1] != ':')
+                strncat(dlmod_path, ":", sizeof(dlmod_path) - l);
+            strncat(dlmod_path, p + 1,
+                    sizeof(dlmod_path) - strlen(dlmod_path));
+        } else
+            strncpy(dlmod_path, p, sizeof(dlmod_path));
+    }
+#if 1
+    DEBUGMSGTL(("dlmod", "dlmod_path: %s\n", dlmod_path));
+#endif
+}
+
+void
+deinit_dlmod(void)
+{
+    snmpd_unregister_config_handler("dlmod");
+}
+
+static void
+dlmod_parse_config(char *token, char *cptr)
+{
+    char           *dlm_name, *dlm_path;
+    struct dlmod   *dlm;
+
+    if (cptr == NULL) {
+        config_perror("Bad dlmod line");
+        return;
+    }
+    /*
+     * remove comments 
+     */
+    *(cptr + strcspn(cptr, "#;\r\n")) = '\0';
+
+    dlm = dlmod_create_module();
+    if (!dlm)
+        return;
+
+    /*
+     * dynamic module name 
+     */
+    dlm_name = strtok(cptr, "\t ");
+    if (dlm_name == NULL) {
+        config_perror("Bad dlmod line");
+        dlmod_delete_module(dlm);
+        return;
+    }
+    strncpy(dlm->name, dlm_name, sizeof(dlm->name));
+
+    /*
+     * dynamic module path 
+     */
+    dlm_path = strtok(NULL, "\t ");
+    if (dlm_path)
+        strncpy(dlm->path, dlm_path, sizeof(dlm->path));
+    else
+        strncpy(dlm->path, dlm_name, sizeof(dlm->path));
+
+    dlmod_load_module(dlm);
+
+    if (dlm->status == DLMOD_ERROR)
+        snmp_log(LOG_ERR, "%s\n", dlm->error);
+
+}
+
+static void
+dlmod_free_config(void)
+{
+    struct dlmod   *dtmp, *dtmp2;
+
+    for (dtmp = dlmods; dtmp != NULL;) {
+        dtmp2 = dtmp;
+        dtmp = dtmp->next;
+        dlmod_unload_module(dtmp2);
+        free(dtmp2);
+    }
+    dlmods = NULL;
+    dlmod_next_index = 1;
+}
+
+struct dlmod   *
+dlmod_create_module(void)
+{
+    struct dlmod  **pdlmod, *dlm;
+#if 1
+    DEBUGMSGTL(("dlmod", "dlmod_create_module\n"));
+#endif
+    dlm = calloc(1, sizeof(struct dlmod));
+    if (dlm == NULL)
+        return NULL;
+
+    dlm->index = dlmod_next_index++;
+    dlm->status = DLMOD_UNLOADED;
+
+    for (pdlmod = &dlmods; *pdlmod != NULL; pdlmod = &((*pdlmod)->next));
+    (*pdlmod) = dlm;
+
+    return dlm;
+}
+
+void
+dlmod_delete_module(struct dlmod *dlm)
+{
+    struct dlmod  **pdlmod;
+
+#if 1
+    DEBUGMSGTL(("dlmod", "dlmod_delete_module\n"));
+#endif
+    if (!dlm || dlm->status != DLMOD_UNLOADED)
+        return;
+
+    for (pdlmod = &dlmods; *pdlmod; pdlmod = &((*pdlmod)->next))
+        if (*pdlmod == dlm) {
+            *pdlmod = dlm->next;
+            free(dlm);
+            return;
+        }
+}
+
+void
+dlmod_load_module(struct dlmod *dlm)
+{
+    char            sym_init[64];
+    char           *p, tmp_path[255];
+    int             (*dl_init) (void);
+#if 1
+    DEBUGMSGTL(("dlmod", "dlmod_load_module\n"));
+#endif
+
+    if (!dlm || !dlm->path || !dlm->name || dlm->status != DLMOD_UNLOADED)
+        return;
+
+
+    if (dlm->path[0] == '/') {
+        dlm->handle = dlopen(dlm->path, RTLD_NOW);
+        if (dlm->handle == NULL) {
+            snprintf(dlm->error, sizeof(dlm->error),
+                     "dlopen failed: %s", dlerror());
+            dlm->status = DLMOD_ERROR;
+            return;
+        }
+    } else {
+        for (p = strtok(dlmod_path, ":"); p; p = strtok(NULL, ":")) {
+            snprintf(tmp_path, sizeof(tmp_path), "%s/%s.so", p, dlm->path);
+#if 1
+            DEBUGMSGTL(("dlmod", "p: %s tmp_path: %s\n", p, tmp_path));
+#endif
+            dlm->handle = dlopen(tmp_path, RTLD_NOW);
+            if (dlm->handle == NULL) {
+                snprintf(dlm->error, sizeof(dlm->error),
+                         "dlopen failed: %s", dlerror());
+                dlm->status = DLMOD_ERROR;
+            }
+        }
+        strncpy(dlm->path, tmp_path, sizeof(dlm->path));
+        if (dlm->status == DLMOD_ERROR)
+            return;
+    }
+    snprintf(sym_init, sizeof(sym_init), "_dynamic_init_%s", dlm->name);
+    dl_init = dlsym(dlm->handle, sym_init);
+    if (dl_init == NULL) {
+        snprintf(dlm->error, sizeof(dlm->error),
+                 "dlsym failed: can't find \'%s\'", sym_init);
+        dlm->status = DLMOD_ERROR;
+        return;
+    }
+
+    if (dl_init()) {
+        snprintf(dlm->error, sizeof(dlm->error), "\'%s\' failed",
+                 sym_init);
+        dlm->status = DLMOD_ERROR;
+        return;
+    }
+
+    dlm->error[0] = '\0';
+    dlm->status = DLMOD_LOADED;
+}
+
+void
+dlmod_unload_module(struct dlmod *dlm)
+{
+    char            sym_deinit[64];
+    char            buf[256];
+    int             (*dl_deinit) (void);
+
+    if (!dlm || dlm->status != DLMOD_LOADED)
+        return;
+
+    snprintf(sym_deinit, sizeof(sym_deinit), "_dynamic_deinit_%s",
+             dlm->name);
+    dl_deinit = dlsym(dlm->handle, sym_deinit);
+    if (dl_deinit == NULL) {
+        /** it's right way ? */
+        dlm->status = DLMOD_ERROR;
+        return;
+    }
+    dl_deinit();
+    dlclose(dlm->handle);
+    dlm->status = DLMOD_UNLOADED;
+#if 1
+    DEBUGMSGTL(("dlmod", "Module %s unloaded\n", dlm->name));
+#endif
+}
+
+int
+dlmod_get_next_index(void)
+{
+    return dlmod_next_index;
+}
+
+struct dlmod   *
+dlmod_get_by_index(int iindex)
+{
+    struct dlmod   *dlmod;
+
+    for (dlmod = dlmods; dlmod; dlmod = dlmod->next)
+        if (dlmod->index == iindex)
+            return dlmod;
+
+    return NULL;
+}
+
+#if 0
+struct dlmod   *
+dlmod_get_next(struct dlmod *dlm)
+{
+    if (dlm)
+        return dlmods;
+    else
+        return dlm->next;
+}
+#endif
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/misc/dlmod.h tomato121/release/src/router/snmp/agent/mibgroup/misc/dlmod.h
--- tomato/release/src/router/snmp/agent/mibgroup/misc/dlmod.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/misc/dlmod.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,43 @@
+/*
+ *  pass: pass through extensiblity
+ */
+#ifndef _MIBGROUP_DLMOD_H
+#define _MIBGROUP_DLMOD_H
+
+
+
+#include "mibdefs.h"
+
+#ifndef DLMOD_PATH
+#define DLMOD_DEFAULT_PATH "/usr/local/lib/snmp/dlmod"
+#endif
+
+struct dlmod {
+    struct dlmod   *next;
+    int             index;
+    char            name[64];
+    char            path[255];
+    char            error[255];
+    void           *handle;
+    int             status;
+};
+
+#define DLMOD_LOADED 	1
+#define DLMOD_UNLOADED	2
+#define DLMOD_ERROR		3
+#define DLMOD_LOAD		4
+#define	DLMOD_UNLOAD	5
+#define DLMOD_CREATE	6
+#define DLMOD_DELETE	7
+
+void            dlmod_load_module(struct dlmod *);
+void            dlmod_unload_module(struct dlmod *);
+struct dlmod   *dlmod_create_module(void);
+void            dlmod_delete_module(struct dlmod *);
+struct dlmod   *dlmod_get_by_index(int);
+
+void            dlmod_init(void);
+void            dlmod_deinit(void);
+
+extern int      dlmod_next_index;
+#endif                          /* _MIBGROUP_DLMOD_H */
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/misc/ipfwacc.c tomato121/release/src/router/snmp/agent/mibgroup/misc/ipfwacc.c
--- tomato/release/src/router/snmp/agent/mibgroup/misc/ipfwacc.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/misc/ipfwacc.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,347 @@
+/****************************************************************************
+ * Module for ucd-snmpd reading IP Firewall accounting rules.               *
+ * It reads "/proc/net/ip_acct". If the file has a wrong format it silently *
+ * returns erroneous data but doesn't do anything harmfull. Based (on the   *
+ * output of) mib2c, wombat.c, proc.c and the Linux kernel.                 *
+ * Author: Cristian.Estan@net.utcluj.ro                                     *
+ ***************************************************************************/
+
+#include <net-snmp/net-snmp-config.h>
+
+#if TIME_WITH_SYS_TIME
+# include <sys/time.h>
+# include <time.h>
+#else
+# if HAVE_SYS_TIME_H
+#  include <sys/time.h>
+# else
+#  include <time.h>
+# endif
+#endif
+
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+#include "util_funcs.h"
+#include "ipfwacc.h"
+
+/*
+ * According to the 2.0.33 Linux kernel, assuming we use ipv4 any line from
+ * * "/proc/net/ip_acct should fit into
+ * * 8+1+8+2+8+1+8+1+16+1+8+1+4+1+2+1+2+1+20+20+10*(1+5)+2+2+2+2=182
+ * * characters+ newline.
+ */
+#define IPFWRULELEN 200
+
+#define IP_FW_F_ALL     0x0000  /* This is a universal packet firewall */
+#define IP_FW_F_TCP     0x0001  /* This is a TCP packet firewall      */
+#define IP_FW_F_UDP     0x0002  /* This is a UDP packet firewall      */
+#define IP_FW_F_ICMP    0x0003  /* This is a ICMP packet firewall     */
+#define IP_FW_F_KIND    0x0003  /* Mask to isolate firewall kind      */
+#define IP_FW_F_SRNG    0x0008  /* The first two src ports are a min  *
+                                 * and max range (stored in host byte *
+                                 * order).                            */
+#define IP_FW_F_DRNG    0x0010  /* The first two dst ports are a min  *
+                                 * and max range (stored in host byte *
+                                 * order).                            *
+                                 * (ports[0] <= port <= ports[1])     */
+#define IP_FW_F_BIDIR   0x0040  /* For bidirectional firewalls        */
+#define IP_FW_F_ACCTIN  0x1000  /* Account incoming packets only.     */
+#define IP_FW_F_ACCTOUT 0x2000  /* Account outgoing packets only.     */
+
+static unsigned char rule[IPFWRULELEN]; /*Buffer for reading a line from
+                                         * /proc/net/ip_acct. Care has been taken
+                                         * not to read beyond the end of this 
+                                         * buffer, even if rules are in an 
+                                         * unexpected format
+                                         */
+
+/*
+ * This function reads the rule with the given number into the buffer. It
+ * * returns the number of rule read or 0 if the number is invalid or other
+ * * problems occur. If the argument is 0 it returns the number of accounting
+ * * rules. No caching of rules is done.
+ */
+
+static int
+readrule(unsigned int number)
+{
+    int             i;
+    FILE           *f = fopen("/proc/net/ip_acct", "rt");
+
+    if (!f)
+        return 0;
+    /*
+     * get rid of "IP accounting rules" line
+     */
+    if (!fgets(rule, sizeof(rule), f)) {
+        fclose(f);
+        return 0;
+    }
+    for (i = 1; i != number; i++)
+        if (!fgets(rule, sizeof(rule), f)) {
+            fclose(f);
+            return (number ? 0 : (i - 1));
+        }
+    if (!fgets(rule, sizeof(rule), f)) {
+        fclose(f);
+        return 0;
+    }
+    fclose(f);
+    return i;
+}
+
+static unsigned long ret_val;   /* Used by var_ipfwacc to return ulongs */
+
+/*
+ * This function converts the hexadecimal representation of an IP address from
+ * * the rule buffer to an unsigned long. The result is stored in the ret_val
+ * * variable. The parameter indicates the position where the address starts. It
+ * * only works with uppercase letters and assumes input is correct. Had to use
+ * * this because stol returns a signed long. 
+ */
+
+static inline void
+atoip(int pos)
+{
+    int             i;
+
+    ret_val = 0;
+    for (i = 0; i < 32; i += 8) {
+        unsigned long   value = (((rule[pos]) >= '0' && rule[pos] <= '9') ?
+                                 rule[pos] - '0' : rule[pos] - 'A' + 10);
+        pos++;
+        value = (value << 4) + (((rule[pos]) >= '0' && rule[pos] <= '9') ?
+                                rule[pos] - '0' : rule[pos] - 'A' + 10);
+        pos++;
+        ret_val |= (value << i);
+    }
+}
+
+/*
+ * This function parses the flags field from the line in the buffer 
+ */
+
+static unsigned long int
+getflags(void)
+{
+    unsigned long int flags;
+    int             i = 37;     /* position in the rule */
+
+    /*
+     * skipping via name 
+     */
+    while (rule[i] != ' ' && i < IPFWRULELEN - 12)
+        i++;
+    /*
+     * skipping via address 
+     */
+    i += 10;
+    for (flags = 0; rule[i] != ' ' && i < IPFWRULELEN - 1; i++) {
+        int             value = (((rule[i]) >= '0' && rule[i] <= '9') ?
+                                 rule[i] - '0' : rule[i] - 'A' + 10);
+        flags = (flags << 4) + value;
+    }
+    return flags;
+}
+
+/*
+ * This function reads into ret_val a field from the rule buffer. The field
+ * * is a base 10 long integer and the parameter skip tells us how many fields
+ * * to skip after the "via addrress" field (including the flag field)
+ */
+
+static void
+getnumeric(int skip)
+{
+    int             i = 37;     /* position in the rule */
+
+    /*
+     * skipping via name 
+     */
+    while (rule[i] != ' ' && i < IPFWRULELEN - 12)
+        i++;
+    /*
+     * skipping via address 
+     */
+    i += 10;
+    while (skip > 0) {
+        skip--;
+        /*
+         * skipping field, than subsequent spaces 
+         */
+        while (rule[i] != ' ' && i < IPFWRULELEN - 2)
+            i++;
+        while (rule[i] == ' ' && i < IPFWRULELEN - 1)
+            i++;
+    }
+    for (ret_val = 0; rule[i] != ' ' && i < IPFWRULELEN - 1; i++)
+        ret_val = ret_val * 10 + rule[i] - '0';
+}
+
+/*
+ * this variable defines function callbacks and type return information 
+ * for the ipfwaccounting mib 
+ */
+
+struct variable2 ipfwacc_variables[] = {
+    {IPFWACCINDEX, ASN_INTEGER, RONLY, var_ipfwacc, 1, {IPFWACCINDEX}},
+    {IPFWACCSRCADDR, ASN_IPADDRESS, RONLY, var_ipfwacc, 1,
+     {IPFWACCSRCADDR}},
+    {IPFWACCSRCNM, ASN_IPADDRESS, RONLY, var_ipfwacc, 1, {IPFWACCSRCNM}},
+    {IPFWACCDSTADDR, ASN_IPADDRESS, RONLY, var_ipfwacc, 1,
+     {IPFWACCDSTADDR}},
+    {IPFWACCDSTNM, ASN_IPADDRESS, RONLY, var_ipfwacc, 1, {IPFWACCDSTNM}},
+    {IPFWACCVIANAME, ASN_OCTET_STR, RONLY, var_ipfwacc, 1,
+     {IPFWACCVIANAME}},
+    {IPFWACCVIAADDR, ASN_IPADDRESS, RONLY, var_ipfwacc, 1,
+     {IPFWACCVIAADDR}},
+    {IPFWACCPROTO, ASN_INTEGER, RONLY, var_ipfwacc, 1, {IPFWACCPROTO}},
+    {IPFWACCBIDIR, ASN_INTEGER, RONLY, var_ipfwacc, 1, {IPFWACCBIDIR}},
+    {IPFWACCDIR, ASN_INTEGER, RONLY, var_ipfwacc, 1, {IPFWACCDIR}},
+    {IPFWACCBYTES, ASN_COUNTER, RONLY, var_ipfwacc, 1, {IPFWACCBYTES}},
+    {IPFWACCPACKETS, ASN_COUNTER, RONLY, var_ipfwacc, 1, {IPFWACCPACKETS}},
+    {IPFWACCNSRCPRTS, ASN_INTEGER, RONLY, var_ipfwacc, 1,
+     {IPFWACCNSRCPRTS}},
+    {IPFWACCNDSTPRTS, ASN_INTEGER, RONLY, var_ipfwacc, 1,
+     {IPFWACCNDSTPRTS}},
+    {IPFWACCSRCISRNG, ASN_INTEGER, RONLY, var_ipfwacc, 1,
+     {IPFWACCSRCISRNG}},
+    {IPFWACCDSTISRNG, ASN_INTEGER, RONLY, var_ipfwacc, 1,
+     {IPFWACCDSTISRNG}},
+    {IPFWACCPORT1, ASN_INTEGER, RONLY, var_ipfwacc, 1, {IPFWACCPORT1}},
+    {IPFWACCPORT2, ASN_INTEGER, RONLY, var_ipfwacc, 1, {IPFWACCPORT2}},
+    {IPFWACCPORT3, ASN_INTEGER, RONLY, var_ipfwacc, 1, {IPFWACCPORT3}},
+    {IPFWACCPORT4, ASN_INTEGER, RONLY, var_ipfwacc, 1, {IPFWACCPORT4}},
+    {IPFWACCPORT5, ASN_INTEGER, RONLY, var_ipfwacc, 1, {IPFWACCPORT5}},
+    {IPFWACCPORT6, ASN_INTEGER, RONLY, var_ipfwacc, 1, {IPFWACCPORT6}},
+    {IPFWACCPORT7, ASN_INTEGER, RONLY, var_ipfwacc, 1, {IPFWACCPORT7}},
+    {IPFWACCPORT8, ASN_INTEGER, RONLY, var_ipfwacc, 1, {IPFWACCPORT8}},
+    {IPFWACCPORT9, ASN_INTEGER, RONLY, var_ipfwacc, 1, {IPFWACCPORT9}},
+    {IPFWACCPORT10, ASN_INTEGER, RONLY, var_ipfwacc, 1, {IPFWACCPORT10}}
+};
+
+oid             ipfwacc_variables_oid[] =
+    { 1, 3, 6, 1, 4, 1, 2021, 13, 1, 1, 1 };
+
+void
+init_ipfwacc(void)
+{
+    REGISTER_MIB("misc/ipfwacc", ipfwacc_variables, variable2,
+                 ipfwacc_variables_oid);
+}
+
+
+u_char         *
+var_ipfwacc(struct variable *vp,
+            oid * name,
+            size_t * length,
+            int exact, size_t * var_len, WriteMethod ** write_method)
+{
+    *write_method = 0;          /* assume it isnt writable for the time being */
+    *var_len = sizeof(ret_val); /* assume an integer and change later if not */
+
+    if (header_simple_table
+        (vp, name, length, exact, var_len, write_method, readrule(0)))
+        return (NULL);
+
+    if (readrule(name[*length - 1])) {
+        /*
+         * this is where we do the value assignments for the mib results. 
+         */
+        switch (vp->magic) {
+        case IPFWACCINDEX:
+            ret_val = name[*length - 1];
+            return ((u_char *) (&ret_val));
+        case IPFWACCSRCADDR:
+            atoip(0);
+            return ((u_char *) (&ret_val));
+        case IPFWACCSRCNM:
+            atoip(9);
+            return ((u_char *) (&ret_val));
+        case IPFWACCDSTADDR:
+            atoip(19);
+            return ((u_char *) (&ret_val));
+        case IPFWACCDSTNM:
+            atoip(28);
+            return ((u_char *) (&ret_val));
+        case IPFWACCVIANAME:
+            {
+                int             i = 37; /* position in the rule */
+                while (rule[i] != ' ' && i < IPFWRULELEN - 1)
+                    i++;
+                rule[i] = 0;
+                return (rule + 37);
+            }
+        case IPFWACCVIAADDR:
+            {
+                int             i = 37; /* position in the rule */
+                while (rule[i] != ' ' && i < IPFWRULELEN - 9)
+                    i++;
+                atoip(i + 1);
+                return ((u_char *) (&ret_val));
+            }
+        case IPFWACCPROTO:
+            switch (getflags() & IP_FW_F_KIND) {
+            case IP_FW_F_ALL:
+                ret_val = 2;
+                return ((u_char *) (&ret_val));
+            case IP_FW_F_TCP:
+                ret_val = 3;
+                return ((u_char *) (&ret_val));
+            case IP_FW_F_UDP:
+                ret_val = 4;
+                return ((u_char *) (&ret_val));
+            case IP_FW_F_ICMP:
+                ret_val = 5;
+                return ((u_char *) (&ret_val));
+            default:
+                ret_val = 1;
+                return ((u_char *) (&ret_val));
+            }
+        case IPFWACCBIDIR:
+            ret_val = ((getflags() & IP_FW_F_BIDIR) ? 2 : 1);
+            return ((u_char *) (&ret_val));
+        case IPFWACCDIR:
+            ret_val = (getflags() & (IP_FW_F_ACCTIN | IP_FW_F_ACCTOUT));
+            if (ret_val == IP_FW_F_ACCTIN)
+                ret_val = 2;
+            else if (ret_val == IP_FW_F_ACCTOUT)
+                ret_val = 3;
+            else
+                ret_val = 1;
+            return ((u_char *) (&ret_val));
+        case IPFWACCBYTES:
+            getnumeric(4);
+            return ((u_char *) (&ret_val));
+        case IPFWACCPACKETS:
+            getnumeric(3);
+            return ((u_char *) (&ret_val));
+        case IPFWACCNSRCPRTS:
+            getnumeric(1);
+            return ((u_char *) (&ret_val));
+        case IPFWACCNDSTPRTS:
+            getnumeric(2);
+            return ((u_char *) (&ret_val));
+        case IPFWACCSRCISRNG:
+            ret_val = ((getflags() & IP_FW_F_SRNG) ? 1 : 2);
+            return ((u_char *) (&ret_val));
+        case IPFWACCDSTISRNG:
+            ret_val = ((getflags() & IP_FW_F_DRNG) ? 1 : 2);
+            return ((u_char *) (&ret_val));
+        case IPFWACCPORT1:
+        case IPFWACCPORT2:
+        case IPFWACCPORT3:
+        case IPFWACCPORT4:
+        case IPFWACCPORT5:
+        case IPFWACCPORT6:
+        case IPFWACCPORT7:
+        case IPFWACCPORT8:
+        case IPFWACCPORT9:
+        case IPFWACCPORT10:
+            getnumeric(5 + (vp->magic) - IPFWACCPORT1);
+            return ((u_char *) (&ret_val));
+        }
+    }
+    return NULL;
+}
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/misc/ipfwacc.h tomato121/release/src/router/snmp/agent/mibgroup/misc/ipfwacc.h
--- tomato/release/src/router/snmp/agent/mibgroup/misc/ipfwacc.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/misc/ipfwacc.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,54 @@
+/*
+ *  MIB group interface - ipfwacc.h
+ *  IP accounting through firewall rules
+ */
+#ifndef _MIBGROUP_IPFWACC_H
+#define _MIBGROUP_IPFWACC_H
+
+/*
+ * we use checkmib from the util_funcs module 
+ */
+
+config_require(util_funcs)
+
+    /*
+     * add the mib we implement to the list of default mibs to load 
+     */
+config_add_mib(UCD-IPFWACC-MIB)
+
+    /*
+     * Magic number definitions: 
+     */
+#define	IPFWACCINDEX		1
+#define	IPFWACCSRCADDR		2
+#define	IPFWACCSRCNM		3
+#define	IPFWACCDSTADDR		4
+#define	IPFWACCDSTNM		5
+#define	IPFWACCVIANAME		6
+#define	IPFWACCVIAADDR		7
+#define	IPFWACCPROTO		8
+#define	IPFWACCBIDIR		9
+#define	IPFWACCDIR		10
+#define	IPFWACCBYTES		11
+#define	IPFWACCPACKETS		12
+#define	IPFWACCNSRCPRTS		13
+#define	IPFWACCNDSTPRTS		14
+#define	IPFWACCSRCISRNG		15
+#define	IPFWACCDSTISRNG		16
+#define	IPFWACCPORT1		17
+#define	IPFWACCPORT2		18
+#define	IPFWACCPORT3		19
+#define	IPFWACCPORT4		20
+#define	IPFWACCPORT5		21
+#define	IPFWACCPORT6		22
+#define	IPFWACCPORT7		23
+#define	IPFWACCPORT8		24
+#define	IPFWACCPORT9		25
+#define	IPFWACCPORT10		26
+    /*
+     * function definitions 
+     */
+     extern void     init_ipfwacc(void);
+     extern FindVarMethod var_ipfwacc;
+
+#endif                          /* _MIBGROUP_IPFWACC_H */
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/notification/.cvsignore tomato121/release/src/router/snmp/agent/mibgroup/notification/.cvsignore
--- tomato/release/src/router/snmp/agent/mibgroup/notification/.cvsignore	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/notification/.cvsignore	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,2 @@
+.libs
+*.lo
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/notification/snmpNotifyFilterProfileTable.c tomato121/release/src/router/snmp/agent/mibgroup/notification/snmpNotifyFilterProfileTable.c
--- tomato/release/src/router/snmp/agent/mibgroup/notification/snmpNotifyFilterProfileTable.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/notification/snmpNotifyFilterProfileTable.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,790 @@
+/*
+ * This file was generated by mib2c and is intended for use as
+ * a mib module for the ucd-snmp snmpd agent. 
+ */
+
+
+/*
+ * This should always be included first before anything else 
+ */
+#include <net-snmp/net-snmp-config.h>
+
+#include <sys/types.h>
+#if HAVE_WINSOCK_H
+#include <winsock.h>
+#endif
+#if HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#if HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+
+
+/*
+ * minimal include directives 
+ */
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+#include "header_complex.h"
+#include "snmpNotifyFilterProfileTable.h"
+
+
+/*
+ * snmpNotifyFilterProfileTable_variables_oid:
+ *   this is the top level oid that we want to register under.  This
+ *   is essentially a prefix, with the suffix appearing in the
+ *   variable below.
+ */
+
+
+oid             snmpNotifyFilterProfileTable_variables_oid[] =
+    { 1, 3, 6, 1, 6, 3, 13, 1, 2 };
+
+
+/*
+ * variable2 snmpNotifyFilterProfileTable_variables:
+ *   this variable defines function callbacks and type return information 
+ *   for the snmpNotifyFilterProfileTable mib section 
+ */
+
+
+struct variable2 snmpNotifyFilterProfileTable_variables[] = {
+    /*
+     * magic number        , variable type , ro/rw , callback fn  , L, oidsuffix 
+     */
+#define   SNMPNOTIFYFILTERPROFILENAME  3
+    {SNMPNOTIFYFILTERPROFILENAME, ASN_OCTET_STR, RWRITE,
+     var_snmpNotifyFilterProfileTable, 2, {1, 1}},
+#define   SNMPNOTIFYFILTERPROFILESTORTYPE  4
+    {SNMPNOTIFYFILTERPROFILESTORTYPE, ASN_INTEGER, RWRITE,
+     var_snmpNotifyFilterProfileTable, 2, {1, 2}},
+#define   SNMPNOTIFYFILTERPROFILEROWSTATUS  5
+    {SNMPNOTIFYFILTERPROFILEROWSTATUS, ASN_INTEGER, RWRITE,
+     var_snmpNotifyFilterProfileTable, 2, {1, 3}},
+
+};
+/*
+ * (L = length of the oidsuffix) 
+ */
+
+
+/*
+ * global storage of our data, saved in and configured by header_complex() 
+ */
+static struct header_complex_index *snmpNotifyFilterProfileTableStorage =
+    NULL;
+
+
+
+
+/*
+ * init_snmpNotifyFilterProfileTable():
+ *   Initialization routine.  This is called when the agent starts up.
+ *   At a minimum, registration of your variables should take place here.
+ */
+void
+init_snmpNotifyFilterProfileTable(void)
+{
+    DEBUGMSGTL(("snmpNotifyFilterProfileTable", "initializing...  "));
+
+
+    /*
+     * register ourselves with the agent to handle our mib tree 
+     */
+    REGISTER_MIB("snmpNotifyFilterProfileTable",
+                 snmpNotifyFilterProfileTable_variables, variable2,
+                 snmpNotifyFilterProfileTable_variables_oid);
+
+
+    /*
+     * register our config handler(s) to deal with registrations 
+     */
+    snmpd_register_config_handler("snmpNotifyFilterProfileTable",
+                                  parse_snmpNotifyFilterProfileTable, NULL,
+                                  NULL);
+
+
+
+
+    /*
+     * we need to be called back later to store our data 
+     */
+    snmp_register_callback(SNMP_CALLBACK_LIBRARY, SNMP_CALLBACK_STORE_DATA,
+                           store_snmpNotifyFilterProfileTable, NULL);
+
+
+    /*
+     * place any other initialization junk you need here 
+     */
+
+
+    DEBUGMSGTL(("snmpNotifyFilterProfileTable", "done.\n"));
+}
+
+
+/*
+ * snmpNotifyFilterProfileTable_add(): adds a structure node to our data set 
+ */
+int
+snmpNotifyFilterProfileTable_add(struct snmpNotifyFilterProfileTable_data
+                                 *thedata)
+{
+    netsnmp_variable_list *vars = NULL;
+
+
+    DEBUGMSGTL(("snmpNotifyFilterProfileTable", "adding data...  "));
+    /*
+     * add the index variables to the varbind list, which is 
+     * used by header_complex to index the data 
+     */
+
+    snmp_varlist_add_variable(&vars, NULL, 0, ASN_PRIV_IMPLIED_OCTET_STR,
+                              (u_char *) thedata->snmpTargetParamsName,
+                              thedata->snmpTargetParamsNameLen);
+
+    header_complex_add_data(&snmpNotifyFilterProfileTableStorage, vars,
+                            thedata);
+    DEBUGMSGTL(("snmpNotifyFilterProfileTable", "registered an entry\n"));
+
+
+    DEBUGMSGTL(("snmpNotifyFilterProfileTable", "done.\n"));
+    return SNMPERR_SUCCESS;
+}
+
+
+/*
+ * parse_snmpNotifyFilterProfileTable():
+ *   parses .conf file entries needed to configure the mib.
+ */
+void
+parse_snmpNotifyFilterProfileTable(const char *token, char *line)
+{
+    size_t          tmpint;
+    struct snmpNotifyFilterProfileTable_data *StorageTmp =
+        SNMP_MALLOC_STRUCT(snmpNotifyFilterProfileTable_data);
+
+    DEBUGMSGTL(("snmpNotifyFilterProfileTable", "parsing config...  "));
+
+    if (StorageTmp == NULL) {
+        config_perror("malloc failure");
+        return;
+    }
+
+    line =
+        read_config_read_data(ASN_OCTET_STR, line,
+                              &StorageTmp->snmpTargetParamsName,
+                              &StorageTmp->snmpTargetParamsNameLen);
+    if (StorageTmp->snmpTargetParamsName == NULL) {
+        config_perror("invalid specification for snmpTargetParamsName");
+        return;
+    }
+
+    line =
+        read_config_read_data(ASN_OCTET_STR, line,
+                              &StorageTmp->snmpNotifyFilterProfileName,
+                              &StorageTmp->snmpNotifyFilterProfileNameLen);
+
+    line =
+        read_config_read_data(ASN_INTEGER, line,
+                              &StorageTmp->snmpNotifyFilterProfileStorType,
+                              &tmpint);
+
+    line =
+        read_config_read_data(ASN_INTEGER, line,
+                              &StorageTmp->
+                              snmpNotifyFilterProfileRowStatus, &tmpint);
+
+    snmpNotifyFilterProfileTable_add(StorageTmp);
+
+    DEBUGMSGTL(("snmpNotifyFilterProfileTable", "done.\n"));
+}
+
+
+
+
+/*
+ * store_snmpNotifyFilterProfileTable():
+ *   stores .conf file entries needed to configure the mib.
+ */
+int
+store_snmpNotifyFilterProfileTable(int majorID, int minorID,
+                                   void *serverarg, void *clientarg)
+{
+    char            line[SNMP_MAXBUF];
+    char           *cptr;
+    size_t          tmpint;
+    struct snmpNotifyFilterProfileTable_data *StorageTmp;
+    struct header_complex_index *hcindex;
+
+
+    DEBUGMSGTL(("snmpNotifyFilterProfileTable", "storing data...  "));
+
+    for (hcindex = snmpNotifyFilterProfileTableStorage; hcindex != NULL;
+         hcindex = hcindex->next) {
+        StorageTmp =
+            (struct snmpNotifyFilterProfileTable_data *) hcindex->data;
+
+        if (StorageTmp->snmpNotifyFilterProfileStorType == ST_NONVOLATILE) {
+
+            memset(line, 0, sizeof(line));
+            strcat(line, "snmpNotifyFilterProfileTable ");
+            cptr = line + strlen(line);
+
+            cptr =
+                read_config_store_data(ASN_OCTET_STR, cptr,
+                                       &StorageTmp->snmpTargetParamsName,
+                                       &StorageTmp->
+                                       snmpTargetParamsNameLen);
+            cptr =
+                read_config_store_data(ASN_OCTET_STR, cptr,
+                                       &StorageTmp->
+                                       snmpNotifyFilterProfileName,
+                                       &StorageTmp->
+                                       snmpNotifyFilterProfileNameLen);
+            cptr =
+                read_config_store_data(ASN_INTEGER, cptr,
+                                       &StorageTmp->
+                                       snmpNotifyFilterProfileStorType,
+                                       &tmpint);
+            cptr =
+                read_config_store_data(ASN_INTEGER, cptr,
+                                       &StorageTmp->
+                                       snmpNotifyFilterProfileRowStatus,
+                                       &tmpint);
+
+            snmpd_store_config(line);
+        }
+    }
+    DEBUGMSGTL(("snmpNotifyFilterProfileTable", "done.\n"));
+    return 0;
+}
+
+
+
+
+/*
+ * var_snmpNotifyFilterProfileTable():
+ *   Handle this table separately from the scalar value case.
+ *   The workings of this are basically the same as for var_snmpNotifyFilterProfileTable above.
+ */
+unsigned char  *
+var_snmpNotifyFilterProfileTable(struct variable *vp,
+                                 oid * name,
+                                 size_t * length,
+                                 int exact,
+                                 size_t * var_len,
+                                 WriteMethod ** write_method)
+{
+
+
+    struct snmpNotifyFilterProfileTable_data *StorageTmp = NULL;
+
+
+    DEBUGMSGTL(("snmpNotifyFilterProfileTable",
+                "var_snmpNotifyFilterProfileTable: Entering...  \n"));
+    /*
+     * this assumes you have registered all your data properly
+     */
+    if ((StorageTmp = (struct snmpNotifyFilterProfileTable_data *)
+         header_complex((struct header_complex_index *)
+                        snmpNotifyFilterProfileTableStorage, vp, name,
+                        length, exact, var_len, write_method)) == NULL) {
+        if (vp->magic == SNMPNOTIFYFILTERPROFILEROWSTATUS)
+            *write_method = write_snmpNotifyFilterProfileRowStatus;
+        return NULL;
+    }
+
+    /*
+     * this is where we do the value assignments for the mib results.
+     */
+    switch (vp->magic) {
+
+    case SNMPNOTIFYFILTERPROFILENAME:
+        *write_method = write_snmpNotifyFilterProfileName;
+        *var_len = StorageTmp->snmpNotifyFilterProfileNameLen;
+        return (u_char *) StorageTmp->snmpNotifyFilterProfileName;
+
+    case SNMPNOTIFYFILTERPROFILESTORTYPE:
+        *write_method = write_snmpNotifyFilterProfileStorType;
+        *var_len = sizeof(StorageTmp->snmpNotifyFilterProfileStorType);
+        return (u_char *) & StorageTmp->snmpNotifyFilterProfileStorType;
+
+    case SNMPNOTIFYFILTERPROFILEROWSTATUS:
+        *write_method = write_snmpNotifyFilterProfileRowStatus;
+        *var_len = sizeof(StorageTmp->snmpNotifyFilterProfileRowStatus);
+        return (u_char *) & StorageTmp->snmpNotifyFilterProfileRowStatus;
+
+
+    default:
+        ERROR_MSG("");
+    }
+    return NULL;
+}
+
+
+
+
+int
+write_snmpNotifyFilterProfileName(int action,
+                                  u_char * var_val,
+                                  u_char var_val_type,
+                                  size_t var_val_len,
+                                  u_char * statP,
+                                  oid * name, size_t name_len)
+{
+    static char    *tmpvar;
+    struct snmpNotifyFilterProfileTable_data *StorageTmp = NULL;
+    static size_t   tmplen;
+    size_t          newlen =
+        name_len -
+        (sizeof(snmpNotifyFilterProfileTable_variables_oid) / sizeof(oid) +
+         3 - 1);
+
+
+    DEBUGMSGTL(("snmpNotifyFilterProfileTable",
+                "write_snmpNotifyFilterProfileName entering action=%d...  \n",
+                action));
+    if ((StorageTmp = (struct snmpNotifyFilterProfileTable_data *)
+         header_complex((struct header_complex_index *)
+                        snmpNotifyFilterProfileTableStorage, NULL,
+                        &name[sizeof
+                              (snmpNotifyFilterProfileTable_variables_oid)
+                              / sizeof(oid) + 3 - 1], &newlen, 1, NULL,
+                        NULL)) == NULL)
+        return SNMP_ERR_NOSUCHNAME;     /* remove if you support creation here */
+
+
+    switch (action) {
+    case RESERVE1:
+        if (var_val_type != ASN_OCTET_STR) {
+            fprintf(stderr,
+                    "write to snmpNotifyFilterProfileName not ASN_OCTET_STR\n");
+            return SNMP_ERR_WRONGTYPE;
+        }
+        break;
+
+
+    case RESERVE2:
+        /*
+         * memory reseveration, final preparation... 
+         */
+        break;
+
+
+    case FREE:
+        /*
+         * Release any resources that have been allocated 
+         */
+        break;
+
+
+    case ACTION:
+        /*
+         * The variable has been stored in string for
+         * you to use, and you have just been asked to do something with
+         * it.  Note that anything done here must be reversable in the UNDO case 
+         */
+        tmpvar = StorageTmp->snmpNotifyFilterProfileName;
+        tmplen = StorageTmp->snmpNotifyFilterProfileNameLen;
+        memdup((u_char **) & StorageTmp->snmpNotifyFilterProfileName,
+               var_val, var_val_len);
+        StorageTmp->snmpNotifyFilterProfileNameLen = var_val_len;
+        break;
+
+
+    case UNDO:
+        /*
+         * Back out any changes made in the ACTION case 
+         */
+        SNMP_FREE(StorageTmp->snmpNotifyFilterProfileName);
+        StorageTmp->snmpNotifyFilterProfileName = tmpvar;
+        StorageTmp->snmpNotifyFilterProfileNameLen = tmplen;
+        break;
+
+
+    case COMMIT:
+        /*
+         * Things are working well, so it's now safe to make the change
+         * permanently.  Make sure that anything done here can't fail! 
+         */
+        SNMP_FREE(tmpvar);
+        break;
+    }
+    return SNMP_ERR_NOERROR;
+}
+
+
+
+int
+write_snmpNotifyFilterProfileStorType(int action,
+                                      u_char * var_val,
+                                      u_char var_val_type,
+                                      size_t var_val_len,
+                                      u_char * statP,
+                                      oid * name, size_t name_len)
+{
+    static int      tmpvar;
+    struct snmpNotifyFilterProfileTable_data *StorageTmp = NULL;
+    size_t          newlen =
+        name_len -
+        (sizeof(snmpNotifyFilterProfileTable_variables_oid) / sizeof(oid) +
+         3 - 1);
+
+
+    DEBUGMSGTL(("snmpNotifyFilterProfileTable",
+                "write_snmpNotifyFilterProfileStorType entering action=%d...  \n",
+                action));
+    if ((StorageTmp = (struct snmpNotifyFilterProfileTable_data *)
+         header_complex((struct header_complex_index *)
+                        snmpNotifyFilterProfileTableStorage, NULL,
+                        &name[sizeof
+                              (snmpNotifyFilterProfileTable_variables_oid)
+                              / sizeof(oid) + 3 - 1], &newlen, 1, NULL,
+                        NULL)) == NULL)
+        return SNMP_ERR_NOSUCHNAME;     /* remove if you support creation here */
+
+
+    switch (action) {
+    case RESERVE1:
+        if (var_val_type != ASN_INTEGER) {
+            fprintf(stderr,
+                    "write to snmpNotifyFilterProfileStorType not ASN_INTEGER\n");
+            return SNMP_ERR_WRONGTYPE;
+        }
+        break;
+
+
+    case RESERVE2:
+        /*
+         * memory reseveration, final preparation... 
+         */
+        break;
+
+
+    case FREE:
+        /*
+         * Release any resources that have been allocated 
+         */
+        break;
+
+
+    case ACTION:
+        /*
+         * The variable has been stored in long_ret for
+         * you to use, and you have just been asked to do something with
+         * it.  Note that anything done here must be reversable in the UNDO case 
+         */
+        tmpvar = StorageTmp->snmpNotifyFilterProfileStorType;
+        StorageTmp->snmpNotifyFilterProfileStorType = *((long *) var_val);
+        break;
+
+
+    case UNDO:
+        /*
+         * Back out any changes made in the ACTION case 
+         */
+        StorageTmp->snmpNotifyFilterProfileStorType = tmpvar;
+        break;
+
+
+    case COMMIT:
+        /*
+         * Things are working well, so it's now safe to make the change
+         * permanently.  Make sure that anything done here can't fail! 
+         */
+
+        break;
+    }
+    return SNMP_ERR_NOERROR;
+}
+
+
+
+
+
+
+int
+write_snmpNotifyFilterProfileRowStatus(int action,
+                                       u_char * var_val,
+                                       u_char var_val_type,
+                                       size_t var_val_len,
+                                       u_char * statP,
+                                       oid * name, size_t name_len)
+{
+    struct snmpNotifyFilterProfileTable_data *StorageTmp = NULL;
+    static struct snmpNotifyFilterProfileTable_data *StorageNew,
+        *StorageDel;
+    size_t          newlen =
+        name_len -
+        (sizeof(snmpNotifyFilterProfileTable_variables_oid) / sizeof(oid) +
+         3 - 1);
+    static int      old_value;
+    int             set_value;
+    netsnmp_variable_list *vars;
+    struct header_complex_index *hciptr;
+
+
+    StorageTmp = (struct snmpNotifyFilterProfileTable_data *)
+        header_complex((struct header_complex_index *)
+                       snmpNotifyFilterProfileTableStorage, NULL,
+                       &name[sizeof
+                             (snmpNotifyFilterProfileTable_variables_oid) /
+                             sizeof(oid) + 3 - 1], &newlen, 1, NULL, NULL);
+
+
+
+
+    if (var_val_type != ASN_INTEGER || var_val == NULL) {
+        fprintf(stderr,
+                "write to snmpNotifyFilterProfileRowStatus not ASN_INTEGER\n");
+        return SNMP_ERR_WRONGTYPE;
+    }
+    set_value = *((long *) var_val);
+
+
+    /*
+     * check legal range, and notReady is reserved for us, not a user 
+     */
+    if (set_value < 1 || set_value > 6 || set_value == RS_NOTREADY)
+        return SNMP_ERR_INCONSISTENTVALUE;
+
+
+    switch (action) {
+    case RESERVE1:
+        /*
+         * stage one: test validity 
+         */
+        if (StorageTmp == NULL) {
+            /*
+             * create the row now? 
+             */
+
+
+            /*
+             * ditch illegal values now 
+             */
+            if (set_value == RS_ACTIVE || set_value == RS_NOTINSERVICE)
+                return SNMP_ERR_INCONSISTENTVALUE;
+
+        } else {
+            /*
+             * row exists.  Check for a valid state change 
+             */
+            if (set_value == RS_CREATEANDGO
+                || set_value == RS_CREATEANDWAIT) {
+                /*
+                 * can't create a row that exists 
+                 */
+                return SNMP_ERR_INCONSISTENTVALUE;
+            }
+            /*
+             * XXX: interaction with row storage type needed 
+             */
+        }
+        break;
+
+
+
+
+    case RESERVE2:
+        /*
+         * memory reseveration, final preparation... 
+         */
+        if (StorageTmp == NULL &&
+            (set_value == RS_CREATEANDGO
+             || set_value == RS_CREATEANDWAIT)) {
+            /*
+             * creation 
+             */
+            vars = NULL;
+
+            snmp_varlist_add_variable(&vars, NULL, 0,
+                                      ASN_PRIV_IMPLIED_OCTET_STR, NULL, 0);
+
+            if (header_complex_parse_oid
+                (&
+                 (name
+                  [sizeof(snmpNotifyFilterProfileTable_variables_oid) /
+                   sizeof(oid) + 2]), newlen, vars) != SNMPERR_SUCCESS) {
+                snmp_free_var(vars);
+                return SNMP_ERR_INCONSISTENTNAME;
+            }
+
+            StorageNew =
+                SNMP_MALLOC_STRUCT(snmpNotifyFilterProfileTable_data);
+            memdup((u_char **) & (StorageNew->snmpTargetParamsName),
+                   vars->val.string, vars->val_len);
+            StorageNew->snmpTargetParamsNameLen = vars->val_len;
+            StorageNew->snmpNotifyFilterProfileStorType = ST_NONVOLATILE;
+
+            StorageNew->snmpNotifyFilterProfileRowStatus = set_value;
+            snmp_free_var(vars);
+        }
+
+
+        break;
+
+
+
+
+    case FREE:
+        /*
+         * XXX: free, zero vars 
+         */
+        /*
+         * Release any resources that have been allocated 
+         */
+        break;
+
+
+
+
+    case ACTION:
+        /*
+         * The variable has been stored in set_value for you to
+         * use, and you have just been asked to do something with
+         * it.  Note that anything done here must be reversable in
+         * the UNDO case 
+         */
+
+
+        if (StorageTmp == NULL &&
+            (set_value == RS_CREATEANDGO ||
+             set_value == RS_CREATEANDWAIT)) {
+            /*
+             * row creation, so add it 
+             */
+            if (StorageNew != NULL)
+                snmpNotifyFilterProfileTable_add(StorageNew);
+            /*
+             * XXX: ack, and if it is NULL? 
+             */
+        } else if (set_value != RS_DESTROY) {
+            /*
+             * set the flag? 
+             */
+            old_value = StorageTmp->snmpNotifyFilterProfileRowStatus;
+            StorageTmp->snmpNotifyFilterProfileRowStatus =
+                *((long *) var_val);
+        } else {
+            /*
+             * destroy...  extract it for now 
+             */
+            if (StorageTmp) {
+                hciptr =
+                    header_complex_find_entry
+                    (snmpNotifyFilterProfileTableStorage, StorageTmp);
+                StorageDel = (struct snmpNotifyFilterProfileTable_data *)
+                    header_complex_extract_entry((struct
+                                                  header_complex_index **)
+                                                 &snmpNotifyFilterProfileTableStorage,
+                                                 hciptr);
+            }
+
+        }
+        break;
+
+
+
+
+    case UNDO:
+        /*
+         * Back out any changes made in the ACTION case 
+         */
+        if (StorageTmp == NULL &&
+            (set_value == RS_CREATEANDGO ||
+             set_value == RS_CREATEANDWAIT)) {
+            /*
+             * row creation, so remove it again 
+             */
+            hciptr =
+                header_complex_find_entry
+                (snmpNotifyFilterProfileTableStorage, StorageNew);
+            StorageDel = (struct snmpNotifyFilterProfileTable_data *)
+                header_complex_extract_entry((struct header_complex_index
+                                              **)
+                                             &snmpNotifyFilterProfileTableStorage,
+                                             hciptr);
+            /*
+             * XXX: free it 
+             */
+        } else if (StorageDel != NULL) {
+            /*
+             * row deletion, so add it again 
+             */
+            snmpNotifyFilterProfileTable_add(StorageDel);
+            StorageDel = NULL;
+        } else if (set_value != RS_DESTROY) {
+            StorageTmp->snmpNotifyFilterProfileRowStatus = old_value;
+        }
+        break;
+
+
+
+
+    case COMMIT:
+        /*
+         * Things are working well, so it's now safe to make the change
+         * permanently.  Make sure that anything done here can't fail! 
+         */
+        if (StorageDel != NULL) {
+            StorageDel = NULL;
+            /*
+             * XXX: free it, its dead 
+             */
+        }
+        if (StorageTmp
+            && StorageTmp->snmpNotifyFilterProfileRowStatus ==
+            RS_CREATEANDGO) {
+            StorageTmp->snmpNotifyFilterProfileRowStatus = RS_ACTIVE;
+        } else if (StorageTmp &&
+                   StorageTmp->snmpNotifyFilterProfileRowStatus ==
+                   RS_CREATEANDWAIT) {
+            StorageTmp->snmpNotifyFilterProfileRowStatus = RS_NOTINSERVICE;
+        }
+        break;
+    }
+    return SNMP_ERR_NOERROR;
+}
+
+
+
+char           *
+get_FilterName(char *targetName, size_t targetName_len,
+               size_t * profileName_len)
+{
+    netsnmp_variable_list *vars = NULL;
+    struct snmpNotifyFilterProfileTable_data *data;
+
+    /*
+     * put requested info into var structure 
+     */
+    snmp_varlist_add_variable(&vars, NULL, 0, ASN_PRIV_IMPLIED_OCTET_STR,
+                              (u_char *) targetName, targetName_len);
+
+    /*
+     * get the data from the header_complex storage 
+     */
+    data = (struct snmpNotifyFilterProfileTable_data *)
+        header_complex_get(snmpNotifyFilterProfileTableStorage, vars);
+
+    /*
+     * free search index 
+     */
+    snmp_free_var(vars);
+
+    /*
+     * return the requested information (if this row is active) 
+     */
+    if (data && data->snmpNotifyFilterProfileRowStatus == RS_ACTIVE) {
+        *profileName_len = data->snmpNotifyFilterProfileNameLen;
+        return data->snmpNotifyFilterProfileName;
+    }
+
+    *profileName_len = 0;
+    return NULL;
+}
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/notification/snmpNotifyFilterProfileTable.h tomato121/release/src/router/snmp/agent/mibgroup/notification/snmpNotifyFilterProfileTable.h
--- tomato/release/src/router/snmp/agent/mibgroup/notification/snmpNotifyFilterProfileTable.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/notification/snmpNotifyFilterProfileTable.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,66 @@
+/*
+ * This file was generated by mib2c and is intended for use as a mib module
+ * for the ucd-snmp snmpd agent. 
+ */
+
+
+#ifndef _MIBGROUP_SNMPNOTIFYFILTERPROFILETABLE_H
+#define _MIBGROUP_SNMPNOTIFYFILTERPROFILETABLE_H
+
+
+/*
+ * we may use header_complex from the header_complex module 
+ */
+
+
+config_require(header_complex)
+
+
+    /*
+     * our storage structure(s) 
+     */
+     struct snmpNotifyFilterProfileTable_data {
+
+         char           *snmpTargetParamsName;
+         size_t          snmpTargetParamsNameLen;
+         char           *snmpNotifyFilterProfileName;
+         size_t          snmpNotifyFilterProfileNameLen;
+         long            snmpNotifyFilterProfileStorType;
+         long            snmpNotifyFilterProfileRowStatus;
+
+     };
+
+
+
+
+/*
+ * enum definitions from the covered mib sections 
+ */
+
+
+
+
+
+
+
+
+/*
+ * function prototypes 
+ */
+
+
+     void            init_snmpNotifyFilterProfileTable(void);
+     FindVarMethod   var_snmpNotifyFilterProfileTable;
+     void            parse_snmpNotifyFilterProfileTable(const char *,
+                                                        char *);
+     SNMPCallback    store_snmpNotifyFilterProfileTable;
+
+     WriteMethod     write_snmpNotifyFilterProfileName;
+     WriteMethod     write_snmpNotifyFilterProfileStorType;
+     WriteMethod     write_snmpNotifyFilterProfileRowStatus;
+
+     WriteMethod     write_snmpNotifyFilterProfileRowStatus;
+
+
+
+#endif                          /* _MIBGROUP_SNMPNOTIFYFILTERPROFILETABLE_H */
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/notification/snmpNotifyFilterTable.c tomato121/release/src/router/snmp/agent/mibgroup/notification/snmpNotifyFilterTable.c
--- tomato/release/src/router/snmp/agent/mibgroup/notification/snmpNotifyFilterTable.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/notification/snmpNotifyFilterTable.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,873 @@
+/*
+ * This file was generated by mib2c and is intended for use as
+ * a mib module for the ucd-snmp snmpd agent. 
+ */
+
+
+/*
+ * This should always be included first before anything else 
+ */
+#include <net-snmp/net-snmp-config.h>
+
+#include <sys/types.h>
+#if HAVE_WINSOCK_H
+#include <winsock.h>
+#endif
+#if HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#if HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+
+
+/*
+ * minimal include directives 
+ */
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+#include "header_complex.h"
+#include "snmpNotifyFilterTable.h"
+
+
+/*
+ * snmpNotifyFilterTable_variables_oid:
+ *   this is the top level oid that we want to register under.  This
+ *   is essentially a prefix, with the suffix appearing in the
+ *   variable below.
+ */
+
+
+oid             snmpNotifyFilterTable_variables_oid[] =
+    { 1, 3, 6, 1, 6, 3, 13, 1, 3 };
+
+
+/*
+ * variable2 snmpNotifyFilterTable_variables:
+ *   this variable defines function callbacks and type return information 
+ *   for the snmpNotifyFilterTable mib section 
+ */
+
+
+struct variable2 snmpNotifyFilterTable_variables[] = {
+    /*
+     * magic number        , variable type , ro/rw , callback fn  , L, oidsuffix 
+     */
+#define   SNMPNOTIFYFILTERMASK  4
+    {SNMPNOTIFYFILTERMASK, ASN_OCTET_STR, RWRITE,
+     var_snmpNotifyFilterTable, 2, {1, 2}},
+#define   SNMPNOTIFYFILTERTYPE  5
+    {SNMPNOTIFYFILTERTYPE, ASN_INTEGER, RWRITE, var_snmpNotifyFilterTable,
+     2, {1, 3}},
+#define   SNMPNOTIFYFILTERSTORAGETYPE  6
+    {SNMPNOTIFYFILTERSTORAGETYPE, ASN_INTEGER, RWRITE,
+     var_snmpNotifyFilterTable, 2, {1, 4}},
+#define   SNMPNOTIFYFILTERROWSTATUS  7
+    {SNMPNOTIFYFILTERROWSTATUS, ASN_INTEGER, RWRITE,
+     var_snmpNotifyFilterTable, 2, {1, 5}},
+
+};
+/*
+ * (L = length of the oidsuffix) 
+ */
+
+
+/*
+ * global storage of our data, saved in and configured by header_complex() 
+ */
+static struct header_complex_index *snmpNotifyFilterTableStorage = NULL;
+
+
+
+
+/*
+ * init_snmpNotifyFilterTable():
+ *   Initialization routine.  This is called when the agent starts up.
+ *   At a minimum, registration of your variables should take place here.
+ */
+void
+init_snmpNotifyFilterTable(void)
+{
+    DEBUGMSGTL(("snmpNotifyFilterTable", "initializing...  "));
+
+
+    /*
+     * register ourselves with the agent to handle our mib tree 
+     */
+    REGISTER_MIB("snmpNotifyFilterTable", snmpNotifyFilterTable_variables,
+                 variable2, snmpNotifyFilterTable_variables_oid);
+
+
+    /*
+     * register our config handler(s) to deal with registrations 
+     */
+    snmpd_register_config_handler("snmpNotifyFilterTable",
+                                  parse_snmpNotifyFilterTable, NULL, NULL);
+
+
+    /*
+     * we need to be called back later to store our data 
+     */
+    snmp_register_callback(SNMP_CALLBACK_LIBRARY, SNMP_CALLBACK_STORE_DATA,
+                           store_snmpNotifyFilterTable, NULL);
+
+
+    /*
+     * place any other initialization junk you need here 
+     */
+
+
+    DEBUGMSGTL(("snmpNotifyFilterTable", "done.\n"));
+}
+
+
+/*
+ * snmpNotifyFilterTable_add(): adds a structure node to our data set 
+ */
+int
+snmpNotifyFilterTable_add(struct snmpNotifyFilterTable_data *thedata)
+{
+    netsnmp_variable_list *vars = NULL;
+
+
+    DEBUGMSGTL(("snmpNotifyFilterTable", "adding data...  "));
+    /*
+     * add the index variables to the varbind list, which is 
+     * used by header_complex to index the data 
+     */
+
+    snmp_varlist_add_variable(&vars, NULL, 0, ASN_OCTET_STR,
+                              (u_char *) thedata->
+                              snmpNotifyFilterProfileName,
+                              thedata->snmpNotifyFilterProfileNameLen);
+    snmp_varlist_add_variable(&vars, NULL, 0, ASN_PRIV_IMPLIED_OBJECT_ID, (u_char *) thedata->snmpNotifyFilterSubtree, thedata->snmpNotifyFilterSubtreeLen * sizeof(oid));      /* snmpNotifyFilterSubtree */
+
+    header_complex_add_data(&snmpNotifyFilterTableStorage, vars, thedata);
+    DEBUGMSGTL(("snmpNotifyFilterTable", "registered an entry\n"));
+
+    DEBUGMSGTL(("snmpNotifyFilterTable", "done.\n"));
+    return SNMPERR_SUCCESS;
+}
+
+
+/*
+ * parse_snmpNotifyFilterTable():
+ *   parses .conf file entries needed to configure the mib.
+ */
+void
+parse_snmpNotifyFilterTable(const char *token, char *line)
+{
+    size_t          tmpint;
+    struct snmpNotifyFilterTable_data *StorageTmp =
+        SNMP_MALLOC_STRUCT(snmpNotifyFilterTable_data);
+
+
+    DEBUGMSGTL(("snmpNotifyFilterTable", "parsing config...  "));
+
+
+    if (StorageTmp == NULL) {
+        config_perror("malloc failure");
+        return;
+    }
+
+
+    line =
+        read_config_read_data(ASN_OCTET_STR, line,
+                              &StorageTmp->snmpNotifyFilterProfileName,
+                              &StorageTmp->snmpNotifyFilterProfileNameLen);
+    if (StorageTmp->snmpNotifyFilterProfileName == NULL) {
+        config_perror
+            ("invalid specification for snmpNotifyFilterProfileName");
+        return;
+    }
+
+    line =
+        read_config_read_data(ASN_OBJECT_ID, line,
+                              &StorageTmp->snmpNotifyFilterSubtree,
+                              &StorageTmp->snmpNotifyFilterSubtreeLen);
+    if (StorageTmp->snmpNotifyFilterSubtree == NULL) {
+        config_perror("invalid specification for snmpNotifyFilterSubtree");
+        return;
+    }
+
+    line =
+        read_config_read_data(ASN_OCTET_STR, line,
+                              &StorageTmp->snmpNotifyFilterMask,
+                              &StorageTmp->snmpNotifyFilterMaskLen);
+
+    line =
+        read_config_read_data(ASN_INTEGER, line,
+                              &StorageTmp->snmpNotifyFilterType, &tmpint);
+
+    line =
+        read_config_read_data(ASN_INTEGER, line,
+                              &StorageTmp->snmpNotifyFilterStorageType,
+                              &tmpint);
+
+    line =
+        read_config_read_data(ASN_INTEGER, line,
+                              &StorageTmp->snmpNotifyFilterRowStatus,
+                              &tmpint);
+
+    snmpNotifyFilterTable_add(StorageTmp);
+
+    DEBUGMSGTL(("snmpNotifyFilterTable", "done.\n"));
+}
+
+
+
+
+/*
+ * store_snmpNotifyFilterTable():
+ *   stores .conf file entries needed to configure the mib.
+ */
+int
+store_snmpNotifyFilterTable(int majorID, int minorID, void *serverarg,
+                            void *clientarg)
+{
+    char            line[SNMP_MAXBUF];
+    char           *cptr;
+    size_t          tmpint;
+    struct snmpNotifyFilterTable_data *StorageTmp;
+    struct header_complex_index *hcindex;
+
+
+    DEBUGMSGTL(("snmpNotifyFilterTable", "storing data...  "));
+
+
+    for (hcindex = snmpNotifyFilterTableStorage; hcindex != NULL;
+         hcindex = hcindex->next) {
+        StorageTmp = (struct snmpNotifyFilterTable_data *) hcindex->data;
+
+
+        if (StorageTmp->snmpNotifyFilterStorageType == ST_NONVOLATILE) {
+
+            memset(line, 0, sizeof(line));
+            strcat(line, "snmpNotifyFilterTable ");
+            cptr = line + strlen(line);
+
+            cptr =
+                read_config_store_data(ASN_OCTET_STR, cptr,
+                                       &StorageTmp->
+                                       snmpNotifyFilterProfileName,
+                                       &StorageTmp->
+                                       snmpNotifyFilterProfileNameLen);
+            cptr =
+                read_config_store_data(ASN_OBJECT_ID, cptr,
+                                       &StorageTmp->
+                                       snmpNotifyFilterSubtree,
+                                       &StorageTmp->
+                                       snmpNotifyFilterSubtreeLen);
+            cptr =
+                read_config_store_data(ASN_OCTET_STR, cptr,
+                                       &StorageTmp->snmpNotifyFilterMask,
+                                       &StorageTmp->
+                                       snmpNotifyFilterMaskLen);
+            cptr =
+                read_config_store_data(ASN_INTEGER, cptr,
+                                       &StorageTmp->snmpNotifyFilterType,
+                                       &tmpint);
+            cptr =
+                read_config_store_data(ASN_INTEGER, cptr,
+                                       &StorageTmp->
+                                       snmpNotifyFilterStorageType,
+                                       &tmpint);
+            cptr =
+                read_config_store_data(ASN_INTEGER, cptr,
+                                       &StorageTmp->
+                                       snmpNotifyFilterRowStatus, &tmpint);
+
+
+
+            snmpd_store_config(line);
+        }
+    }
+    DEBUGMSGTL(("snmpNotifyFilterTable", "done.\n"));
+    return 0;
+}
+
+
+
+
+/*
+ * var_snmpNotifyFilterTable():
+ *   Handle this table separately from the scalar value case.
+ *   The workings of this are basically the same as for var_snmpNotifyFilterTable above.
+ */
+unsigned char  *
+var_snmpNotifyFilterTable(struct variable *vp,
+                          oid * name,
+                          size_t * length,
+                          int exact,
+                          size_t * var_len, WriteMethod ** write_method)
+{
+
+
+    struct snmpNotifyFilterTable_data *StorageTmp = NULL;
+
+
+    DEBUGMSGTL(("snmpNotifyFilterTable",
+                "var_snmpNotifyFilterTable: Entering...  \n"));
+    /*
+     * this assumes you have registered all your data properly
+     */
+    if ((StorageTmp = (struct snmpNotifyFilterTable_data *)
+         header_complex((struct header_complex_index *)
+                        snmpNotifyFilterTableStorage, vp, name, length,
+                        exact, var_len, write_method)) == NULL) {
+        if (vp->magic == SNMPNOTIFYFILTERROWSTATUS)
+            *write_method = write_snmpNotifyFilterRowStatus;
+        return NULL;
+    }
+
+
+    /*
+     * this is where we do the value assignments for the mib results.
+     */
+    switch (vp->magic) {
+
+
+    case SNMPNOTIFYFILTERMASK:
+        *write_method = write_snmpNotifyFilterMask;
+        *var_len = StorageTmp->snmpNotifyFilterMaskLen;
+        return (u_char *) StorageTmp->snmpNotifyFilterMask;
+
+    case SNMPNOTIFYFILTERTYPE:
+        *write_method = write_snmpNotifyFilterType;
+        *var_len = sizeof(StorageTmp->snmpNotifyFilterType);
+        return (u_char *) & StorageTmp->snmpNotifyFilterType;
+
+    case SNMPNOTIFYFILTERSTORAGETYPE:
+        *write_method = write_snmpNotifyFilterStorageType;
+        *var_len = sizeof(StorageTmp->snmpNotifyFilterStorageType);
+        return (u_char *) & StorageTmp->snmpNotifyFilterStorageType;
+
+    case SNMPNOTIFYFILTERROWSTATUS:
+        *write_method = write_snmpNotifyFilterRowStatus;
+        *var_len = sizeof(StorageTmp->snmpNotifyFilterRowStatus);
+        return (u_char *) & StorageTmp->snmpNotifyFilterRowStatus;
+
+
+    default:
+        ERROR_MSG("");
+    }
+    return NULL;
+}
+
+
+
+
+int
+write_snmpNotifyFilterMask(int action,
+                           u_char * var_val,
+                           u_char var_val_type,
+                           size_t var_val_len,
+                           u_char * statP, oid * name, size_t name_len)
+{
+    static char    *tmpvar;
+    struct snmpNotifyFilterTable_data *StorageTmp = NULL;
+    static size_t   tmplen;
+    size_t          newlen =
+        name_len -
+        (sizeof(snmpNotifyFilterTable_variables_oid) / sizeof(oid) + 3 -
+         1);
+
+    DEBUGMSGTL(("snmpNotifyFilterTable",
+                "write_snmpNotifyFilterMask entering action=%d...  \n",
+                action));
+    if ((StorageTmp = (struct snmpNotifyFilterTable_data *)
+         header_complex((struct header_complex_index *)
+                        snmpNotifyFilterTableStorage, NULL,
+                        &name[sizeof(snmpNotifyFilterTable_variables_oid) /
+                              sizeof(oid) + 3 - 1], &newlen, 1, NULL,
+                        NULL)) == NULL)
+        return SNMP_ERR_NOSUCHNAME;     /* remove if you support creation here */
+
+
+    switch (action) {
+    case RESERVE1:
+        if (var_val_type != ASN_OCTET_STR) {
+            fprintf(stderr,
+                    "write to snmpNotifyFilterMask not ASN_OCTET_STR\n");
+            return SNMP_ERR_WRONGTYPE;
+        }
+        break;
+
+
+    case RESERVE2:
+        /*
+         * memory reseveration, final preparation... 
+         */
+        break;
+
+
+    case FREE:
+        /*
+         * Release any resources that have been allocated 
+         */
+        break;
+
+
+    case ACTION:
+        /*
+         * The variable has been stored in string for
+         * you to use, and you have just been asked to do something with
+         * it.  Note that anything done here must be reversable in the UNDO case 
+         */
+        tmpvar = StorageTmp->snmpNotifyFilterMask;
+        tmplen = StorageTmp->snmpNotifyFilterMaskLen;
+        memdup((u_char **) & StorageTmp->snmpNotifyFilterMask, var_val,
+               var_val_len);
+        StorageTmp->snmpNotifyFilterMaskLen = var_val_len;
+        break;
+
+
+    case UNDO:
+        /*
+         * Back out any changes made in the ACTION case 
+         */
+        SNMP_FREE(StorageTmp->snmpNotifyFilterMask);
+        StorageTmp->snmpNotifyFilterMask = tmpvar;
+        StorageTmp->snmpNotifyFilterMaskLen = tmplen;
+        break;
+
+
+    case COMMIT:
+        /*
+         * Things are working well, so it's now safe to make the change
+         * permanently.  Make sure that anything done here can't fail! 
+         */
+        SNMP_FREE(tmpvar);
+        break;
+    }
+    return SNMP_ERR_NOERROR;
+}
+
+
+
+int
+write_snmpNotifyFilterType(int action,
+                           u_char * var_val,
+                           u_char var_val_type,
+                           size_t var_val_len,
+                           u_char * statP, oid * name, size_t name_len)
+{
+    static int      tmpvar;
+    struct snmpNotifyFilterTable_data *StorageTmp = NULL;
+    size_t          newlen =
+        name_len -
+        (sizeof(snmpNotifyFilterTable_variables_oid) / sizeof(oid) + 3 -
+         1);
+
+
+    DEBUGMSGTL(("snmpNotifyFilterTable",
+                "write_snmpNotifyFilterType entering action=%d...  \n",
+                action));
+    if ((StorageTmp = (struct snmpNotifyFilterTable_data *)
+         header_complex((struct header_complex_index *)
+                        snmpNotifyFilterTableStorage, NULL,
+                        &name[sizeof(snmpNotifyFilterTable_variables_oid) /
+                              sizeof(oid) + 3 - 1], &newlen, 1, NULL,
+                        NULL)) == NULL)
+        return SNMP_ERR_NOSUCHNAME;     /* remove if you support creation here */
+
+
+    switch (action) {
+    case RESERVE1:
+        if (var_val_type != ASN_INTEGER) {
+            fprintf(stderr,
+                    "write to snmpNotifyFilterType not ASN_INTEGER\n");
+            return SNMP_ERR_WRONGTYPE;
+        }
+        break;
+
+
+    case RESERVE2:
+        /*
+         * memory reseveration, final preparation... 
+         */
+        break;
+
+
+    case FREE:
+        /*
+         * Release any resources that have been allocated 
+         */
+        break;
+
+
+    case ACTION:
+        /*
+         * The variable has been stored in long_ret for
+         * you to use, and you have just been asked to do something with
+         * it.  Note that anything done here must be reversable in the UNDO case 
+         */
+        tmpvar = StorageTmp->snmpNotifyFilterType;
+        StorageTmp->snmpNotifyFilterType = *((long *) var_val);
+        break;
+
+
+    case UNDO:
+        /*
+         * Back out any changes made in the ACTION case 
+         */
+        StorageTmp->snmpNotifyFilterType = tmpvar;
+        break;
+
+
+    case COMMIT:
+        /*
+         * Things are working well, so it's now safe to make the change
+         * permanently.  Make sure that anything done here can't fail! 
+         */
+
+        break;
+    }
+    return SNMP_ERR_NOERROR;
+}
+
+
+
+int
+write_snmpNotifyFilterStorageType(int action,
+                                  u_char * var_val,
+                                  u_char var_val_type,
+                                  size_t var_val_len,
+                                  u_char * statP,
+                                  oid * name, size_t name_len)
+{
+    static int      tmpvar;
+    struct snmpNotifyFilterTable_data *StorageTmp = NULL;
+    size_t          newlen =
+        name_len -
+        (sizeof(snmpNotifyFilterTable_variables_oid) / sizeof(oid) + 3 -
+         1);
+
+
+    DEBUGMSGTL(("snmpNotifyFilterTable",
+                "write_snmpNotifyFilterStorageType entering action=%d...  \n",
+                action));
+    if ((StorageTmp = (struct snmpNotifyFilterTable_data *)
+         header_complex((struct header_complex_index *)
+                        snmpNotifyFilterTableStorage, NULL,
+                        &name[sizeof(snmpNotifyFilterTable_variables_oid) /
+                              sizeof(oid) + 3 - 1], &newlen, 1, NULL,
+                        NULL)) == NULL)
+        return SNMP_ERR_NOSUCHNAME;     /* remove if you support creation here */
+
+
+    switch (action) {
+    case RESERVE1:
+        if (var_val_type != ASN_INTEGER) {
+            fprintf(stderr,
+                    "write to snmpNotifyFilterStorageType not ASN_INTEGER\n");
+            return SNMP_ERR_WRONGTYPE;
+        }
+        break;
+
+
+    case RESERVE2:
+        /*
+         * memory reseveration, final preparation... 
+         */
+        break;
+
+
+    case FREE:
+        /*
+         * Release any resources that have been allocated 
+         */
+        break;
+
+
+    case ACTION:
+        /*
+         * The variable has been stored in long_ret for
+         * you to use, and you have just been asked to do something with
+         * it.  Note that anything done here must be reversable in the UNDO case 
+         */
+        tmpvar = StorageTmp->snmpNotifyFilterStorageType;
+        StorageTmp->snmpNotifyFilterStorageType = *((long *) var_val);
+        break;
+
+
+    case UNDO:
+        /*
+         * Back out any changes made in the ACTION case 
+         */
+        StorageTmp->snmpNotifyFilterStorageType = tmpvar;
+        break;
+
+
+    case COMMIT:
+        /*
+         * Things are working well, so it's now safe to make the change
+         * permanently.  Make sure that anything done here can't fail! 
+         */
+
+        break;
+    }
+    return SNMP_ERR_NOERROR;
+}
+
+
+
+
+
+
+int
+write_snmpNotifyFilterRowStatus(int action,
+                                u_char * var_val,
+                                u_char var_val_type,
+                                size_t var_val_len,
+                                u_char * statP,
+                                oid * name, size_t name_len)
+{
+    struct snmpNotifyFilterTable_data *StorageTmp = NULL;
+    static struct snmpNotifyFilterTable_data *StorageNew, *StorageDel;
+    size_t          newlen =
+        name_len -
+        (sizeof(snmpNotifyFilterTable_variables_oid) / sizeof(oid) + 3 -
+         1);
+    static int      old_value;
+    int             set_value;
+    static netsnmp_variable_list *vars, *vp;
+    struct header_complex_index *hciptr;
+
+
+    StorageTmp = (struct snmpNotifyFilterTable_data *)
+        header_complex((struct header_complex_index *)
+                       snmpNotifyFilterTableStorage, NULL,
+                       &name[sizeof(snmpNotifyFilterTable_variables_oid) /
+                             sizeof(oid) + 3 - 1], &newlen, 1, NULL, NULL);
+
+
+
+
+    if (var_val_type != ASN_INTEGER || var_val == NULL) {
+        fprintf(stderr,
+                "write to snmpNotifyFilterRowStatus not ASN_INTEGER\n");
+        return SNMP_ERR_WRONGTYPE;
+    }
+    set_value = *((long *) var_val);
+
+
+    /*
+     * check legal range, and notReady is reserved for us, not a user 
+     */
+    if (set_value < 1 || set_value > 6 || set_value == RS_NOTREADY)
+        return SNMP_ERR_INCONSISTENTVALUE;
+
+
+    switch (action) {
+    case RESERVE1:
+        /*
+         * stage one: test validity 
+         */
+        if (StorageTmp == NULL) {
+            /*
+             * create the row now? 
+             */
+
+
+            /*
+             * ditch illegal values now 
+             */
+            if (set_value == RS_ACTIVE || set_value == RS_NOTINSERVICE)
+                return SNMP_ERR_INCONSISTENTVALUE;
+
+        } else {
+            /*
+             * row exists.  Check for a valid state change 
+             */
+            if (set_value == RS_CREATEANDGO
+                || set_value == RS_CREATEANDWAIT) {
+                /*
+                 * can't create a row that exists 
+                 */
+                return SNMP_ERR_INCONSISTENTVALUE;
+            }
+            /*
+             * XXX: interaction with row storage type needed 
+             */
+        }
+        break;
+
+
+
+
+    case RESERVE2:
+        /*
+         * memory reseveration, final preparation... 
+         */
+        if (StorageTmp == NULL &&
+            (set_value == RS_CREATEANDGO
+             || set_value == RS_CREATEANDWAIT)) {
+            /*
+             * creation 
+             */
+            vars = NULL;
+
+            snmp_varlist_add_variable(&vars, NULL, 0, ASN_OCTET_STR, NULL, 0);  /* snmpNotifyFilterSubtree */
+            snmp_varlist_add_variable(&vars, NULL, 0, ASN_PRIV_IMPLIED_OBJECT_ID, NULL, 0);     /* snmpNotifyFilterSubtree */
+
+            if (header_complex_parse_oid
+                (&
+                 (name
+                  [sizeof(snmpNotifyFilterTable_variables_oid) /
+                   sizeof(oid) + 2]), newlen, vars) != SNMPERR_SUCCESS) {
+                /*
+                 * XXX: free, zero vars 
+                 */
+                return SNMP_ERR_INCONSISTENTNAME;
+            }
+            vp = vars;
+
+            StorageNew = SNMP_MALLOC_STRUCT(snmpNotifyFilterTable_data);
+            memdup((u_char **) & (StorageNew->snmpNotifyFilterProfileName),
+                   (u_char *) vp->val.string, vp->val_len);
+            StorageNew->snmpNotifyFilterProfileNameLen = vp->val_len;
+            vp = vp->next_variable;
+            memdup((u_char **) & (StorageNew->snmpNotifyFilterSubtree),
+                   (u_char *) vp->val.objid, vp->val_len);
+            StorageNew->snmpNotifyFilterSubtreeLen =
+                vp->val_len / sizeof(oid);
+
+            StorageNew->snmpNotifyFilterMask = (char *) calloc(1, 1);
+            StorageNew->snmpNotifyFilterMaskLen = 0;
+            StorageNew->snmpNotifyFilterType =
+                SNMPNOTIFYFILTERTYPE_INCLUDED;
+            StorageNew->snmpNotifyFilterStorageType = ST_NONVOLATILE;
+            StorageNew->snmpNotifyFilterRowStatus = set_value;
+            /*
+             * XXX: free, zero vars, no longer needed? 
+             */
+        }
+
+
+        break;
+
+
+
+
+    case FREE:
+        /*
+         * XXX: free, zero vars 
+         */
+        /*
+         * Release any resources that have been allocated 
+         */
+        break;
+
+
+
+
+    case ACTION:
+        /*
+         * The variable has been stored in set_value for you to
+         * use, and you have just been asked to do something with
+         * it.  Note that anything done here must be reversable in
+         * the UNDO case 
+         */
+
+
+        if (StorageTmp == NULL &&
+            (set_value == RS_CREATEANDGO ||
+             set_value == RS_CREATEANDWAIT)) {
+            /*
+             * row creation, so add it 
+             */
+            if (StorageNew != NULL)
+                snmpNotifyFilterTable_add(StorageNew);
+            /*
+             * XXX: ack, and if it is NULL? 
+             */
+        } else if (set_value != RS_DESTROY) {
+            /*
+             * set the flag? 
+             */
+            old_value = StorageTmp->snmpNotifyFilterRowStatus;
+            StorageTmp->snmpNotifyFilterRowStatus = *((long *) var_val);
+        } else {
+            /*
+             * destroy...  extract it for now 
+             */
+            if (StorageTmp) {
+                hciptr =
+                    header_complex_find_entry(snmpNotifyFilterTableStorage,
+                                              StorageTmp);
+                StorageDel = (struct snmpNotifyFilterTable_data *)
+                    header_complex_extract_entry((struct
+                                                  header_complex_index **)
+                                                 &snmpNotifyFilterTableStorage,
+                                                 hciptr);
+            }
+        }
+        break;
+
+
+
+
+    case UNDO:
+        /*
+         * Back out any changes made in the ACTION case 
+         */
+        if (StorageTmp == NULL &&
+            (set_value == RS_CREATEANDGO ||
+             set_value == RS_CREATEANDWAIT)) {
+            /*
+             * row creation, so remove it again 
+             */
+            hciptr =
+                header_complex_find_entry(snmpNotifyFilterTableStorage,
+                                          StorageNew);
+            StorageDel = (struct snmpNotifyFilterTable_data *)
+                header_complex_extract_entry((struct header_complex_index
+                                              **)
+                                             &snmpNotifyFilterTableStorage,
+                                             hciptr);
+            /*
+             * XXX: free it 
+             */
+        } else if (StorageDel != NULL) {
+            /*
+             * row deletion, so add it again 
+             */
+            snmpNotifyFilterTable_add(StorageDel);
+            StorageDel = NULL;
+        } else if (set_value != RS_DESTROY) {
+            StorageTmp->snmpNotifyFilterRowStatus = old_value;
+        }
+        break;
+
+
+
+
+    case COMMIT:
+        /*
+         * Things are working well, so it's now safe to make the change
+         * permanently.  Make sure that anything done here can't fail! 
+         */
+        if (StorageDel != NULL) {
+            StorageDel = NULL;
+            /*
+             * XXX: free it, its dead 
+             */
+        } else {
+            if (StorageTmp
+                && StorageTmp->snmpNotifyFilterRowStatus ==
+                RS_CREATEANDGO) {
+                StorageTmp->snmpNotifyFilterRowStatus = RS_ACTIVE;
+            } else if (StorageTmp &&
+                       StorageTmp->snmpNotifyFilterRowStatus ==
+                       RS_CREATEANDWAIT) {
+                StorageTmp->snmpNotifyFilterRowStatus = RS_NOTINSERVICE;
+            }
+        }
+        break;
+    }
+    return SNMP_ERR_NOERROR;
+}
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/notification/snmpNotifyFilterTable.h tomato121/release/src/router/snmp/agent/mibgroup/notification/snmpNotifyFilterTable.h
--- tomato/release/src/router/snmp/agent/mibgroup/notification/snmpNotifyFilterTable.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/notification/snmpNotifyFilterTable.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,74 @@
+/*
+ * This file was generated by mib2c and is intended for use as a mib module
+ * for the ucd-snmp snmpd agent. 
+ */
+
+
+#ifndef _MIBGROUP_SNMPNOTIFYFILTERTABLE_H
+#define _MIBGROUP_SNMPNOTIFYFILTERTABLE_H
+
+
+/*
+ * we may use header_complex from the header_complex module 
+ */
+
+
+config_require(header_complex)
+
+
+    /*
+     * our storage structure(s) 
+     */
+     struct snmpNotifyFilterTable_data {
+
+         char           *snmpNotifyFilterProfileName;
+         size_t          snmpNotifyFilterProfileNameLen;
+         oid            *snmpNotifyFilterSubtree;
+         size_t          snmpNotifyFilterSubtreeLen;
+         char           *snmpNotifyFilterMask;
+         size_t          snmpNotifyFilterMaskLen;
+         long            snmpNotifyFilterType;
+         long            snmpNotifyFilterStorageType;
+         long            snmpNotifyFilterRowStatus;
+
+     };
+
+
+
+
+/*
+ * enum definitions from the covered mib sections 
+ */
+
+
+
+
+
+
+#define SNMPNOTIFYFILTERTYPE_INCLUDED            1
+#define SNMPNOTIFYFILTERTYPE_EXCLUDED            2
+
+
+
+
+/*
+ * function prototypes 
+ */
+
+
+     void            init_snmpNotifyFilterTable(void);
+     FindVarMethod   var_snmpNotifyFilterTable;
+     void            parse_snmpNotifyFilterTable(const char *, char *);
+     SNMPCallback    store_snmpNotifyFilterTable;
+
+
+     WriteMethod     write_snmpNotifyFilterMask;
+     WriteMethod     write_snmpNotifyFilterType;
+     WriteMethod     write_snmpNotifyFilterStorageType;
+     WriteMethod     write_snmpNotifyFilterRowStatus;
+
+     WriteMethod     write_snmpNotifyFilterRowStatus;
+
+
+
+#endif                          /* _MIBGROUP_SNMPNOTIFYFILTERTABLE_H */
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/notification/snmpNotifyTable.c tomato121/release/src/router/snmp/agent/mibgroup/notification/snmpNotifyTable.c
--- tomato/release/src/router/snmp/agent/mibgroup/notification/snmpNotifyTable.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/notification/snmpNotifyTable.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,981 @@
+/*
+ * This file was generated by mib2c and is intended for use as
+ * a mib module for the ucd-snmp snmpd agent. 
+ */
+
+
+/*
+ * This should always be included first before anything else 
+ */
+#include <net-snmp/net-snmp-config.h>
+
+#include <sys/types.h>
+#if HAVE_WINSOCK_H
+#include <winsock.h>
+#endif
+#if HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#if HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+
+/*
+ * minimal include directives 
+ */
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+#include "header_complex.h"
+#include "snmpNotifyTable.h"
+#include "target/snmpTargetParamsEntry.h"
+#include "target/snmpTargetAddrEntry.h"
+#include "target/target.h"
+#include <net-snmp/agent/agent_callbacks.h>
+#include <net-snmp/agent/agent_trap.h>
+
+SNMPCallback    store_snmpNotifyTable;
+
+/*
+ * snmpNotifyTable_variables_oid:
+ *   this is the top level oid that we want to register under.  This
+ *   is essentially a prefix, with the suffix appearing in the
+ *   variable below.
+ */
+
+
+oid             snmpNotifyTable_variables_oid[] =
+    { 1, 3, 6, 1, 6, 3, 13, 1, 1 };
+
+
+/*
+ * variable2 snmpNotifyTable_variables:
+ *   this variable defines function callbacks and type return information 
+ *   for the snmpNotifyTable mib section 
+ */
+
+
+struct variable2 snmpNotifyTable_variables[] = {
+    /*
+     * magic number        , variable type , ro/rw , callback fn  , L, oidsuffix 
+     */
+#define   SNMPNOTIFYTAG         4
+    {SNMPNOTIFYTAG, ASN_OCTET_STR, RWRITE, var_snmpNotifyTable, 2, {1, 2}},
+#define   SNMPNOTIFYTYPE        5
+    {SNMPNOTIFYTYPE, ASN_INTEGER, RWRITE, var_snmpNotifyTable, 2, {1, 3}},
+#define   SNMPNOTIFYSTORAGETYPE  6
+    {SNMPNOTIFYSTORAGETYPE, ASN_INTEGER, RWRITE, var_snmpNotifyTable, 2,
+     {1, 4}},
+#define   SNMPNOTIFYROWSTATUS   7
+    {SNMPNOTIFYROWSTATUS, ASN_INTEGER, RWRITE, var_snmpNotifyTable, 2,
+     {1, 5}},
+
+};
+/*
+ * (L = length of the oidsuffix) 
+ */
+
+
+/*
+ * global storage of our data, saved in and configured by header_complex() 
+ */
+static struct header_complex_index *snmpNotifyTableStorage = NULL;
+
+int
+send_notifications(int major, int minor, void *serverarg, void *clientarg)
+{
+    struct header_complex_index *hptr;
+    struct snmpNotifyTable_data *nptr;
+    netsnmp_session *sess, *sptr;
+    netsnmp_pdu    *template_pdu = (netsnmp_pdu *) serverarg;
+
+    DEBUGMSGTL(("send_notifications", "starting: pdu=%x, vars=%x\n",
+                template_pdu, template_pdu->variables));
+
+    for (hptr = snmpNotifyTableStorage; hptr; hptr = hptr->next) {
+        nptr = (struct snmpNotifyTable_data *) hptr->data;
+        if (nptr->snmpNotifyRowStatus != RS_ACTIVE)
+            continue;
+        if (!nptr->snmpNotifyTag)
+            continue;
+
+        sess = get_target_sessions(nptr->snmpNotifyTag, NULL, NULL);
+
+        /*
+         * XXX: filter appropriately 
+         */
+
+        for (sptr = sess; sptr; sptr = sptr->next) {
+            if (sptr->version == SNMP_VERSION_1 &&
+                minor == SNMPD_CALLBACK_SEND_TRAP1) {
+                send_trap_to_sess(sptr, template_pdu);
+            } else if (sptr->version != SNMP_VERSION_1 &&
+                       minor == SNMPD_CALLBACK_SEND_TRAP2) {
+                if (nptr->snmpNotifyType == SNMPNOTIFYTYPE_INFORM) {
+                    template_pdu->command = SNMP_MSG_INFORM;
+                } else {
+                    template_pdu->command = SNMP_MSG_TRAP2;
+                }
+                send_trap_to_sess(sptr, template_pdu);
+            }
+        }
+    }
+    return 0;
+}
+
+#define MAX_ENTRIES 1024
+
+int
+notifyTable_register_notifications(int major, int minor,
+                                   void *serverarg, void *clientarg)
+{
+    struct targetAddrTable_struct *ptr;
+    struct targetParamTable_struct *pptr;
+    struct snmpNotifyTable_data *nptr;
+    int             confirm, i;
+    char            buf[SNMP_MAXBUF_SMALL];
+    netsnmp_transport *t = NULL;
+    struct agent_add_trap_args *args =
+        (struct agent_add_trap_args *) serverarg;
+    netsnmp_session *ss;
+
+    if (!args || !(args->ss)) {
+        return (0);
+    }
+    confirm = args->confirm;
+    ss = args->ss;
+
+    /*
+     * XXX: START move target creation to target code 
+     */
+    for (i = 0; i < MAX_ENTRIES; i++) {
+        sprintf(buf, "internal%d", i);
+        if (get_addrForName(buf) == NULL && get_paramEntry(buf) == NULL)
+            break;
+    }
+    if (i == MAX_ENTRIES) {
+        snmp_log(LOG_ERR,
+                 "Can't register new trap destination: max limit reached: %d",
+                 MAX_ENTRIES);
+        snmp_sess_close(ss);
+        return (0);
+    }
+
+    /*
+     * address 
+     */
+    ptr = snmpTargetAddrTable_create();
+    ptr->name = strdup(buf);
+    t = snmp_sess_transport(snmp_sess_pointer(ss));
+    memcpy(ptr->tDomain, t->domain, t->domain_length * sizeof(oid));
+    ptr->tDomainLen = t->domain_length;
+    ptr->tAddressLen = t->remote_length;
+    ptr->tAddress = t->remote;
+
+    ptr->timeout = ss->timeout / 1000;
+    ptr->retryCount = ss->retries;
+    SNMP_FREE(ptr->tagList);
+    ptr->tagList = strdup(ptr->name);
+    ptr->params = strdup(ptr->name);
+    ptr->storageType = ST_READONLY;
+    ptr->rowStatus = RS_ACTIVE;
+    ptr->sess = ss;
+    DEBUGMSGTL(("trapsess", "adding to trap table\n"));
+    snmpTargetAddrTable_add(ptr);
+
+    /*
+     * param 
+     */
+    pptr = snmpTargetParamTable_create();
+    pptr->paramName = strdup(buf);
+    pptr->mpModel = ss->version;
+    if (ss->version == SNMP_VERSION_3) {
+        pptr->secModel = ss->securityModel;
+        pptr->secLevel = ss->securityLevel;
+        pptr->secName = (char *) malloc(ss->securityNameLen + 1);
+        memcpy((void *) pptr->secName, (void *) ss->securityName,
+               ss->securityNameLen);
+        pptr->secName[ss->securityNameLen] = 0;
+    } else {
+        pptr->secModel = ss->version == SNMP_VERSION_1 ?
+            SNMP_SEC_MODEL_SNMPv1 : SNMP_SEC_MODEL_SNMPv2c;
+        pptr->secLevel = SNMP_SEC_LEVEL_NOAUTH;
+        pptr->secName = NULL;
+        if (ss->community && (ss->community_len > 0)) {
+            pptr->secName = (char *) malloc(ss->community_len + 1);
+            memcpy((void *) pptr->secName, (void *) ss->community,
+                   ss->community_len);
+            pptr->secName[ss->community_len] = 0;
+        }
+    }
+    pptr->storageType = ST_READONLY;
+    pptr->rowStatus = RS_ACTIVE;
+    snmpTargetParamTable_add(pptr);
+    /*
+     * XXX: END move target creation to target code 
+     */
+
+    /*
+     * notify table 
+     */
+    nptr = SNMP_MALLOC_STRUCT(snmpNotifyTable_data);
+    nptr->snmpNotifyName = strdup(buf);
+    nptr->snmpNotifyNameLen = strlen(buf);
+    nptr->snmpNotifyTag = strdup(buf);
+    nptr->snmpNotifyTagLen = strlen(buf);
+    nptr->snmpNotifyType = confirm ?
+        SNMPNOTIFYTYPE_INFORM : SNMPNOTIFYTYPE_TRAP;
+    nptr->snmpNotifyStorageType = ST_READONLY;
+    nptr->snmpNotifyRowStatus = RS_ACTIVE;
+
+    snmpNotifyTable_add(nptr);
+    return 0;
+}
+
+
+/*
+ * XXX: this really needs to be done for the target mib entries too.
+ * But we can only trust that we've added stuff here and we don't want
+ * to destroy other valid entries in the target tables, so...  Don't
+ * do too many kill -HUPs to your agent as re reading the config file
+ * will be a slow memory leak in the target mib. 
+ */
+int
+notifyTable_unregister_notifications(int major, int minor,
+                                     void *serverarg, void *clientarg)
+{
+    struct header_complex_index *hptr, *nhptr;
+    struct snmpNotifyTable_data *nptr;
+
+    for (hptr = snmpNotifyTableStorage; hptr; hptr = nhptr) {
+        nptr = (struct snmpNotifyTable_data *) hptr->data;
+        nhptr = hptr->next;
+        if (nptr->snmpNotifyStorageType == ST_READONLY) {
+            header_complex_extract_entry(&snmpNotifyTableStorage, hptr);
+            SNMP_FREE(nptr->snmpNotifyName);
+            SNMP_FREE(nptr->snmpNotifyTag);
+            SNMP_FREE(nptr);
+        }
+    }
+    return (0);
+}
+
+/*
+ * init_snmpNotifyTable():
+ *   Initialization routine.  This is called when the agent starts up.
+ *   At a minimum, registration of your variables should take place here.
+ */
+void
+init_snmpNotifyTable(void)
+{
+    DEBUGMSGTL(("snmpNotifyTable", "initializing...  "));
+
+
+    /*
+     * register ourselves with the agent to handle our mib tree 
+     */
+    REGISTER_MIB("snmpNotifyTable", snmpNotifyTable_variables, variable2,
+                 snmpNotifyTable_variables_oid);
+
+
+    /*
+     * register our config handler(s) to deal with registrations 
+     */
+    snmpd_register_config_handler("snmpNotifyTable", parse_snmpNotifyTable,
+                                  NULL, NULL);
+
+
+    /*
+     * we need to be called back later to store our data 
+     */
+    snmp_register_callback(SNMP_CALLBACK_LIBRARY, SNMP_CALLBACK_STORE_DATA,
+                           store_snmpNotifyTable, NULL);
+
+    snmp_register_callback(SNMP_CALLBACK_APPLICATION,
+                           SNMPD_CALLBACK_SEND_TRAP1, send_notifications,
+                           NULL);
+    snmp_register_callback(SNMP_CALLBACK_APPLICATION,
+                           SNMPD_CALLBACK_SEND_TRAP2, send_notifications,
+                           NULL);
+    snmp_register_callback(SNMP_CALLBACK_APPLICATION,
+                           SNMPD_CALLBACK_REGISTER_NOTIFICATIONS,
+                           notifyTable_register_notifications, NULL);
+    snmp_register_callback(SNMP_CALLBACK_APPLICATION,
+                           SNMPD_CALLBACK_PRE_UPDATE_CONFIG,
+                           notifyTable_unregister_notifications, NULL);
+
+    /*
+     * place any other initialization junk you need here 
+     */
+
+
+    DEBUGMSGTL(("snmpNotifyTable", "done.\n"));
+}
+
+
+/*
+ * snmpNotifyTable_add(): adds a structure node to our data set 
+ */
+int
+snmpNotifyTable_add(struct snmpNotifyTable_data *thedata)
+{
+    netsnmp_variable_list *vars = NULL;
+
+
+    DEBUGMSGTL(("snmpNotifyTable", "adding data...  "));
+    /*
+     * add the index variables to the varbind list, which is 
+     * used by header_complex to index the data 
+     */
+
+
+    snmp_varlist_add_variable(&vars, NULL, 0, ASN_PRIV_IMPLIED_OCTET_STR, (u_char *) thedata->snmpNotifyName, thedata->snmpNotifyNameLen);      /* snmpNotifyName */
+
+
+
+    header_complex_add_data(&snmpNotifyTableStorage, vars, thedata);
+    DEBUGMSGTL(("snmpNotifyTable", "registered an entry\n"));
+
+
+    DEBUGMSGTL(("snmpNotifyTable", "done.\n"));
+    return SNMPERR_SUCCESS;
+}
+
+
+/*
+ * parse_snmpNotifyTable():
+ *   parses .conf file entries needed to configure the mib.
+ */
+void
+parse_snmpNotifyTable(const char *token, char *line)
+{
+    size_t          tmpint;
+    struct snmpNotifyTable_data *StorageTmp =
+        SNMP_MALLOC_STRUCT(snmpNotifyTable_data);
+
+
+    DEBUGMSGTL(("snmpNotifyTable", "parsing config...  "));
+
+
+    if (StorageTmp == NULL) {
+        config_perror("malloc failure");
+        return;
+    }
+
+    line =
+        read_config_read_data(ASN_OCTET_STR, line,
+                              &StorageTmp->snmpNotifyName,
+                              &StorageTmp->snmpNotifyNameLen);
+    if (StorageTmp->snmpNotifyName == NULL) {
+        config_perror("invalid specification for snmpNotifyName");
+        return;
+    }
+
+    line =
+        read_config_read_data(ASN_OCTET_STR, line,
+                              &StorageTmp->snmpNotifyTag,
+                              &StorageTmp->snmpNotifyTagLen);
+    if (StorageTmp->snmpNotifyTag == NULL) {
+        config_perror("invalid specification for snmpNotifyTag");
+        return;
+    }
+
+    line =
+        read_config_read_data(ASN_INTEGER, line,
+                              &StorageTmp->snmpNotifyType, &tmpint);
+
+    line =
+        read_config_read_data(ASN_INTEGER, line,
+                              &StorageTmp->snmpNotifyStorageType, &tmpint);
+
+    line =
+        read_config_read_data(ASN_INTEGER, line,
+                              &StorageTmp->snmpNotifyRowStatus, &tmpint);
+
+
+
+
+    snmpNotifyTable_add(StorageTmp);
+
+
+    DEBUGMSGTL(("snmpNotifyTable", "done.\n"));
+}
+
+
+
+
+/*
+ * store_snmpNotifyTable():
+ *   stores .conf file entries needed to configure the mib.
+ */
+int
+store_snmpNotifyTable(int majorID, int minorID, void *serverarg,
+                      void *clientarg)
+{
+    char            line[SNMP_MAXBUF];
+    char           *cptr;
+    size_t          tmpint;
+    struct snmpNotifyTable_data *StorageTmp;
+    struct header_complex_index *hcindex;
+
+
+    DEBUGMSGTL(("snmpNotifyTable", "storing data...  "));
+
+
+    for (hcindex = snmpNotifyTableStorage; hcindex != NULL;
+         hcindex = hcindex->next) {
+        StorageTmp = (struct snmpNotifyTable_data *) hcindex->data;
+
+        if (StorageTmp->snmpNotifyStorageType == ST_NONVOLATILE) {
+
+            memset(line, 0, sizeof(line));
+            strcat(line, "snmpNotifyTable ");
+            cptr = line + strlen(line);
+
+            cptr =
+                read_config_store_data(ASN_OCTET_STR, cptr,
+                                       &StorageTmp->snmpNotifyName,
+                                       &StorageTmp->snmpNotifyNameLen);
+            cptr =
+                read_config_store_data(ASN_OCTET_STR, cptr,
+                                       &StorageTmp->snmpNotifyTag,
+                                       &StorageTmp->snmpNotifyTagLen);
+            cptr =
+                read_config_store_data(ASN_INTEGER, cptr,
+                                       &StorageTmp->snmpNotifyType,
+                                       &tmpint);
+            cptr =
+                read_config_store_data(ASN_INTEGER, cptr,
+                                       &StorageTmp->snmpNotifyStorageType,
+                                       &tmpint);
+            cptr =
+                read_config_store_data(ASN_INTEGER, cptr,
+                                       &StorageTmp->snmpNotifyRowStatus,
+                                       &tmpint);
+
+            snmpd_store_config(line);
+        }
+    }
+    DEBUGMSGTL(("snmpNotifyTable", "done.\n"));
+    return 0;
+}
+
+
+
+
+/*
+ * var_snmpNotifyTable():
+ *   Handle this table separately from the scalar value case.
+ *   The workings of this are basically the same as for var_snmpNotifyTable above.
+ */
+unsigned char  *
+var_snmpNotifyTable(struct variable *vp,
+                    oid * name,
+                    size_t * length,
+                    int exact,
+                    size_t * var_len, WriteMethod ** write_method)
+{
+    struct snmpNotifyTable_data *StorageTmp = NULL;
+    int             found = 1;
+
+    DEBUGMSGTL(("snmpNotifyTable",
+                "var_snmpNotifyTable: Entering...  \n"));
+    /*
+     * this assumes you have registered all your data properly
+     */
+    if ((StorageTmp = (struct snmpNotifyTable_data *)
+         header_complex((struct header_complex_index *)
+                        snmpNotifyTableStorage, vp, name, length, exact,
+                        var_len, write_method)) == NULL) {
+        found = 0;
+    }
+
+    switch (vp->magic) {
+    case SNMPNOTIFYTAG:
+        *write_method = write_snmpNotifyTag;
+        break;
+    case SNMPNOTIFYTYPE:
+        *write_method = write_snmpNotifyType;
+        break;
+    case SNMPNOTIFYSTORAGETYPE:
+        *write_method = write_snmpNotifyStorageType;
+        break;
+    case SNMPNOTIFYROWSTATUS:
+        *write_method = write_snmpNotifyRowStatus;
+        break;
+    default:
+        *write_method = NULL;
+    }
+
+    if (!found) {
+        return NULL;
+    }
+
+    switch (vp->magic) {
+    case SNMPNOTIFYTAG:
+        *var_len = StorageTmp->snmpNotifyTagLen;
+        return (u_char *) StorageTmp->snmpNotifyTag;
+
+    case SNMPNOTIFYTYPE:
+        *var_len = sizeof(StorageTmp->snmpNotifyType);
+        return (u_char *) & StorageTmp->snmpNotifyType;
+
+    case SNMPNOTIFYSTORAGETYPE:
+        *var_len = sizeof(StorageTmp->snmpNotifyStorageType);
+        return (u_char *) & StorageTmp->snmpNotifyStorageType;
+
+    case SNMPNOTIFYROWSTATUS:
+        *var_len = sizeof(StorageTmp->snmpNotifyRowStatus);
+        return (u_char *) & StorageTmp->snmpNotifyRowStatus;
+
+    default:
+        ERROR_MSG("");
+    }
+    return NULL;
+}
+
+static int
+is_delim(const char c)
+{
+    return (c == 0x020 || c == 0x09 || c == 0x0d || c == 0x0b);
+}
+
+int
+snmpTagValid(const char *tag, const size_t tagLen)
+{
+    size_t          i = 0;
+
+
+    for (i = 0; i < tagLen; i++) {
+        if (is_delim(tag[i])) {
+            /*
+             * Delimeters aren't allowed.  
+             */
+            return 0;
+        }
+    }
+    return 1;
+}
+
+static struct snmpNotifyTable_data *StorageNew;
+
+int
+write_snmpNotifyTag(int action,
+                    u_char * var_val,
+                    u_char var_val_type,
+                    size_t var_val_len,
+                    u_char * statP, oid * name, size_t name_len)
+{
+    static char    *tmpvar;
+    struct snmpNotifyTable_data *StorageTmp = NULL;
+    static size_t   tmplen;
+    size_t          newlen =
+        name_len - (sizeof(snmpNotifyTable_variables_oid) / sizeof(oid) +
+                    3 - 1);
+
+
+    DEBUGMSGTL(("snmpNotifyTable",
+                "write_snmpNotifyTag entering action=%d...  \n", action));
+    if (action != RESERVE1 &&
+        (StorageTmp = (struct snmpNotifyTable_data *)
+         header_complex((struct header_complex_index *)
+                        snmpNotifyTableStorage, NULL,
+                        &name[sizeof(snmpNotifyTable_variables_oid) /
+                              sizeof(oid) + 3 - 1], &newlen, 1, NULL,
+                        NULL)) == NULL) {
+        if ((StorageTmp = StorageNew) == NULL)
+            return SNMP_ERR_NOSUCHNAME; /* remove if you support creation here */
+    }
+
+
+    switch (action) {
+    case RESERVE1:
+        if (var_val_type != ASN_OCTET_STR) {
+            return SNMP_ERR_WRONGTYPE;
+        }
+        if (var_val_len < 0 || var_val_len > 255) {
+            return SNMP_ERR_WRONGLENGTH;
+        }
+        if (!snmpTagValid(var_val, var_val_len)) {
+            return SNMP_ERR_WRONGVALUE;
+        }
+        break;
+
+
+    case RESERVE2:
+        /*
+         * memory reseveration, final preparation... 
+         */
+        break;
+
+
+    case FREE:
+        /*
+         * Release any resources that have been allocated 
+         */
+        break;
+
+
+    case ACTION:
+        tmpvar = StorageTmp->snmpNotifyTag;
+        tmplen = StorageTmp->snmpNotifyTagLen;
+        memdup((u_char **) & StorageTmp->snmpNotifyTag, var_val,
+               var_val_len);
+        StorageTmp->snmpNotifyTagLen = var_val_len;
+        break;
+
+
+    case UNDO:
+        /*
+         * Back out any changes made in the ACTION case 
+         */
+        SNMP_FREE(StorageTmp->snmpNotifyTag);
+        StorageTmp->snmpNotifyTag = tmpvar;
+        StorageTmp->snmpNotifyTagLen = tmplen;
+        tmpvar = NULL;
+        break;
+
+
+    case COMMIT:
+        /*
+         * Things are working well, so it's now safe to make the change
+         * permanently.  Make sure that anything done here can't fail! 
+         */
+        SNMP_FREE(tmpvar);
+        break;
+    }
+
+    return SNMP_ERR_NOERROR;
+}
+
+
+
+int
+write_snmpNotifyType(int action,
+                     u_char * var_val,
+                     u_char var_val_type,
+                     size_t var_val_len,
+                     u_char * statP, oid * name, size_t name_len)
+{
+    static int      tmpvar;
+    struct snmpNotifyTable_data *StorageTmp = NULL;
+    long            value = *((long *) var_val);
+    size_t          newlen =
+        name_len - (sizeof(snmpNotifyTable_variables_oid) / sizeof(oid) +
+                    3 - 1);
+
+
+    DEBUGMSGTL(("snmpNotifyTable",
+                "write_snmpNotifyType entering action=%d...  \n", action));
+    if (action != RESERVE1 &&
+        (StorageTmp = (struct snmpNotifyTable_data *)
+         header_complex((struct header_complex_index *)
+                        snmpNotifyTableStorage, NULL,
+                        &name[sizeof(snmpNotifyTable_variables_oid) /
+                              sizeof(oid) + 3 - 1], &newlen, 1, NULL,
+                        NULL)) == NULL) {
+        if ((StorageTmp = StorageNew) == NULL)
+            return SNMP_ERR_NOSUCHNAME;
+    }
+
+    switch (action) {
+    case RESERVE1:
+        if (var_val_type != ASN_INTEGER) {
+            return SNMP_ERR_WRONGTYPE;
+        }
+        if (var_val_len != sizeof(long)) {
+            return SNMP_ERR_WRONGLENGTH;
+        }
+        if (value < 1 || value > 2) {
+            return SNMP_ERR_WRONGVALUE;
+        }
+        break;
+
+    case ACTION:
+        tmpvar = StorageTmp->snmpNotifyType;
+        StorageTmp->snmpNotifyType = value;
+        break;
+
+    case UNDO:
+        /*
+         * Back out any changes made in the ACTION case 
+         */
+        StorageTmp->snmpNotifyType = tmpvar;
+        break;
+    }
+
+    return SNMP_ERR_NOERROR;
+}
+
+
+
+int
+write_snmpNotifyStorageType(int action,
+                            u_char * var_val,
+                            u_char var_val_type,
+                            size_t var_val_len,
+                            u_char * statP, oid * name, size_t name_len)
+{
+    static int      tmpvar;
+    long            value = *((long *) var_val);
+    struct snmpNotifyTable_data *StorageTmp = NULL;
+    size_t          newlen =
+        name_len - (sizeof(snmpNotifyTable_variables_oid) / sizeof(oid) +
+                    3 - 1);
+
+
+    DEBUGMSGTL(("snmpNotifyTable",
+                "write_snmpNotifyStorageType entering action=%d...  \n",
+                action));
+    if (action != RESERVE1 &&
+        (StorageTmp = (struct snmpNotifyTable_data *)
+         header_complex((struct header_complex_index *)
+                        snmpNotifyTableStorage, NULL,
+                        &name[sizeof(snmpNotifyTable_variables_oid) /
+                              sizeof(oid) + 3 - 1], &newlen, 1, NULL,
+                        NULL)) == NULL) {
+        if ((StorageTmp = StorageNew) == NULL)
+            return SNMP_ERR_NOSUCHNAME;
+    }
+
+
+    switch (action) {
+    case RESERVE1:
+        if (var_val_type != ASN_INTEGER) {
+            return SNMP_ERR_WRONGTYPE;
+        }
+        if (var_val_len != sizeof(long)) {
+            return SNMP_ERR_WRONGLENGTH;
+        }
+        if (value != SNMP_STORAGE_OTHER && value != SNMP_STORAGE_VOLATILE
+            && value != SNMP_STORAGE_NONVOLATILE) {
+            return SNMP_ERR_WRONGVALUE;
+        }
+        break;
+
+    case ACTION:
+        tmpvar = StorageTmp->snmpNotifyStorageType;
+        StorageTmp->snmpNotifyStorageType = value;
+        break;
+
+    case UNDO:
+        StorageTmp->snmpNotifyStorageType = tmpvar;
+        break;
+    }
+    return SNMP_ERR_NOERROR;
+}
+
+
+
+int
+write_snmpNotifyRowStatus(int action,
+                          u_char * var_val,
+                          u_char var_val_type,
+                          size_t var_val_len,
+                          u_char * statP, oid * name, size_t name_len)
+{
+    struct snmpNotifyTable_data *StorageTmp = NULL;
+    static struct snmpNotifyTable_data *StorageDel;
+    size_t          newlen =
+        name_len - (sizeof(snmpNotifyTable_variables_oid) / sizeof(oid) +
+                    3 - 1);
+    static int      old_value;
+    int             set_value = *((long *) var_val);
+    static netsnmp_variable_list *vars, *vp;
+    struct header_complex_index *hciptr;
+
+
+    DEBUGMSGTL(("snmpNotifyTable",
+                "write_snmpNotifyRowStatus entering action=%d...  \n",
+                action));
+    StorageTmp = (struct snmpNotifyTable_data *)
+        header_complex((struct header_complex_index *)
+                       snmpNotifyTableStorage, NULL,
+                       &name[sizeof(snmpNotifyTable_variables_oid) /
+                             sizeof(oid) + 3 - 1], &newlen, 1, NULL, NULL);
+
+    switch (action) {
+    case RESERVE1:
+        if (var_val_type != ASN_INTEGER || var_val == NULL) {
+            return SNMP_ERR_WRONGTYPE;
+        }
+        if (var_val_len != sizeof(long)) {
+            return SNMP_ERR_WRONGLENGTH;
+        }
+        if (set_value < 1 || set_value > 6 || set_value == RS_NOTREADY) {
+            return SNMP_ERR_WRONGVALUE;
+        }
+        if (StorageTmp == NULL) {
+            /*
+             * create the row now? 
+             */
+            /*
+             * ditch illegal values now 
+             */
+            if (set_value == RS_ACTIVE || set_value == RS_NOTINSERVICE) {
+                return SNMP_ERR_INCONSISTENTVALUE;
+            }
+        } else {
+            /*
+             * row exists.  Check for a valid state change 
+             */
+            if (set_value == RS_CREATEANDGO
+                || set_value == RS_CREATEANDWAIT) {
+                /*
+                 * can't create a row that exists 
+                 */
+                return SNMP_ERR_INCONSISTENTVALUE;
+            }
+            /*
+             * XXX: interaction with row storage type needed 
+             */
+        }
+
+        /*
+         * memory reseveration, final preparation... 
+         */
+        if (StorageTmp == NULL &&
+            (set_value == RS_CREATEANDGO
+             || set_value == RS_CREATEANDWAIT)) {
+            /*
+             * creation 
+             */
+            vars = NULL;
+
+            snmp_varlist_add_variable(&vars, NULL, 0, ASN_PRIV_IMPLIED_OCTET_STR, NULL, 0);     /* snmpNotifyName */
+
+            if (header_complex_parse_oid
+                (&
+                 (name
+                  [sizeof(snmpNotifyTable_variables_oid) / sizeof(oid) +
+                   2]), newlen, vars) != SNMPERR_SUCCESS) {
+                /*
+                 * XXX: free, zero vars 
+                 */
+                snmp_free_var(vars);
+                return SNMP_ERR_INCONSISTENTNAME;
+            }
+            vp = vars;
+
+
+            StorageNew = SNMP_MALLOC_STRUCT(snmpNotifyTable_data);
+            if (StorageNew == NULL) {
+                return SNMP_ERR_RESOURCEUNAVAILABLE;
+            }
+            memdup((u_char **) & (StorageNew->snmpNotifyName),
+                   vp->val.string, vp->val_len);
+            if (StorageNew->snmpNotifyName == NULL) {
+                return SNMP_ERR_RESOURCEUNAVAILABLE;
+            }
+            StorageNew->snmpNotifyNameLen = vp->val_len;
+            vp = vp->next_variable;
+
+            /*
+             * default values 
+             */
+            StorageNew->snmpNotifyStorageType = ST_NONVOLATILE;
+            StorageNew->snmpNotifyType = SNMPNOTIFYTYPE_TRAP;
+            StorageNew->snmpNotifyTagLen = 0;
+            StorageNew->snmpNotifyTag = (char *) calloc(sizeof(char), 1);
+            if (StorageNew->snmpNotifyTag == NULL) {
+                return SNMP_ERR_RESOURCEUNAVAILABLE;
+            }
+
+            StorageNew->snmpNotifyRowStatus = set_value;
+            snmp_free_var(vars);
+        }
+        break;
+
+    case RESERVE2:
+        break;
+
+    case FREE:
+        if (StorageNew != NULL) {
+            SNMP_FREE(StorageNew->snmpNotifyTag);
+            SNMP_FREE(StorageNew->snmpNotifyName);
+            free(StorageNew);
+            StorageNew = NULL;
+        }
+        break;
+
+    case ACTION:
+        if (StorageTmp == NULL && (set_value == RS_CREATEANDGO ||
+                                   set_value == RS_CREATEANDWAIT)) {
+            /*
+             * row creation, so add it 
+             */
+            if (StorageNew != NULL) {
+                snmpNotifyTable_add(StorageNew);
+            }
+        } else if (set_value != RS_DESTROY) {
+            /*
+             * set the flag? 
+             */
+            old_value = StorageTmp->snmpNotifyRowStatus;
+            StorageTmp->snmpNotifyRowStatus = *((long *) var_val);
+        } else {
+            /*
+             * destroy...  extract it for now 
+             */
+            if (StorageTmp) {
+                hciptr = header_complex_find_entry(snmpNotifyTableStorage,
+                                                   StorageTmp);
+                StorageDel = (struct snmpNotifyTable_data *)
+                    header_complex_extract_entry((struct
+                                                  header_complex_index **)
+                                                 &snmpNotifyTableStorage,
+                                                 hciptr);
+            }
+        }
+        break;
+
+    case UNDO:
+        /*
+         * Back out any changes made in the ACTION case 
+         */
+        if (StorageTmp == NULL && (set_value == RS_CREATEANDGO ||
+                                   set_value == RS_CREATEANDWAIT)) {
+            /*
+             * row creation, so remove it again 
+             */
+            hciptr = header_complex_find_entry(snmpNotifyTableStorage,
+                                               StorageNew);
+            StorageDel = (struct snmpNotifyTable_data *)
+                header_complex_extract_entry((struct header_complex_index
+                                              **) &snmpNotifyTableStorage,
+                                             hciptr);
+            /*
+             * XXX: free it 
+             */
+        } else if (StorageDel != NULL) {
+            /*
+             * row deletion, so add it again 
+             */
+            snmpNotifyTable_add(StorageDel);
+        } else if (set_value != RS_DESTROY) {
+            StorageTmp->snmpNotifyRowStatus = old_value;
+        }
+        break;
+
+    case COMMIT:
+        if (StorageDel != NULL) {
+            SNMP_FREE(StorageDel->snmpNotifyTag);
+            SNMP_FREE(StorageDel->snmpNotifyName);
+            free(StorageDel);
+            StorageDel = NULL;
+        }
+        if (StorageTmp
+            && StorageTmp->snmpNotifyRowStatus == RS_CREATEANDGO) {
+            StorageTmp->snmpNotifyRowStatus = RS_ACTIVE;
+            StorageNew = NULL;
+        } else if (StorageTmp &&
+                   StorageTmp->snmpNotifyRowStatus == RS_CREATEANDWAIT) {
+            StorageTmp->snmpNotifyRowStatus = RS_NOTINSERVICE;
+            StorageNew = NULL;
+        }
+        break;
+    }
+    return SNMP_ERR_NOERROR;
+}
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/notification/snmpNotifyTable.h tomato121/release/src/router/snmp/agent/mibgroup/notification/snmpNotifyTable.h
--- tomato/release/src/router/snmp/agent/mibgroup/notification/snmpNotifyTable.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/notification/snmpNotifyTable.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,75 @@
+/*
+ * This file was generated by mib2c and is intended for use as a mib module
+ * for the ucd-snmp snmpd agent. 
+ */
+
+
+#ifndef _MIBGROUP_SNMPNOTIFYTABLE_H
+#define _MIBGROUP_SNMPNOTIFYTABLE_H
+
+
+/*
+ * we may use header_complex from the header_complex module 
+ */
+
+
+config_require(header_complex)
+config_require(target)
+config_add_mib(SNMP-NOTIFICATION-MIB)
+
+
+    /*
+     * our storage structure(s) 
+     */
+     struct snmpNotifyTable_data {
+
+         char           *snmpNotifyName;
+         size_t          snmpNotifyNameLen;
+         char           *snmpNotifyTag;
+         size_t          snmpNotifyTagLen;
+         long            snmpNotifyType;
+         long            snmpNotifyStorageType;
+         long            snmpNotifyRowStatus;
+
+     };
+
+
+
+
+/*
+ * enum definitions from the covered mib sections 
+ */
+
+
+
+
+
+
+#define SNMPNOTIFYTYPE_TRAP                      1
+#define SNMPNOTIFYTYPE_INFORM                    2
+
+
+
+
+/*
+ * function prototypes 
+ */
+
+
+     void            init_snmpNotifyTable(void);
+     FindVarMethod   var_snmpNotifyTable;
+     void            parse_snmpNotifyTable(const char *, char *);
+
+     int             snmpNotifyTable_add(struct snmpNotifyTable_data
+                                         *thedata);
+
+     WriteMethod     write_snmpNotifyTag;
+     WriteMethod     write_snmpNotifyType;
+     WriteMethod     write_snmpNotifyStorageType;
+     WriteMethod     write_snmpNotifyRowStatus;
+
+     WriteMethod     write_snmpNotifyRowStatus;
+
+
+
+#endif                          /* _MIBGROUP_SNMPNOTIFYTABLE_H */
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/notification.h tomato121/release/src/router/snmp/agent/mibgroup/notification.h
--- tomato/release/src/router/snmp/agent/mibgroup/notification.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/notification.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,4 @@
+
+config_require(notification/snmpNotifyTable)
+config_require(notification/snmpNotifyFilterTable)
+config_require(notification/snmpNotifyFilterProfileTable)
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/qos_access.c tomato121/release/src/router/snmp/agent/mibgroup/qos_access.c
--- tomato/release/src/router/snmp/agent/mibgroup/qos_access.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/qos_access.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,555 @@
+
+/*
+ * Note: this file originally auto-generated by mib2c using
+ *        : mib2c.access_functions.conf,v 1.6 2003/09/11 22:48:49 rstory Exp $
+ */
+
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include "qos_access.h"
+#include "qos_enums.h"
+#include "qos_checkfns.h"
+#include "unistd.h"
+
+/** returns the first data point within the qosObjectTable table data.
+
+    Set the my_loop_context variable to the first data point structure
+    of your choice (from which you can find the next one).  This could
+    be anything from the first node in a linked list, to an integer
+    pointer containing the beginning of an array variable.
+
+    Set the my_data_context variable to something to be returned to
+    you later that will provide you with the data to return in a given
+    row.  This could be the same pointer as what my_loop_context is
+    set to, or something different.
+
+    The put_index_data variable contains a list of snmp variable
+    bindings, one for each index in your table.  Set the values of
+    each appropriately according to the data matching the first row
+    and return the put_index_data variable at the end of the function.
+*/
+netsnmp_variable_list *
+qosObjectTable_get_first_data_point(void **my_loop_context,
+                                    void **my_data_context,
+                                    netsnmp_variable_list * put_index_data,
+                                    netsnmp_iterator_info *mydata)
+{
+    extern struct qos_table table;
+    netsnmp_variable_list *vptr;
+
+    update_qos_table_data(&table);
+    
+    *my_loop_context = &table;
+    *my_data_context = &(table.data);
+
+    vptr = put_index_data;
+    
+    snmp_set_var_value(vptr, (u_char *) &(table.data.device_type) /** XXX: qosDeviceIndex data */ ,
+//                       sizeof(long)/** XXX: length of qosDeviceType data */ );
+                       sizeof(ASN_INTEGER)/** XXX: length of qosDeviceIndex data */ );
+    vptr = vptr->next_variable;
+    snmp_set_var_value(vptr, (u_char *) &(table.data.device_index) /** XXX: qosDeviceIndex data */ ,
+//                       sizeof(long)/** XXX: length of qosDeviceIndex data */ );
+                       sizeof(ASN_INTEGER)/** XXX: length of qosDeviceIndex data */ );
+    vptr = vptr->next_variable;
+    snmp_set_var_value(vptr, (u_char *) &(table.data.majorhandle) /** XXX: qosMajorHandle data */ ,
+                       sizeof(ASN_UNSIGNED)/** XXX: length of qosMajorHandle data */ );
+//                       sizeof(int)/** XXX: length of qosHandle data */ );
+    vptr = vptr->next_variable;
+    snmp_set_var_value(vptr, (u_char *) &(table.data.minorhandle) /** XXX: qosMinorHandle data */ ,
+                       sizeof(ASN_UNSIGNED)/** XXX: length of qosMinorHandle data */ );
+//                       sizeof(int)/** XXX: length of qosHandle data */ );
+    vptr = vptr->next_variable;
+
+    return put_index_data;
+}
+
+/** functionally the same as qosObjectTable_get_first_data_point, but
+   my_loop_context has already been set to a previous value and should
+   be updated to the next in the list.  For example, if it was a
+   linked list, you might want to cast it to your local data type and
+   then return my_loop_context->next.  The my_data_context pointer
+   should be set to something you need later and the indexes in
+   put_index_data updated again. */
+netsnmp_variable_list *
+qosObjectTable_get_next_data_point(void **my_loop_context,
+                                   void **my_data_context,
+                                   netsnmp_variable_list * put_index_data,
+                                   netsnmp_iterator_info *mydata)
+{
+    netsnmp_variable_list *vptr;
+    qos_table *table;    
+
+    table = (struct qos_table*)*my_loop_context;
+
+    if(table->next==NULL) {
+	return(NULL);
+    }
+
+    table = table->next;	
+    *my_loop_context = table; 
+    *my_data_context = &(table->data);
+
+    vptr = put_index_data;
+
+    snmp_set_var_value(vptr, (u_char *) &((table->data).device_type) /** XXX: qosDeviceType data */ ,
+                       sizeof(ASN_INTEGER)/** XXX: length of qosDeviceType data */ );
+    vptr = vptr->next_variable;
+    snmp_set_var_value(vptr, (u_char *) &((table->data).device_index) /** XXX: qosDeviceIndex data */ ,
+                       sizeof(ASN_INTEGER)/** XXX: length of qosDeviceIndex data */ );
+    vptr = vptr->next_variable;
+    snmp_set_var_value(vptr, (u_char *) &((table->data).majorhandle) /** XXX: qosMajorHandle data */ ,
+                       sizeof(ASN_UNSIGNED)/** XXX: length of qosMajorHandle data */ );
+    vptr = vptr->next_variable;
+    snmp_set_var_value(vptr, (u_char *) &((table->data).minorhandle) /** XXX: qosMinorHandle data */ ,
+                       sizeof(ASN_UNSIGNED)/** XXX: length of qosMinorHandle data */ );
+    vptr = vptr->next_variable;
+    
+    return put_index_data;
+}
+
+/** Create a data_context for non-existent rows that SETs are performed on.
+ *  return a void * pointer which will be passed to subsequent get_XXX
+ *  and set_XXX functions for data retrival and modification during
+ *  this SET request.
+ *
+ *  The indexs are encoded (in order) into the index_data pointer if it
+ *  would be helpful to use that information.
+ */
+void           *
+qosObjectTable_create_data_context(netsnmp_variable_list * index_data)
+{
+    return NULL;                /* XXX: you likely want to return a real pointer */
+}
+
+/** If the implemented set_* functions don't operate directly on the
+   real-live data (which is actually recommended), then this function
+   can be used to take a given my_data_context pointer and "commit" it
+   to whereever the modified data needs to be put back to.  For
+   example, if this was a routing table you could publish the modified
+   routes back into the kernel at this point.
+
+   new_or_del will be set to 1 if new, or -1 if it should be deleted
+   or 0 if it is just a modification of an existing row.
+
+   If you free the data yourself, make sure to *my_data_context = NULL */
+int
+qosObjectTable_commit_row(void **my_data_context, int new_or_del)
+{
+    /** Add any necessary commit code here 
+     * return no errors.  And there shouldn't be any!!!  Ever!!!  You
+     * should have checked the values long before this. 
+     */
+    return SNMP_ERR_NOERROR;
+}
+
+
+
+// functions that return pointers to real data from qos structure (see qos_checkfns.h)
+
+long           *
+get_qosDeviceType(void *data_context, size_t * ret_len)
+{
+    struct qos_data *data;
+//    snmp_log(LOG_NOTICE,"get_qosDeviceType\n");
+    data=(struct qos_data*)data_context;
+    *ret_len=sizeof(long);
+    return(&(data->device_type));
+}
+
+long           *
+get_qosDeviceIndex(void *data_context, size_t * ret_len)
+{
+    struct qos_data *data;
+//    snmp_log(LOG_NOTICE,"get_qosDeviceIndex\n");
+    data=(struct qos_data*)data_context;
+    *ret_len=sizeof(long);
+    return(&(data->device_index));
+}
+
+/** XXX: return a data pointer to the data for the qosHandle column and set
+         ret_len to its proper size in bytes. */
+u_long           *
+get_qosMajorHandle(void *data_context, size_t * ret_len)
+{
+    struct qos_data *data;
+//    snmp_log(LOG_NOTICE,"get_qosHandle\n");
+    data=(struct qos_data*)data_context;
+    *ret_len=sizeof(u_long);
+    return(&(data->majorhandle));    
+}
+
+u_long           *
+get_qosMinorHandle(void *data_context, size_t * ret_len)
+{
+    struct qos_data *data;
+//    snmp_log(LOG_NOTICE,"get_qosHandle\n");
+    data=(struct qos_data*)data_context;
+    *ret_len=sizeof(u_long);
+    return(&(data->minorhandle));    
+}
+
+char *get_qosTextHandle(void *data_context, size_t * ret_len)
+{
+    struct qos_data *data;
+//    snmp_log(LOG_NOTICE,"get_qosTextHandle\n");
+    data=(struct qos_data*)data_context;
+    if(data->text_handle==NULL) { return(NULL); }
+    *ret_len=sizeof(char)*strlen(data->text_handle);
+    return((data->text_handle));
+}
+
+char *get_qosTextLeaf(void *data_context, size_t * ret_len)
+{
+    struct qos_data *data;
+//    snmp_log(LOG_NOTICE,"get_qosTextLeaf\n");
+    data=(struct qos_data*)data_context;
+    if(data->text_leaf==NULL) { return(NULL); }
+    *ret_len=sizeof(char)*strlen(data->text_leaf);
+    return((data->text_leaf));
+}
+
+u_long           *
+get_qosParent(void *data_context, size_t * ret_len)
+{
+    struct qos_data *data;
+//    snmp_log(LOG_NOTICE,"get_qosParent\n");
+    data=(struct qos_data*)data_context;
+    *ret_len=sizeof(u_long);
+    return(&(data->parent));    
+}
+
+char *get_qosTextParent(void *data_context, size_t * ret_len)
+{
+    struct qos_data *data;
+//    snmp_log(LOG_NOTICE,"get_qosTextParent\n");
+    data=(struct qos_data*)data_context;
+    if(data->text_parent==NULL) { return(NULL); }
+    *ret_len=sizeof(char)*strlen(data->text_parent);
+    return((data->text_parent));
+}
+
+/** XXX: return a data pointer to the data for the qosDeviceName column and set
+         ret_len to its proper size in bytes. */
+
+char *get_qosDeviceName(void *data_context, size_t * ret_len)
+{
+    struct qos_data *data;
+//    snmp_log(LOG_NOTICE,"get_qosDeviceName\n");
+    data=(struct qos_data*)data_context;
+    if(data->dev_name==NULL) { return(NULL); }
+    *ret_len=sizeof(char)*strlen(data->dev_name);
+    return((data->dev_name));
+}
+
+/** XXX: return a data pointer to the data for the qosType column and set
+         ret_len to its proper size in bytes. */
+char *get_qosType(void *data_context, size_t * ret_len)
+{
+    struct qos_data *data;
+//    snmp_log(LOG_NOTICE,"get_qosType\n");
+    data=(struct qos_data*)data_context;
+    if(data->type==NULL) { return(NULL); }
+    *ret_len=sizeof(char)*strlen(data->type);
+    return((data->type));
+}
+
+/** XXX: return a data pointer to the data for the qosBytes column and set
+         ret_len to its proper size in bytes. */
+unsigned long long         *
+get_qosBytes(void *data_context, size_t * ret_len)
+{
+    struct qos_data *data;
+//    snmp_log(LOG_NOTICE,"get_qosBytes\n");
+    data=(struct qos_data*)data_context;
+    *ret_len=sizeof(unsigned long long);
+    return(&(data->qosBytes));
+}
+
+/** XXX: return a data pointer to the data for the qosPackets column and set
+         ret_len to its proper size in bytes. */
+u_long         *
+get_qosPackets(void *data_context, size_t * ret_len)
+{
+    struct qos_data *data;
+//    snmp_log(LOG_NOTICE,"get_qosPackets\n");
+    data=(struct qos_data*)data_context;
+    *ret_len=sizeof(u_long);
+    return(&(data->qosPackets));
+}
+
+/** XXX: return a data pointer to the data for the qosDropped column and set
+         ret_len to its proper size in bytes. */
+u_long         *
+get_qosDropped(void *data_context, size_t * ret_len)
+{
+    struct qos_data *data;
+//    snmp_log(LOG_NOTICE,"get_qosDropped\n");
+    data=(struct qos_data*)data_context;
+    *ret_len=sizeof(u_long);
+    return(&(data->qosDropped));
+}
+
+/** XXX: return a data pointer to the data for the qosOverlimit column and set
+         ret_len to its proper size in bytes. */
+u_long         *
+get_qosOverlimit(void *data_context, size_t * ret_len)
+{
+    struct qos_data *data;
+//    snmp_log(LOG_NOTICE,"get_qosOverlimit\n");
+    data=(struct qos_data*)data_context;
+    *ret_len=sizeof(u_long);
+    return(&(data->qosOverlimit));
+}
+
+/** XXX: return a data pointer to the data for the qosBps column and set
+         ret_len to its proper size in bytes. */
+u_long         *
+get_qosBps(void *data_context, size_t * ret_len)
+{
+    struct qos_data *data;
+//    snmp_log(LOG_NOTICE,"get_qosBps\n");
+    data=(struct qos_data*)data_context;
+    *ret_len=sizeof(u_long);
+    return(&(data->qosBps));
+}
+
+/** XXX: return a data pointer to the data for the qosPps column and set
+         ret_len to its proper size in bytes. */
+u_long         *
+get_qosPps(void *data_context, size_t * ret_len)
+{
+    struct qos_data *data;
+//    snmp_log(LOG_NOTICE,"get_qosPps\n");
+    data=(struct qos_data*)data_context;
+    *ret_len=sizeof(u_long);
+    return(&(data->qosPps));
+}
+
+/** XXX: return a data pointer to the data for the qosQlen column and set
+         ret_len to its proper size in bytes. */
+u_long         *
+get_qosQlen(void *data_context, size_t * ret_len)
+{
+    struct qos_data *data;
+//   snmp_log(LOG_NOTICE,"get_qosQlen\n");
+    data=(struct qos_data*)data_context;
+    *ret_len=sizeof(u_long);
+    return(&(data->qosQlen));
+}
+
+/** XXX: return a data pointer to the data for the qosBacklog column and set
+         ret_len to its proper size in bytes. */
+u_long         *
+get_qosBacklog(void *data_context, size_t * ret_len)
+{
+    struct qos_data *data;
+//    snmp_log(LOG_NOTICE,"get_qosBacklog\n");
+    data=(struct qos_data*)data_context;
+    *ret_len=sizeof(u_long);
+    return(&(data->qosBacklog));
+}
+
+/** XXX: return a data pointer to the data for the redEarly column and set
+         ret_len to its proper size in bytes. */
+u_long         *
+get_redEarly(void *data_context, size_t * ret_len)
+{
+    struct qos_data *data;
+//    snmp_log(LOG_NOTICE,"get_redEarly\n");
+    data=(struct qos_data*)data_context;
+    *ret_len=sizeof(u_long);
+    return(&(data->redEarly));
+}
+
+/** XXX: return a data pointer to the data for the redPdrop column and set
+         ret_len to its proper size in bytes. */
+u_long         *
+get_redPdrop(void *data_context, size_t * ret_len)
+{
+    struct qos_data *data;
+//    snmp_log(LOG_NOTICE,"get_redPdrop\n");
+    data=(struct qos_data*)data_context;
+    *ret_len=sizeof(u_long);
+    return(&(data->redPdrop));
+}
+
+/** XXX: return a data pointer to the data for the redOther column and set
+         ret_len to its proper size in bytes. */
+u_long         *
+get_redOther(void *data_context, size_t * ret_len)
+{
+    struct qos_data *data;
+//    snmp_log(LOG_NOTICE,"get_redOther\n");
+    data=(struct qos_data*)data_context;
+    *ret_len=sizeof(u_long);
+    return(&(data->redOther));
+}
+
+/** XXX: return a data pointer to the data for the redMarked column and set
+         ret_len to its proper size in bytes. */
+u_long         *
+get_redMarked(void *data_context, size_t * ret_len)
+{
+    struct qos_data *data;
+//    snmp_log(LOG_NOTICE,"get_redMarked\n");
+    data=(struct qos_data*)data_context;
+    *ret_len=sizeof(u_long);
+    return(&(data->redMarked));
+}
+
+/** XXX: return a data pointer to the data for the htbLends column and set
+         ret_len to its proper size in bytes. */
+u_long         *
+get_htbLends(void *data_context, size_t * ret_len)
+{
+    struct qos_data *data;
+//    snmp_log(LOG_NOTICE,"get_htbLends\n");
+    data=(struct qos_data*)data_context;
+    *ret_len=sizeof(u_long);
+    return(&(data->htbLends));
+}
+
+/** XXX: return a data pointer to the data for the htbBorrows column and set
+         ret_len to its proper size in bytes. */
+u_long         *
+get_htbBorrows(void *data_context, size_t * ret_len)
+{
+    struct qos_data *data;
+//    snmp_log(LOG_NOTICE,"get_htbBorrows\n");
+    data=(struct qos_data*)data_context;
+    *ret_len=sizeof(u_long);
+    return(&(data->htbBorrows));
+}
+
+/** XXX: return a data pointer to the data for the htbGiants column and set
+         ret_len to its proper size in bytes. */
+u_long         *
+get_htbGiants(void *data_context, size_t * ret_len)
+{
+    struct qos_data *data;
+//    snmp_log(LOG_NOTICE,"get_htbGiants\n");
+    data=(struct qos_data*)data_context;
+    *ret_len=sizeof(u_long);
+    return(&(data->htbGiants));
+}
+
+/** XXX: return a data pointer to the data for the htbTokens column and set
+         ret_len to its proper size in bytes. */
+u_long         *
+get_htbTokens(void *data_context, size_t * ret_len)
+{
+    struct qos_data *data;
+//    snmp_log(LOG_NOTICE,"get_htbTokens\n");
+    data=(struct qos_data*)data_context;
+    *ret_len=sizeof(u_long);
+    return(&(data->htbTokens));
+}
+
+/** XXX: return a data pointer to the data for the htbCTokens column and set
+         ret_len to its proper size in bytes. */
+u_long         *
+get_htbCTokens(void *data_context, size_t * ret_len)
+{
+    struct qos_data *data;
+//    snmp_log(LOG_NOTICE,"get_htbCTokens\n");
+    data=(struct qos_data*)data_context;
+    *ret_len=sizeof(u_long);
+    return(&(data->htbCTokens));
+}
+
+/** XXX: return a data pointer to the data for the htbRate column and set
+         ret_len to its proper size in bytes. */
+u_long         *
+get_htbRate(void *data_context, size_t * ret_len)
+{
+    struct qos_data *data;
+//    snmp_log(LOG_NOTICE,"get_htbRate\n");
+    data=(struct qos_data*)data_context;
+    *ret_len=sizeof(u_long);
+    return(&(data->htbRate));
+}
+
+/** XXX: return a data pointer to the data for the htbCeil column and set
+         ret_len to its proper size in bytes. */
+u_long         *
+get_htbCeil(void *data_context, size_t * ret_len)
+{
+    struct qos_data *data;
+//    snmp_log(LOG_NOTICE,"get_htbCeil\n");
+    data=(struct qos_data*)data_context;
+    *ret_len=sizeof(u_long);
+    return(&(data->htbCeil));
+}
+
+/** XXX: return a data pointer to the data for the htbPrio column and set
+         ret_len to its proper size in bytes. */
+u_long         *
+get_htbPrio(void *data_context, size_t * ret_len)
+{
+    struct qos_data *data;
+//    snmp_log(LOG_NOTICE,"get_htbPrio\n");
+    data=(struct qos_data*)data_context;
+    *ret_len=sizeof(u_long);
+    return(&(data->htbPrio));
+}
+
+/** XXX: return a data pointer to the data for the cbqBorrows column and set
+         ret_len to its proper size in bytes. */
+u_long         *
+get_cbqBorrows(void *data_context, size_t * ret_len)
+{
+    struct qos_data *data;
+//    snmp_log(LOG_NOTICE,"get_cbqBorrows\n");
+    data=(struct qos_data*)data_context;
+    *ret_len=sizeof(u_long);
+    return(&(data->cbqBorrows));
+}
+
+/** XXX: return a data pointer to the data for the cbqOveractions column and set
+         ret_len to its proper size in bytes. */
+u_long         *
+get_cbqOveractions(void *data_context, size_t * ret_len)
+{
+    struct qos_data *data;
+//    snmp_log(LOG_NOTICE,"get_cbqOveractions\n");
+    data=(struct qos_data*)data_context;
+    *ret_len=sizeof(u_long);
+    return(&(data->cbqOveractions));
+}
+
+/** XXX: return a data pointer to the data for the cbqAvgidle column and set
+         ret_len to its proper size in bytes. */
+long         *
+get_cbqAvgidle(void *data_context, size_t * ret_len)
+{
+    struct qos_data *data;
+//    snmp_log(LOG_NOTICE,"get_cbqAvgidle\n");
+    data=(struct qos_data*)data_context;
+    *ret_len=sizeof(u_long);
+    return(&(data->cbqAvgidle));
+}
+
+/** XXX: return a data pointer to the data for the cbqUndertime column and set
+         ret_len to its proper size in bytes. */
+long         *
+get_cbqUndertime(void *data_context, size_t * ret_len)
+{
+    struct qos_data *data;
+//    snmp_log(LOG_NOTICE,"get_cbqUndertime\n");
+    data=(struct qos_data*)data_context;
+    *ret_len=sizeof(u_long);
+    return(&(data->cbqUndertime));
+}
+
+char *get_qosInfo(void *data_context, size_t * ret_len)
+{
+    struct qos_data *data;
+//    snmp_log(LOG_NOTICE,"get_qosTextHandle\n");
+    data=(struct qos_data*)data_context;
+    if(data->text_handle==NULL) { return(NULL); }
+    *ret_len=sizeof(char)*strlen(data->info);
+    return((data->info));
+}
+
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/qos_access.h tomato121/release/src/router/snmp/agent/mibgroup/qos_access.h
--- tomato/release/src/router/snmp/agent/mibgroup/qos_access.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/qos_access.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,63 @@
+/*
+ * Note: this file originally auto-generated by mib2c using
+ *        : mib2c.access_functions.conf,v 1.6 2003/09/11 22:48:49 rstory Exp $
+ */
+#ifndef QOS_ACCESS_H
+#define QOS_ACCESS_H
+
+/** User-defined data access functions for data in table qosObjectTable */
+/** row level accessors */
+//Netsnmp_First_Data_Point _get_first_data_point;
+//Netsnmp_Next_Data_Point _get_next_data_point;
+
+Netsnmp_First_Data_Point qosObjectTable_get_first_data_point;
+Netsnmp_Next_Data_Point qosObjectTable_get_next_data_point;
+
+int             qosObjectTable_commit_row(void **my_data_context,
+                                          int new_or_del);
+void           *qosObjectTable_create_data_context(netsnmp_variable_list *
+                                                   index_data);
+
+/** column accessors */
+long           *get_qosDeviceType(void *data_context, size_t * ret_len);
+long           *get_qosDeviceIndex(void *data_context, size_t * ret_len);
+u_long           *get_qosMajorHandle(void *data_context, size_t * ret_len);
+u_long           *get_qosMinorHandle(void *data_context, size_t * ret_len);
+u_long           *get_qosParent(void *data_context, size_t * ret_len);
+char 		*get_qosTextParent(void *data_context, size_t * ret_len);
+char 		*get_qosTextHandle(void *data_context, size_t * ret_len);
+char 		*get_qosTextLeaf(void *data_context, size_t * ret_len);
+char 		*get_qosDeviceName(void *data_context, size_t * ret_len);
+char 		*get_qosType(void *data_context, size_t * ret_len);
+unsigned long long         *get_qosBytes(void *data_context, size_t * ret_len);
+u_long         *get_qosPackets(void *data_context, size_t * ret_len);
+u_long         *get_qosDropped(void *data_context, size_t * ret_len);
+u_long         *get_qosOverlimit(void *data_context, size_t * ret_len);
+
+
+u_long         *get_qosBps(void *data_context, size_t * ret_len);
+u_long         *get_qosPps(void *data_context, size_t * ret_len);
+u_long         *get_qosQlen(void *data_context, size_t * ret_len);
+u_long         *get_qosBacklog(void *data_context, size_t * ret_len);
+
+u_long         *get_redEarly(void *data_context, size_t * ret_len);
+u_long         *get_redPdrop(void *data_context, size_t * ret_len);
+u_long         *get_redOther(void *data_context, size_t * ret_len);
+u_long         *get_redMarked(void *data_context, size_t * ret_len);
+
+u_long         *get_htbLends(void *data_context, size_t * ret_len);
+u_long         *get_htbBorrows(void *data_context, size_t * ret_len);
+u_long         *get_htbGiants(void *data_context, size_t * ret_len);
+u_long         *get_htbTokens(void *data_context, size_t * ret_len);
+u_long         *get_htbCTokens(void *data_context, size_t * ret_len);
+u_long         *get_htbRate(void *data_context, size_t * ret_len);
+u_long         *get_htbCeil(void *data_context, size_t * ret_len);
+u_long         *get_htbPrio(void *data_context, size_t * ret_len);
+
+u_long         *get_cbqBorrows(void *data_context, size_t * ret_len);
+u_long         *get_cbqOveractions(void *data_context, size_t * ret_len);
+long    	*get_cbqAvgidle(void *data_context, size_t * ret_len);
+long 	        *get_cbqUndertime(void *data_context, size_t * ret_len);
+char 		*get_qosInfo(void *data_context, size_t * ret_len);
+
+#endif                          /* QOS_ACCESS_H */
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/qos.c tomato121/release/src/router/snmp/agent/mibgroup/qos.c
--- tomato/release/src/router/snmp/agent/mibgroup/qos.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/qos.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,645 @@
+/*
+ * Note: this file originally auto-generated by mib2c using
+ *        : mib2c.iterate_access.conf,v 1.6 2003/09/29 22:30:36 hardaker Exp $
+ */
+
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include "qos.h"
+#include "qos_checkfns.h"
+#include "qos_access.h"
+
+/* 
+    As said in first lines, this file is partly autogenerated - functions had to be
+    modified to fit needs into my extension - that means that specific function 
+    for walking going through qos statistics table in memory are wrriten
+    
+    Default comments from mib2c compiler are self-explanatory - I was only info 
+    I had during developement, so it should be sufficient also to you :-)
+
+*/
+struct qos_table table;
+
+static netsnmp_oid_stash_node *undoStorage = NULL;
+static netsnmp_oid_stash_node *commitStorage = NULL;
+
+struct undoInfo {
+    void           *ptr;
+    size_t          len;
+};
+
+struct commitInfo {
+    void           *data_context;
+    int             have_committed;
+    int             new_row;
+};
+
+void
+qos_free_undoInfo(void *vptr)
+{
+    struct undoInfo *ui = vptr;
+    if (!ui)
+        return;
+    SNMP_FREE(ui->ptr);
+    SNMP_FREE(ui);
+}
+
+/** Initialize the qosObjectTable table by defining its contents and how it's structured */
+void
+initialize_table_qosObjectTable(void)
+{
+    static oid      qosObjectTable_oid[] = { 1, 3, 6, 1, 4, 1, 18756, 1 };
+    netsnmp_table_registration_info *table_info;
+    netsnmp_handler_registration *my_handler;
+    netsnmp_iterator_info *iinfo;
+
+    /** create the table registration information structures */
+    table_info = SNMP_MALLOC_TYPEDEF(netsnmp_table_registration_info);
+    iinfo = SNMP_MALLOC_TYPEDEF(netsnmp_iterator_info);
+
+    /** if your table is read only, it's easiest to change the
+        HANDLER_CAN_RWRITE definition below to HANDLER_CAN_RONLY */
+    my_handler = netsnmp_create_handler_registration("qosObjectTable",
+                                                     qosObjectTable_handler,
+                                                     qosObjectTable_oid,
+                                                     OID_LENGTH
+                                                     (qosObjectTable_oid),
+                                                     HANDLER_CAN_RWRITE);
+
+    if (!my_handler || !table_info || !iinfo) {
+        snmp_log(LOG_ERR,
+                 "malloc failed in initialize_table_qosObjectTable");
+        return; /** Serious error. */
+    }
+
+    /***************************************************
+     * Setting up the table's definition
+     */
+    netsnmp_table_helper_add_indexes(table_info, 
+				     ASN_INTEGER,
+				    		/** index: qosDeviceType */
+				     ASN_INTEGER,
+                                               /** index: qosDeviceIndex */
+                                     ASN_UNSIGNED,
+                                               /** index: qosMajorHandle */
+				     ASN_UNSIGNED,
+						/* index: qosMinorHandle */
+                                     0);
+
+    /** Define the minimum and maximum accessible columns.  This
+        optimizes retrival. */
+    table_info->min_column = 1;
+    table_info->max_column = 35;
+
+    /** iterator access routines */
+    iinfo->get_first_data_point = qosObjectTable_get_first_data_point;
+    iinfo->get_next_data_point = qosObjectTable_get_next_data_point;
+
+    /** tie the two structures together */
+    iinfo->table_reginfo = table_info;
+
+    /***************************************************
+     * registering the table with the master agent
+     */
+    DEBUGMSGTL(("initialize_table_qosObjectTable",
+                "Registering table qosObjectTable as a table iterator\n"));
+    netsnmp_register_table_iterator(my_handler, iinfo);
+}
+
+/** Initializes the qos module */
+void
+init_qos(void)
+{
+  /** here we initialize all the tables we're planning on supporting */
+    initialize_table_qosObjectTable();
+    initialize_qos_table(&table);
+}
+
+/** handles requests for the qosObjectTable table, if anything else needs to be done */
+int
+qosObjectTable_handler(netsnmp_mib_handler *handler,
+                       netsnmp_handler_registration *reginfo,
+                       netsnmp_agent_request_info *reqinfo,
+                       netsnmp_request_info *requests)
+{
+
+    netsnmp_request_info *request;
+    netsnmp_table_request_info *table_info;
+    netsnmp_variable_list *var;
+    struct commitInfo *ci = NULL;
+
+    void           *data_context = NULL;
+
+    oid            *suffix;
+    size_t          suffix_len;
+
+    /** column and row index encoded portion */
+    suffix = requests->requestvb->name + reginfo->rootoid_len + 1;
+    suffix_len = requests->requestvb->name_length -
+        (reginfo->rootoid_len + 1);
+
+    for (request = requests; request; request = request->next) {
+        var = request->requestvb;
+        if (request->processed != 0)
+            continue;
+
+        switch (reqinfo->mode) {
+        case MODE_GET:
+        case MODE_SET_RESERVE1:
+            data_context = netsnmp_extract_iterator_context(request);
+            if (data_context == NULL) {
+                if (reqinfo->mode == MODE_GET) {
+                    netsnmp_set_request_error(reqinfo, request,
+                                              SNMP_NOSUCHINSTANCE);
+                    continue;
+                }
+            }
+            break;
+
+        default:               /* == the other SET modes */
+            ci = netsnmp_oid_stash_get_data(commitStorage,
+                                            suffix + 1, suffix_len - 1);
+            break;
+
+        }
+
+        /** extracts the information about the table from the request */
+        table_info = netsnmp_extract_table_info(request);
+        /** table_info->colnum contains the column number requested */
+        /** table_info->indexes contains a linked list of snmp variable
+           bindings for the indexes of the table.  Values in the list
+           have been set corresponding to the indexes of the
+           request */
+        if (table_info == NULL) {
+            continue;
+        }
+
+        switch (reqinfo->mode) {
+        case MODE_GET:
+            switch (table_info->colnum) {
+
+            case COLUMN_QOSDEVICETYPE:
+                {
+                    long           *retval;
+                    size_t          retval_len = 0;
+                    retval = get_qosDeviceIndex(data_context, &retval_len);
+                    snmp_set_var_typed_value(var, ASN_INTEGER,
+                                             (const u_char *) retval,
+                                             retval_len);
+                }
+                break;
+
+            case COLUMN_QOSDEVICEINDEX:
+                {
+                    long           *retval;
+                    size_t          retval_len = 0;
+                    retval = get_qosDeviceIndex(data_context, &retval_len);
+                    snmp_set_var_typed_value(var, ASN_INTEGER,
+                                             (const u_char *) retval,
+                                             retval_len);
+                }
+                break;
+
+            case COLUMN_QOSMAJORHANDLE:
+                {
+                    long           *retval;
+                    size_t          retval_len = 0;
+                    retval = get_qosMajorHandle(data_context, &retval_len);
+                    snmp_set_var_typed_value(var, ASN_UNSIGNED,
+                                             (const u_char *) retval,
+                                             retval_len);
+                }
+                break;
+
+            case COLUMN_QOSMINORHANDLE:
+                {
+                    long           *retval;
+                    size_t          retval_len = 0;
+                    retval = get_qosMinorHandle(data_context, &retval_len);
+                    snmp_set_var_typed_value(var, ASN_UNSIGNED,
+                                             (const u_char *) retval,
+                                             retval_len);
+                }
+                break;
+
+            case COLUMN_QOSTEXTHANDLE:
+                {
+                    char *retval;
+                    size_t          retval_len = 0;
+                    retval = get_qosTextHandle(data_context, &retval_len);
+                    snmp_set_var_typed_value(var,ASN_OCTET_STR,
+                                             (const u_char *) retval,
+                                             retval_len);
+                }
+                break;
+
+            case COLUMN_QOSTEXTLEAF:
+                {
+                    char *retval;
+                    size_t          retval_len = 0;
+                    retval = get_qosTextLeaf(data_context, &retval_len);
+                    snmp_set_var_typed_value(var,ASN_OCTET_STR,
+                                             (const u_char *) retval,
+                                             retval_len);
+                }
+                break;
+
+            case COLUMN_QOSPARENT:
+                {
+                    long           *retval;
+                    size_t          retval_len = 0;
+                    retval = get_qosParent(data_context, &retval_len);
+                    snmp_set_var_typed_value(var, ASN_UNSIGNED,
+                                             (const u_char *) retval,
+                                             retval_len);
+                }
+                break;
+
+            case COLUMN_QOSTEXTPARENT:
+                {
+                    char *retval;
+                    size_t          retval_len = 0;
+                    retval = get_qosTextParent(data_context, &retval_len);
+                    snmp_set_var_typed_value(var,ASN_OCTET_STR,
+                                             (const u_char *) retval,
+                                             retval_len);
+                }
+                break;
+
+            case COLUMN_QOSDEVICENAME:
+                {
+                    char *retval;
+                    size_t          retval_len = 0;
+                    retval = get_qosDeviceName(data_context, &retval_len);
+                    snmp_set_var_typed_value(var,ASN_OCTET_STR,
+                                             (const u_char *) retval,
+                                             retval_len);
+                }
+                break;
+
+
+            case COLUMN_QOSTYPE:
+                {
+                    char *retval;
+                    size_t          retval_len = 0;
+                    retval = get_qosType(data_context, &retval_len);
+                    snmp_set_var_typed_value(var,ASN_OCTET_STR,
+                                             (const u_char *) retval,
+                                             retval_len);
+                }
+                break;
+
+            case COLUMN_QOSBYTES:
+                {
+                    unsigned long long     *retval;
+//		    u_long		*retval;
+                    size_t          retval_len = 0;
+                    retval = get_qosBytes(data_context, &retval_len);
+                    snmp_set_var_typed_value(var, ASN_COUNTER64,
+                                             (const u_char *) retval,
+                                             retval_len);
+                }
+                break;
+
+            case COLUMN_QOSPACKETS:
+                {
+                    u_long         *retval;
+                    size_t          retval_len = 0;
+                    retval = get_qosPackets(data_context, &retval_len);
+                    snmp_set_var_typed_value(var, ASN_COUNTER,
+                                             (const u_char *) retval,
+                                             retval_len);
+                }
+                break;
+
+            case COLUMN_QOSDROPPED:
+                {
+                    u_long         *retval;
+                    size_t          retval_len = 0;
+                    retval = get_qosDropped(data_context, &retval_len);
+                    snmp_set_var_typed_value(var, ASN_COUNTER,
+                                             (const u_char *) retval,
+                                             retval_len);
+                }
+                break;
+
+            case COLUMN_QOSOVERLIMIT:
+                {
+                    u_long         *retval;
+                    size_t          retval_len = 0;
+                    retval = get_qosOverlimit(data_context, &retval_len);
+                    snmp_set_var_typed_value(var, ASN_COUNTER,
+                                             (const u_char *) retval,
+                                             retval_len);
+                }
+                break;
+
+            case COLUMN_QOSBPS:
+                {
+                    u_long           *retval;
+                    size_t          retval_len = 0;
+                    retval = get_qosBps(data_context, &retval_len);
+                    snmp_set_var_typed_value(var, ASN_UNSIGNED,
+                                             (const u_char *) retval,
+                                             retval_len);
+                }
+                break;
+
+            case COLUMN_QOSPPS:
+                {
+                    u_long           *retval;
+                    size_t          retval_len = 0;
+                    retval = get_qosPps(data_context, &retval_len);
+                    snmp_set_var_typed_value(var, ASN_UNSIGNED,
+                                             (const u_char *) retval,
+                                             retval_len);
+                }
+                break;
+
+            case COLUMN_QOSQLEN:
+                {
+                    u_long           *retval;
+                    size_t          retval_len = 0;
+                    retval = get_qosQlen(data_context, &retval_len);
+                    snmp_set_var_typed_value(var, ASN_UNSIGNED,
+                                             (const u_char *) retval,
+                                             retval_len);
+                }
+                break;
+
+            case COLUMN_QOSBACKLOG:
+                {
+                    u_long           *retval;
+                    size_t          retval_len = 0;
+                    retval = get_qosBacklog(data_context, &retval_len);
+                    snmp_set_var_typed_value(var, ASN_UNSIGNED,
+                                             (const u_char *) retval,
+                                             retval_len);
+                }
+                break;
+
+            case COLUMN_QOSREDEARLY:
+                {
+                    u_long           *retval;
+                    size_t          retval_len = 0;
+                    retval = get_redEarly(data_context, &retval_len);
+                    snmp_set_var_typed_value(var, ASN_COUNTER,
+                                             (const u_char *) retval,
+                                             retval_len);
+                }
+                break;
+
+            case COLUMN_QOSREDPDROP:
+                {
+                    u_long           *retval;
+                    size_t          retval_len = 0;
+                    retval = get_redPdrop(data_context, &retval_len);
+                    snmp_set_var_typed_value(var, ASN_COUNTER,
+                                             (const u_char *) retval,
+                                             retval_len);
+                }
+                break;
+
+            case COLUMN_QOSREDOTHER:
+                {
+                    u_long           *retval;
+                    size_t          retval_len = 0;
+                    retval = get_redOther(data_context, &retval_len);
+                    snmp_set_var_typed_value(var, ASN_COUNTER,
+                                             (const u_char *) retval,
+                                             retval_len);
+                }
+                break;
+
+            case COLUMN_QOSREDMARKED:
+                {
+                    u_long           *retval;
+                    size_t          retval_len = 0;
+                    retval = get_redMarked(data_context, &retval_len);
+                    snmp_set_var_typed_value(var, ASN_COUNTER,
+                                             (const u_char *) retval,
+                                             retval_len);
+                }
+                break;
+
+            case COLUMN_QOSHTBLENDS:
+                {
+                    u_long           *retval;
+                    size_t          retval_len = 0;
+                    retval = get_htbLends(data_context, &retval_len);
+                    snmp_set_var_typed_value(var, ASN_COUNTER,
+                                             (const u_char *) retval,
+                                             retval_len);
+                }
+                break;
+
+            case COLUMN_QOSHTBBORROWS:
+                {
+                    u_long           *retval;
+                    size_t          retval_len = 0;
+                    retval = get_htbBorrows(data_context, &retval_len);
+                    snmp_set_var_typed_value(var, ASN_COUNTER,
+                                             (const u_char *) retval,
+                                             retval_len);
+                }
+                break;
+
+            case COLUMN_QOSHTBGIANTS:
+                {
+                    u_long           *retval;
+                    size_t          retval_len = 0;
+                    retval = get_htbGiants(data_context, &retval_len);
+                    snmp_set_var_typed_value(var, ASN_COUNTER,
+                                             (const u_char *) retval,
+                                             retval_len);
+                }
+                break;
+
+            case COLUMN_QOSHTBTOKENS:
+                {
+                    u_long           *retval;
+                    size_t          retval_len = 0;
+                    retval = get_htbTokens(data_context, &retval_len);
+                    snmp_set_var_typed_value(var, ASN_INTEGER,
+                                             (const u_char *) retval,
+                                             retval_len);
+                }
+                break;
+
+            case COLUMN_QOSHTBCTOKENS:
+                {
+                    u_long           *retval;
+                    size_t          retval_len = 0;
+                    retval = get_htbCTokens(data_context, &retval_len);
+                    snmp_set_var_typed_value(var, ASN_INTEGER,
+                                             (const u_char *) retval,
+                                             retval_len);
+                }
+                break;
+
+            case COLUMN_QOSHTBRATE:
+                {
+                    u_long           *retval;
+                    size_t          retval_len = 0;
+                    retval = get_htbRate(data_context, &retval_len);
+                    snmp_set_var_typed_value(var, ASN_UNSIGNED,
+                                             (const u_char *) retval,
+                                             retval_len);
+                }
+                break;
+
+            case COLUMN_QOSHTBCEIL:
+                {
+                    u_long           *retval;
+                    size_t          retval_len = 0;
+                    retval = get_htbCeil(data_context, &retval_len);
+                    snmp_set_var_typed_value(var, ASN_UNSIGNED,
+                                             (const u_char *) retval,
+                                             retval_len);
+                }
+                break;
+
+            case COLUMN_QOSHTBPRIO:
+                {
+                    u_long           *retval;
+                    size_t          retval_len = 0;
+                    retval = get_htbPrio(data_context, &retval_len);
+                    snmp_set_var_typed_value(var, ASN_UNSIGNED,
+                                             (const u_char *) retval,
+                                             retval_len);
+                }
+                break;
+		
+            case COLUMN_QOSCBQBORROWS:
+                {
+                    u_long           *retval;
+                    size_t          retval_len = 0;
+                    retval = get_cbqBorrows(data_context, &retval_len);
+                    snmp_set_var_typed_value(var, ASN_COUNTER,
+                                             (const u_char *) retval,
+                                             retval_len);
+                }
+                break;
+		
+            case COLUMN_QOSCBQOVERACTIONS:
+                {
+                    u_long           *retval;
+                    size_t          retval_len = 0;
+                    retval = get_cbqOveractions(data_context, &retval_len);
+                    snmp_set_var_typed_value(var, ASN_COUNTER,
+                                             (const u_char *) retval,
+                                             retval_len);
+                }
+                break;
+
+            case COLUMN_QOSCBQAVGIDLE:
+                {
+                    long           *retval;
+                    size_t          retval_len = 0;
+                    retval = get_cbqUndertime(data_context, &retval_len);
+                    snmp_set_var_typed_value(var, ASN_INTEGER,
+                                             (const u_char *) retval,
+                                             retval_len);
+                }
+                break;
+
+            case COLUMN_QOSCBQUNDERTIME:
+                {
+                    long           *retval;
+                    size_t          retval_len = 0;
+                    retval = get_cbqUndertime(data_context, &retval_len);
+                    snmp_set_var_typed_value(var, ASN_INTEGER,
+                                             (const u_char *) retval,
+                                             retval_len);
+                }
+                break;
+            case COLUMN_QOSINFO:
+                {
+                    char *retval;
+                    size_t          retval_len = 0;
+                    retval = get_qosInfo(data_context, &retval_len);
+                    snmp_set_var_typed_value(var,ASN_OCTET_STR,
+                                             (const u_char *) retval,
+                                             retval_len);
+                }
+                break;
+		
+            default:
+                /** We shouldn't get here */
+                snmp_log(LOG_ERR,
+                         "problem encountered in qosObjectTable_handler: unknown column\n");
+            }
+            break;
+
+        case MODE_SET_RESERVE1:
+            ci = netsnmp_oid_stash_get_data(commitStorage,
+                                            suffix + 1, suffix_len - 1);
+
+            if (!ci) {
+                    /** create the commit storage info */
+                ci = SNMP_MALLOC_STRUCT(commitInfo);
+                if (!data_context) {
+                    ci->data_context =
+                        qosObjectTable_create_data_context(table_info->
+                                                           indexes);
+                    ci->new_row = 1;
+                } else {
+                    ci->data_context = data_context;
+                }
+                netsnmp_oid_stash_add_data(&commitStorage,
+                                           suffix + 1, suffix_len - 1, ci);
+            }
+            break;
+
+        case MODE_SET_RESERVE2:
+            switch (table_info->colnum) {
+            default:
+                netsnmp_set_request_error(reqinfo, request,
+                                          SNMP_ERR_NOTWRITABLE);
+                break;
+            }
+            break;
+
+        case MODE_SET_ACTION:
+            /** save a variable copy */
+            switch (table_info->colnum) {
+            }
+            break;
+
+        case MODE_SET_COMMIT:
+            if (!ci->have_committed) {
+                    /** do this once per row only */
+                qosObjectTable_commit_row(&ci->data_context, ci->new_row);
+                ci->have_committed = 1;
+            }
+            break;
+
+        case MODE_SET_UNDO:
+             /** save a variable copy */
+            switch (table_info->colnum) {
+            }
+            break;
+
+        case MODE_SET_FREE:
+            break;
+
+        default:
+            snmp_log(LOG_ERR,
+                     "problem encountered in qosObjectTable_handler: unsupported mode\n");
+        }
+    }
+
+    /** clean up after all requset processing has ended */
+    switch (reqinfo->mode) {
+    case MODE_SET_UNDO:
+    case MODE_SET_FREE:
+    case MODE_SET_COMMIT:
+        /** clear out the undo cache */
+        netsnmp_oid_stash_free(&undoStorage, qos_free_undoInfo);
+        netsnmp_oid_stash_free(&commitStorage, netsnmp_oid_stash_no_free);
+    }
+
+
+    return SNMP_ERR_NOERROR;
+}
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/qos_checkfns.c tomato121/release/src/router/snmp/agent/mibgroup/qos_checkfns.c
--- tomato/release/src/router/snmp/agent/mibgroup/qos_checkfns.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/qos_checkfns.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,114 @@
+/*
+ * Note: this file originally auto-generated by mib2c using
+ *        : mib2c.check_values.conf,v 1.6 2003/06/13 18:18:04 hardaker Exp $
+ */
+
+/********************************************************************
+ *                       NOTE   NOTE   NOTE
+ *   This file is auto-generated and SHOULD NOT BE EDITED by hand.
+ *   Modify the qos_checkfns_local.[ch] files insead so that you
+ *   can regenerate this one as mib2c improvements are made.
+ ********************************************************************/
+
+/*
+ * standard headers 
+ */
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include "qos_checkfns.h"
+#include "qos_checkfns_local.h"
+#include "qos_enums.h"
+#include<time.h>
+
+void initialize_qos_table(qos_table *table) {
+// first object in table is permanent a due to this fact declared as static
+// its initialization
+    memset(table,0,sizeof(qos_table));
+    table->next=NULL;
+    table->data.dev_name[0]=0x0;
+    table->data.type[0]=0x0;
+    table->data.text_parent[0]=0x0;
+    table->data.text_handle[0]=0x0;
+    table->data.text_leaf[0]=0x0;
+    table->data.qosBytes=0;
+    table->data.info[0]=0x0;
+}
+
+void update_qos_table_data(qos_table *table) {
+// deletes old data from qos_table and calls functions to fetch new data
+// it happens only if time between calls is greater than UPDATE_INTERVAL 
+// (located in header file)
+// memory allocations and fetch is a bit complicated and it could take 
+// relatively long time to proceed (especially in cases with lot of classes/qdisc)
+    static long old_time;
+    long actual_time;
+    long diff;
+    actual_time = (long)time(NULL);
+    diff = actual_time-old_time;
+    if(diff<UPDATE_INTERVAL) {
+	return;
+    }
+    old_time=actual_time;
+    
+    delete_old_qos_table_data(table);    
+    add_new_entries_to_table();
+    // fetches all data from kernel and stores them in linked list of structures
+}
+
+void delete_old_qos_table_data(qos_table *table) {
+    // deletes all table data except those in first pointer (they are not mallocced - static)
+    qos_table *iterator;
+    qos_table *temp=NULL;
+    iterator=table;
+
+    if(iterator->next==NULL) return;
+    iterator=iterator->next;    
+    
+    while(iterator!=NULL) {
+	temp=iterator->next;
+	free(iterator);
+	iterator=temp;
+    }
+    table->next=NULL; //delete first point in line
+    
+}
+
+qos_table* create_new_qos_table_entry() {
+// allocates a new entry into table, don't care about qos_table identifier, it should be named
+// qos_table_entry, but it's around all code :-), qos_table doesn't mean whole table, but only 
+// one entry in linked list... sorry for that
+
+    qos_table *new_entry;
+
+    new_entry = (qos_table*)malloc(sizeof(qos_table));
+
+    if(new_entry==NULL) {
+	snmp_log(LOG_WARNING,"qos-ext: create_new_qos_table_entry: cannot allocate memory for new entry\n");
+	return(NULL);
+    }
+
+    memset(new_entry,0,sizeof(qos_table));
+
+    new_entry->next=NULL;
+    new_entry->data.dev_name[0]=0x0;
+    new_entry->data.type[0]=0x0;
+    new_entry->data.text_parent[0]=0x0;
+    new_entry->data.text_handle[0]=0x0;    
+    new_entry->data.text_leaf[0]=0x0;
+    new_entry->data.qosBytes=0;
+    new_entry->data.info[0]=0x0;
+    //string initialization
+    return(new_entry);
+}
+
+qos_table* get_last_entry_in_list(qos_table *table) {
+// finds last entry in linked list of qos_table entities
+    qos_table *iterator;
+    iterator = table;
+    while(iterator->next!=NULL) {
+	iterator=iterator->next;
+    }
+    return(iterator);
+}
+
+
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/qos_checkfns.h tomato121/release/src/router/snmp/agent/mibgroup/qos_checkfns.h
--- tomato/release/src/router/snmp/agent/mibgroup/qos_checkfns.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/qos_checkfns.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,78 @@
+/*
+ * Note: this file originally auto-generated by mib2c using
+ *        : mib2c.iterate.conf,v 5.6 2003/02/20 00:52:07 hardaker Exp $
+ */
+
+/***********************************************************************
+ *   This file is auto-generated and SHOULD NOT BE EDITED by hand.
+ *   Modify the qos_checkfns_local.[ch] files insead.
+ *   (so that you can regenerate this one as mib2c improvements are made)
+ ***********************************************************************/
+#ifndef QOS_CHECKFNS_H
+#define QOS_CHECKFNS_H
+
+
+#define UPDATE_INTERVAL 10
+/** make sure we load the functions that you can modify */
+config_require(qos_checkfns_local)
+
+    /*
+     * these functions are designed to check incoming values for 
+     * columns in the qosObjectTable table for legality with respect to 
+     * datatype and value.
+     */
+typedef struct qos_data qos_data;
+struct qos_data {
+    long	device_type;
+    long	device_index;
+    u_long	majorhandle;
+    u_long	minorhandle;
+    u_long	parent;
+    char	text_parent[20];
+    char	text_handle[20];
+    char	text_leaf[20];
+    char	dev_name[10];
+    char	type[10];
+    unsigned long long	qosBytes;
+    u_long	qosPackets;
+    u_long	qosDropped;
+    u_long	qosOverlimit;
+    u_long	qosBps;
+    u_long	qosPps;
+    u_long	qosQlen;
+    u_long	qosBacklog;
+    
+    u_long	redEarly;
+    u_long	redPdrop;
+    u_long	redOther;
+    u_long	redMarked;
+    
+    u_long	htbLends;
+    u_long	htbBorrows;
+    u_long	htbGiants;
+    u_long	htbTokens;
+    u_long	htbCTokens;
+    u_long	htbRate;
+    u_long	htbCeil;
+    u_long	htbPrio;
+    
+    u_long	cbqBorrows;
+    u_long	cbqOveractions;
+    long	cbqAvgidle;
+    long	cbqUndertime;
+    char	info[256];
+};
+
+typedef struct qos_table qos_table;
+struct qos_table {
+    qos_data	data;
+    qos_table	*next;
+};
+
+void initialize_qos_table(qos_table *table);
+void update_qos_table_data(qos_table *table);     
+
+void delete_old_qos_table_data(qos_table *table);
+qos_table* create_new_qos_table_entry();
+qos_table* get_last_entry_in_list(qos_table *table);
+#endif                          /* QOS_CHECKFNS_H */
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/qos_checkfns_local.c tomato121/release/src/router/snmp/agent/mibgroup/qos_checkfns_local.c
--- tomato/release/src/router/snmp/agent/mibgroup/qos_checkfns_local.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/qos_checkfns_local.c	2008-04-21 19:44:20.000000000 +1000
@@ -0,0 +1,705 @@
+/*
+ * Note: this file originally auto-generated by mib2c using
+ *        : mib2c.check_values_local.conf,v 5.1 2003/05/30 23:53:15 hardaker Exp $
+ */
+
+/*
+    Function from this file are mainly copied from iproute2 project, distrubuted under GPL
+    qos_table specific functions are written by Michal Charvat, jaazz@post.cz
+    generally I wanted to link libnetlink.a (created by iproute2 package) into snmp daemon,
+    but it didn't work well.... I'm not so familiar with library linking.
+    what happend when I've tried: compilation and linking ok, but during run relocation error
+    occured and program was terminated by kernel.(due to missing functions - but compiler
+    didn't say a word about that missing functions ... why????)
+
+*/
+
+/*
+ * standard headers
+ */
+
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include "qos_checkfns.h"
+#include "qos_enums.h"
+#include "qos_checkfns_local.h"
+#include <stdio.h>
+#include <unistd.h>
+#include <string.h>
+#include <stdlib.h>
+#include <asm/types.h>
+#include <asm/param.h>
+#include <sys/types.h>
+#include <resolv.h>
+#include <linux/socket.h>
+#include <linux/netlink.h>
+#include <linux/rtnetlink.h>
+#include "libnetlink.h"
+#include "../../../../linux/linux/include/linux/pkt_sched.h"
+#include <linux/pkt_cls.h>
+#include <syslog.h>
+#include <fcntl.h>
+#include <net/if_arp.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <string.h>
+#include <errno.h>
+#include <time.h>
+#include <sys/uio.h>
+
+#include "ll_map.h"
+#include "libnetlink.h"
+
+static int rth_initialized=0;
+
+void add_new_entries_to_table() {
+// call dump of netlink qos layer in kernel and adds received object into qos_table 
+//(specifically their statistics values & some parts of configuration (htb))
+	struct tcmsg t;
+	struct rtnl_handle rth;
+	extern int rth_initialized;
+	char d[16];
+
+	memset(&rth,0,sizeof(struct rtnl_handle));
+	memset(&t, 0, sizeof(t));
+	t.tcm_family = AF_UNSPEC;
+	memset(&d, 0, sizeof(d));
+	
+	if (rtnl_open(&rth, 0) < 0) {
+		snmp_log(LOG_NOTICE, "Cannot open rtnetlink");
+		return;
+	}
+
+//	if(rth_initialized==0) {
+	    ll_init_map(&rth);
+//	    rth_initialized=1;
+//	}
+
+	if (rtnl_dump_request(&rth, RTM_GETQDISC, &t, sizeof(t)) < 0) {
+		snmp_log(LOG_WARNING,"qos-ext: add_new_entries to table: cannot send dump request");
+		return;
+	}
+
+
+	if (rtnl_dump_filter(&rth, insert_entry, NULL, NULL, NULL) < 0) {
+		snmp_log(LOG_WARNING, "qos-ext: add_new entries to table: qdisc dump terminated");
+		return;
+	}
+
+	rtnl_close(&rth);
+
+	add_classes();		
+}
+
+void add_classes() {
+// call dump of classes, these needs to be dumped on per device basis
+	struct tcmsg t;
+	struct rtnl_handle rth;
+	char d[16];
+
+	char line[1024];
+	FILE *dev;
+	char *p;
+
+	memset(&rth,0,sizeof(struct rtnl_handle));
+	memset(&t, 0, sizeof(t));
+
+	t.tcm_family = AF_UNSPEC;
+	memset(&d, 0, sizeof(d));
+	
+	if (rtnl_open(&rth, 0) < 0) {
+		snmp_log(LOG_NOTICE, "Cannot open rtnetlink");
+		return;
+	}
+
+
+	dev=fopen("/proc/net/dev","r");
+	if(dev==NULL) {
+	    snmp_log(LOG_WARNING,"qos-ext: cannot open /proc/net/dev for reading, class stats won't be avaiable");
+	    return;
+	}    
+	while(fscanf(dev,"%s",line)!=EOF) {
+	//find existing devices
+	    p=index(line,':'); if(p==NULL) continue;
+	    *p='\0';
+	    // line contains device_name.... need to translate name into index
+	    t.tcm_ifindex = ll_name_to_index(line);
+	
+	    if (rtnl_dump_request(&rth, RTM_GETTCLASS, &t, sizeof(t)) < 0) {
+		//dump all classes on device with index t.tcm_ifindex
+	    	snmp_log(LOG_WARNING,"qos-ext: add_new_entries to table: cannot send dump request");
+		fclose(dev);
+		return;
+	    }
+	    if (rtnl_dump_filter(&rth, insert_entry, NULL, NULL, NULL) < 0) {
+		//append all classes entris into the internal table
+		snmp_log(LOG_WARNING, "qos-ext: add_new entries to table: class dump terminated");
+		fclose(dev);
+		return;
+	    }
+	}
+	fclose(dev);
+	rtnl_close(&rth);
+}
+
+int insert_entry(struct sockaddr_nl *who, struct nlmsghdr *n, void *a)
+{
+	// this function extracts data from netlink message and creates object in qos_table
+	extern struct qos_table table;
+	qos_table *qos_table_entry;
+	qos_table *temp;
+	char handle[20]="unset";
+	char parent[20]="unset";
+	char leaf[20]="leaf";
+	char optional[20]="";
+
+	char info[256]="";
+	int offset=0;
+	//string info 
+	
+	unsigned int major,minor;
+	struct tcmsg *t = NLMSG_DATA(n);
+	int len = n->nlmsg_len;
+	struct rtattr * tb[TCA_MAX+1];
+	char abuf[256];
+
+	len -= NLMSG_LENGTH(sizeof(*t));
+	if (len < 0) {
+		snmp_log(LOG_NOTICE, "insert_qdisc_entry: Wrong len of tc message:%i", len);
+		return(-1);
+	}
+
+	memset(tb, 0, sizeof(tb));
+	parse_rtattr(tb, TCA_MAX, TCA_RTA(t), len);
+
+	if (tb[TCA_KIND] == NULL) {
+		snmp_log(LOG_NOTICE, "insert_qdisc_entry: unknown kind\n");
+		return(-1);
+	}
+
+	qos_table_entry = create_new_qos_table_entry();
+	
+	if(qos_table_entry==NULL) {
+	    return;
+	}
+
+	strcpy(qos_table_entry->data.type,(char*)RTA_DATA(tb[TCA_KIND]));
+
+	qos_table_entry->data.majorhandle = (t->tcm_handle >> 16) & 0x0000ffff;		//major part of handle
+	qos_table_entry->data.minorhandle = t->tcm_handle & 0x0000ffff;			//minor part of handle	
+	qos_table_entry->data.parent = t->tcm_parent;					//parent
+
+	strcpy(qos_table_entry->data.dev_name, ll_index_to_name(t->tcm_ifindex));
+	// sets string qosDeviceName in mib
+
+	set_device_index_and_type(&(qos_table_entry->data.device_index),&(qos_table_entry->data.device_type),qos_table_entry->data.dev_name);
+	// function takes string device name as input and separate it to device_index and device_type
+
+	switch(t->tcm_parent) {
+	    case TC_H_ROOT:
+		strcpy(optional," (root)");
+		break;
+	    case TC_H_INGRESS:
+		strcpy(optional," (ingress)");
+		break;
+	    default:
+	    break;
+	}
+	minor=t->tcm_parent & 0x0000FFFF;
+	major=(t->tcm_parent >> 16) & 0x0000FFFF;   
+	sprintf(parent,"%x:%x%s",major,minor,optional);
+	strcpy(qos_table_entry->data.text_parent,parent);
+	// sets string parent info in mib
+
+	sprintf(info+strlen(info),"%s%s","parent:",parent);
+	// one line values reporting
+	
+	strcpy(optional,"");
+	// clear temporary optional variable
+		
+	switch(t->tcm_handle) {
+	    case TC_H_ROOT:
+		strcpy(optional," (root)");
+		break;
+	    case TC_H_INGRESS:
+		strcpy(optional," (ingress)");
+		break;
+	    default:
+	    break;
+	}
+ 	minor=t->tcm_handle & 0x0000FFFF;
+	major=(t->tcm_handle >> 16) & 0x0000FFFF;   
+    	sprintf(handle,"%x:%x%s",major,minor,optional);
+	strcpy(qos_table_entry->data.text_handle,handle);
+	// sets string handle info in mib
+	
+	sprintf(info+strlen(info),"%s%s"," handle:",handle);
+	// one line values reporting
+
+	if((t->tcm_info >> 16)!=0) {
+	    minor=0;
+	    major=t->tcm_info >> 16;
+	    strcpy(optional," (leaf)");
+	    sprintf(leaf,"%x:%x%s",major,minor,optional);
+	    strcpy(qos_table_entry->data.text_leaf,leaf);
+	    // sets leaf info if any
+	    
+	    sprintf(info+strlen(info),"%s%s"," leaf:",leaf);
+	    // one line values reporting
+	}
+	
+    
+	if (tb[TCA_STATS]) {
+		if (RTA_PAYLOAD(tb[TCA_STATS]) < sizeof(struct tc_stats))
+			snmp_log(LOG_WARNING, "qos-ext: insert into table: statistics truncated\n");
+		else {
+		    struct tc_stats st;
+		    unsigned long long temp;
+		    unsigned long long ibytes; // for string info reporting purpose
+		    memcpy(&st, RTA_DATA(tb[TCA_STATS]), sizeof(st));
+		    ibytes=st.bytes;
+		    temp = st.bytes & 0xFFFFFFFF00000000;
+		    temp = temp >> 32;
+		    temp = (st.bytes << 32) | temp;
+		    // this funny action translates from host (x86) representation to network data representation (ASN1)
+		    // I know it can be done in one step - but this way it's easy to understand
+		    
+		    qos_table_entry->data.qosBytes = temp;
+		    qos_table_entry->data.qosPackets = st.packets;
+		    qos_table_entry->data.qosDropped = st.drops;
+		    qos_table_entry->data.qosOverlimit = st.overlimits;
+		    qos_table_entry->data.qosBps = st.bps;
+		    qos_table_entry->data.qosPps = st.pps;
+		    qos_table_entry->data.qosQlen = st.qlen;
+		    qos_table_entry->data.qosBacklog = st.backlog;
+		    // all standard statistic values
+		    // pps/bps value is currently (April 2004) reported only from htb classes
+		    
+		    sprintf(info+strlen(info),"%s%lli%s%i%s%i%s%i%s%i%s%i%s%i%s%i"," bytes:",ibytes," packets:",st.packets," drops:",st.drops,
+			    " overlimit:",st.overlimits," bps:",st.bps," pps:",st.pps," qlen:",st.qlen," backlog:",st.backlog);
+		    //one line values reporting (column 35)
+		}	
+	}
+	if (tb[TCA_XSTATS]) {
+		if (RTA_PAYLOAD(tb[TCA_XSTATS]) < sizeof(struct xstats)) {
+		}
+		else {
+		    struct xstats st;
+		    memcpy(&st,RTA_DATA(tb[TCA_XSTATS]),sizeof(st));
+		    //check out, what type of qdisc/class it is and set appropriate values
+		    if(strcmp(qos_table_entry->data.type,"red")==0 || strcmp(qos_table_entry->data.type,"gred")==0) {
+			qos_table_entry->data.redEarly=st.x1;
+			qos_table_entry->data.redPdrop=st.x2;
+			qos_table_entry->data.redOther=st.x3;
+			qos_table_entry->data.redMarked=st.x4;
+			
+			sprintf(info+strlen(info),"%s%i%s%i%s%i%s%i"," redearly:",st.x1," redpdrop:",st.x2," redother:",st.x3," redmarked",st.x4);
+			//one line values reporting (column 35)
+		    }
+		    if(strcmp(qos_table_entry->data.type,"cbq")==0) {
+			qos_table_entry->data.cbqBorrows=st.x1;
+			qos_table_entry->data.cbqOveractions=st.x2;
+			qos_table_entry->data.cbqAvgidle=st.x3;
+			qos_table_entry->data.cbqUndertime=st.x4;
+
+			sprintf(info+strlen(info),"%s%i%s%i%s%i%s%i"," cbqborrows:",st.x1," cbqoveractions:",st.x2," cbqavgidle:",st.x3," cbqundertime",st.x4);
+			//one line values reporting (column 35)
+		    }
+		    if(strcmp(qos_table_entry->data.type,"htb")==0) {
+			struct tc_htb_xstats *st_htb;
+			struct rtattr *tb2[TCA_HTB_RTAB+1];
+			memset(tb2,0,sizeof(tb2));
+			parse_rtattr(tb2,TCA_HTB_RTAB, RTA_DATA(tb[TCA_OPTIONS]),RTA_PAYLOAD(tb[TCA_OPTIONS]));
+			// extracts htb specific parameters
+			
+			st_htb=(struct tc_htb_xstats *)&st;
+			qos_table_entry->data.htbLends=st_htb->lends;
+			qos_table_entry->data.htbBorrows=st_htb->borrows;
+			qos_table_entry->data.htbGiants=st_htb->giants;
+			qos_table_entry->data.htbTokens=st_htb->tokens;
+
+			sprintf(info+strlen(info),"%s%i%s%i%s%i%s%i"," htblends:",st_htb->lends," htbborrows:",st_htb->borrows,
+				" htbgiants:",st_htb->giants," htbtokens:",st_htb->tokens);
+			// one line values reporting (column 35)
+
+			if(RTA_PAYLOAD(tb[TCA_XSTATS]) >= sizeof(*st_htb)) {
+    		    	    qos_table_entry->data.htbCTokens=st_htb->ctokens;
+			    
+			    sprintf(info+strlen(info),"%s%i"," htbctokens:",st_htb->ctokens);
+			    // one line values reporting (column 35)
+
+			}
+			else {
+			    snmp_log(LOG_WARNING,"Ctokens value not avaiable in netlink message\n");
+			}
+
+			if(tb2[TCA_HTB_PARMS]) {
+			    struct tc_htb_opt *hopt;
+			    hopt = RTA_DATA(tb2[TCA_HTB_PARMS]);
+			    if(RTA_PAYLOAD(tb2[TCA_HTB_PARMS]) < sizeof(*hopt)) {
+				snmp_log(LOG_WARNING,"qos-ext: htb parametrs are not all\n");
+			    }
+			    else {
+				qos_table_entry->data.htbCeil=hopt->ceil.rate;
+				qos_table_entry->data.htbRate=hopt->rate.rate;
+				qos_table_entry->data.htbPrio=hopt->prio;
+				// htb rate, ceil and prio values
+			    }
+			}
+		    }
+		}
+	}
+
+	strcpy(qos_table_entry->data.info,info);
+	// one line values reporting
+
+	temp = get_last_entry_in_list(&table); 
+	temp->next = qos_table_entry;
+	// add stat structute into linked list
+}
+
+void set_device_index_and_type(long *device_index, long *device_type, char *string_device) {
+    // takes device name as argument and return 2 values - ex: ppp123 -> ppp & 123 (device type & device index)
+    int i=0;
+    if(string_device==NULL) {
+	// just to be sure
+	snmp_log(LOG_WARNING,"qos-ext: set_device_index_and_type: input string is NULL\n");
+	*device_index=0;
+	*device_type=0;
+	return;
+    }
+    for(i=0;i<DEVICE_COUNT;i++) {
+	//finding appropriate device_name
+	if(strncmp(devices[i],string_device,strlen(devices[i]))==0) {
+	    *device_type=i+1; // +1 because 0.0.0.0 is present everytime - it would otherwise conflit with ppp0 
+	    *device_index=atol(string_device+strlen(devices[i]));
+	    return;
+	}
+    }
+    snmp_log(LOG_WARNING,"qos-ext: device type not found\n");
+    *device_index=0;
+    *device_type=0;
+}
+
+// futher functions are copied from iproute2 project, because of problems with
+// linking libnetlink.a library into snmp daemon
+// I've changed only perror calls into snmpd_log calls
+
+void rtnl_close(struct rtnl_handle *rth)
+{
+	close(rth->fd);
+}
+
+int rtnl_open(struct rtnl_handle *rth, unsigned subscriptions)
+{
+	int addr_len;
+
+	memset(rth, 0, sizeof(rth));
+
+	rth->fd = socket(AF_NETLINK, SOCK_RAW, NETLINK_ROUTE);
+	if (rth->fd < 0) {
+		snmp_log(LOG_WARNING,"cannot open netlink socket\n");
+		return -1;
+	}
+
+	memset(&rth->local, 0, sizeof(rth->local));
+	rth->local.nl_family = AF_NETLINK;
+	rth->local.nl_groups = subscriptions;
+
+	if (bind(rth->fd, (struct sockaddr*)&rth->local, sizeof(rth->local)) < 0) {
+//		perror("Cannot bind netlink socket");
+		snmp_log(LOG_NOTICE,"cannot bind netlink socket\n");
+		return -1;
+	}
+	addr_len = sizeof(rth->local);
+	if (getsockname(rth->fd, (struct sockaddr*)&rth->local, &addr_len) < 0) {
+//		perror("Cannot getsockname");
+		snmp_log(LOG_NOTICE,"canot getsockname\n");
+		return -1;
+	}
+	if (addr_len != sizeof(rth->local)) {
+//		fprintf(stderr, "Wrong address length %d\n", addr_len);
+		snmp_log(LOG_NOTICE,"wrong address length\n");
+		return -1;
+	}
+	if (rth->local.nl_family != AF_NETLINK) {
+//		fprintf(stderr, "Wrong address family %d\n", rth->local.nl_family);
+		snmp_log(LOG_NOTICE,"wrong address family\n");
+		return -1;
+	}
+	rth->seq = time(NULL);
+	return 0;
+}
+
+int rtnl_dump_request(struct rtnl_handle *rth, int type, void *req, int len)
+{
+	struct nlmsghdr nlh;
+	struct sockaddr_nl nladdr;
+	struct iovec iov[2] = { { &nlh, sizeof(nlh) }, { req, len } };
+	struct msghdr msg = {
+		(void*)&nladdr, sizeof(nladdr),
+		iov,	2,
+		NULL,	0,
+		0
+	};
+
+	memset(&nladdr, 0, sizeof(nladdr));
+	nladdr.nl_family = AF_NETLINK;
+
+	nlh.nlmsg_len = NLMSG_LENGTH(len);
+	nlh.nlmsg_type = type;
+	nlh.nlmsg_flags = NLM_F_ROOT|NLM_F_MATCH|NLM_F_REQUEST;
+	nlh.nlmsg_pid = 0;
+	nlh.nlmsg_seq = rth->dump = ++rth->seq;
+
+	return sendmsg(rth->fd, &msg, 0);
+}
+
+int rtnl_wilddump_request(struct rtnl_handle *rth, int family, int type)
+{
+	struct {
+		struct nlmsghdr nlh;
+		struct rtgenmsg g;
+	} req;
+	struct sockaddr_nl nladdr;
+
+	memset(&nladdr, 0, sizeof(nladdr));
+	nladdr.nl_family = AF_NETLINK;
+
+	req.nlh.nlmsg_len = sizeof(req);
+	req.nlh.nlmsg_type = type;
+	req.nlh.nlmsg_flags = NLM_F_ROOT|NLM_F_MATCH|NLM_F_REQUEST;
+	req.nlh.nlmsg_pid = 0;
+	req.nlh.nlmsg_seq = rth->dump = ++rth->seq;
+	req.g.rtgen_family = family;
+
+	return sendto(rth->fd, (void*)&req, sizeof(req), 0, (struct sockaddr*)&nladdr, sizeof(nladdr));
+}
+
+int rtnl_dump_filter(struct rtnl_handle *rth,
+		     int (*filter)(struct sockaddr_nl *, struct nlmsghdr *n, void *),
+		     void *arg1,
+		     int (*junk)(struct sockaddr_nl *,struct nlmsghdr *n, void *),
+		     void *arg2)
+{
+	char	buf[8192];
+	struct sockaddr_nl nladdr;
+	struct iovec iov = { buf, sizeof(buf) };
+
+	while (1) {
+		int status;
+		struct nlmsghdr *h;
+
+		struct msghdr msg = {
+			(void*)&nladdr, sizeof(nladdr),
+			&iov,	1,
+			NULL,	0,
+			0
+		};
+
+		status = recvmsg(rth->fd, &msg, 0);
+
+		if (status < 0) {
+			if (errno == EINTR)
+				continue;
+//			perror("OVERRUN");
+			snmp_log(LOG_WARNING,"overrun\n");
+			continue;
+		}
+		if (status == 0) {
+//			fprintf(stderr, "EOF on netlink\n");
+			snmp_log(LOG_NOTICE,"EOF on netlink\n");
+			return -1;
+		}
+		if (msg.msg_namelen != sizeof(nladdr)) {
+//			fprintf(stderr, "sender address length == %d\n", msg.msg_namelen);
+			snmp_log(LOG_NOTICE,"sender address length\n");
+			return(1);
+		}
+
+		h = (struct nlmsghdr*)buf;
+		while (NLMSG_OK(h, status)) {
+			int err;
+
+			if (h->nlmsg_pid != rth->local.nl_pid ||
+			    h->nlmsg_seq != rth->dump) {
+				if (junk) {
+					err = junk(&nladdr, h, arg2);
+					if (err < 0)
+						return err;
+				}
+				goto skip_it;
+			}
+
+			if (h->nlmsg_type == NLMSG_DONE)
+				return 0;
+			if (h->nlmsg_type == NLMSG_ERROR) {
+				struct nlmsgerr *err = (struct nlmsgerr*)NLMSG_DATA(h);
+				if (h->nlmsg_len < NLMSG_LENGTH(sizeof(struct nlmsgerr))) {
+//					fprintf(stderr, "ERROR truncated\n");
+					snmp_log(LOG_NOTICE,"error struncated\n");
+				} else {
+					errno = -err->error;
+//					perror("RTNETLINK answers");
+					snmp_log(LOG_NOTICE,"rtnetlink failed\n");
+				}
+				return -1;
+			}
+			err = filter(&nladdr, h, arg1);
+			if (err < 0)
+				return err;
+
+skip_it:
+			h = NLMSG_NEXT(h, status);
+		}
+		if (msg.msg_flags & MSG_TRUNC) {
+//			fprintf(stderr, "Message truncated\n");
+			snmp_log(LOG_NOTICE,"message truncated\n");
+			continue;
+		}
+		if (status) {
+//			fprintf(stderr, "!!!Remnant of size %d\n", status);
+			snmp_log(LOG_NOTICE,"remnant of size\n");
+			return(1);
+		}
+	}
+}
+
+int parse_rtattr(struct rtattr *tb[], int max, struct rtattr *rta, int len)
+{
+	while (RTA_OK(rta, len)) {
+		if (rta->rta_type <= max)
+			tb[rta->rta_type] = rta;
+		rta = RTA_NEXT(rta,len);
+	}
+	if (len)
+//		fprintf(stderr, "!!!Deficit %d, rta_len=%d\n", len, rta->rta_len);
+		snmp_log(LOG_WARNING,"deficit of rta_len\n");
+	return 0;
+}
+
+
+struct idxmap
+{
+	struct idxmap * next;
+	int		index;
+	int		type;
+	int		alen;
+	unsigned	flags;
+	unsigned char	addr[8];
+	char		name[16];
+};
+
+static struct idxmap *idxmap[16];
+
+int ll_remember_index(struct sockaddr_nl *who, struct nlmsghdr *n, void *arg)
+{
+	int h;
+	struct ifinfomsg *ifi = NLMSG_DATA(n);
+	struct idxmap *im, **imp;
+	struct rtattr *tb[IFLA_MAX+1];
+
+	if (n->nlmsg_type != RTM_NEWLINK)
+		return 0;
+
+	if (n->nlmsg_len < NLMSG_LENGTH(sizeof(ifi)))
+		return -1;
+
+
+	memset(tb, 0, sizeof(tb));
+	parse_rtattr(tb, IFLA_MAX, IFLA_RTA(ifi), IFLA_PAYLOAD(n));
+	if (tb[IFLA_IFNAME] == NULL)
+		return 0;
+
+	h = ifi->ifi_index&0xF;
+
+	for (imp=&idxmap[h]; (im=*imp)!=NULL; imp = &im->next)
+		if (im->index == ifi->ifi_index)
+			break;
+
+	if (im == NULL) {
+		im = malloc(sizeof(*im));
+		if (im == NULL)
+			return 0;
+		im->next = *imp;
+		im->index = ifi->ifi_index;
+		*imp = im;
+	}
+
+	im->type = ifi->ifi_type;
+	im->flags = ifi->ifi_flags;
+	if (tb[IFLA_ADDRESS]) {
+		int alen;
+		im->alen = alen = RTA_PAYLOAD(tb[IFLA_ADDRESS]);
+		if (alen > sizeof(im->addr))
+			alen = sizeof(im->addr);
+		memcpy(im->addr, RTA_DATA(tb[IFLA_ADDRESS]), alen);
+	} else {
+		im->alen = 0;
+		memset(im->addr, 0, sizeof(im->addr));
+	}
+	strcpy(im->name, RTA_DATA(tb[IFLA_IFNAME]));
+	return 0;
+}
+
+const char *ll_idx_n2a(int idx, char *buf)
+{
+	struct idxmap *im;
+
+	if (idx == 0)
+		return "*";
+	for (im = idxmap[idx&0xF]; im; im = im->next)
+		if (im->index == idx)
+			return im->name;
+	snprintf(buf, 16, "if%d", idx);
+	return buf;
+}
+
+
+const char *ll_index_to_name(int idx)
+{
+	static char nbuf[16];
+
+	return ll_idx_n2a(idx, nbuf);
+}
+
+int ll_name_to_index(char *name)
+{
+	static char ncache[16];
+	static int icache;
+	struct idxmap *im;
+	int i;
+
+	if (name == NULL)
+		return 0;
+	if (icache && strcmp(name, ncache) == 0)
+		return icache;
+	for (i=0; i<16; i++) {
+		for (im = idxmap[i]; im; im = im->next) {
+			if (strcmp(im->name, name) == 0) {
+				icache = im->index;
+				strcpy(ncache, name);
+				return im->index;
+			}
+		}
+	}
+	return 0;
+}
+
+int ll_init_map(struct rtnl_handle *rth)
+{
+	if (rtnl_wilddump_request(rth, AF_UNSPEC, RTM_GETLINK) < 0) {
+//		perror("Cannot send dump request");
+		snmp_log(LOG_WARNING,"cannot send dump request\n");
+		return(-1);
+//		exit(1);
+	}
+
+	if (rtnl_dump_filter(rth, ll_remember_index, &idxmap, NULL, NULL) < 0) {
+//		fprintf(stderr, "Dump terminated\n");
+		snmp_log(LOG_WARNING,"dump terminated\n");
+//		exit(1);
+		return(-1);
+	}
+	return 0;
+}
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/qos_checkfns_local.h tomato121/release/src/router/snmp/agent/mibgroup/qos_checkfns_local.h
--- tomato/release/src/router/snmp/agent/mibgroup/qos_checkfns_local.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/qos_checkfns_local.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,38 @@
+/*
+ * Note: this file originally auto-generated by mib2c using
+ *        : : mib2c.check_values_local.conf,v 5.1 2003/05/30 23:53:15 hardaker Exp $
+ * 
+ */
+#ifndef QOS_CHECKFNS_LOCAL_H
+#define QOS_CHECKFNS_LOCAL_H
+
+#include<asm/types.h>
+#include<linux/netlink.h>
+#include<linux/rtnetlink.h>
+/*
+ * these functions are designed to check incoming values for 
+ * columns in the qosObjectTable table for legality with respect to 
+ * datatype and value according to local conventions.  You should modify
+ * them as appropriate.  They will be called from parent check_value
+ * functions that are auto-generated using mib2c and the parent functions
+ * should NOT be modified.
+ */
+
+#define DEVICE_COUNT 9
+static char* devices[] = { "ppp" , "eth" , "tap" , "tun" , "br", "wlan" , "tunl", "lo", "teql" };
+
+typedef struct xstats xstats;
+struct xstats {
+    __u32	x1;
+    __u32	x2;
+    __u32	x3;
+    __u32	x4;
+    __u32	x5;
+};
+
+
+void add_new_entries_to_table();
+void add_classes();
+void set_device_index_and_type(long *device_index,long *device_name,char *string_device);
+int insert_entry(struct sockaddr_nl *who, struct nlmsghdr *n, void *a);
+#endif                          /* QOS_CHECKFNS_H */
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/qos_columns.h tomato121/release/src/router/snmp/agent/mibgroup/qos_columns.h
--- tomato/release/src/router/snmp/agent/mibgroup/qos_columns.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/qos_columns.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,47 @@
+/*
+ * Note: this file originally auto-generated by mib2c using
+ *  : mib2c.column_defines.conf,v 5.1 2002/05/08 05:42:47 hardaker Exp $
+ */
+#ifndef QOS_COLUMNS_H
+#define QOS_COLUMNS_H
+
+/*
+ * column number definitions for table qosObjectTable 
+ */
+#define COLUMN_QOSDEVICETYPE		1
+#define COLUMN_QOSDEVICEINDEX		2
+#define COLUMN_QOSMAJORHANDLE		3
+#define COLUMN_QOSMINORHANDLE		4
+#define COLUMN_QOSTEXTHANDLE		5
+#define COLUMN_QOSTEXTLEAF		6
+#define COLUMN_QOSPARENT		7
+#define COLUMN_QOSTEXTPARENT		8
+#define COLUMN_QOSDEVICENAME		9
+#define COLUMN_QOSTYPE			10
+#define COLUMN_QOSBYTES			11
+#define COLUMN_QOSPACKETS		12
+#define COLUMN_QOSDROPPED		13
+#define COLUMN_QOSOVERLIMIT		14
+#define COLUMN_QOSBPS			15
+#define COLUMN_QOSPPS			16
+#define COLUMN_QOSQLEN			17
+#define COLUMN_QOSBACKLOG		18
+#define COLUMN_QOSREDEARLY		19
+#define COLUMN_QOSREDPDROP		20
+#define COLUMN_QOSREDOTHER		21
+#define COLUMN_QOSREDMARKED		22
+#define COLUMN_QOSHTBLENDS		23
+#define COLUMN_QOSHTBBORROWS		24
+#define COLUMN_QOSHTBGIANTS		25
+#define COLUMN_QOSHTBTOKENS		26
+#define COLUMN_QOSHTBCTOKENS		27
+#define COLUMN_QOSHTBRATE		28
+#define COLUMN_QOSHTBCEIL		29
+#define COLUMN_QOSHTBPRIO		30
+#define COLUMN_QOSCBQBORROWS		31
+#define COLUMN_QOSCBQOVERACTIONS	32
+#define COLUMN_QOSCBQAVGIDLE		33
+#define COLUMN_QOSCBQUNDERTIME		34
+#define COLUMN_QOSINFO			35
+
+#endif                          /* QOS_COLUMNS_H */
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/qos_enums.h tomato121/release/src/router/snmp/agent/mibgroup/qos_enums.h
--- tomato/release/src/router/snmp/agent/mibgroup/qos_enums.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/qos_enums.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,8 @@
+/*
+ * Note: this file originally auto-generated by mib2c using
+ *  : mib2c.column_enums.conf,v 5.2 2003/02/22 04:09:25 hardaker Exp $
+ */
+#ifndef QOS_ENUMS_H
+#define QOS_ENUMS_H
+
+#endif                          /* QOS_ENUMS_H */
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/qos.h tomato121/release/src/router/snmp/agent/mibgroup/qos.h
--- tomato/release/src/router/snmp/agent/mibgroup/qos.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/qos.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,30 @@
+/*
+ * Note: this file originally auto-generated by mib2c using
+ *        : mib2c.iterate_access.conf,v 1.6 2003/09/29 22:30:36 hardaker Exp $
+ */
+#ifndef QOS_H
+#define QOS_H
+
+/** other required module components */
+config_require(qos_access)
+    config_require(qos_checkfns)
+
+    /*
+     * function declarations 
+     */
+     void            init_qos(void);
+     void            initialize_table_qosObjectTable(void);
+     Netsnmp_Node_Handler qosObjectTable_handler;
+
+
+/*
+ * column number definitions for table qosObjectTable 
+ */
+#include "qos_columns.h"
+
+/*
+ * enum definions 
+ */
+#include "qos_enums.h"
+
+#endif /** QOS_H */
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/QOS.TXT tomato121/release/src/router/snmp/agent/mibgroup/QOS.TXT
--- tomato/release/src/router/snmp/agent/mibgroup/QOS.TXT	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/QOS.TXT	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,371 @@
+LINUX-KERNEL-QOS DEFINITIONS ::= BEGIN
+
+IMPORTS
+    MODULE-IDENTITY, OBJECT-TYPE, enterprises,
+    Integer32, Counter32, mib-2, Unsigned32
+        FROM SNMPv2-SMI
+    DisplayString
+        FROM SNMPv2-TC
+    MODULE-COMPLIANCE, OBJECT-GROUP
+        FROM SNMPv2-CONF;
+    
+qos MODULE-IDENTITY
+    LAST-UPDATED	"200402080000Z"
+    ORGANIZATION	"www.prokon.cz"
+    CONTACT-INFO
+	"postal:	Michal Charvat
+			Zemesska 309
+			Citoliby 439 02
+			Czech Republic
+			
+	 email:		michal@ns1.prokon.cz"
+    DESCRIPTION 
+	"QoS statistics from Linux kernel"
+    REVISION	"200402080000Z"
+    DESCRIPTION
+	"qos mib to get values from Linux kernel"
+    ::= { enterprises 18756 }	-- IANA gave me this number to use
+    
+-- top level structure
+
+qosObjectTable OBJECT-TYPE
+    SYNTAX	SEQUENCE OF QosObject
+    MAX-ACCESS	not-accessible
+    STATUS	current
+    DESCRIPTION
+	"table, where are all values stored"
+    ::= { qos 1 }
+
+qosObject OBJECT-TYPE
+    SYNTAX	QosObject
+    MAX-ACCESS	not-accessible
+    STATUS	current
+    DESCRIPTION
+	"object specifies one qdisc or class"
+    INDEX	{ qosDeviceIndex, qosMajorHandle, qosMinorHandle }
+    ::= { qosObjectTable 1 }
+    
+
+QosObject ::= SEQUENCE {
+    qosDeviceType	Counter32
+    qosDeviceIndex	INTEGER,
+    qosMajorHandle	Unsigned32,
+    qosMinorHandle	Unsigned32,
+    qosTextHandle	DisplayString,
+    qosTextLeaf		DisplayString,
+    qosParent		Unsigned32,
+    qosTextParent	DisplayString,
+    qosDeviceName	DisplayString,
+    qosType		DisplayString,
+    qosBytes		Counter32,
+    qosPackets		Counter32,
+    qosDropped		Counter32,
+    qosOverlimit	Counter32,
+    qosBps		Unsigned32,
+    qosPps		Unsigned32,
+    qosQlen		Unsigned32,
+    qosBacklog		Unsigned32,
+    qosRedEarly		Counter32,
+    qosRedDrop		Counter32,
+    qosRedOther		Counter32,
+    qosRedMarked	Counter32,
+    qosHtbLends		Counter32,
+    qosHtbBorrows	Counter32,
+    qosHtbGiants	Counter32,
+    qosHtbTokens	INTEGER,
+    qosHtbCTokens	INTEGER,
+    qosHtbRate		Unsigned32,
+    qosHtbCeil		Unsigned32,
+    qosHtbPrio		Unsigned32,
+    qosCbqBorrows	Counter32,
+    qosCbqOveractions	Counter32,
+    qosCbqAvgidle	INTEGER,
+    qosCbqUndertime	INTEGER,
+    qosInfo		DisplayString
+    }
+
+qosDeviceIndex OBJECT-TYPE
+    SYNTAX	INTEGER
+    MAX-ACCESS	read-only
+    STATUS	current
+    DESCRIPTION
+	"system device number"
+    ::= { qosObject 1 }
+
+qosDeviceIndex OBJECT-TYPE
+    SYNTAX	Integer32 (0..2147483647)
+    MAX-ACCESS	read-only
+    STATUS	current
+    DESCRIPTION
+	"system device number"
+    ::= { qosObject 2 }
+
+qosMajorHandle OBJECT-TYPE
+    SYNTAX	Unsigned32
+    MAX-ACCESS	read-only
+    STATUS	current
+    DESCRIPTION	
+	"major part of system handle, per device unique"
+    ::= { qosObject 3 }	
+
+qosMinorHandle OBJECT-TYPE
+    SYNTAX	Unsigned32
+    MAX-ACCESS	read-only
+    STATUS	current
+    DESCRIPTION	
+	"minor part of system handle, per device unique"
+    ::= { qosObject 4 }	
+
+qosTextHandle OBJECT-TYPE 
+    SYNTAX	DisplayString
+    MAX-ACCESS	read-only
+    STATUS	current
+    DESCRIPTION	
+	"literal handle - for better orientation"
+    ::= { qosObject 5 }
+
+qosTextLeaf OBJECT-TYPE 
+    SYNTAX	DisplayString
+    MAX-ACCESS	read-only
+    STATUS	current
+    DESCRIPTION	
+	"literal leaf - for better orientation"
+    ::= { qosObject 6 }
+
+qosParent OBJECT-TYPE
+    SYNTAX	Unsigned32
+    MAX-ACCESS	read-only
+    STATUS	current
+    DESCRIPTION	
+	"parent"
+    ::= { qosObject 7 }	
+
+qosTextParent OBJECT-TYPE 
+    SYNTAX	DisplayString
+    MAX-ACCESS	read-only
+    STATUS	current
+    DESCRIPTION	
+	"literal parent - for better orientation"
+    ::= { qosObject 8 }
+
+
+qosDeviceName OBJECT-TYPE 
+    SYNTAX	DisplayString
+    MAX-ACCESS	read-only
+    STATUS	current
+    DESCRIPTION	
+	"literal device name - for better orientation"
+    ::= { qosObject 9 }
+
+qosType OBJECT-TYPE
+    SYNTAX	DisplayString
+    MAX-ACCESS	read-only
+    STATUS	current
+    DESCRIPTION
+	"literal qos type, once again, better orientation"
+    ::= { qosObject 10 }
+
+qosBytes OBJECT-TYPE
+    SYNTAX	Counter64
+    MAX-ACCESS	read-only
+    STATUS	current
+    DESCRIPTION	
+	"counts transfered bytes on object"
+    ::= { qosObject 11 }
+
+qosPackets OBJECT-TYPE
+    SYNTAX	Counter32
+    MAX-ACCESS	read-only
+    STATUS	current
+    DESCRIPTION	
+	"counts packtes"
+    ::= { qosObject 12 }
+
+qosDropped OBJECT-TYPE
+    SYNTAX	Counter32
+    MAX-ACCESS	read-only
+    STATUS	current
+    DESCRIPTION	
+	"counts dropped packets (perhaps too long a queue)"
+    ::= { qosObject 13 }
+    
+qosOverlimit OBJECT-TYPE
+    SYNTAX	Counter32
+    MAX-ACCESS	read-only
+    STATUS	current
+    DESCRIPTION	
+	"counts discarded packets - rate exceeded"
+    ::= { qosObject 14 }
+
+qosBps OBJECT-TYPE
+    SYNTAX	Unsigned32
+    MAX-ACCESS	read-only
+    STATUS	current
+    DESCRIPTION	
+	"counts bytes per second"
+    ::= { qosObject 15 }
+
+qosPps OBJECT-TYPE
+    SYNTAX	Unsigned32
+    MAX-ACCESS	read-only
+    STATUS	current
+    DESCRIPTION	
+	"counts packets per second"
+    ::= { qosObject 16 }
+
+qosQlen OBJECT-TYPE
+    SYNTAX	Unsigned32
+    MAX-ACCESS	read-only
+    STATUS	current
+    DESCRIPTION	
+	"queue length"
+    ::= { qosObject 17 }
+
+qosBacklog OBJECT-TYPE
+    SYNTAX	Unsigned32
+    MAX-ACCESS	read-only
+    STATUS	current
+    DESCRIPTION	
+	"backlog"
+    ::= { qosObject 18 }
+
+qosRedEarly OBJECT-TYPE
+    SYNTAX	Counter32
+    MAX-ACCESS	read-only
+    STATUS	current
+    DESCRIPTION	
+	"early red packets"
+    ::= { qosObject 19 }
+
+qosRedpdrop OBJECT-TYPE
+    SYNTAX	Counter32
+    MAX-ACCESS	read-only
+    STATUS	current
+    DESCRIPTION	
+	"probability dropped packets"
+    ::= { qosObject 20 }
+
+qosRedOther OBJECT-TYPE
+    SYNTAX	Counter32
+    MAX-ACCESS	read-only
+    STATUS	current
+    DESCRIPTION	
+	"other packets"
+    ::= { qosObject 21 }
+
+qosRedMarked OBJECT-TYPE
+    SYNTAX	Counter32
+    MAX-ACCESS	read-only
+    STATUS	current
+    DESCRIPTION	
+	"counts discarded packets - rate exceeded"
+    ::= { qosObject 22 }
+
+qosHtbLends OBJECT-TYPE
+    SYNTAX	Counter32
+    MAX-ACCESS	read-only
+    STATUS	current
+    DESCRIPTION	
+	"HTB lended bytes"
+    ::= { qosObject 23 }
+
+qosHtbBorrows OBJECT-TYPE
+    SYNTAX	Counter32
+    MAX-ACCESS	read-only
+    STATUS	current
+    DESCRIPTION	
+	"HTB borrowed packets"
+    ::= { qosObject 24 }
+
+qosHtbGiants OBJECT-TYPE
+    SYNTAX	Counter32
+    MAX-ACCESS	read-only
+    STATUS	current
+    DESCRIPTION	
+	"HTB giants packets"
+    ::= { qosObject 25 }
+
+qosHtbTokens OBJECT-TYPE
+    SYNTAX	INTEGER
+    MAX-ACCESS	read-only
+    STATUS	current
+    DESCRIPTION	
+	"HTB tokens in reservoir"
+    ::= { qosObject 26 }
+
+qosHtbCTokens OBJECT-TYPE
+    SYNTAX 	INTEGER
+    MAX-ACCESS	read-only
+    STATUS	current
+    DESCRIPTION	
+	"HTB ceil tokens in reservoir"
+    ::= { qosObject 27 }
+
+qosHtbRate OBJECT-TYPE
+    SYNTAX	Unsigned32
+    MAX-ACCESS	read-only
+    STATUS	current
+    DESCRIPTION	
+	"HTB class rate"
+    ::= { qosObject 28 }
+
+qosHtbCeil OBJECT-TYPE
+    SYNTAX	Unsigned32
+    MAX-ACCESS	read-only
+    STATUS	current
+    DESCRIPTION	
+	"HTB ceil rate"
+    ::= { qosObject 29 }
+
+qosHtbPrio OBJECT-TYPE
+    SYNTAX	Unsigned32
+    MAX-ACCESS	read-only
+    STATUS	current
+    DESCRIPTION	
+	"HTB class prio"
+    ::= { qosObject 30 }
+
+qosCbqBorrows OBJECT-TYPE
+    SYNTAX	Counter32
+    MAX-ACCESS	read-only
+    STATUS	current
+    DESCRIPTION	
+	"CBQ borrowed bytes"
+    ::= { qosObject 31 }
+
+qosCbqOveractions OBJECT-TYPE
+    SYNTAX	Counter32
+    MAX-ACCESS	read-only
+    STATUS	current
+    DESCRIPTION	
+	"CBQ Overactions"
+    ::= { qosObject 32 }
+
+qosCbqAvgidle OBJECT-TYPE
+    SYNTAX	INTEGER
+    MAX-ACCESS	read-only
+    STATUS	current
+    DESCRIPTION	
+	"CBQ avgidle"
+    ::= { qosObject 33 }
+
+qosCbqUndertime OBJECT-TYPE
+    SYNTAX	INTEGER
+    MAX-ACCESS	read-only
+    STATUS	current
+    DESCRIPTION	
+	"CBQ undertime"
+    ::= { qosObject 34 }
+
+qosInfo OBJECT-TYPE 
+    SYNTAX	DisplayString
+    MAX-ACCESS	read-only
+    STATUS	current
+    DESCRIPTION	
+	"literal parameters - for better orientation"
+    ::= { qosObject 35 }
+
+
+
+
+END
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/README tomato121/release/src/router/snmp/agent/mibgroup/README
--- tomato/release/src/router/snmp/agent/mibgroup/README	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/README	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,113 @@
+This directory holds the implementation of individual MIB groups.
+Currently, this contains the eight MIB-2 groups, plus a basic template
+for new MIB groups (examples/example.c and examples/example.h)
+
+Additionally, you may wish to check out the 'mib2c' perl script in the 
+SRCDIR/local directory that can convert a written mib into C template
+files for use with this package as mib modules.
+
+Each group consists of two files:
+
+  examples/example.h:	interface information
+
+	- declaration of the initialisation function 'init_example'
+		(optional)
+	- declaration of the function(s) for retrieving variable
+		information 'var_example'
+	- declaration of the function(s) for setting variable
+		information (if appropriate)
+
+	- declaration of the function(s) for parsing the snmpd.conf file
+		(optional)
+        - a call to config_parse_dot_conf() to explain to the .conf
+		parser which tokens we want to parse.
+		(optional)
+
+	- definitions of the MIB group 'magic numbers'
+		declarations of the 'public' functions
+
+	- a list of the variables in the group, including
+		type information, mapping between magic numbers
+		and OID sub-identifiers within the group,
+		accessibility information, and the relevant
+		function for retrieving this variable's value.
+                They *must* be listed in the mib-descending order.
+	- a call to 'config_load_mib', identifying the location of
+		this MIB group within the general MIB structure.
+	- a call to 'config_require' to identify any other files
+		that are required by the implementation of this group.
+		(optional)
+
+    (these last three are only visible within the 'glue' file 'snmp_vars.c'
+	(if at all), but are declared here for ease of maintainance)
+
+
+
+  examples/example.c:	implementation code
+		(can be non-existant if only the .h file is needed)
+
+	- a list of kernel information needed to report
+		on this group
+	- an initialisation function (optional)
+        - a routine to parse an snmpd.conf line.
+        - a routine to free resources from above and return to 
+                default settings.
+	- 'header' function(s) to map the OID requested
+		to the next appropriate OID
+		(and similar system-independent setup)
+	- function(s) (possibly system-specific) to
+		determine and return the value of the
+		variable requested.
+	- (optionally) functions used to set values
+	- other functions used internally
+
+
+To implement a new MIB group, copy the two files 'example.c'
+and 'example.h' to appropriate new files ({MODULENAME}.c and {MODULENAME}.h),
+and edit them as follows:
+
+	example.h:
+		globally change "example" to the new module name
+		    and update the initial comment.
+		replace the EXAMPLE* defines with the list of
+		    variables within this new group
+		fill in the 'MODULENAME_variables' structure with these
+		    new variables, updating the type, accessibility
+		    and sub-identifier information as appropriate.
+		replace 'variableN' with the maximum size of the
+		    returned OID (omitting the group prefix).
+		    For non-table values, this will probably be one
+		    greater than the length of the sub-identifier.
+                update or remove the 'config_parse_dot_conf' call if
+                    you need to handle lines in the snmpd.conf files.
+		update the 'config_load_mib' call with the appropriate
+		    location within the global MIB structure, and
+		    its length (note that 'MIB' has length 6)
+		provide a suitable 'config_require' call if this
+		    code uses routines from any other files within
+		    the 'mibgroup' directory (such as 'util_funcs.c')
+
+
+
+	example.c:
+		globally change "example" to the new module name
+		    and update the initial comment.
+		replace the 'MODULENAME_nl' name list with any necessary
+		    kernel variables, and update the associated #define's
+		replace the name length definition within the 'header'
+		    function with the length of the requesting OID
+		    (i.e. the sum of the lengths given in the subtree
+		     definition, and the variable structure above).
+		replace the basic 'switch' structure within the
+		    'var_MODULENAME' function with the necessary code
+		    to calculate the required information.
+		(plus any other internal functions as needed).
+
+  It will then be necessary to (re-)run the configure script with the
+option
+	--with-mib-modules="MODULENAME"
+
+(where MODULENAME matches the name of the .c/.h file pair exactly).
+Note that if anything in the config_* macros changes, or the init function
+is added or removed, then the configure script will need to be re-run.
+
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/README-avc802dot11 tomato121/release/src/router/snmp/agent/mibgroup/README-avc802dot11
--- tomato/release/src/router/snmp/agent/mibgroup/README-avc802dot11	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/README-avc802dot11	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,61 @@
+AvantCom Private 802.11 MIB for MadWiFi and HostAP Drivers using NetSNMP
+
+The AvantCom Private 802.11 MIB for NetSNMP 5.0.8 found here uses Wireless Extension information 
+and driver specific /proc files to populate the AvantCom private 802.11 MIB. See 
+http://www.hpl.hp.com/personal/Jean_Tourrilhes/Linux/Tools.html for more details about 
+Wireless Extensions.
+
+Drivers vary in what funtions and data they do and do not support in terms of Wireless 
+Extensions and driver /proc files, so the AVC 802.11 MIB is populated based on what the 
+particular driver makes available. 
+
+See http://hostap.epitest.fi/ for information on the HostAP driver for the 
+Prism 2/2.5/3 chipsets and http://sourceforge.net/projects/madwifi/ for more 
+information on the MadWiFi driver for the Atheros chipsets.
+
+This release assumes you already have a working build for NetSNMP in place. See 
+http://www.net-snmp.org/ for details about installing NetSNMP on a Linux or other
+Unix oriented OS. To add AvantCom private 802.11 MIB support, unzip the files in this 
+release to the following directory:
+
+.../net-snmp-5.0.8/agent/mibgroup 
+
+Reconfigure NetSNMP by adding the following parameter to the configuration step 
+(from the .../net-snmp-5.0.8 directory):
+
+--with-mib-modules="avc802dot11"
+
+Your configuration command may look a bit different than mine which is:
+
+./configure --with-cflags="-g -O0 -Dlinux" --with-mib-modules="avc802dot11"
+
+Now rebuild NetSNMP using the make clean, make, make install commands.
+
+That's it, assuming you already had a NetSNMP build that was responding to SNMP
+requests.
+
+Keep in mind this is a beta release and only GETs are supported at
+the moment. Please send feedback about problems and/or enhancements 
+to lsimmons@avantcom.com.
+
+Always use the MIB file that comes with the release. This is an experimental
+MIB and objects will move about from time to time. If there is a question
+about compatiblily, compare the DEFVAL section of the avSystem.sysMIBVersion and the
+value returned in the avSystem.sysExpectedMIBVersion to be certain they match.
+
+Support for the standard 802.11 MIB can be found at: 
+http://www.avantcom.com/snmp80211.asp
+
+
+avc802do11-0.0.2 - 09/25/2003
+
+Initial BETA release:
+
+Atheros Chipset - MAC and PHY statistics
+Prism Chipset - Associated clients table with statistics
+
+
+Larry Simmons
+AvantCom Corporation
+www.avantcom.com
+lsimmons@avantcom.com
\ No newline at end of file
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/README-ieee802dot11 tomato121/release/src/router/snmp/agent/mibgroup/README-ieee802dot11
--- tomato/release/src/router/snmp/agent/mibgroup/README-ieee802dot11	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/README-ieee802dot11	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,56 @@
+802.11 MIB Support for NetSNMP
+
+The 802.11 MIB support for NetSNMP 5.0.8 found here uses Wireless Extension information 
+to populate the 802.11 MIB. See 
+http://www.hpl.hp.com/personal/Jean_Tourrilhes/Linux/Tools.html for more details about 
+Wireless Extensions.
+
+Drivers vary in what funtions and data they do and do not support in terms of Wireless 
+Extensions, so the 802.11 MIB is populated based on what the particular driver makes 
+available. Future releases will include special case data that is available in the HostAP and 
+MadWiFi drivers only.
+
+See http://hostap.epitest.fi/ for information on the HostAP driver for the 
+Prism 2/2.5/3 chipsets and http://sourceforge.net/projects/madwifi/ for more 
+information on the MadWiFi driver for the Atheros chipsets.
+
+This release assumes you already have a working build for NetSNMP in place. See 
+http://www.net-snmp.org/ for details about installing NetSNMP on a Linux or other
+Unix oriented OS. To add 802.11 MIB support, unzip the files in this release to 
+the following directory:
+
+.../net-snmp-5.0.8/agent/mibgroup 
+
+Reconfigure NetSNMP by adding the following parameter to the configuration step 
+(from the .../net-snmp-5.0.8 directory):
+
+--with-mib-modules="ieee802dot11"
+
+Your configuration command may look a bit different than mine which is:
+
+./configure --with-cflags="-g -O0 -Dlinux" --with-mib-modules="ieee802dot11"
+
+Now rebuild NetSNMP using the make clean, make, make install commands.
+
+That's it, assuming you already had a NetSNMP build that was responding to SNMP
+requests.
+
+Keep in mind this is a beta release and only GETs are supported at
+the moment. Please send feedback about problems and/or enhancements 
+to lsimmons@avantcom.com.
+
+
+ieee802do11-0.0.2 - 09/24/2003
+
+Wouldn't build after fresh ./configure
+
+
+ieee802do11-0.0.1 - 09/15/2003
+
+Initial BETA release. 
+
+
+Larry Simmons
+AvantCom Corporation
+www.avantcom.com
+lsimmons@avantcom.com
\ No newline at end of file
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/README.smux tomato121/release/src/router/snmp/agent/mibgroup/README.smux
--- tomato/release/src/router/snmp/agent/mibgroup/README.smux	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/README.smux	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,44 @@
+[1] What is SMUX?
+SMUX is the snmp multiplexing protocol (RFC 1227). It can be
+used by an snmp agent to query variables maintained by another
+user-level process (e.g. GateD).
+
+[2] Why is it relevant to ucd-snmp?
+The ucd-snmp agent needed a mechanism to query statistics from
+GateD.  GateD has traditionally supported this functionality via
+SMUX.  Hence SMUX was implemented within the ucd-snmp framework
+to extract routing protocol statistics from GateD.  The agent
+can also communicate with other applications via SMUX.
+
+[3] What is GateD?
+GateD is the 'Gateway Daemon' which implements a variety of routing
+protocols on a variety of platforms (OSes).  There is a public
+version that is available free of charge.  For more information
+see http://www.gated.org.
+
+[4] What routing protocol MIBs does ucd-snmp SMUX support?
+GateD supports up-to-date MIBS for all of the routing
+protocols that it implements (RIP, BGP4, OSPF, etc.).  The
+agent will pass down queries it receives for any other MIB
+registered by a SMUX peer.
+
+[5] Can SMUX extract statistics from other user-level processes?
+Yes, the current implementation allows for the registration of
+any MIB that might be registered by a SMUX peer.
+
+[6] How does it work?
+Assuming 'snmpd' is already up and running, when the SMUX
+peer (e.g. GateD) comes up, it identifies itself with an
+oid identifier and string password, and registers any MIBs
+it would like to implement.  When 'snmpd' receives queries
+for these MIBs, it passes these queries to the peer.
+
+[7] Who implemented SMUX for ucd-snmp?
+SMUX was implemented by Rohit Dube. He had oodles of help from
+ucd-snmp-coders (Dave, Niels, Wes, Simon, Felix, Leonti) and 
+gated-people (Acee, Feiyi, Larry, Sue). [If I missed somebody, sorry in 
+advance and do let me know].  Later, Nick Amato re-write the entire
+SMUX package so the code today is mostly his.
+
+[8] How do I find out more about SMUX?
+Read the RFC, the code and get in touch with ucd-snmp-coders@ece.ucdavis.edu
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/Rmon/agutil_api.h tomato121/release/src/router/snmp/agent/mibgroup/Rmon/agutil_api.h
--- tomato/release/src/router/snmp/agent/mibgroup/Rmon/agutil_api.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/Rmon/agutil_api.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,93 @@
+/**************************************************************
+ * Copyright (C) 2001 Alex Rozin, Optical Access 
+ *
+ *                     All Rights Reserved
+ *
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation for any purpose and without fee is hereby granted,
+ * provided that the above copyright notice appear in all copies and that
+ * both that copyright notice and this permission notice appear in
+ * supporting documentation.
+ * 
+ * ALEX ROZIN DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+ * ALEX ROZIN BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+ * SOFTWARE.
+ ******************************************************************/
+
+#ifndef _agutil_api_h_included__
+#define _agutil_api_h_included__
+
+#include <string.h>
+
+#if 0                           /* for debug */
+#warning MEMORY DEBUG VERSION
+void           *dbg_f_AGMALLOC(size_t size);
+void            dbg_f_AGFREE(void *ptr);
+char           *dbg_f_AGSTRDUP(const char *s);
+void            dbg_f_AG_MEM_REPORT(void);
+#  define AGMALLOC(X)	dbg_f_AGMALLOC(X)
+#  define AGFREE(X)       { dbg_f_AGFREE(X); X = NULL; }
+#  define AGSTRDUP(X)     dbg_f_AGSTRDUP(X)
+#else
+#  define AGMALLOC(X)	malloc(X)
+#  define AGFREE(X)	{ free(X); X = NULL; }
+#  define AGSTRDUP(X)	strdup(X)
+#endif
+
+typedef struct {
+    size_t          length;
+    oid             objid[MAX_OID_LEN];
+} VAR_OID_T;
+
+void            ag_trace(const char *format, ...);
+
+int             AGUTIL_advance_index_name(struct variable *vp, oid * name,
+                                          size_t * length, int exact);
+int             AGUTIL_get_int_value(u_char * var_val, u_char var_val_type,
+                                     size_t var_val_len, long min_value,
+                                     long max_value, long *long_tmp);
+int             AGUTIL_get_string_value(u_char * var_val,
+                                        u_char var_val_type,
+                                        size_t var_val_len,
+                                        size_t buffer_max_size,
+                                        u_char should_zero_limited,
+                                        size_t * buffer_actual_size,
+                                        char *buffer);
+int             AGUTIL_get_oid_value(u_char * var_val, u_char var_val_type,
+                                     size_t var_val_len,
+                                     VAR_OID_T * data_source_ptr);
+
+u_long          AGUTIL_sys_up_time(void);
+
+#if OPTICALL_ACESS
+#define ETH_STATS_T UID_PORT_STATISTICS_T
+#else
+typedef struct {
+    u_int           ifIndex;
+    u_long          octets;
+    u_long          packets;
+    u_long          bcast_pkts;
+    u_long          mcast_pkts;
+    u_long          crc_align;
+    u_long          undersize;
+    u_long          oversize;
+    u_long          fragments;
+    u_long          jabbers;
+    u_long          collisions;
+    u_long          pkts_64;
+    u_long          pkts_65_127;
+    u_long          pkts_128_255;
+    u_long          pkts_256_511;
+    u_long          pkts_512_1023;
+    u_long          pkts_1024_1518;
+} ETH_STATS_T;
+#endif
+
+void            SYSTEM_get_eth_statistics(VAR_OID_T * data_source,
+                                          ETH_STATS_T * where);
+
+#endif                          /* _agutil_api_h_included__ */
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/Rmon/agutil.c tomato121/release/src/router/snmp/agent/mibgroup/Rmon/agutil.c
--- tomato/release/src/router/snmp/agent/mibgroup/Rmon/agutil.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/Rmon/agutil.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,314 @@
+/**************************************************************
+ * Copyright (C) 2001 Alex Rozin, Optical Access 
+ *
+ *                     All Rights Reserved
+ *
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation for any purpose and without fee is hereby granted,
+ * provided that the above copyright notice appear in all copies and that
+ * both that copyright notice and this permission notice appear in
+ * supporting documentation.
+ * 
+ * ALEX ROZIN DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+ * ALEX ROZIN BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+ * SOFTWARE.
+ ******************************************************************/
+
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+#include "util_funcs.h"
+
+#include "agutil.h"
+#include "agutil_api.h"
+
+#ifndef OPTICALL_ACESS          /* in OpticalAccess case : find them in ~agent/mibgroup/nbase directory */
+void
+ag_trace(const char *format, ...)
+{
+#define AG_MAX_MSG_LEN  120
+    char            msg[AG_MAX_MSG_LEN];
+    va_list         args;
+
+    /*
+     * create msg 
+     */
+    va_start(args, format);
+    vsnprintf(msg, AG_MAX_MSG_LEN - 1, format, args);
+
+    snmp_log(LOG_INFO, "%s\n", msg);
+    va_end(args);
+}
+
+int
+AGUTIL_advance_index_name(struct variable *vp, oid * name,
+                          size_t * length, int exact)
+{
+    int             result;
+
+    if (exact)
+        return 0;
+
+    if (*length <= vp->namelen) {
+        result =
+            snmp_oid_compare(name, *length, vp->name, (int) vp->namelen);
+        memcpy((char *) name, (char *) vp->name,
+               ((int) vp->namelen) * sizeof(oid));
+        *length = vp->namelen;
+    } else {
+        /*
+         * If the name is given with indexes - compare only the oids. 
+         */
+        result =
+            snmp_oid_compare(name, (int) vp->namelen, vp->name,
+                             (int) vp->namelen);
+        /*
+         * If it's not the same oid - change name to the new oid 
+         */
+        if (result < 0) {
+            memcpy((char *) name, (char *) vp->name,
+                   ((int) vp->namelen) * sizeof(oid));
+            *length = vp->namelen;
+        }
+    }
+
+    if (result > 0) {
+        ag_trace("*length=%d result=%d !!!", (int) *length, (int) result);
+        return -1;
+    }
+    return 0;
+}
+
+/*********************************************************************
+ * Function: AGUTIL_get_int_value
+ *
+ * Description:
+ *   Check/Get long value from the PDU..
+ *   The parameters 'min_value' & 'max_value' allow to check the diaposon
+ *   of the value. If (max_value <= min_value) we avoid this checking.
+ *
+ * Returns:
+ *   SNMP_ERR_NOERROR
+ *   SNMP_ERR_WRONGTYPE
+ *   SNMP_ERR_WRONGLENGTH
+ *   SNMP_ERR_WRONGENCODING
+ *   SNMP_ERR_BADVALUE
+ *********************************************************************/
+int
+AGUTIL_get_int_value(u_char * var_val, u_char var_val_type,
+                     size_t var_val_len, long min_value, long max_value,
+                     long *long_tmp)
+{
+    if (var_val_type != ASN_INTEGER && var_val_type != ASN_TIMETICKS) {
+        ag_trace("not ASN_INTEGER 0x%lx", (long) var_val_type);
+        return SNMP_ERR_WRONGTYPE;
+    }
+
+    if (var_val_len > sizeof(long)) {
+        ag_trace("wrong len=%d", (int) var_val_len);
+        return SNMP_ERR_WRONGLENGTH;
+    }
+
+    *long_tmp = *((long *) var_val);
+
+    if (max_value > min_value) {
+        if (*long_tmp < min_value) {
+            ag_trace("%ld=long_tmp < min=%ld", (long) *long_tmp,
+                     (long) min_value);
+            return SNMP_ERR_BADVALUE;
+        }
+
+        if (*long_tmp > max_value) {
+            ag_trace("%ld=long_tmp > max=%ld", (long) *long_tmp,
+                     (long) max_value);
+            return SNMP_ERR_BADVALUE;
+        }
+    }
+
+    return SNMP_ERR_NOERROR;
+}
+
+
+/*********************************************************************
+ * Function: AGUTIL_get_string_value
+ *
+ * Description:
+ *   Check/Get 'DisplayString' value from the PDU..
+ *
+ * Returns:
+ *   SNMP_ERR_NOERROR
+ *   SNMP_ERR_WRONGTYPE
+ *   SNMP_ERR_WRONGLENGTH
+ *   SNMP_ERR_WRONGENCODING
+ *   SNMP_ERR_BADVALUE
+ *********************************************************************/
+int
+AGUTIL_get_string_value(u_char * var_val, u_char var_val_type,
+                        size_t var_val_len, size_t buffer_max_size,
+                        u_char should_zero_limited,
+                        size_t * buffer_actual_size, char *buffer)
+{
+    if (var_val_type != ASN_OCTET_STR) {
+        ag_trace("not ASN_OCTET_STR 0x%lx", (long) var_val_type);
+        return SNMP_ERR_WRONGTYPE;
+    }
+
+    if (var_val_len > buffer_max_size) {
+        ag_trace("wrong len=%d > %d", (int) var_val_len, buffer_max_size);
+        return SNMP_ERR_WRONGLENGTH;
+    }
+
+    if (buffer_actual_size)
+        *buffer_actual_size = var_val_len;
+
+    memcpy(buffer, var_val, var_val_len);
+    if (should_zero_limited) {
+        buffer[var_val_len] = 0;
+        if (buffer_actual_size)
+            *buffer_actual_size += 1;
+    }
+
+    return SNMP_ERR_NOERROR;
+}
+
+#endif
+
+int
+AGUTIL_get_oid_value(u_char * var_val, u_char var_val_type,
+                     size_t var_val_len, VAR_OID_T * data_source_ptr)
+{
+    register int    iii;
+    register oid   *oid_var;
+
+    if (var_val_len > MAX_OID_LEN) {
+        ag_trace("wrong len=%d > %d", (int) var_val_len, MAX_OID_LEN);
+        return SNMP_ERR_WRONGLENGTH;
+    }
+
+    var_val_len /= sizeof(oid);
+    data_source_ptr->length = var_val_len;
+    oid_var = (oid *) var_val;
+    for (iii = 0; iii < data_source_ptr->length; iii++)
+        data_source_ptr->objid[iii] = oid_var[iii];
+
+    return SNMP_ERR_NOERROR;
+}
+
+u_long
+AGUTIL_sys_up_time(void)
+{
+    struct timeval  current, delta;
+    extern struct timeval starttime;
+
+    gettimeofday(&current, NULL);
+    current.tv_sec--;
+    current.tv_usec += 1000000L;
+    delta.tv_sec = current.tv_sec - starttime.tv_sec;
+    delta.tv_usec = current.tv_usec - starttime.tv_usec;
+    if (delta.tv_usec > 1000000L) {
+        delta.tv_usec -= 1000000L;
+        delta.tv_sec++;
+    }
+
+    return delta.tv_sec * 100 + delta.tv_usec / 10000;
+}
+
+/*
+ * NOTE: this function is a template for system dependent
+ * implementation. Actually it (in debug purposes) returns
+ * random (but likely) data */
+void
+SYSTEM_get_eth_statistics(VAR_OID_T * data_source, ETH_STATS_T * where)
+{
+#if OPTICALL_ACESS
+    where->ifIndex = data_source->objid[data_source->length - 1];
+    agent_get_Rmon_ethernet_statistics(where->ifIndex, 1,       /* exact */
+                                       where);
+#else                           /* OPTICALL_ACESS */
+    static ETH_STATS_T prev = { -1, -1 };
+    static time_t   ifLastRead = 0;
+    time_t          curr_time;
+    u_char          need_to_read;
+    u_long          rc;
+
+    where->ifIndex = data_source->objid[data_source->length - 1];
+    need_to_read = (where->ifIndex != prev.ifIndex);
+    if (!need_to_read) {
+        curr_time = time(NULL);
+        need_to_read = (curr_time - ifLastRead > 1);
+    }
+
+    if (need_to_read) {
+        rc = (u_long) (1.0 +
+                       ((double) rand() / (double) RAND_MAX) * 100.0);
+        ifLastRead = time(NULL);
+        prev.ifIndex = where->ifIndex;
+    } else
+        rc = 0;
+
+    memcpy(where, &prev, sizeof(ETH_STATS_T));
+    where->octets += rc * 100 * 200;
+    where->packets += rc * 100;
+    where->bcast_pkts += rc * 2;
+    where->mcast_pkts += rc * 3;
+    where->crc_align += rc;
+    where->undersize += 0;
+    where->oversize += 0;
+    where->fragments += rc / 2;
+    where->jabbers += 0;
+    where->collisions += rc / 4;
+
+    where->pkts_64 += rc * 10;
+    where->pkts_65_127 += rc * 50;
+    where->pkts_128_255 += rc * 20;
+    where->pkts_256_511 += rc * 10;
+    where->pkts_512_1023 += rc * 15;
+    where->pkts_1024_1518 += rc * 5;
+
+    need_to_read = prev.ifIndex;
+    memcpy(&prev, where, sizeof(ETH_STATS_T));
+    prev.ifIndex = need_to_read;
+#endif                          /* OPTICALL_ACESS */
+}
+
+#if 0                           /* for memory debug */
+static u_long   dbg_mem_cnt = 0;
+
+void           *
+dbg_f_AGMALLOC(size_t size)
+{
+    dbg_mem_cnt++;
+    return malloc(size);
+}
+
+void
+dbg_f_AGFREE(void *ptr)
+{
+    dbg_mem_cnt--;
+    free(ptr);
+}
+
+char           *
+dbg_f_AGSTRDUP(const char *s)
+{
+    dbg_mem_cnt++;
+    return strdup(s);
+}
+
+void
+dbg_f_AG_MEM_REPORT(void)
+{
+    ag_trace("dbg_mem_cnt=%ld", (long) dbg_mem_cnt);
+}
+
+#endif
+
+void
+init_agutil(void)
+{
+}
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/Rmon/agutil.h tomato121/release/src/router/snmp/agent/mibgroup/Rmon/agutil.h
--- tomato/release/src/router/snmp/agent/mibgroup/Rmon/agutil.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/Rmon/agutil.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,26 @@
+/**************************************************************
+ * Copyright (C) 2001 Alex Rozin, Optical Access 
+ *
+ *                     All Rights Reserved
+ *
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation for any purpose and without fee is hereby granted,
+ * provided that the above copyright notice appear in all copies and that
+ * both that copyright notice and this permission notice appear in
+ * supporting documentation.
+ * 
+ * ALEX ROZIN DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+ * ALEX ROZIN BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+ * SOFTWARE.
+ ******************************************************************/
+
+#ifndef _agutil_h_included__
+#define _agutil_h_included__
+
+void            init_agutil(void);
+
+#endif                          /* _agutil_h_included__ */
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/Rmon/alarm.c tomato121/release/src/router/snmp/agent/mibgroup/Rmon/alarm.c
--- tomato/release/src/router/snmp/agent/mibgroup/Rmon/alarm.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/Rmon/alarm.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,704 @@
+/**************************************************************
+ * Copyright (C) 2001 Alex Rozin, Optical Access
+ * 
+ *                     All Rights Reserved
+ * 
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation for any purpose and without fee is hereby granted,
+ * provided that the above copyright notice appear in all copies and that
+ * both that copyright notice and this permission notice appear in
+ * supporting documentation. 
+ * 
+ * ALEX ROZIN DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+ * ALEX ROZIN BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+ * SOFTWARE. 
+ ******************************************************************/
+
+#include <stdlib.h>
+#include <sys/time.h>
+#include <unistd.h>
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include "util_funcs.h"
+#include "alarm.h"
+    /*
+     * Implementation headers 
+     */
+#include "agutil_api.h"
+#include "row_api.h"
+    /*
+     * File scope definitions section 
+     */
+    /*
+     * from MIB compilation 
+     */
+#define alarmEntryFirstIndexBegin       11
+#define MMM_MAX				0xFFFFFFFFl
+#define IDalarmIndex                    1
+#define IDalarmInterval                 2
+#define IDalarmVariable                 3
+#define IDalarmSampleType               4
+#define IDalarmValue                    5
+#define IDalarmStartupAlarm             6
+#define IDalarmRisingThreshold          7
+#define IDalarmFallingThreshold         8
+#define IDalarmRisingEventIndex         9
+#define IDalarmFallingEventIndex        10
+#define IDalarmOwner                    11
+#define IDalarmStatus                   12
+#define MIN_alarmEventIndex             0
+#define MAX_alarmEventIndex             65535
+     typedef enum {
+         SAMPLE_TYPE_ABSOLUTE =
+             1,
+         SAMPLE_TYPE_DELTE
+     } SAMPLE_TYPE_T;
+
+     typedef enum {
+         ALARM_NOTHING =
+             0,
+         ALARM_RISING,
+         ALARM_FALLING,
+         ALARM_BOTH
+     } ALARM_TYPE_T;
+
+     typedef struct {
+         u_long
+             interval;
+         u_long
+             timer_id;
+         VAR_OID_T
+             var_name;
+         SAMPLE_TYPE_T
+             sample_type;
+         ALARM_TYPE_T
+             startup_type;      /* RISING | FALLING | BOTH */
+
+         u_long
+             rising_threshold;
+         u_long
+             falling_threshold;
+         u_long
+             rising_event_index;
+         u_long
+             falling_event_index;
+
+         u_long
+             last_abs_value;
+         u_long
+             value;
+         ALARM_TYPE_T
+             prev_alarm;        /* NOTHING | RISING | FALLING */
+     } CRTL_ENTRY_T;
+
+/*
+ * Main section 
+ */
+
+     static TABLE_DEFINTION_T
+         AlarmCtrlTable;
+     static TABLE_DEFINTION_T *
+         table_ptr = &
+         AlarmCtrlTable;
+
+#if 0                           /* KUKU */
+     static u_long
+         kuku_sum =
+         0,
+         kuku_cnt =
+         0;
+#endif
+
+/*
+ * find & enjoy it in event.c 
+ */
+     extern int
+     event_api_send_alarm(u_char is_rising,
+                          u_long alarm_index,
+                          u_long event_index,
+                          oid * alarmed_var,
+                          size_t alarmed_var_length,
+                          u_long sample_type,
+                          u_long value,
+                          u_long the_threshold, char *alarm_descr);
+
+     static int
+     fetch_var_val(oid * name, size_t namelen, u_long * new_value)
+{
+    netsnmp_subtree *tree_ptr;
+    size_t          var_len;
+    WriteMethod    *write_method;
+    struct variable called_var;
+    register struct variable *s_var_ptr;
+    register int    iii;
+    register u_char *access;
+
+
+    tree_ptr = netsnmp_subtree_find(name, namelen, NULL, "");
+    if (!tree_ptr) {
+        return SNMP_ERR_NOSUCHNAME;
+    }
+
+    memcpy(called_var.name, tree_ptr->name_a,
+           tree_ptr->namelen * sizeof(oid));
+    s_var_ptr = tree_ptr->variables;
+    for (iii = 0; iii < tree_ptr->variables_len; iii++) {
+        if (s_var_ptr->namelen) {
+            if (0 >= snmp_oidtree_compare(name + tree_ptr->namelen,
+                                          namelen - tree_ptr->namelen,
+                                          s_var_ptr->name,
+                                          s_var_ptr->namelen)) {
+                memcpy(called_var.name + tree_ptr->namelen,
+                       s_var_ptr->name, s_var_ptr->namelen * sizeof(oid));
+                called_var.namelen =
+                    tree_ptr->namelen + s_var_ptr->namelen;
+                called_var.type = s_var_ptr->type;
+                called_var.magic = s_var_ptr->magic;
+                called_var.acl = s_var_ptr->acl;
+                called_var.findVar = s_var_ptr->findVar;
+
+                access =
+                    (*(s_var_ptr->findVar)) (&called_var, name, &namelen,
+                                             1, &var_len, &write_method);
+                if (access
+                    && snmp_oid_compare(name, namelen, tree_ptr->end_a,
+                                        tree_ptr->end_len) > 0) {
+                    memcpy(name, tree_ptr->end_a, tree_ptr->end_len);
+                    access = 0;
+                    ag_trace("access := 0");
+                }
+
+                if (access) {
+
+                    /*
+                     * check 'var_len' ? 
+                     */
+
+                    /*
+                     * check type 
+                     */
+                    switch (called_var.type) {
+                    case ASN_INTEGER:
+                    case ASN_COUNTER:
+                    case ASN_TIMETICKS:
+                    case ASN_GAUGE:
+                    case ASN_COUNTER64:
+                        break;
+                    default:
+                        ag_trace("invalid type: %d",
+                                 (int) called_var.type);
+                        return SNMP_ERR_GENERR;
+                    }
+                    *new_value = *(u_long *) access;
+                    return SNMP_ERR_NOERROR;
+                }
+            }
+        }
+
+        s_var_ptr =
+            (struct variable *) ((char *) s_var_ptr +
+                                 tree_ptr->variables_width);
+    }
+
+    return SNMP_ERR_NOSUCHNAME;
+}
+
+static void
+alarm_check_var(unsigned int clientreg, void *clientarg)
+{
+    RMON_ENTRY_T   *hdr_ptr;
+    CRTL_ENTRY_T   *body;
+    u_long          new_value;
+    int             ierr;
+
+    hdr_ptr = (RMON_ENTRY_T *) clientarg;
+    if (!hdr_ptr) {
+        ag_trace
+            ("Err: history_get_backet: hdr_ptr=NULL ? (Inserted in shock)");
+        return;
+    }
+
+    body = (CRTL_ENTRY_T *) hdr_ptr->body;
+    if (!body) {
+        ag_trace
+            ("Err: history_get_backet: body=NULL ? (Inserted in shock)");
+        return;
+    }
+
+    if (RMON1_ENTRY_VALID != hdr_ptr->status) {
+        ag_trace("Err: history_get_backet when entry %d is not valid ?!!",
+                 (int) hdr_ptr->ctrl_index);
+        snmp_alarm_unregister(body->timer_id);
+        return;
+    }
+
+    ierr = fetch_var_val(body->var_name.objid,
+                         body->var_name.length, &new_value);
+    if (SNMP_ERR_NOERROR != ierr) {
+        ag_trace("Err: Can't fetch var_name");
+        return;
+    }
+
+    body->value = (SAMPLE_TYPE_ABSOLUTE == body->sample_type) ?
+        new_value : new_value - body->last_abs_value;
+    body->last_abs_value = new_value;
+    /*
+     * ag_trace ("fetched value=%ld check %ld", (long) new_value, (long) body->value); 
+     */
+#if 0                           /* KUKU */
+    kuku_sum += body->value;
+    kuku_cnt++;
+#endif
+
+    if (ALARM_RISING != body->prev_alarm &&
+        body->value >= body->rising_threshold &&
+        SNMP_ERR_NOERROR == event_api_send_alarm(1, hdr_ptr->ctrl_index,
+                                                 body->rising_event_index,
+                                                 body->var_name.objid,
+                                                 body->var_name.length,
+                                                 ALARM_RISING, body->value,
+                                                 body->rising_threshold,
+                                                 "Rising"))
+        body->prev_alarm = ALARM_RISING;
+    else if (ALARM_FALLING != body->prev_alarm &&
+             body->value <= body->falling_threshold &&
+             SNMP_ERR_NOERROR == event_api_send_alarm(0,
+                                                      hdr_ptr->ctrl_index,
+                                                      body->
+                                                      falling_event_index,
+                                                      body->var_name.objid,
+                                                      body->var_name.
+                                                      length, ALARM_RISING,
+                                                      body->value,
+                                                      body->
+                                                      falling_threshold,
+                                                      "Falling"))
+        body->prev_alarm = ALARM_FALLING;
+}
+
+/*
+ * Control Table RowApi Callbacks 
+ */
+
+int
+alarm_Create(RMON_ENTRY_T * eptr)
+{                               /* create the body: alloc it and set defaults */
+    CRTL_ENTRY_T   *body;
+    static VAR_OID_T DEFAULT_VAR = { 12,        /* etherStatsPkts.1 */
+        {1, 3, 6, 1, 2, 1, 16, 1, 1, 1, 5, 1}
+    };
+
+
+    eptr->body = AGMALLOC(sizeof(CRTL_ENTRY_T));
+    if (!eptr->body)
+        return -3;
+    body = (CRTL_ENTRY_T *) eptr->body;
+
+    /*
+     * set defaults 
+     */
+    body->interval = 1;
+    memcpy(&body->var_name, &DEFAULT_VAR, sizeof(VAR_OID_T));
+    body->sample_type = SAMPLE_TYPE_ABSOLUTE;
+    body->startup_type = ALARM_BOTH;
+    body->rising_threshold = MMM_MAX;
+    body->falling_threshold = 0;
+    body->rising_event_index = body->falling_event_index = 0;
+
+    body->prev_alarm = ALARM_NOTHING;
+
+    return 0;
+}
+
+int
+alarm_Validate(RMON_ENTRY_T * eptr)
+{
+    CRTL_ENTRY_T   *body = (CRTL_ENTRY_T *) eptr->body;
+
+    if (body->rising_threshold <= body->falling_threshold) {
+        ag_trace("alarm_Validate failed: %lu must be > %lu",
+                 body->rising_threshold, body->falling_threshold);
+        return SNMP_ERR_BADVALUE;
+    }
+
+    return 0;
+}
+
+int
+alarm_Activate(RMON_ENTRY_T * eptr)
+{
+    CRTL_ENTRY_T   *body = (CRTL_ENTRY_T *) eptr->body;
+    int             ierr;
+
+#if 0                           /* KUKU */
+    kuku_sum = 0;
+    kuku_cnt = 0;
+#endif
+    ierr = fetch_var_val(body->var_name.objid,
+                         body->var_name.length, &body->last_abs_value);
+    if (SNMP_ERR_NOERROR != ierr) {
+        ag_trace("Can't fetch var_name");
+        return ierr;
+    }
+
+    if (SAMPLE_TYPE_ABSOLUTE != body->sample_type) {
+        /*
+         * check startup alarm 
+         */
+        if (ALARM_RISING == body->startup_type ||
+            ALARM_BOTH == body->startup_type) {
+            if (body->last_abs_value >= body->rising_threshold) {
+                event_api_send_alarm(1, eptr->ctrl_index,
+                                     body->rising_event_index,
+                                     body->var_name.objid,
+                                     body->var_name.length,
+                                     ALARM_RISING, body->value,
+                                     body->rising_threshold,
+                                     "Startup Rising");
+            }
+        }
+
+        if (ALARM_FALLING == body->startup_type ||
+            ALARM_BOTH == body->startup_type) {
+            if (body->last_abs_value <= body->falling_threshold) {
+                event_api_send_alarm(0, eptr->ctrl_index,
+                                     body->falling_event_index,
+                                     body->var_name.objid,
+                                     body->var_name.length,
+                                     ALARM_RISING, body->value,
+                                     body->falling_threshold,
+                                     "Startup Falling");
+            }
+        }
+
+    }
+
+    body->timer_id = snmp_alarm_register(body->interval, SA_REPEAT,
+                                         alarm_check_var, eptr);
+    return 0;
+}
+
+int
+alarm_Deactivate(RMON_ENTRY_T * eptr)
+{
+    CRTL_ENTRY_T   *body = (CRTL_ENTRY_T *) eptr->body;
+
+    snmp_alarm_unregister(body->timer_id);
+#if 0                           /* KUKU */
+    ag_trace("kuku_sum=%ld kuku_cnt=%ld sp=%ld",
+             (long) kuku_sum, (long) kuku_cnt,
+             (long) (kuku_sum / kuku_cnt));
+#endif
+    return 0;
+}
+
+int
+alarm_Copy(RMON_ENTRY_T * eptr)
+{
+    CRTL_ENTRY_T   *body = (CRTL_ENTRY_T *) eptr->body;
+    CRTL_ENTRY_T   *clone = (CRTL_ENTRY_T *) eptr->tmp;
+
+    if (RMON1_ENTRY_VALID == eptr->status &&
+        clone->rising_threshold <= clone->falling_threshold) {
+        ag_trace("alarm_Copy failed: invalid thresholds");
+        return SNMP_ERR_BADVALUE;
+    }
+
+    if (clone->interval != body->interval) {
+        if (RMON1_ENTRY_VALID == eptr->status) {
+            snmp_alarm_unregister(body->timer_id);
+            body->timer_id =
+                snmp_alarm_register(clone->interval, SA_REPEAT,
+                                    alarm_check_var, eptr);
+        }
+        body->interval = clone->interval;
+    }
+
+    if (snmp_oid_compare(clone->var_name.objid, clone->var_name.length,
+                         body->var_name.objid, body->var_name.length)) {
+        memcpy(&body->var_name, &clone->var_name, sizeof(VAR_OID_T));
+    }
+
+    body->sample_type = clone->sample_type;
+    body->startup_type = clone->startup_type;
+    body->sample_type = clone->sample_type;
+    body->rising_threshold = clone->rising_threshold;
+    body->falling_threshold = clone->falling_threshold;
+    body->rising_event_index = clone->rising_event_index;
+    body->falling_event_index = clone->falling_event_index;
+    /*
+     * ag_trace ("alarm_Copy: rising_threshold=%lu falling_threshold=%lu",
+     * body->rising_threshold, body->falling_threshold); 
+     */
+    return 0;
+}
+
+static int
+write_alarmEntry(int action, u_char * var_val, u_char var_val_type,
+                 size_t var_val_len, u_char * statP,
+                 oid * name, size_t name_len)
+{
+    long            long_tmp;
+    int             leaf_id, snmp_status;
+    static int      prev_action = COMMIT;
+    RMON_ENTRY_T   *hdr;
+    CRTL_ENTRY_T   *cloned_body;
+    CRTL_ENTRY_T   *body;
+
+    switch (action) {
+    case RESERVE1:
+    case FREE:
+    case UNDO:
+    case ACTION:
+    case COMMIT:
+    default:
+        return ROWAPI_do_another_action(name, alarmEntryFirstIndexBegin,
+                                        action, &prev_action,
+                                        table_ptr, sizeof(CRTL_ENTRY_T));
+    case RESERVE2:
+        /*
+         * get values from PDU, check them and save them in the cloned entry 
+         */
+        long_tmp = name[alarmEntryFirstIndexBegin];
+        leaf_id = (int) name[alarmEntryFirstIndexBegin - 1];
+        hdr = ROWAPI_find(table_ptr, long_tmp); /* it MUST be OK */
+        cloned_body = (CRTL_ENTRY_T *) hdr->tmp;
+        body = (CRTL_ENTRY_T *) hdr->body;
+        switch (leaf_id) {
+        case IDalarmInterval:
+            snmp_status = AGUTIL_get_int_value(var_val, var_val_type,
+                                               var_val_len,
+                                               0, MMM_MAX, &long_tmp);
+            if (SNMP_ERR_NOERROR != snmp_status) {
+                return snmp_status;
+            }
+            cloned_body->interval = long_tmp;
+            break;
+        case IDalarmVariable:
+            snmp_status = AGUTIL_get_oid_value(var_val, var_val_type,
+                                               var_val_len,
+                                               &cloned_body->var_name);
+            if (SNMP_ERR_NOERROR != snmp_status) {
+                return snmp_status;
+            }
+            if (RMON1_ENTRY_UNDER_CREATION != hdr->status &&
+                snmp_oid_compare(cloned_body->var_name.objid,
+                                 cloned_body->var_name.length,
+                                 body->var_name.objid,
+                                 body->var_name.length))
+                return SNMP_ERR_BADVALUE;
+            break;
+
+            break;
+        case IDalarmSampleType:
+            snmp_status = AGUTIL_get_int_value(var_val, var_val_type,
+                                               var_val_len,
+                                               SAMPLE_TYPE_ABSOLUTE,
+                                               SAMPLE_TYPE_DELTE,
+                                               &long_tmp);
+            if (SNMP_ERR_NOERROR != snmp_status) {
+                return snmp_status;
+            }
+            cloned_body->sample_type = long_tmp;
+            break;
+        case IDalarmStartupAlarm:
+            snmp_status = AGUTIL_get_int_value(var_val, var_val_type,
+                                               var_val_len,
+                                               ALARM_RISING,
+                                               ALARM_BOTH, &long_tmp);
+            if (SNMP_ERR_NOERROR != snmp_status) {
+                return snmp_status;
+            }
+            cloned_body->startup_type = long_tmp;
+            break;
+        case IDalarmRisingThreshold:
+            snmp_status = AGUTIL_get_int_value(var_val, var_val_type,
+                                               var_val_len,
+                                               0, MMM_MAX, &long_tmp);
+            if (SNMP_ERR_NOERROR != snmp_status) {
+                return snmp_status;
+            }
+            cloned_body->rising_threshold = long_tmp;
+            break;
+        case IDalarmFallingThreshold:
+            snmp_status = AGUTIL_get_int_value(var_val, var_val_type,
+                                               var_val_len,
+                                               0, 0xFFFFFFFFl, &long_tmp);
+            if (SNMP_ERR_NOERROR != snmp_status) {
+                return snmp_status;
+            }
+            cloned_body->falling_threshold = long_tmp;
+            break;
+        case IDalarmRisingEventIndex:
+            snmp_status = AGUTIL_get_int_value(var_val, var_val_type, var_val_len, 0,   /* min. value */
+                                               0,       /* max. value */
+                                               &long_tmp);
+            if (SNMP_ERR_NOERROR != snmp_status) {
+                return snmp_status;
+            }
+            cloned_body->rising_event_index = long_tmp;
+            break;
+        case IDalarmFallingEventIndex:
+            snmp_status = AGUTIL_get_int_value(var_val, var_val_type, var_val_len, 0,   /* min. value */
+                                               0,       /* max. value */
+                                               &long_tmp);
+            if (SNMP_ERR_NOERROR != snmp_status) {
+                return snmp_status;
+            }
+            cloned_body->falling_event_index = long_tmp;
+            break;
+        case IDalarmOwner:
+            if (hdr->new_owner)
+                AGFREE(hdr->new_owner);
+            hdr->new_owner = AGMALLOC(MAX_OWNERSTRING);;
+            if (!hdr->new_owner)
+                return SNMP_ERR_TOOBIG;
+            snmp_status = AGUTIL_get_string_value(var_val, var_val_type,
+                                                  var_val_len,
+                                                  MAX_OWNERSTRING,
+                                                  1, NULL, hdr->new_owner);
+            if (SNMP_ERR_NOERROR != snmp_status) {
+                return snmp_status;
+            }
+
+            break;
+        case IDalarmStatus:
+            snmp_status = AGUTIL_get_int_value(var_val, var_val_type,
+                                               var_val_len,
+                                               RMON1_ENTRY_VALID,
+                                               RMON1_ENTRY_INVALID,
+                                               &long_tmp);
+            if (SNMP_ERR_NOERROR != snmp_status) {
+                return snmp_status;
+            }
+            hdr->new_status = long_tmp;
+            break;
+        default:
+            ag_trace("%s:unknown leaf_id=%d\n", table_ptr->name,
+                     (int) leaf_id);
+            return SNMP_ERR_NOSUCHNAME;
+        }                       /* of switch by 'leaf_id' */
+
+        break;
+    }                           /* of switch by actions */
+
+    prev_action = action;
+    return SNMP_ERR_NOERROR;
+}
+
+u_char         *
+var_alarmEntry(struct variable * vp, oid * name, size_t * length,
+               int exact, size_t * var_len, WriteMethod ** write_method)
+{
+    static long     long_return;
+    static CRTL_ENTRY_T theEntry;
+    RMON_ENTRY_T   *hdr;
+
+    *write_method = write_alarmEntry;
+    hdr = ROWAPI_header_ControlEntry(vp, name, length, exact, var_len,
+                                     table_ptr,
+                                     &theEntry, sizeof(CRTL_ENTRY_T));
+    if (!hdr)
+        return NULL;
+
+    *var_len = sizeof(long);    /* default */
+
+    switch (vp->magic) {
+    case IDalarmIndex:
+        long_return = hdr->ctrl_index;
+        return (u_char *) & long_return;
+    case IDalarmInterval:
+        long_return = theEntry.interval;
+        return (u_char *) & long_return;
+    case IDalarmVariable:
+        *var_len = sizeof(oid) * theEntry.var_name.length;
+        return (unsigned char *) theEntry.var_name.objid;
+        return (u_char *) & long_return;
+    case IDalarmSampleType:
+        long_return = theEntry.sample_type;
+        return (u_char *) & long_return;
+    case IDalarmValue:
+        long_return = theEntry.value;
+        return (u_char *) & long_return;
+    case IDalarmStartupAlarm:
+        long_return = theEntry.startup_type;
+        return (u_char *) & long_return;
+    case IDalarmRisingThreshold:
+        long_return = theEntry.rising_threshold;
+        return (u_char *) & long_return;
+    case IDalarmFallingThreshold:
+        long_return = theEntry.falling_threshold;
+        return (u_char *) & long_return;
+    case IDalarmRisingEventIndex:
+        long_return = theEntry.rising_event_index;
+        return (u_char *) & long_return;
+    case IDalarmFallingEventIndex:
+        long_return = theEntry.falling_event_index;
+        return (u_char *) & long_return;
+    case IDalarmOwner:
+        if (hdr->owner) {
+            *var_len = strlen(hdr->owner);
+            return (unsigned char *) hdr->owner;
+        } else {
+            *var_len = 0;
+            return (unsigned char *) "";
+        }
+
+    case IDalarmStatus:
+        long_return = hdr->status;
+        return (u_char *) & long_return;
+    default:
+        ag_trace("%s: unknown vp->magic=%d", table_ptr->name,
+                 (int) vp->magic);
+        ERROR_MSG("");
+    };                          /* of switch by 'vp->magic' */
+
+    return NULL;
+}
+
+/*
+ * Registration & Initializatio section 
+ */
+
+oid             oidalarmVariablesOid[] = { 1, 3, 6, 1, 2, 1, 16, 3 };
+
+struct variable7 oidalarmVariables[] = {
+    {IDalarmIndex, ASN_INTEGER, RONLY, var_alarmEntry, 3, {1, 1, 1}},
+    {IDalarmInterval, ASN_INTEGER, RWRITE, var_alarmEntry, 3, {1, 1, 2}},
+    {IDalarmVariable, ASN_OBJECT_ID, RWRITE, var_alarmEntry, 3, {1, 1, 3}},
+    {IDalarmSampleType, ASN_INTEGER, RWRITE, var_alarmEntry, 3, {1, 1, 4}},
+    {IDalarmValue, ASN_INTEGER, RONLY, var_alarmEntry, 3, {1, 1, 5}},
+    {IDalarmStartupAlarm, ASN_INTEGER, RWRITE, var_alarmEntry, 3,
+     {1, 1, 6}},
+    {IDalarmRisingThreshold, ASN_INTEGER, RWRITE, var_alarmEntry, 3,
+     {1, 1, 7}},
+    {IDalarmFallingThreshold, ASN_INTEGER, RWRITE, var_alarmEntry, 3,
+     {1, 1, 8}},
+    {IDalarmRisingEventIndex, ASN_INTEGER, RWRITE, var_alarmEntry, 3,
+     {1, 1, 9}},
+    {IDalarmFallingEventIndex, ASN_INTEGER, RWRITE, var_alarmEntry, 3,
+     {1, 1, 10}},
+    {IDalarmOwner, ASN_OCTET_STR, RWRITE, var_alarmEntry, 3, {1, 1, 11}},
+    {IDalarmStatus, ASN_INTEGER, RWRITE, var_alarmEntry, 3, {1, 1, 12}}
+};
+
+void
+init_alarm(void)
+{
+    REGISTER_MIB("alarmTable", oidalarmVariables, variable7,
+                 oidalarmVariablesOid);
+
+    ROWAPI_init_table(&AlarmCtrlTable, "Alarm", 0, &alarm_Create, NULL, /* &alarm_Clone, */
+                      NULL,     /* &alarm_Delete, */
+                      &alarm_Validate,
+                      &alarm_Activate, &alarm_Deactivate, &alarm_Copy);
+}
+
+/*
+ * end of file alarm.c 
+ */
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/Rmon/alarm.h tomato121/release/src/router/snmp/agent/mibgroup/Rmon/alarm.h
--- tomato/release/src/router/snmp/agent/mibgroup/Rmon/alarm.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/Rmon/alarm.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,31 @@
+/**************************************************************
+ * Copyright (C) 2001 Alex Rozin, Optical Access
+ *
+ *                     All Rights Reserved
+ *
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation for any purpose and without fee is hereby granted,
+ * provided that the above copyright notice appear in all copies and that
+ * both that copyright notice and this permission notice appear in
+ * supporting documentation.
+ *
+ * ALEX ROZIN DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+ * ALEX ROZIN BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+ * SOFTWARE.
+ ******************************************************************/
+
+#ifndef _MIBGROUP_ALARM_H
+#define _MIBGROUP_ALARM_H
+
+config_require(util_funcs)
+
+    /*
+     * function prototypes 
+     */
+     void            init_alarm(void);
+
+#endif                          /* _MIBGROUP_ALARM_H */
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/Rmon/.cvsignore tomato121/release/src/router/snmp/agent/mibgroup/Rmon/.cvsignore
--- tomato/release/src/router/snmp/agent/mibgroup/Rmon/.cvsignore	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/Rmon/.cvsignore	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,2 @@
+*.lo
+.libs
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/Rmon/event.c tomato121/release/src/router/snmp/agent/mibgroup/Rmon/event.c
--- tomato/release/src/router/snmp/agent/mibgroup/Rmon/event.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/Rmon/event.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,808 @@
+/**************************************************************
+ * Copyright (C) 2001 Alex Rozin, Optical Access
+ *
+ *                     All Rights Reserved
+ *
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation for any purpose and without fee is hereby granted,
+ * provided that the above copyright notice appear in all copies and that
+ * both that copyright notice and this permission notice appear in
+ * supporting documentation.
+ *
+ * ALEX ROZIN DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+ * ALEX ROZIN BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+ * SOFTWARE.
+ ******************************************************************/
+
+#include <stdlib.h>
+#include <sys/time.h>
+#include <unistd.h>
+#include <ctype.h>
+
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+#include "util_funcs.h"
+
+#include "event.h"
+
+/*
+ * Implementation headers 
+ */
+#include "agutil_api.h"
+#include "row_api.h"
+
+/*
+ * File scope definitions section 
+ */
+
+/*
+ * from MIB compilation 
+ */
+#define eventEntryFirstIndexBegin       11
+
+#define EVENTINDEX            3
+#define EVENTDESCRIPTION      4
+#define EVENTTYPE             5
+#define EVENTCOMMUNITY        6
+#define EVENTLASTTIMESENT     7
+#define EVENTOWNER            8
+#define EVENTSTATUS           9
+
+#define Leaf_event_description  2
+#define MIN_event_description   0
+#define MAX_event_description   127
+#define Leaf_event_type         3
+#define Leaf_event_community    4
+#define MIN_event_community     0
+#define MAX_event_community     127
+#define Leaf_event_last_time_sent 5
+#define Leaf_eventOwner        6
+#define Leaf_eventStatus       7
+
+
+#define LOGEVENTINDEX         3
+#define LOGINDEX              4
+#define LOGTIME               5
+#define LOGDESCRIPTION        6
+
+
+/*
+ * defaults & limitations 
+ */
+
+#define MAX_LOG_ENTRIES_PER_CTRL	200
+
+typedef struct data_struct_t {
+    struct data_struct_t *next;
+    u_long          data_index;
+    u_long          log_time;
+    char           *log_description;
+} DATA_ENTRY_T;
+
+typedef enum {
+    EVENT_NONE = 1,
+    EVENT_LOG,
+    EVENT_TRAP,
+    EVENT_LOG_AND_TRAP
+} EVENT_TYPE_T;
+
+typedef struct {
+    char           *event_description;
+    char           *event_community;
+    EVENT_TYPE_T    event_type;
+    u_long          event_last_time_sent;
+
+    SCROLLER_T      scrlr;
+#if 0
+    u_long          event_last_logged_index;
+    u_long          event_number_of_log_entries;
+    DATA_ENTRY_T   *log_list;
+    DATA_ENTRY_T   *last_log_ptr;
+#endif
+} CRTL_ENTRY_T;
+
+/*
+ * Main section 
+ */
+
+static TABLE_DEFINTION_T EventCtrlTable;
+static TABLE_DEFINTION_T *table_ptr = &EventCtrlTable;
+
+/*
+ * Control Table RowApi Callbacks 
+ */
+
+static int
+data_destructor(SCROLLER_T * scrlr, void *free_me)
+{
+    DATA_ENTRY_T   *lptr = free_me;
+
+    if (lptr->log_description)
+        AGFREE(lptr->log_description);
+
+    return 0;
+}
+
+int
+event_Create(RMON_ENTRY_T * eptr)
+{                               /* create the body: alloc it and set defaults */
+    CRTL_ENTRY_T   *body;
+
+    eptr->body = AGMALLOC(sizeof(CRTL_ENTRY_T));
+    if (!eptr->body)
+        return -3;
+    body = (CRTL_ENTRY_T *) eptr->body;
+
+    /*
+     * set defaults 
+     */
+
+    body->event_description = NULL;
+    body->event_community = AGSTRDUP("public");
+    /*
+     * ag_trace ("Dbg: created event_community=<%s>", body->event_community); 
+     */
+    body->event_type = EVENT_NONE;
+    ROWDATAAPI_init(&body->scrlr,
+                    MAX_LOG_ENTRIES_PER_CTRL,
+                    MAX_LOG_ENTRIES_PER_CTRL,
+                    sizeof(DATA_ENTRY_T), &data_destructor);
+
+
+    return 0;
+}
+
+int
+event_Clone(RMON_ENTRY_T * eptr)
+{                               /* copy entry_bod -> clone */
+    CRTL_ENTRY_T   *body = (CRTL_ENTRY_T *) eptr->body;
+    CRTL_ENTRY_T   *clone = (CRTL_ENTRY_T *) eptr->tmp;
+
+    if (body->event_description)
+        clone->event_description = AGSTRDUP(body->event_description);
+
+    if (body->event_community)
+        clone->event_community = AGSTRDUP(body->event_community);
+    return 0;
+}
+
+int
+event_Copy(RMON_ENTRY_T * eptr)
+{
+    CRTL_ENTRY_T   *body = (CRTL_ENTRY_T *) eptr->body;
+    CRTL_ENTRY_T   *clone = (CRTL_ENTRY_T *) eptr->tmp;
+
+    if (body->event_type != clone->event_type) {
+        body->event_type = clone->event_type;
+    }
+
+    if (clone->event_description) {
+        if (body->event_description)
+            AGFREE(body->event_description);
+        body->event_description = AGSTRDUP(clone->event_description);
+    }
+
+    if (clone->event_community) {
+        if (body->event_community)
+            AGFREE(body->event_community);
+        body->event_community = AGSTRDUP(clone->event_community);
+    }
+
+    return 0;
+}
+
+int
+event_Delete(RMON_ENTRY_T * eptr)
+{
+    CRTL_ENTRY_T   *body = (CRTL_ENTRY_T *) eptr;
+
+    if (body->event_description)
+        AGFREE(body->event_description);
+
+    if (body->event_community)
+        AGFREE(body->event_community);
+
+    return 0;
+}
+
+int
+event_Activate(RMON_ENTRY_T * eptr)
+{                               /* init logTable */
+    CRTL_ENTRY_T   *body = (CRTL_ENTRY_T *) eptr->body;
+
+    ROWDATAAPI_set_size(&body->scrlr,
+                        body->scrlr.data_requested,
+                        RMON1_ENTRY_VALID == eptr->status);
+
+    return 0;
+}
+
+int
+event_Deactivate(RMON_ENTRY_T * eptr)
+{                               /* free logTable */
+    CRTL_ENTRY_T   *body = (CRTL_ENTRY_T *) eptr->body;
+
+    /*
+     * free data list 
+     */
+    ROWDATAAPI_descructor(&body->scrlr);
+
+    return 0;
+}
+
+static int
+write_eventControl(int action, u_char * var_val, u_char var_val_type,
+                   size_t var_val_len, u_char * statP,
+                   oid * name, size_t name_len)
+{
+    long            long_temp;
+    char           *char_temp;
+    int             leaf_id, snmp_status;
+    static int      prev_action = COMMIT;
+    RMON_ENTRY_T   *hdr;
+    CRTL_ENTRY_T   *cloned_body;
+    CRTL_ENTRY_T   *body;
+
+    switch (action) {
+    case RESERVE1:
+    case FREE:
+    case UNDO:
+    case ACTION:
+    case COMMIT:
+    default:
+        return ROWAPI_do_another_action(name, eventEntryFirstIndexBegin,
+                                        action, &prev_action,
+                                        table_ptr, sizeof(CRTL_ENTRY_T));
+
+    case RESERVE2:
+        /*
+         * get values from PDU, check them and save them in the cloned entry 
+         */
+        long_temp = name[eventEntryFirstIndexBegin];
+        leaf_id = (int) name[eventEntryFirstIndexBegin - 1];
+        hdr = ROWAPI_find(table_ptr, long_temp);        /* it MUST be OK */
+        cloned_body = (CRTL_ENTRY_T *) hdr->tmp;
+        body = (CRTL_ENTRY_T *) hdr->body;
+        switch (leaf_id) {
+        case Leaf_event_description:
+            char_temp = AGMALLOC(1 + MAX_event_description);
+            if (!char_temp)
+                return SNMP_ERR_TOOBIG;
+            snmp_status = AGUTIL_get_string_value(var_val, var_val_type,
+                                                  var_val_len,
+                                                  MAX_event_description,
+                                                  1, NULL, char_temp);
+            if (SNMP_ERR_NOERROR != snmp_status) {
+                AGFREE(char_temp);
+                return snmp_status;
+            }
+
+            if (cloned_body->event_description)
+                AGFREE(cloned_body->event_description);
+
+            cloned_body->event_description = AGSTRDUP(char_temp);
+            /*
+             * ag_trace ("rx: event_description=<%s>", cloned_body->event_description); 
+             */
+            AGFREE(char_temp);
+
+            break;
+        case Leaf_event_type:
+            snmp_status = AGUTIL_get_int_value(var_val, var_val_type,
+                                               var_val_len,
+                                               EVENT_NONE,
+                                               EVENT_LOG_AND_TRAP,
+                                               &long_temp);
+            if (SNMP_ERR_NOERROR != snmp_status) {
+                return snmp_status;
+            }
+            cloned_body->event_type = long_temp;
+            break;
+        case Leaf_event_community:
+            char_temp = AGMALLOC(1 + MAX_event_community);
+            if (!char_temp)
+                return SNMP_ERR_TOOBIG;
+            snmp_status = AGUTIL_get_string_value(var_val, var_val_type,
+                                                  var_val_len,
+                                                  MAX_event_community,
+                                                  1, NULL, char_temp);
+            if (SNMP_ERR_NOERROR != snmp_status) {
+                AGFREE(char_temp);
+                return snmp_status;
+            }
+
+            if (cloned_body->event_community)
+                AGFREE(cloned_body->event_community);
+
+            cloned_body->event_community = AGSTRDUP(char_temp);
+            AGFREE(char_temp);
+
+            break;
+        case Leaf_eventOwner:
+            if (hdr->new_owner)
+                AGFREE(hdr->new_owner);
+            hdr->new_owner = AGMALLOC(MAX_OWNERSTRING);;
+            if (!hdr->new_owner)
+                return SNMP_ERR_TOOBIG;
+            snmp_status = AGUTIL_get_string_value(var_val, var_val_type,
+                                                  var_val_len,
+                                                  MAX_OWNERSTRING,
+                                                  1, NULL, hdr->new_owner);
+            if (SNMP_ERR_NOERROR != snmp_status) {
+                return snmp_status;
+            }
+
+            break;
+        case Leaf_eventStatus:
+            snmp_status = AGUTIL_get_int_value(var_val, var_val_type,
+                                               var_val_len,
+                                               RMON1_ENTRY_VALID,
+                                               RMON1_ENTRY_INVALID,
+                                               &long_temp);
+            if (SNMP_ERR_NOERROR != snmp_status) {
+                return snmp_status;
+            }
+            hdr->new_status = long_temp;
+            break;
+        default:
+            ag_trace("%s:unknown leaf_id=%d\n", table_ptr->name,
+                     (int) leaf_id);
+            return SNMP_ERR_NOSUCHNAME;
+        }                       /* of switch by 'leaf_id' */
+        break;
+    }                           /* of switch by actions */
+
+    prev_action = action;
+    return SNMP_ERR_NOERROR;
+}
+
+unsigned char  *
+var_eventTable(struct variable *vp,
+               oid * name,
+               size_t * length,
+               int exact, size_t * var_len, WriteMethod ** write_method)
+{
+    static long     long_ret;
+    static CRTL_ENTRY_T theEntry;
+    RMON_ENTRY_T   *hdr;
+
+    *write_method = write_eventControl;
+    hdr = ROWAPI_header_ControlEntry(vp, name, length, exact, var_len,
+                                     table_ptr,
+                                     &theEntry, sizeof(CRTL_ENTRY_T));
+    if (!hdr)
+        return NULL;
+
+    *var_len = sizeof(long);    /* default */
+
+    switch (vp->magic) {
+    case EVENTINDEX:
+        long_ret = hdr->ctrl_index;
+        return (unsigned char *) &long_ret;
+    case EVENTDESCRIPTION:
+        if (theEntry.event_description) {
+            *var_len = strlen(theEntry.event_description);
+            return (unsigned char *) theEntry.event_description;
+        } else {
+            *var_len = 0;
+            return (unsigned char *) "";
+        }
+    case EVENTTYPE:
+        long_ret = theEntry.event_type;
+        return (unsigned char *) &long_ret;
+    case EVENTCOMMUNITY:
+        if (theEntry.event_community) {
+            *var_len = strlen(theEntry.event_community);
+            return (unsigned char *) theEntry.event_community;
+        } else {
+            *var_len = 0;
+            return (unsigned char *) "";
+        }
+    case EVENTLASTTIMESENT:
+        long_ret = theEntry.event_last_time_sent;
+        return (unsigned char *) &long_ret;
+    case EVENTOWNER:
+        if (hdr->owner) {
+            *var_len = strlen(hdr->owner);
+            return (unsigned char *) hdr->owner;
+        } else {
+            *var_len = 0;
+            return (unsigned char *) "";
+        }
+    case EVENTSTATUS:
+        long_ret = hdr->status;
+        return (unsigned char *) &long_ret;
+    default:
+        ag_trace("EventControlTable: unknown vp->magic=%d",
+                 (int) vp->magic);
+        ERROR_MSG("");
+    }
+    return NULL;
+}
+
+static SCROLLER_T *
+event_extract_scroller(void *v_body)
+{
+    CRTL_ENTRY_T   *body = (CRTL_ENTRY_T *) v_body;
+    return &body->scrlr;
+}
+
+unsigned char  *
+var_logTable(struct variable *vp,
+             oid * name,
+             size_t * length,
+             int exact, size_t * var_len, WriteMethod ** write_method)
+{
+    static long     long_ret;
+    static DATA_ENTRY_T theEntry;
+    RMON_ENTRY_T   *hdr;
+    CRTL_ENTRY_T   *ctrl;
+
+    *write_method = NULL;
+    hdr = ROWDATAAPI_header_DataEntry(vp, name, length, exact, var_len,
+                                      table_ptr,
+                                      &event_extract_scroller,
+                                      sizeof(DATA_ENTRY_T), &theEntry);
+    if (!hdr)
+        return NULL;
+
+    ctrl = (CRTL_ENTRY_T *) hdr->body;
+
+    *var_len = sizeof(long);    /* default */
+
+    switch (vp->magic) {
+    case LOGEVENTINDEX:
+        long_ret = hdr->ctrl_index;
+        return (unsigned char *) &long_ret;
+    case LOGINDEX:
+        long_ret = theEntry.data_index;
+        return (unsigned char *) &long_ret;
+    case LOGTIME:
+        long_ret = theEntry.log_time;
+        return (unsigned char *) &long_ret;
+    case LOGDESCRIPTION:
+        if (theEntry.log_description) {
+            *var_len = strlen(theEntry.log_description);
+            return (unsigned char *) theEntry.log_description;
+        } else {
+            *var_len = 0;
+            return (unsigned char *) "";
+        }
+    default:
+        ERROR_MSG("");
+    }
+
+    return NULL;
+}
+
+/*
+ * External API section 
+ */
+
+static char    *
+create_explanaition(CRTL_ENTRY_T * evptr, u_char is_rising,
+                    u_long alarm_index, u_long event_index,
+                    oid * alarmed_var,
+                    size_t alarmed_var_length,
+                    u_long value, u_long the_threshold,
+                    u_long sample_type, char *alarm_descr)
+{
+#define UNEQ_LENGTH	(1 + 11 + 4 + 11 + 1 + 20)
+    char            expl[UNEQ_LENGTH];
+    static char     c_oid[SPRINT_MAX_LEN];
+    size_t          sz;
+    char           *descr;
+    register char  *pch;
+    register char  *tmp;
+
+
+    snprint_objid(c_oid, sizeof(c_oid)-1, alarmed_var, alarmed_var_length);
+    c_oid[sizeof(c_oid)-1] = '\0';
+    for (pch = c_oid;;) {
+        tmp = strchr(pch, '.');
+        if (!tmp)
+            break;
+        if (isdigit(tmp[1]) || '"' == tmp[1])
+            break;
+        pch = tmp + 1;
+    }
+
+    snprintf(expl, UNEQ_LENGTH, "=%ld %s= %ld :%ld, %ld",
+             (unsigned long) value,
+             is_rising ? ">" : "<",
+             (unsigned long) the_threshold,
+             (long) alarm_index, (long) event_index);
+    sz = 3 + strlen(expl) + strlen(pch);
+    if (alarm_descr)
+        sz += strlen(alarm_descr);
+
+    descr = AGMALLOC(sz);
+    if (!descr) {
+        ag_trace("Can't allocate event description");
+        return NULL;
+    }
+
+    if (alarm_descr) {
+        strcpy(descr, alarm_descr);
+        strcat(descr, ":");
+    } else
+        *descr = '\0';
+
+    strcat(descr, pch);
+    strcat(descr, expl);
+    return descr;
+}
+
+extern void     send_enterprise_trap_vars(int, int, oid *, int,
+                                          netsnmp_variable_list *);
+
+static netsnmp_variable_list *
+oa_bind_var(netsnmp_variable_list * prev,
+            void *value, int type, size_t sz_val, oid * oid, size_t sz_oid)
+{
+    netsnmp_variable_list *var;
+
+    var = (netsnmp_variable_list *) malloc(sizeof(netsnmp_variable_list));
+    if (!var) {
+        ag_trace("FATAL: cannot malloc in oa_bind_var\n");
+        exit(-1);               /* Sorry :( */
+    }
+    memset(var, 0, sizeof(netsnmp_variable_list));
+    var->next_variable = prev;
+    snmp_set_var_objid(var, oid, sz_oid);
+    snmp_set_var_value(var, (u_char *) value, sz_val);
+    var->type = type;
+
+    return var;
+}
+
+static void
+event_send_trap(CRTL_ENTRY_T * evptr, u_char is_rising,
+                u_int alarm_index,
+                u_int value, u_int the_threshold,
+                oid * alarmed_var, size_t alarmed_var_length,
+                u_int sample_type)
+{
+    static oid      rmon1_trap_oid[] = { 1, 3, 6, 1, 2, 1, 16, 0, 0 };
+    static oid      alarm_index_oid[] =
+        { 1, 3, 6, 1, 2, 1, 16, 3, 1, 1, 1 };
+    static oid      alarmed_var_oid[] =
+        { 1, 3, 6, 1, 2, 1, 16, 3, 1, 1, 3 };
+    static oid      sample_type_oid[] =
+        { 1, 3, 6, 1, 2, 1, 16, 3, 1, 1, 4 };
+    static oid      value_oid[] = { 1, 3, 6, 1, 2, 1, 16, 3, 1, 1, 5 };
+    static oid      threshold_oid[] = { 1, 3, 6, 1, 2, 1, 16, 3, 1, 1, 7 };     /* rising case */
+    netsnmp_variable_list *top = NULL;
+    register int    iii;
+
+    /*
+     * set the last 'oid' : risingAlarm or fallingAlarm 
+     */
+    if (is_rising) {
+        iii = OID_LENGTH(rmon1_trap_oid);
+        rmon1_trap_oid[iii - 1] = 1;
+        iii = OID_LENGTH(threshold_oid);
+        threshold_oid[iii - 1] = 7;
+    } else {
+        iii = OID_LENGTH(rmon1_trap_oid);
+        rmon1_trap_oid[iii - 1] = 0;
+        iii = OID_LENGTH(threshold_oid);
+        threshold_oid[iii - 1] = 8;
+    }
+
+    /*
+     * build the var list 
+     */
+    top = oa_bind_var(top, &alarm_index, ASN_INTEGER, sizeof(u_int),
+                      alarm_index_oid, OID_LENGTH(alarm_index_oid));
+
+    top =
+        oa_bind_var(top, alarmed_var, ASN_OBJECT_ID,
+                    sizeof(oid) * alarmed_var_length, alarmed_var_oid,
+                    OID_LENGTH(alarmed_var_oid));
+
+    top = oa_bind_var(top, &sample_type, ASN_INTEGER, sizeof(u_int),
+                      sample_type_oid, OID_LENGTH(sample_type_oid));
+
+    top = oa_bind_var(top, &value, ASN_INTEGER, sizeof(u_int),
+                      value_oid, OID_LENGTH(value_oid));
+
+    top = oa_bind_var(top, &the_threshold, ASN_INTEGER, sizeof(u_int),
+                      threshold_oid, OID_LENGTH(threshold_oid));
+
+
+    send_enterprise_trap_vars(SNMP_TRAP_ENTERPRISESPECIFIC, 0,
+                              rmon1_trap_oid,
+                              OID_LENGTH(rmon1_trap_oid), top);
+    ag_trace("rmon trap has been sent");
+    snmp_free_varbind(top);
+
+}
+
+
+static void
+event_save_log(CRTL_ENTRY_T * body, char *event_descr)
+{
+    register DATA_ENTRY_T *lptr;
+
+    lptr = ROWDATAAPI_locate_new_data(&body->scrlr);
+    if (!lptr) {
+        ag_trace("Err: event_save_log:cannot locate ?");
+        return;
+    }
+
+    lptr->log_time = body->event_last_time_sent;
+    lptr->log_description = AGSTRDUP(event_descr);
+    lptr->data_index = ROWDATAAPI_get_total_number(&body->scrlr);
+
+    /*
+     * ag_trace ("log has been saved, data_index=%d", (int) lptr->data_index); 
+     */
+}
+
+int
+event_api_send_alarm(u_char is_rising,
+                     u_long alarm_index,
+                     u_long event_index,
+                     oid * alarmed_var,
+                     size_t alarmed_var_length,
+                     u_long sample_type,
+                     u_long value, u_long the_threshold, char *alarm_descr)
+{
+    RMON_ENTRY_T   *eptr;
+    CRTL_ENTRY_T   *evptr;
+
+    if (!event_index)
+        return SNMP_ERR_NOSUCHNAME;
+
+#if 0
+    ag_trace("event_api_send_alarm(%d,%d,%d,'%s')",
+             (int) is_rising, (int) alarm_index, (int) event_index,
+             alarm_descr);
+#endif
+    eptr = ROWAPI_find(table_ptr, event_index);
+    if (!eptr) {
+        /*
+         * ag_trace ("event cannot find entry %ld", event_index); 
+         */
+        return SNMP_ERR_NOSUCHNAME;
+    }
+
+    evptr = (CRTL_ENTRY_T *) eptr->body;
+    evptr->event_last_time_sent = AGUTIL_sys_up_time();
+
+
+    if (EVENT_TRAP == evptr->event_type
+        || EVENT_LOG_AND_TRAP == evptr->event_type) {
+        event_send_trap(evptr, is_rising, alarm_index, value,
+                        the_threshold, alarmed_var, alarmed_var_length,
+                        sample_type);
+    }
+
+    if (EVENT_LOG == evptr->event_type
+        || EVENT_LOG_AND_TRAP == evptr->event_type) {
+        register char  *explain;
+
+        explain = create_explanaition(evptr, is_rising,
+                                      alarm_index, event_index,
+                                      alarmed_var, alarmed_var_length,
+                                      value, the_threshold,
+                                      sample_type, alarm_descr);
+        /*
+         * if (explain) ag_trace ("Dbg:'%s'", explain); 
+         */
+        event_save_log(evptr, explain);
+        if (explain)
+            AGFREE(explain);
+    }
+
+    return SNMP_ERR_NOERROR;
+}
+
+#if 1                           /* debug, but may be used for init. TBD: may be token snmpd.conf ? */
+int
+add_event_entry(int ctrl_index,
+                char *event_description,
+                EVENT_TYPE_T event_type, char *event_community)
+{
+    register RMON_ENTRY_T *eptr;
+    register CRTL_ENTRY_T *body;
+    int             ierr;
+
+    ierr = ROWAPI_new(table_ptr, ctrl_index);
+    if (ierr) {
+        ag_trace("ROWAPI_new failed with %d", ierr);
+        return ierr;
+    }
+
+    eptr = ROWAPI_find(table_ptr, ctrl_index);
+    if (!eptr) {
+        ag_trace("ROWAPI_find failed");
+        return -4;
+    }
+
+    body = (CRTL_ENTRY_T *) eptr->body;
+
+    /*
+     * set parameters 
+     */
+
+    if (event_description) {
+        if (body->event_description)
+            AGFREE(body->event_description);
+        body->event_description = AGSTRDUP(event_description);
+    }
+
+    if (event_community) {
+        if (body->event_community)
+            AGFREE(body->event_community);
+        body->event_community = AGSTRDUP(event_community);
+    }
+
+    body->event_type = event_type;
+
+    eptr->new_status = RMON1_ENTRY_VALID;
+    ierr = ROWAPI_commit(table_ptr, ctrl_index);
+    if (ierr) {
+        ag_trace("ROWAPI_commit failed with %d", ierr);
+    }
+
+    return ierr;
+}
+#endif
+
+/*
+ * Registration & Initializatio section 
+ */
+
+oid             eventTable_variables_oid[] =
+    { 1, 3, 6, 1, 2, 1, 16, 9, 1 };
+oid             logTable_variables_oid[] = { 1, 3, 6, 1, 2, 1, 16, 9, 2 };
+
+struct variable2 eventTable_variables[] = {
+    /*
+     * magic number        , variable type, ro/rw , callback fn  ,           L, oidsuffix 
+     */
+    {EVENTINDEX, ASN_INTEGER, RONLY, var_eventTable, 2, {1, 1}},
+    {EVENTDESCRIPTION, ASN_OCTET_STR, RWRITE, var_eventTable, 2, {1, 2}},
+    {EVENTTYPE, ASN_INTEGER, RWRITE, var_eventTable, 2, {1, 3}},
+    {EVENTCOMMUNITY, ASN_OCTET_STR, RWRITE, var_eventTable, 2, {1, 4}},
+    {EVENTLASTTIMESENT, ASN_TIMETICKS, RONLY, var_eventTable, 2, {1, 5}},
+    {EVENTOWNER, ASN_OCTET_STR, RWRITE, var_eventTable, 2, {1, 6}},
+    {EVENTSTATUS, ASN_INTEGER, RWRITE, var_eventTable, 2, {1, 7}}
+};
+
+struct variable2 logTable_variables[] = {
+    /*
+     * magic number        , variable type, ro/rw , callback fn  ,           L, oidsuffix 
+     */
+    {LOGEVENTINDEX, ASN_INTEGER, RONLY, var_logTable, 2, {1, 1}},
+    {LOGINDEX, ASN_INTEGER, RONLY, var_logTable, 2, {1, 2}},
+    {LOGTIME, ASN_TIMETICKS, RONLY, var_logTable, 2, {1, 3}},
+    {LOGDESCRIPTION, ASN_OCTET_STR, RONLY, var_logTable, 2, {1, 4}}
+
+};
+
+void
+init_event(void)
+{
+    REGISTER_MIB("eventTable", eventTable_variables, variable2,
+                 eventTable_variables_oid);
+    REGISTER_MIB("logTable", logTable_variables, variable2,
+                 logTable_variables_oid);
+
+    ROWAPI_init_table(&EventCtrlTable, "Event", 0, &event_Create, &event_Clone, &event_Delete, NULL,    /* &event_Validate, */
+                      &event_Activate, &event_Deactivate, &event_Copy);
+#if 0
+    add_event_entry(3, "Alarm", EVENT_LOG_AND_TRAP, NULL);
+    /*
+     * add_event_entry (5, ">=", EVENT_LOG_AND_TRAP, NULL); 
+     */
+#endif
+}
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/Rmon/event.h tomato121/release/src/router/snmp/agent/mibgroup/Rmon/event.h
--- tomato/release/src/router/snmp/agent/mibgroup/Rmon/event.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/Rmon/event.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,31 @@
+/**************************************************************
+ * Copyright (C) 2001 Alex Rozin, Optical Access
+ *
+ *                     All Rights Reserved
+ *
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation for any purpose and without fee is hereby granted,
+ * provided that the above copyright notice appear in all copies and that
+ * both that copyright notice and this permission notice appear in
+ * supporting documentation.
+ *
+ * ALEX ROZIN DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+ * ALEX ROZIN BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+ * SOFTWARE.
+ ******************************************************************/
+
+#ifndef _MIBGROUP_EVENT_H
+#define _MIBGROUP_EVENT_H
+
+config_require(util_funcs)
+
+    /*
+     * function prototypes 
+     */
+     void            init_event(void);
+
+#endif                          /* _MIBGROUP_EVENT_H */
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/Rmon/history.c tomato121/release/src/router/snmp/agent/mibgroup/Rmon/history.c
--- tomato/release/src/router/snmp/agent/mibgroup/Rmon/history.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/Rmon/history.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,711 @@
+/**************************************************************
+ * Copyright (C) 2001 Alex Rozin, Optical Access 
+ *
+ *                     All Rights Reserved
+ *
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation for any purpose and without fee is hereby granted,
+ * provided that the above copyright notice appear in all copies and that
+ * both that copyright notice and this permission notice appear in
+ * supporting documentation.
+ * 
+ * ALEX ROZIN DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+ * ALEX ROZIN BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+ * SOFTWARE.
+ ******************************************************************/
+
+#include <stdlib.h>
+#include <sys/time.h>
+#include <unistd.h>
+
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+#include "util_funcs.h"
+
+#include "history.h"
+
+/*
+ * Implementation headers 
+ */
+#include "agutil_api.h"
+#include "row_api.h"
+
+/*
+ * File scope definitions section 
+ */
+
+#define historyControlEntryFirstIndexBegin      11
+
+#define CTRL_INDEX		3
+#define CTRL_DATASOURCE		4
+#define CTRL_BUCKETSREQUESTED	5
+#define CTRL_BUCKETSGRANTED	6
+#define CTRL_INTERVAL		7
+#define CTRL_OWNER		8
+#define CTRL_STATUS		9
+
+#define DATA_INDEX		3
+#define DATA_SAMPLEINDEX	4
+#define DATA_INTERVALSTART	5
+#define DATA_DROPEVENTS		6
+#define DATA_OCTETS		7
+#define DATA_PKTS		8
+#define DATA_BROADCASTPKTS	9
+#define DATA_MULTICASTPKTS	10
+#define DATA_CRCALIGNERRORS	11
+#define DATA_UNDERSIZEPKTS	12
+#define DATA_OVERSIZEPKTS	13
+#define DATA_FRAGMENTS		14
+#define DATA_JABBERS		15
+#define DATA_COLLISIONS		16
+#define DATA_UTILIZATION	17
+
+/*
+ * defaults & limitations 
+ */
+
+#define MAX_BUCKETS_IN_CRTL_ENTRY	50
+#define HIST_DEF_BUCK_REQ		50
+#define HIST_DEF_INTERVAL		1800
+static VAR_OID_T DEFAULT_DATA_SOURCE = { 11,    /* ifIndex.1 */
+    {1, 3, 6, 1, 2, 1, 2, 2, 1, 1, 1}
+};
+
+typedef struct data_struct_t {
+    struct data_struct_t *next;
+    u_long          data_index;
+    u_long          start_interval;
+    u_long          utilization;
+    ETH_STATS_T     EthData;
+} DATA_ENTRY_T;
+
+typedef struct {
+    u_long          interval;
+    u_long          timer_id;
+    VAR_OID_T       data_source;
+
+    u_long          coeff;
+    DATA_ENTRY_T    previous_bucket;
+    SCROLLER_T      scrlr;
+
+} CRTL_ENTRY_T;
+
+static TABLE_DEFINTION_T HistoryCtrlTable;
+static TABLE_DEFINTION_T *table_ptr = &HistoryCtrlTable;
+
+/*
+ * Main section 
+ */
+
+#  define Leaf_historyControlDataSource                    2
+#  define Leaf_historyControlBucketsRequested              3
+#  define Leaf_historyControlInterval                      5
+#  define Leaf_historyControlOwner                         6
+#  define Leaf_historyControlStatus                        7
+#  define MIN_historyControlBucketsRequested               1
+#  define MAX_historyControlBucketsRequested               65535
+#  define MIN_historyControlInterval                       1
+#  define MAX_historyControlInterval                       3600
+
+static int
+write_historyControl(int action, u_char * var_val, u_char var_val_type,
+                     size_t var_val_len, u_char * statP,
+                     oid * name, size_t name_len)
+{
+    long            long_temp;
+    int             leaf_id, snmp_status;
+    static int      prev_action = COMMIT;
+    RMON_ENTRY_T   *hdr;
+    CRTL_ENTRY_T   *cloned_body;
+    CRTL_ENTRY_T   *body;
+
+    switch (action) {
+    case RESERVE1:
+    case FREE:
+    case UNDO:
+    case ACTION:
+    case COMMIT:
+    default:
+        return ROWAPI_do_another_action(name,
+                                        historyControlEntryFirstIndexBegin,
+                                        action, &prev_action, table_ptr,
+                                        sizeof(CRTL_ENTRY_T));
+    case RESERVE2:
+        /*
+         * get values from PDU, check them and save them in the cloned entry 
+         */
+        long_temp = name[historyControlEntryFirstIndexBegin];
+        leaf_id = (int) name[historyControlEntryFirstIndexBegin - 1];
+        hdr = ROWAPI_find(table_ptr, long_temp);        /* it MUST be OK */
+        cloned_body = (CRTL_ENTRY_T *) hdr->tmp;
+        body = (CRTL_ENTRY_T *) hdr->body;
+        switch (leaf_id) {
+        case Leaf_historyControlDataSource:
+            snmp_status = AGUTIL_get_oid_value(var_val, var_val_type,
+                                               var_val_len,
+                                               &cloned_body->data_source);
+            if (SNMP_ERR_NOERROR != snmp_status) {
+                ag_trace("can't browse historyControlDataSource");
+                return snmp_status;
+            }
+            if (RMON1_ENTRY_UNDER_CREATION != hdr->status &&
+                snmp_oid_compare(cloned_body->data_source.objid,
+                                 cloned_body->data_source.length,
+                                 body->data_source.objid,
+                                 body->data_source.length)) {
+                ag_trace
+                    ("can't change historyControlDataSource - not Creation");
+                return SNMP_ERR_BADVALUE;
+            }
+            break;
+        case Leaf_historyControlBucketsRequested:
+            snmp_status = AGUTIL_get_int_value(var_val, var_val_type,
+                                               var_val_len,
+                                               MIN_historyControlBucketsRequested,
+                                               MAX_historyControlBucketsRequested,
+                                               &cloned_body->scrlr.
+                                               data_requested);
+            if (SNMP_ERR_NOERROR != snmp_status) {
+                return snmp_status;
+            }
+#if 0
+            if (RMON1_ENTRY_UNDER_CREATION != hdr->status &&
+                cloned_body->scrlr.data_requested !=
+                body->scrlr.data_requested)
+                return SNMP_ERR_BADVALUE;
+#endif
+            break;
+        case Leaf_historyControlInterval:
+            snmp_status = AGUTIL_get_int_value(var_val, var_val_type,
+                                               var_val_len,
+                                               MIN_historyControlInterval,
+                                               MAX_historyControlInterval,
+                                               &cloned_body->interval);
+            if (SNMP_ERR_NOERROR != snmp_status) {
+                return snmp_status;
+            }
+#if 0
+            if (RMON1_ENTRY_UNDER_CREATION != hdr->status &&
+                cloned_body->interval != body->interval)
+                return SNMP_ERR_BADVALUE;
+#endif
+            break;
+        case Leaf_historyControlOwner:
+            if (hdr->new_owner)
+                AGFREE(hdr->new_owner);
+            hdr->new_owner = AGMALLOC(MAX_OWNERSTRING);;
+            if (!hdr->new_owner)
+                return SNMP_ERR_TOOBIG;
+            snmp_status = AGUTIL_get_string_value(var_val, var_val_type,
+                                                  var_val_len,
+                                                  MAX_OWNERSTRING,
+                                                  1, NULL, hdr->new_owner);
+            if (SNMP_ERR_NOERROR != snmp_status) {
+                return snmp_status;
+            }
+
+            break;
+        case Leaf_historyControlStatus:
+            snmp_status = AGUTIL_get_int_value(var_val, var_val_type,
+                                               var_val_len,
+                                               RMON1_ENTRY_VALID,
+                                               RMON1_ENTRY_INVALID,
+                                               &long_temp);
+            if (SNMP_ERR_NOERROR != snmp_status) {
+                return snmp_status;
+            }
+            hdr->new_status = long_temp;
+            break;
+        default:
+            ag_trace("%s:unknown leaf_id=%d\n", table_ptr->name,
+                     (int) leaf_id);
+            return SNMP_ERR_NOSUCHNAME;
+        }                       /* of switch by 'leaf_id' */
+        break;
+
+    }                           /* of switch by actions */
+
+    prev_action = action;
+    return SNMP_ERR_NOERROR;
+}
+
+/*
+ * var_historyControlTable():
+ */
+unsigned char  *
+var_historyControlTable(struct variable *vp,
+                        oid * name,
+                        size_t * length,
+                        int exact,
+                        size_t * var_len, WriteMethod ** write_method)
+{
+    static long     long_ret;
+    static CRTL_ENTRY_T theEntry;
+    RMON_ENTRY_T   *hdr;
+
+    *write_method = write_historyControl;
+    hdr = ROWAPI_header_ControlEntry(vp, name, length, exact, var_len,
+                                     table_ptr,
+                                     &theEntry, sizeof(CRTL_ENTRY_T));
+    if (!hdr)
+        return NULL;
+
+    *var_len = sizeof(long);    /* default */
+
+    switch (vp->magic) {
+    case CTRL_INDEX:
+        long_ret = hdr->ctrl_index;
+        return (unsigned char *) &long_ret;
+
+    case CTRL_DATASOURCE:
+        *var_len = sizeof(oid) * theEntry.data_source.length;
+        return (unsigned char *) theEntry.data_source.objid;
+
+    case CTRL_BUCKETSREQUESTED:
+        long_ret = theEntry.scrlr.data_requested;
+        return (unsigned char *) &long_ret;
+
+    case CTRL_BUCKETSGRANTED:
+
+        long_ret = theEntry.scrlr.data_granted;
+        return (unsigned char *) &long_ret;
+
+    case CTRL_INTERVAL:
+        long_ret = theEntry.interval;
+        return (unsigned char *) &long_ret;
+
+    case CTRL_OWNER:
+        if (hdr->owner) {
+            *var_len = strlen(hdr->owner);
+            return (unsigned char *) hdr->owner;
+        } else {
+            *var_len = 0;
+            return (unsigned char *) "";
+        }
+
+    case CTRL_STATUS:
+        long_ret = hdr->status;
+        return (unsigned char *) &long_ret;
+
+    default:
+        ag_trace("HistoryControlTable: unknown vp->magic=%d",
+                 (int) vp->magic);
+        ERROR_MSG("");
+    }
+    return NULL;
+}
+
+/*
+ * history row management control callbacks 
+ */
+
+static void
+compute_delta(ETH_STATS_T * delta,
+              ETH_STATS_T * newval, ETH_STATS_T * prevval)
+{
+#define CNT_DIF(X) delta->X = newval->X - prevval->X
+
+    CNT_DIF(octets);
+    CNT_DIF(packets);
+    CNT_DIF(bcast_pkts);
+    CNT_DIF(mcast_pkts);
+    CNT_DIF(crc_align);
+    CNT_DIF(undersize);
+    CNT_DIF(oversize);
+    CNT_DIF(fragments);
+    CNT_DIF(jabbers);
+    CNT_DIF(collisions);
+}
+
+static void
+history_get_backet(unsigned int clientreg, void *clientarg)
+{
+    RMON_ENTRY_T   *hdr_ptr;
+    CRTL_ENTRY_T   *body;
+    DATA_ENTRY_T   *bptr;
+    ETH_STATS_T     newSample;
+
+    /*
+     * ag_trace ("history_get_backet: timer_id=%d", (int) clientreg); 
+     */
+    hdr_ptr = (RMON_ENTRY_T *) clientarg;
+    if (!hdr_ptr) {
+        ag_trace
+            ("Err: history_get_backet: hdr_ptr=NULL ? (Inserted in shock)");
+        return;
+    }
+
+    body = (CRTL_ENTRY_T *) hdr_ptr->body;
+    if (!body) {
+        ag_trace
+            ("Err: history_get_backet: body=NULL ? (Inserted in shock)");
+        return;
+    }
+
+    if (RMON1_ENTRY_VALID != hdr_ptr->status) {
+        ag_trace("Err: history_get_backet when entry %d is not valid ?!!",
+                 (int) hdr_ptr->ctrl_index);
+        /*
+         * snmp_alarm_print_list (); 
+         */
+        snmp_alarm_unregister(body->timer_id);
+        ag_trace("Err: unregistered %ld", (long) body->timer_id);
+        return;
+    }
+
+    SYSTEM_get_eth_statistics(&body->data_source, &newSample);
+
+    bptr = ROWDATAAPI_locate_new_data(&body->scrlr);
+    if (!bptr) {
+        ag_trace
+            ("Err: history_get_backet for %d: empty bucket's list !??\n",
+             (int) hdr_ptr->ctrl_index);
+        return;
+    }
+
+    bptr->data_index = ROWDATAAPI_get_total_number(&body->scrlr);
+
+    bptr->start_interval = body->previous_bucket.start_interval;
+
+    compute_delta(&bptr->EthData, &newSample,
+                  &body->previous_bucket.EthData);
+
+    bptr->utilization =
+        bptr->EthData.octets * 8 + bptr->EthData.packets * (96 + 64);
+    bptr->utilization /= body->coeff;
+
+    /*
+     * update previous_bucket 
+     */
+    body->previous_bucket.start_interval = AGUTIL_sys_up_time();
+    memcpy(&body->previous_bucket.EthData, &newSample,
+           sizeof(ETH_STATS_T));
+}
+
+/*
+ * Control Table RowApi Callbacks 
+ */
+
+int
+history_Create(RMON_ENTRY_T * eptr)
+{                               /* create the body: alloc it and set defaults */
+    CRTL_ENTRY_T   *body;
+
+    eptr->body = AGMALLOC(sizeof(CRTL_ENTRY_T));
+    if (!eptr->body)
+        return -3;
+    body = (CRTL_ENTRY_T *) eptr->body;
+
+    /*
+     * set defaults 
+     */
+    body->interval = HIST_DEF_INTERVAL;
+    body->timer_id = 0;
+    memcpy(&body->data_source, &DEFAULT_DATA_SOURCE, sizeof(VAR_OID_T));
+
+    ROWDATAAPI_init(&body->scrlr, HIST_DEF_BUCK_REQ,
+                    MAX_BUCKETS_IN_CRTL_ENTRY, sizeof(DATA_ENTRY_T), NULL);
+
+    return 0;
+}
+
+int
+history_Validate(RMON_ENTRY_T * eptr)
+{
+    /*
+     * T.B.D. (system dependent) check valid inteface in body->data_source; 
+     */
+    return 0;
+}
+
+int
+history_Activate(RMON_ENTRY_T * eptr)
+{
+    CRTL_ENTRY_T   *body = (CRTL_ENTRY_T *) eptr->body;
+
+    body->coeff = 100000L * (long) body->interval;
+
+    ROWDATAAPI_set_size(&body->scrlr,
+                        body->scrlr.data_requested,
+                        RMON1_ENTRY_VALID == eptr->status);
+
+    SYSTEM_get_eth_statistics(&body->data_source,
+                              &body->previous_bucket.EthData);
+    body->previous_bucket.start_interval = AGUTIL_sys_up_time();
+
+    body->scrlr.current_data_ptr = body->scrlr.first_data_ptr;
+    /*
+     * ag_trace ("Dbg:   registered in history_Activate"); 
+     */
+    body->timer_id = snmp_alarm_register(body->interval, SA_REPEAT,
+                                         history_get_backet, eptr);
+    return 0;
+}
+
+int
+history_Deactivate(RMON_ENTRY_T * eptr)
+{
+    CRTL_ENTRY_T   *body = (CRTL_ENTRY_T *) eptr->body;
+
+    snmp_alarm_unregister(body->timer_id);
+    /*
+     * ag_trace ("Dbg: unregistered in history_Deactivate timer_id=%d",
+     * (int) body->timer_id); 
+     */
+
+    /*
+     * free data list 
+     */
+    ROWDATAAPI_descructor(&body->scrlr);
+
+    return 0;
+}
+
+int
+history_Copy(RMON_ENTRY_T * eptr)
+{
+    CRTL_ENTRY_T   *body = (CRTL_ENTRY_T *) eptr->body;
+    CRTL_ENTRY_T   *clone = (CRTL_ENTRY_T *) eptr->tmp;
+
+    if (body->scrlr.data_requested != clone->scrlr.data_requested) {
+        ROWDATAAPI_set_size(&body->scrlr, clone->scrlr.data_requested,
+                            RMON1_ENTRY_VALID == eptr->status);
+    }
+
+    if (body->interval != clone->interval) {
+        if (RMON1_ENTRY_VALID == eptr->status) {
+            snmp_alarm_unregister(body->timer_id);
+            body->timer_id =
+                snmp_alarm_register(clone->interval, SA_REPEAT,
+                                    history_get_backet, eptr);
+        }
+
+        body->interval = clone->interval;
+    }
+
+    if (snmp_oid_compare
+        (clone->data_source.objid, clone->data_source.length,
+         body->data_source.objid, body->data_source.length)) {
+        memcpy(&body->data_source, &clone->data_source, sizeof(VAR_OID_T));
+    }
+
+    return 0;
+}
+
+static SCROLLER_T *
+history_extract_scroller(void *v_body)
+{
+    CRTL_ENTRY_T   *body = (CRTL_ENTRY_T *) v_body;
+    return &body->scrlr;
+}
+
+/*
+ * var_etherHistoryTable():
+ */
+unsigned char  *
+var_etherHistoryTable(struct variable *vp,
+                      oid * name,
+                      size_t * length,
+                      int exact,
+                      size_t * var_len, WriteMethod ** write_method)
+{
+    static long     long_ret;
+    static DATA_ENTRY_T theBucket;
+    RMON_ENTRY_T   *hdr;
+    CRTL_ENTRY_T   *ctrl;
+
+    *write_method = NULL;
+    hdr = ROWDATAAPI_header_DataEntry(vp, name, length, exact, var_len,
+                                      table_ptr,
+                                      &history_extract_scroller,
+                                      sizeof(DATA_ENTRY_T), &theBucket);
+    if (!hdr)
+        return NULL;
+
+    *var_len = sizeof(long);    /* default */
+
+    ctrl = (CRTL_ENTRY_T *) hdr->body;
+
+    switch (vp->magic) {
+    case DATA_INDEX:
+        long_ret = hdr->ctrl_index;
+        return (unsigned char *) &long_ret;
+    case DATA_SAMPLEINDEX:
+        long_ret = theBucket.data_index;
+        return (unsigned char *) &long_ret;
+    case DATA_INTERVALSTART:
+        long_ret = 0;
+        return (unsigned char *) &theBucket.start_interval;
+    case DATA_DROPEVENTS:
+        long_ret = 0;
+        return (unsigned char *) &long_ret;
+    case DATA_OCTETS:
+        long_ret = 0;
+        return (unsigned char *) &theBucket.EthData.octets;
+    case DATA_PKTS:
+        long_ret = 0;
+        return (unsigned char *) &theBucket.EthData.packets;
+    case DATA_BROADCASTPKTS:
+        long_ret = 0;
+        return (unsigned char *) &theBucket.EthData.bcast_pkts;
+    case DATA_MULTICASTPKTS:
+        long_ret = 0;
+        return (unsigned char *) &theBucket.EthData.mcast_pkts;
+    case DATA_CRCALIGNERRORS:
+        long_ret = 0;
+        return (unsigned char *) &theBucket.EthData.crc_align;
+    case DATA_UNDERSIZEPKTS:
+        long_ret = 0;
+        return (unsigned char *) &theBucket.EthData.undersize;
+    case DATA_OVERSIZEPKTS:
+        long_ret = 0;
+        return (unsigned char *) &theBucket.EthData.oversize;
+    case DATA_FRAGMENTS:
+        long_ret = 0;
+        return (unsigned char *) &theBucket.EthData.fragments;
+    case DATA_JABBERS:
+        long_ret = 0;
+        return (unsigned char *) &theBucket.EthData.jabbers;
+    case DATA_COLLISIONS:
+        long_ret = 0;
+        return (unsigned char *) &theBucket.EthData.collisions;
+    case DATA_UTILIZATION:
+        long_ret = 0;
+        return (unsigned char *) &theBucket.utilization;
+    default:
+        ag_trace("etherHistoryTable: unknown vp->magic=%d",
+                 (int) vp->magic);
+        ERROR_MSG("");
+    }
+    return NULL;
+}
+
+#if 1                           /* debug, but may be used for init. TBD: may be token snmpd.conf ? */
+int
+add_hist_entry(int ctrl_index, int ifIndex,
+               u_long interval, u_long requested)
+{
+    register RMON_ENTRY_T *eptr;
+    register CRTL_ENTRY_T *body;
+    int             ierr;
+
+    ierr = ROWAPI_new(table_ptr, ctrl_index);
+    if (ierr) {
+        ag_trace("ROWAPI_new failed with %d", ierr);
+        return ierr;
+    }
+
+    eptr = ROWAPI_find(table_ptr, ctrl_index);
+    if (!eptr) {
+        ag_trace("ROWAPI_find failed");
+        return -4;
+    }
+
+    body = (CRTL_ENTRY_T *) eptr->body;
+
+    /*
+     * set parameters 
+     */
+
+    body->data_source.objid[body->data_source.length - 1] = ifIndex;
+    body->interval = interval;
+    body->scrlr.data_requested = requested;
+
+    eptr->new_status = RMON1_ENTRY_VALID;
+    ierr = ROWAPI_commit(table_ptr, ctrl_index);
+    if (ierr) {
+        ag_trace("ROWAPI_commit failed with %d", ierr);
+    }
+
+    return ierr;
+
+}
+
+#endif
+
+/*
+ * Registration & Initializatio section 
+ */
+
+oid             historyControlTable_variables_oid[] =
+    { 1, 3, 6, 1, 2, 1, 16, 2, 1 };
+
+struct variable2 historyControlTable_variables[] = {
+    /*
+     * magic number        , variable type, ro/rw , callback fn  ,           L, oidsuffix 
+     */
+    {CTRL_INDEX, ASN_INTEGER, RONLY, var_historyControlTable, 2, {1, 1}},
+    {CTRL_DATASOURCE, ASN_OBJECT_ID, RWRITE, var_historyControlTable, 2,
+     {1, 2}},
+    {CTRL_BUCKETSREQUESTED, ASN_INTEGER, RWRITE, var_historyControlTable,
+     2, {1, 3}},
+    {CTRL_BUCKETSGRANTED, ASN_INTEGER, RONLY, var_historyControlTable, 2,
+     {1, 4}},
+    {CTRL_INTERVAL, ASN_INTEGER, RWRITE, var_historyControlTable, 2,
+     {1, 5}},
+    {CTRL_OWNER, ASN_OCTET_STR, RWRITE, var_historyControlTable, 2,
+     {1, 6}},
+    {CTRL_STATUS, ASN_INTEGER, RWRITE, var_historyControlTable, 2, {1, 7}},
+
+};
+
+oid             etherHistoryTable_variables_oid[] =
+    { 1, 3, 6, 1, 2, 1, 16, 2, 2 };
+
+struct variable2 etherHistoryTable_variables[] = {
+    /*
+     * magic number     , variable type , ro/rw , callback fn  ,        L, oidsuffix 
+     */
+    {DATA_INDEX, ASN_INTEGER, RONLY, var_etherHistoryTable, 2, {1, 1}},
+    {DATA_SAMPLEINDEX, ASN_INTEGER, RONLY, var_etherHistoryTable, 2,
+     {1, 2}},
+    {DATA_INTERVALSTART, ASN_TIMETICKS, RONLY, var_etherHistoryTable, 2,
+     {1, 3}},
+    {DATA_DROPEVENTS, ASN_COUNTER, RONLY, var_etherHistoryTable, 2,
+     {1, 4}},
+    {DATA_OCTETS, ASN_COUNTER, RONLY, var_etherHistoryTable, 2, {1, 5}},
+    {DATA_PKTS, ASN_COUNTER, RONLY, var_etherHistoryTable, 2, {1, 6}},
+    {DATA_BROADCASTPKTS, ASN_COUNTER, RONLY, var_etherHistoryTable, 2,
+     {1, 7}},
+    {DATA_MULTICASTPKTS, ASN_COUNTER, RONLY, var_etherHistoryTable, 2,
+     {1, 8}},
+    {DATA_CRCALIGNERRORS, ASN_COUNTER, RONLY, var_etherHistoryTable, 2,
+     {1, 9}},
+    {DATA_UNDERSIZEPKTS, ASN_COUNTER, RONLY, var_etherHistoryTable, 2,
+     {1, 10}},
+    {DATA_OVERSIZEPKTS, ASN_COUNTER, RONLY, var_etherHistoryTable, 2,
+     {1, 11}},
+    {DATA_FRAGMENTS, ASN_COUNTER, RONLY, var_etherHistoryTable, 2,
+     {1, 12}},
+    {DATA_JABBERS, ASN_COUNTER, RONLY, var_etherHistoryTable, 2, {1, 13}},
+    {DATA_COLLISIONS, ASN_COUNTER, RONLY, var_etherHistoryTable, 2,
+     {1, 14}},
+    {DATA_UTILIZATION, ASN_INTEGER, RONLY, var_etherHistoryTable, 2,
+     {1, 15}},
+
+};
+
+void
+init_history(void)
+{
+    REGISTER_MIB("historyControlTable", historyControlTable_variables,
+                 variable2, historyControlTable_variables_oid);
+    REGISTER_MIB("etherHistoryTable", etherHistoryTable_variables,
+                 variable2, etherHistoryTable_variables_oid);
+
+    ROWAPI_init_table(&HistoryCtrlTable, "History", 0, &history_Create, NULL,   /* &history_Clone, */
+                      NULL,     /* &history_Delete, */
+                      &history_Validate,
+                      &history_Activate,
+                      &history_Deactivate, &history_Copy);
+
+    /*
+     * add_hist_entry (2, 3, 4, 2); 
+     */
+}
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/Rmon/history.h tomato121/release/src/router/snmp/agent/mibgroup/Rmon/history.h
--- tomato/release/src/router/snmp/agent/mibgroup/Rmon/history.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/Rmon/history.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,31 @@
+/**************************************************************
+ * Copyright (C) 2001 Alex Rozin, Optical Access 
+ *
+ *                     All Rights Reserved
+ *
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation for any purpose and without fee is hereby granted,
+ * provided that the above copyright notice appear in all copies and that
+ * both that copyright notice and this permission notice appear in
+ * supporting documentation.
+ * 
+ * ALEX ROZIN DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+ * ALEX ROZIN BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+ * SOFTWARE.
+ ******************************************************************/
+
+#ifndef _MIBGROUP_HISTORY_H
+#define _MIBGROUP_HISTORY_H
+
+config_require(util_funcs)
+
+    /*
+     * function prototypes 
+     */
+     void            init_history(void);
+
+#endif                          /* _MIBGROUP_HISTORY_H */
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/Rmon/README tomato121/release/src/router/snmp/agent/mibgroup/Rmon/README
--- tomato/release/src/router/snmp/agent/mibgroup/Rmon/README	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/Rmon/README	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,30 @@
+
+Important notes.
+===============
+1. This  implementation  is  actually  a  system  independent
+   template.  It  means  that  the question  "Where  and  how
+   may  I collect the monitored statistics ?"  is  taken  out
+   from the scope. Actually, it is emulated with random values.
+   You are free  to  rewrite  the function 'get_history_data'
+   for your system.  Don't  forget  also to insert DataSourse
+   checking in 'history_Validate'  function.  (Both  functions
+   are in the file history.c).
+
+2. This implementation has two RMON mib understanding extensions
+   (I hope it does not break anything; nevertheless you may  use
+   it in completely standard way).
+
+   2.1. I permit to set VALID entryStatus when entry doesn't exit;
+        in this case PDU has to have  the  necessary & valid  set
+        of non-default values
+
+   2.2. I permit to travel from VALID to 'UNDER_CREATION' state:
+        these ways a manager can change control entry and validate
+        it once more.
+
+
+THANKS
+======
+  Mr. Michael J. Slifcak of Internet Security Systems, Inc has provided
+  a number of remarks, I implemented ALL of them.
+
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/Rmon/row_api.h tomato121/release/src/router/snmp/agent/mibgroup/Rmon/row_api.h
--- tomato/release/src/router/snmp/agent/mibgroup/Rmon/row_api.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/Rmon/row_api.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,187 @@
+/**************************************************************
+ * Copyright (C) 2001 Alex Rozin, Optical Access 
+ *
+ *                     All Rights Reserved
+ *
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation for any purpose and without fee is hereby granted,
+ * provided that the above copyright notice appear in all copies and that
+ * both that copyright notice and this permission notice appear in
+ * supporting documentation.
+ * 
+ * ALEX ROZIN DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+ * ALEX ROZIN BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+ * SOFTWARE.
+ ******************************************************************/
+
+#ifndef _row_api_h_included__
+#define _row_api_h_included__
+
+/*
+ * control tables API section 
+ */
+
+typedef enum {
+    RMON1_ENTRY_VALID = 1,
+    RMON1_ENTRY_CREATE_REQUEST,
+    RMON1_ENTRY_UNDER_CREATION,
+    RMON1_ENTRY_INVALID,
+} RMON1_ENTRY_STATUS_T;
+
+#define MAX_OWNERSTRING		128
+
+/*
+ * structure for entry of all 'control' tables 
+ */
+typedef struct tagEntry {
+    /*
+     * begin of the header 
+     */
+    struct tagEntry *next;
+    void           *table_ptr;  /* do casting to (TABLE_DEFINTION_T*) */
+    RMON1_ENTRY_STATUS_T status;
+    RMON1_ENTRY_STATUS_T new_status;
+    u_long          ctrl_index;
+    u_long          timer_id;
+    char           *owner;
+    char           *new_owner;
+    u_char          only_just_created;
+
+    /*
+     * end of the header 
+     */
+
+    void           *body;
+    void           *tmp;
+} RMON_ENTRY_T;
+
+typedef int     (ENTRY_CALLBACK_T) (RMON_ENTRY_T *);
+
+typedef struct {
+    char           *name;
+    RMON_ENTRY_T   *first;
+    u_long          max_number_of_entries;      /* '<0' means without limit */
+    u_long          current_number_of_entries;
+    ENTRY_CALLBACK_T *ClbkCreate;
+    ENTRY_CALLBACK_T *ClbkClone;
+    ENTRY_CALLBACK_T *ClbkValidate;
+    ENTRY_CALLBACK_T *ClbkActivate;
+    ENTRY_CALLBACK_T *ClbkDeactivate;
+    ENTRY_CALLBACK_T *ClbkDelete;
+    ENTRY_CALLBACK_T *ClbkCopy;
+} TABLE_DEFINTION_T;
+
+/*
+ * Api prototypes 
+ */
+void            ROWAPI_init_table(TABLE_DEFINTION_T * table_ptr,
+                                  char *name,
+                                  u_long max_number_of_entries,
+                                  ENTRY_CALLBACK_T * ClbkCreate,
+                                  ENTRY_CALLBACK_T * ClbkClone,
+                                  ENTRY_CALLBACK_T * ClbkDelete,
+                                  ENTRY_CALLBACK_T * ClbkValidate,
+                                  ENTRY_CALLBACK_T * ClbkActivate,
+                                  ENTRY_CALLBACK_T * ClbkDeactivate,
+                                  ENTRY_CALLBACK_T * ClbkCopy);
+
+int             ROWAPI_new(TABLE_DEFINTION_T * table_ptr,
+                           u_long ctrl_index);
+
+RMON_ENTRY_T   *ROWAPI_get_clone(TABLE_DEFINTION_T * table_ptr,
+                                 u_long ctrl_index, size_t body_size);
+
+void            ROWAPI_delete_clone(TABLE_DEFINTION_T * table_ptr,
+                                    u_long ctrl_index);
+
+RMON_ENTRY_T   *ROWAPI_first(TABLE_DEFINTION_T * table_ptr);
+
+RMON_ENTRY_T   *ROWAPI_next(TABLE_DEFINTION_T * table_ptr,
+                            u_long prev_index);
+
+RMON_ENTRY_T   *ROWAPI_find(TABLE_DEFINTION_T * table_ptr,
+                            u_long ctrl_index);
+
+int             ROWAPI_action_check(TABLE_DEFINTION_T * table_ptr,
+                                    u_long ctrl_index);
+
+int             ROWAPI_commit(TABLE_DEFINTION_T * table_ptr,
+                              u_long ctrl_index);
+
+RMON_ENTRY_T   *ROWAPI_header_ControlEntry(struct variable *vp, oid * name,
+                                           size_t * length, int exact,
+                                           size_t * var_len,
+                                           TABLE_DEFINTION_T * table_ptr,
+                                           void *entry_ptr,
+                                           size_t entry_size);
+
+int             ROWAPI_do_another_action(oid * name,
+                                         int tbl_first_index_begin,
+                                         int action, int *prev_action,
+                                         TABLE_DEFINTION_T * table_ptr,
+                                         size_t entry_size);
+
+/*
+ * data tables API section 
+ */
+
+typedef int     (SCROLLER_ENTRY_DESCRUCTOR_T) (void *);
+
+typedef struct nexted_void_t {
+    struct nexted_void_t *next;
+    u_long          data_index;
+} NEXTED_PTR_T;
+
+typedef struct data_scroller {
+    u_long          max_number_of_entries;
+    u_long          data_requested;
+    u_long          data_granted;
+    u_long          data_created;       /* number of allocated data entries */
+    u_long          data_stored;        /* number of data, currently stored */
+    u_long          data_total_number;  /* number of data entries, stored after validation */
+
+    /*
+     * these 3 pointers make casting to private (DATA_ENTRY_T*) 
+     */
+    void           *first_data_ptr;
+    NEXTED_PTR_T   *last_data_ptr;
+    void           *current_data_ptr;
+
+    size_t          data_size;
+    int             (*data_destructor) (struct data_scroller *, void *);
+} SCROLLER_T;
+
+int             ROWDATAAPI_init(SCROLLER_T * scrlr,
+                                u_long max_number_of_entries,
+                                u_long data_requested,
+                                size_t data_size,
+                                int (*data_destructor) (struct
+                                                        data_scroller *,
+                                                        void *));
+
+void
+                ROWDATAAPI_set_size(SCROLLER_T * scrlr,
+                                    u_long data_requested,
+                                    u_char do_allocation);
+
+void            ROWDATAAPI_descructor(SCROLLER_T * scrlr);
+
+void           *ROWDATAAPI_locate_new_data(SCROLLER_T * scrlr);
+
+u_long          ROWDATAAPI_get_total_number(SCROLLER_T * scrlr);
+
+RMON_ENTRY_T   *ROWDATAAPI_header_DataEntry(struct variable *vp,
+                                            oid * name, size_t * length,
+                                            int exact, size_t * var_len,
+                                            TABLE_DEFINTION_T * table_ptr,
+                                            SCROLLER_T *
+                                            (*extract_scroller) (void
+                                                                 *body),
+                                            size_t data_size,
+                                            void *entry_ptr);
+
+#endif                          /* _row_api_h_included__ */
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/Rmon/rows.c tomato121/release/src/router/snmp/agent/mibgroup/Rmon/rows.c
--- tomato/release/src/router/snmp/agent/mibgroup/Rmon/rows.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/Rmon/rows.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,880 @@
+/**************************************************************
+ * Copyright (C) 2001 Alex Rozin, Optical Access 
+ *
+ *                     All Rights Reserved
+ *
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation for any purpose and without fee is hereby granted,
+ * provided that the above copyright notice appear in all copies and that
+ * both that copyright notice and this permission notice appear in
+ * supporting documentation.
+ * 
+ * ALEX ROZIN DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+ * ALEX ROZIN BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+ * SOFTWARE.
+ ******************************************************************/
+
+#include <stddef.h>
+#include <string.h>
+#include <stdlib.h>
+
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+#include "util_funcs.h"
+
+#include "agutil_api.h"
+#include "rows.h"
+#include "row_api.h"
+
+#define MAX_CREATION_TIME	60
+
+/*
+ * *************************** 
+ */
+/*
+ * static file scope functions 
+ */
+/*
+ * *************************** 
+ */
+
+static void
+rowapi_delete(RMON_ENTRY_T * eold)
+{
+    register RMON_ENTRY_T *eptr;
+    register RMON_ENTRY_T *prev = NULL;
+    TABLE_DEFINTION_T *table_ptr;
+
+    table_ptr = (TABLE_DEFINTION_T *) eold->table_ptr;
+
+    /*
+     * delete timout scheduling 
+     */
+    snmp_alarm_unregister(eold->timer_id);
+    ag_trace("Entry %ld in %s has been deleted",
+             eold->ctrl_index, table_ptr->name);
+
+    /*
+     * It it was valid entry => deactivate it 
+     */
+    if (RMON1_ENTRY_VALID == eold->status) {
+        if (table_ptr->ClbkDeactivate)
+            table_ptr->ClbkDeactivate(eold);
+    }
+
+    /*
+     * delete it in users's sence 
+     */
+    if (table_ptr->ClbkDelete)
+        table_ptr->ClbkDelete((RMON_ENTRY_T *) eold->body);
+
+    if (eold->body) {
+        AGFREE(eold->body);
+    }
+
+    if (eold->owner)
+        AGFREE(eold->owner);
+
+    /*
+     * delete it from the list in table 
+     */
+
+    table_ptr->current_number_of_entries--;
+
+    for (eptr = table_ptr->first; eptr; eptr = eptr->next) {
+        if (eptr == eold)
+            break;
+        prev = eptr;
+    }
+
+    if (prev)
+        prev->next = eold->next;
+    else
+        table_ptr->first = eold->next;
+
+    AGFREE(eold);
+}
+
+static void
+rowapi_too_long_creation_callback(unsigned int clientreg, void *clientarg)
+{
+    RMON_ENTRY_T   *eptr;
+    TABLE_DEFINTION_T *table_ptr;
+
+    eptr = (RMON_ENTRY_T *) clientarg;
+    table_ptr = (TABLE_DEFINTION_T *) eptr->table_ptr;
+    if (RMON1_ENTRY_VALID != eptr->status) {
+        ag_trace("row #%d in %s was under creation more then %ld sec.",
+                 eptr->ctrl_index, table_ptr->name,
+                 (long) MAX_CREATION_TIME);
+        rowapi_delete(eptr);
+    } else {
+        snmp_alarm_unregister(eptr->timer_id);
+    }
+}
+
+static int
+rowapi_deactivate(TABLE_DEFINTION_T * table_ptr, RMON_ENTRY_T * eptr)
+{
+    if (RMON1_ENTRY_UNDER_CREATION == eptr->status) {
+        /*
+         * nothing to do 
+         */
+        return SNMP_ERR_NOERROR;
+    }
+
+    if (table_ptr->ClbkDeactivate)
+        table_ptr->ClbkDeactivate(eptr);
+    eptr->status = RMON1_ENTRY_UNDER_CREATION;
+    eptr->timer_id = snmp_alarm_register(MAX_CREATION_TIME, 0,
+                                         rowapi_too_long_creation_callback,
+                                         eptr);
+    ag_trace("Entry %ld in %s has been deactivated",
+             eptr->ctrl_index, table_ptr->name);
+
+    return SNMP_ERR_NOERROR;
+}
+
+static int
+rowapi_activate(TABLE_DEFINTION_T * table_ptr, RMON_ENTRY_T * eptr)
+{
+    RMON1_ENTRY_STATUS_T prev_status = eptr->status;
+
+    eptr->status = RMON1_ENTRY_VALID;
+
+    if (table_ptr->ClbkActivate) {
+        if (0 != table_ptr->ClbkActivate(eptr)) {
+            ag_trace("Can't activate entry #%ld in %s",
+                     eptr->ctrl_index, table_ptr->name);
+            eptr->status = prev_status;
+            return SNMP_ERR_BADVALUE;
+        }
+    }
+
+    snmp_alarm_unregister(eptr->timer_id);
+    eptr->timer_id = 0;
+    ag_trace("Entry %ld in %s has been activated",
+             eptr->ctrl_index, table_ptr->name);
+    return SNMP_ERR_NOERROR;
+}
+
+/*
+ * creates an entry, locats it in proper sorted order by index
+ * Row is initialized to zero,
+ * except: 'next', 'table_ptr', 'index',
+ * 'timer_id' & 'status'=(RMON1_ENTRY_UNDER_CREATION)
+ * Calls (if need) ClbkCreate.
+ * Schedules for timeout under entry creation (id of this
+ * scheduling is saved in 'timer_id').
+ * Returns 0: OK,
+ -1:max. number exedes;
+ -2:malloc failed;
+ -3:ClbkCreate failed */
+int
+ROWAPI_new(TABLE_DEFINTION_T * table_ptr, u_long ctrl_index)
+{
+    register RMON_ENTRY_T *eptr;
+    register RMON_ENTRY_T *prev = NULL;
+    register RMON_ENTRY_T *enew;
+
+    /*
+     * check on 'max.number' 
+     */
+    if (table_ptr->max_number_of_entries > 0 &&
+        table_ptr->current_number_of_entries >=
+        table_ptr->max_number_of_entries)
+        return -1;
+
+    /*
+     * allocate memory for the header 
+     */
+    enew = (RMON_ENTRY_T *) AGMALLOC(sizeof(RMON_ENTRY_T));
+    if (!enew)
+        return -2;
+
+    /*
+     * init the header 
+     */
+    memset(enew, 0, sizeof(RMON_ENTRY_T));
+    enew->ctrl_index = ctrl_index;
+    enew->table_ptr = (void *) table_ptr;
+    enew->status = RMON1_ENTRY_UNDER_CREATION;
+    enew->only_just_created = 1;
+
+    /*
+     * create the body: alloc it and set defaults 
+     */
+    if (table_ptr->ClbkCreate) {
+        if (0 != table_ptr->ClbkCreate(enew)) {
+            AGFREE(enew);
+            return -3;
+        }
+    }
+
+    table_ptr->current_number_of_entries++;
+
+    /*
+     * find the place : before 'eptr' and after 'prev' 
+     */
+    for (eptr = table_ptr->first; eptr; eptr = eptr->next) {
+        if (ctrl_index < eptr->ctrl_index)
+            break;
+        prev = eptr;
+    }
+
+    /*
+     * insert it 
+     */
+    enew->next = eptr;
+    if (prev)
+        prev->next = enew;
+    else
+        table_ptr->first = enew;
+
+    enew->timer_id = snmp_alarm_register(MAX_CREATION_TIME, 0,
+                                         rowapi_too_long_creation_callback,
+                                         enew);
+    ag_trace("Entry %ld in %s has been created",
+             enew->ctrl_index, table_ptr->name);
+    return 0;
+}
+
+/*
+ * ****************************** 
+ */
+/*
+ * external usage (API) functions 
+ */
+/*
+ * ****************************** 
+ */
+
+void
+ROWAPI_init_table(TABLE_DEFINTION_T * table_ptr,
+                  char *name,
+                  u_long max_number_of_entries,
+                  ENTRY_CALLBACK_T * ClbkCreate,
+                  ENTRY_CALLBACK_T * ClbkClone,
+                  ENTRY_CALLBACK_T * ClbkDelete,
+                  ENTRY_CALLBACK_T * ClbkValidate,
+                  ENTRY_CALLBACK_T * ClbkActivate,
+                  ENTRY_CALLBACK_T * ClbkDeactivate,
+                  ENTRY_CALLBACK_T * ClbkCopy)
+{
+    table_ptr->name = name;
+    if (!table_ptr->name)
+        table_ptr->name = "Unknown";
+
+    table_ptr->max_number_of_entries = max_number_of_entries;
+    table_ptr->ClbkCreate = ClbkCreate;
+    table_ptr->ClbkClone = ClbkClone;
+    table_ptr->ClbkDelete = ClbkDelete;
+    table_ptr->ClbkValidate = ClbkValidate;
+    table_ptr->ClbkActivate = ClbkActivate;
+    table_ptr->ClbkDeactivate = ClbkDeactivate;
+    table_ptr->ClbkCopy = ClbkCopy;
+
+    table_ptr->first = NULL;
+    table_ptr->current_number_of_entries = 0;
+}
+
+void
+ROWAPI_delete_clone(TABLE_DEFINTION_T * table_ptr, u_long ctrl_index)
+{
+    register RMON_ENTRY_T *eptr;
+
+    eptr = ROWAPI_find(table_ptr, ctrl_index);
+    if (eptr) {
+        if (eptr->new_owner)
+            AGFREE(eptr->new_owner);
+
+        if (eptr->tmp) {
+            if (table_ptr->ClbkDelete)
+                table_ptr->ClbkDelete((RMON_ENTRY_T *) eptr->tmp);
+            AGFREE(eptr->tmp);
+        }
+
+        if (eptr->only_just_created) {
+            rowapi_delete(eptr);
+        }
+    }
+}
+
+RMON_ENTRY_T   *
+ROWAPI_get_clone(TABLE_DEFINTION_T * table_ptr,
+                 u_long ctrl_index, size_t body_size)
+{
+    register RMON_ENTRY_T *eptr;
+
+    if (ctrl_index < 1 || ctrl_index > 0xFFFFu) {
+        ag_trace("%s: index %ld out of range (1..65535)",
+                 table_ptr->name, (long) ctrl_index);
+        return NULL;
+    }
+
+    /*
+     * get it 
+     */
+    eptr = ROWAPI_find(table_ptr, ctrl_index);
+
+    if (!eptr) {                /* try to create */
+        if (0 != ROWAPI_new(table_ptr, ctrl_index)) {
+            return NULL;
+        }
+
+        /*
+         * get it 
+         */
+        eptr = ROWAPI_find(table_ptr, ctrl_index);
+        if (!eptr)              /* it is unbelievable, but ... :( */
+            return NULL;
+    }
+
+    eptr->new_status = eptr->status;
+
+    eptr->tmp = AGMALLOC(body_size);
+    if (!eptr->tmp) {
+        if (eptr->only_just_created)
+            rowapi_delete(eptr);
+        return NULL;
+    }
+
+    memcpy(eptr->tmp, eptr->body, body_size);
+    if (table_ptr->ClbkClone)
+        table_ptr->ClbkClone(eptr);
+
+    if (eptr->new_owner)
+        AGFREE(eptr->new_owner);
+    return eptr->tmp;
+}
+
+RMON_ENTRY_T   *
+ROWAPI_first(TABLE_DEFINTION_T * table_ptr)
+{
+    return table_ptr->first;
+}
+
+/*
+ * returns an entry with the smallest index
+ * which index > prev_index
+ */
+RMON_ENTRY_T   *
+ROWAPI_next(TABLE_DEFINTION_T * table_ptr, u_long prev_index)
+{
+    register RMON_ENTRY_T *eptr;
+
+    for (eptr = table_ptr->first; eptr; eptr = eptr->next)
+        if (eptr->ctrl_index > prev_index)
+            return eptr;
+
+    return NULL;
+}
+
+RMON_ENTRY_T   *
+ROWAPI_find(TABLE_DEFINTION_T * table_ptr, u_long ctrl_index)
+{
+    register RMON_ENTRY_T *eptr;
+
+    for (eptr = table_ptr->first; eptr; eptr = eptr->next) {
+        if (eptr->ctrl_index == ctrl_index)
+            return eptr;
+        if (eptr->ctrl_index > ctrl_index)
+            break;
+    }
+
+    return NULL;
+}
+
+int
+ROWAPI_action_check(TABLE_DEFINTION_T * table_ptr, u_long ctrl_index)
+{
+    register RMON_ENTRY_T *eptr;
+
+    eptr = ROWAPI_find(table_ptr, ctrl_index);
+    if (!eptr) {
+        ag_trace("Smth wrong ?");
+        return SNMP_ERR_GENERR;
+    }
+
+    /*
+     * test owner string 
+     */
+    if (RMON1_ENTRY_UNDER_CREATION != eptr->status) {
+        /*
+         * Only the same value is allowed 
+         */
+        if (eptr->new_owner &&
+            (!eptr->owner
+             || strncmp(eptr->new_owner, eptr->owner, MAX_OWNERSTRING))) {
+            ag_trace("invalid owner string in ROWAPI_action_check");
+            ag_trace("eptr->new_owner=%p eptr->owner=%p", eptr->new_owner,
+                     eptr->owner);
+            return SNMP_ERR_BADVALUE;
+        }
+    }
+
+    switch (eptr->new_status) { /* this status we want to set */
+    case RMON1_ENTRY_CREATE_REQUEST:
+        if (RMON1_ENTRY_UNDER_CREATION != eptr->status)
+            return SNMP_ERR_BADVALUE;
+        break;
+    case RMON1_ENTRY_INVALID:
+        break;
+    case RMON1_ENTRY_VALID:
+        if (RMON1_ENTRY_VALID == eptr->status) {
+            break;              /* nothing to do */
+        }
+        if (RMON1_ENTRY_UNDER_CREATION != eptr->status) {
+            ag_trace("Validate %s: entry %ld has wrong status %d",
+                     table_ptr->name, (long) ctrl_index,
+                     (int) eptr->status);
+            return SNMP_ERR_BADVALUE;
+        }
+
+        /*
+         * Our MIB understanding extension: we permit to set
+         * VALID when entry doesn't exit, in this case PDU has to have
+         * the nessessary & valid set of non-default values 
+         */
+        if (table_ptr->ClbkValidate) {
+            return table_ptr->ClbkValidate(eptr);
+        }
+        break;
+    case RMON1_ENTRY_UNDER_CREATION:
+        /*
+         * Our MIB understanding extension: we permit to travel from 
+         * VALID to 'UNDER_CREATION' state 
+         */
+        break;
+    }
+
+    return SNMP_ERR_NOERROR;
+}
+
+int
+ROWAPI_commit(TABLE_DEFINTION_T * table_ptr, u_long ctrl_index)
+{
+    register RMON_ENTRY_T *eptr;
+
+    eptr = ROWAPI_find(table_ptr, ctrl_index);
+    if (!eptr) {
+        ag_trace("Smth wrong ?");
+        return SNMP_ERR_GENERR;
+    }
+
+    eptr->only_just_created = 0;
+
+    switch (eptr->new_status) { /* this status we want to set */
+    case RMON1_ENTRY_CREATE_REQUEST:   /* copy tmp => eprt */
+        if (eptr->new_owner) {
+            if (eptr->owner)
+                AGFREE(eptr->owner);
+            eptr->owner = AGSTRDUP(eptr->new_owner);
+        }
+
+        if (table_ptr->ClbkCopy && eptr->tmp)
+            table_ptr->ClbkCopy(eptr);
+        break;
+    case RMON1_ENTRY_INVALID:
+        ROWAPI_delete_clone(table_ptr, ctrl_index);
+        rowapi_delete(eptr);
+#if 0                           /* for debug */
+        dbg_f_AG_MEM_REPORT();
+#endif
+        break;
+    case RMON1_ENTRY_VALID:    /* copy tmp => eprt and activate */
+        /*
+         * Our MIB understanding extension: we permit to set
+         * VALID when entry doesn't exit, in this case PDU has to have
+         * the nessessary & valid set of non-default values 
+         */
+        if (eptr->new_owner) {
+            if (eptr->owner)
+                AGFREE(eptr->owner);
+            eptr->owner = AGSTRDUP(eptr->new_owner);
+        }
+        if (table_ptr->ClbkCopy && eptr->tmp)
+            table_ptr->ClbkCopy(eptr);
+        if (RMON1_ENTRY_VALID != eptr->status) {
+            rowapi_activate(table_ptr, eptr);
+        }
+        break;
+    case RMON1_ENTRY_UNDER_CREATION:   /* deactivate (if need) and copy tmp => eprt */
+        /*
+         * Our MIB understanding extension: we permit to travel from
+         * VALID to 'UNDER_CREATION' state 
+         */
+        rowapi_deactivate(table_ptr, eptr);
+        if (eptr->new_owner) {
+            if (eptr->owner)
+                AGFREE(eptr->owner);
+            eptr->owner = AGSTRDUP(eptr->new_owner);
+        }
+        if (table_ptr->ClbkCopy && eptr->tmp)
+            table_ptr->ClbkCopy(eptr);
+        break;
+    }
+
+    ROWAPI_delete_clone(table_ptr, ctrl_index);
+    return SNMP_ERR_NOERROR;
+}
+
+RMON_ENTRY_T   *
+ROWAPI_header_ControlEntry(struct variable * vp, oid * name,
+                           size_t * length, int exact,
+                           size_t * var_len,
+                           TABLE_DEFINTION_T * table_ptr,
+                           void *entry_ptr, size_t entry_size)
+{
+    long            ctrl_index;
+    RMON_ENTRY_T   *hdr = NULL;
+
+    if (0 != AGUTIL_advance_index_name(vp, name, length, exact)) {
+        ag_trace("cannot advance_index_name");
+        return NULL;
+    }
+
+    ctrl_index = vp->namelen >= *length ? 0 : name[vp->namelen];
+
+    if (exact) {
+        if (ctrl_index)
+            hdr = ROWAPI_find(table_ptr, ctrl_index);
+    } else {
+        if (ctrl_index)
+            hdr = ROWAPI_next(table_ptr, ctrl_index);
+        else
+            hdr = ROWAPI_first(table_ptr);
+
+        if (hdr) {              /* set new index */
+            name[vp->namelen] = hdr->ctrl_index;
+            *length = vp->namelen + 1;
+        }
+    }
+
+    if (hdr)
+        memcpy(entry_ptr, hdr->body, entry_size);
+    return hdr;
+}
+
+int
+ROWAPI_do_another_action(oid * name, int tbl_first_index_begin,
+                         int action, int *prev_action,
+                         TABLE_DEFINTION_T * table_ptr, size_t entry_size)
+{
+    long            long_temp;
+    RMON_ENTRY_T   *tmp;
+
+    if (action == *prev_action)
+        return SNMP_ERR_NOERROR;        /* I want to process it only once ! */
+    *prev_action = action;
+
+    long_temp = name[tbl_first_index_begin];
+
+    switch (action) {
+    case RESERVE1:
+        tmp = ROWAPI_get_clone(table_ptr, long_temp, entry_size);
+        if (!tmp) {
+            ag_trace("RESERVE1: cannot get clone\n");
+            return SNMP_ERR_TOOBIG;
+        }
+        break;
+
+    case FREE:                 /* if RESERVEx failed: release any resources that have been allocated */
+    case UNDO:                 /* if ACTION failed: release any resources that have been allocated */
+        ROWAPI_delete_clone(table_ptr, long_temp);
+        break;
+
+    case ACTION:
+        long_temp = ROWAPI_action_check(table_ptr, long_temp);
+        if (0 != long_temp)
+            return long_temp;
+        break;
+
+    case COMMIT:
+        long_temp = ROWAPI_commit(table_ptr, long_temp);
+        if (0 != long_temp)     /* it MUST NOT be */
+            return long_temp;
+        break;
+    default:
+        ag_trace("Unknown action %d", (int) action);
+        return SNMP_ERR_GENERR;
+    }                           /* of switch by actions */
+
+    return SNMP_ERR_NOERROR;
+}
+
+/*
+ * data tables API section 
+ */
+
+int
+ROWDATAAPI_init(SCROLLER_T * scrlr,
+                u_long data_requested,
+                u_long max_number_of_entries,
+                size_t data_size,
+                int (*data_destructor) (struct data_scroller *, void *))
+{
+    scrlr->data_granted = 0;
+    scrlr->data_created = 0;
+    scrlr->data_total_number = 0;
+    scrlr->first_data_ptr =
+        scrlr->last_data_ptr = scrlr->current_data_ptr = NULL;
+
+    scrlr->max_number_of_entries = max_number_of_entries;
+    scrlr->data_size = data_size;
+
+    scrlr->data_destructor = data_destructor;
+
+    ROWDATAAPI_set_size(scrlr, data_requested, 0);
+
+    return 0;
+}
+
+static int
+delete_data_entry(SCROLLER_T * scrlr, void *delete_me)
+{
+    NEXTED_PTR_T   *data_ptr = delete_me;
+    register NEXTED_PTR_T *tmp;
+
+    if (data_ptr == scrlr->first_data_ptr) {
+        scrlr->first_data_ptr = data_ptr->next;
+        if (data_ptr == scrlr->last_data_ptr)
+            scrlr->last_data_ptr = NULL;
+    } else {                    /* not first */
+        for (tmp = scrlr->first_data_ptr; tmp; tmp = tmp->next) {
+            if (tmp->next == data_ptr) {
+                if (data_ptr == scrlr->last_data_ptr)
+                    scrlr->last_data_ptr = tmp;
+                tmp->next = data_ptr->next;
+                break;
+            }
+        }                       /* for */
+    }                           /* not first */
+
+    if (data_ptr == scrlr->current_data_ptr)
+        scrlr->current_data_ptr = data_ptr->next;
+
+    if (scrlr->data_destructor)
+        scrlr->data_destructor(scrlr, data_ptr);
+    AGFREE(data_ptr);
+    scrlr->data_created--;
+    scrlr->data_stored--;
+
+    return 0;
+}
+
+static void
+realloc_number_of_data(SCROLLER_T * scrlr, long dlong)
+{
+    void           *bptr;       /* DATA_ENTRY_T */
+    NEXTED_PTR_T   *prev = NULL;
+    void           *first = NULL;
+
+    if (dlong > 0) {
+        for (; dlong; dlong--, prev = bptr, scrlr->data_created++) {
+            bptr = AGMALLOC(scrlr->data_size);
+            if (!bptr) {
+                ag_trace("Err: no memory for data");
+                break;
+            }
+            memset(bptr, 0, scrlr->data_size);
+            if (prev)
+                prev->next = bptr;
+            else
+                first = bptr;
+        }                       /* of loop by malloc bucket */
+
+        if (!scrlr->current_data_ptr)
+            scrlr->current_data_ptr = first;
+        if (scrlr->last_data_ptr) {
+            scrlr->last_data_ptr->next = first;
+        } else
+            scrlr->first_data_ptr = first;
+
+        scrlr->last_data_ptr = bptr;
+
+    } else {
+        for (; dlong && scrlr->data_created > 0; dlong++) {
+            if (scrlr->current_data_ptr)
+                delete_data_entry(scrlr, scrlr->current_data_ptr);
+            else
+                delete_data_entry(scrlr, scrlr->first_data_ptr);
+        }
+    }
+}
+
+void
+ROWDATAAPI_set_size(SCROLLER_T * scrlr,
+                    u_long data_requested, u_char do_allocation)
+{
+    long            dlong;
+
+    scrlr->data_requested = data_requested;
+    scrlr->data_granted = (data_requested < scrlr->max_number_of_entries) ?
+        data_requested : scrlr->max_number_of_entries;
+    if (do_allocation) {
+        dlong = (long) scrlr->data_granted - (long) scrlr->data_created;
+        realloc_number_of_data(scrlr, dlong);
+    }
+}
+
+void
+ROWDATAAPI_descructor(SCROLLER_T * scrlr)
+{
+    register NEXTED_PTR_T *bptr;
+    register void  *next;
+
+    for (bptr = scrlr->first_data_ptr; bptr; bptr = next) {
+        next = bptr->next;
+        if (scrlr->data_destructor)
+            scrlr->data_destructor(scrlr, bptr);
+        AGFREE(bptr);
+    }
+    scrlr->data_created = 0;
+    scrlr->data_granted = 0;
+    scrlr->first_data_ptr =
+        scrlr->last_data_ptr = scrlr->current_data_ptr = NULL;
+}
+
+void           *
+ROWDATAAPI_locate_new_data(SCROLLER_T * scrlr)
+{
+    register NEXTED_PTR_T *bptr;
+
+    if (!scrlr->current_data_ptr) {     /* there was wrap */
+        bptr = scrlr->first_data_ptr;
+        if (!bptr) {
+            ag_trace("Err: SCROLLER_T:locate_new_data: internal error :(");
+            return NULL;
+        }
+        scrlr->first_data_ptr = bptr->next;
+        scrlr->last_data_ptr->next = bptr;
+        scrlr->last_data_ptr = (NEXTED_PTR_T *) bptr;
+        bptr->next = 0;
+    } else {
+        bptr = scrlr->current_data_ptr;
+        scrlr->current_data_ptr = bptr->next;
+        ++scrlr->data_stored;
+    }
+
+    scrlr->data_total_number++;
+
+    return bptr;
+}
+
+u_long
+ROWDATAAPI_get_total_number(SCROLLER_T * scrlr)
+{
+    return scrlr->data_total_number;
+}
+
+RMON_ENTRY_T   *
+ROWDATAAPI_header_DataEntry(struct variable * vp, oid * name,
+                            size_t * length, int exact,
+                            size_t * var_len,
+                            TABLE_DEFINTION_T * table_ptr,
+                            SCROLLER_T * (*extract_scroller) (void *body),
+                            size_t data_size, void *entry_ptr)
+{
+    long            ctrl_indx, data_index;
+    RMON_ENTRY_T   *hdr = NULL;
+    SCROLLER_T     *scrlr;
+    NEXTED_PTR_T   *bptr = NULL;
+    register u_long iii;
+
+    if (0 != AGUTIL_advance_index_name(vp, name, length, exact)) {
+        ag_trace("cannot advance_index_name");
+        return NULL;
+    }
+
+    ctrl_indx = vp->namelen >= *length ? 0 : name[vp->namelen];
+    if (ctrl_indx)
+        data_index =
+            (vp->namelen + 1 >= *length) ? 0 : name[vp->namelen + 1];
+    else
+        data_index = 0;
+
+    if (exact) {
+        if (ctrl_indx && data_index) {
+            hdr = ROWAPI_find(table_ptr, ctrl_indx);
+            if (hdr) {
+                scrlr = extract_scroller(hdr->body);
+                bptr = scrlr->first_data_ptr;
+                for (iii = 0; iii < scrlr->data_stored && bptr;
+                     iii++, bptr = bptr->next) {
+                    if (bptr->data_index == data_index)
+                        break;
+                }
+                if (!bptr)
+                    hdr = NULL;
+            }
+        }
+    } else {
+        if (ctrl_indx)
+            hdr = ROWAPI_find(table_ptr, ctrl_indx);
+        else
+            hdr = ROWAPI_first(table_ptr);
+
+        if (hdr) {
+            scrlr = extract_scroller(hdr->body);
+            /*
+             * ag_trace ("get next after (%d %d)", (int) ctrl_indx, (int) data_index); 
+             */
+            bptr = scrlr->first_data_ptr;
+            for (iii = 0; iii < scrlr->data_stored && bptr;
+                 iii++, bptr = bptr->next) {
+                if (bptr->data_index && bptr->data_index > data_index)
+                    break;
+            }
+
+            if (bptr && bptr->data_index <= data_index)
+                bptr = NULL;
+
+            if (!bptr) {        /* travel to next row */
+                /*
+                 * ag_trace ("Dbg: travel to next row"); 
+                 */
+                for (hdr = hdr->next; hdr; hdr = hdr->next) {
+                    if (RMON1_ENTRY_VALID != hdr->status)
+                        continue;
+
+                    scrlr = extract_scroller(hdr->body);
+                    if (scrlr->data_stored <= 0)
+                        continue;
+                    for (bptr = scrlr->first_data_ptr; bptr;
+                         bptr = bptr->next) {
+                        if (bptr->data_index)
+                            break;
+                    }
+
+                    if (bptr)
+                        break;
+                }
+            }
+            if (bptr) {         /* set new index */
+                /*
+                 * ag_trace ("Dbg: So (%d %d)", (int) hdr->index, (int) bptr->data_index); 
+                 */
+                name[vp->namelen] = hdr->ctrl_index;
+                name[vp->namelen + 1] = bptr->data_index;
+                *length = vp->namelen + 2;
+            } else
+                hdr = NULL;
+        }
+    }
+
+    if (hdr)
+        memcpy(entry_ptr, bptr, data_size);
+    return hdr;
+}
+
+void
+init_rows(void)
+{
+}
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/Rmon/rows.h tomato121/release/src/router/snmp/agent/mibgroup/Rmon/rows.h
--- tomato/release/src/router/snmp/agent/mibgroup/Rmon/rows.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/Rmon/rows.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,26 @@
+/**************************************************************
+ * Copyright (C) 2001 Alex Rozin, Optical Access 
+ *
+ *                     All Rights Reserved
+ *
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation for any purpose and without fee is hereby granted,
+ * provided that the above copyright notice appear in all copies and that
+ * both that copyright notice and this permission notice appear in
+ * supporting documentation.
+ * 
+ * ALEX ROZIN DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+ * ALEX ROZIN BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+ * SOFTWARE.
+ ******************************************************************/
+
+#ifndef _rows_h_included__
+#define _rows_h_included__
+
+void            init_rows(void);
+
+#endif                          /* _rows_h_included__ */
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/Rmon/statistics.c tomato121/release/src/router/snmp/agent/mibgroup/Rmon/statistics.c
--- tomato/release/src/router/snmp/agent/mibgroup/Rmon/statistics.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/Rmon/statistics.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,529 @@
+/**************************************************************
+ * Copyright (C) 2001 Tali Rozin, Optical Access
+ *
+ *                     All Rights Reserved
+ *
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation for any purpose and without fee is hereby granted,
+ * provided that the above copyright notice appear in all copies and that
+ * both that copyright notice and this permission notice appear in
+ * supporting documentation.
+ *
+ * TALI ROZIN DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+ * ALEX ROZIN BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+ * SOFTWARE.
+ ******************************************************************/
+
+#include <stdlib.h>
+#include <sys/time.h>
+#include <unistd.h>
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include "util_funcs.h"
+#include "statistics.h"
+        /*
+         * Implementation headers 
+         */
+#include "agutil_api.h"
+#include "row_api.h"
+        /*
+         * File scope definitions section 
+         */
+        /*
+         * from MIB compilation 
+         */
+#define MIB_DESCR	"EthStat"
+#define etherStatsEntryFirstIndexBegin	11
+#define IDetherStatsDroppedFrames        1
+#define IDetherStatsCreateTime           2
+#define IDetherStatsIndex                3
+#define IDetherStatsDataSource           4
+#define IDetherStatsDropEvents           5
+#define IDetherStatsOctets               6
+#define IDetherStatsPkts                 7
+#define IDetherStatsBroadcastPkts        8
+#define IDetherStatsMulticastPkts        9
+#define IDetherStatsCRCAlignErrors       10
+#define IDetherStatsUndersizePkts        11
+#define IDetherStatsOversizePkts         12
+#define IDetherStatsFragments            13
+#define IDetherStatsJabbers              14
+#define IDetherStatsCollisions           15
+#define IDetherStatsPkts64Octets         16
+#define IDetherStatsPkts65to127Octets    17
+#define IDetherStatsPkts128to255Octets   18
+#define IDetherStatsPkts256to511Octets   19
+#define IDetherStatsPkts512to1023Octets  20
+#define IDetherStatsPkts1024to1518Octets 21
+#define IDetherStatsOwner                22
+#define IDetherStatsStatus               23
+#define Leaf_etherStatsDataSource        2
+#define Leaf_etherStatsOwner             20
+#define Leaf_etherStatsStatus            21
+#define MIN_etherStatsIndex   1
+#define MAX_etherStatsIndex   65535
+     typedef struct {
+         VAR_OID_T
+             data_source;
+         u_long
+             etherStatsCreateTime;
+         ETH_STATS_T
+             eth;
+     } CRTL_ENTRY_T;
+
+/*
+ * Main section 
+ */
+
+     static TABLE_DEFINTION_T
+         StatCtrlTable;
+     static TABLE_DEFINTION_T *
+         table_ptr = &
+         StatCtrlTable;
+
+/*
+ * Control Table RowApi Callbacks 
+ */
+
+     int
+     stat_Create(RMON_ENTRY_T * eptr)
+{                               /* create the body: alloc it and set defaults */
+    CRTL_ENTRY_T   *body;
+    static VAR_OID_T data_src_if_index_1 =
+        { 11, {1, 3, 6, 1, 2, 1, 2, 2, 1, 1, 1} };
+
+    eptr->body = AGMALLOC(sizeof(CRTL_ENTRY_T));
+    if (!eptr->body)
+        return -3;
+    body = (CRTL_ENTRY_T *) eptr->body;
+
+    /*
+     * set defaults 
+     */
+    memcpy(&body->data_source, &data_src_if_index_1, sizeof(VAR_OID_T));
+    body->data_source.objid[body->data_source.length - 1] =
+        eptr->ctrl_index;
+    eptr->owner = AGSTRDUP("Startup Mgmt");
+    memset(&body->eth, 0, sizeof(ETH_STATS_T));
+
+    return 0;
+}
+
+int
+stat_Validate(RMON_ENTRY_T * eptr)
+{
+    /*
+     * T.B.D. (system dependent) check valid inteface in body->data_source; 
+     */
+
+    return 0;
+}
+
+int
+stat_Activate(RMON_ENTRY_T * eptr)
+{
+    CRTL_ENTRY_T   *body = (CRTL_ENTRY_T *) eptr->body;
+
+    body->etherStatsCreateTime = AGUTIL_sys_up_time();
+
+    return 0;
+}
+
+int
+stat_Copy(RMON_ENTRY_T * eptr)
+{
+    CRTL_ENTRY_T   *body = (CRTL_ENTRY_T *) eptr->body;
+    CRTL_ENTRY_T   *clone = (CRTL_ENTRY_T *) eptr->tmp;
+
+    if (snmp_oid_compare
+        (clone->data_source.objid, clone->data_source.length,
+         body->data_source.objid, body->data_source.length)) {
+        memcpy(&body->data_source, &clone->data_source, sizeof(VAR_OID_T));
+    }
+
+    return 0;
+}
+
+int
+stat_Deactivate(RMON_ENTRY_T * eptr)
+{
+    CRTL_ENTRY_T   *body = (CRTL_ENTRY_T *) eptr->body;
+    memset(&body->eth, 0, sizeof(ETH_STATS_T));
+    return 0;
+}
+
+
+/***************************************************
+ * Function:var_etherStats2Entry 
+ * Purpose: Handles the request for etherStats2Entry variable instances
+ ***************************************************/
+u_char         *
+var_etherStats2Entry(struct variable * vp, oid * name, size_t * length,
+                     int exact, size_t * var_len,
+                     WriteMethod ** write_method)
+{
+    static long     long_return;
+    static CRTL_ENTRY_T theEntry;
+    RMON_ENTRY_T   *hdr;
+
+    *write_method = NULL;
+
+    hdr = ROWAPI_header_ControlEntry(vp, name, length, exact, var_len,
+                                     table_ptr,
+                                     &theEntry, sizeof(CRTL_ENTRY_T));
+    if (!hdr)
+        return NULL;
+
+    *var_len = sizeof(long);    /* default */
+
+    switch (vp->magic) {
+    case IDetherStatsDroppedFrames:
+        long_return = 0;
+        return (u_char *) & long_return;
+    case IDetherStatsCreateTime:
+        long_return = theEntry.etherStatsCreateTime;
+        return (u_char *) & long_return;
+    default:
+        ag_trace("%s: unknown vp->magic=%d", table_ptr->name,
+                 (int) vp->magic);
+        ERROR_MSG("");
+    };                          /* of switch by 'vp->magic'  */
+
+    return NULL;
+}
+
+
+/***************************************************
+ * Function:write_etherStatsEntry 
+ ***************************************************/
+static int
+write_etherStatsEntry(int action, u_char * var_val, u_char var_val_type,
+                      size_t var_val_len, u_char * statP,
+                      oid * name, size_t name_len)
+{
+    long            long_temp;
+    int             leaf_id, snmp_status;
+    static int      prev_action = COMMIT;
+    RMON_ENTRY_T   *hdr;
+    CRTL_ENTRY_T   *cloned_body;
+    CRTL_ENTRY_T   *body;
+
+    switch (action) {
+    case RESERVE1:
+    case FREE:
+    case UNDO:
+    case ACTION:
+    case COMMIT:
+    default:
+        snmp_status =
+            ROWAPI_do_another_action(name, etherStatsEntryFirstIndexBegin,
+                                     action, &prev_action, table_ptr,
+                                     sizeof(CRTL_ENTRY_T));
+        if (SNMP_ERR_NOERROR != snmp_status) {
+            ag_trace("failed action %d with %d", action, snmp_status);
+        }
+        break;
+
+    case RESERVE2:
+        /*
+         * get values from PDU, check them and save them in the cloned entry 
+         */
+        long_temp = name[etherStatsEntryFirstIndexBegin];
+        leaf_id = (int) name[etherStatsEntryFirstIndexBegin - 1];
+        hdr = ROWAPI_find(table_ptr, long_temp);        /* it MUST be OK */
+        cloned_body = (CRTL_ENTRY_T *) hdr->tmp;
+        body = (CRTL_ENTRY_T *) hdr->body;
+        switch (leaf_id) {
+        case Leaf_etherStatsDataSource:
+            snmp_status = AGUTIL_get_oid_value(var_val, var_val_type,
+                                               var_val_len,
+                                               &cloned_body->data_source);
+            if (SNMP_ERR_NOERROR != snmp_status) {
+                return snmp_status;
+            }
+            if (RMON1_ENTRY_UNDER_CREATION != hdr->status &&
+                snmp_oid_compare(cloned_body->data_source.objid,
+                                 cloned_body->data_source.length,
+                                 body->data_source.objid,
+                                 body->data_source.length))
+                return SNMP_ERR_BADVALUE;
+            break;
+
+            break;
+        case Leaf_etherStatsOwner:
+            if (hdr->new_owner)
+                AGFREE(hdr->new_owner);
+            hdr->new_owner = AGMALLOC(MAX_OWNERSTRING);;
+            if (!hdr->new_owner)
+                return SNMP_ERR_TOOBIG;
+            snmp_status = AGUTIL_get_string_value(var_val, var_val_type,
+                                                  var_val_len,
+                                                  MAX_OWNERSTRING,
+                                                  1, NULL, hdr->new_owner);
+            if (SNMP_ERR_NOERROR != snmp_status) {
+                return snmp_status;
+            }
+            break;
+        case Leaf_etherStatsStatus:
+            snmp_status = AGUTIL_get_int_value(var_val, var_val_type,
+                                               var_val_len,
+                                               RMON1_ENTRY_VALID,
+                                               RMON1_ENTRY_INVALID,
+                                               &long_temp);
+            if (SNMP_ERR_NOERROR != snmp_status) {
+                ag_trace("cannot browse etherStatsStatus");
+                return snmp_status;
+            }
+            hdr->new_status = long_temp;
+            break;
+            break;
+        default:
+            ag_trace("%s:unknown leaf_id=%d\n", table_ptr->name,
+                     (int) leaf_id);
+            return SNMP_ERR_NOSUCHNAME;
+        }                       /* of switch by 'leaf_id' */
+        break;
+    }                           /* of switch by 'action' */
+
+    prev_action = action;
+    return SNMP_ERR_NOERROR;
+}
+
+/***************************************************
+ * Function:var_etherStatsEntry 
+ * Purpose: Handles the request for etherStatsEntry variable instances
+ ***************************************************/
+u_char         *
+var_etherStatsEntry(struct variable * vp, oid * name, size_t * length,
+                    int exact, size_t * var_len,
+                    WriteMethod ** write_method)
+{
+    static long     long_return;
+    static CRTL_ENTRY_T theEntry;
+    RMON_ENTRY_T   *hdr;
+
+    *write_method = write_etherStatsEntry;
+    hdr = ROWAPI_header_ControlEntry(vp, name, length, exact, var_len,
+                                     table_ptr,
+                                     &theEntry, sizeof(CRTL_ENTRY_T));
+    if (!hdr)
+        return NULL;
+
+    if (RMON1_ENTRY_VALID == hdr->status)
+        SYSTEM_get_eth_statistics(&theEntry.data_source, &theEntry.eth);
+
+    *var_len = sizeof(long);
+
+    switch (vp->magic) {
+    case IDetherStatsIndex:
+        long_return = hdr->ctrl_index;
+        return (u_char *) & long_return;
+    case IDetherStatsDataSource:
+        *var_len = sizeof(oid) * theEntry.data_source.length;
+        return (unsigned char *) theEntry.data_source.objid;
+    case IDetherStatsDropEvents:
+        long_return = 0;        /* theEntry.eth.etherStatsDropEvents; */
+        return (u_char *) & long_return;
+    case IDetherStatsOctets:
+        long_return = theEntry.eth.octets;
+        return (u_char *) & long_return;
+    case IDetherStatsPkts:
+        long_return = theEntry.eth.packets;
+        return (u_char *) & long_return;
+    case IDetherStatsBroadcastPkts:
+        long_return = theEntry.eth.bcast_pkts;
+        return (u_char *) & long_return;
+    case IDetherStatsMulticastPkts:
+        long_return = theEntry.eth.mcast_pkts;
+        return (u_char *) & long_return;
+    case IDetherStatsCRCAlignErrors:
+        long_return = theEntry.eth.crc_align;
+        return (u_char *) & long_return;
+    case IDetherStatsUndersizePkts:
+        long_return = theEntry.eth.undersize;
+        return (u_char *) & long_return;
+    case IDetherStatsOversizePkts:
+        long_return = theEntry.eth.oversize;
+        return (u_char *) & long_return;
+    case IDetherStatsFragments:
+        long_return = theEntry.eth.fragments;
+        return (u_char *) & long_return;
+    case IDetherStatsJabbers:
+        long_return = theEntry.eth.jabbers;
+        return (u_char *) & long_return;
+    case IDetherStatsCollisions:
+        long_return = theEntry.eth.collisions;
+        return (u_char *) & long_return;
+    case IDetherStatsPkts64Octets:
+        long_return = theEntry.eth.pkts_64;
+        return (u_char *) & long_return;
+    case IDetherStatsPkts65to127Octets:
+        long_return = theEntry.eth.pkts_65_127;
+        return (u_char *) & long_return;
+    case IDetherStatsPkts128to255Octets:
+        long_return = theEntry.eth.pkts_128_255;
+        return (u_char *) & long_return;
+    case IDetherStatsPkts256to511Octets:
+        long_return = theEntry.eth.pkts_256_511;
+        return (u_char *) & long_return;
+    case IDetherStatsPkts512to1023Octets:
+        long_return = theEntry.eth.pkts_512_1023;
+        return (u_char *) & long_return;
+    case IDetherStatsPkts1024to1518Octets:
+        long_return = theEntry.eth.pkts_1024_1518;
+        return (u_char *) & long_return;
+    case IDetherStatsOwner:
+        if (hdr->owner) {
+            *var_len = strlen(hdr->owner);
+            return (unsigned char *) hdr->owner;
+        } else {
+            *var_len = 0;
+            return (unsigned char *) "";
+        }
+    case IDetherStatsStatus:
+        long_return = hdr->status;
+        return (u_char *) & long_return;
+    default:
+        ERROR_MSG("");
+    };                          /* of switch by 'vp->magic'  */
+
+    return NULL;
+}
+
+#if 1                           /* debug, but may be used for init. TBD: may be token snmpd.conf ? */
+int
+add_statistics_entry(int ctrl_index, int ifIndex)
+{
+    int             ierr;
+
+    ierr = ROWAPI_new(table_ptr, ctrl_index);
+    switch (ierr) {
+    case -1:
+        ag_trace("max. number exedes\n");
+        break;
+    case -2:
+        ag_trace("malloc failed");
+        break;
+    case -3:
+        ag_trace("ClbkCreate failed");
+        break;
+    case 0:
+        break;
+    default:
+        ag_trace("Unknown code %d", ierr);
+        break;
+    }
+
+    if (!ierr) {
+        register RMON_ENTRY_T *eptr = ROWAPI_find(table_ptr, ctrl_index);
+        if (!eptr) {
+            ag_trace("cannot find it");
+            ierr = -4;
+        } else {
+            CRTL_ENTRY_T   *body = (CRTL_ENTRY_T *) eptr->body;
+
+            body->data_source.objid[body->data_source.length - 1] =
+                ifIndex;
+
+            eptr->new_status = RMON1_ENTRY_VALID;
+            ierr = ROWAPI_commit(table_ptr, ctrl_index);
+            if (ierr) {
+                ag_trace("ROWAPI_commit returned %d", ierr);
+            }
+        }
+    }
+
+    return ierr;
+}
+#endif
+
+/***************************************************
+ * define Variables callbacks 
+ ***************************************************/
+oid             oidstatisticsVariablesOid[] = { 1, 3, 6, 1, 2, 1, 16, 1 };
+
+struct variable7 oidstatisticsVariables[] = {
+    {IDetherStatsIndex, ASN_INTEGER, RONLY, var_etherStatsEntry, 3,
+     {1, 1, 1}},
+    {IDetherStatsDataSource, ASN_OBJECT_ID, RWRITE, var_etherStatsEntry, 3,
+     {1, 1, 2}},
+    {IDetherStatsDropEvents, ASN_COUNTER, RONLY, var_etherStatsEntry, 3,
+     {1, 1, 3}},
+    {IDetherStatsOctets, ASN_COUNTER, RONLY, var_etherStatsEntry, 3,
+     {1, 1, 4}},
+    {IDetherStatsPkts, ASN_COUNTER, RONLY, var_etherStatsEntry, 3,
+     {1, 1, 5}},
+    {IDetherStatsBroadcastPkts, ASN_COUNTER, RONLY, var_etherStatsEntry, 3,
+     {1, 1, 6}},
+    {IDetherStatsMulticastPkts, ASN_COUNTER, RONLY, var_etherStatsEntry, 3,
+     {1, 1, 7}},
+    {IDetherStatsCRCAlignErrors, ASN_COUNTER, RONLY, var_etherStatsEntry,
+     3, {1, 1, 8}},
+    {IDetherStatsUndersizePkts, ASN_COUNTER, RONLY, var_etherStatsEntry, 3,
+     {1, 1, 9}},
+    {IDetherStatsOversizePkts, ASN_COUNTER, RONLY, var_etherStatsEntry, 3,
+     {1, 1, 10}},
+    {IDetherStatsFragments, ASN_COUNTER, RONLY, var_etherStatsEntry, 3,
+     {1, 1, 11}},
+    {IDetherStatsJabbers, ASN_COUNTER, RONLY, var_etherStatsEntry, 3,
+     {1, 1, 12}},
+    {IDetherStatsCollisions, ASN_COUNTER, RONLY, var_etherStatsEntry, 3,
+     {1, 1, 13}},
+    {IDetherStatsPkts64Octets, ASN_COUNTER, RONLY, var_etherStatsEntry, 3,
+     {1, 1, 14}},
+    {IDetherStatsPkts65to127Octets, ASN_COUNTER, RONLY,
+     var_etherStatsEntry, 3, {1, 1, 15}},
+    {IDetherStatsPkts128to255Octets, ASN_COUNTER, RONLY,
+     var_etherStatsEntry, 3, {1, 1, 16}},
+    {IDetherStatsPkts256to511Octets, ASN_COUNTER, RONLY,
+     var_etherStatsEntry, 3, {1, 1, 17}},
+    {IDetherStatsPkts512to1023Octets, ASN_COUNTER, RONLY,
+     var_etherStatsEntry, 3, {1, 1, 18}},
+    {IDetherStatsPkts1024to1518Octets, ASN_COUNTER, RONLY,
+     var_etherStatsEntry, 3, {1, 1, 19}},
+    {IDetherStatsOwner, ASN_OCTET_STR, RWRITE, var_etherStatsEntry, 3,
+     {1, 1, 20}},
+    {IDetherStatsStatus, ASN_INTEGER, RWRITE, var_etherStatsEntry, 3,
+     {1, 1, 21}},
+    {IDetherStatsDroppedFrames, ASN_COUNTER, RONLY, var_etherStats2Entry,
+     3, {4, 1, 1}},
+    {IDetherStatsCreateTime, ASN_TIMETICKS, RONLY, var_etherStats2Entry, 3,
+     {4, 1, 2}},
+};
+
+/***************************************************
+ * Function:init_statistics 
+ * Purpose: register statistics objects in the agent 
+ ***************************************************/
+void
+init_statistics(void)
+{
+    REGISTER_MIB(MIB_DESCR, oidstatisticsVariables, variable7,
+                 oidstatisticsVariablesOid);
+
+    ROWAPI_init_table(&StatCtrlTable, MIB_DESCR, 0, &stat_Create, NULL, /* &stat_Clone, */
+                      NULL,     /* &stat_Delete, */
+                      &stat_Validate,
+                      &stat_Activate, &stat_Deactivate, &stat_Copy);
+
+#if 0                           /* debug */
+    {
+        int             iii;
+        for (iii = 1; iii < 6; iii++) {
+            add_statistics_entry(iii, iii);
+        }
+
+        add_statistics_entry(10, 16);
+        add_statistics_entry(12, 11);
+    }
+#endif
+}
+
+/*
+ * end of file statistics.c 
+ */
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/Rmon/statistics.h tomato121/release/src/router/snmp/agent/mibgroup/Rmon/statistics.h
--- tomato/release/src/router/snmp/agent/mibgroup/Rmon/statistics.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/Rmon/statistics.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,31 @@
+/**************************************************************
+ * Copyright (C) 2001 Tali Rozin, Optical Access
+ *
+ *                     All Rights Reserved
+ *
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation for any purpose and without fee is hereby granted,
+ * provided that the above copyright notice appear in all copies and that
+ * both that copyright notice and this permission notice appear in
+ * supporting documentation.
+ *
+ * TALI ROZIN DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+ * ALEX ROZIN BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+ * SOFTWARE.
+ ******************************************************************/
+
+#ifndef _statistics_h_included__
+#define _statistics_h_included__
+
+config_require(util_funcs)
+     void            init_statistics(void);
+
+#endif                          /* _statistics_h_included__ */
+
+/*
+ * end of file statistics.h 
+ */
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/Rmon/test_alarm.sh tomato121/release/src/router/snmp/agent/mibgroup/Rmon/test_alarm.sh
--- tomato/release/src/router/snmp/agent/mibgroup/Rmon/test_alarm.sh	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/Rmon/test_alarm.sh	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,85 @@
+:
+
+# Rmon Alarms/Events testing script
+# $Log: test_alarm.sh,v $
+# Revision 1.1.2.1  2004/06/20 21:54:16  nikki
+# Adding WOL, SNMP, RFLOW
+#
+# Revision 5.0  2002/04/20 07:30:01  hardaker
+# cvs file version number change
+#
+# Revision 1.1  2001/05/09 19:36:13  slif
+# Include Alex Rozin's Rmon.
+#
+#
+
+#Only parameter: number of interface (ifIndex) to be tested.
+#Default: 1
+
+TSTIF=1
+COMPAR="-m ALL localhost public"
+
+if [ "X"${1} = "X" ] ; then
+    echo got default parameter : $TSTIF
+else
+    TSTIF=$1
+fi
+
+#testing parameters:
+ETHIND=3
+EVNIND=7
+ALRIND=2
+LOWLIMIT=4800
+HILIMIT =4900
+INTERVAL=3
+WAITTIME=17
+
+echo interface ifIndex.$TSTIF will be tested
+
+echo " "
+echo 1. Create etherStatsEntry
+snmpset $COMPAR \
+	etherStatsStatus.$ETHIND i 2 \
+	etherStatsDataSource.$ETHIND o interfaces.ifTable.ifEntry.ifIndex.$TSTIF
+snmpset $COMPAR etherStatsStatus.$ETHIND i 1
+snmpwalk $COMPAR statistics
+
+echo 2. Create event control entry
+snmpset $COMPAR \
+	eventStatus.$EVNIND i 1 \
+	eventDescription.$EVNIND s "Alarms" \
+	eventType.$EVNIND i 4 \
+	eventOwner.$EVNIND s "Alex"
+#snmpwalk $COMPAR eventTable
+
+echo 3. Create alarm entry
+snmpset $COMPAR \
+	alarmStatus.$ALRIND i 1 \
+	alarmInterval.$ALRIND i $INTERVAL \
+	alarmVariable.$ALRIND o rmon.statistics.etherStatsTable.etherStatsEntry.etherStatsPkts.$ETHIND \
+	alarmSampleType.$ALRIND i 2 \
+	alarmFallingThreshold.$ALRIND i $LOWLIMIT \
+	alarmRisingThreshold.$ALRIND i $HILIMIT \
+	alarmRisingEventIndex.$ALRIND i $EVNIND \
+	alarmFallingEventIndex.$ALRIND i $EVNIND
+snmpwalk $COMPAR alarm
+
+echo 4. Sleep $WAITTIME to collect log.
+echo    This $WAITTIME seconds you may enjoy with Rmon traps.
+sleep $WAITTIME
+
+echo 5. Check log:
+snmpwalk $COMPAR logTable
+snmptable $COMPAR logTable
+snmpwalk $COMPAR eventTable
+
+echo 6.  clean everything
+snmpset $COMPAR alarmStatus.$ALRIND i 4
+snmpset $COMPAR eventStatus.$EVNIND i 4
+snmpset $COMPAR etherStatsStatus.$ETHIND i 4
+snmpwalk $COMPAR rmon
+	
+echo " "
+echo "Goodbye, I'm a gonner"
+echo " "
+
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/Rmon/test_hist.sh tomato121/release/src/router/snmp/agent/mibgroup/Rmon/test_hist.sh
--- tomato/release/src/router/snmp/agent/mibgroup/Rmon/test_hist.sh	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/Rmon/test_hist.sh	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,91 @@
+:
+# Rmon History testing script
+# $Log: test_hist.sh,v $
+# Revision 1.1.2.1  2004/06/20 21:54:16  nikki
+# Adding WOL, SNMP, RFLOW
+#
+# Revision 5.0  2002/04/20 07:30:01  hardaker
+# cvs file version number change
+#
+# Revision 1.1  2001/05/09 19:36:13  slif
+# Include Alex Rozin's Rmon.
+#
+#
+
+#Only parameter: number of interface (ifIndex) to be tested.
+#Default: 1
+
+TSTIF=1
+COMPAR="-m ALL localhost public"
+
+if [ "X"${1} = "X" ] ; then
+    echo got default parameter : $TSTIF
+else
+    TSTIF=$1
+fi
+
+echo interface ifIndex.$TSTIF will be tested
+
+echo " "
+echo 1. create control entry
+snmpset $COMPAR historyControlBucketsRequested.4 i 4 historyControlInterval.4 i 3 \
+historyControlDataSource.4 o interfaces.ifTable.ifEntry.ifIndex.$TSTIF \
+historyControlStatus.4 i 2
+
+snmpwalk $COMPAR historyControlTable
+echo " "
+echo 2. validate it
+snmpset $COMPAR historyControlStatus.4 i 1
+snmpwalk $COMPAR historyControlTable
+echo "Sleep 3, take it chance to get something"
+sleep 3
+snmpwalk $COMPAR etherHistoryTable
+echo "Sleep 6, take it chance to advance"
+sleep 6
+snmpwalk $COMPAR etherHistoryTable
+
+
+echo " "
+echo 3. change requested number of buckets
+snmpset $COMPAR historyControlBucketsRequested.4 i 2
+echo "Sleep 9, take it chance to get something"
+sleep 9
+snmpwalk $COMPAR etherHistoryTable
+
+echo " "
+echo 4. invalidate it
+snmpset $COMPAR historyControlStatus.4 i 4
+snmpwalk $COMPAR history
+
+
+echo " "
+echo 5. create and validate 2 control entries
+snmpset $COMPAR historyControlBucketsRequested.4 i 3 historyControlInterval.4 i 2 \
+historyControlDataSource.4 o interfaces.ifTable.ifEntry.ifIndex.$TSTIF \
+historyControlStatus.4 i 1
+snmpset $COMPAR historyControlBucketsRequested.2 i 2 historyControlInterval.2 i 4 \
+historyControlStatus.2 i 1
+snmptable $COMPAR historyControlTable
+echo "Sleep 12, take them chance to get something"
+sleep 12
+snmpwalk $COMPAR etherHistoryTable
+
+echo " "
+echo 6. create entry and let it to be aged
+snmpset $COMPAR historyControlStatus.3 i 2
+snmptable $COMPAR historyControlTable
+echo "Sleep 61, take it chance to be aged"
+sleep 61
+snmptable $COMPAR historyControlTable
+
+echo " "
+echo 7. clean everything
+snmpset $COMPAR historyControlStatus.2 i 4
+snmpset $COMPAR historyControlStatus.4 i 4
+snmpwalk $COMPAR history
+
+
+echo " "
+echo "Goodbye, I'm a gonner"
+echo " "
+
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/Rmon.h tomato121/release/src/router/snmp/agent/mibgroup/Rmon.h
--- tomato/release/src/router/snmp/agent/mibgroup/Rmon.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/Rmon.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,57 @@
+/**************************************************************
+ * Copyright (C) 2001 Alex Rozin, Optical Access
+ * 
+ *                     All Rights Reserved
+ * 
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation for any purpose and without fee is hereby granted,
+ * provided that the above copyright notice appear in all copies and that
+ * both that copyright notice and this permission notice appear in
+ * supporting documentation.
+ * 
+ * ALEX ROZIN DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+ * ALEX ROZIN BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+ * SOFTWARE.
+ ******************************************************************/
+
+/*
+ * $Log: Rmon.h,v $
+ * Revision 1.1.2.1  2004/06/20 21:54:13  nikki
+ * Adding WOL, SNMP, RFLOW
+ *
+ * Revision 5.0  2002/04/20 07:30:00  hardaker
+ * cvs file version number change
+ *
+ * Revision 1.2  2002/04/20 07:07:34  hardaker
+ * White space, oh glorious white space.
+ * How great our though?
+ * The code is fine.
+ * We agree on functionality easily.
+ * What really troubles us?
+ * Something we can't see.
+ * Something between the code.
+ * We bow down to your magnificence,
+ * For you are everywhere,
+ * Between everything.
+ * Pretty nothingness you are.
+ *
+ * Revision 1.1  2001/05/09 19:36:13  slif
+ * Include Alex Rozin's Rmon.
+ *
+ * Revision 1.1.2.1  2001/04/16 14:45:05  alex
+ * Rmon1 : first edition
+ *
+ */
+
+config_require(Rmon/rows)
+config_require(Rmon/agutil)
+config_require(Rmon/statistics)
+config_require(Rmon/alarm)
+config_require(Rmon/history)
+config_require(Rmon/event)
+config_add_mib(RMON-MIB)
+
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/smux/.cvsignore tomato121/release/src/router/snmp/agent/mibgroup/smux/.cvsignore
--- tomato/release/src/router/snmp/agent/mibgroup/smux/.cvsignore	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/smux/.cvsignore	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,2 @@
+.libs
+*.lo
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/smux/smux.c tomato121/release/src/router/snmp/agent/mibgroup/smux/smux.c
--- tomato/release/src/router/snmp/agent/mibgroup/smux/smux.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/smux/smux.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,1920 @@
+/*
+ * Smux module authored by Rohit Dube.
+ * Rewritten by Nick Amato <naamato@merit.net>.
+ */
+
+#include <net-snmp/net-snmp-config.h>
+#include <sys/types.h>
+#include <ctype.h>
+
+#if HAVE_IO_H                   /* win32 */
+#include <io.h>
+#endif
+#include <stdio.h>
+#if HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#if HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+#if HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#if HAVE_ERR_H
+#include <err.h>
+#endif
+#if TIME_WITH_SYS_TIME
+# ifdef WIN32
+#  include <sys/timeb.h>
+# else
+#  include <sys/time.h>
+# endif
+# include <time.h>
+#else
+# if HAVE_SYS_TIME_H
+#  include <sys/time.h>
+# else
+#  include <time.h>
+# endif
+#endif
+#include <errno.h>
+#if HAVE_NETDB_H
+#include <netdb.h>
+#endif
+
+#include <sys/stat.h>
+#if HAVE_SYS_SOCKET_H
+#include <sys/socket.h>
+#elif HAVE_WINSOCK_H
+#include <winsock.h>
+#endif
+#if HAVE_SYS_FILIO_H
+#include <sys/filio.h>
+#endif
+
+#if HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+
+#if HAVE_ARPA_INET_H
+#include <arpa/inet.h>
+#endif
+
+#if HAVE_SYS_IOCTL_H
+#include <sys/ioctl.h>
+#endif
+
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+#include "smux.h"
+#include "util_funcs.h"
+#include "mibdefs.h"
+#include "snmpd.h"
+
+long            smux_long;
+u_long          smux_ulong;
+struct sockaddr_in smux_sa;
+struct counter64 smux_counter64;
+oid             smux_objid[MAX_OID_LEN];
+u_char          smux_str[SMUXMAXSTRLEN];
+int             smux_listen_sd = -1;
+
+static struct timeval smux_rcv_timeout;
+static u_long   smux_reqid;
+
+void            init_smux(void);
+static u_char  *smux_open_process(int, u_char *, size_t *, int *);
+static u_char  *smux_rreq_process(int, u_char *, size_t *);
+static u_char  *smux_close_process(int, u_char *, size_t *);
+static u_char  *smux_trap_process(u_char *, size_t *);
+static u_char  *smux_parse(u_char *, oid *, size_t *, size_t *, u_char *);
+static u_char  *smux_parse_var(u_char *, size_t *, oid *, size_t *,
+                               size_t *, u_char *);
+static void     smux_send_close(int, int);
+static void     smux_list_detach(smux_reg **, smux_reg **);
+static void     smux_replace_active(smux_reg *, smux_reg *);
+static void     smux_peer_cleanup(int);
+static int      smux_auth_peer(oid *, size_t, char *, int);
+static int      smux_build(u_char, u_long, oid *,
+                           size_t *, u_char, u_char *, size_t, u_char *,
+                           size_t *);
+static int      smux_list_add(smux_reg **, smux_reg *);
+static int      smux_pdu_process(int, u_char *, size_t);
+static int      smux_send_rrsp(int, int);
+static smux_reg *smux_find_match(smux_reg *, int, oid *, size_t, long);
+static smux_reg *smux_find_replacement(oid *, size_t);
+u_char         *var_smux(struct variable *, oid *, size_t *, int, size_t *,
+                         WriteMethod ** write_method);
+int             var_smux_write(int, u_char *, u_char, size_t, u_char *,
+                               oid *, size_t);
+
+static smux_reg *ActiveRegs;    /* Active registrations                 */
+static smux_reg *PassiveRegs;   /* Currently unused registrations       */
+
+static smux_peer_auth *Auths[SMUX_MAX_PEERS];   /* Configured peers */
+static int      nauths, npeers = 0;
+
+struct variable2 smux_variables[] = {
+    /*
+     * bogus entry, as in pass.c 
+     */
+    {MIBINDEX, ASN_INTEGER, RWRITE, var_smux, 0, {MIBINDEX}},
+};
+
+
+
+void
+smux_parse_peer_auth(const char *token, char *cptr)
+{
+    smux_peer_auth *aptr;
+
+    if ((aptr =
+         (smux_peer_auth *) calloc(1, sizeof(smux_peer_auth))) == NULL) {
+        snmp_log_perror("smux_parse_peer_auth: malloc");
+        return;
+    }
+    aptr->sa_active_fd = -1;
+    if (!cptr) {
+        /*
+         * null passwords OK 
+         */
+        Auths[nauths++] = aptr;
+        DEBUGMSGTL(("smux_conf", "null password\n"));
+        return;
+    }
+
+    if (*cptr == '.')
+        cptr++;
+
+    if (!isdigit(*cptr)) {
+        config_perror("second token is not an OID");
+        free((char *) aptr);
+        return;
+    }
+    /*
+     * oid 
+     */
+    aptr->sa_oid_len = parse_miboid(cptr, aptr->sa_oid);
+
+    DEBUGMSGTL(("smux_conf", "parsing registration for: %s\n", cptr));
+
+    while (isdigit(*cptr) || *cptr == '.')
+        cptr++;
+    cptr = skip_white(cptr);
+
+    /*
+     * password 
+     */
+    if (cptr)
+        strcpy(aptr->sa_passwd, cptr);
+
+    Auths[nauths++] = aptr;
+}
+
+void
+smux_free_peer_auth(void)
+{
+    int             i;
+
+    for (i = 0; i < nauths; i++) {
+        free(Auths[i]);
+        Auths[i] = NULL;
+    }
+    nauths = 0;
+}
+
+void
+init_smux(void)
+{
+
+    struct sockaddr_in lo_socket;
+    int             one = 1;
+
+    if (netsnmp_ds_get_boolean(NETSNMP_DS_APPLICATION_ID, NETSNMP_DS_AGENT_ROLE) == SUB_AGENT) {
+        smux_listen_sd = -1;
+        return;
+    }
+
+    snmpd_register_config_handler("smuxpeer", smux_parse_peer_auth,
+                                  smux_free_peer_auth,
+                                  "OID-IDENTITY PASSWORD");
+    /*
+     * Reqid 
+     */
+    smux_reqid = 0;
+    smux_listen_sd = -1;
+
+    /*
+     * Receive timeout 
+     */
+    smux_rcv_timeout.tv_sec = 0;
+    smux_rcv_timeout.tv_usec = 500000;
+
+    /*
+     * Get ready to listen on the SMUX port
+     */
+    memset(&lo_socket, (0), sizeof(lo_socket));
+    lo_socket.sin_family = AF_INET;
+    lo_socket.sin_port = htons((u_short) SMUXPORT);
+
+    if ((smux_listen_sd = socket(AF_INET, SOCK_STREAM, 0)) < 0) {
+        snmp_log_perror("[init_smux] socket failed");
+        return;
+    }
+#ifdef SO_REUSEADDR
+    /*
+     * At least on Linux, when the master agent terminates, any
+     * TCP connections for SMUX peers are put in the TIME_WAIT
+     * state for about 60 seconds. If the master agent is started
+     * during this time, the bind for the listening socket will
+     * fail because the SMUX port is in use.
+     */
+    if (setsockopt(smux_listen_sd, SOL_SOCKET, SO_REUSEADDR, (char *) &one,
+                   sizeof(one)) < 0) {
+        snmp_log_perror("[init_smux] setsockopt(SO_REUSEADDR) failed");
+    }
+#endif                          /* SO_REUSEADDR */
+
+    if (bind(smux_listen_sd, (struct sockaddr *) &lo_socket,
+             sizeof(lo_socket)) < 0) {
+        snmp_log_perror("[init_smux] bind failed");
+        close(smux_listen_sd);
+        smux_listen_sd = -1;
+        return;
+    }
+#ifdef	SO_KEEPALIVE
+    if (setsockopt(smux_listen_sd, SOL_SOCKET, SO_KEEPALIVE, (char *) &one,
+                   sizeof(one)) < 0) {
+        snmp_log_perror("[init_smux] setsockopt(SO_KEEPALIVE) failed");
+        close(smux_listen_sd);
+        smux_listen_sd = -1;
+        return;
+    }
+#endif                          /* SO_KEEPALIVE */
+
+    if (listen(smux_listen_sd, SOMAXCONN) == -1) {
+        snmp_log_perror("[init_smux] listen failed");
+        close(smux_listen_sd);
+        smux_listen_sd = -1;
+        return;
+    }
+
+    DEBUGMSGTL(("smux_init",
+                "[smux_init] done; smux listen sd is %d, smux port is %d\n",
+                smux_listen_sd, ntohs(lo_socket.sin_port)));
+}
+
+u_char         *
+var_smux(struct variable * vp,
+         oid * name,
+         size_t * length,
+         int exact, size_t * var_len, WriteMethod ** write_method)
+{
+    u_char         *valptr, val_type;
+    smux_reg       *rptr;
+
+    *write_method = var_smux_write;
+    /*
+     * search the active registration list 
+     */
+    for (rptr = ActiveRegs; rptr; rptr = rptr->sr_next) {
+        if (0 >= snmp_oidtree_compare(vp->name, vp->namelen, rptr->sr_name,
+                                      rptr->sr_name_len))
+            break;
+    }
+    if (rptr == NULL)
+        return NULL;
+    else if (exact && (*length < rptr->sr_name_len))
+        return NULL;
+
+    valptr = smux_snmp_process(exact, name, length,
+                               var_len, &val_type, rptr->sr_fd);
+
+    if (valptr == NULL)
+        return NULL;
+
+    if ((snmp_oidtree_compare(name, *length, rptr->sr_name,
+                              rptr->sr_name_len)) != 0) {
+        /*
+         * the peer has returned a value outside
+         * * of the registered tree
+         */
+        return NULL;
+    } else {
+        /*
+         * set the type and return the value 
+         */
+        vp->type = val_type;
+        return valptr;
+    }
+}
+
+int
+var_smux_write(int action,
+               u_char * var_val,
+               u_char var_val_type,
+               size_t var_val_len,
+               u_char * statP, oid * name, size_t name_len)
+{
+    smux_reg       *rptr;
+    u_char          buf[SMUXMAXPKTSIZE], *ptr, sout[3], type;
+    int             reterr;
+    size_t          var_len, datalen, name_length, packet_len;
+    int             len;
+    long            reqid, errsts, erridx;
+    u_char          var_type, *dataptr;
+
+    DEBUGMSGTL(("smux", "[var_smux_write] entering var_smux_write\n"));
+
+    len = SMUXMAXPKTSIZE;
+    reterr = SNMP_ERR_NOERROR;
+    var_len = var_val_len;
+    var_type = var_val_type;
+    name_length = name_len;
+
+    /*
+     * XXX find the descriptor again 
+     */
+    for (rptr = ActiveRegs; rptr; rptr = rptr->sr_next) {
+        if (!snmp_oidtree_compare(name, name_len, rptr->sr_name,
+                                  rptr->sr_name_len))
+            break;
+    }
+
+    switch (action) {
+    case RESERVE1:
+        DEBUGMSGTL(("smux", "[var_smux_write] entering RESERVE1\n"));
+
+        /*
+         * length might be long 
+         */
+        var_len += (*(var_val + 1) & ASN_LONG_LEN) ?
+            var_len + ((*(var_val + 1) & 0x7F) + 2) : 2;
+
+        switch (var_val_type) {
+        case ASN_INTEGER:
+        case ASN_OCTET_STR:
+        case ASN_COUNTER:
+        case ASN_GAUGE:
+        case ASN_TIMETICKS:
+        case ASN_UINTEGER:
+        case ASN_COUNTER64:
+        case ASN_IPADDRESS:
+        case ASN_OPAQUE:
+        case ASN_NSAP:
+        case ASN_OBJECT_ID:
+        case ASN_BIT_STR:
+            datalen = var_val_len;
+            dataptr = var_val;
+            break;
+        case SNMP_NOSUCHOBJECT:
+        case SNMP_NOSUCHINSTANCE:
+        case SNMP_ENDOFMIBVIEW:
+        case ASN_NULL:
+        default:
+            DEBUGMSGTL(("smux",
+                        "[var_smux_write] variable not supported\n"));
+            return SNMP_ERR_GENERR;
+            break;
+        }
+
+        if ((smux_build((u_char) SMUX_SET, smux_reqid,
+                        name, &name_length, var_val_type, dataptr,
+                        datalen, buf, &len)) < 0) {
+            DEBUGMSGTL(("smux", "[var_smux_write] smux build failed\n"));
+            return SNMP_ERR_GENERR;
+        }
+
+        if (send(rptr->sr_fd, buf, len, 0) < 0) {
+            DEBUGMSGTL(("smux", "[var_smux_write] send failed\n"));
+            return SNMP_ERR_GENERR;
+        }
+
+        while (1) {
+            /*
+             * peek at what's received 
+             */
+            if ((len = recv(rptr->sr_fd, buf,
+                            SMUXMAXPKTSIZE, MSG_PEEK)) <= 0) {
+                DEBUGMSGTL(("smux",
+                            "[var_smux_write] peek failed or timed out\n"));
+                /*
+                 * do we need to do a peer cleanup in this case?? 
+                 */
+                smux_peer_cleanup(rptr->sr_fd);
+                return SNMP_ERR_GENERR;
+            }
+
+            DEBUGMSGTL(("smux", "[var_smux_write] Peeked at %d bytes\n",
+                        len));
+            DEBUGDUMPSETUP("var_smux_write", buf, len);
+
+            /*
+             * determine if we received more than one packet 
+             */
+            packet_len = len;
+            ptr = asn_parse_header(buf, &packet_len, &type);
+            packet_len += (ptr - buf);
+            if (len > packet_len) {
+                /*
+                 * set length to receive only the first packet 
+                 */
+                len = packet_len;
+            }
+
+            /*
+             * receive the first packet 
+             */
+            if ((len = recv(rptr->sr_fd, buf, len, 0)) <= 0) {
+                DEBUGMSGTL(("smux",
+                            "[var_smux_write] recv failed or timed out\n"));
+                /*
+                 * do we need to do a peer cleanup in this case?? 
+                 */
+                smux_peer_cleanup(rptr->sr_fd);
+                return SNMP_ERR_GENERR;
+            }
+
+            DEBUGMSGTL(("smux", "[var_smux_write] Received %d bytes\n",
+                        len));
+
+            if (buf[0] == SMUX_TRAP) {
+                DEBUGMSGTL(("smux", "[var_smux_write] Received trap\n"));
+                snmp_log(LOG_INFO, "Got trap from peer on fd %d\n",
+                         rptr->sr_fd);
+                ptr = asn_parse_header(buf, &len, &type);
+                smux_trap_process(ptr, &len);
+
+
+                /*
+                 * go and peek at received data again 
+                 */
+                /*
+                 * we could receive the reply or another trap 
+                 */
+            } else {
+                ptr = buf;
+                ptr = asn_parse_header(ptr, &len, &type);
+                if ((ptr == NULL) || type != SNMP_MSG_RESPONSE)
+                    return SNMP_ERR_GENERR;
+
+                ptr =
+                    asn_parse_int(ptr, &len, &type, &reqid, sizeof(reqid));
+                if ((ptr == NULL) || type != ASN_INTEGER)
+                    return SNMP_ERR_GENERR;
+
+                ptr =
+                    asn_parse_int(ptr, &len, &type, &errsts,
+                                  sizeof(errsts));
+                if ((ptr == NULL) || type != ASN_INTEGER)
+                    return SNMP_ERR_GENERR;
+
+                if (errsts) {
+                    DEBUGMSGTL(("smux",
+                                "[var_smux_write] errsts returned\n"));
+                    return (errsts);
+                }
+
+                ptr =
+                    asn_parse_int(ptr, &len, &type, &erridx,
+                                  sizeof(erridx));
+                if ((ptr == NULL) || type != ASN_INTEGER)
+                    return SNMP_ERR_GENERR;
+
+                reterr = SNMP_ERR_NOERROR;
+                break;
+            }
+        }                       /* while (1) */
+        break;                  /* case Action == RESERVE1 */
+
+    case RESERVE2:
+        DEBUGMSGTL(("smux", "[var_smux_write] entering RESERVE2\n"));
+        reterr = SNMP_ERR_NOERROR;
+        break;                  /* case Action == RESERVE2 */
+
+    case FREE:
+    case COMMIT:
+        ptr = sout;
+        *(ptr++) = (u_char) SMUX_SOUT;
+        *(ptr++) = (u_char) 1;
+        if (action == FREE) {
+            *ptr = (u_char) 1;  /* rollback */
+            DEBUGMSGTL(("smux",
+                        "[var_smux_write] entering FREE - sending RollBack \n"));
+        } else {
+            *ptr = (u_char) 0;  /* commit */
+            DEBUGMSGTL(("smux",
+                        "[var_smux_write] entering FREE - sending Commit \n"));
+        }
+
+        if ((send(rptr->sr_fd, sout, 3, 0)) < 0) {
+            DEBUGMSGTL(("smux",
+                        "[var_smux_write] send rollback/commit failed\n"));
+            return SNMP_ERR_GENERR;
+        }
+
+        reterr = SNMP_ERR_NOERROR;
+        break;                  /* case Action == COMMIT */
+
+    default:
+        break;
+    }
+    return reterr;
+}
+
+
+int
+smux_accept(int sd)
+{
+    u_char          data[SMUXMAXPKTSIZE], *ptr, type;
+    struct sockaddr_in in_socket;
+    struct timeval  tv;
+    int             fail, fd, alen;
+    int             length, len;
+
+    alen = sizeof(struct sockaddr_in);
+    /*
+     * this may be too high 
+     */
+    tv.tv_sec = 5;
+    tv.tv_usec = 0;
+
+    /*
+     * connection request 
+     */
+    DEBUGMSGTL(("smux", "[smux_accept] Calling accept()\n"));
+    errno = 0;
+    if ((fd = accept(sd, (struct sockaddr *) &in_socket, &alen)) < 0) {
+        snmp_log_perror("[smux_accept] accept failed");
+        return -1;
+    } else {
+        snmp_log(LOG_INFO, "[smux_accept] accepted fd %d from %s:%d\n",
+                 fd, inet_ntoa(in_socket.sin_addr),
+                 ntohs(in_socket.sin_port));
+        if (npeers + 1 == SMUXMAXPEERS) {
+            snmp_log(LOG_ERR,
+                     "[smux_accept] denied peer on fd %d, limit %d reached",
+                     fd, SMUXMAXPEERS);
+            close(sd);
+            return -1;
+        }
+
+        /*
+         * now block for an OpenPDU 
+         */
+        if ((length = recv(fd, (char *) data, SMUXMAXPKTSIZE, 0)) <= 0) {
+            DEBUGMSGTL(("smux",
+                        "[smux_accept] peer on fd %d died or timed out\n",
+                        fd));
+            close(fd);
+            return -1;
+        }
+        /*
+         * try to authorize him 
+         */
+        ptr = data;
+        len = length;
+        if ((ptr = asn_parse_header(ptr, &len, &type)) == NULL) {
+            smux_send_close(fd, SMUXC_PACKETFORMAT);
+            close(fd);
+            DEBUGMSGTL(("smux", "[smux_accept] peer on %d sent bad open"));
+            return -1;
+        } else if (type != (u_char) SMUX_OPEN) {
+            smux_send_close(fd, SMUXC_PROTOCOLERROR);
+            close(fd);
+            DEBUGMSGTL(("smux",
+                        "[smux_accept] peer on %d did not send open: (%d)\n",
+                        type));
+            return -1;
+        }
+        ptr = smux_open_process(fd, ptr, &len, &fail);
+        if (fail) {
+            smux_send_close(fd, SMUXC_AUTHENTICATIONFAILURE);
+            close(fd);
+            DEBUGMSGTL(("smux",
+                        "[smux_accept] peer on %d failed authentication\n",
+                        fd));
+            return -1;
+        }
+
+        /*
+         * he's OK 
+         */
+#ifdef SO_RCVTIMEO
+        if (setsockopt
+            (fd, SOL_SOCKET, SO_RCVTIMEO, (void *) &tv, sizeof(tv)) < 0) {
+            DEBUGMSGTL(("smux",
+                        "[smux_accept] setsockopt(SO_RCVTIMEO) failed fd %d\n",
+                        fd));
+            snmp_log_perror("smux_accept: setsockopt SO_RCVTIMEO");
+        }
+#endif
+        npeers++;
+        DEBUGMSGTL(("smux", "[smux_accept] fd %d\n", fd));
+
+        /*
+         * Process other PDUs already read, e.g. a registerRequest. 
+         */
+        len = length - (ptr - data);
+        if (smux_pdu_process(fd, ptr, len) < 0) {
+            /*
+             * Easy come, easy go.  Clean-up is already done. 
+             */
+            return -1;
+        }
+    }
+    return fd;
+}
+
+int
+smux_process(int fd)
+{
+    int             length;
+    u_char          data[SMUXMAXPKTSIZE];
+
+    length = recv(fd, (char *) data, SMUXMAXPKTSIZE, 0);
+    if (length <= 0) {
+        /*
+         * the peer went away, close this descriptor 
+         * * and delete it from the list
+         */
+        DEBUGMSGTL(("smux",
+                    "[smux_process] peer on fd %d died or timed out\n",
+                    fd));
+        smux_peer_cleanup(fd);
+        return -1;
+    }
+
+    return smux_pdu_process(fd, data, length);
+}
+
+static int
+smux_pdu_process(int fd, u_char * data, size_t length)
+{
+    int             error;
+    size_t          len;
+    u_char         *ptr, type;
+
+    DEBUGMSGTL(("smux", "[smux_pdu_process] Processing %d bytes\n",
+                length));
+
+    error = 0;
+    ptr = data;
+    while (error == 0 && ptr != NULL && ptr < data + length) {
+        len = length - (ptr - data);
+        ptr = asn_parse_header(ptr, &len, &type);
+        DEBUGMSGTL(("smux", "[smux_pdu_process] type is %d\n",
+                    (int) type));
+        switch (type) {
+        case SMUX_OPEN:
+            smux_send_close(fd, SMUXC_PROTOCOLERROR);
+            DEBUGMSGTL(("smux",
+                        "[smux_pdu_process] peer on fd %d sent duplicate open?\n",
+                        fd));
+            smux_peer_cleanup(fd);
+            error = -1;
+            break;
+        case SMUX_CLOSE:
+            ptr = smux_close_process(fd, ptr, &len);
+            smux_peer_cleanup(fd);
+            error = -1;
+            break;
+        case SMUX_RREQ:
+            ptr = smux_rreq_process(fd, ptr, &len);
+            break;
+        case SMUX_RRSP:
+            error = -1;
+            smux_send_close(fd, SMUXC_PROTOCOLERROR);
+            smux_peer_cleanup(fd);
+            DEBUGMSGTL(("smux",
+                        "[smux_pdu_process] peer on fd %d sent RRSP!\n",
+                        fd));
+            break;
+        case SMUX_SOUT:
+            error = -1;
+            smux_send_close(fd, SMUXC_PROTOCOLERROR);
+            smux_peer_cleanup(fd);
+            DEBUGMSGTL(("smux", "This shouldn't have happened!\n"));
+            break;
+        case SMUX_TRAP:
+            snmp_log(LOG_INFO, "Got trap from peer on fd %d\n", fd);
+            ptr = smux_trap_process(ptr, &len);
+            /*
+             * watch out for close on top of this...should return correct end 
+             */
+            /*
+             * debug this... 
+             */
+            ptr = NULL;
+            break;
+        default:
+            smux_send_close(fd, SMUXC_PACKETFORMAT);
+            smux_peer_cleanup(fd);
+            DEBUGMSGTL(("smux", "[smux_pdu_process] Wrong type %d\n",
+                        (int) type));
+            error = -1;
+            break;
+        }
+    }
+    return error;
+}
+
+static u_char  *
+smux_open_process(int fd, u_char * ptr, size_t * len, int *fail)
+{
+    u_char          type;
+    long            version;
+    oid             oid_name[MAX_OID_LEN];
+    char            passwd[SMUXMAXSTRLEN];
+    char            descr[SMUXMAXSTRLEN];
+    char            oid_print[SMUXMAXSTRLEN];
+    int             i;
+    size_t          oid_name_len, string_len;
+
+    if (!(ptr = asn_parse_int(ptr, len, &type, &version, sizeof(version)))) {
+        DEBUGMSGTL(("smux", "[smux_open_process] version parse failed\n"));
+        *fail = TRUE;
+        return ((ptr += *len));
+    }
+    DEBUGMSGTL(("smux",
+                "[smux_open_process] version %d, len %d, type %d\n",
+                version, *len, (int) type));
+
+    oid_name_len = MAX_OID_LEN;
+    if ((ptr = asn_parse_objid(ptr, len, &type, oid_name,
+                               &oid_name_len)) == NULL) {
+        DEBUGMSGTL(("smux", "[smux_open_process] oid parse failed\n"));
+        *fail = TRUE;
+        return ((ptr += *len));
+    }
+    snprint_objid(oid_print, sizeof(oid_print), oid_name, oid_name_len);
+
+    if (snmp_get_do_debugging()) {
+        DEBUGMSGTL(("smux", "[smux_open_process] smux peer: %s\n",
+                    oid_print));
+        DEBUGMSGTL(("smux", "[smux_open_process] len %d, type %d\n", *len,
+                    (int) type));
+    }
+
+    string_len = SMUXMAXSTRLEN;
+    if ((ptr = asn_parse_string(ptr, len, &type, (u_char *) descr,
+                                &string_len)) == NULL) {
+        DEBUGMSGTL(("smux", "[smux_open_process] descr parse failed\n"));
+        *fail = TRUE;
+        return ((ptr += *len));
+    }
+
+    if (snmp_get_do_debugging()) {
+        DEBUGMSGTL(("smux", "[smux_open_process] smux peer descr: "));
+        for (i = 0; i < (int) string_len; i++)
+            DEBUGMSG(("smux", "%c", descr[i]));
+        DEBUGMSG(("smux", "\n"));
+        DEBUGMSGTL(("smux", "[smux_open_process] len %d, type %d\n", *len,
+                    (int) type));
+    }
+    descr[string_len] = 0;
+
+    string_len = SMUXMAXSTRLEN;
+    if ((ptr = asn_parse_string(ptr, len, &type, (u_char *) passwd,
+                                &string_len)) == NULL) {
+        DEBUGMSGTL(("smux", "[smux_open_process] passwd parse failed\n"));
+        *fail = TRUE;
+        return ((ptr += *len));
+    }
+
+    if (snmp_get_do_debugging()) {
+        DEBUGMSGTL(("smux", "[smux_open_process] smux peer passwd: "));
+        for (i = 0; i < (int) string_len; i++)
+            DEBUGMSG(("smux", "%c", passwd[i]));
+        DEBUGMSG(("smux", "\n"));
+        DEBUGMSGTL(("smux", "[smux_open_process] len %d, type %d\n", *len,
+                    (int) type));
+    }
+    passwd[string_len] = '\0';
+    if (!smux_auth_peer(oid_name, oid_name_len, passwd, fd)) {
+        snmp_log(LOG_WARNING,
+                 "refused smux peer: oid %s, password %s, descr %s\n",
+                 oid_print, passwd, descr);
+        *fail = TRUE;
+        return ptr;
+    }
+    snmp_log(LOG_INFO,
+             "accepted smux peer: oid %s, password %s, descr %s\n",
+             oid_print, passwd, descr);
+    *fail = FALSE;
+    return ptr;
+}
+
+static void
+smux_send_close(int fd, int reason)
+{
+    u_char          outpacket[3], *ptr;
+
+    ptr = outpacket;
+
+    *(ptr++) = (u_char) SMUX_CLOSE;
+    *(ptr++) = (u_char) 1;
+    *ptr = (u_char) (reason & 0xFF);
+
+    if (snmp_get_do_debugging())
+        DEBUGMSGTL(("smux",
+                    "[smux_close] sending close to fd %d, reason %d\n", fd,
+                    reason));
+
+    /*
+     * send a response back 
+     */
+    if (send(fd, (char *) outpacket, 3, 0) < 0) {
+        snmp_log_perror("[smux_snmp_close] send failed");
+    }
+}
+
+
+static int
+smux_auth_peer(oid * name, size_t namelen, char *passwd, int fd)
+{
+    int             i;
+
+    for (i = 0; i < nauths; i++) {
+        if (snmp_oid_compare(Auths[i]->sa_oid, Auths[i]->sa_oid_len,
+                             name, namelen) == 0) {
+            if (!(strcmp(Auths[i]->sa_passwd, passwd)) &&
+                (Auths[i]->sa_active_fd == -1)) {
+                /*
+                 * matched, mark the auth 
+                 */
+                Auths[i]->sa_active_fd = fd;
+                return 1;
+            }
+        }
+    }
+    /*
+     * did not match oid and passwd 
+     */
+    return 0;
+}
+
+
+/*
+ * XXX - Bells and Whistles:
+ * Need to catch signal when snmpd goes down and send close pdu to gated 
+ */
+static u_char  *
+smux_close_process(int fd, u_char * ptr, size_t * len)
+{
+    long            down = 0;
+    int             length = *len;
+
+    /*
+     * This is the integer part of the close pdu 
+     */
+    while (length--) {
+        down = (down << 8) | (long) *ptr;
+        ptr++;
+    }
+
+    DEBUGMSGTL(("smux",
+                "[smux_close_process] close from peer on fd %d reason %d\n",
+                fd, down));
+    smux_peer_cleanup(fd);
+
+    return NULL;
+}
+
+static u_char  *
+smux_rreq_process(int sd, u_char * ptr, size_t * len)
+{
+    long            priority, rpriority;
+    long            operation;
+    oid             oid_name[MAX_OID_LEN];
+    size_t          oid_name_len;
+    int             i, result;
+    u_char          type;
+    smux_reg       *rptr, *nrptr;
+
+    oid_name_len = MAX_OID_LEN;
+    ptr = asn_parse_objid(ptr, len, &type, oid_name, &oid_name_len);
+
+    DEBUGMSGTL(("smux", "[smux_rreq_process] smux subtree: "));
+    DEBUGMSGOID(("smux", oid_name, oid_name_len));
+    DEBUGMSG(("smux", "\n"));
+
+    if ((ptr = asn_parse_int(ptr, len, &type, &priority,
+                             sizeof(priority))) == NULL) {
+        DEBUGMSGTL(("smux",
+                    "[smux_rreq_process] priority parse failed\n"));
+        smux_send_rrsp(sd, -1);
+        return NULL;
+    }
+    DEBUGMSGTL(("smux", "[smux_rreq_process] priority %d\n", priority));
+
+    if ((ptr = asn_parse_int(ptr, len, &type, &operation,
+                             sizeof(operation))) == NULL) {
+        DEBUGMSGTL(("smux",
+                    "[smux_rreq_process] operation parse failed\n"));
+        smux_send_rrsp(sd, -1);
+        return NULL;
+    }
+    DEBUGMSGTL(("smux", "[smux_rreq_process] operation %d\n", operation));
+
+    if (operation == SMUX_REGOP_DELETE) {
+        /*
+         * search the active list for this registration 
+         */
+        rptr =
+            smux_find_match(ActiveRegs, sd, oid_name, oid_name_len,
+                            priority);
+        if (rptr) {
+            rpriority = rptr->sr_priority;
+            /*
+             * unregister the mib 
+             */
+            unregister_mib(rptr->sr_name, rptr->sr_name_len);
+            /*
+             * find a replacement 
+             */
+            nrptr =
+                smux_find_replacement(rptr->sr_name, rptr->sr_name_len);
+            if (nrptr) {
+                /*
+                 * found one 
+                 */
+                smux_replace_active(rptr, nrptr);
+            } else {
+                /*
+                 * no replacement found 
+                 */
+                smux_list_detach(&ActiveRegs, &rptr);
+                free(rptr);
+            }
+            smux_send_rrsp(sd, rpriority);
+            return ptr;
+        }
+        /*
+         * search the passive list for this registration 
+         */
+        rptr =
+            smux_find_match(PassiveRegs, sd, oid_name, oid_name_len,
+                            priority);
+        if (rptr) {
+            rpriority = rptr->sr_priority;
+            smux_list_detach(&PassiveRegs, &rptr);
+            free(rptr);
+            smux_send_rrsp(sd, rpriority);
+            return ptr;
+        }
+        /*
+         * This peer cannot unregister the tree, it does not
+         * * belong to him.  Send him an error.
+         */
+        smux_send_rrsp(sd, -1);
+        return ptr;
+
+    } else if ((operation == SMUX_REGOP_REGISTER_RO) ||
+               (operation == SMUX_REGOP_REGISTER_RW)) {
+        if (priority < -1) {
+            DEBUGMSGTL(("smux",
+                        "[smux_rreq_process] peer fd %d invalid priority",
+                        sd, priority));
+            smux_send_rrsp(sd, -1);
+            return NULL;
+        }
+        if ((nrptr = malloc(sizeof(smux_reg))) == NULL) {
+            snmp_log_perror("[smux_rreq_process] malloc");
+            smux_send_rrsp(sd, -1);
+            return NULL;
+        }
+        nrptr->sr_priority = priority;
+        nrptr->sr_name_len = oid_name_len;
+        nrptr->sr_fd = sd;
+        for (i = 0; i < (int) oid_name_len; i++)
+            nrptr->sr_name[i] = oid_name[i];
+
+        /*
+         * See if this tree matches or scopes any of the
+         * * active trees.
+         */
+        for (rptr = ActiveRegs; rptr; rptr = rptr->sr_next) {
+            result =
+                snmp_oid_compare(oid_name, oid_name_len, rptr->sr_name,
+                                 rptr->sr_name_len);
+            if (result == 0) {
+                if ((oid_name_len == rptr->sr_name_len)) {
+                    if ((nrptr->sr_priority == -1)) {
+                        nrptr->sr_priority = rptr->sr_priority;
+                        do {
+                            nrptr->sr_priority++;
+                        } while (smux_list_add(&PassiveRegs, nrptr));
+                        goto done;
+                    } else if (nrptr->sr_priority < rptr->sr_priority) {
+                        /*
+                         * Better priority.  There are no better
+                         * * priorities for this tree in the passive list,
+                         * * so replace the current active tree.
+                         */
+                        smux_replace_active(rptr, nrptr);
+                        goto done;
+                    } else {
+                        /*
+                         * Equal or worse priority 
+                         */
+                        do {
+                            nrptr->sr_priority++;
+                        } while (smux_list_add(&PassiveRegs, nrptr) == -1);
+                        goto done;
+                    }
+                } else if (oid_name_len < rptr->sr_name_len) {
+                    /*
+                     * This tree scopes a current active
+                     * * tree.  Replace the current active tree.
+                     */
+                    smux_replace_active(rptr, nrptr);
+                    goto done;
+                } else {        /* oid_name_len > rptr->sr_name_len */
+                    /*
+                     * This tree is scoped by a current
+                     * * active tree.  
+                     */
+                    do {
+                        nrptr->sr_priority++;
+                    } while (smux_list_add(&PassiveRegs, nrptr) == -1);
+                    goto done;
+                }
+            }
+        }
+        /*
+         * We didn't find it in the active list.  Add it at
+         * * the requested priority.
+         */
+        if (nrptr->sr_priority == -1)
+            nrptr->sr_priority = 0;
+        smux_list_add(&ActiveRegs, nrptr);
+        register_mib("smux", (struct variable *)
+                     smux_variables, sizeof(struct variable2),
+                     1, nrptr->sr_name, nrptr->sr_name_len);
+      done:
+        smux_send_rrsp(sd, nrptr->sr_priority);
+        return ptr;
+    } else {
+        DEBUGMSGTL(("smux", "[smux_rreq_process] unknown operation\n"));
+        smux_send_rrsp(sd, -1);
+        return NULL;
+    }
+}
+
+/*
+ * Find the registration with a matching descriptor, OID and priority.  If
+ * the priority is -1 then find a registration with a matching descriptor,
+ * a matching OID, and the highest priority.
+ */
+static smux_reg *
+smux_find_match(smux_reg * regs, int sd, oid * oid_name,
+                size_t oid_name_len, long priority)
+{
+    smux_reg       *rptr, *bestrptr;
+
+    bestrptr = NULL;
+    for (rptr = regs; rptr; rptr = rptr->sr_next) {
+        if (rptr->sr_fd != sd)
+            continue;
+        if (snmp_oid_compare
+            (rptr->sr_name, rptr->sr_name_len, oid_name, oid_name_len))
+            continue;
+        if (rptr->sr_priority == priority)
+            return rptr;
+        if (priority != -1)
+            continue;
+        if (bestrptr) {
+            if (bestrptr->sr_priority > rptr->sr_priority)
+                bestrptr = rptr;
+        } else {
+            bestrptr = rptr;
+        }
+    }
+    return bestrptr;
+}
+
+static void
+smux_replace_active(smux_reg * actptr, smux_reg * pasptr)
+{
+    smux_list_detach(&ActiveRegs, &actptr);
+    unregister_mib(actptr->sr_name, actptr->sr_name_len);
+
+    smux_list_detach(&PassiveRegs, &pasptr);
+    (void) smux_list_add(&ActiveRegs, pasptr);
+
+    register_mib("smux", (struct variable *) smux_variables,
+                 sizeof(struct variable2), 1, pasptr->sr_name,
+                 pasptr->sr_name_len);
+    free(actptr);
+}
+
+static void
+smux_list_detach(smux_reg ** head, smux_reg ** m_remove)
+{
+    smux_reg       *rptr, *rptr2;
+
+    if (*head == NULL) {
+        DEBUGMSGTL(("smux", "[smux_list_detach] Ouch!"));
+        return;
+    }
+    if (*head == *m_remove) {
+        *m_remove = *head;
+        *head = (*head)->sr_next;
+        return;
+    }
+    for (rptr = *head, rptr2 = rptr->sr_next; rptr2;
+         rptr2 = rptr2->sr_next, rptr = rptr->sr_next) {
+        if (rptr2 == *m_remove) {
+            *m_remove = rptr2;
+            rptr->sr_next = rptr2->sr_next;
+            return;
+        }
+    }
+}
+
+/*
+ * Attempt to add a registration (in order) to a list.  If the
+ * add fails (because of an existing registration with equal
+ * priority) return -1.
+ */
+static int
+smux_list_add(smux_reg ** head, smux_reg * add)
+{
+    smux_reg       *rptr;
+    int             result;
+
+    if (*head == NULL) {
+        *head = add;
+        (*head)->sr_next = NULL;
+        return 0;
+    }
+    for (rptr = *head; rptr->sr_next; rptr = rptr->sr_next) {
+        result = snmp_oid_compare(add->sr_name, add->sr_name_len,
+                                  rptr->sr_name, rptr->sr_name_len);
+        if ((result == 0) && (add->sr_priority == rptr->sr_priority)) {
+            /*
+             * same tree, same pri, nope 
+             */
+            return -1;
+        } else if (result < 0) {
+            /*
+             * this can only happen if we go before the head 
+             */
+            add->sr_next = *head;
+            *head = add;
+            return 0;
+        } else if ((snmp_oid_compare(add->sr_name, add->sr_name_len,
+                                     rptr->sr_next->sr_name,
+                                     rptr->sr_next->sr_name_len)) < 0) {
+            /*
+             * insert here 
+             */
+            add->sr_next = rptr->sr_next;
+            rptr->sr_next = add;
+            return 0;
+        }
+    }
+    /*
+     * compare the last one 
+     */
+    if ((snmp_oid_compare(add->sr_name, add->sr_name_len, rptr->sr_name,
+                          rptr->sr_name_len) == 0)
+        && add->sr_priority == rptr->sr_priority)
+        return -1;
+    else {
+        rptr->sr_next = add;
+        add->sr_next = NULL;
+    }
+    return 0;
+}
+
+/*
+ * Find a replacement for this registration.  In order
+ * of preference:
+ *
+ *      - Least difference in subtree length
+ *      - Best (lowest) priority
+ *
+ * For example, if we need to replace .1.3.6.1.69, 
+ * we would pick .1.3.6.1.69.1 instead of .1.3.6.69.1.1
+ *
+ */
+static smux_reg *
+smux_find_replacement(oid * name, size_t name_len)
+{
+    smux_reg       *rptr, *bestptr;
+    int             bestlen, difflen;
+
+    bestlen = SMUX_MAX_PRIORITY;
+    bestptr = NULL;
+
+    for (rptr = PassiveRegs; rptr; rptr = rptr->sr_next) {
+        if (!snmp_oidtree_compare(rptr->sr_name, rptr->sr_name_len,
+                                  name, name_len)) {
+            if ((difflen = rptr->sr_name_len - name_len)
+                < bestlen) {
+                bestlen = difflen;
+                bestptr = rptr;
+            } else if ((difflen == bestlen) &&
+                       (rptr->sr_priority < bestptr->sr_priority))
+                bestptr = rptr;
+        }
+    }
+    return bestptr;
+}
+
+u_char         *
+smux_snmp_process(int exact,
+                  oid * objid,
+                  size_t * len,
+                  size_t * return_len, u_char * return_type, int sd)
+{
+    u_char          packet[SMUXMAXPKTSIZE], *ptr, result[SMUXMAXPKTSIZE];
+    size_t          length = SMUXMAXPKTSIZE;
+    u_char          type;
+    size_t          packet_len;
+
+    /*
+     * Send the query to the peer
+     */
+    smux_reqid++;
+
+    if (exact)
+        type = SMUX_GET;
+    else
+        type = SMUX_GETNEXT;
+
+    if (smux_build(type, smux_reqid, objid, len, 0, NULL,
+                   *len, packet, &length) < 0) {
+        snmp_log(LOG_ERR, "[smux_snmp_process]: smux_build failed\n");
+        return NULL;
+    }
+    DEBUGMSGTL(("smux", "[smux_snmp_process] oid from build: "));
+    DEBUGMSGOID(("smux", objid, *len));
+    DEBUGMSG(("smux", "\n"));
+
+    if (send(sd, (char *) packet, length, 0) < 0) {
+        snmp_log_perror("[smux_snmp_process] send failed");
+    }
+
+    DEBUGMSGTL(("smux",
+                "[smux_snmp_process] Sent %d request to peer; %d bytes\n",
+                (int) type, length));
+
+    while (1) {
+        /*
+         * peek at what's received 
+         */
+        length = recv(sd, (char *) result, SMUXMAXPKTSIZE, MSG_PEEK);
+        if (length < 0) {
+            snmp_log_perror("[smux_snmp_process] peek failed");
+            smux_peer_cleanup(sd);
+            return NULL;
+        }
+
+        DEBUGMSGTL(("smux", "[smux_snmp_process] Peeked at %d bytes\n",
+                    length));
+        DEBUGDUMPSETUP("smux_snmp_process", result, length);
+
+        /*
+         * determine if we received more than one packet 
+         */
+        packet_len = length;
+        ptr = asn_parse_header(result, &packet_len, &type);
+        packet_len += (ptr - result);
+        if (length > packet_len) {
+            /*
+             * set length to receive only the first packet 
+             */
+            length = packet_len;
+        }
+
+        /*
+         * receive the first packet 
+         */
+        length = recv(sd, (char *) result, length, 0);
+        if (length < 0) {
+            snmp_log_perror("[smux_snmp_process] recv failed");
+            smux_peer_cleanup(sd);
+            return NULL;
+        }
+
+        DEBUGMSGTL(("smux", "[smux_snmp_process] Received %d bytes\n",
+                    length));
+
+        if (result[0] == SMUX_TRAP) {
+            DEBUGMSGTL(("smux", "[smux_snmp_process] Received trap\n"));
+            snmp_log(LOG_INFO, "Got trap from peer on fd %d\n", sd);
+            ptr = asn_parse_header(result, &length, &type);
+            smux_trap_process(ptr, &length);
+
+            /*
+             * go and peek at received data again 
+             */
+            /*
+             * we could receive the reply or another trap 
+             */
+        } else {
+            /*
+             * Interpret reply 
+             */
+            ptr = smux_parse(result, objid, len, return_len, return_type);
+            /*
+             * ptr will point to query result or NULL if error 
+             */
+            break;
+        }
+    }                           /* while (1) */
+
+    return ptr;
+}
+
+static u_char  *
+smux_parse(u_char * rsp,
+           oid * objid,
+           size_t * oidlen, size_t * return_len, u_char * return_type)
+{
+    size_t          length = SMUXMAXPKTSIZE;
+    u_char         *ptr, type;
+    long            reqid, errstat, errindex;
+
+    ptr = rsp;
+
+    /*
+     * Return pointer to the snmp/smux return value.
+     * return_len should contain the number of bytes in the value
+     * returned above.
+     * objid is the next object, with len for GETNEXT.
+     * objid and len are not changed for GET
+     */
+    ptr = asn_parse_header(ptr, &length, &type);
+    if (ptr == NULL || type != SNMP_MSG_RESPONSE)
+        return NULL;
+
+    if ((ptr = asn_parse_int(ptr, &length, &type, &reqid,
+                             sizeof(reqid))) == NULL) {
+        DEBUGMSGTL(("smux", "[smux_parse] parse of reqid failed\n"));
+        return NULL;
+    }
+    if ((ptr = asn_parse_int(ptr, &length, &type, &errstat,
+                             sizeof(errstat))) == NULL) {
+        DEBUGMSGTL(("smux",
+                    "[smux_parse] parse of error status failed\n"));
+        return NULL;
+    }
+    if ((ptr = asn_parse_int(ptr, &length, &type, &errindex,
+                             sizeof(errindex))) == NULL) {
+        DEBUGMSGTL(("smux", "[smux_parse] parse of error index failed\n"));
+        return NULL;
+    }
+
+    /*
+     * XXX How to send something intelligent back in case of an error 
+     */
+    DEBUGMSGTL(("smux",
+                "[smux_parse] Message type %d, reqid %d, errstat %d, \n\terrindex %d\n",
+                (int) type, reqid, errstat, errindex));
+    if (ptr == NULL || errstat != SNMP_ERR_NOERROR)
+        return NULL;
+
+    /*
+     * stuff to return 
+     */
+    return (smux_parse_var
+            (ptr, &length, objid, oidlen, return_len, return_type));
+}
+
+
+static u_char  *
+smux_parse_var(u_char * varbind,
+               size_t * varbindlength,
+               oid * objid,
+               size_t * oidlen, size_t * varlength, u_char * vartype)
+{
+    oid             var_name[MAX_OID_LEN];
+    size_t          var_name_len;
+    size_t          var_val_len;
+    u_char         *var_val;
+    size_t          str_len, objid_len;
+    size_t          len;
+    u_char         *ptr;
+    u_char          type;
+
+    ptr = varbind;
+    len = *varbindlength;
+
+    DEBUGMSGTL(("smux", "[smux_parse_var] before any processing: "));
+    DEBUGMSGOID(("smux", objid, *oidlen));
+    DEBUGMSG(("smux", "\n"));
+
+    ptr = asn_parse_header(ptr, &len, &type);
+    if (ptr == NULL || type != (ASN_SEQUENCE | ASN_CONSTRUCTOR)) {
+        snmp_log(LOG_NOTICE, "[smux_parse_var] Panic: type %d\n",
+                 (int) type);
+        return NULL;
+    }
+
+    /*
+     * get hold of the objid and the asn1 coded value 
+     */
+    var_name_len = MAX_OID_LEN;
+    ptr = snmp_parse_var_op(ptr, var_name, &var_name_len, vartype,
+                            &var_val_len, &var_val, &len);
+
+    *oidlen = var_name_len;
+    memcpy(objid, var_name, var_name_len * sizeof(oid));
+
+    DEBUGMSGTL(("smux", "[smux_parse_var] returning oid : "));
+    DEBUGMSGOID(("smux", objid, *oidlen));
+    DEBUGMSG(("smux", "\n"));
+    /*
+     * XXX 
+     */
+    len = SMUXMAXPKTSIZE;
+    DEBUGMSGTL(("smux",
+                "[smux_parse_var] Asn coded len of var %d, type %d\n",
+                var_val_len, (int) *vartype));
+
+    switch ((short) *vartype) {
+    case ASN_INTEGER:
+        *varlength = sizeof(long);
+        asn_parse_int(var_val, &len, vartype,
+                      (long *) &smux_long, *varlength);
+        return (u_char *) & smux_long;
+        break;
+    case ASN_COUNTER:
+    case ASN_GAUGE:
+    case ASN_TIMETICKS:
+    case ASN_UINTEGER:
+        *varlength = sizeof(u_long);
+        asn_parse_unsigned_int(var_val, &len, vartype,
+                               (u_long *) & smux_ulong, *varlength);
+        return (u_char *) & smux_ulong;
+        break;
+    case ASN_COUNTER64:
+        *varlength = sizeof(smux_counter64);
+        asn_parse_unsigned_int64(var_val, &len, vartype,
+                                 (struct counter64 *) &smux_counter64,
+                                 *varlength);
+        return (u_char *) & smux_counter64;
+        break;
+    case ASN_IPADDRESS:
+        *varlength = 4;
+        /*
+         * consume the tag and length, but just copy here
+         * because we know it is an ip address
+         */
+        if ((var_val = asn_parse_header(var_val, &len, &type)) == NULL)
+            return NULL;
+        memcpy((u_char *) & (smux_sa.sin_addr.s_addr), var_val,
+               *varlength);
+        return (u_char *) & (smux_sa.sin_addr.s_addr);
+        break;
+    case ASN_OCTET_STR:
+        /*
+         * XXX 
+         */
+        if (len == 0)
+            return NULL;
+        str_len = SMUXMAXSTRLEN;
+        asn_parse_string(var_val, &len, vartype, smux_str, &str_len);
+        *varlength = str_len;
+        return smux_str;
+        break;
+    case ASN_OPAQUE:
+    case ASN_NSAP:
+    case ASN_OBJECT_ID:
+        objid_len = MAX_OID_LEN;
+        asn_parse_objid(var_val, &len, vartype, smux_objid, &objid_len);
+        *varlength = objid_len * sizeof(oid);
+        return (u_char *) smux_objid;
+        break;
+    case SNMP_NOSUCHOBJECT:
+    case SNMP_NOSUCHINSTANCE:
+    case SNMP_ENDOFMIBVIEW:
+    case ASN_NULL:
+        return NULL;
+        break;
+    case ASN_BIT_STR:
+        /*
+         * XXX 
+         */
+        if (len == 0)
+            return NULL;
+        str_len = SMUXMAXSTRLEN;
+        asn_parse_bitstring(var_val, &len, vartype, smux_str, &str_len);
+        *varlength = str_len;
+        return (u_char *) smux_str;
+        break;
+    default:
+        snmp_log(LOG_ERR, "bad type returned (%x)\n", *vartype);
+        return NULL;
+        break;
+    }
+}
+
+/*
+ * XXX This is a bad hack - do not want to muck with ucd code 
+ */
+static int
+smux_build(u_char type,
+           u_long reqid,
+           oid * objid,
+           size_t * oidlen,
+           u_char val_type,
+           u_char * val, size_t val_len, u_char * packet, size_t * length)
+{
+    u_char         *ptr, *save1, *save2;
+    size_t          len;
+    long            errstat = 0;
+    long            errindex = 0;
+
+    /*
+     * leave space for Seq and length 
+     */
+    save1 = packet;
+    ptr = packet + 4;
+    len = *length - 4;
+
+    /*
+     * build reqid 
+     */
+    ptr = asn_build_unsigned_int(ptr, &len,
+                                 (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE |
+                                           ASN_INTEGER), &reqid,
+                                 sizeof(reqid));
+    if (ptr == NULL) {
+        return -1;
+    }
+
+    /*
+     * build err stat 
+     */
+    ptr = asn_build_int(ptr, &len,
+                        (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE |
+                                  ASN_INTEGER), &errstat, sizeof(errstat));
+    if (ptr == NULL) {
+        return -1;
+    }
+
+    /*
+     * build err index 
+     */
+    ptr = asn_build_int(ptr, &len,
+                        (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE |
+                                  ASN_INTEGER), &errindex,
+                        sizeof(errindex));
+    if (ptr == NULL) {
+        return -1;
+    }
+
+    save2 = ptr;
+    ptr += 4;
+    len -= 4;
+
+    if (type != SMUX_SET) {
+        val_type = ASN_NULL;
+        val_len = 0;
+    }
+
+    /*
+     * build var list : snmp_build_var_op not liked by gated XXX 
+     */
+    ptr = snmp_build_var_op(ptr, objid, oidlen, val_type, val_len,
+                            val, &len);
+    if (ptr == NULL) {
+        return -1;
+    }
+
+    len = ptr - save1;
+    asn_build_sequence(save1, &len, type, (ptr - save1 - 4));
+
+    len = ptr - save2;
+    asn_build_sequence(save2, &len,
+                       (ASN_SEQUENCE | ASN_CONSTRUCTOR),
+                       (ptr - save2 - 4));
+
+    *length = ptr - packet;
+
+    return 0;
+}
+
+static void
+smux_peer_cleanup(int sd)
+{
+    smux_reg       *nrptr, *rptr, *rptr2;
+    int             nfound, i;
+
+    nfound = 0;
+
+    /*
+     * close the descriptor 
+     */
+    close(sd);
+
+    /*
+     * delete all of the passive registrations that this peer owns 
+     */
+    for (rptr = PassiveRegs; rptr; rptr = nrptr) {
+        nrptr = rptr->sr_next;
+        if (rptr->sr_fd == sd) {
+            smux_list_detach(&PassiveRegs, &rptr);
+            free(rptr);
+        }
+        rptr = nrptr;
+    }
+    /*
+     * find replacements for all of the active registrations found 
+     */
+    for (rptr = ActiveRegs; rptr; rptr = rptr2) {
+        rptr2 = rptr->sr_next;
+        if (rptr->sr_fd == sd) {
+            smux_list_detach(&ActiveRegs, &rptr);
+            unregister_mib(rptr->sr_name, rptr->sr_name_len);
+            if ((nrptr = smux_find_replacement(rptr->sr_name,
+                                               rptr->sr_name_len)) !=
+                NULL) {
+                smux_list_detach(&PassiveRegs, &nrptr);
+                smux_list_add(&ActiveRegs, nrptr);
+                register_mib("smux", (struct variable *)
+                             smux_variables, sizeof(struct variable2),
+                             1, nrptr->sr_name, nrptr->sr_name_len);
+            }
+            free(rptr);
+        }
+    }
+
+    /*
+     * decrement the peer count 
+     */
+    npeers--;
+
+    /*
+     * make his auth available again 
+     */
+    for (i = 0; i < nauths; i++) {
+        if (Auths[i]->sa_active_fd == sd) {
+            char            oid_name[128];
+            Auths[i]->sa_active_fd = -1;
+            snprint_objid(oid_name, sizeof(oid_name), Auths[i]->sa_oid,
+                          Auths[i]->sa_oid_len);
+            snmp_log(LOG_INFO, "peer disconnected: %s\n", oid_name);
+        }
+    }
+}
+
+int
+smux_send_rrsp(int sd, int pri)
+{
+    u_char          outdata[2 + sizeof(int)];
+    u_char         *ptr = outdata;
+    int             intsize = sizeof(int);
+    u_int           mask = ((u_int) 0xFF) << (8 * (sizeof(int) - 1));
+    /*
+     * e.g. mask is 0xFF000000 on a 32-bit machine 
+     */
+    int             sent;
+
+    /*
+     * This is kind of like calling asn_build_int(), but the
+     * encoding will always be the size of an integer on this
+     * machine, never shorter.
+     */
+    *ptr++ = (u_char) SMUX_RRSP;
+    *ptr++ = (u_char) intsize;
+
+    /*
+     * Copy each byte, most significant first. 
+     */
+    while (intsize--) {
+        *ptr++ = (u_char) ((pri & mask) >> (8 * (sizeof(int) - 1)));
+        pri <<= 8;
+    }
+
+    sent = send(sd, (char *) outdata, sizeof outdata, 0);
+    if (sent < 0) {
+        DEBUGMSGTL(("smux", "[smux_send_rrsp] send failed\n"));
+    }
+    return (sent);
+}
+
+static u_char  *
+smux_trap_process(u_char * rsp, size_t * len)
+{
+    oid             sa_enterpriseoid[MAX_OID_LEN], var_name[MAX_OID_LEN];
+    size_t          datalen, var_name_len, var_val_len, maxlen;
+    int             sa_enterpriseoid_len;
+    u_char          vartype, *ptr, *var_val;
+
+    long            trap, specific;
+    u_long          timestamp;
+
+    netsnmp_variable_list *snmptrap_head, *snmptrap_ptr, *snmptrap_tmp;
+    snmptrap_head = NULL;
+    snmptrap_ptr = NULL;
+
+    ptr = rsp;
+
+    /*
+     * parse the sub-agent enterprise oid 
+     */
+    datalen = MAX_OID_LEN;
+    if ((ptr = asn_parse_objid(ptr, len,
+                               &vartype, (oid *) & sa_enterpriseoid,
+                               &sa_enterpriseoid_len)) == NULL) {
+        DEBUGMSGTL(("smux",
+                    "[smux_trap_process] asn_parse_objid failed\n"));
+        return NULL;
+    }
+
+    /*
+     * parse the agent-addr ipAddress 
+     */
+    datalen = SMUXMAXSTRLEN;
+    if (((ptr = asn_parse_string(ptr, len,
+                                 &vartype, smux_str,
+                                 &datalen)) == NULL) ||
+        (vartype != (u_char) ASN_IPADDRESS)) {
+        DEBUGMSGTL(("smux",
+                    "[smux_trap_process] asn_parse_string failed\n"));
+        return NULL;
+    }
+
+    /*
+     * parse the generic trap int 
+     */
+    datalen = sizeof(long);
+    if ((ptr = asn_parse_int(ptr, len, &vartype, &trap, datalen)) == NULL) {
+        DEBUGMSGTL(("smux",
+                    "[smux_trap_process] asn_parse_int generic failed\n"));
+        return NULL;
+    }
+
+    /*
+     * parse the specific trap int 
+     */
+    datalen = sizeof(long);
+    if ((ptr = asn_parse_int(ptr, len,
+                             &vartype, &specific, datalen)) == NULL) {
+        DEBUGMSGTL(("smux",
+                    "[smux_trap_process] asn_parse_int specific failed\n"));
+        return NULL;
+    }
+
+    /*
+     * parse the timeticks timestamp 
+     */
+    datalen = sizeof(u_long);
+    if (((ptr = asn_parse_unsigned_int(ptr, len,
+                                       &vartype, (u_long *) & timestamp,
+                                       datalen)) == NULL) ||
+        (vartype != (u_char) ASN_TIMETICKS)) {
+        DEBUGMSGTL(("smux",
+                    "[smux_trap_process] asn_parse_unsigned_int (timestamp) failed\n"));
+        return NULL;
+    }
+
+    /*
+     * parse out the overall sequence 
+     */
+    ptr = asn_parse_header(ptr, len, &vartype);
+    if (ptr == NULL || vartype != (ASN_SEQUENCE | ASN_CONSTRUCTOR)) {
+        return NULL;
+    }
+
+    /*
+     * parse the variable bindings 
+     */
+    while (ptr && *len) {
+
+        /*
+         * get the objid and the asn1 coded value 
+         */
+        var_name_len = MAX_OID_LEN;
+        ptr = snmp_parse_var_op(ptr, var_name, &var_name_len, &vartype,
+                                &var_val_len, (u_char **) & var_val, len);
+
+        if (ptr == NULL) {
+            return NULL;
+        }
+
+        maxlen = SMUXMAXPKTSIZE;
+        switch ((short) vartype) {
+        case ASN_INTEGER:
+            var_val_len = sizeof(long);
+            asn_parse_int(var_val, &maxlen, &vartype,
+                          (long *) &smux_long, var_val_len);
+            var_val = (u_char *) & smux_long;
+            break;
+        case ASN_COUNTER:
+        case ASN_GAUGE:
+        case ASN_TIMETICKS:
+        case ASN_UINTEGER:
+            var_val_len = sizeof(u_long);
+            asn_parse_unsigned_int(var_val, &maxlen, &vartype,
+                                   (u_long *) & smux_ulong, var_val_len);
+            var_val = (u_char *) & smux_ulong;
+            break;
+        case ASN_COUNTER64:
+            var_val_len = sizeof(smux_counter64);
+            asn_parse_unsigned_int64(var_val, &maxlen, &vartype,
+                                     (struct counter64 *) &smux_counter64,
+                                     var_val_len);
+            var_val = (u_char *) & smux_counter64;
+            break;
+        case ASN_IPADDRESS:
+            var_val_len = 4;
+            /*
+             * consume the tag and length, but just copy here
+             * because we know it is an ip address
+             */
+            if ((var_val =
+                 asn_parse_header(var_val, &maxlen, &vartype)) == NULL)
+                return NULL;
+            memcpy((u_char *) & (smux_sa.sin_addr.s_addr), var_val,
+                   var_val_len);
+            var_val = (u_char *) & (smux_sa.sin_addr.s_addr);
+            break;
+        case ASN_OPAQUE:
+        case ASN_OCTET_STR:
+            /*
+             * XXX 
+             */
+            if (len == 0)
+                return NULL;
+            var_val_len = SMUXMAXSTRLEN;
+            asn_parse_string(var_val, &maxlen, &vartype,
+                             smux_str, &var_val_len);
+            var_val = smux_str;
+            break;
+        case ASN_OBJECT_ID:
+            var_val_len = MAX_OID_LEN;
+            asn_parse_objid(var_val, &maxlen, &vartype,
+                            smux_objid, &var_val_len);
+            var_val_len *= sizeof(oid);
+            var_val = (u_char *) smux_objid;
+            break;
+        case SNMP_NOSUCHOBJECT:
+        case SNMP_NOSUCHINSTANCE:
+        case SNMP_ENDOFMIBVIEW:
+        case ASN_NULL:
+            var_val = NULL;
+            break;
+        case ASN_BIT_STR:
+            /*
+             * XXX 
+             */
+            if (len == 0)
+                return NULL;
+            var_val_len = SMUXMAXSTRLEN;
+            asn_parse_bitstring(var_val, &maxlen, &vartype,
+                                smux_str, &var_val_len);
+            var_val = (u_char *) smux_str;
+            break;
+        case ASN_NSAP:
+        default:
+            snmp_log(LOG_ERR, "bad type returned (%x)\n", vartype);
+            var_val = NULL;
+            break;
+        }
+
+        snmptrap_tmp =
+            (netsnmp_variable_list *)
+            malloc(sizeof(netsnmp_variable_list));
+        if (snmptrap_tmp == NULL)
+            return NULL;
+        memset(snmptrap_tmp, 0, sizeof(netsnmp_variable_list));
+        if (snmptrap_head == NULL) {
+            snmptrap_head = snmptrap_tmp;
+            snmptrap_ptr = snmptrap_head;
+        } else {
+            snmptrap_ptr->next_variable = snmptrap_tmp;
+            snmptrap_ptr = snmptrap_ptr->next_variable;
+        }
+
+        snmp_set_var_objid(snmptrap_ptr, var_name, var_name_len);
+        snmp_set_var_value(snmptrap_ptr, (char *) var_val, var_val_len);
+        snmptrap_ptr->type = vartype;
+        snmptrap_ptr->next_variable = NULL;
+
+    }
+
+    /*
+     * send the traps 
+     */
+    send_enterprise_trap_vars(trap, specific, (oid *) & sa_enterpriseoid,
+                              sa_enterpriseoid_len, snmptrap_head);
+
+    /*
+     * free trap variables 
+     */
+    snmp_free_varbind(snmptrap_head);
+
+    return ptr;
+
+}
+
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/smux/smux.h tomato121/release/src/router/snmp/agent/mibgroup/smux/smux.h
--- tomato/release/src/router/snmp/agent/mibgroup/smux/smux.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/smux/smux.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,67 @@
+/*
+ * Smux module authored by Rohit Dube.
+ * Rewritten by Nick Amato <naamato@merit.net>.
+ */
+
+#define SMUXPORT 199
+
+#define SMUXMAXPKTSIZE 1500
+#define SMUXMAXSTRLEN  1024
+#define SMUXMAXPEERS   10
+
+#define SMUX_OPEN 	(ASN_APPLICATION | ASN_CONSTRUCTOR | 0)
+#define SMUX_CLOSE      (ASN_APPLICATION | ASN_PRIMITIVE | 1)
+#define SMUX_RREQ       (ASN_APPLICATION | ASN_CONSTRUCTOR | 2)
+#define SMUX_RRSP       (ASN_APPLICATION | ASN_PRIMITIVE | 3)
+#define SMUX_SOUT       (ASN_APPLICATION | ASN_PRIMITIVE | 4)
+
+#define SMUX_GET        (ASN_CONTEXT | ASN_CONSTRUCTOR | 0)
+#define SMUX_GETNEXT    (ASN_CONTEXT | ASN_CONSTRUCTOR | 1)
+#define SMUX_GETRSP     (ASN_CONTEXT | ASN_CONSTRUCTOR | 2)
+#define SMUX_SET	(ASN_CONTEXT | ASN_CONSTRUCTOR | 3)
+#define SMUX_TRAP	(ASN_CONTEXT | ASN_CONSTRUCTOR | 4)
+
+#define SMUXC_GOINGDOWN                    0
+#define SMUXC_UNSUPPORTEDVERSION           1
+#define SMUXC_PACKETFORMAT                 2
+#define SMUXC_PROTOCOLERROR                3
+#define SMUXC_INTERNALERROR                4
+#define SMUXC_AUTHENTICATIONFAILURE        5
+
+#define SMUX_MAX_PEERS          10
+#define SMUX_MAX_PRIORITY       2147483647
+
+#define SMUX_REGOP_DELETE		0
+#define SMUX_REGOP_REGISTER_RO		1
+#define SMUX_REGOP_REGISTER_RW		2
+
+/*
+ * Authorized peers read from the config file
+ */
+typedef struct _smux_peer_auth {
+    oid             sa_oid[MAX_OID_LEN];        /* name of peer                 */
+    size_t          sa_oid_len; /* length of peer name          */
+    char            sa_passwd[SMUXMAXSTRLEN];   /* configured passwd            */
+    int             sa_active_fd;       /* the peer using this auth     */
+} smux_peer_auth;
+
+/*
+ * Registrations
+ */
+typedef struct _smux_reg {
+    oid             sr_name[MAX_OID_LEN];       /* name of subtree              */
+    size_t          sr_name_len;        /* length of subtree name       */
+    int             sr_priority;        /* priority of registration     */
+    int             sr_fd;      /* descriptor of owner          */
+    struct _smux_reg *sr_next;  /* next one                     */
+} smux_reg;
+
+extern void     init_smux(void);
+extern int      smux_accept(int);
+extern u_char  *smux_snmp_process(int, oid *, size_t *, size_t *, u_char *,
+                                  int);
+extern int      smux_process(int);
+extern void     smux_parse_peer_auth(const char *, char *);
+extern void     smux_free_peer_auth(void);
+extern void     send_enterprise_trap_vars(int, int, oid *, int,
+                                          netsnmp_variable_list *);
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/smux/snmp_bgp.c tomato121/release/src/router/snmp/agent/mibgroup/smux/snmp_bgp.c
--- tomato/release/src/router/snmp/agent/mibgroup/smux/snmp_bgp.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/smux/snmp_bgp.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,187 @@
+/*
+ * $Id: snmp_bgp.c,v 1.1.2.1 2004/06/20 21:54:23 nikki Exp $ 
+ */
+
+/*
+ * Smux module authored by Rohit Dube.
+ */
+
+#include <net-snmp/net-snmp-config.h>
+
+#include <stdio.h>
+#if HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#if HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+#if HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#if HAVE_ERR_H
+#include <err.h>
+#endif
+#if TIME_WITH_SYS_TIME
+# include <sys/time.h>
+# include <time.h>
+#else
+# if HAVE_SYS_TIME_H
+#  include <sys/time.h>
+# else
+#  include <time.h>
+# endif
+#endif
+#include <errno.h>
+#include <netdb.h>
+
+#include <sys/stat.h>
+#include <sys/socket.h>
+#if HAVE_SYS_FILIO_H
+#include <sys/filio.h>
+#endif
+
+#if HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include "smux.h"
+#include "snmp_bgp.h"
+
+struct variable13 bgp_variables[] = {
+    {BGPVERSION, ASN_OCTET_STR, RONLY, var_bgp, 1, {1}},
+    {BGPLOCALAS, ASN_INTEGER, RONLY, var_bgp, 1, {2}},
+    {BGPIDENTIFIER, ASN_IPADDRESS, RONLY, var_bgp, 1, {4}},
+    {BGPPEERIDENTIFIER, ASN_IPADDRESS, RONLY, var_bgp, 3, {3, 1, 1}},
+    {BGPPEERSTATE, ASN_INTEGER, RONLY, var_bgp, 3, {3, 1, 2}},
+    {BGPPEERADMINSTATUS, ASN_INTEGER, RONLY, var_bgp, 3, {3, 1, 3}},
+    {BGPPEERNEGOTIATEDVERSION, ASN_INTEGER, RONLY, var_bgp, 3, {3, 1, 4}},
+    {BGPPEERLOCALADDR, ASN_IPADDRESS, RONLY, var_bgp, 3, {3, 1, 5}},
+    {BGPPEERLOCALPORT, ASN_INTEGER, RONLY, var_bgp, 3, {3, 1, 6}},
+    {BGPPEERREMOTEADDR, ASN_IPADDRESS, RONLY, var_bgp, 3, {3, 1, 7}},
+    {BGPPEERREMOTEPORT, ASN_INTEGER, RONLY, var_bgp, 3, {3, 1, 8}},
+    {BGPPEERREMOTEAS, ASN_INTEGER, RONLY, var_bgp, 3, {3, 1, 9}},
+    {BGPPEERINUPDATES, ASN_COUNTER, RONLY, var_bgp, 3, {3, 1, 10}},
+    {BGPPEEROUTUPDATES, ASN_COUNTER, RONLY, var_bgp, 3, {3, 1, 11}},
+    {BGPPEERINTOTALMESSAGES, ASN_COUNTER, RONLY, var_bgp, 3, {3, 1, 12}},
+    {BGPPEEROUTTOTALMESSAGES, ASN_COUNTER, RONLY, var_bgp, 3, {3, 1, 13}},
+    {BGPPEERLASTERROR, ASN_OCTET_STR, RONLY, var_bgp, 3, {3, 1, 14}},
+    {BGPPATHATTRPEER, ASN_IPADDRESS, RONLY, var_bgp, 3, {5, 1, 1}},
+    {BGPPATHATTRDESTNETWORK, ASN_IPADDRESS, RONLY, var_bgp, 3, {5, 1, 2}},
+    {BGPPATHATTRORIGIN, ASN_INTEGER, RONLY, var_bgp, 3, {5, 1, 3}},
+    {BGPPATHATTRASPATH, ASN_OCTET_STR, RONLY, var_bgp, 3, {5, 1, 4}},
+    {BGPPATHATTRNEXTHOP, ASN_INTEGER, RONLY, var_bgp, 3, {5, 1, 5}},
+    {BGPPATHATTRINTERASMETRIC, ASN_OCTET_STR, RONLY, var_bgp, 3, {5, 1, 6}}
+};
+
+oid             bgp_variables_oid[] = { MIB, 15 };
+
+void
+init_snmp_bdp(void)
+{
+    REGISTER_MIB("smux/snmp_bgp", bgp_variables, variable13,
+                 bgp_variables_oid);
+}
+
+
+#endif
+static oid      max_bgp_mib[] =
+    { 1, 3, 6, 1, 2, 1, 15, 5, 1, 6, 255, 255, 255, 255 };
+static oid      min_bgp_mib[] = { 1, 3, 6, 1, 2, 1, 15, 1, 0 };
+extern u_char   smux_type;
+
+u_char         *
+var_bgp(struct variable *vp,
+        oid * name,
+        int *length, int exact, int *var_len, WriteMethod ** write_method)
+{
+    u_char         *var;
+    int             result;
+
+    DEBUGMSGTL(("smux/snmp_bgp",
+                "[var_bgp] var len %d, oid requested Len %d-", *var_len,
+                *length));
+    DEBUGMSGOID(("smux/snmp_bgp", name, *length));
+    DEBUGMSG(("smux/snmp_bgp", "\n"));
+
+    /*
+     * Pass on the request to Gated.
+     * If the request sent out was a get next, check to see if
+     * it lies in the bgp range. If it doesn't, return NULL.
+     * In either case, make sure that errors are checked on the
+     * returned packets.
+     */
+
+    /*
+     * No writes for now 
+     */
+    *write_method = NULL;
+
+    /*
+     * Donot allow access to the peer stuff as it crashes gated.
+     * However A GetNext on the last 23.3.1.9 variable will force gated into
+     * the peer stuff and cause it to crash.
+     * The only way to fix this is to either solve the Gated problem, or 
+     * remove the peer variables from Gated itself and cause it to return
+     * NULL at the crossing. Currently doing the later.
+     */
+
+    /*
+     * Reject GET and GETNEXT for anything above bgpifconf range 
+     */
+    result = snmp_oid_compare(name, *length, max_bgp_mib,
+                              sizeof(max_bgp_mib) / sizeof(u_int));
+
+    if (result >= 0) {
+        DEBUGMSGTL(("smux/snmp_bgp", "Over shot\n"));
+        return NULL;
+    }
+
+    /*
+     * for GETs we need to be in the bgp range so reject anything below 
+     */
+    result = snmp_oid_compare(name, *length, min_bgp_mib,
+                              sizeof(min_bgp_mib) / sizeof(u_int));
+    if (exact && (result < 0)) {
+        DEBUGMSGTL(("smux/snmp_bgp",
+                    "Exact but doesn't match length %d, size %d\n",
+                    *length, sizeof(min_bgp_mib)));
+        return NULL;
+    }
+
+    /*
+     * On return, 'var' points to the value returned which is of length
+     * '*var_len'. 'name' points to the new (same as the one passed in for 
+     * GETs) oid which has 'length' suboids.
+     * 'smux_type' contains the type of the variable.
+     */
+    var = smux_snmp_process(exact, name, length, var_len);
+
+    DEBUGMSGTL(("smux/snmp_bgp",
+                "[var_bgp] var len %d, oid obtained Len %d-", *var_len,
+                *length));
+    DEBUGMSGOID(("smux/snmp_bgp", name, *length));
+    DEBUGMSG(("smux/snmp_bgp", "\n"));
+
+    vp->type = smux_type;
+
+    /*
+     * XXX Need a mechanism to return errors in gated's responses 
+     */
+
+    if (var == NULL)
+        return NULL;
+
+    /*
+     * Any resullt returned should be within the bgp tree.
+     * bgp_mib - static u_int bgp_mib[] = {1, 3, 6, 1, 2, 1, 15};
+     */
+    if (memcmp(bgp_mib, name, sizeof(bgp_mib)) != 0) {
+        return NULL;
+    } else {
+        return var;
+    }
+}
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/smux/snmp_bgp.h tomato121/release/src/router/snmp/agent/mibgroup/smux/snmp_bgp.h
--- tomato/release/src/router/snmp/agent/mibgroup/smux/snmp_bgp.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/smux/snmp_bgp.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,38 @@
+/*
+ *  snmp_bgp.h
+ *
+ */
+#ifndef _MIBGROUP_SNMP_BGP_H
+#define _MIBGROUP_SNMP_BGP_H
+
+config_require(smux/smux)
+
+     extern FindVarMethod var_bgp;
+     extern void     init_snmp_bgp(void);
+
+
+#define BGPVERSION			0
+#define BGPLOCALAS			1
+#define BGPIDENTIFIER			2
+#define BGPPEERIDENTIFIER		3
+#define BGPPEERSTATE			4
+#define BGPPEERADMINSTATUS		5
+#define BGPPEERNEGOTIATEDVERSION	6
+#define BGPPEERLOCALADDR		7
+#define BGPPEERLOCALPORT		8
+#define BGPPEERREMOTEADDR		9
+#define BGPPEERREMOTEPORT		10
+#define BGPPEERREMOTEAS			11
+#define BGPPEERINUPDATES		12
+#define BGPPEEROUTUPDATES		13
+#define BGPPEERINTOTALMESSAGES		14
+#define BGPPEEROUTTOTALMESSAGES		15
+#define BGPPEERLASTERROR		16
+#define BGPPATHATTRPEER			17
+#define BGPPATHATTRDESTNETWORK		18
+#define BGPPATHATTRORIGIN		19
+#define BGPPATHATTRASPATH		20
+#define BGPPATHATTRNEXTHOP		21
+#define BGPPATHATTRINTERASMETRIC	22
+
+#endif                          /* _MIBGROUP_SNMP_BGP_H */
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/smux/snmp_ospf.c tomato121/release/src/router/snmp/agent/mibgroup/smux/snmp_ospf.c
--- tomato/release/src/router/snmp/agent/mibgroup/smux/snmp_ospf.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/smux/snmp_ospf.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,282 @@
+/*
+ * $Id: snmp_ospf.c,v 1.1.2.1 2004/06/20 21:54:23 nikki Exp $ 
+ */
+
+/*
+ * Smux module authored by Rohit Dube.
+ */
+
+#include <net-snmp/net-snmp-config.h>
+
+#include <stdio.h>
+#if HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#if HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+#if HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#if HAVE_ERR_H
+#include <err.h>
+#endif
+#if TIME_WITH_SYS_TIME
+# include <sys/time.h>
+# include <time.h>
+#else
+# if HAVE_SYS_TIME_H
+#  include <sys/time.h>
+# else
+#  include <time.h>
+# endif
+#endif
+#include <errno.h>
+#include <netdb.h>
+
+#include <sys/stat.h>
+#include <sys/socket.h>
+#if HAVE_SYS_FILIO_H
+#include <sys/filio.h>
+#endif
+
+#if HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include "smux.h"
+#include "snmp_ospf.h"
+
+static oid      max_ospf_mib[] = { 1, 3, 6, 1, 2, 1, 14, 14, 1, 6, 0 };
+static oid      min_ospf_mib[] =
+    { 1, 3, 6, 1, 2, 1, 14, 1, 1, 0, 0, 0, 0 };
+extern u_char   smux_type;
+
+struct variable13 ospf_variables[] = {
+    {ospfRouterId, ASN_IPADDRESS, RWRITE, var_ospf, 3, {1, 1, 1}},
+    {ospfAdminStat, ASN_INTEGER, RWRITE, var_ospf, 3, {1, 1, 2}},
+    {ospfVersionNumber, ASN_INTEGER, RONLY, var_ospf, 3, {1, 1, 3}},
+    {ospfAreaBdrRtrStatus, ASN_INTEGER, RONLY, var_ospf, 3, {1, 1, 4}},
+    {ospfASBdrRtrStatus, ASN_INTEGER, RWRITE, var_ospf, 3, {1, 1, 5}},
+    {ospfExternLsaCount, ASN_GAUGE, RONLY, var_ospf, 3, {1, 1, 6}},
+    {ospfExternLsaCksumSum, ASN_INTEGER, RONLY, var_ospf, 3, {1, 1, 7}},
+    {ospfTOSSupport, ASN_INTEGER, RWRITE, var_ospf, 3, {1, 1, 8}},
+    {ospfOriginateNewLsas, ASN_COUNTER, RONLY, var_ospf, 3, {1, 1, 9}},
+    {ospfRxNewLsas, ASN_COUNTER, RONLY, var_ospf, 3, {1, 1, 10, 0}},
+    {ospfExtLsdbLimit, ASN_INTEGER, RWRITE, var_ospf, 3, {1, 1, 11}},
+    {ospfMulticastExtensions, ASN_INTEGER, RWRITE, var_ospf, 3,
+     {1, 1, 12}},
+    {ospfAreaId, ASN_IPADDRESS, RONLY, var_ospf, 3, {2, 1, 1}},
+    {ospfAuthType, ASN_INTEGER, RWRITE, var_ospf, 3, {2, 1, 2}},
+    {ospfImportAsExtern, ASN_INTEGER, RWRITE, var_ospf, 3, {2, 1, 3}},
+    {ospfSpfRuns, ASN_COUNTER, RONLY, var_ospf, 3, {2, 1, 4}},
+    {ospfAreaBdrRtrCount, ASN_GAUGE, RONLY, var_ospf, 3, {2, 1, 5}},
+    {ospfAsBdrRtrCount, ASN_GAUGE, RONLY, var_ospf, 3, {2, 1, 6}},
+    {ospfAreaLsaCount, ASN_GAUGE, RONLY, var_ospf, 3, {2, 1, 7}},
+    {ospfAreaLsaCksumSum, ASN_INTEGER, RONLY, var_ospf, 3, {2, 1, 8}},
+    {ospfAreaSummary, ASN_INTEGER, RWRITE, var_ospf, 3, {2, 1, 9}},
+    {ospfAreaStatus, ASN_INTEGER, RWRITE, var_ospf, 3, {2, 1, 10}},
+    {ospfStubAreaId, ASN_IPADDRESS, RONLY, var_ospf, 3, {3, 1, 1}},
+    {ospfStubTOS, ASN_INTEGER, RONLY, var_ospf, 3, {3, 1, 2}},
+    {ospfStubMetric, ASN_INTEGER, RWRITE, var_ospf, 3, {3, 1, 3}},
+    {ospfStubStatus, ASN_INTEGER, RWRITE, var_ospf, 3, {3, 1, 4}},
+    {ospfStubMetricType, ASN_INTEGER, RWRITE, var_ospf, 3, {3, 1, 5}},
+    {ospfLsdbAreaId, ASN_IPADDRESS, RONLY, var_ospf, 3, {4, 1, 1}},
+    {ospfLsdbType, ASN_INTEGER, RONLY, var_ospf, 3, {4, 1, 2}},
+    {ospfLsdbLsid, ASN_IPADDRESS, RONLY, var_ospf, 3, {4, 1, 3}},
+    {ospfLsdbRouterId, ASN_IPADDRESS, RONLY, var_ospf, 3, {4, 1, 4}},
+    {ospfLsdbSequence, ASN_INTEGER, RONLY, var_ospf, 3, {4, 1, 5}},
+    {ospfLsdbAge, ASN_INTEGER, RONLY, var_ospf, 3, {4, 1, 6}},
+    {ospfLsdbChecksum, ASN_INTEGER, RONLY, var_ospf, 3, {4, 1, 7}},
+    {ospfLsdbAdvertisement, ASN_OCTET_STR, RONLY, var_ospf, 3, {4, 1, 8}},
+    {ospfAreaRangeAreaId, ASN_IPADDRESS, RONLY, var_ospf, 3, {5, 1, 1}},
+    {ospfAreaRangeNet, ASN_IPADDRESS, RONLY, var_ospf, 3, {5, 1, 2}},
+    {ospfAreaRangeMask, ASN_IPADDRESS, RWRITE, var_ospf, 3, {5, 1, 3}},
+    {ospfAreaRangeStatus, ASN_INTEGER, RWRITE, var_ospf, 3, {5, 1, 4}},
+    {ospfAreaRangeEffect, ASN_INTEGER, RWRITE, var_ospf, 3, {5, 1, 5}},
+    {ospfHostIpAddress, ASN_IPADDRESS, RONLY, var_ospf, 3, {6, 1, 1}},
+    {ospfHostTOS, ASN_INTEGER, RONLY, var_ospf, 3, {6, 1, 2}},
+    {ospfHostMetric, ASN_INTEGER, RWRITE, var_ospf, 3, {6, 1, 3}},
+    {ospfHostStatus, ASN_INTEGER, RWRITE, var_ospf, 3, {6, 1, 4}},
+    {ospfHostAreaID, ASN_IPADDRESS, RONLY, var_ospf, 3, {6, 1, 5}},
+    {ospfIfIpAddress, ASN_IPADDRESS, RONLY, var_ospf, 3, {7, 1, 1}},
+    {ospfAddressLessIf, ASN_INTEGER, RONLY, var_ospf, 3, {7, 1, 2}},
+    {ospfIfAreaId, ASN_IPADDRESS, RWRITE, var_ospf, 3, {7, 1, 3}},
+    {ospfIfType, ASN_INTEGER, RWRITE, var_ospf, 3, {7, 1, 4}},
+    {ospfIfAdminStat, ASN_INTEGER, RWRITE, var_ospf, 3, {7, 1, 5}},
+    {ospfIfRtrPriority, ASN_INTEGER, RWRITE, var_ospf, 3, {7, 1, 6}},
+    {ospfIfTransitDelay, ASN_INTEGER, RWRITE, var_ospf, 3, {7, 1, 7}},
+    {ospfIfRetransInterval, ASN_INTEGER, RWRITE, var_ospf, 3, {7, 1, 8}},
+    {ospfIfHelloInterval, ASN_INTEGER, RWRITE, var_ospf, 3, {7, 1, 9}},
+    {ospfIfRtrDeadInterval, ASN_INTEGER, RWRITE, var_ospf, 3, {7, 1, 10}},
+    {ospfIfPollInterval, ASN_INTEGER, RWRITE, var_ospf, 3, {7, 1, 11}},
+    {ospfIfState, ASN_INTEGER, RONLY, var_ospf, 3, {7, 1, 12}},
+    {ospfIfDesignatedRouter, ASN_IPADDRESS, RONLY, var_ospf, 3,
+     {7, 1, 13}},
+    {ospfIfBackupDesignatedRouter, ASN_IPADDRESS, RONLY, var_ospf, 3,
+     {7, 1, 14}},
+    {ospfIfEvents, ASN_COUNTER, RONLY, var_ospf, 3, {7, 1, 15}},
+    {ospfIfAuthKey, ASN_OCTET_STR, RWRITE, var_ospf, 3, {7, 1, 16}},
+    {ospfIfStatus, ASN_INTEGER, RWRITE, var_ospf, 3, {7, 1, 17}},
+    {ospfIfMulticastForwarding, ASN_INTEGER, RWRITE, var_ospf, 3,
+     {7, 1, 18}},
+    {ospfIfMetricIpAddress, ASN_IPADDRESS, RONLY, var_ospf, 3, {8, 1, 1}},
+    {ospfIfMetricAddressLessIf, ASN_INTEGER, RONLY, var_ospf, 3,
+     {8, 1, 2}},
+    {ospfIfMetricTOS, ASN_INTEGER, RONLY, var_ospf, 3, {8, 1, 3}},
+    {ospfIfMetricValue, ASN_INTEGER, RWRITE, var_ospf, 3, {8, 1, 4}},
+    {ospfIfMetricStatus, ASN_INTEGER, RWRITE, var_ospf, 3, {8, 1, 5}},
+    {ospfVirtIfAreaId, ASN_IPADDRESS, RONLY, var_ospf, 3, {9, 1, 1}},
+    {ospfVirtIfNeighbor, ASN_IPADDRESS, RONLY, var_ospf, 3, {9, 1, 2}},
+    {ospfVirtIfTransitDelay, ASN_INTEGER, RWRITE, var_ospf, 3, {9, 1, 3}},
+    {ospfVirtIfRetransInterval, ASN_INTEGER, RWRITE, var_ospf, 3,
+     {9, 1, 4}},
+    {ospfVirtIfHelloInterval, ASN_INTEGER, RWRITE, var_ospf, 3, {9, 1, 5}},
+    {ospfVirtIfRtrDeadInterval, ASN_INTEGER, RWRITE, var_ospf, 3,
+     {9, 1, 6}},
+    {ospfVirtIfState, ASN_INTEGER, RONLY, var_ospf, 3, {9, 1, 7}},
+    {ospfVirtIfEvents, ASN_COUNTER, RONLY, var_ospf, 3, {9, 1, 8}},
+    {ospfVirtIfAuthKey, ASN_OCTET_STR, RWRITE, var_ospf, 3, {9, 1, 9}},
+    {ospfVirtIfStatus, ASN_INTEGER, RWRITE, var_ospf, 3, {9, 1, 10}},
+    {ospfNbrIpAddr, ASN_IPADDRESS, RONLY, var_ospf, 3, {10, 1, 1}},
+    {ospfNbrAddressLessIndex, ASN_INTEGER, RONLY, var_ospf, 3, {10, 1, 2}},
+    {ospfNbrRtrId, ASN_IPADDRESS, RONLY, var_ospf, 3, {10, 1, 3}},
+    {ospfNbrOptions, ASN_INTEGER, RONLY, var_ospf, 3, {10, 1, 4}},
+    {ospfNbrPriority, ASN_INTEGER, RWRITE, var_ospf, 3, {10, 1, 5}},
+    {ospfNbrState, ASN_INTEGER, RONLY, var_ospf, 3, {10, 1, 6}},
+    {ospfNbrEvents, ASN_COUNTER, RONLY, var_ospf, 3, {10, 1, 7}},
+    {ospfNbrLsRetransQLen, ASN_GAUGE, RONLY, var_ospf, 3, {10, 1, 8}},
+    {ospfNbmaNbrStatus, ASN_INTEGER, RWRITE, var_ospf, 3, {10, 1, 9}},
+    {ospfNbmaNbrPermanence, ASN_INTEGER, RWRITE, var_ospf, 3, {10, 1, 10}},
+    {ospfVirtNbrArea, ASN_IPADDRESS, RONLY, var_ospf, 3, {11, 1, 1}},
+    {ospfVirtNbrRtrId, ASN_IPADDRESS, RONLY, var_ospf, 3, {11, 1, 2}},
+    {ospfVirtNbrIpAddr, ASN_IPADDRESS, RONLY, var_ospf, 3, {11, 1, 3}},
+    {ospfVirtNbrOptions, ASN_INTEGER, RONLY, var_ospf, 3, {11, 1, 4}},
+    {ospfVirtNbrState, ASN_INTEGER, RONLY, var_ospf, 3, {11, 1, 5}},
+    {ospfVirtNbrEvents, ASN_COUNTER, RONLY, var_ospf, 3, {11, 1, 6}},
+    {ospfVirtNbrLsRetransQLen, ASN_GAUGE, RONLY, var_ospf, 3, {11, 1, 7}},
+    {ospfExtLsdbType, ASN_INTEGER, RONLY, var_ospf, 3, {12, 1, 1}},
+    {ospfExtLsdbLsid, ASN_IPADDRESS, RONLY, var_ospf, 3, {12, 1, 2}},
+    {ospfExtLsdbRouterId, ASN_IPADDRESS, RONLY, var_ospf, 3, {12, 1, 3}},
+    {ospfExtLsdbSequence, ASN_INTEGER, RONLY, var_ospf, 3, {12, 1, 4}},
+    {ospfExtLsdbAge, ASN_INTEGER, RONLY, var_ospf, 3, {12, 1, 5}},
+    {ospfExtLsdbChecksum, ASN_INTEGER, RONLY, var_ospf, 3, {12, 1, 6}},
+    {ospfExtLsdbAdvertisement, ASN_OCTET_STR, RONLY, var_ospf, 3,
+     {12, 1, 7}},
+    {ospfAreaAggregateAreaID, ASN_IPADDRESS, RONLY, var_ospf, 3,
+     {14, 1, 1}},
+    {ospfAreaAggregateLsdbType, ASN_INTEGER, RONLY, var_ospf, 3,
+     {14, 1, 2}},
+    {ospfAreaAggregateNet, ASN_IPADDRESS, RONLY, var_ospf, 3, {14, 1, 3}},
+    {ospfAreaAggregateMask, ASN_IPADDRESS, RWRITE, var_ospf, 3,
+     {14, 1, 4}},
+    {ospfAreaAggregateStatus, ASN_INTEGER, RWRITE, var_ospf, 3,
+     {14, 1, 5}},
+    {ospfAreaAggregateEffect, ASN_INTEGER, RWRITE, var_ospf, 3, {14, 1, 6}}
+};
+
+oid             ospf_variables_oid[] = { MIB, 14 };
+
+void
+init_snmp_ospf(void)
+{
+    REGISTER_MIB("smux/snmp_ospf", ospf_variables, variable13,
+                 ospf_variables_oid);
+}
+
+u_char         *
+var_ospf(struct variable *vp,
+         oid * name,
+         int *length, int exact, int *var_len, WriteMethod ** write_method)
+{
+    u_char         *var;
+    int             result;
+
+    DEBUGMSGTL(("smux/snmp_ospf",
+                "[var_ospf] var len %d, oid requested Len %d-", *var_len,
+                *length));
+    DEBUGMSGOID(("smux/snmp_ospf", name, *length));
+    DEBUGMSG(("smux/snmp_ospf", "\n"));
+
+    /*
+     * Pass on the request to Gated.
+     * If the request sent out was a get next, check to see if
+     * it lies in the ospf range. If it doesn't, return NULL.
+     * In either case, make sure that errors are checked on the
+     * returned packets.
+     */
+
+    /*
+     * No writes for now 
+     */
+    *write_method = NULL;
+
+    /*
+     * Donot allow access to the peer stuff as it crashes gated.
+     * However A GetNext on the last 23.3.1.9 variable will force gated into
+     * the peer stuff and cause it to crash.
+     * The only way to fix this is to either solve the Gated problem, or 
+     * remove the peer variables from Gated itself and cause it to return
+     * NULL at the crossing. Currently doing the later.
+     */
+
+    /*
+     * Reject GET and GETNEXT for anything above ospfifconf range 
+     */
+    result = snmp_oid_compare(name, *length, max_ospf_mib,
+                              sizeof(max_ospf_mib) / sizeof(u_int));
+
+    if (result >= 0) {
+        DEBUGMSGTL(("smux/snmp_ospf", "Over shot\n"));
+        return NULL;
+    }
+
+    /*
+     * for GETs we need to be in the ospf range so reject anything below 
+     */
+    result = snmp_oid_compare(name, *length, min_ospf_mib,
+                              sizeof(min_ospf_mib) / sizeof(u_int));
+    if (exact && (result < 0)) {
+        DEBUGMSGTL(("smux/snmp_ospf",
+                    "Exact but doesn't match length %d, size %d\n",
+                    *length, sizeof(min_ospf_mib)));
+        return NULL;
+    }
+
+    /*
+     * On return, 'var' points to the value returned which is of length
+     * '*var_len'. 'name' points to the new (same as the one passed in for 
+     * GETs) oid which has 'length' suboids.
+     * 'smux_type' contains the type of the variable.
+     */
+    var = smux_snmp_process(exact, name, length, var_len);
+
+    DEBUGMSGTL(("smux/snmp_ospf",
+                "[var_ospf] var len %d, oid obtained Len %d-", *var_len,
+                *length));
+    DEBUGMSGOID(("smux/snmp_ospf", name, *length));
+    DEBUGMSG(("smux/snmp_ospf", "\n"));
+
+    vp->type = smux_type;
+
+    /*
+     * XXX Need a mechanism to return errors in gated's responses 
+     */
+
+    if (var == NULL)
+        return NULL;
+
+    /*
+     * Any resullt returned should be within the ospf tree.
+     * ospf_mib - static u_int ospf_mib[] = {1, 3, 6, 1, 2, 1, 14};
+     */
+    if (memcmp(ospf_mib, name, sizeof(ospf_mib)) != 0) {
+        return NULL;
+    } else {
+        return var;
+    }
+}
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/smux/snmp_ospf.h tomato121/release/src/router/snmp/agent/mibgroup/smux/snmp_ospf.h
--- tomato/release/src/router/snmp/agent/mibgroup/smux/snmp_ospf.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/smux/snmp_ospf.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,123 @@
+/*
+ *  snmp_ospf.h
+ *
+ */
+#ifndef _MIBGROUP_SNMP_OSPF_H
+#define _MIBGROUP_SNMP_OSPF_H
+
+config_require(smux/smux)
+
+     extern FindVarMethod var_ospf;
+     extern void     init_snmp_ospf(void);
+
+
+#define ospfRouterId		0
+#define ospfAdminStat		1
+#define ospfVersionNumber		2
+#define ospfAreaBdrRtrStatus		3
+#define ospfASBdrRtrStatus		4
+#define ospfExternLsaCount		5
+#define ospfExternLsaCksumSum		6
+#define ospfTOSSupport		7
+#define ospfOriginateNewLsas		8
+#define ospfRxNewLsas		9
+#define ospfExtLsdbLimit		10
+#define ospfMulticastExtensions		11
+#define ospfAreaId		12
+#define ospfAuthType		13
+#define ospfImportAsExtern		14
+#define ospfSpfRuns		15
+#define ospfAreaBdrRtrCount		16
+#define ospfAsBdrRtrCount		17
+#define ospfAreaLsaCount		18
+#define ospfAreaLsaCksumSum		19
+#define ospfAreaSummary		20
+#define ospfAreaStatus		21
+#define ospfStubAreaId		22
+#define ospfStubTOS		23
+#define ospfStubMetric		24
+#define ospfStubStatus		25
+#define ospfStubMetricType		26
+#define ospfLsdbAreaId		27
+#define ospfLsdbType		28
+#define ospfLsdbLsid		29
+#define ospfLsdbRouterId		30
+#define ospfLsdbSequence		31
+#define ospfLsdbAge		32
+#define ospfLsdbChecksum		33
+#define ospfLsdbAdvertisement		34
+#define ospfAreaRangeAreaId		35
+#define ospfAreaRangeNet		36
+#define ospfAreaRangeMask		37
+#define ospfAreaRangeStatus		38
+#define ospfAreaRangeEffect		39
+#define ospfHostIpAddress		40
+#define ospfHostTOS		41
+#define ospfHostMetric		42
+#define ospfHostStatus		43
+#define ospfHostAreaID		44
+#define ospfIfIpAddress		45
+#define ospfAddressLessIf		46
+#define ospfIfAreaId		47
+#define ospfIfType		48
+#define ospfIfAdminStat		49
+#define ospfIfRtrPriority		50
+#define ospfIfTransitDelay		51
+#define ospfIfRetransInterval		52
+#define ospfIfHelloInterval		53
+#define ospfIfRtrDeadInterval		54
+#define ospfIfPollInterval		55
+#define ospfIfState		56
+#define ospfIfDesignatedRouter		57
+#define ospfIfBackupDesignatedRouter		58
+#define ospfIfEvents		59
+#define ospfIfAuthKey		60
+#define ospfIfStatus		61
+#define ospfIfMulticastForwarding		62
+#define ospfIfMetricIpAddress		63
+#define ospfIfMetricAddressLessIf		64
+#define ospfIfMetricTOS		65
+#define ospfIfMetricValue		66
+#define ospfIfMetricStatus		67
+#define ospfVirtIfAreaId		68
+#define ospfVirtIfNeighbor		69
+#define ospfVirtIfTransitDelay		70
+#define ospfVirtIfRetransInterval		71
+#define ospfVirtIfHelloInterval		72
+#define ospfVirtIfRtrDeadInterval		73
+#define ospfVirtIfState		74
+#define ospfVirtIfEvents		75
+#define ospfVirtIfAuthKey		76
+#define ospfVirtIfStatus		77
+#define ospfNbrIpAddr		78
+#define ospfNbrAddressLessIndex		79
+#define ospfNbrRtrId		80
+#define ospfNbrOptions		81
+#define ospfNbrPriority		82
+#define ospfNbrState		83
+#define ospfNbrEvents		84
+#define ospfNbrLsRetransQLen		85
+#define ospfNbmaNbrStatus		86
+#define ospfNbmaNbrPermanence		87
+#define ospfVirtNbrArea		88
+#define ospfVirtNbrRtrId		89
+#define ospfVirtNbrIpAddr		90
+#define ospfVirtNbrOptions		91
+#define ospfVirtNbrState		92
+#define ospfVirtNbrEvents		93
+#define ospfVirtNbrLsRetransQLen		94
+#define ospfExtLsdbType		95
+#define ospfExtLsdbLsid		96
+#define ospfExtLsdbRouterId		97
+#define ospfExtLsdbSequence		98
+#define ospfExtLsdbAge		99
+#define ospfExtLsdbChecksum		100
+#define ospfExtLsdbAdvertisement		101
+#define ospfAreaAggregateAreaID		102
+#define ospfAreaAggregateLsdbType		103
+#define ospfAreaAggregateNet		104
+#define ospfAreaAggregateMask		105
+#define ospfAreaAggregateStatus		106
+#define ospfAreaAggregateEffect		107
+
+#endif                          /* _MIBGROUP_SNMP_OSPF_H */
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/smux/snmp_rip2.c tomato121/release/src/router/snmp/agent/mibgroup/smux/snmp_rip2.c
--- tomato/release/src/router/snmp/agent/mibgroup/smux/snmp_rip2.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/smux/snmp_rip2.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,184 @@
+/*
+ * $Id: snmp_rip2.c,v 1.1.2.1 2004/06/20 21:54:23 nikki Exp $ 
+ */
+
+/*
+ * Smux module authored by Rohit Dube.
+ */
+
+#include <net-snmp/net-snmp-config.h>
+
+#include <stdio.h>
+#if HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#if HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+#if HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#if HAVE_ERR_H
+#include <err.h>
+#endif
+#if TIME_WITH_SYS_TIME
+# include <sys/time.h>
+# include <time.h>
+#else
+# if HAVE_SYS_TIME_H
+#  include <sys/time.h>
+# else
+#  include <time.h>
+# endif
+#endif
+#include <errno.h>
+#include <netdb.h>
+
+#include <sys/stat.h>
+#include <sys/socket.h>
+#if HAVE_SYS_FILIO_H
+#include <sys/filio.h>
+#endif
+
+#if HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include "smux.h"
+#include "snmp_rip2.h"
+
+static oid      max_rip_mib[] =
+    { 1, 3, 6, 1, 2, 1, 23, 3, 1, 9, 255, 255, 255, 255 };
+static oid      min_rip_mib[] = { 1, 3, 6, 1, 2, 1, 23, 1, 1, 0 };
+extern u_char   smux_type;
+
+struct variable13 rip2_variables[] = {
+    {RIP2GLOBALROUTECHANGES, ASN_COUNTER, RONLY, var_rip2, 2, {1, 1}},
+    {RIP2GLOBALQUERIES, ASN_COUNTER, RONLY, var_rip2, 2, {1, 2}},
+    {RIP2IFSTATADDRESS, ASN_IPADDRESS, RONLY, var_rip2, 3, {2, 1, 1}},
+    {RIP2IFSTATRCVBADPKTS, ASN_COUNTER, RONLY, var_rip2, 3, {2, 1, 2}},
+    {RIP2IFSTATRCVBADROUTES, ASN_COUNTER, RONLY, var_rip2, 3, {2, 1, 3}},
+    {RIP2IFSTATSENTUPDATES, ASN_COUNTER, RONLY, var_rip2, 3, {2, 1, 4}},
+    {RIP2IFSTATSTATUS, ASN_INTEGER, RWRITE, var_rip2, 3, {2, 1, 5}},
+    {RIP2IFCONFADDRESS, ASN_IPADDRESS, RONLY, var_rip2, 3, {3, 1, 1}},
+    {RIP2IFCONFDOMAIN, ASN_OCTET_STR, RWRITE, var_rip2, 3, {3, 1, 2}},
+    {RIP2IFCONFAUTHTYPE, ASN_INTEGER, RWRITE, var_rip2, 3, {3, 1, 3}},
+    {RIP2IFCONFAUTHKEY, ASN_OCTET_STR, RWRITE, var_rip2, 3, {3, 1, 4}},
+    {RIP2IFCONFSEND, ASN_INTEGER, RWRITE, var_rip2, 3, {3, 1, 5}},
+    {RIP2IFCONFRECEIVE, ASN_INTEGER, RWRITE, var_rip2, 3, {3, 1, 6}},
+    {RIP2IFCONFDEFAULTMETRIC, ASN_INTEGER, RWRITE, var_rip2, 3, {3, 1, 7}},
+    {RIP2IFCONFSTATUS, ASN_INTEGER, RWRITE, var_rip2, 3, {3, 1, 8}},
+    {RIP2IFCONFSRCADDRESS, ASN_IPADDRESS, RWRITE, var_rip2, 3, {3, 1, 9}},
+    {RIP2PEERADDRESS, ASN_IPADDRESS, RONLY, var_rip2, 3, {4, 1, 1}},
+    {RIP2PEERDOMAIN, ASN_OCTET_STR, RONLY, var_rip2, 3, {4, 1, 2}},
+    {RIP2PEERLASTUPDATE, ASN_TIMETICKS, RONLY, var_rip2, 3, {4, 1, 3}},
+    {RIP2PEERVERSION, ASN_INTEGER, RONLY, var_rip2, 3, {4, 1, 4}},
+    {RIP2PEERRCVBADPKTS, ASN_COUNTER, RONLY, var_rip2, 3, {4, 1, 5}},
+    {RIP2PEERRCVBADROUTES, ASN_COUNTER, RONLY, var_rip2, 3, {4, 1, 6}}
+};
+
+oid             rip2_variables_oid[] = { MIB, 23 };
+
+void
+init_snmp_rip2(void)
+{
+    REGISTER_MIB("smux/snmp_rip2", rip2_variables, variable13,
+                 rip2_variables_oid);
+}
+
+u_char         *
+var_rip2(struct variable *vp,
+         oid * name,
+         int *length, int exact, int *var_len, WriteMethod ** write_method)
+{
+    u_char         *var;
+    int             result;
+
+    DEBUGMSGTL(("smux/snmp_rip2",
+                "[var_rip2] var len %d, oid requested Len %d-", *var_len,
+                *length));
+    DEBUGMSGOID(("smux/snmp_rip2", name, *length));
+    DEBUGMSG(("smux/snmp_rip2", "\n"));
+
+    /*
+     * Pass on the request to Gated.
+     * If the request sent out was a get next, check to see if
+     * it lies in the rip2 range. If it doesn't, return NULL.
+     * In either case, make sure that errors are checked on the
+     * returned packets.
+     */
+
+    /*
+     * No writes for now 
+     */
+    *write_method = NULL;
+
+    /*
+     * Donot allow access to the peer stuff as it crashes gated.
+     * However A GetNext on the last 23.3.1.9 variable will force gated into
+     * the peer stuff and cause it to crash.
+     * The only way to fix this is to either solve the Gated problem, or 
+     * remove the peer variables from Gated itself and cause it to return
+     * NULL at the crossing. Currently doing the later.
+     */
+
+    /*
+     * Reject GET and GETNEXT for anything above rip2ifconf range 
+     */
+    result = snmp_oid_compare(name, *length, max_rip_mib,
+                              sizeof(max_rip_mib) / sizeof(u_int));
+
+    if (result >= 0) {
+        DEBUGMSGTL(("smux/snmp_rip2", "Over shot\n"));
+        return NULL;
+    }
+
+    /*
+     * for GETs we need to be in the rip2 range so reject anything below 
+     */
+    result = snmp_oid_compare(name, *length, min_rip_mib,
+                              sizeof(min_rip_mib) / sizeof(u_int));
+    if (exact && (result < 0)) {
+        DEBUGMSGTL(("smux/snmp_rip2",
+                    "Exact but doesn't match length %d, size %d\n",
+                    *length, sizeof(min_rip_mib)));
+        return NULL;
+    }
+
+    /*
+     * On return, 'var' points to the value returned which is of length
+     * '*var_len'. 'name' points to the new (same as the one passed in for 
+     * GETs) oid which has 'length' suboids.
+     * 'smux_type' contains the type of the variable.
+     */
+    var = smux_snmp_process(exact, name, length, var_len);
+
+    DEBUGMSGTL(("smux/snmp_rip2",
+                "[var_rip2] var len %d, oid obtained Len %d-", *var_len,
+                *length));
+    DEBUGMSGOID(("smux/snmp_rip2", name, *length));
+    DEBUGMSG(("smux/snmp_rip2", "\n"));
+
+    vp->type = smux_type;
+
+    /*
+     * XXX Need a mechanism to return errors in gated's responses 
+     */
+
+    if (var == NULL)
+        return NULL;
+
+    /*
+     * Any resullt returned should be within the rip2 tree.
+     * rip_mib - static u_int rip_mib[] = {1, 3, 6, 1, 2, 1, 23};
+     */
+    if (memcmp(rip_mib, name, sizeof(rip_mib)) != 0) {
+        return NULL;
+    } else {
+        return var;
+    }
+}
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/smux/snmp_rip2.h tomato121/release/src/router/snmp/agent/mibgroup/smux/snmp_rip2.h
--- tomato/release/src/router/snmp/agent/mibgroup/smux/snmp_rip2.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/smux/snmp_rip2.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,37 @@
+/*
+ *  snmp_rip2.h
+ *
+ */
+#ifndef _MIBGROUP_SNMP_RIP2_H
+#define _MIBGROUP_SNMP_RIP2_H
+
+config_require(smux/smux)
+
+     extern FindVarMethod var_rip2;;
+     void            init_snmp_rip2(void);
+
+
+#define RIP2GLOBALROUTECHANGES  0
+#define RIP2GLOBALQUERIES       1
+#define RIP2IFSTATADDRESS       2
+#define RIP2IFSTATRCVBADPKTS    3
+#define RIP2IFSTATRCVBADROUTES  4
+#define RIP2IFSTATSENTUPDATES   5
+#define RIP2IFSTATSTATUS        6
+#define RIP2IFCONFADDRESS       7
+#define RIP2IFCONFDOMAIN        8
+#define RIP2IFCONFAUTHTYPE      9
+#define RIP2IFCONFAUTHKEY       10
+#define RIP2IFCONFSEND          11
+#define RIP2IFCONFRECEIVE       12
+#define RIP2IFCONFDEFAULTMETRIC 13
+#define RIP2IFCONFSTATUS        14
+#define RIP2IFCONFSRCADDRESS    15
+#define RIP2PEERADDRESS         16
+#define RIP2PEERDOMAIN          17
+#define RIP2PEERLASTUPDATE      18
+#define RIP2PEERVERSION         19
+#define RIP2PEERRCVBADPKTS      20
+#define RIP2PEERRCVBADROUTES    21
+
+#endif                          /* _MIBGROUP_SNMP_RIP2_H */
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/smux_gated.h tomato121/release/src/router/snmp/agent/mibgroup/smux_gated.h
--- tomato/release/src/router/snmp/agent/mibgroup/smux_gated.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/smux_gated.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,6 @@
+/*
+ * dummy module to load parts needed for smux/gated interaction 
+ */
+config_require(smux/snmp_ospf)
+config_require(smux/snmp_rip2)
+config_require(smux/snmp_bgp)
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/smux.h tomato121/release/src/router/snmp/agent/mibgroup/smux.h
--- tomato/release/src/router/snmp/agent/mibgroup/smux.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/smux.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,4 @@
+/*
+ * smux.h: top level .h file to merely include the sub-module.
+ */
+config_require(smux/smux)
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/snmpv3/.cvsignore tomato121/release/src/router/snmp/agent/mibgroup/snmpv3/.cvsignore
--- tomato/release/src/router/snmp/agent/mibgroup/snmpv3/.cvsignore	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/snmpv3/.cvsignore	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,2 @@
+.libs
+*.lo
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/snmpv3/snmpEngine.c tomato121/release/src/router/snmp/agent/mibgroup/snmpv3/snmpEngine.c
--- tomato/release/src/router/snmp/agent/mibgroup/snmpv3/snmpEngine.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/snmpv3/snmpEngine.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,212 @@
+/*
+ * snmpEngine.c: implement's the SNMP-FRAMEWORK-MIB. 
+ */
+
+#include <net-snmp/net-snmp-config.h>
+
+#if HAVE_WINSOCK_H
+#include <winsock.h>
+#endif
+
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+#include "util_funcs.h"
+#include "mibII/sysORTable.h"
+#include "snmpEngine.h"
+
+struct variable2 snmpEngine_variables[] = {
+    {SNMPENGINEID, ASN_OCTET_STR, RONLY, var_snmpEngine, 1, {1}},
+#ifdef SNMP_TESTING_CODE
+    {SNMPENGINEBOOTS, ASN_INTEGER, RWRITE, var_snmpEngine, 1, {2}},
+    {SNMPENGINETIME, ASN_INTEGER, RWRITE, var_snmpEngine, 1, {3}},
+#else                           /* !SNMP_TESTING_CODE */
+    {SNMPENGINEBOOTS, ASN_INTEGER, RONLY, var_snmpEngine, 1, {2}},
+    {SNMPENGINETIME, ASN_INTEGER, RONLY, var_snmpEngine, 1, {3}},
+#endif                          /* SNMP_TESTING_CODE */
+    {SNMPENGINEMAXMESSAGESIZE, ASN_INTEGER, RONLY, var_snmpEngine, 1, {4}},
+};
+
+/*
+ * now load this mib into the agents mib table 
+ */
+oid             snmpEngine_variables_oid[] =
+    { 1, 3, 6, 1, 6, 3, 10, 2, 1 };
+
+void
+init_snmpEngine(void)
+{
+#ifdef USING_MIBII_SYSORTABLE_MODULE
+    static oid      reg[] = { 1, 3, 6, 1, 6, 3, 10, 3, 1, 1 };
+    register_sysORTable(reg, 10, "The SNMP Management Architecture MIB.");
+#endif
+
+    REGISTER_MIB("snmpv3/snmpEngine", snmpEngine_variables, variable2,
+                 snmpEngine_variables_oid);
+
+    /*
+     * place any initialization routines needed here 
+     */
+}
+
+extern struct timeval starttime;
+
+#ifdef SNMP_TESTING_CODE
+int             write_engineBoots(int, u_char *, u_char, size_t, u_char *,
+                                  oid *, size_t);
+int             write_engineTime(int, u_char *, u_char, size_t, u_char *,
+                                 oid *, size_t);
+#endif                          /* SNMP_TESTING_CODE */
+
+u_char         *
+var_snmpEngine(struct variable *vp,
+               oid * name,
+               size_t * length,
+               int exact, size_t * var_len, WriteMethod ** write_method)
+{
+
+    /*
+     * variables we may use later 
+     */
+    static long     long_ret;
+    static unsigned char engineID[SNMP_MAXBUF];
+
+    *write_method = 0;          /* assume it isnt writable for the time being */
+    *var_len = sizeof(long_ret);        /* assume an integer and change later if not */
+
+    if (header_generic(vp, name, length, exact, var_len, write_method))
+        return 0;
+
+    /*
+     * this is where we do the value assignments for the mib results. 
+     */
+    switch (vp->magic) {
+
+    case SNMPENGINEID:
+        *var_len = snmpv3_get_engineID(engineID, SNMP_MAXBUF);
+        /*
+         * XXX  Set ERROR_MSG() upon error? 
+         */
+        return (unsigned char *) engineID;
+
+    case SNMPENGINEBOOTS:
+#ifdef SNMP_TESTING_CODE
+        *write_method = write_engineBoots;
+#endif                          /* SNMP_TESTING_CODE */
+        long_ret = snmpv3_local_snmpEngineBoots();
+        return (unsigned char *) &long_ret;
+
+    case SNMPENGINETIME:
+#ifdef SNMP_TESTING_CODE
+        *write_method = write_engineTime;
+#endif                          /* SNMP_TESTING_CODE */
+        long_ret = snmpv3_local_snmpEngineTime();
+        return (unsigned char *) &long_ret;
+
+    case SNMPENGINEMAXMESSAGESIZE:
+        long_ret = 1500;
+        return (unsigned char *) &long_ret;
+
+    default:
+        DEBUGMSGTL(("snmpd", "unknown sub-id %d in var_snmpEngine\n",
+                    vp->magic));
+    }
+    return 0;
+}
+
+#ifdef SNMP_TESTING_CODE
+/*
+ * write_engineBoots():
+ * 
+ * This is technically not writable a writable mib object, but we
+ * allow it so we can run some time synchronization tests.
+ */
+int
+write_engineBoots(int action,
+                  u_char * var_val,
+                  u_char var_val_type,
+                  size_t var_val_len,
+                  u_char * statP, oid * name, size_t name_len)
+{
+    /*
+     * variables we may use later 
+     */
+    static long     long_ret;
+    size_t          size;
+    int             bigsize = SNMP_MAXBUF_MEDIUM;
+    u_char          engineIDBuf[SNMP_MAXBUF_MEDIUM];
+    int             engineIDBufLen = 0;
+
+    if (var_val_type != ASN_INTEGER) {
+        DEBUGMSGTL(("snmpEngine",
+                    "write to engineBoots not ASN_INTEGER\n"));
+        return SNMP_ERR_WRONGTYPE;
+    }
+    if (var_val_len > sizeof(long_ret)) {
+        DEBUGMSGTL(("snmpEngine", "write to engineBoots: bad length\n"));
+        return SNMP_ERR_WRONGLENGTH;
+    }
+    long_ret = *((long *) var_val);
+    if (action == COMMIT) {
+        engineIDBufLen =
+            snmpv3_get_engineID(engineIDBuf, SNMP_MAXBUF_MEDIUM);
+        /*
+         * set our local engineTime in the LCD timing cache 
+         */
+        snmpv3_set_engineBootsAndTime(long_ret,
+                                      snmpv3_local_snmpEngineTime());
+        set_enginetime(engineIDBuf, engineIDBufLen,
+                       snmpv3_local_snmpEngineBoots(),
+                       snmpv3_local_snmpEngineTime(), TRUE);
+    }
+    return SNMP_ERR_NOERROR;
+}
+
+/*
+ * write_engineTime():
+ * 
+ * This is technically not writable a writable mib object, but we
+ * allow it so we can run some time synchronization tests.
+ */
+int
+write_engineTime(int action,
+                 u_char * var_val,
+                 u_char var_val_type,
+                 size_t var_val_len,
+                 u_char * statP, oid * name, size_t name_len)
+{
+    /*
+     * variables we may use later 
+     */
+    static long     long_ret;
+    size_t          size;
+    int             bigsize = SNMP_MAXBUF_MEDIUM;
+    u_char          engineIDBuf[SNMP_MAXBUF_MEDIUM];
+    int             engineIDBufLen = 0;
+
+    if (var_val_type != ASN_INTEGER) {
+        DEBUGMSGTL(("snmpEngine",
+                    "write to engineTime not ASN_INTEGER\n"));
+        return SNMP_ERR_WRONGTYPE;
+    }
+    if (var_val_len > sizeof(long_ret)) {
+        DEBUGMSGTL(("snmpEngine", "write to engineTime: bad length\n"));
+        return SNMP_ERR_WRONGLENGTH;
+    }
+    long_ret = *((long *) var_val);
+    if (action == COMMIT) {
+        engineIDBufLen =
+            snmpv3_get_engineID(engineIDBuf, SNMP_MAXBUF_MEDIUM);
+        /*
+         * set our local engineTime in the LCD timing cache 
+         */
+        snmpv3_set_engineBootsAndTime(snmpv3_local_snmpEngineBoots(),
+                                      long_ret);
+        set_enginetime(engineIDBuf, engineIDBufLen,
+                       snmpv3_local_snmpEngineBoots(),
+                       snmpv3_local_snmpEngineTime(), TRUE);
+    }
+    return SNMP_ERR_NOERROR;
+}
+
+#endif                          /* SNMP_TESTING_CODE */
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/snmpv3/snmpEngine.h tomato121/release/src/router/snmp/agent/mibgroup/snmpv3/snmpEngine.h
--- tomato/release/src/router/snmp/agent/mibgroup/snmpv3/snmpEngine.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/snmpv3/snmpEngine.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,32 @@
+/*
+ * snmpEngine.h
+ *
+ * This file was generated by mib2c and is intended for use as a mib module
+ * for the ucd-snmp snmpd agent.
+ */
+
+
+#ifndef _MIBGROUP_SNMPENGINE_H
+#define _MIBGROUP_SNMPENGINE_H
+
+/*
+ * we use header_generic and checkmib from the util_funcs module 
+ */
+
+config_require(util_funcs)
+config_add_mib(SNMP-FRAMEWORK-MIB)
+
+    /*
+     * Magic number definitions: 
+     */
+#define   SNMPENGINEID          1
+#define   SNMPENGINEBOOTS       2
+#define   SNMPENGINETIME        3
+#define   SNMPENGINEMAXMESSAGESIZE  4
+    /*
+     * function definitions 
+     */
+     extern void     init_snmpEngine(void);
+     extern FindVarMethod var_snmpEngine;
+
+#endif                          /* _MIBGROUP_SNMPENGINE_H */
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/snmpv3/snmpMPDStats.c tomato121/release/src/router/snmp/agent/mibgroup/snmpv3/snmpMPDStats.c
--- tomato/release/src/router/snmp/agent/mibgroup/snmpv3/snmpMPDStats.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/snmpv3/snmpMPDStats.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,75 @@
+/*
+ * snmpMPDStats.c: tallies errors for SNMPv3 message processing. 
+ */
+
+#include <net-snmp/net-snmp-config.h>
+
+#if HAVE_WINSOCK_H
+#include <winsock.h>
+#endif
+
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+#include "mibII/sysORTable.h"
+#include "snmpMPDStats.h"
+#include "util_funcs.h"
+
+
+struct variable2 snmpMPDStats_variables[] = {
+    {SNMPUNKNOWNSECURITYMODELS, ASN_COUNTER, RONLY, var_snmpMPDStats, 1,
+     {1}},
+    {SNMPINVALIDMSGS, ASN_COUNTER, RONLY, var_snmpMPDStats, 1, {2}},
+    {SNMPUNKNOWNPDUHANDLERS, ASN_COUNTER, RONLY, var_snmpMPDStats, 1, {3}},
+};
+
+/*
+ * now load this mib into the agents mib table 
+ */
+oid             snmpMPDStats_variables_oid[] =
+    { 1, 3, 6, 1, 6, 3, 11, 2, 1 };
+
+void
+init_snmpMPDStats(void)
+{
+#ifdef USING_MIBII_SYSORTABLE_MODULE
+    static oid      reg[] = { 1, 3, 6, 1, 6, 3, 11, 3, 1, 1 };
+    register_sysORTable(reg, 10,
+                        "The MIB for Message Processing and Dispatching.");
+#endif
+
+    REGISTER_MIB("snmpv3/snmpMPDStats", snmpMPDStats_variables, variable2,
+                 snmpMPDStats_variables_oid);
+}
+
+u_char         *
+var_snmpMPDStats(struct variable *vp,
+                 oid * name,
+                 size_t * length,
+                 int exact, size_t * var_len, WriteMethod ** write_method)
+{
+
+    /*
+     * variables we may use later 
+     */
+    static long     long_ret;
+    int             tmagic;
+
+
+    *write_method = 0;          /* assume it isnt writable for the time being */
+    *var_len = sizeof(long_ret);        /* assume an integer and change later if not */
+
+    if (header_generic(vp, name, length, exact, var_len, write_method))
+        return 0;
+
+    /*
+     * this is where we do the value assignments for the mib results. 
+     */
+    tmagic = vp->magic;
+    if ((tmagic >= 0)
+        && (tmagic <= (STAT_MPD_STATS_END - STAT_MPD_STATS_START))) {
+        long_ret = snmp_get_statistic(tmagic + STAT_MPD_STATS_START);
+        return (unsigned char *) &long_ret;
+    }
+    return 0;
+}
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/snmpv3/snmpMPDStats.h tomato121/release/src/router/snmp/agent/mibgroup/snmpv3/snmpMPDStats.h
--- tomato/release/src/router/snmp/agent/mibgroup/snmpv3/snmpMPDStats.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/snmpv3/snmpMPDStats.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,29 @@
+
+/*
+ * This file was generated by mib2c and is intended for use as a mib module
+ * for the ucd-snmp snmpd agent. 
+ */
+
+#ifndef _MIBGROUP_SNMPMPDSTATS_H
+#define _MIBGROUP_SNMPMPDSTATS_H
+
+/*
+ * we use header_generic and checkmib from the util_funcs module 
+ */
+
+config_require(util_funcs)
+config_add_mib(SNMP-MPD-MIB)
+
+    /*
+     * Magic number definitions: 
+     */
+#define   SNMPUNKNOWNSECURITYMODELS  0
+#define   SNMPINVALIDMSGS            1
+#define   SNMPUNKNOWNPDUHANDLERS     2
+    /*
+     * function definitions 
+     */
+     void            init_snmpMPDStats(void);
+     extern FindVarMethod var_snmpMPDStats;
+
+#endif                          /* _MIBGROUP_SNMPMPDSTATS_H */
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/snmpv3/usmStats.c tomato121/release/src/router/snmp/agent/mibgroup/snmpv3/usmStats.c
--- tomato/release/src/router/snmp/agent/mibgroup/snmpv3/usmStats.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/snmpv3/usmStats.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,77 @@
+
+/*
+ * usmStats.c: implements the usmStats portion of the SNMP-USER-BASED-SM-MIB 
+ */
+
+#include <net-snmp/net-snmp-config.h>
+
+#if HAVE_WINSOCK_H
+#include <winsock.h>
+#endif
+
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+#include "util_funcs.h"
+#include "mibII/sysORTable.h"
+#include "usmStats.h"
+
+struct variable2 usmStats_variables[] = {
+    {USMSTATSUNSUPPORTEDSECLEVELS, ASN_COUNTER, RONLY, var_usmStats, 1,
+     {1}},
+    {USMSTATSNOTINTIMEWINDOWS, ASN_COUNTER, RONLY, var_usmStats, 1, {2}},
+    {USMSTATSUNKNOWNUSERNAMES, ASN_COUNTER, RONLY, var_usmStats, 1, {3}},
+    {USMSTATSUNKNOWNENGINEIDS, ASN_COUNTER, RONLY, var_usmStats, 1, {4}},
+    {USMSTATSWRONGDIGESTS, ASN_COUNTER, RONLY, var_usmStats, 1, {5}},
+    {USMSTATSDECRYPTIONERRORS, ASN_COUNTER, RONLY, var_usmStats, 1, {6}},
+};
+
+/*
+ * now load this mib into the agents mib table 
+ */
+oid             usmStats_variables_oid[] = { 1, 3, 6, 1, 6, 3, 15, 1, 1 };
+
+
+void
+init_usmStats(void)
+{
+#ifdef USING_MIBII_SYSORTABLE_MODULE
+    static oid      reg[] = { 1, 3, 6, 1, 6, 3, 15, 2, 1, 1 };
+    register_sysORTable(reg, 10,
+                        "The management information definitions for the SNMP User-based Security Model.");
+#endif
+
+    REGISTER_MIB("snmpv3/usmStats", usmStats_variables, variable2,
+                 usmStats_variables_oid);
+}
+
+u_char         *
+var_usmStats(struct variable *vp,
+             oid * name,
+             size_t * length,
+             int exact, size_t * var_len, WriteMethod ** write_method)
+{
+
+    /*
+     * variables we may use later 
+     */
+    static long     long_ret;
+    int             tmagic;
+
+    *write_method = 0;          /* assume it isnt writable for the time being */
+    *var_len = sizeof(long_ret);        /* assume an integer and change later if not */
+
+    if (header_generic(vp, name, length, exact, var_len, write_method))
+        return 0;
+
+    /*
+     * this is where we do the value assignments for the mib results. 
+     */
+    tmagic = vp->magic;
+    if ((tmagic >= 0)
+        && (tmagic <= (STAT_USM_STATS_END - STAT_USM_STATS_START))) {
+        long_ret = snmp_get_statistic(tmagic + STAT_USM_STATS_START);
+        return (unsigned char *) &long_ret;
+    }
+    return 0;
+}
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/snmpv3/usmStats.h tomato121/release/src/router/snmp/agent/mibgroup/snmpv3/usmStats.h
--- tomato/release/src/router/snmp/agent/mibgroup/snmpv3/usmStats.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/snmpv3/usmStats.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,34 @@
+/*
+ * usmStats.h
+ *
+ * This file was generated by mib2c and is intended for use as a mib module
+ * for the ucd-snmp snmpd agent.
+ */
+
+#ifndef _MIBGROUP_USMSTATS_H
+#define _MIBGROUP_USMSTATS_H
+
+/*
+ * we use header_generic and checkmib from the util_funcs module 
+ */
+
+config_require(util_funcs)
+config_add_mib(SNMP-USER-BASED-SM-MIB)
+
+    /*
+     * Magic number definitions: 
+     */
+#define   USMSTATSUNSUPPORTEDSECLEVELS  0
+#define   USMSTATSNOTINTIMEWINDOWS      1
+#define   USMSTATSUNKNOWNUSERNAMES      2
+#define   USMSTATSUNKNOWNENGINEIDS      3
+#define   USMSTATSWRONGDIGESTS          4
+#define   USMSTATSDECRYPTIONERRORS      5
+    /*
+     * function definitions 
+     */
+     extern void     init_usmStats(void);
+     extern FindVarMethod var_usmStats;
+
+
+#endif                          /* _MIBGROUP_USMSTATS_H */
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/snmpv3/usmUser.c tomato121/release/src/router/snmp/agent/mibgroup/snmpv3/usmUser.c
--- tomato/release/src/router/snmp/agent/mibgroup/snmpv3/usmUser.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/snmpv3/usmUser.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,1560 @@
+/*
+ * usmUser.c
+ */
+
+#include <net-snmp/net-snmp-config.h>
+#include <stdlib.h>
+
+#if HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+
+#if HAVE_WINSOCK_H
+#include <winsock.h>
+#endif
+
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+#include "util_funcs.h"
+#include "usmUser.h"
+
+int usmStatusCheck(struct usmUser *uptr);
+
+struct variable4 usmUser_variables[] = {
+    {USMUSERSPINLOCK, ASN_INTEGER, RWRITE, var_usmUser, 1, {1}},
+    {USMUSERSECURITYNAME, ASN_OCTET_STR, RONLY, var_usmUser, 3, {2, 1, 3}},
+    {USMUSERCLONEFROM, ASN_OBJECT_ID, RWRITE, var_usmUser, 3, {2, 1, 4}},
+    {USMUSERAUTHPROTOCOL, ASN_OBJECT_ID, RWRITE, var_usmUser, 3,
+     {2, 1, 5}},
+    {USMUSERAUTHKEYCHANGE, ASN_OCTET_STR, RWRITE, var_usmUser, 3,
+     {2, 1, 6}},
+    {USMUSEROWNAUTHKEYCHANGE, ASN_OCTET_STR, RWRITE, var_usmUser, 3,
+     {2, 1, 7}},
+    {USMUSERPRIVPROTOCOL, ASN_OBJECT_ID, RWRITE, var_usmUser, 3,
+     {2, 1, 8}},
+    {USMUSERPRIVKEYCHANGE, ASN_OCTET_STR, RWRITE, var_usmUser, 3,
+     {2, 1, 9}},
+    {USMUSEROWNPRIVKEYCHANGE, ASN_OCTET_STR, RWRITE, var_usmUser, 3,
+     {2, 1, 10}},
+    {USMUSERPUBLIC, ASN_OCTET_STR, RWRITE, var_usmUser, 3, {2, 1, 11}},
+    {USMUSERSTORAGETYPE, ASN_INTEGER, RWRITE, var_usmUser, 3, {2, 1, 12}},
+    {USMUSERSTATUS, ASN_INTEGER, RWRITE, var_usmUser, 3, {2, 1, 13}},
+
+};
+
+oid             usmUser_variables_oid[] = { 1, 3, 6, 1, 6, 3, 15, 1, 2 };
+
+
+/*
+ * needed for the write_ functions to find the start of the index 
+ */
+#define USM_MIB_LENGTH 12
+
+static unsigned int usmUserSpinLock = 0;
+
+void
+init_usmUser(void)
+{
+    snmpd_register_config_handler("usmUser",
+                                  usm_parse_config_usmUser, NULL, NULL);
+    snmpd_register_config_handler("createUser",
+                                  usm_parse_create_usmUser, NULL,
+                                  "username (MD5|SHA) passphrase [DES [passphrase]]");
+
+    /*
+     * we need to be called back later 
+     */
+    snmp_register_callback(SNMP_CALLBACK_LIBRARY, SNMP_CALLBACK_STORE_DATA,
+                           usm_store_users, NULL);
+
+    REGISTER_MIB("snmpv3/usmUser", usmUser_variables, variable4,
+                 usmUser_variables_oid);
+}
+
+/*******************************************************************-o-******
+ * usm_generate_OID
+ *
+ * Parameters:
+ *	*prefix		(I) OID prefix to the usmUser table entry.
+ *	 prefixLen	(I)
+ *	*uptr		(I) Pointer to a user in the user list.
+ *	*length		(O) Length of generated index OID.
+ *      
+ * Returns:
+ *	Pointer to the OID index for the user (uptr)  -OR-
+ *	NULL on failure.
+ *
+ *
+ * Generate the index OID for a given usmUser name.  'length' is set to
+ * the length of the index OID.
+ *
+ * Index OID format is:
+ *
+ *    <...prefix>.<engineID_length>.<engineID>.<user_name_length>.<user_name>
+ */
+oid            *
+usm_generate_OID(oid * prefix, size_t prefixLen, struct usmUser *uptr,
+                 size_t * length)
+{
+    oid            *indexOid;
+    int             i;
+
+    *length = 2 + uptr->engineIDLen + strlen(uptr->name) + prefixLen;
+    indexOid = (oid *) malloc(*length * sizeof(oid));
+    if (indexOid) {
+        memmove(indexOid, prefix, prefixLen * sizeof(oid));
+
+        indexOid[prefixLen] = uptr->engineIDLen;
+        for (i = 0; i < (int) uptr->engineIDLen; i++)
+            indexOid[prefixLen + 1 + i] = (oid) uptr->engineID[i];
+
+        indexOid[prefixLen + uptr->engineIDLen + 1] = strlen(uptr->name);
+        for (i = 0; i < (int) strlen(uptr->name); i++)
+            indexOid[prefixLen + uptr->engineIDLen + 2 + i] =
+                (oid) uptr->name[i];
+    }
+    return indexOid;
+
+}                               /* end usm_generate_OID() */
+
+/*
+ * usm_parse_oid(): parses an index to the usmTable to break it down into
+ * a engineID component and a name component.  The results are stored in:
+ * 
+ * **engineID:   a newly malloced string.
+ * *engineIDLen: The length of the malloced engineID string above.
+ * **name:       a newly malloced string.
+ * *nameLen:     The length of the malloced name string above.
+ * 
+ * returns 1 if an error is encountered, or 0 if successful.
+ */
+int
+usm_parse_oid(oid * oidIndex, size_t oidLen,
+              unsigned char **engineID, size_t * engineIDLen,
+              unsigned char **name, size_t * nameLen)
+{
+    int             nameL;
+    int             engineIDL;
+    int             i;
+
+    /*
+     * first check the validity of the oid 
+     */
+    if ((oidLen <= 0) || (!oidIndex)) {
+        DEBUGMSGTL(("usmUser",
+                    "parse_oid: null oid or zero length oid passed in\n"));
+        return 1;
+    }
+    engineIDL = *oidIndex;      /* initial engineID length */
+    if ((int) oidLen < engineIDL + 2) {
+        DEBUGMSGTL(("usmUser",
+                    "parse_oid: invalid oid length: less than the engineIDLen\n"));
+        return 1;
+    }
+    nameL = oidIndex[engineIDL + 1];    /* the initial name length */
+    if ((int) oidLen != engineIDL + nameL + 2) {
+        DEBUGMSGTL(("usmUser",
+                    "parse_oid: invalid oid length: length is not exact\n"));
+        return 1;
+    }
+
+    /*
+     * its valid, malloc the space and store the results 
+     */
+    if (engineID == NULL || name == NULL) {
+        DEBUGMSGTL(("usmUser",
+                    "parse_oid: null storage pointer passed in.\n"));
+        return 1;
+    }
+
+    *engineID = (unsigned char *) malloc(engineIDL);
+    if (*engineID == NULL) {
+        DEBUGMSGTL(("usmUser",
+                    "parse_oid: malloc of the engineID failed\n"));
+        return 1;
+    }
+    *engineIDLen = engineIDL;
+
+    *name = (unsigned char *) malloc(nameL + 1);
+    if (*name == NULL) {
+        DEBUGMSGTL(("usmUser", "parse_oid: malloc of the name failed\n"));
+        free(*engineID);
+        return 1;
+    }
+    *nameLen = nameL;
+
+    for (i = 0; i < engineIDL; i++) {
+        if (oidIndex[i + 1] > 255) {
+            goto UPO_parse_error;
+        }
+        engineID[0][i] = (unsigned char) oidIndex[i + 1];
+    }
+
+    for (i = 0; i < nameL; i++) {
+        if (oidIndex[i + 2 + engineIDL] > 255) {
+          UPO_parse_error:
+            free(*engineID);
+            free(*name);
+            return 1;
+        }
+        name[0][i] = (unsigned char) oidIndex[i + 2 + engineIDL];
+    }
+    name[0][nameL] = 0;
+
+    return 0;
+
+}                               /* end usm_parse_oid() */
+
+/*******************************************************************-o-******
+ * usm_parse_user
+ *
+ * Parameters:
+ *	*name		Complete OID indexing a given usmUser entry.
+ *	 name_length
+ *      
+ * Returns:
+ *	Pointer to a usmUser  -OR-
+ *	NULL if name does not convert to a usmUser.
+ * 
+ * Convert an (full) OID and return a pointer to a matching user in the
+ * user list if one exists.
+ */
+struct usmUser *
+usm_parse_user(oid * name, size_t name_len)
+{
+    struct usmUser *uptr;
+
+    char           *newName;
+    u_char         *engineID;
+    size_t          nameLen, engineIDLen;
+
+    /*
+     * get the name and engineID out of the incoming oid 
+     */
+    if (usm_parse_oid(&name[USM_MIB_LENGTH], name_len - USM_MIB_LENGTH,
+                      &engineID, &engineIDLen, (u_char **) & newName,
+                      &nameLen))
+        return NULL;
+
+    /*
+     * Now see if a user exists with these index values 
+     */
+    uptr = usm_get_user(engineID, engineIDLen, newName);
+    free(engineID);
+    free(newName);
+
+    return uptr;
+
+}                               /* end usm_parse_user() */
+
+/*******************************************************************-o-******
+ * var_usmUser
+ *
+ * Parameters:
+ *	  *vp	   (I)     Variable-binding associated with this action.
+ *	  *name	   (I/O)   Input name requested, output name found.
+ *	  *length  (I/O)   Length of input and output oid's.
+ *	   exact   (I)     TRUE if an exact match was requested.
+ *	  *var_len (O)     Length of variable or 0 if function returned.
+ *	(**write_method)   Hook to name a write method (UNUSED).
+ *      
+ * Returns:
+ *	Pointer to (char *) containing related data of length 'length'
+ *	  (May be NULL.)
+ *
+ *
+ * Call-back function passed to the agent in order to return information
+ * for the USM MIB tree.
+ *
+ *
+ * If this invocation is not for USMUSERSPINLOCK, lookup user name
+ * in the usmUser list.
+ *
+ * If the name does not match any user and the request
+ * is for an exact match, -or- if the usmUser list is empty, create a 
+ * new list entry.
+ *
+ * Finally, service the given USMUSER* var-bind.  A NULL user generally
+ * results in a NULL return value.
+ */
+u_char         *
+var_usmUser(struct variable * vp,
+            oid * name,
+            size_t * length,
+            int exact, size_t * var_len, WriteMethod ** write_method)
+{
+    struct usmUser *uptr = NULL, *nptr, *pptr;
+    int             i, rtest, result;
+    oid            *indexOid;
+    size_t          len;
+
+    /*
+     * variables we may use later 
+     */
+    static long     long_ret;
+    static u_char   string[1];
+    static oid      objid[2];   /* for .0.0 */
+
+    *write_method = 0;          /* assume it isnt writable for the time being */
+    *var_len = sizeof(long_ret);        /* assume an integer and change later if not */
+
+    if (vp->magic != USMUSERSPINLOCK) {
+        oid             newname[MAX_OID_LEN];
+        len = (*length < vp->namelen) ? *length : vp->namelen;
+        rtest = snmp_oid_compare(name, len, vp->name, len);
+        if (rtest > 0 ||
+            /*
+             * (rtest == 0 && !exact && (int) vp->namelen+1 < (int) *length) || 
+             */
+            (exact == 1 && rtest != 0)) {
+            if (var_len)
+                *var_len = 0;
+            return 0;
+        }
+        memset(newname, 0, sizeof(newname));
+        if (((int) *length) <= (int) vp->namelen || rtest == -1) {
+            /*
+             * oid is not within our range yet 
+             */
+            /*
+             * need to fail if not exact 
+             */
+            uptr = usm_get_userList();
+
+        } else {
+            for (nptr = usm_get_userList(), pptr = NULL, uptr = NULL;
+                 nptr != NULL; pptr = nptr, nptr = nptr->next) {
+                indexOid =
+                    usm_generate_OID(vp->name, vp->namelen, nptr, &len);
+                result = snmp_oid_compare(name, *length, indexOid, len);
+                DEBUGMSGTL(("usmUser", "Checking user: %s - ",
+                            nptr->name));
+                for (i = 0; i < (int) nptr->engineIDLen; i++) {
+                    DEBUGMSG(("usmUser", " %x", nptr->engineID[i]));
+                }
+                DEBUGMSG(("usmUser", " - %d \n  -> OID: ", result));
+                DEBUGMSGOID(("usmUser", indexOid, len));
+                DEBUGMSG(("usmUser", "\n"));
+
+                free(indexOid);
+
+                if (exact) {
+                    if (result == 0) {
+                        uptr = nptr;
+                    }
+                } else {
+                    if (result == 0) {
+                        /*
+                         * found an exact match.  Need the next one for !exact 
+                         */
+                        uptr = nptr->next;
+                    } else if (result == -1) {
+                        uptr = nptr;
+                        break;
+                    }
+                }
+            }
+        }                       /* endif -- name <= vp->name */
+
+        /*
+         * if uptr is NULL and exact we need to continue for creates 
+         */
+        if (uptr == NULL && !exact)
+            return (NULL);
+
+        if (uptr) {
+            indexOid = usm_generate_OID(vp->name, vp->namelen, uptr, &len);
+            *length = len;
+            memmove(name, indexOid, len * sizeof(oid));
+            DEBUGMSGTL(("usmUser", "Found user: %s - ", uptr->name));
+            for (i = 0; i < (int) uptr->engineIDLen; i++) {
+                DEBUGMSG(("usmUser", " %x", uptr->engineID[i]));
+            }
+            DEBUGMSG(("usmUser", "\n  -> OID: "));
+            DEBUGMSGOID(("usmUser", indexOid, len));
+            DEBUGMSG(("usmUser", "\n"));
+
+            free(indexOid);
+        }
+    } else {
+        if (header_generic(vp, name, length, exact, var_len, write_method))
+            return 0;
+    }                           /* endif -- vp->magic != USMUSERSPINLOCK */
+
+    switch (vp->magic) {
+    case USMUSERSPINLOCK:
+        *write_method = write_usmUserSpinLock;
+        long_ret = usmUserSpinLock;
+        return (unsigned char *) &long_ret;
+
+    case USMUSERSECURITYNAME:
+        if (uptr) {
+            *var_len = strlen(uptr->secName);
+            return (unsigned char *) uptr->secName;
+        }
+        return NULL;
+
+    case USMUSERCLONEFROM:
+        *write_method = write_usmUserCloneFrom;
+        if (uptr) {
+            objid[0] = 0;       /* "When this object is read, the ZeroDotZero OID */
+            objid[1] = 0;       /*  is returned." */
+            *var_len = sizeof(oid) * 2;
+            return (unsigned char *) objid;
+        }
+        return NULL;
+
+    case USMUSERAUTHPROTOCOL:
+        *write_method = write_usmUserAuthProtocol;
+        if (uptr) {
+            *var_len = uptr->authProtocolLen * sizeof(oid);
+            return (u_char *) uptr->authProtocol;
+        }
+        return NULL;
+
+    case USMUSERAUTHKEYCHANGE:
+    case USMUSEROWNAUTHKEYCHANGE:
+        /*
+         * we treat these the same, and let the calling module
+         * distinguish between them 
+         */
+        *write_method = write_usmUserAuthKeyChange;
+        if (uptr) {
+            *string = 0;        /* always return a NULL string */
+            *var_len = 0;
+            return string;
+        }
+        return NULL;
+
+    case USMUSERPRIVPROTOCOL:
+        *write_method = write_usmUserPrivProtocol;
+        if (uptr) {
+            *var_len = uptr->privProtocolLen * sizeof(oid);
+            return (u_char *) uptr->privProtocol;
+        }
+        return NULL;
+
+    case USMUSERPRIVKEYCHANGE:
+    case USMUSEROWNPRIVKEYCHANGE:
+        /*
+         * we treat these the same, and let the calling module
+         * distinguish between them 
+         */
+        *write_method = write_usmUserPrivKeyChange;
+        if (uptr) {
+            *string = 0;        /* always return a NULL string */
+            *var_len = 0;
+            return string;
+        }
+        return NULL;
+
+    case USMUSERPUBLIC:
+        *write_method = write_usmUserPublic;
+        if (uptr) {
+            if (uptr->userPublicString) {
+                *var_len = strlen((char *) uptr->userPublicString);
+                return uptr->userPublicString;
+            }
+            *string = 0;
+            *var_len = 0;       /* return an empty string if the public
+                                 * string hasn't been defined yet */
+            return string;
+        }
+        return NULL;
+
+    case USMUSERSTORAGETYPE:
+        *write_method = write_usmUserStorageType;
+        if (uptr) {
+            long_ret = uptr->userStorageType;
+            return (unsigned char *) &long_ret;
+        }
+        return NULL;
+
+    case USMUSERSTATUS:
+        *write_method = write_usmUserStatus;
+        if (uptr) {
+            long_ret = uptr->userStatus;
+            return (unsigned char *) &long_ret;
+        }
+        return NULL;
+
+    default:
+        DEBUGMSGTL(("snmpd", "unknown sub-id %d in var_usmUser\n",
+                    vp->magic));
+    }
+    return 0;
+
+}                               /* end var_usmUser() */
+
+/*
+ * write_usmUserSpinLock(): called when a set is performed on the
+ * usmUserSpinLock object 
+ */
+int
+write_usmUserSpinLock(int action,
+                      u_char * var_val,
+                      u_char var_val_type,
+                      size_t var_val_len,
+                      u_char * statP, oid * name, size_t name_len)
+{
+    /*
+     * variables we may use later 
+     */
+    static long     long_ret;
+
+    if (var_val_type != ASN_INTEGER) {
+        DEBUGMSGTL(("usmUser",
+                    "write to usmUserSpinLock not ASN_INTEGER\n"));
+        return SNMP_ERR_WRONGTYPE;
+    }
+    if (var_val_len > sizeof(long_ret)) {
+        DEBUGMSGTL(("usmUser", "write to usmUserSpinLock: bad length\n"));
+        return SNMP_ERR_WRONGLENGTH;
+    }
+    long_ret = *((long *) var_val);
+    if (long_ret != (long) usmUserSpinLock)
+        return SNMP_ERR_INCONSISTENTVALUE;
+    if (action == COMMIT) {
+        if (usmUserSpinLock == 2147483647)
+            usmUserSpinLock = 0;
+        else
+            usmUserSpinLock++;
+    }
+    return SNMP_ERR_NOERROR;
+}                               /* end write_usmUserSpinLock() */
+
+/*******************************************************************-o-******
+ * write_usmUserCloneFrom
+ *
+ * Parameters:
+ *	 action
+ *	*var_val
+ *	 var_val_type
+ *	 var_val_len
+ *	*statP		(UNUSED)
+ *	*name		OID of user to clone from.
+ *	 name_len
+ *      
+ * Returns:
+ *	SNMP_ERR_NOERROR		On success  -OR-  If user exists
+ *					  and has already been cloned.
+ *	SNMP_ERR_GENERR			Local function call failures.
+ *	SNMP_ERR_INCONSISTENTNAME	'name' does not exist in user list
+ *					  -OR-  user to clone from != RS_ACTIVE.
+ *	SNMP_ERR_WRONGLENGTH		OID length > than local buffer size.
+ *	SNMP_ERR_WRONGTYPE		ASN_OBJECT_ID is wrong.
+ *
+ *
+ * XXX:  should handle action=UNDO's.
+ */
+int
+write_usmUserCloneFrom(int action,
+                       u_char * var_val,
+                       u_char var_val_type,
+                       size_t var_val_len,
+                       u_char * statP, oid * name, size_t name_len)
+{
+    struct usmUser *uptr, *cloneFrom;
+
+    if (action == RESERVE1) {
+        if (var_val_type != ASN_OBJECT_ID) {
+            DEBUGMSGTL(("usmUser",
+                        "write to usmUserCloneFrom not ASN_OBJECT_ID\n"));
+            return SNMP_ERR_WRONGTYPE;
+        }
+        if (var_val_len > USM_LENGTH_OID_MAX * sizeof(oid) ||
+            var_val_len % sizeof(oid) != 0) {
+            DEBUGMSGTL(("usmUser",
+                        "write to usmUserCloneFrom: bad length\n"));
+            return SNMP_ERR_WRONGLENGTH;
+        }
+    } else if (action == RESERVE2) {
+        if ((uptr = usm_parse_user(name, name_len)) == NULL) {
+            /*
+             * We don't allow creations here.  
+             */
+            return SNMP_ERR_INCONSISTENTNAME;
+        }
+
+        /*
+         * Has the user already been cloned?  If so, writes to this variable
+         * are defined to have no effect and to produce no error.  
+         */
+        if (uptr->cloneFrom != NULL) {
+            return SNMP_ERR_NOERROR;
+        }
+
+        cloneFrom =
+            usm_parse_user((oid *) var_val, var_val_len / sizeof(oid));
+        if (cloneFrom == NULL || cloneFrom->userStatus != SNMP_ROW_ACTIVE) {
+            return SNMP_ERR_INCONSISTENTNAME;
+        }
+        uptr->cloneFrom = snmp_duplicate_objid((oid *) var_val,
+                                               var_val_len / sizeof(oid));
+        usm_cloneFrom_user(cloneFrom, uptr);
+
+        if (usmStatusCheck(uptr) && uptr->userStatus == SNMP_ROW_NOTREADY) {
+            uptr->userStatus = SNMP_ROW_NOTINSERVICE;
+        }
+    }
+
+    return SNMP_ERR_NOERROR;
+}
+
+/*******************************************************************-o-******
+ * write_usmUserAuthProtocol
+ *
+ * Parameters:
+ *	 action
+ *	*var_val	OID of auth transform to set.
+ *	 var_val_type
+ *	 var_val_len
+ *	*statP
+ *	*name		OID of user upon which to perform set operation.
+ *	 name_len
+ *      
+ * Returns:
+ *	SNMP_ERR_NOERROR		On success.
+ *	SNMP_ERR_GENERR
+ *	SNMP_ERR_INCONSISTENTVALUE
+ *	SNMP_ERR_NOSUCHNAME
+ *	SNMP_ERR_WRONGLENGTH
+ *	SNMP_ERR_WRONGTYPE
+ */
+int
+write_usmUserAuthProtocol(int action,
+                          u_char * var_val,
+                          u_char var_val_type,
+                          size_t var_val_len,
+                          u_char * statP, oid * name, size_t name_len)
+{
+    static oid     *optr;
+    static size_t   olen;
+    static int      resetOnFail;
+    struct usmUser *uptr;
+
+    if (action == RESERVE1) {
+        resetOnFail = 0;
+        if (var_val_type != ASN_OBJECT_ID) {
+            DEBUGMSGTL(("usmUser",
+                        "write to usmUserAuthProtocol not ASN_OBJECT_ID\n"));
+            return SNMP_ERR_WRONGTYPE;
+        }
+        if (var_val_len > USM_LENGTH_OID_MAX * sizeof(oid) ||
+            var_val_len % sizeof(oid) != 0) {
+            DEBUGMSGTL(("usmUser",
+                        "write to usmUserAuthProtocol: bad length\n"));
+            return SNMP_ERR_WRONGLENGTH;
+        }
+    } else if (action == RESERVE2) {
+        if ((uptr = usm_parse_user(name, name_len)) == NULL) {
+            return SNMP_ERR_INCONSISTENTNAME;
+        }
+
+        if (uptr->userStatus == RS_ACTIVE
+            || uptr->userStatus == RS_NOTREADY
+            || uptr->userStatus == RS_NOTINSERVICE) {
+            /*
+             * The authProtocol is already set.  It is only legal to CHANGE it
+             * to usmNoAuthProtocol...  
+             */
+            if (snmp_oid_compare
+                ((oid *) var_val, var_val_len / sizeof(oid),
+                 usmNoAuthProtocol,
+                 sizeof(usmNoAuthProtocol) / sizeof(oid)) == 0) {
+                /*
+                 * ... and then only if the privProtocol is equal to
+                 * usmNoPrivProtocol.  
+                 */
+                if (snmp_oid_compare
+                    (uptr->privProtocol, uptr->privProtocolLen,
+                     usmNoPrivProtocol,
+                     sizeof(usmNoPrivProtocol) / sizeof(oid)) != 0) {
+                    return SNMP_ERR_INCONSISTENTVALUE;
+                }
+                optr = uptr->authProtocol;
+                olen = uptr->authProtocolLen;
+                resetOnFail = 1;
+                uptr->authProtocol = snmp_duplicate_objid((oid *) var_val,
+                                                          var_val_len /
+                                                          sizeof(oid));
+                if (uptr->authProtocol == NULL) {
+                    return SNMP_ERR_RESOURCEUNAVAILABLE;
+                }
+                uptr->authProtocolLen = var_val_len / sizeof(oid);
+            } else
+                if (snmp_oid_compare
+                    ((oid *) var_val, var_val_len / sizeof(oid),
+                     uptr->authProtocol, uptr->authProtocolLen) == 0) {
+                /*
+                 * But it's also okay to set it to the same thing as it
+                 * currently is.  
+                 */
+                return SNMP_ERR_NOERROR;
+            } else {
+                return SNMP_ERR_INCONSISTENTVALUE;
+            }
+        } else {
+            /*
+             * This row is under creation.  It's okay to set
+             * usmUserAuthProtocol to any valid authProtocol but it will be
+             * overwritten when usmUserCloneFrom is set (so don't write it if
+             * that has already been set).  
+             */
+
+            if (snmp_oid_compare
+                ((oid *) var_val, var_val_len / sizeof(oid),
+                 usmNoAuthProtocol,
+                 sizeof(usmNoAuthProtocol) / sizeof(oid)) == 0
+                || snmp_oid_compare((oid *) var_val,
+                                    var_val_len / sizeof(oid),
+                                    usmHMACMD5AuthProtocol,
+                                    sizeof(usmHMACMD5AuthProtocol) /
+                                    sizeof(oid)) == 0
+                || snmp_oid_compare((oid *) var_val,
+                                    var_val_len / sizeof(oid),
+                                    usmHMACSHA1AuthProtocol,
+                                    sizeof(usmHMACSHA1AuthProtocol) /
+                                    sizeof(oid)) == 0) {
+                if (uptr->cloneFrom != NULL) {
+                    optr = uptr->authProtocol;
+                    olen = uptr->authProtocolLen;
+                    resetOnFail = 1;
+                    uptr->authProtocol =
+                        snmp_duplicate_objid((oid *) var_val,
+                                             var_val_len / sizeof(oid));
+                    if (uptr->authProtocol == NULL) {
+                        return SNMP_ERR_RESOURCEUNAVAILABLE;
+                    }
+                    uptr->authProtocolLen = var_val_len / sizeof(oid);
+                }
+            } else {
+                /*
+                 * Unknown authentication protocol.  
+                 */
+                return SNMP_ERR_WRONGVALUE;
+            }
+        }
+    } else if (action == COMMIT) {
+        SNMP_FREE(optr);
+        optr = NULL;
+    } else if (action == FREE || action == UNDO) {
+        if ((uptr = usm_parse_user(name, name_len)) != NULL) {
+            if (resetOnFail) {
+                SNMP_FREE(uptr->authProtocol);
+                uptr->authProtocol = optr;
+                uptr->authProtocolLen = olen;
+            }
+        }
+    }
+    return SNMP_ERR_NOERROR;
+}                               /* end write_usmUserAuthProtocol() */
+
+/*******************************************************************-o-******
+ * write_usmUserAuthKeyChange
+ *
+ * Parameters:
+ *	 action		
+ *	*var_val	Octet string representing new KeyChange value.
+ *	 var_val_type
+ *	 var_val_len
+ *	*statP		(UNUSED)
+ *	*name		OID of user upon which to perform set operation.
+ *	 name_len
+ *      
+ * Returns:
+ *	SNMP_ERR_NOERR		Success.
+ *	SNMP_ERR_WRONGTYPE	
+ *	SNMP_ERR_WRONGLENGTH	
+ *	SNMP_ERR_NOSUCHNAME	
+ *	SNMP_ERR_GENERR
+ *
+ * Note: This function handles both the usmUserAuthKeyChange and
+ *       usmUserOwnAuthKeyChange objects.  We are not passed the name
+ *       of the user requseting the keychange, so we leave this to the
+ *       calling module to verify when and if we should be called.  To
+ *       change this would require a change in the mib module API to
+ *       pass in the securityName requesting the change.
+ *
+ * XXX:  should handle action=UNDO's.
+ */
+int
+write_usmUserAuthKeyChange(int action,
+                           u_char * var_val,
+                           u_char var_val_type,
+                           size_t var_val_len,
+                           u_char * statP, oid * name, size_t name_len)
+{
+    struct usmUser *uptr;
+    unsigned char   buf[SNMP_MAXBUF_SMALL];
+    size_t          buflen = SNMP_MAXBUF_SMALL;
+    const char      fnAuthKey[] = "write_usmUserAuthKeyChange";
+    const char      fnOwnAuthKey[] = "write_usmUserOwnAuthKeyChange";
+    const char     *fname;
+    static unsigned char *oldkey;
+    static size_t   oldkeylen;
+    static int      resetOnFail;
+
+    if (name[USM_MIB_LENGTH - 1] == 6) {
+        fname = fnAuthKey;
+    } else {
+        fname = fnOwnAuthKey;
+    }
+
+    if (action == RESERVE1) {
+        resetOnFail = 0;
+        if (var_val_type != ASN_OCTET_STR) {
+            DEBUGMSGTL(("usmUser", "write to %s not ASN_OCTET_STR\n",
+                        fname));
+            return SNMP_ERR_WRONGTYPE;
+        }
+        if (var_val_len == 0) {
+            return SNMP_ERR_WRONGLENGTH;
+        }
+    } else if (action == RESERVE2) {
+        if ((uptr = usm_parse_user(name, name_len)) == NULL) {
+            return SNMP_ERR_INCONSISTENTNAME;
+        } else {
+            if (snmp_oid_compare(uptr->authProtocol, uptr->authProtocolLen,
+                                 usmHMACMD5AuthProtocol,
+                                 sizeof(usmHMACMD5AuthProtocol) /
+                                 sizeof(oid)) == 0) {
+                if (var_val_len != 0 && var_val_len != 32) {
+                    return SNMP_ERR_WRONGLENGTH;
+                }
+            } else
+                if (snmp_oid_compare
+                    (uptr->authProtocol, uptr->authProtocolLen,
+                     usmHMACSHA1AuthProtocol,
+                     sizeof(usmHMACSHA1AuthProtocol) / sizeof(oid)) == 0) {
+                if (var_val_len != 0 && var_val_len != 40) {
+                    return SNMP_ERR_WRONGLENGTH;
+                }
+            }
+        }
+    } else if (action == ACTION) {
+        if ((uptr = usm_parse_user(name, name_len)) == NULL) {
+            return SNMP_ERR_INCONSISTENTNAME;
+        }
+        if (uptr->cloneFrom == NULL) {
+            return SNMP_ERR_INCONSISTENTNAME;
+        }
+        if (snmp_oid_compare(uptr->authProtocol, uptr->authProtocolLen,
+                             usmNoAuthProtocol,
+                             sizeof(usmNoAuthProtocol) / sizeof(oid)) ==
+            0) {
+            /*
+             * "When the value of the corresponding usmUserAuthProtocol is
+             * usmNoAuthProtocol, then a set is successful, but effectively
+             * is a no-op."  
+             */
+            DEBUGMSGTL(("usmUser",
+                        "%s: noAuthProtocol keyChange... success!\n",
+                        fname));
+            return SNMP_ERR_NOERROR;
+        }
+
+        /*
+         * Change the key.  
+         */
+        DEBUGMSGTL(("usmUser", "%s: changing auth key for user %s\n",
+                    fname, uptr->secName));
+
+        if (decode_keychange(uptr->authProtocol, uptr->authProtocolLen,
+                             uptr->authKey, uptr->authKeyLen,
+                             var_val, var_val_len,
+                             buf, &buflen) != SNMPERR_SUCCESS) {
+            DEBUGMSGTL(("usmUser", "%s: ... failed\n", fname));
+            return SNMP_ERR_GENERR;
+        }
+        DEBUGMSGTL(("usmUser", "%s: ... succeeded\n", fname));
+        resetOnFail = 1;
+        oldkey = uptr->authKey;
+        oldkeylen = uptr->authKeyLen;
+        memdup(&uptr->authKey, buf, buflen);
+        if (uptr->authKey == NULL) {
+            return SNMP_ERR_RESOURCEUNAVAILABLE;
+        }
+        uptr->authKeyLen = buflen;
+    } else if (action == COMMIT) {
+        SNMP_FREE(oldkey);
+        oldkey = NULL;
+    } else if (action == UNDO) {
+        if ((uptr = usm_parse_user(name, name_len)) != NULL && resetOnFail) {
+            SNMP_FREE(uptr->authKey);
+            uptr->authKey = oldkey;
+            uptr->authKeyLen = oldkeylen;
+        }
+    }
+
+    return SNMP_ERR_NOERROR;
+}                               /* end write_usmUserAuthKeyChange() */
+
+int
+write_usmUserPrivProtocol(int action,
+                          u_char * var_val,
+                          u_char var_val_type,
+                          size_t var_val_len,
+                          u_char * statP, oid * name, size_t name_len)
+{
+    static oid     *optr;
+    static size_t   olen;
+    static int      resetOnFail;
+    struct usmUser *uptr;
+
+    if (action == RESERVE1) {
+        resetOnFail = 0;
+        if (var_val_type != ASN_OBJECT_ID) {
+            DEBUGMSGTL(("usmUser",
+                        "write to usmUserPrivProtocol not ASN_OBJECT_ID\n"));
+            return SNMP_ERR_WRONGTYPE;
+        }
+        if (var_val_len > USM_LENGTH_OID_MAX * sizeof(oid) ||
+            var_val_len % sizeof(oid) != 0) {
+            DEBUGMSGTL(("usmUser",
+                        "write to usmUserPrivProtocol: bad length\n"));
+            return SNMP_ERR_WRONGLENGTH;
+        }
+    } else if (action == RESERVE2) {
+        if ((uptr = usm_parse_user(name, name_len)) == NULL) {
+            return SNMP_ERR_INCONSISTENTNAME;
+        }
+
+        if (uptr->userStatus == RS_ACTIVE
+            || uptr->userStatus == RS_NOTREADY
+            || uptr->userStatus == RS_NOTINSERVICE) {
+            /*
+             * The privProtocol is already set.  It is only legal to CHANGE it
+             * to usmNoPrivProtocol.  
+             */
+            if (snmp_oid_compare
+                ((oid *) var_val, var_val_len / sizeof(oid),
+                 usmNoPrivProtocol,
+                 sizeof(usmNoPrivProtocol) / sizeof(oid)) == 0) {
+                resetOnFail = 1;
+                optr = uptr->privProtocol;
+                olen = uptr->privProtocolLen;
+                uptr->privProtocol = snmp_duplicate_objid((oid *) var_val,
+                                                          var_val_len /
+                                                          sizeof(oid));
+                if (uptr->privProtocol == NULL) {
+                    return SNMP_ERR_RESOURCEUNAVAILABLE;
+                }
+                uptr->privProtocolLen = var_val_len / sizeof(oid);
+            } else
+                if (snmp_oid_compare
+                    ((oid *) var_val, var_val_len / sizeof(oid),
+                     uptr->privProtocol, uptr->privProtocolLen) == 0) {
+                /*
+                 * But it's also okay to set it to the same thing as it
+                 * currently is.  
+                 */
+                return SNMP_ERR_NOERROR;
+            } else {
+                return SNMP_ERR_INCONSISTENTVALUE;
+            }
+        } else {
+            /*
+             * This row is under creation.  It's okay to set
+             * usmUserPrivProtocol to any valid privProtocol with the proviso
+             * that if usmUserAuthProtocol is set to usmNoAuthProtocol, it may
+             * only be set to usmNoPrivProtocol.  The value will be overwritten
+             * when usmUserCloneFrom is set (so don't write it if that has
+             * already been set).  
+             */
+            if (snmp_oid_compare(uptr->authProtocol, uptr->authProtocolLen,
+                                 usmNoAuthProtocol,
+                                 sizeof(usmNoAuthProtocol) /
+                                 sizeof(oid)) == 0) {
+                if (snmp_oid_compare
+                    ((oid *) var_val, var_val_len / sizeof(oid),
+                     usmNoPrivProtocol,
+                     sizeof(usmNoPrivProtocol) / sizeof(oid)) != 0) {
+                    return SNMP_ERR_INCONSISTENTVALUE;
+                }
+            } else {
+                if (snmp_oid_compare
+                    ((oid *) var_val, var_val_len / sizeof(oid),
+                     usmNoPrivProtocol,
+                     sizeof(usmNoPrivProtocol) / sizeof(oid)) != 0
+                    && snmp_oid_compare((oid *) var_val,
+                                        var_val_len / sizeof(oid),
+                                        usmDESPrivProtocol,
+                                        sizeof(usmDESPrivProtocol) /
+                                        sizeof(oid) != 0)) {
+                    return SNMP_ERR_WRONGVALUE;
+                }
+            }
+            resetOnFail = 1;
+            optr = uptr->privProtocol;
+            olen = uptr->privProtocolLen;
+            uptr->privProtocol = snmp_duplicate_objid((oid *) var_val,
+                                                      var_val_len /
+                                                      sizeof(oid));
+            if (uptr->privProtocol == NULL) {
+                return SNMP_ERR_RESOURCEUNAVAILABLE;
+            }
+            uptr->privProtocolLen = var_val_len / sizeof(oid);
+        }
+    } else if (action == COMMIT) {
+        SNMP_FREE(optr);
+        optr = NULL;
+    } else if (action == FREE || action == UNDO) {
+        if ((uptr = usm_parse_user(name, name_len)) != NULL) {
+            if (resetOnFail) {
+                SNMP_FREE(uptr->privProtocol);
+                uptr->privProtocol = optr;
+                uptr->privProtocolLen = olen;
+            }
+        }
+    }
+
+    return SNMP_ERR_NOERROR;
+}                               /* end write_usmUserPrivProtocol() */
+
+/*
+ * Note: This function handles both the usmUserPrivKeyChange and
+ *       usmUserOwnPrivKeyChange objects.  We are not passed the name
+ *       of the user requseting the keychange, so we leave this to the
+ *       calling module to verify when and if we should be called.  To
+ *       change this would require a change in the mib module API to
+ *       pass in the securityName requesting the change.
+ *
+ */
+int
+write_usmUserPrivKeyChange(int action,
+                           u_char * var_val,
+                           u_char var_val_type,
+                           size_t var_val_len,
+                           u_char * statP, oid * name, size_t name_len)
+{
+    struct usmUser *uptr;
+    unsigned char   buf[SNMP_MAXBUF_SMALL];
+    size_t          buflen = SNMP_MAXBUF_SMALL;
+    const char      fnPrivKey[] = "write_usmUserPrivKeyChange";
+    const char      fnOwnPrivKey[] = "write_usmUserOwnPrivKeyChange";
+    const char     *fname;
+    static unsigned char *oldkey;
+    static size_t   oldkeylen;
+    static int      resetOnFail;
+
+    if (name[USM_MIB_LENGTH - 1] == 9) {
+        fname = fnPrivKey;
+    } else {
+        fname = fnOwnPrivKey;
+    }
+
+    if (action == RESERVE1) {
+        resetOnFail = 0;
+        if (var_val_type != ASN_OCTET_STR) {
+            DEBUGMSGTL(("usmUser", "write to %s not ASN_OCTET_STR\n",
+                        fname));
+            return SNMP_ERR_WRONGTYPE;
+        }
+        if (var_val_len == 0) {
+            return SNMP_ERR_WRONGLENGTH;
+        }
+    } else if (action == RESERVE2) {
+        if ((uptr = usm_parse_user(name, name_len)) == NULL) {
+            return SNMP_ERR_INCONSISTENTNAME;
+        } else {
+            if (snmp_oid_compare(uptr->privProtocol, uptr->privProtocolLen,
+                                 usmDESPrivProtocol,
+                                 sizeof(usmDESPrivProtocol) /
+                                 sizeof(oid)) == 0) {
+                if (var_val_len != 0 && var_val_len != 32) {
+                    return SNMP_ERR_WRONGLENGTH;
+                }
+            }
+        }
+    } else if (action == ACTION) {
+        if ((uptr = usm_parse_user(name, name_len)) == NULL) {
+            return SNMP_ERR_INCONSISTENTNAME;
+        }
+        if (uptr->cloneFrom == NULL) {
+            return SNMP_ERR_INCONSISTENTNAME;
+        }
+        if (snmp_oid_compare(uptr->privProtocol, uptr->privProtocolLen,
+                             usmNoPrivProtocol,
+                             sizeof(usmNoPrivProtocol) / sizeof(oid)) ==
+            0) {
+            /*
+             * "When the value of the corresponding usmUserPrivProtocol is
+             * usmNoPrivProtocol, then a set is successful, but effectively
+             * is a no-op."  
+             */
+            DEBUGMSGTL(("usmUser",
+                        "%s: noPrivProtocol keyChange... success!\n",
+                        fname));
+            return SNMP_ERR_NOERROR;
+        }
+
+        /*
+         * Change the key. 
+         */
+        DEBUGMSGTL(("usmUser", "%s: changing priv key for user %s\n",
+                    fname, uptr->secName));
+
+        if (decode_keychange(uptr->authProtocol, uptr->authProtocolLen,
+                             uptr->privKey, uptr->privKeyLen,
+                             var_val, var_val_len,
+                             buf, &buflen) != SNMPERR_SUCCESS) {
+            DEBUGMSGTL(("usmUser", "%s: ... failed\n", fname));
+            return SNMP_ERR_GENERR;
+        }
+        DEBUGMSGTL(("usmUser", "%s: ... succeeded\n", fname));
+        resetOnFail = 1;
+        oldkey = uptr->privKey;
+        oldkeylen = uptr->privKeyLen;
+        memdup(&uptr->privKey, buf, buflen);
+        if (uptr->privKey == NULL) {
+            return SNMP_ERR_RESOURCEUNAVAILABLE;
+        }
+        uptr->privKeyLen = buflen;
+    } else if (action == COMMIT) {
+        SNMP_FREE(oldkey);
+        oldkey = NULL;
+    } else if (action == UNDO) {
+        if ((uptr = usm_parse_user(name, name_len)) != NULL && resetOnFail) {
+            SNMP_FREE(uptr->privKey);
+            uptr->privKey = oldkey;
+            uptr->privKeyLen = oldkeylen;
+        }
+    }
+
+    return SNMP_ERR_NOERROR;
+}                               /* end write_usmUserPrivKeyChange() */
+
+int
+write_usmUserPublic(int action,
+                    u_char * var_val,
+                    u_char var_val_type,
+                    size_t var_val_len,
+                    u_char * statP, oid * name, size_t name_len)
+{
+    struct usmUser *uptr = NULL;
+
+    if (var_val_type != ASN_OCTET_STR) {
+        DEBUGMSGTL(("usmUser",
+                    "write to usmUserPublic not ASN_OCTET_STR\n"));
+        return SNMP_ERR_WRONGTYPE;
+    }
+    if (var_val_len < 0 || var_val_len > 32) {
+        DEBUGMSGTL(("usmUser", "write to usmUserPublic: bad length\n"));
+        return SNMP_ERR_WRONGLENGTH;
+    }
+    if (action == COMMIT) {
+        /*
+         * don't allow creations here 
+         */
+        if ((uptr = usm_parse_user(name, name_len)) == NULL) {
+            return SNMP_ERR_NOSUCHNAME;
+        }
+        if (uptr->userPublicString)
+            free(uptr->userPublicString);
+        uptr->userPublicString = (u_char *) malloc(var_val_len + 1);
+        if (uptr->userPublicString == NULL) {
+            return SNMP_ERR_GENERR;
+        }
+        memcpy(uptr->userPublicString, var_val, var_val_len);
+        uptr->userPublicString[var_val_len] = 0;
+        DEBUGMSG(("usmUser", "setting public string: %d - %s\n",
+                  var_val_len, uptr->userPublicString));
+    }
+    return SNMP_ERR_NOERROR;
+}                               /* end write_usmUserPublic() */
+
+int
+write_usmUserStorageType(int action,
+                         u_char * var_val,
+                         u_char var_val_type,
+                         size_t var_val_len,
+                         u_char * statP, oid * name, size_t name_len)
+{
+    long            long_ret = *((long *) var_val);
+    static long     oldValue;
+    struct usmUser *uptr;
+    static int      resetOnFail;
+
+    if (action == RESERVE1) {
+        resetOnFail = 0;
+        if (var_val_type != ASN_INTEGER) {
+            DEBUGMSGTL(("usmUser",
+                        "write to usmUserStorageType not ASN_INTEGER\n"));
+            return SNMP_ERR_WRONGTYPE;
+        }
+        if (var_val_len != sizeof(long)) {
+            DEBUGMSGTL(("usmUser",
+                        "write to usmUserStorageType: bad length\n"));
+            return SNMP_ERR_WRONGLENGTH;
+        }
+        if (long_ret < 1 || long_ret > 5) {
+            return SNMP_ERR_WRONGVALUE;
+        }
+    } else if (action == RESERVE2) {
+        if ((uptr = usm_parse_user(name, name_len)) == NULL) {
+            return SNMP_ERR_INCONSISTENTNAME;
+        }
+        if ((long_ret == ST_VOLATILE || long_ret == ST_NONVOLATILE) &&
+            (uptr->userStorageType == ST_VOLATILE ||
+             uptr->userStorageType == ST_NONVOLATILE)) {
+            oldValue = uptr->userStorageType;
+            uptr->userStorageType = long_ret;
+            resetOnFail = 1;
+        } else {
+            /*
+             * From RFC2574:
+             * 
+             * "Note that any user who employs authentication or privacy must
+             * allow its secret(s) to be updated and thus cannot be 'readOnly'.
+             * 
+             * If an initial set operation tries to set the value to 'readOnly'
+             * for a user who employs authentication or privacy, then an
+             * 'inconsistentValue' error must be returned.  Note that if the
+             * value has been previously set (implicit or explicit) to any
+             * value, then the rules as defined in the StorageType Textual
+             * Convention apply.  
+             */
+            DEBUGMSGTL(("usmUser",
+                        "long_ret %d uptr->st %d uptr->status %d\n",
+                        long_ret, uptr->userStorageType,
+                        uptr->userStatus));
+
+            if (long_ret == ST_READONLY &&
+                uptr->userStorageType != ST_READONLY &&
+                (uptr->userStatus == RS_ACTIVE ||
+                 uptr->userStatus == RS_NOTINSERVICE)) {
+                return SNMP_ERR_WRONGVALUE;
+            } else if (long_ret == ST_READONLY &&
+                       (snmp_oid_compare
+                        (uptr->privProtocol, uptr->privProtocolLen,
+                         usmNoPrivProtocol,
+                         sizeof(usmNoPrivProtocol) / sizeof(oid)) != 0
+                        || snmp_oid_compare(uptr->authProtocol,
+                                            uptr->authProtocolLen,
+                                            usmNoAuthProtocol,
+                                            sizeof(usmNoAuthProtocol) /
+                                            sizeof(oid)) != 0)) {
+                return SNMP_ERR_INCONSISTENTVALUE;
+            } else {
+                return SNMP_ERR_WRONGVALUE;
+            }
+        }
+    } else if (action == UNDO || action == FREE) {
+        if ((uptr = usm_parse_user(name, name_len)) != NULL && resetOnFail) {
+            uptr->userStorageType = oldValue;
+        }
+    }
+    return SNMP_ERR_NOERROR;
+}                               /* end write_usmUserStorageType() */
+
+/*
+ * Return 1 if enough objects have been set up to transition rowStatus to
+ * notInService(2) or active(1).  
+ */
+
+int
+usmStatusCheck(struct usmUser *uptr)
+{
+    if (uptr == NULL) {
+        return 0;
+    } else {
+        if (uptr->cloneFrom == NULL) {
+            return 0;
+        }
+    }
+    return 1;
+}
+
+/*******************************************************************-o-******
+ * write_usmUserStatus
+ *
+ * Parameters:
+ *	 action
+ *	*var_val
+ *	 var_val_type
+ *	 var_val_len
+ *	*statP
+ *	*name
+ *	 name_len
+ *      
+ * Returns:
+ *	SNMP_ERR_NOERROR		On success.
+ *	SNMP_ERR_GENERR	
+ *	SNMP_ERR_INCONSISTENTNAME
+ *	SNMP_ERR_INCONSISTENTVALUE
+ *	SNMP_ERR_WRONGLENGTH
+ *	SNMP_ERR_WRONGTYPE
+ */
+int
+write_usmUserStatus(int action,
+                    u_char * var_val,
+                    u_char var_val_type,
+                    size_t var_val_len,
+                    u_char * statP, oid * name, size_t name_len)
+{
+    /*
+     * variables we may use later 
+     */
+    static long     long_ret;
+    unsigned char  *engineID;
+    size_t          engineIDLen;
+    char           *newName;
+    size_t          nameLen;
+    struct usmUser *uptr = NULL;
+
+    if (action == RESERVE1) {
+        if (var_val_type != ASN_INTEGER) {
+            DEBUGMSGTL(("usmUser",
+                        "write to usmUserStatus not ASN_INTEGER\n"));
+            return SNMP_ERR_WRONGTYPE;
+        }
+        if (var_val_len != sizeof(long_ret)) {
+            DEBUGMSGTL(("usmUser",
+                        "write to usmUserStatus: bad length\n"));
+            return SNMP_ERR_WRONGLENGTH;
+        }
+        long_ret = *((long *) var_val);
+        if (long_ret == RS_NOTREADY || long_ret < 1 || long_ret > 6) {
+            return SNMP_ERR_WRONGVALUE;
+        }
+
+        /*
+         * See if we can parse the oid for engineID/name first.  
+         */
+        if (usm_parse_oid(&name[USM_MIB_LENGTH], name_len - USM_MIB_LENGTH,
+                          &engineID, &engineIDLen, (u_char **) & newName,
+                          &nameLen)) {
+            return SNMP_ERR_INCONSISTENTNAME;
+        }
+
+        if (engineIDLen < 5 || engineIDLen > 32 || nameLen < 1
+            || nameLen > 32) {
+            SNMP_FREE(engineID);
+            SNMP_FREE(newName);
+            return SNMP_ERR_NOCREATION;
+        }
+
+        /*
+         * Now see if a user already exists with these index values. 
+         */
+        uptr = usm_get_user(engineID, engineIDLen, newName);
+
+        if (uptr != NULL) {
+            if (long_ret == RS_CREATEANDGO || long_ret == RS_CREATEANDWAIT) {
+                SNMP_FREE(engineID);
+                SNMP_FREE(newName);
+                long_ret = RS_NOTREADY;
+                return SNMP_ERR_INCONSISTENTVALUE;
+            }
+            SNMP_FREE(engineID);
+            SNMP_FREE(newName);
+        } else {
+            if (long_ret == RS_ACTIVE || long_ret == RS_NOTINSERVICE) {
+                SNMP_FREE(engineID);
+                SNMP_FREE(newName);
+                return SNMP_ERR_INCONSISTENTVALUE;
+            }
+            if (long_ret == RS_CREATEANDGO || long_ret == RS_CREATEANDWAIT) {
+                if ((uptr = usm_create_user()) == NULL) {
+                    SNMP_FREE(engineID);
+                    SNMP_FREE(newName);
+                    return SNMP_ERR_RESOURCEUNAVAILABLE;
+                }
+                uptr->engineID = engineID;
+                uptr->name = newName;
+                uptr->secName = strdup(uptr->name);
+                if (uptr->secName == NULL) {
+                    usm_free_user(uptr);
+                    return SNMP_ERR_RESOURCEUNAVAILABLE;
+                }
+                uptr->engineIDLen = engineIDLen;
+
+                /*
+                 * Set status to createAndGo or createAndWait so we can tell
+                 * that this row is under creation.  
+                 */
+
+                uptr->userStatus = long_ret;
+
+                /*
+                 * Add to the list of users (we will take it off again
+                 * later if something goes wrong).  
+                 */
+
+                usm_add_user(uptr);
+            } else {
+                SNMP_FREE(engineID);
+                SNMP_FREE(newName);
+            }
+        }
+    } else if (action == ACTION) {
+        usm_parse_oid(&name[USM_MIB_LENGTH], name_len - USM_MIB_LENGTH,
+                      &engineID, &engineIDLen, (u_char **) & newName,
+                      &nameLen);
+        uptr = usm_get_user(engineID, engineIDLen, newName);
+        SNMP_FREE(engineID);
+        SNMP_FREE(newName);
+
+        if (uptr != NULL) {
+            if (long_ret == RS_CREATEANDGO || long_ret == RS_ACTIVE) {
+                if (usmStatusCheck(uptr)) {
+                    uptr->userStatus = RS_ACTIVE;
+                } else {
+                    SNMP_FREE(engineID);
+                    SNMP_FREE(newName);
+                    return SNMP_ERR_INCONSISTENTVALUE;
+                }
+            } else if (long_ret == RS_CREATEANDWAIT) {
+                if (usmStatusCheck(uptr)) {
+                    uptr->userStatus = RS_NOTINSERVICE;
+                } else {
+                    uptr->userStatus = RS_NOTREADY;
+                }
+            } else if (long_ret == RS_NOTINSERVICE) {
+                if (uptr->userStatus == RS_ACTIVE ||
+                    uptr->userStatus == RS_NOTINSERVICE) {
+                    uptr->userStatus = RS_NOTINSERVICE;
+                } else {
+                    return SNMP_ERR_INCONSISTENTVALUE;
+                }
+            }
+        }
+    } else if (action == COMMIT) {
+        usm_parse_oid(&name[USM_MIB_LENGTH], name_len - USM_MIB_LENGTH,
+                      &engineID, &engineIDLen, (u_char **) & newName,
+                      &nameLen);
+        uptr = usm_get_user(engineID, engineIDLen, newName);
+        SNMP_FREE(engineID);
+        SNMP_FREE(newName);
+
+        if (uptr != NULL) {
+            if (long_ret == RS_DESTROY) {
+                usm_remove_user(uptr);
+                usm_free_user(uptr);
+            }
+        }
+    } else if (action == UNDO || action == FREE) {
+        usm_parse_oid(&name[USM_MIB_LENGTH], name_len - USM_MIB_LENGTH,
+                      &engineID, &engineIDLen, (u_char **) & newName,
+                      &nameLen);
+        uptr = usm_get_user(engineID, engineIDLen, newName);
+        SNMP_FREE(engineID);
+        SNMP_FREE(newName);
+
+        if (long_ret == RS_CREATEANDGO || long_ret == RS_CREATEANDWAIT) {
+            usm_remove_user(uptr);
+            usm_free_user(uptr);
+        }
+    }
+
+    return SNMP_ERR_NOERROR;
+}
+
+#if 0
+
+    /*
+     * see if we can parse the oid for engineID/name first 
+     */
+if (usm_parse_oid(&name[USM_MIB_LENGTH], name_len - USM_MIB_LENGTH,
+                  &engineID, &engineIDLen, (u_char **) & newName,
+                  &nameLen))
+    return SNMP_ERR_INCONSISTENTNAME;
+
+    /*
+     * Now see if a user already exists with these index values 
+     */
+uptr = usm_get_user(engineID, engineIDLen, newName);
+
+
+if (uptr) {                     /* If so, we set the appropriate value... */
+    free(engineID);
+    free(newName);
+    if (long_ret == RS_CREATEANDGO || long_ret == RS_CREATEANDWAIT) {
+        return SNMP_ERR_INCONSISTENTVALUE;
+    }
+    if (long_ret == RS_DESTROY) {
+        usm_remove_user(uptr);
+        usm_free_user(uptr);
+    } else {
+        uptr->userStatus = long_ret;
+    }
+
+} else {                        /* ...else we create a new user */
+    /*
+     * check for a valid status column set 
+     */
+    if (long_ret == RS_ACTIVE || long_ret == RS_NOTINSERVICE) {
+        free(engineID);
+        free(newName);
+        return SNMP_ERR_INCONSISTENTVALUE;
+    }
+    if (long_ret == RS_DESTROY) {
+        /*
+         * destroying a non-existent row is actually legal 
+         */
+        free(engineID);
+        free(newName);
+        return SNMP_ERR_NOERROR;
+    }
+
+    /*
+     * generate a new user 
+     */
+    if ((uptr = usm_create_user()) == NULL) {
+        free(engineID);
+        free(newName);
+        return SNMP_ERR_GENERR;
+    }
+
+    /*
+     * copy in the engineID 
+     */
+    uptr->engineID = (unsigned char *) malloc(engineIDLen);
+    if (uptr->engineID == NULL) {
+        free(engineID);
+        free(newName);
+        usm_free_user(uptr);
+        return SNMP_ERR_GENERR;
+    }
+    uptr->engineIDLen = engineIDLen;
+    memcpy(uptr->engineID, engineID, engineIDLen);
+    free(engineID);
+
+    /*
+     * copy in the name and secname 
+     */
+    if ((uptr->name = strdup(newName)) == NULL) {
+        free(newName);
+        usm_free_user(uptr);
+        return SNMP_ERR_GENERR;
+    }
+    free(newName);
+    if ((uptr->secName = strdup(uptr->name)) == NULL) {
+        usm_free_user(uptr);
+        return SNMP_ERR_GENERR;
+    }
+
+    /*
+     * set the status of the row based on the request 
+     */
+    if (long_ret == RS_CREATEANDGO)
+        uptr->userStatus = RS_ACTIVE;
+    else if (long_ret == RS_CREATEANDWAIT)
+        uptr->userStatus = RS_NOTINSERVICE;
+
+    /*
+     * finally, add it to our list of users 
+     */
+    usm_add_user(uptr);
+
+}                               /* endif -- uptr */
+}                               /* endif -- action==COMMIT */
+
+return SNMP_ERR_NOERROR;
+
+}                               /* end write_usmUserStatus() */
+#endif
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/snmpv3/usmUser.h tomato121/release/src/router/snmp/agent/mibgroup/snmpv3/usmUser.h
--- tomato/release/src/router/snmp/agent/mibgroup/snmpv3/usmUser.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/snmpv3/usmUser.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,66 @@
+/*
+ * usmUser.h
+ *
+ */
+
+#ifndef _MIBGROUP_USMUSER_H
+#define _MIBGROUP_USMUSER_H
+
+#include <net-snmp/library/snmpusm.h>
+
+/*
+ * <...prefix>.<engineID_length>.<engineID>.<user_name_length>.<user_name>
+ * = 1 + 32 + 1 + 32 
+ */
+#define USM_LENGTH_OID_MAX	66
+
+/*
+ * we use header_generic and checkmib from the util_funcs module 
+ */
+
+config_require(util_funcs)
+config_add_mib(SNMP-USER-BASED-SM-MIB)
+
+    /*
+     * Magic number definitions: 
+     */
+#define   USMUSERSPINLOCK       1
+#define   USMUSERSECURITYNAME   2
+#define   USMUSERCLONEFROM      3
+#define   USMUSERAUTHPROTOCOL   4
+#define   USMUSERAUTHKEYCHANGE  5
+#define   USMUSEROWNAUTHKEYCHANGE  6
+#define   USMUSERPRIVPROTOCOL   7
+#define   USMUSERPRIVKEYCHANGE  8
+#define   USMUSEROWNPRIVKEYCHANGE  9
+#define   USMUSERPUBLIC         10
+#define   USMUSERSTORAGETYPE    11
+#define   USMUSERSTATUS         12
+    /*
+     * function definitions 
+     */
+     extern void     init_usmUser(void);
+     extern FindVarMethod var_usmUser;
+
+     void            shutdown_usmUser(void);
+     int             store_usmUser(int majorID, int minorID,
+                                   void *serverarg, void *clientarg);
+     oid            *usm_generate_OID(oid * prefix, size_t prefixLen,
+                                      struct usmUser *uptr,
+                                      size_t * length);
+     int             usm_parse_oid(oid * oidIndex, size_t oidLen,
+                                   unsigned char **engineID,
+                                   size_t * engineIDLen,
+                                   unsigned char **name, size_t * nameLen);
+
+     WriteMethod     write_usmUserSpinLock;
+     WriteMethod     write_usmUserCloneFrom;
+     WriteMethod     write_usmUserAuthProtocol;
+     WriteMethod     write_usmUserAuthKeyChange;
+     WriteMethod     write_usmUserPrivProtocol;
+     WriteMethod     write_usmUserPrivKeyChange;
+     WriteMethod     write_usmUserPublic;
+     WriteMethod     write_usmUserStorageType;
+     WriteMethod     write_usmUserStatus;
+
+#endif                          /* _MIBGROUP_USMUSER_H */
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/snmpv3mibs.h tomato121/release/src/router/snmp/agent/mibgroup/snmpv3mibs.h
--- tomato/release/src/router/snmp/agent/mibgroup/snmpv3mibs.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/snmpv3mibs.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,13 @@
+#ifndef SNMPV3MIBS_H
+#define SNMPV3MIBS_H
+
+/*
+ * snmpv3mibs.h: mib module to include the modules relavent to the
+ * snmpv3 mib(s) 
+ */
+
+config_require(snmpv3/snmpEngine)
+config_require(snmpv3/snmpMPDStats)
+config_require(snmpv3/usmStats)
+config_require(snmpv3/usmUser)
+#endif                          /* NSMPV3MIBS_H */
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/struct.h tomato121/release/src/router/snmp/agent/mibgroup/struct.h
--- tomato/release/src/router/snmp/agent/mibgroup/struct.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/struct.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,42 @@
+#ifndef UCD_SNMP_STRUCT
+#define UCD_SNMP_STRUCT
+
+#define STRMAX 1024
+#define SHPROC 1
+#define EXECPROC 2
+#define PASSTHRU 3
+#define PASSTHRU_PERSIST 4
+#define MIBMAX 30
+
+struct extensible {
+    char            name[STRMAX];
+    char            command[STRMAX];
+    char            fixcmd[STRMAX];
+    int             type;
+    int             result;
+    char            output[STRMAX];
+    struct extensible *next;
+    unsigned long   miboid[MIBMAX];
+    size_t          miblen;
+    int             pid;
+};
+
+struct myproc {
+    char            name[STRMAX];
+    char            fixcmd[STRMAX];
+    int             min;
+    int             max;
+    struct myproc  *next;
+};
+
+/*
+ * struct mibinfo 
+ * {
+ * int numid;
+ * unsigned long mibid[10];
+ * char *name;
+ * void (*handle) ();
+ * };
+ */
+
+#endif
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/target/.cvsignore tomato121/release/src/router/snmp/agent/mibgroup/target/.cvsignore
--- tomato/release/src/router/snmp/agent/mibgroup/target/.cvsignore	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/target/.cvsignore	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,2 @@
+.libs
+*.lo
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/target/snmpTargetAddrEntry.c tomato121/release/src/router/snmp/agent/mibgroup/target/snmpTargetAddrEntry.c
--- tomato/release/src/router/snmp/agent/mibgroup/target/snmpTargetAddrEntry.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/target/snmpTargetAddrEntry.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,1680 @@
+/*
+ * snmpTargetAddrEntry MIB
+ * 
+ * This file was generated by mib2c and is intended for use as a mib module
+ * for the ucd-snmp snmpd agent. Edited by Michael Baer
+ * 
+ * last changed 2/2/99.
+ */
+
+#include <net-snmp/net-snmp-config.h>
+#if HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+#include <stdlib.h>
+#include <ctype.h>
+#if HAVE_WINSOCK_H
+#include <winsock.h>
+#endif
+
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+#include "snmpTargetAddrEntry.h"
+#include "util_funcs.h"
+
+#define snmpTargetAddrOIDLen 11 /*This is base+column, 
+                                 * i.e. everything but index */
+
+oid             snmpTargetAddrOID[snmpTargetAddrOIDLen] =
+    { 1, 3, 6, 1, 6, 3, 12, 1, 2, 1, 0 };
+
+static unsigned long snmpTargetSpinLock = 0;
+static struct targetAddrTable_struct *aAddrTable = 0;
+
+
+/*
+ * Utility routines 
+ */
+struct targetAddrTable_struct *
+get_addrTable(void)
+{
+    return aAddrTable;
+}
+
+struct targetAddrTable_struct *
+get_addrForName(char *name)
+{
+    struct targetAddrTable_struct *ptr;
+    for (ptr = aAddrTable; ptr != NULL; ptr = ptr->next) {
+        if (ptr->name && strcmp(ptr->name, name) == 0)
+            return ptr;
+    }
+    return NULL;
+}
+
+
+/*
+ * TargetAddrTable_create creates and returns a pointer
+ * to a targetAddrTable_struct with default values set 
+ */
+struct targetAddrTable_struct
+               *
+snmpTargetAddrTable_create(void)
+{
+    struct targetAddrTable_struct *newEntry;
+
+    newEntry = (struct targetAddrTable_struct *)
+        malloc(sizeof(struct targetAddrTable_struct));
+
+    if (newEntry) {
+        newEntry->name = 0;
+
+        newEntry->tDomainLen = 0;
+        newEntry->tAddress = 0;
+
+        newEntry->timeout = 1500;
+        newEntry->retryCount = 3;
+
+        newEntry->tagList = strdup("");
+        newEntry->params = 0;
+
+        newEntry->storageType = SNMP_STORAGE_NONVOLATILE;
+        newEntry->rowStatus = SNMP_ROW_NONEXISTENT;
+        newEntry->sess = (netsnmp_session *) NULL;
+        newEntry->next = 0;
+    }
+
+    return newEntry;
+}                               /* snmpTargetAddrTable_create */
+
+
+/*
+ * TargetAddrTable_dispose frees the space allocated to a
+ * targetAddrTable_struct 
+ */
+void
+snmpTargetAddrTable_dispose(struct targetAddrTable_struct *reaped)
+{
+    SNMP_FREE(reaped->name);
+    SNMP_FREE(reaped->tAddress);
+    SNMP_FREE(reaped->tagList);
+    SNMP_FREE(reaped->params);
+
+    SNMP_FREE(reaped);
+}                               /* snmpTargetAddrTable_dispose  */
+
+/*
+ * snmpTargetAddrTable_addToList adds a targetAddrTable_struct 
+ * to a list passed in. The list is assumed to be in a sorted order,
+ * low to high and this procedure inserts a new struct in the proper 
+ * location. Sorting uses OID values based on name. A new equal value 
+ * overwrites a current one. 
+ */
+void
+snmpTargetAddrTable_addToList(struct targetAddrTable_struct *newEntry,
+                              struct targetAddrTable_struct **listPtr)
+{
+    static struct targetAddrTable_struct *curr_struct, *prev_struct;
+    int             i;
+    size_t          newOIDLen = 0, currOIDLen = 0;
+    oid             newOID[128], currOID[128];
+
+    /*
+     * if the list is empty, add the new entry to the top 
+     */
+    if ((prev_struct = curr_struct = *listPtr) == 0) {
+        *listPtr = newEntry;
+        return;
+    } else {
+        /*
+         * get the 'OID' value of the new entry 
+         */
+        newOIDLen = strlen(newEntry->name);
+        for (i = 0; i < (int) newOIDLen; i++) {
+            newOID[i] = newEntry->name[i];
+        }
+
+        /*
+         * search through the list for an equal or greater OID value 
+         */
+        while (curr_struct != 0) {
+            currOIDLen = strlen(curr_struct->name);
+            for (i = 0; i < (int) currOIDLen; i++) {
+                currOID[i] = curr_struct->name[i];
+            }
+
+            i = snmp_oid_compare(newOID, newOIDLen, currOID, currOIDLen);
+            if (i == 0) {       /* Exact match, overwrite with new struct */
+                newEntry->next = curr_struct->next;
+                /*
+                 * if curr_struct is the top of the list 
+                 */
+                if (*listPtr == curr_struct)
+                    *listPtr = newEntry;
+                else
+                    prev_struct->next = newEntry;
+                snmpTargetAddrTable_dispose(curr_struct);
+                return;
+            } else if (i < 0) { /* Found a greater OID, insert struct in front of it. */
+                newEntry->next = curr_struct;
+                /*
+                 * if curr_struct is the top of the list 
+                 */
+                if (*listPtr == curr_struct)
+                    *listPtr = newEntry;
+                else
+                    prev_struct->next = newEntry;
+                return;
+            }
+            prev_struct = curr_struct;
+            curr_struct = curr_struct->next;
+        }
+    }
+    /*
+     * if we're here, no larger OID was ever found, insert on end of list 
+     */
+    prev_struct->next = newEntry;
+}                               /* snmpTargeAddrTable_addToList  */
+
+
+void
+snmpTargetAddrTable_add(struct targetAddrTable_struct *newEntry)
+{
+    snmpTargetAddrTable_addToList(newEntry, &aAddrTable);
+}
+
+
+/*
+ * snmpTargetAddrTable_remFromList removes a targetAddrTable_struct 
+ * from the list passed in 
+ */
+void
+snmpTargetAddrTable_remFromList(struct targetAddrTable_struct *oldEntry,
+                                struct targetAddrTable_struct **listPtr)
+{
+    struct targetAddrTable_struct *tptr;
+
+    if ((tptr = *listPtr) == 0)
+        return;
+    else if (tptr == oldEntry) {
+        *listPtr = (*listPtr)->next;
+        snmpTargetAddrTable_dispose(tptr);
+        return;
+    } else {
+        while (tptr->next != 0) {
+            if (tptr->next == oldEntry) {
+                tptr->next = tptr->next->next;
+                snmpTargetAddrTable_dispose(oldEntry);
+                return;
+            }
+            tptr = tptr->next;
+        }
+    }
+}                               /* snmpTargetAddrTable_remFromList  */
+
+
+/*
+ * lookup OID in the link list of Addr Table Entries 
+ */
+struct targetAddrTable_struct *
+search_snmpTargetAddrTable(oid * baseName,
+                           size_t baseNameLen,
+                           oid * name, size_t * length, int exact)
+{
+    static struct targetAddrTable_struct *temp_struct;
+    int             i;
+    size_t          myOIDLen = 0;
+    oid             newNum[128];
+
+    /*
+     * lookup entry in addrTable linked list, Get Current MIB ID 
+     */
+    memcpy(newNum, baseName, baseNameLen * sizeof(oid));
+
+    for (temp_struct = aAddrTable; temp_struct != 0;
+         temp_struct = temp_struct->next) {
+        for (i = 0; i < (int) strlen(temp_struct->name); i++) {
+            newNum[baseNameLen + i] = temp_struct->name[i];
+        }
+        myOIDLen = baseNameLen + strlen(temp_struct->name);
+        i = snmp_oid_compare(name, *length, newNum, myOIDLen);
+        /*
+         * Assumes that the linked list sorted by OID, low to high 
+         */
+        if ((i == 0 && exact != 0) || (i < 0 && exact == 0)) {
+            if (exact == 0) {
+                memcpy(name, newNum, myOIDLen * sizeof(oid));
+                *length = myOIDLen;
+            }
+            return temp_struct;
+        }
+    }
+    return (0);
+}                               /* search_snmpTargetAddrTable  */
+
+
+/*
+ * snmpTargetAddr_rowStatusCheck is boolean funciton that  checks 
+ * the status of a row's values in order to determine whether
+ * the row should be notReady or notInService  
+ */
+int
+snmpTargetAddr_rowStatusCheck(struct targetAddrTable_struct *entry)
+{
+    if ((entry->tDomainLen == 0) || (entry->tAddress == 0) ||
+        (entry->params == 0))
+        return 0;
+    else
+        return 1;
+}                               /* snmtpTargetAddrTable_rowStatusCheck */
+
+
+/*
+ * Init routines 
+ */
+
+/*
+ * this variable defines function callbacks and type return information 
+ * for the snmpTargetAddrEntry mib 
+ */
+
+struct variable2 snmpTargetAddrEntry_variables[] = {
+    {SNMPTARGETADDRTDOMAIN, ASN_OBJECT_ID, RWRITE,
+     var_snmpTargetAddrEntry, 1, {SNMPTARGETADDRTDOMAINCOLUMN}},
+    {SNMPTARGETADDRTADDRESS, ASN_OCTET_STR, RWRITE,
+     var_snmpTargetAddrEntry, 1, {SNMPTARGETADDRTADDRESSCOLUMN}},
+    {SNMPTARGETADDRTIMEOUT, ASN_INTEGER, RWRITE,
+     var_snmpTargetAddrEntry, 1, {SNMPTARGETADDRTIMEOUTCOLUMN}},
+    {SNMPTARGETADDRRETRYCOUNT, ASN_INTEGER, RWRITE,
+     var_snmpTargetAddrEntry, 1, {SNMPTARGETADDRRETRYCOUNTCOLUMN}},
+    {SNMPTARGETADDRTAGLIST, ASN_OCTET_STR, RWRITE,
+     var_snmpTargetAddrEntry, 1, {SNMPTARGETADDRTAGLISTCOLUMN}},
+    {SNMPTARGETADDRPARAMS, ASN_OCTET_STR, RWRITE,
+     var_snmpTargetAddrEntry, 1, {SNMPTARGETADDRPARAMSCOLUMN}},
+    {SNMPTARGETADDRSTORAGETYPE, ASN_INTEGER, RWRITE,
+     var_snmpTargetAddrEntry, 1, {SNMPTARGETADDRSTORAGETYPECOLUMN}},
+    {SNMPTARGETADDRROWSTATUS, ASN_INTEGER, RWRITE,
+     var_snmpTargetAddrEntry, 1, {SNMPTARGETADDRROWSTATUSCOLUMN}},
+
+};
+
+struct variable2 snmpTargetSpinLock_var[] = {
+    {SNMPTARGETSPINLOCK, ASN_INTEGER, RWRITE, var_targetSpinLock, 1, {1}}
+};
+
+static oid      snmpTargetSpinLock_oid[] = { 1, 3, 6, 1, 6, 3, 12, 1 };
+
+/*
+ * now load this mib into the agents mib table 
+ */
+oid             snmpTargetAddrEntry_variables_oid[] =
+    { 1, 3, 6, 1, 6, 3, 12, 1, 2, 1 };
+
+
+void
+init_snmpTargetAddrEntry(void)
+{
+    aAddrTable = 0;
+    DEBUGMSGTL(("snmpTargetAddrEntry", "init\n"));
+    REGISTER_MIB("target/snmpTargetAddrEntry",
+                 snmpTargetAddrEntry_variables, variable2,
+                 snmpTargetAddrEntry_variables_oid);
+    REGISTER_MIB("target/snmpTargetSpinLock", snmpTargetSpinLock_var,
+                 variable2, snmpTargetSpinLock_oid);
+
+    snmpd_register_config_handler("targetAddr",
+                                  snmpd_parse_config_targetAddr, 0, NULL);
+
+    /*
+     * we need to be called back later 
+     */
+    snmp_register_callback(SNMP_CALLBACK_LIBRARY, SNMP_CALLBACK_STORE_DATA,
+                           store_snmpTargetAddrEntry, NULL);
+
+}                               /* init_snmpTargetAddrEntry */
+
+
+int
+snmpTargetAddr_addName(struct targetAddrTable_struct *entry, char *cptr)
+{
+    size_t          len;
+    if (cptr == 0) {
+        DEBUGMSGTL(("snmpTargetAddrEntry",
+                    "ERROR snmpTargetAddrEntry: no name in config string\n"));
+        return (0);
+    } else {
+        len = strlen(cptr);
+        /*
+         * spec check for string 1-32 
+         */
+        if (len < 1 || len > 32) {
+            DEBUGMSGTL(("snmpTargetAddrEntry",
+                        "ERROR snmpTargetAddrEntry: name out of range in config string\n"));
+            return (0);
+        }
+        entry->name = (char *) malloc(len + 1);
+        strncpy(entry->name, cptr, len);
+        entry->name[len] = '\0';
+    }
+    return (1);
+}                               /* addName */
+
+
+int
+snmpTargetAddr_addTDomain(struct targetAddrTable_struct *entry, char *cptr)
+{
+    size_t          len = 128;
+
+    if (cptr == 0) {
+        DEBUGMSGTL(("snmpTargetAddrEntry",
+                    "ERROR snmpTargetAddrEntry: no tDomain in config string\n"));
+        return (0);
+    }
+
+    if (!read_objid(cptr, entry->tDomain, &len)) {
+        DEBUGMSGTL(("snmpTargetAddrEntry",
+                    "ERROR snmpTargetAddrEntry: tDomain unreadable in config string\n"));
+        return (0);
+    }
+
+    /*
+     * spec check for oid 1-128 
+     */
+    if (len < 1 || len > 128) {
+        DEBUGMSGTL(("snmpTargetAddrEntry",
+                    "ERROR snmpTargetAddrEntry: tDomain out of range in config string\n"));
+        return (0);
+    }
+
+    entry->tDomainLen = len;
+    return (1);
+}                               /* snmpTargetAddr_addTDomain */
+
+
+int
+snmpTargetAddr_addTAddress(struct targetAddrTable_struct *entry,
+                           char *cptr, size_t len)
+{
+    if (cptr == 0) {
+        DEBUGMSGTL(("snmpTargetAddrEntry",
+                    "ERROR snmpTargetAddrEntry: no tAddress in config string\n"));
+        return (0);
+    } else {
+        /*
+         * spec check for string 1-32 
+         */
+        /*
+         * if (len < 1 || len > 32)  {
+         * DEBUGMSGTL(("snmpTargetAddrEntry","ERROR snmpTargetAddrEntry: name out of range in config string\n"));
+         * return(0);
+         * } 
+         */
+        SNMP_FREE(entry->tAddress);
+        entry->tAddress = (u_char *) malloc(len);
+        entry->tAddressLen = len;
+        memcpy(entry->tAddress, cptr, len);
+    }
+    return (1);
+}                               /* snmpTargetAddr_addTAddress */
+
+
+int
+snmpTargetAddr_addTimeout(struct targetAddrTable_struct *entry, char *cptr)
+{
+    if (cptr == 0) {
+        DEBUGMSGTL(("snmpTargetAddrEntry",
+                    "ERROR snmpTargetParamsEntry: no Timeout in config string\n"));
+        return (0);
+    } else if (!(isdigit(*cptr))) {
+        DEBUGMSGTL(("snmpTargetAddrEntry",
+                    "ERROR snmpTargeParamsEntry: Timeout is not a digit in config string\n"));
+        return (0);
+    }
+    /*
+     * check Timeout >= 0 
+     */
+    else if ((entry->timeout = (int) strtol(cptr, (char **) NULL, 0)) < 0) {
+        DEBUGMSGTL(("snmpTargetAddrEntry",
+                    "ERROR snmpTargeParamsEntry: Timeout out of range in config string\n"));
+        return (0);
+    }
+    return (1);
+}                               /* snmpTargetAddr_addTimeout  */
+
+
+int
+snmpTargetAddr_addRetryCount(struct targetAddrTable_struct *entry,
+                             char *cptr)
+{
+    if (cptr == 0) {
+        DEBUGMSGTL(("snmpTargetAddrEntry",
+                    "ERROR snmpTargetParamsEntry: no Retry Count in config string\n"));
+        return (0);
+    } else if (!(isdigit(*cptr))) {
+        DEBUGMSGTL(("snmpTargetAddrEntry",
+                    "ERROR snmpTargeParamsEntry: Retry Count is not a digit in config string\n"));
+        return (0);
+    }
+    /*
+     * spec check 0..255 
+     */
+    else {
+        entry->retryCount = (int) strtol(cptr, (char **) NULL, 0);
+        if ((entry->retryCount < 0) || (entry->retryCount > 255)) {
+            DEBUGMSGTL(("snmpTargetAddrEntry",
+                        "ERROR snmpTargeParamsEntry: Retry Count is out of range in config string\n"));
+            return (0);
+        }
+    }
+    return (1);
+}                               /* snmpTargetAddr_addRetryCount  */
+
+
+int
+snmpTargetAddr_addTagList(struct targetAddrTable_struct *entry, char *cptr)
+{
+    size_t          len;
+    if (cptr == 0) {
+        DEBUGMSGTL(("snmpTargetAddrEntry",
+                    "ERROR snmpTargetAddrEntry: no tag list in config string\n"));
+        return (0);
+    } else {
+        len = strlen(cptr);
+        /*
+         * spec check for string 0-255 
+         */
+        if (len < 0 || len > 255) {
+            DEBUGMSGTL(("snmpTargetAddrEntry",
+                        "ERROR snmpTargetAddrEntry: tag list out of range in config string\n"));
+            return (0);
+        }
+        SNMP_FREE(entry->tagList);
+        entry->tagList = (char *) malloc(len + 1);
+        strncpy(entry->tagList, cptr, len);
+        entry->tagList[len] = '\0';
+    }
+    return (1);
+}                               /* snmpTargetAddr_addTagList */
+
+
+int
+snmpTargetAddr_addParams(struct targetAddrTable_struct *entry, char *cptr)
+{
+    size_t          len;
+    if (cptr == 0) {
+        DEBUGMSGTL(("snmpTargetAddrEntry",
+                    "ERROR snmpTargetAddrEntry: no params in config string\n"));
+        return (0);
+    } else {
+        len = strlen(cptr);
+        /*
+         * spec check for string 1-32 
+         */
+        if (len < 1 || len > 32) {
+            DEBUGMSGTL(("snmpTargetAddrEntry",
+                        "ERROR snmpTargetAddrEntry: params out of range in config string\n"));
+            return (0);
+        }
+        entry->params = (char *) malloc(len + 1);
+        strncpy(entry->params, cptr, len);
+        entry->params[len] = '\0';
+    }
+    return (1);
+}                               /* snmpTargetAddr_addParams */
+
+
+int
+snmpTargetAddr_addStorageType(struct targetAddrTable_struct *entry,
+                              char *cptr)
+{
+    char            buff[1024];
+
+    if (cptr == 0) {
+        DEBUGMSGTL(("snmpTargetAddrEntry",
+                    "ERROR snmpTargetAddrEntry: no storage type in config string\n"));
+        return (0);
+    } else if (!(isdigit(*cptr))) {
+        DEBUGMSGTL(("snmpTargetAddrEntry",
+                    "ERROR snmpTargetAddrEntry: storage type is not a digit in config string\n"));
+        return (0);
+    }
+    /*
+     * check that storage type is a possible value 
+     */
+    else if (((entry->storageType = (int) strtol(cptr, (char **) NULL, 0))
+              != SNMP_STORAGE_OTHER) &&
+             (entry->storageType != SNMP_STORAGE_VOLATILE) &&
+             (entry->storageType != SNMP_STORAGE_NONVOLATILE) &&
+             (entry->storageType != SNMP_STORAGE_PERMANENT) &&
+             (entry->storageType != SNMP_STORAGE_READONLY)) {
+        snprintf(buff, sizeof(buff),
+                "ERROR snmpTargetAddrEntry: storage type not a valid value of other(%d), volatile(%d), nonvolatile(%d), permanent(%d), or readonly(%d) in config string.\n",
+                SNMP_STORAGE_OTHER, SNMP_STORAGE_VOLATILE,
+                SNMP_STORAGE_NONVOLATILE, SNMP_STORAGE_PERMANENT,
+                SNMP_STORAGE_READONLY);
+        buff[ sizeof(buff)-1 ] = 0;
+        DEBUGMSGTL(("snmpTargetAddrEntry", buff));
+
+        return (0);
+    }
+    return (1);
+}                               /* snmpTargetAddr_addStorageType */
+
+
+int
+snmpTargetAddr_addRowStatus(struct targetAddrTable_struct *entry,
+                            char *cptr)
+{
+    char            buff[1024];
+
+    if (cptr == 0) {
+        DEBUGMSGTL(("snmpTargetAddrEntry",
+                    "ERROR snmpTargetAddrEntry: no Row Status in config string\n"));
+        return (0);
+    } else if (!(isdigit(*cptr))) {
+        DEBUGMSGTL(("snmpTargetAddrEntry",
+                    "ERROR snmpTargetAddrEntry: Row Status is not a digit in config string\n"));
+        return (0);
+    }
+    /*
+     * check that row status is a valid value 
+     */
+    else if (((entry->rowStatus = (int) strtol(cptr, (char **) NULL, 0))
+              != SNMP_ROW_ACTIVE) &&
+             (entry->rowStatus != SNMP_ROW_NOTINSERVICE) &&
+             (entry->rowStatus != SNMP_ROW_NOTREADY)) {
+        snprintf(buff, sizeof(buff),
+                "ERROR snmpTargetAddrEntry: Row Status is not a valid value of active(%d), notinservice(%d), or notready(%d) in config string.\n",
+                SNMP_ROW_ACTIVE, SNMP_ROW_NOTINSERVICE, SNMP_ROW_NOTREADY);
+        buff[ sizeof(buff)-1 ] = 0;
+        DEBUGMSGTL(("snmpTargetAddrEntry", buff));
+
+        return (0);
+    }
+    return (1);
+}                               /* snmpTargetAddr_addRowStatus  */
+
+
+void
+snmpd_parse_config_targetAddr(const char *token, char *char_ptr)
+{
+    char           *cptr = char_ptr, buff[1024];
+    struct targetAddrTable_struct *newEntry;
+    int             i;
+
+    newEntry = snmpTargetAddrTable_create();
+
+    cptr = copy_nword(cptr, buff, sizeof(buff));
+    if (snmpTargetAddr_addName(newEntry, buff) == 0) {
+        snmpTargetAddrTable_dispose(newEntry);
+        return;
+    }
+    cptr = copy_nword(cptr, buff, sizeof(buff));
+    if (snmpTargetAddr_addTDomain(newEntry, buff) == 0) {
+        snmpTargetAddrTable_dispose(newEntry);
+        return;
+    }
+    cptr =
+        read_config_read_octet_string(cptr,
+                                      (u_char **) & newEntry->tAddress,
+                                      &newEntry->tAddressLen);
+    if (!cptr || !(newEntry->tAddress)) {
+        DEBUGMSGTL(("snmpTargetAddrEntry",
+                    "ERROR snmpTargetAddrEntry: no TAddress in config string\n"));
+        snmpTargetAddrTable_dispose(newEntry);
+        return;
+    }
+    cptr = copy_nword(cptr, buff, sizeof(buff));
+    if (snmpTargetAddr_addTimeout(newEntry, buff) == 0) {
+        snmpTargetAddrTable_dispose(newEntry);
+        return;
+    }
+    cptr = copy_nword(cptr, buff, sizeof(buff));
+    if (snmpTargetAddr_addRetryCount(newEntry, buff) == 0) {
+        snmpTargetAddrTable_dispose(newEntry);
+        return;
+    }
+    cptr = copy_nword(cptr, buff, sizeof(buff));
+    if (snmpTargetAddr_addTagList(newEntry, buff) == 0) {
+        snmpTargetAddrTable_dispose(newEntry);
+        return;
+    }
+    cptr = copy_nword(cptr, buff, sizeof(buff));
+    if (snmpTargetAddr_addParams(newEntry, buff) == 0) {
+        snmpTargetAddrTable_dispose(newEntry);
+        return;
+    }
+    cptr = copy_nword(cptr, buff, sizeof(buff));
+    if (snmpTargetAddr_addStorageType(newEntry, buff) == 0) {
+        snmpTargetAddrTable_dispose(newEntry);
+        return;
+    }
+    cptr = copy_nword(cptr, buff, sizeof(buff));
+    if (snmpTargetAddr_addRowStatus(newEntry, buff) == 0) {
+        snmpTargetAddrTable_dispose(newEntry);
+        return;
+    }
+    snprintf(buff, sizeof(buff), "snmp_parse_config_targetAddr, read: %s\n",
+            newEntry->name);
+    buff[ sizeof(buff)-1 ] = 0;
+    for (i = 0; i < newEntry->tDomainLen; i++) {
+        snprintf(&buff[strlen(buff)], sizeof(buff)-strlen(buff)-1,
+                 ".%d", (int) newEntry->tDomain[i]);
+        buff[ sizeof(buff)-1 ] = 0;
+    }
+    snprintf(&buff[strlen(buff)], sizeof(buff)-strlen(buff)-1,
+            " %s %d %d %s %s %d %d\n",
+            newEntry->tAddress, newEntry->timeout, newEntry->retryCount,
+            newEntry->tagList, newEntry->params, newEntry->storageType,
+            newEntry->rowStatus);
+    buff[ sizeof(buff)-1 ] = 0;
+    DEBUGMSGTL(("snmpTargetAddrEntry", buff));
+
+    snmpTargetAddrTable_addToList(newEntry, &aAddrTable);
+}                               /* snmpd_parse_config_target */
+
+
+/*
+ * Shutdown routines 
+ */
+
+
+/*
+ * store_snmpTargetAddrEntry handles the persistent storage proccess 
+ * for this MIB table. It writes out all the non-volatile rows 
+ * to permanent storage on a shutdown  
+ */
+int
+store_snmpTargetAddrEntry(int majorID, int minorID, void *serverarg,
+                          void *clientarg)
+{
+    struct targetAddrTable_struct *curr_struct;
+    char            line[1024];
+    int             i;
+
+    if ((curr_struct = aAddrTable) != 0) {
+        while (curr_struct != 0) {
+            if ((curr_struct->storageType == SNMP_STORAGE_NONVOLATILE ||
+                 curr_struct->storageType == SNMP_STORAGE_PERMANENT)
+                &&
+                (curr_struct->rowStatus == SNMP_ROW_ACTIVE ||
+                 curr_struct->rowStatus == SNMP_ROW_NOTINSERVICE)) {
+                snprintf(line, sizeof(line),
+                        "targetAddr %s ", curr_struct->name);
+                line[ sizeof(line)-1 ] = 0;
+                for (i = 0; i < curr_struct->tDomainLen; i++) {
+                    snprintf(&line[strlen(line)],
+                            sizeof(line)-strlen(line)-1, ".%i",
+                            (int) curr_struct->tDomain[i]);
+                    line[ sizeof(line)-1 ] = 0;
+                }
+                if ( strlen(line)+2 < sizeof(line) ) {
+                    line[ strlen(line)+1 ] = 0;
+                    line[ strlen(line)   ] = ' ';
+                }
+                read_config_save_octet_string(&line[strlen(line)],
+                                              curr_struct->tAddress,
+                                              curr_struct->tAddressLen);
+
+                snprintf(&line[strlen(line)], sizeof(line)-strlen(line)-1,
+                        " %i %i \"%s\" %s %i %i",
+                        curr_struct->timeout,
+                        curr_struct->retryCount, curr_struct->tagList,
+                        curr_struct->params, curr_struct->storageType,
+                        curr_struct->rowStatus);
+                line[ sizeof(line)-1 ] = 0;
+
+                /*
+                 * store to file 
+                 */
+                snmpd_store_config(line);
+            }
+            curr_struct = curr_struct->next;
+        }
+    }
+    return SNMPERR_SUCCESS;
+
+}                               /*  store_snmpTargetAddrEntry  */
+
+
+/*
+ * MIB table access routines 
+ */
+
+
+u_char         *
+var_snmpTargetAddrEntry(struct variable * vp,
+                        oid * name,
+                        size_t * length,
+                        int exact,
+                        size_t * var_len, WriteMethod ** write_method)
+{
+
+    /*
+     * variables we may use later 
+     */
+    static long     long_ret;
+    static char     string[1500];
+    static oid      objid[128];
+    struct targetAddrTable_struct *temp_struct;
+    int             i = 0;
+
+    /*
+     * Set up write_method first, in case we return NULL before getting to the
+     * switch (vp->magic) below.  In some of these cases, we still want to call
+     * the appropriate write_method, if only to have it return the appropriate
+     * error.  
+     */
+
+    switch (vp->magic) {
+    case SNMPTARGETADDRTDOMAIN:
+        *write_method = write_snmpTargetAddrTDomain;
+        break;
+    case SNMPTARGETADDRTADDRESS:
+        *write_method = write_snmpTargetAddrTAddress;
+        break;
+    case SNMPTARGETADDRRETRYCOUNT:
+        *write_method = write_snmpTargetAddrRetryCount;
+        break;
+    case SNMPTARGETADDRTIMEOUT:
+        *write_method = write_snmpTargetAddrTimeout;
+        break;
+    case SNMPTARGETADDRTAGLIST:
+        *write_method = write_snmpTargetAddrTagList;
+        break;
+    case SNMPTARGETADDRPARAMS:
+        *write_method = write_snmpTargetAddrParams;
+        break;
+    case SNMPTARGETADDRSTORAGETYPE:
+        *write_method = write_snmpTargetAddrStorageType;
+        break;
+    case SNMPTARGETADDRROWSTATUS:
+        *write_method = write_snmpTargetAddrRowStatus;
+        break;
+    default:
+        *write_method = NULL;
+    }
+
+    *var_len = sizeof(long_ret);        /* assume an integer and change later if not */
+
+    /*
+     * look for OID in current table 
+     */
+    if ((temp_struct = search_snmpTargetAddrTable(vp->name, vp->namelen,
+                                                  name, length,
+                                                  exact)) == 0) {
+        return (0);
+    }
+
+    /*
+     * We found what we were looking for, either the next OID or the exact OID 
+     */
+    /*
+     * this is where we do the value assignments for the mib results. 
+     */
+    switch (vp->magic) {
+    case SNMPTARGETADDRTDOMAIN:
+        if (temp_struct->tDomainLen <= 0) {
+            return (0);
+        } else {
+            for (i = 0; i < temp_struct->tDomainLen; i++) {
+                objid[i] = temp_struct->tDomain[i];
+            }
+            *var_len = temp_struct->tDomainLen * sizeof(oid);
+        }
+        return (unsigned char *) objid;
+
+    case SNMPTARGETADDRTADDRESS:
+        if (temp_struct->tAddress == 0)
+            return (0);
+        *var_len = temp_struct->tAddressLen;
+        return (unsigned char *) temp_struct->tAddress;
+
+    case SNMPTARGETADDRTIMEOUT:
+        long_ret = temp_struct->timeout;
+        return (unsigned char *) &long_ret;
+
+    case SNMPTARGETADDRRETRYCOUNT:
+        long_ret = temp_struct->retryCount;
+        return (unsigned char *) &long_ret;
+
+    case SNMPTARGETADDRTAGLIST:
+        if (temp_struct->tagList != NULL) {
+            strcpy(string, temp_struct->tagList);
+            *var_len = strlen(string);
+            return (unsigned char *) string;
+        } else {
+            return NULL;
+        }
+
+    case SNMPTARGETADDRPARAMS:
+        if (temp_struct->params == 0)
+            return (0);
+        strcpy(string, temp_struct->params);
+        *var_len = strlen(string);
+        return (unsigned char *) string;
+
+    case SNMPTARGETADDRSTORAGETYPE:
+        long_ret = temp_struct->storageType;
+        return (unsigned char *) &long_ret;
+
+    case SNMPTARGETADDRROWSTATUS:
+        long_ret = temp_struct->rowStatus;
+        return (unsigned char *) &long_ret;
+
+    default:
+        DEBUGMSGTL(("snmpd",
+                    "unknown sub-id %d in var_snmpTargetAddrEntry\n",
+                    vp->magic));
+    }
+    return 0;
+}                               /* var_snmpTargetAddrEntry */
+
+
+int
+write_snmpTargetAddrTDomain(int action,
+                            u_char * var_val,
+                            u_char var_val_type,
+                            size_t var_val_len,
+                            u_char * statP, oid * name, size_t name_len)
+{
+    struct targetAddrTable_struct *target = NULL;
+    static oid      old_oid[MAX_OID_LEN];
+    static size_t   old_oid_len;
+
+    if (action == RESERVE1) {
+        if (var_val_type != ASN_OBJECT_ID) {
+            DEBUGMSGTL(("snmpTargetAddrEntry",
+                        "write to snmpTargetAddrTDomain not ASN_OBJECT_ID\n"));
+            return SNMP_ERR_WRONGTYPE;
+        }
+        if ((var_val_len > (MAX_OID_LEN * sizeof(oid))) ||
+            (var_val_len % sizeof(oid) != 0)) {
+            DEBUGMSGTL(("snmpTargetAddrEntry",
+                        "write to snmpTargetAddrTDomain: bad length\n"));
+            return SNMP_ERR_WRONGLENGTH;
+        }
+    } else if (action == RESERVE2) {
+        snmpTargetAddrOID[snmpTargetAddrOIDLen - 1] =
+            SNMPTARGETADDRTDOMAINCOLUMN;
+        if ((target =
+             search_snmpTargetAddrTable(snmpTargetAddrOID,
+                                        snmpTargetAddrOIDLen, name,
+                                        &name_len, 1)) == 0) {
+            DEBUGMSGTL(("snmpTargetAddrEntry",
+                        "write to snmpTargetAddrTDomain: BAD OID!\n"));
+            return SNMP_ERR_INCONSISTENTNAME;
+        } else {
+            if (target->storageType == SNMP_STORAGE_READONLY) {
+                DEBUGMSGTL(("snmpTargetAddrEntry",
+                            "write to snmpTargetAddrTDomain: row is read only\n"));
+                return SNMP_ERR_NOTWRITABLE;
+            }
+            if (target->rowStatus == SNMP_ROW_ACTIVE) {
+                DEBUGMSGTL(("snmpTargetAddrEntry",
+                            "write to snmpTargetAddrTDomain: not allowed in active row.\n"));
+                return SNMP_ERR_INCONSISTENTVALUE;
+            }
+
+            /*
+             * Finally, we're golden, save current value.  
+             */
+
+            memcpy(old_oid, target->tDomain,
+                   target->tDomainLen * sizeof(oid));
+            old_oid_len = target->tDomainLen;
+
+            memcpy((u_char *) target->tDomain, var_val, var_val_len);
+            target->tDomainLen = var_val_len / sizeof(oid);
+
+            /*
+             * If row is new, check if its status can be updated.  
+             */
+            if ((target->rowStatus == SNMP_ROW_NOTREADY) &&
+                (snmpTargetAddr_rowStatusCheck(target) != 0)) {
+                target->rowStatus = SNMP_ROW_NOTINSERVICE;
+            }
+        }
+    } else if (action == FREE || action == UNDO) {
+        /*
+         * Try to undo the SET here (abnormal usage of FREE clause)  
+         */
+        snmpTargetAddrOID[snmpTargetAddrOIDLen - 1] =
+            SNMPTARGETADDRTDOMAINCOLUMN;
+        if ((target =
+             search_snmpTargetAddrTable(snmpTargetAddrOID,
+                                        snmpTargetAddrOIDLen, name,
+                                        &name_len, 1)) != NULL) {
+            if (target->storageType != SNMP_STORAGE_READONLY
+                && target->rowStatus != SNMP_ROW_ACTIVE) {
+                memcpy((u_char *) target->tDomain, (u_char *) old_oid,
+                       (old_oid_len * sizeof(oid)));
+                target->tDomainLen = old_oid_len;
+                if (target->rowStatus == SNMP_ROW_NOTINSERVICE &&
+                    snmpTargetAddr_rowStatusCheck(target) == 0) {
+                    target->rowStatus = SNMP_ROW_NOTREADY;
+                }
+            }
+        }
+    }
+    return SNMP_ERR_NOERROR;
+}                               /* write_snmpTargetAddrTDomain */
+
+
+int
+write_snmpTargetAddrTAddress(int action,
+                             u_char * var_val,
+                             u_char var_val_type,
+                             size_t var_val_len,
+                             u_char * statP, oid * name, size_t name_len)
+{
+    struct targetAddrTable_struct *target = NULL;
+    static char    *old_addr = NULL;
+    static size_t   old_len = 0;
+
+    if (action == RESERVE1) {
+        if (var_val_type != ASN_OCTET_STR) {
+            DEBUGMSGTL(("snmpTargetAddrEntry",
+                        "write to snmpTargetAddrTAddress not ASN_OCTET_STR\n"));
+            return SNMP_ERR_WRONGTYPE;
+        } else if (var_val_len < 1 || var_val_len > 255) {
+            return SNMP_ERR_WRONGLENGTH;
+        }
+    } else if (action == RESERVE2) {
+        snmpTargetAddrOID[snmpTargetAddrOIDLen - 1] =
+            SNMPTARGETADDRTADDRESSCOLUMN;
+        if ((target =
+             search_snmpTargetAddrTable(snmpTargetAddrOID,
+                                        snmpTargetAddrOIDLen, name,
+                                        &name_len, 1)) == 0) {
+            DEBUGMSGTL(("snmpTargetAddrEntry",
+                        "write to snmpTargetAddrTAddress: BAD OID!\n"));
+            return SNMP_ERR_INCONSISTENTNAME;
+        } else {
+            if (target->storageType == SNMP_STORAGE_READONLY) {
+                DEBUGMSGTL(("snmpTargetAddrEntry",
+                            "write to snmpTargetAddrTAddress: row is read only\n"));
+                return SNMP_ERR_NOTWRITABLE;
+            }
+            if (target->rowStatus == SNMP_ROW_ACTIVE) {
+                DEBUGMSGTL(("snmpTargetAddrEntry",
+                            "write to snmpTargetAddrTAddress: not allowed in active row.\n"));
+                return SNMP_ERR_INCONSISTENTVALUE;
+            }
+
+            old_addr = target->tAddress;
+            old_len = target->tAddressLen;
+            target->tAddress = (u_char *) malloc(var_val_len);
+            if (target->tAddress == NULL) {
+                return SNMP_ERR_RESOURCEUNAVAILABLE;
+            }
+            memcpy(target->tAddress, var_val, var_val_len);
+            target->tAddressLen = var_val_len;
+
+            /*
+             * If row is new, check if its status can be updated.  
+             */
+            if ((target->rowStatus == SNMP_ROW_NOTREADY) &&
+                (snmpTargetAddr_rowStatusCheck(target) != 0)) {
+                target->rowStatus = SNMP_ROW_NOTINSERVICE;
+            }
+        }
+    } else if (action == COMMIT) {
+        SNMP_FREE(old_addr);
+        old_addr = NULL;
+    } else if (action == FREE || action == UNDO) {
+        /*
+         * Try to undo the SET here (abnormal usage of FREE clause)  
+         */
+        snmpTargetAddrOID[snmpTargetAddrOIDLen - 1] =
+            SNMPTARGETADDRTADDRESSCOLUMN;
+        if ((target =
+             search_snmpTargetAddrTable(snmpTargetAddrOID,
+                                        snmpTargetAddrOIDLen, name,
+                                        &name_len, 1)) != NULL) {
+            if (target->storageType != SNMP_STORAGE_READONLY
+                && target->rowStatus != SNMP_ROW_ACTIVE) {
+                SNMP_FREE(target->tAddress);
+                target->tAddress = old_addr;
+                target->tAddressLen = old_len;
+                if (target->rowStatus == SNMP_ROW_NOTINSERVICE &&
+                    snmpTargetAddr_rowStatusCheck(target) == 0) {
+                    target->rowStatus = SNMP_ROW_NOTREADY;
+                }
+            }
+        }
+    }
+
+    return SNMP_ERR_NOERROR;
+}                               /* write_snmpTargetAddrTAddress */
+
+
+int
+write_snmpTargetAddrTimeout(int action,
+                            u_char * var_val,
+                            u_char var_val_type,
+                            size_t var_val_len,
+                            u_char * statP, oid * name, size_t name_len)
+{
+    /*
+     * variables we may use later 
+     */
+    static long     long_ret;
+    size_t          size;
+    struct targetAddrTable_struct *temp_struct;
+
+    if (action == RESERVE1) {
+        if (var_val_type != ASN_INTEGER) {
+            DEBUGMSGTL(("snmpTargetAddrEntry",
+                        "write to snmpTargetAddrTimeout not ASN_INTEGER\n"));
+            return SNMP_ERR_WRONGTYPE;
+        }
+        if (var_val_len > (size = sizeof(long_ret))) {
+            DEBUGMSGTL(("snmpTargetAddrEntry",
+                        "write to snmpTargetAddrTimeout: bad length\n"));
+            return SNMP_ERR_WRONGLENGTH;
+        }
+        long_ret = *((long *) var_val);
+    } else if (action == RESERVE2) {
+
+        /*
+         * spec check range, no spec check 
+         */
+
+        /*
+         * Find row in linked list and check pertinent status... 
+         */
+        snmpTargetAddrOID[snmpTargetAddrOIDLen - 1] =
+            SNMPTARGETADDRTIMEOUTCOLUMN;
+        if ((temp_struct =
+             search_snmpTargetAddrTable(snmpTargetAddrOID,
+                                        snmpTargetAddrOIDLen, name, &name_len,
+                                        1)) == 0) {
+            DEBUGMSGTL(("snmpTargetAddrEntry",
+                        "write to snmpTargetAddrTimeout : BAD OID\n"));
+            return SNMP_ERR_NOSUCHNAME;
+        }
+        /*
+         * row exists, check if it is changeable 
+         */
+        if (temp_struct->storageType == SNMP_STORAGE_READONLY) {
+            DEBUGMSGTL(("snmpTargetAddrEntry",
+                        "write to snmpTargetAddrTimeout : row is read only\n"));
+            return SNMP_ERR_NOTWRITABLE;
+        }
+    } else if  (action == COMMIT) {
+        /*
+         * Finally, we're golden, should we save value? 
+         */
+        snmpTargetAddrOID[snmpTargetAddrOIDLen - 1] =
+            SNMPTARGETADDRTIMEOUTCOLUMN;
+        if ((temp_struct =
+             search_snmpTargetAddrTable(snmpTargetAddrOID,
+                                        snmpTargetAddrOIDLen, name, &name_len,
+                                        1)) == 0) {
+            temp_struct->timeout = long_ret;
+        }
+    }
+
+    return SNMP_ERR_NOERROR;
+}                               /* write_snmpTargetAddrTimeout */
+
+
+int
+write_snmpTargetAddrRetryCount(int action,
+                               u_char * var_val,
+                               u_char var_val_type,
+                               size_t var_val_len,
+                               u_char * statP, oid * name, size_t name_len)
+{
+    static long     long_ret;
+    struct targetAddrTable_struct *target;
+
+    if (action == RESERVE1) {
+        if (var_val_type != ASN_INTEGER) {
+            DEBUGMSGTL(("snmpTargetAddrEntry",
+                        "write to snmpTargetAddrRetryCount not ASN_INTEGER\n"));
+            return SNMP_ERR_WRONGTYPE;
+        }
+        if (var_val_len != sizeof(long)) {
+            DEBUGMSGTL(("snmpTargetAddrEntry",
+                        "write to snmpTargetAddrRetryCount: bad length\n"));
+            return SNMP_ERR_WRONGLENGTH;
+        }
+        long_ret = *((long *) var_val);
+        if (long_ret < 0 || long_ret > 255) {
+            return SNMP_ERR_WRONGVALUE;
+        }
+    } else if (action == RESERVE2) {
+        snmpTargetAddrOID[snmpTargetAddrOIDLen - 1] =
+            SNMPTARGETADDRRETRYCOUNTCOLUMN;
+        if ((target = search_snmpTargetAddrTable(snmpTargetAddrOID,
+                                                 snmpTargetAddrOIDLen,
+                                                 name, &name_len,
+                                                 1)) == NULL) {
+            DEBUGMSGTL(("snmpTargetAddrEntry",
+                        "write to snmpTargetAddrTimeout: BAD OID\n"));
+            return SNMP_ERR_INCONSISTENTNAME;
+        } else {
+            if (target->storageType == SNMP_STORAGE_READONLY) {
+                DEBUGMSGTL(("snmpTargetAddrEntry",
+                            "write to snmpTargetAddrRetryCount: row is read only\n"));
+                return SNMP_ERR_NOTWRITABLE;
+            }
+        }
+    } else if (action == COMMIT) {
+        snmpTargetAddrOID[snmpTargetAddrOIDLen - 1] =
+            SNMPTARGETADDRRETRYCOUNTCOLUMN;
+        if ((target = search_snmpTargetAddrTable(snmpTargetAddrOID,
+                                                 snmpTargetAddrOIDLen,
+                                                 name, &name_len,
+                                                 1)) != NULL) {
+            target->retryCount = long_ret;
+        }
+    }
+
+    return SNMP_ERR_NOERROR;
+}                               /* write_snmpTargetAddrRetryCount */
+
+static int
+is_delim(const char c)
+{
+    return (c == 0x020 || c == 0x09 || c == 0x0d || c == 0x0b);
+}
+
+int
+snmpTagListValid(const char *tagList, const size_t tagListLen)
+{
+    size_t          i = 0;
+    int             inTag = 0;
+
+
+    for (i = 0; i < tagListLen; i++) {
+        if (is_delim(tagList[i]) && !inTag) {
+            /*
+             * Either a leading delimiter or two consecutive delimiters.  
+             */
+            return 0;
+        } else if (is_delim(tagList[i]) && inTag) {
+            inTag = 0;
+        } else if (!is_delim(tagList[i]) && !inTag) {
+            inTag = 1;
+        }
+    }
+    if (!inTag) {
+        /*
+         * Trailing delimiter.  
+         */
+        return 0;
+    }
+    return 1;
+}
+
+int
+write_snmpTargetAddrTagList(int action,
+                            u_char * var_val,
+                            u_char var_val_type,
+                            size_t var_val_len,
+                            u_char * statP, oid * name, size_t name_len)
+{
+    struct targetAddrTable_struct *target = NULL;
+    static char    *old_tlist;
+
+    if (action == RESERVE1) {
+        if (var_val_type != ASN_OCTET_STR) {
+            DEBUGMSGTL(("snmpTargetAddrEntry",
+                        "write to snmpTargetAddrTagList not ASN_OCTET_STR\n"));
+            return SNMP_ERR_WRONGTYPE;
+        }
+        if (var_val_len > 255) {
+            DEBUGMSGTL(("snmpTargetAddrEntry",
+                        "write to snmpTargetAddrTagList: bad length\n"));
+            return SNMP_ERR_WRONGLENGTH;
+        }
+        if (!snmpTagListValid(var_val, var_val_len)) {
+            return SNMP_ERR_WRONGVALUE;
+        }
+    } else if (action == RESERVE2) {
+        snmpTargetAddrOID[snmpTargetAddrOIDLen - 1] =
+            SNMPTARGETADDRTAGLISTCOLUMN;
+        if ((target =
+             search_snmpTargetAddrTable(snmpTargetAddrOID,
+                                        snmpTargetAddrOIDLen, name,
+                                        &name_len, 1)) == NULL) {
+            DEBUGMSGTL(("snmpTargetAddrEntry",
+                        "write to snmpTargetAddrTagList: BAD OID!\n"));
+            return SNMP_ERR_INCONSISTENTNAME;
+        } else {
+            if (target->storageType == SNMP_STORAGE_READONLY) {
+                DEBUGMSGTL(("snmpTargetAddrEntry",
+                            "write to snmpTargetAddrTagList: row is read only\n"));
+                return SNMP_ERR_NOTWRITABLE;
+            }
+            old_tlist = target->tagList;
+            target->tagList = (char *) malloc(var_val_len + 1);
+            if (target->tagList == NULL) {
+                return SNMP_ERR_RESOURCEUNAVAILABLE;
+            }
+            memcpy(target->tagList, var_val, var_val_len);
+            target->tagList[var_val_len] = '\0';
+        }
+    } else if (action == COMMIT) {
+        SNMP_FREE(old_tlist);
+        old_tlist = NULL;
+    } else if (action == FREE || action == UNDO) {
+        snmpTargetAddrOID[snmpTargetAddrOIDLen - 1] =
+            SNMPTARGETADDRTAGLISTCOLUMN;
+        if ((target =
+             search_snmpTargetAddrTable(snmpTargetAddrOID,
+                                        snmpTargetAddrOIDLen, name,
+                                        &name_len, 1)) != NULL) {
+            if (target->storageType != SNMP_STORAGE_READONLY) {
+                SNMP_FREE(target->tagList);
+                target->tagList = old_tlist;
+            }
+        }
+    }
+
+    return SNMP_ERR_NOERROR;
+}                               /* write_snmpTargetAddrTagList */
+
+
+int
+write_snmpTargetAddrParams(int action,
+                           u_char * var_val,
+                           u_char var_val_type,
+                           size_t var_val_len,
+                           u_char * statP, oid * name, size_t name_len)
+{
+    struct targetAddrTable_struct *target = NULL;
+    static char    *old_params = NULL;
+
+    if (action == RESERVE1) {
+        if (var_val_type != ASN_OCTET_STR) {
+            DEBUGMSGTL(("snmpTargetAddrEntry",
+                        "write to snmpTargetAddrParams not ASN_OCTET_STR\n"));
+            return SNMP_ERR_WRONGTYPE;
+        } else if (var_val_len < 1 || var_val_len > 32) {
+            return SNMP_ERR_WRONGLENGTH;
+        }
+    } else if (action == RESERVE2) {
+        snmpTargetAddrOID[snmpTargetAddrOIDLen - 1] =
+            SNMPTARGETADDRPARAMSCOLUMN;
+        if ((target =
+             search_snmpTargetAddrTable(snmpTargetAddrOID,
+                                        snmpTargetAddrOIDLen, name,
+                                        &name_len, 1)) == 0) {
+            DEBUGMSGTL(("snmpTargetAddrEntry",
+                        "write to snmpTargetAddrParams: BAD OID!\n"));
+            return SNMP_ERR_INCONSISTENTNAME;
+        } else {
+            if (target->storageType == SNMP_STORAGE_READONLY) {
+                DEBUGMSGTL(("snmpTargetAddrEntry",
+                            "write to snmpTargetAddrParams: row is read only\n"));
+                return SNMP_ERR_NOTWRITABLE;
+            }
+            if (target->rowStatus == SNMP_ROW_ACTIVE) {
+                DEBUGMSGTL(("snmpTargetAddrEntry",
+                            "write to snmpTargetAddrParams: not allowed in active row.\n"));
+                return SNMP_ERR_INCONSISTENTVALUE;
+            }
+
+            old_params = target->params;
+            target->params = (u_char *) malloc(var_val_len + 1);
+            if (target->params == NULL) {
+                return SNMP_ERR_RESOURCEUNAVAILABLE;
+            }
+            memcpy(target->params, var_val, var_val_len);
+            target->params[var_val_len] = '\0';
+
+            /*
+             * If row is new, check if its status can be updated.  
+             */
+            if ((target->rowStatus == SNMP_ROW_NOTREADY) &&
+                (snmpTargetAddr_rowStatusCheck(target) != 0)) {
+                target->rowStatus = SNMP_ROW_NOTINSERVICE;
+            }
+        }
+    } else if (action == COMMIT) {
+        SNMP_FREE(old_params);
+        old_params = NULL;
+    } else if (action == FREE || action == UNDO) {
+        /*
+         * Try to undo the SET here (abnormal usage of FREE clause)  
+         */
+        snmpTargetAddrOID[snmpTargetAddrOIDLen - 1] =
+            SNMPTARGETADDRPARAMSCOLUMN;
+        if ((target =
+             search_snmpTargetAddrTable(snmpTargetAddrOID,
+                                        snmpTargetAddrOIDLen, name,
+                                        &name_len, 1)) != NULL) {
+            if (target->storageType != SNMP_STORAGE_READONLY
+                && target->rowStatus != SNMP_ROW_ACTIVE) {
+                SNMP_FREE(target->params);
+                target->params = old_params;
+                if (target->rowStatus == SNMP_ROW_NOTINSERVICE &&
+                    snmpTargetAddr_rowStatusCheck(target) == 0) {
+                    target->rowStatus = SNMP_ROW_NOTREADY;
+                }
+            }
+        }
+    }
+
+    return SNMP_ERR_NOERROR;
+}                               /* write_snmpTargetAddrParams */
+
+int
+write_snmpTargetAddrStorageType(int action,
+                                u_char * var_val,
+                                u_char var_val_type,
+                                size_t var_val_len,
+                                u_char * statP,
+                                oid * name, size_t name_len)
+{
+    long            long_ret = *((long *) var_val);
+    struct targetAddrTable_struct *target;
+
+    if (action == RESERVE1) {
+        if (var_val_type != ASN_INTEGER) {
+            DEBUGMSGTL(("snmpTargetAddrEntry",
+                        "write to snmpTargetAddrStorageType not ASN_INTEGER\n"));
+            return SNMP_ERR_WRONGTYPE;
+        }
+        if (var_val_len != sizeof(long)) {
+            DEBUGMSGTL(("snmpTargetAddrEntry",
+                        "write to snmpTargetAddrStorageType: bad length\n"));
+            return SNMP_ERR_WRONGLENGTH;
+        }
+        if (long_ret != SNMP_STORAGE_OTHER &&
+            long_ret != SNMP_STORAGE_VOLATILE &&
+            long_ret != SNMP_STORAGE_NONVOLATILE) {
+            DEBUGMSGTL(("snmpTargetAddrEntry",
+                        "write to snmpTargetAddrStorageType: attempted storage type not a valid"));
+            DEBUGMSG(("snmpTargetAddrEntry",
+                      " value of other(%d), volatile(%d), or nonvolatile(%d)\n",
+                      SNMP_STORAGE_OTHER, SNMP_STORAGE_VOLATILE,
+                      SNMP_STORAGE_NONVOLATILE));
+            return SNMP_ERR_WRONGVALUE;
+        }
+    } else if (action == RESERVE2) {
+        snmpTargetAddrOID[snmpTargetAddrOIDLen - 1] =
+            SNMPTARGETADDRSTORAGETYPECOLUMN;
+        if ((target = search_snmpTargetAddrTable(snmpTargetAddrOID,
+                                                 snmpTargetAddrOIDLen,
+                                                 name, &name_len,
+                                                 1)) == NULL) {
+            DEBUGMSGTL(("snmpTargetAddrEntry",
+                        "write to snmpTargetAddrStorageType: BAD OID\n"));
+            return SNMP_ERR_INCONSISTENTNAME;
+        } else {
+            if (target->storageType == SNMP_STORAGE_PERMANENT ||
+                target->storageType == SNMP_STORAGE_READONLY) {
+                DEBUGMSGTL(("snmpTargetAddrEntry",
+                            "write to snmpTargetAddrStorageType: row has unchangeable storage status: %d\n",
+                            target->storageType));
+                return SNMP_ERR_WRONGVALUE;
+            }
+        }
+    } else if (action == COMMIT) {
+        snmpTargetAddrOID[snmpTargetAddrOIDLen - 1] =
+            SNMPTARGETADDRSTORAGETYPECOLUMN;
+        if ((target = search_snmpTargetAddrTable(snmpTargetAddrOID,
+                                                 snmpTargetAddrOIDLen,
+                                                 name, &name_len,
+                                                 1)) != NULL) {
+            target->storageType = long_ret;
+        }
+    }
+
+    return SNMP_ERR_NOERROR;
+}                               /* write_snmpTargetAddrStorageType */
+
+
+/*
+ * snmpTargeAddr_createNewRow is called from write_snmpTargetAddrRowStatus
+ * when a new row is required. It creates a new row with 
+ * the index of the passed in 'name' (i.e. full index OID) and
+ * adds it to the linked list. 'name' should be the full OID of the new index. 
+ * It passes back 0 if unsuccessfull.
+ */
+int
+snmpTargetAddr_createNewRow(oid * name, size_t name_len)
+{
+    size_t          newNameLen;
+    int             i;
+    struct targetAddrTable_struct *temp_struct;
+
+    /*
+     * setup a new snmpTargetAddrTable structure and add it to the list 
+     */
+    newNameLen = name_len - snmpTargetAddrOIDLen;
+    if (newNameLen > 0) {
+        temp_struct = snmpTargetAddrTable_create();
+        temp_struct->name = (char *) malloc(newNameLen + 1);
+        if (temp_struct->name == NULL) {
+            return 0;
+        }
+
+        for (i = 0; i < (int) newNameLen; i++) {
+            temp_struct->name[i] = (char) name[i + snmpTargetAddrOIDLen];
+        }
+
+        temp_struct->name[newNameLen] = '\0';
+        temp_struct->rowStatus = SNMP_ROW_NOTREADY;
+
+        snmpTargetAddrTable_addToList(temp_struct, &aAddrTable);
+
+        return 1;
+    }
+
+    return 0;
+}                               /* snmpTargetAddr_createNewRow */
+
+
+/*
+ * Assign a value to the Row Status variable 
+ */
+int
+write_snmpTargetAddrRowStatus(int action,
+                              u_char * var_val,
+                              u_char var_val_type,
+                              size_t var_val_len,
+                              u_char * statP, oid * name, size_t name_len)
+{
+    static long     value;
+    struct targetAddrTable_struct *target = NULL;
+
+    if (action == RESERVE1) {
+        value = *((long *) var_val);
+        if (var_val_type != ASN_INTEGER) {
+            DEBUGMSGTL(("snmpTargetAddrEntry",
+                        "write to snmpTargetAddrRowStatus not ASN_INTEGER\n"));
+            return SNMP_ERR_WRONGTYPE;
+        }
+        if (var_val_len != sizeof(int)) {
+            DEBUGMSGTL(("snmpTargetAddrEntry",
+                        "write to snmpTargetAddrRowStatus: bad length\n"));
+            return SNMP_ERR_WRONGLENGTH;
+        }
+        if (value == RS_NOTREADY || value < 1 || value > 6) {
+            return SNMP_ERR_WRONGVALUE;
+        }
+
+        /*
+         * Check index value is reasonable.  
+         */
+
+        if (name_len < snmpTargetAddrOIDLen + 1 ||
+            name_len > snmpTargetAddrOIDLen + 32) {
+            DEBUGMSGTL(("snmpTargetAddrEntry", "bad index length %d\n",
+                        name_len - snmpTargetAddrOIDLen));
+            return SNMP_ERR_NOCREATION;
+        }
+
+        /*
+         * Search for struct in linked list.  
+         */
+
+        snmpTargetAddrOID[snmpTargetAddrOIDLen - 1] =
+            SNMPTARGETADDRROWSTATUSCOLUMN;
+        target =
+            search_snmpTargetAddrTable(snmpTargetAddrOID,
+                                       snmpTargetAddrOIDLen, name,
+                                       &name_len, 1);
+
+        if (target != NULL) {
+            if (value == RS_CREATEANDGO || value == RS_CREATEANDWAIT) {
+                value = RS_NOTREADY;
+                return SNMP_ERR_INCONSISTENTVALUE;
+            }
+            if (target->storageType == SNMP_STORAGE_READONLY) {
+                DEBUGMSGTL(("snmpTargetAddrEntry", "row is read only\n"));
+                return SNMP_ERR_NOTWRITABLE;
+            }
+            if (target->storageType == SNMP_STORAGE_PERMANENT) {
+                if (value == RS_DESTROY) {
+                    DEBUGMSGTL(("snmpTargetAddrEntry",
+                                "unable to destroy permanent row\n"));
+                    return SNMP_ERR_INCONSISTENTVALUE;
+                }
+            }
+        } else {
+            if (value == RS_ACTIVE || value == RS_NOTINSERVICE) {
+                return SNMP_ERR_INCONSISTENTVALUE;
+            }
+            if (value == RS_CREATEANDGO || value == RS_CREATEANDWAIT) {
+                if (snmpTargetAddr_createNewRow(name, name_len) == 0) {
+                    DEBUGMSGTL(("snmpTargetAddrEntry",
+                                "couldn't malloc() new row\n"));
+                    return SNMP_ERR_RESOURCEUNAVAILABLE;
+                }
+            }
+        }
+    } else if (action == ACTION) {
+        snmpTargetAddrOID[snmpTargetAddrOIDLen - 1] =
+            SNMPTARGETADDRROWSTATUSCOLUMN;
+        target =
+            search_snmpTargetAddrTable(snmpTargetAddrOID,
+                                       snmpTargetAddrOIDLen, name,
+                                       &name_len, 1);
+
+        if (target != NULL) {
+            if (value == RS_CREATEANDGO) {
+                /*
+                 * Check whether all the required objects have been set.  
+                 */
+                if (snmpTargetAddr_rowStatusCheck(target)) {
+                    target->rowStatus = RS_ACTIVE;
+                } else {
+                    target->rowStatus = RS_NOTREADY;
+                }
+            } else if (value == RS_CREATEANDWAIT) {
+                /*
+                 * Check whether all the required objects have been set.  
+                 */
+                if (snmpTargetAddr_rowStatusCheck(target)) {
+                    target->rowStatus = RS_NOTINSERVICE;
+                } else {
+                    target->rowStatus = RS_NOTREADY;
+                }
+            } else if (value == RS_ACTIVE) {
+                if (target->rowStatus == RS_NOTINSERVICE) {
+                    target->rowStatus = RS_ACTIVE;
+                } else if (target->rowStatus == RS_NOTREADY) {
+                    return SNMP_ERR_INCONSISTENTVALUE;
+                }
+            } else if (value == RS_NOTINSERVICE) {
+                if (target->rowStatus == RS_ACTIVE) {
+                    target->rowStatus = RS_NOTINSERVICE;
+                } else if (target->rowStatus == RS_NOTREADY) {
+                    return SNMP_ERR_INCONSISTENTVALUE;
+                }
+            }
+        }
+    } else if (action == COMMIT) {
+        snmpTargetAddrOID[snmpTargetAddrOIDLen - 1] =
+            SNMPTARGETADDRROWSTATUSCOLUMN;
+        target =
+            search_snmpTargetAddrTable(snmpTargetAddrOID,
+                                       snmpTargetAddrOIDLen, name,
+                                       &name_len, 1);
+        if (target != NULL) {
+            if (value == RS_DESTROY) {
+                snmpTargetAddrTable_remFromList(target, &aAddrTable);
+            }
+            if (value == RS_NOTINSERVICE) {
+                if (target->sess != NULL) {
+                    snmp_close(target->sess);
+                    target->sess = NULL;
+                }
+            }
+        }
+    } else if (action == UNDO || action == FREE) {
+        snmpTargetAddrOID[snmpTargetAddrOIDLen - 1] =
+            SNMPTARGETADDRROWSTATUSCOLUMN;
+        target =
+            search_snmpTargetAddrTable(snmpTargetAddrOID,
+                                       snmpTargetAddrOIDLen, name,
+                                       &name_len, 1);
+        if (value == RS_CREATEANDGO || value == RS_CREATEANDWAIT) {
+            if (target != NULL) {
+                snmpTargetAddrTable_remFromList(target, &aAddrTable);
+            }
+        }
+    }
+    return SNMP_ERR_NOERROR;
+}                               /* write_snmpTargetAddrRowStatus */
+
+
+
+int
+write_targetSpinLock(int action,
+                     u_char * var_val,
+                     u_char var_val_type,
+                     size_t var_val_len,
+                     u_char * statP, oid * name, size_t name_len)
+{
+    if (action == RESERVE1) {
+        if (var_val_type != ASN_INTEGER) {
+            return SNMP_ERR_WRONGTYPE;
+        }
+        if (var_val_len != sizeof(unsigned long)) {
+            return SNMP_ERR_WRONGLENGTH;
+        }
+        if (*((unsigned long *) var_val) != snmpTargetSpinLock) {
+            return SNMP_ERR_INCONSISTENTVALUE;
+        }
+    } else if (action == COMMIT) {
+        if (snmpTargetSpinLock == 2147483647) {
+            snmpTargetSpinLock = 0;
+        } else {
+            snmpTargetSpinLock++;
+        }
+    }
+    return SNMP_ERR_NOERROR;
+}
+
+
+
+u_char         *
+var_targetSpinLock(struct variable * vp,
+                   oid * name,
+                   size_t * length,
+                   int exact,
+                   size_t * var_len, WriteMethod ** write_method)
+{
+    if (header_generic(vp, name, length, exact, var_len, write_method) ==
+        MATCH_FAILED) {
+        *write_method = write_targetSpinLock;
+        return NULL;
+    }
+    if (vp->magic == SNMPTARGETSPINLOCK) {
+        *write_method = write_targetSpinLock;
+        *var_len = sizeof(unsigned long);
+        return (u_char *) & (snmpTargetSpinLock);
+    }
+    return NULL;
+}
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/target/snmpTargetAddrEntry.h tomato121/release/src/router/snmp/agent/mibgroup/target/snmpTargetAddrEntry.h
--- tomato/release/src/router/snmp/agent/mibgroup/target/snmpTargetAddrEntry.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/target/snmpTargetAddrEntry.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,95 @@
+
+/*
+ * This file was generated by mib2c and is intended for use as a mib module
+ * for the ucd-snmp snmpd agent.  Edited by Michael Baer
+ * 
+ * last changed 2/2/99.
+ */
+
+#ifndef _MIBGROUP_SNMPTARGETADDRENTRY_H
+#define _MIBGROUP_SNMPTARGETADDRENTRY_H
+
+/*
+ * we use header_generic and checkmib from the util_funcs module 
+ */
+
+config_require(util_funcs)
+
+
+    /*
+     * add the SNMPv2-TM mib into the default list of mibs to load, since
+     * it contains the Domain definitions (EG, netsnmpUDPDomain) 
+     */
+config_add_mib(SNMPv2-TM)
+
+    /*
+     * Magic number definitions: 
+     */
+#define   SNMPTARGETADDRTDOMAIN      1
+#define   SNMPTARGETADDRTADDRESS     2
+#define   SNMPTARGETADDRTIMEOUT      3
+#define   SNMPTARGETADDRRETRYCOUNT   4
+#define   SNMPTARGETADDRTAGLIST      5
+#define   SNMPTARGETADDRPARAMS       6
+#define   SNMPTARGETADDRSTORAGETYPE  7
+#define   SNMPTARGETADDRROWSTATUS    8
+#define	  SNMPTARGETSPINLOCK	     99
+#define   SNMPTARGETADDRTDOMAINCOLUMN      2
+#define   SNMPTARGETADDRTADDRESSCOLUMN     3
+#define   SNMPTARGETADDRTIMEOUTCOLUMN      4
+#define   SNMPTARGETADDRRETRYCOUNTCOLUMN   5
+#define   SNMPTARGETADDRTAGLISTCOLUMN      6
+#define   SNMPTARGETADDRPARAMSCOLUMN       7
+#define   SNMPTARGETADDRSTORAGETYPECOLUMN  8
+#define   SNMPTARGETADDRROWSTATUSCOLUMN    9
+    /*
+     * structure definitions 
+     */
+     struct targetAddrTable_struct {
+         char           *name;
+         oid             tDomain[MAX_OID_LEN];
+         int             tDomainLen;
+         unsigned char  *tAddress;
+         size_t          tAddressLen;
+         int             timeout;
+         int             retryCount;
+         char           *tagList;
+         char           *params;
+         int             storageType;
+         int             rowStatus;
+         struct targetAddrTable_struct *next;
+         netsnmp_session *sess; /* a snmp session to the target host */
+         time_t          sessionCreationTime;
+     };
+
+/*
+ * function definitions 
+ */
+
+     void            init_snmpTargetAddrEntry(void);
+     int             store_snmpTargetAddrEntry(int majorID, int minorID,
+                                               void *serverarg,
+                                               void *clientarg);
+     FindVarMethod   var_snmpTargetAddrEntry;
+
+     struct targetAddrTable_struct *get_addrTable(void);
+     struct targetAddrTable_struct *get_addrForName(char *name);
+     struct targetAddrTable_struct *snmpTargetAddrTable_create(void);
+     void            snmpTargetAddrTable_add(struct targetAddrTable_struct
+                                             *newEntry);
+
+     void            snmpd_parse_config_targetAddr(const char *, char *);
+
+     WriteMethod     write_snmpTargetAddrTDomain;
+     WriteMethod     write_snmpTargetAddrTAddress;
+     WriteMethod     write_snmpTargetAddrTimeout;
+     WriteMethod     write_snmpTargetAddrRetryCount;
+     WriteMethod     write_snmpTargetAddrTagList;
+     WriteMethod     write_snmpTargetAddrParams;
+     WriteMethod     write_snmpTargetAddrStorageType;
+     WriteMethod     write_snmpTargetAddrRowStatus;
+
+     FindVarMethod   var_targetSpinLock;
+     WriteMethod     write_targetSpinLock;
+
+#endif                          /* _MIBGROUP_SNMPTARGETADDRENTRY_H */
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/target/snmpTargetParamsEntry.c tomato121/release/src/router/snmp/agent/mibgroup/target/snmpTargetParamsEntry.c
--- tomato/release/src/router/snmp/agent/mibgroup/target/snmpTargetParamsEntry.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/target/snmpTargetParamsEntry.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,1401 @@
+/*
+ * TargetParamTable MIB
+ * 
+ * This file was generated by mib2c and is intended for use as a mib module
+ * for the ucd-snmp snmpd agent. Edited by Michael Baer 
+ * 
+ * last changed 2/2/99.
+ */
+
+#include <net-snmp/net-snmp-config.h>
+#if HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+#include <stdlib.h>
+#include <ctype.h>
+#if HAVE_WINSOCK_H
+#include <winsock.h>
+#endif
+
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+#include "snmpTargetParamsEntry.h"
+
+#define snmpTargetParamsOIDLen 11       /*This is base+column, 
+                                         * i.e. everything but index */
+
+oid             snmpTargetParamsOID[snmpTargetParamsOIDLen] =
+    { 1, 3, 6, 1, 6, 3, 12, 1, 3, 1, 0 };
+
+static struct targetParamTable_struct *aPTable = 0;
+
+
+/*
+ * Utility routines 
+ */
+
+
+/*
+ * TargetParamTable_create creates and returns a pointer
+ * to a targetParamTable_struct with default values set 
+ */
+struct targetParamTable_struct
+               *
+snmpTargetParamTable_create(void)
+{
+    struct targetParamTable_struct *newEntry;
+
+    newEntry = (struct targetParamTable_struct *)
+        malloc(sizeof(struct targetParamTable_struct));
+
+    newEntry->paramName = 0;
+    newEntry->mpModel = -1;
+
+    newEntry->secModel = -1;
+    newEntry->secName = 0;
+    newEntry->secLevel = -1;
+
+    newEntry->storageType = SNMP_STORAGE_NONVOLATILE;
+    newEntry->rowStatus = SNMP_ROW_NONEXISTENT;
+    newEntry->next = 0;
+    return newEntry;
+}
+
+
+/*
+ * TargetParamTable_dispose frees the space allocated to a
+ * targetParamTable_struct 
+ */
+void
+snmpTargetParamTable_dispose(struct targetParamTable_struct *reaped)
+{
+    free(reaped->paramName);
+    free(reaped->secName);
+
+    free(reaped);
+}                               /* snmpTargetParamTable_dispose  */
+
+
+/*
+ * snmpTargetParamTable_addToList adds a targetParamTable_struct 
+ * to a list passed in. The list is assumed to be in a sorted order,
+ * low to high and this procedure inserts a new struct in the proper 
+ * location. Sorting uses OID values based on paramName. A new equal value 
+ * overwrites a current one. 
+ */
+void
+snmpTargetParamTable_addToList(struct targetParamTable_struct *newEntry,
+                               struct targetParamTable_struct **listPtr)
+{
+    static struct targetParamTable_struct *curr_struct, *prev_struct;
+    int             i;
+    size_t          newOIDLen = 0, currOIDLen = 0;
+    oid             newOID[128], currOID[128];
+
+    /*
+     * if the list is empty, add the new entry to the top 
+     */
+    if ((prev_struct = curr_struct = *listPtr) == 0) {
+        *listPtr = newEntry;
+        return;
+    } else {
+        /*
+         * get the 'OID' value of the new entry 
+         */
+        newOIDLen = strlen(newEntry->paramName);
+        for (i = 0; i < (int) newOIDLen; i++) {
+            newOID[i] = newEntry->paramName[i];
+        }
+
+        /*
+         * search through the list for an equal or greater OID value 
+         */
+        while (curr_struct != 0) {
+            currOIDLen = strlen(curr_struct->paramName);
+            for (i = 0; i < (int) currOIDLen; i++) {
+                currOID[i] = curr_struct->paramName[i];
+            }
+
+            i = snmp_oid_compare(newOID, newOIDLen, currOID, currOIDLen);
+            if (i == 0) {       /* Exact match, overwrite with new struct */
+                newEntry->next = curr_struct->next;
+                /*
+                 * if curr_struct is the top of the list 
+                 */
+                if (*listPtr == curr_struct)
+                    *listPtr = newEntry;
+                else
+                    prev_struct->next = newEntry;
+                snmpTargetParamTable_dispose(curr_struct);
+                return;
+            } else if (i < 0) { /* Found a greater OID, insert struct in front of it. */
+                newEntry->next = curr_struct;
+                /*
+                 * if curr_struct is the top of the list 
+                 */
+                if (*listPtr == curr_struct)
+                    *listPtr = newEntry;
+                else
+                    prev_struct->next = newEntry;
+                return;
+            }
+            prev_struct = curr_struct;
+            curr_struct = curr_struct->next;
+        }
+    }
+    /*
+     * if we're here, no larger OID was ever found, insert on end of list 
+     */
+    prev_struct->next = newEntry;
+}                               /* snmpTargeParamTable_addToList  */
+
+void
+snmpTargetParamTable_add(struct targetParamTable_struct *newEntry)
+{
+    snmpTargetParamTable_addToList(newEntry, &aPTable);
+}
+
+/*
+ * snmpTargetParamTable_remFromList removes a targetParamTable_struct 
+ * from the list passed in 
+ */
+void
+snmpTargetParamTable_remFromList(struct targetParamTable_struct *oldEntry,
+                                 struct targetParamTable_struct **listPtr)
+{
+    struct targetParamTable_struct *tptr;
+
+    if ((tptr = *listPtr) == 0)
+        return;
+    else if (tptr == oldEntry) {
+        *listPtr = (*listPtr)->next;
+        snmpTargetParamTable_dispose(tptr);
+        return;
+    } else {
+        while (tptr->next != 0) {
+            if (tptr->next == oldEntry) {
+                tptr->next = tptr->next->next;
+                snmpTargetParamTable_dispose(oldEntry);
+                return;
+            }
+            tptr = tptr->next;
+        }
+    }
+}                               /* snmpTargetParamTable_remFromList  */
+
+
+/*
+ * lookup OID in the link list of Table Entries 
+ */
+struct targetParamTable_struct *
+search_snmpTargetParamsTable(oid * baseName,
+                             size_t baseNameLen,
+                             oid * name, size_t * length, int exact)
+{
+    static struct targetParamTable_struct *temp_struct;
+    int             i;
+    size_t          myOIDLen = 0;
+    oid             newNum[128];
+
+    /*
+     * lookup entry in p / * Get Current MIB ID 
+     */
+    memcpy(newNum, baseName, baseNameLen * sizeof(oid));
+
+    for (temp_struct = aPTable; temp_struct != 0;
+         temp_struct = temp_struct->next) {
+        for (i = 0; i < (int) strlen(temp_struct->paramName); i++) {
+            newNum[baseNameLen + i] = temp_struct->paramName[i];
+        }
+        myOIDLen = baseNameLen + strlen(temp_struct->paramName);
+        i = snmp_oid_compare(name, *length, newNum, myOIDLen);
+        /*
+         * Assumes that the linked list sorted by OID, low to high 
+         */
+        if ((i == 0 && exact != 0) || (i < 0 && exact == 0)) {
+            if (exact == 0) {
+                memcpy(name, newNum, myOIDLen * sizeof(oid));
+                *length = myOIDLen;
+            }
+            return temp_struct;
+        }
+    }
+    return (0);
+}                               /* search_snmpTargetParamsTable */
+
+
+/*
+ * snmpTargetParams_rowStatusCheck is boolean funciton that  checks 
+ * the status of a row's values in order to determine whether
+ * the row should be notReady or notInService  
+ */
+int
+snmpTargetParams_rowStatusCheck(struct targetParamTable_struct *entry)
+{
+    if ((entry->mpModel < 0) || (entry->secModel < 0) ||
+        (entry->secLevel < 0) || (entry->secName == 0))
+        return 0;
+    else
+        return 1;
+}                               /* snmtpTargetParamTable_rowStatusCheck */
+
+
+/*
+ * initialization routines 
+ */
+
+
+/*
+ * this variable defines function callbacks and type return information 
+ * for the snmpTargetAddrEntry mib 
+ */
+
+struct variable2 snmpTargetParamsEntry_variables[] = {
+    {SNMPTARGETPARAMSMPMODEL, ASN_INTEGER, RWRITE,
+     var_snmpTargetParamsEntry, 1, {SNMPTARGETPARAMSMPMODELCOLUMN}},
+    {SNMPTARGETPARAMSSECURITYMODEL, ASN_INTEGER, RWRITE,
+     var_snmpTargetParamsEntry, 1, {SNMPTARGETPARAMSSECURITYMODELCOLUMN}},
+    {SNMPTARGETPARAMSSECURITYNAME, ASN_OCTET_STR, RWRITE,
+     var_snmpTargetParamsEntry, 1, {SNMPTARGETPARAMSSECURITYNAMECOLUMN}},
+    {SNMPTARGETPARAMSSECURITYLEVEL, ASN_INTEGER, RWRITE,
+     var_snmpTargetParamsEntry, 1, {SNMPTARGETPARAMSSECURITYLEVELCOLUMN}},
+    {SNMPTARGETPARAMSSTORAGETYPE, ASN_INTEGER, RWRITE,
+     var_snmpTargetParamsEntry, 1, {SNMPTARGETPARAMSSTORAGETYPECOLUMN}},
+    {SNMPTARGETPARAMSROWSTATUS, ASN_INTEGER, RWRITE,
+     var_snmpTargetParamsEntry, 1, {SNMPTARGETPARAMSROWSTATUSCOLUMN}}
+};
+
+/*
+ * now load this mib into the agents mib table 
+ */
+oid             snmpTargetParamsEntry_variables_oid[] =
+    { 1, 3, 6, 1, 6, 3, 12, 1, 3, 1 };
+
+
+void
+init_snmpTargetParamsEntry(void)
+{
+    aPTable = 0;
+
+    REGISTER_MIB("target/snmpTargetParamsEntry",
+                 snmpTargetParamsEntry_variables, variable2,
+                 snmpTargetParamsEntry_variables_oid);
+
+    snmpd_register_config_handler("targetParams",
+                                  snmpd_parse_config_targetParams, 0,
+                                  NULL);
+
+    /*
+     * we need to be called back later 
+     */
+    snmp_register_callback(SNMP_CALLBACK_LIBRARY, SNMP_CALLBACK_STORE_DATA,
+                           store_snmpTargetParamsEntry, NULL);
+}                               /*  init_snmpTargetParmsEntry  */
+
+
+int
+snmpTargetParams_addParamName(struct targetParamTable_struct *entry,
+                              char *cptr)
+{
+    size_t          len;
+    if (cptr == 0) {
+        DEBUGMSGTL(("snmpTargetParamsEntry",
+                    "ERROR snmpTargetParamsEntry: no param name in config string\n"));
+        return (0);
+    } else {
+        len = strlen(cptr);
+        /*
+         * spec check for string 1-32 
+         */
+        if (len < 1 || len > 32) {
+            DEBUGMSGTL(("snmpTargetParamsEntry",
+                        "ERROR snmpTargetParamsEntry: param name out of range in config string\n"));
+            return (0);
+        }
+        entry->paramName = (char *) malloc(len + 1);
+        strncpy(entry->paramName, cptr, len);
+        entry->paramName[len] = '\0';
+    }
+    return (1);
+}
+
+
+int
+snmpTargetParams_addMPModel(struct targetParamTable_struct *entry,
+                            char *cptr)
+{
+    if (cptr == 0) {
+        DEBUGMSGTL(("snmpTargetParamsEntry",
+                    "ERROR snmpTargetParamsEntry: no mp model in config string\n"));
+        return (0);
+    } else if (!(isdigit(*cptr))) {
+        DEBUGMSGTL(("snmpTargetParamsEntry",
+                    "ERROR snmpTargeParamsEntry: mp model is not digit in config string\n"));
+        return (0);
+    }
+    /*
+     * spec check MP Model >= 0 
+     */
+    else if ((entry->mpModel = (int) strtol(cptr, (char **) NULL, 0)) < 0) {
+        DEBUGMSGTL(("snmpTargetParamsEntry",
+                    "ERROR snmpTargeParamsEntry: mp model out of range in config string\n"));
+        return (0);
+    }
+    return (1);
+}                               /* snmpTargetParams_addMPModel  */
+
+
+int
+snmpTargetParams_addSecModel(struct targetParamTable_struct *entry,
+                             char *cptr)
+{
+    if (cptr == 0) {
+        DEBUGMSGTL(("snmpTargetParamsEntry",
+                    "ERROR snmpTargetParamsEntry: no sec model in config string\n"));
+        return (0);
+    } else if (!(isdigit(*cptr))) {
+        DEBUGMSGTL(("snmpTargetParamsEntry",
+                    "ERROR snmpTargeParamsEntry: security model is not digit in config string\n"));
+        return (0);
+    }
+    /*
+     * spec check Sec. Model > 0 
+     */
+    else if ((entry->secModel =
+              (int) strtol(cptr, (char **) NULL, 0)) <= 0) {
+        DEBUGMSGTL(("snmpTargetParamsEntry",
+                    "ERROR snmpTargetParamsEntry: security model out of range in config string\n"));
+        return (0);
+    }
+    return (1);
+}                               /*  snmpTargetParams_addSecModel  */
+
+
+int
+snmpTargetParams_addSecName(struct targetParamTable_struct *entry,
+                            char *cptr)
+{
+    size_t          len;
+    if (cptr == 0) {
+        DEBUGMSGTL(("snmpTargetParamsEntry",
+                    "ERROR snmpTargetParamsEntry: no security name in config string\n"));
+        return (0);
+    } else {
+        len = strlen(cptr);
+        entry->secName = (char *) malloc(len + 1);
+        strncpy(entry->secName, cptr, len);
+        entry->secName[len] = '\0';
+    }
+    return (1);
+}                               /* snmpTargetParams_addSecName  */
+
+
+int
+snmpTargetParams_addSecLevel(struct targetParamTable_struct *entry,
+                             char *cptr)
+{
+    if (cptr == 0) {
+        DEBUGMSGTL(("snmpTargetParamsEntry",
+                    "ERROR snmpTargetParamsEntry: no security level in config string\n"));
+        return (0);
+    } else if (!(isdigit(*cptr))) {
+        DEBUGMSGTL(("snmpTargetParamsEntry",
+                    "ERROR snmpTargeParamsEntry: security level is not digit in config string\n"));
+        return (0);
+    }
+    /*
+     * no spec range check, but noAuthNoPriv is 1 so... 
+     */
+    else if ((entry->secLevel =
+              (int) strtol(cptr, (char **) NULL, 0)) <= 0) {
+        DEBUGMSGTL(("snmpTargetParamsEntry",
+                    "ERROR snmpTargeParamsEntry: security level is not greater than 0 in config string\n"));
+        return (0);
+    }
+    return (1);
+}                               /*  snmpTargetParams_addSecLevel  */
+
+
+int
+snmpTargetParams_addStorageType(struct targetParamTable_struct *entry,
+                                char *cptr)
+{
+    if (cptr == 0) {
+        DEBUGMSGTL(("snmpTargetParamsEntry",
+                    "ERROR snmpTargetParamsEntry: no storage type in config string\n"));
+        return (0);
+    } else if (!(isdigit(*cptr))) {
+        DEBUGMSGTL(("snmpTargetParamsEntry",
+                    "ERROR snmpTargeParamsEntry: storage type is not digit in config string\n"));
+        return (0);
+    }
+    /*
+     * check that storage type is a possible value 
+     */
+    else if (((entry->storageType = (int) strtol(cptr, (char **) NULL, 0))
+              != SNMP_STORAGE_OTHER) &&
+             (entry->storageType != SNMP_STORAGE_VOLATILE) &&
+             (entry->storageType != SNMP_STORAGE_NONVOLATILE) &&
+             (entry->storageType != SNMP_STORAGE_PERMANENT) &&
+             (entry->storageType != SNMP_STORAGE_READONLY)) {
+        DEBUGMSGTL(("snmpTargetParamsEntry",
+                    "ERROR snmpTargeParamsEntry: storage type is not a valid value of"));
+        DEBUGMSG(("snmpTargetParamsEntry",
+                  " other(%d), volatile(%d), nonvolatile(%d), permanent(%d), or ",
+                  SNMP_STORAGE_OTHER, SNMP_STORAGE_VOLATILE,
+                  SNMP_STORAGE_NONVOLATILE, SNMP_STORAGE_PERMANENT));
+        DEBUGMSGTL(("snmpTargetParamsEntry",
+                    "readonly(%d) in config string.\n",
+                    SNMP_STORAGE_READONLY));
+
+        return (0);
+    }
+    return (1);
+}                               /* snmpTargetParams_addStorageType  */
+
+
+int
+snmpTargetParams_addRowStatus(struct targetParamTable_struct *entry,
+                              char *cptr)
+{
+    if (cptr == 0) {
+        DEBUGMSGTL(("snmpTargetParamsEntry",
+                    "ERROR snmpTargetParamsEntry: no row status in config string\n"));
+        return (0);
+    } else if (!(isdigit(*cptr))) {
+        DEBUGMSGTL(("snmpTargetParamsEntry",
+                    "ERROR snmpTargeParamsEntry: row status is not digit in config string\n"));
+        return (0);
+    }
+    /*
+     * check that row status is a valid value 
+     */
+    else if (((entry->rowStatus = (int) strtol(cptr, (char **) NULL, 0))
+              != SNMP_ROW_ACTIVE) &&
+             (entry->rowStatus != SNMP_ROW_NOTINSERVICE) &&
+             (entry->rowStatus != SNMP_ROW_NOTREADY)) {
+        DEBUGMSGTL(("snmpTargetParamsEntry",
+                    "ERROR snmpTargetParamsEntry: Row Status is not a valid value of "));
+        DEBUGMSG(("snmpTargetParamsEntry",
+                  "active(%d), notinservice(%d), or notready(%d) in config string.\n",
+                  SNMP_ROW_ACTIVE, SNMP_ROW_NOTINSERVICE,
+                  SNMP_ROW_NOTREADY));
+
+        return (0);
+    }
+    return (1);
+}                               /* snmpTargetParams_addRowStatus  */
+
+/*
+ * timestamp the current entry's modification time 
+ */
+void
+update_timestamp(struct targetParamTable_struct *temp_struct)
+{
+    temp_struct->updateTime = time(NULL);
+}
+
+void
+snmpd_parse_config_targetParams(const char *token, char *char_ptr)
+{
+    char           *cptr = char_ptr, buff[1024];
+    struct targetParamTable_struct *newEntry;
+
+    newEntry = snmpTargetParamTable_create();
+
+    cptr = copy_nword(cptr, buff, sizeof(buff));
+    if (snmpTargetParams_addParamName(newEntry, buff) == 0) {
+        snmpTargetParamTable_dispose(newEntry);
+        return;
+    }
+    cptr = copy_nword(cptr, buff, sizeof(buff));
+    if (snmpTargetParams_addMPModel(newEntry, buff) == 0) {
+        snmpTargetParamTable_dispose(newEntry);
+        return;
+    }
+    cptr = copy_nword(cptr, buff, sizeof(buff));
+    if (snmpTargetParams_addSecModel(newEntry, buff) == 0) {
+        snmpTargetParamTable_dispose(newEntry);
+        return;
+    }
+    cptr = copy_nword(cptr, buff, sizeof(buff));
+    if (snmpTargetParams_addSecName(newEntry, buff) == 0) {
+        snmpTargetParamTable_dispose(newEntry);
+        return;
+    }
+    cptr = copy_nword(cptr, buff, sizeof(buff));
+    if (snmpTargetParams_addSecLevel(newEntry, buff) == 0) {
+        snmpTargetParamTable_dispose(newEntry);
+        return;
+    }
+    cptr = copy_nword(cptr, buff, sizeof(buff));
+    if (snmpTargetParams_addStorageType(newEntry, buff) == 0) {
+        snmpTargetParamTable_dispose(newEntry);
+        return;
+    }
+    cptr = copy_nword(cptr, buff, sizeof(buff));
+    if (snmpTargetParams_addRowStatus(newEntry, buff) == 0) {
+        snmpTargetParamTable_dispose(newEntry);
+        return;
+    }
+    snprintf(buff, sizeof(buff),
+            "snmp_parse_config_targetParams, read: %s %d %d %s %d %d %d\n",
+            newEntry->paramName, newEntry->mpModel, newEntry->secModel,
+            newEntry->secName, newEntry->secLevel, newEntry->storageType,
+            newEntry->rowStatus);
+    buff[ sizeof(buff)-1 ] = 0;
+    DEBUGMSGTL(("snmpTargetParamsEntry", buff));
+
+    update_timestamp(newEntry);
+    snmpTargetParamTable_addToList(newEntry, &aPTable);
+}                               /* snmpd_parse_config_target */
+
+
+/*
+ * shutdown routines 
+ */
+
+
+/*
+ * store_snmpTargetParamsEntry handles the presistent storage proccess 
+ * for this MIB table. It writes out all the non-volatile rows 
+ * to permanent storage on a shutdown  
+ */
+int
+store_snmpTargetParamsEntry(int majorID, int minorID, void *serverarg,
+                            void *clientarg)
+{
+    struct targetParamTable_struct *curr_struct;
+    char            line[1024];
+
+    strcpy(line, "");
+    if ((curr_struct = aPTable) != 0) {
+        while (curr_struct != 0) {
+            if ((curr_struct->storageType == SNMP_STORAGE_NONVOLATILE ||
+                 curr_struct->storageType == SNMP_STORAGE_PERMANENT)
+                &&
+                (curr_struct->rowStatus == SNMP_ROW_ACTIVE ||
+                 curr_struct->rowStatus == SNMP_ROW_NOTINSERVICE)) {
+                snprintf(&line[strlen(line)], sizeof(line)-strlen(line)-1,
+                        "targetParams %s %i %i %s %i %i %i\n",
+                        curr_struct->paramName, curr_struct->mpModel,
+                        curr_struct->secModel, curr_struct->secName,
+                        curr_struct->secLevel, curr_struct->storageType,
+                        curr_struct->rowStatus);
+                line[ sizeof(line)-1 ] = 0;
+
+                /*
+                 * store to file 
+                 */
+                snmpd_store_config(line);
+            }
+            curr_struct = curr_struct->next;
+        }
+    }
+    return SNMPERR_SUCCESS;
+}                               /*  store_snmpTargetParmsEntry  */
+
+
+/*
+ * MIB table access routines 
+ */
+
+
+u_char         *
+var_snmpTargetParamsEntry(struct variable * vp,
+                          oid * name,
+                          size_t * length,
+                          int exact,
+                          size_t * var_len, WriteMethod ** write_method)
+{
+    /*
+     * variables we may use later 
+     */
+    static long     long_ret;
+    static unsigned char string[1500];
+    struct targetParamTable_struct *temp_struct;
+
+    switch (vp->magic) {
+    case SNMPTARGETPARAMSMPMODEL:
+        *write_method = write_snmpTargetParamsMPModel;
+        break;
+    case SNMPTARGETPARAMSSECURITYMODEL:
+        *write_method = write_snmpTargetParamsSecModel;
+        break;
+    case SNMPTARGETPARAMSSECURITYNAME:
+        *write_method = write_snmpTargetParamsSecName;
+        break;
+    case SNMPTARGETPARAMSSECURITYLEVEL:
+        *write_method = write_snmpTargetParamsSecLevel;
+        break;
+    case SNMPTARGETPARAMSSTORAGETYPE:
+        *write_method = write_snmpTargetParamsStorageType;
+        break;
+    case SNMPTARGETPARAMSROWSTATUS:
+        *write_method = write_snmpTargetParamsRowStatus;
+        break;
+    default:
+        *write_method = NULL;
+    }
+
+    *var_len = sizeof(long_ret);        /* assume an integer and change later if not */
+
+    /*
+     * look for OID in current table 
+     */
+    if ((temp_struct = search_snmpTargetParamsTable(vp->name, vp->namelen,
+                                                    name, length,
+                                                    exact)) == 0) {
+        return (0);
+    }
+
+    /*
+     * We found what we were looking for, either the next OID or the exact OID 
+     */
+    /*
+     * this is where we do the value assignments for the mib results. 
+     */
+    switch (vp->magic) {
+
+    case SNMPTARGETPARAMSMPMODEL:
+        /*
+         * if unset value, (i.e. new row) 
+         */
+        if (temp_struct->mpModel == -1)
+            return (0);
+        long_ret = temp_struct->mpModel;
+        return (unsigned char *) &long_ret;
+
+    case SNMPTARGETPARAMSSECURITYMODEL:
+        /*
+         * if unset value, (i.e. new row) 
+         */
+        if (temp_struct->secModel == -1)
+            return (0);
+        long_ret = temp_struct->secModel;
+        return (unsigned char *) &long_ret;
+
+    case SNMPTARGETPARAMSSECURITYNAME:
+        /*
+         * if unset value, (i.e. new row) 
+         */
+        if (temp_struct->secName == 0)
+            return (0);
+        /*
+         * including null character. 
+         */
+        memcpy(string, temp_struct->secName, strlen(temp_struct->secName));
+        string[strlen(temp_struct->secName)] = '\0';
+        *var_len = strlen(temp_struct->secName);
+        return (unsigned char *) string;
+
+    case SNMPTARGETPARAMSSECURITYLEVEL:
+        /*
+         * if unset value, (i.e. new row) 
+         */
+        if (temp_struct->secLevel == -1)
+            return (0);
+        long_ret = temp_struct->secLevel;
+        return (unsigned char *) &long_ret;
+
+    case SNMPTARGETPARAMSSTORAGETYPE:
+        long_ret = temp_struct->storageType;
+        return (unsigned char *) &long_ret;
+
+    case SNMPTARGETPARAMSROWSTATUS:
+        long_ret = temp_struct->rowStatus;
+        return (unsigned char *) &long_ret;
+
+    default:
+        DEBUGMSGTL(("snmpd",
+                    "unknown sub-id %d in var_snmpTargetParamsEntry\n",
+                    vp->magic));
+    }
+    return 0;
+}                               /* var_snmpTargetParamsEntry */
+
+/*
+ * Assign a value to the mpModel variable.  
+ */
+int
+write_snmpTargetParamsMPModel(int action,
+                              u_char * var_val,
+                              u_char var_val_type,
+                              size_t var_val_len,
+                              u_char * statP, oid * name, size_t name_len)
+{
+    long            long_ret = *((long *) var_val);
+    static long     old_mp;
+    struct targetParamTable_struct *params = NULL;
+
+    if (action == RESERVE1) {
+        if (var_val_type != ASN_INTEGER) {
+            DEBUGMSGTL(("snmpTargetParamsEntry",
+                        "write to snmpTargetParamsMPModel: not ASN_INTEGER\n"));
+            return SNMP_ERR_WRONGTYPE;
+        }
+        if (var_val_len != sizeof(long)) {
+            DEBUGMSGTL(("snmpTargetParamsEntry",
+                        "write to snmpTargetParamsMPModel: bad length\n"));
+            return SNMP_ERR_WRONGLENGTH;
+        }
+        if (long_ret < 0) {
+            DEBUGMSGTL(("snmpTargetParamsEntry",
+                        "write to snmpTargetParamsMPModel: MP Model out of range\n"));
+            return SNMP_ERR_INCONSISTENTVALUE;
+        }
+    } else if (action == RESERVE2) {
+        snmpTargetParamsOID[snmpTargetParamsOIDLen - 1] =
+            SNMPTARGETPARAMSMPMODELCOLUMN;
+        params = search_snmpTargetParamsTable(snmpTargetParamsOID,
+                                              snmpTargetParamsOIDLen,
+                                              name, &name_len, 1);
+        if (params == NULL) {
+            DEBUGMSGTL(("snmpTargetParamsEntry",
+                        "write to snmpTargetParamsMPModel: BAD OID\n"));
+            return SNMP_ERR_INCONSISTENTNAME;
+        } else {
+            /*
+             * Row exists, check if it is changeable.  
+             */
+            if (params->storageType == SNMP_STORAGE_READONLY) {
+                DEBUGMSGTL(("snmpTargetParamsEntry",
+                            "write to snmpTargetParamMPModel: row is read only\n"));
+                return SNMP_ERR_NOTWRITABLE;
+            }
+            /*
+             * Check if row is active.  
+             */
+            if (params->rowStatus == SNMP_ROW_ACTIVE) {
+                DEBUGMSGTL(("snmpTargetParamsEntry",
+                            "write to snmpTargetParamsMPModel: this change not allowed in active row.\n"));
+                return SNMP_ERR_INCONSISTENTVALUE;
+            }
+
+            old_mp = params->mpModel;
+            params->mpModel = long_ret;
+
+            if (params->rowStatus == SNMP_ROW_NOTREADY &&
+                snmpTargetParams_rowStatusCheck(params)) {
+                params->rowStatus = SNMP_ROW_NOTINSERVICE;
+            }
+        }
+    } else if (action == COMMIT) {
+        snmpTargetParamsOID[snmpTargetParamsOIDLen - 1] =
+            SNMPTARGETPARAMSMPMODELCOLUMN;
+        if ((params = search_snmpTargetParamsTable(snmpTargetParamsOID,
+                                                   snmpTargetParamsOIDLen,
+                                                   name, &name_len,
+                                                   1)) != NULL) {
+            update_timestamp(params);
+        }
+    } else if (action == FREE || action == UNDO) {
+        /*
+         * Try to undo the SET here (abnormal usage of FREE clause)  
+         */
+        snmpTargetParamsOID[snmpTargetParamsOIDLen - 1] =
+            SNMPTARGETPARAMSMPMODELCOLUMN;
+        if ((params = search_snmpTargetParamsTable(snmpTargetParamsOID,
+                                                   snmpTargetParamsOIDLen,
+                                                   name, &name_len,
+                                                   1)) != NULL) {
+            if (params->storageType != SNMP_STORAGE_READONLY
+                && params->rowStatus != SNMP_ROW_ACTIVE) {
+                params->mpModel = old_mp;
+                if (params->rowStatus == SNMP_ROW_NOTINSERVICE &&
+                    !snmpTargetParams_rowStatusCheck(params)) {
+                    params->rowStatus = SNMP_ROW_NOTREADY;
+                }
+            }
+        }
+    }
+
+    return SNMP_ERR_NOERROR;
+}                               /* write_snmpTargetParamsMPModel */
+
+/*
+ * Assign a value to the secModel variable.  
+ */
+int
+write_snmpTargetParamsSecModel(int action,
+                               u_char * var_val,
+                               u_char var_val_type,
+                               size_t var_val_len,
+                               u_char * statP, oid * name, size_t name_len)
+{
+    long            long_ret = *((long *) var_val);
+    static long     old_sec;
+    struct targetParamTable_struct *params = NULL;
+
+    if (action == RESERVE1) {
+        if (var_val_type != ASN_INTEGER) {
+            DEBUGMSGTL(("snmpTargetParamsEntry",
+                        "write to snmpTargetParamsSecModel: not ASN_INTEGER\n"));
+            return SNMP_ERR_WRONGTYPE;
+        }
+        if (var_val_len != sizeof(long)) {
+            DEBUGMSGTL(("snmpTargetParamsEntry",
+                        "write to snmpTargetParamsSecModel: bad length\n"));
+            return SNMP_ERR_WRONGLENGTH;
+        }
+        if (long_ret <= 0) {
+            DEBUGMSGTL(("snmpTargetParamsEntry",
+                        "write to snmpTargetParamsSecModel: secModel out of range\n"));
+            return SNMP_ERR_WRONGVALUE;
+        }
+        if (find_sec_mod(long_ret) == NULL && long_ret >= 3) {
+            DEBUGMSGTL(("snmpTargetParamsEntry",
+                        "write to snmpTargetParamsSecModel: secModel %d unsupported\n",
+                        long_ret));
+            return SNMP_ERR_INCONSISTENTVALUE;
+        }
+
+    } else if (action == RESERVE2) {
+        snmpTargetParamsOID[snmpTargetParamsOIDLen - 1] =
+            SNMPTARGETPARAMSSECURITYMODELCOLUMN;
+        params = search_snmpTargetParamsTable(snmpTargetParamsOID,
+                                              snmpTargetParamsOIDLen,
+                                              name, &name_len, 1);
+        if (params == NULL) {
+            DEBUGMSGTL(("snmpTargetParamsEntry",
+                        "write to snmpTargetParamsSecModel: BAD OID\n"));
+            return SNMP_ERR_INCONSISTENTNAME;
+        } else {
+            /*
+             * Row exists, check if it is changeable.  
+             */
+            if (params->storageType == SNMP_STORAGE_READONLY) {
+                DEBUGMSGTL(("snmpTargetParamsEntry",
+                            "write to snmpTargetParamSecModel: row is read only\n"));
+                return SNMP_ERR_NOTWRITABLE;
+            }
+            /*
+             * Check if row is active.  
+             */
+            if (params->rowStatus == SNMP_ROW_ACTIVE) {
+                DEBUGMSGTL(("snmpTargetParamsEntry",
+                            "write to snmpTargetParamsSecModel: this change not allowed in active row.\n"));
+                return SNMP_ERR_INCONSISTENTVALUE;
+            }
+
+            old_sec = params->secModel;
+            params->secModel = long_ret;
+
+            if (params->rowStatus == SNMP_ROW_NOTREADY &&
+                snmpTargetParams_rowStatusCheck(params)) {
+                params->rowStatus = SNMP_ROW_NOTINSERVICE;
+            }
+        }
+    } else if (action == COMMIT) {
+        snmpTargetParamsOID[snmpTargetParamsOIDLen - 1] =
+            SNMPTARGETPARAMSSECURITYMODELCOLUMN;
+        if ((params = search_snmpTargetParamsTable(snmpTargetParamsOID,
+                                                   snmpTargetParamsOIDLen,
+                                                   name, &name_len,
+                                                   1)) != NULL) {
+            update_timestamp(params);
+        }
+    } else if (action == FREE || action == UNDO) {
+        /*
+         * Try to undo the SET here (abnormal usage of FREE clause)  
+         */
+        snmpTargetParamsOID[snmpTargetParamsOIDLen - 1] =
+            SNMPTARGETPARAMSSECURITYMODELCOLUMN;
+        if ((params = search_snmpTargetParamsTable(snmpTargetParamsOID,
+                                                   snmpTargetParamsOIDLen,
+                                                   name, &name_len,
+                                                   1)) != NULL) {
+            if (params->storageType != SNMP_STORAGE_READONLY
+                && params->rowStatus != SNMP_ROW_ACTIVE) {
+                params->secModel = old_sec;
+                if (params->rowStatus == SNMP_ROW_NOTINSERVICE &&
+                    !snmpTargetParams_rowStatusCheck(params)) {
+                    params->rowStatus = SNMP_ROW_NOTREADY;
+                }
+            }
+        }
+    }
+
+    return SNMP_ERR_NOERROR;
+}                               /* write_snmpTargetParamsSecModel */
+
+/*
+ * Assign a value to the SecLevel variable.  
+ */
+int
+write_snmpTargetParamsSecLevel(int action,
+                               u_char * var_val,
+                               u_char var_val_type,
+                               size_t var_val_len,
+                               u_char * statP, oid * name, size_t name_len)
+{
+    long            long_ret = *((long *) var_val);
+    static long     old_level;
+    struct targetParamTable_struct *params = NULL;
+
+    if (action == RESERVE1) {
+        if (var_val_type != ASN_INTEGER) {
+            DEBUGMSGTL(("snmpTargetParamsEntry",
+                        "write to snmpTargetParamsSecLevel: not ASN_INTEGER\n"));
+            return SNMP_ERR_WRONGTYPE;
+        }
+        if (var_val_len != sizeof(long)) {
+            DEBUGMSGTL(("snmpTargetParamsEntry",
+                        "write to snmpTargetParamsSecLevel: bad length\n"));
+            return SNMP_ERR_WRONGLENGTH;
+        }
+        if (long_ret <= 0 || long_ret > 3) {
+            DEBUGMSGTL(("snmpTargetParamsEntry",
+                        "write to snmpTargetParamsSecLevel: security level is not noAuthNoPriv(1), authNopriv(2) or authPriv(3)\n"));
+            return SNMP_ERR_WRONGVALUE;
+        }
+    } else if (action == RESERVE2) {
+        snmpTargetParamsOID[snmpTargetParamsOIDLen - 1] =
+            SNMPTARGETPARAMSSECURITYLEVELCOLUMN;
+        params = search_snmpTargetParamsTable(snmpTargetParamsOID,
+                                              snmpTargetParamsOIDLen,
+                                              name, &name_len, 1);
+        if (params == NULL) {
+            DEBUGMSGTL(("snmpTargetParamsEntry",
+                        "write to snmpTargetParamsSecLevel: BAD OID\n"));
+            return SNMP_ERR_INCONSISTENTNAME;
+        } else {
+            /*
+             * Row exists, check if it is changeable.  
+             */
+            if (params->storageType == SNMP_STORAGE_READONLY) {
+                DEBUGMSGTL(("snmpTargetParamsEntry",
+                            "write to snmpTargetParamSecLevel: row is read only\n"));
+                return SNMP_ERR_NOTWRITABLE;
+            }
+            /*
+             * Check if row is active.  
+             */
+            if (params->rowStatus == SNMP_ROW_ACTIVE) {
+                DEBUGMSGTL(("snmpTargetParamsEntry",
+                            "write to snmpTargetParamsSecLevel: this change not allowed in active row.\n"));
+                return SNMP_ERR_INCONSISTENTVALUE;
+            }
+
+            old_level = params->secLevel;
+            params->secLevel = long_ret;
+
+            if (params->rowStatus == SNMP_ROW_NOTREADY &&
+                snmpTargetParams_rowStatusCheck(params)) {
+                params->rowStatus = SNMP_ROW_NOTINSERVICE;
+            }
+        }
+    } else if (action == COMMIT) {
+        snmpTargetParamsOID[snmpTargetParamsOIDLen - 1] =
+            SNMPTARGETPARAMSSECURITYLEVELCOLUMN;
+        if ((params = search_snmpTargetParamsTable(snmpTargetParamsOID,
+                                                   snmpTargetParamsOIDLen,
+                                                   name, &name_len,
+                                                   1)) != NULL) {
+            update_timestamp(params);
+        }
+    } else if (action == FREE || action == UNDO) {
+        /*
+         * Try to undo the SET here (abnormal usage of FREE clause)  
+         */
+        snmpTargetParamsOID[snmpTargetParamsOIDLen - 1] =
+            SNMPTARGETPARAMSSECURITYLEVELCOLUMN;
+        if ((params = search_snmpTargetParamsTable(snmpTargetParamsOID,
+                                                   snmpTargetParamsOIDLen,
+                                                   name, &name_len,
+                                                   1)) != NULL) {
+            if (params->storageType != SNMP_STORAGE_READONLY
+                && params->rowStatus != SNMP_ROW_ACTIVE) {
+                params->secLevel = old_level;
+                if (params->rowStatus == SNMP_ROW_NOTINSERVICE &&
+                    !snmpTargetParams_rowStatusCheck(params)) {
+                    params->rowStatus = SNMP_ROW_NOTREADY;
+                }
+            }
+        }
+    }
+
+    return SNMP_ERR_NOERROR;
+}                               /* write_snmpTargetParamsSecLevel */
+
+/*
+ * Assign a value to the storageType variable.  
+ */
+int
+write_snmpTargetParamsStorageType(int action,
+                                  u_char * var_val,
+                                  u_char var_val_type,
+                                  size_t var_val_len,
+                                  u_char * statP,
+                                  oid * name, size_t name_len)
+{
+    long            long_ret = *((long *) var_val);
+    static long     old_st;
+    struct targetParamTable_struct *params = NULL;
+
+    if (action == RESERVE1) {
+        if (var_val_type != ASN_INTEGER) {
+            DEBUGMSGTL(("snmpTargetParamsEntry",
+                        "write to snmpTargetParamsStorageType: not ASN_INTEGER\n"));
+            return SNMP_ERR_WRONGTYPE;
+        }
+        if (var_val_len != sizeof(long)) {
+            DEBUGMSGTL(("snmpTargetParamsEntry",
+                        "write to snmpTargetParamsStorageType: bad length\n"));
+            return SNMP_ERR_WRONGLENGTH;
+        }
+        if (long_ret != SNMP_STORAGE_OTHER &&
+            long_ret != SNMP_STORAGE_VOLATILE &&
+            long_ret != SNMP_STORAGE_NONVOLATILE) {
+            DEBUGMSGTL(("snmpTargetParamsEntry",
+                        "write to snmpTargetParamsStorageType: attempted storage type not a valid"));
+            DEBUGMSG(("snmpTargetParamsEntry",
+                      " value of other(%d), volatile(%d), or nonvolatile(%d)\n",
+                      SNMP_STORAGE_OTHER, SNMP_STORAGE_VOLATILE,
+                      SNMP_STORAGE_NONVOLATILE));
+            return SNMP_ERR_WRONGVALUE;
+        }
+    } else if (action == RESERVE2) {
+        snmpTargetParamsOID[snmpTargetParamsOIDLen - 1] =
+            SNMPTARGETPARAMSSTORAGETYPECOLUMN;
+        params = search_snmpTargetParamsTable(snmpTargetParamsOID,
+                                              snmpTargetParamsOIDLen,
+                                              name, &name_len, 1);
+        if (params == NULL) {
+            DEBUGMSGTL(("snmpTargetParamsEntry",
+                        "write to snmpTargetParamsStorageType: BAD OID\n"));
+            return SNMP_ERR_INCONSISTENTNAME;
+        } else {
+            /*
+             * Row exists, check if it is changeable.  
+             */
+            if (params->storageType == SNMP_STORAGE_READONLY ||
+                params->storageType == SNMP_STORAGE_PERMANENT) {
+                DEBUGMSGTL(("snmpTargetParamsEntry",
+                            "write to snmpTargetParamsStorageType: row has unchangeable storage status: %d\n",
+                            params->storageType));
+                return SNMP_ERR_INCONSISTENTVALUE;
+            }
+
+            old_st = params->storageType;
+            params->storageType = long_ret;
+        }
+    } else if (action == FREE || action == UNDO) {
+        /*
+         * Try to undo the SET here (abnormal usage of FREE clause)  
+         */
+        snmpTargetParamsOID[snmpTargetParamsOIDLen - 1] =
+            SNMPTARGETPARAMSSTORAGETYPECOLUMN;
+        if ((params = search_snmpTargetParamsTable(snmpTargetParamsOID,
+                                                   snmpTargetParamsOIDLen,
+                                                   name, &name_len,
+                                                   1)) != NULL) {
+            if (params->storageType != SNMP_STORAGE_READONLY
+                && params->storageType != SNMP_STORAGE_PERMANENT) {
+                params->storageType = old_st;
+            }
+        }
+    }
+
+    return SNMP_ERR_NOERROR;
+}                               /* write_snmpTargetParamsStorageType */
+
+/*
+ * Assign a value to the secName variable.  
+ */
+int
+write_snmpTargetParamsSecName(int action,
+                              u_char * var_val,
+                              u_char var_val_type,
+                              size_t var_val_len,
+                              u_char * statP, oid * name, size_t name_len)
+{
+    static char    *old_name;
+    struct targetParamTable_struct *params = NULL;
+
+    if (action == RESERVE1) {
+        if (var_val_type != ASN_OCTET_STR) {
+            DEBUGMSGTL(("snmpTargetParamsEntry",
+                        "write to snmpTargetParamsSecName: not ASN_OCTET_STR\n"));
+            return SNMP_ERR_WRONGTYPE;
+        }
+        if (var_val_len > 255 || var_val_len < 0) {
+            DEBUGMSGTL(("snmpTargetParamsEntry",
+                        "write to snmpTargetParamsSecName: bad length\n"));
+            return SNMP_ERR_WRONGLENGTH;
+        }
+    } else if (action == RESERVE2) {
+        snmpTargetParamsOID[snmpTargetParamsOIDLen - 1] =
+            SNMPTARGETPARAMSSECURITYNAMECOLUMN;
+        params = search_snmpTargetParamsTable(snmpTargetParamsOID,
+                                              snmpTargetParamsOIDLen,
+                                              name, &name_len, 1);
+        if (params == NULL) {
+            DEBUGMSGTL(("snmpTargetParamsEntry",
+                        "write to snmpTargetParamsSecName: BAD OID\n"));
+            return SNMP_ERR_INCONSISTENTNAME;
+        } else {
+            /*
+             * Row exists, check if it is changeable.  
+             */
+            if (params->storageType == SNMP_STORAGE_READONLY) {
+                DEBUGMSGTL(("snmpTargetParamsEntry",
+                            "write to snmpTargetParamSecName: row is read only\n"));
+                return SNMP_ERR_NOTWRITABLE;
+            }
+            /*
+             * Check if row is active.  
+             */
+            if (params->rowStatus == SNMP_ROW_ACTIVE) {
+                DEBUGMSGTL(("snmpTargetParamsEntry",
+                            "write to snmpTargetParamsSecName: this change not allowed in active row.\n"));
+                return SNMP_ERR_INCONSISTENTVALUE;
+            }
+
+            old_name = params->secName;
+            params->secName = (char *) malloc(var_val_len + 1);
+            if (params->secName == NULL) {
+                return SNMP_ERR_RESOURCEUNAVAILABLE;
+            }
+            memcpy(params->secName, var_val, var_val_len);
+            params->secName[var_val_len] = '\0';
+
+            if (params->rowStatus == SNMP_ROW_NOTREADY &&
+                snmpTargetParams_rowStatusCheck(params)) {
+                params->rowStatus = SNMP_ROW_NOTINSERVICE;
+            }
+        }
+    } else if (action == COMMIT) {
+        snmpTargetParamsOID[snmpTargetParamsOIDLen - 1] =
+            SNMPTARGETPARAMSSECURITYNAMECOLUMN;
+        if ((params = search_snmpTargetParamsTable(snmpTargetParamsOID,
+                                                   snmpTargetParamsOIDLen,
+                                                   name, &name_len,
+                                                   1)) != NULL) {
+            update_timestamp(params);
+            SNMP_FREE(old_name);
+            old_name = NULL;
+        }
+    } else if (action == FREE || action == UNDO) {
+        /*
+         * Try to undo the SET here (abnormal usage of FREE clause)  
+         */
+        snmpTargetParamsOID[snmpTargetParamsOIDLen - 1] =
+            SNMPTARGETPARAMSSECURITYNAMECOLUMN;
+        if ((params = search_snmpTargetParamsTable(snmpTargetParamsOID,
+                                                   snmpTargetParamsOIDLen,
+                                                   name, &name_len,
+                                                   1)) != NULL) {
+            if (params->storageType != SNMP_STORAGE_READONLY
+                && params->rowStatus != SNMP_ROW_ACTIVE) {
+                SNMP_FREE(params->secName);
+                params->secName = old_name;
+                if (params->rowStatus == SNMP_ROW_NOTINSERVICE &&
+                    !snmpTargetParams_rowStatusCheck(params)) {
+                    params->rowStatus = SNMP_ROW_NOTREADY;
+                }
+            }
+        }
+    }
+
+    return SNMP_ERR_NOERROR;
+}                               /* write_snmpTargetParamsSecName */
+
+/*
+ * snmpTargeParams_createNewRow is called from write_snmpTargetParamsRowStatus
+ * when a new row is required. It creates a new row with 
+ * the index of the passed in 'name' (i.e. full index OID) and
+ * adds it to the linked list. 'name' should be the full OID of the new index. 
+ * It passes back 0 if unsuccessfull.
+ */
+int
+snmpTargetParams_createNewRow(oid * name, size_t name_len)
+{
+    int             pNameLen, i;
+    struct targetParamTable_struct *temp_struct;
+
+    /*
+     * setup a new snmpTargetParamTable structure and add it to the list 
+     */
+    pNameLen = name_len - snmpTargetParamsOIDLen;
+    if (pNameLen > 0) {
+        temp_struct = snmpTargetParamTable_create();
+        temp_struct->paramName = (char *) malloc(pNameLen + 1);
+
+        for (i = 0; i < pNameLen; i++) {
+            temp_struct->paramName[i] =
+                (char) name[i + snmpTargetParamsOIDLen];
+        }
+
+        temp_struct->paramName[pNameLen] = '\0';
+        temp_struct->rowStatus = SNMP_ROW_NOTREADY;
+
+        update_timestamp(temp_struct);
+        snmpTargetParamTable_addToList(temp_struct, &aPTable);
+
+        return 1;
+    }
+
+    return 0;
+}                               /* snmpTargetParams_createNewRow */
+
+/*
+ * Assign a value to the Row Status variable 
+ */
+int
+write_snmpTargetParamsRowStatus(int action,
+                                u_char * var_val,
+                                u_char var_val_type,
+                                size_t var_val_len,
+                                u_char * statP,
+                                oid * name, size_t name_len)
+{
+    static long     value;
+    struct targetParamTable_struct *params = NULL;
+
+    if (action == RESERVE1) {
+        if (var_val_type != ASN_INTEGER) {
+            DEBUGMSGTL(("snmpTargetParamsEntry",
+                        "write to snmpTargetParamsRowStatus not ASN_INTEGER\n"));
+            return SNMP_ERR_WRONGTYPE;
+        }
+        if (var_val_len != sizeof(long)) {
+            DEBUGMSGTL(("snmpTargetParamsEntry",
+                        "write to snmpTargetParamsRowStatus: bad length\n"));
+            return SNMP_ERR_WRONGLENGTH;
+        }
+        value = *((long *) var_val);
+        if (value == SNMP_ROW_NOTREADY || value < 1 || value > 6) {
+            return SNMP_ERR_WRONGVALUE;
+        }
+
+        /*
+         * Check index value is reasonable.  
+         */
+
+        if (name_len < snmpTargetParamsOIDLen + 1 ||
+            name_len > snmpTargetParamsOIDLen + 32) {
+            DEBUGMSGTL(("snmpTargetParamsEntry", "bad index length %d\n",
+                        name_len - snmpTargetParamsOIDLen));
+            return SNMP_ERR_NOCREATION;
+        }
+
+        snmpTargetParamsOID[snmpTargetParamsOIDLen - 1] =
+            SNMPTARGETPARAMSROWSTATUSCOLUMN;
+        params = search_snmpTargetParamsTable(snmpTargetParamsOID,
+                                              snmpTargetParamsOIDLen,
+                                              name, &name_len, 1);
+        if (params != NULL) {
+            if (value == SNMP_ROW_CREATEANDGO
+                || value == SNMP_ROW_CREATEANDWAIT) {
+                value = SNMP_ROW_NOTREADY;
+                return SNMP_ERR_INCONSISTENTVALUE;
+            }
+            if (params->storageType == SNMP_STORAGE_READONLY) {
+                DEBUGMSGTL(("snmpTargetParamsEntry",
+                            "row is read only\n"));
+                return SNMP_ERR_NOTWRITABLE;
+            }
+            if (params->storageType == SNMP_STORAGE_PERMANENT) {
+                if (value == SNMP_ROW_DESTROY) {
+                    DEBUGMSGTL(("snmpTargetParamsEntry",
+                                "unable to destroy permanent row\n"));
+                    return SNMP_ERR_INCONSISTENTVALUE;
+                }
+            }
+        } else {
+            if (value == SNMP_ROW_ACTIVE || value == SNMP_ROW_NOTINSERVICE) {
+                return SNMP_ERR_INCONSISTENTVALUE;
+            }
+            if (value == SNMP_ROW_CREATEANDGO
+                || value == SNMP_ROW_CREATEANDWAIT) {
+                if (snmpTargetParams_createNewRow(name, name_len) == 0) {
+                    DEBUGMSGTL(("snmpTargetParamsEntry",
+                                "couldn't malloc() new row\n"));
+                    return SNMP_ERR_RESOURCEUNAVAILABLE;
+                }
+            }
+        }
+    } else if (action == ACTION) {
+        snmpTargetParamsOID[snmpTargetParamsOIDLen - 1] =
+            SNMPTARGETPARAMSROWSTATUSCOLUMN;
+        params = search_snmpTargetParamsTable(snmpTargetParamsOID,
+                                              snmpTargetParamsOIDLen,
+                                              name, &name_len, 1);
+        if (params != NULL) {
+            if (value == SNMP_ROW_CREATEANDGO) {
+                /*
+                 * Check whether all the required objects have been set.  
+                 */
+                if (snmpTargetParams_rowStatusCheck(params)) {
+                    params->rowStatus = SNMP_ROW_ACTIVE;
+                } else {
+                    params->rowStatus = SNMP_ROW_NOTREADY;
+                }
+            } else if (value == SNMP_ROW_CREATEANDWAIT) {
+                /*
+                 * Check whether all the required objects have been set.  
+                 */
+                if (snmpTargetParams_rowStatusCheck(params)) {
+                    params->rowStatus = SNMP_ROW_NOTINSERVICE;
+                } else {
+                    params->rowStatus = SNMP_ROW_NOTREADY;
+                }
+            } else if (value == SNMP_ROW_ACTIVE) {
+                if (params->rowStatus == SNMP_ROW_NOTINSERVICE) {
+                    params->rowStatus = SNMP_ROW_ACTIVE;
+                } else if (params->rowStatus == SNMP_ROW_NOTREADY) {
+                    return SNMP_ERR_INCONSISTENTVALUE;
+                }
+            } else if (value == SNMP_ROW_NOTINSERVICE) {
+                if (params->rowStatus == SNMP_ROW_ACTIVE) {
+                    params->rowStatus = SNMP_ROW_NOTINSERVICE;
+                } else if (params->rowStatus == SNMP_ROW_NOTREADY) {
+                    return SNMP_ERR_INCONSISTENTVALUE;
+                }
+            }
+        }
+    } else if (action == COMMIT) {
+        snmpTargetParamsOID[snmpTargetParamsOIDLen - 1] =
+            SNMPTARGETPARAMSROWSTATUSCOLUMN;
+        params = search_snmpTargetParamsTable(snmpTargetParamsOID,
+                                              snmpTargetParamsOIDLen,
+                                              name, &name_len, 1);
+        if (params != NULL) {
+            if (value == SNMP_ROW_DESTROY) {
+                snmpTargetParamTable_remFromList(params, &aPTable);
+            }
+            if (value == SNMP_ROW_ACTIVE || value == SNMP_ROW_NOTINSERVICE) {
+                update_timestamp(params);
+            }
+        }
+    } else if (action == UNDO || action == FREE) {
+        snmpTargetParamsOID[snmpTargetParamsOIDLen - 1] =
+            SNMPTARGETPARAMSROWSTATUSCOLUMN;
+        params = search_snmpTargetParamsTable(snmpTargetParamsOID,
+                                              snmpTargetParamsOIDLen,
+                                              name, &name_len, 1);
+        if (value == SNMP_ROW_CREATEANDGO
+            || value == SNMP_ROW_CREATEANDWAIT) {
+            if (params != NULL) {
+                snmpTargetParamTable_remFromList(params, &aPTable);
+            }
+        }
+    }
+    return SNMP_ERR_NOERROR;
+}
+
+struct targetParamTable_struct *
+get_paramEntry(char *name)
+{
+    static struct targetParamTable_struct *ptr;
+    for (ptr = aPTable; ptr; ptr = ptr->next) {
+        if (strcmp(ptr->paramName, name) == 0) {
+            return ptr;
+        }
+    }
+    return NULL;
+}
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/target/snmpTargetParamsEntry.h tomato121/release/src/router/snmp/agent/mibgroup/target/snmpTargetParamsEntry.h
--- tomato/release/src/router/snmp/agent/mibgroup/target/snmpTargetParamsEntry.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/target/snmpTargetParamsEntry.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,77 @@
+
+/*
+ * This file was generated by mib2c and is intended for use as a mib module
+ * for the ucd-snmp snmpd agent. Edited by Michael Baer
+ * 
+ * last changed 2/2/99.
+ */
+
+#ifndef _MIBGROUP_SNMPTARGETPARAMSENTRY_H
+#define _MIBGROUP_SNMPTARGETPARAMSENTRY_H
+
+/*
+ * we use header_generic and checkmib from the util_funcs module 
+ */
+
+config_require(util_funcs)
+
+    /*
+     * Magic number definitions: 
+     */
+#define   SNMPTARGETPARAMSMPMODEL        1
+#define   SNMPTARGETPARAMSSECURITYMODEL  2
+#define   SNMPTARGETPARAMSSECURITYNAME   3
+#define   SNMPTARGETPARAMSSECURITYLEVEL  4
+#define   SNMPTARGETPARAMSSTORAGETYPE    5
+#define   SNMPTARGETPARAMSROWSTATUS      6
+#define   SNMPTARGETPARAMSMPMODELCOLUMN        2
+#define   SNMPTARGETPARAMSSECURITYMODELCOLUMN  3
+#define   SNMPTARGETPARAMSSECURITYNAMECOLUMN   4
+#define   SNMPTARGETPARAMSSECURITYLEVELCOLUMN  5
+#define   SNMPTARGETPARAMSSTORAGETYPECOLUMN    6
+#define   SNMPTARGETPARAMSROWSTATUSCOLUMN      7
+    /*
+     * structure definitions 
+     */
+     struct targetParamTable_struct {
+         char           *paramName;
+         int             mpModel;
+         int             secModel;
+         char           *secName;
+         int             secLevel;
+         int             storageType;
+         int             rowStatus;
+         struct targetParamTable_struct *next;
+         time_t          updateTime;
+     };
+
+/*
+ * utility functions 
+ */
+     struct targetParamTable_struct *get_paramEntry(char *name);
+     void            snmpTargetParamTable_add(struct
+                                              targetParamTable_struct
+                                              *newEntry);
+     struct targetParamTable_struct *snmpTargetParamTable_create(void);
+
+/*
+ * function definitions 
+ */
+
+     void            init_snmpTargetParamsEntry(void);
+     int             store_snmpTargetParamsEntry(int majorID, int minorID,
+                                                 void *serverarg,
+                                                 void *clientarg);
+     extern FindVarMethod var_snmpTargetParamsEntry;
+
+     void            snmpd_parse_config_targetParams(const char *, char *);
+
+     WriteMethod     write_snmpTargetParamsMPModel;
+     WriteMethod     write_snmpTargetParamsSecModel;
+     WriteMethod     write_snmpTargetParamsSecName;
+     WriteMethod     write_snmpTargetParamsSecLevel;
+     WriteMethod     write_snmpTargetParamsStorageType;
+     WriteMethod     write_snmpTargetParamsRowStatus;
+
+
+#endif                          /* _MIBGROUP_SNMPTARGETPARAMSENTRY_H */
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/target/target.c tomato121/release/src/router/snmp/agent/mibgroup/target/target.c
--- tomato/release/src/router/snmp/agent/mibgroup/target/target.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/target/target.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,204 @@
+#include <net-snmp/net-snmp-config.h>
+
+#if HAVE_WINSOCK_H
+#include <winsock.h>
+#endif
+#if HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+#include "snmpTargetAddrEntry.h"
+#include "snmpTargetParamsEntry.h"
+#include "target.h"
+
+#define MAX_TAGS 128
+
+netsnmp_session *
+get_target_sessions(char *taglist, TargetFilterFunction * filterfunct,
+                    void *filterArg)
+{
+    netsnmp_session *ret = NULL, thissess;
+    struct targetAddrTable_struct *targaddrs;
+    char            buf[SPRINT_MAX_LEN];
+    char            tags[MAX_TAGS][SPRINT_MAX_LEN], *cp;
+    int             numtags = 0, i;
+    static struct targetParamTable_struct *param;
+
+    DEBUGMSGTL(("target_sessions", "looking for: %s\n", taglist));
+    for (cp = taglist; cp && numtags < MAX_TAGS;) {
+        cp = copy_nword(cp, tags[numtags], sizeof(tags[numtags]));
+        DEBUGMSGTL(("target_sessions", " for: %d=%s\n", numtags,
+                    tags[numtags]));
+        numtags++;
+    }
+
+    for (targaddrs = get_addrTable(); targaddrs;
+         targaddrs = targaddrs->next) {
+
+        /*
+         * legal row? 
+         */
+        if (targaddrs->tDomain == NULL ||
+            targaddrs->tAddress == NULL ||
+            targaddrs->rowStatus != SNMP_ROW_ACTIVE) {
+            DEBUGMSGTL(("target_sessions", "  which is not ready yet\n"));
+            continue;
+        }
+
+        if (netsnmp_tdomain_support
+            (targaddrs->tDomain, targaddrs->tDomainLen, NULL, NULL) == 0) {
+            snmp_log(LOG_ERR,
+                     "unsupported domain for target address table entry %s\n",
+                     targaddrs->name);
+        }
+
+        /*
+         * check tag list to see if we match 
+         */
+        if (targaddrs->tagList) {
+            /*
+             * loop through tag list looking for requested tags 
+             */
+            for (cp = targaddrs->tagList; cp;) {
+                cp = copy_nword(cp, buf, sizeof(buf));
+                for (i = 0; i < numtags; i++) {
+                    if (strcmp(buf, tags[i]) == 0) {
+                        /*
+                         * found a valid target table entry 
+                         */
+                        DEBUGMSGTL(("target_sessions", "found one: %s\n",
+                                    tags[i]));
+
+                        if (targaddrs->params) {
+                            param = get_paramEntry(targaddrs->params);
+                            if (!param
+                                || param->rowStatus != SNMP_ROW_ACTIVE) {
+                                /*
+                                 * parameter entry must exist and be active 
+                                 */
+                                continue;
+                            }
+                        } else {
+                            /*
+                             * parameter entry must be specified 
+                             */
+                            continue;
+                        }
+
+                        /*
+                         * last chance for caller to opt-out.  Call
+                         * filtering function 
+                         */
+                        if (filterfunct &&
+                            (*(filterfunct)) (targaddrs, param,
+                                              filterArg)) {
+                            continue;
+                        }
+
+                        if (targaddrs->storageType != ST_READONLY &&
+                            targaddrs->sess &&
+                            param->updateTime >=
+                            targaddrs->sessionCreationTime) {
+                            /*
+                             * parameters have changed, nuke the old session 
+                             */
+                            snmp_close(targaddrs->sess);
+                            targaddrs->sess = NULL;
+                        }
+
+                        /*
+                         * target session already exists? 
+                         */
+                        if (targaddrs->sess == NULL) {
+                            /*
+                             * create an appropriate snmp session and add
+                             * it to our return list 
+                             */
+                            netsnmp_transport *t = NULL;
+
+                            t = netsnmp_tdomain_transport_oid(targaddrs->
+                                                              tDomain,
+                                                              targaddrs->
+                                                              tDomainLen,
+                                                              targaddrs->
+                                                              tAddress,
+                                                              targaddrs->
+                                                              tAddressLen,
+                                                              0);
+                            if (t == NULL) {
+                                DEBUGMSGTL(("target_sessions",
+                                            "bad dest \""));
+                                DEBUGMSGOID(("target_sessions",
+                                             targaddrs->tDomain,
+                                             targaddrs->tDomainLen));
+                                DEBUGMSG(("target_sessions", "\", \""));
+                                DEBUGMSGHEX(("target_sessions",
+                                             targaddrs->tAddress,
+                                             targaddrs->tAddressLen));
+                                DEBUGMSG(("target_sessions", "\n"));
+                                continue;
+                            } else {
+                                char           *dst_str =
+                                    t->f_fmtaddr(t, NULL, 0);
+                                if (dst_str != NULL) {
+                                    DEBUGMSGTL(("target_sessions",
+                                                "  to: %s\n", dst_str));
+                                    free(dst_str);
+                                }
+                            }
+                            memset(&thissess, 0, sizeof(thissess));
+                            thissess.timeout = (targaddrs->timeout) * 1000;
+                            thissess.retries = targaddrs->retryCount;
+                            DEBUGMSGTL(("target_sessions",
+                                        "timeout: %d -> %d\n",
+                                        targaddrs->timeout,
+                                        thissess.timeout));
+
+                            if (param->mpModel == SNMP_VERSION_3 &&
+                                param->secModel != 3) {
+                                snmp_log(LOG_ERR,
+                                         "unsupported model/secmodel combo for target %s\n",
+                                         targaddrs->name);
+                                /*
+                                 * XXX: memleak 
+                                 */
+                                netsnmp_transport_free(t);
+                                continue;
+                            }
+                            thissess.version = param->mpModel;
+                            if (param->mpModel == SNMP_VERSION_3) {
+                                thissess.securityName = param->secName;
+                                thissess.securityNameLen =
+                                    strlen(thissess.securityName);
+                                thissess.securityLevel = param->secLevel;
+                            } else {
+                                thissess.community =
+                                    (u_char *) strdup(param->secName);
+                                thissess.community_len =
+                                    strlen((char *) thissess.community);
+                            }
+
+                            targaddrs->sess = snmp_add(&thissess, t,
+                                                       NULL, NULL);
+                            targaddrs->sessionCreationTime = time(NULL);
+                        }
+                        if (targaddrs->sess) {
+                            if (ret) {
+                                targaddrs->sess->next = ret;
+                            }
+                            ret = targaddrs->sess;
+                        } else {
+                            snmp_sess_perror("target session", &thissess);
+                        }
+                    }
+                }
+            }
+        }
+    }
+    return ret;
+}
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/target/target_counters.c tomato121/release/src/router/snmp/agent/mibgroup/target/target_counters.c
--- tomato/release/src/router/snmp/agent/mibgroup/target/target_counters.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/target/target_counters.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,81 @@
+#include <net-snmp/net-snmp-config.h>
+
+#if HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+#include "target_counters.h"
+#include <net-snmp/agent/instance.h>
+
+static oid      unavailable_context_oid[] =
+    { 1, 3, 6, 1, 6, 3, 12, 1, 4, 0 };
+static oid      unknown_context_oid[] = { 1, 3, 6, 1, 6, 3, 12, 1, 5, 0 };
+
+void
+init_target_counters(void)
+{
+    DEBUGMSGTL(("target_counters", "initializing\n"));
+
+    /*
+     * unknown contexts
+     */
+
+    netsnmp_register_read_only_instance(netsnmp_create_handler_registration
+                                        ("myInstance",
+                                         get_unknown_context_count,
+                                         unknown_context_oid,
+                                         sizeof(unknown_context_oid) /
+                                         sizeof(oid), HANDLER_CAN_RONLY));
+
+    /*
+     * unavailable available
+     */
+
+    netsnmp_register_read_only_instance(netsnmp_create_handler_registration
+                                        ("myInstance",
+                                         get_unavailable_context_count,
+                                         unavailable_context_oid,
+                                         sizeof(unavailable_context_oid) /
+                                         sizeof(oid), HANDLER_CAN_RONLY));
+
+}
+
+int
+get_unknown_context_count(netsnmp_mib_handler *handler,
+                          netsnmp_handler_registration *reginfo,
+                          netsnmp_agent_request_info *reqinfo,
+                          netsnmp_request_info *requests)
+{
+    /*
+     * we're only called for GETs of the right node, so this is easy: 
+     */
+
+    u_long          long_ret =
+        snmp_get_statistic(STAT_SNMPUNKNOWNCONTEXTS);
+    snmp_set_var_typed_value(requests->requestvb, ASN_COUNTER,
+                             (u_char *) & long_ret, sizeof(long_ret));
+    return SNMP_ERR_NOERROR;
+}
+
+
+int
+get_unavailable_context_count(netsnmp_mib_handler *handler,
+                              netsnmp_handler_registration *reginfo,
+                              netsnmp_agent_request_info *reqinfo,
+                              netsnmp_request_info *requests)
+{
+    /*
+     * we're only called for GETs of the right node, so this is easy: 
+     */
+
+    u_long          long_ret =
+        snmp_get_statistic(STAT_SNMPUNAVAILABLECONTEXTS);
+    snmp_set_var_typed_value(requests->requestvb, ASN_COUNTER,
+                             (u_char *) & long_ret, sizeof(long_ret));
+    return SNMP_ERR_NOERROR;
+}
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/target/target_counters.h tomato121/release/src/router/snmp/agent/mibgroup/target/target_counters.h
--- tomato/release/src/router/snmp/agent/mibgroup/target/target_counters.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/target/target_counters.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,7 @@
+/*
+ * testhandler.h 
+ */
+
+void            init_target_counters(void);
+Netsnmp_Node_Handler get_unavailable_context_count;
+Netsnmp_Node_Handler get_unknown_context_count;
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/target/target.h tomato121/release/src/router/snmp/agent/mibgroup/target/target.h
--- tomato/release/src/router/snmp/agent/mibgroup/target/target.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/target/target.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,24 @@
+#ifndef SNMP_TARGET_H
+#define SNMP_TARGET_H
+
+/*
+ * optional filtering function.  Return either TARGET_SKIP or TARGET_KEEP 
+ */
+typedef int     (TargetFilterFunction) (struct targetAddrTable_struct *
+                                        targaddrs,
+                                        struct targetParamTable_struct *
+                                        param, void *);
+#define TARGET_KEEP 0
+#define TARGET_SKIP 1
+
+
+/*
+ * utility functions 
+ */
+
+netsnmp_session *get_target_sessions(char *taglist, TargetFilterFunction *,
+                                     void *filterArg);
+
+config_require(target/snmpTargetAddrEntry target/snmpTargetParamsEntry)
+
+#endif                          /* SNMP_TARGET_H */
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/target.h tomato121/release/src/router/snmp/agent/mibgroup/target.h
--- tomato/release/src/router/snmp/agent/mibgroup/target.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/target.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,5 @@
+config_require(target/snmpTargetAddrEntry)
+config_require(target/snmpTargetParamsEntry)
+config_require(target/target)
+config_require(target/target_counters)
+config_add_mib(SNMP-TARGET-MIB)
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/testhandler.c tomato121/release/src/router/snmp/agent/mibgroup/testhandler.c
--- tomato/release/src/router/snmp/agent/mibgroup/testhandler.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/testhandler.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,425 @@
+#include <net-snmp/net-snmp-config.h>
+
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#if HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+#include "testhandler.h"
+
+#include <net-snmp/agent/table.h>
+#include <net-snmp/agent/instance.h>
+#include <net-snmp/agent/table_data.h>
+#include <net-snmp/agent/table_dataset.h>
+
+static oid      my_test_oid[4] = { 1, 2, 3, 4 };
+static oid      my_table_oid[4] = { 1, 2, 3, 5 };
+static oid      my_instance_oid[5] = { 1, 2, 3, 6, 1 };
+static oid      my_data_table_oid[4] = { 1, 2, 3, 7 };
+static oid      my_data_table_set_oid[4] = { 1, 2, 3, 8 };
+static oid      my_data_ulong_instance[4] = { 1, 2, 3, 9 };
+
+u_long          my_ulong = 0;
+
+void
+init_testhandler(void)
+{
+    /*
+     * we're registering at .1.2.3.4 
+     */
+    netsnmp_handler_registration *my_test;
+    netsnmp_table_registration_info *table_info;
+    u_long          ind1;
+    netsnmp_table_data *table;
+    netsnmp_table_data_set *table_set;
+    netsnmp_table_row *row;
+
+    DEBUGMSGTL(("testhandler", "initializing\n"));
+
+    /*
+     * basic handler test
+     */
+    netsnmp_register_handler(netsnmp_create_handler_registration
+                             ("myTest", my_test_handler, my_test_oid, 4,
+                              HANDLER_CAN_RONLY));
+
+    /*
+     * instance handler test
+     */
+
+    netsnmp_register_instance(netsnmp_create_handler_registration
+                              ("myInstance", my_test_instance_handler,
+                               my_instance_oid, 5, HANDLER_CAN_RWRITE));
+
+    netsnmp_register_ulong_instance("myulong",
+                                    my_data_ulong_instance, 4,
+                                    &my_ulong, NULL);
+
+    /*
+     * table helper test
+     */
+
+    my_test = netsnmp_create_handler_registration("myTable",
+                                                  my_test_table_handler,
+                                                  my_table_oid, 4,
+                                                  HANDLER_CAN_RONLY);
+    if (!my_test)
+        return;
+
+    table_info = SNMP_MALLOC_TYPEDEF(netsnmp_table_registration_info);
+
+    netsnmp_table_helper_add_indexes(table_info, ASN_INTEGER, ASN_INTEGER,
+                                     0);
+    table_info->min_column = 3;
+    table_info->max_column = 3;
+    netsnmp_register_table(my_test, table_info);
+
+    /*
+     * data table helper test
+     */
+    /*
+     * we'll construct a simple table here with two indexes: an
+     * integer and a string (why not).  It'll contain only one
+     * column so the data pointer is merely the data in that
+     * column. 
+     */
+
+    table = netsnmp_create_table_data("data_table_test");
+
+    netsnmp_table_data_add_index(table, ASN_INTEGER);
+    netsnmp_table_data_add_index(table, ASN_OCTET_STR);
+
+    /*
+     * 1 partridge in a pear tree 
+     */
+    row = netsnmp_create_table_data_row();
+    ind1 = 1;
+    netsnmp_table_row_add_index(row, ASN_INTEGER, &ind1, sizeof(ind1));
+    netsnmp_table_row_add_index(row, ASN_OCTET_STR, "partridge",
+                                strlen("partridge"));
+    row->data = (void *) "pear tree";
+    netsnmp_table_data_add_row(table, row);
+
+    /*
+     * 2 turtle doves 
+     */
+    row = netsnmp_create_table_data_row();
+    ind1 = 2;
+    netsnmp_table_row_add_index(row, ASN_INTEGER, &ind1, sizeof(ind1));
+    netsnmp_table_row_add_index(row, ASN_OCTET_STR, "turtle",
+                                strlen("turtle"));
+    row->data = (void *) "doves";
+    netsnmp_table_data_add_row(table, row);
+
+    /*
+     * we're going to register it as a normal table too, so we get the
+     * automatically parsed column and index information 
+     */
+    table_info = SNMP_MALLOC_TYPEDEF(netsnmp_table_registration_info);
+
+    netsnmp_table_helper_add_indexes(table_info, ASN_INTEGER,
+                                     ASN_OCTET_STR, 0);
+    table_info->min_column = 3;
+    table_info->max_column = 3;
+
+    netsnmp_register_read_only_table_data
+        (netsnmp_create_handler_registration
+         ("12days", my_data_table_handler, my_data_table_oid, 4,
+          HANDLER_CAN_RONLY), table, table_info);
+
+}
+
+int
+my_test_handler(netsnmp_mib_handler *handler,
+                netsnmp_handler_registration *reginfo,
+                netsnmp_agent_request_info *reqinfo,
+                netsnmp_request_info *requests)
+{
+
+    oid             myoid1[] = { 1, 2, 3, 4, 5, 6 };
+    static u_long   accesses = 0;
+
+    DEBUGMSGTL(("testhandler", "Got request:\n"));
+    /*
+     * loop through requests 
+     */
+    while (requests) {
+        netsnmp_variable_list *var = requests->requestvb;
+
+        DEBUGMSGTL(("testhandler", "  oid:"));
+        DEBUGMSGOID(("testhandler", var->name, var->name_length));
+        DEBUGMSG(("testhandler", "\n"));
+
+        switch (reqinfo->mode) {
+        case MODE_GET:
+            if (netsnmp_oid_equals(var->name, var->name_length, myoid1, 6)
+                == 0) {
+                snmp_set_var_typed_value(var, ASN_INTEGER,
+                                         (u_char *) & accesses,
+                                         sizeof(accesses));
+                return SNMP_ERR_NOERROR;
+            }
+            break;
+
+        case MODE_GETNEXT:
+            if (snmp_oid_compare(var->name, var->name_length, myoid1, 6)
+                < 0) {
+                snmp_set_var_objid(var, myoid1, 6);
+                snmp_set_var_typed_value(var, ASN_INTEGER,
+                                         (u_char *) & accesses,
+                                         sizeof(accesses));
+                return SNMP_ERR_NOERROR;
+            }
+            break;
+
+        default:
+            netsnmp_set_request_error(reqinfo, requests, SNMP_ERR_GENERR);
+            break;
+        }
+
+        requests = requests->next;
+    }
+    return SNMP_ERR_NOERROR;
+}
+
+/*
+ * functionally this is a simply a multiplication table for 12x12
+ */
+
+#define MAX_COLONE 12
+#define MAX_COLTWO 12
+#define RESULT_COLUMN 3
+int
+my_test_table_handler(netsnmp_mib_handler *handler,
+                      netsnmp_handler_registration *reginfo,
+                      netsnmp_agent_request_info *reqinfo,
+                      netsnmp_request_info *requests)
+{
+
+    netsnmp_table_registration_info
+     
+        
+        
+        
+        
+        
+        
+        
+        
+        
+        
+        
+        
+        
+        *handler_reg_info =
+        (netsnmp_table_registration_info *) handler->prev->myvoid;
+    netsnmp_table_request_info *table_info;
+    u_long          result;
+    int             x, y;
+
+
+    while (requests) {
+        netsnmp_variable_list *var = requests->requestvb;
+
+        if (requests->processed != 0)
+            continue;
+
+        DEBUGMSGTL(("testhandler_table", "Got request:\n"));
+        DEBUGMSGTL(("testhandler_table", "  oid:"));
+        DEBUGMSGOID(("testhandler_table", var->name, var->name_length));
+        DEBUGMSG(("testhandler_table", "\n"));
+
+        table_info = netsnmp_extract_table_info(requests);
+        if (table_info == NULL) {
+            requests = requests->next;
+            continue;
+        }
+
+        switch (reqinfo->mode) {
+        case MODE_GETNEXT:
+            /*
+             * beyond our search range? 
+             */
+            if (table_info->colnum > RESULT_COLUMN)
+                break;
+
+            /*
+             * below our minimum column? 
+             */
+            if (table_info->colnum < RESULT_COLUMN ||
+                /*
+                 * or no index specified 
+                 */
+                table_info->indexes->val.integer == 0) {
+                table_info->colnum = RESULT_COLUMN;
+                x = 0;
+                y = 0;
+            } else {
+                x = *(table_info->indexes->val.integer);
+                y = *(table_info->indexes->next_variable->val.integer);
+            }
+
+            if (table_info->number_indexes ==
+                handler_reg_info->number_indexes) {
+                y++;            /* GETNEXT is basically just y+1 for this table */
+                if (y > MAX_COLTWO) {   /* (with wrapping) */
+                    y = 0;
+                    x++;
+                }
+            }
+            if (x <= MAX_COLONE) {
+                result = x * y;
+
+                *(table_info->indexes->val.integer) = x;
+                *(table_info->indexes->next_variable->val.integer) = y;
+                netsnmp_table_build_result(reginfo, requests,
+                                           table_info, ASN_INTEGER,
+                                           (u_char *) & result,
+                                           sizeof(result));
+            }
+
+            break;
+
+        case MODE_GET:
+            if (var->type == ASN_NULL) {        /* valid request if ASN_NULL */
+                /*
+                 * is it the right column? 
+                 */
+                if (table_info->colnum == RESULT_COLUMN &&
+                    /*
+                     * and within the max boundries? 
+                     */
+                    *(table_info->indexes->val.integer) <= MAX_COLONE &&
+                    *(table_info->indexes->next_variable->val.integer)
+                    <= MAX_COLTWO) {
+
+                    /*
+                     * then, the result is column1 * column2 
+                     */
+                    result = *(table_info->indexes->val.integer) *
+                        *(table_info->indexes->next_variable->val.integer);
+                    snmp_set_var_typed_value(var, ASN_INTEGER,
+                                             (u_char *) & result,
+                                             sizeof(result));
+                }
+            }
+            break;
+
+        }
+
+        requests = requests->next;
+    }
+
+    return SNMP_ERR_NOERROR;
+}
+
+#define TESTHANDLER_SET_NAME "my_test"
+int
+my_test_instance_handler(netsnmp_mib_handler *handler,
+                         netsnmp_handler_registration *reginfo,
+                         netsnmp_agent_request_info *reqinfo,
+                         netsnmp_request_info *requests)
+{
+
+    static u_long   accesses = 0;
+    u_long         *accesses_cache = NULL;
+
+    DEBUGMSGTL(("testhandler", "Got instance request:\n"));
+
+    switch (reqinfo->mode) {
+    case MODE_GET:
+        snmp_set_var_typed_value(requests->requestvb, ASN_UNSIGNED,
+                                 (u_char *) & accesses, sizeof(accesses));
+        break;
+
+    case MODE_SET_RESERVE1:
+        if (requests->requestvb->type != ASN_UNSIGNED)
+            netsnmp_set_request_error(reqinfo, requests,
+                                      SNMP_ERR_WRONGTYPE);
+        break;
+
+    case MODE_SET_RESERVE2:
+        /*
+         * store old info for undo later 
+         */
+        memdup((u_char **) & accesses_cache,
+               (u_char *) & accesses, sizeof(accesses));
+        if (accesses_cache == NULL) {
+            netsnmp_set_request_error(reqinfo, requests,
+                                      SNMP_ERR_RESOURCEUNAVAILABLE);
+            return SNMP_ERR_NOERROR;
+        }
+        netsnmp_request_add_list_data(requests,
+                                      netsnmp_create_data_list
+                                      (TESTHANDLER_SET_NAME,
+                                       accesses_cache, free));
+        break;
+
+    case MODE_SET_ACTION:
+        /*
+         * update current 
+         */
+        accesses = *(requests->requestvb->val.integer);
+        DEBUGMSGTL(("testhandler", "updated accesses -> %d\n", accesses));
+        break;
+
+    case MODE_SET_UNDO:
+        accesses =
+            *((u_long *) netsnmp_request_get_list_data(requests,
+                                                       TESTHANDLER_SET_NAME));
+        break;
+
+    case MODE_SET_COMMIT:
+    case MODE_SET_FREE:
+        /*
+         * nothing to do 
+         */
+        break;
+    }
+
+    return SNMP_ERR_NOERROR;
+}
+
+int
+my_data_table_handler(netsnmp_mib_handler *handler,
+                      netsnmp_handler_registration *reginfo,
+                      netsnmp_agent_request_info *reqinfo,
+                      netsnmp_request_info *requests)
+{
+
+    char           *column3;
+    netsnmp_table_request_info *table_info;
+    netsnmp_table_row *row;
+
+    while (requests) {
+        if (requests->processed)
+            continue;
+
+        /*
+         * extract our stored data and table info 
+         */
+        row = netsnmp_extract_table_row(requests);
+        table_info = netsnmp_extract_table_info(requests);
+        if (row)
+            column3 = (char *) row->data;
+        if (!row || !table_info || !column3)
+            continue;
+
+        /*
+         * there's only one column, we don't need to check if it's right 
+         */
+        netsnmp_table_data_build_result(reginfo, reqinfo, requests, row,
+                                        table_info->colnum,
+                                        ASN_OCTET_STR, column3,
+                                        strlen(column3));
+        requests = requests->next;
+    }
+    return SNMP_ERR_NOERROR;
+}
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/testhandler.h tomato121/release/src/router/snmp/agent/mibgroup/testhandler.h
--- tomato/release/src/router/snmp/agent/mibgroup/testhandler.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/testhandler.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,9 @@
+/*
+ * testhandler.h 
+ */
+
+void            init_testhandler(void);
+Netsnmp_Node_Handler my_test_handler;
+Netsnmp_Node_Handler my_test_table_handler;
+Netsnmp_Node_Handler my_data_table_handler;
+Netsnmp_Node_Handler my_test_instance_handler;
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/tunnel/tunnel.c tomato121/release/src/router/snmp/agent/mibgroup/tunnel/tunnel.c
--- tomato/release/src/router/snmp/agent/mibgroup/tunnel/tunnel.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/tunnel/tunnel.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,973 @@
+/*
+ * tunnel.c --
+ * 
+ *      An implementation of the TUNNEL-MIB for the UCD-SNMP 4.2
+ *      agent running on Linux 2.2.x.
+ *      
+ * Copyright (c) 2000 Frank Strauss <strauss@ibr.cs.tu-bs.de>
+ *
+ *                          All Rights Reserved
+ * 
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation for any purpose and without fee is hereby granted,
+ * provided that the above copyright notice appears in all copies and
+ * that both that copyright notice and this permission notice appear in
+ * supporting documentation, and that the name of the author and CMU and
+ * The Regents of the University of California not be used in advertising
+ * or publicity pertaining to distribution of the software without
+ * specific written permission.
+ * 
+ * THE AUTHOR AND CMU AND THE REGENTS OF THE UNIVERSITY OF CALIFORNIA
+ * DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS.  IN NO EVENT SHALL
+ * THE AUTHOR OR CMU OR THE REGENTS OF THE UNIVERSITY OF CALIFORNIA BE
+ * LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY
+ * DAMAGES WHATSOEVER RESULTING FROM THE LOSS OF USE, DATA OR PROFITS,
+ * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+ * SOFTWARE.
+ *
+ */
+
+/*
+ * NOTE: This TUNNEL-MIB implementation
+ *
+ *       (a) DOES NOT implement write access on the tunnelConfigTable,
+ *           i.e. no new tunnels can be created and no existing tunnels
+ *           can be removed through SET operations.
+ *
+ *       (b) DOES implement write access on some tunnelIfTable objects
+ *           to allow reconfiguring established tunnels. This violates
+ *           RFC 2667! However, the author thinks it makes sense. ;-)
+ */
+
+#include <string.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <sys/time.h>
+#include <sys/ioctl.h>
+#include <signal.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
+
+#include <linux/if.h>
+#include <linux/ip.h>
+#include <linux/sockios.h>
+#include <linux/if_tunnel.h>
+#include <linux/if_arp.h>
+
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+#include "util_funcs.h"
+#include "tunnel.h"
+
+#ifndef MIN
+#define MIN(a, b) (((a) < (b)) ? (a) : (b))
+#endif
+#ifndef MAX
+#define MAX(a, b) (((a) > (b)) ? (a) : (b))
+#endif
+
+
+
+/*
+ * This is used, because the TUNNEL-MIB augments ifTable. 
+ */
+extern unsigned char *var_ifEntry(struct variable *,
+                                  oid *, size_t *,
+                                  int, size_t *, WriteMethod **);
+
+
+/*
+ * tunnel_variables_oid:
+ *   this is the top level oid that we want to register under.  This
+ *   is essentially a prefix, with the suffix appearing in the
+ *   variable below.
+ */
+oid             tunnel_variables_oid[] =
+    { 1, 3, 6, 1, 2, 1, 10, 131, 1, 1 };
+const int       tunnel_len = 10;
+
+oid             tunnel_ifEntry_oid[] =
+    { 1, 3, 6, 1, 2, 1, 10, 131, 1, 1, 1, 1 };
+const int       tunnel_ifEntry_len = 12;
+
+oid             tunnel_configEntry_oid[] =
+    { 1, 3, 6, 1, 2, 1, 10, 131, 1, 1, 2, 1 };
+const int       tunnel_configEntry_len = 12;
+
+
+
+struct tunnel {
+    oid             ifindex;
+    int             id;
+    char           *ifname;
+    int             active;
+    unsigned long   local;
+    unsigned long   remote;
+    int             encaps;
+    int             hoplimit;
+    int             security;
+    int             tos;
+    oid             config_name[MAX_OID_LEN];
+    size_t          config_length;
+    struct tunnel  *next;
+};
+
+
+
+/*
+ * variable4 tunnel_variables:
+ *   this variable defines function callbacks and type return information 
+ *   for the tunnel mib section 
+ */
+
+struct variable4 tunnel_variables[] = {
+    /*
+     * magic number        , variable type , ro/rw , callback fn  , L, oidsuffix 
+     */
+#define   LOCALADDRESS          1
+    {LOCALADDRESS, ASN_IPADDRESS, RWRITE, var_tunnelIfEntry, 3, {1, 1, 1}},
+#define   REMOTEADDRESS         2
+    {REMOTEADDRESS, ASN_IPADDRESS, RWRITE, var_tunnelIfEntry, 3,
+     {1, 1, 2}},
+#define   ENCAPSMETHOD          3
+    {ENCAPSMETHOD, ASN_INTEGER, RONLY, var_tunnelIfEntry, 3, {1, 1, 3}},
+#define   HOPLIMIT              4
+    {HOPLIMIT, ASN_INTEGER, RWRITE, var_tunnelIfEntry, 3, {1, 1, 4}},
+#define   SECURITY              5
+    {SECURITY, ASN_INTEGER, RONLY, var_tunnelIfEntry, 3, {1, 1, 5}},
+#define   TOS                   6
+    {TOS, ASN_INTEGER, RWRITE, var_tunnelIfEntry, 3, {1, 1, 6}},
+
+#define   IFINDEX               7
+    {IFINDEX, ASN_INTEGER, RONLY, var_tunnelConfigEntry, 3, {2, 1, 5}},
+#define   ROWSTATUS             8
+    {ROWSTATUS, ASN_INTEGER, RWRITE, var_tunnelConfigEntry, 3, {2, 1, 6}},
+};
+
+
+
+extern int      register_sysORTable(oid *, size_t, const char *);
+extern int      unregister_sysORTable(oid *, size_t);
+
+static oid      sysORTable_reg[] = { 1, 3, 6, 1, 2, 1, 10, 131 };
+static size_t   sysORTable_reglen = 8;
+
+static struct tunnel *tunnels;
+
+
+
+void
+deinit_tunnel(void)
+{
+    unregister_sysORTable(sysORTable_reg, sysORTable_reglen);
+}
+
+
+
+int
+term_tunnel(int majorID, int minorID, void *serverarg, void *clientarg)
+{
+    deinit_tunnel();
+    return 0;
+}
+
+
+
+void
+init_tunnel(void)
+{
+    register_sysORTable(sysORTable_reg, sysORTable_reglen,
+                        "RFC 2667 TUNNEL-MIB implementation for "
+                        "Linux 2.2.x kernels.");
+
+    netsnmp_ds_set_string(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_APPTYPE, "snmpd");
+
+    /*
+     * register ourselves with the agent to handle our mib tree 
+     */
+    REGISTER_MIB("tunnel", tunnel_variables, variable4,
+                 tunnel_variables_oid);
+
+    snmp_register_callback(SNMP_CALLBACK_LIBRARY,
+                           SNMP_CALLBACK_SHUTDOWN, term_tunnel, NULL);
+
+    tunnels = NULL;
+}
+
+
+
+static int
+getType(int index)
+{
+    oid             name[MAX_OID_LEN] = { 1, 3, 6, 1, 2, 1, 2, 2, 1, 3 };
+    size_t          length = 10;
+    struct variable ifType_variable =
+        { 3, ASN_INTEGER, RONLY, var_ifEntry, 10,
+        {1, 3, 6, 1, 2, 1, 2, 2, 1, 3}
+    };
+    unsigned char  *p;
+    size_t          var_len;
+    WriteMethod    *write_method;
+
+    name[length] = index;
+    length++;
+
+    p = var_ifEntry(&ifType_variable,
+                    name, &length,
+                    1 /* exact */ , &var_len, &write_method);
+    if (!p)
+        return 0;
+
+    return *(int *) p;
+}
+
+
+
+static char    *
+getName(int index)
+{
+    oid             name[MAX_OID_LEN] = { 1, 3, 6, 1, 2, 1, 2, 2, 1, 2 };
+    size_t          length = 10;
+    struct variable ifName_variable =
+        { 2, ASN_INTEGER, RONLY, var_ifEntry, 10,
+        {1, 3, 6, 1, 2, 1, 2, 2, 1, 2}
+    };
+    unsigned char  *p;
+    size_t          var_len;
+    WriteMethod    *write_method;
+
+    name[length] = index;
+    length++;
+
+    p = var_ifEntry(&ifName_variable,
+                    name, &length,
+                    1 /* exact */ , &var_len, &write_method);
+    if (!p)
+        return NULL;
+
+    return p;
+}
+
+
+
+static struct ip_tunnel_parm *
+getTunnelParm(char *ifname)
+{
+    struct ifreq    ifrq;
+    int             fd;
+    static struct ip_tunnel_parm parm;
+
+    if ((fd = socket(AF_INET, SOCK_DGRAM, 0)) < 0) {
+        return NULL;
+    }
+
+    memset(&parm, 0, sizeof(struct ip_tunnel_parm));
+    strcpy(ifrq.ifr_name, ifname);
+    ifrq.ifr_ifru.ifru_data = (void *) &parm;
+    if (ioctl(fd, SIOCGETTUNNEL, &ifrq) < 0) {
+        /*
+         * try again with the last char of the device name cut off.
+         * it might have been a zero digit appended by the agent.
+         */
+        ifrq.ifr_name[strlen(ifrq.ifr_name) - 1] = 0;
+        if (ioctl(fd, SIOCGETTUNNEL, &ifrq) < 0) {
+            close(fd);
+            return NULL;
+        }
+        ifname[strlen(ifname) - 1] = 0;
+    }
+
+    close(fd);
+
+    return &parm;
+}
+
+
+
+int
+setTunnelParm(char *ifname, struct ip_tunnel_parm *parm)
+{
+    struct ifreq    ifrq;
+    int             fd;
+    int             err;
+
+    if ((fd = socket(AF_INET, SOCK_DGRAM, 0)) < 0) {
+        return -1;
+    }
+
+    strcpy(ifrq.ifr_name, ifname);
+    ifrq.ifr_ifru.ifru_data = (void *) parm;
+    err = ioctl(fd, SIOCCHGTUNNEL, &ifrq);
+    close(fd);
+
+    return err;
+}
+
+
+
+/*
+ * update a struct tunnel. its index and ifname elements have to be set.
+ */
+static struct tunnel *
+updateTunnel(struct tunnel *tunnel)
+{
+    struct ip_tunnel_parm *parm;
+    int             fd;
+    struct ifreq    ifrq;
+
+    /*
+     * NOTE: getTunnelParm() may adjust the passed ifname. 
+     */
+    parm = getTunnelParm(tunnel->ifname);
+    if (!parm) {
+	DEBUGMSGTL(("tunnel",
+		    "updateTunnel(): getTunnelParm(\"%s\") returned NULL\n",
+		    tunnel->ifname));
+        tunnel->active = 0;
+        return NULL;
+    }
+
+    tunnel->active = 1;
+
+    tunnel->local = parm->iph.saddr;
+    tunnel->remote = parm->iph.daddr;
+
+    if ((fd = socket(AF_INET, SOCK_DGRAM, 0)) < 0) {
+        DEBUGMSGTL(("snmpd", "socket open failure in updateTunnels()\n"));
+        return NULL;
+    } else {
+        strcpy(ifrq.ifr_name, tunnel->ifname);
+        if (ioctl(fd, SIOCGIFHWADDR, &ifrq) == 0)
+            switch (ifrq.ifr_hwaddr.sa_family) {
+            case ARPHRD_TUNNEL:
+                tunnel->encaps = 2;
+                break;;         /* direct */
+            case ARPHRD_TUNNEL6:
+                tunnel->encaps = 2;
+                break;;         /* direct */
+            case ARPHRD_IPGRE:
+                tunnel->encaps = 3;
+                break;;         /* gre */
+            case ARPHRD_SIT:
+                tunnel->encaps = 2;
+                break;;         /* direct */
+            default:
+                tunnel->encaps = 1;     /* other */
+            }
+        close(fd);
+    }
+
+    tunnel->hoplimit = parm->iph.ttl;
+    tunnel->security = 1;
+    tunnel->tos = (parm->iph.tos & 1) ? -1 : parm->iph.tos;
+    /*
+     * XXX: adjust tos mapping (kernel <-> TUNNEL-MIB::tunnelIfTOS) 
+     */
+
+    return tunnel;
+}
+
+
+
+static void
+updateTunnels(void)
+{
+    static int      max_index = 1;
+    static struct tunnel *last_tunnel = NULL;
+    struct tunnel  *tunnel;
+    char           *ifname;
+    int             type;
+
+    /*
+     * uptime the tunnels we have so far 
+     */
+    for (tunnel = tunnels; tunnel; tunnel = tunnel->next) {
+        DEBUGMSG(("tunnel",
+                  "updateTunnels(): updating %s (index=%d)\n",
+                  tunnel->ifname, tunnel->ifindex));
+        updateTunnel(tunnel);
+    }
+
+    /*
+     * look for new tunnels 
+     */
+    for (; max_index < 256; max_index++) {
+        DEBUGMSG(("tunnel",
+                  "updateTunnels(): looking for new index=%d\n",
+                  max_index));
+        type = getType(max_index);
+        if (type == 131) {
+            tunnel = (struct tunnel *) malloc(sizeof(struct tunnel));
+            if (!tunnel)
+                continue;
+
+            tunnel->ifindex = max_index;
+            tunnel->id = 1;
+
+            ifname = getName(max_index);
+            if (!ifname) {
+                free(tunnel);
+                continue;
+            }
+
+            tunnel->ifname = strdup(ifname);
+            if (!tunnel->ifname) {
+                free(tunnel);
+                continue;
+            }
+
+            if (!updateTunnel(tunnel)) {
+                free(tunnel);
+                continue;
+            }
+
+            if (last_tunnel)
+                last_tunnel->next = tunnel;
+            if (!tunnels)
+                tunnels = last_tunnel = tunnel;
+            tunnel->next = NULL;
+            last_tunnel = tunnel;
+
+            DEBUGMSG(("tunnel",
+                      "updateTunnels(): added %s (index=%d state=%d)\n",
+                      tunnel->ifname, tunnel->ifindex, tunnel->active));
+        }
+        if (type == 0)
+            break;
+    }
+}
+
+
+
+static struct tunnel *
+getTunnelByIfIndex(int index)
+{
+    struct tunnel  *tunnel;
+
+    DEBUGMSG(("tunnel", "getTunnelByIfIndex(%d): ", index));
+
+    for (tunnel = tunnels; tunnel; tunnel = tunnel->next) {
+        if (tunnel->ifindex == index) {
+            if (!tunnel->active)
+                break;
+            DEBUGMSG(("tunnel",
+                      "%s (index=%d)\n", tunnel->ifname, tunnel->ifindex));
+            return tunnel;
+        }
+    }
+    DEBUGMSG(("tunnel", "NONE\n"));
+    return NULL;
+}
+
+
+
+static struct tunnel *
+getNextTunnelByIfIndex(int index)
+{
+    struct tunnel  *tunnel;
+
+    DEBUGMSG(("tunnel", "getNextTunnelByIfIndex(%d): ", index));
+
+    for (tunnel = tunnels; tunnel; tunnel = tunnel->next) {
+        if (tunnel->ifindex > index) {
+            if (!tunnel->active)
+                continue;
+            DEBUGMSG(("tunnel",
+                      "%s (index=%d)\n", tunnel->ifname, tunnel->ifindex));
+            return tunnel;
+        }
+    }
+    DEBUGMSG(("tunnel", "NONE\n"));
+    return NULL;
+}
+
+
+
+static void
+fillConfigOid(oid * name, struct tunnel *tunnel)
+{
+    name[0] = ((unsigned char *) &tunnel->local)[0];
+    name[1] = ((unsigned char *) &tunnel->local)[1];
+    name[2] = ((unsigned char *) &tunnel->local)[2];
+    name[3] = ((unsigned char *) &tunnel->local)[3];
+    name[4] = ((unsigned char *) &tunnel->remote)[0];
+    name[5] = ((unsigned char *) &tunnel->remote)[1];
+    name[6] = ((unsigned char *) &tunnel->remote)[2];
+    name[7] = ((unsigned char *) &tunnel->remote)[3];
+    name[8] = tunnel->encaps;
+    name[9] = tunnel->id;
+    DEBUGMSGOID(("tunnel", name, 10));
+}
+
+
+
+static struct tunnel *
+getTunnelByConfigOid(oid * name, size_t * length)
+{
+    struct tunnel  *tunnel;
+    oid             tname[4 + 4 + 1 + 1];
+
+    DEBUGMSG(("tunnel", "getTunnelByConfigOid(): "));
+
+    for (tunnel = tunnels; tunnel; tunnel = tunnel->next) {
+        fillConfigOid(tname, tunnel);
+        if (!snmp_oid_compare(tname, 4 + 4 + 1 + 1,
+                              &name[tunnel_len + 3],
+                              (*length) - tunnel_len - 3)) {
+            if (!tunnel->active)
+                break;
+            DEBUGMSG(("tunnel",
+                      "%s (index=%d)\n", tunnel->ifname, tunnel->ifindex));
+            return tunnel;
+        }
+    }
+    DEBUGMSG(("tunnel", "NONE\n"));
+    return NULL;
+}
+
+
+
+static struct tunnel *
+getNextTunnelByConfigOid(oid * name, size_t * length)
+{
+    struct tunnel  *tunnel, *last_tunnel;
+    oid             tname[10], last_tname[10];
+
+    DEBUGMSG(("tunnel", "getNextTunnelByConfigOid("));
+    DEBUGMSGOID(("tunnel", name, *length));
+    DEBUGMSG(("tunnel", "): "));
+
+    last_tunnel = NULL;
+    for (tunnel = tunnels; tunnel; tunnel = tunnel->next) {
+        if (!tunnel->active)
+            continue;
+        fillConfigOid(tname, tunnel);
+        if (snmp_oid_compare(tname, 10,
+                             &name[tunnel_len + 3],
+                             (*length) - tunnel_len - 3) > 0) {
+            if (!last_tunnel) {
+                last_tunnel = tunnel;
+                memcpy((char *) last_tname, (char *) tname,
+                       10 * sizeof(oid));
+            } else {
+                if (snmp_oid_compare(tname, 10, last_tname, 10) < 0) {
+                    last_tunnel = tunnel;
+                    memcpy((char *) last_tname, (char *) tname,
+                           10 * sizeof(oid));
+                }
+            }
+        }
+    }
+
+    if (last_tunnel) {
+        DEBUGMSG(("tunnel",
+                  "%s (index=%d)\n",
+                  last_tunnel->ifname, last_tunnel->ifindex));
+    } else {
+        DEBUGMSG(("tunnel", "NONE\n"));
+    }
+
+    return last_tunnel;
+}
+
+
+
+static int
+writeLocalAddress(int action, unsigned char *var_val,
+                  unsigned char var_val_type, size_t var_val_len,
+                  unsigned char *statP, oid * name, size_t name_len)
+{
+    static struct tunnel *tunnel;
+    struct ip_tunnel_parm *parm;
+
+    switch (action) {
+    case RESERVE1:
+        if (var_val_type != ASN_IPADDRESS) {
+            return SNMP_ERR_WRONGTYPE;
+        }
+        if (var_val_len != 4) {
+            return SNMP_ERR_WRONGLENGTH;
+        }
+    case RESERVE2:
+        tunnel = getTunnelByIfIndex((int) name[name_len - 1]);
+        if (!tunnel) {
+            return SNMP_ERR_NOSUCHNAME;
+        }
+    case FREE:
+        break;
+    case ACTION:
+        break;
+    case UNDO:
+        break;
+    case COMMIT:
+        if (!tunnel) {
+            return SNMP_ERR_NOSUCHNAME;
+        }
+        parm = getTunnelParm(tunnel->ifname);
+        if (!parm) {
+            return SNMP_ERR_NOSUCHNAME;
+        }
+        parm->iph.saddr = *(unsigned long *) var_val;
+        setTunnelParm(tunnel->ifname, parm);
+        break;
+    }
+
+    return SNMP_ERR_NOERROR;
+}
+
+
+
+static int
+writeRemoteAddress(int action, unsigned char *var_val,
+                   unsigned char var_val_type, size_t var_val_len,
+                   unsigned char *statP, oid * name, size_t name_len)
+{
+    static struct tunnel *tunnel;
+    struct ip_tunnel_parm *parm;
+
+    switch (action) {
+    case RESERVE1:
+        if (var_val_type != ASN_IPADDRESS) {
+            return SNMP_ERR_WRONGTYPE;
+        }
+        if (var_val_len != 4) {
+            return SNMP_ERR_WRONGLENGTH;
+        }
+    case RESERVE2:
+        tunnel = getTunnelByIfIndex((int) name[name_len - 1]);
+        if (!tunnel) {
+            return SNMP_ERR_NOSUCHNAME;
+        }
+    case FREE:
+        break;
+    case ACTION:
+        break;
+    case UNDO:
+        break;
+    case COMMIT:
+        if (!tunnel) {
+            return SNMP_ERR_NOSUCHNAME;
+        }
+        parm = getTunnelParm(tunnel->ifname);
+        if (!parm) {
+            return SNMP_ERR_NOSUCHNAME;
+        }
+        parm->iph.daddr = *(unsigned long *) var_val;
+        setTunnelParm(tunnel->ifname, parm);
+        break;
+    }
+
+    return SNMP_ERR_NOERROR;
+}
+
+
+
+static int
+writeHopLimit(int action, unsigned char *var_val,
+              unsigned char var_val_type, size_t var_val_len,
+              unsigned char *statP, oid * name, size_t name_len)
+{
+    static struct tunnel *tunnel;
+    struct ip_tunnel_parm *parm;
+
+    switch (action) {
+    case RESERVE1:
+        if (var_val_type != ASN_INTEGER) {
+            return SNMP_ERR_WRONGTYPE;
+        }
+        if (var_val_len > sizeof(long)) {
+            return SNMP_ERR_WRONGLENGTH;
+        }
+    case RESERVE2:
+        tunnel = getTunnelByIfIndex((int) name[name_len - 1]);
+        if (!tunnel) {
+            return SNMP_ERR_NOSUCHNAME;
+        }
+    case FREE:
+        break;
+    case ACTION:
+        break;
+    case UNDO:
+        break;
+    case COMMIT:
+        if (!tunnel) {
+            return SNMP_ERR_NOSUCHNAME;
+        }
+        parm = getTunnelParm(tunnel->ifname);
+        if (!parm) {
+            return SNMP_ERR_NOSUCHNAME;
+        }
+        parm->iph.ttl = *(long *) var_val;
+        setTunnelParm(tunnel->ifname, parm);
+        break;
+    }
+
+    return SNMP_ERR_NOERROR;
+}
+
+
+
+static int
+writeTOS(int action, unsigned char *var_val,
+         unsigned char var_val_type, size_t var_val_len,
+         unsigned char *statP, oid * name, size_t name_len)
+{
+    static struct tunnel *tunnel;
+    struct ip_tunnel_parm *parm;
+
+    switch (action) {
+    case RESERVE1:
+        if (var_val_type != ASN_INTEGER) {
+            return SNMP_ERR_WRONGTYPE;
+        }
+        if (var_val_len > sizeof(long)) {
+            return SNMP_ERR_WRONGLENGTH;
+        }
+    case RESERVE2:
+        tunnel = getTunnelByIfIndex((int) name[name_len - 1]);
+        if (!tunnel) {
+            return SNMP_ERR_NOSUCHNAME;
+        }
+    case FREE:
+        break;
+    case ACTION:
+        break;
+    case UNDO:
+        break;
+    case COMMIT:
+        if (!tunnel) {
+            return SNMP_ERR_NOSUCHNAME;
+        }
+        parm = getTunnelParm(tunnel->ifname);
+        if (!parm) {
+            return SNMP_ERR_NOSUCHNAME;
+        }
+        /*
+         * this does not cover all meaningful values: 
+         */
+        parm->iph.tos = (*(long *) var_val == -1) ? 1 : *(long *) var_val;
+        setTunnelParm(tunnel->ifname, parm);
+        break;
+    }
+
+    return SNMP_ERR_NOERROR;
+}
+
+
+
+unsigned char  *
+var_tunnelIfEntry(struct variable *vp,
+                  oid * name, size_t * length,
+                  int exact, size_t * var_len, WriteMethod ** write_method)
+{
+    static unsigned long ret_addr;
+    static long     ret_int;
+    struct tunnel  *tunnel;
+
+    DEBUGMSGTL(("tunnel", "var_tunnelIfEntry: "));
+    DEBUGMSGOID(("tunnel", name, *length));
+    DEBUGMSG(("tunnel", " %d\n", exact));
+
+    updateTunnels();
+
+    if (exact) {
+        if (*length != tunnel_len + 3 + 1) {
+            return NULL;
+        }
+        tunnel = getTunnelByIfIndex((int) name[*length - 1]);
+    } else {
+        if ((*length) < tunnel_len) {
+            memcpy((char *) name, (char *) tunnel_variables_oid,
+                   tunnel_len * sizeof(oid));
+        }
+        if ((*length) < tunnel_len + 1) {
+            name[tunnel_len] = 1;
+        }
+        if ((*length) < tunnel_len + 2) {
+            name[tunnel_len + 1] = 1;
+        }
+        if ((*length) < tunnel_len + 3) {
+            name[tunnel_len + 2] = 1;
+        }
+        if ((*length) < tunnel_len + 4) {
+            name[tunnel_len + 3] = 0;
+        }
+        *length = tunnel_len + 4;
+
+        tunnel = getNextTunnelByIfIndex(name[*length - 1]);
+        if (!tunnel) {
+            /*
+             * end of column, continue with first row of next column 
+             */
+            tunnel = tunnels;
+            name[tunnel_len + 2]++;
+            if (name[tunnel_len + 2] > 6) {
+                /*
+                 * there is no next column 
+                 */
+                return NULL;
+            }
+            if (!tunnel) {
+                /*
+                 * there is no (next) row 
+                 */
+                return NULL;
+            }
+        }
+    }
+
+    if (!tunnel) {
+        return NULL;
+    }
+
+    name[*length - 1] = tunnel->ifindex;
+
+    DEBUGMSGTL(("tunnel", "var_tunnelIfEntry: using"));
+    DEBUGMSGOID(("tunnel", name, *length));
+    DEBUGMSG(("tunnel", "\n"));
+
+    switch (name[tunnel_len + 2]) {
+    case 1:                    /* tunnelIfLocalAddress */
+        ret_addr = tunnel->local;
+        *var_len = 4;
+        vp->type = ASN_IPADDRESS;
+        *write_method = writeLocalAddress;
+        return (u_char *) & ret_addr;
+    case 2:                    /* tunnelIfRemoteAddress */
+        ret_addr = tunnel->remote;
+        *var_len = 4;
+        vp->type = ASN_IPADDRESS;
+        *write_method = writeRemoteAddress;
+        return (u_char *) & ret_addr;
+    case 3:                    /* tunnelIfEncapsMethod */
+        ret_int = tunnel->encaps;
+        *var_len = sizeof(ret_int);
+        vp->type = ASN_INTEGER;
+        return (u_char *) & ret_int;
+    case 4:                    /* tunnelIfHopLimit */
+        ret_int = tunnel->hoplimit;
+        *var_len = sizeof(ret_int);
+        vp->type = ASN_INTEGER;
+        *write_method = writeHopLimit;
+        return (u_char *) & ret_int;
+    case 5:                    /* tunnelIfSecurity */
+        ret_int = tunnel->security;
+        *var_len = sizeof(ret_int);
+        vp->type = ASN_INTEGER;
+        return (u_char *) & ret_int;
+    case 6:                    /* tunnelIfTOS */
+        ret_int = tunnel->tos;
+        *var_len = sizeof(ret_int);
+        vp->type = ASN_INTEGER;
+        *write_method = writeTOS;
+        return (u_char *) & ret_int;
+    default:
+        return 0;
+    }
+
+    return NULL;
+}
+
+
+
+unsigned char  *
+var_tunnelConfigEntry(struct variable *vp,
+                      oid * name, size_t * length,
+                      int exact, size_t * var_len,
+                      WriteMethod ** write_method)
+{
+    static long     ret_int;
+    struct tunnel  *tunnel;
+    int             i;
+
+    DEBUGMSGTL(("tunnel", "var_tunnelConfigEntry: "));
+    DEBUGMSGOID(("tunnel", name, *length));
+    DEBUGMSG(("tunnel", " %d\n", exact));
+
+    updateTunnels();
+
+    if (exact) {
+        if (*length != tunnel_len + 3 + 4 + 4 + 1 + 1) {
+            return NULL;
+        }
+        tunnel = getTunnelByConfigOid(name, length);
+    } else {
+        if (snmp_oid_compare(name, *length,
+                             tunnel_configEntry_oid,
+                             tunnel_configEntry_len) < 0) {
+            *length = 0;
+        }
+        if ((*length) < tunnel_len) {
+            memcpy((char *) name, (char *) tunnel_variables_oid,
+                   tunnel_len * sizeof(oid));
+        }
+        if ((*length) < tunnel_len + 1) {
+            name[tunnel_len] = 2;
+        }
+        if ((*length) < tunnel_len + 2) {
+            name[tunnel_len + 1] = 1;
+        }
+        if ((*length) < tunnel_len + 3) {
+            name[tunnel_len + 2] = 5;
+        }
+        for (i = MAX(*length, tunnel_len + 3);
+             i < tunnel_len + 3 + 4 + 4 + 1 + 1; i++) {
+            name[i] = 0;
+        }
+        *length = tunnel_len + 3 + 4 + 4 + 1 + 1;
+        tunnel = getNextTunnelByConfigOid(name, length);
+        if (!tunnel) {
+            /*
+             * end of column, continue with first row of next column 
+             */
+            tunnel = tunnels;
+            name[tunnel_len + 2]++;
+            if (name[tunnel_len + 2] > 6) {
+                /*
+                 * there is no next column 
+                 */
+                return NULL;
+            }
+            if (!tunnel) {
+                /*
+                 * there is no (next) row 
+                 */
+                return NULL;
+            }
+        }
+    }
+
+    if (!tunnel) {
+        return NULL;
+    }
+
+    fillConfigOid(&name[tunnel_len + 3], tunnel);
+
+    DEBUGMSGTL(("tunnel", "var_tunnelConfigEntry: using "));
+    DEBUGMSGOID(("tunnel", name, *length));
+    DEBUGMSG(("tunnel", "\n"));
+
+    switch (name[tunnel_len + 2]) {
+    case 5:                    /* tunnelConfigIfIndex */
+        ret_int = tunnel->ifindex;
+        *var_len = sizeof(ret_int);
+        vp->type = ASN_INTEGER;
+        return (u_char *) & ret_int;
+    case 6:                    /* tunnelConfigStatus */
+        ret_int = 1;            /* active */
+        *var_len = sizeof(ret_int);
+        vp->type = ASN_INTEGER;
+        return (u_char *) & ret_int;
+    default:
+        return 0;
+    }
+
+    return NULL;
+}
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/tunnel/tunnel.h tomato121/release/src/router/snmp/agent/mibgroup/tunnel/tunnel.h
--- tomato/release/src/router/snmp/agent/mibgroup/tunnel/tunnel.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/tunnel/tunnel.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,46 @@
+/*
+ * tunnel.h --
+ *
+ *      Interface of the TUNNEL-MIB implementation.
+ *
+ * Copyright (c) 2000-2003 Frank Strauss <strauss@ibr.cs.tu-bs.de>
+ *
+ *                          All Rights Reserved
+ * 
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation for any purpose and without fee is hereby granted,
+ * provided that the above copyright notice appears in all copies and
+ * that both that copyright notice and this permission notice appear in
+ * supporting documentation, and that the name of the author and CMU and
+ * The Regents of the University of California not be used in advertising
+ * or publicity pertaining to distribution of the software without
+ * specific written permission.
+ * 
+ * THE AUTHOR AND CMU AND THE REGENTS OF THE UNIVERSITY OF CALIFORNIA
+ * DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS.  IN NO EVENT SHALL
+ * THE AUTHOR OR CMU OR THE REGENTS OF THE UNIVERSITY OF CALIFORNIA BE
+ * LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY
+ * DAMAGES WHATSOEVER RESULTING FROM THE LOSS OF USE, DATA OR PROFITS,
+ * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+ * SOFTWARE.
+ *
+ */
+
+#ifndef _MIBGROUP_TUNNEL_H
+#define _MIBGROUP_TUNNEL_H
+
+void            init_tunnel(void);
+void            deinit_tunnel(void);
+
+unsigned char  *var_tunnelIfEntry(struct variable *, oid *, size_t *,
+                                  int, size_t *,
+                                  WriteMethod ** write_method);
+
+unsigned char  *var_tunnelConfigEntry(struct variable *, oid *, size_t *,
+                                      int, size_t *,
+                                      WriteMethod ** write_method);
+
+#endif                          /* _MIBGROUP_TUNNEL_H */
+
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/tunnel.h tomato121/release/src/router/snmp/agent/mibgroup/tunnel.h
--- tomato/release/src/router/snmp/agent/mibgroup/tunnel.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/tunnel.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,5 @@
+/*
+ * tunnel.h: top level .h file to merely include the sub-module.
+ */
+config_require(tunnel/tunnel)
+config_add_mib(TUNNEL-MIB)
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/ucd-snmp/.cvsignore tomato121/release/src/router/snmp/agent/mibgroup/ucd-snmp/.cvsignore
--- tomato/release/src/router/snmp/agent/mibgroup/ucd-snmp/.cvsignore	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/ucd-snmp/.cvsignore	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,2 @@
+.libs
+*.lo
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/ucd-snmp/disk.c tomato121/release/src/router/snmp/agent/mibgroup/ucd-snmp/disk.c
--- tomato/release/src/router/snmp/agent/mibgroup/ucd-snmp/disk.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/ucd-snmp/disk.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,586 @@
+/*
+ * disk.c
+ */
+
+#include <net-snmp/net-snmp-config.h>
+
+#include <stdio.h>
+
+#if HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#if HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#if HAVE_FCNTL_H
+#include <fcntl.h>
+#endif
+#include <signal.h>
+#if HAVE_MACHINE_PARAM_H
+#include <machine/param.h>
+#endif
+#if HAVE_SYS_VMMETER_H
+#if !(defined(bsdi2) || defined(netbsd1))
+#include <sys/vmmeter.h>
+#endif
+#endif
+#if HAVE_SYS_PARAM_H
+#include <sys/param.h>
+#endif
+#if HAVE_SYS_CONF_H
+#include <sys/conf.h>
+#endif
+#if HAVE_ASM_PAGE_H
+#include <asm/page.h>
+#endif
+#if HAVE_SYS_SWAP_H
+#include <sys/swap.h>
+#endif
+#if HAVE_SYS_FS_H
+#include <sys/fs.h>
+#else
+#if HAVE_UFS_FS_H
+#include <ufs/fs.h>
+#else
+#ifdef HAVE_SYS_STAT_H
+#include <sys/stat.h>
+#endif
+#ifdef HAVE_SYS_VNODE_H
+#include <sys/vnode.h>
+#endif
+#ifdef HAVE_UFS_UFS_QUOTA_H
+#include <ufs/ufs/quota.h>
+#endif
+#ifdef HAVE_UFS_UFS_INODE_H
+#include <ufs/ufs/inode.h>
+#endif
+#if HAVE_UFS_FFS_FS_H
+#include <ufs/ffs/fs.h>
+#endif
+#endif
+#endif
+#if HAVE_MTAB_H
+#include <mtab.h>
+#endif
+#include <sys/stat.h>
+#include <errno.h>
+#if HAVE_SYS_STATFS_H
+#include <sys/statfs.h>
+#endif
+#if HAVE_SYS_STATVFS_H
+#include <sys/statvfs.h>
+#endif
+#if HAVE_SYS_VFS_H
+#include <sys/vfs.h>
+#endif
+#if (!defined(HAVE_STATVFS)) && defined(HAVE_STATFS)
+#if HAVE_SYS_MOUNT_H
+#include <sys/mount.h>
+#endif
+#if HAVE_SYS_SYSCTL_H
+#include <sys/sysctl.h>
+#endif
+#define statvfs statfs
+#endif
+#if HAVE_VM_VM_H
+#include <vm/vm.h>
+#endif
+#if HAVE_VM_SWAP_PAGER_H
+#include <vm/swap_pager.h>
+#endif
+#if HAVE_SYS_FIXPOINT_H
+#include <sys/fixpoint.h>
+#endif
+#if HAVE_MALLOC_H
+#include <malloc.h>
+#endif
+#if HAVE_STRING_H
+#include <string.h>
+#endif
+#if HAVE_FSTAB_H
+#include <fstab.h>
+#endif
+#if HAVE_MNTENT_H
+#include <mntent.h>
+#endif
+#if HAVE_SYS_MNTTAB_H
+#include <sys/mnttab.h>
+#endif
+#if HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+#if TIME_WITH_SYS_TIME
+# ifdef WIN32
+#  include <sys/timeb.h>
+# else
+#  include <sys/time.h>
+# endif
+# include <time.h>
+#else
+# if HAVE_SYS_TIME_H
+#  include <sys/time.h>
+# else
+#  include <time.h>
+# endif
+#endif
+#if HAVE_WINSOCK_H
+#include <winsock.h>
+#endif
+
+#if HAVE_DMALLOC_H
+#include <dmalloc.h>
+#endif
+
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include <net-snmp/agent/auto_nlist.h>
+
+#include "struct.h"
+#include "disk.h"
+#include "util_funcs.h"
+#if USING_UCD_SNMP_ERRORMIB_MODULE
+#include "errormib.h"
+#else
+#define setPerrorstatus(x) snmp_log_perror(x)
+#endif
+
+int             numdisks;
+struct diskpart disks[MAXDISKS];
+
+struct variable2 extensible_disk_variables[] = {
+    {MIBINDEX, ASN_INTEGER, RONLY, var_extensible_disk, 1, {MIBINDEX}},
+    {ERRORNAME, ASN_OCTET_STR, RONLY, var_extensible_disk, 1, {ERRORNAME}},
+    {DISKDEVICE, ASN_OCTET_STR, RONLY, var_extensible_disk, 1,
+     {DISKDEVICE}},
+    {DISKMINIMUM, ASN_INTEGER, RONLY, var_extensible_disk, 1,
+     {DISKMINIMUM}},
+    {DISKMINPERCENT, ASN_INTEGER, RONLY, var_extensible_disk, 1,
+     {DISKMINPERCENT}},
+    {DISKTOTAL, ASN_INTEGER, RONLY, var_extensible_disk, 1, {DISKTOTAL}},
+    {DISKAVAIL, ASN_INTEGER, RONLY, var_extensible_disk, 1, {DISKAVAIL}},
+    {DISKUSED, ASN_INTEGER, RONLY, var_extensible_disk, 1, {DISKUSED}},
+    {DISKPERCENT, ASN_INTEGER, RONLY, var_extensible_disk, 1,
+     {DISKPERCENT}},
+    {DISKPERCENTNODE, ASN_INTEGER, RONLY, var_extensible_disk, 1,
+     {DISKPERCENTNODE}},
+    {ERRORFLAG, ASN_INTEGER, RONLY, var_extensible_disk, 1, {ERRORFLAG}},
+    {ERRORMSG, ASN_OCTET_STR, RONLY, var_extensible_disk, 1, {ERRORMSG}}
+};
+
+/*
+ * Define the OID pointer to the top of the mib tree that we're
+ * registering underneath 
+ */
+oid             disk_variables_oid[] = { UCDAVIS_MIB, DISKMIBNUM, 1 };
+
+void
+init_disk(void)
+{
+    /*
+     * register ourselves with the agent to handle our mib tree 
+     */
+    REGISTER_MIB("ucd-snmp/disk", extensible_disk_variables, variable2,
+                 disk_variables_oid);
+
+    snmpd_register_config_handler("disk", disk_parse_config,
+                                  disk_free_config,
+                                  "path [ minspace | minpercent% ]");
+}
+
+void
+disk_free_config(void)
+{
+    int             i;
+
+    numdisks = 0;
+    for (i = 0; i < MAXDISKS; i++) {    /* init/erase disk db */
+        disks[i].device[0] = 0;
+        disks[i].path[0] = 0;
+        disks[i].minimumspace = -1;
+        disks[i].minpercent = -1;
+    }
+}
+
+void
+disk_parse_config(const char *token, char *cptr)
+{
+#if HAVE_GETMNTENT
+#if HAVE_SYS_MNTTAB_H
+    struct mnttab   mnttab;
+#else
+    struct mntent  *mntent;
+#endif
+    FILE           *mntfp;
+#else
+#if HAVE_FSTAB_H
+    struct fstab   *fstab;
+    struct stat     stat1;
+#else
+#if HAVE_STATFS
+    struct statfs   statf;
+#endif                          /* HAVE_STATFS */
+#endif                          /* HAVE_FSTAB_H */
+#endif                          /* HAVE_GETMNTENT */
+    char            tmpbuf[1024];
+#if defined(HAVE_GETMNTENT) && !defined(HAVE_SETMNTENT)
+    int             i;
+#endif
+
+#if HAVE_FSTAB_H || HAVE_GETMNTENT || HAVE_STATFS
+    if (numdisks == MAXDISKS) {
+        config_perror("Too many disks specified.");
+        snprintf(tmpbuf, sizeof(tmpbuf), "\tignoring:  %s", cptr);
+        tmpbuf[ sizeof(tmpbuf)-1 ] = 0;
+        config_perror(tmpbuf);
+    } else {
+        /*
+         * read disk path (eg, /1 or /usr) 
+         */
+        copy_nword(cptr, disks[numdisks].path,
+                   sizeof(disks[numdisks].path));
+        cptr = skip_not_white(cptr);
+        cptr = skip_white(cptr);
+        /*
+         * read optional minimum disk usage spec 
+         */
+        if (cptr != NULL) {
+            if (strchr(cptr, '%') == 0) {
+                disks[numdisks].minimumspace = atoi(cptr);
+                disks[numdisks].minpercent = -1;
+            } else {
+                disks[numdisks].minimumspace = -1;
+                disks[numdisks].minpercent = atoi(cptr);
+            }
+        } else {
+            disks[numdisks].minimumspace = DEFDISKMINIMUMSPACE;
+            disks[numdisks].minpercent = -1;
+        }
+        /*
+         * find the device associated with the directory 
+         */
+#if HAVE_GETMNTENT
+#if HAVE_SETMNTENT
+        mntfp = setmntent(ETC_MNTTAB, "r");
+        disks[numdisks].device[0] = 0;
+        while (NULL != (mntent = getmntent(mntfp)))
+            if (strcmp(disks[numdisks].path, mntent->mnt_dir) == 0) {
+                copy_nword(mntent->mnt_fsname, disks[numdisks].device,
+                           sizeof(disks[numdisks].device));
+                DEBUGMSGTL(("ucd-snmp/disk", "Disk:  %s\n",
+                            mntent->mnt_fsname));
+                break;
+            } else {
+                DEBUGMSGTL(("ucd-snmp/disk", "  %s != %s\n",
+                            disks[numdisks].path, mntent->mnt_dir));
+            }
+        if (mntfp)
+            endmntent(mntfp);
+        if (disks[numdisks].device[0] != 0) {
+            /*
+             * dummy clause for else below 
+             */
+            numdisks += 1;      /* but inc numdisks here after test */
+        }
+#else                           /* getmentent but not setmntent */
+        mntfp = fopen(ETC_MNTTAB, "r");
+        while ((i = getmntent(mntfp, &mnttab)) == 0)
+            if (strcmp(disks[numdisks].path, mnttab.mnt_mountp) == 0)
+                break;
+            else {
+                DEBUGMSGTL(("ucd-snmp/disk", "  %s != %s\n",
+                            disks[numdisks].path, mnttab.mnt_mountp));
+            }
+        fclose(mntfp);
+        if (i == 0) {
+            copy_nword(mnttab.mnt_special, disks[numdisks].device,
+                       sizeof(disks[numdisks].device));
+            numdisks += 1;
+        }
+#endif                          /* HAVE_SETMNTENT */
+#else
+#if HAVE_FSTAB_H
+        stat(disks[numdisks].path, &stat1);
+        setfsent();
+        if ((fstab = getfsfile(disks[numdisks].path))) {
+            copy_nword(fstab->fs_spec, disks[numdisks].device,
+                       sizeof(disks[numdisks].device));
+            numdisks += 1;
+        }
+#else
+#if HAVE_STATFS
+        if (statfs(disks[numdisks].path, &statf) == 0) {
+            copy_word(statf.f_mntfromname, disks[numdisks].device);
+            DEBUGMSGTL(("ucd-snmp/disk", "Disk:  %s\n",
+                        statf.f_mntfromname));
+        } else {
+            DEBUGMSGT(("ucd-snmp/disk", "  %s != %s\n",
+                       disks[numdisks].path, statf.f_mntfromname));
+        }
+        if (disks[numdisks].device[0] != 0) {
+            /*
+             * dummy clause for else below 
+             */
+            numdisks += 1;      /* but inc numdisks here after test */
+        }
+#endif  /* HAVE_STATFS */
+#endif                          /* HAVE_FSTAB_H */
+#endif                          /* HAVE_GETMNTENT */
+        else {
+            snprintf(tmpbuf, sizeof(tmpbuf),
+                    "Couldn't find device for disk %s",
+                    disks[numdisks].path);
+            tmpbuf[ sizeof(tmpbuf)-1 ] = 0;
+            config_pwarn(tmpbuf);
+            disks[numdisks].minimumspace = -1;
+            disks[numdisks].minpercent = -1;
+            disks[numdisks].path[0] = 0;
+        }
+#if HAVE_FSTAB_H
+#ifndef __UCLIBC__
+        endfsent();
+#endif
+#endif
+    }
+#else
+    config_perror("'disk' checks not supported on this architecture.");
+#endif                          /* HAVE_FSTAB_H || HAVE_GETMNTENT || HAVE_STATFS */
+}
+
+/*
+ * var_extensible_disk(...
+ * Arguments:
+ * vp     IN      - pointer to variable entry that points here
+ * name    IN/OUT  - IN/name requested, OUT/name found
+ * length  IN/OUT  - length of IN/OUT oid's 
+ * exact   IN      - TRUE if an exact match was requested
+ * var_len OUT     - length of variable or 0 if function returned
+ * write_method
+ * 
+ */
+
+u_char         *
+var_extensible_disk(struct variable *vp,
+                    oid * name,
+                    size_t * length,
+                    int exact,
+                    size_t * var_len, WriteMethod ** write_method)
+{
+
+    int             percent, iserror, disknum = 0;
+#if !defined(HAVE_SYS_STATVFS_H) && !defined(HAVE_STATFS)
+    double          totalblks, free, used, avail, availblks;
+#else
+    static long     avail;
+#if defined(STRUCT_STATVFS_HAS_F_FILES) || defined(STRUCT_STATFS_HAS_F_FILES)
+    int             percent_inode;
+#endif
+#endif
+    static long     long_ret;
+    static char     errmsg[300];
+
+#if defined(HAVE_STATVFS) || defined(HAVE_STATFS)
+#ifdef STAT_STATFS_FS_DATA
+    struct fs_data  fsd;
+    struct {
+        u_int           f_blocks, f_bfree, f_bavail, f_bsize;
+    } vfs;
+#else
+    struct statvfs  vfs;
+#endif
+#else
+#if HAVE_FSTAB_H
+    int             file;
+    union {
+        struct fs       iu_fs;
+        char            dummy[SBSIZE];
+    } sb;
+#define filesys sb.iu_fs
+#endif
+#endif
+
+    if (header_simple_table
+        (vp, name, length, exact, var_len, write_method, numdisks))
+        return (NULL);
+    disknum = name[*length - 1] - 1;
+    switch (vp->magic) {
+    case MIBINDEX:
+        long_ret = disknum + 1;
+        return ((u_char *) (&long_ret));
+    case ERRORNAME:            /* DISKPATH */
+        *var_len = strlen(disks[disknum].path);
+        return ((u_char *) disks[disknum].path);
+    case DISKDEVICE:
+        *var_len = strlen(disks[disknum].device);
+        return ((u_char *) disks[disknum].device);
+    case DISKMINIMUM:
+        long_ret = disks[disknum].minimumspace;
+        return ((u_char *) (&long_ret));
+    case DISKMINPERCENT:
+        long_ret = disks[disknum].minpercent;
+        return ((u_char *) (&long_ret));
+    }
+#if defined(HAVE_STATVFS) || defined(HAVE_STATFS)
+#ifdef STAT_STATFS_FS_DATA
+    if (statvfs(disks[disknum].path, &fsd) == -1) {
+#else
+    if (statvfs(disks[disknum].path, &vfs) == -1) {
+#endif
+        snmp_log(LOG_ERR, "Couldn't open device %s\n",
+                 disks[disknum].device);
+        setPerrorstatus("statvfs dev/disk");
+        return NULL;
+    }
+#ifdef STAT_STATFS_FS_DATA
+    vfs.f_blocks = fsd.fd_btot;
+    vfs.f_bfree = fsd.fd_bfree;
+    vfs.f_bavail = fsd.fd_bfreen;
+    vfs.f_bsize = 1024;         /*  Ultrix f_bsize is a VM parameter apparently.  */
+#endif
+#if defined(HAVE_ODS)
+    vfs.f_blocks = vfs.f_spare[0];
+    vfs.f_bfree = vfs.f_spare[1];
+    vfs.f_bavail = vfs.f_spare[2];
+#endif
+    percent = vfs.f_bavail <= 0 ? 100 :
+        (int) ((double) (vfs.f_blocks - vfs.f_bfree) /
+               (double) (vfs.f_blocks -
+                         (vfs.f_bfree - vfs.f_bavail)) * 100.0 + 0.5);
+    avail = vfs.f_bavail * (vfs.f_bsize / 1024);
+#ifdef STRUCT_STATVFS_HAS_F_FRSIZE
+    if (vfs.f_frsize > 255)
+        avail = vfs.f_bavail * (vfs.f_frsize / 1024);
+#endif
+    iserror = (disks[disknum].minimumspace >= 0 ?
+               avail < disks[disknum].minimumspace :
+               100 - percent <= disks[disknum].minpercent) ? 1 : 0;
+#if defined(STRUCT_STATVFS_HAS_F_FILES) || defined STRUCT_STATFS_HAS_F_FAVAIL
+    percent_inode = vfs.f_favail <= 0 ? 100 :
+        (int) ((double) (vfs.f_files - vfs.f_ffree) /
+               (double) (vfs.f_files -
+                         (vfs.f_ffree - vfs.f_favail)) * 100.0 + 0.5);
+#else
+#if defined(STRUCT_STATFS_HAS_F_FILES) && defined(STRUCT_STATFS_HAS_F_FFREE)
+   percent_inode = vfs.f_files == 0 ? 100.0 :
+      (int) ((double) (vfs.f_files - vfs.f_ffree) /
+	          (double) (vfs.f_files) * 100.0 + 0.5);
+#endif 
+#endif /* defined(STRUCT_STATVFS_HAS_F_FILES) */ 
+    switch (vp->magic) {
+    case DISKTOTAL:
+        long_ret = vfs.f_blocks * (vfs.f_bsize / 1024);
+#ifdef STRUCT_STATVFS_HAS_F_FRSIZE
+        if (vfs.f_frsize > 255)
+            long_ret = vfs.f_blocks * (vfs.f_frsize / 1024);
+#endif
+        return ((u_char *) (&long_ret));
+    case DISKAVAIL:
+        return ((u_char *) (&avail));
+    case DISKUSED:
+        long_ret = (vfs.f_blocks - vfs.f_bfree) * (vfs.f_bsize / 1024);
+#ifdef STRUCT_STATVFS_HAS_F_FRSIZE
+        if (vfs.f_frsize > 255)
+            long_ret =
+                (vfs.f_blocks - vfs.f_bfree) * (vfs.f_frsize / 1024);
+#endif
+        return ((u_char *) (&long_ret));
+    case DISKPERCENT:
+        long_ret = percent;
+        return ((u_char *) (&long_ret));
+#if defined(STRUCT_STATVFS_HAS_F_FILES) || defined (STRUCT_STATFS_HAS_F_FILES)
+    case DISKPERCENTNODE:
+        long_ret = percent_inode;
+        return ((u_char *) (&long_ret));
+#endif
+    case ERRORFLAG:
+        long_ret = iserror;
+        return ((u_char *) (&long_ret));
+    case ERRORMSG:
+        if (iserror) {
+            if (disks[disknum].minimumspace >= 0)
+                snprintf(errmsg, sizeof(errmsg),
+                        "%s: less than %d free (= %d)",
+                        disks[disknum].path, disks[disknum].minimumspace,
+                        (int) avail);
+            else
+                snprintf(errmsg, sizeof(errmsg),
+                        "%s: less than %d%% free (= %d%%)",
+                        disks[disknum].path, disks[disknum].minpercent,
+                        percent);
+            errmsg[ sizeof(errmsg)-1 ] = 0;
+        } else
+            errmsg[0] = 0;
+        *var_len = strlen(errmsg);
+        return ((u_char *) (errmsg));
+    }
+#else
+#if HAVE_FSTAB_H
+    /*
+     * read the disk information 
+     */
+    if ((file = open(disks[disknum].device, 0)) < 0) {
+        snmp_log(LOG_ERR, "Couldn't open device %s\n",
+                 disks[disknum].device);
+        setPerrorstatus("open dev/disk");
+        return (NULL);
+    }
+    lseek(file, (long) (SBLOCK * DEV_BSIZE), 0);
+    if (read(file, (char *) &filesys, SBSIZE) != SBSIZE) {
+        setPerrorstatus("open dev/disk");
+        snmp_log(LOG_ERR, "Error reading device %s\n",
+                 disks[disknum].device);
+        close(file);
+        return (NULL);
+    }
+    close(file);
+    totalblks = filesys.fs_dsize;
+    free = filesys.fs_cstotal.cs_nbfree * filesys.fs_frag +
+        filesys.fs_cstotal.cs_nffree;
+    used = totalblks - free;
+    availblks = totalblks * (100 - filesys.fs_minfree) / 100;
+    avail = availblks > used ? availblks - used : 0;
+    percent =
+        availblks ==
+        0 ? 100 : (int) ((double) used / (double) totalblks * 100.0 + 0.5);
+    iserror =
+        (disks[disknum].minimumspace >=
+         0 ? avail * filesys.fs_fsize / 1024 <
+         disks[disknum].minimumspace : 100 - percent <=
+         disks[disknum].minpercent) ? 1 : 0;
+    switch (vp->magic) {
+    case DISKTOTAL:
+        long_ret = (totalblks * filesys.fs_fsize / 1024);
+        return ((u_char *) (&long_ret));
+    case DISKAVAIL:
+        long_ret = avail * filesys.fs_fsize / 1024;
+        return ((u_char *) (&long_ret));
+    case DISKUSED:
+        long_ret = used * filesys.fs_fsize / 1024;
+        return ((u_char *) (&long_ret));
+    case DISKPERCENT:
+        long_ret = percent;
+        return ((u_char *) (&long_ret));
+    case ERRORFLAG:
+        long_ret = iserror;
+        return ((u_char *) (&long_ret));
+    case ERRORMSG:
+        if (iserror) {
+            if (disks[disknum].minimumspace >= 0)
+                snprintf(errmsg, sizeof(errmsg),
+                        "%s: less than %d free (= %d)",
+                        disks[disknum].path, disks[disknum].minimumspace,
+                        avail * filesys.fs_fsize / 1024);
+            else
+                snprintf(errmsg, sizeof(errmsg),
+                        "%s: less than %d%% free (= %d%%)",
+                        disks[disknum].path, disks[disknum].minpercent,
+                        percent);
+            errmsg[ sizeof(errmsg)-1 ] = 0;
+        } else
+            errmsg[0] = 0;
+        *var_len = strlen(errmsg);
+        return ((u_char *) (errmsg));
+    }
+#endif
+#endif
+    return NULL;
+}
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/ucd-snmp/disk.h tomato121/release/src/router/snmp/agent/mibgroup/ucd-snmp/disk.h
--- tomato/release/src/router/snmp/agent/mibgroup/ucd-snmp/disk.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/ucd-snmp/disk.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,38 @@
+/*
+ *  Template MIB group interface - disk.h
+ *
+ */
+#ifndef _MIBGROUP_DISK_H
+#define _MIBGROUP_DISK_H
+
+void            init_disk(void);
+
+config_require(util_funcs)
+
+     extern FindVarMethod var_extensible_disk;
+
+/*
+ * config file parsing routines 
+ */
+     void            disk_free_config(void);
+     void            disk_parse_config(const char *, char *);
+
+#include "mibdefs.h"
+
+#define DISKDEVICE 3
+#define DISKMINIMUM 4
+#define DISKMINPERCENT 5
+#define DISKTOTAL 6
+#define DISKAVAIL 7
+#define DISKUSED 8
+#define DISKPERCENT 9
+#define DISKPERCENTNODE 10
+
+     struct diskpart {
+         char            device[STRMAX];
+         char            path[STRMAX];
+         int             minimumspace;
+         int             minpercent;
+     };
+
+#endif                          /* _MIBGROUP_DISK_H */
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/ucd-snmp/diskio.c tomato121/release/src/router/snmp/agent/mibgroup/ucd-snmp/diskio.c
--- tomato/release/src/router/snmp/agent/mibgroup/ucd-snmp/diskio.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/ucd-snmp/diskio.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,678 @@
+#include <net-snmp/net-snmp-config.h>
+
+/*
+ * needed by util_funcs.h 
+ */
+#if TIME_WITH_SYS_TIME
+# include <sys/time.h>
+# include <time.h>
+#else
+# if HAVE_SYS_TIME_H
+#  include <sys/time.h>
+# else
+#  include <time.h>
+# endif
+#endif
+
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+/*
+ * header_generic() comes from here 
+ */
+#include "util_funcs.h"
+
+/*
+ * include our .h file 
+ */
+#include "diskio.h"
+
+#define CACHE_TIMEOUT 10
+static time_t   cache_time = 0;
+
+#ifdef solaris2
+#include <kstat.h>
+
+#define MAX_DISKS 20
+
+static kstat_ctl_t *kc;
+static kstat_t *ksp;
+static kstat_io_t kio;
+static int      cache_disknr = -1;
+#endif                          /* solaris2 */
+
+#if defined(bsdi3) || defined(bsdi4)
+#include <string.h>
+#include <sys/param.h>
+#include <sys/sysctl.h>
+#include <sys/diskstats.h>
+#endif                          /* bsdi */
+
+#if defined (freebsd4) || defined(freebsd5)
+#include <sys/dkstat.h>
+#include <devstat.h>
+#endif                          /* freebsd */
+
+#if defined (darwin)
+#include <CoreFoundation/CoreFoundation.h>
+#include <IOKit/IOKitLib.h>
+#include <IOKit/storage/IOBlockStorageDriver.h>
+#include <IOKit/storage/IOMedia.h>
+#include <IOKit/IOBSD.h>
+
+static mach_port_t masterPort;		/* to communicate with I/O Kit	*/
+#endif                          /* darwin */
+
+static char     type[20];
+void            diskio_parse_config(const char *, char *);
+FILE           *file;
+
+         /*********************
+	 *
+	 *  Initialisation & common implementation functions
+	 *
+	 *********************/
+
+
+/*
+ * this is an optional function called at the time the agent starts up
+ * to do any initilizations you might require.  You don't have to
+ * create it, as it is optional. 
+ */
+
+/*
+ * IMPORTANT: If you add or remove this function, you *must* re-run
+ * the configure script as it checks for its existance. 
+ */
+
+void
+init_diskio(void)
+{
+    /*
+     * Define a 'variable' structure that is a representation of our mib. 
+     */
+
+    /*
+     * first, we have to pick the variable type.  They are all defined in
+     * the var_struct.h file in the agent subdirectory.  I'm picking the
+     * variable2 structure since the longest sub-component of the oid I
+     * want to load is .2.1 and .2.2 so I need at most 2 spaces in the
+     * last entry. 
+     */
+
+    struct variable2 diskio_variables[] = {
+        {DISKIO_INDEX, ASN_INTEGER, RONLY, var_diskio, 1, {1}},
+        {DISKIO_DEVICE, ASN_OCTET_STR, RONLY, var_diskio, 1, {2}},
+        {DISKIO_NREAD, ASN_COUNTER, RONLY, var_diskio, 1, {3}},
+        {DISKIO_NWRITTEN, ASN_COUNTER, RONLY, var_diskio, 1, {4}},
+        {DISKIO_READS, ASN_COUNTER, RONLY, var_diskio, 1, {5}},
+        {DISKIO_WRITES, ASN_COUNTER, RONLY, var_diskio, 1, {6}},
+    };
+
+    /*
+     * Define the OID pointer to the top of the mib tree that we're
+     * registering underneath. 
+     */
+    oid             diskio_variables_oid[] =
+        { 1, 3, 6, 1, 4, 1, 2021, 13, 15, 1, 1 };
+
+    /*
+     * register ourselves with the agent to handle our mib tree
+     * 
+     * This is a macro defined in ../../snmp_vars.h.  The arguments are:
+     * 
+     * descr:   A short description of the mib group being loaded.
+     * var:     The variable structure to load.
+     * vartype: The variable structure used to define it (variable2, variable4, ...)
+     * theoid:  A *initialized* *exact length* oid pointer.
+     * (sizeof(theoid) *must* return the number of elements!)  
+     */
+    REGISTER_MIB("diskio", diskio_variables, variable2,
+                 diskio_variables_oid);
+
+    /*
+     * Added to parse snmpd.conf - abby
+     */
+    snmpd_register_config_handler("diskio", diskio_parse_config,
+                                  NULL, "diskio [device-type]");
+
+#ifdef solaris2
+    kc = kstat_open();
+
+    if (kc == NULL)
+        snmp_log(LOG_ERR, "diskio: Couln't open kstat\n");
+#endif
+
+#ifdef darwin
+    /*
+     * Get the I/O Kit communication handle.
+     */
+    IOMasterPort(bootstrap_port, &masterPort);
+#endif
+}
+
+void
+diskio_parse_config(const char *token, char *cptr)
+{
+    copy_nword(cptr, type, sizeof(type));
+}
+
+#ifdef solaris2
+int
+get_disk(int disknr)
+{
+    time_t          now;
+    int             i = 0;
+    kstat_t *tksp;
+
+    now = time(NULL);
+    if (disknr == cache_disknr && cache_time + CACHE_TIMEOUT > now) {
+        return 1;
+    }
+
+    /*
+     * could be optimiced by checking if cache_disknr<=disknr
+     * if so, just reread the data - not going through the whole chain
+     * from kc->kc_chain 
+     */
+
+    for (tksp = kc->kc_chain; tksp != NULL; tksp = tksp->ks_next) {
+        if (tksp->ks_type == KSTAT_TYPE_IO
+            && !strcmp(tksp->ks_class, "disk")) {
+            if (i == disknr) {
+                if (kstat_read(kc, tksp, &kio) == -1)
+                    snmp_log(LOG_ERR, "diskio: kstat_read failed\n");
+		ksp = tksp;
+                cache_time = now;
+                cache_disknr = disknr;
+                return 1;
+            } else {
+                i++;
+            }
+        }
+    }
+    return 0;
+}
+
+
+u_char         *
+var_diskio(struct variable * vp,
+           oid * name,
+           size_t * length,
+           int exact, size_t * var_len, WriteMethod ** write_method)
+{
+    /*
+     * define any variables we might return as static! 
+     */
+    static long     long_ret;
+
+    if (header_simple_table
+        (vp, name, length, exact, var_len, write_method, MAX_DISKS))
+        return NULL;
+
+
+    if (get_disk(name[*length - 1] - 1) == 0)
+        return NULL;
+
+
+    /*
+     * We can now simply test on vp's magic number, defined in diskio.h 
+     */
+    switch (vp->magic) {
+    case DISKIO_INDEX:
+        long_ret = (long) name[*length - 1];
+        return (u_char *) & long_ret;
+    case DISKIO_DEVICE:
+        *var_len = strlen(ksp->ks_name);
+        return (u_char *) ksp->ks_name;
+    case DISKIO_NREAD:
+        long_ret = (signed long) kio.nread;
+        return (u_char *) & long_ret;
+    case DISKIO_NWRITTEN:
+        long_ret = (signed long) kio.nwritten;
+        return (u_char *) & long_ret;
+    case DISKIO_READS:
+        long_ret = (signed long) kio.reads;
+        return (u_char *) & long_ret;
+    case DISKIO_WRITES:
+        long_ret = (signed long) kio.writes;
+        return (u_char *) & long_ret;
+
+    default:
+        ERROR_MSG("diskio.c: don't know how to handle this request.");
+    }
+    /*
+     * if we fall to here, fail by returning NULL 
+     */
+    return NULL;
+}
+#endif                          /* solaris2 */
+
+#if defined(bsdi3) || defined(bsdi4)
+static int      ndisk;
+static struct diskstats *dk;
+static char   **dkname;
+
+static int
+getstats(void)
+{
+    time_t          now;
+    int             mib[2];
+    char           *t, *tp;
+    int             size, dkn_size, i;
+
+    now = time(NULL);
+    if (cache_time + CACHE_TIMEOUT > now) {
+        return 1;
+    }
+    mib[0] = CTL_HW;
+    mib[1] = HW_DISKSTATS;
+    size = 0;
+    if (sysctl(mib, 2, NULL, &size, NULL, 0) < 0) {
+        perror("Can't get size of HW_DISKSTATS mib");
+        return 0;
+    }
+    if (ndisk != size / sizeof(*dk)) {
+        if (dk)
+            free(dk);
+        if (dkname) {
+            for (i = 0; i < ndisk; i++)
+                if (dkname[i])
+                    free(dkname[i]);
+            free(dkname);
+        }
+        ndisk = size / sizeof(*dk);
+        if (ndisk == 0)
+            return 0;
+        dkname = malloc(ndisk * sizeof(char *));
+        mib[0] = CTL_HW;
+        mib[1] = HW_DISKNAMES;
+        if (sysctl(mib, 2, NULL, &dkn_size, NULL, 0) < 0) {
+            perror("Can't get size of HW_DISKNAMES mib");
+            return 0;
+        }
+        tp = t = malloc(dkn_size);
+        if (sysctl(mib, 2, t, &dkn_size, NULL, 0) < 0) {
+            perror("Can't get size of HW_DISKNAMES mib");
+            return 0;
+        }
+        for (i = 0; i < ndisk; i++) {
+            dkname[i] = strdup(tp);
+            tp += strlen(tp) + 1;
+        }
+        free(t);
+        dk = malloc(ndisk * sizeof(*dk));
+    }
+    mib[0] = CTL_HW;
+    mib[1] = HW_DISKSTATS;
+    if (sysctl(mib, 2, dk, &size, NULL, 0) < 0) {
+        perror("Can't get HW_DISKSTATS mib");
+        return 0;
+    }
+    cache_time = now;
+    return 1;
+}
+
+u_char         *
+var_diskio(struct variable * vp,
+           oid * name,
+           size_t * length,
+           int exact, size_t * var_len, WriteMethod ** write_method)
+{
+    static long     long_ret;
+    unsigned int    indx;
+
+    if (getstats() == 0)
+        return 0;
+
+    if (header_simple_table
+        (vp, name, length, exact, var_len, write_method, ndisk))
+        return NULL;
+
+    indx = (unsigned int) (name[*length - 1] - 1);
+    if (indx >= ndisk)
+        return NULL;
+
+    switch (vp->magic) {
+    case DISKIO_INDEX:
+        long_ret = (long) indx + 1;
+        return (u_char *) & long_ret;
+    case DISKIO_DEVICE:
+        *var_len = strlen(dkname[indx]);
+        return (u_char *) dkname[indx];
+    case DISKIO_NREAD:
+        long_ret =
+            (signed long) (dk[indx].dk_sectors * dk[indx].dk_secsize);
+        return (u_char *) & long_ret;
+    case DISKIO_NWRITTEN:
+        return NULL;            /* Sigh... BSD doesn't keep seperate track */
+    case DISKIO_READS:
+        long_ret = (signed long) dk[indx].dk_xfers;
+        return (u_char *) & long_ret;
+    case DISKIO_WRITES:
+        return NULL;            /* Sigh... BSD doesn't keep seperate track */
+
+    default:
+        ERROR_MSG("diskio.c: don't know how to handle this request.");
+    }
+    return NULL;
+}
+#endif                          /* bsdi */
+
+#if defined(freebsd4) || defined(freebsd5)
+static int      ndisk;
+static struct statinfo *stat;
+FILE           *file;
+
+static int
+getstats(void)
+{
+    time_t          now;
+    int             i;
+
+    now = time(NULL);
+    if (cache_time + CACHE_TIMEOUT > now) {
+        return 0;
+    }
+    if (stat == NULL) {
+        stat = (struct statinfo *) malloc(sizeof(struct statinfo));
+        stat->dinfo = (struct devinfo *) malloc(sizeof(struct devinfo));
+    }
+    memset(stat->dinfo, 0, sizeof(struct devinfo));
+
+    if ((getdevs(stat)) == -1) {
+        fprintf(stderr, "Can't get devices:%s\n", devstat_errbuf);
+        return 1;
+    }
+    ndisk = stat->dinfo->numdevs;
+    /* Gross hack to include device numbers in the device name array */
+    for (i = 0; i < ndisk; i++) {
+      char *cp = stat->dinfo->devices[i].device_name;
+      int len = strlen(cp);
+      if (len > DEVSTAT_NAME_LEN - 3)
+        len -= 3;
+      cp += len;
+      sprintf(cp, "%d", stat->dinfo->devices[i].unit_number);
+    }
+    cache_time = now;
+    return 0;
+}
+
+u_char         *
+var_diskio(struct variable * vp,
+           oid * name,
+           size_t * length,
+           int exact, size_t * var_len, WriteMethod ** write_method)
+{
+    static long     long_ret;
+    unsigned int    indx;
+
+    if (getstats() == 1) {
+        return NULL;
+    }
+
+
+    if (header_simple_table
+        (vp, name, length, exact, var_len, write_method, ndisk)) {
+        return NULL;
+    }
+
+    indx = (unsigned int) (name[*length - 1] - 1);
+
+    if (indx >= ndisk)
+        return NULL;
+
+    switch (vp->magic) {
+    case DISKIO_INDEX:
+        long_ret = (long) indx + 1;;
+        return (u_char *) & long_ret;
+    case DISKIO_DEVICE:
+        *var_len = strlen(stat->dinfo->devices[indx].device_name);
+        return (u_char *) stat->dinfo->devices[indx].device_name;
+    case DISKIO_NREAD:
+        long_ret = (signed long) stat->dinfo->devices[indx].bytes_read;
+        return (u_char *) & long_ret;
+    case DISKIO_NWRITTEN:
+        long_ret = (signed long) stat->dinfo->devices[indx].bytes_written;
+        return (u_char *) & long_ret;
+    case DISKIO_READS:
+        long_ret = (signed long) stat->dinfo->devices[indx].num_reads;
+        return (u_char *) & long_ret;
+    case DISKIO_WRITES:
+        long_ret = (signed long) stat->dinfo->devices[indx].num_writes;
+        return (u_char *) & long_ret;
+
+    default:
+        ERROR_MSG("diskio.c: don't know how to handle this request.");
+    }
+    return NULL;
+}
+#endif                          /* freebsd4 */
+
+#if defined(darwin)
+
+#define MAXDRIVES	16	/* most drives we will record */
+#define MAXDRIVENAME	31	/* largest drive name we allow */
+
+#define kIDXBytesRead		0	/* used as index into the stats array in a drivestats struct */
+#define kIDXBytesWritten	1
+#define kIDXNumReads		2
+#define kIDXNumWrites		3
+#define kIDXLast		3
+
+struct drivestats {
+    char name[MAXDRIVENAME + 1];
+    long bsd_unit_number;
+    long stats[kIDXLast+1];
+};
+
+static struct drivestats drivestat[MAXDRIVES];
+
+static mach_port_t masterPort;		/* to communicate with I/O Kit	*/
+
+static int num_drives;			/* number of drives detected	*/
+
+static int
+collect_drive_stats(io_registry_entry_t driver, long *stats)
+{
+    CFNumberRef     number;
+    CFDictionaryRef properties;
+    CFDictionaryRef statistics;
+    long            value;
+    kern_return_t   status;
+    int             i;
+
+
+    /*
+     * If the drive goes away, we may not get any properties
+     * for it.  So take some defaults. Nb: use memset ??
+     */
+    for (i = 0; i < kIDXLast; i++) {
+	stats[i] = 0;
+    }
+
+    /* retrieve the properties */
+    status = IORegistryEntryCreateCFProperties(driver, (CFMutableDictionaryRef *)&properties,
+					       kCFAllocatorDefault, kNilOptions);
+    if (status != KERN_SUCCESS) {
+	snmp_log(LOG_ERR, "diskio: device has no properties\n");
+/*	fprintf(stderr, "device has no properties\n"); */
+	return (1);
+    }
+
+    /* retrieve statistics from properties */
+    statistics = (CFDictionaryRef)CFDictionaryGetValue(properties,
+						       CFSTR(kIOBlockStorageDriverStatisticsKey));
+    if (statistics) {
+
+	/* Now hand me the crystals. */
+	if ((number = (CFNumberRef)CFDictionaryGetValue(statistics,
+						 CFSTR(kIOBlockStorageDriverStatisticsBytesReadKey)))) {
+	    CFNumberGetValue(number, kCFNumberSInt32Type, &value);
+	    stats[kIDXBytesRead] = value;
+	}
+
+	if ((number = (CFNumberRef)CFDictionaryGetValue(statistics,
+						 CFSTR(kIOBlockStorageDriverStatisticsBytesWrittenKey)))) {
+	    CFNumberGetValue(number, kCFNumberSInt32Type, &value);
+	    stats[kIDXBytesWritten] = value;
+	}
+
+	if ((number = (CFNumberRef)CFDictionaryGetValue(statistics,
+						 CFSTR(kIOBlockStorageDriverStatisticsReadsKey)))) {
+	    CFNumberGetValue(number, kCFNumberSInt32Type, &value);
+	    stats[kIDXNumReads] = value;
+	}
+	if ((number = (CFNumberRef)CFDictionaryGetValue(statistics,
+						 CFSTR(kIOBlockStorageDriverStatisticsWritesKey)))) {
+	    CFNumberGetValue(number, kCFNumberSInt32Type, &value);
+	    stats[kIDXNumWrites] = value;
+	}
+    }
+    /* we're done with the properties, release them */
+    CFRelease(properties);
+    return (0);
+}
+
+/*
+ * Check whether an IORegistryEntry refers to a valid
+ * I/O device, and if so, collect the information.
+ */
+static int
+handle_drive(io_registry_entry_t drive, struct drivestats * dstat)
+{
+    io_registry_entry_t parent;
+    CFDictionaryRef     properties;
+    CFStringRef         name;
+    CFNumberRef         number;
+    kern_return_t       status;
+
+    /* get drive's parent */
+    status = IORegistryEntryGetParentEntry(drive, kIOServicePlane, &parent);
+    if (status != KERN_SUCCESS) {
+	snmp_log(LOG_ERR, "diskio: device has no parent\n");
+/*	fprintf(stderr, "device has no parent\n"); */
+	return(1);
+    }
+
+    if (IOObjectConformsTo(parent, "IOBlockStorageDriver")) {
+
+	/* get drive properties */
+	status = IORegistryEntryCreateCFProperties(drive, (CFMutableDictionaryRef *)&properties,
+					    kCFAllocatorDefault, kNilOptions);
+	if (status != KERN_SUCCESS) {
+	    snmp_log(LOG_ERR, "diskio: device has no properties\n");
+/*	    fprintf(stderr, "device has no properties\n"); */
+	    return(1);
+	}
+
+	/* get BSD name and unitnumber from properties */
+	name = (CFStringRef)CFDictionaryGetValue(properties,
+					  CFSTR(kIOBSDNameKey));
+	number = (CFNumberRef)CFDictionaryGetValue(properties,
+					    CFSTR(kIOBSDUnitKey));
+
+	/* Collect stats and if succesful store them with the name and unitnumber */
+	if (!collect_drive_stats(parent, dstat->stats)) {
+
+	    CFStringGetCString(name, dstat->name, MAXDRIVENAME, CFStringGetSystemEncoding());
+	    CFNumberGetValue(number, kCFNumberSInt32Type, &dstat->bsd_unit_number);
+	    num_drives++;
+	}
+
+	/* clean up, return success */
+	CFRelease(properties);
+	return(0);
+    }
+
+    /* failed, don't keep parent */
+    IOObjectRelease(parent);
+    return(1);
+}
+
+static int
+getstats(void)
+{
+    time_t                 now;
+    io_iterator_t          drivelist;
+    io_registry_entry_t    drive;
+    CFMutableDictionaryRef match;
+    kern_return_t          status;
+
+    now = time(NULL);	/* register current time and check wether cache can be used */
+    if (cache_time + CACHE_TIMEOUT > now) {
+        return 0;
+    }
+
+    /*  Retrieve a list of drives. */
+    match = IOServiceMatching("IOMedia");
+    CFDictionaryAddValue(match, CFSTR(kIOMediaWholeKey), kCFBooleanTrue);
+    status = IOServiceGetMatchingServices(masterPort, match, &drivelist);
+    if (status != KERN_SUCCESS) {
+	snmp_log(LOG_ERR, "diskio: couldn't match whole IOMedia devices\n");
+/*	fprintf(stderr,"Couldn't match whole IOMedia devices\n"); */
+	return(1);
+    }
+
+    num_drives = 0;  /* NB: Incremented by handle_drive */
+    while ((drive = IOIteratorNext(drivelist)) && (num_drives < MAXDRIVES)) {
+	handle_drive(drive, &drivestat[num_drives]);
+	IOObjectRelease(drive);
+    }
+    IOObjectRelease(drivelist);
+
+    cache_time = now;
+    return (0);
+}
+
+u_char         *
+var_diskio(struct variable * vp,
+           oid * name,
+           size_t * length,
+           int exact, size_t * var_len, WriteMethod ** write_method)
+{
+    static long     long_ret;
+    unsigned int    indx;
+
+    if (getstats() == 1) {
+        return NULL;
+    }
+
+
+    if (header_simple_table
+        (vp, name, length, exact, var_len, write_method, num_drives)) {
+        return NULL;
+    }
+
+    indx = (unsigned int) (name[*length - 1] - 1);
+
+    if (indx >= num_drives)
+        return NULL;
+
+    switch (vp->magic) {
+	case DISKIO_INDEX:
+	    long_ret = (long) drivestat[indx].bsd_unit_number;
+	    return (u_char *) & long_ret;
+	case DISKIO_DEVICE:
+	    *var_len = strlen(drivestat[indx].name);
+	    return (u_char *) drivestat[indx].name;
+	case DISKIO_NREAD:
+	    long_ret = (signed long) drivestat[indx].stats[kIDXBytesRead];
+	    return (u_char *) & long_ret;
+	case DISKIO_NWRITTEN:
+	    long_ret = (signed long) drivestat[indx].stats[kIDXBytesWritten];
+	    return (u_char *) & long_ret;
+	case DISKIO_READS:
+	    long_ret = (signed long) drivestat[indx].stats[kIDXNumReads];
+	    return (u_char *) & long_ret;
+	case DISKIO_WRITES:
+	    long_ret = (signed long) drivestat[indx].stats[kIDXNumWrites];
+	    return (u_char *) & long_ret;
+
+	default:
+	    ERROR_MSG("diskio.c: don't know how to handle this request.");
+    }
+    return NULL;
+}
+#endif                          /* darwin */
+
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/ucd-snmp/diskio.h tomato121/release/src/router/snmp/agent/mibgroup/ucd-snmp/diskio.h
--- tomato/release/src/router/snmp/agent/mibgroup/ucd-snmp/diskio.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/ucd-snmp/diskio.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,33 @@
+#ifndef _MIBGROUP_DISKIO_H
+#define _MIBGROUP_DISKIO_H
+
+config_require(util_funcs)
+config_add_mib(UCD-DISKIO-MIB)
+
+    /*
+     * Define all our functions using prototyping for ANSI compilers 
+     */
+    /*
+     * These functions are then defined in the example.c file 
+     */
+     void            init_diskio(void);
+     FindVarMethod   var_diskio;
+
+
+/*
+ * Magic number definitions.  These numbers are the last oid index
+ * numbers to the table that you are going to define.  For example,
+ * lets say (since we are) creating a mib table at the location
+ * .1.3.6.1.4.1.2021.254.  The following magic numbers would be the
+ * next numbers on that oid for the var_example function to use, ie:
+ * .1.3.6.1.4.1.2021.254.1 (and .2 and .3 ...) 
+ */
+
+#define	DISKIO_INDEX		1
+#define DISKIO_DEVICE		2
+#define DISKIO_NREAD		3
+#define DISKIO_NWRITTEN		4
+#define DISKIO_READS		5
+#define DISKIO_WRITES		6
+
+#endif                          /* _MIBGROUP_DISKIO_H */
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/ucd-snmp/dlmod.c tomato121/release/src/router/snmp/agent/mibgroup/ucd-snmp/dlmod.c
--- tomato/release/src/router/snmp/agent/mibgroup/ucd-snmp/dlmod.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/ucd-snmp/dlmod.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,590 @@
+/*
+ *  Dynamic Loadable Agent Modules MIB (UCD-DLMOD-MIB) - dlmod.c
+ *
+ */
+#include <net-snmp/net-snmp-config.h>
+
+#if HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#include <stdio.h>
+#if HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+#if HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#include <ctype.h>
+
+#if HAVE_WINSOCK_H
+#include <winsock.h>
+#endif
+
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+#include "struct.h"
+#include "util_funcs.h"
+
+#if defined(HAVE_DLFCN_H) && defined(HAVE_DLOPEN)
+
+#include <dlfcn.h>
+#include "dlmod.h"
+
+static struct dlmod *dlmods = NULL;
+static int      dlmod_next_index = 1;
+static char     dlmod_path[1024];
+
+static void     dlmod_parse_config(const char *, char *);
+static void     dlmod_free_config(void);
+
+/*
+ * this variable defines function callbacks and type return
+ * information for the dlmod mib
+ */
+static struct variable4 dlmod_variables[] = {
+    {DLMODNEXTINDEX, ASN_INTEGER, RONLY, var_dlmod, 1, {1}},
+    {DLMODNAME, ASN_OCTET_STR, RWRITE, var_dlmodEntry, 3, {2, 1, 2}},
+    {DLMODPATH, ASN_OCTET_STR, RWRITE, var_dlmodEntry, 3, {2, 1, 3}},
+    {DLMODERROR, ASN_OCTET_STR, RONLY, var_dlmodEntry, 3, {2, 1, 4}},
+    {DLMODSTATUS, ASN_INTEGER, RWRITE, var_dlmodEntry, 3, {2, 1, 5}},
+};
+
+static oid      dlmod_variables_oid[] = { 1, 3, 6, 1, 4, 1, 2021, 13, 14 };
+static int      dlmod_variables_oid_len = 9;
+
+void
+init_dlmod(void)
+{
+    char           *p;
+    int             len;
+
+    REGISTER_MIB("dlmod", dlmod_variables, variable4, dlmod_variables_oid);
+
+    /*
+     * TODO: REGISTER_SYSOR_ENTRY 
+     */
+
+    DEBUGMSGTL(("dlmod", "register mib\n"));
+
+    snmpd_register_config_handler("dlmod", dlmod_parse_config,
+                                  dlmod_free_config,
+                                  "module-name module-path");
+
+    p = getenv("SNMPDLMODPATH");
+    strncpy(dlmod_path, SNMPDLMODPATH, sizeof(dlmod_path));
+    dlmod_path[ sizeof(dlmod_path)-1 ] = 0;
+    if (p) {
+        if (p[0] == ':') {
+            len = strlen(dlmod_path);
+            if (dlmod_path[len - 1] != ':') {
+                strncat(dlmod_path, ":", sizeof(dlmod_path) - len -1);
+                len++;
+            }
+            strncat(dlmod_path, p + 1,   sizeof(dlmod_path) - len);
+        } else
+            strncpy(dlmod_path, p, sizeof(dlmod_path));
+    }
+    dlmod_path[ sizeof(dlmod_path)-1 ] = 0;
+    DEBUGMSGTL(("dlmod", "dlmod_path: %s\n", dlmod_path));
+}
+
+void
+deinit_dlmod(void)
+{
+    unregister_mib(dlmod_variables_oid, dlmod_variables_oid_len);
+    snmpd_unregister_config_handler("dlmod");
+}
+
+struct dlmod   *
+dlmod_create_module(void)
+{
+    struct dlmod  **pdlmod, *dlm;
+
+    DEBUGMSGTL(("dlmod", "dlmod_create_module\n"));
+    dlm = (struct dlmod *) calloc(1, sizeof(struct dlmod));
+    if (dlm == NULL)
+        return NULL;
+
+    dlm->index = dlmod_next_index++;
+    dlm->status = DLMOD_UNLOADED;
+
+    for (pdlmod = &dlmods; *pdlmod != NULL; pdlmod = &((*pdlmod)->next));
+    (*pdlmod) = dlm;
+
+    return dlm;
+}
+
+void
+dlmod_delete_module(struct dlmod *dlm)
+{
+    struct dlmod  **pdlmod;
+
+    DEBUGMSGTL(("dlmod", "dlmod_delete_module\n"));
+    if (!dlm || dlm->status != DLMOD_UNLOADED)
+        return;
+
+    for (pdlmod = &dlmods; *pdlmod; pdlmod = &((*pdlmod)->next))
+        if (*pdlmod == dlm) {
+            *pdlmod = dlm->next;
+            free(dlm);
+            return;
+        }
+}
+
+void
+dlmod_load_module(struct dlmod *dlm)
+{
+    char            sym_init[64];
+    char           *p, tmp_path[255];
+    int             (*dl_init) (void);
+
+    DEBUGMSGTL(("dlmod", "dlmod_load_module %s: %s\n", dlm->name,
+                dlm->path));
+
+    if (!dlm || !dlm->path || !dlm->name ||
+        (dlm->status != DLMOD_UNLOADED && dlm->status != DLMOD_ERROR))
+        return;
+
+    if (dlm->path[0] == '/') {
+#ifdef RTLD_NOW
+        dlm->handle = dlopen(dlm->path, RTLD_NOW);
+#else
+        dlm->handle = dlopen(dlm->path, RTLD_LAZY);
+#endif
+        if (dlm->handle == NULL) {
+            snprintf(dlm->error, sizeof(dlm->error),
+                     "dlopen failed: %s", dlerror());
+            dlm->status = DLMOD_ERROR;
+            return;
+        }
+    } else {
+        for (p = strtok(dlmod_path, ":"); p; p = strtok(NULL, ":")) {
+            snprintf(tmp_path, sizeof(tmp_path), "%s/%s.so", p, dlm->path);
+            DEBUGMSGTL(("dlmod", "p: %s tmp_path: %s\n", p, tmp_path));
+#ifdef RTLD_NOW
+            dlm->handle = dlopen(tmp_path, RTLD_NOW);
+#else
+            dlm->handle = dlopen(tmp_path, RTLD_LAZY);
+#endif
+            if (dlm->handle == NULL) {
+                snprintf(dlm->error, sizeof(dlm->error),
+                         "dlopen failed: %s", dlerror());
+                dlm->status = DLMOD_ERROR;
+            }
+        }
+        strncpy(dlm->path, tmp_path, sizeof(dlm->path));
+        if (dlm->status == DLMOD_ERROR)
+            return;
+    }
+    snprintf(sym_init, sizeof(sym_init), "init_%s", dlm->name);
+    dl_init = dlsym(dlm->handle, sym_init);
+    if (dl_init == NULL) {
+        dlclose(dlm->handle);
+        snprintf(dlm->error, sizeof(dlm->error),
+                 "dlsym failed: can't find \'%s\'", sym_init);
+        dlm->status = DLMOD_ERROR;
+        return;
+    }
+
+    dl_init();
+    dlm->error[0] = '\0';
+    dlm->status = DLMOD_LOADED;
+}
+
+void
+dlmod_unload_module(struct dlmod *dlm)
+{
+    char            sym_deinit[64];
+    int             (*dl_deinit) (void);
+
+    if (!dlm || dlm->status != DLMOD_LOADED)
+        return;
+
+    snprintf(sym_deinit, sizeof(sym_deinit), "deinit_%s", dlm->name);
+    dl_deinit = dlsym(dlm->handle, sym_deinit);
+    if (dl_deinit == NULL) {
+        snprintf(dlm->error, sizeof(dlm->error),
+                 "dlsym failed: can't find \'%s\'", sym_deinit);
+    } else {
+        dl_deinit();
+    }
+    dlclose(dlm->handle);
+    dlm->status = DLMOD_UNLOADED;
+    DEBUGMSGTL(("dlmod", "Module %s unloaded\n", dlm->name));
+}
+
+struct dlmod   *
+dlmod_get_by_index(int iindex)
+{
+    struct dlmod   *dlmod;
+
+    for (dlmod = dlmods; dlmod; dlmod = dlmod->next)
+        if (dlmod->index == iindex)
+            return dlmod;
+
+    return NULL;
+}
+
+static void
+dlmod_parse_config(const char *token, char *cptr)
+{
+    char           *dlm_name, *dlm_path;
+    struct dlmod   *dlm;
+
+    if (cptr == NULL) {
+        config_perror("Bad dlmod line");
+        return;
+    }
+    /*
+     * remove comments 
+     */
+    *(cptr + strcspn(cptr, "#;\r\n")) = '\0';
+
+    dlm = dlmod_create_module();
+    if (!dlm)
+        return;
+
+    /*
+     * dynamic module name 
+     */
+    dlm_name = strtok(cptr, "\t ");
+    if (dlm_name == NULL) {
+        config_perror("Bad dlmod line");
+        dlmod_delete_module(dlm);
+        return;
+    }
+    strncpy(dlm->name, dlm_name, sizeof(dlm->name));
+
+    /*
+     * dynamic module path 
+     */
+    dlm_path = strtok(NULL, "\t ");
+    if (dlm_path)
+        strncpy(dlm->path, dlm_path, sizeof(dlm->path));
+    else
+        strncpy(dlm->path, dlm_name, sizeof(dlm->path));
+
+    dlmod_load_module(dlm);
+
+    if (dlm->status == DLMOD_ERROR)
+        snmp_log(LOG_ERR, "%s\n", dlm->error);
+}
+
+static void
+dlmod_free_config(void)
+{
+    struct dlmod   *dtmp, *dtmp2;
+
+    for (dtmp = dlmods; dtmp != NULL;) {
+        dtmp2 = dtmp;
+        dtmp = dtmp->next;
+        dlmod_unload_module(dtmp2);
+        free(dtmp2);
+    }
+    dlmods = NULL;
+}
+
+
+/*
+ * header_dlmod(...
+ * Arguments:
+ * vp     IN      - pointer to variable entry that points here
+ * name    IN/OUT  - IN/name requested, OUT/name found
+ * length  IN/OUT  - length of IN/OUT oid's 
+ * exact   IN      - TRUE if an exact match was requested
+ * var_len OUT     - length of variable or 0 if function returned
+ * write_method
+ */
+
+static int
+header_dlmod(struct variable *vp,
+             oid * name,
+             size_t * length,
+             int exact, size_t * var_len, WriteMethod ** write_method)
+{
+#define DLMOD_NAME_LENGTH 10
+    oid             newname[MAX_OID_LEN];
+    int             result;
+
+    memcpy((char *) newname, (char *) vp->name,
+           (int) vp->namelen * sizeof(oid));
+    newname[DLMOD_NAME_LENGTH] = 0;
+
+    result =
+        snmp_oid_compare(name, *length, newname, (int) vp->namelen + 1);
+    if ((exact && (result != 0)) || (!exact && (result >= 0))) {
+        return MATCH_FAILED;
+    }
+
+    memcpy((char *) name, (char *) newname,
+           ((int) vp->namelen + 1) * sizeof(oid));
+    *length = vp->namelen + 1;
+    *write_method = 0;
+    *var_len = sizeof(long);    /* default to 'long' results */
+    return MATCH_SUCCEEDED;
+}
+
+
+u_char         *
+var_dlmod(struct variable * vp,
+          oid * name,
+          size_t * length,
+          int exact, size_t * var_len, WriteMethod ** write_method)
+{
+
+    /*
+     * variables we may use later 
+     */
+
+    *write_method = 0;          /* assume it isnt writable for the time being */
+    *var_len = sizeof(int);     /* assume an integer and change later
+                                 * if not */
+
+    if (header_dlmod(vp, name, length, exact,
+                     var_len, write_method) == MATCH_FAILED)
+        return 0;
+
+    /*
+     * this is where we do the value assignments for the mib results. 
+     */
+    switch (vp->magic) {
+    case DLMODNEXTINDEX:
+        long_return = dlmod_next_index;
+        return (unsigned char *) &long_return;
+    default:
+        DEBUGMSGTL(("dlmod", "unknown sub-id %d in var_dlmod\n",
+                    vp->magic));
+    }
+    return 0;
+}
+
+
+/*
+ * header_dlmodEntry(...
+ * Arguments:
+ * vp     IN      - pointer to variable entry that points here
+ * name    IN/OUT  - IN/name requested, OUT/name found
+ * length  IN/OUT  - length of IN/OUT oid's 
+ * exact   IN      - TRUE if an exact match was requested
+ * var_len OUT     - length of variable or 0 if function returned
+ * write_method
+ * 
+ */
+
+
+static struct dlmod *
+header_dlmodEntry(struct variable *vp,
+                  oid * name,
+                  size_t * length,
+                  int exact, size_t * var_len, WriteMethod ** write_method)
+{
+#define DLMODENTRY_NAME_LENGTH 12
+    oid             newname[MAX_OID_LEN];
+    int             result;
+    struct dlmod   *dlm = 0;
+    int             dlmod_index;
+
+    memcpy((char *) newname, (char *) vp->name,
+           (int) vp->namelen * sizeof(oid));
+    *write_method = 0;
+
+    for (dlmod_index = 1; dlmod_index < dlmod_next_index; dlmod_index++) {
+        dlm = dlmod_get_by_index(dlmod_index);
+
+        DEBUGMSGTL(("dlmod", "dlmodEntry dlm: %x dlmod_index: %d\n",
+                    (int) dlm, dlmod_index));
+
+        if (dlm) {
+            newname[12] = dlmod_index;
+            result = snmp_oid_compare(name, *length, newname,
+                                      (int) vp->namelen + 1);
+
+            if ((exact && (result == 0)) || (!exact && (result < 0)))
+                break;
+        }
+    }
+
+    if (dlmod_index >= dlmod_next_index) {
+        if (dlmod_index == dlmod_next_index &&
+            exact && vp->magic == DLMODSTATUS)
+
+            *write_method = write_dlmodStatus;
+        return NULL;
+    }
+
+    memcpy((char *) name, (char *) newname,
+           ((int) vp->namelen + 1) * sizeof(oid));
+    *length = vp->namelen + 1;
+    *var_len = sizeof(long);
+    return dlm;
+}
+
+u_char         *
+var_dlmodEntry(struct variable * vp,
+               oid * name,
+               size_t * length,
+               int exact, size_t * var_len, WriteMethod ** write_method)
+{
+    /*
+     * variables we may use later 
+     */
+    struct dlmod   *dlm;
+
+    *var_len = sizeof(int);     /* assume an integer and change later
+                                 * if not */
+
+    dlm =
+        header_dlmodEntry(vp, name, length, exact, var_len, write_method);
+    if (dlm == NULL)
+        return 0;
+
+    /*
+     * this is where we do the value assignments for the mib results. 
+     */
+    switch (vp->magic) {
+    case DLMODNAME:
+        *write_method = write_dlmodName;
+        *var_len = strlen(dlm->name);
+        return (unsigned char *) dlm->name;
+    case DLMODPATH:
+        *write_method = write_dlmodPath;
+        *var_len = strlen(dlm->path);
+        return (unsigned char *) dlm->path;
+    case DLMODERROR:
+        *var_len = strlen(dlm->error);
+        return (unsigned char *) dlm->error;
+    case DLMODSTATUS:
+        *write_method = write_dlmodStatus;
+        long_return = dlm->status;
+        return (unsigned char *) &long_return;
+    default:
+        DEBUGMSGTL(("dlmod", "unknown sub-id %d in var_dlmodEntry\n",
+                    vp->magic));
+    }
+    return 0;
+}
+
+int
+write_dlmodName(int action,
+                u_char * var_val,
+                u_char var_val_type,
+                size_t var_val_len,
+                u_char * statP, oid * name, size_t name_len)
+{
+    static struct dlmod *dlm;
+
+    if (var_val_type != ASN_OCTET_STR) {
+        snmp_log(LOG_ERR, "write to dlmodName not ASN_OCTET_STR\n");
+        return SNMP_ERR_WRONGTYPE;
+    }
+    if (var_val_len > sizeof(dlm->name)) {
+        snmp_log(LOG_ERR, "write to dlmodName: bad length\n");
+        return SNMP_ERR_WRONGLENGTH;
+    }
+    if (action == COMMIT) {
+        dlm = dlmod_get_by_index(name[12]);
+        if (!dlm || dlm->status == DLMOD_LOADED)
+            return SNMP_ERR_RESOURCEUNAVAILABLE;
+        strncpy(dlm->name, (const char *) var_val, var_val_len);
+        dlm->name[var_val_len] = 0;
+    }
+    return SNMP_ERR_NOERROR;
+}
+
+int
+write_dlmodPath(int action,
+                u_char * var_val,
+                u_char var_val_type,
+                size_t var_val_len,
+                u_char * statP, oid * name, size_t name_len)
+{
+    static struct dlmod *dlm;
+
+    if (var_val_type != ASN_OCTET_STR) {
+        snmp_log(LOG_ERR, "write to dlmodPath not ASN_OCTET_STR\n");
+        return SNMP_ERR_WRONGTYPE;
+    }
+    if (var_val_len > sizeof(dlm->path)) {
+        snmp_log(LOG_ERR, "write to dlmodPath: bad length\n");
+        return SNMP_ERR_WRONGLENGTH;
+    }
+    if (action == COMMIT) {
+        dlm = dlmod_get_by_index(name[12]);
+        if (!dlm || dlm->status == DLMOD_LOADED)
+            return SNMP_ERR_RESOURCEUNAVAILABLE;
+        strncpy(dlm->path, (const char *) var_val, var_val_len);
+        dlm->path[var_val_len] = 0;
+    }
+    return SNMP_ERR_NOERROR;
+}
+
+int
+write_dlmodStatus(int action,
+                  u_char * var_val,
+                  u_char var_val_type,
+                  size_t var_val_len,
+                  u_char * statP, oid * name, size_t name_len)
+{
+    /*
+     * variables we may use later 
+     */
+    struct dlmod   *dlm;
+
+    if (var_val_type != ASN_INTEGER) {
+        snmp_log(LOG_ERR, "write to dlmodStatus not ASN_INTEGER\n");
+        return SNMP_ERR_WRONGTYPE;
+    }
+    if (var_val_len > sizeof(long)) {
+        snmp_log(LOG_ERR, "write to dlmodStatus: bad length\n");
+        return SNMP_ERR_WRONGLENGTH;
+    }
+    if (action == COMMIT) {
+        /*
+         * object identifier in form .1.3.6.1.4.1.2021.13.14.2.1.4.x 
+         * where X is index with offset 12 
+         */
+
+        dlm = dlmod_get_by_index(name[12]);
+        switch (*((long *) var_val)) {
+        case DLMOD_CREATE:
+            if (dlm || (name[12] != dlmod_next_index))
+                return SNMP_ERR_RESOURCEUNAVAILABLE;
+            dlm = dlmod_create_module();
+            if (!dlm)
+                return SNMP_ERR_RESOURCEUNAVAILABLE;
+            break;
+        case DLMOD_LOAD:
+            if (!dlm || dlm->status == DLMOD_LOADED)
+                return SNMP_ERR_RESOURCEUNAVAILABLE;
+            dlmod_load_module(dlm);
+            break;
+        case DLMOD_UNLOAD:
+            if (!dlm || dlm->status != DLMOD_LOADED)
+                return SNMP_ERR_RESOURCEUNAVAILABLE;
+            dlmod_unload_module(dlm);
+            break;
+        case DLMOD_DELETE:
+            if (!dlm || dlm->status == DLMOD_LOADED)
+                return SNMP_ERR_RESOURCEUNAVAILABLE;
+            dlmod_delete_module(dlm);
+            break;
+        default:
+            return SNMP_ERR_WRONGVALUE;
+        }
+    }
+    return SNMP_ERR_NOERROR;
+}
+
+#else                           /* no dlopen support */
+
+void
+init_dlmod(void)
+{
+    DEBUGMSGTL(("dlmod",
+                "Dynamic modules not support on this platform\n"));
+}
+
+#endif
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/ucd-snmp/dlmod.h tomato121/release/src/router/snmp/agent/mibgroup/ucd-snmp/dlmod.h
--- tomato/release/src/router/snmp/agent/mibgroup/ucd-snmp/dlmod.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/ucd-snmp/dlmod.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,60 @@
+/*
+ *  Dynamic Loadable Agent Modules MIB (UCD-DLMOD-MIB) - dlmod.h
+ *
+ */
+
+#ifndef _MIBGROUP_DLMOD_H
+#define _MIBGROUP_DLMOD_H
+
+/*
+ * TODO #include "mibdefs.h" 
+ */
+
+config_add_mib(UCD-DLMOD-MIB)
+#ifndef SNMPDLMODPATH
+#define SNMPDLMODPATH "/usr/local/lib/snmp/dlmod"
+#endif
+     struct dlmod {
+         struct dlmod   *next;
+         int             index;
+         char            name[64 + 1];
+         char            path[255 + 1];
+         char            error[255 + 1];
+         void           *handle;
+         int             status;
+     };
+
+     void            dlmod_load_module(struct dlmod *);
+     void            dlmod_unload_module(struct dlmod *);
+     struct dlmod   *dlmod_create_module(void);
+     void            dlmod_delete_module(struct dlmod *);
+     struct dlmod   *dlmod_get_by_index(int);
+
+     void            dlmod_init(void);
+     void            dlmod_deinit(void);
+
+     extern void     init_dlmod(void);
+     extern void     deinit_dlmod(void);
+
+     extern FindVarMethod var_dlmod;
+     extern FindVarMethod var_dlmodEntry;
+     extern WriteMethod write_dlmodName;
+     extern WriteMethod write_dlmodPath;
+     extern WriteMethod write_dlmodStatus;
+
+#define DLMODNEXTINDEX 		1
+#define DLMODINDEX     		2
+#define DLMODNAME      		3
+#define DLMODPATH      		4
+#define DLMODERROR     		5
+#define DLMODSTATUS    		6
+
+#define DLMOD_LOADED		1
+#define DLMOD_UNLOADED		2
+#define DLMOD_ERROR		3
+#define DLMOD_LOAD		4
+#define	DLMOD_UNLOAD		5
+#define DLMOD_CREATE		6
+#define DLMOD_DELETE		7
+
+#endif                          /* _MIBGROUP_DLMOD_H */
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/ucd-snmp/errormib.c tomato121/release/src/router/snmp/agent/mibgroup/ucd-snmp/errormib.c
--- tomato/release/src/router/snmp/agent/mibgroup/ucd-snmp/errormib.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/ucd-snmp/errormib.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,240 @@
+#include <net-snmp/net-snmp-config.h>
+
+#if HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#if HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#if HAVE_FCNTL_H
+#include <fcntl.h>
+#endif
+#include <signal.h>
+#if TIME_WITH_SYS_TIME
+# ifdef WIN32
+#  include <sys/timeb.h>
+# else
+#  include <sys/time.h>
+# endif
+# include <time.h>
+#else
+# if HAVE_SYS_TIME_H
+#  include <sys/time.h>
+# else
+#  include <time.h>
+# endif
+#endif
+#if HAVE_MACHINE_PARAM_H
+#include <machine/param.h>
+#endif
+#if HAVE_SYS_PARAM_H
+#include <sys/param.h>
+#endif
+#if HAVE_SYS_VMMETER_H
+#if !(defined(bsdi2) || defined(netbsd1))
+#include <sys/vmmeter.h>
+#endif
+#endif
+#if HAVE_SYS_CONF_H
+#include <sys/conf.h>
+#endif
+#if HAVE_ASM_PAGE_H
+#include <asm/page.h>
+#endif
+#if HAVE_SYS_SWAP_H
+#include <sys/swap.h>
+#endif
+#if HAVE_SYS_FS_H
+#include <sys/fs.h>
+#else
+#if HAVE_UFS_FS_H
+#include <ufs/fs.h>
+#else
+#ifdef HAVE_SYS_STAT_H
+#include <sys/stat.h>
+#endif
+#ifdef HAVE_SYS_VNODE_H
+#include <sys/vnode.h>
+#endif
+#ifdef HAVE_UFS_UFS_QUOTA_H
+#include <ufs/ufs/quota.h>
+#endif
+#ifdef HAVE_UFS_UFS_INODE_H
+#include <ufs/ufs/inode.h>
+#endif
+#if HAVE_UFS_FFS_FS_H
+#include <ufs/ffs/fs.h>
+#endif
+#endif
+#endif
+#if HAVE_MTAB_H
+#include <mtab.h>
+#endif
+#include <sys/stat.h>
+#include <errno.h>
+#if HAVE_FSTAB_H
+#include <fstab.h>
+#endif
+#if HAVE_SYS_STATFS_H
+#include <sys/statfs.h>
+#endif
+#if HAVE_SYS_STATVFS_H
+#include <sys/statvfs.h>
+#endif
+#if HAVE_SYS_VFS_H
+#include <sys/vfs.h>
+#endif
+#if (!defined(HAVE_STATVFS)) && defined(HAVE_STATFS)
+#if HAVE_SYS_PARAM_H
+#include <sys/param.h>
+#endif
+#if HAVE_SYS_MOUNT_H
+#include <sys/mount.h>
+#endif
+#if HAVE_SYS_SYSCTL_H
+#include <sys/sysctl.h>
+#endif
+#define statvfs statfs
+#endif
+#if HAVE_VM_VM_H
+#include <vm/vm.h>
+#endif
+#if HAVE_VM_SWAP_PAGER_H
+#include <vm/swap_pager.h>
+#endif
+#if HAVE_SYS_FIXPOINT_H
+#include <sys/fixpoint.h>
+#endif
+#if HAVE_MALLOC_H
+#include <malloc.h>
+#endif
+#if HAVE_STRING_H
+#include <string.h>
+#endif
+#if HAVE_WINSOCK_H
+#include <winsock.h>
+#endif
+
+#if HAVE_DMALLOC_H
+#include <dmalloc.h>
+#endif
+
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include <net-snmp/agent/auto_nlist.h>
+
+#include "struct.h"
+#include "errormib.h"
+#include "util_funcs.h"
+
+static time_t   errorstatustime = 0;
+static int      errorstatusprior = 0;
+static char     errorstring[STRMAX];
+
+void
+setPerrorstatus(const char *to)
+{
+    char            buf[STRMAX];
+
+    snprintf(buf, sizeof(buf), "%s:  %s", to, strerror(errno));
+    buf[ sizeof(buf)-1 ] = 0;
+    snmp_log_perror(to);
+    seterrorstatus(buf, 5);
+}
+
+void
+seterrorstatus(const char *to, int prior)
+{
+    if (errorstatusprior <= prior ||
+        (ERRORTIMELENGTH < (time(NULL) - errorstatustime))) {
+        strncpy(errorstring, to, sizeof(errorstring));
+        errorstring[ sizeof(errorstring)-1 ] = 0;
+        errorstatusprior = prior;
+        errorstatustime = time(NULL);
+    }
+}
+
+void
+init_errormib(void)
+{
+
+    /*
+     * define the structure we're going to ask the agent to register our
+     * information at 
+     */
+    struct variable2 extensible_error_variables[] = {
+        {MIBINDEX, ASN_INTEGER, RONLY, var_extensible_errors, 1,
+         {MIBINDEX}},
+        {ERRORNAME, ASN_OCTET_STR, RONLY, var_extensible_errors, 1,
+         {ERRORNAME}},
+        {ERRORFLAG, ASN_INTEGER, RONLY, var_extensible_errors, 1,
+         {ERRORFLAG}},
+        {ERRORMSG, ASN_OCTET_STR, RONLY, var_extensible_errors, 1,
+         {ERRORMSG}}
+    };
+
+    /*
+     * Define the OID pointer to the top of the mib tree that we're
+     * registering underneath 
+     */
+    oid             extensible_error_variables_oid[] =
+        { UCDAVIS_MIB, ERRORMIBNUM };
+
+    /*
+     * register ourselves with the agent to handle our mib tree 
+     */
+    REGISTER_MIB("ucd-snmp/errormib", extensible_error_variables,
+                 variable2, extensible_error_variables_oid);
+}
+
+/*
+ * var_extensible_errors(...
+ * Arguments:
+ * vp     IN      - pointer to variable entry that points here
+ * name    IN/OUT  - IN/name requested, OUT/name found
+ * length  IN/OUT  - length of IN/OUT oid's 
+ * exact   IN      - TRUE if an exact match was requested
+ * var_len OUT     - length of variable or 0 if function returned
+ * write_method
+ * 
+ */
+u_char         *
+var_extensible_errors(struct variable *vp,
+                      oid * name,
+                      size_t * length,
+                      int exact,
+                      size_t * var_len, WriteMethod ** write_method)
+{
+
+    static long     long_ret;
+    static char     errmsg[300];
+
+
+    if (header_generic(vp, name, length, exact, var_len, write_method))
+        return (NULL);
+
+    errmsg[0] = 0;
+
+    switch (vp->magic) {
+    case MIBINDEX:
+        long_ret = name[*length - 1];
+        return ((u_char *) (&long_ret));
+    case ERRORNAME:
+        strcpy(errmsg, "snmp");
+        *var_len = strlen(errmsg);
+        return ((u_char *) errmsg);
+    case ERRORFLAG:
+        long_ret =
+            (ERRORTIMELENGTH >= time(NULL) - errorstatustime) ? 1 : 0;
+        return ((u_char *) (&long_ret));
+    case ERRORMSG:
+        if ((ERRORTIMELENGTH >= time(NULL) - errorstatustime) ? 1 : 0) {
+            strncpy(errmsg, errorstring, sizeof(errmsg));
+            errmsg[ sizeof(errmsg)-1 ] = 0;
+        } else
+            errmsg[0] = 0;
+        *var_len = strlen(errmsg);
+        return ((u_char *) errmsg);
+    }
+    return NULL;
+}
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/ucd-snmp/errormib.h tomato121/release/src/router/snmp/agent/mibgroup/ucd-snmp/errormib.h
--- tomato/release/src/router/snmp/agent/mibgroup/ucd-snmp/errormib.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/ucd-snmp/errormib.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,17 @@
+/*
+ *  Errormibess watching mib group
+ */
+#ifndef _MIBGROUP_ERRORMIB_H
+#define _MIBGROUP_ERRORMIB_H
+
+void            init_errormib(void);
+
+config_require(util_funcs)
+
+     void            setPerrorstatus(const char *);
+     void            seterrorstatus(const char *, int);
+     extern FindVarMethod var_extensible_errors;
+
+#include "mibdefs.h"
+
+#endif                          /* _MIBGROUP_ERRORMIB_H */
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/ucd-snmp/extensible.c tomato121/release/src/router/snmp/agent/mibgroup/ucd-snmp/extensible.c
--- tomato/release/src/router/snmp/agent/mibgroup/ucd-snmp/extensible.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/ucd-snmp/extensible.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,598 @@
+#include <net-snmp/net-snmp-config.h>
+
+#if HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#if HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#if HAVE_FCNTL_H
+#include <fcntl.h>
+#endif
+#if TIME_WITH_SYS_TIME
+# ifdef WIN32
+#  include <sys/timeb.h>
+# else
+#  include <sys/time.h>
+# endif
+# include <time.h>
+#else
+# if HAVE_SYS_TIME_H
+#  include <sys/time.h>
+# else
+#  include <time.h>
+# endif
+#endif
+#include <signal.h>
+#if HAVE_MACHINE_PARAM_H
+#include <machine/param.h>
+#endif
+#if HAVE_SYS_PARAM_H
+#include <sys/param.h>
+#endif
+#if HAVE_SYS_VMMETER_H
+#if !(defined(bsdi2) || defined(netbsd1))
+#include <sys/vmmeter.h>
+#endif
+#endif
+#if HAVE_SYS_CONF_H
+#include <sys/conf.h>
+#endif
+#if HAVE_ASM_PAGE_H
+#include <asm/page.h>
+#endif
+#if HAVE_SYS_SWAP_H
+#include <sys/swap.h>
+#endif
+#if HAVE_SYS_FS_H
+#include <sys/fs.h>
+#else
+#if HAVE_UFS_FS_H
+#include <ufs/fs.h>
+#else
+#if HAVE_UFS_UFS_DINODE_H
+#include <ufs/ufs/dinode.h>
+#endif
+#if HAVE_UFS_FFS_FS_H
+#include <ufs/ffs/fs.h>
+#endif
+#endif
+#endif
+#if HAVE_MTAB_H
+#include <mtab.h>
+#endif
+#include <sys/stat.h>
+#include <errno.h>
+#if HAVE_FSTAB_H
+#include <fstab.h>
+#endif
+#if HAVE_SYS_STATFS_H
+#include <sys/statfs.h>
+#endif
+#if HAVE_SYS_STATVFS_H
+#include <sys/statvfs.h>
+#endif
+#if HAVE_SYS_VFS_H
+#include <sys/vfs.h>
+#endif
+#if (!defined(HAVE_STATVFS)) && defined(HAVE_STATFS)
+#if HAVE_SYS_MOUNT_H
+#include <sys/mount.h>
+#endif
+#if HAVE_SYS_SYSCTL_H
+#include <sys/sysctl.h>
+#endif
+#define statvfs statfs
+#endif
+#if HAVE_VM_VM_H
+#include <vm/vm.h>
+#endif
+#if HAVE_VM_SWAP_PAGER_H
+#include <vm/swap_pager.h>
+#endif
+#if HAVE_SYS_FIXPOINT_H
+#include <sys/fixpoint.h>
+#endif
+#if HAVE_MALLOC_H
+#include <malloc.h>
+#endif
+#if HAVE_STRING_H
+#include <string.h>
+#endif
+#include <ctype.h>
+#if HAVE_WINSOCK_H
+#include <winsock.h>
+#endif
+#ifndef HAVE_STRNCASECMP
+int             strncasecmp(const char *s1, const char *s2, size_t n);
+#endif
+
+#if HAVE_DMALLOC_H
+#include <dmalloc.h>
+#endif
+
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include <net-snmp/agent/auto_nlist.h>
+
+#include "struct.h"
+#include "extensible.h"
+#include "util_funcs.h"
+
+extern struct myproc *procwatch;        /* moved to proc.c */
+extern int      numprocs;       /* ditto */
+extern struct extensible *extens;       /* In exec.c */
+extern struct extensible *relocs;       /* In exec.c */
+extern int      numextens;      /* ditto */
+extern int      numrelocs;      /* ditto */
+extern struct extensible *passthrus;    /* In pass.c */
+extern int      numpassthrus;   /* ditto */
+extern char     sysName[];
+extern netsnmp_subtree *subtrees;
+extern struct variable2 extensible_relocatable_variables[];
+extern struct variable2 extensible_passthru_variables[];
+
+void
+init_extensible(void)
+{
+
+    struct variable2 extensible_extensible_variables[] = {
+        {MIBINDEX, ASN_INTEGER, RONLY, var_extensible_shell, 1,
+         {MIBINDEX}},
+        {ERRORNAME, ASN_OCTET_STR, RONLY, var_extensible_shell, 1,
+         {ERRORNAME}},
+        {SHELLCOMMAND, ASN_OCTET_STR, RONLY, var_extensible_shell, 1,
+         {SHELLCOMMAND}},
+        {ERRORFLAG, ASN_INTEGER, RONLY, var_extensible_shell, 1,
+         {ERRORFLAG}},
+        {ERRORMSG, ASN_OCTET_STR, RONLY, var_extensible_shell, 1,
+         {ERRORMSG}},
+        {ERRORFIX, ASN_INTEGER, RWRITE, var_extensible_shell, 1,
+         {ERRORFIX}},
+        {ERRORFIXCMD, ASN_OCTET_STR, RONLY, var_extensible_shell, 1,
+         {ERRORFIXCMD}}
+    };
+
+    /*
+     * Define the OID pointer to the top of the mib tree that we're
+     * registering underneath 
+     */
+    oid             extensible_variables_oid[] =
+        { UCDAVIS_MIB, SHELLMIBNUM, 1 };
+
+    /*
+     * register ourselves with the agent to handle our mib tree 
+     */
+    REGISTER_MIB("ucd-snmp/extensible", extensible_extensible_variables,
+                 variable2, extensible_variables_oid);
+
+    snmpd_register_config_handler("exec", extensible_parse_config,
+                                  extensible_free_config,
+                                  "[miboid] name program arguments");
+    snmpd_register_config_handler("sh", extensible_parse_config,
+                                  extensible_free_config,
+                                  "[miboid] name program-or-script arguments");
+    snmpd_register_config_handler("execfix", execfix_parse_config, NULL,
+                                  "exec-or-sh-name program [arguments...]");
+}
+
+void
+extensible_parse_config(const char *token, char *cptr)
+{
+    struct extensible *ptmp, **pp;
+    char           *tcptr;
+
+    /*
+     * allocate and clear memory structure 
+     */
+    ptmp = (struct extensible *) calloc(1, sizeof(struct extensible));
+    if (ptmp == NULL)
+        return;                 /* XXX memory alloc error */
+
+    if (*cptr == '.')
+        cptr++;
+    if (isdigit(*cptr)) {
+        /*
+         * its a relocatable extensible mib 
+         */
+        for (pp = &relocs, numrelocs++; *pp; pp = &((*pp)->next));
+        (*pp) = ptmp;
+    } else {
+        /*
+         * it goes in with the general extensible table 
+         */
+        for (pp = &extens, numextens++; *pp; pp = &((*pp)->next));
+        (*pp) = ptmp;
+    }
+
+    /*
+     * the rest is pretty much handled the same 
+     */
+    if (!strncasecmp(token, "sh", 2))
+        ptmp->type = SHPROC;
+    else
+        ptmp->type = EXECPROC;
+    if (isdigit(*cptr)) {
+        ptmp->miblen = parse_miboid(cptr, ptmp->miboid);
+        while (isdigit(*cptr) || *cptr == '.')
+            cptr++;
+    }
+
+    /*
+     * name 
+     */
+    cptr = skip_white(cptr);
+    copy_nword(cptr, ptmp->name, sizeof(ptmp->name));
+    cptr = skip_not_white(cptr);
+    cptr = skip_white(cptr);
+    /*
+     * command 
+     */
+    if (cptr == NULL) {
+        config_perror("No command specified on line");
+    } else {
+        for (tcptr = cptr; *tcptr != 0 && *tcptr != '#' && *tcptr != ';';
+             tcptr++);
+        strncpy(ptmp->command, cptr, tcptr - cptr);
+        ptmp->command[tcptr - cptr] = 0;
+    }
+#ifdef EXECFIXCMD
+    sprintf(ptmp->fixcmd, EXECFIXCMD, ptmp->name);
+#endif
+    if (ptmp->miblen > 0) {
+        register_mib(token,
+                     (struct variable *) extensible_relocatable_variables,
+                     sizeof(struct variable2), 6, ptmp->miboid,
+                     ptmp->miblen);
+    }
+}
+
+void
+extensible_free_config(void)
+{
+    struct extensible *etmp, *etmp2;
+
+    for (etmp = extens; etmp != NULL;) {
+        etmp2 = etmp;
+        etmp = etmp->next;
+        free(etmp2);
+    }
+
+    for (etmp = relocs; etmp != NULL;) {
+        etmp2 = etmp;
+        etmp = etmp->next;
+        unregister_mib(etmp2->miboid, etmp2->miblen);
+        free(etmp2);
+    }
+
+    relocs = NULL;
+    extens = NULL;
+    numextens = 0;
+    numrelocs = 0;
+}
+
+
+struct extensible *
+get_exten_instance(struct extensible *exten, size_t inst)
+{
+    int             i;
+
+    if (exten == NULL)
+        return (NULL);
+    for (i = 1; i != (int) inst && exten != NULL; i++)
+        exten = exten->next;
+    return (exten);
+}
+
+#define MAXMSGLINES 1000
+
+struct extensible *extens = NULL;       /* In exec.c */
+struct extensible *relocs = NULL;       /* In exec.c */
+int             numextens = 0, numrelocs = 0;   /* ditto */
+
+
+/*
+ * var_extensible_shell(...
+ * Arguments:
+ * vp     IN      - pointer to variable entry that points here
+ * name    IN/OUT  - IN/name requested, OUT/name found
+ * length  IN/OUT  - length of IN/OUT oid's 
+ * exact   IN      - TRUE if an exact match was requested
+ * var_len OUT     - length of variable or 0 if function returned
+ * write_method
+ * 
+ */
+
+/*
+ * find a give entry in the linked list associated with a proc name 
+ */
+struct extensible *
+get_exec_by_name(char *name)
+{
+    struct extensible *etmp;
+
+    if (name == NULL)
+        return NULL;
+
+    for (etmp = extens; etmp != NULL && strcmp(etmp->name, name) != 0;
+         etmp = etmp->next);
+    return etmp;
+}
+
+void
+execfix_parse_config(const char *token, char *cptr)
+{
+    char            tmpname[STRMAX];
+    struct extensible *execp;
+
+    /*
+     * don't allow two entries with the same name 
+     */
+    cptr = copy_nword(cptr, tmpname, sizeof(tmpname));
+    if ((execp = get_exec_by_name(tmpname)) == NULL) {
+        config_perror("No exec entry registered for this exec name yet.");
+        return;
+    }
+
+    if (strlen(cptr) > sizeof(execp->fixcmd)) {
+        config_perror("fix command too long.");
+        return;
+    }
+
+    strncpy(execp->fixcmd, cptr, sizeof(execp->fixcmd));
+    execp->fixcmd[ sizeof(execp->fixcmd)-1 ] = 0;
+}
+
+u_char         *
+var_extensible_shell(struct variable * vp,
+                     oid * name,
+                     size_t * length,
+                     int exact,
+                     size_t * var_len, WriteMethod ** write_method)
+{
+
+    static struct extensible *exten = 0;
+    static long     long_ret;
+
+    if (header_simple_table
+        (vp, name, length, exact, var_len, write_method, numextens))
+        return (NULL);
+
+    if ((exten = get_exten_instance(extens, name[*length - 1]))) {
+        switch (vp->magic) {
+        case MIBINDEX:
+            long_ret = name[*length - 1];
+            return ((u_char *) (&long_ret));
+        case ERRORNAME:        /* name defined in config file */
+            *var_len = strlen(exten->name);
+            return ((u_char *) (exten->name));
+        case SHELLCOMMAND:
+            *var_len = strlen(exten->command);
+            return ((u_char *) (exten->command));
+        case ERRORFLAG:        /* return code from the process */
+            if (exten->type == EXECPROC)
+                exec_command(exten);
+            else
+                shell_command(exten);
+            long_ret = exten->result;
+            return ((u_char *) (&long_ret));
+        case ERRORMSG:         /* first line of text returned from the process */
+            if (exten->type == EXECPROC)
+                exec_command(exten);
+            else
+                shell_command(exten);
+            *var_len = strlen(exten->output);
+            if (exten->output[*var_len - 1] == '\n')
+                exten->output[--(*var_len)] = '\0';
+            return ((u_char *) (exten->output));
+        case ERRORFIX:
+            *write_method = fixExecError;
+            long_return = 0;
+            return ((u_char *) & long_return);
+
+        case ERRORFIXCMD:
+            *var_len = strlen(exten->fixcmd);
+            return ((u_char *) exten->fixcmd);
+        }
+        return NULL;
+    }
+    return NULL;
+}
+
+int
+fixExecError(int action,
+             u_char * var_val,
+             u_char var_val_type,
+             size_t var_val_len,
+             u_char * statP, oid * name, size_t name_len)
+{
+
+    struct extensible *exten;
+    long            tmp = 0;
+    int             fd;
+    static struct extensible ex;
+    FILE           *file;
+
+    if ((exten = get_exten_instance(extens, name[10]))) {
+        if (var_val_type != ASN_INTEGER) {
+            snmp_log(LOG_ERR, "Wrong type != int\n");
+            return SNMP_ERR_WRONGTYPE;
+        }
+        tmp = *((long *) var_val);
+        if ((tmp == 1) && (action == COMMIT) && (exten->fixcmd[0] != 0)) {
+            sprintf(ex.command, exten->fixcmd);
+            if ((fd = get_exec_output(&ex)) != -1) {
+                file = fdopen(fd, "r");
+                while (fgets(ex.output, sizeof(ex.output), file) != NULL);
+                fclose(file);
+                wait_on_exec(&ex);
+            }
+        }
+        return SNMP_ERR_NOERROR;
+    }
+    return SNMP_ERR_WRONGTYPE;
+}
+
+/*
+ * the relocatable extensible commands variables 
+ */
+struct variable2 extensible_relocatable_variables[] = {
+    {MIBINDEX, ASN_INTEGER, RONLY, var_extensible_relocatable, 1,
+     {MIBINDEX}},
+    {ERRORNAME, ASN_OCTET_STR, RONLY, var_extensible_relocatable, 1,
+     {ERRORNAME}},
+    {SHELLCOMMAND, ASN_OCTET_STR, RONLY, var_extensible_relocatable, 1,
+     {SHELLCOMMAND}},
+    {ERRORFLAG, ASN_INTEGER, RONLY, var_extensible_relocatable, 1,
+     {ERRORFLAG}},
+    {ERRORMSG, ASN_OCTET_STR, RONLY, var_extensible_relocatable, 1,
+     {ERRORMSG}},
+    {ERRORFIX, ASN_INTEGER, RWRITE, var_extensible_relocatable, 1,
+     {ERRORFIX}}
+};
+
+u_char         *
+var_extensible_relocatable(struct variable *vp,
+                           oid * name,
+                           size_t * length,
+                           int exact,
+                           size_t * var_len, WriteMethod ** write_method)
+{
+
+    int             fd;
+    int             i;
+    FILE           *file;
+    struct extensible *exten = 0;
+    static long     long_ret;
+    static char     errmsg[STRMAX];
+    struct variable myvp;
+    oid             tname[MAX_OID_LEN];
+
+    memcpy(&myvp, vp, sizeof(struct variable));
+
+    long_ret = *length;
+    for (i = 1; i <= (int) numrelocs; i++) {
+        exten = get_exten_instance(relocs, i);
+        if ((int) exten->miblen == (int) vp->namelen - 1) {
+            memcpy(myvp.name, exten->miboid, exten->miblen * sizeof(oid));
+            myvp.namelen = exten->miblen;
+            *length = vp->namelen;
+            memcpy(tname, vp->name, vp->namelen * sizeof(oid));
+            if (!header_simple_table
+                (&myvp, tname, length, -1, var_len, write_method, -1))
+                break;
+            else
+                exten = NULL;
+        }
+    }
+    if (i > (int) numrelocs || exten == NULL) {
+        *length = long_ret;
+        *var_len = 0;
+        *write_method = NULL;
+        return (NULL);
+    }
+
+    *length = long_ret;
+    if (header_simple_table(vp, name, length, exact, var_len, write_method,
+                            ((vp->magic == ERRORMSG) ? MAXMSGLINES : 1)))
+        return (NULL);
+
+    switch (vp->magic) {
+    case MIBINDEX:
+        long_ret = name[*length - 1];
+        return ((u_char *) (&long_ret));
+    case ERRORNAME:            /* name defined in config file */
+        *var_len = strlen(exten->name);
+        return ((u_char *) (exten->name));
+    case SHELLCOMMAND:
+        *var_len = strlen(exten->command);
+        return ((u_char *) (exten->command));
+    case ERRORFLAG:            /* return code from the process */
+        if (exten->type == EXECPROC)
+            exec_command(exten);
+        else
+            shell_command(exten);
+        long_ret = exten->result;
+        return ((u_char *) (&long_ret));
+    case ERRORMSG:             /* first line of text returned from the process */
+        if (exten->type == EXECPROC) {
+            if ((fd = get_exec_output(exten)) != -1) {
+                file = fdopen(fd, "r");
+                for (i = 0; i != (int) name[*length - 1]; i++) {
+                    if (fgets(errmsg, sizeof(errmsg), file) == NULL) {
+                        *var_len = 0;
+                        fclose(file);
+                        wait_on_exec(exten);
+                        return (NULL);
+                    }
+                }
+                fclose(file);
+                wait_on_exec(exten);
+            } else
+                errmsg[0] = 0;
+        } else {
+            if (*length > 1) {
+                *var_len = 0;
+                return (NULL);
+            }
+            shell_command(exten);
+            strncpy(errmsg, exten->output, sizeof(errmsg));
+            errmsg[ sizeof(errmsg)-1 ] = 0;
+        }
+        *var_len = strlen(errmsg);
+        if (errmsg[*var_len - 1] == '\n')
+            errmsg[--(*var_len)] = '\0';
+        return ((u_char *) (errmsg));
+    case ERRORFIX:
+        *write_method = fixExecError;
+        long_return = 0;
+        return ((u_char *) & long_return);
+    }
+    return NULL;
+}
+
+netsnmp_subtree *
+find_extensible(netsnmp_subtree *tp, oid *tname, size_t tnamelen, int exact)
+{
+    size_t          tmp;
+    int             i;
+    struct extensible *exten = 0;
+    struct variable myvp;
+    oid             name[MAX_OID_LEN];
+    static netsnmp_subtree mysubtree[2] =
+	{ { NULL, 0, NULL, 0, NULL, 0, NULL, 0, 0, NULL, NULL, 0, 0, 0,
+	    NULL, NULL, NULL, 0, 0, NULL, 0, 0 },
+	  { NULL, 0, NULL, 0, NULL, 0, NULL, 0, 0, NULL, NULL, 0, 0, 0,
+	    NULL, NULL, NULL, 0, 0, NULL, 0, 0 } };
+
+    for (i = 1; i <= (int) numrelocs; i++) {
+        exten = get_exten_instance(relocs, i);
+        if (exten->miblen != 0) {
+            memcpy(myvp.name, exten->miboid, exten->miblen * sizeof(oid));
+            memcpy(name, tname, tnamelen * sizeof(oid));
+            myvp.name[exten->miblen] = name[exten->miblen];
+            myvp.namelen = exten->miblen + 1;
+            tmp = exten->miblen + 1;
+            if (!header_simple_table(&myvp, name, &tmp, -1, 
+				     NULL, NULL, numrelocs)) {
+                break;
+	    }
+        }
+    }
+    if (i > (int)numrelocs || exten == NULL) {
+        return (tp);
+    }
+
+    if (mysubtree[0].name_a != NULL) {
+	free(mysubtree[0].name_a);
+	mysubtree[0].name_a = NULL;
+    }
+    mysubtree[0].name_a  = snmp_duplicate_objid(exten->miboid, exten->miblen);
+    mysubtree[0].namelen = exten->miblen;
+    mysubtree[0].variables = (struct variable *)extensible_relocatable_variables;
+    mysubtree[0].variables_len = sizeof(extensible_relocatable_variables) /
+        sizeof(*extensible_relocatable_variables);
+    mysubtree[0].variables_width = sizeof(*extensible_relocatable_variables);
+    mysubtree[1].namelen = 0;
+    return (mysubtree);
+}
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/ucd-snmp/extensible.h tomato121/release/src/router/snmp/agent/mibgroup/ucd-snmp/extensible.h
--- tomato/release/src/router/snmp/agent/mibgroup/ucd-snmp/extensible.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/ucd-snmp/extensible.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,31 @@
+/*
+ *  Template MIB group interface - extensible.h
+ *
+ */
+#ifndef _MIBGROUP_EXTENSIBLE_H
+#define _MIBGROUP_EXTENSIBLE_H
+
+void            init_extensible(void);
+
+config_require(util_funcs)
+
+     struct extensible *get_exten_instance(struct extensible *, size_t);
+     extern FindVarMethod var_extensible_shell;
+     extern WriteMethod fixExecError;
+     extern FindVarMethod var_extensible_relocatable;
+     netsnmp_subtree *find_extensible(netsnmp_subtree *, oid *, size_t, int);
+
+/*
+ * config file parsing routines 
+ */
+     void            extensible_free_config(void);
+     void            extensible_parse_config(const char *, char *);
+     void            execfix_parse_config(const char *, char *);
+
+#include "mibdefs.h"
+
+#define SHELLCOMMAND 3
+#define SHELLRESULT 6
+#define SHELLOUTPUT 7
+
+#endif                          /* _MIBGROUP_EXTENSIBLE_H */
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/ucd-snmp/file.c tomato121/release/src/router/snmp/agent/mibgroup/ucd-snmp/file.c
--- tomato/release/src/router/snmp/agent/mibgroup/ucd-snmp/file.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/ucd-snmp/file.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,190 @@
+/* Portions of this file are subject to the following copyrights.  See
+ * the Net-SNMP's COPYING file for more details and other copyrights
+ * that may apply:
+ */
+/*
+ * Copyright © 2003 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms specified in the COPYING file
+ * distributed with the Net-SNMP package.
+ */
+#include <net-snmp/net-snmp-config.h>
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#if TIME_WITH_SYS_TIME
+# ifdef WIN32
+#  include <sys/timeb.h>
+# else
+#  include <sys/time.h>
+# endif
+# include <time.h>
+#else
+# if HAVE_SYS_TIME_H
+#  include <sys/time.h>
+# else
+#  include <time.h>
+# endif
+#endif
+#if HAVE_WINSOCK_H
+#include <winsock.h>
+#endif
+#if HAVE_STRING_H
+#include <string.h>
+#endif
+
+#if HAVE_STRING_H
+#include <string.h>
+#endif
+
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+#include "struct.h"
+#include "file.h"
+#include "util_funcs.h"
+
+#if HAVE_DMALLOC_H
+#include <dmalloc.h>
+#endif
+
+#define MAXFILE   20
+
+struct filestat fileTable[MAXFILE];
+int             fileCount;
+
+void
+init_file(void)
+{
+    struct variable2 file_table[] = {
+        {FILE_INDEX, ASN_INTEGER, RONLY, var_file_table, 1, {1}},
+        {FILE_NAME, ASN_OCTET_STR, RONLY, var_file_table, 1, {2}},
+        {FILE_SIZE, ASN_INTEGER, RONLY, var_file_table, 1, {3}},
+        {FILE_MAX, ASN_INTEGER, RONLY, var_file_table, 1, {4}},
+        {FILE_ERROR, ASN_INTEGER, RONLY, var_file_table, 1, {100}},
+        {FILE_MSG, ASN_OCTET_STR, RONLY, var_file_table, 1, {101}}
+    };
+
+    /*
+     * Define the OID pointer to the top of the mib tree that we're
+     * registering underneath 
+     */
+    oid             file_variables_oid[] = { UCDAVIS_MIB, 15, 1 };
+
+    /*
+     * register ourselves with the agent to handle our mib tree 
+     */
+    REGISTER_MIB("ucd-snmp/file", file_table, variable2,
+                 file_variables_oid);
+
+    snmpd_register_config_handler("file", file_parse_config,
+                                  file_free_config, "file [maxsize]");
+
+}
+
+void
+file_free_config(void)
+{
+    fileCount = 0;
+}
+
+void
+file_parse_config(const char *token, char *cptr)
+{
+    char space;
+	
+    if (fileCount < MAXFILE) {
+        fileTable[fileCount].max = -1;
+
+        sscanf(cptr, "%255s%c%d",
+               fileTable[fileCount].name, &space, &fileTable[fileCount].max);
+	/*
+	 * Log an error then return if the string scanned in was larger then
+	 * it should have been.
+	 */
+	if (space != ' ') {
+		snmp_log(LOG_ERR, "file_parse_config: file name scanned " \
+		    "in from line %s is too large.  fileCount = %d\n", cptr,
+		    fileCount);
+		return;
+	}
+
+        fileCount++;
+    }
+}
+
+void
+updateFile(int iindex)
+{
+    struct stat     sb;
+
+    if (stat(fileTable[iindex].name, &sb) == 0)
+        fileTable[iindex].size = sb.st_size >> 10;
+}
+
+/*
+ * OID functions 
+ */
+
+u_char         *
+var_file_table(struct variable *vp,
+               oid * name,
+               size_t * length,
+               int exact, size_t * var_len, WriteMethod ** write_method)
+{
+    static long     long_ret;
+    static char     error[256];
+    int             iindex;
+    struct filestat *file;
+
+    if (header_simple_table
+        (vp, name, length, exact, var_len, write_method, fileCount))
+        return (NULL);
+
+    iindex = name[*length - 1] - 1;
+
+    updateFile(iindex);
+
+    file = &fileTable[iindex];
+
+    switch (vp->magic) {
+    case FILE_INDEX:
+        long_ret = iindex + 1;
+        return (u_char *) & long_ret;
+
+    case FILE_NAME:
+        *var_len = strlen(file->name);
+        return (u_char *) file->name;
+
+    case FILE_SIZE:
+        long_ret = file->size;
+        return (u_char *) & long_ret;
+
+    case FILE_MAX:
+        long_ret = file->max;
+        return (u_char *) & long_ret;
+
+    case FILE_ERROR:
+        if (file->max >= 0 && file->size > file->max)
+            long_ret = 1;
+        else
+            long_ret = 0;
+
+        return (u_char *) & long_ret;
+
+    case FILE_MSG:
+        if (file->max >= 0 && file->size > file->max)
+            snprintf(error, sizeof(error), FILE_ERROR_MSG, file->name,
+		file->max, file->size);
+        else
+            strcpy(error, "");
+
+        *var_len = strlen(error);
+        return (u_char *) error;
+
+    default:
+        DEBUGMSGTL(("snmpd", "unknown sub-id %d in var_file_table\n",
+                    vp->magic));
+    }
+
+    return NULL;
+}
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/ucd-snmp/file.h tomato121/release/src/router/snmp/agent/mibgroup/ucd-snmp/file.h
--- tomato/release/src/router/snmp/agent/mibgroup/ucd-snmp/file.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/ucd-snmp/file.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,34 @@
+/*
+ *  Template MIB group interface - file.h
+ *
+ */
+#ifndef _MIBGROUP_FILE_H
+#define _MIBGROUP_FILE_H
+
+#include "mibdefs.h"
+
+void            init_file(void);
+
+/*
+ * config file parsing routines 
+ */
+void            file_free_config(void);
+void            file_parse_config(const char *, char *);
+extern FindVarMethod var_file_table;
+
+struct filestat {
+    char            name[256];
+    int             size;
+    int             max;
+};
+
+#define FILE_ERROR_MSG  "%s: size exceeds %dkb (= %dkb)"
+
+#define FILE_INDEX      1
+#define FILE_NAME       2
+#define FILE_SIZE       3
+#define FILE_MAX        4
+#define FILE_ERROR      100
+#define FILE_MSG        101
+
+#endif                          /* _MIBGROUP_FILE_H */
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/ucd-snmp/hpux.c tomato121/release/src/router/snmp/agent/mibgroup/ucd-snmp/hpux.c
--- tomato/release/src/router/snmp/agent/mibgroup/ucd-snmp/hpux.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/ucd-snmp/hpux.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,119 @@
+/*
+ * HP specific stuff that OpenView recognizes 
+ */
+
+#include <net-snmp/net-snmp-config.h>
+
+#include <signal.h>
+#if HAVE_MACHINE_PARAM_H
+#include <machine/param.h>
+#endif
+#if HAVE_SYS_VMMETER_H
+#include <sys/vmmeter.h>
+#endif
+#if HAVE_STRING_H
+#include <string.h>
+#endif
+
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+#include "hpux.h"
+#include "mibdefs.h"
+
+void
+int_hpux(void)
+{
+
+    /*
+     * define the structure we're going to ask the agent to register our
+     * information at 
+     */
+    struct variable2 hp_variables[] = {
+        {HPCONF, ASN_INTEGER, RWRITE, var_hp, 1, {HPCONF}},
+        {HPRECONFIG, ASN_INTEGER, RWRITE, var_hp, 1, {HPRECONFIG}},
+        {HPFLAG, ASN_INTEGER, RWRITE, var_hp, 1, {HPFLAG}},
+        {HPLOGMASK, ASN_INTEGER, RWRITE, var_hp, 1, {ERRORFLAG}},
+        {HPSTATUS, ASN_INTEGER, RWRITE, var_hp, 1, {ERRORMSG}}
+    };
+
+    struct variable2 hptrap_variables[] = {
+        {HPTRAP, ASN_IPADDRESS, RWRITE, var_hp, 1, {HPTRAP}},
+    };
+
+    /*
+     * Define the OID pointer to the top of the mib tree that we're
+     * registering underneath 
+     */
+    oid             hp_variables_oid[] =
+        { 1, 3, 6, 1, 4, 1, 11, 2, 13, 1, 2, 1 };
+    oid             hptrap_variables_oid[] =
+        { 1, 3, 6, 1, 4, 1, 11, 2, 13, 2 };
+
+    /*
+     * register ourselves with the agent to handle our mib tree 
+     */
+    REGISTER_MIB("ucd-snmp/hpux:hp", hp_variables, variable2,
+                 hp_variables_oid);
+    REGISTER_MIB("ucd-snmp/hpux:hptrap", hptrap_variables, variable2,
+                 hptrap_variables_oid);
+
+}
+
+
+#ifdef RESERVED_FOR_FUTURE_USE
+int
+writeHP(int action,
+        u_char * var_val,
+        u_char var_val_type,
+        int var_val_len, u_char * statP, oid * name, int name_len)
+{
+    DODEBUG("Gotto:  writeHP\n");
+    return SNMP_ERR_NOERROR;
+}
+#endif
+
+unsigned char  *
+var_hp(struct variable *vp,
+       oid * name,
+       size_t * length,
+       int exact, size_t * var_len, WriteMethod ** write_method)
+{
+
+    oid             newname[MAX_OID_LEN];
+    int             result;
+    static long     long_ret;
+
+    memcpy((char *) newname, (char *) vp->name,
+           (int) vp->namelen * sizeof(oid));
+    newname[*length] = 0;
+    result =
+        snmp_oid_compare(name, *length, newname, (int) vp->namelen + 1);
+    if ((exact && (result != 0)) || (!exact && (result >= 0)))
+        return NULL;
+    memcpy((char *) name, (char *) newname,
+           ((int) vp->namelen + 1) * sizeof(oid));
+    *length = *length + 1;
+    *var_len = sizeof(long);    /* default length */
+    switch (vp->magic) {
+    case HPFLAG:
+    case HPCONF:
+    case HPSTATUS:
+    case HPRECONFIG:
+        long_ret = 1;
+        return (u_char *) & long_ret;   /* remove trap */
+    case HPLOGMASK:
+        long_ret = 3;
+        return (u_char *) & long_ret;
+    case HPTRAP:
+        newname[*length - 1] = 128;
+        newname[*length] = 120;
+        newname[*length + 1] = 57;
+        newname[*length + 2] = 92;
+        *length = *length + 3;
+        memcpy((char *) name, (char *) newname, *length * sizeof(oid));
+        long_ret = ((((((128 << 8) + 120) << 8) + 57) << 8) + 92);
+        return (u_char *) & long_ret;
+    }
+    return NULL;
+}
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/ucd-snmp/hpux.h tomato121/release/src/router/snmp/agent/mibgroup/ucd-snmp/hpux.h
--- tomato/release/src/router/snmp/agent/mibgroup/ucd-snmp/hpux.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/ucd-snmp/hpux.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,21 @@
+/*
+ *  hpux specific mib sections
+ *
+ */
+#ifndef _MIBGROUP_HPUX_H
+#define _MIBGROUP_HPUX_H
+
+FindVarMethod   var_hp;
+WriteMethod     writeHP;
+
+
+#define TRAPAGENT 128.120.57.92
+
+#define HPCONF 1
+#define HPRECONFIG 2
+#define HPFLAG 3
+#define HPLOGMASK 4
+#define HPSTATUS 6
+#define HPTRAP 101
+
+#endif                          /* _MIBGROUP_HPUX_H */
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/ucd-snmp/lmSensors.c tomato121/release/src/router/snmp/agent/mibgroup/ucd-snmp/lmSensors.c
--- tomato/release/src/router/snmp/agent/mibgroup/ucd-snmp/lmSensors.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/ucd-snmp/lmSensors.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,303 @@
+/*
+ * This file was generated by mib2c and is intended for use as a mib module
+ * for the ucd-snmp snmpd agent. 
+ */
+
+
+/*
+ * This should always be included first before anything else 
+ */
+#include <net-snmp/net-snmp-config.h>
+
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+/*
+ * minimal include directives 
+ */
+#include "util_funcs.h"
+
+
+#include <time.h>
+#include <sensors/sensors.h>
+
+#include "lmSensors.h"
+
+#define N_TYPES      (4)
+#define MAX_NAME     (64)
+#define MAX_SENSORS  (32)
+
+/*
+ * lmSensors_variables_oid:
+ *   this is the top level oid that we want to register under.  This
+ *   is essentially a prefix, with the suffix appearing in the
+ *   variable below.
+ */
+
+
+oid             lmSensors_variables_oid[] =
+    { 1, 3, 6, 1, 4, 1, 2021, 13, 16 };
+
+/*
+ * variable4 lmSensors_variables:
+ *   this variable defines function callbacks and type return information 
+ *   for the lmSensors mib section 
+ */
+
+struct variable4 lmSensors_variables[] = {
+    /*
+     * magic number        , variable type , ro/rw , callback fn  , L, oidsuffix 
+     */
+#define   LMTEMPSENSORSINDEX    3
+    {LMTEMPSENSORSINDEX, ASN_INTEGER, RONLY, var_lmSensorsTable, 3,
+     {2, 1, 1}},
+#define   LMTEMPSENSORSDEVICE   4
+    {LMTEMPSENSORSDEVICE, ASN_OCTET_STR, RONLY, var_lmSensorsTable, 3,
+     {2, 1, 2}},
+#define   LMTEMPSENSORSVALUE    5
+    {LMTEMPSENSORSVALUE, ASN_GAUGE, RONLY, var_lmSensorsTable, 3,
+     {2, 1, 3}},
+#define   LMFANSENSORSINDEX     8
+    {LMFANSENSORSINDEX, ASN_INTEGER, RONLY, var_lmSensorsTable, 3,
+     {3, 1, 1}},
+#define   LMFANSENSORSDEVICE    9
+    {LMFANSENSORSDEVICE, ASN_OCTET_STR, RONLY, var_lmSensorsTable, 3,
+     {3, 1, 2}},
+#define   LMFANSENSORSVALUE     10
+    {LMFANSENSORSVALUE, ASN_GAUGE, RONLY, var_lmSensorsTable, 3,
+     {3, 1, 3}},
+#define   LMVOLTSENSORSINDEX    13
+    {LMVOLTSENSORSINDEX, ASN_INTEGER, RONLY, var_lmSensorsTable, 3,
+     {4, 1, 1}},
+#define   LMVOLTSENSORSDEVICE   14
+    {LMVOLTSENSORSDEVICE, ASN_OCTET_STR, RONLY, var_lmSensorsTable, 3,
+     {4, 1, 2}},
+#define   LMVOLTSENSORSVALUE    15
+    {LMVOLTSENSORSVALUE, ASN_GAUGE, RONLY, var_lmSensorsTable, 3,
+     {4, 1, 3}},
+#define   LMMISCSENSORSINDEX    18
+    {LMMISCSENSORSINDEX, ASN_INTEGER, RONLY, var_lmSensorsTable, 3,
+     {5, 1, 1}},
+#define   LMMISCSENSORSDEVICE   19
+    {LMMISCSENSORSDEVICE, ASN_OCTET_STR, RONLY, var_lmSensorsTable, 3,
+     {5, 1, 2}},
+#define   LMMISCSENSORSVALUE    20
+    {LMMISCSENSORSVALUE, ASN_GAUGE, RONLY, var_lmSensorsTable, 3,
+     {5, 1, 3}},
+};
+
+typedef struct {
+    char            name[MAX_NAME];
+    int             value;
+} _sensor;
+
+typedef struct {
+    int             n;
+    _sensor         sensor[MAX_SENSORS];
+} _sensor_array;
+
+static _sensor_array sensor_array[N_TYPES];
+static clock_t  timestamp;
+
+
+static int      sensor_init(void);
+static void     sensor_load(void);
+static void     _sensor_load(clock_t t);
+
+#define CONFIG_FILE_NAME "/etc/sensors.conf"
+
+/*
+ * init_lmSensors():
+ *   Initialization routine.  This is called when the agent starts up.
+ *   At a minimum, registration of your variables should take place here.
+ */
+void
+init_lmSensors(void)
+{
+    sensor_init();
+
+    /*
+     * register ourselves with the agent to handle our mib tree 
+     */
+    REGISTER_MIB("lmSensors", lmSensors_variables, variable4,
+                 lmSensors_variables_oid);
+}
+
+/*
+ * var_lmSensorsTable():
+ *   Handle this table separately from the scalar value case.
+ *   The workings of this are basically the same as for var_lmSensors above.
+ */
+unsigned char  *
+var_lmSensorsTable(struct variable *vp,
+                   oid * name,
+                   size_t * length,
+                   int exact,
+                   size_t * var_len, WriteMethod ** write_method)
+{
+    static long     long_ret;
+    static unsigned char string[SPRINT_MAX_LEN];
+    int             i;
+
+    int             s_index = name[*length - 1] - 1;
+    int             s_type = -1;
+    int             n_sensors;
+
+    _sensor         s;
+
+    sensor_load();
+
+    switch (vp->magic) {
+    case LMTEMPSENSORSINDEX:
+    case LMTEMPSENSORSDEVICE:
+    case LMTEMPSENSORSVALUE:
+        s_type = 0;
+        n_sensors = sensor_array[0].n;
+        break;
+
+    case LMFANSENSORSINDEX:
+    case LMFANSENSORSDEVICE:
+    case LMFANSENSORSVALUE:
+        s_type = 1;
+        n_sensors = sensor_array[1].n;
+        break;
+
+    case LMVOLTSENSORSINDEX:
+    case LMVOLTSENSORSDEVICE:
+    case LMVOLTSENSORSVALUE:
+        s_type = 2;
+        n_sensors = sensor_array[2].n;
+        break;
+
+    case LMMISCSENSORSINDEX:
+    case LMMISCSENSORSDEVICE:
+    case LMMISCSENSORSVALUE:
+        s_type = 3;
+        n_sensors = sensor_array[3].n;
+        break;
+
+    default:
+        s_type = -1;
+        n_sensors = 0;
+    }
+
+    if (header_simple_table(vp, name, length, exact,
+                            var_len, write_method,
+                            n_sensors) == MATCH_FAILED)
+        return NULL;
+
+    if (s_type < 0)
+        return NULL;
+
+    s = sensor_array[s_type].sensor[s_index];
+
+    switch (vp->magic) {
+    case LMTEMPSENSORSINDEX:
+    case LMFANSENSORSINDEX:
+    case LMVOLTSENSORSINDEX:
+    case LMMISCSENSORSINDEX:
+        long_ret = s_index;
+        return (unsigned char *) &long_ret;
+
+    case LMTEMPSENSORSDEVICE:
+    case LMFANSENSORSDEVICE:
+    case LMVOLTSENSORSDEVICE:
+    case LMMISCSENSORSDEVICE:
+        strncpy(string, s.name, SPRINT_MAX_LEN - 1);
+        *var_len = strlen(string);
+        return (unsigned char *) string;
+
+    case LMTEMPSENSORSVALUE:
+    case LMFANSENSORSVALUE:
+    case LMVOLTSENSORSVALUE:
+    case LMMISCSENSORSVALUE:
+        long_ret = s.value;
+        return (unsigned char *) &long_ret;
+
+    default:
+        ERROR_MSG("Unable to handle table request");
+    }
+
+    return NULL;
+}
+
+static int
+sensor_init(void)
+{
+    int             res;
+    char            filename[] = CONFIG_FILE_NAME;
+    clock_t         t = clock();
+
+    FILE           *fp = fopen(filename, "r");
+    if (!fp)
+        return 1;
+
+    if (res = sensors_init(fp))
+        return 2;
+
+    _sensor_load(t);
+    return 0;
+}
+
+static void
+sensor_load(void)
+{
+    clock_t         t = clock();
+
+    if (t > timestamp + 60)
+        _sensor_load(t);
+
+    return;
+}
+
+static void
+_sensor_load(clock_t t)
+{
+    const sensors_chip_name *chip;
+    const sensors_feature_data *data;
+    int             chip_nr = 0;
+    int             a = 0;
+    int             b = 0;
+
+    int             i;
+    for (i = 0; i < N_TYPES; i++)
+        sensor_array[i].n = 0;
+
+    while (chip = sensors_get_detected_chips(&chip_nr)) {
+        while (data = sensors_get_all_features(*chip, &a, &b)) {
+            char           *label;
+            double          val;
+
+            if ((data->mode & SENSORS_MODE_R) &&
+                (data->mapping == SENSORS_NO_MAPPING) &&
+                !sensors_get_label(*chip, data->number, &label) &&
+                !sensors_get_feature(*chip, data->number, &val)) {
+                int             type;
+                float           mul;
+                _sensor_array  *array;
+
+                if (strstr(label, "temp")) {
+                    type = 0;
+                    mul = 1000.0;
+                } else if (strstr(label, "fan")) {
+                    type = 1;
+                    mul = 1.0;
+                } else if (strstr(label, "V")) {
+                    type = 2;
+                    mul = 1000.0;
+                } else {
+                    type = 3;
+                    mul = 1000.0;
+                }
+
+                array = &sensor_array[type];
+
+                strncpy(array->sensor[array->n].name, label, MAX_NAME);
+                array->sensor[array->n].value = (int) (val * mul);
+                array->n++;
+            }
+        }
+    }
+
+    timestamp = t;
+}
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/ucd-snmp/lmSensors.h tomato121/release/src/router/snmp/agent/mibgroup/ucd-snmp/lmSensors.h
--- tomato/release/src/router/snmp/agent/mibgroup/ucd-snmp/lmSensors.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/ucd-snmp/lmSensors.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,14 @@
+/*
+ * This file was generated by mib2c and is intended for use as a mib module
+ * for the ucd-snmp snmpd agent. 
+ */
+
+#ifndef _MIBGROUP_LMSENSORS_H
+#define _MIBGROUP_LMSENSORS_H
+
+config_require(util_funcs)
+
+     void            init_lmSensors(void);
+     FindVarMethod   var_lmSensorsTable;
+
+#endif                          /* _MIBGROUP_LMSENSORS_H */
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/ucd-snmp/loadave.c tomato121/release/src/router/snmp/agent/mibgroup/ucd-snmp/loadave.c
--- tomato/release/src/router/snmp/agent/mibgroup/ucd-snmp/loadave.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/ucd-snmp/loadave.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,365 @@
+#include <net-snmp/net-snmp-config.h>
+
+#if HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#if HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#if HAVE_FCNTL_H
+#include <fcntl.h>
+#endif
+#include <signal.h>
+#if HAVE_MACHINE_PARAM_H
+#include <machine/param.h>
+#endif
+#if HAVE_SYS_PARAM_H
+#include <sys/param.h>
+#endif
+#if HAVE_SYS_VMMETER_H
+#if !(defined(bsdi2) || defined(netbsd1))
+#include <sys/vmmeter.h>
+#endif
+#endif
+#if HAVE_SYS_CONF_H
+#include <sys/conf.h>
+#endif
+#if HAVE_ASM_PAGE_H
+#include <asm/page.h>
+#endif
+#if HAVE_SYS_SWAP_H
+#include <sys/swap.h>
+#endif
+#if HAVE_SYS_FS_H
+#include <sys/fs.h>
+#else
+#if HAVE_UFS_FS_H
+#include <ufs/fs.h>
+#else
+#ifdef HAVE_SYS_STAT_H
+#include <sys/stat.h>
+#endif
+#ifdef HAVE_SYS_VNODE_H
+#include <sys/vnode.h>
+#endif
+#ifdef HAVE_UFS_UFS_QUOTA_H
+#include <ufs/ufs/quota.h>
+#endif
+#ifdef HAVE_UFS_UFS_INODE_H
+#include <ufs/ufs/inode.h>
+#endif
+#if HAVE_UFS_FFS_FS_H
+#include <ufs/ffs/fs.h>
+#endif
+#endif
+#endif
+#if HAVE_MTAB_H
+#include <mtab.h>
+#endif
+#include <sys/stat.h>
+#include <errno.h>
+#if HAVE_FSTAB_H
+#include <fstab.h>
+#endif
+#if HAVE_SYS_STATFS_H
+#include <sys/statfs.h>
+#endif
+#if HAVE_SYS_STATVFS_H
+#include <sys/statvfs.h>
+#endif
+#if HAVE_SYS_VFS_H
+#include <sys/vfs.h>
+#endif
+#if (!defined(HAVE_STATVFS)) && defined(HAVE_STATFS)
+#if HAVE_SYS_MOUNT_H
+#include <sys/mount.h>
+#endif
+#if HAVE_SYS_SYSCTL_H
+#include <sys/sysctl.h>
+#endif
+#define statvfs statfs
+#endif
+#if HAVE_VM_VM_H
+#include <vm/vm.h>
+#endif
+#if HAVE_VM_SWAP_PAGER_H
+#include <vm/swap_pager.h>
+#endif
+#if HAVE_SYS_FIXPOINT_H
+#include <sys/fixpoint.h>
+#endif
+#if HAVE_SYS_LOADAVG_H
+#include <sys/loadavg.h>
+#endif
+#if HAVE_MALLOC_H
+#include <malloc.h>
+#endif
+#if HAVE_STRING_H
+#include <string.h>
+#endif
+#if TIME_WITH_SYS_TIME
+# ifdef WIN32
+#  include <sys/timeb.h>
+# else
+#  include <sys/time.h>
+# endif
+# include <time.h>
+#else
+# if HAVE_SYS_TIME_H
+#  include <sys/time.h>
+# else
+#  include <time.h>
+# endif
+#endif
+#if HAVE_WINSOCK_H
+#include <winsock.h>
+#endif
+#ifdef dynix
+#include <sys/mc_vmparam.h>
+#endif
+#if defined(hpux10) || defined(hpux11)
+#include <sys/pstat.h>
+#endif
+
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include <net-snmp/agent/auto_nlist.h>
+
+#include "struct.h"
+#include "loadave.h"
+#include "util_funcs.h"
+#include "kernel.h"
+
+double          maxload[3];
+
+void
+init_loadave(void)
+{
+
+    /*
+     * define the structure we're going to ask the agent to register our
+     * information at 
+     */
+    struct variable2 extensible_loadave_variables[] = {
+        {MIBINDEX, ASN_INTEGER, RONLY, var_extensible_loadave, 1,
+         {MIBINDEX}},
+        {ERRORNAME, ASN_OCTET_STR, RONLY, var_extensible_loadave, 1,
+         {ERRORNAME}},
+        {LOADAVE, ASN_OCTET_STR, RONLY, var_extensible_loadave, 1,
+         {LOADAVE}},
+        {LOADMAXVAL, ASN_OCTET_STR, RONLY, var_extensible_loadave, 1,
+         {LOADMAXVAL}},
+        {LOADAVEINT, ASN_INTEGER, RONLY, var_extensible_loadave, 1,
+         {LOADAVEINT}},
+#ifdef OPAQUE_SPECIAL_TYPES
+        {LOADAVEFLOAT, ASN_OPAQUE_FLOAT, RONLY, var_extensible_loadave, 1,
+         {LOADAVEFLOAT}},
+#endif
+        {ERRORFLAG, ASN_INTEGER, RONLY, var_extensible_loadave, 1,
+         {ERRORFLAG}},
+        {ERRORMSG, ASN_OCTET_STR, RONLY, var_extensible_loadave, 1,
+         {ERRORMSG}}
+    };
+
+    /*
+     * Define the OID pointer to the top of the mib tree that we're
+     * registering underneath 
+     */
+    oid             loadave_variables_oid[] =
+        { UCDAVIS_MIB, LOADAVEMIBNUM, 1 };
+
+    /*
+     * register ourselves with the agent to handle our mib tree 
+     */
+    REGISTER_MIB("ucd-snmp/loadave", extensible_loadave_variables,
+                 variable2, loadave_variables_oid);
+
+    snmpd_register_config_handler("load", loadave_parse_config,
+                                  loadave_free_config,
+                                  "max1 [max5] [max15]");
+}
+
+void
+loadave_parse_config(const char *token, char *cptr)
+{
+    int             i;
+
+    for (i = 0; i <= 2; i++) {
+        if (cptr != NULL)
+            maxload[i] = atof(cptr);
+        else
+            maxload[i] = maxload[i - 1];
+        cptr = skip_not_white(cptr);
+        cptr = skip_white(cptr);
+    }
+}
+
+void
+loadave_free_config(void)
+{
+    int             i;
+
+    for (i = 0; i <= 2; i++)
+        maxload[i] = DEFMAXLOADAVE;
+}
+
+/*
+ * try to get load average
+ * Inputs: pointer to array of doubles, number of elements in array
+ * Returns: 0=array has values, -1=error occurred.
+ */
+int
+try_getloadavg(double *r_ave, size_t s_ave)
+{
+    double         *pave = r_ave;
+#ifdef HAVE_SYS_FIXPOINT_H
+    fix             favenrun[3];
+#endif
+#if (defined(ultrix) || defined(sun) || defined(__alpha) || defined(dynix))
+    int             i;
+#if (defined(sun) || defined(__alpha) || defined(dynix))
+    long            favenrun[3];
+    if (s_ave > 3)              /* bounds check */
+        return (-1);
+#define FIX_TO_DBL(_IN) (((double) _IN)/((double) FSCALE))
+#endif
+#endif
+#ifdef aix4
+    int             favenrun[3];
+#endif
+#if defined(hpux10) || defined(hpux11)
+  struct pst_dynamic pst_buf;
+#endif
+
+
+#ifdef HAVE_GETLOADAVG
+    if (getloadavg(pave, s_ave) == -1)
+        return (-1);
+#elif defined(linux)
+    {
+        FILE           *in = fopen("/proc/loadavg", "r");
+        if (!in) {
+            snmp_log(LOG_ERR, "snmpd: cannot open /proc/loadavg\n");
+            return (-1);
+        }
+        fscanf(in, "%lf %lf %lf", pave, (pave + 1), (pave + 2));
+        fclose(in);
+    }
+#elif (defined(ultrix) || defined(sun) || defined(__alpha) || defined(dynix))
+    if (auto_nlist(LOADAVE_SYMBOL, (char *) favenrun, sizeof(favenrun)) ==
+        0)
+        return (-1);
+    for (i = 0; i < s_ave; i++)
+        *(pave + i) = FIX_TO_DBL(favenrun[i]);
+#elif defined(hpux10) || defined(hpux11)
+    if (pstat_getdynamic(&pst_buf, sizeof(struct pst_dynamic), 1, 0) < 0)
+        return(-1);
+    r_ave[0] = pst_buf.psd_avg_1_min;
+    r_ave[1] = pst_buf.psd_avg_5_min;
+    r_ave[2] = pst_buf.psd_avg_15_min;
+#elif !defined(cygwin)
+#ifdef CAN_USE_NLIST
+#if aix4
+    if (auto_nlist(LOADAVE_SYMBOL, (char *) favenrun, sizeof(favenrun)) ==
+        0)
+        return -1;
+    r_ave[0] = favenrun[0] / 65536.0;
+    r_ave[1] = favenrun[1] / 65536.0;
+    r_ave[2] = favenrun[2] / 65536.0;
+    return 0;
+#else
+    if (auto_nlist(LOADAVE_SYMBOL, (char *) pave, sizeof(double) * s_ave)
+        == 0)
+#endif
+#endif
+        return (-1);
+#endif
+    /*
+     * XXX
+     *   To calculate this, we need to compare
+     *   successive values of the kernel array
+     *   '_cp_times', and calculate the resulting
+     *   percentage changes.
+     *     This calculation needs to be performed
+     *   regularly - perhaps as a background process.
+     *
+     *   See the source to 'top' for full details.
+     *
+     * The linux SNMP HostRes implementation
+     *   uses 'avenrun[0]*100' as an approximation.
+     *   This is less than accurate, but has the
+     *   advantage of being simple to implement!
+     *
+     * I'm also assuming a single processor
+     */
+    return 0;
+}
+
+u_char         *
+var_extensible_loadave(struct variable * vp,
+                       oid * name,
+                       size_t * length,
+                       int exact,
+                       size_t * var_len, WriteMethod ** write_method)
+{
+
+    static long     long_ret;
+    static float    float_ret;
+    static char     errmsg[300];
+    double          avenrun[3];
+    if (header_simple_table
+        (vp, name, length, exact, var_len, write_method, 3))
+        return (NULL);
+    switch (vp->magic) {
+    case MIBINDEX:
+        long_ret = name[*length - 1];
+        return ((u_char *) (&long_ret));
+    case ERRORNAME:
+        sprintf(errmsg, "Load-%d", ((name[*length - 1] == 1) ? 1 :
+                                    ((name[*length - 1] == 2) ? 5 : 15)));
+        *var_len = strlen(errmsg);
+        return ((u_char *) (errmsg));
+    }
+    if (try_getloadavg(&avenrun[0], sizeof(avenrun) / sizeof(avenrun[0]))
+        == -1)
+        return (0);
+    switch (vp->magic) {
+    case LOADAVE:
+
+        sprintf(errmsg, "%.2f", avenrun[name[*length - 1] - 1]);
+        *var_len = strlen(errmsg);
+        return ((u_char *) (errmsg));
+    case LOADMAXVAL:
+        sprintf(errmsg, "%.2f", maxload[name[*length - 1] - 1]);
+        *var_len = strlen(errmsg);
+        return ((u_char *) (errmsg));
+    case LOADAVEINT:
+        long_ret = (u_long) (avenrun[name[*length - 1] - 1] * 100);
+        return ((u_char *) (&long_ret));
+#ifdef OPAQUE_SPECIAL_TYPES
+    case LOADAVEFLOAT:
+        float_ret = (float) avenrun[name[*length - 1] - 1];
+        *var_len = sizeof(float_ret);
+        return ((u_char *) (&float_ret));
+#endif
+    case ERRORFLAG:
+        long_ret = (maxload[name[*length - 1] - 1] != 0 &&
+                    avenrun[name[*length - 1] - 1] >=
+                    maxload[name[*length - 1] - 1]) ? 1 : 0;
+        return ((u_char *) (&long_ret));
+    case ERRORMSG:
+        if (maxload[name[*length - 1] - 1] != 0 &&
+            avenrun[name[*length - 1] - 1] >=
+            maxload[name[*length - 1] - 1]) {
+            sprintf(errmsg, "%d min Load Average too high (= %.2f)",
+                    (name[*length - 1] ==
+                     1) ? 1 : ((name[*length - 1] == 2) ? 5 : 15),
+                    avenrun[name[*length - 1] - 1]);
+        } else {
+            errmsg[0] = 0;
+        }
+        *var_len = strlen(errmsg);
+        return ((u_char *) errmsg);
+    }
+    return NULL;
+}
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/ucd-snmp/loadave.h tomato121/release/src/router/snmp/agent/mibgroup/ucd-snmp/loadave.h
--- tomato/release/src/router/snmp/agent/mibgroup/ucd-snmp/loadave.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/ucd-snmp/loadave.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,26 @@
+/*
+ *  Loadaveess watching mib group
+ */
+#ifndef _MIBGROUP_LOADAVE_H
+#define _MIBGROUP_LOADAVE_H
+
+config_require(util_funcs)
+
+     void            init_loadave(void);
+     extern FindVarMethod var_extensible_loadave;
+
+/*
+ * config file parsing routines 
+ */
+     void            loadave_parse_config(const char *, char *);
+     void            loadave_free_config(void);
+     int             try_getloadavg(double *r_ave, size_t s_ave);
+
+#include "mibdefs.h"
+
+#define LOADAVE 3
+#define LOADMAXVAL 4
+#define LOADAVEINT 5
+#define LOADAVEFLOAT 6
+
+#endif                          /* _MIBGROUP_LOADAVE_H */
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/ucd-snmp/logmatch.c tomato121/release/src/router/snmp/agent/mibgroup/ucd-snmp/logmatch.c
--- tomato/release/src/router/snmp/agent/mibgroup/ucd-snmp/logmatch.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/ucd-snmp/logmatch.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,682 @@
+/* Portions of this file are subject to the following copyrights.  See
+ * the Net-SNMP's COPYING file for more details and other copyrights
+ * that may apply:
+ */
+/*
+ * Copyright © 2003 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms specified in the COPYING file
+ * distributed with the Net-SNMP package.
+ */
+#include <net-snmp/net-snmp-config.h>
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <errno.h>
+
+
+#if TIME_WITH_SYS_TIME
+# ifdef WIN32
+#  include <sys/timeb.h>
+# else
+#  include <sys/time.h>
+# endif
+# include <time.h>
+#else
+# if HAVE_SYS_TIME_H
+#  include <sys/time.h>
+# else
+#  include <time.h>
+# endif
+#endif
+#if HAVE_WINSOCK_H
+#include <winsock.h>
+#endif
+
+#if HAVE_DMALLOC_H
+#include <dmalloc.h>
+#endif
+
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+#include "struct.h"
+#include "util_funcs.h"
+#include "logmatch.h"
+#include "util_funcs.h"
+
+#define MAXLOGMATCH   50
+
+struct logmatchstat logmatchTable[MAXLOGMATCH];
+int             logmatchCount;
+
+void
+init_logmatch(void)
+{
+    struct variable2 logmatch_info[] = {
+        {LOGMATCH_INFO, ASN_INTEGER, RONLY, var_logmatch_table, 0}
+    };
+
+    struct variable2 logmatch_table[] = {
+        {LOGMATCH_INDEX, ASN_INTEGER, RONLY, var_logmatch_table, 1, {1}},
+        {LOGMATCH_NAME, ASN_OCTET_STR, RONLY, var_logmatch_table, 1, {2}},
+        {LOGMATCH_FILENAME, ASN_OCTET_STR, RONLY, var_logmatch_table, 1,
+         {3}},
+        {LOGMATCH_REGEX, ASN_OCTET_STR, RONLY, var_logmatch_table, 1, {4}},
+        {LOGMATCH_GLOBALCTR, ASN_COUNTER, RONLY, var_logmatch_table, 1,
+         {5}},
+        {LOGMATCH_GLOBALCNT, ASN_INTEGER, RONLY, var_logmatch_table, 1,
+         {6}},
+        {LOGMATCH_CURRENTCTR, ASN_COUNTER, RONLY, var_logmatch_table, 1,
+         {7}},
+        {LOGMATCH_CURRENTCNT, ASN_INTEGER, RONLY, var_logmatch_table, 1,
+         {8}},
+        {LOGMATCH_COUNTER, ASN_COUNTER, RONLY, var_logmatch_table, 1, {9}},
+        {LOGMATCH_COUNT, ASN_INTEGER, RONLY, var_logmatch_table, 1, {10}},
+        {LOGMATCH_FREQ, ASN_INTEGER, RONLY, var_logmatch_table, 1, {11}},
+        {LOGMATCH_ERROR, ASN_INTEGER, RONLY, var_logmatch_table, 1, {100}},
+        {LOGMATCH_MSG, ASN_OCTET_STR, RONLY, var_logmatch_table, 1, {101}}
+    };
+
+    /*
+     * Define the OID pointer to the top of the mib tree that we're
+     * registering underneath 
+     */
+    oid             logmatch_info_oid[] = { UCDAVIS_MIB, 16, 1 };
+    oid             logmatch_variables_oid[] = { UCDAVIS_MIB, 16, 2, 1 };
+
+    /*
+     * register ourselves with the agent to handle our mib tree 
+     */
+    REGISTER_MIB("ucd-snmp/logmatch", logmatch_info, variable2,
+                 logmatch_info_oid);
+    REGISTER_MIB("ucd-snmp/logmatch", logmatch_table, variable2,
+                 logmatch_variables_oid);
+
+    snmpd_register_config_handler("logmatch", logmatch_parse_config,
+                                  logmatch_free_config,
+                                  "logmatch name path cycletime regex");
+
+}
+
+/***************************************************************
+*                                                              *
+* !!!---!!! PUBLIC !!! --- !!!                                 *
+*                                                              *
+* logmatch_free_config                                         *
+* free memory allocated by this mib module                     *
+*                                                              *
+***************************************************************/
+
+void
+logmatch_free_config(void)
+{
+    int             i;
+
+    /*
+     * ------------------------------------ 
+     */
+    /*
+     * the only memory we have allocated    
+     */
+    /*
+     * is the memory allocated by regcomp   
+     */
+    /*
+     * ------------------------------------ 
+     */
+
+    for (i = 0; i < logmatchCount; i++) {
+
+        regfree(&(logmatchTable[i].regexBuffer));
+    }
+    logmatchCount = 0;
+}
+
+/***************************************************************
+*                                                              *
+* !!!---!!! PUBLIC !!! --- !!!                                 *
+*                                                              *
+* logmatch_parse_config                                        *
+* parse one line from snmpd.conf                               *
+*                                                              *
+***************************************************************/
+
+void
+logmatch_parse_config(const char *token, char *cptr)
+{
+
+    char space_name;
+    char space_path;
+
+    if (logmatchCount < MAXLOGMATCH) {
+        logmatchTable[logmatchCount].frequency = 30;
+        logmatchTable[logmatchCount].thisIndex = logmatchCount;
+
+
+        /*
+         * ------------------------------------ 
+         */
+        /*
+         * be careful this counter needs to be  
+         */
+        /*
+         * resetfrom persistant storage         
+         */
+        /*
+         * ------------------------------------ 
+         */
+
+        logmatchTable[logmatchCount].globalMatchCounter = 0;
+        logmatchTable[logmatchCount].currentMatchCounter = 0;
+        logmatchTable[logmatchCount].matchCounter = 0;
+        logmatchTable[logmatchCount].virgin = TRUE;
+        logmatchTable[logmatchCount].currentFilePosition = 0;
+
+
+        /*
+         * ------------------------------------ 
+         */
+        /*
+         * be careful: the flag 255 must fit to 
+         */
+        /*
+         * the size of regEx as definded in     
+         */
+        /*
+         * logmatch.h                           
+         */
+        /*
+         * ------------------------------------ 
+         */
+
+        sscanf(cptr, "%255s%c%255s%c %d %255c\n",
+               logmatchTable[logmatchCount].name,
+	       &space_name,
+               logmatchTable[logmatchCount].filename,
+	       &space_path,
+               &(logmatchTable[logmatchCount].frequency),
+               logmatchTable[logmatchCount].regEx);
+
+	/*
+	 * Log an error then return if any of the strings scanned in were
+	 * larger then they should have been.
+	 */
+	if (space_name != ' ') {
+		snmp_log(LOG_ERR, "logmatch_parse_config: the name scanned " \
+		 "in from line %s is too large. logmatchCount = %d\n",
+		 cptr, logmatchCount);
+		return;
+	} else if (space_path != ' ') {
+		snmp_log(LOG_ERR, "logmatch_parse_config: the file name " \
+		 "scanned in from line %s is too large. logmatchCount = %d\n",
+		    cptr, logmatchCount);
+		return;
+	}
+
+        /*
+         * ------------------------------------ 
+         */
+        /*
+         * just to be safe "NULL" the end of    
+         */
+        /*
+         * the arary regEx as sscanf won't do   
+         */
+        /*
+         * it with the %c modifier              
+         */
+        /*
+         * ------------------------------------ 
+         */
+
+        logmatchTable[logmatchCount].regEx[255] = '\0';
+
+
+        /*
+         * ------------------------------------ 
+         */
+        /*
+         * now compile the regular expression   
+         */
+        /*
+         * ------------------------------------ 
+         */
+
+        logmatchTable[logmatchCount].myRegexError =
+            regcomp(&(logmatchTable[logmatchCount].regexBuffer),
+                    logmatchTable[logmatchCount].regEx,
+                    REG_EXTENDED | REG_NOSUB);
+
+        if (logmatchTable[logmatchCount].frequency > 0) {
+            snmp_alarm_register(logmatchTable[logmatchCount].frequency,
+                                SA_REPEAT,
+                                (SNMPAlarmCallback *)
+                                updateLogmatch_Scheduled,
+                                &(logmatchTable[logmatchCount])
+                );
+        }
+
+        logmatchCount++;
+    }
+}
+
+
+/***************************************************************
+*                                                              *
+* !!!---!!! PUBLIC !!! --- !!!                                 *
+*                                                              *
+* updateLogmatch                                               *
+* this function is called back by snmpd alarms                 *
+*                                                              *
+***************************************************************/
+
+
+void
+updateLogmatch(int iindex)
+{
+
+    regmatch_t      myMatch;
+    int             matchResultCode;
+    char            inbuf[1024];
+    char            perfilename[512];
+    FILE           *perfile;
+    unsigned long   pos, ccounter, counter;
+    int             result;
+    int             toobig;
+    int             anyChanges = FALSE;
+    struct stat     sb;
+
+    /*
+     * ------------------------------------ 
+     */
+    /*
+     * we can never be sure if this is the  
+     */
+    /*
+     * last time we are being called here,  
+     */
+    /*
+     * so we always update a persistent     
+     */
+    /*
+     * data file with our current file      
+     */
+    /*
+     * position                             
+     */
+    /*
+     * ------------------------------------ 
+     */
+
+    snprintf(perfilename, sizeof(perfilename), "%s/snmpd_logmatch_%s.pos",
+	get_persistent_directory(), logmatchTable[iindex].name);
+
+    if (logmatchTable[iindex].virgin) {
+
+        /*
+         * ------------------------------------ 
+         */
+        /*
+         * this is the first time we are being  
+         */
+        /*
+         * called; let's try to find an old     
+         */
+        /*
+         * file position stored in a persistent 
+         */
+        /*
+         * data file and restore it             
+         */
+        /*
+         * ------------------------------------ 
+         */
+
+        if (perfile = fopen(perfilename, "r")) {
+
+
+            /*
+             * ------------------------------------ 
+             */
+            /*
+             * the persistent data file exists so   
+             */
+            /*
+             * let's read it out                    
+             */
+            /*
+             * ------------------------------------ 
+             */
+
+
+            pos = counter = ccounter = 0;
+
+            if (fscanf(perfile, "%lu %lu %lu", &pos, &ccounter, &counter)) {
+
+
+                /*
+                 * ------------------------------------ 
+                 */
+                /*
+                 * the data could be read; now let's    
+                 */
+                /*
+                 * try to open the  logfile to be       
+                 */
+                /*
+                 * scanned                              
+                 */
+                /*
+                 * ------------------------------------ 
+                 */
+
+                if (logmatchTable[iindex].logfile =
+                    fopen(logmatchTable[iindex].filename, "r")) {
+
+
+                    /*
+                     * ------------------------------------ 
+                     */
+                    /*
+                     * the log file could be opened; now    
+                     */
+                    /*
+                     * let's try to set the pointer         
+                     */
+                    /*
+                     * ------------------------------------ 
+                     */
+
+                    if (!fseek
+                        (logmatchTable[iindex].logfile, pos, SEEK_SET)) {
+
+
+                        /*
+                         * ------------------------------------ 
+                         */
+                        /*
+                         * the pointer could be set - this is   
+                         */
+                        /*
+                         * the most that we can do: if the      
+                         */
+                        /*
+                         * pointer is smaller than the file     
+                         */
+                        /*
+                         * size we must assume that the pointer 
+                         */
+                        /*
+                         * still points to where it read the    
+                         */
+                        /*
+                         * file last time; let's restore the    
+                         */
+                        /*
+                         * data                                 
+                         */
+                        /*
+                         * ------------------------------------ 
+                         */
+
+                        logmatchTable[iindex].currentFilePosition = pos;
+                        logmatchTable[iindex].currentMatchCounter =
+                            ccounter;
+                        logmatchTable[iindex].globalMatchCounter = counter;
+                    }
+
+                    fclose(logmatchTable[iindex].logfile);
+                }
+            }
+
+            fclose(perfile);
+        }
+
+        logmatchTable[iindex].virgin = FALSE;
+    }
+
+
+    /*
+     * ------------------------------------ 
+     */
+    /*
+     * now the pointer and the counter are  
+     */
+    /*
+     * set either zero or reset to old      
+     */
+    /*
+     * value; now let's try to read some    
+     */
+    /*
+     * data                                 
+     */
+    /*
+     * ------------------------------------ 
+     */
+
+    if (stat(logmatchTable[iindex].filename, &sb) == 0) {
+
+        if (logmatchTable[iindex].currentFilePosition > sb.st_size) {
+            toobig = TRUE;
+        } else {
+            toobig = FALSE;
+        }
+
+        if (logmatchTable[iindex].logfile =
+            fopen(logmatchTable[iindex].filename, "r")) {
+
+            result =
+                fseek(logmatchTable[iindex].logfile,
+                      logmatchTable[iindex].currentFilePosition, SEEK_SET);
+
+            if (result || toobig || (errno == EINVAL)
+                || feof(logmatchTable[iindex].logfile)) {
+
+
+                /*
+                 * ------------------------------------ 
+                 */
+                /*
+                 * when we are here that means we       
+                 */
+                /*
+                 * could't set the file position maybe  
+                 */
+                /*
+                 * the file was rotated; let's reset    
+                 */
+                /*
+                 * the filepointer, but not the counter 
+                 */
+                /*
+                 * ------------------------------------ 
+                 */
+
+
+                logmatchTable[iindex].currentFilePosition = 0;
+                logmatchTable[iindex].currentMatchCounter = 0;
+                fseek(logmatchTable[iindex].logfile, 0, SEEK_SET);
+                anyChanges = TRUE;
+            }
+
+            while (fgets
+                   (inbuf, sizeof(inbuf), logmatchTable[iindex].logfile)) {
+
+                matchResultCode =
+                    regexec(&(logmatchTable[iindex].regexBuffer),
+                            inbuf, 0, &myMatch, REG_NOTEOL);
+
+                if (matchResultCode == 0) {
+                    logmatchTable[iindex].globalMatchCounter++;
+                    logmatchTable[iindex].currentMatchCounter++;
+                    logmatchTable[iindex].matchCounter++;
+                    anyChanges = TRUE;
+                }
+            }
+
+            logmatchTable[iindex].currentFilePosition =
+                ftell(logmatchTable[iindex].logfile);
+            fclose(logmatchTable[iindex].logfile);
+        }
+    }
+
+
+    /*
+     * ------------------------------------ 
+     */
+    /*
+     * at this point we can be safe that    
+     */
+    /*
+     * our current file position is         
+     */
+    /*
+     * straightened out o.k. - we never     
+     */
+    /*
+     * know if this is the last time we are 
+     */
+    /*
+     * being called so save the position    
+     */
+    /*
+     * in a file                            
+     */
+    /*
+     * ------------------------------------ 
+     */
+
+    if (anyChanges && (perfile = fopen(perfilename, "w"))) {
+
+
+        /*
+         * ------------------------------------ 
+         */
+        /*
+         * o.k. lets write out our variable     
+         */
+        /*
+         * ------------------------------------ 
+         */
+
+        fprintf(perfile, "%lu %lu %lu\n",
+                logmatchTable[iindex].currentFilePosition,
+                logmatchTable[iindex].currentMatchCounter,
+                logmatchTable[iindex].globalMatchCounter);
+
+        fclose(perfile);
+    }
+
+}
+
+
+void
+updateLogmatch_Scheduled(unsigned int registrationNumber,
+                         struct logmatchstat *logmatchtable)
+{
+
+    updateLogmatch(logmatchtable->thisIndex);
+}
+
+
+
+
+/*
+ * OID functions 
+ */
+
+u_char         *
+var_logmatch_table(struct variable *vp,
+                   oid * name,
+                   size_t * length,
+                   int exact,
+                   size_t * var_len, WriteMethod ** write_method)
+{
+    static long     long_ret;
+    static char     message[256];
+    int             iindex;
+    struct logmatchstat *logmatch;
+
+    if (vp->magic == LOGMATCH_INFO) {
+        if (header_generic(vp, name, length, exact, var_len, write_method)
+            == MATCH_FAILED)
+            return (NULL);
+    } else {
+        if (header_simple_table
+            (vp, name, length, exact, var_len, write_method,
+             logmatchCount))
+            return (NULL);
+    }
+
+
+    iindex = name[*length - 1] - 1;
+    logmatch = &logmatchTable[iindex];
+
+    if (logmatch->myRegexError == 0)
+        updateLogmatch(iindex);
+
+    switch (vp->magic) {
+    case LOGMATCH_INFO:
+        long_ret = MAXLOGMATCH;
+        return (u_char *) & long_ret;
+
+    case LOGMATCH_INDEX:
+        long_ret = iindex + 1;
+        return (u_char *) & long_ret;
+
+    case LOGMATCH_NAME:
+        *var_len = strlen(logmatch->name);
+        return (u_char *) logmatch->name;
+
+    case LOGMATCH_FILENAME:
+        *var_len = strlen(logmatch->filename);
+        return (u_char *) logmatch->filename;
+
+    case LOGMATCH_REGEX:
+        *var_len = strlen(logmatch->regEx);
+        return (u_char *) logmatch->regEx;
+
+    case LOGMATCH_GLOBALCTR:
+    case LOGMATCH_GLOBALCNT:
+        long_ret = (logmatch->globalMatchCounter);
+        return (u_char *) & long_ret;
+
+    case LOGMATCH_CURRENTCTR:
+    case LOGMATCH_CURRENTCNT:
+        long_ret = (logmatch->currentMatchCounter);
+        return (u_char *) & long_ret;
+
+    case LOGMATCH_COUNTER:
+    case LOGMATCH_COUNT:
+        long_ret = (logmatch->matchCounter);
+        logmatch->matchCounter = 0;
+        return (u_char *) & long_ret;
+
+    case LOGMATCH_FREQ:
+        long_ret = logmatch->frequency;
+        return (u_char *) & long_ret;
+
+    case LOGMATCH_ERROR:
+        if (logmatch->frequency >= 0 && logmatch->myRegexError == 0)
+            long_ret = 0;
+        else
+            long_ret = 1;
+
+        return (u_char *) & long_ret;
+
+    case LOGMATCH_MSG:
+
+        regerror(logmatch->myRegexError, &(logmatch->regexBuffer), message,
+                 sizeof(message));
+
+        *var_len = strlen(message);
+        return (u_char *) message;
+
+    default:
+        DEBUGMSGTL(("snmpd", "unknown sub-id %d in var_logmatch_table\n",
+                    vp->magic));
+    }
+
+    return NULL;
+}
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/ucd-snmp/logmatch.h tomato121/release/src/router/snmp/agent/mibgroup/ucd-snmp/logmatch.h
--- tomato/release/src/router/snmp/agent/mibgroup/ucd-snmp/logmatch.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/ucd-snmp/logmatch.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,57 @@
+/*
+ *  Template MIB group interface - logmatch.h
+ *
+ */
+#ifndef _MIBGROUP_LOGMATCH_H
+#define _MIBGROUP_LOGMATCH_H
+
+#include "mibdefs.h"
+#include <regex.h>
+
+struct logmatchstat {
+    char            filename[256];
+    char            regEx[256];
+    char            name[256];
+    FILE           *logfile;
+    long            currentFilePosition;
+    unsigned long   globalMatchCounter;
+    unsigned long   currentMatchCounter;
+    unsigned long   matchCounter;
+    regex_t         regexBuffer;
+    int             myRegexError;
+    int             virgin;
+    int             thisIndex;
+    int             frequency;
+};
+void            init_logmatch(void);
+
+
+/*
+ * config logmatch parsing routines 
+ */
+void            logmatch_free_config(void);
+void            logmatch_parse_config(const char *, char *);
+void            updateLogmatch_Scheduled(unsigned int,
+                                         struct logmatchstat *);
+extern FindVarMethod var_logmatch_table;
+
+
+
+#define LOGMATCH_ERROR_MSG  "%s: size exceeds %dkb (= %dkb)"
+
+#define LOGMATCH_INFO       0
+#define LOGMATCH_INDEX      1
+#define LOGMATCH_NAME       2
+#define LOGMATCH_FILENAME   3
+#define LOGMATCH_REGEX      4
+#define LOGMATCH_GLOBALCTR  5
+#define LOGMATCH_GLOBALCNT  6
+#define LOGMATCH_CURRENTCTR 7
+#define LOGMATCH_CURRENTCNT 8
+#define LOGMATCH_COUNTER    9
+#define LOGMATCH_COUNT      10
+#define LOGMATCH_FREQ       11
+#define LOGMATCH_ERROR      100
+#define LOGMATCH_MSG        101
+
+#endif                          /* _MIBGROUP_LOGMATCH_H */
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/ucd-snmp/memory.c tomato121/release/src/router/snmp/agent/mibgroup/ucd-snmp/memory.c
--- tomato/release/src/router/snmp/agent/mibgroup/ucd-snmp/memory.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/ucd-snmp/memory.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,688 @@
+#include <net-snmp/net-snmp-config.h>
+
+#if HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#if HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#if HAVE_FCNTL_H
+#include <fcntl.h>
+#endif
+#include <ctype.h>
+#include <signal.h>
+#if HAVE_MACHINE_PARAM_H
+#include <machine/param.h>
+#endif
+#if HAVE_SYS_VMMETER_H
+#if !defined(bsdi2) && !defined(netbsd1)
+#include <sys/vmmeter.h>
+#endif
+#endif
+#if HAVE_SYS_CONF_H
+#include <sys/conf.h>
+#endif
+#if HAVE_ASM_PAGE_H
+#include <asm/page.h>
+#endif
+#if HAVE_SYS_SWAP_H
+#include <sys/swap.h>
+#endif
+#if HAVE_SYS_FS_H
+#include <sys/fs.h>
+#else
+#if HAVE_UFS_FS_H
+#include <ufs/fs.h>
+#else
+#ifdef HAVE_SYS_STAT_H
+#include <sys/stat.h>
+#endif
+#ifdef HAVE_SYS_VNODE_H
+#include <sys/vnode.h>
+#endif
+#ifdef HAVE_UFS_UFS_QUOTA_H
+#include <ufs/ufs/quota.h>
+#endif
+#ifdef HAVE_UFS_UFS_INODE_H
+#include <ufs/ufs/inode.h>
+#endif
+#ifdef HAVE_SYS_PARAM_H
+#include <sys/param.h>
+#endif
+#if HAVE_UFS_FFS_FS_H
+#include <ufs/ffs/fs.h>
+#endif
+#endif
+#endif
+#if HAVE_MTAB_H
+#include <mtab.h>
+#endif
+#include <sys/stat.h>
+#include <errno.h>
+#if HAVE_FSTAB_H
+#include <fstab.h>
+#endif
+#if HAVE_SYS_STATVFS_H
+#include <sys/statvfs.h>
+#endif
+#if HAVE_SYS_VFS_H
+#include <sys/vfs.h>
+#endif
+#if (!defined(HAVE_STATVFS)) && defined(HAVE_STATFS)
+#if HAVE_SYS_PARAM_H
+#include <sys/param.h>
+#endif
+#if HAVE_SYS_MOUNT_H
+#include <sys/mount.h>
+#endif
+#if HAVE_SYS_SYSCTL_H
+#include <sys/sysctl.h>
+#endif
+#define statvfs statfs
+#endif
+#if HAVE_VM_SWAP_PAGER_H
+#include <vm/swap_pager.h>
+#endif
+#if HAVE_SYS_FIXPOINT_H
+#include <sys/fixpoint.h>
+#endif
+#if HAVE_MALLOC_H
+#include <malloc.h>
+#endif
+#if HAVE_STRING_H
+#include <string.h>
+#endif
+#if TIME_WITH_SYS_TIME
+# include <sys/time.h>
+# include <time.h>
+#else
+# if HAVE_SYS_TIME_H
+#  include <sys/time.h>
+# else
+#  include <time.h>
+# endif
+#endif
+#if defined(hpux10) || defined(hpux11)
+#include <sys/pstat.h>
+#endif
+
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include <net-snmp/agent/auto_nlist.h>
+
+#include "mibdefs.h"
+#include "struct.h"
+#include "util_funcs.h"
+#include "memory.h"
+
+int             minimumswap;
+#ifndef linux
+static int      pageshift;      /* log base 2 of the pagesize */
+#endif
+
+#ifndef bsdi2
+#ifdef NSWAPDEV_SYMBOL
+int nswapdev=10;            /* taken from <machine/space.h> */
+#endif
+#ifdef NSWAPFS_SYMBOL
+int nswapfs=10;            /* taken from <machine/space.h> */
+#endif
+#endif      /* !bsdi2 */
+
+#define DEFAULTMINIMUMSWAP 16000        /* kilobytes */
+
+static FindVarMethod var_extensible_mem;
+
+void
+init_memory(void)
+{
+#ifndef linux
+    int             pagesize;
+#ifdef PHYSMEM_SYMBOL
+    auto_nlist(PHYSMEM_SYMBOL, 0, 0);
+#endif
+#ifdef TOTAL_MEMORY_SYMBOL
+    auto_nlist(TOTAL_MEMORY_SYMBOL, 0, 0);
+#endif
+#ifdef MBSTAT_SYMBOL
+    auto_nlist(MBSTAT_SYMBOL, 0, 0);
+#endif
+#ifdef SWDEVT_SYMBOL
+    auto_nlist(SWDEVT_SYMBOL, 0, 0);
+#endif
+#ifdef FSWDEVT_SYMBOL
+    auto_nlist(FSWDEVT_SYMBOL, 0, 0);
+#endif
+#ifdef NSWAPFS_SYMBOL
+    auto_nlist(NSWAPFS_SYMBOL, 0, 0);
+#endif
+#ifdef NSWAPDEV_SYMBOL
+    auto_nlist(NSWAPDEV_SYMBOL, 0, 0);
+#endif
+
+#ifndef bsdi2
+#ifdef NSWAPDEV_SYMBOL
+    if (auto_nlist(NSWAPDEV_SYMBOL, (char *) &nswapdev, sizeof(nswapdev))
+        == 0)
+        return;
+#endif
+#ifdef NSWAPFS_SYMBOL
+    if (auto_nlist(NSWAPFS_SYMBOL, (char *) &nswapfs, sizeof(nswapfs)) ==
+        0)
+        return;
+#endif
+#endif
+    pagesize = 1 << PGSHIFT;
+    pageshift = 0;
+    while (pagesize > 1) {
+        pageshift++;
+        pagesize >>= 1;
+    }
+    pageshift -= 10;
+#endif
+    {
+        struct variable2 extensible_mem_variables[] = {
+            {MIBINDEX, ASN_INTEGER, RONLY, var_extensible_mem, 1,
+             {MIBINDEX}},
+            {ERRORNAME, ASN_OCTET_STR, RONLY, var_extensible_mem, 1,
+             {ERRORNAME}},
+            {MEMTOTALSWAP, ASN_INTEGER, RONLY, var_extensible_mem, 1,
+             {MEMTOTALSWAP}},
+            {MEMAVAILSWAP, ASN_INTEGER, RONLY, var_extensible_mem, 1,
+             {MEMAVAILSWAP}},
+            {MEMTOTALREAL, ASN_INTEGER, RONLY, var_extensible_mem, 1,
+             {MEMTOTALREAL}},
+            {MEMAVAILREAL, ASN_INTEGER, RONLY, var_extensible_mem, 1,
+             {MEMAVAILREAL}},
+            {MEMTOTALSWAPTXT, ASN_INTEGER, RONLY, var_extensible_mem, 1,
+             {MEMTOTALSWAPTXT}},
+            {MEMUSEDSWAPTXT, ASN_INTEGER, RONLY, var_extensible_mem, 1,
+             {MEMUSEDSWAPTXT}},
+            {MEMTOTALREALTXT, ASN_INTEGER, RONLY, var_extensible_mem, 1,
+             {MEMTOTALREALTXT}},
+            {MEMUSEDREALTXT, ASN_INTEGER, RONLY, var_extensible_mem, 1,
+             {MEMUSEDREALTXT}},
+            {MEMTOTALFREE, ASN_INTEGER, RONLY, var_extensible_mem, 1,
+             {MEMTOTALFREE}},
+            {MEMSWAPMINIMUM, ASN_INTEGER, RONLY, var_extensible_mem, 1,
+             {MEMSWAPMINIMUM}},
+            {MEMSHARED, ASN_INTEGER, RONLY, var_extensible_mem, 1,
+             {MEMSHARED}},
+            {MEMBUFFER, ASN_INTEGER, RONLY, var_extensible_mem, 1,
+             {MEMBUFFER}},
+            {MEMCACHED, ASN_INTEGER, RONLY, var_extensible_mem, 1,
+             {MEMCACHED}},
+            {ERRORFLAG, ASN_INTEGER, RONLY, var_extensible_mem, 1,
+             {ERRORFLAG}},
+            {ERRORMSG, ASN_OCTET_STR, RONLY, var_extensible_mem, 1,
+             {ERRORMSG}}
+        };
+
+        /*
+         * Define the OID pointer to the top of the mib tree that we're
+         * registering underneath 
+         */
+        oid             mem_variables_oid[] = { UCDAVIS_MIB, MEMMIBNUM };
+
+        /*
+         * register ourselves with the agent to handle our mib tree 
+         */
+        REGISTER_MIB("ucd-snmp/memory", extensible_mem_variables,
+                     variable2, mem_variables_oid);
+
+        snmpd_register_config_handler("swap", memory_parse_config,
+                                      memory_free_config, "min-avail");
+    }
+}
+
+void
+memory_parse_config(const char *token, char *cptr)
+{
+    minimumswap = atoi(cptr);
+}
+
+void
+memory_free_config(void)
+{
+    minimumswap = DEFAULTMINIMUMSWAP;
+}
+
+#ifdef linux
+enum meminfo_row { meminfo_main = 0,
+    meminfo_swap
+};
+
+enum meminfo_col { meminfo_total = 0, meminfo_used, meminfo_free,
+    meminfo_shared, meminfo_buffers, meminfo_cached
+};
+#define MEMINFO_FILE "/proc/meminfo"
+
+static char     buf[300];
+
+/*
+ * This macro opens FILE only if necessary and seeks to 0 so that successive
+ * calls to the functions are more efficient.  It also reads the current
+ * contents of the file into the global buf.
+ */
+#define FILE_TO_BUF(FILE) {					\
+    static int n, fd = -1;					\
+    if (fd == -1 && (fd = open(FILE, O_RDONLY)) == -1) {	\
+	return 0;						\
+    }								\
+    lseek(fd, 0L, SEEK_SET);					\
+    if ((n = read(fd, buf, sizeof buf - 1)) < 0) {		\
+	close(fd);						\
+	fd = -1;						\
+	return 0;						\
+    }								\
+    buf[n] = '\0';						\
+}
+
+#define MAX_ROW 3               /* these are a little liberal for flexibility */
+#define MAX_COL 7
+
+unsigned      **
+meminfo(void)
+{
+    static unsigned *row[MAX_ROW + 1];  /* row pointers */
+    static unsigned num[MAX_ROW * MAX_COL];     /* number storage */
+    char           *p;
+    int             i, j, k, l;
+    unsigned long   m;
+
+    FILE_TO_BUF(MEMINFO_FILE)
+        if (!row[0])            /* init ptrs 1st time through */
+        for (i = 0; i < MAX_ROW; i++)   /* std column major order: */
+            row[i] = num + MAX_COL * i; /* A[i][j] = A + COLS*i + j */
+    p = buf;
+    for (i = 0; i < MAX_ROW; i++)       /* zero unassigned fields */
+        for (j = 0; j < MAX_COL; j++)
+            row[i][j] = 0;
+    for (i = 0; i < MAX_ROW && *p; i++) {       /* loop over rows */
+        while (*p && !isdigit(*p))
+            p++;                /* skip chars until a digit */
+        for (j = 0; j < MAX_COL && *p; j++) {   /* scanf column-by-column */
+            l = sscanf(p, "%lu%n", &m, &k);
+            m /= 1024;
+            if (0x7fffffff < m) {
+                *(row[i] + j) = 0x7fffffff;
+            } else {
+                *(row[i] + j) = (unsigned) m;
+            }
+            p += k;             /* step over used buffer */
+            if (*p == '\n' || l < 1)    /* end of line/buffer */
+                break;
+        }
+    }
+    /*
+     * row[i+1] = NULL;     terminate the row list, currently unnecessary 
+     */
+    return row;                 /* NULL return ==> error */
+}
+
+unsigned
+memory(int iindex)
+{
+    unsigned      **mem = meminfo();
+    if (mem != NULL)
+        return mem[meminfo_main][iindex];
+    else
+        return -1;
+}
+
+unsigned
+memswap(int iindex)
+{
+    unsigned      **mem = meminfo();
+    if (mem != NULL)
+        return mem[meminfo_swap][iindex];
+    else
+        return -1;
+}
+#else
+#define pagetok(size) ((size) << pageshift)
+#endif
+
+#define SWAPGETLEFT 0
+#define SWAPGETTOTAL 1
+
+static long
+getswap(int rettype)
+{
+    long            spaceleft = 0, spacetotal = 0;
+
+#if defined(linux)
+    spaceleft = memswap(meminfo_free);
+    spacetotal = memswap(meminfo_total);
+#elif defined(bsdi2)
+    struct swapstats swapst;
+    size_t          size = sizeof(swapst);
+    static int      mib[] = { CTL_VM, VM_SWAPSTATS };
+    if (sysctl(mib, 2, &swapst, &size, NULL, 0) < 0)
+        return (0);
+    spaceleft = swapst.swap_free / 2;
+    spacetotal = swapst.swap_total / 2;
+#elif defined (hpux10) || defined(hpux11)
+    struct pst_swapinfo pst_buf;
+    int ndx = 0;
+    long pgs, pgs_free;
+  
+    while (pstat_getswap(&pst_buf, sizeof(struct pst_swapinfo), 1, ndx) > 0) {
+        if (pst_buf.pss_flags & SW_BLOCK) {
+            pgs = pst_buf.pss_nblksenabled;
+            pgs_free = pst_buf.pss_nblksavail;
+        }
+        else if (pst_buf.pss_flags & SW_FS) {
+            pgs = pst_buf.pss_limit;
+            pgs_free = pgs - pst_buf.pss_allocated - pst_buf.pss_reserve;
+            /*
+             * the following calculation is done this way to avoid integer overflow!
+             * pss_swapchunk is either 512 or a multiple of 1024!
+             */
+            if (pst_buf.pss_swapchunk == 512) {
+                pgs_free /= 2;
+                pgs /= 2;
+            } else {
+                pgs_free *= (pst_buf.pss_swapchunk / 1024);
+                pgs *= (pst_buf.pss_swapchunk / 1024);
+            }
+        }
+        else {
+            pgs = pgs_free = 0;
+        }
+        spaceleft += pgs_free;
+        spacetotal += pgs;
+        ndx = pst_buf.pss_idx + 1;
+    }
+#else /* !linux && !bsdi2 && !hpux10 && !hpux11 */
+    struct swdevt   swdevt[100];
+    struct fswdevt  fswdevt[100];
+    FILE           *file;
+    struct extensible ex;
+    int             i, fd;
+    char           *cp;
+
+    if (auto_nlist
+        (SWDEVT_SYMBOL, (char *) swdevt, sizeof(struct swdevt) * nswapdev)
+        == 0)
+        return (0);
+    DEBUGMSGTL(("ucd-snmp/memory", "%d block swap devices: \n", nswapdev));
+    for (i = 0; i < nswapdev; i++) {
+        DEBUGMSGTL(("ucd-snmp/memory", "swdevt[%d]: %d\n", i,
+                    swdevt[i].sw_enable));
+        if (swdevt[i].sw_enable)
+        {
+#ifdef STRUCT_SWDEVT_HAS_SW_NBLKSENABLED
+            DEBUGMSGTL(("ucd-snmp/memory",
+                        "  swdevt.sw_nblksenabled:     %d\n",
+                        swdevt[i].sw_nblksenabled));
+            spacetotal += swdevt[i].sw_nblksenabled;
+#else
+            DEBUGMSGTL(("ucd-snmp/memory", "  swdevt.sw_nblks:     %d\n",
+                        swdevt[i].sw_nblks));
+            spacetotal += swdevt[i].sw_nblks;
+#endif
+            DEBUGMSGTL(("ucd-snmp/memory", "  swdevt.sw_nfpgs:     %d\n",
+                        swdevt[i].sw_nfpgs));
+            spaceleft += (swdevt[i].sw_nfpgs * 4);
+        }
+    }
+    if (auto_nlist
+        (FSWDEVT_SYMBOL, (char *) fswdevt,
+         sizeof(struct fswdevt) * nswapfs)
+        == 0)
+        return (0);
+    DEBUGMSGTL(("ucd-snmp/memory", "%d fs swap devices: \n", nswapfs));
+    for (i = 0; i < nswapfs; i++) {
+        DEBUGMSGTL(("ucd-snmp/memory", "fswdevt[%d]: %d\n", i,
+                    fswdevt[i].fsw_enable));
+        if (fswdevt[i].fsw_enable)
+        {
+            spacetotal += (fswdevt[i].fsw_limit * 2048);        /* 2048=bytes per page? */
+            spaceleft += (fswdevt[i].fsw_limit * 2048 -
+                          ((fswdevt[i].fsw_allocated -
+                            fswdevt[i].fsw_min) * 37));
+            DEBUGMSGTL(("ucd-snmp/memory",
+                        "  fswdevt[i].fsw_limit:     %d\n",
+                        fswdevt[i].fsw_limit));
+            DEBUGMSGTL(("ucd-snmp/memory",
+                        "  fswdevt[i].fsw_allocated: %d\n",
+                        fswdevt[i].fsw_allocated));
+            DEBUGMSGTL(("ucd-snmp/memory",
+                        "  fswdevt[i].fsw_min:       %d\n",
+                        fswdevt[i].fsw_min));
+            DEBUGMSGTL(("ucd-snmp/memory",
+                        "  fswdevt[i].fsw_reserve:   %d\n",
+                        fswdevt[i].fsw_reserve));
+            /*
+             * 37 = calculated value I know it makes no sense, nor is it accurate 
+             */
+        }
+    }
+    /*
+     * this is a real hack.  I need to get the hold info from swapinfo, but
+     * I can't figure out how to read it out of the kernel directly
+     * -- Wes 
+     */
+    strcpy(ex.command, "/etc/swapinfo -h");
+    if ((fd = get_exec_output(&ex)) != -1) {
+        file = fdopen(fd, "r");
+        for (i = 1;
+             i <= 2 && fgets(ex.output, sizeof(ex.output), file) != NULL;
+             i++);
+        if (fgets(ex.output, sizeof(ex.output), file) != NULL) {
+            cp = skip_white(ex.output); /* not there should be any */
+            cp = skip_not_white(cp);    /* skip over "reserve" */
+            cp = skip_white(cp);
+            cp = skip_not_white(cp);    /* avail swap, a '-' in most cases */
+            cp = skip_white(cp);
+            spaceleft -= atoi(cp);      /* reserved swap */
+        }
+        fclose(file);
+        wait_on_exec(&ex);
+    } else {
+        return (0);
+    }
+#endif                          /* !linux && !bsdi2 && !hpux10 && !hpux11 */
+
+    switch (rettype) {
+    case SWAPGETLEFT:
+        return (spaceleft);
+    case SWAPGETTOTAL:
+        return (spacetotal);
+    }
+    return 0;
+}
+
+static
+unsigned char  *
+var_extensible_mem(struct variable *vp,
+                   oid * name,
+                   size_t * length,
+                   int exact,
+                   size_t * var_len, WriteMethod ** write_method)
+{
+
+    static long     long_ret;
+    static char     errmsg[300];
+#if !defined(linux)
+#if defined(hpux10) || defined(hpux11)
+    struct pst_dynamic pst_buf;
+#elif defined(TOTAL_MEMORY_SYMBOL) || defined(USE_SYSCTL_VM)
+    struct vmtotal total;
+#endif
+#endif
+
+    long_ret = 0;               /* set to 0 as default */
+
+    if (header_generic(vp, name, length, exact, var_len, write_method))
+        return (NULL);
+
+#if !defined(linux)
+#if defined(hpux10) || defined(hpux11)
+    if (pstat_getdynamic(&pst_buf, sizeof(struct pst_dynamic), 1, 0) < 0)
+        return NULL;
+#elif defined(USE_SYSCTL_VM)
+    /*
+     * sum memory statistics 
+     */
+    {
+        size_t          size = sizeof(total);
+        static int      mib[] = { CTL_VM, VM_TOTAL };
+        if (sysctl(mib, 2, &total, &size, NULL, 0) < 0)
+            return NULL;
+    }
+#elif defined(TOTAL_MEMORY_SYMBOL)
+    if (auto_nlist(TOTAL_MEMORY_SYMBOL, (char *) &total, sizeof(total)) ==
+        0)
+        return NULL;
+#endif
+#endif                          /* !linux */
+
+    switch (vp->magic) {
+    case MIBINDEX:
+        long_ret = 0;
+        return ((u_char *) (&long_ret));
+    case ERRORNAME:            /* dummy name */
+        sprintf(errmsg, "swap");
+        *var_len = strlen(errmsg);
+        return ((u_char *) (errmsg));
+    case MEMTOTALSWAP:
+        long_ret = getswap(SWAPGETTOTAL);
+        return ((u_char *) (&long_ret));
+    case MEMAVAILSWAP:
+        long_ret = getswap(SWAPGETLEFT);
+        return ((u_char *) (&long_ret));
+    case MEMSWAPMINIMUM:
+        long_ret = minimumswap;
+        return ((u_char *) (&long_ret));
+    case MEMTOTALREAL:
+#if defined(USE_SYSCTL)
+        {
+            size_t          size = sizeof(long_ret);
+            static int      mib[] = { CTL_HW, HW_PHYSMEM };
+            if (sysctl(mib, 2, &long_ret, &size, NULL, 0) < 0)
+                return NULL;
+            long_ret = long_ret / 1024;
+        }
+#elif defined(hpux10) || defined(hpux11)
+        {
+            struct pst_static pst_buf;
+            if (pstat_getstatic(&pst_buf, sizeof(struct pst_static), 1, 0)
+                < 0)
+                return NULL;
+            long_ret =
+                pst_buf.physical_memory * (pst_buf.page_size / 1024);
+        }
+#elif defined(linux)
+        long_ret = memory(meminfo_total);
+#elif defined(_SC_PHYS_PAGES) && defined(_SC_PAGESIZE)
+        long_ret =
+            sysconf(_SC_PHYS_PAGES) * (sysconf(_SC_PAGESIZE) / 1024);
+#elif defined(PHYSMEM_SYMBOL)
+        {
+            int             result;
+            if (auto_nlist
+                (PHYSMEM_SYMBOL, (char *) &result, sizeof(result)) == 0)
+                return NULL;
+            long_ret = result * 1000;   /* ??? */
+        }
+#else
+        return NULL;            /* no dummy values */
+#endif
+        return ((u_char *) (&long_ret));
+    case MEMAVAILREAL:
+#ifdef linux
+        long_ret = memory(meminfo_free);
+#elif defined(hpux10) || defined(hpux11)
+        long_ret = pagetok((int) pst_buf.psd_arm);
+#elif defined(TOTAL_MEMORY_SYMBOL) || defined(USE_SYSCTL_VM)
+        long_ret = pagetok((int) total.t_arm);
+#else
+        return NULL;            /* no dummy values */
+#endif
+        return ((u_char *) (&long_ret));
+#ifndef linux
+    case MEMTOTALSWAPTXT:
+#if defined(hpux10) || defined(hpux11)
+        long_ret = pagetok((int) pst_buf.psd_vmtxt);
+#elif !defined(bsdi2)
+        long_ret = pagetok(total.t_vmtxt);
+#else
+        return NULL;            /* no dummy values */
+#endif
+        return ((u_char *) (&long_ret));
+    case MEMUSEDSWAPTXT:
+#if defined(hpux10) || defined(hpux11)
+        long_ret = pagetok((int) pst_buf.psd_avmtxt);
+#elif !defined(bsdi2)
+        long_ret = pagetok(total.t_avmtxt);
+#else
+        return NULL;            /* no dummy values */
+#endif
+        return ((u_char *) (&long_ret));
+    case MEMTOTALREALTXT:
+#if defined(hpux10) || defined(hpux11)
+        long_ret = pagetok((int) pst_buf.psd_rmtxt);
+#elif !defined(bsdi2)
+        long_ret = pagetok(total.t_rmtxt);
+#else
+        return NULL;            /* no dummy values */
+#endif
+        return ((u_char *) (&long_ret));
+    case MEMUSEDREALTXT:
+#if defined(hpux10) || defined(hpux11)
+        long_ret = pagetok((int) pst_buf.psd_armtxt);
+#elif !defined(bsdi2)
+        long_ret = pagetok(total.t_armtxt);
+#else
+        return NULL;            /* no dummy values */
+#endif
+        return ((u_char *) (&long_ret));
+#endif                          /* linux */
+    case MEMTOTALFREE:
+#ifdef linux
+        long_ret = memory(meminfo_free) + memswap(meminfo_free);
+#elif defined(hpux10) || defined(hpux11)
+        long_ret = pagetok((int) pst_buf.psd_free);
+#else
+        long_ret = pagetok(total.t_free);
+#endif
+        return ((u_char *) (&long_ret));
+    case MEMCACHED:
+#ifdef linux
+        long_ret = memory(meminfo_cached);
+#else
+        return NULL;            /* no dummy values */
+#endif
+        return ((u_char *) (&long_ret));
+    case MEMBUFFER:
+#ifdef linux
+        long_ret = memory(meminfo_buffers);
+#else
+        return NULL;            /* no dummy values */
+#endif
+        return ((u_char *) (&long_ret));
+    case MEMSHARED:
+#ifdef linux
+        long_ret = memory(meminfo_shared);
+#else
+        return NULL;            /* no dummy values */
+#endif
+        return ((u_char *) (&long_ret));
+    case ERRORFLAG:
+        long_ret = getswap(SWAPGETLEFT);
+        long_ret = (long_ret > minimumswap) ? 0 : 1;
+        return ((u_char *) (&long_ret));
+    case ERRORMSG:
+        long_ret = getswap(SWAPGETLEFT);
+        if ((long_ret > minimumswap) ? 0 : 1)
+            sprintf(errmsg, "Running out of swap space (%ld)",
+                    getswap(SWAPGETLEFT));
+        else
+            errmsg[0] = 0;
+        *var_len = strlen(errmsg);
+        return ((u_char *) (errmsg));
+    }
+    return NULL;
+}
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/ucd-snmp/memory_dynix.c tomato121/release/src/router/snmp/agent/mibgroup/ucd-snmp/memory_dynix.c
--- tomato/release/src/router/snmp/agent/mibgroup/ucd-snmp/memory_dynix.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/ucd-snmp/memory_dynix.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,227 @@
+#include <net-snmp/net-snmp-config.h>
+
+#ifdef dynix
+#  ifdef HAVE_SYS_SWAP_H
+#    include <sys/swap.h>
+#  endif
+#  ifdef HAVE_SYS_PARAM_H
+#    include <sys/param.h>
+#  endif
+#  ifdef HAVE_UNISTD_H
+#    include <unistd.h>
+#  endif
+#endif
+
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include <net-snmp/agent/auto_nlist.h>
+
+
+#include "util_funcs.h"         /* utility function declarations */
+#include "memory.h"             /* the module-specific header */
+#include "memory_dynix.h"       /* the module-specific header */
+
+int             minimumswap;
+static char     errmsg[300];
+
+static FindVarMethod var_extensible_mem;
+static long     getFreeSwap(void);
+static long     getTotalSwap(void);
+static long     getTotalFree(void);
+
+void
+init_memory_dynix(void)
+{
+
+    struct variable2 extensible_mem_variables[] = {
+        {MIBINDEX, ASN_INTEGER, RONLY, var_extensible_mem, 1, {MIBINDEX}},
+        {ERRORNAME, ASN_OCTET_STR, RONLY, var_extensible_mem, 1,
+         {ERRORNAME}},
+        {MEMTOTALSWAP, ASN_INTEGER, RONLY, var_extensible_mem, 1,
+         {MEMTOTALSWAP}},
+        {MEMAVAILSWAP, ASN_INTEGER, RONLY, var_extensible_mem, 1,
+         {MEMAVAILSWAP}},
+        {MEMTOTALREAL, ASN_INTEGER, RONLY, var_extensible_mem, 1,
+         {MEMTOTALREAL}},
+        {MEMAVAILREAL, ASN_INTEGER, RONLY, var_extensible_mem, 1,
+         {MEMAVAILREAL}},
+        {MEMTOTALSWAPTXT, ASN_INTEGER, RONLY, var_extensible_mem, 1,
+         {MEMTOTALSWAPTXT}},
+        {MEMUSEDSWAPTXT, ASN_INTEGER, RONLY, var_extensible_mem, 1,
+         {MEMUSEDSWAPTXT}},
+        {MEMTOTALREALTXT, ASN_INTEGER, RONLY, var_extensible_mem, 1,
+         {MEMTOTALREALTXT}},
+        {MEMUSEDREALTXT, ASN_INTEGER, RONLY, var_extensible_mem, 1,
+         {MEMUSEDREALTXT}},
+        {MEMTOTALFREE, ASN_INTEGER, RONLY, var_extensible_mem, 1,
+         {MEMTOTALFREE}},
+        {MEMSWAPMINIMUM, ASN_INTEGER, RONLY, var_extensible_mem, 1,
+         {MEMSWAPMINIMUM}},
+        {MEMSHARED, ASN_INTEGER, RONLY, var_extensible_mem, 1,
+         {MEMSHARED}},
+        {MEMBUFFER, ASN_INTEGER, RONLY, var_extensible_mem, 1,
+         {MEMBUFFER}},
+        {MEMCACHED, ASN_INTEGER, RONLY, var_extensible_mem, 1,
+         {MEMCACHED}},
+        {ERRORFLAG, ASN_INTEGER, RONLY, var_extensible_mem, 1,
+         {ERRORFLAG}},
+        {ERRORMSG, ASN_OCTET_STR, RONLY, var_extensible_mem, 1, {ERRORMSG}}
+    };
+
+    /*
+     * Define the OID pointer to the top of the mib tree that we're
+     * registering underneath 
+     */
+    oid             mem_variables_oid[] = { UCDAVIS_MIB, MEMMIBNUM };
+
+    /*
+     * register ourselves with the agent to handle our mib tree 
+     */
+    REGISTER_MIB("ucd-snmp/memory", extensible_mem_variables, variable2,
+                 mem_variables_oid);
+
+    snmpd_register_config_handler("swap", memory_parse_config,
+                                  memory_free_config, "min-avail");
+
+}
+
+static u_char  *
+var_extensible_mem(struct variable *vp,
+                   oid * name,
+                   size_t * length,
+                   int exact,
+                   size_t * var_len, WriteMethod ** write_method)
+{
+    static long     long_ret;
+
+    /*
+     * Initialize the return value to 0 
+     */
+    long_ret = 0;
+
+    if (header_generic(vp, name, length, exact, var_len, write_method))
+        return (NULL);
+
+    switch (vp->magic) {
+    case MIBINDEX:
+        long_ret = 0;
+        return ((u_char *) (&long_ret));
+    case ERRORNAME:            /* dummy name */
+        sprintf(errmsg, "swap");
+        *var_len = strlen(errmsg);
+        return ((u_char *) (errmsg));
+    case MEMTOTALSWAP:
+        long_ret = S2KB(getTotalSwap());
+        return ((u_char *) (&long_ret));
+    case MEMAVAILSWAP:
+        long_ret = S2KB(getFreeSwap());
+        return ((u_char *) (&long_ret));
+    case MEMSWAPMINIMUM:
+        long_ret = minimumswap;
+        return ((u_char *) (&long_ret));
+    case MEMTOTALREAL:
+        long_ret = P2KB(sysconf(_SC_PHYSMEM));
+        return ((u_char *) (&long_ret));
+    case MEMAVAILREAL:
+        long_ret = P2KB(sysconf(_SC_FREEMEM));
+        return ((u_char *) (&long_ret));
+    case MEMTOTALFREE:
+        long_ret = getTotalFree();
+        return ((u_char *) (&long_ret));
+
+    case ERRORFLAG:
+        long_ret = getTotalFree();
+        long_ret = (long_ret > minimumswap) ? 0 : 1;
+        return ((u_char *) (&long_ret));
+
+    case ERRORMSG:
+        long_ret = getTotalFree();
+        if ((long_ret > minimumswap) ? 0 : 1)
+            sprintf(errmsg, "Running out of swap space (%ld)", long_ret);
+        else
+            errmsg[0] = 0;
+        *var_len = strlen(errmsg);
+        return ((u_char *) (errmsg));
+
+    }
+
+    return (NULL);
+}
+
+#define DEFAULTMINIMUMSWAP 16384        /* kilobytes */
+
+void
+memory_parse_config(const char *token, char *cptr)
+{
+    minimumswap = atoi(cptr);
+}
+
+void
+memory_free_config(void)
+{
+    minimumswap = DEFAULTMINIMUMSWAP;
+}
+
+
+
+/*
+ * return is in sectors 
+ */
+long
+getTotalSwap(void)
+{
+    long            total_swp_sectors = -1;
+
+    size_t          max_elements = MAXSWAPDEVS;
+    swapsize_t      swap_dblks[MAXSWAPDEVS];
+    swapstat_t      swap_status;
+    int             swap_sizes;
+
+    if ((swap_sizes =
+         getswapstat(max_elements, swap_dblks, &swap_status) >= 0))
+        total_swp_sectors =
+            swap_dblks[0].sws_size * swap_dblks[0].sws_total;
+
+    return (total_swp_sectors);
+}
+
+/*
+ * return is in sectors 
+ */
+static long
+getFreeSwap(void)
+{
+    long            free_swp_sectors = -1;
+
+    size_t          max_elements = MAXSWAPDEVS;
+    swapsize_t      swap_dblks[MAXSWAPDEVS];
+    swapstat_t      swap_status;
+    int             i, swap_sizes;
+
+    if ((swap_sizes =
+         getswapstat(max_elements, swap_dblks, &swap_status) >= 0)) {
+        for (i = 0; i < swap_sizes; i++)
+            free_swp_sectors +=
+                swap_dblks[0].sws_size * swap_dblks[i].sws_avail;
+    }
+
+    return (free_swp_sectors);
+}
+
+/*
+ * return is in kilobytes 
+ */
+static long
+getTotalFree(void)
+{
+    long            free_swap = S2KB(getFreeSwap());
+    long            free_mem = P2KB(sysconf(_SC_FREEMEM));
+
+    if (free_swap < 0)
+        return (free_swap);
+    if (free_mem < 0)
+        return (free_mem);
+
+    free_mem += free_swap;
+    return (free_mem);
+}
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/ucd-snmp/memory_dynix.h tomato121/release/src/router/snmp/agent/mibgroup/ucd-snmp/memory_dynix.h
--- tomato/release/src/router/snmp/agent/mibgroup/ucd-snmp/memory_dynix.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/ucd-snmp/memory_dynix.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,27 @@
+/*
+ *  memory quantity mib groups
+ *
+ */
+#ifndef _MIBGROUP_MEMORY_DYNIX_H
+#define _MIBGROUP_MEMORY_DYNIX_H
+
+#include "mibdefs.h"
+
+/*
+ * from /usr/include/sys/mc_param.h 
+ */
+#define MMU_PAGESIZE 0x1000     /* 4096 bytes */
+
+/*
+ * Here's the correct way to convert sectors to KB
+ * #define S2KB(size) (((size)*DEV_BSIZE)/1024)
+ * Here's the quick way plus no fear of overflow
+ */
+#define S2KB(size)  ((size)/2)  /* sectors to KB */
+#define S2MB(size)  (((size)+1023)/2048)        /* sectors to MB */
+#define P2KB(size)  ((size)*(MMU_PAGESIZE/1024))        /* pages to KB */
+#define P2MB(size)  ((P2KB(size)+511)/1024)     /* pages to MB */
+
+void            init_memory_dynix(void);
+
+#endif                          /* _MIBGROUP_MEMORY_DYNIX_H */
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/ucd-snmp/memory_freebsd2.c tomato121/release/src/router/snmp/agent/mibgroup/ucd-snmp/memory_freebsd2.c
--- tomato/release/src/router/snmp/agent/mibgroup/ucd-snmp/memory_freebsd2.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/ucd-snmp/memory_freebsd2.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,391 @@
+/*
+ * memory_freebsd2.c
+ */
+
+#include <net-snmp/net-snmp-config.h>
+
+
+/*
+ * Ripped from /usr/scr/usr.bin/vmstat/vmstat.c (covering all bases) 
+ */
+#include <sys/param.h>
+#include <sys/time.h>
+#include <sys/proc.h>
+#include <sys/dkstat.h>
+#ifdef freebsd5
+#include <sys/bio.h>
+#endif
+#include <sys/buf.h>
+#include <sys/uio.h>
+#include <sys/namei.h>
+#include <sys/malloc.h>
+#include <sys/signal.h>
+#include <sys/fcntl.h>
+#include <sys/ioctl.h>
+#include <sys/sysctl.h>
+#include <sys/vmmeter.h>
+
+#if HAVE_SYS_VMPARAM_H
+#include <sys/vmparam.h>
+#else
+#include <vm/vm_param.h>
+#endif
+
+#include <time.h>
+#include <nlist.h>
+#include <kvm.h>
+#include <errno.h>
+#include <unistd.h>
+#include <stdio.h>
+#include <ctype.h>
+#include <stdlib.h>
+#include <string.h>
+#include <paths.h>
+#include <limits.h>
+
+#if HAVE_DMALLOC_H
+#include <dmalloc.h>
+#endif
+
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include <net-snmp/agent/auto_nlist.h>
+
+#include "util_funcs.h"
+#include "memory.h"
+#include "memory_freebsd2.h"
+
+/*
+ * nlist symbols 
+ */
+#define SUM_SYMBOL      "cnt"
+#ifndef openbsd2
+#define BUFSPACE_SYMBOL "bufspace"
+#endif
+
+/*
+ * Default swap warning limit (kb) 
+ */
+#define DEFAULTMINIMUMSWAP 16000
+
+/*
+ * Swap warning limit 
+ */
+long            minimumswap;
+
+/*
+ * Swap info 
+ */
+quad_t          swapTotal;
+quad_t          swapUsed;
+quad_t          swapFree;
+
+static FindVarMethod var_extensible_mem;
+
+void
+init_memory_freebsd2(void)
+{
+
+    struct variable2 extensible_mem_variables[] = {
+        {MIBINDEX, ASN_INTEGER, RONLY, var_extensible_mem, 1, {MIBINDEX}},
+        {ERRORNAME, ASN_OCTET_STR, RONLY, var_extensible_mem, 1,
+         {ERRORNAME}},
+        {MEMTOTALSWAP, ASN_INTEGER, RONLY, var_extensible_mem, 1,
+         {MEMTOTALSWAP}},
+        {MEMAVAILSWAP, ASN_INTEGER, RONLY, var_extensible_mem, 1,
+         {MEMAVAILSWAP}},
+        {MEMTOTALREAL, ASN_INTEGER, RONLY, var_extensible_mem, 1,
+         {MEMTOTALREAL}},
+        {MEMAVAILREAL, ASN_INTEGER, RONLY, var_extensible_mem, 1,
+         {MEMAVAILREAL}},
+        {MEMTOTALSWAPTXT, ASN_INTEGER, RONLY, var_extensible_mem, 1,
+         {MEMTOTALSWAPTXT}},
+        {MEMUSEDSWAPTXT, ASN_INTEGER, RONLY, var_extensible_mem, 1,
+         {MEMUSEDSWAPTXT}},
+        {MEMTOTALREALTXT, ASN_INTEGER, RONLY, var_extensible_mem, 1,
+         {MEMTOTALREALTXT}},
+        {MEMUSEDREALTXT, ASN_INTEGER, RONLY, var_extensible_mem, 1,
+         {MEMUSEDREALTXT}},
+        {MEMTOTALFREE, ASN_INTEGER, RONLY, var_extensible_mem, 1,
+         {MEMTOTALFREE}},
+        {MEMSWAPMINIMUM, ASN_INTEGER, RONLY, var_extensible_mem, 1,
+         {MEMSWAPMINIMUM}},
+        {MEMSHARED, ASN_INTEGER, RONLY, var_extensible_mem, 1,
+         {MEMSHARED}},
+        {MEMBUFFER, ASN_INTEGER, RONLY, var_extensible_mem, 1,
+         {MEMBUFFER}},
+        {MEMCACHED, ASN_INTEGER, RONLY, var_extensible_mem, 1,
+         {MEMCACHED}},
+        {ERRORFLAG, ASN_INTEGER, RONLY, var_extensible_mem, 1,
+         {ERRORFLAG}},
+        {ERRORMSG, ASN_OCTET_STR, RONLY, var_extensible_mem, 1, {ERRORMSG}}
+    };
+
+    /*
+     * Define the OID pointer to the top of the mib tree that we're
+     * registering underneath 
+     */
+    oid             mem_variables_oid[] = { UCDAVIS_MIB, MEMMIBNUM };
+
+    /*
+     * register ourselves with the agent to handle our mib tree 
+     */
+    REGISTER_MIB("ucd-snmp/memory", extensible_mem_variables, variable2,
+                 mem_variables_oid);
+
+    snmpd_register_config_handler("swap", memory_parse_config,
+                                  memory_free_config, "min-avail");
+}
+
+
+void
+memory_parse_config(const char *token, char *cptr)
+{
+    minimumswap = atoi(cptr);
+}
+
+void
+memory_free_config(void)
+{
+    minimumswap = DEFAULTMINIMUMSWAP;
+}
+
+#ifndef freebsd4
+/*
+ * Executes swapinfo and parses last line 
+ */
+/*
+ * This is just way too ugly ;) 
+ */
+
+void
+swapmode(void)
+{
+    struct extensible ext;
+    int             fd;
+    FILE           *file;
+
+    strcpy(ext.command, "/usr/sbin/swapinfo -k");
+
+    if ((fd = get_exec_output(&ext)) != -1) {
+        file = fdopen(fd, "r");
+
+        while (fgets(ext.output, sizeof(ext.output), file) != NULL);
+
+        fclose(file);
+        wait_on_exec(&ext);
+
+        sscanf(ext.output, "%*s%*d%qd%qd", &swapUsed, &swapFree);
+
+        swapTotal = swapUsed + swapFree;
+    }
+}
+#else
+/*
+ * swapmode is based on a program called swapinfo written
+ * by Kevin Lahey <kml@rokkaku.atl.ga.us>.
+ */
+
+#include <sys/conf.h>
+
+#define NSWDEV_SYMBOL     "nswdev"
+#define DMMAX_SYMBOL      "dmmax"
+#define SWDEVT_SYMBOL     "swdevt"
+
+void
+swapmode(void)
+{
+    int             nswdev, dmmax, pagesize;
+    int             i, n;
+    struct swdevt  *sw;
+    static kvm_t   *kd = NULL;
+    struct kvm_swap kswap[16];
+
+    if (kd == NULL)
+        kd = kvm_openfiles(NULL, NULL, NULL, O_RDONLY, NULL);
+
+    auto_nlist(NSWDEV_SYMBOL, (char *) &nswdev, sizeof(nswdev));
+    auto_nlist(DMMAX_SYMBOL, (char *) &dmmax, sizeof(dmmax));
+
+    sw = (struct swdevt *) malloc(nswdev * sizeof(*sw));
+    if (sw == NULL)
+        return;
+
+    auto_nlist(SWDEVT_SYMBOL, (char *) sw, nswdev * sizeof(*sw));
+
+    n = kvm_getswapinfo(kd, kswap, sizeof(kswap) / sizeof(kswap[0]), 0);
+
+    swapUsed = swapTotal = swapFree = 0;
+    /*
+     * Count up free swap space. 
+     */
+    for (i = 0; i < n; ++i)
+        swapFree += kswap[i].ksw_total - kswap[i].ksw_used;
+
+    /*
+     * Count up total swap space 
+     */
+    for (i = 0; i < n; i++)
+        swapTotal += kswap[i].ksw_total;
+
+    /*
+     * Calculate used swap space 
+     */
+    swapUsed = swapTotal - swapFree;
+
+    /*
+     * Convert to kb 
+     */
+    pagesize = getpagesize() / 1024;
+
+    swapTotal *= pagesize;
+    swapUsed *= pagesize;
+    swapFree *= pagesize;
+
+    free(sw);
+}
+#endif
+
+
+/*
+ * var_extensible_mem(...
+ * Arguments:
+ * vp     IN      - pointer to variable entry that points here
+ * name    IN/OUT  - IN/name requested, OUT/name found
+ * length  IN/OUT  - length of IN/OUT oid's 
+ * exact   IN      - TRUE if an exact match was requested
+ * var_len OUT     - length of variable or 0 if function returned
+ * write_method
+ * 
+ */
+
+static unsigned char *
+var_extensible_mem(struct variable *vp,
+                   oid * name,
+                   size_t * length,
+                   int exact,
+                   size_t * var_len, WriteMethod ** write_method)
+{
+    static long     long_ret;
+    static char     errmsg[300];
+
+    static struct vmmeter mem;
+    static struct vmtotal total;
+    size_t          total_size = sizeof(total);
+    int             total_mib[] = { CTL_VM, VM_METER };
+
+    long            phys_mem;
+    size_t          phys_mem_size = sizeof(phys_mem);
+    int             phys_mem_mib[] = { CTL_HW, HW_USERMEM };
+
+#ifdef BUFSPACE_SYMBOL
+    long            bufspace;
+#endif
+
+    if (header_generic(vp, name, length, exact, var_len, write_method))
+        return (NULL);
+
+    /*
+     * Memory info 
+     */
+    auto_nlist(SUM_SYMBOL, (char *) &mem, sizeof(mem));
+    sysctl(total_mib, 2, &total, &total_size, NULL, 0);
+
+    /*
+     * Swap info 
+     */
+    swapmode();
+    /*
+     * getSwap(); 
+     */
+
+    /*
+     * Physical memory 
+     */
+    sysctl(phys_mem_mib, 2, &phys_mem, &phys_mem_size, NULL, 0);
+
+#ifdef BUFSPACE_SYMBOL
+    /*
+     * Buffer space 
+     */
+    auto_nlist(BUFSPACE_SYMBOL, (char *) &bufspace, sizeof(bufspace));
+#endif
+
+    long_ret = 0;               /* set to 0 as default */
+
+    /*
+     * Page-to-kb macro 
+     */
+#define ptok(p) ((p) * (mem.v_page_size >> 10))
+
+    switch (vp->magic) {
+    case MIBINDEX:
+        long_ret = 0;
+        return ((u_char *) (&long_ret));
+    case ERRORNAME:            /* dummy name */
+        sprintf(errmsg, "swap");
+        *var_len = strlen(errmsg);
+        return ((u_char *) (errmsg));
+    case MEMTOTALSWAP:
+        long_ret = swapTotal;
+        return ((u_char *) (&long_ret));
+    case MEMAVAILSWAP:         /* FREE swap memory */
+        long_ret = swapFree;
+        return ((u_char *) (&long_ret));
+    case MEMTOTALREAL:
+        long_ret = phys_mem >> 10;
+        return ((u_char *) (&long_ret));
+    case MEMAVAILREAL:         /* FREE real memory */
+        long_ret = ptok(mem.v_free_count);
+        return ((u_char *) (&long_ret));
+
+        /*
+         * these are not implemented 
+         */
+    case MEMTOTALSWAPTXT:
+    case MEMUSEDSWAPTXT:
+    case MEMTOTALREALTXT:
+    case MEMUSEDREALTXT:
+#if NO_DUMMY_VALUES
+        return NULL;
+#endif
+        long_ret = -1;
+        return ((u_char *) (&long_ret));
+
+    case MEMTOTALFREE:
+        long_ret = ptok((int) total.t_free);
+        return ((u_char *) (&long_ret));
+    case MEMSWAPMINIMUM:
+        long_ret = minimumswap;
+        return ((u_char *) (&long_ret));
+    case MEMSHARED:
+        long_ret = ptok(total.t_vmshr +
+                        total.t_avmshr + total.t_rmshr + total.t_armshr);
+        return ((u_char *) (&long_ret));
+#ifdef BUFSPACE_SYMBOL
+    case MEMBUFFER:
+        long_ret = bufspace >> 10;
+        return ((u_char *) (&long_ret));
+#endif
+#ifndef openbsd2
+    case MEMCACHED:
+#ifdef darwin
+        long_ret = ptok(mem.v_lookups);
+#else
+        long_ret = ptok(mem.v_cache_count);
+#endif
+        return ((u_char *) (&long_ret));
+#endif
+    case ERRORFLAG:
+        long_ret = (swapFree > minimumswap) ? 0 : 1;
+        return ((u_char *) (&long_ret));
+    case ERRORMSG:
+        if (swapFree < minimumswap)
+            sprintf(errmsg, "Running out of swap space (%qd)", swapFree);
+        else
+            errmsg[0] = 0;
+        *var_len = strlen(errmsg);
+        return ((u_char *) (errmsg));
+    }
+    return NULL;
+}
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/ucd-snmp/memory_freebsd2.h tomato121/release/src/router/snmp/agent/mibgroup/ucd-snmp/memory_freebsd2.h
--- tomato/release/src/router/snmp/agent/mibgroup/ucd-snmp/memory_freebsd2.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/ucd-snmp/memory_freebsd2.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,12 @@
+/*
+ *  memory quantity mib groups
+ *
+ */
+#ifndef _MIBGROUP_MEMORY_FREEBSD2_H
+#define _MIBGROUP_MEMORY_FREEBSD2_H
+
+#include "mibdefs.h"
+
+extern void     init_memory_freebsd2(void);
+
+#endif                          /* _MIBGROUP_MEMORY_FREEBSD2_H */
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/ucd-snmp/memory.h tomato121/release/src/router/snmp/agent/mibgroup/ucd-snmp/memory.h
--- tomato/release/src/router/snmp/agent/mibgroup/ucd-snmp/memory.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/ucd-snmp/memory.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,33 @@
+/*
+ *  memory quantity mib groups
+ *
+ */
+#ifndef _MIBGROUP_MEMORY_H
+#define _MIBGROUP_MEMORY_H
+
+#include "mibdefs.h"
+
+void            init_memory(void);
+
+/*
+ * config file parsing routines 
+ */
+void            memory_parse_config(const char *, char *);
+void            memory_free_config(void);
+
+#define MEMTOTALSWAP 3
+#define MEMAVAILSWAP 4
+#define MEMTOTALREAL 5
+#define MEMAVAILREAL 6
+#define MEMTOTALSWAPTXT 7
+#define MEMUSEDSWAPTXT 8
+#define MEMTOTALREALTXT 9
+#define MEMUSEDREALTXT 10
+#define MEMTOTALFREE 11
+#define MEMSWAPMINIMUM 12
+#define MEMSHARED 13
+#define MEMBUFFER 14
+#define MEMCACHED 15
+#define MEMSWAPERROR 16
+
+#endif                          /* _MIBGROUP_MEMORY_H */
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/ucd-snmp/memory_hpux.c tomato121/release/src/router/snmp/agent/mibgroup/ucd-snmp/memory_hpux.c
--- tomato/release/src/router/snmp/agent/mibgroup/ucd-snmp/memory_hpux.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/ucd-snmp/memory_hpux.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,295 @@
+#include <net-snmp/net-snmp-config.h>
+#if HAVE_STRING_H
+#include <string.h>
+#endif
+#if HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+
+#include <sys/types.h>
+
+#if HAVE_DMALLOC_H
+#include <dmalloc.h>
+#endif
+
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include <net-snmp/agent/auto_nlist.h>
+#include "memory.h"             /* the module-specific header */
+#include "memory_hpux.h"        /* the module-specific header */
+
+#include <sys/pstat.h>
+
+#define MAXSTRSIZE	80
+#define DEFAULTMINIMUMSWAP 16000        /* kilobytes */
+
+int             minimumswap;
+static char     errmsg[300];
+
+static FindVarMethod var_extensible_mem;
+static long     getFreeSwap(void);
+static long     getTotalFree(void);
+static long     getTotalSwap(void);
+
+struct swapinfo {
+    unsigned long   total_swap; /* in kilobytes */
+    unsigned long   free_swap;  /* in kilobytes */
+};
+
+void
+memory_parse_config(const char *token, char *cptr)
+{
+    minimumswap = atoi(cptr);
+}
+
+void
+memory_free_config(void)
+{
+    minimumswap = DEFAULTMINIMUMSWAP;
+}
+
+void
+init_memory_hpux(void)
+{
+
+    struct variable2 extensible_mem_variables[] = {
+        {MIBINDEX, ASN_INTEGER, RONLY, var_extensible_mem, 1, {MIBINDEX}},
+        {ERRORNAME, ASN_OCTET_STR, RONLY, var_extensible_mem, 1,
+         {ERRORNAME}},
+        {MEMTOTALSWAP, ASN_INTEGER, RONLY, var_extensible_mem, 1,
+         {MEMTOTALSWAP}},
+        {MEMAVAILSWAP, ASN_INTEGER, RONLY, var_extensible_mem, 1,
+         {MEMAVAILSWAP}},
+        {MEMTOTALREAL, ASN_INTEGER, RONLY, var_extensible_mem, 1,
+         {MEMTOTALREAL}},
+        {MEMAVAILREAL, ASN_INTEGER, RONLY, var_extensible_mem, 1,
+         {MEMAVAILREAL}},
+        {MEMTOTALSWAPTXT, ASN_INTEGER, RONLY, var_extensible_mem, 1,
+         {MEMTOTALSWAPTXT}},
+        {MEMUSEDSWAPTXT, ASN_INTEGER, RONLY, var_extensible_mem, 1,
+         {MEMUSEDSWAPTXT}},
+        {MEMTOTALREALTXT, ASN_INTEGER, RONLY, var_extensible_mem, 1,
+         {MEMTOTALREALTXT}},
+        {MEMUSEDREALTXT, ASN_INTEGER, RONLY, var_extensible_mem, 1,
+         {MEMUSEDREALTXT}},
+        {MEMTOTALFREE, ASN_INTEGER, RONLY, var_extensible_mem, 1,
+         {MEMTOTALFREE}},
+        {MEMSWAPMINIMUM, ASN_INTEGER, RONLY, var_extensible_mem, 1,
+         {MEMSWAPMINIMUM}},
+        {MEMSHARED, ASN_INTEGER, RONLY, var_extensible_mem, 1,
+         {MEMSHARED}},
+        {MEMBUFFER, ASN_INTEGER, RONLY, var_extensible_mem, 1,
+         {MEMBUFFER}},
+        {MEMCACHED, ASN_INTEGER, RONLY, var_extensible_mem, 1,
+         {MEMCACHED}},
+        {ERRORFLAG, ASN_INTEGER, RONLY, var_extensible_mem, 1,
+         {ERRORFLAG}},
+        {ERRORMSG, ASN_OCTET_STR, RONLY, var_extensible_mem, 1, {ERRORMSG}}
+    };
+
+    /*
+     * Define the OID pointer to the top of the mib tree that we're
+     * registering underneath 
+     */
+    oid             mem_variables_oid[] = { UCDAVIS_MIB, MEMMIBNUM };
+
+    /*
+     * register ourselves with the agent to handle our mib tree 
+     */
+    REGISTER_MIB("ucd-snmp/memory", extensible_mem_variables, variable2,
+                 mem_variables_oid);
+
+    snmpd_register_config_handler("swap", memory_parse_config,
+                                  memory_free_config, "min-avail");
+
+}                               /* end init_hpux */
+
+static int
+get_swapinfo(struct swapinfo *swap)
+{
+
+    struct pst_swapinfo pss;
+    int             i = 0;
+
+    while (pstat_getswap(&pss, sizeof(pss), (size_t) 1, i) != -1) {
+        if (pss.pss_idx == (unsigned) i) {
+            swap->total_swap += pss.pss_nblksenabled;
+            swap->free_swap += 4 * pss.pss_nfpgs;       /* nfpgs is in 4-byte blocks - who knows why? */
+            i++;
+        } else
+            return;
+    }
+}                               /* end get_swapinfo */
+
+static u_char  *
+var_extensible_mem(struct variable *vp,
+                   oid * name,
+                   size_t * length,
+                   int exact,
+                   size_t * var_len, WriteMethod ** write_method)
+{
+
+    struct swapinfo swap;
+    struct pst_static pst;
+    struct pst_dynamic psd;
+    static long     long_ret;
+
+    /*
+     * Initialize the return value to 0 
+     */
+    long_ret = 0;
+    swap.total_swap = 0;
+    swap.free_swap = 0;
+
+    if (header_generic(vp, name, length, exact, var_len, write_method))
+        return (NULL);
+
+    switch (vp->magic) {
+    case MIBINDEX:
+        long_ret = 0;
+        return ((u_char *) (&long_ret));
+    case ERRORNAME:            /* dummy name */
+        sprintf(errmsg, "swap");
+        *var_len = strlen(errmsg);
+        return ((u_char *) (errmsg));
+    case MEMTOTALSWAP:
+        get_swapinfo(&swap);
+        long_ret = swap.total_swap;
+        return ((u_char *) (&long_ret));
+    case MEMAVAILSWAP:
+        get_swapinfo(&swap);
+        long_ret = swap.free_swap;
+        return ((u_char *) (&long_ret));
+    case MEMSWAPMINIMUM:
+        long_ret = minimumswap;
+        return ((u_char *) (&long_ret));
+    case MEMTOTALREAL:
+        /*
+         * Retrieve the static memory statistics 
+         */
+        if (pstat_getstatic(&pst, sizeof(pst), (size_t) 1, 0) == -1) {
+            snmp_log(LOG_ERR, "memory_hpux: pstat_getstatic failed!\n");
+            return (NULL);
+        }
+        long_ret = pst.page_size / 1024 * pst.physical_memory;
+        return ((u_char *) (&long_ret));
+    case MEMAVAILREAL:
+        /*
+         * Retrieve the static memory statistics 
+         */
+        if (pstat_getstatic(&pst, sizeof(pst), (size_t) 1, 0) == -1) {
+            snmp_log(LOG_ERR, "memory_hpux: pstat_getstatic failed!\n");
+            return (NULL);
+        }
+        /*
+         * Retrieve the dynamic memory statistics 
+         */
+        if (pstat_getdynamic(&psd, sizeof(psd), (size_t) 1, 0) == -1) {
+            snmp_log(LOG_ERR, "memory_hpux: pstat_getdynamic failed!\n");
+            return (NULL);
+        }
+        long_ret = pst.page_size / 1024 * psd.psd_free;
+        return ((u_char *) (&long_ret));
+    case MEMTOTALSWAPTXT:
+        /*
+         * Retrieve the static memory statistics 
+         */
+        if (pstat_getstatic(&pst, sizeof(pst), (size_t) 1, 0) == -1) {
+            snmp_log(LOG_ERR, "memory_hpux: pstat_getstatic failed!\n");
+            return (NULL);
+        }
+        /*
+         * Retrieve the dynamic memory statistics 
+         */
+        if (pstat_getdynamic(&psd, sizeof(psd), (size_t) 1, 0) == -1) {
+            snmp_log(LOG_ERR, "memory_hpux: pstat_getdynamic failed!\n");
+            return (NULL);
+        }
+        long_ret = pst.page_size / 1024 * psd.psd_vmtxt;
+        return ((u_char *) (&long_ret));
+    case MEMUSEDSWAPTXT:
+        /*
+         * Retrieve the static memory statistics 
+         */
+        if (pstat_getstatic(&pst, sizeof(pst), (size_t) 1, 0) == -1) {
+            snmp_log(LOG_ERR, "memory_hpux: pstat_getstatic failed!\n");
+            return (NULL);
+        }
+        /*
+         * Retrieve the dynamic memory statistics 
+         */
+        if (pstat_getdynamic(&psd, sizeof(psd), (size_t) 1, 0) == -1) {
+            snmp_log(LOG_ERR, "memory_hpux: pstat_getdynamic failed!\n");
+            return (NULL);
+        }
+        long_ret = pst.page_size / 1024 * (psd.psd_vmtxt - psd.psd_avmtxt);
+        return ((u_char *) (&long_ret));
+    case MEMTOTALREALTXT:
+        /*
+         * Retrieve the static memory statistics 
+         */
+        if (pstat_getstatic(&pst, sizeof(pst), (size_t) 1, 0) == -1) {
+            snmp_log(LOG_ERR, "memory_hpux: pstat_getstatic failed!\n");
+            return (NULL);
+        }
+        /*
+         * Retrieve the dynamic memory statistics 
+         */
+        if (pstat_getdynamic(&psd, sizeof(psd), (size_t) 1, 0) == -1) {
+            snmp_log(LOG_ERR, "memory_hpux: pstat_getdynamic failed!\n");
+            return (NULL);
+        }
+        long_ret = pst.page_size / 1024 * psd.psd_rmtxt;
+        return ((u_char *) (&long_ret));
+    case MEMUSEDREALTXT:
+        /*
+         * Retrieve the static memory statistics 
+         */
+        if (pstat_getstatic(&pst, sizeof(pst), (size_t) 1, 0) == -1) {
+            snmp_log(LOG_ERR, "memory_hpux: pstat_getstatic failed!\n");
+            return (NULL);
+        }
+        /*
+         * Retrieve the dynamic memory statistics 
+         */
+        if (pstat_getdynamic(&psd, sizeof(psd), (size_t) 1, 0) == -1) {
+            snmp_log(LOG_ERR, "memory_hpux: pstat_getdynamic failed!\n");
+            return (NULL);
+        }
+        long_ret = pst.page_size / 1024 * (psd.psd_rmtxt - psd.psd_armtxt);
+        return ((u_char *) (&long_ret));
+    case MEMTOTALFREE:
+        /*
+         * Retrieve the static memory statistics 
+         */
+        if (pstat_getstatic(&pst, sizeof(pst), (size_t) 1, 0) == -1) {
+            snmp_log(LOG_ERR, "memory_hpux: pstat_getstatic failed!\n");
+            return (NULL);
+        }
+        /*
+         * Retrieve the dynamic memory statistics 
+         */
+        if (pstat_getdynamic(&psd, sizeof(psd), (size_t) 1, 0) == -1) {
+            snmp_log(LOG_ERR, "memory_hpux: pstat_getdynamic failed!\n");
+            return (NULL);
+        }
+        get_swapinfo(&swap);
+        long_ret = (pst.page_size / 1024 * psd.psd_free) + swap.free_swap;
+        return ((u_char *) (&long_ret));
+    case ERRORFLAG:
+        get_swapinfo(&swap);
+        long_ret = (swap.free_swap > minimumswap) ? 0 : 1;
+        return ((u_char *) (&long_ret));
+    case ERRORMSG:
+        get_swapinfo(&swap);
+        if ((swap.free_swap > minimumswap) ? 0 : 1)
+            sprintf(errmsg, "Running out of swap space (%ld)", long_ret);
+        else
+            errmsg[0] = 0;
+        *var_len = strlen(errmsg);
+        return ((u_char *) (errmsg));
+
+    }                           /* end case */
+
+    return (NULL);
+}
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/ucd-snmp/memory_hpux.h tomato121/release/src/router/snmp/agent/mibgroup/ucd-snmp/memory_hpux.h
--- tomato/release/src/router/snmp/agent/mibgroup/ucd-snmp/memory_hpux.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/ucd-snmp/memory_hpux.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,12 @@
+/*
+ *  memory quantity mib groups
+ *
+ */
+#ifndef _MIBGROUP_MEMORY_HPUX_H
+#define _MIBGROUP_MEMORY_HPUX_H
+
+#include "mibdefs.h"
+
+void            init_memory_hpux(void);
+
+#endif                          /* _MIBGROUP_MEMORY_HPUX_H */
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/ucd-snmp/memory_netbsd1.c tomato121/release/src/router/snmp/agent/mibgroup/ucd-snmp/memory_netbsd1.c
--- tomato/release/src/router/snmp/agent/mibgroup/ucd-snmp/memory_netbsd1.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/ucd-snmp/memory_netbsd1.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,259 @@
+/*
+ * memory_netbsd1.c
+ */
+
+#include <net-snmp/net-snmp-config.h>
+
+/*
+ * Ripped from /usr/scr/usr.bin/vmstat/vmstat.c (covering all bases) 
+ */
+#include <sys/param.h>
+#include <sys/time.h>
+#include <sys/proc.h>
+#include <sys/dkstat.h>
+#include <sys/buf.h>
+#include <sys/uio.h>
+#include <sys/namei.h>
+#include <sys/malloc.h>
+#include <sys/signal.h>
+#include <sys/fcntl.h>
+#include <sys/ioctl.h>
+#include <sys/sysctl.h>
+#include <sys/vmmeter.h>
+ 
+#if defined(HAVE_UVM_UVM_PARAM_H) && defined(HAVE_UVM_UVM_EXTERN_H)
+#include <uvm/uvm_param.h>
+#include <uvm/uvm_extern.h>
+#elif defined(HAVE_VM_VM_PARAM_H) && defined(HAVE_VM_VM_EXTERN_H)
+#include <vm/vm_param.h>
+#include <vm/vm_extern.h>
+#else
+#error memory_netbsd1.c: Is this really a NetBSD system?
+#endif
+ 
+#include <time.h>
+#include <nlist.h>
+#include <kvm.h>
+#include <errno.h>
+#include <unistd.h>
+#include <stdio.h>
+#include <ctype.h>
+#include <stdlib.h>
+#include <string.h>
+#include <paths.h>
+#include <limits.h>
+
+#if HAVE_DMALLOC_H
+#include <dmalloc.h>
+#endif
+
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include <net-snmp/agent/auto_nlist.h>
+
+#include "util_funcs.h"
+#include "memory.h"
+#include "memory_netbsd1.h"
+
+/*
+ * Default swap warning limit (kb) 
+ */
+#define DEFAULTMINIMUMSWAP 16000
+
+/*
+ * Swap warning limit 
+ */
+long            minimumswap;
+
+/*
+ * Swap info 
+ */
+quad_t          swapTotal;
+quad_t          swapUsed;
+quad_t          swapFree;
+
+static FindVarMethod var_extensible_mem;
+
+void
+init_memory_netbsd1(void)
+{
+
+    struct variable2 extensible_mem_variables[] = {
+        {MIBINDEX, ASN_INTEGER, RONLY, var_extensible_mem, 1, {MIBINDEX}},
+        {ERRORNAME, ASN_OCTET_STR, RONLY, var_extensible_mem, 1,
+         {ERRORNAME}},
+        {MEMTOTALSWAP, ASN_INTEGER, RONLY, var_extensible_mem, 1,
+         {MEMTOTALSWAP}},
+        {MEMAVAILSWAP, ASN_INTEGER, RONLY, var_extensible_mem, 1,
+         {MEMAVAILSWAP}},
+        {MEMTOTALREAL, ASN_INTEGER, RONLY, var_extensible_mem, 1,
+         {MEMTOTALREAL}},
+        {MEMAVAILREAL, ASN_INTEGER, RONLY, var_extensible_mem, 1,
+         {MEMAVAILREAL}},
+        {MEMTOTALSWAPTXT, ASN_INTEGER, RONLY, var_extensible_mem, 1,
+         {MEMTOTALSWAPTXT}},
+        {MEMUSEDSWAPTXT, ASN_INTEGER, RONLY, var_extensible_mem, 1,
+         {MEMUSEDSWAPTXT}},
+        {MEMTOTALREALTXT, ASN_INTEGER, RONLY, var_extensible_mem, 1,
+         {MEMTOTALREALTXT}},
+        {MEMUSEDREALTXT, ASN_INTEGER, RONLY, var_extensible_mem, 1,
+         {MEMUSEDREALTXT}},
+        {MEMTOTALFREE, ASN_INTEGER, RONLY, var_extensible_mem, 1,
+         {MEMTOTALFREE}},
+        {MEMSWAPMINIMUM, ASN_INTEGER, RONLY, var_extensible_mem, 1,
+         {MEMSWAPMINIMUM}},
+        {MEMSHARED, ASN_INTEGER, RONLY, var_extensible_mem, 1,
+         {MEMSHARED}},
+        {MEMBUFFER, ASN_INTEGER, RONLY, var_extensible_mem, 1,
+         {MEMBUFFER}},
+        {MEMCACHED, ASN_INTEGER, RONLY, var_extensible_mem, 1,
+         {MEMCACHED}},
+        {ERRORFLAG, ASN_INTEGER, RONLY, var_extensible_mem, 1,
+         {ERRORFLAG}},
+        {ERRORMSG, ASN_OCTET_STR, RONLY, var_extensible_mem, 1, {ERRORMSG}}
+    };
+
+    /*
+     * Define the OID pointer to the top of the mib tree that we're
+     * registering underneath 
+     */
+    oid             mem_variables_oid[] = { UCDAVIS_MIB, MEMMIBNUM };
+
+    /*
+     * register ourselves with the agent to handle our mib tree 
+     */
+    REGISTER_MIB("ucd-snmp/memory", extensible_mem_variables, variable2,
+                 mem_variables_oid);
+
+    snmpd_register_config_handler("swap", memory_parse_config,
+                                  memory_free_config, "min-avail");
+}
+
+
+void
+memory_parse_config(const char *token, char *cptr)
+{
+    minimumswap = atoi(cptr);
+}
+
+void
+memory_free_config(void)
+{
+    minimumswap = DEFAULTMINIMUMSWAP;
+}
+
+
+/*
+ * var_extensible_mem(...
+ * Arguments:
+ * vp     IN      - pointer to variable entry that points here
+ * name    IN/OUT  - IN/name requested, OUT/name found
+ * length  IN/OUT  - length of IN/OUT oid's 
+ * exact   IN      - TRUE if an exact match was requested
+ * var_len OUT     - length of variable or 0 if function returned
+ * write_method
+ * 
+ */
+
+static
+unsigned char  *
+var_extensible_mem(struct variable *vp,
+                   oid * name,
+                   size_t * length,
+                   int exact,
+                   size_t * var_len, WriteMethod ** write_method)
+{
+    static long     long_ret;
+    static char     errmsg[300];
+
+    static struct uvmexp uvmexp;
+    int             uvmexp_size = sizeof(uvmexp);
+    int             uvmexp_mib[] = { CTL_VM, VM_UVMEXP };
+    static struct vmtotal total;
+    size_t          total_size = sizeof(total);
+    int             total_mib[] = { CTL_VM, VM_METER };
+
+    long            phys_mem;
+    size_t          phys_mem_size = sizeof(phys_mem);
+    int             phys_mem_mib[] = { CTL_HW, HW_USERMEM };
+
+    if (header_generic(vp, name, length, exact, var_len, write_method))
+        return (NULL);
+
+    /*
+     * Memory info 
+     */
+    sysctl(uvmexp_mib, 2, &uvmexp, &uvmexp_size, NULL, 0);
+    sysctl(total_mib, 2, &total, &total_size, NULL, 0);
+
+    /*
+     * Physical memory 
+     */
+    sysctl(phys_mem_mib, 2, &phys_mem, &phys_mem_size, NULL, 0);
+
+    long_ret = 0;               /* set to 0 as default */
+
+    /*
+     * Page-to-kb macro 
+     */
+#define ptok(p) ((p) * (uvmexp.pagesize >> 10))
+
+    switch (vp->magic) {
+    case MIBINDEX:
+        long_ret = 0;
+        return ((u_char *) (&long_ret));
+    case ERRORNAME:            /* dummy name */
+        sprintf(errmsg, "swap");
+        *var_len = strlen(errmsg);
+        return ((u_char *) (errmsg));
+    case MEMTOTALSWAP:
+        long_ret = ptok(uvmexp.swpages);
+        return ((u_char *) (&long_ret));
+    case MEMAVAILSWAP:         /* FREE swap memory */
+        long_ret = ptok(uvmexp.swpages - uvmexp.swpginuse);
+        return ((u_char *) (&long_ret));
+    case MEMTOTALREAL:
+        long_ret = phys_mem >> 10;
+        return ((u_char *) (&long_ret));
+    case MEMAVAILREAL:         /* FREE real memory */
+        long_ret = ptok(uvmexp.free);
+        return ((u_char *) (&long_ret));
+
+        /*
+         * these are not implemented 
+         */
+    case MEMTOTALSWAPTXT:
+    case MEMUSEDSWAPTXT:
+    case MEMTOTALREALTXT:
+    case MEMUSEDREALTXT:
+#if NO_DUMMY_VALUES
+        return NULL;
+#endif
+        long_ret = -1;
+        return ((u_char *) (&long_ret));
+
+    case MEMTOTALFREE:
+        long_ret = ptok((int) total.t_free);
+        return ((u_char *) (&long_ret));
+    case MEMSWAPMINIMUM:
+        long_ret = minimumswap;
+        return ((u_char *) (&long_ret));
+    case MEMSHARED:
+        return ((u_char *) (&long_ret));
+    case MEMBUFFER:
+        return NULL;
+    case MEMCACHED:
+        return NULL;
+    case ERRORFLAG:
+        long_ret = (swapFree > minimumswap) ? 0 : 1;
+        return ((u_char *) (&long_ret));
+    case ERRORMSG:
+        if (swapFree < minimumswap)
+            sprintf(errmsg, "Running out of swap space (%qd)", swapFree);
+        else
+            errmsg[0] = 0;
+        *var_len = strlen(errmsg);
+        return ((u_char *) (errmsg));
+    }
+    return NULL;
+}
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/ucd-snmp/memory_netbsd1.h tomato121/release/src/router/snmp/agent/mibgroup/ucd-snmp/memory_netbsd1.h
--- tomato/release/src/router/snmp/agent/mibgroup/ucd-snmp/memory_netbsd1.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/ucd-snmp/memory_netbsd1.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,12 @@
+/*
+ *  memory quantity mib groups
+ *
+ */
+#ifndef _MIBGROUP_MEMORY_NETBSD1_H
+#define _MIBGROUP_MEMORY_NETBSD1_H
+
+#include "mibdefs.h"
+
+extern void     init_memory_netbsd1(void);
+
+#endif                          /* _MIBGROUP_MEMORY_NETBSD1_H */
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/ucd-snmp/memory_solaris2.c tomato121/release/src/router/snmp/agent/mibgroup/ucd-snmp/memory_solaris2.c
--- tomato/release/src/router/snmp/agent/mibgroup/ucd-snmp/memory_solaris2.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/ucd-snmp/memory_solaris2.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,281 @@
+#include <net-snmp/net-snmp-config.h>   /* local SNMP configuration details */
+#if HAVE_STRING_H
+#include <string.h>
+#endif
+#if HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+
+#include <sys/types.h>
+
+#if HAVE_DMALLOC_H
+#include <dmalloc.h>
+#endif
+
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include <net-snmp/agent/auto_nlist.h>
+
+#include "util_funcs.h"         /* utility function declarations */
+#include "memory.h"             /* the module-specific header */
+#include "memory_solaris2.h"    /* the module-specific header */
+
+#include <kstat.h>
+#include <sys/stat.h>
+#include <sys/swap.h>
+#include <unistd.h>
+
+#define MAXSTRSIZE	80
+
+int             minimumswap;
+static char     errmsg[300];
+/****************************
+ * Kstat specific variables *
+ ****************************/
+extern kstat_ctl_t *kstat_fd;   /* defined in kernel_sunos5.c */
+kstat_t        *ksp1, *ksp2;
+kstat_named_t  *kn, *kn2;
+
+static FindVarMethod var_extensible_mem;
+static long     getFreeSwap(void);
+static long     getTotalFree(void);
+static long     getTotalSwap(void);
+
+void
+init_memory_solaris2(void)
+{
+
+    struct variable2 extensible_mem_variables[] = {
+        {MIBINDEX, ASN_INTEGER, RONLY, var_extensible_mem, 1, {MIBINDEX}},
+        {ERRORNAME, ASN_OCTET_STR, RONLY, var_extensible_mem, 1,
+         {ERRORNAME}},
+        {MEMTOTALSWAP, ASN_INTEGER, RONLY, var_extensible_mem, 1,
+         {MEMTOTALSWAP}},
+        {MEMAVAILSWAP, ASN_INTEGER, RONLY, var_extensible_mem, 1,
+         {MEMAVAILSWAP}},
+        {MEMTOTALREAL, ASN_INTEGER, RONLY, var_extensible_mem, 1,
+         {MEMTOTALREAL}},
+        {MEMAVAILREAL, ASN_INTEGER, RONLY, var_extensible_mem, 1,
+         {MEMAVAILREAL}},
+        {MEMTOTALSWAPTXT, ASN_INTEGER, RONLY, var_extensible_mem, 1,
+         {MEMTOTALSWAPTXT}},
+        {MEMUSEDSWAPTXT, ASN_INTEGER, RONLY, var_extensible_mem, 1,
+         {MEMUSEDSWAPTXT}},
+        {MEMTOTALREALTXT, ASN_INTEGER, RONLY, var_extensible_mem, 1,
+         {MEMTOTALREALTXT}},
+        {MEMUSEDREALTXT, ASN_INTEGER, RONLY, var_extensible_mem, 1,
+         {MEMUSEDREALTXT}},
+        {MEMTOTALFREE, ASN_INTEGER, RONLY, var_extensible_mem, 1,
+         {MEMTOTALFREE}},
+        {MEMSWAPMINIMUM, ASN_INTEGER, RONLY, var_extensible_mem, 1,
+         {MEMSWAPMINIMUM}},
+        {MEMSHARED, ASN_INTEGER, RONLY, var_extensible_mem, 1,
+         {MEMSHARED}},
+        {MEMBUFFER, ASN_INTEGER, RONLY, var_extensible_mem, 1,
+         {MEMBUFFER}},
+        {MEMCACHED, ASN_INTEGER, RONLY, var_extensible_mem, 1,
+         {MEMCACHED}},
+        {ERRORFLAG, ASN_INTEGER, RONLY, var_extensible_mem, 1,
+         {ERRORFLAG}},
+        {ERRORMSG, ASN_OCTET_STR, RONLY, var_extensible_mem, 1, {ERRORMSG}}
+    };
+
+    /*
+     * Define the OID pointer to the top of the mib tree that we're
+     * registering underneath 
+     */
+    oid             mem_variables_oid[] = { UCDAVIS_MIB, MEMMIBNUM };
+
+    /*
+     * register ourselves with the agent to handle our mib tree 
+     */
+    REGISTER_MIB("ucd-snmp/memory", extensible_mem_variables, variable2,
+                 mem_variables_oid);
+
+    snmpd_register_config_handler("swap", memory_parse_config,
+                                  memory_free_config, "min-avail");
+
+    if (kstat_fd == 0) {
+        kstat_fd = kstat_open();
+        if (kstat_fd == 0) {
+            snmp_log(LOG_ERR, "kstat_open(): failed\n");
+        }
+    }
+}
+
+static u_char  *
+var_extensible_mem(struct variable *vp,
+                   oid * name,
+                   size_t * length,
+                   int exact,
+                   size_t * var_len, WriteMethod ** write_method)
+{
+    static long     long_ret;
+
+    /*
+     * Initialize the return value to 0 
+     */
+    long_ret = 0;
+
+    if (header_generic(vp, name, length, exact, var_len, write_method))
+        return (NULL);
+
+    switch (vp->magic) {
+    case MIBINDEX:
+        long_ret = 0;
+        return ((u_char *) (&long_ret));
+    case ERRORNAME:            /* dummy name */
+        sprintf(errmsg, "swap");
+        *var_len = strlen(errmsg);
+        return ((u_char *) (errmsg));
+    case MEMTOTALSWAP:
+        long_ret = getTotalSwap() * (getpagesize() / 1024);
+        return ((u_char *) (&long_ret));
+    case MEMAVAILSWAP:
+        long_ret = getFreeSwap() * (getpagesize() / 1024);
+        return ((u_char *) (&long_ret));
+    case MEMSWAPMINIMUM:
+        long_ret = minimumswap;
+        return ((u_char *) (&long_ret));
+    case MEMTOTALREAL:
+#ifdef _SC_PHYS_PAGES
+        long_ret = sysconf(_SC_PHYS_PAGES) * (getpagesize()/1024);
+#else
+        ksp1 = kstat_lookup(kstat_fd, "unix", 0, "system_pages");
+        kstat_read(kstat_fd, ksp1, 0);
+        kn = kstat_data_lookup(ksp1, "physmem");
+
+        long_ret = kn->value.ul * (getpagesize() / 1024);
+#endif
+        return ((u_char *) (&long_ret));
+    case MEMAVAILREAL:
+#ifdef _SC_AVPHYS_PAGES
+        long_ret = sysconf(_SC_AVPHYS_PAGES) * (getpagesize()/1024);
+#else
+        long_ret =
+            (getTotalFree() - getFreeSwap()) * (getpagesize() / 1024);
+#endif
+        return ((u_char *) (&long_ret));
+    case MEMTOTALFREE:
+        long_ret = getTotalFree() * (getpagesize() / 1024);
+        return ((u_char *) (&long_ret));
+
+    case ERRORFLAG:
+        long_ret = getTotalFree() * (getpagesize() / 1024);
+        long_ret = (long_ret > minimumswap) ? 0 : 1;
+        return ((u_char *) (&long_ret));
+
+    case ERRORMSG:
+        long_ret = getTotalFree() * (getpagesize() / 1024);
+        if ((long_ret > minimumswap) ? 0 : 1)
+            sprintf(errmsg, "Running out of swap space (%ld)", long_ret);
+        else
+            errmsg[0] = 0;
+        *var_len = strlen(errmsg);
+        return ((u_char *) (errmsg));
+
+    }
+
+    return (NULL);
+}
+
+#define DEFAULTMINIMUMSWAP 16000        /* kilobytes */
+
+void
+memory_parse_config(const char *token, char *cptr)
+{
+    minimumswap = atoi(cptr);
+}
+
+void
+memory_free_config(void)
+{
+    minimumswap = DEFAULTMINIMUMSWAP;
+}
+
+long
+getTotalSwap(void)
+{
+    long            total_mem;
+
+    size_t          num;
+    int             i, n;
+    swaptbl_t      *s;
+    char           *strtab;
+
+    total_mem = 0;
+
+    num = swapctl(SC_GETNSWP, 0);
+    s = malloc(num * sizeof(swapent_t) + sizeof(struct swaptable));
+    if (s) {
+        strtab = (char *) malloc((num + 1) * MAXSTRSIZE);
+        if (strtab) {
+            for (i = 0; i < (num + 1); i++) {
+                s->swt_ent[i].ste_path = strtab + (i * MAXSTRSIZE);
+            }
+            s->swt_n = num + 1;
+            n = swapctl(SC_LIST, s);
+
+            for (i = 0; i < n; i++)
+                total_mem += s->swt_ent[i].ste_pages;
+
+            free(strtab);
+        }
+        free(s);
+    }
+
+    return (total_mem);
+}
+
+/*
+ * returns -1 if malloc fails.
+ */
+static long
+getFreeSwap(void)
+{
+    long            free_mem = -1;
+
+    size_t          num;
+    int             i, n;
+    swaptbl_t      *s;
+    char           *strtab;
+
+    num = swapctl(SC_GETNSWP, 0);
+    s = malloc(num * sizeof(swapent_t) + sizeof(struct swaptable));
+    if (s) {
+        strtab = (char *) malloc((num + 1) * MAXSTRSIZE);
+        if (strtab) {
+            free_mem = 0;
+            for (i = 0; i < (num + 1); i++) {
+                s->swt_ent[i].ste_path = strtab + (i * MAXSTRSIZE);
+            }
+            s->swt_n = num + 1;
+            n = swapctl(SC_LIST, s);
+
+            for (i = 0; i < n; i++)
+                free_mem += s->swt_ent[i].ste_free;
+
+            free(strtab);
+        }
+        free(s);
+    }
+
+    return (free_mem);
+}
+
+static long
+getTotalFree(void)
+{
+    unsigned long   free_mem, allocated, reserved, available, used_size;
+    struct anoninfo ai;
+
+    if (-1 == swapctl(SC_AINFO, &ai)) {
+        snmp_log(LOG_ERR, "error swapctl\n");
+    }
+    allocated = ai.ani_max - ai.ani_free;
+    reserved = (ai.ani_resv - allocated);
+    available = (ai.ani_max - ai.ani_resv);     /* K-byte */
+    free_mem = used_size = reserved + allocated;
+    free_mem = available;
+    return (free_mem);
+}
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/ucd-snmp/memory_solaris2.h tomato121/release/src/router/snmp/agent/mibgroup/ucd-snmp/memory_solaris2.h
--- tomato/release/src/router/snmp/agent/mibgroup/ucd-snmp/memory_solaris2.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/ucd-snmp/memory_solaris2.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,12 @@
+/*
+ *  memory quantity mib groups
+ *
+ */
+#ifndef _MIBGROUP_MEMORY_SOLARIS2_H
+#define _MIBGROUP_MEMORY_SOLARIS2_H
+
+#include "mibdefs.h"
+
+void            init_memory_solaris2(void);
+
+#endif                          /* _MIBGROUP_MEMORY_SOLARIS2_H */
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/ucd-snmp/pass.c tomato121/release/src/router/snmp/agent/mibgroup/ucd-snmp/pass.c
--- tomato/release/src/router/snmp/agent/mibgroup/ucd-snmp/pass.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/ucd-snmp/pass.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,501 @@
+#include <net-snmp/net-snmp-config.h>
+
+#if HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#include <stdio.h>
+#if HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+#if HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#include <ctype.h>
+#include <sys/types.h>
+#if HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+#if HAVE_SYS_WAIT_H
+# include <sys/wait.h>
+#endif
+#if HAVE_WINSOCK_H
+#include <winsock.h>
+#endif
+
+#if HAVE_DMALLOC_H
+#include <dmalloc.h>
+#endif
+
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+#include "struct.h"
+#include "pass.h"
+#include "extensible.h"
+#include "util_funcs.h"
+
+struct extensible *passthrus = NULL;
+int             numpassthrus = 0;
+
+/*
+ * the relocatable extensible commands variables 
+ */
+struct variable2 extensible_passthru_variables[] = {
+    /*
+     * bogus entry.  Only some of it is actually used. 
+     */
+    {MIBINDEX, ASN_INTEGER, RWRITE, var_extensible_pass, 0, {MIBINDEX}},
+};
+
+
+
+/*
+ * lexicographical compare two object identifiers.
+ * * Returns -1 if name1 < name2,
+ * *          0 if name1 = name2,
+ * *          1 if name1 > name2
+ * *
+ * * This method differs from snmp_oid_compare
+ * * in that the comparison stops at the length
+ * * of the smallest object identifier.
+ */
+int
+snmp_oid_min_compare(const oid * in_name1,
+                     size_t len1, const oid * in_name2, size_t len2)
+{
+    register int    len;
+    register const oid *name1 = in_name1;
+    register const oid *name2 = in_name2;
+
+    /*
+     * len = minimum of len1 and len2 
+     */
+    if (len1 < len2)
+        len = len1;
+    else
+        len = len2;
+    /*
+     * find first non-matching OID 
+     */
+    while (len-- > 0) {
+        /*
+         * these must be done in seperate comparisons, since
+         * subtracting them and using that result has problems with
+         * subids > 2^31. 
+         */
+        if (*(name1) < *(name2))
+            return -1;
+        if (*(name1++) > *(name2++))
+            return 1;
+    }
+    /*
+     * both OIDs equal up to length of shorter OID 
+     */
+
+    return 0;
+}
+
+
+/*
+ * This is also called from pass_persist.c 
+ */
+int
+asc2bin(char *p)
+{
+    char           *r, *q = p;
+    char            c;
+    int             n = 0;
+
+    for (;;) {
+        c = (char) strtol(q, &r, 16);
+        if (r == q)
+            break;
+        *p++ = c;
+        q = r;
+        n++;
+    }
+    return n;
+}
+
+/*
+ * This is also called from pass_persist.c 
+ */
+int
+bin2asc(char *p, size_t n)
+{
+    int             i, flag = 0;
+    char            buffer[SNMP_MAXBUF];
+
+    for (i = 0; i < (int) n; i++) {
+        buffer[i] = p[i];
+        if (!isprint(p[i]))
+            flag = 1;
+    }
+    if (flag == 0) {
+        p[n] = 0;
+        return n;
+    }
+    for (i = 0; i < (int) n; i++) {
+        sprintf(p, "%02x ", (unsigned char) (buffer[i] & 0xff));
+        p += 3;
+    }
+    *--p = 0;
+    return 3 * n - 1;
+}
+
+
+void
+init_pass(void)
+{
+    snmpd_register_config_handler("pass", pass_parse_config,
+                                  pass_free_config, "miboid command");
+}
+
+
+void
+pass_parse_config(const char *token, char *cptr)
+{
+    struct extensible **ppass = &passthrus, **etmp, *ptmp;
+    char           *tcptr;
+    int             i;
+
+    if (*cptr == '.')
+        cptr++;
+    if (!isdigit(*cptr)) {
+        config_perror("second token is not a OID");
+        return;
+    }
+    numpassthrus++;
+
+    while (*ppass != NULL)
+        ppass = &((*ppass)->next);
+    (*ppass) = (struct extensible *) malloc(sizeof(struct extensible));
+    if (*ppass == NULL)
+        return;
+    (*ppass)->type = PASSTHRU;
+
+    (*ppass)->miblen = parse_miboid(cptr, (*ppass)->miboid);
+    while (isdigit(*cptr) || *cptr == '.')
+        cptr++;
+    /*
+     * name 
+     */
+    cptr = skip_white(cptr);
+    if (cptr == NULL) {
+        config_perror("No command specified on pass line");
+        (*ppass)->command[0] = 0;
+    } else {
+        for (tcptr = cptr; *tcptr != 0 && *tcptr != '#' && *tcptr != ';';
+             tcptr++);
+        strncpy((*ppass)->command, cptr, tcptr - cptr);
+        (*ppass)->command[tcptr - cptr] = 0;
+    }
+    strncpy((*ppass)->name, (*ppass)->command, sizeof((*ppass)->name));
+    (*ppass)->name[ sizeof((*ppass)->name)-1 ] = 0;
+    (*ppass)->next = NULL;
+
+    register_mib("pass", (struct variable *) extensible_passthru_variables,
+                 sizeof(struct variable2),
+                 1, (*ppass)->miboid, (*ppass)->miblen);
+
+    /*
+     * argggg -- pasthrus must be sorted 
+     */
+    if (numpassthrus > 0) {
+        etmp = (struct extensible **)
+            malloc(((sizeof(struct extensible *)) * numpassthrus));
+        if (etmp == NULL)
+            return;
+
+        for (i = 0, ptmp = (struct extensible *) passthrus;
+             i < numpassthrus && ptmp != 0; i++, ptmp = ptmp->next)
+            etmp[i] = ptmp;
+        qsort(etmp, numpassthrus, sizeof(struct extensible *),
+              pass_compare);
+        passthrus = (struct extensible *) etmp[0];
+        ptmp = (struct extensible *) etmp[0];
+
+        for (i = 0; i < numpassthrus - 1; i++) {
+            ptmp->next = etmp[i + 1];
+            ptmp = ptmp->next;
+        }
+        ptmp->next = NULL;
+        free(etmp);
+    }
+}
+
+void
+pass_free_config(void)
+{
+    struct extensible *etmp, *etmp2;
+
+    for (etmp = passthrus; etmp != NULL;) {
+        etmp2 = etmp;
+        etmp = etmp->next;
+        unregister_mib(etmp2->miboid, etmp2->miblen);
+        free(etmp2);
+    }
+    passthrus = NULL;
+    numpassthrus = 0;
+}
+
+u_char         *
+var_extensible_pass(struct variable *vp,
+                    oid * name,
+                    size_t * length,
+                    int exact,
+                    size_t * var_len, WriteMethod ** write_method)
+{
+    oid             newname[MAX_OID_LEN];
+    int             i, rtest, fd, newlen;
+    static long     long_ret;
+    char            buf[SNMP_MAXBUF];
+    static char     buf2[SNMP_MAXBUF];
+    static oid      objid[MAX_OID_LEN];
+    struct extensible *passthru;
+    FILE           *file;
+
+    long_ret = *length;
+    for (i = 1; i <= numpassthrus; i++) {
+        passthru = get_exten_instance(passthrus, i);
+        rtest = snmp_oid_min_compare(name, *length,
+                                     passthru->miboid, passthru->miblen);
+        if ((exact && rtest == 0) || (!exact && rtest <= 0)) {
+            /*
+             * setup args 
+             */
+            if (passthru->miblen >= *length || rtest < 0)
+                sprint_mib_oid(buf, passthru->miboid, passthru->miblen);
+            else
+                sprint_mib_oid(buf, name, *length);
+            if (exact)
+                snprintf(passthru->command, sizeof(passthru->command),
+                         "%s -g %s", passthru->name, buf);
+            else
+                snprintf(passthru->command, sizeof(passthru->command),
+                         "%s -n %s", passthru->name, buf);
+            passthru->command[ sizeof(passthru->command)-1 ] = 0;
+            DEBUGMSGTL(("ucd-snmp/pass", "pass-running:  %s\n",
+                        passthru->command));
+            /*
+             * valid call.  Exec and get output 
+             */
+            if ((fd = get_exec_output(passthru)) != -1) {
+                file = fdopen(fd, "r");
+                if (fgets(buf, sizeof(buf), file) == NULL) {
+                    /*
+                     * to enable creation
+                     */
+                    *write_method = setPass;
+                    *var_len = 0;
+                    fclose(file);
+                    wait_on_exec(passthru);
+                    return (NULL);
+                }
+                newlen = parse_miboid(buf, newname);
+
+                /*
+                 * its good, so copy onto name/length 
+                 */
+                memcpy((char *) name, (char *) newname,
+                       (int) newlen * sizeof(oid));
+                *length = newlen;
+
+                /*
+                 * set up return pointer for setable stuff 
+                 */
+                *write_method = setPass;
+
+                if (newlen == 0 || fgets(buf, sizeof(buf), file) == NULL
+                    || fgets(buf2, sizeof(buf2), file) == NULL) {
+                    *var_len = 0;
+                    fclose(file);
+                    wait_on_exec(passthru);
+                    return (NULL);
+                }
+                fclose(file);
+                wait_on_exec(passthru);
+
+                /*
+                 * buf contains the return type, and buf2 contains the data 
+                 */
+                if (!strncasecmp(buf, "string", 6)) {
+                    buf2[strlen(buf2) - 1] = 0; /* zap the linefeed */
+                    *var_len = strlen(buf2);
+                    vp->type = ASN_OCTET_STR;
+                    return ((unsigned char *) buf2);
+                } else if (!strncasecmp(buf, "opaque", 6)) {
+                    *var_len = asc2bin(buf2);
+                    vp->type = ASN_OPAQUE;
+                    return ((unsigned char *) buf2);
+                } else if (!strncasecmp(buf, "integer", 7)) {
+                    *var_len = sizeof(long_ret);
+                    long_ret = strtol(buf2, NULL, 10);
+                    vp->type = ASN_INTEGER;
+                    return ((unsigned char *) &long_ret);
+                } else if (!strncasecmp(buf, "unsigned", 7)) {
+                    *var_len = sizeof(long_ret);
+                    long_ret = strtoul(buf2, NULL, 10);
+                    vp->type = ASN_UNSIGNED;
+                    return ((unsigned char *) &long_ret);
+                } else if (!strncasecmp(buf, "counter", 7)) {
+                    *var_len = sizeof(long_ret);
+                    long_ret = strtoul(buf2, NULL, 10);
+                    vp->type = ASN_COUNTER;
+                    return ((unsigned char *) &long_ret);
+                } else if (!strncasecmp(buf, "octet", 5)) {
+                    *var_len = asc2bin(buf2);
+                    vp->type = ASN_OCTET_STR;
+                    return ((unsigned char *) buf2);
+                } else if (!strncasecmp(buf, "gauge", 5)) {
+                    *var_len = sizeof(long_ret);
+                    long_ret = strtoul(buf2, NULL, 10);
+                    vp->type = ASN_GAUGE;
+                    return ((unsigned char *) &long_ret);
+                } else if (!strncasecmp(buf, "objectid", 8)) {
+                    newlen = parse_miboid(buf2, objid);
+                    *var_len = newlen * sizeof(oid);
+                    vp->type = ASN_OBJECT_ID;
+                    return ((unsigned char *) objid);
+                } else if (!strncasecmp(buf, "timetick", 8)) {
+                    *var_len = sizeof(long_ret);
+                    long_ret = strtoul(buf2, NULL, 10);
+                    vp->type = ASN_TIMETICKS;
+                    return ((unsigned char *) &long_ret);
+                } else if (!strncasecmp(buf, "ipaddress", 9)) {
+                    newlen = parse_miboid(buf2, objid);
+                    if (newlen != 4) {
+                        snmp_log(LOG_ERR,
+                                 "invalid ipaddress returned:  %s\n",
+                                 buf2);
+                        *var_len = 0;
+                        return (NULL);
+                    }
+                    long_ret =
+                        (objid[0] << (8 * 3)) + (objid[1] << (8 * 2)) +
+                        (objid[2] << 8) + objid[3];
+                    long_ret = htonl(long_ret);
+                    *var_len = sizeof(long_ret);
+                    vp->type = ASN_IPADDRESS;
+                    return ((unsigned char *) &long_ret);
+                }
+            }
+            *var_len = 0;
+            return (NULL);
+        }
+    }
+    if (var_len)
+        *var_len = 0;
+    *write_method = NULL;
+    return (NULL);
+}
+
+int
+setPass(int action,
+        u_char * var_val,
+        u_char var_val_type,
+        size_t var_val_len, u_char * statP, oid * name, size_t name_len)
+{
+    int             i, rtest;
+    struct extensible *passthru;
+
+    char            buf[SNMP_MAXBUF], buf2[SNMP_MAXBUF];
+    long            tmp;
+    unsigned long   utmp;
+    size_t          itmp;
+
+    for (i = 1; i <= numpassthrus; i++) {
+        passthru = get_exten_instance(passthrus, i);
+        rtest = snmp_oid_min_compare(name, name_len,
+                                     passthru->miboid, passthru->miblen);
+        if (rtest <= 0) {
+            if (action != COMMIT)
+                return SNMP_ERR_NOERROR;
+            /*
+             * setup args 
+             */
+            if (passthru->miblen >= name_len || rtest < 0)
+                sprint_mib_oid(buf, passthru->miboid, passthru->miblen);
+            else
+                sprint_mib_oid(buf, name, name_len);
+            snprintf(passthru->command, sizeof(passthru->command),
+                     "%s -s %s ", passthru->name, buf);
+            passthru->command[ sizeof(passthru->command)-1 ] = 0;
+            switch (var_val_type) {
+            case ASN_INTEGER:
+            case ASN_COUNTER:
+            case ASN_GAUGE:
+            case ASN_TIMETICKS:
+                tmp = *((long *) var_val);
+                switch (var_val_type) {
+                case ASN_INTEGER:
+                    sprintf(buf, "integer %d\n", (int) tmp);
+                    break;
+                case ASN_COUNTER:
+                    sprintf(buf, "counter %d\n", (int) tmp);
+                    break;
+                case ASN_GAUGE:
+                    sprintf(buf, "gauge %d\n", (int) tmp);
+                    break;
+                case ASN_TIMETICKS:
+                    sprintf(buf, "timeticks %d\n", (int) tmp);
+                    break;
+                }
+                break;
+            case ASN_IPADDRESS:
+                utmp = *((u_long *) var_val);
+                utmp = ntohl(utmp);
+                sprintf(buf, "ipaddress %d.%d.%d.%d\n",
+                        (int) ((utmp & 0xff000000) >> (8 * 3)),
+                        (int) ((utmp & 0xff0000) >> (8 * 2)),
+                        (int) ((utmp & 0xff00) >> (8)),
+                        (int) ((utmp & 0xff)));
+                break;
+            case ASN_OCTET_STR:
+                itmp = sizeof(buf2);
+                memcpy(buf2, var_val, var_val_len);
+                if (var_val_len == 0)
+                    sprintf(buf, "string \"\"\n");
+                else if (bin2asc(buf2, var_val_len) == (int) var_val_len)
+                    snprintf(buf, sizeof(buf), "string \"%s\"\n", buf2);
+                else
+                    snprintf(buf, sizeof(buf), "octet \"%s\"\n", buf2);
+                buf[ sizeof(buf)-1 ] = 0;
+                break;
+            case ASN_OBJECT_ID:
+                sprint_mib_oid(buf2, (oid *) var_val, var_val_len);
+                snprintf(buf, sizeof(buf), "objectid \"%s\"\n", buf2);
+                buf[ sizeof(buf)-1 ] = 0;
+                break;
+            }
+            strncat(passthru->command, buf, sizeof(passthru->command));
+            passthru->command[ sizeof(passthru->command)-1 ] = 0;
+            DEBUGMSGTL(("ucd-snmp/pass", "pass-running:  %s\n",
+                        passthru->command));
+            exec_command(passthru);
+            if (!strncasecmp(passthru->output, "not-writable", 11)) {
+                return SNMP_ERR_NOTWRITABLE;
+            } else if (!strncasecmp(passthru->output, "wrong-type", 9)) {
+                return SNMP_ERR_WRONGTYPE;
+            }
+            return SNMP_ERR_NOERROR;
+        }
+    }
+    if (snmp_get_do_debugging()) {
+        sprint_mib_oid(buf2, name, name_len);
+        DEBUGMSGTL(("ucd-snmp/pass", "pass-notfound:  %s\n", buf2));
+    }
+    return SNMP_ERR_NOSUCHNAME;
+}
+
+int
+pass_compare(const void *a, const void *b)
+{
+    const struct extensible *const *ap, *const *bp;
+    ap = (const struct extensible * const *) a;
+    bp = (const struct extensible * const *) b;
+    return snmp_oid_compare((*ap)->miboid, (*ap)->miblen, (*bp)->miboid,
+                            (*bp)->miblen);
+}
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/ucd-snmp/pass.h tomato121/release/src/router/snmp/agent/mibgroup/ucd-snmp/pass.h
--- tomato/release/src/router/snmp/agent/mibgroup/ucd-snmp/pass.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/ucd-snmp/pass.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,23 @@
+/*
+ *  pass: pass through extensiblity
+ */
+#ifndef _MIBGROUP_PASS_H
+#define _MIBGROUP_PASS_H
+
+void            init_pass(void);
+
+config_require(ucd-snmp/extensible util_funcs)
+
+extern FindVarMethod var_extensible_pass;
+WriteMethod     setPass;
+int             pass_compare(const void *, const void *);
+
+/*
+ * config file parsing routines 
+ */
+void            pass_free_config(void);
+void            pass_parse_config(const char *, char *);
+
+#include "mibdefs.h"
+
+#endif                          /* _MIBGROUP_PASS_H */
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/ucd-snmp/pass_persist.c tomato121/release/src/router/snmp/agent/mibgroup/ucd-snmp/pass_persist.c
--- tomato/release/src/router/snmp/agent/mibgroup/ucd-snmp/pass_persist.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/ucd-snmp/pass_persist.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,720 @@
+#include <net-snmp/net-snmp-config.h>
+
+#if HAVE_IO_H
+#include <io.h>
+#endif
+#if HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#if HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+#if HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#include <ctype.h>
+#include <sys/types.h>
+#if HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+#if HAVE_SYS_WAIT_H
+# include <sys/wait.h>
+#endif
+#if HAVE_WINSOCK_H
+#include <winsock.h>
+#endif
+
+#if HAVE_DMALLOC_H
+#include <dmalloc.h>
+#endif
+
+#include <signal.h>
+#include <errno.h>
+
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+#include "struct.h"
+#include "pass_persist.h"
+#include "extensible.h"
+#include "util_funcs.h"
+
+struct extensible *persistpassthrus = NULL;
+int             numpersistpassthrus = 0;
+struct persist_pipe_type {
+    FILE           *fIn, *fOut;
+    int             fdIn, fdOut;
+    int             pid;
+}              *persist_pipes = (struct persist_pipe_type *) NULL;
+static int      init_persist_pipes(void);
+static void     close_persist_pipe(int iindex);
+static int      open_persist_pipe(int iindex, char *command);
+static void     destruct_persist_pipes(void);
+static int      write_persist_pipe(int iindex, const char *data);
+
+/*
+ * These are defined in pass.c 
+ */
+extern int      asc2bin(char *p);
+extern int      bin2asc(char *p, size_t n);
+extern int      snmp_oid_min_compare(const oid *, size_t, const oid *,
+                                     size_t);
+
+/*
+ * the relocatable extensible commands variables 
+ */
+struct variable2 extensible_persist_passthru_variables[] = {
+    /*
+     * bogus entry.  Only some of it is actually used. 
+     */
+    {MIBINDEX, ASN_INTEGER, RWRITE, var_extensible_pass_persist, 0,
+     {MIBINDEX}},
+};
+
+void
+init_pass_persist(void)
+{
+    snmpd_register_config_handler("pass_persist",
+                                  pass_persist_parse_config,
+                                  pass_persist_free_config,
+                                  "miboid program");
+}
+
+void
+pass_persist_parse_config(const char *token, char *cptr)
+{
+    struct extensible **ppass = &persistpassthrus, **etmp, *ptmp;
+    char           *tcptr;
+    int             i;
+
+    if (*cptr == '.')
+        cptr++;
+    if (!isdigit(*cptr)) {
+        config_perror("second token is not a OID");
+        return;
+    }
+    numpersistpassthrus++;
+
+    while (*ppass != NULL)
+        ppass = &((*ppass)->next);
+    (*ppass) = (struct extensible *) malloc(sizeof(struct extensible));
+    if (*ppass == NULL)
+        return;
+    (*ppass)->type = PASSTHRU_PERSIST;
+
+    (*ppass)->miblen = parse_miboid(cptr, (*ppass)->miboid);
+    while (isdigit(*cptr) || *cptr == '.')
+        cptr++;
+    /*
+     * name 
+     */
+    cptr = skip_white(cptr);
+    if (cptr == NULL) {
+        config_perror("No command specified on pass_persist line");
+        (*ppass)->command[0] = 0;
+    } else {
+        for (tcptr = cptr; *tcptr != 0 && *tcptr != '#' && *tcptr != ';';
+             tcptr++);
+        strncpy((*ppass)->command, cptr, tcptr - cptr);
+        (*ppass)->command[tcptr - cptr] = 0;
+    }
+    strcpy((*ppass)->name, (*ppass)->command);
+    (*ppass)->next = NULL;
+
+    register_mib("pass_persist",
+                 (struct variable *) extensible_persist_passthru_variables,
+                 sizeof(struct variable2), 1, (*ppass)->miboid,
+                 (*ppass)->miblen);
+
+    /*
+     * argggg -- pasthrus must be sorted 
+     */
+    if (numpersistpassthrus > 0) {
+        etmp = (struct extensible **)
+            malloc(((sizeof(struct extensible *)) * numpersistpassthrus));
+        if (etmp == NULL)
+            return;
+        for (i = 0, ptmp = (struct extensible *) persistpassthrus;
+             i < numpersistpassthrus && ptmp != 0; i++, ptmp = ptmp->next)
+            etmp[i] = ptmp;
+        qsort(etmp, numpersistpassthrus, sizeof(struct extensible *),
+              pass_persist_compare);
+        persistpassthrus = (struct extensible *) etmp[0];
+        ptmp = (struct extensible *) etmp[0];
+
+        for (i = 0; i < numpersistpassthrus - 1; i++) {
+            ptmp->next = etmp[i + 1];
+            ptmp = ptmp->next;
+        }
+        ptmp->next = NULL;
+        free(etmp);
+    }
+}
+
+void
+pass_persist_free_config(void)
+{
+    struct extensible *etmp, *etmp2;
+
+    /*
+     * Close any open pipes to any programs 
+     */
+    destruct_persist_pipes();
+
+    for (etmp = persistpassthrus; etmp != NULL;) {
+        etmp2 = etmp;
+        etmp = etmp->next;
+        unregister_mib(etmp2->miboid, etmp2->miblen);
+        free(etmp2);
+    }
+    persistpassthrus = NULL;
+    numpersistpassthrus = 0;
+}
+
+u_char         *
+var_extensible_pass_persist(struct variable *vp,
+                            oid * name,
+                            size_t * length,
+                            int exact,
+                            size_t * var_len, WriteMethod ** write_method)
+{
+    oid             newname[MAX_OID_LEN];
+    int             i, rtest, newlen;
+    static long     long_ret;
+    char            buf[SNMP_MAXBUF];
+    static char     buf2[SNMP_MAXBUF];
+    static oid      objid[MAX_OID_LEN];
+    struct extensible *persistpassthru;
+    FILE           *file;
+
+    /*
+     * Make sure that our basic pipe structure is malloced 
+     */
+    init_persist_pipes();
+
+    long_ret = *length;
+    for (i = 1; i <= numpersistpassthrus; i++) {
+        persistpassthru = get_exten_instance(persistpassthrus, i);
+        rtest = snmp_oid_min_compare(name, *length,
+                                     persistpassthru->miboid,
+                                     persistpassthru->miblen);
+        if ((exact && rtest == 0) || (!exact && rtest <= 0)) {
+            /*
+             * setup args 
+             */
+            if (persistpassthru->miblen >= *length || rtest < 0)
+                sprint_mib_oid(buf, persistpassthru->miboid,
+                               persistpassthru->miblen);
+            else
+                sprint_mib_oid(buf, name, *length);
+
+            /*
+             * Open our pipe if necessary 
+             */
+            if (!open_persist_pipe(i, persistpassthru->name)) {
+                return (NULL);
+            }
+
+            if (exact)
+                snprintf(persistpassthru->command,
+                  sizeof(persistpassthru->command), "get\n%s\n", buf);
+            else
+                snprintf(persistpassthru->command,
+                  sizeof(persistpassthru->command), "getnext\n%s\n", buf);
+            persistpassthru->command[ sizeof(persistpassthru->command)-1 ] = 0;
+
+            DEBUGMSGTL(("ucd-snmp/pass_persist",
+                        "persistpass-sending:\n%s",
+                        persistpassthru->command));
+            if (!write_persist_pipe(i, persistpassthru->command)) {
+                *var_len = 0;
+                /*
+                 * close_persist_pipes is called in write_persist_pipe 
+                 */
+                return (NULL);
+            }
+
+            /*
+             * valid call.  Exec and get output 
+             */
+            if ((file = persist_pipes[i].fIn)) {
+                if (fgets(buf, sizeof(buf), file) == NULL) {
+                    *var_len = 0;
+                    close_persist_pipe(i);
+                    return (NULL);
+                }
+                /*
+                 * persistant scripts return "NONE\n" on invalid items 
+                 */
+                if (!strncmp(buf, "NONE", 4)) {
+                    *var_len = 0;
+                    return (NULL);
+                }
+                newlen = parse_miboid(buf, newname);
+
+                /*
+                 * its good, so copy onto name/length 
+                 */
+                memcpy((char *) name, (char *) newname,
+                       (int) newlen * sizeof(oid));
+                *length = newlen;
+
+                /*
+                 * set up return pointer for setable stuff 
+                 */
+                *write_method = setPassPersist;
+
+                if (newlen == 0 || fgets(buf, sizeof(buf), file) == NULL
+                    || fgets(buf2, sizeof(buf2), file) == NULL) {
+                    *var_len = 0;
+                    close_persist_pipe(i);
+                    return (NULL);
+                }
+
+                /*
+                 * buf contains the return type, and buf2 contains the data 
+                 */
+                if (!strncasecmp(buf, "string", 6)) {
+                    buf2[strlen(buf2) - 1] = 0; /* zap the linefeed */
+                    *var_len = strlen(buf2);
+                    vp->type = ASN_OCTET_STR;
+                    return ((unsigned char *) buf2);
+                } else if (!strncasecmp(buf, "integer", 7)) {
+                    *var_len = sizeof(long_ret);
+                    long_ret = strtol(buf2, NULL, 10);
+                    vp->type = ASN_INTEGER;
+                    return ((unsigned char *) &long_ret);
+                } else if (!strncasecmp(buf, "unsigned", 7)) {
+                    *var_len = sizeof(long_ret);
+                    long_ret = strtoul(buf2, NULL, 10);
+                    vp->type = ASN_UNSIGNED;
+                    return ((unsigned char *) &long_ret);
+                } else if (!strncasecmp(buf, "counter", 7)) {
+                    *var_len = sizeof(long_ret);
+                    long_ret = strtoul(buf2, NULL, 10);
+                    vp->type = ASN_COUNTER;
+                    return ((unsigned char *) &long_ret);
+                } else if (!strncasecmp(buf, "octet", 5)) {
+                    *var_len = asc2bin(buf2);
+                    vp->type = ASN_OCTET_STR;
+                    return ((unsigned char *) buf2);
+                } else if (!strncasecmp(buf, "opaque", 5)) {
+                    *var_len = asc2bin(buf2);
+                    vp->type = ASN_OPAQUE;
+                    return ((unsigned char *) buf2);
+                } else if (!strncasecmp(buf, "gauge", 5)) {
+                    *var_len = sizeof(long_ret);
+                    long_ret = strtoul(buf2, NULL, 10);
+                    vp->type = ASN_GAUGE;
+                    return ((unsigned char *) &long_ret);
+                } else if (!strncasecmp(buf, "objectid", 8)) {
+                    newlen = parse_miboid(buf2, objid);
+                    *var_len = newlen * sizeof(oid);
+                    vp->type = ASN_OBJECT_ID;
+                    return ((unsigned char *) objid);
+                } else if (!strncasecmp(buf, "timetick", 8)) {
+                    *var_len = sizeof(long_ret);
+                    long_ret = strtoul(buf2, NULL, 10);
+                    vp->type = ASN_TIMETICKS;
+                    return ((unsigned char *) &long_ret);
+                } else if (!strncasecmp(buf, "ipaddress", 9)) {
+                    newlen = parse_miboid(buf2, objid);
+                    if (newlen != 4) {
+                        snmp_log(LOG_ERR,
+                                 "invalid ipaddress returned:  %s\n",
+                                 buf2);
+                        *var_len = 0;
+                        return (NULL);
+                    }
+                    long_ret =
+                        (objid[0] << (8 * 3)) + (objid[1] << (8 * 2)) +
+                        (objid[2] << 8) + objid[3];
+                    long_ret = htonl(long_ret);
+                    *var_len = sizeof(long_ret);
+                    vp->type = ASN_IPADDRESS;
+                    return ((unsigned char *) &long_ret);
+                }
+            }
+            *var_len = 0;
+            return (NULL);
+        }
+    }
+    if (var_len)
+        *var_len = 0;
+    *write_method = NULL;
+    return (NULL);
+}
+
+int
+setPassPersist(int action,
+               u_char * var_val,
+               u_char var_val_type,
+               size_t var_val_len,
+               u_char * statP, oid * name, size_t name_len)
+{
+    int             i, rtest;
+    struct extensible *persistpassthru;
+
+    char            buf[SNMP_MAXBUF], buf2[SNMP_MAXBUF];
+    long            tmp;
+    unsigned long   utmp;
+    int             itmp;
+
+    /*
+     * Make sure that our basic pipe structure is malloced 
+     */
+    init_persist_pipes();
+
+    for (i = 1; i <= numpersistpassthrus; i++) {
+        persistpassthru = get_exten_instance(persistpassthrus, i);
+        rtest = snmp_oid_min_compare(name, name_len,
+                                     persistpassthru->miboid,
+                                     persistpassthru->miblen);
+        if (rtest <= 0) {
+            if (action != COMMIT)
+                return SNMP_ERR_NOERROR;
+            /*
+             * setup args 
+             */
+            if (persistpassthru->miblen >= name_len || rtest < 0)
+                sprint_mib_oid(buf, persistpassthru->miboid,
+                               persistpassthru->miblen);
+            else
+                sprint_mib_oid(buf, name, name_len);
+            snprintf(persistpassthru->command,
+                     sizeof(persistpassthru->command), "set\n%s\n", buf);
+            persistpassthru->command[ sizeof(persistpassthru->command)-1 ] = 0;
+            switch (var_val_type) {
+            case ASN_INTEGER:
+            case ASN_COUNTER:
+            case ASN_GAUGE:
+            case ASN_TIMETICKS:
+                tmp = *((long *) var_val);
+                switch (var_val_type) {
+                case ASN_INTEGER:
+                    sprintf(buf, "integer %d\n", (int) tmp);
+                    break;
+                case ASN_COUNTER:
+                    sprintf(buf, "counter %d\n", (int) tmp);
+                    break;
+                case ASN_GAUGE:
+                    sprintf(buf, "gauge %d\n", (int) tmp);
+                    break;
+                case ASN_TIMETICKS:
+                    sprintf(buf, "timeticks %d\n", (int) tmp);
+                    break;
+                }
+                break;
+            case ASN_IPADDRESS:
+                utmp = *((u_long *) var_val);
+                utmp = ntohl(utmp);
+                sprintf(buf, "ipaddress %d.%d.%d.%d\n",
+                        (int) ((utmp & 0xff000000) >> (8 * 3)),
+                        (int) ((utmp & 0xff0000) >> (8 * 2)),
+                        (int) ((utmp & 0xff00) >> (8)),
+                        (int) ((utmp & 0xff)));
+                break;
+            case ASN_OCTET_STR:
+                itmp = sizeof(buf2);
+                memcpy(buf2, var_val, var_val_len);
+                if (var_val_len == 0)
+                    sprintf(buf, "string \"\"\n");
+                else if (bin2asc(buf2, var_val_len) == (int) var_val_len)
+                    snprintf(buf, sizeof(buf), "string \"%s\"\n", buf2);
+                else
+                    snprintf(buf, sizeof(buf), "octet \"%s\"\n", buf2);
+                buf[ sizeof(buf)-1 ] = 0;
+                break;
+            case ASN_OBJECT_ID:
+                sprint_mib_oid(buf2, (oid *) var_val, var_val_len);
+                snprintf(buf, sizeof(buf), "objectid \"%s\"\n", buf2);
+                buf[ sizeof(buf)-1 ] = 0;
+                break;
+            }
+            strncat(persistpassthru->command, buf,
+                    sizeof(persistpassthru->command) -
+                    strlen(persistpassthru->command) - 2);
+            persistpassthru->command[ sizeof(persistpassthru->command)-2 ] = '\n';
+            persistpassthru->command[ sizeof(persistpassthru->command)-1 ] = 0;
+
+            if (!open_persist_pipe(i, persistpassthru->name)) {
+                return SNMP_ERR_NOTWRITABLE;
+            }
+
+            DEBUGMSGTL(("ucd-snmp/pass_persist",
+                        "persistpass-writing:  %s\n",
+                        persistpassthru->command));
+            if (!write_persist_pipe(i, persistpassthru->command)) {
+                close_persist_pipe(i);
+                return SNMP_ERR_NOTWRITABLE;
+            }
+
+            if (fgets(buf, sizeof(buf), persist_pipes[i].fIn) == NULL) {
+                close_persist_pipe(i);
+                return SNMP_ERR_NOTWRITABLE;
+            }
+
+            if (!strncasecmp(buf, "not-writable", 11)) {
+                return SNMP_ERR_NOTWRITABLE;
+            } else if (!strncasecmp(buf, "wrong-type", 9)) {
+                return SNMP_ERR_WRONGTYPE;
+            }
+            return SNMP_ERR_NOERROR;
+        }
+    }
+    if (snmp_get_do_debugging()) {
+        sprint_mib_oid(buf2, name, name_len);
+        DEBUGMSGTL(("ucd-snmp/pass_persist", "persistpass-notfound:  %s\n",
+                    buf2));
+    }
+    return SNMP_ERR_NOSUCHNAME;
+}
+
+int
+pass_persist_compare(const void *a, const void *b)
+{
+    const struct extensible *const *ap, *const *bp;
+    ap = (const struct extensible * const *) a;
+    bp = (const struct extensible * const *) b;
+    return snmp_oid_compare((*ap)->miboid, (*ap)->miblen, (*bp)->miboid,
+                            (*bp)->miblen);
+}
+
+/*
+ * Initialize our persistant pipes
+ *   - Returns 1 on success, 0 on failure.
+ *   - Initializes all FILE pointers to NULL to indicate "closed"
+ */
+static int
+init_persist_pipes(void)
+{
+    int             i;
+
+    /*
+     * if we are already taken care of, just return 
+     */
+    if (persist_pipes) {
+        return persist_pipes ? 1 : 0;
+    }
+
+    /*
+     * Otherwise malloc and initialize 
+     */
+    persist_pipes = (struct persist_pipe_type *)
+        malloc(sizeof(struct persist_pipe_type) *
+               (numpersistpassthrus + 1));
+    if (persist_pipes) {
+        for (i = 0; i <= numpersistpassthrus; i++) {
+            persist_pipes[i].fIn = persist_pipes[i].fOut = (FILE *) 0;
+            persist_pipes[i].fdIn = persist_pipes[i].fdOut = -1;
+            persist_pipes[i].pid = -1;
+        }
+    }
+    return persist_pipes ? 1 : 0;
+}
+
+/*
+ * Destruct our persistant pipes
+ *
+ */
+static void
+destruct_persist_pipes(void)
+{
+    int             i;
+
+    /*
+     * Return if there are no pipes 
+     */
+    if (!persist_pipes) {
+        return;
+    }
+
+    for (i = 0; i <= numpersistpassthrus; i++) {
+        close_persist_pipe(i);
+    }
+
+    free(persist_pipes);
+    persist_pipes = (struct persist_pipe_type *) 0;
+}
+
+/*
+ * returns 0 on failure, 1 on success 
+ */
+static int
+open_persist_pipe(int iindex, char *command)
+{
+    static int      recurse = 0;        /* used to allow one level of recursion */
+
+    DEBUGMSGTL(("ucd-snmp/pass_persist", "open_persist_pipe(%d,'%s')\n",
+                iindex, command));
+    /*
+     * Open if it's not already open 
+     */
+    if (persist_pipes[iindex].pid == -1) {
+        int             fdIn, fdOut, pid;
+        get_exec_pipes(command, &fdIn, &fdOut, &pid);
+
+        /*
+         * Did we fail? 
+         */
+        if (pid == -1) {
+            DEBUGMSGTL(("ucd-snmp/pass_persist",
+                        "open_persist_pipe: pid == -1\n"));
+            recurse = 0;
+            return 0;
+        }
+
+        /*
+         * If not, fill out our structure 
+         */
+        persist_pipes[iindex].pid = pid;
+        persist_pipes[iindex].fdIn = fdIn;
+        persist_pipes[iindex].fdOut = fdOut;
+        persist_pipes[iindex].fIn = fdopen(fdIn, "r");
+        persist_pipes[iindex].fOut = fdopen(fdOut, "w");
+
+        /*
+         * Setup our -non-buffered-io- 
+         */
+        setbuf(persist_pipes[iindex].fOut, (char *) 0);
+    }
+
+    /*
+     * Send test packet always so we can self-catch 
+     */
+    {
+        char            buf[SNMP_MAXBUF];
+        /*
+         * Should catch SIGPIPE around this call! 
+         */
+        if (!write_persist_pipe(iindex, "PING\n")) {
+            DEBUGMSGTL(("ucd-snmp/pass_persist",
+                        "open_persist_pipe: Error writing PING\n"));
+            close_persist_pipe(iindex);
+
+            /*
+             * Recurse one time if we get a SIGPIPE 
+             */
+            if (!recurse) {
+                recurse = 1;
+                return open_persist_pipe(iindex, command);
+            }
+            recurse = 0;
+            return 0;
+        }
+        if (fgets(buf, sizeof(buf), persist_pipes[iindex].fIn) == NULL) {
+            DEBUGMSGTL(("ucd-snmp/pass_persist",
+                        "open_persist_pipe: Error reading for PONG\n"));
+            close_persist_pipe(iindex);
+            recurse = 0;
+            return 0;
+        }
+        if (strncmp(buf, "PONG", 4)) {
+            DEBUGMSGTL(("ucd-snmp/pass_persist",
+                        "open_persist_pipe: PONG not received!\n"));
+            close_persist_pipe(iindex);
+            recurse = 0;
+            return 0;
+        }
+    }
+
+    recurse = 0;
+    return 1;
+}
+
+#if STRUCT_SIGACTION_HAS_SA_SIGACTION
+/*
+ * Generic handler 
+ */
+void
+sigpipe_handler(int sig, siginfo_t * sip, void *uap)
+{
+    return;
+}
+#endif
+
+static int
+write_persist_pipe(int iindex, const char *data)
+{
+#if HAVE_SIGNAL
+    struct sigaction sa, osa;
+    int             wret = 0, werrno = 0;
+
+    /*
+     * Don't write to a non-existant process 
+     */
+    if (persist_pipes[iindex].pid == -1) {
+        return 0;
+    }
+
+    /*
+     * Setup our signal action to catch SIGPIPEs 
+     */
+    sa.sa_handler = NULL;
+#if STRUCT_SIGACTION_HAS_SA_SIGACTION
+    sa.sa_sigaction = &sigpipe_handler;
+#endif
+    sigemptyset(&sa.sa_mask);
+    sa.sa_flags = 0;
+    if (sigaction(SIGPIPE, &sa, &osa)) {
+        DEBUGMSGTL(("ucd-snmp/pass_persist",
+                    "write_persist_pipe: sigaction failed: %d", errno));
+    }
+
+    /*
+     * Do the write 
+     */
+    wret = write(persist_pipes[iindex].fdOut, data, strlen(data));
+    werrno = errno;
+
+    /*
+     * Reset the signal handler 
+     */
+    sigaction(SIGPIPE, &osa, (struct sigaction *) 0);
+
+    if (wret < 0) {
+        if (werrno != EINTR) {
+            DEBUGMSGTL(("ucd-snmp/pass_persist",
+                        "write_persist_pipe: write returned unknown error %d\n",
+                        errno));
+        }
+        close_persist_pipe(iindex);
+        return 0;
+    }
+#endif                          /* HAVE_SIGNAL */
+    return 1;
+}
+
+static void
+close_persist_pipe(int iindex)
+{
+
+    /*
+     * Check and nix every item 
+     */
+    if (persist_pipes[iindex].fOut) {
+        fclose(persist_pipes[iindex].fOut);
+        persist_pipes[iindex].fOut = (FILE *) 0;
+    }
+    if (persist_pipes[iindex].fdOut != -1) {
+        close(persist_pipes[iindex].fdOut);
+        persist_pipes[iindex].fdOut = -1;
+    }
+    if (persist_pipes[iindex].fIn) {
+        fclose(persist_pipes[iindex].fIn);
+        persist_pipes[iindex].fIn = (FILE *) 0;
+    }
+    if (persist_pipes[iindex].fdIn != -1) {
+        close(persist_pipes[iindex].fdIn);
+        persist_pipes[iindex].fdIn = -1;
+    }
+    if (persist_pipes[iindex].pid != -1) {
+#if HAVE_SYS_WAIT_H
+        waitpid(persist_pipes[iindex].pid, 0, 0);
+#endif
+        persist_pipes[iindex].pid = -1;
+    }
+
+}
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/ucd-snmp/pass_persist.h tomato121/release/src/router/snmp/agent/mibgroup/ucd-snmp/pass_persist.h
--- tomato/release/src/router/snmp/agent/mibgroup/ucd-snmp/pass_persist.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/ucd-snmp/pass_persist.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,22 @@
+/*
+ *  pass: pass through extensiblity
+ */
+#ifndef _MIBGROUP_PASS_PERSIST_H
+#define _MIBGROUP_PASS_PERSIST_H
+
+config_require(ucd-snmp/extensible util_funcs)
+
+void            init_pass_persist(void);
+extern FindVarMethod var_extensible_pass_persist;
+extern WriteMethod setPassPersist;
+
+/*
+ * config file parsing routines 
+ */
+void            pass_persist_free_config(void);
+void            pass_persist_parse_config(const char *, char *);
+int             pass_persist_compare(const void *, const void *);
+
+#include "mibdefs.h"
+
+#endif                          /* _MIBGROUP_PASS_PERSIST_H */
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/ucd-snmp/proc.c tomato121/release/src/router/snmp/agent/mibgroup/ucd-snmp/proc.c
--- tomato/release/src/router/snmp/agent/mibgroup/ucd-snmp/proc.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/ucd-snmp/proc.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,811 @@
+#include <net-snmp/net-snmp-config.h>
+
+#ifdef solaris2
+#define _KMEMUSER               /* Needed by <sys/user.h> */
+#include <sys/types.h>          /* helps define struct rlimit */
+#endif
+
+#if HAVE_IO_H                   /* win32 */
+#include <io.h>
+#endif
+#if HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#if HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#if HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+#if HAVE_MALLOC_H
+#include <malloc.h>
+#endif
+#include <math.h>
+#include <ctype.h>
+#include <sys/types.h>
+#if HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+#if TIME_WITH_SYS_TIME
+# ifdef WIN32
+#  include <sys/timeb.h>
+# else
+#  include <sys/time.h>
+# endif
+# include <time.h>
+#else
+# if HAVE_SYS_TIME_H
+#  include <sys/time.h>
+# else
+#  include <time.h>
+# endif
+#endif
+#if HAVE_KVM_H
+#include <kvm.h>
+#endif
+#if HAVE_WINSOCK_H
+#include <winsock.h>
+#endif
+
+#if HAVE_DMALLOC_H
+#include <dmalloc.h>
+#endif
+
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+#include "struct.h"
+#include "proc.h"
+#ifdef USING_UCD_SNMP_ERRORMIB_MODULE
+#include "errormib.h"
+#else
+#define setPerrorstatus(x) snmp_log_perror(x)
+#endif
+#include "util_funcs.h"
+#include "kernel.h"
+
+static struct myproc *get_proc_instance(struct myproc *, oid);
+struct myproc  *procwatch = NULL;
+static struct extensible fixproc;
+int             numprocs = 0;
+
+void
+init_proc(void)
+{
+
+    /*
+     * define the structure we're going to ask the agent to register our
+     * information at 
+     */
+    struct variable2 extensible_proc_variables[] = {
+        {MIBINDEX, ASN_INTEGER, RONLY, var_extensible_proc, 1, {MIBINDEX}},
+        {ERRORNAME, ASN_OCTET_STR, RONLY, var_extensible_proc, 1,
+         {ERRORNAME}},
+        {PROCMIN, ASN_INTEGER, RONLY, var_extensible_proc, 1, {PROCMIN}},
+        {PROCMAX, ASN_INTEGER, RONLY, var_extensible_proc, 1, {PROCMAX}},
+        {PROCCOUNT, ASN_INTEGER, RONLY, var_extensible_proc, 1,
+         {PROCCOUNT}},
+        {ERRORFLAG, ASN_INTEGER, RONLY, var_extensible_proc, 1,
+         {ERRORFLAG}},
+        {ERRORMSG, ASN_OCTET_STR, RONLY, var_extensible_proc, 1,
+         {ERRORMSG}},
+        {ERRORFIX, ASN_INTEGER, RWRITE, var_extensible_proc, 1,
+         {ERRORFIX}},
+        {ERRORFIXCMD, ASN_OCTET_STR, RONLY, var_extensible_proc, 1,
+         {ERRORFIXCMD}}
+    };
+
+    /*
+     * Define the OID pointer to the top of the mib tree that we're
+     * registering underneath 
+     */
+    oid             proc_variables_oid[] = { UCDAVIS_MIB, PROCMIBNUM, 1 };
+
+    /*
+     * register ourselves with the agent to handle our mib tree 
+     */
+    REGISTER_MIB("ucd-snmp/proc", extensible_proc_variables, variable2,
+                 proc_variables_oid);
+
+    snmpd_register_config_handler("proc", proc_parse_config,
+                                  proc_free_config,
+                                  "process-name [max-num] [min-num]");
+    snmpd_register_config_handler("procfix", procfix_parse_config, NULL,
+                                  "process-name program [arguments...]");
+}
+
+
+/*
+ * Define snmpd.conf reading routines first.  They get called
+ * automatically by the invocation of a macro in the proc.h file. 
+ */
+
+void
+proc_free_config(void)
+{
+    struct myproc  *ptmp, *ptmp2;
+
+    for (ptmp = procwatch; ptmp != NULL;) {
+        ptmp2 = ptmp;
+        ptmp = ptmp->next;
+        free(ptmp2);
+    }
+    procwatch = NULL;
+    numprocs = 0;
+}
+
+/*
+ * find a give entry in the linked list associated with a proc name 
+ */
+static struct myproc *
+get_proc_by_name(char *name)
+{
+    struct myproc  *ptmp;
+
+    if (name == NULL)
+        return NULL;
+
+    for (ptmp = procwatch; ptmp != NULL && strcmp(ptmp->name, name) != 0;
+         ptmp = ptmp->next);
+    return ptmp;
+}
+
+void
+procfix_parse_config(const char *token, char *cptr)
+{
+    char            tmpname[STRMAX];
+    struct myproc  *procp;
+
+    /*
+     * don't allow two entries with the same name 
+     */
+    cptr = copy_nword(cptr, tmpname, sizeof(tmpname));
+    if ((procp = get_proc_by_name(tmpname)) == NULL) {
+        config_perror("No proc entry registered for this proc name yet.");
+        return;
+    }
+
+    if (strlen(cptr) > sizeof(procp->fixcmd)) {
+        config_perror("fix command too long.");
+        return;
+    }
+
+    strcpy(procp->fixcmd, cptr);
+}
+
+
+void
+proc_parse_config(const char *token, char *cptr)
+{
+    char            tmpname[STRMAX];
+    struct myproc **procp = &procwatch;
+
+    /*
+     * don't allow two entries with the same name 
+     */
+    copy_nword(cptr, tmpname, sizeof(tmpname));
+    if (get_proc_by_name(tmpname) != NULL) {
+        config_perror("Already have an entry for this process.");
+        return;
+    }
+
+    /*
+     * skip past used ones 
+     */
+    while (*procp != NULL)
+        procp = &((*procp)->next);
+
+    (*procp) = (struct myproc *) calloc(1, sizeof(struct myproc));
+    if (*procp == NULL)
+        return;                 /* memory alloc error */
+    numprocs++;
+    /*
+     * not blank and not a comment 
+     */
+    copy_nword(cptr, (*procp)->name, sizeof((*procp)->name));
+    cptr = skip_not_white(cptr);
+    if ((cptr = skip_white(cptr))) {
+        (*procp)->max = atoi(cptr);
+        cptr = skip_not_white(cptr);
+        if ((cptr = skip_white(cptr)))
+            (*procp)->min = atoi(cptr);
+        else
+            (*procp)->min = 0;
+    } else {
+        (*procp)->max = 0;
+        (*procp)->min = 0;
+    }
+#ifdef PROCFIXCMD
+    sprintf((*procp)->fixcmd, PROCFIXCMD, (*procp)->name);
+#endif
+    DEBUGMSGTL(("ucd-snmp/proc", "Read:  %s (%d) (%d)\n",
+                (*procp)->name, (*procp)->max, (*procp)->min));
+}
+
+/*
+ * The routine that handles everything 
+ */
+
+u_char         *
+var_extensible_proc(struct variable *vp,
+                    oid * name,
+                    size_t * length,
+                    int exact,
+                    size_t * var_len, WriteMethod ** write_method)
+{
+
+    struct myproc  *proc;
+    static long     long_ret;
+    static char     errmsg[300];
+
+
+    if (header_simple_table
+        (vp, name, length, exact, var_len, write_method, numprocs))
+        return (NULL);
+
+    if ((proc = get_proc_instance(procwatch, name[*length - 1]))) {
+        switch (vp->magic) {
+        case MIBINDEX:
+            long_ret = name[*length - 1];
+            return ((u_char *) (&long_ret));
+        case ERRORNAME:        /* process name to check for */
+            *var_len = strlen(proc->name);
+            return ((u_char *) (proc->name));
+        case PROCMIN:
+            long_ret = proc->min;
+            return ((u_char *) (&long_ret));
+        case PROCMAX:
+            long_ret = proc->max;
+            return ((u_char *) (&long_ret));
+        case PROCCOUNT:
+            long_ret = sh_count_procs(proc->name);
+            return ((u_char *) (&long_ret));
+        case ERRORFLAG:
+            long_ret = sh_count_procs(proc->name);
+            if (long_ret >= 0 &&
+                ((proc->min && long_ret < proc->min) ||
+                 (proc->max && long_ret > proc->max) ||
+                 (proc->min == 0 && proc->max == 0 && long_ret < 1))) {
+                long_ret = 1;
+            } else {
+                long_ret = 0;
+            }
+            return ((u_char *) (&long_ret));
+        case ERRORMSG:
+            long_ret = sh_count_procs(proc->name);
+            if (long_ret < 0) {
+                errmsg[0] = 0;  /* catch out of mem errors return 0 count */
+            } else if (proc->min && long_ret < proc->min) {
+                snprintf(errmsg, sizeof(errmsg),
+                        "Too few %s running (# = %d)",
+                        proc->name, (int) long_ret);
+            } else if (proc->max && long_ret > proc->max) {
+                snprintf(errmsg, sizeof(errmsg),
+                        "Too many %s running (# = %d)",
+                        proc->name, (int) long_ret);
+            } else if (proc->min == 0 && proc->max == 0 && long_ret < 1) {
+                snprintf(errmsg, sizeof(errmsg),
+                        "No %s process running.", proc->name);
+            } else {
+                errmsg[0] = 0;
+            }
+            errmsg[ sizeof(errmsg)-1 ] = 0;
+            *var_len = strlen(errmsg);
+            return ((u_char *) errmsg);
+        case ERRORFIX:
+            *write_method = fixProcError;
+            long_return = fixproc.result;
+            return ((u_char *) & long_return);
+        case ERRORFIXCMD:
+            if (proc->fixcmd) {
+                *var_len = strlen(proc->fixcmd);
+                return (u_char *) proc->fixcmd;
+            }
+            errmsg[0] = 0;
+            *var_len = 0;
+            return ((u_char *) errmsg);
+        }
+        return NULL;
+    }
+    return NULL;
+}
+
+int
+fixProcError(int action,
+             u_char * var_val,
+             u_char var_val_type,
+             size_t var_val_len,
+             u_char * statP, oid * name, size_t name_len)
+{
+
+    struct myproc  *proc;
+    long            tmp = 0;
+
+    if ((proc = get_proc_instance(procwatch, name[10]))) {
+        if (var_val_type != ASN_INTEGER) {
+            snmp_log(LOG_ERR, "Wrong type != int\n");
+            return SNMP_ERR_WRONGTYPE;
+        }
+        tmp = *((long *) var_val);
+        if (tmp == 1 && action == COMMIT) {
+            if (proc->fixcmd[0]) {
+                strcpy(fixproc.command, proc->fixcmd);
+                exec_command(&fixproc);
+            }
+        }
+        return SNMP_ERR_NOERROR;
+    }
+    return SNMP_ERR_WRONGTYPE;
+}
+
+static struct myproc *
+get_proc_instance(struct myproc *proc, oid inst)
+{
+    int             i;
+
+    if (proc == NULL)
+        return (NULL);
+    for (i = 1; (i != (int) inst) && (proc != NULL); i++)
+        proc = proc->next;
+    return (proc);
+}
+
+#ifdef bsdi2
+#include <sys/param.h>
+#include <sys/sysctl.h>
+
+#define PP(pp, field) ((pp)->kp_proc . field)
+#define EP(pp, field) ((pp)->kp_eproc . field)
+#define VP(pp, field) ((pp)->kp_eproc.e_vm . field)
+
+/*
+ * these are for keeping track of the proc array 
+ */
+
+static int      nproc = 0;
+static int      onproc = -1;
+static struct kinfo_proc *pbase = 0;
+
+int
+sh_count_procs(char *procname)
+{
+    register int    i, ret = 0;
+    register struct kinfo_proc *pp;
+    static int      mib[] = { CTL_KERN, KERN_PROC, KERN_PROC_ALL };
+
+    if (sysctl(mib, 3, NULL, &nproc, NULL, 0) < 0)
+        return 0;
+
+    if (nproc > onproc || !pbase) {
+        if ((pbase = (struct kinfo_proc *) realloc(pbase,
+                                                   nproc +
+                                                   sizeof(struct
+                                                          kinfo_proc))) ==
+            0)
+            return -1;
+        onproc = nproc;
+        memset(pbase, 0, nproc + sizeof(struct kinfo_proc));
+    }
+
+    if (sysctl(mib, 3, pbase, &nproc, NULL, 0) < 0)
+        return -1;
+
+    for (pp = pbase, i = 0; i < nproc / sizeof(struct kinfo_proc);
+         pp++, i++) {
+        if (PP(pp, p_stat) != 0 && (((PP(pp, p_flag) & P_SYSTEM) == 0))) {
+            if (PP(pp, p_stat) != SZOMB
+                && !strcmp(PP(pp, p_comm), procname))
+                ret++;
+        }
+    }
+    return ret;
+}
+
+#elif OSTYPE == LINUXID
+
+#include <dirent.h>
+#include <fcntl.h>
+#include <unistd.h>
+
+int
+sh_count_procs(char *procname)
+{
+    DIR *dir;
+    char cmdline[512], *tmpc;
+    struct dirent *ent;
+#ifdef USE_PROC_CMDLINE
+    int fd,len;
+#endif
+    int plen=strlen(procname),total = 0;
+    FILE *status;
+
+    if ((dir = opendir("/proc")) == NULL) return -1;
+    while (NULL != (ent = readdir(dir))) {
+      if(!(ent->d_name[0] >= '0' && ent->d_name[0] <= '9')) continue;
+#ifdef USE_PROC_CMDLINE  /* old method */
+      /* read /proc/XX/cmdline */
+      sprintf(cmdline,"/proc/%s/cmdline",ent->d_name);
+      if((fd = open(cmdline, O_RDONLY)) < 0) break;
+      len = read(fd,cmdline,sizeof(cmdline) - 1);
+      close(fd);
+      if(len <= 0) continue;
+      cmdline[len] = 0;
+      while(--len && !cmdline[len]);
+      while(--len) if(!cmdline[len]) cmdline[len] = ' ';
+      if(!strncmp(cmdline,procname,plen)) total++;
+#else
+      /* read /proc/XX/status */
+      sprintf(cmdline,"/proc/%s/status",ent->d_name);
+      if ((status = fopen(cmdline, "r")) == NULL)
+          break;
+      if (fgets(cmdline, sizeof(cmdline), status) == NULL) {
+          fclose(status);
+          break;
+      }
+      fclose(status);
+      cmdline[sizeof(cmdline)-1] = '\0';
+      /* XXX: assumes Name: is first */
+      if (strncmp("Name:",cmdline, 5) != 0)
+          break;
+      tmpc = skip_token(cmdline);
+      if (!tmpc)
+          break;
+      DEBUGMSGTL(("proc","Comparing wanted %s against %s\n",
+                  procname, tmpc));
+      if(!strncmp(tmpc,procname,plen)) {
+          total++;
+          DEBUGMSGTL(("proc", " Matched.  total count now=%d\n", total));
+      }
+#endif      
+    }
+    closedir(dir);
+    return total;
+}
+
+#elif OSTYPE == ULTRIXID
+
+#define	NPROCS		32      /* number of proces to read at once */
+
+extern int      kmem, mem, swap;
+
+#include <sys/user.h>
+#include <sys/proc.h>
+#include <sys/file.h>
+#include <sys/vm.h>
+#include <machine/pte.h>
+#ifdef HAVE_NLIST_H
+#include <nlist.h>
+#endif
+
+static struct user *getuser(struct proc *);
+static int      getword(off_t);
+static int      getstruct(off_t, char *, off_t, int);
+
+static struct nlist proc_nl[] = {
+    {"_nproc"},
+#define X_NPROC		0
+    {"_proc"},
+#define X_PROC		1
+    {"_proc_bitmap"},
+#define X_PROC_BITMAP	2
+    {NULL}
+};
+
+int
+sh_count_procs(char *procname)
+{
+    int             total, proc_active, nproc;
+    int             thisproc = 0;
+    int             absolute_proc_number = -1;
+    struct user    *auser;
+    struct proc    *aproc, *procp;
+    unsigned        bitmap;
+    struct proc     procs[NPROCS], *procsp;
+    static int      inited = 0;
+
+    procp = (struct proc *) getword(proc_nl[X_PROC].n_value);
+    nproc = getword(proc_nl[X_NPROC].n_value);
+
+    total = 0;
+    for (;;) {
+        do {
+            while (thisproc == 0) {
+                int             nread;
+                int             psize;
+
+                if (nproc == 0)
+                    return (total);
+
+                thisproc = MIN(NPROCS, nproc);
+                psize = thisproc * sizeof(struct proc);
+                nproc -= thisproc;
+                if (lseek(kmem, (off_t) procp, L_SET) == -1 ||
+                    (nread = read(kmem, (char *) procs, psize)) < 0) {
+                    /*
+                     * warn("read proc"); 
+                     */
+                    return (total);
+                } else if (nread != psize) {
+                    thisproc = nread / sizeof(struct proc);
+                    nproc = 0;
+                    /*
+                     * warn("read proc: short read"); 
+                     */
+                }
+                procsp = procs;
+                procp += thisproc;
+            }
+
+            aproc = procsp++;
+            thisproc--;
+
+            absolute_proc_number++;
+            if ((absolute_proc_number % 32) == 0)
+                bitmap =
+                    getword((unsigned int) proc_nl[X_PROC_BITMAP].n_value +
+                            ((absolute_proc_number / 32) * 4));
+            proc_active =
+                (bitmap & (1 << (absolute_proc_number % 32))) != 0;
+            if (proc_active && aproc->p_stat != SZOMB
+                && !(aproc->p_type & SWEXIT))
+                auser = getuser(aproc);
+        } while (!proc_active || auser == NULL);
+
+        if (strcmp(auser->u_comm, procname) == 0)
+            total++;
+    }
+}
+
+#define	SW_UADDR	dtob(getword((off_t)dmap.dm_ptdaddr))
+#define	SW_UBYTES	sizeof(struct user)
+
+#define	SKRD(file, src, dst, size)			\
+	(lseek(file, (off_t)(src), L_SET) == -1) ||	\
+	(read(file, (char *)(dst), (size)) != (size))
+
+static struct user *
+getuser(struct proc *aproc)
+{
+    static union {
+        struct user     user;
+        char            upgs[UPAGES][NBPG];
+    } u;
+    static struct pte uptes[UPAGES];
+    static struct dmap dmap;
+    int             i, nbytes;
+
+    /*
+     * If process is not in core, we simply snarf it's user struct
+     * from the swap device.
+     */
+    if ((aproc->p_sched & SLOAD) == 0) {
+        if (!getstruct
+            ((off_t) aproc->p_smap, "aproc->p_smap", (off_t) & dmap,
+             sizeof(dmap))) {
+            /*
+             * warnx("can't read dmap for pid %d from %s", aproc->p_pid,
+             * _PATH_DRUM); 
+             */
+            return (NULL);
+        }
+        if (SKRD(swap, SW_UADDR, &u.user, SW_UBYTES)) {
+            /*
+             * warnx("can't read u for pid %d from %s", aproc->p_pid, _PATH_DRUM); 
+             */
+            return (NULL);
+        }
+        return (&u.user);
+    }
+
+    /*
+     * Process is in core.  Follow p_addr to read in the page
+     * table entries that map the u-area and then read in the
+     * physical pages that comprise the u-area.
+     *
+     * If at any time, an lseek() or read() fails, print a warning
+     * message and return NULL.
+     */
+    if (SKRD(kmem, aproc->p_addr, uptes, sizeof(uptes))) {
+        /*
+         * warnx("can't read user pt for pid %d from %s", aproc->p_pid, _PATH_DRUM); 
+         */
+        return (NULL);
+    }
+
+    nbytes = sizeof(struct user);
+    for (i = 0; i < UPAGES && nbytes > 0; i++) {
+        if (SKRD(mem, ptob(uptes[i].pg_pfnum), u.upgs[i], NBPG)) {
+            /*
+             * warnx("can't read user page %u for pid %d from %s",
+             * uptes[i].pg_pfnum, aproc->p_pid, _PATH_MEM); 
+             */
+            return (NULL);
+        }
+        nbytes -= NBPG;
+    }
+    return (&u.user);
+}
+
+static int
+getword(off_t loc)
+{
+    int             val;
+
+    if (SKRD(kmem, loc, &val, sizeof(val)))
+        exit(1);
+    return (val);
+}
+
+static int
+getstruct(off_t loc, char *name, off_t dest, int size)
+{
+    if (SKRD(kmem, loc, dest, size))
+        return (0);
+    return (1);
+}
+#elif OSTYPE == SOLARISID
+
+#ifdef _SLASH_PROC_METHOD_
+
+#include <fcntl.h>
+#include <dirent.h>
+
+#include <procfs.h>
+
+/*
+ * Gets process information from /proc/.../psinfo
+ */
+
+int
+sh_count_procs(char *procname)
+{
+    int             fd, total = 0;
+    struct psinfo   info;
+    char            fbuf[32];
+    struct dirent  *ent;
+    DIR            *dir;
+
+    if (!(dir = opendir("/proc"))) {
+        snmp_perror("/proc");
+        return -1;
+    }
+
+    while ((ent = readdir(dir))) {
+        if (!strcmp(ent->d_name, "..") || !strcmp(ent->d_name, "."))
+            continue;
+
+        snprintf(fbuf, sizeof fbuf, "/proc/%s/psinfo", ent->d_name);
+        if ((fd = open(fbuf, O_RDONLY)) < 0) {  /* Continue or return error? */
+            snmp_perror(fbuf);
+	    continue;
+        }
+
+        if (read(fd, (char *) &info, sizeof(struct psinfo)) !=
+            sizeof(struct psinfo)) {
+            snmp_perror(fbuf);
+            close(fd);
+            closedir(dir);
+            return -1;
+        }
+
+        if (!info.pr_nlwp && !info.pr_lwp.pr_lwpid) {
+            /*
+             * Zombie process 
+             */
+        } else {
+            DEBUGMSGTL(("proc","Comparing wanted %s against %s\n",
+                        procname, info.pr_fname));
+            if (!strcmp(procname, info.pr_fname)) {
+                total++;
+                DEBUGMSGTL(("proc", " Matched.  total count now=%d\n", total));
+            }
+        }
+
+        close(fd);
+    }
+    closedir(dir);
+    return total;
+}
+
+#else                           /* _SLASH_PROC_METHOD_ */
+
+#define _KMEMUSER               /* Needed by <sys/user.h> */
+
+#include <kvm.h>
+#include <fcntl.h>
+#include <sys/user.h>
+#include <sys/proc.h>
+
+int
+sh_count_procs(char *procname)
+{
+    struct proc    *p;
+    struct user    *u;
+    int             total;
+
+    if (kd == NULL) {
+        return -1;
+    }
+    if (kvm_setproc(kd) < 0) {
+        return (-1);
+    }
+    kvm_setproc(kd);
+    total = 0;
+    while ((p = kvm_nextproc(kd)) != NULL) {
+        if (!p) {
+            return (-1);
+        }
+        u = kvm_getu(kd, p);
+        /*
+         * Skip this entry if u or u->u_comm is a NULL pointer 
+         */
+        if (!u) {
+            continue;
+        }
+        if (strcmp(procname, u->u_comm) == 0)
+            total++;
+    }
+    return (total);
+}
+#endif                          /* _SLASH_PROC_METHOD_ */
+#else
+int
+sh_count_procs(char *procname)
+{
+    char            line[STRMAX], *cptr, *cp;
+    int             ret = 0, fd;
+    FILE           *file;
+#ifndef EXCACHETIME
+#endif
+    struct extensible ex;
+    int             slow = strstr(PSCMD, "ax") != NULL;
+
+    strcpy(ex.command, PSCMD);
+    if ((fd = get_exec_output(&ex)) >= 0) {
+        if ((file = fdopen(fd, "r")) == NULL) {
+            setPerrorstatus("fdopen");
+            close(fd);
+            return (-1);
+        }
+        while (fgets(line, sizeof(line), file) != NULL) {
+            if (slow) {
+                cptr = find_field(line, 5);
+                cp = strrchr(cptr, '/');
+                if (cp)
+                    cptr = cp + 1;
+                else if (*cptr == '-')
+                    cptr++;
+                else if (*cptr == '[') {
+                    cptr++;
+                    cp = strchr(cptr, ']');
+                    if (cp)
+                        *cp = 0;
+                }
+                copy_nword(cptr, line, sizeof(line));
+                cp = line + strlen(line) - 1;
+                if (*cp == ':')
+                    *cp = 0;
+            } else {
+                if ((cptr = find_field(line, LASTFIELD)) == NULL)
+                    continue;
+                copy_nword(cptr, line, sizeof(line));
+            }
+            if (!strcmp(line, procname))
+                ret++;
+        }
+        if (ftell(file) < 2) {
+#ifdef USING_UCD_SNMP_ERRORMIB_MODULE
+            seterrorstatus("process list unreasonable short (mem?)", 2);
+#endif
+            ret = -1;
+        }
+        fclose(file);
+        wait_on_exec(&ex);
+    } else {
+        ret = -1;
+    }
+    return (ret);
+}
+#endif
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/ucd-snmp/proc.c.newproc tomato121/release/src/router/snmp/agent/mibgroup/ucd-snmp/proc.c.newproc
--- tomato/release/src/router/snmp/agent/mibgroup/ucd-snmp/proc.c.newproc	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/ucd-snmp/proc.c.newproc	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,773 @@
+#include <net-snmp/net-snmp-config.h>
+
+#ifdef solaris2
+#define _KMEMUSER               /* Needed by <sys/user.h> */
+#include <sys/types.h>          /* helps define struct rlimit */
+#endif
+
+#if HAVE_IO_H                   /* win32 */
+#include <io.h>
+#endif
+#if HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#if HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#if HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+#if HAVE_MALLOC_H
+#include <malloc.h>
+#endif
+#include <math.h>
+#include <ctype.h>
+#include <sys/types.h>
+#if HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+#if TIME_WITH_SYS_TIME
+# ifdef WIN32
+#  include <sys/timeb.h>
+# else
+#  include <sys/time.h>
+# endif
+# include <time.h>
+#else
+# if HAVE_SYS_TIME_H
+#  include <sys/time.h>
+# else
+#  include <time.h>
+# endif
+#endif
+#if HAVE_KVM_H
+#include <kvm.h>
+#endif
+#if HAVE_WINSOCK_H
+#include <winsock.h>
+#endif
+
+#if HAVE_DMALLOC_H
+#include <dmalloc.h>
+#endif
+
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+#include "struct.h"
+#include "proc.h"
+#ifdef USING_UCD_SNMP_ERRORMIB_MODULE
+#include "errormib.h"
+#else
+#define setPerrorstatus(x) snmp_log_perror(x)
+#endif
+#include "util_funcs.h"
+#include "kernel.h"
+
+static struct myproc *get_proc_instance(struct myproc *, oid);
+struct myproc  *procwatch = NULL;
+static struct extensible fixproc;
+int             numprocs = 0;
+
+void
+init_proc(void)
+{
+
+    /*
+     * define the structure we're going to ask the agent to register our
+     * information at 
+     */
+    struct variable2 extensible_proc_variables[] = {
+        {MIBINDEX, ASN_INTEGER, RONLY, var_extensible_proc, 1, {MIBINDEX}},
+        {ERRORNAME, ASN_OCTET_STR, RONLY, var_extensible_proc, 1,
+         {ERRORNAME}},
+        {PROCMIN, ASN_INTEGER, RONLY, var_extensible_proc, 1, {PROCMIN}},
+        {PROCMAX, ASN_INTEGER, RONLY, var_extensible_proc, 1, {PROCMAX}},
+        {PROCCOUNT, ASN_INTEGER, RONLY, var_extensible_proc, 1,
+         {PROCCOUNT}},
+        {ERRORFLAG, ASN_INTEGER, RONLY, var_extensible_proc, 1,
+         {ERRORFLAG}},
+        {ERRORMSG, ASN_OCTET_STR, RONLY, var_extensible_proc, 1,
+         {ERRORMSG}},
+        {ERRORFIX, ASN_INTEGER, RWRITE, var_extensible_proc, 1,
+         {ERRORFIX}},
+        {ERRORFIXCMD, ASN_OCTET_STR, RONLY, var_extensible_proc, 1,
+         {ERRORFIXCMD}}
+    };
+
+    /*
+     * Define the OID pointer to the top of the mib tree that we're
+     * registering underneath 
+     */
+    oid             proc_variables_oid[] = { UCDAVIS_MIB, PROCMIBNUM, 1 };
+
+    /*
+     * register ourselves with the agent to handle our mib tree 
+     */
+    REGISTER_MIB("ucd-snmp/proc", extensible_proc_variables, variable2,
+                 proc_variables_oid);
+
+    snmpd_register_config_handler("proc", proc_parse_config,
+                                  proc_free_config,
+                                  "process-name [max-num] [min-num]");
+    snmpd_register_config_handler("procfix", procfix_parse_config, NULL,
+                                  "process-name program [arguments...]");
+}
+
+
+/*
+ * Define snmpd.conf reading routines first.  They get called
+ * automatically by the invocation of a macro in the proc.h file. 
+ */
+
+void
+proc_free_config(void)
+{
+    struct myproc  *ptmp, *ptmp2;
+
+    for (ptmp = procwatch; ptmp != NULL;) {
+        ptmp2 = ptmp;
+        ptmp = ptmp->next;
+        free(ptmp2);
+    }
+    procwatch = NULL;
+    numprocs = 0;
+}
+
+/*
+ * find a give entry in the linked list associated with a proc name 
+ */
+static struct myproc *
+get_proc_by_name(char *name)
+{
+    struct myproc  *ptmp;
+
+    if (name == NULL)
+        return NULL;
+
+    for (ptmp = procwatch; ptmp != NULL && strcmp(ptmp->name, name) != 0;
+         ptmp = ptmp->next);
+    return ptmp;
+}
+
+void
+procfix_parse_config(const char *token, char *cptr)
+{
+    char            tmpname[STRMAX];
+    struct myproc  *procp;
+
+    /*
+     * don't allow two entries with the same name 
+     */
+    cptr = copy_nword(cptr, tmpname, sizeof(tmpname));
+    if ((procp = get_proc_by_name(tmpname)) == NULL) {
+        config_perror("No proc entry registered for this proc name yet.");
+        return;
+    }
+
+    if (strlen(cptr) > sizeof(procp->fixcmd)) {
+        config_perror("fix command too long.");
+        return;
+    }
+
+    strcpy(procp->fixcmd, cptr);
+}
+
+
+void
+proc_parse_config(const char *token, char *cptr)
+{
+    char            tmpname[STRMAX];
+    struct myproc **procp = &procwatch;
+
+    /*
+     * don't allow two entries with the same name 
+     */
+    copy_nword(cptr, tmpname, sizeof(tmpname));
+    if (get_proc_by_name(tmpname) != NULL) {
+        config_perror("Already have an entry for this process.");
+        return;
+    }
+
+    /*
+     * skip past used ones 
+     */
+    while (*procp != NULL)
+        procp = &((*procp)->next);
+
+    (*procp) = (struct myproc *) calloc(1, sizeof(struct myproc));
+    if (*procp == NULL)
+        return;                 /* memory alloc error */
+    numprocs++;
+    /*
+     * not blank and not a comment 
+     */
+    copy_nword(cptr, (*procp)->name, sizeof((*procp)->name));
+    cptr = skip_not_white(cptr);
+    if ((cptr = skip_white(cptr))) {
+        (*procp)->max = atoi(cptr);
+        cptr = skip_not_white(cptr);
+        if ((cptr = skip_white(cptr)))
+            (*procp)->min = atoi(cptr);
+        else
+            (*procp)->min = 0;
+    } else {
+        (*procp)->max = 0;
+        (*procp)->min = 0;
+    }
+#ifdef PROCFIXCMD
+    sprintf((*procp)->fixcmd, PROCFIXCMD, (*procp)->name);
+#endif
+    DEBUGMSGTL(("ucd-snmp/proc", "Read:  %s (%d) (%d)\n",
+                (*procp)->name, (*procp)->max, (*procp)->min));
+}
+
+/*
+ * The routine that handles everything 
+ */
+
+u_char         *
+var_extensible_proc(struct variable *vp,
+                    oid * name,
+                    size_t * length,
+                    int exact,
+                    size_t * var_len, WriteMethod ** write_method)
+{
+
+    struct myproc  *proc;
+    static long     long_ret;
+    static char     errmsg[300];
+
+
+    if (header_simple_table
+        (vp, name, length, exact, var_len, write_method, numprocs))
+        return (NULL);
+
+    if ((proc = get_proc_instance(procwatch, name[*length - 1]))) {
+        switch (vp->magic) {
+        case MIBINDEX:
+            long_ret = name[*length - 1];
+            return ((u_char *) (&long_ret));
+        case ERRORNAME:        /* process name to check for */
+            *var_len = strlen(proc->name);
+            return ((u_char *) (proc->name));
+        case PROCMIN:
+            long_ret = proc->min;
+            return ((u_char *) (&long_ret));
+        case PROCMAX:
+            long_ret = proc->max;
+            return ((u_char *) (&long_ret));
+        case PROCCOUNT:
+            long_ret = sh_count_procs(proc->name);
+            return ((u_char *) (&long_ret));
+        case ERRORFLAG:
+            long_ret = sh_count_procs(proc->name);
+            if (long_ret >= 0 &&
+                ((proc->min && long_ret < proc->min) ||
+                 (proc->max && long_ret > proc->max) ||
+                 (proc->min == 0 && proc->max == 0 && long_ret < 1))) {
+                long_ret = 1;
+            } else {
+                long_ret = 0;
+            }
+            return ((u_char *) (&long_ret));
+        case ERRORMSG:
+            long_ret = sh_count_procs(proc->name);
+            if (long_ret < 0) {
+                errmsg[0] = 0;  /* catch out of mem errors return 0 count */
+            } else if (proc->min && long_ret < proc->min) {
+                snprintf(errmsg, sizeof(errmsg),
+                        "Too few %s running (# = %d)",
+                        proc->name, (int) long_ret);
+            } else if (proc->max && long_ret > proc->max) {
+                snprintf(errmsg, sizeof(errmsg),
+                        "Too many %s running (# = %d)",
+                        proc->name, (int) long_ret);
+            } else if (proc->min == 0 && proc->max == 0 && long_ret < 1) {
+                snprintf(errmsg, sizeof(errmsg),
+                        "No %s process running.", proc->name);
+            } else {
+                errmsg[0] = 0;
+            }
+            errmsg[ sizeof(errmsg)-1 ] = 0;
+            *var_len = strlen(errmsg);
+            return ((u_char *) errmsg);
+        case ERRORFIX:
+            *write_method = fixProcError;
+            long_return = fixproc.result;
+            return ((u_char *) & long_return);
+        case ERRORFIXCMD:
+            if (proc->fixcmd) {
+                *var_len = strlen(proc->fixcmd);
+                return (u_char *) proc->fixcmd;
+            }
+            errmsg[0] = 0;
+            *var_len = 0;
+            return ((u_char *) errmsg);
+        }
+        return NULL;
+    }
+    return NULL;
+}
+
+int
+fixProcError(int action,
+             u_char * var_val,
+             u_char var_val_type,
+             size_t var_val_len,
+             u_char * statP, oid * name, size_t name_len)
+{
+
+    struct myproc  *proc;
+    long            tmp = 0;
+
+    if ((proc = get_proc_instance(procwatch, name[10]))) {
+        if (var_val_type != ASN_INTEGER) {
+            snmp_log(LOG_ERR, "Wrong type != int\n");
+            return SNMP_ERR_WRONGTYPE;
+        }
+        tmp = *((long *) var_val);
+        if (tmp == 1 && action == COMMIT) {
+            if (proc->fixcmd[0]) {
+                strcpy(fixproc.command, proc->fixcmd);
+                exec_command(&fixproc);
+            }
+        }
+        return SNMP_ERR_NOERROR;
+    }
+    return SNMP_ERR_WRONGTYPE;
+}
+
+static struct myproc *
+get_proc_instance(struct myproc *proc, oid inst)
+{
+    int             i;
+
+    if (proc == NULL)
+        return (NULL);
+    for (i = 1; (i != (int) inst) && (proc != NULL); i++)
+        proc = proc->next;
+    return (proc);
+}
+
+#ifdef bsdi2
+#include <sys/param.h>
+#include <sys/sysctl.h>
+
+#define PP(pp, field) ((pp)->kp_proc . field)
+#define EP(pp, field) ((pp)->kp_eproc . field)
+#define VP(pp, field) ((pp)->kp_eproc.e_vm . field)
+
+/*
+ * these are for keeping track of the proc array 
+ */
+
+static int      nproc = 0;
+static int      onproc = -1;
+static struct kinfo_proc *pbase = 0;
+
+int
+sh_count_procs(char *procname)
+{
+    register int    i, ret = 0;
+    register struct kinfo_proc *pp;
+    static int      mib[] = { CTL_KERN, KERN_PROC, KERN_PROC_ALL };
+
+    if (sysctl(mib, 3, NULL, &nproc, NULL, 0) < 0)
+        return 0;
+
+    if (nproc > onproc || !pbase) {
+        if ((pbase = (struct kinfo_proc *) realloc(pbase,
+                                                   nproc +
+                                                   sizeof(struct
+                                                          kinfo_proc))) ==
+            0)
+            return -1;
+        onproc = nproc;
+        memset(pbase, 0, nproc + sizeof(struct kinfo_proc));
+    }
+
+    if (sysctl(mib, 3, pbase, &nproc, NULL, 0) < 0)
+        return -1;
+
+    for (pp = pbase, i = 0; i < nproc / sizeof(struct kinfo_proc);
+         pp++, i++) {
+        if (PP(pp, p_stat) != 0 && (((PP(pp, p_flag) & P_SYSTEM) == 0))) {
+            if (PP(pp, p_stat) != SZOMB
+                && !strcmp(PP(pp, p_comm), procname))
+                ret++;
+        }
+    }
+    return ret;
+}
+
+#elif OSTYPE == LINUXID
+
+#include <dirent.h>
+#include <fcntl.h>
+#include <unistd.h>
+
+int
+sh_count_procs(char *procname)
+{
+    DIR *dir;
+    char cmdline[512];
+    struct dirent *ent;
+    int fd,len,plen=strlen(procname),total = 0;
+
+    if ((dir = opendir("/proc")) == NULL) return -1;
+    while (NULL != (ent = readdir(dir))) {
+      if(!(ent->d_name[0] >= '0' && ent->d_name[0] <= '9')) continue;
+      /* read /proc/XX/cmdline */
+      sprintf(cmdline,"/proc/%s/cmdline",ent->d_name);
+      if((fd = open(cmdline, O_RDONLY)) < 0) break;
+      len = read(fd,cmdline,sizeof(cmdline) - 1);
+      close(fd);
+      if(len <= 0) continue;
+      cmdline[len] = 0;
+      while(--len && !cmdline[len]);
+      while(--len) if(!cmdline[len]) cmdline[len] = ' ';
+      if(!strncmp(cmdline,procname,plen)) total++;
+    }
+    closedir(dir);
+    return total;
+}
+
+#elif OSTYPE == ULTRIXID
+
+#define	NPROCS		32      /* number of proces to read at once */
+
+extern int      kmem, mem, swap;
+
+#include <sys/user.h>
+#include <sys/proc.h>
+#include <sys/file.h>
+#include <sys/vm.h>
+#include <machine/pte.h>
+#ifdef HAVE_NLIST_H
+#include <nlist.h>
+#endif
+
+static struct user *getuser(struct proc *);
+static int      getword(off_t);
+static int      getstruct(off_t, char *, off_t, int);
+
+static struct nlist proc_nl[] = {
+    {"_nproc"},
+#define X_NPROC		0
+    {"_proc"},
+#define X_PROC		1
+    {"_proc_bitmap"},
+#define X_PROC_BITMAP	2
+    {NULL}
+};
+
+int
+sh_count_procs(char *procname)
+{
+    int             total, proc_active, nproc;
+    int             thisproc = 0;
+    int             absolute_proc_number = -1;
+    struct user    *auser;
+    struct proc    *aproc, *procp;
+    unsigned        bitmap;
+    struct proc     procs[NPROCS], *procsp;
+    static int      inited = 0;
+
+    procp = (struct proc *) getword(proc_nl[X_PROC].n_value);
+    nproc = getword(proc_nl[X_NPROC].n_value);
+
+    total = 0;
+    for (;;) {
+        do {
+            while (thisproc == 0) {
+                int             nread;
+                int             psize;
+
+                if (nproc == 0)
+                    return (total);
+
+                thisproc = MIN(NPROCS, nproc);
+                psize = thisproc * sizeof(struct proc);
+                nproc -= thisproc;
+                if (lseek(kmem, (off_t) procp, L_SET) == -1 ||
+                    (nread = read(kmem, (char *) procs, psize)) < 0) {
+                    /*
+                     * warn("read proc"); 
+                     */
+                    return (total);
+                } else if (nread != psize) {
+                    thisproc = nread / sizeof(struct proc);
+                    nproc = 0;
+                    /*
+                     * warn("read proc: short read"); 
+                     */
+                }
+                procsp = procs;
+                procp += thisproc;
+            }
+
+            aproc = procsp++;
+            thisproc--;
+
+            absolute_proc_number++;
+            if ((absolute_proc_number % 32) == 0)
+                bitmap =
+                    getword((unsigned int) proc_nl[X_PROC_BITMAP].n_value +
+                            ((absolute_proc_number / 32) * 4));
+            proc_active =
+                (bitmap & (1 << (absolute_proc_number % 32))) != 0;
+            if (proc_active && aproc->p_stat != SZOMB
+                && !(aproc->p_type & SWEXIT))
+                auser = getuser(aproc);
+        } while (!proc_active || auser == NULL);
+
+        if (strcmp(auser->u_comm, procname) == 0)
+            total++;
+    }
+}
+
+#define	SW_UADDR	dtob(getword((off_t)dmap.dm_ptdaddr))
+#define	SW_UBYTES	sizeof(struct user)
+
+#define	SKRD(file, src, dst, size)			\
+	(lseek(file, (off_t)(src), L_SET) == -1) ||	\
+	(read(file, (char *)(dst), (size)) != (size))
+
+static struct user *
+getuser(struct proc *aproc)
+{
+    static union {
+        struct user     user;
+        char            upgs[UPAGES][NBPG];
+    } u;
+    static struct pte uptes[UPAGES];
+    static struct dmap dmap;
+    int             i, nbytes;
+
+    /*
+     * If process is not in core, we simply snarf it's user struct
+     * from the swap device.
+     */
+    if ((aproc->p_sched & SLOAD) == 0) {
+        if (!getstruct
+            ((off_t) aproc->p_smap, "aproc->p_smap", (off_t) & dmap,
+             sizeof(dmap))) {
+            /*
+             * warnx("can't read dmap for pid %d from %s", aproc->p_pid,
+             * _PATH_DRUM); 
+             */
+            return (NULL);
+        }
+        if (SKRD(swap, SW_UADDR, &u.user, SW_UBYTES)) {
+            /*
+             * warnx("can't read u for pid %d from %s", aproc->p_pid, _PATH_DRUM); 
+             */
+            return (NULL);
+        }
+        return (&u.user);
+    }
+
+    /*
+     * Process is in core.  Follow p_addr to read in the page
+     * table entries that map the u-area and then read in the
+     * physical pages that comprise the u-area.
+     *
+     * If at any time, an lseek() or read() fails, print a warning
+     * message and return NULL.
+     */
+    if (SKRD(kmem, aproc->p_addr, uptes, sizeof(uptes))) {
+        /*
+         * warnx("can't read user pt for pid %d from %s", aproc->p_pid, _PATH_DRUM); 
+         */
+        return (NULL);
+    }
+
+    nbytes = sizeof(struct user);
+    for (i = 0; i < UPAGES && nbytes > 0; i++) {
+        if (SKRD(mem, ptob(uptes[i].pg_pfnum), u.upgs[i], NBPG)) {
+            /*
+             * warnx("can't read user page %u for pid %d from %s",
+             * uptes[i].pg_pfnum, aproc->p_pid, _PATH_MEM); 
+             */
+            return (NULL);
+        }
+        nbytes -= NBPG;
+    }
+    return (&u.user);
+}
+
+static int
+getword(off_t loc)
+{
+    int             val;
+
+    if (SKRD(kmem, loc, &val, sizeof(val)))
+        exit(1);
+    return (val);
+}
+
+static int
+getstruct(off_t loc, char *name, off_t dest, int size)
+{
+    if (SKRD(kmem, loc, dest, size))
+        return (0);
+    return (1);
+}
+#elif OSTYPE == SOLARISID
+
+#ifdef _SLASH_PROC_METHOD_
+
+#include <fcntl.h>
+#include <dirent.h>
+
+#include <procfs.h>
+
+/*
+ * Gets process information from /proc/.../psinfo
+ */
+
+int
+sh_count_procs(char *procname)
+{
+    int             fd, total = 0;
+    struct psinfo   info;
+    char            fbuf[32];
+    struct dirent  *ent;
+    DIR            *dir;
+
+    if (!(dir = opendir("/proc")))
+        return -1;
+
+    while ((ent = readdir(dir))) {
+        if (!strcmp(ent->d_name, "..") || !strcmp(ent->d_name, "."))
+            continue;
+
+        snprintf(fbuf, sizeof fbuf, "/proc/%s/psinfo", ent->d_name);
+        if ((fd = open(fbuf, O_RDONLY)) < 0) {  /* Continue or return error? */
+            closedir(dir);
+            return -1;
+        }
+
+        if (read(fd, (char *) &info, sizeof(struct psinfo)) !=
+            sizeof(struct psinfo)) {
+            close(fd);
+            closedir(dir);
+            return -1;
+        }
+
+        if (!info.pr_nlwp && !info.pr_lwp.pr_lwpid) {
+            /*
+             * Zombie process 
+             */
+        } else if (!strcmp(procname, info.pr_fname))
+            total++;
+
+        close(fd);
+    }
+    closedir(dir);
+    return total;
+}
+
+#else                           /* _SLASH_PROC_METHOD_ */
+
+#define _KMEMUSER               /* Needed by <sys/user.h> */
+
+#include <kvm.h>
+#include <fcntl.h>
+#include <sys/user.h>
+#include <sys/proc.h>
+
+int
+sh_count_procs(char *procname)
+{
+    struct proc    *p;
+    struct user    *u;
+    int             total;
+
+    if (kd == NULL) {
+        return -1;
+    }
+    if (kvm_setproc(kd) < 0) {
+        return (-1);
+    }
+    kvm_setproc(kd);
+    total = 0;
+    while ((p = kvm_nextproc(kd)) != NULL) {
+        if (!p) {
+            return (-1);
+        }
+        u = kvm_getu(kd, p);
+        /*
+         * Skip this entry if u or u->u_comm is a NULL pointer 
+         */
+        if (!u) {
+            continue;
+        }
+        if (strcmp(procname, u->u_comm) == 0)
+            total++;
+    }
+    return (total);
+}
+#endif                          /* _SLASH_PROC_METHOD_ */
+#else
+int
+sh_count_procs(char *procname)
+{
+    char            line[STRMAX], *cptr, *cp;
+    int             ret = 0, fd;
+    FILE           *file;
+#ifndef EXCACHETIME
+#endif
+    struct extensible ex;
+    int             slow = strstr(PSCMD, "ax") != NULL;
+
+    strcpy(ex.command, PSCMD);
+    if ((fd = get_exec_output(&ex)) >= 0) {
+        if ((file = fdopen(fd, "r")) == NULL) {
+            setPerrorstatus("fdopen");
+            close(fd);
+            return (-1);
+        }
+        while (fgets(line, sizeof(line), file) != NULL) {
+            if (slow) {
+                cptr = find_field(line, 5);
+                cp = strrchr(cptr, '/');
+                if (cp)
+                    cptr = cp + 1;
+                else if (*cptr == '-')
+                    cptr++;
+                else if (*cptr == '[') {
+                    cptr++;
+                    cp = strchr(cptr, ']');
+                    if (cp)
+                        *cp = 0;
+                }
+                copy_nword(cptr, line, sizeof(line));
+                cp = line + strlen(line) - 1;
+                if (*cp == ':')
+                    *cp = 0;
+            } else {
+                if ((cptr = find_field(line, LASTFIELD)) == NULL)
+                    continue;
+                copy_nword(cptr, line, sizeof(line));
+            }
+            if (!strcmp(line, procname))
+                ret++;
+        }
+        if (ftell(file) < 2) {
+#ifdef USING_UCD_SNMP_ERRORMIB_MODULE
+            seterrorstatus("process list unreasonable short (mem?)", 2);
+#endif
+            ret = -1;
+        }
+        fclose(file);
+        wait_on_exec(&ex);
+    } else {
+        ret = -1;
+    }
+    return (ret);
+}
+#endif
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/ucd-snmp/proc.h tomato121/release/src/router/snmp/agent/mibgroup/ucd-snmp/proc.h
--- tomato/release/src/router/snmp/agent/mibgroup/ucd-snmp/proc.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/ucd-snmp/proc.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,28 @@
+/*
+ *  Process watching mib group
+ */
+#ifndef _MIBGROUP_PROC_H
+#define _MIBGROUP_PROC_H
+
+config_require(util_funcs)
+
+     void            init_proc(void);
+
+     extern FindVarMethod var_extensible_proc;
+     extern WriteMethod fixProcError;
+     int             sh_count_procs(char *);
+
+/*
+ * config file parsing routines 
+ */
+     void            proc_free_config(void);
+     void            proc_parse_config(const char *, char *);
+     void            procfix_parse_config(const char *, char *);
+
+#include "mibdefs.h"
+
+#define PROCMIN 3
+#define PROCMAX 4
+#define PROCCOUNT 5
+
+#endif                          /* _MIBGROUP_PROC_H */
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/ucd-snmp/proxy.c tomato121/release/src/router/snmp/agent/mibgroup/ucd-snmp/proxy.c
--- tomato/release/src/router/snmp/agent/mibgroup/ucd-snmp/proxy.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/ucd-snmp/proxy.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,447 @@
+#include <net-snmp/net-snmp-config.h>
+
+#include <sys/types.h>
+#if HAVE_WINSOCK_H
+#include <winsock.h>
+#endif
+#if HAVE_STRING_H
+#include <string.h>
+#endif
+#ifdef HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+#include "proxy.h"
+
+static struct simple_proxy *proxies = NULL;
+
+oid             testoid[] = { 1, 3, 6, 1, 4, 1, 2021, 8888, 1 };
+
+/*
+ * this must be standardized somewhere, right? 
+ */
+#define MAX_ARGS 128
+
+char           *context_string;
+
+static void
+proxyOptProc(int argc, char *const *argv, int opt)
+{
+    switch (opt) {
+    case 'C':
+        while (*optarg) {
+            switch (*optarg++) {
+            case 'n':
+                optind++;
+                if (optind < argc) {
+                    context_string = argv[optind - 1];
+                } else {
+                    config_perror("No context name passed to -Cn");
+                }
+                break;
+            default:
+                config_perror("unknown argument passed to -C");
+                break;
+            }
+        }
+        break;
+    default:
+        break;
+        /*
+         * shouldn't get here 
+         */
+    }
+}
+
+void
+proxy_parse_config(const char *token, char *line)
+{
+    /*
+     * proxy args [base-oid] [remap-to-remote-oid] 
+     */
+
+    netsnmp_session session, *ss;
+    struct simple_proxy *newp, **listpp;
+    char            args[MAX_ARGS][SPRINT_MAX_LEN], *argv[MAX_ARGS];
+    int             argn, arg;
+    char           *cp;
+    netsnmp_handler_registration *reg;
+
+    context_string = NULL;
+
+    DEBUGMSGTL(("proxy_config", "entering\n"));
+
+    /*
+     * create the argv[] like array 
+     */
+    strcpy(argv[0] = args[0], "snmpd-proxy");   /* bogus entry for getopt() */
+    for (argn = 1, cp = line; cp && argn < MAX_ARGS;
+         cp = copy_nword(cp, argv[argn] = args[argn++], SPRINT_MAX_LEN)) {
+    }
+
+    for (arg = 0; arg < argn; arg++) {
+        DEBUGMSGTL(("proxy_args", "final args: %d = %s\n", arg,
+                    argv[arg]));
+    }
+
+    DEBUGMSGTL(("proxy_config", "parsing args: %d\n", argn));
+    arg = snmp_parse_args(argn, argv, &session, "C:", proxyOptProc);
+    DEBUGMSGTL(("proxy_config", "done parsing args\n"));
+
+    if (arg >= argn) {
+        config_perror("missing base oid");
+        return;
+    }
+
+    SOCK_STARTUP;
+    /*
+     * usm_set_reportErrorOnUnknownID(0); 
+     *
+     * hack, stupid v3 ASIs. 
+     */
+    /*
+     * XXX: on a side note, we don't really need to be a reference
+     * platform any more so the proper thing to do would be to fix
+     * snmplib/snmpusm.c to pass in the pdu type to usm_process_incoming
+     * so this isn't needed. 
+     */
+    ss = snmp_open(&session);
+    /*
+     * usm_set_reportErrorOnUnknownID(1); 
+     */
+    if (ss == NULL) {
+        /*
+         * diagnose snmp_open errors with the input netsnmp_session pointer 
+         */
+        snmp_sess_perror("snmpget", &session);
+        SOCK_CLEANUP;
+        return;
+    }
+
+    newp = (struct simple_proxy *) calloc(1, sizeof(struct simple_proxy));
+
+    newp->sess = ss;
+    DEBUGMSGTL(("proxy_init", "name = %s\n", args[arg]));
+    newp->name_len = MAX_OID_LEN;
+    if (!snmp_parse_oid(args[arg++], newp->name, &newp->name_len)) {
+        snmp_perror("proxy");
+        config_perror("illegal proxy oid specified\n");
+        return;
+    }
+
+    if (arg < argn) {
+        DEBUGMSGTL(("proxy_init", "base = %s\n", args[arg]));
+        newp->base_len = MAX_OID_LEN;
+        if (!snmp_parse_oid(args[arg++], newp->base, &newp->base_len)) {
+            snmp_perror("proxy");
+            config_perror("illegal variable name specified (base oid)\n");
+            return;
+        }
+    }
+
+    DEBUGMSGTL(("proxy_init", "registering at: "));
+    DEBUGMSGOID(("proxy_init", newp->name, newp->name_len));
+    DEBUGMSG(("proxy_init", "\n"));
+
+    /*
+     * add to our chain 
+     */
+    /*
+     * must be sorted! 
+     */
+    listpp = &proxies;
+    while (*listpp &&
+           snmp_oid_compare(newp->name, newp->name_len,
+                            (*listpp)->name, (*listpp)->name_len) > 0) {
+        listpp = &((*listpp)->next);
+    }
+
+    /*
+     * listpp should be next in line from us. 
+     */
+    if (*listpp) {
+        /*
+         * make our next in the link point to the current link 
+         */
+        newp->next = *listpp;
+    }
+    /*
+     * replace current link with us 
+     */
+    *listpp = newp;
+
+    reg = netsnmp_create_handler_registration("proxy",
+                                              proxy_handler,
+                                              newp->name,
+                                              newp->name_len,
+                                              HANDLER_CAN_RWRITE);
+    reg->handler->myvoid = newp;
+    if (context_string)
+        reg->contextName = strdup(context_string);
+
+    netsnmp_register_handler(reg);
+}
+
+void
+proxy_free_config(void)
+{
+    struct simple_proxy *rm;
+
+    /*
+     * XXX: finish me (needs unregister_mib()) 
+     */
+    return;
+
+    while (proxies) {
+        rm = proxies;
+        proxies = rm->next;
+        SNMP_FREE(rm->variables);
+        snmp_close(rm->sess);
+        SNMP_FREE(rm);
+    }
+}
+
+void
+init_proxy(void)
+{
+    snmpd_register_config_handler("proxy", proxy_parse_config,
+                                  proxy_free_config,
+                                  "[snmpcmd args] host oid [remoteoid]");
+}
+
+int
+proxy_handler(netsnmp_mib_handler *handler,
+              netsnmp_handler_registration *reginfo,
+              netsnmp_agent_request_info *reqinfo,
+              netsnmp_request_info *requests)
+{
+
+    netsnmp_pdu    *pdu;
+    struct simple_proxy *sp;
+    oid            *ourname;
+    size_t          ourlength;
+    netsnmp_request_info *request = requests;
+
+    DEBUGMSGTL(("proxy", "proxy handler starting, mode = %d\n",
+                reqinfo->mode));
+
+    switch (reqinfo->mode) {
+    case MODE_GET:
+    case MODE_GETNEXT:
+    case MODE_GETBULK:         /* WWWXXX */
+        pdu = snmp_pdu_create(reqinfo->mode);
+        break;
+
+    case MODE_SET_COMMIT:
+        pdu = snmp_pdu_create(SNMP_MSG_SET);
+        break;
+
+    default:
+        snmp_log(LOG_WARNING, "unsupported mode for proxy called\n");
+        return SNMP_ERR_NOERROR;
+    }
+
+    sp = (struct simple_proxy *) handler->myvoid;
+
+    if (!pdu || !sp) {
+        netsnmp_set_request_error(reqinfo, requests, SNMP_ERR_GENERR);
+        return SNMP_ERR_NOERROR;
+    }
+
+    while (request) {
+        ourname = request->requestvb->name;
+        ourlength = request->requestvb->name_length;
+
+        if (sp->base_len > 0) {
+            if ((ourlength - sp->name_len + sp->base_len) > MAX_OID_LEN) {
+                /*
+                 * too large 
+                 */
+                snmp_log(LOG_ERR,
+                         "proxy oid request length is too long\n");
+                return SNMP_ERR_NOERROR;
+            }
+            /*
+             * suffix appended? 
+             */
+            DEBUGMSGTL(("proxy", "length=%d, base_len=%d, name_len=%d\n",
+                        ourlength, sp->base_len, sp->name_len));
+            if (ourlength > (int) sp->name_len)
+                memcpy(&(sp->base[sp->base_len]), &(ourname[sp->name_len]),
+                       sizeof(oid) * (ourlength - sp->name_len));
+            ourlength = ourlength - sp->name_len + sp->base_len;
+            ourname = sp->base;
+        }
+
+        snmp_pdu_add_variable(pdu, ourname, ourlength,
+                              request->requestvb->type,
+                              request->requestvb->val.string,
+                              request->requestvb->val_len);
+        request->delegated = 1;
+        request = request->next;
+    }
+
+    /*
+     * send the request out 
+     */
+    DEBUGMSGTL(("proxy", "sending pdu\n"));
+    snmp_async_send(sp->sess, pdu, proxy_got_response,
+                    netsnmp_create_delegated_cache(handler, reginfo,
+                                                   reqinfo, requests,
+                                                   (void *) sp));
+    return SNMP_ERR_NOERROR;
+}
+
+int
+proxy_got_response(int operation, netsnmp_session * sess, int reqid,
+                   netsnmp_pdu *pdu, void *cb_data)
+{
+    netsnmp_delegated_cache *cache = (netsnmp_delegated_cache *) cb_data;
+    netsnmp_request_info *requests, *request;
+    netsnmp_variable_list *vars, *var;
+
+    struct simple_proxy *sp;
+    oid             myname[MAX_OID_LEN];
+    size_t          myname_len = MAX_OID_LEN;
+
+    cache = netsnmp_handler_check_cache(cache);
+
+    if (!cache) {
+        DEBUGMSGTL(("proxy", "a proxy request was no longer valid.\n"));
+        return SNMP_ERR_NOERROR;
+    }
+
+    requests = cache->requests;
+
+
+    sp = (struct simple_proxy *) cache->localinfo;
+
+    if (!sp) {
+        DEBUGMSGTL(("proxy", "a proxy request was no longer valid.\n"));
+        return SNMP_ERR_NOERROR;
+    }
+
+    switch (operation) {
+    case NETSNMP_CALLBACK_OP_TIMED_OUT:
+        /*
+         * WWWXXX: don't leave requests delayed if operation is
+         * something like TIMEOUT 
+         */
+        DEBUGMSGTL(("proxy", "got timed out... requests = %08p\n", requests));
+
+        netsnmp_handler_mark_requests_as_delegated(requests,
+						   REQUEST_IS_NOT_DELEGATED);
+        netsnmp_set_request_error(cache->reqinfo, requests, /* XXXWWW: should be index = 0 */
+				  SNMP_ERR_GENERR);
+        netsnmp_free_delegated_cache(cache);
+        return 0;
+
+    case NETSNMP_CALLBACK_OP_RECEIVED_MESSAGE:
+        vars = pdu->variables;
+
+        /*
+         * update the original request varbinds with the results 
+         */
+        for (var = vars, request = requests;
+             request && var;
+             request = request->next, var = var->next_variable) {
+            snmp_set_var_typed_value(request->requestvb, var->type,
+                                     var->val.string, var->val_len);
+
+            DEBUGMSGTL(("proxy", "got response... "));
+            DEBUGMSGOID(("proxy", var->name, var->name_length));
+            DEBUGMSG(("proxy", "\n"));
+            request->delegated = 0;
+
+            /*
+             * copy the oid it belongs to 
+             */
+            if (sp->base_len &&
+                (var->name_length < sp->base_len ||
+                 snmp_oid_compare(var->name, sp->base_len, sp->base,
+                                  sp->base_len) != 0)) {
+                DEBUGMSGTL(("proxy", "out of registered range... "));
+                DEBUGMSGOID(("proxy", var->name, sp->base_len));
+                DEBUGMSG(("proxy", " (%d) != ", sp->base_len));
+                DEBUGMSGOID(("proxy", sp->base, sp->base_len));
+                DEBUGMSG(("proxy", "\n"));
+
+                continue;
+            } else if (!sp->base_len &&
+                       (var->name_length < sp->name_len ||
+                        snmp_oid_compare(var->name, sp->name_len, sp->name,
+                                         sp->name_len) != 0)) {
+                DEBUGMSGTL(("proxy", "out of registered base range...\n"));
+                /*
+                 * or not if its out of our search range 
+                 */
+                continue;
+            } else {
+                if (sp->base_len) {
+                    /*
+                     * XXX: oid size maxed? 
+                     */
+                    memcpy(myname, sp->name, sizeof(oid) * sp->name_len);
+                    myname_len =
+                        sp->name_len + var->name_length - sp->base_len;
+                    if (myname_len > MAX_OID_LEN) {
+                        snmp_log(LOG_WARNING,
+                                 "proxy OID return length too long.\n");
+                        netsnmp_set_request_error(cache->reqinfo, requests,
+                                                  SNMP_ERR_GENERR);
+                        if (pdu)
+                            snmp_free_pdu(pdu);
+                        netsnmp_free_delegated_cache(cache);
+                        return 1;
+                    }
+
+                    if (var->name_length > sp->base_len)
+                        memcpy(&myname[sp->name_len],
+                               &var->name[sp->base_len],
+                               sizeof(oid) * (var->name_length -
+                                              sp->base_len));
+                    snmp_set_var_objid(request->requestvb, myname,
+                                       myname_len);
+                } else {
+                    snmp_set_var_objid(request->requestvb, var->name,
+                                       var->name_length);
+                }
+            }
+        }
+
+        if (request || var) {
+            /*
+             * ack, this is bad.  The # of varbinds don't match and
+             * there is no way to fix the problem 
+             */
+            if (pdu)
+                snmp_free_pdu(pdu);
+            snmp_log(LOG_ERR,
+                     "response to proxy request illegal.  We're screwed.\n");
+            netsnmp_set_request_error(cache->reqinfo, requests,
+                                      SNMP_ERR_GENERR);
+        }
+
+        /* fix bulk_to_next operations */
+        if (cache->reqinfo->mode == MODE_GETBULK)
+            netsnmp_bulk_to_next_fix_requests(requests);
+        
+        /*
+         * free the response 
+         */
+        if (pdu && 0)
+            snmp_free_pdu(pdu);
+	break;
+
+    default:
+        DEBUGMSGTL(("proxy", "no response received: op = %d\n",
+                    operation));
+	break;
+    }
+
+    netsnmp_free_delegated_cache(cache);
+    return 1;
+}
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/ucd-snmp/proxy.h tomato121/release/src/router/snmp/agent/mibgroup/ucd-snmp/proxy.h
--- tomato/release/src/router/snmp/agent/mibgroup/ucd-snmp/proxy.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/ucd-snmp/proxy.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,20 @@
+#ifndef UCD_SNMP_PROXY_H
+#define UCD_SNMP_PROXY_H
+
+struct simple_proxy {
+    struct variable2 *variables;
+    oid             name[MAX_OID_LEN];
+    size_t          name_len;
+    oid             base[MAX_OID_LEN];
+    size_t          base_len;
+    netsnmp_session *sess;
+    struct simple_proxy *next;
+};
+
+int             proxy_got_response(int, netsnmp_session *, int,
+                                   netsnmp_pdu *, void *);
+void            proxy_parse_config(const char *, char *);
+void            init_proxy(void);
+Netsnmp_Node_Handler proxy_handler;
+
+#endif                          /* UCD_SNMP_PROXY_H */
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/ucd-snmp/versioninfo.c tomato121/release/src/router/snmp/agent/mibgroup/ucd-snmp/versioninfo.c
--- tomato/release/src/router/snmp/agent/mibgroup/ucd-snmp/versioninfo.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/ucd-snmp/versioninfo.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,224 @@
+#include <net-snmp/net-snmp-config.h>
+
+#include <sys/types.h>
+#if TIME_WITH_SYS_TIME
+# ifdef WIN32
+#  include <sys/timeb.h>
+# else
+#  include <sys/time.h>
+# endif
+# include <time.h>
+#else
+# if HAVE_SYS_TIME_H
+#  include <sys/time.h>
+# else
+#  include <time.h>
+# endif
+#endif
+#if HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+#if HAVE_WINSOCK_H
+#include <winsock.h>
+#endif
+#if HAVE_STRING_H
+#include <string.h>
+#endif
+
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+#include "struct.h"
+#include "versioninfo.h"
+#include "util_funcs.h"
+
+void
+init_versioninfo(void)
+{
+
+    /*
+     * define the structure we're going to ask the agent to register our
+     * information at 
+     */
+    struct variable2 extensible_version_variables[] = {
+        {MIBINDEX, ASN_INTEGER, RONLY, var_extensible_version, 1,
+         {MIBINDEX}},
+        {VERTAG, ASN_OCTET_STR, RONLY, var_extensible_version, 1,
+         {VERTAG}},
+        {VERDATE, ASN_OCTET_STR, RONLY, var_extensible_version, 1,
+         {VERDATE}},
+        {VERCDATE, ASN_OCTET_STR, RONLY, var_extensible_version, 1,
+         {VERCDATE}},
+        {VERIDENT, ASN_OCTET_STR, RONLY, var_extensible_version, 1,
+         {VERIDENT}},
+        {VERCONFIG, ASN_OCTET_STR, RONLY, var_extensible_version, 1,
+         {VERCONFIG}},
+        {VERCLEARCACHE, ASN_INTEGER, RWRITE, var_extensible_version, 1,
+         {VERCLEARCACHE}},
+        {VERUPDATECONFIG, ASN_INTEGER, RWRITE, var_extensible_version, 1,
+         {VERUPDATECONFIG}},
+        {VERRESTARTAGENT, ASN_INTEGER, RWRITE, var_extensible_version, 1,
+         {VERRESTARTAGENT}},
+        {VERSAVEPERSISTENT, ASN_INTEGER, RWRITE, var_extensible_version, 1,
+         {VERSAVEPERSISTENT}},
+        {VERDEBUGGING, ASN_INTEGER, RWRITE, var_extensible_version, 1,
+         {VERDEBUGGING}}
+    };
+
+    /*
+     * Define the OID pointer to the top of the mib tree that we're
+     * registering underneath 
+     */
+    oid             version_variables_oid[] =
+        { UCDAVIS_MIB, VERSIONMIBNUM };
+
+    /*
+     * register ourselves with the agent to handle our mib tree 
+     */
+    REGISTER_MIB("ucd-snmp/versioninfo", extensible_version_variables,
+                 variable2, version_variables_oid);
+
+}
+
+
+u_char         *
+var_extensible_version(struct variable *vp,
+                       oid * name,
+                       size_t * length,
+                       int exact,
+                       size_t * var_len, WriteMethod ** write_method)
+{
+
+    static long     long_ret;
+    static char     errmsg[300];
+    char           *cptr;
+    time_t          curtime;
+#ifdef CONFIGURE_OPTIONS
+    static char     config_opts[] = CONFIGURE_OPTIONS;
+#endif
+
+    DEBUGMSGTL(("ucd-snmp/versioninfo", "var_extensible_version: "));
+    DEBUGMSGOID(("ucd-snmp/versioninfo", name, *length));
+    DEBUGMSG(("ucd-snmp/versioninfo", " %d\n", exact));
+
+    if (header_generic(vp, name, length, exact, var_len, write_method))
+        return (NULL);
+
+    switch (vp->magic) {
+    case MIBINDEX:
+        long_ret = name[8];
+        return ((u_char *) (&long_ret));
+    case VERTAG:
+        sprintf(errmsg, NetSnmpVersionInfo);
+        *var_len = strlen(errmsg);
+        return ((u_char *) errmsg);
+    case VERDATE:
+        sprintf(errmsg, "$Date: 2004/06/20 21:54:28 $");
+        *var_len = strlen(errmsg);
+        return ((u_char *) errmsg);
+    case VERCDATE:
+        curtime = time(NULL);
+        cptr = ctime(&curtime);
+        sprintf(errmsg, cptr);
+        *var_len = strlen(errmsg) - 1;
+        return ((u_char *) errmsg);
+    case VERIDENT:
+        sprintf(errmsg,
+                "$Id: versioninfo.c,v 1.1.2.1 2004/06/20 21:54:28 nikki Exp $");
+        *var_len = strlen(errmsg);
+        return ((u_char *) errmsg);
+    case VERCONFIG:
+#ifdef CONFIGURE_OPTIONS
+        *var_len = strlen(config_opts);
+        if (*var_len > 1024)
+            *var_len = 1024;    /* mib imposed restriction */
+        return (u_char *) config_opts;
+#else
+        sprintf(errmsg, "");
+        *var_len = strlen(errmsg);
+        return ((u_char *) errmsg);
+#endif
+    case VERCLEARCACHE:
+        *write_method = clear_cache;
+        long_ret = 0;
+        return ((u_char *) & long_ret);
+    case VERUPDATECONFIG:
+        *write_method = update_hook;
+        long_ret = 0;
+        return ((u_char *) & long_ret);
+    case VERRESTARTAGENT:
+        *write_method = restart_hook;
+        long_ret = 0;
+        return ((u_char *) & long_ret);
+    case VERSAVEPERSISTENT:
+        *write_method = save_persistent;
+        long_ret = 0;
+        return ((u_char *) & long_ret);
+    case VERDEBUGGING:
+        *write_method = debugging_hook;
+        long_ret = snmp_get_do_debugging();
+        return ((u_char *) & long_ret);
+    }
+    return NULL;
+}
+
+int
+update_hook(int action,
+            u_char * var_val,
+            u_char var_val_type,
+            size_t var_val_len,
+            u_char * statP, oid * name, size_t name_len)
+{
+    long            tmp = 0;
+
+    if (var_val_type != ASN_INTEGER) {
+        snmp_log(LOG_ERR, "Wrong type != int\n");
+        return SNMP_ERR_WRONGTYPE;
+    }
+    tmp = *((long *) var_val);
+    if (tmp == 1 && action == COMMIT) {
+        update_config();
+    }
+    return SNMP_ERR_NOERROR;
+}
+
+int
+debugging_hook(int action,
+               u_char * var_val,
+               u_char var_val_type,
+               size_t var_val_len,
+               u_char * statP, oid * name, size_t name_len)
+{
+    long            tmp = 0;
+
+    if (var_val_type != ASN_INTEGER) {
+        DEBUGMSGTL(("versioninfo", "Wrong type != int\n"));
+        return SNMP_ERR_WRONGTYPE;
+    }
+    tmp = *((long *) var_val);
+    if (action == COMMIT) {
+        snmp_set_do_debugging(tmp);
+    }
+    return SNMP_ERR_NOERROR;
+}
+
+int
+save_persistent(int action,
+               u_char * var_val,
+               u_char var_val_type,
+               size_t var_val_len,
+               u_char * statP, oid * name, size_t name_len)
+{
+    long            tmp = 0;
+
+    if (var_val_type != ASN_INTEGER) {
+        DEBUGMSGTL(("versioninfo", "Wrong type != int\n"));
+        return SNMP_ERR_WRONGTYPE;
+    }
+    tmp = *((long *) var_val);
+    if (action == COMMIT) {
+        snmp_store(netsnmp_ds_get_string(NETSNMP_DS_LIBRARY_ID,
+                                         NETSNMP_DS_LIB_APPTYPE));
+    }
+    return SNMP_ERR_NOERROR;
+}
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/ucd-snmp/versioninfo.h tomato121/release/src/router/snmp/agent/mibgroup/ucd-snmp/versioninfo.h
--- tomato/release/src/router/snmp/agent/mibgroup/ucd-snmp/versioninfo.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/ucd-snmp/versioninfo.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,32 @@
+/*
+ *  Template MIB group interface - versioninfo.h
+ *
+ */
+#ifndef _MIBGROUP_VERSIONINFO_H
+#define _MIBGROUP_VERSIONINFO_H
+
+void            init_versioninfo(void);
+
+extern FindVarMethod var_extensible_version;
+extern WriteMethod update_hook;
+extern WriteMethod debugging_hook;
+extern WriteMethod save_persistent;
+
+#include "mibdefs.h"
+
+/*
+ * Version info mib 
+ */
+#define VERTAG 2
+#define VERDATE 3
+#define VERCDATE 4
+#define VERIDENT 5
+#define VERCONFIG 6
+#define VERCLEARCACHE 10
+#define VERUPDATECONFIG 11
+#define VERRESTARTAGENT 12
+#define VERSAVEPERSISTENT 13
+#define VERDEBUGGING 20
+
+config_require(util_funcs)
+#endif                          /* _MIBGROUP_VERSIONINFO_H */
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/ucd-snmp/vmstat_bsdi4.c tomato121/release/src/router/snmp/agent/mibgroup/ucd-snmp/vmstat_bsdi4.c
--- tomato/release/src/router/snmp/agent/mibgroup/ucd-snmp/vmstat_bsdi4.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/ucd-snmp/vmstat_bsdi4.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,281 @@
+/*
+ * vmstat_bsdi4.c
+ */
+
+#include <net-snmp/net-snmp-config.h>
+
+/*
+ * Ripped from /usr/scr/usr.bin/vmstat/vmstat.c (covering all bases) 
+ */
+#include <sys/param.h>
+#include <sys/time.h>
+#include <sys/proc.h>
+#include <sys/dkstat.h>
+#include <sys/buf.h>
+#include <sys/uio.h>
+#include <sys/namei.h>
+#include <sys/malloc.h>
+#include <sys/signal.h>
+#include <sys/fcntl.h>
+#include <sys/ioctl.h>
+#include <sys/sysctl.h>
+#include <sys/vmmeter.h>
+
+#include <vm/vm_param.h>
+#include <vm/vm_extern.h>
+
+#include <time.h>
+#include <nlist.h>
+#include <kvm.h>
+#include <errno.h>
+#include <unistd.h>
+#include <stdio.h>
+#include <ctype.h>
+#include <stdlib.h>
+#include <string.h>
+#include <paths.h>
+#include <limits.h>
+
+
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include <net-snmp/agent/auto_nlist.h>
+
+#include "util_funcs.h"
+#include "vmstat.h"
+
+/*
+ * CPU percentage 
+ */
+#define CPU_PRC         100
+#define BOOTTIME_SYMBOL	"boottime"
+
+FindVarMethod var_extensible_vmstat;
+
+void
+init_vmstat_bsdi4(void)
+{
+
+    struct variable2 extensible_vmstat_variables[] = {
+        {MIBINDEX, ASN_INTEGER, RONLY, var_extensible_vmstat, 1,
+         {MIBINDEX}},
+        {ERRORNAME, ASN_OCTET_STR, RONLY, var_extensible_vmstat, 1,
+         {ERRORNAME}},
+        {SWAPIN, ASN_INTEGER, RONLY, var_extensible_vmstat, 1, {SWAPIN}},
+        {SWAPOUT, ASN_INTEGER, RONLY, var_extensible_vmstat, 1, {SWAPOUT}},
+        {IOSENT, ASN_INTEGER, RONLY, var_extensible_vmstat, 1, {IOSENT}},
+        {IORECEIVE, ASN_INTEGER, RONLY, var_extensible_vmstat, 1,
+         {IORECEIVE}},
+        {SYSINTERRUPTS, ASN_INTEGER, RONLY, var_extensible_vmstat, 1,
+         {SYSINTERRUPTS}},
+        {SYSCONTEXT, ASN_INTEGER, RONLY, var_extensible_vmstat, 1,
+         {SYSCONTEXT}},
+        {CPUUSER, ASN_INTEGER, RONLY, var_extensible_vmstat, 1, {CPUUSER}},
+        {CPUSYSTEM, ASN_INTEGER, RONLY, var_extensible_vmstat, 1,
+         {CPUSYSTEM}},
+        {CPUIDLE, ASN_INTEGER, RONLY, var_extensible_vmstat, 1, {CPUIDLE}},
+        {CPURAWUSER, ASN_COUNTER, RONLY, var_extensible_vmstat, 1,
+         {CPURAWUSER}},
+        {CPURAWNICE, ASN_COUNTER, RONLY, var_extensible_vmstat, 1,
+         {CPURAWNICE}},
+        {CPURAWSYSTEM, ASN_COUNTER, RONLY, var_extensible_vmstat, 1,
+         {CPURAWSYSTEM}},
+        {CPURAWIDLE, ASN_COUNTER, RONLY, var_extensible_vmstat, 1,
+         {CPURAWIDLE}},
+        {CPURAWKERNEL, ASN_COUNTER, RONLY, var_extensible_vmstat, 1,
+         {CPURAWKERNEL}},
+        {CPURAWINTR, ASN_COUNTER, RONLY, var_extensible_vmstat, 1,
+         {CPURAWINTR}},
+        /*
+         * Future use: 
+         */
+        /*
+         * {ERRORFLAG, ASN_INTEGER, RONLY, var_extensible_vmstat, 1, {ERRORFLAG }},
+         * {ERRORMSG, ASN_OCTET_STR, RONLY, var_extensible_vmstat, 1, {ERRORMSG }}
+         */
+    };
+
+    /*
+     * Define the OID pointer to the top of the mib tree that we're
+     * registering underneath 
+     */
+    oid             vmstat_variables_oid[] = { UCDAVIS_MIB, 11 };
+
+    /*
+     * register ourselves with the agent to handle our mib tree 
+     */
+    REGISTER_MIB("ucd-snmp/vmstat", extensible_vmstat_variables, variable2,
+                 vmstat_variables_oid);
+
+}
+
+
+long
+getuptime(void)
+{
+    static time_t   now, boottime;
+    time_t          uptime;
+
+    if (boottime == 0)
+        auto_nlist(BOOTTIME_SYMBOL, (char *) &boottime, sizeof(boottime));
+
+    time(&now);
+    uptime = now - boottime;
+
+    return (uptime);
+}
+
+unsigned char  *
+var_extensible_vmstat(struct variable *vp,
+                      oid * name,
+                      size_t * length,
+                      int exact,
+                      size_t * var_len, WriteMethod ** write_method)
+{
+
+    int             loop;
+
+    time_t          time_new = getuptime();
+    static time_t   time_old;
+    static time_t   time_diff;
+
+    static long     cpu_old[CPUSTATES];
+    static long     cpu_new[CPUSTATES];
+    static long     cpu_diff[CPUSTATES];
+    static long     cpu_total;
+    long            cpu_sum;
+    double          cpu_prc;
+
+    static struct vmmeter mem_old, mem_new;
+    int             mem_mib[] = { CTL_VM, VM_CNT };
+    int             mem_size = sizeof(struct vmmeter);
+    int             cpu_mib[] = { CTL_KERN, KERN_CPUSTATS };
+    int             cpu_size = sizeof(struct cpustats);
+
+    static long     long_ret;
+    static char     errmsg[300];
+
+    long_ret = 0;               /* set to 0 as default */
+
+    if (header_generic(vp, name, length, exact, var_len, write_method))
+        return (NULL);
+
+    /*
+     * Update structures (only if time has passed) 
+     */
+    if (time_new != time_old) {
+        time_diff = time_new - time_old;
+        time_old = time_new;
+
+        /*
+         * CPU usage 
+         */
+        sysctl(cpu_mib, 2, &cpu_new, &cpu_size, NULL, 0);
+
+        cpu_total = 0;
+
+        for (loop = 0; loop < CPUSTATES; loop++) {
+            cpu_diff[loop] = cpu_new[loop] - cpu_old[loop];
+            cpu_old[loop] = cpu_new[loop];
+            cpu_total += cpu_diff[loop];
+        }
+
+        if (cpu_total == 0)
+            cpu_total = 1;
+
+        /*
+         * Memory info 
+         */
+        mem_old = mem_new;
+        sysctl(mem_mib, 2, &mem_new, &mem_size, NULL, 0);
+    }
+
+    /*
+     * Rate macro 
+     */
+#define rate(x) (((x)+ time_diff/2) / time_diff)
+
+    /*
+     * Page-to-kb macro 
+     */
+#define ptok(p) ((p) * (mem_new.v_page_size >> 10))
+
+    switch (vp->magic) {
+    case MIBINDEX:
+        long_ret = 1;
+        return ((u_char *) (&long_ret));
+    case ERRORNAME:            /* dummy name */
+        sprintf(errmsg, "systemStats");
+        *var_len = strlen(errmsg);
+        return ((u_char *) (errmsg));
+    case SWAPIN:
+        long_ret = ptok(mem_new.v_swpin - mem_old.v_swpin);
+        long_ret = rate(long_ret);
+        return ((u_char *) (&long_ret));
+    case SWAPOUT:
+        long_ret = ptok(mem_new.v_swpout - mem_old.v_swpout);
+        long_ret = rate(long_ret);
+        return ((u_char *) (&long_ret));
+    case IOSENT:
+#if NO_DUMMY_VALUES
+        return NULL;
+#endif
+        long_ret = -1;
+        return ((u_char *) (&long_ret));
+    case IORECEIVE:
+#if NO_DUMMY_VALUES
+        return NULL;
+#endif
+        long_ret = -1;
+        return ((u_char *) (&long_ret));
+    case SYSINTERRUPTS:
+        long_ret = rate(mem_new.v_intr - mem_old.v_intr);
+        return ((u_char *) (&long_ret));
+    case SYSCONTEXT:
+        long_ret = rate(mem_new.v_swtch - mem_old.v_swtch);
+        return ((u_char *) (&long_ret));
+    case CPUUSER:
+        cpu_sum = cpu_diff[CP_USER] + cpu_diff[CP_NICE];
+        cpu_prc = (float) cpu_sum / (float) cpu_total;
+        long_ret = cpu_prc * CPU_PRC;
+        return ((u_char *) (&long_ret));
+    case CPUSYSTEM:
+        cpu_sum = cpu_diff[CP_SYS] + cpu_diff[CP_INTR];
+        cpu_prc = (float) cpu_sum / (float) cpu_total;
+        long_ret = cpu_prc * CPU_PRC;
+        return ((u_char *) (&long_ret));
+    case CPUIDLE:
+        cpu_sum = cpu_diff[CP_IDLE];
+        cpu_prc = (float) cpu_sum / (float) cpu_total;
+        long_ret = cpu_prc * CPU_PRC;
+        return ((u_char *) (&long_ret));
+    case CPURAWUSER:
+        long_ret = cpu_new[CP_USER];
+        return ((u_char *) (&long_ret));
+    case CPURAWNICE:
+        long_ret = cpu_new[CP_NICE];
+        return ((u_char *) (&long_ret));
+    case CPURAWSYSTEM:
+        long_ret = cpu_new[CP_SYS] + cpu_new[CP_INTR];
+        return ((u_char *) (&long_ret));
+    case CPURAWIDLE:
+        long_ret = cpu_new[CP_IDLE];
+        return ((u_char *) (&long_ret));
+    case CPURAWKERNEL:
+        long_ret = cpu_new[CP_SYS];
+        return ((u_char *) (&long_ret));
+    case CPURAWINTR:
+        long_ret = cpu_new[CP_INTR];
+        return ((u_char *) (&long_ret));
+        /*
+         * reserved for future use 
+         */
+        /*
+         * case ERRORFLAG:
+         * return((u_char *) (&long_ret));
+         * case ERRORMSG:
+         * return((u_char *) (&long_ret));
+         */
+    }
+    return NULL;
+}
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/ucd-snmp/vmstat_bsdi4.h tomato121/release/src/router/snmp/agent/mibgroup/ucd-snmp/vmstat_bsdi4.h
--- tomato/release/src/router/snmp/agent/mibgroup/ucd-snmp/vmstat_bsdi4.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/ucd-snmp/vmstat_bsdi4.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,12 @@
+/*
+ *  vmstat mib groups
+ *
+ */
+#ifndef _MIBGROUP_VMSTAT_BSDI4_H
+#define _MIBGROUP_VMSTAT_BSDI4_H
+
+#include "mibdefs.h"
+
+void            init_vmstat_bsdi4(void);
+
+#endif                          /* _MIBGROUP_VMSTAT_BSDI4_H */
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/ucd-snmp/vmstat.c tomato121/release/src/router/snmp/agent/mibgroup/ucd-snmp/vmstat.c
--- tomato/release/src/router/snmp/agent/mibgroup/ucd-snmp/vmstat.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/ucd-snmp/vmstat.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,421 @@
+#include <net-snmp/net-snmp-config.h>
+
+#if HAVE_LIMITS_H
+#include <limits.h>
+#endif
+#if HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#if HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#if HAVE_FCNTL_H
+#include <fcntl.h>
+#endif
+#include <ctype.h>
+#include <signal.h>
+#if HAVE_MACHINE_PARAM_H
+#include <machine/param.h>
+#endif
+#if HAVE_SYS_VMMETER_H
+#if !defined(bsdi2) && !defined(netbsd1)
+#include <sys/vmmeter.h>
+#endif
+#endif
+#if HAVE_SYS_CONF_H
+#include <sys/conf.h>
+#endif
+#if HAVE_SYS_FS_H
+#include <sys/fs.h>
+#else
+#if HAVE_UFS_FS_H
+#include <ufs/fs.h>
+#else
+#ifdef HAVE_SYS_STAT_H
+#include <sys/stat.h>
+#endif
+#ifdef HAVE_SYS_VNODE_H
+#include <sys/vnode.h>
+#endif
+#ifdef HAVE_UFS_UFS_QUOTA_H
+#include <ufs/ufs/quota.h>
+#endif
+#ifdef HAVE_UFS_UFS_INODE_H
+#include <ufs/ufs/inode.h>
+#endif
+#if HAVE_UFS_FFS_FS_H
+#include <ufs/ffs/fs.h>
+#endif
+#endif
+#endif
+#if HAVE_MTAB_H
+#include <mtab.h>
+#endif
+#include <sys/stat.h>
+#include <errno.h>
+#if HAVE_FSTAB_H
+#include <fstab.h>
+#endif
+#if HAVE_SYS_STATVFS_H
+#include <sys/statvfs.h>
+#endif
+#if HAVE_SYS_VFS_H
+#include <sys/vfs.h>
+#endif
+#if (!defined(HAVE_STATVFS)) && defined(HAVE_STATFS)
+#if HAVE_SYS_PARAM_H
+#include <sys/param.h>
+#endif
+#if HAVE_SYS_MOUNT_H
+#include <sys/mount.h>
+#endif
+#if HAVE_SYS_SYSCTL_H
+#include <sys/sysctl.h>
+#endif
+#define statvfs statfs
+#endif
+#if HAVE_VM_SWAP_PAGER_H
+#include <vm/swap_pager.h>
+#endif
+#if HAVE_SYS_FIXPOINT_H
+#include <sys/fixpoint.h>
+#endif
+#if HAVE_MALLOC_H
+#include <malloc.h>
+#endif
+#if HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+#if TIME_WITH_SYS_TIME
+# include <sys/time.h>
+# include <time.h>
+#else
+# if HAVE_SYS_TIME_H
+#  include <sys/time.h>
+# else
+#  include <time.h>
+# endif
+#endif
+
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include <net-snmp/agent/auto_nlist.h>
+
+#include "mibdefs.h"
+#include "struct.h"
+#include "util_funcs.h"
+#include "vmstat.h"
+
+FindVarMethod var_extensible_vmstat;
+
+void
+init_vmstat(void)
+{
+    struct variable2 extensible_vmstat_variables[] = {
+        {MIBINDEX, ASN_INTEGER, RONLY, var_extensible_vmstat, 1,
+         {MIBINDEX}},
+        {ERRORNAME, ASN_OCTET_STR, RONLY, var_extensible_vmstat, 1,
+         {ERRORNAME}},
+        {SWAPIN, ASN_INTEGER, RONLY, var_extensible_vmstat, 1, {SWAPIN}},
+        {SWAPOUT, ASN_INTEGER, RONLY, var_extensible_vmstat, 1, {SWAPOUT}},
+        {IOSENT, ASN_INTEGER, RONLY, var_extensible_vmstat, 1, {IOSENT}},
+        {IORECEIVE, ASN_INTEGER, RONLY, var_extensible_vmstat, 1,
+         {IORECEIVE}},
+        {SYSINTERRUPTS, ASN_INTEGER, RONLY, var_extensible_vmstat, 1,
+         {SYSINTERRUPTS}},
+        {SYSCONTEXT, ASN_INTEGER, RONLY, var_extensible_vmstat, 1,
+         {SYSCONTEXT}},
+        {CPUUSER, ASN_INTEGER, RONLY, var_extensible_vmstat, 1, {CPUUSER}},
+        {CPUSYSTEM, ASN_INTEGER, RONLY, var_extensible_vmstat, 1,
+         {CPUSYSTEM}},
+        {CPUIDLE, ASN_INTEGER, RONLY, var_extensible_vmstat, 1, {CPUIDLE}},
+        {CPURAWUSER, ASN_COUNTER, RONLY, var_extensible_vmstat, 1,
+         {CPURAWUSER}},
+        {CPURAWNICE, ASN_COUNTER, RONLY, var_extensible_vmstat, 1,
+         {CPURAWNICE}},
+        {CPURAWSYSTEM, ASN_COUNTER, RONLY, var_extensible_vmstat, 1,
+         {CPURAWSYSTEM}},
+        {CPURAWIDLE, ASN_COUNTER, RONLY, var_extensible_vmstat, 1,
+         {CPURAWIDLE}},
+        {SYSRAWINTERRUPTS, ASN_COUNTER, RONLY, var_extensible_vmstat, 1,
+         {SYSRAWINTERRUPTS}},
+        {SYSRAWCONTEXT, ASN_COUNTER, RONLY, var_extensible_vmstat, 1,
+         {SYSRAWCONTEXT}},
+        /*
+         * Future use: 
+         */
+        /*
+         * {ERRORFLAG, ASN_INTEGER, RONLY, var_extensible_vmstat, 1, {ERRORFLAG }},
+         * {ERRORMSG, ASN_OCTET_STR, RONLY, var_extensible_vmstat, 1, {ERRORMSG }}
+         */
+    };
+
+    /*
+     * Define the OID pointer to the top of the mib tree that we're
+     * registering underneath 
+     */
+    oid             vmstat_variables_oid[] = { UCDAVIS_MIB, 11 };
+
+    /*
+     * register ourselves with the agent to handle our mib tree 
+     */
+    REGISTER_MIB("ucd-snmp/vmstat", extensible_vmstat_variables, variable2,
+                 vmstat_variables_oid);
+
+}
+
+
+
+#define VMSTAT_FILE "/proc/stat"
+
+void
+getstat(unsigned long *cuse, unsigned long *cice, unsigned long *csys,
+        unsigned long *cide, unsigned long *pin, unsigned long *pout,
+        unsigned long *swpin, unsigned long *swpout, unsigned long *itot,
+	unsigned long *i1, unsigned long *ct)
+{
+    int             statfd;
+    int             first = 1;
+    static char    *buff = NULL;
+    static int      bsize = 0;
+
+    if ((statfd = open(VMSTAT_FILE, O_RDONLY, 0)) != -1) {
+        char           *b;
+        if (bsize == 0) {
+            bsize = 128;
+            buff = malloc(bsize);
+        }
+        while (read(statfd, buff, bsize) == bsize) {
+            bsize += 256;
+            buff = realloc(buff, bsize);
+            DEBUGMSGTL(("vmstat", "/proc/stat buffer increased to %d\n", bsize));
+            close(statfd);
+            statfd = open(VMSTAT_FILE, O_RDONLY, 0);
+        }
+        close(statfd);
+        *itot = 0;
+        *i1 = 1;                /* ensure assert below will fail if the sscanf bombs */
+        b = strstr(buff, "cpu ");
+        if (b)
+            sscanf(b, "cpu  %lu %lu %lu %lu", cuse, cice, csys, cide);
+        else {
+            if (first)
+                snmp_log(LOG_ERR, "No cpu line in /proc/stat\n");
+            *cuse = *cice = *csys = *cide = 0;
+        }
+        b = strstr(buff, "page ");
+        if (b)
+            sscanf(b, "page %lu %lu", pin, pout);
+        else {
+            if (first)
+                snmp_log(LOG_ERR, "No page line in /proc/stat\n");
+            *pin = *pout = 0;
+        }
+        b = strstr(buff, "swap ");
+        if (b)
+            sscanf(b, "swap %lu %lu", swpin, swpout);
+        else {
+            if (first)
+                snmp_log(LOG_ERR, "No swap line in /proc/stat\n");
+            *swpin = *swpout = 0;
+        }
+        b = strstr(buff, "intr ");
+        if (b)
+            sscanf(b, "intr %lu %lu", itot, i1);
+        else {
+            if (first)
+                snmp_log(LOG_ERR, "No intr line in /proc/stat\n");
+            *itot = 0;
+        }
+        b = strstr(buff, "ctxt ");
+        if (b)
+            sscanf(b, "ctxt %lu", ct);
+        else {
+            if (first)
+                snmp_log(LOG_ERR, "No ctxt line in /proc/stat\n");
+            *ct = 0;
+        }
+        first = 0;
+    } else {
+        snmp_log_perror(VMSTAT_FILE);
+    }
+}
+
+enum vmstat_index { swapin = 0, swapout,
+    iosent, ioreceive,
+    sysinterrupts, syscontext,
+    cpuuser, cpusystem, cpuidle,
+    cpurawuser, cpurawnice,
+    cpurawsystem, cpurawidle,
+    sysrawinterrupts, sysrawcontext
+};
+
+unsigned
+vmstat(int iindex)
+{
+    unsigned long   cpu_use, cpu_nic, cpu_sys, cpu_idl;
+    double          duse, dsys, didl, ddiv, divo2;
+    unsigned long   pgpgin, pgpgout, pswpin, pswpout;
+    unsigned long   inter, ticks, ctxt;
+    unsigned int    hz;
+
+    getstat(&cpu_use, &cpu_nic, &cpu_sys, &cpu_idl,
+            &pgpgin, &pgpgout, &pswpin, &pswpout, &inter, &ticks, &ctxt);
+    duse = cpu_use + cpu_nic;
+    dsys = cpu_sys;
+    didl = cpu_idl;
+    ddiv = (duse + dsys + didl);
+    hz = sysconf(_SC_CLK_TCK);  /* get ticks/s from system */
+    divo2 = ddiv / 2;
+
+    switch (iindex) {
+    case swapin:
+        return (pswpin * 4 * hz + divo2) / ddiv;
+    case swapout:
+        return (pswpout * 4 * hz + divo2) / ddiv;
+    case iosent:
+        return (pgpgin * hz + divo2) / ddiv;
+    case ioreceive:
+        return (pgpgout * hz + divo2) / ddiv;
+    case sysinterrupts:
+        return (inter * hz + divo2) / ddiv;
+    case syscontext:
+        return (ctxt * hz + divo2) / ddiv;
+    case cpuuser:
+        return (100 * duse / ddiv);
+    case cpusystem:
+        return (100 * dsys / ddiv);
+    case cpuidle:
+        return (100 * didl / ddiv);
+    case cpurawuser:
+        return cpu_use;
+    case cpurawnice:
+        return cpu_nic;
+    case cpurawsystem:
+        return cpu_sys;
+    case cpurawidle:
+        return cpu_idl;
+    case sysrawinterrupts:
+        return inter;
+    case sysrawcontext:
+        return ctxt;
+    default:
+        return -1;
+    }
+}
+
+unsigned char  *
+var_extensible_vmstat(struct variable *vp,
+                      oid * name,
+                      size_t * length,
+                      int exact,
+                      size_t * var_len, WriteMethod ** write_method)
+{
+
+    static long     long_ret;
+    static char     errmsg[300];
+#ifndef linux
+    struct vmtotal  total;
+#endif
+
+    long_ret = 0;               /* set to 0 as default */
+
+    if (header_generic(vp, name, length, exact, var_len, write_method))
+        return (NULL);
+    switch (vp->magic) {
+    case MIBINDEX:
+        long_ret = 1;
+        return ((u_char *) (&long_ret));
+    case ERRORNAME:            /* dummy name */
+        sprintf(errmsg, "systemStats");
+        *var_len = strlen(errmsg);
+        return ((u_char *) (errmsg));
+    case SWAPIN:
+#ifdef linux
+        long_ret = vmstat(swapin);
+#endif
+        return ((u_char *) (&long_ret));
+    case SWAPOUT:
+#ifdef linux
+        long_ret = vmstat(swapout);
+#endif
+        return ((u_char *) (&long_ret));
+    case IOSENT:
+#ifdef linux
+        long_ret = vmstat(iosent);
+#endif
+        return ((u_char *) (&long_ret));
+    case IORECEIVE:
+#ifdef linux
+        long_ret = vmstat(ioreceive);
+#endif
+        return ((u_char *) (&long_ret));
+    case SYSINTERRUPTS:
+#ifdef linux
+        long_ret = vmstat(sysinterrupts);
+#endif
+        return ((u_char *) (&long_ret));
+    case SYSCONTEXT:
+#ifdef linux
+        long_ret = vmstat(syscontext);
+#endif
+        return ((u_char *) (&long_ret));
+    case CPUUSER:
+#ifdef linux
+        long_ret = vmstat(cpuuser);
+#endif
+        return ((u_char *) (&long_ret));
+    case CPUSYSTEM:
+#ifdef linux
+        long_ret = vmstat(cpusystem);
+#endif
+        return ((u_char *) (&long_ret));
+    case CPUIDLE:
+#ifdef linux
+        long_ret = vmstat(cpuidle);
+#endif
+        return ((u_char *) (&long_ret));
+    case CPURAWUSER:
+#ifdef linux
+        long_ret = vmstat(cpurawuser);
+#endif
+        return ((u_char *) (&long_ret));
+    case CPURAWNICE:
+#ifdef linux
+        long_ret = vmstat(cpurawnice);
+#endif
+        return ((u_char *) (&long_ret));
+    case CPURAWSYSTEM:
+#ifdef linux
+        long_ret = vmstat(cpurawsystem);
+#endif
+        return ((u_char *) (&long_ret));
+    case CPURAWIDLE:
+#ifdef linux
+        long_ret = vmstat(cpurawidle);
+#endif
+        return ((u_char *) (&long_ret));
+    case SYSRAWINTERRUPTS:
+#ifdef linux
+        long_ret = vmstat(sysrawinterrupts);
+#endif
+        return ((u_char *) (&long_ret));
+    case SYSRAWCONTEXT:
+#ifdef linux
+        long_ret = vmstat(sysrawcontext);
+#endif
+        return ((u_char *) (&long_ret));
+        /*
+         * reserved for future use 
+         */
+        /*
+         * case ERRORFLAG:
+         * return((u_char *) (&long_ret));
+         * case ERRORMSG:
+         * return((u_char *) (&long_ret));
+         */
+    }
+    return NULL;
+}
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/ucd-snmp/vmstat_dynix.c tomato121/release/src/router/snmp/agent/mibgroup/ucd-snmp/vmstat_dynix.c
--- tomato/release/src/router/snmp/agent/mibgroup/ucd-snmp/vmstat_dynix.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/ucd-snmp/vmstat_dynix.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,790 @@
+/*
+ *  vmstat_dynix.c
+ *  UCD SNMP module for systemStats section of UCD-SNMP-MIB for Dynix
+ *  Patrick Hess <phess@phess.best.vwh.net>
+ *
+ *  This is just a port of the vmstat_solaris2 code Version 0.7
+ *
+ */
+
+/*
+ * To make lint skip the debug code and stop complaining 
+ */
+#ifdef __lint
+#define SNMP_NO_DEBUGGING 1
+#endif
+
+#define __NO_ASM_MACRO 1
+
+/*
+ * Includes start here 
+ */
+#include <net-snmp/net-snmp-config.h>
+
+/*
+ * Standard includes 
+ */
+#include <sys/tmp_ctl.h>
+#include <sys/sysperf.h>
+#include <sys/vmmeter.h>
+#include <unistd.h>
+#include <string.h>
+
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+#include "mibdefs.h"
+#include "util_funcs.h"
+
+/*
+ * Header file for this module 
+ */
+#include "vmstat.h"
+#include "vmstat_dynix.h"
+
+/*
+ * Includes end here 
+ */
+
+
+/*
+ * Global structures start here 
+ */
+
+/*
+ * A structure to save data gathered from the kernel kstat interface to.  
+ */
+/*
+ * We used to have the sys/sysinfo.h cpu_stat_t here but we did not need 
+ */
+/*
+ * all of it, some in a different size and some additional ones so we build 
+ */
+/*
+ * our own 
+ */
+struct cpu_stat_snapshot {
+    time_t          css_time;
+    unsigned int    css_cpus;
+    unsigned long long css_swapin;
+    unsigned long long css_swapout;
+    unsigned long long css_blocks_read;
+    unsigned long long css_blocks_write;
+    unsigned long long css_interrupts;
+    unsigned long long css_context_sw;
+    unsigned long long css_cpu[V_CPU_STATES];
+};
+
+/*
+ * Global structures end here 
+ */
+
+
+/*
+ * Global variables start here 
+ */
+
+/*
+ * Variables for the calculated values, filled in update_stats    
+ */
+/*
+ * Need to be global since we need them in more than one function 
+ */
+static ulong    swapin;
+static ulong    swapout;
+static ulong    blocks_read;
+static ulong    blocks_write;
+static ulong    interrupts;
+static ulong    context_sw;
+
+/*
+ * Since MIB wants V_CPU_SYSTEM, which is V_CPU_KERNEL + V_CPU_STREAM 
+ */
+static long     cpu_perc[V_CPU_STATES + 1];
+
+/*
+ * How many snapshots we have already taken, needed for the first 
+ */
+/*
+ * POLL_INTERVAL * POLL_VALUES seconds of agent running 
+ */
+static unsigned int number_of_snapshots;
+
+/*
+ * The place to store the snapshots of system data in 
+ */
+static struct cpu_stat_snapshot snapshot[POLL_VALUES + 1];
+
+/*
+ * And one for the raw counters, which we fill when the raw values are 
+ */
+/*
+ * requested, as opposed to the absolute values, which are taken every 
+ */
+/*
+ * POLL_INTERVAL seconds and calculated over POLL_INTERVAL * POLL_VALUES time 
+ */
+static struct cpu_stat_snapshot raw_values;
+
+/*
+ * Global variables end here 
+ */
+
+
+/*
+ * Functions start here 
+ */
+
+/*
+ * Function prototype 
+ */
+static void     update_stats(unsigned int registrationNumber,
+                             void *clientarg);
+static int      take_snapshot(struct cpu_stat_snapshot *css);
+
+/*
+ * init_vmstat_dynix starts here 
+ */
+/*
+ * Init function for this module, from prototype 
+ */
+/*
+ * Defines variables handled by this module, defines root OID for 
+ */
+/*
+ * this module and registers it with the agent 
+ */
+
+FindVarMethod var_extensible_vmstat;
+
+void
+init_vmstat_dynix(void)
+{
+
+    /*
+     * Which variables do we service ? 
+     */
+    struct variable2 extensible_vmstat_variables[] = {
+        {MIBINDEX, ASN_INTEGER, RONLY, var_extensible_vmstat, 1,
+         {MIBINDEX}},
+        {ERRORNAME, ASN_OCTET_STR, RONLY, var_extensible_vmstat, 1,
+         {ERRORNAME}},
+        {SWAPIN, ASN_INTEGER, RONLY, var_extensible_vmstat, 1, {SWAPIN}},
+        {SWAPOUT, ASN_INTEGER, RONLY, var_extensible_vmstat, 1, {SWAPOUT}},
+        {IOSENT, ASN_INTEGER, RONLY, var_extensible_vmstat, 1, {IOSENT}},
+        {IORECEIVE, ASN_INTEGER, RONLY, var_extensible_vmstat, 1,
+         {IORECEIVE}},
+        {SYSINTERRUPTS, ASN_INTEGER, RONLY, var_extensible_vmstat, 1,
+         {SYSINTERRUPTS}},
+        {SYSCONTEXT, ASN_INTEGER, RONLY, var_extensible_vmstat, 1,
+         {SYSCONTEXT}},
+        {CPUUSER, ASN_INTEGER, RONLY, var_extensible_vmstat, 1, {CPUUSER}},
+        {CPUSYSTEM, ASN_INTEGER, RONLY, var_extensible_vmstat, 1,
+         {CPUSYSTEM}},
+        {CPUIDLE, ASN_INTEGER, RONLY, var_extensible_vmstat, 1, {CPUIDLE}},
+        {CPURAWUSER, ASN_COUNTER, RONLY, var_extensible_vmstat, 1,
+         {CPURAWUSER}},
+        {CPURAWSYSTEM, ASN_COUNTER, RONLY, var_extensible_vmstat, 1,
+         {CPURAWSYSTEM}},
+        {CPURAWIDLE, ASN_COUNTER, RONLY, var_extensible_vmstat, 1,
+         {CPURAWIDLE}},
+        {CPURAWWAIT, ASN_COUNTER, RONLY, var_extensible_vmstat, 1,
+         {CPURAWWAIT}},
+        {CPURAWKERNEL, ASN_COUNTER, RONLY, var_extensible_vmstat, 1,
+         {CPURAWKERNEL}},
+        {IORAWSENT, ASN_COUNTER, RONLY, var_extensible_vmstat, 1,
+         {IORAWSENT}},
+        {IORAWRECEIVE, ASN_COUNTER, RONLY, var_extensible_vmstat, 1,
+         {IORAWRECEIVE}},
+        /*
+         * Future use: 
+         */
+        /*
+         * {ERRORFLAG, ASN_INTEGER, RONLY, var_extensible_vmstat, 1, {ERRORFLAG }},
+         * {ERRORMSG, ASN_OCTET_STR, RONLY, var_extensible_vmstat, 1, {ERRORMSG }}
+         */
+    };
+
+    /*
+     * Define the OID pointer to the top of the mib tree that we're 
+     */
+    /*
+     * registering underneath 
+     */
+    oid             vmstat_variables_oid[] = { UCDAVIS_MIB, 11 };
+
+    /*
+     * register ourselves with the agent to handle our mib tree 
+     */
+    /*
+     * LINTED Trust me, I know what I'm doing 
+     */
+    REGISTER_MIB("ucd-snmp/vmstat", extensible_vmstat_variables, variable2,
+                 vmstat_variables_oid);
+
+    /*
+     * Start with some useful data 
+     */
+    update_stats(0, NULL);
+
+    /*
+     * update_stats is run every POLL_INTERVAL seconds using this routine 
+     */
+    /*
+     * (see 'man snmp_alarm') 
+     */
+    /*
+     * This is only executed once to get some useful data in the beginning 
+     */
+    if (snmp_alarm_register(5, NULL, update_stats, NULL) == 0) {
+        snmp_log(LOG_WARNING,
+                 "vmstat_dynix (init): snmp_alarm_register failed.\n");
+    }
+    /*
+     * This is the one that runs update_stats every POLL_INTERVAL seconds 
+     */
+    if (snmp_alarm_register(POLL_INTERVAL, SA_REPEAT, update_stats, NULL)
+        == 0) {
+        snmp_log(LOG_ERR,
+                 "vmstat_dynix (init): snmp_alarm_register failed, cannot service requests.\n");
+    }
+
+}                               /* init_vmstat_dynix ends here */
+
+/*
+ * Data collection function take_snapshot starts here 
+ */
+/*
+ * Get data from kernel and save into the snapshot strutcs 
+ */
+/*
+ * Argument is the snapshot struct to save to. Global anyway, but looks nicer 
+ */
+static int
+take_snapshot(struct cpu_stat_snapshot *css)
+{
+    /*
+     * Variables start here 
+     */
+
+    /*
+     * Counters 
+     */
+    unsigned int    cpu_num = 0;
+
+    /*
+     * Low resolution time counter 
+     */
+    time_t          current_time;
+
+    /*
+     * see sys/sysperf.h, holds CPU data 
+     */
+    exp_vmmeter_t  *cs, *origcs = 0;
+
+    /*
+     * size of the cs struct 
+     */
+    size_t          vminfo_size;
+
+    /*
+     * The usual stuff to count on, err, by 
+     */
+    int             i;
+    int             engnum = 0;
+
+    /*
+     * Variables end here 
+     */
+
+    /*
+     * Function starts here 
+     */
+
+    /*
+     * Get time 
+     */
+    current_time = time(0);
+
+    /*
+     * If we have just gotten the data, return the values from last run (skip if-clause) 
+     */
+    /*
+     * This happens on a snmpwalk request. 
+     */
+    /*
+     * if we just did it less than 2 seconds ago 
+     */
+    /*
+     * Jumps into if-clause either when snapshot is empty or when too old 
+     */
+
+    if ((css->css_time == 0) || (current_time > css->css_time + 2)) {
+        /*
+         * Make sure we clean up before we put new data into snapshot 
+         */
+        memset(css, 0, sizeof *css);
+
+        /*
+         * Get the number of CPUs we gather data from 
+         */
+        if ((cpu_num = tmp_ctl(TMP_NENG, 0)) < 0) {
+            snmp_log(LOG_ERR,
+                     "vmstat_dynix: (take snapshot) bad tmp_ctl return\n");
+            return (-1);
+        }
+        css->css_cpus = cpu_num;
+
+        vminfo_size = cpu_num * sizeof(exp_vmmeter_t);
+
+        if (!(cs = (exp_vmmeter_t *) malloc(vminfo_size))) {
+            snmp_log(LOG_ERR,
+                     "vmstat_dynix: (take_snapshot) bad malloc return\n");
+            return (-1);
+        }
+        origcs = cs;
+
+        /*
+         * Update timer 
+         */
+        css->css_time = current_time;
+
+        /*
+         * Read data from kernel into cs structure 
+         */
+        /*
+         * cs is the buffer we are writing to and 
+         */
+        /*
+         * vminfo_size is the size of the cs struct 
+         */
+        if ((getkerndata(VMMETER_DATAID, cs, vminfo_size)) < 0) {
+            snmp_log(LOG_ERR,
+                     "vmstat_dynix (take_snapshot): getkerndata failure.");
+            return (-1);
+        }
+
+        /*
+         * Get the data from each CPU 
+         */
+        /*
+         * We walk through the whole vmmeter struct and sum up all the found stats, 
+         */
+        /*
+         * there's one for every CPU in a machine 
+         */
+        /*
+         * Okay...  you can't laugh at this!  I'm a C-hack, not a C-coder. :)  
+         */
+        while (engnum < cpu_num) {
+
+            /*
+             * Get the data from the cs structure and sum it up in our own structure 
+             */
+            css->css_swapin += (unsigned long long) cs->v_swpin;
+            css->css_swapout += (unsigned long long) cs->v_swpout;
+            css->css_blocks_read += (unsigned long long) cs->v_phread;
+            css->css_blocks_write += (unsigned long long) cs->v_phwrite;
+            css->css_interrupts += (unsigned long long) cs->v_intr;
+            css->css_context_sw += (unsigned long long) cs->v_swtch;
+
+            /*
+             * We need a for-loop for the CPU STATE values 
+             */
+            for (i = 0; i < V_CPU_STATES; i++) {
+                css->css_cpu[i] += (unsigned long long) cs->v_time[i];
+            }                   /* end for */
+
+            cs++;
+            engnum++;
+        }                       /* end while */
+    }
+
+    free((void *) origcs);
+
+    /*
+     * All engines running at warp speed, no problems (if there are any engines, that is) 
+     */
+    return (cpu_num > 0 ? 0 : -1);
+}                               /* take_snapshot ends here */
+
+/*
+ * This gets called every POLL_INTERVAL seconds to update the snapshots.  It takes a new snapshot and 
+ */
+/*
+ * drops the oldest one.  This way we move the time window so we always take the values over 
+ */
+/*
+ * POLL_INTERVAL * POLL_VALUES seconds and update the data used every POLL_INTERVAL seconds 
+ */
+/*
+ * The alarm timer is in the init function of this module (snmp_alarm_register) 
+ */
+/*
+ * ARGSUSED0 
+ */
+static void
+update_stats(unsigned int registrationNumber, void *clientarg)
+{
+    /*
+     * The time between the samples we compare 
+     */
+    time_t          time_diff;
+
+    /*
+     * Easier to use these than the snapshots, short hand pointers 
+     */
+    struct cpu_stat_snapshot *css_old, *css_new;
+
+    /*
+     * The usual stuff to count on, err, by 
+     */
+    int             i;
+
+    /*
+     * The sum of the CPU ticks that have passed on the different CPU states, so we can calculate 
+     */
+    /*
+     * the percentages of each state 
+     */
+    unsigned long long cpu_sum = 0;
+
+    DEBUGMSGTL(("ucd-snmp/vmstat_dynix.c:update_stats",
+                "updating stats\n"));
+
+    /*
+     * Take the current snapshot 
+     */
+    if (take_snapshot(&snapshot[0]) == -1) {
+        snmp_log(LOG_WARNING,
+                 "vmstat_dynix (update_stats): Something went wrong with take_snapshot.");
+        return;
+    }
+
+    /*
+     * Do we have some data we can use ?  An issue right after the start of the agent 
+     */
+    if (number_of_snapshots > 0) {
+        /*
+         * Huh, the number of CPUs changed during run time.  That is indeed s.th. worth noting, we 
+         */
+        /*
+         * output a humorous (more or less) syslog message and need to retake the snapshots 
+         */
+        if (snapshot[0].css_cpus != snapshot[1].css_cpus) {
+            if (snapshot[0].css_cpus > snapshot[1].css_cpus) {
+                snmp_log(LOG_NOTICE,
+                         "vmstat_dynix (update_stats): Cool ! Number of CPUs increased, must be hot-pluggable.");
+            } else {
+                snmp_log(LOG_NOTICE,
+                         "vmstat_dynix (update_stats): Lost at least one CPU, RIP.");
+            }
+            /*
+             * Make all snapshots but the current one invalid 
+             */
+            number_of_snapshots = 1;
+            /*
+             * Move the current one in the "first" [1] slot 
+             */
+            memmove(&snapshot[1], &snapshot[0], sizeof snapshot[0]);
+            /*
+             * Erase the current one 
+             */
+            memset(&snapshot[0], 0, sizeof snapshot[0]);
+            /*
+             * Try to get a new snapshot in five seconds so we can return s.th. useful 
+             */
+            if (snmp_alarm_register(5, NULL, update_stats, NULL) == 0) {
+                snmp_log(LOG_WARNING,
+                         "vmstat_dynix (update_stats): snmp_alarm_register failed.\n");
+            }
+            return;
+        }
+
+        /*
+         * Short hand pointers 
+         */
+        css_new = &snapshot[0];
+        css_old = &snapshot[number_of_snapshots];
+
+        /*
+         * How much time has passed between the snapshots we get the values from ? 
+         */
+        /*
+         * Time is in seconds 
+         */
+        time_diff =
+            snapshot[0].css_time - snapshot[number_of_snapshots].css_time;
+
+        if (time_diff == 0)
+            DEBUGMSGTL(("ucd-snmp/vmstat_dynix.c:update_stats",
+                        "time_diff is ZERO...  watch for the segfault\n"));
+
+        DEBUGMSGTL(("ucd-snmp/vmstat_dynix.c:update_stats",
+                    "time_diff: %lld\n", time_diff));
+
+        /*
+         * swapin and swapout are in pages, MIB wants kB/s,so we just need to get kB and seconds 
+         */
+        /*
+         * For the others we need to get value per second 
+         */
+        /*
+         * decided to use sysconf(_SC_PAGESIZE) instead to get around an #ifndef (I don't like those) 
+         */
+        /*
+         * LINTED cast needed, really 
+         */
+        swapin =
+            (uint_t) ((css_new->css_swapin -
+                       css_old->css_swapin) * (time_t) 1000 *
+                      sysconf(_SC_PAGESIZE) / 1024 / time_diff);
+        /*
+         * LINTED cast needed, really 
+         */
+        swapout =
+            (uint_t) ((css_new->css_swapout -
+                       css_old->css_swapout) * (time_t) 1000 *
+                      sysconf(_SC_PAGESIZE) / 1024 / time_diff);
+        /*
+         * LINTED cast needed, really 
+         */
+        blocks_read =
+            (uint_t) ((css_new->css_blocks_read -
+                       css_old->css_blocks_read) * (time_t) 1000 /
+                      time_diff);
+        /*
+         * LINTED cast needed, really 
+         */
+        blocks_write =
+            (uint_t) ((css_new->css_blocks_write -
+                       css_old->css_blocks_write) * (time_t) 1000 /
+                      time_diff);
+        /*
+         * LINTED cast needed, really 
+         */
+        interrupts =
+            (uint_t) ((css_new->css_interrupts -
+                       css_old->css_interrupts) * (time_t) 1000 /
+                      time_diff);
+        /*
+         * LINTED cast needed, really 
+         */
+        context_sw =
+            (uint_t) ((css_new->css_context_sw -
+                       css_old->css_context_sw) * (time_t) 1000 /
+                      time_diff);
+
+        /*
+         * Loop thru all the V_CPU_STATES and get the differences 
+         */
+        for (i = 0; i < V_CPU_STATES; i++) {
+            cpu_sum += (css_new->css_cpu[i] - css_old->css_cpu[i]);
+        }
+
+        /*
+         * Now calculate the absolute percentage values 
+         */
+        /*
+         * Looks somewhat complicated sometimes but tries to get around using floats to increase speed 
+         */
+        for (i = 0; i < V_CPU_STATES; i++) {
+            /*
+             * Since we don't return fractions we use + 0.5 to get between 99 and 101 percent adding the values 
+             */
+            /*
+             * together, otherwise we would get less than 100 most of the time 
+             */
+            /*
+             * LINTED has to be 'long' 
+             */
+            cpu_perc[i] =
+                (long) (((css_new->css_cpu[i] -
+                          css_old->css_cpu[i]) * 100 +
+                         (cpu_sum / 2)) / cpu_sum);
+        }
+
+        /*
+         * As said before, MIB wants V_CPU_SYSTEM which is V_CPU_KERNEL + V_CPU_STREAM 
+         */
+        /*
+         * LINTED has to be 'long' 
+         */
+        cpu_perc[V_CPU_SYSTEM] =
+            (long) ((((css_new->css_cpu[V_CPU_KERNEL] -
+                       css_old->css_cpu[V_CPU_KERNEL])
+                      + (css_new->css_cpu[V_CPU_STREAM] -
+                         css_old->css_cpu[V_CPU_STREAM]))
+                     * 100 + (cpu_sum / 2)) / cpu_sum);
+    }
+
+    /*
+     * Make the current one the first one and move the whole thing one place down 
+     */
+    memmove(&snapshot[1], &snapshot[0],
+            (size_t) (((char *) &snapshot[POLL_VALUES]) -
+                      ((char *) &snapshot[0])));
+
+    /*
+     * Erase the current one 
+     */
+    memset(&snapshot[0], 0, sizeof snapshot[0]);
+
+    /*
+     * Only important on start up, we keep track of how many snapshots we have taken so far 
+     */
+    if (number_of_snapshots < POLL_VALUES) {
+        number_of_snapshots++;
+    }
+}                               /* update_stats ends here */
+
+/*
+ * *var_extensible_vmstat starts here 
+ */
+/*
+ * The guts of the module, this routine gets called to service a request 
+ */
+unsigned char *
+var_extensible_vmstat(struct variable *vp,
+                      oid * name,
+                      size_t * length,
+                      int exact,
+                      size_t * var_len, WriteMethod ** write_method)
+{
+    /*
+     * Needed for returning the values 
+     */
+    static long     long_ret;
+    static char     errmsg[300];
+
+    /*
+     * set to 0 as default 
+     */
+    long_ret = 0;
+
+    /*
+     * generic check whether the options passed make sense and whether the 
+     */
+    /*
+     * right variable is requested 
+     */
+    if (header_generic(vp, name, length, exact, var_len, write_method) !=
+        MATCH_SUCCEEDED) {
+        return (NULL);
+    }
+
+    /*
+     * The function that actually returns s.th. 
+     */
+    switch (vp->magic) {
+    case MIBINDEX:
+        long_ret = 1;
+        return ((u_char *) (&long_ret));
+    case ERRORNAME:            /* dummy name */
+        sprintf(errmsg, "systemStats");
+        *var_len = strlen(errmsg);
+        return ((u_char *) (errmsg));
+    case SWAPIN:
+        return ((u_char *) (&swapin));
+    case SWAPOUT:
+        return ((u_char *) (&swapout));
+    case IOSENT:
+        return ((u_char *) (&blocks_write));
+    case IORECEIVE:
+        return ((u_char *) (&blocks_read));
+    case SYSINTERRUPTS:
+        return ((u_char *) (&interrupts));
+    case SYSCONTEXT:
+        return ((u_char *) (&context_sw));
+    case CPUUSER:
+        return ((u_char *) (&cpu_perc[V_CPU_USER]));
+    case CPUSYSTEM:
+        return ((u_char *) (&cpu_perc[V_CPU_SYSTEM]));
+    case CPUIDLE:
+        return ((u_char *) (&cpu_perc[V_CPU_IDLE]));
+    case CPURAWUSER:
+        take_snapshot(&raw_values);
+        /*
+         * LINTED has to be 'long' 
+         */
+        long_ret =
+            (long) (raw_values.css_cpu[V_CPU_USER] / raw_values.css_cpus);
+        return ((u_char *) (&long_ret));
+        /*
+         * We are missing CPURAWNICE, Dynix does not account for this in the kernel so this OID can not 
+         */
+        /*
+         * be returned.  Also, these values will roll over sooner or later and then return inaccurate data 
+         */
+        /*
+         * but the MIB wants Integer32 so we cannot put a counter here 
+         */
+        /*
+         * (Has been changed to Counter32 in the latest MIB version!) 
+         */
+    case CPURAWSYSTEM:
+        take_snapshot(&raw_values);
+        /*
+         * LINTED has to be 'long' 
+         */
+        long_ret =
+            (long) ((raw_values.css_cpu[V_CPU_KERNEL] +
+                     raw_values.css_cpu[V_CPU_STREAM]) /
+                    raw_values.css_cpus);
+        return ((u_char *) (&long_ret));
+    case CPURAWIDLE:
+        take_snapshot(&raw_values);
+        /*
+         * LINTED has to be 'long' 
+         */
+        long_ret =
+            (long) (raw_values.css_cpu[V_CPU_IDLE] / raw_values.css_cpus);
+        return ((u_char *) (&long_ret));
+    case CPURAWWAIT:
+        take_snapshot(&raw_values);
+        /*
+         * LINTED has to be 'long' 
+         */
+        long_ret =
+            (long) (raw_values.css_cpu[V_CPU_STREAM] /
+                    raw_values.css_cpus);
+        return ((u_char *) (&long_ret));
+    case CPURAWKERNEL:
+        take_snapshot(&raw_values);
+        /*
+         * LINTED has to be 'long' 
+         */
+        long_ret =
+            (long) (raw_values.css_cpu[V_CPU_KERNEL] /
+                    raw_values.css_cpus);
+        return ((u_char *) (&long_ret));
+    case IORAWSENT:
+        long_ret = (long) (raw_values.css_blocks_write);
+        return ((u_char *) (&long_ret));
+    case IORAWRECEIVE:
+        long_ret = (long) (raw_values.css_blocks_read);
+        return ((u_char *) (&long_ret));
+
+        /*
+         * reserved for future use 
+         */
+        /*
+         * case ERRORFLAG:
+         * return((u_char *) (&long_ret));
+         * case ERRORMSG:
+         * return((u_char *) (&long_ret));
+         */
+    default:
+        snmp_log(LOG_ERR,
+                 "vmstat_dynix: Error in request, no match found.\n");
+    }
+    return (NULL);
+}                               /* *var_extensible_vmstat ends here */
+
+/*
+ * Functions end here 
+ */
+
+/*
+ * Program ends here 
+ */
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/ucd-snmp/vmstat_dynix.h tomato121/release/src/router/snmp/agent/mibgroup/ucd-snmp/vmstat_dynix.h
--- tomato/release/src/router/snmp/agent/mibgroup/ucd-snmp/vmstat_dynix.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/ucd-snmp/vmstat_dynix.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,51 @@
+/*
+ *  vmstat_dynix.h
+ *  Header file for vmstat_dynix module for UCD-SNMP
+ *  Patrick Hess <phess@phess.best.vwh.net>
+ *
+ */
+
+/*
+ * Prevent accidental double inclusions 
+ */
+#ifndef _MIBGROUP_VMSTAT_DYNIX_H
+#define _MIBGROUP_VMSTAT_DYNIX_H
+
+/*
+ * Directive to include utility module 
+ */
+config_require(util_funcs)
+
+    /*
+     * MIB wants V_CPU_SYSTEM which is sysinfo V_CPU_KERNEL + V_CPU_WAIT 
+     */
+#define V_CPU_SYSTEM 4
+    /*
+     * Time interval to gather system data 
+     */
+    /*
+     * Lower value -> more accurate data, higher value -> less CPU usage 
+     */
+    /*
+     * Value is in seconds 
+     */
+#define POLL_INTERVAL 60
+    /*
+     * How many snapshots of system data to keep.  Values returned are over 
+     */
+    /*
+     * time difference between first and last snapshot 
+     */
+    /*
+     * Using POLL_INTERVAL 60 and POLL_VALUES 5 we get the values 
+     */
+    /*
+     * over five minutes, which is a reasonable figure 
+     */
+#define POLL_VALUES    5
+    /*
+     * Declared in vmstat_dynix.c, from prototype 
+     */
+     void            init_vmstat_dynix(void);
+
+#endif                          /* _MIBGROUP_VMSTAT_DYNIX_H */
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/ucd-snmp/vmstat_freebsd2.c tomato121/release/src/router/snmp/agent/mibgroup/ucd-snmp/vmstat_freebsd2.c
--- tomato/release/src/router/snmp/agent/mibgroup/ucd-snmp/vmstat_freebsd2.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/ucd-snmp/vmstat_freebsd2.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,318 @@
+/*
+ * vmstat_freebsd2.c
+ */
+
+#include <net-snmp/net-snmp-config.h>
+
+/*
+ * Ripped from /usr/scr/usr.bin/vmstat/vmstat.c (covering all bases) 
+ */
+#include <sys/param.h>
+#include <sys/time.h>
+#include <sys/proc.h>
+#include <sys/dkstat.h>
+#ifdef freebsd5
+#include <sys/bio.h>
+#endif
+#include <sys/buf.h>
+#include <sys/uio.h>
+#include <sys/namei.h>
+#include <sys/malloc.h>
+#include <sys/signal.h>
+#include <sys/fcntl.h>
+#include <sys/ioctl.h>
+#include <sys/sysctl.h>
+#include <sys/vmmeter.h>
+
+#if HAVE_SYS_VMPARAM_H
+#include <sys/vmparam.h>
+#else
+#include <vm/vm_param.h>
+#endif
+
+#include <time.h>
+#include <nlist.h>
+#include <kvm.h>
+#include <errno.h>
+#include <unistd.h>
+#include <stdio.h>
+#include <ctype.h>
+#include <stdlib.h>
+#include <string.h>
+#include <paths.h>
+#include <limits.h>
+
+
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include <net-snmp/agent/auto_nlist.h>
+
+#include "util_funcs.h"
+#include "vmstat.h"
+#include "vmstat_freebsd2.h"
+
+
+/*
+ * nlist symbols 
+ */
+#define CPTIME_SYMBOL   "cp_time"
+#define SUM_SYMBOL      "cnt"
+#define INTRCNT_SYMBOL  "intrcnt"
+#define EINTRCNT_SYMBOL "eintrcnt"
+#define BOOTTIME_SYMBOL "boottime"
+
+/*
+ * Number of interrupts 
+ */
+#define INT_COUNT       10
+
+/*
+ * CPU percentage 
+ */
+#define CPU_PRC         100
+
+FindVarMethod var_extensible_vmstat;
+
+void
+init_vmstat_freebsd2(void)
+{
+
+    struct variable2 extensible_vmstat_variables[] = {
+        {MIBINDEX, ASN_INTEGER, RONLY, var_extensible_vmstat, 1,
+         {MIBINDEX}},
+        {ERRORNAME, ASN_OCTET_STR, RONLY, var_extensible_vmstat, 1,
+         {ERRORNAME}},
+        {SWAPIN, ASN_INTEGER, RONLY, var_extensible_vmstat, 1, {SWAPIN}},
+        {SWAPOUT, ASN_INTEGER, RONLY, var_extensible_vmstat, 1, {SWAPOUT}},
+        {IOSENT, ASN_INTEGER, RONLY, var_extensible_vmstat, 1, {IOSENT}},
+        {IORECEIVE, ASN_INTEGER, RONLY, var_extensible_vmstat, 1,
+         {IORECEIVE}},
+        {SYSINTERRUPTS, ASN_INTEGER, RONLY, var_extensible_vmstat, 1,
+         {SYSINTERRUPTS}},
+        {SYSCONTEXT, ASN_INTEGER, RONLY, var_extensible_vmstat, 1,
+         {SYSCONTEXT}},
+        {CPUUSER, ASN_INTEGER, RONLY, var_extensible_vmstat, 1, {CPUUSER}},
+        {CPUSYSTEM, ASN_INTEGER, RONLY, var_extensible_vmstat, 1,
+         {CPUSYSTEM}},
+        {CPUIDLE, ASN_INTEGER, RONLY, var_extensible_vmstat, 1, {CPUIDLE}},
+        {CPURAWUSER, ASN_COUNTER, RONLY, var_extensible_vmstat, 1,
+         {CPURAWUSER}},
+        {CPURAWNICE, ASN_COUNTER, RONLY, var_extensible_vmstat, 1,
+         {CPURAWNICE}},
+        {CPURAWSYSTEM, ASN_COUNTER, RONLY, var_extensible_vmstat, 1,
+         {CPURAWSYSTEM}},
+        {CPURAWIDLE, ASN_COUNTER, RONLY, var_extensible_vmstat, 1,
+         {CPURAWIDLE}},
+        {CPURAWKERNEL, ASN_COUNTER, RONLY, var_extensible_vmstat, 1,
+         {CPURAWKERNEL}},
+        {CPURAWINTR, ASN_COUNTER, RONLY, var_extensible_vmstat, 1,
+         {CPURAWINTR}},
+        {SYSRAWINTERRUPTS, ASN_COUNTER, RONLY, var_extensible_vmstat, 1,
+         {SYSRAWINTERRUPTS}},
+        {SYSRAWCONTEXT, ASN_COUNTER, RONLY, var_extensible_vmstat, 1,
+         {SYSRAWCONTEXT}},
+        /*
+         * Future use: 
+         */
+        /*
+         * {ERRORFLAG, ASN_INTEGER, RONLY, var_extensible_vmstat, 1, {ERRORFLAG }},
+         * {ERRORMSG, ASN_OCTET_STR, RONLY, var_extensible_vmstat, 1, {ERRORMSG }}
+         */
+    };
+
+    /*
+     * Define the OID pointer to the top of the mib tree that we're
+     * registering underneath 
+     */
+    oid             vmstat_variables_oid[] = { UCDAVIS_MIB, 11 };
+
+    /*
+     * register ourselves with the agent to handle our mib tree 
+     */
+    REGISTER_MIB("ucd-snmp/vmstat", extensible_vmstat_variables, variable2,
+                 vmstat_variables_oid);
+
+}
+
+
+long
+getuptime(void)
+{
+    static time_t   now, boottime;
+    time_t          uptime;
+
+    if (boottime == 0)
+        auto_nlist(BOOTTIME_SYMBOL, (char *) &boottime, sizeof(boottime));
+
+    time(&now);
+    uptime = now - boottime;
+
+    return (uptime);
+}
+
+unsigned char  *
+var_extensible_vmstat(struct variable *vp,
+                      oid * name,
+                      size_t * length,
+                      int exact,
+                      size_t * var_len, WriteMethod ** write_method)
+{
+
+    int             loop;
+
+    time_t          time_new = getuptime();
+    static time_t   time_old;
+    static time_t   time_diff;
+
+    static long     cpu_old[CPUSTATES];
+    static long     cpu_new[CPUSTATES];
+    static long     cpu_diff[CPUSTATES];
+    static long     cpu_total;
+    long            cpu_sum;
+    double          cpu_prc;
+
+    static struct vmmeter mem_old, mem_new;
+
+    static long     long_ret;
+    static char     errmsg[300];
+
+    long_ret = 0;               /* set to 0 as default */
+
+    if (header_generic(vp, name, length, exact, var_len, write_method))
+        return (NULL);
+
+    /*
+     * Update structures (only if time has passed) 
+     */
+    if (time_new != time_old) {
+        time_diff = time_new - time_old;
+        time_old = time_new;
+
+        /*
+         * CPU usage 
+         */
+        auto_nlist(CPTIME_SYMBOL, (char *) cpu_new, sizeof(cpu_new));
+
+        cpu_total = 0;
+
+        for (loop = 0; loop < CPUSTATES; loop++) {
+            cpu_diff[loop] = cpu_new[loop] - cpu_old[loop];
+            cpu_old[loop] = cpu_new[loop];
+            cpu_total += cpu_diff[loop];
+        }
+
+        if (cpu_total == 0)
+            cpu_total = 1;
+
+        /*
+         * Memory info 
+         */
+        mem_old = mem_new;
+        auto_nlist(SUM_SYMBOL, (char *) &mem_new, sizeof(mem_new));
+    }
+
+    /*
+     * Rate macro 
+     */
+#define rate(x) (((x)+ time_diff/2) / time_diff)
+
+    /*
+     * Page-to-kb macro 
+     */
+#define ptok(p) ((p) * (mem_new.v_page_size >> 10))
+
+    switch (vp->magic) {
+    case MIBINDEX:
+        long_ret = 1;
+        return ((u_char *) (&long_ret));
+    case ERRORNAME:            /* dummy name */
+        sprintf(errmsg, "systemStats");
+        *var_len = strlen(errmsg);
+        return ((u_char *) (errmsg));
+    case SWAPIN:
+#if defined(openbsd2) || defined(darwin)
+        long_ret = ptok(mem_new.v_swpin - mem_old.v_swpin);
+#else
+        long_ret = ptok(mem_new.v_swappgsin - mem_old.v_swappgsin +
+                        mem_new.v_vnodepgsin - mem_old.v_vnodepgsin);
+#endif
+        long_ret = rate(long_ret);
+        return ((u_char *) (&long_ret));
+    case SWAPOUT:
+#if defined(openbsd2) || defined(darwin)
+        long_ret = ptok(mem_new.v_swpout - mem_old.v_swpout);
+#else
+        long_ret = ptok(mem_new.v_swappgsout - mem_old.v_swappgsout +
+                        mem_new.v_vnodepgsout - mem_old.v_vnodepgsout);
+#endif
+        long_ret = rate(long_ret);
+        return ((u_char *) (&long_ret));
+    case IOSENT:
+#if NO_DUMMY_VALUES
+        return NULL;
+#endif
+        long_ret = -1;
+        return ((u_char *) (&long_ret));
+    case IORECEIVE:
+#if NO_DUMMY_VALUES
+        return NULL;
+#endif
+        long_ret = -1;
+        return ((u_char *) (&long_ret));
+    case SYSINTERRUPTS:
+        long_ret = rate(mem_new.v_intr - mem_old.v_intr);
+        return ((u_char *) (&long_ret));
+    case SYSCONTEXT:
+        long_ret = rate(mem_new.v_swtch - mem_old.v_swtch);
+        return ((u_char *) (&long_ret));
+    case CPUUSER:
+        cpu_sum = cpu_diff[CP_USER] + cpu_diff[CP_NICE];
+        cpu_prc = (float) cpu_sum / (float) cpu_total;
+        long_ret = cpu_prc * CPU_PRC;
+        return ((u_char *) (&long_ret));
+    case CPUSYSTEM:
+        cpu_sum = cpu_diff[CP_SYS] + cpu_diff[CP_INTR];
+        cpu_prc = (float) cpu_sum / (float) cpu_total;
+        long_ret = cpu_prc * CPU_PRC;
+        return ((u_char *) (&long_ret));
+    case CPUIDLE:
+        cpu_sum = cpu_diff[CP_IDLE];
+        cpu_prc = (float) cpu_sum / (float) cpu_total;
+        long_ret = cpu_prc * CPU_PRC;
+        return ((u_char *) (&long_ret));
+    case CPURAWUSER:
+        long_ret = cpu_new[CP_USER];
+        return ((u_char *) (&long_ret));
+    case CPURAWNICE:
+        long_ret = cpu_new[CP_NICE];
+        return ((u_char *) (&long_ret));
+    case CPURAWSYSTEM:
+        long_ret = cpu_new[CP_SYS] + cpu_new[CP_INTR];
+        return ((u_char *) (&long_ret));
+    case CPURAWIDLE:
+        long_ret = cpu_new[CP_IDLE];
+        return ((u_char *) (&long_ret));
+    case CPURAWKERNEL:
+        long_ret = cpu_new[CP_SYS];
+        return ((u_char *) (&long_ret));
+    case CPURAWINTR:
+        long_ret = cpu_new[CP_INTR];
+        return ((u_char *) (&long_ret));
+    case SYSRAWINTERRUPTS:
+        long_ret = mem_new.v_intr;
+        return ((u_char *) (&long_ret));
+    case SYSRAWCONTEXT:
+        long_ret = mem_new.v_swtch;
+        return ((u_char *) (&long_ret));
+        /*
+         * reserved for future use 
+         */
+        /*
+         * case ERRORFLAG:
+         * return((u_char *) (&long_ret));
+         * case ERRORMSG:
+         * return((u_char *) (&long_ret));
+         */
+    }
+    return NULL;
+}
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/ucd-snmp/vmstat_freebsd2.h tomato121/release/src/router/snmp/agent/mibgroup/ucd-snmp/vmstat_freebsd2.h
--- tomato/release/src/router/snmp/agent/mibgroup/ucd-snmp/vmstat_freebsd2.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/ucd-snmp/vmstat_freebsd2.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,12 @@
+/*
+ *  vmstat mib groups
+ *
+ */
+#ifndef _MIBGROUP_VMSTAT_FREEBSD2_H
+#define _MIBGROUP_VMSTAT_FREEBSD2_H
+
+#include "mibdefs.h"
+
+void            init_vmstat_freebsd2(void);
+
+#endif                          /* _MIBGROUP_VMSTAT_FREEBSD2_H */
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/ucd-snmp/vmstat.h tomato121/release/src/router/snmp/agent/mibgroup/ucd-snmp/vmstat.h
--- tomato/release/src/router/snmp/agent/mibgroup/ucd-snmp/vmstat.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/ucd-snmp/vmstat.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,35 @@
+/*
+ *  vmstat mib groups
+ *
+ */
+#ifndef _MIBGROUP_VMSTAT_H
+#define _MIBGROUP_VMSTAT_H
+
+#include "mibdefs.h"
+
+FindVarMethod   var_extensible_vmstat;
+void            init_vmstat(void);
+
+#define SWAPIN 3
+#define SWAPOUT 4
+#define IOSENT 5
+#define IORECEIVE 6
+#define SYSINTERRUPTS 7
+#define SYSCONTEXT 8
+#define CPUUSER 9
+#define CPUSYSTEM 10
+#define CPUIDLE 11
+#define CPUERROR 16
+#define CPURAWUSER 50
+#define CPURAWNICE 51
+#define CPURAWSYSTEM 52
+#define CPURAWIDLE 53
+#define CPURAWWAIT 54
+#define CPURAWKERNEL 55
+#define CPURAWINTR 56
+#define IORAWSENT 57
+#define IORAWRECEIVE 58
+#define SYSRAWINTERRUPTS 59
+#define SYSRAWCONTEXT 60
+
+#endif                          /* _MIBGROUP_VMSTAT_H */
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/ucd-snmp/vmstat_hpux.c tomato121/release/src/router/snmp/agent/mibgroup/ucd-snmp/vmstat_hpux.c
--- tomato/release/src/router/snmp/agent/mibgroup/ucd-snmp/vmstat_hpux.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/ucd-snmp/vmstat_hpux.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,764 @@
+/*
+ *  vmstat_hpux.c
+ *  UCD SNMP module for systemStats section of UCD-SNMP-MIB for HPUX 10.x/11.x
+ */
+
+/*
+ * To make lint skip the debug code and stop complaining 
+ */
+#ifdef __lint
+#define SNMP_NO_DEBUGGING 1
+#endif
+
+/*
+ * Includes start here 
+ */
+
+/*
+ * UCD-SNMP config details 
+ */
+#include <net-snmp/net-snmp-config.h>
+
+/*
+ * Standard includes 
+ */
+#include <stdlib.h>
+#include <unistd.h>
+#include <sys/types.h>
+#include <sys/time.h>
+#include <string.h>
+
+/*
+ * pstat and sysinfo structs 
+ */
+#include <sys/pstat.h>
+#include <sys/dk.h>
+
+
+/*
+ * Includes needed for all modules 
+ */
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include "mibdefs.h"
+
+/*
+ * Utility functions for UCD-SNMP 
+ */
+#include "util_funcs.h"
+
+/*
+ * Header file for this module 
+ */
+#include "vmstat.h"
+#include "vmstat_hpux.h"
+
+/*
+ * Includes end here 
+ */
+
+
+/*
+ * Global structures start here 
+ */
+
+/*
+ * A structure to save data gathered from the kernel pstat interface to.
+ * CPUSTATES are defined as (see sys/dk.h):
+ * #define CPUSTATES       9       -- number of CPU states
+ * #define CP_USER         0       -- user mode of USER process
+ * #define CP_NICE         1       -- user mode of USER process at nice priority
+ * #define CP_SYS          2       -- kernel mode of USER process
+ * #define CP_IDLE         3       -- IDLE mode
+ * #define CP_WAIT         4       
+ * #define CP_BLOCK        5       -- time blocked on a spinlock
+ * #define CP_SWAIT        6       -- time blocked on the kernel semaphore
+ * #define CP_INTR         7       -- INTERRUPT mode
+ * #define CP_SSYS         8       -- kernel mode of KERNEL process
+ */
+
+struct cpu_stat_snapshot {
+    time_t          css_time;
+    unsigned int    css_cpus;
+    unsigned long long css_swapin;
+    unsigned long long css_swapout;
+    unsigned long long css_blocks_read;
+    unsigned long long css_blocks_write;
+    unsigned long long css_interrupts;
+    unsigned long long css_context_sw;
+    unsigned long long css_cpu[CPUSTATES];
+};
+
+/*
+ * Define a structure to hold kernel static information 
+ */
+struct pst_static pst;
+
+/*
+ * Global structures end here 
+ */
+
+/*
+ * Global variables start here 
+ */
+
+/*
+ * Variables for the calculated values, filled in update_stats    
+ */
+/*
+ * Need to be global since we need them in more than one function 
+ */
+static unsigned long swapin;
+static unsigned long swapout;
+static unsigned long blocks_read;
+static unsigned long blocks_write;
+static unsigned long interrupts;
+static unsigned long context_sw;
+
+/*
+ * Since MIB wants CPU_SYSTEM, which is CP_SYS + CP_WAIT (see sys/dk.h) 
+ */
+static long     cpu_perc[CPUSTATES + 1];
+
+/*
+ * How many snapshots we have already taken, needed for the first 
+ */
+/*
+ * POLL_INTERVAL * POLL_VALUES seconds of agent running 
+ */
+static unsigned int number_of_snapshots;
+
+/*
+ * The place to store the snapshots of system data in 
+ */
+static struct cpu_stat_snapshot snapshot[POLL_VALUES + 1];
+
+/*
+ * And one for the raw counters, which we fill when the raw values are 
+ */
+/*
+ * requested, as opposed to the absolute values, which are taken every 
+ */
+/*
+ * POLL_INTERVAL seconds and calculated over POLL_INTERVAL * POLL_VALUES time 
+ */
+static struct cpu_stat_snapshot raw_values;
+
+/*
+ * Global variables end here 
+ */
+
+
+/*
+ * Functions start here 
+ */
+
+/*
+ * Function prototype 
+ */
+static void     update_stats(unsigned int registrationNumber,
+                             void *clientarg);
+static int      take_snapshot(struct cpu_stat_snapshot *css);
+
+/*
+ * init_vmstat_hpux starts here 
+ */
+/*
+ * Init function for this module, from prototype 
+ */
+/*
+ * Defines variables handled by this module, defines root OID for 
+ */
+/*
+ * this module and registers it with the agent 
+ */
+
+FindVarMethod var_extensible_vmstat;
+
+void
+init_vmstat_hpux(void)
+{
+
+    /*
+     * Which variables do we service ? 
+     */
+    struct variable2 extensible_vmstat_variables[] = {
+        {MIBINDEX, ASN_INTEGER, RONLY, var_extensible_vmstat, 1,
+         {MIBINDEX}},
+        {ERRORNAME, ASN_OCTET_STR, RONLY, var_extensible_vmstat, 1,
+         {ERRORNAME}},
+        {SWAPIN, ASN_INTEGER, RONLY, var_extensible_vmstat, 1, {SWAPIN}},
+        {SWAPOUT, ASN_INTEGER, RONLY, var_extensible_vmstat, 1, {SWAPOUT}},
+        {IOSENT, ASN_INTEGER, RONLY, var_extensible_vmstat, 1, {IOSENT}},
+        {IORECEIVE, ASN_INTEGER, RONLY, var_extensible_vmstat, 1,
+         {IORECEIVE}},
+        {SYSINTERRUPTS, ASN_INTEGER, RONLY, var_extensible_vmstat, 1,
+         {SYSINTERRUPTS}},
+        {SYSCONTEXT, ASN_INTEGER, RONLY, var_extensible_vmstat, 1,
+         {SYSCONTEXT}},
+        {CPUUSER, ASN_INTEGER, RONLY, var_extensible_vmstat, 1, {CPUUSER}},
+        {CPUSYSTEM, ASN_INTEGER, RONLY, var_extensible_vmstat, 1,
+         {CPUSYSTEM}},
+        {CPUIDLE, ASN_INTEGER, RONLY, var_extensible_vmstat, 1, {CPUIDLE}},
+        {CPURAWUSER, ASN_COUNTER, RONLY, var_extensible_vmstat, 1,
+         {CPURAWUSER}},
+        {CPURAWNICE, ASN_COUNTER, RONLY, var_extensible_vmstat, 1,
+         {CPURAWNICE}},
+        {CPURAWSYSTEM, ASN_COUNTER, RONLY, var_extensible_vmstat, 1,
+         {CPURAWSYSTEM}},
+        {CPURAWIDLE, ASN_COUNTER, RONLY, var_extensible_vmstat, 1,
+         {CPURAWIDLE}},
+        {CPURAWWAIT, ASN_COUNTER, RONLY, var_extensible_vmstat, 1,
+         {CPURAWWAIT}},
+        {CPURAWKERNEL, ASN_COUNTER, RONLY, var_extensible_vmstat, 1,
+         {CPURAWKERNEL}},
+        {IORAWSENT, ASN_COUNTER, RONLY, var_extensible_vmstat, 1,
+         {IORAWSENT}},
+        {IORAWRECEIVE, ASN_COUNTER, RONLY, var_extensible_vmstat, 1,
+         {IORAWRECEIVE}},
+        /*
+         * Future use: 
+         */
+        /*
+         * {ERRORFLAG, ASN_INTEGER, RONLY, var_extensible_vmstat, 1, {ERRORFLAG }},
+         * {ERRORMSG, ASN_OCTET_STR, RONLY, var_extensible_vmstat, 1, {ERRORMSG }}
+         */
+    };
+
+    /*
+     * Define the OID pointer to the top of the mib tree that we're 
+     */
+    /*
+     * registering underneath 
+     */
+    oid             vmstat_variables_oid[] = { UCDAVIS_MIB, 11 };
+
+    /*
+     * register ourselves with the agent to handle our mib tree 
+     */
+    /*
+     * LINTED Trust me, I know what I'm doing 
+     */
+    REGISTER_MIB("ucd-snmp/vmstat", extensible_vmstat_variables, variable2,
+                 vmstat_variables_oid);
+
+    /*
+     * Start with some useful data 
+     */
+    update_stats(0, NULL);
+
+    /*
+     * update_stats is run every POLL_INTERVAL seconds using this routine 
+     */
+    /*
+     * (see 'man snmp_alarm') 
+     */
+    /*
+     * This is only executed once to get some useful data in the beginning 
+     */
+    if (snmp_alarm_register(5, NULL, update_stats, NULL) == 0) {
+        snmp_log(LOG_WARNING,
+                 "vmstat_hpux (init): snmp_alarm_register failed.\n");
+    }
+    /*
+     * This is the one that runs update_stats every POLL_INTERVAL seconds 
+     */
+    if (snmp_alarm_register(POLL_INTERVAL, SA_REPEAT, update_stats, NULL)
+        == 0) {
+        snmp_log(LOG_ERR,
+                 "vmstat_hpux (init): snmp_alarm_register failed, cannot service requests.\n");
+    }
+
+}                               /* init_vmstat_hpux ends here */
+
+/*
+ * Data collection function take_snapshot starts here 
+ */
+/*
+ * Get data from kernel and save into the snapshot strutcs 
+ */
+/*
+ * Argument is the snapshot struct to save to. Global anyway, but looks nicer 
+ */
+static int
+take_snapshot(struct cpu_stat_snapshot *css)
+{
+    /*
+     * Variables start here 
+     */
+
+    struct pst_dynamic psd;
+    struct pst_processor *psp;
+    struct pst_vminfo psv;
+
+    /*
+     * time counter 
+     */
+    time_t          current_time;
+
+    /*
+     * The usual stuff to count on, err, by 
+     */
+    int             i;
+
+    /*
+     * Variables end here 
+     */
+
+    /*
+     * Function starts here 
+     */
+
+    /*
+     * Get time 
+     */
+    time(&current_time);
+
+    /*
+     * If we have just gotten the data, return the values from last run (skip if-clause) 
+     */
+    /*
+     * This happens on a snmpwalk request.  No need to read the pstat again 
+     */
+    /*
+     * if we just did it less than 2 seconds ago 
+     */
+    /*
+     * Jumps into if-clause either when snapshot is empty or when too old 
+     */
+
+    if ((css->css_time == 0) || (current_time > css->css_time + 2)) {
+        /*
+         * Make sure we clean up before we put new data into snapshot 
+         */
+        memset(css, 0, sizeof *css);
+
+        /*
+         * Update timer 
+         */
+        css->css_time = current_time;
+
+        if (pstat_getdynamic(&psd, sizeof(psd), (size_t) 1, 0) != -1) {
+            css->css_cpus = psd.psd_proc_cnt;
+            DEBUGMSGTL(("take_snapshot", "*** Number of CPUs: %d\n",
+                        css->css_cpus));
+
+            /*
+             * We need a for-loop for the CPU values 
+             */
+            for (i = 0; i < CPUSTATES; i++) {
+                css->css_cpu[i] = (unsigned long long) psd.psd_cpu_time[i];
+                DEBUGMSGTL(("take_snapshot",
+                            "*** Time for CPU state %d: %d\n", i,
+                            psd.psd_cpu_time[i]));
+            }
+            psp =
+                (struct pst_processor *) malloc(css->css_cpus *
+                                                sizeof(*psp));
+            if (pstat_getprocessor(psp, sizeof(*psp), css->css_cpus, 0) !=
+                -1) {
+                int             i;
+                for (i = 0; i < css->css_cpus; i++) {
+                    css->css_blocks_read = psp[i].psp_phread;
+                    css->css_blocks_write = psp[i].psp_phwrite;
+                }
+            } else
+                snmp_log(LOG_ERR,
+                         "vmstat_hpux (take_snapshot): pstat_getprocessor failed!\n");
+        } else
+            snmp_log(LOG_ERR,
+                     "vmstat_hpux (take_snapshot): pstat_getdynamic failed!\n");
+
+        if (pstat_getvminfo(&psv, sizeof(psv), (size_t) 1, 0) != -1) {
+            css->css_swapin = psv.psv_sswpin;
+            css->css_swapout = psv.psv_sswpout;
+            css->css_interrupts = psv.psv_sintr;
+            css->css_context_sw = psv.psv_sswtch;
+        } else
+            snmp_log(LOG_ERR,
+                     "vmstat_hpux (take_snapshot): pstat_getvminfo failed!\n");
+
+    }
+
+    /*
+     * All engines running at warp speed, no problems (if there are any engines, that is) 
+     */
+    return (css->css_cpus > 0 ? 0 : -1);
+}                               /* take_snapshot ends here */
+
+/*
+ * This gets called every POLL_INTERVAL seconds to update the snapshots.  It takes a new snapshot and 
+ */
+/*
+ * drops the oldest one.  This way we move the time window so we always take the values over 
+ */
+/*
+ * POLL_INTERVAL * POLL_VALUES seconds and update the data used every POLL_INTERVAL seconds 
+ */
+/*
+ * The alarm timer is in the init function of this module (snmp_alarm_register) 
+ */
+/*
+ * ARGSUSED0 
+ */
+static void
+update_stats(unsigned int registrationNumber, void *clientarg)
+{
+    /*
+     * The time between the samples we compare 
+     */
+    time_t          time_diff;
+
+    /*
+     * Easier to use these than the snapshots, short hand pointers 
+     */
+    struct cpu_stat_snapshot *css_old, *css_new;
+
+    /*
+     * The usual stuff to count on, err, by 
+     */
+    int             i;
+
+    /*
+     * The sum of the CPU ticks that have passed on the different CPU states, so we can calculate 
+     */
+    /*
+     * the percentages of each state 
+     */
+    unsigned long long cpu_sum = 0;
+
+    DEBUGMSGTL(("ucd-snmp/vmstat_hpux.c:update_stats",
+                "updating stats\n"));
+
+    /*
+     * Take the current snapshot 
+     */
+    if (take_snapshot(&snapshot[0]) == -1) {
+        snmp_log(LOG_WARNING,
+                 "vmstat_hpux (update_stats): Something went wrong with take_snapshot.\n");
+        return;
+    }
+
+    /*
+     * Do we have some data we can use ?  An issue right after the start of the agent 
+     */
+    if (number_of_snapshots > 0) {
+        /*
+         * Huh, the number of CPUs changed during run time.  That is indeed s.th. worth noting, we 
+         */
+        /*
+         * output a humorous (more or less) syslog message and need to retake the snapshots 
+         */
+        if (snapshot[0].css_cpus != snapshot[1].css_cpus) {
+            if (snapshot[0].css_cpus > snapshot[1].css_cpus) {
+                snmp_log(LOG_NOTICE,
+                         "vmstat_hpux (update_stats): Cool ! Number of CPUs increased, must be hot-pluggable.\n");
+            } else {
+                snmp_log(LOG_NOTICE,
+                         "vmstat_hpux (update_stats): Lost at least one CPU, RIP.\n");
+            }
+            /*
+             * Make all snapshots but the current one invalid 
+             */
+            number_of_snapshots = 1;
+            /*
+             * Move the current one in the "first" [1] slot 
+             */
+            memmove(&snapshot[1], &snapshot[0], sizeof snapshot[0]);
+            /*
+             * Erase the current one 
+             */
+            memset(&snapshot[0], 0, sizeof snapshot[0]);
+            /*
+             * Try to get a new snapshot in five seconds so we can return s.th. useful 
+             */
+            if (snmp_alarm_register(5, NULL, update_stats, NULL) == 0) {
+                snmp_log(LOG_WARNING,
+                         "vmstat_hpux (update_stats): snmp_alarm_register failed.\n");
+            }
+            return;
+        }
+
+        /*
+         * Short hand pointers 
+         */
+        css_new = &snapshot[0];
+        css_old = &snapshot[number_of_snapshots];
+
+        /*
+         * How much time has passed between the snapshots we get the values from ? 
+         */
+        time_diff =
+            (snapshot[0].css_time -
+             snapshot[number_of_snapshots].css_time);
+
+        DEBUGMSGTL(("ucd-snmp/vmstat_hpux.c:update_stats",
+                    "time_diff: %lld\n", time_diff));
+
+        /*
+         * swapin and swapout are in pages, MIB wants kB/s,so we just need to get kB and seconds 
+         */
+        /*
+         * For the others we need to get value per second 
+         */
+        /*
+         * Retreive static information to obtain memory page_size 
+         */
+        if (pstat_getstatic(&pst, sizeof(pst), (size_t) 1, 0) == -1) {
+            snmp_log(LOG_ERR, "vmstat_hpux: pstat_getstatic failed!\n");
+        }
+
+        /*
+         * LINTED cast needed, really 
+         */
+        swapin =
+            (unsigned int) ((css_new->css_swapin - css_old->css_swapin) *
+                            pst.page_size / 1024 / time_diff);
+        /*
+         * LINTED cast needed, really 
+         */
+        swapout =
+            (unsigned int) ((css_new->css_swapout - css_old->css_swapout) *
+                            pst.page_size / 1024 / time_diff);
+        /*
+         * LINTED cast needed, really 
+         */
+        blocks_read =
+            (unsigned
+             int) ((css_new->css_blocks_read -
+                    css_old->css_blocks_read) / time_diff);
+        /*
+         * LINTED cast needed, really 
+         */
+        blocks_write =
+            (unsigned
+             int) ((css_new->css_blocks_write -
+                    css_old->css_blocks_write) / time_diff);
+        /*
+         * LINTED cast needed, really 
+         */
+        interrupts =
+            (unsigned
+             int) ((css_new->css_interrupts -
+                    css_old->css_interrupts) / time_diff);
+        /*
+         * LINTED cast needed, really 
+         */
+        context_sw =
+            (unsigned
+             int) ((css_new->css_context_sw -
+                    css_old->css_context_sw) / time_diff);
+
+        /*
+         * Loop thru all the CPUSTATES and get the differences 
+         */
+        for (i = 0; i < CPUSTATES; i++) {
+            cpu_sum += (css_new->css_cpu[i] - css_old->css_cpu[i]);
+        }
+
+        /*
+         * Now calculate the absolute percentage values 
+         */
+        /*
+         * Looks somewhat complicated sometimes but tries to get around using floats to increase speed 
+         */
+        for (i = 0; i < CPUSTATES; i++) {
+            /*
+             * Since we don't return fractions we use + 0.5 to get between 99 and 101 percent adding the values 
+             */
+            /*
+             * together, otherwise we would get less than 100 most of the time 
+             */
+            /*
+             * LINTED has to be 'long' 
+             */
+            cpu_perc[i] =
+                (long) (((css_new->css_cpu[i] -
+                          css_old->css_cpu[i]) * 100 +
+                         (cpu_sum / 2)) / cpu_sum);
+        }
+
+        /*
+         * As said before, MIB wants CPU_SYSTEM which is CP_SYS + CP_WAIT 
+         */
+        /*
+         * LINTED has to be 'long' 
+         */
+        cpu_perc[CPU_SYSTEM] =
+            (long) ((((css_new->css_cpu[CP_SYS] - css_old->css_cpu[CP_SYS])
+                      + (css_new->css_cpu[CP_WAIT] -
+                         css_old->css_cpu[CP_WAIT]))
+                     * 100 + (cpu_sum / 2)) / cpu_sum);
+    }
+
+    /*
+     * Make the current one the first one and move the whole thing one place down 
+     */
+    memmove(&snapshot[1], &snapshot[0],
+            (size_t) (((char *) &snapshot[POLL_VALUES]) -
+                      ((char *) &snapshot[0])));
+
+    /*
+     * Erase the current one 
+     */
+    memset(&snapshot[0], 0, sizeof snapshot[0]);
+
+    /*
+     * Only important on start up, we keep track of how many snapshots we have taken so far 
+     */
+    if (number_of_snapshots < POLL_VALUES) {
+        number_of_snapshots++;
+    }
+}                               /* update_stats ends here */
+
+/*
+ * *var_extensible_vmstat starts here 
+ */
+/*
+ * The guts of the module, this routine gets called to service a request 
+ */
+unsigned char *
+var_extensible_vmstat(struct variable *vp,
+                      oid * name,
+                      size_t * length,
+                      int exact,
+                      size_t * var_len, WriteMethod ** write_method)
+{
+    /*
+     * Needed for returning the values 
+     */
+    static long     long_ret;
+    static char     errmsg[300];
+
+    /*
+     * set to 0 as default 
+     */
+    long_ret = 0;
+
+    /*
+     * generic check whether the options passed make sense and whether the 
+     */
+    /*
+     * right variable is requested 
+     */
+    if (header_generic(vp, name, length, exact, var_len, write_method) !=
+        MATCH_SUCCEEDED) {
+        return (NULL);
+    }
+
+    /*
+     * The function that actually returns s.th. 
+     */
+    switch (vp->magic) {
+    case MIBINDEX:
+        long_ret = 1;
+        return ((u_char *) (&long_ret));
+    case ERRORNAME:            /* dummy name */
+        sprintf(errmsg, "systemStats");
+        *var_len = strlen(errmsg);
+        return ((u_char *) (errmsg));
+    case SWAPIN:
+        return ((u_char *) (&swapin));
+    case SWAPOUT:
+        return ((u_char *) (&swapout));
+    case IOSENT:
+        return ((u_char *) (&blocks_write));
+    case IORECEIVE:
+        return ((u_char *) (&blocks_read));
+    case SYSINTERRUPTS:
+        return ((u_char *) (&interrupts));
+    case SYSCONTEXT:
+        return ((u_char *) (&context_sw));
+    case CPUUSER:
+        return ((u_char *) (&cpu_perc[CP_USER]));
+    case CPUSYSTEM:
+        return ((u_char *) (&cpu_perc[CPU_SYSTEM]));
+    case CPUIDLE:
+        return ((u_char *) (&cpu_perc[CP_IDLE]));
+    case CPURAWUSER:
+        take_snapshot(&raw_values);
+        /*
+         * LINTED has to be 'long' 
+         */
+        long_ret =
+            (long) (raw_values.css_cpu[CP_USER] / raw_values.css_cpus);
+        return ((u_char *) (&long_ret));
+    case CPURAWNICE:
+        take_snapshot(&raw_values);
+        /*
+         * LINTED has to be 'long' 
+         */
+        long_ret =
+            (long) (raw_values.css_cpu[CP_NICE] / raw_values.css_cpus);
+        return ((u_char *) (&long_ret));
+    case CPURAWSYSTEM:
+        take_snapshot(&raw_values);
+        /*
+         * LINTED has to be 'long' 
+         */
+        long_ret =
+            (long) ((raw_values.css_cpu[CP_SYS] +
+                     raw_values.css_cpu[CP_WAIT]) / raw_values.css_cpus);
+        return ((u_char *) (&long_ret));
+    case CPURAWIDLE:
+        take_snapshot(&raw_values);
+        /*
+         * LINTED has to be 'long' 
+         */
+        long_ret =
+            (long) (raw_values.css_cpu[CP_IDLE] / raw_values.css_cpus);
+        return ((u_char *) (&long_ret));
+    case CPURAWWAIT:
+        take_snapshot(&raw_values);
+        /*
+         * LINTED has to be 'long' 
+         */
+        long_ret =
+            (long) (raw_values.css_cpu[CP_WAIT] / raw_values.css_cpus);
+        return ((u_char *) (&long_ret));
+    case CPURAWKERNEL:
+        take_snapshot(&raw_values);
+        /*
+         * LINTED has to be 'long' 
+         */
+        long_ret =
+            (long) (raw_values.css_cpu[CP_SYS] / raw_values.css_cpus);
+        return ((u_char *) (&long_ret));
+    case IORAWSENT:
+        take_snapshot(&raw_values);
+        /*
+         * LINTED has to be 'long' 
+         */
+        long_ret = (long) (raw_values.css_blocks_write);
+        return ((u_char *) (&long_ret));
+    case IORAWRECEIVE:
+        take_snapshot(&raw_values);
+        /*
+         * LINTED has to be 'long' 
+         */
+        long_ret = (long) (raw_values.css_blocks_read);
+        return ((u_char *) (&long_ret));
+
+        /*
+         * reserved for future use 
+         */
+        /*
+         * case ERRORFLAG:
+         * return((u_char *) (&long_ret));
+         * case ERRORMSG:
+         * return((u_char *) (&long_ret));
+         */
+    default:
+        snmp_log(LOG_ERR,
+                 "vmstat_hpux: Error in request, no match found.\n");
+    }
+    return (NULL);
+}                               /* *var_extensible_vmstat ends here */
+
+/*
+ * Functions end here 
+ */
+
+/*
+ * Program ends here 
+ */
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/ucd-snmp/vmstat_hpux.h tomato121/release/src/router/snmp/agent/mibgroup/ucd-snmp/vmstat_hpux.h
--- tomato/release/src/router/snmp/agent/mibgroup/ucd-snmp/vmstat_hpux.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/ucd-snmp/vmstat_hpux.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,55 @@
+/*
+ *  vmstat_hpux.h
+ *  Header file for vmstat_hpux module for UCD-SNMP
+ *  Gary Edwards <garye@cadence.com>
+ *
+ */
+
+/*
+ * Prevent accidental double inclusions 
+ */
+#ifndef _MIBGROUP_VMSTAT_HPUX_H
+#define _MIBGROUP_VMSTAT_HPUX_H
+
+/*
+ * Directive to include utility module 
+ */
+config_require(util_funcs)
+
+    /*
+     * Make 64-bit pstat calls 
+     */
+#define _PSTAT64
+    /*
+     * MIB wants CPU_SYSTEM which is CP_SYS + CP_WAIT (see sys/dk.h) 
+     */
+#define CPU_SYSTEM 9
+    /*
+     * Time interval to gather system data 
+     */
+    /*
+     * Lower value -> more accurate data, higher value -> less CPU usage 
+     */
+    /*
+     * Value is in seconds 
+     */
+#define POLL_INTERVAL 60
+    /*
+     * How many snapshots of system data to keep.  Values returned are over 
+     */
+    /*
+     * time difference between first and last snapshot 
+     */
+    /*
+     * Using POLL_INTERVAL 60 and POLL_VALUES 5 we get the values 
+     */
+    /*
+     * over five minutes, which is a reasonable figure 
+     */
+#define POLL_VALUES    5
+    /*
+     * Declared in vmstat_hpux.c, from prototype 
+     */
+     void            init_vmstat_hpux(void);
+
+#endif                          /* _MIBGROUP_VMSTAT_HPUX_H */
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/ucd-snmp/vmstat_netbsd1.c tomato121/release/src/router/snmp/agent/mibgroup/ucd-snmp/vmstat_netbsd1.c
--- tomato/release/src/router/snmp/agent/mibgroup/ucd-snmp/vmstat_netbsd1.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/ucd-snmp/vmstat_netbsd1.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,315 @@
+/*
+ * vmstat_netbsd1.c
+ */
+
+#include <net-snmp/net-snmp-config.h>
+
+/*
+ * Ripped from /usr/scr/usr.bin/vmstat/vmstat.c (covering all bases) 
+ */
+#include <sys/param.h>
+#include <sys/time.h>
+#include <sys/proc.h>
+#include <sys/dkstat.h>
+#include <sys/buf.h>
+#include <sys/uio.h>
+#include <sys/namei.h>
+#include <sys/malloc.h>
+#include <sys/signal.h>
+#include <sys/fcntl.h>
+#include <sys/ioctl.h>
+#include <sys/sysctl.h>
+#include <sys/vmmeter.h>
+#include <sys/sched.h>
+
+#if defined(HAVE_UVM_UVM_PARAM_H) && defined(HAVE_UVM_UVM_EXTERN_H)
+#include <uvm/uvm_param.h>
+#include <uvm/uvm_extern.h>
+#elif defined(HAVE_VM_VM_PARAM_H) && defined(HAVE_VM_VM_EXTERN_H)
+#include <vm/vm_param.h>
+#include <vm/vm_extern.h>
+#else
+#error vmstat_netbsd1.c: Is this really a NetBSD system?
+#endif
+
+#include <time.h>
+#include <nlist.h>
+#include <kvm.h>
+#include <errno.h>
+#include <unistd.h>
+#include <stdio.h>
+#include <ctype.h>
+#include <stdlib.h>
+#include <string.h>
+#include <paths.h>
+#include <limits.h>
+
+
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include <net-snmp/agent/auto_nlist.h>
+
+#include "util_funcs.h"
+#include "vmstat.h"
+
+/*
+ * CPU percentage 
+ */
+#define CPU_PRC         100
+#define CPTIME_SYMBOL	"cp_time"
+#define BOOTTIME_SYMBOL	"boottime"
+
+FindVarMethod var_extensible_vmstat;
+
+void
+init_vmstat_netbsd1(void)
+{
+
+    struct variable2 extensible_vmstat_variables[] = {
+        {MIBINDEX, ASN_INTEGER, RONLY, var_extensible_vmstat, 1,
+         {MIBINDEX}},
+        {ERRORNAME, ASN_OCTET_STR, RONLY, var_extensible_vmstat, 1,
+         {ERRORNAME}},
+        {SWAPIN, ASN_INTEGER, RONLY, var_extensible_vmstat, 1, {SWAPIN}},
+        {SWAPOUT, ASN_INTEGER, RONLY, var_extensible_vmstat, 1, {SWAPOUT}},
+        {IOSENT, ASN_INTEGER, RONLY, var_extensible_vmstat, 1, {IOSENT}},
+        {IORECEIVE, ASN_INTEGER, RONLY, var_extensible_vmstat, 1,
+         {IORECEIVE}},
+        {SYSINTERRUPTS, ASN_INTEGER, RONLY, var_extensible_vmstat, 1,
+         {SYSINTERRUPTS}},
+        {SYSCONTEXT, ASN_INTEGER, RONLY, var_extensible_vmstat, 1,
+         {SYSCONTEXT}},
+        {CPUUSER, ASN_INTEGER, RONLY, var_extensible_vmstat, 1, {CPUUSER}},
+        {CPUSYSTEM, ASN_INTEGER, RONLY, var_extensible_vmstat, 1,
+         {CPUSYSTEM}},
+        {CPUIDLE, ASN_INTEGER, RONLY, var_extensible_vmstat, 1, {CPUIDLE}},
+        {CPURAWUSER, ASN_COUNTER, RONLY, var_extensible_vmstat, 1,
+         {CPURAWUSER}},
+        {CPURAWNICE, ASN_COUNTER, RONLY, var_extensible_vmstat, 1,
+         {CPURAWNICE}},
+        {CPURAWSYSTEM, ASN_COUNTER, RONLY, var_extensible_vmstat, 1,
+         {CPURAWSYSTEM}},
+        {CPURAWIDLE, ASN_COUNTER, RONLY, var_extensible_vmstat, 1,
+         {CPURAWIDLE}},
+        {CPURAWKERNEL, ASN_COUNTER, RONLY, var_extensible_vmstat, 1,
+         {CPURAWKERNEL}},
+        {CPURAWINTR, ASN_COUNTER, RONLY, var_extensible_vmstat, 1,
+         {CPURAWINTR}},
+
+        /*
+         * Future use: 
+         */
+        /*
+         * {ERRORFLAG, ASN_INTEGER, RONLY, var_extensible_vmstat, 1, {ERRORFLAG }},
+         * {ERRORMSG, ASN_OCTET_STR, RONLY, var_extensible_vmstat, 1, {ERRORMSG }}
+         */
+    };
+
+    /*
+     * Define the OID pointer to the top of the mib tree that we're
+     * registering underneath 
+     */
+    oid             vmstat_variables_oid[] = { UCDAVIS_MIB, 11 };
+
+    /*
+     * register ourselves with the agent to handle our mib tree 
+     */
+    REGISTER_MIB("ucd-snmp/vmstat", extensible_vmstat_variables, variable2,
+                 vmstat_variables_oid);
+
+}
+
+
+long
+getuptime(void)
+{
+    static time_t   now, boottime;
+    time_t          uptime;
+
+    if (boottime == 0)
+        auto_nlist(BOOTTIME_SYMBOL, (char *) &boottime, sizeof(boottime));
+
+    time(&now);
+    uptime = now - boottime;
+
+    return (uptime);
+}
+
+unsigned char  *
+var_extensible_vmstat(struct variable *vp,
+                      oid * name,
+                      size_t * length,
+                      int exact,
+                      size_t * var_len, WriteMethod ** write_method)
+{
+
+    int             loop;
+
+    time_t          time_new = getuptime();
+    static time_t   time_old;
+    static time_t   time_diff;
+
+#if defined(KERN_CP_TIME)
+    static u_int64_t cpu_old[CPUSTATES];
+    static u_int64_t cpu_new[CPUSTATES];
+    static u_int64_t cpu_diff[CPUSTATES];
+    static u_int64_t cpu_total;
+#elif defined(KERN_CPTIME)
+    static long     cpu_old[CPUSTATES];
+    static long     cpu_new[CPUSTATES];
+    static long     cpu_diff[CPUSTATES];
+    static long     cpu_total;
+#else
+    static long     cpu_old[CPUSTATES];
+    static long     cpu_new[CPUSTATES];
+    static long     cpu_diff[CPUSTATES];
+    static long     cpu_total;
+#endif
+    long            cpu_sum;
+    double          cpu_prc;
+
+    static struct uvmexp mem_old, mem_new;
+    int             mem_mib[] = { CTL_VM, VM_UVMEXP };
+    int             mem_size = sizeof(struct uvmexp);
+
+    static long     long_ret;
+    static char     errmsg[300];
+
+    long_ret = 0;               /* set to 0 as default */
+
+    if (header_generic(vp, name, length, exact, var_len, write_method))
+        return (NULL);
+
+    /*
+     * Update structures (only if time has passed) 
+     */
+    if (time_new != time_old) {
+#ifdef KERN_CP_TIME
+        int             mib[2] = { CTL_KERN, KERN_CP_TIME };
+        int             ssize = sizeof(cpu_new);
+
+        if (sysctl(mib, 2, cpu_new, &ssize, NULL, 0) < 0)
+            memset(cpu_new, 0, sizeof(cpu_new));
+#elif defined(KERN_CPTIME)
+        int             mib[2] = { CTL_KERN, KERN_CPTIME };
+        int             ssize = sizeof(cpu_new);
+
+        if (sysctl(mib, 2, cpu_new, &ssize, NULL, 0) < 0)
+            memset(cpu_new, 0, sizeof(cpu_new));
+#else
+        /*
+         * CPU usage 
+         */
+        auto_nlist(CPTIME_SYMBOL, (char *) cpu_new, sizeof(cpu_new));
+#endif
+
+        time_diff = time_new - time_old;
+        time_old = time_new;
+
+        cpu_total = 0;
+
+        for (loop = 0; loop < CPUSTATES; loop++) {
+            cpu_diff[loop] = cpu_new[loop] - cpu_old[loop];
+            cpu_old[loop] = cpu_new[loop];
+            cpu_total += cpu_diff[loop];
+        }
+
+        if (cpu_total == 0)
+            cpu_total = 1;
+
+        /*
+         * Memory info 
+         */
+        mem_old = mem_new;
+        sysctl(mem_mib, 2, &mem_new, &mem_size, NULL, 0);
+    }
+
+    /*
+     * Rate macro 
+     */
+#define rate(x) (((x)+ time_diff/2) / time_diff)
+
+    /*
+     * Page-to-kb macro 
+     */
+#define ptok(p) ((p) * (mem_new.pagesize >> 10))
+
+    switch (vp->magic) {
+    case MIBINDEX:
+        long_ret = 1;
+        return ((u_char *) (&long_ret));
+    case ERRORNAME:            /* dummy name */
+        sprintf(errmsg, "systemStats");
+        *var_len = strlen(errmsg);
+        return ((u_char *) (errmsg));
+    case SWAPIN:
+        long_ret = ptok(mem_new.swapins - mem_old.swapins);
+        long_ret = rate(long_ret);
+        return ((u_char *) (&long_ret));
+    case SWAPOUT:
+        long_ret = ptok(mem_new.swapouts - mem_old.swapouts);
+        long_ret = rate(long_ret);
+        return ((u_char *) (&long_ret));
+    case IOSENT:
+#if NO_DUMMY_VALUES
+        return NULL;
+#endif
+        long_ret = -1;
+        return ((u_char *) (&long_ret));
+    case IORECEIVE:
+#if NO_DUMMY_VALUES
+        return NULL;
+#endif
+        long_ret = -1;
+        return ((u_char *) (&long_ret));
+    case SYSINTERRUPTS:
+        long_ret = rate(mem_new.intrs - mem_old.intrs);
+        return ((u_char *) (&long_ret));
+    case SYSCONTEXT:
+        long_ret = rate(mem_new.swtch - mem_old.swtch);
+        return ((u_char *) (&long_ret));
+    case CPUUSER:
+        cpu_sum = cpu_diff[CP_USER] + cpu_diff[CP_NICE];
+        cpu_prc = (float) cpu_sum / (float) cpu_total;
+        long_ret = cpu_prc * CPU_PRC;
+        return ((u_char *) (&long_ret));
+    case CPUSYSTEM:
+        cpu_sum = cpu_diff[CP_SYS] + cpu_diff[CP_INTR];
+        cpu_prc = (float) cpu_sum / (float) cpu_total;
+        long_ret = cpu_prc * CPU_PRC;
+        return ((u_char *) (&long_ret));
+    case CPUIDLE:
+        cpu_sum = cpu_diff[CP_IDLE];
+        cpu_prc = (float) cpu_sum / (float) cpu_total;
+        long_ret = cpu_prc * CPU_PRC;
+        return ((u_char *) (&long_ret));
+    case CPURAWUSER:
+        long_ret = cpu_new[CP_USER];
+        return ((u_char *) (&long_ret));
+    case CPURAWNICE:
+        long_ret = cpu_new[CP_NICE];
+        return ((u_char *) (&long_ret));
+    case CPURAWSYSTEM:
+        long_ret = cpu_new[CP_SYS] + cpu_new[CP_INTR];
+        return ((u_char *) (&long_ret));
+    case CPURAWIDLE:
+        long_ret = cpu_new[CP_IDLE];
+        return ((u_char *) (&long_ret));
+    case CPURAWKERNEL:
+        long_ret = cpu_new[CP_SYS];
+        return ((u_char *) (&long_ret));
+    case CPURAWINTR:
+        long_ret = cpu_new[CP_INTR];
+        return ((u_char *) (&long_ret));
+        /*
+         * reserved for future use 
+         */
+        /*
+         * case ERRORFLAG:
+         * return((u_char *) (&long_ret));
+         * case ERRORMSG:
+         * return((u_char *) (&long_ret));
+         */
+    }
+    return NULL;
+}
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/ucd-snmp/vmstat_netbsd1.h tomato121/release/src/router/snmp/agent/mibgroup/ucd-snmp/vmstat_netbsd1.h
--- tomato/release/src/router/snmp/agent/mibgroup/ucd-snmp/vmstat_netbsd1.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/ucd-snmp/vmstat_netbsd1.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,12 @@
+/*
+ *  vmstat mib groups
+ *
+ */
+#ifndef _MIBGROUP_VMSTAT_NETBSD1_H
+#define _MIBGROUP_VMSTAT_NETBSD1_H
+
+#include "mibdefs.h"
+
+void            init_vmstat_netbsd1(void);
+
+#endif                          /* _MIBGROUP_VMSTAT_NETBSD1_H */
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/ucd-snmp/vmstat_solaris2.c tomato121/release/src/router/snmp/agent/mibgroup/ucd-snmp/vmstat_solaris2.c
--- tomato/release/src/router/snmp/agent/mibgroup/ucd-snmp/vmstat_solaris2.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/ucd-snmp/vmstat_solaris2.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,887 @@
+/*
+ *  vmstat_solaris2.c
+ *  UCD SNMP module for systemStats section of UCD-SNMP-MIB for SunOS/Solaris
+ *  Jochen Kmietsch <kmietsch@jochen.de>
+ *  with fixes and additions from the UCD-SNMP community
+ *  Uses some ideas from xosview and top
+ *  Some comments paraphrased from the SUN man pages 
+ *  Version 0.1 initial release (Dec 1999)
+ *  Version 0.2 added support for multiprocessor machines (Jan 2000)
+ *  Version 0.3 some reliability enhancements and compile time fixes (Feb 2000)
+ *  Version 0.4 portability issue and raw cpu value support (Jun 2000)
+ *  Version 0.5 64-bit Solaris support and new data gathering routine (Aug 2000)
+ *  Version 0.6 Memory savings, overroll precautions and lint checks (Aug 2000)
+ *  Version 0.7 More raw counters and some cosmetic changes (Jan 2001)
+ *
+ */
+
+/*
+ * To make lint skip the debug code and stop complaining 
+ */
+#ifdef __lint
+#define SNMP_NO_DEBUGGING 1
+#endif
+
+/*
+ * Includes start here 
+ */
+
+/*
+ * Standard includes 
+ */
+#include <stdlib.h>
+#include <unistd.h>
+#include <sys/types.h>
+#include <sys/time.h>
+#include <string.h>
+
+/*
+ * kstat and sysinfo structs 
+ */
+#include <kstat.h>
+#include <sys/sysinfo.h>
+
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+#include "mibdefs.h"
+#include "util_funcs.h"
+
+/*
+ * Header file for this module 
+ */
+#include "vmstat.h"
+#include "vmstat_solaris2.h"
+
+/*
+ * Includes end here 
+ */
+
+
+/*
+ * Global structures start here 
+ */
+
+/*
+ * A structure to save data gathered from the kernel kstat interface to.  
+ */
+/*
+ * We used to have the sys/sysinfo.h cpu_stat_t here but we did not need 
+ */
+/*
+ * all of it, some in a different size and some additional ones so we build 
+ */
+/*
+ * our own 
+ */
+struct cpu_stat_snapshot {
+    hrtime_t        css_time;
+    unsigned int    css_cpus;
+    unsigned long long css_swapin;
+    unsigned long long css_swapout;
+    unsigned long long css_blocks_read;
+    unsigned long long css_blocks_write;
+    unsigned long long css_interrupts;
+    unsigned long long css_context_sw;
+    unsigned long long css_cpu[CPU_STATES];
+};
+
+/*
+ * Global structures end here 
+ */
+
+
+/*
+ * Global variables start here 
+ */
+
+/*
+ * From kstat.h: 
+ */
+/*
+ * Provides access to the kernel statistics library by 
+ */
+/*
+ * initializing a kstat control structure and returning a pointer 
+ */
+/*
+ * to this structure.  This pointer must be used as the kc argument in  
+ */
+/*
+ * following function calls from libkstat (here kc is called kstat_fd). 
+ */
+/*
+ * Pointer to structure to be opened with kstat_open in main procedure. 
+ */
+/*
+ * We share this one with memory_solaris2 and kernel_sunos5, where it's 
+ */
+/*
+ * defined. 
+ */
+extern kstat_ctl_t *kstat_fd;
+
+/*
+ * Variables for the calculated values, filled in update_stats    
+ */
+/*
+ * Need to be global since we need them in more than one function 
+ */
+static ulong    swapin;
+static ulong    swapout;
+static ulong    blocks_read;
+static ulong    blocks_write;
+static ulong    interrupts;
+static ulong    context_sw;
+
+/*
+ * Since MIB wants CPU_SYSTEM, which is CPU_KERNEL + CPU_WAIT 
+ */
+static long     cpu_perc[CPU_STATES + 1];
+
+/*
+ * How many snapshots we have already taken, needed for the first 
+ */
+/*
+ * POLL_INTERVAL * POLL_VALUES seconds of agent running 
+ */
+static unsigned int number_of_snapshots;
+
+/*
+ * The place to store the snapshots of system data in 
+ */
+static struct cpu_stat_snapshot snapshot[POLL_VALUES + 1];
+
+/*
+ * And one for the raw counters, which we fill when the raw values are 
+ */
+/*
+ * requested, as opposed to the absolute values, which are taken every 
+ */
+/*
+ * POLL_INTERVAL seconds and calculated over POLL_INTERVAL * POLL_VALUES time 
+ */
+static struct cpu_stat_snapshot raw_values;
+
+/*
+ * Global variables end here 
+ */
+
+
+/*
+ * Functions start here 
+ */
+
+/*
+ * Function prototype 
+ */
+static void     update_stats(unsigned int registrationNumber,
+                             void *clientarg);
+static int      take_snapshot(struct cpu_stat_snapshot *css);
+
+/*
+ * init_vmstat_solaris2 starts here 
+ */
+/*
+ * Init function for this module, from prototype 
+ */
+/*
+ * Defines variables handled by this module, defines root OID for 
+ */
+/*
+ * this module and registers it with the agent 
+ */
+
+FindVarMethod var_extensible_vmstat;
+
+void
+init_vmstat_solaris2(void)
+{
+
+    /*
+     * Which variables do we service ? 
+     */
+    struct variable2 extensible_vmstat_variables[] = {
+        {MIBINDEX, ASN_INTEGER, RONLY, var_extensible_vmstat, 1,
+         {MIBINDEX}},
+        {ERRORNAME, ASN_OCTET_STR, RONLY, var_extensible_vmstat, 1,
+         {ERRORNAME}},
+        {SWAPIN, ASN_INTEGER, RONLY, var_extensible_vmstat, 1, {SWAPIN}},
+        {SWAPOUT, ASN_INTEGER, RONLY, var_extensible_vmstat, 1, {SWAPOUT}},
+        {IOSENT, ASN_INTEGER, RONLY, var_extensible_vmstat, 1, {IOSENT}},
+        {IORECEIVE, ASN_INTEGER, RONLY, var_extensible_vmstat, 1,
+         {IORECEIVE}},
+        {SYSINTERRUPTS, ASN_INTEGER, RONLY, var_extensible_vmstat, 1,
+         {SYSINTERRUPTS}},
+        {SYSCONTEXT, ASN_INTEGER, RONLY, var_extensible_vmstat, 1,
+         {SYSCONTEXT}},
+        {CPUUSER, ASN_INTEGER, RONLY, var_extensible_vmstat, 1, {CPUUSER}},
+        {CPUSYSTEM, ASN_INTEGER, RONLY, var_extensible_vmstat, 1,
+         {CPUSYSTEM}},
+        {CPUIDLE, ASN_INTEGER, RONLY, var_extensible_vmstat, 1, {CPUIDLE}},
+        {CPURAWUSER, ASN_COUNTER, RONLY, var_extensible_vmstat, 1,
+         {CPURAWUSER}},
+        {CPURAWSYSTEM, ASN_COUNTER, RONLY, var_extensible_vmstat, 1,
+         {CPURAWSYSTEM}},
+        {CPURAWIDLE, ASN_COUNTER, RONLY, var_extensible_vmstat, 1,
+         {CPURAWIDLE}},
+        {CPURAWWAIT, ASN_COUNTER, RONLY, var_extensible_vmstat, 1,
+         {CPURAWWAIT}},
+        {CPURAWKERNEL, ASN_COUNTER, RONLY, var_extensible_vmstat, 1,
+         {CPURAWKERNEL}},
+        {IORAWSENT, ASN_COUNTER, RONLY, var_extensible_vmstat, 1,
+         {IORAWSENT}},
+        {IORAWRECEIVE, ASN_COUNTER, RONLY, var_extensible_vmstat, 1,
+         {IORAWRECEIVE}},
+        {SYSRAWINTERRUPTS, ASN_COUNTER, RONLY, var_extensible_vmstat, 1,
+         {SYSRAWINTERRUPTS}},
+        {SYSRAWCONTEXT, ASN_COUNTER, RONLY, var_extensible_vmstat, 1,
+         {SYSRAWCONTEXT}},
+        /*
+         * Future use: 
+         */
+        /*
+         * {ERRORFLAG, ASN_INTEGER, RONLY, var_extensible_vmstat, 1, {ERRORFLAG }},
+         * {ERRORMSG, ASN_OCTET_STR, RONLY, var_extensible_vmstat, 1, {ERRORMSG }}
+         */
+    };
+
+    /*
+     * Define the OID pointer to the top of the mib tree that we're 
+     */
+    /*
+     * registering underneath 
+     */
+    oid             vmstat_variables_oid[] = { UCDAVIS_MIB, 11 };
+
+    /*
+     * register ourselves with the agent to handle our mib tree 
+     */
+    /*
+     * LINTED Trust me, I know what I'm doing 
+     */
+    REGISTER_MIB("ucd-snmp/vmstat", extensible_vmstat_variables, variable2,
+                 vmstat_variables_oid);
+
+    /*
+     * First check whether shared kstat contol is NULL, if so, try to open our 
+     */
+    /*
+     * own. 
+     */
+    if (kstat_fd == NULL) {
+        kstat_fd = kstat_open();
+    }
+
+    /*
+     * Then check whether either shared kstat was found or we succeeded in 
+     */
+    /*
+     * opening our own. 
+     */
+    if (kstat_fd == NULL) {
+        snmp_log(LOG_ERR,
+                 "vmstat_solaris2 (init): kstat_open() failed and no shared kstat control found.\n");
+    }
+
+    /*
+     * Start with some useful data 
+     */
+    update_stats(0, NULL);
+
+    /*
+     * update_stats is run every POLL_INTERVAL seconds using this routine 
+     */
+    /*
+     * (see 'man snmp_alarm') 
+     */
+    /*
+     * This is only executed once to get some useful data in the beginning 
+     */
+    if (snmp_alarm_register(5, NULL, update_stats, NULL) == 0) {
+        snmp_log(LOG_WARNING,
+                 "vmstat_solaris2 (init): snmp_alarm_register failed.\n");
+    }
+    /*
+     * This is the one that runs update_stats every POLL_INTERVAL seconds 
+     */
+    if (snmp_alarm_register(POLL_INTERVAL, SA_REPEAT, update_stats, NULL)
+        == 0) {
+        snmp_log(LOG_ERR,
+                 "vmstat_solaris2 (init): snmp_alarm_register failed, cannot service requests.\n");
+    }
+
+}                               /* init_vmstat_solaris2 ends here */
+
+/*
+ * Data collection function take_snapshot starts here 
+ */
+/*
+ * Get data from kernel and save into the snapshot strutcs 
+ */
+/*
+ * Argument is the snapshot struct to save to. Global anyway, but looks nicer 
+ */
+static int
+take_snapshot(struct cpu_stat_snapshot *css)
+{
+    /*
+     * Variables start here 
+     */
+
+    /*
+     * From sys/kstat.h (included from kstat.h): 
+     */
+    /*
+     * Pointer to current kstat 
+     */
+    kstat_t        *ksp;
+
+    /*
+     * Counters 
+     */
+    unsigned int    cpu_num = 0;
+
+    /*
+     * High resolution time counter 
+     */
+    hrtime_t        current_time;
+
+    /*
+     * see sys/sysinfo.h, holds CPU data 
+     */
+    cpu_stat_t      cs;
+
+    /*
+     * The usual stuff to count on, err, by 
+     */
+    int             i;
+
+    /*
+     * Variables end here 
+     */
+
+    /*
+     * Function starts here 
+     */
+
+    /*
+     * Get time 
+     */
+    current_time = gethrtime();
+
+    /*
+     * If we have just gotten the data, return the values from last run (skip if-clause) 
+     */
+    /*
+     * This happens on a snmpwalk request.  No need to read the kstat again 
+     */
+    /*
+     * if we just did it less than 2 seconds ago 
+     */
+    /*
+     * Jumps into if-clause either when snapshot is empty or when too old 
+     */
+
+    if ((css->css_time == 0)
+        || (current_time > css->css_time + 2000000000)) {
+        /*
+         * Make sure we clean up before we put new data into snapshot 
+         */
+        memset(css, 0, sizeof *css);
+
+        /*
+         * Update timer 
+         */
+        css->css_time = current_time;
+
+        /*
+         * Look thru all the cpu slots on the machine whether they holds a CPU 
+         */
+        /*
+         * and if so, get the data from that CPU 
+         */
+        /*
+         * We walk through the whole kstat chain and sum up all the found cpu_stat kstats, 
+         */
+        /*
+         * there's one for every CPU in a machine 
+         */
+        for (ksp = kstat_fd->kc_chain; ksp != NULL; ksp = ksp->ks_next) {
+            /*
+             * If we encounter an invalid kstat, skip it and continue with next one 
+             */
+            if (ksp->ks_flags & KSTAT_FLAG_INVALID) {
+                continue;
+            }
+
+            if (strcmp(ksp->ks_module, "cpu_stat") == 0) {
+                /*
+                 * Yeah, we found a CPU. 
+                 */
+                cpu_num++;
+
+                /*
+                 * Read data from kstat into cs structure 
+                 */
+                /*
+                 * kstat_fd is the control structure, ksp the kstat we are reading 
+                 */
+                /*
+                 * and cs the buffer we are writing to. 
+                 */
+                if ((ksp->ks_type != KSTAT_TYPE_RAW) ||
+                    (ksp->ks_data_size != sizeof cs) ||
+                    (kstat_read(kstat_fd, ksp, &cs) == -1)) {
+                    snmp_log(LOG_ERR,
+                             "vmstat_solaris2 (take_snapshot): could not read cs structure.\n");
+                    return (-1);
+                }
+
+                /*
+                 * Get the data from the cs structure and sum it up in our own structure 
+                 */
+                css->css_swapin +=
+                    (unsigned long long) cs.cpu_vminfo.swapin;
+                css->css_swapout +=
+                    (unsigned long long) cs.cpu_vminfo.swapout;
+                css->css_blocks_read +=
+                    (unsigned long long) cs.cpu_sysinfo.bread;
+                css->css_blocks_write +=
+                    (unsigned long long) cs.cpu_sysinfo.bwrite;
+                css->css_interrupts +=
+                    (unsigned long long) cs.cpu_sysinfo.intr;
+                css->css_context_sw +=
+                    (unsigned long long) cs.cpu_sysinfo.pswitch;
+
+                /*
+                 * We need a for-loop for the CPU values 
+                 */
+                for (i = 0; i < CPU_STATES; i++) {
+                    css->css_cpu[i] +=
+                        (unsigned long long) cs.cpu_sysinfo.cpu[i];
+                }               /* end for */
+            }                   /* end if */
+        }                       /* end for */
+
+        /*
+         * Increment number of CPUs we gathered data from, for future use 
+         */
+        css->css_cpus = cpu_num;
+    }
+
+    /*
+     * All engines running at warp speed, no problems (if there are any engines, that is) 
+     */
+    return (cpu_num > 0 ? 0 : -1);
+}                               /* take_snapshot ends here */
+
+/*
+ * This gets called every POLL_INTERVAL seconds to update the snapshots.
+ * It takes a new snapshot and drops the oldest one.  This way we move
+ * the time window so we always take the values over 
+ * POLL_INTERVAL * POLL_VALUES seconds and update the data used every
+ * POLL_INTERVAL seconds 
+ * The alarm timer is in the init function of this module (snmp_alarm_register) 
+ */
+/*
+ * ARGSUSED0 
+ */
+static void
+update_stats(unsigned int registrationNumber, void *clientarg)
+{
+    /*
+     * The time between the samples we compare 
+     */
+    hrtime_t        time_diff;
+
+    /*
+     * Easier to use these than the snapshots, short hand pointers 
+     */
+    struct cpu_stat_snapshot *css_old, *css_new;
+
+    /*
+     * The usual stuff to count on, err, by 
+     */
+    int             i;
+
+    /*
+     * Kstat chain id, to check whether kstat chain changed 
+     */
+    kid_t           kid;
+
+    /*
+     * The sum of the CPU ticks that have passed on the different CPU states, so we can calculate 
+     */
+    /*
+     * the percentages of each state 
+     */
+    unsigned long long cpu_sum = 0;
+
+    DEBUGMSGTL(("ucd-snmp/vmstat_solaris2.c:update_stats",
+                "updating stats\n"));
+
+    /*
+     * Just in case someone added (or removed) some CPUs during operation (or other kstat chain changes) 
+     */
+    kid = kstat_chain_update(kstat_fd);
+    if (kid != 0) {
+        if (kid == -1) {
+            snmp_log(LOG_WARNING,
+                     "vmstat_solaris2 (update_stats): Could not update kstat chain.\n");
+        } else {
+            /*
+             * On some machines this floods the logfile, thus commented out 
+             */
+            /*
+             * snmp_log(LOG_INFO, "vmstat_solaris2 (update_stats): Kstat chain changed."); 
+             */
+        }
+    }
+
+    /*
+     * Take the current snapshot 
+     */
+    if (take_snapshot(&snapshot[0]) == -1) {
+        snmp_log(LOG_WARNING,
+                 "vmstat_solaris2 (update_stats): Something went wrong with take_snapshot.\n");
+        return;
+    }
+
+    /*
+     * Do we have some data we can use ?  An issue right after the start of the agent 
+     */
+    if (number_of_snapshots > 0) {
+        /*
+         * Huh, the number of CPUs changed during run time.  That is indeed s.th. worth noting, we 
+         */
+        /*
+         * output a humorous (more or less) syslog message and need to retake the snapshots 
+         */
+        if (snapshot[0].css_cpus != snapshot[1].css_cpus) {
+            if (snapshot[0].css_cpus > snapshot[1].css_cpus) {
+                snmp_log(LOG_NOTICE,
+                         "vmstat_solaris2 (update_stats): Cool ! Number of CPUs increased, must be hot-pluggable.\n");
+            } else {
+                snmp_log(LOG_NOTICE,
+                         "vmstat_solaris2 (update_stats): Lost at least one CPU, RIP.\n");
+            }
+            /*
+             * Make all snapshots but the current one invalid 
+             */
+            number_of_snapshots = 1;
+            /*
+             * Move the current one in the "first" [1] slot 
+             */
+            memmove(&snapshot[1], &snapshot[0], sizeof snapshot[0]);
+            /*
+             * Erase the current one 
+             */
+            memset(&snapshot[0], 0, sizeof snapshot[0]);
+            /*
+             * Try to get a new snapshot in five seconds so we can return s.th. useful 
+             */
+            if (snmp_alarm_register(5, NULL, update_stats, NULL) == 0) {
+                snmp_log(LOG_WARNING,
+                         "vmstat_solaris2 (update_stats): snmp_alarm_register failed.\n");
+            }
+            return;
+        }
+
+        /*
+         * Short hand pointers 
+         */
+        css_new = &snapshot[0];
+        css_old = &snapshot[number_of_snapshots];
+
+        /*
+         * How much time has passed between the snapshots we get the values from ? 
+         */
+        /*
+         * Time is in nanoseconds so a few zeros here to juggle with 
+         */
+        /*
+         * But the hrtime is not subject to change (s.b. setting the clock), unlike the normal time 
+         */
+        time_diff =
+            (snapshot[0].css_time -
+             snapshot[number_of_snapshots].css_time) / 1000000;
+
+        DEBUGMSGTL(("ucd-snmp/vmstat_solaris2.c:update_stats",
+                    "time_diff: %lld\n", time_diff));
+
+        /*
+         * swapin and swapout are in pages, MIB wants kB/s,so we just need to get kB and seconds 
+         */
+        /*
+         * For the others we need to get value per second 
+         */
+        /*
+         * getpagesize() returns pagesize in bytes 
+         */
+        /*
+         * decided to use sysconf(_SC_PAGESIZE) instead to get around an #ifndef (I don't like those) 
+         */
+        /*
+         * that was needed b/c some old Solaris versions don't have getpagesize() 
+         */
+        /*
+         * LINTED cast needed, really 
+         */
+        swapin =
+            (uint_t) ((css_new->css_swapin -
+                       css_old->css_swapin) * (hrtime_t) 1000 *
+                      sysconf(_SC_PAGESIZE) / 1024 / time_diff);
+        /*
+         * LINTED cast needed, really 
+         */
+        swapout =
+            (uint_t) ((css_new->css_swapout -
+                       css_old->css_swapout) * (hrtime_t) 1000 *
+                      sysconf(_SC_PAGESIZE) / 1024 / time_diff);
+        /*
+         * LINTED cast needed, really 
+         */
+        blocks_read =
+            (uint_t) ((css_new->css_blocks_read -
+                       css_old->css_blocks_read) * (hrtime_t) 1000 /
+                      time_diff);
+        /*
+         * LINTED cast needed, really 
+         */
+        blocks_write =
+            (uint_t) ((css_new->css_blocks_write -
+                       css_old->css_blocks_write) * (hrtime_t) 1000 /
+                      time_diff);
+        /*
+         * LINTED cast needed, really 
+         */
+        interrupts =
+            (uint_t) ((css_new->css_interrupts -
+                       css_old->css_interrupts) * (hrtime_t) 1000 /
+                      time_diff);
+        /*
+         * LINTED cast needed, really 
+         */
+        context_sw =
+            (uint_t) ((css_new->css_context_sw -
+                       css_old->css_context_sw) * (hrtime_t) 1000 /
+                      time_diff);
+
+        /*
+         * Loop thru all the CPU_STATES and get the differences 
+         */
+        for (i = 0; i < CPU_STATES; i++) {
+            cpu_sum += (css_new->css_cpu[i] - css_old->css_cpu[i]);
+        }
+
+        /*
+         * Now calculate the absolute percentage values 
+         */
+        /*
+         * Looks somewhat complicated sometimes but tries to get around using floats to increase speed 
+         */
+        for (i = 0; i < CPU_STATES; i++) {
+            /*
+             * Since we don't return fractions we use + 0.5 to get between 99 and 101 percent adding the values 
+             */
+            /*
+             * together, otherwise we would get less than 100 most of the time 
+             */
+            /*
+             * LINTED has to be 'long' 
+             */
+            cpu_perc[i] =
+                (long) (((css_new->css_cpu[i] -
+                          css_old->css_cpu[i]) * 100 +
+                         (cpu_sum / 2)) / cpu_sum);
+        }
+
+        /*
+         * As said before, MIB wants CPU_SYSTEM which is CPU_KERNEL + CPU_WAIT 
+         */
+        /*
+         * LINTED has to be 'long' 
+         */
+        cpu_perc[CPU_SYSTEM] =
+            (long) ((((css_new->css_cpu[CPU_KERNEL] -
+                       css_old->css_cpu[CPU_KERNEL])
+                      + (css_new->css_cpu[CPU_WAIT] -
+                         css_old->css_cpu[CPU_WAIT]))
+                     * 100 + (cpu_sum / 2)) / cpu_sum);
+    }
+
+    /*
+     * Make the current one the first one and move the whole thing one place down 
+     */
+    memmove(&snapshot[1], &snapshot[0],
+            (size_t) (((char *) &snapshot[POLL_VALUES]) -
+                      ((char *) &snapshot[0])));
+
+    /*
+     * Erase the current one 
+     */
+    memset(&snapshot[0], 0, sizeof snapshot[0]);
+
+    /*
+     * Only important on start up, we keep track of how many snapshots we have taken so far 
+     */
+    if (number_of_snapshots < POLL_VALUES) {
+        number_of_snapshots++;
+    }
+}                               /* update_stats ends here */
+
+/*
+ * *var_extensible_vmstat starts here 
+ */
+/*
+ * The guts of the module, this routine gets called to service a request 
+ */
+unsigned char *
+var_extensible_vmstat(struct variable *vp,
+                      oid * name,
+                      size_t * length,
+                      int exact,
+                      size_t * var_len, WriteMethod ** write_method)
+{
+    /*
+     * Needed for returning the values 
+     */
+    static long     long_ret;
+    static char     errmsg[300];
+
+    /*
+     * set to 0 as default 
+     */
+    long_ret = 0;
+
+    /*
+     * generic check whether the options passed make sense and whether the 
+     */
+    /*
+     * right variable is requested 
+     */
+    if (header_generic(vp, name, length, exact, var_len, write_method) !=
+        MATCH_SUCCEEDED) {
+        return (NULL);
+    }
+
+    /*
+     * The function that actually returns s.th. 
+     */
+    switch (vp->magic) {
+    case MIBINDEX:
+        long_ret = 1;
+        return ((u_char *) (&long_ret));
+    case ERRORNAME:            /* dummy name */
+        sprintf(errmsg, "systemStats");
+        *var_len = strlen(errmsg);
+        return ((u_char *) (errmsg));
+    case SWAPIN:
+        return ((u_char *) (&swapin));
+    case SWAPOUT:
+        return ((u_char *) (&swapout));
+    case IOSENT:
+        return ((u_char *) (&blocks_write));
+    case IORECEIVE:
+        return ((u_char *) (&blocks_read));
+    case SYSINTERRUPTS:
+        return ((u_char *) (&interrupts));
+    case SYSCONTEXT:
+        return ((u_char *) (&context_sw));
+    case CPUUSER:
+        return ((u_char *) (&cpu_perc[CPU_USER]));
+    case CPUSYSTEM:
+        return ((u_char *) (&cpu_perc[CPU_SYSTEM]));
+    case CPUIDLE:
+        return ((u_char *) (&cpu_perc[CPU_IDLE]));
+    case CPURAWUSER:
+        take_snapshot(&raw_values);
+        /*
+         * LINTED has to be 'long' 
+         */
+        long_ret =
+            (long) (raw_values.css_cpu[CPU_USER] / raw_values.css_cpus);
+        return ((u_char *) (&long_ret));
+        /*
+         * We are missing CPURAWNICE, Solaris does not account for this in the kernel so this OID can not 
+         */
+        /*
+         * be returned.  Also, these values will roll over sooner or later and then return inaccurate data 
+         */
+        /*
+         * but the MIB wants Integer32 so we cannot put a counter here 
+         */
+        /*
+         * (Has been changed to Counter32 in the latest MIB version!) 
+         */
+    case CPURAWSYSTEM:
+        take_snapshot(&raw_values);
+        /*
+         * LINTED has to be 'long' 
+         */
+        long_ret =
+            (long) ((raw_values.css_cpu[CPU_KERNEL] +
+                     raw_values.css_cpu[CPU_WAIT]) / raw_values.css_cpus);
+        return ((u_char *) (&long_ret));
+    case CPURAWIDLE:
+        take_snapshot(&raw_values);
+        /*
+         * LINTED has to be 'long' 
+         */
+        long_ret =
+            (long) (raw_values.css_cpu[CPU_IDLE] / raw_values.css_cpus);
+        return ((u_char *) (&long_ret));
+    case CPURAWWAIT:
+        take_snapshot(&raw_values);
+        /*
+         * LINTED has to be 'long' 
+         */
+        long_ret =
+            (long) (raw_values.css_cpu[CPU_WAIT] / raw_values.css_cpus);
+        return ((u_char *) (&long_ret));
+    case CPURAWKERNEL:
+        take_snapshot(&raw_values);
+        /*
+         * LINTED has to be 'long' 
+         */
+        long_ret =
+            (long) (raw_values.css_cpu[CPU_KERNEL] / raw_values.css_cpus);
+        return ((u_char *) (&long_ret));
+    case IORAWSENT:
+        long_ret = (long) (raw_values.css_blocks_write);
+        return ((u_char *) (&long_ret));
+    case IORAWRECEIVE:
+        long_ret = (long) (raw_values.css_blocks_read);
+        return ((u_char *) (&long_ret));
+    case SYSRAWINTERRUPTS:
+        long_ret = (long) (raw_values.css_interrupts);
+        return ((u_char *) (&long_ret));
+    case SYSRAWCONTEXT:
+        long_ret = (long) (raw_values.css_context_sw);
+        return ((u_char *) (&long_ret));
+
+        /*
+         * reserved for future use 
+         */
+        /*
+         * case ERRORFLAG:
+         * return((u_char *) (&long_ret));
+         * case ERRORMSG:
+         * return((u_char *) (&long_ret));
+         */
+    default:
+        snmp_log(LOG_ERR,
+                 "vmstat_solaris2: Error in request, no match found.\n");
+    }
+    return (NULL);
+}                               /* *var_extensible_vmstat ends here */
+
+/*
+ * Functions end here 
+ */
+
+/*
+ * Program ends here 
+ */
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/ucd-snmp/vmstat_solaris2.h tomato121/release/src/router/snmp/agent/mibgroup/ucd-snmp/vmstat_solaris2.h
--- tomato/release/src/router/snmp/agent/mibgroup/ucd-snmp/vmstat_solaris2.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/ucd-snmp/vmstat_solaris2.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,60 @@
+/*
+ *  vmstat_solaris2.h
+ *  Header file for vmstat_solaris2 module for UCD-SNMP
+ *  Jochen Kmietsch <kmietsch@jochen.de>
+ *  see vmstat_solaris2.c for revision history and additional comments
+ *
+ */
+
+/*
+ * Prevent accidental double inclusions 
+ */
+#ifndef _MIBGROUP_VMSTAT_SOLARIS2_H
+#define _MIBGROUP_VMSTAT_SOLARIS2_H
+
+/*
+ * The following statements are used by the configure script 
+ */
+/*
+ * Dependency requirements 
+ */
+config_arch_require(solaris2, kernel_sunos5)
+
+    /*
+     * Directive to include utility module 
+     */
+config_require(util_funcs)
+
+    /*
+     * MIB wants CPU_SYSTEM which is sysinfo CPU_KERNEL + CPU_WAIT 
+     */
+#define CPU_SYSTEM 4
+    /*
+     * Time interval to gather system data 
+     */
+    /*
+     * Lower value -> more accurate data, higher value -> less CPU usage 
+     */
+    /*
+     * Value is in seconds 
+     */
+#define POLL_INTERVAL 60
+    /*
+     * How many snapshots of system data to keep.  Values returned are over 
+     */
+    /*
+     * time difference between first and last snapshot 
+     */
+    /*
+     * Using POLL_INTERVAL 60 and POLL_VALUES 5 we get the values 
+     */
+    /*
+     * over five minutes, which is a reasonable figure 
+     */
+#define POLL_VALUES    5
+    /*
+     * Declared in vmstat_solaris2.c, from prototype 
+     */
+     void            init_vmstat_solaris2(void);
+
+#endif                          /* _MIBGROUP_VMSTAT_SOLARIS2_H */
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/ucd_snmp.h tomato121/release/src/router/snmp/agent/mibgroup/ucd_snmp.h
--- tomato/release/src/router/snmp/agent/mibgroup/ucd_snmp.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/ucd_snmp.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,48 @@
+/* module to include the various ucd-snmp specific extension modules. */
+config_require(ucd-snmp/proc)
+config_require(ucd-snmp/versioninfo)
+config_require(ucd-snmp/pass)
+config_require(ucd-snmp/pass_persist)
+config_require(ucd-snmp/disk)
+config_require(ucd-snmp/loadave)
+config_require(ucd-snmp/extensible)
+config_require(ucd-snmp/errormib)
+config_require(ucd-snmp/file)
+config_require(ucd-snmp/dlmod)
+config_require(ucd-snmp/proxy)
+config_arch_require(linux, ucd-snmp/memory)
+config_arch_require(linux, ucd-snmp/vmstat)
+config_arch_require(hpux9, ucd-snmp/memory)
+config_arch_require(hpux9, ucd-snmp/hpux)
+config_arch_require(hpux10, ucd-snmp/memory_hpux)
+config_arch_require(hpux10, ucd-snmp/vmstat_hpux)
+config_arch_require(hpux10, ucd-snmp/hpux)
+config_arch_require(hpux11, ucd-snmp/memory_hpux)
+config_arch_require(hpux11, ucd-snmp/vmstat_hpux)
+config_arch_require(hpux11, ucd-snmp/hpux)
+config_arch_require(solaris2, ucd-snmp/vmstat_solaris2)
+config_arch_require(solaris2, ucd-snmp/memory_solaris2)
+config_arch_require(bsdi2, ucd-snmp/memory)
+config_arch_require(bsdi3, ucd-snmp/memory)
+config_arch_require(bsdi4, ucd-snmp/memory)
+config_arch_require(bsdi4, ucd-snmp/vmstat_bsdi4)
+config_arch_require(freebsd2, ucd-snmp/vmstat_freebsd2)
+config_arch_require(freebsd2, ucd-snmp/memory_freebsd2)
+config_arch_require(freebsd3, ucd-snmp/vmstat_freebsd2)
+config_arch_require(freebsd3, ucd-snmp/memory_freebsd2)
+config_arch_require(freebsd4, ucd-snmp/vmstat_freebsd2)
+config_arch_require(freebsd4, ucd-snmp/memory_freebsd2)
+config_arch_require(freebsd5, ucd-snmp/vmstat_freebsd2)
+config_arch_require(freebsd5, ucd-snmp/memory_freebsd2)
+config_arch_require(netbsd1, ucd-snmp/vmstat_netbsd1)
+config_arch_require(netbsd1, ucd-snmp/memory_netbsd1)
+config_arch_require(openbsd2, ucd-snmp/vmstat_netbsd1)
+config_arch_require(openbsd2, ucd-snmp/memory_netbsd1)
+config_arch_require(openbsd3, ucd-snmp/vmstat_netbsd1)
+config_arch_require(openbsd3, ucd-snmp/memory_netbsd1)
+config_arch_require(darwin1, ucd-snmp/vmstat_freebsd2)
+config_arch_require(darwin1, ucd-snmp/memory_freebsd2)
+config_arch_require(dynix, ucd-snmp/vmstat_dynix)
+config_arch_require(dynix, ucd-snmp/memory_dynix)
+config_add_mib(UCD-SNMP-MIB)
+config_add_mib(UCD-DEMO-MIB)
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/util_funcs.c tomato121/release/src/router/snmp/agent/mibgroup/util_funcs.c
--- tomato/release/src/router/snmp/agent/mibgroup/util_funcs.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/util_funcs.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,971 @@
+/*
+ * util_funcs.c
+ */
+
+#include <net-snmp/net-snmp-config.h>
+
+#if HAVE_IO_H
+#include <io.h>
+#endif
+#include <stdio.h>
+#if HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#if HAVE_MALLOC_H
+#include <malloc.h>
+#endif
+#include <sys/types.h>
+#ifdef __alpha
+#ifndef _BSD
+#define _BSD
+#define _myBSD
+#endif
+#endif
+#if HAVE_SYS_WAIT_H
+# include <sys/wait.h>
+#endif
+#ifdef __alpha
+#ifdef _myBSD
+#undef _BSD
+#undef _myBSD
+#endif
+#endif
+#ifndef WEXITSTATUS
+# define WEXITSTATUS(stat_val) ((unsigned)(stat_val) >> 8)
+#endif
+#ifndef WIFEXITED
+# define WIFEXITED(stat_val) (((stat_val) & 255) == 0)
+#endif
+#if TIME_WITH_SYS_TIME
+# ifdef WIN32
+#  include <sys/timeb.h>
+# else
+#  include <sys/time.h>
+# endif
+# include <time.h>
+#else
+# if HAVE_SYS_TIME_H
+#  include <sys/time.h>
+# else
+#  include <time.h>
+# endif
+#endif
+#if HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#if HAVE_FCNTL_H
+#include <fcntl.h>
+#endif
+#include <errno.h>
+#include <signal.h>
+#if HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+#include <ctype.h>
+#if HAVE_WINSOCK_H
+#include <winsock.h>
+#endif
+#if HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+#if HAVE_BASETSD_H
+#include <basetsd.h>
+#define ssize_t SSIZE_T
+#endif
+#if HAVE_RAISE
+#define alarm raise
+#endif
+
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+#include "struct.h"
+#include "util_funcs.h"
+
+#if HAVE_LIMITS_H
+#include "limits.h"
+#endif
+#ifdef USING_UCD_SNMP_ERRORMIB_MODULE
+#include "ucd-snmp/errormib.h"
+#else
+#define setPerrorstatus(x) snmp_log_perror(x)
+#endif
+
+
+#ifdef EXCACHETIME
+static long     cachetime;
+#endif
+
+extern int      numprocs, numextens;
+
+void
+Exit(int var)
+{
+    snmp_log(LOG_ERR, "Server Exiting with code %d\n", var);
+    exit(var);
+}
+
+static const char *
+make_tempfile(void)
+{
+    static char     name[32];
+    int             fd = -1;
+
+    strcpy(name, "/tmp/snmpdXXXXXX");
+#ifdef HAVE_MKSTEMP
+    fd = mkstemp(name);
+#else
+    if (mktemp(name))
+        fd = open(name, O_CREAT | O_EXCL | O_WRONLY);
+#endif
+    if (fd >= 0) {
+        close(fd);
+        return name;
+    }
+    return NULL;
+}
+
+int
+shell_command(struct extensible *ex)
+{
+#if HAVE_SYSTEM
+    const char     *ofname;
+    char            shellline[STRMAX];
+    FILE           *shellout;
+
+    ofname = make_tempfile();
+    if (ofname == NULL) {
+        ex->output[0] = 0;
+        ex->result = 127;
+        return ex->result;
+    }
+
+    snprintf(shellline, sizeof(shellline), "%s > %s", ex->command, ofname);
+    shellline[ sizeof(shellline)-1 ] = 0;
+    ex->result = system(shellline);
+    ex->result = WEXITSTATUS(ex->result);
+    shellout = fopen(ofname, "r");
+    if (shellout != NULL) {
+        if (fgets(ex->output, sizeof(ex->output), shellout) == NULL) {
+            ex->output[0] = 0;
+        }
+        fclose(shellout);
+    }
+    unlink(ofname);
+#else
+    ex->output[0] = 0;
+    ex->result = 0;
+#endif
+    return (ex->result);
+}
+
+#define MAXOUTPUT 300
+
+int
+exec_command(struct extensible *ex)
+{
+#if HAVE_EXECV
+    int             fd;
+    FILE           *file;
+
+    if ((fd = get_exec_output(ex)) != -1) {
+        file = fdopen(fd, "r");
+        if (fgets(ex->output, sizeof(ex->output), file) == NULL) {
+            ex->output[0] = 0;
+        }
+        fclose(file);
+        wait_on_exec(ex);
+    } else
+#endif
+    {
+        ex->output[0] = 0;
+        ex->result = 0;
+    }
+    return (ex->result);
+}
+
+void
+wait_on_exec(struct extensible *ex)
+{
+#ifndef EXCACHETIME
+    if (ex->pid && waitpid(ex->pid, &ex->result, 0) < 0) {
+        setPerrorstatus("waitpid");
+    }
+    ex->pid = 0;
+#endif
+}
+
+#define MAXARGS 30
+
+int
+get_exec_output(struct extensible *ex)
+{
+#if HAVE_EXECV
+    int             fd[2], i, cnt;
+    char            ctmp[STRMAX], *cptr1, *cptr2, argvs[STRMAX], **argv,
+        **aptr;
+#ifdef EXCACHETIME
+    char            cachefile[STRMAX];
+    char            cache[MAXCACHESIZE];
+    ssize_t         cachebytes;
+    long            curtime;
+    static char     lastcmd[STRMAX];
+    int             cfd;
+    static int      lastresult;
+    int             readcount;
+#endif
+
+#ifdef EXCACHETIME
+    sprintf(cachefile, "%s/%s", get_persistent_directory(), CACHEFILE);
+    curtime = time(NULL);
+    if (curtime > (cachetime + EXCACHETIME) ||
+        strcmp(ex->command, lastcmd) != 0) {
+        strcpy(lastcmd, ex->command);
+        cachetime = curtime;
+#endif
+        if (pipe(fd)) {
+            setPerrorstatus("pipe");
+#ifdef EXCACHETIME
+            cachetime = 0;
+#endif
+            return -1;
+        }
+        if ((ex->pid = fork()) == 0) {
+            close(1);
+            if (dup(fd[1]) != 1) {
+                setPerrorstatus("dup");
+                return -1;
+            }
+
+            /*
+             * write standard output and standard error to pipe. 
+             */
+            /*
+             * close all other file descriptors. 
+             */
+            for (cnt = getdtablesize() - 1; cnt >= 2; --cnt)
+                (void) close(cnt);
+            (void) dup(1);      /* stderr */
+
+            /*
+             * set standard input to /dev/null 
+             */
+            close(0);
+            (void) open("/dev/null", O_RDWR);
+
+            for (cnt = 1, cptr1 = ex->command, cptr2 = argvs;
+                 cptr1 && *cptr1 != 0; cptr2++, cptr1++) {
+                *cptr2 = *cptr1;
+                if (*cptr1 == ' ') {
+                    *(cptr2++) = 0;
+                    if ((cptr1 = skip_white(cptr1)) == NULL)
+                        break;
+                    if (cptr1) {
+                        *cptr2 = *cptr1;
+                        if (*cptr1 != 0)
+                            cnt++;
+                    }
+                }
+            }
+            *cptr2 = 0;
+            *(cptr2 + 1) = 0;
+            argv = (char **) malloc((cnt + 2) * sizeof(char *));
+            if (argv == NULL)
+                return 0;       /* memory alloc error */
+            aptr = argv;
+            *(aptr++) = argvs;
+            for (cptr2 = argvs, i = 1; i != cnt; cptr2++)
+                if (*cptr2 == 0) {
+                    *(aptr++) = cptr2 + 1;
+                    i++;
+                }
+            while (*cptr2 != 0)
+                cptr2++;
+            *(aptr++) = NULL;
+            copy_nword(ex->command, ctmp, sizeof(ctmp));
+            execv(ctmp, argv);
+            perror(ctmp);
+            exit(1);
+        } else {
+            close(fd[1]);
+            if (ex->pid < 0) {
+                close(fd[0]);
+                setPerrorstatus("fork");
+#ifdef EXCACHETIME
+                cachetime = 0;
+#endif
+                return -1;
+            }
+#ifdef EXCACHETIME
+            unlink(cachefile);
+            /*
+             * XXX  Use SNMP_FILEMODE_CLOSED instead of 644? 
+             */
+            if ((cfd =
+                 open(cachefile, O_WRONLY | O_TRUNC | O_CREAT,
+                      0644)) < 0) {
+                setPerrorstatus(cachefile);
+                cachetime = 0;
+                return -1;
+            }
+            fcntl(fd[0], F_SETFL, O_NONBLOCK);  /* don't block on reads */
+#ifdef HAVE_USLEEP
+            for (readcount = 0; readcount <= MAXREADCOUNT * 100 &&
+                 (cachebytes = read(fd[0], (void *) cache, MAXCACHESIZE));
+                 readcount++) {
+#else
+            for (readcount = 0; readcount <= MAXREADCOUNT &&
+                 (cachebytes = read(fd[0], (void *) cache, MAXCACHESIZE));
+                 readcount++) {
+#endif
+                if (cachebytes > 0)
+                    write(cfd, (void *) cache, cachebytes);
+                else if (cachebytes == -1 && errno != EAGAIN) {
+                    setPerrorstatus("read");
+                    break;
+                } else
+#ifdef HAVE_USLEEP
+                    usleep(10000);      /* sleeps for 0.01 sec */
+#else
+                    sleep(1);
+#endif
+            }
+            close(cfd);
+            close(fd[0]);
+            /*
+             * wait for the child to finish 
+             */
+            if (ex->pid > 0 && waitpid(ex->pid, &ex->result, 0) < 0) {
+                setPerrorstatus("waitpid()");
+                cachetime = 0;
+                return -1;
+            }
+            ex->pid = 0;
+            ex->result = WEXITSTATUS(ex->result);
+            lastresult = ex->result;
+#else                           /* !EXCACHETIME */
+            return (fd[0]);
+#endif
+        }
+#ifdef EXCACHETIME
+    } else {
+        ex->result = lastresult;
+    }
+    if ((cfd = open(cachefile, O_RDONLY)) < 0) {
+        setPerrorstatus(cachefile);
+        return -1;
+    }
+    return (cfd);
+#endif
+
+#else                           /* !HAVE_EXECV */
+    return -1;
+#endif
+}
+
+int
+get_exec_pipes(char *cmd, int *fdIn, int *fdOut, int *pid)
+{
+#if HAVE_EXECV
+    int             fd[2][2], i, cnt;
+    char            ctmp[STRMAX], *cptr1, *cptr2, argvs[STRMAX], **argv,
+        **aptr;
+    /*
+     * Setup our pipes 
+     */
+    if (pipe(fd[0]) || pipe(fd[1])) {
+        setPerrorstatus("pipe");
+        return 0;
+    }
+    if ((*pid = fork()) == 0) { /* First handle for the child */
+        close(0);
+        if (dup(fd[0][0]) != 0) {
+            setPerrorstatus("dup 0");
+            return 0;
+        }
+        close(1);
+        if (dup(fd[1][1]) != 1) {
+            setPerrorstatus("dup 1");
+            return 0;
+        }
+
+        /*
+         * write standard output and standard error to pipe. 
+         */
+        /*
+         * close all non-standard open file descriptors 
+         */
+        for (cnt = getdtablesize() - 1; cnt >= 2; --cnt)
+            (void) close(cnt);
+        (void) dup(1);          /* stderr */
+
+        for (cnt = 1, cptr1 = cmd, cptr2 = argvs; *cptr1 != 0;
+             cptr2++, cptr1++) {
+            *cptr2 = *cptr1;
+            if (*cptr1 == ' ') {
+                *(cptr2++) = 0;
+                if ((cptr1 = skip_white(cptr1)) == NULL)
+                    break;
+                *cptr2 = *cptr1;
+                if (*cptr1 != 0)
+                    cnt++;
+            }
+        }
+        *cptr2 = 0;
+        *(cptr2 + 1) = 0;
+        argv = (char **) malloc((cnt + 2) * sizeof(char *));
+        if (argv == NULL)
+            return 0;           /* memory alloc error */
+        aptr = argv;
+        *(aptr++) = argvs;
+        for (cptr2 = argvs, i = 1; i != cnt; cptr2++)
+            if (*cptr2 == 0) {
+                *(aptr++) = cptr2 + 1;
+                i++;
+            }
+        while (*cptr2 != 0)
+            cptr2++;
+        *(aptr++) = NULL;
+        copy_nword(cmd, ctmp, sizeof(ctmp));
+        execv(ctmp, argv);
+        perror(ctmp);
+        exit(1);
+    } else {
+        close(fd[0][0]);
+        close(fd[1][1]);
+        if (*pid < 0) {
+            close(fd[0][1]);
+            close(fd[1][0]);
+            setPerrorstatus("fork");
+            return 0;
+        }
+        *fdIn = fd[1][0];
+        *fdOut = fd[0][1];
+        return (1);             /* We are returning 0 for error... */
+    }
+#endif                          /* !HAVE_EXECV */
+    return 0;
+}
+
+int
+clear_cache(int action,
+            u_char * var_val,
+            u_char var_val_type,
+            size_t var_val_len,
+            u_char * statP, oid * name, size_t name_len)
+{
+
+    long            tmp = 0;
+
+    if (var_val_type != ASN_INTEGER) {
+        snmp_log(LOG_NOTICE, "Wrong type != int\n");
+        return SNMP_ERR_WRONGTYPE;
+    }
+    tmp = *((long *) var_val);
+    if (tmp == 1 && action == COMMIT) {
+#ifdef EXCACHETIME
+        cachetime = 0;          /* reset the cache next read */
+#endif
+    }
+    return SNMP_ERR_NOERROR;
+}
+
+char          **argvrestartp, *argvrestartname, *argvrestart;
+
+RETSIGTYPE
+restart_doit(int a)
+{
+    snmp_shutdown("snmpd");
+
+    /*
+     * do the exec 
+     */
+#if HAVE_EXECV
+    execv(argvrestartname, argvrestartp);
+    setPerrorstatus(argvrestartname);
+#endif
+}
+
+int
+restart_hook(int action,
+             u_char * var_val,
+             u_char var_val_type,
+             size_t var_val_len,
+             u_char * statP, oid * name, size_t name_len)
+{
+
+    long            tmp = 0;
+
+    if (var_val_type != ASN_INTEGER) {
+        snmp_log(LOG_NOTICE, "Wrong type != int\n");
+        return SNMP_ERR_WRONGTYPE;
+    }
+    tmp = *((long *) var_val);
+    if (tmp == 1 && action == COMMIT) {
+#ifdef SIGALRM
+        signal(SIGALRM, restart_doit);
+#endif
+        alarm(RESTARTSLEEP);
+    }
+    return SNMP_ERR_NOERROR;
+}
+
+void
+print_mib_oid(oid name[], size_t len)
+{
+    char           *buffer;
+    buffer = (char *) malloc(11 * len); /* maximum digit lengths for int32 + a '.' */
+    if (!buffer) {
+        snmp_log(LOG_ERR, "Malloc failed - out of memory?");
+        return;
+    }
+    sprint_mib_oid(buffer, name, len);
+    snmp_log(LOG_NOTICE, "Mib: %s\n", buffer);
+    free(buffer);
+}
+
+void
+sprint_mib_oid(char *buf, oid name[], size_t len)
+{
+    int             i;
+    for (i = 0; i < (int) len; i++) {
+        sprintf(buf, ".%d", (int) name[i]);
+        while (*buf != 0)
+            buf++;
+    }
+}
+
+/*******************************************************************-o-******
+ * header_simple_table
+ *
+ * Parameters:
+ *	  *vp		 Variable data.
+ *	  *name		 Fully instantiated OID name.
+ *	  *length	 Length of name.
+ *	   exact	 TRUE if an exact match is desired.
+ *	  *var_len	 Hook for size of returned data type.
+ *	(**write_method) Hook for write method (UNUSED).
+ *	   max
+ *      
+ * Returns:
+ *	0	If name matches vp->name (accounting for 'exact') and is
+ *			not greater in length than 'max'.
+ *	1	Otherwise.
+ *
+ *
+ * Compare 'name' to vp->name for the best match or an exact match (if
+ *	requested).  Also check that 'name' is not longer than 'max' if
+ *	max is greater-than/equal 0.
+ * Store a successful match in 'name', and increment the OID instance if
+ *	the match was not exact.  
+ *
+ * 'name' and 'length' are undefined upon failure.
+ *
+ */
+int
+header_simple_table(struct variable *vp, oid * name, size_t * length,
+                    int exact, size_t * var_len,
+                    WriteMethod ** write_method, int max)
+{
+    int             i, rtest;   /* Set to:      -1      If name < vp->name,
+                                 *              1       If name > vp->name,
+                                 *              0       Otherwise.
+                                 */
+    oid             newname[MAX_OID_LEN];
+
+    for (i = 0, rtest = 0;
+         i < (int) vp->namelen && i < (int) (*length) && !rtest; i++) {
+        if (name[i] != vp->name[i]) {
+            if (name[i] < vp->name[i])
+                rtest = -1;
+            else
+                rtest = 1;
+        }
+    }
+    if (rtest > 0 ||
+        (exact == 1
+         && (rtest || (int) *length != (int) (vp->namelen + 1)))) {
+        if (var_len)
+            *var_len = 0;
+        return MATCH_FAILED;
+    }
+
+    memset(newname, 0, sizeof(newname));
+
+    if (((int) *length) <= (int) vp->namelen || rtest == -1) {
+        memmove(newname, vp->name, (int) vp->namelen * sizeof(oid));
+        newname[vp->namelen] = 1;
+        *length = vp->namelen + 1;
+    } else if (((int) *length) > (int) vp->namelen + 1) {       /* exact case checked earlier */
+        *length = vp->namelen + 1;
+        memmove(newname, name, (*length) * sizeof(oid));
+        if (name[*length - 1] < ULONG_MAX) {
+            newname[*length - 1] = name[*length - 1] + 1;
+        } else {
+            /*
+             * Careful not to overflow...  
+             */
+            newname[*length - 1] = name[*length - 1];
+        }
+    } else {
+        *length = vp->namelen + 1;
+        memmove(newname, name, (*length) * sizeof(oid));
+        if (!exact) {
+            if (name[*length - 1] < ULONG_MAX) {
+                newname[*length - 1] = name[*length - 1] + 1;
+            } else {
+                /*
+                 * Careful not to overflow...  
+                 */
+                newname[*length - 1] = name[*length - 1];
+            }
+        } else {
+            newname[*length - 1] = name[*length - 1];
+        }
+    }
+    if ((max >= 0 && (newname[*length - 1] > max)) ||
+               ( 0 == newname[*length - 1] )) {
+        if (var_len)
+            *var_len = 0;
+        return MATCH_FAILED;
+    }
+
+    memmove(name, newname, (*length) * sizeof(oid));
+    if (write_method)
+        *write_method = 0;
+    if (var_len)
+        *var_len = sizeof(long);        /* default */
+    return (MATCH_SUCCEEDED);
+}
+
+/*
+ * header_generic(...
+ * Arguments:
+ * vp     IN      - pointer to variable entry that points here
+ * name    IN/OUT  - IN/name requested, OUT/name found
+ * length  IN/OUT  - length of IN/OUT oid's 
+ * exact   IN      - TRUE if an exact match was requested
+ * var_len OUT     - length of variable or 0 if function returned
+ * write_method
+ * 
+ */
+
+/*******************************************************************-o-******
+ * generic_header
+ *
+ * Parameters:
+ *	  *vp	   (I)     Pointer to variable entry that points here.
+ *	  *name	   (I/O)   Input name requested, output name found.
+ *	  *length  (I/O)   Length of input and output oid's.
+ *	   exact   (I)     TRUE if an exact match was requested.
+ *	  *var_len (O)     Length of variable or 0 if function returned.
+ *	(**write_method)   Hook to name a write method (UNUSED).
+ *      
+ * Returns:
+ *	MATCH_SUCCEEDED	If vp->name matches name (accounting for exact bit).
+ *	MATCH_FAILED	Otherwise,
+ *
+ *
+ * Check whether variable (vp) matches name.
+ */
+int
+header_generic(struct variable *vp,
+               oid * name,
+               size_t * length,
+               int exact, size_t * var_len, WriteMethod ** write_method)
+{
+    oid             newname[MAX_OID_LEN];
+    int             result;
+
+    DEBUGMSGTL(("util_funcs", "header_generic: "));
+    DEBUGMSGOID(("util_funcs", name, *length));
+    DEBUGMSG(("util_funcs", " exact=%d\n", exact));
+
+    memcpy((char *) newname, (char *) vp->name,
+           (int) vp->namelen * sizeof(oid));
+    newname[vp->namelen] = 0;
+    result = snmp_oid_compare(name, *length, newname, vp->namelen + 1);
+    DEBUGMSGTL(("util_funcs", "  result: %d\n", result));
+    if ((exact && (result != 0)) || (!exact && (result >= 0)))
+        return (MATCH_FAILED);
+    memcpy((char *) name, (char *) newname,
+           ((int) vp->namelen + 1) * sizeof(oid));
+    *length = vp->namelen + 1;
+
+    *write_method = 0;
+    *var_len = sizeof(long);    /* default to 'long' results */
+    return (MATCH_SUCCEEDED);
+}
+
+/*
+ * checkmib(): provided for backwards compatibility, do not use: 
+ */
+int
+checkmib(struct variable *vp, oid * name, size_t * length,
+         int exact, size_t * var_len, WriteMethod ** write_method, int max)
+{
+    /*
+     * checkmib used to be header_simple_table, with reveresed boolean
+     * return output.  header_simple_table() was created to match
+     * header_generic(). 
+     */
+    return (!header_simple_table(vp, name, length, exact, var_len,
+                                 write_method, max));
+}
+
+char           *
+find_field(char *ptr, int field)
+{
+    int             i;
+    char           *init = ptr;
+
+    if (field == LASTFIELD) {
+        /*
+         * skip to end 
+         */
+        while (*ptr++);
+        ptr = ptr - 2;
+        /*
+         * rewind a field length 
+         */
+        while (*ptr != 0 && isspace(*ptr) && init <= ptr)
+            ptr--;
+        while (*ptr != 0 && !isspace(*ptr) && init <= ptr)
+            ptr--;
+        if (isspace(*ptr))
+            ptr++;              /* past space */
+        if (ptr < init)
+            ptr = init;
+        if (!isspace(*ptr) && *ptr != 0)
+            return (ptr);
+    } else {
+        if ((ptr = skip_white(ptr)) == NULL)
+            return (NULL);
+        for (i = 1; *ptr != 0 && i != field; i++) {
+            if ((ptr = skip_not_white(ptr)) == NULL)
+                return (NULL);
+            if ((ptr = skip_white(ptr)) == NULL)
+                return (NULL);
+        }
+        if (*ptr != 0 && i == field)
+            return (ptr);
+        return (NULL);
+    }
+    return (NULL);
+}
+
+int
+parse_miboid(const char *buf, oid * oidout)
+{
+    int             i;
+
+    if (!buf)
+        return 0;
+    if (*buf == '.')
+        buf++;
+    for (i = 0; isdigit(*buf); i++) {
+        oidout[i] = atoi(buf);
+        while (isdigit(*buf++));
+        if (*buf == '.')
+            buf++;
+    }
+    /*
+     * oidout[i] = -1; hmmm 
+     */
+    return i;
+}
+
+void
+string_append_int(char *s, int val)
+{
+    char            textVal[16];
+
+    if (val < 10) {
+        *s++ = '0' + val;
+        *s = '\0';
+        return;
+    }
+    sprintf(textVal, "%d", val);
+    strcpy(s, textVal);
+    return;
+}
+
+struct internal_mib_table {
+    int             max_size;   /* Size of the current data table */
+    int             next_index; /* Index of the next free entry */
+    int             current_index;      /* Index of the 'current' entry */
+    int             cache_timeout;
+    marker_t        cache_marker;
+    RELOAD         *reload;     /* Routine to read in the data */
+    COMPARE        *compare;    /* Routine to compare two entries */
+    int             data_size;  /* Size of an individual entry */
+    void           *data;       /* The table itself */
+};
+
+mib_table_t
+Initialise_Table(int size, int timeout, RELOAD reload, COMPARE compare)
+{
+    struct internal_mib_table *t;
+
+    t = (struct internal_mib_table *)
+        malloc(sizeof(struct internal_mib_table));
+    if (t == NULL)
+        return NULL;
+
+    t->max_size = 0;
+    t->next_index = 1;          /* Don't use index 0 */
+    t->current_index = 1;
+    t->cache_timeout = timeout;
+    t->cache_marker = NULL;
+    t->reload = reload;
+    t->compare = compare;
+    t->data_size = size;
+    t->data = NULL;
+
+    return (mib_table_t) t;
+}
+
+#define TABLE_ADD( x, y )	((void*)((char*)(x) + y))
+#define TABLE_INDEX(t, i)	(TABLE_ADD(t->data, i * t->data_size))
+#define TABLE_START(t)		(TABLE_INDEX(t, 1))
+#define TABLE_NEXT(t)		(TABLE_INDEX(t, t->next_index))
+#define TABLE_CURRENT(t)	(TABLE_INDEX(t, t->current_index))
+
+int
+check_and_reload_table(struct internal_mib_table *table)
+{
+    /*
+     * If the saved data is fairly recent,
+     *    we don't need to reload it
+     */
+    if (table->cache_marker &&
+        !(atime_ready(table->cache_marker, table->cache_timeout * 1000)))
+        return 1;
+
+
+    /*
+     * Call the routine provided to read in the data
+     *
+     * N.B:  Update the cache marker *before* calling
+     *   this routine, to avoid problems with recursion
+     */
+    if (!table->cache_marker)
+        table->cache_marker = atime_newMarker();
+    else
+        atime_setMarker(table->cache_marker);
+
+    table->next_index = 1;
+    if (table->reload((mib_table_t) table) < 0) {
+        free(table->cache_marker);
+        table->cache_marker = NULL;
+        return 0;
+    }
+    table->current_index = 1;
+    if (table->compare != NULL) /* Sort the table */
+        qsort(TABLE_START(table), table->next_index,
+              table->data_size, table->compare);
+    return 1;
+}
+
+int
+Search_Table(mib_table_t t, void *entry, int exact)
+{
+    struct internal_mib_table *table = (struct internal_mib_table *) t;
+    void           *entry2;
+    int             res;
+
+    if (!check_and_reload_table(table))
+        return -1;
+
+    if (table->compare == NULL) {
+        /*
+         * XXX - not sure this is right ? 
+         */
+        memcpy(entry, table->data, table->data_size);
+        return 0;
+    }
+
+    if (table->next_index == table->current_index)
+        table->current_index = 1;
+
+    entry2 = TABLE_CURRENT(table);
+    res = table->compare(entry, entry2);
+    if ((res < 0) && (table->current_index != 1)) {
+        table->current_index = 1;
+        entry2 = TABLE_CURRENT(table);
+        res = table->compare(entry, entry2);
+    }
+
+    while (res > 0) {
+        table->current_index++;
+        if (table->next_index == table->current_index)
+            return -1;
+        entry2 = TABLE_CURRENT(table);
+        res = table->compare(entry, entry2);
+    }
+
+    if (exact && res != 0)
+        return -1;
+
+    if (!exact && res == 0) {
+        table->current_index++;
+        if (table->next_index == table->current_index)
+            return -1;
+        entry2 = TABLE_CURRENT(table);
+    }
+    memcpy(entry, entry2, table->data_size);
+    return 0;
+}
+
+int
+Add_Entry(mib_table_t t, void *entry)
+{
+    struct internal_mib_table *table = (struct internal_mib_table *) t;
+    int             new_max;
+    void           *new_data;   /* Used for
+                                 *      a) extending the data table
+                                 *      b) the next entry to use
+                                 */
+
+    if (table->max_size <= table->next_index) {
+        /*
+         * Table is full, so extend it to double the size
+         */
+        new_max = 2 * table->max_size;
+        if (new_max == 0)
+            new_max = 10;       /* Start with 10 entries */
+
+        new_data = (void *) malloc(new_max * table->data_size);
+        if (new_data == NULL)
+            return -1;
+
+        if (table->data) {
+            memcpy(new_data, table->data,
+                   table->max_size * table->data_size);
+            free(table->data);
+        }
+        table->data = new_data;
+        table->max_size = new_max;
+    }
+
+    /*
+     * Insert the new entry into the data array
+     */
+    new_data = TABLE_NEXT(table);
+    memcpy(new_data, entry, table->data_size);
+    table->next_index++;
+    return 0;
+}
+
+void           *
+Retrieve_Table_Data(mib_table_t t, int *max_idx)
+{
+    struct internal_mib_table *table = (struct internal_mib_table *) t;
+
+    if (!check_and_reload_table(table))
+        return NULL;
+    *max_idx = table->next_index - 1;
+    return table->data;
+}
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/util_funcs.h tomato121/release/src/router/snmp/agent/mibgroup/util_funcs.h
--- tomato/release/src/router/snmp/agent/mibgroup/util_funcs.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/util_funcs.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,53 @@
+/*
+ *  util_funcs.h:  utilitiy functions for extensible groups.
+ */
+#ifndef _MIBGROUP_UTIL_FUNCS_H
+#define _MIBGROUP_UTIL_FUNCS_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "struct.h"
+
+void            Exit(int);
+int             shell_command(struct extensible *);
+int             exec_command(struct extensible *);
+int             get_exec_output(struct extensible *);
+int             get_exec_pipes(char *cmd, int *fdIn, int *fdOut, int *pid);
+WriteMethod     clear_cache;
+RETSIGTYPE      restart_doit(int);
+WriteMethod     restart_hook;
+void            print_mib_oid(oid *, size_t);
+void            sprint_mib_oid(char *, oid *, size_t);
+int             header_simple_table(struct variable *, oid *, size_t *,
+                                    int, size_t *,
+                                    WriteMethod ** write_method, int);
+int             header_generic(struct variable *, oid *, size_t *, int,
+                               size_t *, WriteMethod **);
+int             checkmib(struct variable *, oid *, size_t *, int, size_t *,
+                         WriteMethod ** write_method, int);
+char           *find_field(char *, int);
+int             parse_miboid(const char *, oid *);
+void            string_append_int(char *, int);
+void            wait_on_exec(struct extensible *);
+
+#define     satosin(x)      ((struct sockaddr_in *) &(x))
+#define     SOCKADDR(x)     (satosin(x)->sin_addr.s_addr)
+#ifndef MIB_STATS_CACHE_TIMEOUT
+#define MIB_STATS_CACHE_TIMEOUT 5
+#endif
+
+typedef void   *mib_table_t;
+typedef int     (RELOAD) (mib_table_t);
+typedef int     (COMPARE) (const void *, const void *);
+mib_table_t     Initialise_Table(int, int, RELOAD, COMPARE);
+int             Search_Table(mib_table_t, void *, int);
+int             Add_Entry(mib_table_t, void *);
+void           *Retrieve_Table_Data(mib_table_t, int *);
+
+#ifdef __cplusplus
+};
+#endif
+
+#endif                          /* _MIBGROUP_UTIL_FUNCS_H */
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/utilities/.cvsignore tomato121/release/src/router/snmp/agent/mibgroup/utilities/.cvsignore
--- tomato/release/src/router/snmp/agent/mibgroup/utilities/.cvsignore	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/utilities/.cvsignore	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,3 @@
+*.lo
+Makefile
+.libs
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/utilities/override.c tomato121/release/src/router/snmp/agent/mibgroup/utilities/override.c
--- tomato/release/src/router/snmp/agent/mibgroup/utilities/override.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/utilities/override.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,191 @@
+/** allows overriding of a given oid with a new type and value */
+
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+#include "util_funcs.h"
+
+typedef struct override_data_s {
+    int             type;
+    void           *value;
+    size_t          value_len;
+} override_data;
+
+/** @todo: (optionally) save values persistently when configured for
+ *  read-write */
+int
+override_handler(netsnmp_mib_handler *handler,
+                 netsnmp_handler_registration *reginfo,
+                 netsnmp_agent_request_info *reqinfo,
+                 netsnmp_request_info *requests)
+{
+
+    override_data  *data = handler->myvoid;
+    if (!data) {
+        netsnmp_set_request_error(reqinfo, requests, SNMP_ERR_GENERR);
+        return SNMP_ERR_NOERROR;
+    }
+
+    switch (reqinfo->mode) {
+    case MODE_GET:
+        DEBUGMSGTL(("override", "overriding oid "));
+        DEBUGMSGOID(("override", requests->requestvb->name,
+                     requests->requestvb->name_length));
+        DEBUGMSG(("override", "\n"));
+        snmp_set_var_typed_value(requests->requestvb, data->type,
+                                 (u_char *) data->value, data->value_len);
+        break;
+
+    default:
+        snmp_log(LOG_ERR, "unsupported mode in override handler");
+        break;
+    }
+    return SNMP_ERR_NOERROR;
+}
+
+#define MALLOC_OR_DIE(x) \
+  thedata->value = malloc(x); \
+  thedata->value_len = x; \
+  if (!thedata->value) { \
+      free(thedata); \
+      config_perror("memory allocation failure"); \
+      return; \
+  }
+
+void
+netsnmp_parse_override(const char *token, char *line)
+{
+    char           *cp;
+    char            buf[SNMP_MAXBUF];
+    int             readwrite = 0;
+    oid             oidbuf[MAX_OID_LEN];
+    size_t          oidbuf_len = sizeof(oidbuf);
+    int             type;
+    override_data  *thedata;
+    netsnmp_handler_registration *the_reg;
+
+    cp = copy_nword(line, buf, sizeof(buf) - 1);
+    if (strcmp(buf, "-rw") == 0) {
+        readwrite = 1;
+        cp = copy_nword(cp, buf, sizeof(buf) - 1);
+    }
+
+    if (!cp) {
+        config_perror("no oid specified");
+        return;
+    }
+
+    if (!snmp_parse_oid(buf, oidbuf, &oidbuf_len)) {
+        config_perror("illegal oid");
+        return;
+    }
+    cp = copy_nword(cp, buf, sizeof(buf) - 1);
+
+    if (!cp && strcmp(buf, "null") != 0) {
+        config_perror("no variable value specified");
+        return;
+    }
+
+    type = se_find_value_in_slist("asntypes", buf);
+    if (!type) {
+        config_perror("unknown type specified");
+        return;
+    }
+
+    if (cp)
+        copy_nword(cp, buf, sizeof(buf) - 1);
+    else
+        buf[0] = 0;
+
+    thedata = SNMP_MALLOC_TYPEDEF(override_data);
+    thedata->type = type;
+    if (!thedata) {
+        config_perror("memory allocation failure");
+        return;
+    }
+
+    switch (type) {
+    case ASN_INTEGER:
+        MALLOC_OR_DIE(sizeof(long));
+        *((long *) thedata->value) = strtol(buf, NULL, 0);
+        break;
+
+    case ASN_COUNTER:
+    case ASN_UNSIGNED:
+        MALLOC_OR_DIE(sizeof(u_long));
+        *((u_long *) thedata->value) = strtoul(buf, NULL, 0);
+        break;
+
+    case ASN_OCTET_STR:
+    case ASN_BIT_STR:
+        if (buf[0] == '0' && buf[1] == 'x') {
+            /*
+             * hex 
+             */
+            thedata->value_len =
+                hex_to_binary2(buf + 2, strlen(buf) - 2,
+                               (char **) &thedata->value);
+        } else {
+            thedata->value = strdup(buf);
+            thedata->value_len = strlen(buf);
+        }
+        break;
+
+    case ASN_OBJECT_ID:
+        read_config_read_objid(buf, (oid **) & thedata->value,
+                               &thedata->value_len);
+        break;
+
+    case ASN_NULL:
+        thedata->value_len = 0;
+        break;
+
+    default:
+        config_perror("illegal/unsupported type specified");
+        return;
+    }
+
+    if (!thedata->value && thedata->type != ASN_NULL) {
+        config_perror("memory allocation failure");
+        free(thedata);
+        return;
+    }
+
+    the_reg = SNMP_MALLOC_TYPEDEF(netsnmp_handler_registration);
+    if (!the_reg) {
+        config_perror("memory allocation failure");
+        free(thedata);
+        return;
+    }
+
+    the_reg->priority = 255;
+    the_reg->modes = (readwrite) ? HANDLER_CAN_RWRITE : HANDLER_CAN_RONLY;
+    the_reg->handler =
+        netsnmp_create_handler("override", override_handler);
+    memdup((u_char **) & the_reg->rootoid, (const u_char *) oidbuf,
+           oidbuf_len * sizeof(oid));
+    the_reg->rootoid_len = oidbuf_len;
+    if (!the_reg->rootoid) {
+        config_perror("memory allocation failure");
+        free(thedata);
+        return;
+    }
+    the_reg->handler->myvoid = thedata;
+
+    if (netsnmp_register_instance(the_reg)) {
+        config_perror("oid registration failed within the agent");
+        SNMP_FREE(thedata->value);
+        free(thedata);
+        return;
+    }
+}
+
+
+void
+init_override(void)
+{
+
+    snmpd_register_config_handler("override", netsnmp_parse_override, NULL,     /* XXX: free func */
+                                  "[-rw] mibnode type value");
+}
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/utilities/override.h tomato121/release/src/router/snmp/agent/mibgroup/utilities/override.h
--- tomato/release/src/router/snmp/agent/mibgroup/utilities/override.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/utilities/override.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,7 @@
+#ifndef OVERRIDE_H
+#define OVERRIDE_H
+
+Netsnmp_Node_Handler override_handler;
+void init_override(void);
+
+#endif                          /* OVERRIDE_H */
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/utilities.h tomato121/release/src/router/snmp/agent/mibgroup/utilities.h
--- tomato/release/src/router/snmp/agent/mibgroup/utilities.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/utilities.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1 @@
+config_require(utilities/override)
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/v2party/.cvsignore tomato121/release/src/router/snmp/agent/mibgroup/v2party/.cvsignore
--- tomato/release/src/router/snmp/agent/mibgroup/v2party/.cvsignore	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/v2party/.cvsignore	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,2 @@
+.libs
+*.lo
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/vestinternett/.cvsignore tomato121/release/src/router/snmp/agent/mibgroup/vestinternett/.cvsignore
--- tomato/release/src/router/snmp/agent/mibgroup/vestinternett/.cvsignore	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/vestinternett/.cvsignore	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,2 @@
+.libs
+*.lo
diff -Naur tomato/release/src/router/snmp/agent/mibgroup/wireless.h tomato121/release/src/router/snmp/agent/mibgroup/wireless.h
--- tomato/release/src/router/snmp/agent/mibgroup/wireless.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mibgroup/wireless.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,1069 @@
+/*
+ * This file define a set of standard wireless extensions
+ *
+ * Version :	19	18.3.05
+ *
+ * Authors :	Jean Tourrilhes - HPL - <jt@hpl.hp.com>
+ * Copyright (c) 1997-2005 Jean Tourrilhes, All Rights Reserved.
+ */
+
+#ifndef _LINUX_WIRELESS_H
+#define _LINUX_WIRELESS_H
+
+/************************** DOCUMENTATION **************************/
+/*
+ * Initial APIs (1996 -> onward) :
+ * -----------------------------
+ * Basically, the wireless extensions are for now a set of standard ioctl
+ * call + /proc/net/wireless
+ *
+ * The entry /proc/net/wireless give statistics and information on the
+ * driver.
+ * This is better than having each driver having its entry because
+ * its centralised and we may remove the driver module safely.
+ *
+ * Ioctl are used to configure the driver and issue commands.  This is
+ * better than command line options of insmod because we may want to
+ * change dynamically (while the driver is running) some parameters.
+ *
+ * The ioctl mechanimsm are copied from standard devices ioctl.
+ * We have the list of command plus a structure descibing the
+ * data exchanged...
+ * Note that to add these ioctl, I was obliged to modify :
+ *	# net/core/dev.c (two place + add include)
+ *	# net/ipv4/af_inet.c (one place + add include)
+ *
+ * /proc/net/wireless is a copy of /proc/net/dev.
+ * We have a structure for data passed from the driver to /proc/net/wireless
+ * Too add this, I've modified :
+ *	# net/core/dev.c (two other places)
+ *	# include/linux/netdevice.h (one place)
+ *	# include/linux/proc_fs.h (one place)
+ *
+ * New driver API (2002 -> onward) :
+ * -------------------------------
+ * This file is only concerned with the user space API and common definitions.
+ * The new driver API is defined and documented in :
+ *	# include/net/iw_handler.h
+ *
+ * Note as well that /proc/net/wireless implementation has now moved in :
+ *	# net/core/wireless.c
+ *
+ * Wireless Events (2002 -> onward) :
+ * --------------------------------
+ * Events are defined at the end of this file, and implemented in :
+ *	# net/core/wireless.c
+ *
+ * Other comments :
+ * --------------
+ * Do not add here things that are redundant with other mechanisms
+ * (drivers init, ifconfig, /proc/net/dev, ...) and with are not
+ * wireless specific.
+ *
+ * These wireless extensions are not magic : each driver has to provide
+ * support for them...
+ *
+ * IMPORTANT NOTE : As everything in the kernel, this is very much a
+ * work in progress. Contact me if you have ideas of improvements...
+ */
+
+/***************************** INCLUDES *****************************/
+
+/* Do not put any header in this file, this creates a mess when
+ * exported to user space. Most users have included all the
+ * relevant headers anyway... Jean II */
+/*#include <linux/types.h>*/		/* for "caddr_t" et al		*/
+/*#include <linux/socket.h>*/		/* for "struct sockaddr" et al	*/
+/*#include <linux/if.h>*/		/* for IFNAMSIZ and co... */
+
+/***************************** VERSION *****************************/
+/*
+ * This constant is used to know the availability of the wireless
+ * extensions and to know which version of wireless extensions it is
+ * (there is some stuff that will be added in the future...)
+ * I just plan to increment with each new version.
+ */
+#define WIRELESS_EXT	19
+
+/*
+ * Changes :
+ *
+ * V2 to V3
+ * --------
+ *	Alan Cox start some incompatibles changes. I've integrated a bit more.
+ *	- Encryption renamed to Encode to avoid US regulation problems
+ *	- Frequency changed from float to struct to avoid problems on old 386
+ *
+ * V3 to V4
+ * --------
+ *	- Add sensitivity
+ *
+ * V4 to V5
+ * --------
+ *	- Missing encoding definitions in range
+ *	- Access points stuff
+ *
+ * V5 to V6
+ * --------
+ *	- 802.11 support (ESSID ioctls)
+ *
+ * V6 to V7
+ * --------
+ *	- define IW_ESSID_MAX_SIZE and IW_MAX_AP
+ *
+ * V7 to V8
+ * --------
+ *	- Changed my e-mail address
+ *	- More 802.11 support (nickname, rate, rts, frag)
+ *	- List index in frequencies
+ *
+ * V8 to V9
+ * --------
+ *	- Support for 'mode of operation' (ad-hoc, managed...)
+ *	- Support for unicast and multicast power saving
+ *	- Change encoding to support larger tokens (>64 bits)
+ *	- Updated iw_params (disable, flags) and use it for NWID
+ *	- Extracted iw_point from iwreq for clarity
+ *
+ * V9 to V10
+ * ---------
+ *	- Add PM capability to range structure
+ *	- Add PM modifier : MAX/MIN/RELATIVE
+ *	- Add encoding option : IW_ENCODE_NOKEY
+ *	- Add TxPower ioctls (work like TxRate)
+ *
+ * V10 to V11
+ * ----------
+ *	- Add WE version in range (help backward/forward compatibility)
+ *	- Add retry ioctls (work like PM)
+ *
+ * V11 to V12
+ * ----------
+ *	- Add SIOCSIWSTATS to get /proc/net/wireless programatically
+ *	- Add DEV PRIVATE IOCTL to avoid collisions in SIOCDEVPRIVATE space
+ *	- Add new statistics (frag, retry, beacon)
+ *	- Add average quality (for user space calibration)
+ *
+ * V12 to V13
+ * ----------
+ *	- Document creation of new driver API.
+ *	- Extract union iwreq_data from struct iwreq (for new driver API).
+ *	- Rename SIOCSIWNAME as SIOCSIWCOMMIT
+ *
+ * V13 to V14
+ * ----------
+ *	- Wireless Events support : define struct iw_event
+ *	- Define additional specific event numbers
+ *	- Add "addr" and "param" fields in union iwreq_data
+ *	- AP scanning stuff (SIOCSIWSCAN and friends)
+ *
+ * V14 to V15
+ * ----------
+ *	- Add IW_PRIV_TYPE_ADDR for struct sockaddr private arg
+ *	- Make struct iw_freq signed (both m & e), add explicit padding
+ *	- Add IWEVCUSTOM for driver specific event/scanning token
+ *	- Add IW_MAX_GET_SPY for driver returning a lot of addresses
+ *	- Add IW_TXPOW_RANGE for range of Tx Powers
+ *	- Add IWEVREGISTERED & IWEVEXPIRED events for Access Points
+ *	- Add IW_MODE_MONITOR for passive monitor
+ *
+ * V15 to V16
+ * ----------
+ *	- Increase the number of bitrates in iw_range to 32 (for 802.11g)
+ *	- Increase the number of frequencies in iw_range to 32 (for 802.11b+a)
+ *	- Reshuffle struct iw_range for increases, add filler
+ *	- Increase IW_MAX_AP to 64 for driver returning a lot of addresses
+ *	- Remove IW_MAX_GET_SPY because conflict with enhanced spy support
+ *	- Add SIOCSIWTHRSPY/SIOCGIWTHRSPY and "struct iw_thrspy"
+ *	- Add IW_ENCODE_TEMP and iw_range->encoding_login_index
+ *
+ * V16 to V17
+ * ----------
+ *	- Add flags to frequency -> auto/fixed
+ *	- Document (struct iw_quality *)->updated, add new flags (INVALID)
+ *	- Wireless Event capability in struct iw_range
+ *	- Add support for relative TxPower (yick !)
+ *
+ * V17 to V18 (From Jouni Malinen <jkmaline@cc.hut.fi>)
+ * ----------
+ *	- Add support for WPA/WPA2
+ *	- Add extended encoding configuration (SIOCSIWENCODEEXT and
+ *	  SIOCGIWENCODEEXT)
+ *	- Add SIOCSIWGENIE/SIOCGIWGENIE
+ *	- Add SIOCSIWMLME
+ *	- Add SIOCSIWPMKSA
+ *	- Add struct iw_range bit field for supported encoding capabilities
+ *	- Add optional scan request parameters for SIOCSIWSCAN
+ *	- Add SIOCSIWAUTH/SIOCGIWAUTH for setting authentication and WPA
+ *	  related parameters (extensible up to 4096 parameter values)
+ *	- Add wireless events: IWEVGENIE, IWEVMICHAELMICFAILURE,
+ *	  IWEVASSOCREQIE, IWEVASSOCRESPIE, IWEVPMKIDCAND
+ *
+ * V18 to V19
+ * ----------
+ *	- Remove (struct iw_point *)->pointer from events and streams
+ *	- Remove header includes to help user space
+ *	- Increase IW_ENCODING_TOKEN_MAX from 32 to 64
+ *	- Add IW_QUAL_ALL_UPDATED and IW_QUAL_ALL_INVALID macros
+ *	- Add explicit flag to tell stats are in dBm : IW_QUAL_DBM
+ *	- Add IW_IOCTL_IDX() and IW_EVENT_IDX() macros
+ */
+
+/**************************** CONSTANTS ****************************/
+
+/* -------------------------- IOCTL LIST -------------------------- */
+
+/* Wireless Identification */
+#define SIOCSIWCOMMIT	0x8B00		/* Commit pending changes to driver */
+#define SIOCGIWNAME	0x8B01		/* get name == wireless protocol */
+/* SIOCGIWNAME is used to verify the presence of Wireless Extensions.
+ * Common values : "IEEE 802.11-DS", "IEEE 802.11-FH", "IEEE 802.11b"...
+ * Don't put the name of your driver there, it's useless. */
+
+/* Basic operations */
+#define SIOCSIWNWID	0x8B02		/* set network id (pre-802.11) */
+#define SIOCGIWNWID	0x8B03		/* get network id (the cell) */
+#define SIOCSIWFREQ	0x8B04		/* set channel/frequency (Hz) */
+#define SIOCGIWFREQ	0x8B05		/* get channel/frequency (Hz) */
+#define SIOCSIWMODE	0x8B06		/* set operation mode */
+#define SIOCGIWMODE	0x8B07		/* get operation mode */
+#define SIOCSIWSENS	0x8B08		/* set sensitivity (dBm) */
+#define SIOCGIWSENS	0x8B09		/* get sensitivity (dBm) */
+
+/* Informative stuff */
+#define SIOCSIWRANGE	0x8B0A		/* Unused */
+#define SIOCGIWRANGE	0x8B0B		/* Get range of parameters */
+#define SIOCSIWPRIV	0x8B0C		/* Unused */
+#define SIOCGIWPRIV	0x8B0D		/* get private ioctl interface info */
+#define SIOCSIWSTATS	0x8B0E		/* Unused */
+#define SIOCGIWSTATS	0x8B0F		/* Get /proc/net/wireless stats */
+/* SIOCGIWSTATS is strictly used between user space and the kernel, and
+ * is never passed to the driver (i.e. the driver will never see it). */
+
+/* Spy support (statistics per MAC address - used for Mobile IP support) */
+#define SIOCSIWSPY	0x8B10		/* set spy addresses */
+#define SIOCGIWSPY	0x8B11		/* get spy info (quality of link) */
+#define SIOCSIWTHRSPY	0x8B12		/* set spy threshold (spy event) */
+#define SIOCGIWTHRSPY	0x8B13		/* get spy threshold */
+
+/* Access Point manipulation */
+#define SIOCSIWAP	0x8B14		/* set access point MAC addresses */
+#define SIOCGIWAP	0x8B15		/* get access point MAC addresses */
+#define SIOCGIWAPLIST	0x8B17		/* Deprecated in favor of scanning */
+#define SIOCSIWSCAN	0x8B18		/* trigger scanning (list cells) */
+#define SIOCGIWSCAN	0x8B19		/* get scanning results */
+
+/* 802.11 specific support */
+#define SIOCSIWESSID	0x8B1A		/* set ESSID (network name) */
+#define SIOCGIWESSID	0x8B1B		/* get ESSID */
+#define SIOCSIWNICKN	0x8B1C		/* set node name/nickname */
+#define SIOCGIWNICKN	0x8B1D		/* get node name/nickname */
+/* As the ESSID and NICKN are strings up to 32 bytes long, it doesn't fit
+ * within the 'iwreq' structure, so we need to use the 'data' member to
+ * point to a string in user space, like it is done for RANGE... */
+
+/* Other parameters useful in 802.11 and some other devices */
+#define SIOCSIWRATE	0x8B20		/* set default bit rate (bps) */
+#define SIOCGIWRATE	0x8B21		/* get default bit rate (bps) */
+#define SIOCSIWRTS	0x8B22		/* set RTS/CTS threshold (bytes) */
+#define SIOCGIWRTS	0x8B23		/* get RTS/CTS threshold (bytes) */
+#define SIOCSIWFRAG	0x8B24		/* set fragmentation thr (bytes) */
+#define SIOCGIWFRAG	0x8B25		/* get fragmentation thr (bytes) */
+#define SIOCSIWTXPOW	0x8B26		/* set transmit power (dBm) */
+#define SIOCGIWTXPOW	0x8B27		/* get transmit power (dBm) */
+#define SIOCSIWRETRY	0x8B28		/* set retry limits and lifetime */
+#define SIOCGIWRETRY	0x8B29		/* get retry limits and lifetime */
+
+/* Encoding stuff (scrambling, hardware security, WEP...) */
+#define SIOCSIWENCODE	0x8B2A		/* set encoding token & mode */
+#define SIOCGIWENCODE	0x8B2B		/* get encoding token & mode */
+/* Power saving stuff (power management, unicast and multicast) */
+#define SIOCSIWPOWER	0x8B2C		/* set Power Management settings */
+#define SIOCGIWPOWER	0x8B2D		/* get Power Management settings */
+
+/* WPA : Generic IEEE 802.11 informatiom element (e.g., for WPA/RSN/WMM).
+ * This ioctl uses struct iw_point and data buffer that includes IE id and len
+ * fields. More than one IE may be included in the request. Setting the generic
+ * IE to empty buffer (len=0) removes the generic IE from the driver. Drivers
+ * are allowed to generate their own WPA/RSN IEs, but in these cases, drivers
+ * are required to report the used IE as a wireless event, e.g., when
+ * associating with an AP. */
+#define SIOCSIWGENIE	0x8B30		/* set generic IE */
+#define SIOCGIWGENIE	0x8B31		/* get generic IE */
+
+/* WPA : IEEE 802.11 MLME requests */
+#define SIOCSIWMLME	0x8B16		/* request MLME operation; uses
+					 * struct iw_mlme */
+/* WPA : Authentication mode parameters */
+#define SIOCSIWAUTH	0x8B32		/* set authentication mode params */
+#define SIOCGIWAUTH	0x8B33		/* get authentication mode params */
+
+/* WPA : Extended version of encoding configuration */
+#define SIOCSIWENCODEEXT 0x8B34		/* set encoding token & mode */
+#define SIOCGIWENCODEEXT 0x8B35		/* get encoding token & mode */
+
+/* WPA2 : PMKSA cache management */
+#define SIOCSIWPMKSA	0x8B36		/* PMKSA cache operation */
+
+/* -------------------- DEV PRIVATE IOCTL LIST -------------------- */
+
+/* These 32 ioctl are wireless device private, for 16 commands.
+ * Each driver is free to use them for whatever purpose it chooses,
+ * however the driver *must* export the description of those ioctls
+ * with SIOCGIWPRIV and *must* use arguments as defined below.
+ * If you don't follow those rules, DaveM is going to hate you (reason :
+ * it make mixed 32/64bit operation impossible).
+ */
+#define SIOCIWFIRSTPRIV	0x8BE0
+#define SIOCIWLASTPRIV	0x8BFF
+/* Previously, we were using SIOCDEVPRIVATE, but we now have our
+ * separate range because of collisions with other tools such as
+ * 'mii-tool'.
+ * We now have 32 commands, so a bit more space ;-).
+ * Also, all 'odd' commands are only usable by root and don't return the
+ * content of ifr/iwr to user (but you are not obliged to use the set/get
+ * convention, just use every other two command). More details in iwpriv.c.
+ * And I repeat : you are not forced to use them with iwpriv, but you
+ * must be compliant with it.
+ */
+
+/* ------------------------- IOCTL STUFF ------------------------- */
+
+/* The first and the last (range) */
+#define SIOCIWFIRST	0x8B00
+#define SIOCIWLAST	SIOCIWLASTPRIV		/* 0x8BFF */
+#define IW_IOCTL_IDX(cmd)	((cmd) - SIOCIWFIRST)
+
+/* Even : get (world access), odd : set (root access) */
+#define IW_IS_SET(cmd)	(!((cmd) & 0x1))
+#define IW_IS_GET(cmd)	((cmd) & 0x1)
+
+/* ----------------------- WIRELESS EVENTS ----------------------- */
+/* Those are *NOT* ioctls, do not issue request on them !!! */
+/* Most events use the same identifier as ioctl requests */
+
+#define IWEVTXDROP	0x8C00		/* Packet dropped to excessive retry */
+#define IWEVQUAL	0x8C01		/* Quality part of statistics (scan) */
+#define IWEVCUSTOM	0x8C02		/* Driver specific ascii string */
+#define IWEVREGISTERED	0x8C03		/* Discovered a new node (AP mode) */
+#define IWEVEXPIRED	0x8C04		/* Expired a node (AP mode) */
+#define IWEVGENIE	0x8C05		/* Generic IE (WPA, RSN, WMM, ..)
+					 * (scan results); This includes id and
+					 * length fields. One IWEVGENIE may
+					 * contain more than one IE. Scan
+					 * results may contain one or more
+					 * IWEVGENIE events. */
+#define IWEVMICHAELMICFAILURE 0x8C06	/* Michael MIC failure
+					 * (struct iw_michaelmicfailure)
+					 */
+#define IWEVASSOCREQIE	0x8C07		/* IEs used in (Re)Association Request.
+					 * The data includes id and length
+					 * fields and may contain more than one
+					 * IE. This event is required in
+					 * Managed mode if the driver
+					 * generates its own WPA/RSN IE. This
+					 * should be sent just before
+					 * IWEVREGISTERED event for the
+					 * association. */
+#define IWEVASSOCRESPIE	0x8C08		/* IEs used in (Re)Association
+					 * Response. The data includes id and
+					 * length fields and may contain more
+					 * than one IE. This may be sent
+					 * between IWEVASSOCREQIE and
+					 * IWEVREGISTERED events for the
+					 * association. */
+#define IWEVPMKIDCAND	0x8C09		/* PMKID candidate for RSN
+					 * pre-authentication
+					 * (struct iw_pmkid_cand) */
+
+#define IWEVFIRST	0x8C00
+#define IW_EVENT_IDX(cmd)	((cmd) - IWEVFIRST)
+
+/* ------------------------- PRIVATE INFO ------------------------- */
+/*
+ * The following is used with SIOCGIWPRIV. It allow a driver to define
+ * the interface (name, type of data) for its private ioctl.
+ * Privates ioctl are SIOCIWFIRSTPRIV -> SIOCIWLASTPRIV
+ */
+
+#define IW_PRIV_TYPE_MASK	0x7000	/* Type of arguments */
+#define IW_PRIV_TYPE_NONE	0x0000
+#define IW_PRIV_TYPE_BYTE	0x1000	/* Char as number */
+#define IW_PRIV_TYPE_CHAR	0x2000	/* Char as character */
+#define IW_PRIV_TYPE_INT	0x4000	/* 32 bits int */
+#define IW_PRIV_TYPE_FLOAT	0x5000	/* struct iw_freq */
+#define IW_PRIV_TYPE_ADDR	0x6000	/* struct sockaddr */
+
+#define IW_PRIV_SIZE_FIXED	0x0800	/* Variable or fixed number of args */
+
+#define IW_PRIV_SIZE_MASK	0x07FF	/* Max number of those args */
+
+/*
+ * Note : if the number of args is fixed and the size < 16 octets,
+ * instead of passing a pointer we will put args in the iwreq struct...
+ */
+
+/* ----------------------- OTHER CONSTANTS ----------------------- */
+
+/* Maximum frequencies in the range struct */
+#define IW_MAX_FREQUENCIES	32
+/* Note : if you have something like 80 frequencies,
+ * don't increase this constant and don't fill the frequency list.
+ * The user will be able to set by channel anyway... */
+
+/* Maximum bit rates in the range struct */
+#define IW_MAX_BITRATES		32
+
+/* Maximum tx powers in the range struct */
+#define IW_MAX_TXPOWER		8
+/* Note : if you more than 8 TXPowers, just set the max and min or
+ * a few of them in the struct iw_range. */
+
+/* Maximum of address that you may set with SPY */
+#define IW_MAX_SPY		8
+
+/* Maximum of address that you may get in the
+   list of access points in range */
+#define IW_MAX_AP		64
+
+/* Maximum size of the ESSID and NICKN strings */
+#define IW_ESSID_MAX_SIZE	32
+
+/* Modes of operation */
+#define IW_MODE_AUTO	0	/* Let the driver decides */
+#define IW_MODE_ADHOC	1	/* Single cell network */
+#define IW_MODE_INFRA	2	/* Multi cell network, roaming, ... */
+#define IW_MODE_MASTER	3	/* Synchronisation master or Access Point */
+#define IW_MODE_REPEAT	4	/* Wireless Repeater (forwarder) */
+#define IW_MODE_SECOND	5	/* Secondary master/repeater (backup) */
+#define IW_MODE_MONITOR	6	/* Passive monitor (listen only) */
+
+/* Statistics flags (bitmask in updated) */
+#define IW_QUAL_QUAL_UPDATED	0x01	/* Value was updated since last read */
+#define IW_QUAL_LEVEL_UPDATED	0x02
+#define IW_QUAL_NOISE_UPDATED	0x04
+#define IW_QUAL_ALL_UPDATED	0x07
+#define IW_QUAL_DBM		0x08	/* Level + Noise are dBm */
+#define IW_QUAL_QUAL_INVALID	0x10	/* Driver doesn't provide value */
+#define IW_QUAL_LEVEL_INVALID	0x20
+#define IW_QUAL_NOISE_INVALID	0x40
+#define IW_QUAL_ALL_INVALID	0x70
+
+/* Frequency flags */
+#define IW_FREQ_AUTO		0x00	/* Let the driver decides */
+#define IW_FREQ_FIXED		0x01	/* Force a specific value */
+
+/* Maximum number of size of encoding token available
+ * they are listed in the range structure */
+#define IW_MAX_ENCODING_SIZES	8
+
+/* Maximum size of the encoding token in bytes */
+#define IW_ENCODING_TOKEN_MAX	64	/* 512 bits (for now) */
+
+/* Flags for encoding (along with the token) */
+#define IW_ENCODE_INDEX		0x00FF	/* Token index (if needed) */
+#define IW_ENCODE_FLAGS		0xFF00	/* Flags defined below */
+#define IW_ENCODE_MODE		0xF000	/* Modes defined below */
+#define IW_ENCODE_DISABLED	0x8000	/* Encoding disabled */
+#define IW_ENCODE_ENABLED	0x0000	/* Encoding enabled */
+#define IW_ENCODE_RESTRICTED	0x4000	/* Refuse non-encoded packets */
+#define IW_ENCODE_OPEN		0x2000	/* Accept non-encoded packets */
+#define IW_ENCODE_NOKEY		0x0800  /* Key is write only, so not present */
+#define IW_ENCODE_TEMP		0x0400  /* Temporary key */
+
+/* Power management flags available (along with the value, if any) */
+#define IW_POWER_ON		0x0000	/* No details... */
+#define IW_POWER_TYPE		0xF000	/* Type of parameter */
+#define IW_POWER_PERIOD		0x1000	/* Value is a period/duration of  */
+#define IW_POWER_TIMEOUT	0x2000	/* Value is a timeout (to go asleep) */
+#define IW_POWER_MODE		0x0F00	/* Power Management mode */
+#define IW_POWER_UNICAST_R	0x0100	/* Receive only unicast messages */
+#define IW_POWER_MULTICAST_R	0x0200	/* Receive only multicast messages */
+#define IW_POWER_ALL_R		0x0300	/* Receive all messages though PM */
+#define IW_POWER_FORCE_S	0x0400	/* Force PM procedure for sending unicast */
+#define IW_POWER_REPEATER	0x0800	/* Repeat broadcast messages in PM period */
+#define IW_POWER_MODIFIER	0x000F	/* Modify a parameter */
+#define IW_POWER_MIN		0x0001	/* Value is a minimum  */
+#define IW_POWER_MAX		0x0002	/* Value is a maximum */
+#define IW_POWER_RELATIVE	0x0004	/* Value is not in seconds/ms/us */
+
+/* Transmit Power flags available */
+#define IW_TXPOW_TYPE		0x00FF	/* Type of value */
+#define IW_TXPOW_DBM		0x0000	/* Value is in dBm */
+#define IW_TXPOW_MWATT		0x0001	/* Value is in mW */
+#define IW_TXPOW_RELATIVE	0x0002	/* Value is in arbitrary units */
+#define IW_TXPOW_RANGE		0x1000	/* Range of value between min/max */
+
+/* Retry limits and lifetime flags available */
+#define IW_RETRY_ON		0x0000	/* No details... */
+#define IW_RETRY_TYPE		0xF000	/* Type of parameter */
+#define IW_RETRY_LIMIT		0x1000	/* Maximum number of retries*/
+#define IW_RETRY_LIFETIME	0x2000	/* Maximum duration of retries in us */
+#define IW_RETRY_MODIFIER	0x000F	/* Modify a parameter */
+#define IW_RETRY_MIN		0x0001	/* Value is a minimum  */
+#define IW_RETRY_MAX		0x0002	/* Value is a maximum */
+#define IW_RETRY_RELATIVE	0x0004	/* Value is not in seconds/ms/us */
+
+/* Scanning request flags */
+#define IW_SCAN_DEFAULT		0x0000	/* Default scan of the driver */
+#define IW_SCAN_ALL_ESSID	0x0001	/* Scan all ESSIDs */
+#define IW_SCAN_THIS_ESSID	0x0002	/* Scan only this ESSID */
+#define IW_SCAN_ALL_FREQ	0x0004	/* Scan all Frequencies */
+#define IW_SCAN_THIS_FREQ	0x0008	/* Scan only this Frequency */
+#define IW_SCAN_ALL_MODE	0x0010	/* Scan all Modes */
+#define IW_SCAN_THIS_MODE	0x0020	/* Scan only this Mode */
+#define IW_SCAN_ALL_RATE	0x0040	/* Scan all Bit-Rates */
+#define IW_SCAN_THIS_RATE	0x0080	/* Scan only this Bit-Rate */
+/* struct iw_scan_req scan_type */
+#define IW_SCAN_TYPE_ACTIVE 0
+#define IW_SCAN_TYPE_PASSIVE 1
+/* Maximum size of returned data */
+#define IW_SCAN_MAX_DATA	4096	/* In bytes */
+
+/* Max number of char in custom event - use multiple of them if needed */
+#define IW_CUSTOM_MAX		256	/* In bytes */
+
+/* Generic information element */
+#define IW_GENERIC_IE_MAX	1024
+
+/* MLME requests (SIOCSIWMLME / struct iw_mlme) */
+#define IW_MLME_DEAUTH		0
+#define IW_MLME_DISASSOC	1
+
+/* SIOCSIWAUTH/SIOCGIWAUTH struct iw_param flags */
+#define IW_AUTH_INDEX		0x0FFF
+#define IW_AUTH_FLAGS		0xF000
+/* SIOCSIWAUTH/SIOCGIWAUTH parameters (0 .. 4095)
+ * (IW_AUTH_INDEX mask in struct iw_param flags; this is the index of the
+ * parameter that is being set/get to; value will be read/written to
+ * struct iw_param value field) */
+#define IW_AUTH_WPA_VERSION		0
+#define IW_AUTH_CIPHER_PAIRWISE		1
+#define IW_AUTH_CIPHER_GROUP		2
+#define IW_AUTH_KEY_MGMT		3
+#define IW_AUTH_TKIP_COUNTERMEASURES	4
+#define IW_AUTH_DROP_UNENCRYPTED	5
+#define IW_AUTH_80211_AUTH_ALG		6
+#define IW_AUTH_WPA_ENABLED		7
+#define IW_AUTH_RX_UNENCRYPTED_EAPOL	8
+#define IW_AUTH_ROAMING_CONTROL		9
+#define IW_AUTH_PRIVACY_INVOKED		10
+
+/* IW_AUTH_WPA_VERSION values (bit field) */
+#define IW_AUTH_WPA_VERSION_DISABLED	0x00000001
+#define IW_AUTH_WPA_VERSION_WPA		0x00000002
+#define IW_AUTH_WPA_VERSION_WPA2	0x00000004
+
+/* IW_AUTH_PAIRWISE_CIPHER and IW_AUTH_GROUP_CIPHER values (bit field) */
+#define IW_AUTH_CIPHER_NONE	0x00000001
+#define IW_AUTH_CIPHER_WEP40	0x00000002
+#define IW_AUTH_CIPHER_TKIP	0x00000004
+#define IW_AUTH_CIPHER_CCMP	0x00000008
+#define IW_AUTH_CIPHER_WEP104	0x00000010
+
+/* IW_AUTH_KEY_MGMT values (bit field) */
+#define IW_AUTH_KEY_MGMT_802_1X	1
+#define IW_AUTH_KEY_MGMT_PSK	2
+
+/* IW_AUTH_80211_AUTH_ALG values (bit field) */
+#define IW_AUTH_ALG_OPEN_SYSTEM	0x00000001
+#define IW_AUTH_ALG_SHARED_KEY	0x00000002
+#define IW_AUTH_ALG_LEAP	0x00000004
+
+/* IW_AUTH_ROAMING_CONTROL values */
+#define IW_AUTH_ROAMING_ENABLE	0	/* driver/firmware based roaming */
+#define IW_AUTH_ROAMING_DISABLE	1	/* user space program used for roaming
+					 * control */
+
+/* SIOCSIWENCODEEXT definitions */
+#define IW_ENCODE_SEQ_MAX_SIZE	8
+/* struct iw_encode_ext ->alg */
+#define IW_ENCODE_ALG_NONE	0
+#define IW_ENCODE_ALG_WEP	1
+#define IW_ENCODE_ALG_TKIP	2
+#define IW_ENCODE_ALG_CCMP	3
+/* struct iw_encode_ext ->ext_flags */
+#define IW_ENCODE_EXT_TX_SEQ_VALID	0x00000001
+#define IW_ENCODE_EXT_RX_SEQ_VALID	0x00000002
+#define IW_ENCODE_EXT_GROUP_KEY		0x00000004
+#define IW_ENCODE_EXT_SET_TX_KEY	0x00000008
+
+/* IWEVMICHAELMICFAILURE : struct iw_michaelmicfailure ->flags */
+#define IW_MICFAILURE_KEY_ID	0x00000003 /* Key ID 0..3 */
+#define IW_MICFAILURE_GROUP	0x00000004
+#define IW_MICFAILURE_PAIRWISE	0x00000008
+#define IW_MICFAILURE_STAKEY	0x00000010
+#define IW_MICFAILURE_COUNT	0x00000060 /* 1 or 2 (0 = count not supported)
+					    */
+
+/* Bit field values for enc_capa in struct iw_range */
+#define IW_ENC_CAPA_WPA		0x00000001
+#define IW_ENC_CAPA_WPA2	0x00000002
+#define IW_ENC_CAPA_CIPHER_TKIP	0x00000004
+#define IW_ENC_CAPA_CIPHER_CCMP	0x00000008
+
+/* Event capability macros - in (struct iw_range *)->event_capa
+ * Because we have more than 32 possible events, we use an array of
+ * 32 bit bitmasks. Note : 32 bits = 0x20 = 2^5. */
+#define IW_EVENT_CAPA_BASE(cmd)		((cmd >= SIOCIWFIRSTPRIV) ? \
+					 (cmd - SIOCIWFIRSTPRIV + 0x60) : \
+					 (cmd - SIOCSIWCOMMIT))
+#define IW_EVENT_CAPA_INDEX(cmd)	(IW_EVENT_CAPA_BASE(cmd) >> 5)
+#define IW_EVENT_CAPA_MASK(cmd)		(1 << (IW_EVENT_CAPA_BASE(cmd) & 0x1F))
+/* Event capability constants - event autogenerated by the kernel
+ * This list is valid for most 802.11 devices, customise as needed... */
+#define IW_EVENT_CAPA_K_0	(IW_EVENT_CAPA_MASK(0x8B04) | \
+				 IW_EVENT_CAPA_MASK(0x8B06) | \
+				 IW_EVENT_CAPA_MASK(0x8B1A))
+#define IW_EVENT_CAPA_K_1	(IW_EVENT_CAPA_MASK(0x8B2A))
+/* "Easy" macro to set events in iw_range (less efficient) */
+#define IW_EVENT_CAPA_SET(event_capa, cmd) (event_capa[IW_EVENT_CAPA_INDEX(cmd)] |= IW_EVENT_CAPA_MASK(cmd))
+#define IW_EVENT_CAPA_SET_KERNEL(event_capa) {event_capa[0] |= IW_EVENT_CAPA_K_0; event_capa[1] |= IW_EVENT_CAPA_K_1; }
+
+
+/****************************** TYPES ******************************/
+
+/* --------------------------- SUBTYPES --------------------------- */
+/*
+ *	Generic format for most parameters that fit in an int
+ */
+struct	iw_param
+{
+  __s32		value;		/* The value of the parameter itself */
+  __u8		fixed;		/* Hardware should not use auto select */
+  __u8		disabled;	/* Disable the feature */
+  __u16		flags;		/* Various specifc flags (if any) */
+};
+
+/*
+ *	For all data larger than 16 octets, we need to use a
+ *	pointer to memory allocated in user space.
+ */
+struct	iw_point
+{
+  void __user	*pointer;	/* Pointer to the data  (in user space) */
+  __u16		length;		/* number of fields or size in bytes */
+  __u16		flags;		/* Optional params */
+};
+
+/*
+ *	A frequency
+ *	For numbers lower than 10^9, we encode the number in 'm' and
+ *	set 'e' to 0
+ *	For number greater than 10^9, we divide it by the lowest power
+ *	of 10 to get 'm' lower than 10^9, with 'm'= f / (10^'e')...
+ *	The power of 10 is in 'e', the result of the division is in 'm'.
+ */
+struct	iw_freq
+{
+	__s32		m;		/* Mantissa */
+	__s16		e;		/* Exponent */
+	__u8		i;		/* List index (when in range struct) */
+	__u8		flags;		/* Flags (fixed/auto) */
+};
+
+/*
+ *	Quality of the link
+ */
+struct	iw_quality
+{
+	__u8		qual;		/* link quality (%retries, SNR,
+					   %missed beacons or better...) */
+	__u8		level;		/* signal level (dBm) */
+	__u8		noise;		/* noise level (dBm) */
+	__u8		updated;	/* Flags to know if updated */
+};
+
+/*
+ *	Packet discarded in the wireless adapter due to
+ *	"wireless" specific problems...
+ *	Note : the list of counter and statistics in net_device_stats
+ *	is already pretty exhaustive, and you should use that first.
+ *	This is only additional stats...
+ */
+struct	iw_discarded
+{
+	__u32		nwid;		/* Rx : Wrong nwid/essid */
+	__u32		code;		/* Rx : Unable to code/decode (WEP) */
+	__u32		fragment;	/* Rx : Can't perform MAC reassembly */
+	__u32		retries;	/* Tx : Max MAC retries num reached */
+	__u32		misc;		/* Others cases */
+};
+
+/*
+ *	Packet/Time period missed in the wireless adapter due to
+ *	"wireless" specific problems...
+ */
+struct	iw_missed
+{
+	__u32		beacon;		/* Missed beacons/superframe */
+};
+
+/*
+ *	Quality range (for spy threshold)
+ */
+struct	iw_thrspy
+{
+	struct sockaddr		addr;		/* Source address (hw/mac) */
+	struct iw_quality	qual;		/* Quality of the link */
+	struct iw_quality	low;		/* Low threshold */
+	struct iw_quality	high;		/* High threshold */
+};
+
+/*
+ *	Optional data for scan request
+ *
+ *	Note: these optional parameters are controlling parameters for the
+ *	scanning behavior, these do not apply to getting scan results
+ *	(SIOCGIWSCAN). Drivers are expected to keep a local BSS table and
+ *	provide a merged results with all BSSes even if the previous scan
+ *	request limited scanning to a subset, e.g., by specifying an SSID.
+ *	Especially, scan results are required to include an entry for the
+ *	current BSS if the driver is in Managed mode and associated with an AP.
+ */
+struct	iw_scan_req
+{
+	__u8		scan_type; /* IW_SCAN_TYPE_{ACTIVE,PASSIVE} */
+	__u8		essid_len;
+	__u8		num_channels; /* num entries in channel_list;
+				       * 0 = scan all allowed channels */
+	__u8		flags; /* reserved as padding; use zero, this may
+				* be used in the future for adding flags
+				* to request different scan behavior */
+	struct sockaddr	bssid; /* ff:ff:ff:ff:ff:ff for broadcast BSSID or
+				* individual address of a specific BSS */
+
+	/*
+	 * Use this ESSID if IW_SCAN_THIS_ESSID flag is used instead of using
+	 * the current ESSID. This allows scan requests for specific ESSID
+	 * without having to change the current ESSID and potentially breaking
+	 * the current association.
+	 */
+	__u8		essid[IW_ESSID_MAX_SIZE];
+
+	/*
+	 * Optional parameters for changing the default scanning behavior.
+	 * These are based on the MLME-SCAN.request from IEEE Std 802.11.
+	 * TU is 1.024 ms. If these are set to 0, driver is expected to use
+	 * reasonable default values. min_channel_time defines the time that
+	 * will be used to wait for the first reply on each channel. If no
+	 * replies are received, next channel will be scanned after this. If
+	 * replies are received, total time waited on the channel is defined by
+	 * max_channel_time.
+	 */
+	__u32		min_channel_time; /* in TU */
+	__u32		max_channel_time; /* in TU */
+
+	struct iw_freq	channel_list[IW_MAX_FREQUENCIES];
+};
+
+/* ------------------------- WPA SUPPORT ------------------------- */
+
+/*
+ *	Extended data structure for get/set encoding (this is used with
+ *	SIOCSIWENCODEEXT/SIOCGIWENCODEEXT. struct iw_point and IW_ENCODE_*
+ *	flags are used in the same way as with SIOCSIWENCODE/SIOCGIWENCODE and
+ *	only the data contents changes (key data -> this structure, including
+ *	key data).
+ *
+ *	If the new key is the first group key, it will be set as the default
+ *	TX key. Otherwise, default TX key index is only changed if
+ *	IW_ENCODE_EXT_SET_TX_KEY flag is set.
+ *
+ *	Key will be changed with SIOCSIWENCODEEXT in all cases except for
+ *	special "change TX key index" operation which is indicated by setting
+ *	key_len = 0 and ext_flags |= IW_ENCODE_EXT_SET_TX_KEY.
+ *
+ *	tx_seq/rx_seq are only used when respective
+ *	IW_ENCODE_EXT_{TX,RX}_SEQ_VALID flag is set in ext_flags. Normal
+ *	TKIP/CCMP operation is to set RX seq with SIOCSIWENCODEEXT and start
+ *	TX seq from zero whenever key is changed. SIOCGIWENCODEEXT is normally
+ *	used only by an Authenticator (AP or an IBSS station) to get the
+ *	current TX sequence number. Using TX_SEQ_VALID for SIOCSIWENCODEEXT and
+ *	RX_SEQ_VALID for SIOCGIWENCODEEXT are optional, but can be useful for
+ *	debugging/testing.
+ */
+struct	iw_encode_ext
+{
+	__u32		ext_flags; /* IW_ENCODE_EXT_* */
+	__u8		tx_seq[IW_ENCODE_SEQ_MAX_SIZE]; /* LSB first */
+	__u8		rx_seq[IW_ENCODE_SEQ_MAX_SIZE]; /* LSB first */
+	struct sockaddr	addr; /* ff:ff:ff:ff:ff:ff for broadcast/multicast
+			       * (group) keys or unicast address for
+			       * individual keys */
+	__u16		alg; /* IW_ENCODE_ALG_* */
+	__u16		key_len;
+	__u8		key[0];
+};
+
+/* SIOCSIWMLME data */
+struct	iw_mlme
+{
+	__u16		cmd; /* IW_MLME_* */
+	__u16		reason_code;
+	struct sockaddr	addr;
+};
+
+/* SIOCSIWPMKSA data */
+#define IW_PMKSA_ADD		1
+#define IW_PMKSA_REMOVE		2
+#define IW_PMKSA_FLUSH		3
+
+#define IW_PMKID_LEN	16
+
+struct	iw_pmksa
+{
+	__u32		cmd; /* IW_PMKSA_* */
+	struct sockaddr	bssid;
+	__u8		pmkid[IW_PMKID_LEN];
+};
+
+/* IWEVMICHAELMICFAILURE data */
+struct	iw_michaelmicfailure
+{
+	__u32		flags;
+	struct sockaddr	src_addr;
+	__u8		tsc[IW_ENCODE_SEQ_MAX_SIZE]; /* LSB first */
+};
+
+/* IWEVPMKIDCAND data */
+#define IW_PMKID_CAND_PREAUTH	0x00000001 /* RNS pre-authentication enabled */
+struct	iw_pmkid_cand
+{
+	__u32		flags; /* IW_PMKID_CAND_* */
+	__u32		index; /* the smaller the index, the higher the
+				* priority */
+	struct sockaddr	bssid;
+};
+
+/* ------------------------ WIRELESS STATS ------------------------ */
+/*
+ * Wireless statistics (used for /proc/net/wireless)
+ */
+struct	iw_statistics
+{
+	__u16		status;		/* Status
+					 * - device dependent for now */
+
+	struct iw_quality	qual;		/* Quality of the link
+						 * (instant/mean/max) */
+	struct iw_discarded	discard;	/* Packet discarded counts */
+	struct iw_missed	miss;		/* Packet missed counts */
+};
+
+/* ------------------------ IOCTL REQUEST ------------------------ */
+/*
+ * This structure defines the payload of an ioctl, and is used 
+ * below.
+ *
+ * Note that this structure should fit on the memory footprint
+ * of iwreq (which is the same as ifreq), which mean a max size of
+ * 16 octets = 128 bits. Warning, pointers might be 64 bits wide...
+ * You should check this when increasing the structures defined
+ * above in this file...
+ */
+union	iwreq_data
+{
+	/* Config - generic */
+	char		name[IFNAMSIZ];
+	/* Name : used to verify the presence of  wireless extensions.
+	 * Name of the protocol/provider... */
+
+	struct iw_point	essid;		/* Extended network name */
+	struct iw_param	nwid;		/* network id (or domain - the cell) */
+	struct iw_freq	freq;		/* frequency or channel :
+					 * 0-1000 = channel
+					 * > 1000 = frequency in Hz */
+
+	struct iw_param	sens;		/* signal level threshold */
+	struct iw_param	bitrate;	/* default bit rate */
+	struct iw_param	txpower;	/* default transmit power */
+	struct iw_param	rts;		/* RTS threshold threshold */
+	struct iw_param	frag;		/* Fragmentation threshold */
+	__u32		mode;		/* Operation mode */
+	struct iw_param	retry;		/* Retry limits & lifetime */
+
+	struct iw_point	encoding;	/* Encoding stuff : tokens */
+	struct iw_param	power;		/* PM duration/timeout */
+	struct iw_quality qual;		/* Quality part of statistics */
+
+	struct sockaddr	ap_addr;	/* Access point address */
+	struct sockaddr	addr;		/* Destination address (hw/mac) */
+
+	struct iw_param	param;		/* Other small parameters */
+	struct iw_point	data;		/* Other large parameters */
+};
+
+/*
+ * The structure to exchange data for ioctl.
+ * This structure is the same as 'struct ifreq', but (re)defined for
+ * convenience...
+ * Do I need to remind you about structure size (32 octets) ?
+ */
+struct	iwreq 
+{
+	union
+	{
+		char	ifrn_name[IFNAMSIZ];	/* if name, e.g. "eth0" */
+	} ifr_ifrn;
+
+	/* Data part (defined just above) */
+	union	iwreq_data	u;
+};
+
+/* -------------------------- IOCTL DATA -------------------------- */
+/*
+ *	For those ioctl which want to exchange mode data that what could
+ *	fit in the above structure...
+ */
+
+/*
+ *	Range of parameters
+ */
+
+struct	iw_range
+{
+	/* Informative stuff (to choose between different interface) */
+	__u32		throughput;	/* To give an idea... */
+	/* In theory this value should be the maximum benchmarked
+	 * TCP/IP throughput, because with most of these devices the
+	 * bit rate is meaningless (overhead an co) to estimate how
+	 * fast the connection will go and pick the fastest one.
+	 * I suggest people to play with Netperf or any benchmark...
+	 */
+
+	/* NWID (or domain id) */
+	__u32		min_nwid;	/* Minimal NWID we are able to set */
+	__u32		max_nwid;	/* Maximal NWID we are able to set */
+
+	/* Old Frequency (backward compat - moved lower ) */
+	__u16		old_num_channels;
+	__u8		old_num_frequency;
+
+	/* Wireless event capability bitmasks */
+	__u32		event_capa[6];
+
+	/* signal level threshold range */
+	__s32		sensitivity;
+
+	/* Quality of link & SNR stuff */
+	/* Quality range (link, level, noise)
+	 * If the quality is absolute, it will be in the range [0 ; max_qual],
+	 * if the quality is dBm, it will be in the range [max_qual ; 0].
+	 * Don't forget that we use 8 bit arithmetics... */
+	struct iw_quality	max_qual;	/* Quality of the link */
+	/* This should contain the average/typical values of the quality
+	 * indicator. This should be the threshold between a "good" and
+	 * a "bad" link (example : monitor going from green to orange).
+	 * Currently, user space apps like quality monitors don't have any
+	 * way to calibrate the measurement. With this, they can split
+	 * the range between 0 and max_qual in different quality level
+	 * (using a geometric subdivision centered on the average).
+	 * I expect that people doing the user space apps will feedback
+	 * us on which value we need to put in each driver... */
+	struct iw_quality	avg_qual;	/* Quality of the link */
+
+	/* Rates */
+	__u8		num_bitrates;	/* Number of entries in the list */
+	__s32		bitrate[IW_MAX_BITRATES];	/* list, in bps */
+
+	/* RTS threshold */
+	__s32		min_rts;	/* Minimal RTS threshold */
+	__s32		max_rts;	/* Maximal RTS threshold */
+
+	/* Frag threshold */
+	__s32		min_frag;	/* Minimal frag threshold */
+	__s32		max_frag;	/* Maximal frag threshold */
+
+	/* Power Management duration & timeout */
+	__s32		min_pmp;	/* Minimal PM period */
+	__s32		max_pmp;	/* Maximal PM period */
+	__s32		min_pmt;	/* Minimal PM timeout */
+	__s32		max_pmt;	/* Maximal PM timeout */
+	__u16		pmp_flags;	/* How to decode max/min PM period */
+	__u16		pmt_flags;	/* How to decode max/min PM timeout */
+	__u16		pm_capa;	/* What PM options are supported */
+
+	/* Encoder stuff */
+	__u16	encoding_size[IW_MAX_ENCODING_SIZES];	/* Different token sizes */
+	__u8	num_encoding_sizes;	/* Number of entry in the list */
+	__u8	max_encoding_tokens;	/* Max number of tokens */
+	/* For drivers that need a "login/passwd" form */
+	__u8	encoding_login_index;	/* token index for login token */
+
+	/* Transmit power */
+	__u16		txpower_capa;	/* What options are supported */
+	__u8		num_txpower;	/* Number of entries in the list */
+	__s32		txpower[IW_MAX_TXPOWER];	/* list, in bps */
+
+	/* Wireless Extension version info */
+	__u8		we_version_compiled;	/* Must be WIRELESS_EXT */
+	__u8		we_version_source;	/* Last update of source */
+
+	/* Retry limits and lifetime */
+	__u16		retry_capa;	/* What retry options are supported */
+	__u16		retry_flags;	/* How to decode max/min retry limit */
+	__u16		r_time_flags;	/* How to decode max/min retry life */
+	__s32		min_retry;	/* Minimal number of retries */
+	__s32		max_retry;	/* Maximal number of retries */
+	__s32		min_r_time;	/* Minimal retry lifetime */
+	__s32		max_r_time;	/* Maximal retry lifetime */
+
+	/* Frequency */
+	__u16		num_channels;	/* Number of channels [0; num - 1] */
+	__u8		num_frequency;	/* Number of entry in the list */
+	struct iw_freq	freq[IW_MAX_FREQUENCIES];	/* list */
+	/* Note : this frequency list doesn't need to fit channel numbers,
+	 * because each entry contain its channel index */
+
+	__u32		enc_capa; /* IW_ENC_CAPA_* bit field */
+};
+
+/*
+ * Private ioctl interface information
+ */
+ 
+struct	iw_priv_args
+{
+	__u32		cmd;		/* Number of the ioctl to issue */
+	__u16		set_args;	/* Type and number of args */
+	__u16		get_args;	/* Type and number of args */
+	char		name[IFNAMSIZ];	/* Name of the extension */
+};
+
+/* ----------------------- WIRELESS EVENTS ----------------------- */
+/*
+ * Wireless events are carried through the rtnetlink socket to user
+ * space. They are encapsulated in the IFLA_WIRELESS field of
+ * a RTM_NEWLINK message.
+ */
+
+/*
+ * A Wireless Event. Contains basically the same data as the ioctl...
+ */
+struct iw_event
+{
+	__u16		len;			/* Real lenght of this stuff */
+	__u16		cmd;			/* Wireless IOCTL */
+	union iwreq_data	u;		/* IOCTL fixed payload */
+};
+
+/* Size of the Event prefix (including padding and alignement junk) */
+#define IW_EV_LCP_LEN	(sizeof(struct iw_event) - sizeof(union iwreq_data))
+/* Size of the various events */
+#define IW_EV_CHAR_LEN	(IW_EV_LCP_LEN + IFNAMSIZ)
+#define IW_EV_UINT_LEN	(IW_EV_LCP_LEN + sizeof(__u32))
+#define IW_EV_FREQ_LEN	(IW_EV_LCP_LEN + sizeof(struct iw_freq))
+#define IW_EV_PARAM_LEN	(IW_EV_LCP_LEN + sizeof(struct iw_param))
+#define IW_EV_ADDR_LEN	(IW_EV_LCP_LEN + sizeof(struct sockaddr))
+#define IW_EV_QUAL_LEN	(IW_EV_LCP_LEN + sizeof(struct iw_quality))
+
+/* iw_point events are special. First, the payload (extra data) come at
+ * the end of the event, so they are bigger than IW_EV_POINT_LEN. Second,
+ * we omit the pointer, so start at an offset. */
+#define IW_EV_POINT_OFF (((char *) &(((struct iw_point *) NULL)->length)) - \
+			  (char *) NULL)
+#define IW_EV_POINT_LEN	(IW_EV_LCP_LEN + sizeof(struct iw_point) - \
+			 IW_EV_POINT_OFF)
+
+#endif	/* _LINUX_WIRELESS_H */
diff -Naur tomato/release/src/router/snmp/agent/mib_modules.c tomato121/release/src/router/snmp/agent/mib_modules.c
--- tomato/release/src/router/snmp/agent/mib_modules.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/mib_modules.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,138 @@
+/*
+ * wrapper to call all the mib module initialization functions 
+ */
+
+#include <net-snmp/agent/mib_module_config.h>
+#include <net-snmp/net-snmp-config.h>
+#if HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+#if HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#if HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#include <sys/types.h>
+#if TIME_WITH_SYS_TIME
+# ifdef WIN32
+#  include <sys/timeb.h>
+# else
+#  include <sys/time.h>
+# endif
+# include <time.h>
+#else
+# if HAVE_SYS_TIME_H
+#  include <sys/time.h>
+# else
+#  include <time.h>
+# endif
+#endif
+#if HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+#if HAVE_WINSOCK_H
+#include <winsock.h>
+#endif
+
+#if HAVE_DMALLOC_H
+#include <dmalloc.h>
+#endif
+
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include "m2m.h"
+
+#include "mibgroup/struct.h"
+#include <net-snmp/agent/mib_modules.h>
+#include <net-snmp/agent/table.h>
+#include <net-snmp/agent/table_iterator.h>
+#include "mib_module_includes.h"
+#ifdef USING_AGENTX_SUBAGENT_MODULE
+#include "mibgroup/agentx/subagent.h"
+#endif
+
+struct module_init_list *initlist = NULL;
+struct module_init_list *noinitlist = NULL;
+
+
+void
+add_to_init_list(char *module_list)
+{
+    struct module_init_list *newitem, **list;
+    char           *cp;
+
+    if (module_list == NULL) {
+        return;
+    } else {
+        cp = (char *) module_list;
+    }
+
+    if (*cp == '-' || *cp == '!') {
+        cp++;
+        list = &noinitlist;
+    } else {
+        list = &initlist;
+    }
+
+    cp = strtok(cp, ", :");
+    while (cp) {
+        newitem = (struct module_init_list *) calloc(1, sizeof(*initlist));
+        newitem->module_name = strdup(cp);
+        newitem->next = *list;
+        *list = newitem;
+        cp = strtok(NULL, ", :");
+    }
+}
+
+int
+should_init(const char *module_name)
+{
+    struct module_init_list *listp;
+
+    /*
+     * a definitive list takes priority 
+     */
+    if (initlist) {
+        listp = initlist;
+        while (listp) {
+            if (strcmp(listp->module_name, module_name) == 0) {
+                DEBUGMSGTL(("mib_init", "initializing: %s\n",
+                            module_name));
+                return DO_INITIALIZE;
+            }
+            listp = listp->next;
+        }
+        DEBUGMSGTL(("mib_init", "skipping:     %s\n", module_name));
+        return DONT_INITIALIZE;
+    }
+
+    /*
+     * initialize it only if not on the bad list (bad module, no bone) 
+     */
+    if (noinitlist) {
+        listp = noinitlist;
+        while (listp) {
+            if (strcmp(listp->module_name, module_name) == 0) {
+                DEBUGMSGTL(("mib_init", "skipping:     %s\n",
+                            module_name));
+                return DONT_INITIALIZE;
+            }
+            listp = listp->next;
+        }
+    }
+    DEBUGMSGTL(("mib_init", "initializing: %s\n", module_name));
+
+    /*
+     * initialize it 
+     */
+    return DO_INITIALIZE;
+}
+
+void
+init_mib_modules(void)
+{
+#  include "mib_module_inits.h"
+}
diff -Naur tomato/release/src/router/snmp/agent/object_monitor.c tomato121/release/src/router/snmp/agent/object_monitor.c
--- tomato/release/src/router/snmp/agent/object_monitor.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/object_monitor.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,755 @@
+/*
+ * object_monitor.c
+ *
+ * $Id: object_monitor.c,v 1.1.2.1 2004/06/20 21:54:09 nikki Exp $
+ *
+ * functions and data structures for cooperating code to monitor objects.
+ *
+ * WARNING! WARNING! WARNING! WARNING! WARNING! WARNING! WARNING! WARNING!
+ * WARNING!                                                       WARNING!
+ * WARNING!                                                       WARNING!
+ * WARNING!         This code is under active development         WARNING!
+ * WARNING!         and is subject to change at any time.         WARNING!
+ * WARNING!                                                       WARNING!
+ * WARNING!                                                       WARNING!
+ * WARNING! WARNING! WARNING! WARNING! WARNING! WARNING! WARNING! WARNING!
+ */
+
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include <net-snmp/library/container.h>
+#include <net-snmp/library/snmp_assert.h>
+
+#include "net-snmp/agent/object_monitor.h"
+
+#if ! defined TRUE
+#  define TRUE 1
+#elsif TRUE != 1
+error "TRUE != 1"
+#endif
+/**************************************************************************
+ *
+ * Private data structures
+ *
+ **************************************************************************/
+    /*
+     * individual callback info for an object
+     */
+    typedef struct monitor_info_s {
+
+   /** priority for this callback */
+    int             priority;
+
+   /** handler that registred to watch this object */
+    netsnmp_mib_handler *watcher;
+
+   /** events that the watcher cares about */
+    unsigned int    events;
+
+   /** callback function */
+    netsnmp_object_monitor_callback *cb;
+
+   /** pointer to data from the watcher */
+    void           *watcher_data;
+
+    struct monitor_info_s *next;
+
+} monitor_info;
+
+/*
+ * list of watchers for a given object
+ */
+typedef struct watcher_list_s {
+
+   /** netsnmp_index must be first! */
+    netsnmp_index  monitored_object;
+
+    monitor_info   *head;
+
+} watcher_list;
+
+/*
+ * temp holder for ordered list of callbacks
+ */
+typedef struct callback_placeholder_s {
+
+    monitor_info   *mi;
+    netsnmp_monitor_callback_header *cbh;
+
+    struct callback_placeholder_s *next;
+
+} callback_placeholder;
+
+
+/**************************************************************************
+ *
+ * 
+ *
+ **************************************************************************/
+
+/*
+ * local statics
+ */
+static char     need_init = 1;
+static netsnmp_container *monitored_objects = NULL;
+static netsnmp_monitor_callback_header *callback_pending_list;
+static callback_placeholder *callback_ready_list;
+
+/*
+ * local prototypes
+ */
+static watcher_list *find_watchers(oid * object, size_t oid_len);
+static int      insert_watcher(oid *, size_t, monitor_info *);
+static int      check_registered(unsigned int event, oid * o, int o_l,
+                                 watcher_list ** pWl, monitor_info ** pMi);
+static void     move_pending_to_ready(void);
+
+
+/**************************************************************************
+ *
+ * Public functions
+ *
+ **************************************************************************/
+
+/*
+ * 
+ */
+void
+netsnmp_monitor_init(void)
+{
+    if (!need_init)
+        return;
+
+    callback_pending_list = NULL;
+    callback_ready_list = NULL;
+
+    monitored_objects = netsnmp_container_get("object_monitor:binary_array");
+    if (NULL != monitored_objects)
+        need_init = 0;
+    monitored_objects->compare = netsnmp_compare_netsnmp_index;
+    monitored_objects->ncompare = netsnmp_ncompare_netsnmp_index;
+    
+    return;
+}
+
+
+/**************************************************************************
+ *
+ * Registration functions
+ *
+ **************************************************************************/
+
+/**
+ * Register a callback for the specified object.
+ *
+ * @param object  pointer to the OID of the object to monitor.
+ * @param oid_len length of the OID pointed to by object.
+ * @param priority the priority to associate with this callback. A
+ *                 higher number indicates higher priority. This
+ *                 allows multiple callbacks for the same object to
+ *                 coordinate the order in which they are called. If
+ *                 two callbacks register with the same priority, the
+ *                 order is undefined.
+ * @param events  the events which the callback is interested in.
+ * @param watcher_data pointer to data that will be supplied to the
+ *                     callback method when an event occurs.
+ * @param cb pointer to the function to be called when an event occurs.
+ *
+ * NOTE: the combination of the object, priority and watcher_data must
+ *       be unique, as they are the parameters for unregistering a
+ *       callback.
+ *
+ * @return SNMPERR_NOERR registration was successful
+ * @return SNMPERR_MALLOC memory allocation failed
+ * @return SNMPERR_VALUE the combination of the object, priority and
+ *                        watcher_data is not unique.
+ */
+int
+netsnmp_monitor_register(oid * object, size_t oid_len, int priority,
+                         unsigned int events, void *watcher_data,
+                         netsnmp_object_monitor_callback * cb)
+{
+    monitor_info   *mi;
+    int             rc;
+
+    netsnmp_assert(need_init == 0);
+
+    mi = calloc(1, sizeof(monitor_info));
+    if (NULL == mi)
+        return SNMPERR_MALLOC;
+
+    mi->priority = priority;
+    mi->events = events;
+    mi->watcher_data = watcher_data;
+    mi->cb = cb;
+
+    rc = insert_watcher(object, oid_len, mi);
+    if (rc != SNMPERR_SUCCESS)
+        free(mi);
+
+    return rc;
+}
+
+/**
+ * Unregister a callback for the specified object.
+ *
+ * @param object  pointer to the OID of the object to monitor.
+ * @param oid_len length of the OID pointed to by object.
+ * @param priority the priority to associate with this callback.
+ * @param watcher_data pointer to data that was supplied when the
+ *                     callback was registered.
+ * @param cb pointer to the function to be called when an event occurs.
+ */
+int
+netsnmp_monitor_unregister(oid * object, size_t oid_len, int priority,
+                           void *wd, netsnmp_object_monitor_callback * cb)
+{
+    monitor_info   *mi, *last;
+
+    watcher_list   *wl = find_watchers(object, oid_len);
+    if (NULL == wl)
+        return SNMPERR_GENERR;
+
+    last = NULL;
+    mi = wl->head;
+    while (mi) {
+        if ((mi->cb == cb) && (mi->priority == priority) &&
+            (mi->watcher_data == wd))
+            break;
+        last = mi;
+        mi = mi->next;
+    }
+
+    if (NULL == mi)
+        return SNMPERR_GENERR;
+
+    if (NULL == last)
+        wl->head = mi->next;
+    else
+        last->next = mi->next;
+
+    if (NULL == wl->head) {
+        CONTAINER_REMOVE(monitored_objects, wl);
+        free(wl->monitored_object.oids);
+        free(wl);
+    }
+
+    free(mi);
+
+    return SNMPERR_SUCCESS;
+}
+
+/**************************************************************************
+ *
+ * object monitor functions
+ *
+ **************************************************************************/
+
+/**
+ * Notifies the object monitor of an event.
+ *
+ * The object monitor funtions will save the callback information
+ * until all varbinds in the current PDU have been processed and
+ * a response has been sent. At that time, the object monitor will
+ * determine if there are any watchers monitoring for the event.
+ *
+ * NOTE: the actual type of the callback structure may vary. The
+ *       object monitor functions require only that the start of
+ *       the structure match the netsnmp_monitor_callback_header
+ *       structure. It is up to the watcher and monitored objects
+ *       to agree on the format of other data.
+ *
+ * @param cbh pointer to a callback header.
+ */
+void
+netsnmp_notify_monitor(netsnmp_monitor_callback_header * cbh)
+{
+
+    netsnmp_assert(need_init == 0);
+
+    /*
+     * put processing of until response has been sent
+     */
+    cbh->private = callback_pending_list;
+    callback_pending_list = cbh;
+
+    return;
+}
+
+/**
+ * check to see if a registration exists for an object/event combination
+ *
+ * @param event the event type to check for
+ * @param o     the oid to check for
+ * @param o_l   the length of the oid
+ *
+ * @returns TRUE(1) if a callback is registerd
+ * @returns FALSE(0) if no callback is registered
+ */
+int
+netsnmp_monitor_check_registered(int event, oid * o, int o_l)
+{
+    return check_registered(event, o, o_l, NULL, NULL);
+}
+
+/**
+ * Process all pending callbacks
+ *
+ * NOTE: this method is not in the public header, as it should only be
+ *       called in one place, in the agent.
+ */
+void
+netsnmp_monitor_process_callbacks(void)
+{
+    netsnmp_assert(need_init == 0);
+    netsnmp_assert(NULL == callback_ready_list);
+
+    if (NULL == callback_pending_list) {
+        DEBUGMSGT(("object_monitor", "No callbacks to process"));
+        return;
+    }
+
+    DEBUGMSG(("object_monitor", "Checking for registered " "callbacks."));
+
+    /*
+     * move an pending notification which has a registered watcher to the
+     * ready list. Free any other notifications.
+     */
+    move_pending_to_ready();
+
+    /*
+     * call callbacks
+     */
+    while (callback_ready_list) {
+
+        /*
+         * pop off the first item
+         */
+        callback_placeholder *current_cbr;
+        current_cbr = callback_ready_list;
+        callback_ready_list = current_cbr->next;
+
+        /*
+         * setup, then call callback
+         */
+        current_cbr->cbh->watcher_data = current_cbr->mi->watcher_data;
+        current_cbr->cbh->priority = current_cbr->mi->priority;
+        (*current_cbr->mi->cb) (current_cbr->cbh);
+
+        /*
+         * release memory (don't free current_cbr->mi)
+         */
+        if (--(current_cbr->cbh->refs) == 0) {
+            free(current_cbr->cbh->monitored_object.oids);
+            free(current_cbr->cbh);
+        }
+        free(current_cbr);
+
+        /*
+         * check for any new pending notifications
+         */
+        move_pending_to_ready();
+
+    }
+
+    netsnmp_assert(callback_ready_list == NULL);
+    netsnmp_assert(callback_pending_list = NULL);
+
+    return;
+}
+
+/**************************************************************************
+ *
+ * COOPERATIVE helpers
+ *
+ **************************************************************************/
+/**
+ * Notifies the object monitor of a cooperative event.
+ *
+ * This convenience function will build a
+ * @link netsnmp_monitor_callback_header@endlink and call
+ * @link netsnmp_notify_monitor@endlink.
+ *
+ * @param event the event type
+ * @param object pointer to the oid of the object sending the event
+ * @param len    the lenght of the oid
+ * @param oid_steal set to true if the function may keep the pointer
+ *                  to the memory (and free it later). set to false
+ *                  to make the function allocate and copy the oid.
+ * @param object_info pointer to data supplied by the object for
+ *                    the callback. This pointer must remain valid,
+ *                    will be provided to each callback registered
+ *                    for the object (i.e. it will not be copied or
+ *                    freed).
+ */
+void
+netsnmp_notify_cooperative(int event, oid * o, size_t o_len, char o_steal,
+                           void *object_info)
+{
+    netsnmp_monitor_callback_cooperative *cbh;
+
+    netsnmp_assert(need_init == 0);
+
+    cbh = SNMP_MALLOC_TYPEDEF(netsnmp_monitor_callback_cooperative);
+    if (NULL == cbh) {
+        snmp_log(LOG_ERR, "could not allocate memory for "
+                 "cooperative callback");
+        return;
+    }
+
+    cbh->hdr.event = event;
+    cbh->hdr.object_info = object_info;
+    cbh->hdr.monitored_object.len = o_len;
+
+    if (o_steal) {
+        cbh->hdr.monitored_object.oids = o;
+    } else {
+        cbh->hdr.monitored_object.oids = snmp_duplicate_objid(o, o_len);
+    }
+
+    netsnmp_notify_monitor((netsnmp_monitor_callback_header *) cbh);
+}
+
+#ifndef DOXYGEN_SHOULD_IGNORE_THIS
+/*************************************************************************
+ *************************************************************************
+ *************************************************************************
+ * WARNING! WARNING! WARNING! WARNING! WARNING! WARNING! WARNING! WARNING!
+ * WARNING!                                                       WARNING!
+ * WARNING!                                                       WARNING!
+ * WARNING!         This code is under active development         WARNING!
+ * WARNING!         and is subject to change at any time.         WARNING!
+ * WARNING!                                                       WARNING!
+ * WARNING!                                                       WARNING!
+ * WARNING! WARNING! WARNING! WARNING! WARNING! WARNING! WARNING! WARNING!
+ *************************************************************************
+ *************************************************************************
+ *************************************************************************
+ */
+static watcher_list *
+find_watchers(oid * object, size_t oid_len)
+{
+    netsnmp_index oah;
+
+    oah.oids = object;
+    oah.len = oid_len;
+
+    return (watcher_list *)CONTAINER_FIND(monitored_objects, &oah);
+}
+
+static int
+insert_watcher(oid * object, size_t oid_len, monitor_info * mi)
+{
+    watcher_list   *wl = find_watchers(object, oid_len);
+    int             rc = SNMPERR_SUCCESS;
+
+    if (NULL != wl) {
+
+        monitor_info   *last, *current;
+
+        netsnmp_assert(wl->head != NULL);
+
+        last = NULL;
+        current = wl->head;
+        while (current) {
+            if (mi->priority == current->priority) {
+                /*
+                 * check for duplicate
+                 */
+                if (mi->watcher_data == current->watcher_data)
+                    return SNMPERR_VALUE; /** duplicate! */
+            } else if (mi->priority > current->priority) {
+                break;
+            }
+            last = current;
+            current = current->next;
+        }
+        if (NULL == last) {
+            mi->next = wl->head;
+            wl->head = mi;
+        } else {
+            mi->next = last->next;
+            last->next = mi;
+        }
+    } else {
+
+        /*
+         * first watcher for this oid; set up list
+         */
+        wl = SNMP_MALLOC_TYPEDEF(watcher_list);
+        if (NULL == wl)
+            return SNMPERR_MALLOC;
+
+        /*
+         * copy index oid
+         */
+        wl->monitored_object.len = oid_len;
+        wl->monitored_object.oids = malloc(sizeof(oid) * oid_len);
+        if (NULL == wl->monitored_object.oids) {
+            free(wl);
+            return SNMPERR_MALLOC;
+        }
+        memcpy(wl->monitored_object.oids, object, sizeof(oid) * oid_len);
+
+        /*
+         * add watcher, and insert into array
+         */
+        wl->head = mi;
+        mi->next = NULL;
+        rc = CONTAINER_INSERT(monitored_objects, wl);
+        if (rc) {
+            free(wl->monitored_object.oids);
+            free(wl);
+            return rc;
+        }
+    }
+    return rc;
+}
+
+/**
+ * @internal
+ * check to see if a registration exists for an object/event combination
+ *
+ * @param event the event type to check for
+ * @param o     the oid to check for
+ * @param o_l   the length of the oid
+ * @param pWl   if a pointer to a watcher_list pointer is supplied,
+ *              upon return the watcher list pointer will be set to
+ *              the watcher list for the object, or NULL if there are
+ *              no watchers for the object.
+ * @param pMi   if a pointer to a monitor_info pointer is supplied,
+ *              upon return the pointer will be set to the first
+ *              monitor_info object for the specified event.
+ *
+ * @returns TRUE(1) if a callback is registerd
+ * @returns FALSE(0) if no callback is registered
+ */
+static int
+check_registered(unsigned int event, oid * o, int o_l,
+                 watcher_list ** pWl, monitor_info ** pMi)
+{
+    watcher_list   *wl;
+    monitor_info   *mi;
+
+    netsnmp_assert(need_init == 0);
+
+    /*
+     * check to see if anyone has registered for callbacks
+     * for the object.
+     */
+    wl = find_watchers(o, o_l);
+    if (pWl)
+        *pWl = wl;
+    if (NULL == wl)
+        return 0;
+
+    /*
+     * check if any watchers are watching for this specific event
+     */
+    for (mi = wl->head; mi; mi = mi->next) {
+
+        if (mi->events & event) {
+            if (pMi)
+                *pMi = mi;
+            return TRUE;
+        }
+    }
+
+    return 0;
+}
+
+/**
+ *@internal
+ */
+NETSNMP_INLINE void
+insert_ready(callback_placeholder * new_cbr)
+{
+    callback_placeholder *current_cbr, *last_cbr;
+
+    /*
+     * insert in callback ready list
+     */
+    last_cbr = NULL;
+    current_cbr = callback_ready_list;
+    while (current_cbr) {
+
+        if (new_cbr->mi->priority > current_cbr->mi->priority)
+            break;
+
+        last_cbr = current_cbr;
+        current_cbr = current_cbr->next;
+    }
+    if (NULL == last_cbr) {
+        new_cbr->next = callback_ready_list;
+        callback_ready_list = new_cbr;
+    } else {
+        new_cbr->next = last_cbr->next;
+        last_cbr->next = new_cbr;
+    }
+}
+
+/**
+ *@internal
+ *
+ * move an pending notification which has a registered watcher to the
+ * ready list. Free any other notifications.
+ */
+static void
+move_pending_to_ready(void)
+{
+    /*
+     * check to see if anyone has registered for callbacks
+     * for each object.
+     */
+    while (callback_pending_list) {
+
+        watcher_list   *wl;
+        monitor_info   *mi;
+        netsnmp_monitor_callback_header *cbp;
+
+        /*
+         * pop off first item
+         */
+        cbp = callback_pending_list;
+        callback_pending_list = cbp->private; /** next */
+
+        if (0 == check_registered(cbp->event, cbp->monitored_object.oids,
+                                  cbp->monitored_object.len, &wl,
+                                  &mi)) {
+
+            /*
+             * nobody watching, free memory
+             */
+            free(cbp);
+            continue;
+        }
+
+        /*
+         * Found at least one; check the rest of the list and
+         * save callback for processing
+         */
+        for (; mi; mi = mi->next) {
+
+            callback_placeholder *new_cbr;
+
+            if (0 == (mi->events & cbp->event))
+                continue;
+
+            /*
+             * create temprory placeholder.
+             *
+             * I hate to allocate memory here, as I'd like this code to
+             * be fast and lean. But I don't have time to think of another
+             * solution os this will have to do for now.
+             *
+             * I need a list of monitor_info (mi) objects for each
+             * callback which has registered for the event, and want
+             * that list sorted by the priority required by the watcher.
+             */
+            new_cbr = SNMP_MALLOC_TYPEDEF(callback_placeholder);
+            if (NULL == new_cbr) {
+                snmp_log(LOG_ERR, "malloc failed, callback dropped.");
+                continue;
+            }
+            new_cbr->cbh = cbp;
+            new_cbr->mi = mi;
+            ++cbp->refs;
+
+            /*
+             * insert in callback ready list
+             */
+            insert_ready(new_cbr);
+
+        } /** end mi loop */
+    } /** end cbp loop */
+
+    netsnmp_assert(callback_pending_list == NULL);
+}
+
+
+#if defined TESTING_OBJECT_MONITOR
+/**************************************************************************
+ *
+ * (untested) TEST CODE
+ *
+ */
+void
+dummy_callback(netsnmp_monitor_callback_header * cbh)
+{
+    printf("Callback received.\n");
+}
+
+void
+dump_watchers(netsnmp_index *oah, void *)
+{
+    watcher_list   *wl = (watcher_list *) oah;
+    netsnmp_monitor_callback_header *cbh = wl->head;
+
+    printf("Watcher List for OID ");
+    print_objid(wl->hdr->oids, wl->hdr->len);
+    printf("\n");
+
+    while (cbh) {
+
+        printf("Priority = %d;, Events = %d; Watcher Data = 0x%x\n",
+               cbh->priority, cbh->events, cbh->watcher_data);
+
+        cbh = cbh->private;
+    }
+}
+
+void
+main(int argc, char **argv)
+{
+
+    oid             object[3] = { 1, 3, 6 };
+    int             object_len = 3;
+    int             rc;
+
+    /*
+     * init
+     */
+    netsnmp_monitor_init();
+
+    /*
+     * insert an object
+     */
+    rc = netsnmp_monitor_register(object, object_len, 0,
+                                  EVENT_ROW_ADD, (void *) 0xdeadbeef,
+                                  dummy_callback);
+    printf("insert an object: %d\n", rc);
+
+    /*
+     * insert same object, new priority
+     */
+    netsnmp_monitor_register(object, object_len, 10,
+                             EVENT_ROW_ADD, (void *) 0xdeadbeef,
+                             dummy_callback);
+    printf("insert same object, new priority: %d\n", rc);
+
+    /*
+     * insert same object, same priority, new data
+     */
+    netsnmp_monitor_register(object, object_len, 10,
+                             EVENT_ROW_ADD, (void *) 0xbeefdead,
+                             dummy_callback);
+    printf("insert same object, same priority, new data: %d\n", rc);
+
+    /*
+     * insert same object, same priority, same data
+     */
+    netsnmp_monitor_register(object, object_len, 10,
+                             EVENT_ROW_ADD, (void *) 0xbeefdead,
+                             dummy_callback);
+    printf("insert same object, same priority, new data: %d\n", rc);
+
+
+    /*
+     * dump table
+     */
+    CONTAINER_FOR_EACH(monitored_objects, dump_watchers, NULL);
+}
+#endif /** defined TESTING_OBJECT_MONITOR */
+
+#endif /** DOXYGEN_SHOULD_IGNORE_THIS */
diff -Naur tomato/release/src/router/snmp/agent/snmp_agent.c tomato121/release/src/router/snmp/agent/snmp_agent.c
--- tomato/release/src/router/snmp/agent/snmp_agent.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/snmp_agent.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,2993 @@
+/*
+ * snmp_agent.c
+ *
+ * Simple Network Management Protocol (RFC 1067).
+ */
+/***********************************************************
+	Copyright 1988, 1989 by Carnegie Mellon University
+
+                      All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its 
+documentation for any purpose and without fee is hereby granted, 
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in 
+supporting documentation, and that the name of CMU not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.  
+
+CMU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+CMU BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+******************************************************************/
+
+#include <net-snmp/net-snmp-config.h>
+
+#include <sys/types.h>
+#ifdef HAVE_LIMITS_H
+#include <limits.h>
+#endif
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#if HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#if HAVE_STRING_H
+#include <string.h>
+#endif
+#if TIME_WITH_SYS_TIME
+# ifdef WIN32
+#  include <sys/timeb.h>
+# else
+#  include <sys/time.h>
+# endif
+# include <time.h>
+#else
+# if HAVE_SYS_TIME_H
+#  include <sys/time.h>
+# else
+#  include <time.h>
+# endif
+#endif
+#if HAVE_SYS_SELECT_H
+#include <sys/select.h>
+#endif
+#if HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+#include <errno.h>
+#if HAVE_WINSOCK_H
+#include <winsock.h>
+#endif
+
+#if HAVE_DMALLOC_H
+#include <dmalloc.h>
+#endif
+
+#define SNMP_NEED_REQUEST_LIST
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include <net-snmp/library/snmp_assert.h>
+
+#ifdef USE_LIBWRAP
+#include <syslog.h>
+#include <tcpd.h>
+#include <syslog.h>
+int             allow_severity = LOG_INFO;
+int             deny_severity = LOG_WARNING;
+#endif
+
+#include "snmpd.h"
+#include "mibgroup/struct.h"
+#include "mibgroup/util_funcs.h"
+#include <net-snmp/agent/mib_module_config.h>
+
+#ifdef USING_AGENTX_PROTOCOL_MODULE
+#include "agentx/protocol.h"
+#endif
+
+#ifdef USING_AGENTX_MASTER_MODULE
+#include "agentx/master.h"
+#endif
+
+#define SNMP_ADDRCACHE_SIZE 10
+
+struct addrCache {
+    char           *addr;
+    enum { SNMP_ADDRCACHE_UNUSED = 0,
+        SNMP_ADDRCACHE_USED = 1,
+        SNMP_ADDRCACHE_OLD = 2
+    } status;
+};
+
+static struct addrCache addrCache[SNMP_ADDRCACHE_SIZE];
+int             lastAddrAge = 0;
+int             log_addresses = 0;
+
+
+
+typedef struct _agent_nsap {
+    int             handle;
+    netsnmp_transport *t;
+    void           *s;          /*  Opaque internal session pointer.  */
+    struct _agent_nsap *next;
+} agent_nsap;
+
+static agent_nsap *agent_nsap_list = NULL;
+static netsnmp_agent_session *agent_session_list = NULL;
+static netsnmp_agent_session *netsnmp_processing_set = NULL;
+netsnmp_agent_session *agent_delegated_list = NULL;
+netsnmp_agent_session *netsnmp_agent_queued_list = NULL;
+
+
+int             netsnmp_agent_check_packet(netsnmp_session *,
+                                           struct netsnmp_transport_s *,
+                                           void *, int);
+int             netsnmp_agent_check_parse(netsnmp_session *, netsnmp_pdu *,
+                                          int);
+void            delete_subnetsnmp_tree_cache(netsnmp_agent_session *asp);
+int             handle_pdu(netsnmp_agent_session *asp);
+int             netsnmp_handle_request(netsnmp_agent_session *asp,
+                                       int status);
+int             netsnmp_wrap_up_request(netsnmp_agent_session *asp,
+                                        int status);
+int             check_delayed_request(netsnmp_agent_session *asp);
+int             handle_getnext_loop(netsnmp_agent_session *asp);
+int             handle_set_loop(netsnmp_agent_session *asp);
+
+int             netsnmp_check_queued_chain_for(netsnmp_agent_session *asp);
+int             netsnmp_add_queued(netsnmp_agent_session *asp);
+int             netsnmp_remove_from_delegated(netsnmp_agent_session *asp);
+
+
+static int      current_globalid = 0;
+
+int
+netsnmp_allocate_globalcacheid(void)
+{
+    return ++current_globalid;
+}
+
+int
+netsnmp_get_local_cachid(netsnmp_cachemap *cache_store, int globalid)
+{
+    while (cache_store != NULL) {
+        if (cache_store->globalid == globalid)
+            return cache_store->cacheid;
+        cache_store = cache_store->next;
+    }
+    return -1;
+}
+
+netsnmp_cachemap *
+netsnmp_get_or_add_local_cachid(netsnmp_cachemap **cache_store,
+                                int globalid, int localid)
+{
+    netsnmp_cachemap *tmpp;
+
+    tmpp = SNMP_MALLOC_TYPEDEF(netsnmp_cachemap);
+    if (*cache_store) {
+        tmpp->next = *cache_store;
+        *cache_store = tmpp;
+    } else {
+        *cache_store = tmpp;
+    }
+
+    tmpp->globalid = globalid;
+    tmpp->cacheid = localid;
+    return tmpp;
+}
+
+void
+netsnmp_free_cachemap(netsnmp_cachemap *cache_store)
+{
+    netsnmp_cachemap *tmpp;
+    while (cache_store) {
+        tmpp = cache_store;
+        cache_store = cache_store->next;
+        free(tmpp);
+    }
+}
+
+
+typedef struct agent_set_cache_s {
+    /*
+     * match on these 2 
+     */
+    int             transID;
+    netsnmp_session *sess;
+
+    /*
+     * store this info 
+     */
+    netsnmp_tree_cache *treecache;
+    int             treecache_len;
+    int             treecache_num;
+
+    int             vbcount;
+    netsnmp_request_info *requests;
+    netsnmp_data_list *agent_data;
+
+    /*
+     * list 
+     */
+    struct agent_set_cache_s *next;
+} agent_set_cache;
+
+static agent_set_cache *Sets = NULL;
+
+agent_set_cache *
+save_set_cache(netsnmp_agent_session *asp)
+{
+    agent_set_cache *ptr;
+
+    if (!asp->reqinfo || !asp->pdu)
+        return NULL;
+
+    ptr = SNMP_MALLOC_TYPEDEF(agent_set_cache);
+    if (ptr == NULL)
+        return NULL;
+
+    /*
+     * Save the important information 
+     */
+    ptr->transID = asp->pdu->transid;
+    ptr->sess = asp->session;
+    ptr->treecache = asp->treecache;
+    ptr->treecache_len = asp->treecache_len;
+    ptr->treecache_num = asp->treecache_num;
+    ptr->agent_data = asp->reqinfo->agent_data;
+    ptr->requests = asp->requests;
+    ptr->vbcount = asp->vbcount;
+
+    /*
+     * make the agent forget about what we've saved 
+     */
+    asp->treecache = NULL;
+    asp->reqinfo->agent_data = NULL;
+    asp->pdu->variables = NULL;
+    asp->requests = NULL;
+
+    ptr->next = Sets;
+    Sets = ptr;
+
+    return ptr;
+}
+
+int
+get_set_cache(netsnmp_agent_session *asp)
+{
+    agent_set_cache *ptr, *prev = NULL;
+
+    for (ptr = Sets; ptr != NULL; ptr = ptr->next) {
+        if (ptr->sess == asp->session && ptr->transID == asp->pdu->transid) {
+            if (prev)
+                prev->next = ptr->next;
+            else
+                Sets = ptr->next;
+
+            /*
+             * found it.  Get the needed data 
+             */
+            asp->treecache = ptr->treecache;
+            asp->treecache_len = ptr->treecache_len;
+            asp->treecache_num = ptr->treecache_num;
+            asp->requests = ptr->requests;
+            asp->vbcount = ptr->vbcount;
+            if (!asp->reqinfo) {
+                asp->reqinfo =
+                    SNMP_MALLOC_TYPEDEF(netsnmp_agent_request_info);
+                if (asp->reqinfo) {
+                    asp->reqinfo->asp = asp;
+                    asp->reqinfo->agent_data = ptr->agent_data;
+                }
+            }
+            free(ptr);
+            return SNMP_ERR_NOERROR;
+        }
+        prev = ptr;
+    }
+    return SNMP_ERR_GENERR;
+}
+
+int
+getNextSessID()
+{
+    static int      SessionID = 0;
+
+    return ++SessionID;
+}
+
+int
+agent_check_and_process(int block)
+{
+    int             numfds;
+    fd_set          fdset;
+    struct timeval  timeout = { LONG_MAX, 0 }, *tvp = &timeout;
+    int             count;
+    int             fakeblock = 0;
+
+    numfds = 0;
+    FD_ZERO(&fdset);
+    snmp_select_info(&numfds, &fdset, tvp, &fakeblock);
+    if (block != 0 && fakeblock != 0) {
+        /*
+         * There are no alarms registered, and the caller asked for blocking, so
+         * let select() block forever.  
+         */
+
+        tvp = NULL;
+    } else if (block != 0 && fakeblock == 0) {
+        /*
+         * The caller asked for blocking, but there is an alarm due sooner than
+         * LONG_MAX seconds from now, so use the modified timeout returned by
+         * snmp_select_info as the timeout for select().  
+         */
+
+    } else if (block == 0) {
+        /*
+         * The caller does not want us to block at all.  
+         */
+
+        tvp->tv_sec = 0;
+        tvp->tv_usec = 0;
+    }
+
+    count = select(numfds, &fdset, 0, 0, tvp);
+
+    if (count > 0) {
+        /*
+         * packets found, process them 
+         */
+        snmp_read(&fdset);
+    } else
+        switch (count) {
+        case 0:
+            snmp_timeout();
+            break;
+        case -1:
+            if (errno != EINTR) {
+                snmp_log_perror("select");
+            }
+            return -1;
+        default:
+            snmp_log(LOG_ERR, "select returned %d\n", count);
+            return -1;
+        }                       /* endif -- count>0 */
+
+    /*
+     * Run requested alarms.  
+     */
+    run_alarms();
+
+    return count;
+}
+
+
+
+/*
+ * Set up the address cache.  
+ */
+void
+netsnmp_addrcache_initialise(void)
+{
+    int             i = 0;
+
+    for (i = 0; i < SNMP_ADDRCACHE_SIZE; i++) {
+        addrCache[i].addr = NULL;
+        addrCache[i].status = SNMP_ADDRCACHE_UNUSED;
+    }
+}
+
+
+
+/*
+ * Age the entries in the address cache.  
+ */
+
+void
+netsnmp_addrcache_age(void)
+{
+    int             i = 0;
+
+    lastAddrAge = 0;
+    for (i = 0; i < SNMP_ADDRCACHE_SIZE; i++) {
+        if (addrCache[i].status == SNMP_ADDRCACHE_OLD) {
+            addrCache[i].status = SNMP_ADDRCACHE_UNUSED;
+            if (addrCache[i].addr != NULL) {
+                free(addrCache[i].addr);
+                addrCache[i].addr = NULL;
+            }
+        }
+        if (addrCache[i].status == SNMP_ADDRCACHE_USED) {
+            addrCache[i].status = SNMP_ADDRCACHE_OLD;
+        }
+    }
+}
+
+/*******************************************************************-o-******
+ * netsnmp_agent_check_packet
+ *
+ * Parameters:
+ *	session, transport, transport_data, transport_data_length
+ *      
+ * Returns:
+ *	1	On success.
+ *	0	On error.
+ *
+ * Handler for all incoming messages (a.k.a. packets) for the agent.  If using
+ * the libwrap utility, log the connection and deny/allow the access. Print
+ * output when appropriate, and increment the incoming counter.
+ *
+ */
+
+int
+netsnmp_agent_check_packet(netsnmp_session * session,
+                           netsnmp_transport *transport,
+                           void *transport_data, int transport_data_length)
+{
+    char           *addr_string = NULL;
+#ifdef USE_LIBWRAP
+    char           *fcolon_ptr = NULL, *lcolon_ptr = NULL, *wrap_addr = NULL;
+#endif
+    int             i = 0;
+
+    /*
+     * Log the message and/or dump the message.
+     * Optionally cache the network address of the sender.
+     */
+
+    if (transport != NULL && transport->f_fmtaddr != NULL) {
+        /*
+         * Okay I do know how to format this address for logging.  
+         */
+        addr_string = transport->f_fmtaddr(transport, transport_data,
+                                           transport_data_length);
+        /*
+         * Don't forget to free() it.  
+         */
+    }
+#ifdef  USE_LIBWRAP
+    if (addr_string != NULL) {
+        if ((wrap_addr = strdup(addr_string)) != NULL) {
+	  fcolon_ptr = strchr(wrap_addr, ':');
+	  lcolon_ptr = strrchr(wrap_addr, ':');
+	  if (lcolon_ptr != NULL)
+	     *lcolon_ptr = NULL;
+	  if (fcolon_ptr != NULL) {
+	    fcolon_ptr++;
+	    if (hosts_ctl("snmpd", STRING_UNKNOWN, fcolon_ptr, STRING_UNKNOWN)) {
+		snmp_log(allow_severity, "Connection from %s\n", addr_string);
+	    } else {
+		snmp_log(deny_severity, "Connection from %s REFUSED\n",
+			 addr_string);
+		free(wrap_addr);
+		free(addr_string);
+		return 0;
+	    }
+	  }
+	  free(wrap_addr);
+	  wrap_addr = NULL;
+	}
+    } else {
+        if (hosts_ctl("snmpd", STRING_UNKNOWN, STRING_UNKNOWN, STRING_UNKNOWN)){
+            snmp_log(allow_severity, "Connection from <UNKNOWN>\n");
+            addr_string = strdup("<UNKNOWN>");
+        } else {
+            snmp_log(deny_severity, "Connection from <UNKNOWN> REFUSED\n");
+            return 0;
+        }
+    }
+#endif                          /*USE_LIBWRAP */
+
+    snmp_increment_statistic(STAT_SNMPINPKTS);
+
+    if (log_addresses || netsnmp_ds_get_boolean(NETSNMP_DS_APPLICATION_ID, 
+						NETSNMP_DS_AGENT_VERBOSE)) {
+        for (i = 0; i < SNMP_ADDRCACHE_SIZE; i++) {
+            if ((addrCache[i].status != SNMP_ADDRCACHE_UNUSED) &&
+                (strcmp(addrCache[i].addr, addr_string) == 0)) {
+                break;
+            }
+        }
+
+        if (i >= SNMP_ADDRCACHE_SIZE ||
+	    netsnmp_ds_get_boolean(NETSNMP_DS_APPLICATION_ID, 
+				   NETSNMP_DS_AGENT_VERBOSE)) {
+            /*
+             * Address wasn't in the cache, so log the packet...  
+             */
+            snmp_log(LOG_INFO, "Received SNMP packet(s) from %s\n",
+                     addr_string);
+            /*
+             * ...and try to cache the address.  
+             */
+            for (i = 0; i < SNMP_ADDRCACHE_SIZE; i++) {
+                if (addrCache[i].status == SNMP_ADDRCACHE_UNUSED) {
+                    if (addrCache[i].addr != NULL) {
+                        free(addrCache[i].addr);
+                    }
+                    addrCache[i].addr = addr_string;
+                    addrCache[i].status = SNMP_ADDRCACHE_USED;
+                    addr_string = NULL; /* Don't free this 'temporary' string
+                                         * since it's now part of the cache */
+                    break;
+                }
+            }
+            if (i >= SNMP_ADDRCACHE_SIZE) {
+                /*
+                 * We didn't find a free slot to cache the address.  Perhaps
+                 * we should be using an LRU replacement policy here or
+                 * something.  Oh well.
+                 */
+                DEBUGMSGTL(("netsnmp_agent_check_packet",
+                            "cache overrun"));
+            }
+        } else {
+            addrCache[i].status = SNMP_ADDRCACHE_USED;
+        }
+    }
+
+    if (addr_string != NULL) {
+        free(addr_string);
+        addr_string = NULL;
+    }
+    return 1;
+}
+
+
+int
+netsnmp_agent_check_parse(netsnmp_session * session, netsnmp_pdu *pdu,
+                          int result)
+{
+    if (result == 0) {
+        if (snmp_get_do_logging() &&
+	    netsnmp_ds_get_boolean(NETSNMP_DS_APPLICATION_ID, 
+				   NETSNMP_DS_AGENT_VERBOSE)) {
+            netsnmp_variable_list *var_ptr;
+
+            switch (pdu->command) {
+            case SNMP_MSG_GET:
+                snmp_log(LOG_DEBUG, "  GET message\n");
+                break;
+            case SNMP_MSG_GETNEXT:
+                snmp_log(LOG_DEBUG, "  GETNEXT message\n");
+                break;
+            case SNMP_MSG_RESPONSE:
+                snmp_log(LOG_DEBUG, "  RESPONSE message\n");
+                break;
+            case SNMP_MSG_SET:
+                snmp_log(LOG_DEBUG, "  SET message\n");
+                break;
+            case SNMP_MSG_TRAP:
+                snmp_log(LOG_DEBUG, "  TRAP message\n");
+                break;
+            case SNMP_MSG_GETBULK:
+                snmp_log(LOG_DEBUG, "  GETBULK message, non-rep=%d, max_rep=%d\n",
+                         pdu->errstat, pdu->errindex);
+                break;
+            case SNMP_MSG_INFORM:
+                snmp_log(LOG_DEBUG, "  INFORM message\n");
+                break;
+            case SNMP_MSG_TRAP2:
+                snmp_log(LOG_DEBUG, "  TRAP2 message\n");
+                break;
+            case SNMP_MSG_REPORT:
+                snmp_log(LOG_DEBUG, "  REPORT message\n");
+                break;
+
+            case SNMP_MSG_INTERNAL_SET_RESERVE1:
+                snmp_log(LOG_DEBUG, "  INTERNAL RESERVE1 message\n");
+                break;
+
+            case SNMP_MSG_INTERNAL_SET_RESERVE2:
+                snmp_log(LOG_DEBUG, "  INTERNAL RESERVE2 message\n");
+                break;
+
+            case SNMP_MSG_INTERNAL_SET_ACTION:
+                snmp_log(LOG_DEBUG, "  INTERNAL ACTION message\n");
+                break;
+
+            case SNMP_MSG_INTERNAL_SET_COMMIT:
+                snmp_log(LOG_DEBUG, "  INTERNAL COMMIT message\n");
+                break;
+
+            case SNMP_MSG_INTERNAL_SET_FREE:
+                snmp_log(LOG_DEBUG, "  INTERNAL FREE message\n");
+                break;
+
+            case SNMP_MSG_INTERNAL_SET_UNDO:
+                snmp_log(LOG_DEBUG, "  INTERNAL UNDO message\n");
+                break;
+
+            default:
+                snmp_log(LOG_DEBUG, "  UNKNOWN message, type=%02X\n",
+                         pdu->command);
+                snmp_increment_statistic(STAT_SNMPINASNPARSEERRS);
+                return 0;
+            }
+
+            for (var_ptr = pdu->variables; var_ptr != NULL;
+                 var_ptr = var_ptr->next_variable) {
+                size_t          c_oidlen = 256, c_outlen = 0;
+                u_char         *c_oid = (u_char *) malloc(c_oidlen);
+
+                if (c_oid) {
+                    if (!sprint_realloc_objid
+                        (&c_oid, &c_oidlen, &c_outlen, 1, var_ptr->name,
+                         var_ptr->name_length)) {
+                        snmp_log(LOG_DEBUG, "    -- %s [TRUNCATED]\n",
+                                 c_oid);
+                    } else {
+                        snmp_log(LOG_DEBUG, "    -- %s\n", c_oid);
+                    }
+                    free(c_oid);
+                }
+            }
+        }
+        return 1;
+    }
+    return 0;                   /* XXX: does it matter what the return value
+                                 * is?  Yes: if we return 0, then the PDU is
+                                 * dumped.  */
+}
+
+
+/*
+ * Global access to the primary session structure for this agent.
+ * for Index Allocation use initially. 
+ */
+
+/*
+ * I don't understand what this is for at the moment.  AFAICS as long as it
+ * gets set and points at a session, that's fine.  ???  
+ */
+
+netsnmp_session *main_session = NULL;
+
+
+
+/*
+ * Set up an agent session on the given transport.  Return a handle
+ * which may later be used to de-register this transport.  A return
+ * value of -1 indicates an error.  
+ */
+
+int
+netsnmp_register_agent_nsap(netsnmp_transport *t)
+{
+    netsnmp_session *s, *sp = NULL;
+    agent_nsap     *a = NULL, *n = NULL, **prevNext = &agent_nsap_list;
+    int             handle = 0;
+    void           *isp = NULL;
+
+    if (t == NULL) {
+        return -1;
+    }
+
+    DEBUGMSGTL(("netsnmp_register_agent_nsap", "fd %d\n", t->sock));
+
+    n = (agent_nsap *) malloc(sizeof(agent_nsap));
+    if (n == NULL) {
+        return -1;
+    }
+    s = (netsnmp_session *) malloc(sizeof(netsnmp_session));
+    if (s == NULL) {
+        free(n);
+        return -1;
+    }
+    memset(s, 0, sizeof(netsnmp_session));
+    snmp_sess_init(s);
+
+    /*
+     * Set up the session appropriately for an agent.  
+     */
+
+    s->version = SNMP_DEFAULT_VERSION;
+    s->callback = handle_snmp_packet;
+    s->authenticator = NULL;
+    s->flags = netsnmp_ds_get_int(NETSNMP_DS_APPLICATION_ID, 
+				  NETSNMP_DS_AGENT_FLAGS);
+    s->isAuthoritative = SNMP_SESS_AUTHORITATIVE;
+
+    sp = snmp_add(s, t, netsnmp_agent_check_packet,
+                  netsnmp_agent_check_parse);
+    if (sp == NULL) {
+        free(s);
+        free(n);
+        return -1;
+    }
+
+    isp = snmp_sess_pointer(sp);
+    if (isp == NULL) {          /*  over-cautious  */
+        free(s);
+        free(n);
+        return -1;
+    }
+
+    n->s = isp;
+    n->t = t;
+
+    if (main_session == NULL) {
+        main_session = snmp_sess_session(isp);
+    }
+
+    for (a = agent_nsap_list; a != NULL && handle + 1 >= a->handle;
+         a = a->next) {
+        handle = a->handle;
+        prevNext = &(a->next);
+    }
+
+    if (handle < INT_MAX) {
+        n->handle = handle + 1;
+        n->next = a;
+        *prevNext = n;
+        free(s);
+        return n->handle;
+    } else {
+        free(s);
+        free(n);
+        return -1;
+    }
+}
+
+void
+netsnmp_deregister_agent_nsap(int handle)
+{
+    agent_nsap     *a = NULL, **prevNext = &agent_nsap_list;
+    int             main_session_deregistered = 0;
+
+    DEBUGMSGTL(("netsnmp_deregister_agent_nsap", "handle %d\n", handle));
+
+    for (a = agent_nsap_list; a != NULL && a->handle < handle; a = a->next) {
+        prevNext = &(a->next);
+    }
+
+    if (a != NULL && a->handle == handle) {
+        *prevNext = a->next;
+        if (main_session == snmp_sess_session(a->s)) {
+            main_session_deregistered = 1;
+        }
+        snmp_close(snmp_sess_session(a->s));
+        /*
+         * The above free()s the transport and session pointers.  
+         */
+        free(a);
+    }
+
+    /*
+     * If we've deregistered the session that main_session used to point to,
+     * then make it point to another one, or in the last resort, make it equal
+     * to NULL.  Basically this shouldn't ever happen in normal operation
+     * because main_session starts off pointing at the first session added by
+     * init_master_agent(), which then discards the handle.  
+     */
+
+    if (main_session_deregistered) {
+        if (agent_nsap_list != NULL) {
+            DEBUGMSGTL(("snmp_agent",
+			"WARNING: main_session ptr changed from %p to %p\n",
+                        main_session, snmp_sess_session(agent_nsap_list->s)));
+            main_session = snmp_sess_session(agent_nsap_list->s);
+        } else {
+            DEBUGMSGTL(("snmp_agent",
+			"WARNING: main_session ptr changed from %p to NULL\n",
+                        main_session));
+            main_session = NULL;
+        }
+    }
+}
+
+
+
+/*
+ * 
+ * This function has been modified to use the experimental
+ * netsnmp_register_agent_nsap interface.  The major responsibility of this
+ * function now is to interpret a string specified to the agent (via -p on the
+ * command line, or from a configuration file) as a list of agent NSAPs on
+ * which to listen for SNMP packets.  Typically, when you add a new transport
+ * domain "foo", you add code here such that if the "foo" code is compiled
+ * into the agent (SNMP_TRANSPORT_FOO_DOMAIN is defined), then a token of the
+ * form "foo:bletch-3a0054ef%wob&wob" gets turned into the appropriate
+ * transport descriptor.  netsnmp_register_agent_nsap is then called with that
+ * transport descriptor and sets up a listening agent session on it.
+ * 
+ * Everything then works much as normal: the agent runs in an infinite loop
+ * (in the snmpd.c/receive()routine), which calls snmp_read() when a request
+ * is readable on any of the given transports.  This routine then traverses
+ * the library 'Sessions' list to identify the relevant session and eventually
+ * invokes '_sess_read'.  This then processes the incoming packet, calling the
+ * pre_parse, parse, post_parse and callback routines in turn.
+ * 
+ * JBPN 20001117
+ */
+
+int
+init_master_agent(void)
+{
+    netsnmp_transport *transport;
+    char           *cptr;
+    char            buf[SPRINT_MAX_LEN];
+
+    /* default to turning off lookup caching */
+    netsnmp_set_lookup_cache_size(0);
+
+    if (netsnmp_ds_get_boolean(NETSNMP_DS_APPLICATION_ID, 
+			       NETSNMP_DS_AGENT_ROLE) != MASTER_AGENT) {
+        DEBUGMSGTL(("snmp_agent",
+                    "init_master_agent; not master agent\n"));
+        return 0;               /*  No error if ! MASTER_AGENT  */
+    }
+#ifdef USING_AGENTX_MASTER_MODULE
+    if (netsnmp_ds_get_boolean(NETSNMP_DS_APPLICATION_ID, 
+			       NETSNMP_DS_AGENT_AGENTX_MASTER) == 1)
+        real_init_master();
+#endif
+
+    /*
+     * Have specific agent ports been specified?  
+     */
+    cptr = netsnmp_ds_get_string(NETSNMP_DS_APPLICATION_ID, 
+				 NETSNMP_DS_AGENT_PORTS);
+
+    if (cptr) {
+        snprintf(buf, sizeof(buf), "%s", cptr);
+        buf[ sizeof(buf)-1 ] = 0;
+    } else {
+        /*
+         * No, so just specify the default port.  
+         */
+        if (netsnmp_ds_get_int(NETSNMP_DS_APPLICATION_ID, NETSNMP_DS_AGENT_FLAGS) & SNMP_FLAGS_STREAM_SOCKET) {
+            sprintf(buf, "tcp:%d", SNMP_PORT);
+        } else {
+            sprintf(buf, "udp:%d", SNMP_PORT);
+        }
+    }
+
+    DEBUGMSGTL(("snmp_agent", "final port spec: %s\n", buf));
+    cptr = strtok(buf, ",");
+    while (cptr) {
+        /*
+         * Specification format: 
+         * 
+         * NONE:                      (a pseudo-transport)
+         * UDP:[address:]port        (also default if no transport is specified)
+         * TCP:[address:]port         (if supported)
+         * Unix:pathname              (if supported)
+         * AAL5PVC:itf.vpi.vci        (if supported)
+         * IPX:[network]:node[/port] (if supported)
+         * 
+         */
+
+        DEBUGMSGTL(("snmp_agent", "installing master agent on port %s\n",
+                    cptr));
+
+        if (!cptr || !(*cptr)) {
+            snmp_log(LOG_ERR, "improper port specification\n");
+            return 1;
+        }
+
+        if (strncasecmp(cptr, "none", 4) == 0) {
+            DEBUGMSGTL(("snmp_agent",
+                        "init_master_agent; pseudo-transport \"none\" requested\n"));
+            return 0;
+        }
+        transport = netsnmp_tdomain_transport(cptr, 1, "udp");
+
+        if (transport == NULL) {
+            snmp_log(LOG_ERR, "Error opening specified endpoint \"%s\"\n",
+                     cptr);
+            return 1;
+        }
+
+        if (netsnmp_register_agent_nsap(transport) == 0) {
+            snmp_log(LOG_ERR,
+                     "Error registering specified transport \"%s\" as an agent NSAP\n",
+                     cptr);
+            return 1;
+        } else {
+            DEBUGMSGTL(("snmp_agent",
+                        "init_master_agent; \"%s\" registered as an agent NSAP\n",
+                        cptr));
+        }
+
+        /*
+         * Next transport please...  
+         */
+        cptr = strtok(NULL, ",");
+    }
+
+    return 0;
+}
+
+
+
+netsnmp_agent_session *
+init_agent_snmp_session(netsnmp_session * session, netsnmp_pdu *pdu)
+{
+    netsnmp_agent_session *asp = (netsnmp_agent_session *)
+        calloc(1, sizeof(netsnmp_agent_session));
+
+    if (asp == NULL) {
+        return NULL;
+    }
+
+    DEBUGMSGTL(("snmp_agent","agent_sesion %08p created\n", asp));
+    asp->session = session;
+    asp->pdu = snmp_clone_pdu(pdu);
+    asp->orig_pdu = snmp_clone_pdu(pdu);
+    asp->rw = READ;
+    asp->exact = TRUE;
+    asp->next = NULL;
+    asp->mode = RESERVE1;
+    asp->status = SNMP_ERR_NOERROR;
+    asp->index = 0;
+    asp->oldmode = 0;
+    asp->treecache_num = -1;
+    asp->treecache_len = 0;
+
+    return asp;
+}
+
+void
+free_agent_snmp_session(netsnmp_agent_session *asp)
+{
+    if (!asp)
+        return;
+
+    DEBUGMSGTL(("snmp_agent","agent_sesion %08p released\n", asp));
+
+    netsnmp_remove_from_delegated(asp);
+    
+    if (asp->orig_pdu)
+        snmp_free_pdu(asp->orig_pdu);
+    if (asp->pdu)
+        snmp_free_pdu(asp->pdu);
+    if (asp->reqinfo)
+        netsnmp_free_agent_request_info(asp->reqinfo);
+    if (asp->treecache) {
+        free(asp->treecache);
+    }
+    if (asp->bulkcache) {
+        free(asp->bulkcache);
+    }
+    if (asp->requests) {
+        int             i;
+        for (i = 0; i < asp->vbcount; i++) {
+            netsnmp_free_request_data_sets(&asp->requests[i]);
+        }
+    }
+    if (asp->requests) {
+        free(asp->requests);
+    }
+    if (asp->cache_store) {
+        netsnmp_free_cachemap(asp->cache_store);
+        asp->cache_store = NULL;
+    }
+    free(asp);
+}
+
+int
+netsnmp_check_for_delegated(netsnmp_agent_session *asp)
+{
+    int             i;
+    netsnmp_request_info *request;
+
+    if (NULL == asp->treecache)
+        return 0;
+    
+    for (i = 0; i <= asp->treecache_num; i++) {
+        for (request = asp->treecache[i].requests_begin; request;
+             request = request->next) {
+            if (request->delegated)
+                return 1;
+        }
+    }
+    return 0;
+}
+
+int
+netsnmp_check_delegated_chain_for(netsnmp_agent_session *asp)
+{
+    netsnmp_agent_session *asptmp;
+    for (asptmp = agent_delegated_list; asptmp; asptmp = asptmp->next) {
+        if (asptmp == asp)
+            return 1;
+    }
+    return 0;
+}
+
+int
+netsnmp_check_for_delegated_and_add(netsnmp_agent_session *asp)
+{
+    if (netsnmp_check_for_delegated(asp)) {
+        if (!netsnmp_check_delegated_chain_for(asp)) {
+            /*
+             * add to delegated request chain 
+             */
+            asp->next = agent_delegated_list;
+            agent_delegated_list = asp;
+            DEBUGMSGTL(("snmp_agent", "delegate session == %08p\n", asp));
+        }
+        return 1;
+    }
+    return 0;
+}
+
+int
+netsnmp_remove_from_delegated(netsnmp_agent_session *asp)
+{
+    netsnmp_agent_session *curr, *prev = NULL;
+    
+    for (curr = agent_delegated_list; curr; prev = curr, curr = curr->next) {
+        /*
+         * is this us?
+         */
+        if (curr != asp)
+            continue;
+        
+        /*
+         * remove from queue 
+         */
+        if (prev != NULL)
+            prev->next = asp->next;
+        else
+            agent_delegated_list = asp->next;
+
+        DEBUGMSGTL(("snmp_agent", "remove delegated session == %08p\n", asp));
+
+        return 1;
+    }
+
+    return 0;
+}
+
+/*
+ * netsnmp_remove_delegated_requests_for_session
+ *
+ * called when a session is being closed. Check all delegated requests to
+ * see if the are waiting on this session, and if set, set the status for
+ * that request to GENERR.
+ */
+int
+netsnmp_remove_delegated_requests_for_session(netsnmp_session *sess)
+{
+    netsnmp_agent_session *asp;
+    int count = 0;
+    
+    for (asp = agent_delegated_list; asp; asp = asp->next) {
+        /*
+         * check each request
+         */
+        netsnmp_request_info *request;
+        for(request = asp->requests; request; request = request->next) {
+            /*
+             * check session
+             */
+            netsnmp_assert(NULL!=request->subtree);
+            if(request->subtree->session != sess)
+                continue;
+
+            /*
+             * matched! mark request as done
+             */
+            netsnmp_set_mode_request_error(MODE_SET_BEGIN, request,
+                                           SNMP_ERR_GENERR);
+            ++count;
+        }
+    }
+
+    /*
+     * if we found any, that request may be finished now
+     */
+    if(count) {
+        DEBUGMSGTL(("snmp_agent", "removed %d delegated request(s) for session "
+                    "%08p\n", count, sess));
+        netsnmp_check_outstanding_agent_requests();
+    }
+    
+    return count;
+}
+
+int
+netsnmp_check_queued_chain_for(netsnmp_agent_session *asp)
+{
+    netsnmp_agent_session *asptmp;
+    for (asptmp = netsnmp_agent_queued_list; asptmp; asptmp = asptmp->next) {
+        if (asptmp == asp)
+            return 1;
+    }
+    return 0;
+}
+
+int
+netsnmp_add_queued(netsnmp_agent_session *asp)
+{
+    netsnmp_agent_session *asp_tmp;
+
+    /*
+     * first item?
+     */
+    if (NULL == netsnmp_agent_queued_list) {
+        netsnmp_agent_queued_list = asp;
+        return 1;
+    }
+
+
+    /*
+     * add to end of queued request chain 
+     */
+    asp_tmp = netsnmp_agent_queued_list;
+    for (; asp_tmp; asp_tmp = asp_tmp->next) {
+        /*
+         * already in queue?
+         */
+        if (asp_tmp == asp)
+            break;
+
+        /*
+         * end of queue?
+         */
+        if (NULL == asp_tmp->next)
+            asp_tmp->next = asp;
+    }
+    return 1;
+}
+
+
+int
+netsnmp_wrap_up_request(netsnmp_agent_session *asp, int status)
+{
+    netsnmp_variable_list *var_ptr;
+    int             i, n = 0, r = 0;
+
+    /*
+     * Update asp->status if necessary. Fixes ro/rw problem.
+     */
+    if ( status != 0  && asp->status == 0 )
+          asp->status = status;
+
+    /*
+     * if this request was a set, clear the global now that we are
+     * done.
+     */
+    if (asp == netsnmp_processing_set) {
+        DEBUGMSGTL(("snmp_agent", "SET request complete, asp = %08p\n",
+                    asp));
+        netsnmp_processing_set = NULL;
+    }
+
+    /*
+     * some stuff needs to be saved in special subagent cases 
+     */
+    if (asp->pdu) {
+
+        switch (asp->pdu->command) {
+            case SNMP_MSG_INTERNAL_SET_BEGIN:
+            case SNMP_MSG_INTERNAL_SET_RESERVE1:
+            case SNMP_MSG_INTERNAL_SET_RESERVE2:
+            case SNMP_MSG_INTERNAL_SET_ACTION:
+                save_set_cache(asp);
+                break;
+        }
+
+        /*
+         * if this is a GETBULK response we need to rearrange the varbinds 
+         */
+        if (asp->pdu->command == SNMP_MSG_GETBULK) {
+            int             repeats = asp->pdu->errindex;
+            int             j;
+            
+            if (asp->pdu->errstat < asp->vbcount) {
+                n = asp->pdu->errstat;
+            } else {
+                n = asp->vbcount;
+            }
+            if ((r = asp->vbcount - n) < 0) {
+                r = 0;
+            }
+            
+            for (i = 0; i < r - 1; i++) {
+                for (j = 0; j < repeats; j++) {
+                    asp->bulkcache[i * repeats + j]->next_variable =
+                        asp->bulkcache[(i + 1) * repeats + j];
+                }
+            }
+            if (r > 0) {
+                for (j = 0; j < repeats - 1; j++) {
+                    asp->bulkcache[(r - 1) * repeats + j]->next_variable =
+                        asp->bulkcache[j + 1];
+                }
+            }
+        }
+
+        /*
+         * May need to "dumb down" a SET error status for a
+         * v1 query.  See RFC2576 - section 4.3
+         */
+        if ((asp->pdu->command == SNMP_MSG_SET) &&
+            (asp->pdu->version == SNMP_VERSION_1)) {
+            switch (status) {
+                case SNMP_ERR_WRONGVALUE:
+                case SNMP_ERR_WRONGENCODING:
+                case SNMP_ERR_WRONGTYPE:
+                case SNMP_ERR_WRONGLENGTH:
+                case SNMP_ERR_INCONSISTENTVALUE:
+                    status = SNMP_ERR_BADVALUE;
+                    asp->status = SNMP_ERR_BADVALUE;
+                    break;
+                case SNMP_ERR_NOACCESS:
+                case SNMP_ERR_NOTWRITABLE:
+                case SNMP_ERR_NOCREATION:
+                case SNMP_ERR_INCONSISTENTNAME:
+                case SNMP_ERR_AUTHORIZATIONERROR:
+                    status = SNMP_ERR_NOSUCHNAME;
+                    asp->status = SNMP_ERR_NOSUCHNAME;
+                    break;
+                case SNMP_ERR_RESOURCEUNAVAILABLE:
+                case SNMP_ERR_COMMITFAILED:
+                case SNMP_ERR_UNDOFAILED:
+                    status = SNMP_ERR_GENERR;
+                    asp->status = SNMP_ERR_GENERR;
+                    break;
+            }
+        }
+        /*
+         * Similarly we may need to "dumb down" v2 exception
+         *  types to throw an error for a v1 query.
+         *  See RFC2576 - section 4.1.2.3
+         */
+        if ((asp->pdu->command != SNMP_MSG_SET) &&
+            (asp->pdu->version == SNMP_VERSION_1)) {
+            for (var_ptr = asp->pdu->variables, i = 1;
+                 var_ptr != NULL; var_ptr = var_ptr->next_variable, i++) {
+                switch (var_ptr->type) {
+                    case SNMP_NOSUCHOBJECT:
+                    case SNMP_NOSUCHINSTANCE:
+                    case SNMP_ENDOFMIBVIEW:
+                    case ASN_COUNTER64:
+                        status = SNMP_ERR_NOSUCHNAME;
+                        asp->status = SNMP_ERR_NOSUCHNAME;
+                        asp->index = i;
+                        break;
+                }
+            }
+        }
+    } /** if asp->pdu */
+
+    /*
+     * Update the snmp error-count statistics
+     *   XXX - should we include the V2 errors in this or not?
+     */
+#define INCLUDE_V2ERRORS_IN_V1STATS
+
+    switch (status) {
+#ifdef INCLUDE_V2ERRORS_IN_V1STATS
+    case SNMP_ERR_WRONGVALUE:
+    case SNMP_ERR_WRONGENCODING:
+    case SNMP_ERR_WRONGTYPE:
+    case SNMP_ERR_WRONGLENGTH:
+    case SNMP_ERR_INCONSISTENTVALUE:
+#endif
+    case SNMP_ERR_BADVALUE:
+        snmp_increment_statistic(STAT_SNMPOUTBADVALUES);
+        break;
+#ifdef INCLUDE_V2ERRORS_IN_V1STATS
+    case SNMP_ERR_NOACCESS:
+    case SNMP_ERR_NOTWRITABLE:
+    case SNMP_ERR_NOCREATION:
+    case SNMP_ERR_INCONSISTENTNAME:
+    case SNMP_ERR_AUTHORIZATIONERROR:
+#endif
+    case SNMP_ERR_NOSUCHNAME:
+        snmp_increment_statistic(STAT_SNMPOUTNOSUCHNAMES);
+        break;
+#ifdef INCLUDE_V2ERRORS_IN_V1STATS
+    case SNMP_ERR_RESOURCEUNAVAILABLE:
+    case SNMP_ERR_COMMITFAILED:
+    case SNMP_ERR_UNDOFAILED:
+#endif
+    case SNMP_ERR_GENERR:
+        snmp_increment_statistic(STAT_SNMPOUTGENERRS);
+        break;
+
+    case SNMP_ERR_TOOBIG:
+        snmp_increment_statistic(STAT_SNMPOUTTOOBIGS);
+        break;
+    }
+
+    if ((status == SNMP_ERR_NOERROR) && (asp->pdu)) {
+        snmp_increment_statistic_by((asp->pdu->command == SNMP_MSG_SET ?
+                                     STAT_SNMPINTOTALSETVARS :
+                                     STAT_SNMPINTOTALREQVARS),
+                                    count_varbinds(asp->pdu->variables));
+    } else {
+        /*
+         * Use a copy of the original request
+         *   to report failures.
+         */
+        snmp_free_pdu(asp->pdu);
+        asp->pdu = asp->orig_pdu;
+        asp->orig_pdu = NULL;
+    }
+    if (asp->pdu) {
+        asp->pdu->command = SNMP_MSG_RESPONSE;
+        asp->pdu->errstat = asp->status;
+        asp->pdu->errindex = asp->index;
+        if (!snmp_send(asp->session, asp->pdu)) {
+            snmp_free_pdu(asp->pdu);
+            asp->pdu = NULL;
+        }
+        snmp_increment_statistic(STAT_SNMPOUTPKTS);
+        snmp_increment_statistic(STAT_SNMPOUTGETRESPONSES);
+        asp->pdu = NULL;
+        netsnmp_remove_and_free_agent_snmp_session(asp);
+    }
+    return 1;
+}
+
+void
+dump_sess_list(void)
+{
+    netsnmp_agent_session *a;
+
+    DEBUGMSGTL(("snmp_agent", "DUMP agent_sess_list -> "));
+    for (a = agent_session_list; a != NULL; a = a->next) {
+        DEBUGMSG(("snmp_agent", "%08p[session %08p] -> ", a, a->session));
+    }
+    DEBUGMSG(("snmp_agent", "[NIL]\n"));
+}
+
+void
+netsnmp_remove_and_free_agent_snmp_session(netsnmp_agent_session *asp)
+{
+    netsnmp_agent_session *a, **prevNext = &agent_session_list;
+
+    DEBUGMSGTL(("snmp_agent", "REMOVE session == %08p\n", asp));
+
+    for (a = agent_session_list; a != NULL; a = *prevNext) {
+        if (a == asp) {
+            *prevNext = a->next;
+            a->next = NULL;
+            free_agent_snmp_session(a);
+            asp = NULL;
+            break;
+        } else {
+            prevNext = &(a->next);
+        }
+    }
+
+    if (a == NULL && asp != NULL) {
+        /*
+         * We coulnd't find it on the list, so free it anyway.  
+         */
+        free_agent_snmp_session(asp);
+    }
+}
+
+void
+netsnmp_free_agent_snmp_session_by_session(netsnmp_session * sess,
+                                           void (*free_request)
+                                           (netsnmp_request_list *))
+{
+    netsnmp_agent_session *a, *next, **prevNext = &agent_session_list;
+
+    DEBUGMSGTL(("snmp_agent", "REMOVE session == %08p\n", sess));
+
+    for (a = agent_session_list; a != NULL; a = next) {
+        if (a->session == sess) {
+            *prevNext = a->next;
+            next = a->next;
+            free_agent_snmp_session(a);
+        } else {
+            prevNext = &(a->next);
+            next = a->next;
+        }
+    }
+}
+
+/** handles an incoming SNMP packet into the agent */
+int
+handle_snmp_packet(int op, netsnmp_session * session, int reqid,
+                   netsnmp_pdu *pdu, void *magic)
+{
+    netsnmp_agent_session *asp;
+    int             status, access_ret, rc;
+
+    /*
+     * We only support receiving here.  
+     */
+    if (op != NETSNMP_CALLBACK_OP_RECEIVED_MESSAGE) {
+        return 1;
+    }
+
+    /*
+     * RESPONSE messages won't get this far, but TRAP-like messages
+     * might.  
+     */
+    if (pdu->command == SNMP_MSG_TRAP || pdu->command == SNMP_MSG_INFORM ||
+        pdu->command == SNMP_MSG_TRAP2) {
+        DEBUGMSGTL(("snmp_agent", "received trap-like PDU (%02x)\n",
+                    pdu->command));
+        pdu->command = SNMP_MSG_TRAP2;
+        snmp_increment_statistic(STAT_SNMPUNKNOWNPDUHANDLERS);
+        return 1;
+    }
+
+    if (magic == NULL) {
+        asp = init_agent_snmp_session(session, pdu);
+        status = SNMP_ERR_NOERROR;
+    } else {
+        asp = (netsnmp_agent_session *) magic;
+        status = asp->status;
+    }
+
+    if ((access_ret = check_access(pdu)) != 0) {
+        if (access_ret == VACM_NOSUCHCONTEXT) {
+            /*
+             * rfc2573 section 3.2, step 5 says that we increment the
+             * counter but don't return a response of any kind 
+             */
+
+            /*
+             * we currently don't support unavailable contexts, as
+             * there is no reason to that I currently know of 
+             */
+            snmp_increment_statistic(STAT_SNMPUNKNOWNCONTEXTS);
+
+            /*
+             * drop the request 
+             */
+            netsnmp_remove_and_free_agent_snmp_session(asp);
+            return 0;
+        } else {
+            /*
+             * access control setup is incorrect 
+             */
+            send_easy_trap(SNMP_TRAP_AUTHFAIL, 0);
+            if (asp->pdu->version != SNMP_VERSION_1
+                && asp->pdu->version != SNMP_VERSION_2c) {
+                asp->pdu->errstat = SNMP_ERR_AUTHORIZATIONERROR;
+                asp->pdu->command = SNMP_MSG_RESPONSE;
+                snmp_increment_statistic(STAT_SNMPOUTPKTS);
+                if (!snmp_send(asp->session, asp->pdu))
+                    snmp_free_pdu(asp->pdu);
+                asp->pdu = NULL;
+                netsnmp_remove_and_free_agent_snmp_session(asp);
+                return 1;
+            } else {
+                /*
+                 * drop the request 
+                 */
+                netsnmp_remove_and_free_agent_snmp_session(asp);
+                return 0;
+            }
+        }
+    }
+
+    rc = netsnmp_handle_request(asp, status);
+
+    /*
+     * done 
+     */
+    DEBUGMSGTL(("snmp_agent", "end of handle_snmp_packet, asp = %08p\n",
+                asp));
+    return rc;
+}
+
+netsnmp_request_info *
+netsnmp_add_varbind_to_cache(netsnmp_agent_session *asp, int vbcount,
+                             netsnmp_variable_list * varbind_ptr,
+                             netsnmp_subtree *tp)
+{
+    netsnmp_request_info *request = NULL;
+    int             cacheid;
+
+    DEBUGMSGTL(("snmp_agent", "add_vb_to_cache(%8p, %d, ", asp, vbcount));
+    DEBUGMSGOID(("snmp_agent", varbind_ptr->name,
+                 varbind_ptr->name_length));
+    DEBUGMSG(("snmp_agent", ", %8p)\n", tp));
+
+    if (tp &&
+        (asp->pdu->command == SNMP_MSG_GETNEXT ||
+         asp->pdu->command == SNMP_MSG_GETBULK)) {
+        int result;
+        int prefix_len;
+
+        prefix_len = netsnmp_oid_find_prefix(tp->start_a,
+                                             tp->start_len,
+                                             tp->end_a, tp->end_len);
+        result =
+            netsnmp_acm_check_subtree(asp->pdu, tp->start_a, prefix_len);
+
+        while (result == VACM_NOTINVIEW) {
+            /* the entire subtree is not in view. Skip it. */
+            /** @todo make this be more intelligent about ranges.
+                Right now we merely take the highest level
+                commonality of a registration range and use that.
+                At times we might be able to be smarter about
+                checking the range itself as opposed to the node
+                above where the range exists, but I doubt this will
+                come up all that frequently. */
+            tp = tp->next;
+            if (tp) {
+                prefix_len = netsnmp_oid_find_prefix(tp->start_a,
+                                                     tp->start_len,
+                                                     tp->end_a,
+                                                     tp->end_len);
+                result =
+                    netsnmp_acm_check_subtree(asp->pdu,
+                                              tp->start_a, prefix_len);
+            }
+            else
+                break;
+        }
+    }
+    if (tp == NULL) {
+        /*
+         * no appropriate registration found 
+         */
+        /*
+         * make up the response ourselves 
+         */
+        switch (asp->pdu->command) {
+        case SNMP_MSG_GETNEXT:
+        case SNMP_MSG_GETBULK:
+            varbind_ptr->type = SNMP_ENDOFMIBVIEW;
+            break;
+
+        case SNMP_MSG_SET:
+            varbind_ptr->type = SNMP_NOSUCHOBJECT;
+            break;
+
+        case SNMP_MSG_GET:
+            varbind_ptr->type = SNMP_NOSUCHOBJECT;
+            break;
+
+        default:
+            return NULL;        /* shouldn't get here */
+        }
+    } else {
+        DEBUGMSGTL(("snmp_agent", "tp->start "));
+        DEBUGMSGOID(("snmp_agent", tp->start_a, tp->start_len));
+        DEBUGMSG(("snmp_agent", ", tp->end "));
+        DEBUGMSGOID(("snmp_agent", tp->end_a, tp->end_len));
+        DEBUGMSG(("snmp_agent", ", \n"));
+
+        /*
+         * malloc the request structure 
+         */
+        request = &(asp->requests[vbcount - 1]);
+        request->index = vbcount;
+        request->delegated = 0;
+        request->processed = 0;
+        request->status = 0;
+        request->subtree = tp;
+        if (request->parent_data) {
+            netsnmp_free_request_data_sets(request);
+        }
+
+        /*
+         * for non-SET modes, set the type to NULL 
+         */
+        if (!MODE_IS_SET(asp->pdu->command)) {
+            if (varbind_ptr->type == ASN_PRIV_INCL_RANGE) {
+                DEBUGMSGTL(("snmp_agent", "varbind %d is inclusive\n",
+                            request->index));
+                request->inclusive = 1;
+            }
+            varbind_ptr->type = ASN_NULL;
+        }
+
+        /*
+         * place them in a cache 
+         */
+        if (tp->global_cacheid) {
+            /*
+             * we need to merge all marked subtrees together 
+             */
+            if (asp->cache_store && -1 !=
+                (cacheid = netsnmp_get_local_cachid(asp->cache_store,
+                                                    tp->global_cacheid))) {
+            } else {
+                cacheid = ++(asp->treecache_num);
+                netsnmp_get_or_add_local_cachid(&asp->cache_store,
+                                                tp->global_cacheid,
+                                                cacheid);
+                goto mallocslot;        /* XXX: ick */
+            }
+        } else if (tp->cacheid > -1 && tp->cacheid <= asp->treecache_num &&
+                   asp->treecache[tp->cacheid].subtree == tp) {
+            /*
+             * we have already added a request to this tree
+             * pointer before 
+             */
+            cacheid = tp->cacheid;
+        } else {
+            cacheid = ++(asp->treecache_num);
+          mallocslot:
+            /*
+             * new slot needed 
+             */
+            if (asp->treecache_num >= asp->treecache_len) {
+                /*
+                 * exapand cache array 
+                 */
+                /*
+                 * WWW: non-linear expansion needed (with cap) 
+                 */
+#define CACHE_GROW_SIZE 16
+                asp->treecache_len =
+                    (asp->treecache_len + CACHE_GROW_SIZE);
+                asp->treecache =
+                    realloc(asp->treecache,
+                            sizeof(netsnmp_tree_cache) *
+                            asp->treecache_len);
+                if (asp->treecache == NULL)
+                    return NULL;
+                memset(&(asp->treecache[cacheid]), 0x00,
+                       sizeof(netsnmp_tree_cache) * (CACHE_GROW_SIZE));
+            }
+            asp->treecache[cacheid].subtree = tp;
+            asp->treecache[cacheid].requests_begin = request;
+            tp->cacheid = cacheid;
+        }
+
+        /*
+         * if this is a search type, get the ending range oid as well 
+         */
+        if (asp->pdu->command == SNMP_MSG_GETNEXT ||
+            asp->pdu->command == SNMP_MSG_GETBULK) {
+            request->range_end = tp->end_a;
+            request->range_end_len = tp->end_len;
+        } else {
+            request->range_end = NULL;
+            request->range_end_len = 0;
+        }
+
+        /*
+         * link into chain 
+         */
+        if (asp->treecache[cacheid].requests_end)
+            asp->treecache[cacheid].requests_end->next = request;
+        request->next = NULL;
+        request->prev = asp->treecache[cacheid].requests_end;
+        asp->treecache[cacheid].requests_end = request;
+
+        /*
+         * add the given request to the list of requests they need
+         * to handle results for 
+         */
+        request->requestvb = request->requestvb_start = varbind_ptr;
+    }
+    return request;
+}
+
+/*
+ * check the ACM(s) for the results on each of the varbinds.
+ * If ACM disallows it, replace the value with type
+ * 
+ * Returns number of varbinds with ACM errors
+ */
+int
+check_acm(netsnmp_agent_session *asp, u_char type)
+{
+    int             view;
+    int             i, j, k;
+    netsnmp_request_info *request;
+    int             ret = 0;
+    netsnmp_variable_list *vb, *vb2, *vbc;
+    int             earliest = 0;
+
+    for (i = 0; i <= asp->treecache_num; i++) {
+        for (request = asp->treecache[i].requests_begin;
+             request; request = request->next) {
+            /*
+             * for each request, run it through in_a_view() 
+             */
+            earliest = 0;
+            for(j = request->repeat, vb = request->requestvb_start;
+                vb && j > -1;
+                j--, vb = vb->next_variable) {
+                if (vb->type != ASN_NULL &&
+                    vb->type != ASN_PRIV_RETRY) { /* not yet processed */
+                    view =
+                        in_a_view(vb->name, &vb->name_length,
+                                  asp->pdu, vb->type);
+
+                    /*
+                     * if a ACM error occurs, mark it as type passed in 
+                     */
+                    if (view != VACM_SUCCESS) {
+                        ret++;
+                        if (request->repeat < request->orig_repeat) {
+                            /* basically this means a GETBULK */
+                            request->repeat++;
+                            if (!earliest) {
+                                request->requestvb = vb;
+                                earliest = 1;
+                            }
+
+                            /* ugh.  if a whole now exists, we need to
+                               move the contents up the chain and fill
+                               in at the end else we won't end up
+                               lexographically sorted properly */
+                            if (j > -1 && vb->next_variable &&
+                                vb->next_variable->type != ASN_NULL &&
+                                vb->next_variable->type != ASN_PRIV_RETRY) {
+                                for(k = j, vbc = vb, vb2 = vb->next_variable;
+                                    k > -2 && vbc && vb2;
+                                    k--, vbc = vb2, vb2 = vb2->next_variable) {
+                                    /* clone next into the current */
+                                    snmp_clone_var(vb2, vbc);
+                                    vbc->next_variable = vb2;
+                                }
+                            }
+                        }
+                        snmp_set_var_typed_value(vb, type, NULL, 0);
+                    }
+                }
+            }
+        }
+    }
+    return ret;
+}
+
+
+int
+netsnmp_create_subtree_cache(netsnmp_agent_session *asp)
+{
+    netsnmp_subtree *tp;
+    netsnmp_variable_list *varbind_ptr, *vbsave, *vbptr, **prevNext;
+    int             view;
+    int             vbcount = 0;
+    int             bulkcount = 0, bulkrep = 0;
+    int             i = 0, n = 0, r = 0;
+    netsnmp_request_info *request;
+
+    if (asp->treecache == NULL && asp->treecache_len == 0) {
+        asp->treecache_len = SNMP_MAX(1 + asp->vbcount / 4, 16);
+        asp->treecache =
+            calloc(asp->treecache_len, sizeof(netsnmp_tree_cache));
+        if (asp->treecache == NULL)
+            return SNMP_ERR_GENERR;
+    }
+    asp->treecache_num = -1;
+
+    if (asp->pdu->command == SNMP_MSG_GETBULK) {
+        /*
+         * getbulk prep 
+         */
+        int             count = count_varbinds(asp->pdu->variables);
+
+        if (asp->pdu->errstat < 0) {
+            asp->pdu->errstat = 0;
+        }
+        if (asp->pdu->errindex < 0) {
+            asp->pdu->errindex = 0;
+        }
+
+        if (asp->pdu->errstat < count) {
+            n = asp->pdu->errstat;
+        } else {
+            n = count;
+        }
+        if ((r = count - n) < 0) {
+            r = 0;
+            asp->bulkcache = NULL;
+        } else {
+            asp->bulkcache =
+                (netsnmp_variable_list **) malloc(asp->pdu->errindex * r *
+                                                  sizeof(struct
+                                                         varbind_list *));
+        }
+        DEBUGMSGTL(("snmp_agent", "GETBULK N = %d, M = %d, R = %d\n",
+                    n, asp->pdu->errindex, r));
+    }
+
+    /*
+     * collect varbinds into their registered trees 
+     */
+    prevNext = &(asp->pdu->variables);
+    for (varbind_ptr = asp->pdu->variables; varbind_ptr;
+         varbind_ptr = vbsave) {
+
+        /*
+         * getbulk mess with this pointer, so save it 
+         */
+        vbsave = varbind_ptr->next_variable;
+
+        if (asp->pdu->command == SNMP_MSG_GETBULK) {
+            if (n > 0) {
+                n--;
+            } else {
+                /*
+                 * repeate request varbinds on GETBULK.  These will
+                 * have to be properly rearranged later though as
+                 * responses are supposed to actually be interlaced
+                 * with each other.  This is done with the asp->bulkcache. 
+                 */
+                bulkrep = asp->pdu->errindex - 1;
+                if (asp->pdu->errindex > 0) {
+                    vbptr = varbind_ptr;
+                    asp->bulkcache[bulkcount++] = vbptr;
+
+                    for (i = 1; i < asp->pdu->errindex; i++) {
+                        vbptr->next_variable =
+                            SNMP_MALLOC_STRUCT(variable_list);
+                        /*
+                         * don't clone the oid as it's got to be
+                         * overwwritten anyway 
+                         */
+                        if (!vbptr->next_variable) {
+                            /*
+                             * XXXWWW: ack!!! 
+                             */
+                        } else {
+                            vbptr = vbptr->next_variable;
+                            vbptr->name_length = 0;
+                            vbptr->type = ASN_NULL;
+                            asp->bulkcache[bulkcount++] = vbptr;
+                        }
+                    }
+                    vbptr->next_variable = vbsave;
+                } else {
+                    /*
+                     * 0 repeats requested for this varbind, so take it off
+                     * the list.  
+                     */
+                    vbptr = varbind_ptr;
+                    *prevNext = vbptr->next_variable;
+                    vbptr->next_variable = NULL;
+                    snmp_free_varbind(vbptr);
+                    asp->vbcount--;
+                    continue;
+                }
+            }
+        }
+
+        /*
+         * count the varbinds 
+         */
+        ++vbcount;
+
+        /*
+         * find the owning tree 
+         */
+        tp = netsnmp_subtree_find(varbind_ptr->name, varbind_ptr->name_length,
+				  NULL, asp->pdu->contextName);
+
+        /*
+         * check access control 
+         */
+        switch (asp->pdu->command) {
+        case SNMP_MSG_GET:
+            view = in_a_view(varbind_ptr->name, &varbind_ptr->name_length,
+                             asp->pdu, varbind_ptr->type);
+            if (view != VACM_SUCCESS)
+                snmp_set_var_typed_value(varbind_ptr, SNMP_NOSUCHOBJECT,
+                                         NULL, 0);
+            break;
+
+        case SNMP_MSG_SET:
+            view = in_a_view(varbind_ptr->name, &varbind_ptr->name_length,
+                             asp->pdu, varbind_ptr->type);
+            if (view != VACM_SUCCESS)
+                return SNMP_ERR_NOTWRITABLE;
+            break;
+
+        case SNMP_MSG_GETNEXT:
+        case SNMP_MSG_GETBULK:
+        default:
+            view = VACM_SUCCESS;
+            /*
+             * XXXWWW: check VACM here to see if "tp" is even worthwhile 
+             */
+        }
+        if (view == VACM_SUCCESS) {
+            request = netsnmp_add_varbind_to_cache(asp, vbcount, varbind_ptr,
+						   tp);
+            if (request && asp->pdu->command == SNMP_MSG_GETBULK) {
+                request->repeat = request->orig_repeat = bulkrep;
+            }
+        }
+
+        prevNext = &(varbind_ptr->next_variable);
+    }
+
+    return SNMPERR_SUCCESS;
+}
+
+/*
+ * this function is only applicable in getnext like contexts 
+ */
+int
+netsnmp_reassign_requests(netsnmp_agent_session *asp)
+{
+    /*
+     * assume all the requests have been filled or rejected by the
+     * subtrees, so reassign the rejected ones to the next subtree in
+     * the chain 
+     */
+
+    int             i;
+
+    /*
+     * get old info 
+     */
+    netsnmp_tree_cache *old_treecache = asp->treecache;
+
+    /*
+     * malloc new space 
+     */
+    asp->treecache =
+        (netsnmp_tree_cache *) calloc(asp->treecache_len,
+                                      sizeof(netsnmp_tree_cache));
+    asp->treecache_num = -1;
+    if (asp->cache_store) {
+        netsnmp_free_cachemap(asp->cache_store);
+        asp->cache_store = NULL;
+    }
+
+    for (i = 0; i < asp->vbcount; i++) {
+        if (asp->requests[i].requestvb->type == ASN_NULL) {
+            if (!netsnmp_add_varbind_to_cache(asp, asp->requests[i].index,
+                                              asp->requests[i].requestvb,
+                                              asp->requests[i].subtree->next)) {
+                if (old_treecache != NULL) {
+                    free(old_treecache);
+                    old_treecache = NULL;
+                }
+            }
+        } else if (asp->requests[i].requestvb->type == ASN_PRIV_RETRY) {
+            /*
+             * re-add the same subtree 
+             */
+            asp->requests[i].requestvb->type = ASN_NULL;
+            if (!netsnmp_add_varbind_to_cache(asp, asp->requests[i].index,
+                                              asp->requests[i].requestvb,
+                                              asp->requests[i].subtree)) {
+                if (old_treecache != NULL) {
+                    free(old_treecache);
+                    old_treecache = NULL;
+                }
+            }
+        }
+    }
+
+    if (old_treecache != NULL) {
+        free(old_treecache);
+    }
+    return SNMP_ERR_NOERROR;
+}
+
+void
+netsnmp_delete_request_infos(netsnmp_request_info *reqlist)
+{
+    while (reqlist) {
+        netsnmp_free_request_data_sets(reqlist);
+        reqlist = reqlist->next;
+    }
+}
+
+void
+netsnmp_delete_subtree_cache(netsnmp_agent_session *asp)
+{
+    while (asp->treecache_num >= 0) {
+        /*
+         * don't delete subtrees 
+         */
+        netsnmp_delete_request_infos(asp->treecache[asp->treecache_num].
+                                     requests_begin);
+        asp->treecache_num--;
+    }
+}
+
+int
+netsnmp_check_requests_status(netsnmp_agent_session *asp,
+                              netsnmp_request_info *requests,
+                              int look_for_specific)
+{
+    /*
+     * find any errors marked in the requests 
+     */
+    while (requests) {
+        if (requests->status != SNMP_ERR_NOERROR &&
+            (!look_for_specific || requests->status == look_for_specific)
+            && (look_for_specific || asp->index == 0
+                || requests->index < asp->index)) {
+            asp->index = requests->index;
+            asp->status = requests->status;
+        }
+        requests = requests->next;
+    }
+    return asp->status;
+}
+
+int
+netsnmp_check_all_requests_status(netsnmp_agent_session *asp,
+                                  int look_for_specific)
+{
+    int             i;
+    for (i = 0; i <= asp->treecache_num; i++) {
+        netsnmp_check_requests_status(asp,
+                                      asp->treecache[i].requests_begin,
+                                      look_for_specific);
+    }
+    return asp->status;
+}
+
+int
+handle_var_requests(netsnmp_agent_session *asp)
+{
+    int             i, retstatus = SNMP_ERR_NOERROR,
+        status = SNMP_ERR_NOERROR, final_status = SNMP_ERR_NOERROR;
+    netsnmp_handler_registration *reginfo;
+
+    /*
+     * create the netsnmp_agent_request_info data 
+     */
+    if (!asp->reqinfo) {
+        asp->reqinfo = SNMP_MALLOC_TYPEDEF(netsnmp_agent_request_info);
+        if (!asp->reqinfo)
+            return SNMP_ERR_GENERR;
+    }
+
+    asp->reqinfo->asp = asp;
+    asp->reqinfo->mode = asp->mode;
+
+    /*
+     * now, have the subtrees in the cache go search for their results 
+     */
+    for (i = 0; i <= asp->treecache_num; i++) {
+        reginfo = asp->treecache[i].subtree->reginfo;
+        status = netsnmp_call_handlers(reginfo, asp->reqinfo,
+                                       asp->treecache[i].requests_begin);
+
+        /*
+         * find any errors marked in the requests.  For later parts of
+         * SET processing, only check for new errors specific to that
+         * set processing directive (which must superceed the previous
+         * errors).
+         */
+        switch (asp->mode) {
+        case MODE_SET_COMMIT:
+            retstatus = netsnmp_check_requests_status(asp,
+						      asp->treecache[i].
+						      requests_begin,
+						      SNMP_ERR_COMMITFAILED);
+            break;
+
+        case MODE_SET_UNDO:
+            retstatus = netsnmp_check_requests_status(asp,
+						      asp->treecache[i].
+						      requests_begin,
+						      SNMP_ERR_UNDOFAILED);
+            break;
+
+        default:
+            retstatus = netsnmp_check_requests_status(asp,
+						      asp->treecache[i].
+						      requests_begin, 0);
+            break;
+        }
+
+        /*
+         * always take lowest varbind if possible 
+         */
+        if (retstatus != SNMP_ERR_NOERROR) {
+            status = retstatus;
+	}
+
+        /*
+         * other things we know less about (no index) 
+         */
+        /*
+         * WWW: drop support for this? 
+         */
+        if (final_status == SNMP_ERR_NOERROR && status != SNMP_ERR_NOERROR) {
+            /*
+             * we can't break here, since some processing needs to be
+             * done for all requests anyway (IE, SET handling for UNDO
+             * needs to be called regardless of previous status
+             * results.
+             * WWW:  This should be predictable though and
+             * breaking should be possible in some cases (eg GET,
+             * GETNEXT, ...) 
+             */
+            final_status = status;
+        }
+    }
+
+    return final_status;
+}
+
+/*
+ * loop through our sessions known delegated sessions and check to see
+ * if they've completed yet. If there are no more delegated sessions,
+ * check for and process any queued requests
+ */
+void
+netsnmp_check_outstanding_agent_requests(void)
+{
+    netsnmp_agent_session *asp, *prev_asp = NULL, *next_asp = NULL;
+
+    /*
+     * deal with delegated requests
+     */
+    for (asp = agent_delegated_list; asp; prev_asp = asp, asp = next_asp) {
+        next_asp = asp->next;   /* save in case we clean up asp */
+        if (!netsnmp_check_for_delegated(asp)) {
+
+            /*
+             * we're done with this one, remove from queue 
+             */
+            if (prev_asp != NULL)
+                prev_asp->next = asp->next;
+            else
+                agent_delegated_list = asp->next;
+
+            /*
+             * check request status
+             */
+            netsnmp_check_all_requests_status(asp, 0);
+            
+            /*
+             * continue processing or finish up 
+             */
+            check_delayed_request(asp);
+        }
+    }
+
+    /*
+     * if we are processing a set and there are more delegated
+     * requests, keep waiting before getting to queued requests.
+     */
+    if (netsnmp_processing_set && (NULL != agent_delegated_list))
+        return;
+
+    while (netsnmp_agent_queued_list) {
+
+        /*
+         * if we are processing a set, the first item better be
+         * the set being (or waiting to be) processed.
+         */
+        netsnmp_assert((!netsnmp_processing_set) ||
+                       (netsnmp_processing_set == netsnmp_agent_queued_list));
+
+        /*
+         * if the top request is a set, don't pop it
+         * off if there are delegated requests
+         */
+        if ((netsnmp_agent_queued_list->pdu->command == SNMP_MSG_SET) &&
+            (agent_delegated_list)) {
+
+            netsnmp_assert(netsnmp_processing_set == NULL);
+
+            netsnmp_processing_set = netsnmp_agent_queued_list;
+            DEBUGMSGTL(("snmp_agent", "SET request remains queued while "
+                        "delegated requests finish, asp = %08p\n", asp));
+            break;
+        }
+
+        /*
+         * pop the first request and process it
+         */
+        asp = netsnmp_agent_queued_list;
+        netsnmp_agent_queued_list = asp->next;
+        DEBUGMSGTL(("snmp_agent",
+                    "processing queued request, asp = %08p\n", asp));
+
+        netsnmp_handle_request(asp, asp->status);
+
+        /*
+         * if we hit a set, stop
+         */
+        if (NULL != netsnmp_processing_set)
+            break;
+    }
+}
+
+/** Decide if the requested transaction_id is still being processed
+   within the agent.  This is used to validate whether a delayed cache
+   (containing possibly freed pointers) is still usable.
+
+   returns SNMPERR_SUCCESS if it's still valid, or SNMPERR_GENERR if not. */
+int
+netsnmp_check_transaction_id(int transaction_id)
+{
+    netsnmp_agent_session *asp, *prev_asp = NULL;
+
+    for (asp = agent_delegated_list; asp; prev_asp = asp, asp = asp->next) {
+        if (asp->pdu->transid == transaction_id)
+            return SNMPERR_SUCCESS;
+    }
+    return SNMPERR_GENERR;
+}
+
+
+/*
+ * check_delayed_request(asp)
+ *
+ * Called to rexamine a set of requests and continue processing them
+ * once all the previous (delayed) requests have been handled one way
+ * or another.
+ */
+
+int
+check_delayed_request(netsnmp_agent_session *asp)
+{
+    int             status = SNMP_ERR_NOERROR;
+
+    DEBUGMSGTL(("snmp_agent", "processing delegated request, asp = %08p\n",
+                asp));
+
+    switch (asp->mode) {
+    case SNMP_MSG_GETBULK:
+    case SNMP_MSG_GETNEXT:
+        netsnmp_check_all_requests_status(asp, 0);
+        handle_getnext_loop(asp);
+        if (netsnmp_check_for_delegated(asp) &&
+            netsnmp_check_transaction_id(asp->pdu->transid) !=
+            SNMPERR_SUCCESS) {
+            /*
+             * add to delegated request chain 
+             */
+            if (!netsnmp_check_delegated_chain_for(asp)) {
+                asp->next = agent_delegated_list;
+                agent_delegated_list = asp;
+            }
+        }
+        break;
+
+    case MODE_SET_COMMIT:
+        netsnmp_check_all_requests_status(asp, SNMP_ERR_COMMITFAILED);
+        goto settop;
+
+    case MODE_SET_UNDO:
+        netsnmp_check_all_requests_status(asp, SNMP_ERR_UNDOFAILED);
+        goto settop;
+
+    case MODE_SET_BEGIN:
+    case MODE_SET_RESERVE1:
+    case MODE_SET_RESERVE2:
+    case MODE_SET_ACTION:
+    case MODE_SET_FREE:
+      settop:
+        handle_set_loop(asp);
+        if (asp->mode != FINISHED_SUCCESS && asp->mode != FINISHED_FAILURE) {
+
+            if (netsnmp_check_for_delegated_and_add(asp)) {
+                /*
+                 * add to delegated request chain 
+                 */
+                if (!asp->status)
+                    asp->status = status;
+            }
+
+            return SNMP_ERR_NOERROR;
+        }
+        break;
+
+    default:
+        break;
+    }
+
+    /*
+     * if we don't have anything outstanding (delegated), wrap up 
+     */
+    if (!netsnmp_check_for_delegated(asp))
+        return netsnmp_wrap_up_request(asp, status);
+
+    return 1;
+}
+
+/** returns 1 if there are valid GETNEXT requests left.  Returns 0 if not. */
+int
+check_getnext_results(netsnmp_agent_session *asp)
+{
+    /*
+     * get old info 
+     */
+    netsnmp_tree_cache *old_treecache = asp->treecache;
+    int             old_treecache_num = asp->treecache_num;
+    int             count = 0;
+    int             i, special = 0;
+    netsnmp_request_info *request;
+
+    if (asp->mode == SNMP_MSG_GET) {
+        /*
+         * Special case for doing INCLUSIVE getNext operations in
+         * AgentX subagents.  
+         */
+        DEBUGMSGTL(("snmp_agent",
+                    "asp->mode == SNMP_MSG_GET in ch_getnext\n"));
+        asp->mode = asp->oldmode;
+        special = 1;
+    }
+
+    for (i = 0; i <= old_treecache_num; i++) {
+        for (request = old_treecache[i].requests_begin; request;
+             request = request->next) {
+
+            /*
+             * If we have just done the special case AgentX GET, then any
+             * requests which were not INCLUSIVE will now have a wrong
+             * response, so junk them and retry from the same place (except
+             * that this time the handler will be called in "inexact"
+             * mode).  
+             */
+
+            if (special) {
+                if (!request->inclusive) {
+                    DEBUGMSGTL(("snmp_agent",
+                                "request %d wasn't inclusive\n",
+                                request->index));
+                    snmp_set_var_typed_value(request->requestvb,
+                                             ASN_PRIV_RETRY, NULL, 0);
+                } else if (request->requestvb->type == ASN_NULL ||
+                           request->requestvb->type == SNMP_NOSUCHINSTANCE ||
+                           request->requestvb->type == SNMP_NOSUCHOBJECT) {
+                    /*
+                     * it was inclusive, but no results.  Still retry this
+                     * search. 
+                     */
+                    snmp_set_var_typed_value(request->requestvb,
+                                             ASN_PRIV_RETRY, NULL, 0);
+                }
+            }
+
+            /*
+             * out of range? 
+             */
+            if (snmp_oid_compare(request->requestvb->name,
+                                 request->requestvb->name_length,
+                                 request->range_end,
+                                 request->range_end_len) >= 0) {
+                /*
+                 * ack, it's beyond the accepted end of range. 
+                 */
+                /*
+                 * fix it by setting the oid to the end of range oid instead 
+                 */
+                DEBUGMSGTL(("check_getnext_results",
+                            "request response %d out of range\n",
+                            request->index));
+                request->inclusive = 1;
+                /*
+                 * XXX: should set this to the original OID? 
+                 */
+                snmp_set_var_objid(request->requestvb,
+                                   request->range_end,
+                                   request->range_end_len);
+                snmp_set_var_typed_value(request->requestvb, ASN_NULL,
+                                         NULL, 0);
+            }
+
+            /*
+             * mark any existent requests with illegal results as NULL 
+             */
+            if (request->requestvb->type == SNMP_ENDOFMIBVIEW) {
+                /*
+                 * illegal response from a subagent.  Change it back to NULL 
+                 */
+                request->requestvb->type = ASN_NULL;
+                request->inclusive = 1;
+            }
+
+            if (request->requestvb->type == ASN_NULL ||
+                request->requestvb->type == ASN_PRIV_RETRY ||
+                (asp->reqinfo->mode == MODE_GETBULK
+                 && request->repeat > 0))
+                count++;
+        }
+    }
+    return count;
+}
+
+/** repeatedly calls getnext handlers looking for an answer till all
+   requests are satisified.  It's expected that one pass has been made
+   before entering this function */
+int
+handle_getnext_loop(netsnmp_agent_session *asp)
+{
+    int             status;
+    netsnmp_variable_list *var_ptr;
+
+    /*
+     * loop 
+     */
+    while (1) {
+
+        /*
+         * bail for now if anything is delegated. 
+         */
+        if (netsnmp_check_for_delegated(asp)) {
+            return SNMP_ERR_NOERROR;
+        }
+
+        /*
+         * check vacm against results 
+         */
+        check_acm(asp, ASN_PRIV_RETRY);
+
+        /*
+         * need to keep going we're not done yet. 
+         */
+        if (!check_getnext_results(asp))
+            /*
+             * nothing left, quit now 
+             */
+            break;
+
+        /*
+         * never had a request (empty pdu), quit now 
+         */
+        /*
+         * XXXWWW: huh?  this would be too late, no?  shouldn't we
+         * catch this earlier? 
+         */
+        /*
+         * if (count == 0)
+         * break; 
+         */
+
+        DEBUGIF("results") {
+            DEBUGMSGTL(("results",
+                        "getnext results, before next pass:\n"));
+            for (var_ptr = asp->pdu->variables; var_ptr;
+                 var_ptr = var_ptr->next_variable) {
+                DEBUGMSGTL(("results", "\t"));
+                DEBUGMSGVAR(("results", var_ptr));
+                DEBUGMSG(("results", "\n"));
+            }
+        }
+
+        netsnmp_reassign_requests(asp);
+        status = handle_var_requests(asp);
+        if (status != SNMP_ERR_NOERROR) {
+            return status;      /* should never really happen */
+        }
+    }
+    return SNMP_ERR_NOERROR;
+}
+
+int
+handle_set(netsnmp_agent_session *asp)
+{
+    int             status;
+    /*
+     * SETS require 3-4 passes through the var_op_list.
+     * The first two
+     * passes verify that all types, lengths, and values are valid
+     * and may reserve resources and the third does the set and a
+     * fourth executes any actions.  Then the identical GET RESPONSE
+     * packet is returned.
+     * If either of the first two passes returns an error, another
+     * pass is made so that any reserved resources can be freed.
+     * If the third pass returns an error, another pass is
+     * made so that
+     * any changes can be reversed.
+     * If the fourth pass (or any of the error handling passes)
+     * return an error, we'd rather not know about it!
+     */
+    if (!(asp->pdu->flags & UCD_MSG_FLAG_ONE_PASS_ONLY)) {
+        switch (asp->mode) {
+        case MODE_SET_BEGIN:
+            snmp_increment_statistic(STAT_SNMPINSETREQUESTS);
+            asp->rw = WRITE;    /* WWW: still needed? */
+            asp->mode = MODE_SET_RESERVE1;
+            asp->status = SNMP_ERR_NOERROR;
+            break;
+
+        case MODE_SET_RESERVE1:
+
+            if (asp->status != SNMP_ERR_NOERROR)
+                asp->mode = MODE_SET_FREE;
+            else
+                asp->mode = MODE_SET_RESERVE2;
+            break;
+
+        case MODE_SET_RESERVE2:
+            if (asp->status != SNMP_ERR_NOERROR)
+                asp->mode = MODE_SET_FREE;
+            else
+                asp->mode = MODE_SET_ACTION;
+            break;
+
+        case MODE_SET_ACTION:
+            if (asp->status != SNMP_ERR_NOERROR)
+                asp->mode = MODE_SET_UNDO;
+            else
+                asp->mode = MODE_SET_COMMIT;
+            break;
+
+        case MODE_SET_COMMIT:
+            if (asp->status != SNMP_ERR_NOERROR) {
+                asp->mode = FINISHED_FAILURE;
+            } else {
+                asp->mode = FINISHED_SUCCESS;
+            }
+            break;
+
+        case MODE_SET_UNDO:
+            asp->mode = FINISHED_FAILURE;
+            break;
+
+        case MODE_SET_FREE:
+            asp->mode = FINISHED_FAILURE;
+            break;
+        }
+    }
+
+    if (asp->mode != FINISHED_SUCCESS && asp->mode != FINISHED_FAILURE) {
+        DEBUGMSGTL(("agent_set", "doing set mode = %d (%s)\n", asp->mode,
+                    se_find_label_in_slist("agent_mode", asp->mode)));
+        status = handle_var_requests(asp);
+        DEBUGMSGTL(("agent_set", "did set mode = %d, status = %d\n",
+                    asp->mode, status));
+        if ((status != SNMP_ERR_NOERROR && asp->status == SNMP_ERR_NOERROR) ||
+	    status == SNMP_ERR_COMMITFAILED || 
+	    status == SNMP_ERR_UNDOFAILED) {
+            asp->status = status;
+        }
+    }
+    return asp->status;
+}
+
+int
+handle_set_loop(netsnmp_agent_session *asp)
+{
+    while (asp->mode != FINISHED_FAILURE && asp->mode != FINISHED_SUCCESS) {
+        handle_set(asp);
+        if (netsnmp_check_for_delegated(asp)) {
+            return SNMP_ERR_NOERROR;
+	}
+        if (asp->pdu->flags & UCD_MSG_FLAG_ONE_PASS_ONLY) {
+            return asp->status;
+	}
+    }
+    return asp->status;
+}
+
+int
+netsnmp_handle_request(netsnmp_agent_session *asp, int status)
+{
+    /*
+     * if this isn't a delegated request trying to finish,
+     * processing of a set request should not start until all
+     * delegated requests have completed, and no other new requests
+     * should be processed until the set request completes.
+     */
+    if ((0 == netsnmp_check_delegated_chain_for(asp)) &&
+        (asp != netsnmp_processing_set)) {
+        /*
+         * if we are processing a set and this is not a delegated
+         * request, queue the request
+         */
+        if (netsnmp_processing_set) {
+            netsnmp_add_queued(asp);
+            DEBUGMSGTL(("snmp_agent",
+                        "request queued while processing set, "
+                        "asp = %08p\n", asp));
+            return 1;
+        }
+
+        /*
+         * check for set request
+         */
+        if (asp->pdu->command == SNMP_MSG_SET) {
+            netsnmp_processing_set = asp;
+
+            /*
+             * if there are delegated requests, we must wait for them
+             * to finishd.
+             */
+            if (agent_delegated_list) {
+                DEBUGMSGTL(("snmp_agent", "SET request queued while "
+                            "delegated requests finish, asp = %08p\n",
+                            asp));
+                netsnmp_add_queued(asp);
+                return 1;
+            }
+        }
+    }
+
+    /*
+     * process the request 
+     */
+    status = handle_pdu(asp);
+
+    /*
+     * print the results in appropriate debugging mode 
+     */
+    DEBUGIF("results") {
+        netsnmp_variable_list *var_ptr;
+        DEBUGMSGTL(("results", "request results (status = %d):\n",
+                    status));
+        for (var_ptr = asp->pdu->variables; var_ptr;
+             var_ptr = var_ptr->next_variable) {
+            DEBUGMSGTL(("results", "\t"));
+            DEBUGMSGVAR(("results", var_ptr));
+            DEBUGMSG(("results", "\n"));
+        }
+    }
+
+    /*
+     * check for uncompleted requests 
+     */
+    if (netsnmp_check_for_delegated_and_add(asp)) {
+        /*
+         * add to delegated request chain 
+         */
+        asp->status = status;
+    } else {
+        /*
+         * if we don't have anything outstanding (delegated), wrap up
+         */
+        return netsnmp_wrap_up_request(asp, status);
+    }
+
+    return 1;
+}
+
+int
+handle_pdu(netsnmp_agent_session *asp)
+{
+    int             status, inclusives = 0;
+    netsnmp_variable_list *v = NULL;
+
+    /*
+     * for illegal requests, mark all nodes as ASN_NULL 
+     */
+    switch (asp->pdu->command) {
+
+    case SNMP_MSG_INTERNAL_SET_RESERVE2:
+    case SNMP_MSG_INTERNAL_SET_ACTION:
+    case SNMP_MSG_INTERNAL_SET_COMMIT:
+    case SNMP_MSG_INTERNAL_SET_FREE:
+    case SNMP_MSG_INTERNAL_SET_UNDO:
+        status = get_set_cache(asp);
+        if (status != SNMP_ERR_NOERROR)
+            return status;
+        break;
+
+    case SNMP_MSG_GET:
+    case SNMP_MSG_GETNEXT:
+    case SNMP_MSG_GETBULK:
+        for (v = asp->pdu->variables; v != NULL; v = v->next_variable) {
+            if (v->type == ASN_PRIV_INCL_RANGE) {
+                /*
+                 * Leave the type for now (it gets set to
+                 * ASN_NULL in netsnmp_add_varbind_to_cache,
+                 * called by create_subnetsnmp_tree_cache below).
+                 * If we set it to ASN_NULL now, we wouldn't be
+                 * able to distinguish INCLUSIVE search
+                 * ranges.  
+                 */
+                inclusives++;
+            } else {
+                snmp_set_var_typed_value(v, ASN_NULL, NULL, 0);
+            }
+        }
+        /*
+         * fall through 
+         */
+
+    case SNMP_MSG_INTERNAL_SET_BEGIN:
+    case SNMP_MSG_INTERNAL_SET_RESERVE1:
+    default:
+        asp->vbcount = count_varbinds(asp->pdu->variables);
+        if (asp->vbcount) /* efence doesn't like 0 size allocs */
+            asp->requests = (netsnmp_request_info *)
+                calloc(asp->vbcount, sizeof(netsnmp_request_info));
+        /*
+         * collect varbinds 
+         */
+        status = netsnmp_create_subtree_cache(asp);
+        if (status != SNMP_ERR_NOERROR)
+            return status;
+    }
+
+    asp->mode = asp->pdu->command;
+    switch (asp->mode) {
+    case SNMP_MSG_GET:
+        /*
+         * increment the message type counter 
+         */
+        snmp_increment_statistic(STAT_SNMPINGETREQUESTS);
+
+        /*
+         * check vacm ahead of time 
+         */
+        check_acm(asp, SNMP_NOSUCHOBJECT);
+
+        /*
+         * get the results 
+         */
+        status = handle_var_requests(asp);
+
+        /*
+         * Deal with unhandled results -> noSuchInstance (rather
+         * than noSuchObject -- in that case, the type will
+         * already have been set to noSuchObject when we realised
+         * we couldn't find an appropriate tree).  
+         */
+        if (status == SNMP_ERR_NOERROR)
+            snmp_replace_var_types(asp->pdu->variables, ASN_NULL,
+                                   SNMP_NOSUCHINSTANCE);
+        break;
+
+    case SNMP_MSG_GETNEXT:
+        snmp_increment_statistic(STAT_SNMPINGETNEXTS);
+        /*
+         * fall through 
+         */
+
+    case SNMP_MSG_GETBULK:     /* note: there is no getbulk stat */
+        /*
+         * loop through our mib tree till we find an
+         * appropriate response to return to the caller. 
+         */
+
+        if (inclusives) {
+            /*
+             * This is a special case for AgentX INCLUSIVE getNext
+             * requests where a result lexi-equal to the request is okay
+             * but if such a result does not exist, we still want the
+             * lexi-next one.  So basically we do a GET first, and if any
+             * of the INCLUSIVE requests are satisfied, we use that
+             * value.  Then, unsatisfied INCLUSIVE requests, and
+             * non-INCLUSIVE requests get done as normal.  
+             */
+
+            DEBUGMSGTL(("snmp_agent", "inclusive range(s) in getNext\n"));
+            asp->oldmode = asp->mode;
+            asp->mode = SNMP_MSG_GET;
+        }
+
+        /*
+         * first pass 
+         */
+        status = handle_var_requests(asp);
+        if (status != SNMP_ERR_NOERROR) {
+            if (!inclusives)
+                return status;  /* should never really happen */
+            else
+                asp->status = SNMP_ERR_NOERROR;
+        }
+
+        /*
+         * loop through our mib tree till we find an
+         * appropriate response to return to the caller. 
+         */
+
+        status = handle_getnext_loop(asp);
+        break;
+
+    case SNMP_MSG_SET:
+        /*
+         * check access permissions first 
+         */
+        if (check_acm(asp, SNMP_NOSUCHOBJECT))
+            return SNMP_ERR_NOTWRITABLE;
+
+        asp->mode = MODE_SET_BEGIN;
+        status = handle_set_loop(asp);
+
+        break;
+
+    case SNMP_MSG_INTERNAL_SET_BEGIN:
+    case SNMP_MSG_INTERNAL_SET_RESERVE1:
+    case SNMP_MSG_INTERNAL_SET_RESERVE2:
+    case SNMP_MSG_INTERNAL_SET_ACTION:
+    case SNMP_MSG_INTERNAL_SET_COMMIT:
+    case SNMP_MSG_INTERNAL_SET_FREE:
+    case SNMP_MSG_INTERNAL_SET_UNDO:
+        asp->pdu->flags |= UCD_MSG_FLAG_ONE_PASS_ONLY;
+        status = handle_set_loop(asp);
+        /*
+         * asp related cache is saved in cleanup 
+         */
+        break;
+
+    case SNMP_MSG_RESPONSE:
+        snmp_increment_statistic(STAT_SNMPINGETRESPONSES);
+        return SNMP_ERR_NOERROR;
+
+    case SNMP_MSG_TRAP:
+    case SNMP_MSG_TRAP2:
+        snmp_increment_statistic(STAT_SNMPINTRAPS);
+        return SNMP_ERR_NOERROR;
+
+    default:
+        /*
+         * WWW: are reports counted somewhere ? 
+         */
+        snmp_increment_statistic(STAT_SNMPINASNPARSEERRS);
+        return SNMPERR_GENERR;  /* shouldn't get here */
+        /*
+         * WWW 
+         */
+    }
+    return status;
+}
+
+int
+netsnmp_set_request_error(netsnmp_agent_request_info *reqinfo,
+                          netsnmp_request_info *request, int error_value)
+{
+    if (!request || !reqinfo)
+        return error_value;
+
+    return netsnmp_set_mode_request_error(reqinfo->mode, request,
+                                          error_value);
+}
+
+int
+netsnmp_set_mode_request_error(int mode, netsnmp_request_info *request,
+                               int error_value)
+{
+    if (!request)
+        return error_value;
+
+    request->processed = 1;
+    request->delegated = REQUEST_IS_NOT_DELEGATED;
+
+    switch (error_value) {
+    case SNMP_NOSUCHOBJECT:
+    case SNMP_NOSUCHINSTANCE:
+    case SNMP_ENDOFMIBVIEW:
+        /*
+         * these are exceptions that should be put in the varbind
+         * in the case of a GET but should be translated for a SET
+         * into a real error status code and put in the request 
+         */
+        switch (mode) {
+        case MODE_GET:
+            request->requestvb->type = error_value;
+            return error_value;
+
+        case MODE_GETNEXT:
+        case MODE_GETBULK:
+            /*
+             * ignore these.  They're illegal to set by the
+             * client APIs for these modes 
+             */
+            snmp_log(LOG_ERR, "Illegal error_value %d for mode %d ignored\n",
+                     error_value, mode);
+            return error_value;
+
+        default:
+            request->status = SNMP_ERR_NOSUCHNAME;      /* WWW: correct? */
+            return error_value;
+        }
+        break;                  /* never get here */
+
+    default:
+        if (request->status < 0) {
+            /*
+             * illegal local error code.  translate to generr 
+             */
+            /*
+             * WWW: full translation map? 
+             */
+            snmp_log(LOG_ERR, "Illegal error_value %d translated to %d\n",
+                     error_value, SNMP_ERR_GENERR);
+            request->status = SNMP_ERR_GENERR;
+        } else {
+            /*
+             * WWW: translations and mode checking? 
+             */
+            request->status = error_value;
+        }
+        return error_value;
+    }
+    return error_value;
+}
+
+int
+netsnmp_set_all_requests_error(netsnmp_agent_request_info *reqinfo,
+                               netsnmp_request_info *requests,
+                               int error_value)
+{
+    while (requests) {
+        netsnmp_set_request_error(reqinfo, requests, error_value);
+        requests = requests->next;
+    }
+    return error_value;
+}
+
+extern struct timeval starttime;
+
+                /*
+                 * Return the value of 'sysUpTime' at the given marker 
+                 */
+u_long
+netsnmp_marker_uptime(marker_t pm)
+{
+    u_long          res;
+    marker_t        start = (marker_t) & starttime;
+
+    res = uatime_hdiff(start, pm);
+    return res;                 /* atime_diff works in msec, not csec */
+}
+
+                        /*
+                         * struct timeval equivalents of these 
+                         */
+u_long
+netsnmp_timeval_uptime(struct timeval * tv)
+{
+    return netsnmp_marker_uptime((marker_t) tv);
+}
+
+                /*
+                 * Return the current value of 'sysUpTime' 
+                 */
+u_long
+netsnmp_get_agent_uptime(void)
+{
+    struct timeval  now;
+    gettimeofday(&now, NULL);
+
+    return netsnmp_timeval_uptime(&now);
+}
+
+
+
+NETSNMP_INLINE void
+netsnmp_agent_add_list_data(netsnmp_agent_request_info *ari,
+                            netsnmp_data_list *node)
+{
+    if (ari) {
+	if (ari->agent_data) {
+            netsnmp_add_list_data(&ari->agent_data, node);
+        } else {
+            ari->agent_data = node;
+	}
+    }
+}
+
+NETSNMP_INLINE void    *
+netsnmp_agent_get_list_data(netsnmp_agent_request_info *ari,
+                            const char *name)
+{
+    if (ari) {
+        return netsnmp_get_list_data(ari->agent_data, name);
+    }
+    return NULL;
+}
+
+NETSNMP_INLINE void
+netsnmp_free_agent_data_set(netsnmp_agent_request_info *ari)
+{
+    if (ari) {
+        netsnmp_free_list_data(ari->agent_data);
+    }
+}
+
+NETSNMP_INLINE void
+netsnmp_free_agent_data_sets(netsnmp_agent_request_info *ari)
+{
+    if (ari) {
+        netsnmp_free_all_list_data(ari->agent_data);
+    }
+}
+
+NETSNMP_INLINE void
+netsnmp_free_agent_request_info(netsnmp_agent_request_info *ari)
+{
+    if (ari) {
+        if (ari->agent_data) {
+            netsnmp_free_all_list_data(ari->agent_data);
+	}
+        free(ari);
+    }
+}
diff -Naur tomato/release/src/router/snmp/agent/snmp_agent.c.libwrap tomato121/release/src/router/snmp/agent/snmp_agent.c.libwrap
--- tomato/release/src/router/snmp/agent/snmp_agent.c.libwrap	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/snmp_agent.c.libwrap	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,2978 @@
+/*
+ * snmp_agent.c
+ *
+ * Simple Network Management Protocol (RFC 1067).
+ */
+/***********************************************************
+	Copyright 1988, 1989 by Carnegie Mellon University
+
+                      All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its 
+documentation for any purpose and without fee is hereby granted, 
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in 
+supporting documentation, and that the name of CMU not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.  
+
+CMU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+CMU BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+******************************************************************/
+
+#include <net-snmp/net-snmp-config.h>
+
+#include <sys/types.h>
+#ifdef HAVE_LIMITS_H
+#include <limits.h>
+#endif
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#if HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#if HAVE_STRING_H
+#include <string.h>
+#endif
+#if TIME_WITH_SYS_TIME
+# ifdef WIN32
+#  include <sys/timeb.h>
+# else
+#  include <sys/time.h>
+# endif
+# include <time.h>
+#else
+# if HAVE_SYS_TIME_H
+#  include <sys/time.h>
+# else
+#  include <time.h>
+# endif
+#endif
+#if HAVE_SYS_SELECT_H
+#include <sys/select.h>
+#endif
+#if HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+#include <errno.h>
+#if HAVE_WINSOCK_H
+#include <winsock.h>
+#endif
+
+#if HAVE_DMALLOC_H
+#include <dmalloc.h>
+#endif
+
+#define SNMP_NEED_REQUEST_LIST
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include <net-snmp/library/snmp_assert.h>
+
+#ifdef USE_LIBWRAP
+#include <syslog.h>
+#include <tcpd.h>
+#include <syslog.h>
+int             allow_severity = LOG_INFO;
+int             deny_severity = LOG_WARNING;
+#endif
+
+#include "snmpd.h"
+#include "mibgroup/struct.h"
+#include "mibgroup/util_funcs.h"
+#include <net-snmp/agent/mib_module_config.h>
+
+#ifdef USING_AGENTX_PROTOCOL_MODULE
+#include "agentx/protocol.h"
+#endif
+
+#ifdef USING_AGENTX_MASTER_MODULE
+#include "agentx/master.h"
+#endif
+
+#define SNMP_ADDRCACHE_SIZE 10
+
+struct addrCache {
+    char           *addr;
+    enum { SNMP_ADDRCACHE_UNUSED = 0,
+        SNMP_ADDRCACHE_USED = 1,
+        SNMP_ADDRCACHE_OLD = 2
+    } status;
+};
+
+static struct addrCache addrCache[SNMP_ADDRCACHE_SIZE];
+int             lastAddrAge = 0;
+int             log_addresses = 0;
+
+
+
+typedef struct _agent_nsap {
+    int             handle;
+    netsnmp_transport *t;
+    void           *s;          /*  Opaque internal session pointer.  */
+    struct _agent_nsap *next;
+} agent_nsap;
+
+static agent_nsap *agent_nsap_list = NULL;
+static netsnmp_agent_session *agent_session_list = NULL;
+static netsnmp_agent_session *netsnmp_processing_set = NULL;
+netsnmp_agent_session *agent_delegated_list = NULL;
+netsnmp_agent_session *netsnmp_agent_queued_list = NULL;
+
+
+int             netsnmp_agent_check_packet(netsnmp_session *,
+                                           struct netsnmp_transport_s *,
+                                           void *, int);
+int             netsnmp_agent_check_parse(netsnmp_session *, netsnmp_pdu *,
+                                          int);
+void            delete_subnetsnmp_tree_cache(netsnmp_agent_session *asp);
+int             handle_pdu(netsnmp_agent_session *asp);
+int             netsnmp_handle_request(netsnmp_agent_session *asp,
+                                       int status);
+int             netsnmp_wrap_up_request(netsnmp_agent_session *asp,
+                                        int status);
+int             check_delayed_request(netsnmp_agent_session *asp);
+int             handle_getnext_loop(netsnmp_agent_session *asp);
+int             handle_set_loop(netsnmp_agent_session *asp);
+
+int             netsnmp_check_queued_chain_for(netsnmp_agent_session *asp);
+int             netsnmp_add_queued(netsnmp_agent_session *asp);
+int             netsnmp_remove_from_delegated(netsnmp_agent_session *asp);
+
+
+static int      current_globalid = 0;
+
+int
+netsnmp_allocate_globalcacheid(void)
+{
+    return ++current_globalid;
+}
+
+int
+netsnmp_get_local_cachid(netsnmp_cachemap *cache_store, int globalid)
+{
+    while (cache_store != NULL) {
+        if (cache_store->globalid == globalid)
+            return cache_store->cacheid;
+        cache_store = cache_store->next;
+    }
+    return -1;
+}
+
+netsnmp_cachemap *
+netsnmp_get_or_add_local_cachid(netsnmp_cachemap **cache_store,
+                                int globalid, int localid)
+{
+    netsnmp_cachemap *tmpp;
+
+    tmpp = SNMP_MALLOC_TYPEDEF(netsnmp_cachemap);
+    if (*cache_store) {
+        tmpp->next = *cache_store;
+        *cache_store = tmpp;
+    } else {
+        *cache_store = tmpp;
+    }
+
+    tmpp->globalid = globalid;
+    tmpp->cacheid = localid;
+    return tmpp;
+}
+
+void
+netsnmp_free_cachemap(netsnmp_cachemap *cache_store)
+{
+    netsnmp_cachemap *tmpp;
+    while (cache_store) {
+        tmpp = cache_store;
+        cache_store = cache_store->next;
+        free(tmpp);
+    }
+}
+
+
+typedef struct agent_set_cache_s {
+    /*
+     * match on these 2 
+     */
+    int             transID;
+    netsnmp_session *sess;
+
+    /*
+     * store this info 
+     */
+    netsnmp_tree_cache *treecache;
+    int             treecache_len;
+    int             treecache_num;
+
+    int             vbcount;
+    netsnmp_request_info *requests;
+    netsnmp_data_list *agent_data;
+
+    /*
+     * list 
+     */
+    struct agent_set_cache_s *next;
+} agent_set_cache;
+
+static agent_set_cache *Sets = NULL;
+
+agent_set_cache *
+save_set_cache(netsnmp_agent_session *asp)
+{
+    agent_set_cache *ptr;
+
+    if (!asp->reqinfo || !asp->pdu)
+        return NULL;
+
+    ptr = SNMP_MALLOC_TYPEDEF(agent_set_cache);
+    if (ptr == NULL)
+        return NULL;
+
+    /*
+     * Save the important information 
+     */
+    ptr->transID = asp->pdu->transid;
+    ptr->sess = asp->session;
+    ptr->treecache = asp->treecache;
+    ptr->treecache_len = asp->treecache_len;
+    ptr->treecache_num = asp->treecache_num;
+    ptr->agent_data = asp->reqinfo->agent_data;
+    ptr->requests = asp->requests;
+    ptr->vbcount = asp->vbcount;
+
+    /*
+     * make the agent forget about what we've saved 
+     */
+    asp->treecache = NULL;
+    asp->reqinfo->agent_data = NULL;
+    asp->pdu->variables = NULL;
+    asp->requests = NULL;
+
+    ptr->next = Sets;
+    Sets = ptr;
+
+    return ptr;
+}
+
+int
+get_set_cache(netsnmp_agent_session *asp)
+{
+    agent_set_cache *ptr, *prev = NULL;
+
+    for (ptr = Sets; ptr != NULL; ptr = ptr->next) {
+        if (ptr->sess == asp->session && ptr->transID == asp->pdu->transid) {
+            if (prev)
+                prev->next = ptr->next;
+            else
+                Sets = ptr->next;
+
+            /*
+             * found it.  Get the needed data 
+             */
+            asp->treecache = ptr->treecache;
+            asp->treecache_len = ptr->treecache_len;
+            asp->treecache_num = ptr->treecache_num;
+            asp->requests = ptr->requests;
+            asp->vbcount = ptr->vbcount;
+            if (!asp->reqinfo) {
+                asp->reqinfo =
+                    SNMP_MALLOC_TYPEDEF(netsnmp_agent_request_info);
+                if (asp->reqinfo) {
+                    asp->reqinfo->asp = asp;
+                    asp->reqinfo->agent_data = ptr->agent_data;
+                }
+            }
+            free(ptr);
+            return SNMP_ERR_NOERROR;
+        }
+        prev = ptr;
+    }
+    return SNMP_ERR_GENERR;
+}
+
+int
+getNextSessID()
+{
+    static int      SessionID = 0;
+
+    return ++SessionID;
+}
+
+int
+agent_check_and_process(int block)
+{
+    int             numfds;
+    fd_set          fdset;
+    struct timeval  timeout = { LONG_MAX, 0 }, *tvp = &timeout;
+    int             count;
+    int             fakeblock = 0;
+
+    numfds = 0;
+    FD_ZERO(&fdset);
+    snmp_select_info(&numfds, &fdset, tvp, &fakeblock);
+    if (block != 0 && fakeblock != 0) {
+        /*
+         * There are no alarms registered, and the caller asked for blocking, so
+         * let select() block forever.  
+         */
+
+        tvp = NULL;
+    } else if (block != 0 && fakeblock == 0) {
+        /*
+         * The caller asked for blocking, but there is an alarm due sooner than
+         * LONG_MAX seconds from now, so use the modified timeout returned by
+         * snmp_select_info as the timeout for select().  
+         */
+
+    } else if (block == 0) {
+        /*
+         * The caller does not want us to block at all.  
+         */
+
+        tvp->tv_sec = 0;
+        tvp->tv_usec = 0;
+    }
+
+    count = select(numfds, &fdset, 0, 0, tvp);
+
+    if (count > 0) {
+        /*
+         * packets found, process them 
+         */
+        snmp_read(&fdset);
+    } else
+        switch (count) {
+        case 0:
+            snmp_timeout();
+            break;
+        case -1:
+            if (errno != EINTR) {
+                snmp_log_perror("select");
+            }
+            return -1;
+        default:
+            snmp_log(LOG_ERR, "select returned %d\n", count);
+            return -1;
+        }                       /* endif -- count>0 */
+
+    /*
+     * Run requested alarms.  
+     */
+    run_alarms();
+
+    return count;
+}
+
+
+
+/*
+ * Set up the address cache.  
+ */
+void
+netsnmp_addrcache_initialise(void)
+{
+    int             i = 0;
+
+    for (i = 0; i < SNMP_ADDRCACHE_SIZE; i++) {
+        addrCache[i].addr = NULL;
+        addrCache[i].status = SNMP_ADDRCACHE_UNUSED;
+    }
+}
+
+
+
+/*
+ * Age the entries in the address cache.  
+ */
+
+void
+netsnmp_addrcache_age(void)
+{
+    int             i = 0;
+
+    lastAddrAge = 0;
+    for (i = 0; i < SNMP_ADDRCACHE_SIZE; i++) {
+        if (addrCache[i].status == SNMP_ADDRCACHE_OLD) {
+            addrCache[i].status = SNMP_ADDRCACHE_UNUSED;
+            if (addrCache[i].addr != NULL) {
+                free(addrCache[i].addr);
+                addrCache[i].addr = NULL;
+            }
+        }
+        if (addrCache[i].status == SNMP_ADDRCACHE_USED) {
+            addrCache[i].status = SNMP_ADDRCACHE_OLD;
+        }
+    }
+}
+
+/*******************************************************************-o-******
+ * netsnmp_agent_check_packet
+ *
+ * Parameters:
+ *	session, transport, transport_data, transport_data_length
+ *      
+ * Returns:
+ *	1	On success.
+ *	0	On error.
+ *
+ * Handler for all incoming messages (a.k.a. packets) for the agent.  If using
+ * the libwrap utility, log the connection and deny/allow the access. Print
+ * output when appropriate, and increment the incoming counter.
+ *
+ */
+
+int
+netsnmp_agent_check_packet(netsnmp_session * session,
+                           netsnmp_transport *transport,
+                           void *transport_data, int transport_data_length)
+{
+    char           *addr_string = NULL;
+    int             i = 0;
+
+    /*
+     * Log the message and/or dump the message.
+     * Optionally cache the network address of the sender.
+     */
+
+    if (transport != NULL && transport->f_fmtaddr != NULL) {
+        /*
+         * Okay I do know how to format this address for logging.  
+         */
+        addr_string = transport->f_fmtaddr(transport, transport_data,
+                                           transport_data_length);
+        /*
+         * Don't forget to free() it.  
+         */
+    }
+#ifdef  USE_LIBWRAP
+    if (addr_string != NULL) {
+        if (hosts_ctl("snmpd", STRING_UNKNOWN, addr_string, STRING_UNKNOWN)) {
+            snmp_log(allow_severity, "Connection from %s\n", addr_string);
+        } else {
+            snmp_log(deny_severity, "Connection from %s REFUSED\n",
+                     addr_string);
+            free(addr_string);
+            return 0;
+        }
+    } else {
+        if (hosts_ctl("snmp", STRING_UNKNOWN, STRING_UNKNOWN, STRING_UNKNOWN)){
+            snmp_log(allow_severity, "Connection from <UNKNOWN>\n");
+            addr_string = strdup("<UNKNOWN>");
+        } else {
+            snmp_log(deny_severity, "Connection from <UNKNOWN> REFUSED\n");
+            return 0;
+        }
+    }
+#endif                          /*USE_LIBWRAP */
+
+    snmp_increment_statistic(STAT_SNMPINPKTS);
+
+    if (log_addresses || netsnmp_ds_get_boolean(NETSNMP_DS_APPLICATION_ID, 
+						NETSNMP_DS_AGENT_VERBOSE)) {
+        for (i = 0; i < SNMP_ADDRCACHE_SIZE; i++) {
+            if ((addrCache[i].status != SNMP_ADDRCACHE_UNUSED) &&
+                (strcmp(addrCache[i].addr, addr_string) == 0)) {
+                break;
+            }
+        }
+
+        if (i >= SNMP_ADDRCACHE_SIZE ||
+	    netsnmp_ds_get_boolean(NETSNMP_DS_APPLICATION_ID, 
+				   NETSNMP_DS_AGENT_VERBOSE)) {
+            /*
+             * Address wasn't in the cache, so log the packet...  
+             */
+            snmp_log(LOG_INFO, "Received SNMP packet(s) from %s\n",
+                     addr_string);
+            /*
+             * ...and try to cache the address.  
+             */
+            for (i = 0; i < SNMP_ADDRCACHE_SIZE; i++) {
+                if (addrCache[i].status == SNMP_ADDRCACHE_UNUSED) {
+                    if (addrCache[i].addr != NULL) {
+                        free(addrCache[i].addr);
+                    }
+                    addrCache[i].addr = addr_string;
+                    addrCache[i].status = SNMP_ADDRCACHE_USED;
+                    addr_string = NULL; /* Don't free this 'temporary' string
+                                         * since it's now part of the cache */
+                    break;
+                }
+            }
+            if (i >= SNMP_ADDRCACHE_SIZE) {
+                /*
+                 * We didn't find a free slot to cache the address.  Perhaps
+                 * we should be using an LRU replacement policy here or
+                 * something.  Oh well.
+                 */
+                DEBUGMSGTL(("netsnmp_agent_check_packet",
+                            "cache overrun"));
+            }
+        } else {
+            addrCache[i].status = SNMP_ADDRCACHE_USED;
+        }
+    }
+
+    if (addr_string != NULL) {
+        free(addr_string);
+        addr_string = NULL;
+    }
+    return 1;
+}
+
+
+int
+netsnmp_agent_check_parse(netsnmp_session * session, netsnmp_pdu *pdu,
+                          int result)
+{
+    if (result == 0) {
+        if (snmp_get_do_logging() &&
+	    netsnmp_ds_get_boolean(NETSNMP_DS_APPLICATION_ID, 
+				   NETSNMP_DS_AGENT_VERBOSE)) {
+            netsnmp_variable_list *var_ptr;
+
+            switch (pdu->command) {
+            case SNMP_MSG_GET:
+                snmp_log(LOG_DEBUG, "  GET message\n");
+                break;
+            case SNMP_MSG_GETNEXT:
+                snmp_log(LOG_DEBUG, "  GETNEXT message\n");
+                break;
+            case SNMP_MSG_RESPONSE:
+                snmp_log(LOG_DEBUG, "  RESPONSE message\n");
+                break;
+            case SNMP_MSG_SET:
+                snmp_log(LOG_DEBUG, "  SET message\n");
+                break;
+            case SNMP_MSG_TRAP:
+                snmp_log(LOG_DEBUG, "  TRAP message\n");
+                break;
+            case SNMP_MSG_GETBULK:
+                snmp_log(LOG_DEBUG, "  GETBULK message, non-rep=%d, max_rep=%d\n",
+                         pdu->errstat, pdu->errindex);
+                break;
+            case SNMP_MSG_INFORM:
+                snmp_log(LOG_DEBUG, "  INFORM message\n");
+                break;
+            case SNMP_MSG_TRAP2:
+                snmp_log(LOG_DEBUG, "  TRAP2 message\n");
+                break;
+            case SNMP_MSG_REPORT:
+                snmp_log(LOG_DEBUG, "  REPORT message\n");
+                break;
+
+            case SNMP_MSG_INTERNAL_SET_RESERVE1:
+                snmp_log(LOG_DEBUG, "  INTERNAL RESERVE1 message\n");
+                break;
+
+            case SNMP_MSG_INTERNAL_SET_RESERVE2:
+                snmp_log(LOG_DEBUG, "  INTERNAL RESERVE2 message\n");
+                break;
+
+            case SNMP_MSG_INTERNAL_SET_ACTION:
+                snmp_log(LOG_DEBUG, "  INTERNAL ACTION message\n");
+                break;
+
+            case SNMP_MSG_INTERNAL_SET_COMMIT:
+                snmp_log(LOG_DEBUG, "  INTERNAL COMMIT message\n");
+                break;
+
+            case SNMP_MSG_INTERNAL_SET_FREE:
+                snmp_log(LOG_DEBUG, "  INTERNAL FREE message\n");
+                break;
+
+            case SNMP_MSG_INTERNAL_SET_UNDO:
+                snmp_log(LOG_DEBUG, "  INTERNAL UNDO message\n");
+                break;
+
+            default:
+                snmp_log(LOG_DEBUG, "  UNKNOWN message, type=%02X\n",
+                         pdu->command);
+                snmp_increment_statistic(STAT_SNMPINASNPARSEERRS);
+                return 0;
+            }
+
+            for (var_ptr = pdu->variables; var_ptr != NULL;
+                 var_ptr = var_ptr->next_variable) {
+                size_t          c_oidlen = 256, c_outlen = 0;
+                u_char         *c_oid = (u_char *) malloc(c_oidlen);
+
+                if (c_oid) {
+                    if (!sprint_realloc_objid
+                        (&c_oid, &c_oidlen, &c_outlen, 1, var_ptr->name,
+                         var_ptr->name_length)) {
+                        snmp_log(LOG_DEBUG, "    -- %s [TRUNCATED]\n",
+                                 c_oid);
+                    } else {
+                        snmp_log(LOG_DEBUG, "    -- %s\n", c_oid);
+                    }
+                    free(c_oid);
+                }
+            }
+        }
+        return 1;
+    }
+    return 0;                   /* XXX: does it matter what the return value
+                                 * is?  Yes: if we return 0, then the PDU is
+                                 * dumped.  */
+}
+
+
+/*
+ * Global access to the primary session structure for this agent.
+ * for Index Allocation use initially. 
+ */
+
+/*
+ * I don't understand what this is for at the moment.  AFAICS as long as it
+ * gets set and points at a session, that's fine.  ???  
+ */
+
+netsnmp_session *main_session = NULL;
+
+
+
+/*
+ * Set up an agent session on the given transport.  Return a handle
+ * which may later be used to de-register this transport.  A return
+ * value of -1 indicates an error.  
+ */
+
+int
+netsnmp_register_agent_nsap(netsnmp_transport *t)
+{
+    netsnmp_session *s, *sp = NULL;
+    agent_nsap     *a = NULL, *n = NULL, **prevNext = &agent_nsap_list;
+    int             handle = 0;
+    void           *isp = NULL;
+
+    if (t == NULL) {
+        return -1;
+    }
+
+    DEBUGMSGTL(("netsnmp_register_agent_nsap", "fd %d\n", t->sock));
+
+    n = (agent_nsap *) malloc(sizeof(agent_nsap));
+    if (n == NULL) {
+        return -1;
+    }
+    s = (netsnmp_session *) malloc(sizeof(netsnmp_session));
+    if (s == NULL) {
+        free(n);
+        return -1;
+    }
+    memset(s, 0, sizeof(netsnmp_session));
+    snmp_sess_init(s);
+
+    /*
+     * Set up the session appropriately for an agent.  
+     */
+
+    s->version = SNMP_DEFAULT_VERSION;
+    s->callback = handle_snmp_packet;
+    s->authenticator = NULL;
+    s->flags = netsnmp_ds_get_int(NETSNMP_DS_APPLICATION_ID, 
+				  NETSNMP_DS_AGENT_FLAGS);
+    s->isAuthoritative = SNMP_SESS_AUTHORITATIVE;
+
+    sp = snmp_add(s, t, netsnmp_agent_check_packet,
+                  netsnmp_agent_check_parse);
+    if (sp == NULL) {
+        free(s);
+        free(n);
+        return -1;
+    }
+
+    isp = snmp_sess_pointer(sp);
+    if (isp == NULL) {          /*  over-cautious  */
+        free(s);
+        free(n);
+        return -1;
+    }
+
+    n->s = isp;
+    n->t = t;
+
+    if (main_session == NULL) {
+        main_session = snmp_sess_session(isp);
+    }
+
+    for (a = agent_nsap_list; a != NULL && handle + 1 >= a->handle;
+         a = a->next) {
+        handle = a->handle;
+        prevNext = &(a->next);
+    }
+
+    if (handle < INT_MAX) {
+        n->handle = handle + 1;
+        n->next = a;
+        *prevNext = n;
+        free(s);
+        return n->handle;
+    } else {
+        free(s);
+        free(n);
+        return -1;
+    }
+}
+
+void
+netsnmp_deregister_agent_nsap(int handle)
+{
+    agent_nsap     *a = NULL, **prevNext = &agent_nsap_list;
+    int             main_session_deregistered = 0;
+
+    DEBUGMSGTL(("netsnmp_deregister_agent_nsap", "handle %d\n", handle));
+
+    for (a = agent_nsap_list; a != NULL && a->handle < handle; a = a->next) {
+        prevNext = &(a->next);
+    }
+
+    if (a != NULL && a->handle == handle) {
+        *prevNext = a->next;
+        if (main_session == snmp_sess_session(a->s)) {
+            main_session_deregistered = 1;
+        }
+        snmp_close(snmp_sess_session(a->s));
+        /*
+         * The above free()s the transport and session pointers.  
+         */
+        free(a);
+    }
+
+    /*
+     * If we've deregistered the session that main_session used to point to,
+     * then make it point to another one, or in the last resort, make it equal
+     * to NULL.  Basically this shouldn't ever happen in normal operation
+     * because main_session starts off pointing at the first session added by
+     * init_master_agent(), which then discards the handle.  
+     */
+
+    if (main_session_deregistered) {
+        if (agent_nsap_list != NULL) {
+            DEBUGMSGTL(("snmp_agent",
+			"WARNING: main_session ptr changed from %p to %p\n",
+                        main_session, snmp_sess_session(agent_nsap_list->s)));
+            main_session = snmp_sess_session(agent_nsap_list->s);
+        } else {
+            DEBUGMSGTL(("snmp_agent",
+			"WARNING: main_session ptr changed from %p to NULL\n",
+                        main_session));
+            main_session = NULL;
+        }
+    }
+}
+
+
+
+/*
+ * 
+ * This function has been modified to use the experimental
+ * netsnmp_register_agent_nsap interface.  The major responsibility of this
+ * function now is to interpret a string specified to the agent (via -p on the
+ * command line, or from a configuration file) as a list of agent NSAPs on
+ * which to listen for SNMP packets.  Typically, when you add a new transport
+ * domain "foo", you add code here such that if the "foo" code is compiled
+ * into the agent (SNMP_TRANSPORT_FOO_DOMAIN is defined), then a token of the
+ * form "foo:bletch-3a0054ef%wob&wob" gets turned into the appropriate
+ * transport descriptor.  netsnmp_register_agent_nsap is then called with that
+ * transport descriptor and sets up a listening agent session on it.
+ * 
+ * Everything then works much as normal: the agent runs in an infinite loop
+ * (in the snmpd.c/receive()routine), which calls snmp_read() when a request
+ * is readable on any of the given transports.  This routine then traverses
+ * the library 'Sessions' list to identify the relevant session and eventually
+ * invokes '_sess_read'.  This then processes the incoming packet, calling the
+ * pre_parse, parse, post_parse and callback routines in turn.
+ * 
+ * JBPN 20001117
+ */
+
+int
+init_master_agent(void)
+{
+    netsnmp_transport *transport;
+    char           *cptr;
+    char            buf[SPRINT_MAX_LEN];
+
+    /* default to turning off lookup caching */
+    netsnmp_set_lookup_cache_size(0);
+
+    if (netsnmp_ds_get_boolean(NETSNMP_DS_APPLICATION_ID, 
+			       NETSNMP_DS_AGENT_ROLE) != MASTER_AGENT) {
+        DEBUGMSGTL(("snmp_agent",
+                    "init_master_agent; not master agent\n"));
+        return 0;               /*  No error if ! MASTER_AGENT  */
+    }
+#ifdef USING_AGENTX_MASTER_MODULE
+    if (netsnmp_ds_get_boolean(NETSNMP_DS_APPLICATION_ID, 
+			       NETSNMP_DS_AGENT_AGENTX_MASTER) == 1)
+        real_init_master();
+#endif
+
+    /*
+     * Have specific agent ports been specified?  
+     */
+    cptr = netsnmp_ds_get_string(NETSNMP_DS_APPLICATION_ID, 
+				 NETSNMP_DS_AGENT_PORTS);
+
+    if (cptr) {
+        snprintf(buf, sizeof(buf), "%s", cptr);
+        buf[ sizeof(buf)-1 ] = 0;
+    } else {
+        /*
+         * No, so just specify the default port.  
+         */
+        if (netsnmp_ds_get_int(NETSNMP_DS_APPLICATION_ID, NETSNMP_DS_AGENT_FLAGS) & SNMP_FLAGS_STREAM_SOCKET) {
+            sprintf(buf, "tcp:%d", SNMP_PORT);
+        } else {
+            sprintf(buf, "udp:%d", SNMP_PORT);
+        }
+    }
+
+    DEBUGMSGTL(("snmp_agent", "final port spec: %s\n", buf));
+    cptr = strtok(buf, ",");
+    while (cptr) {
+        /*
+         * Specification format: 
+         * 
+         * NONE:                      (a pseudo-transport)
+         * UDP:[address:]port        (also default if no transport is specified)
+         * TCP:[address:]port         (if supported)
+         * Unix:pathname              (if supported)
+         * AAL5PVC:itf.vpi.vci        (if supported)
+         * IPX:[network]:node[/port] (if supported)
+         * 
+         */
+
+        DEBUGMSGTL(("snmp_agent", "installing master agent on port %s\n",
+                    cptr));
+
+        if (!cptr || !(*cptr)) {
+            snmp_log(LOG_ERR, "improper port specification\n");
+            return 1;
+        }
+
+        if (strncasecmp(cptr, "none", 4) == 0) {
+            DEBUGMSGTL(("snmp_agent",
+                        "init_master_agent; pseudo-transport \"none\" requested\n"));
+            return 0;
+        }
+        transport = netsnmp_tdomain_transport(cptr, 1, "udp");
+
+        if (transport == NULL) {
+            snmp_log(LOG_ERR, "Error opening specified endpoint \"%s\"\n",
+                     cptr);
+            return 1;
+        }
+
+        if (netsnmp_register_agent_nsap(transport) == 0) {
+            snmp_log(LOG_ERR,
+                     "Error registering specified transport \"%s\" as an agent NSAP\n",
+                     cptr);
+            return 1;
+        } else {
+            DEBUGMSGTL(("snmp_agent",
+                        "init_master_agent; \"%s\" registered as an agent NSAP\n",
+                        cptr));
+        }
+
+        /*
+         * Next transport please...  
+         */
+        cptr = strtok(NULL, ",");
+    }
+
+    return 0;
+}
+
+
+
+netsnmp_agent_session *
+init_agent_snmp_session(netsnmp_session * session, netsnmp_pdu *pdu)
+{
+    netsnmp_agent_session *asp = (netsnmp_agent_session *)
+        calloc(1, sizeof(netsnmp_agent_session));
+
+    if (asp == NULL) {
+        return NULL;
+    }
+
+    DEBUGMSGTL(("snmp_agent","agent_sesion %08p created\n", asp));
+    asp->session = session;
+    asp->pdu = snmp_clone_pdu(pdu);
+    asp->orig_pdu = snmp_clone_pdu(pdu);
+    asp->rw = READ;
+    asp->exact = TRUE;
+    asp->next = NULL;
+    asp->mode = RESERVE1;
+    asp->status = SNMP_ERR_NOERROR;
+    asp->index = 0;
+    asp->oldmode = 0;
+    asp->treecache_num = -1;
+    asp->treecache_len = 0;
+
+    return asp;
+}
+
+void
+free_agent_snmp_session(netsnmp_agent_session *asp)
+{
+    if (!asp)
+        return;
+
+    DEBUGMSGTL(("snmp_agent","agent_sesion %08p released\n", asp));
+
+    netsnmp_remove_from_delegated(asp);
+    
+    if (asp->orig_pdu)
+        snmp_free_pdu(asp->orig_pdu);
+    if (asp->pdu)
+        snmp_free_pdu(asp->pdu);
+    if (asp->reqinfo)
+        netsnmp_free_agent_request_info(asp->reqinfo);
+    if (asp->treecache) {
+        free(asp->treecache);
+    }
+    if (asp->bulkcache) {
+        free(asp->bulkcache);
+    }
+    if (asp->requests) {
+        int             i;
+        for (i = 0; i < asp->vbcount; i++) {
+            netsnmp_free_request_data_sets(&asp->requests[i]);
+        }
+    }
+    if (asp->requests) {
+        free(asp->requests);
+    }
+    if (asp->cache_store) {
+        netsnmp_free_cachemap(asp->cache_store);
+        asp->cache_store = NULL;
+    }
+    free(asp);
+}
+
+int
+netsnmp_check_for_delegated(netsnmp_agent_session *asp)
+{
+    int             i;
+    netsnmp_request_info *request;
+
+    if (NULL == asp->treecache)
+        return 0;
+    
+    for (i = 0; i <= asp->treecache_num; i++) {
+        for (request = asp->treecache[i].requests_begin; request;
+             request = request->next) {
+            if (request->delegated)
+                return 1;
+        }
+    }
+    return 0;
+}
+
+int
+netsnmp_check_delegated_chain_for(netsnmp_agent_session *asp)
+{
+    netsnmp_agent_session *asptmp;
+    for (asptmp = agent_delegated_list; asptmp; asptmp = asptmp->next) {
+        if (asptmp == asp)
+            return 1;
+    }
+    return 0;
+}
+
+int
+netsnmp_check_for_delegated_and_add(netsnmp_agent_session *asp)
+{
+    if (netsnmp_check_for_delegated(asp)) {
+        if (!netsnmp_check_delegated_chain_for(asp)) {
+            /*
+             * add to delegated request chain 
+             */
+            asp->next = agent_delegated_list;
+            agent_delegated_list = asp;
+            DEBUGMSGTL(("snmp_agent", "delegate session == %08p\n", asp));
+        }
+        return 1;
+    }
+    return 0;
+}
+
+int
+netsnmp_remove_from_delegated(netsnmp_agent_session *asp)
+{
+    netsnmp_agent_session *curr, *prev = NULL;
+    
+    for (curr = agent_delegated_list; curr; prev = curr, curr = curr->next) {
+        /*
+         * is this us?
+         */
+        if (curr != asp)
+            continue;
+        
+        /*
+         * remove from queue 
+         */
+        if (prev != NULL)
+            prev->next = asp->next;
+        else
+            agent_delegated_list = asp->next;
+
+        DEBUGMSGTL(("snmp_agent", "remove delegated session == %08p\n", asp));
+
+        return 1;
+    }
+
+    return 0;
+}
+
+/*
+ * netsnmp_remove_delegated_requests_for_session
+ *
+ * called when a session is being closed. Check all delegated requests to
+ * see if the are waiting on this session, and if set, set the status for
+ * that request to GENERR.
+ */
+int
+netsnmp_remove_delegated_requests_for_session(netsnmp_session *sess)
+{
+    netsnmp_agent_session *asp;
+    int count = 0;
+    
+    for (asp = agent_delegated_list; asp; asp = asp->next) {
+        /*
+         * check each request
+         */
+        netsnmp_request_info *request;
+        for(request = asp->requests; request; request = request->next) {
+            /*
+             * check session
+             */
+            netsnmp_assert(NULL!=request->subtree);
+            if(request->subtree->session != sess)
+                continue;
+
+            /*
+             * matched! mark request as done
+             */
+            netsnmp_set_mode_request_error(MODE_SET_BEGIN, request,
+                                           SNMP_ERR_GENERR);
+            ++count;
+        }
+    }
+
+    /*
+     * if we found any, that request may be finished now
+     */
+    if(count) {
+        DEBUGMSGTL(("snmp_agent", "removed %d delegated request(s) for session "
+                    "%08p\n", count, sess));
+        netsnmp_check_outstanding_agent_requests();
+    }
+    
+    return count;
+}
+
+int
+netsnmp_check_queued_chain_for(netsnmp_agent_session *asp)
+{
+    netsnmp_agent_session *asptmp;
+    for (asptmp = netsnmp_agent_queued_list; asptmp; asptmp = asptmp->next) {
+        if (asptmp == asp)
+            return 1;
+    }
+    return 0;
+}
+
+int
+netsnmp_add_queued(netsnmp_agent_session *asp)
+{
+    netsnmp_agent_session *asp_tmp;
+
+    /*
+     * first item?
+     */
+    if (NULL == netsnmp_agent_queued_list) {
+        netsnmp_agent_queued_list = asp;
+        return 1;
+    }
+
+
+    /*
+     * add to end of queued request chain 
+     */
+    asp_tmp = netsnmp_agent_queued_list;
+    for (; asp_tmp; asp_tmp = asp_tmp->next) {
+        /*
+         * already in queue?
+         */
+        if (asp_tmp == asp)
+            break;
+
+        /*
+         * end of queue?
+         */
+        if (NULL == asp_tmp->next)
+            asp_tmp->next = asp;
+    }
+    return 1;
+}
+
+
+int
+netsnmp_wrap_up_request(netsnmp_agent_session *asp, int status)
+{
+    netsnmp_variable_list *var_ptr;
+    int             i, n = 0, r = 0;
+
+    /*
+     * Update asp->status if necessary. Fixes ro/rw problem.
+     */
+    if ( status != 0  && asp->status == 0 )
+          asp->status = status;
+
+    /*
+     * if this request was a set, clear the global now that we are
+     * done.
+     */
+    if (asp == netsnmp_processing_set) {
+        DEBUGMSGTL(("snmp_agent", "SET request complete, asp = %08p\n",
+                    asp));
+        netsnmp_processing_set = NULL;
+    }
+
+    /*
+     * some stuff needs to be saved in special subagent cases 
+     */
+    if (asp->pdu) {
+
+        switch (asp->pdu->command) {
+            case SNMP_MSG_INTERNAL_SET_BEGIN:
+            case SNMP_MSG_INTERNAL_SET_RESERVE1:
+            case SNMP_MSG_INTERNAL_SET_RESERVE2:
+            case SNMP_MSG_INTERNAL_SET_ACTION:
+                save_set_cache(asp);
+                break;
+        }
+
+        /*
+         * if this is a GETBULK response we need to rearrange the varbinds 
+         */
+        if (asp->pdu->command == SNMP_MSG_GETBULK) {
+            int             repeats = asp->pdu->errindex;
+            int             j;
+            
+            if (asp->pdu->errstat < asp->vbcount) {
+                n = asp->pdu->errstat;
+            } else {
+                n = asp->vbcount;
+            }
+            if ((r = asp->vbcount - n) < 0) {
+                r = 0;
+            }
+            
+            for (i = 0; i < r - 1; i++) {
+                for (j = 0; j < repeats; j++) {
+                    asp->bulkcache[i * repeats + j]->next_variable =
+                        asp->bulkcache[(i + 1) * repeats + j];
+                }
+            }
+            if (r > 0) {
+                for (j = 0; j < repeats - 1; j++) {
+                    asp->bulkcache[(r - 1) * repeats + j]->next_variable =
+                        asp->bulkcache[j + 1];
+                }
+            }
+        }
+
+        /*
+         * May need to "dumb down" a SET error status for a
+         * v1 query.  See RFC2576 - section 4.3
+         */
+        if ((asp->pdu->command == SNMP_MSG_SET) &&
+            (asp->pdu->version == SNMP_VERSION_1)) {
+            switch (status) {
+                case SNMP_ERR_WRONGVALUE:
+                case SNMP_ERR_WRONGENCODING:
+                case SNMP_ERR_WRONGTYPE:
+                case SNMP_ERR_WRONGLENGTH:
+                case SNMP_ERR_INCONSISTENTVALUE:
+                    status = SNMP_ERR_BADVALUE;
+                    asp->status = SNMP_ERR_BADVALUE;
+                    break;
+                case SNMP_ERR_NOACCESS:
+                case SNMP_ERR_NOTWRITABLE:
+                case SNMP_ERR_NOCREATION:
+                case SNMP_ERR_INCONSISTENTNAME:
+                case SNMP_ERR_AUTHORIZATIONERROR:
+                    status = SNMP_ERR_NOSUCHNAME;
+                    asp->status = SNMP_ERR_NOSUCHNAME;
+                    break;
+                case SNMP_ERR_RESOURCEUNAVAILABLE:
+                case SNMP_ERR_COMMITFAILED:
+                case SNMP_ERR_UNDOFAILED:
+                    status = SNMP_ERR_GENERR;
+                    asp->status = SNMP_ERR_GENERR;
+                    break;
+            }
+        }
+        /*
+         * Similarly we may need to "dumb down" v2 exception
+         *  types to throw an error for a v1 query.
+         *  See RFC2576 - section 4.1.2.3
+         */
+        if ((asp->pdu->command != SNMP_MSG_SET) &&
+            (asp->pdu->version == SNMP_VERSION_1)) {
+            for (var_ptr = asp->pdu->variables, i = 1;
+                 var_ptr != NULL; var_ptr = var_ptr->next_variable, i++) {
+                switch (var_ptr->type) {
+                    case SNMP_NOSUCHOBJECT:
+                    case SNMP_NOSUCHINSTANCE:
+                    case SNMP_ENDOFMIBVIEW:
+                    case ASN_COUNTER64:
+                        status = SNMP_ERR_NOSUCHNAME;
+                        asp->status = SNMP_ERR_NOSUCHNAME;
+                        asp->index = i;
+                        break;
+                }
+            }
+        }
+    } /** if asp->pdu */
+
+    /*
+     * Update the snmp error-count statistics
+     *   XXX - should we include the V2 errors in this or not?
+     */
+#define INCLUDE_V2ERRORS_IN_V1STATS
+
+    switch (status) {
+#ifdef INCLUDE_V2ERRORS_IN_V1STATS
+    case SNMP_ERR_WRONGVALUE:
+    case SNMP_ERR_WRONGENCODING:
+    case SNMP_ERR_WRONGTYPE:
+    case SNMP_ERR_WRONGLENGTH:
+    case SNMP_ERR_INCONSISTENTVALUE:
+#endif
+    case SNMP_ERR_BADVALUE:
+        snmp_increment_statistic(STAT_SNMPOUTBADVALUES);
+        break;
+#ifdef INCLUDE_V2ERRORS_IN_V1STATS
+    case SNMP_ERR_NOACCESS:
+    case SNMP_ERR_NOTWRITABLE:
+    case SNMP_ERR_NOCREATION:
+    case SNMP_ERR_INCONSISTENTNAME:
+    case SNMP_ERR_AUTHORIZATIONERROR:
+#endif
+    case SNMP_ERR_NOSUCHNAME:
+        snmp_increment_statistic(STAT_SNMPOUTNOSUCHNAMES);
+        break;
+#ifdef INCLUDE_V2ERRORS_IN_V1STATS
+    case SNMP_ERR_RESOURCEUNAVAILABLE:
+    case SNMP_ERR_COMMITFAILED:
+    case SNMP_ERR_UNDOFAILED:
+#endif
+    case SNMP_ERR_GENERR:
+        snmp_increment_statistic(STAT_SNMPOUTGENERRS);
+        break;
+
+    case SNMP_ERR_TOOBIG:
+        snmp_increment_statistic(STAT_SNMPOUTTOOBIGS);
+        break;
+    }
+
+    if ((status == SNMP_ERR_NOERROR) && (asp->pdu)) {
+        snmp_increment_statistic_by((asp->pdu->command == SNMP_MSG_SET ?
+                                     STAT_SNMPINTOTALSETVARS :
+                                     STAT_SNMPINTOTALREQVARS),
+                                    count_varbinds(asp->pdu->variables));
+    } else {
+        /*
+         * Use a copy of the original request
+         *   to report failures.
+         */
+        snmp_free_pdu(asp->pdu);
+        asp->pdu = asp->orig_pdu;
+        asp->orig_pdu = NULL;
+    }
+    if (asp->pdu) {
+        asp->pdu->command = SNMP_MSG_RESPONSE;
+        asp->pdu->errstat = asp->status;
+        asp->pdu->errindex = asp->index;
+        if (!snmp_send(asp->session, asp->pdu)) {
+            snmp_free_pdu(asp->pdu);
+            asp->pdu = NULL;
+        }
+        snmp_increment_statistic(STAT_SNMPOUTPKTS);
+        snmp_increment_statistic(STAT_SNMPOUTGETRESPONSES);
+        asp->pdu = NULL;
+        netsnmp_remove_and_free_agent_snmp_session(asp);
+    }
+    return 1;
+}
+
+void
+dump_sess_list(void)
+{
+    netsnmp_agent_session *a;
+
+    DEBUGMSGTL(("snmp_agent", "DUMP agent_sess_list -> "));
+    for (a = agent_session_list; a != NULL; a = a->next) {
+        DEBUGMSG(("snmp_agent", "%08p[session %08p] -> ", a, a->session));
+    }
+    DEBUGMSG(("snmp_agent", "[NIL]\n"));
+}
+
+void
+netsnmp_remove_and_free_agent_snmp_session(netsnmp_agent_session *asp)
+{
+    netsnmp_agent_session *a, **prevNext = &agent_session_list;
+
+    DEBUGMSGTL(("snmp_agent", "REMOVE session == %08p\n", asp));
+
+    for (a = agent_session_list; a != NULL; a = *prevNext) {
+        if (a == asp) {
+            *prevNext = a->next;
+            a->next = NULL;
+            free_agent_snmp_session(a);
+            asp = NULL;
+            break;
+        } else {
+            prevNext = &(a->next);
+        }
+    }
+
+    if (a == NULL && asp != NULL) {
+        /*
+         * We coulnd't find it on the list, so free it anyway.  
+         */
+        free_agent_snmp_session(asp);
+    }
+}
+
+void
+netsnmp_free_agent_snmp_session_by_session(netsnmp_session * sess,
+                                           void (*free_request)
+                                           (netsnmp_request_list *))
+{
+    netsnmp_agent_session *a, *next, **prevNext = &agent_session_list;
+
+    DEBUGMSGTL(("snmp_agent", "REMOVE session == %08p\n", sess));
+
+    for (a = agent_session_list; a != NULL; a = next) {
+        if (a->session == sess) {
+            *prevNext = a->next;
+            next = a->next;
+            free_agent_snmp_session(a);
+        } else {
+            prevNext = &(a->next);
+            next = a->next;
+        }
+    }
+}
+
+/** handles an incoming SNMP packet into the agent */
+int
+handle_snmp_packet(int op, netsnmp_session * session, int reqid,
+                   netsnmp_pdu *pdu, void *magic)
+{
+    netsnmp_agent_session *asp;
+    int             status, access_ret, rc;
+
+    /*
+     * We only support receiving here.  
+     */
+    if (op != NETSNMP_CALLBACK_OP_RECEIVED_MESSAGE) {
+        return 1;
+    }
+
+    /*
+     * RESPONSE messages won't get this far, but TRAP-like messages
+     * might.  
+     */
+    if (pdu->command == SNMP_MSG_TRAP || pdu->command == SNMP_MSG_INFORM ||
+        pdu->command == SNMP_MSG_TRAP2) {
+        DEBUGMSGTL(("snmp_agent", "received trap-like PDU (%02x)\n",
+                    pdu->command));
+        pdu->command = SNMP_MSG_TRAP2;
+        snmp_increment_statistic(STAT_SNMPUNKNOWNPDUHANDLERS);
+        return 1;
+    }
+
+    if (magic == NULL) {
+        asp = init_agent_snmp_session(session, pdu);
+        status = SNMP_ERR_NOERROR;
+    } else {
+        asp = (netsnmp_agent_session *) magic;
+        status = asp->status;
+    }
+
+    if ((access_ret = check_access(pdu)) != 0) {
+        if (access_ret == VACM_NOSUCHCONTEXT) {
+            /*
+             * rfc2573 section 3.2, step 5 says that we increment the
+             * counter but don't return a response of any kind 
+             */
+
+            /*
+             * we currently don't support unavailable contexts, as
+             * there is no reason to that I currently know of 
+             */
+            snmp_increment_statistic(STAT_SNMPUNKNOWNCONTEXTS);
+
+            /*
+             * drop the request 
+             */
+            netsnmp_remove_and_free_agent_snmp_session(asp);
+            return 0;
+        } else {
+            /*
+             * access control setup is incorrect 
+             */
+            send_easy_trap(SNMP_TRAP_AUTHFAIL, 0);
+            if (asp->pdu->version != SNMP_VERSION_1
+                && asp->pdu->version != SNMP_VERSION_2c) {
+                asp->pdu->errstat = SNMP_ERR_AUTHORIZATIONERROR;
+                asp->pdu->command = SNMP_MSG_RESPONSE;
+                snmp_increment_statistic(STAT_SNMPOUTPKTS);
+                if (!snmp_send(asp->session, asp->pdu))
+                    snmp_free_pdu(asp->pdu);
+                asp->pdu = NULL;
+                netsnmp_remove_and_free_agent_snmp_session(asp);
+                return 1;
+            } else {
+                /*
+                 * drop the request 
+                 */
+                netsnmp_remove_and_free_agent_snmp_session(asp);
+                return 0;
+            }
+        }
+    }
+
+    rc = netsnmp_handle_request(asp, status);
+
+    /*
+     * done 
+     */
+    DEBUGMSGTL(("snmp_agent", "end of handle_snmp_packet, asp = %08p\n",
+                asp));
+    return rc;
+}
+
+netsnmp_request_info *
+netsnmp_add_varbind_to_cache(netsnmp_agent_session *asp, int vbcount,
+                             netsnmp_variable_list * varbind_ptr,
+                             netsnmp_subtree *tp)
+{
+    netsnmp_request_info *request = NULL;
+    int             cacheid;
+
+    DEBUGMSGTL(("snmp_agent", "add_vb_to_cache(%8p, %d, ", asp, vbcount));
+    DEBUGMSGOID(("snmp_agent", varbind_ptr->name,
+                 varbind_ptr->name_length));
+    DEBUGMSG(("snmp_agent", ", %8p)\n", tp));
+
+    if (tp &&
+        (asp->pdu->command == SNMP_MSG_GETNEXT ||
+         asp->pdu->command == SNMP_MSG_GETBULK)) {
+        int result;
+        int prefix_len;
+
+        prefix_len = netsnmp_oid_find_prefix(tp->start_a,
+                                             tp->start_len,
+                                             tp->end_a, tp->end_len);
+        result =
+            netsnmp_acm_check_subtree(asp->pdu, tp->start_a, prefix_len);
+
+        while (result == VACM_NOTINVIEW) {
+            /* the entire subtree is not in view. Skip it. */
+            /** @todo make this be more intelligent about ranges.
+                Right now we merely take the highest level
+                commonality of a registration range and use that.
+                At times we might be able to be smarter about
+                checking the range itself as opposed to the node
+                above where the range exists, but I doubt this will
+                come up all that frequently. */
+            tp = tp->next;
+            if (tp) {
+                prefix_len = netsnmp_oid_find_prefix(tp->start_a,
+                                                     tp->start_len,
+                                                     tp->end_a,
+                                                     tp->end_len);
+                result =
+                    netsnmp_acm_check_subtree(asp->pdu,
+                                              tp->start_a, prefix_len);
+            }
+            else
+                break;
+        }
+    }
+    if (tp == NULL) {
+        /*
+         * no appropriate registration found 
+         */
+        /*
+         * make up the response ourselves 
+         */
+        switch (asp->pdu->command) {
+        case SNMP_MSG_GETNEXT:
+        case SNMP_MSG_GETBULK:
+            varbind_ptr->type = SNMP_ENDOFMIBVIEW;
+            break;
+
+        case SNMP_MSG_SET:
+            varbind_ptr->type = SNMP_NOSUCHOBJECT;
+            break;
+
+        case SNMP_MSG_GET:
+            varbind_ptr->type = SNMP_NOSUCHOBJECT;
+            break;
+
+        default:
+            return NULL;        /* shouldn't get here */
+        }
+    } else {
+        DEBUGMSGTL(("snmp_agent", "tp->start "));
+        DEBUGMSGOID(("snmp_agent", tp->start_a, tp->start_len));
+        DEBUGMSG(("snmp_agent", ", tp->end "));
+        DEBUGMSGOID(("snmp_agent", tp->end_a, tp->end_len));
+        DEBUGMSG(("snmp_agent", ", \n"));
+
+        /*
+         * malloc the request structure 
+         */
+        request = &(asp->requests[vbcount - 1]);
+        request->index = vbcount;
+        request->delegated = 0;
+        request->processed = 0;
+        request->status = 0;
+        request->subtree = tp;
+        if (request->parent_data) {
+            netsnmp_free_request_data_sets(request);
+        }
+
+        /*
+         * for non-SET modes, set the type to NULL 
+         */
+        if (!MODE_IS_SET(asp->pdu->command)) {
+            if (varbind_ptr->type == ASN_PRIV_INCL_RANGE) {
+                DEBUGMSGTL(("snmp_agent", "varbind %d is inclusive\n",
+                            request->index));
+                request->inclusive = 1;
+            }
+            varbind_ptr->type = ASN_NULL;
+        }
+
+        /*
+         * place them in a cache 
+         */
+        if (tp->global_cacheid) {
+            /*
+             * we need to merge all marked subtrees together 
+             */
+            if (asp->cache_store && -1 !=
+                (cacheid = netsnmp_get_local_cachid(asp->cache_store,
+                                                    tp->global_cacheid))) {
+            } else {
+                cacheid = ++(asp->treecache_num);
+                netsnmp_get_or_add_local_cachid(&asp->cache_store,
+                                                tp->global_cacheid,
+                                                cacheid);
+                goto mallocslot;        /* XXX: ick */
+            }
+        } else if (tp->cacheid > -1 && tp->cacheid <= asp->treecache_num &&
+                   asp->treecache[tp->cacheid].subtree == tp) {
+            /*
+             * we have already added a request to this tree
+             * pointer before 
+             */
+            cacheid = tp->cacheid;
+        } else {
+            cacheid = ++(asp->treecache_num);
+          mallocslot:
+            /*
+             * new slot needed 
+             */
+            if (asp->treecache_num >= asp->treecache_len) {
+                /*
+                 * exapand cache array 
+                 */
+                /*
+                 * WWW: non-linear expansion needed (with cap) 
+                 */
+#define CACHE_GROW_SIZE 16
+                asp->treecache_len =
+                    (asp->treecache_len + CACHE_GROW_SIZE);
+                asp->treecache =
+                    realloc(asp->treecache,
+                            sizeof(netsnmp_tree_cache) *
+                            asp->treecache_len);
+                if (asp->treecache == NULL)
+                    return NULL;
+                memset(&(asp->treecache[cacheid]), 0x00,
+                       sizeof(netsnmp_tree_cache) * (CACHE_GROW_SIZE));
+            }
+            asp->treecache[cacheid].subtree = tp;
+            asp->treecache[cacheid].requests_begin = request;
+            tp->cacheid = cacheid;
+        }
+
+        /*
+         * if this is a search type, get the ending range oid as well 
+         */
+        if (asp->pdu->command == SNMP_MSG_GETNEXT ||
+            asp->pdu->command == SNMP_MSG_GETBULK) {
+            request->range_end = tp->end_a;
+            request->range_end_len = tp->end_len;
+        } else {
+            request->range_end = NULL;
+            request->range_end_len = 0;
+        }
+
+        /*
+         * link into chain 
+         */
+        if (asp->treecache[cacheid].requests_end)
+            asp->treecache[cacheid].requests_end->next = request;
+        request->next = NULL;
+        request->prev = asp->treecache[cacheid].requests_end;
+        asp->treecache[cacheid].requests_end = request;
+
+        /*
+         * add the given request to the list of requests they need
+         * to handle results for 
+         */
+        request->requestvb = request->requestvb_start = varbind_ptr;
+    }
+    return request;
+}
+
+/*
+ * check the ACM(s) for the results on each of the varbinds.
+ * If ACM disallows it, replace the value with type
+ * 
+ * Returns number of varbinds with ACM errors
+ */
+int
+check_acm(netsnmp_agent_session *asp, u_char type)
+{
+    int             view;
+    int             i, j, k;
+    netsnmp_request_info *request;
+    int             ret = 0;
+    netsnmp_variable_list *vb, *vb2, *vbc;
+    int             earliest = 0;
+
+    for (i = 0; i <= asp->treecache_num; i++) {
+        for (request = asp->treecache[i].requests_begin;
+             request; request = request->next) {
+            /*
+             * for each request, run it through in_a_view() 
+             */
+            earliest = 0;
+            for(j = request->repeat, vb = request->requestvb_start;
+                vb && j > -1;
+                j--, vb = vb->next_variable) {
+                if (vb->type != ASN_NULL &&
+                    vb->type != ASN_PRIV_RETRY) { /* not yet processed */
+                    view =
+                        in_a_view(vb->name, &vb->name_length,
+                                  asp->pdu, vb->type);
+
+                    /*
+                     * if a ACM error occurs, mark it as type passed in 
+                     */
+                    if (view != VACM_SUCCESS) {
+                        ret++;
+                        if (request->repeat < request->orig_repeat) {
+                            /* basically this means a GETBULK */
+                            request->repeat++;
+                            if (!earliest) {
+                                request->requestvb = vb;
+                                earliest = 1;
+                            }
+
+                            /* ugh.  if a whole now exists, we need to
+                               move the contents up the chain and fill
+                               in at the end else we won't end up
+                               lexographically sorted properly */
+                            if (j > -1 && vb->next_variable &&
+                                vb->next_variable->type != ASN_NULL &&
+                                vb->next_variable->type != ASN_PRIV_RETRY) {
+                                for(k = j, vbc = vb, vb2 = vb->next_variable;
+                                    k > -2 && vbc && vb2;
+                                    k--, vbc = vb2, vb2 = vb2->next_variable) {
+                                    /* clone next into the current */
+                                    snmp_clone_var(vb2, vbc);
+                                    vbc->next_variable = vb2;
+                                }
+                            }
+                        }
+                        snmp_set_var_typed_value(vb, type, NULL, 0);
+                    }
+                }
+            }
+        }
+    }
+    return ret;
+}
+
+
+int
+netsnmp_create_subtree_cache(netsnmp_agent_session *asp)
+{
+    netsnmp_subtree *tp;
+    netsnmp_variable_list *varbind_ptr, *vbsave, *vbptr, **prevNext;
+    int             view;
+    int             vbcount = 0;
+    int             bulkcount = 0, bulkrep = 0;
+    int             i = 0, n = 0, r = 0;
+    netsnmp_request_info *request;
+
+    if (asp->treecache == NULL && asp->treecache_len == 0) {
+        asp->treecache_len = SNMP_MAX(1 + asp->vbcount / 4, 16);
+        asp->treecache =
+            calloc(asp->treecache_len, sizeof(netsnmp_tree_cache));
+        if (asp->treecache == NULL)
+            return SNMP_ERR_GENERR;
+    }
+    asp->treecache_num = -1;
+
+    if (asp->pdu->command == SNMP_MSG_GETBULK) {
+        /*
+         * getbulk prep 
+         */
+        int             count = count_varbinds(asp->pdu->variables);
+
+        if (asp->pdu->errstat < 0) {
+            asp->pdu->errstat = 0;
+        }
+        if (asp->pdu->errindex < 0) {
+            asp->pdu->errindex = 0;
+        }
+
+        if (asp->pdu->errstat < count) {
+            n = asp->pdu->errstat;
+        } else {
+            n = count;
+        }
+        if ((r = count - n) < 0) {
+            r = 0;
+            asp->bulkcache = NULL;
+        } else {
+            asp->bulkcache =
+                (netsnmp_variable_list **) malloc(asp->pdu->errindex * r *
+                                                  sizeof(struct
+                                                         varbind_list *));
+        }
+        DEBUGMSGTL(("snmp_agent", "GETBULK N = %d, M = %d, R = %d\n",
+                    n, asp->pdu->errindex, r));
+    }
+
+    /*
+     * collect varbinds into their registered trees 
+     */
+    prevNext = &(asp->pdu->variables);
+    for (varbind_ptr = asp->pdu->variables; varbind_ptr;
+         varbind_ptr = vbsave) {
+
+        /*
+         * getbulk mess with this pointer, so save it 
+         */
+        vbsave = varbind_ptr->next_variable;
+
+        if (asp->pdu->command == SNMP_MSG_GETBULK) {
+            if (n > 0) {
+                n--;
+            } else {
+                /*
+                 * repeate request varbinds on GETBULK.  These will
+                 * have to be properly rearranged later though as
+                 * responses are supposed to actually be interlaced
+                 * with each other.  This is done with the asp->bulkcache. 
+                 */
+                bulkrep = asp->pdu->errindex - 1;
+                if (asp->pdu->errindex > 0) {
+                    vbptr = varbind_ptr;
+                    asp->bulkcache[bulkcount++] = vbptr;
+
+                    for (i = 1; i < asp->pdu->errindex; i++) {
+                        vbptr->next_variable =
+                            SNMP_MALLOC_STRUCT(variable_list);
+                        /*
+                         * don't clone the oid as it's got to be
+                         * overwwritten anyway 
+                         */
+                        if (!vbptr->next_variable) {
+                            /*
+                             * XXXWWW: ack!!! 
+                             */
+                        } else {
+                            vbptr = vbptr->next_variable;
+                            vbptr->name_length = 0;
+                            vbptr->type = ASN_NULL;
+                            asp->bulkcache[bulkcount++] = vbptr;
+                        }
+                    }
+                    vbptr->next_variable = vbsave;
+                } else {
+                    /*
+                     * 0 repeats requested for this varbind, so take it off
+                     * the list.  
+                     */
+                    vbptr = varbind_ptr;
+                    *prevNext = vbptr->next_variable;
+                    vbptr->next_variable = NULL;
+                    snmp_free_varbind(vbptr);
+                    asp->vbcount--;
+                    continue;
+                }
+            }
+        }
+
+        /*
+         * count the varbinds 
+         */
+        ++vbcount;
+
+        /*
+         * find the owning tree 
+         */
+        tp = netsnmp_subtree_find(varbind_ptr->name, varbind_ptr->name_length,
+				  NULL, asp->pdu->contextName);
+
+        /*
+         * check access control 
+         */
+        switch (asp->pdu->command) {
+        case SNMP_MSG_GET:
+            view = in_a_view(varbind_ptr->name, &varbind_ptr->name_length,
+                             asp->pdu, varbind_ptr->type);
+            if (view != VACM_SUCCESS)
+                snmp_set_var_typed_value(varbind_ptr, SNMP_NOSUCHOBJECT,
+                                         NULL, 0);
+            break;
+
+        case SNMP_MSG_SET:
+            view = in_a_view(varbind_ptr->name, &varbind_ptr->name_length,
+                             asp->pdu, varbind_ptr->type);
+            if (view != VACM_SUCCESS)
+                return SNMP_ERR_NOTWRITABLE;
+            break;
+
+        case SNMP_MSG_GETNEXT:
+        case SNMP_MSG_GETBULK:
+        default:
+            view = VACM_SUCCESS;
+            /*
+             * XXXWWW: check VACM here to see if "tp" is even worthwhile 
+             */
+        }
+        if (view == VACM_SUCCESS) {
+            request = netsnmp_add_varbind_to_cache(asp, vbcount, varbind_ptr,
+						   tp);
+            if (request && asp->pdu->command == SNMP_MSG_GETBULK) {
+                request->repeat = request->orig_repeat = bulkrep;
+            }
+        }
+
+        prevNext = &(varbind_ptr->next_variable);
+    }
+
+    return SNMPERR_SUCCESS;
+}
+
+/*
+ * this function is only applicable in getnext like contexts 
+ */
+int
+netsnmp_reassign_requests(netsnmp_agent_session *asp)
+{
+    /*
+     * assume all the requests have been filled or rejected by the
+     * subtrees, so reassign the rejected ones to the next subtree in
+     * the chain 
+     */
+
+    int             i;
+
+    /*
+     * get old info 
+     */
+    netsnmp_tree_cache *old_treecache = asp->treecache;
+
+    /*
+     * malloc new space 
+     */
+    asp->treecache =
+        (netsnmp_tree_cache *) calloc(asp->treecache_len,
+                                      sizeof(netsnmp_tree_cache));
+    asp->treecache_num = -1;
+    if (asp->cache_store) {
+        netsnmp_free_cachemap(asp->cache_store);
+        asp->cache_store = NULL;
+    }
+
+    for (i = 0; i < asp->vbcount; i++) {
+        if (asp->requests[i].requestvb->type == ASN_NULL) {
+            if (!netsnmp_add_varbind_to_cache(asp, asp->requests[i].index,
+                                              asp->requests[i].requestvb,
+                                              asp->requests[i].subtree->next)) {
+                if (old_treecache != NULL) {
+                    free(old_treecache);
+                    old_treecache = NULL;
+                }
+            }
+        } else if (asp->requests[i].requestvb->type == ASN_PRIV_RETRY) {
+            /*
+             * re-add the same subtree 
+             */
+            asp->requests[i].requestvb->type = ASN_NULL;
+            if (!netsnmp_add_varbind_to_cache(asp, asp->requests[i].index,
+                                              asp->requests[i].requestvb,
+                                              asp->requests[i].subtree)) {
+                if (old_treecache != NULL) {
+                    free(old_treecache);
+                    old_treecache = NULL;
+                }
+            }
+        }
+    }
+
+    if (old_treecache != NULL) {
+        free(old_treecache);
+    }
+    return SNMP_ERR_NOERROR;
+}
+
+void
+netsnmp_delete_request_infos(netsnmp_request_info *reqlist)
+{
+    while (reqlist) {
+        netsnmp_free_request_data_sets(reqlist);
+        reqlist = reqlist->next;
+    }
+}
+
+void
+netsnmp_delete_subtree_cache(netsnmp_agent_session *asp)
+{
+    while (asp->treecache_num >= 0) {
+        /*
+         * don't delete subtrees 
+         */
+        netsnmp_delete_request_infos(asp->treecache[asp->treecache_num].
+                                     requests_begin);
+        asp->treecache_num--;
+    }
+}
+
+int
+netsnmp_check_requests_status(netsnmp_agent_session *asp,
+                              netsnmp_request_info *requests,
+                              int look_for_specific)
+{
+    /*
+     * find any errors marked in the requests 
+     */
+    while (requests) {
+        if (requests->status != SNMP_ERR_NOERROR &&
+            (!look_for_specific || requests->status == look_for_specific)
+            && (look_for_specific || asp->index == 0
+                || requests->index < asp->index)) {
+            asp->index = requests->index;
+            asp->status = requests->status;
+        }
+        requests = requests->next;
+    }
+    return asp->status;
+}
+
+int
+netsnmp_check_all_requests_status(netsnmp_agent_session *asp,
+                                  int look_for_specific)
+{
+    int             i;
+    for (i = 0; i <= asp->treecache_num; i++) {
+        netsnmp_check_requests_status(asp,
+                                      asp->treecache[i].requests_begin,
+                                      look_for_specific);
+    }
+    return asp->status;
+}
+
+int
+handle_var_requests(netsnmp_agent_session *asp)
+{
+    int             i, retstatus = SNMP_ERR_NOERROR,
+        status = SNMP_ERR_NOERROR, final_status = SNMP_ERR_NOERROR;
+    netsnmp_handler_registration *reginfo;
+
+    /*
+     * create the netsnmp_agent_request_info data 
+     */
+    if (!asp->reqinfo) {
+        asp->reqinfo = SNMP_MALLOC_TYPEDEF(netsnmp_agent_request_info);
+        if (!asp->reqinfo)
+            return SNMP_ERR_GENERR;
+    }
+
+    asp->reqinfo->asp = asp;
+    asp->reqinfo->mode = asp->mode;
+
+    /*
+     * now, have the subtrees in the cache go search for their results 
+     */
+    for (i = 0; i <= asp->treecache_num; i++) {
+        reginfo = asp->treecache[i].subtree->reginfo;
+        status = netsnmp_call_handlers(reginfo, asp->reqinfo,
+                                       asp->treecache[i].requests_begin);
+
+        /*
+         * find any errors marked in the requests.  For later parts of
+         * SET processing, only check for new errors specific to that
+         * set processing directive (which must superceed the previous
+         * errors).
+         */
+        switch (asp->mode) {
+        case MODE_SET_COMMIT:
+            retstatus = netsnmp_check_requests_status(asp,
+						      asp->treecache[i].
+						      requests_begin,
+						      SNMP_ERR_COMMITFAILED);
+            break;
+
+        case MODE_SET_UNDO:
+            retstatus = netsnmp_check_requests_status(asp,
+						      asp->treecache[i].
+						      requests_begin,
+						      SNMP_ERR_UNDOFAILED);
+            break;
+
+        default:
+            retstatus = netsnmp_check_requests_status(asp,
+						      asp->treecache[i].
+						      requests_begin, 0);
+            break;
+        }
+
+        /*
+         * always take lowest varbind if possible 
+         */
+        if (retstatus != SNMP_ERR_NOERROR) {
+            status = retstatus;
+	}
+
+        /*
+         * other things we know less about (no index) 
+         */
+        /*
+         * WWW: drop support for this? 
+         */
+        if (final_status == SNMP_ERR_NOERROR && status != SNMP_ERR_NOERROR) {
+            /*
+             * we can't break here, since some processing needs to be
+             * done for all requests anyway (IE, SET handling for UNDO
+             * needs to be called regardless of previous status
+             * results.
+             * WWW:  This should be predictable though and
+             * breaking should be possible in some cases (eg GET,
+             * GETNEXT, ...) 
+             */
+            final_status = status;
+        }
+    }
+
+    return final_status;
+}
+
+/*
+ * loop through our sessions known delegated sessions and check to see
+ * if they've completed yet. If there are no more delegated sessions,
+ * check for and process any queued requests
+ */
+void
+netsnmp_check_outstanding_agent_requests(void)
+{
+    netsnmp_agent_session *asp, *prev_asp = NULL, *next_asp = NULL;
+
+    /*
+     * deal with delegated requests
+     */
+    for (asp = agent_delegated_list; asp; prev_asp = asp, asp = next_asp) {
+        next_asp = asp->next;   /* save in case we clean up asp */
+        if (!netsnmp_check_for_delegated(asp)) {
+
+            /*
+             * we're done with this one, remove from queue 
+             */
+            if (prev_asp != NULL)
+                prev_asp->next = asp->next;
+            else
+                agent_delegated_list = asp->next;
+
+            /*
+             * check request status
+             */
+            netsnmp_check_all_requests_status(asp, 0);
+            
+            /*
+             * continue processing or finish up 
+             */
+            check_delayed_request(asp);
+        }
+    }
+
+    /*
+     * if we are processing a set and there are more delegated
+     * requests, keep waiting before getting to queued requests.
+     */
+    if (netsnmp_processing_set && (NULL != agent_delegated_list))
+        return;
+
+    while (netsnmp_agent_queued_list) {
+
+        /*
+         * if we are processing a set, the first item better be
+         * the set being (or waiting to be) processed.
+         */
+        netsnmp_assert((!netsnmp_processing_set) ||
+                       (netsnmp_processing_set == netsnmp_agent_queued_list));
+
+        /*
+         * if the top request is a set, don't pop it
+         * off if there are delegated requests
+         */
+        if ((netsnmp_agent_queued_list->pdu->command == SNMP_MSG_SET) &&
+            (agent_delegated_list)) {
+
+            netsnmp_assert(netsnmp_processing_set == NULL);
+
+            netsnmp_processing_set = netsnmp_agent_queued_list;
+            DEBUGMSGTL(("snmp_agent", "SET request remains queued while "
+                        "delegated requests finish, asp = %08p\n", asp));
+            break;
+        }
+
+        /*
+         * pop the first request and process it
+         */
+        asp = netsnmp_agent_queued_list;
+        netsnmp_agent_queued_list = asp->next;
+        DEBUGMSGTL(("snmp_agent",
+                    "processing queued request, asp = %08p\n", asp));
+
+        netsnmp_handle_request(asp, asp->status);
+
+        /*
+         * if we hit a set, stop
+         */
+        if (NULL != netsnmp_processing_set)
+            break;
+    }
+}
+
+/** Decide if the requested transaction_id is still being processed
+   within the agent.  This is used to validate whether a delayed cache
+   (containing possibly freed pointers) is still usable.
+
+   returns SNMPERR_SUCCESS if it's still valid, or SNMPERR_GENERR if not. */
+int
+netsnmp_check_transaction_id(int transaction_id)
+{
+    netsnmp_agent_session *asp, *prev_asp = NULL;
+
+    for (asp = agent_delegated_list; asp; prev_asp = asp, asp = asp->next) {
+        if (asp->pdu->transid == transaction_id)
+            return SNMPERR_SUCCESS;
+    }
+    return SNMPERR_GENERR;
+}
+
+
+/*
+ * check_delayed_request(asp)
+ *
+ * Called to rexamine a set of requests and continue processing them
+ * once all the previous (delayed) requests have been handled one way
+ * or another.
+ */
+
+int
+check_delayed_request(netsnmp_agent_session *asp)
+{
+    int             status = SNMP_ERR_NOERROR;
+
+    DEBUGMSGTL(("snmp_agent", "processing delegated request, asp = %08p\n",
+                asp));
+
+    switch (asp->mode) {
+    case SNMP_MSG_GETBULK:
+    case SNMP_MSG_GETNEXT:
+        netsnmp_check_all_requests_status(asp, 0);
+        handle_getnext_loop(asp);
+        if (netsnmp_check_for_delegated(asp) &&
+            netsnmp_check_transaction_id(asp->pdu->transid) !=
+            SNMPERR_SUCCESS) {
+            /*
+             * add to delegated request chain 
+             */
+            if (!netsnmp_check_delegated_chain_for(asp)) {
+                asp->next = agent_delegated_list;
+                agent_delegated_list = asp;
+            }
+        }
+        break;
+
+    case MODE_SET_COMMIT:
+        netsnmp_check_all_requests_status(asp, SNMP_ERR_COMMITFAILED);
+        goto settop;
+
+    case MODE_SET_UNDO:
+        netsnmp_check_all_requests_status(asp, SNMP_ERR_UNDOFAILED);
+        goto settop;
+
+    case MODE_SET_BEGIN:
+    case MODE_SET_RESERVE1:
+    case MODE_SET_RESERVE2:
+    case MODE_SET_ACTION:
+    case MODE_SET_FREE:
+      settop:
+        handle_set_loop(asp);
+        if (asp->mode != FINISHED_SUCCESS && asp->mode != FINISHED_FAILURE) {
+
+            if (netsnmp_check_for_delegated_and_add(asp)) {
+                /*
+                 * add to delegated request chain 
+                 */
+                if (!asp->status)
+                    asp->status = status;
+            }
+
+            return SNMP_ERR_NOERROR;
+        }
+        break;
+
+    default:
+        break;
+    }
+
+    /*
+     * if we don't have anything outstanding (delegated), wrap up 
+     */
+    if (!netsnmp_check_for_delegated(asp))
+        return netsnmp_wrap_up_request(asp, status);
+
+    return 1;
+}
+
+/** returns 1 if there are valid GETNEXT requests left.  Returns 0 if not. */
+int
+check_getnext_results(netsnmp_agent_session *asp)
+{
+    /*
+     * get old info 
+     */
+    netsnmp_tree_cache *old_treecache = asp->treecache;
+    int             old_treecache_num = asp->treecache_num;
+    int             count = 0;
+    int             i, special = 0;
+    netsnmp_request_info *request;
+
+    if (asp->mode == SNMP_MSG_GET) {
+        /*
+         * Special case for doing INCLUSIVE getNext operations in
+         * AgentX subagents.  
+         */
+        DEBUGMSGTL(("snmp_agent",
+                    "asp->mode == SNMP_MSG_GET in ch_getnext\n"));
+        asp->mode = asp->oldmode;
+        special = 1;
+    }
+
+    for (i = 0; i <= old_treecache_num; i++) {
+        for (request = old_treecache[i].requests_begin; request;
+             request = request->next) {
+
+            /*
+             * If we have just done the special case AgentX GET, then any
+             * requests which were not INCLUSIVE will now have a wrong
+             * response, so junk them and retry from the same place (except
+             * that this time the handler will be called in "inexact"
+             * mode).  
+             */
+
+            if (special) {
+                if (!request->inclusive) {
+                    DEBUGMSGTL(("snmp_agent",
+                                "request %d wasn't inclusive\n",
+                                request->index));
+                    snmp_set_var_typed_value(request->requestvb,
+                                             ASN_PRIV_RETRY, NULL, 0);
+                } else if (request->requestvb->type == ASN_NULL ||
+                           request->requestvb->type == SNMP_NOSUCHINSTANCE ||
+                           request->requestvb->type == SNMP_NOSUCHOBJECT) {
+                    /*
+                     * it was inclusive, but no results.  Still retry this
+                     * search. 
+                     */
+                    snmp_set_var_typed_value(request->requestvb,
+                                             ASN_PRIV_RETRY, NULL, 0);
+                }
+            }
+
+            /*
+             * out of range? 
+             */
+            if (snmp_oid_compare(request->requestvb->name,
+                                 request->requestvb->name_length,
+                                 request->range_end,
+                                 request->range_end_len) >= 0) {
+                /*
+                 * ack, it's beyond the accepted end of range. 
+                 */
+                /*
+                 * fix it by setting the oid to the end of range oid instead 
+                 */
+                DEBUGMSGTL(("check_getnext_results",
+                            "request response %d out of range\n",
+                            request->index));
+                request->inclusive = 1;
+                /*
+                 * XXX: should set this to the original OID? 
+                 */
+                snmp_set_var_objid(request->requestvb,
+                                   request->range_end,
+                                   request->range_end_len);
+                snmp_set_var_typed_value(request->requestvb, ASN_NULL,
+                                         NULL, 0);
+            }
+
+            /*
+             * mark any existent requests with illegal results as NULL 
+             */
+            if (request->requestvb->type == SNMP_ENDOFMIBVIEW) {
+                /*
+                 * illegal response from a subagent.  Change it back to NULL 
+                 */
+                request->requestvb->type = ASN_NULL;
+                request->inclusive = 1;
+            }
+
+            if (request->requestvb->type == ASN_NULL ||
+                request->requestvb->type == ASN_PRIV_RETRY ||
+                (asp->reqinfo->mode == MODE_GETBULK
+                 && request->repeat > 0))
+                count++;
+        }
+    }
+    return count;
+}
+
+/** repeatedly calls getnext handlers looking for an answer till all
+   requests are satisified.  It's expected that one pass has been made
+   before entering this function */
+int
+handle_getnext_loop(netsnmp_agent_session *asp)
+{
+    int             status;
+    netsnmp_variable_list *var_ptr;
+
+    /*
+     * loop 
+     */
+    while (1) {
+
+        /*
+         * bail for now if anything is delegated. 
+         */
+        if (netsnmp_check_for_delegated(asp)) {
+            return SNMP_ERR_NOERROR;
+        }
+
+        /*
+         * check vacm against results 
+         */
+        check_acm(asp, ASN_PRIV_RETRY);
+
+        /*
+         * need to keep going we're not done yet. 
+         */
+        if (!check_getnext_results(asp))
+            /*
+             * nothing left, quit now 
+             */
+            break;
+
+        /*
+         * never had a request (empty pdu), quit now 
+         */
+        /*
+         * XXXWWW: huh?  this would be too late, no?  shouldn't we
+         * catch this earlier? 
+         */
+        /*
+         * if (count == 0)
+         * break; 
+         */
+
+        DEBUGIF("results") {
+            DEBUGMSGTL(("results",
+                        "getnext results, before next pass:\n"));
+            for (var_ptr = asp->pdu->variables; var_ptr;
+                 var_ptr = var_ptr->next_variable) {
+                DEBUGMSGTL(("results", "\t"));
+                DEBUGMSGVAR(("results", var_ptr));
+                DEBUGMSG(("results", "\n"));
+            }
+        }
+
+        netsnmp_reassign_requests(asp);
+        status = handle_var_requests(asp);
+        if (status != SNMP_ERR_NOERROR) {
+            return status;      /* should never really happen */
+        }
+    }
+    return SNMP_ERR_NOERROR;
+}
+
+int
+handle_set(netsnmp_agent_session *asp)
+{
+    int             status;
+    /*
+     * SETS require 3-4 passes through the var_op_list.
+     * The first two
+     * passes verify that all types, lengths, and values are valid
+     * and may reserve resources and the third does the set and a
+     * fourth executes any actions.  Then the identical GET RESPONSE
+     * packet is returned.
+     * If either of the first two passes returns an error, another
+     * pass is made so that any reserved resources can be freed.
+     * If the third pass returns an error, another pass is
+     * made so that
+     * any changes can be reversed.
+     * If the fourth pass (or any of the error handling passes)
+     * return an error, we'd rather not know about it!
+     */
+    if (!(asp->pdu->flags & UCD_MSG_FLAG_ONE_PASS_ONLY)) {
+        switch (asp->mode) {
+        case MODE_SET_BEGIN:
+            snmp_increment_statistic(STAT_SNMPINSETREQUESTS);
+            asp->rw = WRITE;    /* WWW: still needed? */
+            asp->mode = MODE_SET_RESERVE1;
+            asp->status = SNMP_ERR_NOERROR;
+            break;
+
+        case MODE_SET_RESERVE1:
+
+            if (asp->status != SNMP_ERR_NOERROR)
+                asp->mode = MODE_SET_FREE;
+            else
+                asp->mode = MODE_SET_RESERVE2;
+            break;
+
+        case MODE_SET_RESERVE2:
+            if (asp->status != SNMP_ERR_NOERROR)
+                asp->mode = MODE_SET_FREE;
+            else
+                asp->mode = MODE_SET_ACTION;
+            break;
+
+        case MODE_SET_ACTION:
+            if (asp->status != SNMP_ERR_NOERROR)
+                asp->mode = MODE_SET_UNDO;
+            else
+                asp->mode = MODE_SET_COMMIT;
+            break;
+
+        case MODE_SET_COMMIT:
+            if (asp->status != SNMP_ERR_NOERROR) {
+                asp->mode = FINISHED_FAILURE;
+            } else {
+                asp->mode = FINISHED_SUCCESS;
+            }
+            break;
+
+        case MODE_SET_UNDO:
+            asp->mode = FINISHED_FAILURE;
+            break;
+
+        case MODE_SET_FREE:
+            asp->mode = FINISHED_FAILURE;
+            break;
+        }
+    }
+
+    if (asp->mode != FINISHED_SUCCESS && asp->mode != FINISHED_FAILURE) {
+        DEBUGMSGTL(("agent_set", "doing set mode = %d (%s)\n", asp->mode,
+                    se_find_label_in_slist("agent_mode", asp->mode)));
+        status = handle_var_requests(asp);
+        DEBUGMSGTL(("agent_set", "did set mode = %d, status = %d\n",
+                    asp->mode, status));
+        if ((status != SNMP_ERR_NOERROR && asp->status == SNMP_ERR_NOERROR) ||
+	    status == SNMP_ERR_COMMITFAILED || 
+	    status == SNMP_ERR_UNDOFAILED) {
+            asp->status = status;
+        }
+    }
+    return asp->status;
+}
+
+int
+handle_set_loop(netsnmp_agent_session *asp)
+{
+    while (asp->mode != FINISHED_FAILURE && asp->mode != FINISHED_SUCCESS) {
+        handle_set(asp);
+        if (netsnmp_check_for_delegated(asp)) {
+            return SNMP_ERR_NOERROR;
+	}
+        if (asp->pdu->flags & UCD_MSG_FLAG_ONE_PASS_ONLY) {
+            return asp->status;
+	}
+    }
+    return asp->status;
+}
+
+int
+netsnmp_handle_request(netsnmp_agent_session *asp, int status)
+{
+    /*
+     * if this isn't a delegated request trying to finish,
+     * processing of a set request should not start until all
+     * delegated requests have completed, and no other new requests
+     * should be processed until the set request completes.
+     */
+    if ((0 == netsnmp_check_delegated_chain_for(asp)) &&
+        (asp != netsnmp_processing_set)) {
+        /*
+         * if we are processing a set and this is not a delegated
+         * request, queue the request
+         */
+        if (netsnmp_processing_set) {
+            netsnmp_add_queued(asp);
+            DEBUGMSGTL(("snmp_agent",
+                        "request queued while processing set, "
+                        "asp = %08p\n", asp));
+            return 1;
+        }
+
+        /*
+         * check for set request
+         */
+        if (asp->pdu->command == SNMP_MSG_SET) {
+            netsnmp_processing_set = asp;
+
+            /*
+             * if there are delegated requests, we must wait for them
+             * to finishd.
+             */
+            if (agent_delegated_list) {
+                DEBUGMSGTL(("snmp_agent", "SET request queued while "
+                            "delegated requests finish, asp = %08p\n",
+                            asp));
+                netsnmp_add_queued(asp);
+                return 1;
+            }
+        }
+    }
+
+    /*
+     * process the request 
+     */
+    status = handle_pdu(asp);
+
+    /*
+     * print the results in appropriate debugging mode 
+     */
+    DEBUGIF("results") {
+        netsnmp_variable_list *var_ptr;
+        DEBUGMSGTL(("results", "request results (status = %d):\n",
+                    status));
+        for (var_ptr = asp->pdu->variables; var_ptr;
+             var_ptr = var_ptr->next_variable) {
+            DEBUGMSGTL(("results", "\t"));
+            DEBUGMSGVAR(("results", var_ptr));
+            DEBUGMSG(("results", "\n"));
+        }
+    }
+
+    /*
+     * check for uncompleted requests 
+     */
+    if (netsnmp_check_for_delegated_and_add(asp)) {
+        /*
+         * add to delegated request chain 
+         */
+        asp->status = status;
+    } else {
+        /*
+         * if we don't have anything outstanding (delegated), wrap up
+         */
+        return netsnmp_wrap_up_request(asp, status);
+    }
+
+    return 1;
+}
+
+int
+handle_pdu(netsnmp_agent_session *asp)
+{
+    int             status, inclusives = 0;
+    netsnmp_variable_list *v = NULL;
+
+    /*
+     * for illegal requests, mark all nodes as ASN_NULL 
+     */
+    switch (asp->pdu->command) {
+
+    case SNMP_MSG_INTERNAL_SET_RESERVE2:
+    case SNMP_MSG_INTERNAL_SET_ACTION:
+    case SNMP_MSG_INTERNAL_SET_COMMIT:
+    case SNMP_MSG_INTERNAL_SET_FREE:
+    case SNMP_MSG_INTERNAL_SET_UNDO:
+        status = get_set_cache(asp);
+        if (status != SNMP_ERR_NOERROR)
+            return status;
+        break;
+
+    case SNMP_MSG_GET:
+    case SNMP_MSG_GETNEXT:
+    case SNMP_MSG_GETBULK:
+        for (v = asp->pdu->variables; v != NULL; v = v->next_variable) {
+            if (v->type == ASN_PRIV_INCL_RANGE) {
+                /*
+                 * Leave the type for now (it gets set to
+                 * ASN_NULL in netsnmp_add_varbind_to_cache,
+                 * called by create_subnetsnmp_tree_cache below).
+                 * If we set it to ASN_NULL now, we wouldn't be
+                 * able to distinguish INCLUSIVE search
+                 * ranges.  
+                 */
+                inclusives++;
+            } else {
+                snmp_set_var_typed_value(v, ASN_NULL, NULL, 0);
+            }
+        }
+        /*
+         * fall through 
+         */
+
+    case SNMP_MSG_INTERNAL_SET_BEGIN:
+    case SNMP_MSG_INTERNAL_SET_RESERVE1:
+    default:
+        asp->vbcount = count_varbinds(asp->pdu->variables);
+        if (asp->vbcount) /* efence doesn't like 0 size allocs */
+            asp->requests = (netsnmp_request_info *)
+                calloc(asp->vbcount, sizeof(netsnmp_request_info));
+        /*
+         * collect varbinds 
+         */
+        status = netsnmp_create_subtree_cache(asp);
+        if (status != SNMP_ERR_NOERROR)
+            return status;
+    }
+
+    asp->mode = asp->pdu->command;
+    switch (asp->mode) {
+    case SNMP_MSG_GET:
+        /*
+         * increment the message type counter 
+         */
+        snmp_increment_statistic(STAT_SNMPINGETREQUESTS);
+
+        /*
+         * check vacm ahead of time 
+         */
+        check_acm(asp, SNMP_NOSUCHOBJECT);
+
+        /*
+         * get the results 
+         */
+        status = handle_var_requests(asp);
+
+        /*
+         * Deal with unhandled results -> noSuchInstance (rather
+         * than noSuchObject -- in that case, the type will
+         * already have been set to noSuchObject when we realised
+         * we couldn't find an appropriate tree).  
+         */
+        if (status == SNMP_ERR_NOERROR)
+            snmp_replace_var_types(asp->pdu->variables, ASN_NULL,
+                                   SNMP_NOSUCHINSTANCE);
+        break;
+
+    case SNMP_MSG_GETNEXT:
+        snmp_increment_statistic(STAT_SNMPINGETNEXTS);
+        /*
+         * fall through 
+         */
+
+    case SNMP_MSG_GETBULK:     /* note: there is no getbulk stat */
+        /*
+         * loop through our mib tree till we find an
+         * appropriate response to return to the caller. 
+         */
+
+        if (inclusives) {
+            /*
+             * This is a special case for AgentX INCLUSIVE getNext
+             * requests where a result lexi-equal to the request is okay
+             * but if such a result does not exist, we still want the
+             * lexi-next one.  So basically we do a GET first, and if any
+             * of the INCLUSIVE requests are satisfied, we use that
+             * value.  Then, unsatisfied INCLUSIVE requests, and
+             * non-INCLUSIVE requests get done as normal.  
+             */
+
+            DEBUGMSGTL(("snmp_agent", "inclusive range(s) in getNext\n"));
+            asp->oldmode = asp->mode;
+            asp->mode = SNMP_MSG_GET;
+        }
+
+        /*
+         * first pass 
+         */
+        status = handle_var_requests(asp);
+        if (status != SNMP_ERR_NOERROR) {
+            if (!inclusives)
+                return status;  /* should never really happen */
+            else
+                asp->status = SNMP_ERR_NOERROR;
+        }
+
+        /*
+         * loop through our mib tree till we find an
+         * appropriate response to return to the caller. 
+         */
+
+        status = handle_getnext_loop(asp);
+        break;
+
+    case SNMP_MSG_SET:
+        /*
+         * check access permissions first 
+         */
+        if (check_acm(asp, SNMP_NOSUCHOBJECT))
+            return SNMP_ERR_NOTWRITABLE;
+
+        asp->mode = MODE_SET_BEGIN;
+        status = handle_set_loop(asp);
+
+        break;
+
+    case SNMP_MSG_INTERNAL_SET_BEGIN:
+    case SNMP_MSG_INTERNAL_SET_RESERVE1:
+    case SNMP_MSG_INTERNAL_SET_RESERVE2:
+    case SNMP_MSG_INTERNAL_SET_ACTION:
+    case SNMP_MSG_INTERNAL_SET_COMMIT:
+    case SNMP_MSG_INTERNAL_SET_FREE:
+    case SNMP_MSG_INTERNAL_SET_UNDO:
+        asp->pdu->flags |= UCD_MSG_FLAG_ONE_PASS_ONLY;
+        status = handle_set_loop(asp);
+        /*
+         * asp related cache is saved in cleanup 
+         */
+        break;
+
+    case SNMP_MSG_RESPONSE:
+        snmp_increment_statistic(STAT_SNMPINGETRESPONSES);
+        return SNMP_ERR_NOERROR;
+
+    case SNMP_MSG_TRAP:
+    case SNMP_MSG_TRAP2:
+        snmp_increment_statistic(STAT_SNMPINTRAPS);
+        return SNMP_ERR_NOERROR;
+
+    default:
+        /*
+         * WWW: are reports counted somewhere ? 
+         */
+        snmp_increment_statistic(STAT_SNMPINASNPARSEERRS);
+        return SNMPERR_GENERR;  /* shouldn't get here */
+        /*
+         * WWW 
+         */
+    }
+    return status;
+}
+
+int
+netsnmp_set_request_error(netsnmp_agent_request_info *reqinfo,
+                          netsnmp_request_info *request, int error_value)
+{
+    if (!request || !reqinfo)
+        return error_value;
+
+    return netsnmp_set_mode_request_error(reqinfo->mode, request,
+                                          error_value);
+}
+
+int
+netsnmp_set_mode_request_error(int mode, netsnmp_request_info *request,
+                               int error_value)
+{
+    if (!request)
+        return error_value;
+
+    request->processed = 1;
+    request->delegated = REQUEST_IS_NOT_DELEGATED;
+
+    switch (error_value) {
+    case SNMP_NOSUCHOBJECT:
+    case SNMP_NOSUCHINSTANCE:
+    case SNMP_ENDOFMIBVIEW:
+        /*
+         * these are exceptions that should be put in the varbind
+         * in the case of a GET but should be translated for a SET
+         * into a real error status code and put in the request 
+         */
+        switch (mode) {
+        case MODE_GET:
+            request->requestvb->type = error_value;
+            return error_value;
+
+        case MODE_GETNEXT:
+        case MODE_GETBULK:
+            /*
+             * ignore these.  They're illegal to set by the
+             * client APIs for these modes 
+             */
+            snmp_log(LOG_ERR, "Illegal error_value %d for mode %d ignored\n",
+                     error_value, mode);
+            return error_value;
+
+        default:
+            request->status = SNMP_ERR_NOSUCHNAME;      /* WWW: correct? */
+            return error_value;
+        }
+        break;                  /* never get here */
+
+    default:
+        if (request->status < 0) {
+            /*
+             * illegal local error code.  translate to generr 
+             */
+            /*
+             * WWW: full translation map? 
+             */
+            snmp_log(LOG_ERR, "Illegal error_value %d translated to %d\n",
+                     error_value, SNMP_ERR_GENERR);
+            request->status = SNMP_ERR_GENERR;
+        } else {
+            /*
+             * WWW: translations and mode checking? 
+             */
+            request->status = error_value;
+        }
+        return error_value;
+    }
+    return error_value;
+}
+
+int
+netsnmp_set_all_requests_error(netsnmp_agent_request_info *reqinfo,
+                               netsnmp_request_info *requests,
+                               int error_value)
+{
+    while (requests) {
+        netsnmp_set_request_error(reqinfo, requests, error_value);
+        requests = requests->next;
+    }
+    return error_value;
+}
+
+extern struct timeval starttime;
+
+                /*
+                 * Return the value of 'sysUpTime' at the given marker 
+                 */
+u_long
+netsnmp_marker_uptime(marker_t pm)
+{
+    u_long          res;
+    marker_t        start = (marker_t) & starttime;
+
+    res = uatime_hdiff(start, pm);
+    return res;                 /* atime_diff works in msec, not csec */
+}
+
+                        /*
+                         * struct timeval equivalents of these 
+                         */
+u_long
+netsnmp_timeval_uptime(struct timeval * tv)
+{
+    return netsnmp_marker_uptime((marker_t) tv);
+}
+
+                /*
+                 * Return the current value of 'sysUpTime' 
+                 */
+u_long
+netsnmp_get_agent_uptime(void)
+{
+    struct timeval  now;
+    gettimeofday(&now, NULL);
+
+    return netsnmp_timeval_uptime(&now);
+}
+
+
+
+NETSNMP_INLINE void
+netsnmp_agent_add_list_data(netsnmp_agent_request_info *ari,
+                            netsnmp_data_list *node)
+{
+    if (ari) {
+	if (ari->agent_data) {
+            netsnmp_add_list_data(&ari->agent_data, node);
+        } else {
+            ari->agent_data = node;
+	}
+    }
+}
+
+NETSNMP_INLINE void    *
+netsnmp_agent_get_list_data(netsnmp_agent_request_info *ari,
+                            const char *name)
+{
+    if (ari) {
+        return netsnmp_get_list_data(ari->agent_data, name);
+    }
+    return NULL;
+}
+
+NETSNMP_INLINE void
+netsnmp_free_agent_data_set(netsnmp_agent_request_info *ari)
+{
+    if (ari) {
+        netsnmp_free_list_data(ari->agent_data);
+    }
+}
+
+NETSNMP_INLINE void
+netsnmp_free_agent_data_sets(netsnmp_agent_request_info *ari)
+{
+    if (ari) {
+        netsnmp_free_all_list_data(ari->agent_data);
+    }
+}
+
+NETSNMP_INLINE void
+netsnmp_free_agent_request_info(netsnmp_agent_request_info *ari)
+{
+    if (ari) {
+        if (ari->agent_data) {
+            netsnmp_free_all_list_data(ari->agent_data);
+	}
+        free(ari);
+    }
+}
diff -Naur tomato/release/src/router/snmp/agent/snmp_agent.c.readonly tomato121/release/src/router/snmp/agent/snmp_agent.c.readonly
--- tomato/release/src/router/snmp/agent/snmp_agent.c.readonly	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/snmp_agent.c.readonly	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,2972 @@
+/*
+ * snmp_agent.c
+ *
+ * Simple Network Management Protocol (RFC 1067).
+ */
+/***********************************************************
+	Copyright 1988, 1989 by Carnegie Mellon University
+
+                      All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its 
+documentation for any purpose and without fee is hereby granted, 
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in 
+supporting documentation, and that the name of CMU not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.  
+
+CMU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+CMU BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+******************************************************************/
+
+#include <net-snmp/net-snmp-config.h>
+
+#include <sys/types.h>
+#ifdef HAVE_LIMITS_H
+#include <limits.h>
+#endif
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#if HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#if HAVE_STRING_H
+#include <string.h>
+#endif
+#if TIME_WITH_SYS_TIME
+# ifdef WIN32
+#  include <sys/timeb.h>
+# else
+#  include <sys/time.h>
+# endif
+# include <time.h>
+#else
+# if HAVE_SYS_TIME_H
+#  include <sys/time.h>
+# else
+#  include <time.h>
+# endif
+#endif
+#if HAVE_SYS_SELECT_H
+#include <sys/select.h>
+#endif
+#if HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+#include <errno.h>
+#if HAVE_WINSOCK_H
+#include <winsock.h>
+#endif
+
+#if HAVE_DMALLOC_H
+#include <dmalloc.h>
+#endif
+
+#define SNMP_NEED_REQUEST_LIST
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include <net-snmp/library/snmp_assert.h>
+
+#ifdef USE_LIBWRAP
+#include <syslog.h>
+#include <tcpd.h>
+#include <syslog.h>
+int             allow_severity = LOG_INFO;
+int             deny_severity = LOG_WARNING;
+#endif
+
+#include "snmpd.h"
+#include "mibgroup/struct.h"
+#include "mibgroup/util_funcs.h"
+#include <net-snmp/agent/mib_module_config.h>
+
+#ifdef USING_AGENTX_PROTOCOL_MODULE
+#include "agentx/protocol.h"
+#endif
+
+#ifdef USING_AGENTX_MASTER_MODULE
+#include "agentx/master.h"
+#endif
+
+#define SNMP_ADDRCACHE_SIZE 10
+
+struct addrCache {
+    char           *addr;
+    enum { SNMP_ADDRCACHE_UNUSED = 0,
+        SNMP_ADDRCACHE_USED = 1,
+        SNMP_ADDRCACHE_OLD = 2
+    } status;
+};
+
+static struct addrCache addrCache[SNMP_ADDRCACHE_SIZE];
+int             lastAddrAge = 0;
+int             log_addresses = 0;
+
+
+
+typedef struct _agent_nsap {
+    int             handle;
+    netsnmp_transport *t;
+    void           *s;          /*  Opaque internal session pointer.  */
+    struct _agent_nsap *next;
+} agent_nsap;
+
+static agent_nsap *agent_nsap_list = NULL;
+static netsnmp_agent_session *agent_session_list = NULL;
+static netsnmp_agent_session *netsnmp_processing_set = NULL;
+netsnmp_agent_session *agent_delegated_list = NULL;
+netsnmp_agent_session *netsnmp_agent_queued_list = NULL;
+
+
+int             netsnmp_agent_check_packet(netsnmp_session *,
+                                           struct netsnmp_transport_s *,
+                                           void *, int);
+int             netsnmp_agent_check_parse(netsnmp_session *, netsnmp_pdu *,
+                                          int);
+void            delete_subnetsnmp_tree_cache(netsnmp_agent_session *asp);
+int             handle_pdu(netsnmp_agent_session *asp);
+int             netsnmp_handle_request(netsnmp_agent_session *asp,
+                                       int status);
+int             netsnmp_wrap_up_request(netsnmp_agent_session *asp,
+                                        int status);
+int             check_delayed_request(netsnmp_agent_session *asp);
+int             handle_getnext_loop(netsnmp_agent_session *asp);
+int             handle_set_loop(netsnmp_agent_session *asp);
+
+int             netsnmp_check_queued_chain_for(netsnmp_agent_session *asp);
+int             netsnmp_add_queued(netsnmp_agent_session *asp);
+int             netsnmp_remove_from_delegated(netsnmp_agent_session *asp);
+
+
+static int      current_globalid = 0;
+
+int
+netsnmp_allocate_globalcacheid(void)
+{
+    return ++current_globalid;
+}
+
+int
+netsnmp_get_local_cachid(netsnmp_cachemap *cache_store, int globalid)
+{
+    while (cache_store != NULL) {
+        if (cache_store->globalid == globalid)
+            return cache_store->cacheid;
+        cache_store = cache_store->next;
+    }
+    return -1;
+}
+
+netsnmp_cachemap *
+netsnmp_get_or_add_local_cachid(netsnmp_cachemap **cache_store,
+                                int globalid, int localid)
+{
+    netsnmp_cachemap *tmpp;
+
+    tmpp = SNMP_MALLOC_TYPEDEF(netsnmp_cachemap);
+    if (*cache_store) {
+        tmpp->next = *cache_store;
+        *cache_store = tmpp;
+    } else {
+        *cache_store = tmpp;
+    }
+
+    tmpp->globalid = globalid;
+    tmpp->cacheid = localid;
+    return tmpp;
+}
+
+void
+netsnmp_free_cachemap(netsnmp_cachemap *cache_store)
+{
+    netsnmp_cachemap *tmpp;
+    while (cache_store) {
+        tmpp = cache_store;
+        cache_store = cache_store->next;
+        free(tmpp);
+    }
+}
+
+
+typedef struct agent_set_cache_s {
+    /*
+     * match on these 2 
+     */
+    int             transID;
+    netsnmp_session *sess;
+
+    /*
+     * store this info 
+     */
+    netsnmp_tree_cache *treecache;
+    int             treecache_len;
+    int             treecache_num;
+
+    int             vbcount;
+    netsnmp_request_info *requests;
+    netsnmp_data_list *agent_data;
+
+    /*
+     * list 
+     */
+    struct agent_set_cache_s *next;
+} agent_set_cache;
+
+static agent_set_cache *Sets = NULL;
+
+agent_set_cache *
+save_set_cache(netsnmp_agent_session *asp)
+{
+    agent_set_cache *ptr;
+
+    if (!asp->reqinfo || !asp->pdu)
+        return NULL;
+
+    ptr = SNMP_MALLOC_TYPEDEF(agent_set_cache);
+    if (ptr == NULL)
+        return NULL;
+
+    /*
+     * Save the important information 
+     */
+    ptr->transID = asp->pdu->transid;
+    ptr->sess = asp->session;
+    ptr->treecache = asp->treecache;
+    ptr->treecache_len = asp->treecache_len;
+    ptr->treecache_num = asp->treecache_num;
+    ptr->agent_data = asp->reqinfo->agent_data;
+    ptr->requests = asp->requests;
+    ptr->vbcount = asp->vbcount;
+
+    /*
+     * make the agent forget about what we've saved 
+     */
+    asp->treecache = NULL;
+    asp->reqinfo->agent_data = NULL;
+    asp->pdu->variables = NULL;
+    asp->requests = NULL;
+
+    ptr->next = Sets;
+    Sets = ptr;
+
+    return ptr;
+}
+
+int
+get_set_cache(netsnmp_agent_session *asp)
+{
+    agent_set_cache *ptr, *prev = NULL;
+
+    for (ptr = Sets; ptr != NULL; ptr = ptr->next) {
+        if (ptr->sess == asp->session && ptr->transID == asp->pdu->transid) {
+            if (prev)
+                prev->next = ptr->next;
+            else
+                Sets = ptr->next;
+
+            /*
+             * found it.  Get the needed data 
+             */
+            asp->treecache = ptr->treecache;
+            asp->treecache_len = ptr->treecache_len;
+            asp->treecache_num = ptr->treecache_num;
+            asp->requests = ptr->requests;
+            asp->vbcount = ptr->vbcount;
+            if (!asp->reqinfo) {
+                asp->reqinfo =
+                    SNMP_MALLOC_TYPEDEF(netsnmp_agent_request_info);
+                if (asp->reqinfo) {
+                    asp->reqinfo->asp = asp;
+                    asp->reqinfo->agent_data = ptr->agent_data;
+                }
+            }
+            free(ptr);
+            return SNMP_ERR_NOERROR;
+        }
+        prev = ptr;
+    }
+    return SNMP_ERR_GENERR;
+}
+
+int
+getNextSessID()
+{
+    static int      SessionID = 0;
+
+    return ++SessionID;
+}
+
+int
+agent_check_and_process(int block)
+{
+    int             numfds;
+    fd_set          fdset;
+    struct timeval  timeout = { LONG_MAX, 0 }, *tvp = &timeout;
+    int             count;
+    int             fakeblock = 0;
+
+    numfds = 0;
+    FD_ZERO(&fdset);
+    snmp_select_info(&numfds, &fdset, tvp, &fakeblock);
+    if (block != 0 && fakeblock != 0) {
+        /*
+         * There are no alarms registered, and the caller asked for blocking, so
+         * let select() block forever.  
+         */
+
+        tvp = NULL;
+    } else if (block != 0 && fakeblock == 0) {
+        /*
+         * The caller asked for blocking, but there is an alarm due sooner than
+         * LONG_MAX seconds from now, so use the modified timeout returned by
+         * snmp_select_info as the timeout for select().  
+         */
+
+    } else if (block == 0) {
+        /*
+         * The caller does not want us to block at all.  
+         */
+
+        tvp->tv_sec = 0;
+        tvp->tv_usec = 0;
+    }
+
+    count = select(numfds, &fdset, 0, 0, tvp);
+
+    if (count > 0) {
+        /*
+         * packets found, process them 
+         */
+        snmp_read(&fdset);
+    } else
+        switch (count) {
+        case 0:
+            snmp_timeout();
+            break;
+        case -1:
+            if (errno != EINTR) {
+                snmp_log_perror("select");
+            }
+            return -1;
+        default:
+            snmp_log(LOG_ERR, "select returned %d\n", count);
+            return -1;
+        }                       /* endif -- count>0 */
+
+    /*
+     * Run requested alarms.  
+     */
+    run_alarms();
+
+    return count;
+}
+
+
+
+/*
+ * Set up the address cache.  
+ */
+void
+netsnmp_addrcache_initialise(void)
+{
+    int             i = 0;
+
+    for (i = 0; i < SNMP_ADDRCACHE_SIZE; i++) {
+        addrCache[i].addr = NULL;
+        addrCache[i].status = SNMP_ADDRCACHE_UNUSED;
+    }
+}
+
+
+
+/*
+ * Age the entries in the address cache.  
+ */
+
+void
+netsnmp_addrcache_age(void)
+{
+    int             i = 0;
+
+    lastAddrAge = 0;
+    for (i = 0; i < SNMP_ADDRCACHE_SIZE; i++) {
+        if (addrCache[i].status == SNMP_ADDRCACHE_OLD) {
+            addrCache[i].status = SNMP_ADDRCACHE_UNUSED;
+            if (addrCache[i].addr != NULL) {
+                free(addrCache[i].addr);
+                addrCache[i].addr = NULL;
+            }
+        }
+        if (addrCache[i].status == SNMP_ADDRCACHE_USED) {
+            addrCache[i].status = SNMP_ADDRCACHE_OLD;
+        }
+    }
+}
+
+/*******************************************************************-o-******
+ * netsnmp_agent_check_packet
+ *
+ * Parameters:
+ *	session, transport, transport_data, transport_data_length
+ *      
+ * Returns:
+ *	1	On success.
+ *	0	On error.
+ *
+ * Handler for all incoming messages (a.k.a. packets) for the agent.  If using
+ * the libwrap utility, log the connection and deny/allow the access. Print
+ * output when appropriate, and increment the incoming counter.
+ *
+ */
+
+int
+netsnmp_agent_check_packet(netsnmp_session * session,
+                           netsnmp_transport *transport,
+                           void *transport_data, int transport_data_length)
+{
+    char           *addr_string = NULL;
+    int             i = 0;
+
+    /*
+     * Log the message and/or dump the message.
+     * Optionally cache the network address of the sender.
+     */
+
+    if (transport != NULL && transport->f_fmtaddr != NULL) {
+        /*
+         * Okay I do know how to format this address for logging.  
+         */
+        addr_string = transport->f_fmtaddr(transport, transport_data,
+                                           transport_data_length);
+        /*
+         * Don't forget to free() it.  
+         */
+    }
+#ifdef  USE_LIBWRAP
+    if (addr_string != NULL) {
+        if (hosts_ctl("snmpd", STRING_UNKNOWN, addr_string, STRING_UNKNOWN)) {
+            snmp_log(allow_severity, "Connection from %s\n", addr_string);
+        } else {
+            snmp_log(deny_severity, "Connection from %s REFUSED\n",
+                     addr_string);
+            free(addr_string);
+            return 0;
+        }
+    } else {
+        if (hosts_ctl("snmp", STRING_UNKNOWN, STRING_UNKNOWN, STRING_UNKNOWN)){
+            snmp_log(allow_severity, "Connection from <UNKNOWN>\n");
+            addr_string = strdup("<UNKNOWN>");
+        } else {
+            snmp_log(deny_severity, "Connection from <UNKNOWN> REFUSED\n");
+            return 0;
+        }
+    }
+#endif                          /*USE_LIBWRAP */
+
+    snmp_increment_statistic(STAT_SNMPINPKTS);
+
+    if (log_addresses || netsnmp_ds_get_boolean(NETSNMP_DS_APPLICATION_ID, 
+						NETSNMP_DS_AGENT_VERBOSE)) {
+        for (i = 0; i < SNMP_ADDRCACHE_SIZE; i++) {
+            if ((addrCache[i].status != SNMP_ADDRCACHE_UNUSED) &&
+                (strcmp(addrCache[i].addr, addr_string) == 0)) {
+                break;
+            }
+        }
+
+        if (i >= SNMP_ADDRCACHE_SIZE ||
+	    netsnmp_ds_get_boolean(NETSNMP_DS_APPLICATION_ID, 
+				   NETSNMP_DS_AGENT_VERBOSE)) {
+            /*
+             * Address wasn't in the cache, so log the packet...  
+             */
+            snmp_log(LOG_INFO, "Received SNMP packet(s) from %s\n",
+                     addr_string);
+            /*
+             * ...and try to cache the address.  
+             */
+            for (i = 0; i < SNMP_ADDRCACHE_SIZE; i++) {
+                if (addrCache[i].status == SNMP_ADDRCACHE_UNUSED) {
+                    if (addrCache[i].addr != NULL) {
+                        free(addrCache[i].addr);
+                    }
+                    addrCache[i].addr = addr_string;
+                    addrCache[i].status = SNMP_ADDRCACHE_USED;
+                    addr_string = NULL; /* Don't free this 'temporary' string
+                                         * since it's now part of the cache */
+                    break;
+                }
+            }
+            if (i >= SNMP_ADDRCACHE_SIZE) {
+                /*
+                 * We didn't find a free slot to cache the address.  Perhaps
+                 * we should be using an LRU replacement policy here or
+                 * something.  Oh well.
+                 */
+                DEBUGMSGTL(("netsnmp_agent_check_packet",
+                            "cache overrun"));
+            }
+        } else {
+            addrCache[i].status = SNMP_ADDRCACHE_USED;
+        }
+    }
+
+    if (addr_string != NULL) {
+        free(addr_string);
+        addr_string = NULL;
+    }
+    return 1;
+}
+
+
+int
+netsnmp_agent_check_parse(netsnmp_session * session, netsnmp_pdu *pdu,
+                          int result)
+{
+    if (result == 0) {
+        if (snmp_get_do_logging() &&
+	    netsnmp_ds_get_boolean(NETSNMP_DS_APPLICATION_ID, 
+				   NETSNMP_DS_AGENT_VERBOSE)) {
+            netsnmp_variable_list *var_ptr;
+
+            switch (pdu->command) {
+            case SNMP_MSG_GET:
+                snmp_log(LOG_DEBUG, "  GET message\n");
+                break;
+            case SNMP_MSG_GETNEXT:
+                snmp_log(LOG_DEBUG, "  GETNEXT message\n");
+                break;
+            case SNMP_MSG_RESPONSE:
+                snmp_log(LOG_DEBUG, "  RESPONSE message\n");
+                break;
+            case SNMP_MSG_SET:
+                snmp_log(LOG_DEBUG, "  SET message\n");
+                break;
+            case SNMP_MSG_TRAP:
+                snmp_log(LOG_DEBUG, "  TRAP message\n");
+                break;
+            case SNMP_MSG_GETBULK:
+                snmp_log(LOG_DEBUG, "  GETBULK message, non-rep=%d, max_rep=%d\n",
+                         pdu->errstat, pdu->errindex);
+                break;
+            case SNMP_MSG_INFORM:
+                snmp_log(LOG_DEBUG, "  INFORM message\n");
+                break;
+            case SNMP_MSG_TRAP2:
+                snmp_log(LOG_DEBUG, "  TRAP2 message\n");
+                break;
+            case SNMP_MSG_REPORT:
+                snmp_log(LOG_DEBUG, "  REPORT message\n");
+                break;
+
+            case SNMP_MSG_INTERNAL_SET_RESERVE1:
+                snmp_log(LOG_DEBUG, "  INTERNAL RESERVE1 message\n");
+                break;
+
+            case SNMP_MSG_INTERNAL_SET_RESERVE2:
+                snmp_log(LOG_DEBUG, "  INTERNAL RESERVE2 message\n");
+                break;
+
+            case SNMP_MSG_INTERNAL_SET_ACTION:
+                snmp_log(LOG_DEBUG, "  INTERNAL ACTION message\n");
+                break;
+
+            case SNMP_MSG_INTERNAL_SET_COMMIT:
+                snmp_log(LOG_DEBUG, "  INTERNAL COMMIT message\n");
+                break;
+
+            case SNMP_MSG_INTERNAL_SET_FREE:
+                snmp_log(LOG_DEBUG, "  INTERNAL FREE message\n");
+                break;
+
+            case SNMP_MSG_INTERNAL_SET_UNDO:
+                snmp_log(LOG_DEBUG, "  INTERNAL UNDO message\n");
+                break;
+
+            default:
+                snmp_log(LOG_DEBUG, "  UNKNOWN message, type=%02X\n",
+                         pdu->command);
+                snmp_increment_statistic(STAT_SNMPINASNPARSEERRS);
+                return 0;
+            }
+
+            for (var_ptr = pdu->variables; var_ptr != NULL;
+                 var_ptr = var_ptr->next_variable) {
+                size_t          c_oidlen = 256, c_outlen = 0;
+                u_char         *c_oid = (u_char *) malloc(c_oidlen);
+
+                if (c_oid) {
+                    if (!sprint_realloc_objid
+                        (&c_oid, &c_oidlen, &c_outlen, 1, var_ptr->name,
+                         var_ptr->name_length)) {
+                        snmp_log(LOG_DEBUG, "    -- %s [TRUNCATED]\n",
+                                 c_oid);
+                    } else {
+                        snmp_log(LOG_DEBUG, "    -- %s\n", c_oid);
+                    }
+                    free(c_oid);
+                }
+            }
+        }
+        return 1;
+    }
+    return 0;                   /* XXX: does it matter what the return value
+                                 * is?  Yes: if we return 0, then the PDU is
+                                 * dumped.  */
+}
+
+
+/*
+ * Global access to the primary session structure for this agent.
+ * for Index Allocation use initially. 
+ */
+
+/*
+ * I don't understand what this is for at the moment.  AFAICS as long as it
+ * gets set and points at a session, that's fine.  ???  
+ */
+
+netsnmp_session *main_session = NULL;
+
+
+
+/*
+ * Set up an agent session on the given transport.  Return a handle
+ * which may later be used to de-register this transport.  A return
+ * value of -1 indicates an error.  
+ */
+
+int
+netsnmp_register_agent_nsap(netsnmp_transport *t)
+{
+    netsnmp_session *s, *sp = NULL;
+    agent_nsap     *a = NULL, *n = NULL, **prevNext = &agent_nsap_list;
+    int             handle = 0;
+    void           *isp = NULL;
+
+    if (t == NULL) {
+        return -1;
+    }
+
+    DEBUGMSGTL(("netsnmp_register_agent_nsap", "fd %d\n", t->sock));
+
+    n = (agent_nsap *) malloc(sizeof(agent_nsap));
+    if (n == NULL) {
+        return -1;
+    }
+    s = (netsnmp_session *) malloc(sizeof(netsnmp_session));
+    if (s == NULL) {
+        free(n);
+        return -1;
+    }
+    memset(s, 0, sizeof(netsnmp_session));
+    snmp_sess_init(s);
+
+    /*
+     * Set up the session appropriately for an agent.  
+     */
+
+    s->version = SNMP_DEFAULT_VERSION;
+    s->callback = handle_snmp_packet;
+    s->authenticator = NULL;
+    s->flags = netsnmp_ds_get_int(NETSNMP_DS_APPLICATION_ID, 
+				  NETSNMP_DS_AGENT_FLAGS);
+    s->isAuthoritative = SNMP_SESS_AUTHORITATIVE;
+
+    sp = snmp_add(s, t, netsnmp_agent_check_packet,
+                  netsnmp_agent_check_parse);
+    if (sp == NULL) {
+        free(s);
+        free(n);
+        return -1;
+    }
+
+    isp = snmp_sess_pointer(sp);
+    if (isp == NULL) {          /*  over-cautious  */
+        free(s);
+        free(n);
+        return -1;
+    }
+
+    n->s = isp;
+    n->t = t;
+
+    if (main_session == NULL) {
+        main_session = snmp_sess_session(isp);
+    }
+
+    for (a = agent_nsap_list; a != NULL && handle + 1 >= a->handle;
+         a = a->next) {
+        handle = a->handle;
+        prevNext = &(a->next);
+    }
+
+    if (handle < INT_MAX) {
+        n->handle = handle + 1;
+        n->next = a;
+        *prevNext = n;
+        free(s);
+        return n->handle;
+    } else {
+        free(s);
+        free(n);
+        return -1;
+    }
+}
+
+void
+netsnmp_deregister_agent_nsap(int handle)
+{
+    agent_nsap     *a = NULL, **prevNext = &agent_nsap_list;
+    int             main_session_deregistered = 0;
+
+    DEBUGMSGTL(("netsnmp_deregister_agent_nsap", "handle %d\n", handle));
+
+    for (a = agent_nsap_list; a != NULL && a->handle < handle; a = a->next) {
+        prevNext = &(a->next);
+    }
+
+    if (a != NULL && a->handle == handle) {
+        *prevNext = a->next;
+        if (main_session == snmp_sess_session(a->s)) {
+            main_session_deregistered = 1;
+        }
+        snmp_close(snmp_sess_session(a->s));
+        /*
+         * The above free()s the transport and session pointers.  
+         */
+        free(a);
+    }
+
+    /*
+     * If we've deregistered the session that main_session used to point to,
+     * then make it point to another one, or in the last resort, make it equal
+     * to NULL.  Basically this shouldn't ever happen in normal operation
+     * because main_session starts off pointing at the first session added by
+     * init_master_agent(), which then discards the handle.  
+     */
+
+    if (main_session_deregistered) {
+        if (agent_nsap_list != NULL) {
+            DEBUGMSGTL(("snmp_agent",
+			"WARNING: main_session ptr changed from %p to %p\n",
+                        main_session, snmp_sess_session(agent_nsap_list->s)));
+            main_session = snmp_sess_session(agent_nsap_list->s);
+        } else {
+            DEBUGMSGTL(("snmp_agent",
+			"WARNING: main_session ptr changed from %p to NULL\n",
+                        main_session));
+            main_session = NULL;
+        }
+    }
+}
+
+
+
+/*
+ * 
+ * This function has been modified to use the experimental
+ * netsnmp_register_agent_nsap interface.  The major responsibility of this
+ * function now is to interpret a string specified to the agent (via -p on the
+ * command line, or from a configuration file) as a list of agent NSAPs on
+ * which to listen for SNMP packets.  Typically, when you add a new transport
+ * domain "foo", you add code here such that if the "foo" code is compiled
+ * into the agent (SNMP_TRANSPORT_FOO_DOMAIN is defined), then a token of the
+ * form "foo:bletch-3a0054ef%wob&wob" gets turned into the appropriate
+ * transport descriptor.  netsnmp_register_agent_nsap is then called with that
+ * transport descriptor and sets up a listening agent session on it.
+ * 
+ * Everything then works much as normal: the agent runs in an infinite loop
+ * (in the snmpd.c/receive()routine), which calls snmp_read() when a request
+ * is readable on any of the given transports.  This routine then traverses
+ * the library 'Sessions' list to identify the relevant session and eventually
+ * invokes '_sess_read'.  This then processes the incoming packet, calling the
+ * pre_parse, parse, post_parse and callback routines in turn.
+ * 
+ * JBPN 20001117
+ */
+
+int
+init_master_agent(void)
+{
+    netsnmp_transport *transport;
+    char           *cptr;
+    char            buf[SPRINT_MAX_LEN];
+
+    /* default to turning off lookup caching */
+    netsnmp_set_lookup_cache_size(0);
+
+    if (netsnmp_ds_get_boolean(NETSNMP_DS_APPLICATION_ID, 
+			       NETSNMP_DS_AGENT_ROLE) != MASTER_AGENT) {
+        DEBUGMSGTL(("snmp_agent",
+                    "init_master_agent; not master agent\n"));
+        return 0;               /*  No error if ! MASTER_AGENT  */
+    }
+#ifdef USING_AGENTX_MASTER_MODULE
+    if (netsnmp_ds_get_boolean(NETSNMP_DS_APPLICATION_ID, 
+			       NETSNMP_DS_AGENT_AGENTX_MASTER) == 1)
+        real_init_master();
+#endif
+
+    /*
+     * Have specific agent ports been specified?  
+     */
+    cptr = netsnmp_ds_get_string(NETSNMP_DS_APPLICATION_ID, 
+				 NETSNMP_DS_AGENT_PORTS);
+
+    if (cptr) {
+        snprintf(buf, sizeof(buf), "%s", cptr);
+        buf[ sizeof(buf)-1 ] = 0;
+    } else {
+        /*
+         * No, so just specify the default port.  
+         */
+        if (netsnmp_ds_get_int(NETSNMP_DS_APPLICATION_ID, NETSNMP_DS_AGENT_FLAGS) & SNMP_FLAGS_STREAM_SOCKET) {
+            sprintf(buf, "tcp:%d", SNMP_PORT);
+        } else {
+            sprintf(buf, "udp:%d", SNMP_PORT);
+        }
+    }
+
+    DEBUGMSGTL(("snmp_agent", "final port spec: %s\n", buf));
+    cptr = strtok(buf, ",");
+    while (cptr) {
+        /*
+         * Specification format: 
+         * 
+         * NONE:                      (a pseudo-transport)
+         * UDP:[address:]port        (also default if no transport is specified)
+         * TCP:[address:]port         (if supported)
+         * Unix:pathname              (if supported)
+         * AAL5PVC:itf.vpi.vci        (if supported)
+         * IPX:[network]:node[/port] (if supported)
+         * 
+         */
+
+        DEBUGMSGTL(("snmp_agent", "installing master agent on port %s\n",
+                    cptr));
+
+        if (!cptr || !(*cptr)) {
+            snmp_log(LOG_ERR, "improper port specification\n");
+            return 1;
+        }
+
+        if (strncasecmp(cptr, "none", 4) == 0) {
+            DEBUGMSGTL(("snmp_agent",
+                        "init_master_agent; pseudo-transport \"none\" requested\n"));
+            return 0;
+        }
+        transport = netsnmp_tdomain_transport(cptr, 1, "udp");
+
+        if (transport == NULL) {
+            snmp_log(LOG_ERR, "Error opening specified endpoint \"%s\"\n",
+                     cptr);
+            return 1;
+        }
+
+        if (netsnmp_register_agent_nsap(transport) == 0) {
+            snmp_log(LOG_ERR,
+                     "Error registering specified transport \"%s\" as an agent NSAP\n",
+                     cptr);
+            return 1;
+        } else {
+            DEBUGMSGTL(("snmp_agent",
+                        "init_master_agent; \"%s\" registered as an agent NSAP\n",
+                        cptr));
+        }
+
+        /*
+         * Next transport please...  
+         */
+        cptr = strtok(NULL, ",");
+    }
+
+    return 0;
+}
+
+
+
+netsnmp_agent_session *
+init_agent_snmp_session(netsnmp_session * session, netsnmp_pdu *pdu)
+{
+    netsnmp_agent_session *asp = (netsnmp_agent_session *)
+        calloc(1, sizeof(netsnmp_agent_session));
+
+    if (asp == NULL) {
+        return NULL;
+    }
+
+    DEBUGMSGTL(("snmp_agent","agent_sesion %08p created\n", asp));
+    asp->session = session;
+    asp->pdu = snmp_clone_pdu(pdu);
+    asp->orig_pdu = snmp_clone_pdu(pdu);
+    asp->rw = READ;
+    asp->exact = TRUE;
+    asp->next = NULL;
+    asp->mode = RESERVE1;
+    asp->status = SNMP_ERR_NOERROR;
+    asp->index = 0;
+    asp->oldmode = 0;
+    asp->treecache_num = -1;
+    asp->treecache_len = 0;
+
+    return asp;
+}
+
+void
+free_agent_snmp_session(netsnmp_agent_session *asp)
+{
+    if (!asp)
+        return;
+
+    DEBUGMSGTL(("snmp_agent","agent_sesion %08p released\n", asp));
+
+    netsnmp_remove_from_delegated(asp);
+    
+    if (asp->orig_pdu)
+        snmp_free_pdu(asp->orig_pdu);
+    if (asp->pdu)
+        snmp_free_pdu(asp->pdu);
+    if (asp->reqinfo)
+        netsnmp_free_agent_request_info(asp->reqinfo);
+    if (asp->treecache) {
+        free(asp->treecache);
+    }
+    if (asp->bulkcache) {
+        free(asp->bulkcache);
+    }
+    if (asp->requests) {
+        int             i;
+        for (i = 0; i < asp->vbcount; i++) {
+            netsnmp_free_request_data_sets(&asp->requests[i]);
+        }
+    }
+    if (asp->requests) {
+        free(asp->requests);
+    }
+    if (asp->cache_store) {
+        netsnmp_free_cachemap(asp->cache_store);
+        asp->cache_store = NULL;
+    }
+    free(asp);
+}
+
+int
+netsnmp_check_for_delegated(netsnmp_agent_session *asp)
+{
+    int             i;
+    netsnmp_request_info *request;
+
+    if (NULL == asp->treecache)
+        return 0;
+    
+    for (i = 0; i <= asp->treecache_num; i++) {
+        for (request = asp->treecache[i].requests_begin; request;
+             request = request->next) {
+            if (request->delegated)
+                return 1;
+        }
+    }
+    return 0;
+}
+
+int
+netsnmp_check_delegated_chain_for(netsnmp_agent_session *asp)
+{
+    netsnmp_agent_session *asptmp;
+    for (asptmp = agent_delegated_list; asptmp; asptmp = asptmp->next) {
+        if (asptmp == asp)
+            return 1;
+    }
+    return 0;
+}
+
+int
+netsnmp_check_for_delegated_and_add(netsnmp_agent_session *asp)
+{
+    if (netsnmp_check_for_delegated(asp)) {
+        if (!netsnmp_check_delegated_chain_for(asp)) {
+            /*
+             * add to delegated request chain 
+             */
+            asp->next = agent_delegated_list;
+            agent_delegated_list = asp;
+            DEBUGMSGTL(("snmp_agent", "delegate session == %08p\n", asp));
+        }
+        return 1;
+    }
+    return 0;
+}
+
+int
+netsnmp_remove_from_delegated(netsnmp_agent_session *asp)
+{
+    netsnmp_agent_session *curr, *prev = NULL;
+    
+    for (curr = agent_delegated_list; curr; prev = curr, curr = curr->next) {
+        /*
+         * is this us?
+         */
+        if (curr != asp)
+            continue;
+        
+        /*
+         * remove from queue 
+         */
+        if (prev != NULL)
+            prev->next = asp->next;
+        else
+            agent_delegated_list = asp->next;
+
+        DEBUGMSGTL(("snmp_agent", "remove delegated session == %08p\n", asp));
+
+        return 1;
+    }
+
+    return 0;
+}
+
+/*
+ * netsnmp_remove_delegated_requests_for_session
+ *
+ * called when a session is being closed. Check all delegated requests to
+ * see if the are waiting on this session, and if set, set the status for
+ * that request to GENERR.
+ */
+int
+netsnmp_remove_delegated_requests_for_session(netsnmp_session *sess)
+{
+    netsnmp_agent_session *asp;
+    int count = 0;
+    
+    for (asp = agent_delegated_list; asp; asp = asp->next) {
+        /*
+         * check each request
+         */
+        netsnmp_request_info *request;
+        for(request = asp->requests; request; request = request->next) {
+            /*
+             * check session
+             */
+            netsnmp_assert(NULL!=request->subtree);
+            if(request->subtree->session != sess)
+                continue;
+
+            /*
+             * matched! mark request as done
+             */
+            netsnmp_set_mode_request_error(MODE_SET_BEGIN, request,
+                                           SNMP_ERR_GENERR);
+            ++count;
+        }
+    }
+
+    /*
+     * if we found any, that request may be finished now
+     */
+    if(count) {
+        DEBUGMSGTL(("snmp_agent", "removed %d delegated request(s) for session "
+                    "%08p\n", count, sess));
+        netsnmp_check_outstanding_agent_requests();
+    }
+    
+    return count;
+}
+
+int
+netsnmp_check_queued_chain_for(netsnmp_agent_session *asp)
+{
+    netsnmp_agent_session *asptmp;
+    for (asptmp = netsnmp_agent_queued_list; asptmp; asptmp = asptmp->next) {
+        if (asptmp == asp)
+            return 1;
+    }
+    return 0;
+}
+
+int
+netsnmp_add_queued(netsnmp_agent_session *asp)
+{
+    netsnmp_agent_session *asp_tmp;
+
+    /*
+     * first item?
+     */
+    if (NULL == netsnmp_agent_queued_list) {
+        netsnmp_agent_queued_list = asp;
+        return 1;
+    }
+
+
+    /*
+     * add to end of queued request chain 
+     */
+    asp_tmp = netsnmp_agent_queued_list;
+    for (; asp_tmp; asp_tmp = asp_tmp->next) {
+        /*
+         * already in queue?
+         */
+        if (asp_tmp == asp)
+            break;
+
+        /*
+         * end of queue?
+         */
+        if (NULL == asp_tmp->next)
+            asp_tmp->next = asp;
+    }
+    return 1;
+}
+
+
+int
+netsnmp_wrap_up_request(netsnmp_agent_session *asp, int status)
+{
+    netsnmp_variable_list *var_ptr;
+    int             i, n = 0, r = 0;
+
+    /*
+     * if this request was a set, clear the global now that we are
+     * done.
+     */
+    if (asp == netsnmp_processing_set) {
+        DEBUGMSGTL(("snmp_agent", "SET request complete, asp = %08p\n",
+                    asp));
+        netsnmp_processing_set = NULL;
+    }
+
+    /*
+     * some stuff needs to be saved in special subagent cases 
+     */
+    if (asp->pdu) {
+
+        switch (asp->pdu->command) {
+            case SNMP_MSG_INTERNAL_SET_BEGIN:
+            case SNMP_MSG_INTERNAL_SET_RESERVE1:
+            case SNMP_MSG_INTERNAL_SET_RESERVE2:
+            case SNMP_MSG_INTERNAL_SET_ACTION:
+                save_set_cache(asp);
+                break;
+        }
+
+        /*
+         * if this is a GETBULK response we need to rearrange the varbinds 
+         */
+        if (asp->pdu->command == SNMP_MSG_GETBULK) {
+            int             repeats = asp->pdu->errindex;
+            int             j;
+            
+            if (asp->pdu->errstat < asp->vbcount) {
+                n = asp->pdu->errstat;
+            } else {
+                n = asp->vbcount;
+            }
+            if ((r = asp->vbcount - n) < 0) {
+                r = 0;
+            }
+            
+            for (i = 0; i < r - 1; i++) {
+                for (j = 0; j < repeats; j++) {
+                    asp->bulkcache[i * repeats + j]->next_variable =
+                        asp->bulkcache[(i + 1) * repeats + j];
+                }
+            }
+            if (r > 0) {
+                for (j = 0; j < repeats - 1; j++) {
+                    asp->bulkcache[(r - 1) * repeats + j]->next_variable =
+                        asp->bulkcache[j + 1];
+                }
+            }
+        }
+
+        /*
+         * May need to "dumb down" a SET error status for a
+         * v1 query.  See RFC2576 - section 4.3
+         */
+        if ((asp->pdu->command == SNMP_MSG_SET) &&
+            (asp->pdu->version == SNMP_VERSION_1)) {
+            switch (status) {
+                case SNMP_ERR_WRONGVALUE:
+                case SNMP_ERR_WRONGENCODING:
+                case SNMP_ERR_WRONGTYPE:
+                case SNMP_ERR_WRONGLENGTH:
+                case SNMP_ERR_INCONSISTENTVALUE:
+                    status = SNMP_ERR_BADVALUE;
+                    asp->status = SNMP_ERR_BADVALUE;
+                    break;
+                case SNMP_ERR_NOACCESS:
+                case SNMP_ERR_NOTWRITABLE:
+                case SNMP_ERR_NOCREATION:
+                case SNMP_ERR_INCONSISTENTNAME:
+                case SNMP_ERR_AUTHORIZATIONERROR:
+                    status = SNMP_ERR_NOSUCHNAME;
+                    asp->status = SNMP_ERR_NOSUCHNAME;
+                    break;
+                case SNMP_ERR_RESOURCEUNAVAILABLE:
+                case SNMP_ERR_COMMITFAILED:
+                case SNMP_ERR_UNDOFAILED:
+                    status = SNMP_ERR_GENERR;
+                    asp->status = SNMP_ERR_GENERR;
+                    break;
+            }
+        }
+        /*
+         * Similarly we may need to "dumb down" v2 exception
+         *  types to throw an error for a v1 query.
+         *  See RFC2576 - section 4.1.2.3
+         */
+        if ((asp->pdu->command != SNMP_MSG_SET) &&
+            (asp->pdu->version == SNMP_VERSION_1)) {
+            for (var_ptr = asp->pdu->variables, i = 1;
+                 var_ptr != NULL; var_ptr = var_ptr->next_variable, i++) {
+                switch (var_ptr->type) {
+                    case SNMP_NOSUCHOBJECT:
+                    case SNMP_NOSUCHINSTANCE:
+                    case SNMP_ENDOFMIBVIEW:
+                    case ASN_COUNTER64:
+                        status = SNMP_ERR_NOSUCHNAME;
+                        asp->status = SNMP_ERR_NOSUCHNAME;
+                        asp->index = i;
+                        break;
+                }
+            }
+        }
+    } /** if asp->pdu */
+
+    /*
+     * Update the snmp error-count statistics
+     *   XXX - should we include the V2 errors in this or not?
+     */
+#define INCLUDE_V2ERRORS_IN_V1STATS
+
+    switch (status) {
+#ifdef INCLUDE_V2ERRORS_IN_V1STATS
+    case SNMP_ERR_WRONGVALUE:
+    case SNMP_ERR_WRONGENCODING:
+    case SNMP_ERR_WRONGTYPE:
+    case SNMP_ERR_WRONGLENGTH:
+    case SNMP_ERR_INCONSISTENTVALUE:
+#endif
+    case SNMP_ERR_BADVALUE:
+        snmp_increment_statistic(STAT_SNMPOUTBADVALUES);
+        break;
+#ifdef INCLUDE_V2ERRORS_IN_V1STATS
+    case SNMP_ERR_NOACCESS:
+    case SNMP_ERR_NOTWRITABLE:
+    case SNMP_ERR_NOCREATION:
+    case SNMP_ERR_INCONSISTENTNAME:
+    case SNMP_ERR_AUTHORIZATIONERROR:
+#endif
+    case SNMP_ERR_NOSUCHNAME:
+        snmp_increment_statistic(STAT_SNMPOUTNOSUCHNAMES);
+        break;
+#ifdef INCLUDE_V2ERRORS_IN_V1STATS
+    case SNMP_ERR_RESOURCEUNAVAILABLE:
+    case SNMP_ERR_COMMITFAILED:
+    case SNMP_ERR_UNDOFAILED:
+#endif
+    case SNMP_ERR_GENERR:
+        snmp_increment_statistic(STAT_SNMPOUTGENERRS);
+        break;
+
+    case SNMP_ERR_TOOBIG:
+        snmp_increment_statistic(STAT_SNMPOUTTOOBIGS);
+        break;
+    }
+
+    if ((status == SNMP_ERR_NOERROR) && (asp->pdu)) {
+        snmp_increment_statistic_by((asp->pdu->command == SNMP_MSG_SET ?
+                                     STAT_SNMPINTOTALSETVARS :
+                                     STAT_SNMPINTOTALREQVARS),
+                                    count_varbinds(asp->pdu->variables));
+    } else {
+        /*
+         * Use a copy of the original request
+         *   to report failures.
+         */
+        snmp_free_pdu(asp->pdu);
+        asp->pdu = asp->orig_pdu;
+        asp->orig_pdu = NULL;
+    }
+    if (asp->pdu) {
+        asp->pdu->command = SNMP_MSG_RESPONSE;
+        asp->pdu->errstat = asp->status;
+        asp->pdu->errindex = asp->index;
+        if (!snmp_send(asp->session, asp->pdu)) {
+            snmp_free_pdu(asp->pdu);
+            asp->pdu = NULL;
+        }
+        snmp_increment_statistic(STAT_SNMPOUTPKTS);
+        snmp_increment_statistic(STAT_SNMPOUTGETRESPONSES);
+        asp->pdu = NULL;
+        netsnmp_remove_and_free_agent_snmp_session(asp);
+    }
+    return 1;
+}
+
+void
+dump_sess_list(void)
+{
+    netsnmp_agent_session *a;
+
+    DEBUGMSGTL(("snmp_agent", "DUMP agent_sess_list -> "));
+    for (a = agent_session_list; a != NULL; a = a->next) {
+        DEBUGMSG(("snmp_agent", "%08p[session %08p] -> ", a, a->session));
+    }
+    DEBUGMSG(("snmp_agent", "[NIL]\n"));
+}
+
+void
+netsnmp_remove_and_free_agent_snmp_session(netsnmp_agent_session *asp)
+{
+    netsnmp_agent_session *a, **prevNext = &agent_session_list;
+
+    DEBUGMSGTL(("snmp_agent", "REMOVE session == %08p\n", asp));
+
+    for (a = agent_session_list; a != NULL; a = *prevNext) {
+        if (a == asp) {
+            *prevNext = a->next;
+            a->next = NULL;
+            free_agent_snmp_session(a);
+            asp = NULL;
+            break;
+        } else {
+            prevNext = &(a->next);
+        }
+    }
+
+    if (a == NULL && asp != NULL) {
+        /*
+         * We coulnd't find it on the list, so free it anyway.  
+         */
+        free_agent_snmp_session(asp);
+    }
+}
+
+void
+netsnmp_free_agent_snmp_session_by_session(netsnmp_session * sess,
+                                           void (*free_request)
+                                           (netsnmp_request_list *))
+{
+    netsnmp_agent_session *a, *next, **prevNext = &agent_session_list;
+
+    DEBUGMSGTL(("snmp_agent", "REMOVE session == %08p\n", sess));
+
+    for (a = agent_session_list; a != NULL; a = next) {
+        if (a->session == sess) {
+            *prevNext = a->next;
+            next = a->next;
+            free_agent_snmp_session(a);
+        } else {
+            prevNext = &(a->next);
+            next = a->next;
+        }
+    }
+}
+
+/** handles an incoming SNMP packet into the agent */
+int
+handle_snmp_packet(int op, netsnmp_session * session, int reqid,
+                   netsnmp_pdu *pdu, void *magic)
+{
+    netsnmp_agent_session *asp;
+    int             status, access_ret, rc;
+
+    /*
+     * We only support receiving here.  
+     */
+    if (op != NETSNMP_CALLBACK_OP_RECEIVED_MESSAGE) {
+        return 1;
+    }
+
+    /*
+     * RESPONSE messages won't get this far, but TRAP-like messages
+     * might.  
+     */
+    if (pdu->command == SNMP_MSG_TRAP || pdu->command == SNMP_MSG_INFORM ||
+        pdu->command == SNMP_MSG_TRAP2) {
+        DEBUGMSGTL(("snmp_agent", "received trap-like PDU (%02x)\n",
+                    pdu->command));
+        pdu->command = SNMP_MSG_TRAP2;
+        snmp_increment_statistic(STAT_SNMPUNKNOWNPDUHANDLERS);
+        return 1;
+    }
+
+    if (magic == NULL) {
+        asp = init_agent_snmp_session(session, pdu);
+        status = SNMP_ERR_NOERROR;
+    } else {
+        asp = (netsnmp_agent_session *) magic;
+        status = asp->status;
+    }
+
+    if ((access_ret = check_access(pdu)) != 0) {
+        if (access_ret == VACM_NOSUCHCONTEXT) {
+            /*
+             * rfc2573 section 3.2, step 5 says that we increment the
+             * counter but don't return a response of any kind 
+             */
+
+            /*
+             * we currently don't support unavailable contexts, as
+             * there is no reason to that I currently know of 
+             */
+            snmp_increment_statistic(STAT_SNMPUNKNOWNCONTEXTS);
+
+            /*
+             * drop the request 
+             */
+            netsnmp_remove_and_free_agent_snmp_session(asp);
+            return 0;
+        } else {
+            /*
+             * access control setup is incorrect 
+             */
+            send_easy_trap(SNMP_TRAP_AUTHFAIL, 0);
+            if (asp->pdu->version != SNMP_VERSION_1
+                && asp->pdu->version != SNMP_VERSION_2c) {
+                asp->pdu->errstat = SNMP_ERR_AUTHORIZATIONERROR;
+                asp->pdu->command = SNMP_MSG_RESPONSE;
+                snmp_increment_statistic(STAT_SNMPOUTPKTS);
+                if (!snmp_send(asp->session, asp->pdu))
+                    snmp_free_pdu(asp->pdu);
+                asp->pdu = NULL;
+                netsnmp_remove_and_free_agent_snmp_session(asp);
+                return 1;
+            } else {
+                /*
+                 * drop the request 
+                 */
+                netsnmp_remove_and_free_agent_snmp_session(asp);
+                return 0;
+            }
+        }
+    }
+
+    rc = netsnmp_handle_request(asp, status);
+
+    /*
+     * done 
+     */
+    DEBUGMSGTL(("snmp_agent", "end of handle_snmp_packet, asp = %08p\n",
+                asp));
+    return rc;
+}
+
+netsnmp_request_info *
+netsnmp_add_varbind_to_cache(netsnmp_agent_session *asp, int vbcount,
+                             netsnmp_variable_list * varbind_ptr,
+                             netsnmp_subtree *tp)
+{
+    netsnmp_request_info *request = NULL;
+    int             cacheid;
+
+    DEBUGMSGTL(("snmp_agent", "add_vb_to_cache(%8p, %d, ", asp, vbcount));
+    DEBUGMSGOID(("snmp_agent", varbind_ptr->name,
+                 varbind_ptr->name_length));
+    DEBUGMSG(("snmp_agent", ", %8p)\n", tp));
+
+    if (tp &&
+        (asp->pdu->command == SNMP_MSG_GETNEXT ||
+         asp->pdu->command == SNMP_MSG_GETBULK)) {
+        int result;
+        int prefix_len;
+
+        prefix_len = netsnmp_oid_find_prefix(tp->start_a,
+                                             tp->start_len,
+                                             tp->end_a, tp->end_len);
+        result =
+            netsnmp_acm_check_subtree(asp->pdu, tp->start_a, prefix_len);
+
+        while (result == VACM_NOTINVIEW) {
+            /* the entire subtree is not in view. Skip it. */
+            /** @todo make this be more intelligent about ranges.
+                Right now we merely take the highest level
+                commonality of a registration range and use that.
+                At times we might be able to be smarter about
+                checking the range itself as opposed to the node
+                above where the range exists, but I doubt this will
+                come up all that frequently. */
+            tp = tp->next;
+            if (tp) {
+                prefix_len = netsnmp_oid_find_prefix(tp->start_a,
+                                                     tp->start_len,
+                                                     tp->end_a,
+                                                     tp->end_len);
+                result =
+                    netsnmp_acm_check_subtree(asp->pdu,
+                                              tp->start_a, prefix_len);
+            }
+            else
+                break;
+        }
+    }
+    if (tp == NULL) {
+        /*
+         * no appropriate registration found 
+         */
+        /*
+         * make up the response ourselves 
+         */
+        switch (asp->pdu->command) {
+        case SNMP_MSG_GETNEXT:
+        case SNMP_MSG_GETBULK:
+            varbind_ptr->type = SNMP_ENDOFMIBVIEW;
+            break;
+
+        case SNMP_MSG_SET:
+            varbind_ptr->type = SNMP_NOSUCHOBJECT;
+            break;
+
+        case SNMP_MSG_GET:
+            varbind_ptr->type = SNMP_NOSUCHOBJECT;
+            break;
+
+        default:
+            return NULL;        /* shouldn't get here */
+        }
+    } else {
+        DEBUGMSGTL(("snmp_agent", "tp->start "));
+        DEBUGMSGOID(("snmp_agent", tp->start_a, tp->start_len));
+        DEBUGMSG(("snmp_agent", ", tp->end "));
+        DEBUGMSGOID(("snmp_agent", tp->end_a, tp->end_len));
+        DEBUGMSG(("snmp_agent", ", \n"));
+
+        /*
+         * malloc the request structure 
+         */
+        request = &(asp->requests[vbcount - 1]);
+        request->index = vbcount;
+        request->delegated = 0;
+        request->processed = 0;
+        request->status = 0;
+        request->subtree = tp;
+        if (request->parent_data) {
+            netsnmp_free_request_data_sets(request);
+        }
+
+        /*
+         * for non-SET modes, set the type to NULL 
+         */
+        if (!MODE_IS_SET(asp->pdu->command)) {
+            if (varbind_ptr->type == ASN_PRIV_INCL_RANGE) {
+                DEBUGMSGTL(("snmp_agent", "varbind %d is inclusive\n",
+                            request->index));
+                request->inclusive = 1;
+            }
+            varbind_ptr->type = ASN_NULL;
+        }
+
+        /*
+         * place them in a cache 
+         */
+        if (tp->global_cacheid) {
+            /*
+             * we need to merge all marked subtrees together 
+             */
+            if (asp->cache_store && -1 !=
+                (cacheid = netsnmp_get_local_cachid(asp->cache_store,
+                                                    tp->global_cacheid))) {
+            } else {
+                cacheid = ++(asp->treecache_num);
+                netsnmp_get_or_add_local_cachid(&asp->cache_store,
+                                                tp->global_cacheid,
+                                                cacheid);
+                goto mallocslot;        /* XXX: ick */
+            }
+        } else if (tp->cacheid > -1 && tp->cacheid <= asp->treecache_num &&
+                   asp->treecache[tp->cacheid].subtree == tp) {
+            /*
+             * we have already added a request to this tree
+             * pointer before 
+             */
+            cacheid = tp->cacheid;
+        } else {
+            cacheid = ++(asp->treecache_num);
+          mallocslot:
+            /*
+             * new slot needed 
+             */
+            if (asp->treecache_num >= asp->treecache_len) {
+                /*
+                 * exapand cache array 
+                 */
+                /*
+                 * WWW: non-linear expansion needed (with cap) 
+                 */
+#define CACHE_GROW_SIZE 16
+                asp->treecache_len =
+                    (asp->treecache_len + CACHE_GROW_SIZE);
+                asp->treecache =
+                    realloc(asp->treecache,
+                            sizeof(netsnmp_tree_cache) *
+                            asp->treecache_len);
+                if (asp->treecache == NULL)
+                    return NULL;
+                memset(&(asp->treecache[cacheid]), 0x00,
+                       sizeof(netsnmp_tree_cache) * (CACHE_GROW_SIZE));
+            }
+            asp->treecache[cacheid].subtree = tp;
+            asp->treecache[cacheid].requests_begin = request;
+            tp->cacheid = cacheid;
+        }
+
+        /*
+         * if this is a search type, get the ending range oid as well 
+         */
+        if (asp->pdu->command == SNMP_MSG_GETNEXT ||
+            asp->pdu->command == SNMP_MSG_GETBULK) {
+            request->range_end = tp->end_a;
+            request->range_end_len = tp->end_len;
+        } else {
+            request->range_end = NULL;
+            request->range_end_len = 0;
+        }
+
+        /*
+         * link into chain 
+         */
+        if (asp->treecache[cacheid].requests_end)
+            asp->treecache[cacheid].requests_end->next = request;
+        request->next = NULL;
+        request->prev = asp->treecache[cacheid].requests_end;
+        asp->treecache[cacheid].requests_end = request;
+
+        /*
+         * add the given request to the list of requests they need
+         * to handle results for 
+         */
+        request->requestvb = request->requestvb_start = varbind_ptr;
+    }
+    return request;
+}
+
+/*
+ * check the ACM(s) for the results on each of the varbinds.
+ * If ACM disallows it, replace the value with type
+ * 
+ * Returns number of varbinds with ACM errors
+ */
+int
+check_acm(netsnmp_agent_session *asp, u_char type)
+{
+    int             view;
+    int             i, j, k;
+    netsnmp_request_info *request;
+    int             ret = 0;
+    netsnmp_variable_list *vb, *vb2, *vbc;
+    int             earliest = 0;
+
+    for (i = 0; i <= asp->treecache_num; i++) {
+        for (request = asp->treecache[i].requests_begin;
+             request; request = request->next) {
+            /*
+             * for each request, run it through in_a_view() 
+             */
+            earliest = 0;
+            for(j = request->repeat, vb = request->requestvb_start;
+                vb && j > -1;
+                j--, vb = vb->next_variable) {
+                if (vb->type != ASN_NULL &&
+                    vb->type != ASN_PRIV_RETRY) { /* not yet processed */
+                    view =
+                        in_a_view(vb->name, &vb->name_length,
+                                  asp->pdu, vb->type);
+
+                    /*
+                     * if a ACM error occurs, mark it as type passed in 
+                     */
+                    if (view != VACM_SUCCESS) {
+                        ret++;
+                        if (request->repeat < request->orig_repeat) {
+                            /* basically this means a GETBULK */
+                            request->repeat++;
+                            if (!earliest) {
+                                request->requestvb = vb;
+                                earliest = 1;
+                            }
+
+                            /* ugh.  if a whole now exists, we need to
+                               move the contents up the chain and fill
+                               in at the end else we won't end up
+                               lexographically sorted properly */
+                            if (j > -1 && vb->next_variable &&
+                                vb->next_variable->type != ASN_NULL &&
+                                vb->next_variable->type != ASN_PRIV_RETRY) {
+                                for(k = j, vbc = vb, vb2 = vb->next_variable;
+                                    k > -2 && vbc && vb2;
+                                    k--, vbc = vb2, vb2 = vb2->next_variable) {
+                                    /* clone next into the current */
+                                    snmp_clone_var(vb2, vbc);
+                                    vbc->next_variable = vb2;
+                                }
+                            }
+                        }
+                        snmp_set_var_typed_value(vb, type, NULL, 0);
+                    }
+                }
+            }
+        }
+    }
+    return ret;
+}
+
+
+int
+netsnmp_create_subtree_cache(netsnmp_agent_session *asp)
+{
+    netsnmp_subtree *tp;
+    netsnmp_variable_list *varbind_ptr, *vbsave, *vbptr, **prevNext;
+    int             view;
+    int             vbcount = 0;
+    int             bulkcount = 0, bulkrep = 0;
+    int             i = 0, n = 0, r = 0;
+    netsnmp_request_info *request;
+
+    if (asp->treecache == NULL && asp->treecache_len == 0) {
+        asp->treecache_len = SNMP_MAX(1 + asp->vbcount / 4, 16);
+        asp->treecache =
+            calloc(asp->treecache_len, sizeof(netsnmp_tree_cache));
+        if (asp->treecache == NULL)
+            return SNMP_ERR_GENERR;
+    }
+    asp->treecache_num = -1;
+
+    if (asp->pdu->command == SNMP_MSG_GETBULK) {
+        /*
+         * getbulk prep 
+         */
+        int             count = count_varbinds(asp->pdu->variables);
+
+        if (asp->pdu->errstat < 0) {
+            asp->pdu->errstat = 0;
+        }
+        if (asp->pdu->errindex < 0) {
+            asp->pdu->errindex = 0;
+        }
+
+        if (asp->pdu->errstat < count) {
+            n = asp->pdu->errstat;
+        } else {
+            n = count;
+        }
+        if ((r = count - n) < 0) {
+            r = 0;
+            asp->bulkcache = NULL;
+        } else {
+            asp->bulkcache =
+                (netsnmp_variable_list **) malloc(asp->pdu->errindex * r *
+                                                  sizeof(struct
+                                                         varbind_list *));
+        }
+        DEBUGMSGTL(("snmp_agent", "GETBULK N = %d, M = %d, R = %d\n",
+                    n, asp->pdu->errindex, r));
+    }
+
+    /*
+     * collect varbinds into their registered trees 
+     */
+    prevNext = &(asp->pdu->variables);
+    for (varbind_ptr = asp->pdu->variables; varbind_ptr;
+         varbind_ptr = vbsave) {
+
+        /*
+         * getbulk mess with this pointer, so save it 
+         */
+        vbsave = varbind_ptr->next_variable;
+
+        if (asp->pdu->command == SNMP_MSG_GETBULK) {
+            if (n > 0) {
+                n--;
+            } else {
+                /*
+                 * repeate request varbinds on GETBULK.  These will
+                 * have to be properly rearranged later though as
+                 * responses are supposed to actually be interlaced
+                 * with each other.  This is done with the asp->bulkcache. 
+                 */
+                bulkrep = asp->pdu->errindex - 1;
+                if (asp->pdu->errindex > 0) {
+                    vbptr = varbind_ptr;
+                    asp->bulkcache[bulkcount++] = vbptr;
+
+                    for (i = 1; i < asp->pdu->errindex; i++) {
+                        vbptr->next_variable =
+                            SNMP_MALLOC_STRUCT(variable_list);
+                        /*
+                         * don't clone the oid as it's got to be
+                         * overwwritten anyway 
+                         */
+                        if (!vbptr->next_variable) {
+                            /*
+                             * XXXWWW: ack!!! 
+                             */
+                        } else {
+                            vbptr = vbptr->next_variable;
+                            vbptr->name_length = 0;
+                            vbptr->type = ASN_NULL;
+                            asp->bulkcache[bulkcount++] = vbptr;
+                        }
+                    }
+                    vbptr->next_variable = vbsave;
+                } else {
+                    /*
+                     * 0 repeats requested for this varbind, so take it off
+                     * the list.  
+                     */
+                    vbptr = varbind_ptr;
+                    *prevNext = vbptr->next_variable;
+                    vbptr->next_variable = NULL;
+                    snmp_free_varbind(vbptr);
+                    asp->vbcount--;
+                    continue;
+                }
+            }
+        }
+
+        /*
+         * count the varbinds 
+         */
+        ++vbcount;
+
+        /*
+         * find the owning tree 
+         */
+        tp = netsnmp_subtree_find(varbind_ptr->name, varbind_ptr->name_length,
+				  NULL, asp->pdu->contextName);
+
+        /*
+         * check access control 
+         */
+        switch (asp->pdu->command) {
+        case SNMP_MSG_GET:
+            view = in_a_view(varbind_ptr->name, &varbind_ptr->name_length,
+                             asp->pdu, varbind_ptr->type);
+            if (view != VACM_SUCCESS)
+                snmp_set_var_typed_value(varbind_ptr, SNMP_NOSUCHOBJECT,
+                                         NULL, 0);
+            break;
+
+        case SNMP_MSG_SET:
+            view = in_a_view(varbind_ptr->name, &varbind_ptr->name_length,
+                             asp->pdu, varbind_ptr->type);
+            if (view != VACM_SUCCESS)
+                return SNMP_ERR_NOTWRITABLE;
+            break;
+
+        case SNMP_MSG_GETNEXT:
+        case SNMP_MSG_GETBULK:
+        default:
+            view = VACM_SUCCESS;
+            /*
+             * XXXWWW: check VACM here to see if "tp" is even worthwhile 
+             */
+        }
+        if (view == VACM_SUCCESS) {
+            request = netsnmp_add_varbind_to_cache(asp, vbcount, varbind_ptr,
+						   tp);
+            if (request && asp->pdu->command == SNMP_MSG_GETBULK) {
+                request->repeat = request->orig_repeat = bulkrep;
+            }
+        }
+
+        prevNext = &(varbind_ptr->next_variable);
+    }
+
+    return SNMPERR_SUCCESS;
+}
+
+/*
+ * this function is only applicable in getnext like contexts 
+ */
+int
+netsnmp_reassign_requests(netsnmp_agent_session *asp)
+{
+    /*
+     * assume all the requests have been filled or rejected by the
+     * subtrees, so reassign the rejected ones to the next subtree in
+     * the chain 
+     */
+
+    int             i;
+
+    /*
+     * get old info 
+     */
+    netsnmp_tree_cache *old_treecache = asp->treecache;
+
+    /*
+     * malloc new space 
+     */
+    asp->treecache =
+        (netsnmp_tree_cache *) calloc(asp->treecache_len,
+                                      sizeof(netsnmp_tree_cache));
+    asp->treecache_num = -1;
+    if (asp->cache_store) {
+        netsnmp_free_cachemap(asp->cache_store);
+        asp->cache_store = NULL;
+    }
+
+    for (i = 0; i < asp->vbcount; i++) {
+        if (asp->requests[i].requestvb->type == ASN_NULL) {
+            if (!netsnmp_add_varbind_to_cache(asp, asp->requests[i].index,
+                                              asp->requests[i].requestvb,
+                                              asp->requests[i].subtree->next)) {
+                if (old_treecache != NULL) {
+                    free(old_treecache);
+                    old_treecache = NULL;
+                }
+            }
+        } else if (asp->requests[i].requestvb->type == ASN_PRIV_RETRY) {
+            /*
+             * re-add the same subtree 
+             */
+            asp->requests[i].requestvb->type = ASN_NULL;
+            if (!netsnmp_add_varbind_to_cache(asp, asp->requests[i].index,
+                                              asp->requests[i].requestvb,
+                                              asp->requests[i].subtree)) {
+                if (old_treecache != NULL) {
+                    free(old_treecache);
+                    old_treecache = NULL;
+                }
+            }
+        }
+    }
+
+    if (old_treecache != NULL) {
+        free(old_treecache);
+    }
+    return SNMP_ERR_NOERROR;
+}
+
+void
+netsnmp_delete_request_infos(netsnmp_request_info *reqlist)
+{
+    while (reqlist) {
+        netsnmp_free_request_data_sets(reqlist);
+        reqlist = reqlist->next;
+    }
+}
+
+void
+netsnmp_delete_subtree_cache(netsnmp_agent_session *asp)
+{
+    while (asp->treecache_num >= 0) {
+        /*
+         * don't delete subtrees 
+         */
+        netsnmp_delete_request_infos(asp->treecache[asp->treecache_num].
+                                     requests_begin);
+        asp->treecache_num--;
+    }
+}
+
+int
+netsnmp_check_requests_status(netsnmp_agent_session *asp,
+                              netsnmp_request_info *requests,
+                              int look_for_specific)
+{
+    /*
+     * find any errors marked in the requests 
+     */
+    while (requests) {
+        if (requests->status != SNMP_ERR_NOERROR &&
+            (!look_for_specific || requests->status == look_for_specific)
+            && (look_for_specific || asp->index == 0
+                || requests->index < asp->index)) {
+            asp->index = requests->index;
+            asp->status = requests->status;
+        }
+        requests = requests->next;
+    }
+    return asp->status;
+}
+
+int
+netsnmp_check_all_requests_status(netsnmp_agent_session *asp,
+                                  int look_for_specific)
+{
+    int             i;
+    for (i = 0; i <= asp->treecache_num; i++) {
+        netsnmp_check_requests_status(asp,
+                                      asp->treecache[i].requests_begin,
+                                      look_for_specific);
+    }
+    return asp->status;
+}
+
+int
+handle_var_requests(netsnmp_agent_session *asp)
+{
+    int             i, retstatus = SNMP_ERR_NOERROR,
+        status = SNMP_ERR_NOERROR, final_status = SNMP_ERR_NOERROR;
+    netsnmp_handler_registration *reginfo;
+
+    /*
+     * create the netsnmp_agent_request_info data 
+     */
+    if (!asp->reqinfo) {
+        asp->reqinfo = SNMP_MALLOC_TYPEDEF(netsnmp_agent_request_info);
+        if (!asp->reqinfo)
+            return SNMP_ERR_GENERR;
+    }
+
+    asp->reqinfo->asp = asp;
+    asp->reqinfo->mode = asp->mode;
+
+    /*
+     * now, have the subtrees in the cache go search for their results 
+     */
+    for (i = 0; i <= asp->treecache_num; i++) {
+        reginfo = asp->treecache[i].subtree->reginfo;
+        status = netsnmp_call_handlers(reginfo, asp->reqinfo,
+                                       asp->treecache[i].requests_begin);
+
+        /*
+         * find any errors marked in the requests.  For later parts of
+         * SET processing, only check for new errors specific to that
+         * set processing directive (which must superceed the previous
+         * errors).
+         */
+        switch (asp->mode) {
+        case MODE_SET_COMMIT:
+            retstatus = netsnmp_check_requests_status(asp,
+						      asp->treecache[i].
+						      requests_begin,
+						      SNMP_ERR_COMMITFAILED);
+            break;
+
+        case MODE_SET_UNDO:
+            retstatus = netsnmp_check_requests_status(asp,
+						      asp->treecache[i].
+						      requests_begin,
+						      SNMP_ERR_UNDOFAILED);
+            break;
+
+        default:
+            retstatus = netsnmp_check_requests_status(asp,
+						      asp->treecache[i].
+						      requests_begin, 0);
+            break;
+        }
+
+        /*
+         * always take lowest varbind if possible 
+         */
+        if (retstatus != SNMP_ERR_NOERROR) {
+            status = retstatus;
+	}
+
+        /*
+         * other things we know less about (no index) 
+         */
+        /*
+         * WWW: drop support for this? 
+         */
+        if (final_status == SNMP_ERR_NOERROR && status != SNMP_ERR_NOERROR) {
+            /*
+             * we can't break here, since some processing needs to be
+             * done for all requests anyway (IE, SET handling for UNDO
+             * needs to be called regardless of previous status
+             * results.
+             * WWW:  This should be predictable though and
+             * breaking should be possible in some cases (eg GET,
+             * GETNEXT, ...) 
+             */
+            final_status = status;
+        }
+    }
+
+    return final_status;
+}
+
+/*
+ * loop through our sessions known delegated sessions and check to see
+ * if they've completed yet. If there are no more delegated sessions,
+ * check for and process any queued requests
+ */
+void
+netsnmp_check_outstanding_agent_requests(void)
+{
+    netsnmp_agent_session *asp, *prev_asp = NULL, *next_asp = NULL;
+
+    /*
+     * deal with delegated requests
+     */
+    for (asp = agent_delegated_list; asp; prev_asp = asp, asp = next_asp) {
+        next_asp = asp->next;   /* save in case we clean up asp */
+        if (!netsnmp_check_for_delegated(asp)) {
+
+            /*
+             * we're done with this one, remove from queue 
+             */
+            if (prev_asp != NULL)
+                prev_asp->next = asp->next;
+            else
+                agent_delegated_list = asp->next;
+
+            /*
+             * check request status
+             */
+            netsnmp_check_all_requests_status(asp, 0);
+            
+            /*
+             * continue processing or finish up 
+             */
+            check_delayed_request(asp);
+        }
+    }
+
+    /*
+     * if we are processing a set and there are more delegated
+     * requests, keep waiting before getting to queued requests.
+     */
+    if (netsnmp_processing_set && (NULL != agent_delegated_list))
+        return;
+
+    while (netsnmp_agent_queued_list) {
+
+        /*
+         * if we are processing a set, the first item better be
+         * the set being (or waiting to be) processed.
+         */
+        netsnmp_assert((!netsnmp_processing_set) ||
+                       (netsnmp_processing_set == netsnmp_agent_queued_list));
+
+        /*
+         * if the top request is a set, don't pop it
+         * off if there are delegated requests
+         */
+        if ((netsnmp_agent_queued_list->pdu->command == SNMP_MSG_SET) &&
+            (agent_delegated_list)) {
+
+            netsnmp_assert(netsnmp_processing_set == NULL);
+
+            netsnmp_processing_set = netsnmp_agent_queued_list;
+            DEBUGMSGTL(("snmp_agent", "SET request remains queued while "
+                        "delegated requests finish, asp = %08p\n", asp));
+            break;
+        }
+
+        /*
+         * pop the first request and process it
+         */
+        asp = netsnmp_agent_queued_list;
+        netsnmp_agent_queued_list = asp->next;
+        DEBUGMSGTL(("snmp_agent",
+                    "processing queued request, asp = %08p\n", asp));
+
+        netsnmp_handle_request(asp, asp->status);
+
+        /*
+         * if we hit a set, stop
+         */
+        if (NULL != netsnmp_processing_set)
+            break;
+    }
+}
+
+/** Decide if the requested transaction_id is still being processed
+   within the agent.  This is used to validate whether a delayed cache
+   (containing possibly freed pointers) is still usable.
+
+   returns SNMPERR_SUCCESS if it's still valid, or SNMPERR_GENERR if not. */
+int
+netsnmp_check_transaction_id(int transaction_id)
+{
+    netsnmp_agent_session *asp, *prev_asp = NULL;
+
+    for (asp = agent_delegated_list; asp; prev_asp = asp, asp = asp->next) {
+        if (asp->pdu->transid == transaction_id)
+            return SNMPERR_SUCCESS;
+    }
+    return SNMPERR_GENERR;
+}
+
+
+/*
+ * check_delayed_request(asp)
+ *
+ * Called to rexamine a set of requests and continue processing them
+ * once all the previous (delayed) requests have been handled one way
+ * or another.
+ */
+
+int
+check_delayed_request(netsnmp_agent_session *asp)
+{
+    int             status = SNMP_ERR_NOERROR;
+
+    DEBUGMSGTL(("snmp_agent", "processing delegated request, asp = %08p\n",
+                asp));
+
+    switch (asp->mode) {
+    case SNMP_MSG_GETBULK:
+    case SNMP_MSG_GETNEXT:
+        netsnmp_check_all_requests_status(asp, 0);
+        handle_getnext_loop(asp);
+        if (netsnmp_check_for_delegated(asp) &&
+            netsnmp_check_transaction_id(asp->pdu->transid) !=
+            SNMPERR_SUCCESS) {
+            /*
+             * add to delegated request chain 
+             */
+            if (!netsnmp_check_delegated_chain_for(asp)) {
+                asp->next = agent_delegated_list;
+                agent_delegated_list = asp;
+            }
+        }
+        break;
+
+    case MODE_SET_COMMIT:
+        netsnmp_check_all_requests_status(asp, SNMP_ERR_COMMITFAILED);
+        goto settop;
+
+    case MODE_SET_UNDO:
+        netsnmp_check_all_requests_status(asp, SNMP_ERR_UNDOFAILED);
+        goto settop;
+
+    case MODE_SET_BEGIN:
+    case MODE_SET_RESERVE1:
+    case MODE_SET_RESERVE2:
+    case MODE_SET_ACTION:
+    case MODE_SET_FREE:
+      settop:
+        handle_set_loop(asp);
+        if (asp->mode != FINISHED_SUCCESS && asp->mode != FINISHED_FAILURE) {
+
+            if (netsnmp_check_for_delegated_and_add(asp)) {
+                /*
+                 * add to delegated request chain 
+                 */
+                if (!asp->status)
+                    asp->status = status;
+            }
+
+            return SNMP_ERR_NOERROR;
+        }
+        break;
+
+    default:
+        break;
+    }
+
+    /*
+     * if we don't have anything outstanding (delegated), wrap up 
+     */
+    if (!netsnmp_check_for_delegated(asp))
+        return netsnmp_wrap_up_request(asp, status);
+
+    return 1;
+}
+
+/** returns 1 if there are valid GETNEXT requests left.  Returns 0 if not. */
+int
+check_getnext_results(netsnmp_agent_session *asp)
+{
+    /*
+     * get old info 
+     */
+    netsnmp_tree_cache *old_treecache = asp->treecache;
+    int             old_treecache_num = asp->treecache_num;
+    int             count = 0;
+    int             i, special = 0;
+    netsnmp_request_info *request;
+
+    if (asp->mode == SNMP_MSG_GET) {
+        /*
+         * Special case for doing INCLUSIVE getNext operations in
+         * AgentX subagents.  
+         */
+        DEBUGMSGTL(("snmp_agent",
+                    "asp->mode == SNMP_MSG_GET in ch_getnext\n"));
+        asp->mode = asp->oldmode;
+        special = 1;
+    }
+
+    for (i = 0; i <= old_treecache_num; i++) {
+        for (request = old_treecache[i].requests_begin; request;
+             request = request->next) {
+
+            /*
+             * If we have just done the special case AgentX GET, then any
+             * requests which were not INCLUSIVE will now have a wrong
+             * response, so junk them and retry from the same place (except
+             * that this time the handler will be called in "inexact"
+             * mode).  
+             */
+
+            if (special) {
+                if (!request->inclusive) {
+                    DEBUGMSGTL(("snmp_agent",
+                                "request %d wasn't inclusive\n",
+                                request->index));
+                    snmp_set_var_typed_value(request->requestvb,
+                                             ASN_PRIV_RETRY, NULL, 0);
+                } else if (request->requestvb->type == ASN_NULL ||
+                           request->requestvb->type == SNMP_NOSUCHINSTANCE ||
+                           request->requestvb->type == SNMP_NOSUCHOBJECT) {
+                    /*
+                     * it was inclusive, but no results.  Still retry this
+                     * search. 
+                     */
+                    snmp_set_var_typed_value(request->requestvb,
+                                             ASN_PRIV_RETRY, NULL, 0);
+                }
+            }
+
+            /*
+             * out of range? 
+             */
+            if (snmp_oid_compare(request->requestvb->name,
+                                 request->requestvb->name_length,
+                                 request->range_end,
+                                 request->range_end_len) >= 0) {
+                /*
+                 * ack, it's beyond the accepted end of range. 
+                 */
+                /*
+                 * fix it by setting the oid to the end of range oid instead 
+                 */
+                DEBUGMSGTL(("check_getnext_results",
+                            "request response %d out of range\n",
+                            request->index));
+                request->inclusive = 1;
+                /*
+                 * XXX: should set this to the original OID? 
+                 */
+                snmp_set_var_objid(request->requestvb,
+                                   request->range_end,
+                                   request->range_end_len);
+                snmp_set_var_typed_value(request->requestvb, ASN_NULL,
+                                         NULL, 0);
+            }
+
+            /*
+             * mark any existent requests with illegal results as NULL 
+             */
+            if (request->requestvb->type == SNMP_ENDOFMIBVIEW) {
+                /*
+                 * illegal response from a subagent.  Change it back to NULL 
+                 */
+                request->requestvb->type = ASN_NULL;
+                request->inclusive = 1;
+            }
+
+            if (request->requestvb->type == ASN_NULL ||
+                request->requestvb->type == ASN_PRIV_RETRY ||
+                (asp->reqinfo->mode == MODE_GETBULK
+                 && request->repeat > 0))
+                count++;
+        }
+    }
+    return count;
+}
+
+/** repeatedly calls getnext handlers looking for an answer till all
+   requests are satisified.  It's expected that one pass has been made
+   before entering this function */
+int
+handle_getnext_loop(netsnmp_agent_session *asp)
+{
+    int             status;
+    netsnmp_variable_list *var_ptr;
+
+    /*
+     * loop 
+     */
+    while (1) {
+
+        /*
+         * bail for now if anything is delegated. 
+         */
+        if (netsnmp_check_for_delegated(asp)) {
+            return SNMP_ERR_NOERROR;
+        }
+
+        /*
+         * check vacm against results 
+         */
+        check_acm(asp, ASN_PRIV_RETRY);
+
+        /*
+         * need to keep going we're not done yet. 
+         */
+        if (!check_getnext_results(asp))
+            /*
+             * nothing left, quit now 
+             */
+            break;
+
+        /*
+         * never had a request (empty pdu), quit now 
+         */
+        /*
+         * XXXWWW: huh?  this would be too late, no?  shouldn't we
+         * catch this earlier? 
+         */
+        /*
+         * if (count == 0)
+         * break; 
+         */
+
+        DEBUGIF("results") {
+            DEBUGMSGTL(("results",
+                        "getnext results, before next pass:\n"));
+            for (var_ptr = asp->pdu->variables; var_ptr;
+                 var_ptr = var_ptr->next_variable) {
+                DEBUGMSGTL(("results", "\t"));
+                DEBUGMSGVAR(("results", var_ptr));
+                DEBUGMSG(("results", "\n"));
+            }
+        }
+
+        netsnmp_reassign_requests(asp);
+        status = handle_var_requests(asp);
+        if (status != SNMP_ERR_NOERROR) {
+            return status;      /* should never really happen */
+        }
+    }
+    return SNMP_ERR_NOERROR;
+}
+
+int
+handle_set(netsnmp_agent_session *asp)
+{
+    int             status;
+    /*
+     * SETS require 3-4 passes through the var_op_list.
+     * The first two
+     * passes verify that all types, lengths, and values are valid
+     * and may reserve resources and the third does the set and a
+     * fourth executes any actions.  Then the identical GET RESPONSE
+     * packet is returned.
+     * If either of the first two passes returns an error, another
+     * pass is made so that any reserved resources can be freed.
+     * If the third pass returns an error, another pass is
+     * made so that
+     * any changes can be reversed.
+     * If the fourth pass (or any of the error handling passes)
+     * return an error, we'd rather not know about it!
+     */
+    if (!(asp->pdu->flags & UCD_MSG_FLAG_ONE_PASS_ONLY)) {
+        switch (asp->mode) {
+        case MODE_SET_BEGIN:
+            snmp_increment_statistic(STAT_SNMPINSETREQUESTS);
+            asp->rw = WRITE;    /* WWW: still needed? */
+            asp->mode = MODE_SET_RESERVE1;
+            asp->status = SNMP_ERR_NOERROR;
+            break;
+
+        case MODE_SET_RESERVE1:
+
+            if (asp->status != SNMP_ERR_NOERROR)
+                asp->mode = MODE_SET_FREE;
+            else
+                asp->mode = MODE_SET_RESERVE2;
+            break;
+
+        case MODE_SET_RESERVE2:
+            if (asp->status != SNMP_ERR_NOERROR)
+                asp->mode = MODE_SET_FREE;
+            else
+                asp->mode = MODE_SET_ACTION;
+            break;
+
+        case MODE_SET_ACTION:
+            if (asp->status != SNMP_ERR_NOERROR)
+                asp->mode = MODE_SET_UNDO;
+            else
+                asp->mode = MODE_SET_COMMIT;
+            break;
+
+        case MODE_SET_COMMIT:
+            if (asp->status != SNMP_ERR_NOERROR) {
+                asp->mode = FINISHED_FAILURE;
+            } else {
+                asp->mode = FINISHED_SUCCESS;
+            }
+            break;
+
+        case MODE_SET_UNDO:
+            asp->mode = FINISHED_FAILURE;
+            break;
+
+        case MODE_SET_FREE:
+            asp->mode = FINISHED_FAILURE;
+            break;
+        }
+    }
+
+    if (asp->mode != FINISHED_SUCCESS && asp->mode != FINISHED_FAILURE) {
+        DEBUGMSGTL(("agent_set", "doing set mode = %d (%s)\n", asp->mode,
+                    se_find_label_in_slist("agent_mode", asp->mode)));
+        status = handle_var_requests(asp);
+        DEBUGMSGTL(("agent_set", "did set mode = %d, status = %d\n",
+                    asp->mode, status));
+        if ((status != SNMP_ERR_NOERROR && asp->status == SNMP_ERR_NOERROR) ||
+	    status == SNMP_ERR_COMMITFAILED || 
+	    status == SNMP_ERR_UNDOFAILED) {
+            asp->status = status;
+        }
+    }
+    return asp->status;
+}
+
+int
+handle_set_loop(netsnmp_agent_session *asp)
+{
+    while (asp->mode != FINISHED_FAILURE && asp->mode != FINISHED_SUCCESS) {
+        handle_set(asp);
+        if (netsnmp_check_for_delegated(asp)) {
+            return SNMP_ERR_NOERROR;
+	}
+        if (asp->pdu->flags & UCD_MSG_FLAG_ONE_PASS_ONLY) {
+            return asp->status;
+	}
+    }
+    return asp->status;
+}
+
+int
+netsnmp_handle_request(netsnmp_agent_session *asp, int status)
+{
+    /*
+     * if this isn't a delegated request trying to finish,
+     * processing of a set request should not start until all
+     * delegated requests have completed, and no other new requests
+     * should be processed until the set request completes.
+     */
+    if ((0 == netsnmp_check_delegated_chain_for(asp)) &&
+        (asp != netsnmp_processing_set)) {
+        /*
+         * if we are processing a set and this is not a delegated
+         * request, queue the request
+         */
+        if (netsnmp_processing_set) {
+            netsnmp_add_queued(asp);
+            DEBUGMSGTL(("snmp_agent",
+                        "request queued while processing set, "
+                        "asp = %08p\n", asp));
+            return 1;
+        }
+
+        /*
+         * check for set request
+         */
+        if (asp->pdu->command == SNMP_MSG_SET) {
+            netsnmp_processing_set = asp;
+
+            /*
+             * if there are delegated requests, we must wait for them
+             * to finishd.
+             */
+            if (agent_delegated_list) {
+                DEBUGMSGTL(("snmp_agent", "SET request queued while "
+                            "delegated requests finish, asp = %08p\n",
+                            asp));
+                netsnmp_add_queued(asp);
+                return 1;
+            }
+        }
+    }
+
+    /*
+     * process the request 
+     */
+    status = handle_pdu(asp);
+
+    /*
+     * print the results in appropriate debugging mode 
+     */
+    DEBUGIF("results") {
+        netsnmp_variable_list *var_ptr;
+        DEBUGMSGTL(("results", "request results (status = %d):\n",
+                    status));
+        for (var_ptr = asp->pdu->variables; var_ptr;
+             var_ptr = var_ptr->next_variable) {
+            DEBUGMSGTL(("results", "\t"));
+            DEBUGMSGVAR(("results", var_ptr));
+            DEBUGMSG(("results", "\n"));
+        }
+    }
+
+    /*
+     * check for uncompleted requests 
+     */
+    if (netsnmp_check_for_delegated_and_add(asp)) {
+        /*
+         * add to delegated request chain 
+         */
+        asp->status = status;
+    } else {
+        /*
+         * if we don't have anything outstanding (delegated), wrap up
+         */
+        return netsnmp_wrap_up_request(asp, status);
+    }
+
+    return 1;
+}
+
+int
+handle_pdu(netsnmp_agent_session *asp)
+{
+    int             status, inclusives = 0;
+    netsnmp_variable_list *v = NULL;
+
+    /*
+     * for illegal requests, mark all nodes as ASN_NULL 
+     */
+    switch (asp->pdu->command) {
+
+    case SNMP_MSG_INTERNAL_SET_RESERVE2:
+    case SNMP_MSG_INTERNAL_SET_ACTION:
+    case SNMP_MSG_INTERNAL_SET_COMMIT:
+    case SNMP_MSG_INTERNAL_SET_FREE:
+    case SNMP_MSG_INTERNAL_SET_UNDO:
+        status = get_set_cache(asp);
+        if (status != SNMP_ERR_NOERROR)
+            return status;
+        break;
+
+    case SNMP_MSG_GET:
+    case SNMP_MSG_GETNEXT:
+    case SNMP_MSG_GETBULK:
+        for (v = asp->pdu->variables; v != NULL; v = v->next_variable) {
+            if (v->type == ASN_PRIV_INCL_RANGE) {
+                /*
+                 * Leave the type for now (it gets set to
+                 * ASN_NULL in netsnmp_add_varbind_to_cache,
+                 * called by create_subnetsnmp_tree_cache below).
+                 * If we set it to ASN_NULL now, we wouldn't be
+                 * able to distinguish INCLUSIVE search
+                 * ranges.  
+                 */
+                inclusives++;
+            } else {
+                snmp_set_var_typed_value(v, ASN_NULL, NULL, 0);
+            }
+        }
+        /*
+         * fall through 
+         */
+
+    case SNMP_MSG_INTERNAL_SET_BEGIN:
+    case SNMP_MSG_INTERNAL_SET_RESERVE1:
+    default:
+        asp->vbcount = count_varbinds(asp->pdu->variables);
+        if (asp->vbcount) /* efence doesn't like 0 size allocs */
+            asp->requests = (netsnmp_request_info *)
+                calloc(asp->vbcount, sizeof(netsnmp_request_info));
+        /*
+         * collect varbinds 
+         */
+        status = netsnmp_create_subtree_cache(asp);
+        if (status != SNMP_ERR_NOERROR)
+            return status;
+    }
+
+    asp->mode = asp->pdu->command;
+    switch (asp->mode) {
+    case SNMP_MSG_GET:
+        /*
+         * increment the message type counter 
+         */
+        snmp_increment_statistic(STAT_SNMPINGETREQUESTS);
+
+        /*
+         * check vacm ahead of time 
+         */
+        check_acm(asp, SNMP_NOSUCHOBJECT);
+
+        /*
+         * get the results 
+         */
+        status = handle_var_requests(asp);
+
+        /*
+         * Deal with unhandled results -> noSuchInstance (rather
+         * than noSuchObject -- in that case, the type will
+         * already have been set to noSuchObject when we realised
+         * we couldn't find an appropriate tree).  
+         */
+        if (status == SNMP_ERR_NOERROR)
+            snmp_replace_var_types(asp->pdu->variables, ASN_NULL,
+                                   SNMP_NOSUCHINSTANCE);
+        break;
+
+    case SNMP_MSG_GETNEXT:
+        snmp_increment_statistic(STAT_SNMPINGETNEXTS);
+        /*
+         * fall through 
+         */
+
+    case SNMP_MSG_GETBULK:     /* note: there is no getbulk stat */
+        /*
+         * loop through our mib tree till we find an
+         * appropriate response to return to the caller. 
+         */
+
+        if (inclusives) {
+            /*
+             * This is a special case for AgentX INCLUSIVE getNext
+             * requests where a result lexi-equal to the request is okay
+             * but if such a result does not exist, we still want the
+             * lexi-next one.  So basically we do a GET first, and if any
+             * of the INCLUSIVE requests are satisfied, we use that
+             * value.  Then, unsatisfied INCLUSIVE requests, and
+             * non-INCLUSIVE requests get done as normal.  
+             */
+
+            DEBUGMSGTL(("snmp_agent", "inclusive range(s) in getNext\n"));
+            asp->oldmode = asp->mode;
+            asp->mode = SNMP_MSG_GET;
+        }
+
+        /*
+         * first pass 
+         */
+        status = handle_var_requests(asp);
+        if (status != SNMP_ERR_NOERROR) {
+            if (!inclusives)
+                return status;  /* should never really happen */
+            else
+                asp->status = SNMP_ERR_NOERROR;
+        }
+
+        /*
+         * loop through our mib tree till we find an
+         * appropriate response to return to the caller. 
+         */
+
+        status = handle_getnext_loop(asp);
+        break;
+
+    case SNMP_MSG_SET:
+        /*
+         * check access permissions first 
+         */
+        if (check_acm(asp, SNMP_NOSUCHOBJECT))
+            return SNMP_ERR_NOTWRITABLE;
+
+        asp->mode = MODE_SET_BEGIN;
+        status = handle_set_loop(asp);
+
+        break;
+
+    case SNMP_MSG_INTERNAL_SET_BEGIN:
+    case SNMP_MSG_INTERNAL_SET_RESERVE1:
+    case SNMP_MSG_INTERNAL_SET_RESERVE2:
+    case SNMP_MSG_INTERNAL_SET_ACTION:
+    case SNMP_MSG_INTERNAL_SET_COMMIT:
+    case SNMP_MSG_INTERNAL_SET_FREE:
+    case SNMP_MSG_INTERNAL_SET_UNDO:
+        asp->pdu->flags |= UCD_MSG_FLAG_ONE_PASS_ONLY;
+        status = handle_set_loop(asp);
+        /*
+         * asp related cache is saved in cleanup 
+         */
+        break;
+
+    case SNMP_MSG_RESPONSE:
+        snmp_increment_statistic(STAT_SNMPINGETRESPONSES);
+        return SNMP_ERR_NOERROR;
+
+    case SNMP_MSG_TRAP:
+    case SNMP_MSG_TRAP2:
+        snmp_increment_statistic(STAT_SNMPINTRAPS);
+        return SNMP_ERR_NOERROR;
+
+    default:
+        /*
+         * WWW: are reports counted somewhere ? 
+         */
+        snmp_increment_statistic(STAT_SNMPINASNPARSEERRS);
+        return SNMPERR_GENERR;  /* shouldn't get here */
+        /*
+         * WWW 
+         */
+    }
+    return status;
+}
+
+int
+netsnmp_set_request_error(netsnmp_agent_request_info *reqinfo,
+                          netsnmp_request_info *request, int error_value)
+{
+    if (!request || !reqinfo)
+        return error_value;
+
+    return netsnmp_set_mode_request_error(reqinfo->mode, request,
+                                          error_value);
+}
+
+int
+netsnmp_set_mode_request_error(int mode, netsnmp_request_info *request,
+                               int error_value)
+{
+    if (!request)
+        return error_value;
+
+    request->processed = 1;
+    request->delegated = REQUEST_IS_NOT_DELEGATED;
+
+    switch (error_value) {
+    case SNMP_NOSUCHOBJECT:
+    case SNMP_NOSUCHINSTANCE:
+    case SNMP_ENDOFMIBVIEW:
+        /*
+         * these are exceptions that should be put in the varbind
+         * in the case of a GET but should be translated for a SET
+         * into a real error status code and put in the request 
+         */
+        switch (mode) {
+        case MODE_GET:
+            request->requestvb->type = error_value;
+            return error_value;
+
+        case MODE_GETNEXT:
+        case MODE_GETBULK:
+            /*
+             * ignore these.  They're illegal to set by the
+             * client APIs for these modes 
+             */
+            snmp_log(LOG_ERR, "Illegal error_value %d for mode %d ignored\n",
+                     error_value, mode);
+            return error_value;
+
+        default:
+            request->status = SNMP_ERR_NOSUCHNAME;      /* WWW: correct? */
+            return error_value;
+        }
+        break;                  /* never get here */
+
+    default:
+        if (request->status < 0) {
+            /*
+             * illegal local error code.  translate to generr 
+             */
+            /*
+             * WWW: full translation map? 
+             */
+            snmp_log(LOG_ERR, "Illegal error_value %d translated to %d\n",
+                     error_value, SNMP_ERR_GENERR);
+            request->status = SNMP_ERR_GENERR;
+        } else {
+            /*
+             * WWW: translations and mode checking? 
+             */
+            request->status = error_value;
+        }
+        return error_value;
+    }
+    return error_value;
+}
+
+int
+netsnmp_set_all_requests_error(netsnmp_agent_request_info *reqinfo,
+                               netsnmp_request_info *requests,
+                               int error_value)
+{
+    while (requests) {
+        netsnmp_set_request_error(reqinfo, requests, error_value);
+        requests = requests->next;
+    }
+    return error_value;
+}
+
+extern struct timeval starttime;
+
+                /*
+                 * Return the value of 'sysUpTime' at the given marker 
+                 */
+u_long
+netsnmp_marker_uptime(marker_t pm)
+{
+    u_long          res;
+    marker_t        start = (marker_t) & starttime;
+
+    res = uatime_hdiff(start, pm);
+    return res;                 /* atime_diff works in msec, not csec */
+}
+
+                        /*
+                         * struct timeval equivalents of these 
+                         */
+u_long
+netsnmp_timeval_uptime(struct timeval * tv)
+{
+    return netsnmp_marker_uptime((marker_t) tv);
+}
+
+                /*
+                 * Return the current value of 'sysUpTime' 
+                 */
+u_long
+netsnmp_get_agent_uptime(void)
+{
+    struct timeval  now;
+    gettimeofday(&now, NULL);
+
+    return netsnmp_timeval_uptime(&now);
+}
+
+
+
+NETSNMP_INLINE void
+netsnmp_agent_add_list_data(netsnmp_agent_request_info *ari,
+                            netsnmp_data_list *node)
+{
+    if (ari) {
+	if (ari->agent_data) {
+            netsnmp_add_list_data(&ari->agent_data, node);
+        } else {
+            ari->agent_data = node;
+	}
+    }
+}
+
+NETSNMP_INLINE void    *
+netsnmp_agent_get_list_data(netsnmp_agent_request_info *ari,
+                            const char *name)
+{
+    if (ari) {
+        return netsnmp_get_list_data(ari->agent_data, name);
+    }
+    return NULL;
+}
+
+NETSNMP_INLINE void
+netsnmp_free_agent_data_set(netsnmp_agent_request_info *ari)
+{
+    if (ari) {
+        netsnmp_free_list_data(ari->agent_data);
+    }
+}
+
+NETSNMP_INLINE void
+netsnmp_free_agent_data_sets(netsnmp_agent_request_info *ari)
+{
+    if (ari) {
+        netsnmp_free_all_list_data(ari->agent_data);
+    }
+}
+
+NETSNMP_INLINE void
+netsnmp_free_agent_request_info(netsnmp_agent_request_info *ari)
+{
+    if (ari) {
+        if (ari->agent_data) {
+            netsnmp_free_all_list_data(ari->agent_data);
+	}
+        free(ari);
+    }
+}
diff -Naur tomato/release/src/router/snmp/agent/snmp_agent.c.syslog tomato121/release/src/router/snmp/agent/snmp_agent.c.syslog
--- tomato/release/src/router/snmp/agent/snmp_agent.c.syslog	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/snmp_agent.c.syslog	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,2971 @@
+/*
+ * snmp_agent.c
+ *
+ * Simple Network Management Protocol (RFC 1067).
+ */
+/***********************************************************
+	Copyright 1988, 1989 by Carnegie Mellon University
+
+                      All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its 
+documentation for any purpose and without fee is hereby granted, 
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in 
+supporting documentation, and that the name of CMU not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.  
+
+CMU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+CMU BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+******************************************************************/
+
+#include <net-snmp/net-snmp-config.h>
+
+#include <sys/types.h>
+#ifdef HAVE_LIMITS_H
+#include <limits.h>
+#endif
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#if HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#if HAVE_STRING_H
+#include <string.h>
+#endif
+#if TIME_WITH_SYS_TIME
+# ifdef WIN32
+#  include <sys/timeb.h>
+# else
+#  include <sys/time.h>
+# endif
+# include <time.h>
+#else
+# if HAVE_SYS_TIME_H
+#  include <sys/time.h>
+# else
+#  include <time.h>
+# endif
+#endif
+#if HAVE_SYS_SELECT_H
+#include <sys/select.h>
+#endif
+#if HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+#include <errno.h>
+#if HAVE_WINSOCK_H
+#include <winsock.h>
+#endif
+
+#if HAVE_DMALLOC_H
+#include <dmalloc.h>
+#endif
+
+#define SNMP_NEED_REQUEST_LIST
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include <net-snmp/library/snmp_assert.h>
+
+#ifdef USE_LIBWRAP
+#include <tcpd.h>
+#include <syslog.h>
+int             allow_severity = LOG_INFO;
+int             deny_severity = LOG_WARNING;
+#endif
+
+#include "snmpd.h"
+#include "mibgroup/struct.h"
+#include "mibgroup/util_funcs.h"
+#include <net-snmp/agent/mib_module_config.h>
+
+#ifdef USING_AGENTX_PROTOCOL_MODULE
+#include "agentx/protocol.h"
+#endif
+
+#ifdef USING_AGENTX_MASTER_MODULE
+#include "agentx/master.h"
+#endif
+
+#define SNMP_ADDRCACHE_SIZE 10
+
+struct addrCache {
+    char           *addr;
+    enum { SNMP_ADDRCACHE_UNUSED = 0,
+        SNMP_ADDRCACHE_USED = 1,
+        SNMP_ADDRCACHE_OLD = 2
+    } status;
+};
+
+static struct addrCache addrCache[SNMP_ADDRCACHE_SIZE];
+int             lastAddrAge = 0;
+int             log_addresses = 0;
+
+
+
+typedef struct _agent_nsap {
+    int             handle;
+    netsnmp_transport *t;
+    void           *s;          /*  Opaque internal session pointer.  */
+    struct _agent_nsap *next;
+} agent_nsap;
+
+static agent_nsap *agent_nsap_list = NULL;
+static netsnmp_agent_session *agent_session_list = NULL;
+static netsnmp_agent_session *netsnmp_processing_set = NULL;
+netsnmp_agent_session *agent_delegated_list = NULL;
+netsnmp_agent_session *netsnmp_agent_queued_list = NULL;
+
+
+int             netsnmp_agent_check_packet(netsnmp_session *,
+                                           struct netsnmp_transport_s *,
+                                           void *, int);
+int             netsnmp_agent_check_parse(netsnmp_session *, netsnmp_pdu *,
+                                          int);
+void            delete_subnetsnmp_tree_cache(netsnmp_agent_session *asp);
+int             handle_pdu(netsnmp_agent_session *asp);
+int             netsnmp_handle_request(netsnmp_agent_session *asp,
+                                       int status);
+int             netsnmp_wrap_up_request(netsnmp_agent_session *asp,
+                                        int status);
+int             check_delayed_request(netsnmp_agent_session *asp);
+int             handle_getnext_loop(netsnmp_agent_session *asp);
+int             handle_set_loop(netsnmp_agent_session *asp);
+
+int             netsnmp_check_queued_chain_for(netsnmp_agent_session *asp);
+int             netsnmp_add_queued(netsnmp_agent_session *asp);
+int             netsnmp_remove_from_delegated(netsnmp_agent_session *asp);
+
+
+static int      current_globalid = 0;
+
+int
+netsnmp_allocate_globalcacheid(void)
+{
+    return ++current_globalid;
+}
+
+int
+netsnmp_get_local_cachid(netsnmp_cachemap *cache_store, int globalid)
+{
+    while (cache_store != NULL) {
+        if (cache_store->globalid == globalid)
+            return cache_store->cacheid;
+        cache_store = cache_store->next;
+    }
+    return -1;
+}
+
+netsnmp_cachemap *
+netsnmp_get_or_add_local_cachid(netsnmp_cachemap **cache_store,
+                                int globalid, int localid)
+{
+    netsnmp_cachemap *tmpp;
+
+    tmpp = SNMP_MALLOC_TYPEDEF(netsnmp_cachemap);
+    if (*cache_store) {
+        tmpp->next = *cache_store;
+        *cache_store = tmpp;
+    } else {
+        *cache_store = tmpp;
+    }
+
+    tmpp->globalid = globalid;
+    tmpp->cacheid = localid;
+    return tmpp;
+}
+
+void
+netsnmp_free_cachemap(netsnmp_cachemap *cache_store)
+{
+    netsnmp_cachemap *tmpp;
+    while (cache_store) {
+        tmpp = cache_store;
+        cache_store = cache_store->next;
+        free(tmpp);
+    }
+}
+
+
+typedef struct agent_set_cache_s {
+    /*
+     * match on these 2 
+     */
+    int             transID;
+    netsnmp_session *sess;
+
+    /*
+     * store this info 
+     */
+    netsnmp_tree_cache *treecache;
+    int             treecache_len;
+    int             treecache_num;
+
+    int             vbcount;
+    netsnmp_request_info *requests;
+    netsnmp_data_list *agent_data;
+
+    /*
+     * list 
+     */
+    struct agent_set_cache_s *next;
+} agent_set_cache;
+
+static agent_set_cache *Sets = NULL;
+
+agent_set_cache *
+save_set_cache(netsnmp_agent_session *asp)
+{
+    agent_set_cache *ptr;
+
+    if (!asp->reqinfo || !asp->pdu)
+        return NULL;
+
+    ptr = SNMP_MALLOC_TYPEDEF(agent_set_cache);
+    if (ptr == NULL)
+        return NULL;
+
+    /*
+     * Save the important information 
+     */
+    ptr->transID = asp->pdu->transid;
+    ptr->sess = asp->session;
+    ptr->treecache = asp->treecache;
+    ptr->treecache_len = asp->treecache_len;
+    ptr->treecache_num = asp->treecache_num;
+    ptr->agent_data = asp->reqinfo->agent_data;
+    ptr->requests = asp->requests;
+    ptr->vbcount = asp->vbcount;
+
+    /*
+     * make the agent forget about what we've saved 
+     */
+    asp->treecache = NULL;
+    asp->reqinfo->agent_data = NULL;
+    asp->pdu->variables = NULL;
+    asp->requests = NULL;
+
+    ptr->next = Sets;
+    Sets = ptr;
+
+    return ptr;
+}
+
+int
+get_set_cache(netsnmp_agent_session *asp)
+{
+    agent_set_cache *ptr, *prev = NULL;
+
+    for (ptr = Sets; ptr != NULL; ptr = ptr->next) {
+        if (ptr->sess == asp->session && ptr->transID == asp->pdu->transid) {
+            if (prev)
+                prev->next = ptr->next;
+            else
+                Sets = ptr->next;
+
+            /*
+             * found it.  Get the needed data 
+             */
+            asp->treecache = ptr->treecache;
+            asp->treecache_len = ptr->treecache_len;
+            asp->treecache_num = ptr->treecache_num;
+            asp->requests = ptr->requests;
+            asp->vbcount = ptr->vbcount;
+            if (!asp->reqinfo) {
+                asp->reqinfo =
+                    SNMP_MALLOC_TYPEDEF(netsnmp_agent_request_info);
+                if (asp->reqinfo) {
+                    asp->reqinfo->asp = asp;
+                    asp->reqinfo->agent_data = ptr->agent_data;
+                }
+            }
+            free(ptr);
+            return SNMP_ERR_NOERROR;
+        }
+        prev = ptr;
+    }
+    return SNMP_ERR_GENERR;
+}
+
+int
+getNextSessID()
+{
+    static int      SessionID = 0;
+
+    return ++SessionID;
+}
+
+int
+agent_check_and_process(int block)
+{
+    int             numfds;
+    fd_set          fdset;
+    struct timeval  timeout = { LONG_MAX, 0 }, *tvp = &timeout;
+    int             count;
+    int             fakeblock = 0;
+
+    numfds = 0;
+    FD_ZERO(&fdset);
+    snmp_select_info(&numfds, &fdset, tvp, &fakeblock);
+    if (block != 0 && fakeblock != 0) {
+        /*
+         * There are no alarms registered, and the caller asked for blocking, so
+         * let select() block forever.  
+         */
+
+        tvp = NULL;
+    } else if (block != 0 && fakeblock == 0) {
+        /*
+         * The caller asked for blocking, but there is an alarm due sooner than
+         * LONG_MAX seconds from now, so use the modified timeout returned by
+         * snmp_select_info as the timeout for select().  
+         */
+
+    } else if (block == 0) {
+        /*
+         * The caller does not want us to block at all.  
+         */
+
+        tvp->tv_sec = 0;
+        tvp->tv_usec = 0;
+    }
+
+    count = select(numfds, &fdset, 0, 0, tvp);
+
+    if (count > 0) {
+        /*
+         * packets found, process them 
+         */
+        snmp_read(&fdset);
+    } else
+        switch (count) {
+        case 0:
+            snmp_timeout();
+            break;
+        case -1:
+            if (errno != EINTR) {
+                snmp_log_perror("select");
+            }
+            return -1;
+        default:
+            snmp_log(LOG_ERR, "select returned %d\n", count);
+            return -1;
+        }                       /* endif -- count>0 */
+
+    /*
+     * Run requested alarms.  
+     */
+    run_alarms();
+
+    return count;
+}
+
+
+
+/*
+ * Set up the address cache.  
+ */
+void
+netsnmp_addrcache_initialise(void)
+{
+    int             i = 0;
+
+    for (i = 0; i < SNMP_ADDRCACHE_SIZE; i++) {
+        addrCache[i].addr = NULL;
+        addrCache[i].status = SNMP_ADDRCACHE_UNUSED;
+    }
+}
+
+
+
+/*
+ * Age the entries in the address cache.  
+ */
+
+void
+netsnmp_addrcache_age(void)
+{
+    int             i = 0;
+
+    lastAddrAge = 0;
+    for (i = 0; i < SNMP_ADDRCACHE_SIZE; i++) {
+        if (addrCache[i].status == SNMP_ADDRCACHE_OLD) {
+            addrCache[i].status = SNMP_ADDRCACHE_UNUSED;
+            if (addrCache[i].addr != NULL) {
+                free(addrCache[i].addr);
+                addrCache[i].addr = NULL;
+            }
+        }
+        if (addrCache[i].status == SNMP_ADDRCACHE_USED) {
+            addrCache[i].status = SNMP_ADDRCACHE_OLD;
+        }
+    }
+}
+
+/*******************************************************************-o-******
+ * netsnmp_agent_check_packet
+ *
+ * Parameters:
+ *	session, transport, transport_data, transport_data_length
+ *      
+ * Returns:
+ *	1	On success.
+ *	0	On error.
+ *
+ * Handler for all incoming messages (a.k.a. packets) for the agent.  If using
+ * the libwrap utility, log the connection and deny/allow the access. Print
+ * output when appropriate, and increment the incoming counter.
+ *
+ */
+
+int
+netsnmp_agent_check_packet(netsnmp_session * session,
+                           netsnmp_transport *transport,
+                           void *transport_data, int transport_data_length)
+{
+    char           *addr_string = NULL;
+    int             i = 0;
+
+    /*
+     * Log the message and/or dump the message.
+     * Optionally cache the network address of the sender.
+     */
+
+    if (transport != NULL && transport->f_fmtaddr != NULL) {
+        /*
+         * Okay I do know how to format this address for logging.  
+         */
+        addr_string = transport->f_fmtaddr(transport, transport_data,
+                                           transport_data_length);
+        /*
+         * Don't forget to free() it.  
+         */
+    }
+#ifdef  USE_LIBWRAP
+    if (addr_string != NULL) {
+        if (hosts_ctl("snmpd", STRING_UNKNOWN, addr_string, STRING_UNKNOWN)) {
+            snmp_log(allow_severity, "Connection from %s\n", addr_string);
+        } else {
+            snmp_log(deny_severity, "Connection from %s REFUSED\n",
+                     addr_string);
+            free(addr_string);
+            return 0;
+        }
+    } else {
+        if (hosts_ctl("snmp", STRING_UNKNOWN, STRING_UNKNOWN, STRING_UNKNOWN)){
+            snmp_log(allow_severity, "Connection from <UNKNOWN>\n");
+            addr_string = strdup("<UNKNOWN>");
+        } else {
+            snmp_log(deny_severity, "Connection from <UNKNOWN> REFUSED\n");
+            return 0;
+        }
+    }
+#endif                          /*USE_LIBWRAP */
+
+    snmp_increment_statistic(STAT_SNMPINPKTS);
+
+    if (log_addresses || netsnmp_ds_get_boolean(NETSNMP_DS_APPLICATION_ID, 
+						NETSNMP_DS_AGENT_VERBOSE)) {
+        for (i = 0; i < SNMP_ADDRCACHE_SIZE; i++) {
+            if ((addrCache[i].status != SNMP_ADDRCACHE_UNUSED) &&
+                (strcmp(addrCache[i].addr, addr_string) == 0)) {
+                break;
+            }
+        }
+
+        if (i >= SNMP_ADDRCACHE_SIZE ||
+	    netsnmp_ds_get_boolean(NETSNMP_DS_APPLICATION_ID, 
+				   NETSNMP_DS_AGENT_VERBOSE)) {
+            /*
+             * Address wasn't in the cache, so log the packet...  
+             */
+            snmp_log(LOG_INFO, "Received SNMP packet(s) from %s\n",
+                     addr_string);
+            /*
+             * ...and try to cache the address.  
+             */
+            for (i = 0; i < SNMP_ADDRCACHE_SIZE; i++) {
+                if (addrCache[i].status == SNMP_ADDRCACHE_UNUSED) {
+                    if (addrCache[i].addr != NULL) {
+                        free(addrCache[i].addr);
+                    }
+                    addrCache[i].addr = addr_string;
+                    addrCache[i].status = SNMP_ADDRCACHE_USED;
+                    addr_string = NULL; /* Don't free this 'temporary' string
+                                         * since it's now part of the cache */
+                    break;
+                }
+            }
+            if (i >= SNMP_ADDRCACHE_SIZE) {
+                /*
+                 * We didn't find a free slot to cache the address.  Perhaps
+                 * we should be using an LRU replacement policy here or
+                 * something.  Oh well.
+                 */
+                DEBUGMSGTL(("netsnmp_agent_check_packet",
+                            "cache overrun"));
+            }
+        } else {
+            addrCache[i].status = SNMP_ADDRCACHE_USED;
+        }
+    }
+
+    if (addr_string != NULL) {
+        free(addr_string);
+        addr_string = NULL;
+    }
+    return 1;
+}
+
+
+int
+netsnmp_agent_check_parse(netsnmp_session * session, netsnmp_pdu *pdu,
+                          int result)
+{
+    if (result == 0) {
+        if (snmp_get_do_logging() &&
+	    netsnmp_ds_get_boolean(NETSNMP_DS_APPLICATION_ID, 
+				   NETSNMP_DS_AGENT_VERBOSE)) {
+            netsnmp_variable_list *var_ptr;
+
+            switch (pdu->command) {
+            case SNMP_MSG_GET:
+                snmp_log(LOG_DEBUG, "  GET message\n");
+                break;
+            case SNMP_MSG_GETNEXT:
+                snmp_log(LOG_DEBUG, "  GETNEXT message\n");
+                break;
+            case SNMP_MSG_RESPONSE:
+                snmp_log(LOG_DEBUG, "  RESPONSE message\n");
+                break;
+            case SNMP_MSG_SET:
+                snmp_log(LOG_DEBUG, "  SET message\n");
+                break;
+            case SNMP_MSG_TRAP:
+                snmp_log(LOG_DEBUG, "  TRAP message\n");
+                break;
+            case SNMP_MSG_GETBULK:
+                snmp_log(LOG_DEBUG, "  GETBULK message, non-rep=%d, max_rep=%d\n",
+                         pdu->errstat, pdu->errindex);
+                break;
+            case SNMP_MSG_INFORM:
+                snmp_log(LOG_DEBUG, "  INFORM message\n");
+                break;
+            case SNMP_MSG_TRAP2:
+                snmp_log(LOG_DEBUG, "  TRAP2 message\n");
+                break;
+            case SNMP_MSG_REPORT:
+                snmp_log(LOG_DEBUG, "  REPORT message\n");
+                break;
+
+            case SNMP_MSG_INTERNAL_SET_RESERVE1:
+                snmp_log(LOG_DEBUG, "  INTERNAL RESERVE1 message\n");
+                break;
+
+            case SNMP_MSG_INTERNAL_SET_RESERVE2:
+                snmp_log(LOG_DEBUG, "  INTERNAL RESERVE2 message\n");
+                break;
+
+            case SNMP_MSG_INTERNAL_SET_ACTION:
+                snmp_log(LOG_DEBUG, "  INTERNAL ACTION message\n");
+                break;
+
+            case SNMP_MSG_INTERNAL_SET_COMMIT:
+                snmp_log(LOG_DEBUG, "  INTERNAL COMMIT message\n");
+                break;
+
+            case SNMP_MSG_INTERNAL_SET_FREE:
+                snmp_log(LOG_DEBUG, "  INTERNAL FREE message\n");
+                break;
+
+            case SNMP_MSG_INTERNAL_SET_UNDO:
+                snmp_log(LOG_DEBUG, "  INTERNAL UNDO message\n");
+                break;
+
+            default:
+                snmp_log(LOG_DEBUG, "  UNKNOWN message, type=%02X\n",
+                         pdu->command);
+                snmp_increment_statistic(STAT_SNMPINASNPARSEERRS);
+                return 0;
+            }
+
+            for (var_ptr = pdu->variables; var_ptr != NULL;
+                 var_ptr = var_ptr->next_variable) {
+                size_t          c_oidlen = 256, c_outlen = 0;
+                u_char         *c_oid = (u_char *) malloc(c_oidlen);
+
+                if (c_oid) {
+                    if (!sprint_realloc_objid
+                        (&c_oid, &c_oidlen, &c_outlen, 1, var_ptr->name,
+                         var_ptr->name_length)) {
+                        snmp_log(LOG_DEBUG, "    -- %s [TRUNCATED]\n",
+                                 c_oid);
+                    } else {
+                        snmp_log(LOG_DEBUG, "    -- %s\n", c_oid);
+                    }
+                    free(c_oid);
+                }
+            }
+        }
+        return 1;
+    }
+    return 0;                   /* XXX: does it matter what the return value
+                                 * is?  Yes: if we return 0, then the PDU is
+                                 * dumped.  */
+}
+
+
+/*
+ * Global access to the primary session structure for this agent.
+ * for Index Allocation use initially. 
+ */
+
+/*
+ * I don't understand what this is for at the moment.  AFAICS as long as it
+ * gets set and points at a session, that's fine.  ???  
+ */
+
+netsnmp_session *main_session = NULL;
+
+
+
+/*
+ * Set up an agent session on the given transport.  Return a handle
+ * which may later be used to de-register this transport.  A return
+ * value of -1 indicates an error.  
+ */
+
+int
+netsnmp_register_agent_nsap(netsnmp_transport *t)
+{
+    netsnmp_session *s, *sp = NULL;
+    agent_nsap     *a = NULL, *n = NULL, **prevNext = &agent_nsap_list;
+    int             handle = 0;
+    void           *isp = NULL;
+
+    if (t == NULL) {
+        return -1;
+    }
+
+    DEBUGMSGTL(("netsnmp_register_agent_nsap", "fd %d\n", t->sock));
+
+    n = (agent_nsap *) malloc(sizeof(agent_nsap));
+    if (n == NULL) {
+        return -1;
+    }
+    s = (netsnmp_session *) malloc(sizeof(netsnmp_session));
+    if (s == NULL) {
+        free(n);
+        return -1;
+    }
+    memset(s, 0, sizeof(netsnmp_session));
+    snmp_sess_init(s);
+
+    /*
+     * Set up the session appropriately for an agent.  
+     */
+
+    s->version = SNMP_DEFAULT_VERSION;
+    s->callback = handle_snmp_packet;
+    s->authenticator = NULL;
+    s->flags = netsnmp_ds_get_int(NETSNMP_DS_APPLICATION_ID, 
+				  NETSNMP_DS_AGENT_FLAGS);
+    s->isAuthoritative = SNMP_SESS_AUTHORITATIVE;
+
+    sp = snmp_add(s, t, netsnmp_agent_check_packet,
+                  netsnmp_agent_check_parse);
+    if (sp == NULL) {
+        free(s);
+        free(n);
+        return -1;
+    }
+
+    isp = snmp_sess_pointer(sp);
+    if (isp == NULL) {          /*  over-cautious  */
+        free(s);
+        free(n);
+        return -1;
+    }
+
+    n->s = isp;
+    n->t = t;
+
+    if (main_session == NULL) {
+        main_session = snmp_sess_session(isp);
+    }
+
+    for (a = agent_nsap_list; a != NULL && handle + 1 >= a->handle;
+         a = a->next) {
+        handle = a->handle;
+        prevNext = &(a->next);
+    }
+
+    if (handle < INT_MAX) {
+        n->handle = handle + 1;
+        n->next = a;
+        *prevNext = n;
+        free(s);
+        return n->handle;
+    } else {
+        free(s);
+        free(n);
+        return -1;
+    }
+}
+
+void
+netsnmp_deregister_agent_nsap(int handle)
+{
+    agent_nsap     *a = NULL, **prevNext = &agent_nsap_list;
+    int             main_session_deregistered = 0;
+
+    DEBUGMSGTL(("netsnmp_deregister_agent_nsap", "handle %d\n", handle));
+
+    for (a = agent_nsap_list; a != NULL && a->handle < handle; a = a->next) {
+        prevNext = &(a->next);
+    }
+
+    if (a != NULL && a->handle == handle) {
+        *prevNext = a->next;
+        if (main_session == snmp_sess_session(a->s)) {
+            main_session_deregistered = 1;
+        }
+        snmp_close(snmp_sess_session(a->s));
+        /*
+         * The above free()s the transport and session pointers.  
+         */
+        free(a);
+    }
+
+    /*
+     * If we've deregistered the session that main_session used to point to,
+     * then make it point to another one, or in the last resort, make it equal
+     * to NULL.  Basically this shouldn't ever happen in normal operation
+     * because main_session starts off pointing at the first session added by
+     * init_master_agent(), which then discards the handle.  
+     */
+
+    if (main_session_deregistered) {
+        if (agent_nsap_list != NULL) {
+            DEBUGMSGTL(("snmp_agent",
+			"WARNING: main_session ptr changed from %p to %p\n",
+                        main_session, snmp_sess_session(agent_nsap_list->s)));
+            main_session = snmp_sess_session(agent_nsap_list->s);
+        } else {
+            DEBUGMSGTL(("snmp_agent",
+			"WARNING: main_session ptr changed from %p to NULL\n",
+                        main_session));
+            main_session = NULL;
+        }
+    }
+}
+
+
+
+/*
+ * 
+ * This function has been modified to use the experimental
+ * netsnmp_register_agent_nsap interface.  The major responsibility of this
+ * function now is to interpret a string specified to the agent (via -p on the
+ * command line, or from a configuration file) as a list of agent NSAPs on
+ * which to listen for SNMP packets.  Typically, when you add a new transport
+ * domain "foo", you add code here such that if the "foo" code is compiled
+ * into the agent (SNMP_TRANSPORT_FOO_DOMAIN is defined), then a token of the
+ * form "foo:bletch-3a0054ef%wob&wob" gets turned into the appropriate
+ * transport descriptor.  netsnmp_register_agent_nsap is then called with that
+ * transport descriptor and sets up a listening agent session on it.
+ * 
+ * Everything then works much as normal: the agent runs in an infinite loop
+ * (in the snmpd.c/receive()routine), which calls snmp_read() when a request
+ * is readable on any of the given transports.  This routine then traverses
+ * the library 'Sessions' list to identify the relevant session and eventually
+ * invokes '_sess_read'.  This then processes the incoming packet, calling the
+ * pre_parse, parse, post_parse and callback routines in turn.
+ * 
+ * JBPN 20001117
+ */
+
+int
+init_master_agent(void)
+{
+    netsnmp_transport *transport;
+    char           *cptr;
+    char            buf[SPRINT_MAX_LEN];
+
+    /* default to turning off lookup caching */
+    netsnmp_set_lookup_cache_size(0);
+
+    if (netsnmp_ds_get_boolean(NETSNMP_DS_APPLICATION_ID, 
+			       NETSNMP_DS_AGENT_ROLE) != MASTER_AGENT) {
+        DEBUGMSGTL(("snmp_agent",
+                    "init_master_agent; not master agent\n"));
+        return 0;               /*  No error if ! MASTER_AGENT  */
+    }
+#ifdef USING_AGENTX_MASTER_MODULE
+    if (netsnmp_ds_get_boolean(NETSNMP_DS_APPLICATION_ID, 
+			       NETSNMP_DS_AGENT_AGENTX_MASTER) == 1)
+        real_init_master();
+#endif
+
+    /*
+     * Have specific agent ports been specified?  
+     */
+    cptr = netsnmp_ds_get_string(NETSNMP_DS_APPLICATION_ID, 
+				 NETSNMP_DS_AGENT_PORTS);
+
+    if (cptr) {
+        snprintf(buf, sizeof(buf), "%s", cptr);
+        buf[ sizeof(buf)-1 ] = 0;
+    } else {
+        /*
+         * No, so just specify the default port.  
+         */
+        if (netsnmp_ds_get_int(NETSNMP_DS_APPLICATION_ID, NETSNMP_DS_AGENT_FLAGS) & SNMP_FLAGS_STREAM_SOCKET) {
+            sprintf(buf, "tcp:%d", SNMP_PORT);
+        } else {
+            sprintf(buf, "udp:%d", SNMP_PORT);
+        }
+    }
+
+    DEBUGMSGTL(("snmp_agent", "final port spec: %s\n", buf));
+    cptr = strtok(buf, ",");
+    while (cptr) {
+        /*
+         * Specification format: 
+         * 
+         * NONE:                      (a pseudo-transport)
+         * UDP:[address:]port        (also default if no transport is specified)
+         * TCP:[address:]port         (if supported)
+         * Unix:pathname              (if supported)
+         * AAL5PVC:itf.vpi.vci        (if supported)
+         * IPX:[network]:node[/port] (if supported)
+         * 
+         */
+
+        DEBUGMSGTL(("snmp_agent", "installing master agent on port %s\n",
+                    cptr));
+
+        if (!cptr || !(*cptr)) {
+            snmp_log(LOG_ERR, "improper port specification\n");
+            return 1;
+        }
+
+        if (strncasecmp(cptr, "none", 4) == 0) {
+            DEBUGMSGTL(("snmp_agent",
+                        "init_master_agent; pseudo-transport \"none\" requested\n"));
+            return 0;
+        }
+        transport = netsnmp_tdomain_transport(cptr, 1, "udp");
+
+        if (transport == NULL) {
+            snmp_log(LOG_ERR, "Error opening specified endpoint \"%s\"\n",
+                     cptr);
+            return 1;
+        }
+
+        if (netsnmp_register_agent_nsap(transport) == 0) {
+            snmp_log(LOG_ERR,
+                     "Error registering specified transport \"%s\" as an agent NSAP\n",
+                     cptr);
+            return 1;
+        } else {
+            DEBUGMSGTL(("snmp_agent",
+                        "init_master_agent; \"%s\" registered as an agent NSAP\n",
+                        cptr));
+        }
+
+        /*
+         * Next transport please...  
+         */
+        cptr = strtok(NULL, ",");
+    }
+
+    return 0;
+}
+
+
+
+netsnmp_agent_session *
+init_agent_snmp_session(netsnmp_session * session, netsnmp_pdu *pdu)
+{
+    netsnmp_agent_session *asp = (netsnmp_agent_session *)
+        calloc(1, sizeof(netsnmp_agent_session));
+
+    if (asp == NULL) {
+        return NULL;
+    }
+
+    DEBUGMSGTL(("snmp_agent","agent_sesion %08p created\n", asp));
+    asp->session = session;
+    asp->pdu = snmp_clone_pdu(pdu);
+    asp->orig_pdu = snmp_clone_pdu(pdu);
+    asp->rw = READ;
+    asp->exact = TRUE;
+    asp->next = NULL;
+    asp->mode = RESERVE1;
+    asp->status = SNMP_ERR_NOERROR;
+    asp->index = 0;
+    asp->oldmode = 0;
+    asp->treecache_num = -1;
+    asp->treecache_len = 0;
+
+    return asp;
+}
+
+void
+free_agent_snmp_session(netsnmp_agent_session *asp)
+{
+    if (!asp)
+        return;
+
+    DEBUGMSGTL(("snmp_agent","agent_sesion %08p released\n", asp));
+
+    netsnmp_remove_from_delegated(asp);
+    
+    if (asp->orig_pdu)
+        snmp_free_pdu(asp->orig_pdu);
+    if (asp->pdu)
+        snmp_free_pdu(asp->pdu);
+    if (asp->reqinfo)
+        netsnmp_free_agent_request_info(asp->reqinfo);
+    if (asp->treecache) {
+        free(asp->treecache);
+    }
+    if (asp->bulkcache) {
+        free(asp->bulkcache);
+    }
+    if (asp->requests) {
+        int             i;
+        for (i = 0; i < asp->vbcount; i++) {
+            netsnmp_free_request_data_sets(&asp->requests[i]);
+        }
+    }
+    if (asp->requests) {
+        free(asp->requests);
+    }
+    if (asp->cache_store) {
+        netsnmp_free_cachemap(asp->cache_store);
+        asp->cache_store = NULL;
+    }
+    free(asp);
+}
+
+int
+netsnmp_check_for_delegated(netsnmp_agent_session *asp)
+{
+    int             i;
+    netsnmp_request_info *request;
+
+    if (NULL == asp->treecache)
+        return 0;
+    
+    for (i = 0; i <= asp->treecache_num; i++) {
+        for (request = asp->treecache[i].requests_begin; request;
+             request = request->next) {
+            if (request->delegated)
+                return 1;
+        }
+    }
+    return 0;
+}
+
+int
+netsnmp_check_delegated_chain_for(netsnmp_agent_session *asp)
+{
+    netsnmp_agent_session *asptmp;
+    for (asptmp = agent_delegated_list; asptmp; asptmp = asptmp->next) {
+        if (asptmp == asp)
+            return 1;
+    }
+    return 0;
+}
+
+int
+netsnmp_check_for_delegated_and_add(netsnmp_agent_session *asp)
+{
+    if (netsnmp_check_for_delegated(asp)) {
+        if (!netsnmp_check_delegated_chain_for(asp)) {
+            /*
+             * add to delegated request chain 
+             */
+            asp->next = agent_delegated_list;
+            agent_delegated_list = asp;
+            DEBUGMSGTL(("snmp_agent", "delegate session == %08p\n", asp));
+        }
+        return 1;
+    }
+    return 0;
+}
+
+int
+netsnmp_remove_from_delegated(netsnmp_agent_session *asp)
+{
+    netsnmp_agent_session *curr, *prev = NULL;
+    
+    for (curr = agent_delegated_list; curr; prev = curr, curr = curr->next) {
+        /*
+         * is this us?
+         */
+        if (curr != asp)
+            continue;
+        
+        /*
+         * remove from queue 
+         */
+        if (prev != NULL)
+            prev->next = asp->next;
+        else
+            agent_delegated_list = asp->next;
+
+        DEBUGMSGTL(("snmp_agent", "remove delegated session == %08p\n", asp));
+
+        return 1;
+    }
+
+    return 0;
+}
+
+/*
+ * netsnmp_remove_delegated_requests_for_session
+ *
+ * called when a session is being closed. Check all delegated requests to
+ * see if the are waiting on this session, and if set, set the status for
+ * that request to GENERR.
+ */
+int
+netsnmp_remove_delegated_requests_for_session(netsnmp_session *sess)
+{
+    netsnmp_agent_session *asp;
+    int count = 0;
+    
+    for (asp = agent_delegated_list; asp; asp = asp->next) {
+        /*
+         * check each request
+         */
+        netsnmp_request_info *request;
+        for(request = asp->requests; request; request = request->next) {
+            /*
+             * check session
+             */
+            netsnmp_assert(NULL!=request->subtree);
+            if(request->subtree->session != sess)
+                continue;
+
+            /*
+             * matched! mark request as done
+             */
+            netsnmp_set_mode_request_error(MODE_SET_BEGIN, request,
+                                           SNMP_ERR_GENERR);
+            ++count;
+        }
+    }
+
+    /*
+     * if we found any, that request may be finished now
+     */
+    if(count) {
+        DEBUGMSGTL(("snmp_agent", "removed %d delegated request(s) for session "
+                    "%08p\n", count, sess));
+        netsnmp_check_outstanding_agent_requests();
+    }
+    
+    return count;
+}
+
+int
+netsnmp_check_queued_chain_for(netsnmp_agent_session *asp)
+{
+    netsnmp_agent_session *asptmp;
+    for (asptmp = netsnmp_agent_queued_list; asptmp; asptmp = asptmp->next) {
+        if (asptmp == asp)
+            return 1;
+    }
+    return 0;
+}
+
+int
+netsnmp_add_queued(netsnmp_agent_session *asp)
+{
+    netsnmp_agent_session *asp_tmp;
+
+    /*
+     * first item?
+     */
+    if (NULL == netsnmp_agent_queued_list) {
+        netsnmp_agent_queued_list = asp;
+        return 1;
+    }
+
+
+    /*
+     * add to end of queued request chain 
+     */
+    asp_tmp = netsnmp_agent_queued_list;
+    for (; asp_tmp; asp_tmp = asp_tmp->next) {
+        /*
+         * already in queue?
+         */
+        if (asp_tmp == asp)
+            break;
+
+        /*
+         * end of queue?
+         */
+        if (NULL == asp_tmp->next)
+            asp_tmp->next = asp;
+    }
+    return 1;
+}
+
+
+int
+netsnmp_wrap_up_request(netsnmp_agent_session *asp, int status)
+{
+    netsnmp_variable_list *var_ptr;
+    int             i, n = 0, r = 0;
+
+    /*
+     * if this request was a set, clear the global now that we are
+     * done.
+     */
+    if (asp == netsnmp_processing_set) {
+        DEBUGMSGTL(("snmp_agent", "SET request complete, asp = %08p\n",
+                    asp));
+        netsnmp_processing_set = NULL;
+    }
+
+    /*
+     * some stuff needs to be saved in special subagent cases 
+     */
+    if (asp->pdu) {
+
+        switch (asp->pdu->command) {
+            case SNMP_MSG_INTERNAL_SET_BEGIN:
+            case SNMP_MSG_INTERNAL_SET_RESERVE1:
+            case SNMP_MSG_INTERNAL_SET_RESERVE2:
+            case SNMP_MSG_INTERNAL_SET_ACTION:
+                save_set_cache(asp);
+                break;
+        }
+
+        /*
+         * if this is a GETBULK response we need to rearrange the varbinds 
+         */
+        if (asp->pdu->command == SNMP_MSG_GETBULK) {
+            int             repeats = asp->pdu->errindex;
+            int             j;
+            
+            if (asp->pdu->errstat < asp->vbcount) {
+                n = asp->pdu->errstat;
+            } else {
+                n = asp->vbcount;
+            }
+            if ((r = asp->vbcount - n) < 0) {
+                r = 0;
+            }
+            
+            for (i = 0; i < r - 1; i++) {
+                for (j = 0; j < repeats; j++) {
+                    asp->bulkcache[i * repeats + j]->next_variable =
+                        asp->bulkcache[(i + 1) * repeats + j];
+                }
+            }
+            if (r > 0) {
+                for (j = 0; j < repeats - 1; j++) {
+                    asp->bulkcache[(r - 1) * repeats + j]->next_variable =
+                        asp->bulkcache[j + 1];
+                }
+            }
+        }
+
+        /*
+         * May need to "dumb down" a SET error status for a
+         * v1 query.  See RFC2576 - section 4.3
+         */
+        if ((asp->pdu->command == SNMP_MSG_SET) &&
+            (asp->pdu->version == SNMP_VERSION_1)) {
+            switch (status) {
+                case SNMP_ERR_WRONGVALUE:
+                case SNMP_ERR_WRONGENCODING:
+                case SNMP_ERR_WRONGTYPE:
+                case SNMP_ERR_WRONGLENGTH:
+                case SNMP_ERR_INCONSISTENTVALUE:
+                    status = SNMP_ERR_BADVALUE;
+                    asp->status = SNMP_ERR_BADVALUE;
+                    break;
+                case SNMP_ERR_NOACCESS:
+                case SNMP_ERR_NOTWRITABLE:
+                case SNMP_ERR_NOCREATION:
+                case SNMP_ERR_INCONSISTENTNAME:
+                case SNMP_ERR_AUTHORIZATIONERROR:
+                    status = SNMP_ERR_NOSUCHNAME;
+                    asp->status = SNMP_ERR_NOSUCHNAME;
+                    break;
+                case SNMP_ERR_RESOURCEUNAVAILABLE:
+                case SNMP_ERR_COMMITFAILED:
+                case SNMP_ERR_UNDOFAILED:
+                    status = SNMP_ERR_GENERR;
+                    asp->status = SNMP_ERR_GENERR;
+                    break;
+            }
+        }
+        /*
+         * Similarly we may need to "dumb down" v2 exception
+         *  types to throw an error for a v1 query.
+         *  See RFC2576 - section 4.1.2.3
+         */
+        if ((asp->pdu->command != SNMP_MSG_SET) &&
+            (asp->pdu->version == SNMP_VERSION_1)) {
+            for (var_ptr = asp->pdu->variables, i = 1;
+                 var_ptr != NULL; var_ptr = var_ptr->next_variable, i++) {
+                switch (var_ptr->type) {
+                    case SNMP_NOSUCHOBJECT:
+                    case SNMP_NOSUCHINSTANCE:
+                    case SNMP_ENDOFMIBVIEW:
+                    case ASN_COUNTER64:
+                        status = SNMP_ERR_NOSUCHNAME;
+                        asp->status = SNMP_ERR_NOSUCHNAME;
+                        asp->index = i;
+                        break;
+                }
+            }
+        }
+    } /** if asp->pdu */
+
+    /*
+     * Update the snmp error-count statistics
+     *   XXX - should we include the V2 errors in this or not?
+     */
+#define INCLUDE_V2ERRORS_IN_V1STATS
+
+    switch (status) {
+#ifdef INCLUDE_V2ERRORS_IN_V1STATS
+    case SNMP_ERR_WRONGVALUE:
+    case SNMP_ERR_WRONGENCODING:
+    case SNMP_ERR_WRONGTYPE:
+    case SNMP_ERR_WRONGLENGTH:
+    case SNMP_ERR_INCONSISTENTVALUE:
+#endif
+    case SNMP_ERR_BADVALUE:
+        snmp_increment_statistic(STAT_SNMPOUTBADVALUES);
+        break;
+#ifdef INCLUDE_V2ERRORS_IN_V1STATS
+    case SNMP_ERR_NOACCESS:
+    case SNMP_ERR_NOTWRITABLE:
+    case SNMP_ERR_NOCREATION:
+    case SNMP_ERR_INCONSISTENTNAME:
+    case SNMP_ERR_AUTHORIZATIONERROR:
+#endif
+    case SNMP_ERR_NOSUCHNAME:
+        snmp_increment_statistic(STAT_SNMPOUTNOSUCHNAMES);
+        break;
+#ifdef INCLUDE_V2ERRORS_IN_V1STATS
+    case SNMP_ERR_RESOURCEUNAVAILABLE:
+    case SNMP_ERR_COMMITFAILED:
+    case SNMP_ERR_UNDOFAILED:
+#endif
+    case SNMP_ERR_GENERR:
+        snmp_increment_statistic(STAT_SNMPOUTGENERRS);
+        break;
+
+    case SNMP_ERR_TOOBIG:
+        snmp_increment_statistic(STAT_SNMPOUTTOOBIGS);
+        break;
+    }
+
+    if ((status == SNMP_ERR_NOERROR) && (asp->pdu)) {
+        snmp_increment_statistic_by((asp->pdu->command == SNMP_MSG_SET ?
+                                     STAT_SNMPINTOTALSETVARS :
+                                     STAT_SNMPINTOTALREQVARS),
+                                    count_varbinds(asp->pdu->variables));
+    } else {
+        /*
+         * Use a copy of the original request
+         *   to report failures.
+         */
+        snmp_free_pdu(asp->pdu);
+        asp->pdu = asp->orig_pdu;
+        asp->orig_pdu = NULL;
+    }
+    if (asp->pdu) {
+        asp->pdu->command = SNMP_MSG_RESPONSE;
+        asp->pdu->errstat = asp->status;
+        asp->pdu->errindex = asp->index;
+        if (!snmp_send(asp->session, asp->pdu)) {
+            snmp_free_pdu(asp->pdu);
+            asp->pdu = NULL;
+        }
+        snmp_increment_statistic(STAT_SNMPOUTPKTS);
+        snmp_increment_statistic(STAT_SNMPOUTGETRESPONSES);
+        asp->pdu = NULL;
+        netsnmp_remove_and_free_agent_snmp_session(asp);
+    }
+    return 1;
+}
+
+void
+dump_sess_list(void)
+{
+    netsnmp_agent_session *a;
+
+    DEBUGMSGTL(("snmp_agent", "DUMP agent_sess_list -> "));
+    for (a = agent_session_list; a != NULL; a = a->next) {
+        DEBUGMSG(("snmp_agent", "%08p[session %08p] -> ", a, a->session));
+    }
+    DEBUGMSG(("snmp_agent", "[NIL]\n"));
+}
+
+void
+netsnmp_remove_and_free_agent_snmp_session(netsnmp_agent_session *asp)
+{
+    netsnmp_agent_session *a, **prevNext = &agent_session_list;
+
+    DEBUGMSGTL(("snmp_agent", "REMOVE session == %08p\n", asp));
+
+    for (a = agent_session_list; a != NULL; a = *prevNext) {
+        if (a == asp) {
+            *prevNext = a->next;
+            a->next = NULL;
+            free_agent_snmp_session(a);
+            asp = NULL;
+            break;
+        } else {
+            prevNext = &(a->next);
+        }
+    }
+
+    if (a == NULL && asp != NULL) {
+        /*
+         * We coulnd't find it on the list, so free it anyway.  
+         */
+        free_agent_snmp_session(asp);
+    }
+}
+
+void
+netsnmp_free_agent_snmp_session_by_session(netsnmp_session * sess,
+                                           void (*free_request)
+                                           (netsnmp_request_list *))
+{
+    netsnmp_agent_session *a, *next, **prevNext = &agent_session_list;
+
+    DEBUGMSGTL(("snmp_agent", "REMOVE session == %08p\n", sess));
+
+    for (a = agent_session_list; a != NULL; a = next) {
+        if (a->session == sess) {
+            *prevNext = a->next;
+            next = a->next;
+            free_agent_snmp_session(a);
+        } else {
+            prevNext = &(a->next);
+            next = a->next;
+        }
+    }
+}
+
+/** handles an incoming SNMP packet into the agent */
+int
+handle_snmp_packet(int op, netsnmp_session * session, int reqid,
+                   netsnmp_pdu *pdu, void *magic)
+{
+    netsnmp_agent_session *asp;
+    int             status, access_ret, rc;
+
+    /*
+     * We only support receiving here.  
+     */
+    if (op != NETSNMP_CALLBACK_OP_RECEIVED_MESSAGE) {
+        return 1;
+    }
+
+    /*
+     * RESPONSE messages won't get this far, but TRAP-like messages
+     * might.  
+     */
+    if (pdu->command == SNMP_MSG_TRAP || pdu->command == SNMP_MSG_INFORM ||
+        pdu->command == SNMP_MSG_TRAP2) {
+        DEBUGMSGTL(("snmp_agent", "received trap-like PDU (%02x)\n",
+                    pdu->command));
+        pdu->command = SNMP_MSG_TRAP2;
+        snmp_increment_statistic(STAT_SNMPUNKNOWNPDUHANDLERS);
+        return 1;
+    }
+
+    if (magic == NULL) {
+        asp = init_agent_snmp_session(session, pdu);
+        status = SNMP_ERR_NOERROR;
+    } else {
+        asp = (netsnmp_agent_session *) magic;
+        status = asp->status;
+    }
+
+    if ((access_ret = check_access(pdu)) != 0) {
+        if (access_ret == VACM_NOSUCHCONTEXT) {
+            /*
+             * rfc2573 section 3.2, step 5 says that we increment the
+             * counter but don't return a response of any kind 
+             */
+
+            /*
+             * we currently don't support unavailable contexts, as
+             * there is no reason to that I currently know of 
+             */
+            snmp_increment_statistic(STAT_SNMPUNKNOWNCONTEXTS);
+
+            /*
+             * drop the request 
+             */
+            netsnmp_remove_and_free_agent_snmp_session(asp);
+            return 0;
+        } else {
+            /*
+             * access control setup is incorrect 
+             */
+            send_easy_trap(SNMP_TRAP_AUTHFAIL, 0);
+            if (asp->pdu->version != SNMP_VERSION_1
+                && asp->pdu->version != SNMP_VERSION_2c) {
+                asp->pdu->errstat = SNMP_ERR_AUTHORIZATIONERROR;
+                asp->pdu->command = SNMP_MSG_RESPONSE;
+                snmp_increment_statistic(STAT_SNMPOUTPKTS);
+                if (!snmp_send(asp->session, asp->pdu))
+                    snmp_free_pdu(asp->pdu);
+                asp->pdu = NULL;
+                netsnmp_remove_and_free_agent_snmp_session(asp);
+                return 1;
+            } else {
+                /*
+                 * drop the request 
+                 */
+                netsnmp_remove_and_free_agent_snmp_session(asp);
+                return 0;
+            }
+        }
+    }
+
+    rc = netsnmp_handle_request(asp, status);
+
+    /*
+     * done 
+     */
+    DEBUGMSGTL(("snmp_agent", "end of handle_snmp_packet, asp = %08p\n",
+                asp));
+    return rc;
+}
+
+netsnmp_request_info *
+netsnmp_add_varbind_to_cache(netsnmp_agent_session *asp, int vbcount,
+                             netsnmp_variable_list * varbind_ptr,
+                             netsnmp_subtree *tp)
+{
+    netsnmp_request_info *request = NULL;
+    int             cacheid;
+
+    DEBUGMSGTL(("snmp_agent", "add_vb_to_cache(%8p, %d, ", asp, vbcount));
+    DEBUGMSGOID(("snmp_agent", varbind_ptr->name,
+                 varbind_ptr->name_length));
+    DEBUGMSG(("snmp_agent", ", %8p)\n", tp));
+
+    if (tp &&
+        (asp->pdu->command == SNMP_MSG_GETNEXT ||
+         asp->pdu->command == SNMP_MSG_GETBULK)) {
+        int result;
+        int prefix_len;
+
+        prefix_len = netsnmp_oid_find_prefix(tp->start_a,
+                                             tp->start_len,
+                                             tp->end_a, tp->end_len);
+        result =
+            netsnmp_acm_check_subtree(asp->pdu, tp->start_a, prefix_len);
+
+        while (result == VACM_NOTINVIEW) {
+            /* the entire subtree is not in view. Skip it. */
+            /** @todo make this be more intelligent about ranges.
+                Right now we merely take the highest level
+                commonality of a registration range and use that.
+                At times we might be able to be smarter about
+                checking the range itself as opposed to the node
+                above where the range exists, but I doubt this will
+                come up all that frequently. */
+            tp = tp->next;
+            if (tp) {
+                prefix_len = netsnmp_oid_find_prefix(tp->start_a,
+                                                     tp->start_len,
+                                                     tp->end_a,
+                                                     tp->end_len);
+                result =
+                    netsnmp_acm_check_subtree(asp->pdu,
+                                              tp->start_a, prefix_len);
+            }
+            else
+                break;
+        }
+    }
+    if (tp == NULL) {
+        /*
+         * no appropriate registration found 
+         */
+        /*
+         * make up the response ourselves 
+         */
+        switch (asp->pdu->command) {
+        case SNMP_MSG_GETNEXT:
+        case SNMP_MSG_GETBULK:
+            varbind_ptr->type = SNMP_ENDOFMIBVIEW;
+            break;
+
+        case SNMP_MSG_SET:
+            varbind_ptr->type = SNMP_NOSUCHOBJECT;
+            break;
+
+        case SNMP_MSG_GET:
+            varbind_ptr->type = SNMP_NOSUCHOBJECT;
+            break;
+
+        default:
+            return NULL;        /* shouldn't get here */
+        }
+    } else {
+        DEBUGMSGTL(("snmp_agent", "tp->start "));
+        DEBUGMSGOID(("snmp_agent", tp->start_a, tp->start_len));
+        DEBUGMSG(("snmp_agent", ", tp->end "));
+        DEBUGMSGOID(("snmp_agent", tp->end_a, tp->end_len));
+        DEBUGMSG(("snmp_agent", ", \n"));
+
+        /*
+         * malloc the request structure 
+         */
+        request = &(asp->requests[vbcount - 1]);
+        request->index = vbcount;
+        request->delegated = 0;
+        request->processed = 0;
+        request->status = 0;
+        request->subtree = tp;
+        if (request->parent_data) {
+            netsnmp_free_request_data_sets(request);
+        }
+
+        /*
+         * for non-SET modes, set the type to NULL 
+         */
+        if (!MODE_IS_SET(asp->pdu->command)) {
+            if (varbind_ptr->type == ASN_PRIV_INCL_RANGE) {
+                DEBUGMSGTL(("snmp_agent", "varbind %d is inclusive\n",
+                            request->index));
+                request->inclusive = 1;
+            }
+            varbind_ptr->type = ASN_NULL;
+        }
+
+        /*
+         * place them in a cache 
+         */
+        if (tp->global_cacheid) {
+            /*
+             * we need to merge all marked subtrees together 
+             */
+            if (asp->cache_store && -1 !=
+                (cacheid = netsnmp_get_local_cachid(asp->cache_store,
+                                                    tp->global_cacheid))) {
+            } else {
+                cacheid = ++(asp->treecache_num);
+                netsnmp_get_or_add_local_cachid(&asp->cache_store,
+                                                tp->global_cacheid,
+                                                cacheid);
+                goto mallocslot;        /* XXX: ick */
+            }
+        } else if (tp->cacheid > -1 && tp->cacheid <= asp->treecache_num &&
+                   asp->treecache[tp->cacheid].subtree == tp) {
+            /*
+             * we have already added a request to this tree
+             * pointer before 
+             */
+            cacheid = tp->cacheid;
+        } else {
+            cacheid = ++(asp->treecache_num);
+          mallocslot:
+            /*
+             * new slot needed 
+             */
+            if (asp->treecache_num >= asp->treecache_len) {
+                /*
+                 * exapand cache array 
+                 */
+                /*
+                 * WWW: non-linear expansion needed (with cap) 
+                 */
+#define CACHE_GROW_SIZE 16
+                asp->treecache_len =
+                    (asp->treecache_len + CACHE_GROW_SIZE);
+                asp->treecache =
+                    realloc(asp->treecache,
+                            sizeof(netsnmp_tree_cache) *
+                            asp->treecache_len);
+                if (asp->treecache == NULL)
+                    return NULL;
+                memset(&(asp->treecache[cacheid]), 0x00,
+                       sizeof(netsnmp_tree_cache) * (CACHE_GROW_SIZE));
+            }
+            asp->treecache[cacheid].subtree = tp;
+            asp->treecache[cacheid].requests_begin = request;
+            tp->cacheid = cacheid;
+        }
+
+        /*
+         * if this is a search type, get the ending range oid as well 
+         */
+        if (asp->pdu->command == SNMP_MSG_GETNEXT ||
+            asp->pdu->command == SNMP_MSG_GETBULK) {
+            request->range_end = tp->end_a;
+            request->range_end_len = tp->end_len;
+        } else {
+            request->range_end = NULL;
+            request->range_end_len = 0;
+        }
+
+        /*
+         * link into chain 
+         */
+        if (asp->treecache[cacheid].requests_end)
+            asp->treecache[cacheid].requests_end->next = request;
+        request->next = NULL;
+        request->prev = asp->treecache[cacheid].requests_end;
+        asp->treecache[cacheid].requests_end = request;
+
+        /*
+         * add the given request to the list of requests they need
+         * to handle results for 
+         */
+        request->requestvb = request->requestvb_start = varbind_ptr;
+    }
+    return request;
+}
+
+/*
+ * check the ACM(s) for the results on each of the varbinds.
+ * If ACM disallows it, replace the value with type
+ * 
+ * Returns number of varbinds with ACM errors
+ */
+int
+check_acm(netsnmp_agent_session *asp, u_char type)
+{
+    int             view;
+    int             i, j, k;
+    netsnmp_request_info *request;
+    int             ret = 0;
+    netsnmp_variable_list *vb, *vb2, *vbc;
+    int             earliest = 0;
+
+    for (i = 0; i <= asp->treecache_num; i++) {
+        for (request = asp->treecache[i].requests_begin;
+             request; request = request->next) {
+            /*
+             * for each request, run it through in_a_view() 
+             */
+            earliest = 0;
+            for(j = request->repeat, vb = request->requestvb_start;
+                vb && j > -1;
+                j--, vb = vb->next_variable) {
+                if (vb->type != ASN_NULL &&
+                    vb->type != ASN_PRIV_RETRY) { /* not yet processed */
+                    view =
+                        in_a_view(vb->name, &vb->name_length,
+                                  asp->pdu, vb->type);
+
+                    /*
+                     * if a ACM error occurs, mark it as type passed in 
+                     */
+                    if (view != VACM_SUCCESS) {
+                        ret++;
+                        if (request->repeat < request->orig_repeat) {
+                            /* basically this means a GETBULK */
+                            request->repeat++;
+                            if (!earliest) {
+                                request->requestvb = vb;
+                                earliest = 1;
+                            }
+
+                            /* ugh.  if a whole now exists, we need to
+                               move the contents up the chain and fill
+                               in at the end else we won't end up
+                               lexographically sorted properly */
+                            if (j > -1 && vb->next_variable &&
+                                vb->next_variable->type != ASN_NULL &&
+                                vb->next_variable->type != ASN_PRIV_RETRY) {
+                                for(k = j, vbc = vb, vb2 = vb->next_variable;
+                                    k > -2 && vbc && vb2;
+                                    k--, vbc = vb2, vb2 = vb2->next_variable) {
+                                    /* clone next into the current */
+                                    snmp_clone_var(vb2, vbc);
+                                    vbc->next_variable = vb2;
+                                }
+                            }
+                        }
+                        snmp_set_var_typed_value(vb, type, NULL, 0);
+                    }
+                }
+            }
+        }
+    }
+    return ret;
+}
+
+
+int
+netsnmp_create_subtree_cache(netsnmp_agent_session *asp)
+{
+    netsnmp_subtree *tp;
+    netsnmp_variable_list *varbind_ptr, *vbsave, *vbptr, **prevNext;
+    int             view;
+    int             vbcount = 0;
+    int             bulkcount = 0, bulkrep = 0;
+    int             i = 0, n = 0, r = 0;
+    netsnmp_request_info *request;
+
+    if (asp->treecache == NULL && asp->treecache_len == 0) {
+        asp->treecache_len = SNMP_MAX(1 + asp->vbcount / 4, 16);
+        asp->treecache =
+            calloc(asp->treecache_len, sizeof(netsnmp_tree_cache));
+        if (asp->treecache == NULL)
+            return SNMP_ERR_GENERR;
+    }
+    asp->treecache_num = -1;
+
+    if (asp->pdu->command == SNMP_MSG_GETBULK) {
+        /*
+         * getbulk prep 
+         */
+        int             count = count_varbinds(asp->pdu->variables);
+
+        if (asp->pdu->errstat < 0) {
+            asp->pdu->errstat = 0;
+        }
+        if (asp->pdu->errindex < 0) {
+            asp->pdu->errindex = 0;
+        }
+
+        if (asp->pdu->errstat < count) {
+            n = asp->pdu->errstat;
+        } else {
+            n = count;
+        }
+        if ((r = count - n) < 0) {
+            r = 0;
+            asp->bulkcache = NULL;
+        } else {
+            asp->bulkcache =
+                (netsnmp_variable_list **) malloc(asp->pdu->errindex * r *
+                                                  sizeof(struct
+                                                         varbind_list *));
+        }
+        DEBUGMSGTL(("snmp_agent", "GETBULK N = %d, M = %d, R = %d\n",
+                    n, asp->pdu->errindex, r));
+    }
+
+    /*
+     * collect varbinds into their registered trees 
+     */
+    prevNext = &(asp->pdu->variables);
+    for (varbind_ptr = asp->pdu->variables; varbind_ptr;
+         varbind_ptr = vbsave) {
+
+        /*
+         * getbulk mess with this pointer, so save it 
+         */
+        vbsave = varbind_ptr->next_variable;
+
+        if (asp->pdu->command == SNMP_MSG_GETBULK) {
+            if (n > 0) {
+                n--;
+            } else {
+                /*
+                 * repeate request varbinds on GETBULK.  These will
+                 * have to be properly rearranged later though as
+                 * responses are supposed to actually be interlaced
+                 * with each other.  This is done with the asp->bulkcache. 
+                 */
+                bulkrep = asp->pdu->errindex - 1;
+                if (asp->pdu->errindex > 0) {
+                    vbptr = varbind_ptr;
+                    asp->bulkcache[bulkcount++] = vbptr;
+
+                    for (i = 1; i < asp->pdu->errindex; i++) {
+                        vbptr->next_variable =
+                            SNMP_MALLOC_STRUCT(variable_list);
+                        /*
+                         * don't clone the oid as it's got to be
+                         * overwwritten anyway 
+                         */
+                        if (!vbptr->next_variable) {
+                            /*
+                             * XXXWWW: ack!!! 
+                             */
+                        } else {
+                            vbptr = vbptr->next_variable;
+                            vbptr->name_length = 0;
+                            vbptr->type = ASN_NULL;
+                            asp->bulkcache[bulkcount++] = vbptr;
+                        }
+                    }
+                    vbptr->next_variable = vbsave;
+                } else {
+                    /*
+                     * 0 repeats requested for this varbind, so take it off
+                     * the list.  
+                     */
+                    vbptr = varbind_ptr;
+                    *prevNext = vbptr->next_variable;
+                    vbptr->next_variable = NULL;
+                    snmp_free_varbind(vbptr);
+                    asp->vbcount--;
+                    continue;
+                }
+            }
+        }
+
+        /*
+         * count the varbinds 
+         */
+        ++vbcount;
+
+        /*
+         * find the owning tree 
+         */
+        tp = netsnmp_subtree_find(varbind_ptr->name, varbind_ptr->name_length,
+				  NULL, asp->pdu->contextName);
+
+        /*
+         * check access control 
+         */
+        switch (asp->pdu->command) {
+        case SNMP_MSG_GET:
+            view = in_a_view(varbind_ptr->name, &varbind_ptr->name_length,
+                             asp->pdu, varbind_ptr->type);
+            if (view != VACM_SUCCESS)
+                snmp_set_var_typed_value(varbind_ptr, SNMP_NOSUCHOBJECT,
+                                         NULL, 0);
+            break;
+
+        case SNMP_MSG_SET:
+            view = in_a_view(varbind_ptr->name, &varbind_ptr->name_length,
+                             asp->pdu, varbind_ptr->type);
+            if (view != VACM_SUCCESS)
+                return SNMP_ERR_NOTWRITABLE;
+            break;
+
+        case SNMP_MSG_GETNEXT:
+        case SNMP_MSG_GETBULK:
+        default:
+            view = VACM_SUCCESS;
+            /*
+             * XXXWWW: check VACM here to see if "tp" is even worthwhile 
+             */
+        }
+        if (view == VACM_SUCCESS) {
+            request = netsnmp_add_varbind_to_cache(asp, vbcount, varbind_ptr,
+						   tp);
+            if (request && asp->pdu->command == SNMP_MSG_GETBULK) {
+                request->repeat = request->orig_repeat = bulkrep;
+            }
+        }
+
+        prevNext = &(varbind_ptr->next_variable);
+    }
+
+    return SNMPERR_SUCCESS;
+}
+
+/*
+ * this function is only applicable in getnext like contexts 
+ */
+int
+netsnmp_reassign_requests(netsnmp_agent_session *asp)
+{
+    /*
+     * assume all the requests have been filled or rejected by the
+     * subtrees, so reassign the rejected ones to the next subtree in
+     * the chain 
+     */
+
+    int             i;
+
+    /*
+     * get old info 
+     */
+    netsnmp_tree_cache *old_treecache = asp->treecache;
+
+    /*
+     * malloc new space 
+     */
+    asp->treecache =
+        (netsnmp_tree_cache *) calloc(asp->treecache_len,
+                                      sizeof(netsnmp_tree_cache));
+    asp->treecache_num = -1;
+    if (asp->cache_store) {
+        netsnmp_free_cachemap(asp->cache_store);
+        asp->cache_store = NULL;
+    }
+
+    for (i = 0; i < asp->vbcount; i++) {
+        if (asp->requests[i].requestvb->type == ASN_NULL) {
+            if (!netsnmp_add_varbind_to_cache(asp, asp->requests[i].index,
+                                              asp->requests[i].requestvb,
+                                              asp->requests[i].subtree->next)) {
+                if (old_treecache != NULL) {
+                    free(old_treecache);
+                    old_treecache = NULL;
+                }
+            }
+        } else if (asp->requests[i].requestvb->type == ASN_PRIV_RETRY) {
+            /*
+             * re-add the same subtree 
+             */
+            asp->requests[i].requestvb->type = ASN_NULL;
+            if (!netsnmp_add_varbind_to_cache(asp, asp->requests[i].index,
+                                              asp->requests[i].requestvb,
+                                              asp->requests[i].subtree)) {
+                if (old_treecache != NULL) {
+                    free(old_treecache);
+                    old_treecache = NULL;
+                }
+            }
+        }
+    }
+
+    if (old_treecache != NULL) {
+        free(old_treecache);
+    }
+    return SNMP_ERR_NOERROR;
+}
+
+void
+netsnmp_delete_request_infos(netsnmp_request_info *reqlist)
+{
+    while (reqlist) {
+        netsnmp_free_request_data_sets(reqlist);
+        reqlist = reqlist->next;
+    }
+}
+
+void
+netsnmp_delete_subtree_cache(netsnmp_agent_session *asp)
+{
+    while (asp->treecache_num >= 0) {
+        /*
+         * don't delete subtrees 
+         */
+        netsnmp_delete_request_infos(asp->treecache[asp->treecache_num].
+                                     requests_begin);
+        asp->treecache_num--;
+    }
+}
+
+int
+netsnmp_check_requests_status(netsnmp_agent_session *asp,
+                              netsnmp_request_info *requests,
+                              int look_for_specific)
+{
+    /*
+     * find any errors marked in the requests 
+     */
+    while (requests) {
+        if (requests->status != SNMP_ERR_NOERROR &&
+            (!look_for_specific || requests->status == look_for_specific)
+            && (look_for_specific || asp->index == 0
+                || requests->index < asp->index)) {
+            asp->index = requests->index;
+            asp->status = requests->status;
+        }
+        requests = requests->next;
+    }
+    return asp->status;
+}
+
+int
+netsnmp_check_all_requests_status(netsnmp_agent_session *asp,
+                                  int look_for_specific)
+{
+    int             i;
+    for (i = 0; i <= asp->treecache_num; i++) {
+        netsnmp_check_requests_status(asp,
+                                      asp->treecache[i].requests_begin,
+                                      look_for_specific);
+    }
+    return asp->status;
+}
+
+int
+handle_var_requests(netsnmp_agent_session *asp)
+{
+    int             i, retstatus = SNMP_ERR_NOERROR,
+        status = SNMP_ERR_NOERROR, final_status = SNMP_ERR_NOERROR;
+    netsnmp_handler_registration *reginfo;
+
+    /*
+     * create the netsnmp_agent_request_info data 
+     */
+    if (!asp->reqinfo) {
+        asp->reqinfo = SNMP_MALLOC_TYPEDEF(netsnmp_agent_request_info);
+        if (!asp->reqinfo)
+            return SNMP_ERR_GENERR;
+    }
+
+    asp->reqinfo->asp = asp;
+    asp->reqinfo->mode = asp->mode;
+
+    /*
+     * now, have the subtrees in the cache go search for their results 
+     */
+    for (i = 0; i <= asp->treecache_num; i++) {
+        reginfo = asp->treecache[i].subtree->reginfo;
+        status = netsnmp_call_handlers(reginfo, asp->reqinfo,
+                                       asp->treecache[i].requests_begin);
+
+        /*
+         * find any errors marked in the requests.  For later parts of
+         * SET processing, only check for new errors specific to that
+         * set processing directive (which must superceed the previous
+         * errors).
+         */
+        switch (asp->mode) {
+        case MODE_SET_COMMIT:
+            retstatus = netsnmp_check_requests_status(asp,
+						      asp->treecache[i].
+						      requests_begin,
+						      SNMP_ERR_COMMITFAILED);
+            break;
+
+        case MODE_SET_UNDO:
+            retstatus = netsnmp_check_requests_status(asp,
+						      asp->treecache[i].
+						      requests_begin,
+						      SNMP_ERR_UNDOFAILED);
+            break;
+
+        default:
+            retstatus = netsnmp_check_requests_status(asp,
+						      asp->treecache[i].
+						      requests_begin, 0);
+            break;
+        }
+
+        /*
+         * always take lowest varbind if possible 
+         */
+        if (retstatus != SNMP_ERR_NOERROR) {
+            status = retstatus;
+	}
+
+        /*
+         * other things we know less about (no index) 
+         */
+        /*
+         * WWW: drop support for this? 
+         */
+        if (final_status == SNMP_ERR_NOERROR && status != SNMP_ERR_NOERROR) {
+            /*
+             * we can't break here, since some processing needs to be
+             * done for all requests anyway (IE, SET handling for UNDO
+             * needs to be called regardless of previous status
+             * results.
+             * WWW:  This should be predictable though and
+             * breaking should be possible in some cases (eg GET,
+             * GETNEXT, ...) 
+             */
+            final_status = status;
+        }
+    }
+
+    return final_status;
+}
+
+/*
+ * loop through our sessions known delegated sessions and check to see
+ * if they've completed yet. If there are no more delegated sessions,
+ * check for and process any queued requests
+ */
+void
+netsnmp_check_outstanding_agent_requests(void)
+{
+    netsnmp_agent_session *asp, *prev_asp = NULL, *next_asp = NULL;
+
+    /*
+     * deal with delegated requests
+     */
+    for (asp = agent_delegated_list; asp; prev_asp = asp, asp = next_asp) {
+        next_asp = asp->next;   /* save in case we clean up asp */
+        if (!netsnmp_check_for_delegated(asp)) {
+
+            /*
+             * we're done with this one, remove from queue 
+             */
+            if (prev_asp != NULL)
+                prev_asp->next = asp->next;
+            else
+                agent_delegated_list = asp->next;
+
+            /*
+             * check request status
+             */
+            netsnmp_check_all_requests_status(asp, 0);
+            
+            /*
+             * continue processing or finish up 
+             */
+            check_delayed_request(asp);
+        }
+    }
+
+    /*
+     * if we are processing a set and there are more delegated
+     * requests, keep waiting before getting to queued requests.
+     */
+    if (netsnmp_processing_set && (NULL != agent_delegated_list))
+        return;
+
+    while (netsnmp_agent_queued_list) {
+
+        /*
+         * if we are processing a set, the first item better be
+         * the set being (or waiting to be) processed.
+         */
+        netsnmp_assert((!netsnmp_processing_set) ||
+                       (netsnmp_processing_set == netsnmp_agent_queued_list));
+
+        /*
+         * if the top request is a set, don't pop it
+         * off if there are delegated requests
+         */
+        if ((netsnmp_agent_queued_list->pdu->command == SNMP_MSG_SET) &&
+            (agent_delegated_list)) {
+
+            netsnmp_assert(netsnmp_processing_set == NULL);
+
+            netsnmp_processing_set = netsnmp_agent_queued_list;
+            DEBUGMSGTL(("snmp_agent", "SET request remains queued while "
+                        "delegated requests finish, asp = %08p\n", asp));
+            break;
+        }
+
+        /*
+         * pop the first request and process it
+         */
+        asp = netsnmp_agent_queued_list;
+        netsnmp_agent_queued_list = asp->next;
+        DEBUGMSGTL(("snmp_agent",
+                    "processing queued request, asp = %08p\n", asp));
+
+        netsnmp_handle_request(asp, asp->status);
+
+        /*
+         * if we hit a set, stop
+         */
+        if (NULL != netsnmp_processing_set)
+            break;
+    }
+}
+
+/** Decide if the requested transaction_id is still being processed
+   within the agent.  This is used to validate whether a delayed cache
+   (containing possibly freed pointers) is still usable.
+
+   returns SNMPERR_SUCCESS if it's still valid, or SNMPERR_GENERR if not. */
+int
+netsnmp_check_transaction_id(int transaction_id)
+{
+    netsnmp_agent_session *asp, *prev_asp = NULL;
+
+    for (asp = agent_delegated_list; asp; prev_asp = asp, asp = asp->next) {
+        if (asp->pdu->transid == transaction_id)
+            return SNMPERR_SUCCESS;
+    }
+    return SNMPERR_GENERR;
+}
+
+
+/*
+ * check_delayed_request(asp)
+ *
+ * Called to rexamine a set of requests and continue processing them
+ * once all the previous (delayed) requests have been handled one way
+ * or another.
+ */
+
+int
+check_delayed_request(netsnmp_agent_session *asp)
+{
+    int             status = SNMP_ERR_NOERROR;
+
+    DEBUGMSGTL(("snmp_agent", "processing delegated request, asp = %08p\n",
+                asp));
+
+    switch (asp->mode) {
+    case SNMP_MSG_GETBULK:
+    case SNMP_MSG_GETNEXT:
+        netsnmp_check_all_requests_status(asp, 0);
+        handle_getnext_loop(asp);
+        if (netsnmp_check_for_delegated(asp) &&
+            netsnmp_check_transaction_id(asp->pdu->transid) !=
+            SNMPERR_SUCCESS) {
+            /*
+             * add to delegated request chain 
+             */
+            if (!netsnmp_check_delegated_chain_for(asp)) {
+                asp->next = agent_delegated_list;
+                agent_delegated_list = asp;
+            }
+        }
+        break;
+
+    case MODE_SET_COMMIT:
+        netsnmp_check_all_requests_status(asp, SNMP_ERR_COMMITFAILED);
+        goto settop;
+
+    case MODE_SET_UNDO:
+        netsnmp_check_all_requests_status(asp, SNMP_ERR_UNDOFAILED);
+        goto settop;
+
+    case MODE_SET_BEGIN:
+    case MODE_SET_RESERVE1:
+    case MODE_SET_RESERVE2:
+    case MODE_SET_ACTION:
+    case MODE_SET_FREE:
+      settop:
+        handle_set_loop(asp);
+        if (asp->mode != FINISHED_SUCCESS && asp->mode != FINISHED_FAILURE) {
+
+            if (netsnmp_check_for_delegated_and_add(asp)) {
+                /*
+                 * add to delegated request chain 
+                 */
+                if (!asp->status)
+                    asp->status = status;
+            }
+
+            return SNMP_ERR_NOERROR;
+        }
+        break;
+
+    default:
+        break;
+    }
+
+    /*
+     * if we don't have anything outstanding (delegated), wrap up 
+     */
+    if (!netsnmp_check_for_delegated(asp))
+        return netsnmp_wrap_up_request(asp, status);
+
+    return 1;
+}
+
+/** returns 1 if there are valid GETNEXT requests left.  Returns 0 if not. */
+int
+check_getnext_results(netsnmp_agent_session *asp)
+{
+    /*
+     * get old info 
+     */
+    netsnmp_tree_cache *old_treecache = asp->treecache;
+    int             old_treecache_num = asp->treecache_num;
+    int             count = 0;
+    int             i, special = 0;
+    netsnmp_request_info *request;
+
+    if (asp->mode == SNMP_MSG_GET) {
+        /*
+         * Special case for doing INCLUSIVE getNext operations in
+         * AgentX subagents.  
+         */
+        DEBUGMSGTL(("snmp_agent",
+                    "asp->mode == SNMP_MSG_GET in ch_getnext\n"));
+        asp->mode = asp->oldmode;
+        special = 1;
+    }
+
+    for (i = 0; i <= old_treecache_num; i++) {
+        for (request = old_treecache[i].requests_begin; request;
+             request = request->next) {
+
+            /*
+             * If we have just done the special case AgentX GET, then any
+             * requests which were not INCLUSIVE will now have a wrong
+             * response, so junk them and retry from the same place (except
+             * that this time the handler will be called in "inexact"
+             * mode).  
+             */
+
+            if (special) {
+                if (!request->inclusive) {
+                    DEBUGMSGTL(("snmp_agent",
+                                "request %d wasn't inclusive\n",
+                                request->index));
+                    snmp_set_var_typed_value(request->requestvb,
+                                             ASN_PRIV_RETRY, NULL, 0);
+                } else if (request->requestvb->type == ASN_NULL ||
+                           request->requestvb->type == SNMP_NOSUCHINSTANCE ||
+                           request->requestvb->type == SNMP_NOSUCHOBJECT) {
+                    /*
+                     * it was inclusive, but no results.  Still retry this
+                     * search. 
+                     */
+                    snmp_set_var_typed_value(request->requestvb,
+                                             ASN_PRIV_RETRY, NULL, 0);
+                }
+            }
+
+            /*
+             * out of range? 
+             */
+            if (snmp_oid_compare(request->requestvb->name,
+                                 request->requestvb->name_length,
+                                 request->range_end,
+                                 request->range_end_len) >= 0) {
+                /*
+                 * ack, it's beyond the accepted end of range. 
+                 */
+                /*
+                 * fix it by setting the oid to the end of range oid instead 
+                 */
+                DEBUGMSGTL(("check_getnext_results",
+                            "request response %d out of range\n",
+                            request->index));
+                request->inclusive = 1;
+                /*
+                 * XXX: should set this to the original OID? 
+                 */
+                snmp_set_var_objid(request->requestvb,
+                                   request->range_end,
+                                   request->range_end_len);
+                snmp_set_var_typed_value(request->requestvb, ASN_NULL,
+                                         NULL, 0);
+            }
+
+            /*
+             * mark any existent requests with illegal results as NULL 
+             */
+            if (request->requestvb->type == SNMP_ENDOFMIBVIEW) {
+                /*
+                 * illegal response from a subagent.  Change it back to NULL 
+                 */
+                request->requestvb->type = ASN_NULL;
+                request->inclusive = 1;
+            }
+
+            if (request->requestvb->type == ASN_NULL ||
+                request->requestvb->type == ASN_PRIV_RETRY ||
+                (asp->reqinfo->mode == MODE_GETBULK
+                 && request->repeat > 0))
+                count++;
+        }
+    }
+    return count;
+}
+
+/** repeatedly calls getnext handlers looking for an answer till all
+   requests are satisified.  It's expected that one pass has been made
+   before entering this function */
+int
+handle_getnext_loop(netsnmp_agent_session *asp)
+{
+    int             status;
+    netsnmp_variable_list *var_ptr;
+
+    /*
+     * loop 
+     */
+    while (1) {
+
+        /*
+         * bail for now if anything is delegated. 
+         */
+        if (netsnmp_check_for_delegated(asp)) {
+            return SNMP_ERR_NOERROR;
+        }
+
+        /*
+         * check vacm against results 
+         */
+        check_acm(asp, ASN_PRIV_RETRY);
+
+        /*
+         * need to keep going we're not done yet. 
+         */
+        if (!check_getnext_results(asp))
+            /*
+             * nothing left, quit now 
+             */
+            break;
+
+        /*
+         * never had a request (empty pdu), quit now 
+         */
+        /*
+         * XXXWWW: huh?  this would be too late, no?  shouldn't we
+         * catch this earlier? 
+         */
+        /*
+         * if (count == 0)
+         * break; 
+         */
+
+        DEBUGIF("results") {
+            DEBUGMSGTL(("results",
+                        "getnext results, before next pass:\n"));
+            for (var_ptr = asp->pdu->variables; var_ptr;
+                 var_ptr = var_ptr->next_variable) {
+                DEBUGMSGTL(("results", "\t"));
+                DEBUGMSGVAR(("results", var_ptr));
+                DEBUGMSG(("results", "\n"));
+            }
+        }
+
+        netsnmp_reassign_requests(asp);
+        status = handle_var_requests(asp);
+        if (status != SNMP_ERR_NOERROR) {
+            return status;      /* should never really happen */
+        }
+    }
+    return SNMP_ERR_NOERROR;
+}
+
+int
+handle_set(netsnmp_agent_session *asp)
+{
+    int             status;
+    /*
+     * SETS require 3-4 passes through the var_op_list.
+     * The first two
+     * passes verify that all types, lengths, and values are valid
+     * and may reserve resources and the third does the set and a
+     * fourth executes any actions.  Then the identical GET RESPONSE
+     * packet is returned.
+     * If either of the first two passes returns an error, another
+     * pass is made so that any reserved resources can be freed.
+     * If the third pass returns an error, another pass is
+     * made so that
+     * any changes can be reversed.
+     * If the fourth pass (or any of the error handling passes)
+     * return an error, we'd rather not know about it!
+     */
+    if (!(asp->pdu->flags & UCD_MSG_FLAG_ONE_PASS_ONLY)) {
+        switch (asp->mode) {
+        case MODE_SET_BEGIN:
+            snmp_increment_statistic(STAT_SNMPINSETREQUESTS);
+            asp->rw = WRITE;    /* WWW: still needed? */
+            asp->mode = MODE_SET_RESERVE1;
+            asp->status = SNMP_ERR_NOERROR;
+            break;
+
+        case MODE_SET_RESERVE1:
+
+            if (asp->status != SNMP_ERR_NOERROR)
+                asp->mode = MODE_SET_FREE;
+            else
+                asp->mode = MODE_SET_RESERVE2;
+            break;
+
+        case MODE_SET_RESERVE2:
+            if (asp->status != SNMP_ERR_NOERROR)
+                asp->mode = MODE_SET_FREE;
+            else
+                asp->mode = MODE_SET_ACTION;
+            break;
+
+        case MODE_SET_ACTION:
+            if (asp->status != SNMP_ERR_NOERROR)
+                asp->mode = MODE_SET_UNDO;
+            else
+                asp->mode = MODE_SET_COMMIT;
+            break;
+
+        case MODE_SET_COMMIT:
+            if (asp->status != SNMP_ERR_NOERROR) {
+                asp->mode = FINISHED_FAILURE;
+            } else {
+                asp->mode = FINISHED_SUCCESS;
+            }
+            break;
+
+        case MODE_SET_UNDO:
+            asp->mode = FINISHED_FAILURE;
+            break;
+
+        case MODE_SET_FREE:
+            asp->mode = FINISHED_FAILURE;
+            break;
+        }
+    }
+
+    if (asp->mode != FINISHED_SUCCESS && asp->mode != FINISHED_FAILURE) {
+        DEBUGMSGTL(("agent_set", "doing set mode = %d (%s)\n", asp->mode,
+                    se_find_label_in_slist("agent_mode", asp->mode)));
+        status = handle_var_requests(asp);
+        DEBUGMSGTL(("agent_set", "did set mode = %d, status = %d\n",
+                    asp->mode, status));
+        if ((status != SNMP_ERR_NOERROR && asp->status == SNMP_ERR_NOERROR) ||
+	    status == SNMP_ERR_COMMITFAILED || 
+	    status == SNMP_ERR_UNDOFAILED) {
+            asp->status = status;
+        }
+    }
+    return asp->status;
+}
+
+int
+handle_set_loop(netsnmp_agent_session *asp)
+{
+    while (asp->mode != FINISHED_FAILURE && asp->mode != FINISHED_SUCCESS) {
+        handle_set(asp);
+        if (netsnmp_check_for_delegated(asp)) {
+            return SNMP_ERR_NOERROR;
+	}
+        if (asp->pdu->flags & UCD_MSG_FLAG_ONE_PASS_ONLY) {
+            return asp->status;
+	}
+    }
+    return asp->status;
+}
+
+int
+netsnmp_handle_request(netsnmp_agent_session *asp, int status)
+{
+    /*
+     * if this isn't a delegated request trying to finish,
+     * processing of a set request should not start until all
+     * delegated requests have completed, and no other new requests
+     * should be processed until the set request completes.
+     */
+    if ((0 == netsnmp_check_delegated_chain_for(asp)) &&
+        (asp != netsnmp_processing_set)) {
+        /*
+         * if we are processing a set and this is not a delegated
+         * request, queue the request
+         */
+        if (netsnmp_processing_set) {
+            netsnmp_add_queued(asp);
+            DEBUGMSGTL(("snmp_agent",
+                        "request queued while processing set, "
+                        "asp = %08p\n", asp));
+            return 1;
+        }
+
+        /*
+         * check for set request
+         */
+        if (asp->pdu->command == SNMP_MSG_SET) {
+            netsnmp_processing_set = asp;
+
+            /*
+             * if there are delegated requests, we must wait for them
+             * to finishd.
+             */
+            if (agent_delegated_list) {
+                DEBUGMSGTL(("snmp_agent", "SET request queued while "
+                            "delegated requests finish, asp = %08p\n",
+                            asp));
+                netsnmp_add_queued(asp);
+                return 1;
+            }
+        }
+    }
+
+    /*
+     * process the request 
+     */
+    status = handle_pdu(asp);
+
+    /*
+     * print the results in appropriate debugging mode 
+     */
+    DEBUGIF("results") {
+        netsnmp_variable_list *var_ptr;
+        DEBUGMSGTL(("results", "request results (status = %d):\n",
+                    status));
+        for (var_ptr = asp->pdu->variables; var_ptr;
+             var_ptr = var_ptr->next_variable) {
+            DEBUGMSGTL(("results", "\t"));
+            DEBUGMSGVAR(("results", var_ptr));
+            DEBUGMSG(("results", "\n"));
+        }
+    }
+
+    /*
+     * check for uncompleted requests 
+     */
+    if (netsnmp_check_for_delegated_and_add(asp)) {
+        /*
+         * add to delegated request chain 
+         */
+        asp->status = status;
+    } else {
+        /*
+         * if we don't have anything outstanding (delegated), wrap up
+         */
+        return netsnmp_wrap_up_request(asp, status);
+    }
+
+    return 1;
+}
+
+int
+handle_pdu(netsnmp_agent_session *asp)
+{
+    int             status, inclusives = 0;
+    netsnmp_variable_list *v = NULL;
+
+    /*
+     * for illegal requests, mark all nodes as ASN_NULL 
+     */
+    switch (asp->pdu->command) {
+
+    case SNMP_MSG_INTERNAL_SET_RESERVE2:
+    case SNMP_MSG_INTERNAL_SET_ACTION:
+    case SNMP_MSG_INTERNAL_SET_COMMIT:
+    case SNMP_MSG_INTERNAL_SET_FREE:
+    case SNMP_MSG_INTERNAL_SET_UNDO:
+        status = get_set_cache(asp);
+        if (status != SNMP_ERR_NOERROR)
+            return status;
+        break;
+
+    case SNMP_MSG_GET:
+    case SNMP_MSG_GETNEXT:
+    case SNMP_MSG_GETBULK:
+        for (v = asp->pdu->variables; v != NULL; v = v->next_variable) {
+            if (v->type == ASN_PRIV_INCL_RANGE) {
+                /*
+                 * Leave the type for now (it gets set to
+                 * ASN_NULL in netsnmp_add_varbind_to_cache,
+                 * called by create_subnetsnmp_tree_cache below).
+                 * If we set it to ASN_NULL now, we wouldn't be
+                 * able to distinguish INCLUSIVE search
+                 * ranges.  
+                 */
+                inclusives++;
+            } else {
+                snmp_set_var_typed_value(v, ASN_NULL, NULL, 0);
+            }
+        }
+        /*
+         * fall through 
+         */
+
+    case SNMP_MSG_INTERNAL_SET_BEGIN:
+    case SNMP_MSG_INTERNAL_SET_RESERVE1:
+    default:
+        asp->vbcount = count_varbinds(asp->pdu->variables);
+        if (asp->vbcount) /* efence doesn't like 0 size allocs */
+            asp->requests = (netsnmp_request_info *)
+                calloc(asp->vbcount, sizeof(netsnmp_request_info));
+        /*
+         * collect varbinds 
+         */
+        status = netsnmp_create_subtree_cache(asp);
+        if (status != SNMP_ERR_NOERROR)
+            return status;
+    }
+
+    asp->mode = asp->pdu->command;
+    switch (asp->mode) {
+    case SNMP_MSG_GET:
+        /*
+         * increment the message type counter 
+         */
+        snmp_increment_statistic(STAT_SNMPINGETREQUESTS);
+
+        /*
+         * check vacm ahead of time 
+         */
+        check_acm(asp, SNMP_NOSUCHOBJECT);
+
+        /*
+         * get the results 
+         */
+        status = handle_var_requests(asp);
+
+        /*
+         * Deal with unhandled results -> noSuchInstance (rather
+         * than noSuchObject -- in that case, the type will
+         * already have been set to noSuchObject when we realised
+         * we couldn't find an appropriate tree).  
+         */
+        if (status == SNMP_ERR_NOERROR)
+            snmp_replace_var_types(asp->pdu->variables, ASN_NULL,
+                                   SNMP_NOSUCHINSTANCE);
+        break;
+
+    case SNMP_MSG_GETNEXT:
+        snmp_increment_statistic(STAT_SNMPINGETNEXTS);
+        /*
+         * fall through 
+         */
+
+    case SNMP_MSG_GETBULK:     /* note: there is no getbulk stat */
+        /*
+         * loop through our mib tree till we find an
+         * appropriate response to return to the caller. 
+         */
+
+        if (inclusives) {
+            /*
+             * This is a special case for AgentX INCLUSIVE getNext
+             * requests where a result lexi-equal to the request is okay
+             * but if such a result does not exist, we still want the
+             * lexi-next one.  So basically we do a GET first, and if any
+             * of the INCLUSIVE requests are satisfied, we use that
+             * value.  Then, unsatisfied INCLUSIVE requests, and
+             * non-INCLUSIVE requests get done as normal.  
+             */
+
+            DEBUGMSGTL(("snmp_agent", "inclusive range(s) in getNext\n"));
+            asp->oldmode = asp->mode;
+            asp->mode = SNMP_MSG_GET;
+        }
+
+        /*
+         * first pass 
+         */
+        status = handle_var_requests(asp);
+        if (status != SNMP_ERR_NOERROR) {
+            if (!inclusives)
+                return status;  /* should never really happen */
+            else
+                asp->status = SNMP_ERR_NOERROR;
+        }
+
+        /*
+         * loop through our mib tree till we find an
+         * appropriate response to return to the caller. 
+         */
+
+        status = handle_getnext_loop(asp);
+        break;
+
+    case SNMP_MSG_SET:
+        /*
+         * check access permissions first 
+         */
+        if (check_acm(asp, SNMP_NOSUCHOBJECT))
+            return SNMP_ERR_NOTWRITABLE;
+
+        asp->mode = MODE_SET_BEGIN;
+        status = handle_set_loop(asp);
+
+        break;
+
+    case SNMP_MSG_INTERNAL_SET_BEGIN:
+    case SNMP_MSG_INTERNAL_SET_RESERVE1:
+    case SNMP_MSG_INTERNAL_SET_RESERVE2:
+    case SNMP_MSG_INTERNAL_SET_ACTION:
+    case SNMP_MSG_INTERNAL_SET_COMMIT:
+    case SNMP_MSG_INTERNAL_SET_FREE:
+    case SNMP_MSG_INTERNAL_SET_UNDO:
+        asp->pdu->flags |= UCD_MSG_FLAG_ONE_PASS_ONLY;
+        status = handle_set_loop(asp);
+        /*
+         * asp related cache is saved in cleanup 
+         */
+        break;
+
+    case SNMP_MSG_RESPONSE:
+        snmp_increment_statistic(STAT_SNMPINGETRESPONSES);
+        return SNMP_ERR_NOERROR;
+
+    case SNMP_MSG_TRAP:
+    case SNMP_MSG_TRAP2:
+        snmp_increment_statistic(STAT_SNMPINTRAPS);
+        return SNMP_ERR_NOERROR;
+
+    default:
+        /*
+         * WWW: are reports counted somewhere ? 
+         */
+        snmp_increment_statistic(STAT_SNMPINASNPARSEERRS);
+        return SNMPERR_GENERR;  /* shouldn't get here */
+        /*
+         * WWW 
+         */
+    }
+    return status;
+}
+
+int
+netsnmp_set_request_error(netsnmp_agent_request_info *reqinfo,
+                          netsnmp_request_info *request, int error_value)
+{
+    if (!request || !reqinfo)
+        return error_value;
+
+    return netsnmp_set_mode_request_error(reqinfo->mode, request,
+                                          error_value);
+}
+
+int
+netsnmp_set_mode_request_error(int mode, netsnmp_request_info *request,
+                               int error_value)
+{
+    if (!request)
+        return error_value;
+
+    request->processed = 1;
+    request->delegated = REQUEST_IS_NOT_DELEGATED;
+
+    switch (error_value) {
+    case SNMP_NOSUCHOBJECT:
+    case SNMP_NOSUCHINSTANCE:
+    case SNMP_ENDOFMIBVIEW:
+        /*
+         * these are exceptions that should be put in the varbind
+         * in the case of a GET but should be translated for a SET
+         * into a real error status code and put in the request 
+         */
+        switch (mode) {
+        case MODE_GET:
+            request->requestvb->type = error_value;
+            return error_value;
+
+        case MODE_GETNEXT:
+        case MODE_GETBULK:
+            /*
+             * ignore these.  They're illegal to set by the
+             * client APIs for these modes 
+             */
+            snmp_log(LOG_ERR, "Illegal error_value %d for mode %d ignored\n",
+                     error_value, mode);
+            return error_value;
+
+        default:
+            request->status = SNMP_ERR_NOSUCHNAME;      /* WWW: correct? */
+            return error_value;
+        }
+        break;                  /* never get here */
+
+    default:
+        if (request->status < 0) {
+            /*
+             * illegal local error code.  translate to generr 
+             */
+            /*
+             * WWW: full translation map? 
+             */
+            snmp_log(LOG_ERR, "Illegal error_value %d translated to %d\n",
+                     error_value, SNMP_ERR_GENERR);
+            request->status = SNMP_ERR_GENERR;
+        } else {
+            /*
+             * WWW: translations and mode checking? 
+             */
+            request->status = error_value;
+        }
+        return error_value;
+    }
+    return error_value;
+}
+
+int
+netsnmp_set_all_requests_error(netsnmp_agent_request_info *reqinfo,
+                               netsnmp_request_info *requests,
+                               int error_value)
+{
+    while (requests) {
+        netsnmp_set_request_error(reqinfo, requests, error_value);
+        requests = requests->next;
+    }
+    return error_value;
+}
+
+extern struct timeval starttime;
+
+                /*
+                 * Return the value of 'sysUpTime' at the given marker 
+                 */
+u_long
+netsnmp_marker_uptime(marker_t pm)
+{
+    u_long          res;
+    marker_t        start = (marker_t) & starttime;
+
+    res = uatime_hdiff(start, pm);
+    return res;                 /* atime_diff works in msec, not csec */
+}
+
+                        /*
+                         * struct timeval equivalents of these 
+                         */
+u_long
+netsnmp_timeval_uptime(struct timeval * tv)
+{
+    return netsnmp_marker_uptime((marker_t) tv);
+}
+
+                /*
+                 * Return the current value of 'sysUpTime' 
+                 */
+u_long
+netsnmp_get_agent_uptime(void)
+{
+    struct timeval  now;
+    gettimeofday(&now, NULL);
+
+    return netsnmp_timeval_uptime(&now);
+}
+
+
+
+NETSNMP_INLINE void
+netsnmp_agent_add_list_data(netsnmp_agent_request_info *ari,
+                            netsnmp_data_list *node)
+{
+    if (ari) {
+	if (ari->agent_data) {
+            netsnmp_add_list_data(&ari->agent_data, node);
+        } else {
+            ari->agent_data = node;
+	}
+    }
+}
+
+NETSNMP_INLINE void    *
+netsnmp_agent_get_list_data(netsnmp_agent_request_info *ari,
+                            const char *name)
+{
+    if (ari) {
+        return netsnmp_get_list_data(ari->agent_data, name);
+    }
+    return NULL;
+}
+
+NETSNMP_INLINE void
+netsnmp_free_agent_data_set(netsnmp_agent_request_info *ari)
+{
+    if (ari) {
+        netsnmp_free_list_data(ari->agent_data);
+    }
+}
+
+NETSNMP_INLINE void
+netsnmp_free_agent_data_sets(netsnmp_agent_request_info *ari)
+{
+    if (ari) {
+        netsnmp_free_all_list_data(ari->agent_data);
+    }
+}
+
+NETSNMP_INLINE void
+netsnmp_free_agent_request_info(netsnmp_agent_request_info *ari)
+{
+    if (ari) {
+        if (ari->agent_data) {
+            netsnmp_free_all_list_data(ari->agent_data);
+	}
+        free(ari);
+    }
+}
diff -Naur tomato/release/src/router/snmp/agent/snmpd.c tomato121/release/src/router/snmp/agent/snmpd.c
--- tomato/release/src/router/snmp/agent/snmpd.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/snmpd.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,1371 @@
+/*
+ * snmpd.c
+ */
+/** @defgroup agent The Net-SNMP agent
+ * The snmp agent responds to SNMP queries from management stations
+ */
+/* Portions of this file are subject to the following copyrights.  See
+ * the Net-SNMP's COPYING file for more details and other copyrights
+ * that may apply:
+ */
+/*
+ * Copyright 1988, 1989 by Carnegie Mellon University
+ * 
+ * All Rights Reserved
+ * 
+ * Permission to use, copy, modify, and distribute this software and its 
+ * documentation for any purpose and without fee is hereby granted, 
+ * provided that the above copyright notice appear in all copies and that
+ * both that copyright notice and this permission notice appear in 
+ * supporting documentation, and that the name of CMU not be
+ * used in advertising or publicity pertaining to distribution of the
+ * software without specific, written prior permission.  
+ * 
+ * CMU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+ * CMU BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+ * SOFTWARE.
+ * *****************************************************************
+ */
+/*
+ * Copyright © 2003 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms specified in the COPYING file
+ * distributed with the Net-SNMP package.
+ */
+#include <net-snmp/net-snmp-config.h>
+
+#include <stdio.h>
+#include <errno.h>
+#if HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+#if HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#if HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#include <sys/types.h>
+#if HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+#if HAVE_ARPA_INET_H
+#include <arpa/inet.h>
+#endif
+#if TIME_WITH_SYS_TIME
+# ifdef WIN32
+#  include <sys/timeb.h>
+# else
+#  include <sys/time.h>
+# endif
+# include <time.h>
+#else
+# if HAVE_SYS_TIME_H
+#  include <sys/time.h>
+# else
+#  include <time.h>
+# endif
+#endif
+#if HAVE_SYS_SELECT_H
+#include <sys/select.h>
+#endif
+#if HAVE_SYS_SOCKET_H
+#include <sys/socket.h>
+#elif HAVE_WINSOCK_H
+#include <winsock.h>
+#endif
+#if HAVE_NET_IF_H
+#include <net/if.h>
+#endif
+#if HAVE_INET_MIB2_H
+#include <inet/mib2.h>
+#endif
+#if HAVE_SYS_IOCTL_H
+#include <sys/ioctl.h>
+#endif
+#if HAVE_SYS_FILE_H
+#include <sys/file.h>
+#endif
+#ifdef HAVE_FCNTL_H
+#include <fcntl.h>
+#endif
+#if HAVE_SYS_WAIT_H
+#include <sys/wait.h>
+#endif
+#include <signal.h>
+#ifdef HAVE_SYS_PARAM_H
+#include <sys/param.h>
+#endif
+#if HAVE_PROCESS_H              /* Win32-getpid */
+#include <process.h>
+#endif
+#if HAVE_LIMITS_H
+#include <limits.h>
+#endif
+#if HAVE_PWD_H
+#include <pwd.h>
+#endif
+#if HAVE_GRP_H
+#include <grp.h>
+#endif
+
+#ifndef PATH_MAX
+# ifdef _POSIX_PATH_MAX
+#  define PATH_MAX _POSIX_PATH_MAX
+# else
+#  define PATH_MAX 255
+# endif
+#endif
+
+#ifndef FD_SET
+typedef long    fd_mask;
+#define NFDBITS (sizeof(fd_mask) * NBBY)        /* bits per mask */
+#define FD_SET(n, p)    ((p)->fds_bits[(n)/NFDBITS] |= (1 << ((n) % NFDBITS)))
+#define FD_CLR(n, p)    ((p)->fds_bits[(n)/NFDBITS] &= ~(1 << ((n) % NFDBITS)))
+#define FD_ISSET(n, p)  ((p)->fds_bits[(n)/NFDBITS] & (1 << ((n) % NFDBITS)))
+#define FD_ZERO(p)      memset((p), 0, sizeof(*(p)))
+#endif
+
+#if HAVE_DMALLOC_H
+#include <dmalloc.h>
+#endif
+
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+#include "m2m.h"
+#include <net-snmp/agent/mib_module_config.h>
+
+#include "snmpd.h"
+#include "mibgroup/struct.h"
+#include <net-snmp/agent/mib_modules.h>
+
+#include "mibgroup/util_funcs.h"
+
+#include <net-snmp/agent/agent_trap.h>
+
+#include <net-snmp/agent/table.h>
+#include <net-snmp/agent/table_iterator.h>
+#include "mib_module_includes.h"
+
+/*
+ * Include winservice.h to support Windows Service
+ */
+#ifdef WIN32
+#include <windows.h>
+#include <tchar.h>
+#include <net-snmp/library/winservice.h>
+#endif
+
+/*
+ * Globals.
+ */
+#ifdef USE_LIBWRAP
+#include <tcpd.h>
+#endif                          /* USE_LIBWRAP */
+
+#define TIMETICK         500000L
+
+int             snmp_dump_packet;
+int             running = 1;
+int             reconfig = 0;
+int             Facility = LOG_DAEMON;
+
+#ifdef WIN32
+/*
+ * SNMP Agent Status 
+ */
+#define AGENT_RUNNING 1
+#define AGENT_STOPPED 0
+int             agent_status = AGENT_STOPPED;
+LPTSTR          g_szAppName = _T("Net-Snmp Agent");     /* Application Name */
+#endif
+
+extern char   **argvrestartp;
+extern char    *argvrestart;
+extern char    *argvrestartname;
+
+#define NUM_SOCKETS	32
+
+#ifdef USING_SMUX_MODULE
+static int      sdlist[NUM_SOCKETS], sdlen = 0;
+#endif                          /* USING_SMUX_MODULE */
+
+/*
+ * Prototypes.
+ */
+int             snmp_read_packet(int);
+int             snmp_input(int, netsnmp_session *, int, netsnmp_pdu *,
+                           void *);
+static void     usage(char *);
+static void     SnmpTrapNodeDown(void);
+static int      receive(void);
+#ifdef WIN32
+void            StopSnmpAgent(void);
+int             SnmpDaemonMain(int argc, TCHAR * argv[]);
+int __cdecl     _tmain(int argc, TCHAR * argv[]);
+#else
+int             main(int, char **);
+#endif
+
+/*
+ * These definitions handle 4.2 systems without additional syslog facilities.
+ */
+#ifndef LOG_CONS
+#define LOG_CONS	0       /* Don't bother if not defined... */
+#endif
+#ifndef LOG_PID
+#define LOG_PID		0       /* Don't bother if not defined... */
+#endif
+#ifndef LOG_LOCAL0
+#define LOG_LOCAL0	0
+#endif
+#ifndef LOG_LOCAL1
+#define LOG_LOCAL1	0
+#endif
+#ifndef LOG_LOCAL2
+#define LOG_LOCAL2	0
+#endif
+#ifndef LOG_LOCAL3
+#define LOG_LOCAL3	0
+#endif
+#ifndef LOG_LOCAL4
+#define LOG_LOCAL4	0
+#endif
+#ifndef LOG_LOCAL5
+#define LOG_LOCAL5	0
+#endif
+#ifndef LOG_LOCAL6
+#define LOG_LOCAL6	0
+#endif
+#ifndef LOG_LOCAL7
+#define LOG_LOCAL7	0
+#endif
+#ifndef LOG_DAEMON
+#define LOG_DAEMON	0
+#endif
+
+
+static void
+usage(char *prog)
+{
+#ifdef WIN32
+    printf("\nUsage:  %s [-register] [OPTIONS] [LISTENING ADDRESSES]",
+           prog);
+    printf("\n        %s -unregister", prog);
+#else
+    printf("\nUsage:  %s [OPTIONS] [LISTENING ADDRESSES]", prog);
+#endif
+    printf("\n");
+    printf("\n\tVersion:  %s\n", netsnmp_get_version());
+    printf("\tWeb:      http://www.net-snmp.org/\n");
+    printf("\tEmail:    net-snmp-coders@lists.sourceforge.net\n");
+    printf("\n  -a\t\t\tlog addresses\n");
+    printf("  -A\t\t\tappend to the logfile rather than truncating it\n");
+    printf("  -c FILE\t\tread FILE as a configuration file\n");
+    printf("  -C\t\t\tdo not read the default configuration files\n");
+    printf("  -d\t\t\tdump sent and received SNMP packets\n");
+    printf("  -D\t\t\tturn on debugging output\n");
+    printf("  -f\t\t\tdo not fork from the shell\n");
+#if HAVE_UNISTD_H
+    printf("  -g GID\t\tchange to this numeric gid after opening\n"
+	   "\t\t\t  transport endpoints\n");
+#endif
+    printf("  -h, --help\t\tdisplay this usage message\n");
+    printf("  -H\t\t\tdisplay configuration file directives understood\n");
+    printf("  -I [-]INITLIST\tlist of mib modules to initialize (or not)\n");
+    printf("\t\t\t  (run snmpd with -Dmib_init for a list)\n");
+    printf("  -l FILE\t\tprint warnings/messages to FILE\n");
+#ifdef LOGFILE
+    printf("\t\t\t  (by default FILE=%s)\n", LOGFILE);
+#else
+    printf("\t\t\t  (by default FILE=none)\n");
+#endif
+    printf("  -L\t\t\tprint warnings/messages to stdout/err\n");
+    printf("  -P FILE\t\tstore process id in FILE\n");
+    printf("  -q\t\t\tprint information in a more parsable format\n");
+    printf("  -r\t\t\tdo not exit if files only accessible to root\n"
+	   "\t\t\t  cannot be opened\n");
+#ifdef WIN32
+    printf("  -register\t\tregister as a Windows service\n");
+    printf("  \t\t\t  (followed by the startup parameter list)\n");
+    printf("  \t\t\t  Note that not all parameters are relevant when running as a service\n");
+#endif
+    printf("  -s\t\t\tlog warnings/messages to syslog\n");
+    printf("  -S d|i|0-7\t\tset syslog facility to LOG_DAEMON (d), LOG_INFO (i)\n\t\t\t  or LOG_LOCAL[0-7] (default LOG_DAEMON)\n");
+#if HAVE_UNISTD_H
+    printf("  -u UID\t\tchange to this uid (numeric or textual) after\n"
+	   "\t\t\t  opening transport endpoints\n");
+#endif
+#ifdef WIN32
+    printf("  -unregister\t\tunregister as a Windows service\n");
+#endif
+    printf("  -v, --version\t\tdisplay version information\n");
+    printf("  -V\t\t\tverbose display\n");
+#if defined(USING_AGENTX_SUBAGENT_MODULE)|| defined(USING_AGENTX_MASTER_MODULE)
+    printf("  -x ADDRESS\t\tuse ADDRESS as AgentX address\n");
+#endif
+#ifdef USING_AGENTX_SUBAGENT_MODULE
+    printf("  -X\t\t\trun as an AgentX subagent rather than as an\n"
+	   "\t\t\t  SNMP master agent\n");
+#endif
+
+    printf("\n");
+    exit(1);
+}
+
+static void
+version(void)
+{
+    printf("\nNET-SNMP version:  %s\n", netsnmp_get_version());
+    printf("Web:               http://www.net-snmp.org/\n");
+    printf("Email:             net-snmp-coders@lists.sourceforge.net\n\n");
+    exit(0);
+}
+
+RETSIGTYPE
+SnmpdShutDown(int a)
+{
+#ifdef WIN32
+    extern netsnmp_session *main_session;
+#endif
+    running = 0;
+#ifdef WIN32
+    /*
+     * In case of windows, select() in receive() function will not return 
+     * on signal. Thats why following function is called, which closes the 
+     * socket descriptors and causes the select() to return
+     */
+    snmp_close(main_session);
+#endif
+}
+
+#ifdef SIGHUP
+RETSIGTYPE
+SnmpdReconfig(int a)
+{
+    reconfig = 1;
+    signal(SIGHUP, SnmpdReconfig);
+}
+#endif
+
+#ifdef SIGUSR1
+extern void     dump_registry(void);
+RETSIGTYPE
+SnmpdDump(int a)
+{
+    dump_registry();
+    signal(SIGUSR1, SnmpdDump);
+}
+#endif
+
+
+static void
+SnmpTrapNodeDown(void)
+{
+    send_easy_trap(SNMP_TRAP_ENTERPRISESPECIFIC, 2);
+    /*
+     * XXX  2 - Node Down #define it as NODE_DOWN_TRAP 
+     */
+}
+
+static void
+setup_log(int restart, int dont_zero, int stderr_log, int syslog_log, 
+	  char *logfile)
+{
+    static char logfile_s[PATH_MAX + 1] = { 0 };
+    static int dont_zero_s  = 0;
+    static int stderr_log_s = 0;
+    static int syslog_log_s = 0;
+
+    if (restart == 0) {
+	if (logfile != NULL) {
+	    strncpy(logfile_s, logfile, PATH_MAX);
+	}
+	dont_zero_s  = dont_zero;
+	stderr_log_s = stderr_log;
+	syslog_log_s = syslog_log;
+    }
+
+    if (stderr_log_s) {
+	snmp_enable_stderrlog();
+    } else {
+	snmp_disable_stderrlog();
+    }
+
+    if (logfile_s[0]) {
+	snmp_enable_filelog(logfile_s, dont_zero_s);
+    }
+
+    if (syslog_log_s) {
+	snmp_enable_syslog_ident("snmpd", Facility);
+    }
+}
+
+/*******************************************************************-o-******
+ * main - Non Windows
+ * SnmpDeamonMain - Windows to support windows serivce
+ *
+ * Parameters:
+ *	 argc
+ *	*argv[]
+ *      
+ * Returns:
+ *	0	Always succeeds.  (?)
+ *
+ *
+ * Setup and start the agent daemon.
+ *
+ * Also successfully EXITs with zero for some options.
+ */
+int
+#ifdef WIN32
+SnmpDaemonMain(int argc, TCHAR * argv[])
+#else
+main(int argc, char *argv[])
+#endif
+{
+    char            options[128] = "aAc:CdD::fhHI:l:LP:qrsS:UvV-:";
+    int             arg, i, ret;
+    int             dont_fork = 0;
+    int             dont_zero_log = 0;
+    int             stderr_log = 0, syslog_log = 0;
+    int             uid = 0, gid = 0;
+    int             agent_mode = -1;
+    char            logfile[PATH_MAX + 1] = { 0 };
+    char           *cptr, **argvptr;
+    char           *pid_file = NULL;
+#if HAVE_GETPID
+    int fd;
+    FILE           *PID;
+#endif
+
+#ifdef LOGFILE
+    strncpy(logfile, LOGFILE, PATH_MAX);
+#endif
+
+#ifdef NO_ROOT_ACCESS
+    /*
+     * Default to no.  
+     */
+    netsnmp_ds_set_boolean(NETSNMP_DS_APPLICATION_ID, 
+			   NETSNMP_DS_AGENT_NO_ROOT_ACCESS, 1);
+#endif
+    /*
+     * Default to NOT running an AgentX master.  
+     */
+    netsnmp_ds_set_boolean(NETSNMP_DS_APPLICATION_ID, 
+			   NETSNMP_DS_AGENT_AGENTX_MASTER, 0);
+    netsnmp_ds_set_int(NETSNMP_DS_APPLICATION_ID,
+                       NETSNMP_DS_AGENT_AGENTX_TIMEOUT, -1);
+    netsnmp_ds_set_int(NETSNMP_DS_APPLICATION_ID,
+                       NETSNMP_DS_AGENT_AGENTX_RETRIES, -1);
+
+    /*
+     * Add some options if they are available.  
+     */
+#if HAVE_UNISTD_H
+    strcat(options, "g:u:");
+#endif
+#if defined(USING_AGENTX_SUBAGENT_MODULE)|| defined(USING_AGENTX_MASTER_MODULE)
+    strcat(options, "x:");
+#endif
+#ifdef USING_AGENTX_SUBAGENT_MODULE
+    strcat(options, "X");
+#endif
+
+    /*
+     * Now process options normally.  
+     */
+
+    while ((arg = getopt(argc, argv, options)) != EOF) {
+        switch (arg) {
+        case '-':
+            if (strcasecmp(optarg, "help") == 0) {
+                usage(argv[0]);
+            }
+            if (strcasecmp(optarg, "version") == 0) {
+                version();
+            }
+
+            handle_long_opt(optarg);
+            break;
+
+        case 'a':
+            log_addresses++;
+            break;
+
+        case 'A':
+            dont_zero_log = 1;
+            break;
+
+        case 'c':
+            if (optarg != NULL) {
+                netsnmp_ds_set_string(NETSNMP_DS_LIBRARY_ID, 
+				      NETSNMP_DS_LIB_OPTIONALCONFIG, optarg);
+            } else {
+                usage(argv[0]);
+            }
+            break;
+
+        case 'C':
+            netsnmp_ds_set_boolean(NETSNMP_DS_LIBRARY_ID, 
+				   NETSNMP_DS_LIB_DONT_READ_CONFIGS, 1);
+            break;
+
+        case 'd':
+            snmp_set_dump_packet(++snmp_dump_packet);
+            netsnmp_ds_set_boolean(NETSNMP_DS_APPLICATION_ID, 
+				   NETSNMP_DS_AGENT_VERBOSE, 1);
+            break;
+
+        case 'D':
+            debug_register_tokens(optarg);
+            snmp_set_do_debugging(1);
+            break;
+
+        case 'f':
+            dont_fork = 1;
+            break;
+
+#if HAVE_UNISTD_H
+        case 'g':
+            if (optarg != NULL) {
+                netsnmp_ds_set_int(NETSNMP_DS_APPLICATION_ID, 
+				   NETSNMP_DS_AGENT_GROUPID, atoi(optarg));
+            } else {
+                usage(argv[0]);
+            }
+            break;
+#endif
+
+        case 'h':
+            usage(argv[0]);
+            break;
+
+        case 'H':
+            netsnmp_ds_set_boolean(NETSNMP_DS_APPLICATION_ID, 
+				   NETSNMP_DS_AGENT_NO_ROOT_ACCESS, 1);
+            init_agent("snmpd");        /* register our .conf handlers */
+            init_mib_modules();
+            init_snmp("snmpd");
+            fprintf(stderr, "Configuration directives understood:\n");
+            read_config_print_usage("  ");
+            exit(0);
+
+        case 'I':
+            if (optarg != NULL) {
+                add_to_init_list(optarg);
+            } else {
+                usage(argv[0]);
+            }
+            break;
+
+        case 'l':
+            if (optarg != NULL) {
+                if (strlen(optarg) > PATH_MAX) {
+                    fprintf(stderr,
+                            "%s: logfile path too long (limit %d chars)\n",
+                            argv[0], PATH_MAX);
+                    exit(1);
+                }
+                strncpy(logfile, optarg, PATH_MAX);
+            } else {
+                usage(argv[0]);
+            }
+            break;
+
+        case 'L':
+            stderr_log = 1;
+            break;
+
+        case 'P':
+            if (optarg != NULL) {
+                pid_file = optarg;
+            } else {
+                usage(argv[0]);
+            }
+            break;
+
+        case 'q':
+            snmp_set_quick_print(1);
+            break;
+
+        case 'r':
+            netsnmp_ds_toggle_boolean(NETSNMP_DS_APPLICATION_ID, 
+				      NETSNMP_DS_AGENT_NO_ROOT_ACCESS);
+            break;
+
+        case 's':
+            syslog_log = 1;
+            break;
+
+        case 'S':
+            if (optarg != NULL) {
+                switch (*optarg) {
+                case 'd':
+                case 'D':
+                    Facility = LOG_DAEMON;
+                    break;
+                case 'i':
+                case 'I':
+                    Facility = LOG_INFO;
+                    break;
+                case '0':
+                    Facility = LOG_LOCAL0;
+                    break;
+                case '1':
+                    Facility = LOG_LOCAL1;
+                    break;
+                case '2':
+                    Facility = LOG_LOCAL2;
+                    break;
+                case '3':
+                    Facility = LOG_LOCAL3;
+                    break;
+                case '4':
+                    Facility = LOG_LOCAL4;
+                    break;
+                case '5':
+                    Facility = LOG_LOCAL5;
+                    break;
+                case '6':
+                    Facility = LOG_LOCAL6;
+                    break;
+                case '7':
+                    Facility = LOG_LOCAL7;
+                    break;
+                default:
+                    fprintf(stderr, "invalid syslog facility: -S%c\n",*optarg);
+                    usage(argv[0]);
+                }
+            } else {
+                fprintf(stderr, "no syslog facility specified\n");
+                usage(argv[0]);
+            }
+            break;
+
+        case 'U':
+            netsnmp_ds_toggle_boolean(NETSNMP_DS_APPLICATION_ID, 
+				      NETSNMP_DS_AGENT_LEAVE_PIDFILE);
+            break;
+
+#if HAVE_UNISTD_H
+        case 'u':
+            if (optarg != NULL) {
+                char           *ecp;
+                int             uid;
+
+                uid = strtoul(optarg, &ecp, 10);
+                if (*ecp) {
+#if HAVE_GETPWNAM && HAVE_PWD_H
+                    struct passwd  *info;
+                    info = getpwnam(optarg);
+                    if (info) {
+                        uid = info->pw_uid;
+                    } else {
+#endif
+                        fprintf(stderr, "Bad user id: %s\n", optarg);
+                        exit(1);
+#if HAVE_GETPWNAM && HAVE_PWD_H
+                    }
+#endif
+                }
+                netsnmp_ds_set_int(NETSNMP_DS_APPLICATION_ID, 
+				   NETSNMP_DS_AGENT_USERID, uid);
+            } else {
+                usage(argv[0]);
+            }
+            break;
+#endif
+
+        case 'v':
+            version();
+
+        case 'V':
+            netsnmp_ds_set_boolean(NETSNMP_DS_APPLICATION_ID, 
+				   NETSNMP_DS_AGENT_VERBOSE, 1);
+            break;
+
+#if defined(USING_AGENTX_SUBAGENT_MODULE)|| defined(USING_AGENTX_MASTER_MODULE)
+        case 'x':
+            if (optarg != NULL) {
+                netsnmp_ds_set_string(NETSNMP_DS_APPLICATION_ID, 
+				      NETSNMP_DS_AGENT_X_SOCKET, optarg);
+            } else {
+                usage(argv[0]);
+            }
+            netsnmp_ds_set_boolean(NETSNMP_DS_APPLICATION_ID, 
+				   NETSNMP_DS_AGENT_AGENTX_MASTER, 1);
+            break;
+#endif
+
+        case 'X':
+#if defined(USING_AGENTX_SUBAGENT_MODULE)
+            agent_mode = SUB_AGENT;
+#else
+            fprintf(stderr, "%s: Illegal argument -X:"
+		            "AgentX support not compiled in.\n", argv[0]);
+            usage(argv[0]);
+            exit(1);
+#endif
+            break;
+
+        default:
+            usage(argv[0]);
+            break;
+        }
+    }
+
+    if (optind < argc) {
+        /*
+         * There are optional transport addresses on the command line.  
+         */
+        DEBUGMSGTL(("snmpd/main", "optind %d, argc %d\n", optind, argc));
+        for (i = optind; i < argc; i++) {
+            char *c, *astring;
+            if ((c = netsnmp_ds_get_string(NETSNMP_DS_APPLICATION_ID, 
+					   NETSNMP_DS_AGENT_PORTS))) {
+                astring = malloc(strlen(c) + 2 + strlen(argv[i]));
+                if (astring == NULL) {
+                    fprintf(stderr, "malloc failure processing argv[%d]\n", i);
+                    exit(1);
+                }
+                sprintf(astring, "%s,%s", c, argv[i]);
+                netsnmp_ds_set_string(NETSNMP_DS_APPLICATION_ID, 
+				      NETSNMP_DS_AGENT_PORTS, astring);
+                free(astring);
+            } else {
+                netsnmp_ds_set_string(NETSNMP_DS_APPLICATION_ID, 
+				      NETSNMP_DS_AGENT_PORTS, argv[i]);
+            }
+        }
+        DEBUGMSGTL(("snmpd/main", "port spec: %s\n",
+                    netsnmp_ds_get_string(NETSNMP_DS_APPLICATION_ID, 
+					  NETSNMP_DS_AGENT_PORTS)));
+    }
+
+    setup_log(0, dont_zero_log, stderr_log, syslog_log, logfile);
+
+    /*
+     * Initialize a argv set to the current for restarting the agent.   
+     */
+    argvrestartp = (char **)malloc((argc + 2) * sizeof(char *));
+    argvptr = argvrestartp;
+    for (i = 0, ret = 1; i < argc; i++) {
+        ret += strlen(argv[i]) + 1;
+    }
+    argvrestart = (char *) malloc(ret);
+    argvrestartname = (char *) malloc(strlen(argv[0]) + 1);
+    if (!argvrestartp || !argvrestart || !argvrestartname) {
+        fprintf(stderr, "malloc failure processing argvrestart\n");
+        exit(1);
+    }
+    strcpy(argvrestartname, argv[0]);
+    if (agent_mode == -1) {
+        if (strstr(argvrestartname, "agentxd") != NULL) {
+            netsnmp_ds_set_boolean(NETSNMP_DS_APPLICATION_ID, 
+				   NETSNMP_DS_AGENT_ROLE, SUB_AGENT);
+        } else {
+            netsnmp_ds_set_boolean(NETSNMP_DS_APPLICATION_ID, 
+				   NETSNMP_DS_AGENT_ROLE, MASTER_AGENT);
+        }
+    } else {
+        netsnmp_ds_set_boolean(NETSNMP_DS_APPLICATION_ID, 
+			       NETSNMP_DS_AGENT_ROLE, agent_mode);
+    }
+
+    for (cptr = argvrestart, i = 0; i < argc; i++) {
+        strcpy(cptr, argv[i]);
+        *(argvptr++) = cptr;
+        cptr += strlen(argv[i]) + 1;
+    }
+    *cptr = 0;
+    *argvptr = NULL;
+
+#ifdef BUFSIZ
+    setvbuf(stdout, NULL, _IOLBF, BUFSIZ);
+#endif
+    /*
+     * Initialize the world.  Detach from the shell.  Create initial user.  
+     */
+#if HAVE_FORK
+    if (!dont_fork) {
+        /*
+         * Fork to return control to the invoking process and to
+         * guarantee that we aren't a process group leader.
+         */
+        if (fork() != 0) {
+            /* Parent. */
+            if (!netsnmp_ds_get_boolean(NETSNMP_DS_APPLICATION_ID,
+                                        NETSNMP_DS_AGENT_QUIT_IMMEDIATELY)) {
+                exit(0);
+            }
+        } else {
+            /* Child. */
+#ifdef HAVE_SETSID
+            /* Become a process/session group leader. */
+            setsid();
+#endif
+            /*
+             * Fork to let the process/session group leader exit.
+             */
+            if (fork() != 0) {
+                /* Parent. */
+                exit(0);
+            }
+#ifndef WIN32
+            else {
+                /* Child. */
+
+                /* Avoid keeping any directory in use. */
+                chdir("/");
+
+                if (!stderr_log) {
+                    /*
+                     * Close inherited file descriptors to avoid
+                     * keeping unnecessary references.
+                     */
+                    close(0);
+                    close(1);
+                    close(2);
+
+                    /*
+                     * Redirect std{in,out,err} to /dev/null, just in
+                     * case.
+                     */
+                    open("/dev/null", O_RDWR);
+                    dup(0);
+                    dup(0);
+                }
+            }
+#endif /* !WIN32 */
+        }
+    }
+#endif /* HAVE_FORK */
+
+    SOCK_STARTUP;
+    init_agent("snmpd");        /* do what we need to do first. */
+    init_mib_modules();
+
+    /*
+     * start library 
+     */
+    init_snmp("snmpd");
+
+    if ((ret = init_master_agent()) != 0) {
+        /*
+         * Some error opening one of the specified agent transports.  
+         */
+        Exit(1);                /*  Exit logs exit val for us  */
+    }
+#ifdef SIGTERM
+    DEBUGMSGTL(("signal", "registering SIGTERM signal handler\n"));
+    signal(SIGTERM, SnmpdShutDown);
+#endif
+#ifdef SIGINT
+    DEBUGMSGTL(("signal", "registering SIGINT signal handler\n"));
+    signal(SIGINT, SnmpdShutDown);
+#endif
+#ifdef SIGHUP
+    DEBUGMSGTL(("signal", "registering SIGHUP signal handler\n"));
+    signal(SIGHUP, SnmpdReconfig);
+#endif
+#ifdef SIGUSR1
+    DEBUGMSGTL(("signal", "registering SIGUSR1 signal handler\n"));
+    signal(SIGUSR1, SnmpdDump);
+#endif
+#ifdef SIGPIPE
+    DEBUGMSGTL(("signal", "registering SIGPIPE signal handler\n"));
+    signal(SIGPIPE, SIG_IGN);   /* 'Inline' failure of wayward readers */
+#endif
+
+    /*
+     * Store persistent data immediately in case we crash later.  
+     */
+    snmp_store("snmpd");
+
+    /*
+     * Send coldstart trap if possible.  
+     */
+    send_easy_trap(0, 0);
+
+#if HAVE_GETPID
+    if (pid_file != NULL) {
+	    /*
+	     * unlink the pid_file, if it exists, prior to open.  Without
+	     * doing this the open will fail if the user specified pid_file
+	     * already exists.
+	     */
+	    unlink(pid_file);
+	    fd = open(pid_file, O_CREAT | O_EXCL | O_WRONLY, 0600);
+	    if (fd == -1) {
+		    snmp_log_perror(pid_file);
+		    if (!netsnmp_ds_get_boolean(NETSNMP_DS_APPLICATION_ID, 
+			NETSNMP_DS_AGENT_NO_ROOT_ACCESS)) {
+			    exit(1);
+		    }
+	    } else {
+		    if ((PID = fdopen(fd, "w")) == NULL) {
+			    snmp_log_perror(pid_file);
+			    exit(1);
+		    } else {
+			    fprintf(PID, "%d\n", (int) getpid());
+			    fclose(PID);
+		    }
+		    close(fd);
+	    }
+    }
+#endif
+
+#if HAVE_UNISTD_H
+#ifdef HAVE_SETGID
+    if ((gid = netsnmp_ds_get_int(NETSNMP_DS_APPLICATION_ID, 
+				  NETSNMP_DS_AGENT_GROUPID)) != 0) {
+        DEBUGMSGTL(("snmpd/main", "Changing gid to %d.\n", gid));
+        if (setgid(gid) == -1
+#ifdef HAVE_SETGROUPS
+            || setgroups(1, (gid_t *)&gid) == -1
+#endif
+            ) {
+            snmp_log_perror("setgid failed");
+            if (!netsnmp_ds_get_boolean(NETSNMP_DS_APPLICATION_ID, 
+					NETSNMP_DS_AGENT_NO_ROOT_ACCESS)) {
+                exit(1);
+            }
+        }
+    }
+#endif
+#ifdef HAVE_SETUID
+    if ((uid = netsnmp_ds_get_int(NETSNMP_DS_APPLICATION_ID, 
+				  NETSNMP_DS_AGENT_USERID)) != 0) {
+        DEBUGMSGTL(("snmpd/main", "Changing uid to %d.\n", uid));
+        if (setuid(uid) == -1) {
+            snmp_log_perror("setuid failed");
+            if (!netsnmp_ds_get_boolean(NETSNMP_DS_APPLICATION_ID, 
+					NETSNMP_DS_AGENT_NO_ROOT_ACCESS)) {
+                exit(1);
+            }
+        }
+    }
+#endif
+#endif
+
+    /*
+     * We're up, log our version number.  
+     */
+    snmp_log(LOG_INFO, "NET-SNMP version %s\n", netsnmp_get_version());
+#ifdef WIN32
+    agent_status = AGENT_RUNNING;
+#endif
+    netsnmp_addrcache_initialise();
+
+    /*
+     * Forever monitor the dest_port for incoming PDUs.  
+     */
+    DEBUGMSGTL(("snmpd/main", "We're up.  Starting to process data.\n"));
+    if (!netsnmp_ds_get_boolean(NETSNMP_DS_APPLICATION_ID, 
+				NETSNMP_DS_AGENT_QUIT_IMMEDIATELY))
+        receive();
+#include "mib_module_shutdown.h"
+    DEBUGMSGTL(("snmpd/main", "sending shutdown trap\n"));
+    SnmpTrapNodeDown();
+    DEBUGMSGTL(("snmpd/main", "Bye...\n"));
+    snmp_shutdown("snmpd");
+    if (!netsnmp_ds_get_boolean(NETSNMP_DS_APPLICATION_ID, 
+				NETSNMP_DS_AGENT_LEAVE_PIDFILE) &&
+	(pid_file != NULL)) {
+        unlink(pid_file);
+    }
+#ifdef WIN32
+    agent_status = AGENT_STOPPED;
+#endif
+    return 0;
+}                               /* End main() -- snmpd */
+
+/*******************************************************************-o-******
+ * receive
+ *
+ * Parameters:
+ *      
+ * Returns:
+ *	0	On success.
+ *	-1	System error.
+ *
+ * Infinite while-loop which monitors incoming messges for the agent.
+ * Invoke the established message handlers for incoming messages on a per
+ * port basis.  Handle timeouts.
+ */
+static int
+receive(void)
+{
+    int             numfds;
+    fd_set          readfds, writefds, exceptfds;
+    struct timeval  timeout, *tvp = &timeout;
+    struct timeval  sched, *svp = &sched, now, *nvp = &now;
+    int             count, block, i;
+#ifdef	USING_SMUX_MODULE
+    int             sd;
+#endif                          /* USING_SMUX_MODULE */
+
+
+    /*
+     * Set the 'sched'uled timeout to the current time + one TIMETICK.
+     */
+    gettimeofday(nvp, (struct timezone *) NULL);
+    svp->tv_usec = nvp->tv_usec + TIMETICK;
+    svp->tv_sec = nvp->tv_sec;
+
+    while (svp->tv_usec >= ONE_SEC) {
+        svp->tv_usec -= ONE_SEC;
+        svp->tv_sec++;
+    }
+
+    /*
+     * Loop-forever: execute message handlers for sockets with data,
+     * reset the 'sched'uler.
+     */
+    while (running) {
+        if (reconfig) {
+            reconfig = 0;
+            snmp_log(LOG_INFO, "Reconfiguring daemon\n");
+	    /*  Stop and restart logging.  This allows logfiles to be
+		rotated etc.  */
+	    snmp_disable_log();
+	    setup_log(1, 0, 0, 0, NULL);
+	    snmp_log(LOG_INFO, "NET-SNMP version %s restarted\n",
+		     netsnmp_get_version());
+            update_config();
+            send_easy_trap(SNMP_TRAP_ENTERPRISESPECIFIC, 3);
+        }
+
+        for (i = 0; i < NUM_EXTERNAL_SIGS; i++) {
+            if (external_signal_scheduled[i]) {
+                external_signal_scheduled[i]--;
+                external_signal_handler[i](i);
+            }
+        }
+
+        tvp = &timeout;
+        tvp->tv_sec = 0;
+        tvp->tv_usec = TIMETICK;
+
+        numfds = 0;
+        FD_ZERO(&readfds);
+        FD_ZERO(&writefds);
+        FD_ZERO(&exceptfds);
+        block = 0;
+        snmp_select_info(&numfds, &readfds, tvp, &block);
+        if (block == 1) {
+            tvp = NULL;         /* block without timeout */
+	}
+
+#ifdef	USING_SMUX_MODULE
+        if (smux_listen_sd >= 0) {
+            FD_SET(smux_listen_sd, &readfds);
+            numfds =
+                smux_listen_sd >= numfds ? smux_listen_sd + 1 : numfds;
+            for (i = 0; i < sdlen; i++) {
+                FD_SET(sdlist[i], &readfds);
+                numfds = sdlist[i] >= numfds ? sdlist[i] + 1 : numfds;
+            }
+        }
+#endif                          /* USING_SMUX_MODULE */
+
+        for (i = 0; i < external_readfdlen; i++) {
+            FD_SET(external_readfd[i], &readfds);
+            if (external_readfd[i] >= numfds)
+                numfds = external_readfd[i] + 1;
+        }
+        for (i = 0; i < external_writefdlen; i++) {
+            FD_SET(external_writefd[i], &writefds);
+            if (external_writefd[i] >= numfds)
+                numfds = external_writefd[i] + 1;
+        }
+        for (i = 0; i < external_exceptfdlen; i++) {
+            FD_SET(external_exceptfd[i], &exceptfds);
+            if (external_exceptfd[i] >= numfds)
+                numfds = external_exceptfd[i] + 1;
+        }
+
+    reselect:
+        DEBUGMSGTL(("snmpd/select", "select( numfds=%d, ..., tvp=%p)\n",
+                    numfds, tvp));
+        count = select(numfds, &readfds, &writefds, &exceptfds, tvp);
+        DEBUGMSGTL(("snmpd/select", "returned, count = %d\n", count));
+
+        if (count > 0) {
+
+#ifdef USING_SMUX_MODULE
+            /*
+             * handle the SMUX sd's 
+             */
+            if (smux_listen_sd >= 0) {
+                for (i = 0; i < sdlen; i++) {
+                    if (FD_ISSET(sdlist[i], &readfds)) {
+                        if (smux_process(sdlist[i]) < 0) {
+                            for (; i < (sdlen - 1); i++) {
+                                sdlist[i] = sdlist[i + 1];
+                            }
+                            sdlen--;
+                        }
+                    }
+                }
+                /*
+                 * new connection 
+                 */
+                if (FD_ISSET(smux_listen_sd, &readfds)) {
+                    if ((sd = smux_accept(smux_listen_sd)) >= 0) {
+                        sdlist[sdlen++] = sd;
+                    }
+                }
+            }
+#endif                          /* USING_SMUX_MODULE */
+
+            snmp_read(&readfds);
+
+            for (i = 0; count && (i < external_readfdlen); i++) {
+                if (FD_ISSET(external_readfd[i], &readfds)) {
+                    DEBUGMSGTL(("snmpd/select", "readfd[%d] = %d\n",
+                                i, external_readfd[i]));
+                    external_readfdfunc[i] (external_readfd[i],
+                                            external_readfd_data[i]);
+                    FD_CLR(external_readfd[i], &readfds);
+                    count--;
+                }
+            }
+            for (i = 0; count && (i < external_writefdlen); i++) {
+                if (FD_ISSET(external_writefd[i], &writefds)) {
+                    DEBUGMSGTL(("snmpd/select", "writefd[%d] = %d\n",
+                                i, external_writefd[i]));
+                    external_writefdfunc[i] (external_writefd[i],
+                                             external_writefd_data[i]);
+                    FD_CLR(external_writefd[i], &writefds);
+                    count--;
+                }
+            }
+            for (i = 0; count && (i < external_exceptfdlen); i++) {
+                if (FD_ISSET(external_exceptfd[i], &exceptfds)) {
+                    DEBUGMSGTL(("snmpd/select", "exceptfd[%d] = %d\n",
+                                i, external_exceptfd[i]));
+                    external_exceptfdfunc[i] (external_exceptfd[i],
+                                              external_exceptfd_data[i]);
+                    FD_CLR(external_exceptfd[i], &exceptfds);
+                    count--;
+                }
+            }
+
+        } else
+            switch (count) {
+            case 0:
+                snmp_timeout();
+                break;
+            case -1:
+                if (errno == EINTR) {
+                    /*
+                     * likely that we got a signal. Check our special signal
+                     * flags before retrying select.
+                     */
+		    if (running && !reconfig) {
+                        goto reselect;
+		    }
+                    continue;
+                } else {
+                    snmp_log_perror("select");
+                }
+                return -1;
+            default:
+                snmp_log(LOG_ERR, "select returned %d\n", count);
+                return -1;
+            }                   /* endif -- count>0 */
+
+
+
+
+        /*
+         * If the time 'now' is greater than the 'sched'uled time, then:
+         *
+         *    Check alarm and event timers.
+         *    Reset the 'sched'uled time to current time + one TIMETICK.
+         *    Age the cache network addresses (from whom messges have
+         *        been received).
+         */
+        gettimeofday(nvp, (struct timezone *)NULL);
+
+        if (nvp->tv_sec > svp->tv_sec || (nvp->tv_sec == svp->tv_sec &&
+					  nvp->tv_usec > svp->tv_usec)) {
+            svp->tv_usec = nvp->tv_usec + TIMETICK;
+            svp->tv_sec = nvp->tv_sec;
+
+            while (svp->tv_usec >= ONE_SEC) {
+                svp->tv_usec -= ONE_SEC;
+                svp->tv_sec++;
+            }
+            if (log_addresses && lastAddrAge++ > 600) {
+                netsnmp_addrcache_age();
+            }
+        }
+
+        /*
+         * endif -- now>sched 
+         */
+        /*
+         * run requested alarms 
+         */
+        run_alarms();
+
+        netsnmp_check_outstanding_agent_requests();
+
+    }                           /* endwhile */
+
+    snmp_log(LOG_INFO, "Received TERM or STOP signal...  shutting down...\n");
+    return 0;
+
+}                               /* end receive() */
+
+
+
+/*******************************************************************-o-******
+ * snmp_input
+ *
+ * Parameters:
+ *	 op
+ *	*session
+ *	 requid
+ *	*pdu
+ *	*magic
+ *      
+ * Returns:
+ *	1		On success	-OR-
+ *	Passes through	Return from alarmGetResponse() when 
+ *	  		  USING_V2PARTY_ALARM_MODULE is defined.
+ *
+ * Call-back function to manage responses to traps (informs) and alarms.
+ * Not used by the agent to process other Response PDUs.
+ */
+int
+snmp_input(int op,
+           netsnmp_session * session,
+           int reqid, netsnmp_pdu *pdu, void *magic)
+{
+    struct get_req_state *state = (struct get_req_state *) magic;
+
+    if (op == NETSNMP_CALLBACK_OP_RECEIVED_MESSAGE) {
+        if (pdu->command == SNMP_MSG_GET) {
+            if (state->type == EVENT_GET_REQ) {
+                /*
+                 * this is just the ack to our inform pdu 
+                 */
+                return 1;
+            }
+        }
+    } else if (op == NETSNMP_CALLBACK_OP_TIMED_OUT) {
+        if (state->type == ALARM_GET_REQ) {
+            /*
+             * Need a mechanism to replace obsolete SNMPv2p alarm 
+             */
+        }
+    }
+    return 1;
+
+}                               /* end snmp_input() */
+
+
+
+/*
+ * Windows Service Related functions 
+ */
+#ifdef WIN32
+/************************************************************
+* main function for Windows
+* Parse command line arguments for startup options,
+* to start as service or console mode application in windows.
+* Invokes appropriate startup funcitons depending on the 
+* parameters passesd
+*************************************************************/
+int
+    __cdecl
+_tmain(int argc, TCHAR * argv[])
+{
+
+    /*
+     * Define Service Name and Description, which appears in windows SCM 
+     */
+    LPCTSTR         lpszServiceName = g_szAppName;      /* Service Registry Name */
+    LPCTSTR         lpszServiceDisplayName = _T("Net SNMP Agent Daemon");       /* Display Name */
+    LPCTSTR         lpszServiceDescription =
+        _T("SNMP agent for windows from Net-SNMP");
+    InputParams     InputOptions;
+
+
+    int             nRunType = RUN_AS_CONSOLE;
+    nRunType = ParseCmdLineForServiceOption(argc, argv);
+
+    switch (nRunType) {
+    case REGISTER_SERVICE:
+        /*
+         * Register As service 
+         */
+        InputOptions.Argc = argc;
+        InputOptions.Argv = argv;
+        RegisterService(lpszServiceName,
+                        lpszServiceDisplayName,
+                        lpszServiceDescription, &InputOptions);
+        exit(0);
+        break;
+    case UN_REGISTER_SERVICE:
+        /*
+         * Unregister service 
+         */
+        UnregisterService(lpszServiceName);
+        exit(0);
+        break;
+    case RUN_AS_SERVICE:
+        /*
+         * Run as service 
+         */
+        /*
+         * Register Stop Function 
+         */
+        RegisterStopFunction(StopSnmpAgent);
+        return RunAsService(SnmpDaemonMain);
+        break;
+    default:
+        /*
+         * Run Net-Snmpd in console mode 
+         */
+        /*
+         * Invoke SnmpDeamonMain with input arguments 
+         */
+        return SnmpDaemonMain(argc, argv);
+        break;
+    }
+}
+
+/*
+ * To stop Snmp Agent deamon 
+ * This portion is still not working
+ */
+void
+StopSnmpAgent(void)
+{
+    /*
+     * Shut Down Agent 
+     */
+    SnmpdShutDown(1);
+
+    /*
+     * Wait till agent is completely stopped 
+     */
+
+    while (agent_status != AGENT_STOPPED) {
+        Sleep(100);
+    }
+}
+
+#endif/*WIN32*/
diff -Naur tomato/release/src/router/snmp/agent/snmpd.h tomato121/release/src/router/snmp/agent/snmpd.h
--- tomato/release/src/router/snmp/agent/snmpd.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/snmpd.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,19 @@
+/*
+ * snmpd.h
+ */
+
+#define MASTER_AGENT 0
+#define SUB_AGENT    1
+extern int      agent_role;
+
+extern int      snmp_dump_packet;
+extern int      verbose;
+extern int      (*sd_handlers[]) (int);
+extern int      smux_listen_sd;
+
+extern int      snmp_read_packet(int);
+
+/*
+ * config file parsing routines 
+ */
+void            agentBoots_conf(char *, char *);
diff -Naur tomato/release/src/router/snmp/agent/snmp_perl.c tomato121/release/src/router/snmp/agent/snmp_perl.c
--- tomato/release/src/router/snmp/agent/snmp_perl.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/snmp_perl.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,141 @@
+#include <EXTERN.h>
+#include "perl.h"
+
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+static PerlInterpreter *my_perl;
+
+void            boot_DynaLoader(CV * cv);
+
+void
+xs_init(void)
+{
+    char            myfile[] = __FILE__;
+    char            modulename[] = "DynaLoader::boot_DynaLoader";
+    /*
+     * DynaLoader is a special case 
+     */
+    newXS(modulename, boot_DynaLoader, myfile);
+}
+
+void
+maybe_source_perl_startup(void)
+{
+    const char     *embedargs[] = { "", "" };
+    const char     *perl_init_file = netsnmp_ds_get_string(NETSNMP_DS_APPLICATION_ID,
+							   NETSNMP_DS_AGENT_PERL_INIT_FILE);
+    char            init_file[SNMP_MAXBUF];
+
+    static int      have_done_init = 0;
+
+    if (have_done_init)
+        return;
+    have_done_init = 1;
+
+    if (!perl_init_file) {
+        snprintf(init_file, sizeof(init_file) - 1,
+                 "%s/%s", SNMPSHAREPATH, "snmp_perl.pl");
+        perl_init_file = init_file;
+    }
+    embedargs[1] = perl_init_file;
+
+    DEBUGMSGTL(("perl", "initializing perl (%s)\n", embedargs[1]));
+    my_perl = perl_alloc();
+    if (!my_perl)
+        goto bail_out;
+
+    perl_construct(my_perl);
+    if (perl_parse(my_perl, xs_init, 2, (char **) embedargs, NULL))
+        goto bail_out;
+
+    if (perl_run(my_perl))
+        goto bail_out;
+
+    DEBUGMSGTL(("perl", "done initializing perl\n"));
+
+    return;
+
+  bail_out:
+    snmp_log(LOG_ERR, "embedded perl support failed to initalize\n");
+    netsnmp_ds_set_boolean(NETSNMP_DS_APPLICATION_ID, 
+			   NETSNMP_DS_AGENT_DISABLE_PERL, 1);
+    return;
+}
+
+void
+do_something_perlish(char *something)
+{
+    if (netsnmp_ds_get_boolean(NETSNMP_DS_APPLICATION_ID, 
+			       NETSNMP_DS_AGENT_DISABLE_PERL)) {
+        return;
+    }
+    maybe_source_perl_startup();
+    if (netsnmp_ds_get_boolean(NETSNMP_DS_APPLICATION_ID, 
+			       NETSNMP_DS_AGENT_DISABLE_PERL)) {
+        return;
+    }
+    DEBUGMSGTL(("perl", "calling perl\n"));
+#ifdef HAVE_EVAL_PV
+    /* newer perl */
+    eval_pv(something, TRUE);
+#else
+#ifdef HAVE_PERL_EVAL_PV
+    /* older perl */
+    perl_eval_pv(something, TRUE);
+#endif /* HAVE_PERL_EVAL_PV */
+#endif /* HAVE_EVAL_PV */
+    DEBUGMSGTL(("perl", "finished calling perl\n"));
+}
+
+void
+perl_config_handler(const char *token, char *line)
+{
+    do_something_perlish(line);
+}
+
+void
+init_perl(void)
+{
+    const char     *appid = netsnmp_ds_get_string(NETSNMP_DS_LIBRARY_ID, 
+						  NETSNMP_DS_LIB_APPTYPE);
+    const char     *defaultid = "snmpd";
+
+    if (!appid) {
+        appid = defaultid;
+    }
+
+    /*
+     * register config handlers 
+     */
+    snmpd_register_config_handler("perl", perl_config_handler, NULL,
+                                  "PERLCODE");
+
+    /*
+     * define the perlInitFile token to point to an init file 
+     */
+    netsnmp_ds_register_premib(ASN_OCTET_STR, appid, "perlInitFile",
+			       NETSNMP_DS_APPLICATION_ID, 
+			       NETSNMP_DS_AGENT_PERL_INIT_FILE);
+
+    /*
+     * define the perlInitFile token to point to an init file 
+     */
+    netsnmp_ds_register_premib(ASN_BOOLEAN, appid, "disablePerl",
+			       NETSNMP_DS_APPLICATION_ID,
+			       NETSNMP_DS_AGENT_DISABLE_PERL);
+}
+
+void
+shutdown_perl(void)
+{
+    if (netsnmp_ds_get_boolean(NETSNMP_DS_APPLICATION_ID, 
+			       NETSNMP_DS_AGENT_DISABLE_PERL)) {
+        return;
+    }
+    DEBUGMSGTL(("perl", "shutting down perl\n"));
+    perl_destruct(my_perl);
+    perl_free(my_perl);
+    DEBUGMSGTL(("perl", "finished shutting down perl\n"));
+}
diff -Naur tomato/release/src/router/snmp/agent/snmp_perl.pl tomato121/release/src/router/snmp/agent/snmp_perl.pl
--- tomato/release/src/router/snmp/agent/snmp_perl.pl	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/snmp_perl.pl	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,8 @@
+##
+## SNMPD perl initialization file.
+##
+
+use NetSNMP::agent;
+$agent = new NetSNMP::agent('dont_init_agent' => 1,
+			    'dont_init_lib' => 1);
+
diff -Naur tomato/release/src/router/snmp/agent/snmp_vars.c tomato121/release/src/router/snmp/agent/snmp_vars.c
--- tomato/release/src/router/snmp/agent/snmp_vars.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/agent/snmp_vars.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,289 @@
+/*
+ * snmp_vars.c - return a pointer to the named variable.
+ *
+ *
+ */
+/***********************************************************
+	Copyright 1988, 1989, 1990 by Carnegie Mellon University
+	Copyright 1989	TGV, Incorporated
+
+		      All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of CMU and TGV not be used
+in advertising or publicity pertaining to distribution of the software
+without specific, written prior permission.
+
+CMU AND TGV DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+EVENT SHALL CMU OR TGV BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
+USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
+OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+PERFORMANCE OF THIS SOFTWARE.
+******************************************************************/
+/*
+ * additions, fixes and enhancements for Linux by Erik Schoenfelder
+ * (schoenfr@ibr.cs.tu-bs.de) 1994/1995.
+ * Linux additions taken from CMU to UCD stack by Jennifer Bray of Origin
+ * (jbray@origin-at.co.uk) 1997
+ */
+
+/*
+ * XXXWWW merge todo: incl/excl range changes in differences between
+ * 1.194 and 1.199 
+ */
+
+#include <net-snmp/net-snmp-config.h>
+#if HAVE_STRING_H
+#include <string.h>
+#endif
+#if HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#include <sys/types.h>
+#include <stdio.h>
+#include <fcntl.h>
+
+#if TIME_WITH_SYS_TIME
+# ifdef WIN32
+#  include <sys/timeb.h>
+# else
+#  include <sys/time.h>
+# endif
+# include <time.h>
+#else
+# if HAVE_SYS_TIME_H
+#  include <sys/time.h>
+# else
+#  include <time.h>
+# endif
+#endif
+#if HAVE_WINSOCK_H
+# include <winsock.h>
+#endif
+#if HAVE_SYS_SOCKET_H
+# include <sys/socket.h>
+#endif
+#if HAVE_SYS_STREAM_H
+#include <sys/stream.h>
+#endif
+#if HAVE_SYS_SOCKETVAR_H
+# include <sys/socketvar.h>
+#endif
+#if HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+#if HAVE_NETINET_IN_SYSTM_H
+#include <netinet/in_systm.h>
+#endif
+#if HAVE_NETINET_IP_H
+#include <netinet/ip.h>
+#endif
+#ifdef INET6
+#if HAVE_NETINET_IP6_H
+#include <netinet/ip6.h>
+#endif
+#endif
+#if HAVE_SYS_QUEUE_H
+#include <sys/queue.h>
+#endif
+#if HAVE_NET_ROUTE_H
+#include <net/route.h>
+#endif
+#if HAVE_NETINET_IP_VAR_H
+#include <netinet/ip_var.h>
+#endif
+#ifdef INET6
+#if HAVE_NETINET6_IP6_VAR_H
+#include <netinet6/ip6_var.h>
+#endif
+#endif
+#if HAVE_NETINET_IN_PCB_H
+#include <netinet/in_pcb.h>
+#endif
+#if HAVE_INET_MIB2_H
+#include <inet/mib2.h>
+#endif
+
+#if HAVE_DMALLOC_H
+#include <dmalloc.h>
+#endif
+
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include "kernel.h"
+
+#include "mibgroup/struct.h"
+#include "snmpd.h"
+#include "net-snmp/agent/all_helpers.h"
+#include "mib_module_includes.h"
+#include "net-snmp/library/container.h"
+
+#ifndef  MIN
+#define  MIN(a,b)                     (((a) < (b)) ? (a) : (b))
+#endif
+
+/*
+ * mib clients are passed a pointer to a oid buffer.  Some mib clients
+ * * (namely, those first noticed in mibII/vacm.c) modify this oid buffer
+ * * before they determine if they really need to send results back out
+ * * using it.  If the master agent determined that the client was not the
+ * * right one to talk with, it will use the same oid buffer to pass to the
+ * * rest of the clients, which may not longer be valid.  This should be
+ * * fixed in all clients rather than the master.  However, its not a
+ * * particularily easy bug to track down so this saves debugging time at
+ * * the expense of a few memcpy's.
+ */
+#define MIB_CLIENTS_ARE_EVIL 1
+
+extern netsnmp_subtree *subtrees;
+
+/*
+ *      Each variable name is placed in the variable table, without the
+ * terminating substring that determines the instance of the variable.  When
+ * a string is found that is lexicographicly preceded by the input string,
+ * the function for that entry is called to find the method of access of the
+ * instance of the named variable.  If that variable is not found, NULL is
+ * returned, and the search through the table continues (it will probably
+ * stop at the next entry).  If it is found, the function returns a character
+ * pointer and a length or a function pointer.  The former is the address
+ * of the operand, the latter is a write routine for the variable.
+ *
+ * u_char *
+ * findVar(name, length, exact, var_len, write_method)
+ * oid      *name;          IN/OUT - input name requested, output name found
+ * int      length;         IN/OUT - number of sub-ids in the in and out oid's
+ * int      exact;          IN - TRUE if an exact match was requested.
+ * int      len;            OUT - length of variable or 0 if function returned.
+ * int      write_method;   OUT - pointer to function to set variable,
+ *                                otherwise 0
+ *
+ *     The writeVar function is returned to handle row addition or complex
+ * writes that require boundary checking or executing an action.
+ * This routine will be called three times for each varbind in the packet.
+ * The first time for each varbind, action is set to RESERVE1.  The type
+ * and value should be checked during this pass.  If any other variables
+ * in the MIB depend on this variable, this variable will be stored away
+ * (but *not* committed!) in a place where it can be found by a call to
+ * writeVar for a dependent variable, even in the same PDU.  During
+ * the second pass, action is set to RESERVE2.  If this variable is dependent
+ * on any other variables, it will check them now.  It must check to see
+ * if any non-committed values have been stored for variables in the same
+ * PDU that it depends on.  Sometimes resources will need to be reserved
+ * in the first two passes to guarantee that the operation can proceed
+ * during the third pass.  During the third pass, if there were no errors
+ * in the first two passes, writeVar is called for every varbind with action
+ * set to COMMIT.  It is now that the values should be written.  If there
+ * were errors during the first two passes, writeVar is called in the third
+ * pass once for each varbind, with the action set to FREE.  An opportunity
+ * is thus provided to free those resources reserved in the first two passes.
+ * 
+ * writeVar(action, var_val, var_val_type, var_val_len, statP, name, name_len)
+ * int      action;         IN - RESERVE1, RESERVE2, COMMIT, or FREE
+ * u_char   *var_val;       IN - input or output buffer space
+ * u_char   var_val_type;   IN - type of input buffer
+ * int      var_val_len;    IN - input and output buffer len
+ * u_char   *statP;         IN - pointer to local statistic
+ * oid      *name           IN - pointer to name requested
+ * int      name_len        IN - number of sub-ids in the name
+ */
+
+long            long_return;
+#ifndef ibm032
+u_char          return_buf[258];
+#else
+u_char          return_buf[256];        /* nee 64 */
+#endif
+
+struct timeval  starttime;
+netsnmp_session *callback_master_sess;
+int             callback_master_num;
+
+/*
+ * init_agent() returns non-zero on error 
+ */
+int
+init_agent(const char *app)
+{
+    int             r = 0;
+
+    /*
+     * get current time (ie, the time the agent started) 
+     */
+    gettimeofday(&starttime, NULL);
+    starttime.tv_sec--;
+    starttime.tv_usec += 1000000L;
+
+    /*
+     * we handle alarm signals ourselves in the select loop 
+     */
+    netsnmp_ds_set_boolean(NETSNMP_DS_LIBRARY_ID, 
+			   NETSNMP_DS_LIB_ALARM_DONT_USE_SIG, 1);
+
+#ifdef CAN_USE_NLIST
+    init_kmem("/dev/kmem");
+#endif
+
+    setup_tree();
+
+    init_agent_read_config(app);
+
+#ifdef TESTING
+    auto_nlist_print_tree(-2, 0);
+#endif
+
+#ifndef WIN32
+	/*
+	 * the pipe call creates fds that select chokes on, so
+	 * disable callbacks on WIN32 until a fix can be found
+	 */
+    /*
+     * always register a callback transport for internal use 
+     */
+    callback_master_sess = netsnmp_callback_open(0, handle_snmp_packet,
+                                                 netsnmp_agent_check_packet,
+                                                 netsnmp_agent_check_parse);
+    if (callback_master_sess)
+        callback_master_num = callback_master_sess->local_port;
+    else
+#endif
+        callback_master_num = -1;
+
+    netsnmp_init_helpers();
+    init_traps();
+    netsnmp_container_init_list();
+
+    /*
+     * initialize agentx subagent if necessary. 
+     */
+#ifdef USING_AGENTX_SUBAGENT_MODULE
+    if (netsnmp_ds_get_boolean(NETSNMP_DS_APPLICATION_ID, 
+			       NETSNMP_DS_AGENT_ROLE) == SUB_AGENT) {
+        r = subagent_pre_init();
+        init_subagent();
+    }
+#endif
+
+    /*
+     * Register configuration tokens from transport modules.  
+     */
+#ifdef SNMP_TRANSPORT_UDP_DOMAIN
+    netsnmp_udp_agent_config_tokens_register();
+#endif
+#ifdef SNMP_TRANSPORT_UDPIPV6_DOMAIN
+    netsnmp_udp6_agent_config_tokens_register();
+#endif
+
+#ifdef NETSNMP_EMBEDDED_PERL
+    init_perl();
+#endif
+
+    return r;
+}                               /* end init_agent() */
+
+oid             nullOid[] = { 0, 0 };
+int             nullOidLen = sizeof(nullOid);
diff -Naur tomato/release/src/router/snmp/AGENT.txt tomato121/release/src/router/snmp/AGENT.txt
--- tomato/release/src/router/snmp/AGENT.txt	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/AGENT.txt	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,1163 @@
+Note, this is based on the text from a web page, which can be found in 
+the documentation section of the http://www.net-snmp.org web page.
+
+Extending the UCD-SNMP agent
+============================
+
+This document describes the procedure for writing code to extend
+the functionality of the v4 UCD-SNMP network management agent.
+Modules written using this procedure will also work with the v5
+Net-SNMP agent, though this will not take advantage of the new
+handler-based helper mechanisms.  See the on-line documentation
+for more information and examples of that mechanism.
+We would be very interested in comment and feedback about how useful
+useful you find this description, and ways in which it could be improved.
+
+The information is designed to be read in order - the structure being:
+
+  1. Overview & Introduction
+  2. MIB files, and how they relate to the agent implementation
+  3. Header files
+  4. The basic structure of module implementation code
+  5. The details of non-table based implementations
+  6. The details of simple table based implementations
+  7. The details of more general table based implementations
+  8. How to implement SET-able variables
+
+While the document is intended to be generally self-contained,
+it does occasionally refer to code files shipped with the main UCD
+distribution (in particular the example module), and it may prove
+useful to have these files available for reference.
+
+1. How to write a Mib module
+============================
+
+Introduction
+------------
+
+The design of the UCD SNMP agent has always been shaped by the desire to be
+able to extend its functionality by adding new modules. One of the earliest
+developments from the underlying CMU code base was the ability to call
+external scripts, and this is probably the simplest method of extending the
+agent.
+However, there are circumstances where such an approach is felt to be
+inappropriate - perhaps from considerations of speed, access to the
+necessary data, reliability or elegance. In such cases, the obvious solution
+is to provide C code that can be compiled into the agent itself to implement
+the desired module. Many of the more recent developments in the code
+structure have been intended to ease this process. In particular, one of the
+more recent additions to the suite is the tool mib2c. This is designed to
+take a portion of the MIB tree (as defined by a MIB file) and generate the
+code skeleton necessary to implement this. This document will cover the use
+mib2c, as well as describing the requirements and functionality of the code
+in more detail.
+
+In order to implement a new MIB module, three files are necessary, and these
+will be considered in turn. Note that, by the very nature of the task, this
+document cannot cover the details of precisely how to obtain the necessary
+information from the operating system or application. Instead, it describes
+the code framework that is needed, freeing the implementer from needing to
+understand the detailed internals of the agent, and allowing them to
+concentrate on the particular problem in hand.
+
+It may prove useful to examine some of the existing module implementations
+and examples in the light of this description, and suitable examples will be
+referred to at the appropriate points. However, it should be remembered that
+the UCD agent seeks to support a wide variety of systems, often with
+dramatically differing implementations and interfaces, and this is reflected
+in the complexity of the code. Also, the agent has developed gradually over
+the years, and there is often some measure of duplication or redundancy as a
+result.
+As the FAQ states, the official slogan of the UCD-SNMP developers is
+
+     The current implementation is non-obvious and may need to be
+     improved.
+
+This document describes the ideal, straightforward cases - real life is
+rarely so simple, and the example modules may prove easier to follow at a
+first reading.
+It is also advisable to have a compiled and installed implementation
+available before starting to extend the agent. This will make debugging and
+testing the agent much easier.
+
+A note regarding terminology - the word "module" is widely used throughout
+this document, with a number of different meanings.
+
+   * support for a new MIB,
+     i.e. the whole of the functionality that is required. This is usually
+     termed a MIB module;
+   * a self-contained subset of this, implemented as a single unit.
+     This is usually termed an implementation module (or simply "a module");
+   * the combination of such subsets, usually termed a module group.
+
+Note that the first and third of these are often synonymous - the
+difference being that a MIB module refers to the view from outside the
+agent, regarding this as a seamless whole and hiding the internal
+implementation. A "module group" is used where the internal structure is of
+more relevance, and recognises the fact that the functionality may be
+provided by a number of co-operating implementation modules.
+
+Anyway, enough waffle - on with the details: The three files needed are
+
+   * a MIB definition file;
+   * a C header file;
+   * a C implementation file.
+
+The next part looks at the MIB definition file, and how this impacts on the
+agent implementation.
+
+2. The MIB File
+===============
+
+The first file needed is the MIB file that defines the MIB module to be
+implemented.
+Strictly speaking, this is not absolutely necessary, as the agent itself
+does not make any direct use of the MIB definitions. However, it is
+advisable to start with this for three reasons:
+
+   * It provides an initial specification for what is to be implemented.
+     Code development is always easier if you know what you are meant to be
+     writing!
+   * If the new MIB file is read in with the other MIB files,
+     this lets the applications provided with the suite be used to test the
+     new agent, and report (hopefully meaningful) symbolic OIDs and values,
+     rather than the bare numeric forms.
+     (N.B: Remember to tell the application to load the new MIB. See the
+     relevant question in the FAQ)
+   * The tool mib2c uses this description to produce the two code files.
+     This is by far the easiest way to develop a new module.
+
+If the intention is to implement a 'standard' MIB module, or a
+vendor-specific one, then the construction of this file will have already
+been done for you. If the intention is to provide a totally new, private
+module, then you will need to write this yourself, in addition to the agent
+code files.
+A description of MIB file format and syntax is beyond the scope of this
+document, and most books on SNMP management should provide some information
+on this subject. One book which concentrates on this is
+
+     Understanding SNMP MIBS
+     (Perkins & McGinnis, Prentice Hall, ISBN 0-13-437708-7).
+
+This blatant plug is wholly unrelated to the fact that David Perkins is an
+active member of the development group, and is regarded as our resident
+"protocol guru and policeman". (In fact, this book concentrates on MIB
+files in rather more detail than is appropriate in more general SNMP works).
+Information on other books covering SNMP and Network Management more generally
+is available on the SimpleWeb site (among other places).
+See the FAQ for more details.
+
+Assigned OID numbers
+--------------------
+
+One word of advice - even if you are developing a totally private MIB
+module, you will still need to position this somewhere within the overall
+MIB tree. Please do NOT simply choose a location "at random". Any such is
+likely to have either been assigned to some other organisation, or may be so
+assigned some time in the future. However much you may regard your project
+as a totally internal affair, such projects have a tendency to exceed their
+expected scope, both in terms of lifetime and distribution (not to mention
+the potential OID clash if you subsequently need to use elements from the
+legitimate owner's tree).
+It is simple and cheap (i.e. free!) to obtain your own official segment of
+the MIB tree (see http://www.iana.org for an application form), and having
+done so, you then have complete global authority over it. If you have
+problems with this, it's worth contacting the development team (email:
+net-snmp-coders@lists.sourceforge.net) for advice. Please do think to the
+future, and be a good Net citizen by using a legitimately assigned OID as
+the root of your new MIB.
+
+MIB division
+------------
+
+The next point to consider, whether writing by hand or using mib2c,
+implementing an existing MIB, or writing a new one, is whether and how to
+divide up the MIB tree. This is a purely internal implementation decision,
+and will not be visible to management applications querying the agent. A
+sensible choice of partitioning will result in a simpler, clearer
+implementation, which should ease both the initial development and
+subsequent maintenance of the module.
+Unfortunately, this choice is one of the module-specific decisions, so must
+be made on a case-by-case basis. For a simple, self-contained module, it may
+well be reasonable to implement the module as a single block (examples
+include the SNMP statistics subtree RFC 1907 or the TCP subtree RFC 2011).
+More complex and diverse modules (such as the Host Resources MIB - RFC 1514)
+are more naturally considered as a number of individual sub-modules.
+Some guidelines to bear in mind when deciding on this division:
+
+   * A MIB sub-tree consisting purely of scalar objects with a common
+     OID prefix would normally be handled in a single implementation module;
+   * Separate scalar subtrees would normally be in different implementation
+     modules;
+   * A table can either be handled within the same implementation module
+     as related scalar objects in the same subtree, or in a separate
+     implementation module;
+   * Variables that rely on the same underlying data structure to retrieve
+     their values, should probably be in the same implementation module (and
+     conversely, (though less so) those that don't, shouldn't).
+
+As an initial rule of thumb, a good initial division is likely to be
+obtained by treating each table and each scalar sub-tree separately. This
+can be seen in the current agent, where most of the MIB-II modules (RFC
+1213) are implemented in separate files (see the files under mibgroup/mibII).
+Note that many of these combine scalar and table handling in the same file,
+though they are implemented using separate routines.
+  This is also the approach used by mib2c, which constructs a single pair of
+code files, but uses a separate routine for each table (and another for all
+the scalar variables).
+  Ultimately, the final consideration (concerning the underlying data) is
+the most important, and should guide the basic division. For example, the
+Host Resources Running Software and Running Software Performance modules,
+while separate in the MIB tree, use the same underlying kernel data and so
+are implemented together.
+
+MIB name
+--------
+
+The final requirement at this stage is to choose a name for each
+implementation module. This should be reasonably short, meaningful, unique
+and unlikely to clash with other (existing or future) modules. Mib2c uses
+the label of the root node of the MIB sub-tree as this name, and this is a
+reasonable choice in most cases.
+Recent changes to the agent code organisation have introduced the idea of
+module groups of related implementation modules. This is used, for example,
+to identify the constituent modules of a 'split' MIB (such as the Host
+Resources MIB), or those relating to a particular organisation (such as
+UCD).
+As with the division, this naming and grouping is a purely internal matter,
+and is really only visible when configuring and compiling the agent.
+
+So much for the MIB file. The next part considers the C header file.
+
+3. The C code header file
+=========================
+
+If the MIB file is the definition of the module for external network
+management applications (where applications includes network management
+personnel!), then the header file has traditionally served effectively the
+same purpose for the agent itself.
+Recent changes to the recommended code structure has resulted in the header
+file becoming increasingly simpler. It now simply contains definitions of the
+publically visible routines, and can be generated completely by mib2c.
+
+Function prototypes
+-------------------
+
+For those interested in the details of this file (for example, if coding a
+module by hand), then the details of these definitions are as follows. Every
+header file will have the following two function prototype definitions
+
+        extern void          init_example (void);
+        extern FindVarMethod var_example;
+
+If the module includes any tables, or other collections of variables that
+are implemented in separate routines, then this second definition will be
+repeated for each of these.
+In addition, if any of the variables can be SET (and it is intended to
+implement them as such), there will be a function prototype definitions for
+each of these, of the form:
+
+        extern WriteMethod write_varName;
+
+These prototypes are in fact typedef'ed in <agent/snmp_vars.h>.
+
+Module dependancies
+-------------------
+
+This header file is also used to inform the compilation system of any
+dependancies between this module and any others. There is one utility module
+which is required by almost every module, and this is included using the
+directive
+
+
+(which is produced automatically by mib2c). This same syntax can be used to
+trigger the inclusion of other related modules. An example of this can be
+seen in mibII/route_write.h which relies on the mibII/ip module, thus:
+
+        config_require( mibII/ip )
+
+One use of this directive is to define a module group, by supplying a header
+file consisting exclusively of such config_require directives.  It can then
+be included or excluded from the agent very simply. Examples of this can be
+seen in mibgroup/mibII.h or mibgroup/host.h, which list the consituent
+sub-modules of the MIB-II and Host Resources MIBs respectively.
+
+MIB file information
+--------------------
+
+Most of the information in this file is (understandably) aimed at the network
+management agent itself.  However, there is one common header file directive
+that is actually intended to affect the utility commands that are included
+within the full distribution:
+
+	config_add_mib( HOST-RESOURCES-MIB )
+
+  This is used to add the MIB file being implemented to the default list of
+MIBs loaded by such commands.  This means that querying the agent will return
+informative names and values, rather than the raw numeric forms that SNMP
+actually works with.  Of course, it is always possible for the utilities
+to specify that this MIB should be loaded anyway.  But specifying this file
+within the module header file is a useful hint that a particular MIB should
+be loaded, without needing to ask for it explicitly.
+  Note that this will only affect the binaries compiled as part of the same
+configuration run.  It will have no effect on pre-installed binaries, or
+those compiled following a different configuration specification.
+
+Magic Numbers
+-------------
+
+The other common element within the header file defines a set of "magic
+numbers" - one for each object within the implementation module. In fact,
+this can equally well appear within the main code file, as part of the
+variable structure (which will be described in the next part).
+  This is the technique used by mib2c, but most handcrafted modules have
+tended to define these as part of the header file, probably for clarity.
+
+  The only necessity is that the names and values are distinct (or more
+precisely, the values are distinct within a single variable handling routine).
+In practise, they tend to be defined using integers incrementing from 1,
+or as the same as the final sub-identifier of the corresponding MIB object
+(or indeed both, as these are frequently themselves successive integers).
+  This is not mandatory, and a counter-example can be seen in the
+example module, where two of the object form a sub-tree, and the corresponding
+magic numbers are based on the final *two* sub-identifiers (to ensure that
+the values are unique).  But this construction is definitely unusual, and
+the majority of modules simply use successive integers.
+
+Header file protection
+----------------------
+
+Normally, the only other contents of the header file will be the
+#ifndef/#define/#endif statements surrounding the whole file. This is used
+to ensure that the header file is only included once by any source code file
+(or more accurately, that there is no effect if it is inadvertantly included
+a second time).
+Again, as with the rest of the header file, this is generated automatically
+by mib2c.
+
+Having finished all the preparatory work (or let mib2c deal with it), the
+next part starts to look at the code file that actually implements the
+module.
+
+4. Core structure of the implementation code
+============================================
+
+The core work of implementing the module is done in the C code file. As
+indicated earlier, much of the detail of this will be dependent on the
+particular module being implemented, and this can only be described by the
+individual programmer concerned.
+However, there is a fairly clearly defined framework that the implementation
+will need to follow, though this varies slightly depending on the style of
+the module being implemented (in particular whether it forms a table or a
+series of individual values). The differences will be covered in the
+following pages, but we first need to consider the overall shape of the
+framework, and the elements that are common to all styles. These are
+essentially the compulsory routines, the common header definitions, and
+assorted initialisation code.
+As with the header file, most of this will be generated automatically by
+mib2c.
+
+Standard includes
+-----------------
+
+Certain header files are either compulsory, or required so frequently that
+they should be included as a matter of course. These are as follows:
+
+  #include <config.h>                   // local SNMP configuration details
+  #include "mib_module_config.h"        // list of which modules are supported
+  #if HAVE_STDLIB_H
+  #include <stdlib.h>
+  #endif
+  #if HAVE_STRING_H
+  #include <string.h>
+  #else
+  #include <strings.h>
+  #endif
+
+  #include <sys/types.h>
+
+All of these will usually be the first files to be included.
+
+  #include "mibincl.h"                  // Standard set of SNMP includes
+  #include "util_funcs.h"               // utility function declarations
+  #include "read_config.h"              // if the module uses run-time
+                                        //      configuration controls
+  #include "auto_nlist.h"               // structures for a BSD-based
+                                        //      kernel using nlist
+  #include "system.h"
+
+  #include "name.h"                     // the module-specific header
+
+These conventionally come at the end of the list of includes. In between
+will come all the standard system-provided header files required for the
+library functions used in the file.
+
+Module definition
+-----------------
+
+Much of the code defining the contents of the MIB has traditionally been
+held in the header file. However, much of this has slowly migrated to the
+code file, and this is now the recommended location for it (as typified by
+the output of mib2c).
+  The main element of this is a variable structure specifying the details of 
+the objects implemented.  This takes the form of an unconstrained array of
+type struct variableN (where N is the length of the longest suffix in the
+table). Thus
+
+                struct variable2 example_variables[] = {
+			<individual entries go here>
+                };
+
+Each entry corresponds to one object in the MIB tree (or one column in the
+case of table entries), and these should be listed in increasing OID order.
+A single entry consists of six fields:
+
+   * a magic number (the #defined integer constant described above)
+   * a type indicator (from the values listed in <snmplib/snmp_impl.h>)
+   * an access indicator (essentially RWRITE or RONLY)
+   * the name of the routine used to handle this entry
+   * the length of the OID suffix used, and
+   * an array of integers specifying this suffix (more on this in a moment)
+
+Thus a typical variable entry would look like:
+
+        { EXAMPLESTRING, ASN_OCTET_STR, RONLY, var_example, 1, {1}}
+
+If the magic numbers have not been defined in the header file, then they
+should be defined here, usually comming immediately before the corresponding
+variable entry.  This is the technique used by mib2c.
+
+Note that in practise, only certain sizes of the structure variableN
+are defined (listed in <agent/var_struct.h>), being sufficient to meet the
+common requirements. If your particular module needs a non-supported value,
+the easiest thing is simply to use the next largest value that is supported.
+
+The module also needs to declare the location within the MIB tree where
+it should be registered. This is done using a declaration of the form
+
+        oid example_variables_oid[] = { 1,3,6,1,4,1,2021,254 }
+
+where the contents of the array give the object identifier of the root of
+the module.
+
+Module initialisation
+---------------------
+
+Many modules require some form of initialisation before they can start
+providing the necessary information. This is done by providing a routine
+called init_{name} (where {name} is the name of the module).
+This routine is theoretically optional, but in practise is required to
+register this module with the main agent at the very least. This specifies
+the list of variables being implemented (from the variableN structure)
+and declare where these fit into the overall MIB tree.
+
+This is done by using the REGISTER_MIB macro, as follows:
+
+        REGISTER_MIB( "example",  example_variables, variable2,
+                        example_variables_oid );
+
+where "example" is used for identification purposed (and is usually the name
+being used for the module), example_variables is the structure defining the
+variables being implemented, variable2 is the type used for this structure,
+and example_variables_oid is the location of the root.
+
+In fact, this macro is simply a wrapper round the routine register_mib(),
+but the details of this can safely be ignored, unless more control over the
+registration is required.
+
+One common requirement, particularly on older operating systems or for the
+more obscure areas of the system, is to be able to read data directly from
+kernel memory. The preparation for this is typically done here by one or
+more statements of the form
+
+        #ifdef {NAME}_SYMBOL
+        auto_nlist( {NAME}_SYMBOL, 0, 0);
+        #endif
+
+where {NAME}_SYMBOL is defined as part of the system-specific configuration,
+to be the name of the appropriate kernel variable or data structure. (The
+two 0 values are because the kernel information is simply being primed at
+this point - this call will be reused later when the actual values are
+required). Note that this is probably the first thing described so far which
+isn't provided by mib2c!
+
+Other possibilities for initialisation may include registering config file
+directive handlers (which are documented in the read_config(5) man page), and
+registering the MIB module (either in whole or in part) in the sysOR table.
+The first of these is covered in the example module, and the second in many
+of the other modules within the main UCD distribution.
+
+Variable handling
+-----------------
+
+The other obligatory routine is that which actually handles a request for a
+particular variable instance. This is the routine that appeared in the
+variableN structure, so while the name is not fixed, it should be the same
+as was used there.
+This routine has six parameters, which will be described in turn.
+
+Four of these parameters are used for passing in information about the
+request, these being:
+
+        struct variable *vp;
+                // The entry in the variableN array from the
+                //   header file, for the object under consideration.
+                // Note that the name field of this structure has been
+                //   completed into a fully qualified OID, by prepending
+                //   the prefix common to the whole array.
+        oid *name;      // The OID from the request
+        int *length;    // The length of this OID
+        int exact;      // A flag to indicate whether this is an exact
+                        // request (GET/SET) or an 'inexact' one (GETNEXT)
+
+Four of the parameters are used to return information about the answer.
+The function also returns a pointer to the actual data for the variable
+requested (or NULL if this data is not available for any reason).
+The other result parameters are:
+
+        oid *name;      // The OID being returned
+        int *length;    // The length of this OID
+        int *var_len;   // The length of the answer being returned
+        WriteMethod **write_method;
+                        // A pointer to the SET function for this variable
+
+Note that two of the parameters (name and length) serve a dual purpose,
+being used for both input and output.
+
+The first thing that this routine needs to do is to validate the request, to
+ensure that it does indeed lie in the range implemented by this particular
+module. This is done in slightly different ways, depending on the style of
+the module, so this will be discussed in more detail later.
+  At the same time, it is common to retrieve some of the information needed
+for answering the query.
+
+Then the routine uses the Magic Number field from the vp parameter to determine
+which of the possible variables being implemented is being requested. This is
+done using a switch statement, which should have as many cases as there are
+entries in the variableN array (or more precisely, as many as specify this
+routine as their handler), plus an additional default case to handle an
+erroneous call.
+Each branch of the switch statement needs to ensure that the return
+parameters are filled in correctly, set up a (static) return variable with
+the correct data, and then return a pointer to this value. These can be done
+separately for each branch, or once at the start, being overridden in
+particular branches if necessary.
+
+In fact, the default validation routines make the assumption that the
+variable is both read-only, and of integer type (which includes the COUNTER
+and GAUGE types among others), and set the return paramaters write_method and
+var_len appropriately. These settings can then be corrected for those cases
+when either or both of these assumptions are wrong. Examples of this can be
+seen in the example module.
+EXAMPLEINTEGER is writeable, so this branch sets the write_method parameter,
+and EXAMPLEOBJECTID is not an integer, so this branch sets the var_len
+parameter.  In the case of EXAMPLESTRING, both assumptions are wrong, so this
+branch needs to set both these parameters explicitly.
+
+Note that because the routine returns a pointer to a static result, a
+suitable variable must be declared somewhere for this. Two global variables
+are provided for this purpose - long_return (for integer results) and
+return_buf (for other types). This latter is a generic array (of type
+u_char) that can contain up to 256 bytes of data. Alternatively, static
+variables can be declared, either within the code file, or local to this
+particular variable routine. This last is the approach adopted by mib2c,
+which defines four such local variables, (long_ret, string, objid and c64).
+
+Mib2c requirements
+------------------
+
+Most of the code described here is generated by mib2c. The main exceptions
+(which therefore need to be provided by the programmer) are
+
+   * Any initialisation, other than the basic registration
+     (including kernel data initialisation, config file handling, or sysOR
+     registration).
+   * Retrieving the necessary data, and setting the appropriate return
+     value correctly.
+   * The var_len (and possibly write_method) return parameters for variable
+     types that are not recognised by mib2c
+   * The contents of any write routines (see later).
+
+Everything else should be useable as generated.
+
+This concludes the preliminary walk-through of the general structure of the
+C implementation. To fill in the details, we will need to consider the
+various styles of module separately. The next part will look at scalar (i.e.
+non-table based) modules.
+
+5. Non-table-based modules
+==========================
+
+Having looked at the general structure of a module implementation, it's now
+time to look at this in more detail. We'll start with the simplest style of
+module - a collection of independent variables. This could easily be
+implemented as a series of completely separate modules - the main reason for
+combining them is to avoid the proliferation of multiple versions of very
+similar code.
+
+Recall that the variable handling routine needs to cover two distinct
+purposes - validation of the request, and provision of the answer. In this
+style of module, these are handled separately. Once again, mib2c does much
+of the donkey work, generating the whole of the request validation code (so
+the description of this section can be skipped if desired), and even
+providing a skeleton for returning the data. This latter still requires some
+input from the programmer, to actually return the correct results (rather
+than dummy values).
+
+Request Validation
+------------------
+
+This is done using a standard utility function header_generic. The
+parameters for this are exactly the same as for the main routine, and are
+simply passed through directly. It returns an integer result, as a flag to
+indicate whether the validation succeeded or not.
+If the validation fails, then the main routine should return immediately,
+leaving the parameters untouched, and indicate the failure by returning a
+NULL value. Thus the initial code fragment of a scalar-variable style
+implementation will typically look like:
+
+    u_char  *
+    var_system(vp, name, length, exact, var_len, write_method)
+    {
+        if (header_generic(vp, name, length, exact, var_len, write_method)
+                                                == MATCH_FAILED )
+            return NULL;
+
+        [ etc, etc, etc ]
+    }
+
+Although the utility function can be used as a "black box", it's worth
+looking more closely at exactly what it does (since the table-handling
+modules will need to do something fairly similar). It has two (or possibly
+three) separate functions:
+
+   * checking that the request is valid,
+   * setting up the OID for the result,
+   * and (optionally) setting up default values for the other return
+     parameters.
+
+In order to actually validate the request, the header routine first needs to
+construct the OID under consideration, in order to compare it with that
+originally asked for. The driving code has already combined the OID prefix
+(constant throughout the module) with the entry-specific suffix, before
+calling the main variable handler. This is available via the name field of
+the parameter vp. For a scalar variable, completing the OID is therefore
+simply a matter of appending the instance identifier 0 to this. The full OID
+is built up in a local oid array newname defined for this purpose.
+This gives the following code fragment:
+
+    int
+    header_generic(vp, name, length, exact, var_len, write_method)
+    {
+        oid newname[MAX_OID_LEN];
+
+        memcpy((char *)newname, (char *)vp->name,
+                        (int)vp->namelen * sizeof(oid));
+        newname[ vp->namelen ] = 0;
+
+                :
+    }
+
+Having formed the OID, this can then be compared against the variable
+specified in the original request, which is available as the name parameter.
+This comparison is done using the snmp_oid_compare function, which takes the
+two OIDs (together with their respective lengths), and returns -1, 0 or 1
+depending on whether the first OID precedes, matches or follows the second.
+
+In the case of an 'exact' match (i.e. a GET/SET/etc), then the request is
+only valid if the two OIDs are identical (snmp_oid_compare returns 0). In
+the case of a GETNEXT (or GETBULK) request, it's valid if the OID being
+considered comes after that of the original request (snmp_oid_compare
+returns -1).
+
+This gives the code fragment
+
+        result = snmp_oid_compare(name, *length, newname, (int)vp->namelen + 1);
+                        // +1 because of the extra instance sub-identifier
+        if ((exact && (result != 0))            // GET match fails
+                || (!exact && (result >= 0)))   // GETNEXT match fails
+            return(MATCH_FAILED);
+
+Note that in this case, we're only interested in the single variable
+indicated by the vp parameter. The fact that this module may well implement
+other variables as well is ignored. The 'lexically next' requirement of the
+GETNEXT request is handled by working through the variable entries in order
+until one matches. And yes, this is not the most efficient implementation
+possible!
+Note that in releases prior to 3.6, the snmp_oid_compare function was called
+simply compare.
+
+Finally, having determined that the request is valid, this routine must
+update the name and length parameters to return the OID being processed. It
+also sets default values for the other two return parameters.
+
+        memcpy( (char *)name,(char *)newname,
+                ((int)vp->namelen + 1) * sizeof(oid));
+        *length = vp->namelen + 1;
+        *write_method = 0;              // Non-writeable
+        *var_len = sizeof(long);        // default to integer results
+        return(MATCH_SUCCEEDED);
+
+These three code fragments combine to form the full header_generic code
+which can be seen in the file util_funcs.c
+
+Note: This validation used to be done using a separate function for each
+module (conventionally called header_{name}), and many modules may still be
+coded in this style. The code for these are to all intents and purposes
+identical to the header_generic routine described above.
+
+Data Retrieval
+--------------
+
+The other main job of the request handling routine is to retrieve any
+necessary data, and return the appropriate answer to the original request.
+This must be done even if mib2c is being used to generate the framework of
+the implementation. As has been indicated earlier, the different cases are
+handled using a switch statement, with the Magic Number field of the vp
+parameter being used to distinguish between them.
+The data necessary for answering the request can be retrieved for each
+variable individually in the relevant case statement (as is the case with
+the system group), or using a common block of data before processing the
+switch (as is done for the ICMP group, among others).
+
+With many of the modules implemented so far, this data is read from a kernel
+structure. This can be done using the auto_nlist routine already mentioned,
+providing a variable in which to store the results and an indication of its
+size (see the !HAVE_SYS_TCPIPSTATS_H case of the ICMP group for an example).
+Alternatively, there may be ioctl calls on suitable devices, specific system
+calls, or special files that can be read to provide the necessary
+information.
+
+If the available data provides the requested value immediately, then the
+individual branch becomes a simple assignment to the appropriate static
+return variable - either one of the global static variables (e.g. long_return)
+or the local equivalents (such as generated by mib2c).
+Otherwise, the requested value may need to be calculated by combining two or
+more items of data (e.g. IPINHDRERRORS in mibII/ip.c) or by applying a
+mapping or other calculation involving available information (e.g.
+IPFORWARDING from the same group).
+
+In each of these cases, the routine should return a pointer to the result
+value, casting this to the pseudo-generic (u_char *)
+
+So much for the scalar case. The next part looks at how to handle simple
+tables.
+
+6. Simple tables
+================
+
+Having considered the simplest style of module implementation, we now turn
+our attention to the next style - a simple table. The tabular nature of
+these is immediately apparent from the MIB definition file, but the
+qualifier "simple" deserves a word of explanation.
+A simple table, in this context, has four characteristics:
+
+  1. It is indexed by a single integer value;
+  2. Such indices run from 1 to a determinable maximum;
+  3. All indices within this range are valid;
+  4. The data for a particular index can be retrieved directly
+     (e.g. by indexing into an underlying data structure).
+
+If any of the conditions are not met, then the table is not a pure simple
+one, and the techniques described here are not applicable. The next section
+of this guide will cover the more general case. (In fact, it may be possible
+to use the bulk of the techniques covered here, though special handling will
+be needed to cope with the invalid assumption or assumptions). Note that
+mib2c assumes that all tables are simple.
+
+As with the scalar case, the variable routine needs to provide two basic
+functions - request validation and data retrieval.
+
+Validation
+----------
+
+This is provided by the shared utility routine header_simple_table. As with
+the scalar header routine, this takes the same parameters as the main
+variable routine, with one addition - the maximum valid index. Mib2c
+generates a dummy token for this, which must be replaced by the appropriate
+value.
+As with the header routine, it also returns an indication of whether the
+request was valid, as well as setting up the return parameters with the
+matching OID information, and defaults for var_len and write_method.
+Note that in releases prior to 3.6, this job was performed by the routine
+checkmib. However, the return values of this were the reverse of those for
+generic_header and header_simple_table. A version of checkmib is still
+available for compatability purposes, but you are encouraged to use
+header_simple_table instead.
+
+The basic code fragment (see ucd-snmp/disk.c) is therefore of the form:
+
+        unsigned char *
+        var_extensible_disk(vp, name, length, exact, var_len, write_method)
+        {
+            if (header_simple_table(vp,name,length,exact,var_len,write_method,numdisks)
+                                        == MATCH_FAILED)
+                return(NULL);
+
+            [ etc, etc, etc ]
+
+        }
+
+Note that the maximum index value parameter does not have to be a
+permanently fixed constant. It specifies the maximum valid index at the time
+the request is processed, and a subsequent request may have a different
+maximum.
+An example of this can be seen in mibII/sysORTable.c where the table is held
+purely internally to the agent code, including its size (and hence the
+maximum valid index). This maximum could also be retrieved via a system
+call, or via a kernel data variable.
+
+Data Retrieval
+--------------
+
+As with the scalar case, the other required function is to retrieve the data
+requested. However, given the definition of a simple table this is simply a
+matter of using the single, integer index sub-identifier to index into an
+existing data structure. This index will always be the last index of the OID
+returned by header_simple_table, so can be obtained as name[*length-1].
+A good example of this type of table can be seen in ucd-snmp/disk.c
+
+With some modules, this underlying table may be relatively large, or only
+accessible via a slow or cumbersome interface. The implementation described
+so far may prove unacceptably slow, particularly when walking a MIB tree
+requires the table to be loaded afresh for each variable requested.
+
+In these circumstances, a useful technique is to cache the table when it is
+first read in, and use that cache for subsequent requests. This can be done
+by having a separate routine to read in the table. This uses two static
+variables, one a structure or array for the data itself, and the other an
+additional timestamp to indicate when the table was last loaded. When a call
+is made to this routine to "read" the table, it can first check whether the
+cached table is "new enough". If so, it can return immediately, and the
+system will use the cached data.
+Only if the cached version is sufficiently old that it's probably out of
+date, is it necessary to retrieve the current data, updating the cached
+version and the timestamp value.
+This is particularly useful if the data itself is relatively static, such as
+a list of mounted filesystems. There is an example of this technique in the
+Host Resources implementation.
+
+As with the scalar case, mib2c simply provides placeholder dummy return
+values. It's up to the programmer to fill in the details.
+
+The next part concludes the examination of the detailed implementation by
+looking at more general tables.
+
+7. General Tables
+=================
+
+Some table structures are not suitable for the simple table approach, due to
+the failure of one or more of the assumptions listed earlier. Perhaps they
+are indexed by something other than a single integer (such as a 4-octet IP
+address), or the maximum index is not easily determinable (such as the
+interfaces table), or not all indices are valid (running software), or the
+necessary data is not directly accessible (interfaces again).
+In such circumstances, a more general approach is needed. In contrast with
+the two styles already covered, this style of module will commonly combine
+the two functions of request validation and data retrieval. Note that mib2c
+will assume the simple table case, and this will need to be corrected.
+
+General table algorithm
+-----------------------
+
+The basic algorithm is as follows:
+
+     Perform any necessary initialization, then walk through the
+     underlying instances, retrieving the data for each one, until the
+     desired instance is found. If no valid entry is found, return
+     failure.
+
+For an exact match (GET and similar), identifying the desired instance is
+trivial - construct the OID (from the 'vp' variable parameter and the index
+value or values), and see whether it matches the requested OID.
+For GETNEXT, the situation is not quite so simple. Depending on the
+underlying representation of the data, the entries may be returned in the
+same order as they should appear in the table (i.e. lexically increasing by
+index). However, this is not guaranteed, and the natural way of retrieving
+the data may be in some "random" order. In this case, then the whole table
+needs to be traversed for each request. in order to determine the
+appropriate successor.
+This random order is the worst case, and dictates the structure of the code
+used in most currently implemented tables. The ordered case can be regarded
+as a simplification of this more general one.
+
+The algorithm outlined above can now be expanded into the following
+pseudo-code:
+
+        Init_{Name}_Entry();    // Perform any necessary initialisation
+
+        while (( index = Get_Next_{Name}_Entry() ) != EndMarker ) {
+                        // This steps through the underlying table,
+                        //   returning the current index,
+                        //   or some suitable end-marker when all
+                        //   the entries have been examined.
+                        // Note that this routine should also return the
+                        //   data for this entry, either via a parameter
+                        //   or using some external location.
+
+            construct OID from vp->name and index
+            compare new OID and request
+            if valid {
+                save current data
+                if finished     // exact match, or ordered table
+                    break;      //  so don't look at any more entries
+
+            }
+
+                //  Otherwise, we need to loop round, and examine
+                //    the next entry in the table.  Either because
+                //    the entry wasn't valid for this request,
+                //    or the entry was a possible "next" candidate,
+                //    but we don't know that there isn't there's a
+                //    better one later in the table.
+        }
+
+        if no saved data        // Nothing matched
+           return failure
+
+                // Otherwise, go on to the switch handling
+                //  we've already covered in the earlier styles.
+
+This is now very close to the actual code used in many current
+implementations (such as the the routine header_ifEntry in
+mibII/interfaces.c). Notice that the pseudo-code fragment if valid expands
+in practise to
+
+        if ((exact && (result == 0))  ||
+                        // GET request, and identical OIDs
+            (!exact && (result < 0)) )
+                        // GETNEXT, and candidate OID is later
+                        //  than requested OID.
+
+This is a very common expression, that can be seen in most of the table
+implementations.
+
+Notice also that the interfaces table returns immediately the first valid
+entry is found, even for GETNEXT requests. This is because entries are
+returned in lexical order, so the first succeeding entry will be the one
+that's required.
+(As an aside, this also means that the underlying data can be saved
+implicitly within the 'next entry' routine - not very clean, but it saves
+some unnecessary copying).
+
+The more general case can be seen in the TCP and UDP tables (see mibII/tcp.c
+and mibII/udp.c). Here, the if valid fragment expands to:
+
+        if ( exact && (result == 0)) {
+                // save results
+                break;
+        }
+        else if (!exact && (result < 0)) {
+            if ( .... ) {       // no saved OID, or this OID
+                                //  precedes the saved OID
+                // save this OID into 'lowest'
+                // save the results into Lowinpcb
+                // don't break, since we still need to look
+                //      at the rest of the table
+            }
+        }
+
+The GET match handling is just as we've already seen - is this the requested
+OID or not. If so, save the results and move on to the switch statement.
+  The GETNEXT case is more complicated. As well as considering whether this
+is a possible match (using the same test we've already seen), we also have to
+check whether this is a better match than anything we've already seen. This
+is done by comparing the current candidate (newname) with the best match found
+so far (lowest).
+  Only if this extra comparison shows that the new OID is earlier than the
+saved one, do we need to save both the new OID, and any associated data
+(such as the inpcb block, and state flag). But having found one better
+match, we don't know that there isn't an even better one later on. So we
+can't break out of the enclosing loop - we need to keep going and examine
+all the remaining entries of the table.
+
+These two cases (the TCP and UDP tables) also show a more general style of
+indexing. Rather than simply appending a single index value to the OID
+prefix, these routines have to add the local four-octet IP address plus port
+(and the same for the remote end in the case of the TCP table). This is the
+purpose of the op and cp section of code that precedes the comparison.
+
+These two are probably among the most complex cases you are likely to
+encounter. If you can follow the code here, then you've probably cracked the
+problem of understanding how the agent works.
+
+Finally, the next part discusses how to implement a writable (or SETable)
+object in a MIB module.
+
+8. How to implement a SETable object
+====================================
+
+Finally, the only remaining area to cover is that of setting data - the
+handling of SNMPSET. Particular care should be taken here for two reasons.
+
+Firstly, any errors in the earlier sections can have limited effect. The
+worst that is likely to happen is that the agent will either return invalid
+information, or possibly crash. Either way, this is unlikely to affect the
+operation of the workstation as a whole. If there are problems in the
+writing routine, the results could be catastrophic (particularly if writing
+data directly into kernel memory).
+
+Secondly, this is the least well understood area of the agent, at least by
+the author. There are relatively few variables that are defined as READ-WRITE
+in the relevant MIBs, and even fewer that have actually been implemented as
+such. I'm therefore describing this from a combination of my understanding
+of how SETs ought to work, personal experience of very simple SET handling
+and what's actually been done by others (which do not necessarily coincide).
+
+There are also subtle differences between the setting of simple scalar
+variables (or individual entries within a table), and the creation of a new
+row within a table. This will therefore be considered separately.
+
+With these caveats, and a healthy dose of caution, let us proceed. Note that
+the UCD-SNMP development team can accept no responsibility for any damage or
+loss resulting from either following or ignoring the information presented
+here. You coded it - you fix it!
+
+Write routine
+-------------
+
+The heart of SET handling is the write_method parameter from the variable
+handling routine. This is a pointer to the relevant routine for setting the
+variable in question. Mib2c will generate one such routine for each setable
+variable. This routine should be declared using the template
+
+        int
+        write_variable(
+           int      action,
+           u_char   *var_val,
+           u_char   var_val_type,
+           int      var_val_len,
+           u_char   *statP,
+           oid      *name,
+           int      name_len );
+
+Most of these parameters are fairly self explanatory:
+The last two hold the OID to be set, just as was passed to the main variable
+routine.
+
+The second, third and fourth parameters provide information about the new
+desired value, both the type, value and length. This is very similar to the
+way that results are returned from the main variable routine.
+
+The return value of the routine is simply an indication of whether the
+current stage of the SET was successful or not. We'll come back to this in a
+minute. Note that it is the responsibility of this routine to check that the
+OID and value provided are appropriate for the variable being implemented.
+This includes (but is not limited to) checking:
+
+   * the OID is recognised as one this routine can handle
+     (this should be true if the routine only handles the one variable, and
+     there are no errors in the main variable routine or driving code, but
+     it does no harm to check).
+   * the value requested is the correct type expected for this OID
+   * the value requested is appropriate for this OID
+     (within particular ranges, suitable length, etc, etc)
+
+There are two parameters remaining to be considered.
+
+The fifth parameter, statP, is the value that would be returned from a GET
+request on this particular variable. It could be used to check that the
+requested new value is consistent with the current state, but its main use
+is to denote that a new table row is being created.
+In most cases (particularly when dealing with scalar values or single elements
+of tables), you can normally simply ignore this parameter.
+
+Actions
+-------
+
+The final parameter to consider is the first one - action. To understand
+this, it's necessary to know a bit about how SETs are implemented.
+The design of SNMP calls for all variables in a SET request to be done "as
+if simultaneously" - i.e. they should all succeed or all fail. However, in
+practise, the variables are handled in succession. Thus, if one fails, it
+must be possible to "undo" any changes made to the other variables in the
+request.
+This is a well understood requirement in the database world, and is usually
+implemented using a "multi-stage commit". This is certainly the mechanism
+expected within the SNMP community (and has been made explicit in the work
+of the AgentX extensibility group). In other words, the routine to handle
+setting a variable will be called more than once, and the routine must be
+able to perform the appropriate actions depending on how far through the
+process we currently are. This is determined by the value of the action
+parameter.
+
+This is implemented using three basic phases:
+
+RESERVE is used to check the syntax of all the variables provided, that the
+values being set are sensible and consistent, and to allocate any resources
+required for performing the SET. After this stage, the expectation is that
+the set ought to succeed, though this is not guaranteed.
+(In fact, with the UCD agent, this is done in two passes - RESERVE1, and
+RESERVE2, to allow for dependancies between variables).
+
+If any of these calls fail (in either pass) the write routines are called
+again with the FREE action, to release any resources that have been
+allocated. The agent will then return a failure response to the requesting
+application.
+
+Assuming that the RESERVE phase was successful, the next stage is indicated
+by the action value ACTION. This is used to actually implement the set
+operation. However, this must either be done into temporary (persistent)
+storage, or the previous value stored similarly, in case any of the
+subsequent ACTION calls fail.
+ This can be seen in the example module, where both write routines have
+static 'old' variables, to hold the previous value of the relevant object.
+
+If the ACTION phase does fail (for example due to an apparently valid, but
+unacceptable value, or an unforeseen problem), then the list of write
+routines are called again, with the UNDO action. This requires the routine
+to reset the value that was changed to its previous value (assuming it was
+actually changed), and then to release any resources that had been
+allocated. As with the FREE phase, the agent will then return an indication
+of the error to the requesting application.
+
+Only once the ACTION phase has completed successfully, can the final COMMIT
+phase be run. This is used to complete any writes that were done into
+temporary storage, and then release any allocated resources. Note that all
+the code in this phase should be "safe" code that cannot possibly fail (cue
+hysterical laughter). The whole intent of the ACTION/COMMIT division is that
+all of the fallible code should be done in the ACTION phase, so that it can
+be backed out if necessary.
+
+Table row creation
+------------------
+
+What about creating new rows in a table, I hear you ask. Good Question.
+This case can often be detected by the fact that a GET request would have
+failed, and hence the fifth parameter, statP, will be null.  This contrasts
+with changing the values of an element of an existing row, when the statP
+parameter would hold the previous value.
+
+The details of precisely how to create a new row will clearly depend on the
+underlying format of the table.  However, one implementation strategy would
+be as follows:
+
+  *  The first column object to be SET would return a null value from the
+	var_name routine.  This null statP parameter would be the signal
+	to create a new temporary instance of the underlying data structure,
+	filled with dummy values.
+  *  Subsequent column objects would return pointers to the appropriate
+	field of this new data structure from the var_name routine,
+	which would then be filled in by the write routine.
+  *  Once all the necessary fields had been SET, the completed temporary
+	instance could be moved into the "standard" structure (or copied,
+	or otherwise used to set things up appropriately).
+
+However, this is purely a theoretical strategy, and has not been tried
+by the author.  No guarantees are given as to whether this would actually
+work.  There are also questions regarding how to handle incomplete
+or overlapping SET requests.
+Anyone who has experience of doing this, please get in touch!
+
+  ------------------------------------------------------------------------
+And that's it. Congratulations for getting this far. If you understand
+everything that's been said, then you now know as much as the rest of us
+about the inner workings of the UCD-SNMP agent. (Well, very nearly).
+All that remains is to try putting this into practise. Good luck!
+
+And if you've found this helpful, gifts of money, chocolate, alcohol, and
+above all feedback, would be most appreciated :-)
+
+  ------------------------------------------------------------------------
+Copyright 1999, 2000 - D.T.Shield.
+Not to be distributed without the explicit permission of the author.
diff -Naur tomato/release/src/router/snmp/apps/.cvsignore tomato121/release/src/router/snmp/apps/.cvsignore
--- tomato/release/src/router/snmp/apps/.cvsignore	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/apps/.cvsignore	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,26 @@
+.pure
+.purify
+*.lo
+.gdb.auto.init
+.gdbinit
+.libs
+Makefile
+encode_keychange
+snmpbulkget
+snmpbulkwalk
+snmpdelta
+snmpdf
+snmpget
+snmpgetnext
+snmpinform
+snmppass
+snmpset
+snmpstatus
+snmptable
+snmptest
+snmptranslate
+snmptrap
+snmptrapd
+snmpusm
+snmpvacm
+snmpwalk
diff -Naur tomato/release/src/router/snmp/apps/encode_keychange.c tomato121/release/src/router/snmp/apps/encode_keychange.c
--- tomato/release/src/router/snmp/apps/encode_keychange.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/apps/encode_keychange.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,792 @@
+/*
+ * encode_keychange.c
+ *
+ * Collect information to build a KeyChange encoding, per the textual
+ * convention given in RFC 2274, Section 5.  Compute the value and
+ * dump to stdout as a string of hex nibbles.
+ *
+ *
+ * Passphrase material may come from many sources.  The following are
+ * checked in order (see get_user_passphrases()):
+ *      - Prompt always if -f is given.
+ *      - Commandline arguments.
+ *      - PASSPHRASE_FILE.
+ *      - Prompts on stdout.   Use -P to turn off prompt tags.
+ *
+ *
+ * FIX  Better name?
+ * FIX  Change encode_keychange() to take random bits?
+ * FIX  QUITFUN not quite appropriate here...
+ * FIX  This is slow...
+ */
+
+#include <net-snmp/net-snmp-config.h>
+
+#include <stdio.h>
+#include <ctype.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#if HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#if HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+#ifdef HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+
+#if HAVE_WINSOCK_H
+#include <winsock.h>
+#endif
+
+#include <net-snmp/net-snmp-includes.h>
+
+#include <stdlib.h>
+
+/*
+ * Globals, &c...
+ */
+char           *local_progname;
+char           *local_passphrase_filename;
+
+#define NL	"\n"
+
+#define USAGE	"Usage: %s [-fhPvV] -t (md5|sha1) [-O \"<old_passphrase>\"][-N \"<new_passphrase>\"][-E [0x]<engineID>]"
+
+#define OPTIONLIST	"E:fhN:O:Pt:vVD"
+
+#define PASSPHRASE_DIR		".snmp"
+        /*
+         * Rooted at $HOME.
+         */
+#define PASSPHRASE_FILE		"passphrase.ek"
+        /*
+         * Format: two lines containing old and new passphrases, nothing more.
+         *      
+         * XXX  Add creature comforts like: comments and 
+         *      tokens identifying passphrases, separate directory check,
+         *      check in current directory (?), traverse a path of
+         *      directories (?)...
+         * FIX  Better name?
+         */
+
+
+int             forcepassphrase = 0,    /* Always prompt for passphrases. */
+                promptindicator = 1,    /* Output an indicator that input
+                                         *   is requested.                */
+                visible = 0,    /* Echo passphrases to terminal.  */
+                verbose = 0;    /* Output progress to stderr.     */
+size_t          engineid_len = 0;
+
+u_char         *engineid = NULL;        /* Both input & final binary form. */
+char           *newpass = NULL, *oldpass = NULL;
+
+char           *transform_type_input = NULL;
+
+const oid      *transform_type = NULL;  /* Type of HMAC hash to use.      */
+
+
+
+/*
+ * Prototypes.
+ */
+void            usage_to_file(FILE * ofp);
+void            usage_synopsis(FILE * ofp);
+int             get_user_passphrases(void);
+int             snmp_ttyecho(const int fd, const int echo);
+char           *snmp_getpassphrase(const char *prompt, int fvisible);
+
+#ifdef WIN32
+#define HAVE_GETPASS 1
+char           *getpass(const char *prompt);
+int             isatty(int);
+int             _cputs(const char *);
+int             _getch(void);
+#endif
+
+/*******************************************************************-o-******
+ */
+int
+main(int argc, char **argv)
+{
+    int             rval = SNMPERR_SUCCESS;
+    size_t          oldKu_len = SNMP_MAXBUF_SMALL,
+        newKu_len = SNMP_MAXBUF_SMALL,
+        oldkul_len = SNMP_MAXBUF_SMALL,
+        newkul_len = SNMP_MAXBUF_SMALL, keychange_len = SNMP_MAXBUF_SMALL;
+
+    char           *s = NULL;
+    u_char          oldKu[SNMP_MAXBUF_SMALL],
+        newKu[SNMP_MAXBUF_SMALL],
+        oldkul[SNMP_MAXBUF_SMALL],
+        newkul[SNMP_MAXBUF_SMALL], keychange[SNMP_MAXBUF_SMALL];
+
+    int             i;
+    int             arg = 1;
+
+    local_progname = argv[0];
+    local_passphrase_filename = (char *) malloc(sizeof(PASSPHRASE_DIR) +
+                                                sizeof(PASSPHRASE_FILE) +
+                                                4);
+    if (!local_passphrase_filename) {
+        fprintf(stderr, "%s: out of memory!", local_progname);
+        exit(-1);
+    }
+    sprintf(local_passphrase_filename, "%s/%s", PASSPHRASE_DIR,
+            PASSPHRASE_FILE);
+
+
+
+    /*
+     * Parse.
+     */
+    for (; (arg < argc) && (argv[arg][0] == '-'); arg++) {
+        switch (argv[arg][1]) {
+        case 'D':
+            snmp_set_do_debugging(1);
+            break;
+        case 'E':
+            engineid = (u_char *) argv[++arg];
+            break;
+        case 'f':
+            forcepassphrase = 1;
+            break;
+        case 'N':
+            newpass = argv[++arg];
+            break;
+        case 'O':
+            oldpass = argv[++arg];
+            break;
+        case 'P':
+            promptindicator = 0;
+            break;
+        case 't':
+            transform_type_input = argv[++arg];
+            break;
+        case 'v':
+            verbose = 1;
+            break;
+        case 'V':
+            visible = 1;
+            break;
+        case 'h':
+            rval = 0;
+        default:
+            usage_to_file(stdout);
+            exit(rval);
+        }
+    }
+
+    if (!transform_type_input) {
+        fprintf(stderr, "The -t option is mandatory.\n");
+        usage_synopsis(stdout);
+        exit(1000);
+    }
+
+
+
+    /*
+     * Convert and error check transform_type.
+     */
+    if (!strcmp(transform_type_input, "md5")) {
+        transform_type = usmHMACMD5AuthProtocol;
+
+    } else if (!strcmp(transform_type_input, "sha1")) {
+        transform_type = usmHMACSHA1AuthProtocol;
+
+    } else {
+        fprintf(stderr,
+                "Unrecognized hash transform: \"%s\".\n",
+                transform_type_input);
+        usage_synopsis(stderr);
+        QUITFUN(rval = SNMPERR_GENERR, main_quit);
+    }
+
+    if (verbose) {
+        fprintf(stderr, "Hash:\t\t%s\n",
+                (transform_type == usmHMACMD5AuthProtocol)
+                ? "usmHMACMD5AuthProtocol" : "usmHMACSHA1AuthProtocol");
+    }
+
+
+
+    /*
+     * Build engineID.  Accept hex engineID as the bits
+     * "in-and-of-themselves", otherwise create an engineID with the
+     * given string as text.
+     *
+     * If no engineID is given, lookup the first IP address for the
+     * localhost and use that (see setup_engineID()).
+     */
+    if (engineid && (tolower(*(engineid + 1)) == 'x')) {
+        engineid_len = hex_to_binary2(engineid + 2,
+                                      strlen((char *) engineid) - 2,
+                                      (char **) &engineid);
+        DEBUGMSGTL(("encode_keychange", "engineIDLen: %d\n",
+                    engineid_len));
+    } else {
+        engineid_len = setup_engineID(&engineid, (char *) engineid);
+
+    }
+
+#ifdef SNMP_TESTING_CODE
+    if (verbose) {
+        fprintf(stderr, "EngineID:\t%s\n",
+                /*
+                 * XXX = 
+                 */ dump_snmpEngineID(engineid, &engineid_len));
+    }
+#endif
+
+
+    /*
+     * Get passphrases from user.
+     */
+    rval = get_user_passphrases();
+    QUITFUN(rval, main_quit);
+
+    if (strlen(oldpass) < USM_LENGTH_P_MIN) {
+        fprintf(stderr, "Old passphrase must be greater than %d "
+                "characters in length.\n", USM_LENGTH_P_MIN);
+        QUITFUN(rval = SNMPERR_GENERR, main_quit);
+
+    } else if (strlen(newpass) < USM_LENGTH_P_MIN) {
+        fprintf(stderr, "New passphrase must be greater than %d "
+                "characters in length.\n", USM_LENGTH_P_MIN);
+        QUITFUN(rval = SNMPERR_GENERR, main_quit);
+    }
+
+    if (verbose) {
+        fprintf(stderr,
+                "Old passphrase:\t%s\nNew passphrase:\t%s\n",
+                oldpass, newpass);
+    }
+
+
+
+    /*
+     * Compute Ku and Kul's from old and new passphrases, then
+     * compute the keychange string & print it out.
+     */
+    rval = sc_init();
+    QUITFUN(rval, main_quit);
+
+
+    rval = generate_Ku(transform_type, USM_LENGTH_OID_TRANSFORM,
+                       (u_char *) oldpass, strlen(oldpass),
+                       oldKu, &oldKu_len);
+    QUITFUN(rval, main_quit);
+
+
+    rval = generate_Ku(transform_type, USM_LENGTH_OID_TRANSFORM,
+                       (u_char *) newpass, strlen(newpass),
+                       newKu, &newKu_len);
+    QUITFUN(rval, main_quit);
+
+
+    DEBUGMSGTL(("encode_keychange", "EID (%d): ", engineid_len));
+    for (i = 0; i < (int) engineid_len; i++)
+        DEBUGMSGTL(("encode_keychange", "%02x", (int) (engineid[i])));
+    DEBUGMSGTL(("encode_keychange", "\n"));
+
+    DEBUGMSGTL(("encode_keychange", "old Ku (%d) (from %s): ", oldKu_len,
+                oldpass));
+    for (i = 0; i < (int) oldKu_len; i++)
+        DEBUGMSGTL(("encode_keychange", "%02x", (int) (oldKu[i])));
+    DEBUGMSGTL(("encode_keychange", "\n"));
+
+    rval = generate_kul(transform_type, USM_LENGTH_OID_TRANSFORM,
+                        engineid, engineid_len,
+                        oldKu, oldKu_len, oldkul, &oldkul_len);
+    QUITFUN(rval, main_quit);
+
+
+    DEBUGMSGTL(("encode_keychange", "generating old Kul (%d) (from Ku): ",
+                oldkul_len));
+    for (i = 0; i < (int) oldkul_len; i++)
+        DEBUGMSGTL(("encode_keychange", "%02x", (int) (oldkul[i])));
+    DEBUGMSGTL(("encode_keychange", "\n"));
+
+    rval = generate_kul(transform_type, USM_LENGTH_OID_TRANSFORM,
+                        engineid, engineid_len,
+                        newKu, newKu_len, newkul, &newkul_len);
+    QUITFUN(rval, main_quit);
+
+    DEBUGMSGTL(("encode_keychange", "generating new Kul (%d) (from Ku): ",
+                oldkul_len));
+    for (i = 0; i < (int) newkul_len; i++)
+        DEBUGMSGTL(("encode_keychange", "%02x", newkul[i]));
+    DEBUGMSGTL(("encode_keychange", "\n"));
+
+    rval = encode_keychange(transform_type, USM_LENGTH_OID_TRANSFORM,
+                            oldkul, oldkul_len,
+                            newkul, newkul_len, keychange, &keychange_len);
+    QUITFUN(rval, main_quit);
+
+
+
+    binary_to_hex(keychange, keychange_len, &s);
+    printf("%s%s\n", (verbose) ? "KeyChange string:\t" : "",    /* XXX stdout */
+           s);
+
+
+    /*
+     * Cleanup.
+     */
+  main_quit:
+    snmp_call_callbacks(SNMP_CALLBACK_LIBRARY, SNMP_CALLBACK_SHUTDOWN,
+                        NULL);
+
+
+    SNMP_ZERO(oldpass, strlen(oldpass));
+    SNMP_ZERO(newpass, strlen(newpass));
+
+    SNMP_ZERO(oldKu, oldKu_len);
+    SNMP_ZERO(newKu, newKu_len);
+
+    SNMP_ZERO(oldkul, oldkul_len);
+    SNMP_ZERO(newkul, newkul_len);
+
+    SNMP_ZERO(s, strlen(s));
+
+    return rval;
+
+}                               /* end main() */
+
+
+
+
+/*******************************************************************-o-******
+ */
+void
+usage_synopsis(FILE * ofp)
+{
+    fprintf(ofp, USAGE "\n\
+\n\
+    -E [0x]<engineID>		EngineID used for kul generation.\n\
+    -f				Force passphrases to be read from stdin.\n\
+    -h				Help.\n\
+    -N \"<new_passphrase>\"	Passphrase used to generate new Ku.\n\
+    -O \"<old_passphrase>\"	Passphrase used to generate old Ku.\n\
+    -P				Turn off prompt indicators.\n\
+    -t md5 | sha1		HMAC hash transform type.\n\
+    -v				Verbose.\n\
+    -V				Visible.  Echo passphrases to terminal.\n\
+		" NL, local_progname);
+
+}                               /* end usage_synopsis() */
+
+void
+usage_to_file(FILE * ofp)
+{
+    char           *s;
+
+    usage_synopsis(ofp);
+
+    fprintf(ofp, "\n\
+    Only -t is mandatory.  The transform is used to convert P=>Ku, convert\n\
+    Ku=>Kul, and to hash the old Kul with the random bits.\n\
+\n\
+    Passphrase will be taken from the first successful source as follows:\n\
+	a) Commandline options,\n\
+	b) The file \"%s/%s\",\n\
+	c) stdin  -or-  User input from the terminal.\n\
+\n\
+    -f will require reading from the stdin/terminal, ignoring a) and b).\n\
+    -P will prevent prompts for passphrases to stdout from being printed.\n\
+\n\
+    <engineID> is intepreted as a hex string when preceeded by \"0x\",\n\
+    otherwise it is created to contain \"text\".  If nothing is given,\n\
+    <engineID> is constructed from the first IP address for the local host.\n\
+		" NL, (s = getenv("HOME")) ? s : "$HOME", local_passphrase_filename);
+
+
+    /*
+     * FIX -- make this possible?
+     * -r [0x]<random_bits> Random bits used in KeyChange XOR.
+     * 
+     * <engineID> and <random_bits> are intepreted as hex strings when
+     * preceeded by \"0x\", otherwise <engineID> is created to contain \"text\"
+     * and <random_bits> are the same as the ascii input.
+     * 
+     * <random_bits> will be generated by SCAPI if not given.  If value is
+     * too long, it will be truncated; if too short, the remainder will be
+     * filled in with zeros.
+     */
+
+}                               /* end usage() */
+
+
+/*
+ * this defined for HPUX aCC because the aCC doesn't drop the 
+ */
+/*
+ * snmp_parse_args.c functionality if compile with -g, PKY 
+ */
+
+void
+usage(void)
+{
+    usage_to_file(stdout);
+}
+
+
+
+
+
+/*******************************************************************-o-******
+ * get_user_passphrases
+ *
+ * Returns:
+ *	SNMPERR_SUCCESS		Success.
+ *	SNMPERR_GENERR		Otherwise.
+ *
+ *
+ * Acquire new and old passphrases from the user:
+ *
+ *	+ Always prompt if 'forcepassphrase' is set.
+ *	+ Use given arguments if they are defined.
+ *	+ Otherwise read file format from PASSPHRASE_FILE.
+ *		Sanity check existence and permissions of the path.
+ *		ASSUME for now that PASSPHRASE_FILE is rooted only at $HOME.
+ *	+ Otherwise prompt user for passphrase(s).
+ *		Echo input if 'visible' is set.
+ *		Turning off 'promptindicator' makes piping in input cleaner.
+ *
+ * NOTE Only using forcepassphrase mandates taking both passphrases
+ * from the same source.  Otherwise processing continues until both 
+ * passphrases are defined.
+ */
+int
+get_user_passphrases(void)
+{
+    int             rval = SNMPERR_SUCCESS;
+    size_t          len;
+
+    char           *obuf = NULL, *nbuf = NULL;
+
+    char            path[SNMP_MAXBUF], buf[SNMP_MAXBUF], *s = NULL;
+
+    struct stat     statbuf;
+    FILE           *fp;
+
+
+
+    /*
+     * Allow prompts to the user to override all other sources.
+     * Nothing to do otherwise if oldpass and newpass are already defined.
+     */
+    if (forcepassphrase)
+        goto get_user_passphrases_prompt;
+    if (oldpass && newpass)
+        goto get_user_passphrases_quit;
+
+
+
+    /*
+     * Read passphrases out of PASSPHRASE_FILE.  Sanity check the
+     * path for existence and access first.  Refuse to read
+     * if the permissions are wrong.
+     */
+    s = getenv("HOME");
+    snprintf(path, sizeof(path), "%s/%s", s, PASSPHRASE_DIR);
+    path[ sizeof(path)-1 ] = 0;
+
+    /*
+     * Test directory. 
+     */
+    if (stat(path, &statbuf) < 0) {
+        fprintf(stderr, "Cannot access directory \"%s\".\n", path);
+        QUITFUN(rval = SNMPERR_GENERR, get_user_passphrases_quit);
+#ifndef WIN32
+    } else if (statbuf.st_mode & (S_IRWXG | S_IRWXO)) {
+        fprintf(stderr,
+                "Directory \"%s\" is accessible by group or world.\n",
+                path);
+        QUITFUN(rval = SNMPERR_GENERR, get_user_passphrases_quit);
+#endif                          /* !WIN32 */
+    }
+
+    /*
+     * Test file. 
+     */
+    snprintf(path, sizeof(path), "%s/%s", s, local_passphrase_filename);
+    path[ sizeof(path)-1 ] = 0;
+    if (stat(path, &statbuf) < 0) {
+        fprintf(stderr, "Cannot access file \"%s\".\n", path);
+        QUITFUN(rval = SNMPERR_GENERR, get_user_passphrases_quit);
+#ifndef WIN32
+    } else if (statbuf.st_mode & (S_IRWXG | S_IRWXO)) {
+        fprintf(stderr,
+                "File \"%s\" is accessible by group or world.\n", path);
+        QUITFUN(rval = SNMPERR_GENERR, get_user_passphrases_quit);
+#endif                          /* !WIN32 */
+    }
+
+    /*
+     * Open the file. 
+     */
+    if ((fp = fopen(path, "r")) == NULL) {
+        fprintf(stderr, "Cannot open \"%s\".", path);
+        QUITFUN(rval = SNMPERR_GENERR, get_user_passphrases_quit);
+    }
+
+    /*
+     * Read 1st line. 
+     */
+    if (!fgets(buf, sizeof(buf), fp)) {
+        if (verbose) {
+            fprintf(stderr, "Passphrase file \"%s\" is empty...\n", path);
+        }
+        goto get_user_passphrases_prompt;
+
+    } else if (!oldpass) {
+        len = strlen(buf);
+        if (buf[len - 1] == '\n')
+            buf[--len] = '\0';
+        oldpass = (char *) calloc(1, len + 1);
+        if (oldpass)
+            memcpy(oldpass, buf, len + 1);
+    }
+    /*
+     * Read 2nd line. 
+     */
+    if (!fgets(buf, sizeof(buf), fp)) {
+        if (verbose) {
+            fprintf(stderr, "Only one line in file \"%s\"...\n", path);
+        }
+
+    } else if (!newpass) {
+        len = strlen(buf);
+        if (buf[len - 1] == '\n')
+            buf[--len] = '\0';
+        newpass = (char *) calloc(1, len + 1);
+        if (newpass)
+            memcpy(newpass, buf, len + 1);
+    }
+
+    if (oldpass && newpass)
+        goto get_user_passphrases_quit;
+
+
+
+    /*
+     * Prompt the user for passphrase entry.  Visible prompts
+     * may be omitted, and invisible entry may turned off.
+     */
+  get_user_passphrases_prompt:
+    if (forcepassphrase) {
+        oldpass = newpass = NULL;
+    }
+
+    if (!oldpass) {
+        oldpass = obuf
+            = snmp_getpassphrase((promptindicator) ? "Old passphrase: " :
+                                 "", visible);
+    }
+    if (!newpass) {
+        newpass = nbuf
+            = snmp_getpassphrase((promptindicator) ? "New passphrase: " :
+                                 "", visible);
+    }
+
+
+
+    /*
+     * Check that both passphrases were defined.
+     */
+    if (oldpass && newpass) {
+        goto get_user_passphrases_quit;
+    } else {
+        rval = SNMPERR_GENERR;
+    }
+
+
+  get_user_passphrases_quit:
+    SNMP_ZERO(buf, SNMP_MAXBUF);
+
+    if (obuf != oldpass) {
+        SNMP_ZERO(obuf, strlen(obuf));
+        SNMP_FREE(obuf);
+    }
+    if (nbuf != newpass) {
+        SNMP_ZERO(nbuf, strlen(nbuf));
+        SNMP_FREE(nbuf);
+    }
+
+    return rval;
+
+}                               /* end get_user_passphrases() */
+
+/*******************************************************************-o-******
+ * snmp_ttyecho
+ *
+ * Parameters:
+ *	fd	Descriptor of terminal on which to toggle echoing.
+ *	echo	TRUE if echoing should be on; FALSE otherwise.
+ *      
+ * Returns:
+ *	Previous value of echo setting.
+ *
+ *
+ * FIX	Put HAVE_TCGETATTR in autoconf?
+ */
+#ifndef HAVE_GETPASS
+#ifdef HAVE_TCGETATTR
+#include <termios.h>
+int
+snmp_ttyecho(const int fd, const int echo)
+{
+    struct termios  tio;
+    int             was_echo;
+
+
+    if (!isatty(fd))
+        return (-1);
+    tcgetattr(fd, &tio);
+    was_echo = (tio.c_lflag & ECHO) != 0;
+    if (echo)
+        tio.c_lflag |= (ECHO | ECHONL);
+    else
+        tio.c_lflag &= ~(ECHO | ECHONL);
+    tcsetattr(fd, TCSANOW, &tio);
+
+    return (was_echo);
+
+}                               /* end snmp_ttyecho() */
+
+#else
+#include <sgtty.h>
+int
+snmp_ttyecho(const int fd, const int echo)
+{
+    struct sgttyb   ttyparams;
+    int             was_echo;
+
+
+    if (!isatty(fd))
+        was_echo = -1;
+    else {
+        ioctl(fd, TIOCGETP, &ttyparams);
+        was_echo = (ttyparams.sg_flags & ECHO) != 0;
+        if (echo)
+            ttyparams.sg_flags = ttyparams.sg_flags | ECHO;
+        else
+            ttyparams.sg_flags = ttyparams.sg_flags & ~ECHO;
+        ioctl(fd, TIOCSETP, &ttyparams);
+    }
+
+    return (was_echo);
+
+}                               /* end snmp_ttyecho() */
+#endif                          /* HAVE_TCGETATTR */
+#endif                          /* HAVE_GETPASS */
+
+
+
+
+/*******************************************************************-o-******
+ * snmp_getpassphrase
+ *
+ * Parameters:
+ *	*prompt		(May be NULL.)
+ *	 bvisible	TRUE means echo back user input.
+ *      
+ * Returns:
+ *	Pointer to newly allocated, null terminated string containing
+ *		passphrase  -OR-
+ *	NULL on error.
+ *
+ *
+ * Prompt stdin for a string (or passphrase).  Return a copy of the 
+ * input in a null terminated string.
+ *
+ * FIX	Put HAVE_GETPASS in autoconf.
+ */
+char           *
+snmp_getpassphrase(const char *prompt, int bvisible)
+{
+    int             ti = 0;
+    size_t          len;
+
+    char           *bufp = NULL;
+    static char     buffer[SNMP_MAXBUF];
+
+    FILE           *ofp = stdout;
+
+
+    /*
+     * Query stdin for a passphrase.
+     */
+#ifdef HAVE_GETPASS
+    if (isatty(0)) {
+        return getpass((prompt) ? prompt : "");
+    }
+#endif
+
+    fputs((prompt) ? prompt : "", ofp);
+
+    if (!bvisible) {
+        ti = snmp_ttyecho(0, 0);
+    }
+
+    fgets(buffer, sizeof(buffer), stdin);
+
+    if (!bvisible) {
+        ti = snmp_ttyecho(0, ti);
+        fputs("\n", ofp);
+    }
+
+
+    /*
+     * Copy the input and zero out the read-in buffer.
+     */
+    len = strlen(buffer);
+    if (buffer[len - 1] == '\n')
+        buffer[--len] = '\0';
+
+    bufp = (char *) calloc(1, len + 1);
+    if (bufp)
+        memcpy(bufp, buffer, len + 1);
+
+    SNMP_ZERO(buffer, SNMP_MAXBUF);
+
+
+    return bufp;
+
+}                               /* end snmp_getpassphrase() */
+
+#ifdef WIN32
+
+int
+snmp_ttyecho(const int fd, const int echo)
+{
+    return 0;
+}
+
+/*
+ * stops at the first newline, carrier return, or backspace.
+ * WARNING! _getch does NOT read <Ctrl-C>
+ */
+char           *
+getpass(const char *prompt)
+{
+    static char     pbuf[128];
+    int             ch, lim;
+
+    _cputs(prompt);
+    for (ch = 0, lim = 0; ch != '\n' && lim < sizeof(pbuf)-1;) {
+        ch = _getch();          /* look ma, no echo ! */
+        if (ch == '\r' || ch == '\n' || ch == '\b')
+            break;
+        pbuf[lim++] = ch;
+    }
+    pbuf[lim] = '\0';
+    puts("\n");
+
+    return pbuf;
+}
+#endif                          /* WIN32 */
diff -Naur tomato/release/src/router/snmp/apps/Makefile.depend tomato121/release/src/router/snmp/apps/Makefile.depend
--- tomato/release/src/router/snmp/apps/Makefile.depend	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/apps/Makefile.depend	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,1414 @@
+# DO NOT DELETE THIS LINE -- make depend depends on it.
+
+./encode_keychange.lo: ../include/net-snmp/net-snmp-config.h
+./encode_keychange.lo: ../include/net-snmp/system/linux.h
+./encode_keychange.lo: ../include/net-snmp/system/sysv.h
+./encode_keychange.lo: ../include/net-snmp/system/generic.h
+./encode_keychange.lo: ../include/net-snmp/machine/generic.h
+./encode_keychange.lo: ../include/net-snmp/net-snmp-includes.h
+./encode_keychange.lo: ../include/net-snmp/definitions.h
+./encode_keychange.lo: ../include/net-snmp/types.h
+./encode_keychange.lo: ../include/net-snmp/library/snmp_api.h
+./encode_keychange.lo: ../include/net-snmp/library/asn1.h
+./encode_keychange.lo: ../include/net-snmp/library/snmp_impl.h
+./encode_keychange.lo: ../include/net-snmp/library/snmp.h
+./encode_keychange.lo: ../include/net-snmp/library/snmp-tc.h
+./encode_keychange.lo: ../include/net-snmp/utilities.h
+./encode_keychange.lo: ../include/net-snmp/library/snmp_client.h
+./encode_keychange.lo: ../include/net-snmp/library/getopt.h
+./encode_keychange.lo: ../include/net-snmp/library/system.h
+./encode_keychange.lo: ../include/net-snmp/library/tools.h
+./encode_keychange.lo: ../include/net-snmp/library/int64.h
+./encode_keychange.lo: ../include/net-snmp/library/mt_support.h
+./encode_keychange.lo: ../include/net-snmp/library/snmp_alarm.h
+./encode_keychange.lo: ../include/net-snmp/library/data_list.h
+./encode_keychange.lo: ../include/net-snmp/library/callback.h
+./encode_keychange.lo: ../include/net-snmp/library/oid_stash.h
+./encode_keychange.lo: ../include/net-snmp/library/check_varbind.h
+./encode_keychange.lo: ../include/net-snmp/version.h
+./encode_keychange.lo: ../include/net-snmp/session_api.h
+./encode_keychange.lo: ../include/net-snmp/library/snmp_transport.h
+./encode_keychange.lo: ../include/net-snmp/library/snmpCallbackDomain.h
+./encode_keychange.lo: ../include/net-snmp/library/snmpUnixDomain.h
+./encode_keychange.lo: ../include/net-snmp/library/snmpUDPDomain.h
+./encode_keychange.lo: ../include/net-snmp/library/snmpTCPDomain.h
+./encode_keychange.lo: ../include/net-snmp/library/snmpUDPIPv6Domain.h
+./encode_keychange.lo: ../include/net-snmp/library/snmpTCPIPv6Domain.h
+./encode_keychange.lo: ../include/net-snmp/library/snmpIPXDomain.h
+./encode_keychange.lo: ../include/net-snmp/library/ucd_compat.h
+./encode_keychange.lo: ../include/net-snmp/pdu_api.h
+./encode_keychange.lo: ../include/net-snmp/mib_api.h
+./encode_keychange.lo: ../include/net-snmp/library/mib.h
+./encode_keychange.lo: ../include/net-snmp/library/parse.h
+./encode_keychange.lo: ../include/net-snmp/varbind_api.h
+./encode_keychange.lo: ../include/net-snmp/config_api.h
+./encode_keychange.lo: ../include/net-snmp/library/read_config.h
+./encode_keychange.lo: ../include/net-snmp/library/default_store.h
+./encode_keychange.lo: ../include/net-snmp/library/snmp_parse_args.h
+./encode_keychange.lo: ../include/net-snmp/library/snmp_enum.h
+./encode_keychange.lo: ../include/net-snmp/library/vacm.h
+./encode_keychange.lo: ../include/net-snmp/output_api.h
+./encode_keychange.lo: ../include/net-snmp/library/snmp_debug.h
+./encode_keychange.lo: ../include/net-snmp/library/snmp_logging.h
+./encode_keychange.lo: ../include/net-snmp/snmpv3_api.h
+./encode_keychange.lo: ../include/net-snmp/library/snmpv3.h
+./encode_keychange.lo: ../include/net-snmp/library/transform_oids.h
+./encode_keychange.lo: ../include/net-snmp/library/keytools.h
+./encode_keychange.lo: ../include/net-snmp/library/scapi.h
+./encode_keychange.lo: ../include/net-snmp/library/lcd_time.h
+./encode_keychange.lo: ../include/net-snmp/library/snmp_secmod.h
+./encode_keychange.lo: ../include/net-snmp/library/snmpv3-security-includes.h
+./encode_keychange.lo: ../include/net-snmp/library/snmpusm.h
+./notification_log.lo: ../include/net-snmp/net-snmp-config.h
+./notification_log.lo: ../include/net-snmp/system/linux.h
+./notification_log.lo: ../include/net-snmp/system/sysv.h
+./notification_log.lo: ../include/net-snmp/system/generic.h
+./notification_log.lo: ../include/net-snmp/machine/generic.h
+./notification_log.lo: ../include/net-snmp/net-snmp-includes.h
+./notification_log.lo: ../include/net-snmp/definitions.h
+./notification_log.lo: ../include/net-snmp/types.h
+./notification_log.lo: ../include/net-snmp/library/snmp_api.h
+./notification_log.lo: ../include/net-snmp/library/asn1.h
+./notification_log.lo: ../include/net-snmp/library/snmp_impl.h
+./notification_log.lo: ../include/net-snmp/library/snmp.h
+./notification_log.lo: ../include/net-snmp/library/snmp-tc.h
+./notification_log.lo: ../include/net-snmp/utilities.h
+./notification_log.lo: ../include/net-snmp/library/snmp_client.h
+./notification_log.lo: ../include/net-snmp/library/getopt.h
+./notification_log.lo: ../include/net-snmp/library/system.h
+./notification_log.lo: ../include/net-snmp/library/tools.h
+./notification_log.lo: ../include/net-snmp/library/int64.h
+./notification_log.lo: ../include/net-snmp/library/mt_support.h
+./notification_log.lo: ../include/net-snmp/library/snmp_alarm.h
+./notification_log.lo: ../include/net-snmp/library/data_list.h
+./notification_log.lo: ../include/net-snmp/library/callback.h
+./notification_log.lo: ../include/net-snmp/library/oid_stash.h
+./notification_log.lo: ../include/net-snmp/library/check_varbind.h
+./notification_log.lo: ../include/net-snmp/version.h
+./notification_log.lo: ../include/net-snmp/session_api.h
+./notification_log.lo: ../include/net-snmp/library/snmp_transport.h
+./notification_log.lo: ../include/net-snmp/library/snmpCallbackDomain.h
+./notification_log.lo: ../include/net-snmp/library/snmpUnixDomain.h
+./notification_log.lo: ../include/net-snmp/library/snmpUDPDomain.h
+./notification_log.lo: ../include/net-snmp/library/snmpTCPDomain.h
+./notification_log.lo: ../include/net-snmp/library/snmpUDPIPv6Domain.h
+./notification_log.lo: ../include/net-snmp/library/snmpTCPIPv6Domain.h
+./notification_log.lo: ../include/net-snmp/library/snmpIPXDomain.h
+./notification_log.lo: ../include/net-snmp/library/ucd_compat.h
+./notification_log.lo: ../include/net-snmp/pdu_api.h
+./notification_log.lo: ../include/net-snmp/mib_api.h
+./notification_log.lo: ../include/net-snmp/library/mib.h
+./notification_log.lo: ../include/net-snmp/library/parse.h
+./notification_log.lo: ../include/net-snmp/varbind_api.h
+./notification_log.lo: ../include/net-snmp/config_api.h
+./notification_log.lo: ../include/net-snmp/library/read_config.h
+./notification_log.lo: ../include/net-snmp/library/default_store.h
+./notification_log.lo: ../include/net-snmp/library/snmp_parse_args.h
+./notification_log.lo: ../include/net-snmp/library/snmp_enum.h
+./notification_log.lo: ../include/net-snmp/library/vacm.h
+./notification_log.lo: ../include/net-snmp/output_api.h
+./notification_log.lo: ../include/net-snmp/library/snmp_debug.h
+./notification_log.lo: ../include/net-snmp/library/snmp_logging.h
+./notification_log.lo: ../include/net-snmp/snmpv3_api.h
+./notification_log.lo: ../include/net-snmp/library/snmpv3.h
+./notification_log.lo: ../include/net-snmp/library/transform_oids.h
+./notification_log.lo: ../include/net-snmp/library/keytools.h
+./notification_log.lo: ../include/net-snmp/library/scapi.h
+./notification_log.lo: ../include/net-snmp/library/lcd_time.h
+./notification_log.lo: ../include/net-snmp/library/snmp_secmod.h
+./notification_log.lo: ../include/net-snmp/library/snmpv3-security-includes.h
+./notification_log.lo: ../include/net-snmp/library/snmpusm.h
+./notification_log.lo: ../include/net-snmp/agent/net-snmp-agent-includes.h
+./notification_log.lo: ../include/net-snmp/agent/snmp_agent.h
+./notification_log.lo: ../include/net-snmp/agent/snmp_vars.h
+./notification_log.lo: ../include/net-snmp/agent/agent_handler.h
+./notification_log.lo: ../include/net-snmp/agent/var_struct.h
+./notification_log.lo: ../include/net-snmp/agent/agent_registry.h
+./notification_log.lo: ../include/net-snmp/agent/ds_agent.h
+./notification_log.lo: ../include/net-snmp/agent/agent_read_config.h
+./notification_log.lo: ../include/net-snmp/agent/agent_trap.h
+./notification_log.lo: ../include/net-snmp/agent/all_helpers.h
+./notification_log.lo: ../include/net-snmp/agent/instance.h
+./notification_log.lo: ../include/net-snmp/agent/multiplexer.h
+./notification_log.lo: ../include/net-snmp/agent/null.h
+./notification_log.lo: ../include/net-snmp/agent/debug_handler.h
+./notification_log.lo: ../include/net-snmp/agent/old_api.h
+./notification_log.lo: ../include/net-snmp/agent/read_only.h
+./notification_log.lo: ../include/net-snmp/agent/serialize.h
+./notification_log.lo: ../include/net-snmp/agent/bulk_to_next.h
+./notification_log.lo: ../include/net-snmp/agent/mode_end_call.h
+./notification_log.lo: ../include/net-snmp/agent/table.h
+./notification_log.lo: ../include/net-snmp/agent/table_data.h
+./notification_log.lo: ../include/net-snmp/agent/table_dataset.h
+./notification_log.lo: ../include/net-snmp/agent/table_iterator.h
+./notification_log.lo: ../include/net-snmp/agent/mib_module_config.h
+./notification_log.lo: notification_log.h
+./snmpbulkget.lo: ../include/net-snmp/net-snmp-config.h
+./snmpbulkget.lo: ../include/net-snmp/system/linux.h
+./snmpbulkget.lo: ../include/net-snmp/system/sysv.h
+./snmpbulkget.lo: ../include/net-snmp/system/generic.h
+./snmpbulkget.lo: ../include/net-snmp/machine/generic.h 
+./snmpbulkget.lo:  ../include/net-snmp/utilities.h
+./snmpbulkget.lo: ../include/net-snmp/types.h 
+./snmpbulkget.lo: ../include/net-snmp/definitions.h
+./snmpbulkget.lo: ../include/net-snmp/library/snmp_api.h
+./snmpbulkget.lo: ../include/net-snmp/library/asn1.h
+./snmpbulkget.lo: ../include/net-snmp/library/snmp_impl.h
+./snmpbulkget.lo: ../include/net-snmp/library/snmp.h
+./snmpbulkget.lo: ../include/net-snmp/library/snmp-tc.h
+./snmpbulkget.lo: ../include/net-snmp/library/snmp_client.h
+./snmpbulkget.lo: ../include/net-snmp/library/getopt.h
+./snmpbulkget.lo: ../include/net-snmp/library/system.h
+./snmpbulkget.lo: ../include/net-snmp/library/tools.h
+./snmpbulkget.lo: ../include/net-snmp/library/int64.h
+./snmpbulkget.lo: ../include/net-snmp/library/mt_support.h
+./snmpbulkget.lo: ../include/net-snmp/library/snmp_alarm.h
+./snmpbulkget.lo: ../include/net-snmp/library/data_list.h
+./snmpbulkget.lo: ../include/net-snmp/library/callback.h
+./snmpbulkget.lo: ../include/net-snmp/library/oid_stash.h
+./snmpbulkget.lo: ../include/net-snmp/library/check_varbind.h
+./snmpbulkget.lo: ../include/net-snmp/version.h 
+./snmpbulkget.lo: ../include/net-snmp/net-snmp-includes.h
+./snmpbulkget.lo: ../include/net-snmp/session_api.h
+./snmpbulkget.lo: ../include/net-snmp/library/snmp_transport.h
+./snmpbulkget.lo: ../include/net-snmp/library/snmpCallbackDomain.h
+./snmpbulkget.lo: ../include/net-snmp/library/snmpUnixDomain.h
+./snmpbulkget.lo: ../include/net-snmp/library/snmpUDPDomain.h
+./snmpbulkget.lo: ../include/net-snmp/library/snmpTCPDomain.h
+./snmpbulkget.lo: ../include/net-snmp/library/snmpUDPIPv6Domain.h
+./snmpbulkget.lo: ../include/net-snmp/library/snmpTCPIPv6Domain.h
+./snmpbulkget.lo: ../include/net-snmp/library/snmpIPXDomain.h
+./snmpbulkget.lo: ../include/net-snmp/library/ucd_compat.h
+./snmpbulkget.lo: ../include/net-snmp/pdu_api.h ../include/net-snmp/mib_api.h
+./snmpbulkget.lo: ../include/net-snmp/library/mib.h
+./snmpbulkget.lo: ../include/net-snmp/library/parse.h
+./snmpbulkget.lo: ../include/net-snmp/varbind_api.h
+./snmpbulkget.lo: ../include/net-snmp/config_api.h
+./snmpbulkget.lo: ../include/net-snmp/library/read_config.h
+./snmpbulkget.lo: ../include/net-snmp/library/default_store.h
+./snmpbulkget.lo: ../include/net-snmp/library/snmp_parse_args.h
+./snmpbulkget.lo: ../include/net-snmp/library/snmp_enum.h
+./snmpbulkget.lo: ../include/net-snmp/library/vacm.h
+./snmpbulkget.lo: ../include/net-snmp/output_api.h
+./snmpbulkget.lo: ../include/net-snmp/library/snmp_debug.h
+./snmpbulkget.lo: ../include/net-snmp/library/snmp_logging.h
+./snmpbulkget.lo: ../include/net-snmp/snmpv3_api.h
+./snmpbulkget.lo: ../include/net-snmp/library/snmpv3.h
+./snmpbulkget.lo: ../include/net-snmp/library/transform_oids.h
+./snmpbulkget.lo: ../include/net-snmp/library/keytools.h
+./snmpbulkget.lo: ../include/net-snmp/library/scapi.h
+./snmpbulkget.lo: ../include/net-snmp/library/lcd_time.h
+./snmpbulkget.lo: ../include/net-snmp/library/snmp_secmod.h
+./snmpbulkget.lo: ../include/net-snmp/library/snmpv3-security-includes.h
+./snmpbulkget.lo: ../include/net-snmp/library/snmpusm.h
+./snmpbulkwalk.lo: ../include/net-snmp/net-snmp-config.h
+./snmpbulkwalk.lo: ../include/net-snmp/system/linux.h
+./snmpbulkwalk.lo: ../include/net-snmp/system/sysv.h
+./snmpbulkwalk.lo: ../include/net-snmp/system/generic.h
+./snmpbulkwalk.lo: ../include/net-snmp/machine/generic.h
+./snmpbulkwalk.lo: ../include/net-snmp/net-snmp-includes.h
+./snmpbulkwalk.lo: ../include/net-snmp/definitions.h
+./snmpbulkwalk.lo: ../include/net-snmp/types.h
+./snmpbulkwalk.lo: ../include/net-snmp/library/snmp_api.h
+./snmpbulkwalk.lo: ../include/net-snmp/library/asn1.h
+./snmpbulkwalk.lo: ../include/net-snmp/library/snmp_impl.h
+./snmpbulkwalk.lo: ../include/net-snmp/library/snmp.h
+./snmpbulkwalk.lo: ../include/net-snmp/library/snmp-tc.h
+./snmpbulkwalk.lo: ../include/net-snmp/utilities.h
+./snmpbulkwalk.lo: ../include/net-snmp/library/snmp_client.h
+./snmpbulkwalk.lo: ../include/net-snmp/library/getopt.h
+./snmpbulkwalk.lo: ../include/net-snmp/library/system.h
+./snmpbulkwalk.lo: ../include/net-snmp/library/tools.h
+./snmpbulkwalk.lo: ../include/net-snmp/library/int64.h
+./snmpbulkwalk.lo: ../include/net-snmp/library/mt_support.h
+./snmpbulkwalk.lo: ../include/net-snmp/library/snmp_alarm.h
+./snmpbulkwalk.lo: ../include/net-snmp/library/data_list.h
+./snmpbulkwalk.lo: ../include/net-snmp/library/callback.h
+./snmpbulkwalk.lo: ../include/net-snmp/library/oid_stash.h
+./snmpbulkwalk.lo: ../include/net-snmp/library/check_varbind.h
+./snmpbulkwalk.lo: ../include/net-snmp/version.h
+./snmpbulkwalk.lo: ../include/net-snmp/session_api.h
+./snmpbulkwalk.lo: ../include/net-snmp/library/snmp_transport.h
+./snmpbulkwalk.lo: ../include/net-snmp/library/snmpCallbackDomain.h
+./snmpbulkwalk.lo: ../include/net-snmp/library/snmpUnixDomain.h
+./snmpbulkwalk.lo: ../include/net-snmp/library/snmpUDPDomain.h
+./snmpbulkwalk.lo: ../include/net-snmp/library/snmpTCPDomain.h
+./snmpbulkwalk.lo: ../include/net-snmp/library/snmpUDPIPv6Domain.h
+./snmpbulkwalk.lo: ../include/net-snmp/library/snmpTCPIPv6Domain.h
+./snmpbulkwalk.lo: ../include/net-snmp/library/snmpIPXDomain.h
+./snmpbulkwalk.lo: ../include/net-snmp/library/ucd_compat.h
+./snmpbulkwalk.lo: ../include/net-snmp/pdu_api.h
+./snmpbulkwalk.lo: ../include/net-snmp/mib_api.h
+./snmpbulkwalk.lo: ../include/net-snmp/library/mib.h
+./snmpbulkwalk.lo: ../include/net-snmp/library/parse.h
+./snmpbulkwalk.lo: ../include/net-snmp/varbind_api.h
+./snmpbulkwalk.lo: ../include/net-snmp/config_api.h
+./snmpbulkwalk.lo: ../include/net-snmp/library/read_config.h
+./snmpbulkwalk.lo: ../include/net-snmp/library/default_store.h
+./snmpbulkwalk.lo: ../include/net-snmp/library/snmp_parse_args.h
+./snmpbulkwalk.lo: ../include/net-snmp/library/snmp_enum.h
+./snmpbulkwalk.lo: ../include/net-snmp/library/vacm.h
+./snmpbulkwalk.lo: ../include/net-snmp/output_api.h
+./snmpbulkwalk.lo: ../include/net-snmp/library/snmp_debug.h
+./snmpbulkwalk.lo: ../include/net-snmp/library/snmp_logging.h
+./snmpbulkwalk.lo: ../include/net-snmp/snmpv3_api.h
+./snmpbulkwalk.lo: ../include/net-snmp/library/snmpv3.h
+./snmpbulkwalk.lo: ../include/net-snmp/library/transform_oids.h
+./snmpbulkwalk.lo: ../include/net-snmp/library/keytools.h
+./snmpbulkwalk.lo: ../include/net-snmp/library/scapi.h
+./snmpbulkwalk.lo: ../include/net-snmp/library/lcd_time.h
+./snmpbulkwalk.lo: ../include/net-snmp/library/snmp_secmod.h
+./snmpbulkwalk.lo: ../include/net-snmp/library/snmpv3-security-includes.h
+./snmpbulkwalk.lo: ../include/net-snmp/library/snmpusm.h
+./snmpdelta.lo: ../include/net-snmp/net-snmp-config.h
+./snmpdelta.lo: ../include/net-snmp/system/linux.h
+./snmpdelta.lo: ../include/net-snmp/system/sysv.h
+./snmpdelta.lo: ../include/net-snmp/system/generic.h
+./snmpdelta.lo: ../include/net-snmp/machine/generic.h 
+./snmpdelta.lo: ../include/net-snmp/net-snmp-includes.h
+./snmpdelta.lo: ../include/net-snmp/definitions.h ../include/net-snmp/types.h
+./snmpdelta.lo: ../include/net-snmp/library/snmp_api.h
+./snmpdelta.lo: ../include/net-snmp/library/asn1.h
+./snmpdelta.lo: ../include/net-snmp/library/snmp_impl.h
+./snmpdelta.lo: ../include/net-snmp/library/snmp.h
+./snmpdelta.lo: ../include/net-snmp/library/snmp-tc.h
+./snmpdelta.lo: ../include/net-snmp/utilities.h
+./snmpdelta.lo: ../include/net-snmp/library/snmp_client.h
+./snmpdelta.lo: ../include/net-snmp/library/getopt.h
+./snmpdelta.lo: ../include/net-snmp/library/system.h
+./snmpdelta.lo: ../include/net-snmp/library/tools.h
+./snmpdelta.lo: ../include/net-snmp/library/int64.h
+./snmpdelta.lo: ../include/net-snmp/library/mt_support.h
+./snmpdelta.lo: ../include/net-snmp/library/snmp_alarm.h
+./snmpdelta.lo: ../include/net-snmp/library/data_list.h
+./snmpdelta.lo: ../include/net-snmp/library/callback.h
+./snmpdelta.lo: ../include/net-snmp/library/oid_stash.h
+./snmpdelta.lo: ../include/net-snmp/library/check_varbind.h
+./snmpdelta.lo: ../include/net-snmp/version.h
+./snmpdelta.lo: ../include/net-snmp/session_api.h
+./snmpdelta.lo: ../include/net-snmp/library/snmp_transport.h
+./snmpdelta.lo: ../include/net-snmp/library/snmpCallbackDomain.h
+./snmpdelta.lo: ../include/net-snmp/library/snmpUnixDomain.h
+./snmpdelta.lo: ../include/net-snmp/library/snmpUDPDomain.h
+./snmpdelta.lo: ../include/net-snmp/library/snmpTCPDomain.h
+./snmpdelta.lo: ../include/net-snmp/library/snmpUDPIPv6Domain.h
+./snmpdelta.lo: ../include/net-snmp/library/snmpTCPIPv6Domain.h
+./snmpdelta.lo: ../include/net-snmp/library/snmpIPXDomain.h
+./snmpdelta.lo: ../include/net-snmp/library/ucd_compat.h
+./snmpdelta.lo: ../include/net-snmp/pdu_api.h ../include/net-snmp/mib_api.h
+./snmpdelta.lo: ../include/net-snmp/library/mib.h
+./snmpdelta.lo: ../include/net-snmp/library/parse.h
+./snmpdelta.lo: ../include/net-snmp/varbind_api.h
+./snmpdelta.lo: ../include/net-snmp/config_api.h
+./snmpdelta.lo: ../include/net-snmp/library/read_config.h
+./snmpdelta.lo: ../include/net-snmp/library/default_store.h
+./snmpdelta.lo: ../include/net-snmp/library/snmp_parse_args.h
+./snmpdelta.lo: ../include/net-snmp/library/snmp_enum.h
+./snmpdelta.lo: ../include/net-snmp/library/vacm.h
+./snmpdelta.lo: ../include/net-snmp/output_api.h
+./snmpdelta.lo: ../include/net-snmp/library/snmp_debug.h
+./snmpdelta.lo: ../include/net-snmp/library/snmp_logging.h
+./snmpdelta.lo: ../include/net-snmp/snmpv3_api.h
+./snmpdelta.lo: ../include/net-snmp/library/snmpv3.h
+./snmpdelta.lo: ../include/net-snmp/library/transform_oids.h
+./snmpdelta.lo: ../include/net-snmp/library/keytools.h
+./snmpdelta.lo: ../include/net-snmp/library/scapi.h
+./snmpdelta.lo: ../include/net-snmp/library/lcd_time.h
+./snmpdelta.lo: ../include/net-snmp/library/snmp_secmod.h
+./snmpdelta.lo: ../include/net-snmp/library/snmpv3-security-includes.h
+./snmpdelta.lo: ../include/net-snmp/library/snmpusm.h
+./snmpdf.lo: ../include/net-snmp/net-snmp-config.h
+./snmpdf.lo: ../include/net-snmp/system/linux.h
+./snmpdf.lo: ../include/net-snmp/system/sysv.h
+./snmpdf.lo: ../include/net-snmp/system/generic.h
+./snmpdf.lo: ../include/net-snmp/machine/generic.h 
+./snmpdf.lo: ../include/net-snmp/net-snmp-includes.h
+./snmpdf.lo: ../include/net-snmp/definitions.h ../include/net-snmp/types.h
+./snmpdf.lo: ../include/net-snmp/library/snmp_api.h
+./snmpdf.lo: ../include/net-snmp/library/asn1.h
+./snmpdf.lo: ../include/net-snmp/library/snmp_impl.h
+./snmpdf.lo: ../include/net-snmp/library/snmp.h
+./snmpdf.lo: ../include/net-snmp/library/snmp-tc.h
+./snmpdf.lo: ../include/net-snmp/utilities.h
+./snmpdf.lo: ../include/net-snmp/library/snmp_client.h
+./snmpdf.lo: ../include/net-snmp/library/getopt.h
+./snmpdf.lo: ../include/net-snmp/library/system.h
+./snmpdf.lo: ../include/net-snmp/library/tools.h
+./snmpdf.lo: ../include/net-snmp/library/int64.h
+./snmpdf.lo: ../include/net-snmp/library/mt_support.h
+./snmpdf.lo: ../include/net-snmp/library/snmp_alarm.h
+./snmpdf.lo: ../include/net-snmp/library/data_list.h
+./snmpdf.lo: ../include/net-snmp/library/callback.h
+./snmpdf.lo: ../include/net-snmp/library/oid_stash.h
+./snmpdf.lo: ../include/net-snmp/library/check_varbind.h
+./snmpdf.lo: ../include/net-snmp/version.h ../include/net-snmp/session_api.h
+./snmpdf.lo: ../include/net-snmp/library/snmp_transport.h
+./snmpdf.lo: ../include/net-snmp/library/snmpCallbackDomain.h
+./snmpdf.lo: ../include/net-snmp/library/snmpUnixDomain.h
+./snmpdf.lo: ../include/net-snmp/library/snmpUDPDomain.h
+./snmpdf.lo: ../include/net-snmp/library/snmpTCPDomain.h
+./snmpdf.lo: ../include/net-snmp/library/snmpUDPIPv6Domain.h
+./snmpdf.lo: ../include/net-snmp/library/snmpTCPIPv6Domain.h
+./snmpdf.lo: ../include/net-snmp/library/snmpIPXDomain.h
+./snmpdf.lo: ../include/net-snmp/library/ucd_compat.h
+./snmpdf.lo: ../include/net-snmp/pdu_api.h ../include/net-snmp/mib_api.h
+./snmpdf.lo: ../include/net-snmp/library/mib.h
+./snmpdf.lo: ../include/net-snmp/library/parse.h
+./snmpdf.lo: ../include/net-snmp/varbind_api.h
+./snmpdf.lo: ../include/net-snmp/config_api.h
+./snmpdf.lo: ../include/net-snmp/library/read_config.h
+./snmpdf.lo: ../include/net-snmp/library/default_store.h
+./snmpdf.lo: ../include/net-snmp/library/snmp_parse_args.h
+./snmpdf.lo: ../include/net-snmp/library/snmp_enum.h
+./snmpdf.lo: ../include/net-snmp/library/vacm.h
+./snmpdf.lo: ../include/net-snmp/output_api.h
+./snmpdf.lo: ../include/net-snmp/library/snmp_debug.h
+./snmpdf.lo: ../include/net-snmp/library/snmp_logging.h 
+./snmpdf.lo:  ../include/net-snmp/snmpv3_api.h
+./snmpdf.lo: ../include/net-snmp/library/snmpv3.h
+./snmpdf.lo: ../include/net-snmp/library/transform_oids.h
+./snmpdf.lo: ../include/net-snmp/library/keytools.h
+./snmpdf.lo: ../include/net-snmp/library/scapi.h
+./snmpdf.lo: ../include/net-snmp/library/lcd_time.h
+./snmpdf.lo: ../include/net-snmp/library/snmp_secmod.h
+./snmpdf.lo: ../include/net-snmp/library/snmpv3-security-includes.h
+./snmpdf.lo: ../include/net-snmp/library/snmpusm.h
+./snmpget.lo: ../include/net-snmp/net-snmp-config.h
+./snmpget.lo: ../include/net-snmp/system/linux.h
+./snmpget.lo: ../include/net-snmp/system/sysv.h
+./snmpget.lo: ../include/net-snmp/system/generic.h
+./snmpget.lo: ../include/net-snmp/machine/generic.h 
+./snmpget.lo: ../include/net-snmp/utilities.h ../include/net-snmp/types.h
+./snmpget.lo: ../include/net-snmp/definitions.h
+./snmpget.lo: ../include/net-snmp/library/snmp_api.h
+./snmpget.lo: ../include/net-snmp/library/asn1.h
+./snmpget.lo: ../include/net-snmp/library/snmp_impl.h
+./snmpget.lo: ../include/net-snmp/library/snmp.h
+./snmpget.lo: ../include/net-snmp/library/snmp-tc.h
+./snmpget.lo: ../include/net-snmp/library/snmp_client.h
+./snmpget.lo: ../include/net-snmp/library/getopt.h
+./snmpget.lo: ../include/net-snmp/library/system.h
+./snmpget.lo: ../include/net-snmp/library/tools.h
+./snmpget.lo: ../include/net-snmp/library/int64.h
+./snmpget.lo: ../include/net-snmp/library/mt_support.h
+./snmpget.lo: ../include/net-snmp/library/snmp_alarm.h
+./snmpget.lo: ../include/net-snmp/library/data_list.h
+./snmpget.lo: ../include/net-snmp/library/callback.h
+./snmpget.lo: ../include/net-snmp/library/oid_stash.h
+./snmpget.lo: ../include/net-snmp/library/check_varbind.h
+./snmpget.lo: ../include/net-snmp/version.h
+./snmpget.lo: ../include/net-snmp/net-snmp-includes.h
+./snmpget.lo: ../include/net-snmp/session_api.h
+./snmpget.lo: ../include/net-snmp/library/snmp_transport.h
+./snmpget.lo: ../include/net-snmp/library/snmpCallbackDomain.h
+./snmpget.lo: ../include/net-snmp/library/snmpUnixDomain.h
+./snmpget.lo: ../include/net-snmp/library/snmpUDPDomain.h
+./snmpget.lo: ../include/net-snmp/library/snmpTCPDomain.h
+./snmpget.lo: ../include/net-snmp/library/snmpUDPIPv6Domain.h
+./snmpget.lo: ../include/net-snmp/library/snmpTCPIPv6Domain.h
+./snmpget.lo: ../include/net-snmp/library/snmpIPXDomain.h
+./snmpget.lo: ../include/net-snmp/library/ucd_compat.h
+./snmpget.lo: ../include/net-snmp/pdu_api.h ../include/net-snmp/mib_api.h
+./snmpget.lo: ../include/net-snmp/library/mib.h
+./snmpget.lo: ../include/net-snmp/library/parse.h
+./snmpget.lo: ../include/net-snmp/varbind_api.h
+./snmpget.lo: ../include/net-snmp/config_api.h
+./snmpget.lo: ../include/net-snmp/library/read_config.h
+./snmpget.lo: ../include/net-snmp/library/default_store.h
+./snmpget.lo: ../include/net-snmp/library/snmp_parse_args.h
+./snmpget.lo: ../include/net-snmp/library/snmp_enum.h
+./snmpget.lo: ../include/net-snmp/library/vacm.h
+./snmpget.lo: ../include/net-snmp/output_api.h
+./snmpget.lo: ../include/net-snmp/library/snmp_debug.h
+./snmpget.lo: ../include/net-snmp/library/snmp_logging.h
+./snmpget.lo: ../include/net-snmp/snmpv3_api.h
+./snmpget.lo: ../include/net-snmp/library/snmpv3.h
+./snmpget.lo: ../include/net-snmp/library/transform_oids.h
+./snmpget.lo: ../include/net-snmp/library/keytools.h
+./snmpget.lo: ../include/net-snmp/library/scapi.h
+./snmpget.lo: ../include/net-snmp/library/lcd_time.h
+./snmpget.lo: ../include/net-snmp/library/snmp_secmod.h
+./snmpget.lo: ../include/net-snmp/library/snmpv3-security-includes.h
+./snmpget.lo: ../include/net-snmp/library/snmpusm.h
+./snmpgetnext.lo: ../include/net-snmp/net-snmp-config.h
+./snmpgetnext.lo: ../include/net-snmp/system/linux.h
+./snmpgetnext.lo: ../include/net-snmp/system/sysv.h
+./snmpgetnext.lo: ../include/net-snmp/system/generic.h
+./snmpgetnext.lo: ../include/net-snmp/machine/generic.h 
+./snmpgetnext.lo: ../include/net-snmp/net-snmp-includes.h
+./snmpgetnext.lo: ../include/net-snmp/definitions.h
+./snmpgetnext.lo: ../include/net-snmp/types.h
+./snmpgetnext.lo: ../include/net-snmp/library/snmp_api.h
+./snmpgetnext.lo: ../include/net-snmp/library/asn1.h
+./snmpgetnext.lo: ../include/net-snmp/library/snmp_impl.h
+./snmpgetnext.lo: ../include/net-snmp/library/snmp.h
+./snmpgetnext.lo: ../include/net-snmp/library/snmp-tc.h
+./snmpgetnext.lo: ../include/net-snmp/utilities.h
+./snmpgetnext.lo: ../include/net-snmp/library/snmp_client.h
+./snmpgetnext.lo: ../include/net-snmp/library/getopt.h
+./snmpgetnext.lo: ../include/net-snmp/library/system.h
+./snmpgetnext.lo: ../include/net-snmp/library/tools.h
+./snmpgetnext.lo: ../include/net-snmp/library/int64.h
+./snmpgetnext.lo: ../include/net-snmp/library/mt_support.h
+./snmpgetnext.lo: ../include/net-snmp/library/snmp_alarm.h
+./snmpgetnext.lo: ../include/net-snmp/library/data_list.h
+./snmpgetnext.lo: ../include/net-snmp/library/callback.h
+./snmpgetnext.lo: ../include/net-snmp/library/oid_stash.h
+./snmpgetnext.lo: ../include/net-snmp/library/check_varbind.h
+./snmpgetnext.lo: ../include/net-snmp/version.h
+./snmpgetnext.lo: ../include/net-snmp/session_api.h
+./snmpgetnext.lo: ../include/net-snmp/library/snmp_transport.h
+./snmpgetnext.lo: ../include/net-snmp/library/snmpCallbackDomain.h
+./snmpgetnext.lo: ../include/net-snmp/library/snmpUnixDomain.h
+./snmpgetnext.lo: ../include/net-snmp/library/snmpUDPDomain.h
+./snmpgetnext.lo: ../include/net-snmp/library/snmpTCPDomain.h
+./snmpgetnext.lo: ../include/net-snmp/library/snmpUDPIPv6Domain.h
+./snmpgetnext.lo: ../include/net-snmp/library/snmpTCPIPv6Domain.h
+./snmpgetnext.lo: ../include/net-snmp/library/snmpIPXDomain.h
+./snmpgetnext.lo: ../include/net-snmp/library/ucd_compat.h
+./snmpgetnext.lo: ../include/net-snmp/pdu_api.h ../include/net-snmp/mib_api.h
+./snmpgetnext.lo: ../include/net-snmp/library/mib.h
+./snmpgetnext.lo: ../include/net-snmp/library/parse.h
+./snmpgetnext.lo: ../include/net-snmp/varbind_api.h
+./snmpgetnext.lo: ../include/net-snmp/config_api.h
+./snmpgetnext.lo: ../include/net-snmp/library/read_config.h
+./snmpgetnext.lo: ../include/net-snmp/library/default_store.h
+./snmpgetnext.lo: ../include/net-snmp/library/snmp_parse_args.h
+./snmpgetnext.lo: ../include/net-snmp/library/snmp_enum.h
+./snmpgetnext.lo: ../include/net-snmp/library/vacm.h
+./snmpgetnext.lo: ../include/net-snmp/output_api.h
+./snmpgetnext.lo: ../include/net-snmp/library/snmp_debug.h
+./snmpgetnext.lo: ../include/net-snmp/library/snmp_logging.h
+./snmpgetnext.lo: ../include/net-snmp/snmpv3_api.h
+./snmpgetnext.lo: ../include/net-snmp/library/snmpv3.h
+./snmpgetnext.lo: ../include/net-snmp/library/transform_oids.h
+./snmpgetnext.lo: ../include/net-snmp/library/keytools.h
+./snmpgetnext.lo: ../include/net-snmp/library/scapi.h
+./snmpgetnext.lo: ../include/net-snmp/library/lcd_time.h
+./snmpgetnext.lo: ../include/net-snmp/library/snmp_secmod.h
+./snmpgetnext.lo: ../include/net-snmp/library/snmpv3-security-includes.h
+./snmpgetnext.lo: ../include/net-snmp/library/snmpusm.h
+./snmpset.lo: ../include/net-snmp/net-snmp-config.h
+./snmpset.lo: ../include/net-snmp/system/linux.h
+./snmpset.lo: ../include/net-snmp/system/sysv.h
+./snmpset.lo: ../include/net-snmp/system/generic.h
+./snmpset.lo: ../include/net-snmp/machine/generic.h 
+./snmpset.lo: ../include/net-snmp/net-snmp-includes.h
+./snmpset.lo: ../include/net-snmp/definitions.h ../include/net-snmp/types.h
+./snmpset.lo: ../include/net-snmp/library/snmp_api.h
+./snmpset.lo: ../include/net-snmp/library/asn1.h
+./snmpset.lo: ../include/net-snmp/library/snmp_impl.h
+./snmpset.lo: ../include/net-snmp/library/snmp.h
+./snmpset.lo: ../include/net-snmp/library/snmp-tc.h
+./snmpset.lo: ../include/net-snmp/utilities.h
+./snmpset.lo: ../include/net-snmp/library/snmp_client.h
+./snmpset.lo: ../include/net-snmp/library/getopt.h
+./snmpset.lo: ../include/net-snmp/library/system.h
+./snmpset.lo: ../include/net-snmp/library/tools.h
+./snmpset.lo: ../include/net-snmp/library/int64.h
+./snmpset.lo: ../include/net-snmp/library/mt_support.h
+./snmpset.lo: ../include/net-snmp/library/snmp_alarm.h
+./snmpset.lo: ../include/net-snmp/library/data_list.h
+./snmpset.lo: ../include/net-snmp/library/callback.h
+./snmpset.lo: ../include/net-snmp/library/oid_stash.h
+./snmpset.lo: ../include/net-snmp/library/check_varbind.h
+./snmpset.lo: ../include/net-snmp/version.h ../include/net-snmp/session_api.h
+./snmpset.lo: ../include/net-snmp/library/snmp_transport.h
+./snmpset.lo: ../include/net-snmp/library/snmpCallbackDomain.h
+./snmpset.lo: ../include/net-snmp/library/snmpUnixDomain.h
+./snmpset.lo: ../include/net-snmp/library/snmpUDPDomain.h
+./snmpset.lo: ../include/net-snmp/library/snmpTCPDomain.h
+./snmpset.lo: ../include/net-snmp/library/snmpUDPIPv6Domain.h
+./snmpset.lo: ../include/net-snmp/library/snmpTCPIPv6Domain.h
+./snmpset.lo: ../include/net-snmp/library/snmpIPXDomain.h
+./snmpset.lo: ../include/net-snmp/library/ucd_compat.h
+./snmpset.lo: ../include/net-snmp/pdu_api.h ../include/net-snmp/mib_api.h
+./snmpset.lo: ../include/net-snmp/library/mib.h
+./snmpset.lo: ../include/net-snmp/library/parse.h
+./snmpset.lo: ../include/net-snmp/varbind_api.h
+./snmpset.lo: ../include/net-snmp/config_api.h
+./snmpset.lo: ../include/net-snmp/library/read_config.h
+./snmpset.lo: ../include/net-snmp/library/default_store.h
+./snmpset.lo: ../include/net-snmp/library/snmp_parse_args.h
+./snmpset.lo: ../include/net-snmp/library/snmp_enum.h
+./snmpset.lo: ../include/net-snmp/library/vacm.h
+./snmpset.lo: ../include/net-snmp/output_api.h
+./snmpset.lo: ../include/net-snmp/library/snmp_debug.h
+./snmpset.lo: ../include/net-snmp/library/snmp_logging.h
+./snmpset.lo: ../include/net-snmp/snmpv3_api.h
+./snmpset.lo: ../include/net-snmp/library/snmpv3.h
+./snmpset.lo: ../include/net-snmp/library/transform_oids.h
+./snmpset.lo: ../include/net-snmp/library/keytools.h
+./snmpset.lo: ../include/net-snmp/library/scapi.h
+./snmpset.lo: ../include/net-snmp/library/lcd_time.h
+./snmpset.lo: ../include/net-snmp/library/snmp_secmod.h
+./snmpset.lo: ../include/net-snmp/library/snmpv3-security-includes.h
+./snmpset.lo: ../include/net-snmp/library/snmpusm.h
+./snmpstatus.lo: ../include/net-snmp/net-snmp-config.h
+./snmpstatus.lo: ../include/net-snmp/system/linux.h
+./snmpstatus.lo: ../include/net-snmp/system/sysv.h
+./snmpstatus.lo: ../include/net-snmp/system/generic.h
+./snmpstatus.lo: ../include/net-snmp/machine/generic.h 
+./snmpstatus.lo: ../include/net-snmp/utilities.h ../include/net-snmp/types.h
+./snmpstatus.lo: ../include/net-snmp/definitions.h
+./snmpstatus.lo: ../include/net-snmp/library/snmp_api.h
+./snmpstatus.lo: ../include/net-snmp/library/asn1.h
+./snmpstatus.lo: ../include/net-snmp/library/snmp_impl.h
+./snmpstatus.lo: ../include/net-snmp/library/snmp.h
+./snmpstatus.lo: ../include/net-snmp/library/snmp-tc.h
+./snmpstatus.lo: ../include/net-snmp/library/snmp_client.h
+./snmpstatus.lo: ../include/net-snmp/library/getopt.h
+./snmpstatus.lo: ../include/net-snmp/library/system.h
+./snmpstatus.lo: ../include/net-snmp/library/tools.h
+./snmpstatus.lo: ../include/net-snmp/library/int64.h
+./snmpstatus.lo: ../include/net-snmp/library/mt_support.h
+./snmpstatus.lo: ../include/net-snmp/library/snmp_alarm.h
+./snmpstatus.lo: ../include/net-snmp/library/data_list.h
+./snmpstatus.lo: ../include/net-snmp/library/callback.h
+./snmpstatus.lo: ../include/net-snmp/library/oid_stash.h
+./snmpstatus.lo: ../include/net-snmp/library/check_varbind.h
+./snmpstatus.lo: ../include/net-snmp/version.h
+./snmpstatus.lo: ../include/net-snmp/net-snmp-includes.h
+./snmpstatus.lo: ../include/net-snmp/session_api.h
+./snmpstatus.lo: ../include/net-snmp/library/snmp_transport.h
+./snmpstatus.lo: ../include/net-snmp/library/snmpCallbackDomain.h
+./snmpstatus.lo: ../include/net-snmp/library/snmpUnixDomain.h
+./snmpstatus.lo: ../include/net-snmp/library/snmpUDPDomain.h
+./snmpstatus.lo: ../include/net-snmp/library/snmpTCPDomain.h
+./snmpstatus.lo: ../include/net-snmp/library/snmpUDPIPv6Domain.h
+./snmpstatus.lo: ../include/net-snmp/library/snmpTCPIPv6Domain.h
+./snmpstatus.lo: ../include/net-snmp/library/snmpIPXDomain.h
+./snmpstatus.lo: ../include/net-snmp/library/ucd_compat.h
+./snmpstatus.lo: ../include/net-snmp/pdu_api.h ../include/net-snmp/mib_api.h
+./snmpstatus.lo: ../include/net-snmp/library/mib.h
+./snmpstatus.lo: ../include/net-snmp/library/parse.h
+./snmpstatus.lo: ../include/net-snmp/varbind_api.h
+./snmpstatus.lo: ../include/net-snmp/config_api.h
+./snmpstatus.lo: ../include/net-snmp/library/read_config.h
+./snmpstatus.lo: ../include/net-snmp/library/default_store.h
+./snmpstatus.lo: ../include/net-snmp/library/snmp_parse_args.h
+./snmpstatus.lo: ../include/net-snmp/library/snmp_enum.h
+./snmpstatus.lo: ../include/net-snmp/library/vacm.h
+./snmpstatus.lo: ../include/net-snmp/output_api.h
+./snmpstatus.lo: ../include/net-snmp/library/snmp_debug.h
+./snmpstatus.lo: ../include/net-snmp/library/snmp_logging.h
+./snmpstatus.lo: ../include/net-snmp/snmpv3_api.h
+./snmpstatus.lo: ../include/net-snmp/library/snmpv3.h
+./snmpstatus.lo: ../include/net-snmp/library/transform_oids.h
+./snmpstatus.lo: ../include/net-snmp/library/keytools.h
+./snmpstatus.lo: ../include/net-snmp/library/scapi.h
+./snmpstatus.lo: ../include/net-snmp/library/lcd_time.h
+./snmpstatus.lo: ../include/net-snmp/library/snmp_secmod.h
+./snmpstatus.lo: ../include/net-snmp/library/snmpv3-security-includes.h
+./snmpstatus.lo: ../include/net-snmp/library/snmpusm.h
+./snmptable.lo: ../include/net-snmp/net-snmp-config.h
+./snmptable.lo: ../include/net-snmp/system/linux.h
+./snmptable.lo: ../include/net-snmp/system/sysv.h
+./snmptable.lo: ../include/net-snmp/system/generic.h
+./snmptable.lo: ../include/net-snmp/machine/generic.h 
+./snmptable.lo: ../include/net-snmp/net-snmp-includes.h
+./snmptable.lo: ../include/net-snmp/definitions.h ../include/net-snmp/types.h
+./snmptable.lo: ../include/net-snmp/library/snmp_api.h
+./snmptable.lo: ../include/net-snmp/library/asn1.h
+./snmptable.lo: ../include/net-snmp/library/snmp_impl.h
+./snmptable.lo: ../include/net-snmp/library/snmp.h
+./snmptable.lo: ../include/net-snmp/library/snmp-tc.h
+./snmptable.lo: ../include/net-snmp/utilities.h
+./snmptable.lo: ../include/net-snmp/library/snmp_client.h
+./snmptable.lo: ../include/net-snmp/library/getopt.h
+./snmptable.lo: ../include/net-snmp/library/system.h
+./snmptable.lo: ../include/net-snmp/library/tools.h
+./snmptable.lo: ../include/net-snmp/library/int64.h
+./snmptable.lo: ../include/net-snmp/library/mt_support.h
+./snmptable.lo: ../include/net-snmp/library/snmp_alarm.h
+./snmptable.lo: ../include/net-snmp/library/data_list.h
+./snmptable.lo: ../include/net-snmp/library/callback.h
+./snmptable.lo: ../include/net-snmp/library/oid_stash.h
+./snmptable.lo: ../include/net-snmp/library/check_varbind.h
+./snmptable.lo: ../include/net-snmp/version.h
+./snmptable.lo: ../include/net-snmp/session_api.h
+./snmptable.lo: ../include/net-snmp/library/snmp_transport.h
+./snmptable.lo: ../include/net-snmp/library/snmpCallbackDomain.h
+./snmptable.lo: ../include/net-snmp/library/snmpUnixDomain.h
+./snmptable.lo: ../include/net-snmp/library/snmpUDPDomain.h
+./snmptable.lo: ../include/net-snmp/library/snmpTCPDomain.h
+./snmptable.lo: ../include/net-snmp/library/snmpUDPIPv6Domain.h
+./snmptable.lo: ../include/net-snmp/library/snmpTCPIPv6Domain.h
+./snmptable.lo: ../include/net-snmp/library/snmpIPXDomain.h
+./snmptable.lo: ../include/net-snmp/library/ucd_compat.h
+./snmptable.lo: ../include/net-snmp/pdu_api.h ../include/net-snmp/mib_api.h
+./snmptable.lo: ../include/net-snmp/library/mib.h
+./snmptable.lo: ../include/net-snmp/library/parse.h
+./snmptable.lo: ../include/net-snmp/varbind_api.h
+./snmptable.lo: ../include/net-snmp/config_api.h
+./snmptable.lo: ../include/net-snmp/library/read_config.h
+./snmptable.lo: ../include/net-snmp/library/default_store.h
+./snmptable.lo: ../include/net-snmp/library/snmp_parse_args.h
+./snmptable.lo: ../include/net-snmp/library/snmp_enum.h
+./snmptable.lo: ../include/net-snmp/library/vacm.h
+./snmptable.lo: ../include/net-snmp/output_api.h
+./snmptable.lo: ../include/net-snmp/library/snmp_debug.h
+./snmptable.lo: ../include/net-snmp/library/snmp_logging.h
+./snmptable.lo: ../include/net-snmp/snmpv3_api.h
+./snmptable.lo: ../include/net-snmp/library/snmpv3.h
+./snmptable.lo: ../include/net-snmp/library/transform_oids.h
+./snmptable.lo: ../include/net-snmp/library/keytools.h
+./snmptable.lo: ../include/net-snmp/library/scapi.h
+./snmptable.lo: ../include/net-snmp/library/lcd_time.h
+./snmptable.lo: ../include/net-snmp/library/snmp_secmod.h
+./snmptable.lo: ../include/net-snmp/library/snmpv3-security-includes.h
+./snmptable.lo: ../include/net-snmp/library/snmpusm.h
+./snmptest.lo: ../include/net-snmp/net-snmp-config.h
+./snmptest.lo: ../include/net-snmp/system/linux.h
+./snmptest.lo: ../include/net-snmp/system/sysv.h
+./snmptest.lo: ../include/net-snmp/system/generic.h
+./snmptest.lo: ../include/net-snmp/machine/generic.h 
+./snmptest.lo: ../include/net-snmp/net-snmp-includes.h
+./snmptest.lo: ../include/net-snmp/definitions.h ../include/net-snmp/types.h
+./snmptest.lo: ../include/net-snmp/library/snmp_api.h
+./snmptest.lo: ../include/net-snmp/library/asn1.h
+./snmptest.lo: ../include/net-snmp/library/snmp_impl.h
+./snmptest.lo: ../include/net-snmp/library/snmp.h
+./snmptest.lo: ../include/net-snmp/library/snmp-tc.h
+./snmptest.lo: ../include/net-snmp/utilities.h
+./snmptest.lo: ../include/net-snmp/library/snmp_client.h
+./snmptest.lo: ../include/net-snmp/library/getopt.h
+./snmptest.lo: ../include/net-snmp/library/system.h
+./snmptest.lo: ../include/net-snmp/library/tools.h
+./snmptest.lo: ../include/net-snmp/library/int64.h
+./snmptest.lo: ../include/net-snmp/library/mt_support.h
+./snmptest.lo: ../include/net-snmp/library/snmp_alarm.h
+./snmptest.lo: ../include/net-snmp/library/data_list.h
+./snmptest.lo: ../include/net-snmp/library/callback.h
+./snmptest.lo: ../include/net-snmp/library/oid_stash.h
+./snmptest.lo: ../include/net-snmp/library/check_varbind.h
+./snmptest.lo: ../include/net-snmp/version.h
+./snmptest.lo: ../include/net-snmp/session_api.h
+./snmptest.lo: ../include/net-snmp/library/snmp_transport.h
+./snmptest.lo: ../include/net-snmp/library/snmpCallbackDomain.h
+./snmptest.lo: ../include/net-snmp/library/snmpUnixDomain.h
+./snmptest.lo: ../include/net-snmp/library/snmpUDPDomain.h
+./snmptest.lo: ../include/net-snmp/library/snmpTCPDomain.h
+./snmptest.lo: ../include/net-snmp/library/snmpUDPIPv6Domain.h
+./snmptest.lo: ../include/net-snmp/library/snmpTCPIPv6Domain.h
+./snmptest.lo: ../include/net-snmp/library/snmpIPXDomain.h
+./snmptest.lo: ../include/net-snmp/library/ucd_compat.h
+./snmptest.lo: ../include/net-snmp/pdu_api.h ../include/net-snmp/mib_api.h
+./snmptest.lo: ../include/net-snmp/library/mib.h
+./snmptest.lo: ../include/net-snmp/library/parse.h
+./snmptest.lo: ../include/net-snmp/varbind_api.h
+./snmptest.lo: ../include/net-snmp/config_api.h
+./snmptest.lo: ../include/net-snmp/library/read_config.h
+./snmptest.lo: ../include/net-snmp/library/default_store.h
+./snmptest.lo: ../include/net-snmp/library/snmp_parse_args.h
+./snmptest.lo: ../include/net-snmp/library/snmp_enum.h
+./snmptest.lo: ../include/net-snmp/library/vacm.h
+./snmptest.lo: ../include/net-snmp/output_api.h
+./snmptest.lo: ../include/net-snmp/library/snmp_debug.h
+./snmptest.lo: ../include/net-snmp/library/snmp_logging.h
+./snmptest.lo: ../include/net-snmp/snmpv3_api.h
+./snmptest.lo: ../include/net-snmp/library/snmpv3.h
+./snmptest.lo: ../include/net-snmp/library/transform_oids.h
+./snmptest.lo: ../include/net-snmp/library/keytools.h
+./snmptest.lo: ../include/net-snmp/library/scapi.h
+./snmptest.lo: ../include/net-snmp/library/lcd_time.h
+./snmptest.lo: ../include/net-snmp/library/snmp_secmod.h
+./snmptest.lo: ../include/net-snmp/library/snmpv3-security-includes.h
+./snmptest.lo: ../include/net-snmp/library/snmpusm.h
+./snmptranslate.lo: ../include/net-snmp/net-snmp-config.h
+./snmptranslate.lo: ../include/net-snmp/system/linux.h
+./snmptranslate.lo: ../include/net-snmp/system/sysv.h
+./snmptranslate.lo: ../include/net-snmp/system/generic.h
+./snmptranslate.lo: ../include/net-snmp/machine/generic.h
+./snmptranslate.lo: ../include/net-snmp/utilities.h
+./snmptranslate.lo: ../include/net-snmp/types.h 
+./snmptranslate.lo: ../include/net-snmp/definitions.h
+./snmptranslate.lo: ../include/net-snmp/library/snmp_api.h
+./snmptranslate.lo: ../include/net-snmp/library/asn1.h
+./snmptranslate.lo: ../include/net-snmp/library/snmp_impl.h
+./snmptranslate.lo: ../include/net-snmp/library/snmp.h
+./snmptranslate.lo: ../include/net-snmp/library/snmp-tc.h
+./snmptranslate.lo: ../include/net-snmp/library/snmp_client.h
+./snmptranslate.lo: ../include/net-snmp/library/getopt.h
+./snmptranslate.lo: ../include/net-snmp/library/system.h
+./snmptranslate.lo: ../include/net-snmp/library/tools.h
+./snmptranslate.lo: ../include/net-snmp/library/int64.h
+./snmptranslate.lo: ../include/net-snmp/library/mt_support.h
+./snmptranslate.lo: ../include/net-snmp/library/snmp_alarm.h
+./snmptranslate.lo: ../include/net-snmp/library/data_list.h
+./snmptranslate.lo: ../include/net-snmp/library/callback.h
+./snmptranslate.lo: ../include/net-snmp/library/oid_stash.h
+./snmptranslate.lo: ../include/net-snmp/library/check_varbind.h
+./snmptranslate.lo: ../include/net-snmp/version.h
+./snmptranslate.lo: ../include/net-snmp/config_api.h
+./snmptranslate.lo: ../include/net-snmp/library/read_config.h
+./snmptranslate.lo: ../include/net-snmp/library/default_store.h
+./snmptranslate.lo: ../include/net-snmp/library/snmp_parse_args.h
+./snmptranslate.lo: ../include/net-snmp/library/snmp_enum.h
+./snmptranslate.lo: ../include/net-snmp/library/vacm.h
+./snmptranslate.lo: ../include/net-snmp/output_api.h
+./snmptranslate.lo: ../include/net-snmp/library/snmp_debug.h
+./snmptranslate.lo: ../include/net-snmp/library/snmp_logging.h
+./snmptranslate.lo: ../include/net-snmp/mib_api.h
+./snmptranslate.lo: ../include/net-snmp/library/mib.h
+./snmptranslate.lo: ../include/net-snmp/library/parse.h
+./snmptranslate.lo: ../include/net-snmp/library/ucd_compat.h
+./snmptrap.lo: ../include/net-snmp/net-snmp-config.h
+./snmptrap.lo: ../include/net-snmp/system/linux.h
+./snmptrap.lo: ../include/net-snmp/system/sysv.h
+./snmptrap.lo: ../include/net-snmp/system/generic.h
+./snmptrap.lo: ../include/net-snmp/machine/generic.h 
+./snmptrap.lo: ../include/net-snmp/net-snmp-includes.h
+./snmptrap.lo: ../include/net-snmp/definitions.h ../include/net-snmp/types.h
+./snmptrap.lo: ../include/net-snmp/library/snmp_api.h
+./snmptrap.lo: ../include/net-snmp/library/asn1.h
+./snmptrap.lo: ../include/net-snmp/library/snmp_impl.h
+./snmptrap.lo: ../include/net-snmp/library/snmp.h
+./snmptrap.lo: ../include/net-snmp/library/snmp-tc.h
+./snmptrap.lo: ../include/net-snmp/utilities.h
+./snmptrap.lo: ../include/net-snmp/library/snmp_client.h
+./snmptrap.lo: ../include/net-snmp/library/getopt.h
+./snmptrap.lo: ../include/net-snmp/library/system.h
+./snmptrap.lo: ../include/net-snmp/library/tools.h
+./snmptrap.lo: ../include/net-snmp/library/int64.h
+./snmptrap.lo: ../include/net-snmp/library/mt_support.h
+./snmptrap.lo: ../include/net-snmp/library/snmp_alarm.h
+./snmptrap.lo: ../include/net-snmp/library/data_list.h
+./snmptrap.lo: ../include/net-snmp/library/callback.h
+./snmptrap.lo: ../include/net-snmp/library/oid_stash.h
+./snmptrap.lo: ../include/net-snmp/library/check_varbind.h
+./snmptrap.lo: ../include/net-snmp/version.h
+./snmptrap.lo: ../include/net-snmp/session_api.h
+./snmptrap.lo: ../include/net-snmp/library/snmp_transport.h
+./snmptrap.lo: ../include/net-snmp/library/snmpCallbackDomain.h
+./snmptrap.lo: ../include/net-snmp/library/snmpUnixDomain.h
+./snmptrap.lo: ../include/net-snmp/library/snmpUDPDomain.h
+./snmptrap.lo: ../include/net-snmp/library/snmpTCPDomain.h
+./snmptrap.lo: ../include/net-snmp/library/snmpUDPIPv6Domain.h
+./snmptrap.lo: ../include/net-snmp/library/snmpTCPIPv6Domain.h
+./snmptrap.lo: ../include/net-snmp/library/snmpIPXDomain.h
+./snmptrap.lo: ../include/net-snmp/library/ucd_compat.h
+./snmptrap.lo: ../include/net-snmp/pdu_api.h ../include/net-snmp/mib_api.h
+./snmptrap.lo: ../include/net-snmp/library/mib.h
+./snmptrap.lo: ../include/net-snmp/library/parse.h
+./snmptrap.lo: ../include/net-snmp/varbind_api.h
+./snmptrap.lo: ../include/net-snmp/config_api.h
+./snmptrap.lo: ../include/net-snmp/library/read_config.h
+./snmptrap.lo: ../include/net-snmp/library/default_store.h
+./snmptrap.lo: ../include/net-snmp/library/snmp_parse_args.h
+./snmptrap.lo: ../include/net-snmp/library/snmp_enum.h
+./snmptrap.lo: ../include/net-snmp/library/vacm.h
+./snmptrap.lo: ../include/net-snmp/output_api.h
+./snmptrap.lo: ../include/net-snmp/library/snmp_debug.h
+./snmptrap.lo: ../include/net-snmp/library/snmp_logging.h
+./snmptrap.lo: ../include/net-snmp/snmpv3_api.h
+./snmptrap.lo: ../include/net-snmp/library/snmpv3.h
+./snmptrap.lo: ../include/net-snmp/library/transform_oids.h
+./snmptrap.lo: ../include/net-snmp/library/keytools.h
+./snmptrap.lo: ../include/net-snmp/library/scapi.h
+./snmptrap.lo: ../include/net-snmp/library/lcd_time.h
+./snmptrap.lo: ../include/net-snmp/library/snmp_secmod.h
+./snmptrap.lo: ../include/net-snmp/library/snmpv3-security-includes.h
+./snmptrap.lo: ../include/net-snmp/library/snmpusm.h
+./snmptrapd.lo: ../include/net-snmp/net-snmp-config.h
+./snmptrapd.lo: ../include/net-snmp/system/linux.h
+./snmptrapd.lo: ../include/net-snmp/system/sysv.h
+./snmptrapd.lo: ../include/net-snmp/system/generic.h
+./snmptrapd.lo: ../include/net-snmp/machine/generic.h 
+./snmptrapd.lo: ../include/net-snmp/net-snmp-includes.h
+./snmptrapd.lo: ../include/net-snmp/definitions.h ../include/net-snmp/types.h
+./snmptrapd.lo: ../include/net-snmp/library/snmp_api.h
+./snmptrapd.lo: ../include/net-snmp/library/asn1.h
+./snmptrapd.lo: ../include/net-snmp/library/snmp_impl.h
+./snmptrapd.lo: ../include/net-snmp/library/snmp.h
+./snmptrapd.lo: ../include/net-snmp/library/snmp-tc.h
+./snmptrapd.lo: ../include/net-snmp/utilities.h
+./snmptrapd.lo: ../include/net-snmp/library/snmp_client.h
+./snmptrapd.lo: ../include/net-snmp/library/getopt.h
+./snmptrapd.lo: ../include/net-snmp/library/system.h
+./snmptrapd.lo: ../include/net-snmp/library/tools.h
+./snmptrapd.lo: ../include/net-snmp/library/int64.h
+./snmptrapd.lo: ../include/net-snmp/library/mt_support.h
+./snmptrapd.lo: ../include/net-snmp/library/snmp_alarm.h
+./snmptrapd.lo: ../include/net-snmp/library/data_list.h
+./snmptrapd.lo: ../include/net-snmp/library/callback.h
+./snmptrapd.lo: ../include/net-snmp/library/oid_stash.h
+./snmptrapd.lo: ../include/net-snmp/library/check_varbind.h
+./snmptrapd.lo: ../include/net-snmp/version.h
+./snmptrapd.lo: ../include/net-snmp/session_api.h
+./snmptrapd.lo: ../include/net-snmp/library/snmp_transport.h
+./snmptrapd.lo: ../include/net-snmp/library/snmpCallbackDomain.h
+./snmptrapd.lo: ../include/net-snmp/library/snmpUnixDomain.h
+./snmptrapd.lo: ../include/net-snmp/library/snmpUDPDomain.h
+./snmptrapd.lo: ../include/net-snmp/library/snmpTCPDomain.h
+./snmptrapd.lo: ../include/net-snmp/library/snmpUDPIPv6Domain.h
+./snmptrapd.lo: ../include/net-snmp/library/snmpTCPIPv6Domain.h
+./snmptrapd.lo: ../include/net-snmp/library/snmpIPXDomain.h
+./snmptrapd.lo: ../include/net-snmp/library/ucd_compat.h
+./snmptrapd.lo: ../include/net-snmp/pdu_api.h ../include/net-snmp/mib_api.h
+./snmptrapd.lo: ../include/net-snmp/library/mib.h
+./snmptrapd.lo: ../include/net-snmp/library/parse.h
+./snmptrapd.lo: ../include/net-snmp/varbind_api.h
+./snmptrapd.lo: ../include/net-snmp/config_api.h
+./snmptrapd.lo: ../include/net-snmp/library/read_config.h
+./snmptrapd.lo: ../include/net-snmp/library/default_store.h
+./snmptrapd.lo: ../include/net-snmp/library/snmp_parse_args.h
+./snmptrapd.lo: ../include/net-snmp/library/snmp_enum.h
+./snmptrapd.lo: ../include/net-snmp/library/vacm.h
+./snmptrapd.lo: ../include/net-snmp/output_api.h
+./snmptrapd.lo: ../include/net-snmp/library/snmp_debug.h
+./snmptrapd.lo: ../include/net-snmp/library/snmp_logging.h
+./snmptrapd.lo: ../include/net-snmp/snmpv3_api.h
+./snmptrapd.lo: ../include/net-snmp/library/snmpv3.h
+./snmptrapd.lo: ../include/net-snmp/library/transform_oids.h
+./snmptrapd.lo: ../include/net-snmp/library/keytools.h
+./snmptrapd.lo: ../include/net-snmp/library/scapi.h
+./snmptrapd.lo: ../include/net-snmp/library/lcd_time.h
+./snmptrapd.lo: ../include/net-snmp/library/snmp_secmod.h
+./snmptrapd.lo: ../include/net-snmp/library/snmpv3-security-includes.h
+./snmptrapd.lo: ../include/net-snmp/library/snmpusm.h
+./snmptrapd.lo: ../include/net-snmp/agent/net-snmp-agent-includes.h
+./snmptrapd.lo: ../include/net-snmp/agent/snmp_agent.h
+./snmptrapd.lo: ../include/net-snmp/agent/snmp_vars.h
+./snmptrapd.lo: ../include/net-snmp/agent/agent_handler.h
+./snmptrapd.lo: ../include/net-snmp/agent/var_struct.h
+./snmptrapd.lo: ../include/net-snmp/agent/agent_registry.h
+./snmptrapd.lo: ../include/net-snmp/agent/ds_agent.h
+./snmptrapd.lo: ../include/net-snmp/agent/agent_read_config.h
+./snmptrapd.lo: ../include/net-snmp/agent/agent_trap.h
+./snmptrapd.lo: ../include/net-snmp/agent/all_helpers.h
+./snmptrapd.lo: ../include/net-snmp/agent/instance.h
+./snmptrapd.lo: ../include/net-snmp/agent/multiplexer.h
+./snmptrapd.lo: ../include/net-snmp/agent/null.h
+./snmptrapd.lo: ../include/net-snmp/agent/debug_handler.h
+./snmptrapd.lo: ../include/net-snmp/agent/old_api.h
+./snmptrapd.lo: ../include/net-snmp/agent/read_only.h
+./snmptrapd.lo: ../include/net-snmp/agent/serialize.h
+./snmptrapd.lo: ../include/net-snmp/agent/bulk_to_next.h
+./snmptrapd.lo: ../include/net-snmp/agent/mode_end_call.h
+./snmptrapd.lo: ../include/net-snmp/agent/table.h
+./snmptrapd.lo: ../include/net-snmp/agent/table_data.h
+./snmptrapd.lo: ../include/net-snmp/agent/table_dataset.h
+./snmptrapd.lo: ../include/net-snmp/agent/table_iterator.h
+./snmptrapd.lo: ../include/net-snmp/agent/mib_module_config.h
+./snmptrapd.lo: snmptrapd_handlers.h snmptrapd_log.h notification_log.h
+./snmptrapd_handlers.lo: ../include/net-snmp/net-snmp-config.h
+./snmptrapd_handlers.lo: ../include/net-snmp/system/linux.h
+./snmptrapd_handlers.lo: ../include/net-snmp/system/sysv.h
+./snmptrapd_handlers.lo: ../include/net-snmp/system/generic.h
+./snmptrapd_handlers.lo: ../include/net-snmp/machine/generic.h
+./snmptrapd_handlers.lo: ../include/net-snmp/config_api.h
+./snmptrapd_handlers.lo: ../include/net-snmp/types.h 
+./snmptrapd_handlers.lo: ../include/net-snmp/definitions.h
+./snmptrapd_handlers.lo: ../include/net-snmp/library/snmp_api.h
+./snmptrapd_handlers.lo: ../include/net-snmp/library/asn1.h
+./snmptrapd_handlers.lo: ../include/net-snmp/library/snmp_impl.h
+./snmptrapd_handlers.lo: ../include/net-snmp/library/snmp.h
+./snmptrapd_handlers.lo: ../include/net-snmp/library/snmp-tc.h
+./snmptrapd_handlers.lo: ../include/net-snmp/library/read_config.h
+./snmptrapd_handlers.lo: ../include/net-snmp/library/default_store.h
+./snmptrapd_handlers.lo: ../include/net-snmp/library/snmp_parse_args.h
+./snmptrapd_handlers.lo: ../include/net-snmp/library/snmp_enum.h
+./snmptrapd_handlers.lo: ../include/net-snmp/library/vacm.h
+./snmptrapd_handlers.lo: ../include/net-snmp/output_api.h
+./snmptrapd_handlers.lo: ../include/net-snmp/library/snmp_client.h
+./snmptrapd_handlers.lo: ../include/net-snmp/library/snmp_debug.h
+./snmptrapd_handlers.lo: ../include/net-snmp/library/snmp_logging.h
+./snmptrapd_handlers.lo: ../include/net-snmp/mib_api.h
+./snmptrapd_handlers.lo: ../include/net-snmp/library/mib.h
+./snmptrapd_handlers.lo: ../include/net-snmp/library/parse.h
+./snmptrapd_handlers.lo: ../include/net-snmp/library/callback.h
+./snmptrapd_handlers.lo: ../include/net-snmp/library/oid_stash.h
+./snmptrapd_handlers.lo: ../include/net-snmp/library/ucd_compat.h
+./snmptrapd_handlers.lo: ../include/net-snmp/utilities.h
+./snmptrapd_handlers.lo: ../include/net-snmp/library/getopt.h
+./snmptrapd_handlers.lo: ../include/net-snmp/library/system.h
+./snmptrapd_handlers.lo: ../include/net-snmp/library/tools.h
+./snmptrapd_handlers.lo: ../include/net-snmp/library/int64.h
+./snmptrapd_handlers.lo: ../include/net-snmp/library/mt_support.h
+./snmptrapd_handlers.lo: ../include/net-snmp/library/snmp_alarm.h
+./snmptrapd_handlers.lo: ../include/net-snmp/library/data_list.h
+./snmptrapd_handlers.lo: ../include/net-snmp/library/check_varbind.h
+./snmptrapd_handlers.lo: ../include/net-snmp/version.h
+./snmptrapd_log.lo: ../include/net-snmp/net-snmp-config.h
+./snmptrapd_log.lo: ../include/net-snmp/system/linux.h
+./snmptrapd_log.lo: ../include/net-snmp/system/sysv.h
+./snmptrapd_log.lo: ../include/net-snmp/system/generic.h
+./snmptrapd_log.lo: ../include/net-snmp/machine/generic.h
+./snmptrapd_log.lo: ../include/net-snmp/net-snmp-includes.h
+./snmptrapd_log.lo: ../include/net-snmp/definitions.h
+./snmptrapd_log.lo: ../include/net-snmp/types.h
+./snmptrapd_log.lo: ../include/net-snmp/library/snmp_api.h
+./snmptrapd_log.lo: ../include/net-snmp/library/asn1.h
+./snmptrapd_log.lo: ../include/net-snmp/library/snmp_impl.h
+./snmptrapd_log.lo: ../include/net-snmp/library/snmp.h
+./snmptrapd_log.lo: ../include/net-snmp/library/snmp-tc.h
+./snmptrapd_log.lo: ../include/net-snmp/utilities.h
+./snmptrapd_log.lo: ../include/net-snmp/library/snmp_client.h
+./snmptrapd_log.lo: ../include/net-snmp/library/getopt.h
+./snmptrapd_log.lo: ../include/net-snmp/library/system.h
+./snmptrapd_log.lo: ../include/net-snmp/library/tools.h
+./snmptrapd_log.lo: ../include/net-snmp/library/int64.h
+./snmptrapd_log.lo: ../include/net-snmp/library/mt_support.h
+./snmptrapd_log.lo: ../include/net-snmp/library/snmp_alarm.h
+./snmptrapd_log.lo: ../include/net-snmp/library/data_list.h
+./snmptrapd_log.lo: ../include/net-snmp/library/callback.h
+./snmptrapd_log.lo: ../include/net-snmp/library/oid_stash.h
+./snmptrapd_log.lo: ../include/net-snmp/library/check_varbind.h
+./snmptrapd_log.lo: ../include/net-snmp/version.h
+./snmptrapd_log.lo: ../include/net-snmp/session_api.h
+./snmptrapd_log.lo: ../include/net-snmp/library/snmp_transport.h
+./snmptrapd_log.lo: ../include/net-snmp/library/snmpCallbackDomain.h
+./snmptrapd_log.lo: ../include/net-snmp/library/snmpUnixDomain.h
+./snmptrapd_log.lo: ../include/net-snmp/library/snmpUDPDomain.h
+./snmptrapd_log.lo: ../include/net-snmp/library/snmpTCPDomain.h
+./snmptrapd_log.lo: ../include/net-snmp/library/snmpUDPIPv6Domain.h
+./snmptrapd_log.lo: ../include/net-snmp/library/snmpTCPIPv6Domain.h
+./snmptrapd_log.lo: ../include/net-snmp/library/snmpIPXDomain.h
+./snmptrapd_log.lo: ../include/net-snmp/library/ucd_compat.h
+./snmptrapd_log.lo: ../include/net-snmp/pdu_api.h
+./snmptrapd_log.lo: ../include/net-snmp/mib_api.h
+./snmptrapd_log.lo: ../include/net-snmp/library/mib.h
+./snmptrapd_log.lo: ../include/net-snmp/library/parse.h
+./snmptrapd_log.lo: ../include/net-snmp/varbind_api.h
+./snmptrapd_log.lo: ../include/net-snmp/config_api.h
+./snmptrapd_log.lo: ../include/net-snmp/library/read_config.h
+./snmptrapd_log.lo: ../include/net-snmp/library/default_store.h
+./snmptrapd_log.lo: ../include/net-snmp/library/snmp_parse_args.h
+./snmptrapd_log.lo: ../include/net-snmp/library/snmp_enum.h
+./snmptrapd_log.lo: ../include/net-snmp/library/vacm.h
+./snmptrapd_log.lo: ../include/net-snmp/output_api.h
+./snmptrapd_log.lo: ../include/net-snmp/library/snmp_debug.h
+./snmptrapd_log.lo: ../include/net-snmp/library/snmp_logging.h
+./snmptrapd_log.lo: ../include/net-snmp/snmpv3_api.h
+./snmptrapd_log.lo: ../include/net-snmp/library/snmpv3.h
+./snmptrapd_log.lo: ../include/net-snmp/library/transform_oids.h
+./snmptrapd_log.lo: ../include/net-snmp/library/keytools.h
+./snmptrapd_log.lo: ../include/net-snmp/library/scapi.h
+./snmptrapd_log.lo: ../include/net-snmp/library/lcd_time.h
+./snmptrapd_log.lo: ../include/net-snmp/library/snmp_secmod.h
+./snmptrapd_log.lo: ../include/net-snmp/library/snmpv3-security-includes.h
+./snmptrapd_log.lo: ../include/net-snmp/library/snmpusm.h snmptrapd_log.h
+./snmpusm.lo: ../include/net-snmp/net-snmp-config.h
+./snmpusm.lo: ../include/net-snmp/system/linux.h
+./snmpusm.lo: ../include/net-snmp/system/sysv.h
+./snmpusm.lo: ../include/net-snmp/system/generic.h
+./snmpusm.lo: ../include/net-snmp/machine/generic.h 
+./snmpusm.lo: ../include/net-snmp/net-snmp-includes.h
+./snmpusm.lo: ../include/net-snmp/definitions.h ../include/net-snmp/types.h
+./snmpusm.lo: ../include/net-snmp/library/snmp_api.h
+./snmpusm.lo: ../include/net-snmp/library/asn1.h
+./snmpusm.lo: ../include/net-snmp/library/snmp_impl.h
+./snmpusm.lo: ../include/net-snmp/library/snmp.h
+./snmpusm.lo: ../include/net-snmp/library/snmp-tc.h
+./snmpusm.lo: ../include/net-snmp/utilities.h
+./snmpusm.lo: ../include/net-snmp/library/snmp_client.h
+./snmpusm.lo: ../include/net-snmp/library/getopt.h
+./snmpusm.lo: ../include/net-snmp/library/system.h
+./snmpusm.lo: ../include/net-snmp/library/tools.h
+./snmpusm.lo: ../include/net-snmp/library/int64.h
+./snmpusm.lo: ../include/net-snmp/library/mt_support.h
+./snmpusm.lo: ../include/net-snmp/library/snmp_alarm.h
+./snmpusm.lo: ../include/net-snmp/library/data_list.h
+./snmpusm.lo: ../include/net-snmp/library/callback.h
+./snmpusm.lo: ../include/net-snmp/library/oid_stash.h
+./snmpusm.lo: ../include/net-snmp/library/check_varbind.h
+./snmpusm.lo: ../include/net-snmp/version.h ../include/net-snmp/session_api.h
+./snmpusm.lo: ../include/net-snmp/library/snmp_transport.h
+./snmpusm.lo: ../include/net-snmp/library/snmpCallbackDomain.h
+./snmpusm.lo: ../include/net-snmp/library/snmpUnixDomain.h
+./snmpusm.lo: ../include/net-snmp/library/snmpUDPDomain.h
+./snmpusm.lo: ../include/net-snmp/library/snmpTCPDomain.h
+./snmpusm.lo: ../include/net-snmp/library/snmpUDPIPv6Domain.h
+./snmpusm.lo: ../include/net-snmp/library/snmpTCPIPv6Domain.h
+./snmpusm.lo: ../include/net-snmp/library/snmpIPXDomain.h
+./snmpusm.lo: ../include/net-snmp/library/ucd_compat.h
+./snmpusm.lo: ../include/net-snmp/pdu_api.h ../include/net-snmp/mib_api.h
+./snmpusm.lo: ../include/net-snmp/library/mib.h
+./snmpusm.lo: ../include/net-snmp/library/parse.h
+./snmpusm.lo: ../include/net-snmp/varbind_api.h
+./snmpusm.lo: ../include/net-snmp/config_api.h
+./snmpusm.lo: ../include/net-snmp/library/read_config.h
+./snmpusm.lo: ../include/net-snmp/library/default_store.h
+./snmpusm.lo: ../include/net-snmp/library/snmp_parse_args.h
+./snmpusm.lo: ../include/net-snmp/library/snmp_enum.h
+./snmpusm.lo: ../include/net-snmp/library/vacm.h
+./snmpusm.lo: ../include/net-snmp/output_api.h
+./snmpusm.lo: ../include/net-snmp/library/snmp_debug.h
+./snmpusm.lo: ../include/net-snmp/library/snmp_logging.h
+./snmpusm.lo: ../include/net-snmp/snmpv3_api.h
+./snmpusm.lo: ../include/net-snmp/library/snmpv3.h
+./snmpusm.lo: ../include/net-snmp/library/transform_oids.h
+./snmpusm.lo: ../include/net-snmp/library/keytools.h
+./snmpusm.lo: ../include/net-snmp/library/scapi.h
+./snmpusm.lo: ../include/net-snmp/library/lcd_time.h
+./snmpusm.lo: ../include/net-snmp/library/snmp_secmod.h
+./snmpusm.lo: ../include/net-snmp/library/snmpv3-security-includes.h
+./snmpusm.lo: ../include/net-snmp/library/snmpusm.h
+./snmpvacm.lo: ../include/net-snmp/net-snmp-config.h
+./snmpvacm.lo: ../include/net-snmp/system/linux.h
+./snmpvacm.lo: ../include/net-snmp/system/sysv.h
+./snmpvacm.lo: ../include/net-snmp/system/generic.h
+./snmpvacm.lo: ../include/net-snmp/machine/generic.h 
+./snmpvacm.lo: ../include/net-snmp/net-snmp-includes.h
+./snmpvacm.lo: ../include/net-snmp/definitions.h ../include/net-snmp/types.h
+./snmpvacm.lo: ../include/net-snmp/library/snmp_api.h
+./snmpvacm.lo: ../include/net-snmp/library/asn1.h
+./snmpvacm.lo: ../include/net-snmp/library/snmp_impl.h
+./snmpvacm.lo: ../include/net-snmp/library/snmp.h
+./snmpvacm.lo: ../include/net-snmp/library/snmp-tc.h
+./snmpvacm.lo: ../include/net-snmp/utilities.h
+./snmpvacm.lo: ../include/net-snmp/library/snmp_client.h
+./snmpvacm.lo: ../include/net-snmp/library/getopt.h
+./snmpvacm.lo: ../include/net-snmp/library/system.h
+./snmpvacm.lo: ../include/net-snmp/library/tools.h
+./snmpvacm.lo: ../include/net-snmp/library/int64.h
+./snmpvacm.lo: ../include/net-snmp/library/mt_support.h
+./snmpvacm.lo: ../include/net-snmp/library/snmp_alarm.h
+./snmpvacm.lo: ../include/net-snmp/library/data_list.h
+./snmpvacm.lo: ../include/net-snmp/library/callback.h
+./snmpvacm.lo: ../include/net-snmp/library/oid_stash.h
+./snmpvacm.lo: ../include/net-snmp/library/check_varbind.h
+./snmpvacm.lo: ../include/net-snmp/version.h
+./snmpvacm.lo: ../include/net-snmp/session_api.h
+./snmpvacm.lo: ../include/net-snmp/library/snmp_transport.h
+./snmpvacm.lo: ../include/net-snmp/library/snmpCallbackDomain.h
+./snmpvacm.lo: ../include/net-snmp/library/snmpUnixDomain.h
+./snmpvacm.lo: ../include/net-snmp/library/snmpUDPDomain.h
+./snmpvacm.lo: ../include/net-snmp/library/snmpTCPDomain.h
+./snmpvacm.lo: ../include/net-snmp/library/snmpUDPIPv6Domain.h
+./snmpvacm.lo: ../include/net-snmp/library/snmpTCPIPv6Domain.h
+./snmpvacm.lo: ../include/net-snmp/library/snmpIPXDomain.h
+./snmpvacm.lo: ../include/net-snmp/library/ucd_compat.h
+./snmpvacm.lo: ../include/net-snmp/pdu_api.h ../include/net-snmp/mib_api.h
+./snmpvacm.lo: ../include/net-snmp/library/mib.h
+./snmpvacm.lo: ../include/net-snmp/library/parse.h
+./snmpvacm.lo: ../include/net-snmp/varbind_api.h
+./snmpvacm.lo: ../include/net-snmp/config_api.h
+./snmpvacm.lo: ../include/net-snmp/library/read_config.h
+./snmpvacm.lo: ../include/net-snmp/library/default_store.h
+./snmpvacm.lo: ../include/net-snmp/library/snmp_parse_args.h
+./snmpvacm.lo: ../include/net-snmp/library/snmp_enum.h
+./snmpvacm.lo: ../include/net-snmp/library/vacm.h
+./snmpvacm.lo: ../include/net-snmp/output_api.h
+./snmpvacm.lo: ../include/net-snmp/library/snmp_debug.h
+./snmpvacm.lo: ../include/net-snmp/library/snmp_logging.h
+./snmpvacm.lo: ../include/net-snmp/snmpv3_api.h
+./snmpvacm.lo: ../include/net-snmp/library/snmpv3.h
+./snmpvacm.lo: ../include/net-snmp/library/transform_oids.h
+./snmpvacm.lo: ../include/net-snmp/library/keytools.h
+./snmpvacm.lo: ../include/net-snmp/library/scapi.h
+./snmpvacm.lo: ../include/net-snmp/library/lcd_time.h
+./snmpvacm.lo: ../include/net-snmp/library/snmp_secmod.h
+./snmpvacm.lo: ../include/net-snmp/library/snmpv3-security-includes.h
+./snmpvacm.lo: ../include/net-snmp/library/snmpusm.h
+./snmpwalk.lo: ../include/net-snmp/net-snmp-config.h
+./snmpwalk.lo: ../include/net-snmp/system/linux.h
+./snmpwalk.lo: ../include/net-snmp/system/sysv.h
+./snmpwalk.lo: ../include/net-snmp/system/generic.h
+./snmpwalk.lo: ../include/net-snmp/machine/generic.h 
+./snmpwalk.lo: ../include/net-snmp/net-snmp-includes.h
+./snmpwalk.lo: ../include/net-snmp/definitions.h ../include/net-snmp/types.h
+./snmpwalk.lo: ../include/net-snmp/library/snmp_api.h
+./snmpwalk.lo: ../include/net-snmp/library/asn1.h
+./snmpwalk.lo: ../include/net-snmp/library/snmp_impl.h
+./snmpwalk.lo: ../include/net-snmp/library/snmp.h
+./snmpwalk.lo: ../include/net-snmp/library/snmp-tc.h
+./snmpwalk.lo: ../include/net-snmp/utilities.h
+./snmpwalk.lo: ../include/net-snmp/library/snmp_client.h
+./snmpwalk.lo: ../include/net-snmp/library/getopt.h
+./snmpwalk.lo: ../include/net-snmp/library/system.h
+./snmpwalk.lo: ../include/net-snmp/library/tools.h
+./snmpwalk.lo: ../include/net-snmp/library/int64.h
+./snmpwalk.lo: ../include/net-snmp/library/mt_support.h
+./snmpwalk.lo: ../include/net-snmp/library/snmp_alarm.h
+./snmpwalk.lo: ../include/net-snmp/library/data_list.h
+./snmpwalk.lo: ../include/net-snmp/library/callback.h
+./snmpwalk.lo: ../include/net-snmp/library/oid_stash.h
+./snmpwalk.lo: ../include/net-snmp/library/check_varbind.h
+./snmpwalk.lo: ../include/net-snmp/version.h
+./snmpwalk.lo: ../include/net-snmp/session_api.h
+./snmpwalk.lo: ../include/net-snmp/library/snmp_transport.h
+./snmpwalk.lo: ../include/net-snmp/library/snmpCallbackDomain.h
+./snmpwalk.lo: ../include/net-snmp/library/snmpUnixDomain.h
+./snmpwalk.lo: ../include/net-snmp/library/snmpUDPDomain.h
+./snmpwalk.lo: ../include/net-snmp/library/snmpTCPDomain.h
+./snmpwalk.lo: ../include/net-snmp/library/snmpUDPIPv6Domain.h
+./snmpwalk.lo: ../include/net-snmp/library/snmpTCPIPv6Domain.h
+./snmpwalk.lo: ../include/net-snmp/library/snmpIPXDomain.h
+./snmpwalk.lo: ../include/net-snmp/library/ucd_compat.h
+./snmpwalk.lo: ../include/net-snmp/pdu_api.h ../include/net-snmp/mib_api.h
+./snmpwalk.lo: ../include/net-snmp/library/mib.h
+./snmpwalk.lo: ../include/net-snmp/library/parse.h
+./snmpwalk.lo: ../include/net-snmp/varbind_api.h
+./snmpwalk.lo: ../include/net-snmp/config_api.h
+./snmpwalk.lo: ../include/net-snmp/library/read_config.h
+./snmpwalk.lo: ../include/net-snmp/library/default_store.h
+./snmpwalk.lo: ../include/net-snmp/library/snmp_parse_args.h
+./snmpwalk.lo: ../include/net-snmp/library/snmp_enum.h
+./snmpwalk.lo: ../include/net-snmp/library/vacm.h
+./snmpwalk.lo: ../include/net-snmp/output_api.h
+./snmpwalk.lo: ../include/net-snmp/library/snmp_debug.h
+./snmpwalk.lo: ../include/net-snmp/library/snmp_logging.h
+./snmpwalk.lo: ../include/net-snmp/snmpv3_api.h
+./snmpwalk.lo: ../include/net-snmp/library/snmpv3.h
+./snmpwalk.lo: ../include/net-snmp/library/transform_oids.h
+./snmpwalk.lo: ../include/net-snmp/library/keytools.h
+./snmpwalk.lo: ../include/net-snmp/library/scapi.h
+./snmpwalk.lo: ../include/net-snmp/library/lcd_time.h
+./snmpwalk.lo: ../include/net-snmp/library/snmp_secmod.h
+./snmpwalk.lo: ../include/net-snmp/library/snmpv3-security-includes.h
+./snmpwalk.lo: ../include/net-snmp/library/snmpusm.h
+./snmpnetstat/if.lo: ../include/net-snmp/net-snmp-config.h
+./snmpnetstat/if.lo: ../include/net-snmp/system/linux.h
+./snmpnetstat/if.lo: ../include/net-snmp/system/sysv.h
+./snmpnetstat/if.lo: ../include/net-snmp/system/generic.h
+./snmpnetstat/if.lo: ../include/net-snmp/machine/generic.h
+./snmpnetstat/if.lo:  ./snmpnetstat/main.h
+./snmpnetstat/if.lo: ../include/net-snmp/net-snmp-includes.h
+./snmpnetstat/if.lo: ../include/net-snmp/definitions.h
+./snmpnetstat/if.lo: ../include/net-snmp/types.h
+./snmpnetstat/if.lo: ../include/net-snmp/library/snmp_api.h
+./snmpnetstat/if.lo: ../include/net-snmp/library/asn1.h
+./snmpnetstat/if.lo: ../include/net-snmp/library/snmp_impl.h
+./snmpnetstat/if.lo: ../include/net-snmp/library/snmp.h
+./snmpnetstat/if.lo: ../include/net-snmp/library/snmp-tc.h
+./snmpnetstat/if.lo: ../include/net-snmp/utilities.h
+./snmpnetstat/if.lo: ../include/net-snmp/library/snmp_client.h
+./snmpnetstat/if.lo: ../include/net-snmp/library/getopt.h
+./snmpnetstat/if.lo: ../include/net-snmp/library/system.h
+./snmpnetstat/if.lo: ../include/net-snmp/library/tools.h
+./snmpnetstat/if.lo: ../include/net-snmp/library/int64.h
+./snmpnetstat/if.lo: ../include/net-snmp/library/mt_support.h
+./snmpnetstat/if.lo: ../include/net-snmp/library/snmp_alarm.h
+./snmpnetstat/if.lo: ../include/net-snmp/library/data_list.h
+./snmpnetstat/if.lo: ../include/net-snmp/library/callback.h
+./snmpnetstat/if.lo: ../include/net-snmp/library/oid_stash.h
+./snmpnetstat/if.lo: ../include/net-snmp/library/check_varbind.h
+./snmpnetstat/if.lo: ../include/net-snmp/version.h
+./snmpnetstat/if.lo: ../include/net-snmp/session_api.h
+./snmpnetstat/if.lo: ../include/net-snmp/library/snmp_transport.h
+./snmpnetstat/if.lo: ../include/net-snmp/library/snmpCallbackDomain.h
+./snmpnetstat/if.lo: ../include/net-snmp/library/snmpUnixDomain.h
+./snmpnetstat/if.lo: ../include/net-snmp/library/snmpUDPDomain.h
+./snmpnetstat/if.lo: ../include/net-snmp/library/snmpTCPDomain.h
+./snmpnetstat/if.lo: ../include/net-snmp/library/snmpUDPIPv6Domain.h
+./snmpnetstat/if.lo: ../include/net-snmp/library/snmpTCPIPv6Domain.h
+./snmpnetstat/if.lo: ../include/net-snmp/library/snmpIPXDomain.h
+./snmpnetstat/if.lo: ../include/net-snmp/library/ucd_compat.h
+./snmpnetstat/if.lo: ../include/net-snmp/pdu_api.h
+./snmpnetstat/if.lo: ../include/net-snmp/mib_api.h
+./snmpnetstat/if.lo: ../include/net-snmp/library/mib.h
+./snmpnetstat/if.lo: ../include/net-snmp/library/parse.h
+./snmpnetstat/if.lo: ../include/net-snmp/varbind_api.h
+./snmpnetstat/if.lo: ../include/net-snmp/config_api.h
+./snmpnetstat/if.lo: ../include/net-snmp/library/read_config.h
+./snmpnetstat/if.lo: ../include/net-snmp/library/default_store.h
+./snmpnetstat/if.lo: ../include/net-snmp/library/snmp_parse_args.h
+./snmpnetstat/if.lo: ../include/net-snmp/library/snmp_enum.h
+./snmpnetstat/if.lo: ../include/net-snmp/library/vacm.h
+./snmpnetstat/if.lo: ../include/net-snmp/output_api.h
+./snmpnetstat/if.lo: ../include/net-snmp/library/snmp_debug.h
+./snmpnetstat/if.lo: ../include/net-snmp/library/snmp_logging.h
+./snmpnetstat/if.lo: ../include/net-snmp/snmpv3_api.h
+./snmpnetstat/if.lo: ../include/net-snmp/library/snmpv3.h
+./snmpnetstat/if.lo: ../include/net-snmp/library/transform_oids.h
+./snmpnetstat/if.lo: ../include/net-snmp/library/keytools.h
+./snmpnetstat/if.lo: ../include/net-snmp/library/scapi.h
+./snmpnetstat/if.lo: ../include/net-snmp/library/lcd_time.h
+./snmpnetstat/if.lo: ../include/net-snmp/library/snmp_secmod.h
+./snmpnetstat/if.lo: ../include/net-snmp/library/snmpv3-security-includes.h
+./snmpnetstat/if.lo: ../include/net-snmp/library/snmpusm.h
+./snmpnetstat/if.lo: ./snmpnetstat/netstat.h
+./snmpnetstat/inet6.lo: ../include/net-snmp/net-snmp-config.h
+./snmpnetstat/inet6.lo: ../include/net-snmp/system/linux.h
+./snmpnetstat/inet6.lo: ../include/net-snmp/system/sysv.h
+./snmpnetstat/inet6.lo: ../include/net-snmp/system/generic.h
+./snmpnetstat/inet6.lo: ../include/net-snmp/machine/generic.h
+./snmpnetstat/inet.lo: ../include/net-snmp/net-snmp-config.h
+./snmpnetstat/inet.lo: ../include/net-snmp/system/linux.h
+./snmpnetstat/inet.lo: ../include/net-snmp/system/sysv.h
+./snmpnetstat/inet.lo: ../include/net-snmp/system/generic.h
+./snmpnetstat/inet.lo: ../include/net-snmp/machine/generic.h
+./snmpnetstat/inet.lo:  ./snmpnetstat/main.h
+./snmpnetstat/inet.lo: ../include/net-snmp/net-snmp-includes.h
+./snmpnetstat/inet.lo: ../include/net-snmp/definitions.h
+./snmpnetstat/inet.lo: ../include/net-snmp/types.h
+./snmpnetstat/inet.lo: ../include/net-snmp/library/snmp_api.h
+./snmpnetstat/inet.lo: ../include/net-snmp/library/asn1.h
+./snmpnetstat/inet.lo: ../include/net-snmp/library/snmp_impl.h
+./snmpnetstat/inet.lo: ../include/net-snmp/library/snmp.h
+./snmpnetstat/inet.lo: ../include/net-snmp/library/snmp-tc.h
+./snmpnetstat/inet.lo: ../include/net-snmp/utilities.h
+./snmpnetstat/inet.lo: ../include/net-snmp/library/snmp_client.h
+./snmpnetstat/inet.lo: ../include/net-snmp/library/getopt.h
+./snmpnetstat/inet.lo: ../include/net-snmp/library/system.h
+./snmpnetstat/inet.lo: ../include/net-snmp/library/tools.h
+./snmpnetstat/inet.lo: ../include/net-snmp/library/int64.h
+./snmpnetstat/inet.lo: ../include/net-snmp/library/mt_support.h
+./snmpnetstat/inet.lo: ../include/net-snmp/library/snmp_alarm.h
+./snmpnetstat/inet.lo: ../include/net-snmp/library/data_list.h
+./snmpnetstat/inet.lo: ../include/net-snmp/library/callback.h
+./snmpnetstat/inet.lo: ../include/net-snmp/library/oid_stash.h
+./snmpnetstat/inet.lo: ../include/net-snmp/library/check_varbind.h
+./snmpnetstat/inet.lo: ../include/net-snmp/version.h
+./snmpnetstat/inet.lo: ../include/net-snmp/session_api.h
+./snmpnetstat/inet.lo: ../include/net-snmp/library/snmp_transport.h
+./snmpnetstat/inet.lo: ../include/net-snmp/library/snmpCallbackDomain.h
+./snmpnetstat/inet.lo: ../include/net-snmp/library/snmpUnixDomain.h
+./snmpnetstat/inet.lo: ../include/net-snmp/library/snmpUDPDomain.h
+./snmpnetstat/inet.lo: ../include/net-snmp/library/snmpTCPDomain.h
+./snmpnetstat/inet.lo: ../include/net-snmp/library/snmpUDPIPv6Domain.h
+./snmpnetstat/inet.lo: ../include/net-snmp/library/snmpTCPIPv6Domain.h
+./snmpnetstat/inet.lo: ../include/net-snmp/library/snmpIPXDomain.h
+./snmpnetstat/inet.lo: ../include/net-snmp/library/ucd_compat.h
+./snmpnetstat/inet.lo: ../include/net-snmp/pdu_api.h
+./snmpnetstat/inet.lo: ../include/net-snmp/mib_api.h
+./snmpnetstat/inet.lo: ../include/net-snmp/library/mib.h
+./snmpnetstat/inet.lo: ../include/net-snmp/library/parse.h
+./snmpnetstat/inet.lo: ../include/net-snmp/varbind_api.h
+./snmpnetstat/inet.lo: ../include/net-snmp/config_api.h
+./snmpnetstat/inet.lo: ../include/net-snmp/library/read_config.h
+./snmpnetstat/inet.lo: ../include/net-snmp/library/default_store.h
+./snmpnetstat/inet.lo: ../include/net-snmp/library/snmp_parse_args.h
+./snmpnetstat/inet.lo: ../include/net-snmp/library/snmp_enum.h
+./snmpnetstat/inet.lo: ../include/net-snmp/library/vacm.h
+./snmpnetstat/inet.lo: ../include/net-snmp/output_api.h
+./snmpnetstat/inet.lo: ../include/net-snmp/library/snmp_debug.h
+./snmpnetstat/inet.lo: ../include/net-snmp/library/snmp_logging.h
+./snmpnetstat/inet.lo: ../include/net-snmp/snmpv3_api.h
+./snmpnetstat/inet.lo: ../include/net-snmp/library/snmpv3.h
+./snmpnetstat/inet.lo: ../include/net-snmp/library/transform_oids.h
+./snmpnetstat/inet.lo: ../include/net-snmp/library/keytools.h
+./snmpnetstat/inet.lo: ../include/net-snmp/library/scapi.h
+./snmpnetstat/inet.lo: ../include/net-snmp/library/lcd_time.h
+./snmpnetstat/inet.lo: ../include/net-snmp/library/snmp_secmod.h
+./snmpnetstat/inet.lo: ../include/net-snmp/library/snmpv3-security-includes.h
+./snmpnetstat/inet.lo: ../include/net-snmp/library/snmpusm.h
+./snmpnetstat/inet.lo: ./snmpnetstat/netstat.h
+./snmpnetstat/main.lo: ../include/net-snmp/net-snmp-config.h
+./snmpnetstat/main.lo: ../include/net-snmp/system/linux.h
+./snmpnetstat/main.lo: ../include/net-snmp/system/sysv.h
+./snmpnetstat/main.lo: ../include/net-snmp/system/generic.h
+./snmpnetstat/main.lo: ../include/net-snmp/machine/generic.h
+./snmpnetstat/main.lo:  ../include/net-snmp/utilities.h
+./snmpnetstat/main.lo: ../include/net-snmp/types.h 
+./snmpnetstat/main.lo: ../include/net-snmp/definitions.h
+./snmpnetstat/main.lo: ../include/net-snmp/library/snmp_api.h
+./snmpnetstat/main.lo: ../include/net-snmp/library/asn1.h
+./snmpnetstat/main.lo: ../include/net-snmp/library/snmp_impl.h
+./snmpnetstat/main.lo: ../include/net-snmp/library/snmp.h
+./snmpnetstat/main.lo: ../include/net-snmp/library/snmp-tc.h
+./snmpnetstat/main.lo: ../include/net-snmp/library/snmp_client.h
+./snmpnetstat/main.lo: ../include/net-snmp/library/getopt.h
+./snmpnetstat/main.lo: ../include/net-snmp/library/system.h
+./snmpnetstat/main.lo: ../include/net-snmp/library/tools.h
+./snmpnetstat/main.lo: ../include/net-snmp/library/int64.h
+./snmpnetstat/main.lo: ../include/net-snmp/library/mt_support.h
+./snmpnetstat/main.lo: ../include/net-snmp/library/snmp_alarm.h
+./snmpnetstat/main.lo: ../include/net-snmp/library/data_list.h
+./snmpnetstat/main.lo: ../include/net-snmp/library/callback.h
+./snmpnetstat/main.lo: ../include/net-snmp/library/oid_stash.h
+./snmpnetstat/main.lo: ../include/net-snmp/library/check_varbind.h
+./snmpnetstat/main.lo: ../include/net-snmp/version.h 
+./snmpnetstat/main.lo: ../include/net-snmp/net-snmp-includes.h
+./snmpnetstat/main.lo: ../include/net-snmp/session_api.h
+./snmpnetstat/main.lo: ../include/net-snmp/library/snmp_transport.h
+./snmpnetstat/main.lo: ../include/net-snmp/library/snmpCallbackDomain.h
+./snmpnetstat/main.lo: ../include/net-snmp/library/snmpUnixDomain.h
+./snmpnetstat/main.lo: ../include/net-snmp/library/snmpUDPDomain.h
+./snmpnetstat/main.lo: ../include/net-snmp/library/snmpTCPDomain.h
+./snmpnetstat/main.lo: ../include/net-snmp/library/snmpUDPIPv6Domain.h
+./snmpnetstat/main.lo: ../include/net-snmp/library/snmpTCPIPv6Domain.h
+./snmpnetstat/main.lo: ../include/net-snmp/library/snmpIPXDomain.h
+./snmpnetstat/main.lo: ../include/net-snmp/library/ucd_compat.h
+./snmpnetstat/main.lo: ../include/net-snmp/pdu_api.h
+./snmpnetstat/main.lo: ../include/net-snmp/mib_api.h
+./snmpnetstat/main.lo: ../include/net-snmp/library/mib.h
+./snmpnetstat/main.lo: ../include/net-snmp/library/parse.h
+./snmpnetstat/main.lo: ../include/net-snmp/varbind_api.h
+./snmpnetstat/main.lo: ../include/net-snmp/config_api.h
+./snmpnetstat/main.lo: ../include/net-snmp/library/read_config.h
+./snmpnetstat/main.lo: ../include/net-snmp/library/default_store.h
+./snmpnetstat/main.lo: ../include/net-snmp/library/snmp_parse_args.h
+./snmpnetstat/main.lo: ../include/net-snmp/library/snmp_enum.h
+./snmpnetstat/main.lo: ../include/net-snmp/library/vacm.h
+./snmpnetstat/main.lo: ../include/net-snmp/output_api.h
+./snmpnetstat/main.lo: ../include/net-snmp/library/snmp_debug.h
+./snmpnetstat/main.lo: ../include/net-snmp/library/snmp_logging.h
+./snmpnetstat/main.lo: ../include/net-snmp/snmpv3_api.h
+./snmpnetstat/main.lo: ../include/net-snmp/library/snmpv3.h
+./snmpnetstat/main.lo: ../include/net-snmp/library/transform_oids.h
+./snmpnetstat/main.lo: ../include/net-snmp/library/keytools.h
+./snmpnetstat/main.lo: ../include/net-snmp/library/scapi.h
+./snmpnetstat/main.lo: ../include/net-snmp/library/lcd_time.h
+./snmpnetstat/main.lo: ../include/net-snmp/library/snmp_secmod.h
+./snmpnetstat/main.lo: ../include/net-snmp/library/snmpv3-security-includes.h
+./snmpnetstat/main.lo: ../include/net-snmp/library/snmpusm.h
+./snmpnetstat/main.lo: ./snmpnetstat/netstat.h
+./snmpnetstat/route.lo: ../include/net-snmp/net-snmp-config.h
+./snmpnetstat/route.lo: ../include/net-snmp/system/linux.h
+./snmpnetstat/route.lo: ../include/net-snmp/system/sysv.h
+./snmpnetstat/route.lo: ../include/net-snmp/system/generic.h
+./snmpnetstat/route.lo: ../include/net-snmp/machine/generic.h
+./snmpnetstat/route.lo: ./snmpnetstat/main.h
+./snmpnetstat/route.lo: ../include/net-snmp/net-snmp-includes.h
+./snmpnetstat/route.lo: ../include/net-snmp/definitions.h
+./snmpnetstat/route.lo: ../include/net-snmp/types.h
+./snmpnetstat/route.lo: ../include/net-snmp/library/snmp_api.h
+./snmpnetstat/route.lo: ../include/net-snmp/library/asn1.h
+./snmpnetstat/route.lo: ../include/net-snmp/library/snmp_impl.h
+./snmpnetstat/route.lo: ../include/net-snmp/library/snmp.h
+./snmpnetstat/route.lo: ../include/net-snmp/library/snmp-tc.h
+./snmpnetstat/route.lo: ../include/net-snmp/utilities.h
+./snmpnetstat/route.lo: ../include/net-snmp/library/snmp_client.h
+./snmpnetstat/route.lo: ../include/net-snmp/library/getopt.h
+./snmpnetstat/route.lo: ../include/net-snmp/library/system.h
+./snmpnetstat/route.lo: ../include/net-snmp/library/tools.h
+./snmpnetstat/route.lo: ../include/net-snmp/library/int64.h
+./snmpnetstat/route.lo: ../include/net-snmp/library/mt_support.h
+./snmpnetstat/route.lo: ../include/net-snmp/library/snmp_alarm.h
+./snmpnetstat/route.lo: ../include/net-snmp/library/data_list.h
+./snmpnetstat/route.lo: ../include/net-snmp/library/callback.h
+./snmpnetstat/route.lo: ../include/net-snmp/library/oid_stash.h
+./snmpnetstat/route.lo: ../include/net-snmp/library/check_varbind.h
+./snmpnetstat/route.lo: ../include/net-snmp/version.h
+./snmpnetstat/route.lo: ../include/net-snmp/session_api.h
+./snmpnetstat/route.lo: ../include/net-snmp/library/snmp_transport.h
+./snmpnetstat/route.lo: ../include/net-snmp/library/snmpCallbackDomain.h
+./snmpnetstat/route.lo: ../include/net-snmp/library/snmpUnixDomain.h
+./snmpnetstat/route.lo: ../include/net-snmp/library/snmpUDPDomain.h
+./snmpnetstat/route.lo: ../include/net-snmp/library/snmpTCPDomain.h
+./snmpnetstat/route.lo: ../include/net-snmp/library/snmpUDPIPv6Domain.h
+./snmpnetstat/route.lo: ../include/net-snmp/library/snmpTCPIPv6Domain.h
+./snmpnetstat/route.lo: ../include/net-snmp/library/snmpIPXDomain.h
+./snmpnetstat/route.lo: ../include/net-snmp/library/ucd_compat.h
+./snmpnetstat/route.lo: ../include/net-snmp/pdu_api.h
+./snmpnetstat/route.lo: ../include/net-snmp/mib_api.h
+./snmpnetstat/route.lo: ../include/net-snmp/library/mib.h
+./snmpnetstat/route.lo: ../include/net-snmp/library/parse.h
+./snmpnetstat/route.lo: ../include/net-snmp/varbind_api.h
+./snmpnetstat/route.lo: ../include/net-snmp/config_api.h
+./snmpnetstat/route.lo: ../include/net-snmp/library/read_config.h
+./snmpnetstat/route.lo: ../include/net-snmp/library/default_store.h
+./snmpnetstat/route.lo: ../include/net-snmp/library/snmp_parse_args.h
+./snmpnetstat/route.lo: ../include/net-snmp/library/snmp_enum.h
+./snmpnetstat/route.lo: ../include/net-snmp/library/vacm.h
+./snmpnetstat/route.lo: ../include/net-snmp/output_api.h
+./snmpnetstat/route.lo: ../include/net-snmp/library/snmp_debug.h
+./snmpnetstat/route.lo: ../include/net-snmp/library/snmp_logging.h
+./snmpnetstat/route.lo: ../include/net-snmp/snmpv3_api.h
+./snmpnetstat/route.lo: ../include/net-snmp/library/snmpv3.h
+./snmpnetstat/route.lo: ../include/net-snmp/library/transform_oids.h
+./snmpnetstat/route.lo: ../include/net-snmp/library/keytools.h
+./snmpnetstat/route.lo: ../include/net-snmp/library/scapi.h
+./snmpnetstat/route.lo: ../include/net-snmp/library/lcd_time.h
+./snmpnetstat/route.lo: ../include/net-snmp/library/snmp_secmod.h
+./snmpnetstat/route.lo: ../include/net-snmp/library/snmpv3-security-includes.h
+./snmpnetstat/route.lo: ../include/net-snmp/library/snmpusm.h
+./snmpnetstat/route.lo: ./snmpnetstat/netstat.h
+./snmpnetstat/winstub.lo: ../include/net-snmp/net-snmp-config.h
+./snmpnetstat/winstub.lo: ../include/net-snmp/system/linux.h
+./snmpnetstat/winstub.lo: ../include/net-snmp/system/sysv.h
+./snmpnetstat/winstub.lo: ../include/net-snmp/system/generic.h
+./snmpnetstat/winstub.lo: ../include/net-snmp/machine/generic.h
diff -Naur tomato/release/src/router/snmp/apps/Makefile.in tomato121/release/src/router/snmp/apps/Makefile.in
--- tomato/release/src/router/snmp/apps/Makefile.in	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/apps/Makefile.in	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,116 @@
+#
+# Makefile for snmpget, snmpwalk, snmpbulkwalk, snmptest, snmptranslate,
+# snmptrapd, snmptable, snmpset, snmpgetnext, and other utilities.
+#
+
+top_builddir=..
+
+#
+# Things to install
+#
+
+INSTALLBINPROGS	= snmpget$(EXEEXT) 			\
+		snmpgetnext$(EXEEXT) 			\
+		snmpset$(EXEEXT) 			\
+		snmpusm$(EXEEXT)			\
+		snmpwalk$(EXEEXT) 			\
+		snmpbulkwalk$(EXEEXT) 			\
+		snmptable$(EXEEXT)			\
+		snmptrap$(EXEEXT) 			\
+		snmpbulkget$(EXEEXT)			\
+		snmptranslate$(EXEEXT) 			\
+		snmpstatus$(EXEEXT) 			\
+		snmpdelta$(EXEEXT) 			\
+		snmptest$(EXEEXT)			\
+		encode_keychange$(EXEEXT) 		\
+		snmpdf$(EXEEXT) 			\
+		snmpvacm$(EXEEXT)
+
+INSTALLSBINPROGS = snmptrapd$(EXEEXT)
+
+SUBDIRS		= snmpnetstat
+
+#
+# build variables.
+#
+
+USELIBS		= ../snmplib/libnetsnmp.$(LIB_EXTENSION)$(LIB_VERSION) 
+USETRAPLIBS	= ../agent/libnetsnmpagent.$(LIB_EXTENSION)$(LIB_VERSION) ../agent/libnetsnmpmibs.$(LIB_EXTENSION)$(LIB_VERSION) ../agent/helpers/libnetsnmphelpers.$(LIB_EXTENSION)$(LIB_VERSION) $(USELIBS)
+LOCAL_LIBS	= -L../snmplib -L../agent -L../agent/helpers
+LIBS		= $(USELIBS) @LIBS@
+TRAPLIBS	= $(USETRAPLIBS) @AGENTLIBS@
+
+CPPFLAGS	= -I$(top_srcdir)/include -I../include \
+		  -I.. -I$(srcdir)/.. -I$(srcdir)/../snmplib \
+		  @CPPFLAGS@ -I$(srcdir)/../agent -I../agent/helpers \
+		  -I$(srcdir)/../agent/mibgroup
+OSUFFIX		= lo
+TRAPD_OBJECTS   = snmptrapd.$(OSUFFIX) snmptrapd_handlers.$(OSUFFIX) snmptrapd_log.$(OSUFFIX) notification_log.$(OSUFFIX)
+OBJS  = *.o
+LOBJS = *.lo
+
+all: standardall
+
+OTHERINSTALL=snmpinforminstall
+
+#
+# build rules
+#
+snmpwalk$(EXEEXT):    snmpwalk.$(OSUFFIX) $(USELIBS)
+	$(LINK) -o $@ snmpwalk.$(OSUFFIX) $(LOCAL_LIBS) ${LDFLAGS} ${LIBS} 
+
+snmpbulkwalk$(EXEEXT):    snmpbulkwalk.$(OSUFFIX) $(USELIBS)
+	$(LINK) -o $@ snmpbulkwalk.$(OSUFFIX) $(LOCAL_LIBS) ${LDFLAGS} ${LIBS} 
+
+snmpbulkget$(EXEEXT):    snmpbulkget.$(OSUFFIX) $(USELIBS)
+	$(LINK) -o $@ snmpbulkget.$(OSUFFIX) $(LOCAL_LIBS) ${LDFLAGS} ${LIBS} 
+
+snmptranslate$(EXEEXT):    snmptranslate.$(OSUFFIX) $(USELIBS)
+	$(LINK) -o $@ snmptranslate.$(OSUFFIX) $(LOCAL_LIBS) ${LDFLAGS} ${LIBS} 
+
+snmpstatus$(EXEEXT):    snmpstatus.$(OSUFFIX) $(USELIBS)
+	$(LINK) -o $@ snmpstatus.$(OSUFFIX) $(LOCAL_LIBS) ${LDFLAGS} ${LIBS} 
+
+snmpget$(EXEEXT):    snmpget.$(OSUFFIX) $(USELIBS)
+	$(LINK) -o $@ snmpget.$(OSUFFIX) $(LOCAL_LIBS) ${LDFLAGS} ${LIBS} 
+
+snmpdelta$(EXEEXT):    snmpdelta.$(OSUFFIX) $(USELIBS)
+	$(LINK) -o $@ snmpdelta.$(OSUFFIX) $(LOCAL_LIBS) ${LDFLAGS} ${LIBS} 
+
+snmptable$(EXEEXT):    snmptable.$(OSUFFIX) $(USELIBS)
+	$(LINK) -o $@ snmptable.$(OSUFFIX) $(LOCAL_LIBS) ${LDFLAGS} ${LIBS} 
+
+snmptest$(EXEEXT):    snmptest.$(OSUFFIX) $(USELIBS)
+	$(LINK) -o $@ snmptest.$(OSUFFIX) $(LOCAL_LIBS) ${LDFLAGS} ${LIBS} 
+
+snmptrapd$(EXEEXT):    $(TRAPD_OBJECTS) $(USETRAPLIBS) 
+	$(LINK) -o $@ $(TRAPD_OBJECTS) $(LOCAL_LIBS) ${LDFLAGS} ${TRAPLIBS} @WRAPLIBS@
+
+snmptrap$(EXEEXT):    snmptrap.$(OSUFFIX) $(USELIBS)
+	$(LINK) -o $@ snmptrap.$(OSUFFIX) $(LOCAL_LIBS) ${LDFLAGS} ${LIBS} 
+
+snmpinform$(EXEEXT): snmptrap$(EXEEXT)
+	rm -f snmpinform
+	$(LN_S) snmptrap$(EXEEXT) snmpinform$(EXEEXT)
+
+snmpset$(EXEEXT):    snmpset.$(OSUFFIX) $(USELIBS)
+	$(LINK) -o $@ snmpset.$(OSUFFIX) $(LOCAL_LIBS) ${LDFLAGS} ${LIBS} 
+
+snmpusm$(EXEEXT):    snmpusm.$(OSUFFIX) $(USELIBS)
+	$(LINK) -o $@ snmpusm.$(OSUFFIX) $(LOCAL_LIBS) ${LDFLAGS} ${LIBS} 
+
+snmpvacm$(EXEEXT):    snmpvacm.$(OSUFFIX) $(USELIBS)
+	$(LINK) -o $@ snmpvacm.$(OSUFFIX) $(LOCAL_LIBS) ${LDFLAGS} ${LIBS} 
+
+snmpgetnext$(EXEEXT):    snmpgetnext.$(OSUFFIX) $(USELIBS)
+	$(LINK) -o $@ snmpgetnext.$(OSUFFIX) $(LOCAL_LIBS) ${LDFLAGS} ${LIBS} 
+
+encode_keychange$(EXEEXT):    encode_keychange.$(OSUFFIX) $(USELIBS)
+	$(LINK) -o $@ encode_keychange.$(OSUFFIX) $(LOCAL_LIBS) ${LDFLAGS} ${LIBS} 
+
+snmpdf$(EXEEXT):    snmpdf.$(OSUFFIX) $(USELIBS)
+	$(LINK) -o $@ snmpdf.$(OSUFFIX) $(LOCAL_LIBS) ${LDFLAGS} ${LIBS} 
+
+snmpinforminstall:
+	rm -f $(bindir)/snmpinform$(EXEEXT)
+	$(LN_S) snmptrap$(EXEEXT) $(bindir)/snmpinform$(EXEEXT)
diff -Naur tomato/release/src/router/snmp/apps/notification_log.c tomato121/release/src/router/snmp/apps/notification_log.c
--- tomato/release/src/router/snmp/apps/notification_log.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/apps/notification_log.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,658 @@
+#include <net-snmp/net-snmp-config.h>
+
+#include <sys/types.h>
+#if HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+#if HAVE_NETDB_H
+#include <netdb.h>
+#endif
+
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include <net-snmp/agent/instance.h>
+#include <net-snmp/agent/table.h>
+#include <net-snmp/agent/table_data.h>
+#include <net-snmp/agent/table_dataset.h>
+#include "notification_log.h"
+
+extern u_long   num_received;
+u_long          num_deleted = 0;
+
+u_long          max_logged = 1000;      /* goes against the mib default of infinite */
+u_long          max_age = 1440; /* 24 hours, which is the mib default */
+
+netsnmp_table_data_set *nlmLogTable;
+netsnmp_table_data_set *nlmLogVarTable;
+
+void
+check_log_size(unsigned int clientreg, void *clientarg)
+{
+    netsnmp_table_row *row, *deleterow, *tmprow, *deletevarrow;
+    netsnmp_table_data_set_storage *data;
+    u_long          count = 0;
+    struct timeval  now;
+    long            tmpl;
+
+    gettimeofday(&now, NULL);
+    tmpl = netsnmp_timeval_uptime(&now);
+
+    for (row = nlmLogTable->table->first_row; row; row = row->next) {
+        /*
+         * check max allowed count 
+         */
+        count++;
+        if (max_logged && count == max_logged)
+            break;
+
+        /*
+         * check max age 
+         */
+
+        data = (netsnmp_table_data_set_storage *) row->data;
+        data = netsnmp_table_data_set_find_column(data, COLUMN_NLMLOGTIME);
+
+        if (max_age && tmpl > (*(data->data.integer) + max_age * 100 * 60))
+            break;
+    }
+
+    if (!row)
+        return;
+
+    /*
+     * we've reached the limit, so keep looping but start deleting
+     * from the beginning 
+     */
+    for (deleterow = nlmLogTable->table->first_row, row = row->next; row;
+         row = row->next) {
+        DEBUGMSGTL(("notification_log", "deleting a log entry\n"));
+
+        /*
+         * delete contained varbinds 
+         */
+        for (deletevarrow = nlmLogVarTable->table->first_row;
+             deletevarrow; deletevarrow = tmprow) {
+
+            tmprow = deletevarrow->next;
+
+            if (deleterow->index_oid_len ==
+                deletevarrow->index_oid_len - 1 &&
+                snmp_oid_compare(deleterow->index_oid,
+                                 deleterow->index_oid_len,
+                                 deletevarrow->index_oid,
+                                 deleterow->index_oid_len) == 0) {
+                netsnmp_table_dataset_remove_and_delete_row(nlmLogVarTable,
+                                                            deletevarrow);
+            }
+        }
+
+        /*
+         * delete the master row 
+         */
+        tmprow = deleterow->next;
+        netsnmp_table_dataset_remove_and_delete_row(nlmLogTable,
+                                                    deleterow);
+        deleterow = tmprow;
+        num_deleted++;
+        /*
+         * XXX: delete vars from it's table 
+         */
+    }
+}
+
+
+/** Initialize the nlmLogVariableTable table by defining it's contents and how it's structured */
+void
+initialize_table_nlmLogVariableTable(void)
+{
+    static oid      nlmLogVariableTable_oid[] =
+        { 1, 3, 6, 1, 2, 1, 92, 1, 3, 2 };
+    size_t          nlmLogVariableTable_oid_len =
+        OID_LENGTH(nlmLogVariableTable_oid);
+    netsnmp_table_data_set *table_set;
+
+    /*
+     * create the table structure itself 
+     */
+    table_set = netsnmp_create_table_data_set("nlmLogVariableTable");
+    nlmLogVarTable = table_set;
+    nlmLogVarTable->table->store_indexes = 1;
+
+    /***************************************************
+     * Adding indexes
+     */
+    /*
+     * declaring the nlmLogName index
+     */
+    DEBUGMSGTL(("initialize_table_nlmLogVariableTable",
+                "adding index nlmLogName of type ASN_OCTET_STR to table nlmLogVariableTable\n"));
+    netsnmp_table_dataset_add_index(table_set, ASN_OCTET_STR);
+    /*
+     * declaring the nlmLogIndex index
+     */
+    DEBUGMSGTL(("initialize_table_nlmLogVariableTable",
+                "adding index nlmLogIndex of type ASN_UNSIGNED to table nlmLogVariableTable\n"));
+    netsnmp_table_dataset_add_index(table_set, ASN_UNSIGNED);
+    /*
+     * declaring the nlmLogVariableIndex index
+     */
+    DEBUGMSGTL(("initialize_table_nlmLogVariableTable",
+                "adding index nlmLogVariableIndex of type ASN_UNSIGNED to table nlmLogVariableTable\n"));
+    netsnmp_table_dataset_add_index(table_set, ASN_UNSIGNED);
+
+    /*
+     * adding column nlmLogVariableIndex of type ASN_UNSIGNED and access
+     * of NoAccess 
+     */
+    DEBUGMSGTL(("initialize_table_nlmLogVariableTable",
+                "adding column nlmLogVariableIndex (#1) of type ASN_UNSIGNED to table nlmLogVariableTable\n"));
+    netsnmp_table_set_add_default_row(table_set,
+                                      COLUMN_NLMLOGVARIABLEINDEX,
+                                      ASN_UNSIGNED, 0, NULL, 0);
+    /*
+     * adding column nlmLogVariableID of type ASN_OBJECT_ID and access of
+     * ReadOnly 
+     */
+    DEBUGMSGTL(("initialize_table_nlmLogVariableTable",
+                "adding column nlmLogVariableID (#2) of type ASN_OBJECT_ID to table nlmLogVariableTable\n"));
+    netsnmp_table_set_add_default_row(table_set, COLUMN_NLMLOGVARIABLEID,
+                                      ASN_OBJECT_ID, 0, NULL, 0);
+    /*
+     * adding column nlmLogVariableValueType of type ASN_INTEGER and
+     * access of ReadOnly 
+     */
+    DEBUGMSGTL(("initialize_table_nlmLogVariableTable",
+                "adding column nlmLogVariableValueType (#3) of type ASN_INTEGER to table nlmLogVariableTable\n"));
+    netsnmp_table_set_add_default_row(table_set,
+                                      COLUMN_NLMLOGVARIABLEVALUETYPE,
+                                      ASN_INTEGER, 0, NULL, 0);
+    /*
+     * adding column nlmLogVariableCounter32Val of type ASN_COUNTER and
+     * access of ReadOnly 
+     */
+    DEBUGMSGTL(("initialize_table_nlmLogVariableTable",
+                "adding column nlmLogVariableCounter32Val (#4) of type ASN_COUNTER to table nlmLogVariableTable\n"));
+    netsnmp_table_set_add_default_row(table_set,
+                                      COLUMN_NLMLOGVARIABLECOUNTER32VAL,
+                                      ASN_COUNTER, 0, NULL, 0);
+    /*
+     * adding column nlmLogVariableUnsigned32Val of type ASN_UNSIGNED and
+     * access of ReadOnly 
+     */
+    DEBUGMSGTL(("initialize_table_nlmLogVariableTable",
+                "adding column nlmLogVariableUnsigned32Val (#5) of type ASN_UNSIGNED to table nlmLogVariableTable\n"));
+    netsnmp_table_set_add_default_row(table_set,
+                                      COLUMN_NLMLOGVARIABLEUNSIGNED32VAL,
+                                      ASN_UNSIGNED, 0, NULL, 0);
+    /*
+     * adding column nlmLogVariableTimeTicksVal of type ASN_TIMETICKS and
+     * access of ReadOnly 
+     */
+    DEBUGMSGTL(("initialize_table_nlmLogVariableTable",
+                "adding column nlmLogVariableTimeTicksVal (#6) of type ASN_TIMETICKS to table nlmLogVariableTable\n"));
+    netsnmp_table_set_add_default_row(table_set,
+                                      COLUMN_NLMLOGVARIABLETIMETICKSVAL,
+                                      ASN_TIMETICKS, 0, NULL, 0);
+    /*
+     * adding column nlmLogVariableInteger32Val of type ASN_INTEGER and
+     * access of ReadOnly 
+     */
+    DEBUGMSGTL(("initialize_table_nlmLogVariableTable",
+                "adding column nlmLogVariableInteger32Val (#7) of type ASN_INTEGER to table nlmLogVariableTable\n"));
+    netsnmp_table_set_add_default_row(table_set,
+                                      COLUMN_NLMLOGVARIABLEINTEGER32VAL,
+                                      ASN_INTEGER, 0, NULL, 0);
+    /*
+     * adding column nlmLogVariableOctetStringVal of type ASN_OCTET_STR
+     * and access of ReadOnly 
+     */
+    DEBUGMSGTL(("initialize_table_nlmLogVariableTable",
+                "adding column nlmLogVariableOctetStringVal (#8) of type ASN_OCTET_STR to table nlmLogVariableTable\n"));
+    netsnmp_table_set_add_default_row(table_set,
+                                      COLUMN_NLMLOGVARIABLEOCTETSTRINGVAL,
+                                      ASN_OCTET_STR, 0, NULL, 0);
+    /*
+     * adding column nlmLogVariableIpAddressVal of type ASN_IPADDRESS and
+     * access of ReadOnly 
+     */
+    DEBUGMSGTL(("initialize_table_nlmLogVariableTable",
+                "adding column nlmLogVariableIpAddressVal (#9) of type ASN_IPADDRESS to table nlmLogVariableTable\n"));
+    netsnmp_table_set_add_default_row(table_set,
+                                      COLUMN_NLMLOGVARIABLEIPADDRESSVAL,
+                                      ASN_IPADDRESS, 0, NULL, 0);
+    /*
+     * adding column nlmLogVariableOidVal of type ASN_OBJECT_ID and access 
+     * of ReadOnly 
+     */
+    DEBUGMSGTL(("initialize_table_nlmLogVariableTable",
+                "adding column nlmLogVariableOidVal (#10) of type ASN_OBJECT_ID to table nlmLogVariableTable\n"));
+    netsnmp_table_set_add_default_row(table_set,
+                                      COLUMN_NLMLOGVARIABLEOIDVAL,
+                                      ASN_OBJECT_ID, 0, NULL, 0);
+    /*
+     * adding column nlmLogVariableCounter64Val of type ASN_COUNTER64 and
+     * access of ReadOnly 
+     */
+    DEBUGMSGTL(("initialize_table_nlmLogVariableTable",
+                "adding column nlmLogVariableCounter64Val (#11) of type ASN_COUNTER64 to table nlmLogVariableTable\n"));
+    netsnmp_table_set_add_default_row(table_set,
+                                      COLUMN_NLMLOGVARIABLECOUNTER64VAL,
+                                      ASN_COUNTER64, 0, NULL, 0);
+    /*
+     * adding column nlmLogVariableOpaqueVal of type ASN_OPAQUE and access 
+     * of ReadOnly 
+     */
+    DEBUGMSGTL(("initialize_table_nlmLogVariableTable",
+                "adding column nlmLogVariableOpaqueVal (#12) of type ASN_OPAQUE to table nlmLogVariableTable\n"));
+    netsnmp_table_set_add_default_row(table_set,
+                                      COLUMN_NLMLOGVARIABLEOPAQUEVAL,
+                                      ASN_OPAQUE, 0, NULL, 0);
+
+    /*
+     * registering the table with the master agent 
+     */
+    /*
+     * note: if you don't need a subhandler to deal with any aspects of
+     * the request, change nlmLogVariableTable_handler to "NULL" 
+     */
+    netsnmp_register_table_data_set(netsnmp_create_handler_registration
+                                    ("nlmLogVariableTable",
+                                     nlmLogVariableTable_handler,
+                                     nlmLogVariableTable_oid,
+                                     nlmLogVariableTable_oid_len,
+                                     HANDLER_CAN_RWRITE), table_set, NULL);
+}
+
+/** Initialize the nlmLogTable table by defining it's contents and how it's structured */
+void
+initialize_table_nlmLogTable(void)
+{
+    static oid      nlmLogTable_oid[] = { 1, 3, 6, 1, 2, 1, 92, 1, 3, 1 };
+    size_t          nlmLogTable_oid_len = OID_LENGTH(nlmLogTable_oid);
+
+    /*
+     * create the table structure itself 
+     */
+    nlmLogTable = netsnmp_create_table_data_set("nlmLogTable");
+
+    /***************************************************
+     * Adding indexes
+     */
+    /*
+     * declaring the nlmLogIndex index
+     */
+    DEBUGMSGTL(("initialize_table_nlmLogTable",
+                "adding index nlmLogName of type ASN_OCTET_STR to table nlmLogTable\n"));
+    netsnmp_table_dataset_add_index(nlmLogTable, ASN_OCTET_STR);
+
+    DEBUGMSGTL(("initialize_table_nlmLogTable",
+                "adding index nlmLogIndex of type ASN_UNSIGNED to table nlmLogTable\n"));
+    netsnmp_table_dataset_add_index(nlmLogTable, ASN_UNSIGNED);
+
+    /*
+     * adding column nlmLogTime of type ASN_TIMETICKS and access of
+     * ReadOnly 
+     */
+    DEBUGMSGTL(("initialize_table_nlmLogTable",
+                "adding column nlmLogTime (#2) of type ASN_TIMETICKS to table nlmLogTable\n"));
+    netsnmp_table_set_add_default_row(nlmLogTable, COLUMN_NLMLOGTIME,
+                                      ASN_TIMETICKS, 0, NULL, 0);
+    /*
+     * adding column nlmLogDateAndTime of type ASN_OCTET_STR and access of 
+     * ReadOnly 
+     */
+    DEBUGMSGTL(("initialize_table_nlmLogTable",
+                "adding column nlmLogDateAndTime (#3) of type ASN_OCTET_STR to table nlmLogTable\n"));
+    netsnmp_table_set_add_default_row(nlmLogTable,
+                                      COLUMN_NLMLOGDATEANDTIME,
+                                      ASN_OCTET_STR, 0, NULL, 0);
+    /*
+     * adding column nlmLogEngineID of type ASN_OCTET_STR and access of
+     * ReadOnly 
+     */
+    DEBUGMSGTL(("initialize_table_nlmLogTable",
+                "adding column nlmLogEngineID (#4) of type ASN_OCTET_STR to table nlmLogTable\n"));
+    netsnmp_table_set_add_default_row(nlmLogTable, COLUMN_NLMLOGENGINEID,
+                                      ASN_OCTET_STR, 0, NULL, 0);
+    /*
+     * adding column nlmLogEngineTAddress of type ASN_OCTET_STR and access 
+     * of ReadOnly 
+     */
+    DEBUGMSGTL(("initialize_table_nlmLogTable",
+                "adding column nlmLogEngineTAddress (#5) of type ASN_OCTET_STR to table nlmLogTable\n"));
+    netsnmp_table_set_add_default_row(nlmLogTable,
+                                      COLUMN_NLMLOGENGINETADDRESS,
+                                      ASN_OCTET_STR, 0, NULL, 0);
+    /*
+     * adding column nlmLogEngineTDomain of type ASN_OBJECT_ID and access
+     * of ReadOnly 
+     */
+    DEBUGMSGTL(("initialize_table_nlmLogTable",
+                "adding column nlmLogEngineTDomain (#6) of type ASN_OBJECT_ID to table nlmLogTable\n"));
+    netsnmp_table_set_add_default_row(nlmLogTable,
+                                      COLUMN_NLMLOGENGINETDOMAIN,
+                                      ASN_OBJECT_ID, 0, NULL, 0);
+    /*
+     * adding column nlmLogContextEngineID of type ASN_OCTET_STR and
+     * access of ReadOnly 
+     */
+    DEBUGMSGTL(("initialize_table_nlmLogTable",
+                "adding column nlmLogContextEngineID (#7) of type ASN_OCTET_STR to table nlmLogTable\n"));
+    netsnmp_table_set_add_default_row(nlmLogTable,
+                                      COLUMN_NLMLOGCONTEXTENGINEID,
+                                      ASN_OCTET_STR, 0, NULL, 0);
+    /*
+     * adding column nlmLogContextName of type ASN_OCTET_STR and access of 
+     * ReadOnly 
+     */
+    DEBUGMSGTL(("initialize_table_nlmLogTable",
+                "adding column nlmLogContextName (#8) of type ASN_OCTET_STR to table nlmLogTable\n"));
+    netsnmp_table_set_add_default_row(nlmLogTable,
+                                      COLUMN_NLMLOGCONTEXTNAME,
+                                      ASN_OCTET_STR, 0, NULL, 0);
+    /*
+     * adding column nlmLogNotificationID of type ASN_OBJECT_ID and access 
+     * of ReadOnly 
+     */
+    DEBUGMSGTL(("initialize_table_nlmLogTable",
+                "adding column nlmLogNotificationID (#9) of type ASN_OBJECT_ID to table nlmLogTable\n"));
+    netsnmp_table_set_add_default_row(nlmLogTable,
+                                      COLUMN_NLMLOGNOTIFICATIONID,
+                                      ASN_OBJECT_ID, 0, NULL, 0);
+
+    /*
+     * registering the table with the master agent 
+     */
+    /*
+     * note: if you don't need a subhandler to deal with any aspects of
+     * the request, change nlmLogTable_handler to "NULL" 
+     */
+    netsnmp_register_table_data_set(netsnmp_create_handler_registration
+                                    ("nlmLogTable", nlmLogTable_handler,
+                                     nlmLogTable_oid, nlmLogTable_oid_len,
+                                     HANDLER_CAN_RWRITE), nlmLogTable,
+                                    NULL);
+
+    /*
+     * hmm...  5 minutes seems like a reasonable time to check for out
+     * dated notification logs right? 
+     */
+    snmp_alarm_register(300, SA_REPEAT, check_log_size, NULL);
+}
+
+int
+notification_log_config_handler(netsnmp_mib_handler *handler,
+                                netsnmp_handler_registration *reginfo,
+                                netsnmp_agent_request_info *reqinfo,
+                                netsnmp_request_info *requests)
+{
+    /*
+     *this handler exists only to act as a trigger when the
+     * configuration variables get set to a value and thus
+     * notifications must be possibly deleted from our archives.
+     */
+    if (reqinfo->mode == MODE_SET_COMMIT)
+        check_log_size(0, NULL);
+    return SNMP_ERR_NOERROR;
+}
+
+void
+init_notification_log(void)
+{
+    static oid      my_nlmStatsGlobalNotificationsLogged_oid[] =
+        { 1, 3, 6, 1, 2, 1, 92, 1, 2, 1, 0 };
+    static oid      my_nlmStatsGlobalNotificationsBumped_oid[] =
+        { 1, 3, 6, 1, 2, 1, 92, 1, 2, 2, 0 };
+    static oid      my_nlmConfigGlobalEntryLimit_oid[] =
+        { 1, 3, 6, 1, 2, 1, 92, 1, 1, 1, 0 };
+    static oid      my_nlmConfigGlobalAgeOut_oid[] =
+        { 1, 3, 6, 1, 2, 1, 92, 1, 1, 2, 0 };
+
+    /*
+     * static variables 
+     */
+    netsnmp_register_read_only_counter32_instance
+        ("nlmStatsGlobalNotificationsLogged",
+         my_nlmStatsGlobalNotificationsLogged_oid,
+         OID_LENGTH(my_nlmStatsGlobalNotificationsLogged_oid),
+         &num_received, NULL);
+
+    netsnmp_register_read_only_counter32_instance
+        ("nlmStatsGlobalNotificationsBumped",
+         my_nlmStatsGlobalNotificationsBumped_oid,
+         OID_LENGTH(my_nlmStatsGlobalNotificationsBumped_oid),
+         &num_deleted, NULL);
+
+    netsnmp_register_ulong_instance("nlmConfigGlobalEntryLimit",
+                                    my_nlmConfigGlobalEntryLimit_oid,
+                                    OID_LENGTH
+                                    (my_nlmConfigGlobalEntryLimit_oid),
+                                    &max_logged,
+                                    notification_log_config_handler);
+
+    netsnmp_register_ulong_instance("nlmConfigGlobalAgeOut",
+                                    my_nlmConfigGlobalAgeOut_oid,
+                                    OID_LENGTH
+                                    (my_nlmConfigGlobalAgeOut_oid),
+                                    &max_age,
+                                    notification_log_config_handler);
+
+    /*
+     * tables 
+     */
+    initialize_table_nlmLogTable();
+    initialize_table_nlmLogVariableTable();
+
+    /*
+     * disable flag 
+     */
+    netsnmp_ds_register_config(ASN_BOOLEAN, "snmptrapd", "dontRetainLogs",
+			   NETSNMP_DS_APPLICATION_ID, NETSNMP_DS_APP_DONT_LOG);
+}
+
+u_long          default_num = 0;
+
+void
+log_notification(struct hostent *host, netsnmp_pdu *pdu,
+                 netsnmp_transport *transport)
+{
+    long            tmpl;
+    struct timeval  now;
+    netsnmp_table_row *row;
+
+    static oid      snmptrapoid[] = { 1, 3, 6, 1, 6, 3, 1, 1, 4, 1, 0 };
+    size_t          snmptrapoid_len = OID_LENGTH(snmptrapoid);
+    netsnmp_variable_list *vptr;
+    u_char         *logdate;
+    size_t          logdate_size;
+    time_t          timetnow;
+
+    u_long          vbcount = 0;
+    u_long          tmpul;
+    int             col;
+
+    if (netsnmp_ds_get_boolean(NETSNMP_DS_APPLICATION_ID, 
+			       NETSNMP_DS_APP_DONT_LOG)) {
+        return;
+    }
+
+    DEBUGMSGTL(("log_notification", "logging something\n"));
+    row = netsnmp_create_table_data_row();
+
+    default_num++;
+
+    /*
+     * indexes to the table 
+     */
+    netsnmp_table_row_add_index(row, ASN_OCTET_STR, "default",
+                                strlen("default"));
+    netsnmp_table_row_add_index(row, ASN_UNSIGNED, &default_num,
+                                sizeof(default_num));
+
+    /*
+     * add the data 
+     */
+    gettimeofday(&now, NULL);
+    tmpl = netsnmp_timeval_uptime(&now);
+    netsnmp_set_row_column(row, COLUMN_NLMLOGTIME, ASN_TIMETICKS,
+                           (u_char *) & tmpl, sizeof(tmpl));
+    time(&timetnow);
+    logdate = date_n_time(&timetnow, &logdate_size);
+    netsnmp_set_row_column(row, COLUMN_NLMLOGDATEANDTIME, ASN_OCTET_STR,
+                           logdate, logdate_size);
+    netsnmp_set_row_column(row, COLUMN_NLMLOGENGINEID, ASN_OCTET_STR,
+                           pdu->securityEngineID,
+                           pdu->securityEngineIDLen);
+    if (transport && transport->domain == netsnmpUDPDomain) {
+        /*
+         * lame way to check for the udp domain 
+         */
+        /*
+         * no, it is the correct way to do it -- jbpn 
+         */
+        struct sockaddr_in *addr =
+            (struct sockaddr_in *) pdu->transport_data;
+        if (addr) {
+            char            buf[sizeof(in_addr_t) +
+                                sizeof(addr->sin_port)];
+            in_addr_t       locaddr = htonl(addr->sin_addr.s_addr);
+            u_short         portnum = htons(addr->sin_port);
+            memcpy(buf, &locaddr, sizeof(in_addr_t));
+            memcpy(buf + sizeof(in_addr_t), &portnum,
+                   sizeof(addr->sin_port));
+            netsnmp_set_row_column(row, COLUMN_NLMLOGENGINETADDRESS,
+                                   ASN_OCTET_STR, buf,
+                                   sizeof(in_addr_t) +
+                                   sizeof(addr->sin_port));
+        }
+    }
+    netsnmp_set_row_column(row, COLUMN_NLMLOGENGINETDOMAIN, ASN_OBJECT_ID,
+                           (const u_char *) transport->domain,
+                           sizeof(oid) * transport->domain_length);
+    netsnmp_set_row_column(row, COLUMN_NLMLOGCONTEXTENGINEID,
+                           ASN_OCTET_STR, pdu->contextEngineID,
+                           pdu->contextEngineIDLen);
+    netsnmp_set_row_column(row, COLUMN_NLMLOGCONTEXTNAME, ASN_OCTET_STR,
+                           pdu->contextName, pdu->contextNameLen);
+    for (vptr = pdu->variables; vptr; vptr = vptr->next_variable) {
+        if (snmp_oid_compare(snmptrapoid, snmptrapoid_len,
+                             vptr->name, vptr->name_length) == 0) {
+            netsnmp_set_row_column(row, COLUMN_NLMLOGNOTIFICATIONID,
+                                   ASN_OBJECT_ID, vptr->val.string,
+                                   vptr->val_len);
+
+        } else {
+            netsnmp_table_row *myrow;
+            myrow = netsnmp_create_table_data_row();
+
+            /*
+             * indexes to the table 
+             */
+            netsnmp_table_row_add_index(myrow, ASN_OCTET_STR, "default",
+                                        strlen("default"));
+            netsnmp_table_row_add_index(myrow, ASN_UNSIGNED, &default_num,
+                                        sizeof(default_num));
+            vbcount++;
+            netsnmp_table_row_add_index(myrow, ASN_UNSIGNED, &vbcount,
+                                        sizeof(vbcount));
+
+            /*
+             * OID 
+             */
+            netsnmp_set_row_column(myrow, COLUMN_NLMLOGVARIABLEID,
+                                   ASN_OBJECT_ID, (u_char *) vptr->name,
+                                   vptr->name_length * sizeof(oid));
+
+            /*
+             * value 
+             */
+            switch (vptr->type) {
+            case ASN_OBJECT_ID:
+                tmpul = 7;
+                col = COLUMN_NLMLOGVARIABLEOIDVAL;
+                break;
+
+            case ASN_INTEGER:
+                tmpul = 4;
+                col = COLUMN_NLMLOGVARIABLEINTEGER32VAL;
+                break;
+
+            case ASN_UNSIGNED:
+                tmpul = 2;
+                col = COLUMN_NLMLOGVARIABLEUNSIGNED32VAL;
+                break;
+
+            case ASN_COUNTER:
+                tmpul = 1;
+                col = COLUMN_NLMLOGVARIABLECOUNTER32VAL;
+                break;
+
+            case ASN_TIMETICKS:
+                tmpul = 3;
+                col = COLUMN_NLMLOGVARIABLETIMETICKSVAL;
+                break;
+
+            case ASN_OCTET_STR:
+                tmpul = 6;
+                col = COLUMN_NLMLOGVARIABLEOCTETSTRINGVAL;
+                break;
+
+            default:
+                /*
+                 * unsupported 
+                 */
+                DEBUGMSGTL(("log_notification",
+                            "skipping type %d\n", vptr->type));
+                continue;
+            }
+            netsnmp_set_row_column(myrow, COLUMN_NLMLOGVARIABLEVALUETYPE,
+                                   ASN_INTEGER, (u_char *) & tmpul,
+                                   sizeof(tmpul));
+            netsnmp_set_row_column(myrow, col, vptr->type,
+                                   vptr->val.string, vptr->val_len);
+            DEBUGMSGTL(("log_notification",
+                        "adding a row to the variables table\n"));
+            netsnmp_table_dataset_add_row(nlmLogVarTable, myrow);
+        }
+    }
+
+    /*
+     * store the row 
+     */
+    netsnmp_table_dataset_add_row(nlmLogTable, row);
+
+    check_log_size(0, NULL);
+    DEBUGMSGTL(("log_notification", "done logging something\n"));
+}
+
+/** handles requests for the nlmLogTable table, if anything else needs to be done */
+int
+nlmLogTable_handler(netsnmp_mib_handler *handler,
+                    netsnmp_handler_registration *reginfo,
+                    netsnmp_agent_request_info *reqinfo,
+                    netsnmp_request_info *requests)
+{
+    /*
+     * perform anything here that you need to do.  The requests have
+     * already been processed by the master table_dataset handler, but
+     * this gives you chance to act on the request in some other way if
+     * need be. 
+     */
+    return SNMP_ERR_NOERROR;
+}
+
+/** handles requests for the nlmLogVariableTable table, if anything else needs to be done */
+int
+nlmLogVariableTable_handler(netsnmp_mib_handler *handler,
+                            netsnmp_handler_registration *reginfo,
+                            netsnmp_agent_request_info *reqinfo,
+                            netsnmp_request_info *requests)
+{
+    /*
+     * perform anything here that you need to do.  The requests have
+     * already been processed by the master table_dataset handler, but
+     * this gives you chance to act on the request in some other way if
+     * need be. 
+     */
+    return SNMP_ERR_NOERROR;
+}
diff -Naur tomato/release/src/router/snmp/apps/notification_log.h tomato121/release/src/router/snmp/apps/notification_log.h
--- tomato/release/src/router/snmp/apps/notification_log.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/apps/notification_log.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,47 @@
+#ifndef NOTIFICATION_LOG_H
+#define NOTIFICATION_LOG_H
+#include <net-snmp/agent/agent_handler.h>
+
+/*
+ * function declarations 
+ */
+void            init_notification_log(void);
+Netsnmp_Node_Handler nlmLogTable_handler;
+Netsnmp_Node_Handler nlmLogVariableTable_handler;
+
+void
+                log_notification(struct hostent *host, netsnmp_pdu *pdu,
+                                 netsnmp_transport *transport);
+
+#define NETSNMP_DS_APP_DONT_LOG    9    /* must match notification_log. */
+
+/*
+ * column number definitions for table nlmLogTable 
+ */
+#define COLUMN_NLMLOGINDEX		1
+#define COLUMN_NLMLOGTIME		2
+#define COLUMN_NLMLOGDATEANDTIME		3
+#define COLUMN_NLMLOGENGINEID		4
+#define COLUMN_NLMLOGENGINETADDRESS		5
+#define COLUMN_NLMLOGENGINETDOMAIN		6
+#define COLUMN_NLMLOGCONTEXTENGINEID		7
+#define COLUMN_NLMLOGCONTEXTNAME		8
+#define COLUMN_NLMLOGNOTIFICATIONID		9
+
+/*
+ * column number definitions for table nlmLogVariableTable 
+ */
+#define COLUMN_NLMLOGVARIABLEINDEX		1
+#define COLUMN_NLMLOGVARIABLEID		2
+#define COLUMN_NLMLOGVARIABLEVALUETYPE		3
+#define COLUMN_NLMLOGVARIABLECOUNTER32VAL		4
+#define COLUMN_NLMLOGVARIABLEUNSIGNED32VAL		5
+#define COLUMN_NLMLOGVARIABLETIMETICKSVAL		6
+#define COLUMN_NLMLOGVARIABLEINTEGER32VAL		7
+#define COLUMN_NLMLOGVARIABLEOCTETSTRINGVAL		8
+#define COLUMN_NLMLOGVARIABLEIPADDRESSVAL		9
+#define COLUMN_NLMLOGVARIABLEOIDVAL		10
+#define COLUMN_NLMLOGVARIABLECOUNTER64VAL		11
+#define COLUMN_NLMLOGVARIABLEOPAQUEVAL		12
+
+#endif                          /* NOTIFICATION_LOG_H */
diff -Naur tomato/release/src/router/snmp/apps/snmpbulkget.c tomato121/release/src/router/snmp/apps/snmpbulkget.c
--- tomato/release/src/router/snmp/apps/snmpbulkget.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/apps/snmpbulkget.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,259 @@
+/*
+ * snmpbulkget.c - send SNMPv2 Bulk requests to a network entity.
+ *
+ */
+/*********************************************************************
+	Copyright 1988, 1989, 1991, 1992 by Carnegie Mellon University
+
+                      All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its 
+documentation for any purpose and without fee is hereby granted, 
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in 
+supporting documentation, and that the name of CMU not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.  
+
+CMU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+CMU BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+**********************************************************************/
+#include <net-snmp/net-snmp-config.h>
+
+#if HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#if HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#if HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+#include <net-snmp/utilities.h>
+#include <sys/types.h>
+#if HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+#if TIME_WITH_SYS_TIME
+# ifdef WIN32
+#  include <sys/timeb.h>
+# else
+#  include <sys/time.h>
+# endif
+# include <time.h>
+#else
+# if HAVE_SYS_TIME_H
+#  include <sys/time.h>
+# else
+#  include <time.h>
+# endif
+#endif
+#if HAVE_SYS_SELECT_H
+#include <sys/select.h>
+#endif
+#include <stdio.h>
+#include <ctype.h>
+#if HAVE_WINSOCK_H
+#include <winsock.h>
+#endif
+#if HAVE_NETDB_H
+#include <netdb.h>
+#endif
+#if HAVE_ARPA_INET_H
+#include <arpa/inet.h>
+#endif
+
+#include <net-snmp/net-snmp-includes.h>
+
+oid             objid_mib[] = { 1, 3, 6, 1, 2, 1 };
+int             max_repetitions = 10;
+int             non_repeaters = 0;
+struct nameStruct {
+    oid             name[MAX_OID_LEN];
+    size_t          name_len;
+}              *name, *namep;
+int             names;
+
+void
+usage(void)
+{
+    fprintf(stderr, "USAGE: snmpbulkget ");
+    snmp_parse_args_usage(stderr);
+    fprintf(stderr, " OID [OID]...\n\n");
+    snmp_parse_args_descriptions(stderr);
+    fprintf(stderr,
+            "  -C APPOPTS\t\tSet various application specific behaviours:\n");
+    fprintf(stderr, "\t\t\t  n<NUM>:  set non-repeaters to <NUM>\n");
+    fprintf(stderr, "\t\t\t  r<NUM>:  set max-repeaters to <NUM>\n");
+}
+
+static
+    void
+optProc(int argc, char *const *argv, int opt)
+{
+    char           *endptr = NULL;
+
+    switch (opt) {
+    case 'C':
+        while (*optarg) {
+            switch (*optarg++) {
+            case 'n':
+            case 'r':
+                if (*(optarg - 1) == 'r') {
+                    max_repetitions = strtol(optarg, &endptr, 0);
+                } else {
+                    non_repeaters = strtol(optarg, &endptr, 0);
+                }
+
+                if (endptr == optarg) {
+                    /*
+                     * No number given -- error.  
+                     */
+                    usage();
+                    exit(1);
+                } else {
+                    optarg = endptr;
+                    if (isspace(*optarg)) {
+                        return;
+                    }
+                }
+                break;
+
+            default:
+                fprintf(stderr, "Unknown flag passed to -C: %c\n",
+                        optarg[-1]);
+                exit(1);
+            }
+        }
+    }
+}
+
+int
+main(int argc, char *argv[])
+{
+    netsnmp_session session, *ss;
+    netsnmp_pdu    *pdu;
+    netsnmp_pdu    *response;
+    netsnmp_variable_list *vars;
+    int             arg;
+    int             count;
+    int             running;
+    int             status;
+    int             exitval = 0;
+
+    /*
+     * get the common command line arguments 
+     */
+    switch (arg = snmp_parse_args(argc, argv, &session, "C:", optProc)) {
+    case -2:
+        exit(0);
+    case -1:
+        usage();
+        exit(1);
+    default:
+        break;
+    }
+
+    names = argc - arg;
+    if (names < non_repeaters) {
+        fprintf(stderr, "snmpbulkget: need more objects than <nonrep>\n");
+        exit(1);
+    }
+
+    namep = name = (struct nameStruct *) calloc(names, sizeof(*name));
+    while (arg < argc) {
+        namep->name_len = MAX_OID_LEN;
+        if (snmp_parse_oid(argv[arg], namep->name, &namep->name_len) ==
+            NULL) {
+            snmp_perror(argv[arg]);
+            exit(1);
+        }
+        arg++;
+        namep++;
+    }
+
+    SOCK_STARTUP;
+
+    /*
+     * open an SNMP session 
+     */
+    ss = snmp_open(&session);
+    if (ss == NULL) {
+        /*
+         * diagnose snmp_open errors with the input netsnmp_session pointer 
+         */
+        snmp_sess_perror("snmpbulkget", &session);
+        SOCK_CLEANUP;
+        exit(1);
+    }
+
+    /*
+     * create PDU for GETBULK request and add object name to request 
+     */
+    pdu = snmp_pdu_create(SNMP_MSG_GETBULK);
+    pdu->non_repeaters = non_repeaters;
+    pdu->max_repetitions = max_repetitions;     /* fill the packet */
+    for (arg = 0; arg < names; arg++)
+        snmp_add_null_var(pdu, name[arg].name, name[arg].name_len);
+
+    /*
+     * do the request 
+     */
+    status = snmp_synch_response(ss, pdu, &response);
+    if (status == STAT_SUCCESS) {
+        if (response->errstat == SNMP_ERR_NOERROR) {
+            /*
+             * check resulting variables 
+             */
+            for (vars = response->variables; vars;
+                 vars = vars->next_variable)
+                print_variable(vars->name, vars->name_length, vars);
+        } else {
+            /*
+             * error in response, print it 
+             */
+            running = 0;
+            if (response->errstat == SNMP_ERR_NOSUCHNAME) {
+                printf("End of MIB.\n");
+            } else {
+                fprintf(stderr, "Error in packet.\nReason: %s\n",
+                        snmp_errstring(response->errstat));
+                if (response->errindex != 0) {
+                    fprintf(stderr, "Failed object: ");
+                    for (count = 1, vars = response->variables;
+                         vars && (count != response->errindex);
+                         vars = vars->next_variable, count++)
+                        /*EMPTY*/;
+                    if (vars)
+                        fprint_objid(stderr, vars->name,
+                                     vars->name_length);
+                    fprintf(stderr, "\n");
+                }
+                exitval = 2;
+            }
+        }
+    } else if (status == STAT_TIMEOUT) {
+        fprintf(stderr, "Timeout: No Response from %s\n",
+                session.peername);
+        running = 0;
+        exitval = 1;
+    } else {                    /* status == STAT_ERROR */
+        snmp_sess_perror("snmpbulkget", ss);
+        running = 0;
+        exitval = 1;
+    }
+
+    if (response)
+        snmp_free_pdu(response);
+
+    snmp_close(ss);
+    SOCK_CLEANUP;
+    return exitval;
+}
diff -Naur tomato/release/src/router/snmp/apps/snmpbulkwalk.c tomato121/release/src/router/snmp/apps/snmpbulkwalk.c
--- tomato/release/src/router/snmp/apps/snmpbulkwalk.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/apps/snmpbulkwalk.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,391 @@
+/*
+ * snmpbulkwalk.c - send SNMPv2 Bulk requests to a network entity, walking a
+ * subtree.
+ *
+ */
+/*********************************************************************
+	Copyright 1988, 1989, 1991, 1992 by Carnegie Mellon University
+
+                      All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its 
+documentation for any purpose and without fee is hereby granted, 
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in 
+supporting documentation, and that the name of CMU not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.  
+
+CMU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+CMU BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+**********************************************************************/
+#include <net-snmp/net-snmp-config.h>
+
+#if HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#if HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#if HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+#include <sys/types.h>
+#if HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+#if TIME_WITH_SYS_TIME
+# ifdef WIN32
+#  include <sys/timeb.h>
+# else
+#  include <sys/time.h>
+# endif
+# include <time.h>
+#else
+# if HAVE_SYS_TIME_H
+#  include <sys/time.h>
+# else
+#  include <time.h>
+# endif
+#endif
+#if HAVE_SYS_SELECT_H
+#include <sys/select.h>
+#endif
+#include <stdio.h>
+#include <ctype.h>
+#if HAVE_WINSOCK_H
+#include <winsock.h>
+#endif
+#if HAVE_NETDB_H
+#include <netdb.h>
+#endif
+#if HAVE_ARPA_INET_H
+#include <arpa/inet.h>
+#endif
+
+#include <net-snmp/net-snmp-includes.h>
+
+#define NETSNMP_DS_WALK_INCLUDE_REQUESTED		1
+#define NETSNMP_DS_WALK_PRINT_STATISTICS		2
+#define NETSNMP_DS_WALK_DONT_CHECK_LEXICOGRAPHIC	3
+
+oid             objid_mib[] = { 1, 3, 6, 1, 2, 1 };
+int             numprinted = 0;
+int             reps = 10, non_reps = 0;
+
+void
+usage(void)
+{
+    fprintf(stderr, "USAGE: snmpbulkwalk ");
+    snmp_parse_args_usage(stderr);
+    fprintf(stderr, " [OID]\n\n");
+    snmp_parse_args_descriptions(stderr);
+    fprintf(stderr,
+            "  -C APPOPTS\t\tSet various application specific behaviours:\n");
+    fprintf(stderr,
+            "\t\t\t  c:       do not check returned OIDs are increasing\n");
+    fprintf(stderr,
+            "\t\t\t  i:       include given OIDs in the search range\n");
+    fprintf(stderr, "\t\t\t  n<NUM>:  set non-repeaters to <NUM>\n");
+    fprintf(stderr,
+            "\t\t\t  p:       print the number of variables found\n");
+    fprintf(stderr, "\t\t\t  r<NUM>:  set max-repeaters to <NUM>\n");
+}
+
+static void
+snmp_get_and_print(netsnmp_session * ss, oid * theoid, size_t theoid_len)
+{
+    netsnmp_pdu    *pdu, *response;
+    netsnmp_variable_list *vars;
+    int             status;
+
+    pdu = snmp_pdu_create(SNMP_MSG_GET);
+    snmp_add_null_var(pdu, theoid, theoid_len);
+
+    status = snmp_synch_response(ss, pdu, &response);
+    if (status == STAT_SUCCESS && response->errstat == SNMP_ERR_NOERROR) {
+        for (vars = response->variables; vars; vars = vars->next_variable) {
+            numprinted++;
+            print_variable(vars->name, vars->name_length, vars);
+        }
+    }
+    if (response) {
+        snmp_free_pdu(response);
+    }
+}
+
+static
+    void
+optProc(int argc, char *const *argv, int opt)
+{
+    char           *endptr = NULL;
+
+    switch (opt) {
+    case 'C':
+        while (*optarg) {
+            switch (*optarg++) {
+            case 'c':
+                netsnmp_ds_toggle_boolean(NETSNMP_DS_APPLICATION_ID,
+				     NETSNMP_DS_WALK_DONT_CHECK_LEXICOGRAPHIC);
+                break;
+
+            case 'i':
+                netsnmp_ds_toggle_boolean(NETSNMP_DS_APPLICATION_ID,
+					  NETSNMP_DS_WALK_INCLUDE_REQUESTED);
+                break;
+
+            case 'n':
+            case 'r':
+                if (*(optarg - 1) == 'r') {
+                    reps = strtol(optarg, &endptr, 0);
+                } else {
+                    non_reps = strtol(optarg, &endptr, 0);
+                }
+
+                if (endptr == optarg) {
+                    /*
+                     * No number given -- error.  
+                     */
+                    usage();
+                    exit(1);
+                } else {
+                    optarg = endptr;
+                    if (isspace(*optarg)) {
+                        return;
+                    }
+                }
+                break;
+
+            case 'p':
+                netsnmp_ds_toggle_boolean(NETSNMP_DS_APPLICATION_ID,
+					  NETSNMP_DS_WALK_PRINT_STATISTICS);
+                break;
+
+            default:
+                fprintf(stderr, "Unknown flag passed to -C: %c\n",
+                        optarg[-1]);
+                exit(1);
+            }
+        }
+        break;
+    }
+}
+
+int
+main(int argc, char *argv[])
+{
+    netsnmp_session session, *ss;
+    netsnmp_pdu    *pdu, *response;
+    netsnmp_variable_list *vars;
+    int             arg;
+    oid             name[MAX_OID_LEN];
+    size_t          name_length;
+    oid             root[MAX_OID_LEN];
+    size_t          rootlen;
+    int             count;
+    int             running;
+    int             status;
+    int             check;
+    int             exitval = 0;
+
+    netsnmp_ds_register_config(ASN_BOOLEAN, "snmpwalk", "includeRequested",
+			       NETSNMP_DS_APPLICATION_ID, 
+			       NETSNMP_DS_WALK_INCLUDE_REQUESTED);
+    netsnmp_ds_register_config(ASN_BOOLEAN, "snmpwalk", "printStatistics",
+			       NETSNMP_DS_APPLICATION_ID, 
+			       NETSNMP_DS_WALK_PRINT_STATISTICS);
+    netsnmp_ds_register_config(ASN_BOOLEAN, "snmpwalk", "dontCheckOrdering",
+			       NETSNMP_DS_APPLICATION_ID,
+			       NETSNMP_DS_WALK_DONT_CHECK_LEXICOGRAPHIC);
+
+    /*
+     * get the common command line arguments 
+     */
+    switch (arg = snmp_parse_args(argc, argv, &session, "C:", optProc)) {
+    case -2:
+        exit(0);
+    case -1:
+        usage();
+        exit(1);
+    default:
+        break;
+    }
+
+    /*
+     * get the initial object and subtree 
+     */
+    if (arg < argc) {
+        /*
+         * specified on the command line 
+         */
+        rootlen = MAX_OID_LEN;
+        if (snmp_parse_oid(argv[arg], root, &rootlen) == NULL) {
+            snmp_perror(argv[arg]);
+            exit(1);
+        }
+    } else {
+        /*
+         * use default value 
+         */
+        memmove(root, objid_mib, sizeof(objid_mib));
+        rootlen = sizeof(objid_mib) / sizeof(oid);
+    }
+
+    SOCK_STARTUP;
+
+    /*
+     * open an SNMP session 
+     */
+    ss = snmp_open(&session);
+    if (ss == NULL) {
+        /*
+         * diagnose snmp_open errors with the input netsnmp_session pointer 
+         */
+        snmp_sess_perror("snmpbulkwalk", &session);
+        SOCK_CLEANUP;
+        exit(1);
+    }
+
+    /*
+     * setup initial object name 
+     */
+    memmove(name, root, rootlen * sizeof(oid));
+    name_length = rootlen;
+
+    running = 1;
+
+    check = !netsnmp_ds_get_boolean(NETSNMP_DS_APPLICATION_ID,
+				    NETSNMP_DS_WALK_DONT_CHECK_LEXICOGRAPHIC);
+    if (netsnmp_ds_get_boolean(NETSNMP_DS_APPLICATION_ID,
+			       NETSNMP_DS_WALK_INCLUDE_REQUESTED)) {
+        snmp_get_and_print(ss, root, rootlen);
+    }
+
+    while (running) {
+        /*
+         * create PDU for GETBULK request and add object name to request 
+         */
+        pdu = snmp_pdu_create(SNMP_MSG_GETBULK);
+        pdu->non_repeaters = non_reps;
+        pdu->max_repetitions = reps;    /* fill the packet */
+        snmp_add_null_var(pdu, name, name_length);
+
+        /*
+         * do the request 
+         */
+        status = snmp_synch_response(ss, pdu, &response);
+        if (status == STAT_SUCCESS) {
+            if (response->errstat == SNMP_ERR_NOERROR) {
+                /*
+                 * check resulting variables 
+                 */
+                for (vars = response->variables; vars;
+                     vars = vars->next_variable) {
+                    if ((vars->name_length < rootlen)
+                        || (memcmp(root, vars->name, rootlen * sizeof(oid))
+                            != 0)) {
+                        /*
+                         * not part of this subtree 
+                         */
+                        running = 0;
+                        continue;
+                    }
+                    numprinted++;
+                    print_variable(vars->name, vars->name_length, vars);
+                    if ((vars->type != SNMP_ENDOFMIBVIEW) &&
+                        (vars->type != SNMP_NOSUCHOBJECT) &&
+                        (vars->type != SNMP_NOSUCHINSTANCE)) {
+                        /*
+                         * not an exception value 
+                         */
+                        if (check
+                            && snmp_oid_compare(name, name_length,
+                                                vars->name,
+                                                vars->name_length) >= 0) {
+                            fprintf(stderr, "Error: OID not increasing: ");
+                            fprint_objid(stderr, name, name_length);
+                            fprintf(stderr, " >= ");
+                            fprint_objid(stderr, vars->name,
+                                         vars->name_length);
+                            fprintf(stderr, "\n");
+                            running = 0;
+                            exitval = 1;
+                        }
+                        /*
+                         * Check if last variable, and if so, save for next request.  
+                         */
+                        if (vars->next_variable == NULL) {
+                            memmove(name, vars->name,
+                                    vars->name_length * sizeof(oid));
+                            name_length = vars->name_length;
+                        }
+                    } else {
+                        /*
+                         * an exception value, so stop 
+                         */
+                        running = 0;
+                    }
+                }
+            } else {
+                /*
+                 * error in response, print it 
+                 */
+                running = 0;
+                if (response->errstat == SNMP_ERR_NOSUCHNAME) {
+                    printf("End of MIB\n");
+                } else {
+                    fprintf(stderr, "Error in packet.\nReason: %s\n",
+                            snmp_errstring(response->errstat));
+                    if (response->errindex != 0) {
+                        fprintf(stderr, "Failed object: ");
+                        for (count = 1, vars = response->variables;
+                             vars && count != response->errindex;
+                             vars = vars->next_variable, count++)
+                            /*EMPTY*/;
+                        if (vars)
+                            fprint_objid(stderr, vars->name,
+                                         vars->name_length);
+                        fprintf(stderr, "\n");
+                    }
+                    exitval = 2;
+                }
+            }
+        } else if (status == STAT_TIMEOUT) {
+            fprintf(stderr, "Timeout: No Response from %s\n",
+                    session.peername);
+            running = 0;
+            exitval = 1;
+        } else {                /* status == STAT_ERROR */
+            snmp_sess_perror("snmpbulkwalk", ss);
+            running = 0;
+            exitval = 1;
+        }
+        if (response)
+            snmp_free_pdu(response);
+    }
+
+    if (numprinted == 0 && status == STAT_SUCCESS) {
+        /*
+         * no printed successful results, which may mean we were
+         * pointed at an only existing instance.  Attempt a GET, just
+         * for get measure. 
+         */
+        snmp_get_and_print(ss, root, rootlen);
+    }
+    snmp_close(ss);
+
+    if (netsnmp_ds_get_boolean(NETSNMP_DS_APPLICATION_ID, 
+			       NETSNMP_DS_WALK_PRINT_STATISTICS)) {
+        printf("Variables found: %d\n", numprinted);
+    }
+
+    SOCK_CLEANUP;
+    return exitval;
+}
diff -Naur tomato/release/src/router/snmp/apps/snmpdelta.c tomato121/release/src/router/snmp/apps/snmpdelta.c
--- tomato/release/src/router/snmp/apps/snmpdelta.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/apps/snmpdelta.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,731 @@
+/*
+ * snmpdelta.c - Monitor deltas of integer valued SNMP variables
+ *
+ */
+/**********************************************************************
+ *
+ *           Copyright 1996 by Carnegie Mellon University
+ * 
+ *                       All Rights Reserved
+ * 
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation for any purpose and without fee is hereby granted,
+ * provided that the above copyright notice appear in all copies and that
+ * both that copyright notice and this permission notice appear in
+ * supporting documentation, and that the name of CMU not be
+ * used in advertising or publicity pertaining to distribution of the
+ * software without specific, written prior permission.
+ * 
+ * CMU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+ * CMU BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+ * SOFTWARE.
+ * 
+ **********************************************************************/
+
+#include <net-snmp/net-snmp-config.h>
+
+#if HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#if HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#if HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+#include <sys/types.h>
+#if HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+#include <stdio.h>
+#include <ctype.h>
+#if TIME_WITH_SYS_TIME
+# ifdef WIN32
+#  include <sys/timeb.h>
+# else
+#  include <sys/time.h>
+# endif
+# include <time.h>
+#else
+# if HAVE_SYS_TIME_H
+#  include <sys/time.h>
+# else
+#  include <time.h>
+# endif
+#endif
+#if HAVE_SYS_SELECT_H
+#include <sys/select.h>
+#endif
+#if HAVE_WINSOCK_H
+#include <winsock.h>
+#endif
+#if HAVE_NETDB_H
+#include <netdb.h>
+#endif
+#if HAVE_ARPA_INET_H
+#include <arpa/inet.h>
+#endif
+
+#include <net-snmp/net-snmp-includes.h>
+
+#define MAX_ARGS 256
+#define NETSNMP_DS_APP_DONT_FIX_PDUS 0
+
+const char     *SumFile = "Sum";
+
+/*
+ * Information about the handled variables 
+ */
+struct varInfo {
+    char           *name;
+    oid            *info_oid;
+    int             type;
+    size_t          oidlen;
+    char            descriptor[64];
+    u_int           value;
+    struct counter64 c64value;
+    float           max;
+    time_t          time;
+    int             peak_count;
+    float           peak;
+    float           peak_average;
+    int             spoiled;
+};
+
+struct varInfo  varinfo[128];
+int             current_name = 0;
+int             period = 1;
+int             deltat = 0, timestamp = 0, fileout = 0, dosum =
+    0, printmax = 0;
+int             keepSeconds = 0, peaks = 0;
+int             tableForm = 0;
+int             varbindsPerPacket = 60;
+
+void            processFileArgs(char *fileName);
+
+void
+usage(void)
+{
+    fprintf(stderr,
+            "Usage: snmpdelta [-Cf] [-CF commandFile] [-Cl] [-CL SumFileName]\n\t[-Cs] [-Ck] [-Ct] [-CS] [-Cv vars/pkt] [-Cp period]\n\t[-CP peaks] ");
+    snmp_parse_args_usage(stderr);
+    fprintf(stderr, " oid [oid ...]\n");
+    snmp_parse_args_descriptions(stderr);
+    fprintf(stderr, "snmpdelta specific options\n");
+    fprintf(stderr, "  -Cf\t\tDon't fix errors and retry the request.\n");
+    fprintf(stderr, "  -Cl\t\twrite configuration to file\n");
+    fprintf(stderr, "  -CF config\tload configuration from file\n");
+    fprintf(stderr, "  -Cp period\tspecifies the poll period\n");
+    fprintf(stderr, "  -CP peaks\treporting period in poll periods\n");
+    fprintf(stderr, "  -Cv vars/pkt\tnumber of variables per packet\n");
+    fprintf(stderr, "  -Ck\t\tkeep seconds in output time\n");
+    fprintf(stderr, "  -Cm\t\tshow max values\n");
+    fprintf(stderr, "  -CS\t\tlog to a sum file\n");
+    fprintf(stderr, "  -Cs\t\tshow timestamps\n");
+    fprintf(stderr, "  -Ct\t\tget timing from agent\n");
+    fprintf(stderr, "  -CT\t\tprint output in tabular form\n");
+    fprintf(stderr, "  -CL sumfile\tspecifies the sum file name\n");
+}
+
+static void
+optProc(int argc, char *const *argv, int opt)
+{
+    switch (opt) {
+    case 'C':
+        while (*optarg) {
+            switch ((opt = *optarg++)) {
+            case 'f':
+                netsnmp_ds_toggle_boolean(NETSNMP_DS_APPLICATION_ID,
+					  NETSNMP_DS_APP_DONT_FIX_PDUS);
+                break;
+            case 'p':
+                period = atoi(argv[optind++]);
+                break;
+            case 'P':
+                peaks = atoi(argv[optind++]);
+                break;
+            case 'v':
+                varbindsPerPacket = atoi(argv[optind++]);
+                break;
+            case 't':
+                deltat = 1;
+                break;
+            case 's':
+                timestamp = 1;
+                break;
+            case 'S':
+                dosum = 1;
+                break;
+            case 'm':
+                printmax = 1;
+                break;
+            case 'F':
+                processFileArgs(argv[optind++]);
+                break;
+            case 'l':
+                fileout = 1;
+                break;
+            case 'L':
+                SumFile = argv[optind++];
+                break;
+            case 'k':
+                keepSeconds = 1;
+                break;
+            case 'T':
+                tableForm = 1;
+                break;
+            default:
+                fprintf(stderr, "Bad -C options: %c\n", opt);
+                exit(1);
+            }
+        }
+        break;
+    }
+}
+
+int
+wait_for_peak_start(int period, int peak)
+{
+    struct timeval  m_time, *tv = &m_time;
+    struct tm       tm;
+    time_t          SecondsAtNextHour;
+    int             target = 0;
+    int             seconds;
+
+    seconds = period * peak;
+
+    /*
+     * Find the current time 
+     */
+    gettimeofday(tv, (struct timezone *) 0);
+
+    /*
+     * Create a tm struct from it 
+     */
+    memcpy(&tm, localtime((time_t *) & tv->tv_sec), sizeof(tm));
+
+    /*
+     * Calculate the next hour 
+     */
+    tm.tm_sec = 0;
+    tm.tm_min = 0;
+    tm.tm_hour++;
+    SecondsAtNextHour = mktime(&tm);
+
+    /*
+     * Now figure out the amount of time to sleep 
+     */
+    target = (SecondsAtNextHour - tv->tv_sec) % seconds;
+
+    return target;
+}
+
+void
+print_log(char *file, char *message)
+{
+    FILE           *fp;
+
+    fp = fopen(file, "a");
+    if (fp == NULL) {
+        fprintf(stderr, "Couldn't open %s\n", file);
+        return;
+    }
+    fprintf(fp, "%s\n", message);
+    fclose(fp);
+}
+
+void
+sprint_descriptor(char *buffer, struct varInfo *vip)
+{
+    u_char         *buf = NULL, *cp = NULL;
+    size_t          buf_len = 0, out_len = 0;
+
+    if (!sprint_realloc_objid(&buf, &buf_len, &out_len, 1,
+                              vip->info_oid, vip->oidlen)) {
+        if (buf != NULL) {
+            free(buf);
+        }
+        return;
+    }
+
+    for (cp = buf; *cp; cp++);
+    while (cp >= buf) {
+        if (isalpha(*cp))
+            break;
+        cp--;
+    }
+    while (cp >= buf) {
+        if (*cp == '.')
+            break;
+        cp--;
+    }
+    cp++;
+    if (cp < buf)
+        cp = buf;
+    strcpy(buffer, cp);
+
+    if (buf != NULL) {
+        free(buf);
+    }
+}
+
+void
+processFileArgs(char *fileName)
+{
+    FILE           *fp;
+    char            buf[260] = { 0 }, *cp;
+    int             blank, linenumber = 0;
+
+    fp = fopen(fileName, "r");
+    if (fp == NULL)
+        return;
+    while (fgets(buf, sizeof(buf), fp)) {
+        linenumber++;
+        if (strlen(buf) > (sizeof(buf) - 2)) {
+            fprintf(stderr, "Line too long on line %d of %s\n",
+                    linenumber, fileName);
+            exit(1);
+        }
+        if (buf[0] == '#')
+            continue;
+        blank = TRUE;
+        for (cp = buf; *cp; cp++)
+            if (!isspace(*cp)) {
+                blank = FALSE;
+                break;
+            }
+        if (blank)
+            continue;
+        buf[strlen(buf) - 1] = 0;
+        varinfo[current_name++].name = strdup(buf);
+    }
+    fclose(fp);
+    return;
+}
+
+void
+wait_for_period(int period)
+{
+    struct timeval  m_time, *tv = &m_time;
+    struct tm       tm;
+    int             count;
+    static int      target = 0;
+    time_t          nexthour;
+
+    gettimeofday(tv, (struct timezone *) 0);
+
+    if (target) {
+        target += period;
+    } else {
+        memcpy(&tm, localtime((time_t *) & tv->tv_sec), sizeof(tm));
+        tm.tm_sec = 0;
+        tm.tm_min = 0;
+        tm.tm_hour++;
+        nexthour = mktime(&tm);
+
+        target = (nexthour - tv->tv_sec) % period;
+        if (target == 0)
+            target = period;
+        target += tv->tv_sec;
+    }
+
+    tv->tv_sec = target - tv->tv_sec;
+    if (tv->tv_usec != 0) {
+        tv->tv_sec--;
+        tv->tv_usec = 1000000 - tv->tv_usec;
+    }
+    if (tv->tv_sec < 0) {
+        /*
+         * ran out of time, schedule immediately 
+         */
+        tv->tv_sec = 0;
+        tv->tv_usec = 0;
+    }
+    count = 1;
+    while (count != 0) {
+        count = select(0, 0, 0, 0, tv);
+        switch (count) {
+        case 0:
+            break;
+        case -1:
+            /*
+             * FALLTHRU 
+             */
+        default:
+            snmp_log_perror("select");
+            break;
+        }
+    }
+}
+
+oid             sysUpTimeOid[9] = { 1, 3, 6, 1, 2, 1, 1, 3, 0 };
+size_t          sysUpTimeLen = 9;
+
+int
+main(int argc, char *argv[])
+{
+    netsnmp_session session, *ss;
+    netsnmp_pdu    *pdu, *response;
+    netsnmp_variable_list *vars;
+    int             arg;
+    char           *gateway;
+
+    int             count;
+    struct varInfo *vip;
+    u_int           value = 0;
+    struct counter64 c64value;
+    float           printvalue;
+    time_t          last_time = 0;
+    time_t          this_time;
+    time_t          delta_time;
+    int             sum;        /* what the heck is this for, its never used? */
+    char            filename[128] = { 0 };
+    struct timeval  tv;
+    struct tm       tm;
+    char            timestring[64] = { 0 }, valueStr[64] = {
+    0}, maxStr[64] = {
+    0};
+    char            outstr[256] = { 0 }, peakStr[64] = {
+    0};
+    int             status;
+    int             begin, end, last_end;
+    int             print = 1;
+    int             exit_code = 0;
+
+    switch (arg = snmp_parse_args(argc, argv, &session, "C:", &optProc)) {
+    case -2:
+        exit(0);
+    case -1:
+        usage();
+        exit(1);
+    default:
+        break;
+    }
+
+    gateway = session.peername;
+
+    for (; optind < argc; optind++)
+        varinfo[current_name++].name = argv[optind];
+
+    if (current_name == 0) {
+        usage();
+        exit(1);
+    }
+
+    if (dosum) {
+        varinfo[current_name++].name = 0;
+    }
+
+    SOCK_STARTUP;
+
+    /*
+     * open an SNMP session 
+     */
+    ss = snmp_open(&session);
+    if (ss == NULL) {
+        /*
+         * diagnose snmp_open errors with the input netsnmp_session pointer 
+         */
+        snmp_sess_perror("snmpdelta", &session);
+        SOCK_CLEANUP;
+        exit(1);
+    }
+
+    if (tableForm && timestamp) {
+        printf("%s", gateway);
+    }
+    for (count = 0; count < current_name; count++) {
+        vip = varinfo + count;
+        if (vip->name) {
+            vip->oidlen = MAX_OID_LEN;
+            vip->info_oid = (oid *) malloc(sizeof(oid) * vip->oidlen);
+            if (snmp_parse_oid(vip->name, vip->info_oid, &vip->oidlen) ==
+                NULL) {
+                snmp_perror(vip->name);
+                SOCK_CLEANUP;
+                exit(1);
+            }
+            sprint_descriptor(vip->descriptor, vip);
+            if (tableForm)
+                printf("\t%s", vip->descriptor);
+        } else {
+            vip->oidlen = 0;
+            strcpy(vip->descriptor, SumFile);
+        }
+        vip->value = 0;
+        zeroU64(&vip->c64value);
+        vip->time = 0;
+        vip->max = 0;
+        if (peaks) {
+            vip->peak_count = -1;
+            vip->peak = 0;
+            vip->peak_average = 0;
+        }
+    }
+
+    wait_for_period(period);
+
+    end = current_name;
+    sum = 0;
+    while (1) {
+        pdu = snmp_pdu_create(SNMP_MSG_GET);
+
+        if (deltat)
+            snmp_add_null_var(pdu, sysUpTimeOid, sysUpTimeLen);
+
+        if (end == current_name)
+            count = 0;
+        else
+            count = end;
+        begin = count;
+        for (; count < current_name
+             && count < begin + varbindsPerPacket - deltat; count++) {
+            if (varinfo[count].oidlen)
+                snmp_add_null_var(pdu, varinfo[count].info_oid,
+                                  varinfo[count].oidlen);
+        }
+        last_end = end;
+        end = count;
+
+      retry:
+        status = snmp_synch_response(ss, pdu, &response);
+        if (status == STAT_SUCCESS) {
+            if (response->errstat == SNMP_ERR_NOERROR) {
+                if (timestamp) {
+                    gettimeofday(&tv, (struct timezone *) 0);
+                    memcpy(&tm, localtime((time_t *) & tv.tv_sec),
+                           sizeof(tm));
+                    if (((period % 60)
+                         && (!peaks || ((period * peaks) % 60)))
+                        || keepSeconds)
+                        sprintf(timestring, " [%02d:%02d:%02d %d/%d]",
+                                tm.tm_hour, tm.tm_min, tm.tm_sec,
+                                tm.tm_mon + 1, tm.tm_mday);
+                    else
+                        sprintf(timestring, " [%02d:%02d %d/%d]",
+                                tm.tm_hour, tm.tm_min,
+                                tm.tm_mon + 1, tm.tm_mday);
+                }
+
+                vars = response->variables;
+                if (deltat) {
+                    if (!vars) {
+                        fprintf(stderr, "Missing variable in reply\n");
+                        continue;
+                    } else {
+                        this_time = *(vars->val.integer);
+                    }
+                    vars = vars->next_variable;
+                } else {
+                    this_time = 1;
+                }
+
+                for (count = begin; count < end; count++) {
+                    vip = varinfo + count;
+
+                    if (vip->oidlen) {
+                        if (!vars) {
+                            fprintf(stderr, "Missing variable in reply\n");
+                            break;
+                        }
+                        vip->type = vars->type;
+                        if (vars->type == ASN_COUNTER64) {
+                            u64Subtract(vars->val.counter64,
+                                        &vip->c64value, &c64value);
+                            memcpy(&vip->c64value, vars->val.counter64,
+                                   sizeof(struct counter64));
+                        } else {
+                            value = *(vars->val.integer) - vip->value;
+                            vip->value = *(vars->val.integer);
+                        }
+                        vars = vars->next_variable;
+                    } else {
+                        value = sum;
+                        sum = 0;
+                    }
+                    delta_time = this_time - vip->time;
+                    if (delta_time <= 0)
+                        delta_time = 100;
+                    last_time = vip->time;
+                    vip->time = this_time;
+                    if (last_time == 0)
+                        continue;
+
+                    if (vip->oidlen && vip->type != ASN_COUNTER64) {
+                        sum += value;
+                    }
+
+                    if (tableForm) {
+                        if (count == begin) {
+                            sprintf(outstr, "%s", timestring + 1);
+                        }
+                    } else {
+                        sprintf(outstr, "%s %s", timestring,
+                                vip->descriptor);
+                    }
+
+                    if (deltat || tableForm) {
+                        if (vip->type == ASN_COUNTER64) {
+                            fprintf(stderr,
+                                    "time delta and table form not supported for counter64s\n");
+                            exit(1);
+                        } else {
+                            printvalue =
+                                ((float) value * 100) / delta_time;
+                            if (tableForm)
+                                sprintf(valueStr, "\t%.2f", printvalue);
+                            else
+                                sprintf(valueStr, " /sec: %.2f",
+                                        printvalue);
+                        }
+                    } else {
+                        printvalue = (float) value;
+                        sprintf(valueStr, " /%d sec: ", period);
+                        if (vip->type == ASN_COUNTER64)
+                            printU64(valueStr + strlen(valueStr),
+                                     &c64value);
+                        else
+                            sprintf(valueStr + strlen(valueStr), "%u",
+                                    value);
+                    }
+
+                    if (!peaks) {
+                        strcat(outstr, valueStr);
+                    } else {
+                        print = 0;
+                        if (vip->peak_count == -1) {
+                            if (wait_for_peak_start(period, peaks) == 0)
+                                vip->peak_count = 0;
+                        } else {
+                            vip->peak_average += printvalue;
+                            if (vip->peak < printvalue)
+                                vip->peak = printvalue;
+                            if (++vip->peak_count == peaks) {
+                                if (deltat)
+                                    sprintf(peakStr,
+                                            " /sec: %.2f	(%d sec Peak: %.2f)",
+                                            vip->peak_average /
+                                            vip->peak_count, period,
+                                            vip->peak);
+                                else
+                                    sprintf(peakStr,
+                                            " /%d sec: %.0f	(%d sec Peak: %.0f)",
+                                            period,
+                                            vip->peak_average /
+                                            vip->peak_count, period,
+                                            vip->peak);
+                                vip->peak_average = 0;
+                                vip->peak = 0;
+                                vip->peak_count = 0;
+                                print = 1;
+                                strcat(outstr, peakStr);
+                            }
+                        }
+                    }
+
+                    if (printmax) {
+                        if (printvalue > vip->max) {
+                            vip->max = printvalue;
+                        }
+                        if (deltat)
+                            sprintf(maxStr, "	(Max: %.2f)", vip->max);
+                        else
+                            sprintf(maxStr, "	(Max: %.0f)", vip->max);
+                        strcat(outstr, maxStr);
+                    }
+
+                    if (print) {
+                        if (fileout) {
+                            sprintf(filename, "%s-%s", gateway,
+                                    vip->descriptor);
+                            print_log(filename, outstr + 1);
+                        } else {
+                            if (tableForm)
+                                printf("%s", outstr);
+                            else
+                                printf("%s\n", outstr + 1);
+                            fflush(stdout);
+                        }
+                    }
+                }
+                if (end == last_end && tableForm)
+                    printf("\n");
+            } else {
+                if (response->errstat == SNMP_ERR_TOOBIG) {
+                    if (response->errindex <= varbindsPerPacket
+                        && response->errindex > 0) {
+                        varbindsPerPacket = response->errindex - 1;
+                    } else {
+                        if (varbindsPerPacket > 30)
+                            varbindsPerPacket -= 5;
+                        else
+                            varbindsPerPacket--;
+                    }
+                    if (varbindsPerPacket <= 0) {
+                        exit_code = 5;
+                        break;
+                    }
+                    end = last_end;
+                    continue;
+                } else if (response->errindex != 0) {
+                    fprintf(stderr, "Failed object: ");
+                    for (count = 1, vars = response->variables;
+                         vars && count != response->errindex;
+                         vars = vars->next_variable, count++);
+                    if (vars)
+                        fprint_objid(stderr, vars->name,
+                                     vars->name_length);
+                    fprintf(stderr, "\n");
+                    /*
+                     * Don't exit when OIDs from file are not found on agent
+                     * exit_code = 1;
+                     * break;
+                     */
+                } else {
+                    fprintf(stderr, "Error in packet: %s\n",
+                            snmp_errstring(response->errstat));
+                    exit_code = 1;
+                    break;
+                }
+
+                /*
+                 * retry if the errored variable was successfully removed 
+                 */
+                if (!netsnmp_ds_get_boolean(NETSNMP_DS_APPLICATION_ID, 
+					    NETSNMP_DS_APP_DONT_FIX_PDUS)) {
+                    pdu = snmp_fix_pdu(response, SNMP_MSG_GET);
+                    snmp_free_pdu(response);
+                    response = NULL;
+                    if (pdu != NULL)
+                        goto retry;
+                }
+            }
+
+        } else if (status == STAT_TIMEOUT) {
+            fprintf(stderr, "Timeout: No Response from %s\n", gateway);
+            response = 0;
+            exit_code = 1;
+            break;
+        } else {                /* status == STAT_ERROR */
+            snmp_sess_perror("snmpdelta", ss);
+            response = 0;
+            exit_code = 1;
+            break;
+        }
+
+        if (response)
+            snmp_free_pdu(response);
+        if (end == current_name) {
+            wait_for_period(period);
+        }
+    }
+    snmp_close(ss);
+    SOCK_CLEANUP;
+    return (exit_code);
+}
diff -Naur tomato/release/src/router/snmp/apps/snmpdf.c tomato121/release/src/router/snmp/apps/snmpdf.c
--- tomato/release/src/router/snmp/apps/snmpdf.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/apps/snmpdf.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,363 @@
+/*
+ * snmpget.c - send snmp GET requests to a network entity.
+ *
+ */
+/***********************************************************************
+	Copyright 1988, 1989, 1991, 1992 by Carnegie Mellon University
+
+                      All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its 
+documentation for any purpose and without fee is hereby granted, 
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in 
+supporting documentation, and that the name of CMU not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.  
+
+CMU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+CMU BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+******************************************************************/
+#include <net-snmp/net-snmp-config.h>
+
+#if HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#if HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#if HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+#include <sys/types.h>
+#if HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+#include <stdio.h>
+#include <ctype.h>
+#if TIME_WITH_SYS_TIME
+# ifdef WIN32
+#  include <sys/timeb.h>
+# else
+#  include <sys/time.h>
+# endif
+# include <time.h>
+#else
+# if HAVE_SYS_TIME_H
+#  include <sys/time.h>
+# else
+#  include <time.h>
+# endif
+#endif
+#if HAVE_SYS_SELECT_H
+#include <sys/select.h>
+#endif
+#if HAVE_WINSOCK_H
+#include <winsock.h>
+#endif
+#if HAVE_NETDB_H
+#include <netdb.h>
+#endif
+#if HAVE_ARPA_INET_H
+#include <arpa/inet.h>
+#endif
+
+#include <net-snmp/net-snmp-includes.h>
+
+int             failures = 0;
+
+void
+usage(void)
+{
+    fprintf(stderr, "Usage: snmpdf [-Cu] ");
+    snmp_parse_args_usage(stderr);
+    fprintf(stderr, "\n\n");
+    snmp_parse_args_descriptions(stderr);
+    fprintf(stderr, "\nsnmpdf options:\n");
+    fprintf(stderr,
+            "\t-Cu\tUse UCD-SNMP dskTable to do the calculations.\n");
+    fprintf(stderr,
+            "\t\t[Normally the HOST-RESOURCES-MIB is consulted first.]\n");
+}
+
+int             ucd_mib = 0;
+
+static void
+optProc(int argc, char *const *argv, int opt)
+{
+    switch (opt) {
+    case 'C':
+        while (*optarg) {
+            switch (*optarg++) {
+            case 'u':
+                ucd_mib = 1;
+                break;
+            default:
+                fprintf(stderr,
+                        "Unknown flag passed to -C: %c\n", optarg[-1]);
+                exit(1);
+            }
+        }
+    }
+}
+
+struct hrStorageTable {
+    u_long          hrStorageIndex;
+    oid            *hrStorageType;
+    char           *hrStorageDescr;
+    u_long          hrStorageAllocationUnits;
+    u_long          hrStorageSize;
+    u_long          hrStorageUsed;
+};
+
+int
+add(netsnmp_pdu *pdu, const char *mibnodename,
+    oid * index, size_t indexlen)
+{
+    oid             base[MAX_OID_LEN];
+    size_t          base_length = MAX_OID_LEN;
+
+    memset(base, 0, MAX_OID_LEN * sizeof(oid));
+
+    if (!snmp_parse_oid(mibnodename, base, &base_length)) {
+        snmp_perror(mibnodename);
+        fprintf(stderr, "couldn't find mib node %s, giving up\n",
+                mibnodename);
+        exit(1);
+    }
+
+    if (index && indexlen) {
+        memcpy(&(base[base_length]), index, indexlen * sizeof(oid));
+        base_length += indexlen;
+    }
+    DEBUGMSGTL(("add", "created: "));
+    DEBUGMSGOID(("add", base, base_length));
+    DEBUGMSG(("add", "\n"));
+    snmp_add_null_var(pdu, base, base_length);
+
+    return base_length;
+}
+
+netsnmp_variable_list *
+collect(netsnmp_session * ss, netsnmp_pdu *pdu,
+        oid * base, size_t base_length)
+{
+    netsnmp_pdu    *response;
+    int             running = 1;
+    netsnmp_variable_list *saved = NULL, **vlpp = &saved;
+    int             status;
+
+    while (running) {
+        /*
+         * gotta catch em all, gotta catch em all! 
+         */
+        status = snmp_synch_response(ss, pdu, &response);
+        if (status != STAT_SUCCESS || !response) {
+            snmp_sess_perror("snmpdf", ss);
+            exit(1);
+        }
+        if (response && snmp_oid_compare(response->variables->name,
+                                         SNMP_MIN(base_length,
+                                                  response->variables->
+                                                  name_length), base,
+                                         base_length) != 0)
+            running = 0;
+        else {
+            /*
+             * get response 
+             */
+            *vlpp = response->variables;
+            (*vlpp)->next_variable = NULL;      /* shouldn't be any, but just in case */
+
+            /*
+             * create the next request 
+             */
+            pdu = snmp_pdu_create(SNMP_MSG_GETNEXT);
+            snmp_add_null_var(pdu, (*vlpp)->name, (*vlpp)->name_length);
+
+            /*
+             * finish loop setup 
+             */
+            vlpp = &((*vlpp)->next_variable);
+            response->variables = NULL; /* ahh, forget about it */
+        }
+        snmp_free_pdu(response);
+    }
+    return saved;
+}
+
+
+
+int
+main(int argc, char *argv[])
+{
+    netsnmp_session session, *ss;
+    netsnmp_pdu    *pdu;
+    netsnmp_pdu    *response;
+    int             arg;
+    oid             base[MAX_OID_LEN];
+    size_t          base_length;
+    int             status;
+    netsnmp_variable_list *saved = NULL, *vlp = saved, *vlp2;
+    int             count = 0;
+
+    /*
+     * get the common command line arguments 
+     */
+    switch (arg = snmp_parse_args(argc, argv, &session, "C:", optProc)) {
+    case -2:
+        exit(0);
+    case -1:
+        usage();
+        exit(1);
+    default:
+        break;
+    }
+
+    SOCK_STARTUP;
+
+    /*
+     * Open an SNMP session.
+     */
+    ss = snmp_open(&session);
+    if (ss == NULL) {
+        /*
+         * diagnose snmp_open errors with the input netsnmp_session pointer 
+         */
+        snmp_sess_perror("snmpget", &session);
+        SOCK_CLEANUP;
+        exit(1);
+    }
+
+    printf("%-18s %15s %15s %15s %5s\n", "Description", "size (kB)",
+           "Used", "Available", "Used%");
+    if (ucd_mib == 0) {
+        /*
+         * * Begin by finding all the storage pieces that are of
+         * * type hrStorageFixedDisk, which is a standard disk.
+         */
+        pdu = snmp_pdu_create(SNMP_MSG_GETNEXT);
+        base_length =
+            add(pdu, "HOST-RESOURCES-MIB:hrStorageIndex", NULL, 0);
+        memcpy(base, pdu->variables->name, base_length * sizeof(oid));
+
+        vlp = collect(ss, pdu, base, base_length);
+
+        while (vlp) {
+            size_t          units;
+            unsigned long   hssize, hsused;
+            char            descr[SPRINT_MAX_LEN];
+
+            pdu = snmp_pdu_create(SNMP_MSG_GET);
+
+            add(pdu, "HOST-RESOURCES-MIB:hrStorageDescr",
+                &(vlp->name[base_length]), vlp->name_length - base_length);
+            add(pdu, "HOST-RESOURCES-MIB:hrStorageAllocationUnits",
+                &(vlp->name[base_length]), vlp->name_length - base_length);
+            add(pdu, "HOST-RESOURCES-MIB:hrStorageSize",
+                &(vlp->name[base_length]), vlp->name_length - base_length);
+            add(pdu, "HOST-RESOURCES-MIB:hrStorageUsed",
+                &(vlp->name[base_length]), vlp->name_length - base_length);
+
+            status = snmp_synch_response(ss, pdu, &response);
+            if (status != STAT_SUCCESS || !response) {
+                snmp_sess_perror("snmpdf", ss);
+                exit(1);
+            }
+
+            vlp2 = response->variables;
+            memcpy(descr, vlp2->val.string, vlp2->val_len);
+            descr[vlp2->val_len] = '\0';
+
+            vlp2 = vlp2->next_variable;
+            units = vlp2->val.integer ? *(vlp2->val.integer) : 0;
+
+            vlp2 = vlp2->next_variable;
+            hssize = vlp2->val.integer ? *(vlp2->val.integer) : 0;
+
+            vlp2 = vlp2->next_variable;
+            hsused = vlp2->val.integer ? *(vlp2->val.integer) : 0;
+
+            printf("%-18s %15lu %15lu %15lu %4lu%%\n", descr,
+                   units ? hssize * (units / 1024) : hssize,
+                   units ? hsused * (units / 1024) : hsused,
+                   units ? (hssize - hsused) * (units / 1024) : hssize -
+                   hsused, hssize ? 100 * hsused / hssize : hsused);
+
+            vlp = vlp->next_variable;
+            snmp_free_pdu(response);
+            count++;
+        }
+    }
+
+    if (count == 0) {
+        size_t          units = 0;
+        /*
+         * the host resources mib must not be supported.  Lets try the
+         * UCD-SNMP-MIB and its dskTable 
+         */
+
+        pdu = snmp_pdu_create(SNMP_MSG_GETNEXT);
+        base_length = add(pdu, "UCD-SNMP-MIB:dskIndex", NULL, 0);
+        memcpy(base, pdu->variables->name, base_length * sizeof(oid));
+
+        vlp = collect(ss, pdu, base, base_length);
+
+        while (vlp) {
+            unsigned long   hssize, hsused;
+            char            descr[SPRINT_MAX_LEN];
+
+            pdu = snmp_pdu_create(SNMP_MSG_GET);
+
+            add(pdu, "UCD-SNMP-MIB:dskPath",
+                &(vlp->name[base_length]), vlp->name_length - base_length);
+            add(pdu, "UCD-SNMP-MIB:dskTotal",
+                &(vlp->name[base_length]), vlp->name_length - base_length);
+            add(pdu, "UCD-SNMP-MIB:dskUsed",
+                &(vlp->name[base_length]), vlp->name_length - base_length);
+
+            status = snmp_synch_response(ss, pdu, &response);
+            if (status != STAT_SUCCESS || !response) {
+                snmp_sess_perror("snmpdf", ss);
+                exit(1);
+            }
+
+            vlp2 = response->variables;
+            memcpy(descr, vlp2->val.string, vlp2->val_len);
+            descr[vlp2->val_len] = '\0';
+
+            vlp2 = vlp2->next_variable;
+            hssize = *(vlp2->val.integer);
+
+            vlp2 = vlp2->next_variable;
+            hsused = *(vlp2->val.integer);
+
+            printf("%-18s %15lu %15lu %15lu %4lu%%\n", descr,
+                   units ? hssize * (units / 1024) : hssize,
+                   units ? hsused * (units / 1024) : hsused,
+                   units ? (hssize - hsused) * (units / 1024) : hssize -
+                   hsused, hssize ? 100 * hsused / hssize : hsused);
+
+            vlp = vlp->next_variable;
+            snmp_free_pdu(response);
+            count++;
+        }
+    }
+
+    if (count == 0) {
+        fprintf(stderr, "Failed to locate any partions.\n");
+        exit(1);
+    }
+
+    snmp_close(ss);
+    SOCK_CLEANUP;
+    return 0;
+
+}                               /* end main() */
diff -Naur tomato/release/src/router/snmp/apps/snmpget.c tomato121/release/src/router/snmp/apps/snmpget.c
--- tomato/release/src/router/snmp/apps/snmpget.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/apps/snmpget.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,253 @@
+/*
+ * snmpget.c - send snmp GET requests to a network entity.
+ *
+ */
+/***********************************************************************
+	Copyright 1988, 1989, 1991, 1992 by Carnegie Mellon University
+
+                      All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its 
+documentation for any purpose and without fee is hereby granted, 
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in 
+supporting documentation, and that the name of CMU not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.  
+
+CMU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+CMU BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+******************************************************************/
+#include <net-snmp/net-snmp-config.h>
+
+#if HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#if HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#if HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+#include <sys/types.h>
+#if HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+#include <stdio.h>
+#include <ctype.h>
+#if TIME_WITH_SYS_TIME
+# ifdef WIN32
+#  include <sys/timeb.h>
+# else
+#  include <sys/time.h>
+# endif
+# include <time.h>
+#else
+# if HAVE_SYS_TIME_H
+#  include <sys/time.h>
+# else
+#  include <time.h>
+# endif
+#endif
+#if HAVE_SYS_SELECT_H
+#include <sys/select.h>
+#endif
+#if HAVE_WINSOCK_H
+#include <winsock.h>
+#endif
+#if HAVE_NETDB_H
+#include <netdb.h>
+#endif
+#if HAVE_ARPA_INET_H
+#include <arpa/inet.h>
+#endif
+
+#include <net-snmp/utilities.h>
+
+#include <net-snmp/net-snmp-includes.h>
+
+int             failures = 0;
+
+#define NETSNMP_DS_APP_DONT_FIX_PDUS 0
+
+static void
+optProc(int argc, char *const *argv, int opt)
+{
+    switch (opt) {
+    case 'C':
+        while (*optarg) {
+            switch (*optarg++) {
+            case 'f':
+                netsnmp_ds_toggle_boolean(NETSNMP_DS_APPLICATION_ID, 
+					  NETSNMP_DS_APP_DONT_FIX_PDUS);
+                break;
+            default:
+                fprintf(stderr, "Unknown flag passed to -C: %c\n",
+                        optarg[-1]);
+                exit(1);
+            }
+        }
+        break;
+    }
+}
+
+void
+usage(void)
+{
+    fprintf(stderr, "USAGE: snmpget ");
+    snmp_parse_args_usage(stderr);
+    fprintf(stderr, " OID [OID]...\n\n");
+    snmp_parse_args_descriptions(stderr);
+    fprintf(stderr,
+            "  -C APPOPTS\t\tSet various application specific behaviours:\n");
+    fprintf(stderr,
+            "\t\t\t  f:  do not fix errors and retry the request\n");
+}
+
+int
+main(int argc, char *argv[])
+{
+    netsnmp_session session, *ss;
+    netsnmp_pdu    *pdu;
+    netsnmp_pdu    *response;
+    netsnmp_variable_list *vars;
+    int             arg;
+    int             count;
+    int             current_name = 0;
+    char           *names[128];
+    oid             name[MAX_OID_LEN];
+    size_t          name_length;
+    int             status;
+    int             exitval = 0;
+
+    /*
+     * get the common command line arguments 
+     */
+    switch (arg = snmp_parse_args(argc, argv, &session, "C:", optProc)) {
+    case -2:
+        exit(0);
+    case -1:
+        usage();
+        exit(1);
+    default:
+        break;
+    }
+
+    if (arg >= argc) {
+        fprintf(stderr, "Missing object name\n");
+        usage();
+        exit(1);
+    }
+
+    /*
+     * get the object names 
+     */
+    for (; arg < argc; arg++)
+        names[current_name++] = argv[arg];
+
+    SOCK_STARTUP;
+
+
+    /*
+     * Open an SNMP session.
+     */
+    ss = snmp_open(&session);
+    if (ss == NULL) {
+        /*
+         * diagnose snmp_open errors with the input netsnmp_session pointer 
+         */
+        snmp_sess_perror("snmpget", &session);
+        SOCK_CLEANUP;
+        exit(1);
+    }
+
+
+    /*
+     * Create PDU for GET request and add object names to request.
+     */
+    pdu = snmp_pdu_create(SNMP_MSG_GET);
+    for (count = 0; count < current_name; count++) {
+        name_length = MAX_OID_LEN;
+        if (!snmp_parse_oid(names[count], name, &name_length)) {
+            snmp_perror(names[count]);
+            failures++;
+        } else
+            snmp_add_null_var(pdu, name, name_length);
+    }
+    if (failures) {
+        SOCK_CLEANUP;
+        exit(1);
+    }
+
+
+    /*
+     * Perform the request.
+     *
+     * If the Get Request fails, note the OID that caused the error,
+     * "fix" the PDU (removing the error-prone OID) and retry.
+     */
+  retry:
+    status = snmp_synch_response(ss, pdu, &response);
+    if (status == STAT_SUCCESS) {
+        if (response->errstat == SNMP_ERR_NOERROR) {
+            for (vars = response->variables; vars;
+                 vars = vars->next_variable)
+                print_variable(vars->name, vars->name_length, vars);
+
+        } else {
+            fprintf(stderr, "Error in packet\nReason: %s\n",
+                    snmp_errstring(response->errstat));
+
+            if (response->errindex != 0) {
+                fprintf(stderr, "Failed object: ");
+                for (count = 1, vars = response->variables;
+                     vars && count != response->errindex;
+                     vars = vars->next_variable, count++)
+                    /*EMPTY*/;
+                if (vars) {
+                    fprint_objid(stderr, vars->name, vars->name_length);
+		}
+                fprintf(stderr, "\n");
+            }
+            exitval = 2;
+
+            /*
+             * retry if the errored variable was successfully removed 
+             */
+            if (!netsnmp_ds_get_boolean(NETSNMP_DS_APPLICATION_ID,
+					NETSNMP_DS_APP_DONT_FIX_PDUS)) {
+                pdu = snmp_fix_pdu(response, SNMP_MSG_GET);
+                snmp_free_pdu(response);
+                response = NULL;
+                if (pdu != NULL) {
+                    goto retry;
+		}
+            }
+        }                       /* endif -- SNMP_ERR_NOERROR */
+
+    } else if (status == STAT_TIMEOUT) {
+        fprintf(stderr, "Timeout: No Response from %s.\n",
+                session.peername);
+        exitval = 1;
+
+    } else {                    /* status == STAT_ERROR */
+        snmp_sess_perror("snmpget", ss);
+        exitval = 1;
+
+    }                           /* endif -- STAT_SUCCESS */
+
+
+    if (response)
+        snmp_free_pdu(response);
+    snmp_close(ss);
+    SOCK_CLEANUP;
+    return exitval;
+
+}                               /* end main() */
diff -Naur tomato/release/src/router/snmp/apps/snmpgetnext.c tomato121/release/src/router/snmp/apps/snmpgetnext.c
--- tomato/release/src/router/snmp/apps/snmpgetnext.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/apps/snmpgetnext.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,234 @@
+/*
+ * snmpgetnext.c - send snmp GETNEXT requests to a network entity.
+ *
+ */
+/***********************************************************************
+	Copyright 1988, 1989, 1991, 1992 by Carnegie Mellon University
+
+                      All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of CMU not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+CMU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+CMU BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+******************************************************************/
+#include <net-snmp/net-snmp-config.h>
+
+#if HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#if HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#if HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+#include <sys/types.h>
+#if HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+#include <stdio.h>
+#include <ctype.h>
+#if TIME_WITH_SYS_TIME
+# ifdef WIN32
+#  include <sys/timeb.h>
+# else
+#  include <sys/time.h>
+# endif
+# include <time.h>
+#else
+# if HAVE_SYS_TIME_H
+#  include <sys/time.h>
+# else
+#  include <time.h>
+# endif
+#endif
+#if HAVE_SYS_SELECT_H
+#include <sys/select.h>
+#endif
+#if HAVE_WINSOCK_H
+#include <winsock.h>
+#endif
+#if HAVE_NETDB_H
+#include <netdb.h>
+#endif
+#if HAVE_ARPA_INET_H
+#include <arpa/inet.h>
+#endif
+
+#include <net-snmp/net-snmp-includes.h>
+
+#define NETSNMP_DS_APP_DONT_FIX_PDUS 0
+
+static void
+optProc(int argc, char *const *argv, int opt)
+{
+    switch (opt) {
+    case 'C':
+        while (*optarg) {
+            switch (*optarg++) {
+            case 'f':
+                netsnmp_ds_toggle_boolean(NETSNMP_DS_APPLICATION_ID, 
+					  NETSNMP_DS_APP_DONT_FIX_PDUS);
+                break;
+            default:
+                fprintf(stderr, "Unknown flag passed to -C: %c\n",
+                        optarg[-1]);
+                exit(1);
+            }
+        }
+        break;
+    }
+}
+
+void
+usage(void)
+{
+    fprintf(stderr, "USAGE: snmpgetnext ");
+    snmp_parse_args_usage(stderr);
+    fprintf(stderr, " OID [OID]...\n\n");
+    snmp_parse_args_descriptions(stderr);
+    fprintf(stderr,
+            "  -C APPOPTS\t\tSet various application specific behaviours:\n");
+    fprintf(stderr,
+            "\t\t\t  f:  do not fix errors and retry the request\n");
+}
+
+int
+main(int argc, char *argv[])
+{
+    netsnmp_session session, *ss;
+    netsnmp_pdu    *pdu, *response;
+    netsnmp_variable_list *vars;
+    int             arg;
+    int             count;
+    int             current_name = 0;
+    char           *names[128];
+    oid             name[MAX_OID_LEN];
+    size_t          name_length;
+    int             status;
+    int             failures = 0;
+    int             exitval = 0;
+
+    /*
+     * get the common command line arguments 
+     */
+    switch (arg = snmp_parse_args(argc, argv, &session, "C:", &optProc)) {
+    case -2:
+        exit(0);
+    case -1:
+        usage();
+        exit(1);
+    default:
+        break;
+    }
+
+    if (arg >= argc) {
+        fprintf(stderr, "Missing object name\n");
+        usage();
+        exit(1);
+    }
+
+    /*
+     * get the object names 
+     */
+    for (; arg < argc; arg++)
+        names[current_name++] = argv[arg];
+
+    SOCK_STARTUP;
+
+    /*
+     * open an SNMP session 
+     */
+    ss = snmp_open(&session);
+    if (ss == NULL) {
+        /*
+         * diagnose snmp_open errors with the input netsnmp_session pointer 
+         */
+        snmp_sess_perror("snmpgetnext", &session);
+        SOCK_CLEANUP;
+        exit(1);
+    }
+
+    /*
+     * create PDU for GET request and add object names to request 
+     */
+    pdu = snmp_pdu_create(SNMP_MSG_GETNEXT);
+
+    for (count = 0; count < current_name; count++) {
+        name_length = MAX_OID_LEN;
+        if (snmp_parse_oid(names[count], name, &name_length) == NULL) {
+            snmp_perror(names[count]);
+            failures++;
+        } else
+            snmp_add_null_var(pdu, name, name_length);
+    }
+    if (failures) {
+        SOCK_CLEANUP;
+        exit(1);
+    }
+
+    /*
+     * do the request 
+     */
+  retry:
+    status = snmp_synch_response(ss, pdu, &response);
+    if (status == STAT_SUCCESS) {
+        if (response->errstat == SNMP_ERR_NOERROR) {
+            for (vars = response->variables; vars;
+                 vars = vars->next_variable)
+                print_variable(vars->name, vars->name_length, vars);
+        } else {
+            fprintf(stderr, "Error in packet.\nReason: %s\n",
+                    snmp_errstring(response->errstat));
+            if (response->errindex != 0) {
+                fprintf(stderr, "Failed object: ");
+                for (count = 1, vars = response->variables;
+                     vars && count != response->errindex;
+                     vars = vars->next_variable, count++);
+                if (vars)
+                    fprint_objid(stderr, vars->name, vars->name_length);
+                fprintf(stderr, "\n");
+                exitval = 2;
+            }
+
+            /*
+             * retry if the errored variable was successfully removed 
+             */
+            if (!netsnmp_ds_get_boolean(NETSNMP_DS_APPLICATION_ID, 
+					NETSNMP_DS_APP_DONT_FIX_PDUS)) {
+                pdu = snmp_fix_pdu(response, SNMP_MSG_GETNEXT);
+                snmp_free_pdu(response);
+                response = NULL;
+                if (pdu != NULL)
+                    goto retry;
+            }
+        }
+    } else if (status == STAT_TIMEOUT) {
+        fprintf(stderr, "Timeout: No Response from %s.\n",
+                session.peername);
+        exitval = 1;
+    } else {                    /* status == STAT_ERROR */
+        snmp_sess_perror("snmpgetnext", ss);
+        exitval = 1;
+    }
+
+    if (response)
+        snmp_free_pdu(response);
+    snmp_close(ss);
+    SOCK_CLEANUP;
+    return exitval;
+}
diff -Naur tomato/release/src/router/snmp/apps/snmpnetstat/.cvsignore tomato121/release/src/router/snmp/apps/snmpnetstat/.cvsignore
--- tomato/release/src/router/snmp/apps/snmpnetstat/.cvsignore	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/apps/snmpnetstat/.cvsignore	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,4 @@
+Makefile
+snmpnetstat
+*.lo
+.libs
diff -Naur tomato/release/src/router/snmp/apps/snmpnetstat/if.c tomato121/release/src/router/snmp/apps/snmpnetstat/if.c
--- tomato/release/src/router/snmp/apps/snmpnetstat/if.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/apps/snmpnetstat/if.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,891 @@
+/*****************************************************************
+	Copyright 1989, 1991, 1992 by Carnegie Mellon University
+
+                      All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its 
+documentation for any purpose and without fee is hereby granted, 
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in 
+supporting documentation, and that the name of CMU not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.  
+
+CMU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+CMU BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+******************************************************************/
+/*
+ * Copyright (c) 1983,1988 Regents of the University of California.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms are permitted
+ * provided that this notice is preserved and that due credit is given
+ * to the University of California at Berkeley. The name of the University
+ * may not be used to endorse or promote products derived from this
+ * software without specific prior written permission. This software
+ * is provided ``as is'' without express or implied warranty.
+ */
+
+#include <net-snmp/net-snmp-config.h>
+
+#if HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#if HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#if HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+
+#include <sys/types.h>
+#if TIME_WITH_SYS_TIME
+# ifdef WIN32
+#  include <sys/timeb.h>
+# else
+#  include <sys/time.h>
+# endif
+# include <time.h>
+#else
+# if HAVE_SYS_TIME_H
+#  include <sys/time.h>
+# else
+#  include <time.h>
+# endif
+#endif
+#if HAVE_SYS_SELECT_H
+#include <sys/select.h>
+#endif
+#if HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+
+#include <stdio.h>
+#include <signal.h>
+
+#if HAVE_WINSOCK_H
+#include <winsock.h>
+#endif
+#if HAVE_SYS_SOCKET_H
+#include <sys/socket.h>
+#endif
+#if HAVE_NETDB_H
+#include <netdb.h>
+#endif
+
+#include "main.h"
+#include <net-snmp/net-snmp-includes.h>
+#include "netstat.h"
+
+#define	YES	1
+#define	NO	0
+
+static void     sidewaysintpr(unsigned int);
+static void     timerSet(int interval_seconds);
+static void     timerPause(void);
+
+static oid      oid_ifname[] = { 1, 3, 6, 1, 2, 1, 2, 2, 1, 2, 1 };
+static oid      oid_ifinucastpkts[] = { 1, 3, 6, 1, 2, 1, 2, 2, 1, 11, 1 };
+static oid      oid_cfg_nnets[] = { 1, 3, 6, 1, 2, 1, 2, 1, 0 };
+static oid      oid_ipadentaddr[] =
+    { 1, 3, 6, 1, 2, 1, 4, 20, 1, 1, 0, 0, 0, 0 };
+
+#define IFINDEX		1
+#define IFNAME		2
+#define IFMTU		4
+#define IFOPERSTATUS	8
+#define INOCTETS	10
+#define INUCASTPKTS	11
+#define INNUCASTPKTS	12
+#define INERRORS	14
+#define OUTOCTETS	16
+#define OUTUCASTPKTS	17
+#define OUTNUCASTPKTS	18
+#define OUTERRORS	20
+#define OUTQLEN		21
+
+#define IPADDR		1
+#define	IPIFINDEX	2
+#define IPNETMASK	3
+
+
+/*
+ * Print a description of the network interfaces.
+ */
+void
+intpr(int interval)
+{
+    oid             varname[MAX_OID_LEN], *instance, *ifentry;
+    size_t          varname_len;
+    int             ifnum, cfg_nnets;
+    oid             curifip[4];
+    netsnmp_variable_list *var;
+    netsnmp_pdu    *request, *response;
+    int             status;
+    int             ifindex, oldindex = 0;
+    struct _if_info {
+        char            name[128];
+        char            ip[128], route[128];
+        int             mtu;
+        int             ifindex;
+        char            s_ipkts[20], s_ierrs[20], s_opkts[20], s_oerrs[20],
+            s_outq[20];
+        unsigned long   ipkts, opkts;
+        int             operstatus;
+        u_long          netmask;
+        struct in_addr  ifip, ifroute;
+    }              *if_table, *cur_if;
+    int             max_name = 4, max_ip = 7, max_route = 7, max_ipkts = 5,
+        max_ierrs = 5, max_opkts = 5, max_oerrs = 5, max_outq = 5;
+    int             i;
+
+    if (interval) {
+        sidewaysintpr((unsigned) interval);
+        return;
+    }
+    var =
+        getvarbyname(Session, oid_cfg_nnets,
+                     sizeof(oid_cfg_nnets) / sizeof(oid));
+    if (var && var->val.integer) {
+        cfg_nnets = *var->val.integer;
+        snmp_free_var(var);
+    } else {
+        fprintf(stderr,
+                "No response when requesting number of interfaces.\n");
+        return;
+    }
+    DEBUGMSGTL(("netstat:if", "cfg_nnets = %d\n", cfg_nnets));
+
+    memset(curifip, 0, sizeof(curifip));
+    if_table = (struct _if_info *) calloc(cfg_nnets, sizeof(*if_table));
+    cur_if = if_table;
+
+    for (ifnum = 1; ifnum <= cfg_nnets; ifnum++) {
+        register char  *cp;
+
+        request = snmp_pdu_create(SNMP_MSG_GETNEXT);
+        memmove(varname, oid_ipadentaddr, sizeof(oid_ipadentaddr));
+        varname_len = sizeof(oid_ipadentaddr) / sizeof(oid);
+        instance = varname + 9;
+        memmove(varname + 10, curifip, sizeof(curifip));
+        *instance = IPIFINDEX;
+        snmp_add_null_var(request, varname, varname_len);
+        *instance = IPADDR;
+        snmp_add_null_var(request, varname, varname_len);
+        *instance = IPNETMASK;
+        snmp_add_null_var(request, varname, varname_len);
+
+        status = snmp_synch_response(Session, request, &response);
+        if (status != STAT_SUCCESS
+            || response->errstat != SNMP_ERR_NOERROR) {
+            fprintf(stderr,
+                    "SNMP request failed after %d out of %d interfaces (IP)\n",
+                    ifnum, cfg_nnets);
+            if (snmp_get_do_debugging()) {
+                fprintf(stderr,
+                        "status = %d, errstat = %ld, errindex = %ld\n",
+                        status, response->errstat, response->errindex);
+            }
+            cfg_nnets = ifnum;
+            break;
+        }
+        for (var = response->variables; var; var = var->next_variable) {
+            if (snmp_get_do_debugging()) {
+                print_variable(var->name, var->name_length, var);
+            }
+            switch (var->name[9]) {
+            case IPIFINDEX:
+                ifindex = *var->val.integer;
+                for (cur_if = if_table;
+                     cur_if < (if_table + cfg_nnets) &&
+                     cur_if->ifindex != ifindex &&
+                     cur_if->ifindex != 0; cur_if++);
+                if (cur_if >= (if_table + cfg_nnets)) {
+                    fprintf(stderr,
+                            "Inconsistent reponse from server. Aborting.\n");
+                    exit(0);
+                }
+                cur_if->ifindex = ifindex;
+                break;
+            case IPADDR:
+                memmove(curifip, var->name + 10, sizeof(curifip));
+                memmove(&cur_if->ifip, var->val.string, sizeof(u_long));
+                break;
+            case IPNETMASK:
+                memmove(&cur_if->netmask, var->val.string, sizeof(u_long));
+            }
+        }
+        cur_if->ifroute.s_addr = cur_if->ifip.s_addr & cur_if->netmask;
+        if (cur_if->ifroute.s_addr)
+            strcpy(cur_if->route,
+                   netname(cur_if->ifroute, cur_if->netmask));
+        else
+            strcpy(cur_if->route, "none");
+        if ((i = strlen(cur_if->route)) > max_route)
+            max_route = i;
+        if (cur_if->ifip.s_addr)
+            strcpy(cur_if->ip, routename(cur_if->ifip));
+        else
+            strcpy(cur_if->ip, "none");
+        if ((i = strlen(cur_if->ip)) > max_ip)
+            max_ip = i;
+
+        snmp_free_pdu(response);
+
+        memmove(varname, oid_ifname, sizeof(oid_ifname));
+        varname_len = sizeof(oid_ifname) / sizeof(oid);
+        ifentry = varname + 9;
+        instance = varname + 10;
+        request = snmp_pdu_create(SNMP_MSG_GETNEXT);
+
+        *instance = oldindex;
+        *ifentry = IFINDEX;
+        snmp_add_null_var(request, varname, varname_len);
+        *ifentry = IFNAME;
+        snmp_add_null_var(request, varname, varname_len);
+        *ifentry = IFMTU;
+        snmp_add_null_var(request, varname, varname_len);
+        *ifentry = IFOPERSTATUS;
+        snmp_add_null_var(request, varname, varname_len);
+        *ifentry = INUCASTPKTS;
+        snmp_add_null_var(request, varname, varname_len);
+        *ifentry = INNUCASTPKTS;
+        snmp_add_null_var(request, varname, varname_len);
+        *ifentry = INERRORS;
+        snmp_add_null_var(request, varname, varname_len);
+        *ifentry = OUTUCASTPKTS;
+        snmp_add_null_var(request, varname, varname_len);
+        *ifentry = OUTNUCASTPKTS;
+        snmp_add_null_var(request, varname, varname_len);
+        *ifentry = OUTERRORS;
+        snmp_add_null_var(request, varname, varname_len);
+        *ifentry = OUTQLEN;
+        snmp_add_null_var(request, varname, varname_len);
+
+        while ((status =
+                snmp_synch_response(Session, request,
+                                    &response)) == STAT_SUCCESS) {
+            if (response->errstat != SNMP_ERR_NOSUCHNAME)
+                break;
+            if ((request =
+                 snmp_fix_pdu(response, SNMP_MSG_GETNEXT)) == NULL)
+                break;
+            snmp_free_pdu(response);
+        }
+        if (status != STAT_SUCCESS
+            || response->errstat != SNMP_ERR_NOERROR) {
+            fprintf(stderr,
+                    "SNMP request failed after %d out of %d interfaces (IF)\n",
+                    ifnum, cfg_nnets);
+            cfg_nnets = ifnum;
+            break;
+        }
+        cur_if = if_table + ifnum - 1;
+        for (var = response->variables; var; var = var->next_variable) {
+            if (snmp_get_do_debugging()) {
+                print_variable(var->name, var->name_length, var);
+            }
+            if (!var->val.integer)
+                continue;
+            if (memcmp(var->name, oid_ifname, 8 * sizeof(oid)))
+                continue;
+            switch (var->name[9]) {
+            case IFINDEX:
+                ifindex = *var->val.integer;
+                for (cur_if = if_table;
+                     cur_if->ifindex != ifindex && cur_if->ifindex != 0;
+                     cur_if++);
+                if (cur_if >= (if_table + cfg_nnets)) {
+                    fprintf(stderr,
+                            "Inconsistent reponse from server. Aborting\n");
+                    exit(0);
+                }
+                cur_if->ifindex = ifindex;
+                break;
+            case OUTQLEN:
+                sprintf(cur_if->s_outq, "%lu", *var->val.integer);
+                i = strlen(cur_if->s_outq);
+                if (i > max_outq)
+                    max_outq = i;
+                break;
+            case OUTERRORS:
+                sprintf(cur_if->s_oerrs, "%lu", *var->val.integer);
+                i = strlen(cur_if->s_oerrs);
+                if (i > max_oerrs)
+                    max_oerrs = i;
+                break;
+            case INERRORS:
+                sprintf(cur_if->s_ierrs, "%lu", *var->val.integer);
+                i = strlen(cur_if->s_ierrs);
+                if (i > max_ierrs)
+                    max_ierrs = i;
+                break;
+            case IFMTU:
+                cur_if->mtu = *var->val.integer;
+                break;
+            case INUCASTPKTS:
+                cur_if->ipkts += *var->val.integer;
+                sprintf(cur_if->s_ipkts, "%lu", cur_if->ipkts);
+                i = strlen(cur_if->s_ipkts);
+                if (i > max_ipkts)
+                    max_ipkts = i;
+                break;
+            case INNUCASTPKTS:
+                cur_if->ipkts += *var->val.integer;
+                sprintf(cur_if->s_ipkts, "%lu", cur_if->ipkts);
+                i = strlen(cur_if->s_ipkts);
+                if (i > max_ipkts)
+                    max_ipkts = i;
+                break;
+            case OUTUCASTPKTS:
+                cur_if->opkts += *var->val.integer;
+                sprintf(cur_if->s_opkts, "%lu", cur_if->opkts);
+                i = strlen(cur_if->s_opkts);
+                if (i > max_opkts)
+                    max_opkts = i;
+                break;
+            case OUTNUCASTPKTS:
+                cur_if->opkts += *var->val.integer;
+                sprintf(cur_if->s_opkts, "%lu", cur_if->opkts);
+                i = strlen(cur_if->s_opkts);
+                if (i > max_opkts)
+                    max_opkts = i;
+                break;
+            case IFNAME:
+                oldindex = var->name[10];
+                if (var->val_len >= sizeof(cur_if->name))
+                    var->val_len = sizeof(cur_if->name) - 1;
+                memmove(cur_if->name, var->val.string, var->val_len);
+                cur_if->name[var->val_len] = 0;
+                if ((i = strlen(cur_if->name) + 1) > max_name)
+                    max_name = i;
+                break;
+            case IFOPERSTATUS:
+                cur_if->operstatus = *var->val.integer;
+                break;
+            }
+        }
+
+        snmp_free_pdu(response);
+
+        if (intrface != NULL && strcmp(cur_if->name, intrface) != 0) {
+            cur_if->name[0] = 0;
+            continue;
+        }
+        if (cur_if->operstatus != MIB_IFSTATUS_UP) {
+            cp = strchr(cur_if->name, '\0');
+            *cp++ = '*';
+            *cp = '\0';
+        }
+    }
+
+    printf("%*.*s %5.5s %*.*s %*.*s %*s %*s %*s %*s %*s",
+           -max_name, max_name, "Name", "Mtu",
+           -max_route, max_route, "Network",
+           -max_ip, max_ip, "Address",
+           max_ipkts, "Ipkts",
+           max_ierrs, "Ierrs",
+           max_opkts, "Opkts", max_oerrs, "Oerrs", max_outq, "Queue");
+    putchar('\n');
+    for (ifnum = 0, cur_if = if_table; ifnum < cfg_nnets;
+         ifnum++, cur_if++) {
+        if (cur_if->name[0] == 0)
+            continue;
+        printf("%*.*s %5d ", -max_name, max_name, cur_if->name,
+               cur_if->mtu);
+        printf("%*.*s ", -max_route, max_route, cur_if->route);
+        printf("%*.*s ", -max_ip, max_ip, cur_if->ip);
+        printf("%*s %*s %*s %*s %*s",
+               max_ipkts, cur_if->s_ipkts, max_ierrs, cur_if->s_ierrs,
+               max_opkts, cur_if->s_opkts, max_oerrs, cur_if->s_oerrs,
+               max_outq, cur_if->s_outq);
+        putchar('\n');
+    }
+    free(if_table);
+}
+
+/*
+ * Print a description of the network interfaces.
+ */
+void
+intpro(int interval)
+{
+    oid             varname[MAX_OID_LEN], *instance, *ifentry;
+    size_t          varname_len;
+    int             ifnum, cfg_nnets;
+    oid             curifip[4];
+    netsnmp_variable_list *var;
+    netsnmp_pdu    *request, *response;
+    int             status;
+    int             ifindex, oldindex = 0;
+    struct _if_info {
+        int             ifindex;
+        char            name[128];
+        char            ip[128], route[128];
+        char            ioctets[20], ierrs[20], ooctets[20], oerrs[20],
+            outqueue[20];
+        int             operstatus;
+        u_long          netmask;
+        struct in_addr  ifip, ifroute;
+    }              *if_table, *cur_if;
+    int             max_name = 4, max_route = 7, max_ip = 7, max_ioctets =
+        7, max_ooctets = 7;
+    int             i;
+
+    if (interval) {
+        sidewaysintpr((unsigned) interval);
+        return;
+    }
+    var =
+        getvarbyname(Session, oid_cfg_nnets,
+                     sizeof(oid_cfg_nnets) / sizeof(oid));
+    if (var && var->val.integer) {
+        cfg_nnets = *var->val.integer;
+        snmp_free_var(var);
+    } else {
+        fprintf(stderr,
+                "No response when requesting number of interfaces.\n");
+        return;
+    }
+    DEBUGMSGTL(("netstat:if", "cfg_nnets = %d\n", cfg_nnets));
+
+    memset(curifip, 0, sizeof(curifip));
+    if_table = (struct _if_info *) calloc(cfg_nnets, sizeof(*if_table));
+    cur_if = if_table;
+
+    for (ifnum = 1; ifnum <= cfg_nnets; ifnum++) {
+        register char  *cp;
+
+        request = snmp_pdu_create(SNMP_MSG_GETNEXT);
+        memmove(varname, oid_ipadentaddr, sizeof(oid_ipadentaddr));
+        varname_len = sizeof(oid_ipadentaddr) / sizeof(oid);
+        instance = varname + 9;
+        memmove(varname + 10, curifip, sizeof(curifip));
+        *instance = IPIFINDEX;
+        snmp_add_null_var(request, varname, varname_len);
+        *instance = IPADDR;
+        snmp_add_null_var(request, varname, varname_len);
+        *instance = IPNETMASK;
+        snmp_add_null_var(request, varname, varname_len);
+
+        status = snmp_synch_response(Session, request, &response);
+        if (status != STAT_SUCCESS
+            || response->errstat != SNMP_ERR_NOERROR) {
+            fprintf(stderr,
+                    "SNMP request failed for interface %d, variable %ld out of %d interfaces (IP)\n",
+                    ifnum, response->errindex, cfg_nnets);
+            cfg_nnets = ifnum;
+            break;
+        }
+        for (var = response->variables; var; var = var->next_variable) {
+            if (snmp_get_do_debugging()) {
+                print_variable(var->name, var->name_length, var);
+            }
+            switch (var->name[9]) {
+            case IPIFINDEX:
+                ifindex = *var->val.integer;
+                for (cur_if = if_table;
+                     cur_if->ifindex != ifindex && cur_if->ifindex != 0;
+                     cur_if++);
+                cur_if->ifindex = ifindex;
+                break;
+            case IPADDR:
+                memmove(curifip, var->name + 10, sizeof(curifip));
+                memmove(&cur_if->ifip, var->val.string, sizeof(u_long));
+                break;
+            case IPNETMASK:
+                memmove(&cur_if->netmask, var->val.string, sizeof(u_long));
+            }
+        }
+        cur_if->ifroute.s_addr = cur_if->ifip.s_addr & cur_if->netmask;
+        if (cur_if->ifroute.s_addr)
+            strcpy(cur_if->route,
+                   netname(cur_if->ifroute, cur_if->netmask));
+        else
+            strcpy(cur_if->route, "none");
+        if ((i = strlen(cur_if->route)) > max_route)
+            max_route = i;
+        if (cur_if->ifip.s_addr)
+            strcpy(cur_if->ip, routename(cur_if->ifip));
+        else
+            strcpy(cur_if->ip, "none");
+        if ((i = strlen(cur_if->ip)) > max_ip)
+            max_ip = i;
+
+        snmp_free_pdu(response);
+
+        memmove(varname, oid_ifname, sizeof(oid_ifname));
+        varname_len = sizeof(oid_ifname) / sizeof(oid);
+        ifentry = varname + 9;
+        instance = varname + 10;
+        request = snmp_pdu_create(SNMP_MSG_GETNEXT);
+
+        *instance = oldindex;
+        *ifentry = IFINDEX;
+        snmp_add_null_var(request, varname, varname_len);
+        *ifentry = IFNAME;
+        snmp_add_null_var(request, varname, varname_len);
+        *ifentry = IFOPERSTATUS;
+        snmp_add_null_var(request, varname, varname_len);
+        *ifentry = INOCTETS;
+        snmp_add_null_var(request, varname, varname_len);
+        *ifentry = OUTOCTETS;
+        snmp_add_null_var(request, varname, varname_len);
+
+        while ((status =
+                snmp_synch_response(Session, request,
+                                    &response)) == STAT_SUCCESS) {
+            if (response->errstat != SNMP_ERR_NOSUCHNAME)
+                break;
+            if ((request =
+                 snmp_fix_pdu(response, SNMP_MSG_GETNEXT)) == NULL)
+                break;
+            snmp_free_pdu(response);
+        }
+        if (status != STAT_SUCCESS
+            || response->errstat != SNMP_ERR_NOERROR) {
+            fprintf(stderr,
+                    "SNMP request failed for interface %d, variable %ld out of %d interfaces (IF)\n",
+                    ifnum, response->errindex, cfg_nnets);
+            cfg_nnets = ifnum;
+            break;
+        }
+        for (var = response->variables; var; var = var->next_variable) {
+            if (snmp_get_do_debugging()) {
+                print_variable(var->name, var->name_length, var);
+            }
+            if (!var->val.integer)
+                continue;
+            switch (var->name[9]) {
+            case IFINDEX:
+                ifindex = *var->val.integer;
+                for (cur_if = if_table;
+                     cur_if->ifindex != ifindex && cur_if->ifindex != 0;
+                     cur_if++);
+                cur_if->ifindex = ifindex;
+                break;
+            case INOCTETS:
+                sprintf(cur_if->ioctets, "%lu", *var->val.integer);
+                i = strlen(cur_if->ioctets);
+                if (i > max_ioctets)
+                    max_ioctets = i;
+                break;
+            case OUTOCTETS:
+                sprintf(cur_if->ooctets, "%lu", *var->val.integer);
+                i = strlen(cur_if->ooctets);
+                if (i > max_ooctets)
+                    max_ooctets = i;
+                break;
+            case IFNAME:
+                oldindex = var->name[10];
+                if (var->val_len >= sizeof(cur_if->name))
+                    var->val_len = sizeof(cur_if->name) - 1;
+                memmove(cur_if->name, var->val.string, var->val_len);
+                cur_if->name[var->val_len] = 0;
+                if ((i = strlen(cur_if->name) + 1) > max_name)
+                    max_name = i;
+                break;
+            case IFOPERSTATUS:
+                cur_if->operstatus = *var->val.integer;
+                break;
+            }
+        }
+
+        snmp_free_pdu(response);
+
+        if (intrface != NULL && strcmp(cur_if->name, intrface) != 0) {
+            cur_if->name[0] = 0;
+            continue;
+        }
+        if (cur_if->operstatus != MIB_IFSTATUS_UP) {
+            cp = strchr(cur_if->name, '\0');
+            *cp++ = '*';
+            *cp = '\0';
+        }
+    }
+
+    printf("%*.*s %*.*s %*.*s %*.*s %*.*s ",
+           -max_name, max_name, "Name",
+           -max_route, max_route, "Network",
+           -max_ip, max_ip, "Address",
+           max_ioctets, max_ioctets, "Ioctets",
+           max_ooctets, max_ooctets, "Ooctets");
+    putchar('\n');
+    for (ifnum = 0, cur_if = if_table; ifnum < cfg_nnets;
+         ifnum++, cur_if++) {
+        if (cur_if->name[0] == 0)
+            continue;
+        printf("%*.*s ", -max_name, max_name, cur_if->name);
+        printf("%*.*s ", -max_route, max_route, cur_if->route);
+        printf("%*.*s ", -max_ip, max_ip, cur_if->ip);
+        printf("%*s %*s", max_ioctets, cur_if->ioctets,
+               max_ioctets, cur_if->ooctets);
+        putchar('\n');
+    }
+    free(if_table);
+}
+
+#define	MAXIF	128
+struct iftot {
+    char            ift_name[128];      /* interface name */
+    unsigned int    ift_ip;     /* input packets */
+    unsigned int    ift_ie;     /* input errors */
+    unsigned int    ift_op;     /* output packets */
+    unsigned int    ift_oe;     /* output errors */
+    unsigned int    ift_co;     /* collisions */
+} iftot[MAXIF];
+
+u_char          signalled;      /* set if alarm goes off "early" */
+
+/*
+ * timerSet sets or resets the timer to fire in "interval" seconds.
+ * timerPause waits only if the timer has not fired.
+ * timing precision is not considered important.
+ */
+
+#if (defined(WIN32) || defined(cygwin))
+static int      sav_int;
+static time_t   timezup;
+static void
+timerSet(int interval_seconds)
+{
+    sav_int = interval_seconds;
+    timezup = time(0) + interval_seconds;
+}
+
+/*
+ * you can do better than this ! 
+ */
+static void
+timerPause(void)
+{
+    time_t          now;
+    while (time(&now) < timezup)
+#ifdef WIN32
+        Sleep(400);
+#else
+    {
+        struct timeval  tx;
+        tx.tv_sec = 0;
+        tx.tv_usec = 400 * 1000;        /* 400 milliseconds */
+        select(0, 0, 0, 0, &tx);
+    }
+#endif
+}
+
+#else
+
+/*
+ * Called if an interval expires before sidewaysintpr has completed a loop.
+ * Sets a flag to not wait for the alarm.
+ */
+RETSIGTYPE
+catchalarm(int sig)
+{
+    signalled = YES;
+}
+
+static void
+timerSet(int interval_seconds)
+{
+#ifdef HAVE_SIGSET
+    (void) sigset(SIGALRM, catchalarm);
+#else
+    (void) signal(SIGALRM, catchalarm);
+#endif
+    signalled = NO;
+    (void) alarm(interval_seconds);
+}
+
+static void
+timerPause(void)
+{
+#ifdef HAVE_SIGHOLD
+    sighold(SIGALRM);
+    if (!signalled) {
+        sigpause(SIGALRM);
+    }
+#else
+    int             oldmask;
+    oldmask = sigblock(sigmask(SIGALRM));
+    if (!signalled) {
+        sigpause(0);
+    }
+    sigsetmask(oldmask);
+#endif
+}
+
+#endif                          /* !WIN32 && !cygwin */
+
+/*
+ * Print a running summary of interface statistics.
+ * Repeat display every interval seconds, showing statistics
+ * collected over that interval.  Assumes that interval is non-zero.
+ * First line printed at top of screen is always cumulative.
+ */
+static void
+sidewaysintpr(unsigned int interval)
+{
+    register struct iftot *ip, *total;
+    register int    line;
+    struct iftot   *lastif, *sum, *interesting, ifnow, *now = &ifnow;
+    netsnmp_variable_list *var;
+    oid             varname[MAX_OID_LEN], *instance, *ifentry;
+    size_t          varname_len;
+    int             ifnum, cfg_nnets;
+
+    lastif = iftot;
+    sum = iftot + MAXIF - 1;
+    total = sum - 1;
+    interesting = iftot;
+    var =
+        getvarbyname(Session, oid_cfg_nnets,
+                     sizeof(oid_cfg_nnets) / sizeof(oid));
+    if (var) {
+        cfg_nnets = *var->val.integer;
+        snmp_free_var(var);
+    } else
+        return;
+    memmove(varname, oid_ifname, sizeof(oid_ifname));
+    varname_len = sizeof(oid_ifname) / sizeof(oid);
+    for (ifnum = 1, ip = iftot; ifnum <= cfg_nnets; ifnum++) {
+        char           *cp;
+
+        ip->ift_name[0] = '(';
+        varname[10] = ifnum;
+        var = getvarbyname(Session, varname, varname_len);
+        if (var) {
+            if (var->val_len >= (sizeof(ip->ift_name) - 3))
+                var->val_len = (sizeof(ip->ift_name) - 4);
+            memmove(ip->ift_name + 1, var->val.string, var->val_len);
+            snmp_free_var(var);
+        }
+        cp = (char *) strchr(ip->ift_name, ' ');
+        if (cp != NULL)
+            *cp = '\0';
+        if (intrface && strcmp(ip->ift_name + 1, intrface) == 0)
+            interesting = ip;
+        ip->ift_name[15] = '\0';
+        cp = (char *) strchr(ip->ift_name, '\0');
+        sprintf(cp, ")");
+        ip++;
+        if (ip >= iftot + MAXIF - 2)
+            break;
+    }
+    lastif = ip;
+
+    timerSet(interval);
+
+  banner:
+    printf("     input   %-6.6s     output       ", interesting->ift_name);
+    if (lastif - iftot > 0)
+        printf("                 input  (Total)     output");
+    for (ip = iftot; ip < iftot + MAXIF; ip++) {
+        ip->ift_ip = 0;
+        ip->ift_ie = 0;
+        ip->ift_op = 0;
+        ip->ift_oe = 0;
+        ip->ift_co = 0;
+    }
+    putchar('\n');
+    printf("%10.10s %8.8s %10.10s %8.8s %8.8s ",
+           "packets", "errs", "packets", "errs", "colls");
+    if (lastif - iftot > 0)
+        printf("%10.10s %8.8s %10.10s %8.8s %8.8s ",
+               "packets", "errs", "packets", "errs", "colls");
+    putchar('\n');
+    fflush(stdout);
+    line = 0;
+  loop:
+    sum->ift_ip = 0;
+    sum->ift_ie = 0;
+    sum->ift_op = 0;
+    sum->ift_oe = 0;
+    sum->ift_co = 0;
+    memmove(varname, oid_ifinucastpkts, sizeof(oid_ifinucastpkts));
+    varname_len = sizeof(oid_ifinucastpkts) / sizeof(oid);
+    ifentry = varname + 9;
+    instance = varname + 10;
+    for (ifnum = 1, ip = iftot; ifnum <= cfg_nnets && ip < lastif;
+         ip++, ifnum++) {
+        memset(now, 0, sizeof(*now));
+        *instance = ifnum;
+        *ifentry = INUCASTPKTS;
+        var = getvarbyname(Session, varname, varname_len);
+        if (var) {
+            now->ift_ip = *var->val.integer;
+            snmp_free_var(var);
+        }
+        *ifentry = INNUCASTPKTS;
+        var = getvarbyname(Session, varname, varname_len);
+        if (var) {
+            now->ift_ip += *var->val.integer;
+            snmp_free_var(var);
+        }
+        *ifentry = INERRORS;
+        var = getvarbyname(Session, varname, varname_len);
+        if (var) {
+            now->ift_ie = *var->val.integer;
+            snmp_free_var(var);
+        }
+        *ifentry = OUTUCASTPKTS;
+        var = getvarbyname(Session, varname, varname_len);
+        if (var) {
+            now->ift_op = *var->val.integer;
+            snmp_free_var(var);
+        }
+        *ifentry = OUTNUCASTPKTS;
+        var = getvarbyname(Session, varname, varname_len);
+        if (var) {
+            now->ift_op += *var->val.integer;
+            snmp_free_var(var);
+        }
+        *ifentry = OUTERRORS;
+        var = getvarbyname(Session, varname, varname_len);
+        if (var) {
+            now->ift_oe = *var->val.integer;
+            snmp_free_var(var);
+        }
+
+        if (ip == interesting)
+            printf("%10d %8d %10d %8d %8d ",
+                   now->ift_ip - ip->ift_ip,
+                   now->ift_ie - ip->ift_ie,
+                   now->ift_op - ip->ift_op,
+                   now->ift_oe - ip->ift_oe, now->ift_co - ip->ift_co);
+        ip->ift_ip = now->ift_ip;
+        ip->ift_ie = now->ift_ie;
+        ip->ift_op = now->ift_op;
+        ip->ift_oe = now->ift_oe;
+        ip->ift_co = now->ift_co;
+        sum->ift_ip += ip->ift_ip;
+        sum->ift_ie += ip->ift_ie;
+        sum->ift_op += ip->ift_op;
+        sum->ift_oe += ip->ift_oe;
+        sum->ift_co += ip->ift_co;
+    }
+    if (lastif - iftot > 0)
+        printf("%10d %8d %10d %8d %8d ",
+               sum->ift_ip - total->ift_ip,
+               sum->ift_ie - total->ift_ie,
+               sum->ift_op - total->ift_op,
+               sum->ift_oe - total->ift_oe, sum->ift_co - total->ift_co);
+    *total = *sum;
+    putchar('\n');
+    fflush(stdout);
+    line++;
+
+    timerPause();
+    timerSet(interval);
+
+    if (line == 21)
+        goto banner;
+    goto loop;
+ /*NOTREACHED*/}
diff -Naur tomato/release/src/router/snmp/apps/snmpnetstat/inet6.c tomato121/release/src/router/snmp/apps/snmpnetstat/inet6.c
--- tomato/release/src/router/snmp/apps/snmpnetstat/inet6.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/apps/snmpnetstat/inet6.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,704 @@
+/****************************************************************
+	Copyright 1989, 1991, 1992 by Carnegie Mellon University
+
+                      All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its 
+documentation for any purpose and without fee is hereby granted, 
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in 
+supporting documentation, and that the name of CMU not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.  
+
+CMU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+CMU BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+******************************************************************/
+/*
+ * Copyright (c) 1983,1988 Regents of the University of California.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms are permitted
+ * provided that this notice is preserved and that due credit is given
+ * to the University of California at Berkeley. The name of the University
+ * may not be used to endorse or promote products derived from this
+ * software without specific prior written permission. This software
+ * is provided ``as is'' without express or implied warranty.
+ */
+
+#include <net-snmp/net-snmp-config.h>
+
+#ifdef INET6
+
+#if HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#if HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#if HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+
+#include <stdio.h>
+
+#if HAVE_SYS_PARAM_H
+#include <sys/param.h>
+#endif
+#if HAVE_SYS_SELECT_H
+#include <sys/select.h>
+#endif
+#if HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+#if HAVE_ARPA_INET_H
+#include <arpa/inet.h>
+#endif
+#if HAVE_WINSOCK_H
+#include <winsock.h>
+#include "winstub.h"
+#else
+#include <sys/socket.h>
+#include <netdb.h>
+#endif
+
+#include "main.h"
+#include <net-snmp/net-snmp-includes.h>
+#include "netstat.h"
+
+static char    *inet6name(struct in6_addr *);
+
+struct stat_table {
+    int             entry;      /* entry number in table */
+    /*
+     * format string to printf(description, value, plural(value)); 
+     */
+    /*
+     * warning: the %d must be before the %s 
+     */
+    char            description[80];
+};
+
+#if DEBUGGING_INFORMATION
+        /*
+         * The following tables provide useful debugging information.
+         * This isn't normally needed or easily accessible,
+         *   but could potentially be very useful.
+         * Rather than delete it totally, it's commented out
+         */
+static oid      oid_ipstats[] = { 1, 3, 6, 1, 2, 1, 4, 0, 0 };
+struct stat_table ip_stattab[] = {
+    {3, "%d total datagram%s received"},
+    {4, "%d datagram%s with header errors"},
+    {5, "%d datagram%s with an invalid destination address"},
+    {6, "%d datagram%s forwarded"},
+    {7, "%d datagram%s with unknown protocol"},
+    {8, "%d datagram%s discarded"},
+    {9, "%d datagram%s delivered"},
+    {10, "%d output datagram request%s"},
+    {11, "%d output datagram%s discarded"},
+    {12, "%d datagram%s with no route"},
+    {14, "%d fragment%s received"},
+    {15, "%d datagram%s reassembled"},
+    {16, "%d reassembly failure%s"},
+    {17, "%d datagram%s fragmented"},
+    {18, "%d fragmentation failure%s"},
+    {19, "%d fragment%s created"}
+};
+
+static oid      oid_udpstats[] = { 1, 3, 6, 1, 2, 1, 7, 0, 0 };
+struct stat_table udp_stattab[] = {
+    {1, "%d total datagram%s received"},
+    {2, "%d datagram%s to invalid port"},
+    {3, "%d datagram%s dropped due to errors"},
+    {4, "%d output datagram request%s"}
+};
+
+static oid      oid_tcpstats[] = { 1, 3, 6, 1, 2, 1, 6, 0, 0 };
+struct stat_table tcp_stattab[] = {
+    {5, "%d active open%s"},
+    {6, "%d passive open%s"},
+    {7, "%d failed attempt%s"},
+    {8, "%d reset%s of established connections"},
+    {9, "%d current established connection%s"},
+    {10, "%d segment%s received"},
+    {11, "%d segment%s sent"},
+    {12, "%d segment%s retransmitted"}
+};
+
+static oid      oid_icmpstats[] = { 1, 3, 6, 1, 2, 1, 5, 0, 0 };
+struct stat_table icmp_stattab[] = {
+    {1, "%d total message%s received"},
+    {2, "%d message%s dropped due to errors"},
+    {14, "%d ouput message request%s"},
+    {15, "%d output message%s discarded"}
+};
+
+struct stat_table icmp_inhistogram[] = {
+    {3, "Destination unreachable: %d"},
+    {4, "Time Exceeded: %d"},
+    {5, "Parameter Problem: %d"},
+    {6, "Source Quench: %d"},
+    {7, "Redirect: %d"},
+    {8, "Echo Request: %d"},
+    {9, "Echo Reply: %d"},
+    {10, "Timestamp Request: %d"},
+    {11, "Timestamp Reply: %d"},
+    {12, "Address Mask Request: %d"},
+    {13, "Addrss Mask Reply:%d"},
+};
+
+struct stat_table icmp_outhistogram[] = {
+    {16, "Destination unreachable: %d"},
+    {17, "Time Exceeded: %d"},
+    {18, "Parameter Problem: %d"},
+    {19, "Source Quench: %d"},
+    {20, "Redirect: %d"},
+    {21, "Echo Request: %d"},
+    {22, "Echo Reply: %d"},
+    {23, "Timestamp Request: %d"},
+    {24, "Timestamp Reply: %d"},
+    {25, "Address Mask Request: %d"},
+    {26, "Addrss Mask Reply:%d"},
+};
+#endif
+
+struct tcpconn_entry {
+    oid             instance[16 + 1 + 16 + 1 + 1];
+    struct in6_addr localAddress;
+    int             locAddrSet;
+    u_short         localPort;
+    int             locPortSet;
+    struct in6_addr remoteAddress;
+    int             remAddrSet;
+    u_short         remotePort;
+    int             remPortSet;
+    int             state;
+    int             stateSet;
+    struct tcpconn_entry *next;
+};
+
+struct udp_entry {
+    oid             instance[16 + 1 + 1];
+    struct in6_addr localAddress;
+    int             locAddrSet;
+    u_short         localPort;
+    int             locPortSet;
+    struct udp_entry *next;
+};
+
+#define TCPCONN_LOCADDR	1
+#define TCPCONN_LOCPORT	2
+#define TCPCONN_REMADDR	3
+#define TCPCONN_REMPORT	4
+#define TCPCONN_IFINDEX	5
+#define TCPCONN_STATE	6
+
+static oid      oid_tcpconntable[] = { 1, 3, 6, 1, 3, 86, 1, 16, 1 };
+#define TCP_ENTRY 9
+
+#define UDP_LOCADDR 	1
+#define UDP_LOCPORT	2
+#define UDP_IFINDEX	3
+
+static oid      oid_udptable[] = { 1, 3, 6, 1, 3, 87, 1, 1, 1 };
+#define UDP_ENTRY 9
+
+static const char *tcpstates[] = {
+    "",
+    "CLOSED",
+    "LISTEN",
+    "SYNSENT",
+    "SYNRECEIVED",
+    "ESTABLISHED",
+    "FINWAIT1",
+    "FINWAIT2",
+    "CLOSEWAIT",
+    "LASTACK",
+    "CLOSING",
+    "TIMEWAIT"
+};
+#define TCP_NSTATES 11
+
+static int      validUShortAssign(unsigned short *, int, const char *);
+
+/*
+ * Print a summary of connections related to an Internet
+ * protocol (currently only TCP).  For TCP, also give state of connection.
+ */
+void
+protopr6(const char *name)
+{
+    struct tcpconn_entry *tcpconn = NULL, *tcplast = NULL, *tp, *newtp;
+    struct udp_entry *udpconn = NULL, *udplast = NULL, *up, *newup;
+    netsnmp_pdu    *request = NULL, *response = NULL;
+    netsnmp_variable_list *vp;
+    oid            *instance;
+    int             first, status;
+
+    response = NULL;
+    if (strncmp(name, "tcp", 3) == 0) {
+        request = snmp_pdu_create(SNMP_MSG_GETNEXT);
+        snmp_add_null_var(request, oid_tcpconntable,
+                          sizeof(oid_tcpconntable) / sizeof(oid));
+        status = STAT_SUCCESS;
+    } else
+        status = STAT_TIMEOUT;
+    while (status == STAT_SUCCESS) {
+        if (response)
+            snmp_free_pdu(response);
+        response = NULL;
+        status = snmp_synch_response(Session, request, &response);
+        if (status != STAT_SUCCESS
+            || response->errstat != SNMP_ERR_NOERROR) {
+            snmp_perror("SNMP request failed");
+            break;
+        }
+        vp = response->variables;
+        if (!vp)
+            break;
+        if (vp->name_length != 46 ||
+            memcmp(vp->name, oid_tcpconntable, sizeof(oid_tcpconntable))) {
+            break;
+        }
+
+        request = snmp_pdu_create(SNMP_MSG_GETNEXT);
+        snmp_add_null_var(request, vp->name, vp->name_length);
+
+        instance = vp->name + 10;
+        for (tp = tcpconn; tp != NULL; tp = tp->next) {
+            if (!memcmp(instance, tp->instance, sizeof(tp->instance)))
+                break;
+        }
+        if (tp == NULL) {
+            tp = (struct tcpconn_entry *) calloc(1,
+                                                 sizeof(struct
+                                                        tcpconn_entry));
+            if (tp == NULL)
+                break;
+            if (tcplast != NULL)
+                tcplast->next = tp;
+            tcplast = tp;
+            if (tcpconn == NULL)
+                tcpconn = tp;
+            memmove(tp->instance, instance, sizeof(tp->instance));
+        }
+
+        if (vp->name[TCP_ENTRY] == TCPCONN_STATE) {
+            tp->state = *vp->val.integer;
+            tp->stateSet = 1;
+        }
+
+        if (vp->name[TCP_ENTRY] == TCPCONN_LOCADDR) {
+            memmove(&tp->localAddress, vp->val.string,
+                    sizeof(struct in6_addr));
+            tp->locAddrSet = 1;
+        }
+
+        if (vp->name[TCP_ENTRY] == TCPCONN_LOCPORT) {
+            if (validUShortAssign(&tp->localPort, *vp->val.integer,
+                                  "TCPCONN_LOCPORT"))
+                tp->locPortSet = 1;
+        }
+
+        if (vp->name[TCP_ENTRY] == TCPCONN_REMADDR) {
+            memmove(&tp->remoteAddress, vp->val.string,
+                    sizeof(struct in6_addr));
+            tp->remAddrSet = 1;
+        }
+
+        if (vp->name[TCP_ENTRY] == TCPCONN_REMPORT) {
+            if (validUShortAssign(&tp->remotePort, *vp->val.integer,
+                                  "TCPCONN_REMPORT"))
+                tp->remPortSet = 1;
+        }
+    }
+    if (response)
+        snmp_free_pdu(response);
+    response = NULL;
+
+    for (first = 1, tp = tcpconn, newtp = NULL; tp != NULL; tp = tp->next) {
+        if (newtp)
+            free(newtp);
+        newtp = tp;
+        if (!(tp->stateSet && tp->locAddrSet
+              && tp->locPortSet && tp->remAddrSet && tp->remPortSet)) {
+            printf("incomplete entry\n");
+            continue;
+        }
+        if (!aflag && tp->state == MIB_TCPCONNSTATE_LISTEN)
+            continue;
+        if (first) {
+            printf("Active Internet (%s) Connections", name);
+            if (aflag)
+                printf(" (including servers)");
+            putchar('\n');
+            printf("%-5.5s %-28.28s %-28.28s %s\n",
+                   "Proto", "Local Address", "Foreign Address", "(state)");
+            first = 0;
+        }
+        printf("%-5.5s ", name);
+        inet6print(&tp->localAddress, tp->localPort, name);
+        inet6print(&tp->remoteAddress, tp->remotePort, name);
+        if (tp->state < 1 || tp->state > TCP_NSTATES)
+            printf(" %d", tp->state);
+        else
+            printf(" %s", tcpstates[tp->state]);
+        putchar('\n');
+    }
+    if (newtp)
+        free(newtp);
+
+    response = NULL;
+    if (strncmp(name, "udp", 3) == 0) {
+        request = snmp_pdu_create(SNMP_MSG_GETNEXT);
+        snmp_add_null_var(request, oid_udptable,
+                          sizeof(oid_udptable) / sizeof(oid));
+        status = STAT_SUCCESS;
+    } else
+        status = STAT_TIMEOUT;
+    while (status == STAT_SUCCESS) {
+        if (response)
+            snmp_free_pdu(response);
+        response = NULL;
+        status = snmp_synch_response(Session, request, &response);
+        if (status != STAT_SUCCESS
+            || response->errstat != SNMP_ERR_NOERROR) {
+            fprintf(stderr, "SNMP request failed\n");
+            break;
+        }
+        vp = response->variables;
+        if (!vp)
+            break;
+        if (vp->name_length != 28 ||
+            memcmp(vp->name, oid_udptable, sizeof(oid_udptable))) {
+            break;
+        }
+
+        request = snmp_pdu_create(SNMP_MSG_GETNEXT);
+        snmp_add_null_var(request, vp->name, vp->name_length);
+
+        instance = vp->name + 10;
+        for (up = udpconn; up != NULL; up = up->next) {
+            if (!memcmp(instance, up->instance, sizeof(up->instance)))
+                break;
+        }
+        if (up == NULL) {
+            up = (struct udp_entry *) calloc(1, sizeof(struct udp_entry));
+            if (up == NULL)
+                break;
+            if (udplast != NULL)
+                udplast->next = up;
+            udplast = up;
+            if (udpconn == NULL)
+                udpconn = up;
+            memmove(up->instance, instance, sizeof(up->instance));
+        }
+
+        if (vp->name[UDP_ENTRY] == UDP_LOCADDR) {
+            memmove(&up->localAddress, vp->val.string,
+                    sizeof(struct in6_addr));
+            up->locAddrSet = 1;
+        }
+
+        if (vp->name[UDP_ENTRY] == UDP_LOCPORT) {
+            if (validUShortAssign(&up->localPort, *vp->val.integer,
+                                  "UDP_LOCPORT"))
+                up->locPortSet = 1;
+        }
+    }
+    if (response)
+        snmp_free_pdu(response);
+    response = NULL;
+
+    for (first = 1, up = udpconn, newup = NULL; up != NULL; up = up->next) {
+        if (newup)
+            free(newup);
+        newup = up;
+        if (!(up->locAddrSet && up->locPortSet)) {
+            printf("incomplete entry\n");
+            continue;
+        }
+        if (first) {
+            printf("Active Internet (%s) Connections", name);
+            putchar('\n');
+            printf("%-5.5s %-28.28s\n", "Proto", "Local Address");
+            first = 0;
+        }
+        printf("%-5.5s ", name);
+        inet6print(&up->localAddress, up->localPort, name);
+        putchar('\n');
+    }
+    if (newup)
+        free(newup);
+
+}
+
+static int
+validUShortAssign(unsigned short *pushort, int ival, const char *errstr)
+{
+    u_long          ulval = (u_long) ival;
+    if (ival > 65535) {
+        printf("Warning: %s value %ld (0x%lx) is not a port address\n",
+               errstr, ulval, ulval);
+        return 0;
+    }
+    *pushort = (unsigned short) ulval;
+    return 1;
+}
+
+
+#if DEBUGGING_INFORMATION
+        /*
+         * The following routines print out useful debugging information.
+         * This isn't normally needed or easily accessible,
+         *   but could potentially be very useful.
+         * Rather than delete it totally, it's commented out
+         */
+/*
+ * Dump UDP statistics structure.
+ */
+void
+udp_stats(void)
+{
+    oid             varname[MAX_OID_LEN], *udpentry;
+    int             varname_len;
+    netsnmp_variable_list *var;
+    int             count;
+    struct stat_table *sp = udp_stattab;
+
+    memmove(varname, oid_udpstats, sizeof(oid_udpstats));
+    varname_len = sizeof(oid_udpstats) / sizeof(oid);
+    udpentry = varname + 7;
+    printf("udp:\n");
+    count = sizeof(udp_stattab) / sizeof(struct stat_table);
+    while (count--) {
+        *udpentry = sp->entry;
+        var = getvarbyname(Session, varname, varname_len);
+        if (var && var->val.integer) {
+            putchar('\t');
+            printf(sp->description, *var->val.integer,
+                   plural((int) *var->val.integer));
+            putchar('\n');
+        }
+        if (var)
+            snmp_free_var(var);
+        sp++;
+    }
+
+}
+
+/*
+ * Dump TCP statistics structure.
+ */
+void
+tcp_stats(void)
+{
+    oid             varname[MAX_OID_LEN], *tcpentry;
+    int             varname_len;
+    netsnmp_variable_list *var;
+    int             count;
+    struct stat_table *sp = tcp_stattab;
+
+    memmove(varname, oid_tcpstats, sizeof(oid_tcpstats));
+    varname_len = sizeof(oid_tcpstats) / sizeof(oid);
+    tcpentry = varname + 7;
+    printf("tcp:\n");
+    count = sizeof(tcp_stattab) / sizeof(struct stat_table);
+    while (count--) {
+        *tcpentry = sp->entry;
+        var = getvarbyname(Session, varname, varname_len);
+        if (var && var->val.integer) {
+            putchar('\t');
+            printf(sp->description, *var->val.integer,
+                   plural((int) *var->val.integer));
+            putchar('\n');
+        }
+        if (var)
+            snmp_free_var(var);
+        sp++;
+    }
+
+}
+
+/*
+ * Dump IP statistics structure.
+ */
+void
+ip_stats(void)
+{
+    oid             varname[MAX_OID_LEN], *ipentry;
+    int             varname_len;
+    netsnmp_variable_list *var;
+    int             count;
+    struct stat_table *sp = ip_stattab;
+
+    memmove(varname, oid_ipstats, sizeof(oid_ipstats));
+    varname_len = sizeof(oid_ipstats) / sizeof(oid);
+    ipentry = varname + 7;
+    printf("ip:\n");
+    count = sizeof(ip_stattab) / sizeof(struct stat_table);
+    while (count--) {
+        *ipentry = sp->entry;
+        var = getvarbyname(Session, varname, varname_len);
+        if (var && var->val.integer) {
+            putchar('\t');
+            printf(sp->description, *var->val.integer,
+                   plural((int) *var->val.integer));
+            putchar('\n');
+        }
+        if (var)
+            snmp_free_var(var);
+        sp++;
+    }
+
+}
+
+/*
+ * Dump ICMP statistics.
+ */
+void
+icmp_stats(void)
+{
+    oid             varname[MAX_OID_LEN], *icmpentry;
+    int             varname_len;
+    netsnmp_variable_list *var;
+    int             count, first;
+    struct stat_table *sp;
+
+    memmove(varname, oid_icmpstats, sizeof(oid_icmpstats));
+    varname_len = sizeof(oid_icmpstats) / sizeof(oid);
+    icmpentry = varname + 7;
+    printf("icmp:\n");
+    sp = icmp_stattab;
+    count = sizeof(icmp_stattab) / sizeof(struct stat_table);
+    while (count--) {
+        *icmpentry = sp->entry;
+        var = getvarbyname(Session, varname, varname_len);
+        if (var && var->val.integer) {
+            putchar('\t');
+            printf(sp->description, *var->val.integer,
+                   plural((int) *var->val.integer));
+            putchar('\n');
+        }
+        if (var)
+            snmp_free_var(var);
+        sp++;
+    }
+
+    sp = icmp_outhistogram;
+    first = 1;
+    count = sizeof(icmp_outhistogram) / sizeof(struct stat_table);
+    while (count--) {
+        *icmpentry = sp->entry;
+        var = getvarbyname(Session, varname, varname_len);
+        if (var && var->val.integer && *var->val.integer != 0) {
+            if (first) {
+                printf("\tOutput Histogram:\n");
+                first = 0;
+            }
+            printf("\t\t");
+            printf(sp->description, *var->val.integer,
+                   plural((int) *var->val.integer));
+            putchar('\n');
+        }
+        if (var)
+            snmp_free_var(var);
+        sp++;
+    }
+
+    sp = icmp_inhistogram;
+    first = 1;
+    count = sizeof(icmp_inhistogram) / sizeof(struct stat_table);
+    while (count--) {
+        *icmpentry = sp->entry;
+        var = getvarbyname(Session, varname, varname_len);
+        if (var && var->val.integer && *var->val.integer != 0) {
+            if (first) {
+                printf("\tInput Histogram:\n");
+                first = 0;
+            }
+            printf("\t\t");
+            printf(sp->description, *var->val.integer,
+                   plural((int) *var->val.integer));
+            putchar('\n');
+        }
+        if (var)
+            snmp_free_var(var);
+        sp++;
+    }
+}
+#endif
+
+/*
+ * Pretty print an Internet address (net address + port).
+ * If the nflag was specified, use numbers instead of names.
+ */
+void
+inet6print(struct in6_addr *in, u_short port, const char *proto)
+{
+    struct servent *sp = 0;
+    char            line[80], *cp;
+    int             width;
+
+    sprintf(line, "%.*s.", 22, inet6name(in));
+    cp = strchr(line, '\0');
+    if (!nflag && port)
+        sp = getservbyport(htons(port), proto);
+    if (sp || port == 0)
+        sprintf(cp, "%.8s", sp ? sp->s_name : "*");
+    else
+        sprintf(cp, "%d", port);
+    width = 28;
+    printf(" %-*.*s", width, width, line);
+}
+
+/*
+ * Construct an Internet address representation.
+ * If the nflag has been supplied, give 
+ * numeric value, otherwise try for symbolic name.
+ */
+static char    *
+inet6name(struct in6_addr *in)
+{
+    register char  *cp;
+    static char     line[50];
+    struct hostent *hp;
+    static char     domain[MAXHOSTNAMELEN + 1];
+    static int      first = 1;
+
+    if (first && !nflag) {
+        first = 0;
+        if (gethostname(domain, MAXHOSTNAMELEN) == 0 &&
+            (cp = strchr(domain, '.')))
+            (void) strcpy(domain, cp + 1);
+        else
+            domain[0] = 0;
+    }
+    cp = 0;
+    if (!nflag && !IN6_IS_ADDR_UNSPECIFIED(in)) {
+        hp = gethostbyaddr((char *) in, sizeof(*in), AF_INET6);
+        if (hp) {
+            if ((cp = strchr(hp->h_name, '.')) && !strcmp(cp + 1, domain))
+                *cp = 0;
+            cp = hp->h_name;
+        }
+    }
+    if (IN6_IS_ADDR_UNSPECIFIED(in))
+        strcpy(line, "*");
+    else if (cp) {
+        strncpy(line, cp, sizeof(line));
+        line[ sizeof(line)-1 ] = 0;
+    } else
+        inet_ntop(AF_INET6, in, line, sizeof(line));
+    return (line);
+}
+
+#endif                          /* INET6 */
diff -Naur tomato/release/src/router/snmp/apps/snmpnetstat/inet.c tomato121/release/src/router/snmp/apps/snmpnetstat/inet.c
--- tomato/release/src/router/snmp/apps/snmpnetstat/inet.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/apps/snmpnetstat/inet.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,700 @@
+/****************************************************************
+	Copyright 1989, 1991, 1992 by Carnegie Mellon University
+
+                      All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its 
+documentation for any purpose and without fee is hereby granted, 
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in 
+supporting documentation, and that the name of CMU not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.  
+
+CMU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+CMU BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+******************************************************************/
+/*
+ * Copyright (c) 1983,1988 Regents of the University of California.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms are permitted
+ * provided that this notice is preserved and that due credit is given
+ * to the University of California at Berkeley. The name of the University
+ * may not be used to endorse or promote products derived from this
+ * software without specific prior written permission. This software
+ * is provided ``as is'' without express or implied warranty.
+ */
+
+#include <net-snmp/net-snmp-config.h>
+
+#if HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#if HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#if HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+
+#include <stdio.h>
+
+#if HAVE_SYS_PARAM_H
+#include <sys/param.h>
+#endif
+#if HAVE_SYS_SELECT_H
+#include <sys/select.h>
+#endif
+#if HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+#if HAVE_ARPA_INET_H
+#include <arpa/inet.h>
+#endif
+#if HAVE_WINSOCK_H
+#include <winsock.h>
+#include "winstub.h"
+#endif
+#if HAVE_SYS_SOCKET_H
+#include <sys/socket.h>
+#endif
+#if HAVE_NETDB_H
+#include <netdb.h>
+#endif
+
+#include "main.h"
+#include <net-snmp/net-snmp-includes.h>
+#include "netstat.h"
+
+static char    *inetname(struct in_addr);
+
+struct stat_table {
+    int             entry;      /* entry number in table */
+    /*
+     * format string to printf(description, value, plural(value)); 
+     */
+    /*
+     * warning: the %d must be before the %s 
+     */
+    char            description[80];
+};
+
+static oid      oid_ipstats[] = { 1, 3, 6, 1, 2, 1, 4, 0, 0 };
+struct stat_table ip_stattab[] = {
+    {3, "%d total datagram%s received"},
+    {4, "%d datagram%s with header errors"},
+    {5, "%d datagram%s with an invalid destination address"},
+    {6, "%d datagram%s forwarded"},
+    {7, "%d datagram%s with unknown protocol"},
+    {8, "%d datagram%s discarded"},
+    {9, "%d datagram%s delivered"},
+    {10, "%d output datagram request%s"},
+    {11, "%d output datagram%s discarded"},
+    {12, "%d datagram%s with no route"},
+    {14, "%d fragment%s received"},
+    {15, "%d datagram%s reassembled"},
+    {16, "%d reassembly failure%s"},
+    {17, "%d datagram%s fragmented"},
+    {18, "%d fragmentation failure%s"},
+    {19, "%d fragment%s created"}
+};
+
+static oid      oid_udpstats[] = { 1, 3, 6, 1, 2, 1, 7, 0, 0 };
+struct stat_table udp_stattab[] = {
+    {1, "%d total datagram%s received"},
+    {2, "%d datagram%s to invalid port"},
+    {3, "%d datagram%s dropped due to errors"},
+    {4, "%d output datagram request%s"}
+};
+
+static oid      oid_tcpstats[] = { 1, 3, 6, 1, 2, 1, 6, 0, 0 };
+struct stat_table tcp_stattab[] = {
+    {5, "%d active open%s"},
+    {6, "%d passive open%s"},
+    {7, "%d failed attempt%s"},
+    {8, "%d reset%s of established connections"},
+    {9, "%d current established connection%s"},
+    {10, "%d segment%s received"},
+    {11, "%d segment%s sent"},
+    {12, "%d segment%s retransmitted"}
+};
+
+static oid      oid_icmpstats[] = { 1, 3, 6, 1, 2, 1, 5, 0, 0 };
+struct stat_table icmp_stattab[] = {
+    {1, "%d total message%s received"},
+    {2, "%d message%s dropped due to errors"},
+    {14, "%d ouput message request%s"},
+    {15, "%d output message%s discarded"}
+};
+
+struct stat_table icmp_inhistogram[] = {
+    {3, "Destination unreachable: %d"},
+    {4, "Time Exceeded: %d"},
+    {5, "Parameter Problem: %d"},
+    {6, "Source Quench: %d"},
+    {7, "Redirect: %d"},
+    {8, "Echo Request: %d"},
+    {9, "Echo Reply: %d"},
+    {10, "Timestamp Request: %d"},
+    {11, "Timestamp Reply: %d"},
+    {12, "Address Mask Request: %d"},
+    {13, "Addrss Mask Reply:%d"},
+};
+
+struct stat_table icmp_outhistogram[] = {
+    {16, "Destination unreachable: %d"},
+    {17, "Time Exceeded: %d"},
+    {18, "Parameter Problem: %d"},
+    {19, "Source Quench: %d"},
+    {20, "Redirect: %d"},
+    {21, "Echo Request: %d"},
+    {22, "Echo Reply: %d"},
+    {23, "Timestamp Request: %d"},
+    {24, "Timestamp Reply: %d"},
+    {25, "Address Mask Request: %d"},
+    {26, "Addrss Mask Reply:%d"},
+};
+
+struct tcpconn_entry {
+    oid             instance[10];
+    struct in_addr  localAddress;
+    int             locAddrSet;
+    u_short         localPort;
+    int             locPortSet;
+    struct in_addr  remoteAddress;
+    int             remAddrSet;
+    u_short         remotePort;
+    int             remPortSet;
+    int             state;
+    int             stateSet;
+    struct tcpconn_entry *next;
+};
+
+struct udp_entry {
+    oid             instance[5];
+    struct in_addr  localAddress;
+    int             locAddrSet;
+    u_short         localPort;
+    int             locPortSet;
+    struct udp_entry *next;
+};
+
+#define TCPCONN_STATE	1
+#define TCPCONN_LOCADDR	2
+#define TCPCONN_LOCPORT	3
+#define TCPCONN_REMADDR	4
+#define TCPCONN_REMPORT	5
+
+static oid      oid_tcpconntable[] = { 1, 3, 6, 1, 2, 1, 6, 13, 1 };
+#define TCP_ENTRY 9
+
+#define UDP_LOCADDR 	1
+#define UDP_LOCPORT	2
+
+static oid      oid_udptable[] = { 1, 3, 6, 1, 2, 1, 7, 5, 1 };
+#define UDP_ENTRY 9
+
+const char     *tcpstates[] = {
+    "",
+    "CLOSED",
+    "LISTEN",
+    "SYNSENT",
+    "SYNRECEIVED",
+    "ESTABLISHED",
+    "FINWAIT1",
+    "FINWAIT2",
+    "CLOSEWAIT",
+    "LASTACK",
+    "CLOSING",
+    "TIMEWAIT"
+};
+#define TCP_NSTATES 11
+
+int             validUShortAssign(unsigned short *, int, const char *);
+
+/*
+ * Print a summary of connections related to an Internet
+ * protocol (currently only TCP).  For TCP, also give state of connection.
+ */
+void
+protopr(const char *name)
+{
+    struct tcpconn_entry *tcpconn = NULL, *tcplast = NULL, *tp, *newtp;
+    struct udp_entry *udpconn = NULL, *udplast = NULL, *up, *newup;
+    netsnmp_pdu    *request = NULL, *response = NULL;
+    netsnmp_variable_list *vp;
+    oid            *instance;
+    int             first, status;
+
+
+    response = NULL;
+    if (strcmp(name, "tcp") == 0) {
+        request = snmp_pdu_create(SNMP_MSG_GETNEXT);
+        snmp_add_null_var(request, oid_tcpconntable,
+                          sizeof(oid_tcpconntable) / sizeof(oid));
+        status = STAT_SUCCESS;
+    } else
+        status = STAT_TIMEOUT;
+    while (status == STAT_SUCCESS) {
+        if (response)
+            snmp_free_pdu(response);
+        response = NULL;
+        status = snmp_synch_response(Session, request, &response);
+        if (status != STAT_SUCCESS
+            || response->errstat != SNMP_ERR_NOERROR) {
+            snmp_sess_perror("SNMP request failed", Session);
+            break;
+        }
+        vp = response->variables;
+        if (!vp)
+            break;
+        if (vp->name_length != 20 ||
+            memcmp(vp->name, oid_tcpconntable, sizeof(oid_tcpconntable))) {
+            break;
+        }
+
+        request = snmp_pdu_create(SNMP_MSG_GETNEXT);
+        snmp_add_null_var(request, vp->name, vp->name_length);
+
+        instance = vp->name + 10;
+        for (tp = tcpconn; tp != NULL; tp = tp->next) {
+            if (!memcmp(instance, tp->instance, sizeof(tp->instance)))
+                break;
+        }
+        if (tp == NULL) {
+            tp = (struct tcpconn_entry *) calloc(1,
+                                                 sizeof(struct
+                                                        tcpconn_entry));
+            if (tp == NULL)
+                break;
+            if (tcplast != NULL)
+                tcplast->next = tp;
+            tcplast = tp;
+            if (tcpconn == NULL)
+                tcpconn = tp;
+            memmove(tp->instance, instance, sizeof(tp->instance));
+        }
+
+        if (vp->name[TCP_ENTRY] == TCPCONN_STATE) {
+            tp->state = *vp->val.integer;
+            tp->stateSet = 1;
+        }
+
+        if (vp->name[TCP_ENTRY] == TCPCONN_LOCADDR) {
+            memmove(&tp->localAddress, vp->val.string, sizeof(u_long));
+            tp->locAddrSet = 1;
+        }
+
+        if (vp->name[TCP_ENTRY] == TCPCONN_LOCPORT) {
+            if (validUShortAssign(&tp->localPort, *vp->val.integer,
+                                  "TCPCONN_LOCPORT"))
+                tp->locPortSet = 1;
+        }
+
+        if (vp->name[TCP_ENTRY] == TCPCONN_REMADDR) {
+            memmove(&tp->remoteAddress, vp->val.string, sizeof(u_long));
+            tp->remAddrSet = 1;
+        }
+
+        if (vp->name[TCP_ENTRY] == TCPCONN_REMPORT) {
+            if (validUShortAssign(&tp->remotePort, *vp->val.integer,
+                                  "TCPCONN_REMPORT"))
+                tp->remPortSet = 1;
+        }
+    }
+    if (response)
+        snmp_free_pdu(response);
+    response = NULL;
+
+    for (first = 1, tp = tcpconn, newtp = NULL; tp != NULL; tp = tp->next) {
+        if (newtp)
+            free(newtp);
+        newtp = tp;
+        if (!(tp->stateSet && tp->locAddrSet
+              && tp->locPortSet && tp->remAddrSet && tp->remPortSet)) {
+            printf("incomplete entry\n");
+            continue;
+        }
+        if (!aflag && tp->state == MIB_TCPCONNSTATE_LISTEN)
+            continue;
+        if (first) {
+            printf("Active Internet (%s) Connections", name);
+            if (aflag)
+                printf(" (including servers)");
+            putchar('\n');
+            printf("%-5.5s %-28.28s %-28.28s %s\n",
+                   "Proto", "Local Address", "Foreign Address", "(state)");
+            first = 0;
+        }
+        printf("%-5.5s ", "tcp");
+        inetprint(&tp->localAddress, tp->localPort, "tcp");
+        inetprint(&tp->remoteAddress, tp->remotePort, "tcp");
+        if (tp->state < 1 || tp->state > TCP_NSTATES)
+            printf(" %d", tp->state);
+        else
+            printf(" %s", tcpstates[tp->state]);
+        putchar('\n');
+    }
+    if (newtp)
+        free(newtp);
+
+
+    response = NULL;
+    if (strcmp(name, "udp") == 0) {
+        request = snmp_pdu_create(SNMP_MSG_GETNEXT);
+        snmp_add_null_var(request, oid_udptable,
+                          sizeof(oid_udptable) / sizeof(oid));
+        status = STAT_SUCCESS;
+    } else
+        status = STAT_TIMEOUT;
+    while (status == STAT_SUCCESS) {
+        if (response)
+            snmp_free_pdu(response);
+        response = NULL;
+        status = snmp_synch_response(Session, request, &response);
+        if (status != STAT_SUCCESS
+            || response->errstat != SNMP_ERR_NOERROR) {
+            fprintf(stderr, "SNMP request failed\n");
+            break;
+        }
+        vp = response->variables;
+        if (!vp)
+            break;
+        if (vp->name_length != 15 ||
+            memcmp(vp->name, oid_udptable, sizeof(oid_udptable))) {
+            break;
+        }
+
+        request = snmp_pdu_create(SNMP_MSG_GETNEXT);
+        snmp_add_null_var(request, vp->name, vp->name_length);
+
+        instance = vp->name + 10;
+        for (up = udpconn; up != NULL; up = up->next) {
+            if (!memcmp(instance, up->instance, sizeof(up->instance)))
+                break;
+        }
+        if (up == NULL) {
+            up = (struct udp_entry *) calloc(1, sizeof(struct udp_entry));
+            if (up == NULL)
+                break;
+            if (udplast != NULL)
+                udplast->next = up;
+            udplast = up;
+            if (udpconn == NULL)
+                udpconn = up;
+            memmove(up->instance, instance, sizeof(up->instance));
+        }
+
+        if (vp->name[UDP_ENTRY] == UDP_LOCADDR) {
+            memmove(&up->localAddress, vp->val.string, sizeof(u_long));
+            up->locAddrSet = 1;
+        }
+
+        if (vp->name[UDP_ENTRY] == UDP_LOCPORT) {
+            if (validUShortAssign(&up->localPort, *vp->val.integer,
+                                  "UDP_LOCPORT"))
+                up->locPortSet = 1;
+        }
+    }
+    if (response)
+        snmp_free_pdu(response);
+    response = NULL;
+
+    for (first = 1, up = udpconn, newup = NULL; up != NULL; up = up->next) {
+        if (newup)
+            free(newup);
+        newup = up;
+        if (!(up->locAddrSet && up->locPortSet)) {
+            printf("incomplete entry\n");
+            continue;
+        }
+        if (first) {
+            printf("Active Internet (%s) Connections", name);
+            putchar('\n');
+            printf("%-5.5s %-28.28s\n", "Proto", "Local Address");
+            first = 0;
+        }
+        printf("%-5.5s ", "udp");
+        inetprint(&up->localAddress, up->localPort, "udp");
+        putchar('\n');
+    }
+    if (newup)
+        free(newup);
+
+}
+
+int
+validUShortAssign(unsigned short *pushort, int ival, const char *errstr)
+{
+    u_long          ulval = (u_long) ival;
+    if (ival > 65535) {
+        printf("Warning: %s value %ld (0x%lx) is not a port address\n",
+               errstr, ulval, ulval);
+        return 0;
+    }
+    *pushort = (unsigned short) ulval;
+    return 1;
+}
+
+
+/*
+ * Dump UDP statistics structure.
+ */
+void
+udp_stats(void)
+{
+    oid             varname[MAX_OID_LEN], *udpentry;
+    size_t          varname_len;
+    netsnmp_variable_list *var;
+    int             count;
+    struct stat_table *sp = udp_stattab;
+
+    memmove(varname, oid_udpstats, sizeof(oid_udpstats));
+    varname_len = sizeof(oid_udpstats) / sizeof(oid);
+    udpentry = varname + 7;
+    printf("udp:\n");
+    count = sizeof(udp_stattab) / sizeof(struct stat_table);
+    while (count--) {
+        *udpentry = sp->entry;
+        var = getvarbyname(Session, varname, varname_len);
+        if (var && var->val.integer) {
+            putchar('\t');
+            printf(sp->description, *var->val.integer,
+                   plural((int) *var->val.integer));
+            putchar('\n');
+        }
+        if (var)
+            snmp_free_var(var);
+        sp++;
+    }
+
+}
+
+/*
+ * Dump TCP statistics structure.
+ */
+void
+tcp_stats(void)
+{
+    oid             varname[MAX_OID_LEN], *tcpentry;
+    size_t          varname_len;
+    netsnmp_variable_list *var;
+    int             count;
+    struct stat_table *sp = tcp_stattab;
+
+    memmove(varname, oid_tcpstats, sizeof(oid_tcpstats));
+    varname_len = sizeof(oid_tcpstats) / sizeof(oid);
+    tcpentry = varname + 7;
+    printf("tcp:\n");
+    count = sizeof(tcp_stattab) / sizeof(struct stat_table);
+    while (count--) {
+        *tcpentry = sp->entry;
+        var = getvarbyname(Session, varname, varname_len);
+        if (var && var->val.integer) {
+            putchar('\t');
+            printf(sp->description, *var->val.integer,
+                   plural((int) *var->val.integer));
+            putchar('\n');
+        }
+        if (var)
+            snmp_free_var(var);
+        sp++;
+    }
+
+}
+
+/*
+ * Dump IP statistics structure.
+ */
+void
+ip_stats(void)
+{
+    oid             varname[MAX_OID_LEN], *ipentry;
+    size_t          varname_len;
+    netsnmp_variable_list *var;
+    int             count;
+    struct stat_table *sp = ip_stattab;
+
+    memmove(varname, oid_ipstats, sizeof(oid_ipstats));
+    varname_len = sizeof(oid_ipstats) / sizeof(oid);
+    ipentry = varname + 7;
+    printf("ip:\n");
+    count = sizeof(ip_stattab) / sizeof(struct stat_table);
+    while (count--) {
+        *ipentry = sp->entry;
+        var = getvarbyname(Session, varname, varname_len);
+        if (var && var->val.integer) {
+            putchar('\t');
+            printf(sp->description, *var->val.integer,
+                   plural((int) *var->val.integer));
+            putchar('\n');
+        }
+        if (var)
+            snmp_free_var(var);
+        sp++;
+    }
+
+}
+
+/*
+ * Dump ICMP statistics.
+ */
+void
+icmp_stats(void)
+{
+    oid             varname[MAX_OID_LEN], *icmpentry;
+    size_t          varname_len;
+    netsnmp_variable_list *var;
+    int             count, first;
+    struct stat_table *sp;
+
+    memmove(varname, oid_icmpstats, sizeof(oid_icmpstats));
+    varname_len = sizeof(oid_icmpstats) / sizeof(oid);
+    icmpentry = varname + 7;
+    printf("icmp:\n");
+    sp = icmp_stattab;
+    count = sizeof(icmp_stattab) / sizeof(struct stat_table);
+    while (count--) {
+        *icmpentry = sp->entry;
+        var = getvarbyname(Session, varname, varname_len);
+        if (var && var->val.integer) {
+            putchar('\t');
+            printf(sp->description, *var->val.integer,
+                   plural((int) *var->val.integer));
+            putchar('\n');
+        }
+        if (var)
+            snmp_free_var(var);
+        sp++;
+    }
+
+    sp = icmp_outhistogram;
+    first = 1;
+    count = sizeof(icmp_outhistogram) / sizeof(struct stat_table);
+    while (count--) {
+        *icmpentry = sp->entry;
+        var = getvarbyname(Session, varname, varname_len);
+        if (var && var->val.integer && *var->val.integer != 0) {
+            if (first) {
+                printf("\tOutput Histogram:\n");
+                first = 0;
+            }
+            printf("\t\t");
+            printf(sp->description, *var->val.integer,
+                   plural((int) *var->val.integer));
+            putchar('\n');
+        }
+        if (var)
+            snmp_free_var(var);
+        sp++;
+    }
+
+    sp = icmp_inhistogram;
+    first = 1;
+    count = sizeof(icmp_inhistogram) / sizeof(struct stat_table);
+    while (count--) {
+        *icmpentry = sp->entry;
+        var = getvarbyname(Session, varname, varname_len);
+        if (var && var->val.integer && *var->val.integer != 0) {
+            if (first) {
+                printf("\tInput Histogram:\n");
+                first = 0;
+            }
+            printf("\t\t");
+            printf(sp->description, *var->val.integer,
+                   plural((int) *var->val.integer));
+            putchar('\n');
+        }
+        if (var)
+            snmp_free_var(var);
+        sp++;
+    }
+}
+
+/*
+ * Pretty print an Internet address (net address + port).
+ * If the nflag was specified, use numbers instead of names.
+ */
+void
+inetprint(struct in_addr *in, u_short port, const char *proto)
+{
+    struct servent *sp = 0;
+    char            line[80], *cp;
+    int             width;
+
+    sprintf(line, "%.*s.", 22, inetname(*in));
+    cp = (char *) strchr(line, '\0');
+    if (!nflag && port)
+        sp = getservbyport(htons(port), proto);
+    if (sp || port == 0)
+        sprintf(cp, "%.8s", sp ? sp->s_name : "*");
+    else
+        sprintf(cp, "%d", port);
+    width = 28;
+    printf(" %-*.*s", width, width, line);
+}
+
+/*
+ * Construct an Internet address representation.
+ * If the nflag has been supplied, give 
+ * numeric value, otherwise try for symbolic name.
+ */
+static char    *
+inetname(struct in_addr in)
+{
+    register char  *cp;
+    static char     line[50];
+    struct hostent *hp;
+    struct netent  *np;
+    static char     domain[MAXHOSTNAMELEN + 1];
+    static int      first = 1;
+
+    if (first && !nflag) {
+        first = 0;
+        if (gethostname(domain, MAXHOSTNAMELEN) == 0 &&
+            (cp = (char *) strchr(domain, '.')))
+            (void) strcpy(domain, cp + 1);
+        else
+            domain[0] = 0;
+    }
+    cp = 0;
+    if (!nflag && in.s_addr != INADDR_ANY) {
+        u_long          net = inet_netof(in);
+        u_long          lna = inet_lnaof(in);
+
+        if (lna == INADDR_ANY) {
+            np = getnetbyaddr(net, AF_INET);
+            if (np)
+                cp = np->n_name;
+        }
+        if (cp == 0) {
+            hp = gethostbyaddr((char *) &in, sizeof(in), AF_INET);
+            if (hp) {
+                if ((cp = (char *) strchr(hp->h_name, '.')) &&
+                    !strcmp(cp + 1, domain))
+                    *cp = 0;
+                cp = (char *) hp->h_name;
+            }
+        }
+    }
+    if (in.s_addr == INADDR_ANY)
+        strcpy(line, "*");
+    else if (cp) {
+        strncpy(line, cp, sizeof(line));
+        line[ sizeof(line)-1 ] = 0;
+    } else {
+        in.s_addr = ntohl(in.s_addr);
+#define C(x)	(unsigned)((x) & 0xff)
+        sprintf(line, "%u.%u.%u.%u", C(in.s_addr >> 24),
+                C(in.s_addr >> 16), C(in.s_addr >> 8), C(in.s_addr));
+    }
+    return (line);
+}
diff -Naur tomato/release/src/router/snmp/apps/snmpnetstat/main.c tomato121/release/src/router/snmp/apps/snmpnetstat/main.c
--- tomato/release/src/router/snmp/apps/snmpnetstat/main.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/apps/snmpnetstat/main.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,475 @@
+/******************************************************************
+	Copyright 1989, 1991, 1992 by Carnegie Mellon University
+
+                      All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its 
+documentation for any purpose and without fee is hereby granted, 
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in 
+supporting documentation, and that the name of CMU not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.  
+
+CMU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+CMU BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+******************************************************************/
+/*
+ * Copyright (c) 1983,1988 Regents of the University of California.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms are permitted
+ * provided that this notice is preserved and that due credit is given
+ * to the University of California at Berkeley. The name of the University
+ * may not be used to endorse or promote products derived from this
+ * software without specific prior written permission. This software
+ * is provided ``as is'' without express or implied warranty.
+ */
+
+#include <net-snmp/net-snmp-config.h>
+
+#ifndef lint
+char            copyright[] =
+    "@(#) Copyright (c) 1983 Regents of the University of California.\n\
+ All rights reserved.\n";
+#endif                          /* not lint */
+
+#if HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#if HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#if HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+#include <net-snmp/utilities.h>
+
+#include <sys/types.h>
+#if HAVE_SYS_PARAM_H
+#include <sys/param.h>
+#endif
+#if TIME_WITH_SYS_TIME
+# ifdef WIN32
+#  include <sys/timeb.h>
+# else
+#  include <sys/time.h>
+# endif
+# include <time.h>
+#else
+# if HAVE_SYS_TIME_H
+#  include <sys/time.h>
+# else
+#  include <time.h>
+# endif
+#endif
+#if HAVE_SYS_SELECT_H
+#include <sys/select.h>
+#endif
+#if HAVE_WINSOCK_H
+#include <winsock.h>
+#include "winstub.h"
+#endif
+#if HAVE_SYS_SOCKET_H
+#include <sys/socket.h>
+#endif
+#if HAVE_NETDB_H
+#include <netdb.h>
+#endif
+
+#include <ctype.h>
+#include <errno.h>
+#include <stdio.h>
+#if HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+#if HAVE_ARPA_INET_H
+#include <arpa/inet.h>
+#endif
+
+#include <net-snmp/net-snmp-includes.h>
+#include "netstat.h"
+
+#define NULLPROTOX	((struct protox *) 0)
+struct protox {
+    u_char          pr_wanted;  /* 1 if wanted, 0 otherwise */
+    void            (*pr_cblocks) (const char *);       /* control blocks printing routine */
+    void            (*pr_stats) (void); /* statistics printing routine */
+    const char     *pr_name;    /* well-known name */
+} protox[] = {
+    {
+    0, protopr, tcp_stats, "tcp"}, {
+    0, protopr, udp_stats, "udp"},
+#ifdef INET6
+    {
+    0, protopr6, tcp_stats, "tcp6"}, {
+    0, protopr6, udp_stats, "udp6"},
+#endif
+    {
+    0, 0, ip_stats, "ip"}, {
+    0, 0, icmp_stats, "icmp"}, {
+    0, 0, 0, 0}
+};
+
+int             aflag;
+int             iflag;
+int             oflag;
+int             nflag;
+int             rflag;
+int             sflag;
+int             interval;
+char           *intrface;
+
+netsnmp_session *Session;
+int             print_errors = 0;
+
+static struct protoent *getprotoent46(void);
+
+void
+usage(void)
+{
+    fprintf(stderr,
+            "Usage: snmpnetstat [options...] hostname [ community ] [interval]\n");
+    fprintf(stderr, "NET-SNMP version: %s\n", netsnmp_get_version());
+    fprintf(stderr, "  -v [1 | 2c ]   SNMP version\n");
+    fprintf(stderr, "  -V             display version number\n");
+    fprintf(stderr, "  -p port        specify agent port number\n");
+    fprintf(stderr, "  -c community   specify community name\n");
+    fprintf(stderr, "  -t timeout     SNMP packet timeout (seconds)\n");
+    fprintf(stderr,
+            "  -i             show interfaces with packet counters\n");
+    fprintf(stderr,
+            "  -o             show interfaces with octet counters\n");
+    fprintf(stderr, "  -r             show routing table\n");
+    fprintf(stderr, "  -s             show general statistics\n");
+    fprintf(stderr, "  -n             show IP addresses, not names\n");
+    fprintf(stderr, "  -a             show sockets in LISTEN mode too\n");
+    fprintf(stderr,
+            "  -P proto       show only details for this protocol\n");
+    fprintf(stderr, "  -I interface   show only this interface\n");
+    fprintf(stderr, "  -d             dump packets\n");
+    fprintf(stderr, "  -Ddebugspec    \n");
+
+}
+
+int
+main(int argc, char *argv[])
+{
+    char           *hostname = NULL;
+    struct protoent *p;
+    struct protox  *tp = NULL;  /* for printing cblocks & stats */
+    int             allprotos = 1;
+    char           *community = NULL;
+    char           *argp;
+    netsnmp_session session;
+    int             dest_port = SNMP_PORT;
+    int             timeout = SNMP_DEFAULT_TIMEOUT;
+    int             version = SNMP_DEFAULT_VERSION;
+    int             arg;
+
+    init_mib();
+    /*
+     * Usage: snmpnetstatwalk -v 1 [-q] hostname community ...      or:
+     * Usage: snmpnetstat [-v 2 ] [-q] hostname noAuth     ...
+     */
+    while ((arg = getopt(argc, argv, "VhdqD:p:t:c:v:aionrsP:I:")) != EOF) {
+        switch (arg) {
+        case 'V':
+            fprintf(stderr, "NET-SNMP version: %s\n",
+                    netsnmp_get_version());
+            exit(0);
+            break;
+
+        case 'h':
+            usage();
+            exit(0);
+
+        case 'd':
+            snmp_set_dump_packet(1);
+            break;
+
+        case 'q':
+            snmp_set_quick_print(1);
+            break;
+
+        case 'D':
+            debug_register_tokens(optarg);
+            snmp_set_do_debugging(1);
+            break;
+        case 'p':
+            dest_port = atoi(optarg);
+            break;
+
+        case 't':
+            timeout = atoi(optarg);
+            timeout *= 1000000;
+            break;
+
+        case 'c':
+            community = optarg;
+            break;
+
+        case 'v':
+            argp = optarg;
+            if (!strcasecmp(argp, "1"))
+                version = SNMP_VERSION_1;
+            else if (!strcasecmp(argp, "2c"))
+                version = SNMP_VERSION_2c;
+            else {
+                fprintf(stderr, "Invalid version: %s\n", argp);
+                usage();
+                exit(1);
+            }
+            break;
+
+        case 'a':
+            aflag++;
+            break;
+
+        case 'i':
+            iflag++;
+            break;
+
+        case 'o':
+            oflag++;
+            break;
+
+        case 'n':
+            nflag++;
+            break;
+
+        case 'r':
+            rflag++;
+            break;
+
+        case 's':
+            sflag++;
+            break;
+
+        case 'P':
+            if ((tp = name2protox(optarg)) == NULLPROTOX) {
+                fprintf(stderr, "%s: unknown or uninstrumented protocol\n",
+                        optarg);
+                exit(1);
+            }
+            allprotos = 0;
+            tp->pr_wanted = 1;
+            break;
+
+        case 'I':
+            iflag++;
+            intrface = optarg;
+            break;
+
+        default:
+            exit(1);
+            break;
+        }
+        continue;
+    }
+
+    init_snmp("snmpapp");
+    if (version == SNMP_DEFAULT_VERSION) {
+        version = netsnmp_ds_get_int(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_SNMPVERSION);
+    }
+    if (hostname == NULL && optind < argc) {
+        hostname = argv[optind++];
+    }
+    if ((version == SNMP_VERSION_1 || version == SNMP_VERSION_2c)
+        && community == NULL && optind < argc) {
+        community = argv[optind++];
+        fprintf(stderr,
+                "Warning: positional community parameter is deprecated. Use -c\n");
+    }
+    if (optind < argc && isdigit(argv[optind][0])) {
+        interval = atoi(argv[optind++]);
+        if (interval <= 0) {
+            usage();
+            exit(1);
+        }
+        iflag++;
+    }
+    if (optind < argc) {
+        usage();
+        exit(1);
+    }
+
+    if (!hostname) {
+        fprintf(stderr, "Missing host name.\n");
+        exit(1);
+    }
+
+    snmp_sess_init(&session);
+    session.peername = hostname;
+    session.remote_port = dest_port;
+    session.timeout = timeout;
+    if (version == SNMP_VERSION_1 || version == SNMP_VERSION_2c) {
+        if (!community
+            && !(community =
+                 netsnmp_ds_get_string(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_COMMUNITY))) {
+            fprintf(stderr, "Missing community name.\n");
+            exit(1);
+        }
+        session.version = version;
+        session.community = (u_char *) community;
+        session.community_len = strlen((char *) community);
+    }
+
+    SOCK_STARTUP;
+
+    /*
+     * open an SNMP session 
+     */
+    Session = snmp_open(&session);
+    if (Session == NULL) {
+        /*
+         * diagnose snmp_open errors with the input netsnmp_session pointer 
+         */
+        snmp_sess_perror("snmpnetstat", &session);
+        SOCK_CLEANUP;
+        exit(1);
+    }
+
+    /*
+     * Keep file descriptors open to avoid overhead
+     * of open/close on each call to get* routines.
+     */
+    sethostent(1);
+    setnetent(1);
+    setprotoent(1);
+    setservent(1);
+
+    if (iflag) {
+        intpr(interval);
+    }
+    if (oflag) {
+        intpro(interval);
+    }
+    if (rflag) {
+        if (sflag)
+            rt_stats();
+        else
+            routepr();
+    }
+
+    if (iflag || rflag || oflag);
+    else {
+
+        while ((p = getprotoent46())) {
+            for (tp = protox; tp->pr_name; tp++) {
+                if (strcmp(tp->pr_name, p->p_name) == 0)
+                    break;
+            }
+            if (tp->pr_name == 0 || (tp->pr_wanted == 0 && allprotos == 0))
+                continue;
+            if (sflag) {
+                if (tp->pr_stats)
+                    (*tp->pr_stats) ();
+            } else if (tp->pr_cblocks)
+                (*tp->pr_cblocks) (tp->pr_name);
+        }
+    }                           /* ! iflag, rflag, oflag */
+
+    endprotoent();
+    endservent();
+    endnetent();
+    endhostent();
+
+    snmp_close(Session);
+
+    SOCK_CLEANUP;
+    return 0;
+}
+
+const char     *
+plural(int n)
+{
+
+    return (n != 1 ? "s" : "");
+}
+
+/*
+ * Find the protox for the given "well-known" name.
+ */
+struct protox  *
+knownname(const char *name)
+{
+    struct protox  *tp;
+
+    for (tp = protox; tp->pr_name; tp++)
+        if (strcmp(tp->pr_name, name) == 0)
+            return (tp);
+    return (NULLPROTOX);
+}
+
+/*
+ * Find the protox corresponding to name.
+ */
+struct protox  *
+name2protox(const char *name)
+{
+    struct protox  *tp;
+    char          **alias;      /* alias from p->aliases */
+    struct protoent *p;
+
+    /*
+     * Try to find the name in the list of "well-known" names. If that
+     * fails, check if name is an alias for an Internet protocol.
+     */
+    if ((tp = knownname(name)))
+        return (tp);
+
+    setprotoent(1);             /* make protocol lookup cheaper */
+    while ((p = getprotoent46())) {
+        /*
+         * assert: name not same as p->name 
+         */
+        for (alias = p->p_aliases; *alias; alias++)
+            if (strcasecmp(name, *alias) == 0) {
+                endprotoent();
+                return (knownname(p->p_name));
+            }
+    }
+    endprotoent();
+    return (NULLPROTOX);
+}
+
+static struct protoent *
+getprotoent46(void)
+{
+#ifdef INET6
+    static enum { NONE, V4, V6 } state = NONE;
+    static struct protoent v;
+    struct protoent *p;
+    int             l;
+
+    switch (state) {
+    case NONE:
+        p = getprotoent();
+        if (!p)
+            return p;
+        memcpy(&v, p, sizeof(v));
+        state = V4;
+        break;
+    case V4:
+        strcat(v.p_name, "4");
+        state = V6;
+        break;
+    case V6:
+        l = strlen(v.p_name);
+        v.p_name[l - 1] = '6';
+        state = NONE;
+        break;
+    }
+    return &v;
+#else
+    return getprotoent();
+#endif
+}
diff -Naur tomato/release/src/router/snmp/apps/snmpnetstat/main.h tomato121/release/src/router/snmp/apps/snmpnetstat/main.h
--- tomato/release/src/router/snmp/apps/snmpnetstat/main.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/apps/snmpnetstat/main.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,10 @@
+
+#ifndef MAXHOSTNAMELEN
+#define MAXHOSTNAMELEN	64
+#endif
+
+
+extern char    *community;
+extern struct sockaddr_in address;
+extern int      reqid;
+extern int      sd;
diff -Naur tomato/release/src/router/snmp/apps/snmpnetstat/Makefile.depend tomato121/release/src/router/snmp/apps/snmpnetstat/Makefile.depend
--- tomato/release/src/router/snmp/apps/snmpnetstat/Makefile.depend	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/apps/snmpnetstat/Makefile.depend	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,245 @@
+# DO NOT DELETE THIS LINE -- make depend depends on it.
+
+./if.lo: ../../include/net-snmp/net-snmp-config.h
+./if.lo: ../../include/net-snmp/system/linux.h
+./if.lo: ../../include/net-snmp/system/sysv.h
+./if.lo: ../../include/net-snmp/system/generic.h
+./if.lo: ../../include/net-snmp/machine/generic.h 
+./if.lo:   main.h
+./if.lo: ../../include/net-snmp/net-snmp-includes.h
+./if.lo: ../../include/net-snmp/definitions.h ../../include/net-snmp/types.h
+./if.lo: ../../include/net-snmp/library/snmp_api.h
+./if.lo: ../../include/net-snmp/library/asn1.h
+./if.lo: ../../include/net-snmp/library/snmp_impl.h
+./if.lo: ../../include/net-snmp/library/snmp.h
+./if.lo: ../../include/net-snmp/library/snmp-tc.h
+./if.lo: ../../include/net-snmp/utilities.h
+./if.lo: ../../include/net-snmp/library/snmp_client.h
+./if.lo: ../../include/net-snmp/library/getopt.h
+./if.lo: ../../include/net-snmp/library/system.h
+./if.lo: ../../include/net-snmp/library/tools.h
+./if.lo: ../../include/net-snmp/library/int64.h
+./if.lo: ../../include/net-snmp/library/mt_support.h
+./if.lo: ../../include/net-snmp/library/snmp_alarm.h
+./if.lo: ../../include/net-snmp/library/data_list.h
+./if.lo: ../../include/net-snmp/library/callback.h
+./if.lo: ../../include/net-snmp/library/oid_stash.h
+./if.lo: ../../include/net-snmp/library/check_varbind.h
+./if.lo: ../../include/net-snmp/version.h
+./if.lo: ../../include/net-snmp/session_api.h
+./if.lo: ../../include/net-snmp/library/snmp_transport.h
+./if.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./if.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./if.lo:  ../../include/net-snmp/library/snmpUDPDomain.h
+./if.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./if.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./if.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./if.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./if.lo: ../../include/net-snmp/library/ucd_compat.h
+./if.lo: ../../include/net-snmp/pdu_api.h ../../include/net-snmp/mib_api.h
+./if.lo: ../../include/net-snmp/library/mib.h
+./if.lo: ../../include/net-snmp/library/parse.h
+./if.lo: ../../include/net-snmp/varbind_api.h
+./if.lo: ../../include/net-snmp/config_api.h
+./if.lo: ../../include/net-snmp/library/read_config.h
+./if.lo: ../../include/net-snmp/library/default_store.h
+./if.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./if.lo: ../../include/net-snmp/library/snmp_enum.h
+./if.lo: ../../include/net-snmp/library/vacm.h
+./if.lo: ../../include/net-snmp/output_api.h
+./if.lo: ../../include/net-snmp/library/snmp_debug.h
+./if.lo: ../../include/net-snmp/library/snmp_logging.h 
+./if.lo:  ../../include/net-snmp/snmpv3_api.h
+./if.lo: ../../include/net-snmp/library/snmpv3.h
+./if.lo: ../../include/net-snmp/library/transform_oids.h
+./if.lo: ../../include/net-snmp/library/keytools.h
+./if.lo: ../../include/net-snmp/library/scapi.h
+./if.lo: ../../include/net-snmp/library/lcd_time.h
+./if.lo: ../../include/net-snmp/library/snmp_secmod.h
+./if.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./if.lo: ../../include/net-snmp/library/snmpusm.h netstat.h
+./inet6.lo: ../../include/net-snmp/net-snmp-config.h
+./inet6.lo: ../../include/net-snmp/system/linux.h
+./inet6.lo: ../../include/net-snmp/system/sysv.h
+./inet6.lo: ../../include/net-snmp/system/generic.h
+./inet6.lo: ../../include/net-snmp/machine/generic.h
+./inet.lo: ../../include/net-snmp/net-snmp-config.h
+./inet.lo: ../../include/net-snmp/system/linux.h
+./inet.lo: ../../include/net-snmp/system/sysv.h
+./inet.lo: ../../include/net-snmp/system/generic.h
+./inet.lo: ../../include/net-snmp/machine/generic.h 
+./inet.lo:  main.h
+./inet.lo: ../../include/net-snmp/net-snmp-includes.h 
+./inet.lo: ../../include/net-snmp/definitions.h
+./inet.lo: ../../include/net-snmp/types.h
+./inet.lo: ../../include/net-snmp/library/snmp_api.h
+./inet.lo: ../../include/net-snmp/library/asn1.h
+./inet.lo: ../../include/net-snmp/library/snmp_impl.h
+./inet.lo: ../../include/net-snmp/library/snmp.h
+./inet.lo: ../../include/net-snmp/library/snmp-tc.h
+./inet.lo: ../../include/net-snmp/utilities.h
+./inet.lo: ../../include/net-snmp/library/snmp_client.h
+./inet.lo: ../../include/net-snmp/library/getopt.h
+./inet.lo: ../../include/net-snmp/library/system.h
+./inet.lo: ../../include/net-snmp/library/tools.h
+./inet.lo: ../../include/net-snmp/library/int64.h
+./inet.lo: ../../include/net-snmp/library/mt_support.h
+./inet.lo: ../../include/net-snmp/library/snmp_alarm.h
+./inet.lo: ../../include/net-snmp/library/data_list.h
+./inet.lo: ../../include/net-snmp/library/callback.h
+./inet.lo: ../../include/net-snmp/library/oid_stash.h
+./inet.lo: ../../include/net-snmp/library/check_varbind.h
+./inet.lo: ../../include/net-snmp/version.h
+./inet.lo: ../../include/net-snmp/session_api.h
+./inet.lo: ../../include/net-snmp/library/snmp_transport.h
+./inet.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./inet.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./inet.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./inet.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./inet.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./inet.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./inet.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./inet.lo: ../../include/net-snmp/library/ucd_compat.h
+./inet.lo: ../../include/net-snmp/pdu_api.h ../../include/net-snmp/mib_api.h
+./inet.lo: ../../include/net-snmp/library/mib.h
+./inet.lo: ../../include/net-snmp/library/parse.h
+./inet.lo: ../../include/net-snmp/varbind_api.h
+./inet.lo: ../../include/net-snmp/config_api.h
+./inet.lo: ../../include/net-snmp/library/read_config.h
+./inet.lo: ../../include/net-snmp/library/default_store.h
+./inet.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./inet.lo: ../../include/net-snmp/library/snmp_enum.h
+./inet.lo: ../../include/net-snmp/library/vacm.h
+./inet.lo: ../../include/net-snmp/output_api.h
+./inet.lo: ../../include/net-snmp/library/snmp_debug.h
+./inet.lo: ../../include/net-snmp/library/snmp_logging.h
+./inet.lo: ../../include/net-snmp/snmpv3_api.h
+./inet.lo: ../../include/net-snmp/library/snmpv3.h
+./inet.lo: ../../include/net-snmp/library/transform_oids.h
+./inet.lo: ../../include/net-snmp/library/keytools.h
+./inet.lo: ../../include/net-snmp/library/scapi.h
+./inet.lo: ../../include/net-snmp/library/lcd_time.h
+./inet.lo: ../../include/net-snmp/library/snmp_secmod.h
+./inet.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./inet.lo: ../../include/net-snmp/library/snmpusm.h netstat.h
+./main.lo: ../../include/net-snmp/net-snmp-config.h
+./main.lo: ../../include/net-snmp/system/linux.h
+./main.lo: ../../include/net-snmp/system/sysv.h
+./main.lo: ../../include/net-snmp/system/generic.h
+./main.lo: ../../include/net-snmp/machine/generic.h 
+./main.lo: ../../include/net-snmp/utilities.h ../../include/net-snmp/types.h
+./main.lo: ../../include/net-snmp/definitions.h
+./main.lo: ../../include/net-snmp/library/snmp_api.h
+./main.lo: ../../include/net-snmp/library/asn1.h
+./main.lo: ../../include/net-snmp/library/snmp_impl.h
+./main.lo: ../../include/net-snmp/library/snmp.h
+./main.lo: ../../include/net-snmp/library/snmp-tc.h
+./main.lo: ../../include/net-snmp/library/snmp_client.h
+./main.lo: ../../include/net-snmp/library/getopt.h
+./main.lo: ../../include/net-snmp/library/system.h
+./main.lo: ../../include/net-snmp/library/tools.h
+./main.lo: ../../include/net-snmp/library/int64.h
+./main.lo: ../../include/net-snmp/library/mt_support.h
+./main.lo: ../../include/net-snmp/library/snmp_alarm.h
+./main.lo: ../../include/net-snmp/library/data_list.h
+./main.lo: ../../include/net-snmp/library/callback.h
+./main.lo: ../../include/net-snmp/library/oid_stash.h
+./main.lo: ../../include/net-snmp/library/check_varbind.h
+./main.lo: ../../include/net-snmp/version.h 
+./main.lo: ../../include/net-snmp/net-snmp-includes.h
+./main.lo: ../../include/net-snmp/session_api.h
+./main.lo: ../../include/net-snmp/library/snmp_transport.h
+./main.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./main.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./main.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./main.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./main.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./main.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./main.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./main.lo: ../../include/net-snmp/library/ucd_compat.h
+./main.lo: ../../include/net-snmp/pdu_api.h ../../include/net-snmp/mib_api.h
+./main.lo: ../../include/net-snmp/library/mib.h
+./main.lo: ../../include/net-snmp/library/parse.h
+./main.lo: ../../include/net-snmp/varbind_api.h
+./main.lo: ../../include/net-snmp/config_api.h
+./main.lo: ../../include/net-snmp/library/read_config.h
+./main.lo: ../../include/net-snmp/library/default_store.h
+./main.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./main.lo: ../../include/net-snmp/library/snmp_enum.h
+./main.lo: ../../include/net-snmp/library/vacm.h
+./main.lo: ../../include/net-snmp/output_api.h
+./main.lo: ../../include/net-snmp/library/snmp_debug.h
+./main.lo: ../../include/net-snmp/library/snmp_logging.h
+./main.lo: ../../include/net-snmp/snmpv3_api.h
+./main.lo: ../../include/net-snmp/library/snmpv3.h
+./main.lo: ../../include/net-snmp/library/transform_oids.h
+./main.lo: ../../include/net-snmp/library/keytools.h
+./main.lo: ../../include/net-snmp/library/scapi.h
+./main.lo: ../../include/net-snmp/library/lcd_time.h
+./main.lo: ../../include/net-snmp/library/snmp_secmod.h
+./main.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./main.lo: ../../include/net-snmp/library/snmpusm.h netstat.h
+./route.lo: ../../include/net-snmp/net-snmp-config.h
+./route.lo: ../../include/net-snmp/system/linux.h
+./route.lo: ../../include/net-snmp/system/sysv.h
+./route.lo: ../../include/net-snmp/system/generic.h
+./route.lo: ../../include/net-snmp/machine/generic.h 
+./route.lo:  main.h
+./route.lo: ../../include/net-snmp/net-snmp-includes.h
+./route.lo:  ../../include/net-snmp/definitions.h
+./route.lo: ../../include/net-snmp/types.h
+./route.lo: ../../include/net-snmp/library/snmp_api.h
+./route.lo: ../../include/net-snmp/library/asn1.h
+./route.lo: ../../include/net-snmp/library/snmp_impl.h
+./route.lo: ../../include/net-snmp/library/snmp.h
+./route.lo: ../../include/net-snmp/library/snmp-tc.h
+./route.lo: ../../include/net-snmp/utilities.h
+./route.lo: ../../include/net-snmp/library/snmp_client.h
+./route.lo: ../../include/net-snmp/library/getopt.h
+./route.lo: ../../include/net-snmp/library/system.h
+./route.lo: ../../include/net-snmp/library/tools.h
+./route.lo: ../../include/net-snmp/library/int64.h
+./route.lo: ../../include/net-snmp/library/mt_support.h
+./route.lo: ../../include/net-snmp/library/snmp_alarm.h
+./route.lo: ../../include/net-snmp/library/data_list.h
+./route.lo: ../../include/net-snmp/library/callback.h
+./route.lo: ../../include/net-snmp/library/oid_stash.h
+./route.lo: ../../include/net-snmp/library/check_varbind.h
+./route.lo: ../../include/net-snmp/version.h
+./route.lo: ../../include/net-snmp/session_api.h
+./route.lo: ../../include/net-snmp/library/snmp_transport.h
+./route.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./route.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./route.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./route.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./route.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./route.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./route.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./route.lo: ../../include/net-snmp/library/ucd_compat.h
+./route.lo: ../../include/net-snmp/pdu_api.h ../../include/net-snmp/mib_api.h
+./route.lo: ../../include/net-snmp/library/mib.h
+./route.lo: ../../include/net-snmp/library/parse.h
+./route.lo: ../../include/net-snmp/varbind_api.h
+./route.lo: ../../include/net-snmp/config_api.h
+./route.lo: ../../include/net-snmp/library/read_config.h
+./route.lo: ../../include/net-snmp/library/default_store.h
+./route.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./route.lo: ../../include/net-snmp/library/snmp_enum.h
+./route.lo: ../../include/net-snmp/library/vacm.h
+./route.lo: ../../include/net-snmp/output_api.h
+./route.lo: ../../include/net-snmp/library/snmp_debug.h
+./route.lo: ../../include/net-snmp/library/snmp_logging.h
+./route.lo: ../../include/net-snmp/snmpv3_api.h
+./route.lo: ../../include/net-snmp/library/snmpv3.h
+./route.lo: ../../include/net-snmp/library/transform_oids.h
+./route.lo: ../../include/net-snmp/library/keytools.h
+./route.lo: ../../include/net-snmp/library/scapi.h
+./route.lo: ../../include/net-snmp/library/lcd_time.h
+./route.lo: ../../include/net-snmp/library/snmp_secmod.h
+./route.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./route.lo: ../../include/net-snmp/library/snmpusm.h netstat.h
+./winstub.lo: ../../include/net-snmp/net-snmp-config.h
+./winstub.lo: ../../include/net-snmp/system/linux.h
+./winstub.lo: ../../include/net-snmp/system/sysv.h
+./winstub.lo: ../../include/net-snmp/system/generic.h
+./winstub.lo: ../../include/net-snmp/machine/generic.h
diff -Naur tomato/release/src/router/snmp/apps/snmpnetstat/Makefile.in tomato121/release/src/router/snmp/apps/snmpnetstat/Makefile.in
--- tomato/release/src/router/snmp/apps/snmpnetstat/Makefile.in	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/apps/snmpnetstat/Makefile.in	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,24 @@
+#
+# snmpnetstat Makefile
+#
+
+top_builddir=../..
+INSTALLBINPROGS=snmpnetstat$(EXEEXT)
+
+#
+# build info
+#
+SRCS=	inet.c inet6.c if.c main.c route.c winstub.c
+OBJS=	inet.o inet6.o if.o main.o route.o winstub.o
+LOBJS=	inet.lo inet6.lo if.lo main.lo route.lo winstub.lo
+TARG= snmpnetstat$(EXEEXT)
+
+CPPFLAGS=-I../../include -I../.. -I$(srcdir)/../.. -I$(srcdir)/../../include @CPPFLAGS@
+
+USELIBS= ../../snmplib/libnetsnmp.$(LIB_EXTENSION)$(LIB_VERSION)
+LIBS=	 ../../snmplib/libnetsnmp.$(LIB_EXTENSION)$(LIB_VERSION) @LIBS@
+
+all: standardall
+
+snmpnetstat$(EXEEXT): ${LOBJS} ${USELIBS}
+	${LINK} -o $@ ${LOBJS} ${LOCAL_LIBS} ${LDFLAGS} ${LIBS}
diff -Naur tomato/release/src/router/snmp/apps/snmpnetstat/netstat.h tomato121/release/src/router/snmp/apps/snmpnetstat/netstat.h
--- tomato/release/src/router/snmp/apps/snmpnetstat/netstat.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/apps/snmpnetstat/netstat.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,33 @@
+extern int      aflag, nflag;
+extern int      print_errors;
+extern char    *intrface;
+extern netsnmp_session *Session;
+
+char           *routename(struct in_addr);
+char           *netname(struct in_addr, u_long);
+const char     *plural(int);
+netsnmp_variable_list *getvarbyname(netsnmp_session *, oid *, size_t);
+
+void            intpr(int);
+void            intpro(int);
+void            protopr(const char *);
+void            routepr(void);
+void            ip_stats(void);
+void            icmp_stats(void);
+void            tcp_stats(void);
+void            udp_stats(void);
+#ifdef INET6
+void            protopr6(const char *);
+#endif
+
+void            inetprint(struct in_addr *, u_short, const char *);
+#ifdef INET6
+void            inet6print(struct in6_addr *, u_short, const char *);
+#endif
+
+void            rt_stats(void);
+
+struct protox  *name2protox(const char *);
+struct protox  *knownname(const char *);
+
+void            get_ifname(char *, int);
diff -Naur tomato/release/src/router/snmp/apps/snmpnetstat/route.c tomato121/release/src/router/snmp/apps/snmpnetstat/route.c
--- tomato/release/src/router/snmp/apps/snmpnetstat/route.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/apps/snmpnetstat/route.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,523 @@
+/*****************************************************************
+	Copyright 1989, 1991, 1992 by Carnegie Mellon University
+
+                      All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its 
+documentation for any purpose and without fee is hereby granted, 
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in 
+supporting documentation, and that the name of CMU not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.  
+
+CMU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+CMU BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+******************************************************************/
+/*
+ * Copyright (c) 1983,1988 Regents of the University of California.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms are permitted
+ * provided that this notice is preserved and that due credit is given
+ * to the University of California at Berkeley. The name of the University
+ * may not be used to endorse or promote products derived from this
+ * software without specific prior written permission. This software
+ * is provided ``as is'' without express or implied warranty.
+ */
+
+#include <net-snmp/net-snmp-config.h>
+
+#if HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#if HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#if HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+
+#include <stdio.h>
+#include <ctype.h>
+
+#if HAVE_SYS_PARAM_H
+#include <sys/param.h>
+#endif
+
+#if HAVE_SYS_SELECT_H
+#include <sys/select.h>
+#endif
+#if HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+#if HAVE_ARPA_INET_H
+#include <arpa/inet.h>
+#endif
+#define	LOOPBACKNET 127
+
+#if HAVE_WINSOCK_H
+#include <winsock.h>
+#include "winstub.h"
+#endif
+#if HAVE_SYS_SOCKET_H
+#include <sys/socket.h>
+#endif
+#if HAVE_NETDB_H
+#include <netdb.h>
+#endif
+
+#include "main.h"
+#include <net-snmp/net-snmp-includes.h>
+#include "netstat.h"
+
+struct route_entry {
+    oid             instance[4];
+    struct in_addr  destination;
+    int             set_destination;
+    struct in_addr  mask;
+    int             set_mask;
+    struct in_addr  gateway;
+    int             set_gateway;
+    int             ifNumber;
+    int             set_ifNumber;
+    int             type;
+    int             set_type;
+    int             proto;
+    int             set_proto;
+    char            ifname[64];
+    int             set_name;
+};
+
+#define RTDEST	    1
+#define RTIFINDEX   2
+#define RTNEXTHOP   7
+#define RTTYPE	    8
+#define RTPROTO	    9
+#define RTMASK	   11
+
+static oid      oid_rttable[] = { 1, 3, 6, 1, 2, 1, 4, 21, 1 };
+static oid      oid_rtdest[] = { 1, 3, 6, 1, 2, 1, 4, 21, 1, 1 };
+static oid      oid_rtifindex[] = { 1, 3, 6, 1, 2, 1, 4, 21, 1, 2 };
+static oid      oid_rtnexthop[] = { 1, 3, 6, 1, 2, 1, 4, 21, 1, 7 };
+static oid      oid_rttype[] = { 1, 3, 6, 1, 2, 1, 4, 21, 1, 8 };
+static oid      oid_rtproto[] = { 1, 3, 6, 1, 2, 1, 4, 21, 1, 9 };
+static oid      oid_rtmask[] = { 1, 3, 6, 1, 2, 1, 4, 21, 1, 11 };
+static oid      oid_ifdescr[] = { 1, 3, 6, 1, 2, 1, 2, 2, 1, 2 };
+static oid      oid_ipnoroutes[] = { 1, 3, 6, 1, 2, 1, 4, 12, 0 };
+
+
+/*
+ * Print routing tables.
+ */
+void
+routepr(void)
+{
+    struct route_entry route, *rp = &route;
+    netsnmp_pdu    *request, *response;
+    netsnmp_variable_list *vp;
+    char            name[16], *flags;
+    oid            *instance, type;
+    int             toloopback, status;
+    char            ch;
+
+    printf("Routing tables\n");
+    printf("%-26.26s %-18.18s %-6.6s  %s\n",
+           "Destination", "Gateway", "Flags", "Interface");
+
+
+    request = snmp_pdu_create(SNMP_MSG_GETNEXT);
+
+    snmp_add_null_var(request, oid_rtdest,
+                      sizeof(oid_rtdest) / sizeof(oid));
+    snmp_add_null_var(request, oid_rtmask,
+                      sizeof(oid_rtmask) / sizeof(oid));
+    snmp_add_null_var(request, oid_rtifindex,
+                      sizeof(oid_rtifindex) / sizeof(oid));
+    snmp_add_null_var(request, oid_rtnexthop,
+                      sizeof(oid_rtnexthop) / sizeof(oid));
+    snmp_add_null_var(request, oid_rttype,
+                      sizeof(oid_rttype) / sizeof(oid));
+    snmp_add_null_var(request, oid_rtproto,
+                      sizeof(oid_rtproto) / sizeof(oid));
+
+    while (request) {
+        status = snmp_synch_response(Session, request, &response);
+        if (status != STAT_SUCCESS
+            || response->errstat != SNMP_ERR_NOERROR) {
+            fprintf(stderr, "SNMP request failed\n");
+            break;
+        }
+        instance = NULL;
+        request = NULL;
+        rp->set_destination = 0;
+        rp->set_mask = 0;
+        rp->set_ifNumber = 0;
+        rp->set_gateway = 0;
+        rp->set_type = 0;
+        rp->set_proto = 0;
+        for (vp = response->variables; vp; vp = vp->next_variable) {
+            if (vp->name_length != 14 ||
+                memcmp(vp->name, oid_rttable, sizeof(oid_rttable))) {
+                continue;       /* if it isn't in this subtree, just continue */
+            }
+
+            if (instance != NULL) {
+                oid            *ip, *op;
+                int             count;
+
+                ip = instance;
+                op = vp->name + 10;
+                for (count = 0; count < 4; count++) {
+                    if (*ip++ != *op++)
+                        break;
+                }
+                if (count < 4)
+                    continue;   /* not the right instance, ignore */
+            } else {
+                instance = vp->name + 10;
+            }
+            /*
+             * At this point, this variable is known to be in the routing table
+             * subtree, and is of the right instance for this transaction.
+             */
+
+            if (request == NULL)
+                request = snmp_pdu_create(SNMP_MSG_GETNEXT);
+            snmp_add_null_var(request, vp->name, vp->name_length);
+
+            type = vp->name[9];
+            switch ((char) type) {
+            case RTDEST:
+                memmove(&rp->destination, vp->val.string, sizeof(u_long));
+                rp->set_destination = 1;
+                break;
+            case RTMASK:
+                memmove(&rp->mask, vp->val.string, sizeof(u_long));
+                rp->set_mask = 1;
+                break;
+            case RTIFINDEX:
+                rp->ifNumber = *vp->val.integer;
+                rp->set_ifNumber = 1;
+                break;
+            case RTNEXTHOP:
+                memmove(&rp->gateway, vp->val.string, sizeof(u_long));
+                rp->set_gateway = 1;
+                break;
+            case RTTYPE:
+                rp->type = *vp->val.integer;
+                rp->set_type = 1;
+                break;
+            case RTPROTO:
+                rp->proto = *vp->val.integer;
+                rp->set_proto = 1;
+                break;
+            }
+        }
+        snmp_free_pdu(response);
+        if (!(rp->set_destination && rp->set_gateway
+              && rp->set_type && rp->set_ifNumber)) {
+            if (request)
+                snmp_free_pdu(request);
+            request = NULL;
+            continue;
+        }
+        toloopback = *(char *) &rp->gateway == LOOPBACKNET;
+        printf("%-26.26s ",
+               (rp->destination.s_addr == INADDR_ANY) ? "default" :
+               (toloopback) ? routename(rp->destination) :
+               rp->set_mask ? netname(rp->destination, rp->mask.s_addr) :
+               netname(rp->destination, 0L));
+        printf("%-18.18s ", routename(rp->gateway));
+        flags = name;
+        *flags++ = 'U';         /* route is in use */
+        /*
+         * this !toloopback shouldnt be necessary 
+         */
+        if (!toloopback && rp->type == MIB_IPROUTETYPE_REMOTE)
+            *flags++ = 'G';
+        if (toloopback)
+            *flags++ = 'H';
+        if (rp->proto == MIB_IPROUTEPROTO_ICMP)
+            *flags++ = 'D';     /* redirect */
+        *flags = '\0';
+        printf("%-6.6s ", name);
+        get_ifname(rp->ifname, rp->ifNumber);
+        ch = rp->ifname[strlen(rp->ifname) - 1];
+        ch = '5';               /* force the if statement */
+        if (isdigit(ch))
+            printf(" %.32s\n", rp->ifname);
+        else
+            printf(" %.32s%d\n", rp->ifname, rp->ifNumber);
+
+    }
+}
+
+struct iflist {
+    int             index;
+    char            name[64];
+    struct iflist  *next;
+}              *Iflist = NULL;
+
+void
+get_ifname(char *name, int ifIndex)
+{
+    netsnmp_pdu    *pdu, *response;
+    netsnmp_variable_list *vp;
+    struct iflist  *ip;
+    oid             varname[MAX_OID_LEN];
+    int             status;
+
+    for (ip = Iflist; ip; ip = ip->next) {
+        if (ip->index == ifIndex)
+            break;
+    }
+    if (ip) {
+        strcpy(name, ip->name);
+        return;
+    }
+    ip = (struct iflist *) malloc(sizeof(struct iflist));
+    if (ip == NULL)
+        return;
+    ip->next = Iflist;
+    Iflist = ip;
+    ip->index = ifIndex;
+    pdu = snmp_pdu_create(SNMP_MSG_GET);
+    memmove(varname, oid_ifdescr, sizeof(oid_ifdescr));
+    varname[10] = (oid) ifIndex;
+    snmp_add_null_var(pdu, varname, sizeof(oid_ifdescr) / sizeof(oid) + 1);
+    status = snmp_synch_response(Session, pdu, &response);
+    if (status == STAT_SUCCESS && response->errstat == SNMP_ERR_NOERROR) {
+        vp = response->variables;
+        if (vp->val_len >= sizeof(ip->name))
+            vp->val_len = sizeof(ip->name) - 1;
+        memmove(ip->name, vp->val.string, vp->val_len);
+        ip->name[vp->val_len] = '\0';
+        snmp_free_pdu(response);
+    } else {
+        sprintf(ip->name, "if%d", ifIndex);
+    }
+    strcpy(name, ip->name);
+}
+
+static          u_long
+forgemask(u_long a)
+{
+    u_long          m;
+    if (IN_CLASSA(a))
+        m = IN_CLASSA_NET;
+    else if (IN_CLASSB(a))
+        m = IN_CLASSB_NET;
+    else
+        m = IN_CLASSC_NET;
+    return m;
+}
+
+static void
+domask(char *dst, u_long addr, u_long mask)
+{
+    int             b, i;
+    if (!mask || forgemask(addr) == mask) {
+        *dst = '\0';
+        return;
+    }
+    i = 0;
+    for (b = 0; b < 32; b++)
+        if (mask & (1 << b)) {
+            int             bb;
+            i = b;
+            for (bb = b + 1; bb < 32; bb++)
+                if (!(mask & (1 << bb))) {
+                    i = -1;     /* non-contig */
+                    break;
+                }
+            break;
+        }
+    if (i == -1)
+        sprintf(dst, "&0x%lx", mask);
+    else
+        sprintf(dst, "/%d", 32 - i);
+}
+
+char           *
+routename(struct in_addr in)
+{
+    register char  *cp;
+    static char     line[MAXHOSTNAMELEN + 1];
+    struct hostent *hp;
+    static char     domain[MAXHOSTNAMELEN + 1];
+    static int      first = 1;
+
+    if (first) {
+        first = 0;
+        if (gethostname(domain, MAXHOSTNAMELEN) == 0 &&
+            (cp = (char *) strchr(domain, '.')))
+            (void) strcpy(domain, cp + 1);
+        else
+            domain[0] = 0;
+    }
+    cp = 0;
+    if (!nflag) {
+        hp = gethostbyaddr((char *) &in, sizeof(struct in_addr), AF_INET);
+        if (hp) {
+            if ((cp = (char *) strchr(hp->h_name, '.')) &&
+                !strcmp(cp + 1, domain))
+                *cp = 0;
+            cp = (char *) hp->h_name;
+        }
+    }
+    if (cp)
+        strncpy(line, cp, sizeof(line) - 1);
+    else {
+#define C(x)	(unsigned)((x) & 0xff)
+        in.s_addr = ntohl(in.s_addr);
+        sprintf(line, "%u.%u.%u.%u", C(in.s_addr >> 24),
+                C(in.s_addr >> 16), C(in.s_addr >> 8), C(in.s_addr));
+    }
+    return (line);
+}
+
+/*
+ * Return the name of the network whose address is given.
+ * The address is assumed to be that of a net or subnet, not a host.
+ */
+char           *
+netname(struct in_addr in, u_long mask)
+{
+    char           *cp = NULL;
+    static char     line[MAXHOSTNAMELEN + 1];
+    struct netent  *np = 0;
+    u_long          net, omask;
+    u_long          i;
+    int             subnetshift;
+
+    i = ntohl(in.s_addr);
+    omask = mask = ntohl(mask);
+    if (!nflag && i != INADDR_ANY) {
+        if (mask == INADDR_ANY) {
+            if (IN_CLASSA(i)) {
+                mask = IN_CLASSA_NET;
+                subnetshift = 8;
+            } else if (IN_CLASSB(i)) {
+                mask = IN_CLASSB_NET;
+                subnetshift = 8;
+            } else {
+                mask = IN_CLASSC_NET;
+                subnetshift = 4;
+            }
+            /*
+             * If there are more bits than the standard mask
+             * would suggest, subnets must be in use.
+             * Guess at the subnet mask, assuming reasonable
+             * width subnet fields.
+             */
+            while (i & ~mask)
+                mask = (long) mask >> subnetshift;
+        }
+        net = i & mask;
+        while ((mask & 1) == 0)
+            mask >>= 1, net >>= 1;
+        np = getnetbyaddr(net, AF_INET);
+        if (np)
+            cp = np->n_name;
+    }
+    if (cp)
+        strncpy(line, cp, sizeof(line) - 1);
+    else if ((i & 0xffffff) == 0)
+        sprintf(line, "%u", C(i >> 24));
+    else if ((i & 0xffff) == 0)
+        sprintf(line, "%u.%u", C(i >> 24), C(i >> 16));
+    else if ((i & 0xff) == 0)
+        sprintf(line, "%u.%u.%u", C(i >> 24), C(i >> 16), C(i >> 8));
+    else
+        sprintf(line, "%u.%u.%u.%u", C(i >> 24),
+                C(i >> 16), C(i >> 8), C(i));
+    domask(line + strlen(line), i, omask);
+    return (line);
+}
+
+/*
+ * Print routing statistics
+ */
+void
+rt_stats(void)
+{
+    netsnmp_variable_list *var;
+
+    printf("routing:\n");
+    var =
+        getvarbyname(Session, oid_ipnoroutes,
+                     sizeof(oid_ipnoroutes) / sizeof(oid));
+    if (var) {
+        printf("\t%lu destination%s found unreachable\n",
+               *var->val.integer, plural((int) *var->val.integer));
+        snmp_free_var(var);
+    } else {
+        printf("\tCouldn't get ipOutNoRoutes variable\n");
+    }
+}
+
+/*
+ * Request a variable with a GET REQUEST message on the given
+ * session.  If the variable is found, a
+ * pointer to a netsnmp_variable_list object will be returned.
+ * Otherwise, NULL is returned.  The caller must free the returned
+ * variable_list object when done with it.
+ */
+netsnmp_variable_list *
+getvarbyname(netsnmp_session * sp, oid * name, size_t len)
+{
+    netsnmp_pdu    *request, *response;
+    netsnmp_variable_list *var = NULL, *vp;
+    int             status;
+
+    request = snmp_pdu_create(SNMP_MSG_GET);
+
+    snmp_add_null_var(request, name, len);
+
+    status = snmp_synch_response(sp, request, &response);
+
+    if (status == STAT_SUCCESS) {
+        if (response->errstat == SNMP_ERR_NOERROR) {
+            for (var = response->variables; var; var = var->next_variable) {
+                if (var->name_length == len
+                    && !memcmp(name, var->name, len * sizeof(oid)))
+                    break;      /* found our match */
+            }
+            if (var != NULL) {
+                /*
+                 * Now unlink this var from pdu chain so it doesn't get freed.
+                 * The caller will free the var.
+                 */
+                if (response->variables == var) {
+                    response->variables = var->next_variable;
+                } else {
+                    for (vp = response->variables; vp;
+                         vp = vp->next_variable) {
+                        if (vp->next_variable == var) {
+                            vp->next_variable = var->next_variable;
+                            break;
+                        }
+                    }
+                }
+                if (var->type == SNMP_NOSUCHOBJECT ||
+                    var->type == SNMP_NOSUCHINSTANCE ||
+                    var->type == SNMP_ENDOFMIBVIEW) {
+                       snmp_free_var(var);
+                       var =  NULL;
+                }
+            }
+        }
+    } else if (status != STAT_TIMEOUT)
+        snmp_sess_perror("snmpnetstat", sp);
+    if (response)
+        snmp_free_pdu(response);
+    return var;
+}
diff -Naur tomato/release/src/router/snmp/apps/snmpnetstat/winstub.c tomato121/release/src/router/snmp/apps/snmpnetstat/winstub.c
--- tomato/release/src/router/snmp/apps/snmpnetstat/winstub.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/apps/snmpnetstat/winstub.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,283 @@
+/*
+ * cheap and dirty network database lookup functions 
+ */
+/*
+ * uses local files only 
+ */
+/*
+ * currently searches the protocols only 
+ */
+
+#include <net-snmp/net-snmp-config.h>
+
+#if (defined(WIN32) || defined(cygwin) || defined(aix4))
+
+#ifdef aix4
+#define _NO_PROTO               /* Hack, you say ? */
+#endif
+
+#include <stdio.h>
+#include <sys/types.h>
+#if HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#if HAVE_STRING_H
+#include <string.h>
+#endif
+#if HAVE_WINSOCK_H
+#include <winsock.h>
+#endif
+#if HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+#if HAVE_NETDB_H
+#include <netdb.h>
+#endif
+
+static int      h_stay_open, s_stay_open, p_stay_open, n_stay_open;
+static FILE    *h_fp, *s_fp, *p_fp, *n_fp;
+static char    *h_fn, *s_fn, *p_fn, *n_fn;
+
+#ifdef aix4
+#define ROOT_BASE "/etc/"
+#define PROT_FN "protocols"
+#else
+#define ROOT_BASE "\\SYSTEM32\\DRIVERS\\ETC\\"
+#define PROT_FN "protocol"
+#endif
+#define HOST_FN "hosts"
+#define SERV_FN "services"
+#define NETW_FN "networks"
+
+static int      pre_env_done = 0;
+static void
+pre_env(void)
+{
+    const char     *cproot;
+    const char     *cp = "";
+
+    if (pre_env_done)
+        return;
+    pre_env_done = 1;
+
+#ifndef aix4
+    cp = getenv("SYSTEMROOT");
+    if (cp) {
+        ;
+        /*
+         * printf ("Root is '%s'\n", cp); 
+         */
+    } else
+        cp = "C:\\WINNT";
+#endif
+
+    cproot = ROOT_BASE;
+    p_fn =
+        (char *) malloc(3 + strlen(cp) + strlen(cproot) + strlen(PROT_FN));
+    if (p_fn)
+        sprintf(p_fn, "%s%s%s", cp, cproot, PROT_FN);
+#ifdef notused
+    h_fn =
+        (char *) malloc(3 + strlen(cp) + strlen(cproot) + strlen(HOST_FN));
+    if (h_fn)
+        sprintf(h_fn, "%s%s%s", cp, cproot, HOST_FN);
+    s_fn =
+        (char *) malloc(3 + strlen(cp) + strlen(cproot) + strlen(SERV_FN));
+    if (s_fn)
+        sprintf(s_fn, "%s%s%s", cp, cproot, SERV_FN);
+    n_fn =
+        (char *) malloc(3 + strlen(cp) + strlen(cproot) + strlen(NETW_FN));
+    if (n_fn)
+        sprintf(n_fn, "%s%s%s", cp, cproot, NETW_FN);
+#endif
+}
+
+/*
+ * sets can open. ends must close. 
+ */
+void
+endhostent(void)
+{
+    if (h_fp)
+        fclose(h_fp);
+    h_fp = 0;
+}
+
+void
+endservent(void)
+{
+    if (s_fp)
+        fclose(s_fp);
+    s_fp = 0;
+}
+
+void
+endprotoent(void)
+{
+    if (p_fp)
+        fclose(p_fp);
+    p_fp = 0;
+}
+
+void
+endnetent(void)
+{
+    if (n_fp)
+        fclose(n_fp);
+    n_fp = 0;
+}
+
+void
+sethostent(int stay_open)
+{
+    pre_env();
+    endhostent();
+    h_stay_open = stay_open;
+}
+
+void
+setservent(int stay_open)
+{
+    pre_env();
+    endservent();
+    s_stay_open = stay_open;
+}
+
+void
+setprotoent(int stay_open)
+{
+    pre_env();
+    endprotoent();
+    p_stay_open = stay_open;
+}
+
+void
+setnetent(int stay_open)
+{
+    pre_env();
+    endnetent();
+    n_stay_open = stay_open;
+}
+
+#define STRTOK_DELIMS " \t\n"
+
+/*
+ * get next entry from data base file, or from NIS if possible. 
+ */
+/*
+ * returns 0 if there are no more entries to read. 
+ */
+struct hostent *
+gethostent(void)
+{
+    return 0;
+}
+struct servent *
+getservent(void)
+{
+    return 0;
+}
+
+struct protoent *
+getprotoent(void)
+{
+    char           *cp, **alp, lbuf[256];
+    static struct protoent spx;
+    static char    *ali[10];
+    struct protoent *px = &spx;
+    int             linecnt = 0;
+
+    for (alp = ali; *alp; free(*alp), *alp = 0, alp++);
+    if (px->p_name)
+        free(px->p_name);
+    px->p_aliases = ali;
+
+    if (!p_fn)
+        return 0;
+    if (!p_fp)
+        p_fp = fopen(p_fn, "r");
+
+    if (!p_fp)
+        return 0;
+    while (fgets(lbuf, sizeof(lbuf), p_fp)) {
+        linecnt++;
+        cp = lbuf;
+        if (*cp == '#')
+            continue;
+
+        cp = strtok(lbuf, STRTOK_DELIMS);
+        if (!cp)
+            continue;
+        if (cp)
+            px->p_name = strdup(cp);
+
+        cp = strtok(NULL, STRTOK_DELIMS);
+        if (!cp) {
+            free(px->p_name);
+            continue;
+        }
+        px->p_proto = (short) atoi(cp);
+
+        for (alp = px->p_aliases; cp; alp++) {
+            cp = strtok(NULL, STRTOK_DELIMS);
+            if (!cp)
+                break;
+            if (*cp == '#')
+                break;
+            *alp = strdup(cp);
+        }
+
+        return (px);
+    }
+
+    return 0;
+}
+struct netent  *
+getnetent(void)
+{
+    return 0;
+}
+
+struct netent  *
+getnetbyaddr(long net, int type)
+{
+    return 0;
+}
+
+/*
+ * Return the network number from an internet address 
+ */
+u_long
+inet_netof(struct in_addr in)
+{
+    register u_long i = ntohl(in.s_addr);
+    u_long          ii = (i >> 24) & 0xff;
+    if (0 == (ii & 0x80))
+        return ((0xff000000 & i) >> 24);
+    if (0x80 == (ii & 0xc0))
+        return ((0xffff0000 & i) >> 16);
+    /*
+     * if (0xc0 == (ii & 0xe0))
+     */
+    return ((0xffffff00 & i) >> 8);
+}
+
+/*
+ * Return the host number from an internet address 
+ */
+u_long
+inet_lnaof(struct in_addr in)
+{
+    register u_long i = ntohl(in.s_addr);
+    u_long          ii = (i >> 24) & 0xff;
+    if (0 == (ii & 0x80))
+        return (0x00ffffff & i);
+    if (0x80 == (ii & 0xc0))
+        return (0x0000ffff & i);
+    /*
+     * if (0xc0 == (ii & 0xe0)) 
+     */
+    return (0x000000ff & i);
+}
+
+#endif                          /* WIN32 or cygwin */
diff -Naur tomato/release/src/router/snmp/apps/snmpnetstat/winstub.h tomato121/release/src/router/snmp/apps/snmpnetstat/winstub.h
--- tomato/release/src/router/snmp/apps/snmpnetstat/winstub.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/apps/snmpnetstat/winstub.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,48 @@
+
+#ifndef _WINSTUB_H_
+#define _WINSTUB_H_
+
+#if (defined(WIN32) || defined(cygwin))
+
+/*
+ * database access functions for host, services, protocols, networks 
+ */
+
+/*
+ * sets can open. ends must close. 
+ */
+void            sethostent(int stay_open);
+void            setservent(int stay_open);
+void            setprotoent(int stay_open);
+void            setnetent(int stay_open);
+void            endhostent(void);
+void            endservent(void);
+void            endprotoent(void);
+void            endnetent(void);
+
+/*
+ * get next entry from data base file, or from NIS if possible. 
+ */
+/*
+ * returns 0 if there are no more entries to read. 
+ */
+struct hostent *gethostent(void);
+struct servent *getservent(void);
+struct protoent *getprotoent(void);
+struct netent  *getnetent(void);
+
+struct netent  *getnetbyaddr(long net, int type);
+
+/*
+ * Return the network number from an internet address 
+ */
+u_long          inet_netof(struct in_addr in);
+
+/*
+ * Return the host number from an internet address 
+ */
+u_long          inet_lnaof(struct in_addr in);
+
+#endif                          /* WIN32 or cygwin */
+
+#endif /*_WINSTUB_H_ */
diff -Naur tomato/release/src/router/snmp/apps/snmpset.c tomato121/release/src/router/snmp/apps/snmpset.c
--- tomato/release/src/router/snmp/apps/snmpset.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/apps/snmpset.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,282 @@
+/*
+ * snmpset.c - send snmp SET requests to a network entity.
+ *
+ */
+/***********************************************************************
+	Copyright 1988, 1989, 1991, 1992 by Carnegie Mellon University
+
+                      All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its 
+documentation for any purpose and without fee is hereby granted, 
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in 
+supporting documentation, and that the name of CMU not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.  
+
+CMU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+CMU BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+******************************************************************/
+#include <net-snmp/net-snmp-config.h>
+
+#if HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#if HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#if HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+#include <sys/types.h>
+#if HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+#include <stdio.h>
+#include <ctype.h>
+#if TIME_WITH_SYS_TIME
+# ifdef WIN32
+#  include <sys/timeb.h>
+# else
+#  include <sys/time.h>
+# endif
+# include <time.h>
+#else
+# if HAVE_SYS_TIME_H
+#  include <sys/time.h>
+# else
+#  include <time.h>
+# endif
+#endif
+#if HAVE_SYS_SELECT_H
+#include <sys/select.h>
+#endif
+#if HAVE_WINSOCK_H
+#include <winsock.h>
+#endif
+#if HAVE_NETDB_H
+#include <netdb.h>
+#endif
+#if HAVE_ARPA_INET_H
+#include <arpa/inet.h>
+#endif
+
+#include <net-snmp/net-snmp-includes.h>
+
+int             failures = 0;
+
+void
+usage(void)
+{
+    fprintf(stderr, "USAGE: snmpset ");
+    snmp_parse_args_usage(stderr);
+    fprintf(stderr, " OID TYPE VALUE [OID TYPE VALUE]...\n\n");
+    snmp_parse_args_descriptions(stderr);
+    fprintf(stderr,
+            "  -C APPOPTS\t\tSet various application specific behaviours:\n");
+    fprintf(stderr, "\t\t\t  q:  don't print results on success\n");
+    fprintf(stderr, "\n  TYPE: one of i, u, t, a, o, s, x, d, b, n\n");
+    fprintf(stderr,
+            "\ti: INTEGER, u: unsigned INTEGER, t: TIMETICKS, a: IPADDRESS\n");
+    fprintf(stderr,
+            "\to: OBJID, s: STRING, x: HEX STRING, d: DECIMAL STRING, b: BITS\n");
+#ifdef OPAQUE_SPECIAL_TYPES
+    fprintf(stderr,
+            "\tU: unsigned int64, I: signed int64, F: float, D: double\n");
+#endif                          /* OPAQUE_SPECIAL_TYPES */
+
+}
+
+static int quiet = 0;
+
+static
+    void
+optProc(int argc, char *const *argv, int opt)
+{
+    switch (opt) {
+    case 'C':
+        while (*optarg) {
+            switch (*optarg++) {
+            case 'q':
+                quiet = 1;
+                break;
+
+            default:
+                fprintf(stderr, "Unknown flag passed to -C: %c\n",
+                        optarg[-1]);
+                exit(1);
+            }
+        }
+    }
+}
+
+int
+main(int argc, char *argv[])
+{
+    netsnmp_session session, *ss;
+    netsnmp_pdu    *pdu, *response = NULL;
+    netsnmp_variable_list *vars;
+    int             arg;
+    int             count;
+    int             current_name = 0;
+    int             current_type = 0;
+    int             current_value = 0;
+    char           *names[128];
+    char            types[128];
+    char           *values[128];
+    oid             name[MAX_OID_LEN];
+    size_t          name_length;
+    int             status;
+    int             exitval = 0;
+
+    putenv(strdup("POSIXLY_CORRECT=1"));
+
+    /*
+     * get the common command line arguments 
+     */
+    switch (arg = snmp_parse_args(argc, argv, &session, "C:", optProc)) {
+    case -2:
+        exit(0);
+    case -1:
+        usage();
+        exit(1);
+    default:
+        break;
+    }
+
+    if (arg >= argc) {
+        fprintf(stderr, "Missing object name\n");
+        usage();
+        exit(1);
+    }
+
+    /*
+     * get object names, types, and values 
+     */
+    for (; arg < argc; arg++) {
+        DEBUGMSGTL(("snmp_parse_args", "handling (#%d): %s %s %s\n",
+                    arg,argv[arg], arg+1 < argc ? argv[arg+1] : NULL,
+                    arg+2 < argc ? argv[arg+2] : NULL));
+        names[current_name++] = argv[arg++];
+        if (arg < argc) {
+            switch (*argv[arg]) {
+            case '=':
+            case 'i':
+            case 'u':
+            case 't':
+            case 'a':
+            case 'o':
+            case 's':
+            case 'x':
+            case 'd':
+            case 'b':
+#ifdef OPAQUE_SPECIAL_TYPES
+            case 'I':
+            case 'U':
+            case 'F':
+            case 'D':
+#endif                          /* OPAQUE_SPECIAL_TYPES */
+                types[current_type++] = *argv[arg++];
+                break;
+            default:
+                fprintf(stderr, "%s: Bad object type: %c\n", argv[arg - 1],
+                        *argv[arg]);
+                exit(1);
+            }
+        } else {
+            fprintf(stderr, "%s: Needs type and value\n", argv[arg - 1]);
+            exit(1);
+        }
+        if (arg < argc)
+            values[current_value++] = argv[arg];
+        else {
+            fprintf(stderr, "%s: Needs value\n", argv[arg - 2]);
+            exit(1);
+        }
+    }
+
+    SOCK_STARTUP;
+
+    /*
+     * open an SNMP session 
+     */
+    ss = snmp_open(&session);
+    if (ss == NULL) {
+        /*
+         * diagnose snmp_open errors with the input netsnmp_session pointer 
+         */
+        snmp_sess_perror("snmpset", &session);
+        SOCK_CLEANUP;
+        exit(1);
+    }
+
+    /*
+     * create PDU for SET request and add object names and values to request 
+     */
+    pdu = snmp_pdu_create(SNMP_MSG_SET);
+    for (count = 0; count < current_name; count++) {
+        name_length = MAX_OID_LEN;
+        if (snmp_parse_oid(names[count], name, &name_length) == NULL) {
+            snmp_perror(names[count]);
+            failures++;
+        } else
+            if (snmp_add_var
+                (pdu, name, name_length, types[count], values[count])) {
+            snmp_perror(names[count]);
+            failures++;
+        }
+    }
+
+    if (failures) {
+        SOCK_CLEANUP;
+        exit(1);
+    }
+
+    /*
+     * do the request 
+     */
+    status = snmp_synch_response(ss, pdu, &response);
+    if (status == STAT_SUCCESS) {
+        if (response->errstat == SNMP_ERR_NOERROR) {
+            if (!quiet) {
+                for (vars = response->variables; vars;
+                     vars = vars->next_variable)
+                    print_variable(vars->name, vars->name_length, vars);
+            }
+        } else {
+            fprintf(stderr, "Error in packet.\nReason: %s\n",
+                    snmp_errstring(response->errstat));
+            if (response->errindex != 0) {
+                fprintf(stderr, "Failed object: ");
+                for (count = 1, vars = response->variables;
+                     vars && (count != response->errindex);
+                     vars = vars->next_variable, count++);
+                if (vars)
+                    fprint_objid(stderr, vars->name, vars->name_length);
+                fprintf(stderr, "\n");
+            }
+            exitval = 2;
+        }
+    } else if (status == STAT_TIMEOUT) {
+        fprintf(stderr, "Timeout: No Response from %s\n",
+                session.peername);
+        exitval = 1;
+    } else {                    /* status == STAT_ERROR */
+        snmp_sess_perror("snmpset", ss);
+        exitval = 1;
+    }
+
+    if (response)
+        snmp_free_pdu(response);
+    snmp_close(ss);
+    SOCK_CLEANUP;
+    return exitval;
+}
diff -Naur tomato/release/src/router/snmp/apps/snmpstatus.c tomato121/release/src/router/snmp/apps/snmpstatus.c
--- tomato/release/src/router/snmp/apps/snmpstatus.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/apps/snmpstatus.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,380 @@
+/*
+ * snmpstatus.c - send snmp GET requests to a network entity.
+ *
+ */
+/***********************************************************************
+	Copyright 1988, 1989, 1991, 1992 by Carnegie Mellon University
+
+                      All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its 
+documentation for any purpose and without fee is hereby granted, 
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in 
+supporting documentation, and that the name of CMU not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.  
+
+CMU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+CMU BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+******************************************************************/
+#include <net-snmp/net-snmp-config.h>
+
+#if HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#if HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#if HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+#include <sys/types.h>
+#if HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+#include <stdio.h>
+#include <ctype.h>
+#if TIME_WITH_SYS_TIME
+# ifdef WIN32
+#  include <sys/timeb.h>
+# else
+#  include <sys/time.h>
+# endif
+# include <time.h>
+#else
+# if HAVE_SYS_TIME_H
+#  include <sys/time.h>
+# else
+#  include <time.h>
+# endif
+#endif
+#if HAVE_SYS_SELECT_H
+#include <sys/select.h>
+#endif
+#if HAVE_WINSOCK_H
+#include <winsock.h>
+#endif
+#if HAVE_NETDB_H
+#include <netdb.h>
+#endif
+#if HAVE_ARPA_INET_H
+#include <arpa/inet.h>
+#endif
+
+#include <net-snmp/utilities.h>
+
+#include <net-snmp/net-snmp-includes.h>
+
+oid             objid_sysDescr[] = { 1, 3, 6, 1, 2, 1, 1, 1, 0 };
+size_t          length_sysDescr = sizeof(objid_sysDescr) / sizeof(oid);
+oid             objid_sysUpTime[] = { 1, 3, 6, 1, 2, 1, 1, 3, 0 };
+size_t          length_sysUpTime = sizeof(objid_sysUpTime) / sizeof(oid);
+oid             objid_ifOperStatus[] = { 1, 3, 6, 1, 2, 1, 2, 2, 1, 8 };
+size_t          length_ifOperStatus =
+    sizeof(objid_ifOperStatus) / sizeof(oid);
+oid             objid_ifInUCastPkts[] = { 1, 3, 6, 1, 2, 1, 2, 2, 1, 11 };
+size_t          length_ifInUCastPkts =
+    sizeof(objid_ifInUCastPkts) / sizeof(oid);
+oid             objid_ifInNUCastPkts[] = { 1, 3, 6, 1, 2, 1, 2, 2, 1, 12 };
+size_t          length_ifInNUCastPkts =
+    sizeof(objid_ifInNUCastPkts) / sizeof(oid);
+oid             objid_ifOutUCastPkts[] = { 1, 3, 6, 1, 2, 1, 2, 2, 1, 17 };
+size_t          length_ifOutUCastPkts =
+    sizeof(objid_ifOutUCastPkts) / sizeof(oid);
+oid             objid_ifOutNUCastPkts[] =
+    { 1, 3, 6, 1, 2, 1, 2, 2, 1, 18 };
+size_t          length_ifOutNUCastPkts =
+    sizeof(objid_ifOutNUCastPkts) / sizeof(oid);
+oid             objid_ipInReceives[] = { 1, 3, 6, 1, 2, 1, 4, 3, 0 };
+size_t          length_ipInReceives =
+    sizeof(objid_ipInReceives) / sizeof(oid);
+oid             objid_ipOutRequests[] = { 1, 3, 6, 1, 2, 1, 4, 10, 0 };
+size_t          length_ipOutRequests =
+    sizeof(objid_ipOutRequests) / sizeof(oid);
+
+#define NETSNMP_DS_APP_DONT_FIX_PDUS 0
+
+static void
+optProc(int argc, char *const *argv, int opt)
+{
+    switch (opt) {
+    case 'C':
+        while (*optarg) {
+            switch (*optarg++) {
+            case 'f':
+                netsnmp_ds_toggle_boolean(NETSNMP_DS_APPLICATION_ID, 
+					  NETSNMP_DS_APP_DONT_FIX_PDUS);
+                break;
+            default:
+                fprintf(stderr, "Unknown flag passed to -C: %c\n",
+                        optarg[-1]);
+                exit(1);
+            }
+        }
+        break;
+    }
+}
+
+void
+usage(void)
+{
+    fprintf(stderr, "USAGE: snmpstatus ");
+    snmp_parse_args_usage(stderr);
+    fprintf(stderr, "\n\n");
+    snmp_parse_args_descriptions(stderr);
+    fprintf(stderr,
+            "  -C APPOPTS\t\tSet various application specific behaviours:\n");
+    fprintf(stderr,
+            "\t\t\t  f:  do not fix errors and retry the request\n");
+}
+
+
+int
+main(int argc, char *argv[])
+{
+    netsnmp_session session, *ss;
+    netsnmp_pdu    *pdu, *response;
+    netsnmp_variable_list *vars;
+    netsnmp_transport *transport = NULL;
+    char           *sysdescr = NULL;
+    u_long          uptime = 0;
+    int             status;
+    int             ipin = 0, ipout = 0, ipackets = 0, opackets = 0;
+    int             good_var;
+    int             down_interfaces = 0;
+    char            buf[40];
+    int             interfaces;
+    int             count;
+    int             exitval = 0;
+
+    /*
+     * get the common command line arguments 
+     */
+    switch (snmp_parse_args(argc, argv, &session, "C:", &optProc)) {
+    case -2:
+        exit(0);
+    case -1:
+        usage();
+        exit(1);
+    default:
+        break;
+    }
+
+    SOCK_STARTUP;
+
+    /*
+     * open an SNMP session 
+     */
+    ss = snmp_open(&session);
+    if (ss == NULL) {
+        /*
+         * diagnose snmp_open errors with the input netsnmp_session pointer 
+         */
+        snmp_sess_perror("snmpstatus", &session);
+        SOCK_CLEANUP;
+        exit(1);
+    }
+
+    /*
+     * create PDU for GET request and add object names to request 
+     */
+    pdu = snmp_pdu_create(SNMP_MSG_GET);
+    snmp_add_null_var(pdu, objid_sysDescr, length_sysDescr);
+    snmp_add_null_var(pdu, objid_sysUpTime, length_sysUpTime);
+    snmp_add_null_var(pdu, objid_ipInReceives, length_ipInReceives);
+    snmp_add_null_var(pdu, objid_ipOutRequests, length_ipOutRequests);
+
+    /*
+     * do the request 
+     */
+  retry:
+    status = snmp_synch_response(ss, pdu, &response);
+    if (status == STAT_SUCCESS) {
+        if (response->errstat == SNMP_ERR_NOERROR) {
+            for (vars = response->variables; vars;
+                 vars = vars->next_variable) {
+                if (vars->name_length == length_sysDescr
+                    && !memcmp(objid_sysDescr, vars->name,
+                               sizeof(objid_sysDescr))) {
+                    sysdescr = (char *) malloc(vars->val_len + 1);
+                    memcpy(sysdescr, vars->val.string, vars->val_len);
+                    sysdescr[vars->val_len] = '\0';
+                }
+                if (vars->name_length == length_sysUpTime &&
+                    !memcmp(objid_sysUpTime, vars->name,
+                            sizeof(objid_sysUpTime))) {
+                    uptime = *vars->val.integer;
+                }
+                if (vars->name_length == length_ipInReceives &&
+                    !memcmp(objid_ipInReceives, vars->name,
+                            sizeof(objid_ipInReceives))) {
+                    ipin = *vars->val.integer;
+                }
+                if (vars->name_length == length_ipOutRequests &&
+                    !memcmp(objid_ipOutRequests, vars->name,
+                            sizeof(objid_ipOutRequests))) {
+                    ipout = *vars->val.integer;
+                }
+            }
+        } else {
+            fprintf(stderr, "Error in packet.\nReason: %s\n",
+                    snmp_errstring(response->errstat));
+            if (response->errindex != 0) {
+                fprintf(stderr, "Failed object: ");
+                for (count = 1, vars = response->variables;
+                     vars && count != response->errindex;
+                     vars = vars->next_variable, count++);
+                if (vars)
+                    fprint_objid(stderr, vars->name, vars->name_length);
+                fprintf(stderr, "\n");
+            }
+
+            /*
+             * retry if the errored variable was successfully removed 
+             */
+            if (!netsnmp_ds_get_boolean(NETSNMP_DS_APPLICATION_ID, 
+					NETSNMP_DS_APP_DONT_FIX_PDUS)) {
+                pdu = snmp_fix_pdu(response, SNMP_MSG_GET);
+                snmp_free_pdu(response);
+                response = NULL;
+                if (pdu != NULL)
+                    goto retry;
+            }
+        }
+    } else if (status == STAT_TIMEOUT) {
+        fprintf(stderr, "Timeout: No Response from %s\n",
+                session.peername);
+        SOCK_CLEANUP;
+        exit(1);
+    } else {                    /* status == STAT_ERROR */
+        snmp_sess_perror("snmpstatus", ss);
+        SOCK_CLEANUP;
+        exit(2);
+    }
+
+    transport = snmp_sess_transport(snmp_sess_pointer(ss));
+    if (transport != NULL && transport->f_fmtaddr != NULL) {
+        char           *s = transport->f_fmtaddr(transport,
+                                                 response->transport_data,
+                                                 response->
+                                                 transport_data_length);
+        printf("[%s]=>[%s] Up: %s\n", s, sysdescr,
+               uptime_string(uptime, buf));
+    } else {
+        printf("[<UNKNOWN>]=>[%s] Up: %s\n", sysdescr,
+               uptime_string(uptime, buf));
+    }
+
+    if (response)
+        snmp_free_pdu(response);
+
+    /*
+     * create PDU for GET request and add object names to request 
+     */
+    pdu = snmp_pdu_create(SNMP_MSG_GETNEXT);
+    snmp_add_null_var(pdu, objid_ifOperStatus, length_ifOperStatus);
+    snmp_add_null_var(pdu, objid_ifInUCastPkts, length_ifInUCastPkts);
+    snmp_add_null_var(pdu, objid_ifInNUCastPkts, length_ifInNUCastPkts);
+    snmp_add_null_var(pdu, objid_ifOutUCastPkts, length_ifOutUCastPkts);
+    snmp_add_null_var(pdu, objid_ifOutNUCastPkts, length_ifOutNUCastPkts);
+
+    /*
+     * ?? note: this code is not quite complete 
+     */
+    good_var = 5;
+    interfaces = 0;
+    while (good_var == 5) {
+        good_var = 0;
+        status = snmp_synch_response(ss, pdu, &response);
+        if (status == STAT_SUCCESS) {
+            if (response->errstat == SNMP_ERR_NOERROR) {
+                pdu = snmp_pdu_create(SNMP_MSG_GETNEXT);
+                for (vars = response->variables; vars;
+                     vars = vars->next_variable) {
+                    if (vars->name_length >= length_ifOperStatus
+                        && !memcmp(objid_ifOperStatus, vars->name,
+                                   sizeof(objid_ifOperStatus))) {
+                        if (*vars->val.integer != MIB_IFSTATUS_UP)
+                            down_interfaces++;
+                        snmp_add_null_var(pdu, vars->name,
+                                          vars->name_length);
+                        good_var++;
+                    } else if (vars->name_length >= length_ifInUCastPkts &&
+                               !memcmp(objid_ifInUCastPkts, vars->name,
+                                       sizeof(objid_ifInUCastPkts))) {
+                        ipackets += *vars->val.integer;
+                        snmp_add_null_var(pdu, vars->name,
+                                          vars->name_length);
+                        good_var++;
+                    } else if (vars->name_length >= length_ifInNUCastPkts
+                               && !memcmp(objid_ifInNUCastPkts, vars->name,
+                                          sizeof(objid_ifInNUCastPkts))) {
+                        ipackets += *vars->val.integer;
+                        snmp_add_null_var(pdu, vars->name,
+                                          vars->name_length);
+                        good_var++;
+                    } else if (vars->name_length >= length_ifOutUCastPkts
+                               && !memcmp(objid_ifOutUCastPkts, vars->name,
+                                          sizeof(objid_ifOutUCastPkts))) {
+                        opackets += *vars->val.integer;
+                        snmp_add_null_var(pdu, vars->name,
+                                          vars->name_length);
+                        good_var++;
+                    } else if (vars->name_length >= length_ifOutNUCastPkts
+                               && !memcmp(objid_ifOutNUCastPkts,
+                                          vars->name,
+                                          sizeof(objid_ifOutNUCastPkts))) {
+                        opackets += *vars->val.integer;
+                        snmp_add_null_var(pdu, vars->name,
+                                          vars->name_length);
+                        good_var++;
+                    }
+                }
+                if (good_var == 5)
+                    interfaces++;
+            } else {
+                fprintf(stderr, "Error in packet.\nReason: %s\n",
+                        snmp_errstring(response->errstat));
+                if (response->errindex != 0) {
+                    fprintf(stderr, "Failed object: ");
+                    for (count = 1, vars = response->variables;
+                         vars && count != response->errindex;
+                         vars = vars->next_variable, count++);
+                    if (vars)
+                        fprint_objid(stderr, vars->name,
+                                     vars->name_length);
+                    fprintf(stderr, "\n");
+                }
+                exitval = 2;
+            }
+        } else if (status == STAT_TIMEOUT) {
+            fprintf(stderr, "Timeout: No Response from %s\n",
+                    session.peername);
+            exitval = 1;
+        } else {                /* status == STAT_ERROR */
+            snmp_sess_perror("snmpstatus", ss);
+            exitval = 1;
+        }
+
+        if (response)
+            snmp_free_pdu(response);
+    }
+    printf("Interfaces: %d, Recv/Trans packets: %d/%d | IP: %d/%d\n",
+           interfaces, ipackets, opackets, ipin, ipout);
+    if (down_interfaces > 0) {
+        printf("%d interface%s down!\n",
+               down_interfaces, down_interfaces > 1 ? "s are" : " is");
+    }
+
+    snmp_close(ss);
+    SOCK_CLEANUP;
+    return exitval;
+}
diff -Naur tomato/release/src/router/snmp/apps/snmptable.c tomato121/release/src/router/snmp/apps/snmptable.c
--- tomato/release/src/router/snmp/apps/snmptable.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/apps/snmptable.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,885 @@
+/*
+ * snmptable.c - walk a table and print it nicely
+ *
+ * Update: 1999-10-26 <rs-snmp@revelstone.com>
+ * Added ability to use MIB to query tables with non-sequential column OIDs
+ * Added code to handle sparse tables
+ *
+ * Update: 1998-07-17 <jhy@gsu.edu>
+ * Added text <special options> to usage().
+ */
+/**********************************************************************
+	Copyright 1997 Niels Baggesen
+
+                      All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its 
+documentation for any purpose and without fee is hereby granted, 
+provided that the above copyright notice appear in all copies.
+
+I DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+I BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+******************************************************************/
+#include <net-snmp/net-snmp-config.h>
+
+#if HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#if HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#if HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+#include <sys/types.h>
+#if HAVE_NETINET_IN_H
+# include <netinet/in.h>
+#endif
+#if TIME_WITH_SYS_TIME
+# ifdef WIN32
+#  include <sys/timeb.h>
+# else
+#  include <sys/time.h>
+# endif
+# include <time.h>
+#else
+# if HAVE_SYS_TIME_H
+#  include <sys/time.h>
+# else
+#  include <time.h>
+# endif
+#endif
+#if HAVE_SYS_SELECT_H
+#include <sys/select.h>
+#endif
+#include <stdio.h>
+#if HAVE_WINSOCK_H
+#include <winsock.h>
+#endif
+#if HAVE_NETDB_H
+#include <netdb.h>
+#endif
+#if HAVE_ARPA_INET_H
+#include <arpa/inet.h>
+#endif
+
+#include <net-snmp/net-snmp-includes.h>
+
+struct column {
+    int             width;
+    oid             subid;
+    char           *label;
+    char           *fmt;
+}              *column = NULL;
+
+static char   **data = NULL;
+static char   **indices = NULL;
+static int      index_width = sizeof("index") - 1;
+static int      fields;
+static int      entries;
+static int      allocated;
+static int      headers_only = 0;
+static int      no_headers = 0;
+static int      max_width = 0;
+static int      brief = 0;
+static int      show_index = 0;
+static char    *field_separator = NULL;
+static char    *table_name;
+static oid      name[MAX_OID_LEN];
+static size_t   name_length;
+static oid      root[MAX_OID_LEN];
+static size_t   rootlen;
+static int      localdebug;
+static int      exitval = 0;
+static int      use_getbulk = 1;
+static int      max_getbulk = 25;
+
+void            usage(void);
+void            get_field_names(char *);
+void            get_table_entries(netsnmp_session * ss);
+void            getbulk_table_entries(netsnmp_session * ss);
+void            print_table(void);
+
+static void
+optProc(int argc, char *const *argv, int opt)
+{
+    switch (opt) {
+    case 'C':
+        /*
+         * Handle new '-C' command-specific meta-options 
+         */
+        while (*optarg) {
+            switch (*optarg++) {
+            case 'w':
+		if (optind < argc) {
+		    if (argv[optind]) {
+			max_width = atoi(argv[optind]);
+			if (max_width == 0) {
+			    usage();
+			    fprintf(stderr, "Bad -Cw option: %s\n", 
+				    argv[optind]);
+			    exit(1);
+			}
+		    }
+		} else {
+		    usage();
+                    fprintf(stderr, "Bad -Cw option: no argument given\n");
+		    exit(1);
+		}
+		optind++;
+                break;
+            case 'f':
+		if (optind < argc) {
+		    field_separator = argv[optind];
+		} else {
+                    usage();
+		    fprintf(stderr, "Bad -Cf option: no argument given\n");
+		    exit(1);
+		}
+		optind++;
+                break;
+            case 'h':
+                headers_only = 1;
+                break;
+            case 'H':
+                no_headers = 1;
+                break;
+            case 'B':
+                use_getbulk = 0;
+                break;
+            case 'b':
+                brief = 1;
+                break;
+            case 'i':
+                show_index = 1;
+                break;
+            default:
+                fprintf(stderr, "Bad option after -C: %c\n", optarg[-1]);
+                usage();
+            }
+        }
+        break;
+    }
+}
+
+void
+usage(void)
+{
+    fprintf(stderr, "USAGE: snmptable ");
+    snmp_parse_args_usage(stderr);
+    fprintf(stderr, " TABLE-OID\n\n");
+    snmp_parse_args_descriptions(stderr);
+    fprintf(stderr,
+	    "  -C APPOPTS\t\tSet various application specific behaviours:\n");
+    fprintf(stderr, "\t\t\t  b:       brief field names\n");
+    fprintf(stderr, "\t\t\t  B:       do not use GETBULK requests\n");
+    fprintf(stderr, "\t\t\t  f<STR>:  print table delimitied with <STR>\n");
+    fprintf(stderr, "\t\t\t  h:       print only the column headers\n");
+    fprintf(stderr, "\t\t\t  H:       print no column headers\n");
+    fprintf(stderr, "\t\t\t  i:       print index values\n");
+    fprintf(stderr, "\t\t\t  w<NUM>:  print table in parts of <NUM> chars width\n");
+}
+
+void
+reverse_fields(void)
+{
+    struct column   tmp;
+    int             i;
+
+    for (i = 0; i < fields / 2; i++) {
+        memcpy(&tmp, &(column[i]), sizeof(struct column));
+        memcpy(&(column[i]), &(column[fields - 1 - i]),
+               sizeof(struct column));
+        memcpy(&(column[fields - 1 - i]), &tmp, sizeof(struct column));
+    }
+}
+
+int
+main(int argc, char *argv[])
+{
+    netsnmp_session session, *ss;
+    char           *tblname;
+
+    setvbuf(stdout, NULL, _IOLBF, 1024);
+    netsnmp_ds_set_boolean(NETSNMP_DS_LIBRARY_ID, 
+                           NETSNMP_DS_LIB_QUICK_PRINT, 1);
+
+    /*
+     * get the common command line arguments 
+     */
+    switch (snmp_parse_args(argc, argv, &session, "C:", optProc)) {
+    case -2:
+        exit(0);
+    case -1:
+        usage();
+        exit(1);
+    default:
+        break;
+    }
+
+    /*
+     * get the initial object and subtree 
+     */
+    /*
+     * specified on the command line 
+     */
+    if (optind + 1 != argc) {
+        fprintf(stderr, "Must have exactly one table name\n");
+        usage();
+    }
+
+    rootlen = MAX_OID_LEN;
+    if (!snmp_parse_oid(argv[optind], root, &rootlen)) {
+        snmp_perror(argv[optind]);
+        exit(1);
+    }
+    localdebug = netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, 
+                                        NETSNMP_DS_LIB_DUMP_PACKET);
+    tblname = strrchr(argv[optind], '.');
+    if (!tblname)
+        tblname = strrchr(argv[optind], ':');
+    if (tblname)
+        ++tblname;
+    else
+        tblname = argv[optind];
+
+    get_field_names(tblname);
+    reverse_fields();
+
+    /*
+     * open an SNMP session 
+     */
+    SOCK_STARTUP;
+    ss = snmp_open(&session);
+    if (ss == NULL) {
+        /*
+         * diagnose snmp_open errors with the input netsnmp_session pointer 
+         */
+        snmp_sess_perror("snmptable", &session);
+        SOCK_CLEANUP;
+        exit(1);
+    }
+
+    if (ss->version == SNMP_VERSION_1)
+        use_getbulk = 0;
+    if (!headers_only) {
+        if (use_getbulk)
+            getbulk_table_entries(ss);
+        else
+            get_table_entries(ss);
+    }
+
+    snmp_close(ss);
+    SOCK_CLEANUP;
+    if (exitval)
+        return exitval;
+
+    if (entries || headers_only)
+        print_table();
+    else
+        printf("%s: No entries\n", table_name);
+
+    return 0;
+}
+
+void
+print_table(void)
+{
+    int             entry, field, first_field, last_field =
+        0, width, part = 0;
+    char          **dp;
+    char            string_buf[SPRINT_MAX_LEN];
+    char           *index_fmt = NULL;
+
+    if (!no_headers && !headers_only)
+        printf("SNMP table: %s\n\n", table_name);
+
+    for (field = 0; field < fields; field++) {
+        if (field_separator == NULL)
+            sprintf(string_buf, "%%%ds", column[field].width + 1);
+        else if (field == 0 && !show_index)
+            sprintf(string_buf, "%%s");
+        else
+            sprintf(string_buf, "%s%%s", field_separator);
+        column[field].fmt = strdup(string_buf);
+    }
+    if (show_index) {
+        if (field_separator == NULL)
+            sprintf(string_buf, "%%%ds", index_width);
+        else
+            sprintf(string_buf, "%%s");
+        index_fmt = strdup(string_buf);
+    }
+
+    while (last_field != fields) {
+        part++;
+        if (part != 1 && !no_headers)
+            printf("\nSNMP table %s, part %d\n\n", table_name, part);
+        first_field = last_field;
+        dp = data;
+        if (show_index && !no_headers) {
+            width = index_width;
+            printf(index_fmt, "index");
+        } else
+            width = 0;
+        for (field = first_field; field < fields; field++) {
+            width += column[field].width + 1;
+            if (field != first_field && width > max_width
+                && max_width != 0)
+                break;
+            if (!no_headers)
+                printf(column[field].fmt, column[field].label);
+        }
+        last_field = field;
+        if (!no_headers)
+            printf("\n");
+        for (entry = 0; entry < entries; entry++) {
+            if (show_index)
+                printf(index_fmt, indices[entry]);
+            for (field = first_field; field < last_field; field++) {
+                printf(column[field].fmt, dp[field] ? dp[field] : "?");
+            }
+            dp += fields;
+            printf("\n");
+        }
+    }
+}
+
+void
+get_field_names(char *tblname)
+{
+    u_char         *buf = NULL, *name_p = NULL;
+    size_t          buf_len = 0, out_len = 0;
+    struct tree    *tbl = NULL;
+    int             going = 1;
+
+    tbl = find_tree_node(tblname, -1);
+    if (tbl) {
+        tbl = tbl->child_list;
+        if (tbl) {
+            root[rootlen++] = tbl->subid;
+            tbl = tbl->child_list;
+        } else {
+            root[rootlen++] = 1;
+        }
+    }
+
+    if (sprint_realloc_objid
+        (&buf, &buf_len, &out_len, 1, root, rootlen - 1)) {
+        table_name = buf;
+        buf = NULL;
+        buf_len = out_len = 0;
+    } else {
+        table_name = strdup("[TRUNCATED]");
+        out_len = 0;
+    }
+
+    fields = 0;
+    while (going) {
+        fields++;
+        if (tbl) {
+            if (tbl->access == MIB_ACCESS_NOACCESS) {
+                fields--;
+                tbl = tbl->next_peer;
+                if (!tbl) {
+                    going = 0;
+                }
+                continue;
+            }
+            root[rootlen] = tbl->subid;
+            tbl = tbl->next_peer;
+            if (!tbl)
+                going = 0;
+        } else {
+            root[rootlen] = fields;
+        }
+        out_len = 0;
+        if (sprint_realloc_objid
+            (&buf, &buf_len, &out_len, 1, root, rootlen + 1)) {
+            name_p = strrchr(buf, '.');
+            if (name_p == NULL) {
+                name_p = strrchr(buf, ':');
+            }
+            if (name_p == NULL) {
+                name_p = buf;
+            } else {
+                name_p++;
+            }
+        } else {
+            break;
+        }
+        if (localdebug) {
+            printf("%s %c\n", buf, name_p[0]);
+        }
+        if ('0' <= name_p[0] && name_p[0] <= '9') {
+            fields--;
+            break;
+        }
+        if (fields == 1) {
+            column = (struct column *) malloc(sizeof(*column));
+        } else {
+            column =
+                (struct column *) realloc(column,
+                                          fields * sizeof(*column));
+        }
+        column[fields - 1].label = strdup(name_p);
+        column[fields - 1].width = strlen(name_p);
+        column[fields - 1].subid = root[rootlen];
+    }
+    if (fields == 0) {
+        fprintf(stderr, "Was that a table? %s\n", buf);
+        exit(1);
+    }
+    *name_p = 0;
+    memmove(name, root, rootlen * sizeof(oid));
+    name_length = rootlen + 1;
+    name_p = strrchr(buf, '.');
+    if (name_p == NULL) {
+        name_p = strrchr(buf, ':');
+    }
+    if (name_p != NULL) {
+        *name_p = 0;
+    }
+    if (brief && fields > 1) {
+        char           *f1, *f2;
+        int             common = strlen(column[0].label);
+        int             field, len;
+        for (field = 1; field < fields; field++) {
+            f1 = column[field - 1].label;
+            f2 = column[field].label;
+            while (*f1 && *f1++ == *f2++);
+            len = f2 - column[field].label - 1;
+            if (len < common)
+                common = len;
+        }
+        if (common) {
+            for (field = 0; field < fields; field++) {
+                column[field].label += common;
+                column[field].width -= common;
+            }
+        }
+    }
+    if (buf != NULL) {
+        free(buf);
+    }
+}
+
+void
+get_table_entries(netsnmp_session * ss)
+{
+    int             running = 1;
+    netsnmp_pdu    *pdu, *response;
+    netsnmp_variable_list *vars;
+    int             count;
+    int             status;
+    int             i;
+    int             col;
+    u_char         *buf = NULL;
+    size_t          out_len = 0, buf_len = 0;
+    char           *cp;
+    char           *name_p = NULL;
+    char          **dp;
+    int             end_of_table = 0;
+    int             have_current_index;
+
+    /*
+     * TODO:
+     *   1) Deal with multiple index fields
+     *   2) Deal with variable length index fields
+     *   3) optimize to remove a sparse column from get-requests
+     */
+
+    while (running) {
+        /*
+         * create PDU for GETNEXT request and add object name to request 
+         */
+        pdu = snmp_pdu_create(SNMP_MSG_GETNEXT);
+        for (i = 1; i <= fields; i++) {
+            name[rootlen] = column[i - 1].subid;
+            snmp_add_null_var(pdu, name, name_length);
+        }
+
+        /*
+         * do the request 
+         */
+        status = snmp_synch_response(ss, pdu, &response);
+        if (status == STAT_SUCCESS) {
+            if (response->errstat == SNMP_ERR_NOERROR) {
+                /*
+                 * check resulting variables 
+                 */
+                vars = response->variables;
+                entries++;
+                if (entries >= allocated) {
+                    if (allocated == 0) {
+                        allocated = 10;
+                        data =
+                            (char **) malloc(allocated * fields *
+                                             sizeof(char *));
+                        memset(data, 0,
+                               allocated * fields * sizeof(char *));
+                        if (show_index)
+                            indices =
+                                (char **) malloc(allocated *
+                                                 sizeof(char *));
+                    } else {
+                        allocated += 10;
+                        data =
+                            (char **) realloc(data,
+                                              allocated * fields *
+                                              sizeof(char *));
+                        memset(data + entries * fields, 0,
+                               (allocated -
+                                entries) * fields * sizeof(char *));
+                        if (show_index)
+                            indices =
+                                (char **) realloc(indices,
+                                                  allocated *
+                                                  sizeof(char *));
+                    }
+                }
+                dp = data + (entries - 1) * fields;
+                col = -1;
+                end_of_table = 1;       /* assume end of table */
+                have_current_index = 0;
+                name_length = rootlen + 1;
+                for (vars = response->variables; vars;
+                     vars = vars->next_variable) {
+                    col++;
+                    name[rootlen] = column[col].subid;
+                    if ((vars->name_length < name_length) ||
+                        ((int) vars->name[rootlen] != column[col].subid) ||
+                        memcmp(name, vars->name,
+                               name_length * sizeof(oid)) != 0
+                        || vars->type == SNMP_ENDOFMIBVIEW) {
+                        /*
+                         * not part of this subtree 
+                         */
+                        if (localdebug) {
+                            fprint_variable(stderr, vars->name,
+                                            vars->name_length, vars);
+                            fprintf(stderr, " => ignored\n");
+                        }
+                        continue;
+                    }
+
+                    /*
+                     * save index off 
+                     */
+                    if (!have_current_index) {
+                        end_of_table = 0;
+                        have_current_index = 1;
+                        name_length = vars->name_length;
+                        memcpy(name, vars->name,
+                               name_length * sizeof(oid));
+                        out_len = 0;
+                        if (!sprint_realloc_objid
+                            (&buf, &buf_len, &out_len, 1, vars->name,
+                             vars->name_length)) {
+                            break;
+                        }
+                        i = vars->name_length - rootlen + 1;
+                        if (localdebug || show_index) {
+                            if (netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, 
+                                              NETSNMP_DS_LIB_EXTENDED_INDEX)) {
+                                name_p = strchr(buf, '[');
+                            } else {
+                                switch (netsnmp_ds_get_int(NETSNMP_DS_LIBRARY_ID,
+                                                          NETSNMP_DS_LIB_OID_OUTPUT_FORMAT)) {
+                                case NETSNMP_OID_OUTPUT_MODULE:
+				case 0:
+                                    name_p = strrchr(buf, ':');
+                                    break;
+                                case NETSNMP_OID_OUTPUT_SUFFIX:
+                                    name_p = buf;
+                                    break;
+                                case NETSNMP_OID_OUTPUT_FULL:
+                                case NETSNMP_OID_OUTPUT_NUMERIC:
+                                case NETSNMP_OID_OUTPUT_UCD:
+                                    name_p = buf + strlen(table_name)+1;
+                                    name_p = strchr(name_p, '.')+1;
+                                    break;
+				default:
+				    fprintf(stderr, "Unrecognized -O option: %d\n",
+					    netsnmp_ds_get_int(NETSNMP_DS_LIBRARY_ID,
+							      NETSNMP_DS_LIB_OID_OUTPUT_FORMAT));
+				    exit(1);
+                                }
+                                name_p = strchr(name_p, '.') + 1;
+                            }
+                        }
+                        if (localdebug) {
+                            printf("Name: %s Index: %s\n", buf, name_p);
+                        }
+                        if (show_index) {
+                            indices[entries - 1] = strdup(name_p);
+                            i = strlen(name_p);
+                            if (i > index_width)
+                                index_width = i;
+                        }
+                    }
+
+                    if (localdebug && buf) {
+                        printf("%s => taken\n", buf);
+                    }
+                    out_len = 0;
+                    sprint_realloc_value(&buf, &buf_len, &out_len, 1,
+                                         vars->name, vars->name_length,
+                                         vars);
+                    for (cp = buf; *cp; cp++) {
+                        if (*cp == '\n') {
+                            *cp = ' ';
+                        }
+                    }
+                    dp[col] = buf;
+                    i = out_len;
+                    buf = NULL;
+                    buf_len = 0;
+                    if (i > column[col].width) {
+                        column[col].width = i;
+                    }
+                }
+
+                if (end_of_table) {
+                    --entries;
+                    /*
+                     * not part of this subtree 
+                     */
+                    if (localdebug) {
+                        printf("End of table: %s\n",
+                               buf ? (char *) buf : "[NIL]");
+                    }
+                    running = 0;
+                    continue;
+                }
+            } else {
+                /*
+                 * error in response, print it 
+                 */
+                running = 0;
+                if (response->errstat == SNMP_ERR_NOSUCHNAME) {
+                    printf("End of MIB\n");
+                } else {
+                    fprintf(stderr, "Error in packet.\nReason: %s\n",
+                            snmp_errstring(response->errstat));
+                    if (response->errindex != 0) {
+                        fprintf(stderr, "Failed object: ");
+                        for (count = 1, vars = response->variables;
+                             vars && count != response->errindex;
+                             vars = vars->next_variable, count++)
+                            /*EMPTY*/;
+                        if (vars) {
+                            fprint_objid(stderr, vars->name,
+                                         vars->name_length);
+                        }
+                        fprintf(stderr, "\n");
+                    }
+                    exitval = 2;
+                }
+            }
+        } else if (status == STAT_TIMEOUT) {
+            fprintf(stderr, "Timeout: No Response from %s\n",
+                    ss->peername);
+            running = 0;
+            exitval = 1;
+        } else {                /* status == STAT_ERROR */
+            snmp_sess_perror("snmptable", ss);
+            running = 0;
+            exitval = 1;
+        }
+        if (response)
+            snmp_free_pdu(response);
+    }
+}
+
+void
+getbulk_table_entries(netsnmp_session * ss)
+{
+    int             running = 1;
+    netsnmp_pdu    *pdu, *response;
+    netsnmp_variable_list *vars, *last_var;
+    int             count;
+    int             status;
+    int             i;
+    int             row, col;
+    u_char         *buf = NULL;
+    size_t          buf_len = 0, out_len = 0;
+    char           *cp;
+    char           *name_p = NULL;
+    char          **dp;
+
+    while (running) {
+        /*
+         * create PDU for GETNEXT request and add object name to request 
+         */
+        pdu = snmp_pdu_create(SNMP_MSG_GETBULK);
+        pdu->non_repeaters = 0;
+        pdu->max_repetitions = max_getbulk;
+        snmp_add_null_var(pdu, name, name_length);
+
+        /*
+         * do the request 
+         */
+        status = snmp_synch_response(ss, pdu, &response);
+        if (status == STAT_SUCCESS) {
+            if (response->errstat == SNMP_ERR_NOERROR) {
+                /*
+                 * check resulting variables 
+                 */
+                vars = response->variables;
+                last_var = NULL;
+                while (vars) {
+                    out_len = 0;
+                    sprint_realloc_objid(&buf, &buf_len, &out_len, 1,
+                                         vars->name, vars->name_length);
+                    if (vars->type == SNMP_ENDOFMIBVIEW ||
+                        memcmp(vars->name, name,
+                               rootlen * sizeof(oid)) != 0) {
+                        if (localdebug) {
+                            printf("%s => end of table\n",
+                                   buf ? (char *) buf : "[NIL]");
+                        }
+                        running = 0;
+                        break;
+                    }
+                    if (localdebug) {
+                        printf("%s => taken\n",
+                               buf ? (char *) buf : "[NIL]");
+                    }
+                    if (netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, 
+                                              NETSNMP_DS_LIB_EXTENDED_INDEX)) {
+                        name_p = strchr(buf, '[');
+                    } else {
+                        switch (netsnmp_ds_get_int(NETSNMP_DS_LIBRARY_ID,
+                                                  NETSNMP_DS_LIB_OID_OUTPUT_FORMAT)) {
+                        case NETSNMP_OID_OUTPUT_MODULE:
+			case 0:
+                            name_p = strrchr(buf, ':');
+                            break;
+                        case NETSNMP_OID_OUTPUT_SUFFIX:
+                            name_p = buf;
+                            break;
+                        case NETSNMP_OID_OUTPUT_FULL:
+                        case NETSNMP_OID_OUTPUT_NUMERIC:
+                        case NETSNMP_OID_OUTPUT_UCD:
+                            name_p = buf + strlen(table_name)+1;
+                            name_p = strchr(name_p, '.')+1;
+                            break;
+			default:
+			    fprintf(stderr, "Unrecognized -O option: %d\n",
+				    netsnmp_ds_get_int(NETSNMP_DS_LIBRARY_ID,
+					              NETSNMP_DS_LIB_OID_OUTPUT_FORMAT));
+			    exit(1);
+                        }
+                        name_p = strchr(name_p, '.') + 1;
+                    }
+                    for (row = 0; row < entries; row++)
+                        if (strcmp(name_p, indices[row]) == 0)
+                            break;
+                    if (row == entries) {
+                        entries++;
+                        if (entries >= allocated) {
+                            if (allocated == 0) {
+                                allocated = 10;
+                                data =
+                                    (char **) malloc(allocated * fields *
+                                                     sizeof(char *));
+                                memset(data, 0,
+                                       allocated * fields *
+                                       sizeof(char *));
+                                indices =
+                                    (char **) malloc(allocated *
+                                                     sizeof(char *));
+                            } else {
+                                allocated += 10;
+                                data =
+                                    (char **) realloc(data,
+                                                      allocated * fields *
+                                                      sizeof(char *));
+                                memset(data + entries * fields, 0,
+                                       (allocated -
+                                        entries) * fields *
+                                       sizeof(char *));
+                                indices =
+                                    (char **) realloc(indices,
+                                                      allocated *
+                                                      sizeof(char *));
+                            }
+                        }
+                        indices[row] = strdup(name_p);
+                        i = strlen(name_p);
+                        if (i > index_width)
+                            index_width = i;
+                    }
+                    dp = data + row * fields;
+                    out_len = 0;
+                    sprint_realloc_value(&buf, &buf_len, &out_len, 1,
+                                         vars->name, vars->name_length,
+                                         vars);
+                    for (cp = buf; *cp; cp++)
+                        if (*cp == '\n')
+                            *cp = ' ';
+                    for (col = 0; col < fields; col++)
+                        if (column[col].subid == vars->name[rootlen])
+                            break;
+                    dp[col] = buf;
+                    i = out_len;
+                    buf = NULL;
+                    buf_len = 0;
+                    if (i > column[col].width)
+                        column[col].width = i;
+                    last_var = vars;
+                    vars = vars->next_variable;
+                }
+                if (last_var) {
+                    name_length = last_var->name_length;
+                    memcpy(name, last_var->name,
+                           name_length * sizeof(oid));
+                }
+            } else {
+                /*
+                 * error in response, print it 
+                 */
+                running = 0;
+                if (response->errstat == SNMP_ERR_NOSUCHNAME) {
+                    printf("End of MIB\n");
+                } else {
+                    fprintf(stderr, "Error in packet.\nReason: %s\n",
+                            snmp_errstring(response->errstat));
+                    if (response->errstat == SNMP_ERR_NOSUCHNAME) {
+                        fprintf(stderr,
+                                "The request for this object identifier failed: ");
+                        for (count = 1, vars = response->variables;
+                             vars && count != response->errindex;
+                             vars = vars->next_variable, count++)
+                            /*EMPTY*/;
+                        if (vars) {
+                            fprint_objid(stderr, vars->name,
+                                         vars->name_length);
+                        }
+                        fprintf(stderr, "\n");
+                    }
+                    exitval = 2;
+                }
+            }
+        } else if (status == STAT_TIMEOUT) {
+            fprintf(stderr, "Timeout: No Response from %s\n",
+                    ss->peername);
+            running = 0;
+            exitval = 1;
+        } else {                /* status == STAT_ERROR */
+            snmp_sess_perror("snmptable", ss);
+            running = 0;
+            exitval = 1;
+        }
+        if (response)
+            snmp_free_pdu(response);
+    }
+}
diff -Naur tomato/release/src/router/snmp/apps/snmptest.c tomato121/release/src/router/snmp/apps/snmptest.c
--- tomato/release/src/router/snmp/apps/snmptest.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/apps/snmptest.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,505 @@
+/*
+ * snmptest.c - send snmp requests to a network entity.
+ *
+ * Usage: snmptest -v 1 [-q] hostname community [objectID]
+ *
+ */
+/***********************************************************************
+	Copyright 1988, 1989, 1991, 1992 by Carnegie Mellon University
+
+                      All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of CMU not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+CMU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+CMU BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+******************************************************************/
+#include <net-snmp/net-snmp-config.h>
+
+#if HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#if HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#if HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+#include <sys/types.h>
+#if HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+#include <stdio.h>
+#include <ctype.h>
+#if TIME_WITH_SYS_TIME
+# ifdef WIN32
+#  include <sys/timeb.h>
+# else
+#  include <sys/time.h>
+# endif
+# include <time.h>
+#else
+# if HAVE_SYS_TIME_H
+#  include <sys/time.h>
+# else
+#  include <time.h>
+# endif
+#endif
+#if HAVE_SYS_SELECT_H
+#include <sys/select.h>
+#endif
+#if HAVE_WINSOCK_H
+#include <winsock.h>
+#endif
+#if HAVE_NETDB_H
+#include <netdb.h>
+#endif
+#if HAVE_ARPA_INET_H
+#include <arpa/inet.h>
+#endif
+
+#include <net-snmp/net-snmp-includes.h>
+
+int             command = SNMP_MSG_GET;
+
+int             input_variable(netsnmp_variable_list *);
+
+void
+usage(void)
+{
+    fprintf(stderr, "USAGE: snmptest ");
+    snmp_parse_args_usage(stderr);
+    fprintf(stderr, "\n\n");
+    snmp_parse_args_descriptions(stderr);
+}
+
+int
+main(int argc, char *argv[])
+{
+    netsnmp_session session, *ss;
+    netsnmp_pdu    *pdu = NULL, *response, *copy = NULL;
+    netsnmp_variable_list *vars, *vp;
+    netsnmp_transport *transport = NULL;
+    int             ret;
+    int             status, count;
+    char            input[128];
+    int             varcount, nonRepeaters = -1, maxRepetitions;
+
+    /*
+     * get the common command line arguments 
+     */
+    switch (snmp_parse_args(argc, argv, &session, NULL, NULL)) {
+    case -2:
+        exit(0);
+    case -1:
+        usage();
+        exit(1);
+    default:
+        break;
+    }
+
+    SOCK_STARTUP;
+
+    /*
+     * open an SNMP session 
+     */
+    ss = snmp_open(&session);
+    if (ss == NULL) {
+        /*
+         * diagnose snmp_open errors with the input netsnmp_session pointer 
+         */
+        snmp_sess_perror("snmptest", &session);
+        SOCK_CLEANUP;
+        exit(1);
+    }
+
+    varcount = 0;
+    while (1) {
+        vars = NULL;
+        for (ret = 1; ret != 0;) {
+            vp = (netsnmp_variable_list *)
+                malloc(sizeof(netsnmp_variable_list));
+            memset(vp, 0, sizeof(netsnmp_variable_list));
+
+            while ((ret = input_variable(vp)) == -1);
+            if (ret == 1) {
+                varcount++;
+                /*
+                 * add it to the list 
+                 */
+                if (vars == NULL) {
+                    /*
+                     * if first variable 
+                     */
+                    pdu = snmp_pdu_create(command);
+                    pdu->variables = vp;
+                } else {
+                    vars->next_variable = vp;
+                }
+                vars = vp;
+            } else {
+                /*
+                 * free the last (unused) variable 
+                 */
+                if (vp->name)
+                    free((char *) vp->name);
+                if (vp->val.string)
+                    free((char *) vp->val.string);
+                free((char *) vp);
+
+                if (command == SNMP_MSG_GETBULK) {
+                    if (nonRepeaters == -1) {
+                        nonRepeaters = varcount;
+                        ret = -1;       /* so we collect more variables */
+                        printf("Now input the repeating variables\n");
+                    } else {
+                        printf("What repeat count? ");
+                        fflush(stdout);
+                        fgets(input, sizeof(input), stdin);
+                        maxRepetitions = atoi(input);
+                        pdu->non_repeaters = nonRepeaters;
+                        pdu->max_repetitions = maxRepetitions;
+                    }
+                }
+            }
+            if (varcount == 0 && ret == 0) {
+                if (!copy) {
+                    printf("No PDU to send.\n");
+                    ret = -1;
+                } else {
+                    pdu = snmp_clone_pdu(copy);
+                    printf("Resending last PDU.\n");
+                }
+            }
+        }
+        copy = snmp_clone_pdu(pdu);
+        if (command == SNMP_MSG_TRAP2) {
+            /*
+             * No response needed 
+             */
+            if (!snmp_send(ss, pdu)) {
+                snmp_free_pdu(pdu);
+                snmp_sess_perror("snmptest", ss);
+            }
+        } else {
+            status = snmp_synch_response(ss, pdu, &response);
+            if (status == STAT_SUCCESS) {
+                if (command == SNMP_MSG_INFORM &&
+                    response->errstat == SNMP_ERR_NOERROR) {
+                    printf("Inform Acknowledged\n");
+                } else {
+                    switch (response->command) {
+                    case SNMP_MSG_GET:
+                        printf("Received Get Request ");
+                        break;
+                    case SNMP_MSG_GETNEXT:
+                        printf("Received Getnext Request ");
+                        break;
+                    case SNMP_MSG_RESPONSE:
+                        printf("Received Get Response ");
+                        break;
+                    case SNMP_MSG_SET:
+                        printf("Received Set Request ");
+                        break;
+                    case SNMP_MSG_TRAP:
+                        printf("Received Trap Request ");
+                        break;
+                    case SNMP_MSG_GETBULK:
+                        printf("Received Bulk Request ");
+                        break;
+                    case SNMP_MSG_INFORM:
+                        printf("Received Inform Request ");
+                        break;
+                    case SNMP_MSG_TRAP2:
+                        printf("Received SNMPv2 Trap Request ");
+                        break;
+                    }
+                    transport = snmp_sess_transport(snmp_sess_pointer(ss));
+                    if (transport != NULL && transport->f_fmtaddr != NULL) {
+                        char           *s = transport->f_fmtaddr(transport,
+                                                                 response->
+                                                                 transport_data,
+                                                                 response->
+                                                                 transport_data_length);
+                        printf("from %s\n", s);
+                    } else {
+                        printf("from <UNKNOWN>\n");
+                    }
+                    printf
+                        ("requestid 0x%lX errstat 0x%lX errindex 0x%lX\n",
+                         response->reqid, response->errstat,
+                         response->errindex);
+                    if (response->errstat == SNMP_ERR_NOERROR) {
+                        for (vars = response->variables; vars;
+                             vars = vars->next_variable)
+                            print_variable(vars->name, vars->name_length,
+                                           vars);
+                    } else {
+                        printf("Error in packet.\nReason: %s\n",
+                               snmp_errstring(response->errstat));
+                        if (response->errindex != 0) {
+                            for (count = 1, vars = response->variables;
+                                 vars && count != response->errindex;
+                                 vars = vars->next_variable, count++);
+                            if (vars) {
+                                printf("Failed object: ");
+                                print_objid(vars->name, vars->name_length);
+                            }
+                            printf("\n");
+                        }
+                    }
+                }
+            } else if (status == STAT_TIMEOUT) {
+                printf("Timeout: No Response from %s\n", session.peername);
+            } else {            /* status == STAT_ERROR */
+                snmp_sess_perror("snmptest", ss);
+            }
+
+            if (response)
+                snmp_free_pdu(response);
+        }
+        varcount = 0;
+        nonRepeaters = -1;
+    }
+    SOCK_CLEANUP;
+    return 0;
+}
+
+int
+input_variable(netsnmp_variable_list * vp)
+{
+    char            buf[256];
+    int             val_len;
+    u_char          value[256], ch;
+    oid             name[MAX_OID_LEN];
+
+    printf("Variable: ");
+    fflush(stdout);
+    if (!fgets(buf, sizeof(buf), stdin)) {
+        printf("Quitting,  Goobye\n");
+        SOCK_CLEANUP;
+        exit(0);
+    }
+    val_len = strlen(buf);
+
+    if (val_len == 0 || *buf == '\n') {
+        vp->name_length = 0;
+        return 0;
+    }
+    if (buf[val_len - 1] == '\n')
+        buf[--val_len] = 0;
+    if (*buf == '$') {
+        switch (toupper(buf[1])) {
+        case 'G':
+            command = SNMP_MSG_GET;
+            printf("Request type is Get Request\n");
+            break;
+        case 'N':
+            command = SNMP_MSG_GETNEXT;
+            printf("Request type is Getnext Request\n");
+            break;
+        case 'S':
+            command = SNMP_MSG_SET;
+            printf("Request type is Set Request\n");
+            break;
+        case 'B':
+            command = SNMP_MSG_GETBULK;
+            printf("Request type is Bulk Request\n");
+            printf
+                ("Enter a blank line to terminate the list of non-repeaters\n");
+            printf("and to begin the repeating variables\n");
+            break;
+        case 'I':
+            command = SNMP_MSG_INFORM;
+            printf("Request type is Inform Request\n");
+            printf("(Are you sending to the right port?)\n");
+            break;
+        case 'T':
+            command = SNMP_MSG_TRAP2;
+            printf("Request type is SNMPv2 Trap Request\n");
+            printf("(Are you sending to the right port?)\n");
+            break;
+        case 'D':
+            if (snmp_get_dump_packet()) {
+                snmp_set_dump_packet(0);
+                printf("Turned packet dump off\n");
+            } else {
+                snmp_set_dump_packet(1);
+                printf("Turned packet dump on\n");
+            }
+            break;
+        case 'Q':
+            switch ((toupper(buf[2]))) {
+            case '\n':
+            case 0:
+                printf("Quitting,  Goodbye\n");
+                SOCK_CLEANUP;
+                exit(0);
+                break;
+            case 'P':
+                if (snmp_get_quick_print()) {
+                    snmp_set_quick_print(0);
+                    printf("Turned quick printing off\n");
+                } else {
+                    snmp_set_quick_print(1);
+                    printf("Turned quick printing on\n");
+                }
+                break;
+            }
+            break;
+        default:
+            printf("Bad command\n");
+        }
+        return -1;
+    }
+    vp->name_length = MAX_OID_LEN;
+    if (!snmp_parse_oid(buf, name, &vp->name_length)) {
+        snmp_perror(buf);
+        return -1;
+    }
+    vp->name = (oid *) malloc(vp->name_length * sizeof(oid));
+    memmove(vp->name, name, vp->name_length * sizeof(oid));
+
+    if (command == SNMP_MSG_SET || command == SNMP_MSG_INFORM
+        || command == SNMP_MSG_TRAP2) {
+        printf("Type [i|u|s|x|d|n|o|t|a]: ");
+        fflush(stdout);
+        fgets(buf, sizeof(buf), stdin);
+        ch = *buf;
+        switch (ch) {
+        case 'i':
+            vp->type = ASN_INTEGER;
+            break;
+        case 'u':
+            vp->type = ASN_UNSIGNED;
+            break;
+        case 's':
+            vp->type = ASN_OCTET_STR;
+            break;
+        case 'x':
+            vp->type = ASN_OCTET_STR;
+            break;
+        case 'd':
+            vp->type = ASN_OCTET_STR;
+            break;
+        case 'n':
+            vp->type = ASN_NULL;
+            break;
+        case 'o':
+            vp->type = ASN_OBJECT_ID;
+            break;
+        case 't':
+            vp->type = ASN_TIMETICKS;
+            break;
+        case 'a':
+            vp->type = ASN_IPADDRESS;
+            break;
+        default:
+            printf
+                ("bad type \"%c\", use \"i\", \"u\", \"s\", \"x\", \"d\", \"n\", \"o\", \"t\", or \"a\".\n",
+                 *buf);
+            return -1;
+        }
+      getValue:
+        printf("Value: ");
+        fflush(stdout);
+        fgets(buf, sizeof(buf), stdin);
+        switch (vp->type) {
+        case ASN_INTEGER:
+            vp->val.integer = (long *) malloc(sizeof(long));
+            *(vp->val.integer) = atoi(buf);
+            vp->val_len = sizeof(long);
+            break;
+        case ASN_UNSIGNED:
+            vp->val.integer = (long *) malloc(sizeof(long));
+            *(vp->val.integer) = strtoul(buf, NULL, 0);
+            vp->val_len = sizeof(long);
+            break;
+        case ASN_OCTET_STR:
+            if (ch == 'd') {
+                size_t          buf_len = 256;
+                val_len = 0;
+                if ((vp->val.string = (u_char *) malloc(buf_len)) == NULL) {
+                    printf("malloc failure\n");
+                    goto getValue;
+                }
+                if (!snmp_decimal_to_binary(&(vp->val.string), &buf_len,
+                                            &val_len, 1, buf)) {
+                    printf("Bad value or no sub-identifier > 255\n");
+                    free(vp->val.string);
+                    goto getValue;
+                }
+                vp->val_len = val_len;
+            } else if (ch == 's') {
+                /*
+                 * -1 to omit trailing newline  
+                 */
+                vp->val.string = (u_char *) malloc(strlen(buf) - 1);
+                if (vp->val.string == NULL) {
+                    printf("malloc failure\n");
+                    goto getValue;
+                }
+                memcpy(vp->val.string, buf, strlen(buf) - 1);
+                vp->val_len = strlen(buf) - 1;
+            } else if (ch == 'x') {
+                size_t          buf_len = 256;
+                val_len = 0;
+                if ((vp->val.string = (u_char *) malloc(buf_len)) == NULL) {
+                    printf("malloc failure\n");
+                    goto getValue;
+                }
+                if (!snmp_hex_to_binary(&(vp->val.string), &buf_len,
+                                        &val_len, 1, buf)) {
+                    printf("Bad value (need pairs of hex digits)\n");
+                    free(vp->val.string);
+                    goto getValue;
+                }
+                vp->val_len = val_len;
+            }
+            break;
+        case ASN_NULL:
+            vp->val_len = 0;
+            vp->val.string = NULL;
+            break;
+        case ASN_OBJECT_ID:
+            if ('\n' == buf[strlen(buf) - 1])
+                buf[strlen(buf) - 1] = '\0';
+            vp->val_len = MAX_OID_LEN;;
+            read_objid(buf, (oid *) value, &vp->val_len);
+            vp->val_len *= sizeof(oid);
+            vp->val.objid = (oid *) malloc(vp->val_len);
+            memmove(vp->val.objid, value, vp->val_len);
+            break;
+        case ASN_TIMETICKS:
+            vp->val.integer = (long *) malloc(sizeof(long));
+            *(vp->val.integer) = atoi(buf);
+            vp->val_len = sizeof(long);
+            break;
+        case ASN_IPADDRESS:
+            vp->val.integer = (long *) malloc(sizeof(long));
+            *(vp->val.integer) = inet_addr(buf);
+            vp->val_len = sizeof(long);
+            break;
+        default:
+            printf("Internal error\n");
+            break;
+        }
+    } else {                    /* some form of get message */
+        vp->type = ASN_NULL;
+        vp->val_len = 0;
+    }
+    return 1;
+}
diff -Naur tomato/release/src/router/snmp/apps/snmptranslate.c tomato121/release/src/router/snmp/apps/snmptranslate.c
--- tomato/release/src/router/snmp/apps/snmptranslate.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/apps/snmptranslate.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,329 @@
+/*
+ * snmptranslate.c - report or translate info about oid from mibs
+ *
+ * Update: 1998-07-17 <jhy@gsu.edu>
+ * Added support for dumping alternate oid reports (-t and -T options).
+ * Added more detailed (useful?) usage info.
+ */
+/************************************************************************
+	Copyright 1988, 1989, 1991, 1992 by Carnegie Mellon University
+
+                      All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its 
+documentation for any purpose and without fee is hereby granted, 
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in 
+supporting documentation, and that the name of CMU not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.  
+
+CMU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+CMU BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+******************************************************************/
+
+
+#include <net-snmp/net-snmp-config.h>
+
+#if HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#if HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#if HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+#include <sys/types.h>
+#if HAVE_SYS_SELECT_H
+#include <sys/select.h>
+#endif
+#if HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+#include <stdio.h>
+#include <ctype.h>
+#include <net-snmp/utilities.h>
+
+#if HAVE_WINSOCK_H
+#include <winsock.h>
+#endif
+
+#include <net-snmp/config_api.h>
+#include <net-snmp/output_api.h>
+#include <net-snmp/mib_api.h>
+
+int             show_all_matched_objects(FILE *, const char *, oid *,
+                                         size_t *, int, int);
+
+void
+usage(void)
+{
+    fprintf(stderr, "USAGE: snmptranslate [OPTIONS] OID [OID]...\n\n");
+    fprintf(stderr, "  Version:  %s\n", netsnmp_get_version());
+    fprintf(stderr, "  Web:      http://www.net-snmp.org/\n");
+    fprintf(stderr,
+            "  Email:    net-snmp-coders@lists.sourceforge.net\n\nOPTIONS:\n");
+
+    fprintf(stderr, "  -h\t\t\tdisplay this help message\n");
+    fprintf(stderr, "  -V\t\t\tdisplay package version number\n");
+    fprintf(stderr,
+            "  -m MIB[:...]\t\tload given list of MIBs (ALL loads everything)\n");
+    fprintf(stderr,
+            "  -M DIR[:...]\t\tlook in given list of directories for MIBs\n");
+    fprintf(stderr,
+            "  -D TOKEN[,...]\tturn on debugging output for the specified TOKENs\n\t\t\t   (ALL gives extremely verbose debugging output)\n");
+    fprintf(stderr, "  -w WIDTH\t\tset width of tree and detail output\n");
+    fprintf(stderr,
+            "  -T TRANSOPTS\t\tSet various options controlling report produced:\n");
+    fprintf(stderr,
+            "\t\t\t  B:  print all matching objects for a regex search\n");
+    fprintf(stderr, "\t\t\t  d:  print full details of the given OID\n");
+    fprintf(stderr, "\t\t\t  p:  print tree format symbol table\n");
+    fprintf(stderr, "\t\t\t  a:  print ASCII format symbol table\n");
+    fprintf(stderr, "\t\t\t  l:  enable labeled OID report\n");
+    fprintf(stderr, "\t\t\t  o:  enable OID report\n");
+    fprintf(stderr, "\t\t\t  s:  enable dotted symbolic report\n");
+    fprintf(stderr,
+            "\t\t\t  t:  enable alternate format symbolic suffix report\n");
+    fprintf(stderr,
+            "  -P MIBOPTS\t\tToggle various defaults controlling mib parsing:\n");
+    snmp_mib_toggle_options_usage("\t\t\t  ", stderr);
+    fprintf(stderr,
+            "  -O OUTOPTS\t\tToggle various defaults controlling output display:\n");
+    snmp_out_toggle_options_usage("\t\t\t  ", stderr);
+    fprintf(stderr,
+            "  -I INOPTS\t\tToggle various defaults controlling input parsing:\n");
+    snmp_in_toggle_options_usage("\t\t\t  ", stderr);
+    exit(1);
+}
+
+int
+main(int argc, char *argv[])
+{
+    int             arg;
+    char           *current_name = NULL, *cp = NULL;
+    oid             name[MAX_OID_LEN];
+    size_t          name_length;
+    int             description = 0;
+    int             print = 0;
+    int             find_all = 0;
+    int             width = 1000000;
+
+    /*
+     * usage: snmptranslate name
+     */
+    while ((arg = getopt(argc, argv, "Vhm:M:w:D:P:T:O:I:")) != EOF) {
+        switch (arg) {
+        case 'h':
+            usage();
+            exit(1);
+
+        case 'm':
+            setenv("MIBS", optarg, 1);
+            break;
+        case 'M':
+            setenv("MIBDIRS", optarg, 1);
+            break;
+        case 'D':
+            debug_register_tokens(optarg);
+            snmp_set_do_debugging(1);
+            break;
+        case 'V':
+            fprintf(stderr, "NET-SNMP version: %s\n",
+                    netsnmp_get_version());
+            exit(0);
+            break;
+        case 'w':
+	    width = atoi(optarg);
+	    if (width <= 0) {
+		fprintf(stderr, "Invalid width specification: %s\n", optarg);
+		exit (1);
+	    }
+	    break;
+        case 'P':
+            cp = snmp_mib_toggle_options(optarg);
+            if (cp != NULL) {
+                fprintf(stderr, "Unknown parser option to -P: %c.\n", *cp);
+                usage();
+                exit(1);
+            }
+            break;
+        case 'O':
+            cp = snmp_out_toggle_options(optarg);
+            if (cp != NULL) {
+                fprintf(stderr, "Unknown OID option to -O: %c.\n", *cp);
+                usage();
+                exit(1);
+            }
+            break;
+        case 'I':
+            cp = snmp_in_toggle_options(optarg);
+            if (cp != NULL) {
+                fprintf(stderr, "Unknown OID option to -I: %c.\n", *cp);
+                usage();
+                exit(1);
+            }
+            break;
+        case 'T':
+            for (cp = optarg; *cp; cp++) {
+                switch (*cp) {
+                case 'l':
+                    print = 3;
+                    print_oid_report_enable_labeledoid();
+                    break;
+                case 'o':
+                    print = 3;
+                    print_oid_report_enable_oid();
+                    break;
+                case 's':
+                    print = 3;
+                    print_oid_report_enable_symbolic();
+                    break;
+                case 't':
+                    print = 3;
+                    print_oid_report_enable_suffix();
+                    break;
+                case 'd':
+                    description = 1;
+                    snmp_set_save_descriptions(1);
+                    break;
+                case 'B':
+                    find_all = 1;
+                    break;
+                case 'p':
+                    print = 1;
+                    break;
+                case 'a':
+                    print = 2;
+                    break;
+                default:
+                    fprintf(stderr, "Invalid -T<lostpad> character: %c\n",
+                            *cp);
+                    usage();
+                    exit(1);
+                    break;
+                }
+            }
+            break;
+        default:
+            fprintf(stderr, "invalid option: -%c\n", arg);
+            usage();
+            exit(1);
+            break;
+        }
+    }
+
+    init_snmp("snmpapp");
+    if (optind < argc)
+        current_name = argv[optind];
+
+    if (current_name == NULL) {
+        switch (print) {
+        default:
+            usage();
+            exit(1);
+        case 1:
+            print_mib_tree(stdout, get_tree_head(), width);
+            break;
+        case 2:
+            print_ascii_dump(stdout);
+            break;
+        case 3:
+            print_oid_report(stdout);
+            break;
+        }
+        exit(0);
+    }
+
+    do {
+        name_length = MAX_OID_LEN;
+        if (snmp_get_random_access()) {
+            if (!get_node(current_name, name, &name_length)) {
+                fprintf(stderr, "Unknown object identifier: %s\n",
+                        current_name);
+                exit(2);
+            }
+        } else if (find_all) {
+            if (0 == show_all_matched_objects(stdout, current_name,
+                                              name, &name_length,
+                                              description, width)) {
+                fprintf(stderr,
+                        "Unable to find a matching object identifier for \"%s\"\n",
+                        current_name);
+                exit(1);
+            }
+            exit(0);
+        } else if (netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, 
+					  NETSNMP_DS_LIB_REGEX_ACCESS)) {
+            if (0 == get_wild_node(current_name, name, &name_length)) {
+                fprintf(stderr,
+                        "Unable to find a matching object identifier for \"%s\"\n",
+                        current_name);
+                exit(1);
+            }
+        } else {
+            if (!read_objid(current_name, name, &name_length)) {
+                snmp_perror(current_name);
+                exit(2);
+            }
+        }
+
+
+        if (print == 1) {
+            struct tree    *tp;
+            tp = get_tree(name, name_length, get_tree_head());
+            if (tp == NULL) {
+                snmp_log(LOG_ERR,
+                        "Unable to find a matching object identifier for \"%s\"\n",
+                        current_name);
+                exit(1);
+            }
+            print_mib_tree(stdout, tp, width);
+        } else {
+            print_objid(name, name_length);
+            if (description) {
+                print_description(name, name_length, width);
+            }
+        }
+        current_name = argv[++optind];
+        if (current_name != NULL)
+            printf("\n");
+    } while (optind < argc);
+
+    return (0);
+}
+
+/*
+ * Show all object identifiers that match the pattern.
+ */
+
+int
+show_all_matched_objects(FILE * fp, const char *patmatch, oid * name, size_t * name_length, int f_desc, /* non-zero if descriptions should be shown */
+                         int width)
+{
+    int             result, count = 0;
+    size_t          savlen = *name_length;
+    clear_tree_flags(get_tree_head());
+
+    while (1) {
+        *name_length = savlen;
+        result = get_wild_node(patmatch, name, name_length);
+        if (!result)
+            break;
+        count++;
+
+        fprint_objid(fp, name, *name_length);
+        if (f_desc)
+            fprint_description(fp, name, *name_length, width);
+    }
+
+    return (count);
+}
diff -Naur tomato/release/src/router/snmp/apps/snmptrap.c tomato121/release/src/router/snmp/apps/snmptrap.c
--- tomato/release/src/router/snmp/apps/snmptrap.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/apps/snmptrap.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,393 @@
+/*
+ * snmptrap.c - send snmp traps to a network entity.
+ *
+ */
+/******************************************************************
+	Copyright 1989, 1991, 1992 by Carnegie Mellon University
+
+                      All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of CMU not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+CMU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+CMU BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+******************************************************************/
+#include <net-snmp/net-snmp-config.h>
+
+#if HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#if HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#if HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+#include <sys/types.h>
+#if HAVE_NETINET_IN_H
+# include <netinet/in.h>
+#endif
+#if TIME_WITH_SYS_TIME
+# ifdef WIN32
+#  include <sys/timeb.h>
+# else
+#  include <sys/time.h>
+# endif
+# include <time.h>
+#else
+# if HAVE_SYS_TIME_H
+#  include <sys/time.h>
+# else
+#  include <time.h>
+# endif
+#endif
+#if HAVE_SYS_SELECT_H
+#include <sys/select.h>
+#endif
+#include <stdio.h>
+#if HAVE_WINSOCK_H
+#include <winsock.h>
+#endif
+#if HAVE_SYS_SOCKET_H
+#include <sys/socket.h>
+#endif
+#if HAVE_NETDB_H
+#include <netdb.h>
+#endif
+#if HAVE_ARPA_INET_H
+#include <arpa/inet.h>
+#endif
+
+#include <net-snmp/net-snmp-includes.h>
+
+oid             objid_enterprise[] = { 1, 3, 6, 1, 4, 1, 3, 1, 1 };
+oid             objid_sysdescr[] = { 1, 3, 6, 1, 2, 1, 1, 1, 0 };
+oid             objid_sysuptime[] = { 1, 3, 6, 1, 2, 1, 1, 3, 0 };
+oid             objid_snmptrap[] = { 1, 3, 6, 1, 6, 3, 1, 1, 4, 1, 0 };
+int             inform = 0;
+
+void
+usage(void)
+{
+    fprintf(stderr, "USAGE: %s ", inform ? "snmpinform" : "snmptrap");
+    snmp_parse_args_usage(stderr);
+    fprintf(stderr, " TRAP-PARAMETERS\n\n");
+    snmp_parse_args_descriptions(stderr);
+    fprintf(stderr,
+            "  -C APPOPTS\t\tSet various application specific behaviour:\n");
+    fprintf(stderr, "\t\t\t  i:  send an INFORM instead of a TRAP\n");
+    fprintf(stderr,
+            "\n  -v 1 TRAP-PARAMETERS:\n\t enterprise-oid agent trap-type specific-type uptime [OID TYPE VALUE]...\n");
+    fprintf(stderr, "  or\n");
+    fprintf(stderr,
+            "  -v 2 TRAP-PARAMETERS:\n\t uptime trapoid [OID TYPE VALUE] ...\n");
+}
+
+int
+snmp_input(int operation,
+           netsnmp_session * session,
+           int reqid, netsnmp_pdu *pdu, void *magic)
+{
+    return 1;
+}
+
+in_addr_t
+parse_address(char *address)
+{
+    in_addr_t       addr;
+    struct sockaddr_in saddr;
+    struct hostent *hp;
+
+    if ((addr = inet_addr(address)) != -1)
+        return addr;
+    hp = gethostbyname(address);
+    if (hp == NULL) {
+        fprintf(stderr, "unknown host: %s\n", address);
+        exit(1);
+    } else {
+        memcpy(&saddr.sin_addr, hp->h_addr, hp->h_length);
+        return saddr.sin_addr.s_addr;
+    }
+
+}
+
+static void
+optProc(int argc, char *const *argv, int opt)
+{
+    switch (opt) {
+    case 'C':
+        while (*optarg) {
+            switch (*optarg++) {
+            case 'i':
+                inform = 1;
+                break;
+            default:
+                fprintf(stderr,
+                        "Unknown flag passed to -C: %c\n", optarg[-1]);
+                exit(1);
+            }
+        }
+        break;
+    }
+}
+
+int
+main(int argc, char *argv[])
+{
+    netsnmp_session session, *ss;
+    netsnmp_pdu    *pdu, *response;
+    in_addr_t      *pdu_in_addr_t;
+    oid             name[MAX_OID_LEN];
+    size_t          name_length;
+    int             arg;
+    int             status;
+    char           *trap = NULL, *specific = NULL, *description =
+        NULL, *agent = NULL;
+    char           *prognam;
+    int             exitval = 0;
+
+    prognam = strrchr(argv[0], '/');
+    if (prognam)
+        prognam++;
+    else
+        prognam = argv[0];
+
+    putenv(strdup("POSIXLY_CORRECT=1"));
+
+    if (strcmp(prognam, "snmpinform") == 0)
+        inform = 1;
+    switch (arg = snmp_parse_args(argc, argv, &session, "C:", optProc)) {
+    case -2:
+        exit(0);
+    case -1:
+        usage();
+        exit(1);
+    default:
+        break;
+    }
+
+    SOCK_STARTUP;
+
+    session.callback = snmp_input;
+    session.callback_magic = NULL;
+    netsnmp_ds_set_int(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_DEFAULT_PORT, 
+		       SNMP_TRAP_PORT);
+
+    if (session.version == SNMP_VERSION_3 && !inform) {
+        /*
+         * for traps, we use ourselves as the authoritative engine
+         * which is really stupid since command line apps don't have a
+         * notion of a persistent engine.  Hence, our boots and time
+         * values are probably always really wacked with respect to what
+         * a manager would like to see.
+         * 
+         * The following should be enough to:
+         * 
+         * 1) prevent the library from doing discovery for engineid & time.
+         * 2) use our engineid instead of the remote engineid for
+         * authoritative & privacy related operations.
+         * 3) The remote engine must be configured with users for our engineID.
+         * 
+         * -- Wes 
+         */
+
+        /*
+         * setup the engineID based on IP addr.  Need a different
+         * algorthim here.  This will cause problems with agents on the
+         * same machine sending traps. 
+         */
+        setup_engineID(NULL, NULL);
+
+        /*
+         * pick our own engineID 
+         */
+        if (session.securityEngineIDLen == 0 ||
+            session.securityEngineID == NULL) {
+            session.securityEngineID =
+                snmpv3_generate_engineID(&session.securityEngineIDLen);
+        }
+        if (session.contextEngineIDLen == 0 ||
+            session.contextEngineID == NULL) {
+            session.contextEngineID =
+                snmpv3_generate_engineID(&session.contextEngineIDLen);
+        }
+
+        /*
+         * set boots and time, which will cause problems if this
+         * machine ever reboots and a remote trap receiver has cached our
+         * boots and time...  I'll cause a not-in-time-window report to
+         * be sent back to this machine. 
+         */
+        if (session.engineBoots == 0)
+            session.engineBoots = 1;
+        if (session.engineTime == 0)    /* not really correct, */
+            session.engineTime = get_uptime();  /* but it'll work. Sort of. */
+    }
+
+    ss = snmp_open(&session);
+    if (ss == NULL) {
+        /*
+         * diagnose snmp_open errors with the input netsnmp_session pointer 
+         */
+        snmp_sess_perror("snmptrap", &session);
+        SOCK_CLEANUP;
+        exit(1);
+    }
+
+    if (session.version == SNMP_VERSION_1) {
+        if (inform) {
+            fprintf(stderr, "Cannot send INFORM as SNMPv1 PDU\n");
+            exit(1);
+        }
+        pdu = snmp_pdu_create(SNMP_MSG_TRAP);
+        pdu_in_addr_t = (in_addr_t *) pdu->agent_addr;
+        if (arg == argc) {
+            fprintf(stderr, "No enterprise oid\n");
+            usage();
+            SOCK_CLEANUP;
+            exit(1);
+        }
+        if (argv[arg][0] == 0) {
+            pdu->enterprise = (oid *) malloc(sizeof(objid_enterprise));
+            memcpy(pdu->enterprise, objid_enterprise,
+                   sizeof(objid_enterprise));
+            pdu->enterprise_length =
+                sizeof(objid_enterprise) / sizeof(oid);
+        } else {
+            name_length = MAX_OID_LEN;
+            if (!snmp_parse_oid(argv[arg], name, &name_length)) {
+                snmp_perror(argv[arg]);
+                usage();
+                SOCK_CLEANUP;
+                exit(1);
+            }
+            pdu->enterprise = (oid *) malloc(name_length * sizeof(oid));
+            memcpy(pdu->enterprise, name, name_length * sizeof(oid));
+            pdu->enterprise_length = name_length;
+        }
+        if (++arg >= argc) {
+            fprintf(stderr, "Missing agent parameter\n");
+            usage();
+            SOCK_CLEANUP;
+            exit(1);
+        }
+        agent = argv[arg];
+        if (agent != NULL && strlen(agent) != 0) {
+            *pdu_in_addr_t = parse_address(agent);
+        } else {
+            *pdu_in_addr_t = get_myaddr();
+        }
+        if (++arg == argc) {
+            fprintf(stderr, "Missing generic-trap parameter\n");
+            usage();
+            SOCK_CLEANUP;
+            exit(1);
+        }
+        trap = argv[arg];
+        pdu->trap_type = atoi(trap);
+        if (++arg == argc) {
+            fprintf(stderr, "Missing specific-trap parameter\n");
+            usage();
+            SOCK_CLEANUP;
+            exit(1);
+        }
+        specific = argv[arg];
+        pdu->specific_type = atoi(specific);
+        if (++arg == argc) {
+            fprintf(stderr, "Missing uptime parameter\n");
+            usage();
+            SOCK_CLEANUP;
+            exit(1);
+        }
+        description = argv[arg];
+        if (description == NULL || *description == 0)
+            pdu->time = get_uptime();
+        else
+            pdu->time = atol(description);
+    } else {
+        long            sysuptime;
+        char            csysuptime[20];
+
+        pdu = snmp_pdu_create(inform ? SNMP_MSG_INFORM : SNMP_MSG_TRAP2);
+        if (arg == argc) {
+            fprintf(stderr, "Missing up-time parameter\n");
+            usage();
+            SOCK_CLEANUP;
+            exit(1);
+        }
+        trap = argv[arg];
+        if (*trap == 0) {
+            sysuptime = get_uptime();
+            sprintf(csysuptime, "%ld", sysuptime);
+            trap = csysuptime;
+        }
+        snmp_add_var(pdu, objid_sysuptime,
+                     sizeof(objid_sysuptime) / sizeof(oid), 't', trap);
+        if (++arg == argc) {
+            fprintf(stderr, "Missing trap-oid parameter\n");
+            usage();
+            SOCK_CLEANUP;
+            exit(1);
+        }
+        if (snmp_add_var
+            (pdu, objid_snmptrap, sizeof(objid_snmptrap) / sizeof(oid),
+             'o', argv[arg]) != 0) {
+            snmp_perror(argv[arg]);
+            SOCK_CLEANUP;
+            exit(1);
+        }
+    }
+    arg++;
+
+    while (arg < argc) {
+        arg += 3;
+        if (arg > argc) {
+            fprintf(stderr, "%s: Missing type/value for variable\n",
+                    argv[arg - 3]);
+            SOCK_CLEANUP;
+            exit(1);
+        }
+        name_length = MAX_OID_LEN;
+        if (!snmp_parse_oid(argv[arg - 3], name, &name_length)) {
+            snmp_perror(argv[arg - 3]);
+            SOCK_CLEANUP;
+            exit(1);
+        }
+        if (snmp_add_var
+            (pdu, name, name_length, argv[arg - 2][0],
+             argv[arg - 1]) != 0) {
+            snmp_perror(argv[arg - 3]);
+            SOCK_CLEANUP;
+            exit(1);
+        }
+    }
+
+    if (inform)
+        status = snmp_synch_response(ss, pdu, &response);
+    else
+        status = snmp_send(ss, pdu) == 0;
+    if (status) {
+        snmp_sess_perror(inform ? "snmpinform" : "snmptrap", ss);
+        if (!inform)
+            snmp_free_pdu(pdu);
+        exitval = 1;
+    } else if (inform)
+        snmp_free_pdu(response);
+
+    snmp_close(ss);
+    SOCK_CLEANUP;
+    return exitval;
+}
diff -Naur tomato/release/src/router/snmp/apps/snmptrapd.c tomato121/release/src/router/snmp/apps/snmptrapd.c
--- tomato/release/src/router/snmp/apps/snmptrapd.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/apps/snmptrapd.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,1475 @@
+/*
+ * snmptrapd.c - receive and log snmp traps
+ *
+ */
+/*****************************************************************
+	Copyright 1989, 1991, 1992 by Carnegie Mellon University
+
+                      All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of CMU not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+CMU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+CMU BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+******************************************************************/
+#include <net-snmp/net-snmp-config.h>
+
+#if HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#if HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#if HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+#include <sys/types.h>
+#if HAVE_SYS_WAIT_H
+#include <sys/wait.h>
+#endif
+#if HAVE_WINSOCK_H
+#include <winsock.h>
+#else
+#include <sys/socket.h>
+#endif
+#if HAVE_SYS_SOCKIO_H
+#include <sys/sockio.h>
+#endif
+#if HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+#include <stdio.h>
+#if HAVE_SYS_TIME_H
+# include <sys/time.h>
+# if TIME_WITH_SYS_TIME
+#  include <time.h>
+# endif
+#else
+# include <time.h>
+#endif
+#if HAVE_SYS_SELECT_H
+#include <sys/select.h>
+#endif
+#if HAVE_SYS_PARAM_H
+#include <sys/param.h>
+#endif
+#if HAVE_SYSLOG_H
+#include <syslog.h>
+#endif
+#if HAVE_SYS_IOCTL_H
+#include <sys/ioctl.h>
+#endif
+#if HAVE_NET_IF_H
+#include <net/if.h>
+#endif
+#if HAVE_NETDB_H
+#include <netdb.h>
+#endif
+#if HAVE_ARPA_INET_H
+#include <arpa/inet.h>
+#endif
+#if HAVE_FCNTL_H
+#include <fcntl.h>
+#endif
+#if HAVE_PROCESS_H              /* Win32-getpid */
+#include <process.h>
+#endif
+#include <signal.h>
+#include <errno.h>
+
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include "snmptrapd_handlers.h"
+#include "snmptrapd_log.h"
+#include "notification_log.h"
+
+#if USE_LIBWRAP
+#include <tcpd.h>
+
+int             allow_severity = LOG_INFO;
+int             deny_severity = LOG_WARNING;
+#endif
+
+/*
+ * #define NETSNMP_DS_APP_DONT_LOG 9 defined in notification_log.h 
+ */
+
+#ifndef BSD4_3
+#define BSD4_2
+#endif
+
+#ifndef FD_SET
+
+typedef long    fd_mask;
+#define NFDBITS	(sizeof(fd_mask) * NBBY)        /* bits per mask */
+
+#define	FD_SET(n, p)	((p)->fds_bits[(n)/NFDBITS] |= (1 << ((n) % NFDBITS)))
+#define	FD_CLR(n, p)	((p)->fds_bits[(n)/NFDBITS] &= ~(1 << ((n) % NFDBITS)))
+#define	FD_ISSET(n, p)	((p)->fds_bits[(n)/NFDBITS] & (1 << ((n) % NFDBITS)))
+#define FD_ZERO(p)      memset((p), 0, sizeof(*(p)))
+#endif
+
+char           *logfile = 0;
+int             Print = 0;
+int             Syslog = 0;
+int             Event = 0;
+int             dropauth = 0;
+int             running = 1;
+int             reconfig = 0;
+u_long          num_received = 0;
+char            default_port[] = "udp:162";
+
+const char     *trap1_std_str = "%.4y-%.2m-%.2l %.2h:%.2j:%.2k %B [%b] (via %A [%a]): %N\n\t%W Trap (%q) Uptime: %#T\n%v\n";
+const char     *trap2_std_str = "%.4y-%.2m-%.2l %.2h:%.2j:%.2k %B [%b]:\n%v\n";
+
+/* how to format logging to stderr */
+char           *trap1_fmt_str = NULL, *trap2_fmt_str = NULL;
+
+/*
+ * These definitions handle 4.2 systems without additional syslog facilities.
+ */
+#ifndef LOG_CONS
+#define LOG_CONS	0       /* Don't bother if not defined... */
+#endif
+#ifndef LOG_PID
+#define LOG_PID		0       /* Don't bother if not defined... */
+#endif
+#ifndef LOG_LOCAL0
+#define LOG_LOCAL0	0
+#endif
+#ifndef LOG_LOCAL1
+#define LOG_LOCAL1	0
+#endif
+#ifndef LOG_LOCAL2
+#define LOG_LOCAL2	0
+#endif
+#ifndef LOG_LOCAL3
+#define LOG_LOCAL3	0
+#endif
+#ifndef LOG_LOCAL4
+#define LOG_LOCAL4	0
+#endif
+#ifndef LOG_LOCAL5
+#define LOG_LOCAL5	0
+#endif
+#ifndef LOG_LOCAL6
+#define LOG_LOCAL6	0
+#endif
+#ifndef LOG_LOCAL7
+#define LOG_LOCAL7	0
+#endif
+#ifndef LOG_DAEMON
+#define LOG_DAEMON	0
+#endif
+
+/*
+ * Include an extra Facility variable to allow command line adjustment of
+ * syslog destination 
+ */
+int Facility = LOG_DAEMON;
+
+struct timeval  Now;
+
+void            trapd_update_config(void);
+
+const char *
+trap_description(int trap)
+{
+    switch (trap) {
+    case SNMP_TRAP_COLDSTART:
+        return "Cold Start";
+    case SNMP_TRAP_WARMSTART:
+        return "Warm Start";
+    case SNMP_TRAP_LINKDOWN:
+        return "Link Down";
+    case SNMP_TRAP_LINKUP:
+        return "Link Up";
+    case SNMP_TRAP_AUTHFAIL:
+        return "Authentication Failure";
+    case SNMP_TRAP_EGPNEIGHBORLOSS:
+        return "EGP Neighbor Loss";
+    case SNMP_TRAP_ENTERPRISESPECIFIC:
+        return "Enterprise Specific";
+    default:
+        return "Unknown Type";
+    }
+}
+
+
+netsnmp_pdu *
+snmp_clone_pdu2(netsnmp_pdu *pdu, int command)
+{
+    netsnmp_pdu *newpdu = snmp_clone_pdu(pdu);
+    if (newpdu) {
+        newpdu->command = command;
+    }
+    return newpdu;
+}
+
+static oid      risingAlarm[] = { 1, 3, 6, 1, 6, 3, 2, 1, 1, 3, 1 };
+static oid      fallingAlarm[] = { 1, 3, 6, 1, 6, 3, 2, 1, 1, 3, 2 };
+static oid      unavailableAlarm[] = { 1, 3, 6, 1, 6, 3, 2, 1, 1, 3, 3 };
+
+void
+event_input(netsnmp_variable_list * vp)
+{
+    int             eventid = 0;
+    oid             variable[MAX_OID_LEN];
+    int             variablelen = 0;
+    u_long          destip = 0;
+    int             sampletype = 0;
+    int             value = 0;
+    int             threshold = 0;
+    int             i;
+    int             nvars = 0;
+
+    netsnmp_variable_list	*vp2 = vp;
+    
+    oid            *op = NULL;
+
+    /* Make sure there are 5 variables.  Otherwise, don't bother */
+    for (i=1; i <= 5; i++) {
+      vp2 = vp2->next_variable;
+      if (!vp2) {
+	nvars = -1;
+	break;
+      }
+    }
+    
+    if (nvars != -1)
+    {
+      vp = vp->next_variable;     /* skip sysUptime */
+      if (vp->val_len != sizeof(risingAlarm) ||
+	  !memcmp(vp->val.objid, risingAlarm, sizeof(risingAlarm)))
+	eventid = 1;
+      else if (vp->val_len != sizeof(risingAlarm) ||
+	  !memcmp(vp->val.objid, fallingAlarm, sizeof(fallingAlarm)))
+	eventid = 2;
+      else if (vp->val_len != sizeof(risingAlarm) ||
+	  !memcmp(vp->val.objid, unavailableAlarm, sizeof(unavailableAlarm)))
+	eventid = 3;
+      else {
+	fprintf(stderr, "unknown event\n");
+	eventid = 0;
+      }
+      
+      vp = vp->next_variable;
+      memmove(variable, vp->val.objid, vp->val_len * sizeof(oid));
+      variablelen = vp->val_len;
+      op = vp->name + 22;
+      destip = 0;
+      destip |= (*op++) << 24;
+      destip |= (*op++) << 16;
+      destip |= (*op++) << 8;
+      destip |= *op++;
+      
+      vp = vp->next_variable;
+      sampletype = *vp->val.integer;
+      
+      vp = vp->next_variable;
+      value = *vp->val.integer;
+      
+      vp = vp->next_variable;
+      threshold = *vp->val.integer;
+    }
+    printf("%d: 0x%02lX %d %d %d\n", eventid, destip, sampletype, value,
+	threshold);
+}
+
+void
+send_handler_data(FILE * file, struct hostent *host,
+                  netsnmp_pdu *pdu, netsnmp_transport *transport)
+{
+    netsnmp_variable_list tmpvar, *vars;
+    static oid      trapoids[] = { 1, 3, 6, 1, 6, 3, 1, 1, 5, 0 };
+    static oid      snmpsysuptime[] = { 1, 3, 6, 1, 2, 1, 1, 3, 0 };
+    static oid      snmptrapoid[] = { 1, 3, 6, 1, 6, 3, 1, 1, 4, 1, 0 };
+    static oid      snmptrapent[] = { 1, 3, 6, 1, 6, 3, 1, 1, 4, 3, 0 };
+    static oid      snmptrapaddr[] = { 1, 3, 6, 1, 6, 3, 18, 1, 3, 0 };
+    static oid      snmptrapcom[] = { 1, 3, 6, 1, 6, 3, 18, 1, 4, 0 };
+    oid             enttrapoid[MAX_OID_LEN];
+    int             enttraplen = pdu->enterprise_length;
+    char           *tstr = NULL;
+
+    if (transport != NULL && transport->f_fmtaddr != NULL) {
+        tstr = transport->f_fmtaddr(transport, pdu->transport_data,
+                                    pdu->transport_data_length);
+        fprintf(file, "%s\n%s\n", host ? host->h_name : tstr, tstr);
+        free(tstr);
+    } else {
+        fprintf(file, "%s\n<UNKNOWN>\n", host ? host->h_name : "<UNKNOWN>");
+    }
+    if (pdu->command == SNMP_MSG_TRAP) {
+        /*
+         * convert a v1 trap to a v2 variable binding list:
+         * The uptime and trapOID go first in the list. 
+         */
+        tmpvar.val.integer = (long *) &pdu->time;
+        tmpvar.val_len = sizeof(pdu->time);
+        tmpvar.type = ASN_TIMETICKS;
+        fprint_variable(file, snmpsysuptime,
+                        sizeof(snmpsysuptime) / sizeof(oid), &tmpvar);
+        tmpvar.type = ASN_OBJECT_ID;
+        if (pdu->trap_type == SNMP_TRAP_ENTERPRISESPECIFIC) {
+            memcpy(enttrapoid, pdu->enterprise, sizeof(oid) * enttraplen);
+            if (enttrapoid[enttraplen - 1] != 0)
+                enttrapoid[enttraplen++] = 0;
+            enttrapoid[enttraplen++] = pdu->specific_type;
+            tmpvar.val.objid = enttrapoid;
+            tmpvar.val_len = enttraplen * sizeof(oid);
+        } else {
+            trapoids[9] = pdu->trap_type + 1;
+            tmpvar.val.objid = trapoids;
+            tmpvar.val_len = 10 * sizeof(oid);
+        }
+        fprint_variable(file, snmptrapoid,
+                        sizeof(snmptrapoid) / sizeof(oid), &tmpvar);
+    }
+    /*
+     * do the variables in the pdu 
+     */
+    for (vars = pdu->variables; vars; vars = vars->next_variable) {
+        fprint_variable(file, vars->name, vars->name_length, vars);
+    }
+    if (pdu->command == SNMP_MSG_TRAP) {
+        /*
+         * convert a v1 trap to a v2 variable binding list:
+         * The enterprise goes last. 
+         */
+        tmpvar.val.string = pdu->agent_addr;
+        tmpvar.val_len = 4;
+        tmpvar.type = ASN_IPADDRESS;
+        fprint_variable(file, snmptrapaddr,
+                        sizeof(snmptrapaddr) / sizeof(oid), &tmpvar);
+        tmpvar.val.string = pdu->community;
+        tmpvar.val_len = pdu->community_len;
+        tmpvar.type = ASN_OCTET_STR;
+        fprint_variable(file, snmptrapcom,
+                        sizeof(snmptrapcom) / sizeof(oid), &tmpvar);
+        tmpvar.val.objid = pdu->enterprise;
+        tmpvar.val_len = pdu->enterprise_length * sizeof(oid);
+        tmpvar.type = ASN_OBJECT_ID;
+        fprint_variable(file, snmptrapent,
+                        sizeof(snmptrapent) / sizeof(oid), &tmpvar);
+    }
+}
+
+void
+do_external(char *cmd, struct hostent *host,
+            netsnmp_pdu *pdu, netsnmp_transport *transport)
+{
+    FILE           *file;
+    int             oldquick, result;
+
+    DEBUGMSGTL(("snmptrapd", "Running: %s\n", cmd));
+    oldquick = snmp_get_quick_print();
+    snmp_set_quick_print(1);
+    if (cmd) {
+#ifndef WIN32
+        int             fd[2];
+        int             pid;
+
+        if (pipe(fd)) {
+            snmp_log_perror("pipe");
+        }
+        if ((pid = fork()) == 0) {
+            /*
+             * child 
+             */
+            close(0);
+            if (dup(fd[0]) != 0) {
+                snmp_log_perror("dup");
+            }
+            close(fd[1]);
+            close(fd[0]);
+            system(cmd);
+            exit(0);
+        } else if (pid > 0) {
+            file = fdopen(fd[1], "w");
+            send_handler_data(file, host, pdu, transport);
+            fclose(file);
+            close(fd[0]);
+            close(fd[1]);
+            if (waitpid(pid, &result, 0) < 0) {
+                snmp_log_perror("waitpid");
+            }
+        } else {
+            snmp_log_perror("fork");
+        }
+#else
+        char            command_buf[128];
+        char            file_buf[L_tmpnam];
+
+        tmpnam(file_buf);
+        file = fopen(file_buf, "w");
+        if (!file) {
+            fprintf(stderr, "fopen: %s: %s\n", file_buf, strerror(errno));
+        } else {
+            send_handler_data(file, host, pdu, transport);
+            fclose(file);
+            snprintf(command_buf, sizeof(command_buf),
+                     "%s < %s", cmd, file_buf);
+            command_buf[ sizeof(command_buf)-1 ] = 0;
+            result = system(command_buf);
+            if (result == -1)
+                fprintf(stderr, "system: %s: %s\n", command_buf,
+                        strerror(errno));
+            else if (result)
+                fprintf(stderr, "system: %s: %d\n", command_buf, result);
+            remove(file_buf);
+        }
+#endif                          /* WIN32 */
+    }
+    snmp_set_quick_print(oldquick);
+}
+
+int
+snmp_input(int op,
+           netsnmp_session * session,
+           int reqid, netsnmp_pdu *pdu, void *magic)
+{
+    netsnmp_variable_list *vars = NULL;
+    netsnmp_transport *transport = (netsnmp_transport *) magic;
+    char            buf[64], *cp;
+    netsnmp_pdu    *reply;
+    struct hostent *host = NULL;
+    static oid      trapoids[10] = { 1, 3, 6, 1, 6, 3, 1, 1, 5 };
+    static oid      snmptrapoid2[11] = { 1, 3, 6, 1, 6, 3, 1, 1, 4, 1, 0 };
+    netsnmp_variable_list tmpvar;
+    char           *Command = NULL, *tstr = NULL;
+    u_char         *rbuf = NULL;
+    size_t          r_len = 64, o_len = 0;
+    int             trunc = 0;
+
+    tmpvar.type = ASN_OBJECT_ID;
+
+    if (op == NETSNMP_CALLBACK_OP_RECEIVED_MESSAGE) {
+        if ((rbuf = (u_char *) calloc(r_len, 1)) == NULL) {
+            snmp_log(LOG_ERR, "couldn't display trap -- malloc failed\n");
+            return 1;
+        }
+
+        if (pdu->command == SNMP_MSG_TRAP) {
+            oid trapOid[MAX_OID_LEN + 2] = { 0 };
+            int trapOidLen = pdu->enterprise_length;
+
+            num_received++;
+
+            if (!netsnmp_ds_get_boolean(NETSNMP_DS_APPLICATION_ID, 
+					NETSNMP_DS_APP_NUMERIC_IP)) {
+                host = gethostbyaddr((char *) pdu->agent_addr, 4, AF_INET);
+            }
+
+            if (pdu->trap_type == SNMP_TRAP_ENTERPRISESPECIFIC) {
+                memcpy(trapOid, pdu->enterprise, sizeof(oid) * trapOidLen);
+                if (trapOid[trapOidLen - 1] != 0) {
+                    trapOid[trapOidLen++] = 0;
+                }
+                trapOid[trapOidLen++] = pdu->specific_type;
+            }
+
+            if (Print && (pdu->trap_type != SNMP_TRAP_AUTHFAIL ||
+			  dropauth == 0)) {
+                if ((trap1_fmt_str == NULL) || (trap1_fmt_str[0] == '\0')) {
+                    trunc = !realloc_format_plain_trap(&rbuf, &r_len, &o_len,
+						       1, pdu, transport);
+                } else {
+                    trunc = !realloc_format_trap(&rbuf, &r_len, &o_len, 1,
+                                                 trap1_fmt_str, pdu,
+                                                 transport);
+                }
+                snmp_log(LOG_INFO, "%s%s", rbuf, (trunc?" [TRUNCATED]\n":""));
+            }
+
+            if (Syslog && (pdu->trap_type != SNMP_TRAP_AUTHFAIL ||
+			   dropauth == 0)) {
+                memset(rbuf, 0, o_len);
+                o_len = 0;
+                rbuf[o_len++] = ',';
+                rbuf[o_len++] = ' ';
+
+                for (vars = pdu->variables; vars;
+                     vars = vars->next_variable) {
+                    trunc = !sprint_realloc_variable(&rbuf, &r_len, &o_len, 1,
+						     vars->name,
+						     vars->name_length, vars);
+                    if (!trunc) {
+                        /*
+                         * Add a trailing , ...  
+                         */
+                        trunc = !snmp_strcat(&rbuf, &r_len, &o_len, 1, ", ");
+                    }
+                    if (trunc) {
+                        break;
+                    }
+                }
+
+                if (o_len > 0 && !trunc) {
+                    o_len -= 2;
+                    rbuf[o_len] = '\0';
+                }
+
+                if (pdu->trap_type == SNMP_TRAP_ENTERPRISESPECIFIC) {
+                    u_char *oidbuf = NULL;
+                    size_t ob_len = 64, oo_len = 0;
+                    int otrunc = 0;
+
+                    if ((oidbuf = (u_char *) calloc(ob_len, 1)) == NULL) {
+                        snmp_log(LOG_ERR,
+                                 "couldn't display trap -- malloc failed\n");
+                        free(rbuf);
+                        return 1;
+                    }
+
+                    otrunc = !sprint_realloc_objid(&oidbuf, &ob_len, &oo_len,
+						   1, trapOid, trapOidLen);
+                    if (!otrunc) {
+                        cp = strrchr((char *) oidbuf, '.');
+                        if (cp != NULL) {
+                            cp++;
+                        } else {
+                            cp = (char *) oidbuf;
+                        }
+                    } else {
+                        cp = (char *) oidbuf;
+                    }
+                    snmp_log(LOG_WARNING, "%s: %s Trap (%s%s) Uptime: %s%s%s",
+                             inet_ntoa(*((struct in_addr *) pdu-> agent_addr)),
+                             trap_description(pdu->trap_type), cp,
+                             (otrunc ? " [TRUNCATED]" : ""),
+                             uptime_string(pdu->time, buf), rbuf,
+                             (trunc ? " [TRUNCATED]\n" : ""));
+                    free(oidbuf);
+                } else {
+                    snmp_log(LOG_WARNING, "%s: %s Trap (%ld) Uptime: %s%s%s",
+                             inet_ntoa(*((struct in_addr *) pdu->agent_addr)),
+                             trap_description(pdu->trap_type),
+                             pdu->specific_type, 
+			     uptime_string(pdu->time, buf), rbuf,
+                             (trunc ? " [TRUNCATED]\n" : ""));
+                }
+            }
+            if (pdu->trap_type == SNMP_TRAP_ENTERPRISESPECIFIC) {
+                Command = snmptrapd_get_traphandler(trapOid, trapOidLen);
+            } else {
+                trapoids[9] = pdu->trap_type + 1;
+                Command = snmptrapd_get_traphandler(trapoids, 10);
+            }
+            if (Command) {
+                do_external(Command, host, pdu, transport);
+            }
+            log_notification(host, pdu, transport);
+        } else if (pdu->command == SNMP_MSG_TRAP2 ||
+                   pdu->command == SNMP_MSG_INFORM) {
+            num_received++;
+            if (!netsnmp_ds_get_boolean(NETSNMP_DS_APPLICATION_ID, 
+					NETSNMP_DS_APP_NUMERIC_IP)) {
+                /*
+                 * Right, apparently a name lookup is wanted.  This is only
+                 * reasonable for the UDP and TCP transport domains (we
+                 * don't want to try to be too clever here).  
+                 */
+#ifdef SNMP_TRANSPORT_TCP_DOMAIN
+                if (transport != NULL
+                    && (transport->domain == netsnmpUDPDomain
+                        || transport->domain == netsnmp_snmpTCPDomain)) {
+#else
+                if (transport != NULL
+                    && transport->domain == netsnmpUDPDomain) {
+#endif
+                    /*
+                     * This is kind of bletcherous -- it breaks the opacity of
+                     * transport_data but never mind -- the alternative is a
+                     * lot of munging strings from f_fmtaddr.
+                     */
+                    struct sockaddr_in *addr =
+                        (struct sockaddr_in *) pdu->transport_data;
+                    if (addr != NULL && 
+		    pdu->transport_data_length == sizeof(struct sockaddr_in)) {
+                        host = gethostbyaddr((char *) &(addr->sin_addr),
+					     sizeof(struct in_addr), AF_INET);
+                    }
+                }
+            }
+
+            if (Print) {
+                if (trap2_fmt_str == NULL || trap2_fmt_str[0] == '\0') {
+                    trunc = !realloc_format_trap(&rbuf, &r_len, &o_len, 1,
+                                                 trap2_std_str, pdu,
+                                                 transport);
+                } else {
+                    trunc = !realloc_format_trap(&rbuf, &r_len, &o_len, 1,
+                                                 trap2_fmt_str, pdu,
+                                                 transport);
+                }
+                snmp_log(LOG_INFO, "%s%s", rbuf, (trunc?" [TRUNCATED]":""));
+            }
+
+            if (Syslog) {
+                memset(rbuf, 0, o_len);
+                o_len = 0;
+                for (vars = pdu->variables; vars;
+                     vars = vars->next_variable) {
+                    trunc =  !sprint_realloc_variable(&rbuf, &r_len, &o_len, 1,
+						      vars->name,
+						      vars->name_length, vars);
+                    if (!trunc) {
+                        trunc = !snmp_strcat(&rbuf, &r_len, &o_len, 1, ", ");
+                    }
+                    if (trunc) {
+                        break;
+                    }
+                }
+
+                if (o_len > 0 && !trunc) {
+                    o_len -= 2;
+                    rbuf[o_len] = '\0';
+                }
+
+                if (!netsnmp_ds_get_boolean(NETSNMP_DS_APPLICATION_ID, 
+					    NETSNMP_DS_APP_NUMERIC_IP)) {
+                    /*
+                     * Right, apparently a name lookup is wanted.  This is only
+                     * reasonable for the UDP and TCP transport domains (we
+                     * don't want to try to be too clever here).  
+                     */
+#ifdef SNMP_TRANSPORT_TCP_DOMAIN
+                    if (transport != NULL
+                        && (transport->domain == netsnmpUDPDomain
+                            || transport->domain ==
+                            netsnmp_snmpTCPDomain)) {
+#else
+                    if (transport != NULL
+                        && transport->domain == netsnmpUDPDomain) {
+#endif
+                        /*
+                         * This is kind of bletcherous -- it breaks the
+                         * opacity of transport_data but never mind -- the
+                         * alternative is a lot of munging strings from
+                         * f_fmtaddr.
+                         */
+                        struct sockaddr_in *addr =
+                            (struct sockaddr_in *) pdu->transport_data;
+                        if (addr != NULL && pdu->transport_data_length ==
+                            sizeof(struct sockaddr_in)) {
+                            host = gethostbyaddr((char *)&(addr->sin_addr),
+					      sizeof(struct in_addr), AF_INET);
+                        }
+                    }
+                }
+
+                if (transport != NULL && transport->f_fmtaddr != NULL) {
+                    tstr = transport->f_fmtaddr(transport,
+                                             pdu->transport_data,
+                                             pdu->transport_data_length);
+                    snmp_log(LOG_WARNING, "%s [%s]: Trap %s%s\n",
+                             host ? host->h_name : tstr, tstr, rbuf,
+                             (trunc ? "[TRUNCATED]" : ""));
+                    free(tstr);
+                } else {
+                    snmp_log(LOG_WARNING, "<UNKNOWN>: Trap %s%s", rbuf,
+                             (trunc ? "[TRUNCATED]\n" : ""));
+                }
+            }
+
+            if (Event) {
+                event_input(pdu->variables);
+            }
+
+            for (vars = pdu->variables; (vars != NULL) &&
+                 snmp_oid_compare(vars->name, vars->name_length,
+                                  snmptrapoid2, 
+				  sizeof(snmptrapoid2)/sizeof(oid));
+                 vars = vars->next_variable);
+
+            if (vars && vars->type == ASN_OBJECT_ID) {
+                Command = snmptrapd_get_traphandler(vars->val.objid,
+                                                    vars->val_len/sizeof(oid));
+                if (Command) {
+                    do_external(Command, host, pdu, transport);
+                }
+            }
+
+            log_notification(host, pdu, transport);
+
+            if (pdu->command == SNMP_MSG_INFORM) {
+                if ((reply = snmp_clone_pdu2(pdu, SNMP_MSG_RESPONSE)) == NULL){
+                    snmp_log(LOG_ERR,
+			     "couldn't clone PDU for INFORM response\n");
+                } else {
+                    reply->errstat = 0;
+                    reply->errindex = 0;
+                    if (!snmp_send(session, reply)) {
+                        snmp_sess_perror("snmptrapd: Couldn't respond to inform pdu",
+					 session);
+                        snmp_free_pdu(reply);
+                    }
+                }
+            }
+        }
+
+        if (rbuf != NULL) {
+            free(rbuf);
+        }
+    } else if (op == NETSNMP_CALLBACK_OP_TIMED_OUT) {
+        fprintf(stderr, "Timeout: This shouldn't happen!\n");
+    }
+    return 1;
+}
+
+
+static void
+parse_trap1_fmt(const char *token, char *line)
+{
+    trap1_fmt_str = strdup(line);
+}
+
+
+static void
+free_trap1_fmt(void)
+{
+    if (trap1_fmt_str && trap1_fmt_str != trap1_std_str)
+        free((char *) trap1_fmt_str);
+    trap1_fmt_str = NULL;
+}
+
+
+static void
+parse_trap2_fmt(const char *token, char *line)
+{
+    trap2_fmt_str = strdup(line);
+}
+
+
+static void
+free_trap2_fmt(void)
+{
+    if (trap2_fmt_str && trap2_fmt_str != trap2_std_str)
+        free((char *) trap2_fmt_str);
+    trap2_fmt_str = NULL;
+}
+
+
+void
+usage(void)
+{
+    fprintf(stderr, "Usage: snmptrapd [OPTIONS] [LISTENING ADDRESSES]\n");
+    fprintf(stderr, "\n\tNET-SNMP Version:  %s\n", netsnmp_get_version());
+    fprintf(stderr, "\tWeb:      http://www.net-snmp.org/\n");
+    fprintf(stderr, "\tEmail:    net-snmp-coders@lists.sourceforge.net\n");
+    fprintf(stderr, "\n");
+    fprintf(stderr, "  -a\t\t\tignore authentication failture traps\n");
+    fprintf(stderr, "  -c FILE\t\tread FILE as a configuration file\n");
+    fprintf(stderr,
+            "  -C\t\t\tdo not read the default configuration files\n");
+    fprintf(stderr, "  -d\t\t\tdump sent and received SNMP packets\n");
+    fprintf(stderr, "  -D\t\t\tturn on debugging output\n");
+    fprintf(stderr,
+            "  -e\t\t\tprint event # (rising/falling alarm, etc.)\n");
+    fprintf(stderr, "  -f\t\t\tdo not fork from the shell\n");
+    fprintf(stderr,
+            "  -F FORMAT\t\tuse specified format for logging to standard error\n");
+    fprintf(stderr, "  -h, --help\t\tdisplay this usage message\n");
+    fprintf(stderr,
+            "  -H\t\t\tdisplay configuration file directives understood\n");
+    fprintf(stderr,
+            "  -m MIBLIST\t\tuse MIBLIST instead of the default MIB list\n");
+    fprintf(stderr,
+            "  -M DIRLIST\t\tuse DIRLIST as the list of locations\n\t\t\t  to look for MIBs\n");
+    fprintf(stderr,
+            "  -n\t\t\tuse numeric addresses instead of attempting\n\t\t\t  hostname lookups (no DNS)\n");
+    fprintf(stderr, "  -o FILE\t\toutput to FILE\n");
+    fprintf(stderr, "  -P\t\t\tprint to standard error\n");
+    fprintf(stderr, "  -s\t\t\tlog to syslog\n");
+    fprintf(stderr,
+            "  -S d|i|0-7\t\tset syslog facility to LOG_DAEMON (d), LOG_INFO (i)\n\t\t\t  or LOG_LOCAL[0-7] (default LOG_DAEMON)\n");
+#if HAVE_GETPID
+    fprintf(stderr, "  -u FILE\t\tstore process id in FILE\n");
+#endif
+    fprintf(stderr, "  -v, --version\t\tdisplay version information\n");
+    fprintf(stderr,
+            "  -O <OUTOPTS>\t\ttoggle options controlling output display\n");
+    snmp_out_toggle_options_usage("\t\t\t", stderr);
+}
+
+static void
+version(void)
+{
+    printf("\nNET-SNMP Version:  %s\n", netsnmp_get_version());
+    printf("Web:               http://www.net-snmp.org/\n");
+    printf("Email:             net-snmp-coders@lists.sourceforge.net\n\n");
+    exit(0);
+}
+
+RETSIGTYPE
+term_handler(int sig)
+{
+    running = 0;
+}
+
+#ifdef SIGHUP
+RETSIGTYPE
+hup_handler(int sig)
+{
+    reconfig = 1;
+    signal(SIGHUP, hup_handler);
+}
+#endif
+
+static int
+pre_parse(netsnmp_session * session, netsnmp_transport *transport,
+          void *transport_data, int transport_data_length)
+{
+#if USE_LIBWRAP
+    char *addr_string = NULL;
+
+    if (transport != NULL && transport->f_fmtaddr != NULL) {
+        /*
+         * Okay I do know how to format this address for logging.  
+         */
+        addr_string = transport->f_fmtaddr(transport, transport_data,
+                                           transport_data_length);
+        /*
+         * Don't forget to free() it.  
+         */
+    }
+
+    if (addr_string != NULL) {
+        if (hosts_ctl("snmptrapd", STRING_UNKNOWN, 
+		      addr_string, STRING_UNKNOWN) == 0) {
+            free(addr_string);
+            return 0;
+        }
+        free(addr_string);
+    } else {
+        if (hosts_ctl("snmptrapd", STRING_UNKNOWN,
+                      STRING_UNKNOWN, STRING_UNKNOWN) == 0) {
+            return 0;
+        }
+    }
+#endif/*  USE_LIBWRAP  */
+    return 1;
+}
+
+static netsnmp_session *
+snmptrapd_add_session(netsnmp_transport *t)
+{
+    netsnmp_session sess, *session = &sess, *rc = NULL;
+
+    snmp_sess_init(session);
+    session->peername = SNMP_DEFAULT_PEERNAME;  /* Original code had NULL here */
+    session->version = SNMP_DEFAULT_VERSION;
+    session->community_len = SNMP_DEFAULT_COMMUNITY_LEN;
+    session->retries = SNMP_DEFAULT_RETRIES;
+    session->timeout = SNMP_DEFAULT_TIMEOUT;
+    session->callback = snmp_input;
+    session->callback_magic = (void *) t;
+    session->authenticator = NULL;
+    sess.isAuthoritative = SNMP_SESS_UNKNOWNAUTH;
+
+    rc = snmp_add(session, t, pre_parse, NULL);
+    if (rc == NULL) {
+        snmp_sess_perror("snmptrapd", session);
+    }
+    return rc;
+}
+
+static void
+snmptrapd_close_sessions(netsnmp_session * sess_list)
+{
+    netsnmp_session *s = NULL, *next = NULL;
+
+    for (s = sess_list; s != NULL; s = next) {
+        next = s->next;
+        snmp_close(s);
+    }
+}
+
+int
+main(int argc, char *argv[])
+{
+    char            options[128] = "ac:CdD::efF:hHl:m:M:no:PqsS:vO:-:";
+    netsnmp_session *sess_list = NULL, *ss = NULL;
+    netsnmp_transport *transport = NULL;
+    int             arg, i = 0;
+    int             count, numfds, block;
+    fd_set          fdset;
+    struct timeval  timeout, *tvp;
+    int             dofork = 1;
+    char           *cp, *listen_ports = NULL;
+    char           *trap1_fmt_str_remember = NULL;
+    int             agentx_subagent = 1, depmsg = 0;
+#if HAVE_GETPID
+    FILE           *PID;
+    char           *pid_file = NULL;
+#endif
+
+    /*
+     * register our configuration handlers now so -H properly displays them 
+     */
+    register_config_handler("snmptrapd", "traphandle",
+                            snmptrapd_traphandle, NULL,
+                            "oid|\"default\" program [args ...] ");
+    register_config_handler("snmptrapd", "createUser",
+                            usm_parse_create_usmUser, NULL,
+                           "username (MD5|SHA) passphrase [DES [passphrase]]");
+    register_config_handler("snmptrapd", "usmUser",
+                            usm_parse_config_usmUser, NULL, NULL);
+    register_config_handler("snmptrapd", "format1",
+                            parse_trap1_fmt, free_trap1_fmt, "format");
+    register_config_handler("snmptrapd", "format2",
+                            parse_trap2_fmt, free_trap2_fmt, "format");
+
+    /*
+     * we need to be called back later 
+     */
+    snmp_register_callback(SNMP_CALLBACK_LIBRARY, SNMP_CALLBACK_STORE_DATA,
+                           usm_store_users, NULL);
+
+#ifdef WIN32
+    setvbuf(stdout, NULL, _IONBF, BUFSIZ);
+#else
+    setvbuf(stdout, NULL, _IOLBF, BUFSIZ);
+#endif
+
+    /*
+     * Add some options if they are available.  
+     */
+#if HAVE_GETPID
+    strcat(options, "u:");
+#endif
+
+    /*
+     * Now process options normally.  
+     */
+
+    while ((arg = getopt(argc, argv, options)) != EOF) {
+        switch (arg) {
+        case '-':
+            if (strcasecmp(optarg, "help") == 0) {
+                usage();
+                exit(0);
+            }
+            if (strcasecmp(optarg, "version") == 0) {
+                version();
+                exit(0);
+            }
+
+            handle_long_opt(optarg);
+            break;
+
+        case 'a':
+            dropauth = 1;
+            break;
+
+        case 'c':
+            if (optarg != NULL) {
+                netsnmp_ds_set_string(NETSNMP_DS_LIBRARY_ID, 
+				      NETSNMP_DS_LIB_OPTIONALCONFIG, optarg);
+            } else {
+                usage();
+                exit(1);
+            }
+            break;
+
+        case 'C':
+            netsnmp_ds_set_boolean(NETSNMP_DS_LIBRARY_ID, 
+				   NETSNMP_DS_LIB_DONT_READ_CONFIGS, 1);
+            break;
+
+        case 'd':
+            snmp_set_dump_packet(1);
+            break;
+
+        case 'D':
+            debug_register_tokens(optarg);
+            snmp_set_do_debugging(1);
+            break;
+
+        case 'e':
+            Event++;
+            break;
+
+        case 'f':
+            dofork = 0;
+            break;
+
+        case 'F':
+            if (optarg != NULL) {
+                trap1_fmt_str_remember = optarg;
+            } else {
+                usage();
+                exit(1);
+            }
+            break;
+
+        case 'h':
+            usage();
+            exit(0);
+
+        case 'H':
+            init_notification_log();
+            init_snmp("snmptrapd");
+            fprintf(stderr, "Configuration directives understood:\n");
+            read_config_print_usage("  ");
+            exit(0);
+
+        case 'l':
+	    fprintf(stderr,
+		    "Warning: -l option is deprecated; use -S instead\n");
+	    depmsg = 1;
+	case 'S':
+            if (optarg != NULL) {
+                switch (*optarg) {
+                case 'd':
+                case 'D':
+                    Facility = LOG_DAEMON;
+                    break;
+                case 'i':
+                case 'I':
+                    Facility = LOG_INFO;
+                    break;
+                case '0':
+                    Facility = LOG_LOCAL0;
+                    break;
+                case '1':
+                    Facility = LOG_LOCAL1;
+                    break;
+                case '2':
+                    Facility = LOG_LOCAL2;
+                    break;
+                case '3':
+                    Facility = LOG_LOCAL3;
+                    break;
+                case '4':
+                    Facility = LOG_LOCAL4;
+                    break;
+                case '5':
+                    Facility = LOG_LOCAL5;
+                    break;
+                case '6':
+                    Facility = LOG_LOCAL6;
+                    break;
+                case '7':
+                    Facility = LOG_LOCAL7;
+                    break;
+                default:
+                    fprintf(stderr, "invalid syslog facility: -S%c\n",*optarg);
+                    usage();
+                    exit(1);
+                }
+            } else {
+                fprintf(stderr, "no syslog facility specified\n");
+                usage();
+                exit(1);
+            }
+            break;
+
+        case 'm':
+            if (optarg != NULL) {
+                setenv("MIBS", optarg, 1);
+            } else {
+                usage();
+                exit(1);
+            }
+            break;
+
+        case 'M':
+            if (optarg != NULL) {
+                setenv("MIBDIRS", optarg, 1);
+            } else {
+                usage();
+                exit(1);
+            }
+            break;
+
+        case 'n':
+            netsnmp_ds_set_boolean(NETSNMP_DS_APPLICATION_ID, 
+				   NETSNMP_DS_APP_NUMERIC_IP, 1);
+            break;
+
+        case 'o':
+            Print++;
+            if (optarg != NULL) {
+                logfile = optarg;
+                snmp_enable_filelog(optarg, 0);
+            } else {
+                usage();
+                exit(1);
+            }
+            break;
+
+        case 'O':
+            cp = snmp_out_toggle_options(optarg);
+            if (cp != NULL) {
+                fprintf(stderr, "Unknown output option passed to -O: %c\n",
+			*cp);
+                usage();
+                exit(1);
+            }
+            break;
+        case 'P':
+            dofork = 0;
+            snmp_enable_stderrlog();
+            Print++;
+            break;
+
+        case 's':
+            Syslog++;
+            break;
+
+#if HAVE_GETPID
+        case 'u':
+            if (optarg != NULL) {
+                pid_file = optarg;
+            } else {
+                usage();
+                exit(1);
+            }
+            break;
+#endif
+            break;
+
+        case 'v':
+            version();
+            exit(0);
+            break;
+
+        default:
+            fprintf(stderr, "invalid option: -%c\n", arg);
+            usage();
+            exit(1);
+            break;
+        }
+    }
+
+    if (optind < argc) {
+        /*
+         * There are optional transport addresses on the command line.  
+         */
+        for (i = optind; i < argc; i++) {
+            char *astring;
+            if (listen_ports != NULL) {
+                astring = malloc(strlen(listen_ports) + 2 + strlen(argv[i]));
+                if (astring == NULL) {
+                    fprintf(stderr, "malloc failure processing argv[%d]\n", i);
+                    exit(1);
+                }
+                sprintf(astring, "%s,%s", listen_ports, argv[i]);
+                free(listen_ports);
+                listen_ports = astring;
+            } else {
+                listen_ports = strdup(argv[i]);
+                if (listen_ports == NULL) {
+                    fprintf(stderr, "malloc failure processing argv[%d]\n", i);
+                    exit(1);
+                }
+            }
+        }
+    } else {
+        listen_ports = default_port;
+    }
+
+    if (!Print) {
+        Syslog = 1;
+    }
+#ifdef USING_AGENTX_SUBAGENT_MODULE
+    /*
+     * we're an agentx subagent? 
+     */
+    if (agentx_subagent) {
+        /*
+         * make us a agentx client. 
+         */
+        netsnmp_ds_set_boolean(NETSNMP_DS_APPLICATION_ID,
+			       NETSNMP_DS_AGENT_ROLE, 1);
+    }
+#endif
+
+    /*
+     * don't fail if we can't do agentx (ie, socket not there, or not root) 
+     */
+    netsnmp_ds_toggle_boolean(NETSNMP_DS_APPLICATION_ID, 
+			      NETSNMP_DS_AGENT_NO_ROOT_ACCESS);
+    /*
+     * ignore any warning messages.
+     */
+    netsnmp_ds_toggle_boolean(NETSNMP_DS_APPLICATION_ID, 
+			      NETSNMP_DS_AGENT_NO_CONNECTION_WARNINGS);
+
+    /*
+     * initialize the agent library 
+     */
+    init_agent("snmptrapd");
+
+    /*
+     * initialize local modules 
+     */
+    if (agentx_subagent) {
+#ifdef USING_AGENTX_SUBAGENT_MODULE
+        init_subagent();
+#endif
+        init_notification_log();
+    }
+
+    /*
+     * Initialize the world. Create initial user 
+     */
+    init_snmp("snmptrapd");
+    if (trap1_fmt_str_remember) {
+        free_trap1_fmt();
+        free_trap2_fmt();
+        trap1_fmt_str = strdup(trap1_fmt_str_remember);
+        trap2_fmt_str = strdup(trap1_fmt_str_remember);
+    }
+
+    if (netsnmp_ds_get_boolean(NETSNMP_DS_APPLICATION_ID, 
+			       NETSNMP_DS_AGENT_QUIT_IMMEDIATELY)) {
+        /*
+         * just starting up to process specific configuration and then
+         * shutting down immediately. 
+         */
+        running = 0;
+    }
+#ifndef WIN32
+    /*
+     * fork the process to the background if we are not printing to stderr 
+     */
+    if (dofork && running) {
+        int             fd;
+
+        switch (fork()) {
+        case -1:
+            fprintf(stderr, "bad fork - %s\n", strerror(errno));
+            _exit(1);
+
+        case 0:
+            /*
+             * become process group leader 
+             */
+            if (setsid() == -1) {
+                fprintf(stderr, "bad setsid - %s\n", strerror(errno));
+                _exit(1);
+            }
+
+            /*
+             * if we are forked, we don't want to print out to stdout or stderr 
+             */
+            fd = open("/dev/null", O_RDWR);
+            dup2(fd, STDIN_FILENO);
+            dup2(fd, STDOUT_FILENO);
+            dup2(fd, STDERR_FILENO);
+            close(fd);
+            break;
+
+        default:
+            _exit(0);
+        }
+    }
+#endif                          /* WIN32 */
+#if HAVE_GETPID
+    if (pid_file != NULL) {
+        if ((PID = fopen(pid_file, "w")) == NULL) {
+            snmp_log_perror(pid_file);
+            exit(1);
+        }
+        fprintf(PID, "%d\n", (int) getpid());
+        fclose(PID);
+    }
+#endif
+
+    if (Syslog) {
+        snmp_enable_syslog_ident("snmptrapd", Facility);
+        snmp_log(LOG_INFO, "Starting snmptrapd %s\n", netsnmp_get_version());
+	if (depmsg) {
+	    snmp_log(LOG_WARNING, "-l option is deprecated; use -S instead\n");
+	}
+    }
+    if (Print) {
+        struct tm      *tm;
+        time_t          timer;
+        time(&timer);
+        tm = localtime(&timer);
+        snmp_log(LOG_INFO,
+                "%.4d-%.2d-%.2d %.2d:%.2d:%.2d NET-SNMP version %s Started.\n",
+                 tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday,
+                 tm->tm_hour, tm->tm_min, tm->tm_sec,
+                 netsnmp_get_version());
+    }
+
+    SOCK_STARTUP;
+
+    cp = listen_ports;
+
+    while (cp != NULL) {
+        char *sep = strchr(cp, ',');
+        if (sep != NULL) {
+            *sep = 0;
+        }
+
+        transport = netsnmp_tdomain_transport(cp, 1, "udp");
+        if (transport == NULL) {
+            snmp_log(LOG_ERR, "couldn't open %s -- errno %d (\"%s\")\n",
+                     cp, errno, strerror(errno));
+            snmptrapd_close_sessions(sess_list);
+            SOCK_CLEANUP;
+            exit(1);
+        } else {
+            ss = snmptrapd_add_session(transport);
+            if (ss == NULL) {
+                /*
+                 * Shouldn't happen?  We have already opened the transport
+                 * successfully so what could have gone wrong?  
+                 */
+                snmptrapd_close_sessions(sess_list);
+                netsnmp_transport_free(transport);
+                if (Syslog) {
+                    snmp_log(LOG_ERR, "couldn't open snmp - %m");
+                }
+                SOCK_CLEANUP;
+                exit(1);
+            } else {
+                ss->next = sess_list;
+                sess_list = ss;
+            }
+        }
+
+        /*
+         * Process next listen address, if there is one.  
+         */
+
+        if (sep != NULL) {
+            *sep = ',';
+            cp = sep + 1;
+        } else {
+            cp = NULL;
+        }
+    }
+
+    signal(SIGTERM, term_handler);
+#ifdef SIGHUP
+    signal(SIGHUP, hup_handler);
+#endif
+    signal(SIGINT, term_handler);
+
+    while (running) {
+        if (reconfig) {
+            if (Print) {
+                struct tm      *tm;
+                time_t          timer;
+                time(&timer);
+                tm = localtime(&timer);
+
+                /*
+                 * If we are logging to a file, receipt of SIGHUP also
+                 * indicates the the log file should be closed and re-opened.
+                 * This is useful for users that want to rotate logs in a more
+                 * predictable manner.
+                 */
+                if (logfile) {
+                    snmp_enable_filelog(logfile, 1);
+                }
+                snmp_log(LOG_INFO,"%.4d-%.2d-%.2d %.2d:%.2d:%.2d "
+                         "NET-SNMP version %s Reconfigured.\n",
+                         tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday,
+                         tm->tm_hour, tm->tm_min, tm->tm_sec,
+                         netsnmp_get_version());
+            }
+
+            if (Syslog)
+                snmp_log(LOG_INFO, "Snmptrapd reconfiguring");
+            trapd_update_config();
+            if (trap1_fmt_str_remember) {
+                free_trap1_fmt();
+                trap1_fmt_str = strdup(trap1_fmt_str_remember);
+            }
+            reconfig = 0;
+        }
+        numfds = 0;
+        FD_ZERO(&fdset);
+        block = 0;
+        tvp = &timeout;
+        timerclear(tvp);
+        tvp->tv_sec = 5;
+        snmp_select_info(&numfds, &fdset, tvp, &block);
+        if (block == 1)
+            tvp = NULL;         /* block without timeout */
+        count = select(numfds, &fdset, 0, 0, tvp);
+        gettimeofday(&Now, 0);
+        if (count > 0) {
+            snmp_read(&fdset);
+        } else
+            switch (count) {
+            case 0:
+                snmp_timeout();
+                break;
+            case -1:
+                if (errno == EINTR)
+                    continue;
+                snmp_log_perror("select");
+                running = 0;
+                break;
+            default:
+                fprintf(stderr, "select returned %d\n", count);
+                running = 0;
+            }
+    }
+
+    if (Print) {
+        struct tm      *tm;
+        time_t          timer;
+        time(&timer);
+        tm = localtime(&timer);
+        snmp_log(LOG_INFO,
+                "%.4d-%.2d-%.2d %.2d:%.2d:%.2d NET-SNMP version %s Stopped.\n",
+                 tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday, tm->tm_hour,
+                 tm->tm_min, tm->tm_sec, netsnmp_get_version());
+    }
+    if (Syslog) {
+        snmp_log(LOG_INFO, "Stopping snmptrapd");
+    }
+
+    snmptrapd_close_sessions(sess_list);
+    snmp_shutdown("snmptrapd");
+    snmp_disable_log();
+    SOCK_CLEANUP;
+    return 0;
+}
+
+/*
+ * Read the configuration files. Implemented as a signal handler so that
+ * receipt of SIGHUP will cause configuration to be re-read when the
+ * trap deamon is running detatched from the console.
+ *
+ */
+void
+trapd_update_config(void)
+{
+    free_config();
+    read_configs();
+}
+
+
+#if !defined(HAVE_GETDTABLESIZE) && !defined(WIN32)
+#include <sys/resource.h>
+int
+getdtablesize(void)
+{
+    struct rlimit   rl;
+    getrlimit(RLIMIT_NOFILE, &rl);
+    return (rl.rlim_cur);
+}
+#endif
diff -Naur tomato/release/src/router/snmp/apps/snmptrapd_handlers.c tomato121/release/src/router/snmp/apps/snmptrapd_handlers.c
--- tomato/release/src/router/snmp/apps/snmptrapd_handlers.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/apps/snmptrapd_handlers.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,123 @@
+#include <net-snmp/net-snmp-config.h>
+
+#if HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#if HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#include <stdio.h>
+#if HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+#include <sys/types.h>
+#if HAVE_WINSOCK_H
+#include <winsock.h>
+#else
+#include <netinet/in.h>
+#include <netdb.h>
+#endif
+
+#include <net-snmp/config_api.h>
+#include <net-snmp/output_api.h>
+#include <net-snmp/mib_api.h>
+#include <net-snmp/utilities.h>
+
+struct traphandle {
+    char           *exec;
+    oid             trap[MAX_OID_LEN];
+    size_t          traplen;
+    struct traphandle *next;
+};
+
+struct traphandle *traphandlers = 0;
+struct traphandle *defaulthandler = 0;
+
+/*
+ * handles parsing .conf lines of: 
+ */
+/*
+ * traphandle OID EXEC           
+ */
+
+char           *
+snmptrapd_get_traphandler(oid * name, size_t namelen)
+{
+    struct traphandle **ttmp;
+    DEBUGMSGTL(("snmptrapd:traphandler", "looking for trap handler for "));
+    DEBUGMSGOID(("snmptrapd:traphandler", name, namelen));
+    DEBUGMSG(("snmptrapd:traphandler", "...\n"));
+    for (ttmp = &traphandlers;
+         *ttmp != NULL
+         && snmp_oid_compare((*ttmp)->trap, (*ttmp)->traplen, name,
+                             namelen); ttmp = &((*ttmp)->next));
+    if (*ttmp == NULL) {
+        if (defaulthandler) {
+            DEBUGMSGTL(("snmptrapd:traphandler",
+                        "  None found, Using the default handler.\n"));
+            return defaulthandler->exec;
+        }
+        DEBUGMSGTL(("snmptrapd:traphandler", "  Didn't find one.\n"));
+        return NULL;
+    }
+    DEBUGMSGTL(("snmptrapd:traphandler", "  Found it!\n"));
+    return (*ttmp)->exec;
+}
+
+void
+snmptrapd_traphandle(const char *token, char *line)
+{
+    struct traphandle **ttmp;
+    char            buf[STRINGMAX];
+    char           *cptr;
+    int             doingdefault = 0;
+
+    /*
+     * find the current one, if it exists 
+     */
+    if (strncmp(line, "default", 7) == 0) {
+        ttmp = &defaulthandler;
+        doingdefault = 1;
+    } else {
+        for (ttmp = &traphandlers; *ttmp != NULL; ttmp = &((*ttmp)->next));
+    }
+
+    if (*ttmp == NULL) {
+        /*
+         * it doesn't, so allocate a new one. 
+         */
+        *ttmp = (struct traphandle *) malloc(sizeof(struct traphandle));
+        if (!*ttmp) {
+            config_perror("malloc failed");
+            return;
+        }
+        memset(*ttmp, 0, sizeof(struct traphandle));
+    } else {
+        if ((*ttmp)->exec)
+            free((*ttmp)->exec);
+    }
+    cptr = copy_nword(line, buf, sizeof(buf));
+    if (!doingdefault) {
+        (*ttmp)->traplen = MAX_OID_LEN;
+        if (!read_objid(buf, (*ttmp)->trap, &((*ttmp)->traplen))) {
+            char            buf1[STRINGMAX];
+            snprintf(buf1,  sizeof(buf1),
+                    "Bad trap OID in traphandle directive: %s", buf);
+            buf1[ sizeof(buf1)-1 ] = 0;
+            config_perror(buf1);
+            return;
+        }
+    }
+
+    (*ttmp)->exec = strdup(cptr);
+    DEBUGMSGTL(("read_config:traphandler", "registered handler for: "));
+    if (doingdefault) {
+        DEBUGMSG(("read_config:traphandler", "default"));
+    } else {
+        DEBUGMSGOID(("read_config:traphandler", (*ttmp)->trap,
+                     (*ttmp)->traplen));
+    }
+    DEBUGMSG(("read_config:traphandler", "\n"));
+}
diff -Naur tomato/release/src/router/snmp/apps/snmptrapd_handlers.h tomato121/release/src/router/snmp/apps/snmptrapd_handlers.h
--- tomato/release/src/router/snmp/apps/snmptrapd_handlers.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/apps/snmptrapd_handlers.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,6 @@
+#ifndef SNMPTRAPD_HANDLERS_H
+#define SNMPTRAPD_HANDLERS_H
+char           *snmptrapd_get_traphandler(oid *, size_t);
+void            snmptrapd_traphandle(const char *, char *);
+
+#endif                          /* SNMPTRAPD_HANDLERS_H */
diff -Naur tomato/release/src/router/snmp/apps/snmptrapd_log.c tomato121/release/src/router/snmp/apps/snmptrapd_log.c
--- tomato/release/src/router/snmp/apps/snmptrapd_log.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/apps/snmptrapd_log.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,1687 @@
+/*
+ * snmptrapd_log.c - format SNMP trap information for logging
+ *
+ */
+/*****************************************************************
+	Copyright 1989, 1991, 1992 by Carnegie Mellon University
+
+                      All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of CMU not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+CMU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+CMU BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+******************************************************************/
+#include <net-snmp/net-snmp-config.h>
+
+#if HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#if HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#if HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+#include <sys/types.h>
+#if HAVE_SYS_WAIT_H
+#include <sys/wait.h>
+#endif
+#if HAVE_WINSOCK_H
+#include <winsock.h>
+#else
+#include <sys/socket.h>
+#endif
+#if HAVE_SYS_SOCKIO_H
+#include <sys/sockio.h>
+#endif
+#if HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+#include <stdio.h>
+#include <ctype.h>
+#if HAVE_SYS_TIME_H
+# include <sys/time.h>
+# if TIME_WITH_SYS_TIME
+#  include <time.h>
+# endif
+#else
+# include <time.h>
+#endif
+#if HAVE_SYS_SELECT_H
+#include <sys/select.h>
+#endif
+#if HAVE_SYS_PARAM_H
+#include <sys/param.h>
+#endif
+#if HAVE_SYSLOG_H
+#include <syslog.h>
+#endif
+#if HAVE_SYS_IOCTL_H
+#include <sys/ioctl.h>
+#endif
+#if HAVE_NET_IF_H
+#include <net/if.h>
+#endif
+#if HAVE_NETDB_H
+#include <netdb.h>
+#endif
+#if HAVE_ARPA_INET_H
+#include <arpa/inet.h>
+#endif
+#if HAVE_FCNTL_H
+#include <fcntl.h>
+#endif
+
+#include <net-snmp/net-snmp-includes.h>
+#include "snmptrapd_log.h"
+
+
+#ifndef BSD4_3
+#define BSD4_2
+#endif
+
+/*
+ * These flags mark undefined values in the options structure 
+ */
+#define UNDEF_CMD '*'
+#define UNDEF_PRECISION -1
+
+/*
+ * This structure holds the options for a single format command 
+ */
+typedef struct {
+    char            cmd;        /* the format command itself */
+    size_t          width;      /* the field's minimum width */
+    size_t          precision;  /* the field's precision */
+    int             left_justify;       /* if true, left justify this field */
+    int             alt_format; /* if true, display in alternate format */
+    int             leading_zeroes;     /* if true, display with leading zeroes */
+} options_type;
+
+/*
+ * These symbols define the characters that the parser recognizes.
+ * The rather odd choice of symbols comes from an attempt to avoid
+ * colliding with the ones that printf uses, so that someone could add
+ * printf functionality to this code and turn it into a library
+ * routine in the future.  
+ */
+typedef enum {
+    CHR_FMT_DELIM = '%',        /* starts a format command */
+    CHR_LEFT_JUST = '-',        /* left justify */
+    CHR_LEAD_ZERO = '0',        /* use leading zeroes */
+    CHR_ALT_FORM = '#',         /* use alternate format */
+    CHR_FIELD_SEP = '.',        /* separates width and precision fields */
+    CHR_CUR_TIME = 't',         /* current time, Unix format */
+    CHR_CUR_YEAR = 'y',         /* current year */
+    CHR_CUR_MONTH = 'm',        /* current month */
+    CHR_CUR_MDAY = 'l',         /* current day of month */
+    CHR_CUR_HOUR = 'h',         /* current hour */
+    CHR_CUR_MIN = 'j',          /* current minute */
+    CHR_CUR_SEC = 'k',          /* current second */
+    CHR_UP_TIME = 'T',          /* uptime, Unix format */
+    CHR_UP_YEAR = 'Y',          /* uptime year */
+    CHR_UP_MONTH = 'M',         /* uptime month */
+    CHR_UP_MDAY = 'L',          /* uptime day of month */
+    CHR_UP_HOUR = 'H',          /* uptime hour */
+    CHR_UP_MIN = 'J',           /* uptime minute */
+    CHR_UP_SEC = 'K',           /* uptime second */
+    CHR_AGENT_IP = 'a',         /* agent's IP address */
+    CHR_AGENT_NAME = 'A',       /* agent's host name if available */
+    CHR_PDU_IP = 'b',           /* PDU's IP address */
+    CHR_PDU_NAME = 'B',         /* PDU's host name if available */
+    CHR_PDU_ENT = 'N',          /* PDU's enterprise string */
+    CHR_PDU_WRAP = 'P',         /* PDU's wrapper info (community, security) */
+    CHR_TRAP_NUM = 'w',         /* trap number */
+    CHR_TRAP_DESC = 'W',        /* trap's description (textual) */
+    CHR_TRAP_STYPE = 'q',       /* trap's subtype */
+    CHR_TRAP_VARS = 'v'         /* tab-separated list of trap's variables */
+} parse_chr_type;
+
+/*
+ * These symbols define the states for the parser's state machine 
+ */
+typedef enum {
+    PARSE_NORMAL,               /* looking for next character */
+    PARSE_BACKSLASH,            /* saw a backslash */
+    PARSE_IN_FORMAT,            /* saw a % sign, in a format command */
+    PARSE_GET_WIDTH,            /* getting field width */
+    PARSE_GET_PRECISION         /* getting field precision */
+} parse_state_type;
+
+/*
+ * macros 
+ */
+
+#define is_cur_time_cmd(chr) ((((chr) == CHR_CUR_TIME)     \
+			       || ((chr) == CHR_CUR_YEAR)  \
+			       || ((chr) == CHR_CUR_MONTH) \
+			       || ((chr) == CHR_CUR_MDAY)  \
+			       || ((chr) == CHR_CUR_HOUR)  \
+			       || ((chr) == CHR_CUR_MIN)   \
+			       || ((chr) == CHR_CUR_SEC)) ? TRUE : FALSE)
+     /*
+      * Function:
+      *    Returns true if the character is a format command that outputs
+      * some field that deals with the current time.
+      *
+      * Input Parameters:
+      *    chr - character to check
+      */
+
+#define is_up_time_cmd(chr) ((((chr) == CHR_UP_TIME)     \
+			      || ((chr) == CHR_UP_YEAR)  \
+			      || ((chr) == CHR_UP_MONTH) \
+			      || ((chr) == CHR_UP_MDAY)  \
+			      || ((chr) == CHR_UP_HOUR)  \
+			      || ((chr) == CHR_UP_MIN)   \
+			      || ((chr) == CHR_UP_SEC)) ? TRUE : FALSE)
+     /*
+      * Function:
+      *    Returns true if the character is a format command that outputs
+      * some field that deals with up-time.
+      *
+      * Input Parameters:
+      *    chr - character to check
+      */
+
+#define is_agent_cmd(chr) ((((chr) == CHR_AGENT_IP) \
+			    || ((chr) == CHR_AGENT_NAME)) ? TRUE : FALSE)
+     /*
+      * Function:
+      *    Returns true if the character outputs information about the
+      * agent.
+      *
+      * Input Parameters:
+      *    chr - the character to check
+      */
+
+#define is_pdu_ip_cmd(chr) ((((chr) == CHR_PDU_IP)   \
+			  || ((chr) == CHR_PDU_NAME)) ? TRUE : FALSE)
+     /*
+      * Function:
+      *    Returns true if the character outputs information about the PDU's
+      * host name or IP address.
+      *
+      * Input Parameters:
+      *    chr - the character to check
+      */
+
+#define is_trap_cmd(chr) ((((chr) == CHR_TRAP_NUM)      \
+			   || ((chr) == CHR_TRAP_DESC)  \
+			   || ((chr) == CHR_TRAP_STYPE) \
+			   || ((chr) == CHR_TRAP_VARS)) ? TRUE : FALSE)
+
+     /*
+      * Function:
+      *    Returns true if the character outputs information about the trap.
+      *
+      * Input Parameters:
+      *    chr - the character to check
+      */
+
+#define is_fmt_cmd(chr) ((is_cur_time_cmd (chr)     \
+			  || is_up_time_cmd (chr)   \
+			  || is_agent_cmd (chr)     \
+			  || is_pdu_ip_cmd (chr)    \
+                          || ((chr) == CHR_PDU_ENT) \
+                          || ((chr) == CHR_PDU_WRAP) \
+			  || is_trap_cmd (chr)) ? TRUE : FALSE)
+     /*
+      * Function:
+      *    Returns true if the character is a format command.
+      * 
+      * Input Parameters:
+      *    chr - character to check
+      */
+
+#define is_numeric_cmd(chr) ((is_cur_time_cmd(chr)   \
+			      || is_up_time_cmd(chr) \
+			      || (chr) == CHR_TRAP_NUM) ? TRUE : FALSE)
+     /*
+      * Function:
+      *    Returns true if this is a numeric format command.
+      *
+      * Input Parameters:
+      *    chr - character to check
+      */
+
+#define reference(var) ((var) == (var))
+
+     /*
+      * Function:
+      *    Some compiler options will tell the compiler to be picky and
+      * warn you if you pass a parameter to a function but don't use it.
+      * This macro lets you reference a parameter so that the compiler won't
+      * generate the warning. It has no other effect.
+      *
+      * Input Parameters:
+      *    var - the parameter to reference
+      */
+
+/*
+ * prototypes 
+ */
+extern const char *trap_description(int trap);
+
+static void
+init_options(options_type * options)
+
+     /*
+      * Function:
+      *    Initialize a structure that contains the option settings for
+      * a format command.
+      *
+      * Input Parameters:
+      *    options - points to the structure to initialize
+      */
+{
+    /*
+     * initialize the structure's fields 
+     */
+    options->cmd = '*';
+    options->width = 0;
+    options->precision = UNDEF_PRECISION;
+    options->left_justify = FALSE;
+    options->alt_format = FALSE;
+    options->leading_zeroes = FALSE;
+    return;
+}
+
+
+static int
+realloc_output_temp_bfr(u_char ** buf, size_t * buf_len, size_t * out_len,
+                        int allow_realloc,
+                        u_char ** temp_buf, options_type * options)
+
+     /*
+      * Function:
+      *    Append the contents of the temporary buffer to the specified
+      * buffer using the correct justification, leading zeroes, width,
+      * precision, and other characteristics specified in the options
+      * structure.
+      *
+      *    buf, buf_len, out_len, allow_realloc - standard relocatable
+      *                                           buffer parameters
+      *    temp_buf - pointer to string to append onto output buffer.  THIS
+      *               STRING IS free()d BY THIS FUNCTION.
+      *    options  - what options to use when appending string
+      */
+{
+    size_t          temp_len;   /* length of temporary buffer */
+    size_t          temp_to_write;      /* # of chars to write from temp bfr */
+    size_t          char_to_write;      /* # of other chars to write */
+    size_t          zeroes_to_write;    /* fill to precision with zeroes for numbers */
+
+    if (temp_buf == NULL || *temp_buf == NULL) {
+        return 1;
+    }
+
+    /*
+     * Figure out how many characters are in the temporary buffer now,
+     * and how many of them we'll write.
+     */
+    temp_len = strlen((char *) *temp_buf);
+    temp_to_write = temp_len;
+
+    if (options->precision != UNDEF_PRECISION &&
+        temp_to_write > options->precision) {
+        temp_to_write = options->precision;
+    }
+
+    /*
+     * Handle leading characters.  
+     */
+    if ((!options->left_justify) && (temp_to_write < options->width)) {
+        zeroes_to_write = options->precision - temp_to_write;
+        if (!is_numeric_cmd(options->cmd)) {
+            zeroes_to_write = 0;
+        }
+
+        for (char_to_write = options->width - temp_to_write;
+             char_to_write > 0; char_to_write--) {
+            if ((*out_len + 1) >= *buf_len) {
+                if (!(allow_realloc && snmp_realloc(buf, buf_len))) {
+                    *(*buf + *out_len) = '\0';
+                    free(*temp_buf);
+                    return 0;
+                }
+            }
+            if (options->leading_zeroes || zeroes_to_write-- > 0) {
+                *(*buf + *out_len) = '0';
+            } else {
+                *(*buf + *out_len) = ' ';
+            }
+            (*out_len)++;
+        }
+    }
+
+    /*
+     * Truncate the temporary buffer and append its contents.  
+     */
+    *(*temp_buf + temp_to_write) = '\0';
+    if (!snmp_strcat(buf, buf_len, out_len, allow_realloc, *temp_buf)) {
+        free(*temp_buf);
+        return 0;
+    }
+
+    /*
+     * Handle trailing characters.  
+     */
+    if ((options->left_justify) && (temp_to_write < options->width)) {
+        for (char_to_write = options->width - temp_to_write;
+             char_to_write > 0; char_to_write--) {
+            if ((*out_len + 1) >= *buf_len) {
+                if (!(allow_realloc && snmp_realloc(buf, buf_len))) {
+                    *(*buf + *out_len) = '\0';
+                    free(*temp_buf);
+                    return 0;
+                }
+            }
+            *(*buf + *out_len) = '0';
+            (*out_len)++;
+        }
+    }
+
+    /*
+     * Slap on a trailing \0 for good measure.  
+     */
+
+    *(*buf + *out_len) = '\0';
+    free(*temp_buf);
+    *temp_buf = NULL;
+    return 1;
+}
+
+
+static int
+realloc_handle_time_fmt(u_char ** buf, size_t * buf_len, size_t * out_len,
+                        int allow_realloc,
+                        options_type * options, netsnmp_pdu *pdu)
+
+     /*
+      * Function:
+      *    Handle a format command that deals with the current or up-time.
+      * Append the correct time information to the buffer subject to the
+      * buffer's length limit.
+      *
+      * Input Parameters:
+      *    buf, buf_len, out_len, allow_realloc - standard relocatable
+      *                                           buffer parameters
+      *    options - options governing how to write the field
+      *    pdu     - information about this trap
+      */
+{
+    time_t          time_val;   /* the time value to output */
+    unsigned long   time_ul;    /* u_long time/timeticks */
+    struct tm      *parsed_time;        /* parsed version of current time */
+    char           *safe_bfr = NULL;
+    char            fmt_cmd = options->cmd;     /* the format command to use */
+    int             offset = 0; /* offset into string to display */
+    size_t          year_len;   /* length of year string */
+
+    if ((safe_bfr = (char *) calloc(30, 1)) == NULL) {
+        return 0;
+    }
+
+    /*
+     * Get the time field to output.  
+     */
+    if (is_up_time_cmd(fmt_cmd)) {
+        time_ul = pdu->time;
+    } else {
+        /*
+         * Note: a time_t is a signed long.  
+         */
+        time(&time_val);
+        time_ul = (unsigned long) time_val;
+    }
+
+    /*
+     * Handle output in Unix time format.  
+     */
+    if (fmt_cmd == CHR_CUR_TIME) {
+        sprintf(safe_bfr, "%lu", time_ul);
+    } else if (fmt_cmd == CHR_UP_TIME && !options->alt_format) {
+        sprintf(safe_bfr, "%lu", time_ul);
+    } else if (fmt_cmd == CHR_UP_TIME) {
+        unsigned int    centisecs, seconds, minutes, hours, days;
+
+        centisecs = time_ul % 100;
+        time_ul /= 100;
+        days = time_ul / (60 * 60 * 24);
+        time_ul %= (60 * 60 * 24);
+
+        hours = time_ul / (60 * 60);
+        time_ul %= (60 * 60);
+
+        minutes = time_ul / 60;
+        seconds = time_ul % 60;
+
+        switch (days) {
+        case 0:
+            sprintf(safe_bfr, "%u:%02u:%02u.%02u",
+                    hours, minutes, seconds, centisecs);
+            break;
+        case 1:
+            sprintf(safe_bfr, "1 day, %u:%02u:%02u.%02u",
+                    hours, minutes, seconds, centisecs);
+            break;
+        default:
+            sprintf(safe_bfr, "%u days, %u:%02u:%02u.%02u",
+                    days, hours, minutes, seconds, centisecs);
+        }
+    } else {
+        /*
+         * Handle other time fields.  
+         */
+
+        if (options->alt_format) {
+            parsed_time = gmtime(&time_val);
+        } else {
+            parsed_time = localtime(&time_val);
+        }
+
+        switch (fmt_cmd) {
+
+            /*
+             * Output year. The year field is unusual: if there's a restriction 
+             * on precision, we want to truncate from the left of the number,
+             * not the right, so someone printing the year 1972 with 2 digit 
+             * precision gets "72" not "19".
+             */
+        case CHR_CUR_YEAR:
+        case CHR_UP_YEAR:
+            sprintf(safe_bfr, "%d", parsed_time->tm_year + 1900);
+            if (options->precision != UNDEF_PRECISION) {
+                year_len = (size_t) strlen(safe_bfr);
+                if (year_len > options->precision)
+                    offset = year_len - options->precision;
+            }
+            break;
+
+            /*
+             * output month 
+             */
+        case CHR_CUR_MONTH:
+        case CHR_UP_MONTH:
+            sprintf(safe_bfr, "%d", parsed_time->tm_mon + 1);
+            break;
+
+            /*
+             * output day of month 
+             */
+        case CHR_CUR_MDAY:
+        case CHR_UP_MDAY:
+            sprintf(safe_bfr, "%d", parsed_time->tm_mday);
+            break;
+
+            /*
+             * output hour 
+             */
+        case CHR_CUR_HOUR:
+        case CHR_UP_HOUR:
+            sprintf(safe_bfr, "%d", parsed_time->tm_hour);
+            break;
+
+            /*
+             * output minute 
+             */
+        case CHR_CUR_MIN:
+        case CHR_UP_MIN:
+            sprintf(safe_bfr, "%d", parsed_time->tm_min);
+            break;
+
+            /*
+             * output second 
+             */
+        case CHR_CUR_SEC:
+        case CHR_UP_SEC:
+            sprintf(safe_bfr, "%d", parsed_time->tm_sec);
+            break;
+
+            /*
+             * unknown format command - just output the character 
+             */
+        default:
+            sprintf(safe_bfr, "%c", fmt_cmd);
+        }
+    }
+
+    /*
+     * Output with correct justification, leading zeroes, etc.  
+     */
+    return realloc_output_temp_bfr(buf, buf_len, out_len, allow_realloc,
+                                   (u_char **) & safe_bfr, options);
+}
+
+
+static int
+realloc_handle_ip_fmt(u_char ** buf, size_t * buf_len, size_t * out_len,
+                      int allow_realloc,
+                      options_type * options, netsnmp_pdu *pdu,
+                      netsnmp_transport *transport)
+
+     /*
+      * Function:
+      *     Handle a format command that deals with an IP address 
+      * or host name.  Append the information to the buffer subject to
+      * the buffer's length limit.
+      *
+      * Input Parameters:
+      *    buf, buf_len, out_len, allow_realloc - standard relocatable
+      *                                           buffer parameters
+      *    options   - options governing how to write the field
+      *    pdu       - information about this trap 
+      *    transport - the transport descriptor
+      */
+{
+    struct in_addr *agent_inaddr = (struct in_addr *) pdu->agent_addr;
+    struct hostent *host = NULL;       /* corresponding host name */
+    char            fmt_cmd = options->cmd;     /* what we're formatting */
+    u_char         *temp_buf = NULL;
+    size_t          temp_buf_len = 64, temp_out_len = 0;
+
+    if ((temp_buf = calloc(temp_buf_len, 1)) == NULL) {
+        return 0;
+    }
+
+    /*
+     * Decide exactly what to output.  
+     */
+    switch (fmt_cmd) {
+    case CHR_AGENT_IP:
+        /*
+         * Write a numerical address.  
+         */
+        if (!snmp_strcat(&temp_buf, &temp_buf_len, &temp_out_len, 1,
+                         inet_ntoa(*agent_inaddr))) {
+            if (temp_buf != NULL) {
+                free(temp_buf);
+            }
+            return 0;
+        }
+        break;
+
+    case CHR_AGENT_NAME:
+        /*
+         * Try to resolve the agent_addr field as a hostname; fall back
+         * to numerical address.  
+         */
+        if (!netsnmp_ds_get_boolean(NETSNMP_DS_APPLICATION_ID, 
+                                    NETSNMP_DS_APP_NUMERIC_IP)) {
+            host = gethostbyaddr((char *) pdu->agent_addr, 4, AF_INET);
+        }
+        if (host != NULL) {
+            if (!snmp_strcat(&temp_buf, &temp_buf_len, &temp_out_len, 1,
+                             host->h_name)) {
+                if (temp_buf != NULL) {
+                    free(temp_buf);
+                }
+                return 0;
+            }
+        } else {
+            if (!snmp_strcat(&temp_buf, &temp_buf_len, &temp_out_len, 1,
+                             inet_ntoa(*agent_inaddr))) {
+                if (temp_buf != NULL) {
+                    free(temp_buf);
+                }
+                return 0;
+            }
+        }
+        break;
+
+    case CHR_PDU_IP:
+        /*
+         * Write the numerical transport information.  
+         */
+        if (transport != NULL && transport->f_fmtaddr != NULL) {
+            char           *tstr =
+                transport->f_fmtaddr(transport, pdu->transport_data,
+                                     pdu->transport_data_length);
+            if (!snmp_strcat
+                (&temp_buf, &temp_buf_len, &temp_out_len, 1, tstr)) {
+                if (tstr != NULL) {
+                    free(tstr);
+                }
+                if (temp_buf != NULL) {
+                    free(temp_buf);
+                }
+                return 0;
+            }
+            if (tstr != NULL) {
+                free(tstr);
+            }
+        } else {
+            if (!snmp_strcat
+                (&temp_buf, &temp_buf_len, &temp_out_len, 1,
+                 "<UNKNOWN>")) {
+                if (temp_buf != NULL) {
+                    free(temp_buf);
+                }
+                return 0;
+            }
+        }
+        break;
+
+        /*
+         * Write a host name.  
+         */
+    case CHR_PDU_NAME:
+        /*
+         * Right, apparently a name lookup is wanted.  This is only reasonable
+         * for the UDP and TCP transport domains (we don't want to try to be
+         * too clever here).  
+         */
+#ifdef SNMP_TRANSPORT_TCP_DOMAIN
+        if (transport != NULL && (transport->domain == netsnmpUDPDomain ||
+                                  transport->domain ==
+                                  netsnmp_snmpTCPDomain)) {
+#else
+        if (transport != NULL && transport->domain == netsnmpUDPDomain) {
+#endif
+            /*
+             * This is kind of bletcherous -- it breaks the opacity of
+             * transport_data but never mind -- the alternative is a lot of
+             * munging strings from f_fmtaddr.  
+             */
+            struct sockaddr_in *addr =
+                (struct sockaddr_in *) pdu->transport_data;
+            if (addr != NULL
+                && pdu->transport_data_length ==
+                sizeof(struct sockaddr_in)) {
+                if (!netsnmp_ds_get_boolean(NETSNMP_DS_APPLICATION_ID, 
+                                            NETSNMP_DS_APP_NUMERIC_IP)) {
+                    host =
+                        gethostbyaddr((char *) &(addr->sin_addr),
+                                      sizeof(struct in_addr), AF_INET);
+                }
+                if (host != NULL) {
+                    if (!snmp_strcat
+                        (&temp_buf, &temp_buf_len, &temp_out_len, 1,
+                         host->h_name)) {
+                        if (temp_buf != NULL) {
+                            free(temp_buf);
+                        }
+                        return 0;
+                    }
+                } else {
+                    if (!snmp_strcat
+                        (&temp_buf, &temp_buf_len, &temp_out_len, 1,
+                         inet_ntoa(addr->sin_addr))) {
+                        if (temp_buf != NULL) {
+                            free(temp_buf);
+                        }
+                        return 0;
+                    }
+                }
+            } else {
+                if (!snmp_strcat
+                    (&temp_buf, &temp_buf_len, &temp_out_len, 1,
+                     "<UNKNOWN>")) {
+                    if (temp_buf != NULL) {
+                        free(temp_buf);
+                    }
+                    return 0;
+                }
+            }
+        } else if (transport != NULL && transport->f_fmtaddr != NULL) {
+            /*
+             * Some other domain for which we do not know how to do a name
+             * lookup.  Fall back to the formatted transport address.  
+             */
+            char           *tstr =
+                transport->f_fmtaddr(transport, pdu->transport_data,
+                                     pdu->transport_data_length);
+            if (!snmp_strcat
+                (&temp_buf, &temp_buf_len, &temp_out_len, 1, tstr)) {
+                if (tstr != NULL) {
+                    free(tstr);
+                }
+                if (temp_buf != NULL) {
+                    free(temp_buf);
+                }
+                return 0;
+            }
+            if (tstr != NULL) {
+                free(tstr);
+            }
+        } else {
+            /*
+             * We are kind of stuck!  
+             */
+            if (!snmp_strcat(&temp_buf, &temp_buf_len, &temp_out_len, 1,
+                             "<UNKNOWN>")) {
+                if (temp_buf != NULL) {
+                    free(temp_buf);
+                }
+                return 0;
+            }
+        }
+        break;
+
+        /*
+         * Don't know how to handle this command - write the character itself.  
+         */
+    default:
+        temp_buf[0] = fmt_cmd;
+    }
+
+    /*
+     * Output with correct justification, leading zeroes, etc.  
+     */
+    return realloc_output_temp_bfr(buf, buf_len, out_len, allow_realloc,
+                                   &temp_buf, options);
+}
+
+
+static int
+realloc_handle_ent_fmt(u_char ** buf, size_t * buf_len, size_t * out_len,
+                       int allow_realloc,
+                       options_type * options, netsnmp_pdu *pdu)
+
+     /*
+      * Function:
+      *     Handle a format command that deals with the enterprise 
+      * string.  Append the information to the buffer subject to the
+      * buffer's length limit.
+      *
+      * Input Parameters:
+      *    buf, buf_len, out_len, allow_realloc - standard relocatable
+      *                                           buffer parameters
+      *    options - options governing how to write the field
+      *    pdu     - information about this trap 
+      */
+{
+    char            fmt_cmd = options->cmd;     /* what we're formatting */
+    u_char         *temp_buf = NULL;
+    size_t          temp_buf_len = 64, temp_out_len = 0;
+
+    if ((temp_buf = (u_char *) calloc(temp_buf_len, 1)) == NULL) {
+        return 0;
+    }
+
+    /*
+     * Decide exactly what to output.  
+     */
+    switch (fmt_cmd) {
+    case CHR_PDU_ENT:
+        /*
+         * Write the enterprise oid.  
+         */
+        if (!sprint_realloc_objid
+            (&temp_buf, &temp_buf_len, &temp_out_len, 1, pdu->enterprise,
+             pdu->enterprise_length)) {
+            free(temp_buf);
+            return 0;
+        }
+        break;
+
+        /*
+         * Don't know how to handle this command - write the character itself.  
+         */
+    default:
+        temp_buf[0] = fmt_cmd;
+    }
+
+    /*
+     * Output with correct justification, leading zeroes, etc.  
+     */
+    return realloc_output_temp_bfr(buf, buf_len, out_len, allow_realloc,
+                                   &temp_buf, options);
+}
+
+
+static int
+realloc_handle_trap_fmt(u_char ** buf, size_t * buf_len, size_t * out_len,
+                        int allow_realloc,
+                        options_type * options, netsnmp_pdu *pdu)
+
+     /*
+      * Function:
+      *     Handle a format command that deals with the trap itself. 
+      * Append the information to the buffer subject to the buffer's 
+      * length limit.
+      *
+      * Input Parameters:
+      *    buf, buf_len, out_len, allow_realloc - standard relocatable
+      *                                           buffer parameters
+      *    options - options governing how to write the field
+      *    pdu     - information about this trap 
+      */
+{
+    netsnmp_variable_list *vars;        /* variables assoc with trap */
+    char            fmt_cmd = options->cmd;     /* what we're outputting */
+    u_char         *temp_buf = NULL;
+    size_t          tbuf_len = 64, tout_len = 0;
+
+    if ((temp_buf = (u_char *) calloc(tbuf_len, 1)) == NULL) {
+        return 0;
+    }
+
+    /*
+     * Decide exactly what to output.  
+     */
+    switch (fmt_cmd) {
+    case CHR_TRAP_NUM:
+        /*
+         * Write the trap's number.  
+         */
+        tout_len = sprintf(temp_buf, "%ld", pdu->trap_type);
+        break;
+
+    case CHR_TRAP_DESC:
+        /*
+         * Write the trap's description.  
+         */
+        tout_len =
+            sprintf(temp_buf, "%s", trap_description(pdu->trap_type));
+        break;
+
+    case CHR_TRAP_STYPE:
+        /*
+         * Write the trap's subtype.  
+         */
+        if (pdu->trap_type != SNMP_TRAP_ENTERPRISESPECIFIC) {
+            tout_len = sprintf(temp_buf, "%ld", pdu->specific_type);
+        } else {
+            /*
+             * Get object ID for the trap.  
+             */
+            size_t          obuf_len = 64, oout_len = 0, trap_oid_len = 0;
+            oid             trap_oid[MAX_OID_LEN + 2] = { 0 };
+            u_char         *obuf = NULL;
+            char           *ptr = NULL;
+
+            if ((obuf = (u_char *) calloc(obuf_len, 1)) == NULL) {
+                free(temp_buf);
+                return 0;
+            }
+
+            trap_oid_len = pdu->enterprise_length;
+            memcpy(trap_oid, pdu->enterprise, trap_oid_len * sizeof(oid));
+            if (trap_oid[trap_oid_len - 1] != 0) {
+                trap_oid[trap_oid_len] = 0;
+                trap_oid_len++;
+            }
+            trap_oid[trap_oid_len] = pdu->specific_type;
+            trap_oid_len++;
+
+            /*
+             * Find the element after the last dot.  
+             */
+            if (!sprint_realloc_objid(&obuf, &obuf_len, &oout_len, 1,
+                                      trap_oid, trap_oid_len)) {
+                if (obuf != NULL) {
+                    free(obuf);
+                }
+                free(temp_buf);
+		return 0;
+            }
+
+            ptr = strrchr((char *) obuf, '.');
+            if (ptr != NULL) {
+                if (!snmp_strcat
+                    (&temp_buf, &tbuf_len, &tout_len, 1, (u_char *) ptr)) {
+                    free(obuf);
+                    if (temp_buf != NULL) {
+                        free(temp_buf);
+                    }
+                    return 0;
+                }
+                free(obuf);
+            } else {
+                free(temp_buf);
+                temp_buf = obuf;
+                tbuf_len = obuf_len;
+                tout_len = oout_len;
+            }
+        }
+        break;
+
+    case CHR_TRAP_VARS:
+        /*
+         * Write the trap's variables.  
+         */
+        for (vars = pdu->variables; vars != NULL;
+             vars = vars->next_variable) {
+            if (options->alt_format) {
+                if (!snmp_strcat(&temp_buf, &tbuf_len, &tout_len, 1, ", ")) {
+                    if (temp_buf != NULL) {
+                        free(temp_buf);
+                    }
+                    return 0;
+                }
+            } else {
+                if (!snmp_strcat(&temp_buf, &tbuf_len, &tout_len, 1, "\t")) {
+                    if (temp_buf != NULL) {
+                        free(temp_buf);
+                    }
+                    return 0;
+                }
+            }
+            if (!sprint_realloc_variable
+                (&temp_buf, &tbuf_len, &tout_len, 1, vars->name,
+                 vars->name_length, vars)) {
+                if (temp_buf != NULL) {
+                    free(temp_buf);
+                }
+                return 0;
+            }
+        }
+        break;
+
+    default:
+        /*
+         * Don't know how to handle this command - write the character itself.  
+         */
+        temp_buf[0] = fmt_cmd;
+    }
+
+    /*
+     * Output with correct justification, leading zeroes, etc.  
+     */
+    return realloc_output_temp_bfr(buf, buf_len, out_len, allow_realloc,
+                                   &temp_buf, options);
+}
+
+
+static int
+realloc_handle_wrap_fmt(u_char ** buf, size_t * buf_len, size_t * out_len,
+                        int allow_realloc, netsnmp_pdu *pdu)
+{
+    size_t          i = 0;
+
+    switch (pdu->command) {
+    case SNMP_MSG_TRAP:
+        if (!snmp_strcat
+            (buf, buf_len, out_len, allow_realloc,
+             (const u_char *) "TRAP")) {
+            return 0;
+        }
+        break;
+    case SNMP_MSG_TRAP2:
+        if (!snmp_strcat
+            (buf, buf_len, out_len, allow_realloc,
+             (const u_char *) "TRAP2")) {
+            return 0;
+        }
+        break;
+    case SNMP_MSG_INFORM:
+        if (!snmp_strcat
+            (buf, buf_len, out_len, allow_realloc,
+             (const u_char *) "INFORM")) {
+            return 0;
+        }
+        break;
+    }
+
+    switch (pdu->version) {
+    case SNMP_VERSION_1:
+        if (!snmp_strcat
+            (buf, buf_len, out_len, allow_realloc,
+             (const u_char *) ", SNMP v1")) {
+            return 0;
+        }
+        break;
+    case SNMP_VERSION_2c:
+        if (!snmp_strcat
+            (buf, buf_len, out_len, allow_realloc,
+             (const u_char *) ", SNMP v2c")) {
+            return 0;
+        }
+        break;
+    case SNMP_VERSION_3:
+        if (!snmp_strcat
+            (buf, buf_len, out_len, allow_realloc,
+             (const u_char *) ", SNMP v3")) {
+            return 0;
+        }
+        break;
+    }
+
+    switch (pdu->version) {
+    case SNMP_VERSION_1:
+    case SNMP_VERSION_2c:
+        if (!snmp_strcat
+            (buf, buf_len, out_len, allow_realloc,
+             (const u_char *) ", community ")) {
+            return 0;
+        }
+
+        while ((*out_len + pdu->community_len + 1) >= *buf_len) {
+            if (!(allow_realloc && snmp_realloc(buf, buf_len))) {
+                return 0;
+            }
+        }
+
+        for (i = 0; i < pdu->community_len; i++) {
+            if (isprint(pdu->community[i])) {
+                *(*buf + *out_len) = pdu->community[i];
+            } else {
+                *(*buf + *out_len) = '.';
+            }
+            (*out_len)++;
+        }
+        *(*buf + *out_len) = '\0';
+        break;
+    case SNMP_VERSION_3:
+        if (!snmp_strcat
+            (buf, buf_len, out_len, allow_realloc,
+             (const u_char *) ", user ")) {
+            return 0;
+        }
+
+        while ((*out_len + pdu->securityNameLen + 1) >= *buf_len) {
+            if (!(allow_realloc && snmp_realloc(buf, buf_len))) {
+                return 0;
+            }
+        }
+
+        for (i = 0; i < pdu->securityNameLen; i++) {
+            if (isprint(pdu->securityName[i])) {
+                *(*buf + *out_len) = pdu->securityName[i];
+            } else {
+                *(*buf + *out_len) = '.';
+            }
+            (*out_len)++;
+        }
+        *(*buf + *out_len) = '\0';
+
+        if (!snmp_strcat
+            (buf, buf_len, out_len, allow_realloc,
+             (const u_char *) ", context ")) {
+            return 0;
+        }
+
+        while ((*out_len + pdu->contextNameLen + 1) >= *buf_len) {
+            if (!(allow_realloc && snmp_realloc(buf, buf_len))) {
+                return 0;
+            }
+        }
+
+        for (i = 0; i < pdu->contextNameLen; i++) {
+            if (isprint(pdu->contextName[i])) {
+                *(*buf + *out_len) = pdu->contextName[i];
+            } else {
+                *(*buf + *out_len) = '.';
+            }
+            (*out_len)++;
+        }
+        *(*buf + *out_len) = '\0';
+    }
+    return 1;
+}
+
+
+static int
+realloc_dispatch_format_cmd(u_char ** buf, size_t * buf_len,
+                            size_t * out_len, int allow_realloc,
+                            options_type * options, netsnmp_pdu *pdu,
+                            netsnmp_transport *transport)
+
+     /*
+      * Function:
+      *     Dispatch a format command to the appropriate command handler.
+      *
+      * Input Parameters:
+      *    buf, buf_len, out_len, allow_realloc - standard relocatable
+      *                                           buffer parameters
+      *    options   - options governing how to write the field
+      *    pdu       - information about this trap
+      *    transport - the transport descriptor
+      */
+{
+    char            fmt_cmd = options->cmd;     /* for speed */
+
+    /*
+     * choose the appropriate command handler 
+     */
+
+    if (is_cur_time_cmd(fmt_cmd) || is_up_time_cmd(fmt_cmd)) {
+        return realloc_handle_time_fmt(buf, buf_len, out_len,
+                                       allow_realloc, options, pdu);
+    } else if (is_agent_cmd(fmt_cmd) || is_pdu_ip_cmd(fmt_cmd)) {
+        return realloc_handle_ip_fmt(buf, buf_len, out_len, allow_realloc,
+                                     options, pdu, transport);
+    } else if (is_trap_cmd(fmt_cmd)) {
+        return realloc_handle_trap_fmt(buf, buf_len, out_len,
+                                       allow_realloc, options, pdu);
+    } else if (fmt_cmd == CHR_PDU_ENT) {
+        return realloc_handle_ent_fmt(buf, buf_len, out_len, allow_realloc,
+                                      options, pdu);
+    } else if (fmt_cmd == CHR_PDU_WRAP) {
+        return realloc_handle_wrap_fmt(buf, buf_len, out_len,
+                                       allow_realloc, pdu);
+    } else {
+        /*
+         * unknown format command - just output the character 
+         */
+        char            fmt_cmd_string[2] = { 0, 0 };
+        fmt_cmd_string[0] = fmt_cmd;
+
+        return snmp_strcat(buf, buf_len, out_len, allow_realloc,
+                           (const u_char *) fmt_cmd_string);
+    }
+}
+
+
+static int
+realloc_handle_backslash(u_char ** buf, size_t * buf_len, size_t * out_len,
+                         int allow_realloc, char fmt_cmd)
+
+     /*
+      * Function:
+      *     Handle a character following a backslash. Append the resulting 
+      * character to the buffer subject to the buffer's length limit.
+      *     This routine currently isn't sophisticated enough to handle
+      * \nnn or \xhh formats.
+      *
+      * Input Parameters:
+      *    buf, buf_len, out_len, allow_realloc - standard relocatable
+      *                                           buffer parameters
+      *    fmt_cmd - the character after the backslash
+      */
+{
+    char            temp_bfr[3];        /* for bulding temporary strings */
+
+    /*
+     * select the proper output character(s) 
+     */
+    switch (fmt_cmd) {
+    case 'a':
+        return snmp_strcat(buf, buf_len, out_len, allow_realloc,
+                           (const u_char *) "\a");
+    case 'b':
+        return snmp_strcat(buf, buf_len, out_len, allow_realloc,
+                           (const u_char *) "\b");
+    case 'f':
+        return snmp_strcat(buf, buf_len, out_len, allow_realloc,
+                           (const u_char *) "\f");
+    case 'n':
+        return snmp_strcat(buf, buf_len, out_len, allow_realloc,
+                           (const u_char *) "\n");
+    case 'r':
+        return snmp_strcat(buf, buf_len, out_len, allow_realloc,
+                           (const u_char *) "\r");
+    case 't':
+        return snmp_strcat(buf, buf_len, out_len, allow_realloc,
+                           (const u_char *) "\t");
+    case 'v':
+        return snmp_strcat(buf, buf_len, out_len, allow_realloc,
+                           (const u_char *) "\v");
+    case '\\':
+        return snmp_strcat(buf, buf_len, out_len, allow_realloc,
+                           (const u_char *) "\\");
+    case '?':
+        return snmp_strcat(buf, buf_len, out_len, allow_realloc,
+                           (const u_char *) "\?");
+    case '\'':
+        return snmp_strcat(buf, buf_len, out_len, allow_realloc,
+                           (const u_char *) "\'");
+    case '"':
+        return snmp_strcat(buf, buf_len, out_len, allow_realloc,
+                           (const u_char *) "\"");
+    default:
+        sprintf(temp_bfr, "\\%c", fmt_cmd);
+        return snmp_strcat(buf, buf_len, out_len, allow_realloc,
+                           (const u_char *) temp_bfr);
+    }
+}
+
+
+int
+realloc_format_plain_trap(u_char ** buf, size_t * buf_len,
+                          size_t * out_len, int allow_realloc,
+                          netsnmp_pdu *pdu, netsnmp_transport *transport)
+
+     /*
+      * Function:
+      *    Format the trap information in the default way and put the results
+      * into the buffer, truncating at the buffer's length limit. This
+      * routine returns 1 if the output was completed successfully or
+      * 0 if it is truncated due to a memory allocation failure.
+      *
+      * Input Parameters:
+      *    buf, buf_len, out_len, allow_realloc - standard relocatable
+      *                                           buffer parameters
+      *    pdu       - the pdu information
+      *    transport - the transport descriptor
+      */
+{
+    time_t          now;        /* the current time */
+    struct tm      *now_parsed; /* time in struct format */
+    char            safe_bfr[200];      /* holds other strings */
+    struct in_addr *agent_inaddr = (struct in_addr *) pdu->agent_addr;
+    struct hostent *host = NULL;       /* host name */
+    netsnmp_variable_list *vars;        /* variables assoc with trap */
+
+    if (buf == NULL) {
+        return 0;
+    }
+
+    /*
+     * Print the current time. Since we don't know how long the buffer is,
+     * and snprintf isn't yet standard, build the timestamp in a separate
+     * buffer of guaranteed length and then copy it to the output buffer.
+     */
+    time(&now);
+    now_parsed = localtime(&now);
+    sprintf(safe_bfr, "%.4d-%.2d-%.2d %.2d:%.2d:%.2d ",
+            now_parsed->tm_year + 1900, now_parsed->tm_mon + 1,
+            now_parsed->tm_mday, now_parsed->tm_hour,
+            now_parsed->tm_min, now_parsed->tm_sec);
+    if (!snmp_strcat
+        (buf, buf_len, out_len, allow_realloc,
+         (const u_char *) safe_bfr)) {
+        return 0;
+    }
+
+    /*
+     * Get info about the sender.  
+     */
+    if (!netsnmp_ds_get_boolean(NETSNMP_DS_APPLICATION_ID, 
+                                NETSNMP_DS_APP_NUMERIC_IP)) {
+        host = gethostbyaddr((char *) pdu->agent_addr, 4, AF_INET);
+    }
+    if (host != (struct hostent *) NULL) {
+        if (!snmp_strcat
+            (buf, buf_len, out_len, allow_realloc,
+             (const u_char *) host->h_name)) {
+            return 0;
+        }
+        if (!snmp_strcat
+            (buf, buf_len, out_len, allow_realloc,
+             (const u_char *) " [")) {
+            return 0;
+        }
+        if (!snmp_strcat(buf, buf_len, out_len, allow_realloc,
+                         (const u_char *) inet_ntoa(*agent_inaddr))) {
+            return 0;
+        }
+        if (!snmp_strcat
+            (buf, buf_len, out_len, allow_realloc,
+             (const u_char *) "] ")) {
+            return 0;
+        }
+    } else {
+        if (!snmp_strcat(buf, buf_len, out_len, allow_realloc,
+                         (const u_char *) inet_ntoa(*agent_inaddr))) {
+            return 0;
+        }
+    }
+
+    /*
+     * Append PDU transport info.  
+     */
+    if (transport != NULL && transport->f_fmtaddr != NULL) {
+        char           *tstr =
+            transport->f_fmtaddr(transport, pdu->transport_data,
+                                 pdu->transport_data_length);
+        if (!snmp_strcat
+            (buf, buf_len, out_len, allow_realloc,
+             (const u_char *) "(via ")) {
+            return 0;
+        }
+        if (!snmp_strcat(buf, buf_len, out_len, allow_realloc, tstr)) {
+            free(tstr);
+            return 0;
+        }
+        free(tstr);
+        if (!snmp_strcat
+            (buf, buf_len, out_len, allow_realloc,
+             (const u_char *) ") ")) {
+            return 0;
+        }
+    }
+
+    /*
+     * Add security wrapper information.  
+     */
+    if (!realloc_handle_wrap_fmt
+        (buf, buf_len, out_len, allow_realloc, pdu)) {
+        return 0;
+    }
+
+    if (!snmp_strcat
+        (buf, buf_len, out_len, allow_realloc, (const u_char *) "\n\t")) {
+        return 0;
+    }
+
+    /*
+     * Add enterprise information.  
+     */
+    if (!sprint_realloc_objid(buf, buf_len, out_len, allow_realloc,
+                              pdu->enterprise, pdu->enterprise_length)) {
+        return 0;
+    }
+
+    if (!snmp_strcat
+        (buf, buf_len, out_len, allow_realloc, (const u_char *) " ")) {
+        return 0;
+    }
+    if (!snmp_strcat(buf, buf_len, out_len, allow_realloc,
+                     trap_description(pdu->trap_type))) {
+        return 0;
+    }
+    if (!snmp_strcat
+        (buf, buf_len, out_len, allow_realloc,
+         (const u_char *) " Trap (")) {
+        return 0;
+    }
+
+    /*
+     * Handle enterprise specific traps.  
+     */
+    if (pdu->trap_type == SNMP_TRAP_ENTERPRISESPECIFIC) {
+        size_t          obuf_len = 64, oout_len = 0, trap_oid_len = 0;
+        oid             trap_oid[MAX_OID_LEN + 2] = { 0 };
+        char           *ent_spec_code = NULL;
+        u_char         *obuf = NULL;
+
+        if ((obuf = (u_char *) calloc(obuf_len, 1)) == NULL) {
+            return 0;
+        }
+
+        /*
+         * Get object ID for the trap.  
+         */
+        trap_oid_len = pdu->enterprise_length;
+        memcpy(trap_oid, pdu->enterprise, trap_oid_len * sizeof(oid));
+        if (trap_oid[trap_oid_len - 1] != 0) {
+            trap_oid[trap_oid_len] = 0;
+            trap_oid_len++;
+        }
+        trap_oid[trap_oid_len] = pdu->specific_type;
+        trap_oid_len++;
+
+        /*
+         * Find the element after the last dot.  
+         */
+        if (!sprint_realloc_objid(&obuf, &obuf_len, &oout_len, 1,
+                                  trap_oid, trap_oid_len)) {
+            if (obuf != NULL) {
+                free(obuf);
+            }
+            return 0;
+        }
+        ent_spec_code = strrchr((char *) obuf, '.');
+        if (ent_spec_code != NULL) {
+            ent_spec_code++;
+        } else {
+            ent_spec_code = (char *) obuf;
+        }
+
+        /*
+         * Print trap info.  
+         */
+        if (!snmp_strcat
+            (buf, buf_len, out_len, allow_realloc,
+             (const u_char *) ent_spec_code)) {
+            free(obuf);
+            return 0;
+        }
+        free(obuf);
+    } else {
+        /*
+         * Handle traps that aren't enterprise specific.  
+         */
+        sprintf(safe_bfr, "%ld", pdu->specific_type);
+        if (!snmp_strcat
+            (buf, buf_len, out_len, allow_realloc,
+             (const u_char *) safe_bfr)) {
+            return 0;
+        }
+    }
+
+    /*
+     * Finish the line.  
+     */
+    if (!snmp_strcat
+        (buf, buf_len, out_len, allow_realloc,
+         (const u_char *) ") Uptime: ")) {
+        return 0;
+    }
+    if (!snmp_strcat(buf, buf_len, out_len, allow_realloc,
+                     (const u_char *) uptime_string(pdu->time,
+                                                    safe_bfr))) {
+        return 0;
+    }
+    if (!snmp_strcat
+        (buf, buf_len, out_len, allow_realloc, (const u_char *) "\n")) {
+        return 0;
+    }
+
+    /*
+     * Finally, output the PDU variables. 
+     */
+    for (vars = pdu->variables; vars != NULL; vars = vars->next_variable) {
+        if (!snmp_strcat
+            (buf, buf_len, out_len, allow_realloc,
+             (const u_char *) "\t")) {
+            return 0;
+        }
+        if (!sprint_realloc_variable(buf, buf_len, out_len, allow_realloc,
+                                     vars->name, vars->name_length,
+                                     vars)) {
+            return 0;
+        }
+    }
+    if (!snmp_strcat
+        (buf, buf_len, out_len, allow_realloc, (const u_char *) "\n")) {
+        return 0;
+    }
+
+    /*
+     * String is already null-terminated.  That's all folks!  
+     */
+    return 1;
+}
+
+
+int
+realloc_format_trap(u_char ** buf, size_t * buf_len, size_t * out_len,
+                    int allow_realloc, const char *format_str,
+                    netsnmp_pdu *pdu, netsnmp_transport *transport)
+
+     /*
+      * Function:
+      *    Format the trap information for display in a log. Place the results
+      *    in the specified buffer (truncating to the length of the buffer).
+      *    Returns the number of characters it put in the buffer.
+      *
+      * Input Parameters:
+      *    buf, buf_len, out_len, allow_realloc - standard relocatable
+      *                                           buffer parameters
+      *    format_str - specifies how to format the trap info
+      *    pdu        - the pdu information
+      *    transport  - the transport descriptor
+      */
+{
+    unsigned long   fmt_idx = 0;        /* index into the format string */
+    options_type    options;    /* formatting options */
+    parse_state_type state = PARSE_NORMAL;      /* state of the parser */
+    char            next_chr;   /* for speed */
+    int             reset_options = TRUE;       /* reset opts on next NORMAL state */
+
+    if (buf == NULL) {
+        return 0;
+    }
+
+    /*
+     * Go until we reach the end of the format string:  
+     */
+    for (fmt_idx = 0; format_str[fmt_idx] != '\0'; fmt_idx++) {
+        next_chr = format_str[fmt_idx];
+        switch (state) {
+        case PARSE_NORMAL:
+            /*
+             * Looking for next character.  
+             */
+            if (reset_options) {
+                init_options(&options);
+                reset_options = FALSE;
+            }
+            if (next_chr == '\\') {
+                state = PARSE_BACKSLASH;
+            } else if (next_chr == CHR_FMT_DELIM) {
+                state = PARSE_IN_FORMAT;
+            } else {
+                if ((*out_len + 1) >= *buf_len) {
+                    if (!(allow_realloc && snmp_realloc(buf, buf_len))) {
+                        return 0;
+                    }
+                }
+                *(*buf + *out_len) = next_chr;
+                (*out_len)++;
+            }
+            break;
+
+        case PARSE_BACKSLASH:
+            /*
+             * Found a backslash.  
+             */
+            if (!realloc_handle_backslash
+                (buf, buf_len, out_len, allow_realloc, next_chr)) {
+                return 0;
+            }
+            state = PARSE_NORMAL;
+            break;
+
+        case PARSE_IN_FORMAT:
+            /*
+             * In a format command.  
+             */
+            reset_options = TRUE;
+            if (next_chr == CHR_LEFT_JUST) {
+                options.left_justify = TRUE;
+            } else if (next_chr == CHR_LEAD_ZERO) {
+                options.leading_zeroes = TRUE;
+            } else if (next_chr == CHR_ALT_FORM) {
+                options.alt_format = TRUE;
+            } else if (next_chr == CHR_FIELD_SEP) {
+                state = PARSE_GET_PRECISION;
+            } else if ((next_chr >= '1') && (next_chr <= '9')) {
+                options.width =
+                    ((unsigned long) next_chr) - ((unsigned long) '0');
+                state = PARSE_GET_WIDTH;
+            } else if (is_fmt_cmd(next_chr)) {
+                options.cmd = next_chr;
+                if (!realloc_dispatch_format_cmd
+                    (buf, buf_len, out_len, allow_realloc, &options, pdu,
+                     transport)) {
+                    return 0;
+                }
+                state = PARSE_NORMAL;
+            } else {
+                if ((*out_len + 1) >= *buf_len) {
+                    if (!(allow_realloc && snmp_realloc(buf, buf_len))) {
+                        return 0;
+                    }
+                }
+                *(*buf + *out_len) = next_chr;
+                (*out_len)++;
+                state = PARSE_NORMAL;
+            }
+            break;
+
+        case PARSE_GET_WIDTH:
+            /*
+             * Parsing a width field.  
+             */
+            reset_options = TRUE;
+            if (isdigit(next_chr)) {
+                options.width *= 10;
+                options.width +=
+                    (unsigned long) next_chr - (unsigned long) '0';
+            } else if (next_chr == CHR_FIELD_SEP) {
+                state = PARSE_GET_PRECISION;
+            } else if (is_fmt_cmd(next_chr)) {
+                options.cmd = next_chr;
+                if (!realloc_dispatch_format_cmd
+                    (buf, buf_len, out_len, allow_realloc, &options, pdu,
+                     transport)) {
+                    return 0;
+                }
+                state = PARSE_NORMAL;
+            } else {
+                if ((*out_len + 1) >= *buf_len) {
+                    if (!(allow_realloc && snmp_realloc(buf, buf_len))) {
+                        return 0;
+                    }
+                }
+                *(*buf + *out_len) = next_chr;
+                (*out_len)++;
+                state = PARSE_NORMAL;
+            }
+            break;
+
+        case PARSE_GET_PRECISION:
+            /*
+             * Parsing a precision field.  
+             */
+            reset_options = TRUE;
+            if (isdigit(next_chr)) {
+                if (options.precision == UNDEF_PRECISION) {
+                    options.precision =
+                        (unsigned long) next_chr - (unsigned long) '0';
+                } else {
+                    options.precision *= 10;
+                    options.precision +=
+                        (unsigned long) next_chr - (unsigned long) '0';
+                }
+            } else if (is_fmt_cmd(next_chr)) {
+                options.cmd = next_chr;
+                if (options.width < options.precision) {
+                    options.width = options.precision;
+                }
+                if (!realloc_dispatch_format_cmd
+                    (buf, buf_len, out_len, allow_realloc, &options, pdu,
+                     transport)) {
+                    return 0;
+                }
+                state = PARSE_NORMAL;
+            } else {
+                if ((*out_len + 1) >= *buf_len) {
+                    if (!(allow_realloc && snmp_realloc(buf, buf_len))) {
+                        return 0;
+                    }
+                }
+                *(*buf + *out_len) = next_chr;
+                (*out_len)++;
+                state = PARSE_NORMAL;
+            }
+            break;
+
+        default:
+            /*
+             * Unknown state.  
+             */
+            reset_options = TRUE;
+            if ((*out_len + 1) >= *buf_len) {
+                if (!(allow_realloc && snmp_realloc(buf, buf_len))) {
+                    return 0;
+                }
+            }
+            *(*buf + *out_len) = next_chr;
+            (*out_len)++;
+            state = PARSE_NORMAL;
+        }
+    }
+
+    *(*buf + *out_len) = '\0';
+    return 1;
+}
diff -Naur tomato/release/src/router/snmp/apps/snmptrapd_log.h tomato121/release/src/router/snmp/apps/snmptrapd_log.h
--- tomato/release/src/router/snmp/apps/snmptrapd_log.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/apps/snmptrapd_log.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,18 @@
+#ifndef  _SNMPTRAPD_LOG_H
+#define  _SNMPTRAPD_LOG_H
+
+#define NETSNMP_DS_APP_NUMERIC_IP  8    /* must not conflict with agent's DS booleans */
+
+int             realloc_format_trap(u_char ** buf, size_t * buf_len,
+                                    size_t * out_len, int allow_realloc,
+                                    const char *format_str,
+                                    netsnmp_pdu *pdu,
+                                    struct netsnmp_transport_s *transport);
+
+int             realloc_format_plain_trap(u_char ** buf, size_t * buf_len,
+                                          size_t * out_len,
+                                          int allow_realloc,
+                                          netsnmp_pdu *pdu,
+                                          struct netsnmp_transport_s
+                                          *transport);
+#endif                          /* _SNMPTRAPD_LOG_H */
diff -Naur tomato/release/src/router/snmp/apps/snmpusm.c tomato121/release/src/router/snmp/apps/snmpusm.c
--- tomato/release/src/router/snmp/apps/snmpusm.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/apps/snmpusm.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,534 @@
+/*
+ * snmpusm.c - send snmp SET requests to a network entity to change the
+ *             usm user database
+ *
+ * XXX get engineID dynamicly.
+ * XXX read passwords from prompts
+ * XXX customize responses with user names, etc.
+ */
+#include <net-snmp/net-snmp-config.h>
+
+#if HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#if HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#if HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+#include <sys/types.h>
+#if HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+#include <stdio.h>
+#include <ctype.h>
+#if TIME_WITH_SYS_TIME
+# ifdef WIN32
+#  include <sys/timeb.h>
+# else
+#  include <sys/time.h>
+# endif
+# include <time.h>
+#else
+# if HAVE_SYS_TIME_H
+#  include <sys/time.h>
+# else
+#  include <time.h>
+# endif
+#endif
+#if HAVE_SYS_SELECT_H
+#include <sys/select.h>
+#endif
+#if HAVE_WINSOCK_H
+#include <winsock.h>
+#endif
+#if HAVE_NETDB_H
+#include <netdb.h>
+#endif
+#if HAVE_ARPA_INET_H
+#include <arpa/inet.h>
+#endif
+
+#include <net-snmp/net-snmp-includes.h>
+
+int             main(int, char **);
+
+#define CMD_PASSWD_NAME    "passwd"
+#define CMD_PASSWD         1
+#define CMD_CREATE_NAME    "create"
+#define CMD_CREATE         2
+#define CMD_DELETE_NAME    "delete"
+#define CMD_DELETE         3
+#define CMD_CLONEFROM_NAME "cloneFrom"
+#define CMD_CLONEFROM      4
+
+#define CMD_NUM    4
+
+static const char *successNotes[CMD_NUM] = {
+    "SNMPv3 Key(s) successfully changed.",
+    "User successfully created.",
+    "User successfully deleted.",
+    "User successfully cloned."
+};
+
+#define                   USM_OID_LEN    12
+
+static oid      authKeyOid[MAX_OID_LEN] =
+    { 1, 3, 6, 1, 6, 3, 15, 1, 2, 2, 1, 6 }, ownAuthKeyOid[MAX_OID_LEN] = {
+1, 3, 6, 1, 6, 3, 15, 1, 2, 2, 1, 7}, privKeyOid[MAX_OID_LEN] = {
+1, 3, 6, 1, 6, 3, 15, 1, 2, 2, 1, 9}, ownPrivKeyOid[MAX_OID_LEN] = {
+1, 3, 6, 1, 6, 3, 15, 1, 2, 2, 1, 10}, usmUserCloneFrom[MAX_OID_LEN] = {
+1, 3, 6, 1, 6, 3, 15, 1, 2, 2, 1, 4}, usmUserSecurityName[MAX_OID_LEN] = {
+1, 3, 6, 1, 6, 3, 15, 1, 2, 2, 1, 3}, usmUserStatus[MAX_OID_LEN] = {
+1, 3, 6, 1, 6, 3, 15, 1, 2, 2, 1, 13}
+
+;
+
+static
+oid            *authKeyChange = authKeyOid, *privKeyChange = privKeyOid;
+int             doauthkey = 0, doprivkey = 0;
+
+void
+usage(void)
+{
+    fprintf(stderr, "Usage: snmpusm ");
+    snmp_parse_args_usage(stderr);
+    fprintf(stderr, " COMMAND\n\n");
+    snmp_parse_args_descriptions(stderr);
+    fprintf(stderr, "\nsnmpusm commands:\n");
+    fprintf(stderr, "  create    USER [CLONEFROM-USER]\n");
+    fprintf(stderr, "  delete    USER\n");
+    fprintf(stderr, "  cloneFrom USER CLONEFROM-USER\n");
+    fprintf(stderr,
+            "  passwd    [-Co] [-Ca] [-Cx] OLD-PASSPHRASE NEW-PASSPHRASE\n");
+    fprintf(stderr, "\t\t-Co\t\tUse the ownKeyChange objects.\n");
+    fprintf(stderr, "\t\t-Cx\t\tChange the privacy key.\n");
+    fprintf(stderr, "\t\t-Ca\t\tChange the authentication key.\n");
+}
+
+/*
+ * setup_oid appends to the oid the index for the engineid/user 
+ */
+void
+setup_oid(oid * it, size_t * len, u_char * id, size_t idlen,
+          const char *user)
+{
+    int             i, itIndex = 12;
+
+    *len = itIndex + 1 + idlen + 1 + strlen(user);
+
+    it[itIndex++] = idlen;
+    for (i = 0; i < (int) idlen; i++) {
+        it[itIndex++] = id[i];
+    }
+
+    it[itIndex++] = strlen(user);
+    for (i = 0; i < (int) strlen(user); i++) {
+        it[itIndex++] = user[i];
+    }
+
+    /*
+     * fprintf(stdout, "setup_oid: ");  
+     */
+    /*
+     * fprint_objid(stdout, it, *len);  
+     */
+    /*
+     * fprintf(stdout, "\n");  
+     */
+}
+
+static void
+optProc(int argc, char *const *argv, int opt)
+{
+    switch (opt) {
+    case 'C':
+        while (*optarg) {
+            switch (*optarg++) {
+            case 'o':
+                authKeyChange = ownAuthKeyOid;
+                privKeyChange = ownPrivKeyOid;
+                break;
+
+            case 'a':
+                doauthkey = 1;
+                break;
+
+            case 'x':
+                doprivkey = 1;
+                break;
+
+            default:
+                fprintf(stderr, "Unknown flag passed to -C: %c\n",
+                        optarg[-1]);
+                exit(1);
+            }
+        }
+        break;
+    }
+}
+
+int
+main(int argc, char *argv[])
+{
+    netsnmp_session session, *ss;
+    netsnmp_pdu    *pdu = NULL, *response = NULL;
+#ifdef notused
+    netsnmp_variable_list *vars;
+#endif
+
+    int             arg;
+#ifdef notused
+    int             count;
+    int             current_name = 0;
+    int             current_type = 0;
+    int             current_value = 0;
+    char           *names[128];
+    char            types[128];
+    char           *values[128];
+    oid             name[MAX_OID_LEN];
+#endif
+    size_t          name_length = USM_OID_LEN;
+    size_t          name_length2 = USM_OID_LEN;
+    int             status;
+    int             exitval = 0;
+    int             rval;
+    int             command = 0;
+    long            longvar;
+
+    size_t          oldKu_len = SNMP_MAXBUF_SMALL,
+        newKu_len = SNMP_MAXBUF_SMALL,
+        oldkul_len = SNMP_MAXBUF_SMALL,
+        newkul_len = SNMP_MAXBUF_SMALL, keychange_len = SNMP_MAXBUF_SMALL;
+
+    char           *newpass = NULL, *oldpass = NULL;
+    u_char          oldKu[SNMP_MAXBUF_SMALL],
+        newKu[SNMP_MAXBUF_SMALL],
+        oldkul[SNMP_MAXBUF_SMALL],
+        newkul[SNMP_MAXBUF_SMALL], keychange[SNMP_MAXBUF_SMALL];
+
+    authKeyChange = authKeyOid;
+    privKeyChange = privKeyOid;
+
+    /*
+     * get the common command line arguments 
+     */
+    switch (arg = snmp_parse_args(argc, argv, &session, "C:", optProc)) {
+    case -2:
+        exit(0);
+    case -1:
+        usage();
+        exit(1);
+    default:
+        break;
+    }
+
+    SOCK_STARTUP;
+
+    /*
+     * open an SNMP session 
+     */
+    /*
+     * Note:  this wil obtain the engineID needed below 
+     */
+    ss = snmp_open(&session);
+    if (ss == NULL) {
+        /*
+         * diagnose snmp_open errors with the input netsnmp_session pointer 
+         */
+        snmp_sess_perror("snmpusm", &session);
+        exit(1);
+    }
+
+    /*
+     * create PDU for SET request and add object names and values to request 
+     */
+    pdu = snmp_pdu_create(SNMP_MSG_SET);
+
+    if (arg >= argc) {
+        fprintf(stderr, "Please specify a opreation to perform.\n");
+        usage();
+        exit(1);
+    }
+
+    if (strcmp(argv[arg], CMD_PASSWD_NAME) == 0) {
+
+        /*
+         * passwd: change a users password.
+         *
+         * XXX:  Uses the auth type of the calling user, a MD5 user can't
+         *       change a SHA user's key.
+         */
+        command = CMD_PASSWD;
+        oldpass = argv[++arg];
+        newpass = argv[++arg];
+
+        if (doprivkey == 0 && doauthkey == 0)
+            doprivkey = doauthkey = 1;
+
+        if (newpass == NULL || strlen(newpass) < USM_LENGTH_P_MIN) {
+            fprintf(stderr,
+                    "New passphrase must be greater than %d characters in length.\n",
+                    USM_LENGTH_P_MIN);
+            exit(1);
+        }
+
+        if (oldpass == NULL || strlen(oldpass) < USM_LENGTH_P_MIN) {
+            fprintf(stderr,
+                    "Old passphrase must be greater than %d characters in length.\n",
+                    USM_LENGTH_P_MIN);
+            exit(1);
+        }
+
+        /*
+         * do we have a securityName?  If not, copy the default 
+         */
+        if (session.securityName == NULL) {
+            session.securityName = 
+	      strdup(netsnmp_ds_get_string(NETSNMP_DS_LIBRARY_ID, 
+					   NETSNMP_DS_LIB_SECNAME));
+        }
+
+        /*
+         * the old Ku is in the session, but we need the new one 
+         */
+        if (session.securityAuthProto == NULL) {
+            /*
+             * get .conf set default 
+             */
+            const oid      *def =
+                get_default_authtype(&session.securityAuthProtoLen);
+            session.securityAuthProto =
+                snmp_duplicate_objid(def, session.securityAuthProtoLen);
+        }
+        if (session.securityAuthProto == NULL) {
+            /*
+             * assume MD5 
+             */
+            session.securityAuthProtoLen =
+                sizeof(usmHMACMD5AuthProtocol) / sizeof(oid);
+            session.securityAuthProto =
+                snmp_duplicate_objid(usmHMACMD5AuthProtocol,
+                                     session.securityAuthProtoLen);
+        }
+        rval = generate_Ku(session.securityAuthProto,
+                           session.securityAuthProtoLen,
+                           (u_char *) newpass, strlen(newpass),
+                           newKu, &newKu_len);
+
+        if (rval != SNMPERR_SUCCESS) {
+            snmp_perror(argv[0]);
+            fprintf(stderr, "generating the old Ku failed\n");
+            exit(1);
+        }
+
+        /*
+         * the old Ku is in the session, but we need the new one 
+         */
+        rval = generate_Ku(session.securityAuthProto,
+                           session.securityAuthProtoLen,
+                           (u_char *) oldpass, strlen(oldpass),
+                           oldKu, &oldKu_len);
+
+        if (rval != SNMPERR_SUCCESS) {
+            snmp_perror(argv[0]);
+            fprintf(stderr, "generating the new Ku failed\n");
+            exit(1);
+        }
+
+        /*
+         * generate the two Kul's 
+         */
+        rval = generate_kul(session.securityAuthProto,
+                            session.securityAuthProtoLen,
+                            ss->contextEngineID, ss->contextEngineIDLen,
+                            oldKu, oldKu_len, oldkul, &oldkul_len);
+
+        if (rval != SNMPERR_SUCCESS) {
+            snmp_perror(argv[0]);
+            fprintf(stderr, "generating the old Kul failed\n");
+            exit(1);
+        }
+
+        rval = generate_kul(session.securityAuthProto,
+                            session.securityAuthProtoLen,
+                            ss->contextEngineID, ss->contextEngineIDLen,
+                            newKu, newKu_len, newkul, &newkul_len);
+
+        if (rval != SNMPERR_SUCCESS) {
+            snmp_perror(argv[0]);
+            fprintf(stderr, "generating the new Kul failed\n");
+            exit(1);
+        }
+
+        /*
+         * create the keychange string 
+         */
+        rval = encode_keychange(session.securityAuthProto,
+                                session.securityAuthProtoLen,
+                                oldkul, oldkul_len,
+                                newkul, newkul_len,
+                                keychange, &keychange_len);
+
+        if (rval != SNMPERR_SUCCESS) {
+            snmp_perror(argv[0]);
+            fprintf(stderr, "encoding the keychange failed\n");
+            usage();
+            exit(1);
+        }
+
+        /*
+         * add the keychange string to the outgoing packet 
+         */
+        if (doauthkey) {
+            setup_oid(authKeyChange, &name_length,
+                      ss->contextEngineID, ss->contextEngineIDLen,
+                      session.securityName);
+            snmp_pdu_add_variable(pdu, authKeyChange, name_length,
+                                  ASN_OCTET_STR, keychange, keychange_len);
+        }
+        if (doprivkey) {
+            setup_oid(privKeyChange, &name_length,
+                      ss->contextEngineID, ss->contextEngineIDLen,
+                      session.securityName);
+            snmp_pdu_add_variable(pdu, privKeyChange, name_length,
+                                  ASN_OCTET_STR, keychange, keychange_len);
+        }
+
+    } else if (strcmp(argv[arg], CMD_CREATE_NAME) == 0) {
+        /*
+         * create:  create a user
+         *
+         * create USER [CLONEFROM]
+         */
+        if (++arg >= argc) {
+            fprintf(stderr, "You must specify the user name to create\n");
+            usage();
+            exit(1);
+        }
+
+        command = CMD_CREATE;
+        setup_oid(usmUserStatus, &name_length,
+                  ss->contextEngineID, ss->contextEngineIDLen, argv[arg]);
+        longvar = RS_CREATEANDGO;
+        snmp_pdu_add_variable(pdu, usmUserStatus, name_length,
+                              ASN_INTEGER, (u_char *) & longvar,
+                              sizeof(longvar));
+
+        if (++arg < argc) {
+            /*
+             * clone the new user from another user as well 
+             */
+            setup_oid(usmUserCloneFrom, &name_length,
+                      ss->contextEngineID, ss->contextEngineIDLen,
+                      argv[arg - 1]);
+            setup_oid(usmUserSecurityName, &name_length2,
+                      ss->contextEngineID, ss->contextEngineIDLen,
+                      argv[arg]);
+            snmp_pdu_add_variable(pdu, usmUserCloneFrom, name_length,
+                                  ASN_OBJECT_ID,
+                                  (u_char *) usmUserSecurityName,
+                                  sizeof(oid) * name_length2);
+        }
+
+    } else if (strcmp(argv[arg], CMD_CLONEFROM_NAME) == 0) {
+        /*
+         * create:  clone a user from another
+         *
+         * cloneFrom USER FROM
+         */
+        if (++arg >= argc) {
+            fprintf(stderr,
+                    "You must specify the user name to operate on\n");
+            usage();
+            exit(1);
+        }
+
+        command = CMD_CLONEFROM;
+        setup_oid(usmUserCloneFrom, &name_length,
+                  ss->contextEngineID, ss->contextEngineIDLen, argv[arg]);
+
+        if (++arg >= argc) {
+            fprintf(stderr,
+                    "You must specify the user name to clone from\n");
+            usage();
+            exit(1);
+        }
+
+        setup_oid(usmUserSecurityName, &name_length2,
+                  ss->contextEngineID, ss->contextEngineIDLen, argv[arg]);
+        snmp_pdu_add_variable(pdu, usmUserCloneFrom, name_length,
+                              ASN_OBJECT_ID,
+                              (u_char *) usmUserSecurityName,
+                              sizeof(oid) * name_length2);
+
+    } else if (strcmp(argv[arg], CMD_DELETE_NAME) == 0) {
+        /*
+         * delete:  delete a user
+         *
+         * delete USER
+         */
+        if (++arg >= argc) {
+            fprintf(stderr, "You must specify the user name to delete\n");
+            exit(1);
+        }
+
+        command = CMD_DELETE;
+        setup_oid(usmUserStatus, &name_length,
+                  ss->contextEngineID, ss->contextEngineIDLen, argv[arg]);
+        longvar = RS_DESTROY;
+        snmp_pdu_add_variable(pdu, usmUserStatus, name_length,
+                              ASN_INTEGER, (u_char *) & longvar,
+                              sizeof(longvar));
+    } else {
+        fprintf(stderr, "Unknown command\n");
+        usage();
+        exit(1);
+    }
+
+
+    /*
+     * do the request 
+     */
+    status = snmp_synch_response(ss, pdu, &response);
+    if (status == STAT_SUCCESS) {
+        if (response) {
+            if (response->errstat == SNMP_ERR_NOERROR) {
+                fprintf(stderr, "%s\n", successNotes[command - 1]);
+            } else {
+                fprintf(stderr, "Error in packet.\nReason: %s\n",
+                        snmp_errstring(response->errstat));
+                if (response->errindex != 0) {
+                    int             count;
+                    netsnmp_variable_list *vars;
+                    fprintf(stderr, "Failed object: ");
+                    for (count = 1, vars = response->variables;
+                         vars && count != response->errindex;
+                         vars = vars->next_variable, count++)
+                        /*EMPTY*/;
+                    if (vars)
+                        fprint_objid(stderr, vars->name,
+                                     vars->name_length);
+                    fprintf(stderr, "\n");
+                }
+                exitval = 2;
+            }
+        }
+    } else if (status == STAT_TIMEOUT) {
+        fprintf(stderr, "Timeout: No Response from %s\n",
+                session.peername);
+        exitval = 1;
+    } else {                    /* status == STAT_ERROR */
+        snmp_sess_perror("snmpset", ss);
+        exitval = 1;
+    }
+
+    if (response)
+        snmp_free_pdu(response);
+    snmp_close(ss);
+    SOCK_CLEANUP;
+    return exitval;
+}
diff -Naur tomato/release/src/router/snmp/apps/snmpvacm.c tomato121/release/src/router/snmp/apps/snmpvacm.c
--- tomato/release/src/router/snmp/apps/snmpvacm.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/apps/snmpvacm.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,576 @@
+/*
+ * snmpvacm.c - send snmp SET requests to a network entity to change the
+ *             vacm database
+ *
+ */
+#include <net-snmp/net-snmp-config.h>
+
+#if HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#if HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#if HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+#include <sys/types.h>
+#if HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+#include <stdio.h>
+#include <ctype.h>
+#if TIME_WITH_SYS_TIME
+# ifdef WIN32
+#  include <sys/timeb.h>
+# else
+#  include <sys/time.h>
+# endif
+# include <time.h>
+#else
+# if HAVE_SYS_TIME_H
+#  include <sys/time.h>
+# else
+#  include <time.h>
+# endif
+#endif
+#if HAVE_SYS_SELECT_H
+#include <sys/select.h>
+#endif
+#if HAVE_WINSOCK_H
+#include <winsock.h>
+#endif
+#if HAVE_NETDB_H
+#include <netdb.h>
+#endif
+#if HAVE_ARPA_INET_H
+#include <arpa/inet.h>
+#endif
+
+#include <net-snmp/net-snmp-includes.h>
+
+int             main(int, char **);
+
+#define CMD_CREATESEC2GROUP_NAME    "createSec2Group"
+#define CMD_CREATESEC2GROUP         1
+#define CMD_DELETESEC2GROUP_NAME    "deleteSec2Group"
+#define CMD_DELETESEC2GROUP         2
+#define CMD_CREATEACCESS_NAME    	"createAccess"
+#define CMD_CREATEACCESS         	3
+#define CMD_DELETEACCESS_NAME 		"deleteAccess"
+#define CMD_DELETEACCESS      		4
+#define CMD_CREATEVIEW_NAME 		"createView"
+#define CMD_CREATEVIEW      		5
+#define CMD_DELETEVIEW_NAME 		"deleteView"
+#define CMD_DELETEVIEW      		6
+
+#define CMD_NUM    6
+
+static const char *successNotes[CMD_NUM] = {
+    "Sec2group successfully created.",
+    "Sec2group successfully deleted.",
+    "Access successfully created.",
+    "Access successfully deleted.",
+    "View successfully created.",
+    "View successfully deleted."
+};
+
+#define                   SEC2GROUP_OID_LEN	11
+#define                   ACCESS_OID_LEN   	11
+#define                   VIEW_OID_LEN    	12
+
+static oid      vacmGroupName[MAX_OID_LEN] =
+    { 1, 3, 6, 1, 6, 3, 16, 1, 2, 1, 3 },
+    vacmSec2GroupStorageType[MAX_OID_LEN] = {
+1, 3, 6, 1, 6, 3, 16, 1, 2, 1, 4}, vacmSec2GroupStatus[MAX_OID_LEN] = {
+1, 3, 6, 1, 6, 3, 16, 1, 2, 1, 5}, vacmAccessContextMatch[MAX_OID_LEN] = {
+1, 3, 6, 1, 6, 3, 16, 1, 4, 1, 4}, vacmAccessReadViewName[MAX_OID_LEN] = {
+1, 3, 6, 1, 6, 3, 16, 1, 4, 1, 5}, vacmAccessWriteViewName[MAX_OID_LEN] = {
+1, 3, 6, 1, 6, 3, 16, 1, 4, 1, 6}, vacmAccessNotifyViewName[MAX_OID_LEN] = {
+1, 3, 6, 1, 6, 3, 16, 1, 4, 1, 7}, vacmAccessStorageType[MAX_OID_LEN] = {
+1, 3, 6, 1, 6, 3, 16, 1, 4, 1, 8}, vacmAccessStatus[MAX_OID_LEN] = {
+1, 3, 6, 1, 6, 3, 16, 1, 4, 1, 9}, vacmViewTreeFamilyMask[MAX_OID_LEN] = {
+1, 3, 6, 1, 6, 3, 16, 1, 5, 2, 1, 3}, vacmViewTreeFamilyType[MAX_OID_LEN] = {
+1, 3, 6, 1, 6, 3, 16, 1, 5, 2, 1, 4},
+    vacmViewTreeFamilyStorageType[MAX_OID_LEN] = {
+1, 3, 6, 1, 6, 3, 16, 1, 5, 2, 1, 5},
+    vacmViewTreeFamilyStatus[MAX_OID_LEN] = {
+1, 3, 6, 1, 6, 3, 16, 1, 5, 2, 1, 6}
+
+;
+
+int             viewTreeFamilyType = 1;
+
+void
+usage(void)
+{
+    fprintf(stderr, "Usage: snmpvacm ");
+    snmp_parse_args_usage(stderr);
+    fprintf(stderr, " COMMAND\n\n");
+    snmp_parse_args_descriptions(stderr);
+    fprintf(stderr, "\nsnmpvacm commands:\n");
+    fprintf(stderr,
+            "                createAccess     GROUPNAME [CONTEXTPREFIX] SECURITYMODEL SECURITYLEVEL CONTEXTMATCH READVIEWNAME WRITEVIEWNAME NOTIFYVIEWNAME\n");
+    fprintf(stderr,
+            "                deleteAccess     GROUPNAME [CONTEXTPREFIX] SECURITYMODEL SECURITYLEVEL\n");
+    fprintf(stderr, "        createSec2Group  MODEL SECURITYNAME  GROUPNAME\n");
+    fprintf(stderr, "        deleteSec2Group  MODEL SECURITYNAME\n");
+    fprintf(stderr, "  [-Ce] createView       NAME SUBTREE MASK\n");
+    fprintf(stderr, "        deleteView       NAME SUBTREE\n");
+}
+
+
+void
+access_oid(oid * it, size_t * len, const char *groupName,
+           const char *prefix, int model, int level)
+{
+    int             i;
+
+    int             itIndex = ACCESS_OID_LEN;
+
+    *len = itIndex + 4 + +strlen(groupName);
+
+    it[itIndex++] = strlen(groupName);
+    for (i = 0; i < (int) strlen(groupName); i++)
+        it[itIndex++] = groupName[i];
+
+    if (prefix) {
+        *len += strlen(prefix);
+        it[itIndex++] = strlen(prefix);
+        for (i = 0; i < (int) strlen(prefix); i++)
+            it[itIndex++] = prefix[i];
+    } else
+        it[itIndex++] = 0;
+
+    it[itIndex++] = model;
+    it[itIndex++] = level;
+}
+
+
+void
+sec2group_oid(oid * it, size_t * len, int model, const char *name)
+{
+    int             i;
+
+    int             itIndex = SEC2GROUP_OID_LEN;
+
+    *len = itIndex + 2 + strlen(name);
+
+    it[itIndex++] = model;
+
+    it[itIndex++] = strlen(name);
+    for (i = 0; i < (int) strlen(name); i++)
+        it[itIndex++] = name[i];
+}
+
+void
+view_oid(oid * it, size_t * len, const char *viewName, char *viewSubtree)
+{
+    int             i;
+    oid             c_oid[SPRINT_MAX_LEN];
+    size_t          c_oid_length = SPRINT_MAX_LEN;
+
+    int             itIndex = VIEW_OID_LEN;
+
+    if (!read_objid(viewSubtree, c_oid, &c_oid_length)) {
+        printf("Error parsing subtree\n");
+        exit(1);
+    }
+
+    *len = itIndex + 2 + strlen(viewName) + c_oid_length;
+
+    it[itIndex++] = strlen(viewName);
+    for (i = 0; i < (int) strlen(viewName); i++)
+        it[itIndex++] = viewName[i];
+
+    
+    it[itIndex++] = c_oid_length;
+    for (i = 0; i < (int) c_oid_length; i++)
+        it[itIndex++] = c_oid[i];
+
+    /*
+     * sprint_objid(c_oid, it, *len); 
+     */
+}
+
+static void
+optProc(int argc, char *const *argv, int opt)
+{
+    switch (opt) {
+    case 'C':
+        while (*optarg) {
+            switch (*optarg++) {
+            case 'e':
+                viewTreeFamilyType = 2;
+                break;
+
+            default:
+                fprintf(stderr,
+                        "Unknown flag passed to -C: %c\n", optarg[-1]);
+                exit(1);
+            }
+        }
+        break;
+    }
+}
+
+
+int
+main(int argc, char *argv[])
+{
+    netsnmp_session session, *ss;
+    netsnmp_pdu    *pdu = NULL, *response = NULL;
+#ifdef notused
+    netsnmp_variable_list *vars;
+#endif
+
+    int             arg;
+#ifdef notused
+    int             count;
+    int             current_name = 0;
+    int             current_type = 0;
+    int             current_value = 0;
+    char           *names[128];
+    char            types[128];
+    char           *values[128];
+    oid             name[MAX_OID_LEN];
+#endif
+    size_t          name_length;
+    int             status;
+    int             exitval = 0;
+    int             command = 0;
+    long            longvar;
+    int             secModel, secLevel, contextMatch, val, i = 0;
+    char           *mask, *groupName, *prefix;
+    u_char          viewMask[VACMSTRINGLEN];
+
+
+    /*
+     * get the common command line arguments 
+     */
+    switch (arg = snmp_parse_args(argc, argv, &session, "C:", optProc)) {
+    case -2:
+        exit(0);
+    case -1:
+        usage();
+        exit(1);
+    default:
+        break;
+    }
+
+
+    SOCK_STARTUP;
+
+    /*
+     * open an SNMP session 
+     */
+    /*
+     * Note:  this wil obtain the engineID needed below 
+     */
+    ss = snmp_open(&session);
+    if (ss == NULL) {
+        /*
+         * diagnose snmp_open errors with the input netsnmp_session pointer 
+         */
+        snmp_sess_perror("snmpvacm", &session);
+        exit(1);
+    }
+
+    /*
+     * create PDU for SET request and add object names and values to request 
+     */
+    pdu = snmp_pdu_create(SNMP_MSG_SET);
+
+    if (arg >= argc) {
+        fprintf(stderr, "Please specify a opreation to perform.\n");
+        usage();
+        exit(1);
+    }
+
+    if (strcmp(argv[arg], CMD_DELETEVIEW_NAME) == 0)
+        /*
+         * deleteView: delete a view
+         *
+         * deleteView NAME SUBTREE
+         *
+         */
+    {
+        if (++arg + 2 != argc) {
+            fprintf(stderr, "You must specify the view to delete\n");
+            usage();
+            exit(1);
+        }
+
+        command = CMD_DELETEVIEW;
+        name_length = VIEW_OID_LEN;
+        view_oid(vacmViewTreeFamilyStatus, &name_length, argv[arg],
+                 argv[arg + 1]);
+        longvar = RS_DESTROY;
+        snmp_pdu_add_variable(pdu, vacmViewTreeFamilyStatus, name_length,
+                              ASN_INTEGER, (u_char *) & longvar,
+                              sizeof(longvar));
+    } else if (strcmp(argv[arg], CMD_CREATEVIEW_NAME) == 0)
+        /*
+         * createView: create a view
+         *
+         * createView NAME SUBTREE MASK
+         *
+         */
+    {
+        if (++arg + 3 > argc) {
+            fprintf(stderr, "You must specify name, subtree and mask\n");
+            usage();
+            exit(1);
+        }
+        command = CMD_CREATEVIEW;
+        name_length = VIEW_OID_LEN;
+        view_oid(vacmViewTreeFamilyStatus, &name_length, argv[arg],
+                 argv[arg + 1]);
+        longvar = RS_CREATEANDGO;
+        snmp_pdu_add_variable(pdu, vacmViewTreeFamilyStatus, name_length,
+                              ASN_INTEGER, (u_char *) & longvar,
+                              sizeof(longvar));
+
+        /*
+         * Mask
+         */
+        mask = argv[arg + 2];
+        for (mask = strtok(mask, ".:"); mask; mask = strtok(NULL, ".:")) {
+            if (i >= sizeof(viewMask)) {
+                printf("MASK too long\n");
+                exit(1);
+            }
+            if (sscanf(mask, "%x", &val) == 0) {
+                printf("invalid MASK\n");
+                exit(1);
+            }
+            viewMask[i] = val;
+            i++;
+        }
+        view_oid(vacmViewTreeFamilyMask, &name_length, argv[arg],
+                 argv[arg + 1]);
+        snmp_pdu_add_variable(pdu, vacmViewTreeFamilyMask, name_length,
+                              ASN_OCTET_STR, viewMask, i);
+
+        view_oid(vacmViewTreeFamilyType, &name_length, argv[arg],
+                 argv[arg + 1]);
+        snmp_pdu_add_variable(pdu, vacmViewTreeFamilyType, name_length,
+                              ASN_INTEGER, (u_char *) & viewTreeFamilyType,
+                              sizeof(viewTreeFamilyType));
+
+    } else if (strcmp(argv[arg], CMD_DELETESEC2GROUP_NAME) == 0)
+        /*
+         * deleteSec2Group: delete security2group
+         *
+         * deleteSec2Group  MODEL SECURITYNAME
+         *
+         */
+    {
+        if (++arg + 2 != argc) {
+            fprintf(stderr, "You must specify the sec2group to delete\n");
+            usage();
+            exit(1);
+        }
+
+        command = CMD_DELETESEC2GROUP;
+        name_length = SEC2GROUP_OID_LEN;
+        if (sscanf(argv[arg], "%d", &secModel) == 0) {
+            printf("invalid security model\n");
+            usage();
+            exit(1);
+        }
+        sec2group_oid(vacmSec2GroupStatus, &name_length, secModel,
+                      argv[arg + 1]);
+        longvar = RS_DESTROY;
+        snmp_pdu_add_variable(pdu, vacmSec2GroupStatus, name_length,
+                              ASN_INTEGER, (u_char *) & longvar,
+                              sizeof(longvar));
+    } else if (strcmp(argv[arg], CMD_CREATESEC2GROUP_NAME) == 0)
+        /*
+         * createSec2Group: create a security2group
+         *
+         * createSec2Group  MODEL SECURITYNAME GROUPNAME
+         *
+         */
+    {
+        if (++arg + 3 != argc) {
+            fprintf(stderr,
+                    "You must specify model, security name and group name\n");
+            usage();
+            exit(1);
+        }
+
+        command = CMD_CREATESEC2GROUP;
+        name_length = SEC2GROUP_OID_LEN;
+        if (sscanf(argv[arg], "%d", &secModel) == 0) {
+            printf("invalid security model\n");
+            usage();
+            exit(1);
+        }
+        sec2group_oid(vacmSec2GroupStatus, &name_length, secModel,
+                      argv[arg + 1]);
+        longvar = RS_CREATEANDGO;
+        snmp_pdu_add_variable(pdu, vacmSec2GroupStatus, name_length,
+                              ASN_INTEGER, (u_char *) & longvar,
+                              sizeof(longvar));
+        sec2group_oid(vacmGroupName, &name_length, secModel,
+                      argv[arg + 1]);
+        snmp_pdu_add_variable(pdu, vacmGroupName, name_length,
+                              ASN_OCTET_STR, (u_char *) argv[arg + 2],
+                              strlen(argv[arg + 2]));
+    } else if (strcmp(argv[arg], CMD_DELETEACCESS_NAME) == 0)
+        /*
+         * deleteAccess: delete access entry
+         *
+         * deleteAccess  GROUPNAME [CONTEXTPREFIX] SECURITYMODEL SECURITYLEVEL
+         *
+         */
+    {
+        if (++arg + 3 > argc) {
+            fprintf(stderr,
+                    "You must specify the access entry to delete\n");
+            usage();
+            exit(1);
+        }
+
+        command = CMD_DELETEACCESS;
+        name_length = ACCESS_OID_LEN;
+        groupName = argv[arg];
+        if (arg + 4 == argc)
+            prefix = argv[++arg];
+        else
+            prefix = NULL;
+
+        if (sscanf(argv[arg + 1], "%d", &secModel) == 0) {
+            printf("invalid security model\n");
+            usage();
+            exit(1);
+        }
+        if (sscanf(argv[arg + 2], "%d", &secLevel) == 0) {
+            printf("invalid security level\n");
+            usage();
+            exit(1);
+        }
+        access_oid(vacmAccessStatus, &name_length, groupName, prefix,
+                   secModel, secLevel);
+        longvar = RS_DESTROY;
+        snmp_pdu_add_variable(pdu, vacmAccessStatus, name_length,
+                              ASN_INTEGER, (u_char *) & longvar,
+                              sizeof(longvar));
+    } else if (strcmp(argv[arg], CMD_CREATEACCESS_NAME) == 0)
+        /*
+         * createAccess: create access entry
+         *
+         * createAccess  GROUPNAME [CONTEXTPREFIX] SECURITYMODEL SECURITYLEVEL CONTEXTMATCH READVIEWNAME WRITEVIEWNAME NOTIFYVIEWNAME
+         *
+         */
+    {
+        if (++arg + 7 > argc) {
+            fprintf(stderr,
+                    "You must specify the access entry to create\n");
+            usage();
+            exit(1);
+        }
+
+        command = CMD_CREATEACCESS;
+        name_length = ACCESS_OID_LEN;
+        groupName = argv[arg];
+        if (arg + 8 == argc)
+            prefix = argv[++arg];
+        else
+            prefix = NULL;
+
+        if (sscanf(argv[arg + 1], "%d", &secModel) == 0) {
+            printf("invalid security model\n");
+            usage();
+            exit(1);
+        }
+        if (sscanf(argv[arg + 2], "%d", &secLevel) == 0) {
+            printf("invalid security level\n");
+            usage();
+            exit(1);
+        }
+        access_oid(vacmAccessStatus, &name_length, groupName, prefix,
+                   secModel, secLevel);
+        longvar = RS_CREATEANDGO;
+        snmp_pdu_add_variable(pdu, vacmAccessStatus, name_length,
+                              ASN_INTEGER, (u_char *) & longvar,
+                              sizeof(longvar));
+
+        access_oid(vacmAccessContextMatch, &name_length, groupName, prefix,
+                   secModel, secLevel);
+        if (sscanf(argv[arg + 3], "%d", &contextMatch) == 0) {
+            printf("invalid contextMatch\n");
+            usage();
+            exit(1);
+        }
+        snmp_pdu_add_variable(pdu, vacmAccessContextMatch, name_length,
+                              ASN_INTEGER, (u_char *) & contextMatch,
+                              sizeof(contextMatch));
+
+        access_oid(vacmAccessReadViewName, &name_length, groupName, prefix,
+                   secModel, secLevel);
+        snmp_pdu_add_variable(pdu, vacmAccessReadViewName, name_length,
+                              ASN_OCTET_STR, (u_char *) argv[arg + 4],
+                              strlen(argv[arg + 4]));
+
+        access_oid(vacmAccessWriteViewName, &name_length, groupName,
+                   prefix, secModel, secLevel);
+        snmp_pdu_add_variable(pdu, vacmAccessWriteViewName, name_length,
+                              ASN_OCTET_STR, (u_char *) argv[arg + 5],
+                              strlen(argv[arg + 5]));
+
+        access_oid(vacmAccessNotifyViewName, &name_length, groupName,
+                   prefix, secModel, secLevel);
+        snmp_pdu_add_variable(pdu, vacmAccessNotifyViewName, name_length,
+                              ASN_OCTET_STR, (u_char *) argv[arg + 6],
+                              strlen(argv[arg + 6]));
+    } else {
+        printf("Unknown command\n");
+        usage();
+        exit(1);
+    }
+
+    /*
+     * do the request 
+     */
+    status = snmp_synch_response(ss, pdu, &response);
+    if (status == STAT_SUCCESS) {
+        if (response) {
+            if (response->errstat == SNMP_ERR_NOERROR) {
+                fprintf(stderr, "%s\n", successNotes[command - 1]);
+            } else {
+                fprintf(stderr, "Error in packet.\nReason: %s\n",
+                        snmp_errstring(response->errstat));
+		if (response->errindex != 0){
+		    int count;
+		    struct variable_list *vars = response->variables;
+		    fprintf(stderr, "Failed object: ");
+		    for(count = 1; vars && (count != response->errindex);
+			    vars = vars->next_variable, count++)
+			;
+		    if (vars)
+			fprint_objid(stderr, vars->name, vars->name_length);
+		    fprintf(stderr, "\n");
+		}
+                exitval = 2;
+            }
+        }
+    } else if (status == STAT_TIMEOUT) {
+        fprintf(stderr, "Timeout: No Response from %s\n",
+                session.peername);
+        exitval = 1;
+    } else {
+        snmp_sess_perror("snmpset", ss);
+        exitval = 1;
+    }
+
+    if (response)
+        snmp_free_pdu(response);
+
+    snmp_close(ss);
+    SOCK_CLEANUP;
+    return exitval;
+}
diff -Naur tomato/release/src/router/snmp/apps/snmpwalk.c tomato121/release/src/router/snmp/apps/snmpwalk.c
--- tomato/release/src/router/snmp/apps/snmpwalk.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/apps/snmpwalk.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,352 @@
+/*
+ * snmpwalk.c - send snmp GETNEXT requests to a network entity, walking a
+ * subtree.
+ *
+ */
+/**********************************************************************
+	Copyright 1988, 1989, 1991, 1992 by Carnegie Mellon University
+
+                      All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its 
+documentation for any purpose and without fee is hereby granted, 
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in 
+supporting documentation, and that the name of CMU not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.  
+
+CMU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+CMU BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+******************************************************************/
+#include <net-snmp/net-snmp-config.h>
+
+#if HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#if HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#if HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+#include <sys/types.h>
+#if HAVE_NETINET_IN_H
+# include <netinet/in.h>
+#endif
+#if TIME_WITH_SYS_TIME
+# ifdef WIN32
+#  include <sys/timeb.h>
+# else
+#  include <sys/time.h>
+# endif
+# include <time.h>
+#else
+# if HAVE_SYS_TIME_H
+#  include <sys/time.h>
+# else
+#  include <time.h>
+# endif
+#endif
+#if HAVE_SYS_SELECT_H
+#include <sys/select.h>
+#endif
+#include <stdio.h>
+#if HAVE_WINSOCK_H
+#include <winsock.h>
+#endif
+#if HAVE_NETDB_H
+#include <netdb.h>
+#endif
+#if HAVE_ARPA_INET_H
+#include <arpa/inet.h>
+#endif
+
+#include <net-snmp/net-snmp-includes.h>
+
+#define NETSNMP_DS_WALK_INCLUDE_REQUESTED	1
+#define NETSNMP_DS_WALK_PRINT_STATISTICS	2
+#define NETSNMP_DS_WALK_DONT_CHECK_LEXICOGRAPHIC	3
+
+oid             objid_mib[] = { 1, 3, 6, 1, 2, 1 };
+int             numprinted = 0;
+
+void
+usage(void)
+{
+    fprintf(stderr, "USAGE: snmpwalk ");
+    snmp_parse_args_usage(stderr);
+    fprintf(stderr, " [OID]\n\n");
+    snmp_parse_args_descriptions(stderr);
+    fprintf(stderr,
+            "  -C APPOPTS\t\tSet various application specific behaviours:\n");
+    fprintf(stderr, "\t\t\t  p:  print the number of variables found\n");
+    fprintf(stderr, "\t\t\t  i:  include given OID in the search range\n");
+    fprintf(stderr,
+            "\t\t\t  c:  do not check returned OIDs are increasing\n");
+}
+
+void
+snmp_get_and_print(netsnmp_session * ss, oid * theoid, size_t theoid_len)
+{
+    netsnmp_pdu    *pdu, *response;
+    netsnmp_variable_list *vars;
+    int             status;
+
+    pdu = snmp_pdu_create(SNMP_MSG_GET);
+    snmp_add_null_var(pdu, theoid, theoid_len);
+
+    status = snmp_synch_response(ss, pdu, &response);
+    if (status == STAT_SUCCESS && response->errstat == SNMP_ERR_NOERROR) {
+        for (vars = response->variables; vars; vars = vars->next_variable) {
+            numprinted++;
+            print_variable(vars->name, vars->name_length, vars);
+        }
+    }
+    if (response) {
+        snmp_free_pdu(response);
+    }
+}
+
+static void
+optProc(int argc, char *const *argv, int opt)
+{
+    switch (opt) {
+    case 'C':
+        while (*optarg) {
+            switch (*optarg++) {
+            case 'i':
+                netsnmp_ds_toggle_boolean(NETSNMP_DS_APPLICATION_ID,
+					  NETSNMP_DS_WALK_INCLUDE_REQUESTED);
+                break;
+
+            case 'p':
+                netsnmp_ds_toggle_boolean(NETSNMP_DS_APPLICATION_ID,
+					  NETSNMP_DS_WALK_PRINT_STATISTICS);
+                break;
+
+            case 'c':
+                netsnmp_ds_toggle_boolean(NETSNMP_DS_APPLICATION_ID,
+				    NETSNMP_DS_WALK_DONT_CHECK_LEXICOGRAPHIC);
+                break;
+            default:
+                fprintf(stderr, "Unknown flag passed to -C: %c\n",
+                        optarg[-1]);
+                exit(1);
+            }
+        }
+        break;
+    }
+}
+
+int
+main(int argc, char *argv[])
+{
+    netsnmp_session session, *ss;
+    netsnmp_pdu    *pdu, *response;
+    netsnmp_variable_list *vars;
+    int             arg;
+    oid             name[MAX_OID_LEN];
+    size_t          name_length;
+    oid             root[MAX_OID_LEN];
+    size_t          rootlen;
+    int             count;
+    int             running;
+    int             status;
+    int             check;
+    int             exitval = 0;
+
+    netsnmp_ds_register_config(ASN_BOOLEAN, "snmpwalk", "includeRequested",
+			       NETSNMP_DS_APPLICATION_ID, 
+			       NETSNMP_DS_WALK_INCLUDE_REQUESTED);
+
+    netsnmp_ds_register_config(ASN_BOOLEAN, "snmpwalk", "printStatistics",
+			       NETSNMP_DS_APPLICATION_ID, 
+			       NETSNMP_DS_WALK_PRINT_STATISTICS);
+
+    netsnmp_ds_register_config(ASN_BOOLEAN, "snmpwalk", "dontCheckOrdering",
+			       NETSNMP_DS_APPLICATION_ID,
+			       NETSNMP_DS_WALK_DONT_CHECK_LEXICOGRAPHIC);
+
+    /*
+     * get the common command line arguments 
+     */
+    switch (arg = snmp_parse_args(argc, argv, &session, "C:", optProc)) {
+    case -2:
+        exit(0);
+    case -1:
+        usage();
+        exit(1);
+    default:
+        break;
+    }
+
+    /*
+     * get the initial object and subtree 
+     */
+    if (arg < argc) {
+        /*
+         * specified on the command line 
+         */
+        rootlen = MAX_OID_LEN;
+        if (snmp_parse_oid(argv[arg], root, &rootlen) == NULL) {
+            snmp_perror(argv[arg]);
+            exit(1);
+        }
+    } else {
+        /*
+         * use default value 
+         */
+        memmove(root, objid_mib, sizeof(objid_mib));
+        rootlen = sizeof(objid_mib) / sizeof(oid);
+    }
+
+    SOCK_STARTUP;
+
+    /*
+     * open an SNMP session 
+     */
+    ss = snmp_open(&session);
+    if (ss == NULL) {
+        /*
+         * diagnose snmp_open errors with the input netsnmp_session pointer 
+         */
+        snmp_sess_perror("snmpwalk", &session);
+        SOCK_CLEANUP;
+        exit(1);
+    }
+
+    /*
+     * get first object to start walk 
+     */
+    memmove(name, root, rootlen * sizeof(oid));
+    name_length = rootlen;
+
+    running = 1;
+
+    check =
+        !netsnmp_ds_get_boolean(NETSNMP_DS_APPLICATION_ID,
+                        NETSNMP_DS_WALK_DONT_CHECK_LEXICOGRAPHIC);
+    if (netsnmp_ds_get_boolean(NETSNMP_DS_APPLICATION_ID, NETSNMP_DS_WALK_INCLUDE_REQUESTED)) {
+        snmp_get_and_print(ss, root, rootlen);
+    }
+
+    while (running) {
+        /*
+         * create PDU for GETNEXT request and add object name to request 
+         */
+        pdu = snmp_pdu_create(SNMP_MSG_GETNEXT);
+        snmp_add_null_var(pdu, name, name_length);
+
+        /*
+         * do the request 
+         */
+        status = snmp_synch_response(ss, pdu, &response);
+        if (status == STAT_SUCCESS) {
+            if (response->errstat == SNMP_ERR_NOERROR) {
+                /*
+                 * check resulting variables 
+                 */
+                for (vars = response->variables; vars;
+                     vars = vars->next_variable) {
+                    if ((vars->name_length < rootlen)
+                        || (memcmp(root, vars->name, rootlen * sizeof(oid))
+                            != 0)) {
+                        /*
+                         * not part of this subtree 
+                         */
+                        running = 0;
+                        continue;
+                    }
+                    numprinted++;
+                    print_variable(vars->name, vars->name_length, vars);
+                    if ((vars->type != SNMP_ENDOFMIBVIEW) &&
+                        (vars->type != SNMP_NOSUCHOBJECT) &&
+                        (vars->type != SNMP_NOSUCHINSTANCE)) {
+                        /*
+                         * not an exception value 
+                         */
+                        if (check
+                            && snmp_oid_compare(name, name_length,
+                                                vars->name,
+                                                vars->name_length) >= 0) {
+                            fprintf(stderr, "Error: OID not increasing: ");
+                            fprint_objid(stderr, name, name_length);
+                            fprintf(stderr, " >= ");
+                            fprint_objid(stderr, vars->name,
+                                         vars->name_length);
+                            fprintf(stderr, "\n");
+                            running = 0;
+                            exitval = 1;
+                        }
+                        memmove((char *) name, (char *) vars->name,
+                                vars->name_length * sizeof(oid));
+                        name_length = vars->name_length;
+                    } else
+                        /*
+                         * an exception value, so stop 
+                         */
+                        running = 0;
+                }
+            } else {
+                /*
+                 * error in response, print it 
+                 */
+                running = 0;
+                if (response->errstat == SNMP_ERR_NOSUCHNAME) {
+                    printf("End of MIB\n");
+                } else {
+                    fprintf(stderr, "Error in packet.\nReason: %s\n",
+                            snmp_errstring(response->errstat));
+                    if (response->errindex != 0) {
+                        fprintf(stderr, "Failed object: ");
+                        for (count = 1, vars = response->variables;
+                             vars && count != response->errindex;
+                             vars = vars->next_variable, count++)
+                            /*EMPTY*/;
+                        if (vars)
+                            fprint_objid(stderr, vars->name,
+                                         vars->name_length);
+                        fprintf(stderr, "\n");
+                    }
+                    exitval = 2;
+                }
+            }
+        } else if (status == STAT_TIMEOUT) {
+            fprintf(stderr, "Timeout: No Response from %s\n",
+                    session.peername);
+            running = 0;
+            exitval = 1;
+        } else {                /* status == STAT_ERROR */
+            snmp_sess_perror("snmpwalk", ss);
+            running = 0;
+            exitval = 1;
+        }
+        if (response)
+            snmp_free_pdu(response);
+    }
+
+    if (numprinted == 0 && status == STAT_SUCCESS) {
+        /*
+         * no printed successful results, which may mean we were
+         * pointed at an only existing instance.  Attempt a GET, just
+         * for get measure. 
+         */
+        snmp_get_and_print(ss, root, rootlen);
+    }
+    snmp_close(ss);
+
+    if (netsnmp_ds_get_boolean(NETSNMP_DS_APPLICATION_ID, NETSNMP_DS_WALK_PRINT_STATISTICS)) {
+        printf("Variables found: %d\n", numprinted);
+    }
+
+    SOCK_CLEANUP;
+    return exitval;
+}
diff -Naur tomato/release/src/router/snmp/ChangeLog tomato121/release/src/router/snmp/ChangeLog
--- tomato/release/src/router/snmp/ChangeLog	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/ChangeLog	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,39666 @@
+-------------------------------------------------------------------------------
+
+Changes: V5.0.8 -> V5.0.9
+
+2003-09-05 23:42  hardaker
+
+   * agent/Makefile.depend, agent/helpers/Makefile.depend
+, agent/mibgroup/Makefile.depend,
+   apps/Makefile.depend, apps/snmpnetstat/Makefile.depend
+, snmplib/Makefile.depend:
+
+   make depend
+   
+2003-09-05 23:41  hardaker
+
+   * configure, configure.in:
+
+   forgot a test after the if
+   
+2003-09-05 23:37  hardaker
+
+   * README:
+
+   added Bob Rowlands
+   
+2003-09-05 23:30  hardaker
+
+   * man/: netsnmp_agent.3, netsnmp_bulk_to_next.3
+, netsnmp_debug.3, netsnmp_handler.3,
+   netsnmp_instance.3, netsnmp_library.3,
+   netsnmp_mib_utilities.3, netsnmp_mode_end_call.3
+, netsnmp_multiplexer.3, netsnmp_old_api.3
+, netsnmp_read_only.3, netsnmp_scalar.3
+, netsnmp_serialize.3, netsnmp_table.3
+, netsnmp_table_array.3, netsnmp_table_data.3
+, netsnmp_table_dataset.3,
+   netsnmp_table_iterator.3, netsnmp_todo.3,
+   netsnmp_watcher.3:
+
+   doxygen update
+   
+2003-09-05 23:25  hardaker
+
+   * Makefile.top:
+
+   update for 5.0.9
+   
+2003-09-05 22:36  hardaker
+
+   * agent/helpers/: table.c, table_iterator.c:
+
+   Patch #800561 from Bob Rowlands to fix 64bit problems (-> size_t)
+   
+2003-09-05 22:30  hardaker
+
+   * agent/mibgroup/agentx/protocol.c:
+
+   Patch #800485 from Bob Rowlands for 64 bit agentx problems
+   
+2003-09-05 22:16  hardaker
+
+   * snmplib/snmpusm.c:
+
+   Patch #792008 from Thomas? to allow usmUser tokens to override previous entries
+   
+2003-09-05 22:04  hardaker
+
+   * man/: mib2c.1.def, snmpcmd.1.def,
+   snmpdelta.1, snmpdf.1, snmpnetstat.1,
+   snmpstatus.1.def, snmptable.1.def,
+   snmptest.1.def, snmptranslate.1.def:
+
+   Patch #789485 from Bob Rowlands for a long needed overhaul of the manual pages.
+   
+2003-09-05 22:00  hardaker
+
+   * Makefile.in, snmplib/Makefile.in:
+
+   one run-away patch
+   
+2003-09-05 21:58  hardaker
+
+   * Makefile.in, configure.in, agent/snmpd.c
+, agent/mibgroup/ucd-snmp/file.c,
+   agent/mibgroup/ucd-snmp/logmatch.c,
+   include/net-snmp/library/system.h, snmplib/mib.c
+, snmplib/parse.c:
+
+   high level comments about contained copyrights moved from the main branch
+   
+2003-09-05 21:54  hardaker
+
+   * NEWS:
+
+   minor updates
+   
+2003-09-05 21:21  hardaker
+
+   * Makefile.in, configure, configure.in
+:
+
+   Add optional arguments to the --with-perl-modules flag for passing down
+   
+2003-09-05 16:57  hardaker
+
+   * agent/snmp_agent.c,
+   include/net-snmp/agent/snmp_agent.h:
+
+   - fix a getbulk bug pointed out by Jurij Smakov.
+   
+2003-07-27 16:54  rstory
+
+   * local/mib2c:
+
+   fix filename in error msg, as noted in coders
+   
+2003-07-24 18:14  rstory
+
+   * perl/SNMP/SNMP.xs:
+
+   add access to augments tag (fix bug 740082: mib2c handles AUGMENTing tables
+   incorrectly)
+   
+2003-07-24 18:13  rstory
+
+   * local/mib2c:
+
+   add indexes from augmented table for tables using augments (fix
+   bug 740082: mib2c handles AUGMENTing tables incorrectly)
+   
+2003-07-24 05:27  rstory
+
+   * acconfig.h:
+
+   define NETSNMP_INLINE as empty if not defined
+   
+2003-07-10 09:32  rstory
+
+   * dist/nsb-functions:
+
+   fix typo; use which to find scp; add extra config to other config
+   
+2003-07-09 20:56  rstory
+
+   * dist/nsb-functions:
+
+   add host/path upload; try to extract more info from make log on error
+   
+2003-07-09 20:54  rstory
+
+   * dist/: nsb-package, nsb-nightly:
+
+   add host/path upload params; use new nsb-default-paths
+   
+2003-07-03 20:52  rstory
+
+   * snmplib/: container_list_ssll.c, container_null.c
+:
+
+   oops - no new features for 5.0.8
+   
+2003-07-03 20:26  rstory
+
+   * snmplib/container_list_ssll.c:
+
+   file container_list_ssll.c was initially added on branch V5-0-patches.
+   
+2003-07-03 20:26  rstory
+
+   * snmplib/container_null.c:
+
+   file container_null.c was initially added on branch V5-0-patches.
+   
+2003-07-03 20:26  rstory
+
+   * snmplib/: container_list_ssll.c, container_null.c
+:
+
+   new containers
+   
+2003-07-02 13:02  hardaker
+
+   * agent/agent_registry.c:
+
+   Patch #724925 from Peter Warasin to fix netsnmp_subtree_unload() to update the root pointer
+   
+2003-07-02 12:47  hardaker
+
+   * agent/mibgroup/ucd-snmp/file.c,
+   agent/mibgroup/ucd-snmp/logmatch.c, snmplib/parse.c
+:
+
+   Patch #760448 from Bob Rowlands/Sun to fix bug #751913 to protect a few minor security violations
+   
+2003-07-02 10:44  hardaker
+
+   * snmplib/strlcpy.c:
+
+   file strlcpy.c was initially added on branch V5-0-patches.
+   
+2003-07-02 10:44  hardaker
+
+   * COPYING, configure, configure.in,
+   agent/snmpd.c, include/net-snmp/net-snmp-config.h.in
+, include/net-snmp/library/system.h,
+   snmplib/Makefile.in, snmplib/mib.c,
+   snmplib/strlcpy.c:
+
+   Patch #760417 from Bob Rowlands/Sun for fixing Bug #751920 for minor security problems (PID file unliked first, and use strlcpy instead of strcpy.  A new strlcpy file was defined if not defined for a system.
+   
+2003-07-02 10:37  hardaker
+
+   * snmplib/mib.c:
+
+   don't use isspace and isprint simultaniously
+   
+2003-07-02 10:36  hardaker
+
+   * local/mib2c.iterate.conf:
+
+   comment change for clarification
+   
+2003-07-02 10:26  hardaker
+
+   * include/net-snmp/library/snmp_debug.h:
+
+   Patch #764047 from Stephen J. Friedl: Remove redundant declaration from snmp_debug.h and fix a few comments
+   
+2003-07-02 10:21  hardaker
+
+   * configure, configure.in:
+
+   Patch #759309 from Stephen Friedl to add prompt over-ride flag descriptions to prompt output
+   
+2003-07-02 10:19  hardaker
+
+   * configure, configure.in:
+
+   patch #759298: fix spelling error
+   
+2003-06-25 14:29  hardaker
+
+   * agent/mibgroup/ucd-snmp/proxy.c:
+
+   fix proxying for getbulk
+   
+2003-06-22 07:23  hardaker
+
+   * apps/snmpvacm.c:
+
+   fix usage for flag ordering
+   
+2003-06-16 14:59  hardaker
+
+   * testing/RUNTESTS:
+
+   remove no longer needed comment about it being broken, as pointed out
+   by Bruce.
+   
+2003-06-16 14:58  hardaker
+
+   * testing/RUNTESTS:
+
+   support , separated arguments to -T like -h says it will.
+   
+2003-06-16 14:57  hardaker
+
+   * testing/RUNTESTS:
+
+   Bruce Shaw's patch 755553 to fix RUNTESTS test number reporting when
+   testing subsets are used.
+   
+2003-06-16 14:44  hardaker
+
+   * agent/mibgroup/kernel_sunos5.c:
+
+   Patch #755540 from Bruce Shaw and IRC:SebNob to fix bug #701439 for 64 bit solaris systems and 64 bit integers returned by getKstat
+   
+2003-06-16 14:43  hardaker
+
+   * testing/tests/: T055agentv1mintrap, T056agentv2cmintrap
+:
+
+   Patch #754105 from Bruce Shaw to fix some spelling errors
+   
+2003-06-10 15:48  nba
+
+   * snmplib/snmp_api.c:
+
+   Beware of dereferencing a NULL pointer
+   
+2003-06-10 10:45  hardaker
+
+   * snmplib/snmp_api.c:
+
+   remove the unused function as pointed out by Bob Rowlands
+   
+2003-06-09 16:11  hardaker
+
+   * agent/mibgroup/mibII/vacm_vars.c, agent/snmp_agent.c
+, include/net-snmp/library/vacm.h,
+   snmplib/vacm.c:
+
+   Long overdue patch #695192 from Ron Tabor to fix the VACM spinning problem that I didn't quite fix before
+   
+2003-06-09 16:01  hardaker
+
+   * configure.in, testing/tests/T023snmpv3getMD5DES
+, testing/tests/T025snmpv3getSHADES:
+
+   fix bug #706710 to show when privacy has been disabled
+   
+2003-06-09 15:33  hardaker
+
+   * snmplib/snmp_api.c:
+
+   bug #748431 from John Shiver: fix thread-safe problems with snmp_get_fd_for_session (which was missing in the 5.x line anyway)
+   
+2003-06-09 14:49  hardaker
+
+   * README.Matsushita.txt, README.Matsushita.txt:
+
+   Patch #748305 from srinivasa rao gurusu describing how to build net-snmp on Matsushita embedded systems
+   
+2003-06-09 14:44  hardaker
+
+   * agent/mibgroup/mibII/ipAddr.c:
+
+   Patch 746339: Otto Solares fixes a file descriptor leak on linux
+   
+2003-06-09 14:38  hardaker
+
+   * agent/mibgroup/ucd-snmp/pass.c:
+
+   patch #740918 from Eric E. Bowles: fix pass through invocation for SETs
+   
+2003-06-09 14:31  hardaker
+
+   * agent/mibgroup/kernel_sunos5.c:
+
+   Patch #749062 to fix caching crashing and clashing under Solaris
+   
+2003-06-09 14:28  hardaker
+
+   * agent/mibgroup/ucd-snmp/proxy.c:
+
+   patch #749103 from Garry C Marshall to fix the proxy when a timeout occurs from the target
+   
+2003-06-06 23:17  nba
+
+   * snmplib/mib.c:
+
+   Fix missing length byte when setting index with checks disabled
+   
+2003-05-28 17:25  hardaker
+
+   * agent/helpers/old_api.c:
+
+   remove unused code as pointed out by Peter Warasin
+   
+2003-05-28 14:29  hardaker
+
+   * AGENT.txt:
+
+   added V4/V5 note from main branch to patches
+   
+2003-05-23 11:25  rstory
+
+   * snmplib/container_binary_array.c:
+
+   free container after freeing contents
+   
+2003-05-23 11:24  rstory
+
+   * include/net-snmp/library/container.h,
+   snmplib/container.c:
+
+   update container free macro/code to deal w/pointer being deleted
+   
+2003-05-23 11:22  rstory
+
+   * agent/mibgroup/ucd-snmp/logmatch.c:
+
+   EXTENSIBLEMIB -> UCDAVIS_MIB
+   
+2003-05-14 10:30  rstory
+
+   * configure:
+
+   configure to match config.in
+   
+2003-05-14 10:28  rstory
+
+   * configure.in:
+
+   fix net-snmp-config chmod to work from configure and config.status
+   
+2003-05-12 22:58  hardaker
+
+   * apps/snmptrapd.c:
+
+   Patch #735511 from Alex Burger: fix snmptrapd to ensure there are the correct number of varbinds
+   
+2003-05-12 22:55  hardaker
+
+   * agent/mibgroup/ucd-snmp/proxy.c:
+
+   Patch #736784 from Ron Tabor: fix proxies for restarted NSMPv3 sub-agents
+   
+2003-05-08 16:16  hardaker
+
+   * README:
+
+   mention Andrew Findlay
+   
+2003-05-08 16:15  hardaker
+
+   * perl/agent/agent.xs:
+
+   (excellent) patch #705566 from Andrew Findlay on perl agent support:
+   
+   1) Agent cannot return MAC addresses containing zero octet.
+   
+   2) Agent coredumps when trying to return IP addresses
+   if these are supplied as dotted-quad or as a hostname
+   that fails to resolve.
+   
+   3) Agent corrupts OID values.
+   
+   4) Agent truncates any OCTET_STRING or BIT_STRING that
+   contains a zero octet (this is the root cause of (1) above)
+   
+   API changes introduced:
+   
+   a) IP addresses now passed as binary strings (4 octets
+   for IPv4) rather than dotted-quad or name. This
+   sidesteps the IPv4/IPv6 problem and leaves the calling
+   script to deal with name->address resolution and
+   associated error handling.
+   
+2003-05-08 09:42  hardaker
+
+   * README:
+
+   mention Alex Burger, who submitted the perl win32 patches
+   
+2003-05-08 09:32  hardaker
+
+   * README:
+
+   mention Stephen
+   
+2003-05-08 09:32  hardaker
+
+   * include/net-snmp/library/mib.h,
+   include/net-snmp/library/parse.h,
+   include/net-snmp/library/snmp_api.h,
+   include/net-snmp/library/snmp_client.h, snmplib/mib.c
+, snmplib/snmp_api.c, snmplib/snmp_client.c
+:
+
+   patch #710275 from Stephen J. Friedl: const fixes for APIs that don't modify their arguments
+   
+2003-05-08 09:28  hardaker
+
+   * include/net-snmp/library/system.h:
+
+   missed a commit for a perl patch
+   
+2003-05-08 09:22  hardaker
+
+   * agent/mibgroup/mibII/ipAddr.c:
+
+   Applied patch #712101: minor irix fix
+   
+2003-05-08 09:21  hardaker
+
+   * NEWS:
+
+   Mention patch #715603
+   
+2003-05-08 09:18  hardaker
+
+   * perl/: Makefile.PL, Makefile.subs.pl,
+   ASN/Makefile.PL, OID/Makefile.PL,
+   SNMP/Makefile.PL, SNMP/README, SNMP/SNMP.xs
+, agent/Makefile.PL,
+   agent/default_store/Makefile.PL,
+   default_store/Makefile.PL:
+
+   patch #715603: fix perl module builds under windows
+   
+2003-05-08 07:10  rstory
+
+   * agent/helpers/table_array.c:
+
+   try to use default container if none specified; non-existent row status not
+   legal for a new row; sanity check asserts; remove unused cooperative
+   notification code; check for null table container
+   
+2003-05-08 07:06  rstory
+
+   * agent/Makefile.in:
+
+   remove object_monitor as it doesn't do anything and would be a new feature if
+   it did
+   
+2003-05-08 07:05  rstory
+
+   * dist/nsb-functions:
+
+   fix sysname translation for /; allow extra config to be specified in
+   environment var
+   
+2003-05-08 07:02  rstory
+
+   * include/net-snmp/library/snmp_assert.h:
+
+   chg NET_SNMP_USE_ASSERT define to NETSNMP_USE_ASSERT to be consistent
+   
+2003-05-08 06:58  rstory
+
+   * include/net-snmp/library/container.h,
+   snmplib/container.c:
+
+   apply patch [ 724927 ] to fix log msg; add \n to log msgs
+   
+2003-05-05 15:35  hardaker
+
+   * man/snmpd.conf.5.def:
+
+   document agentxPingInterval
+   
+2003-05-05 10:35  rstory
+
+   * configure:
+
+   configure to match configure.in
+   
+2003-05-05 10:29  rstory
+
+   * Makefile.in, configure.in:
+
+   chmod net-snmp-config after configure, instead in make
+   
+2003-04-03 15:12  rstory
+
+   * include/net-snmp/library/tools.h:
+
+   wrap SNMP_FREE macro w/do while, so it won't affect if/then flow
+   
+2003-03-28 06:48  hardaker
+
+   * README.krb5:
+
+   Ken Hornstein noted that the rwuser -s flag was missing it's argument
+   
+2003-03-28 06:47  hardaker
+
+   * snmplib/snmpksm.c:
+
+   Patch from Ken for misc krb5 fixes (encryption types, New crypto support,...
+   
+2003-03-19 11:46  rstory
+
+   * Makefile.in:
+
+   remove trailing \ from perl rules
+   
+-------------------------------------------------------------------------------
+
+Changes: V5.0.7 -> V5.0.8
+
+2003-03-17 17:33  rstory
+
+   * NEWS, man/netsnmp_handler.3,
+   man/netsnmp_table.3, man/netsnmp_table_data.3:
+
+   update for 5.0.8
+   
+2003-03-17 17:20  rstory
+
+   * sedscript.in, snmplib/snmp_version.c, FAQ
+, README, perl/SNMP/SNMP.pm:
+
+   - (snmplib/snmp_version.c sedscript.in): version tag ( 5.0.8 )
+   
+2003-03-14 14:55  rstory
+
+   * FAQ, README, sedscript.in,
+   agent/Makefile.depend, agent/helpers/Makefile.depend
+, agent/mibgroup/Makefile.depend,
+   apps/Makefile.depend, apps/snmpnetstat/Makefile.depend
+, perl/SNMP/SNMP.pm, snmplib/Makefile.depend
+, snmplib/snmp_version.c:
+
+   update for 5.0.8.pre2
+   
+2003-03-14 14:40  rstory
+
+   * ChangeLog, NEWS:
+
+   update for 5.0.8.pre2
+   
+2003-03-14 13:53  rstory
+
+   * man/: netsnmp_table.3, netsnmp_table_dataset.3
+:
+
+   update for 5.0.8.pre2
+   
+2003-03-14 13:45  rstory
+
+   * Makefile.in:
+
+   trailing slash on srcdir for comment checks
+   
+2003-03-14 13:44  rstory
+
+   * dist/nsb-functions:
+
+   more extra modules and transports
+   
+2003-03-14 12:44  rstory
+
+   * include/net-snmp/agent/agent_handler.h:
+
+   use new macro for inlining; fix some indent madness
+   
+2003-03-14 12:43  rstory
+
+   * include/net-snmp/library/container.h:
+
+   use new macro for testing if inlining is on
+   
+2003-03-14 12:40  rstory
+
+   * include/net-snmp/system/: aix.h, hpux.h,
+   irix.h:
+
+   don't undef inline
+   
+2003-03-14 12:40  rstory
+
+   * snmplib/container.c:
+
+   rename macro used to test for inlining
+   
+2003-03-14 12:39  rstory
+
+   * win32/: config.h, net-snmp/net-snmp-config.h:
+
+   if inline macro not defined, define as empty
+   
+2003-03-14 12:37  rstory
+
+   * agent/agent_handler.c, agent/agent_registry.c
+, agent/object_monitor.c, agent/snmp_agent.c
+, agent/helpers/table.c,
+   agent/helpers/table_array.c, agent/helpers/table_data.c
+, agent/helpers/table_dataset.c,
+   agent/helpers/table_iterator.c,
+   include/net-snmp/net-snmp-config.h.in,
+   include/net-snmp/agent/snmp_agent.h,
+   include/net-snmp/agent/table_data.h,
+   include/net-snmp/agent/table_dataset.h,
+   include/net-snmp/library/data_list.h, snmplib/data_list.c
+, snmplib/oid_stash.c:
+
+   replace inline w/macro
+   
+2003-03-13 19:03  hardaker
+
+   * agent/snmp_agent.c:
+
+   patch from Tommy Christensen to fix some AgentX (mostly) memory leaks
+   
+2003-03-12 13:40  hardaker
+
+   * net-snmp-config.in:
+
+   patch #699380: From Christophe Kalt: make net-snmp-config do what it's document to do (add -L@libdir@)
+   
+2003-03-12 11:48  hardaker
+
+   * snmplib/snmp_api.c:
+
+   patch #700672: reset itmp to the new value length after decoding a hex string
+   
+2003-03-11 17:37  hardaker
+
+   * snmplib/scapi.c:
+
+   Applied openssl dynamic version hack/fix
+   
+2003-03-11 15:14  rstory
+
+   * agent/Makefile.in:
+
+   add WRAPLIBS var instead of direct substitution
+   
+2003-03-11 15:12  rstory
+
+   * net-snmp-config.in:
+
+   add WRAPLIBS to --agent-libs and --external-agent-libs
+   
+2003-03-11 00:31  rstory
+
+   * configure:
+
+   revert to 2.13
+   
+2003-03-06 01:44  rstory
+
+   * configure:
+
+   update for new configure.in
+   
+2003-03-06 01:41  rstory
+
+   * configure.in:
+
+   fix libwrap w/nsl; make sure all quotes restored before using AC macros. This
+   seems to mess up the config output while checking for modules, but w/out it,
+   I get errors from m4 when running autoconf.
+   
+2003-03-05 20:51  rstory
+
+   * .cvsignore:
+
+   ignore net-snmp-config-x
+   
+2003-03-05 20:49  rstory
+
+   * agent/mibgroup/versiontag:
+
+   check for an optional 3rd param, nocvs, to not commit after updating version
+   
+2003-03-05 20:48  rstory
+
+   * dist/RELEASE-INSTRUCTIONS:
+
+   put all the version number changes in the same step
+   
+2003-03-05 20:21  rstory
+
+   * FAQ, README:
+
+   - (snmplib/snmp_version.c sedscript.in): version tag ( 5.0.8.pre1 )
+   
+2003-03-05 20:00  rstory
+
+   * sedscript.in, perl/SNMP/SNMP.pm,
+   snmplib/snmp_version.c:
+
+   update version to 5.0.8.pre1
+   
+2003-03-05 19:04  rstory
+
+   * man/snmpd.conf.5.def:
+
+   back out docs for new functionality accidentally added when applying patch
+   
+2003-03-05 18:40  rstory
+
+   * agent/mibgroup/disman/mteTriggerTable.c:
+
+   back out new functionality accidentally added when applying patch
+   
+2003-03-05 18:20  rstory
+
+   * README.solaris:
+
+   updates from Bruce Shaw
+   
+2003-03-05 18:18  rstory
+
+   * man/.cvsignore:
+
+   add snmpd.8
+   
+2003-03-05 18:12  rstory
+
+   * man/: netsnmp_agent.3, netsnmp_handler.3,
+   netsnmp_library.3, netsnmp_mib_utilities.3,
+   netsnmp_table_data.3:
+
+   updates for 5.0.8
+   
+2003-03-05 18:04  rstory
+
+   * doxygen.conf:
+
+   update to 5.0.8
+   
+2003-03-05 17:58  rstory
+
+   * dist/README.build-scripts:
+
+   remove obsolete argument; fix typo
+   
+2003-03-05 17:58  rstory
+
+   * Makefile.in:
+
+   exclude ftp from comment check; use egrep
+   
+2003-03-05 17:55  rstory
+
+   * agent/mibgroup/ucd-snmp/diskio.c:
+
+   chg C++ style comment
+   
+2003-03-05 17:50  rstory
+
+   * testing/TESTCONF.sh:
+
+   argh! FreeBSD is driving me crazy!  set RANDOM=2 if RANDOM not defined; use test
+   
+2003-03-05 17:22  rstory
+
+   * testing/TESTCONF.sh:
+
+   simplify netstat args & tweak grep regex for multi platform compatability
+   
+2003-03-05 17:11  rstory
+
+   * testing/TESTCONF.sh:
+
+   check /bin and /usr/bin for netstat (probably a good job for configure)
+   
+2003-03-05 17:02  rstory
+
+   * testing/TESTCONF.sh:
+
+   missed one, re: (( )) -> expr
+   
+2003-03-05 16:58  rstory
+
+   * testing/TESTCONF.sh:
+
+   use more portable expr instead of  (( )) for arithmetic expressions
+   
+2003-03-05 16:16  rstory
+
+   * testing/TESTCONF.sh:
+
+   for systems with /bin/netstat, check that snmpd port is not in use. If it is,
+   try up to three random others before giving up.
+   
+2003-03-05 15:16  rstory
+
+   * dist/: nsb-functions, nsb-package:
+
+   don't prompt between steps by default
+   
+2003-03-05 15:11  rstory
+
+   * testing/RUNTESTS:
+
+   import SNMP_SLEEP time from environment, if available
+   
+2003-03-05 15:10  rstory
+
+   * win32/net-snmp/net-snmp-config.h:
+
+   don't redefine inline
+   
+2003-03-05 15:08  rstory
+
+   * Makefile.top:
+
+   version 5.0.8
+   
+2003-03-05 15:07  rstory
+
+   * .cvsignore:
+
+   ignore some files autoconf may create
+   
+2003-03-05 13:42  nba
+
+   * aclocal.m4, config.guess, config.sub
+, ltmain.sh, configure:
+
+   Update libtool to version 1.4.3, for the benefit of Darwin
+   
+2003-03-05 13:39  nba
+
+   * configure.in:
+
+   Dont force -I/usr/local/include for --with-dmalloc
+   
+2003-03-04 12:47  hardaker
+
+   * agent/mibgroup/agent/nsModuleTable.c:
+
+   wrong type returned for nsModuleModes as reported by Michael Kirkham
+   
+2003-03-03 15:03  nba
+
+   * man/snmpd.conf.5.def:
+
+   Mention the AgentXAddress, AgentsRetries and AgentXTimeout parameters
+   
+2003-03-03 14:25  nba
+
+   * agent/mibgroup/ucd_snmp.h:
+
+   Add support for OpenBSD 3. Sort some lines for easier reference.
+   
+2003-03-01 10:27  rstory
+
+   * agent/mibgroup/agentx/subagent.c:
+
+   agentx patch from Tommy Christensen: better error checking
+   
+2003-03-01 09:59  rstory
+
+   * agent/mibgroup/agentx/master.c:
+
+   agentx patch from Tommy Christensen: don't create delegated cache for CLEANUPSET
+   
+2003-02-28 23:46  hardaker
+
+   * perl/SNMP/Makefile.PL:
+
+   typo
+   
+2003-02-28 23:11  hardaker
+
+   * perl/SNMP/Makefile.PL:
+
+   Patch #597629 from Matt Selsky to fix man page installation
+   
+2003-02-28 13:18  nba
+
+   * agent/snmpd.c, apps/snmptrapd.c:
+
+   Better error message if we cannot create pid file
+   
+2003-02-28 13:17  nba
+
+   * agent/mibgroup/host/hr_filesys.c:
+
+   Use FS types with Linux
+   
+2003-02-27 00:59  rstory
+
+   * local/mib2c.array-user.conf:
+
+   sync w/main
+   
+2003-02-26 18:52  rstory
+
+   * Makefile.top:
+
+   sync w/main: put in missing INSTALL_DATA
+   
+2003-02-26 18:05  nba
+
+   * agent/mibgroup/ucd-snmp/vmstat_solaris2.c:
+
+   Implement sysRawInterrupts and sysRawContext for Solaris
+   
+2003-02-26 14:30  nba
+
+   * snmplib/mib.c:
+
+   Fix a C precedence botch-up, thanks to Fabrício Las Casas <Fabricio@atan.com.br>
+   
+2003-02-26 14:14  nba
+
+   * agent/mibgroup/ucd-snmp/vmstat.c:
+
+   Implement the ssRawInterrupts and ssRawContext counters in Linux
+   
+2003-02-26 14:13  nba
+
+   * apps/snmptrapd.c:
+
+   Fix the -S option
+   
+2003-02-25 14:38  rstory
+
+   * Makefile.in:
+
+   fix logic of test operation
+   
+2003-02-25 14:33  rstory
+
+   * Makefile.in, Makefile.top:
+
+   use AUTO(CONF|HEADER) from configure, instead of hardcoded; don't try and run
+   AUTO(CONF|HEADER) if not found
+   
+2003-02-25 14:11  rstory
+
+   * man/snmpd.8.def:
+
+   sync w/main branch: new file
+   
+2003-02-25 14:03  rstory
+
+   * apps/snmptrapd.c:
+
+   sync w/main branch (correctly, this time)
+   
+2003-02-25 13:49  rstory
+
+   * Makefile.in:
+
+   sync w/main branch: add NOAUTODEPS
+   
+2003-02-25 13:38  rstory
+
+   * dist/nsb-functions:
+
+   sync w/main branch: add smux to dist modules; move make test into nsb-make;
+   remove tee so rc is preserved; use new NOAUTODEPS
+   
+2003-02-25 13:29  rstory
+
+   * snmplib/snmpv3.c:
+
+   sync w/main branch:
+   Recognise "defVersion v3" as well as "defVersion 3" as documented
+   in the man pages (prior to Peter Breitenlohner's correction)
+   [We might as well support both styles....]
+   
+2003-02-25 13:20  rstory
+
+   * EXAMPLE.conf.def, sedscript.in,
+   man/Makefile.in, man/mib2c.1.def,
+   man/read_config.3.def, man/snmp.conf.5.def,
+   man/snmp_config.5.def, man/snmpcmd.1.def,
+   man/snmpconf.1.def, man/snmpd.1.def,
+   man/snmptrapd.conf.5.def, mibs/Makefile.in:
+
+   sync w/main branch: (I hope I got this right)
+   -Apply Peter Breitenlohner's documentation changes
+    (patches #692381,  692382 and  692388)
+   
+2003-02-25 13:16  rstory
+
+   * agent/mibgroup/mibII/interfaces.c:
+
+   sync w/main branch:
+   patch #657808: calculate a proper ifSpeed under linux when possible
+   and do more proper ifOperStatus state determination.
+   
+2003-02-25 13:15  rstory
+
+   * agent/helpers/table_data.c:
+
+   sync w/main branch:
+   - Irfan Sheriff pointed out a bug with getnext requests directly to a column.
+   - check entry node as suggested by Irfan Sheriff
+   
+2003-02-25 13:14  rstory
+
+   * snmplib/system.c:
+
+   sync w/main branch:
+   Remove last remaining use of 'nlist' under HP-UX 10 & 11.
+   As per patch #656773 from Johannes Schmidt-Fischer
+   
+2003-02-25 13:13  rstory
+
+   * agent/mibgroup/host/hr_disk.c:
+
+   sync w/main branch:
+   Checking the length of a string buffer once is sufficient.
+   Using 'strnncpy' [sic] to check this length twice is unnecessary...
+   
+2003-02-25 13:12  rstory
+
+   * Makefile.in:
+
+   sync w/main branch:
+   - Mess with output of doxygen to add sf logos, etc, to the bottom of the
+     generated html files.
+   - Apply Peter Breitenlohner's net-snmp-config patch (#692373)
+   
+2003-02-25 13:11  rstory
+
+   * agent/snmpd.c:
+
+   sync w/main branch:
+   Patch #655154 from Joel Rosdahl: more proper demonization:
+     - close stdin/stdout/stderr if appropriate.
+     - double fork.
+     - chdir /   [except under windows]
+   
+2003-02-25 13:10  rstory
+
+   * agent/mibgroup/ucd-snmp/diskio.c:
+
+   sync w/main branch:
+   Patch #662169 from Jan Willem Luiten: diskio support for Darwin
+   
+2003-02-25 13:10  rstory
+
+   * perl/SNMP/t/: bulkwalk.t, set.t:
+
+   sync w/main branch:
+   Fix tests for bulkwalk (duplicate header) and set (invalid OID constant)
+   
+2003-02-25 13:09  rstory
+
+   * agent/mibgroup/mibII/ipAddr.c:
+
+   sync w/main branch:
+   Accommodate a fussy IRIX environment, which is picky about <unistd.h>
+   See bug #667726
+   
+2003-02-25 13:04  rstory
+
+   * acconfig.h:
+
+   sync w/main branch:
+   Bruce Shaw pointed out a comment typo
+   
+2003-02-25 13:02  rstory
+
+   * perl/: ASN/Makefile.PL, OID/Makefile.PL,
+   SNMP/Makefile.PL, agent/Makefile.PL,
+   default_store/Makefile.PL:
+
+   sync w/main branch:
+   fix my declarations as pointed out by Andrew Page
+   
+2003-02-25 13:01  rstory
+
+   * snmplib/mib.c:
+
+   sync w/main branch:
+   An additional change to support 't' hints
+   
+2003-02-25 13:00  rstory
+
+   * man/snmptrapd.8.def:
+
+   sync w/main branch:
+   -document patch #674218: reopen log files on HUP.
+   -Apply Peter Breitenlohner's documentation changes
+    (patches #692381,  692382 and  692388)
+   
+2003-02-25 12:59  rstory
+
+   * man/snmpd.conf.5.def:
+
+   sync w/main branch:
+   -document monitor -t for threshold monitoring
+   -Apply Peter Breitenlohner's documentation changes
+    (patches #692381,  692382 and  692388)
+   
+2003-02-25 12:57  rstory
+
+   * agent/mibgroup/disman/mteTriggerTable.c:
+
+   sync w/main branch:
+   Patch from Christophe to support monitor -t for threshold monitoring
+   
+2003-02-25 12:55  rstory
+
+   * FAQ:
+
+   sync w/main branch:
+   Clarify the local-only access for non-standard port AgentX connections
+   
+2003-02-25 12:54  rstory
+
+   * apps/snmptrapd.c:
+
+   sync w/main branch:
+     -  close and re-open log file on receiving a HUP (patch 674218, submitted
+        by anonymous)
+   
+2003-02-25 12:52  rstory
+
+   * net-snmp-config.in:
+
+   sync w/main branch: Bruce Shaw pointed out a comment typo
+   
+2003-02-25 09:04  dts12
+
+   * man/snmpd.8.def:
+
+   Apply Peter Breitenlohner's configuration-related documentation and installation changes.
+   (patches #692372,  692377,  692379 and 692386)
+   
+2003-02-13 20:02  hardaker
+
+   * agent/mibgroup/mibII/var_route.c:
+
+   Patch #654329: double check lengths when copying
+   
+2003-02-12 09:01  hardaker
+
+   * agent/mibgroup/tunnel/tunnel.h:
+
+   update
+   
+2003-02-11 11:13  hardaker
+
+   * agent/mibgroup/ucd-snmp/: pass.c, pass_persist.c
+:
+
+   patch #667694 (anon) to add back newlines to pass code
+   
+2003-02-03 10:27  hardaker
+
+   * snmplib/snmp_api.c:
+
+   From Richard Laing: change value check of a string to use a proper length.
+   
+2003-01-24 10:47  hardaker
+
+   * agent/mibgroup/smux/smux.c:
+
+   patch #672021 from Joshua Giles: large set request fixes
+   
+2003-01-20 23:21  rstory
+
+   * snmplib/container_binary_array.c:
+
+   add missing brace
+   
+2003-01-20 23:13  rstory
+
+   * agent/mibgroup/versiontag:
+
+   add back (accidentally deleted) creation of gzipped tarball
+   
+2003-01-20 23:09  rstory
+
+   * snmplib/test_binary_array.c:
+
+   add string test case
+   
+2003-01-20 23:09  rstory
+
+   * snmplib/container_binary_array.c:
+
+   fix array_qsort; fix binary search; con't recurse on insert, del, etc since
+   the INSERT/DELETE macros already handle multiple indexes
+   
+2003-01-20 22:54  rstory
+
+   * include/net-snmp/library/default_store.h,
+   snmplib/snmp_api.c:
+
+   official patch [ 669707 ] 5.0.7: 16-Bit Request IDs
+   
+2003-01-20 22:52  rstory
+
+   * include/net-snmp/library/container.h,
+   snmplib/container.c:
+
+   fix typo in log message; add netsnmp_compare_mem
+   
+2003-01-20 22:51  rstory
+
+   * agent/mibgroup/versiontag:
+
+   create md5sums after creating gzipped tarball
+   
+2003-01-20 22:51  rstory
+
+   * Makefile.rules:
+
+   add another level of directories to make depend, per dts on coders
+   (thought this was in 5.0.7, but apparently not!)
+   
+2003-01-14 08:56  hardaker
+
+   * agent/snmpd.c, doxygen.conf, agent/agent_handler.c
+, dist/RELEASE-INSTRUCTIONS:
+
+   doxygen changes
+   
+2003-01-13 21:49  rstory
+
+   * man/: netsnmp_agent.3, netsnmp_handler.3:
+
+   update for 5.0.7
+   
+2003-01-13 20:30  rstory
+
+   * snmplib/mib.c:
+
+   recognize new 't' code in display hints
+   
+2003-01-13 20:07  rstory
+
+   * agent/helpers/table_iterator.c:
+
+   patch for memory leaks sent to coders by Jay Parlar
+   
+-------------------------------------------------------------------------------
+
+Changes: V5.0.6 -> V5.0.7
+
+2003-01-11 01:15  rstory
+
+   * .cvsignore:
+
+   ignore configure-summary
+   
+2003-01-11 01:14  rstory
+
+   * agent/Makefile.depend, agent/helpers/Makefile.depend
+, agent/mibgroup/Makefile.depend, apps/Makefile.depend
+, apps/snmpnetstat/Makefile.depend,
+   snmplib/Makefile.depend:
+
+   make depend
+   
+2003-01-11 01:08  rstory
+
+   * .cvsignore:
+
+   ignore variations of changelog.add
+   
+2003-01-10 20:09  hardaker
+
+   * snmplib/: mib.c, snmp_api.c:
+
+   doxygen output tags to put the recently defined functions into groups.
+   
+2003-01-10 20:09  hardaker
+
+   * man/: Makefile.in, netsnmp_agent.3,
+   netsnmp_bulk_to_next.3, netsnmp_debug.3,
+   netsnmp_handler.3, netsnmp_instance.3,
+   netsnmp_library.3, netsnmp_mib_utilities.3,
+   netsnmp_mode_end_call.3, netsnmp_multiplexer.3,
+   netsnmp_old_api.3, netsnmp_read_only.3,
+   netsnmp_scalar.3, netsnmp_serialize.3, netsnmp_table.3
+, netsnmp_table_array.3, netsnmp_table_data.3,
+   netsnmp_table_dataset.3, netsnmp_table_iterator.3,
+   netsnmp_todo.3, netsnmp_watcher.3:
+
+   doxygen updates
+   
+2003-01-10 17:38  hardaker
+
+   * configure, configure.in:
+
+   opps
+   
+2003-01-10 17:29  hardaker
+
+   * configure, configure.in:
+
+   remove double checking output
+   
+2003-01-10 14:33  hardaker
+
+   * testing/tests/T0160snmpv2cbulkget:
+
+   fix positional arguments
+   
+2003-01-10 09:04  dts12
+
+   * FAQ:
+
+   Reference Bruce Shaw's discussion of the perl compilation problems
+   (see README.solaris)
+   
+2003-01-10 08:31  dts12
+
+   * FAQ:
+
+   Mention AgentX under windows, and beef up the perl stuff a bit.
+   Add a missing entry in the contents list.
+   (This may prove too late for 5.0.8, but at least it'll be ready for next time!)
+   
+2003-01-09 18:41  hardaker
+
+   * man/Makefile.in:
+
+   make doc update.
+   
+2003-01-09 18:38  hardaker
+
+   * man/: netsnmp_agent.3, netsnmp_bulk_to_next.3,
+   netsnmp_debug.3, netsnmp_handler.3, netsnmp_instance.3
+, netsnmp_mode_end_call.3, netsnmp_multiplexer.3,
+   netsnmp_old_api.3, netsnmp_read_only.3,
+   netsnmp_scalar.3, netsnmp_serialize.3, netsnmp_table.3
+, netsnmp_table_array.3, netsnmp_table_data.3,
+   netsnmp_table_dataset.3, netsnmp_table_iterator.3,
+   netsnmp_todo.3, netsnmp_watcher.3:
+
+   make doc update.
+   
+2003-01-09 18:37  hardaker
+
+   * agent/helpers/Makefile.in, agent/helpers/mode_end_call.c
+, include/net-snmp/agent/all_helpers.h,
+   include/net-snmp/agent/mode_end_call.h:
+
+   end-of-mode helper to call more handlers after processing the main
+   line.  Functionally allows parallel handler trees and callbacks after
+   a particular mode is completed (useful for things registered under a
+   serialize handler when you don't know when the mode is over).
+      (not used anywhere in production code yet.).
+   
+2003-01-09 11:55  dts12
+
+   * FAQ:
+
+   Mention the perl shared/static library problem,
+   the unresponsive agent problem (and fix), and
+   disclaim all knowledge of David Town's Net::SNMP module,
+   
+2003-01-09 10:27  hardaker
+
+   * testing/tests/: T0160snmpv2cbulkget, T0220snmpv3bulkget
+:
+
+   GetBulk testing supplied by Xiaofeng Ling
+   
+2003-01-09 10:26  hardaker
+
+   * testing/RUNTESTS:
+
+   Add -x flag for calling subtests with "sh -x".
+   Fix number counting for interactive output.
+   
+2003-01-07 18:49  hardaker
+
+   * COPYING (V4-2-patches.8), COPYING:
+
+   year update
+   
+2003-01-07 13:18  hardaker
+
+   * FAQ (V4-2-patches.58), FAQ:
+
+   irc server name change
+   
+2003-01-07 11:01  hardaker
+
+   * snmplib/mib.c:
+
+   bug #663628 and patch: fix ip address index parsing from OIDs
+   
+2003-01-07 04:53  dts12
+
+   * agent/helpers/table_iterator.c:
+
+   Remove redundant code to free 'callback_data_keep' data.
+   This branch would never be invoked, and is in the wrong
+   place anyway.  Patch supplied by Jay Parlar
+   
+2003-01-06 11:16  nba
+
+   * Makefile.in:
+
+   Install Solaris 9 header
+   
+2003-01-05 18:14  nba
+
+   * win32/win32.opt:
+
+   Make it compile with VC++
+   
+2003-01-05 17:28  nba
+
+   * win32/: encode_keychange/encode_keychange.dsp, win32.opt
+, libsnmp_dll/libsnmp.def:
+
+   Make it compile with VC++
+   
+2003-01-05 15:45  nba
+
+   * mibs/: Makefile.mib, SNMP-FRAMEWORK-MIB.txt,
+   SNMP-MPD-MIB.txt, SNMP-NOTIFICATION-MIB.txt,
+   SNMP-PROXY-MIB.txt, SNMP-TARGET-MIB.txt,
+   SNMP-USER-BASED-SM-MIB.txt, SNMP-VIEW-BASED-ACM-MIB.txt
+, SNMPv2-MIB.txt, SNMPv2-TM.txt, rfclist:
+
+   Update to current RFC versions
+   
+2003-01-03 15:50  rstory
+
+   * configure, configure.in:
+
+   don't call AC_DISABLE_SHARED, as sets the default to disabled (it's very
+   presence in configure.in generates a configure with shared disabled, even
+   if it was in an if block; for developer default, set enable_shared directly
+   unless it was previously set; test that enable_shared=yes for embedded-perl
+   
+2003-01-03 08:02  dts12
+
+   * FAQ (V4-2-patches.57), FAQ:
+
+   Mention the Stratus VOS port. (Thanks to Brandon Hall)
+   
+2003-01-02 18:00  rstory
+
+   * include/net-snmp/library/container.h:
+
+   parens around x in macro in case x is multiple C tokens
+   
+2002-12-22 12:32  rstory
+
+   * sedscript.in, snmplib/snmp_version.c, FAQ,
+   README, perl/SNMP/SNMP.pm:
+
+   - (snmplib/snmp_version.c sedscript.in): version tag ( 5.0.7.pre2 )
+   
+2002-12-22 12:31  rstory
+
+   * ChangeLog, NEWS:
+
+   update for 5.0.7.pre2
+   
+2002-12-22 12:20  rstory
+
+   * agent/Makefile.depend, agent/helpers/Makefile.depend
+, agent/mibgroup/Makefile.depend, apps/Makefile.depend
+, apps/snmpnetstat/Makefile.depend,
+   snmplib/Makefile.depend:
+
+   make depend
+   
+2002-12-20 07:58  nba
+
+   * Makefile.in:
+
+   clean away net-snmp-config on make clean
+   
+2002-12-20 07:57  nba
+
+   * include/net-snmp/mib_api.h,
+   include/net-snmp/library/oid_stash.h, snmplib/oid_stash.c
+:
+
+   stash the oid_stash ...
+   
+2002-12-20 04:49  nba
+
+   * snmplib/snmp_api.c:
+
+   A patch from V4 that didn't make it ... allow list of numeric bits setting BITS
+   
+2002-12-20 02:50  hardaker
+
+   * include/net-snmp/library/oid_stash.h, snmplib/oid_stash.c
+:
+
+   add a global callback function for registering directly via a callback.
+   
+2002-12-20 02:35  hardaker
+
+   * include/net-snmp/utilities.h:
+
+   add callback.h
+   
+2002-12-20 02:22  hardaker
+
+   * snmplib/read_config.c:
+
+   fix persistent storage file renaming.  (snprintf change mistake)
+   
+2002-12-20 02:21  hardaker
+
+   * include/net-snmp/library/oid_stash.h, snmplib/oid_stash.c
+:
+
+   some new routines for saving oid stash data to persistent storage.
+     (not used anywhere in current production code)
+   
+2002-12-19 17:51  hardaker
+
+   * perl/SNMP/SNMP.xs:
+
+   - watch for undefs passed in as a value to a SET clause.
+   - change BITS to a Octet String as it should be.
+     - on a side note, do you know that the Net-SNMP parser doesn't
+       distinguish between BITS and BIT STRING in it's list of types?  I
+       don't think it's possible to use both types in the code today
+       (which is fine, since BIT STRING is not used in SNMPv2 and beyond).
+   
+2002-12-19 17:49  hardaker
+
+   * perl/OID/OID.xs:
+
+   print a warning when you can't parse an OID (err, not ideal)
+   
+2002-12-19 17:48  hardaker
+
+   * perl/AnyData_SNMP/Storage.pm:
+
+   - misc bug fixes.
+   - skip SETing columns with no value passed in.
+   
+2002-12-19 14:43  nba
+
+   * agent/mibgroup/: examples/example.c, host/hr_network.c
+, host/hr_swinst.c:
+
+   Being a bit quick, eh, Dave ...
+   
+2002-12-19 11:14  dts12
+
+   * agent/mibgroup/mibII/: at.c (V4-2-patches.12), at.c:
+
+   Ensure the ifname buffer is big enough to read in a full-length name.
+   (From the SUSE "audit" patch)
+   
+2002-12-19 11:05  dts12
+
+   * agent/snmpd.c, agent/mibgroup/host/hr_print.c,
+   apps/encode_keychange.c, apps/snmptrapd_handlers.c, snmplib/mib.c
+   (V4-2-patches.[28,9,3,3,30]), agent/snmpd.c,
+   agent/mibgroup/host/hr_print.c, apps/encode_keychange.c
+, apps/snmptrapd_handlers.c, snmplib/mib.c:
+
+   Detect when memory allocations fail, and don't plough on regardless.
+   (Based on changes within the SUSE "audit" patch)
+   
+2002-12-19 10:07  dts12
+
+   * agent/agent_trap.c, agent/snmp_agent.c,
+   agent/mibgroup/util_funcs.c,
+   agent/mibgroup/examples/example.c,
+   agent/mibgroup/examples/ucdDemoPublic.c,
+   agent/mibgroup/host/hr_device.c,
+   agent/mibgroup/host/hr_disk.c,
+   agent/mibgroup/host/hr_filesys.c,
+   agent/mibgroup/host/hr_network.c,
+   agent/mibgroup/host/hr_storage.c,
+   agent/mibgroup/host/hr_swinst.c,
+   agent/mibgroup/host/hr_swrun.c,
+   agent/mibgroup/mibII/interfaces.c,
+   agent/mibgroup/mibII/mta_sendmail.c,
+   agent/mibgroup/mibII/system_mib.c,
+   agent/mibgroup/mibII/vacm_vars.c,
+   agent/mibgroup/mibII/var_route.c,
+   agent/mibgroup/target/snmpTargetAddrEntry.c,
+   agent/mibgroup/target/snmpTargetParamsEntry.c,
+   agent/mibgroup/ucd-snmp/disk.c,
+   agent/mibgroup/ucd-snmp/dlmod.c,
+   agent/mibgroup/ucd-snmp/errormib.c,
+   agent/mibgroup/ucd-snmp/extensible.c,
+   agent/mibgroup/ucd-snmp/pass.c,
+   agent/mibgroup/ucd-snmp/pass_persist.c,
+   agent/mibgroup/ucd-snmp/proc.c, apps/encode_keychange.c
+, apps/snmptrapd.c, apps/snmptrapd_handlers.c,
+   apps/snmpnetstat/inet.c, apps/snmpnetstat/inet6.c,
+   snmplib/asn1.c, snmplib/mib.c, snmplib/parse.c,
+   snmplib/read_config.c, snmplib/snmp_api.c,
+   snmplib/snmpv3.c, snmplib/vacm.c:
+
+   The Great SUSE 'sprintf' Hunt.....
+   
+2002-12-19 06:02  jbpn
+
+   * include/net-snmp/net-snmp-config.h.in:
+
+     - code with BSDi4
+   
+2002-12-19 05:50  jbpn
+
+   * snmplib/snmp_api.c:
+
+     - change a comment that doesn't take into account the transport stuff
+     - fix some particularly bad formatting in snmp_open_ex
+   
+2002-12-18 13:50  hardaker
+
+   * agent/mibgroup/agent/nsModuleTable.c:
+
+   remove mem-leak comment.  Out of date and was fixed
+   
+2002-12-18 13:47  hardaker
+
+   * agent/mibgroup/agentx/agentx_config.c, man/snmpd.conf.5.def
+:
+
+   delete experimental warning about agentx
+   
+2002-12-18 13:40  hardaker
+
+   * mibs/UCD-SNMP-MIB.txt:
+
+   fix bug#655488: descriptions of ssIORawReceived and ssRawInterrupts were reversed
+   
+2002-12-18 08:19  jbpn
+
+   * agent/snmpd.c:
+
+     - restart stderr logging on HUP (if -L was given on command line)
+   
+2002-12-17 19:33  rstory
+
+   * local/mib2c.array-user.conf:
+
+   remove ';' from define; if table has a storage type, check that it's not
+   read only before allowing sets
+   
+2002-12-17 19:26  rstory
+
+   * local/mib2c.array-persistent.conf:
+
+   never mind
+   
+2002-12-17 19:02  hardaker
+
+   * perl/OID/test.pl:
+
+   Don't check for prefixes in test.  They don't exist.  However, do set SNMPCONFPATH in test initialization to a bogus value
+   
+2002-12-17 18:58  hardaker
+
+   * perl/OID/OID.xs:
+
+   remove direct call to init_snmp().  This is already called by the .pm file
+   
+2002-12-17 10:22  rstory
+
+   * local/mib2c.array-persistent.conf:
+
+   persistence for array-tables
+   
+2002-12-17 10:07  rstory
+
+   * include/net-snmp/library/read_config.h,
+   snmplib/read_config.c:
+
+   add read_config_store_data_prefix; add ASN_TIMETICKS w/ASN_UNSIGNED cases
+   
+2002-12-17 09:44  rstory
+
+   * snmplib/snmpUDPDomain.c:
+
+   don't use SO_REUSE_ADDR so agent port can't be hijacked
+   
+2002-12-17 09:43  rstory
+
+   * net-snmp-config.in:
+
+   use local var for base agent libs; reorder base agent libs so static linking
+   works
+   
+2002-12-16 18:32  nba
+
+   * snmplib/scapi.c, agent/mibgroup/mibII/mta_sendmail.c,
+   agent/mibgroup/mibII/mta_sendmail.h:
+
+   Yet another compiler warning ...
+   
+2002-12-16 17:50  hardaker
+
+   * local/mib2c.iterate.conf:
+
+   remove bogus comment reference to table_dataset helper.
+   
+2002-12-16 17:42  nba
+
+   * agent/mibgroup/disman/mteEventNotificationTable.c,
+   agent/mibgroup/disman/mteEventTable.c,
+   agent/mibgroup/disman/mteEventTable.h,
+   agent/mibgroup/disman/mteTriggerTable.c,
+   agent/mibgroup/disman/mteTriggerTable.h, apps/snmptrapd.c
+, include/net-snmp/library/tools.h, snmplib/tools.c
+:
+
+   Spread some magic dust to quell compiler warnings (why isn't --enable-slient-libtool the default ...)
+   
+2002-12-16 11:44  jbpn
+
+   * agent/mibgroup/agentx/master.c:
+
+     - fix small memory leak (peername is copied by snmp_open_ex)
+   
+2002-12-16 11:31  jbpn
+
+   * snmplib/mib.c:
+
+     - fix small memory leak
+   
+2002-12-16 11:19  jbpn
+
+   * snmplib/parse.c:
+
+     - fix memory leak
+   
+2002-12-16 10:02  rstory
+
+   * snmplib/container.c:
+
+   remove redundant include (caused problems on Sun 5.7, reported by jbpn)
+   
+2002-12-16 08:22  rstory
+
+   * dist/nsb-functions:
+
+   configure w/out developer
+   
+2002-12-16 08:18  rstory
+
+   * configure, configure.in:
+
+   DEVFLAGS="" if not developer
+   
+2002-12-16 02:39  nba
+
+   * snmplib/: oid_stash.c, scapi.c, snmpAAL5PVCDomain.c
+, snmpIPXDomain.c, snmpTCPIPv6Domain.c,
+   snmpUDPIPv6Domain.c:
+
+   dmalloc support
+   
+2002-12-16 02:39  nba
+
+   * agent/mibgroup/mibII/ipAddr.c:
+
+   Possible leak of fd on error return
+   
+2002-12-14 10:22  rstory
+
+   * FAQ, README, sedscript.in, perl/SNMP/SNMP.pm
+, snmplib/snmp_version.c:
+
+   - (snmplib/snmp_version.c sedscript.in): version tag ( 5.0.7.pre1 )
+   
+2002-12-14 10:21  rstory
+
+   * ChangeLog, NEWS:
+
+   update for 5.0.7.pre1
+   
+
+
+-------------------------------------------------------------------------------
+
+Changes: V5.0.6 -> V5.0.7pre1
+
+2002-12-14 09:59  rstory
+
+   * dist/nsb-functions:
+
+   check for agent/mibgroup; fix modules for config_dist
+   
+2002-12-14 09:58  rstory
+
+   * man/: netsnmp_bulk_to_next.3, netsnmp_debug.3,
+   netsnmp_handler.3, netsnmp_old_api.3,
+   netsnmp_read_only.3, netsnmp_serialize.3,
+   netsnmp_table.3, netsnmp_table_array.3,
+   netsnmp_table_data.3, netsnmp_table_dataset.3,
+   netsnmp_todo.3:
+
+   update for 5.0.7.pre1
+   
+2002-12-14 09:54  rstory
+
+   * Makefile.top:
+
+   bump rev to 5.0.7
+   
+2002-12-14 09:49  rstory
+
+   * Makefile.in:
+
+   add -n to grep for C++ comments
+   
+2002-12-14 09:47  rstory
+
+   * agent/Makefile.depend, agent/helpers/Makefile.depend,
+   agent/mibgroup/Makefile.depend,
+   apps/snmpnetstat/Makefile.depend, apps/Makefile.depend,
+   snmplib/Makefile.depend:
+
+   make depend
+   
+2002-12-14 09:45  rstory
+
+   * agent/mibgroup/mibII/ipAddr.c:
+
+   remove C++ comments
+   
+2002-12-14 09:30  rstory
+
+   * include/net-snmp/agent/snmp_agent.h:
+
+   add comments to some structure members
+   
+2002-12-14 09:29  rstory
+
+   * agent/helpers/table_array.c:
+
+   errors during commit undo should be xxFAILED; use set_request_error instead of
+   set_mode_request_error; remove incorrect comment; more debugging; check for
+   and call lower handlers
+   
+2002-12-14 09:27  rstory
+
+   * agent/helpers/table.c:
+
+   always process later passes of a set request
+   
+2002-12-13 16:06  nba
+
+   * agent/mibgroup/host/hr_swinst.c:
+
+   Quell compiler warnings
+   
+2002-12-13 15:47  nba
+
+   * agent/mibgroup/mibII/var_route.c, snmplib/default_store.c
+:
+
+   Quell compiler warnings
+   
+2002-12-13 15:40  nba
+
+   * snmplib/scapi.c:
+
+   Fix incomplete zeroing of security data
+   
+2002-12-13 15:39  nba
+
+   * snmplib/parse.c:
+
+   Fix a possible freeing of a NULL pointer
+   
+2002-12-13 15:38  nba
+
+   * agent/helpers/table_dataset.c,
+   agent/mibgroup/mibII/ipAddr.c, apps/snmptrapd.c,
+   include/net-snmp/agent/table_data.h, snmplib/snmp_api.c
+:
+
+   Quell compiler warnings
+   
+2002-12-13 11:38  dts12
+
+   * agent/agent_handler.c:
+
+   Clear the 'processed' flag between passes, so that handlers
+   can correctly clean up after errors have been detected.
+   
+2002-12-13 11:06  rstory
+
+   * agent/mibgroup/agentx/subagent.c:
+
+   add asser to try and cath intermittent crash i've been seeing
+   
+2002-12-13 11:04  rstory
+
+   * agent/mibgroup/agentx/master.c:
+
+   log unknown agentx operation
+   
+2002-12-13 10:12  rstory
+
+   * agent/helpers/table_array.c:
+
+   if no row create callback on set, use NOTWRITABLE instead of NOSUCHINSTANCE
+   
+2002-12-13 10:04  rstory
+
+   * agent/helpers/debug_handler.c:
+
+   fix cut-n-paste so delegated flag displayed properly
+   
+2002-12-13 10:01  rstory
+
+   * snmplib/default_store.c:
+
+   log text (APP|LIB|TOK) instead of store id in debug msgs
+   
+2002-12-13 09:53  rstory
+
+   * dist/nsb-functions:
+
+   add --with-libwrap
+   
+2002-12-13 09:49  rstory
+
+   * FAQ:
+
+   grammar/indention tweak + mention strip for memory footprint question
+   
+2002-12-13 09:32  dts12
+
+   * perl/SNMP/Makefile.PL:
+
+   Remove explicit mention of SNMP module documentation.
+   This setting doesn't seem to be necessary, and without it,
+   the man page is installed automatically.
+   
+2002-12-13 07:47  jbpn
+
+   * apps/snmptrapd.c:
+
+     - make -S do the same as snmpd -S (set the syslog facility)
+     - make -l print a warning saying that it is deprecated and -S should
+       be used instead
+   
+2002-12-13 07:14  jbpn
+
+   * snmplib/read_config.c:
+
+     - increase width of token field to improve legibility of
+       configuration directive help output
+   
+2002-12-12 17:46  nba
+
+   * apps/snmptable.c:
+
+   Protect against unknown -O options
+   
+2002-12-12 15:56  nba
+
+   * agent/mibgroup/smux/smux.c:
+
+   Fix some size_t that really should be int
+   
+2002-12-12 14:18  nba
+
+   * include/net-snmp/library/default_store.h,
+   include/net-snmp/library/mib.h, man/snmp.conf.5.def,
+   man/snmpcmd.1.def, snmplib/mib.c, snmplib/snmp_api.c
+:
+
+   A long overdue patch (#415252) from Robert Hastings that implements
+   reverse DISPLAY-HINT processing, i.e. it allows you to input data
+   formatted like the DISPLAY-HINT prescribes. Enabled by default, but
+   can be disabled with the -Ih option or noDisplayHint in snmp.conf
+   
+2002-12-12 13:56  nba
+
+   * agent/mibgroup/mibII/vacm_vars.c:
+
+   parse oids in view statements the same way the apps do it (consistency, he said)
+   
+2002-12-12 13:35  hardaker
+
+   * perl/agent/agent.xs:
+
+   Add a getRootOID function to the reginfo pointer passed into handlers.
+   
+2002-12-12 13:34  rstory
+
+   * local/mib2c.array-user.conf:
+
+   change create and duplicate row to return specific context instead of generic
+   netsnmp_index; catch error from parse_oid_indexes on row creation
+   
+2002-12-12 13:34  hardaker
+
+   * perl/SNMP/t/mib.t:
+
+   Print errors to STDERR instead.
+     (actually don't because these statements are commented out in the
+     first place)
+   
+2002-12-12 13:33  hardaker
+
+   * agent/agent_registry.c:
+
+   Reverse the context of a context if statement so if not the context
+   then don't use the context in the given context.
+   
+2002-12-12 12:56  jbpn
+
+   * apps/snmptrapd.c:
+
+     - drop long-deprecated -q and -S options
+     - minor formatting fixes
+   
+2002-12-12 12:35  jbpn
+
+   * agent/snmpd.c:
+
+      - remove duplicate message in usage
+   
+2002-12-12 11:37  dts12
+
+   * man/snmpd.1.def, agent/snmpd.c:
+
+   Implement a command-line option (-S) to set the facility to use when
+   logging via syslog.   Based on an idea by Joel Rosdahl (Patch #627701)
+   Note that -l and -L are already taken:-(
+   
+   ToDo:
+     Provide configuration directives for both this, and the syslog token ('snmpd').
+   
+2002-12-12 11:18  dts12
+
+   * man/snmpd.conf.5.def, agent/mibgroup/mibII/system_mib.c
+:
+
+   Support setting of sysDescr and sysObjectID via snmpd.conf
+   configuration directives (though not via SNMP SET reqests).
+   Patches supplied by Joel Rosdahl (#627702 and #628011)
+   
+2002-12-12 10:58  dts12
+
+   * agent/helpers/: all_helpers.c, table.c:
+
+   Suppress some compiler warnings.
+   Based on patch supplied by Chris Johns (#644041)
+   
+2002-12-12 10:42  dts12
+
+   * agent/mibgroup/ucd-snmp/: memory_solaris2.c (V4-2-patches.6),
+   memory_solaris2.c:
+
+   Use 'sysconf' to report on Solaris memory usage.
+   Based on patch supplied by Ben Stern (#651182)
+   
+2002-12-12 10:00  dts12
+
+   * agent/mibgroup/agentx/master.c:
+
+   Basic support for multiple AgentX sockets (on the master side at least).
+   See Feature Request #632556
+   
+2002-12-12 08:57  rstory
+
+   * dist/Makefile:
+
+   create version tag from version so cvs export works; fix REL; add tar.gz
+   of source as dependency for rpmfiles
+   
+2002-12-12 08:04  nba
+
+   * snmplib/: data_list.c, snmpCallbackDomain.c,
+   snmpTCPDomain.c, snmpUDPDomain.c, snmpUnixDomain.c
+, snmp_enum.c, snmp_secmod.c, snmp_transport.c
+:
+
+   dmalloc support
+   
+2002-12-12 07:18  dts12
+
+   * snmplib/mib.c:
+
+   Document the -OU option, and alphabetise the handling of options.
+   
+2002-12-12 06:25  dts12
+
+   * apps/Makefile.in:
+
+   Install 'snmpinform' as a relative link, rather than an absolute one.
+   Fix provided by the indefatigable Stefan Radman (Bug #652587)
+   
+2002-12-12 05:56  dts12
+
+   * configure, configure.in:
+
+   Quote configure options when contructing net-snmp-configure and net-snmp-configure.h
+   This allows options containing spaces, etc, to be handled correctly.
+   (See Feature Request #547152)
+   
+2002-12-11 16:52  nba
+
+   * agent/mibgroup/host/hr_disk.c:
+
+   Patch for FreeBSD. Thanks to Jun Kuriyama
+   
+2002-12-11 12:16  dts12
+
+   * snmplib/: snmp_logging.c (V4-2-patches.4), snmp_logging.c:
+
+   Try disabling line-buffering on Windows systems (since it
+   apparently enables full-buffering instead).  See Bug #558837.
+   
+2002-12-11 11:25  dts12
+
+   * perl/SNMP/t/: async.t, get.t, getnext.t,
+   notify.t, set.t:
+
+   Explicitly set SNMP version = 1 (the original default as expected by the tests)
+   This should now pass all tests apart from conf.t #3
+   
+2002-12-11 06:46  dts12
+
+   * include/net-snmp/agent/auto_nlist.h:
+
+   Be more selective in using the 64-bit version of nlist. (Bug #611655)
+   
+2002-12-11 06:27  dts12
+
+   * README.solaris:
+
+   Mention the non-functionality of one of the suggested approaches.
+   (Bug #617119).   Reported by Quanah Gibson-Mount
+   
+2002-12-11 06:20  dts12
+
+   * agent/Makefile.in:
+
+   Ensure that the destination directory exists before installing the
+   embedded perl script.  (Bug #617891) Fix provided by Stefan Radman.
+   
+2002-12-11 05:56  dts12
+
+   * README.snmpv3 (V4-2-patches.4), README.snmpv3:
+
+   Document the location assumptions being made in this description.
+   
+2002-12-11 04:47  dts12
+
+   * include/net-snmp/library/default_store.h,
+   include/net-snmp/library/mib.h, snmplib/mib.c,
+   man/snmpcmd.1.def:
+
+   Provide a mechanism for forcing strings to be displayed in either
+   ASCII or Hex format, bypassing the "guess" mechanism as to which
+   is more appropriate.   Suggested by Nick Kanakakorn.
+     Note that this does not affect objects with a Display-Hint in
+   their MIB definition.
+   
+2002-12-11 04:30  dts12
+
+   * agent/ds_agent.h, agent/snmpd.c, testing/eval_tools.sh
+   (V4-2-patches.[2,26,6]), agent/agent_read_config.c,
+   agent/snmpd.c, include/net-snmp/agent/ds_agent.h,
+   testing/eval_tools.sh:
+
+   Command-line option to control whether to unlink the PID file or not.
+   Necessary for correct test operation.
+   
+2002-12-11 04:21  dts12
+
+   * perl/OID/test.pl:
+
+   The latest library defaults to MODULE::name style output,
+   so adjust the expected output checks accordingly.
+   Also, there are actually 36 tests, not 35!
+   
+2002-12-11 04:17  dts12
+
+   * perl/OID/OID.xs:
+
+   Initialise the SNMP libraries, to set up the OID tree.
+   Addresses bugs #638024 and #627643
+     [Qn: Do we need to supply an 'appname' (c.d the SNMP module) ?]
+   
+2002-12-10 19:29  nba
+
+   * man/snmp.conf.5.def, snmplib/snmp_api.c,
+   agent/mibgroup/util_funcs.c,
+   agent/mibgroup/ucd-snmp/logmatch.c:
+
+   Allow runtime configuration of persistent directory
+   
+2002-12-10 19:24  nba
+
+   * snmplib/read_config.c:
+
+   Report errors handling persistent storage files
+   
+2002-12-10 19:23  nba
+
+   * snmplib/system.c:
+
+   Pass up error on directory creation
+   
+2002-12-10 17:27  nba
+
+   * snmplib/mib.c:
+
+   Better respect for the max width option (snmptranslate -Td)
+   
+2002-12-10 17:26  nba
+
+   * man/snmp.conf.5.def:
+
+   Document the oidOutputFormat option
+   
+2002-12-10 17:25  nba
+
+   * apps/snmptable.c:
+
+   Clean up. Remove calls to obsolete functions snmp_set_quick_print,
+   snmp_get_dump_packet, snmp_get_suffix_only. Remove last traces of the
+   non_sequential backwards hack. Make sure it works for all -O options.
+   
+2002-12-10 11:58  dts12
+
+   * agent/mibgroup/mibII/: interfaces.c (V4-2-patches.26),
+   interfaces.c:
+
+   Protect against empty lines in /proc/net/dev  (Bug #625426)
+   
+2002-12-10 11:41  dts12
+
+   * snmplib/: snmpv3.c (V4-2-patches.5), snmpv3.c:
+
+   Free destination memory before cloning SNMP Engine ID.
+   Fix provided by Martin Carlsson.  (Bug #835481)
+   
+2002-12-10 11:07  dts12
+
+   * perl/: ASN/Makefile.PL, OID/Makefile.PL,
+   SNMP/Makefile.PL, agent/Makefile.PL,
+   agent/default_store/Makefile.PL, default_store/Makefile.PL
+:
+
+   Add "$Config{ccflags}" to CCFLAGS.   (See bug #640899)
+   
+2002-12-10 10:46  dts12
+
+   * agent/mibgroup/mibII/: ipAddr.c (V4-2-patches.8), ipAddr.c:
+
+   Add support for Linux virtual interfaces in the ipAddressTable.
+   (Note this does *not* include separate per-v-interface statistics
+    in the interfaces table).
+   
+   Patch supplied by Jens Sittner (#621274)
+   
+2002-12-10 04:59  dts12
+
+   * agent/agent_handler.c:
+
+   Remove a couple of extraneous ^M characters.
+   
+2002-12-10 02:36  nba
+
+   * snmplib/mib.c:
+
+   When using -Oqv and printing an empty string you could end up with
+   a NULL string and not an empty string leading to some very obscure
+   problems in snmptable and other applications.
+   
+2002-12-09 11:12  dts12
+
+   * snmplib/snmp_api.c:
+
+   Handle missing integer values (whether 32- or 64-bit!).   Oops!
+   
+2002-12-09 10:12  dts12
+
+   * snmplib/: snmp_api.c (V4-2-patches.38), snmp_api.c:
+
+   Handle integer-based values correctly on a 64-bit platform.
+   Patch supplied by Thomas Weber (#561071)
+   
+2002-12-09 09:45  dts12
+
+   * agent/mibgroup/agentx/master.c:
+
+   Take note of subagent-requested byte ordering in subsequent communications.
+   Patch supplied by Urban (#632284)
+   
+2002-12-09 09:32  dts12
+
+   * agent/: snmpd.c (V4-2-patches.25), snmpd.c:
+
+   Remove the PID file on agent shutdown.
+   Patch supplied by Joel Rosdahl (#627699)
+   
+2002-12-09 09:25  dts12
+
+   * snmplib/system.c:
+
+   Handle 'struct sockaddr' that contain 'sa_len' fields differently
+   to those that don't (c.f ifilter_ioctl.c in BIND 9.2.1 sources)
+   Patch supplied by Joel Rosdahl (#627696)
+   
+2002-12-09 07:12  dts12
+
+   * acconfig.h, configure, configure.in:
+
+   Recognise BSDi4, and tweak the recognition of 'dlopen'.
+   Patches supplied by Joel Rosdahl.
+   
+2002-12-09 06:10  dts12
+
+   * agent/mibgroup/mibII/: at.c, interfaces.c, ip.c
+:
+
+   Remove some warnings, and try to cope with 'sysctl' failures.
+   Patches supplied by Chris Johns.
+   
+2002-12-09 04:20  dts12
+
+   * README.solaris:
+
+   Mention the limitations on /usr/ucb/sed,
+   and point people towards /usr/bin/sed instead.
+   
+2002-12-07 08:41  dts12
+
+   * agent/helpers/table_dataset.c:
+
+   Insert newly-created rows into the per-request lists, so that lower
+   level handlers can access them.
+     [Qn: Should we do something similar with updated lists as well?]
+   
+2002-12-07 08:34  dts12
+
+   * agent/helpers/table_dataset.c:
+
+   Report back the correct error for rows that couldn't be created.
+   
+2002-12-07 08:32  dts12
+
+   * agent/helpers/table_dataset.c:
+
+   Protect against freeing a row that never got created in the first place.
+   
+2002-12-06 18:05  hardaker
+
+   * testing/tests/T030snmpv3usercreation:
+
+   Skip on non-openssl machines.  THis should be changed to just not using encryption on those machines, but I do not have the time at the moment
+   
+2002-12-06 13:12  hardaker
+
+   * configure.in:
+
+   remove ucdDemoPublic from --enable-mini-agent
+   
+2002-12-06 13:02  hardaker
+
+   * configure:
+
+   remove ucdDemoPublic from --enable-mini-agent
+   
+2002-12-06 12:01  dts12
+
+   * agent/helpers/table_dataset.c:
+
+   Don't delete the "old" (non-existent) row, when tidying up after
+   creating a new row.
+   
+2002-12-06 11:40  dts12
+
+   * agent/helpers/table_dataset.c:
+
+   Tweak handling of (invalid) RowStatus creation requests in an
+   "automatic creation" table.   These should return wrongValue or
+   inconsistentValue, rather than notWritable.
+   
+2002-12-05 05:47  dts12
+
+   * agent/helpers/table_dataset.c:
+
+   Support use of RowStatus object to control creation of new rows
+   (i.e. when the 'allow_creation' flag is not set).
+   This should deal with everything except determining whether a
+   row is ready to go 'active' (e.g. via 'createAndGo').  Such a
+   decision is inherently specific to each individual MIB, so must
+   really be done in the lower-level handler.
+   
+2002-12-05 05:41  dts12
+
+   * agent/helpers/table_dataset.c:
+
+   Stop processing when a 'non-writable create' is detected.
+   
+2002-12-04 19:35  hardaker
+
+   * agent/mibgroup/disman/mteTriggerTable.c:
+
+   - BIT_STR -> OCTET_STR, which is what it should be.
+   - run eventTable entries.
+   
+2002-12-04 19:34  hardaker
+
+   * agent/mibgroup/disman/mteTriggerExistenceTable.c:
+
+   BIT_STR -> OCTET_STR, which is what it should be.
+   
+2002-12-04 19:33  hardaker
+
+   * agent/mibgroup/disman/: mteObjectsTable.c,
+   mteTriggerBooleanTable.c:
+
+   use netsnmp_strdup_and_null to get real strings from mib data.
+   
+2002-12-04 19:32  hardaker
+
+   * agent/mibgroup/disman/: event-mib.h,
+   mteEventNotificationTable.c, mteEventNotificationTable.h
+, mteEventTable.c, mteEventTable.h:
+
+   - implemented the mteEventTable and the mteEventNotificationTable
+     - FYI, total implementation time: about 4 hours
+     - no easy-to-use .conf wrappers yet though.  snmpset support only.
+   
+2002-12-04 19:29  hardaker
+
+   * local/mib2c.create-dataset.conf:
+
+   - use the netsnmp_table_set_add_indexes function which actually works.
+   
+2002-12-04 19:29  hardaker
+
+   * agent/helpers/table_dataset.c,
+   include/net-snmp/agent/table_dataset.h:
+
+   - create a netsnmp_table_set_add_indexes function.
+   - Allow row creation using rowStatus when the data column exists, but
+     there is no assigned value (ie, is NULL).
+   - use netsnmp_strdup_and_null instead of memdup to make sure an
+     implicit NULL is in place for things that use the data and need it
+     as a real string.
+   
+2002-12-04 19:27  hardaker
+
+   * net-snmp-config.in:
+
+   document --prefix
+   
+2002-12-04 13:16  hardaker
+
+   * NEWS (V4-2-patches.9), NEWS:
+
+   document 4.2.6
+   
+2002-12-03 04:44  dts12
+
+   * agent/mibgroup/host/hr_print.c:
+
+   Close printer file handle with 'fclose' rather than 'pclose' to avoid
+   a memory leak on Solaris 2.6.   Fix provided by Jacobo Matute.
+   
+2002-12-03 04:33  dts12
+
+   * agent/helpers/: table_data.c, table_dataset.c:
+
+   Translate GetNext (and GetBulk) requests into simple Get requests,
+   when passing them from the table_data handler to table_dataset.
+     This is analogous to how the iterate handler works, and allows
+   lower level handlers to override the basic behaviour (without
+   having to duplicate all of the "find next row" code every time).
+   
+2002-12-02 04:48  dts12
+
+   * agent/helpers/table.c:
+
+   Return SNMPv2-style exceptions, rather than the SNMPv1 'noSuchName' error.
+   This used to break AgentX subagents, but the latest change to snmp_agent.c
+   (to catch noSuch{Instance,Object} exceptions) seems to have fixed that problem.
+   
+2002-12-02 04:40  dts12
+
+   * agent/snmp_agent.c:
+
+   Explicitly parenthesise a comparison, to keep the compiler happy.
+   
+2002-12-02 04:39  dts12
+
+   * agent/snmp_agent.c:
+
+   Inclusive-range GetNext requests are transmitted as Get requests, so may
+   well return noSuch{Instance,Object} exceptions.  Catch these as well.
+   
+2002-12-02 04:36  dts12
+
+   * agent/helpers/table_dataset.c:
+
+   Catch (and reject) attempts to create a new row via a non-writable object.
+   
+2002-11-28 04:24  dts12
+
+   * agent/helpers/table_iterator.c:
+
+   Null out one final loop_context pointer after being freed.
+   (Patch provided by Roger McCalman)
+   
+2002-11-26 17:59  nba
+
+   * snmplib/parse.c:
+
+   Discard the secondary (GROUP) DESCRIPTION insize a MODULE-COMPLIANCE
+   to avoid leaking memory. Thanks to Eugene_Bruk@bmc.com
+   
+2002-11-26 17:53  nba
+
+   * apps/snmptranslate.c:
+
+   Reinstate the -w options that was lost in the indent fury
+   
+2002-11-26 10:50  hardaker
+
+   * agent/mibgroup/examples/notification.c:
+
+   The notification variable shouldn't be static.  A bug found while
+   tracking down a problem pointed out by Venice on IRC.
+   
+2002-11-26 04:10  dts12
+
+   * snmplib/snmp_enum.c:
+
+   Fix incorrect usage of SE_MAX_IDS vs SE_MAX_SUBIDS.
+   Reported by 'shinepeak'
+   
+2002-11-25 22:41  hardaker
+
+   * local/FAQ2HTML:
+
+   hack of a hack of a hack, or: fix multi-line FAQ questions
+   
+2002-11-25 10:08  hardaker
+
+   * README.agentx:
+
+   mention agentxPingInterval
+   
+2002-11-18 21:39  hardaker
+
+   * agent/mibgroup/smux/smux.h:
+
+   applied patch #527650
+   
+2002-11-11 17:10  nba
+
+   * snmplib/mib.c:
+
+   Respect the mibdirs conf directive. Thanks to Stefan Radman (sradman)
+   
+2002-11-11 16:57  nba
+
+   * apps/snmptrapd_log.c:
+
+   Fix a missing error return
+   
+2002-11-11 14:26  hardaker
+
+   * snmplib/: snmpTCPDomain.c, snmpUDPDomain.c:
+
+   fix taddr generation/parsing for port based transports to properly use
+   network byte ordering.
+   
+2002-11-11 14:25  hardaker
+
+   * agent/mibgroup/target/snmpTargetAddrEntry.c:
+
+   fix write support for the timeout column
+   
+2002-11-09 10:06  nba
+
+   * agent/mib_modules.c, agent/snmp_vars.c,
+   agent/mibgroup/agentx/master.c,
+   agent/mibgroup/agentx/master_admin.c,
+   agent/mibgroup/agentx/subagent.c,
+   include/net-snmp/agent/mib_modules.h,
+   include/net-snmp/library/snmpUDPIPv6Domain.h:
+
+   Do away with a bunch of compiler warnings
+   
+2002-11-09 09:59  nba
+
+   * agent/mibgroup/: util_funcs.c, ucd-snmp/extensible.c,
+   ucd-snmp/memory.c, ucd-snmp/memory_freebsd2.c,
+   ucd-snmp/pass.c, ucd-snmp/proc.c, host/hr_print.c
+:
+
+   Zero is an OK file descriptor. -1 is the error return
+   
+2002-11-09 09:54  nba
+
+   * include/net-snmp/library/parse.h, snmplib/parse.c:
+
+   More to the point message for undefined identifiers. Brought forward from 4.2
+   
+2002-11-09 09:52  nba
+
+   * apps/snmpvacm.c:
+
+   Print the error information in case of error
+   
+2002-11-09 09:51  nba
+
+   * apps/snmpnetstat/route.c:
+
+   Protect against v2 exception results
+   
+2002-11-09 09:49  nba
+
+   * sedscript.in, man/snmpcmd.1.def:
+
+   Protect PREFIX when it is the env var. Thanks to Stefan Radman (sradman)
+   
+2002-11-09 09:47  nba
+
+   * mibs/rfclist:
+
+   Add RFC 3371 L2TP-MIB
+   
+2002-11-09 09:46  nba
+
+   * mibs/IANAifType-MIB.txt:
+
+   Updated from IANA
+   
+2002-11-07 05:55  jbpn
+
+   * apps/snmptable.c:
+
+     - fix -Cf and -Cw option processing (previously would core dump if
+       no option passed), as pointed out by hampa on #net-snmp
+   
+2002-11-06 15:35  rstory
+
+   * net-snmp-config.in:
+
+   fix cut/paste
+   
+2002-11-06 15:04  rstory
+
+   * configure:
+
+   configure to match configure.in & makefiles
+   
+2002-11-06 14:08  rstory
+
+   * net-snmp-config.in:
+
+   add missing end quote
+   
+2002-11-06 13:35  rstory
+
+   * net-snmp-config.in:
+
+   add @DEVFLAGS@ weherver there is a @CFLAGS@, except for the new --base-cflags
+   
+2002-11-06 13:22  rstory
+
+   * Makefile.top:
+
+   add @DEVFLAGS@ to CFLAGS
+   
+2002-11-06 13:21  rstory
+
+   * configure.in:
+
+   seperate developer cflags from normal cflags
+   
+2002-11-06 12:55  rstory
+
+   * agent/mibgroup/util_funcs.h:
+
+   change struct.h include to use "" instead of <net-snmp/>, since it it a local
+   include, not a system include
+   
+2002-11-06 12:39  rstory
+
+   * acconfig.h, agent/mibgroup/util_funcs.h,
+   agent/mibgroup/ucd-snmp/lmSensors.c,
+   include/net-snmp/net-snmp-config.h.in,
+   snmplib/ucd-snmp-includes.h, win32/config.h,
+   win32/net-snmp/net-snmp-config.h:
+
+   purge IN_UCD_SNMP_SOURCE
+   
+2002-11-05 12:24  hardaker
+
+   * perl/AnyData_SNMP/netsh:
+
+   added a xmlshort delimiter as requested by lands on IRC
+   
+2002-11-05 11:59  rstory
+
+   * dist/cvsup:
+
+   tabs -> spaces only try to chmod RO src dir if owner of dirs
+   
+2002-11-05 11:56  rstory
+
+   * mkinstalldirs:
+
+   making a directory is not an error, so don't send output to stderr
+   
+2002-11-04 11:15  hardaker
+
+   * agent/mibgroup/target/snmpTargetParamsEntry.c:
+
+   allow unregistered security models <= 2
+   
+2002-11-04 11:14  hardaker
+
+   * agent/mibgroup/notification/snmpNotifyTable.c:
+
+   enable row creation to be better supported (rowstatus no longer has to
+   be first in the list, ...)
+   
+2002-11-04 11:13  hardaker
+
+   * net-snmp-config.in:
+
+   add cppflags to --cflags
+   
+2002-11-04 11:13  hardaker
+
+   * NEWS:
+
+   add stuff for 5.0.7 (or whatever) mentioning a few new features.
+   
+2002-11-01 12:06  hardaker
+
+   * snmplib/snmp_api.c:
+
+   Fixed bug #632094 using the suggested method: watch for NULL strerror() return
+   
+2002-11-01 10:09  rstory
+
+   * Makefile.in:
+
+   undo my changes from r 5.17, attempting to reduce runs of config.status
+   by using explicit paths to srcdir, and let VPATH do it's thing
+   
+2002-10-29 14:30  rstory
+
+   * snmplib/Makefile.in:
+
+   target to build binary array test app; tweak to parse test target (reduces most
+   but not all external references)
+   
+2002-10-29 14:27  rstory
+
+   * snmplib/container_binary_array.c:
+
+   fix for binary search problem noted by Romy Christensen on coders; partial
+   (ifdef'd out) code for a binary array iterator
+   
+2002-10-29 14:25  rstory
+
+   * snmplib/test_binary_array.c:
+
+   simple test program for binary array
+   
+2002-10-29 09:28  hardaker
+
+   * perl/SNMP/SNMP.xs:
+
+   Fix debugging as noted in bug #630348
+   
+2002-10-28 19:47  hardaker
+
+   * configure, configure.in:
+
+   changed .1.6.3 to 1.3.6 as noted in comp.protocols.snmp
+   
+2002-10-28 15:01  hardaker
+
+   * agent/mibgroup/examples/ucdDemoPublic.conf:
+
+   changed password
+   
+2002-10-28 14:57  hardaker
+
+   * agent/mibgroup/examples/ucdDemoPublic.conf:
+
+   misc vacm fixes
+   
+2002-10-28 08:41  jbpn
+
+   * snmplib/snmp_api.c:
+
+     - remove erroneous free() of rxbuf
+   
+2002-10-25 12:35  hardaker
+
+   * snmplib/snmp_api.c:
+
+   fixed SNMP_CALLBACK_OP_DISCONNECT -> NETSNMP_OP_CALLBACK_DISCONNECT as noted by TrogL on IRC
+   
+2002-10-25 07:34  jbpn
+
+   * snmplib/snmp_api.c:
+
+     - perform a NETSNMP_CALLBACK_OP_DISCONNECT type callback if we
+       decide to shutdown a stream type connection because we received
+       an excessively large packet.
+   
+2002-10-24 10:41  hardaker
+
+   * README:
+
+   Added the super-bug-patch generator Stefan Radman to the THANKS list
+   
+2002-10-24 10:40  hardaker
+
+   * configure.in:
+
+   bug #617508: added the mta_sendmail module to --help
+   
+2002-10-24 10:35  hardaker
+
+   * local/Makefile.in:
+
+   update install list for mib2c conf files and remove old one
+   
+2002-10-23 20:34  hardaker
+
+   * configure, configure.in:
+
+   fix incorrect variable name I noticed when copying to a different configure script in another package
+   
+2002-10-23 20:28  hardaker
+
+   * Makefile.in:
+
+   Fixed bug#617838: versiontag isn't distributed and shouldn't be always
+   used in the make distclean calls.
+   
+2002-10-23 20:12  hardaker
+
+   * agent/mibgroup/disman/mteTriggerTable.c:
+
+   inconsequencial memory leaks fixed (init time leaks).
+   
+2002-10-23 20:10  hardaker
+
+   * agent/helpers/table_iterator.c:
+
+   Fixed various memory leaks in the table_iterator as pointed out by
+   Roger McCalman and Jay Parlar on the -coders list (including their patches)
+   
+2002-10-23 18:44  hardaker
+
+   * agent/mibgroup/notification/snmpNotifyTable.c:
+
+   snmpNotifyTable.c
+   
+2002-10-23 18:40  hardaker
+
+   * agent/mibgroup/disman/mteTriggerTable.c:
+
+   free a previously malloced pointer to the watch variable before replacing it.
+   
+2002-10-23 18:40  hardaker
+
+   * agent/mibgroup/examples/delayed_instance.c:
+
+   remove duplicate unused malloc.
+   
+2002-10-21 12:43  jbpn
+
+   * include/net-snmp/system/solaris2.9.h:
+
+     - add system file for Solaris 9
+   
+2002-10-17 22:44  hardaker
+
+   * agent/agent_registry.c, agent/snmp_agent.c,
+   agent/mibgroup/mibII/vacm_vars.c,
+   agent/mibgroup/mibII/vacm_vars.h,
+   include/net-snmp/agent/agent_callbacks.h,
+   include/net-snmp/agent/agent_registry.h,
+   include/net-snmp/library/vacm.h, snmplib/vacm.c:
+
+   Optimized the VACM checks in the case of getnext/getbulk so that when
+   large portions of the mib tree are excluded, the sub-mib access code
+   won't be called at all (finally implementing a very long needed optimization).
+   
+2002-10-17 22:41  hardaker
+
+   * include/net-snmp/library/snmp_api.h, snmplib/snmp_api.c
+:
+
+   new function to find the commonality between two oids: netsnmp_oid_find_prefix
+   
+2002-10-17 22:39  hardaker
+
+   * Makefile.in, aclocal.m4, configure,
+   configure.in:
+
+   Print out a "summary" at the end of a run
+   
+2002-10-17 05:40  dts12
+
+   * local/mib2c.old-api.conf:
+
+   Properly terminate a loop construct (missing '@end@')
+   Spotted by Karl Cooper.    Oops!
+   
+2002-10-16 17:19  rstory
+
+   * agent/snmpd.c:
+
+   restore continue after EINTR caused by signal we handled (instead of falling
+   thorough to exit!)
+   
+2002-10-16 17:00  rstory
+
+   * agent/snmpd.c:
+
+   check for our signal flags on EINTR, and only relesect if not changed;
+   debug msg when signals registered and for select/fdsets;
+   
+2002-10-16 15:52  rstory
+
+   * Makefile.top:
+
+   move CPPFLAGS before user configure CFLAGS.. so if a user adds something
+   like /usr/local/include to CFLAGS, we will pick up our local includes first,
+   instead of includes from a previous release..
+   
+2002-10-16 00:06  rstory
+
+   * apps/: snmptrapd.c, snmptrapd_log.c, snmptrapd_log.h
+:
+
+   make sure snmptrapd always honors DS_APP_NUMERIC_IP for logging
+   
+2002-10-15 17:09  rstory
+
+   * snmplib/mib.c:
+
+   netsnmp_get_boolean -> netsnmp_ds_get_boolean
+   
+2002-10-15 14:08  rstory
+
+   * agent/helpers/table.c:
+
+   fix constant used in assert, noted on coders
+   
+2002-10-15 14:07  rstory
+
+   * agent/snmp_agent.c:
+
+   include syslog for libwrap log levels
+   
+2002-10-15 10:39  hardaker
+
+   * man/snmpcmd.1.def:
+
+   Add yet another way to specify v6 addresses
+   
+2002-10-14 11:54  hardaker
+
+   * man/snmpcmd.1.def:
+
+   fix ipv6 transport address specs
+   
+2002-10-11 19:18  hardaker
+
+   * README.cmu, dist/net-snmp.spec:
+
+   Remove the README.cmu file (entirely out of date at this point).
+   
+2002-10-11 16:57  hardaker
+
+   * acconfig.h, configure, configure.in,
+   agent/mibgroup/ucd-snmp/disk.c,
+   include/net-snmp/net-snmp-config.h.in:
+
+   patch #600933 from Donal Diamond: dskPercentNode for FreeBSD4
+   
+2002-10-11 16:49  hardaker
+
+   * snmplib/mib.c:
+
+   Patch #598280 from Jeff Watson: make -OQ not print type warnings.
+   
+2002-10-11 16:43  hardaker
+
+   * dist/Makefile:
+
+   fix include directory
+   
+2002-10-11 16:42  hardaker
+
+   * dist/.cvsignore:
+
+   ignore rpm subdir
+   
+2002-10-11 16:32  hardaker
+
+   * dist/RELEASE-INSTRUCTIONS:
+
+   better docs about auto-extracted SF news
+   
+2002-10-11 16:04  hardaker
+
+   * dist/: Makefile, net-snmp.spec:
+
+   merge in patch #598869: Mark Harig's better rpm stuff
+   
+2002-10-11 15:21  hardaker
+
+   * include/net-snmp/library/default_store.h, snmplib/mib.c
+:
+
+   Alternative to a patch suggestion: add -OU to not print UNITS suffixes.
+   
+2002-10-11 15:18  hardaker
+
+   * man/snmpcmd.1.def:
+
+   ../agent/snmp_agent.c
+   
+2002-10-11 15:14  hardaker
+
+   * man/snmp.conf.5.def:
+
+   document dontPrintUnits
+   
+2002-10-11 14:48  hardaker
+
+   * agent/snmp_agent.c:
+
+   Patch #617151 from Andrew Rucker Jones: fix libwrap headers.
+     - I'm still unhappy with how libwrap functions...  needs thinking about.
+   
+2002-10-11 13:53  hardaker
+
+   * agent/mibgroup/ucd-snmp/diskio.c:
+
+   Patch #312694 from John Surveyor: fix diskio on solaris.
+   
+2002-10-11 13:37  hardaker
+
+   * agent/mibgroup/mibII/at.c:
+
+   Applied patch #621398 from Matthew Krenzer to fix linux arp table.
+   
+2002-10-11 09:47  rstory
+
+   * win32/snmpdsdk/snmpd.dsp:
+
+   chg netsnmpmibs -> netsnmpmibsskd (noted on coders by Jed Whitten)
+   
+2002-10-11 09:45  jbpn
+
+   * man/snmpcmd.1.def:
+
+     - note square brackets for IPv6 addresses
+   
+2002-10-11 09:40  jbpn
+
+   * agent/snmpd.c:
+
+     - restart select() more quickly if an EINTR happens
+   
+2002-10-11 01:51  hardaker
+
+   * FAQ:
+
+   applied Harrie's patch describing low memory footprints
+   
+2002-10-10 11:38  hardaker
+
+   * snmplib/snmpksm.c:
+
+   Patch from Ken Horstein to fix KSM module
+   
+2002-10-10 06:22  jbpn
+
+   * agent/helpers/table_array.c:
+
+     - remove bad inlines which cause file not to compile with Sun CC.
+       See bug #620827.
+   
+2002-10-10 02:03  hardaker
+
+   * dist/net-snmp.spec:
+
+   add .la files
+   
+2002-10-10 02:00  hardaker
+
+   * dist/net-snmp.spec:
+
+   make the .spec file almost usable.
+   
+2002-10-08 18:55  hardaker
+
+   * FAQ:
+
+   FAQ updates for download sites.
+   
+2002-10-08 10:36  hardaker
+
+   * perl/OID/OID.pm:
+
+   Patch from Joshua Keroes for string comparisons
+   
+2002-10-07 13:57  hardaker
+
+   * FAQ:
+
+   added a statement about the COPYING file (suggested by Harrie)
+   
+2002-10-06 14:32  rstory
+
+   * dist/README.build-scripts:
+
+   nsb-* likes full paths, update examples; fix sourceforge upload site
+   
+2002-10-05 17:42  hardaker
+
+   * README, sedscript.in, snmplib/snmp_version.c
+, FAQ, perl/SNMP/SNMP.pm:
+
+   - (snmplib/snmp_version.c sedscript.in): version tag ( 5.0.6 )
+
+
+-------------------------------------------------------------------------------
+
+Changes: V5.0.5 -> V5.0.6
+
+2002-10-05 14:29  hardaker
+
+   * agent/Makefile.depend, agent/helpers/Makefile.depend,
+   agent/mibgroup/Makefile.depend, apps/Makefile.depend,
+   apps/snmpnetstat/Makefile.depend, snmplib/Makefile.depend
+:
+
+   make depend
+   
+2002-10-05 14:09  hardaker
+
+   * Makefile.top:
+
+   update for 5.0.6
+   
+2002-10-05 14:08  hardaker
+
+   * dist/RELEASE-INSTRUCTIONS:
+
+   remove illegal flag from nsb-config
+   
+2002-10-05 13:41  rstory
+
+   * agent/snmp_agent.c:
+
+   efence is your friend: don't allocate 0 bytes
+   
+2002-10-05 12:58  rstory
+
+   * agent/mibgroup/agentx/subagent.c:
+
+   efence is your friend: don't reference ptr after is has been free'd.
+   
+2002-10-04 07:17  hardaker
+
+   * agent/snmp_agent.c:
+
+   fix secondary effect of bug 613983 and really fix it this time.
+   
+2002-10-02 10:56  hardaker
+
+   * agent/mibgroup/tunnel/: tunnel.c (V4-2-patches.2), tunnel.c
+:
+
+   Patch from Frank Strauss to fix some coding errors
+   
+2002-10-01 07:39  rstory
+
+   * agent/snmp_vars.c:
+
+   offical patch 617049: initialize container list earlier (in init_agent)
+   
+2002-10-01 07:35  rstory
+
+   * agent/snmp_vars.c:
+
+   remove ^M characters (damn windows editors)
+   
+2002-09-30 15:17  rstory
+
+   * FAQ, README, sedscript.in, perl/SNMP/SNMP.pm
+, snmplib/snmp_version.c:
+
+   - (snmplib/snmp_version.c sedscript.in): version tag ( 5.0.5 )
+   
+2002-09-30 15:16  rstory
+
+   * dist/RELEASE-INSTRUCTIONS:
+
+   add info on md5sums and gpg signing
+   
+2002-09-30 15:15  rstory
+
+   * dist/cvsup:
+
+   fix chmod to do what I wanted, not what I told it
+   
+2002-09-30 15:14  rstory
+
+   * ChangeLog, Makefile.top, NEWS:
+
+   update for 5.0.5
+   
+2002-09-30 14:27  rstory
+
+   * ChangeLog:
+
+   merge pre changes into 5.0.4 comments
+   
+2002-09-30 14:25  rstory
+
+   * NEWS:
+
+   update for 5.0.4
+   
+2002-09-30 14:23  hardaker
+
+   * NEWS:
+
+   NEWS updates for 5.0.4
+   
+2002-09-30 14:03  rstory
+
+   * README:
+
+   update my email address
+   
+2002-09-30 14:03  rstory
+
+   * ChangeLog:
+
+   update for release 5.0.4
+
+
+-------------------------------------------------------------------------------
+
+Changes: V5.0.3 -> V5.0.5
+
+2002-09-30 16:08  rstory
+
+   * agent/helpers/table.c:
+
+   make len a size_t to fix problem on 64 bit system, reported by sebnod` in IRC
+   
+2002-09-30 16:05  rstory
+
+   * agent/helpers/table.c:
+
+   don't use static local vars, as they are likely to cause problems with threads
+   
+2002-09-30 15:48  rstory
+
+   * dist/nsb-package:
+
+   make sure install dir is relative to build dir
+   
+2002-09-30 15:20  rstory
+
+   * snmplib/vacm.c:
+
+   add missing newline in debug
+   
+2002-09-30 15:19  rstory
+
+   * dist/: nsb-functions, nsb-package:
+
+   fix typos
+   
+2002-09-30 15:18  rstory
+
+   * agent/snmp_agent.c:
+
+   avoid infinite loop
+   
+2002-09-30 14:59  rstory
+
+   * dist/nsb-functions:
+
+   don't assume make is GNU make, and search for it. require user to set an
+   env var if no GNU make is found in PATH
+   
+2002-09-30 14:58  rstory
+
+   * dist/cvsup:
+
+   if CVS dir is ro, automagically make it rw before update and ro after update
+   
+2002-09-27 14:03  hardaker
+
+   * agent/snmp_agent.c:
+
+   make get_set_cache() return an error if no previous SET has been started.
+   
+2002-09-27 14:02  hardaker
+
+   * agent/agent_registry.c:
+
+   double check against some null pointers before using them in the cache code.
+   
+2002-09-27 13:36  hardaker
+
+   * agent/snmp_agent.c:
+
+   set treecache_num to -1 at init of memory, to be extra safe.
+   
+2002-09-26 14:58  hardaker
+
+   * agent/: snmp_agent.c, snmpd.c:
+
+   move libwrap variables
+   
+2002-09-26 14:57  hardaker
+
+   * perl/agent/agent.xs:
+
+   ok, remove tcpwrappers vars
+   
+2002-09-26 13:44  hardaker
+
+   * perl/agent/agent.xs:
+
+   define stupid variables needed by tcpwrappers because they don't get
+   concepts of encapsulation.  arg.
+   
+2002-09-26 11:26  hardaker
+
+   * perl/agent/agent.xs:
+
+   change call_pv to perl_call_pv for older versions of perl.
+   
+2002-09-26 11:10  hardaker
+
+   * snmplib/mib.c:
+
+   run strdup() on get_mib_dir() results to fix bug pointed out by Eugene Bruk.
+   
+2002-09-23 13:14  hardaker
+
+   * dist/RELEASE-INSTRUCTIONS:
+
+   mention freshmeat
+   
+2002-09-23 13:13  hardaker
+
+   * agent/mibgroup/ucd-snmp/versioninfo.c,
+   agent/mibgroup/ucd-snmp/versioninfo.h, mibs/UCD-SNMP-MIB.txt
+:
+
+   - implement a (long needed) settable variable to store the current
+     persistent information.
+   
+2002-09-23 12:47  hardaker
+
+   * snmplib/snmp_api.c:
+
+   - make not in time window reports trigger a resend of informs.
+     (suggestion from Erik Anggard)
+   
+2002-09-20 11:28  jbpn
+
+   * agent/mibgroup/mibII/vacm_vars.h:
+
+     - remove functions vacm_parse_security and vacm_free_security which
+       don't exist
+   
+2002-09-19 17:01  hardaker
+
+   * perl/agent/agent.xs:
+
+   - support agent shutdowns (well, ok it's just an api since it doesn't work).
+   - misc bug fixes.
+   
+2002-09-19 16:38  hardaker
+
+   * perl/agent/: agent.xs, netsnmp_request_infoPtr.pm:
+
+   fix agent request_infoPtr problems.
+   
+2002-09-19 12:04  dts12
+
+   * win32/snmptranslate/snmptranslate.dsp:
+
+   Compile and link with 'getopt.c' explicitly.
+   
+   This should not be necessary, but for some reason
+   (that completely escapes me!), using command-line options
+   (such as -IR) with the Release version of snmptranslate
+   causes a run-time DLL error.  (The Debug version is fine).
+   The other applications seem to be OK - this problem only
+   seems to hit snmptranslate.  So as a sticking-plaster,
+   compiliing getopt.c in as part of the project, keeps both
+   versions of the application happy.
+     Someone with better Windows knowledge than me needs to
+   look at this and fix it properly.
+   
+2002-09-19 06:14  jbpn
+
+   * include/net-snmp/library/snmp_api.h:
+
+     - undo worst of indent damage
+   
+2002-09-19 06:03  jbpn
+
+   * include/net-snmp/library/snmp_api.h:
+
+     - remove _dparse functions (which don't exist)
+   
+2002-09-18 10:55  hardaker
+
+   * testing/eval_tools.sh:
+
+   reset SNMP_SLEEP after loop
+   
+2002-09-18 10:41  jbpn
+
+   * snmplib/snmp_client.c:
+
+     - remove very obsolete (and not used anywhere) #definitions of
+       PARTY_MIB_BASE and CONTEXT_MIB_BASE
+   
+2002-09-18 02:59  rstory
+
+   * ChangeLog:
+
+   tweak for 5.0.4 last minute update
+   
+2002-09-18 02:48  rstory
+
+   * testing/eval_tools.sh:
+
+   chg > to -gt to achieve intended result
+   
+2002-09-18 01:39  rstory
+
+   * NEWS:
+
+   update for 5.0.4
+   
+2002-09-18 01:33  rstory
+
+   * FAQ, README, sedscript.in, perl/SNMP/SNMP.pm
+, snmplib/snmp_version.c:
+
+   - (snmplib/snmp_version.c sedscript.in): version tag ( 5.0.4 )
+   
+2002-09-18 01:32  rstory
+
+   * ChangeLog:
+
+   update for 5.0.4
+   
+2002-09-18 00:59  rstory
+
+   * Makefile.in:
+
+   add $(srcdir) to a few dependencies to try and reduce the # of times that
+   config.status is run when building outside the src dir
+   
+2002-09-18 00:54  rstory
+
+   * README.win32:
+
+   visually provocative section headers; add recent status (all bad news);
+   not to use new win32sdk.dsw to get additonal functionality with platform sdk;
+   remove info on removing agentx, as it's been around now for a while; add
+   section on what files to edit to add mib2c generated code to agent; remove
+   reference to specific release number in example
+   
+2002-09-18 00:25  rstory
+
+   * win32/snmpdsdk/snmpd.dsp:
+
+   take 'sdk' out of exe name
+   
+2002-09-18 00:25  rstory
+
+   * win32/win32sdk.dsw:
+
+   swap snmpdsdk for snmpd
+   
+2002-09-18 00:14  rstory
+
+   * win32/: encode_keychange/encode_keychange.dsp,
+   libsnmp/libsnmp.dsp, libsnmp_dll/libsnmp_dll.dsp,
+   snmpbulkget/snmpbulkget.dsp, snmpbulkwalk/snmpbulkwalk.dsp
+, snmpd/snmpd.dsp, snmpdelta/snmpdelta.dsp,
+   snmpdf/snmpdf.dsp, snmpget/snmpget.dsp,
+   snmpgetnext/snmpgetnext.dsp, snmpnetstat/snmpnetstat.dsp
+, snmpset/snmpset.dsp, snmpstatus/snmpstatus.dsp,
+   snmptable/snmptable.dsp, snmptest/snmptest.dsp,
+   snmptranslate/snmptranslate.dsp, snmptrap/snmptrap.dsp,
+   snmptrapd/snmptrapd.dsp, snmpusm/snmpusm.dsp,
+   snmpvacm/snmpvacm.dsp, snmpwalk/snmpwalk.dsp:
+
+   get all our ducks in a row: add advapi32.lib to link lines, make sure all
+   Release and Debug libs/apps are compile with same C++ settings
+   
+2002-09-18 00:12  rstory
+
+   * win32/netsnmpmibs/netsnmpmibs.dsp:
+
+   remove sdk dependent modules
+   
+2002-09-18 00:10  rstory
+
+   * win32/mib_module_inits.h:
+
+   group modules that depend on win32 sdk together, with ifdef
+   
+2002-09-18 00:08  rstory
+
+   * agent/snmp_vars.c:
+
+   no callback for win32 until pipe fd problem is fixed
+   
+2002-09-18 00:07  rstory
+
+   * win32/: netsnmpmibssdk/netsnmpmibssdk.dsp,
+   snmpdsdk/snmpd.dsp:
+
+   new versions for sdk users
+   
+2002-09-18 00:05  rstory
+
+   * win32/win32sdk.dsw:
+
+   new workspace for sdk users
+   
+2002-09-16 16:27  hardaker
+
+   * perl/SNMP/SNMP.pm:
+
+   mib module loading fixes by calling init_snmp first
+   
+2002-09-13 15:05  rstory
+
+   * dist/RELEASE-INSTRUCTIONS:
+
+   tweak example nsb-config command; add -b back to cvs2cl, otherwise you
+   get changelog msgs from other branches and have to weed them out
+   
+2002-09-13 12:33  hardaker
+
+   * perl/OID/: OID.pm, OID.xs, test.pl:
+
+   fix illegal oids to not return a pointer.
+   
+2002-09-13 10:40  jbpn
+
+   * snmplib/snmpUDPDomain.c:
+
+     - minor optimisation; we don't need a zero-terminated community
+       string except for debugging output.
+   
+2002-09-13 10:35  hardaker
+
+   * local/mib2c:
+
+   added -i option to request indent not be run
+   
+2002-09-13 10:06  jbpn
+
+   * COPYING:
+
+     - add missing verb in introduction
+   
+2002-09-12 15:58  hardaker
+
+   * perl/SNMP/SNMP.xs:
+
+   protect calling some SvIV dereference functions if it's not an IV.
+     - eliminates the remaining perl warnings.
+   
+2002-09-12 14:45  hardaker
+
+   * net-snmp-config.in:
+
+   include ldflags where appropriate (--libs, --agent-libs, ...)
+   
+2002-09-12 01:48  rstory
+
+   * dist/: nsb-nightly, nsb-package:
+
+   add/use new option to remove build dir after successful build
+   
+2002-09-12 01:47  rstory
+
+   * dist/nsb-functions:
+
+   print build dir
+   
+2002-09-12 01:19  hardaker
+
+   * testing/tests/: Sv3config, T030snmpv3usercreation:
+
+   much more complex tests of USM user creation/modification.
+   
+2002-09-12 01:07  hardaker
+
+   * testing/: eval_tools.sh, tests/T001snmpv1get,
+   tests/T002snmpv1getnext, tests/T003snmpv1getfail,
+   tests/T004snmpv1nosuch:
+
+   - support for multiple tests at once.
+   - merge v1 tests into a single (faster) test.
+   
+2002-09-12 00:34  rstory
+
+   * dist/nsb-functions:
+
+   don't monkey around with returning error codes, just exit; more regexp tweaks
+   
+2002-09-11 19:36  hardaker
+
+   * testing/eval_tools.sh:
+
+   - use sub-second sleeps if available
+   - sleep 1 (sub-)second at a time when waiting for particular tests
+     rather than the full SNMP_SLEEP duration.
+   
+2002-09-11 19:24  hardaker
+
+   * apps/snmptrapd.c:
+
+   use snmp_log instead of printf for shutdown message.
+   
+2002-09-11 18:42  hardaker
+
+   * local/mib2c.iterate.conf:
+
+   missing variable decl pointed out by irc:df
+   
+2002-09-10 16:16  rstory
+
+   * dist/nsb-functions:
+
+   tweak error regexps & error messages
+   
+2002-09-10 15:28  rstory
+
+   * local/mib2c.array-user.conf:
+
+   compiler warnings are your friend!; fix embeded comments; fix non-void
+   functions w/no rtn values; code reorg to fix emacs indent complaints
+   
+2002-09-10 15:26  rstory
+
+   * Makefile.in:
+
+   new start-flag end-flag targets to help nightly build script determine
+   if a make completed successfully
+   
+2002-09-10 15:12  rstory
+
+   * dist/nsb-functions:
+
+   tweaks for new script for automated nightly builds; ad nsb-abort, nsb-flow;
+   direct some messages to stderr; use new start-flag end-flag make targets;
+   update error grep to include '***'; check for new value to rm -fR build dir
+   
+2002-09-10 15:08  rstory
+
+   * dist/nsb-nightly:
+
+   new script for automated nightly builds
+   
+2002-09-10 15:08  rstory
+
+   * dist/nsb-package:
+
+   add option to rm -fR build dir at start; check scrip path for nsb-functions;
+   prefix default build dir w/version; exit w/rc from nsb-build
+   
+2002-09-10 15:05  rstory
+
+   * dist/: nsb-config, nsb-platform:
+
+   add current path to script to nsb-function search path
+   
+2002-09-09 09:28  jbpn
+
+   * snmplib/snmp_api.c:
+
+     - fix bug pointed out by Jared Smith-Mickelson (bug #605147)
+       whereby passing an unknown type character to snmp_add_var would
+       cause a segfault.
+   
+2002-09-09 09:09  hardaker
+
+   * apps/snmptranslate.c:
+
+   double check a pointer value before using it.
+   
+2002-09-09 09:09  hardaker
+
+   * configure, configure.in,
+   agent/mibgroup/ucd-snmp/memory_netbsd1.c,
+   agent/mibgroup/ucd-snmp/vmstat_netbsd1.c,
+   include/net-snmp/net-snmp-config.h.in:
+
+   Current header update patch for netbsd from Patrick Welche.
+   
+2002-09-06 18:30  driehuis
+
+   * mibs/UCD-SNMP-MIB.txt:
+
+   Mark the non-raw variants of objects that are accessable as raw counters
+   as deprecated, to (hopefully!) cut down on the number of users that get
+   bitten by it..
+   
+2002-09-04 14:36  hardaker
+
+   * README.solaris:
+
+   added Bruce's email address
+   
+2002-09-04 14:27  hardaker
+
+   * Makefile.in, Makefile.rules:
+
+   fix perlclean
+   
+2002-09-04 14:10  hardaker
+
+   * agent/snmpd.c:
+
+   Fix process grouping by calling setsid() (reported by irc:TrogL)
+   
+2002-09-04 14:09  hardaker
+
+   * configure, configure.in,
+   include/net-snmp/net-snmp-config.h.in:
+
+   check for setsid().
+   
+2002-09-03 13:51  hardaker
+
+   * local/mib2c:
+
+   fix cases where there either are no tables or no scalars.
+   
+2002-09-03 13:23  hardaker
+
+   * perl/SNMP/SNMP.xs:
+
+   don't use NULL variables.
+   
+2002-09-02 22:33  rstory
+
+   * FAQ, README, sedscript.in, perl/SNMP/SNMP.pm
+, snmplib/snmp_version.c:
+
+   - (snmplib/snmp_version.c sedscript.in): version tag ( 5.0.4.pre2 )
+   
+2002-09-02 22:33  rstory
+
+   * ChangeLog:
+
+   update for release 5.0.4.pre2
+   
+2002-09-02 22:22  rstory
+
+   * man/netsnmp_handler.3:
+
+   updated docs
+   
+2002-09-02 22:19  rstory
+
+   * agent/Makefile.depend, agent/helpers/Makefile.depend,
+   agent/mibgroup/Makefile.depend, apps/Makefile.depend,
+   apps/snmpnetstat/Makefile.depend, snmplib/Makefile.depend
+:
+
+   make depend
+   
+2002-09-02 22:16  rstory
+
+   * dist/nsb-config:
+
+   try and guess at src dir if not specified
+   
+2002-09-02 22:15  rstory
+
+   * dist/README.build-scripts:
+
+   add note about err when building in and out of source tree
+   
+2002-09-02 21:55  rstory
+
+   * Makefile.in:
+
+   full path to versiontag, in case we are buildint outside of src directory
+   
+2002-09-02 21:37  rstory
+
+   * dist/nsb-functions:
+
+   remove forced prompt on errors
+   
+2002-09-02 21:36  rstory
+
+   * Makefile.in:
+
+   add warnings when VERSION is required; add tarclean target; add tarclean to
+   distclean target
+   
+2002-09-02 21:34  rstory
+
+   * agent/mibgroup/versiontag:
+
+   add msg on error; add clean target
+   
+2002-09-02 20:27  rstory
+
+   * NEWS:
+
+   update win32 & AgentX status
+   
+2002-09-02 20:20  rstory
+
+   * agent/snmp_agent.c, agent/mibgroup/agentx/master_admin.c
+, include/net-snmp/agent/snmp_agent.h:
+
+   fix to avoid locking up the agent when a sugagent dies during a set request. We
+   must clean up the delegated requests when the session(s) are closed, so that
+   they will be processed and removed, allowing further requests to be processed.
+   
+2002-09-01 13:43  rstory
+
+   * snmplib/container_binary_array.c:
+
+   change result type back to int, as it may receive a negative value
+   
+   PLEASE check the use of a variable before changing is signedness, especially
+   areound release time!
+   
+2002-08-30 15:18  rstory
+
+   * include/net-snmp/utilities.h:
+
+   include check_varbind.h
+   
+2002-08-30 15:18  rstory
+
+   * agent/helpers/table_array.c:
+
+   change NOSUCHNAME to NOSUCHINSTANCE again, as it seems the agentX fix also
+   correctly deals with this error code
+   
+2002-08-30 09:14  hardaker
+
+   * FAQ, README:
+
+   - delete sunsite.cnlab-switch.ch mirror, as it isn't one anymore.
+   
+2002-08-29 13:32  rstory
+
+   * dist/nsb-functions:
+
+   check for modules before configuring them
+   
+2002-08-29 10:52  hardaker
+
+   * snmplib/scapi.c:
+
+   Fix the last AES bug I know of.  AES128 works great.
+     I still Need to fix 192/256 for longer key generation from MD5/SHA
+   
+2002-08-29 10:52  hardaker
+
+   * perl/agent/agent.pm:
+
+   use the right perl module name in the use line.
+   
+2002-08-29 06:47  dts12
+
+   * agent/agent_handler.c, agent/mibgroup/agentx/master.c
+, include/net-snmp/agent/agent_registry.h,
+   win32/config.h:
+
+   More Win32-related tidying up.
+   The agent now compiles with relatively few warnings.
+   
+2002-08-29 04:50  dts12
+
+   * agent/agent_trap.c, agent/mibgroup/agentx/client.c,
+   agent/mibgroup/mibII/vacm_vars.c,
+   agent/mibgroup/snmpv3/usmUser.c,
+   agent/mibgroup/utilities/override.h,
+   include/net-snmp/agent/snmp_agent.h,
+   include/net-snmp/agent/table_dataset.h,
+   include/net-snmp/library/mt_support.h,
+   snmplib/container_binary_array.c, snmplib/snmpusm.c,
+   win32/config.h, win32/libsnmp_dll/libsnmp.def:
+
+   Declare new routine 'netsnmp_oid_equals', and assorted Win32 cleanup fixes.
+   
+2002-08-28 14:15  rstory
+
+   * dist/RELEASE-INSTRUCTIONS:
+
+   clarify cvs2cl script name; remove -b flag from cvs2cl per Dave; a little
+   reorganization; put commands on separate lines prefixed with $; note 5.x/4.x
+   differences per Dave's email; plug my new scripts where appropriate
+   
+2002-08-27 14:48  rstory
+
+   * dist/RELEASE-INSTRUCTIONS:
+
+   add URL for cvs2cl; update cvs2cl cmds to cvs2cl.pl, since that's the file
+   that's actually distributed
+   
+2002-08-27 00:59  rstory
+
+   * Makefile.top:
+
+   update for release 5.0.4.pre1
+   
+2002-08-27 00:25  rstory
+
+   * snmplib/snmp_version.c, FAQ, README,
+   sedscript.in, perl/SNMP/SNMP.pm:
+
+   - (snmplib/snmp_version.c sedscript.in): version tag ( 5.0.4.pre1 )
+   
+2002-08-27 00:24  rstory
+
+   * ChangeLog:
+
+   update for release 5.0.4.pre1
+   
+2002-08-27 00:19  rstory
+
+   * agent/Makefile.depend (5.6), agent/helpers/Makefile.depend (5.5),
+   agent/mibgroup/Makefile.depend (5.6), apps/Makefile.depend (5.5),
+   apps/snmpnetstat/Makefile.depend (5.5), snmplib/Makefile.depend
+   (5.5):
+
+   make depend
+   
+2002-08-27 00:17  rstory
+
+   * man/: netsnmp_agent.3 (5.3), netsnmp_bulk_to_next.3 (5.3),
+   netsnmp_debug.3 (5.3), netsnmp_handler.3 (5.3), netsnmp_instance.3
+   (5.3), netsnmp_multiplexer.3 (5.3), netsnmp_old_api.3 (5.3),
+   netsnmp_read_only.3 (5.3), netsnmp_scalar.3 (5.2),
+   netsnmp_serialize.3 (5.3), netsnmp_table.3 (5.3),
+   netsnmp_table_array.3 (5.3), netsnmp_table_data.3 (5.3),
+   netsnmp_table_dataset.3 (5.3), netsnmp_table_iterator.3 (5.3),
+   netsnmp_todo.3 (5.3), netsnmp_watcher.3 (5.2):
+
+   update man pages for 5.0.4.pre1
+   
+2002-08-27 00:10  rstory
+
+   * dist/nsb-config (1.1):
+
+   new file to configure using same options as nsb-package for test or dist
+   
+2002-08-27 00:09  rstory
+
+   * dist/nsb-package (1.3):
+
+   don't append sys-name when building in src tree
+   
+2002-08-27 00:09  rstory
+
+   * dist/nsb-functions (1.19):
+
+   fix typo
+   
+2002-08-27 00:06  rstory
+
+   * dist/nsb-functions (1.18):
+
+   rename nsb-get-confg -> nsb-config-dist; use double quotes cuz of some
+   wierd shell thing I don't yet understand; check for src dir in config*
+   
+2002-08-26 23:34  rstory
+
+   * Makefile.in (5.12):
+
+   tweak commentcheck target to work outside the source tree
+   
+2002-08-26 23:33  rstory
+
+   * agent/mibgroup/mibII/interfaces.c (5.3),
+   agent/mibgroup/ucd-snmp/proxy.c (5.1),
+   include/net-snmp/library/asn1.h (5.2),
+   include/net-snmp/library/oid_stash.h (5.1), snmplib/winservice.c
+   (5.1):
+
+   remove C++ style comments (and anything that even remotely resembles one)
+   
+2002-08-26 17:47  rstory
+
+   * dist/nsb-functions (1.17):
+
+   pass make params to make, so we don't try to install in /usr/local/bin of
+   the compile servers... :-/
+   
+2002-08-26 17:39  rstory
+
+   * dist/nsb-functions (1.16):
+
+   make dist & extra transports; no ipv6 on Darwin; make touchit before make
+   
+2002-08-26 17:04  rstory
+
+   * agent/mibgroup/Rmon/event.c (5.4):
+
+   replace u_int32_t, which doesn't compile on Sun 5.8, with u_int
+   
+2002-08-26 16:53  rstory
+
+   * agent/mibgroup/Rmon/rows.c (5.2):
+
+   fix undeclared variable error spotted on Sun, which linux missed completely.
+   I have no idea how this compiled before!!
+   
+2002-08-26 16:43  rstory
+
+   * dist/nsb-functions (1.15):
+
+   cleaner way to add system specific modules; disable perl, as it breaks
+   builds outside of the source tree
+   
+2002-08-26 15:45  rstory
+
+   * dist/nsb-functions (1.14):
+
+   only configure IPX on Linux
+   
+2002-08-26 15:44  rstory
+
+   * dist/nsb-functions (1.13):
+
+   only configure IPX on Linux; bail on configure errors
+   
+2002-08-26 15:04  rstory
+
+   * dist/README.build-scripts (1.4):
+
+   add suggestion to symlink nsb-* in local bin dir
+   
+2002-08-26 15:03  rstory
+
+   * dist/: nsb-package (1.2), nsb-functions (1.12):
+
+   add option for pre-release test configure options
+   
+2002-08-26 15:02  rstory
+
+   * README.snmpv3 (5.3):
+
+   make section headers stand out more; move note about encryption not being
+   enabled to a more prominent place.
+   
+2002-08-24 21:24  driehuis
+
+   * configure.in, agent/mibgroup/ucd-snmp/diskio.c
+   (V4-2-patches.[37,3]):
+
+   Merge from HEAD: detect the requirement for linking with -ldevstat.
+   Ugly hack to make sure diskio device names include the device number.
+   
+2002-08-23 11:46  dts12
+
+   * snmplib/Makefile.in (V4-2-patches.3):
+
+   make depend
+   
+2002-08-22 08:31  jbpn
+
+   * include/net-snmp/system/solaris2.7.h (5.2):
+
+     - DONT_USE_NLIST reinstated, so NO_KMEM_USAGE redundant
+   
+2002-08-22 08:29  jbpn
+
+   * acconfig.h (5.9), include/net-snmp/net-snmp-config.h.in (5.10):
+
+     - reinstate test for DONT_USE_NLIST
+   
+2002-08-22 07:11  jbpn
+
+   * agent/snmpd.c (5.10):
+
+     - stop and restart logging when HUPped.  This allows logfiles to be
+       rotated and so forth.
+   
+2002-08-22 07:06  jbpn
+
+   * agent/snmpd.c (V4-2-patches.24):
+
+     - stop and restart logging when HUPped.  This allows logfiles to be
+       rotated and so forth.
+   
+2002-08-22 04:31  dts12
+
+   * README.snmpv3 (5.2):
+
+   Add the missing '-x/X' options to the example authPriv command line
+     (reported by Prasada R Vankayalapati)
+   
+2002-08-20 11:04  hardaker
+
+   * agent/mibgroup/agentx/subagent.c (5.6), apps/snmptrapd.c (5.4),
+   include/net-snmp/agent/ds_agent.h (5.3), FAQ (5.17):
+
+   quiet snmptrapd when it can't connect to the agentx master.
+   
+2002-08-20 08:54  jbpn
+
+   * include/net-snmp/system/solaris2.7.h (5.1):
+
+     - add #define NO_KMEM_USAGE 1 since net-snmp-config.h.in no longer
+       pays attention to the DONT_USE_NLIST token.  Omission of this
+       causes the agent to exit with the message "init_kmem: kvm_open
+       failed: error 0".
+   
+       NOTE: this may need applying to other members of the Solaris 2
+       family, but I don't have machines to hand to test this.
+   
+2002-08-20 08:48  jbpn
+
+   * agent/mibgroup/kernel_sunos5.c (5.2):
+
+     - detect gigabit ethernet devices (geN)
+     - undo indent mayhem
+   
+2002-08-20 05:57  jbpn
+
+   * include/net-snmp/utilities.h (5.1):
+
+     - for now, don't #include snmp_locking.h since it breaks re-entrant
+       support (because mutex_type gets multiply-defined).  Furthermore, the
+       functions it declares are never used anywhere, nor defined anywhere.
+   
+2002-08-20 05:56  jbpn
+
+   * include/net-snmp/library/mt_support.h (5.1):
+
+     - don't define "do nothing" macros for snmp_res_lock et al. functions
+       on Win32 platform (since real "do nothing" functions are required for
+       reasons best known to someone else).
+     - unmangling
+   
+2002-08-20 05:54  jbpn
+
+   * include/net-snmp/library/snmp_locking.h (5.1):
+
+     - fix highly bogus non-C syntax
+   
+2002-08-20 05:53  jbpn
+
+   * snmplib/mt_support.c (5.1):
+
+     - snmp_res_lock et al. functions no longer #defined to "do nothing"
+       targets for Win32 in mt_support.h, therefore no need to #undef them
+       here.
+     - unmangling
+   
+2002-08-20 01:13  hardaker
+
+   * include/net-snmp/agent/agent_registry.h (5.2):
+
+   headers for cache enabling functions.
+   
+2002-08-20 01:12  hardaker
+
+   * agent/mibgroup/disman/mteTriggerTable.c (5.3):
+
+   don't use non-existent memory pointers to the response data (eg: "timeout")
+   
+2002-08-19 17:46  nba
+
+   * include/net-snmp/net-snmp-includes.h (5.1):
+
+   Change a few conditionals to use #if in place of #ifdef
+   
+2002-08-19 17:28  nba
+
+   * snmplib/: mib.c (5.17), parse.c (5.4):
+
+   Align with 4.2 branch
+   
+2002-08-19 17:26  nba
+
+   * mibs/: DISMAN-SCHEDULE-MIB.txt (5.1),
+   IANA-ADDRESS-FAMILY-NUMBERS-MIB.txt (5.1), IANAifType-MIB.txt
+   (5.1), INET-ADDRESS-MIB.txt (5.1), Makefile.mib (5.2), ianalist
+   (5.1), mibfetch (5.1), rfclist (5.1):
+
+   Update to current MIBs
+   
+2002-08-19 17:25  nba
+
+   * agent/mibgroup/mibII/vacm_vars.c (5.7):
+
+   Bail out for bad snmpAdminString value
+   
+2002-08-19 10:43  jbpn
+
+   * FAQ (V4-2-patches.53), FAQ (5.16):
+
+     - don't use positional community parameter in examples
+     - break a couple of over-long lines
+     - mention netsnmp_ variant of ds_set_ function
+   
+2002-08-19 05:44  dts12
+
+   * FAQ (V4-2-patches.52), FAQ (5.15):
+
+   Add an entry about the snmptrapd/AgentX warning message.
+   
+2002-08-18 21:24  rstory
+
+   * dist/nsb-functions (1.11):
+
+   don't configure with build install dir, it is already specified on cmd line
+   for make install
+   
+2002-08-18 13:59  rstory
+
+   * agent/helpers/table.c (5.7):
+
+   more debugging - log value request is trying to set
+   
+2002-08-16 18:13  hardaker
+
+   * README (5.9):
+
+   added Bruce Shaw to the thanks list
+   
+2002-08-16 18:12  hardaker
+
+   * README.solaris (1.2):
+
+   A great update talking about perl and solaris from Bruce Shaw
+   
+2002-08-16 04:51  dts12
+
+   * agent/helpers/table_iterator.c (5.4):
+
+   Catch explicitly 'noSuchInstance' exceptions, when walking an
+   iterator-handled module, so that holes can be skipped and the
+   next real instance retrieved.  (This was already handled for
+   modules that didn't mark missing instances explicitly).
+   
+2002-08-16 03:17  hardaker
+
+   * agent/snmp_agent.c (5.13):
+
+   turn off caching by default, since the agentx code appears broken.
+   
+2002-08-16 03:03  hardaker
+
+   * agent/: agent_registry.c (5.5), snmp_agent.c (5.12):
+
+   speed enhancements via implementing a registration subtree lookup
+   cache.  greatly speeds things up when similar requests come in
+   (snmpwalk, ...).
+   
+2002-08-15 13:35  hardaker
+
+   * snmplib/parse.c (5.3):
+
+   protect against NULL labels in subtrees
+   
+2002-08-15 11:14  hardaker
+
+   * agent/agent_index.c (5.3), agent/agent_registry.c (5.4),
+   agent/agent_trap.c (5.1), agent/helpers/old_api.c (5.2),
+   agent/mibgroup/header_complex.c (5.1), agent/mibgroup/testhandler.c
+   (5.1), snmplib/snmp_transport.c (5.2), snmplib/snmpusm.c (5.3):
+
+   use netsnmp_oid_equals (which is sometimes faster than
+   snmp_oid_compare) in a few places to achieve barely noticeable speed gains.
+   
+2002-08-15 11:12  hardaker
+
+   * snmplib/parse.c (5.2):
+
+   double check a pointer exists before passing it to strcmp()
+   
+2002-08-15 11:05  hardaker
+
+   * perl/SNMP/Makefile.PL (5.7):
+
+   change MAN3PODS to something compliant with the perl manuals.  I think.
+   
+2002-08-14 13:42  rstory
+
+   * apps/snmpset.c (5.2):
+
+   add debug for local parsing of args
+   
+2002-08-14 12:26  rstory
+
+   * agent/mibgroup/agentx/: master.c (5.5), master_admin.c (5.4),
+   subagent.c (5.5):
+
+   add more detailed in debug messages; add a few new debugs
+   
+2002-08-14 12:23  rstory
+
+   * agent/snmp_agent.c (5.11):
+
+   when all delegated requests have finished, check all requests status so that
+   asp status is set, which is necessary for correct agentx set processing.
+   (now if I can just get all this hair off the floor, and glue it back to my
+   head, and then fix that dent in the wall where I've been banging my head....)
+   
+2002-08-13 17:25  hardaker
+
+   * snmplib/snmp_api.c (5.14):
+
+   fix a length comparison problem with netsnmp_oid_is_subtree()
+   
+2002-08-13 17:24  hardaker
+
+   * NEWS (5.6):
+
+   document a few recent changes.
+   
+2002-08-13 17:05  hardaker
+
+   * agent/mibgroup/host/hr_print.c (5.1):
+
+   Fix open file runaway on solaris.  See bug #592806 reported by James Irwin.
+   
+2002-08-13 15:05  rstory
+
+   * include/net-snmp/types.h (5.7):
+
+   array of pointers = pointer to a pointer
+   
+2002-08-09 19:32  hardaker
+
+   * local/FAQ2HTML (5.1):
+
+   misc doc fixes.
+   
+2002-08-09 19:31  hardaker
+
+   * snmplib/snmp_parse_args.c (5.4),
+   include/net-snmp/library/transform_oids.h (5.2), snmplib/snmpusm.c
+   (5.2), snmplib/snmpv3.c (5.3):
+
+   initial AES support.
+   
+2002-08-09 19:31  hardaker
+
+   * include/net-snmp/library/snmp_api.h (5.2), snmplib/snmp_api.c
+   (5.13):
+
+   slight speed ups for snmp_oid_compare() to do single int compares till !=
+   
+2002-08-09 19:29  hardaker
+
+   * snmplib/scapi.c (5.2):
+
+   - openssl 0.9.7 support for DES changes.
+   - initial AES support.
+   
+2002-08-09 19:28  hardaker
+
+   * snmplib/keytools.c (5.2):
+
+   indent fixes.
+   
+2002-08-09 19:27  hardaker
+
+   * include/net-snmp/library/: scapi.h (5.1), snmpusm.h (5.1):
+
+   define AES key specifics
+   
+2002-08-09 19:26  hardaker
+
+   * acconfig.h (5.8), configure (5.17), configure.in (5.15),
+   include/net-snmp/net-snmp-config.h.in (5.9):
+
+   - check for openssl .0.9.7 DES structures and functions.
+   - check for AES support in openssl (> 0.9.7)
+   
+2002-08-09 19:10  hardaker
+
+   * agent/mibgroup/agentx/subagent.c (5.4):
+
+   fix mode processing for RESERVE1/RESERVE2 test failures
+   
+2002-08-09 18:29  rstory
+
+   * agent/snmp_agent.c (5.10):
+
+   log msg when we ignore/fix illegal error_values for the client APIs
+   
+2002-08-09 18:28  rstory
+
+   * local/mib2c.array-user.conf (5.12):
+
+   corrections to example code
+   
+2002-08-09 18:27  rstory
+
+   * agent/helpers/table.c (5.6):
+
+   revert errors to uninformative SNMPv1 noSuchName for AgentX get-next/inclusive
+   processing; also add more comments here and there
+   
+2002-08-09 17:08  rstory
+
+   * agent/mibgroup/agentx/master.c (5.4):
+
+   debug msg for agentx oid for cases other than get/getnext
+   
+2002-08-09 11:45  rstory
+
+   * agent/mibgroup/agentx/master_admin.c (5.3):
+
+   don't free registration info on failure, as netsnmp_register_mib already did it
+   
+2002-08-09 09:57  jbpn
+
+   * snmplib/: snmpAAL5PVCDomain.c (5.2), snmpCallbackDomain.c (5.1),
+   snmpIPXDomain.c (5.1), snmpTCPDomain.c (5.4), snmpTCPIPv6Domain.c
+   (5.5), snmpUDPDomain.c (5.6), snmpUDPIPv6Domain.c (5.7),
+   snmpUnixDomain.c (5.4), snmp_transport.c (5.1):
+
+     - rename snmp_<domain>_blah functions to netsnmp_<domain>_blah
+     - make transport member functions static, to emphasise that they should
+       not be used directly
+     - handle EINTR in send and recv functions (as pointed out by Antti Kuntsi
+       in bug report #576806)
+     - formatting fixes
+   
+2002-08-09 09:54  jbpn
+
+   * include/net-snmp/library/: snmpAAL5PVCDomain.h (5.3),
+   snmpIPXDomain.h (5.2), snmpTCPDomain.h (5.2), snmpTCPIPv6Domain.h
+   (5.3), snmpUDPDomain.h (5.2):
+
+     - minor formatting fixes
+   
+2002-08-09 09:54  jbpn
+
+   * include/net-snmp/library/snmpUnixDomain.h (5.3):
+
+     - don't export netsnmp_unix_blah() functions
+   
+2002-08-09 09:53  jbpn
+
+   * include/net-snmp/library/snmp_transport.h (5.1):
+
+     - fix nasty formatting
+   
+2002-08-08 12:14  rstory
+
+   * snmplib/snmpv3.c (5.2):
+
+   reword config_perror msgs to remove "Error", as it is redundant
+   
+2002-08-08 12:11  rstory
+
+   * snmplib/keytools.c (5.1):
+
+   remove ifdef to log msg to user, after making msg more informative; remove
+   annoying blank lines
+   
+2002-08-08 11:33  hardaker
+
+   * acconfig.h (5.7), configure (5.16), configure.in (5.14):
+
+   Patch from Harrie to completely disable kmem usage
+   
+2002-08-06 03:30  jbpn
+
+   * agent/mibgroup/agentx/subagent.c (5.3):
+
+     - set main_session to NULL in subagent_shutdown().  This (along with the
+       deregistration of all alarms) allows AgentX functionality to be
+       stopped and restarted in subagents.
+     - Thanks to Vishal Verma for original patch
+   
+2002-08-06 03:27  jbpn
+
+   * include/net-snmp/library/snmp_alarm.h (5.1):
+
+     - add snmp_alarm_unregister_all() function
+   
+2002-08-06 03:26  jbpn
+
+   * snmplib/: snmp_alarm.c (5.3), snmp_api.c (5.12):
+
+     - add snmp_alarm_unregister_all() function
+     - call it from snmp_shutdown()
+     - thanks to Vishal Verma for original patch
+   
+2002-08-06 03:17  jbpn
+
+   * snmplib/snmp_alarm.c (V4-2-patches.4):
+
+     - add debugging output when all alarms unregistered
+   
+2002-08-06 03:10  jbpn
+
+   * agent/mibgroup/agentx/subagent.c (V4-2-patches.4):
+
+     - set main_session to NULL in subagent_shutdown().  This (along with the
+       deregistration of all alarms) allows AgentX functionality to be
+       stopped and restarted in subagents.
+     - Thanks to Vishal Verma for this patch (#558517)
+   
+2002-08-06 03:08  jbpn
+
+   * snmplib/: snmp_alarm.c, snmp_alarm.h, snmp_api.c
+   (V4-2-patches.[3,1,36]):
+
+     - add snmp_alarm_unregister_all() function
+     - call it from snmp_shutdown()
+     - thanks to Vishal Verma for providing this patch
+   
+2002-08-05 10:06  rstory
+
+   * local/mib2c.iterate.conf (5.3):
+
+   match function definition w/Netsnmp_*_DataPoint typedefs; add cvs Id
+   
+2002-08-03 11:52  rstory
+
+   * dist/RELEASE-INSTRUCTIONS (1.5):
+
+   break up lines long than 80 chars; abcde, not abcdd
+   
+2002-08-03 03:21  hardaker
+
+   * dist/RELEASE-INSTRUCTIONS (1.4):
+
+   more updates about things Wes does at 12:30 am
+   
+2002-08-03 02:44  hardaker
+
+   * FAQ (5.14), README (5.8), sedscript.in (5.6), perl/SNMP/SNMP.pm
+   (5.12), snmplib/snmp_version.c (5.5):
+
+   - (snmplib/snmp_version.c sedscript.in): version tag ( 5.0.3 )
+
+-------------------------------------------------------------------------------
+
+Changes: V5.0.2 -> V5.0.3
+
+2002-08-02 23:41  hardaker
+
+   * agent/mibgroup/agent/.cvsignore:
+
+   add .libs
+   
+2002-08-02 23:40  hardaker
+
+   * agent/mibgroup/Rmon/.cvsignore:
+
+   ignore file
+   
+2002-08-02 23:39  hardaker
+
+   * agent/Makefile.depend, agent/helpers/Makefile.depend,
+   agent/mibgroup/Makefile.depend, apps/Makefile.depend,
+   apps/snmpnetstat/Makefile.depend, snmplib/Makefile.depend
+:
+
+   make depend
+   
+2002-08-02 23:37  hardaker
+
+   * include/net-snmp/net-snmp-config.h.in:
+
+   forgotten to check in test for perl_ev changes
+   
+2002-08-02 23:35  hardaker
+
+   * perl/SNMP/SNMP.pm:
+
+   remove debugging print (opps)
+   
+2002-08-02 23:35  hardaker
+
+   * perl/SNMP/: SNMP.pm, SNMP.xs:
+
+   fix default version usage.
+   
+2002-08-02 23:34  hardaker
+
+   * snmplib/snmpUDPIPv6Domain.c:
+
+   Patch #572394 from Katsuhisa ABE:
+     - support link local addresses
+     - bind to ipv6 only if IPV6_V6ONLY is defined.
+   
+2002-08-02 23:31  hardaker
+
+   * snmplib/snmp_parse_args.c:
+
+   fix configure specified default versioning
+   
+2002-08-02 22:58  hardaker
+
+   * configure, configure.in:
+
+   Patch #572394: add ipv6 transports when --enable-ipv6 defined.  Thanks to Katsuhisa ABE.
+   
+2002-08-02 14:59  hardaker
+
+   * NEWS:
+
+   update for 5.0.3
+   
+2002-08-02 14:55  hardaker
+
+   * man/snmp_agent_api.3.def:
+
+   update
+   
+2002-08-02 14:39  hardaker
+
+   * dist/RELEASE-INSTRUCTIONS:
+
+   more docs.
+   
+2002-08-02 14:29  hardaker
+
+   * man/: netsnmp_agent.3, netsnmp_bulk_to_next.3,
+   netsnmp_debug.3, netsnmp_handler.3, netsnmp_instance.3
+, netsnmp_multiplexer.3, netsnmp_old_api.3,
+   netsnmp_read_only.3, netsnmp_scalar.3,
+   netsnmp_serialize.3, netsnmp_table.3,
+   netsnmp_table_array.3, netsnmp_table_data.3,
+   netsnmp_table_dataset.3, netsnmp_table_iterator.3,
+   netsnmp_todo.3, netsnmp_watcher.3, Makefile.in:
+
+   doxygen update.
+   
+2002-08-02 14:26  hardaker
+
+   * dist/RELEASE-INSTRUCTIONS:
+
+   update for yet more stuff.
+   
+2002-08-02 14:26  hardaker
+
+   * remove-files:
+
+   remove a few more dist related files.
+   
+2002-08-02 14:23  hardaker
+
+   * snmplib/snmp_api.c:
+
+   error message change to remove DES specific error msg.
+   
+2002-08-02 14:23  hardaker
+
+   * perl/agent/typemap:
+
+   spacing fixes.
+   
+2002-08-02 14:22  hardaker
+
+   * perl/agent/: Makefile.PL, agent.xs:
+
+   renamed file.
+   
+2002-08-02 14:22  hardaker
+
+   * perl/agent/: netsnmp_request_info.pm,
+   netsnmp_request_infoPtr.pm:
+
+   renamed file
+   
+2002-08-02 14:20  hardaker
+
+   * perl/AnyData_SNMP/netsh:
+
+   Add a "evalvars" directive to do simply replacements.
+   
+2002-08-02 14:16  hardaker
+
+   * agent/mibgroup/versiontag:
+
+   use CVSUSER variable when doing stuff instead of my hard-coded name.
+   
+2002-08-02 14:14  hardaker
+
+   * Makefile.top:
+
+   update libtool version for 5.0.3
+   
+2002-08-02 14:13  hardaker
+
+   * Makefile.in:
+
+   change checkcomment tag to exclude win32 files.
+   
+2002-08-02 14:13  hardaker
+
+   * ChangeLog:
+
+   update changelog build notes at the bottom of the file.
+   
+2002-08-02 14:01  hardaker
+
+   * dist/RELEASE-INSTRUCTIONS:
+
+   created a how-to file for making releases
+   
+2002-08-02 14:01  hardaker
+
+   * dist/changelogfix:
+
+   changelog fix-up script
+   
+2002-08-02 10:21  rstory
+
+   * dist/nsb-functions:
+
+   translate '/' in system name to '_' (for cygwin)
+   
+2002-08-02 09:56  rstory
+
+   * dist/README.build-scripts:
+
+   fix section cvs get command example
+   
+2002-08-02 09:06  dts12
+
+   * include/net-snmp/system/hpux.h:
+
+   Suppress 'inline' when not using GCC. Suggested by Johannes Schmidt-Fischer
+   
+2002-08-02 08:59  rstory
+
+   * dist/README.build-scripts:
+
+   fix section on skipping make test; add -p flag to examples
+   
+2002-08-02 08:52  rstory
+
+   * dist/README.build-scripts:
+
+   describe use of nsb-package script. Testers and comments appreciated...
+   
+2002-08-02 08:33  rstory
+
+   * dist/nsb-platform:
+
+   output platform info
+   
+2002-08-02 08:18  rstory
+
+   * dist/nsb-build:
+
+   renamed to nsb-package
+   
+2002-08-02 08:18  rstory
+
+   * dist/nsb-package:
+
+   renamed nsb-build to avoid confusion with script function
+   
+2002-08-02 08:15  hardaker
+
+   * dist/nsb-functions:
+
+   Change location name to Unknown
+   
+2002-08-02 08:08  hardaker
+
+   * perl/: ASN/ASN.pm, agent/agent.pm,
+   agent/netsnmp_request_info.pm:
+
+   more old perl fixes
+   
+2002-08-02 08:04  hardaker
+
+   * perl/: OID/OID.pm, agent/default_store/default_store.pm
+:
+
+   more old perl fixes
+   
+2002-08-02 08:00  hardaker
+
+   * perl/default_store/default_store.pm:
+
+   more old perl fixes
+   
+2002-08-02 07:48  rstory
+
+   * dist/nsb-functions:
+
+   fix return code
+   
+2002-08-02 07:48  rstory
+
+   * dist/nsb-build:
+
+   don't pull first arg til after getopts/shift; move set of default opts
+   
+2002-08-02 07:37  rstory
+
+   * dist/nsb-functions:
+
+   add option to skip build or test steps; add -f option to prompt to override
+   no prompt flag (useful for errors); new nsb-make method; check rc of
+   make clean
+   
+2002-08-02 07:36  rstory
+
+   * dist/nsb-build:
+
+   add option to skip build or test steps; tweak usage
+   
+2002-08-02 07:10  rstory
+
+   * dist/nsb-build:
+
+   fix typo; remove extra trailing slash in dir
+   
+2002-08-02 06:33  rstory
+
+   * dist/nsb-build:
+
+   check more places to source nsb-functions; fix for cmd line build path
+   
+2002-08-02 06:28  rstory
+
+   * dist/nsb-functions:
+
+   just show errors after build, not warnings
+   
+2002-08-01 17:04  hardaker
+
+   * perl/OID/OID.xs:
+
+   revert to non-ansi prototypes for older perl with older compilers on
+   older systems.  Not that I'm grumpy, of course.
+   
+2002-08-01 16:25  hardaker
+
+   * configure.in, agent/snmp_perl.c:
+
+   check for older and new embedded perl call functions
+   
+2002-08-01 14:07  rstory
+
+   * dist/nsb-functions:
+
+   don't symlink to src from build; update nsb-get-config
+   
+2002-08-01 14:06  rstory
+
+   * dist/nsb-build:
+
+   fix for cmd line build dir
+   
+2002-08-01 12:58  rstory
+
+   * dist/nsb-functions:
+
+   fix config install path; remove platform specific from nsb-build
+   
+2002-08-01 12:56  rstory
+
+   * dist/nsb-build:
+
+   remove hard coded info
+   
+2002-08-01 12:22  rstory
+
+   * dist/nsb-functions:
+
+   add option to skip prompts; remove previous installs; tweak err pattern
+   
+2002-08-01 12:14  jbpn
+
+   * man/snmp_alarm.3.def:
+
+     - use netsnmp_ds_set_boolean() instead of ds_set_boolean()
+   
+2002-08-01 12:12  jbpn
+
+   * man/snmp_agent_api.3.def:
+
+     - change code sample to use netsnmp_ds_set_boolean()
+     - update references to libraries (which were still talking about
+       libucdagent et al.) -- PLEASE REVIEW BEFORE 5.0.3
+   
+2002-08-01 12:07  rstory
+
+   * dist/nsb-functions:
+
+   lots of fixes to previouse untested scripts
+   
+2002-08-01 12:04  rstory
+
+   * dist/nsb-build:
+
+   script to build releases... still some hardcoding while testing, but its
+   getting there...
+   
+2002-08-01 11:51  rstory
+
+   * dist/: cvsshow, cvsup:
+
+   utility scripts
+   
+2002-08-01 09:30  dts12
+
+   * agent/helpers/: scalar.c, scalar2.c:
+
+   Go with the "scalar as super-handler of instance" implementation.
+   Scalar1.c is probably redundent, but we can remove this later.
+   (Yup - I'm a coward....)
+   
+2002-08-01 01:11  dts12
+
+   * README.win32:
+
+   Minor typos, plus emphasise the need for the IpHlpAPI library.
+   
+2002-07-30 08:26  dts12
+
+   * local/snmpconf.dir/snmp-data/output:
+
+   Recognise '0' as a valid setting for suffixPrinting, and update the
+   prompts to match the v5 output formats defaults. See Bug #567451
+   
+2002-07-30 07:59  dts12
+
+   * apps/snmptable.c:
+
+   First attempt at tackling Bug #574434
+   Recognise that default output format is equivalent to -OS.
+   Snmptable still crashes with -Of or -Ou, but at least the
+   default invocation works.
+   
+2002-07-30 05:41  dts12
+
+   * win32/libsnmp_dll/libsnmp.def:
+
+   Export newly-defined public names, and re-export some routines that
+   have changed name.  This should now compile under Visual C++ again.
+   
+2002-07-30 02:27  dts12
+
+   * agent/helpers/table_dataset.c:
+
+   Don't remove a Row-Status auto-deleted row until the last minute,
+   in case other (lower) handlers try to access it.
+   
+2002-07-30 01:38  dts12
+
+   * FAQ (V4-2-patches.1), FAQ:
+
+   Mention the need to escape quotes when querying string-indexed tables.
+   
+2002-07-29 23:56  rstory
+
+   * include/net-snmp/agent/table_array.h:
+
+   update register function name
+   
+2002-07-29 23:55  rstory
+
+   * local/mib2c.array-user.conf:
+
+   autogen example code for index checking in extract_index; update register
+   function name; use container in *_get_by_idx()
+   
+2002-07-29 16:23  rstory
+
+   * local/mib2c.array-user.conf:
+
+   update for new struct name; add example code as comments instead of var_XXX
+   and such; in a few important places add code which will allow a newly
+   generated module to be compiled if -DTABLE_CONTAINER_TODO is specified;
+   probably a few other tweaks I forgot
+   
+2002-07-29 03:06  dts12
+
+   * agent/helpers/: table_array.c, table.c, table_data.c
+, table_dataset.c, table_iterator.c:
+
+   Protect against deferencing NULL pointers.
+   (Most of these Should Never Happen but You Can't Be Too Careful!)
+   
+2002-07-29 03:03  jbpn
+
+   * agent/mibgroup/kernel_sunos5.c:
+
+     - detect `dmfe' ethernet cards as found on Netra X1 machines.
+       Thanks to John Olson for verifying this fix.
+   
+       Also note that `indent' has ----ed the formatting of this file
+       beyond legibility in several places.  I don't think we want to
+       do *that* again.
+   
+2002-07-29 02:40  dts12
+
+   * agent/helpers/table_dataset.c:
+
+   Fuller validation of RowStatus values wrt row creation/existing rows.
+   
+2002-07-29 01:25  dts12
+
+   * win32/: libsnmp/libsnmp.dsp, libsnmp_dll/libsnmp_dll.dsp
+, netsnmpmibs/netsnmpmibs.dsp:
+
+   Take account of recent changes in library files.
+   'Release' applications still don't link properly, but at least
+   the libraries compile, and the 'Debug' side seems to work.
+   
+2002-07-29 01:23  dts12
+
+   * include/net-snmp/system/aix.h:
+
+   Tweak inline handling for AIX - suggested by Andy Hood.
+   
+2002-07-26 10:52  rstory
+
+   * snmplib/Makefile.in:
+
+   remove autodependencies until portable solution can be found
+   
+2002-07-26 08:41  dts12
+
+   * win32/: mib_module_config.h, mib_module_includes.h,
+   mib_module_inits.h:
+
+   Remove mention of the (obsolete) ucd-snmp/registry module.
+   
+2002-07-26 07:32  dts12
+
+   * win32/net-snmp/net-snmp-config.h:
+
+   Protect the Win32 version of the config file, so that the other header
+   files recognise that it has indeed been included.
+   
+2002-07-26 07:24  dts12
+
+   * FAQ (V4-2-patches.0), FAQ:
+
+   A bit more detail on mib2c, plus the non-writeability of sys{Location,Contact}
+   
+2002-07-26 05:22  dts12
+
+   * FAQ (V4-2-patches.9), FAQ:
+
+   Another entry about invalid use of mib2c.
+   
+2002-07-26 05:16  dts12
+
+   * snmplib/Makefile.in:
+
+   Suppress the "non-standard" conditional construct,
+   since it's not recognised by some versions of 'make'.
+   
+2002-07-25 05:00  dts12
+
+   * agent/helpers/Makefile.in:
+
+   Add the 'scalar' and 'watcher' helpers to the helper library.
+   
+2002-07-25 03:28  dts12
+
+   * agent/helpers/watcher.c, include/net-snmp/agent/watcher.h
+:
+
+   Support for watching a sysUpTime marker.
+   
+2002-07-25 03:24  dts12
+
+   * agent/helpers/table_dataset.c,
+   include/net-snmp/agent/table_dataset.h:
+
+   New routine for retrieving a column value directly from a request structure.
+   
+2002-07-24 13:17  rstory
+
+   * snmplib/default_store.c:
+
+   check for setting same value in ds_set_string, since it frees the old
+   value before duping the new one
+   
+2002-07-24 11:58  rstory
+
+   * dist/snmpd-init.d:
+
+   first stab at init.d startup script for snmpd
+   
+2002-07-24 06:48  dts12
+
+   * agent/helpers/table_dataset.c:
+
+   When running off the end of one column, and moving on to the next
+   (in a GetNext), we need to start again with the first row.
+   This is probably the intention of the conditional block at the start
+   of this loop, but I can't see how this test could ever possibly match.
+   
+   Note that there is also a reference to the row data accessible via
+   the 'request->parent_data' data list.   This will also need to be
+   rewound.  Suggestions as to how best to do so gratefully received.
+   
+2002-07-24 06:39  dts12
+
+   * agent/helpers/table_dataset.c:
+
+   Use SNMPv2-style exceptions rather than the uninformative SNMPv1
+   'noSuchName' error for missing table objects.
+   
+2002-07-24 06:37  dts12
+
+   * agent/helpers/table_data.c:
+
+   Protect against the possibility of failing to extract a row structure.
+   
+2002-07-24 06:35  dts12
+
+   * agent/helpers/table_data.c:
+
+   Use SNMPv2-style exceptions rather than the uninformative SNMPv1
+   'noSuchName' error for missing table objects.
+   
+2002-07-24 06:32  dts12
+
+   * agent/helpers/table.c:
+
+   Use SNMPv2-style exceptions rather than the uninformative SNMPv1
+   'noSuchName' error for invalid table objects.
+   
+2002-07-23 14:59  rstory
+
+   * include/net-snmp/library/snmp_assert.h:
+
+   missing comment terminator.:-(
+   
+2002-07-23 12:02  rstory
+
+   * agent/object_monitor.c, agent/snmp_agent.c,
+   agent/helpers/table.c, agent/helpers/table_array.c,
+   snmplib/container_binary_array.c:
+
+   use new netsnmp_assert instead of assert
+   
+2002-07-23 12:00  rstory
+
+   * include/net-snmp/library/snmp_assert.h, snmplib/Makefile.in
+:
+
+   add new netsnmp_assert, which defaults to logging a message
+   
+2002-07-23 07:43  dts12
+
+   * man/: mib_api.3 (V4-2-patches.3), mib_api.3.def:
+
+   Fix the descriptions of the 'sprint_realloc' calls, to include the 'allow_realloc' parameter.
+   
+2002-07-22 10:58  rstory
+
+   * dist/: net-snmp.spec, nsb-functions:
+
+   new (almost empty) spec file; start creating functions for automated builds
+   
+2002-07-22 01:46  dts12
+
+   * agent/helpers/watcher.c, include/net-snmp/agent/watcher.h
+:
+
+   A more generalised form of the 'ns_register_{type}_instance' routines,
+   implemented as a separate helper module, and useable with both the
+   instance and scalar helpers.
+     This also supports arbitrary ASN types (including strings and OIDs).
+   
+2002-07-22 01:43  dts12
+
+   * agent/helpers/scalar1.c, agent/helpers/scalar2.c,
+   include/net-snmp/agent/scalar.h:
+
+   Agent helper module for support of scalar objects.
+   Very similar to the "instance" helper, except that this deals with
+   invalid instance subidentifiers as well (reporting noSuchInstance
+   rather that noSuchObject).
+   
+   There are two parallel implementations as the moment:
+     - scalar1 is essentially an enhanced copy of the instance helper,
+       but is completely independent of it.
+     - scalar2 sits above the instance helper, and uses that to do most
+       of the real processing.
+   Scalar1 is probably slightly more efficient, while scalar2 feels more
+   in keeping with the general ethos of the handler mechanism.
+   We probably need to decide which to adopt, and junk the other.
+   
+2002-07-19 14:24  rstory
+
+   * agent/mibgroup/agentx/master.c:
+
+   use net agentx retires/timeout ds values
+   
+2002-07-19 14:22  rstory
+
+   * agent/mibgroup/agentx/agentx_config.c:
+
+   register parser for agentxTimeout and agentxRetries tokens
+   
+2002-07-19 14:15  rstory
+
+   * agent/mibgroup/Makefile.depend:
+
+   remove refs to non-existent nstAgent* files
+   
+2002-07-19 14:14  rstory
+
+   * agent/snmpd.c:
+
+   move ONE_SEC to definitions.h; add AGENTX_TIMEOUT and AGENTX_RETRIES defaults
+   
+2002-07-19 14:10  rstory
+
+   * include/net-snmp/agent/ds_agent.h:
+
+   add AGENTX_TIMEOUT and AGENTX_RETRIES
+   
+2002-07-19 14:10  rstory
+
+   * include/net-snmp/definitions.h:
+
+   move definition of ONE_SEC here from snmpd.c
+   
+2002-07-19 11:23  rstory
+
+   * snmplib/container.c:
+
+   pass local obj, not random unitialized pointer.:-(
+   
+2002-07-19 04:04  dts12
+
+   * include/net-snmp/library/tools.h:
+
+   Handle systems where MAXPATHLEN isn't defined.
+   
+2002-07-19 03:31  dts12
+
+   * agent/mibgroup/host/hr_filesys.c:
+
+   Use the "system-independent" SNMP_MAXPATH length definition instead of MAXPATHLEN
+   
+2002-07-18 22:00  rstory
+
+   * agent/Makefile.depend:
+
+   remove refs to nonexistent mibgroup/nstAgentModuleObject.h
+   
+2002-07-18 19:44  hardaker
+
+   * FAQ, README, sedscript.in, perl/SNMP/SNMP.pm
+, snmplib/snmp_version.c:
+
+   - (snmplib/snmp_version.c sedscript.in): version tag ( 5.0.2 )
+   
+-------------------------------------------------------------------------------
+
+Changes: V5.0.1 -> V5.0.2
+
+2002-07-18 19:41  hardaker
+
+   * testing/eval_tools.sh:
+
+   minor patch for non-existent (died) log files.
+
+2002-07-18 19:41  hardaker
+
+   * agent/Makefile.depend, agent/helpers/Makefile.depend,
+   agent/mibgroup/Makefile.depend, apps/Makefile.depend,
+   apps/snmpnetstat/Makefile.depend, snmplib/Makefile.depend:
+
+   make depend
+
+2002-07-18 19:40  hardaker
+
+   * NEWS:
+
+   update for 5.0.2
+
+2002-07-18 19:40  hardaker
+
+   * Makefile.rules:
+
+   make depend fixes.
+	
+2002-07-18 18:57  hardaker
+
+   * agent/mibgroup/Rmon/: alarm.c, event.c:
+
+   make the rmon code compile.
+    - new subtree pointer structure.
+    - sprint_objid -> snprint_objid
+   
+2002-07-18 18:32  hardaker
+
+   * Makefile.in:
+
+   silence perl subdirectory build commands.
+   
+2002-07-18 18:31  hardaker
+
+   * perl/AnyData_SNMP/netsh:
+
+   - Use netsh -t -d xml to get xml output from netsh.
+     (Ok, I'm sitting here at an IETF conference having an argument about
+      xml vs BER and needed a XML(-like) example of a huge data set, so I
+      made netsh do it.)
+   
+2002-07-18 17:54  hardaker
+
+   * perl/AnyData_SNMP/Storage.pm:
+
+   - initial support for doing requests from multiple hosts (retrieval, not sets)
+   
+2002-07-18 17:50  hardaker
+
+   * perl/AnyData_SNMP/netsh:
+
+   more fixes to still ugly colorized text (well, the text is pretty but
+   the support is ugly).
+   
+2002-07-18 17:42  hardaker
+
+   * include/net-snmp/library/container.h:
+
+   change text string error to match function name called.
+   
+2002-07-18 15:31  rstory
+
+   * include/net-snmp/library/container.h, snmplib/container.c
+, snmplib/container_binary_array.c:
+
+   rename free -> cfree to avoid some problem wes had... ;-)
+   
+2002-07-18 14:41  rstory
+
+   * snmplib/mib.c:
+
+   two people fixing memory leak in different places = segfault
+   
+2002-07-18 11:02  rstory
+
+   * local/mib2c.array-user.conf:
+
+   $name -> $i
+   
+2002-07-18 10:56  rstory
+
+   * agent/object_monitor.c,
+   include/net-snmp/agent/object_monitor.h:
+
+   update to use containers
+   
+2002-07-18 09:40  rstory
+
+   * net-snmp-config.in:
+
+   add --debug-tokens, --indent-options
+   
+2002-07-18 09:18  dts12
+
+   * include/net-snmp/agent/auto_nlist.h, snmplib/snmp-tc.c
+, include/net-snmp/system/irix.h:
+
+   Apply patch from Bug #582347, for Irix 6.5 support.
+   Submitted by Jan Yenya Kasprzak
+   
+2002-07-18 09:12  dts12
+
+   * man/: snmptrapd.8 (V4-2-patches.5), snmptrapd.8.def:
+
+   Fix markup problem on snmptrapd man page (Bug #583329)
+   
+2002-07-18 09:10  dts12
+
+   * snmplib/snmp-tc.c:
+
+   The fix for the tm_gmtoff problem on AIX (Bug #565769) also applies to AIX 5
+   
+2002-07-18 09:06  dts12
+
+   * apps/: encode_keychange.c (V4-2-patches.1), encode_keychange.c
+:
+
+   Fix off-by-one buffer overflow (patch #577261)
+   
+2002-07-18 08:51  dts12
+
+   * local/mib2c.array-user.conf:
+
+   Generate one code-file per table (to match the header structure).
+   My apologies if this isn't correct, Robert - but the previous behaviour
+   seemed to be broken.
+   
+2002-07-18 08:37  dts12
+
+   * local/mib2c.old-api.conf:
+
+   Tackle some of the immediate deficiencies in the first draft old-api config.
+   (Now that Wes has pointed me in the direction of the documentation!)
+   
+2002-07-18 08:22  dts12
+
+   * local/mib2c:
+
+   Fix the 'decl' substitution handling (so it doesn't include the internal token as well).
+   
+2002-07-18 07:18  dts12
+
+   * local/mib2c.scalar.conf:
+
+   Provide the missing parameter in a read_only instance registration.
+   
+2002-07-18 07:09  dts12
+
+   * agent/helpers/instance.c, include/net-snmp/agent/instance.h
+:
+
+   Bring the 'read_only_int' instance handler in line with the rest of
+   the convenience instance handlers.
+   (and even break the habit of a lifetime and declare the thing....)
+   
+2002-07-18 05:48  hardaker
+
+   * agent/helpers/table_iterator.c:
+
+   fix another memory leak due to an improper ifdefed out section of code
+   
+2002-07-18 04:45  hardaker
+
+   * snmplib/scapi.c:
+
+   I'm beginning to regret ever running indent on the code base...
+   
+2002-07-17 15:43  hardaker
+
+   * local/: Makefile.in, mib2c.conf:
+
+   document and install mib2c.old-api.conf
+   
+2002-07-17 13:07  rstory
+
+   * agent/mibgroup/disman/mteTriggerTable.c:
+
+   fix segfault (possibly creating memory leak); author needs to examine code
+   
+2002-07-17 07:41  dts12
+
+   * local/: mib2c.array-user.conf, mib2c.conf,
+   mib2c.create-dataset.conf, mib2c.int_watch.conf,
+   mib2c.iterate.conf, mib2c.scalar.conf:
+
+   Dave's being unreasonably picky about grammar & spelling again.
+   Just ignore him, and he'll go away.....
+   
+2002-07-17 07:20  dts12
+
+   * local/mib2c.old-api.conf:
+
+   Initial support for the old 4x-style agent API using the new version of mib2c.
+   It doesn't handle types properly, and I'm sure I'll have buggered up some of
+   the control structure handling, but it seems to generate something that's
+   pretty close to the old output.   It's better than nothing.....
+   
+2002-07-16 22:40  rstory
+
+   * include/net-snmp/library/container.h, snmplib/container.c
+:
+
+   restore inline functions (sigh. I feel like I'm playing ring-around-the-rosie)
+   
+2002-07-16 21:58  rstory
+
+   * agent/helpers/table_array.c,
+   include/net-snmp/agent/table_array.h,
+   local/mib2c.array-user.conf:
+
+   rename some struct members to make code easier to read; a bit of re-ordering
+   in the set code; new flags for new and deleted rows; row deletes now
+   actualy work!
+   
+2002-07-16 19:32  rstory
+
+   * include/net-snmp/library/container.h, snmplib/container.c
+:
+
+   change complex macros into functions. would be nice if C had inline.
+   
+2002-07-16 18:07  rstory
+
+   * include/net-snmp/types.h:
+
+   umm, try using correct define.:-/
+   
+2002-07-16 18:05  rstory
+
+   * include/net-snmp/types.h:
+
+   test that net-snmp-config.h has been included, instead of actually including it..
+   (shouldn't this really be in all the header files?)
+   
+2002-07-16 12:14  rstory
+
+   * local/mib2c.array-user.conf:
+
+   update for containers
+   
+2002-07-16 11:20  rstory
+
+   * snmplib/snmpTCPIPv6Domain.c:
+
+   fix compiler warning
+   
+2002-07-16 11:16  rstory
+
+   * apps/snmpnetstat/Makefile.depend:
+
+   remove oid_array related dependencies (grumble grumble)
+   
+2002-07-16 11:14  rstory
+
+   * apps/Makefile.depend:
+
+   remove oid_array related dependencies
+   
+2002-07-16 11:02  rstory
+
+   * agent/: Makefile.depend, mibgroup/Makefile.depend:
+
+   remove oid_array related dependencies
+   
+2002-07-16 10:52  rstory
+
+   * snmplib/Makefile.depend, agent/helpers/Makefile.depend
+:
+
+   remove oid_array related dependencies
+   
+2002-07-16 10:50  rstory
+
+   * snmplib/Makefile.in:
+
+   remove factory.c
+   
+2002-07-16 10:29  rstory
+
+   * snmplib/snmp_api.c:
+
+   add netsnmp_container_init_list() in startup inits
+   
+2002-07-16 10:21  rstory
+
+   * include/net-snmp/library/oid_array.h, snmplib/oid_array.c
+:
+
+   remove unused files
+   
+2002-07-16 10:21  rstory
+
+   * include/net-snmp/library/container.h, snmplib/container.c
+:
+
+   chg param type from void* to struct *
+   
+2002-07-16 10:03  rstory
+
+   * snmplib/Makefile.in:
+
+   remove recently deleted oid_array.h; add factory, binary array .[ch]; derive
+   OBJS and LOBJS from CSRCS; add (optional) auto dependency generation
+   
+2002-07-16 09:53  rstory
+
+   * include/net-snmp/mib_api.h:
+
+   remove recently deleted oid_array.h
+   
+2002-07-16 09:52  rstory
+
+   * agent/mibgroup/ucd-snmp/extensible.h:
+
+   struct subtree -> netsnmp_subtree
+   
+2002-07-16 09:46  rstory
+
+   * agent/helpers/table_array.c,
+   include/net-snmp/agent/table_array.h:
+
+   remove last remaining refs to now defunct oid_array
+   
+2002-07-16 09:40  rstory
+
+   * include/net-snmp/library/container_binary_array.h,
+   snmplib/container_binary_array.c:
+
+   generic binary array container extracted from oid_array
+   
+2002-07-16 09:40  rstory
+
+   * include/net-snmp/types.h:
+
+   include net-snmp-config.h; new typedef struct netsnmp_index (oid ptr + len)
+   
+2002-07-16 09:38  rstory
+
+   * agent/helpers/table_array.c,
+   include/net-snmp/agent/table_array.h:
+
+   use generic container interface; use new netsnmp_index instead of
+   oid_array_header; rename array_group -> request_group
+   
+2002-07-16 09:34  rstory
+
+   * include/net-snmp/library/container.h, snmplib/container.c
+:
+
+   add iterators; more function typedefs; rename some func ptrs, add find_next,
+   get_subset, get_iterator, for_each, ncompare; add ability to have nested
+   containers; more utility routines; convenience marcros; start adding comments
+   
+2002-07-16 09:29  rstory
+
+   * include/net-snmp/library/factory.h:
+
+   declarations for a generic factory
+   
+2002-07-16 08:48  dts12
+
+   * agent/mibgroup/ucd-snmp/: memory_dynix.c, memory_hpux.c
+, vmstat_dynix.c, vmstat_hpux.c:
+
+   Apply patch from bug report 581618 (also applicable to dynix)
+   Provided by Nicholas L. Nigay
+   
+2002-07-16 06:54  hardaker
+
+   * perl/: ASN/ASN.pm, OID/OID.pm, agent/agent.pm,
+   agent/default_store/default_store.pm,
+   default_store/default_store.pm:
+
+   remove "our" problem and use older "use vars" instead for older perl.
+     (this should make it work with perl 5.005.  Could some one test this
+      for me?)
+   
+2002-07-15 06:45  jbpn
+
+   * agent/mibgroup/agentx/master.c:
+
+     - names of netsnmp_subtree elements changed
+   
+2002-07-15 06:42  jbpn
+
+   * agent/mibgroup/ucd-snmp/extensible.c:
+
+     - struct subtree renamed to netsnmp_subtree
+   
+2002-07-15 05:25  hardaker
+
+   * perl/AnyData_SNMP/netsh:
+
+   Some really nasty hacks to get colorized tables to work.
+   
+2002-07-14 20:51  hardaker
+
+   * perl/SNMP/t/: bulkwalk.t, mib.t:
+
+   comment out broken tests for now (XXX marked)
+   
+2002-07-14 20:50  hardaker
+
+   * perl/SNMP/SNMP.xs:
+
+   fix getbulk.
+   
+2002-07-14 20:20  hardaker
+
+   * agent/agent_handler.c,
+   include/net-snmp/agent/agent_handler.h:
+
+   A new function to call a sub-handler but passing it only one request to handle.
+   
+2002-07-10 21:21  rstory
+
+   * win32/: config.h, net-snmp/net-snmp-config.h:
+
+   define LOG_DAEMON, since windows doesn't have it
+   
+2002-07-10 21:07  rstory
+
+   * win32/: config.h, net-snmp/net-snmp-config.h:
+
+   remove define of in_addr_t, which can be found in net-snmp/types.h
+   
+2002-07-10 02:36  jbpn
+
+   * agent/agent_handler.c:
+
+     - struct subtree renamed to netsnmp_subtree
+   
+2002-07-10 02:35  jbpn
+
+   * agent/agent_index.c:
+
+     - don't use 0 in %p format specifiers
+   
+2002-07-10 02:34  jbpn
+
+   * agent/snmp_agent.c:
+
+     - struct subtree renamed to netsnmp_subtree
+     - fix some horrible indent broken formatting
+   
+2002-07-10 02:33  jbpn
+
+   * agent/snmp_vars.c:
+
+     - struct subtree renamed to netsnmp_subtree
+     - remove some obsolete variables
+   
+2002-07-10 02:33  jbpn
+
+   * agent/mibgroup/mibII/vacm_vars.c:
+
+     - reflect changed function names from agent_registry
+   
+2002-07-10 02:32  jbpn
+
+   * agent/mibgroup/agent/nsModuleTable.c:
+
+     - changes due to renaming of struct subtree to netsnmp_subtree
+     - NOTE MEMORY LEAK (which I can't see how to fix -- new agent API
+       experts please examine)
+   
+2002-07-10 02:29  jbpn
+
+   * agent/agent_registry.c:
+
+     - struct subtree renamed to netsnmp_subtree
+     - name, start, end members are now dynamically allocated to reduce
+       wasted memory (by a factor of 5 or so)
+     - functions are renamed consistently
+   
+2002-07-10 02:20  jbpn
+
+   * include/net-snmp/agent/: agent_registry.h,
+   net-snmp-agent-includes.h, snmp_agent.h, snmp_vars.h
+, var_struct.h:
+
+     - struct subtree renamed to netsnmp_subtree
+   
+2002-07-09 06:02  jbpn
+
+   * agent/mibgroup/agentx/master_admin.c:
+
+     - free cache_id storage when closing session
+   
+2002-07-09 05:56  jbpn
+
+   * snmplib/snmp_api.c:
+
+     - just call netsnmp_ds_shutdown() once in snmp_shutdown()
+   
+2002-07-09 04:15  jbpn
+
+   * snmplib/mib.c:
+
+     - fix memory leak in netsnmp_fixup_mib_directory()
+   
+2002-07-09 03:14  jbpn
+
+   * agent/snmpd.c:
+
+     - add a cast to quell compiler warning
+   
+2002-07-08 22:09  rstory
+
+   * agent/mibgroup/util_funcs.h:
+
+   extern C for C++ compiles
+   
+2002-07-08 07:21  jbpn
+
+   * include/net-snmp/agent/snmp_vars.h:
+
+     - remove obsolete function prototypes
+   
+2002-07-07 19:45  rstory
+
+   * local/mib2c.array-user.conf:
+
+   update to use containers
+   
+2002-07-07 19:38  rstory
+
+   * include/net-snmp/library/oid_array.h:
+
+   fix typo
+   
+2002-07-07 19:37  rstory
+
+   * agent/mibgroup/ucd-snmp/: disk.c, proc.c:
+
+   fix compiler warning
+   
+2002-07-07 19:33  rstory
+
+   * agent/mibgroup/: agent/nsModuleTable.c,
+   agent/nsTransactionTable.c, host/hr_swinst.c:
+
+   fix compiler warning
+   
+2002-07-07 19:03  rstory
+
+   * snmplib/snmpUDPIPv6Domain.c:
+
+   remove unused vars
+   
+2002-07-07 19:00  rstory
+
+   * snmplib/oid_stash.c:
+
+   fix compiler warnings
+   
+2002-07-07 18:53  rstory
+
+   * snmplib/asn1.c:
+
+   fix compiler warnings
+   
+2002-07-07 18:50  rstory
+
+   * include/net-snmp/library/snmp_api.h, snmplib/snmp_api.c
+:
+
+   make param const; fix compile const warning
+   
+2002-07-07 18:27  rstory
+
+   * snmplib/mib.c:
+
+   fix compiler warning; fix memory leak; prep a few comments for indent
+   
+2002-07-06 14:11  hardaker
+
+   * README, sedscript.in, snmplib/snmp_version.c,
+   FAQ, perl/SNMP/SNMP.pm:
+
+   - (snmplib/snmp_version.c sedscript.in): version tag ( 5.0.2.pre1 )
+   
+2002-07-06 14:10  hardaker
+
+   * doxygen.conf:
+
+   change project version to 5.0.2
+   
+2002-07-06 14:09  hardaker
+
+   * perl/SNMP/Makefile.PL:
+
+   snmptrapd is actually built in the apps directory, not the agent directory.
+   
+2002-07-05 11:55  rstory
+
+   * local/mib2c:
+
+   clarify directions for obtaining perl/SNMP module.
+   
+2002-07-05 05:18  jbpn
+
+   * agent/mibgroup/agentx/client.c:
+
+     - I must not check in code without compiling it
+     - I must not check in code without compiling it
+     - I must not check in code without compiling it
+     - I must not check in code without compiling it
+     - ...
+   
+2002-07-05 03:23  jbpn
+
+   * agent/mibgroup/: agentx/client.c, mibII/system_mib.c:
+
+     - sysObjectID was being returned minus its last sub-identifier because
+       the length variable had not been updated to reflect the fact that it
+       is now longer.  Code changed to use sizeof() instead, so this won't
+       happen again.  Reported by Stian Soiland (bug #577439).
+   
+2002-07-04 10:13  rstory
+
+   * snmplib/read_config.c:
+
+   ucd-snmp -> net-snmp
+   
+2002-07-04 07:06  jbpn
+
+   * snmplib/snmp_api.c:
+
+     - modified handling of opaque pointer for stream-based transports to
+       avoid both multiple free() problem and unnecessary copying.
+   
+2002-07-04 06:00  dts12
+
+   * man/snmpd.conf.5.def, agent/mibgroup/host/hr_storage.c
+   (V4-2-patches.[5,9]), man/snmpd.conf.5.def,
+   agent/mibgroup/host/hr_storage.c:
+
+   Apply Johannes Schmidt-Fischer's NetworkDisk patch #554554
+   
+2002-07-04 05:56  dts12
+
+   * agent/mibgroup/host/: hr_filesys.c, hr_filesys.h
+   (V4-2-patches.[5,1]), hr_filesys.c, hr_filesys.h:
+
+   Apply Johannes Schmidt-Fischer's NFS filesystem patch #554553
+   (simplified to avoid the re-indentation - which makes it easier to see
+    what's changed.  The whole HostRes group needs cleaning up anyway!)
+   
+2002-07-04 05:52  dts12
+
+   * snmplib/snmp_api.c:
+
+   Ensure transport opaque data isn't multiply assigned
+   (and hence multiply freed) for stream-based transports.
+   Datagram-based transports don't suffer from this problem.
+   Based on Patch 573771
+   
+2002-07-03 16:28  rstory
+
+   * agent/mibgroup/mibII/vacm_vars.c:
+
+   be precise about what file needs to be configured for access control
+   
+2002-07-03 14:13  rstory
+
+   * local/mib2c.conf:
+
+   fix minor grammar errors; add descr for mib2c.array-user; add section header
+   for generating header definition files
+   
+2002-07-03 13:11  rstory
+
+   * include/net-snmp/: types.h, library/system.h:
+
+   move include for in_addr_t to net-snmp/types.h, where in_addr_t is defined
+   for systems w/out netinet/in.h
+   
+2002-07-03 12:51  rstory
+
+   * local/mib2c.scalar.conf:
+
+   more tweaks noticed on the mailing list
+   
+2002-07-03 08:23  hardaker
+
+   * perl/agent/test.pl:
+
+   make test cleanups test.pl
+   
+2002-07-03 03:42  dts12
+
+   * agent/mibgroup/: util_funcs.c (V4-2-patches.1), util_funcs.c
+:
+
+   Shut the agent down cleanly before restarting.
+   This closes any SNMP/AgentX ports as well.
+   
+2002-07-03 03:26  dts12
+
+   * agent/mibgroup/util_funcs.c:
+
+   OID sub-identifiers are unsigned, so treating them as signed can
+   give the wrong results with large values.
+   
+2002-07-03 03:20  dts12
+
+   * snmplib/system.h (V4-2-patches.5),
+   include/net-snmp/library/system.h:
+
+   Ensure in_addr_t is defined.
+   
+2002-07-03 02:34  dts12
+
+   * acconfig.h, configure, configure.in,
+   include/net-snmp/net-snmp-config.h.in:
+
+   Testing for <sys/disklabel.h> requires <machine/types.h> on NetBSD 1.5.
+   Reported by Felicia Neff.
+   (Apparently from the NetBSD bug database - why they didn't tell us about
+   it is a mystery to me....)
+   
+2002-07-03 02:19  dts12
+
+   * configure.in:
+
+   Fix the default value for sysObjectID as reported in the configure --help output.
+   (The actual value used is correct - it's just the help output that's wrong).
+   Spotted by Sandhya Satyanarayan.
+   
+2002-07-02 23:15  hardaker
+
+   * local/mib2c.conf:
+
+   update text for various .conf files
+   
+2002-07-02 13:46  rstory
+
+   * local/mib2c.scalar.conf:
+
+   fixes noted on the mailing list by Patrice Kadionik <kadionik@enseirb.fr>
+   
+2002-07-02 02:39  dts12
+
+   * perl/SNMP/Makefile.PL:
+
+   Add the 'snmpd' and 'snmptrapd' binary names to the appropriate paths
+   when setting up the testing framework.
+   
+2002-07-01 07:53  dts12
+
+   * snmplib/: asn1.c (V4-2-patches.8), asn1.c:
+
+   Encode/Decode OIDs of the form 2.X (X > 40) correctly.
+   
+2002-07-01 02:40  jbpn
+
+   * configure, configure.in:
+
+     - fix horrible formatting in help for transports
+   
+2002-07-01 02:23  dts12
+
+   * sedscript.in:
+
+   Pick up the changed definition for the root of the UCD extensible agent tables
+   (so that the EXAMPLE.conf file gets set up with the correct numeric OIDs)
+   
+2002-06-28 06:46  jbpn
+
+   * snmplib/snmpTCPDomain.c:
+
+     - remove transport specifier and port number from strings returned
+       from snmp_tcp_fmtaddr() which break tcp_wrappers (and perhaps
+       other things).
+   
+2002-06-28 04:41  dts12
+
+   * perl/agent/test.pl:
+
+   Update default store retrieval functions to use the correct name.
+   
+   Note that this test script appears to include two infinite loops.
+   I'm not clear how this is expected to run successfully ?
+   
+2002-06-28 04:39  dts12
+
+   * perl/agent/agent.xs:
+
+   Remove reference to non-existent degugging function.
+   
+2002-06-28 04:37  dts12
+
+   * perl/manager/: Makefile.PL, displaytable.pm,
+   getValues.pm, manager.pm, snmptosql:
+
+   Bring perl 'manager' module under the NetSNMP banner
+   (both in terms of module group name, and references to 'ucd-snmp').
+   Remove some UCD-specific settings.
+   
+   Note that snmptosql still refers explicitly to Wes' UCD email address,
+   and manager.pm to Wes' UCD filestore path.  The relevant lines have
+   been highlighted, to encourage anyone wishing to use this to change them.
+   
+2002-06-28 04:12  dts12
+
+   * perl/: AnyData_SNMP/Makefile.PL, OID/Makefile.PL,
+   SNMP/Makefile.PL, agent/Makefile.PL,
+   manager/Makefile.PL:
+
+   Remove checking for "internal" prerequisites, so that "perl Makefile.PL"
+   at the top level will work - even on a pristine system.
+   
+   Qn:
+     Is it necessary/desirable to separate the NetSNMP modules to this extent?
+   Would it not be simpler to have all of the main .pm/.xs files in a single
+   NetSNMP directory, and compile/install them all from there?
+   
+2002-06-28 01:45  dts12
+
+   * configure, configure.in:
+
+   Check for --with-enterprise (et al) being invoked without a value, and bomb out.
+   
+2002-06-27 21:43  rstory
+
+   * README.solaris:
+
+   new README detainling the use of SFIO to circumvent the 255 fd limit on
+   solaris.
+   
+2002-06-27 11:09  rstory
+
+   * agent/helpers/table_array.c,
+   include/net-snmp/agent/table_array.h:
+
+   remove changing array; add netsnmp_table_array_remove_row()
+   
+2002-06-27 04:15  dts12
+
+   * Makefile.rules:
+
+   Some versions of 'makedepend' (e.g. RedHat 7.1), can't handle "-osuffix"
+   as a single option.  All versions seem happy with "-o suffix" so use that.
+   
+2002-06-27 03:31  dts12
+
+   * snmplib/mib.c:
+
+   Use ENV_SEPARATOR_CHAR rather than hardwiring ':' in netsnmp_set_mib_directory
+   (as suggested by Robert)
+   
+2002-06-27 03:22  jbpn
+
+   * snmplib/snmpUDPDomain.c:
+
+     - remove transport specifier and port number from strings returned
+       from snmp_udp_fmtaddr() which break tcp_wrappers (and perhaps
+       other things).
+   
+2002-06-27 03:09  dts12
+
+   * agent/mibgroup/mibII/: snmp_mib.c (V4-2-patches.2), snmp_mib.c
+:
+
+   Validate new snmpEnableAuthenTraps value before trying to use it.
+   Spotted & fixed by Shantha Kumara
+   
+2002-06-25 14:09  rstory
+
+   * apps/snmpset.c:
+
+   add APPTOPS (-Cq) for suppressing output of set results on success
+   
+2002-06-25 09:28  dts12
+
+   * agent/mibgroup/ucd-snmp/proc.c:
+
+   Apply patch #559848 to use the /proc pseudo-filesystem under Linux
+   (rather than parsing the output of ps)
+   
+2002-06-25 08:59  dts12
+
+   * snmplib/snmp-tc.c:
+
+   Check for 'aix4' (which is the token defined in the system header file)
+   rather than 'aix'.   See bug #565769
+   
+2002-06-25 08:31  dts12
+
+   * agent/mibgroup/util_funcs.c:
+
+   Treat '0' as an invalid index for a "simple table".
+   
+2002-06-25 07:36  hardaker
+
+   * local/snmpconf.dir/snmpd-data/system:
+
+   document read-only nature of sysContact.0 and sysLocation.0
+   configuration tokens.
+   
+2002-06-25 06:40  jbpn
+
+   * man/: Makefile.in, default_store.3.bot,
+   default_store.3.top:
+
+     - add netsnmp_ prefix to default_store functions
+   
+     - clean up manpage a bit
+   
+     - fix breakage in generation of default_store.3.h due to auto-indentation
+       of default_store.h
+   
+2002-06-25 02:55  jbpn
+
+   * EXAMPLE.conf.def (V4-2-patches.3), EXAMPLE.conf.def:
+
+     - mention that setting sysLocation et al. in snmpd.conf makes them
+       read-only
+   
+     - also change syntax of all example command line tools to use newer
+       -c COMMUNITY syntax not positional parameter
+   
+2002-06-24 08:03  hardaker
+
+   * agent/mibgroup/ucd-snmp/vmstat.c:
+
+   make buffer size increase note a debug statement rather than a generic
+   log statement.
+   
+2002-06-23 18:40  driehuis
+
+   * perl/SNMP/SNMP.xs:
+
+   Handle COUNTER64 in __translate_asn_type.
+   
+2002-06-23 16:03  hardaker
+
+   * perl/AnyData_SNMP/netsh:
+
+   documentation for the script and the language it houses.
+     (man page auto-generated from the contained pod documentation)
+   
+2002-06-23 15:03  hardaker
+
+   * perl/SNMP/README:
+
+   update to reference top level Makefile.PL
+   
+2002-06-23 14:51  hardaker
+
+   * perl/SNMP/: SNMP.xs (V4-2-patches.1), SNMP.xs:
+
+   fix reported by Willem Dekker for Windows.  Bug #543194 fixed.
+   
+2002-06-22 08:37  hardaker
+
+   * README.snmpv3:
+
+   update for recent methodologies
+   
+2002-06-21 16:07  rstory
+
+   * snmplib/mib.c:
+
+   final (hopefully!) fix for parsing ip addresses from
+   "Fco. Javier Ridruejo" <acbripef@si.ehu.es>
+   
+2002-06-19 14:38  hardaker
+
+   * man/: netsnmp_agent.3, netsnmp_bulk_to_next.3,
+   netsnmp_debug.3, netsnmp_handler.3, netsnmp_instance.3
+, netsnmp_multiplexer.3, netsnmp_old_api.3,
+   netsnmp_read_only.3, netsnmp_serialize.3,
+   netsnmp_table.3, netsnmp_table_array.3,
+   netsnmp_table_data.3, netsnmp_table_dataset.3,
+   netsnmp_table_iterator.3, netsnmp_todo.3:
+
+   update from doxygen
+   
+2002-06-19 11:50  hardaker
+
+   * local/: mib2c.int_watch.conf, mib2c.scalar.conf:
+
+   scalar mib2c configuration files for generating scalar code.
+   
+2002-06-19 11:43  hardaker
+
+   * agent/mibgroup/examples/scalar_int.c:
+
+   clean up multi-line commend which was messed up by indent.
+   
+2002-06-19 11:42  hardaker
+
+   * perl/AnyData_SNMP/netsh:
+
+   - add support for prompting of unknown parameters to aliases.
+   - misc other improvements (like "rehash")
+   
+2002-06-19 11:38  hardaker
+
+   * net-snmp-config.in:
+
+   fix for new default store API
+   
+2002-06-19 11:29  hardaker
+
+   * perl/: Makefile.PL, Makefile.makefiles,
+   Makefile.subs.pl, make-perl-makefiles, ASN/Makefile.PL
+, OID/Makefile.PL, SNMP/Makefile.PL,
+   agent/Makefile.PL, agent/default_store/Makefile.PL,
+   default_store/Makefile.PL:
+
+   ARGGGGGG
+   I love perl.
+   I hate perl's make system.
+   I hate the fact that perl segfaults if GetOptions() is called more
+   than once.
+   sigh.
+   This hopefully will fix the perl module build routines so it at least
+   works (but it's still ugly and could use more cleaning).
+   
+2002-06-19 07:45  rstory
+
+   * agent/snmp_agent.c:
+
+   fix infinte loop and add debug in remove_delegated
+   
+2002-06-18 07:37  hardaker
+
+   * agent/mibgroup/agentx/master_admin.c:
+
+   NULL the priv pointer on session duplication.  thanks to rezitoz
+   
+2002-06-17 06:23  hardaker
+
+   * README:
+
+   Changed Katsuhisa's email address, on request
+   
+2002-06-14 07:44  hardaker
+
+   * agent/helpers/table_iterator.c:
+
+   Patch #569021: from Lauri Myllari
+     - fix memory leak in the table iterator support.
+   
+2002-06-14 07:02  hardaker
+
+   * snmplib/snmp_api.c:
+
+   Applied patch #569020 from rezitoz on IRC to fix non-initialized variable
+   
+2002-06-14 03:57  dts12
+
+   * agent/mibgroup/Rmon/alarm.c:
+
+   Add (null) context, to bring into line with the v5 registry APIs.
+   Fixes bug 568580.
+   
+2002-06-14 02:27  dts12
+
+   * aclocal.m4, configure:
+
+   Use matching ' and " quotes for AIX configure test.
+   Mentioned in passing in bug 565769.
+   
+2002-06-13 14:32  hardaker
+
+   * perl/SNMP/t/conf.t:
+
+   fix default_store routines
+   
+2002-06-12 06:43  dts12
+
+   * win32/net-snmp/net-snmp-config.h:
+
+   Bring Windows OID usage into line with the main config file settings.
+   
+2002-06-12 06:37  dts12
+
+   * acconfig.h, include/net-snmp/net-snmp-config.h.in:
+
+   Correct the default Enterprise OID used in traps, to avoid a repeated 0
+   subidentifier.  (Fixes bug #566917)
+   
+2002-06-12 05:14  dts12
+
+   * snmplib/snmp_api.c:
+
+   Define 'length' as a signed variable, so it can handle an error value of -1.
+   Reported by Joakim Althini.
+   
+2002-06-12 03:11  dts12
+
+   * snmplib/read_config.c:
+
+   Make sure the address of the next link is properly saved, before freeing memory.
+   Problem discovered by Hugo Cacote.
+   
+2002-06-12 02:15  dts12
+
+   * include/net-snmp/: agent/agent_index.h, agent/agent_trap.h
+, agent/all_helpers.h, agent/auto_nlist.h,
+   agent/bulk_to_next.h, agent/debug_handler.h,
+   agent/mib_modules.h, agent/multiplexer.h, agent/null.h
+, agent/old_api.h, agent/read_only.h,
+   agent/serialize.h, agent/set_helper.h,
+   library/cmu_compat.h, library/snmpAAL5PVCDomain.h,
+   library/snmpCallbackDomain.h, library/snmpIPXDomain.h,
+   library/snmpTCPDomain.h, library/snmpTCPIPv6Domain.h,
+   library/snmpUDPDomain.h, library/snmpUDPIPv6Domain.h,
+   library/snmpUnixDomain.h, library/snmp_parse_args.h,
+   library/snmp_secmod.h, library/transform_oids.h,
+   library/ucd_compat.h:
+
+   Supply missing #ifndef/#define/#endif and extern "C" {} wrappers
+   
+2002-06-11 17:56  rstory
+
+   * snmplib/mib.c:
+
+   remove spurious printf to stderr
+   
+2002-06-11 14:21  rstory
+
+   * include/net-snmp/types.h:
+
+   add extern "C"; add void_array struct
+   
+2002-06-11 14:20  rstory
+
+   * agent/helpers/table_array.c:
+
+   remove tsearch; use new container instead
+   
+2002-06-11 14:19  rstory
+
+   * include/net-snmp/agent/table_array.h:
+
+   use container for secondary index
+   
+2002-06-11 14:17  rstory
+
+   * snmplib/Makefile.in:
+
+   add container to headers; add container.c
+   
+2002-06-11 14:17  rstory
+
+   * snmplib/container.c:
+
+   init functions for basic/sorted container
+   
+2002-06-11 14:15  rstory
+
+   * include/net-snmp/library/container.h:
+
+   more methods for basic container; add sorted (will probably rename) conatiner
+   
+2002-06-11 12:22  rstory
+
+   * include/net-snmp/agent/instance.h:
+
+   protect against multiple includes; add extern "C" for __cplusplus
+   
+2002-06-11 11:11  hardaker
+
+   * perl/AnyData_SNMP/: INSTALL, Makefile.PL, README
+, netsh, snmpsh:
+
+   renamed snmpsh to netsh, as I like the name better and it appeals to a
+   wider number of people.
+   
+2002-06-10 09:53  rstory
+
+   * agent/snmp_agent.c:
+
+   when deleting an asp pointer, make sure it isn't in the delegated list
+   
+2002-06-10 08:46  rstory
+
+   * snmplib/mib.c:
+
+   fix parse_one_oid_index to allow too short IP address when complete is
+   specified; add netsnmp_oid2chars & netsnmp_oid2str
+   
+2002-06-10 07:42  hardaker
+
+   * perl/default_store/: default_store.pm, default_store.xs
+, test.pl:
+
+   update to latest default_store defines
+   
+2002-06-10 07:39  hardaker
+
+   * Makefile.in, perl/.cvsignore, perl/Makefile.PL:
+
+   Top level perl Makefile.PL to install the whole bunch underneath.
+   This should now be used instead of the lower level makefiles for
+   simplicity.
+   
+2002-06-10 07:27  dts12
+
+   * perl/SNMP/t/mib.t:
+
+   Acknowledge known failing tests.
+   This message can be removed once the problem has been isolated and fixed.
+   
+2002-06-10 07:17  hardaker
+
+   * snmplib/mib.c:
+
+   support for ipaddress building/parsing of OID indexes.
+   
+2002-06-10 02:07  dts12
+
+   * FAQ (V4-2-patches.8), FAQ:
+
+   Mention the other perl modules, introduced with v5 (particularly 'default_store')
+   
+2002-06-10 01:28  dts12
+
+   * FAQ (V4-2-patches.7), FAQ:
+
+   New entry describing possible problems with trap handlers.
+   
+2002-06-08 21:39  hardaker
+
+   * perl/agent/agent.pm:
+
+   default_store fixes
+   
+2002-06-08 20:54  rstory
+
+   * Makefile.in:
+
+   break perl makefile creation into seperate step; only clean perl directory
+   if there is a makefile
+   
+2002-06-08 20:15  rstory
+
+   * Makefile.in:
+
+   add perltest target to make test in all perl directories
+   
+2002-06-08 09:47  hardaker
+
+   * perl/AnyData_SNMP/Storage.pm:
+
+   fix to deal with updated SQL::Statement module.
+   
+2002-06-08 07:08  hardaker
+
+   * perl/AnyData_SNMP/INSTALL:
+
+   update to SQL-Statement requirement of 1.004
+   
+2002-06-08 06:45  hardaker
+
+   * perl/SNMP/SNMP.xs:
+
+   remove mib init code from C snmp_translate_obj call
+   
+2002-06-08 06:44  hardaker
+
+   * perl/SNMP/SNMP.pm:
+
+   init_snmp inside translateObj
+   
+2002-06-08 06:44  hardaker
+
+   * perl/OID/OID.pm:
+
+   change version to 0.1
+   
+2002-06-08 06:43  hardaker
+
+   * perl/AnyData_SNMP/configs/unix:
+
+   A few cleanups to ifconfig and netstat commands
+   
+2002-06-08 06:35  hardaker
+
+   * perl/AnyData_SNMP/snmpsh:
+
+   - beginning support for import/export of data (currently to/from CSV).
+   - support for "diff" which compares old (possibly imported data) to current.
+   
+2002-06-08 06:34  hardaker
+
+   * perl/AnyData_SNMP/Makefile.PL:
+
+   change required SNMP module version from 4 to 5
+   
+2002-06-08 06:34  hardaker
+
+   * mibs/NET-SNMP-EXAMPLES-MIB.txt:
+
+   Add a tutorial place holder comment OID.
+   
+2002-06-08 06:33  hardaker
+
+   * local/tkmib:
+
+   fix tkmib for newer perl modules.
+   
+2002-06-08 06:33  hardaker
+
+   * local/snmpconf:
+
+   turn off extra bold/underline formatting by default.
+   
+2002-06-07 15:04  rstory
+
+   * include/net-snmp/library/container.h:
+
+   generic container structure for storing data
+   
+2002-06-07 13:01  rstory
+
+   * perl/ASN/ASN.xs:
+
+   include net-snmp-config.h
+   
+2002-06-07 10:37  rstory
+
+   * configure:
+
+   update configure to keep in line with configure.in (why? shouldn't
+   configure not be in CVS and be autogenerated? One of these days I'm going
+   to have to learn autoconf....)
+   
+2002-06-07 10:35  rstory
+
+   * Makefile.in, Makefile.rules:
+
+   always check return status of make when inside a loop, and exit on errors
+   
+2002-06-07 08:17  dts12
+
+   * agent/mibgroup/mibII/: interfaces.c (V4-2-patches.3),
+   interfaces.c:
+
+   Only null-terminate the interface name while it's actually being copied.
+   Restore the data line afterwards, so the debugging output is meaningful.
+   
+2002-06-07 01:16  dts12
+
+   * agent/snmp_agent.c:
+
+   Fix for indexing error, that causes a crash if more than 16 varbinds
+   are added to the cache in one go.  Spotted by Shanth Kumara
+   
+2002-06-06 01:12  dts12
+
+   * aclocal.m4, configure (V4-2-patches.[7,5]), aclocal.m4,
+   configure:
+
+   Don't differenciate between elf- and a.out-based NetBSD systems.
+   (Problem highlighted by Felicia Neff)
+   
+2002-06-05 18:50  rstory
+
+   * acconfig.h, configure, configure.in,
+   include/net-snmp/net-snmp-config.h.in,
+   include/net-snmp/types.h:
+
+   put defines for socklen_t and in_addr_t in net-snmp/types.h instead of having
+   configure generate them; configure instead generates HAVE_SOCKLEN_T and
+   HAVE_IN_ADDR_T for systems which don't need the defines; this is primarily
+   for the benefit of the Win32 platform, which doesn't have configure.
+   
+2002-06-05 09:20  rstory
+
+   * local/mib2c.iterate.conf:
+
+   don't advance request pointer inside for loop, since for loop does it for
+   us; otherwise for loop may end up dereferencing NULL pointer.
+   
+2002-06-05 06:41  hardaker
+
+   * perl/AnyData_SNMP/configs/unix:
+
+   example configuration file to duplicate various unix utilities:
+    - currently: netstat, ps, df, ifconfig
+   
+2002-06-05 06:40  hardaker
+
+   * perl/AnyData_SNMP/configs/scli:
+
+   example configuration file to duplicate functionality in Juergen's
+   scli command.
+   
+2002-06-05 06:39  hardaker
+
+   * perl/AnyData_SNMP/snmpsh:
+
+   new commands:
+     source file -- sources an rc file
+     watch expression -- repeatedly runs a command and colorizes
+       differences in data
+     eval expression -- evaluates an expression directly in perl
+       - beginnings of overloads in perl so that calling sysContact()
+         will return the sysContact value.  tables not returned yet.
+   fixes:
+     turns of ornamental prompt support (ick) by default
+   
+2002-06-05 04:43  dts12
+
+   * man/: snmpcmd.1 (V4-2-patches.8), snmpcmd.1.def:
+
+   Brief mention of the need to quote OIDs containing string indexes,
+   to protect the double quotes from the shell.
+   
+2002-06-04 10:38  rstory
+
+   * agent/snmp_agent.c:
+
+   test for a null treecache before dereferencing it; noted on the coders
+   list by joakim.althini@reddo.net
+   
+2002-06-04 10:33  rstory
+
+   * agent/snmp_agent.c:
+
+   test for asp->pdu == NULL before dereferencing it; noted on the coders
+   list by joakim.althini@reddo.net.
+   
+2002-06-04 05:54  hardaker
+
+   * perl/AnyData_SNMP/snmpsh:
+
+   support for printf, single query/sets of scalars, multi-line aliases.
+   
+2002-05-30 15:23  hardaker
+
+   * perl/SNMP/SNMP.pm:
+
+   default_store fixes
+   
+2002-05-30 15:23  hardaker
+
+   * perl/OID/OID.pm:
+
+   make new() operator a bit smarter
+   
+2002-05-29 19:57  hardaker
+
+   * snmplib/: snmp_alarm.c (V4-2-patches.2), snmp_alarm.c:
+
+   set the storage pointer to NULL, as pointed out by Mark Hoy.
+   
+2002-05-29 09:22  hardaker
+
+   * include/net-snmp/library/default_store.h,
+   include/net-snmp/library/mib.h, snmplib/mib.c,
+   snmplib/snmp_parse_args.c:
+
+   Patch from Harrie Hazewinkel to APIify MIBDIRS support
+   
+2002-05-29 07:43  dts12
+
+   * FAQ (V4-2-patches.6), FAQ:
+
+   Expand on when OpenSSL is necessary, and how to compile using it.
+   
+2002-05-29 06:52  dts12
+
+   * snmplib/snmpUDPDomain.c:
+
+   Set REUSEADDR so that specifying the same port twice doesn't kill the agent.
+   (Suggested by Robert Hastings)
+   
+2002-05-29 02:41  dts12
+
+   * FAQ (V4-2-patches.5), FAQ:
+
+   Reference both versions of the tutorial (since this document is used
+   for building the on-line version of the FAQ)
+   
+2002-05-29 02:16  dts12
+
+   * FAQ (V4-2-patches.4), FAQ:
+
+   Clarify that trap filtering is not yet operational.
+   
+2002-05-28 14:53  rstory
+
+   * snmplib/oid_array.c:
+
+   remove ^M chars
+   
+2002-05-28 14:52  rstory
+
+   * local/mib2c.array-user.conf:
+
+   fix logic in can_delete; consolidate use of netsnmp_set_mode_request by setting
+   rc for use at end of loop; don't use removed macros for rowstatus/storagetype,
+   using new netsnmp_check_vb* routines instead; add asserts for error cases that
+   should be caught by earlier routines
+   
+2002-05-28 14:47  rstory
+
+   * include/net-snmp/agent/table_array.h:
+
+   add callbacks for row (de)activation
+   
+2002-05-28 06:23  dts12
+
+   * agent/helpers/table_array.c:
+
+   Protect "#include <search.h>" with the HAVE_SEARCH_H token.  (Suggested by Harrie)
+   
+2002-05-28 06:20  dts12
+
+   * include/net-snmp/library/snmp_logging.h:
+
+   Fix the declaration of snmp_enable_syslog_ident. (Spotted by Harrie)
+   
+2002-05-27 01:53  dts12
+
+   * apps/snmptrapd.c, include/net-snmp/library/snmp_logging.h
+, snmplib/snmp_logging.c:
+
+   Don't hardwire syslog facility to LOG_DAEMON.
+   Fix provided by Joakim Fallsjo.
+   
+2002-05-27 01:32  dts12
+
+   * agent/mibgroup/snmpv3/usmUser.c, apps/snmptrapd.c
+   (V4-2-patches.[2,8]), agent/mibgroup/snmpv3/usmUser.c,
+   apps/snmptrapd.c:
+
+   Tweak 'usmUser' help string to accurately reflect which bits are optional.
+   Reported by Ali Chanaui.
+   
+2002-05-27 01:22  dts12
+
+   * man/: snmpd.conf.5.def (V4-2-patches.4), snmpd.conf.5.def:
+
+   Document the limit on the number of "file" directives.
+   
+2002-05-27 01:17  dts12
+
+   * local/Makefile.in:
+
+   Remove an extraneous trailing backslash, that confuses some 'make's
+   
+2002-05-24 09:54  hardaker
+
+   * perl/agent/netsnmp_request_info.pm:
+
+   Proper creation of returned NetSNMP::OID object.
+   
+2002-05-24 09:54  hardaker
+
+   * perl/agent/agent.xs:
+
+   increase reference counts on returned mib registration objects so
+   they're not auto-cleaned by perl (the agent now has a copy of the pointer)
+   
+2002-05-24 09:53  hardaker
+
+   * perl/SNMP/SNMP.xs:
+
+   new default_store netsnmp_ prefixes.
+   
+2002-05-24 09:53  hardaker
+
+   * local/mib2c:
+
+   support for scalars (mib2c.scalar.conf file coming shortly)
+   
+2002-05-24 09:52  hardaker
+
+   * Makefile.in:
+
+   A new rule called "commentcheck" to grep all sources for // comments.
+   
+2002-05-24 08:09  dts12
+
+   * agent/agent_registry.c:
+
+   Declare 'register_mib_detach_node' before it's used for the first time.
+   (Spotted by Xiang Zhang)
+   
+2002-05-24 07:44  dts12
+
+   * apps/Makefile.in:
+
+   Remove extraneous trailing backslash.
+   (That *might* be confusing Sun's make, but is wrong anyway)
+   
+2002-05-23 01:39  dts12
+
+   * agent/mibgroup/ucd-snmp/: vmstat.c, vmstat_bsdi4.c,
+   vmstat_dynix.c, vmstat_freebsd2.c, vmstat_hpux.c,
+   vmstat_netbsd1.c, vmstat_solaris2.c:
+
+   Bring the various 'var_extensible_vmstat' definitions into line
+   with the declaration in the header file - i.e. non-static.
+   
+2002-05-21 15:25  rstory
+
+   * Makefile.in:
+
+   add -I$(srcdir)/include to CPP path for people building outside of src tree
+   
+2002-05-21 08:14  rstory
+
+   * agent/mibgroup/tunnel/tunnel.c:
+
+   apply patch [ 558129 ] Make the tunnel mib compile in 5.0.1, submitted
+   by Lorenzo Colitti (lcolitti), which adds missing net-snmp-config.h
+   
+2002-05-21 05:32  jbpn
+
+   * agent/snmpd.c:
+
+     - fix core dump in -u option processing, noted by Andreas Maus
+   
+2002-05-21 05:20  dts12
+
+   * agent/mibgroup/ucd-snmp/: memory.c (V4-2-patches.9), memory.c
+:
+
+   Latch memory reporting at 2^31-1, rather than 2^32-1 since these
+   objects are defined as (signed) Integer32.
+   Only latch if the value is *greater* than this threshold, not less!
+   
+2002-05-21 01:20  jbpn
+
+   * include/ucd-snmp/default_store.h, snmplib/ucd_compat.c
+:
+
+     - add compatibility definitions and functions for newly-renamed
+       default store manipulation functions and constants (defined iff
+       --enable-ucd-compatibility is given to at configuration time)
+   
+2002-05-21 00:51  jbpn
+
+   * include/net-snmp/library/default_store.h,
+   snmplib/default_store.c:
+
+     - move definition of netsnmp_ds_read_config type from default_store.h
+       into default_store.c (since it is not, and should not, be used
+       elsewhere).
+   
+2002-05-20 03:42  rstory
+
+   * agent/mibgroup/mibII/vacm_vars.c:
+
+   registers tokens for ipv6 ro/rw community, and make sure to parse them
+   as ipv6, not v4.
+   
+2002-05-19 11:38  driehuis
+
+   * agent/mibgroup/ucd-snmp/diskio.c:
+
+   Bugfix for FreeBSD support of the diskIO mib. The original code neglected
+   the device number, which made distinguishing between, say, ad0 and ad1
+   impossible.
+   
+2002-05-17 09:05  hardaker
+
+   * agent/mibgroup/mibII/at.c, agent/mibgroup/mibII/icmp.c
+, agent/mibgroup/mibII/interfaces.c,
+   agent/mibgroup/mibII/ip.c, agent/mibgroup/mibII/ipv6.c,
+   agent/mibgroup/mibII/mta_sendmail.c,
+   agent/mibgroup/mibII/snmp_mib.c,
+   agent/mibgroup/mibII/sysORTable.c,
+   agent/mibgroup/mibII/system_mib.c, agent/mibgroup/mibII/tcp.c
+, agent/mibgroup/mibII/udp.c,
+   agent/mibgroup/mibII/vacm_vars.c,
+   include/net-snmp/agent/var_struct.h:
+
+   Patch from Harrie Hazewinkel to slightly reduce memory costs of registartions
+   
+2002-05-16 17:06  hardaker
+
+   * perl/SNMP/SNMP.xs:
+
+   fix default store tag names.
+   fix init_snmp() definition to match normal perl non-ansi mode.
+   
+2002-05-16 16:39  driehuis
+
+   * net-snmp-config.in:
+
+   Make sure --cflags spits out the required include path when installing
+   in a non-default location, as documented in the usage info in the script.
+   
+2002-05-16 15:36  hardaker
+
+   * local/snmpconf.dir/snmpd-data/system:
+
+   add a line to the sysServices prompt saying if you don't know, say no.
+   
+2002-05-16 12:55  hardaker
+
+   * perl/agent/default_store/: default_store.pm,
+   default_store.xs:
+
+   update to new define list
+   
+2002-05-16 12:55  hardaker
+
+   * perl/agent/default_store/test.pl:
+
+   test script
+   
+2002-05-16 12:49  hardaker
+
+   * perl/agent/default_store/gen:
+
+   autogeneration script
+   
+2002-05-16 10:58  hardaker
+
+   * perl/default_store/: default_store.pm, default_store.xs
+, test.pl:
+
+   updates to new .h tokens
+   
+2002-05-16 10:58  hardaker
+
+   * perl/default_store/gen:
+
+   .h -> perlmodule regeneration script
+   
+2002-05-16 07:09  dts12
+
+   * include/net-snmp/library/default_store.h,
+   include/net-snmp/library/mib.h, snmplib/mib.c,
+   snmplib/snmp_api.c, snmplib/ucd_compat.c:
+
+   Consolidate the various OID output configuration mechanisms into one.
+   This does not affect the command-line options (yet!) - just the internals.
+   
+2002-05-15 17:44  hardaker
+
+   * snmplib/default_store.c,
+   include/net-snmp/library/default_store.h,
+   include/net-snmp/agent/ds_agent.h:
+
+   fix default_store
+   
+2002-05-15 17:20  hardaker
+
+   * configure:
+
+   run autoconf
+   
+2002-05-15 17:20  hardaker
+
+   * acconfig.h, include/net-snmp/net-snmp-config.h.in:
+
+   create a define location for HAVE_GETDEVS
+   
+2002-05-15 17:16  hardaker
+
+   * agent/Makefile.depend, agent/helpers/Makefile.depend,
+   agent/mibgroup/Makefile.depend, apps/Makefile.depend,
+   apps/snmpnetstat/Makefile.depend, snmplib/Makefile.depend
+:
+
+   depend update, which I meant to check in before the 5.0.1 release
+   
+2002-05-15 05:53  jbpn
+
+   * agent/: agent_index.c, agent_read_config.c,
+   agent_registry.c, auto_nlist.c, kernel.c,
+   snmp_agent.c, snmp_perl.c, snmp_vars.c, snmpd.c
+:
+
+     - use new netsnmp_ds_blah functions and constants
+   
+2002-05-15 05:39  jbpn
+
+   * apps/notification_log.c, apps/notification_log.h,
+   apps/snmpbulkwalk.c, apps/snmpdelta.c, apps/snmpget.c
+, apps/snmpgetnext.c, apps/snmpstatus.c,
+   apps/snmptable.c, apps/snmptranslate.c, apps/snmptrap.c
+, apps/snmptrapd.c, apps/snmpusm.c,
+   apps/snmpwalk.c, apps/snmpnetstat/main.c,
+   agent/mibgroup/agentx/agentx_config.c,
+   agent/mibgroup/agentx/master.c,
+   agent/mibgroup/agentx/subagent.c,
+   agent/mibgroup/disman/mteTriggerTable.c,
+   agent/mibgroup/mibII/snmp_mib.c,
+   agent/mibgroup/mibII/sysORTable.c,
+   agent/mibgroup/mibII/system_mib.c, agent/mibgroup/smux/smux.c
+, agent/mibgroup/tunnel/tunnel.c:
+
+     - use new netsnmp_ds_blah functions and constants
+   
+2002-05-15 05:37  jbpn
+
+   * snmplib/: default_store.c, mib.c, parse.c,
+   read_config.c, snmpUDPDomain.c, snmpUDPIPv6Domain.c
+, snmp_alarm.c, snmp_api.c, snmp_logging.c,
+   snmp_parse_args.c, snmp_secmod.c, snmpusm.c,
+   snmpv3.c, ucd_compat.c, vacm.c:
+
+     - rename functions and constants from default_store from ds_blah
+       to netsnmp_ds_blah
+   
+2002-05-15 02:02  jbpn
+
+   * agent/mibgroup/smux/: smux.c (V4-2-patches.0), smux.c:
+
+     - initialise smux_listen_sd to avoid problems noted in bug #545448
+       (a bit unreasonable in my view but it can't do any harm).
+   
+2002-05-14 12:40  rstory
+
+   * agent/helpers/table_array.c:
+
+   precision extraction of tumor instead of amputation, or, ifdef search.h
+   functions that aren't essential to table_array operation and will probably
+   vanish in the near future anyway.
+   
+2002-05-13 20:16  rstory
+
+   * agent/object_monitor.c:
+
+   fix type in sizeof
+   
+2002-05-13 13:04  hardaker
+
+   * configure, configure.in, agent/helpers/table_array.c
+, include/net-snmp/net-snmp-config.h.in:
+
+   Check for search.h before compiling the table_array helper
+   
+2002-05-13 08:00  hardaker
+
+   * agent/helpers/old_api.c:
+
+   remove C++ comments
+   
+2002-05-13 00:39  driehuis
+
+   * ChangeLog:
+
+   Note changes to configure.in.
+   
+2002-05-12 10:30  driehuis
+
+   * configure.in:
+
+   Make sure the checks for kvm related stuff happens when -lkvm is in scope.
+   Add detection of the -ldevstat requirement when building with ucd-snmp/diskio.
+   
+
+	
+-------------------------------------------------------------------------------
+
+Changes: V5.0 -> V5.0.1
+
+20020-05-12 17:30  driehuis
+
+   * configure.in:
+
+   detect -ldevstat when needed; fix -lkvm detection
+
+2002-05-10 17:09  hardaker
+
+   * FAQ, NEWS, README, README.agentx:
+
+   mention tutorial-5 instead of tutorial
+   
+2002-05-10 17:04  hardaker
+
+   * perl/agent/: Makefile.PL, agent.pm,
+   netsnmp_request_info.pm:
+
+   request info perl code moved to separate file.
+   
+2002-05-10 17:01  hardaker
+
+   * perl/OID/OID.pm:
+
+   documentation for the OID building overloads.
+   
+2002-05-10 16:55  hardaker
+
+   * apps/snmpvacm.c:
+
+   Add proper length segment to the build view OID.
+   
+2002-05-10 14:41  hardaker
+
+   * snmplib/mib.c:
+
+   new doc patch from Axel Kittenberg
+   
+2002-05-10 14:04  hardaker
+
+   * agent/mibgroup/mibII/: vacm_vars.c (V4-2-patches.0), vacm_vars.c
+:
+
+   fix vacm problem on sets with OIDs containing large numbers as noted
+   by Vinay Gaonkar on the -coders mailing list.
+   
+2002-05-10 13:46  hardaker
+
+   * local/mib2c:
+
+   fix calling on multiple tables
+   
+2002-05-10 03:23  dts12
+
+   * snmplib/mib.c:
+
+   Merge "STRING: Hex:" type tokens into a single token "Hex-STRING:"
+   
+2002-05-10 03:12  dts12
+
+   * agent/helpers/instance.c:
+
+   Report non-exitent subinstances as 'noSuchInstance' rather than 'noSuchObject'.
+   "snmpget .... .1.3.6.1.6.3.12.1.5.0.99" now responds correctly.
+   (though "snmpget .... .1.3.6.1.6.3.12.1.5.1" still returns 'noSuchObject')
+   
+   Also guess that failed SET requests are 'noCreation' errors (which is
+   probably the most likely option).
+   
+2002-05-09 15:54  hardaker
+
+   * Makefile.rules:
+
+   exit properly when a subdir fails to make properly
+   
+2002-05-09 15:30  hardaker
+
+   * snmplib/mib.c:
+
+   create a token for the -Ov equivelant
+   
+2002-05-09 09:12  hardaker
+
+   * agent/mibgroup/ucd-snmp/: memory_solaris2.c (V4-2-patches.5),
+   memory_solaris2.c:
+
+   patch from Takumi Kadode to fix memory usage on solaris
+   
+2002-05-09 08:54  hardaker
+
+   * agent/mibgroup/ucd-snmp/vmstat.c:
+
+   updates from malloced vmstat fixes from patches branch
+   
+2002-05-08 16:34  hardaker
+
+   * net-snmp-config.in:
+
+   new --compile-subagent features:
+     --cflags
+     --norm
+     --ldflags
+     includes header files
+     misc other bug fixes.
+   
+2002-05-08 13:13  hardaker
+
+   * agent/mibgroup/agentx/subagent.c:
+
+   make the subagent properly call the reserve2 state again.
+   
+2002-05-08 10:02  hardaker
+
+   * agent/mibgroup/examples/notification.c:
+
+   run indent
+   
+2002-05-08 09:01  hardaker
+
+   * agent/mibgroup/examples/notification.c:
+
+   um, use 30 seconds like advertised.
+   
+2002-05-08 08:59  hardaker
+
+   * agent/mibgroup/examples/notification.c,
+   agent/mibgroup/examples/notification.h,
+   mibs/NET-SNMP-EXAMPLES-MIB.txt:
+
+   define a better notification example (no requests.  just alarm -> send)
+   
+2002-05-07 22:45  hardaker
+
+   * local/mib2c:
+
+   update to current indent command
+   
+2002-05-07 22:44  hardaker
+
+   * local/mib2c.create-dataset.conf:
+
+   move text in comment left slight (was too long).
+   
+2002-05-07 22:43  hardaker
+
+   * local/mib2c:
+
+   enum fixes.
+   
+2002-05-07 22:42  hardaker
+
+   * local/: Makefile.in, mib2c.column_defines.conf,
+   mib2c.column_enums.conf, mib2c.conf:
+
+   New mib2c files for generating headers full of column number defines
+   and enum defines.
+   
+2002-05-07 22:40  hardaker
+
+   * net-snmp-config.in:
+
+   - --compile-subagent agent library reordering so it actually works.
+   - --compile-subagent now supports .o files (precompiled code).
+   
+2002-05-07 22:31  hardaker
+
+   * acconfig.h, configure:
+
+   hmm.  missed some checkin files.
+   
+2002-05-07 11:15  hardaker
+
+   * perl/SNMP/t/: conftest.conf, startagent.pl, conf.t
+:
+
+   test for configuration file/default_store support
+   
+2002-05-07 11:14  hardaker
+
+   * perl/SNMP/: SNMP.pm, SNMP.xs:
+
+   make init_snmp() take a char * argument like the real API
+   
+2002-05-07 11:00  hardaker
+
+   * agent/helpers/instance.c:
+
+   typos.
+   
+2002-05-07 09:41  hardaker
+
+   * local/snmpconf:
+
+   fix the -g flag.
+   
+2002-05-07 09:16  hardaker
+
+   * agent/helpers/instance.c:
+
+   call netsnmp_set_request_error like a good boy.
+   
+2002-05-06 20:43  rstory
+
+   * mibs/Makefile.mib:
+
+   fix missing $ noted by John Mills on the coders list
+   
+2002-05-06 16:12  hardaker
+
+   * configure, config.h.in, configure.in, snmplib/snmp_api.c
+   (V4-2-patches.[4,2,3,3]), configure, configure.in,
+   include/net-snmp/net-snmp-config.h.in,
+   snmplib/snmpTCPDomain.c, snmplib/snmpTCPIPv6Domain.c,
+   snmplib/snmpUDPDomain.c, snmplib/snmpUDPIPv6Domain.c,
+   snmplib/snmpUnixDomain.c:
+
+   use size_t when socklen_t is not available (correctly done this time)
+   
+2002-05-06 15:59  hardaker
+
+   * snmplib/: snmpTCPDomain.c, snmpTCPIPv6Domain.c,
+   snmpUDPDomain.c, snmpUDPIPv6Domain.c, snmpUnixDomain.c
+:
+
+   use size_t when socklen_t is not available
+   
+2002-05-06 15:49  hardaker
+
+   * configure, acconfig.h, config.h.in, configure.in
+   (V4-2-patches.[3,7,1,2]), acconfig.h, configure,
+   configure.in, include/net-snmp/net-snmp-config.h.in:
+
+   use size_t when socklen_t is not available
+   
+2002-05-06 15:11  hardaker
+
+   * agent/mibgroup/ucd-snmp/: memory_hpux.c, memory_hpux.h
+, vmstat_hpux.c, vmstat_hpux.h:
+
+   run indent
+   
+2002-05-06 15:10  hardaker
+
+   * agent/mibgroup/ucd-snmp/: memory_hpux.c, memory_hpux.h
+, vmstat_hpux.c, vmstat_hpux.h:
+
+   Patches #551914+ from Gary Edwards to support hpux11 for memory and vmstat modules
+   
+2002-05-06 15:07  hardaker
+
+   * agent/mibgroup/ucd_snmp.h:
+
+   add new hpux modules
+   
+2002-05-06 14:34  hardaker
+
+   * README:
+
+   new contributors.
+   
+2002-05-06 14:32  hardaker
+
+   * include/net-snmp/library/default_store.h, man/snmpcmd.1.def
+, snmplib/mib.c:
+
+   Patch #551489: From Jeffrey Watson to add a -Q option for quick but w/ an '='
+   
+2002-05-06 14:28  hardaker
+
+   * man/snmpd.1.def:
+
+   change -D documentation to reflect current code.
+   
+2002-05-06 14:27  hardaker
+
+   * agent/agent_handler.c:
+
+   misc small bugs and error message wording fixes.
+   
+2002-05-06 09:37  hardaker
+
+   * agent/mibgroup/smux/: smux.c (V4-2-patches.9), smux.c:
+
+   bug #547010: fix smux auth bug as reported and fixed by Stefan Radman
+   
+2002-05-01 23:01  rstory
+
+   * local/mib2c.array-user.conf:
+
+   tweaks for update to table_array
+   
+2002-05-01 23:00  rstory
+
+   * agent/Makefile.in:
+
+   add object_monitor stuff
+   
+2002-05-01 22:46  rstory
+
+   * snmplib/Makefile.in:
+
+   add check_varbind stuff
+   
+2002-05-01 22:45  rstory
+
+   * include/net-snmp/library/check_varbind.h,
+   snmplib/check_varbind.c:
+
+   convenience functions for validation vabrind info
+   
+2002-05-01 22:43  rstory
+
+   * agent/helpers/table_array.c,
+   include/net-snmp/agent/table_array.h:
+
+   do I really have to do this? sigh. Ok, rename debug token; revamp logic to
+   modify rows in place, keeping undo info (vs always changing a copy of a row
+   and swapping rows when set completed successfully) to allow external code
+   to keep pointers that don't disappear on them; add a few callbacks, including
+   row_compare, so table_array can maintain the secondary index tree; don't call
+   can_activate/can_delete unless we are actually trying to activate/delete row;
+   add skeleton (ifdef'd out) code for cooperative notifications of row events;
+   update changing array in commit & undo cases, not just commit; change typdefs
+   for a few callback pointers; ummmm... I *think* that's it....:-)
+   
+2002-05-01 17:30  hardaker
+
+   * perl/OID/: OID.pm, OID.xs, test.pl:
+
+   Add index building to the + operator.
+   
+2002-05-01 09:52  hardaker
+
+   * perl/: OID/OID.pm, OID/OID.xs, agent/Makefile.PL
+, agent/agent.pm, agent/agent.xs, agent/test.pl
+, agent/typemap:
+
+   Make getOID for requests returned a NetSNMP::OID blessed reference.
+   I'm not happy about how this is done, but all attempts to do it
+   correctly only left me in confusion.
+   
+2002-05-01 09:31  hardaker
+
+   * agent/mibgroup/mibII/vacm_vars.c,
+   include/net-snmp/library/snmpAAL5PVCDomain.h,
+   include/net-snmp/library/snmpTCPIPv6Domain.h,
+   include/net-snmp/library/snmpUDPIPv6Domain.h,
+   include/net-snmp/library/snmpUnixDomain.h,
+   snmplib/snmpAAL5PVCDomain.c, snmplib/snmpTCPIPv6Domain.c
+, snmplib/snmpUDPIPv6Domain.c, snmplib/snmpUnixDomain.c
+:
+
+   Change the domain OIDs to point to the net-snmp domains created by Dave.
+   This fixes bug #544245 as well.
+   
+2002-05-01 09:30  hardaker
+
+   * Makefile.in:
+
+   Add the OID perl module to the list of modules.
+   
+2002-05-01 07:45  hardaker
+
+   * mibs/: UCD-SNMP-MIB.txt (V4-2-patches.0), UCD-SNMP-MIB.txt:
+
+   remove old (and conflicting with traps) transport domain OIDs
+   
+2002-05-01 06:19  dts12
+
+   * man/: snmpbulkget.1.def, snmpbulkwalk.1.def,
+   snmpcmd.1.def, snmpdelta.1, snmpget.1.def,
+   snmpset.1.def, snmpstatus.1.def, snmptest.1.def,
+   snmpwalk.1.def:
+
+   Add type tags "STRING: " and "INTEGER: " to example output.
+   Add explicit setting of protocol version to example commands.
+   
+2002-05-01 03:34  jbpn
+
+   * agent/mibgroup/Rmon/: agutil.c, agutil.h,
+   agutil_api.h, alarm.c, alarm.h, event.c,
+   event.h, history.c, history.h, row_api.h,
+   rows.c, rows.h, statistics.c, statistics.h:
+
+     - remove CVS Log: entries which are causing problems since they are
+       embedded in a comment, but some of the log entries contain comment
+       delimiters.
+   
+2002-04-30 22:15  rstory
+
+   * agent/snmpd.c:
+
+   remove netsnmp_processing_set, it lives in snmp_agent.c
+   
+2002-04-30 22:13  rstory
+
+   * include/net-snmp/library/snmp-tc.h, snmplib/snmp-tc.c
+:
+
+   remove unused parameter; allow NONE as old value for storage type transtions
+   
+2002-04-30 22:12  rstory
+
+   * include/net-snmp/agent/table.h:
+
+   remove overly complex macro stuff for rowstatus/storagetype
+   
+2002-04-30 09:28  hardaker
+
+   * perl/OID/: Makefile.PL, OID.pm, OID.xs, README
+, test.pl:
+
+   - allow conversions to an array (needs to be tied still).
+   - documentation.
+   
+2002-04-30 08:15  jbpn
+
+   * agent/: snmpd.c (V4-2-patches.3), snmpd.c:
+
+     - fix bug #545775, reported by Dave Denson, whereby the PID of an
+       already-running snmpd would be overwritten by starting a new snmpd
+       (which would then exit, leaving the original snmpd running and the
+       wrong PID in the file).  Solution is not to write the PID until we
+       have successfully opened all our sockets.
+   
+2002-04-30 07:23  hardaker
+
+   * perl/OID/: .cvsignore, Changes, MANIFEST,
+   Makefile.PL, OID.pm, OID.xs, README,
+   test.pl, typemap:
+
+   OID perl module so you can do simple OID manipulations within perl easily:
+     - Example:  new NetSNMP::OID('interfaces') > new NetSNMP::OID('system')
+   
+2002-04-29 16:52  hardaker
+
+   * agent/mibgroup/versiontag:
+
+   regexp fix for white space checks in indent formatted code
+   
+2002-04-29 16:47  hardaker
+
+   * Makefile.in:
+
+   reorder perl module names to reflect (new) dependencies.
+   
+2002-04-29 09:42  hardaker
+
+   * perl/SNMP/t/mib.t:
+
+   fix a few warnings on failed tests (just screen cleanups)
+   
+2002-04-29 09:41  hardaker
+
+   * perl/SNMP/: Makefile.PL, SNMP.pm:
+
+   Make the perl module respect snmp.conf settings (finally).
+     - Now requires a dependency on the NetSNMP::default_store module though.
+   
+2002-04-27 08:19  rstory
+
+   * agent/snmp_agent.c:
+
+   don't process set request till delegated requests are complete, and queue
+   any other received packets until a set has completed processing.
+   
+2002-04-27 08:10  rstory
+
+   * snmplib/snmp_api.c:
+
+   clean up comments munged by indent
+   
+2002-04-27 08:08  rstory
+
+   * agent/mibgroup/agentx/subagent.h:
+
+   add missing prototype to fix compiler warning
+   
+2002-04-27 08:07  rstory
+
+   * agent/: object_monitor.c, helpers/table.c,
+   helpers/table_array.c:
+
+   ifdef gymnastics to make sure asserts are only compiled in only if explicity
+   requested
+   
+2002-04-26 21:26  rstory
+
+   * agent/mibgroup/host/hr_storage.c:
+
+   fix unbalanced endif on linux. hope I didn't break anything else.
+   
+2002-04-26 19:14  rstory
+
+   * agent/snmpd.c:
+
+   fix unused var warning for !windows
+   
+2002-04-26 14:33  hardaker
+
+   * agent/mibgroup/Rmon/event.c,
+   include/net-snmp/library/asn1.h:
+
+   fix OID_LENGTH definitions
+   
+2002-04-26 10:53  hardaker
+
+   * Makefile.in, perl/ASN/Makefile.PL,
+   perl/agent/Makefile.PL, perl/agent/default_store/Makefile.PL:
+
+   fix --with-perl-modules in makefiles.  Make everything use
+   net-snmp-config, ...
+   
+2002-04-26 10:27  hardaker
+
+   * perl/SNMP/: Makefile.PL, README, SNMP.pm:
+
+   - Cleanup.
+   - Make buildable from within the source.
+   - Change documentation references for ucd-snmp
+   - Change contact location to net-snmp-users (per Joe's agreement)
+   
+2002-04-26 10:19  hardaker
+
+   * perl/default_store/: MANIFEST, Makefile.PL, README, 
+	default_store.pm, test.pl:
+
+   - cleanup.
+   - Use net-snmp-config to find library, etc.
+   - Make buildable from within the source.
+   - a few more tests added
+   - use correct libraries
+   - add documentation
+   
+2002-04-26 04:22  dts12
+
+   * configure, configure.in:
+
+   Extracting the version from 'snmplib/snmp_version.c' needs to take account
+   of blank space.  Reported by Stefan Radman (Bug #547379)
+   
+2002-04-26 04:11  dts12
+
+   * agent/mibgroup/ucd-snmp/: memory.c (V4-2-patches.8), memory.c
+:
+
+   Handle memory values > 32bit (latching at 2^32-1)
+   Patch #548663 from Rob Myers
+   
+2002-04-26 03:55  dts12
+
+   * agent/snmpd.c:
+
+   Remove redundant 'Invalid option' message, since this is typically
+   reported by getopt().  (Suggested by Andrew Rucker Jones - patch #548748 )
+   
+2002-04-26 03:51  dts12
+
+   * agent/snmpd.c:
+
+   Add 'v' to the list of valid options (patch #548748)
+   Thanks to Andrew Rucker Jones.
+   
+2002-04-26 03:36  dts12
+
+   * README.hpux11, agent/mibgroup/host/hr_storage.c,
+   agent/mibgroup/host/hr_system.c,
+   agent/mibgroup/mibII/var_route.c,
+   include/net-snmp/system/hpux.h,
+   agent/mibgroup/ucd-snmp/loadave.c,
+   agent/mibgroup/ucd-snmp/memory.c,
+   agent/mibgroup/ucd-snmp/memory.h:
+
+   Apply Johannes Schmidt-Fischer's improved HP-UX 11 patch
+   (#530724) to the main v5 line, as well as the v4-2 branch.
+   The code now compiles cleanly under HP-UX 11 using gcc.
+   
+2002-04-25 07:19  hardaker
+
+   * README, include/net-snmp/library/vacm.h,
+   snmplib/vacm.c:
+
+   Patch from Axel Kittenberg to fix possible variable name clash
+   
+2002-04-24 22:39  rstory
+
+   * agent/object_monitor.c:
+
+   handle callbacks sending new notifications (while processing notifications)
+   
+2002-04-24 21:35  rstory
+
+   * include/net-snmp/agent/object_monitor.h:
+
+   header for new fucntions for monitoring objects
+   
+2002-04-24 21:34  rstory
+
+   * agent/object_monitor.c:
+
+   new functions for monitoring object values
+   
+2002-04-24 15:02  hardaker
+
+   * agent/mibgroup/ucd-snmp/vmstat.c:
+
+   /proc/stat can be larger than 1024
+   
+2002-04-24 06:19  dts12
+
+   * snmplib/Makefile.in:
+
+   Install the missing 'md5.h' header file.
+   
+2002-04-23 09:43  rstory
+
+   * agent/helpers/: table.c, table_array.c:
+
+   remove last of the #warnings, add xxx-rks if necessary
+   
+2002-04-23 07:53  hardaker
+
+   * agent/helpers/table_array.c:
+
+   remove warnings
+   
+2002-04-22 19:11  rstory
+
+   * agent/mibgroup/ipfwchains/README:
+
+   update URL to use freenmp.com mirror (unless someone knows a better place?)
+   
+2002-04-22 14:10  rstory
+
+   * snmplib/mib.c:
+
+   apply documentatin patch from Axel Kittenberger <Axel.Kittenberger@maxxio.com>
+   
+2002-04-22 13:50  rstory
+
+   * local/mib2c.array-user.conf:
+
+   remove extra @end@ (sure would be nice if mib2c would check for unbalanced
+   @end@s)
+   
+2002-04-22 09:48  rstory
+
+   * snmplib/oid_array.c:
+
+   update function names to match header (no mixed case)
+   
+2002-04-22 08:11  hardaker
+
+   * include/net-snmp/library/snmp_debug.h:
+
+   fix bug #547110: properly spell define
+   
+2002-04-21 16:44  hardaker
+
+   * agent/mibgroup/mibII/sysORTable.c:
+
+   add static to a returned variable
+   
+2002-04-21 16:42  hardaker
+
+   * configure, configure.in:
+
+   fix --with-perl-modules
+   
+2002-04-21 11:37  rstory
+
+   * snmplib/snmp_version.c:
+
+   5.0.pre3 -> 5.0; (I'm sure there are other places this needs to change,
+   but I wanted to get the first post 5.0 checkin...:-)
+   
+2002-04-20 00:37  hardaker
+
+   * FAQ, sedscript.in, perl/SNMP/SNMP.pm:
+
+   - (snmplib/snmp_version.c sedscript.in): version tag ( 5.0 )
+	
+-------------------------------------------------------------------------------
+
+Changes: V4.2 -> V5.0
+
+2002-04-20 00:27  hardaker
+
+   * everything:
+
+   set all CVS/RCS revision control numbers to 5.0
+	
+2002-04-20 00:07  hardaker
+
+   * everything:
+	
+   White space, oh glorious white space.
+   How great our though?
+   The code is fine.
+   We agree on functionality easily.
+   What really troubles us?
+   Something we can't see.
+   Something between the code.
+   We bow down to your magnificence,
+   For you are everywhere,
+   Between everything.
+   Pretty nothingness you are.
+	
+2002-04-20 00:01  hardaker
+
+   * configure , configure.in:
+
+   turn on ucd compat by default.
+   
+2002-04-20 00:00  hardaker
+
+   * NEWS:
+
+   last updates
+   
+2002-04-19 23:33  hardaker
+
+   * agent/mibgroup/testdelayed.h:
+
+   remove testdelayed
+   
+2002-04-19 23:18  hardaker
+
+   * agent/mibgroup/utilities/: .cvsignore , .cvsignore:
+
+   cvs ignore file
+   
+2002-04-19 23:17  hardaker
+
+   * agent/snmp_perl.c:
+
+   don't die if perl doesn't init.
+   
+2002-04-19 23:03  hardaker
+
+   * perl/SNMP/: README , README , SNMP.pm:
+
+   change warning.
+   
+2002-04-19 22:29  hardaker
+
+   * agent/snmp_agent.c:
+
+   double check that multiple inserts into the delegated chain don't
+   happen (read: they shouldn't anyway, but.....).
+   
+2002-04-19 22:29  hardaker
+
+   * CodingStyle:
+
+   typedef update
+   
+2002-04-19 22:16  hardaker
+
+   * snmplib/snmpCallbackDomain.c:
+
+   Fix the callback build hook to turn off the expect response flag when
+   not appropriate.
+   
+2002-04-19 19:09  rstory
+
+   * include/net-snmp/library/oid_array.h:
+
+   spelling misteak; remove capital letters in function names
+   
+2002-04-19 19:08  rstory
+
+   * agent/helpers/table_array.c:
+
+   update for function name changed in oid_array.h
+   
+2002-04-19 18:20  hardaker
+
+   * agent/snmp_perl.c:
+
+   make the perlInitFile and disablePerl tokens register as premib such
+   that when passed as a --FLAG it'll actually do the right thing and
+   disable the later "perl" token handlers.
+   
+2002-04-19 17:29  hardaker
+
+   * Makefile.in , man/Makefile.in , man/netsnmp_agent.3
+   , man/netsnmp_bulk_to_next.3 , man/netsnmp_debug.3 ,
+   man/netsnmp_example_scalar_int.3 , man/netsnmp_handler.3
+   , man/netsnmp_instance.3 ,
+   man/netsnmp_mib_handler_methods.3 , man/netsnmp_multiplexer.3
+   , man/netsnmp_old_api.3 , man/netsnmp_read_only.3 ,
+   man/netsnmp_serialize.3 , man/netsnmp_table.3 ,
+   man/netsnmp_table_array.3 , man/netsnmp_table_data.3 ,
+   man/netsnmp_table_dataset.3 , man/netsnmp_table_iterator.3
+   , man/netsnmp_todo.3:
+
+   documentation.  Can't get enough.
+     - make docs now installs man pages into the man dir, which are then installed.
+   
+2002-04-19 17:14  hardaker
+
+   * testing/tests/: T111agentxset , T121proxyset:
+
+   Correct for new STRING prefix.
+   
+2002-04-19 17:03  hardaker
+
+   * README:
+
+   Add Katsuhisa ABE
+   
+2002-04-19 17:03  hardaker
+
+   * perl/: ASN/ASN.xs , default_store/default_store.xs:
+
+   fix header files for new paths.
+   
+2002-04-19 17:00  hardaker
+
+   * agent/snmp_vars.c , agent/mibgroup/mibII/vacm_vars.c
+   , include/net-snmp/library/snmpUDPIPv6Domain.h ,
+   man/snmpd.conf.5.def , snmplib/snmpUDPIPv6Domain.c:
+
+   Apply patch #532555: ipv6 com2sec support, thanks to Katsuhisa ABE.
+   
+2002-04-19 16:19  hardaker
+
+   * agent/agent_trap.c , agent/snmp_agent.c ,
+   agent/mibgroup/mibII/sysORTable.c ,
+   agent/mibgroup/mibII/system_mib.c ,
+   include/net-snmp/agent/snmp_agent.h ,
+   include/net-snmp/library/tools.h , snmplib/tools.c:
+
+   fix sysUpTime (and related functions) to handle much larger upTime
+   values (ie, fix signed integer wrapping).
+   
+2002-04-19 11:37  hardaker
+
+   * man/snmpd.conf.5.def:
+
+   document embedded perl support.
+   
+2002-04-19 11:34  hardaker
+
+   * configure , configure.in , agent/Makefile.in
+   , agent/snmp_perl.c , agent/snmp_perl.pl ,
+   include/net-snmp/agent/ds_agent.h , perl/agent/Makefile.PL:
+
+   Add some new snmpd.conf tokens for controlling perl better.
+   Fix embedded perl support so it actually works.
+   
+2002-04-19 11:32  hardaker
+
+   * perl/agent/default_store/: .cvsignore , Makefile.PL ,
+   default_store.pm , default_store.xs:
+
+   Added missing agent default_store stuff.  (they existed on my machine,
+   I don't know why everyone else was having problems)
+   
+2002-04-19 10:30  hardaker
+
+   * agent/helpers/table_iterator.c:
+
+   Protect against things that should never ever happen
+   
+2002-04-19 03:10  dts12
+
+   * Makefile.in:
+
+   <Sigh> A little learning is a dangerous thing.
+   Apply the rest of the patch from Axel - sorry.
+   
+2002-04-19 01:49  dts12
+
+   * Makefile.in , doxygen.conf:
+
+   Handle generating documenation when srcdir != configdir
+   (Patch supplied by Axel Kittenberger)
+   
+2002-04-18 17:38  hardaker
+
+   * snmplib/snmpIPXDomain.c:
+
+   fix snmpIPXDomain (again)
+   
+2002-04-18 17:31  hardaker
+
+   * agent/mibgroup/agentx/subagent.c:
+
+   Patch from Vishal Verma: only open subagent connections once at startup
+   
+2002-04-18 17:28  hardaker
+
+   * agent/agent_registry.c:
+
+   Patch from Vishal Verma: for down subagent cases, mark registrations as detached
+   
+2002-04-18 17:17  hardaker
+
+   * snmplib/snmp_api.c:
+
+   define a maximum packet size we can accept to protect certain error
+   conditions (-1 after conversion is now too large).
+   
+2002-04-18 16:28  hardaker
+
+   * acconfig.h:
+
+   change the enterprise OIDs in the proper place (net-snmp-config.h.in
+   is generated from this file).
+   
+2002-04-18 13:51  hardaker
+
+   * configure , configure.in , net-snmp-config.in:
+
+   - Add two new options to net-snmp-config as requested on the IRC channel.
+     --configure-options
+     --snmpd-module-list
+   
+2002-04-18 11:43  rstory
+
+   * mibs/NET-SNMP-AGENT-MIB.txt:
+
+   add missing comma
+   
+2002-04-18 07:39  dts12
+
+   * configure , configure.in:
+
+   Calculate the length of supplied enterprise OIDs correctly
+   (and use a more meaningful output message)
+   
+   Shame these settings aren't cached for later re-use....
+   
+2002-04-18 07:18  dts12
+
+   * agent/snmpd.c:
+
+   Notify on agent reconfiguration.
+   
+2002-04-18 07:16  dts12
+
+   * include/net-snmp/net-snmp-config.h.in:
+
+   Use the Net-SNMP notifications by default, rather than the ucdavis ones.
+   
+2002-04-18 07:08  dts12
+
+   * mibs/NET-SNMP-AGENT-MIB.txt:
+
+   Fix the table-of-contents sequence for the nsModuleTable, add notification
+   definitions for the agent, and define groups for everything.
+   
+2002-04-18 02:52  dts12
+
+   * snmplib/mib.c:
+
+   Bring integer and string output formats into line with the other types
+   by printing a type token before the value (unless supressed by 'quick print')
+   Thanks to Erik for the patch
+   
+2002-04-18 01:46  dts12
+
+   * FAQ:
+
+   Replace the dlmod 'WHERE' with something more meaningful....
+   
+2002-04-17 12:12  hardaker
+
+   * snmplib/snmpIPXDomain.c:
+
+   define the ipxDomain variables
+   
+2002-04-17 12:12  hardaker
+
+   * agent/mibgroup/disman/mteTriggerTable.c:
+
+   Error condition tests
+   
+2002-04-17 10:10  hardaker
+
+   * agent/agent_registry.c , agent/snmp_agent.c ,
+   agent/mibgroup/agentx/master_admin.c ,
+   include/net-snmp/agent/agent_handler.h ,
+   include/net-snmp/agent/snmp_agent.h ,
+   include/net-snmp/agent/var_struct.h:
+
+   Oh, just a small patch to make it possible to make modules request
+   that all queries to a set of registrations get passed all at once
+   (which apparently is important for, oh, agentx)
+   
+2002-04-17 10:09  hardaker
+
+   * agent/mibgroup/agentx/master.c:
+
+   misc non-change clean ups
+   
+2002-04-17 10:03  hardaker
+
+   * include/net-snmp/agent/table.h:
+
+   rename structures beginning with _ to ending with _s
+   
+2002-04-17 10:02  hardaker
+
+   * include/net-snmp/library/snmp_api.h:
+
+   add a void * pointer for the session creator to use at will (different
+   from the callback magic).
+   
+2002-04-17 09:00  dts12
+
+   * configure , configure.in ,
+   include/net-snmp/net-snmp-config.h.in:
+
+   Use the Net-SNMP sysOIDs by default, rather than the ucdavis ones.
+   
+2002-04-17 08:26  dts12
+
+   * apps/snmpnetstat/Makefile.in:
+
+   Blank continuation lines confuse HP's version of make.
+   
+2002-04-17 08:16  dts12
+
+   * agent/Makefile.in:
+
+   Blank continuation lines confuse HP's version of make
+   
+2002-04-17 06:56  hardaker
+
+   * agent/mibgroup/agent/nsModuleTable.c ,
+   mibs/NET-SNMP-AGENT-MIB.txt:
+
+   move nsModuleTable into Dave's structure.
+   
+2002-04-17 06:54  hardaker
+
+   * include/net-snmp/library/: snmpAAL5PVCDomain.h ,
+   snmpTCPIPv6Domain.h , snmpUDPIPv6Domain.h:
+
+   fix declarations of Domain objects (const -> extern)
+   
+2002-04-17 06:31  hardaker
+
+   * local/snmpconf.dir/: snmp-data/snmpconf-config ,
+   snmpd-data/snmpconf-config , snmptrapd-data/snmpconf-config:
+
+   snmpconf configuration data
+   
+2002-04-17 03:01  dts12
+
+   * configure , configure.in:
+
+   Bring the reported default settings for sysoid & notification OIDs
+   back into line with what we actually use (i.e. the ucdavis OIDs).
+   
+   Qn:  Do we want to switch to using the net-snmp equivalent sysOIDs?
+   Qn:  What about defining net-snmp notifications?
+   
+2002-04-17 02:55  dts12
+
+   * configure , configure.in:
+
+   Fix --with-enterprise-sysoid and --with-enterprise-notification-oid,
+   and try to clarify that these are OIDs, while --with-enterprise-oid
+   is actually just the enterprise *number*
+   
+   Qn:  should we change the name of the configure option to reflect this?
+   
+2002-04-16 10:04  hardaker
+
+   * sedscript.in , snmplib/snmp_version.c , FAQ ,
+   perl/SNMP/SNMP.pm:
+
+   - (snmplib/snmp_version.c sedscript.in): version tag ( 5.0.pre3 )
+   
+2002-04-16 10:02  hardaker
+
+   * README:
+
+   delete top disclaimers
+   
+2002-04-16 10:02  hardaker
+
+   * NEWS:
+
+   misc updates
+   
+2002-04-16 10:01  hardaker
+
+   * perl/SNMP/SNMP.xs:
+
+   misc bug fixes
+   
+2002-04-16 08:19  dts12
+
+   * FAQ:
+
+   Add an entry concerning the 'libcrypto' RPM dependency.
+   
+2002-04-16 08:00  hardaker
+
+   * agent/mibgroup/agent/nsModuleTable.c:
+
+   fix memory leak
+   
+2002-04-16 07:13  hardaker
+
+   * agent/snmp_agent.c:
+
+   remove a no longer appropriate todo comment
+   
+2002-04-16 07:12  hardaker
+
+   * configure:
+
+   I guess I forgot to run autoconf
+   
+2002-04-15 08:58  hardaker
+
+   * local/: snmpconf , Makefile.in:
+
+   move snmpconf data directories to different names to avoid confusion
+   
+2002-04-15 08:36  hardaker
+
+   * local/snmpconf.dir/: snmp-data/authopts ,
+   snmp-data/debugging , snmp-data/mibs , snmp-data/output
+   , snmpd-data/acl , snmpd-data/basic_setup ,
+   snmpd-data/extending , snmpd-data/monitor ,
+   snmpd-data/operation , snmpd-data/system ,
+   snmpd-data/trapsinks , snmptrapd-data/formatting ,
+   snmptrapd-data/traphandle:
+
+   data file moving
+   
+2002-04-12 14:38  hardaker
+
+   * local/snmpconf:
+
+   Massive cleanup effort.  It should now respect ordering in the
+   snmpconf configuration files as well.
+   
+2002-04-12 13:00  rstory
+
+   * include/net-snmp/agent/agent_registry.h:
+
+   fix for overzealous perl script
+   
+2002-04-12 09:47  hardaker
+
+   * Makefile.in , configure , configure.in:
+
+   copy ucd persisent directory to net-snmp (prompts, flags and other fun)
+   
+2002-04-12 07:57  hardaker
+
+   * local/Makefile.in:
+
+   install traptoemail
+   
+2002-04-12 07:55  hardaker
+
+   * local/trapnotif:
+
+   remove trapnotif
+   
+2002-04-12 07:51  hardaker
+
+   * local/: Makefile.in , rsnmp:
+
+   remove rsnmp, which is very very old and out of date
+   
+2002-04-12 07:47  hardaker
+
+   * man/: .cvsignore , Makefile.in , mib2c.1.def:
+
+   A manual page for mib2c (help, I'm turning into Dave)
+   
+2002-04-12 07:28  hardaker
+
+   * dotgdbinit:
+
+   a gdb initialization file with helpful functions
+   
+2002-04-12 02:42  dts12
+
+   * local/Makefile.in:
+
+   Add 'snmpconf' and 'mib2c' to the list of scripts to install.
+   
+   I've left 'traptoemail' off this list, since it says it's not intended
+   as a directly user-invoked command, so probably ought not to be installed
+   into a binary directory.
+   
+2002-04-12 02:41  dts12
+
+   * local/rsnmp:
+
+   Fix the path of snmpwalk to be something more plausible.
+   (I'm not convinced about the validity of that initial 'rtopmib' OID mind!)
+   
+2002-04-12 02:36  dts12
+
+   * local/mib2c.conf:
+
+   Fix typo in reference to 'mib2c.iterate.conf'
+   
+2002-04-12 02:33  dts12
+
+   * Makefile.rules , snmplib/Makefile.in:
+
+   Install the main library as 'libsnmp' if configured using UCD compatibility.
+   This should handle the requirements of application compatibility.
+   Agent library compatibility is likely to prove a harder problem
+   (since there are now three libraries, not just two...)
+   
+2002-04-11 22:29  hardaker
+
+   * perl/SNMP/t/startagent.pl:
+
+   set SNMPCONFPATH iff [sic] not set
+   
+2002-04-11 22:27  hardaker
+
+   * perl/SNMP/SNMP.pm:
+
+   return from initMib before doing anything.
+   
+2002-04-11 22:26  hardaker
+
+   * perl/SNMP/Makefile.PL:
+
+   turn off complier warnings
+   
+2002-04-11 22:26  hardaker
+
+   * perl/AnyData_SNMP/snmpsh:
+
+   support "show columns from TABLE"
+   
+2002-04-11 22:25  hardaker
+
+   * mibs/NET-SNMP-EXAMPLES-MIB.txt:
+
+   Add a new demo scalar: the sleeper.  (dah dah dah dummmmm)
+   
+2002-04-11 22:25  hardaker
+
+   * agent/mibgroup/examples/scalar_int.c:
+
+   indent.
+   
+2002-04-11 22:25  hardaker
+
+   * agent/mibgroup/: examples.h , examples/delayed_instance.c
+   , examples/delayed_instance.h:
+
+   Add a delayed instance example, showing how to return mib request
+   results later rather than immediately.
+   
+2002-04-11 22:24  hardaker
+
+   * agent/mibgroup/testdelayed.c:
+
+   remove legacy example.
+   
+2002-04-11 22:23  hardaker
+
+   * agent/snmp_agent.c:
+
+   add comment about possibly fixing inclusive requests in the future.
+   
+2002-04-11 17:08  hardaker
+
+   * README.win32:
+
+   change modukes-> modules
+   
+2002-04-11 07:23  hardaker
+
+   * snmplib/snmp_logging.c:
+
+   turn off debugging when calling logging callbacks
+   
+2002-04-10 12:51  hardaker
+
+   * perl/SNMP/: SNMP.pm , SNMP.xs:
+
+   fix perl module in many many places.  most tests now pass.
+   
+2002-04-10 12:50  hardaker
+
+   * perl/SNMP/t/startagent.pl:
+
+   force setting to a "bogus" SNMPCONFPATH.
+   
+2002-04-10 12:48  hardaker
+
+   * include/net-snmp/library/mib.h , snmplib/mib.c:
+
+   Exporting functions good.  Internalizing bad.
+   
+2002-04-10 09:28  hardaker
+
+   * perl/SNMP/SNMP.xs:
+
+   opps.  sigh.
+   
+2002-04-10 09:27  hardaker
+
+   * perl/SNMP/SNMP.xs:
+
+   opps.  remove debugging statements.
+   
+2002-04-10 09:23  hardaker
+
+   * perl/SNMP/SNMP.xs:
+
+   - Make the perl module call init_snmp()
+     - this is a fairly major change, is it now will read .conf files.
+     - many people have asked for this.
+   - misc clean ups.
+   
+2002-04-10 09:18  dts12
+
+   * Makefile.rules:
+
+   Don't recurse into subdirectories for the consituent subtargets of "make install"
+   
+2002-04-10 09:09  hardaker
+
+   * NEWS:
+
+   added a few things, separated perl stuff into it's own section.
+   
+2002-04-10 08:46  dts12
+
+   * configure , configure.in:
+
+   Bring the help message for the UCD compatability option into line with
+   what's actually recognised.
+   
+2002-04-10 07:52  hardaker
+
+   * Makefile.top:
+
+   change libtool versioning to their recommended method of doing things
+   (which I hate, but is still better than what we were doing, I guess)
+   
+2002-04-10 07:10  dts12
+
+   * Makefile.rules:
+
+   Bring use of BUILTSUBDIR within 'installlocalheaders' into line
+   with the preceding comment, and actual usage.
+   (i.e. INSTALLBUILTSUBDIR rather than INCLUDEBUILTSUBDIR)
+   
+2002-04-10 05:58  dts12
+
+   * snmplib/Makefile.in:
+
+   Typo in security-include header destination directory variable
+   
+2002-04-10 05:55  dts12
+
+   * local/Makefile.in:
+
+   Ensure the destination directory exists before installing mib2c conf files.
+   
+2002-04-10 01:55  dts12
+
+   * testing/tests/: T004snmpv1nosuch , T019snmpv2cnosuch:
+
+   Two new tests to check handling of GETing non-existant instances
+   
+2002-04-10 01:54  dts12
+
+   * agent/snmp_agent.c:
+
+   A fix for SNMPv1 errors that doesn't end up breaking AgentX error handling.
+   
+2002-04-09 10:38  hardaker
+
+   * agent/snmp_agent.c:
+
+   Patch from Dave to fix v1 error results.
+   
+2002-04-08 21:08  rstory
+
+   * snmplib/oid_array.c:
+
+   fix incorrect length return value
+   
+2002-04-08 18:00  hardaker
+
+   * agent/mibgroup/mibII/: vacm_vars.c , vacm_vars.h:
+
+   don't allow no-configuration access anymore.
+   
+2002-04-08 17:59  hardaker
+
+   * include/net-snmp/library/transform_oids.h ,
+   snmplib/snmpAAL5PVCDomain.c , snmplib/snmpTCPIPv6Domain.c
+   , snmplib/snmpUDPIPv6Domain.c , snmplib/snmpusm.c:
+
+   more unconst correctness
+   
+2002-04-08 17:31  hardaker
+
+   * include/net-snmp/library/snmp_transport.h:
+
+   size_t externs for exported oids
+   
+2002-04-08 17:30  hardaker
+
+   * snmplib/snmp_api.c:
+
+   remove temporary debugging statements that accidentally became permanent.
+   
+2002-04-08 17:26  hardaker
+
+   * snmplib/: snmpUDPDomain.c , snmp_transport.c:
+
+   define length size_t's for oid variables.
+   
+2002-04-08 16:53  hardaker
+
+   * agent/mibgroup/utilities/override.c:
+
+   support "null" types.
+   
+2002-04-08 16:52  hardaker
+
+   * apps/snmptrapd.c:
+
+   initialize notification log mib support before -H usage.
+   
+2002-04-08 16:49  hardaker
+
+   * agent/helpers/serialize.c:
+
+   fix a few things and make subhandlers not able to tell there were more requests.
+   
+2002-04-08 16:43  hardaker
+
+   * INSTALL:
+
+   A co-worker pointed out that the INSTALL script still said to edit config.h
+   
+2002-04-08 15:13  hardaker
+
+   * include/net-snmp/library/snmpTCPDomain.h ,
+   include/net-snmp/library/snmpUnixDomain.h ,
+   include/net-snmp/library/snmp_transport.h ,
+   snmplib/snmpTCPDomain.c , snmplib/snmpUnixDomain.c ,
+   snmplib/snmp_transport.c:
+
+   unstatic-ize a few oids that should have been external
+   
+2002-04-08 14:23  hardaker
+
+   * snmplib/: snmpAAL5PVCDomain.c , snmpTCPDomain.c ,
+   snmpTCPIPv6Domain.c , snmpUDPIPv6Domain.c ,
+   snmpUnixDomain.c , snmp_api.c , snmp_transport.c
+   , snmpusm.c:
+
+   Change const oid declarations into static ones since shared libraries
+   have a problem with initializing them on linux systems at least.
+   
+2002-04-08 11:45  hardaker
+
+   * man/snmpd.conf.5.def:
+
+   minimal documentation for debugging and the injectHandler token
+   
+2002-04-05 14:32  hardaker
+
+   * man/: snmptrapd.8.def , snmptrapd.conf.5.def:
+
+   documentation for the NOTIFICATION-LOG-MIB support.
+   
+2002-04-05 14:09  hardaker
+
+   * man/snmpd.conf.5.def:
+
+   document context name support in proxy code.
+   
+2002-04-05 13:51  hardaker
+
+   * man/snmpd.conf.5.def:
+
+   document the disman event mib support for sending traps via monitored OIDs.
+   
+2002-04-05 10:12  hardaker
+
+   * man/snmpd.conf.5.def:
+
+   put trap config into its own section.
+   document the "override" token.
+   
+2002-04-05 06:39  hardaker
+
+   * README.snmpv3:
+
+   change default context to an empty string
+   
+2002-04-04 15:14  hardaker
+
+   * agent/: agent_registry.c (V4-2-patches.5), agent_registry.c:
+
+   deal with fd unregistrations properly.
+   
+2002-04-03 09:12  hardaker
+
+   * agent/helpers/table_dataset.c , agent/mibgroup/examples.h
+   , agent/mibgroup/testhandler.c ,
+   agent/mibgroup/examples/data_set.c ,
+   agent/mibgroup/examples/data_set.h ,
+   agent/mibgroup/examples/scalar_int.c ,
+   include/net-snmp/agent/table_dataset.h ,
+   mibs/NET-SNMP-EXAMPLES-MIB.txt:
+
+   Make an example dataset table to hold and store data in (admittedly
+   useless data from a network management point of view, but it's an example).
+   
+2002-04-02 22:12  hardaker
+
+   * man/Makefile.in:
+
+   fix installation from subdir build case.
+   
+2002-04-02 21:45  hardaker
+
+   * snmplib/Makefile.in:
+
+   install snmpv3-security-includes from from build dir.
+   
+2002-04-02 21:45  hardaker
+
+   * agent/Makefile.in:
+
+   install mib_module_config.h and mib_module_includes.h from build dir.
+   
+2002-04-02 21:43  hardaker
+
+   * Makefile.in:
+
+   install net-snmp-config.h from the build dir.
+   
+2002-04-02 21:43  hardaker
+
+   * Makefile.rules:
+
+   create some install from built header rules.
+   
+2002-04-02 17:27  hardaker
+
+   * local/: Makefile.in , mib2c.conf:
+
+   remove deleted array-auto from .conf install/reference lists
+   
+2002-04-02 15:03  hardaker
+
+   * agent/mibgroup/: ucd_snmp.h , ucd-snmp/registry.c ,
+   ucd-snmp/registry.h:
+
+   remove the registry module, as it's obsolete due to contexts.  Use the nsModuleTable instead
+   
+2002-04-02 14:57  hardaker
+
+   * agent/mibgroup/ucd-snmp/disk.c (V4-2-patches.7),
+   agent/mibgroup/ucd-snmp/disk.c ,
+   include/net-snmp/system/darwin.h:
+
+   Apply patch #524424 for darwin fixes for ucd-snmp/disk.c
+   
+2002-04-02 14:47  hardaker
+
+   * agent/mibgroup/: kernel_sunos5.c (V4-2-patches.8),
+   kernel_sunos5.c:
+
+   apply patch 527573 to fix 64 bit types on solaris
+   
+2002-04-02 07:04  hardaker
+
+   * snmplib/snmp_transport.c:
+
+   check char for NULL before setting to:
+   
+2002-04-01 22:28  hardaker
+
+   * snmplib/: snmp_api.c (V4-2-patches.9), cmu_compat.c ,
+   snmp_api.c:
+
+   Let init_snmp protect itself.
+   
+2002-03-29 15:04  rstory
+
+   * local/mib2c.array-user.conf:
+
+   tweaks & updates
+   
+2002-03-29 10:40  rstory
+
+   * snmplib/mib.c:
+
+   add comment
+   
+2002-03-29 08:36  hardaker
+
+   * local/mib2c.create-dataset.conf:
+
+   add a allow_creation definition.
+   
+2002-03-29 08:22  hardaker
+
+   * Makefile.in:
+
+   make net-snmp-config executable after it's built
+   
+2002-03-29 08:13  hardaker
+
+   * agent/mibgroup/mibII/: setSerialNo.c , setSerialNo.h:
+
+   opps.  forgot to check the setSerial code in
+   
+2002-03-28 23:48  hardaker
+
+   * agent/mibgroup/ucd-snmp/: pass.c (V4-2-patches.4), pass.c:
+
+   enable row creation for pass modules.  Patch #482005
+   
+2002-03-28 23:44  hardaker
+
+   * agent/mibgroup/mibII/: interfaces.c (V4-2-patches.2),
+   interfaces.c:
+
+   patch #517340: freebsd5 support
+   
+2002-03-28 23:38  hardaker
+
+   * agent/mibgroup/host/: hr_filesys.c (V4-2-patches.4), hr_filesys.c:
+
+   apply freebsd5 patch #517333
+   
+2002-03-28 23:32  hardaker
+
+   * agent/mibgroup/: host/hr_system.c , mibII/interfaces.c
+   , mibII/ipAddr.c:
+
+   Apply netbsd fix patch #529733
+   
+2002-03-28 23:01  hardaker
+
+   * snmplib/: snmp_api.c (V4-2-patches.8), snmp_api.c ,
+   snmp_api.c:
+
+   use a static variable for init checking.  Bug #536386.
+   
+2002-03-28 15:25  dts12
+
+   * man/: default_store.3.top , read_config.3.def ,
+   snmp_api.3.def:
+
+   Tweak to use the new include structure.
+   
+2002-03-28 15:23  dts12
+
+   * FAQ (V4-2-patches.8), FAQ:
+
+   Add a few new entries (mostly relating to traps)
+   
+2002-03-28 14:56  rstory
+
+   * agent/helpers/table_array.c:
+
+   rename/prefix functions; add doxygen documentation
+   
+2002-03-28 13:00  rstory
+
+   * doxygen.conf:
+
+   add define for excluding stuff (DOXYGEN_SHOULD_SKIP_THIS)
+   
+2002-03-28 12:50  hardaker
+
+   * agent/mibgroup/mibII.h:
+
+   add setSerialNo
+   
+2002-03-28 12:47  hardaker
+
+   * snmplib/ucd_compat.c:
+
+   fix a never-seen-but-very-old-bug using the wrong default_store token.
+   
+2002-03-28 12:46  hardaker
+
+   * snmplib/snmp_api.c:
+
+   only set the default output style if it's not already set to something.
+   
+2002-03-28 12:45  hardaker
+
+   * agent/agent_read_config.c:
+
+   wrapping.
+   
+2002-03-28 12:17  hardaker
+
+   * doxygen.conf:
+
+   change version number
+   
+2002-03-28 12:08  rstory
+
+   * apps/snmptranslate.c:
+
+   back out change from version 1.65 until better solution can be found;
+   bug #535029
+   
+2002-03-28 12:03  rstory
+
+   * agent/agent_registry.c:
+
+   return specific result code for registration failure if available.
+   
+2002-03-28 11:57  hardaker
+
+   * agent/: agent_registry.c , mibgroup/agentx/master_admin.c:
+
+   perl typo
+   
+2002-03-27 15:48  rstory
+
+   * local/mib2c.array-auto.conf:
+
+   delete old, unused conf file
+   
+2002-03-27 08:27  hardaker
+
+   * apps/: notification_log.c , notification_log.h ,
+   snmptrapd.c:
+
+   add "dontRetainLogs" token to snmptrapd.conf to not enable the
+   notification log mib.
+   
+2002-03-27 01:54  dts12
+
+   * configure.in, configure (V4-2-patches.[1,1]), configure ,
+   configure.in:
+
+   Use the correct name of the Windows IP Helper API library.
+   (Computers can be soooo picky!)
+   
+2002-03-26 23:23  hardaker
+
+   * agent/snmp_agent.c , agent/snmpd.c ,
+   agent/helpers/all_helpers.c , agent/helpers/bulk_to_next.c
+   , agent/helpers/debug_handler.c ,
+   agent/helpers/read_only.c , agent/mibgroup/agentx/master.c
+   , include/net-snmp/agent/bulk_to_next.h ,
+   include/net-snmp/agent/debug_handler.h ,
+   include/net-snmp/agent/read_only.h ,
+   include/net-snmp/agent/snmp_agent.h ,
+   include/net-snmp/agent/var_struct.h:
+
+   - Really fix the "undo failed" problem.  IE, not just any old error
+     will cause an undo failed message to get sent back.  Only varbinds
+     with an undo failed error code will cause an undo failed result.
+     undo failed results do still supersede all other error codes,
+     however, which is what the original problem was all about.  We still
+     have to depend on the modules returning the right error code (but
+     that's their fault if they don't).
+   - misc cleanups and renames
+   
+2002-03-26 23:20  hardaker
+
+   * README:
+
+   add Craig Setera
+   
+2002-03-26 14:07  rstory
+
+   * TODO:
+
+   add creating src rpm spec file
+   
+2002-03-26 08:29  hardaker
+
+   * agent/mibgroup/ucd-snmp/: diskio.c (V4-2-patches.2), diskio.c:
+
+   enable diskio on freebsd5.  Implements patch 517328 in a different way.
+   
+2002-03-26 07:58  hardaker
+
+   * mibs/Makefile.in:
+
+   fix for other-dir builds
+   
+2002-03-26 07:57  hardaker
+
+   * agent/agent_registry.c:
+
+   duplicate registration info in split_subtree
+   
+2002-03-26 07:43  dts12
+
+   * configure, configure.in (V4-2-patches.[0,0]), configure ,
+   configure.in:
+
+   Add /etc/filesystems to list of mount table files (for AIX)
+   Should fix bugs 232588 and (?)517113
+   
+2002-03-26 07:39  dts12
+
+   * configure, configure.in (V4-2-patches.[9,9]), configure ,
+   configure.in:
+
+   Remove trailing ':' from list of MIB module names in configure output,
+   to avoid confusion (see Bug #491129)
+   
+2002-03-26 06:41  dts12
+
+   * configure , configure.in:
+
+   Add '-lhlpapi' to the list of agent libraries, when running on Windows
+   (using Cygwin).  Should fix Bug #534409.
+   
+2002-03-25 22:33  rstory
+
+   * snmplib/: parse.c (V4-2-patches.3), parse.c:
+
+   fix bug#520478 showMibErrors token is inverted
+   
+2002-03-25 15:18  rstory
+
+   * include/net-snmp/version.h:
+
+   remove ^M characters
+   
+2002-03-25 14:53  hardaker
+
+   * agent/snmp_agent.c , include/net-snmp/agent/snmp_agent.h:
+
+   use emacs to fix perl search and replace errors, of course
+   
+2002-03-25 14:47  hardaker
+
+   * agent/agent_registry.c , agent/snmp_agent.c ,
+   agent/helpers/old_api.c , agent/helpers/table.c ,
+   agent/helpers/table_data.c , agent/helpers/table_dataset.c
+   , agent/mibgroup/testhandler.c ,
+   agent/mibgroup/agentx/master_admin.c ,
+   apps/notification_log.c ,
+   include/net-snmp/agent/agent_registry.h ,
+   include/net-snmp/agent/snmp_agent.h ,
+   include/net-snmp/agent/table.h ,
+   include/net-snmp/agent/table_data.h ,
+   include/net-snmp/agent/table_dataset.h ,
+   include/net-snmp/library/mib.h ,
+   local/mib2c.create-dataset.conf , snmplib/mib.c ,
+   snmplib/snmp_api.c:
+
+   use perl to search and replace perl search and replace errors, of course
+   
+2002-03-25 14:23  hardaker
+
+   * agent/mibgroup/smux/smux.c:
+
+   api changes
+   
+2002-03-25 08:43  dts12
+
+   * win32/: win32.opt , libsnmp_dll/libsnmp.def ,
+   snmpbulkget/snmpbulkget.dsp , snmpbulkwalk/snmpbulkwalk.dsp
+   , snmpd/snmpd.dsp , snmpdelta/snmpdelta.dsp ,
+   snmpdf/snmpdf.dsp , snmpget/snmpget.dsp ,
+   snmpgetnext/snmpgetnext.dsp , snmpnetstat/snmpnetstat.dsp
+   , snmpset/snmpset.dsp , snmpstatus/snmpstatus.dsp
+   , snmptable/snmptable.dsp , snmptest/snmptest.dsp
+   , snmptranslate/snmptranslate.dsp ,
+   snmptrap/snmptrap.dsp , snmptrapd/snmptrapd.dsp ,
+   snmpusm/snmpusm.dsp , snmpvacm/snmpvacm.dsp ,
+   snmpwalk/snmpwalk.dsp:
+
+   Remove redundant declarations of 'getopt.c' and 'snmp_parse_args.c' in
+   each individual application project.  These routines are included within
+   the libraries, so we might as well use those.
+   
+2002-03-25 05:53  dts12
+
+   * win32/: mib_module_inits.h , win32.opt ,
+   libsnmp_dll/libsnmp.def , libsnmp_dll/libsnmp_dll.dsp ,
+   snmpd/snmpd.dsp:
+
+   Gotcha!  Everything now builds (more-or-less) cleanly under Visual C++.
+   You still have to use the "Batch Build" mechanism (or else be careful which
+   of libsnmp/libsnmp_dll you build in each of the Debug & Release modes),
+   and you need to build twice in order to get encode_keychange linking.
+   But things *do* finally build.
+   
+2002-03-24 05:21  nba
+
+   * snmplib/mib.c:
+
+   Oops - snprint_* cannot realloc
+   
+2002-03-23 09:40  hardaker
+
+   * apps/Makefile.in:
+
+   really fix snmpinform installs this time.
+   
+2002-03-22 22:32  hardaker
+
+   * apps/notification_log.c:
+
+   final cleanups of notification log support
+   
+2002-03-22 22:32  hardaker
+
+   * apps/Makefile.in:
+
+   fix installation of snmpinform
+   
+2002-03-22 22:32  hardaker
+
+   * agent/helpers/table_data.c , agent/mibgroup/testhandler.c
+   , include/net-snmp/agent/agent_registry.h ,
+   include/net-snmp/agent/table_data.h ,
+   include/net-snmp/agent/table_dataset.h:
+
+   Rename stuff.  Fix stuff.  You know, normal routine.
+   
+2002-03-22 22:31  hardaker
+
+   * configure , configure.in:
+
+   fix version file location for non-sourcedir builds
+   
+2002-03-22 14:13  hardaker
+
+   * include/net-snmp/library/snmp_api.h:
+
+   forgot to commit a prototype.
+   
+2002-03-22 14:12  hardaker
+
+   * agent/agent_handler.c , agent/agent_registry.c ,
+   agent/mibgroup/agentx/master_admin.c ,
+   include/net-snmp/agent/agent_registry.h:
+
+   register_mib_context2 -> netsnmp_register_mib (and marked as internal)
+   
+2002-03-22 14:01  hardaker
+
+   * agent/mibgroup/agentx/: master.c , subagent.c:
+
+   use new error logging api when !root
+   
+2002-03-22 14:00  hardaker
+
+   * snmplib/snmp_api.c:
+
+   enable logging session errors to some log level other than ERR.
+   
+2002-03-22 13:55  hardaker
+
+   * agent/mibgroup/agentx/: master.c , subagent.c:
+
+   better agentx connection related error messages.
+   
+2002-03-22 09:35  dts12
+
+   * win32/: win32.dsw , win32.opt ,
+   libhelpers/libhelpers.dsp , libsnmp_dll/libsnmp.def ,
+   netsnmpmibs/netsnmpmibs.dsp , snmpd/snmpd.dsp:
+
+   Slowly making progress on 5.0 Windows build.
+   Everything now compiles, though the Release version doesn't link.
+     (complains about assorted unknown routines that are there,
+      staring it in the face.  Grrr!!!!)
+   
+2002-03-22 08:24  jbpn
+
+   * agent/mibgroup/agentx/protocol.c:
+
+     - do not "tweak" range_subid when dealing with compressed OIDs.
+       Thanks to Craig Setera for pointing out this deviation from RFC
+       2741.
+   
+2002-03-22 07:50  dts12
+
+   * include/net-snmp/library/snmpUDPDomain.h ,
+   include/net-snmp/library/snmp_client.h , snmplib/oid_array.c
+   , snmplib/snmpTCPDomain.c , snmplib/snmpUDPDomain.c
+   , snmplib/snmp_api.c , snmplib/snmp_client.c:
+
+   Various minor inconsistencies (mostly to do with subtle variations in types)
+   
+2002-03-22 07:31  rstory
+
+   * snmplib/snmp_parse_args.c:
+
+   fix typo
+   
+2002-03-22 07:29  dts12
+
+   * win32/: mib_module_includes.h , mib_module_inits.h ,
+   net-snmp/net-snmp-config.h ,
+   net-snmp/library/snmpv3-security-includes.h:
+
+   Bring Windows versions of "automatically-generated" header files up to date.
+   
+2002-03-22 02:23  jbpn
+
+   * agent/mibgroup/kernel_sunos5.c:
+
+     - don't use "reg" as a parameter name in kernel_sunos5_cache_age()
+       as /usr/include/inet/common.h says:
+       #define reg register
+       (!) which the compiler then barfs on.  Reported as bug #533336 by
+       Anonymous.
+   
+2002-03-21 09:24  hardaker
+
+   * include/net-snmp/library/read_config.h ,
+   include/net-snmp/library/snmp_api.h , snmplib/read_config.c
+   , snmplib/snmp_api.c , snmplib/snmp_parse_args.c:
+
+   - snmp_config* -> netsnmp_config (for new functions only)
+   - fix bug where snmp_config() strings were getting parsed twice.
+   
+2002-03-21 09:23  hardaker
+
+   * apps/snmptrapd.c:
+
+   wrap agentx stuff in a still unused variable (at this point).
+   
+2002-03-21 09:23  hardaker
+
+   * apps/snmptranslate.c:
+
+   remove unused variable.
+   
+2002-03-21 09:23  hardaker
+
+   * agent/mibgroup/utilities/override.c:
+
+   fix oid parsing.
+   
+2002-03-21 09:22  hardaker
+
+   * agent/mibgroup/: Rmon/alarm.c , Rmon/statistics.c ,
+   mibII/at.c:
+
+   change // coments to /* */ comments (bad bad bad)
+   
+2002-03-21 06:40  hardaker
+
+   * snmplib/snmp-tc.c:
+
+   change // coments to /* */ comments (bad bad bad)
+   
+2002-03-20 20:12  hardaker
+
+   * snmplib/snmp_api.c:
+
+   add a list of registered text enums to ASN_* values.
+     (In probably the wrong place.)
+   
+2002-03-20 20:11  hardaker
+
+   * configure , configure.in ,
+   agent/mibgroup/utilities.h ,
+   agent/mibgroup/utilities/override.c ,
+   agent/mibgroup/utilities/override.h:
+
+   create a new "override" directive to force an OID to a particular value
+   - not finished.  It's designed to do read-write as well, but doesn't.
+   
+2002-03-20 20:08  hardaker
+
+   * agent/helpers/instance.c:
+
+   check for inclusive
+   
+2002-03-20 11:37  hardaker
+
+   * include/net-snmp/agent/table_dataset.h:
+
+   include new delete/remove breakdown APIs
+   
+2002-03-20 11:36  hardaker
+
+   * apps/notification_log.c:
+
+   API change.
+   
+2002-03-20 11:36  hardaker
+
+   * agent/helpers/table_dataset.c:
+
+   some "this will change" early row status implementation.
+    - (this will move to a separate handler)
+   
+2002-03-20 11:35  hardaker
+
+   * agent/helpers/table_data.c:
+
+   pointer checking against illegal adds (ie, shouldn't happen but check anyway)
+   
+2002-03-20 08:42  hardaker
+
+   * local/mib2c.create-dataset.conf:
+
+   Ok, I make mistakes.  I admit it.  It really should have been a NULL.
+   
+2002-03-20 08:37  hardaker
+
+   * local/mib2c.create-dataset.conf:
+
+   add missing comma
+   
+2002-03-20 08:36  hardaker
+
+   * agent/helpers/table_data.c ,
+   include/net-snmp/agent/table_data.h:
+
+   separate out delete/remove row functionality
+   
+2002-03-20 07:47  hardaker
+
+   * agent/mibgroup/mibII/: system_mib.c (V4-2-patches.6),
+   system_mib.c:
+
+   remove illegal SET support for sysDescr.
+   
+2002-03-20 06:27  hardaker
+
+   * CodingStyle , local/mib2c:
+
+   - add many many -T flags for defining types.
+   
+2002-03-19 21:13  hardaker
+
+   * apps/snmptrapd.c:
+
+   force setting of '!root' flag so that it will run for non-privileged
+   users or when an agentx master simply has never existed.
+   
+2002-03-19 16:02  hardaker
+
+   * agent/helpers/table_dataset.c ,
+   include/net-snmp/agent/table_dataset.h:
+
+   - allow tables to be marked whether they should support creation or not.
+   - bug fixes
+   
+2002-03-19 07:32  hardaker
+
+   * agent/helpers/: table_data.c , table_dataset.c:
+
+   documentation clean up
+   
+2002-03-19 07:28  hardaker
+
+   * agent/: agent_handler.c , helpers/table_data.c:
+
+   documentation clean up
+   
+2002-03-19 07:17  hardaker
+
+   * agent/: agent_handler.c , helpers/bulk_to_next.c ,
+   helpers/table_dataset.c , mibgroup/examples/scalar_int.c:
+
+   documentation clean up
+   
+2002-03-19 06:43  hardaker
+
+   * agent/agent_handler.c , agent/agent_registry.c ,
+   agent/snmp_agent.c , agent/helpers/instance.c ,
+   agent/helpers/old_api.c , agent/helpers/table.c ,
+   agent/helpers/table_array.c , agent/helpers/table_data.c
+   , agent/helpers/table_dataset.c ,
+   agent/helpers/table_iterator.c , agent/mibgroup/testdelayed.c
+   , agent/mibgroup/testhandler.c ,
+   agent/mibgroup/agentx/master_admin.c ,
+   apps/notification_log.c , include/net-snmp/utilities.h ,
+   include/net-snmp/agent/agent_handler.h ,
+   include/net-snmp/agent/snmp_agent.h ,
+   include/net-snmp/agent/table.h ,
+   include/net-snmp/agent/table_data.h ,
+   include/net-snmp/agent/table_dataset.h ,
+   include/net-snmp/library/data_list.h ,
+   local/mib2c.create-dataset.conf , perl/agent/agent.xs ,
+   snmplib/data_list.c:
+
+   - renamed a few badly named functions (netsnmp_ appeared twice).
+   - implemented the beginning of creation support for datasets.
+   
+2002-03-19 06:35  hardaker
+
+   * configure:
+
+   Apparently I ran autoconf earlier and missed checking in the results.
+   
+2002-03-19 06:35  hardaker
+
+   * CodingStyle:
+
+   add -nfca
+   
+2002-03-17 16:25  hardaker
+
+   * apps/snmptrap.c:
+
+   Set default port to 162.
+   
+2002-03-17 15:51  hardaker
+
+   * snmplib/: snmpTCPDomain.c , snmpUDPDomain.c:
+
+   improved formatting strings showing both transport type and port number.
+   
+2002-03-13 23:30  hardaker
+
+   * Makefile.rules:
+
+   add missing "installsubdirs" target missing (thanks to Katsuhisa ABE)
+   
+2002-03-13 23:27  hardaker
+
+   * configure.in , net-snmp-config.in:
+
+   add --create-snmpv3-user to automate adding a v3 user to both the usm
+   and vacm tables (by adding lines to both the persistent and normal
+   conf files).
+   
+2002-03-13 16:30  hardaker
+
+   * agent/mibgroup/agent/nsModuleTable.c:
+
+   bug fix for pre-processed requests.
+   
+2002-03-13 16:30  hardaker
+
+   * Makefile.rules , configure , configure.in ,
+   agent/Makefile.in , agent/mibgroup/agent_mibs.h ,
+   include/ucd-snmp/agent_index.h ,
+   include/ucd-snmp/agent_read_config.h ,
+   include/ucd-snmp/agent_registry.h ,
+   include/ucd-snmp/agent_trap.h , include/ucd-snmp/asn1.h ,
+   include/ucd-snmp/auto_nlist.h , include/ucd-snmp/callback.h
+   , include/ucd-snmp/default_store.h ,
+   include/ucd-snmp/ds_agent.h ,
+   include/ucd-snmp/header_complex.h , include/ucd-snmp/int64.h
+   , include/ucd-snmp/keytools.h , include/ucd-snmp/mib.h
+   , include/ucd-snmp/mib_module_config.h ,
+   include/ucd-snmp/mibincl.h , include/ucd-snmp/parse.h ,
+   include/ucd-snmp/read_config.h , include/ucd-snmp/scapi.h
+   , include/ucd-snmp/snmp-tc.h , include/ucd-snmp/snmp.h
+   , include/ucd-snmp/snmp_agent.h ,
+   include/ucd-snmp/snmp_alarm.h , include/ucd-snmp/snmp_api.h
+   , include/ucd-snmp/snmp_client.h ,
+   include/ucd-snmp/snmp_debug.h , include/ucd-snmp/snmp_impl.h
+   , include/ucd-snmp/snmp_logging.h ,
+   include/ucd-snmp/snmp_parse_args.h ,
+   include/ucd-snmp/snmp_vars.h , include/ucd-snmp/snmpusm.h
+   , include/ucd-snmp/snmpv3.h , include/ucd-snmp/struct.h
+   , include/ucd-snmp/system.h , include/ucd-snmp/tools.h
+   , include/ucd-snmp/transform_oids.h ,
+   include/ucd-snmp/ucd-snmp-agent-includes.h ,
+   include/ucd-snmp/ucd-snmp-includes.h ,
+   include/ucd-snmp/util_funcs.h , include/ucd-snmp/var_struct.h
+   , include/ucd-snmp/version.h:
+
+   - --enable-ucd-snmp-compatibility actually installs headers (as opposed
+     to always, which is what it used to do).
+   - add agent_mibs to configure default mib modules and document.
+   - change help documentation a bit for the mib modules.
+   - add a forced dependency for mib_modules.lo
+   
+2002-03-13 16:13  hardaker
+
+   * agent/mibgroup/agent.h:
+
+   opps.  duplicates existing agent_mibs.h
+   
+2002-03-13 15:50  hardaker
+
+   * mibs/: UCD-DEMO-MIB.txt, UCD-DISKIO-MIB.txt, UCD-DLMOD-MIB.txt,
+   UCD-IPFILTER-MIB.txt, UCD-IPFWACC-MIB.txt, UCD-SNMP-MIB.txt
+   (V4-2-patches.[1,1,1,1,1,9]), UCD-DEMO-MIB.txt ,
+   UCD-DISKIO-MIB.txt , UCD-DLMOD-MIB.txt ,
+   UCD-IPFILTER-MIB.txt , UCD-IPFWACC-MIB.txt ,
+   UCD-SNMP-MIB.txt:
+
+   address changes for ucd-snmp -> net-snmp note saying these mibs are no
+   longer supported by UCD.
+   
+2002-03-13 15:39  hardaker
+
+   * agent/mibgroup/agent.h ,
+   agent/mibgroup/agent/nsModuleTable.c ,
+   agent/mibgroup/agent/nsModuleTable.h ,
+   mibs/NET-SNMP-AGENT-MIB.txt:
+
+   Added a nsModuleTable table which replaces the older mrTable.
+   Functionally, this is a list of all registered items within the MIB
+   tree just like the mrTable was, but with support for contexts and for
+   duplicate registrations with different priorities.
+   
+2002-03-13 15:21  hardaker
+
+   * snmplib/: tools.c (V4-2-patches.4), tools.c:
+
+   malloc at least one byte in hex_to_binary2
+   
+2002-03-13 15:11  hardaker
+
+   * agent/helpers/table_iterator.c:
+
+   remove unneeded debug statement
+   
+2002-03-13 14:10  hardaker
+
+   * snmplib/mib.c:
+
+   Use local variable name buffers by default when building oid segments.
+   
+2002-03-13 14:09  hardaker
+
+   * agent/helpers/table_iterator.c:
+
+   /* stop water from flowing through dam */
+   finger->insert("hole")
+   
+2002-03-13 04:03  dts12
+
+   * FAQ (V4-2-patches.7), FAQ:
+
+   Add a description of "unlinked OIDs".
+   
+2002-03-12 21:30  hardaker
+
+   * local/: mib2c.create-dataset.conf , mib2c.iterate.conf:
+
+   fix headers.
+   
+2002-03-12 21:15  hardaker
+
+   * local/mib2c:
+
+   add don't format comments option
+   
+2002-03-12 21:10  hardaker
+
+   * agent/helpers/table_dataset.c:
+
+   fix for tables with holes.
+   
+2002-03-12 21:09  hardaker
+
+   * mibs/Makefile.in:
+
+   move default mibs to their own variable.
+   
+2002-03-12 21:06  hardaker
+
+   * perl/: SNMP/Makefile.PL , agent/Makefile.PL ,
+   agent/agent.xs , agent/typemap:
+
+   - use net-snmp-config to figure things out.
+   - update headers and typeinfo for recent changes.
+   
+2002-03-12 20:34  hardaker
+
+   * local/: FAQ2HTML , README.mib2c , mib2c , tkmib
+   , mib2c.array-auto.conf , mib2c.array-user.conf:
+
+   ucd-snmp -> net-snmp changes.
+   
+2002-03-12 20:33  hardaker
+
+   * local/mib2c.storage.conf:
+
+   remove obsolete mib2c.conf file
+   
+2002-03-12 18:11  hardaker
+
+   * agent/helpers/table_data.c:
+
+   don't forget to set row->next->prev to something when removing row.
+   
+2002-03-12 17:54  hardaker
+
+   * agent/snmp_agent.c:
+
+   fix agentx inclusive searches to ignore get errors.
+   
+2002-03-12 17:53  hardaker
+
+   * snmplib/snmpCallbackDomain.c:
+
+   some minimal dump debugging.
+   
+2002-03-12 08:34  dts12
+
+   * FAQ (V4-2-patches.6), FAQ:
+
+   Updating of the FAQ ready for the next release.
+   (Mostly rephrasing of existing entries, but a few new questions)
+   
+2002-03-11 18:00  rstory
+
+   * agent/helpers/table_dataset.c:
+
+   cast -1 to u_char so test doesn't always fail (fix compiler warning)
+   
+2002-03-11 17:27  hardaker
+
+   * agent/mibgroup/agentx/master.c:
+
+   treat (illegal) errors from subagents specially for getnext cases.
+   
+2002-03-11 13:41  hardaker
+
+   * net-snmp-config.in:
+
+   add our snmp libraries to output
+   
+2002-03-11 10:34  hardaker
+
+   * include/net-snmp/agent/: table_data.h , table_dataset.h:
+
+   delete/remove support header changes.
+   
+2002-03-11 09:13  jbpn
+
+   * agent/mibgroup/mibII/vacm_vars.c:
+
+     - allow compilation --with-out-transports=TCP
+   
+2002-03-11 08:21  jbpn
+
+   * include/net-snmp/library/snmp_debug.h:
+
+     - fixes for --disable-debugging
+   
+2002-03-11 07:41  dts12
+
+   * FAQ (V4-2-patches.5), FAQ:
+
+   Bring the 4x- and main-branch FAQs into agreement.
+   
+2002-03-11 06:51  jbpn
+
+   * agent/mibgroup/agentx/master.c:
+
+     - use correct session ID when talking to subagents.  Thanks to Craig
+       Setera for this fix.
+   
+2002-03-11 05:20  jbpn
+
+   * snmplib/parse.c:
+
+     - fix bad type assignment in build_translation_table(), noticed by
+       Peter Stevens.
+   
+2002-03-11 00:13  hardaker
+
+   * apps/snmptrapd.c:
+
+   check for NULL frees, even though it's supposed to be ok according to ansi.
+   
+2002-03-11 00:12  hardaker
+
+   * apps/notification_log.c:
+
+   beginning support for maximum logged checking.
+   
+2002-03-11 00:11  hardaker
+
+   * agent/helpers/table_dataset.c:
+
+   - remove/delete row support.
+   - null check
+   - doc comments.
+   
+2002-03-11 00:10  hardaker
+
+   * agent/helpers/table_data.c:
+
+   remove/delete row support.
+   
+2002-03-11 00:08  hardaker
+
+   * agent/helpers/instance.c:
+
+   call next handlers (opps).
+   
+2002-03-10 14:11  nba
+
+   * man/mib_api.3.def:
+
+   Fix one sprint_variable => snprint_variable
+   
+2002-03-10 14:06  nba
+
+   * include/net-snmp/library/mib.h , snmplib/mib.c:
+
+   Add snprint_* functions that were sprint_* in ucd-snmp 4
+   
+2002-03-10 14:05  nba
+
+   * include/net-snmp/session_api.h , snmplib/snmpIPXDomain.c
+   , snmplib/snmp_transport.c:
+
+   Fix compilation when IPX-transport enabled
+   
+2002-03-10 14:03  nba
+
+   * apps/snmpnetstat/Makefile.in:
+
+   Fix compilation outside source directory
+   
+2002-03-08 22:26  hardaker
+
+   * FAQ , sedscript.in , perl/SNMP/SNMP.pm ,
+   snmplib/snmp_version.c:
+
+   - (snmplib/snmp_version.c sedscript.in): version tag ( 5.0.pre2 )
+   
+2002-03-08 18:23  hardaker
+
+   * README:
+
+   misc changes.
+   
+2002-03-08 18:23  hardaker
+
+   * perl/SNMP/SNMP.xs:
+
+   new api changes
+   
+2002-03-08 17:20  hardaker
+
+   * agent/mibgroup/mibII/mta_sendmail.c:
+
+   Patch from Lawrence Greenfield to deal with Sendmail 8.12 queuegroups.
+   
+2002-03-08 16:59  hardaker
+
+   * apps/snmpnetstat/Makefile.in:
+
+   patch from csete to fix win32 builds
+   
+2002-03-08 16:55  hardaker
+
+   * configure , configure.in:
+
+   add Callback transport to cygwin
+   
+2002-03-08 16:49  hardaker
+
+   * NEWS:
+
+   mention rmon support.
+   
+2002-03-08 16:39  hardaker
+
+   * snmplib/snmp_api.c:
+
+   patch from Harrie Hazewinkel to remove old an unused pointer
+   
+2002-03-08 16:28  hardaker
+
+   * agent/agent_index.c , agent/agent_registry.c ,
+   agent/agent_trap.c , agent/snmp_agent.c ,
+   agent/snmp_vars.c , agent/snmpd.c ,
+   agent/helpers/instance.c , agent/helpers/old_api.c ,
+   agent/helpers/table.c , agent/helpers/table_array.c ,
+   agent/helpers/table_data.c , agent/helpers/table_dataset.c
+   , agent/helpers/table_iterator.c ,
+   agent/mibgroup/header_complex.c ,
+   agent/mibgroup/header_complex.h , agent/mibgroup/testhandler.c
+   , agent/mibgroup/Rmon/event.c ,
+   agent/mibgroup/agent/nsTransactionTable.c ,
+   agent/mibgroup/agentx/client.c ,
+   agent/mibgroup/agentx/client.h ,
+   agent/mibgroup/agentx/master.c ,
+   agent/mibgroup/agentx/master_admin.c ,
+   agent/mibgroup/agentx/master_admin.h ,
+   agent/mibgroup/agentx/protocol.c ,
+   agent/mibgroup/agentx/protocol.h ,
+   agent/mibgroup/agentx/subagent.c ,
+   agent/mibgroup/agentx/subagent.h ,
+   agent/mibgroup/disman/mteObjectsTable.c ,
+   agent/mibgroup/disman/mteObjectsTable.h ,
+   agent/mibgroup/disman/mteTriggerTable.c ,
+   agent/mibgroup/disman/mteTriggerTable.h ,
+   agent/mibgroup/examples/example.c ,
+   agent/mibgroup/mibII/sysORTable.c ,
+   agent/mibgroup/mibII/sysORTable.h ,
+   agent/mibgroup/mibII/vacm_context.c ,
+   agent/mibgroup/mibII/vacm_vars.c ,
+   agent/mibgroup/mibII/vacm_vars.h ,
+   agent/mibgroup/notification/snmpNotifyFilterProfileTable.c ,
+   agent/mibgroup/notification/snmpNotifyFilterTable.c ,
+   agent/mibgroup/notification/snmpNotifyTable.c ,
+   agent/mibgroup/smux/smux.c , agent/mibgroup/smux/smux.h
+   , agent/mibgroup/target/snmpTargetAddrEntry.c ,
+   agent/mibgroup/target/snmpTargetAddrEntry.h ,
+   agent/mibgroup/target/target.c ,
+   agent/mibgroup/target/target.h ,
+   agent/mibgroup/ucd-snmp/proxy.c ,
+   agent/mibgroup/ucd-snmp/proxy.h , apps/notification_log.c
+   , apps/notification_log.h , apps/snmpbulkget.c ,
+   apps/snmpbulkwalk.c , apps/snmpdelta.c , apps/snmpdf.c
+   , apps/snmpget.c , apps/snmpgetnext.c ,
+   apps/snmpset.c , apps/snmpstatus.c , apps/snmptable.c
+   , apps/snmptest.c , apps/snmptrap.c ,
+   apps/snmptrapd.c , apps/snmptrapd_log.c ,
+   apps/snmptrapd_log.h , apps/snmpusm.c , apps/snmpvacm.c
+   , apps/snmpwalk.c , apps/snmpnetstat/if.c ,
+   apps/snmpnetstat/inet.c , apps/snmpnetstat/inet6.c ,
+   apps/snmpnetstat/main.c , apps/snmpnetstat/netstat.h ,
+   apps/snmpnetstat/route.c ,
+   include/net-snmp/agent/agent_index.h ,
+   include/net-snmp/agent/agent_registry.h ,
+   include/net-snmp/agent/agent_trap.h ,
+   include/net-snmp/agent/old_api.h ,
+   include/net-snmp/agent/snmp_agent.h ,
+   include/net-snmp/agent/snmp_vars.h ,
+   include/net-snmp/agent/table.h ,
+   include/net-snmp/agent/table_data.h ,
+   include/net-snmp/agent/table_iterator.h ,
+   include/net-snmp/agent/var_struct.h ,
+   include/net-snmp/library/cmu_compat.h ,
+   include/net-snmp/library/libsnmp.h ,
+   include/net-snmp/library/mib.h ,
+   include/net-snmp/library/oid_array.h ,
+   include/net-snmp/library/parse.h ,
+   include/net-snmp/library/snmpCallbackDomain.h ,
+   include/net-snmp/library/snmp_api.h ,
+   include/net-snmp/library/snmp_client.h ,
+   include/net-snmp/library/snmp_debug.h ,
+   include/net-snmp/library/snmp_parse_args.h ,
+   include/net-snmp/library/snmp_secmod.h ,
+   include/net-snmp/library/snmpusm.h ,
+   local/mib2c.array-user.conf , local/mib2c.iterate.conf ,
+   local/mib2c.storage.conf , perl/SNMP/SNMP.xs ,
+   snmplib/cmu_compat.c , snmplib/mib.c ,
+   snmplib/snmpCallbackDomain.c , snmplib/snmp_api.c ,
+   snmplib/snmp_client.c , snmplib/snmp_debug.c ,
+   snmplib/snmp_parse_args.c , snmplib/snmp_secmod.c ,
+   snmplib/snmpksm.c , snmplib/snmpusm.c , snmplib/snmpv3.c
+   , snmplib/ucd_compat.c:
+
+   struct snmp_session typedefed to netsnmp_session.  & pdu. & ...
+   
+2002-03-08 14:00  hardaker
+
+   * perl/SNMP/SNMP.xs:
+
+   get_symbol -> get_tree
+   
+2002-03-08 07:45  hardaker
+
+   * perl/: SNMP/SNMP.xs , agent/agent.pm , agent/agent.xs
+   , agent/test.pl:
+
+   missed updates
+   
+2002-03-08 07:43  hardaker
+
+   * snmplib/: data_list.c , default_store.c , mib.c
+   , oid_array.c , oid_stash.c , read_config.c
+   , snmpAAL5PVCDomain.c , snmpCallbackDomain.c ,
+   snmpIPXDomain.c , snmpTCPDomain.c , snmpTCPIPv6Domain.c
+   , snmpUDPDomain.c , snmpUDPIPv6Domain.c ,
+   snmpUnixDomain.c , snmp_api.c , snmp_debug.c ,
+   snmp_transport.c , snmpv3.c:
+
+   missing updated code
+   
+2002-03-08 02:07  jbpn
+
+   * include/net-snmp/library/snmp_api.h ,
+   include/net-snmp/library/snmp_transport.h , snmplib/snmp_api.c:
+
+     - some snmp -> netsnmp fixes
+   
+2002-03-07 13:42  hardaker
+
+   * agent/snmp_agent.c , agent/snmp_vars.c ,
+   agent/snmpd.c , agent/helpers/table.c ,
+   agent/helpers/table_array.c , agent/helpers/table_data.c
+   , agent/helpers/table_dataset.c ,
+   agent/helpers/table_iterator.c , agent/mibgroup/testhandler.c
+   , agent/mibgroup/agent/nsTransactionTable.c ,
+   agent/mibgroup/agentx/subagent.c ,
+   agent/mibgroup/disman/mteTriggerTable.c ,
+   agent/mibgroup/mibII/vacm_context.c ,
+   agent/mibgroup/mibII/vacm_vars.c , apps/notification_log.c
+   , apps/snmptrapd.c , apps/snmptrapd_log.c ,
+   include/net-snmp/agent/snmp_agent.h ,
+   include/net-snmp/agent/table.h ,
+   include/net-snmp/agent/table_array.h ,
+   include/net-snmp/agent/table_data.h ,
+   include/net-snmp/agent/table_dataset.h ,
+   include/net-snmp/agent/table_iterator.h ,
+   include/net-snmp/library/snmpAAL5PVCDomain.h ,
+   include/net-snmp/library/snmpCallbackDomain.h ,
+   include/net-snmp/library/snmpIPXDomain.h ,
+   include/net-snmp/library/snmpTCPDomain.h ,
+   include/net-snmp/library/snmpTCPIPv6Domain.h ,
+   include/net-snmp/library/snmpUDPDomain.h ,
+   include/net-snmp/library/snmpUDPIPv6Domain.h ,
+   include/net-snmp/library/snmpUnixDomain.h ,
+   local/mib2c.array-auto.conf , local/mib2c.array-user.conf
+   , local/mib2c.create-dataset.conf ,
+   local/mib2c.iterate.conf:
+
+   massive netsnmp_ prefixing of stuff (pass 4)
+   
+2002-03-07 13:29  hardaker
+
+   * agent/agent_handler.c , agent/agent_read_config.c ,
+   agent/agent_registry.c , agent/snmp_vars.c ,
+   agent/helpers/all_helpers.c , agent/helpers/bulk_to_next.c
+   , agent/helpers/debug_handler.c ,
+   agent/helpers/instance.c , agent/helpers/multiplexer.c ,
+   agent/helpers/null.c , agent/helpers/old_api.c ,
+   agent/helpers/read_only.c , agent/helpers/serialize.c ,
+   agent/helpers/table.c , agent/helpers/table_array.c ,
+   agent/helpers/table_data.c , agent/helpers/table_dataset.c
+   , agent/helpers/table_iterator.c ,
+   agent/mibgroup/testdelayed.c , agent/mibgroup/testhandler.c
+   , agent/mibgroup/agent/nsTransactionTable.c ,
+   agent/mibgroup/agent/nsTransactionTable.h ,
+   agent/mibgroup/agentx/master_admin.c ,
+   agent/mibgroup/disman/mteTriggerTable.c ,
+   agent/mibgroup/examples/scalar_int.c ,
+   agent/mibgroup/mibII/vacm_context.c ,
+   agent/mibgroup/target/target.c ,
+   agent/mibgroup/target/target_counters.c ,
+   apps/notification_log.c ,
+   include/net-snmp/agent/agent_registry.h ,
+   include/net-snmp/agent/all_helpers.h ,
+   include/net-snmp/agent/bulk_to_next.h ,
+   include/net-snmp/agent/debug_handler.h ,
+   include/net-snmp/agent/instance.h ,
+   include/net-snmp/agent/multiplexer.h ,
+   include/net-snmp/agent/null.h ,
+   include/net-snmp/agent/old_api.h ,
+   include/net-snmp/agent/read_only.h ,
+   include/net-snmp/agent/serialize.h ,
+   include/net-snmp/agent/table.h ,
+   include/net-snmp/agent/table_array.h ,
+   include/net-snmp/agent/table_data.h ,
+   include/net-snmp/agent/table_dataset.h ,
+   include/net-snmp/agent/table_iterator.h ,
+   include/net-snmp/library/snmpTCPDomain.h ,
+   local/mib2c.array-auto.conf , local/mib2c.array-user.conf
+   , local/mib2c.create-dataset.conf ,
+   local/mib2c.iterate.conf:
+
+   massive netsnmp_ prefixing of stuff (pass 3)
+   
+2002-03-07 13:13  hardaker
+
+   * agent/agent_handler.c , agent/agent_registry.c ,
+   agent/snmp_agent.c , agent/helpers/debug_handler.c ,
+   agent/helpers/instance.c , agent/helpers/old_api.c ,
+   agent/helpers/table.c , agent/helpers/table_array.c ,
+   agent/helpers/table_data.c , agent/helpers/table_dataset.c
+   , agent/helpers/table_iterator.c ,
+   agent/mibgroup/testdelayed.c , agent/mibgroup/testhandler.c
+   , agent/mibgroup/agentx/master_admin.c ,
+   agent/mibgroup/disman/mteTriggerTable.c ,
+   agent/mibgroup/target/target.c , apps/snmptrapd.c ,
+   include/net-snmp/agent/agent_handler.h ,
+   include/net-snmp/agent/snmp_agent.h ,
+   include/net-snmp/agent/table_array.h ,
+   include/net-snmp/library/data_list.h ,
+   include/net-snmp/library/oid_array.h ,
+   include/net-snmp/library/oid_stash.h ,
+   local/mib2c.array-user.conf:
+
+   massive netsnmp_ prefixing of stuff (pass 2)
+   
+2002-03-07 08:56  hardaker
+
+   * agent/agent_handler.c , agent/agent_read_config.c ,
+   agent/agent_registry.c , agent/snmp_agent.c ,
+   agent/snmp_vars.c , agent/snmpd.c ,
+   agent/helpers/bulk_to_next.c , agent/helpers/debug_handler.c
+   , agent/helpers/instance.c ,
+   agent/helpers/multiplexer.c , agent/helpers/null.c ,
+   agent/helpers/old_api.c , agent/helpers/read_only.c ,
+   agent/helpers/serialize.c , agent/helpers/table.c ,
+   agent/helpers/table_array.c , agent/helpers/table_data.c
+   , agent/helpers/table_dataset.c ,
+   agent/helpers/table_iterator.c , agent/mibgroup/testdelayed.c
+   , agent/mibgroup/testdelayed.h ,
+   agent/mibgroup/testhandler.c , agent/mibgroup/testhandler.h
+   , agent/mibgroup/agent/nsTransactionTable.c ,
+   agent/mibgroup/agent/nsTransactionTable.h ,
+   agent/mibgroup/agentx/master.c ,
+   agent/mibgroup/agentx/master.h ,
+   agent/mibgroup/agentx/master_admin.c ,
+   agent/mibgroup/agentx/subagent.c ,
+   agent/mibgroup/disman/mteTriggerTable.c ,
+   agent/mibgroup/mibII/sysORTable.c ,
+   agent/mibgroup/mibII/system_mib.c ,
+   agent/mibgroup/mibII/vacm_context.c ,
+   agent/mibgroup/mibII/vacm_context.h ,
+   agent/mibgroup/mibII/vacm_vars.c ,
+   agent/mibgroup/notification/snmpNotifyTable.c ,
+   agent/mibgroup/target/snmpTargetAddrEntry.h ,
+   agent/mibgroup/target/target.c ,
+   agent/mibgroup/target/target_counters.c ,
+   agent/mibgroup/target/target_counters.h ,
+   agent/mibgroup/ucd-snmp/proxy.c ,
+   agent/mibgroup/ucd-snmp/proxy.h , apps/notification_log.c
+   , apps/notification_log.h , apps/snmpstatus.c ,
+   apps/snmptest.c , apps/snmptrapd.c ,
+   apps/snmptrapd_log.c , apps/snmptrapd_log.h ,
+   include/net-snmp/session_api.h ,
+   include/net-snmp/agent/agent_handler.h ,
+   include/net-snmp/agent/agent_registry.h ,
+   include/net-snmp/agent/bulk_to_next.h ,
+   include/net-snmp/agent/debug_handler.h ,
+   include/net-snmp/agent/instance.h ,
+   include/net-snmp/agent/multiplexer.h ,
+   include/net-snmp/agent/null.h ,
+   include/net-snmp/agent/old_api.h ,
+   include/net-snmp/agent/read_only.h ,
+   include/net-snmp/agent/serialize.h ,
+   include/net-snmp/agent/set_helper.h ,
+   include/net-snmp/agent/snmp_agent.h ,
+   include/net-snmp/agent/snmp_vars.h ,
+   include/net-snmp/agent/table.h ,
+   include/net-snmp/agent/table_array.h ,
+   include/net-snmp/agent/table_data.h ,
+   include/net-snmp/agent/table_dataset.h ,
+   include/net-snmp/agent/table_iterator.h ,
+   include/net-snmp/agent/var_struct.h ,
+   include/net-snmp/library/mib.h ,
+   include/net-snmp/library/read_config.h ,
+   include/net-snmp/library/snmpAAL5PVCDomain.h ,
+   include/net-snmp/library/snmpCallbackDomain.h ,
+   include/net-snmp/library/snmpIPXDomain.h ,
+   include/net-snmp/library/snmpTCPDomain.h ,
+   include/net-snmp/library/snmpTCPIPv6Domain.h ,
+   include/net-snmp/library/snmpUDPDomain.h ,
+   include/net-snmp/library/snmpUDPIPv6Domain.h ,
+   include/net-snmp/library/snmpUnixDomain.h ,
+   include/net-snmp/library/snmp_api.h ,
+   include/net-snmp/library/snmp_transport.h ,
+   local/mib2c.array-auto.conf , local/mib2c.array-user.conf
+   , local/mib2c.create-dataset.conf ,
+   local/mib2c.iterate.conf:
+
+   massive netsnmp_ prefixing of stuff (pass 1)
+   
+2002-03-07 06:21  jbpn
+
+   * man/snmp_sess_api.3.def:
+
+     - style update
+   
+2002-03-07 05:47  jbpn
+
+   * man/snmp_trap_api.3.def:
+
+     - minor updates
+   
+2002-03-07 05:39  jbpn
+
+   * man/snmp_alarm.3.def:
+
+     - style update
+   
+2002-03-07 05:00  jbpn
+
+   * man/read_config.3.def:
+
+     - make prototypes match header
+   
+     - make style consistent with mib_api
+   
+2002-03-07 03:07  jbpn
+
+   * man/mib_api.3.def:
+
+     - fix up snprint_ declarations, fix small typo.  Patch by Guy
+   Harris.
+   
+2002-03-07 02:44  jbpn
+
+   * include/net-snmp/library/mib.h:
+
+     - remove duplicate declaration of sprint_realloc_by_type, as noted
+       by Guy Harris.
+   
+2002-03-06 17:15  hardaker
+
+   * include/net-snmp/agent/.cvsignore ,
+   include/net-snmp/library/.cvsignore , perl/SNMP/t/.cvsignore:
+
+   new ignore files
+   
+2002-03-06 17:13  hardaker
+
+   * .cvsignore:
+
+   ignore docs
+   
+2002-03-06 17:08  hardaker
+
+   * agent/mibgroup/examples.h:
+
+   examples module wrapper to include all (new) examples.
+   
+2002-03-06 16:58  hardaker
+
+   * agent/mibgroup/examples/scalar_int.c:
+
+   document better.
+   
+2002-03-06 16:58  hardaker
+
+   * doxygen.conf:
+
+   search examples for docs.
+   
+2002-03-06 16:29  hardaker
+
+   * mibs/NET-SNMP-EXAMPLES-MIB.txt:
+
+   example MIB template (and one node)
+   
+2002-03-06 16:28  hardaker
+
+   * mibs/NET-SNMP-MIB.txt:
+
+   instantiate examples
+   
+2002-03-06 16:27  hardaker
+
+   * mibs/Makefile.in:
+
+   install some NS mibs
+   
+2002-03-06 16:27  hardaker
+
+   * agent/mibgroup/examples/: scalar_int.c , scalar_int.h:
+
+   Example implementation of a SNMP enabled int registered at a scalar.
+   
+2002-03-06 16:25  hardaker
+
+   * agent/helpers/instance.c , include/net-snmp/agent/instance.h:
+
+   many changes for instances.  Specificically:
+     - allow for subhandlers.
+     - provide an int wrapper.
+     - reuse more code.
+     - numerous bug fixes.
+   
+2002-03-06 14:05  hardaker
+
+   * NEWS:
+
+   remove a blank line.
+   
+2002-03-06 14:05  hardaker
+
+   * agent/mibgroup/agentx/: master.c , master_admin.c:
+
+   Fix master agent getbulk support.  this has to be independently of the
+   normal bulk->next fixes due to delegation.  Long story.
+   
+2002-03-06 14:03  hardaker
+
+   * agent/helpers/bulk_to_next.c:
+
+   move bulk_to_next fixing functionality into a separate function for reuse.
+   
+2002-03-06 10:26  jbpn
+
+   * include/net-snmp/library/mib.h , snmplib/mib.c:
+
+     - sprinkle magic const dust
+   
+2002-03-06 10:18  jbpn
+
+   * man/mib_api.3.def:
+
+     - document changed API, incorporating patches by Guy Harris.
+   
+2002-03-06 09:34  hardaker
+
+   * testing/tests/: T112agentxsetfail , T122proxysetfail:
+
+   fix tests.
+   
+2002-03-06 09:24  hardaker
+
+   * snmplib/snmp_parse_args.c:
+
+   re-enable setting optind to 1 till Dave tells me where this breaks.
+   
+2002-03-06 09:08  hardaker
+
+   * testing/tests/: T051snmpv2ctrap , T052snmpv2cinform ,
+   T058agentauthtrap:
+
+   fixes for new command line usage.
+   
+2002-03-06 09:07  hardaker
+
+   * snmplib/snmp_client.c:
+
+   more improved error messages (mostly)
+   
+2002-03-06 08:54  hardaker
+
+   * configure:
+
+   autoconf
+   
+2002-03-06 08:41  dts12
+
+   * snmplib/: snmpv3.c (V4-2-patches.3), snmpv3.c:
+
+   Fix a confusion between defAuthType and defPrivType.
+   
+2002-03-06 08:36  hardaker
+
+   * agent/mibgroup/agentx/: master.c , protocol.c:
+
+   proper fix for not requiring responses to CLEANUP messages.
+   
+2002-03-06 06:07  jbpn
+
+   * agent/snmp_agent.c:
+
+     - zero the name of elements of the bulk cache
+   
+2002-03-06 06:06  jbpn
+
+   * snmplib/mib.c:
+
+     - calloc() not malloc() in a few places to initialise some buffers
+       to zeroes.
+   
+2002-03-06 05:52  dts12
+
+   * snmplib/: snmp_api.c (V4-2-patches.6), snmp_api.c:
+
+   Actually use the common 'defPassphrase' value if 'def{Auth,Priv}Passphrase' isn't set.
+   Qn: Should the AuthPassphrase also be used for privacy if no other value is available?
+   
+2002-03-06 05:45  jbpn
+
+   * agent/mibgroup/agentx/master.c:
+
+     - don't send requests for OIDs preceeding the start of a region
+       (this can lead to loops if e.g. a subagent has registered two
+       adjacent rows).
+   
+2002-03-06 05:07  jbpn
+
+   * testing/Makefile.in:
+
+     - ignore errors doing rm -rf /tmp/snmp-test* when making testclean
+   
+2002-03-06 02:26  jbpn
+
+   * snmplib/mib.c:
+
+     - use more efficient get_tree() in sprint_realloc_value()
+   
+2002-03-05 18:28  hardaker
+
+   * testing/tests/: T015snmpv2cgetnext , T001snmpv1get ,
+   T002snmpv1getnext , T003snmpv1getfail , T014snmpv2cget
+   , T016snmpv2cgetfail , T017snmpv2ctov1getfail ,
+   T018snmpv1tov2cgetfail , T100agenthup:
+
+   fixes for new forced -c flags
+   
+2002-03-05 18:21  hardaker
+
+   * include/net-snmp/agent/snmp_agent.h:
+
+   remove no longer appropriate comment.
+   
+2002-03-05 18:20  hardaker
+
+   * agent/mibgroup/agentx/subagent.c:
+
+   fix duplicate free by cloning the pdu before sending it out again
+   (thought I had done this once in the past already, but I got 1/2 functions).
+   
+2002-03-05 18:19  hardaker
+
+   * agent/mibgroup/agentx/protocol.c:
+
+   Temporary fix to fix for agentx SET requests.  This reverses a
+   previous John change where responses to cleanups are now expected
+   again.  This took me a good 2 days to track down, sigh...
+   
+2002-03-05 18:07  hardaker
+
+   * agent/mibgroup/agentx/master.c:
+
+   - add (ascii) agentx state diagram
+   
+2002-03-05 18:07  hardaker
+
+   * agent/snmp_agent.c:
+
+   - multiple free bug fixes.
+   - improved debugging statements.
+   
+2002-03-05 10:44  hardaker
+
+   * agent/mibgroup/agentx/: master_request.c , master_request.h:
+
+   removed unused files
+   
+2002-03-05 10:31  jbpn
+
+   * agent/mibgroup/agentx/subagent.c:
+
+     - oops, fix bad cut and paste
+   
+2002-03-05 10:25  jbpn
+
+   * agent/mibgroup/agentx/subagent.c:
+
+     - reintroduce scope processing (see RFC 2741, p. 66, section 7.2.3.2
+       paragraph 2): "If the subagent can't locate an appropriate
+       variable, __v.name_is_set_to_the_starting_OID__ [the important
+       bit] and the VarBind is set to `endOfMibView'"
+   
+2002-03-05 09:54  hardaker
+
+   * agent/mibgroup/ucd-snmp/versioninfo.c:
+
+   impose max length restriction supplied by mib for configuration options.
+   
+2002-03-05 08:48  jbpn
+
+   * agent/: agent_index.c , snmp_agent.c ,
+   helpers/debug_handler.c , mibgroup/agentx/master.c:
+
+     - use new DEBUGMSGVAR macro in a few places
+   
+2002-03-05 08:45  jbpn
+
+   * snmplib/snmp_debug.c ,
+   include/net-snmp/library/snmp_debug.h:
+
+     - add DEBUGMSGVAR macro to print out a variable
+   
+2002-03-05 08:34  hardaker
+
+   * perl/SNMP/: SNMP.pm , SNMP.xs:
+
+   print_value function updates.
+   
+2002-03-05 08:05  dts12
+
+   * agent/mibgroup/examples/: ucdDemoPublic.c (V4-2-patches.2),
+   ucdDemoPublic.c:
+
+   Add missing "standard" headers, and tweak a type slightly.
+   (Based on requests from Gregory Toth).
+   
+2002-03-05 08:04  jbpn
+
+   * agent/snmp_agent.c:
+
+     - grrr, botched last fix
+   
+2002-03-05 08:01  hardaker
+
+   * agent/mibgroup/agentx/subagent.c ,
+   snmplib/snmpCallbackDomain.c:
+
+   Set the default callback session version number to the generic -1
+   version allowing the pdu to passed without version checking.
+   
+2002-03-05 07:59  hardaker
+
+   * agent/mibgroup/agentx/master.c:
+
+   move NULL check to *before* you actually use the pointer.
+   
+2002-03-05 07:59  jbpn
+
+   * agent/snmp_agent.c:
+
+     - mark INCLUSIVE requests as such
+   
+2002-03-05 07:58  hardaker
+
+   * agent/helpers/old_api.c:
+
+   - use a for loop instead of a while loop, just a precaution for future problems.
+   
+2002-03-05 07:56  hardaker
+
+   * agent/snmp_agent.c:
+
+   - (snmp_check_parse) allow internal set transactions to be passed to
+     the agent, since agentx sends them.
+   
+2002-03-05 07:21  jbpn
+
+   * snmplib/mib.c:
+
+     - don't add the "module ID" to OIDs if it is numeric because we
+       couldn't look it up properly (to avoid horrible looking output
+       like this: "OID: #-1::iso.2.3.4.5.")
+   
+2002-03-05 07:05  jbpn
+
+   * configure.in:
+
+     - remove reference to 2c in error message from version prompt
+   
+2002-03-05 07:01  jbpn
+
+   * configure.in:
+
+     - remove duplicate tests
+   
+2002-03-05 06:51  hardaker
+
+   * configure , configure.in:
+
+   - re-emphasis a suggestion to switch to a secure version of the protocol.
+   - delete notion that v3 without auth/priv provides better security (it doesn't).
+   - Don't accept v2c as an accepted value, as it's used as an int.
+     - but do change help messages, etc, to reflect that 2 = v2c.
+   
+2002-03-05 06:50  dts12
+
+   * agent/mibgroup/ucd-snmp/dlmod.c:
+
+   Cast a calloc appropriately (requested by Gregory Toth)
+   
+2002-03-05 06:20  jbpn
+
+   * snmplib/Makefile.in:
+
+     - fix typo in OBJS definition
+   
+2002-03-05 06:18  jbpn
+
+   * agent/Makefile.in:
+
+     - clean target depends on $(OBJS) and $(LOBJS), so define them
+   
+2002-03-05 03:52  jbpn
+
+   * configure.in:
+
+     - fix default version tests (splitting them over several lines
+       confuses sh on Solaris, at least).
+   
+     - disambiguate some instances of "version" in default version
+       prompt text.
+   
+2002-03-05 02:34  dts12
+
+   * configure , configure.in:
+
+   Correctly detect when no initial default version has been set.
+   Accept '2c' as well as '2' for a default version choice.
+   Fix the title for this prompt, and reword the description to
+   make it a *slightly* less leading question, m'lud.
+   
+   Qn: Should we support a "no default version" option ?
+     (hence allow the admin to force the decision down to the user)
+   
+2002-03-04 18:14  hardaker
+
+   * agent/mibgroup/agentx/client.c:
+
+   ucd-snmp -> net-snmp change
+   
+2002-03-04 18:10  hardaker
+
+   * agent/agent_handler.c:
+
+   (To John): do not free the myvoid pointer in a handler.  You can not
+   assume that it's a freeable resource.  For instance, the agentx master
+   agent was using it to store the master session pointer in it (which
+   would exist in multiple registered nodes).
+   
+2002-03-04 17:26  hardaker
+
+   * configure.in , include/net-snmp/snmpv3_api.h ,
+   snmplib/Makefile.in:
+
+   use a configure generated wrapper header for v3 security modules.
+   
+2002-03-04 11:58  hardaker
+
+   * include/net-snmp/net-snmp-includes.h:
+
+   add dmalloc.h to the proper place.
+   
+2002-03-04 11:53  hardaker
+
+   * agent/mibgroup/disman/mteTriggerTable.c:
+
+   string clean ups.
+   
+2002-03-04 11:52  hardaker
+
+   * acconfig.h , aclocal.m4 , configure ,
+   configure.in , include/net-snmp/net-snmp-config.h.in ,
+   include/net-snmp/library/default_store.h ,
+   snmplib/snmp_parse_args.c , snmplib/snmpv3.c:
+
+   Implement a default version prompt for configure.
+    - (Wes ducks as this is currently set to '3' which he may have to
+       change as it hasn't exactly been agreed upon as the proper default yet).
+    - --with-default-snmp-version also created.
+    - changed handling of default store / snmp.conf usage but impact
+      should be low, hopefully.
+   
+2002-03-04 11:49  hardaker
+
+   * snmplib/snmp_api.c:
+
+   a few error strings slightly improved.  We really need to change the
+   way these are handled to get better improvement.
+   
+2002-03-04 07:49  hardaker
+
+   * testing/Makefile.in:
+
+   separate out the cleaning of /tmp from the main cleaning to provide it
+   as a special target.
+   
+2002-03-04 07:38  hardaker
+
+   * agent/mibgroup/agentx/protocol.c:
+
+   -Wall fixes.
+   
+2002-03-04 05:32  jbpn
+
+   * man/: snmpbulkget.1.def , snmpbulkwalk.1.def ,
+   snmpget.1.def , snmpgetnext.1.def , snmpstatus.1.def
+   , snmptest.1.def , snmptrap.1.def:
+
+     - remove further instances of positional community string parameter,
+       after Patrick Welche
+   
+2002-03-04 05:25  jbpn
+
+   * man/: snmpd.conf.5.def , snmpwalk.1.def:
+
+     - patches from Patrick Welche
+   
+2002-03-04 01:16  dts12
+
+   * agent/mibgroup/ucd-snmp/: memory.c (V4-2-patches.6), memory.c:
+
+   Correct debug output message (thanks to Jeroen Ruigrok)
+   
+2002-03-01 22:45  hardaker
+
+   * agent/mibgroup/agentx/protocol.c:
+
+   making the (same) debugging statement more useful.
+   
+2002-03-01 22:43  hardaker
+
+   * agent/mibgroup/agentx/protocol.c:
+
+   add missing newline to a debugging statement.
+   
+2002-03-01 12:49  hardaker
+
+   * snmplib/: keytools.c , mib.c , snmp_api.c ,
+   snmp_client.c , snmp_parse_args.c , snmpv3.c:
+
+   First pass at a few better error messages.
+   
+2002-03-01 12:01  hardaker
+
+   * mibs/Makefile.in:
+
+   don't install headers here.
+   
+2002-03-01 05:41  jbpn
+
+   * include/net-snmp/library/mib.h , snmplib/mib.c:
+
+     - add snprint_value, snprint_variable, snprint_objid
+   
+2002-02-28 06:54  dts12
+
+   * agent/snmp_vars.c , snmplib/snmpCallbackDomain.c ,
+   win32/libsnmp/libsnmp.dsp , win32/net-snmp/net-snmp-config.h:
+
+   Add back the 'snmpCallback' domain under Windows.
+   
+2002-02-27 10:04  jbpn
+
+   * apps/: snmpbulkget.c , snmpbulkwalk.c , snmpget.c
+   , snmpgetnext.c , snmpset.c , snmpstatus.c
+   , snmptable.c , snmptest.c , snmptranslate.c
+   , snmptrap.c , snmpusm.c , snmpwalk.c:
+
+     - tart up usage messages, make them more consistent and bring in line
+       with manual pages
+   
+2002-02-27 10:03  jbpn
+
+   * man/: snmpset.1.def , snmptable.1.def , snmptrap.1.def
+   , snmpusm.1.def:
+
+     - minor formatting changes
+   
+2002-02-27 10:03  jbpn
+
+   * snmplib/: mib.c , parse.c , snmp_parse_args.c:
+
+     - drop community positional parameter
+   
+     - tart up usage messages to be more consistent and in line with manual
+       pages
+   
+2002-02-27 09:47  dts12
+
+   * snmplib/: vacm.c (V4-2-patches.4), vacm.c:
+
+   Handle views that specify a full instance OID.
+   (Since the internally stored OID prepends the length as well,
+    the apparent length is one greater than it really is)
+   
+2002-02-27 06:50  jbpn
+
+   * apps/snmptrapd.c:
+
+     - [ADDRESSES] -> [LISTENING ADDRESSES] in usage message, to match
+       manual page.
+   
+2002-02-27 06:09  jbpn
+
+   * man/snmpd.conf.5.def:
+
+     - drop optional positional community parameter from trapsess
+       description.
+   
+2002-02-27 05:51  jbpn
+
+   * include/net-snmp/library/mib.h , snmplib/mib.c:
+
+     - drop sprint_blah functions
+   
+     - no snprint_blah yet
+   
+2002-02-27 05:43  jbpn
+
+   * snmplib/asn1.c:
+
+     - don't use sprint_blah functions
+   
+2002-02-27 05:40  jbpn
+
+   * snmplib/snmp_debug.c:
+
+     - don't use sprint_blah functions
+   
+     - drop archaic DEBUGP functions
+   
+2002-02-27 05:37  dts12
+
+   * agent/mibgroup/host/: hr_storage.c , hr_swrun.c:
+
+   Use the more informative 'output_api.h' header file name
+     (I must have missed these earlier)
+   
+2002-02-27 05:35  jbpn
+
+   * man/snmpcmd.1.def:
+
+     - drop community positional parameter
+   
+     - yes, for once the documentation has been updated *before* the
+   code!
+   
+2002-02-27 05:12  jbpn
+
+   * agent/mibgroup/mibII/ipv6.c:
+
+     - don't use obsolete DEBUGP function
+   
+2002-02-27 05:11  jbpn
+
+   * include/net-snmp/library/: snmp_api.h , snmp_debug.h ,
+   system.h:
+
+     - drop archaic DEBUGP functions
+   
+2002-02-27 05:10  jbpn
+
+   * include/net-snmp/library/scapi.h:
+
+     - don't use obsolete DEBUGPL function
+   
+2002-02-27 04:32  jbpn
+
+   * apps/snmpbulkwalk.c , apps/snmpdelta.c ,
+   apps/snmptable.c , apps/snmpusm.c , apps/snmpwalk.c
+   , agent/agent_index.c , agent/helpers/table.c:
+
+     - don't use sprint_blah functions
+   
+2002-02-27 02:26  jbpn
+
+   * agent/mibgroup/agentx/master.c:
+
+     - don't use sprint_variable
+   
+2002-02-27 02:08  jbpn
+
+   * agent/snmp_agent.c:
+
+     - don't use sprint_variable, no, I MEAN it this time
+   
+2002-02-27 02:05  jbpn
+
+   * agent/snmp_agent.c:
+
+     - don't use sprint_variable
+   
+2002-02-26 12:46  rstory
+
+   * agent/snmp_agent.c:
+
+   clear new memory after realloc() since realloc doesn't do it.
+   
+2002-02-26 12:30  hardaker
+
+   * perl/SNMP/SNMP.xs:
+
+   add UNSIGNED32
+   
+2002-02-26 08:55  jbpn
+
+   * agent/mibgroup/: kernel_sunos5.c , kernel_sunos5.h ,
+   mibII/at.c , mibII/icmp.c , mibII/interfaces.c ,
+   mibII/ip.c , mibII/tcp.c , mibII/udp.c ,
+   mibII/var_route.c:
+
+     - change cache implementation after some interesting profiling (see
+       lengthy new comment in kernel_sunos5.c)
+   
+2002-02-26 08:13  dts12
+
+   * agent/helpers/all_helpers.c , agent/helpers/table.c ,
+   agent/mibgroup/notification/snmpNotifyTable.c ,
+   agent/mibgroup/target/snmpTargetAddrEntry.c ,
+   agent/mibgroup/ucd-snmp/proxy.c , snmplib/snmp-tc.c ,
+   snmplib/ucd_compat.c:
+
+   Remove assorted extraneous ^M's
+   
+2002-02-26 07:14  dts12
+
+   * README.win32:
+
+   A quick guide to installing the Core Platform SDK, needed for the Windows agent.
+   
+2002-02-26 07:03  dts12
+
+   * agent/agent_trap.c , agent/snmp_vars.c ,
+   agent/snmpd.c , agent/helpers/table_dataset.c ,
+   agent/mibgroup/mibII/system_mib.c ,
+   agent/mibgroup/mibII/udp.c , agent/mibgroup/mibII/vacm_vars.c
+   , apps/snmptrapd_log.c ,
+   include/net-snmp/agent/agent_handler.h ,
+   include/net-snmp/agent/agent_trap.h ,
+   include/net-snmp/agent/table_dataset.h ,
+   include/net-snmp/library/mib.h ,
+   include/net-snmp/library/snmp_enum.h , snmplib/mib.c ,
+   snmplib/snmp_parse_args.c , snmplib/snmpv3.c ,
+   snmplib/winservice.c:
+
+   Assorted minor tweaks to ensure that the project builds under Visual C++.
+   Mostly because VC++ is fussy about sort-of-compatible data types
+     (e.g. signed vs unsigned integers).
+   
+2002-02-26 07:00  dts12
+
+   * win32/: mib_module_inits.h , win32.dsw , win32.opt
+   , libagent/libagent.dsp , libsnmp/libsnmp.dsp ,
+   libucdmibs/libucdmibs.dsp , netsnmpmibs/netsnmpmibs.dsp ,
+   snmpd/snmpd.dsp , snmptrapd/snmptrapd.dsp:
+
+   Rename 'libucdmibs' to reflect the change of project name,
+   and assorted tweaks so that the full project builds under Visual C++.
+     (N.B: The agent requires "Microsoft Platform Core SDK" in order
+       to build the 'netsnmpmibs' project)
+   
+2002-02-26 06:53  hardaker
+
+   * perl/AnyData_SNMP/Storage.pm:
+
+   remove duplicate variable in a warning
+   
+2002-02-26 06:40  jbpn
+
+   * agent/mibgroup/ucd-snmp/vmstat_solaris2.c:
+
+     - include net-snmp-config.h
+   
+2002-02-25 21:09  hardaker
+
+   * perl/AnyData_SNMP/INSTALL:
+
+   more install changes
+   
+2002-02-25 21:08  hardaker
+
+   * perl/AnyData_SNMP/INSTALL:
+
+   mention installing DBD::File.
+   
+2002-02-25 20:38  hardaker
+
+   * perl/AnyData_SNMP/INSTALL:
+
+   one too many '0's in a url.
+   
+2002-02-25 20:33  hardaker
+
+   * perl/AnyData_SNMP/INSTALL:
+
+   reword.
+   
+2002-02-25 20:30  hardaker
+
+   * perl/AnyData_SNMP/Storage.pm:
+
+   move warning outside secondary warning augmentation loop.
+   
+2002-02-25 20:29  hardaker
+
+   * perl/AnyData_SNMP/INSTALL:
+
+   update SQL::Statement module.
+   
+2002-02-25 16:25  rstory
+
+   * agent/helpers/table_array.c:
+
+   add find_table_array_handler(); remove debugging code/comments;
+   make sure we have the right handler before using the void pointer;
+   remove ^M characters
+   
+2002-02-25 11:57  hardaker
+
+   * snmplib/data_list.c , include/net-snmp/library/data_list.h:
+
+   2 new functions.
+   
+2002-02-25 11:18  hardaker
+
+   * perl/SNMP/SNMP.xs:
+
+   set security model
+   
+2002-02-25 08:15  dts12
+
+   * agent/helpers/all_helpers.c , agent/helpers/old_api.c
+   , agent/helpers/table.c , agent/helpers/table_array.c
+   , agent/helpers/table_dataset.c ,
+   agent/mibgroup/notification/snmpNotifyTable.c ,
+   agent/mibgroup/target/snmpTargetAddrEntry.c ,
+   agent/mibgroup/ucd-snmp/proxy.c ,
+   include/net-snmp/agent/agent_handler.h ,
+   include/net-snmp/agent/table.h , win32/win32.dsw:
+
+   Continuing improvements to compilation of the latest code under Visual C++.
+   The 'libhelpers' project now compiles, and this also addresses a number
+   of warnings and errors in the libagent and libucdmibs projects.
+     But these two still fail on 'OID_LENGTH' and 'iphlpapi.h'
+   
+2002-02-25 07:00  dts12
+
+   * win32/net-snmp/agent/mib_module_config.h:
+
+   Provide a plausible module configuration list for the Windows agent.
+   
+2002-02-25 06:04  jbpn
+
+   * mibs/NET-SNMP-AGENT-MIB.txt:
+
+     - resolve conflicting SYNTAXes for nsTransactionMode
+   
+     - add range for index nsTransactionID
+   
+2002-02-25 03:23  dts12
+
+   * win32/: libsnmp/libsnmp.dsp , libsnmp_dll/libsnmp_dll.dsp:
+
+   Ensure the main library compiles and works under Windows.
+   
+2002-02-25 03:19  dts12
+
+   * apps/: notification_log.h , snmptrapd.c:
+
+   Ensure snmptrapd compiles under Windows.
+   
+2002-02-25 03:09  dts12
+
+   * snmplib/: oid_array.c , oid_stash.c , snmp-tc.c ,
+   ucd_compat.c:
+
+   Minor tweaks to keep Visual C++ happy.
+   
+2002-02-25 02:57  dts12
+
+   * include/net-snmp/version.h:
+
+   Wrap with "extern C"
+   
+2002-02-25 02:56  dts12
+
+   * include/net-snmp/library/cmu_compat.h:
+
+   Pander to CPP's incredibly fussy nature, and provide the correct header file name.
+   
+2002-02-25 01:21  dts12
+
+   * agent/: snmpd.c (V4-2-patches.1), snmpd.c:
+
+   Specify the correct debug token for displaying the list of modules
+   (spotted by Brian Shaver)
+   
+2002-02-22 10:56  hardaker
+
+   * local/mib2c:
+
+   support @foreach $var1 $var2 enums@
+   
+2002-02-22 10:56  hardaker
+
+   * perl/AnyData_SNMP/snmpsh:
+
+   remove trailing ;'s from sql statements.
+   
+2002-02-22 10:55  hardaker
+
+   * include/net-snmp/library/tools.h , snmplib/tools.c:
+
+   define netsnmp_strdup_and_null
+   
+2002-02-22 10:53  hardaker
+
+   * include/net-snmp/net-snmp-includes.h:
+
+   include utilities.
+   
+2002-02-22 10:51  hardaker
+
+   * agent/helpers/table_iterator.c:
+
+   - don't loop again for secondary SET modes and cache information instead.
+   - various fixes.
+   
+2002-02-22 10:49  hardaker
+
+   * agent/helpers/Makefile.in:
+
+   fix install directories for headers
+   
+2002-02-22 10:49  hardaker
+
+   * net-snmp-config.in:
+
+   add --compile-subagent for automatted subagent compilation from
+   mibmodule .c files ;-)
+   
+2002-02-22 09:27  dts12
+
+   * snmplib/: MSG00001.bin, winservice.mc (V4-2-patches.[1,1]),
+   MSG00001.bin , winservice.mc:
+
+   Add missing files for Windows service operation.
+   
+2002-02-22 08:55  dts12
+
+   * agent/snmpd.c:
+
+   Just close the main session when shutting down under Windows,
+   not everything (so that it can still generate the shutdown trap).
+   
+2002-02-22 08:40  dts12
+
+   * include/net-snmp/types.h ,
+   include/net-snmp/library/snmp_impl.h , snmplib/asn1.c ,
+   snmplib/mib.c , snmplib/parse.c , snmplib/snmp_api.c
+   , snmplib/snmp_enum.c , snmplib/snmpv3.c:
+
+   Tweaks required to get the library compiling under Windows VC++
+   
+2002-02-22 08:37  dts12
+
+   * win32/: snmpsm_init.h ,
+   encode_keychange/encode_keychange.dsp ,
+   net-snmp/net-snmp-config.h , libagent/libagent.dsp ,
+   libhelpers/libhelpers.dsp , libsnmp/libsnmp.dsp ,
+   libsnmp_dll/libsnmp_dll.dsp , libucdmibs/libucdmibs.dsp
+   , snmpbulkget/snmpbulkget.dsp ,
+   snmpbulkwalk/snmpbulkwalk.dsp , snmpd/snmpd.dsp ,
+   snmpdelta/snmpdelta.dsp , snmpdf/snmpdf.dsp ,
+   snmpget/snmpget.dsp , snmpgetnext/snmpgetnext.dsp ,
+   snmpnetstat/snmpnetstat.dsp , snmpset/snmpset.dsp ,
+   snmpstatus/snmpstatus.dsp , snmptable/snmptable.dsp ,
+   snmptest/snmptest.dsp , snmptranslate/snmptranslate.dsp
+   , snmptrap/snmptrap.dsp , snmptrapd/snmptrapd.dsp
+   , snmpusm/snmpusm.dsp , snmpvacm/snmpvacm.dsp ,
+   snmpwalk/snmpwalk.dsp:
+
+   Provide Windows-specific versions of automatically-generated header files,
+   and add the new include structure to the project files.
+   
+2002-02-22 07:24  dts12
+
+   * include/net-snmp/library/transform_oids.h:
+
+   Define standard OID lengths here (where they're available to any
+   file wanting to access the OID structures)
+   
+2002-02-22 03:24  dts12
+
+   * snmplib/: snmp_parse_args.c , snmpv3.c:
+
+   Support ".... -3u {secName} ...." syntax
+   (in the normal getopt style - i.e. no need for surrounding quotes)
+   
+   It should now be possible to switch to this as the recommended form
+   for SNMPv3 options - if that's what we want to do.
+     Qn:  Do we want to?
+   
+2002-02-21 08:39  dts12
+
+   * snmplib/snmpv3.c:
+
+   Support "-3u {secName}" syntax (*with* the quotes, unfortunately).
+   Now comes the fun bit.....
+   
+2002-02-21 07:54  dts12
+
+   * win32/snmpd/snmpd.dsp:
+
+   Fix bogus structure comments in the snmpd project file.
+   
+2002-02-21 07:30  jbpn
+
+   * agent/mibgroup/: notification/snmpNotifyTable.c ,
+   target/snmpTargetAddrEntry.c:
+
+     - drop inline (more trouble than it is worth)
+   
+2002-02-21 05:00  dts12
+
+   * snmplib/: snmp_parse_args.c , snmpv3.c:
+
+   First pass at an SNMPv3 "combined-option" command-line flag (-3x).
+   (In *addition* to the current command-line flags, I hasten to add!)
+   
+   Supports  "... -3u{secName} ..." and "... -3u={secName} ..." syntax,
+   but not the separate "... -3u {secName} ..." style.
+   
+   I haven't touched the documentation or usage message to mention this.
+   
+2002-02-20 18:15  hardaker
+
+   * local/mib2c.iterate.conf:
+
+   use for instead of continue for loops.
+   
+2002-02-20 13:42  hardaker
+
+   * README.snmpv3 , agent/agent_read_config.c ,
+   agent/snmpd.c , apps/snmptrapd.c ,
+   include/net-snmp/agent/ds_agent.h:
+
+   - Add a --quit option (and a configuration token) so that you can now
+     create new users by simply calling snmpd as:
+       snmpd --createUser="myuser MD5 mypassword" --quit
+   - Change README.snmpv3 documentation to make use of this feature.
+   
+2002-02-20 06:16  jbpn
+
+   * apps/Makefile.in , apps/snmptrapd.c , configure
+   , configure.in , agent/snmp_agent.c:
+
+     - add libwrap support to snmptrapd (untested)
+   
+     - minor changes to snmpd libwrap support
+   
+     - configure fixes for libwrap
+   
+2002-02-20 03:07  jbpn
+
+   * apps/snmptrapd_log.c:
+
+     - use calloc instead of malloc to make sure buffer is initially
+       zero-terminated (in case of 0 varbinds).  Bug #518700, noted by
+       Andreas Hartmann.
+   
+2002-02-20 03:06  jbpn
+
+   * apps/snmpdelta.c:
+
+     - initialise some buffers, to avoid garbage printing problems, as
+       noted by Anonymous in bug #520220.
+   
+2002-02-20 03:03  dts12
+
+   * apps/Makefile.in:
+
+   Clean up the object files as well
+   
+2002-02-20 01:41  dts12
+
+   * man/.cvsignore:
+
+   Ignore the new crop of generated man pages.
+   
+2002-02-20 01:37  dts12
+
+   * mibs/NET-SNMP-AGENT-MIB.txt:
+
+   Supply missing double-quote  (oops)
+   
+2002-02-19 04:01  dts12
+
+   * apps/snmptranslate.c:
+
+   Initialise the library internals *before* parsing the command line,
+   so that defaults can be overridden by command line options.
+     Qn:  Should '_init_snmp' be invoked by 'snmp_parse_args' itself?
+   
+2002-02-19 03:59  dts12
+
+   * snmplib/mib.c:
+
+   Make sure that multiple output format flags work in a consistent manner.
+   (i.e. the last one is used, rather than relying on internal ordering).
+   
+2002-02-18 21:58  hardaker
+
+   * agent/mibgroup/: testdelayed.c , testhandler.c:
+
+   include stdlib.h
+   
+2002-02-18 21:52  hardaker
+
+   * agent/mibgroup/host/hr_disk.c:
+
+   fix includes
+   
+2002-02-18 21:51  hardaker
+
+   * agent/helpers/table_iterator.c ,
+   include/net-snmp/agent/table_iterator.h:
+
+   - make capability to create data contexts from a loop context (less
+     mallocs when mallocs aren't otherwise avoidable).
+   - don't double free the data context pointer.
+   
+2002-02-18 21:50  hardaker
+
+   * include/net-snmp/agent/net-snmp-agent-includes.h:
+
+   include all agent helpers.
+   
+2002-02-18 21:49  hardaker
+
+   * include/net-snmp/agent/multiplexer.h:
+
+   protect include from double include
+   
+2002-02-18 08:38  hardaker
+
+   * agent/mibgroup/mibincl.h:
+
+   fix include paths
+   
+2002-02-18 02:35  dts12
+
+   * agent/Makefile.in , snmplib/Makefile.in:
+
+   Tweak the list of header files to be installed (thanks to Christoph Mammitzsch)
+   
+2002-02-18 02:29  dts12
+
+   * agent/mibgroup/host/: hr_storage.c (V4-2-patches.7), hr_storage.c:
+
+   Remove a couple of unhelpful OSF definitions (thanks to Jeroen Ruigrok)
+   
+2002-02-18 00:13  hardaker
+
+   * snmplib/: asn1.c (V4-2-patches.3), asn1.c:
+
+   don't build oid's with >128 length subids.  (see bug #518855)
+   
+2002-02-16 23:18  hardaker
+
+   * mibs/: NET-SNMP-MIB.txt , NET-SNMP-MONITOR-MIB.txt ,
+   NET-SNMP-SYSTEM-MIB.txt , NET-SNMP-TC.txt:
+
+   white space clean up.  (AGENT-MIB not checked in due to other
+   incomplete changes).
+   
+2002-02-16 00:17  hardaker
+
+   * NEWS , agent/snmpd.c , apps/snmptrapd.c ,
+   include/net-snmp/library/default_store.h ,
+   include/net-snmp/library/read_config.h , snmplib/read_config.c
+   , snmplib/snmp_parse_args.c:
+
+   - finish implementing snmp_config("my config line")
+     - was done before, but previously had to be called only after
+       configuration files had been read.  Now can be called at any time.
+   - make all configuration options available as --longopts command line options.
+     - --something=value -> "something value"
+     - --something       -> "something 1" (works for setting booleans to true)
+   
+2002-02-16 00:02  hardaker
+
+   * agent/Makefile.in:
+
+   install mib_module_config.h
+   
+2002-02-16 00:01  hardaker
+
+   * configure , configure.in:
+
+   fix rpm for 4.0.3 and above (or whenever it was that we now need librpmdb)
+   
+2002-02-16 00:01  hardaker
+
+   * Makefile.in , Makefile.rules:
+
+   fix net-snmp-config install/clean/etc.
+   
+2002-02-15 22:34  hardaker
+
+   * Makefile.in , Makefile.rules:
+
+   install all system and machine files, since they include each other
+   
+2002-02-15 09:28  dts12
+
+   * agent/mibgroup/agent/nsTransactionTable.c ,
+   mibs/NET-SNMP-AGENT-MIB.txt , mibs/NET-SNMP-MIB.txt ,
+   mibs/NET-SNMP-MONITOR-MIB.txt , mibs/NET-SNMP-SYSTEM-MIB.txt
+   , mibs/NET-SNMP-TC.txt:
+
+   Skeleton framework for the Net-SNMP enterprise tree.
+   (incorporating the initial 'nsTransactionTable', but nothing else as yet)
+   
+2002-02-15 09:10  dts12
+
+   * apps/snmptable.c , apps/snmptranslate.c ,
+   snmplib/snmp_parse_args.c:
+
+   Remove support for deprecated command-line options.
+   
+2002-02-15 07:28  dts12
+
+   * include/net-snmp/library/winservice.h , snmplib/winservice.c
+   , agent/snmpd.c , snmplib/Makefile.in ,
+   snmplib/winservice.rc , win32/snmpd/snmpd.dsp:
+
+   Support for running as a Windows service.
+   (Supplied by Raju Krishnappa & Lathu Prabhu)
+   
+2002-02-15 07:25  dts12
+
+   * include/net-snmp/net-snmp-includes.h:
+
+   Stoke Wes' sense of paranoia by conceding without comment.
+       (What might Shield be plotting now......)
+   
+2002-02-15 07:19  jbpn
+
+   * man/snmpusm.1.def:
+
+     - fix tiny formatting error
+   
+2002-02-15 07:17  dts12
+
+   * mibs/Makefile.in:
+
+   Install NOTIFICATION-LOG-MIB (since it's one of the default load list!)
+   
+2002-02-15 06:47  dts12
+
+   * snmplib/winservice.h:
+
+   file winservice.h was initially added on branch V4-2-patches.
+   
+2002-02-15 06:47  dts12
+
+   * snmplib/winservice.rc:
+
+   file winservice.rc was initially added on branch V4-2-patches.
+   
+2002-02-15 06:47  dts12
+
+   * snmplib/winservice.c:
+
+   file winservice.c was initially added on branch V4-2-patches.
+   
+2002-02-15 06:08  dts12
+
+   * include/net-snmp/types.h:
+
+   Include the <sys/time.h> cascade, to pick up the definition of 'timeval'
+   
+2002-02-15 04:29  jbpn
+
+   * agent/snmpd.c:
+
+     - minor change to bring usage message in line with manpage
+   
+2002-02-15 03:29  dts12
+
+   * snmplib/snmp_parse_args.c:
+
+   Catch use of the transport and port options, and issue an appropriate
+   error message, describing use of the <hostname> parameter instead.
+   
+2002-02-15 03:11  dts12
+
+   * snmplib/: mib.c , snmp_api.c:
+
+   Set the default output format *before* processing command line options,
+   rather than after.  That's probably a bit more flexible:-)
+   
+2002-02-15 02:37  dts12
+
+   * include/net-snmp/: config_api.h , definitions.h ,
+   mib_api.h , output_api.h , pdu_api.h , session_api.h
+   , snmpv3_api.h , types.h , utilities.h ,
+   varbind_api.h:
+
+   Remove 'net-snmp-config.h' from the main API header files.
+   This will have to be #included separately (either explicitly
+   or via the all-in-one 'net-snmp-includes.h' header)
+   
+2002-02-15 02:31  dts12
+
+   * snmplib/Makefile.in:
+
+   Install the README to describe the status of <net-snmp/library> and <net-snmp> header files.
+   
+2002-02-15 02:13  dts12
+
+   * man/Makefile.in , mibs/Makefile.in:
+
+   Install the {system,machine}/*.h header files as well.
+   
+   Doing this via the 'man' & 'mibs' Makefiles is a gross hack,
+   and really needs to be handled more cleanly.  But it's the
+   best I can come up with at the moment.  Sorry - Dave.
+   
+2002-02-15 01:59  dts12
+
+   * snmplib/Makefile.in , agent/Makefile.in:
+
+   Install the UCD-compatability headers as well.
+   
+2002-02-15 01:57  dts12
+
+   * Makefile.rules:
+
+   Only install subdirectory stuff *once*.  (Don't be so enthusiastic, Dave!)
+   
+2002-02-15 01:31  dts12
+
+   * README.snmpv3:
+
+   Remove redundent '-CN' and '-CO' options from the example snmpusm command.
+     (as mentioned by Wes on the users mailing list 2002-02-13)
+     Qn: Does this need to be done on the V4-2-patches branch as well?
+   
+2002-02-15 01:15  dts12
+
+   * include/net-snmp/utilities.h , include/net-snmp/version.h
+   , include/net-snmp/library/version.h ,
+   include/ucd-snmp/version.h , snmplib/snmp_parse_args.c ,
+   snmplib/snmp_version.c:
+
+   Restore 'version.h' as being a "top-level" header file.
+   
+2002-02-15 01:13  dts12
+
+   * snmplib/Makefile.in:
+
+   Install the full set of library header files,
+   retaining the top-level vs library subdirectory split.
+   
+2002-02-15 01:10  dts12
+
+   * configure , configure.in:
+
+   Look for transport-related header files in the correct location.
+   
+2002-02-15 01:09  dts12
+
+   * Makefile.rules:
+
+   Ensure partial install targets recurse properly.
+   
+2002-02-14 08:18  dts12
+
+   * testing/eval_tools.sh:
+
+   Look for mib_module_config.h in the correct location
+   
+2002-02-14 08:06  hardaker
+
+   * man/Makefile.in:
+
+   fix man8 install definitions
+   
+2002-02-14 07:48  dts12
+
+   * Makefile.rules , net-snmp-config.in:
+
+   Substitute values into 'net-snmp-config' properly, and don't 'make clean' it away.
+   
+2002-02-14 07:22  dts12
+
+   * man/Makefile.in:
+
+   Tidy up after moving the library header files
+   
+2002-02-14 07:14  dts12
+
+   * configure , configure.in:
+
+   Tidy up after moving the library header files (including Makefile dependencies)
+   
+2002-02-14 07:10  dts12
+
+   * include/net-snmp/agent/agent_registry.h ,
+   snmplib/Makefile.depend , snmplib/default_store.c ,
+   snmplib/read_config.c , snmplib/snmp_debug.c ,
+   snmplib/snmp_logging.c , snmplib/snmp_parse_args.c ,
+   snmplib/system.c , snmplib/tools.c ,
+   agent/Makefile.depend , apps/Makefile.depend ,
+   apps/snmpbulkget.c , apps/snmpget.c , apps/snmpstatus.c
+   , apps/snmptranslate.c ,
+   apps/snmpnetstat/Makefile.depend , apps/snmpnetstat/main.c
+   , include/net-snmp/agent/snmp_agent.h ,
+   include/net-snmp/agent/snmp_vars.h ,
+   include/net-snmp/agent/table_array.h ,
+   include/net-snmp/library/data_list.h ,
+   include/net-snmp/library/oid_array.h ,
+   include/net-snmp/library/snmpAAL5PVCDomain.h ,
+   include/net-snmp/library/snmpCallbackDomain.h ,
+   include/net-snmp/library/snmpIPXDomain.h ,
+   include/net-snmp/library/snmpTCPDomain.h ,
+   include/net-snmp/library/snmpTCPIPv6Domain.h ,
+   include/net-snmp/library/snmpUDPDomain.h ,
+   include/net-snmp/library/snmpUDPIPv6Domain.h ,
+   include/net-snmp/library/snmpUnixDomain.h ,
+   include/net-snmp/library/snmp_transport.h , agent/agent_trap.c
+   , agent/helpers/Makefile.depend ,
+   agent/mibgroup/Makefile.depend , agent/mibgroup/host_res.h
+   , agent/mibgroup/mibII/vacm_vars.h ,
+   agent/mibgroup/snmpv3/usmUser.h:
+
+   Tidy up after moving the library header files (including Makefile dependencies)
+   
+2002-02-14 07:08  dts12
+
+   * agent/helpers/Makefile.in:
+
+   Remove an extraneous space from CPPFLAGS
+   
+2002-02-14 06:23  dts12
+
+   * include/net-snmp/: config_api.h , definitions.h ,
+   mib_api.h , net-snmp-includes.h , output_api.h ,
+   pdu_api.h , session_api.h , snmpv3_api.h , types.h
+   , utilities.h , varbind_api.h:
+
+   Separate out top-level "public API" library header files from the "internal"
+   library header files.  These are still available for use by application
+   developers, but this split makes it clearer what may change in the future
+   and what can be relied upon to be stable.
+   
+2002-02-14 06:19  dts12
+
+   * include/net-snmp/asn1.h , include/net-snmp/callback.h ,
+   include/net-snmp/cmu_compat.h , include/net-snmp/data_list.h
+   , include/net-snmp/default_store.h ,
+   include/net-snmp/getopt.h , include/net-snmp/int64.h ,
+   include/net-snmp/keytools.h , include/net-snmp/lcd_time.h
+   , include/net-snmp/libsnmp.h , include/net-snmp/md5.h
+   , include/net-snmp/mib.h , include/net-snmp/mt_support.h
+   , include/net-snmp/oid_array.h ,
+   include/net-snmp/oid_stash.h , include/net-snmp/parse.h ,
+   include/net-snmp/read_config.h , include/net-snmp/scapi.h
+   , include/net-snmp/snmp-tc.h , include/net-snmp/snmp.h
+   , include/net-snmp/snmpAAL5PVCDomain.h ,
+   include/net-snmp/snmpCallbackDomain.h ,
+   include/net-snmp/snmpIPXDomain.h ,
+   include/net-snmp/snmpTCPDomain.h ,
+   include/net-snmp/snmpTCPIPv6Domain.h ,
+   include/net-snmp/snmpUDPDomain.h ,
+   include/net-snmp/snmpUDPIPv6Domain.h ,
+   include/net-snmp/snmpUnixDomain.h ,
+   include/net-snmp/snmp_alarm.h , include/net-snmp/snmp_api.h
+   , include/net-snmp/snmp_client.h ,
+   include/net-snmp/snmp_debug.h , include/net-snmp/snmp_enum.h
+   , include/net-snmp/snmp_impl.h ,
+   include/net-snmp/snmp_locking.h ,
+   include/net-snmp/snmp_logging.h ,
+   include/net-snmp/snmp_parse_args.h ,
+   include/net-snmp/snmp_secmod.h ,
+   include/net-snmp/snmp_transport.h , include/net-snmp/snmpksm.h
+   , include/net-snmp/snmpusm.h , include/net-snmp/snmpv3.h
+   , include/net-snmp/system.h , include/net-snmp/tools.h
+   , include/net-snmp/transform_oids.h ,
+   include/net-snmp/ucd_compat.h , include/net-snmp/vacm.h ,
+   include/net-snmp/version.h , include/net-snmp/library/README
+   , include/net-snmp/library/asn1.h ,
+   include/net-snmp/library/callback.h ,
+   include/net-snmp/library/cmu_compat.h ,
+   include/net-snmp/library/data_list.h ,
+   include/net-snmp/library/default_store.h ,
+   include/net-snmp/library/getopt.h ,
+   include/net-snmp/library/int64.h ,
+   include/net-snmp/library/keytools.h ,
+   include/net-snmp/library/lcd_time.h ,
+   include/net-snmp/library/libsnmp.h ,
+   include/net-snmp/library/md5.h ,
+   include/net-snmp/library/mib.h ,
+   include/net-snmp/library/mt_support.h ,
+   include/net-snmp/library/oid_array.h ,
+   include/net-snmp/library/oid_stash.h ,
+   include/net-snmp/library/parse.h ,
+   include/net-snmp/library/read_config.h ,
+   include/net-snmp/library/scapi.h ,
+   include/net-snmp/library/snmp-tc.h ,
+   include/net-snmp/library/snmp.h ,
+   include/net-snmp/library/snmpAAL5PVCDomain.h ,
+   include/net-snmp/library/snmpCallbackDomain.h ,
+   include/net-snmp/library/snmpIPXDomain.h ,
+   include/net-snmp/library/snmpTCPDomain.h ,
+   include/net-snmp/library/snmpTCPIPv6Domain.h ,
+   include/net-snmp/library/snmpUDPDomain.h ,
+   include/net-snmp/library/snmpUDPIPv6Domain.h ,
+   include/net-snmp/library/snmpUnixDomain.h ,
+   include/net-snmp/library/snmp_alarm.h ,
+   include/net-snmp/library/snmp_api.h ,
+   include/net-snmp/library/snmp_client.h ,
+   include/net-snmp/library/snmp_debug.h ,
+   include/net-snmp/library/snmp_enum.h ,
+   include/net-snmp/library/snmp_impl.h ,
+   include/net-snmp/library/snmp_locking.h ,
+   include/net-snmp/library/snmp_logging.h ,
+   include/net-snmp/library/snmp_parse_args.h ,
+   include/net-snmp/library/snmp_secmod.h ,
+   include/net-snmp/library/snmp_transport.h ,
+   include/net-snmp/library/snmpksm.h ,
+   include/net-snmp/library/snmpusm.h ,
+   include/net-snmp/library/snmpv3.h ,
+   include/net-snmp/library/system.h ,
+   include/net-snmp/library/tools.h ,
+   include/net-snmp/library/transform_oids.h ,
+   include/net-snmp/library/ucd_compat.h ,
+   include/net-snmp/library/vacm.h ,
+   include/net-snmp/library/version.h , include/ucd-snmp/asn1.h
+   , include/ucd-snmp/callback.h ,
+   include/ucd-snmp/default_store.h , include/ucd-snmp/int64.h
+   , include/ucd-snmp/keytools.h , include/ucd-snmp/mib.h
+   , include/ucd-snmp/mibincl.h , include/ucd-snmp/parse.h
+   , include/ucd-snmp/read_config.h ,
+   include/ucd-snmp/scapi.h , include/ucd-snmp/snmp-tc.h ,
+   include/ucd-snmp/snmp.h , include/ucd-snmp/snmp_alarm.h ,
+   include/ucd-snmp/snmp_api.h , include/ucd-snmp/snmp_client.h
+   , include/ucd-snmp/snmp_debug.h ,
+   include/ucd-snmp/snmp_impl.h , include/ucd-snmp/snmp_logging.h
+   , include/ucd-snmp/snmp_parse_args.h ,
+   include/ucd-snmp/snmp_vars.h , include/ucd-snmp/snmpusm.h
+   , include/ucd-snmp/snmpv3.h , include/ucd-snmp/system.h
+   , include/ucd-snmp/tools.h ,
+   include/ucd-snmp/transform_oids.h , include/ucd-snmp/version.h
+   , snmplib/asn1.c , snmplib/callback.c ,
+   snmplib/data_list.c , snmplib/default_store.c ,
+   snmplib/int64.c , snmplib/keytools.c ,
+   snmplib/lcd_time.c , snmplib/md5.c , snmplib/mib.c
+   , snmplib/mt_support.c , snmplib/oid_array.c ,
+   snmplib/oid_stash.c , snmplib/parse.c ,
+   snmplib/read_config.c , snmplib/scapi.c ,
+   snmplib/snmp-tc.c , snmplib/snmp.c ,
+   snmplib/snmpAAL5PVCDomain.c , snmplib/snmpCallbackDomain.c
+   , snmplib/snmpIPXDomain.c , snmplib/snmpTCPDomain.c
+   , snmplib/snmpTCPIPv6Domain.c , snmplib/snmpUDPDomain.c
+   , snmplib/snmpUDPIPv6Domain.c ,
+   snmplib/snmpUnixDomain.c , snmplib/snmp_alarm.c ,
+   snmplib/snmp_api.c , snmplib/snmp_auth.c ,
+   snmplib/snmp_client.c , snmplib/snmp_debug.c ,
+   snmplib/snmp_enum.c , snmplib/snmp_logging.c ,
+   snmplib/snmp_parse_args.c , snmplib/snmp_secmod.c ,
+   snmplib/snmp_transport.c , snmplib/snmp_version.c ,
+   snmplib/snmpksm.c , snmplib/snmpusm.c , snmplib/snmpv3.c
+   , snmplib/system.c , snmplib/tools.c ,
+   snmplib/vacm.c:
+
+   Separate out top-level "public API" library header files from the "internal"
+   library header files.  These are still available for use by application
+   developers, but this split makes it clearer what may change in the future
+   and what can be relied upon to be stable.
+   
+2002-02-14 04:41  dts12
+
+   * include/net-snmp/definitions.h ,
+   include/net-snmp/net-snmp-config.h.in ,
+   include/net-snmp/output_api.h , include/net-snmp/snmp_impl.h
+   , include/net-snmp/snmpv3_api.h , snmplib/asn1.c ,
+   snmplib/callback.c , snmplib/default_store.c ,
+   snmplib/int64.c , snmplib/keytools.c ,
+   snmplib/lcd_time.c , snmplib/md5.c , snmplib/mib.c
+   , snmplib/oid_stash.c , snmplib/parse.c ,
+   snmplib/read_config.c , snmplib/scapi.c ,
+   snmplib/snmp-tc.c , snmplib/snmp.c ,
+   snmplib/snmpAAL5PVCDomain.c , snmplib/snmpCallbackDomain.c
+   , snmplib/snmpIPXDomain.c , snmplib/snmpTCPDomain.c
+   , snmplib/snmpTCPIPv6Domain.c , snmplib/snmpUDPDomain.c
+   , snmplib/snmpUDPIPv6Domain.c ,
+   snmplib/snmpUnixDomain.c , snmplib/snmp_alarm.c ,
+   snmplib/snmp_api.c , snmplib/snmp_auth.c ,
+   snmplib/snmp_client.c , snmplib/snmp_debug.c ,
+   snmplib/snmp_logging.c , snmplib/snmp_parse_args.c ,
+   snmplib/snmp_secmod.c , snmplib/snmp_transport.c ,
+   snmplib/snmpksm.c , snmplib/snmpusm.c , snmplib/snmpv3.c
+   , snmplib/system.c , snmplib/tools.c ,
+   snmplib/vacm.c:
+
+   First moves towards using the "public" API header files in the library
+   code as well (concentrating on output/config/utility header files).
+   
+2002-02-14 03:17  dts12
+
+   * configure , configure.in:
+
+   Close a dangling "if" block.   (oops!)
+   
+2002-02-14 01:47  dts12
+
+   * apps/snmpnetstat/: if.c (V4-2-patches.4), if.c:
+
+   Check for running off the end of I/F table (patch from RedHat)
+   
+2002-02-14 01:43  dts12
+
+   * agent/mibgroup/host/hr_swinst.c:
+
+   Latest RedHat rpm-related patch
+   
+2002-02-14 01:39  dts12
+
+   * configure , configure.in:
+
+   Adopt RedHat's configure testing for RPM libraries
+   
+2002-02-13 08:39  hardaker
+
+   * perl/SNMP/SNMP.xs:
+
+   Make John trust his code
+   
+2002-02-13 08:34  jbpn
+
+   * perl/SNMP/SNMP.xs:
+
+     - transport fixes (untested, still #if 0)
+   
+2002-02-13 08:03  hardaker
+
+   * perl/SNMP/SNMP.xs:
+
+   mark some John-to-do-sections
+   
+2002-02-13 07:57  dts12
+
+   * include/net-snmp/default_store.h , man/snmpcmd.1.def ,
+   snmplib/mib.c:
+
+   Switch to using -OS style output by default, and drop the requirement
+   for full OIDs to start with '.', plus command-line options to restore
+   the original UCD-style behaviour.
+   
+2002-02-13 07:36  dts12
+
+   * apps/snmptable.c:
+
+   Apply John's fix for bugs #489336 and #508146 (duplicate columns and
+   columns in wrong order) to the main branch as well.
+   
+2002-02-12 16:40  hardaker
+
+   * snmplib/snmp_client.c:
+
+   const changes.
+   
+2002-02-12 16:39  hardaker
+
+   * perl/: .cvsignore , ASN/.cvsignore , agent/.cvsignore
+   , default_store/.cvsignore:
+
+   add .cvsignore file.
+   
+2002-02-12 16:38  hardaker
+
+   * include/net-snmp/agent/net-snmp-agent-includes.h:
+
+   add agent/agent_handler.h
+   
+2002-02-12 16:38  hardaker
+
+   * include/net-snmp/snmp_client.h:
+
+   const additions.
+   
+2002-02-12 16:37  hardaker
+
+   * include/net-snmp/net-snmp-includes.h:
+
+   Add string.h
+   
+2002-02-12 16:37  hardaker
+
+   * agent/mibgroup/notification/snmpNotifyTable.c:
+
+   add header.
+   
+2002-02-12 16:37  hardaker
+
+   * agent/mibgroup/disman/mteTriggerTable.c:
+
+   fixes to reenable disman event stuff for 5.0 code.  Not done the
+   "right" way, but it works.
+   
+2002-02-12 16:36  hardaker
+
+   * agent/helpers/old_api.c:
+
+   - -Wall fixes
+   
+2002-02-12 16:36  hardaker
+
+   * agent/helpers/instance.c:
+
+   - add stdlib.h
+   - remove unused variable.
+   
+2002-02-12 16:35  hardaker
+
+   * agent/snmp_agent.c:
+
+   remove no longer used "dump_var" routine.
+   
+2002-02-12 16:35  hardaker
+
+   * agent/agent_handler.c ,
+   include/net-snmp/agent/agent_handler.h:
+
+   const specific changes.
+   
+2002-02-12 16:34  hardaker
+
+   * NEWS:
+
+   added new perl specific features.
+   
+2002-02-12 16:34  hardaker
+
+   * Makefile.in:
+
+   .PHNOY mods
+   
+2002-02-12 07:22  dts12
+
+   * agent/Makefile.depend , apps/Makefile.depend ,
+   apps/snmptranslate.c , apps/snmptrapd_handlers.c ,
+   apps/snmpnetstat/Makefile.depend ,
+   include/net-snmp/net-snmp-includes.h ,
+   include/net-snmp/logging_api.h , include/net-snmp/output_api.h:
+
+   Rename the logging & related output API header file, to better
+   reflect the scope of this API.  (As suggested by Wes & John)
+   
+2002-02-12 07:21  jbpn
+
+   * configure.in:
+
+     - amend fix to bug #516389 (ucd-snmp 4.2.3 libwrap support broken) to
+       actually add -lnsl to link parameters!
+   
+2002-02-12 05:39  jbpn
+
+   * configure.in:
+
+     - fix bug #516389 (ucd-snmp 4.2.3 libwrap support broken) -- USE_LIBWRAP
+       was not being #defined in the case where -lnsl is needed in addition
+       to -lwrap.
+   
+2002-02-11 15:56  hardaker
+
+   * agent/Makefile.in:
+
+   lib dependency fix for snmpd target
+   
+2002-02-11 08:29  dts12
+
+   * include/net-snmp/cmu_compat.h , include/net-snmp/mib.h
+   , include/net-snmp/mib_api.h ,
+   include/net-snmp/net-snmp-includes.h ,
+   include/net-snmp/parse.h , include/net-snmp/session_api.h
+   , include/net-snmp/snmp.h , include/net-snmp/snmp_api.h
+   , include/net-snmp/snmp_impl.h ,
+   include/net-snmp/ucd_compat.h , snmplib/cmu_compat.c ,
+   snmplib/Makefile.in , snmplib/mib.c , snmplib/parse.c
+   , snmplib/snmp_api.c , snmplib/ucd_compat.c:
+
+   Extract CMU_COMPATABILITY code, and explicitly deprecated UCD code into separate files.
+   
+2002-02-11 08:23  dts12
+
+   * snmplib/: snmp_parse_args.c (V4-2-patches.2), snmp_parse_args.c:
+
+   Use the 'ds_set_xxx' library routines, rather than the old 'snmp_set_xxx' calls
+   
+2002-02-11 04:45  jbpn
+
+   * man/: snmp.conf.5.def , snmp_config.5.def ,
+   snmptrapd.conf.5.def:
+
+   minor spelling tweaks
+   
+2002-02-11 04:27  jbpn
+
+   * man/: Makefile.in , default_store.3.top , mib_api.3
+   , mib_api.3.def , snmp_agent_api.3 ,
+   snmp_agent_api.3.def , snmp_alarm.3 , snmp_alarm.3.def
+   , snmp_api.3 , snmp_api.3.def , snmp_sess_api.3
+   , snmp_sess_api.3.def , snmp_trap_api.3 ,
+   snmp_trap_api.3.def , variables.5 , variables.5.def:
+
+     - generate the rest of the manual pages (to get version in footer)
+   
+2002-02-08 15:56  hardaker
+
+   * win32/: config.h , mib_module_config.h ,
+   mib_module_inits.h , libsnmp/libsnmp.dsp ,
+   libsnmp_dll/libsnmp.def , libsnmp_dll/libsnmp_dll.dsp ,
+   libucdmibs/libucdmibs.dsp , snmpd/snmpd.dsp:
+
+   win32 specific portions of patch 503256
+   
+2002-02-08 15:53  hardaker
+
+   * win32/libhelpers/libhelpers.dsp:
+
+   patch#503256: helpers library definition for win32
+   
+2002-02-08 09:08  jbpn
+
+   * man/snmpd.conf.5.def:
+
+     - minor format tweakage
+   
+2002-02-08 08:22  dts12
+
+   * man/: mib_api.3 , snmp_agent_api.3 , snmp_alarm.3
+   , snmp_api.3 , snmp_sess_api.3 , snmp_trap_api.3:
+
+   Reference the new header-files in section 3 man page synopses.
+   
+2002-02-08 07:50  jbpn
+
+   * man/: mib_api.3 , read_config.3.def , snmp_agent_api.3
+   , snmp_config.5.def , snmp_trap_api.3 ,
+   snmpcmd.1.def , snmpconf.1.def , snmpd.conf.5.def ,
+   variables.5:
+
+     - more minor tweaks (ucd-snmp -> Net-SNMP etc.)
+   
+2002-02-08 07:48  hardaker
+
+   * agent/Makefile.depend:
+
+   remove local modules from dependency list
+   
+2002-02-08 07:45  dts12
+
+   * agent/: agent_handler.c , agent_index.c ,
+   agent_read_config.c , agent_registry.c , agent_trap.c
+   , auto_nlist.c , kernel.c , mib_modules.c ,
+   snmp_agent.c , snmp_vars.c , snmpd.c ,
+   helpers/bulk_to_next.c , helpers/debug_handler.c ,
+   helpers/instance.c , helpers/multiplexer.c ,
+   helpers/null.c , helpers/old_api.c , helpers/read_only.c
+   , helpers/serialize.c , helpers/table.c ,
+   helpers/table_array.c , helpers/table_data.c ,
+   helpers/table_dataset.c , helpers/table_iterator.c ,
+   mibgroup/header_complex.c , mibgroup/kernel_sunos5.c ,
+   mibgroup/testdelayed.c , mibgroup/testhandler.c ,
+   mibgroup/util_funcs.c , mibgroup/Rmon/agutil.c ,
+   mibgroup/Rmon/alarm.c , mibgroup/Rmon/event.c ,
+   mibgroup/Rmon/history.c , mibgroup/Rmon/rows.c ,
+   mibgroup/Rmon/statistics.c ,
+   mibgroup/agent/nsTransactionTable.c ,
+   mibgroup/agentx/agentx_config.c , mibgroup/agentx/client.c
+   , mibgroup/agentx/master.c ,
+   mibgroup/agentx/master_admin.c ,
+   mibgroup/agentx/master_request.c , mibgroup/agentx/protocol.c
+   , mibgroup/agentx/subagent.c ,
+   mibgroup/disman/mteObjectsTable.c ,
+   mibgroup/disman/mteTriggerBooleanTable.c ,
+   mibgroup/disman/mteTriggerDeltaTable.c ,
+   mibgroup/disman/mteTriggerExistenceTable.c ,
+   mibgroup/disman/mteTriggerTable.c ,
+   mibgroup/disman/mteTriggerThresholdTable.c ,
+   mibgroup/examples/example.c ,
+   mibgroup/examples/ucdDemoPublic.c ,
+   mibgroup/host/hr_filesys.c , mibgroup/host/hr_storage.c
+   , mibgroup/host/hr_swinst.c , mibgroup/host/hr_swrun.c
+   , mibgroup/host/hr_system.c , mibgroup/mibII/at.c
+   , mibgroup/mibII/icmp.c , mibgroup/mibII/interfaces.c
+   , mibgroup/mibII/ip.c , mibgroup/mibII/ipAddr.c ,
+   mibgroup/mibII/ipv6.c , mibgroup/mibII/kernel_linux.c ,
+   mibgroup/mibII/mta_sendmail.c , mibgroup/mibII/route_write.c
+   , mibgroup/mibII/snmp_mib.c ,
+   mibgroup/mibII/sysORTable.c , mibgroup/mibII/system_mib.c
+   , mibgroup/mibII/tcp.c , mibgroup/mibII/tcpTable.c
+   , mibgroup/mibII/udp.c , mibgroup/mibII/udpTable.c
+   , mibgroup/mibII/vacm_context.c ,
+   mibgroup/mibII/vacm_vars.c , mibgroup/mibII/var_route.c
+   , mibgroup/misc/dlmod.c , mibgroup/misc/ipfwacc.c
+   , mibgroup/notification/snmpNotifyFilterProfileTable.c ,
+   mibgroup/notification/snmpNotifyFilterTable.c ,
+   mibgroup/notification/snmpNotifyTable.c ,
+   mibgroup/smux/smux.c , mibgroup/smux/snmp_bgp.c ,
+   mibgroup/smux/snmp_ospf.c , mibgroup/smux/snmp_rip2.c ,
+   mibgroup/snmpv3/snmpEngine.c , mibgroup/snmpv3/snmpMPDStats.c
+   , mibgroup/snmpv3/usmStats.c ,
+   mibgroup/snmpv3/usmUser.c ,
+   mibgroup/target/snmpTargetAddrEntry.c ,
+   mibgroup/target/snmpTargetParamsEntry.c ,
+   mibgroup/target/target.c , mibgroup/target/target_counters.c
+   , mibgroup/tunnel/tunnel.c , mibgroup/ucd-snmp/disk.c
+   , mibgroup/ucd-snmp/diskio.c , mibgroup/ucd-snmp/dlmod.c
+   , mibgroup/ucd-snmp/errormib.c ,
+   mibgroup/ucd-snmp/extensible.c , mibgroup/ucd-snmp/file.c
+   , mibgroup/ucd-snmp/hpux.c ,
+   mibgroup/ucd-snmp/lmSensors.c , mibgroup/ucd-snmp/loadave.c
+   , mibgroup/ucd-snmp/logmatch.c ,
+   mibgroup/ucd-snmp/memory.c , mibgroup/ucd-snmp/memory_dynix.c
+   , mibgroup/ucd-snmp/memory_freebsd2.c ,
+   mibgroup/ucd-snmp/memory_netbsd1.c ,
+   mibgroup/ucd-snmp/memory_solaris2.c ,
+   mibgroup/ucd-snmp/pass.c , mibgroup/ucd-snmp/pass_persist.c
+   , mibgroup/ucd-snmp/proc.c , mibgroup/ucd-snmp/proxy.c
+   , mibgroup/ucd-snmp/registry.c ,
+   mibgroup/ucd-snmp/versioninfo.c , mibgroup/ucd-snmp/vmstat.c
+   , mibgroup/ucd-snmp/vmstat_bsdi4.c ,
+   mibgroup/ucd-snmp/vmstat_dynix.c ,
+   mibgroup/ucd-snmp/vmstat_freebsd2.c ,
+   mibgroup/ucd-snmp/vmstat_netbsd1.c ,
+   mibgroup/ucd-snmp/vmstat_solaris2.c:
+
+   Use the new 'net-snmp-includes' single-include header files,
+   in place of the (uninstalled) 'mibincl.h'.
+     Wheeeee......
+   
+2002-02-08 07:17  jbpn
+
+   * man/: snmp.conf.5.def , snmp_agent_api.3 ,
+   snmp_alarm.3 , snmp_api.3 , snmp_config.5.def ,
+   snmp_sess_api.3 , snmpd.1.def , snmpd.conf.5.def ,
+   snmptrapd.conf.5.def:
+
+     - some editing to make style consistent, add some missing options,
+       change ucd-snmp to Net-SNMP and things like that.
+   
+2002-02-08 07:14  jbpn
+
+   * man/Makefile.in:
+
+     - generate man pages at compile time
+   
+2002-02-08 07:14  jbpn
+
+   * man/: snmpbulkget.1 , snmpbulkwalk.1 ,
+   snmpbulkget.1.def , snmpbulkwalk.1.def , snmpcmd.1
+   , snmpcmd.1.def , snmpconf.1 , snmpconf.1.def
+   , snmpget.1 , snmpget.1.def , snmpgetnext.1 ,
+   snmpgetnext.1.def , snmpset.1 , snmpset.1.def ,
+   snmpstatus.1 , snmpstatus.1.def , snmptable.1 ,
+   snmptable.1.def , snmptest.1 , snmptest.1.def ,
+   snmptranslate.1 , snmptranslate.1.def , snmptrap.1
+   , snmptrap.1.def , snmpusm.1 , snmpusm.1.def ,
+   snmpwalk.1 , snmpwalk.1.def , snmptrapd.8 ,
+   snmptrapd.8.def:
+
+     - rename man pages which are now generated at compile time in order
+       to pick up the version (which gets put in the footer).
+   
+     - also some editing to make style consistent, add some missing options,
+       change ucd-snmp to Net-SNMP and things like that.
+   
+2002-02-08 06:48  dts12
+
+   * agent/mibgroup/: mibJJ.h , mibJJ/icmp.c , mibJJ/icmp.h
+   , mibJJ/if_fields.h , mibJJ/interfaces.c ,
+   mibJJ/interfaces.h , mibJJ/ip.c , mibJJ/ip.h ,
+   mibJJ/ipAddr.c , mibJJ/ipAddr.h , mibJJ/ipMedia.c ,
+   mibJJ/ipMedia.h , mibJJ/ipRoute.c , mibJJ/ipRoute.h
+   , mibJJ/ipv6.c , mibJJ/ipv6.h , mibJJ/kernel_hpux.c
+   , mibJJ/kernel_hpux.h , mibJJ/kernel_linux.c ,
+   mibJJ/kernel_linux.h , mibJJ/snmp_mib.c ,
+   mibJJ/snmp_mib.h , mibJJ/sysORTable.c ,
+   mibJJ/sysORTable.h , mibJJ/system_mib.c ,
+   mibJJ/system_mib.h , mibJJ/tcp.c , mibJJ/tcp.h ,
+   mibJJ/tcpTable.c , mibJJ/tcpTable.h , mibJJ/udp.c ,
+   mibJJ/udp.h , mibJJ/udpTable.c , mibJJ/udpTable.h ,
+   mibJJ/vacm_vars.c , mibJJ/vacm_vars.h:
+
+   Remove the attempted 'mibII' re-write.
+   If we want to tidy up mibII, it makes more sense to use the new agent APIs.
+   
+2002-02-08 06:45  dts12
+
+   * include/net-snmp/: net-snmp-includes.h ,
+   agent/net-snmp-agent-includes.h:
+
+   Bring single-include header files closer in line with the existing "mibincl.h" file
+   
+2002-02-08 06:09  dts12
+
+   * agent/mibgroup/mibII/: sysORTable.h (V4-2-patches.1),
+   sysORTable.h:
+
+   Ensure the null versions of the two REGISTER macros swallow their parameters.
+   
+2002-02-08 04:36  dts12
+
+   * agent/snmp_agent.c:
+
+   Implement the missing outgoing error statistics counters
+   (patch #510194 from Latha Prabhu)
+   
+2002-02-08 02:42  dts12
+
+   * agent/mibgroup/: host/hr_storage.c, ucd-snmp/memory.c
+   (V4-2-patches.[6,3]), host/hr_storage.c , ucd-snmp/memory.c:
+
+   Added support for memory and swap entries in hrStorageTable for Solaris
+   (from patch #505498 - thanks to Johannes Schmidt-Fischer)
+   
+2002-02-08 02:07  dts12
+
+   * agent/mibgroup/mibII/ip.c:
+
+   Consolidate identical MIB object entries (WIN32/non-WIN32)
+   
+2002-02-08 00:50  jbpn
+
+   * man/README:
+
+     - remove chronically dated unhelpful README
+   
+2002-02-07 13:33  hardaker
+
+   * Makefile.in , Makefile.rules , configure ,
+   configure.in , makefileindepend.pl ,
+   agent/Makefile.depend , agent/Makefile.in ,
+   agent/agent_trap.c , agent/mib_modules.c ,
+   agent/snmp_agent.c , agent/snmpd.c ,
+   agent/helpers/Makefile.depend , agent/helpers/Makefile.in
+   , agent/mibgroup/Makefile.depend ,
+   agent/mibgroup/Makefile.in , agent/mibgroup/mibincl.h ,
+   agent/mibgroup/agentx/agentx_config.c ,
+   agent/mibgroup/agentx/subagent.c , apps/Makefile.depend
+   , apps/Makefile.in , apps/snmpnetstat/Makefile.depend
+   , apps/snmpnetstat/Makefile.in , local/Makefile.in
+   , man/Makefile.in , mibs/Makefile.in ,
+   snmplib/Makefile.depend , snmplib/Makefile.in:
+
+   remake make's Makefile's to make better making
+   
+2002-02-07 13:31  hardaker
+
+   * perl/SNMP/Makefile.PL:
+
+   check local pathes
+   
+2002-02-07 12:54  dts12
+
+   * agent/snmp_agent.c:
+
+   Ensure agent returns the correct error codes for UNDO and COMMIT failures.
+   
+2002-02-07 11:18  hardaker
+
+   * perl/SNMP/: Makefile.PL , SNMP.xs , t/startagent.pl:
+
+   attempt at porting Joe's SNMP module to net-snmp.
+   It compiles, but only some of the tests succeed.
+   
+2002-02-07 10:09  jbpn
+
+   * man/: default_store.3.top , mib_api.3 ,
+   read_config.3.def , snmp.conf.5.def , snmp_agent_api.3
+   , snmp_alarm.3 , snmp_api.3 , snmp_config.5.def
+   , snmp_sess_api.3 , snmp_trap_api.3 , snmpbulkget.1
+   , snmpbulkwalk.1 , snmpconf.1 , snmpd.conf.5.def
+   , snmpdelta.1 , snmpdf.1 , snmpget.1 ,
+   snmpgetnext.1 , snmpnetstat.1 , snmpset.1 ,
+   snmpstatus.1 , snmptable.1 , snmptest.1 ,
+   snmptranslate.1 , snmptrap.1 , snmptrapd.conf.5.def
+   , snmpusm.1 , snmpwalk.1 , variables.5:
+
+     - add Net-SNMP in header of all man pages
+   
+2002-02-07 09:52  jbpn
+
+   * man/snmpcmd.1:
+
+     - update style to match snmpd and snmptrapd man pages
+   
+2002-02-07 08:15  jbpn
+
+   * man/snmptrapd.8:
+
+     - fix speeling mistake
+   
+2002-02-07 08:00  jbpn
+
+   * man/snmptrapd.8:
+
+     - bring up to date with snmptrapd
+   
+2002-02-07 07:28  dts12
+
+   * README.hpux11 , acconfig.h ,
+   agent/mibgroup/ucd_snmp.h , agent/mibgroup/host/hr_network.c
+   , agent/mibgroup/host/hr_storage.c ,
+   agent/mibgroup/host/hr_swinst.c ,
+   agent/mibgroup/host/hr_swrun.c , agent/mibgroup/mibII/at.c
+   , agent/mibgroup/mibII/icmp.c ,
+   agent/mibgroup/mibII/interfaces.c ,
+   agent/mibgroup/mibII/interfaces.h , agent/mibgroup/mibII/ip.c
+   , agent/mibgroup/mibII/ipAddr.c ,
+   agent/mibgroup/mibII/tcp.c , agent/mibgroup/mibII/tcpTable.c
+   , agent/mibgroup/mibII/tcpTable.h ,
+   agent/mibgroup/mibII/udp.c , agent/mibgroup/mibII/udpTable.c
+   , agent/mibgroup/mibII/var_route.c ,
+   agent/mibgroup/mibII/var_route.h ,
+   agent/mibgroup/ucd-snmp/memory.c ,
+   include/net-snmp/net-snmp-config.h.in ,
+   include/net-snmp/system/hpux.h , mibs/UCD-SNMP-MIB.txt:
+
+   Support for HP-UX 11, courtesy of Johannes Schmidt-Fischer.
+   
+2002-02-07 06:30  jbpn
+
+   * man/snmpd.1.def:
+
+     - alphabetise options
+   
+     - bring man page in line with new positional arguments listening
+       address specification and add section describing that
+   
+     - put Net-SNMP in header
+   
+2002-02-06 10:06  jbpn
+
+   * include/net-snmp/scapi.h:
+
+     - fix bug noted by Niels
+   
+2002-02-06 09:25  jbpn
+
+   * apps/: encode_keychange.c , snmpusm.c:
+
+     - minor tweaks due to change in definition of USM OIDs.
+   
+2002-02-06 09:17  jbpn
+
+   * include/net-snmp/snmpusm.h , include/net-snmp/snmpv3.h
+   , include/net-snmp/transform_oids.h ,
+   snmplib/snmp_parse_args.c , snmplib/snmpusm.c ,
+   snmplib/snmpv3.c:
+
+     - move USM OID definitions into snmpusm.c, make them const
+   
+     - consequent increase in const-ness in some function prototypes
+   
+2002-02-06 09:12  hardaker
+
+   * include/net-snmp/net-snmp-includes.h:
+
+   remove internal note about v3 api, which should be public
+   
+2002-02-06 09:12  hardaker
+
+   * include/net-snmp/snmpusm_init.h:
+
+   removed unneeded file
+   
+2002-02-06 09:06  jbpn
+
+   * include/net-snmp/keytools.h , include/net-snmp/scapi.h
+   , snmplib/keytools.c , snmplib/scapi.c:
+
+     - add const-ness for transform type args
+   
+2002-02-06 09:01  jbpn
+
+   * include/net-snmp/mib.h , include/net-snmp/snmp_debug.h
+   , snmplib/mib.c , snmplib/snmp_debug.c:
+
+     - add some const-ness for OID args (mainly so that debugmsg_oid takes
+       const).
+   
+2002-02-06 08:44  dts12
+
+   * agent/agent_read_config.c , agent/mibgroup/ucd_snmp.h
+   , agent/mibgroup/host/hr_filesys.c ,
+   agent/mibgroup/host/hr_storage.c ,
+   agent/mibgroup/ucd-snmp/loadave.c ,
+   agent/mibgroup/ucd-snmp/memory_dynix.c ,
+   agent/mibgroup/ucd-snmp/memory_dynix.h ,
+   agent/mibgroup/ucd-snmp/vmstat_dynix.c ,
+   agent/mibgroup/ucd-snmp/vmstat_dynix.h ,
+   include/net-snmp/system/dynix.h ,
+   agent/mibgroup/host/hr_swrun.c , agent/mibgroup/mibII/at.c
+   , agent/mibgroup/mibII/interfaces.c ,
+   agent/mibgroup/mibII/route_write.c ,
+   agent/mibgroup/mibII/var_route.c , snmplib/snmp_api.c:
+
+   Support for Dynix/PTX 4.4, courtesy of Patrick Hess.
+   
+2002-02-06 07:41  jbpn
+
+   * include/net-snmp/snmp_api.h , snmplib/snmp_api.c:
+
+     - make first argument of snmp_dup_objid() const.
+   
+     - better handle NULL values in snmp_dup_objid().
+   
+2002-02-06 07:09  dts12
+
+   * FAQ , man/snmp_trap_api.3:
+
+   Clarify the applicability of 'snmp_trap_api(3)' routines to AgentX subagents.
+   
+2002-02-06 05:58  dts12
+
+   * apps/: encode_keychange.c , notification_log.c ,
+   snmpbulkget.c , snmpbulkwalk.c , snmpdelta.c ,
+   snmpdf.c , snmpget.c , snmpgetnext.c , snmpset.c
+   , snmpstatus.c , snmptable.c , snmptest.c ,
+   snmptranslate.c , snmptrap.c , snmptrapd.c ,
+   snmptrapd_handlers.c , snmptrapd_log.c , snmpusm.c
+   , snmpvacm.c , snmpwalk.c , snmpnetstat/if.c
+   , snmpnetstat/inet.c , snmpnetstat/inet6.c ,
+   snmpnetstat/main.c , snmpnetstat/route.c:
+
+   Applications amended to use the new-style library header structure.
+   (In most cases, simply including the single "full API" header file)
+   
+2002-02-06 05:55  dts12
+
+   * include/net-snmp/: asn1.h , config_api.h ,
+   definitions.h , logging_api.h , mib_api.h ,
+   net-snmp-includes.h , pdu_api.h , session_api.h ,
+   snmpv3_api.h , types.h , utilities.h , varbind_api.h:
+
+   Framework for new library header file organisation, with eight main groups
+   of API routines.  Currently these still refer to the UCD-style style header
+   files for the actual function declarations.
+   
+2002-02-06 05:31  jbpn
+
+   * man/Makefile.in:
+
+     - replace use of $< with explicit filename, since non-GNU makes seem
+       to barf on it
+   
+2002-02-06 03:31  dts12
+
+   * Makefile.in:
+
+   Fix incorrect directory specification in 'make clean'
+   
+2002-02-06 03:18  dts12
+
+   * acconfig.h , include/net-snmp/net-snmp-config.h.in:
+
+   Protect the project config file against multiple inclusion.
+   
+2002-02-06 03:07  jbpn
+
+   * agent/auto_nlist.c:
+
+     - remove #include "../snmplib/system.h" which no longer exists and
+       is apparently unnecessary anyway.
+   
+2002-02-06 02:51  jbpn
+
+   * agent/mibgroup/kernel_sunos5.c:
+
+     - remove #include "../../snmplib/system.h" which no longer exists
+       and is apparently unnecessary anyway.
+   
+2002-02-05 11:44  hardaker
+
+   * COPYING (V4-2-patches.7), COPYING:
+
+   copyright year update for NAI and Cambridge
+   
+2002-02-05 09:54  hardaker
+
+   * include/net-snmp/net-snmp-config.h.in:
+
+   perl fixes
+   
+2002-02-05 09:54  hardaker
+
+   * agent/agent_registry.c , agent/mibgroup/Rmon/alarm.c ,
+   agent/mibgroup/smux/smux.c , include/net-snmp/snmp_api.h
+   , snmplib/snmp_api.c:
+
+   Patch from Harrie Hazewinkel to move the oidtree_compare function to
+   the main library.
+   
+2002-02-05 09:52  hardaker
+
+   * configure , configure.in , agent/Makefile.in:
+
+   perl build fixes.
+   
+2002-02-05 07:19  hardaker
+
+   * agent/Makefile.in:
+
+   opps.  Removed forced perl embedding
+   
+2002-02-04 16:22  hardaker
+
+   * include/net-snmp/net-snmp-config.h:
+
+   this file shouldn't be checked in
+   
+2002-02-04 16:22  hardaker
+
+   * Makefile.in , acconfig.h , configure ,
+   configure.in , agent/Makefile.in , agent/snmp_perl.c
+   , agent/snmp_perl.pl , agent/snmp_vars.c:
+
+   - Support for embedding perl subroutines into the agent to be called
+     as handlers.
+   - New configure options:
+     --with-perl-modules attempts to build contained modules (poorly currently).
+     --enable-embedded-perl actually specifies to do perl embedding
+     within the agent.
+   
+2002-02-04 16:16  hardaker
+
+   * perl/: ASN/ASN.pm , ASN/ASN.xs , ASN/Changes ,
+   ASN/MANIFEST , ASN/Makefile.PL , ASN/test.pl ,
+   agent/Changes , agent/MANIFEST , agent/Makefile.PL ,
+   agent/agent.pm , agent/agent.xs , agent/test.pl ,
+   agent/typemap , default_store/Changes ,
+   default_store/MANIFEST , default_store/Makefile.PL ,
+   default_store/default_store.pm ,
+   default_store/default_store.xs , default_store/test.pl ,
+   default_store/typemap:
+
+   Beginnings of new perl modules needed to implement an SNMP agent (or
+   agentx subagent) inside perl.
+     - not complete yet.
+     - may change.
+     - but works.
+   
+2002-02-04 04:39  jbpn
+
+   * snmplib/mib.c:
+
+     - correct processing for timeticks when DS_LIB_NUMERIC_TIMETICKS is
+       set (corrects bug #511793, reported by Anonymous).
+   
+2002-02-01 01:50  dts12
+
+   * FAQ:
+
+   Clarify the procedure for compiling with 'cc' rather than 'gcc'
+   
+2002-01-31 14:58  hardaker
+
+   * include/net-snmp/net-snmp-includes.h:
+
+   s/snmplib\///;
+   
+2002-01-31 06:55  hardaker
+
+   * Makefile.in , agent/helpers/Makefile.in:
+
+   fix make clean as reported by Bradley Bozarth.
+   
+2002-01-30 08:06  dts12
+
+   * agent/mibgroup/ucd-snmp/versioninfo.c:
+
+   Bring MIB variable versionTag into line with the new <net-snmp/version.h> usage
+   
+2002-01-29 17:53  hardaker
+
+   * version.h , agent/snmpd.c ,
+   agent/mibgroup/versiontag , apps/snmptranslate.c ,
+   apps/snmptrapd.c , apps/snmpnetstat/main.c ,
+   include/net-snmp/version.h , include/ucd-snmp/version.h ,
+   snmplib/Makefile.in , snmplib/snmp_parse_args.c ,
+   snmplib/snmp_version.c:
+
+   Moved versioning information from version.h to:
+     - snmplib/snmp_version.c:
+       - define netsnmp_get_version();
+       - create a const char *NetSnmpVersionInfo
+     - include/net-snmp/version.h:
+       - extern the above char *
+       - prototype the function
+     - include/ucd-snmp/version.h:
+       - create a static variable (the old way) and set it to NetSnmpVersionInfo
+   
+2002-01-29 16:09  hardaker
+
+   * testing/: eval_tools.sh , tests/T049snmpv3inform ,
+   tests/T050snmpv3trap , tests/T051snmpv2ctrap ,
+   tests/T052snmpv2cinform , tests/T053agentv1trap ,
+   tests/T054agentv2ctrap , tests/T055agentv1mintrap ,
+   tests/T056agentv2cmintrap , tests/T058agentauthtrap ,
+   tests/T113agentxtrap:
+
+   trap test fixes so the majority of the tests now work.
+   
+2002-01-29 16:08  hardaker
+
+   * Makefile.in:
+
+   don't generate ucd-snmp-config.h any longer.
+   
+2002-01-29 15:23  hardaker
+
+   * acconfig.h , configure , configure.in ,
+   include/net-snmp/net-snmp-config.h ,
+   include/net-snmp/net-snmp-config.h.in ,
+   include/net-snmp/machine/generic.h ,
+   include/net-snmp/system/aix.h , include/net-snmp/system/bsd.h
+   , include/net-snmp/system/bsdi.h ,
+   include/net-snmp/system/bsdi3.h ,
+   include/net-snmp/system/bsdi4.h ,
+   include/net-snmp/system/cygwin.h ,
+   include/net-snmp/system/darwin.h ,
+   include/net-snmp/system/freebsd.h ,
+   include/net-snmp/system/freebsd2.h ,
+   include/net-snmp/system/freebsd3.h ,
+   include/net-snmp/system/freebsd4.h ,
+   include/net-snmp/system/generic.h ,
+   include/net-snmp/system/hpux.h ,
+   include/net-snmp/system/irix.h ,
+   include/net-snmp/system/linux.h ,
+   include/net-snmp/system/mips.h ,
+   include/net-snmp/system/netbsd.h ,
+   include/net-snmp/system/openbsd.h ,
+   include/net-snmp/system/solaris.h ,
+   include/net-snmp/system/solaris2.6.h ,
+   include/net-snmp/system/solaris2.7.h ,
+   include/net-snmp/system/solaris2.8.h ,
+   include/net-snmp/system/sunos.h ,
+   include/net-snmp/system/svr5.h ,
+   include/net-snmp/system/sysv.h ,
+   include/net-snmp/system/ultrix4.h:
+
+   moved s/*.h files to include/net-snmp/system/*.h
+   moved m/generic.h files to include/net-snmp/machine/generic.h
+   
+2002-01-29 09:24  hardaker
+
+   * apps/snmptrapd.c:
+
+   fix -c argument parsing.
+   
+2002-01-29 09:10  hardaker
+
+   * testing/eval_tools.sh:
+
+   reference include/net-snmp/net-snmp-config.h instead of just config.h
+   
+2002-01-29 09:05  hardaker
+
+   * snmplib/snmpusm.c:
+
+   attempt to fix the unknown engineid/unknown user problems once and for all.
+   
+2002-01-28 21:11  hardaker
+
+   * configure , configure.in:
+
+   whoops.  Missed some .h file checks in configure.  Thanks Robert.
+   
+2002-01-28 21:03  hardaker
+
+   * local/convertcode:
+
+   minor fix.
+   
+2002-01-28 21:02  hardaker
+
+   * local/convertcode:
+
+   added code convert script for ucd-snmp -> net-snmp header conversion
+   
+2002-01-28 20:59  hardaker
+
+   * agent/mibgroup/target/snmpTargetAddrEntry.c ,
+   agent/mibgroup/target/snmpTargetParamsEntry.c ,
+   agent/mibgroup/target/target.c ,
+   agent/mibgroup/target/target_counters.c ,
+   agent/mibgroup/tunnel/tunnel.c ,
+   agent/mibgroup/ucd-snmp/disk.c ,
+   agent/mibgroup/ucd-snmp/dlmod.c ,
+   agent/mibgroup/ucd-snmp/extensible.c ,
+   agent/mibgroup/ucd-snmp/loadave.c ,
+   agent/mibgroup/ucd-snmp/logmatch.c ,
+   agent/mibgroup/ucd-snmp/memory.c ,
+   agent/mibgroup/ucd-snmp/memory_solaris2.c ,
+   agent/mibgroup/ucd-snmp/pass.c ,
+   agent/mibgroup/ucd-snmp/pass_persist.c ,
+   agent/mibgroup/ucd-snmp/proc.c ,
+   agent/mibgroup/ucd-snmp/proxy.c ,
+   agent/mibgroup/ucd-snmp/registry.c ,
+   agent/mibgroup/ucd-snmp/versioninfo.c ,
+   agent/mibgroup/ucd-snmp/vmstat_solaris2.c ,
+   apps/encode_keychange.c , apps/notification_log.c ,
+   apps/snmpbulkget.c , apps/snmpbulkwalk.c ,
+   apps/snmpdelta.c , apps/snmpdf.c , apps/snmpget.c
+   , apps/snmpgetnext.c , apps/snmpset.c ,
+   apps/snmpstatus.c , apps/snmptable.c , apps/snmptest.c
+   , apps/snmptranslate.c , apps/snmptrap.c ,
+   apps/snmptrapd.c , apps/snmptrapd_handlers.c ,
+   apps/snmptrapd_log.c , apps/snmpusm.c , apps/snmpvacm.c
+   , apps/snmpwalk.c , apps/snmpnetstat/Makefile.in
+   , apps/snmpnetstat/if.c , apps/snmpnetstat/inet.c
+   , apps/snmpnetstat/inet6.c , apps/snmpnetstat/main.c
+   , apps/snmpnetstat/route.c , include/net-snmp/asn1.h
+   , include/net-snmp/callback.h ,
+   include/net-snmp/data_list.h ,
+   include/net-snmp/default_store.h , include/net-snmp/getopt.h
+   , include/net-snmp/int64.h , include/net-snmp/keytools.h
+   , include/net-snmp/lcd_time.h ,
+   include/net-snmp/libsnmp.h , include/net-snmp/md5.h ,
+   include/net-snmp/mib.h , include/net-snmp/mt_support.h ,
+   include/net-snmp/net-snmp-config.h ,
+   include/net-snmp/oid_array.h , include/net-snmp/oid_stash.h
+   , include/net-snmp/parse.h ,
+   include/net-snmp/read_config.h , include/net-snmp/scapi.h
+   , include/net-snmp/snmp-tc.h , include/net-snmp/snmp.h
+   , include/net-snmp/snmpAAL5PVCDomain.h ,
+   include/net-snmp/snmpCallbackDomain.h ,
+   include/net-snmp/snmpIPXDomain.h ,
+   include/net-snmp/snmpTCPDomain.h ,
+   include/net-snmp/snmpTCPIPv6Domain.h ,
+   include/net-snmp/snmpUDPDomain.h ,
+   include/net-snmp/snmpUDPIPv6Domain.h ,
+   include/net-snmp/snmpUnixDomain.h ,
+   include/net-snmp/snmp_alarm.h , include/net-snmp/snmp_api.h
+   , include/net-snmp/snmp_client.h ,
+   include/net-snmp/snmp_debug.h , include/net-snmp/snmp_enum.h
+   , include/net-snmp/snmp_impl.h ,
+   include/net-snmp/snmp_locking.h ,
+   include/net-snmp/snmp_logging.h ,
+   include/net-snmp/snmp_parse_args.h ,
+   include/net-snmp/snmp_secmod.h ,
+   include/net-snmp/snmp_transport.h , include/net-snmp/snmpksm.h
+   , include/net-snmp/snmpusm.h ,
+   include/net-snmp/snmpusm_init.h , include/net-snmp/snmpv3.h
+   , include/net-snmp/system.h , include/net-snmp/tools.h
+   , include/net-snmp/transform_oids.h ,
+   include/net-snmp/vacm.h , include/net-snmp/agent/snmp_agent.h
+   , man/Makefile.in , snmplib/Makefile.in ,
+   snmplib/asn1.c , snmplib/asn1.h , snmplib/callback.c
+   , snmplib/callback.h , snmplib/data_list.c ,
+   snmplib/data_list.h , snmplib/default_store.c ,
+   snmplib/default_store.h , snmplib/getopt.h ,
+   snmplib/int64.c , snmplib/int64.h , snmplib/keytools.c
+   , snmplib/keytools.h , snmplib/lcd_time.c ,
+   snmplib/lcd_time.h , snmplib/libsnmp.h , snmplib/md5.c
+   , snmplib/md5.h , snmplib/mib.c , snmplib/mib.h
+   , snmplib/mt_support.c , snmplib/mt_support.h ,
+   snmplib/oid_array.c , snmplib/oid_array.h ,
+   snmplib/oid_stash.c , snmplib/oid_stash.h ,
+   snmplib/parse.c , snmplib/parse.h ,
+   snmplib/read_config.c , snmplib/read_config.h ,
+   snmplib/scapi.c , snmplib/scapi.h , snmplib/snmp-tc.c
+   , snmplib/snmp-tc.h , snmplib/snmp.c ,
+   snmplib/snmp.h , snmplib/snmpAAL5PVCDomain.c ,
+   snmplib/snmpAAL5PVCDomain.h , snmplib/snmpCallbackDomain.c
+   , snmplib/snmpCallbackDomain.h , snmplib/snmpIPXDomain.c
+   , snmplib/snmpIPXDomain.h , snmplib/snmpTCPDomain.c
+   , snmplib/snmpTCPDomain.h , snmplib/snmpTCPIPv6Domain.c
+   , snmplib/snmpTCPIPv6Domain.h , snmplib/snmpUDPDomain.c
+   , snmplib/snmpUDPDomain.h , snmplib/snmpUDPIPv6Domain.c
+   , snmplib/snmpUDPIPv6Domain.h , snmplib/snmpUnixDomain.c
+   , snmplib/snmpUnixDomain.h , snmplib/snmp_alarm.c
+   , snmplib/snmp_alarm.h , snmplib/snmp_api.c ,
+   snmplib/snmp_api.h , snmplib/snmp_auth.c ,
+   snmplib/snmp_client.c , snmplib/snmp_client.h ,
+   snmplib/snmp_debug.c , snmplib/snmp_debug.h ,
+   snmplib/snmp_enum.c , snmplib/snmp_enum.h ,
+   snmplib/snmp_impl.h , snmplib/snmp_logging.c ,
+   snmplib/snmp_logging.h , snmplib/snmp_parse_args.c ,
+   snmplib/snmp_parse_args.h , snmplib/snmp_secmod.c ,
+   snmplib/snmp_secmod.h , snmplib/snmp_transport.c ,
+   snmplib/snmp_transport.h , snmplib/snmpksm.c ,
+   snmplib/snmpksm.h , snmplib/snmpusm.c ,
+   snmplib/snmpusm.h , snmplib/snmpv3.c , snmplib/snmpv3.h
+   , snmplib/system.c , snmplib/system.h ,
+   snmplib/tools.c , snmplib/tools.h ,
+   snmplib/transform_oids.h , snmplib/vacm.c ,
+   snmplib/vacm.h , testing/RUNTESTS ,
+   testing/eval_tools.sh , include/ucd-snmp/asn1.h ,
+   include/ucd-snmp/callback.h , include/ucd-snmp/default_store.h
+   , include/ucd-snmp/int64.h , include/ucd-snmp/keytools.h
+   , include/ucd-snmp/mib.h , include/ucd-snmp/mibincl.h
+   , include/ucd-snmp/parse.h ,
+   include/ucd-snmp/read_config.h , include/ucd-snmp/scapi.h
+   , include/ucd-snmp/snmp-tc.h , include/ucd-snmp/snmp.h
+   , include/ucd-snmp/snmp_alarm.h ,
+   include/ucd-snmp/snmp_api.h , include/ucd-snmp/snmp_client.h
+   , include/ucd-snmp/snmp_debug.h ,
+   include/ucd-snmp/snmp_impl.h , include/ucd-snmp/snmp_logging.h
+   , include/ucd-snmp/snmp_parse_args.h ,
+   include/ucd-snmp/snmp_vars.h , include/ucd-snmp/snmpusm.h
+   , include/ucd-snmp/snmpv3.h , include/ucd-snmp/system.h
+   , include/ucd-snmp/tools.h ,
+   include/ucd-snmp/transform_oids.h ,
+   include/ucd-snmp/util_funcs.h:
+
+   Major file moving and editing of include directives.
+     - essentially adds up to:
+       - mv snmplib/*.h include/net-snmp/
+       - local/convertcode `find . -name \*.c \*.h`
+   
+2002-01-28 20:54  hardaker
+
+   * agent/: agent_handler.c , agent_index.c ,
+   agent_read_config.c , agent_registry.c , agent_trap.c
+   , auto_nlist.c , kernel.c , mib_modules.c ,
+   snmp_agent.c , snmp_vars.c , snmpd.c ,
+   helpers/bulk_to_next.c , helpers/debug_handler.c ,
+   helpers/instance.c , helpers/multiplexer.c ,
+   helpers/null.c , helpers/old_api.c , helpers/read_only.c
+   , helpers/serialize.c , helpers/table.c ,
+   helpers/table_array.c , helpers/table_dataset.c ,
+   helpers/table_iterator.c , mibgroup/host_res.h ,
+   mibgroup/kernel_sunos5.c , mibgroup/mibincl.h ,
+   mibgroup/testdelayed.c , mibgroup/testhandler.c ,
+   mibgroup/util_funcs.c , mibgroup/Rmon/alarm.c ,
+   mibgroup/Rmon/event.c , mibgroup/Rmon/history.c ,
+   mibgroup/Rmon/rows.c , mibgroup/agentx/agentx_config.c ,
+   mibgroup/agentx/client.c , mibgroup/agentx/master.c ,
+   mibgroup/agentx/master_admin.c ,
+   mibgroup/agentx/master_request.c , mibgroup/agentx/protocol.c
+   , mibgroup/agentx/subagent.c ,
+   mibgroup/disman/mteObjectsTable.c ,
+   mibgroup/disman/mteTriggerBooleanTable.c ,
+   mibgroup/disman/mteTriggerDeltaTable.c ,
+   mibgroup/disman/mteTriggerExistenceTable.c ,
+   mibgroup/disman/mteTriggerTable.c ,
+   mibgroup/disman/mteTriggerThresholdTable.c ,
+   mibgroup/examples/ucdDemoPublic.c , mibgroup/host/hr_disk.c
+   , mibgroup/host/hr_filesys.c ,
+   mibgroup/host/hr_storage.c , mibgroup/host/hr_swinst.c
+   , mibgroup/host/hr_swrun.c , mibgroup/host/hr_system.c
+   , mibgroup/mibII/at.c , mibgroup/mibII/icmp.c ,
+   mibgroup/mibII/interfaces.c , mibgroup/mibII/ip.c ,
+   mibgroup/mibII/ipAddr.c , mibgroup/mibII/ipv6.c ,
+   mibgroup/mibII/kernel_linux.c , mibgroup/mibII/route_write.c
+   , mibgroup/mibII/snmp_mib.c ,
+   mibgroup/mibII/sysORTable.c , mibgroup/mibII/system_mib.c
+   , mibgroup/mibII/tcp.c , mibgroup/mibII/tcpTable.c
+   , mibgroup/mibII/udp.c , mibgroup/mibII/udpTable.c
+   , mibgroup/mibII/vacm_context.c ,
+   mibgroup/mibII/vacm_vars.c , mibgroup/mibII/vacm_vars.h
+   , mibgroup/mibII/var_route.c , mibgroup/mibJJ/icmp.c
+   , mibgroup/mibJJ/interfaces.c , mibgroup/mibJJ/ip.c
+   , mibgroup/mibJJ/ipAddr.c , mibgroup/mibJJ/ipMedia.c
+   , mibgroup/mibJJ/ipv6.c , mibgroup/mibJJ/kernel_linux.c
+   , mibgroup/mibJJ/snmp_mib.c , mibgroup/mibJJ/sysORTable.c
+   , mibgroup/mibJJ/system_mib.c , mibgroup/mibJJ/tcp.c
+   , mibgroup/mibJJ/tcpTable.c , mibgroup/mibJJ/udp.c ,
+   mibgroup/mibJJ/udpTable.c , mibgroup/mibJJ/vacm_vars.c ,
+   mibgroup/misc/dlmod.c ,
+   mibgroup/notification/snmpNotifyFilterProfileTable.c ,
+   mibgroup/notification/snmpNotifyFilterTable.c ,
+   mibgroup/notification/snmpNotifyTable.c ,
+   mibgroup/smux/smux.c , mibgroup/smux/snmp_bgp.c ,
+   mibgroup/smux/snmp_ospf.c , mibgroup/smux/snmp_rip2.c ,
+   mibgroup/snmpv3/snmpEngine.c , mibgroup/snmpv3/usmUser.c
+   , mibgroup/snmpv3/usmUser.h:
+
+   Major file moving and editing of include directives.
+     - essentially adds up to:
+       - mv snmplib/*.h include/net-snmp/
+       - local/convertcode `find . -name \*.c \*.h`
+   
+2002-01-28 19:42  hardaker
+
+   * include/ucd-snmp/ucd-snmp-config.h:
+
+   remove UCD_COMPAT flag and DEFINE IT instead
+   
+2002-01-28 19:41  hardaker
+
+   * include/ucd-snmp/ucd-snmp-config.h:
+
+   remove UCD_COMPAT flag and define it instead
+   
+2002-01-25 11:29  hardaker
+
+   * snmplib/mib.c:
+
+   - parse_one_oid_index:
+     - use an unsigned int for length's pulled from the oid.
+     - Make sure they're always < 128
+   
+2002-01-25 09:12  jbpn
+
+   * agent/mibgroup/snmpv3/usmUser.c:
+
+     - closer adherence to state machines described in RFC 2574
+   
+2002-01-25 09:10  jbpn
+
+   * snmplib/snmpusm.c:
+
+     - cause usmDecryptionError reports to be sent in a couple of extra
+       cases: bad salt (length != 8) and length of encrypted data not a
+       multiple of 8 octets (per RFC 2574).
+   
+2002-01-25 09:04  jbpn
+
+   * agent/snmp_agent.c:
+
+     - for unknown message types, increment snmpInASNParseErrs and fail
+       at the post-parse stage.
+   
+     - for notification types, increment snmpUnknownPDUHandlers and bail
+       out early.
+   
+2002-01-25 09:01  jbpn
+
+   * snmplib/snmp_api.c:
+
+     - for unhandled messages (e.g. RESPONSE messages sent to agents),
+       increment the snmpUnknownPDUHandlers counter.
+   
+     - try to free securityStateRefs when post-parse fails.
+   
+2002-01-25 06:26  jbpn
+
+   * agent/mibgroup/mibII/: vacm_vars.c (V4-2-patches.6), vacm_vars.c:
+
+     - fix minor problem with storageType (always okay to set to current
+       value).
+   
+     - don't reset some variables to old value unless we actually set
+       them in the first place!
+   
+2002-01-25 05:00  jbpn
+
+   * agent/helpers/table.c:
+
+     - don't print out debugging info in a further case where it has been
+       free()d.
+   
+     - set the exception noSuchInstance rather than error noSuchName when
+       we have the incorrect number of indices.
+   
+2002-01-25 04:54  dts12
+
+   * snmplib/README.newlib:
+
+   file README.newlib was initially added on branch NEW-LIBRARY-API.
+   
+2002-01-25 04:49  jbpn
+
+   * agent/helpers/table.c:
+
+     - move debugging output to before where (potentially) the data it is
+       trying to print gets free()d.
+   
+2002-01-25 04:40  jbpn
+
+   * agent/snmp_agent.c:
+
+     - keep asp->vbcount correct in create_subtree_cache() if we dump
+       varbinds in the GETNEXT case because numvarbinds > non-repeaters.
+       Failing to do this will cause problems later when you iterate over
+       0 .. asp->vbcount - 1 in reassign_requests().
+   
+2002-01-24 15:11  rstory
+
+   * include/net-snmp/agent/table.h:
+
+   update macros to put parens around parameters when used, in case a parameter is an expression, which might muck about with operator precedence rules and cause unexpected and undesirable behavior.
+   
+2002-01-24 11:07  rstory
+
+   * local/mib2c.array-user.conf:
+
+   try to find & handle external indexes; use new style net-snmp includes; add
+   row_copy; use context types & casts in parameters instead of generic types
+   recast inside method
+   
+2002-01-24 06:03  jbpn
+
+   * snmplib/: read_config.c (V4-2-patches.3), read_config.c:
+
+     - avoid format string nasties in read_config_store() when writing to
+       files (exposed e.g. by the persistent sysName.0 stuff -- try
+       snmpset host sysName.0 s "%08x" -- oops)
+   
+2002-01-24 04:34  jbpn
+
+   * snmplib/snmpusm.c:
+
+     - don't automatically accept a msgUserName of "" when processing
+       incoming messages.
+   
+2002-01-24 04:30  jbpn
+
+   * snmplib/snmp_api.c:
+
+     - bigger buffer for msgAuthoritativeEngineID field since it is not
+       limited to 32 bytes like SnmpEngineTC.  Really this needs to be
+       allocated by the security module but for now we'll just make it
+       twice as big.
+   
+2002-01-24 03:19  dts12
+
+   * agent/mibgroup/host/hr_swrun.c , snmplib/snmp-tc.c:
+
+   AIX support for the Host Resources module.
+      (Thanks to Andy Hood)
+   
+2002-01-23 08:28  jbpn
+
+   * agent/mibgroup/mibII/vacm_vars.c:
+
+     - set viewType to the DEFVAL included(1) for new rows
+   
+2002-01-23 07:40  jbpn
+
+   * snmplib/snmp_api.c:
+
+     - secModel of 0 is a parse error in HeaderData
+   
+2002-01-23 07:23  jbpn
+
+   * snmplib/snmp_api.c:
+
+     - be careful to free securityStateRef in a couple of error cases in
+       snmpv3_parse -- fixes memory leaks when malformed PDUs are
+       received.
+   
+2002-01-22 19:49  rstory
+
+   * snmplib/: snmp_api.c , snmp_api.h:
+
+   chg api for snmp_oid_ncompare, don't implement it vi snmp_oid_compare
+   
+2002-01-22 19:46  rstory
+
+   * snmplib/: oid_array.c , oid_array.h:
+
+   add Get_oid_data_count(); add subset support
+   
+2002-01-22 19:44  rstory
+
+   * snmplib/: mib.c , mib.h:
+
+   add netsnmp_str2oid()
+   
+2002-01-22 19:41  rstory
+
+   * include/net-snmp/agent/table_array.h:
+
+   add subset function
+   
+2002-01-22 19:40  rstory
+
+   * agent/helpers/table_array.c:
+
+   add subset function; add preliminary locking code; add ta_check_row_status
+   
+2002-01-22 06:33  jbpn
+
+   * agent/mibgroup/mibII/: vacm_vars.c (V4-2-patches.4), vacm_vars.c:
+
+     - fix bug just introduced where setting an existing row's status to
+       createAndGo(4) or createAndWait(5) would delete the row.
+   
+2002-01-22 04:58  jbpn
+
+   * snmplib/snmpusm.c:
+
+     - cause a parse error if we receive UsmSecurityParameters with a
+       msgUserName that is illegally long.
+   
+2002-01-22 03:10  jbpn
+
+   * agent/mibgroup/target/snmpTargetParamsEntry.c:
+
+     - oops, left old code in #if 0 branch AGAIN.  I am getting into bad
+       habits!
+   
+2002-01-22 03:08  jbpn
+
+   * agent/mibgroup/notification/snmpNotifyTable.c:
+
+     - fix memory leaks in row creation/destruction
+   
+     - more aggressive validity checking of snmpNotifyTag, snmpNotifyType
+       and snmpNotifyStorageType.
+   
+     - passes 6.5.1.0 -- 6.5.8.3
+   
+2002-01-22 01:47  jbpn
+
+   * agent/mibgroup/target/: snmpTargetAddrEntry.c ,
+   snmpTargetParamsEntry.c , snmpTargetParamsEntry.h:
+
+     - correct state machines for snmpTargetParamsTable
+   
+2002-01-21 23:48  jbpn
+
+   * agent/mibgroup/target/snmpTargetAddrEntry.c:
+
+     - tidy things up a bit (had left some old code sitting if #if 0
+       branch).
+   
+     - remember to close (target->sess) when we move a target to
+       notInService(2).
+   
+2002-01-21 11:04  jbpn
+
+   * agent/mibgroup/target/snmpTargetAddrEntry.c:
+
+     - correct state machines for snmpTargetAddrTable
+   
+2002-01-21 06:47  jbpn
+
+   * agent/mibgroup/target/: snmpTargetAddrEntry.c ,
+   snmpTargetAddrEntry.h:
+
+     - implement snmpTargetSpinLock object
+   
+2002-01-18 09:19  jbpn
+
+   * agent/mibgroup/mibII/vacm_vars.c:
+
+     - correct state machine for vacmViewTreeFamilyTable.  Passes all the
+       relevant Silvercreek VACM tetst (5.4.0.1 -- 5.4.9.7 inclusive).
+   
+2002-01-18 08:49  jbpn
+
+   * snmplib/: vacm.c , vacm.h:
+
+     - add a switch to vacm_getViewEntry() to allow the mask entries
+       to be ignore (which is what you want when you are just using this
+       function to look up an entry in the table in order to write some new
+       value to one of the columnar objects).
+   
+2002-01-18 06:09  jbpn
+
+   * agent/mibgroup/mibII/vacm_vars.c:
+
+     - correct state machine for vacmAccessTable.  Passes all the relevant
+       Silvercreek VACM tetst (5.3.0 -- 5.3.9.7 inclusive).
+   
+2002-01-18 04:11  jbpn
+
+   * agent/mibgroup/mibII/vacm_vars.c:
+
+     - correct state machine for vacmSecurityToGroupTable (i.e. don't
+       just do everything in the COMMIT phase).  Passes all the relevant
+       Silvercreek VACM tetst (5.2.0 -- 5.2.9.7 inclusive).
+   
+2002-01-18 04:08  jbpn
+
+   * agent/snmp_agent.c:
+
+     - don't overwrite an existing error status after COMMIT or UNDO
+       phases with commitFailed or undoFailed (but do translate error
+       returns from those phases into those errors when we don't have an
+       existing error status).
+   
+2002-01-17 06:57  jbpn
+
+   * snmplib/snmp_api.c:
+
+     - handle illegal values of msgID correctly (by dropping the packet
+       and incrementing snmpInASNParseErrs)
+   
+2002-01-17 06:38  jbpn
+
+   * snmplib/snmp_api.c:
+
+     - handle illegal values of msgMaxSize correctly (by dropping the
+       packet and incrementing snmpInASNParseErrs)
+   
+2002-01-15 08:17  rstory
+
+   * include/net-snmp/net-snmp-includes.h:
+
+   top level include which includes useful snmplib headers
+   
+2002-01-15 08:15  rstory
+
+   * include/ucd-snmp/: agent_index.h , agent_read_config.h
+   , agent_registry.h , agent_trap.h , asn1.h ,
+   auto_nlist.h , callback.h , default_store.h ,
+   ds_agent.h , header_complex.h , int64.h , keytools.h
+   , mib.h , mib_module_config.h , mibincl.h ,
+   parse.h , read_config.h , scapi.h , snmp-tc.h ,
+   snmp.h , snmp_agent.h , snmp_alarm.h , snmp_api.h
+   , snmp_client.h , snmp_debug.h , snmp_impl.h ,
+   snmp_logging.h , snmp_parse_args.h , snmp_vars.h ,
+   snmpusm.h , snmpv3.h , struct.h , system.h ,
+   tools.h , transform_oids.h , ucd-snmp-agent-includes.h
+   , ucd-snmp-config.h , ucd-snmp-includes.h ,
+   util_funcs.h , var_struct.h , version.h:
+
+   create 4.x headers that are wrappers pointing to new headers
+   
+2002-01-14 15:08  rstory
+
+   * include/net-snmp/agent/table_array.h:
+
+   add UserRowAction and void pointer
+   
+2002-01-14 13:41  hardaker
+
+   * agent/: mibgroup/ucd-snmp/lmSensors.c , Makefile.in:
+
+   -> net-snmp/agent/net-snmp-agent-includes.h
+   
+2002-01-14 13:40  hardaker
+
+   * include/net-snmp/agent/ucd-snmp-agent-includes.h:
+
+   removed
+   
+2002-01-14 13:29  rstory
+
+   * include/net-snmp/agent/net-snmp-agent-includes.h:
+
+   copy ucd-snmp-agent-includes.h and update to net-snmp use new agent dir
+   
+2002-01-14 08:04  hardaker
+
+   * agent/Makefile.in , agent/agent_callbacks.h ,
+   agent/agent_handler.c , agent/agent_handler.h ,
+   agent/agent_index.c , agent/agent_index.h ,
+   agent/agent_read_config.c , agent/agent_read_config.h ,
+   agent/agent_registry.c , agent/agent_registry.h ,
+   agent/agent_trap.c , agent/agent_trap.h ,
+   agent/auto_nlist.c , agent/auto_nlist.h ,
+   agent/ds_agent.h , agent/kernel.c , agent/mib_modules.c
+   , agent/mib_modules.h , agent/snmp_agent.c ,
+   agent/snmp_agent.h , agent/snmp_vars.c ,
+   agent/snmp_vars.h , agent/snmpd.c ,
+   agent/ucd-snmp-agent-includes.h , agent/var_struct.h ,
+   agent/helpers/Makefile.in , agent/helpers/bulk_to_next.c
+   , agent/helpers/debug_handler.c ,
+   agent/helpers/instance.c , agent/helpers/multiplexer.c ,
+   agent/helpers/null.c , agent/helpers/old_api.c ,
+   agent/helpers/read_only.c , agent/helpers/serialize.c ,
+   agent/helpers/table.c , agent/helpers/table_array.c ,
+   agent/helpers/table_iterator.c , agent/mibgroup/host_res.h
+   , agent/mibgroup/mibincl.h ,
+   agent/mibgroup/testdelayed.c , agent/mibgroup/testhandler.c
+   , agent/mibgroup/agentx/agentx_config.c ,
+   agent/mibgroup/agentx/client.c ,
+   agent/mibgroup/agentx/master.c ,
+   agent/mibgroup/agentx/master_admin.c ,
+   agent/mibgroup/agentx/master_request.c ,
+   agent/mibgroup/agentx/subagent.c ,
+   agent/mibgroup/disman/mteTriggerTable.c ,
+   agent/mibgroup/examples/example.c ,
+   agent/mibgroup/examples/ucdDemoPublic.c ,
+   agent/mibgroup/host/hr_disk.c , agent/mibgroup/host/hr_proc.c
+   , agent/mibgroup/host/hr_storage.c ,
+   agent/mibgroup/host/hr_swrun.c ,
+   agent/mibgroup/host/hr_system.c , agent/mibgroup/mibII/at.c
+   , agent/mibgroup/mibII/icmp.c ,
+   agent/mibgroup/mibII/interfaces.c , agent/mibgroup/mibII/ip.c
+   , agent/mibgroup/mibII/ipAddr.c ,
+   agent/mibgroup/mibII/ipv6.c ,
+   agent/mibgroup/mibII/route_write.c ,
+   agent/mibgroup/mibII/sysORTable.c ,
+   agent/mibgroup/mibII/system_mib.c ,
+   agent/mibgroup/mibII/tcp.c , agent/mibgroup/mibII/tcpTable.c
+   , agent/mibgroup/mibII/udp.c ,
+   agent/mibgroup/mibII/udpTable.c ,
+   agent/mibgroup/mibII/vacm_context.c ,
+   agent/mibgroup/mibII/vacm_vars.c ,
+   agent/mibgroup/mibII/var_route.c ,
+   agent/mibgroup/mibJJ/icmp.c ,
+   agent/mibgroup/mibJJ/interfaces.c , agent/mibgroup/mibJJ/ip.c
+   , agent/mibgroup/mibJJ/ipAddr.c ,
+   agent/mibgroup/mibJJ/ipMedia.c ,
+   agent/mibgroup/mibJJ/ipRoute.c , agent/mibgroup/mibJJ/ipv6.c
+   , agent/mibgroup/mibJJ/sysORTable.c ,
+   agent/mibgroup/mibJJ/system_mib.c , agent/mibgroup/mibJJ/tcp.c
+   , agent/mibgroup/mibJJ/tcpTable.c ,
+   agent/mibgroup/mibJJ/udp.c , agent/mibgroup/mibJJ/udpTable.c
+   , agent/mibgroup/mibJJ/vacm_vars.c ,
+   agent/mibgroup/misc/dlmod.c ,
+   agent/mibgroup/notification/snmpNotifyTable.c ,
+   agent/mibgroup/smux/smux.c , agent/mibgroup/smux/snmp_bgp.c
+   , agent/mibgroup/smux/snmp_ospf.c ,
+   agent/mibgroup/smux/snmp_rip2.c ,
+   agent/mibgroup/snmpv3/usmUser.c ,
+   agent/mibgroup/target/target_counters.c ,
+   agent/mibgroup/tunnel/tunnel.c ,
+   agent/mibgroup/ucd-snmp/disk.c ,
+   agent/mibgroup/ucd-snmp/diskio.c ,
+   agent/mibgroup/ucd-snmp/dlmod.c ,
+   agent/mibgroup/ucd-snmp/errormib.c ,
+   agent/mibgroup/ucd-snmp/extensible.c ,
+   agent/mibgroup/ucd-snmp/file.c ,
+   agent/mibgroup/ucd-snmp/loadave.c ,
+   agent/mibgroup/ucd-snmp/logmatch.c ,
+   agent/mibgroup/ucd-snmp/memory.c ,
+   agent/mibgroup/ucd-snmp/memory_freebsd2.c ,
+   agent/mibgroup/ucd-snmp/memory_netbsd1.c ,
+   agent/mibgroup/ucd-snmp/memory_solaris2.c ,
+   agent/mibgroup/ucd-snmp/pass.c ,
+   agent/mibgroup/ucd-snmp/proc.c ,
+   agent/mibgroup/ucd-snmp/versioninfo.c ,
+   agent/mibgroup/ucd-snmp/vmstat.c ,
+   agent/mibgroup/ucd-snmp/vmstat_bsdi4.c ,
+   agent/mibgroup/ucd-snmp/vmstat_freebsd2.c ,
+   agent/mibgroup/ucd-snmp/vmstat_netbsd1.c ,
+   apps/notification_log.h , apps/snmptrapd.c ,
+   include/net-snmp/agent/agent_callbacks.h ,
+   include/net-snmp/agent/agent_handler.h ,
+   include/net-snmp/agent/agent_index.h ,
+   include/net-snmp/agent/agent_read_config.h ,
+   include/net-snmp/agent/agent_registry.h ,
+   include/net-snmp/agent/agent_trap.h ,
+   include/net-snmp/agent/auto_nlist.h ,
+   include/net-snmp/agent/ds_agent.h ,
+   include/net-snmp/agent/mib_modules.h ,
+   include/net-snmp/agent/snmp_agent.h ,
+   include/net-snmp/agent/snmp_vars.h ,
+   include/net-snmp/agent/ucd-snmp-agent-includes.h ,
+   include/net-snmp/agent/var_struct.h:
+
+   moved the /agent installed headers to ../include/net-snmp/agent
+   
+2002-01-13 09:22  hardaker
+
+   * agent/Makefile.in:
+
+   add a couple more install headers.
+   
+2002-01-11 14:18  hardaker
+
+   * apps/: Makefile.in , notification_log.c:
+
+   Move all agent/helpers/*.h files to include/net-snmp/agent/ and change
+   references.
+   
+2002-01-11 14:12  hardaker
+
+   * agent/Makefile.in , agent/agent_handler.c ,
+   agent/agent_index.c , agent/agent_read_config.c ,
+   agent/agent_registry.c , agent/mib_modules.c ,
+   agent/snmp_vars.c , agent/snmpd.c ,
+   agent/helpers/all_helpers.h , agent/helpers/bulk_to_next.c
+   , agent/helpers/bulk_to_next.h ,
+   agent/helpers/debug_handler.c , agent/helpers/debug_handler.h
+   , agent/helpers/instance.c , agent/helpers/instance.h
+   , agent/helpers/multiplexer.c ,
+   agent/helpers/multiplexer.h , agent/helpers/null.c ,
+   agent/helpers/null.h , agent/helpers/old_api.c ,
+   agent/helpers/old_api.h , agent/helpers/read_only.c ,
+   agent/helpers/read_only.h , agent/helpers/serialize.c ,
+   agent/helpers/serialize.h , agent/helpers/set_helper.h ,
+   agent/helpers/table.c , agent/helpers/table.h ,
+   agent/helpers/table_array.c , agent/helpers/table_array.h
+   , agent/helpers/table_data.c , agent/helpers/table_data.h
+   , agent/helpers/table_dataset.c ,
+   agent/helpers/table_dataset.h , agent/helpers/table_iterator.c
+   , agent/helpers/table_iterator.h ,
+   agent/mibgroup/Makefile.in , agent/mibgroup/testdelayed.c
+   , agent/mibgroup/testhandler.c ,
+   agent/mibgroup/agent/nsTransactionTable.c ,
+   agent/mibgroup/mibII/vacm_context.c ,
+   agent/mibgroup/target/target_counters.c ,
+   include/net-snmp/agent/all_helpers.h ,
+   include/net-snmp/agent/bulk_to_next.h ,
+   include/net-snmp/agent/debug_handler.h ,
+   include/net-snmp/agent/instance.h ,
+   include/net-snmp/agent/multiplexer.h ,
+   include/net-snmp/agent/null.h ,
+   include/net-snmp/agent/old_api.h ,
+   include/net-snmp/agent/read_only.h ,
+   include/net-snmp/agent/serialize.h ,
+   include/net-snmp/agent/set_helper.h ,
+   include/net-snmp/agent/table.h ,
+   include/net-snmp/agent/table_array.h ,
+   include/net-snmp/agent/table_data.h ,
+   include/net-snmp/agent/table_dataset.h ,
+   include/net-snmp/agent/table_iterator.h:
+
+   Move all agent/helpers/*.h files to include/net-snmp/agent/ and change
+   references.
+   
+2002-01-11 08:41  hardaker
+
+   * agent/Makefile.in , agent/helpers/Makefile.in ,
+   agent/mibgroup/Makefile.in , apps/Makefile.in ,
+   snmplib/Makefile.in:
+
+   - Add -I$(top_srcdir)/include to include path.
+   - Rename 3 agent libraries from libucd* -> libnetsnmp*
+   
+2002-01-11 07:58  jbpn
+
+   * agent/mibgroup/mibII/vacm_vars.c:
+
+     - don't use while(x-- >= 0) loops for new unsigned index components
+   
+2002-01-11 05:27  jbpn
+
+   * agent/mibgroup/mibII/vacm_vars.c:
+
+     - be careful about signedess of index components in tables
+   
+2002-01-10 13:12  nba
+
+   * configure , configure.in:
+
+   Create the include directory when building outside source directory
+   
+2002-01-10 08:20  jbpn
+
+   * agent/mibgroup/mibII/sysORTable.c:
+
+     - use an unsigned long loop variable in var_sysORTable() to avoid
+       incorrect lexi-ordering when doing requests like GETNEXT
+       sysORDescr.4294967295.
+   
+     - minor debugging output changes
+   
+2002-01-10 07:32  jbpn
+
+   * agent/snmp_agent.c:
+
+     - fix minor memory leak in reassign_requests()
+   
+2002-01-10 07:21  jbpn
+
+   * agent/snmp_agent.c:
+
+     - set type for unhandled GET requests in handle_pdu() to be
+       noSuchInstance rather than noSuchObject (noSuchObject exceptions
+       are detected and explicitly set earlier).
+   
+2002-01-10 05:52  jbpn
+
+   * agent/helpers/old_api.c:
+
+     - correct typo that meant error returns from old-api write methods
+       were ignored.
+   
+2002-01-10 05:04  jbpn
+
+   * snmplib/snmp_api.h:
+
+     - change value of STAT_TARGET_STATS_END so that mibII/snmp_mib.c can
+       return values of mandatory objects snmpSilentDrops and
+       snmpProxyDrops.
+   
+2002-01-09 08:50  jbpn
+
+   * snmplib/snmp_api.c:
+
+     - make unknown/illegal varbind types in v1/v2c PDUs cause
+       snmpInASNParseErrs to be incremented.
+   
+2002-01-09 07:55  jbpn
+
+   * agent/helpers/debug_handler.c:
+
+     - fix memory leak
+   
+2002-01-09 07:32  jbpn
+
+   * apps/snmpbulkget.c:
+
+     - bring app-specific options in line with snmpbulkwalk (-C rather
+       than -B)
+   
+2002-01-09 07:31  jbpn
+
+   * apps/snmpbulkwalk.c:
+
+     - formatting change to usage message
+   
+2002-01-09 06:35  jbpn
+
+   * agent/helpers/table_iterator.c:
+
+     - fix minor memory leak
+   
+2002-01-08 08:55  jbpn
+
+   * apps/snmpbulkwalk.c:
+
+     - add options from snmpwalk
+   
+     - allow non-repeaters and max-repeaters to be set
+   
+     - change default value of max-repeaters to a lower value to avoid
+       timeouts with slower agents
+   
+2002-01-08 08:17  jbpn
+
+   * agent/snmp_agent.c:
+
+     - don't try to malloc() a zero-length buffer, in case some malloc()s
+       complain.
+   
+2002-01-08 08:15  jbpn
+
+   * agent/snmp_agent.c:
+
+     - hopefully final GETBULK fix -- passes all SilverCreek's GETBULK
+       tests (incl. negative non-repeaters and max-repeaters)
+   
+2002-01-08 06:59  jbpn
+
+   * agent/: snmp_agent.c , snmp_agent.h ,
+   helpers/bulk_to_next.c:
+
+     - GETBULK fix to ignore varbinds for which zero repetitions are
+       called for
+   
+     - drop asp->start and asp->end which are hardly used and which get
+       in the way of this type of processing
+   
+     - ignore negative repetitions in bulk_to_next handler
+   
+2002-01-07 08:39  hardaker
+
+   * perl/manager/.cvsignore:
+
+   ignore file
+   
+2002-01-07 08:38  hardaker
+
+   * perl/manager/INSTALL:
+
+   PNGGraph -> GD::Graph
+   
+2002-01-04 13:48  hardaker
+
+   * Makefile.in:
+
+   fix dependencies
+   
+2002-01-04 13:24  hardaker
+
+   * acconfig.h , include/net-snmp/acconfig.h:
+
+   move acconfig.h back to the top dir where its apparently supposed to live.
+   
+2002-01-04 13:18  hardaker
+
+   * configure , configure.in:
+
+   more ucd-snmp -> net-snmp translations.  warning: includes the default persistent store.
+   
+2002-01-04 13:04  hardaker
+
+   * include/: net-snmp/.cvsignore , ucd-snmp/.cvsignore:
+
+   ignore files
+   
+2002-01-04 13:02  hardaker
+
+   * .cvsignore:
+
+   ignore built net-snmp-config
+   
+2002-01-04 13:00  hardaker
+
+   * apps/: Makefile.in , encode_keychange.c ,
+   notification_log.c , snmpbulkget.c , snmpbulkwalk.c
+   , snmpdelta.c , snmpdf.c , snmpget.c ,
+   snmpgetnext.c , snmpset.c , snmpstatus.c ,
+   snmptable.c , snmptest.c , snmptranslate.c ,
+   snmptrap.c , snmptrapd.c , snmptrapd_handlers.c
+   , snmptrapd_log.c , snmpusm.c , snmpvacm.c
+   , snmpwalk.c:
+
+   beginnings of ucd-snmp -> net-snmp structural changes.
+     - config.h -> include/net-snmp/net-snmp-config.h
+       - this, of course, changes just about every file in the repository.
+   
+2002-01-04 12:56  hardaker
+
+   * agent/mibgroup/mibJJ/icmp.c ,
+   agent/mibgroup/mibJJ/interfaces.c , agent/mibgroup/mibJJ/ip.c
+   , agent/mibgroup/mibJJ/ipAddr.c ,
+   agent/mibgroup/mibJJ/ipMedia.c ,
+   agent/mibgroup/mibJJ/ipRoute.c , agent/mibgroup/mibJJ/ipv6.c
+   , agent/mibgroup/mibJJ/kernel_linux.c ,
+   agent/mibgroup/mibJJ/snmp_mib.c ,
+   agent/mibgroup/mibJJ/sysORTable.c ,
+   agent/mibgroup/mibJJ/system_mib.c , agent/mibgroup/mibJJ/tcp.c
+   , agent/mibgroup/mibJJ/tcpTable.c ,
+   agent/mibgroup/mibJJ/udp.c , agent/mibgroup/mibJJ/udpTable.c
+   , agent/mibgroup/mibJJ/vacm_vars.c ,
+   agent/mibgroup/notification/snmpNotifyFilterProfileTable.c ,
+   agent/mibgroup/notification/snmpNotifyFilterTable.c ,
+   agent/mibgroup/notification/snmpNotifyTable.c ,
+   agent/mibgroup/smux/smux.c , agent/mibgroup/smux/snmp_bgp.c
+   , agent/mibgroup/smux/snmp_ospf.c ,
+   agent/mibgroup/smux/snmp_rip2.c ,
+   agent/mibgroup/snmpv3/snmpEngine.c ,
+   agent/mibgroup/snmpv3/snmpMPDStats.c ,
+   agent/mibgroup/snmpv3/usmStats.c ,
+   agent/mibgroup/snmpv3/usmUser.c ,
+   agent/mibgroup/target/snmpTargetAddrEntry.c ,
+   agent/mibgroup/target/snmpTargetParamsEntry.c ,
+   agent/mibgroup/target/target.c ,
+   agent/mibgroup/target/target_counters.c ,
+   agent/mibgroup/ucd-snmp/disk.c ,
+   agent/mibgroup/ucd-snmp/diskio.c ,
+   agent/mibgroup/ucd-snmp/dlmod.c ,
+   agent/mibgroup/ucd-snmp/errormib.c ,
+   agent/mibgroup/ucd-snmp/extensible.c ,
+   agent/mibgroup/ucd-snmp/file.c ,
+   agent/mibgroup/ucd-snmp/hpux.c ,
+   agent/mibgroup/ucd-snmp/lmSensors.c ,
+   agent/mibgroup/ucd-snmp/loadave.c ,
+   agent/mibgroup/ucd-snmp/logmatch.c ,
+   agent/mibgroup/ucd-snmp/memory.c ,
+   agent/mibgroup/ucd-snmp/memory_freebsd2.c ,
+   agent/mibgroup/ucd-snmp/memory_netbsd1.c ,
+   agent/mibgroup/ucd-snmp/memory_solaris2.c ,
+   agent/mibgroup/ucd-snmp/pass.c ,
+   agent/mibgroup/ucd-snmp/pass_persist.c ,
+   agent/mibgroup/ucd-snmp/proc.c ,
+   agent/mibgroup/ucd-snmp/proxy.c ,
+   agent/mibgroup/ucd-snmp/registry.c ,
+   agent/mibgroup/ucd-snmp/versioninfo.c ,
+   agent/mibgroup/ucd-snmp/vmstat.c ,
+   agent/mibgroup/ucd-snmp/vmstat_bsdi4.c ,
+   agent/mibgroup/ucd-snmp/vmstat_freebsd2.c ,
+   agent/mibgroup/ucd-snmp/vmstat_netbsd1.c ,
+   agent/mibgroup/ucd-snmp/vmstat_solaris2.c ,
+   apps/snmpnetstat/Makefile.in , apps/snmpnetstat/if.c ,
+   apps/snmpnetstat/inet.c , apps/snmpnetstat/inet6.c ,
+   apps/snmpnetstat/main.c , apps/snmpnetstat/route.c ,
+   apps/snmpnetstat/winstub.c:
+
+   beginnings of ucd-snmp -> net-snmp structural changes.
+     - config.h -> include/net-snmp/net-snmp-config.h
+       - this, of course, changes just about every file in the repository.
+   
+2002-01-04 12:52  hardaker
+
+   * agent/mibgroup/misc/dlmod.c , agent/mibgroup/misc/ipfwacc.c
+   , include/net-snmp/acconfig.h ,
+   include/net-snmp/net-snmp-config.h.in ,
+   include/ucd-snmp/README , snmplib/Makefile.in ,
+   snmplib/asn1.c , snmplib/callback.c ,
+   snmplib/data_list.c , snmplib/default_store.c ,
+   snmplib/int64.c , snmplib/keytools.c ,
+   snmplib/lcd_time.c , snmplib/md5.c , snmplib/mib.c
+   , snmplib/mt_support.c , snmplib/oid_array.c ,
+   snmplib/oid_stash.c , snmplib/parse.c ,
+   snmplib/read_config.c , snmplib/scapi.c ,
+   snmplib/snmp-tc.c , snmplib/snmp.c ,
+   snmplib/snmpAAL5PVCDomain.c , snmplib/snmpCallbackDomain.c
+   , snmplib/snmpIPXDomain.c , snmplib/snmpTCPDomain.c
+   , snmplib/snmpTCPIPv6Domain.c , snmplib/snmpUDPDomain.c
+   , snmplib/snmpUDPIPv6Domain.c , snmplib/snmpUnixDomain.c
+   , snmplib/snmp_alarm.c , snmplib/snmp_api.c ,
+   snmplib/snmp_auth.c , snmplib/snmp_client.c ,
+   snmplib/snmp_debug.c , snmplib/snmp_enum.c ,
+   snmplib/snmp_logging.c , snmplib/snmp_parse_args.c ,
+   snmplib/snmp_secmod.c , snmplib/snmp_transport.c ,
+   snmplib/snmpksm.c , snmplib/snmpusm.c , snmplib/snmpv3.c
+   , snmplib/snprintf.c , snmplib/strtol.c ,
+   snmplib/strtoul.c , snmplib/system.c , snmplib/tools.c
+   , snmplib/vacm.c , testing/T.c ,
+   testing/etimetest.c , testing/keymanagetest.c ,
+   testing/misctest.c , testing/scapitest.c:
+
+   beginnings of ucd-snmp -> net-snmp structural changes.
+     - config.h -> include/net-snmp/net-snmp-config.h
+       - this, of course, changes just about every file in the repository.
+   
+2002-01-04 12:49  hardaker
+
+   * Makefile.in , Makefile.top , configure ,
+   configure.in , sedscript.in , agent/Makefile.in
+   , agent/agent_handler.c , agent/agent_index.c ,
+   agent/agent_read_config.c , agent/agent_registry.c ,
+   agent/agent_trap.c , agent/auto_nlist.c ,
+   agent/kernel.c , agent/mib_modules.c ,
+   agent/snmp_agent.c , agent/snmp_vars.c ,
+   agent/snmpd.c , agent/helpers/Makefile.in ,
+   agent/helpers/bulk_to_next.c , agent/helpers/debug_handler.c
+   , agent/helpers/instance.c , agent/helpers/multiplexer.c
+   , agent/helpers/null.c , agent/helpers/old_api.c ,
+   agent/helpers/read_only.c , agent/helpers/serialize.c ,
+   agent/helpers/table.c , agent/helpers/table_array.c ,
+   agent/helpers/table_data.c , agent/helpers/table_dataset.c
+   , agent/helpers/table_iterator.c ,
+   agent/mibgroup/Makefile.in , agent/mibgroup/header_complex.c
+   , agent/mibgroup/kernel_sunos5.c ,
+   agent/mibgroup/testdelayed.c , agent/mibgroup/testhandler.c
+   , agent/mibgroup/util_funcs.c ,
+   agent/mibgroup/Rmon/agutil.c , agent/mibgroup/Rmon/alarm.c
+   , agent/mibgroup/Rmon/event.c ,
+   agent/mibgroup/Rmon/history.c , agent/mibgroup/Rmon/rows.c
+   , agent/mibgroup/Rmon/statistics.c ,
+   agent/mibgroup/agent/nsTransactionTable.c ,
+   agent/mibgroup/agentx/agentx_config.c ,
+   agent/mibgroup/agentx/client.c ,
+   agent/mibgroup/agentx/master.c ,
+   agent/mibgroup/agentx/master_admin.c ,
+   agent/mibgroup/agentx/protocol.c ,
+   agent/mibgroup/agentx/subagent.c ,
+   agent/mibgroup/disman/mteObjectsTable.c ,
+   agent/mibgroup/disman/mteTriggerBooleanTable.c ,
+   agent/mibgroup/disman/mteTriggerDeltaTable.c ,
+   agent/mibgroup/disman/mteTriggerExistenceTable.c ,
+   agent/mibgroup/disman/mteTriggerTable.c ,
+   agent/mibgroup/disman/mteTriggerThresholdTable.c ,
+   agent/mibgroup/examples/example.c ,
+   agent/mibgroup/examples/ucdDemoPublic.c ,
+   agent/mibgroup/host/hr_device.c ,
+   agent/mibgroup/host/hr_disk.c ,
+   agent/mibgroup/host/hr_filesys.c ,
+   agent/mibgroup/host/hr_network.c ,
+   agent/mibgroup/host/hr_other.c ,
+   agent/mibgroup/host/hr_partition.c ,
+   agent/mibgroup/host/hr_print.c ,
+   agent/mibgroup/host/hr_proc.c ,
+   agent/mibgroup/host/hr_storage.c ,
+   agent/mibgroup/host/hr_swinst.c ,
+   agent/mibgroup/host/hr_swrun.c ,
+   agent/mibgroup/host/hr_system.c , agent/mibgroup/mibII/at.c
+   , agent/mibgroup/mibII/icmp.c ,
+   agent/mibgroup/mibII/interfaces.c , agent/mibgroup/mibII/ip.c
+   , agent/mibgroup/mibII/ipAddr.c ,
+   agent/mibgroup/mibII/ipv6.c ,
+   agent/mibgroup/mibII/kernel_linux.c ,
+   agent/mibgroup/mibII/mta_sendmail.c ,
+   agent/mibgroup/mibII/route_write.c ,
+   agent/mibgroup/mibII/snmp_mib.c ,
+   agent/mibgroup/mibII/sysORTable.c ,
+   agent/mibgroup/mibII/system_mib.c ,
+   agent/mibgroup/mibII/tcp.c , agent/mibgroup/mibII/tcpTable.c
+   , agent/mibgroup/mibII/udp.c ,
+   agent/mibgroup/mibII/udpTable.c ,
+   agent/mibgroup/mibII/vacm_context.c ,
+   agent/mibgroup/mibII/vacm_vars.c ,
+   agent/mibgroup/mibII/var_route.c:
+
+   beginnings of ucd-snmp -> net-snmp structural changes.
+     - config.h -> include/net-snmp/net-snmp-config.h
+       - this, of course, changes just about every file in the repository.
+   
+2002-01-04 12:47  hardaker
+
+   * acconfig.h , config.h.in:
+
+   removed uneeded older files
+   
+2002-01-03 14:15  hardaker
+
+   * perl/SNMP/SNMP.xs:
+
+   patch #492072 to main branch
+   
+2002-01-03 14:00  hardaker
+
+   * agent/mibgroup/ucd-snmp/disk.c:
+
+   check results of setmntent before using them.
+   
+2002-01-03 13:57  hardaker
+
+   * apps/snmpnetstat/if.c:
+
+   check against growing server returns as pointed out by bug #498956
+   
+2002-01-03 11:40  hardaker
+
+   * perl/manager/displaytable.pm:
+
+   PNGGraph -> GDGraph
+   
+2002-01-03 11:39  hardaker
+
+   * agent/mibgroup/versiontag:
+
+   change export name to "net-snmp" from "ucd-snmp"
+   
+2002-01-03 11:39  hardaker
+
+   * agent/mibgroup/testhandler.c ,
+   local/mib2c.create-dataset.conf , local/mib2c.iterate.conf:
+
+   make use of the new multi-add functions.
+   
+2002-01-03 11:38  hardaker
+
+   * agent/helpers/: table_dataset.c , table_dataset.h:
+
+   add multiple default row column definitions using one function call (varargs).
+   
+2002-01-03 11:38  hardaker
+
+   * agent/helpers/: table.c , table.h:
+
+   add multiple indexes using one function call (varargs).
+   
+2002-01-03 11:37  hardaker
+
+   * agent/snmp_vars.h:
+
+   remove no longer defined v4 api functions (getStatPtr no less).
+   
+2002-01-03 11:37  hardaker
+
+   * agent/snmp_agent.h:
+
+   remove no longer defined v4 api functions.
+   
+2002-01-03 10:31  hardaker
+
+   * snmplib/: Makefile.in , oid_stash.c , oid_stash.h:
+
+   data stashing based on an oid caching tree.
+   
+2001-12-26 15:36  hardaker
+
+   * perl/manager/: INSTALL , Makefile.PL , manager.pm:
+
+   update to make it a bit easier to install (including a Makefile for
+   automated installation).
+   
+2001-12-26 13:20  hardaker
+
+   * perl/manager/: INSTALL , displaytable.pm , getValues.pm
+   , green.gif , manager.pm , red.gif , setupauth
+   , setupdb , setupuser , snmptosql:
+
+   moving manager to perl/manager
+   
+2001-12-24 16:10  hardaker
+
+   * FAQ , sedscript.in , version.h ,
+   perl/SNMP/SNMP.pm:
+
+   - (version.h sedscript.in): version tag ( 5.0.pre1 )
+   
+2001-12-24 16:04  hardaker
+
+   * local/: Makefile.in , mib2c , mib2c.conf:
+
+   Update to make people understand that it's not finished and you must
+   reference a particular configuration file at this point.
+   
+2001-12-24 15:51  hardaker
+
+   * FAQ , sedscript.in , version.h ,
+   perl/SNMP/SNMP.pm:
+
+   - (version.h sedscript.in): version tag ( 5.0.not.even.close )
+   
+2001-12-24 15:50  hardaker
+
+   * README:
+
+   more comments.
+   
+2001-12-24 15:41  hardaker
+
+   * FAQ , README:
+
+   more updates
+   
+2001-12-24 15:20  hardaker
+
+   * agent/helpers/old_api.c:
+
+   doxygen comments
+   
+2001-12-24 15:20  hardaker
+
+   * NEWS , README:
+
+   5.0 comment updates.
+   
+2001-12-24 15:19  hardaker
+
+   * agent/agent_handler.c:
+
+   doxygen comments on a few functions.
+   
+2001-12-24 15:09  hardaker
+
+   * agent/helpers/table_iterator.c:
+
+   memory leaks.
+   
+2001-12-24 10:06  hardaker
+
+   * agent/Makefile.in:
+
+   remove dependencies for non-existent modules
+   
+2001-12-23 15:47  hardaker
+
+   * net-snmp-config:
+
+   opps.  Don't check in generated files.
+   
+2001-12-23 15:46  hardaker
+
+   * config.h.in , configure , configure.in ,
+   agent/mibgroup/host/hr_swinst.c:
+
+   fix rpm usage (I hope).
+   
+2001-12-23 14:50  hardaker
+
+   * agent/mibgroup/agent/.cvsignore:
+
+   added .cvsignore file
+   
+2001-12-23 14:49  hardaker
+
+   * Makefile.in:
+
+   install net-snmp-config.
+   
+2001-12-23 14:47  hardaker
+
+   * NEWS , configure , configure.in ,
+   net-snmp-config , net-snmp-config.in , agent/Makefile.in
+   , apps/Makefile.in:
+
+   - created a net-snmp-config script to report compiled libs.
+   - separated libs needed by agent from those needed by the rest of the
+     applications.
+   
+2001-12-21 16:53  hardaker
+
+   * perl/AnyData_SNMP/INSTALL:
+
+   mention how to install DBI
+   
+2001-12-21 16:44  hardaker
+
+   * perl/AnyData_SNMP/Makefile.PL:
+
+   remove version requirement for AnyData
+   
+2001-12-21 16:37  hardaker
+
+   * perl/AnyData_SNMP/INSTALL:
+
+   make install as root.
+   
+2001-12-21 16:32  hardaker
+
+   * perl/AnyData_SNMP/: INSTALL , INSTALL , INSTALL ,
+   INSTALL:
+
+   better descr
+   
+2001-12-21 16:09  hardaker
+
+   * perl/AnyData_SNMP/README:
+
+   minor wording change.
+   
+2001-12-21 16:07  hardaker
+
+   * perl/AnyData_SNMP/INSTALL:
+
+   mention it's very alpha code.
+   
+2001-12-21 16:06  hardaker
+
+   * perl/AnyData_SNMP/INSTALL:
+
+   new instructions
+   
+2001-12-21 10:18  hardaker
+
+   * NEWS:
+
+   mention doxygen.
+   
+2001-12-21 10:17  hardaker
+
+   * configure , configure.in ,
+   agent/mibgroup/agent_mibs.h:
+
+   compile in agent specific support mibs.
+   
+2001-12-21 09:49  hardaker
+
+   * NEWS:
+
+   (still incomplete) 2nd update for 5.0
+   
+2001-12-21 09:44  hardaker
+
+   * NEWS:
+
+   (incomplete) update for 5.0
+   
+2001-12-19 17:10  hardaker
+
+   * snmplib/asn1.c:
+
+   fix realloc float and double builds.
+   
+2001-12-19 16:34  hardaker
+
+   * local/mib2c.iterate.conf:
+
+   misc fixes.
+   
+2001-12-19 16:33  hardaker
+
+   * local/mib2c:
+
+   define a C datatype as $var.decl (per Robert's suggestion.  Robert: we
+   probably want pointers for things like strings, no?  maybe one type
+   that is always a pointer and another that is sometimes depending on
+   the type?)
+   
+2001-12-19 16:32  hardaker
+
+   * apps/snmpbulkwalk.c:
+
+   change default bulk number to 100 from the ridiculous 1000.
+   
+2001-12-19 16:32  hardaker
+
+   * agent/Makefile.in , agent/mibgroup/Makefile.in ,
+   apps/Makefile.in , snmplib/Makefile.in:
+
+   make depend
+   
+2001-12-19 08:10  hardaker
+
+   * agent/: snmp_agent.c , helpers/bulk_to_next.c:
+
+   getbulk updates to make it the modules responsibility to update the
+   varbind chain an the repeat counter.
+   
+2001-12-19 07:57  hardaker
+
+   * agent/: agent_handler.c , snmp_agent.c , snmp_agent.h
+   , helpers/Makefile.in , helpers/all_helpers.c ,
+   helpers/all_helpers.h , helpers/bulk_to_next.c ,
+   helpers/bulk_to_next.h:
+
+   GETBULK support for the new API.
+     - may need to make some slight modifications.
+     - defaults to GETNEXT for any handler that doesn't set HANDLER_CAN_GETBULK.
+     - doesn't deal properly yet with end-of-mib condition removal.
+   
+2001-12-19 06:05  jbpn
+
+   * apps/snmptrapd.c:
+
+     - drop -p option.  Addresses to listen on now come as optional
+       arguments at the end of the command line.
+   
+     - drop (long-deprecated) -q option.
+   
+     - re-ordered options in usage message to be alphabetical, and
+       changed description of some options to be more similar to snmpd
+       options (where appropriate).
+   
+2001-12-19 04:38  jbpn
+
+   * agent/snmpd.c:
+
+     - drop -p and -T options.  Addresses to listen on now come as
+       optional arguments at the end of the command line.
+   
+     - re-ordered options in usage message to be alphabetical, plus
+       minor formatting tweaks.
+   
+     - re-written options processing loop to use optarg().
+   
+2001-12-18 08:44  jbpn
+
+   * mibs/: UCD-SNMP-MIB.txt (V4-2-patches.5), UCD-SNMP-MIB.txt:
+
+     - add OBJECT IDENTIFIER for win32 agent
+   
+2001-12-18 08:16  hardaker
+
+   * agent/helpers/old_api.c:
+
+   warning -> debug.
+   
+2001-12-17 10:15  jbpn
+
+   * agent/snmp_agent.c:
+
+     - handle getNext queries where the initial varbind->type is
+       ASN_PRIV_INCL_RANGE (these currently arise only in AgentX
+       subagents but the handling is not specific to AgentX).
+   
+       Basically this is done by performing a GET first on all the
+       variables in a request.  For variables that had an initial type of
+       ASN_PRIV_INCL_RANGE and were satisfied by this initial GET, we use
+       this value as the result.  For variables that did not have an
+       initial type of ASN_PRIV_INCL_RANGE, or variable that had and
+       initial type of ASN_PRIV_INCL_RANGE but were not satisfied by this
+       GET request, we proceed to perform a GET-NEXT type request as
+       normal.
+   
+2001-12-17 10:04  jbpn
+
+   * agent/helpers/old_api.c:
+
+     - add function register_mib_table_row() which emulates old
+       functionality.
+   
+     - use snmp_handler_registration_free() in register_old_api().
+   
+2001-12-17 09:39  jbpn
+
+   * snmplib/mib.c:
+
+     - fix bogus indent
+   
+2001-12-17 09:38  jbpn
+
+   * agent/mibgroup/agentx/master_admin.c:
+
+     - right number of arguments for register_mib_context2() in
+       register_agentx_list().
+   
+     - use snmp_handler_registration_free() in ditto.
+   
+2001-12-13 19:22  hardaker
+
+   * agent/helpers/table_iterator.c:
+
+   remove handler injection order (serialize needs to be called first)
+   
+2001-12-13 19:22  hardaker
+
+   * agent/snmp_agent.c:
+
+   remove unneeded check for already answered ASN_NULLs in first pass.
+   
+2001-12-12 09:31  hardaker
+
+   * perl/AnyData_SNMP/: .cvsignore , INSTALL , MANIFEST
+   , README , snmpsh:
+
+   - doc update.
+   - snmpsh now supports aliases so you can define command sets.
+   - snmpsh now reads a ~/.snmpshrc file for storing these defined aliases.
+   
+2001-12-12 06:42  jbpn
+
+   * agent/agent_registry.c:
+
+     - new function join_subtree() which repairs "punctured" subtrees
+       (these arise in particular when AgentX row registrations are
+       withdrawn).
+   
+     - copy reginfo when doing a range registration (as we used to do
+       with the variable structure), since each node must stand alone.
+   
+     - add parameter to register_mib_context2 to allow REGISTER_OID
+       callbacks to be withheld (for instance, you need this to avoid
+       excess AgentX traffic for row registrations).
+   
+     - remove register_mib_table_row() -- this has moved to old_api.c
+   
+     - call join_subtree() in unregister_mibs_by_session().
+   
+2001-12-12 06:33  jbpn
+
+   * agent/: agent_handler.c , agent_handler.h:
+
+     - add functions snmp_handler_free(), snmp_handler_dup(),
+       snmp_handler_registration_dup() and
+       snmp_handler_registration_free().
+   
+2001-12-11 18:41  hardaker
+
+   * agent/mibgroup/mibII/vacm_vars.c:
+
+   Fix bug where pdu->contextName is NULL.
+   
+2001-12-11 07:34  hardaker
+
+   * local/mib2c:
+
+   BITS: ipaddr -> octet_str
+   
+2001-12-11 04:11  jbpn
+
+   * agent/: snmp_agent.c , snmp_agent.h ,
+   mibgroup/agentx/master.c:
+
+     - send INCLUSIVE search ranges if appropriate
+   
+2001-12-10 20:43  rstory
+
+   * local/mib2c:
+
+   add noaccess flag for not-accessible nodes
+   
+2001-12-10 14:51  hardaker
+
+   * perl/AnyData_SNMP/: Changes , DBD_AnyData.patch ,
+   Format.pm , INSTALL , MANIFEST , Makefile.PL ,
+   Storage.pm , snmpsh:
+
+   First version
+   
+2001-12-10 03:20  jbpn
+
+   * agent/agent_read_config.c:
+
+     - don't strdup arg to ds_set_string
+   
+2001-12-10 03:19  jbpn
+
+   * snmplib/read_config.c:
+
+     - ditto in set_persistent_directory()
+   
+2001-12-10 03:18  jbpn
+
+   * snmplib/read_config.c:
+
+     - don't strdup() in set_configuration_directory() because
+       ds_set_string() already does that for you.
+   
+2001-12-07 09:43  hardaker
+
+   * agent/: helpers/table_iterator.c , helpers/table_iterator.h
+   , mibgroup/agent/nsTransactionTable.c ,
+   mibgroup/mibII/vacm_context.c:
+
+   - Implement new mantra: "always pass more information, rather than less".
+   - fix table iterater GETNEXTs for missing data points.
+   - add a new hook to free loop contexts at the end of the entire iteration.
+   
+2001-12-06 06:58  jbpn
+
+   * agent/mibgroup/agentx/: client.c (JBPN-CBL-4.1), client.c:
+
+     - if request IDs don't match, then call handle_agentx_packet() --
+       copes better with unexpected packets, in particular fixes
+       intermittent duplicate trap issue (due to resent
+   agentx-Notify-PDU).
+   
+2001-12-05 13:46  hardaker
+
+   * snmplib/snmp-tc.c:
+
+   Ahem.  Opps.  Missing includes.
+     - note to self: compile first, *then* check in changes.
+   
+2001-12-05 13:41  hardaker
+
+   * snmplib/snmp-tc.c:
+
+   add in the missing functions from the NEW-AGENT-API branch.
+     (and to answer Robert's pending question of what happened, it was
+      likely one of the files that failed to commit on my side that you
+      tried to fix and somewhere between the two of us the changes were lost).
+   
+2001-12-05 10:03  jbpn
+
+   * man/snmpcmd.1:
+
+     - minor tweaks
+   
+2001-12-05 09:14  jbpn
+
+   * man/snmpcmd.1:
+
+     - add TCP/IPv6 domain to AGENT SPEC section
+   
+     - incorporate suggestions from rstory
+   
+2001-12-05 08:47  jbpn
+
+   * snmplib/snmpTCPIPv6Domain.c:
+
+     - use SOCK_STREAM not SOCK_DGRAM (duh!).  You wouldn't believe how
+       confusing this was -- e.g. how on *earth* can that connect() be
+       succeeding!
+   
+2001-12-05 08:36  jbpn
+
+   * snmplib/snmpTCPDomain.c:
+
+     - make sure to close socket if you can't malloc the encoded far-end
+       address in snmp_tcp_transport()
+   
+2001-12-05 08:27  hardaker
+
+   * win32/: snmptranslate/snmptranslate.dsp ,
+   snmptrap/snmptrap.dsp , snmptrapd/snmptrapd.dsp ,
+   snmpusm/snmpusm.dsp , snmpvacm/snmpvacm.dsp:
+
+   merge from 4.2 patches to main line
+   
+2001-12-05 08:23  hardaker
+
+   * ChangeLog , FAQ , NEWS , README ,
+   README.win32 , acconfig.h , config.h.in ,
+   configure , configure.in , sedscript.in ,
+   agent/agent_callbacks.h , agent/agent_read_config.c ,
+   agent/snmpd.c , agent/mibgroup/kernel_sunos5.c ,
+   agent/mibgroup/versiontag , agent/mibgroup/host/hr_disk.c
+   , agent/mibgroup/host/hr_partition.c ,
+   agent/mibgroup/host/hr_system.c , agent/mibgroup/mibII/at.c
+   , agent/mibgroup/mibII/icmp.c ,
+   agent/mibgroup/mibII/interfaces.c , agent/mibgroup/mibII/ip.c
+   , agent/mibgroup/mibII/ipAddr.c ,
+   agent/mibgroup/mibII/kernel_linux.c ,
+   agent/mibgroup/mibII/kernel_linux.h ,
+   agent/mibgroup/mibII/route_write.c ,
+   agent/mibgroup/mibII/system_mib.c ,
+   agent/mibgroup/mibII/tcp.c , agent/mibgroup/mibII/tcpTable.c
+   , agent/mibgroup/mibII/udp.c ,
+   agent/mibgroup/mibII/udpTable.c ,
+   agent/mibgroup/mibII/var_route.c ,
+   agent/mibgroup/notification/snmpNotifyTable.c ,
+   agent/mibgroup/ucd-snmp/disk.c ,
+   agent/mibgroup/ucd-snmp/vmstat_solaris2.c ,
+   apps/snmpnetstat/if.c , local/mib2c , local/tkmib
+   , man/snmpd.conf.5.def , mibs/UCD-SNMP-MIB.txt ,
+   perl/SNMP/SNMP.pm , snmplib/asn1.c ,
+   snmplib/default_store.h , snmplib/mib.c ,
+   snmplib/read_config.c , snmplib/read_config.h ,
+   snmplib/snmp.h , snmplib/snmp_api.c ,
+   win32/snmpwalk/snmpwalk.dsp , win32/config.h ,
+   win32/mib_module_config.h , win32/mib_module_includes.h ,
+   win32/mib_module_inits.h , win32/win32.dsw ,
+   win32/win32.opt , win32/encode_keychange/encode_keychange.dsp
+   , win32/libagent/libagent.dsp , win32/libsnmp/libsnmp.dsp
+   , win32/libsnmp_dll/libsnmp.def ,
+   win32/libsnmp_dll/libsnmp_dll.dsp ,
+   win32/libucdmibs/libucdmibs.dsp ,
+   win32/snmpbulkget/snmpbulkget.dsp ,
+   win32/snmpbulkwalk/snmpbulkwalk.dsp , win32/snmpd/snmpd.dsp
+   , win32/snmpdelta/snmpdelta.dsp , win32/snmpdf/snmpdf.dsp
+   , win32/snmpget/snmpget.dsp ,
+   win32/snmpgetnext/snmpgetnext.dsp ,
+   win32/snmpnetstat/snmpnetstat.dsp , win32/snmpset/snmpset.dsp
+   , win32/snmpstatus/snmpstatus.dsp ,
+   win32/snmptable/snmptable.dsp , win32/snmptest/snmptest.dsp:
+
+   merge from 4.2 patches to main line
+   
+2001-12-05 07:51  jbpn
+
+   * snmplib/snmpUDPIPv6Domain.c:
+
+     - fix bug in address parser
+   
+2001-12-05 07:48  jbpn
+
+   * snmplib/: snmpTCPIPv6Domain.c , snmpUDPIPv6Domain.c:
+
+     - minor changes to, ahem, make it compile
+   
+2001-12-05 07:42  jbpn
+
+   * snmplib/snmpTCPDomain.c:
+
+     - conditionalise #include <fcntl.h>
+   
+2001-12-05 07:38  jbpn
+
+   * snmplib/snmp_transport.c:
+
+     - fix typo
+   
+2001-12-05 07:29  jbpn
+
+   * acconfig.h , configure.in:
+
+     - mention the TCP/IPv6 transport in config, and add a #define for it
+       if appropriate
+   
+2001-12-05 07:28  jbpn
+
+   * snmplib/snmp_transport.c:
+
+     - call snmp_tcp6_ctor() if appropriate
+   
+2001-12-05 07:27  jbpn
+
+   * snmplib/: snmpTCPIPv6Domain.c , snmpTCPIPv6Domain.h:
+
+     - TCP/IPv6 transport domain.  Untested.
+   
+2001-12-05 07:19  jbpn
+
+   * snmplib/snmpUDPIPv6Domain.c:
+
+     - make encoded addresses at transport open time
+   
+2001-12-05 07:17  jbpn
+
+   * snmplib/: snmpTCPDomain.c , snmp_transport.h:
+
+     - move #definition of SNMP_STREAM_QUEUE_LEN from snmpTCPDomain.c
+       to snmp_transport.h
+   
+2001-12-05 07:10  hardaker
+
+   * agent/: snmp_agent.c , snmp_vars.c:
+
+   remove some unneeded functions like, oh, I don't know, getStatPtr().
+   
+2001-12-05 05:43  jbpn
+
+   * snmplib/snmp_api.h:
+
+     - remove legacy callback operation names
+   
+2001-12-05 05:06  jbpn
+
+   * snmplib/snmpUDPIPv6Domain.c:
+
+     - changed textual address parsing
+   
+2001-12-04 22:52  nba
+
+   * snmplib/snmpUDPIPv6Domain.c:
+
+   Fix bind parameters, so that the agent works
+   
+2001-12-04 13:36  hardaker
+
+   * agent/helpers/table.h , agent/helpers/table_iterator.c
+   , agent/helpers/table_iterator.h ,
+   agent/mibgroup/agent/nsTransactionTable.c ,
+   agent/mibgroup/mibII/vacm_context.c , local/mib2c.iterate.conf:
+
+   - move forgotten function typedefs to iterator specific header file.
+   - add a void * pointer for the callbacks to make functions more reusable.
+   
+2001-12-04 13:11  hardaker
+
+   * agent/helpers/table.h , agent/helpers/table_iterator.c
+   , agent/helpers/table_iterator.h ,
+   agent/mibgroup/agent/nsTransactionTable.c ,
+   agent/mibgroup/mibII/vacm_context.c , local/mib2c.iterate.conf:
+
+   move iterator specific table information into its own structure.
+   
+2001-12-04 12:16  hardaker
+
+   * agent/helpers/all_helpers.h:
+
+   Fix prototype as pointed out by Jerome Peducasse
+   
+2001-12-04 10:10  jbpn
+
+   * man/snmpcmd.1:
+
+     - mention that not all transport domains are always available.
+   
+2001-12-04 09:55  jbpn
+
+   * man/snmpcmd.1:
+
+     - remove -p and -T options from documentation.
+   
+     - add lengthy new section describing new transport address
+       specification format, with examples and everything!
+   
+2001-12-04 07:14  jbpn
+
+   * snmplib/snmp_parse_args.c:
+
+     - drop -p and -T options for apps.
+   
+2001-12-04 03:10  jbpn
+
+   * snmplib/: snmpUDPIPv6Domain.c , snmpUDPIPv6Domain.h:
+
+     - add create_ostring method, export ucdSnmpUDPIPv6Domain[]
+   
+2001-12-04 02:19  jbpn
+
+   * mibs/UCD-SNMP-MIB.txt:
+
+     - mention IPv6 transport domain OIDs in relevant comment.
+   
+2001-12-03 15:07  nba
+
+   * snmplib/snmpUDPDomain.c:
+
+   Quell a const cast warning.
+   
+2001-12-03 15:07  nba
+
+   * snmplib/snmp_api.c:
+
+   Fix debug output from retries.
+   
+2001-12-03 15:06  nba
+
+   * apps/notification_log.c , snmplib/oid_array.c:
+
+   HAVE_SYS_TYPES_H is not conditional.
+   
+2001-12-03 15:04  nba
+
+   * apps/Makefile.in:
+
+   Fix to allow compilations outside source directory.
+   
+2001-12-03 15:03  nba
+
+   * acconfig.h , config.h.in , configure ,
+   configure.in , snmplib/snmpUDPIPv6Domain.c ,
+   snmplib/snmp_transport.c:
+
+   Fixes to make UDPIPv6 transport work for Solaris, Linux and FreeBSD.
+   It compiles, and the apps send v6 packets. Agent not yet tested.
+   
+2001-12-03 09:48  hardaker
+
+   * local/: mib2c.iterate.conf , mib2c.create-dataset.conf:
+
+   copy roberts spiffy header text
+   
+2001-12-03 08:36  hardaker
+
+   * apps/notification_log.c:
+
+   datentime column.
+   
+2001-12-03 08:01  hardaker
+
+   * agent/snmp_agent.c:
+
+   fix problem with double delegated requests after getnext loop.
+   
+2001-12-03 08:00  hardaker
+
+   * configure , configure.in ,
+   mibs/NOTIFICATION-LOG-MIB.txt:
+
+   notification log mib added to default list.
+   
+2001-12-03 05:33  jbpn
+
+   * agent/mibgroup/agentx/protocol.c:
+
+     - remove spurious debugging output ("blah")
+   
+2001-11-30 23:26  hardaker
+
+   * agent/: agent_handler.c , snmp_agent.c , snmp_agent.h:
+
+   Change how request processing gets done such that request objects are
+   all calloced at once and get reused instead of reallocated.  Big speed
+   improvements.
+   
+2001-11-30 15:22  hardaker
+
+   * Makefile.in , doxygen.conf:
+
+   "make doc" to run doxygen.
+   
+2001-11-30 10:31  hardaker
+
+   * agent/helpers/: debug_handler.c , multiplexer.h:
+
+   doxygen fixes
+   
+2001-11-30 09:26  jbpn
+
+   * agent/agent_handler.c:
+
+     - use DEBUGMSGOIDRANGE in register_handler() if appropriate.
+   
+2001-11-30 09:24  jbpn
+
+   * agent/mibgroup/agentx/master_admin.c:
+
+     - fix memory leak in register_agentx_list() when subagent tries to
+       register a MIB region that fails either because it is a duplicate
+       or because of some other reason.
+   
+2001-11-30 08:44  jbpn
+
+   * agent/helpers/old_api.c:
+
+     - fix memory leak of old_info (that never seems to get used for
+       anything anyway?)
+   
+     - fix memory leak that arises during row registration (in AgentX
+       subagents) because successive vars cause apparent duplicate
+       registrations (this is a deficiency) -- but it would appear this
+       could arise in other situations too (genuine duplicate
+       registrations).
+   
+2001-11-30 06:33  jbpn
+
+   * agent/agent_trap.c:
+
+     - fix broken parsing in snmpd_parse_config_trapsess() -- loop was
+       copying the same (first) token MAX_ARGS times.
+   
+     - eliminate memory leak in ditto.
+   
+     - fix typo ("Pausible cause" -> "Possible cause) in ditto.
+   
+2001-11-30 06:29  jbpn
+
+   * snmplib/snmp_api.c:
+
+     - print fd in sess_process_packet() -- useful for debugging
+   
+2001-11-30 06:28  jbpn
+
+   * snmplib/: snmpCallbackDomain.c , snmpCallbackDomain.h:
+
+     - remove a couple of unnecessary #includes from snmpCallbackDomain.h
+   
+     - set *opaque to NULL after we free it -- it might matter.
+   
+2001-11-30 03:47  jbpn
+
+   * agent/mibgroup/agentx/subagent.c:
+
+     - clone PDU in handle_agentx_subagent() before sending it on callback
+       session to avoid double free() and free()d memory reads.
+   
+     - more concise (ahem) declaration of mycallback in handle_agentx_packet().
+   
+2001-11-29 05:51  jbpn
+
+   * agent/mibgroup/agentx/master_admin.c:
+
+     - put session and subsession in subagent description (helpful for
+       debugging)
+   
+2001-11-29 05:49  jbpn
+
+   * agent/helpers/Makefile.in:
+
+     - fix INSTALLHEADERS
+   
+2001-11-29 05:48  jbpn
+
+   * agent/mibgroup/agentx/subagent.c:
+
+     - add some debugging to init_subagent() (which showed that it wasn't
+       being called, so...).
+   
+     - fix cast in handle_subagent_set_response()
+   
+2001-11-29 05:46  jbpn
+
+   * agent/snmp_vars.c:
+
+     - make sure init_subagent() gets called
+   
+2001-11-28 09:28  hardaker
+
+   * agent/agent_registry.c:
+
+   check for session registrations in all contexts.
+   
+2001-11-28 06:39  hardaker
+
+   * apps/notification_log.c , snmplib/oid_array.c:
+
+   Add sys/types.h for bug #486277.
+   
+2001-11-28 04:03  jbpn
+
+   * apps/notification_log.c:
+
+     - #include <netdb.h>
+   
+2001-11-28 04:03  jbpn
+
+   * configure.in , snmplib/Makefile.in:
+
+     - install snmp_transport.h and snmp*Domain.h (for the configured
+       transport domains)
+   
+2001-11-28 03:29  jbpn
+
+   * snmplib/ucd-snmp-includes.h:
+
+     - reverse mystery removal of #include <netinet/in.h> and #include
+   <sys/time.h>
+   
+2001-11-27 17:28  hardaker
+
+   * agent/: snmp_agent.c , snmp_agent.h:
+
+   more intelligently allocate tree space based on number of varbinds in request.
+   
+2001-11-27 14:26  hardaker
+
+   * agent/: snmp_agent.c , snmp_agent.h:
+
+   malloc one large tree_cache array rather than an array of tree_cache pointers.
+   
+2001-11-27 12:19  hardaker
+
+   * agent/helpers/all_helpers.h:
+
+   include file name change.
+   
+2001-11-27 11:43  hardaker
+
+   * agent/snmp_agent.c:
+
+   comment changes.
+   
+2001-11-27 07:52  hardaker
+
+   * apps/Makefile.in:
+
+   fixed Makefile for snmptrapd.
+   
+2001-11-27 07:48  hardaker
+
+   * agent/helpers/: Makefile.in , all_helpers.c ,
+   all_helpers.h , debug_handler.c , debug_handler.h:
+
+   debug handler created for inserting debugging output into the calling chain.
+   
+2001-11-27 07:47  hardaker
+
+   * agent/agent_handler.c:
+
+   enum definitions for modes and can_modes.
+   
+2001-11-26 15:29  hardaker
+
+   * agent/snmp_agent.c:
+
+   set PDU variable to NULL to avoid freeing it twice.
+   
+2001-11-26 11:20  hardaker
+
+   * snmplib/snmpCallbackDomain.c:
+
+   plug another memory leak.
+   
+2001-11-26 09:07  hardaker
+
+   * testing/tests/: T020snmpv3get , T021snmpv3getnext ,
+   T022snmpv3getMD5 , T023snmpv3getMD5DES ,
+   T024snmpv3getSHA1 , T025snmpv3getSHADES ,
+   T028snmpv3getfail , T030snmpv3usercreation ,
+   T053agentv1trap , T054agentv2ctrap , T055agentv1mintrap
+   , T056agentv2cmintrap , T110agentxget ,
+   T111agentxset , T112agentxsetfail , T113agentxtrap ,
+   T120proxyget , T121proxyset , T122proxysetfail:
+
+   don't use contexts in tests.
+   
+2001-11-26 08:57  hardaker
+
+   * snmplib/snmpCallbackDomain.c:
+
+   fix memory leak.
+   
+2001-11-26 08:49  hardaker
+
+   * agent/mibgroup/: testdelayed.c , agentx/master.c ,
+   ucd-snmp/proxy.c:
+
+   use free_delegated_cache() to plug memory leaks.
+   
+2001-11-26 08:48  hardaker
+
+   * agent/: agent_handler.c , agent_handler.h:
+
+   free_delegated_cache() routine
+   
+2001-11-26 08:19  jbpn
+
+   * apps/snmptrapd.c:
+
+     - add the ability to listen for traps on multiple transports via the
+       -p option (consistent with snmpd).
+   
+2001-11-26 05:44  jbpn
+
+   * agent/mibgroup/target/target.c:
+
+     - use snmp_tdomain_transport_oid() to do session creation from
+       <tDomain-oid, tAddress-octet-string> pair, to allow creation of
+       non-IPv4 sessions in snmpTargetAddrTable.
+   
+2001-11-26 04:45  jbpn
+
+   * snmplib/: snmpAAL5PVCDomain.c , snmpIPXDomain.c ,
+   snmpTCPDomain.c , snmpUDPDomain.c , snmpUnixDomain.c
+   , snmp_transport.c , snmp_transport.h:
+
+     - add support for creating a transport from a
+       <tDomain-oid, tAddress-octet-string> pair.
+   
+2001-11-26 03:06  jbpn
+
+   * agent/mibgroup/target/target.c:
+
+     - use snmp_tdomain_support() to determine whether a transport domain
+       is supported.
+   
+2001-11-23 10:24  jbpn
+
+   * apps/snmptrapd.c:
+
+     - add multiple transport domain support for trapd -- this was really
+       REALLY easy!
+   
+2001-11-23 09:25  jbpn
+
+   * agent/mibgroup/disman/mteTriggerTable.c ,
+   snmplib/snmp_transport.c , snmplib/snmp_transport.h:
+
+     - remove legacy function snmp_transport_support() (replaced with
+       snmp_tdomain_support()).
+   
+2001-11-23 08:57  jbpn
+
+   * snmplib/snmpAAL5PVCDomain.c:
+
+     - use network order for AAL5PVC transport address encoding
+   
+2001-11-23 08:47  jbpn
+
+   * snmplib/: snmpAAL5PVCDomain.c , snmpIPXDomain.c ,
+   snmpUnixDomain.c:
+
+     - set local_length, remote_length as appropriate
+   
+2001-11-23 08:39  jbpn
+
+   * snmplib/Makefile.in:
+
+     - fix typo
+   
+2001-11-23 08:34  jbpn
+
+   * agent/: agent_trap.c ,
+   mibgroup/notification/snmpNotifyTable.c:
+
+     - make traps work with new-style addresses, use domain-based address
+       encodings in snmpTargetAddrTable.  Note you can now send traps/informs
+       over any supported transport type by using the trapsess directive and
+       a transport:address type specification.
+   
+2001-11-23 08:31  jbpn
+
+   * snmplib/: snmpAAL5PVCDomain.c , snmpIPXDomain.c ,
+   snmpTCPDomain.c , snmpUDPDomain.c , snmpUnixDomain.c:
+
+     - create appropriately-encoded local or remote endpoint addresses at
+       transport open time.
+   
+2001-11-23 06:50  jbpn
+
+   * snmplib/Makefile.in:
+
+     - update dependencies for transports
+   
+2001-11-22 09:08  jbpn
+
+   * testing/: TESTCONF.sh , eval_tools.sh ,
+   tests/T001snmpv1get , tests/T002snmpv1getnext ,
+   tests/T003snmpv1getfail , tests/T014snmpv2cget ,
+   tests/T015snmpv2cgetnext , tests/T016snmpv2cgetfail ,
+   tests/T017snmpv2ctov1getfail , tests/T018snmpv1tov2cgetfail
+   , tests/T020snmpv3get , tests/T021snmpv3getnext ,
+   tests/T022snmpv3getMD5 , tests/T023snmpv3getMD5DES ,
+   tests/T024snmpv3getSHA1 , tests/T025snmpv3getSHADES ,
+   tests/T028snmpv3getfail , tests/T030snmpv3usercreation ,
+   tests/T049snmpv3inform , tests/T050snmpv3trap ,
+   tests/T051snmpv2ctrap , tests/T052snmpv2cinform ,
+   tests/T053agentv1trap , tests/T054agentv2ctrap ,
+   tests/T055agentv1mintrap , tests/T056agentv2cmintrap ,
+   tests/T058agentauthtrap , tests/T100agenthup ,
+   tests/T110agentxget , tests/T111agentxset ,
+   tests/T112agentxsetfail , tests/T113agentxtrap ,
+   tests/T120proxyget , tests/T121proxyset ,
+   tests/T122proxysetfail:
+
+     - use udp:<hostname>:<port> instead of -p to make tests work again
+   
+2001-11-22 00:20  hardaker
+
+   * apps/: notification_log.c , notification_log.h:
+
+   mork wore on the notification log mib.  It now supports variable
+   storage, but segfaults on access due to pdu cloning problems I'm not
+   going to work out right now.
+   
+2001-11-21 23:15  hardaker
+
+   * apps/Makefile.in:
+
+   fix snmptrapd linking.
+   
+2001-11-21 22:58  rstory
+
+   * snmplib/asn1.h:
+
+   remove duplicate OID_LENGTH; use actual oid type in calculation
+   
+2001-11-21 22:49  hardaker
+
+   * snmplib/snmpCallbackDomain.c:
+
+   add NULL pointer for rbuild in session creation.
+   
+2001-11-21 22:49  hardaker
+
+   * agent/mibgroup/ucd-snmp/proxy.c , apps/notification_log.c:
+
+   netinet/in.h needed.
+   
+2001-11-21 22:49  hardaker
+
+   * agent/mibgroup/agentx/subagent.c:
+
+   variable clean ups.
+   
+2001-11-21 22:33  hardaker
+
+   * agent/mibgroup/agentx/master_request.c ,
+   agent/mibgroup/mibII/icmp.c , agent/mibgroup/mibII/tcpTable.c
+   , agent/mibgroup/mibII/udpTable.c ,
+   agent/mibgroup/ucd-snmp/file.c , local/mib2c ,
+   local/mib2c.array-auto.conf , local/mib2c.array-user.conf
+   , local/mib2c.create-dataset.conf ,
+   local/mib2c.iterate.conf , local/mib2c.vartypes.conf ,
+   man/Makefile.in , mibs/Makefile.in ,
+   mibs/NET-SNMP-AGENT-MIB.txt , perl/SNMP/SNMP.xs ,
+   snmplib/Makefile.in , snmplib/mib.c , snmplib/mib.h
+   , snmplib/read_config.c , snmplib/read_config.h ,
+   snmplib/snmp-tc.h , snmplib/snmpUnixDomain.h ,
+   snmplib/snmp_api.c , snmplib/snmp_api.h ,
+   snmplib/snmp_client.c , snmplib/snmp_client.h ,
+   snmplib/snmp_transport.c , snmplib/snmp_transport.h ,
+   snmplib/tools.c , snmplib/tools.h , snmplib/vacm.c:
+
+   Death: UCD-SNMP
+   Birth: NET-SNMP
+     (new agent API merged to the main branch)
+   
+2001-11-21 22:08  rstory
+
+   * snmplib/: vacm.h , asn1.h:
+
+   Death: UCD-SNMP
+   Birth: NET-SNMP
+     (new agent API merged to the main branch)
+   
+2001-11-21 21:43  rstory
+
+   * snmplib/: snmpCallbackDomain.c , snmpCallbackDomain.h:
+
+   Death: UCD-SNMP
+   Birth: NET-SNMP
+     (new agent API merged to the main branch)
+   
+2001-11-21 21:40  rstory
+
+   * snmplib/snmp.h:
+
+   Death: UCD-SNMP
+   Birth: NET-SNMP
+     (new agent API merged to the main branch)
+   
+2001-11-21 21:33  rstory
+
+   * snmplib/: oid_array.c , oid_array.h:
+
+   Death: UCD-SNMP
+   Birth: NET-SNMP
+     (new agent API merged to the main branch)
+   
+2001-11-21 21:30  rstory
+
+   * snmplib/: data_list.c , data_list.h:
+
+   Death: UCD-SNMP
+   Birth: NET-SNMP
+     (new agent API merged to the main branch)
+   
+2001-11-21 18:56  hardaker
+
+   * Makefile.in , config.h.in , configure ,
+   configure.in , version.h , agent/Makefile.in ,
+   agent/agent_handler.c , agent/agent_handler.h ,
+   agent/agent_index.c , agent/agent_read_config.c ,
+   agent/agent_registry.c , agent/agent_registry.h ,
+   agent/mib_modules.c , agent/snmp_agent.c ,
+   agent/snmp_agent.h , agent/snmp_vars.c , agent/snmpd.c
+   , agent/ucd-snmp-agent-includes.h , agent/var_struct.h
+   , agent/helpers/.cvsignore , agent/helpers/Makefile.in
+   , agent/helpers/all_helpers.c ,
+   agent/helpers/all_helpers.h , agent/helpers/instance.c ,
+   agent/helpers/instance.h , agent/helpers/multiplexer.c ,
+   agent/helpers/multiplexer.h , agent/helpers/null.c ,
+   agent/helpers/null.h , agent/helpers/old_api.c ,
+   agent/helpers/old_api.h , agent/helpers/read_only.c ,
+   agent/helpers/read_only.h , agent/helpers/serialize.c ,
+   agent/helpers/serialize.h , agent/helpers/set_helper.h ,
+   agent/helpers/table.c , agent/helpers/table.h ,
+   agent/helpers/table_array.c , agent/helpers/table_array.h
+   , agent/helpers/table_data.c , agent/helpers/table_data.h
+   , agent/helpers/table_dataset.c ,
+   agent/helpers/table_dataset.h , agent/helpers/table_iterator.c
+   , agent/helpers/table_iterator.h ,
+   agent/mibgroup/Makefile.in , agent/mibgroup/host_res.h
+   , agent/mibgroup/mibincl.h , agent/mibgroup/target.h
+   , agent/mibgroup/testdelayed.c ,
+   agent/mibgroup/testdelayed.h , agent/mibgroup/testhandler.c
+   , agent/mibgroup/testhandler.h ,
+   agent/mibgroup/util_funcs.c , agent/mibgroup/util_funcs.h
+   , agent/mibgroup/agent/nsTransactionTable.c ,
+   agent/mibgroup/agent/nsTransactionTable.h ,
+   agent/mibgroup/agentx/.cvsignore ,
+   agent/mibgroup/agentx/client.c ,
+   agent/mibgroup/agentx/master.c ,
+   agent/mibgroup/agentx/master.h ,
+   agent/mibgroup/agentx/master_admin.c ,
+   agent/mibgroup/agentx/subagent.c ,
+   agent/mibgroup/disman/.cvsignore ,
+   agent/mibgroup/disman/mteTriggerTable.c ,
+   agent/mibgroup/examples/.cvsignore ,
+   agent/mibgroup/host/hr_disk.c , agent/mibgroup/host/hr_disk.h
+   , agent/mibgroup/host/hr_partition.c ,
+   agent/mibgroup/host/hr_partition.h ,
+   agent/mibgroup/host/hr_swinst.c ,
+   agent/mibgroup/mibII/.cvsignore ,
+   agent/mibgroup/mibII/interfaces.c , agent/mibgroup/mibII/ip.c
+   , agent/mibgroup/mibII/system_mib.c ,
+   agent/mibgroup/mibII/tcp.c , agent/mibgroup/mibII/udp.c
+   , agent/mibgroup/mibII/vacm_context.c ,
+   agent/mibgroup/mibII/vacm_context.h ,
+   agent/mibgroup/mibII/vacm_vars.c ,
+   agent/mibgroup/mibII/vacm_vars.h ,
+   agent/mibgroup/target/target_counters.c ,
+   agent/mibgroup/target/target_counters.h ,
+   agent/mibgroup/ucd-snmp/proxy.c ,
+   agent/mibgroup/ucd-snmp/proxy.h ,
+   agent/mibgroup/ucd-snmp/registry.c , apps/Makefile.in ,
+   apps/notification_log.c , apps/notification_log.h ,
+   apps/snmptrapd.c:
+
+   Death: UCD-SNMP
+   Birth: NET-SNMP
+     (new agent API merged to the main branch)
+   
+2001-11-21 06:43  jbpn
+
+   * config.h.in:
+
+     - IPv6 config defs
+   
+2001-11-21 06:36  jbpn
+
+   * agent/snmp_agent.c , snmplib/snmp_api.c:
+
+     - remove now-extraneous #include "snmpBlahDomain.h" lines
+   
+2001-11-21 03:39  jbpn
+
+   * apps/.cvsignore:
+
+   [no log message]
+   
+2001-11-20 09:38  jbpn
+
+   * snmplib/: snmpIPXDomain.c , snmpIPXDomain.h:
+
+     - duh.  Forgot a couple of things to do with domain-based transport
+       address parsing.
+   
+2001-11-20 09:29  jbpn
+
+   * agent/snmp_agent.c:
+
+     - use new domain-based transport address parsing for agent NSAPs
+   
+2001-11-20 09:27  jbpn
+
+   * snmplib/: snmpAAL5PVCDomain.c , snmpAAL5PVCDomain.h ,
+   snmpIPXDomain.c , snmpTCPDomain.c , snmpTCPDomain.h
+   , snmpUDPDomain.c , snmpUDPDomain.h ,
+   snmpUnixDomain.c , snmpUnixDomain.h , snmp_api.c ,
+   snmp_transport.c , snmp_transport.h:
+
+     - domain-based transport address parsing
+   
+2001-11-20 09:16  jbpn
+
+   * snmplib/: snmpUDPIPv6Domain.c , snmpUDPIPv6Domain.h:
+
+     - UDP/IPv6 transport domain.  Note: incomplete!
+   
+2001-11-20 08:29  jbpn
+
+   * agent/: agent_index.c , agent_index.h:
+
+     - unregister_{string,int,oid}_index() utility functions contributed
+       by Damian Gilmurray.
+   
+2001-11-20 02:26  jbpn
+
+   * snmplib/: snmp_api.h (V4-2-patches.1), snmp_api.h:
+
+     - remove duplicate definition of SNMP_MAX_SEC_NAME_SIZE, noted by
+       Karl M. Hegbloom.
+   
+2001-11-19 16:59  driehuis
+
+   * snmplib/asn1.h:
+
+   Fix typo in comment [karlheg@microsharp.com]
+   
+2001-11-16 08:34  jbpn
+
+   * apps/snmptest.c:
+
+     - add support for Unsigned32/Gauge32 types
+   
+2001-11-15 10:03  jbpn
+
+   * agent/mibgroup/agentx/: protocol.c (V4-2-patches.5), protocol.c:
+
+     - stricter test for null OIDs
+   
+2001-11-15 08:44  jbpn
+
+   * man/snmpd.conf.5.def:
+
+     - document read-only nature of snmpEnableAuthenTraps.0 if value is
+       configured via the authtrapenable token
+   
+2001-11-15 08:44  jbpn
+
+   * agent/: agent_read_config.c , agent_trap.c ,
+   mibgroup/mibII/snmp_mib.c:
+
+     - make value of snmpEnableAuthenTraps.0 persistent.  Setting via
+       a read-only configuration file also makes object notWritable (as
+       sysContact.0 et al.).
+   
+2001-11-15 06:57  jbpn
+
+   * agent/mibgroup/mibII/vacm_vars.c:
+
+     - let VACM checks succeed for non-IPv4 transports
+   
+2001-11-15 05:19  jbpn
+
+   * testing/tests/: T111agentxset , T121proxyset:
+
+     - use psyscontact not syscontact to set initial value of sysContact.0
+       object since the latter also makes the object read-only.
+   
+2001-11-15 05:07  jbpn
+
+   * agent/: snmpd.c (V4-2-patches.6), snmpd.c:
+
+     - minor fix to formatting of usage message
+   
+2001-11-15 04:05  jbpn
+
+   * agent/mibgroup/agentx/agentx_config.c:
+
+     - add missing #include "snmpd.h" (for #definition of MASTER_AGENT)
+     - don't strdup() agentxsocket value -- ds_set_string does it for you
+     - change debugging to fit in better with rest of module
+   
+2001-11-14 16:05  hardaker
+
+   * configure, configure.in (V4-2-patches.[7,7]), config.h.in
+   , configure , configure.in:
+
+   patch from Harrie to fix init function checking in modules
+   
+2001-11-14 16:00  hardaker
+
+   * agent/mibgroup/agentx/: agentx_config.c , agentx_config.h
+   , master.c , master.h , subagent.h:
+
+   slightly modified patch from Harrie to move agentx configuration into
+   a separate file.
+   
+2001-11-13 13:57  hardaker
+
+   * apps/notification_log.h:
+
+   file notification_log.h was initially added on branch NEW-AGENT-API.
+   
+2001-11-13 13:57  hardaker
+
+   * apps/notification_log.c:
+
+   file notification_log.c was initially added on branch NEW-AGENT-API.
+   
+2001-11-13 13:55  hardaker
+
+   * agent/mibgroup/agent/nsTransactionTable.c:
+
+   file nsTransactionTable.c was initially added on branch NEW-AGENT-API.
+   
+2001-11-13 13:55  hardaker
+
+   * agent/mibgroup/agent/nsTransactionTable.h:
+
+   file nsTransactionTable.h was initially added on branch NEW-AGENT-API.
+   
+2001-11-13 13:55  hardaker
+
+   * mibs/NET-SNMP-AGENT-MIB.txt:
+
+   file NET-SNMP-AGENT-MIB.txt was initially added on branch NEW-AGENT-API.
+   
+2001-11-13 05:29  jbpn
+
+   * agent/mibgroup/ucd-snmp/vmstat_solaris2.c:
+
+     - patch from Jochen Kmietsch to quieten some noisy logging
+   
+2001-11-13 04:13  jbpn
+
+   * agent/mibgroup/agentx/master_admin.c:
+
+     - use unregister_mib_table_row() when appropriate in
+       unregister_agentx_list().
+   
+2001-11-13 03:23  jbpn
+
+   * agent/agent_registry.c:
+
+     - reset vr->namelen when we've finished with it
+   
+2001-11-12 23:19  hardaker
+
+   * agent/helpers/all_helpers.c:
+
+   file all_helpers.c was initially added on branch NEW-AGENT-API.
+   
+2001-11-12 23:19  hardaker
+
+   * agent/helpers/all_helpers.h:
+
+   file all_helpers.h was initially added on branch NEW-AGENT-API.
+   
+2001-11-08 08:09  jbpn
+
+   * agent/agent_registry.c:
+
+     - better implementation of unregister_mib_table_row(), which uses
+       ranges properly in the callback (hence much more efficient for
+       AgentX).
+   
+2001-11-07 09:56  jbpn
+
+   * agent/mibgroup/agentx/protocol.c:
+
+     - remove now-redundant agentx_build functions
+   
+2001-11-07 06:31  jbpn
+
+   * agent/mibgroup/agentx/: client.c , master_admin.c ,
+   protocol.c:
+
+     - use DEBUGMSGOIDRANGE() in a couple of places for more comprehensive
+       debugging output.
+   
+     - parse unregister ranges properly, and use the range properly for
+       passing to unregister_mib_context().
+   
+2001-11-07 03:33  jbpn
+
+   * snmplib/: snmp_debug.c , snmp_debug.h:
+
+     - add DEBUGSMSGOIDRANGE() macro for debugging OID ranges
+   
+2001-11-06 06:04  jbpn
+
+   * agent/mibgroup/agentx/master_request.c:
+
+     - reset the inclusive flag in a couple of cases, to prevent spurious
+       INCLUSIVE getNext behaviour
+   
+2001-11-05 08:09  jbpn
+
+   * agent/mibgroup/agentx/protocol.c:
+
+     - correct bug in range_subid tweak code
+   
+2001-11-05 05:00  jbpn
+
+   * agent/agent_registry.c:
+
+     - calculate upper bound for table row registrations slightly differently
+   
+2001-11-01 09:35  jbpn
+
+   * agent/mibgroup/agentx/: master.c , protocol.c ,
+   protocol.h , subagent.c:
+
+     - implement relocating buffer version of agentx_build() routines,
+       and use them.
+   
+2001-11-01 09:33  jbpn
+
+   * snmplib/: snmp_api.c , snmp_api.h:
+
+     - support for relocatable buffer build callbacks via open_ex calls
+   
+2001-10-30 07:19  jbpn
+
+   * agent/mibgroup/mibII/interfaces.c:
+
+     - fix bug whereby interface counter is not reset, noted by (amongst
+       others) Victor Kirhenshtein in patch #474064.
+   
+2001-10-30 03:24  jbpn
+
+   * snmplib/snmp_api.c:
+
+     - make the initial buffer size 2048 in snmp_resend_request (as in
+       _sess_async_send) to make success/fail behaviour for AgentX more
+       predictable (since AgentX STILL doesn't use relocating buffers,
+       boo hiss).
+   
+2001-10-29 23:16  rstory
+
+   * local/mib2c.array-auto.conf:
+
+   file mib2c.array-auto.conf was initially added on branch NEW-AGENT-API.
+   
+2001-10-29 23:16  rstory
+
+   * local/mib2c.array-user.conf:
+
+   file mib2c.array-user.conf was initially added on branch NEW-AGENT-API.
+   
+2001-10-28 14:53  rstory
+
+   * agent/helpers/table_array.c:
+
+   file table_array.c was initially added on branch NEW-AGENT-API.
+   
+2001-10-28 14:53  rstory
+
+   * agent/helpers/table_array.h:
+
+   file table_array.h was initially added on branch NEW-AGENT-API.
+   
+2001-10-28 14:50  rstory
+
+   * snmplib/oid_array.h:
+
+   file oid_array.h was initially added on branch NEW-AGENT-API.
+   
+2001-10-28 14:50  rstory
+
+   * snmplib/oid_array.c:
+
+   file oid_array.c was initially added on branch NEW-AGENT-API.
+   
+2001-10-26 19:41  hardaker
+
+   * agent/mibgroup/agentx/master.c:
+
+   patch from Harrie to fix function name in error message
+   
+2001-10-26 06:05  jbpn
+
+   * agent/mibgroup/mibII/: interfaces.c , interfaces.h:
+
+      - add support for rx and tx drop counts (ifInDiscards and
+        ifOutDiscards) for Linux (2.2+)
+   
+2001-10-26 05:57  jbpn
+
+   * aclocal.m4:
+
+     - add if_iqdrops member to struct ifnet
+   
+2001-10-26 04:03  jbpn
+
+   * agent/mibgroup/mibII/interfaces.c:
+
+     - add translation for atm(37) type interfaces for Linux
+   
+2001-10-26 03:43  jbpn
+
+   * man/snmpd.conf.5.def:
+
+     - document the fact that setting sysLocation.0 (et al.) via a
+       syslocation (or equivalent) token makes the object read-only,
+       returning a notWritable error response if an attempt is made to
+       SET it.
+   
+2001-10-24 10:07  jbpn
+
+   * agent/mibgroup/mibII/: system_mib.c (V4-2-patches.4),
+   system_mib.c:
+
+     - fix typo noted by Tim Dietz
+   
+2001-10-24 08:43  jbpn
+
+   * agent/mibgroup/mibII/: system_mib.c , system_mib.h:
+
+     - implement persistence for sysLocation.0, sysContact.0 and sysName.0
+   
+     - presence of a syslocation token in snmpd.conf makes sysLocation.0
+       non-writable (returns notWritable on SET attempts)
+   
+2001-10-24 05:08  jbpn
+
+   * agent/mibgroup/host/: hr_swinst.c (V4-2-patches.2), hr_swinst.c:
+
+     - fix small memory leak just introduced
+   
+2001-10-24 03:42  jbpn
+
+   * agent/mibgroup/host/hr_swinst.c:
+
+     - use pkginfo interface to determine type of software package more
+       specifically if possible.  Slight variation on patch #473669, submitted
+       by Stefan Radman.
+   
+2001-10-24 03:38  jbpn
+
+   * acconfig.h , configure.in:
+
+     - autoconf support for detecting pkginfo interface in libadm.  Thanks
+       to Stefan Radman (patch #473669).
+   
+2001-10-21 07:26  hardaker
+
+   * local/mib2c.iterate.conf:
+
+   file mib2c.iterate.conf was initially added on branch NEW-AGENT-API.
+   
+2001-10-19 09:51  hardaker
+
+   * local/mib2c.create-dataset.conf:
+
+   file mib2c.create-dataset.conf was initially added on branch NEW-AGENT-API.
+   
+2001-10-17 07:52  dts12
+
+   * FAQ (V4-2-patches.2), FAQ:
+
+   Mention the MRTG tutorial web pages
+     (as suggested by Christian Robottom Reis)
+   
+2001-10-15 06:49  jbpn
+
+   * snmplib/: snmpIPXDomain.c , snmpUDPDomain.c:
+
+     - zero socket address structures.  Hopefully fixes problems on NetBSD
+       noted by Joakim Althini (related to sa_len member probably??).
+   
+2001-10-11 16:30  hardaker
+
+   * agent/Makefile.in , agent/mibgroup/Makefile.in ,
+   snmplib/mib.c , snmplib/snmp_api.c:
+
+   Oppses.
+   
+2001-10-11 14:15  hardaker
+
+   * man/Makefile.in , man/snmp_api_errstring.3 ,
+   man/snmp_config.5.def , man/snmp_error.3 ,
+   man/snmp_perror.3 , man/snmp_sess_perror.3 ,
+   man/snmpcmd.1 , man/snmpd.1.def , man/snmpd.conf.5.def
+   , man/snmpset.1 , man/snmptranslate.1 ,
+   man/snmptrapd.8 , man/snmptrapd.conf.5.def ,
+   man/snmpwalk.1 , mibs/DISMAN-SCRIPT-MIB.txt ,
+   mibs/IANAifType-MIB.txt , mibs/Makefile.mib ,
+   mibs/README.mibs , mibs/SMUX-MIB.txt ,
+   mibs/UCD-SNMP-MIB.txt , mibs/mibfetch , mibs/rfclist
+   , mibs/smistrip , perl/SNMP/SNMP.xs ,
+   snmplib/Makefile.in , snmplib/asn1.c ,
+   snmplib/default_store.c , snmplib/int64.c ,
+   snmplib/mib.c , snmplib/mib.h , snmplib/mt_support.c
+   , snmplib/mt_support.h , snmplib/parse.c ,
+   snmplib/scapi.c , snmplib/scapi.h , snmplib/snmp_api.c
+   , snmplib/snmp_auth.c , snmplib/snmp_client.c ,
+   snmplib/snmp_debug.c , snmplib/snmpusm.c ,
+   snmplib/snmpv3.c , snmplib/system.c , snmplib/tools.c
+   , snmplib/ucd-snmp-includes.h , testing/Makefile.in
+   , win32/config.h , win32/config.h.borland:
+
+   massive merge from the patches branch to the main line.
+   
+2001-10-11 14:01  hardaker
+
+   * COPYING , ChangeLog , FAQ , Makefile.in ,
+   NEWS , README , acconfig.h , aclocal.m4 ,
+   config.guess , config.h.in , config.sub ,
+   configure , configure.in , ltconfig , ltmain.sh
+   , makefileindepend.pl , sedscript.in , version.h
+   , agent/Makefile.in , agent/agent_index.c ,
+   agent/agent_read_config.c , agent/agent_read_config.h ,
+   agent/agent_registry.c , agent/agent_trap.c ,
+   agent/snmp_agent.h , agent/snmp_vars.c ,
+   agent/snmp_vars.h , agent/snmpd.c ,
+   agent/mibgroup/Makefile.in , agent/mibgroup/kernel_sunos5.c
+   , agent/mibgroup/mibincl.h , agent/mibgroup/ucd_snmp.h
+   , agent/mibgroup/util_funcs.c ,
+   agent/mibgroup/examples/example.c ,
+   agent/mibgroup/host/hr_disk.c ,
+   agent/mibgroup/host/hr_partition.c ,
+   agent/mibgroup/host/hr_print.c ,
+   agent/mibgroup/host/hr_storage.c ,
+   agent/mibgroup/host/hr_swrun.c ,
+   agent/mibgroup/host/hr_system.c , agent/mibgroup/mibII/at.c
+   , agent/mibgroup/mibII/at.h ,
+   agent/mibgroup/mibII/icmp.c ,
+   agent/mibgroup/mibII/interfaces.c , agent/mibgroup/mibII/ip.c
+   , agent/mibgroup/mibII/ipAddr.c ,
+   agent/mibgroup/mibII/mta_sendmail.h ,
+   agent/mibgroup/mibII/route_write.c ,
+   agent/mibgroup/mibII/sysORTable.c ,
+   agent/mibgroup/mibII/system_mib.c ,
+   agent/mibgroup/mibII/tcp.c , agent/mibgroup/mibII/tcpTable.c
+   , agent/mibgroup/mibII/udp.c ,
+   agent/mibgroup/mibII/udpTable.c ,
+   agent/mibgroup/mibII/var_route.c ,
+   agent/mibgroup/notification/snmpNotifyFilterProfileTable.c ,
+   agent/mibgroup/notification/snmpNotifyFilterTable.c ,
+   agent/mibgroup/notification/snmpNotifyTable.c ,
+   agent/mibgroup/smux/smux.c ,
+   agent/mibgroup/target/snmpTargetAddrEntry.c ,
+   agent/mibgroup/target/snmpTargetParamsEntry.c ,
+   agent/mibgroup/ucd-snmp/diskio.c ,
+   agent/mibgroup/ucd-snmp/dlmod.c ,
+   agent/mibgroup/ucd-snmp/file.c ,
+   agent/mibgroup/ucd-snmp/memory.c ,
+   agent/mibgroup/ucd-snmp/memory.h ,
+   agent/mibgroup/ucd-snmp/memory_freebsd2.c ,
+   agent/mibgroup/ucd-snmp/memory_freebsd2.h ,
+   agent/mibgroup/ucd-snmp/memory_netbsd1.c ,
+   agent/mibgroup/ucd-snmp/memory_netbsd1.h ,
+   agent/mibgroup/ucd-snmp/memory_solaris2.c ,
+   agent/mibgroup/ucd-snmp/memory_solaris2.h ,
+   agent/mibgroup/ucd-snmp/proxy.c ,
+   agent/mibgroup/ucd-snmp/vmstat.c ,
+   agent/mibgroup/ucd-snmp/vmstat_bsdi4.c ,
+   agent/mibgroup/ucd-snmp/vmstat_bsdi4.h ,
+   agent/mibgroup/ucd-snmp/vmstat_freebsd2.c ,
+   agent/mibgroup/ucd-snmp/vmstat_netbsd1.c ,
+   agent/mibgroup/ucd-snmp/vmstat_solaris2.c , apps/Makefile.in
+   , apps/snmpdelta.c , apps/snmpdf.c ,
+   apps/snmpget.c , apps/snmpgetnext.c , apps/snmpset.c
+   , apps/snmpstatus.c , apps/snmptable.c ,
+   apps/snmptest.c , apps/snmptranslate.c ,
+   apps/snmptrap.c , apps/snmptrapd.c ,
+   apps/snmptrapd_log.c , apps/snmpusm.c , apps/snmpvacm.c
+   , apps/snmpwalk.c , apps/snmpnetstat/Makefile.in
+   , local/mib2c.conf , local/mib2c.vartypes.conf ,
+   local/pass_persisttest , local/tkmib:
+
+   massive merge from the patches branch to the main line.
+   
+2001-10-09 07:14  hardaker
+
+   * CodingStyle:
+
+   Sometimes we feel like a -nut
+   
+2001-10-09 06:15  jbpn
+
+   * agent/agent_registry.c:
+
+     - properly account for the length of the suffix in the variable
+       table in register_mib_table_row()
+   
+2001-10-08 08:53  jbpn
+
+   * agent/mibgroup/agentx/client.c:
+
+     - declare version_sysoid_len as extern INT not extern oid, so as to
+       match its actual definition in sytem_mib.c.  This caused all kinds of
+       fun & games on Linux on a Alpha.
+   
+2001-10-04 08:31  jbpn
+
+   * snmplib/: callback.c , callback.h:
+
+     - add function snmp_callback_list() to return list of callbacks for a
+       given <major, minor> pair.
+   
+2001-10-04 07:14  hardaker
+
+   * local/pass_persisttest:
+
+   file pass_persisttest was initially added on branch V4-2-patches.
+   
+2001-10-03 05:42  jbpn
+
+   * snmplib/keytools.c:
+
+     - change expression at l. 415 from:
+   
+           *kcstring++ = *kcstring ^ *newkey++;
+   
+       which has undefined behaviour to:
+   
+           *kcstring++ ^= *newkey++;
+   
+       which is okay (since *kcstring is only evaluated once).  Similarly
+       at l. 530.  The previous constructs cause warnings with GCC3 and
+       some other compilers.  Thanks to Niel Markwick who noted this in
+       bug #465969.
+   
+2001-10-03 03:11  jbpn
+
+   * agent/agent_registry.c:
+
+     - do SNMPD_CALLBACK_UNREGISTER_OID callbacks in
+       unregister_mibs_by_session() -- called when AgentX subagents
+       disappear.
+   
+2001-10-02 06:01  jbpn
+
+   * agent/mibgroup/agentx/protocol.c:
+
+     - don't send ASN_PRIV_INCL_RANGE and ASN_PRIV_EXCL_RANGE on-the-wire
+   
+2001-09-26 08:03  jbpn
+
+   * agent/agent_registry.c:
+
+     - allow split_subtree() to do a split in the middle of a column,
+       keeping the relevant variable in both the old tree and the new
+       tree (arises in AgentX row registrations).
+   
+     - patch from Damian Gilmurray for register_mib_table_row() which
+       allows it to cope with non-zero length variables and also
+       non-contiguous OIDs for adjacent columns.
+   
+     - rewritten dump_registry() that uses reallocating print functions
+       and also prints out variable lists.
+   
+2001-09-26 07:45  jbpn
+
+   * agent/snmp_vars.c:
+
+     - allow for the possibility of subtree name being longer than
+       requested name when calculating the suffix for variable matching.
+   
+     - be strict about subtree chunks being inclusive of the start OID
+       and exclusive of the end OID (shows up big time in AgentX).
+   
+2001-09-26 07:22  jbpn
+
+   * agent/mibgroup/agentx/master_request.c:
+
+     - don't do getNext requests on exclusive searchRanges that begin in
+       a tree marked as a fully-qualified instance (they are doomed to
+       fail).  Skip to the next part of the tree straight away.
+   
+2001-09-26 07:19  jbpn
+
+   * agent/mibgroup/agentx/master_admin.c:
+
+     - bring debugging tokens into line with rest of AgentX code
+   
+2001-09-25 08:15  jbpn
+
+   * apps/snmptrapd_log.c:
+
+     - reinstate a missing space character
+   
+2001-09-25 03:58  jbpn
+
+   * apps/snmptrapd_log.c:
+
+     - remove spurious cast
+   
+2001-09-25 03:45  jbpn
+
+   * apps/snmptrapd.c:
+
+     - fix possible infelicity when printing and syslogging (not sure this is
+       actually possible but)
+   
+2001-09-25 03:09  jbpn
+
+   * snmplib/mib.c:
+
+     - integrate some changes from the V4-2-patches branch: Harrie's
+       prototypes and Wes's fix for bug  #463226.
+   
+2001-09-25 03:01  jbpn
+
+   * apps/snmptrapd_log.c:
+
+     - fix signedness of time stuff
+   
+2001-09-25 02:47  jbpn
+
+   * snmplib/: snmp_logging.c , snmp_logging.h:
+
+     - make argument of snmp_enable_syslog_ident const
+   
+     - don't strdup DEFAULT_LOG_ID if a NULL arg is given
+   
+2001-09-24 09:39  jbpn
+
+   * apps/snmptrapd.c:
+
+     - make use of rewritten output functions in snmptrapd_log.c which
+       avoid fixed length buffers.
+   
+     - fix bug noted in support request #456646 (custom trap format was
+       being ignored for v2 traps and informs).  Thanks to
+       G.Principato@motorola.com for spotting this one.
+   
+     - correct usage for -P option to reflect that it causes output on
+       stderr not stdout.
+   
+2001-09-24 09:36  jbpn
+
+   * apps/: snmptrapd_log.c , snmptrapd_log.h:
+
+     - rewrite of output functions to avoid use of fixed-length buffers
+   
+2001-09-20 13:04  hardaker
+
+   * README , agent/mibgroup/ucd-snmp/logmatch.c ,
+   agent/mibgroup/ucd-snmp/logmatch.h , mibs/UCD-SNMP-MIB.txt:
+
+   new logmatch mib from Stephan Wenzel.
+   
+2001-09-15 08:40  jbpn
+
+   * agent/mibgroup/agentx/master_request.c:
+
+     - override exclusive searchRange getNext operations when retrying
+       operations
+   
+2001-09-15 08:39  jbpn
+
+   * agent/: snmp_agent.c , snmp_agent.h:
+
+     - improved support for AgentX-style inclusive searchRange getNext
+   
+2001-09-14 14:43  hardaker
+
+   * agent/mibgroup/ucd-snmp/diskio.c:
+
+   patch #443115 from Yimin Ge: diskio support for freebsd4
+   
+2001-09-14 14:34  hardaker
+
+   * apps/snmptrapd.c , snmplib/snmp_logging.c ,
+   snmplib/snmp_logging.h:
+
+   Patch #440320 from Mark Ferlatte:
+   
+   1) Adds a new function to the snmp_logging API
+      (snmp_enable_syslog_ident(char *ident))
+   
+   2) Ports snmptrapd to use the existing snmp_logging API instead of
+      using syslog directly.
+   
+   3) Ports snmp_logging.[ch] to use the Win32 Event Log when compiled on
+      Win32. I didn't update the Visual C project files, because I only
+      have access to a newer version of VC, and I didn't know if you
+      wanted them updated. The advapi32 library needs to be added to the
+      project in order for this to work on Win32 (that's where the event
+      log API is).
+   
+2001-09-14 14:22  hardaker
+
+   * config.h.in , configure:
+
+   I, uh, cough, uh forgot to run autoconf/autoheader.  Dave: don't kill me.
+   
+2001-09-14 14:19  hardaker
+
+   * perl/SNMP/: SNMP.pm , SNMP.xs:
+
+   Patch #428884: Add -PR like option to perl module (from Joe Clarke).
+   
+2001-09-14 14:08  hardaker
+
+   * README , acconfig.h , configure.in ,
+   agent/agent_trap.c , agent/mibgroup/agentx/client.c ,
+   agent/mibgroup/host/hr_filesys.c ,
+   agent/mibgroup/host/hr_swinst.c ,
+   agent/mibgroup/mibII/system_mib.c ,
+   agent/mibgroup/mibJJ/system_mib.c ,
+   agent/mibgroup/ucd-snmp/disk.c ,
+   agent/mibgroup/ucd-snmp/errormib.c ,
+   agent/mibgroup/ucd-snmp/extensible.c ,
+   agent/mibgroup/ucd-snmp/file.c ,
+   agent/mibgroup/ucd-snmp/loadave.c ,
+   agent/mibgroup/ucd-snmp/memory.c ,
+   agent/mibgroup/ucd-snmp/memory_freebsd2.c ,
+   agent/mibgroup/ucd-snmp/memory_netbsd1.c ,
+   agent/mibgroup/ucd-snmp/memory_solaris2.c ,
+   agent/mibgroup/ucd-snmp/proc.c ,
+   agent/mibgroup/ucd-snmp/versioninfo.c ,
+   agent/mibgroup/ucd-snmp/vmstat.c ,
+   agent/mibgroup/ucd-snmp/vmstat_bsdi4.c ,
+   agent/mibgroup/ucd-snmp/vmstat_freebsd2.c ,
+   agent/mibgroup/ucd-snmp/vmstat_netbsd1.c ,
+   agent/mibgroup/ucd-snmp/vmstat_solaris2.c ,
+   snmplib/snmpAAL5PVCDomain.c , snmplib/snmpAAL5PVCDomain.h
+   , snmplib/snmpUnixDomain.c , snmplib/snmpUnixDomain.h
+   , snmplib/snmp_api.h , snmplib/snmpv3.c ,
+   snmplib/asn1.h:
+
+   Applied a modified version of patch #427343 from Harrie:
+     make enterprise ID relocatable where legal to do so
+   
+2001-09-14 12:09  hardaker
+
+   * agent/: Makefile.in , mibgroup/Makefile.in:
+
+   Alternative solution to patch #312694:
+     move date_n_time utilities to snmplib/snmp-tc.c.
+   
+2001-09-14 12:08  hardaker
+
+   * agent/mibgroup/host/: hr_utils.c , hr_utils.h:
+
+   removed.  Functionality moved to snmplib/snmp-tc.[ch]
+   
+2001-09-14 12:06  hardaker
+
+   * agent/mibgroup/host.h , agent/mibgroup/host/hr_filesys.c
+   , agent/mibgroup/host/hr_swinst.c ,
+   agent/mibgroup/host/hr_system.c ,
+   agent/mibgroup/host/hr_system.h ,
+   agent/mibgroup/host/hr_utils.c , snmplib/Makefile.in ,
+   snmplib/snmp-tc.c , snmplib/snmp-tc.h:
+
+   Alternative solution to patch #312694:
+     move date_n_time utilities to snmplib/snmp-tc.c.
+   
+2001-09-14 09:48  hardaker
+
+   * win32/config.h.borland:
+
+   file config.h.borland was initially added on branch V4-2-patches.
+   
+2001-09-14 06:19  jbpn
+
+   * agent/mibgroup/agentx/: master.c , master_request.c ,
+   master_request.h:
+
+     - use inclusive search range only when appropriate for getNext
+       queries
+   
+2001-09-12 06:47  hardaker
+
+   * snmplib/snmpCallbackDomain.c:
+
+   file snmpCallbackDomain.c was initially added on branch NEW-AGENT-API.
+   
+2001-09-12 06:47  hardaker
+
+   * snmplib/snmpCallbackDomain.h:
+
+   file snmpCallbackDomain.h was initially added on branch NEW-AGENT-API.
+   
+2001-09-06 07:40  jbpn
+
+   * agent/: snmp_agent.c , snmp_vars.c:
+
+     - if include bit is set in an AgentX SearchRange (hence type of varbind
+       is ASN_PRIV_INCL_RANGE), try an exact query first because an object
+       whose name is lexi-equal is a valid response; if exact query fails
+       then fall back to an inexact query.
+   
+2001-09-06 07:38  jbpn
+
+   * agent/mibgroup/agentx/: master.c , master_request.c ,
+   protocol.c , subagent.c:
+
+     - oops, used INCL/EXCL wrong way round in a couple of places
+   
+     - better test for scoping requirements in subagent
+   
+2001-09-04 07:14  jbpn
+
+   * agent/snmpd.c:
+
+     - add missing break; after processing -P option, noted by Botond
+       Tarnay (see patch #458327)
+   
+2001-08-28 03:04  jbpn
+
+   * agent/: snmp_agent.c (V4-2-patches.7), snmp_agent.c:
+
+     - add missing #include <tcpd.h> if using libwrap, noted by Nathan
+       Neulinger (patch #453831).
+   
+2001-08-28 02:38  jbpn
+
+   * agent/: snmpd.c (V4-2-patches.1), snmpd.c:
+
+     - avoid use of pre-processor directives inside printf() call, which
+       is a macro in glibc, making this an undefined behaviour
+       construct (which GCC 3.0 refuses to compile).  See bug #455804 for
+       further details.
+   
+2001-08-24 10:00  rstory
+
+   * snmplib/data_list.h:
+
+   file data_list.h was initially added on branch NEW-AGENT-API.
+   
+2001-08-24 10:00  rstory
+
+   * snmplib/data_list.c:
+
+   file data_list.c was initially added on branch NEW-AGENT-API.
+   
+2001-08-22 08:45  jbpn
+
+   * agent/: snmp_vars.c , mibgroup/agentx/master.c ,
+   mibgroup/agentx/master_request.c , mibgroup/agentx/protocol.c
+   , mibgroup/agentx/subagent.c:
+
+     - add checking that results to be returned to master agent are in
+       requested scope (if any) (getBulk not yet done)
+   
+2001-08-15 09:31  jbpn
+
+   * snmplib/snmp_debug.c:
+
+     - use sprint_realloc_objid in debugmsg_oid to print long OIDs.
+   
+2001-08-15 08:37  jbpn
+
+   * agent/mibgroup/mibII/vacm_vars.c:
+
+     - increment the value of snmpInBadCommunityUses when attempting an
+       operation not permitted by the given community, per RFC 1907.
+   
+2001-08-15 08:34  jbpn
+
+   * agent/snmp_agent.c:
+
+     - when translating the v2+ error-status value authorizationError
+       into noSuchName for a v1 session, increment the value of
+       snmpInBadCommunityUses, per RFC 2576.
+   
+2001-08-14 03:22  jbpn
+
+   * snmplib/snmp_client.c:
+
+     - in snmp_set_var_objid(), try to detect a previously-malloc()ed
+       buffer for the variable name, and free() it, to avoid memory
+   leaks.
+   
+2001-08-13 03:47  jbpn
+
+   * snmplib/snmpTCPDomain.c:
+
+     - use Win32 calls to change blocking state of sockets if
+       appropriate.  Thanks to Joerg Mattes for help debugging this.
+   
+2001-08-13 03:37  jbpn
+
+   * snmplib/snmp_api.c:
+
+     - perform an SNMP_CALLBACK_OP_DISCONNECT and close the connection if
+       we get an error on a stream receive, as well as if it is closed in
+       an orderly fashion.  This makes life easier on Win32 inparticular.
+       Thanks to Joerg Mattes for help with debugging this.
+   
+2001-08-09 03:10  hardaker
+
+   * agent/helpers/table_dataset.c:
+
+   file table_dataset.c was initially added on branch NEW-AGENT-API.
+   
+2001-08-09 03:10  hardaker
+
+   * agent/helpers/table_dataset.h:
+
+   file table_dataset.h was initially added on branch NEW-AGENT-API.
+   
+2001-08-08 01:42  hardaker
+
+   * agent/helpers/table_data.h:
+
+   file table_data.h was initially added on branch NEW-AGENT-API.
+   
+2001-08-08 01:42  hardaker
+
+   * agent/helpers/table_data.c:
+
+   file table_data.c was initially added on branch NEW-AGENT-API.
+   
+2001-08-07 13:59  nba
+
+   * man/snmp_perror.3:
+
+   file snmp_perror.3 was initially added on branch V4-2-patches.
+   
+2001-08-07 13:59  nba
+
+   * man/snmp_api_errstring.3:
+
+   file snmp_api_errstring.3 was initially added on branch V4-2-patches.
+   
+2001-08-07 13:59  nba
+
+   * man/snmp_sess_perror.3:
+
+   file snmp_sess_perror.3 was initially added on branch V4-2-patches.
+   
+2001-08-07 13:59  nba
+
+   * man/snmp_error.3:
+
+   file snmp_error.3 was initially added on branch V4-2-patches.
+   
+2001-08-06 04:29  jbpn
+
+   * agent/snmpd.c:
+
+     - fix for potential buffer overflow in logfile argument handling,
+       noted by Anonymous (bug #448243).  Also use a large enough buffer
+       to handle filenames of length PATH_MAX (if possible).
+   
+2001-07-30 10:05  jbpn
+
+   * agent/mibgroup/mibII/var_route.c , snmplib/snmp_api.c
+   , snmplib/snmp_api.h:
+
+     - move snmp_socket_length function to agent/mibgroup/mibII/var_route.c
+       from snmp_api.c -- this is the only remaining place that uses this
+       function, which certainly doesn't belong in snmp_api.c after the
+       transport abstraction malarkey.
+   
+2001-07-30 09:22  hardaker
+
+   * agent/agent_handler.c:
+
+   file agent_handler.c was initially added on branch NEW-AGENT-API.
+   
+2001-07-30 09:22  hardaker
+
+   * agent/agent_handler.h:
+
+   file agent_handler.h was initially added on branch NEW-AGENT-API.
+   
+2001-07-30 07:06  jbpn
+
+   * agent/mibgroup/mibII/var_route.c:
+
+     - try to return invalid(2) for the ipRouteType column if the route
+       is not up.  See bug #426710, reported by pjweber.
+   
+2001-07-27 07:32  jbpn
+
+   * snmplib/snmpv3.c:
+
+     - set defaultAuthType to usmHMACSHA1AuthProtocol if SHA specified
+       (was set to usmHMACMD5AuthProtocol in this case).  Spotted by
+       William Kennemer (bug #444860)
+   
+2001-07-27 06:59  jbpn
+
+   * agent/mibgroup/agentx/master_request.c:
+
+     - change to handle_agentx_response ONLY to send NEWLY delegated
+       requests after processing a successful response.  This is achieved
+       by saving the value of asp->outstanding_requests and temporarily
+       setting it to NULL.  After processing all varbinds in the
+       response, therefore, asp->outstanding_requests contains only newly
+       delegated requests, if any.  After sending these, the new requests
+       are merged with the saved queue.
+   
+       This fixes a bug that arises if you request variables from two or
+       more separate subagents simultaneously.  What used to happen is
+       that, upon receiving the first response, the master agent would
+       notice that it had an outstanding request, and retransmit it.
+       Then the second response arrives, and the master agent sends the
+       reply to the (SNMP) requester and frees the requests (including
+       callback data).  Finally, another AgentX response (to the
+       erroneously transmitted request) arrives and the callback is
+       called referencing deallocated memory, which causes a segfault.
+   
+2001-07-26 07:28  dts12
+
+   * snmplib/: snmp_api.c (NEW-LIBRARY-API.4), snmp_api.c:
+
+   Adding a 'double'-valued varbind isn't inherently an internal error!
+   
+2001-07-25 05:47  jbpn
+
+   * agent/snmpd.c:
+
+     - disable stderr logging (if requested) before calling init_mib_modules().
+       This should fix the problem noted by Nigel Metheringham in bug #418857
+       whereby the AgentX master module prints a message to stderr which causes
+       a SIGPIPE when the agent is started as a daemon.
+   
+2001-07-25 02:18  jbpn
+
+   * apps/snmptrapd_log.c:
+
+     - initialise buffers to zero in handle_wrap_fmt, to avoid garbage in
+       display of security parameters, as noted by William Frauenhofer
+       (bug #437231).
+   
+     - add closing parenthesis after (via <address> in format_plain_trap
+   
+2001-07-23 07:53  jbpn
+
+   * snmplib/tools.c:
+
+     - remove excessive debugging from snmp_(re)alloc functions
+   
+2001-07-23 04:37  jbpn
+
+   * snmplib/snmpUnixDomain.c:
+
+     - minor fix to debugging output to print losing path correctly when
+       a remote connect fails.
+   
+2001-07-17 09:56  hardaker
+
+   * CodingStyle:
+
+   update for naming conventions and for structure definitions.
+   
+2001-07-17 09:07  hardaker
+
+   * CodingStyle:
+
+   initial coding style guideline document.
+   
+2001-07-17 09:02  jbpn
+
+   * agent/mibgroup/agentx/subagent.c:
+
+     - remember to remove_trap_session(our-session-with-master-agent)
+       if the master agent session goes away, because otherwise you
+       may subsequently try to use it, which will probably dump core,
+       and is certainly an error.
+   
+     - also change when trap session is registered to being immediately
+       the session is opened so traps can be sent, e.g. from the
+       INDEX_START callback (for example linkUp traps in subagents that
+       register a row of ifTable).
+   
+2001-07-17 08:48  jbpn
+
+   * agent/agent_trap.c:
+
+     - change to remove_trap_session(), so as not to close an SNMP
+       session simply because we are removing it from the trap_sink
+       list.  The rationale is that the session may still be in use for
+       other purposes, or (more to the point) you may be calling this
+       function from the session's callback (from where closing the
+       session isn't a good idea).
+   
+2001-07-13 06:02  dts12
+
+   * snmplib/netsnmp.h:
+
+   file netsnmp.h was initially added on branch NEW-LIBRARY-API.
+   
+2001-07-12 12:09  hardaker
+
+   * agent/helpers/table_iterator.c:
+
+   file table_iterator.c was initially added on branch NEW-AGENT-API.
+   
+2001-07-12 12:09  hardaker
+
+   * agent/helpers/table_iterator.h:
+
+   file table_iterator.h was initially added on branch NEW-AGENT-API.
+   
+2001-07-12 02:21  jbpn
+
+   * agent/: snmp_agent.c , mibgroup/agentx/client.c ,
+   mibgroup/agentx/master_request.c , mibgroup/agentx/protocol.c
+   , mibgroup/agentx/subagent.c:
+
+     - fix for bug #439094, reported by Evert-Jan van Tuijl, whereby
+       the AgentX master agent expects a response to an agentx-CleanupSet-PDU
+       message (incorrectly).  This only shows up when testing against other
+       subagents (e.g. jax) because the net-snmp subagent sends a response
+       to the agentx-CleanupSet-PDU (incorrectly).
+   
+2001-07-10 16:10  hardaker
+
+   * agent/mibgroup/mibII/vacm_context.c:
+
+   file vacm_context.c was initially added on branch NEW-AGENT-API.
+   
+2001-07-10 16:10  hardaker
+
+   * agent/mibgroup/mibII/vacm_context.h:
+
+   file vacm_context.h was initially added on branch NEW-AGENT-API.
+   
+2001-07-10 16:06  hardaker
+
+   * agent/mibgroup/target/target_counters.c:
+
+   file target_counters.c was initially added on branch NEW-AGENT-API.
+   
+2001-07-10 16:06  hardaker
+
+   * agent/mibgroup/target/target_counters.h:
+
+   file target_counters.h was initially added on branch NEW-AGENT-API.
+   
+2001-07-05 06:11  jbpn
+
+   * agent/mibgroup/mibII/: interfaces.c , interfaces.h:
+
+     - make Interface_Scan_Get_Count non-static as it's very useful
+   
+2001-07-05 03:40  jbpn
+
+   * snmplib/snmpusm.c:
+
+     - free the cached security parameters when we have a parse error
+       on input, otherwise we leak memory (triggered by SC 3.0.13.{2,3}).
+   
+2001-07-04 09:51  uid44810
+
+   * snmplib/snmp_api.c:
+
+     - catch some malformed SNMPv3 packets
+   
+2001-07-04 07:42  uid44810
+
+   * snmplib/snmp_api.c:
+
+     - fix bad mistake in snmpv3_scopedPDU_header_realloc_rbuild which
+       was encoding the wrong length into the ScopedPDU SEQUENCE header
+       (wasn't including length of actual data, i.e. PDU!).  Totally my
+       fault -- introduced when changing over to reallocating buffer
+       type functions.  Amazing this hasn't caused all sorts of trouble
+       for people!
+   
+2001-07-02 18:04  rstory
+
+   * snmplib/snmp-tc.c:
+
+   file snmp-tc.c was initially added on branch NEW-AGENT-API.
+   
+2001-07-02 09:33  jbpn
+
+   * agent/snmp_agent.c:
+
+     - slight change to generation of error-index:
+   
+       - explicitly test for error-status == noError, and set error-index
+         to zero in this case;
+   
+       - otherwise use the cached value;
+   
+       - don't zero the cached value in handle_var_list if handle_one_var
+         returns noError
+   
+     - this copes properly with SET requests, where a failing SET will have
+       a FREE phase which will typically return noError.  Previously this
+       would erroneously cause the error-index to be set to zero.
+   
+2001-07-02 08:14  jbpn
+
+   * agent/mibgroup/util_funcs.c:
+
+     - fix bad behaviour in header_simple_table when the index is
+       equal to ULONG_MAX
+   
+2001-06-28 10:01  jbpn
+
+   * agent/mibgroup/snmpv3/usmUser.c:
+
+     - change sense of snmp_oid_compare() result check in var_usmUser
+       to do lexi-ordering correctly
+   
+2001-06-28 07:20  jbpn
+
+   * snmplib/snmp_api.c:
+
+     - count more v1/v2c parse errors (SC 1.1.12.10)
+   
+2001-06-28 05:56  jbpn
+
+   * snmplib/snmp_api.c:
+
+     - check that version field of PDU is of integer type rather than just
+       assuming it is (SC 1.1.12.2.1)
+   
+2001-06-28 04:40  jbpn
+
+   * agent/mibgroup/mibII/vacm_vars.c:
+
+     - increment snmpInBadCommunityNames when we see unknown community
+       names, per RFC1907
+   
+2001-06-27 08:09  jbpn
+
+   * agent/mibgroup/agentx/subagent.c:
+
+     - make use of new function register_mib_detach() to mark all our
+       nodes as detached when we get a transport disconnect indication.
+   
+2001-06-27 08:07  jbpn
+
+   * agent/: agent_registry.c , agent_registry.h ,
+   var_struct.h:
+
+     - add additional flag to subtree structure that subagents can use
+       to determine whether an attempt has been made to register and OID
+       with a master agent during a session's lifetime.  This allows
+       manual re-registration and automatic re-registration to be mixed
+       within a subagent (perhaps because you are doing index stuff).
+   
+     - add function register_mib_detach() which unsets this flag for
+       all known nodes (subagent would typically call this on disconnect
+       indication).
+   
+     - add function unregister_mib_table_row()
+   
+     - correct bad recursive behaviour in register_mib_reattach() which
+       used to try to re-register N nodes N! times.  Once will normally
+       be enough.
+   
+     - change to dump_registry() format to include hex display of
+       flags field.
+   
+2001-06-26 09:26  dts12
+
+   * FAQ:
+
+   Fix error in SNMPv2 trap examples  (Identified by Diwakar Shetty).
+   
+2001-06-26 02:35  jbpn
+
+   * snmplib/mib.c:
+
+     - corrected sense of dump_realloc_oid_to_string() return value
+       checks, as spotted by Robert Story.
+   
+2001-06-25 06:30  jbpn
+
+   * agent/mibgroup/agentx/master_request.c:
+
+     - small tweak in handle_agentx_response() when retrying unfulfilled
+       requests: continue from the "start" OID of the next node of the
+       tree, not from the "name" OID, which causes looping.
+   
+2001-06-21 09:51  jbpn
+
+   * agent/mibgroup/agentx/master_request.c:
+
+     - handle "holes" in rows of tables that are handled by subagents
+   
+       Since the fully-qualified instance is registered, we interpret
+       a return of noSuchInstance when doing an inexact query as meaning
+       we should retry the query.
+   
+2001-06-21 02:50  jbpn
+
+   * snmplib/mib.h:
+
+     - forgot to commit at the same time as last mib.c commit; updated
+       prototype for sprint_realloc_hinted_integer
+   
+2001-06-20 06:44  jbpn
+
+   * agent/: agent_index.c , agent_index.h:
+
+     - add function count_indexes which returns the number of indexes
+       allocated for a given OID.  This can be useful for implementing
+       "row count" objects, e.g. ifNumber.
+   
+2001-06-20 05:37  jbpn
+
+   * agent/: agent_callbacks.h , mibgroup/agentx/subagent.c:
+
+     - add SNMPD_CALLBACK_INDEX_START and SNMPD_CALLBACK_INDEX_STOP
+       callbacks which may be used to manage index allocations.
+   
+       Master agent should probably call these callbacks too, although
+       it's a bit of a degenerate case.
+   
+2001-06-19 09:44  jbpn
+
+   * agent/agent_index.c:
+
+     - use an explicit fieled "allocated" in snmp_index structure to
+       indicate whether or not a value is currently allocated, rather
+       than overloading a NULL session to mean that it is not.
+   
+       This allows startup code in a master agent to pre-register indices
+       when there are no sessions open.
+   
+2001-06-19 08:34  jbpn
+
+   * agent/mibgroup/agentx/: master_admin.c , master_request.c:
+
+     -  keep the value of NETWORK_BYTE_ORDER from h.flags in the
+        agentx-Open-PDU and use it for subsequent master-initiated
+        AgentX protocol operations, per RFC 2741 (section 7.1.1,
+        paragraph 4).
+   
+        For now, we are storing this in the flags field of a
+        subsession.  This is likely to stop working if the flags
+        definitions change (i.e. it's not a great solution)
+   
+     -  Thanks to Peter Korsten (severityone at users.sourceforge.net)
+        for identifying this bug, and for help debugging this fix.
+   
+2001-06-19 02:35  jbpn
+
+   * snmplib/mib.c:
+
+     - reinstate space between numbers and units.
+   
+     - respect DISPLAY-HINTs for Unsigned32, Gauge, Gauge32 types.
+   
+2001-06-13 03:29  jbpn
+
+   * agent/snmp_vars.c:
+
+     - minor change to debugging to reduce "noise level" from Purify
+   
+2001-06-12 10:35  jbpn
+
+   * agent/snmp_agent.c:
+
+     - handle non-repeaters and max-repetitions field values of < 0 (by
+       setting them to 0, per RFC 1905)
+   
+2001-06-12 10:05  jbpn
+
+   * agent/snmp_agent.c:
+
+     - fix bug that caused a null pointer to be followed when processing a
+       GETBULK request with non-repeaters > 0, max-repetitions == 0 and no
+       varbinds in the request.
+   
+2001-06-12 07:24  dts12
+
+   * snmplib/: read_config.c (V4-2-patches.1), read_config.c:
+
+   Fix 'unregister_config_handler' to handle tags other
+   than the first in the list.  (Thanks to Paul Serice).
+   
+2001-06-06 07:39  jbpn
+
+   * agent/mibgroup/agentx/master_admin.c:
+
+     - free() return value from register_index() calls
+   
+2001-06-06 07:37  jbpn
+
+   * agent/agent_index.c:
+
+     - more uniform return value from register_index(): make it always a
+       varbind which the caller is responsible for free()ing, or else NULL.
+   
+2001-06-05 03:10  jbpn
+
+   * agent/agent_index.c:
+
+     - fix for index allocation, such that requests for specific indices which
+       have previously been allocated, but are not currently in use, succeed.
+   
+     - more debugging output.
+   
+2001-06-01 08:37  hardaker
+
+   * agent/mibgroup/testdelayed.h:
+
+   file testdelayed.h was initially added on branch NEW-AGENT-API.
+   
+2001-06-01 08:37  hardaker
+
+   * agent/mibgroup/testhandler.h:
+
+   file testhandler.h was initially added on branch NEW-AGENT-API.
+   
+2001-06-01 08:37  hardaker
+
+   * agent/mibgroup/testdelayed.c:
+
+   file testdelayed.c was initially added on branch NEW-AGENT-API.
+   
+2001-06-01 08:37  hardaker
+
+   * agent/mibgroup/testhandler.c:
+
+   file testhandler.c was initially added on branch NEW-AGENT-API.
+   
+2001-06-01 08:36  hardaker
+
+   * agent/helpers/table.c:
+
+   file table.c was initially added on branch NEW-AGENT-API.
+   
+2001-06-01 08:36  hardaker
+
+   * agent/helpers/multiplexer.h:
+
+   file multiplexer.h was initially added on branch NEW-AGENT-API.
+   
+2001-06-01 08:36  hardaker
+
+   * agent/helpers/old_api.c:
+
+   file old_api.c was initially added on branch NEW-AGENT-API.
+   
+2001-06-01 08:36  hardaker
+
+   * agent/helpers/null.h:
+
+   file null.h was initially added on branch NEW-AGENT-API.
+   
+2001-06-01 08:36  hardaker
+
+   * agent/helpers/instance.c:
+
+   file instance.c was initially added on branch NEW-AGENT-API.
+   
+2001-06-01 08:36  hardaker
+
+   * agent/helpers/set_helper.h:
+
+   file set_helper.h was initially added on branch NEW-AGENT-API.
+   
+2001-06-01 08:36  hardaker
+
+   * agent/helpers/table.h:
+
+   file table.h was initially added on branch NEW-AGENT-API.
+   
+2001-06-01 08:36  hardaker
+
+   * agent/helpers/read_only.c:
+
+   file read_only.c was initially added on branch NEW-AGENT-API.
+   
+2001-06-01 08:36  hardaker
+
+   * agent/helpers/serialize.c:
+
+   file serialize.c was initially added on branch NEW-AGENT-API.
+   
+2001-06-01 08:36  hardaker
+
+   * agent/helpers/old_api.h:
+
+   file old_api.h was initially added on branch NEW-AGENT-API.
+   
+2001-06-01 08:36  hardaker
+
+   * agent/helpers/instance.h:
+
+   file instance.h was initially added on branch NEW-AGENT-API.
+   
+2001-06-01 08:36  hardaker
+
+   * agent/helpers/read_only.h:
+
+   file read_only.h was initially added on branch NEW-AGENT-API.
+   
+2001-06-01 08:36  hardaker
+
+   * agent/helpers/.cvsignore:
+
+   file .cvsignore was initially added on branch NEW-AGENT-API.
+   
+2001-06-01 08:36  hardaker
+
+   * agent/helpers/multiplexer.c:
+
+   file multiplexer.c was initially added on branch NEW-AGENT-API.
+   
+2001-06-01 08:36  hardaker
+
+   * agent/helpers/Makefile.in:
+
+   file Makefile.in was initially added on branch NEW-AGENT-API.
+   
+2001-06-01 08:36  hardaker
+
+   * agent/helpers/serialize.h:
+
+   file serialize.h was initially added on branch NEW-AGENT-API.
+   
+2001-06-01 08:36  hardaker
+
+   * agent/helpers/null.c:
+
+   file null.c was initially added on branch NEW-AGENT-API.
+   
+2001-06-01 07:39  hardaker
+
+   * local/tkmib:
+
+   misc fixes for oid formatting problems.
+   
+2001-06-01 07:37  hardaker
+
+   * README:
+
+   add Martin Oldfield.
+   
+2001-06-01 02:50  jbpn
+
+   * agent/: snmp_agent.c , snmp_agent.h ,
+   mibgroup/agentx/master_request.c:
+
+     - fix for absolutely mind-bending memory leak when AgentX sessions
+       timeout.  agent_session_list holds a queue of sessions with outstanding
+       requests.  When a session times out, this must be scavenged to make
+       sure the sessions that have timed out, and their associated requests
+       are free()d.
+   
+2001-05-30 03:28  jbpn
+
+   * agent/mibgroup/agentx/subagent.c:
+
+     - retry initial open of AgentX master socket if AgentX pings are
+       enabled (should really be a separate default_store option but
+       never mind)
+   
+2001-05-30 03:27  jbpn
+
+   * agent/mibgroup/agentx/master_request.c:
+
+     - more aggressive handling of timeout conditions (also fix memory
+       leak)
+   
+2001-05-30 03:19  jbpn
+
+   * agent/mibgroup/agentx/master_admin.c:
+
+     - more informative debugging
+   
+2001-05-30 02:37  jbpn
+
+   * snmplib/snmp_alarm.c:
+
+     - remove noisy debugging
+   
+2001-05-30 02:37  jbpn
+
+   * snmplib/snmp_api.c:
+
+     - more compact debugging in _sess_select_info
+   
+2001-05-30 02:34  jbpn
+
+   * agent/agent_registry.c:
+
+     - copy flags in reattach_subtree (needed for AgentX row registration)
+   
+2001-05-28 08:54  jbpn
+
+   * agent/mibgroup/agentx/: client.c , client.h ,
+   master_admin.c , master_request.c , subagent.c:
+
+     - stuff from patch #416026 (submitted by anonymous) for AgentX row
+       registration
+   
+2001-05-28 08:49  jbpn
+
+   * agent/snmp_vars.c:
+
+     - tweak to getStatPtr to handle getNext operations in combination with
+       FULLY_QUALIFIED_INSTANCE nodes (which arise in AgentX row registration).
+   
+2001-05-28 08:46  jbpn
+
+   * agent/: agent_registry.c , agent_registry.h ,
+   var_struct.h:
+
+     - stuff from patch #416026 (submitted by anonymous) for AgentX row
+       registration
+   
+2001-05-28 08:42  jbpn
+
+   * agent/mibgroup/agentx/master.c:
+
+     - small tweak to debugging output
+   
+2001-05-28 08:39  jbpn
+
+   * agent/mibgroup/agentx/protocol.c:
+
+     - do parsing/building of ASN_PRIV_EXCL_RANGE and
+       ASN_PRIV_INCL_RANGE types *properly*.
+   
+2001-05-28 04:40  jbpn
+
+   * snmplib/snmp_api.c:
+
+     - fix possible memory leak in _sess_async_send error cases
+   
+2001-05-28 04:27  jbpn
+
+   * agent/mibgroup/agentx/protocol.c:
+
+     - add parsing/building of ASN_PRIV_EXCL_RANGE and
+       ASN_PRIV_INCL_RANGE types.
+   
+2001-05-23 09:20  jbpn
+
+   * snmplib/snmp_api.c:
+
+     - respect msgMaxSize in received v3 PDUs (in the weak sense that if
+       the serialized response PDU is more than it, we don't send it)
+   
+     - removed functions ascii_to_binary, hex_to_binary.  Using these
+       functions is really bad, since they will happily overflow buffers.
+       The superior alternatives, defined in tools.h, are
+       snmp_{decimal, hex}_to_binary.
+   
+2001-05-23 09:00  jbpn
+
+   * apps/snmpstatus.c:
+
+     - remove unused variable struct sockaddr_in respIp
+   
+2001-05-23 08:58  jbpn
+
+   * agent/snmp_agent.c:
+
+     - early bail out of handle_snmp_packet() if the callback operation
+       type is not SNMP_CALLBACK_OP_RECEIVED_MESSAGE.  In practice, the
+       only way this arises currently is when a stream transport based
+       connection goes away and a SNMP_CALLBACK_OP_DISCONNECT occurs.
+   
+2001-05-23 08:44  jbpn
+
+   * snmplib/snmp_api.h:
+
+     - new fields rcvMsgMaxSize and sndMsgMaxSize in snmp_session
+       structure to support v3 msgMaxSize
+   
+     - removed functions ascii_to_binary, hex_to_binary from public
+       interface.  Using these functions is really bad, since they
+       will happily overflow buffers.  The superior alternatives,
+       defined in tools.h, are snmp_{decimal, hex}_to_binary.
+   
+2001-05-23 08:37  jbpn
+
+   * snmplib/: snmpAAL5PVCDomain.c , snmpIPXDomain.c ,
+   snmpTCPDomain.c , snmpUDPDomain.c , snmpUnixDomain.c
+   , snmp_transport.c , snmp_transport.h:
+
+     - add msgMaxSize field to snmp_transport structure to support
+       msgMaxSize negotiation for v3
+   
+2001-05-23 07:14  jbpn
+
+   * snmplib/scapi.c:
+
+     - use sprint_realloc_hexstring instead of sprint_hexstring for
+       SNMP_TESTING_CODE debugging output of IV, key and plaintext
+   
+2001-05-23 05:25  jbpn
+
+   * apps/snmptest.c:
+
+     - free() buffers in a couple of error cases; no big deal
+   
+2001-05-23 04:39  jbpn
+
+   * snmplib/snmpv3.c:
+
+     - use new snmp_hex_to_binary function for engine ID parsing in -e
+       option, rather than archaic hex_to_binary
+   
+2001-05-23 04:22  jbpn
+
+   * snmplib/snmp_parse_args.c:
+
+     - free() buffers in a couple of error cases; no big deal
+   
+2001-05-23 04:14  jbpn
+
+   * snmplib/snmp_parse_args.c:
+
+     - use new snmp_hex_to_binary function for engine ID parsing in -e
+       and -E options, rather than archaic hex_to_binary
+   
+2001-05-23 03:56  jbpn
+
+   * apps/snmptest.c:
+
+     - use new snmp_{decimal, hex}_to_binary functions for input string
+       to OCTET STRING conversion, rather than archaic ascii_to_binary
+       and hex_to_binary
+   
+     - omit trailing newline from string (helpful for objects that don't
+       allow non-printing characters, e.g. sysLocation.0)
+   
+2001-05-20 08:12  jbpn
+
+   * snmplib/snmp_api.c:
+
+     - rewritten _sess_read() function:
+   
+       - better handling of long packets
+       - zero-copy reception of packets on stream transports
+       - lower memory overheads for packet fragment handling for stream
+         transports
+   
+     - allow parsing of large objects (>8192 octets)
+   
+2001-05-20 05:48  jbpn
+
+   * snmplib/snmp_parse_args.c:
+
+     - don't strdup() contextName, securityName -- causes minor memory
+       leak.
+   
+2001-05-20 05:04  jbpn
+
+   * snmplib/snmpTCPDomain.c:
+
+     - test return of fcntl(F_GETFL), so as not to set flags to garbage
+   
+     - correction to comment -- set socket to *blocking*!
+   
+     - check opaque before writing to it in recv
+   
+2001-05-20 05:02  jbpn
+
+   * snmplib/snmp_client.c:
+
+     - proper handling of SNMP_CALLBACK_OP_DISCONNECT in snmp_synch_input:
+       set an error condition, with errno SNMPERR_ABORT ("Session abort
+       failure"), which seems like a good enough match.
+   
+2001-05-18 09:54  jbpn
+
+   * snmplib/snmpTCPDomain.c:
+
+     - make newly-accept()ed sockets blocking; otherwise problems arise
+       later when send()ing large PDUs (since only a single socket buffer's
+       worth of data at most can be sent without blocking).
+   
+2001-05-18 07:17  jbpn
+
+   * agent/snmp_agent.c:
+
+     - use sprint_realloc_objid and sprint_realloc_variable instead of
+       sprint_objid and sprint_variable respectively, to allow large PDUs
+       to be printed when debugging
+   
+2001-05-18 07:16  jbpn
+
+   * snmplib/tools.c:
+
+     - improved debugging output from snmp_realloc()
+   
+2001-05-18 07:15  jbpn
+
+   * snmplib/: mib.c , mib.h:
+
+     - remove debugging from output routines
+   
+     - new function sprint_realloc_objid
+   
+     - make sprint_realloc_objid and sprint_realloc_variable externally
+       visible
+   
+2001-05-18 06:28  jbpn
+
+   * snmplib/asn1.c:
+
+     - improved debugging output from asn_realloc()
+   
+2001-05-15 04:10  jbpn
+
+   * mibs/UCD-SNMP-MIB.txt:
+
+     - add OIDs for UDP/IPv6 and TCP/IPv6
+   
+2001-05-14 02:20  jbpn
+
+   * agent/mibgroup/ucd-snmp/vmstat_solaris2.c:
+
+     - added \n to text of snmp_log() messages (bug #422978)
+   
+2001-05-11 07:30  jbpn
+
+   * snmplib/: mib.c , mib.h:
+
+     - added sprint_realloc_<type> family of functions which take extra
+       parameters and use relocating buffers to remove limitations due to
+       fixed-size buffers (e.g. see bug #409181).
+   
+     - also fixes potential problem noted as bug #414803
+   
+     - fprint_variable, fprint_objid and fprint_value use new functions
+       such that snmpget etc. are improved immediately
+   
+     - old functions remain *FOR NOW* -- but really they should be
+       considered to be deprecated (new functions provide a superset of
+       their functionality).
+   
+2001-05-11 07:14  jbpn
+
+   * snmplib/parse.h:
+
+     - added additional function pointer to struct tree to point at
+       relocating buffer compatible output function
+   
+2001-05-11 06:57  jbpn
+
+   * snmplib/: tools.c , tools.h:
+
+     - added utility function snmp_strcat, which appends a string to a
+       relocatable buffer
+   
+2001-05-10 11:20  rstory
+
+   * snmplib/mib.c:
+
+   fix bug #423109 incorrect index parsing
+   
+2001-05-09 16:43  rstory
+
+   * snmplib/snmp_client.c:
+
+   fix snmp_client.c:569: warning: control reaches end of non-void function
+   
+2001-05-09 12:36  slif
+
+   * agent/mibgroup/: Rmon.h , Rmon/README , Rmon/agutil.c
+   , Rmon/agutil.h , Rmon/agutil_api.h , Rmon/alarm.c
+   , Rmon/alarm.h , Rmon/event.c , Rmon/event.h ,
+   Rmon/history.c , Rmon/history.h , Rmon/row_api.h ,
+   Rmon/rows.c , Rmon/rows.h , Rmon/statistics.c ,
+   Rmon/statistics.h , Rmon/test_alarm.sh ,
+   Rmon/test_hist.sh:
+
+   Include Alex Rozin's Rmon.
+   
+2001-05-07 10:41  hardaker
+
+   * snmplib/: snmp_client.c , snmp_client.h:
+
+   Added a couple of convenience functions for manipulating varbindlists:
+     int snmp_set_var_typed_value(struct variable_list *newvar, u_char type,
+                                  u_char *val_str, size_t val_len);
+     void snmp_replace_var_types(struct variable_list *vbl, int old_type,
+                                 int new_type);
+     void snmp_reset_var_types(struct variable_list *vbl, int new_type);
+   
+2001-05-07 10:36  hardaker
+
+   * snmplib/tools.h:
+
+   define SNMP_MALLOC_TYPEDEF()
+   
+2001-05-05 07:28  rstory
+
+   * local/mib2c.storage.conf:
+
+   fix store_ name; don't cast to asny type if parm expecting u_char*; fix _variable_oid
+   naming; cast parm 2 of memdup to u_char*
+   
+2001-05-03 14:16  hardaker
+
+   * snmplib/asn1.c:
+
+   fixed rauth offset incrementing: was incrementing the pointer, not the value.
+     -- more instances of the same problem found.
+   
+2001-05-03 14:15  hardaker
+
+   * snmplib/asn1.c:
+
+   fixed rauth offset incrementing: was incrementing the pointer, not the value.
+   
+2001-05-03 10:08  hardaker
+
+   * aclocal.m4 , config.guess , config.sub ,
+   configure , ltmain.sh:
+
+   updated to libtool 1.4
+   
+2001-05-01 13:31  hardaker
+
+   * snmplib/snmpksm.c:
+
+   use realloc routines.
+   
+2001-05-01 13:31  hardaker
+
+   * snmplib/read_config.c:
+
+   fix variable declaration.
+   
+2001-05-01 13:30  hardaker
+
+   * snmplib/mib.c:
+
+   Don't print hex for string lengths less than 4.  Should have died ages ago.
+   
+2001-05-01 13:29  hardaker
+
+   * agent/mibgroup/ucd-snmp/vmstat.h:
+
+   Fix prototype so its not static (it shouldn't be).
+   
+2001-05-01 13:29  hardaker
+
+   * agent/mibgroup/mibII/ip.c:
+
+   make RONLY variables writable (which may or may not work.  I'm betting not.)
+   
+2001-05-01 13:28  hardaker
+
+   * agent/snmp_agent.c:
+
+   remove unused variables.
+   
+2001-05-01 13:28  hardaker
+
+   * config.h.in , configure , configure.in:
+
+   check for an rpm subdirectory.
+   
+2001-04-23 20:41  hardaker
+
+   * local/tkmib:
+
+   big cleanup and other fixes I've already forgotten in the last few minutes.
+   
+2001-04-23 20:34  hardaker
+
+   * local/tkmib:
+
+   Don't walk off end of mib tree (sigh).
+   
+2001-04-23 20:19  hardaker
+
+   * local/tkmib:
+
+   fix the mib info display options.
+   save them appropriately.
+   
+2001-04-23 18:23  hardaker
+
+   * local/tkmib:
+
+   more savable option items.
+   use Data::Dumper to save most stuff.
+   
+2001-04-23 17:26  hardaker
+
+   * local/tkmib:
+
+   Don't save session options twice.
+   Make color of writable objects a variable.
+   
+2001-04-23 17:08  hardaker
+
+   * local/: tkmib (V4-2-patches.2), tkmib:
+
+   fix walk problem once and for all.
+   
+2001-04-23 16:36  hardaker
+
+   * local/tkmib:
+
+   reduce screen realestate all over the place
+   
+2001-04-23 16:35  hardaker
+
+   * local/tkmib:
+
+   test against version 5
+   
+2001-04-18 08:46  hardaker
+
+   * agent/mibgroup/ucd-snmp/lmSensors.c ,
+   agent/mibgroup/ucd-snmp/lmSensors.h , mibs/LM-SENSORS-MIB.txt
+   , mibs/UCD-SNMP-MIB.txt:
+
+   Added LM-SENSORS-MIB support (diskio extension) from Martin Oldfield
+   
+2001-04-18 05:40  jbpn
+
+   * snmplib/snmp_api.c:
+
+     - hacking on snmp_add_var to handle long values
+   
+       - use snmp_{hex,decimal}_to_binary instead of hex_to_binary
+         and ascii_to_binary; these should be removed
+   
+       - don't use strtok in processing bitstrings
+   
+2001-04-18 04:58  jbpn
+
+   * snmplib/asn1.c:
+
+     - use the generic snmp_realloc function in asn_realloc
+   
+2001-04-18 02:40  jbpn
+
+   * snmplib/: tools.c , tools.h:
+
+     - new, reallocating utility functions snmp_hex_to_binary and
+       snmp_decimal_to_binary to convert hex and decimal strings to octet
+       strings respectively.
+   
+     - new utility function snmp_realloc to perform buffer (re-)allocation
+   
+2001-04-12 05:12  dts12
+
+   * agent/: snmp_agent.c (V4-2-patches.6), snmp_agent.c:
+
+   Better fix for bug #414855 from arajesh
+   Handles non-repeaters=0 as well, and avoids memory leaks.
+   
+2001-04-11 10:06  jbpn
+
+   * snmplib/asn1.h:
+
+     - second incarnation of asn_realloc_rbuild_<type> functions, which
+       now take an additional argument that may be used to indicate that
+       reallocation should not be done.
+   
+     - old _rbuild API is gone.
+   
+     - extended (and corrected!) commentary on correct usage of new API.
+   
+2001-04-11 10:05  jbpn
+
+   * snmplib/: snmp.c , snmp.h:
+
+     - use second incarnation of _realloc_rbuild functions.
+   
+     - old _rbuild_var_op API is gone.
+   
+2001-04-11 10:04  jbpn
+
+   * snmplib/snmpusm.c:
+
+     - use second incarnation of asn_realloc_rbuild_<type> functions.
+   
+2001-04-11 10:03  jbpn
+
+   * snmplib/snmp_api.c:
+
+     - use second incarnation of _realloc_rbuild functions.
+   
+     - old _rbuild API is gone.
+   
+2001-04-11 10:02  jbpn
+
+   * snmplib/asn1.c:
+
+     - second incarnation of asn_realloc_rbuild_<type> functions, which
+       now take an additional argument that may be used to indicate that
+       reallocation should not be done.
+   
+     - old _rbuild API is gone.
+   
+     - asn_realloc() function checks whether it has been passed a NULL
+       pointer and uses malloc() in that case (thanks to Michael Slifcak
+       for pointing out the danger here).
+   
+2001-04-11 06:13  dts12
+
+   * agent/snmp_agent.c:
+
+   Handle GetBulk requests with max-repetitions=0 properly (bug #414855)
+   
+2001-04-10 04:47  jbpn
+
+   * snmplib/snmpUDPDomain.c:
+
+     - set SO_SNDBUF and SO_RCVBUF to 128Kb for newly-opened UDP sockets,
+       to enable large PDUs to be sent and received.  Some
+       implementations default very low (Solaris 2.7 8Kb, Linux 2.4
+       64Kb).
+   
+2001-04-09 10:05  jbpn
+
+   * snmplib/snmpusm.c:
+
+     - modified usm_rgenerate_out_msg() to make use of reallocating
+       reverse encode functions.
+   
+2001-04-09 10:03  jbpn
+
+   * snmplib/snmpusm.h:
+
+     - additional parameter to usm_rgenerate_out_msg() to enable use of
+       reallocating reverse encode functions.
+   
+2001-04-09 09:57  jbpn
+
+   * snmplib/snmp_secmod.h:
+
+     - allow additional parameter for outgoing params to enable use of
+       reallocating reverse encode functions.
+   
+2001-04-09 09:55  jbpn
+
+   * snmplib/snmp_api.h:
+
+     - prototypes for reallocating reverse encode functions
+   
+2001-04-09 09:54  jbpn
+
+   * snmplib/snmp_api.c:
+
+     - modified to use reallocating reverse ASN.1 encoder functions if
+       using reverse encoding at all.
+   
+2001-04-09 09:49  jbpn
+
+   * snmplib/snmp.c:
+
+     - add new function snmp_realloc_rbuild_var_op() which uses
+       reallocating reverse ASN.1 encoder functions to encode varbinds.
+   
+2001-04-09 09:47  jbpn
+
+   * snmplib/asn1.h:
+
+     - prototype for new suite of functions asn_realloc_rebuild_<type>,
+       which perform reverse encoding into a buffer and grow it if there
+       is not enough space for the encoding.
+   
+     - commentary on correct usage of above.
+   
+2001-04-09 09:43  jbpn
+
+   * snmplib/asn1.c:
+
+     - new suite of functions asn_realloc_rebuild_<type>, which perform
+       reverse encoding into a buffer and grow it if there is not enough
+       space for the encoding.
+   
+2001-04-06 12:12  hardaker
+
+   * AGENT.txt , COPYING , ChangeLog ,
+   EXAMPLE.conf.def , FAQ , NEWS , PORTING ,
+   README , README.agentx , README.snmpv3 , configure
+   , configure.in , sedscript.in , version.h
+   , agent/agent_trap.c , agent/ds_agent.h ,
+   agent/snmp_agent.c , agent/snmpd.c ,
+   agent/mibgroup/ucd_snmp.h , agent/mibgroup/util_funcs.c
+   , agent/mibgroup/agentx/README.agentx ,
+   agent/mibgroup/agentx/master.c ,
+   agent/mibgroup/agentx/master.h ,
+   agent/mibgroup/examples/example.c ,
+   agent/mibgroup/host/hr_filesys.c ,
+   agent/mibgroup/host/hr_storage.c ,
+   agent/mibgroup/host/hr_swrun.c ,
+   agent/mibgroup/host/hr_utils.c , agent/mibgroup/mibII/at.c
+   , agent/mibgroup/mibII/at.h ,
+   agent/mibgroup/mibII/interfaces.c , agent/mibgroup/mibII/ip.c
+   , agent/mibgroup/mibII/udp.c ,
+   agent/mibgroup/mibII/var_route.c ,
+   agent/mibgroup/notification/snmpNotifyFilterProfileTable.c ,
+   agent/mibgroup/notification/snmpNotifyFilterTable.c ,
+   agent/mibgroup/notification/snmpNotifyTable.c ,
+   agent/mibgroup/target/target.c ,
+   agent/mibgroup/ucd-snmp/disk.c ,
+   agent/mibgroup/ucd-snmp/file.c ,
+   agent/mibgroup/ucd-snmp/loadave.c ,
+   agent/mibgroup/ucd-snmp/pass.c ,
+   agent/mibgroup/ucd-snmp/proxy.c ,
+   agent/mibgroup/ucd-snmp/registry.c ,
+   agent/mibgroup/ucd-snmp/versioninfo.c ,
+   agent/mibgroup/ucd-snmp/vmstat_solaris2.c , apps/snmpdelta.c
+   , apps/snmptest.c , apps/snmptrapd.c ,
+   local/Makefile.in , local/mib2c , local/snmpconf
+   , local/tkmib , local/wesrestart , man/snmpcmd.1
+   , man/snmpd.conf.5.def , man/snmpdelta.1 ,
+   mibs/rfclist , mibs/rfcmibs.diff , snmplib/mib.c ,
+   snmplib/parse.c , snmplib/snmp_api.c ,
+   snmplib/snmp_debug.c , snmplib/snmpusm.c ,
+   testing/eval_tools.sh , testing/tests/T120proxyget:
+
+   merge3 -> merge4.  I don't *think* I broke anything.
+     - The main line should now contain all the 4.2.1 patches.
+     - I may double check this at a later date.
+   
+2001-04-05 06:37  dts12
+
+   * snmplib/parse.c:
+
+   Change 'Line' variable name, to assist with Mac port.
+   
+2001-04-05 06:14  dts12
+
+   * agent/mibgroup/ucd-snmp/: pass.c , pass_persist.c:
+
+   Handle setting null string values via the 'pass' mechanism. (Support#406728)
+   Also handle embedded whitespace in such values.
+   Also applied to 'pass_persist'.
+   
+2001-04-05 06:07  dts12
+
+   * agent/: agent_registry.c , agent_trap.c , kernel.c
+   , mib_modules.c , snmp_agent.c , snmp_agent.h
+   , snmp_vars.c , mibgroup/util_funcs.c ,
+   mibgroup/agentx/master_admin.c , mibgroup/agentx/protocol.c
+   , mibgroup/host/hr_disk.c , mibgroup/host/hr_network.c
+   , mibgroup/host/hr_print.c , mibgroup/host/hr_proc.c
+   , mibgroup/host/hr_system.c , mibgroup/host/hr_utils.c
+   , mibgroup/mibII/vacm_vars.c ,
+   mibgroup/mibII/var_route.c ,
+   mibgroup/notification/snmpNotifyFilterProfileTable.c ,
+   mibgroup/notification/snmpNotifyFilterTable.c ,
+   mibgroup/notification/snmpNotifyTable.c ,
+   mibgroup/target/snmpTargetAddrEntry.c ,
+   mibgroup/target/target.c , mibgroup/ucd-snmp/file.c ,
+   mibgroup/ucd-snmp/hpux.c , mibgroup/ucd-snmp/proxy.c ,
+   mibgroup/ucd-snmp/registry.c ,
+   mibgroup/ucd-snmp/versioninfo.c:
+
+   Keep one of the pickier compilers (HP's aCC) happy.
+   
+2001-04-05 06:06  dts12
+
+   * agent/mibgroup/ucd-snmp/disk.c:
+
+   Ensure that checking for 'statvfs' is done consistently
+   
+2001-04-05 06:05  dts12
+
+   * agent/mibgroup/mibII/system_mib.c:
+
+   ensure that 'exec_command' is used consistently with the availability of execv
+   (A cleaner approach than the previous patch)
+   
+2001-04-05 06:01  dts12
+
+   * agent/: auto_nlist.c , auto_nlist.h:
+
+   fix for auto_nlist bogus definitions for machines without nlist.
+   
+2001-04-05 04:51  jbpn
+
+   * snmplib/snmp_api.c:
+
+    - save a strcpy() and allow long octet string values without crashing
+      (though there are still problems due to the liberal use of fixed
+      size buffers with no bounds checking all over the place.  Sigh).
+   
+2001-04-04 06:46  jbpn
+
+   * agent/snmpd.c:
+
+    - call external signal handlers before calling snmp_select_info(),
+      rather than after calling snmp_select_info() but before select().
+      This fixes a potential problem that could arise if a signal handler
+      closed a session, which would cause select() to return -1 with
+      EBADF, and thus terminate the agent.
+   
+2001-04-03 09:31  dts12
+
+   * agent/mibgroup/mibII/system_mib.c:
+
+   Ensure that the 'extmp' command variable is accessible on systems without EXECV.
+   
+2001-04-03 09:29  dts12
+
+   * agent/mibgroup/mibII/interfaces.c:
+
+   Keep one of the pickier compilers (HP's aCC) happy.
+   
+2001-04-03 09:22  dts12
+
+   * apps/: snmptrapd.c , snmptrapd_log.c:
+
+   Keep one of the pickier compilers (HP's aCC) happy.
+   
+2001-04-03 09:15  dts12
+
+   * snmplib/: mib.c , read_config.c , snmpTCPDomain.h
+   , snmpUDPDomain.c , snmpUnixDomain.c ,
+   snmpUnixDomain.h , snmp_api.c , snmp_logging.c ,
+   snmp_transport.c , snmp_transport.h , system.c:
+
+   Keep one of the pickier compilers (HP's aCC) happy.
+   
+2001-04-03 06:30  dts12
+
+   * agent/mibgroup/mibII/kernel_linux.c:
+
+   Plug file-descriptor leak when using cached data.  (Bug#412000)
+   
+2001-04-02 10:11  jbpn
+
+   * agent/snmp_agent.c:
+
+    - check for limits.h properly
+   
+2001-04-02 10:10  jbpn
+
+   * man/snmp_agent_api.3:
+
+    - minor typeface changes
+   
+2001-03-31 06:27  jbpn
+
+   * man/snmp_agent_api.3:
+
+    - update documentation of agent_check_and_process to reflect
+      current behaviour
+   
+        ** NOTE: currently returns control to user when an alarms runs **
+        **                                                             **
+        **                         This may change                     **
+   
+2001-03-31 06:25  jbpn
+
+   * man/snmp_alarm.3:
+
+    - document the snmp_alarm_register_hr function
+   
+    - expand the NOTES section discussing use of SIGALRM (or not)
+   
+2001-03-31 06:17  jbpn
+
+   * agent/mibgroup/agentx/subagent.c:
+
+    - Make use of SNMP_CALLBACK_OP_DISCONNECT transport disconnect
+      indication to shut down AgentX sessions cleanly and cancel all
+      callbacks which make refernce to the AgentX session.
+   
+2001-03-31 06:15  jbpn
+
+   * agent/mibgroup/agentx/master_admin.c:
+
+    - Fix multiple free() of parts of the subsession by zeroing out
+      fields that we don't use.
+   
+    - Make use of SNMP_CALLBACK_OP_DISCONNECT transport disconnect
+      indication to shut down AgentX sessions cleanly.
+   
+2001-03-31 06:13  jbpn
+
+   * agent/mibgroup/agentx/master_request.c:
+
+    - Make use of SNMP_CALLBACK_OP_DISCONNECT transport disconnect
+      indication to shut down AgentX sessions cleanly.
+   
+2001-03-31 06:11  jbpn
+
+   * agent/snmp_agent.c:
+
+    - Fix memory leak in handle_one_var where long varbinds weren't
+      correctly free()d.
+   
+    - Change behaviour of agent_check_and_process so that alarms run
+      correctly.
+   
+        ** NOTE: currently returns control to user when an alarms runs **
+        **                                                             **
+        **                         This may change                     **
+   
+2001-03-31 06:05  jbpn
+
+   * snmplib/snmp_api.c:
+
+    - Changed packet handling on stream-like transports so that all
+      complete received packets are processed:
+   
+      _sess_read is refactored into two functions: _sess_read remains
+      responsible for reading data from the transport layer, but then
+      calls (perhaps more than once) _sess_process_packet to dispatch
+      each packet read.
+   
+    - The presence of a session with a buffered partial packet no longer
+      causes snmp_select_info to return with a timeout of zero.
+   
+    - Free the subsessions of a session when doing an snmp_sess_close;
+      this fixes an AgentX memory leak when subagents come and go.
+   
+    - Perform callbacks with an operation argument of
+      SNMP_CALLBACK_OP_DISCONNECT when you get a transport disconnect
+      indication.
+   
+2001-03-31 05:56  jbpn
+
+   * snmplib/snmp_api.h:
+
+   Made transport domain const
+   
+2001-03-31 05:55  jbpn
+
+   * snmplib/callback.c:
+
+   Fix memory leak that can occur when deregistering callbacks
+   
+2001-03-30 08:05  hardaker
+
+   * README.agentx:
+
+   file README.agentx was initially added on branch V4-2-patches.
+   
+2001-03-29 21:43  hardaker
+
+   * ISSUES (V4-2-patches.1), ISSUES:
+
+   rm ISSUES
+   
+2001-03-29 08:21  slif
+
+   * win32/libsnmp_dll/: libsnmp.def (V4-2-patches.3), libsnmp.def:
+
+   Add vacm_is_configured.
+   
+2001-03-28 06:19  jbpn
+
+   * agent/mibgroup/agentx/: client.c , master_request.c:
+
+    - use SNMP_CALLBACK_OP_<name> callback operation names
+   
+2001-03-28 06:00  jbpn
+
+   * apps/snmptrapd.c:
+
+    - use SNMP_CALLBACK_OP_<name> callback operation names
+   
+2001-03-28 05:36  jbpn
+
+   * agent/: snmp_agent.c , snmpd.c:
+
+    - use SNMP_CALLBACK_OP_<name> callback operation names
+   
+2001-03-28 05:06  jbpn
+
+   * snmplib/: snmp_client.c , snmp_api.c:
+
+    - use SNMP_CALLBACK_OP_<name> callback operation names
+   
+2001-03-28 05:04  jbpn
+
+   * snmplib/snmp_api.h:
+
+    - rename callback operations to SNMP_CALLBACK_OP_<name>
+    - add new operations SNMP_CALLBACK_OP_CONNECT, SNMP_CALLBACK_OP_DISCONNECT
+    - add legacy definitions for RECEIVED_MESSAGE, TIMED_OUT, SEND_FAILED
+   
+2001-03-27 15:57  hardaker
+
+   * agent/mibgroup/disman/: mteObjectsTable.c ,
+   mteTriggerTable.c:
+
+   change fprintf -> snmp_log.
+   Don't allow modifications of read-only rows in mteObjectsTable.
+   
+2001-03-27 10:55  hardaker
+
+   * agent/: ds_agent.h , mibgroup/disman/mteObjectsTable.c
+   , mibgroup/disman/mteObjectsTable.h ,
+   mibgroup/disman/mteTriggerBooleanTable.c ,
+   mibgroup/disman/mteTriggerDeltaTable.c ,
+   mibgroup/disman/mteTriggerExistenceTable.c ,
+   mibgroup/disman/mteTriggerTable.c ,
+   mibgroup/disman/mteTriggerTable.h ,
+   mibgroup/disman/mteTriggerThresholdTable.c:
+
+   Support for new features in the DISMAN-EVENT-MIB code:
+     New snmpd.conf tokens:
+      - monitor [-o oid...] [-u user] oid [(=|!=|<=|...) VALUE].
+      - defaultMonitors yes
+   
+2001-03-27 10:53  hardaker
+
+   * snmplib/mib.c:
+
+   Moved * from beginning of routine to the same line as the return
+   variable declaration.  Was causing etags grief the other way.
+   
+2001-03-27 10:52  hardaker
+
+   * local/Makefile.in:
+
+   patch from Ken Hornstein: use %s instead of @s for search/replace delimiters.
+   
+2001-03-27 10:29  hardaker
+
+   * apps/snmptrapd.c:
+
+   Use snmp_log with %s to prevent % expansion in octet strings containing a %s.
+   trap_fmt_free needs ()s.
+   
+2001-03-27 08:13  dts12
+
+   * agent/: snmp_agent.c , mibgroup/agentx/master_request.c:
+
+   Handle non-responsive AgentX sub-agents more robustly.
+      (Based on suggestions from Harrie Hazewinkel & Paul Rasmussen)
+   
+2001-03-27 08:03  dts12
+
+   * agent/snmp_agent.c:
+
+   Avoid double-freeing of cached address strings.
+      (John's improvement to my suggested fix).
+   
+2001-03-27 02:39  dts12
+
+   * agent/mibgroup/smux/smux.c:
+
+   Reset count of authorized peers on closedown.  (Thanks to Vlad Tunik)
+   
+2001-03-26 18:01  hardaker
+
+   * agent/mibgroup/mibII/vacm_vars.c, snmplib/vacm.c, snmplib/vacm.h
+   (V4-2-patches.[1,2,1]), agent/mibgroup/mibII/vacm_vars.c ,
+   snmplib/vacm.c , snmplib/vacm.h:
+
+   Fixed vacm to drop v1/v2c packets properly when no com2sec entries are found.
+   
+2001-03-26 11:04  hardaker
+
+   * local/: ipf-mod.pl (V4-2-patches.1), ipf-mod.pl:
+
+   add usage comment at top
+   
+2001-03-22 07:55  dts12
+
+   * snmplib/snmp_api.c:
+
+   Use ASN_OCTET_STR rather than the historic ASN_BIT_STR for 'b' object values
+   Patch from Frank Strauss.
+   
+2001-03-22 07:46  dts12
+
+   * agent/: agent_trap.c (V4-2-patches.3), agent_trap.c:
+
+   Fix for minor memory leak with trap-related varbind values.
+   Thanks to John Villalovos (and the Intel SNMP team)
+   
+2001-03-21 17:30  driehuis
+
+   * snmplib/mib.c:
+
+   Avoid crash in snmp_shutdown on platforms that check pointer validity
+   in free(3), e.g. FreeBSD.
+   
+2001-03-21 08:46  hardaker
+
+   * agent/agent_trap.c , agent/mibgroup/util_funcs.c ,
+   agent/mibgroup/mibII/mta_sendmail.c ,
+   agent/mibgroup/mibII/vacm_vars.c ,
+   agent/mibgroup/mibJJ/vacm_vars.c ,
+   agent/mibgroup/target/snmpTargetAddrEntry.c ,
+   agent/mibgroup/target/snmpTargetParamsEntry.c ,
+   agent/mibgroup/target/target.c ,
+   agent/mibgroup/ucd-snmp/disk.c ,
+   agent/mibgroup/ucd-snmp/extensible.c ,
+   agent/mibgroup/ucd-snmp/proc.c ,
+   agent/mibgroup/ucd-snmp/proxy.c , apps/snmptrapd_handlers.c
+   , snmplib/default_store.c , snmplib/read_config.c
+   , snmplib/read_config.h , snmplib/snmpusm.c ,
+   snmplib/snmpv3.c:
+
+   copy_nword created that checks buffer lengths.
+   Made everything use it.
+   
+2001-03-21 08:38  hardaker
+
+   * snmplib/snmpksm.c:
+
+   KSM patch from Ken Hornstein
+   
+2001-03-20 09:13  jbpn
+
+   * agent/.cvsignore:
+
+   Ignore Purify and NFS stuff
+   
+2001-03-16 10:14  hardaker
+
+   * config.h.in:
+
+   added MIT_NEW_CRYPTO (for ksm) definition which was missing
+   
+2001-03-16 02:51  jbpn
+
+   * agent/mibgroup/disman/mteTriggerTable.c:
+
+   fix ridiculous memory leak in discontinuity processing
+   
+2001-03-15 11:04  hardaker
+
+   * testing/tests/T056agentv2cmintrap:
+
+   whoops.  Missed a merge conflict line
+   
+2001-03-15 10:59  hardaker
+
+   * README , README.win32 , agent/mib_modules.c ,
+   agent/mibgroup/header_complex.c ,
+   agent/mibgroup/agentx/client.c ,
+   agent/mibgroup/agentx/master.c ,
+   agent/mibgroup/agentx/master_admin.c ,
+   agent/mibgroup/agentx/master_request.c ,
+   agent/mibgroup/agentx/protocol.c ,
+   agent/mibgroup/agentx/subagent.c ,
+   agent/mibgroup/host/hr_filesys.c , agent/mibgroup/mibII/at.c
+   , agent/mibgroup/mibII/ip.c ,
+   agent/mibgroup/notification/snmpNotifyFilterProfileTable.c ,
+   agent/mibgroup/notification/snmpNotifyFilterTable.c ,
+   agent/mibgroup/notification/snmpNotifyTable.c ,
+   agent/mibgroup/target/target.c ,
+   agent/mibgroup/ucd-snmp/dlmod.c ,
+   agent/mibgroup/ucd-snmp/pass_persist.c ,
+   agent/mibgroup/ucd-snmp/proxy.c , apps/snmptrapd.c ,
+   apps/snmptrapd_log.c , apps/snmpnetstat/if.c ,
+   man/snmp.conf.5.def , man/snmpcmd.1 , man/snmptrapd.8
+   , mibs/IANAifType-MIB.txt , mibs/MTA-MIB.txt ,
+   mibs/Makefile.mib , mibs/README.mibs ,
+   mibs/TUNNEL-MIB.txt , mibs/ianalist , mibs/mibfetch
+   , mibs/rfclist , mibs/rfcmibs.diff , mibs/smistrip
+   , perl/SNMP/SNMP.xs , snmplib/asn1.c ,
+   snmplib/default_store.c , snmplib/mib.c ,
+   snmplib/mib.h , snmplib/parse.c , snmplib/snmp_api.c
+   , snmplib/snmp_logging.c , snmplib/snmp_parse_args.c
+   , snmplib/snmp_parse_args.h , snmplib/snmpv3.c ,
+   snmplib/system.h , testing/eval_tools.sh ,
+   testing/tests/T054agentv2ctrap ,
+   testing/tests/T056agentv2cmintrap ,
+   testing/tests/T058agentauthtrap , testing/tests/T100agenthup
+   , win32/config.h , win32/mib_module_config.h ,
+   win32/mib_module_includes.h , win32/mib_module_inits.h ,
+   win32/libsnmp_dll/libsnmp.def ,
+   win32/libucdmibs/libucdmibs.def ,
+   win32/libucdmibs/libucdmibs.dsp:
+
+   merge from patches branch: merge2->3.
+   
+2001-03-15 10:22  jbpn
+
+   * agent/mibgroup/disman/mteTriggerTable.h:
+
+   extra members for discontinuity processing
+   
+2001-03-15 07:46  hardaker
+
+   * agent/snmpd.c:
+
+   Patch from Frank Strauss to run signal handlers earlier
+   
+2001-03-14 14:37  hardaker
+
+   * agent/: agent_trap.h (V4-2-patches.2), agent_trap.h:
+
+   Patch from Harrie Hazewinkel: make send_enterprise_trap_vars a public fn.
+   
+2001-03-14 12:16  slif
+
+   * agent/mibgroup/tunnel/tunnel.c:
+
+   Use config.h, don't use ucd-snmp directory to build in the mibgroup tree.
+   
+2001-03-14 11:05  slif
+
+   * testing/: Makefile.in , RUNTESTS , TESTCONF.sh
+   , eval_onescript.sh , eval_tools.sh:
+
+   merge the test script changes made in the V4-2-patches branch.
+   
+2001-03-14 10:57  jbpn
+
+   * agent/mibgroup/disman/mteTriggerTable.c:
+
+   Change to discontinuity processing to stop it returning TRUE all the
+   time
+   
+2001-03-14 10:52  jbpn
+
+   * agent/mibgroup/disman/mteTriggerTable.c:
+
+    - rough stab at discontinuity processing
+    - bail out of getNext-type loops on a badType condition
+   
+2001-03-14 10:34  hardaker
+
+   * README.krb5:
+
+   kerberos README file from Ken Hornstein
+   
+2001-03-14 10:28  jbpn
+
+   * agent/mibgroup/disman/mteTriggerDeltaTable.c:
+
+   Get returned *var_len right for mteTriggerDeltaDiscontinuityID
+   
+2001-03-14 10:19  slif
+
+   * agent/snmpd.c , agent/mibgroup/examples/ucdDemoPublic.c
+   , apps/snmpvacm.c , apps/snmpnetstat/winstub.c ,
+   snmplib/parse.c , snmplib/snmpUnixDomain.c:
+
+   patch submitted by Harrie Hazewinkel to quiet some warnings.
+   
+2001-03-14 10:19  hardaker
+
+   * acconfig.h , configure , configure.in ,
+   snmplib/snmp_api.c , snmplib/snmpksm.c ,
+   snmplib/snmpksm.h:
+
+   KSM patch from Ken Hornstein.
+   
+2001-03-14 05:45  dts12
+
+   * agent/mibgroup/host/: hr_swrun.c (V4-2-patches.5), hr_swrun.c:
+
+   Fix Linux file descriptor leak (reported by Oliver Fänger)
+   
+2001-03-14 05:22  jbpn
+
+   * agent/mibgroup/disman/.cvsignore:
+
+   [no log message]
+   
+2001-03-14 02:20  jbpn
+
+   * agent/mibgroup/disman/: mteTriggerTable.c ,
+   mteTriggerTable.h:
+
+    - save original PDU's transport domain -- necessary for
+      community string processing
+   
+      CAUTION: incompatible change in format of mteTriggerTable
+               configuration entry
+   
+    - fix memory leak in mte_run_trigger by releasing PDUs
+   
+    - send "bad type" notifications in some cases
+   
+    - other minor memory leaks
+   
+    - "delta" sampleType handled for boolean triggers
+   
+    - more "XXX:" comments!
+   
+2001-03-13 13:52  marz
+
+   * perl/SNMP/SNMP.xs:
+
+   fix support for Integer32
+   
+2001-03-11 08:43  jbpn
+
+   * snmplib/: snmp_transport.c , snmp_transport.h:
+
+   Add a function to test whether an OID corresponds to a supported transport
+   domain.
+   
+2001-03-11 07:55  jbpn
+
+   * snmplib/snmpTCPDomain.h:
+
+   Add #includes to make struct sockaddr_in complete
+   
+2001-03-11 07:54  jbpn
+
+   * snmplib/snmpAAL5PVCDomain.h:
+
+   Remove spurious #include
+   
+2001-03-09 07:32  hardaker
+
+   * agent/mibgroup/mibII/vacm_vars.c:
+
+   Fix rwuser -s model to actually work.
+   
+2001-03-09 05:52  jbpn
+
+   * snmplib/snmpTCPDomain.c:
+
+   Set a PDU's opaque data on a tcp_recv; this isn't necessary to send
+   replies (because the underlying socket is strongly connected) but if
+   you don't do this then you can't do "com2sec" type processing for PDUs
+   received on TCP sessions... interesting.
+   
+2001-03-09 03:33  jbpn
+
+   * snmplib/snmpUDPDomain.c:
+
+   Fix bad assumption that community string is zero-terminated
+   
+2001-03-08 15:36  hardaker
+
+   * agent/snmpd.c:
+
+   - correct version statements to indicate net-snmp.
+   - remove my name as author (I'm certainly not the only one)
+   - add web address.
+   
+2001-03-08 15:31  hardaker
+
+   * README:
+
+   - Added Ken Hornstein's name to contributers list.
+   - Removed mine from being listed separately.
+   
+2001-03-08 14:51  hardaker
+
+   * configure , configure.in ,
+   agent/mibgroup/mibII/vacm_vars.c , snmplib/snmpksm.c ,
+   snmplib/snmpksm.h:
+
+   Added a kerberos based security module (ksm).
+     However, Needs libraries (-lkrb5 -lcom_err) not being checked for currently.
+   
+2001-03-08 14:48  hardaker
+
+   * snmplib/snmp_api.c:
+
+   Whoops.  Shouldnt have a negation sign on the most recent checkin.
+   
+2001-03-08 14:38  hardaker
+
+   * snmplib/snmp_api.c:
+
+   If NO_PROBE is set, don't do any post probing activities either like
+   time updating and user creation.
+   
+2001-03-08 08:14  jbpn
+
+   * agent/mibgroup/target/target.c:
+
+   Remove strdup()s on some session parameters which cause memory leaks
+   (since snmp_open deep copies the input session anyway)
+   
+2001-03-08 08:11  jbpn
+
+   * agent/mibgroup/target/snmpTargetAddrEntry.c:
+
+   Make sure sess field of new entries is initialised to NULL.
+   
+2001-03-08 07:49  jbpn
+
+   * agent/mibgroup/target/snmpTargetParamsEntry.c:
+
+   Make config token parser update timestamp on entry it creates;
+   move update_timestamp function.
+   
+2001-03-07 07:45  hardaker
+
+   * perl/SNMP/: README , SNMP.pm , SNMP.xs:
+
+   Patch from Karl Schilke to remove unneeded timestamp support
+   
+2001-03-06 20:58  hardaker
+
+   * snmplib/: snmp_api.c , snmp_client.c , snmp_secmod.c
+   , snmp_secmod.h , snmpusm.c:
+
+   secmod struct symbol name changes to something more intelligible.
+   
+2001-03-06 16:46  hardaker
+
+   * snmplib/: snmp_api.c , snmp_client.c:
+
+   - set the default pdu security model to SNMP_DEFAULT_SECMODEL (not 0).
+   - don't force the security model of the session on the pdu if already set.
+   
+2001-03-06 16:11  hardaker
+
+   * agent/mibgroup/mibII/vacm_vars.c:
+
+   hopefully fix to allow other (registered) security models to be used.
+   
+2001-03-06 09:23  hardaker
+
+   * README:
+
+   Added John Naylon to the README file.
+   
+2001-03-06 09:22  hardaker
+
+   * snmplib/: snmp_api.c , snmp_secmod.h:
+
+   Create a new secmod callback when a timeout on a pdu occurs.
+   
+2001-03-06 09:18  hardaker
+
+   * configure , configure.in:
+
+   properly install secmod header list.
+   
+2001-03-06 08:43  hardaker
+
+   * snmplib/: snmp_api.c , snmp_secmod.h:
+
+   - bug fixes for secmod related stuff (it compiles now (opps)).
+   
+2001-03-06 08:38  hardaker
+
+   * snmplib/: snmp_api.c , snmp_secmod.h:
+
+   - two new secmod callbacks for freeing a pdu and a session.
+   - move transport closing in snmp_sess_close() to after pending
+     requests are freed/closed in case something needs to make use of the
+     transport before it closes.
+   
+2001-03-06 07:56  hardaker
+
+   * snmplib/: snmp_api.c , snmp_secmod.h:
+
+   Pass in pdu to secmod encode/decode routines.
+   
+2001-03-06 03:35  jbpn
+
+   * agent/mibgroup/mibII/interfaces.c:
+
+   Modified function Interface_Index_By_Name (Solaris specific) to cope more
+   gracefully with large numbers of interfaces.  Also stops Purify on Solaris
+   complaining about uninitialised memory reads.
+   
+2001-03-05 16:33  hardaker
+
+   * snmplib/snmp_api.c:
+
+   reverse callback ordering of normal callback/secmod callback
+   processing in sess_copy().
+   
+2001-03-05 16:26  hardaker
+
+   * snmplib/snmp_secmod.c:
+
+   remove unused free function calls for security module unregistrations.
+   
+2001-03-05 16:17  hardaker
+
+   * snmplib/: snmp_api.c , snmp_secmod.h:
+
+   minor API changes to the pluggable security model handling.
+   
+2001-03-05 16:11  hardaker
+
+   * snmplib/snmp_api.c:
+
+   properly respect the DONT_PROBE_FLAG.
+   
+2001-03-05 15:36  hardaker
+
+   * snmplib/: snmp_api.c , snmp_api.h , snmp_secmod.h:
+
+   add a session pointer to the v3 build routines.
+   
+2001-03-05 15:23  hardaker
+
+   * snmplib/: snmp_api.c , snmp_api.h:
+
+   Add a krb5 specific error code.
+   
+2001-03-05 14:58  hardaker
+
+   * configure , configure.in:
+
+   make configure properly handle pluggable security modules
+   
+2001-03-05 14:49  hardaker
+
+   * configure , configure.in:
+
+   make configure mkdir snmplib before creating a file in it
+   
+2001-03-05 14:44  hardaker
+
+   * configure , configure.in:
+
+   make configure respect non-local srcdirs for transport/secmods
+   
+2001-03-05 10:40  hardaker
+
+   * acconfig.h , config.h.in , configure ,
+   configure.in , agent/agent_index.c ,
+   agent/agent_read_config.c , agent/agent_registry.c ,
+   agent/mib_modules.c , agent/snmp_vars.c ,
+   agent/snmpd.c , agent/mibgroup/examples/ucdDemoPublic.c
+   , agent/mibgroup/snmpv3/usmUser.c , apps/snmptrapd.c
+   , snmplib/.cvsignore , snmplib/Makefile.in ,
+   snmplib/callback.h , snmplib/default_store.h ,
+   snmplib/lcd_time.c , snmplib/scapi.c ,
+   snmplib/snmp_api.c , snmplib/snmp_api.h ,
+   snmplib/snmpusm.c , snmplib/snmpusm.h ,
+   snmplib/snmpv3.c:
+
+   support for pluggable security models.  Currently only the USM is
+   available, but a new kerberos based security model will be available
+   shortly.  These changes simply make it possible to use more than one
+   security service.
+   
+2001-03-05 10:36  hardaker
+
+   * snmplib/: snmp_secmod.c , snmp_secmod.h:
+
+   Added John Naylon to the authors list.
+   
+2001-03-05 10:33  hardaker
+
+   * snmplib/snmp_enum.h:
+
+   Comment re-arranging to actually be near the functions they're describing.
+   
+2001-03-05 06:10  jbpn
+
+   * snmplib/system.c:
+
+   Modified get_myaddr() function to cope more gracefully with large numbers
+   of interfaces, and with the possibility of non-IPv4 addresses on some
+   interfaces.  Also stops Purify on Solaris complaining about uninitialised
+   memory reads.  Use "official" definition of INADDR_LOOPBACK.
+   
+2001-03-03 14:34  nba
+
+   * mibs/ianalist:
+
+   file ianalist was initially added on branch V4-2-patches.
+   
+2001-03-03 14:34  nba
+
+   * mibs/rfclist:
+
+   file rfclist was initially added on branch V4-2-patches.
+   
+2001-03-03 14:34  nba
+
+   * mibs/README.mibs:
+
+   file README.mibs was initially added on branch V4-2-patches.
+   
+2001-03-03 14:34  nba
+
+   * mibs/rfcmibs.diff:
+
+   file rfcmibs.diff was initially added on branch V4-2-patches.
+   
+2001-03-01 19:23  hardaker
+
+   * snmplib/: asn1.c , snmp_api.c:
+
+   Fix snmp_oid_compare and reverse encodings to deal with numbers > 2^31.
+   
+2001-02-28 23:02  hardaker
+
+   * snmplib/: read_config.c , read_config.h ,
+   snmp_parse_args.c:
+
+   - implemented snmp_config(char *line) to parse a .conf configuration
+     line at any time in the code (handlers must be registered before hand).
+   - implemented snmp_config_remember(char *line) to memorize it for
+     later use.
+   - read_configs, et al, will automatically call them after reading
+     everything else.
+   - Added a -Y flag to snmp_parse_args to store read config directives
+     for later use, thus allowing you to specify .conf directives on the
+     command line.
+   
+2001-02-27 07:28  dts12
+
+   * agent/snmp_vars.c:
+
+   Avoid infinite loop with AgentX subagents and VACM checking interaction.
+   (Fix provided by Frank Strauss)
+   
+2001-02-21 15:21  hardaker
+
+   * snmplib/: ucd-snmp-includes.h (V4-2-patches.1),
+   ucd-snmp-includes.h:
+
+   Applied patch #103805 from bcollar: add sys/time.h to ucd-snmp-includes.h
+   
+2001-02-21 15:15  hardaker
+
+   * snmplib/: int64.c (V4-2-patches.2), int64.c:
+
+   fix bug #133416 (u64Subtraction math) as suggested by the submittor
+   
+2001-02-16 15:12  hardaker
+
+   * agent/: var_struct.h (V4-2-patches.1), var_struct.h:
+
+   - increase UCD_REGISTRY_OID_MAX_LEN to 128 at Frank's request
+   
+2001-02-16 04:16  jbpn
+
+   * configure.in:
+
+   Change behaviour on cygwin to exclude Unix domain transports by default
+   on cygwin, and also fix a minor bug, thanks to suggestions by Peter Folk.
+   
+2001-02-14 18:14  hardaker
+
+   * apps/: snmptrapd.c (V4-2-patches.1), snmptrapd.c:
+
+   removed unused snmp_alarm.h include
+   
+2001-02-12 14:11  marz
+
+   * perl/SNMP/SNMP.pm:
+
+   added Karl's patch for usenumeric
+   
+2001-02-12 13:54  marz
+
+   * perl/SNMP/: MANIFEST , SNMP.pm , SNMP.xs ,
+   examples/trap-example.pl:
+
+   added trap reception API from Philip Prindeville <philipp@cisco.com>
+   
+2001-02-11 08:23  jbpn
+
+   * apps/snmptrapd.c:
+
+   Use snmp_add not snmp_sess_add (the latter doesn't add a session to
+   the Session list, and it therefore won't get included in the select()
+   fdset, hence snmptrapd will never receive very much).
+   
+2001-02-11 08:20  jbpn
+
+   * snmplib/snmpUDPDomain.c:
+
+   Fix improperly-terminated list in com2sec handling.
+   
+2001-02-11 07:45  jbpn
+
+   * agent/snmpd.c:
+
+   Clean up merge (>>>>>>, ====== etc. left behind).
+   
+2001-02-10 09:26  jbpn
+
+   * configure.in:
+
+   Fix typo.
+   
+2001-02-10 09:11  jbpn
+
+   * agent/mibgroup/agentx/: master.c , master_admin.c ,
+   subagent.c:
+
+   Memory leak patches (sourceforge patch #103605).
+   Remove a few strdup()s, and call free_agent_snmp_session() rather than
+   free() in subagent.c:handle_agentx_packet() for AGENTX_MSG_RESPONSE
+   and default cases, to ensure free()ing of cloned PDU allocated by
+   init_agent_snmp_session.
+   
+2001-02-10 07:28  hardaker
+
+   * snmplib/: snmpAAL5PVCDomain.c , snmpAAL5PVCDomain.h ,
+   snmpIPXDomain.c , snmpIPXDomain.h , snmpTCPDomain.c
+   , snmpTCPDomain.h , snmpUDPDomain.c ,
+   snmpUDPDomain.h , snmpUnixDomain.c , snmpUnixDomain.h
+   , snmp_transport.c , snmp_transport.h:
+
+   Whoops.  Forgot the new files associated with the pluggable transport stuff.
+   
+2001-02-09 11:22  hardaker
+
+   * agent/mibgroup/disman/: event-mib.h , mteObjectsTable.c
+   , mteObjectsTable.h , mteTriggerBooleanTable.c ,
+   mteTriggerExistenceTable.c , mteTriggerTable.c ,
+   mteTriggerTable.h , mteTriggerThresholdTable.c:
+
+   Implemented and made use of mteObjectsTable to send additional objects out with traps generated.  Also, don't return data for misc tables when that trigger isn't defined to use that test type.
+   
+2001-02-09 11:16  hardaker
+
+   * agent/: snmpd.c (V4-2-patches.2), snmpd.c:
+
+   Applied patch #103613: fix memory leak in snmpd port specification -> default_store.
+   
+2001-02-09 11:14  hardaker
+
+   * agent/: mib_modules.c (V4-2-patches.2), mib_modules.c:
+
+   Applied patch #103612: fix memory leak in mib_module init code
+   
+2001-02-09 11:12  hardaker
+
+   * agent/: agent_registry.c (V4-2-patches.1), agent_registry.c:
+
+   Applied patch #103611: fix memory leak for duplicate oid registrations.
+   
+2001-02-09 11:05  hardaker
+
+   * agent/mibgroup/ucd-snmp/: memory_freebsd2.c, proxy.c
+   (V4-2-patches.[1,4]), memory_freebsd2.c:
+
+   Applied patch #103702: fix swap reporting on freebsd 4.2
+   
+2001-02-09 10:12  hardaker
+
+   * acconfig.h , config.h.in , configure ,
+   configure.in , agent/agent_trap.c , agent/snmp_agent.c
+   , agent/snmp_agent.h , agent/snmp_vars.c ,
+   agent/snmpd.c , agent/mibgroup/mibII/vacm_vars.c ,
+   apps/snmpstatus.c , apps/snmptest.c , apps/snmptrap.c
+   , apps/snmptrapd.c , apps/snmptrapd_log.c ,
+   apps/snmptrapd_log.h , mibs/UCD-SNMP-MIB.txt ,
+   snmplib/Makefile.in , snmplib/snmp_alarm.c ,
+   snmplib/snmp_alarm.h , snmplib/snmp_api.c ,
+   snmplib/snmp_api.h , snmplib/snmp_client.c ,
+   snmplib/vacm.h:
+
+   Applied patch 103510: domain transport independence.  Note: Traps/VACM broken.
+   
+2001-02-09 08:54  hardaker
+
+   * testing/tests/: T001snmpv1get , T002snmpv1getnext ,
+   T003snmpv1getfail , T014snmpv2cget , T015snmpv2cgetnext
+   , T016snmpv2cgetfail , T017snmpv2ctov1getfail ,
+   T018snmpv1tov2cgetfail , T020snmpv3get ,
+   T021snmpv3getnext , T022snmpv3getMD5 ,
+   T023snmpv3getMD5DES , T024snmpv3getSHA1 ,
+   T025snmpv3getSHADES , T028snmpv3getfail ,
+   T030snmpv3usercreation , T053agentv1trap ,
+   T054agentv2ctrap , T055agentv1mintrap ,
+   T056agentv2cmintrap , T058agentauthtrap , T100agenthup
+   , T110agentxget , T111agentxset , T112agentxsetfail
+   , T113agentxtrap , T120proxyget , T121proxyset
+   , T122proxysetfail:
+
+   updated most tests to use numeric OIDs so as to not rely on mib parsing
+   
+2001-02-09 07:18  hardaker
+
+   * agent/mibgroup/agentx/master.h:
+
+   remove unused prototype: get_agentx_transID
+   
+2001-02-08 14:15  hardaker
+
+   * local/Makefile.in , local/traptoemail ,
+   man/snmptrapd.conf.5.def:
+
+   traptoemail perl script created as an example traphandle script
+   
+2001-02-08 14:01  hardaker
+
+   * Makefile.in , acconfig.h , config.h.in ,
+   agent/Makefile.in , agent/agent_trap.c ,
+   agent/mib_modules.c , agent/snmpd.c ,
+   agent/mibgroup/kernel_sunos5.c ,
+   agent/mibgroup/agentx/client.c ,
+   agent/mibgroup/agentx/master.c ,
+   agent/mibgroup/agentx/master_admin.c ,
+   agent/mibgroup/agentx/master_admin.h ,
+   agent/mibgroup/agentx/master_request.c ,
+   agent/mibgroup/agentx/protocol.c ,
+   agent/mibgroup/agentx/subagent.c ,
+   agent/mibgroup/host/hr_print.c ,
+   agent/mibgroup/host/hr_swrun.c ,
+   agent/mibgroup/mibII/interfaces.c ,
+   agent/mibgroup/mibII/var_route.c ,
+   agent/mibgroup/notification/snmpNotifyTable.c ,
+   agent/mibgroup/smux/smux.c ,
+   agent/mibgroup/ucd-snmp/loadave.c ,
+   agent/mibgroup/ucd-snmp/proxy.c ,
+   agent/mibgroup/ucd-snmp/vmstat.h ,
+   agent/mibgroup/ucd-snmp/vmstat_bsdi4.c ,
+   agent/mibgroup/ucd-snmp/vmstat_bsdi4.h ,
+   agent/mibgroup/ucd-snmp/vmstat_freebsd2.c ,
+   agent/mibgroup/ucd-snmp/vmstat_freebsd2.h ,
+   agent/mibgroup/ucd-snmp/vmstat_netbsd1.c ,
+   agent/mibgroup/ucd-snmp/vmstat_netbsd1.h ,
+   agent/mibgroup/ucd-snmp/vmstat_solaris2.c ,
+   agent/mibgroup/ucd-snmp/vmstat_solaris2.h , apps/snmpdelta.c
+   , apps/snmpset.c , apps/snmptrap.c ,
+   apps/snmpvacm.c , apps/snmpnetstat/Makefile.in ,
+   local/mib2c , man/snmpcmd.1 , mibs/RMON-MIB.txt ,
+   mibs/UCD-SNMP-MIB.txt , perl/SNMP/SNMP.pm ,
+   snmplib/int64.c , snmplib/parse.c , snmplib/snmp_api.c:
+
+   Merge from V4-2-patches: merge 1->2
+   
+2001-01-30 17:13  hardaker
+
+   * agent/mibgroup/ucd-snmp/: disk.c (V4-2-patches.1), disk.c:
+
+   Applied patch #103414: fix disk info for block sizes other than 1024.
+   
+2001-01-30 13:28  hardaker
+
+   * agent/mibgroup/disman/mteTriggerTable.c:
+
+   use snmp_enum's properly (strdup() the strings first)
+   
+2001-01-30 13:28  hardaker
+
+   * snmplib/: snmp_enum.c , snmp_enum.h:
+
+   proper constness for some of the function arguments.
+   
+2001-01-30 13:27  hardaker
+
+   * snmplib/read_config.c:
+
+   fix bug I just introduced (returning proper saveto pointer)
+   
+2001-01-30 13:17  hardaker
+
+   * local/tkmib:
+
+   - snmpsets are supported
+     - A new "set" button has been added to perform sets on an oid.
+     - All writable objects in a table are now buttons that bring up the
+       set window with the current value instated.
+     - All writable objects in the output of snmp{get,walk,getnext}
+       buttons are displayed as blue and are clickable to change their
+       values.
+   - settings configured via the options menu can now be saved.
+   - use Getopt::Std now.
+   - supports most of the important snmpcmd(1) flags for session setup.
+   
+2001-01-30 13:12  hardaker
+
+   * agent/mibgroup/disman/: event-mib.h ,
+   mteTriggerBooleanTable.c , mteTriggerBooleanTable.h ,
+   mteTriggerDeltaTable.c , mteTriggerDeltaTable.h ,
+   mteTriggerExistenceTable.c , mteTriggerExistenceTable.h ,
+   mteTriggerTable.c , mteTriggerTable.h ,
+   mteTriggerThresholdTable.c , mteTriggerThresholdTable.h:
+
+   Initial (not-complete) implementation of the DISMAN-EVENT-MIB:
+     - Implements all 3 tests (boolean, threshold and existence).
+     - not rigorously tested.
+     - Currently only supports querying the local agent
+       (mteTriggerTargetTag must be '').
+     - Currently only supports sending traps and the mteObjectsTable is
+       not implemented (my next todo item)
+     - Only the default traps are sent.  The mteEvent* objects haven't
+       been implemented (no self-defined traps/sets).
+     - no easy to use configuration yet (soon).
+     - configure with --with-mib-modules=disman/event-mib
+   
+2001-01-30 13:03  hardaker
+
+   * snmplib/read_config.c:
+
+   Use memcpy instead of sprintf for strings that may not be null terminated.
+   
+2001-01-30 12:58  hardaker
+
+   * agent/: snmp_agent.c , snmp_agent.h:
+
+   Implemented get_current_agent_session() and set_current_agent_session():
+     - These allow a mib module to retrieve the current
+       agent_snmp_session pointer for the current transaction.
+     - This should probably done differently later when we change the mib
+       module api.
+     - This will completely fail to work properly in a multi-threaded
+       agent (which we currently don't support anyway).
+   
+2001-01-29 11:58  hardaker
+
+   * snmplib/callback.c:
+
+   debugging statement at initialization time.
+   
+2001-01-29 11:58  hardaker
+
+   * snmplib/read_config.c:
+
+   properly malloc a 1 byte, NULL character string for "" read strings.
+   
+2001-01-29 11:54  hardaker
+
+   * agent/mibgroup/: header_complex.c , header_complex.h:
+
+   data seperation and new functions:
+     header_complex_get_from_oid()
+     header_complex_add_data_by_oid()
+   
+2001-01-12 08:22  hardaker
+
+   * mibs/DISMAN-EVENT-MIB.txt:
+
+   - DISMAN-EVENT-MIB added to mib repository. (Or, guess what I did during a 6 hour plane flight?)
+   
+2001-01-12 08:16  hardaker
+
+   * perl/SNMP/SNMP.xs:
+
+   support bit strings
+   
+2001-01-12 08:00  hardaker
+
+   * snmplib/: snmp_api.c (V4-2-patches.5), snmp_api.c:
+
+   - bit_string fixes
+   - make snmp_add_var call snmp_parse_oid() instead of read_objid().
+   
+2001-01-12 07:58  hardaker
+
+   * snmplib/read_config.c:
+
+   - new data types supported for read_config routines: unsigned, bit_str.
+   
+2001-01-12 07:56  hardaker
+
+   * snmplib/: asn1.c (V4-2-patches.3), asn1.c:
+
+   comment out really odd (and broken) check from asn_bitstring_check???
+   
+2001-01-12 07:53  hardaker
+
+   * agent/mibgroup/agentx/subagent.c:
+
+   move config string initializer above subagent check so its known even
+   if not used.
+   
+2001-01-12 07:51  hardaker
+
+   * local/: mib2c.storage.conf, mib2c.vartypes.conf
+   (V4-2-patches.[1,1]), mib2c.storage.conf ,
+   mib2c.vartypes.conf:
+
+   - misc bug fixes.
+   - new data types (uint32, unsigned, bits).
+   
+2001-01-09 17:08  hardaker
+
+   * agent/: agent_registry.c , agent_registry.h ,
+   ds_agent.h , var_struct.h , mibgroup/mibincl.h ,
+   mibgroup/agentx/client.c , mibgroup/agentx/master_admin.c
+   , mibgroup/agentx/master_request.c ,
+   mibgroup/agentx/subagent.c , mibgroup/agentx/subagent.h:
+
+   SubAgent ping support:
+     - agentxPingInterval specifies SECONDS between when the subagent
+       tries to ping the master agent.
+     - if no response is received, it tries to reconnect.
+     - failing that it tries every SECONDS again till it succeeds.
+     - re-registers its oid's based on the current subtree list.
+       - may need some thought.  Assumes *all* need to be re-registered.
+       - needs to re-register sysortable entries too, but doesn't.
+     - currently seg-faults on about the 2-4th time or so.  Not sure why.
+     - Should make Dave smile or cringe or giggle, not sure which.
+   
+2001-01-09 17:02  hardaker
+
+   * snmplib/: callback.c , callback.h:
+
+   Allow deregistering of callbacks
+   
+2001-01-09 06:20  hardaker
+
+   * win32/snmpnetstat/: snmpnetstat.dsp (V4-2-patches.1),
+   snmpnetstat.dsp:
+
+   added getopt.c to list
+   
+2001-01-04 16:44  hardaker
+
+   * snmplib/: snmp_enum.c , snmp_enum.h:
+
+   - generic snmp enum list support.  Not used anywhere (yet).
+   
+2001-01-04 16:43  hardaker
+
+   * configure , configure.in , agent/agent_callbacks.h
+   , agent/agent_trap.c , agent/agent_trap.h ,
+   agent/mibgroup/examples/example.c ,
+   agent/mibgroup/host/hr_swrun.c ,
+   agent/mibgroup/mibII/interfaces.c ,
+   agent/mibgroup/notification/snmpNotifyTable.c ,
+   agent/mibgroup/notification/snmpNotifyTable.h ,
+   apps/snmpnetstat/main.c , snmplib/Makefile.in ,
+   snmplib/asn1.c , snmplib/callback.c ,
+   snmplib/callback.h , snmplib/mib.c ,
+   snmplib/snmp_api.c , snmplib/snmp_logging.c ,
+   testing/tests/T053agentv1trap , testing/tests/T054agentv2ctrap
+   , testing/tests/T055agentv1mintrap ,
+   testing/tests/T056agentv2cmintrap ,
+   testing/tests/T113agentxtrap:
+
+   - merged patches from V4-2-patches branch to main branch.
+   
+2001-01-04 10:37  hardaker
+
+   * man/snmp.conf.5.def , man/snmpcmd.1 , snmplib/mib.c:
+
+   - added new printHexText snmp.conf token.
+   - documented -OT, and the token.
+   
+2001-01-04 10:27  hardaker
+
+   * snmplib/: default_store.h , mib.c:
+
+   Patch #103091 applied:
+     - Added -OT option to view hex strings with text in them.
+   
+2000-12-27 16:47  hardaker
+
+   * testing/tests/T056agentv2cmintrap:
+
+   file T056agentv2cmintrap was initially added on branch V4-2-patches.
+   
+2000-12-27 16:47  hardaker
+
+   * testing/tests/T055agentv1mintrap:
+
+   file T055agentv1mintrap was initially added on branch V4-2-patches.
+   
+2000-12-22 07:02  hardaker
+
+   * snmplib/vacm.c:
+
+   fix view processing to watch for length prefix.  The length prefix
+   really really shouldn't be stored directly in the oid.  Niels?
+   
+2000-12-19 07:22  hardaker
+
+   * snmplib/snmpv3.c:
+
+   make init_snmpv3() deal with a NULL argument properly.
+   
+2000-12-18 14:37  hardaker
+
+   * local/.cvsignore:
+
+   - (.cvsignore): remove passtest from the .cvsignore file (bug #12694)
+   
+2000-12-18 10:45  marz
+
+   * perl/SNMP/: README , SNMP.pm:
+
+   minor doc fix
+   
+2000-12-14 13:46  nba
+
+   * snmplib/system.c:
+
+   - system.c: fix uptime for 64-bit Solaris
+   
+2000-12-14 13:45  nba
+
+   * agent/mibgroup/ucd-snmp/dlmod.c:
+
+   - dlmod.c: fix stupid spelling error
+   
+2000-12-13 21:52  nba
+
+   * agent/mibgroup/ucd-snmp/dlmod.c:
+
+   - dlmod.c: fix confusion between int, size_t, long for 64-bit compiles.
+   
+2000-12-13 08:40  hardaker
+
+   * man/Makefile.in:
+
+   - (Makefile.in): add snmpconf.1
+   
+2000-12-08 14:49  nba
+
+   * agent/mibgroup/mibII/vacm_vars.c , snmplib/vacm.c:
+
+   - vacm_vars.c, vacm.c: indexing of vacmViewTreeFamilyEntry was hosed, assuming
+   	that the Subtree index had an IMPLIED attribute.
+   
+2000-12-08 14:46  nba
+
+   * agent/mibgroup/host/: hr_filesys.c , hr_partition.c:
+
+   - hr_filesys.c, hr_partition.c: fix some zero index values.
+   
+2000-12-08 14:43  nba
+
+   * agent/snmp_vars.c:
+
+   - snmp_vars.c: fix returns of zeroDotZero (such as ifSpecific)
+   
+2000-12-08 14:38  nba
+
+   * agent/agent_trap.c:
+
+   - agent_trapd.c: security model values are not the same is snmp version values
+   
+2000-12-06 14:45  nba
+
+   * agent/mibgroup/mibII/interfaces.c:
+
+   - interfaces.c: Linux kernel 2.0.x has no ARPHRD_HIPPI
+   
+2000-12-05 07:00  hardaker
+
+   * local/Makefile.in:
+
+   - (Makefile.in): Fix rsnmp's /usr/local hardcoded path.
+   
+2000-12-04 17:03  hardaker
+
+   * testing/tests/T112agentxsetfail:
+
+   - (T112agentxsetfail): fix
+   
+2000-12-04 16:33  hardaker
+
+   * README , sedscript.in , version.h:
+
+   - (version.h sedscript.in): version tag ( 5.2 )
+
+-------------------------------------------------------------------------------
+
+Changes: V4.2.3 -> V4.2.4
+	
+2002-04-04 15:24  hardaker
+
+   * snmplib/: snmp_api.c, snmp_api.h:
+
+   patch from Petter Larsen to add a function for extracting the fd associated with a session
+   
+2002-04-04 15:14  hardaker
+
+   * agent/agent_registry.c:
+
+   deal with fd unregistrations properly.
+   
+2002-04-03 08:32  hardaker
+
+   * FAQ, README, sedscript.in, version.h, perl/SNMP/SNMP.pm:
+
+   - (version.h sedscript.in): version tag ( 4.2.4.pre3 )
+   
+2002-04-02 15:02  hardaker
+
+   * agent/mibgroup/ucd-snmp/registry.c:
+
+   Apply patch #515577 to fix one case of a registry problem.
+   
+2002-04-02 14:57  hardaker
+
+   * agent/mibgroup/ucd-snmp/disk.c, s/darwin.h:
+
+   Apply patch #524424 for darwin fixes for ucd-snmp/disk.c
+   
+2002-04-02 14:48  hardaker
+
+   * agent/mibgroup/kernel_sunos5.c:
+
+   apply patch 527573 to fix 64 bit types on solaris
+   
+2002-04-01 22:28  hardaker
+
+   * snmplib/snmp_api.c:
+
+   Let init_snmp protect itself.
+   
+2002-03-28 23:48  hardaker
+
+   * agent/mibgroup/ucd-snmp/pass.c:
+
+   enable row creation for pass modules.  Patch #482005
+   
+2002-03-28 23:44  hardaker
+
+   * agent/mibgroup/mibII/interfaces.c:
+
+   patch #517340: freebsd5 support
+   
+2002-03-28 23:38  hardaker
+
+   * agent/mibgroup/host/hr_filesys.c:
+
+   apply freebsd5 patch #517333
+   
+2002-03-28 23:10  hardaker
+
+   * perl/SNMP/SNMP.xs:
+
+   fix bug #525844.  perl SNMP was using a trap address of 0.0.0.0.
+   
+2002-03-28 23:03  hardaker
+
+   * snmplib/snmp_api.c:
+
+   use a static variable for init checking.  Bug #536386.
+   
+2002-03-28 15:23  dts12
+
+   * FAQ:
+
+   Add a few new entries (mostly relating to traps)
+   
+2002-03-27 01:55  dts12
+
+   * configure.in, configure:
+
+   Use the correct name of the Windows IP Helper API library.
+   (Computers can be soooo picky!)
+   
+2002-03-26 08:29  hardaker
+
+   * agent/mibgroup/ucd-snmp/diskio.c:
+
+   enable diskio on freebsd5.  Implements patch 517328 in a different way.
+   
+2002-03-26 07:44  dts12
+
+   * configure, configure.in:
+
+   Add /etc/filesystems to list of mount table files (for AIX)
+   Should fix bugs 232588 and (?)517113
+   
+2002-03-26 07:39  dts12
+
+   * configure, configure.in:
+
+   Remove trailing ':' from list of MIB module names in configure output,
+   to avoid confusion (see Bug #491129)
+   
+2002-03-26 06:50  dts12
+
+   * configure, configure.in:
+
+   Add '-lhlpapi' to the agent libraries when compiling under Windows
+   (using Cygwin).  DLLIBS is not as suitable as AGENT_LIBS for this
+   (see the equivalent patch on the main branch), but it should do.
+   Should fix Bug #534409.
+   
+2002-03-25 22:33  rstory
+
+   * snmplib/parse.c:
+
+   fix bug#520478 showMibErrors token is inverted
+   
+2002-03-25 18:47  rstory
+
+   * agent/snmp_vars.c:
+
+   fix bug#502123 agentx infinite loop.
+   
+2002-03-24 05:19  nba
+
+   * agent/mibgroup/host/hr_swrun.c:
+
+   Restrict hrSWRunParams returns values to 128 octets
+   
+2002-03-24 05:04  nba
+
+   * snmplib/mib.c:
+
+   Oops - snprint_* cannot realloc
+   
+2002-03-21 07:21  hardaker
+
+   * configure.in, configure:
+
+   fix bug #532696 fixing rpm for newer rpm versions
+   
+2002-03-20 07:48  hardaker
+
+   * agent/mibgroup/mibII/system_mib.c:
+
+   remove illegal SET support for sysDescr.
+   
+2002-03-19 02:01  jbpn
+
+   * agent/mibgroup/smux/smux.h:
+
+     - patch from Joshua Giles to increase the maximum string length
+       (#527650).
+   
+2002-03-18 14:38  nba
+
+   * win32/libsnmp_dll/libsnmp.def:
+
+   Add missing exports for VC++ build
+   
+2002-03-18 13:23  nba
+
+   * agent/mibgroup/ucd-snmp/disk.c:
+
+   Proper test for successful open of ETC_MNTTAB
+   
+2002-03-18 13:09  nba
+
+   * agent/agent_read_config.c:
+
+   Fix interchanged parameters for strncpy
+   
+2002-03-18 08:51  dts12
+
+   * win32/: win32.dsw, encode_keychange/encode_keychange.dsp,
+   libagent/libagent.dsp, libsnmp/libsnmp.dsp,
+   libsnmp_dll/libsnmp_dll.dsp, libucdmibs/libucdmibs.dsp,
+   snmpbulkget/snmpbulkget.dsp, snmpbulkwalk/snmpbulkwalk.dsp,
+   snmpd/snmpd.dsp, snmpdelta/snmpdelta.dsp, snmpdf/snmpdf.dsp,
+   snmpgetnext/snmpgetnext.dsp, snmpget/snmpget.dsp,
+   snmpnetstat/snmpnetstat.dsp, snmpset/snmpset.dsp,
+   snmpstatus/snmpstatus.dsp, snmptable/snmptable.dsp,
+   snmptest/snmptest.dsp, snmptranslate/snmptranslate.dsp,
+   snmptrap/snmptrap.dsp, snmptrapd/snmptrapd.dsp,
+   snmpusm/snmpusm.dsp, snmpvacm/snmpvacm.dsp, snmpwalk/snmpwalk.dsp:
+
+   Apply DOS-type line endings to the DSW/DSP files.
+   
+2002-03-18 08:41  dts12
+
+   * agent/mibgroup/smux/smux.c:
+
+   Use the same variable name for output buffer and size calculation.
+   
+2002-03-18 05:39  jbpn
+
+   * README.hpux11, agent/mibgroup/host/hr_storage.c,
+   agent/mibgroup/host/hr_system.c, agent/mibgroup/mibII/var_route.c,
+   agent/mibgroup/ucd-snmp/loadave.c,
+   agent/mibgroup/ucd-snmp/memory.c, agent/mibgroup/ucd-snmp/memory.h,
+   s/hpux.h:
+
+     - commit Johannes's update to the HPUX-11 patch
+   
+2002-03-18 02:31  jbpn
+
+   * agent/mibgroup/agentx/master.c:
+
+     - extend tcp_wrappers support to AgentX.  This makes it more
+       reasonable to implement a distributed subagent architecture
+       without massive security worries.
+   
+2002-03-14 07:23  hardaker
+
+   * snmplib/snmp_api.c:
+
+   Fix dont_probe bug pointed out by Stefan Aeschbacher.
+   
+2002-03-13 18:58  slif
+
+   * snmplib/asn1.c:
+
+   Clarify unsigned char argument for the noisy or confused compiler.
+   
+2002-03-13 18:46  slif
+
+   * agent/mibgroup/mibII/vacm_vars.c, apps/snmptrapd_log.c:
+
+   quell several warnings about signed vs unsigned comparisons.
+   
+2002-03-13 18:44  slif
+
+   * win32/win32.dsw:
+
+   remove dependencies to restore building either Debug or Release targets.
+   
+2002-03-13 18:43  slif
+
+   * win32/libsnmp_dll/libsnmp.def:
+
+   track change setenv --> snmp_setenv
+   
+2002-03-13 15:50  hardaker
+
+   * mibs/: UCD-DEMO-MIB.txt, UCD-DISKIO-MIB.txt, UCD-DLMOD-MIB.txt,
+   UCD-IPFILTER-MIB.txt, UCD-IPFWACC-MIB.txt, UCD-SNMP-MIB.txt:
+
+   address changes for ucd-snmp -> net-snmp note saying these mibs are no
+   longer supported by UCD.
+   
+2002-03-13 15:21  hardaker
+
+   * snmplib/tools.c:
+
+   malloc at least one byte in hex_to_binary2
+   
+2002-03-13 04:03  dts12
+
+   * FAQ:
+
+   Add a description of "unlinked OIDs".
+   
+2002-03-12 20:03  hardaker
+
+   * agent/mibgroup/ucd-snmp/memory_solaris2.c:
+
+   Patch from daniel Sully to improve solaris swap info
+   
+2002-03-12 08:34  dts12
+
+   * FAQ:
+
+   Updating of the FAQ ready for the next release.
+   (Mostly rephrasing of existing entries, but a few new questions)
+   
+2002-03-11 10:06  hardaker
+
+   * agent/: mibgroup/smux/smux.c, mibgroup/ucd-snmp/proxy.c,
+   agent_index.c, agent_read_config.c, agent_registry.c, snmp_agent.c,
+   snmpd.c, mibgroup/agentx/master_request.c:
+
+   better printing apis
+   
+2002-03-11 10:06  hardaker
+
+   * apps/snmpvacm.c:
+
+   fix api in a comment (how picky am I?)
+   
+2002-03-11 07:41  dts12
+
+   * FAQ:
+
+   Bring the 4x- and main-branch FAQs into agreement.
+   
+2002-03-11 05:16  jbpn
+
+   * snmplib/parse.c:
+
+     - fix bad type assignment in build_translation_table(), noticed by
+       Peter Stevens.
+   
+2002-03-10 14:07  nba
+
+   * snmplib/mib.h:
+
+   Oops - forgot to remove the #ifdef for unsafe sprint_* functions declarations
+   
+2002-03-10 13:54  nba
+
+   * apps/snmpwalk.c:
+
+   Fix up out-of-order error message
+   
+2002-03-10 13:44  nba
+
+   * apps/snmpdelta.c:
+
+   Don't die on v2 exceptions
+   
+2002-03-10 13:41  nba
+
+   * snmplib/: asn1.c, snmp_debug.c:
+
+   Remove some calls to old sprint_* functions
+   
+2002-03-10 13:39  nba
+
+   * snmplib/: mib.c, mib.h:
+
+   Add snprint_* replacement functions for all sprint_* functions
+   
+2002-03-10 13:38  nba
+
+   * man/mib_api.3:
+
+   Document snprint_{objid,variable,value}
+   
+2002-03-10 08:34  hardaker
+
+   * snmplib/: mib.c, mib.h:
+
+   include the snprintf counterparts from the 5.0 code.
+   
+2002-03-08 18:07  hardaker
+
+   * agent/mibgroup/mibII/ipAddr.c:
+
+   redefine a variable on freebsd for 2.2.5
+   
+2002-03-08 17:57  hardaker
+
+   * agent/mibgroup/mibII/interfaces.c:
+
+   remove a broken fix I accidentically committed
+   
+2002-03-08 17:42  hardaker
+
+   * agent/mibgroup/mibII/interfaces.c:
+
+   patch from Mihail Balikov to support up but no ip interfaces.
+   
+2002-03-08 17:27  hardaker
+
+   * configure.in, configure, aclocal.m4:
+
+   patch from Paul Rasmussen to fix --enable-shared
+   
+2002-03-08 16:58  hardaker
+
+   * perl/SNMP/SNMP.xs:
+
+   old patch from Bert Driehuis to fix c64s in perl
+   
+2002-03-08 14:53  nba
+
+   * snmplib/mib.c:
+
+   Remove 1000 lines of duplicate code by using the sprint_realloc_* functions
+   in the implementaion of the non-realloc counterparts.
+   
+2002-03-08 14:51  nba
+
+   * apps/: snmpdelta.c, snmptable.c, snmpusm.c, snmpwalk.c:
+
+   Remove last sprint_nonrealloc calls
+   
+2002-03-07 03:20  jbpn
+
+   * man/mib_api.3:
+
+     - patch from Guy Harris to describe new mib_api
+   
+2002-03-07 02:58  jbpn
+
+   * snmplib/mib.h:
+
+     - declare the sprint_realloc_blah functions.  Thanks to Guy Harris.
+   
+2002-03-06 08:41  dts12
+
+   * snmplib/snmpv3.c:
+
+   Fix a confusion between defAuthType and defPrivType.
+   
+2002-03-06 05:52  dts12
+
+   * snmplib/snmp_api.c:
+
+   Actually use the common 'defPassphrase' value if 'def{Auth,Priv}Passphrase' isn't set.
+   Qn: Should the AuthPassphrase also be used for privacy if no other value is available?
+   
+2002-03-06 03:19  jbpn
+
+   * testing/Makefile.in:
+
+     - ignore errors doing rm -rf /tmp/snmp-test* when making clean (this
+       happens all the time on the compile farm because e.g. I can't
+       delete Wes's test directories and it's a nuisance because then the
+       rest of the directories don't get cleaned up properly).
+   
+2002-03-06 02:24  jbpn
+
+   * snmplib/mib.c:
+
+     - fix another potential buffer overflow problem as reported in bug
+       #526262.
+   
+2002-03-05 10:45  hardaker
+
+   * agent/mibgroup/ucd-snmp/versioninfo.c:
+
+   impose max length restriction supplied by mib for configuration options.
+   
+2002-03-05 09:52  hardaker
+
+   * mibs/UCD-SNMP-MIB.txt:
+
+   missed a modification to the patch.
+   
+2002-03-05 09:51  hardaker
+
+   * mibs/UCD-SNMP-MIB.txt:
+
+   A modified patch from Juergen Schoenwaelder for longer configure strings.
+   
+2002-03-05 08:23  dts12
+
+   * agent/snmp_vars.h:
+
+   Reverse my earlier (bogus) fix.
+   Things were fine as they were - I must be cracking up.....
+   
+2002-03-05 08:05  dts12
+
+   * agent/mibgroup/examples/ucdDemoPublic.c:
+
+   Add missing "standard" headers, and tweak a type slightly.
+   (Based on requests from Gregory Toth).
+   
+2002-03-05 06:56  dts12
+
+   * agent/snmp_vars.h:
+
+   Bring declaration of 'init_agent' into line with code definition.
+   
+2002-03-05 06:48  dts12
+
+   * agent/mibgroup/: notification/snmpNotifyTable.c, ucd-snmp/dlmod.c:
+
+   Cast a couple of mallocs appropriately (requested by Gregory Toth)
+   
+2002-03-04 21:38  hardaker
+
+   * FAQ, README, sedscript.in, version.h, perl/SNMP/SNMP.pm:
+
+   - (version.h sedscript.in): version tag ( 4.2.4.pre2 )
+   
+2002-03-04 01:51  dts12
+
+   * local/mib2c:
+
+   Catch and report invalid node specifications.
+   (This ought to be handled by that test that follows immediately, but
+    "$SNMP::MIB{$oid}" appears to return the core mib-2 object regardless)
+   
+2002-03-04 01:16  dts12
+
+   * agent/mibgroup/ucd-snmp/memory.c:
+
+   Correct debug output message (thanks to Jeroen Ruigrok)
+   
+2002-03-01 22:37  hardaker
+
+   * snmplib/asn1.c:
+
+   fix bug #524529
+   
+2002-03-01 07:17  nba
+
+   * ltmain.sh, aclocal.m4, configure:
+
+   Pull in up-to-date libtool, which should help Darwin
+   
+2002-03-01 07:15  nba
+
+   * config.guess, config.sub:
+
+   Pull in up-to-date config scripts
+   
+2002-02-27 09:47  dts12
+
+   * snmplib/vacm.c:
+
+   Handle views that specify a full instance OID.
+   (Since the internally stored OID prepends the length as well,
+    the apparent length is one greater than it really is)
+   
+2002-02-26 14:18  nba
+
+   * snmplib/: parse.c, parse.h:
+
+   Save File/line for messages about unlinked OIDs
+   
+2002-02-25 15:46  nba
+
+   * mibs/: Makefile.mib, mibfetch:
+
+   Make sure that we fetch IANAifType-MIB from the maintained location.
+   
+2002-02-25 15:45  nba
+
+   * mibs/DISMAN-SCHEDULE-MIB.txt:
+
+   Update for RFC 3231
+   
+2002-02-25 08:59  nba
+
+   * mibs/rfclist:
+
+   New RFC's issued with mibs:
+   3201   CIRCUIT-IF-MIB
+   3202   FRSLD-MIB
+   3231   DISMAN-SCHEDULE-MIB
+   
+2002-02-25 08:57  nba
+
+   * agent/mibgroup/host/hr_disk.c:
+
+   FreeBSD4 has new disk names
+   
+2002-02-25 08:56  nba
+
+   * agent/mibgroup/host/hr_print.c:
+
+   Properly bracket run_lpstat prototype
+   
+2002-02-25 02:48  jbpn
+
+   * snmplib/parse.c:
+
+     - only copy the first DESCRIPTION clause of MODULE-COMPLIANCE
+       statements to avoid a memory leak (see bug #522363).
+   
+2002-02-25 01:21  dts12
+
+   * agent/snmpd.c:
+
+   Specify the correct debug token for displaying the list of modules
+   (spotted by Brian Shaver)
+   
+2002-02-22 09:27  dts12
+
+   * snmplib/: MSG00001.bin, winservice.mc ,
+   MSG00001.bin (1.1), winservice.mc (1.1):
+
+   Add missing files for Windows service operation.
+   
+2002-02-22 08:42  dts12
+
+   * agent/snmpd.c:
+
+   Just close the main session when shutting down under Windows,
+   not everything (so that it can still generate the shutdown trap).
+   
+2002-02-22 01:49  jbpn
+
+   * FAQ, README.win32:
+
+     - update comments on Win32 port in FAQ
+   
+     - discuss what IPHLPAPI.{LIB,DLL} is and where it can be obtained
+       from in README.win32
+   
+2002-02-21 07:02  dts12
+
+   * win32/snmpd/snmpd.dsp:
+
+   Fix bogus structure comments in the snmpd project file.
+   
+2002-02-21 03:13  jbpn
+
+   * agent/mibgroup/smux/smux.c:
+
+     - emit error on over-length password instead of writing off end of
+       buffer (bug #520649, noted by John Sellens).
+   
+2002-02-20 09:27  jbpn
+
+   * apps/snmptranslate.c, apps/snmptrapd.c,
+   snmplib/snmp_parse_args.c, snmplib/system.c, snmplib/system.h:
+
+     - changes to avoid namespace clash problems with setenv() which are
+       caused by libwrap supplying a function of that name as well as us.
+   
+     - all calls in the code to setenv() are replaced with a call to
+       snmp_setenv().
+   
+     - snmp_setenv() calls setenv() if such a function exists, otherwise
+       it simulates the effect by calling putenv().
+   
+2002-02-20 05:43  jbpn
+
+   * NEWS:
+
+     - mention tcp_wrappers support for snmptrapd
+   
+2002-02-20 05:41  jbpn
+
+   * apps/: Makefile.in, snmptrapd.c:
+
+     - add libwrap support for snmptrapd
+   
+2002-02-20 05:20  jbpn
+
+   * configure, configure.in:
+
+     - exit with an error if --with-libwrap is given and we can't find it
+   
+2002-02-20 03:00  jbpn
+
+   * apps/snmpdelta.c:
+
+     - initialise some buffers, to avoid garbage printing problems, as
+       noted by Anonymous in bug #520220.
+   
+2002-02-19 06:47  hardaker
+
+   * agent/mibgroup/ucd-snmp/memory.c:
+
+   Patch from Jeroen Ruigrok to merge a few ifdefs
+   
+2002-02-19 01:51  jbpn
+
+   * agent/auto_nlist.h:
+
+     - add forward declaration of struct nlist to avoid compiler
+       complaints.  Thanks to Andy Hood.
+   
+2002-02-18 08:17  hardaker
+
+   * agent/mibgroup/ucd-snmp/memory.c:
+
+   patch from Jeroen Ruigrok for minor ifdef clean ups
+   
+2002-02-18 02:36  jbpn
+
+   * apps/snmptrapd_log.c:
+
+     - use calloc instead of malloc to make sure buffer is initially
+       zero-terminated (in case of 0 varbinds).  Bug #518700, noted by
+       Andreas Hartmann.
+   
+2002-02-18 02:29  dts12
+
+   * agent/mibgroup/host/hr_storage.c:
+
+   Remove a couple of unhelpful OSF definitions (thanks to Jeroen Ruigrok)
+   
+2002-02-18 02:09  jbpn
+
+   * agent/mibgroup/: notification/snmpNotifyTable.c,
+   target/snmpTargetAddrEntry.c:
+
+     - remove troublesome inline qualifiers.  Thanks to Andy Hood for
+       noting that these cause problems on AIX.
+   
+2002-02-18 02:05  jbpn
+
+   * agent/mibgroup/mibII/at.c:
+
+     - remove //-style comments.  Thanks to Andy Hood for pointing this
+   out.
+   
+2002-02-18 00:13  hardaker
+
+   * snmplib/asn1.c:
+
+   don't build oid's with >128 length subids.  (see bug #518855)
+   
+2002-02-15 22:07  hardaker
+
+   * FAQ, README, sedscript.in, version.h, perl/SNMP/SNMP.pm:
+
+   - (version.h sedscript.in): version tag ( 4.2.4.pre1 )
+   
+2002-02-15 17:02  hardaker
+
+   * agent/mibgroup/snmpv3/usmUser.c:
+
+   fix bug#508126 which actually led me to another.
+     - oid parsing and searching in getnexts could sometimes loop.
+   
+2002-02-15 17:00  hardaker
+
+   * Makefile.top, configure, configure.in:
+
+   support --disable-shared-version concept from Paul Rasmussen.
+   
+2002-02-15 16:41  hardaker
+
+   * agent/mibgroup/host/hr_swrun.c:
+
+   dynix broke linux.  Bad dynix.  No bone.  Go to your room.
+   
+2002-02-15 16:28  hardaker
+
+   * snmplib/ucd-snmp-includes.h:
+
+   add back in netinet/in.h and sys/time.h (in proper protected form)
+   which was deleted from 4.2.3 for some reason we never figured out.
+   
+2002-02-15 16:21  hardaker
+
+   * ChangeLog, FAQ, NEWS, README:
+
+   updates for what will be 4.2.4
+   
+2002-02-15 15:52  hardaker
+
+   * agent/mibgroup/ucd-snmp/proxy.c:
+
+   check end of mibview conditions
+   
+2002-02-15 08:01  dts12
+
+   * agent/mibgroup/mibII/vacm_vars.c:
+
+   Populate an empty case statement (spotted by Jeroen Ruigrok)
+   
+2002-02-15 07:11  hardaker
+
+   * README.snmpv3:
+
+   remove unneeded -CN and -CO example options
+   
+2002-02-15 06:47  dts12
+
+   * agent/snmpd.c, snmplib/winservice.c, snmplib/winservice.h,
+   snmplib/winservice.rc, win32/snmpd/snmpd.dsp:
+
+   Support for running as a Windows service.
+   (Supplied by Raju Krishnappa & Latha Prabhu)
+   
+2002-02-14 11:11  nba
+
+   * agent/mibgroup/ucd-snmp/vmstat.c:
+
+   Make buffer pointer static so it doesn't leak
+   
+2002-02-14 11:10  nba
+
+   * snmplib/scapi.h:
+
+   Fix bad paranthesis
+   
+2002-02-14 07:40  hardaker
+
+   * agent/snmpd.c:
+
+   fix email address bug #517178
+   
+2002-02-14 01:47  dts12
+
+   * apps/snmpnetstat/if.c:
+
+   Check for running off the end of I/F table (patch from RedHat)
+   
+2002-02-14 01:44  dts12
+
+   * agent/mibgroup/host/hr_swinst.c:
+
+   Include RedHat patches for better RPM support
+   
+2002-02-14 01:38  dts12
+
+   * config.h.in, configure, configure.in:
+
+   Adopt RedHat's configure testing for rpm library requirements
+   
+2002-02-13 16:41  hardaker
+
+   * configure, configure.in:
+
+   enable shared by default except for developers
+   
+2002-02-13 13:51  hardaker
+
+   * agent/mibgroup/target/snmpTargetAddrEntry.c:
+
+   remove inline function from being declared in another function.
+   
+2002-02-13 13:27  hardaker
+
+   * agent/mibgroup/notification/snmpNotifyTable.c:
+
+   remove inline function from being declared in another function.
+   
+2002-02-13 08:18  hardaker
+
+   * perl/SNMP/SNMP.xs:
+
+   fix sets of unsigned32's.
+   
+2002-02-13 07:59  dts12
+
+   * snmplib/mib.c:
+
+   DS_LIB_PRINT_SUFFIX_ONLY is an integer option, not a boolean flag.
+   (Attempting to set this via the SUFFIX environmental variable will
+   turn on packet dumping instead!)
+   
+2002-02-13 04:15  jbpn
+
+   * agent/mibgroup/host/hr_print.c:
+
+     - fix bug #516904 (snmpd dies if no printcap with cgetent), noted by
+       Anonymous -- check return value of cgetnext() properly in
+       Init_HR_Print().
+   
+2002-02-12 07:11  jbpn
+
+   * configure.in, configure:
+
+     - amend fix to bug #516389 (ucd-snmp 4.2.3 libwrap support broken) to
+       actually add -lnsl to link parameters!
+   
+2002-02-12 05:29  jbpn
+
+   * configure, configure.in:
+
+     - fix bug #516389 (ucd-snmp 4.2.3 libwrap support broken) -- USE_LIBWRAP
+       was not being #defined in the case where -lnsl is needed in addition
+       to -lwrap.
+   
+2002-02-12 01:30  dts12
+
+   * agent/mibgroup/mibII/vacm_vars.c:
+
+   Implement the BadCommunity{Names,Uses} counters.
+   
+2002-02-11 10:07  jbpn
+
+   * apps/snmptable.c:
+
+     - fix bugs #489336 and #508146 (duplicate columns and columns in
+       wrong order).
+   
+2002-02-11 08:23  dts12
+
+   * snmplib/snmp_parse_args.c:
+
+   Use the 'ds_set_xxx' library routines, rather than the old 'snmp_set_xxx' calls
+   
+2002-02-11 05:30  jbpn
+
+   * FAQ:
+
+     - mention HPUX-11 and Dynix/PTX 4.4 support, and some spelling fixes
+   
+2002-02-08 06:12  dts12
+
+   * agent/mibgroup/mibII/sysORTable.h:
+
+   Ensure the null versions of the two REGISTER macros swallow their parameters.
+   
+2002-02-08 04:42  dts12
+
+   * agent/snmp_agent.c:
+
+   Implement the missing outgoing error statistics counters
+   (patch #510194 from Latha Prabhu)
+   
+2002-02-08 02:54  dts12
+
+   * agent/snmp_agent.c:
+
+   Process the full list objects in each pass of a SET, even if one entry fails
+   midway through.  This is less efficient than failing immediately, but brings
+   the behaviour in line with the documentation, and ensures that all resources
+   will be released.
+   
+2002-02-08 02:50  dts12
+
+   * agent/snmp_agent.c:
+
+   Return the correct error index for problems in SET handling.
+   (patch #467155, from Latha Prabhu)
+   
+2002-02-08 02:42  dts12
+
+   * agent/mibgroup/: host/hr_storage.c, ucd-snmp/memory.c:
+
+   Added support for memory and swap entries in hrStorageTable for Solaris
+   (from patch #505498 - thanks to Johannes Schmidt-Fischer)
+   
+2002-02-08 02:09  dts12
+
+   * agent/mibgroup/mibII/ip.c:
+
+   Register IP Routing table objects as writable.
+   
+2002-02-07 07:39  dts12
+
+   * README.hpux11, acconfig.h, config.h.in,
+   agent/mibgroup/ucd_snmp.h, agent/mibgroup/host/hr_network.c,
+   agent/mibgroup/host/hr_storage.c, agent/mibgroup/host/hr_swinst.c,
+   agent/mibgroup/host/hr_swrun.c, agent/mibgroup/mibII/at.c,
+   agent/mibgroup/mibII/icmp.c, agent/mibgroup/mibII/interfaces.c,
+   agent/mibgroup/mibII/interfaces.h, agent/mibgroup/mibII/ip.c,
+   agent/mibgroup/mibII/ipAddr.c, agent/mibgroup/mibII/tcp.c,
+   agent/mibgroup/mibII/tcpTable.c, agent/mibgroup/mibII/tcpTable.h,
+   agent/mibgroup/mibII/udp.c, agent/mibgroup/mibII/udpTable.c,
+   agent/mibgroup/mibII/var_route.c, agent/mibgroup/mibII/var_route.h,
+   agent/mibgroup/ucd-snmp/memory.c, mibs/UCD-SNMP-MIB.txt, s/hpux.h:
+
+   Support for HP-UX 11, courtesy of Johannes Schmidt-Fischer.
+   
+2002-02-05 11:45  hardaker
+
+   * COPYING:
+
+   copyright year update for NAI and Cambridge
+   
+2002-02-04 03:17  jbpn
+
+   * snmplib/mib.c:
+
+     - correct processing for timeticks when DS_LIB_NUMERIC_TIMETICKS is
+       set (corrects bug #511793, reported by Anonymous).
+   
+2002-01-28 12:50  hardaker
+
+   * FAQ:
+
+   mirror section update
+   
+2002-01-28 12:49  hardaker
+
+   * agent/agent_trap.h:
+
+   warning added about send_trap_vars and enterprise oid used.
+   
+2002-01-25 06:27  jbpn
+
+   * agent/mibgroup/mibII/vacm_vars.c:
+
+     - fix minor problem with storageType (always okay to set to current
+       value).
+   
+     - don't reset some variables to old value unless we actually set
+       them in the first place!
+   
+2002-01-24 06:06  jbpn
+
+   * snmplib/read_config.c:
+
+     - avoid format string nasties in read_config_store() when writing to
+       files (exposed e.g. by the persistent sysName.0 stuff -- try
+       snmpset host sysName.0 s "%08x" -- oops)
+   
+2002-01-24 03:14  dts12
+
+   * agent/mibgroup/host/hr_swrun.c, agent/mibgroup/host/hr_utils.c,
+   s/aix.h:
+
+   AIX support for Host Resources module.
+       (Thanks to Andy Hood)
+   
+2002-01-23 08:39  jbpn
+
+   * agent/mibgroup/mibII/vacm_vars.c:
+
+     - set viewType to the DEFVAL included(1) for new rows
+   
+2002-01-22 06:36  jbpn
+
+   * agent/mibgroup/mibII/vacm_vars.c:
+
+     - fix bug just introduced where setting an existing row's status to
+       createAndGo(4) or createAndWait(5) would delete the row.
+   
+2002-01-22 04:22  jbpn
+
+   * agent/mibgroup/: notification/snmpNotifyTable.c,
+   target/snmpTargetAddrEntry.c, target/snmpTargetAddrEntry.h,
+   target/snmpTargetParamsEntry.c, target/snmpTargetParamsEntry.h:
+
+     - backport of recent improvements to snmpTargetParamsTable,
+       snmpTargetAddrTable and snmpNotifyTable.
+   
+2002-01-21 04:22  jbpn
+
+   * agent/snmp_vars.c:
+
+     - set noSuchObject to FALSE if we have a valid write_method (this
+       causes the correct exception noSuchInstance to be generated if the
+       requested object doesn't exist).
+   
+2002-01-21 04:20  jbpn
+
+   * agent/snmp_agent.c:
+
+     - slight change to generation of error-index:
+   
+       - explicitly test for error-status == noError, and set error-index
+         to zero in this case;
+   
+       - otherwise use the cached value;
+   
+       - don't zero the cached value in handle_var_list if handle_one_var
+         returns noError
+   
+     - this copes properly with SET requests, where a failing SET will have
+       a FREE phase which will typically return noError.  Previously this
+       would erroneously cause the error-index to be set to zero.
+   
+2002-01-21 04:11  jbpn
+
+   * agent/mibgroup/mibII/vacm_vars.c, snmplib/vacm.c, snmplib/vacm.h:
+
+     - backport of recent vacmSecurityToGroupTable, vacmAccessTable and
+       vacmViewTreeFamilyTable changes (corrected state machines).
+       Before: passed 20,  failed 80, untested 11
+       After:  passed 107, failed 1,  untested 3
+   
+       The still-extant failures are due to the non-implemented
+       vacmContextTable.
+   
+2002-01-15 12:44  nba
+
+   * agent/snmp_vars.c:
+
+   Fix stupid missing sizeof(oid) factor in memcpy
+   
+2002-01-15 12:42  nba
+
+   * agent/mibgroup/ucd-snmp/vmstat.c:
+
+   Dont use static buffer when reading /proc/stat
+   
+2002-01-15 12:41  nba
+
+   * agent/mibgroup/host/hr_system.c, s/solaris2.6.h, s/solaris2.7.h,
+   s/solaris2.8.h:
+
+   Fix hrMaxProcesses for Solaris
+   
+2002-01-15 12:39  nba
+
+   * agent/mibgroup/kernel_sunos5.c:
+
+   Some additional debug statements
+   
+2002-01-09 08:27  nba
+
+   * agent/mibgroup/: kernel_sunos5.c, kernel_sunos5.h:
+
+   Add function to acces raw kstat data
+   
+2002-01-09 08:26  nba
+
+   * agent/mibgroup/host/hr_storage.c:
+
+   Use that sysconf returns a long, to save large phys mem
+   
+2002-01-09 08:24  nba
+
+   * mibs/IANAifType-MIB.txt:
+
+   Update to current IANA version
+   
+2002-01-09 08:23  nba
+
+   * agent/mibgroup/mibII/interfaces.c:
+
+   Care for Linux drivers that maintain octet couters as log long values
+   
+2002-01-09 02:20  jbpn
+
+   * FAQ:
+
+     - add OS X to list of supported OSes, to fix bug #501179 (!)
+   
+2002-01-03 14:01  hardaker
+
+   * agent/mibgroup/ucd-snmp/disk.c:
+
+   fix bug #498809 (I think) by checking setmntent return value.
+   
+2002-01-03 13:52  hardaker
+
+   * apps/snmpnetstat/if.c:
+
+   check against growing server returns as pointed out by bug #498956
+   
+2001-12-18 08:49  jbpn
+
+   * acconfig.h, win32/config.h, win32/config.h.borland:
+
+     - add OSTYPE define for win32
+   
+2001-12-18 08:44  jbpn
+
+   * mibs/UCD-SNMP-MIB.txt:
+
+     - add OBJECT IDENTIFIER for win32 agent
+   
+2001-12-18 06:50  jbpn
+
+   * agent/mibgroup/mibII/system_mib.c:
+
+     - patch from Latha Prabhu to produce more meaningful sysDescr.0
+       strings for Microsoft platforms.
+   
+2001-12-05 07:48  hardaker
+
+   * perl/SNMP/SNMP.xs:
+
+   patch from Jason Gloudon to fix leaking session structures from snmp_timeout().
+   
+2001-12-03 14:52  nba
+
+   * acconfig.h, config.h.in, configure, configure.in:
+
+   Complete the BSD IPSTATS configure tests, as pointed out by Mark Moraes
+   (bug# 487708)
+   
+2001-11-29 16:54  hardaker
+
+   * ChangeLog:
+
+   4.2.3 changes
+   
+-------------------------------------------------------------------------------
+
+Changes: V4.2.2 -> V4.2.3
+	
+2001-11-29 14:22  hardaker
+
+   * FAQ, README, sedscript.in, version.h, perl/SNMP/SNMP.pm:
+
+   - (version.h sedscript.in): version tag ( 4.2.3 )
+   
+2001-11-29 13:25  nba
+
+   * agent/mibgroup/kernel_sunos5.c:
+
+   Solaris 8 renamed the kstat ifspeed attribute to ifSpeed and somewhere
+   along the line changed its value from Mbps tp bps
+   
+2001-11-28 14:43  hardaker
+
+   * NEWS:
+
+   mention improved irix support.
+   
+2001-11-28 14:31  hardaker
+
+   * s/irix.h:
+
+   last fixes for irix I think
+   
+2001-11-28 14:30  hardaker
+
+   * agent/mibgroup/mibII/interfaces.c:
+
+   create islands in the stream
+   
+2001-11-28 14:09  hardaker
+
+   * s/irix.h:
+
+   irix fixes for broken irix headers
+   
+2001-11-27 17:05  hardaker
+
+   * perl/SNMP/SNMP.pm:
+
+   version stamp (4.2.3.pre1 (opps))
+   
+2001-11-27 17:05  hardaker
+
+   * agent/mibgroup/versiontag:
+
+   fix for version stamping the perl module.
+   
+2001-11-27 17:03  hardaker
+
+   * NEWS:
+
+   update for 4.2.3
+   
+2001-11-27 11:09  hardaker
+
+   * win32/win32.dsw:
+
+   use at own risk patch from Harrie to fix dependancies
+   
+2001-11-27 06:53  jbpn
+
+   * agent/mibgroup/host/hr_system.c:
+
+     - try harder to get hrSystemMaxProcesses.0 right, drawing on patch
+       #485765, submitted by Johannes Schmidt-Fischer, for Linux, and
+       also using sysctl() more widely.
+   
+2001-11-27 06:51  jbpn
+
+   * configure.in, s/linux.h:
+
+     - Look for <linux/tasks.h>, in order to give a better value for
+       hrSystemMaxProcesses.0.  From patch #485765, submitted by
+       Johannes Schmidt-Fischer.
+   
+2001-11-27 03:56  jbpn
+
+   * agent/mibgroup/mibII/: kernel_linux.c, kernel_linux.h, tcp.c:
+
+     - give correct values for tcpInErrs.0 and tcpOutRsts.0 under Linux
+       if the kernel makes the data available.  From patch #485765,
+       submitted by Johannes Schmidt-Fischer.
+   
+2001-11-26 09:51  jbpn
+
+   * testing/tests/T110agentxget:
+
+     - longer timeout for initial GET (fix spurious test failures)
+   
+2001-11-21 10:49  hardaker
+
+   * FAQ:
+
+   help update to remove the support database
+   
+2001-11-21 04:53  jbpn
+
+   * agent/mibgroup/ucd-snmp/disk.c:
+
+     - fix compilation for Ultrix 4.5 (bug # 415197) -- make sure
+       vfs.f_bsize exists in var_extensible_disk(), and default it to
+       1024.
+   
+2001-11-20 02:27  jbpn
+
+   * snmplib/snmp_api.h:
+
+     - remove duplicate definition of SNMP_MAX_SEC_NAME_SIZE, noted by
+       Karl M. Hegbloom.
+   
+2001-11-19 05:48  jbpn
+
+   * man/snmpd.conf.5.def:
+
+     - documentation of ignoredisk directive.
+   
+2001-11-19 05:48  jbpn
+
+   * agent/mibgroup/host/: hr_disk.c, hr_disk.h, hr_partition.c,
+   hr_partition.h:
+
+     - patch from Johannes Schmidt-Fischer to add directive "ignoredisk" to
+       skip certain devices (and hence avoid the `snmpwalk times out' type
+       problems frequently reported).  Also extends search ranges to cope with
+       larger numbers of disks etc.
+   
+2001-11-16 05:31  jbpn
+
+   * apps/snmptest.c:
+
+     - add support for Unsigned32/Gauge32 types
+   
+2001-11-16 03:21  jbpn
+
+   * agent/mibgroup/mibII/var_route.c:
+
+     - more const-ness in qsort_compare => fewer warnings
+   
+2001-11-16 02:54  jbpn
+
+   * apps/snmpnetstat/if.c:
+
+     - patch from Harrie Hazewinkel to add prototypes for timerSet() and
+       timerPause().
+   
+2001-11-16 02:52  jbpn
+
+   * agent/snmpd.c:
+
+     - patch from Harrie Hazewinkel to #include <grp.h> if we have it
+   
+2001-11-16 02:47  jbpn
+
+   * agent/mibgroup/notification/snmpNotifyTable.c:
+
+     - patch from Harrie Hazewinkel to return a value from
+       notifyTable_unregister_notifications() to avoid warnings
+   
+2001-11-16 02:45  jbpn
+
+   * agent/mibgroup/mibII/var_route.c:
+
+     - patch from Harrie Hazewinkel to make signature of qsort_compare
+       function match that expected by qsort(3) -- adds const to args.
+   
+2001-11-16 02:40  jbpn
+
+   * snmplib/mib.c:
+
+     - patch from Harrie Hazewinkel to make definition of print_tree_node
+       static to match forward declaration.
+   
+2001-11-15 10:03  jbpn
+
+   * agent/mibgroup/agentx/protocol.c:
+
+     - stricter test for null OIDs
+   
+2001-11-15 09:24  jbpn
+
+   * agent/mibgroup/kernel_sunos5.c:
+
+     - fix bad-looking expression which was causing problems described in
+       email titled "Defect report on UCD SNMP toolkit (crash in
+       kernel_sunos5.c)" sent to net-snmp-users on 2001-07-17.
+   
+2001-11-15 08:33  jbpn
+
+   * man/snmpd.conf.5.def:
+
+     - document read-only nature of snmpEnableAuthenTraps.0 if value is
+       configured via the authtrapenable token
+   
+2001-11-15 08:28  jbpn
+
+   * agent/: agent_read_config.c, agent_trap.c,
+   mibgroup/mibII/snmp_mib.c:
+
+     - make value of snmpEnableAuthenTraps.0 persistent.  Setting via
+       a read-only configuration file also makes object notWritable (as
+       sysContact.0 et al.).
+   
+2001-11-15 05:16  jbpn
+
+   * testing/tests/: T111agentxset, T121proxyset:
+
+     - use psyscontact not syscontact to set initial value of sysContact.0
+       object since the latter also makes the object read-only.
+   
+2001-11-15 05:07  jbpn
+
+   * agent/snmpd.c:
+
+     - minor fix to formatting of usage message
+   
+2001-11-14 17:54  hardaker
+
+   * FAQ, README, sedscript.in, version.h:
+
+   - (version.h sedscript.in): version tag ( 4.2.3.pre1 )
+   
+2001-11-14 17:42  hardaker
+
+   * snmplib/snmp.h:
+
+   numeric comments in both hex and decimal
+   
+2001-11-14 17:41  hardaker
+
+   * perl/SNMP/SNMP.xs:
+
+   include INTEGER32 in INTEGER case checking.
+   
+2001-11-14 17:31  hardaker
+
+   * agent/mibgroup/versiontag:
+
+   version tag perl/SNMP/SNMP.pm with the ucd-snmp version number.
+   
+2001-11-14 16:30  hardaker
+
+   * man/snmpd.conf.5.def:
+
+   mention snmpconf.
+   
+2001-11-14 16:06  hardaker
+
+   * configure, configure.in:
+
+   patch from Harrie to fix init function checking in modules
+   
+2001-11-14 11:58  hardaker
+
+   * agent/: agent_callbacks.h, agent_read_config.c,
+   mibgroup/notification/snmpNotifyTable.c:
+
+   - make a new callback for pre-update-config conditions.
+   - make the snmpNotifyTable make use of it to remove "readOnly" entries
+     which should have been generated via configuration parsing.
+     - note that this doesn't remove the generated target entries, which
+       is not ideal, but at least duplicate traps aren't sent.
+   
+2001-11-13 11:13  hardaker
+
+   * agent/mibgroup/kernel_sunos5.c:
+
+   Patch from Jochen Kmietsch to look for eri interfaces.
+   
+2001-11-13 05:24  jbpn
+
+   * agent/mibgroup/ucd-snmp/vmstat_solaris2.c:
+
+     - patch from Jochen Kmietsch to quieten some noisy logging
+   
+2001-11-12 23:14  hardaker
+
+   * snmplib/: asn1.c, mib.c:
+
+   MS C++ warning fixes from Harrie Hazewinkel
+   
+2001-11-11 21:48  nba
+
+   * snmplib/system.c, win32/config.h:
+
+   Restore the old value od TIME_WITH_SYS_TIME
+   
+2001-11-09 12:21  hardaker
+
+   * FAQ:
+
+   Added a germany based mirror
+   
+2001-11-09 11:21  hardaker
+
+   * FAQ:
+
+   mention new mirror
+   
+2001-11-09 11:20  hardaker
+
+   * configure, config.h.in, configure.in:
+
+   applied english/typo/changes noted in bug #471179
+   
+2001-11-09 09:08  hardaker
+
+   * snmplib/snmp_api.c:
+
+   fix bug 479365: use strncpy in snmp_add_var().
+   
+2001-11-09 07:53  hardaker
+
+   * win32/config.h:
+
+   fix bug #474488: add extern C wrappers
+   
+2001-11-09 07:47  hardaker
+
+   * man/snmpd.conf.5.def:
+
+   fix OIDs to include entry node
+   
+2001-11-08 09:43  hardaker
+
+   * mibs/UCD-SNMP-MIB.txt:
+
+   UNIT specs for the fileTable to say kB explicitly
+   
+2001-11-08 09:42  hardaker
+
+   * man/snmpd.conf.5.def:
+
+   mention that the fileTable is in kB.
+   
+2001-11-06 08:26  hardaker
+
+   * local/: mib2c, tkmib:
+
+   add fixes to check for the SNMP and Tk perl modules and print a better
+   error message if they're not available telling users how to get them.
+   
+2001-11-06 08:16  hardaker
+
+   * snmplib/asn1.c:
+
+   fix asn_build_bitstring to check for NULL values (pointed out by Tata Kalyan).
+   
+2001-11-06 07:57  hardaker
+
+   * snmplib/asn1.c:
+
+   length check fixed for wrapped addition.  Bug pointed out by Tata Kalyan
+   
+2001-10-30 21:42  hardaker
+
+   * snmplib/: default_store.h, read_config.c, read_config.h:
+
+   patch from Harrie to make paths more configurable from within C code.
+   
+2001-10-30 07:14  jbpn
+
+   * agent/mibgroup/mibII/interfaces.c:
+
+     - fix bug whereby interface counter is not reset, noted by (amongst
+       others) Victor Kirhenshtein in patch #474064.
+   
+2001-10-26 09:08  hardaker
+
+   * configure, configure.in:
+
+   patch from Harrie to fix agentx/client -> agentx/subagent help message
+   
+2001-10-26 03:34  jbpn
+
+   * man/snmpd.conf.5.def:
+
+     - document the fact that setting sysLocation.0 (et al.) via a
+       syslocation (or equivalent) token makes the object read-only,
+       returning a notWritable error response if an attempt is made to
+       SET it.
+   
+2001-10-24 10:08  jbpn
+
+   * agent/mibgroup/mibII/system_mib.c:
+
+     - fix typo noted by Tim Dietz
+   
+2001-10-24 09:54  jbpn
+
+   * agent/mibgroup/mibII/: system_mib.c, system_mib.h:
+
+     - implement persistence for sysLocation.0, sysContact.0 and sysName.0
+   
+     - presence of a syslocation token in snmpd.conf makes sysLocation.0
+       non-writable (returns notWritable on SET attempts)
+   
+2001-10-24 05:08  jbpn
+
+   * agent/mibgroup/host/hr_swinst.c:
+
+     - fix small memory leak just introduced
+   
+2001-10-24 03:33  jbpn
+
+   * acconfig.h, configure.in:
+
+     - autoconf support for detecting pkginfo interface in libadm.  Thanks
+       to Stefan Radman (patch #473669).
+   
+2001-10-24 03:30  jbpn
+
+   * agent/mibgroup/host/hr_swinst.c:
+
+     - use pkginfo interface to determine type of software package more
+       specifically if possible.  Slight variation on patch #473669, submitted
+       by Stefan Radman.
+   
+2001-10-17 07:52  dts12
+
+   * FAQ:
+
+   Mention the MRTG tutorial web pages
+     (as suggested by Christian Robottom Reis)
+   
+2001-10-08 10:56  hardaker
+
+   * FAQ, README, sedscript.in, version.h:
+
+   - (version.h sedscript.in): version tag ( 4.2.2 )
+
+-------------------------------------------------------------------------------
+
+Changes: V4.2.1 -> V4.2.2
+	
+2001-10-08 10:47  hardaker
+
+   * agent/mibgroup/notification/: snmpNotifyFilterProfileTable.c,
+   snmpNotifyFilterTable.c, snmpNotifyTable.c:
+
+   Apply patches suggested in bug #469082 to fix illegal row creations
+   when rowstatus is set to destroy.
+   
+2001-10-06 07:49  hardaker
+
+   * FAQ:
+
+   minor tweaks to the download list.
+   
+2001-10-06 07:42  hardaker
+
+   * README:
+
+   Add David Lawrence's text about contributing patches.
+   
+2001-10-05 18:09  hardaker
+
+   * FAQ, README, sedscript.in, version.h:
+
+   - (version.h sedscript.in): version tag ( 4.2.2.pre6 )
+   
+2001-10-05 18:01  hardaker
+
+   * acconfig.h, config.h.in, configure, configure.in,
+   snmplib/mt_support.c, snmplib/mt_support.h:
+
+   Change _REENTRANT define to NS_REENTRANT to not conflict with BSD/OS 4.3.
+   
+2001-10-05 17:39  hardaker
+
+   * agent/mibgroup/mibII/at.h, agent/mibgroup/mibII/icmp.c,
+   agent/mibgroup/mibII/interfaces.c, s/irix.h:
+
+   irix specific fixes mentioned in bug #405454
+   
+2001-10-05 17:22  hardaker
+
+   * agent/mibgroup/mibII/var_route.c:
+
+   fix #440808 possibly overwriting a oid buffer.
+   
+2001-10-05 16:59  hardaker
+
+   * local/mib2c.vartypes.conf:
+
+   fix unsigned32 return variable usage
+   
+2001-10-05 16:51  hardaker
+
+   * agent/mibgroup/mibII/at.c:
+
+   move arptab_current and arptab_size definitions up out of ifdef mess.
+   
+2001-10-05 16:47  hardaker
+
+   * agent/mibgroup/notification/: snmpNotifyFilterProfileTable.c,
+   snmpNotifyFilterTable.c, snmpNotifyTable.c:
+
+   don't create rowstatus entries with 'destroy' as initial value.
+   
+2001-10-05 16:36  hardaker
+
+   * agent/mibgroup/notification/: snmpNotifyFilterProfileTable.c,
+   snmpNotifyFilterTable.c, snmpNotifyTable.c:
+
+   fixed UNDO clauses.
+   
+2001-10-05 08:50  hardaker
+
+   * agent/mibgroup/ucd-snmp/dlmod.c, snmplib/snmp_api.c:
+
+   Patch from Harrie for picky compilers.
+   
+2001-10-05 08:49  hardaker
+
+   * agent/agent_trap.c:
+
+   better error description for trapsess
+   
+2001-10-05 08:49  hardaker
+
+   * FAQ:
+
+   Added mirror sites.
+   
+2001-10-05 07:10  hardaker
+
+   * mibs/: SMUX-MIB.txt, UCD-SNMP-MIB.txt:
+
+   MIB problems pointed out by Marek Malowidziki
+   
+2001-10-04 17:09  hardaker
+
+   * snmplib/snmp_auth.c:
+
+   Don't write a null past the end of the community string buffer.
+   
+2001-10-04 07:14  hardaker
+
+   * README, local/snmpconf.dir/snmpd.conf/extending,
+   man/snmpd.conf.5.def:
+
+   Patch from T. J. Mather: Documentation of the pass_persist snmpd.conf token.
+   
+2001-10-04 07:14  hardaker
+
+   * local/pass_persisttest:
+
+   Patch from T. J. Mather: An example (perl) pass_persist script.
+   
+2001-10-04 02:21  jbpn
+
+   * agent/snmpd.c:
+
+     - disable stderr logging (if requested) before calling init_mib_modules().
+       This should fix the problem noted by Nigel Metheringham in bug #418857
+       whereby the AgentX master module prints a message to stderr which causes
+       a SIGPIPE when the agent is started as a daemon.
+   
+       Also noted with extensive analysis by Ted Rule in bug #467551.
+   
+2001-10-03 11:22  hardaker
+
+   * FAQ, README, sedscript.in, version.h:
+
+   - (version.h sedscript.in): version tag ( 4.2.2.pre5 )
+   
+2001-10-03 11:16  hardaker
+
+   * apps/snmptrapd.c, apps/snmptrapd_log.c, snmplib/mib.c,
+   snmplib/tools.c:
+
+   proper const casting in front of Markku's casting patch.
+   
+2001-10-03 11:10  hardaker
+
+   * apps/snmptrapd.c, apps/snmptrapd_log.c, snmplib/asn1.c,
+   snmplib/mib.c, snmplib/tools.c:
+
+   Patch: proper casts for picky compilers from Markku Laukkanen.
+   
+2001-10-03 09:22  hardaker
+
+   * snmplib/snmp_api.c:
+
+   don't rbuild beyond the end of a buffer (needed buffer + length "- 1").
+   
+2001-10-03 05:38  jbpn
+
+   * snmplib/keytools.c:
+
+     - change expression at l. 415 from:
+   
+           *kcstring++ = *kcstring ^ *newkey++;
+   
+       which has undefined behaviour to:
+   
+           *kcstring++ ^= *newkey++;
+   
+       which is okay (since *kcstring is only evaluated once).  Similarly
+       at l. 530.  The previous constructs cause warnings with GCC3 and
+       some other compilers.  Thanks to Niel Markwick who noted this in
+       bug #465969.
+   
+2001-10-02 18:01  hardaker
+
+   * agent/agent_trap.c:
+
+   Change oid lengths to size_t from int (segfaults on an alpha/linux).
+   
+2001-10-02 17:46  hardaker
+
+   * agent/mibgroup/ucd-snmp/memory_solaris2.c:
+
+   Add prototype for getTotalSwap().
+   
+2001-10-02 17:15  hardaker
+
+   * agent/mibgroup/target/: snmpTargetAddrEntry.c,
+   snmpTargetParamsEntry.c:
+
+   return NOT_WRITABLE instead of READONLY as pointed out by
+   arajesh@india.adventnet.com.
+   
+2001-10-02 17:03  hardaker
+
+   * win32/config.h:
+
+   Patch from Marc Moeller to define snprintf as _snprintf
+   
+2001-10-02 17:02  hardaker
+
+   * agent/mibgroup/host/hr_print.c:
+
+   Patch from Marc Moeller to check for HAVE_LPSTAT before calling it.
+   
+2001-10-02 17:00  hardaker
+
+   * README:
+
+   add Ron.
+   
+2001-10-02 17:00  hardaker
+
+   * snmplib/system.c:
+
+   get_uptime() implementation for windows from Ron Mevissen.
+   
+2001-10-01 17:38  hardaker
+
+   * FAQ, README, sedscript.in, version.h:
+
+   - (version.h sedscript.in): version tag ( 4.2.2.pre4 )
+   
+2001-10-01 17:38  hardaker
+
+   * agent/Makefile.in, agent/mibgroup/Makefile.in, apps/Makefile.in,
+   apps/snmpnetstat/Makefile.in, snmplib/Makefile.in,
+   testing/Makefile.in:
+
+   make makefileindepend
+   
+2001-10-01 17:37  hardaker
+
+   * makefileindepend.pl:
+
+   translate .o -> .lo by hand.
+   
+2001-10-01 17:07  hardaker
+
+   * agent/mibgroup/host/: hr_disk.c, hr_print.c:
+
+   Applied patch #465545 to fix delays in host resources mib when looking
+   at devices and printers.
+   
+2001-10-01 16:45  hardaker
+
+   * ChangeLog, NEWS:
+
+   New stuff in 4.2.2
+   
+2001-10-01 16:39  hardaker
+
+   * apps/snmpwalk.c, man/snmpwalk.1:
+
+   make snmpwalk default to detecting illegal OID increases.  -Cc turns
+   it off instead of on.
+   
+2001-10-01 10:36  hardaker
+
+   * COPYING:
+
+   editing tweaks by John to count things properly.  Wes looses the
+   ability to count beyond the number 2.
+   
+2001-10-01 10:26  hardaker
+
+   * COPYING:
+
+   ditto.
+   
+2001-10-01 10:22  hardaker
+
+   * COPYING:
+
+   Various copyright updates.
+   
+2001-10-01 02:52  jbpn
+
+   * snmplib/scapi.c:
+
+     - add #include "snmp_logging.h" to avoid compilation problems on
+       some platforms introduced by new error messages. See:
+       <URL:http://sourceforge.net/tracker/index.php?func=detail&aid=465807&group_id=12694&atid=112694>
+   
+2001-09-29 06:06  nba
+
+   * snmplib/mib.h:
+
+   Add a missing prototype for snmp_realloc_by_type
+   
+2001-09-29 06:05  nba
+
+   * agent/mibgroup/ucd-snmp/memory_solaris2.h:
+
+   Fix a bad #ifdef parantheses
+   
+2001-09-26 10:21  hardaker
+
+   * agent/mibgroup/smux/smux.c:
+
+   smux is *not* a proper delegation subagent.
+   
+2001-09-25 12:46  hardaker
+
+   * FAQ, README, sedscript.in, version.h:
+
+   - (version.h sedscript.in): version tag ( 4.2.2.pre3 )
+   
+2001-09-25 11:51  hardaker
+
+   * snmplib/: scapi.c, scapi.h:
+
+   Better error messages when encryption support isn't available.
+   
+2001-09-25 07:59  jbpn
+
+   * apps/snmptrapd_log.c:
+
+     - reinstate another space that would make the test suite fail
+   
+2001-09-25 07:53  jbpn
+
+   * apps/snmptrapd_log.c:
+
+     - reinstate a missing space
+   
+2001-09-25 05:43  jbpn
+
+   * apps/: snmptrapd.c, snmptrapd_log.c, snmptrapd_log.h:
+
+     - incorporate rewritten output functions from main branch to avoid
+       fixed length buffers
+   
+2001-09-25 05:41  jbpn
+
+   * snmplib/scapi.c:
+
+     - use relocating buffer version of sprint functions
+   
+2001-09-25 05:40  jbpn
+
+   * snmplib/: mib.c, mib.h, parse.h:
+
+     - add relocating buffer code from main branch
+   
+2001-09-25 05:39  jbpn
+
+   * snmplib/: tools.c, tools.h:
+
+     - add snmp_realloc() and snmp_strcat functions which the relocating
+       buffer code uses
+   
+2001-09-21 17:16  hardaker
+
+   * agent/mibgroup/mibII/interfaces.c:
+
+   Patch from Glenn Mansfield to fix interface counting on interfaces
+   without ip addresses.
+   
+2001-09-20 12:47  hardaker
+
+   * agent/mibgroup/util_funcs.c:
+
+   check skip_white() return (as mentioned in patch #462201).
+   
+2001-09-20 11:30  hardaker
+
+   * snmplib/mib.c:
+
+   fixed a possible buffer overflow bug in sprint_asciistring as pointed
+   out by bug #463226.
+   
+2001-09-20 09:46  hardaker
+
+   * configure, configure.in:
+
+   Don't warn about missing openssl unless explicitly asked (and then error).
+   
+2001-09-20 09:12  jbpn
+
+   * agent/: snmp_vars.c, mibgroup/mibII/interfaces.c:
+
+     - move headers around to fix compilation on Solaris 2.7; sys/stream.h
+       needs to be included before sys/socketvar.h for this platform.
+   
+2001-09-20 09:09  jbpn
+
+   * agent/mibgroup/ucd-snmp/memory_solaris2.c:
+
+     - remove #include "system.h" which uses the type in_addr_t thereby
+       causing problems, and seems to be unnecessary anyway.
+   
+2001-09-20 06:59  hardaker
+
+   * README:
+
+   Make sure Harrie's name is in the patches README as well as the mainline.
+   
+2001-09-20 06:58  hardaker
+
+   * snmplib/: default_store.c, mib.c, parse.c, snmp_api.c,
+   snmp_client.c, snmp_debug.c, snmpusm.c:
+
+   Patch from Harrie Hazewinkel:
+     - proper prototypes for some functions.
+   
+2001-09-19 17:19  hardaker
+
+   * FAQ, README, sedscript.in, version.h:
+
+   - (version.h sedscript.in): version tag ( 4.2.2.pre2 )
+   
+2001-09-19 17:01  hardaker
+
+   * FAQ, README, sedscript.in, version.h:
+
+   - (version.h sedscript.in): version tag ( 4.2.2.pre1 )
+   
+2001-09-19 16:59  hardaker
+
+   * FAQ, README, sedscript.in, version.h:
+
+   - (version.h sedscript.in): version tag ( 4.2.2 )
+   
+2001-09-18 17:22  hardaker
+
+   * man/snmpcmd.1, snmplib/mib.c, snmplib/snmp_api.c:
+
+   Undo Niels' change to allow command line options to override .conf
+   files.  Right goal, wrong branch to do it in as it broke SNMPv3 among
+   other things.  The initialization process is rather sensitive to
+   ordering.
+   
+2001-09-18 15:08  nba
+
+   * s/darwin.h:
+
+   Fix an oversight in the Darwin patch
+   
+2001-09-18 15:08  nba
+
+   * aclocal.m4, configure, configure.in:
+
+   Fix an oversight in the Darwin patches
+   
+2001-09-17 09:00  nba
+
+   * s/darwin.h:
+
+   The darwin system file, which I forgot when committing the rest of
+   the darwin patch.
+   
+2001-09-17 07:07  hardaker
+
+   * config.h.in:
+
+   autoheader run
+   
+2001-09-17 04:13  nba
+
+   * apps/snmptrapd.c:
+
+   Fix newlines inside usage string.
+   
+2001-09-16 14:56  nba
+
+   * agent/: snmpd.c, mibgroup/smux/smux.c:
+
+   Move the smux_listen_sd variable to smux.c. This way it will be in the
+   library so the linker wont be upset when you link with the agent library.
+   
+2001-09-16 14:52  nba
+
+   * agent/mibgroup/ucd-snmp/memory_netbsd1.h,
+   agent/mibgroup/ucd-snmp/vmstat_netbsd1.c, s/openbsd.h:
+
+   Patches for OpenBSD 2.9
+   
+2001-09-16 14:49  nba
+
+   * agent/mibgroup/ucd-snmp/diskio.c:
+
+   diskio support for FreeBSD4. Thanks to Yimin Ge
+   
+2001-09-16 14:16  nba
+
+   * aclocal.m4, configure, configure.in, agent/agent_read_config.c,
+   agent/snmp_vars.c, agent/mibgroup/ucd_snmp.h,
+   agent/mibgroup/host/hr_storage.c, agent/mibgroup/host/hr_swrun.c,
+   agent/mibgroup/mibII/interfaces.c,
+   agent/mibgroup/ucd-snmp/memory_freebsd2.c,
+   agent/mibgroup/ucd-snmp/memory_freebsd2.h,
+   agent/mibgroup/ucd-snmp/vmstat_freebsd2.c:
+
+   Patches to support Darwin (Mac OS/X)
+   Thanks to Tex Clayton <tex@dartware.com>
+   
+2001-09-16 14:03  nba
+
+   * agent/: agent_index.c, agent_registry.c, mibgroup/mibincl.h,
+   mibgroup/util_funcs.c, mibgroup/examples/example.c,
+   mibgroup/mibII/icmp.c, mibgroup/mibII/ip.c,
+   mibgroup/mibII/ipAddr.c, mibgroup/mibII/sysORTable.c,
+   mibgroup/mibII/tcp.c, mibgroup/mibII/tcpTable.c,
+   mibgroup/mibII/udp.c, mibgroup/ucd-snmp/proxy.c:
+
+   Header rearrangements to make BSD's happy after the WIN32 patch
+   
+2001-09-15 06:08  jbpn
+
+   * snmplib/asn1.c:
+
+     - add missing argument to snprintf (errpre corresponding to %s) --
+       it was missing from the patch (#452027)
+   
+2001-09-14 17:29  hardaker
+
+   * perl/SNMP/SNMP.xs:
+
+   - debugging compilation fixes
+   
+2001-09-14 17:26  hardaker
+
+   * local/tkmib:
+
+   many needed changes from mainline merged into patches branch
+   
+2001-09-14 15:24  hardaker
+
+   * snmplib/asn1.c:
+
+   Patch #452027 from Marcus Meissner:
+     security fix to make sure that long asn lengths can't be used and
+     aren't improperly cased to a signed value.
+   
+2001-09-14 14:23  hardaker
+
+   * configure, configure.in:
+
+   patch #432982 from Hollis: fix --with-libwrap without a path option
+   
+2001-09-14 13:58  nba
+
+   * agent/mibgroup/: kernel_sunos5.c, mibII/udpTable.c:
+
+   Solaris support for udpTable.
+   Thanks to Johannes Schmidt-Fischer <jsf@InterFace-AG.com>
+   
+2001-09-14 09:53  hardaker
+
+   * snmplib/ucd-snmp-includes.h:
+
+   from patch #423466: add ability to use this file within the source tree
+   
+2001-09-14 09:48  hardaker
+
+   * win32/config.h.borland:
+
+   Added config.h file for borland compilers (which differs slightly).
+     From patch #423466
+   
+2001-09-14 09:28  dts12
+
+   * agent/mibgroup/mibII/: at.c, icmp.c, interfaces.c, ip.c,
+   ipAddr.c, tcp.c, tcpTable.c, udp.c, udpTable.c, var_route.c:
+
+   Mib-2 support for Windows systems.
+   *Many* thanks to Latha S, for filling this long-awaited need.
+   
+2001-09-14 09:07  dts12
+
+   * agent/mibgroup/mibII/: icmp.c, ip.c, ipAddr.c, tcp.c, tcpTable.c,
+   udp.c, udpTable.c:
+
+   Move package-provided header includes ('mibincl' and 'util_funcs')
+   to after the system includes.  This shouldn't affect most systems,
+   but is necessary for the Windows port.
+   
+2001-09-14 08:28  dts12
+
+   * configure:
+
+   Propogate test for <netinet/ip_icmp.h> through to the bit that does the work.
+   
+     (Our illustrious leader clearly has no confidence in the competance
+      of his minions.  I'd take umbrage, if he wasn't right!)
+   
+2001-09-14 08:01  dts12
+
+   * config.h.in, configure.in:
+
+   Add test for <netinet/ip_icmp.h>
+   
+2001-09-14 07:57  dts12
+
+   * agent/mibgroup/mibII/: at.c, icmp.c, interfaces.c, ip.c,
+   ipAddr.c, route_write.c, tcp.c, tcpTable.c, udp.c, udpTable.c,
+   var_route.c:
+
+   Wrap various #includes with appropriate #if HAVE_XXX_H declarations
+   (where this has not already been done).
+   
+2001-09-11 14:47  nba
+
+   * agent/mibgroup/ucd-snmp/: memory.c, memory.h, memory_freebsd2.c,
+   memory_freebsd2.h, memory_netbsd1.c, memory_netbsd1.h,
+   memory_solaris2.c, memory_solaris2.h, vmstat.c, vmstat.h,
+   vmstat_bsdi4.c, vmstat_bsdi4.h, vmstat_freebsd2.c,
+   vmstat_netbsd1.c, vmstat_solaris2.c:
+
+   Make sure that the OID defines are only in one place. No functional change.
+   
+2001-09-11 14:45  nba
+
+   * agent/mibgroup/ucd-snmp/file.c:
+
+   Header reordering to allow dmalloc to work.
+   
+2001-09-11 14:31  nba
+
+   * agent/mibgroup/host/hr_partition.c:
+
+   Fix a misplaces ; in a loop.
+   Thanks to Mala Ramakrishnan <mala@routescience.com>
+   and Johannes Schmidt-Fischer <jsf@InterFace-AG.com>
+   
+2001-09-10 11:20  hardaker
+
+   * agent/mibgroup/mibII/interfaces.c:
+
+   change interface counting to happen more frequently to detect new cards.
+     - see bug #457290
+   
+2001-09-10 11:11  hardaker
+
+   * man/snmptrapd.8, apps/snmptrapd.c:
+
+   fix -P to usage it prints to stderr (bug #459372)
+   
+2001-09-10 10:55  hardaker
+
+   * agent/mibgroup/util_funcs.c:
+
+   fix whitespace parsing bug reported it bug #457267.
+   
+2001-09-10 10:46  hardaker
+
+   * agent/mibgroup/ucd-snmp/vmstat_freebsd2.c:
+
+   apply freebsd specific patch from bug#455924 to fix vmstat's swap report.
+   
+2001-09-10 10:11  hardaker
+
+   * perl/SNMP/SNMP.xs:
+
+   Use a more portable DBPRT macro.
+   
+2001-09-10 09:58  hardaker
+
+   * agent/mibgroup/notification/: snmpNotifyFilterProfileTable.c,
+   snmpNotifyFilterTable.c, snmpNotifyTable.c:
+
+   Remove redundant RowStatus value checks mentioned in bug#449502
+   
+2001-09-04 07:21  jbpn
+
+   * agent/snmpd.c:
+
+     - add missing break; after processing -P option, noted by Botond
+       Tarnay (see patch #458327)
+   
+2001-08-31 13:19  nba
+
+   * mibs/: DISMAN-SCRIPT-MIB.txt, Makefile.mib, README.mibs, rfclist,
+   smistrip:
+
+   Update to current version of DISMAN-SCRIPT-MIB, and a few cosetic changes
+   to smistrip et al.
+   
+2001-08-31 13:18  nba
+
+   * ltconfig:
+
+   Update to libtool 1.4. This ensures that make install will work for NetBSD
+   
+2001-08-31 13:17  nba
+
+   * aclocal.m4, configure, ltmain.sh:
+
+   Update to libtool 1.4. This wil ensure that make install work on NetBSD
+   
+2001-08-28 15:04  nba
+
+   * agent/snmpd.c:
+
+   Fix a bad fix
+   
+2001-08-28 15:03  nba
+
+   * agent/: agent_read_config.h, snmp_agent.h, snmp_vars.h:
+
+   C++ bracket the installed sgent headers
+   
+2001-08-28 07:35  nba
+
+   * apps/snmptrapd.c:
+
+   Fix a malformed multi-line string
+   
+2001-08-28 03:05  jbpn
+
+   * agent/snmp_agent.c:
+
+     - add missing #include <tcpd.h> if using libwrap, noted by Nathan
+       Neulinger (patch #453831).
+   
+2001-08-28 02:38  jbpn
+
+   * agent/snmpd.c:
+
+     - avoid use of pre-processor directives inside printf() call, which
+       is a macro in glibc, making this an undefined behaviour
+       construct (which GCC 3.0 refuses to compile).  See bug #455804 for
+       further details.
+   
+2001-08-27 22:15  nba
+
+   * man/: snmp_config.5.def, snmpd.conf.5.def, snmptrapd.conf.5.def:
+
+   Fix some places where actual lines started with a period.
+   
+2001-08-17 15:12  nba
+
+   * man/Makefile.in:
+
+   Fix misspelled man page name (snmperror => snmp_perror)
+   
+2001-08-17 15:09  nba
+
+   * mibs/: Makefile.mib, mibfetch:
+
+   IANA has moved their mibs into an iana.mib directory.
+   Fix RFC number for RMON-MIB.
+   Make "make allmaibs" extract mibs to another directory.
+   
+2001-08-17 15:03  nba
+
+   * config.guess, config.sub:
+
+   Yet another update from ftp.gnu.org
+   
+2001-08-17 14:09  nba
+
+   * agent/: agent_read_config.c, snmpd.c:
+
+   Add some needed error checking to the uid/gid parsing code.
+   Allow symbolic uid/gid from the command line.
+   
+2001-08-17 14:07  nba
+
+   * FAQ:
+
+   Add a missing argument to the snmptrap examples.
+   
+2001-08-07 14:55  nba
+
+   * apps/snmptrapd_log.c, snmplib/mib.c:
+
+   Timeticks are unsiged! Thanks to Josh Wilmes <josh-ucd@hitchhiker.org>
+   
+2001-08-07 14:42  nba
+
+   * man/snmpcmd.1, snmplib/mib.c, snmplib/snmp_api.c:
+
+   Changes to allow command line arguments to override snmp.conf settings.
+   
+2001-08-07 14:02  nba
+
+   * mibs/: IANAifType-MIB.txt, rfclist:
+
+   Update to current version of IANAifType-MIB.
+   Add rfc 3144 INTERFACETOPN-MIB to rfclist.
+   
+2001-08-07 14:00  nba
+
+   * config.guess, config.sub:
+
+   Update to current version from ftp.gnu.org
+   
+2001-08-07 13:59  nba
+
+   * apps/snmpset.c, apps/snmptranslate.c, apps/snmptrapd.c,
+   man/Makefile.in, man/snmp_api_errstring.3, man/snmp_error.3,
+   man/snmp_perror.3, man/snmp_sess_perror.3, man/snmpcmd.1,
+   man/snmptrapd.8:
+
+   A bunch of minor fixes to usage messages and manual pages.
+   
+2001-08-07 13:56  nba
+
+   * apps/snmptest.c:
+
+   Fix parsing of oid values for set
+   
+2001-08-07 07:09  jbpn
+
+   * agent/snmpd.c:
+
+     - fix for potential buffer overflow in logfile argument handling,
+       noted by Anonymous (bug #448243).  Also use a large enough buffer
+       to handle filenames of length PATH_MAX (if possible).
+   
+2001-07-26 01:40  jbpn
+
+   * apps/snmptrapd_log.c:
+
+     - initialise buffers to zero in handle_wrap_fmt, to avoid garbage in
+       display of security parameters, as noted by William Frauenhofer
+       (bug #437231).
+   
+2001-07-23 10:53  hardaker
+
+   * agent/mibgroup/util_funcs.c:
+
+   carefully construct tmp file names.
+   
+2001-07-23 10:53  hardaker
+
+   * config.h.in, configure, configure.in, agent/snmpd.c:
+
+   use setgroups when available.
+   
+2001-07-11 07:34  hardaker
+
+   * agent/mibgroup/mibII/mta_sendmail.h:
+
+   add NETWORK-SERVICES-MIB to mib require list
+   
+2001-07-09 11:15  hardaker
+
+   * agent/agent_trap.c:
+
+   fix trapsess parsing so as to:
+     - set the default port to 162
+     - don't free memory passed to snmp_parse_args() since
+       snmp_parse_args is broken and needs to copy memory rather than
+       just make use of it.
+   
+2001-06-27 15:48  nba
+
+   * man/snmpd.conf.5.def:
+
+   Simple fix to trapsess argument list
+   
+2001-06-25 08:47  hardaker
+
+   * snmplib/mib.c:
+
+   support 'mibs ""'.
+   
+2001-06-22 13:07  hardaker
+
+   * agent/mibgroup/mibII/interfaces.c:
+
+   Allow interface snmpd.conf tokens to completely override system
+   values.  [bug#426975]
+   
+2001-06-22 11:38  hardaker
+
+   * local/mib2c.conf:
+
+   define ulong_ret
+   
+2001-06-22 01:44  dts12
+
+   * FAQ, man/snmpd.conf.5.def:
+
+   Include a warning of the experimental nature of AgentX in the man page,
+   and update the FAQ to reflect the fuller integration of this support.
+   
+2001-06-21 15:22  nba
+
+   * apps/snmpdf.c:
+
+   Eliminate long long variables
+   
+2001-06-21 15:22  nba
+
+   * apps/snmptable.c:
+
+   Warn about deprecated -b -w and -i options.
+   
+2001-06-21 15:15  nba
+
+   * man/: snmpd.1.def, snmpd.conf.5.def, snmpset.1, snmpwalk.1:
+
+   Update time stamps
+   
+2001-06-21 15:09  nba
+
+   * man/snmptranslate.1:
+
+   Add -m and -M options to header. Update SEE ALSO to reference snmpcmd
+   and RFC 2578-80 in place of 1155
+   
+2001-06-21 15:01  nba
+
+   * snmplib/parse.c:
+
+   Fix parsing of xx ...::= { yy }
+   
+2001-06-21 10:25  hardaker
+
+   * agent/mibgroup/examples/example.c:
+
+   typos (IOD -> OID)
+   
+2001-06-21 10:18  hardaker
+
+   * man/snmpd.conf.5.def:
+
+   - mention "master agentx"
+   - fix config file re-reading oid.
+   
+2001-06-21 10:10  hardaker
+
+   * agent/mibgroup/mibII/system_mib.c:
+
+   make syscontact and syslocation accept "" strings.
+   
+2001-06-21 09:34  hardaker
+
+   * apps/snmptranslate.c, man/snmptranslate.1:
+
+   - Applied arg documentation patch from David Eisner
+   
+2001-06-14 23:19  nba
+
+   * man/snmptrapd.8:
+
+   Document -n option
+   
+2001-06-12 15:14  nba
+
+   * snmplib/default_store.c:
+
+   Properly detect and diagnose bad boolean and integer configuration values
+   
+2001-06-12 15:12  nba
+
+   * apps/: snmpdelta.c, snmpdf.c, snmpget.c, snmpgetnext.c,
+   snmpstatus.c, snmptrap.c, snmpusm.c, snmpvacm.c, snmpwalk.c:
+
+   Properly diagnose bad -C options
+   
+2001-06-12 07:24  dts12
+
+   * snmplib/read_config.c:
+
+   Fix 'unregister_config_handler' to handle tags other
+   than the first in the list.  (Thanks to Paul Serice).
+   
+2001-06-11 15:44  nba
+
+   * apps/snmpwalk.c, man/snmpwalk.1:
+
+   Add an options (-Cc) to snmpwalk that will validate that the returned objects
+   are indeed lexicographically increasing.
+   
+2001-06-11 15:43  nba
+
+   * apps/snmpset.c, man/snmpset.1, snmplib/snmp_api.c:
+
+   Allow a simpler snmpset notation when MIB data are loaded: Using '=' for
+   type type will infer it from the MIB.
+   
+2001-06-11 15:39  nba
+
+   * snmplib/: mib.c, parse.c:
+
+   Fix some long standing bugs when several MIB files define the same objects
+   with different names. Hopefully the results will be consistent now.
+   
+2001-06-11 12:12  nba
+
+   * apps/snmpdelta.c, snmplib/int64.c:
+
+   Another try at Counter64 problems, thanks to Jason Gloudon <snmp@gloudon.com>
+   
+2001-06-11 11:52  nba
+
+   * apps/snmptrapd_log.c:
+
+   Fix for a missing 0-byte to terminate community string.
+   Thanks to "KUBOTA,Takaya" <takaya@po.ntts.co.jp>.
+   
+2001-06-06 21:38  nba
+
+   * config.h.in, configure, configure.in,
+   agent/mibgroup/host/hr_system.c:
+
+   Use <utmpx.h> if available (to fix counting users for Solaris)
+   
+2001-06-06 21:33  nba
+
+   * man/snmpd.1.def:
+
+   Mention -s and -P pidfile arguments
+   
+2001-06-06 21:32  nba
+
+   * agent/mibgroup/smux/smux.c:
+
+   Fix sending of traps without varbinds
+   
+2001-06-06 21:31  nba
+
+   * agent/mibgroup/util_funcs.c:
+
+   More meaningful arguments to setPerrorstatus (true file names)
+   
+2001-05-17 12:36  nba
+
+   * snmplib/snmpv3.c:
+
+   Fix a Truly Stupid Bug thanks to Katsuhisa ABE <abekatsu@cysols.com>
+   
+2001-05-04 09:45  hardaker
+
+   * apps/snmpdf.c:
+
+   Remove duplicate l from %lld printf syntax
+   
+2001-05-04 07:00  hardaker
+
+   * Makefile.in:
+
+   insall mib_module_config.h
+   
+2001-05-03 10:15  hardaker
+
+   * snmplib/Makefile.in:
+
+   add snmp-tc.h to install list
+   
+2001-05-02 07:08  hardaker
+
+   * apps/snmptrapd.c:
+
+   Add -T flag to usage output.
+   
+2001-05-01 12:53  hardaker
+
+   * agent/mibgroup/mibII/at.c:
+
+   Fix use of a -1 assigned to a u_long as a failure checking case.
+   
+2001-04-23 17:08  hardaker
+
+   * local/tkmib:
+
+   fix walk problem once and for all.
+   
+2001-04-17 12:29  nba
+
+   * agent/mibgroup/host/hr_swrun.c:
+
+   Get data for hrSWRunPerfTable for cygwin under NT (or better)
+   
+2001-04-17 11:33  nba
+
+   * config.guess, config.sub, configure, configure.in:
+
+   Update to a recent version of config.guess/config.sub. Update configure
+   to handle the new NetBSD variant that include the object format.
+   
+2001-04-12 05:12  dts12
+
+   * agent/snmp_agent.c:
+
+   Better fix for bug #414855 from arajesh
+   Handles non-repeaters=0 as well, and avoids memory leaks.
+   
+2001-04-11 06:01  dts12
+
+   * agent/snmp_agent.c:
+
+   Handle GetBulk requests with max-repetitions=0 properly (bug #414855)
+   
+2001-04-10 09:33  hardaker
+
+   * apps/snmpdf.c:
+
+   fixed segfault when row has holes.
+   
+2001-04-06 16:20  hardaker
+
+   * man/snmpcmd.1:
+
+   - Added documentotion for -Ot
+   
+2001-04-06 07:32  hardaker
+
+   * agent/mibgroup/notification/snmpNotifyTable.c:
+
+   traps/informs reversed
+   
+2001-04-05 09:34  slif
+
+   * agent/mibgroup/ucd-snmp/pass.c:
+
+   remove unused variable from snmp_oid_min_compare.
+   
+2001-04-05 09:13  slif
+
+   * agent/mibgroup/ucd-snmp/pass.c:
+
+   Fix snmp_oid_compare and reverse encodings to deal with numbers > 2^31.
+   
+2001-04-05 08:21  slif
+
+   * agent/agent_trap.c:
+
+   use malloc to decrease stack size in snmpd_parse_config_trapsess.
+   
+2001-04-05 06:14  dts12
+
+   * agent/mibgroup/ucd-snmp/pass_persist.c:
+
+   Extend recent 'pass' changes to 'pass_persist'.  (Thanks, Mike!)
+   
+2001-04-05 02:27  dts12
+
+   * agent/mibgroup/ucd-snmp/pass.c:
+
+   Handle setting null string values via the 'pass' mechanism. (Support#406728)
+   Also handle embedded whitespace in such values.
+   
+2001-04-04 14:56  hardaker
+
+   * FAQ, README, sedscript.in, version.h:
+
+   - (version.h sedscript.in): version tag ( 4.2.1 )
+   
+2001-04-04 14:55  hardaker
+
+   * FAQ, README:
+
+   Change wording to say 4.2 line is the last to use the ucd-snmp name.
+   
+2001-04-04 14:51  hardaker
+
+   * ChangeLog:
+
+   ChangeLog
+   
+-------------------------------------------------------------------------------
+
+Changes: V4.2 -> V4.2.1
+
+2001-04-04 14:04  hardaker
+
+   * agent/mibgroup/ucd-snmp/loadave.c:
+
+   fix missing variable on solaris 2.6
+   
+2001-04-04 14:02  hardaker
+
+   * testing/eval_tools.sh:
+
+   use kill -TERM instead of kill -SIGTERM for portability (breaks on solaris).
+   
+2001-04-04 12:39  slif
+
+   * agent/mibgroup/host/hr_swrun.c:
+
+   Cleanup debug messages, build.
+   
+2001-04-04 09:18  slif
+
+   * agent/mibgroup/examples/example.c:
+
+   Fix network byte order for IpAddress displayed.
+   
+2001-04-04 08:50  slif
+
+   * apps/snmptrapd.c:
+
+   quiet exit on SIGTERM/SIGINT, same as snmpd.
+   
+2001-04-04 08:49  hardaker
+
+   * agent/: auto_nlist.c, auto_nlist.h:
+
+   fix for auto_nlist bogus definitions for machines without nlist.
+   
+2001-04-04 08:49  hardaker
+
+   * README.snmpv3:
+
+   update to when agent removes "createUser" directives.
+   
+2001-04-04 08:31  hardaker
+
+   * agent/mibgroup/ucd_snmp.h:
+
+   Applied patch #412080: add freebsd5 to module include list.
+   
+2001-04-04 08:12  dts12
+
+   * EXAMPLE.conf.def:
+
+   Document how to enable the AgentX facility in the master agent.
+   
+2001-04-04 07:59  hardaker
+
+   * local/tkmib:
+
+   fix bug #411917: change walk end condition as suggested by submitter.
+   
+2001-04-04 07:43  dts12
+
+   * snmplib/parse.c:
+
+   Change 'Line' variable name, to assist with Mac port.
+   
+2001-04-04 07:42  dts12
+
+   * agent/mibgroup/ucd-snmp/proxy.c:
+
+   Fix typo in cast (missing 'struct')
+   
+2001-04-04 07:37  hardaker
+
+   * snmplib/snmp_api.c:
+
+   Use a larger malloced buffer when decoding a large incoming encrypted message.
+   
+2001-04-04 07:36  hardaker
+
+   * snmplib/snmp_debug.c:
+
+   Limit size of hex messages to 1/5th buffer size (to be safe).
+   
+2001-04-04 07:24  jbpn
+
+   * agent/snmpd.c:
+
+    - call external signal handlers before calling snmp_select_info(),
+      rather than after calling snmp_select_info() but before select().
+      This fixes a potential problem that could arise if a signal handler
+      closed a session, which would cause select() to return -1 with
+      EBADF, and thus terminate the agent.
+   
+2001-04-04 06:50  dts12
+
+   * agent/mibgroup/ucd-snmp/disk.c:
+
+   Ensure that checking for 'statvfs' is done consistently
+   
+2001-04-04 06:48  dts12
+
+   * agent/mibgroup/mibII/system_mib.c:
+
+   ensure that 'exec_command' is used consistently with the availability of execv
+   
+2001-04-04 06:45  dts12
+
+   * snmplib/: mib.c, snmp_api.c, snmp_logging.c:
+
+   Keep one of the pickier compilers (HP's aCC) happy.
+   
+2001-04-03 22:07  hardaker
+
+   * snmplib/snmpusm.c:
+
+   Fix maximum encrypted packet length support for reverse encoded packets.
+   
+2001-04-03 18:07  slif
+
+   * testing/tests/T120proxyget:
+
+   fix rwcommunity
+   
+2001-04-03 16:44  hardaker
+
+   * local/wesrestart:
+
+   remove old unused script
+   
+2001-04-03 16:41  hardaker
+
+   * local/snmpconf.dir/snmpd.conf/operation:
+
+   Add snmpconf directive support for the new "master" token.
+   
+2001-04-03 16:41  hardaker
+
+   * local/snmpconf:
+
+   Fix bug in menus for configuration files containing only "groups".
+   
+2001-04-03 16:40  hardaker
+
+   * README:
+
+   Change my name -> net-snmp developers.
+   
+2001-04-03 15:36  hardaker
+
+   * EXAMPLE.conf.def:
+
+   mention snmpconf
+   
+2001-04-03 15:28  hardaker
+
+   * README:
+
+   url changes mostly.
+   
+2001-04-03 15:28  hardaker
+
+   * NEWS:
+
+   4.2.1 update (please check).
+   
+2001-04-03 15:28  hardaker
+
+   * FAQ:
+
+   ftp site update.
+   
+2001-04-03 14:04  hardaker
+
+   * configure, configure.in:
+
+   Added agentx to default modules to compile in
+   
+2001-04-03 10:12  hardaker
+
+   * local/mib2c:
+
+   add a comment at the end of the mib2c output explaining that its
+   merely a template.
+   
+2001-04-03 08:27  hardaker
+
+   * AGENT.txt, FAQ, PORTING, README, README.agentx:
+
+   Web page/ftp site updates.  Uses www.net-snmp.org everywhere now.
+   
+2001-04-03 06:24  slif
+
+   * agent/mibgroup/util_funcs.c:
+
+   Fix signed/unsigned compare.
+   
+2001-04-03 06:21  dts12
+
+   * agent/mibgroup/mibII/kernel_linux.c:
+
+   Plug file-descriptor leak when using cached data.  (Bug#412000)
+   
+2001-04-02 23:22  nba
+
+   * apps/snmptest.c:
+
+   Fix an incompletely initialized variable
+   
+2001-04-02 23:21  nba
+
+   * local/snmpconf:
+
+   The answers for the "load which files" menu are kept secret from the code
+   that loads the files .... fixed.
+   
+2001-04-02 20:02  hardaker
+
+   * local/: Makefile.in, snmpconf.dir/snmptrapd.conf/formatting,
+   snmpconf.dir/snmptrapd.conf/traphandle:
+
+   Added snmptrapd configuration file directives to snmpconf.
+   
+2001-04-02 10:08  jbpn
+
+   * man/snmp_agent_api.3:
+
+    - update documentation of agent_check_and_process to reflect
+      current behaviour
+   
+2001-04-02 09:58  jbpn
+
+   * agent/snmp_agent.c:
+
+    - Fix memory leak in handle_one_var where long varbinds weren't
+      correctly free()d.
+   
+    - Change behaviour of agent_check_and_process so that alarms run
+      correctly.
+   
+2001-04-02 08:51  dts12
+
+   * agent/mibgroup/agentx/master.c:
+
+   Use the 'standard' config handler registration routine,
+   and recognise the config setting 'master all'
+   
+2001-04-02 06:53  nba
+
+   * man/snmpd.conf.5.def:
+
+   Fix some missing quoting on .IP parameters
+   
+2001-03-30 08:05  hardaker
+
+   * FAQ, README.agentx, agent/mibgroup/agentx/README.agentx:
+
+   moved agentx README to top
+   
+2001-03-30 07:22  dts12
+
+   * FAQ:
+
+   Typo in AgentX README filename
+   
+2001-03-30 07:20  dts12
+
+   * agent/: ds_agent.h, snmp_agent.c, snmpd.c,
+   mibgroup/agentx/README.agentx, mibgroup/agentx/master.c,
+   mibgroup/agentx/master.h:
+
+   Provide 'master' config directive to control whether or not to
+   activate extensible subagent support.
+     Initially restricted to AgentX support only.
+   
+2001-03-30 03:46  dts12
+
+   * agent/mibgroup/agentx/README.agentx:
+
+   Update to reflect the increased maturity of the AgentX implementation.
+   
+2001-03-30 03:34  dts12
+
+   * FAQ:
+
+   Tweaked various entries, and added a few new ones.  General Shield meddling.
+   
+2001-03-30 01:00  dts12
+
+   * README:
+
+   Add prominent warning regarding ucd-snmp => net-snmp switch.
+   
+2001-03-30 00:46  dts12
+
+   * snmplib/snmp_api.c:
+
+   Fix interpretation of "pure numeric" peername strings (i.e. listen on the
+     specified port on all interfaces) - problem identified by Mala Ramakrishnan.
+   
+2001-03-30 00:04  nba
+
+   * snmplib/parse.c:
+
+   Replace atoi/atol with strto(u)l which has better out-of-range returns.
+   This is not a perfect solution, but it is better ...
+   
+2001-03-29 21:43  hardaker
+
+   * ISSUES:
+
+   rm ISSUES
+   
+2001-03-29 14:34  hardaker
+
+   * COPYING:
+
+   minor formatting.
+   
+2001-03-29 14:33  hardaker
+
+   * COPYING:
+
+   Um, got the year right this time.
+   
+2001-03-29 14:32  hardaker
+
+   * COPYING:
+
+   update for 2001: added my required NAI BSD copyright.
+   
+2001-03-29 08:23  slif
+
+   * testing/eval_tools.sh:
+
+   merge change from main branch (return_value=1 statement).
+   
+2001-03-29 08:21  slif
+
+   * win32/libsnmp_dll/libsnmp.def:
+
+   Add vacm_is_configured.
+   
+2001-03-28 22:12  nba
+
+   * mibs/: rfclist, rfcmibs.diff:
+
+   Add Printer-MIB to the rfclist with the corresponding patch.
+   
+2001-03-28 13:06  nba
+
+   * snmplib/snmp_client.c:
+
+   Properly ignore non-response PDU's when doing async transaction.
+   
+2001-03-28 13:04  nba
+
+   * man/snmpcmd.1, snmplib/mib.c:
+
+   Fix index handling to properly accept indexing with TimeTicks.
+   Implement -Ir to disable index checks.
+   
+2001-03-28 06:20  hardaker
+
+   * FAQ, README, sedscript.in, version.h:
+
+   - (version.h sedscript.in): version tag ( 4.2.1.pre2 )
+   
+2001-03-27 10:27  hardaker
+
+   * apps/snmptrapd.c:
+
+   Use snmp_log with %s to prevent % expansion in octet strings containing a %s.
+   
+2001-03-27 05:37  dts12
+
+   * agent/: snmp_agent.c, mibgroup/agentx/master_request.c:
+
+   Handle non-responsive AgentX sub-agents more robustly.
+      (Based on suggestions from Harrie Hazewinkel & Paul Rasmussen)
+   
+2001-03-27 02:35  dts12
+
+   * agent/mibgroup/smux/smux.c:
+
+   Reset count of authorized peers on closedown.  (Thanks to Vlad Tunik)
+   
+2001-03-26 18:03  hardaker
+
+   * agent/mibgroup/mibII/vacm_vars.c, snmplib/vacm.c, snmplib/vacm.h:
+
+   Fixed vacm to drop v1/v2c packets properly when no com2sec entries are found.
+   
+2001-03-26 11:06  hardaker
+
+   * local/ipf-mod.pl:
+
+   add usage comment at top
+   
+2001-03-22 14:34  nba
+
+   * mibs/rfclist:
+
+   New MIB in RFC 3083: DOCS-BPI-MIB
+   
+2001-03-22 14:27  nba
+
+   * agent/mibgroup/host/hr_filesys.c, s/cygwin.h,
+   agent/mibgroup/host/hr_storage.c, agent/mibgroup/host/hr_swrun.c,
+   agent/mibgroup/host/hr_utils.c:
+
+   Make most of the host resources mib compile under Cygwin. We can now do
+   --with-mib-modules=host --with-out-mib-modules=host/hr_network
+   
+2001-03-22 12:27  hardaker
+
+   * agent/mibgroup/util_funcs.c:
+
+   fix header_simple_table() for too long requests
+   
+2001-03-22 08:13  hardaker
+
+   * apps/snmptrapd.c:
+
+   Bad Wes: find all instances of cut-n-paste errors before committing.
+   
+2001-03-22 08:12  hardaker
+
+   * apps/snmptrapd.c:
+
+   Bad Wes: don't call function without the ()s.  (at least in C).
+   
+2001-03-22 07:46  dts12
+
+   * agent/agent_trap.c:
+
+   Fix for minor memory leak with trap-related varbind values.
+   Thanks to John Villalovos (and the Intel SNMP team)
+   
+2001-03-21 17:22  driehuis
+
+   * snmplib/mib.c:
+
+   Bugfix for crash at snmp_shutdown time with OS's that check pointer
+   validity (e.g., FreeBSD)
+   
+2001-03-21 08:16  hardaker
+
+   * agent/mibgroup/mibII/interfaces.c:
+
+   join broken snmp_log lines
+   
+2001-03-21 08:15  hardaker
+
+   * apps/snmptrapd.c:
+
+   fix -F (I think)
+   
+2001-03-21 07:43  hardaker
+
+   * snmplib/snmp_api.c:
+
+   patch from Harrie to fix variable types (int -> size_t)
+   
+2001-03-20 08:25  nba
+
+   * agent/mibgroup/mibII/at.c, agent/mibgroup/mibII/at.h,
+   agent/mibgroup/mibII/interfaces.c, s/linux.h:
+
+   Fix the atTable and ipNetTopMediaTable for Linux to return the ifIndex
+   
+2001-03-19 13:14  nba
+
+   * apps/snmpdelta.c, man/snmpdelta.1:
+
+   Major option parsing surgery to cather for the getopt using version of
+   snmp_parse_args. Seems to have been forgotten when the rest of the apps
+   were updated.
+   
+2001-03-19 13:13  nba
+
+   * agent/mibgroup/ucd-snmp/disk.c:
+
+   Re-order sys/conf.h and sys/param.h to make FreeBSD-5 happy
+   
+2001-03-15 13:44  hardaker
+
+   * agent/mibgroup/mibII/ip.c:
+
+   fixed bug #405000: dropped support for IPOUTNOROUTES, since no
+   calculation of it seems close to correct.
+   
+2001-03-15 13:36  hardaker
+
+   * agent/mibgroup/mibII/udp.c:
+
+   fix part 2 of bug 405519 adding fullsock to udpinerrors
+   
+2001-03-15 13:31  hardaker
+
+   * agent/mibgroup/ucd-snmp/vmstat_solaris2.c:
+
+   fix bug #408388 where memmove is called with too short a length.
+   
+2001-03-15 11:21  hardaker
+
+   * FAQ, README, sedscript.in, version.h:
+
+   - (version.h sedscript.in): version tag ( 4.2.1.pre1 )
+   
+2001-03-15 03:34  jbpn
+
+   * testing/eval_tools.sh:
+
+   kill -SIGKILL isn't legal syntax on Solaris or Linux; changed to kill -9
+   which is likely safer
+   
+   don't set return_value to 1 after killing snmpd, which causes spurious
+   test failures
+   
+2001-03-14 14:38  hardaker
+
+   * agent/agent_trap.h:
+
+   Patch from Harrie Hazewinkel: make send_enterprise_trap_vars a public fn.
+   
+2001-03-14 11:08  hardaker
+
+   * agent/mibgroup/mibII/at.c:
+
+   fix ipnettomedia indexing on solaris.
+   
+2001-03-14 10:27  slif
+
+   * agent/mibgroup/tunnel/tunnel.c:
+
+   Use config.h, don't use ucd-snmp directory to build in the mibgroup tree.
+   
+2001-03-14 10:18  slif
+
+   * testing/RUNTESTS:
+
+   quiet "which" output.  never ending saga...
+   
+2001-03-14 10:08  slif
+
+   * agent/mibgroup/agentx/master_request.c:
+
+   quiet unsigned long compare.
+   
+2001-03-14 10:00  slif
+
+   * agent/mibgroup/agentx/client.c:
+
+   Get a decl of in_addr_t from netinet/in.h, where necessary.
+   
+2001-03-14 10:00  slif
+
+   * snmplib/parse.c:
+
+   Avoid warnings of struct timeval decl in system.h by including *time.h*.
+   
+2001-03-14 09:47  slif
+
+   * agent/snmpd.c, apps/snmpvacm.c, apps/snmpnetstat/winstub.c,
+   snmplib/parse.c:
+
+   patch submitted by Harrie Hazewinkel
+   
+2001-03-14 09:40  slif
+
+   * testing/RUNTESTS:
+
+   don't run tests without needed programs: snmpd, snmpget, snmpgetnext.
+   
+2001-03-14 08:24  slif
+
+   * configure, configure.in:
+
+   Provide an empty DLLIBS value for non-dlmod uses.
+   
+2001-03-14 07:36  slif
+
+   * agent/mibgroup/agentx/protocol.c:
+
+   cast u_long to u_char when storing 8-bit values.
+   
+2001-03-14 07:33  slif
+
+   * agent/mibgroup/ucd-snmp/proxy.c:
+
+   fix unsigned length compares.
+   
+2001-03-14 05:45  dts12
+
+   * agent/mibgroup/host/hr_swrun.c:
+
+   Fix Linux file descriptor leak (reported by Oliver Fänger)
+   
+2001-03-13 13:20  hardaker
+
+   * snmplib/default_store.c:
+
+   Patch from Harrie Hazewinkel to check for NULLs in DEBUG msg
+   
+2001-03-12 14:06  nba
+
+   * agent/mibgroup/agentx/: master_admin.c, subagent.c:
+
+   Fix some minor leaks.
+   
+2001-03-12 14:05  nba
+
+   * agent/snmpd.c:
+
+   Some minor fixes to argument processing, including terminating snmpd on
+   extraneous non-option arguments.
+   
+2001-03-10 08:13  hardaker
+
+   * agent/mibgroup/mibII/ip.c:
+
+   Bug #404988: don't use ipstat.ips_fragtimout as a number of seconds.
+   
+2001-03-07 10:26  slif
+
+   * testing/eval_tools.sh:
+
+   
+   new DELAY function; start/stop daemons using new STARTPROG/STOPPROG with DELAY;
+   log commands issued and final result to SNMP_TMPDIR/invoked;
+   suppress "kill" output to help Cygwin users happy.
+   
+2001-03-07 10:23  slif
+
+   * testing/RUNTESTS:
+
+   
+   add -S parameter for DELAY seconds; add trap for interrupt control;
+   pass test number and display-header-only to eval_onescript.sh;
+   add which test to verbose locating messages (Cygwin uses type, not which).
+   
+2001-03-07 10:20  slif
+
+   * testing/: TESTCONF.sh, eval_onescript.sh:
+
+   
+   
+   Incorporate test number into test results dir name.
+   Provide default values for test number and display-header-only flag.
+   
+2001-03-07 10:19  slif
+
+   * testing/Makefile.in:
+
+   
+   
+   "make clean" removes any test result dirs "/tmp/snmp-test-*".
+   
+2001-03-07 10:15  slif
+
+   * testing/tests/: T054agentv2ctrap, T056agentv2cmintrap,
+   T058agentauthtrap:
+
+   
+   Replace sleep with commented out DELAY ; each start/stop action now
+   invokes DELAY.
+   
+2001-03-07 10:14  slif
+
+   * testing/tests/T100agenthup:
+
+   
+   Replace sleep with DELAY.
+   
+2001-03-07 10:13  slif
+
+   * win32/config.h:
+
+   
+   
+   Change element separator to Win32 ';' in DEFAULT_MIBS
+   Declare Win32 has getpid!.
+   
+2001-03-07 10:10  slif
+
+   * snmplib/snmp_api.c:
+
+   
+   
+   Win32 include io.h to declare mktemp.
+   Expand the comment near mktemp usage to explain why it is needed.
+   
+2001-03-07 10:09  slif
+
+   * snmplib/snmp_alarm.c:
+
+   
+   
+   remove unnecessary ifndef WIN32.  ifdef SIGALRM is sufficient.
+   
+2001-03-07 10:07  slif
+
+   * agent/snmpd.c, apps/snmptrapd.c:
+
+   
+   
+   Win32 include process.h to declare getpid.
+   
+2001-03-07 10:06  slif
+
+   * snmplib/snmp_logging.c:
+
+   
+   
+   Use proper define to qualify include-ing a header.
+   
+2001-03-07 10:04  slif
+
+   * agent/mib_modules.c, apps/snmpnetstat/if.c, snmplib/system.h:
+
+   
+   
+   Apply the time goo consistently: move header includes out of system.h.
+   
+2001-03-06 10:08  hardaker
+
+   * configure, configure.in:
+
+   don't force inclusion of -ldl.
+   
+2001-03-05 06:30  slif
+
+   * snmplib/snmpv3.c:
+
+   
+   
+   Follow method usage, don't declare getHwAddress unless used.
+   
+2001-03-05 06:30  slif
+
+   * snmplib/snmp_api.c:
+
+   
+   
+   Remove nested variable ep - one already exists.
+   
+2001-03-05 06:28  slif
+
+   * agent/mibgroup/examples/ucdDemoPublic.c:
+
+   
+   
+   Comment out example variables that are not used.
+   
+2001-03-04 17:41  slif
+
+   * README.win32, win32/config.h, win32/mib_module_config.h,
+   win32/mib_module_includes.h, win32/mib_module_inits.h,
+   win32/libsnmp_dll/libsnmp.def, win32/libucdmibs/libucdmibs.def,
+   win32/libucdmibs/libucdmibs.dsp:
+
+   
+   
+   patch to build more modules, including agentX, on Win32 using MS-VC.
+   
+2001-03-04 17:27  slif
+
+   * agent/mibgroup/header_complex.c, agent/mibgroup/agentx/client.c,
+   agent/mibgroup/agentx/master.c,
+   agent/mibgroup/agentx/master_admin.c,
+   agent/mibgroup/agentx/master_request.c,
+   agent/mibgroup/agentx/protocol.c, agent/mibgroup/agentx/subagent.c,
+   agent/mibgroup/notification/snmpNotifyFilterProfileTable.c,
+   agent/mibgroup/notification/snmpNotifyFilterTable.c,
+   agent/mibgroup/notification/snmpNotifyTable.c,
+   agent/mibgroup/target/target.c, agent/mibgroup/ucd-snmp/dlmod.c,
+   agent/mibgroup/ucd-snmp/pass_persist.c,
+   agent/mibgroup/ucd-snmp/proxy.c, apps/snmptrapd_log.c:
+
+   
+   
+   patch to build more of the agent using MS-VC on Win32 platform.
+   
+2001-03-03 14:34  nba
+
+   * mibs/: IANAifType-MIB.txt, MTA-MIB.txt, Makefile.mib,
+   README.mibs, TUNNEL-MIB.txt, ianalist, mibfetch, rfclist,
+   rfcmibs.diff, smistrip:
+
+   Update to current IANAifType-MIB, plus addition of README and tools to get
+   a complete set of IETF MIB files.
+   
+2001-03-03 07:11  nba
+
+   * agent/mibgroup/agentx/master.h:
+
+   Remove an unused prototype
+   
+2001-03-03 06:36  nba
+
+   * man/snmptrapd.8, apps/snmptrapd_log.c:
+
+   Add a new %P formatting sequence to user specified log formats. It print
+   the security information from the PDU (community, user, context as available)
+   Also modify the default trap output to use it.
+   
+2001-03-03 06:21  nba
+
+   * apps/snmptrapd_log.c:
+
+   Fix specifiers like %.3s
+   
+2001-03-03 06:10  nba
+
+   * snmplib/parse.c:
+
+   Fix the parser to diagnose oid specs like::= { single }
+   Be silent for internal links when moving nodes to the adoption list. This
+   should help giving only a single message for missing imports of enterprises.
+   
+2001-03-02 13:24  slif
+
+   * snmplib/asn1.c, snmplib/mib.c, snmplib/mib.h, snmplib/snmp_api.c,
+   snmplib/snmp_parse_args.c, snmplib/snmp_parse_args.h,
+   win32/libsnmp_dll/libsnmp.def:
+
+   
+   
+   cleanup for MS-VC Win32 build
+   
+2001-03-02 07:36  hardaker
+
+   * README:
+
+   sourcerforge -> sourceforge
+   
+2001-03-02 07:25  hardaker
+
+   * perl/SNMP/SNMP.xs:
+
+   Patch from Karl Schilke to fix timestamps in synchonous cases
+   
+2001-03-02 06:31  hardaker
+
+   * snmplib/snmp_api.c:
+
+   Remove unused variable from snmp_oid_compare().
+   
+2001-03-01 19:49  hardaker
+
+   * snmplib/: asn1.c, snmp_api.c:
+
+   Fix snmp_oid_compare and reverse encodings to deal with numbers > 2^31.
+   
+2001-02-21 15:31  nba
+
+   * man/: snmp.conf.5.def, snmpcmd.1:
+
+   Fix a couple of typos
+   
+2001-02-21 15:22  hardaker
+
+   * snmplib/ucd-snmp-includes.h:
+
+   Applied patch #103805 from bcollar: add sys/time.h to ucd-snmp-includes.h
+   
+2001-02-21 15:15  hardaker
+
+   * snmplib/int64.c:
+
+   fix bug #133416 (u64Subtraction math) as suggested by the submittor
+   
+2001-02-21 14:38  nba
+
+   * agent/mibgroup/host/hr_filesys.c:
+
+   Try fixing inconsistent indexing on BSD
+   
+2001-02-19 08:46  slif
+
+   * agent/mibgroup/ucd-snmp/proxy.c:
+
+   
+   
+   - proxy.c: remove some unused variables.
+   
+2001-02-16 15:12  hardaker
+
+   * agent/var_struct.h:
+
+   - increase UCD_REGISTRY_OID_MAX_LEN to 128 at Frank's request
+   
+2001-02-14 18:15  hardaker
+
+   * apps/snmptrapd.c:
+
+   removed unused snmp_alarm.h include
+   
+2001-02-13 16:21  hardaker
+
+   * snmplib/snmp_api.c:
+
+   fix bug #130740 using suggested close() wrapper around mkstemp()
+   
+2001-02-09 11:16  hardaker
+
+   * agent/snmpd.c:
+
+   Applied patch #103613: fix memory leak in snmpd port specification -> default_store.
+   
+2001-02-09 11:14  hardaker
+
+   * agent/mib_modules.c:
+
+   Applied patch #103612: fix memory leak in mib_module init code
+   
+2001-02-09 11:12  hardaker
+
+   * agent/agent_registry.c:
+
+   Applied patch #103611: fix memory leak for duplicate oid registrations.
+   
+2001-02-09 11:08  hardaker
+
+   * perl/SNMP/SNMP.xs:
+
+   Applied patch #103604: Add support for V1 traps and int/int32 differences
+   
+2001-02-09 11:06  hardaker
+
+   * agent/mibgroup/ucd-snmp/: memory_freebsd2.c, proxy.c:
+
+   Applied patch #103702: fix swap reporting on freebsd 4.2
+   
+2001-02-06 14:26  nba
+
+   * apps/snmpnetstat/Makefile.in:
+
+   Add a dependency for libsnmp
+   
+2001-02-06 14:25  nba
+
+   * agent/mibgroup/ucd-snmp/vmstat_freebsd2.c:
+
+   Implement raw interrupt and context switch counters
+   
+2001-02-06 14:24  nba
+
+   * agent/mibgroup/notification/snmpNotifyTable.c:
+
+   Make dmalloc happy by fixing a malloc read overrun
+   
+2001-02-06 14:16  nba
+
+   * man/snmpcmd.1, snmplib/default_store.h, snmplib/mib.c:
+
+   Backport -OT output to 4-2-patches branch
+   
+2001-02-06 06:02  hardaker
+
+   * perl/SNMP/SNMP.pm:
+
+   documentation fix
+   
+2001-01-31 23:02  nba
+
+   * snmplib/snmp_api.c:
+
+   Fix value validation for snmpset/snmptrap
+   
+2001-01-31 23:00  nba
+
+   * agent/mibgroup/ucd-snmp/proxy.c:
+
+   Fix bad return of a pointer to non-static storage
+   
+2001-01-31 15:44  hardaker
+
+   * agent/mibgroup/host/hr_print.c:
+
+   Patch from Frank Bartels for freebsd fixes
+   
+2001-01-30 17:13  hardaker
+
+   * agent/mibgroup/ucd-snmp/disk.c:
+
+   Applied patch #103414: fix disk info for block sizes other than 1024.
+   
+2001-01-29 13:24  hardaker
+
+   * agent/mibgroup/smux/smux.c:
+
+   fix bug #130410:  set the write_method in var_smux before returning
+   NULL to make sure that sets happen on OIDs that don't exist first.
+   
+2001-01-29 13:15  hardaker
+
+   * local/mib2c:
+
+   fix suggested in bug #129948: check for - arguments at the begginning
+   of the command line token (don't match mib-2, eg).
+   
+2001-01-29 13:13  hardaker
+
+   * snmplib/parse.c:
+
+   fix suggested in bug #129876: check for hint != NULL before freeing.
+   
+2001-01-26 05:49  nba
+
+   * agent/mibgroup/host/hr_print.c:
+
+   Fix bug on FreeBSD when /etc/printcap is empty
+   
+2001-01-25 14:38  nba
+
+   * mibs/RMON-MIB.txt:
+
+   Updated to RFC 2819
+   
+2001-01-24 21:37  nba
+
+   * agent/Makefile.in:
+
+   Install libraries before agent so that libtool can relink.
+   
+2001-01-20 05:54  nba
+
+   * apps/snmpdelta.c, snmplib/int64.c:
+
+   Two Counter64 glitches detected by Jason Gloudon <snmp@gloudon.com>
+   
+2001-01-20 05:44  nba
+
+   * agent/snmpd.c:
+
+   Dont set up the select parameters before calling interrupt handlers!
+   Thanks to Frank Strauss.
+   
+2001-01-20 05:42  nba
+
+   * snmplib/snmp_api.c:
+
+   Fix encoding of BITS variable, thanks to Frank Strauss
+   
+2001-01-20 05:37  nba
+
+   * agent/mibgroup/ucd-snmp/vmstat_solaris2.c:
+
+   Raw IO counters from Jochen Kmietsch
+   
+2001-01-20 05:36  nba
+
+   * agent/mibgroup/ucd-snmp/vmstat.h, mibs/UCD-SNMP-MIB.txt:
+
+   Prepare for more raw counters
+   
+2001-01-15 15:14  nba
+
+   * agent/mibgroup/ucd-snmp/proxy.c:
+
+   undo a change that sneaked in by mistake
+   
+2001-01-15 14:07  nba
+
+   * agent/mibgroup/ucd-snmp/proxy.c,
+   agent/mibgroup/ucd-snmp/vmstat.h,
+   agent/mibgroup/ucd-snmp/vmstat_bsdi4.c,
+   agent/mibgroup/ucd-snmp/vmstat_bsdi4.h,
+   agent/mibgroup/ucd-snmp/vmstat_freebsd2.c,
+   agent/mibgroup/ucd-snmp/vmstat_freebsd2.h,
+   agent/mibgroup/ucd-snmp/vmstat_netbsd1.c,
+   agent/mibgroup/ucd-snmp/vmstat_netbsd1.h,
+   agent/mibgroup/ucd-snmp/vmstat_solaris2.c, mibs/UCD-SNMP-MIB.txt,
+   agent/mibgroup/ucd-snmp/vmstat_solaris2.h:
+
+   Extend the systemStats.cpuRaw section to include more raw counters for various
+   operating systems.  Basic testing performed for Solaris and FreeBSD. Code
+   guesstimate for NetBSD and BSDi.
+   
+2001-01-12 08:00  hardaker
+
+   * snmplib/snmp_api.c:
+
+   - bit_string fixes
+   - make snmp_add_var call snmp_parse_oid() instead of read_objid().
+   
+2001-01-12 07:57  hardaker
+
+   * snmplib/asn1.c:
+
+   comment out really odd (and broken) check from asn_bitstring_check???
+   
+2001-01-12 07:52  hardaker
+
+   * local/: mib2c.storage.conf, mib2c.vartypes.conf:
+
+   - misc bug fixes.
+   - new data types (uint32, unsigned, bits).
+   
+2001-01-10 21:55  nba
+
+   * snmplib/snmp_api.c:
+
+   Fix calling of init_callbacks even if init_snmp called with NULL parameter
+   
+2001-01-10 21:53  nba
+
+   * snmplib/snmp_api.c:
+
+   Fix badly applied previous patch
+   
+2001-01-10 21:52  nba
+
+   * apps/snmpvacm.c:
+
+   Fix usage message (-e is now -Ce)
+   
+2001-01-10 21:51  nba
+
+   * agent/mibgroup/mibII/var_route.c:
+
+   Fix a bad ipRouteProtocol return
+   
+2001-01-10 21:50  nba
+
+   * agent/mibgroup/host/hr_swrun.c:
+
+   Fix problem when running --without-root-access for FreeBSD. Thanks to
+   Bert Driehuis.
+   
+2001-01-10 21:48  nba
+
+   * agent/mibgroup/kernel_sunos5.c:
+
+   Use the ifspeed attribute from driver when available
+   
+2001-01-09 06:29  hardaker
+
+   * agent/mibgroup/mibII/interfaces.c:
+
+   Applying patch found in bug #127299:
+     - switch ifAdmin and ifOperStatus meanings to match kernel parameters better.
+   
+2001-01-09 06:21  hardaker
+
+   * win32/snmpnetstat/snmpnetstat.dsp:
+
+   added getopt.c to list
+   
+2001-01-08 08:19  hardaker
+
+   * agent/mibgroup/host/hr_swrun.c:
+
+   Patch from Anders Ellefsrud
+     - fix hr_swrun when programs have exited so we don't truncate
+       getnext queries.
+   
+2001-01-08 08:14  hardaker
+
+   * snmplib/snmp_api.c:
+
+   Patch from Frank Strauss:
+     - fix BITS encoding length when mib knowledge is available.
+   
+2001-01-04 23:18  nba
+
+   * apps/: snmpset.c, snmptrap.c:
+
+   Try fixing problems with snmpset of negative values
+   
+2001-01-04 23:15  nba
+
+   * agent/mibgroup/ucd-snmp/vmstat_bsdi4.c:
+
+   Add the raw cpu couters for BSDi. Courtesy Bert Driehuis.
+   
+2001-01-04 23:12  nba
+
+   * agent/mibgroup/host/hr_swrun.c,
+   agent/mibgroup/ucd-snmp/loadave.c, snmplib/callback.c:
+
+   Save some unused variables
+   
+2001-01-04 23:09  nba
+
+   * acconfig.h, config.h.in, agent/agent_trap.c, agent/mib_modules.c,
+   agent/mibgroup/agentx/client.c, agent/mibgroup/agentx/master.c,
+   agent/mibgroup/agentx/master_admin.c,
+   agent/mibgroup/agentx/master_admin.h,
+   agent/mibgroup/agentx/master_request.c,
+   agent/mibgroup/agentx/protocol.c, agent/mibgroup/agentx/subagent.c:
+
+   Add missing dmalloc support for some files
+   
+2001-01-04 23:04  nba
+
+   * Makefile.in:
+
+   Ensure sort order for config.h.in
+   
+2001-01-04 10:24  hardaker
+
+   * configure, configure.in:
+
+   fix semi-colon problem.  Patch #103101.
+   
+2001-01-03 07:01  hardaker
+
+   * agent/mibgroup/host/hr_swrun.c:
+
+   /proc/%d/cmdline may be an empty file for some processes.  Return "" if so.
+   
+2001-01-02 09:47  hardaker
+
+   * snmplib/snmp_logging.c:
+
+   add a "%s" formatting string to the syslog() call (redhat bug #18153).
+   
+2000-12-29 13:38  hardaker
+
+   * agent/mibgroup/mibII/interfaces.c:
+
+   Patch from Ted Rule:
+     - better checking for formatting of the /proc/net/dev file to avoid
+       linux core dumps when the kernel mis-behaves.
+   
+2000-12-27 16:47  hardaker
+
+   * testing/tests/: T053agentv1trap, T054agentv2ctrap,
+   T055agentv1mintrap, T056agentv2cmintrap, T113agentxtrap:
+
+   - trap API testing suite enhanced to test more cases.
+   
+2000-12-27 16:45  hardaker
+
+   * agent/agent_callbacks.h, agent/agent_trap.c, agent/agent_trap.h,
+   agent/mibgroup/notification/snmpNotifyTable.c,
+   agent/mibgroup/notification/snmpNotifyTable.h, snmplib/callback.c,
+   snmplib/callback.h:
+
+   - Make the notification mib work more via callbacks and remove ifdefs in
+     agent_trap.c
+   - Make the agent_trap.c file check for callback registrations and
+     handle it internally using the old trapsink support if no callback
+     is found.
+   - This fixes the problem when init_mib_modules() isn't called in subagents.
+   
+2000-12-27 16:42  hardaker
+
+   * agent/mibgroup/examples/example.c:
+
+   make the example traps be sent using a enterprise specific trap of 99
+   rather than 3.  We need to define it in the mib still.
+   
+2000-12-27 15:26  hardaker
+
+   * snmplib/asn1.c:
+
+   fix broken compiler precedence as reported in support #110473.
+   
+2000-12-22 08:54  hardaker
+
+   * snmplib/asn1.c:
+
+   fix counter64 reverse encodings.
+   
+2000-12-22 06:58  hardaker
+
+   * snmplib/vacm.c:
+
+   fix view processing to watch for length prefix.  The length prefix
+   really really shouldn't be stored directly in the oid.  Niels?
+   
+2000-12-21 14:43  nba
+
+   * apps/snmpnetstat/main.c:
+
+   - main.c: fix problem with positional community argument to snmpnetstat
+   
+2000-12-21 14:37  nba
+
+   * snmplib/mib.c:
+
+   - mib.c: make sure init_mib_internals is called before doing anything
+   	serious in init_mib
+   
+2000-12-21 08:22  hardaker
+
+   * snmplib/snmp_api.c:
+
+   Patch from Frank Strauss to fix support for BITS
+   
+-------------------------------------------------------------------------------
+
+Changes: V4.1.2 -> V4.2
+
+2000-12-04 15:30  hardaker
+
+	- (NEWS, README): updates.
+	
+2000-12-04 14:48  marz
+
+	ensure mibload.t uses correct MIBDIR for testing
+	
+2000-12-04 11:05  hardaker
+
+	- (AGENT.txt, FAQ, README): convert url's to www.netsnmp.org.
+	
+2000-12-04 08:45  hardaker
+
+	- (NEWS): agentx note changes.
+	
+2000-12-03 07:29  nba
+
+	- snmptrapd_log.c: fox missing leading zeroes for %.2d like formats.
+		Add an alternate format for up-time displays.
+	
+2000-12-02 18:22  marz
+
+	found the uninitialized data bug...must have been in there dormant for a while, other test fixes - good to go!
+	
+2000-12-01 16:36  hardaker
+
+	- (agent/snmpd.c): reference sourceforge.
+	
+2000-12-01 16:35  hardaker
+
+	- (AGENT.txt): reference sourceforge.
+	
+2000-12-01 16:34  hardaker
+
+	- (TODO): reference net-snmp-coders.
+	
+2000-12-01 16:34  hardaker
+
+	- (README): update.
+	
+2000-12-01 16:33  hardaker
+
+	- (bug-report, agent/mibgroup/versiontag): remove the bug report script.
+	
+2000-12-01 16:31  hardaker
+
+	- (PORTING): reference sourceforge.
+	
+2000-12-01 16:23  hardaker
+
+	- (man/snmptrapd.conf.5.def): mention the fact that snmpv3 traps are
+	  the same as snmpv2 traps.
+	
+2000-12-01 16:23  hardaker
+
+	- (NEWS): update.
+	
+2000-12-01 15:31  hardaker
+
+	- (README): update.
+	
+2000-12-01 15:16  hardaker
+
+	- (snmpd.conf.5.def): update for proxy support.
+	
+2000-12-01 14:36  hardaker
+
+	- (FAQ): update a few things.
+	
+2000-12-01 14:28  nba
+
+	- mib.c: diagnose wrong quoting in indices
+	
+2000-12-01 14:23  nba
+
+	- parse.c: add RFC-1213 as an aliase for RFC1213-MIB (used in many mibs)
+	
+2000-12-01 14:19  nba
+
+	- smux.c: reformat some debug messages for readability
+	
+2000-12-01 14:17  nba
+
+	- interfaces.c: fix ifType values for Linux
+	
+2000-12-01 14:14  nba
+
+	- subagent.c: supply a missing return value
+	
+2000-12-01 10:04  hardaker
+
+	- (snmpconf): quote things with spaces in them.
+	
+2000-12-01 09:49  hardaker
+
+	- (snmpconf.1): quick man page for snmpconf.
+	
+2000-12-01 09:15  hardaker
+
+	- (local/snmpconf.dir/snmpd.conf/monitor): cleanups.
+	
+2000-12-01 09:14  hardaker
+
+	- (snmplib/parse.c): change no-parent log message into a warning.
+	
+2000-12-01 09:11  hardaker
+
+	- (agent/mibgroup/agentx/README.agentx): update from Dave.
+	
+2000-12-01 09:10  hardaker
+
+	- (FAQ): update from Dave.
+	
+2000-12-01 07:59  hardaker
+
+	- (agent/agent_trap.c): Patch from Dave Shield:
+	  - support v2->v1 trap conversion.
+	
+2000-12-01 07:56  hardaker
+
+	- (configure, configure.in): typo.
+	
+2000-12-01 07:42  marz
+
+	additional fixes to support targetted builds of perl/SNMP using -NET-SNMP-PATH (and white space removal as my emacs kindly does that for me?)
+	
+2000-11-30 14:06  nba
+
+	- getopt.h, snmp_parse_args.h: extern "C" bracketing
+	
+2000-11-30 14:04  nba
+
+	- snmpd.conf.5.def: fix formatting of smuxpeer token
+	
+2000-11-30 10:31  hardaker
+
+	- (FAQ): Update from Dave.
+	
+2000-11-30 10:18  hardaker
+
+	- (master_request.c): Patch from Dave Shield to fix bad sets for agentx.
+	
+2000-11-30 09:19  hardaker
+
+	- (ov/README): minor corrections, probably still incorrect.
+	
+2000-11-30 09:18  hardaker
+
+	- (local/Makefile.in, snmpconf, acl, basic_setup, monitor, operation,
+	  system, trapsinks):
+	  - grouping support.
+	  - sort-of-quiet output support.
+	  - operation mode support (setting user, group, ports...)
+	
+2000-11-30 09:13  hardaker
+
+	- (snmplib/read_config.c): save a warning header at the top of the
+	  persistent data file.
+	
+2000-11-30 09:11  hardaker
+
+	- (agent/mibgroup/tunnel/tunnel.c): Cleanup patch from Frank Strauss.
+	
+2000-11-30 09:10  hardaker
+
+	- (agent/snmpd.c): set DS_AGENT_NO_ROOT_ACCESS in -H help output.
+	
+2000-11-30 09:08  hardaker
+
+	- (configure, configure.in): mention the TUNNEL-MIB support.
+	
+2000-11-29 18:21  slif
+
+	Update e-mail address for Slifcak
+	
+2000-11-29 11:34  marz
+
+	fixed order of function checking so that vsnprintf is not found in libdb (BSD db) by mistake
+	
+2000-11-29 05:18  marz
+
+	partial submit to get perl/SNMP tests to pass and update the docs somewhat - still getting cores in notify.t. had to change create_user_from_session to update an existing user incase 2 sessions are started with the same user
+	
+2000-11-28 18:00  marz
+
+	partial submit to get perl/SNMP tests to pass and update the docs somewhat - still getting cores in notify.t. had to change create_user_from_session to update an existing user incase 2 sessions are started with the same user
+	
+2000-11-27 14:37  hardaker
+
+	- (local/snmpconf.dir/snmpd.conf/basic_setup): basic setup series of questions.
+	
+2000-11-27 14:36  hardaker
+
+	- (local/snmpconf.dir/snmpd.conf/acl): typos.
+	
+2000-11-27 14:36  hardaker
+
+	- (local/snmpconf):
+	  - add support for "groups" of items.
+	  - don't use IO::Dir, as its not in the standard perl module distributions.
+	
+2000-11-27 14:34  hardaker
+
+	- (agent/mibgroup/ucd-snmp/dlmod.h): remove unneeded variable reference.
+	
+2000-11-27 14:33  hardaker
+
+	- (agent/snmp_agent.c): Patch from John Naylon:
+	  - fix auto-set support for the agent (and plug a memory leak).
+	
+2000-11-27 13:42  nba
+
+	- snmp.conf.5.def: document tokens extendedIndex and noRangeCheck
+	
+2000-11-27 13:41  nba
+
+	- parse.c: fix a C++ style comment
+	
+2000-11-24 15:14  nba
+
+	- memory_freebsd2.c, vmstat_netbsd1.c: minor fixes for NetBSD 1.5, OPenBSD 2.6
+	
+2000-11-22 13:48  hardaker
+
+	- (mibgroup/ucd-snmp/dlmod.c): Patch from Sean Harding:
+	  - don't export an internal variable.
+	
+2000-11-21 15:17  nba
+
+	- mib.c: fix parsing of oid like 99.13.\"guf\"8
+	
+2000-11-19 13:03  nba
+
+	- SNMP.xs, mib2c.vartypes.conf: The recent specialisation of the Integer
+		types in the parser created problems for the perl module and in turn
+		for mib2c. Sorry for not catching this before pre2 :-(
+	
+2000-11-19 12:58  nba
+
+	- fixes to ./configure --with-defaults --enable-mini-agent; make install
+		and run the tools under cygwin. Haven't tried the agent yet :-)
+	
+2000-11-18 07:14  hardaker
+
+	- (version.h bug-report sedscript.in): version tag ( 4.2.pre2 )
+	
+2000-11-18 07:12  hardaker
+
+	- (T049snmpv3inform): v3 inform test added.
+	
+2000-11-17 11:01  nba
+
+	- mib.c, snmp_api.c: better error messages for bad snmpset calls and bad
+		indices. Also fix a bug with quoted indices.
+	
+2000-11-17 10:32  hardaker
+
+	- (tests/T050snmpv3trap): test for snmpv3 traps.
+	
+2000-11-17 10:30  hardaker
+
+	- (snmptrapd.c): fix cases where the format strings are specified.
+	
+2000-11-17 10:26  nba
+
+	- IANAifType-MIB.txt: update from IANA
+	
+2000-11-17 08:32  hardaker
+
+	- (master_request.c): Patch from Dave Shield:
+	  - fix memory leaks.
+	  - fix agentx problems with bad sets.
+	
+2000-11-16 17:55  hardaker
+
+	- (snmplib/snmpv3.c): added a space in a debugging output statement.
+	
+2000-11-16 17:54  hardaker
+
+	- (snmplib/read_config.c): simple debugging statement added.
+	
+2000-11-16 17:54  hardaker
+
+	- (snmplib/snmp_api.c): set DS_LIB_APPTYPE if it hasn't been set yet.
+	
+2000-11-16 17:52  hardaker
+
+	- (testing/eval_tools.sh): add CONFIGTRAPD.
+	
+2000-11-16 17:50  hardaker
+
+	- (snmplib/mib.c, testing/tests/T112agentxsetfail,
+	  testing/tests/T122proxysetfail):
+	  - support -Ir for "dont check range/type values" (letter r subject to debate).
+	
+2000-11-16 17:25  hardaker
+
+	- (callback.c): better debugging output to display a callback count when done.
+	
+2000-11-16 16:52  hardaker
+
+	- (T113agentxtrap): A new test to test trap support from agentx subagents.
+	
+2000-11-16 16:50  hardaker
+
+	- (T058agentauthtrap): sleep some and only perform one get request.
+	
+2000-11-16 16:49  hardaker
+
+	- (T054agentv2ctrap): sleep a bit and only send one snmp set request.
+	
+2000-11-16 15:47  nba
+
+	- getopt.c: quell compiler warnings
+	
+2000-11-16 15:31  nba
+
+	- parse.[ch], mib.c, snmp_api.c: rename TYPE_UINTEGER32 back to TYPE_UINTEGER
+	
+2000-11-16 15:16  nba
+
+	- snmptrapd.c, snmptrapd.conf: new config directives format1 and format2 to
+		set log formats for TRAP1 and TRAP2 pdus.
+	
+2000-11-16 13:50  nba
+
+	- snmp_api.c: add functionality to check value types in addition to ranges
+		for snmpset and snmptrap.
+	
+2000-11-16 13:47  nba
+
+	- parse.c: Fix DEFVAL parsing for  OBJECT IDENTIFIER or BITS values
+		(i.e. DEFVAL { { 0 0 } } etc)
+	
+2000-11-16 11:39  hardaker
+
+	- (T058agentauthtrap): add a greater timeout to the get request.
+	
+2000-11-16 11:35  hardaker
+
+	- (example.c):
+	  - send a v2c trap using its own data, not the system_mib's.
+	  - more debugging statements.
+	
+2000-11-16 11:34  hardaker
+
+	- (T053agentv1trap, T054agentv2ctrap, T058agentauthtrap):
+	  - new tests for traps sent by the agent.
+	
+2000-11-16 09:56  hardaker
+
+	- (target.c): Don't delete READONLY trap sessions.
+	
+2000-11-15 16:37  hardaker
+
+	- (testing/tests/T052snmpv2cinform): test inform sending/receiving.
+	
+2000-11-15 16:37  hardaker
+
+	- (apps/snmptrap.c, man/snmptrap.1): support -Ci for sending informs.
+	
+2000-11-15 15:48  hardaker
+
+	- (snmptrapd_log.c): use SNMP_MAXBUF instead of a local length definition.
+	
+2000-11-15 14:18  nba
+
+	- Makefile.in: fix make'ing in remote directory
+	
+2000-11-15 14:11  nba
+
+	- main.c: update to use getopt for argument parsing.
+	
+2000-11-15 14:10  nba
+
+	- snmp_agent.c: fix a confusing indentation.
+	
+2000-11-15 14:09  nba
+
+	- agent_trap.c: make sure community is \0-terminated in targetParamsTable
+	
+2000-11-15 14:03  nba
+
+	- snmptrapd_log: fix a buffer that is way too short for a trap with just a
+		single parameter. Fix a bad limit test in str_append.
+	
+2000-11-15 14:00  nba
+
+	- snmptranslate.c: fix a stupid perror for snmp_perror
+	
+2000-11-15 13:58  nba
+
+	- parse.[ch], mib.c: enhance the parser to distinguish INTEGER, Integer32,
+		Unsigned32, UInteger32.
+	
+2000-11-15 13:55  nba
+
+	snmp_api.c: remove an unused variable
+	
+2000-11-15 07:49  hardaker
+
+	- (snmp_vars.c, subagent.c): Patch from Lawrence Greenfield:
+	  - Don't make init_agent()/subagent_pre_init() exit but return an
+	    error condition instead.
+	
+2000-11-12 08:08  hardaker
+
+	- (ucdDemoPublic.c): add NULL to end of demo string and check for len=0.
+	
+2000-11-12 04:45  nba
+
+	snmp_api.c: Make sure the noRangeCheck token is a boolean
+	
+2000-11-12 04:41  nba
+
+	- mib.c: give the tree-top a name to protect error message when looking up .foo
+	
+2000-11-12 04:36  nba
+
+	- snmptranslate.c: use config_perror for a better error message
+	
+2000-11-12 04:34  nba
+
+	- proxy.c: remove some unused variables.
+	
+2000-11-12 04:33  nba
+
+	-agent_traps.c: Move a conditionally used variable
+	
+2000-11-12 04:32  nba
+
+	Fix a bogus #ifdef
+	
+2000-11-10 09:18  hardaker
+
+	- (configure, configure.in): apply patch #102224 from jbpn for cross-compiling.
+	
+2000-11-10 08:56  hardaker
+
+	- (testing/TESTCONF.sh, testing/eval_tools.sh, testing/tests/T051snmpv2ctrap):
+	 - first pass at a testing script to test trap functionality.
+	   - which even uncovered a bug.
+	
+2000-11-10 08:55  hardaker
+
+	- (apps/snmptrapd.c):
+	  - fork if file logging or syslogging, but not printing.
+	  - don't close open file descriptors.  There shouldn't be any.
+	
+2000-11-10 08:53  hardaker
+
+	- (apps/snmptrapd_log.c): properly null terminate log strings.
+	
+2000-11-09 16:40  hardaker
+
+	- (configure.in): attempt to implement a --with-rsaref flag.
+	
+2000-11-09 15:32  hardaker
+
+	- (README, perl/SNMP/README): mention Karl.
+	
+2000-11-09 15:31  hardaker
+
+	- (NEWS, perl/SNMP/README): mention Karl.
+	
+2000-11-09 14:56  hardaker
+
+	- (examples/bulkwalk.pl, t/bulkwalk.t): patch from Karl Schilke:
+	  - support bulk requests.
+	
+2000-11-09 14:53  hardaker
+
+	- (MANIFEST, README, SNMP.pm, SNMP.xs): patch from Karl Schilke:
+	  - support bulk requests.
+	
+2000-11-08 23:33  hardaker
+
+	- (read_config.c): fix -H output.
+	
+2000-11-08 23:02  hardaker
+
+	- (snmp_agent.c): make agent_check_and_process() call run_alarms().
+	
+2000-11-08 22:45  hardaker
+
+	- (diskio.c): fix OID.
+	
+2000-11-08 17:06  hardaker
+
+	- (SNMP.pm, SNMP.xs): patch from Mark Cavage for default value support.
+	
+2000-11-08 17:03  hardaker
+
+	- (mib.c, parse.c, parse.h): minimal DEFVAL parsing support.
+	
+2000-11-08 16:20  hardaker
+
+	- (config.h.in, configure): check for librsaref, etc, if needed.
+	
+2000-11-07 15:15  hardaker
+
+	- (config.h.in, configure, configure.in, agent/agent_read_config.c,
+	  agent/snmpd.c):
+	  - uid/gid changes.
+	
+2000-11-07 15:10  hardaker
+
+	- (SNMP.xs): fix TYPE_NOTIF -> TYPE_NOTIFTYPE.
+	
+2000-11-07 11:30  hardaker
+
+	- (SNMP/SNMP.pm, SNMP/SNMP.xs): Patch from Joe Clarke:
+	  - implement best-guess (-Ib) parsing.
+	  - access to trap varbinds.
+	  - range access.
+	
+2000-11-07 11:00  hardaker
+
+	- (.cvsignore): ignore build created files.
+	
+2000-11-07 10:58  hardaker
+
+	- (README, SNMP.pm, SNMP.xs): patch from Karl Schilke:
+	  - implement a finish() call.
+	
+2000-11-07 10:54  hardaker
+
+	- (SNMP/SNMP.xs): patch from Karl Schilke:
+	  - multiple callback patch for perl/SNMP/SNMP.xs.
+	
+2000-11-07 10:48  hardaker
+
+	- (read_config.c): log an error message if the optional config file DNE.
+	
+2000-11-07 10:41  hardaker
+
+	- (SNMP.pm): fix iid parsing with respect to mib nodes with a - in it.
+	
+2000-11-07 10:29  hardaker
+
+	- (if_fields.h, interfaces.c, ipMedia.c, ipRoute.c, tcp.c, tcpTable.c,
+	  udp.c, udpTable.c): Patch from Bert Driehuis:
+	  - mibJJ fixes [FreeBSD/other BSD's].
+	
+2000-11-07 10:13  hardaker
+
+	- (agent/agent_read_config.c, agent/ds_agent.h, agent/snmpd.c,
+	  man/snmpd.1.def, man/snmpd.conf.5.def): Patch from Harrie Hazewinkel:
+	  - implement uid/gid changes after startup for the agent.
+	
+2000-11-07 08:33  hardaker
+
+	- (target.c): a better sanity check for session deletion.
+	
+2000-11-07 07:24  hardaker
+
+	- (target.c): Patch from Dave to sanity check param->updateTime.
+	
+2000-11-06 11:00  hardaker
+
+	- (md5.c): check to see that MDsign() data lies on a 32 byte boundry.
+	  - its possible some compilers will choke on this hack.
+	  - fixes bug #12175.
+	
+2000-11-03 17:54  hardaker
+
+	- (mib2c): sort OIDs properly.
+	
+2000-11-03 16:44  hardaker
+
+	- (example.c): Patch from Harrie Hazewinkel:
+	  - fix mib registrations for duplicate OIDs being used for the trap examples.
+	
+2000-11-03 15:31  hardaker
+
+	- (snmpd.c): second patch from dougwarz in bug #117273 to fix smux problems.
+	  - Um, applied correctly this time (I hope).
+	
+2000-11-03 15:29  hardaker
+
+	- (snmpd.c): second patch from dougwarz in bug #117273 to fix smux problems.
+	
+2000-11-02 22:19  nba
+
+	Clean up some unused variables etc.
+	
+2000-11-02 22:16  nba
+
+	- Makefile.in: fix some $(srcdir) references when running outside source
+	
+2000-11-02 22:15  nba
+
+	- snmptrapd.c: fix the format string for format_trap
+	
+2000-11-02 22:14  nba
+
+	- Makefile.in: remove some duplicates from file lists
+	
+2000-11-02 22:12  nba
+
+	Document the -OX output option
+	
+2000-11-02 22:11  nba
+
+	Document the sysservices token
+	
+2000-11-02 16:17  hardaker
+
+	- (agent/mibgroup/ucd_snmp.h): add ucd-snmp/proxy.
+	
+2000-11-02 16:16  hardaker
+
+	- (agent/mibgroup/versiontag): change cvs archive site and package name.
+	
+2000-11-02 13:23  hardaker
+
+	- (smux.c): Patch 102239 from dougwarz to fix a previously bad smux.c patch.
+	
+2000-11-01 16:36  hardaker
+
+	- (version.h bug-report sedscript.in): version tag ( 4.2.pre1 )
+	
+2000-11-01 16:14  hardaker
+
+	- (T120proxyget, T121proxyset, T122proxysetfail): proxy test suite.
+	
+2000-11-01 16:08  hardaker
+
+	- (agent/mibgroup/ucd-snmp/proxy.c, agent/mibgroup/ucd-snmp/proxy.h):
+	  - minimal SET support for the proxy code.
+	
+2000-11-01 10:22  hardaker
+
+	- (T112agentxsetfail): test for agentx sets that should fail properly.
+	
+2000-10-31 14:30  nba
+
+	- tcpTable.c: remove an unnescessary #include
+	
+2000-10-31 14:28  nba
+
+	- smux.c: fix wrong variable length
+	
+2000-10-31 14:25  nba
+
+	- protocol.c: fix some suspicious looking code
+	
+2000-10-31 14:21  nba
+
+	- man/snmpd.conf: fix a typo
+	
+2000-10-31 12:41  nba
+
+	- mib.c: add -OX output format, for just another way of printing indices
+	
+2000-10-31 12:27  nba
+
+	- interface.c: add "interface" config for unguessable interface type/speed
+	
+2000-10-31 12:25  nba
+
+	- apps/*: make sure we report any errindex/errcode in the response
+	
+2000-10-31 12:04  nba
+
+	- protocol.c: clean up unused variables.
+	
+2000-10-31 10:13  hardaker
+
+	- (smux.c): patch #1 from bug #117273 applied to fix smux socket problems.
+	
+2000-10-31 09:24  hardaker
+
+	- (SNMP.xs): print counter64's as unsigned.
+	
+2000-10-31 07:54  hardaker
+
+	- (agent_trap.c, agent_trap.h, subagent.c, snmpNotifyTable.c,
+	  snmpNotifyTable.h): Patch from Dave:
+	  - fix notifications from agentx subagents.
+	
+2000-10-30 22:03  hardaker
+
+	- (smux.c): fix bug #119786: make smux reuse socket address.
+	
+2000-10-30 21:42  hardaker
+
+	- (eval_tools.sh, tests/T110agentxget, tests/T111agentxset):
+	  - fix bug #382
+	  - fix agentx non-root tests to use -x /tmp/blah/agentx_socket.
+	
+2000-10-30 13:45  hardaker
+
+	- (snmpd.1.def): fix a typo pointed out by Chris Pepper.
+	
+2000-10-30 11:46  hardaker
+
+	- (tests/T111agentxset): test script for AgentX set support.
+	
+2000-10-30 11:43  hardaker
+
+	- (tests/T110agentxget): header changed to include the word GET.
+	
+2000-10-30 11:13  nba
+
+	- ucd-snmp/vmstat_*, memory_freebsd2.c, dlmod.c: Make ssRawCpu objects Counters,
+		and add support for *BSD (including OpenBSD)
+	
+2000-10-30 11:07  nba
+
+	- Clean up unused variables.
+	
+2000-10-30 11:04  hardaker
+
+	- (testing/tests/T101agentx, testing/tests/T110agentxget):
+	  - renamed the agentx test script.
+	
+2000-10-30 11:03  hardaker
+
+	- (testing/eval_tools.sh): don't add -c CONFIGFILE if it doesn't exist.
+	
+2000-10-30 10:39  hardaker
+
+	- (agent/snmpd.c): error when parsing -X for non-agentx builds.
+	
+2000-10-27 11:29  hardaker
+
+	- (apps/snmptrapd.c): add -o flag to log to a particular file.
+	
+2000-10-27 10:41  hardaker
+
+	- (snmplib/snmp_api.c): use mkstemp if available.
+	
+2000-10-27 10:40  hardaker
+
+	- (config.h.in, configure, configure.in): Search for mkstemp().
+	
+2000-10-27 10:08  hardaker
+
+	- (FAQ): update linux kernel list to include 2.2.
+	
+2000-10-26 17:51  hardaker
+
+	- (eval_tools.sh): make SKIPIFNOT check the mib module list too.
+	
+2000-10-26 17:48  hardaker
+
+	- (tests/T101agentx): AgentX subagent test for simple get retrieval.
+	
+2000-10-25 17:44  hardaker
+
+	- (snmpd.c): Add -X option to snmpd to run as a subagent.
+	
+2000-10-25 17:06  hardaker
+
+	- (read_config.c): fix for cases whene debugging is always off.
+	
+2000-10-17 15:30  hardaker
+
+	- (config.h.in): autoheader run
+	
+2000-10-16 03:13  daves
+
+	- (agentx/master.c): Specify the length of the (pseudo-)answer to a request.
+		This allows it to be cached correctly for multi-pass SET handling.
+	
+2000-10-16 03:11  daves
+
+	- (agentx/subagent.c): Don't overwrite saved mode information
+		This should help with (some of) the SET handling problems.
+	
+2000-10-16 01:56  daves
+
+	- (agentx/master_request.c): Don't free callback data structure.
+		This holds information that needs to persist across multi-pass requests.
+		I realise that this introduces a memory leak, but this isn't the
+		correct place to handle this.
+	
+2000-10-12 14:52  hardaker
+
+	- (snmpd.c): add -I to the help output.
+	
+2000-10-12 14:24  hardaker
+
+	- (agent/dlmods/*): remove obsolete versions
+	
+2000-10-12 14:08  hardaker
+
+	- (configure): update.
+	
+2000-10-12 14:01  hardaker
+
+	- (acconfig.h, config.h.in, configure.in): Patch from Matt Braithwaite:
+	  - udp configuration changes to check for misc structure definitions.
+	
+2000-10-12 13:48  hardaker
+
+	- (TUNNEL-MIB.txt): TUNNEL-MIB definition.
+	
+2000-10-12 13:48  hardaker
+
+	- (tunnel.h): config_add_mib(TUNNEL-MIB).
+	
+2000-10-12 13:47  hardaker
+
+	- (tunnel.h, tunnel.c, tunnel.h): Patch from Frank Strauss:
+	  - implement the TUNNEL-MIB.
+	
+2000-10-10 14:33  mslifcak
+
+	Fix unlink_tree for "top level" tree nodes.
+	
+2000-10-10 11:02  hardaker
+
+	- (Makefile.in): reverse library link ordering again...
+	
+2000-10-10 09:03  mslifcak
+
+	Remove relative path to include system.h.
+	
+2000-10-10 06:53  mslifcak
+
+	Remove unneeded decl of vsnprintf without stdarg/varargs decl of va_list.
+	
+2000-10-10 05:15  mslifcak
+
+	Apply patch for DEC Alpha EV6, supplied by Shumon Huque<shuque@isc.upenn.edu>
+	
+2000-10-09 17:06  mslifcak
+
+	patch to fix leading zero error introduced by changes for shutdown_mib.
+	
+2000-10-09 15:51  hardaker
+
+	- (dlmod.c): minor debugging output additions.
+	
+2000-10-09 15:51  hardaker
+
+	- (Makefile.in): move auto_nlist to libucdmibs.
+	
+2000-10-09 11:43  hardaker
+
+	- (FAQ, README): add new mirror.
+	
+2000-10-09 10:26  mslifcak
+
+	Move config- and store-related cleanup from shutdown_mib to snmp_shutdown.
+	
+2000-10-09 02:36  daves
+
+	- (mibII/interfaces.c): Qualify an individual interface type test symbol
+		(Qn: should any/all of the others be qualified as well?)
+	
+2000-10-06 08:56  mslifcak
+
+	Support for shutdown_mib - clearing the MIB trees and configured registrations.
+	
+2000-10-06 05:33  mslifcak
+
+	Plug memory leak for ucd-supplied setenv on Win32 platform.
+	
+2000-10-06 04:58  mslifcak
+
+	Remove unused variables.
+	
+2000-10-05 23:45  nba
+
+	- mib.c: fix silly bug in new oid parser, when leaving the tree and going
+		into sub-ids we know nothing about
+	
+2000-10-05 16:03  hardaker
+
+	- (Makefile.in): Patch from Harrie Hazewinkel:
+	  - fix library dependency order.
+	
+2000-10-04 17:59  hardaker
+
+	- (Makefile.in): install "extending" snmpconf file.
+	
+2000-10-04 17:58  hardaker
+
+	- (extending): add snmpconf support for extending the agent (pass, exec, ...)
+	
+2000-10-04 17:58  hardaker
+
+	- (monitor): misc updates and add "file" watching.
+	
+2000-10-04 17:57  hardaker
+
+	- (acl): don't specify line specifications for default snmpconf usage.
+	
+2000-10-04 14:50  nba
+
+	- FAQ: fix a confusion between "omit" and "include"
+	
+2000-10-04 13:25  hardaker
+
+	- (pass_persist.c): opaques in pass_persist.
+	
+2000-10-04 10:35  hardaker
+
+	- (pass.c): support opaque return types.
+	
+2000-10-04 07:15  mslifcak
+
+	Fix parsing problem for -Pc option; reported by Christian Mautner.
+	
+2000-10-04 07:02  mslifcak
+
+	qualify new i/f types.
+	
+2000-10-04 06:52  mslifcak
+
+	qualify symbols for new i/f types.
+	
+2000-10-04 06:51  mslifcak
+
+	Terminate list to compile (add a comma).
+	
+2000-10-04 00:18  nba
+
+	- snmptable.c: index columnt (-Ci) width not properly computed when using
+		GETBULK
+	
+2000-10-03 18:19  hardaker
+
+	- (agent_registry.c, agent_registry.h, snmpd.c): Patch from John Naylon:
+	  - add a passback argument to register_readfd() callbacks.
+	
+2000-10-03 18:17  hardaker
+
+	- (Makefile.in): Patch from Harrie Hazewinkel:
+	  - move auto_nlist.o/lo to libucdagent since some mib-modules need it.
+	
+2000-10-03 18:07  hardaker
+
+	- (smux.c): Patch from Jochen Friedrich:
+	  - fix getnext requests to subagents.
+	
+2000-10-03 17:26  hardaker
+
+	- (mibJJ/interfaces.c): Patch from Frank Strauss:
+	  - better iftype guessing.
+	
+2000-10-03 17:24  hardaker
+
+	- (interfaces.c): Patch from Frank Strauss:
+	  - better iftype guessing.
+	
+2000-10-03 16:52  hardaker
+
+	- (smux.c): Patch from Doug Warzecha:
+	  - fix oid parsing in traps.
+	
+2000-10-03 16:23  hardaker
+
+	- (example.c, example.h): example of coding a v2 trap from someone who
+	  I have very sadly forgotten.  I've been looking for that message for
+	  a while to properly attribute this patch.  Sigh.
+	
+2000-10-03 16:21  hardaker
+
+	- (snmp_agent.c): Patch from Douglas Warzecha:
+	  - snmpd returns wrong error index on SNMPv1 request (BUG#375).
+	
+2000-10-03 09:12  mslifcak
+
+	Fix null deref of ss->community, reported by Jim Pickering.
+	
+2000-10-03 08:03  mslifcak
+
+	Casting to fix problems building with aCC
+	Thanks to Markku Laukkanen <pky@moremagic.com>
+	
+2000-10-03 05:59  mslifcak
+
+	Remove chdir to undo fix for (BUG#298)
+	
+2000-10-02 21:41  nba
+
+	- mib.c: Escape " and \ in text strings.
+	
+2000-10-02 21:39  nba
+
+	- snmp_logging.c: #include <netinet/in.h>
+	
+2000-10-02 21:38  nba
+
+	- Makefile.in: fix a missing $(srcdir) during make install of mib2c
+		configuration files
+	
+2000-10-02 21:37  nba
+
+	- snmpset.c: Do a exit(2) for failure in setting the variable.
+	
+2000-10-02 21:36  nba
+
+	- hr_swrun.c: add a safeguard for very long argument lists.
+	
+2000-10-02 21:34  nba
+
+	- hr_disk.c: Add a name pattern that matches x86 IDE disks for Solaris.
+	
+2000-10-02 21:33  nba
+
+	- kernel_sunos5.c: make the buffer for SIOCGIFCONF dynamic.
+	
+2000-10-02 11:41  hardaker
+
+	- (Makefile.in): install snmpusm.h.
+	
+2000-10-02 10:48  hardaker
+
+	- (snmpconf):
+	  - new options for installing created files.
+	  - more comments in the code.
+	  - allow reading a .conf directly to writing for auto-commenting .conf files.
+	  - misc.
+	
+2000-10-02 10:47  hardaker
+
+	- (agent/mibgroup/Makefile.in, agent/Makefile.in): make depend-less.
+	
+2000-10-02 09:35  hardaker
+
+	- (snmp_agent.c): protect against 0 byte statP mallocs.
+	
+2000-10-02 09:14  hardaker
+
+	- (interfaces.c): Patch from Ted Rule:
+	  - fix interfaces.c for variable length number formatting in /proc/net/dev.
+	
+2000-10-01 16:40  mslifcak
+
+	Per Niels recommendation, chdir to PERSISTENT_DIRECTORY (re: bug #298)
+	
+2000-09-30 08:57  mslifcak
+
+	Fix DEBUGMSGTL not found error for builds without dlmod support.
+	Thanks to simon@zid.tuwein.ac.at
+	
+2000-09-30 08:50  mslifcak
+
+	Fix some kernel symbols - thanks to simon@zid.tuwien.ac.at
+	
+2000-09-29 14:35  hardaker
+
+	- (*/Makefile.in): make depend + .o -> .lo fixes.
+	
+2000-09-29 14:27  hardaker
+
+	- (makefileindepend.pl): skip empty depend lines.
+	
+2000-09-29 14:09  hardaker
+
+	- (snmpconf): drop duplicate lines from read in snmpd.conf files.
+	
+2000-09-29 13:46  hardaker
+
+	- (snmpconf): sort unknown directives by filetype (whoops).
+	
+2000-09-29 13:42  hardaker
+
+	- (monitor): minor wording adjustments.
+	
+2000-09-29 13:42  hardaker
+
+	- (snmpconf): print more information/comments to the screen.
+	
+2000-09-29 11:31  hardaker
+
+	- (var_struct.h): increase registration name length to 32 from 16 (Bug #172)
+	
+2000-09-29 11:12  hardaker
+
+	- (snmp_api.c): incorrect val length passed to parse_unsigned_int (Bug #339).
+	
+2000-09-29 11:01  hardaker
+
+	- (snmp_api.c): fix Bug#353 for hostnames that look like "5w".
+	  - don't interprete them as an ip-port.
+	
+2000-09-29 10:39  hardaker
+
+	- (snmp_alarm.c): Patch from jbpn@cambridgebroadband.com:
+	  - There is a peculiarity in the snmp_alarm_unregister function in
+	    snmplib/snmp_alarm.c which can cause a segmentation fault. (Bug #367)
+	
+2000-09-29 10:34  hardaker
+
+	- (snmpTargetParamsEntry.c): Patch from John Naylon:
+	  - fix use of NULL timestamp pointer in new row creation (Bug #346)
+	
+2000-09-28 14:38  nba
+
+	- mib_api.3: add a few functions to the header
+	
+2000-09-28 14:14  nba
+
+	- snmptrap.c: remove an extraneous snmp_free_pdu
+	
+2000-09-28 14:13  nba
+
+	- man/: add man entries for many library functions (pointing to snmp_api.3)
+	
+2000-09-28 11:09  mslifcak
+
+	remove second copy of sys/socket.h
+	
+2000-09-28 11:08  mslifcak
+
+	For building on Ultrix V4.x
+	
+2000-09-27 12:59  hardaker
+
+	- (dlmod.h): add the UCD-DLMOD-MIB to the default load list.
+	
+2000-09-27 12:55  hardaker
+
+	- (config.h.in, configure, configure.in, ucd_snmp.h, dlmod.c):
+	  - include ucd-snmp/dlmod by default.
+	  - build code only if dlopen is found.
+	
+2000-09-27 08:31  hardaker
+
+	- (auto_nlist.c): Patch from Harrie Hazewinkel:
+	  - don't print kernel based warning messages when -r, etc, is specified.
+	
+2000-09-26 16:07  hardaker
+
+	- (displaytable.pm): minor bug fixes.
+	
+2000-09-26 14:21  hardaker
+
+	- (displaytable.pm, manager.pm):
+	  - displatable supports -mark/-onmarked.
+	  - user's oncall schedule is modifiable via the web.
+	
+2000-09-26 13:17  mslifcak
+
+	For Win32 API: Declare strtoul, vsnprintf; Enable reverse BER encoding.
+	
+2000-09-26 13:15  mslifcak
+
+	Include system.h (vsnprintf decl)
+	
+2000-09-26 13:14  mslifcak
+
+	Fix unsigned comparison.
+	
+2000-09-26 13:14  mslifcak
+
+	Fix unsigned comparisons.
+	
+2000-09-26 13:13  mslifcak
+
+	Fix signed comparison; Remove unused var.
+	
+2000-09-26 13:12  mslifcak
+
+	Include getopt.h (optarg decl); Remove unused var.
+	
+2000-09-26 13:11  mslifcak
+
+	Match Initialise_Table args 3,4 declarations with definitions.
+	
+2000-09-26 12:58  hardaker
+
+	- (interfaces.c): make the adminstatus RONLY.
+	
+2000-09-26 10:21  hardaker
+
+	- (mib2c): chomp($1) is illegal.
+	
+2000-09-26 03:04  mslifcak
+
+	Explicitly build path to CACHEFILE, as not all C compilers support "##".
+	
+2000-09-25 17:49  hardaker
+
+	- (displaytable.pm): Wes actually documented something?  you must be kidding!
+	
+2000-09-25 16:56  mslifcak
+
+	chdir just before sending coldstart trap, to allow for paths to be
+	resolved.
+	
+2000-09-25 15:08  hardaker
+
+	- (displaytable.pm): minor graphing changes
+	
+2000-09-25 09:35  mslifcak
+
+	case insensitive token search (use strcasecmp).
+	
+2000-09-22 06:03  nba
+
+	 -mibs/: MIB updates
+	
+2000-09-22 05:55  nba
+
+	- mibs/: MIB updates
+	
+2000-09-22 05:52  nba
+
+	- snmp_api.c: support setting of BITS variables
+	
+2000-09-22 05:50  nba
+
+	- snmpstatus.c: show error object
+	
+2000-09-22 04:29  nba
+
+	- snmpusm.c: issue error message with object
+	
+2000-09-22 04:28  nba
+
+	- system.h: provide prototypes for strtol, strtoul, snprintf, vsnprintf
+	
+2000-09-22 04:27  nba
+
+	- vacm_vars.c: protect against overrun of strings
+	
+2000-09-21 16:17  nba
+
+	- apps/: display failed object when one is identified by pdu->errindex
+	
+2000-09-21 15:59  hardaker
+
+	- (Makefile.in, snmpdf.1): document the snmpdf command.
+	
+2000-09-21 15:50  nba
+
+	- snmptable: use GETBULK to collect data when protocol allows it. Add
+		-CB options to fall back to GETNEXT.
+	
+2000-09-21 15:38  nba
+
+	- mib.c: rewrite index handling in object ids, to allow symbolic enums.
+		Add Daves suggested -Ov output. Also enhace -Td output to
+		destinguish OBJECT-TYPE from TRAP-TYPE, MODULE-IDENTITY etc.
+	
+2000-09-21 15:31  hardaker
+
+	- (snmpdf.c): use the UCD-SNMP-MIB's dskTable if the
+	  HOST-RESOURCES-MIB is empty or if -Cu is specified on the command line.
+	
+2000-09-21 15:28  nba
+
+	- parse.c: add ability to collect VARIABLES/OBJECTS for TRAP-TYPE
+		and NOTIFICATION-TYPE. Ignore files that does not have DEFINITIONS
+		as their second token. Enhance -Td output accordingly.
+	
+2000-09-21 15:22  nba
+
+	- snmplib: add snprintf, strtol, strtoul for systems that don't have them
+	
+2000-09-21 15:10  hardaker
+
+	- (mib.h): add fake struct definition for enums
+	
+2000-09-21 14:16  nba
+
+	file strtoul.c was initially added on branch V4-1-1-patches.
+	
+2000-09-21 14:16  nba
+
+	file strtol.c was initially added on branch V4-1-1-patches.
+	
+2000-09-21 14:16  nba
+
+	file snprintf.c was initially added on branch V4-1-1-patches.
+	
+2000-09-21 06:16  hardaker
+
+	- (mib.c, mib.h): make sprint* non-static (bug #132).
+	
+2000-09-21 00:25  hardaker
+
+	- (snmp_alarm.c): Patch from John Naylon:
+	  - fix bug #360 where a client might remove a alarm registration
+	    during a call to the alarm function and invalidate the pointer
+	    being used by the calling function.
+	
+2000-09-21 00:22  hardaker
+
+	- (configure, configure.in): --disable-shared by default in cvs checkouts.
+	
+2000-09-20 17:31  hardaker
+
+	- (snmpconf): space indent tokens if # prepended.
+	
+2000-09-20 17:30  hardaker
+
+	- (snmpTargetAddrEntry.c, snmpTargetParamsEntry.c): null internal help lines.
+	
+2000-09-20 17:29  hardaker
+
+	- (Makefile.in, monitor): disk, proc, and load checks.
+	
+2000-09-20 17:28  hardaker
+
+	- (authopts): fix valid answers for auth and priv types.
+	
+2000-09-20 17:27  hardaker
+
+	- (vacm_vars.c, usmUser.c, snmpv3.c): NULL out help messages for .conf
+	  tokens that are either internal or no longer the standard way of
+	  doing things.
+	
+2000-09-20 17:26  hardaker
+
+	- (configure, configure.in): export SNMPCONFPATH to Makefiles
+	
+2000-09-20 17:25  hardaker
+
+	- (EXAMPLE.conf.def): minor correction of table name.  More errors exist.
+	
+2000-09-20 16:46  hardaker
+
+	- (Makefile.in, debugging, mibs, output): more snmp.conf snmpconf config files.
+	
+2000-09-20 15:17  hardaker
+
+	- (Makefile.in, authopts): snmp.conf support for basic authentication options.
+	
+2000-09-20 14:55  hardaker
+
+	- (snmpconf):
+	 - don't force reading of /usr/local/share/snmpd.conf.
+	 - don't print unknown directive comment headers if there aren't any.
+	
+2000-09-20 14:45  hardaker
+
+	- (snmpconf): space things out on the screen a bit better.
+	
+2000-09-20 14:44  hardaker
+
+	- (trapsinks): add port number option to trapsink directives.
+	
+2000-09-20 14:35  hardaker
+
+	- (Makefile.in, snmpconf): install snmpconf and its various support files.
+	
+2000-09-20 14:20  hardaker
+
+	- (snmp_api.c, snmp_api.h): do reverse v3 header encoding with a static buffer.
+	
+2000-09-20 11:37  hardaker
+
+	- (snmpconf): misc updates and improvements.
+	
+2000-09-20 08:54  hardaker
+
+	- (snmp_api.c): Fix dynamic array  problem pointed out by Jochen Kmietsch.
+	
+2000-09-20 02:05  daves
+
+	- (agentx/protocol.c): Don't include context strings on PDUs that shouldn't have them
+		(Thanks to Pedro Pereira for identifying this)
+	
+2000-09-19 17:07  hardaker
+
+	- (acl, system, trapsinks): initial snmpconf description files.
+	
+2000-09-19 17:06  hardaker
+
+	- (snmpconf): read older configuration files in and merge with new results.
+	
+2000-09-19 14:40  hardaker
+
+	- (snmp_api.c): print pdu type on debugging dump output.
+	
+2000-09-19 14:15  hardaker
+
+	- (asn1.c, snmp.c): reverse encoding support for specialized opaque
+	  datatypes (float, double, etc).
+	
+2000-09-19 14:15  hardaker
+
+	- (aclocal.m4): document macros a bit more for submission to the
+	  autoconf macro library.
+	
+2000-09-19 08:30  mslifcak
+
+	Fix bug #295 reported by John Whitney johnw@aiinet.com
+	
+2000-09-18 14:59  hardaker
+
+	- (snmp_vars.h, snmpd.h): Patch from Harrie Hazewinkel:
+	  - move getStatPtr definition to proper .h file.
+	
+2000-09-18 14:55  mslifcak
+
+	Fix bug #347 reported by das_deniz@yahoo.com: make sbin install dir
+	
+2000-09-14 09:05  hardaker
+
+	- (agent_read_config.c, snmpd.conf.5.def): Patch from Harrie Hazewinkel:
+	  - add a port specification snmpd.conf token.
+	
+2000-09-14 08:52  hardaker
+
+	- (agent_trap.c): ignore output of gethostbyname for trap session adding.
+	
+2000-09-13 15:06  hardaker
+
+	- (snmpconf): new utility to generate .conf files by prompting the
+	  user with questions.
+	
+2000-09-08 13:07  hardaker
+
+	- (proxy.c): Patch from Scott Lipcon:
+	  - fix proxy support for null length strings.
+	
+2000-09-07 10:12  hardaker
+
+	- (config.h.in, configure, configure.in):
+	 - fix openssl checks.
+	 - run autoheader.
+	
+2000-09-05 13:35  mslifcak
+
+	Minor touchups to build on Win32 platform.
+	
+2000-09-05 13:34  mslifcak
+
+	Welcome the newest ucd-snmp applications to the Win32 builds.
+	
+2000-09-04 15:19  nba
+
+	- read_config.c: restart errorcount when reloading config
+	
+2000-09-04 15:12  nba
+
+	- snmpnetstat.1: align man page with program
+	
+2000-09-04 15:10  nba
+
+	- ipAddr.c: remove a bad ntohl for OpenBSD
+	
+2000-09-04 15:09  nba
+
+	- mibincl.h, {tc,ud}p{,Table}.c: ensure just one include of socket.h
+		to make unprotected include file in Ultrix happy
+	
+2000-09-04 15:05  nba
+
+	- configure.in: make --without-libwrap work
+	
+2000-09-01 15:14  hardaker
+
+	- (vmstat_solaris2.c, vmstat_solaris2.h): Patch from Jochen Kmietsch:
+	  - updated code.
+	
+2000-09-01 11:54  hardaker
+
+	- (snmptrapd.c): Scott Lipcon noted that snmptrapd doesn't support -T.
+	
+2000-08-30 13:28  nba
+
+	- parse.c: fix loop in syntax error in DEFVAL clause. Also fix reading
+		of .index file with filenames containing blanks.
+	
+2000-08-28 13:43  marz
+
+	minor syntax glitch in POD docs
+	
+2000-08-24 01:55  daves
+
+	- (apps/snmptable.c): Fix bug with displaying header-less indexed tables
+		(Thanks to Ernie Miller)
+	
+2000-08-19 11:29  mslifcak
+
+	Apply patch from <Christoph.Mammitzsch@tu-clausthal.de>
+	to fix sign in asn_rbuild_unsigned_int .
+	
+2000-08-18 04:18  mslifcak
+
+	restore previous version; openbsd, solaris, linux build ok.
+	
+2000-08-18 03:44  mslifcak
+
+	remove unused printf argument passed to snmp_log.
+	
+2000-08-18 03:20  mslifcak
+
+	fix bug 253 with patch supplied by Jeffrey Honig <jch@bsdi.com>
+	
+2000-08-18 02:52  mslifcak
+
+	fix bug 318 - test 9 and 10 explicitly create the test user.
+	
+2000-08-17 13:42  mslifcak
+
+	The battle to trim newlines correctly continues...reduce length by one.
+	
+2000-08-16 15:04  hardaker
+
+	- (snmp_api.c, snmpusm.c): fix various encryption/decryption problems.
+	
+2000-08-16 15:03  hardaker
+
+	- (scapi.c): fix padding size in encryption.
+	
+2000-08-16 14:48  hardaker
+
+	- (scapi.c): set plaintext length at the end of sc_decrypt.
+	
+2000-08-15 05:08  mslifcak
+
+	Fix bug 284 with a short explanation about snmp.conf.
+	
+2000-08-15 03:00  mslifcak
+
+	Fix bug 283 - umask 022, make install. Thanks to csaba.toth@szk.bke.hu
+	
+2000-08-15 00:09  nba
+
+	- snmptest.c: overhaul input_variable, kill newline
+	
+2000-08-14 22:05  nba
+
+	- aclocal.m4, configure.in: fixes for configure --silent
+	
+2000-08-14 17:27  hardaker
+
+	- (Makefile.top, configure, configure.in):
+	  - --enable-silent-libtool to make Niels smile.
+	
+2000-08-14 17:17  hardaker
+
+	- (snmpv3.c, snmpv3.h): implement a new (default) engineID type based
+	  on a random number, and a timestamp.
+	  - I think it won't invalidate existing installations (heh).
+	
+2000-08-14 16:47  hardaker
+
+	- (read_config.c):
+	  - if -Dread_config, then print even no-help tokens and a * for PREMIB ones.
+	
+2000-08-14 14:51  nba
+
+	- (many): portability fixes for OpenBSD 2.6, FreeBSD 4.1, Ultrix 4.5
+	
+2000-08-14 11:33  hardaker
+
+	- (keytools.c): Patch from Yigal Hochberg:
+	  - remove unused context variables.
+	
+2000-08-14 11:29  hardaker
+
+	- (scapi.c): Patch from Yigal Hochberg:
+	  - remove duplicate keylength check.
+	
+2000-08-11 13:09  hardaker
+
+	- (snmp_api.c): optimize reverse encoding of varbindlists.
+	
+2000-08-11 08:55  hardaker
+
+	- (README.mib2c): Patch from Jan Alfred Sandven:
+	  - typos.
+	
+2000-08-11 06:05  nba
+
+	- apps/*: snmpapp -V should not give the usage message too.
+	
+2000-08-11 00:44  nba
+
+	- snmptrapd.8: fix typo. Thanks to G. Allen Morris III <gam3@acm.org>
+	
+2000-08-10 23:23  nba
+
+	- parse.c: predefine ObjectSyntax, ApplicationSyntax, SimpleSyntax and
+		ObjectName
+	
+2000-08-10 16:20  hardaker
+
+	- (Makefile.in, mib2c):
+	  - make mib2c look in $(snmplibdir) for .conf files.
+	  - install mib2c and .conf files.
+	
+2000-08-10 14:33  hardaker
+
+	- (default_store.h, snmp_api.c): dynamically decide to reverse/forward encode.
+	
+2000-08-10 14:31  hardaker
+
+	- (extensible.c): fix CR termination.
+	
+2000-08-10 14:25  hardaker
+
+	- (acconfig.h, config.h.in): define reverse encoding on by default.
+	
+2000-08-10 13:02  mslifcak
+
+	fix bug 252 for configure and sys/socket.h on BSD/OS 4.2
+	
+2000-08-10 09:07  hardaker
+
+	- (asn1.c, asn1.h, snmp.c, snmp.h, snmp_api.c, snmp_api.h, snmpusm.c,
+	  snmpusm.h, snmpv3.c):
+	  - implement reverse encoded messages.
+	    - TODO: clean up, run-time determination of weather to use it or not.
+	
+2000-08-09 15:40  mslifcak
+
+	Fix bug 331 with patch in part provided by John Naylon <jbpn@cambridgebroadband.com>
+	
+2000-08-09 15:27  mslifcak
+
+	no // comment, in deference to non-ANSI-C compilers.
+	
+2000-08-09 07:21  nba
+
+	- hr_swrun.c: fix the RunPath for swapped out Linux process
+	
+2000-08-09 07:21  nba
+
+	- hr_print.c: fix a debug token
+	
+2000-08-09 04:44  nba
+
+	- main.c: fix parsing of -v
+	
+2000-08-09 01:13  daves
+
+	- (mibJJ/ipRoute.h): Omit route_write for now
+	
+2000-08-09 00:58  daves
+
+	- (mibJJ/*): Experimental re-write of mibII
+		(Pilot error when trying to commit the changes earlier - sorry!)
+	
+2000-08-08 10:06  hardaker
+
+	- (extensible.c): strip newlines.
+	
+2000-08-08 08:51  hardaker
+
+	- (snmp_parse_args.c): Patch from Scott Lipcon: start optind at 1 not 0.
+	  -
+	
+2000-08-08 06:36  mslifcak
+
+	Fix bug #295 (free *secStateRef before allocating another one).
+	
+2000-08-08 06:05  mslifcak
+
+	fix bug #298 reported and patch supplied by Conrad Link <clink@ml.com>
+	
+2000-08-08 04:59  nba
+
+	- snmp_api.c: fix a busy loop when alarm queue is active without any
+		outstanding requests
+	
+2000-08-08 04:47  nba
+
+	- snmpset.1: cannot set counters
+	
+2000-08-08 04:42  mslifcak
+
+	Fixed (BUG#332) using patch submitted by John Naylon <jbpn@cambridgebroadband.com>
+	Also consolidated comments about the four send PDU functions.
+	
+2000-08-07 06:59  mslifcak
+
+	Fix leak in reportable errors found by John Naylon <jbpn@cambridgebroadband.com>
+	
+2000-08-07 05:48  nba
+
+	file add_module_replacement.3 was initially added on branch V4-1-1-patches.
+	
+2000-08-07 05:48  nba
+
+	file read_objid.3 was initially added on branch V4-1-1-patches.
+	
+2000-08-07 02:49  nba
+
+	file snmp_set_save_descriptions.3 was initially added on branch V4-1-1-patches.
+	
+2000-08-07 02:49  nba
+
+	file snmp_set_mib_warnings.3 was initially added on branch V4-1-1-patches.
+	
+2000-08-07 02:49  nba
+
+	file read_module_node.3 was initially added on branch V4-1-1-patches.
+	
+2000-08-07 02:49  nba
+
+	file read_module.3 was initially added on branch V4-1-1-patches.
+	
+2000-08-07 02:49  nba
+
+	file read_all_mibs.3 was initially added on branch V4-1-1-patches.
+	
+2000-08-07 02:49  nba
+
+	file read_mib.3 was initially added on branch V4-1-1-patches.
+	
+2000-08-07 02:49  nba
+
+	file print_variable.3 was initially added on branch V4-1-1-patches.
+	
+2000-08-07 02:49  nba
+
+	file print_value.3 was initially added on branch V4-1-1-patches.
+	
+2000-08-07 02:49  nba
+
+	file print_objid.3 was initially added on branch V4-1-1-patches.
+	
+2000-08-07 02:49  nba
+
+	file print_description.3 was initially added on branch V4-1-1-patches.
+	
+2000-08-07 02:49  nba
+
+	file print_mib.3 was initially added on branch V4-1-1-patches.
+	
+2000-08-07 02:49  nba
+
+	file init_mib_internals.3 was initially added on branch V4-1-1-patches.
+	
+2000-08-07 02:49  nba
+
+	file init_mib.3 was initially added on branch V4-1-1-patches.
+	
+2000-08-07 02:49  nba
+
+	file get_module_node.3 was initially added on branch V4-1-1-patches.
+	
+2000-08-07 02:49  nba
+
+	file add_mibdir.3 was initially added on branch V4-1-1-patches.
+	
+2000-08-04 17:13  hardaker
+
+	- (configure, configure.in): add in the notification group by default.
+	
+2000-08-04 17:08  hardaker
+
+	- (notification.h): notification mib wrapper.
+	
+2000-08-04 17:06  hardaker
+
+	- (snmp_parse_args.c):
+	 - initialize optind before calling getopt.
+	 - debugging output.
+	
+2000-08-04 16:56  hardaker
+
+	- (proxy.c): properly set the first (unused) argument to snmp_parse_args().
+	
+2000-08-04 16:53  hardaker
+
+	- (agent_trap.c, snmpNotifyTable.h, snmpTargetAddrEntry.c,
+	  snmpTargetAddrEntry.h, snmpTargetParamsEntry.c,
+	  snmpTargetParamsEntry.h, target.c):
+	  - if using the snmpNotificationTable, insert non-v1 trap sinks into it.
+	
+2000-08-04 05:26  daves
+
+	- (mibgroup/mibJJ.h mibgroup/mibJJ/*): Experimental re-write of mibII
+	
+2000-08-04 05:21  daves
+
+	- (mibgroup/util_funcs.[ch]): New 'cached table' routines
+	
+2000-08-03 08:37  mslifcak
+
+	Fix bug #325 identified by John Naylon <jbpn@cambridgebroadband.com>
+	
+2000-08-03 01:24  nba
+
+	file IP-FORWARD-MIB.txt was initially added on branch V4-1-1-patches.
+	
+2000-08-03 01:24  nba
+
+	file INET-ADDRESS-MIB.txt was initially added on branch V4-1-1-patches.
+	
+2000-08-03 01:24  nba
+
+	file IF-INVERTED-STACK-MIB.txt was initially added on branch V4-1-1-patches.
+	
+2000-08-03 01:24  nba
+
+	file HCNUM-TC.txt was initially added on branch V4-1-1-patches.
+	
+2000-08-02 07:06  mslifcak
+
+	Silent running grep results.
+	
+2000-08-02 06:10  mslifcak
+
+	Fix BUG #291 : allow "255.255.255.255" for text input to ASN_IPADDRESS
+	
+2000-08-02 05:20  mslifcak
+
+	Fix (BUG#323) : free PDU when snmp_send fails.
+	
+2000-08-02 05:06  mslifcak
+
+	Add -p option once to snmpd args.
+	Find MIBDIRS in source tree.
+	Fix condition to set PATH.
+	
+2000-08-01 23:30  nba
+
+	- ip.c: One more #if solaris
+	
+2000-08-01 23:19  nba
+
+	- ip.c: A bad #if ... the proper define to test for Solaris is solaris2
+	
+2000-08-01 16:40  hardaker
+
+	- (snmp_parse_args.c): remove unused usage() typedef.
+	
+2000-08-01 16:40  hardaker
+
+	- (proxy.c, proxy.h): -Wall warning fixes.
+	
+2000-08-01 16:39  hardaker
+
+	- (FAQ): mention newer versions of Solaris.
+	
+2000-08-01 16:37  hardaker
+
+	- (TESTCONF.sh, TESTCONF.sh.in): revert to non-configed TESTCONF.
+	
+2000-08-01 16:31  hardaker
+
+	- (Makefile.top): make un-quiet.
+	
+2000-08-01 10:23  hardaker
+
+	- (snmp-ucd.sh): fix bug #297 (don't kill grep and init script invocations).
+	
+2000-08-01 04:45  mslifcak
+
+	Fix bug found by Yigal Hochberg <hochberg@dmhsoftware.com>
+	
+2000-08-01 03:30  daves
+
+	- (agent/snmp_vars.c): Fix building of complete OID
+		(work with the name originally registered,
+		 not any subsequent division boundaries)
+	
+2000-07-31 20:09  mslifcak
+
+	Remove duplicate fopen from shell_command.
+	
+2000-07-31 18:58  mslifcak
+
+	(TESTCONF.sh.in) - set MIBDIRS to sibling of the testing directory.
+	(RUNTESTS) - allow binaries to be in the "-D bindir" directory.
+	
+2000-07-31 15:25  mslifcak
+
+	Dont adjust PATH if SNMP_PATH is set.
+	Dont add port spec to SNMP_FLAGS if one is already specified.
+	
+2000-07-31 13:49  mslifcak
+
+	Remove test directories for skipped tests.
+	Keep test directories for failed tests.
+	Keep test directories for passed tests when "RUNTESTS -s" is specified.
+	Search config.h at the root of the build tree.
+	
+2000-07-31 11:32  mslifcak
+
+	Merge from automake-1.4: Add for Rhapsody, OpenStep, Cray-T3, SX-4, SX-5
+	
+2000-07-31 11:31  mslifcak
+
+	Merge from automake-1.4: Add for Rhapsody, OpenStep
+	
+2000-07-30 17:38  hardaker
+
+	- (snmpNotifyTable.c, snmpNotifyTable.h, target.c, target.h):
+	  - implement untested filtering function callback for target searches.
+	  - delete unused function.
+	  - misc warning fixes.
+	
+2000-07-30 17:07  hardaker
+
+	- (snmpNotifyFilterProfileTable.c, snmpNotifyFilterProfileTable.h,
+	  snmpNotifyFilterTable.c, snmpNotifyFilterTable.h):
+	  - more notification table implementations for filtering.
+	    - Framework complete, functionality is not.
+	
+2000-07-30 17:05  hardaker
+
+	- (header_complex.c, header_complex.h):
+	  - handle implied objects.
+	  - implement header_complex_get() for simple data retrievals.
+	
+2000-07-28 06:15  mslifcak
+
+	Cleanup include headers to fix bug #307. Thanks to sandven@research.att.com.
+	
+2000-07-27 15:19  hardaker
+
+	- (configure, configure.in): Patch from Vinay Mohta:
+	  - access_hosts() requires an argument so fake one.
+	
+2000-07-27 15:00  hardaker
+
+	- (interfaces.c): Patch from Mattias Barthel:
+	  - fix for interfaces without an attached IP address.
+	
+2000-07-27 14:55  hardaker
+
+	- (vmstat_solaris2.c, vmstat_solaris2.h): Patch from Jochen Kmietsch:
+	  - support raw values.
+	
+2000-07-27 08:25  hardaker
+
+	- (snmpusm.c): print errors to stderr.
+	
+2000-07-27 06:20  nba
+
+	- parse.c: Fix a missing initization when one MIB holds MODULE-COMPLIANCE
+		for another
+	
+2000-07-27 01:35  nba
+
+	- snmp_api.c: Fix pdu->community being overwritten with session->community
+		Thanks to Dana P. Cook <dcook@cabletron.com>
+	
+2000-07-26 22:28  mslifcak
+
+	Update for win32 build: remove unused variables and unpublished method.
+	
+2000-07-26 08:53  hardaker
+
+	- (mib2c.storage.conf): misc changes and improvements.
+	
+2000-07-26 08:53  hardaker
+
+	- (tkmib): Patch from Bert Driehuis:
+	  - translateObj hack.
+	
+2000-07-26 08:49  hardaker
+
+	- (tkmib): Patch from Bert Driehuis:
+	  - remove beginning newline in description clauses.
+	
+2000-07-21 14:00  hardaker
+
+	- (setupdb, snmptosql): only delete history rows once every hour or so.
+	  - too CPU intensive for large tables.
+	
+2000-07-21 12:59  hardaker
+
+	- (setupdb, snmptosql): record and display sysUpTime and others.
+	
+2000-07-21 12:57  hardaker
+
+	- (manager.pm): graphing works again.
+	
+2000-07-21 12:57  hardaker
+
+	- (displaytable.pm): comments, legends, and max/min work again.
+	
+2000-07-17 11:00  hardaker
+
+	- (vmstat_solaris2.h): config_require kernel_sunos5.
+	
+2000-07-12 09:29  hardaker
+
+	- (snmpv3.c): copy key length as well as the key when using the same
+	  privacy key as the auth key.
+	
+2000-07-11 13:34  marz
+
+	added ranges field to SNMP::MIB hash
+	
+2000-07-11 10:05  hardaker
+
+	- (mib.c): Patch from Robert Story:
+	  - make null PREFIX variable possible so non-dot-leading oids are accepted.
+	
+2000-07-11 09:22  hardaker
+
+	- (snmp_agent.c, snmptrapd.c, snmp_api.c, snmp_api.h, snmpusm.c, snmpusm.h):
+	  - make the session pointers indicate weather or not they are
+	    "authoritative", meaning weather they should be learning engineIDs
+	    or reporting on them.
+	  - pass the received-packet session pointer into snmpv3_parse and
+	    usm_proccess_in_msg() to use this flag.
+	  - set isAuthoratative = true in the agent, and unknown in the snmptrapd.
+	
+2000-07-11 08:32  hardaker
+
+	- (snmpv3.c): make the createUser token accept an engineid (-e ARG) to use.
+	
+2000-07-07 01:37  daves
+
+	- (mibII/interfaces.c): Recognise Token Ring interfaces under Linux
+	
+2000-07-06 17:19  hardaker
+
+	- (read_config.c): print generic strings when saving persistent data
+	  where possible.  (IE, check for printable characters before printing hex).
+	
+2000-07-06 17:05  hardaker
+
+	- (TESTCONF.sh, TESTCONF.sh.in): moved TESTCONF.sh to TESTCONF.sh.in
+	  and have the MIBS path variable built by configure since it knows
+	  where the root level source directory is.
+	
+2000-07-06 17:04  hardaker
+
+	- (configure, configure.in, header_complex.c, snmpNotifyTable.c,
+	  asn1.h, snmp_api.c):
+	  - implement IMPLIED index handling.
+	  - make the created USM entries set the storageType and RowStatus
+	    appropriately.
+	
+2000-07-06 17:02  hardaker
+
+	- (snmp_api.h): better comments on a couple of function definitions.
+	
+2000-07-05 07:50  mslifcak
+
+	fix (BUG#290) gracefully handle some PDUs that have no variables.
+	
+2000-07-05 06:46  mslifcak
+
+	[no log message]
+	
+2000-07-04 10:21  hardaker
+
+	- (snmp_vars.c, snmptrapd.c, snmp_api.c, snmp_api.h, snmpusm.c, snmpusm.h):
+	  - remove last remnants of the "initial" user.
+	  - make engineid reports from the usm happen based on the report flag
+	    in the message flag.
+	    - Note: this is a big issue with the SNMPv3 protocol specs.  The
+	      specifications note that you send a report if you are
+	      "authoritative", but don't describe how to know if you are
+	      authoritative or not.  For situations like proxies and
+	      notification receivers, where you are sometimes authoritative
+	      and other times you're not, this is problematic.  The SNMPv3
+	      ASIs do not pass in enough information to determine this and the
+	      WG has proclaimed that the ASIs are not meant to be used as an
+	      API, but the initial work done by NAI and TISLabs attempted to
+	      implement the USM such that it would be a "reference" release
+	      and hence we followed the specifications to the letter and used
+	      the ASIs as APIs just to see if we could.  We could previously
+	      only because we were always either authoritative or
+	      non-authoritative.  Since beginning to work on proxy and the
+	      notification mib, this is no longer possible.  For the record, I
+	      am hereby changing the initial reference release in such a
+	      manner as it no longer conforms exactly to the SNMPv3 ASIs.  So
+	      as not to confuse anyone, this is an entirely theoretical issue
+	      with respect to the SNMPv3 specification and is perfectly legal
+	      to do.  Though I could easily go on, I'll step off my soap box now.
+	
+2000-07-03 10:10  hardaker
+
+	- (agent_callbacks.h, agent_trap.c, agent_trap.h, snmpNotifyTable.c,
+	  snmpTargetAddrEntry.c, snmpTargetAddrEntry.h,
+	  snmpTargetParamsEntry.c, snmpTargetParamsEntry.h, target.c):
+	  - Add a new callback for sending traps.
+	    - Make the notification mib use it.
+	  - make the target mib generate more persistent sessions.
+	  - Make the notification mib always ask the target mib for a session
+	    list, which is now cached directly by the target mib.
+	
+2000-07-03 08:38  mslifcak
+
+	fix (BUG#262) - (some) statements that cannot be reached.
+	
+2000-07-03 07:55  mslifcak
+
+	fix (BUG#287)
+	
+2000-07-03 06:11  mslifcak
+
+	fix bug # 289
+	
+2000-06-30 04:45  mslifcak
+
+	simplify memory allocation in read_config_read_{octet_string, objid}
+	
+2000-06-30 00:47  nba
+
+	- read_config.c: Fix a missing initialization for keywords without help
+	
+2000-06-28 23:37  nba
+
+	- IF-MIB.txt: upgrade to RFC 2863
+	
+2000-06-28 00:58  nba
+
+	- interfaces.c, configure: Irix 6.5 has ifi_baudrate.ifs_value
+	
+2000-06-27 01:34  nba
+
+	- main.c: better option parsing.
+	
+2000-06-27 01:34  nba
+
+	- snmpv3.c: do case insensitive matching of option values.
+	
+2000-06-27 00:33  nba
+
+	- snmptranslate.1: document that -w is also for -Td
+	
+2000-06-27 00:30  nba
+
+	- various man page nit-picking
+	
+2000-06-27 00:28  nba
+
+	- snmptable.c: fixes and usage message for -Ch and -CH
+	
+2000-06-26 23:43  nba
+
+	- Makefile.in, *MIB.txt: update to current RFC version
+	
+2000-06-26 23:42  nba
+
+	- Makefile.mib, mibfetch, smistrip: tools to extract MIBs from RFC
+		documents.
+	
+2000-06-26 23:40  nba
+
+	- parse.c, mib.[ch], snmptranslate.c: add parsing of CHOICE and checks for
+		OBJECT-GROUP and AGENT-CAPABILITIES. This allows us to parse
+		complete MIB extracts from RFC documents.
+	
+2000-06-26 23:38  nba
+
+	- Makefile.top: make libtool silent, so we can see those warnings
+	
+2000-06-26 23:37  nba
+
+	- snmpTargetAddrEntry.c: do a cast to kill a warning
+	
+2000-06-26 23:32  nba
+
+	- agent_trap.c: Fix a leak when request is blocked by VACM and no trap
+		is sent.
+	
+2000-06-26 11:56  mslifcak
+
+	fix (BUG#233)
+	
+2000-06-23 06:42  mslifcak
+
+	replace malloc/memset 0 with calloc.
+	
+2000-06-23 01:08  daves
+
+	- (mibII/kernel_linux.[ch], mibII/ip.c): Added support for ipRoutingDiscards
+		(Thanks to Bryan Blackman)
+	
+2000-06-22 17:09  mslifcak
+
+	remove extra include errormib.h
+	
+2000-06-22 16:50  mslifcak
+
+	Fix bug #276 - close most file descriptors before exec'ing command.
+	
+2000-06-22 15:59  mslifcak
+
+	fgets: use sizeof(buf) in lieu of compiler constant STRMAX.
+	
+2000-06-22 15:53  mslifcak
+
+	Use fewer large static buffers.  pass_persist uses bigger buffers now.
+	
+2000-06-21 14:59  hardaker
+
+	- (manager.pm, snmptosql): record and report sysUpTime.
+	
+2000-06-21 14:31  hardaker
+
+	- (snmptosql): minor sql caching speed optimizations.
+	
+2000-06-21 13:33  hardaker
+
+	- (snmptosql): Ack.  Don't delete stuff from the history table that frequently.
+	
+2000-06-21 12:51  hardaker
+
+	- (snmptosql): better error description support.
+	
+2000-06-21 12:46  hardaker
+
+	- (manager.pm, snmptosql): collect sysDescr, sysObjectId, & versionTag.
+	
+2000-06-21 12:46  hardaker
+
+	- (displaytable.pm): add -selectorder.
+	
+2000-06-21 12:25  hardaker
+
+	- (snmpNotifyTable.c): Uh, only if not deleted.
+	
+2000-06-21 12:23  hardaker
+
+	- (snmpNotifyTable.c): change createAndGo/createAndWait states to active/NIS.
+	
+2000-06-20 20:01  mslifcak
+
+	Declare top_builddir to avoid annoying /libtool not found message.
+	
+2000-06-20 17:30  mslifcak
+
+	Dont assume ANSI C-preprocessor (replace "##" concatenation with sprintf).
+	
+2000-06-20 15:37  mslifcak
+
+	Win32 MS-VC++ build fixups.
+	
+2000-06-20 15:37  mslifcak
+
+	Encapsulate local variable "x" to the scope where needed.
+	
+2000-06-20 15:36  mslifcak
+
+	Remove unused var "newvar".
+	
+2000-06-20 15:36  mslifcak
+
+	Use int vs ulong for array indexing variables to avoid signed/unsigned mismatch.
+	
+2000-06-20 15:34  mslifcak
+
+	Remove unused vars struct tm, time_t.
+	
+2000-06-20 15:34  mslifcak
+
+	Remove unused var "initlist".
+	
+2000-06-20 15:33  mslifcak
+
+	Declare strncasecmp in system.h ; Remove unused var "status".
+	
+2000-06-20 15:31  mslifcak
+
+	Remove unused vars.
+	
+2000-06-20 15:30  mslifcak
+
+	Declare optarg in getopt.h.
+	
+2000-06-20 14:00  hardaker
+
+	- (mib2c.storage.conf): misc minor changes.
+	
+2000-06-20 13:59  hardaker
+
+	- (.cvsignore, snmpNotifyTable.c, snmpNotifyTable.h):
+	  - SNMP-NOTIFICATION-MIB's snmpNotifyTable implemented:
+	    - uses the SNMP-TARGET-MIB to get its addresses from.
+	    - uses header_complex to handle the data.
+	    - much todo:
+	      - dynamic target/notification mib updating without kill -HUP needed.
+	        - this will be a real pain.
+	      - fix v3 related traps still (same usm bug I've been meaning to fix).
+	      - the rest of the SNMP-NOTIFICATION-MIB tables.
+	
+2000-06-20 13:53  hardaker
+
+	- (snmpTargetAddrEntry.c, snmpTargetAddrEntry.h,
+	  snmpTargetParamsEntry.c, snmpTargetParamsEntry.h):
+	- generic target session creation
+	- misc other minor fixes.
+	
+2000-06-20 13:51  hardaker
+
+	- (target.h, target.c, target.h): generic target session creation
+	  based on entries in the SNMP-TARGET-MIB table.
+	
+2000-06-20 13:50  hardaker
+
+	- (header_complex.c): remove Michael's horriblely wrong "fixes".
+	
+2000-06-20 13:48  hardaker
+
+	- (agent_trap.c, agent_trap.h): add remove_trap_session().
+	
+2000-06-20 13:46  hardaker
+
+	- (read_config.c): deal with 0-length persistent strings better.
+	
+2000-06-19 12:32  mslifcak
+
+	Check more alloc failures.
+	
+2000-06-19 12:15  mslifcak
+
+	(protocol.c) Use sizeof(oid), not 4!
+	(client.c) Add _all_ of OID value for agentx_register and agentx_unregister.
+	
+2000-06-19 11:41  mslifcak
+
+	 Removed sizeof(u_char) and unnecessary (unsigned) casts to malloc params.
+	
+2000-06-19 03:04  nba
+
+	Prototype fixup.
+	
+2000-06-19 03:01  nba
+
+	s/conifg/config/ .... Hrrrmmmpf
+	
+2000-06-19 02:58  nba
+
+	- makenosysdepend.pl Makefile.in: object files are now named .lo ...
+	
+2000-06-16 16:01  hardaker
+
+	- (snmpTargetAddrEntry.h): add the SNMPv2-TM mib to the default list.
+	
+2000-06-16 16:01  hardaker
+
+	- (snmpTargetAddrEntry.c, snmpTargetParamsEntry.c): fix incorrect OIDs.
+	
+2000-06-15 06:45  marz
+
+	fat fingers
+	
+2000-06-15 06:42  marz
+
+	add defaults to daemon search path...recalc t/snmptest.cmd everytime per makefile.PL is run
+	
+2000-06-14 16:15  hardaker
+
+	- (manager.pm): fix user preferences.  Columns are optionally
+	  displayable again.
+	
+2000-06-14 16:15  hardaker
+
+	- (snmptosql): fix history deletion.
+	
+2000-06-12 16:43  hardaker
+
+	- (snmpd.conf.5.def): document trapsess.
+	
+2000-06-12 16:39  hardaker
+
+	- (agent_read_config.c, agent_trap.c, agent_trap.h):
+	  - new snmpd.conf token for trap sessions: "trapsess".
+	    - uses snmp_parse_args so any type of trap can be sent with it
+	      modified by any of the parameters that are documented in snmpcmd(1).
+	    - v3 traps don't work due to the same USM problems found in the
+	      recent proxy submissions (my next target).
+	    - -Ci in the argument specifies informs should be used.
+	
+2000-06-12 16:18  hardaker
+
+	- (master_request.c): re-enable freeing of master request.
+	
+2000-06-12 16:17  hardaker
+
+	- (acconfig.h, config.h.in): save exec data to /var/ucd-snmp.
+	  - could cause problems for non-root runs.  Untested.
+	
+2000-06-12 14:12  hardaker
+
+	- (snmptrapd_log.c): Patch from Markku Laukkanen:
+	  - remove ending commas in enum list.
+	
+2000-06-12 10:36  hardaker
+
+	- (setupdb, setupuser, snmptosql): use "Table"s instead of "Entry"s.
+	
+2000-06-12 10:33  hardaker
+
+	- (manager.pm): save mib descriptions for display purposes (again).
+	
+2000-06-12 10:29  hardaker
+
+	- (manager.pm): remove debugging statements.
+	
+2000-06-12 10:27  hardaker
+
+	- (manager.pm): properly sort displayed table columns again.
+	
+2000-06-07 13:23  hardaker
+
+	- (snmp_config.5.def, read_config.c, read_config.h):
+	  - the TYPE.conf parser now accepts tokens from a different .conf
+	    file TYPE if a special "[TYPE]" keyword is inserted into the
+	    .conf file.  See snmp_config(5) for a better description.
+	
+2000-06-07 13:22  hardaker
+
+	- (acconfig.h, config.h.in, configure, configure.in):
+	  - map strtoul to atoi if the function isn't found.
+	
+2000-06-06 14:26  hardaker
+
+	- (INSTALL, green.gif, manager.pm, red.gif, setupauth, setupdb,
+	  setupnewhost, setupuser, snmptosql, snmptosqltable, sqltohtml):
+	  - management cleanup and installation instructions written.
+	  - should be mostly complete (ie, barely functional) for the alpha testers.
+	
+2000-06-06 08:03  hardaker
+
+	- (snmptosql): host name changes -> varchar(64)
+	
+2000-06-06 08:02  hardaker
+
+	- (manager.pm): many minor fixes and changes.
+	
+2000-06-06 08:02  hardaker
+
+	- (displaytable.pm): allow table title setting.
+	
+2000-06-02 11:41  hardaker
+
+	- (.cvsignore): add *.made.
+	
+2000-06-02 11:40  hardaker
+
+	- (Makefile.in, fixproc, ipf-mod.pl, mib2c, tkmib):
+	  - make (and install) perl scripts differently, without modifying the orig.
+	
+2000-06-01 16:47  hardaker
+
+	- (snmptosql): typos.
+	
+2000-06-01 16:44  hardaker
+
+	- (snmptosql):
+	  - debugging to STDERR.
+	  - auto deletion of old historical data.
+	
+2000-06-01 16:44  hardaker
+
+	- (manager.pm): beginnings of a nicer real interface.
+	
+2000-06-01 16:43  hardaker
+
+	- (getValues.pm): some variables were global and hence persistent and
+	  were messing things up.
+	
+2000-06-01 14:48  hardaker
+
+	- (snmpd.c): store persistent data immediately after init'ing to
+	  ensure we update counters and stuff that must change (eg, engineBoots).
+	
+2000-05-31 16:22  hardaker
+
+	- (snmpd.1.def): describe -I.
+	
+2000-05-31 15:52  hardaker
+
+	- (configure, configure.in, mib_modules.c, mib_modules.h, snmpd.c):
+	  - new -I switch to snmpd to do dynamic determinaton of which mib
+	    modules to initialize (and hence which mib tree sections to support).
+	
+2000-05-31 15:50  hardaker
+
+	- (default_store.c, default_store.h): default store routines for void pointers.
+	 - which I immediately decided to do something different for what I
+	   originally implemented it for, so its not being used yet.
+	
+2000-05-31 05:59  daves
+
+	- (mibII/ip.[ch]): Allow IP support without the At/ipNetToMedia module
+	
+2000-05-30 17:11  hardaker
+
+	- (proxy.c, proxy.h): simple proxy support.
+	  - maps one oid inside the agent to a possibly-different oid on a target.
+	  - uses snmp_parse_args() so it takes standard command line config options.
+	  - no set support.
+	  - no kill -HUP support.
+	  - no SNMPv3 support (sigh).
+	
+2000-05-30 15:06  nba
+
+	file IANA-LANGUAGE-MIB.txt was initially added on branch V4-1-1-patches.
+	
+2000-05-30 15:06  nba
+
+	file IANA-ADDRESS-FAMILY-NUMBERS-MIB.txt was initially added on branch V4-1-1-patches.
+	
+2000-05-30 15:06  nba
+
+	file DISMAN-SCHEDULE-MIB.txt was initially added on branch V4-1-1-patches.
+	
+2000-05-30 15:06  nba
+
+	file AGENTX-MIB.txt was initially added on branch V4-1-1-patches.
+	
+2000-05-30 07:47  mslifcak
+
+	Fix problem identified by V. Grenet : new method snmp_oid_min_compare
+	
+2000-05-30 01:31  nba
+
+	file mibfetch was initially added on branch V4-1-1-patches.
+	
+2000-05-30 01:31  nba
+
+	file smistrip was initially added on branch V4-1-1-patches.
+	
+2000-05-30 01:31  nba
+
+	file Makefile.mib was initially added on branch V4-1-1-patches.
+	
+2000-05-26 09:24  daves
+
+	- (mibII/sysORTable.c mibII/system_mib.c):
+	  - Use new time utility routines to simplify processing
+	  - Update sysORLastChange when adding/removing entries
+	
+2000-05-26 09:23  daves
+
+	- (util_funcs.[ch]): New time-diff utility routines
+	
+2000-05-26 08:46  daves
+
+	- (snmpd.c snmp_agent.c mibII/var_route.c): Use 'mibincl.h' header
+	
+2000-05-26 07:48  daves
+
+	- (agent_registry.[ch] agentx/client.[ch]
+	   agentx/master_request.c agentx/subagent.c):
+	   - Support for MIB region timeouts
+	
+2000-05-26 07:46  daves
+
+	- (snmp.h snmp_api.c snmp_client.c): Support for per-request timeout handling
+	
+2000-05-26 07:45  daves
+
+	- (agentx/protocol.c): Minor error in AgentX packet dump
+	
+2000-05-25 10:07  hardaker
+
+	- (memory.c): Patch from Ragnar Kjørstad:
+	  - fixed linux problem: wrong params getting returned.
+	
+2000-05-25 05:38  mslifcak
+
+	Fix use of bin2asc to not always show "string"; use snmp_oid_compare, too.
+	See bug #234 for details.
+	
+2000-05-25 03:39  daves
+
+	- (mibII/interfaces.c): Consolidate header handling.
+	
+2000-05-25 03:31  daves
+
+	- (mibII/interfaces.c): Correct confusing comment
+	
+2000-05-25 01:53  daves
+
+	- (configure.in configure): Replace use of 'cut' with equivalent 'sed' calls
+	
+2000-05-25 01:30  daves
+
+	- (configure.in aclocal.m4 configure):
+	  - Direct certain checks to the appropriate file descriptor (see BUG#247)
+	
+2000-05-22 16:22  hardaker
+
+	- (apps/.cvsignore): add more stuff to ignore.
+	
+2000-05-22 16:21  hardaker
+
+	- (Makefile.in, snmp_parse_args.c, snmp_parse_args.h, snmpbulkget.c,
+	  snmpbulkwalk.c, snmpdelta.c, snmpdf.c, snmpget.c, snmpgetnext.c,
+	  snmpset.c, snmpstatus.c, snmptable.c, snmptest.c, snmptrap.c,
+	  snmpusm.c, snmpvacm.c, snmpwalk.c, Makefile.in, snmp_parse_args.c,
+	  snmp_parse_args.h):
+	  - moved snmp_parse_args to the library, as I promised to do ages ago.
+	    - no longer calls usage() directly, but returns -1 if you should.
+	
+2000-05-22 05:47  daves
+
+	- (snmplib/tools.[ch]): Routine for comparing two markers.
+	
+2000-05-22 05:42  daves
+
+	- (local/mib2c): Generate multiple tables in one code file
+	
+2000-05-17 10:28  hardaker
+
+	- (vacm_vars.c, vacm_vars.h, vacm.c, vacm.h): Patch from Arne Oesleboe:
+	  - writable vacm mib support.
+	  - other misc vacm fixes.
+	
+2000-05-17 10:26  hardaker
+
+	- (snmpusm.c): Patch from Arne Oesleboe:
+	  - Don't segfault on an unknown command, instead print a warning..
+	
+2000-05-17 10:25  hardaker
+
+	- (snmpvacm.c): Patch from Arne Oesleboe:
+	  - added a new command: snmpvacm.
+	
+2000-05-17 09:25  hardaker
+
+	- (agent_read_config.c): mention the port number on the trapsink help line.
+	
+2000-05-17 09:20  hardaker
+
+	- (snmptrapd.c): use standardized buffer sizes
+	
+2000-05-17 09:13  hardaker
+
+	- (Makefile.in, snmptrapd.c, snmptrapd_log.c, snmptrapd.8): Patch from
+	  Jeff Cours:
+	  - customized formatting of trap output.
+	
+2000-05-17 09:11  hardaker
+
+	- (README): add Jeff and Arne.
+	
+2000-05-17 08:15  hardaker
+
+	- (mib.c): *correctly* associate escapeQuotes with the right default_store bool.
+	
+2000-05-17 08:11  hardaker
+
+	- (snmp.conf.5.def): document escapeQuotes.
+	
+2000-05-17 08:09  hardaker
+
+	- (snmpcmd.1, default_store.h, mib.c): new option -OE:
+	  - shell backslash escape quotations marks for cutting and pasting
+	    onto another snmp command line.
+	
+2000-05-15 09:24  daves
+
+	- (mibII/{ip,icmp,tcp,udp,kernel_linux}.[ch]):
+	  -  Pull Linux MIB-II statistics gathering into a single routine.
+	  -  Cache MIB-II statistics on all architectures.
+	
+2000-05-15 08:53  hardaker
+
+	- (ucd_snmp.h, vmstat_bsdi4.c, vmstat_bsdi4.h): Patch from Bert Driehuis:
+	  - vmstat support for bsdi4.
+	
+2000-05-15 03:06  daves
+
+	- (snmp_agent.c): Re-remove redundant PDU clone
+		(It reappeared during a recent change)
+	
+2000-05-15 03:00  daves
+
+	- (agent_registry.[ch] agentx/master_admin.c): Implement missing routine 'unregister_mib_context'
+	
+	- (agent_registry.[ch] agent_index.[ch]): Move 'fd' registry handling back to agent_registry
+	
+	- (agentx/client.c): Recognise new code file for index handling
+	
+2000-05-12 10:15  hardaker
+
+	- (snmp_agent.c): Um, default to port 161.  Opps.
+	
+2000-05-12 09:00  daves
+
+	- (agent_registry.[ch] var_struct.h agentx/master_admin.c):
+	  - Preparation for per-MIB region timeout, and context support
+	
+2000-05-12 08:45  daves
+
+	- (kernel_sunos5.c): Recognise Solaris ATM LAN Emulation interfaces
+		Thanks to Jay Young
+	
+2000-05-12 08:13  daves
+
+	- (agent_index.[ch] agent_registry.[ch] Makefile.in agentx/master_admin.c):
+	  - Split index handling out from the MIB registry.
+	
+2000-05-12 07:02  daves
+
+	- (kernel_sunos5.c): Add support for recognising QuadFastEther interface
+	
+2000-05-12 06:57  daves
+
+	- (apps/snmptable.c): Fix problem with missing separator (with -Ci -Cf)
+		Thanks to Xavier FOURNET
+	
+2000-05-12 04:02  daves
+
+	- (snmp_agent.c): Remove redundant PDU clone
+		I'm sure this was put in for a reason, but I can't remember what.
+		It doesn't seem to be needed now, and just leaks memory.
+		Here's hoping.....
+	
+2000-05-12 03:11  daves
+
+	- (agent/snmpd.c): Catch (and ignore) SIGPIPE signals.
+		Disappearing subagents therefor appear as normal I/O failures
+	
+2000-05-12 02:24  daves
+
+	- (agentx/protocol.c):
+	  - Implement opaque-encoded float & double types
+	  - Bring packet dump in line with the main library style
+	  - Add packet dump capability for outgoing PDUs
+	
+2000-05-10 16:52  hardaker
+
+	- (snmpd.1.def): document -p.
+	
+2000-05-10 16:43  hardaker
+
+	- (snmp_agent.c): always use the default transport mapping, not the last one.
+	
+2000-05-10 16:25  hardaker
+
+	- (ds_agent.h, snmp_agent.c, snmpd.c): implement multiple transport
+	  mappings via -p [transport:]port[@address].
+	
+2000-05-10 11:08  mslifcak
+
+	fix udpstat --> tcpstat
+	
+2000-05-10 07:59  daves
+
+	- (agentx/master_request, agentx/master_admin.c):
+	  - Handle subagent disappearing without warning
+	
+2000-05-10 07:57  daves
+
+	- (agent/snmp_agent.c snmplib/snmp_api.h):
+	  - Provide a mechanism to handle asynchronous send failures.
+	
+2000-05-10 06:13  daves
+
+	- (snmp_api.h): Logical NOT? Bitwise NOT? Who'll notice the difference anyway!
+	
+2000-05-10 05:34  daves
+
+	- (agentx/master_request.c): Handle non-responsive subagents
+	
+2000-05-10 05:33  daves
+
+	- (agent_registry.c mibII/sysORTable.c): Don't assume subsession link is valid
+	
+2000-05-10 05:29  daves
+
+	- (snmp_api.h): Definitions for session closedown handling
+	
+2000-05-09 14:42  mslifcak
+
+	also clean Win32 binary objects, and core files.
+	
+2000-05-09 14:34  mslifcak
+
+	touch up the "clean" rule.
+	
+2000-05-09 11:32  mslifcak
+
+	until Dave's version wins, need snmp_varlist_add_variable to build Win32 agent.
+	
+2000-05-09 11:31  mslifcak
+
+	fix some Win32 builds (signals? we don't need no steenking signals!)
+	
+2000-05-09 11:30  mslifcak
+
+	Remove trailing CR [0x0d] from one line.
+	
+2000-05-09 08:50  hardaker
+
+	- (Makefile.top, Makefile.in, Makefile.in): fix link time problems
+	  with aCC (or any other unknown compiler).
+	
+2000-05-09 08:47  hardaker
+
+	- (Makefile.top, Makefile.in, Makefile.in): fix link time problems
+	  with aCC (or any other unknown compiler).
+	
+2000-05-09 07:43  daves
+
+	- (agentx/master_request.c): Send out re-delegated requests
+		(and fix a problem with specifying the end-of-range value)
+	
+2000-05-09 07:40  daves
+
+	- (agentx/subagent.c): Fix handling of error response generation
+		(by analogy with recent changes to snmp_agent.c)
+	
+2000-05-09 07:34  daves
+
+	- (snmp_agent.c): Handle AgentX "end-of-range" indication.
+		(This is not the cleanest way of doing things,
+		 but works for now.  We can tidy up later).
+	
+2000-05-09 07:16  daves
+
+	- (snmp_vars.c): Use MIB registry 'start' values
+		(rather than the original name registered)
+		This handles subsequent part of 'split' ranges properly.
+	
+2000-05-08 11:08  hardaker
+
+	- (Makefile.in): I can't believe the last checkin even compiled (luck).
+	
+2000-05-08 11:03  hardaker
+
+	- (Makefile.in): fix library list.
+	
+2000-05-05 09:56  hardaker
+
+	- (diskio.c): Patch from Bert Driehuis:
+	  - disk io support for BSD/OS.
+	
+2000-05-05 09:54  hardaker
+
+	- (at.c): Patch from Bert Driehuis:
+	  - fix a zero byte malloc bug (mostly noticed with -lefence).
+	
+2000-05-05 09:43  hardaker
+
+	- (configure, configure.in): Patch from Albert Chin-A-Young:
+	  - --with-libwrap improvements.
+	
+2000-05-05 09:00  daves
+
+	- (agentx/subagent.c agentx/master_request.c):
+	  - Significant improvements to AgentX processing
+		(Thanks to Reiner Beninga)
+	
+2000-05-05 08:58  daves
+
+	- (snmplib/snmp_api.[ch] snmplib/snmp_client.c agent/snmp_agent.[ch]):
+	  - Minor changes to assist with AgentX development
+		(These may not be absolutely necessary, but they get things working again!)
+	
+2000-05-04 16:21  hardaker
+
+	- (configure, configure.in): minor unimportant --without-openssl fix.
+	
+2000-05-04 16:19  hardaker
+
+	- (configure, configure.in): Patch from John L. Villalovos:
+	  - allow --without-openssl to work.
+	
+2000-05-04 16:15  hardaker
+
+	- (Makefile.in): add the DISMAN-SCRIPT-MIB.txt
+	
+2000-05-04 16:01  hardaker
+
+	- (Makefile.in): Patch from Albert Chin-A-Young:
+	  - install UCD-DISKIO-MIB.txt.
+	
+2000-05-04 15:21  hardaker
+
+	- (displaytable.pm, manager.pm): make purdy graphs with history tables.
+	
+2000-05-04 08:26  daves
+
+	- (snmplib/snmp_client.[ch]): New routine 'snmp_clone_varbind()'
+			(From a suggestion by Reiner Beninga)
+	
+2000-05-04 08:24  daves
+
+	- (snmplib/snmp_api.c): Various minor fixes
+		(Thanks to Reiner Beninga)
+	
+2000-05-04 01:29  daves
+
+	- (snmp_agent.[ch]): Handle index/status information separately from PDU.
+		Also means that delegated requests have access to variable indexes
+			(Based on a suggestion from Reiner Beninga)
+	
+2000-05-04 01:00  daves
+
+	- (ucd-snmp/proc.c): Initialize newly malloced structure
+		(Thanks to Jeff Wilson - see BUG #231)
+	
+2000-05-03 09:06  daves
+
+	- (snmp_agent.[ch] agentx/master_admin.c):
+	  - Clone PDU within init_agent_snmp_session.
+	    New routine 'free_agent_snmp_session'
+		(Thanks to Reiner Beninga)
+	
+2000-05-03 08:17  daves
+
+	- (snmp_agent.c): When returning an error response,
+		use a clean copy of the original request PDU.
+	
+2000-05-03 08:14  daves
+
+	- (snmp_agent.[ch]): Routine to handle variables individually
+		(Thanks to Reiner Beninga)
+	
+2000-05-03 04:37  daves
+
+	- (snmp_agent.c): Check accessibility of exact requests before processing
+		(and remove redundant 'generic' SET handling)
+	
+2000-05-02 09:56  hardaker
+
+	- (manager.pm): lots of small changes.
+	
+2000-05-01 11:34  nba
+
+	- mib.c: fix printing of BITS variables
+	
+2000-05-01 06:55  marz
+
+	 applied patch from Steve Pheran Snodgrass to fix incompatibility with perl5.6 ref stringification
+	
+2000-04-29 07:46  hardaker
+
+	- (config.h.in, configure.in, agent_registry.c): Patch from Frank Strauss:
+	  - use sigaction when available.
+	
+2000-04-28 16:22  hardaker
+
+	- (snmptosql): fix -m/-M the wrong way.
+	
+2000-04-28 16:15  hardaker
+
+	- (snmptosql):
+	 - do history saving better (different table).
+	 - -m/-M mib loading options (which don't appear to be working right yet).
+	
+2000-04-28 07:36  hardaker
+
+	- (agent_registry.c, snmpd.c): Patch from Frank Strauss:
+	  - fix signal handling.
+	
+2000-04-27 14:58  hardaker
+
+	- (Makefile.in, snmpdf.c): implement a remote df command via snmp
+	  - (needs the host resources mib working on the remote system).
+	
+2000-04-27 10:57  hardaker
+
+	- (Makefile.top, config.h.in, configure, configure.in): rpm is now
+	  requiring yet another library: libpopt.
+	
+2000-04-26 15:20  hardaker
+
+	- (Makefile.top): run libtool --finish without -n (go ahead and do the cmds)
+	
+2000-04-26 15:19  hardaker
+
+	- (Makefile.top, configure, configure.in, agent/Makefile.in):
+	  - more libtool fixes (.so versioning, properly install...)
+	
+2000-04-26 14:18  hardaker
+
+	- (*/.cvsignore, */Makefile.in, Makefile.top, aclocal.m4, configure,
+	  configure.in, ltconfig, ltmain.sh):
+	  - use libtool for building.
+	    - Certainly, I must have broke something in the process. (make depend, eg)
+	
+2000-04-26 14:15  hardaker
+
+	- (*/.cvsignore, */Makefile.in, Makefile.top, aclocal.m4, configure,
+	  configure.in, ltconfig, ltmain.sh):
+	  - use libtool for building.
+	    - Certainly, I must have broke something in the process. (make depend, eg)
+	
+2000-04-26 08:11  hardaker
+
+	- (FAQ): new secondary slogan.
+	
+2000-04-26 07:22  hardaker
+
+	- (snmp_api.c, snmpusm.c): Attempt to parse the PDU when a report is
+	  being sent so that the requestid can be used in the outgoing report.
+	  This should fix a problem where SNMP Research's Emante agent is
+	  doing engineID discovery probes based on the request_id (which is a
+	  fairly poor choice as the message_id would be a better one to match
+	  on in general and is the only possible thing to use in cases where
+	  the report is encrypted).
+	
+2000-04-25 13:08  hardaker
+
+	- (FAQ): mention that the perl module is included with the source.
+	
+2000-04-25 08:24  hardaker
+
+	- (snmp_api.c): misc -Ddump fixes.
+	
+2000-04-25 08:02  hardaker
+
+	- (snmptable.c): check for end of mib view exceptions (v2c, v3).
+	
+2000-04-24 11:27  hardaker
+
+	- (snmp_api.c): -D support for those "older" protocols that shouldn't
+	  be used anymore (v1, v2c).
+	
+2000-04-24 10:36  hardaker
+
+	- (asn1.c, default_store.h, mib.c, snmp.c, snmp_api.c, snmp_auth.c,
+	  snmp_debug.c, snmp_debug.h, snmpusm.c):
+	  - timestamps can be printed as a numeric number only (-Ot).
+	  - more configurable packet dumping code for both send and receive.
+	    - uses new -D tokens: dumph (headers), dumpx (hex), dumpv
+	      (values).  dumpx_ and dumpv_ (note the _s) make it eat space
+	      (and newline) before the segment in question.  Try -Ddump then
+	      -Ddumph,dumpv_ to see examples.
+	    - todo:
+	      - better horizontally formated information (probably using "%NUMs").
+	      - USM is called after pdu building (makes sense but is backwards
+	        visually in the dumped packet).
+	      - option to strip datatype token (ie Integer:).
+	
+2000-04-24 09:37  hardaker
+
+	- (version.h bug-report sedscript.in): version tag ( 4.2.pre0 )
+	
+2000-04-24 09:13  hardaker
+
+	- (version.h bug-report sedscript.in): version tag ( EXT.4.2.pre0 )
+	
+2000-04-21 14:13  hardaker
+
+	- (snmpwalk.c): fix GET call for an snmpwalk. (was using a GETNEXT PDU, ack).
+	
+2000-04-21 10:41  hardaker
+
+	- (snmpv3.c): more u_long -> size_t for engineID len.
+	
+2000-04-21 08:18  hardaker
+
+	- (mib.c): fix fprint_description to check for null subtrees.
+	
+2000-04-21 08:17  hardaker
+
+	- (snmpv3.c, snmpv3.h): use size_t for engineid lengths.
+	
+2000-04-19 11:02  marz
+
+	changed mode_t typedef to agree with what ActiveState perl uses (anyone have a problem with this?)
+	
+2000-04-19 10:59  marz
+
+	added Marc Lehman patch to ensure alloc/dealloc use same mechanism (perl vs. system default)
+	
+2000-04-19 08:26  hardaker
+
+	- (snmp_agent.c): agent_check_and_process() always block if caller requested it.
+	
+2000-04-19 04:34  mslifcak
+
+	move static decl to .c;minor casting about to support aCC
+	
+2000-04-18 11:11  mslifcak
+
+	Synch devel branch with patches branch.
+	
+2000-04-18 11:07  mslifcak
+
+	Define optarg for apps use; Define vacm_is_configured for agent use.
+	
+2000-04-18 07:57  hardaker
+
+	- (vmstat.c, vmstat.h, UCD-SNMP-MIB.txt): Patch from Mizuki Honda:
+	  - implement raw cpu usage numbers.
+	
+2000-04-18 03:18  daves
+
+	- (man/snmptable.1 apps/snmptable.c):
+	  - Command-specific '-C' options for snmptable
+	
+2000-04-18 02:01  daves
+
+	- (apps/snmp_parse_args.c): Handle previous form of -Z option as well
+	
+2000-04-17 15:36  hardaker
+
+	- (snmp_parse_args.c): fix -Z if args are wrong.
+	
+2000-04-17 15:32  hardaker
+
+	- (snmp_parse_args.c, snmpcmd.1): fix -Z to use a ','.
+	
+2000-04-17 15:06  hardaker
+
+	- (mta_sendmail.c, mta_sendmail.h): Patch from Christoph Mammitzsch:
+	  - update on the sendmail module.
+	
+2000-04-17 15:00  hardaker
+
+	- (vmstat.c): Patch from John L. Villalovos:
+	  - fix ssCpuSystem, ssCpuUser, ssCpuIdle.
+	
+2000-04-17 14:18  hardaker
+
+	- (Makefile.top, Makefile.in): properly use LN_S for linking snmpinform.
+	
+2000-04-17 13:45  hardaker
+
+	- (snmpusm.c, snmpv3.c, snmpv3.h): engineID changes for better aCC support.
+	
+2000-04-17 13:44  hardaker
+
+	- (.cvsignore): ignore snmpinform.
+	
+2000-04-17 09:58  hardaker
+
+	- (snmp_agent.c): fix row creation.
+	
+2000-04-17 07:25  daves
+
+	- (auto_nlist.c snmpd.c agentx/master.c): Don't exit on failure with '-r'
+	
+2000-04-14 15:07  hardaker
+
+	- (snmp_parse_args.c, snmpdelta.c, snmpget.c, snmpgetnext.c,
+	  snmpstatus.c, snmpcmd.1, snmpget.1, default_store.h, mib.c):
+	  - move -If to -Cf and invert behaviour.
+	
+2000-04-14 15:06  hardaker
+
+	- (configure, configure.in): remove debugging output (opps).
+	
+2000-04-14 09:03  hardaker
+
+	- (versioinfo.c): alright.  Who made versionClearCache RONLY?
+	
+2000-04-13 05:49  nba
+
+	- snmptranslate.1: decument the -w width option
+	
+2000-04-12 12:05  mslifcak
+
+	hide user's hostname; prompt before sending e-mail; prompt to save as file.
+	
+2000-04-12 11:22  mslifcak
+
+	fix %f(%s)
+	
+2000-04-12 09:29  hardaker
+
+	- (snmpcmd.1): document -If.
+	
+2000-04-12 09:17  hardaker
+
+	- (snmp_parse_args.c): put ++ back in that accidentically got checked in.
+	
+2000-04-12 09:16  hardaker
+
+	- (snmpset.c): put space back in usage line.
+	
+2000-04-12 09:12  hardaker
+
+	- (snmp_parse_args.c, snmpdelta.c, snmpget.c, snmpgetnext.c,
+	  snmpset.c, snmpstatus.c, default_store.h, mib.c):
+	  - Add a new option -If to specify fixing of PDUs.
+	    - Anyone know a better place to put this option?
+	  - Applications don't do this by default anymore, and you can't in snmpset.
+	
+2000-04-12 07:38  hardaker
+
+	- (vacm_vars.c, vacm.c, vacm.h): fix to allow no v1/v2c requests when
+	  configured for just v3.
+	
+2000-04-12 06:50  mslifcak
+
+	fix MSVC build for encode_keychange, and add more symbols for release builds
+	
+2000-04-12 05:32  nba
+
+	- parse.c: correct parsing of sub-types textual conventions. Allow parsing
+		of MACRO invocations for standard symbols
+	
+2000-04-12 05:31  nba
+
+	- parse.[ch], snmptranslate.c: allow specification of with for -Tp
+	
+2000-04-12 05:30  nba
+
+	- HOST-RESOURCES-MIB.txt, HOST-RESOURCES-TYPES.txt: align with published
+		RFC 2790
+	
+2000-04-11 15:33  hardaker
+
+	- (configure, configure.in): make config_add_mib() actually look for
+	  the mib in $srcdir/mibs/blah and install it if found.
+	
+2000-04-11 15:21  hardaker
+
+	- (snmpv3.c, snmpv3.h): make macaddr engineid setup not linux
+	  specific, but #defines are checked instead.
+	
+2000-04-11 15:20  hardaker
+
+	- (snmp_logging.h): remove old callback typedef no longer needed.
+	
+2000-04-11 14:38  hardaker
+
+	- (snmpv3.c, snmpv3.h): Patch from John L. Villalovos:
+	  - enable engineID to be set from MACAddr.
+	
+2000-04-11 09:51  hardaker
+
+	- (mta_sendmail.c, mta_sendmail.h): New module from Christoph Mammitzsch:
+	  - implements the MTA-MIB for monitoring sendmail.
+	
+2000-04-11 09:50  hardaker
+
+	- (MTA-MIB.txt, NETWORK-SERVICES-MIB.txt): new mibs for new modules.
+	
+2000-04-11 03:25  daves
+
+	- (agent/snmp_agent.c): Save/restore original statP value for SET handling.
+	
+2000-04-11 02:35  daves
+
+	- (agent/snmp_agent.c): Report failures from ACTION phase of SET correctly.
+	
+2000-04-11 01:57  daves
+
+	- (agentx/master_request.c): Dynamically resize subagent requests
+		(Thanks to Reiner Beninga)
+	
+2000-04-10 05:08  daves
+
+	- (snmp_agent.c agentx/master_request.c): Fix multi-subagent requests
+		(Thanks to Reiner Beninga)
+	
+2000-04-07 12:25  hardaker
+
+	- (snmptrap.c, snmpusm.c):
+	  - fix snmpv3 traps to be authoritative from the client side, not the
+	    receiver side.  snmpv3 informs stay as is.  Unfortunately, for
+	    command line apps this doesn't make a whole lot of sense but is
+	    right in terms of how the protocol works and this is hence
+	    somewhat of a hack.
+	
+2000-04-07 07:50  daves
+
+	- (agent/snmp_agent.c): Handle v2 exception types in v1 queries
+	
+2000-04-07 07:16  hardaker
+
+	- (snmptrapd.c, read_config.c, snmpv3.c):
+	  - allow NULL help lines for config directives and use it to hide
+	    internal directives used for persistent storage.
+	
+2000-04-06 15:31  hardaker
+
+	- (snmp_api.c, snmp_api.h):
+	  - turn backwards compatibility macros back into functions so
+	    default_store.h dependencies go away again.
+	  - create a flag to not probe for engineIDs durning sess_open().
+	
+2000-04-06 07:20  daves
+
+	- (snmplib/snmp_api.c): Fix mishandled Counter64 parsing
+	
+2000-04-06 03:36  daves
+
+	- (agent/snmpd.c): Fix usage message alignment.
+	
+2000-04-06 03:31  daves
+
+	- (man/snmpd.1.def): Document the AgentX socket command-line option
+	
+2000-04-05 08:41  hardaker
+
+	- (FAQ2HTML): it's been sitting in my personal src tree for > 2 years.
+	
+2000-04-05 08:38  hardaker
+
+	- (mibincl.h, usmUser.c, snmptrapd.c, lcd_time.c, scapi.c, snmp_api.c,
+	  snmpusm.c, snmpusm.h, snmpv3.c):
+	  - make snmptrapd handle v3 users properly, (and shutdown properly as well).
+	  - a more generic user storage routine added to snmpusm.c and used in
+	    usmUser.c with a side effect of needing callback.h above snmpusm.h.
+	
+2000-04-05 08:27  hardaker
+
+	- (rsnmp): -> /usr/bin/perl
+	
+2000-04-05 08:24  hardaker
+
+	- (.cvsignore): misc minor additions to /
+	
+2000-04-04 11:03  daves
+
+	- (agent/snmp_agent.c): Ensure unimplemented objects return 'noSuchObject'
+	
+2000-04-03 14:57  mslifcak
+
+	Initialize statP.
+	
+2000-04-03 09:12  daves
+
+	- (agent/snmp_agent.c): Ensure a v1 SET returns a v1 error status.
+	
+2000-04-03 08:32  hardaker
+
+	- (ChangeLog): Year was "100" for 2000 (noticed by Jay Riddell):
+	
+2000-04-03 07:53  daves
+
+	- (agent/snmp_agent.c): Ensure SETs fail if one varbind does.
+	
+2000-03-31 07:25  daves
+
+	- (agent/snmp_vars.c): Fix to report 'noSuchObject' in certain circumstances
+	
+2000-03-31 07:13  daves
+
+	- (snmplib/snmp_api.c): Don't repeat the first four bytes in a PDU dump
+	
+2000-03-31 07:04  daves
+
+	- (snmplib/snmp_logging.c): Handle logging empty strings (e.g. a null indent)
+	
+2000-03-30 00:15  daves
+
+	- (agent/snmp_agent.c): Initialise timeout structure properly
+		(Thanks to ashipman@erggroup.com)
+	
+2000-03-27 10:32  mslifcak
+
+	remove trailing newline from hrSWRunName values.
+	
+2000-03-24 09:09  mslifcak
+
+	to sync with patches branch.
+	
+2000-03-24 05:07  nba
+
+	- snmptrapd.c: correctly free the reponse if sending it fails
+	
+2000-03-24 04:22  mslifcak
+
+	xx_synch_response: avoid freeing PDU twice.
+	
+2000-03-23 23:29  nba
+
+	- snmpcmd.1, snmptrap.1, snmptrap.c, Makefile.in: Install and document
+		snmpinform.
+	
+2000-03-23 09:58  mslifcak
+
+	Enqueue only complete request_list entry; Reduce scoping of callback vars.
+	
+2000-03-23 03:02  nba
+
+	file snmpinform.1 was initially added on branch V4-1-1-patches.
+	
+2000-03-22 08:13  mslifcak
+
+	printf ?
+	
+2000-03-21 11:12  mslifcak
+
+	modify F. Strauss' patch per N. Baggesen's suggestion: remove export-dynamic.
+	
+2000-03-21 09:14  mslifcak
+
+	more smooth sailing with Win32 .DLL . DLLEXPORT, anyone ?
+	
+2000-03-21 09:07  mslifcak
+
+	win32 build check: no sigaction, SIGCLD defined.
+	
+2000-03-21 08:47  daves
+
+	- (ds_agent.h snmpd.c mibgroup/agentx/{master,subagent}.c):
+	  -  Command-line option for specifying AgentX port
+	     (based on patch from Frank Strauss)
+	
+2000-03-21 08:38  daves
+
+	- (snmp_api.c): Support 'host:port' representation of peernames
+	
+2000-03-21 04:05  daves
+
+	- (snmp_agent.c): Missing new-line on debug output
+	
+2000-03-21 02:52  daves
+
+	- (mibII/{tcp,udp,ip,icmp}*) Continuing mibII code cleanup
+	
+2000-03-20 11:14  mslifcak
+
+	Comment -C -- do not use this flag.
+	
+2000-03-17 15:32  hardaker
+
+	- (header_complex.c): sizeof(x)*(len+1) not sizeof(x)*len+1
+	
+2000-03-16 00:10  nba
+
+	- configure, hr_print.c: detect system printers (SysV/lpstat, *BSD/cgetnext,
+		Linux/printcap)
+	
+2000-03-15 18:30  mslifcak
+
+	Second part : all members of struct snmp_index are pointers.
+	
+2000-03-15 15:07  mslifcak
+
+	Fix memory leak with unregister_index.
+	
+2000-03-15 15:07  mslifcak
+
+	Fix memory leak when cleaning up trap variables.
+	
+2000-03-15 08:48  daves
+
+	- (snmp_api.c snmp_client.c): Initialise varbind data hook elsewhere as well.
+	
+2000-03-15 07:57  daves
+
+	- (agentx/master_request.c): Fix infinite loop problem when walking subagent.
+	
+2000-03-15 06:09  daves
+
+	- (agent/snmp_agent.c): Avoid calling read routine for each SET handling pass.
+		N.B:  This hasn't been tested with AgentX subagents yet
+	
+2000-03-15 06:07  daves
+
+	- (snmplib/snmp_api.[ch]): Provide hook for internal varbind-related data
+	
+2000-03-15 05:22  daves
+
+	- (agent/var_struct.h): Use a single magic number for MIB registry name lengths.
+	
+2000-03-15 01:51  daves
+
+	- (snmplib/system.h): Don't declare gettimeofday() if the system provides it.
+		(Fix provided by Ron Mevissen)
+	
+2000-03-14 07:57  daves
+
+	- (agent/snmp_agent.c): Don't overwrite saved status when checking access.
+	
+2000-03-14 07:52  daves
+
+	- (agent/snmp_agent.c): Return a response, even if the request failed.
+	
+2000-03-13 15:32  nba
+
+	- ipfwacc.h: fix the MIB name
+	
+2000-03-10 12:48  hardaker
+
+	- (configure): autoconf run
+	
+2000-03-10 11:09  hardaker
+
+	- (Makefile.dlmod): Patch from Frank Strauss:
+	  - dlmod build Makefile example.  Needs incorperation with main configure.
+	
+2000-03-10 11:02  hardaker
+
+	- (agent_registry.c): better signal check from Michael Slifcak
+	
+2000-03-10 10:59  hardaker
+
+	- (UCD-DLMOD-MIB.txt): typo found by Michael Slifcak.
+	
+2000-03-10 10:54  hardaker
+
+	- (dlmod.c, dlmod.h, snmpd.conf.5.def, UCD-DLMOD-MIB.txt): Patch from
+	  Frank Strauss:
+	  - Reimplementation of the dlmod mib module:
+	    o mibgroup/misc/dlmod + dlmods/dlmod_mib -> mibgroup/ucd-snmp/dlmod
+	    o fixed registration (ucdavis.ucdExperimental.14 instead of ucdavis.14)
+	    o added configure stuff for HAVE_SNPRINTF, which was used by dlmod.c
+	    o removed `_dynamic_' prefixes from init/deinit functions
+	    o made dlmodIndex not-accessible (only implementation, not definition)
+	    o removed the asn_parse_XXX stuff
+	    o made entries with state `error' able to accept state `load'
+	    o made the wombat example usable as static and dynamic module
+	    o added simple config_parse functionality to the wombat example
+	
+2000-03-10 10:52  hardaker
+
+	- (agent_registry.c, agent_registry.h, snmpd.c): Patch from Frank Strauss:
+	  - signal registry system implemented (needs to be redone allowing
+	    multiple callbacks and handlers for all signals).
+	  - arbitrary file descriptor/socket registration.
+	    - this is not the way it should be done (use sessions instead).
+	
+2000-03-10 10:44  hardaker
+
+	- (Makefile.in, Makefile.top, acconfig.h, config.h.in, configure.in,
+	  Makefile.in, Makefile.in, Makefile.in, Makefile.in, Makefile.in):
+	  Patch from Frank Strauss:
+	  - clean up shared library usage.
+	
+2000-03-10 10:16  hardaker
+
+	- (config.h.in): autoheader re-arranged some stuff.
+	
+2000-03-07 11:58  mslifcak
+
+	more touchups to allow UnixWare build to complete.
+	
+2000-03-07 11:21  hardaker
+
+	- (default_store.h): make MAX_SUBIDS larger and a multiple of 8.
+	
+2000-03-07 10:13  mslifcak
+
+	Introduce --enable-mini-agent to configure agent (snmpv3, no mibII interfaces).
+	
+2000-03-07 09:03  mslifcak
+
+	assume "snmpapp" if no arg passed to init_snmpv3.
+	
+2000-03-07 08:58  mslifcak
+
+	remove init_mib() call - not appropriate here.
+	
+2000-03-07 08:35  mslifcak
+
+	Let the aix4 patch work.
+	
+2000-03-07 07:08  mslifcak
+
+	trim fat from recent check-ins.
+	
+2000-03-06 20:01  mslifcak
+
+	cleaned up SCO UnixWare build.
+	
+2000-03-06 16:40  mslifcak
+
+	start support for SCO UnixWare 5 as svr5.
+	
+2000-03-06 10:56  hardaker
+
+	- (default_store.h, snmp_api.c): Patch from Robert Story:
+	  - don't check ranges if not requested.
+	
+2000-03-06 10:55  hardaker
+
+	- (snmp_agent.c, snmp_agent.h, snmpd.c): Patch from Robert Story:
+	  - fix exit()ing behaviour in the libucdagent library.
+	
+2000-03-06 10:36  hardaker
+
+	- (snmptrapd.c): Patch from Robert Story:
+	  - -n prints numeric IP addrs.
+	
+2000-03-06 10:25  hardaker
+
+	- (callback.h, snmp_logging.c, snmp_logging.h): Idea from ashipman@erggroup.com:
+	  - callback function (using callback.h) added for external logging.
+	
+2000-03-05 05:25  marz
+
+	fix to preserve trailing multi component instance id's at the end of
+	symbolic mib names(e.g., foo.6.7) when doing translateObj.
+	
+2000-03-04 11:34  nba
+
+	- configure.in, configure: support --without-openssl, even if OpenSSL
+		is available
+	
+2000-03-04 11:30  nba
+
+	- agent/(various): globalize the kvm_t *kd variable
+	
+2000-03-04 11:26  nba
+
+	- mib_modules.c, hr_storage.c: pre-processor # should be in column 1
+	
+2000-03-04 11:17  nba
+
+	- inet.c, inet6.c: survive -v 2c exception replies
+	
+2000-03-04 11:17  nba
+
+	- snmp_api.c: remove a superfluous & in front of an array
+	
+2000-03-04 11:15  nba
+
+	- ucd_snmp.h, {memory,vmstat}_netbsd1.[ch]: support for NetBSD
+	
+2000-03-04 11:14  nba
+
+	- hr_disk.c: fixes for NetBSD
+	
+2000-03-04 11:10  nba
+
+	- versioninfo.c: don't return the trailing newline
+	
+2000-03-04 11:08  nba
+
+	- hr_swrun.c: fix process size for FreeBSD 3 and NetBSD
+	
+2000-03-04 11:05  nba
+
+	- agent_trap.h: fix a wrong prototype
+	
+2000-03-04 11:04  nba
+
+	- snmptable.c: fix problems printing table name and headers when using
+		-OS format
+	
+2000-03-02 11:50  nba
+
+	- snmp_api.c: fix address length info for tcp connect
+	
+2000-03-02 11:48  nba
+
+	- loadave.c: fix for AIX 4
+	
+2000-03-02 08:30  daves
+
+	- (mib2/ip.[ch] mib2/ipAddr.[ch]): First stab at tidying up mib2 support.
+	
+2000-03-01 13:23  hardaker
+
+	- (snmptosql): fix dynamic table testing for creation needed.
+	
+2000-03-01 13:22  hardaker
+
+	- (manager.pm, ucd-snmp.pm): Opps.  Wrong name.  ucd-snmp.pm -> manager.pm.
+	
+2000-03-01 13:21  hardaker
+
+	- (ucd-snmp.pm): turned sqltohtml into an apache module. 2x speed improvement.
+	
+2000-03-01 08:32  mslifcak
+
+	fix bug 180 for cygwin build with _REENTRANT; per ashipman@erggroup.com
+	
+2000-02-29 14:30  mslifcak
+
+	Invoke snmp_sess_send from within snmp_read to avoid mutex deadlocks.
+	
+2000-02-28 14:25  nba
+
+	- snmpd.h, smux.c: don't initialize smux master in sub agent
+	
+2000-02-28 14:16  nba
+
+	- snmp_vars.c: use SUB_AGENT symbol
+	
+2000-02-28 14:12  nba
+
+	- mib.c: sprint_by_type should handle ASN_BIT_STR
+	
+2000-02-28 14:10  nba
+
+	- snmp_parse_args.c: correctly call the -I options input options
+	
+2000-02-28 10:47  mslifcak
+
+	fix bug #176 (AIX 4 - use knlist in lieu of nlist)
+	
+2000-02-24 17:17  mslifcak
+
+	apply patch to fix bug no. 177.
+	
+2000-02-24 13:31  hardaker
+
+	- (default_store.h, read_config.c, snmp_api.c): new snmp.conf keyword
+	  to force the parser to ignore unknown tokens.
+	
+2000-02-24 03:59  mslifcak
+
+	document UNSIGNED32 and COUNTER32 ('u' and 'c') in snmpset (gratis ashipman@erggroup.com)
+	
+2000-02-24 03:56  mslifcak
+
+	add support for COUNTER32 to snmp_add_var; document UNSIGNED32 and COUNTER32
+	('u' and 'c') in snmptrap (gratis ashipman@erggroup.com)
+	
+2000-02-23 23:06  nba
+
+	- pass.c, pass_persist.c: fix setting of octet strings.
+	
+2000-02-23 02:09  nba
+
+	- mt_support.h: a bad ; in the C++ bracketing
+	
+2000-02-23 02:09  nba
+
+	- system.c: remove some superfluous indirections in strcasecmp
+	
+2000-02-23 02:07  nba
+
+	- vmstat_solaris.c: make sure we agree with the prototype of getpagesize!
+	
+2000-02-22 15:31  nba
+
+	- pass_persist.h: declare init_pass_persist
+	
+2000-02-22 09:57  mslifcak
+
+	prune two more symbols not used by auto_nlist for Solaris-built MIB modules.
+	
+2000-02-21 16:17  mslifcak
+
+	Apply R. Story's patch for mkdirhier and strncasecmp on win32
+	
+2000-02-21 07:39  mslifcak
+
+	fix bug 171 (thanks to Larry Parmelee).
+	
+2000-02-21 05:56  mslifcak
+
+	remove free after snmp_close (don't free twice!)
+	
+2000-02-21 04:58  mslifcak
+
+	Added description in SH_NAME for several man-pages (c/o ragnark)
+	
+2000-02-18 12:14  mslifcak
+
+	refer the .so macro to man3; adjust Makefile.in to use the renamed file.
+	
+2000-02-17 05:17  mslifcak
+
+	include pass_persist in the required list.
+	
+2000-02-17 02:00  daves
+
+	- (configure* ucd-snmp/vmstat_solaris2.c):
+	  - Provide missing 'getpagesize' routine for Solaris 2.4
+	    (Thanks to Ragnar Kjørstad)
+	
+2000-02-16 20:17  mslifcak
+
+	include mibincl.h in hr_system.c to fix bug #159.
+	
+2000-02-16 16:35  mslifcak
+
+	remove auto_nlist of unused "swaplist" symbol.
+	
+2000-02-16 15:17  mslifcak
+
+	patch suggested by Rick Beaman <beaman@mediaone.net>
+	
+2000-02-16 14:58  mslifcak
+
+	remove unused vars
+	
+2000-02-16 14:57  mslifcak
+
+	test lengths before allocating memory; use new VACMSTRINGLEN constant.
+	
+2000-02-16 08:18  mslifcak
+
+	include time.h once
+	
+2000-02-16 08:02  mslifcak
+
+	restore #if HAVE...IN_PCB_H
+	
+2000-02-15 23:47  nba
+
+	- configure.in, ipch.[ch]: initial stabs at Linux ipv6 support. A lot is
+		lacking in the kernel statistics though.
+	
+2000-02-15 23:40  nba
+
+	- (many): configure check for netinet/ip6.h
+	
+2000-02-15 23:34  nba
+
+	- hr_filesys.c: MNTTYPE defines for FreeBSD-3 and BSDI-4, and moving the
+		return value for Ext2FS to the newly defined OID.
+	
+2000-02-15 23:24  nba
+
+	- freebsd3.h: some kernel symbols not to be used for FreeBSD 3
+	
+2000-02-15 23:23  nba
+
+	- snmptable.c: give a sensible output for an empty table.
+	
+2000-02-15 23:22  nba
+
+	- vacm*: buffer length checking!
+	
+2000-02-15 23:20  nba
+
+	- hr_storage.c: return memory size in pages.
+	
+2000-02-15 23:17  nba
+
+	- ucd_snmp.h, memory_freebsd2.h: make it work for FreeBSD-3 too
+	
+2000-02-15 23:16  nba
+
+	- snmp_agent.c: one more place to send a AUTHFAIL trap
+	
+2000-02-15 23:15  nba
+
+	- agent_registry.c: fix a return for SNMPv1/Counter64 case
+	
+2000-02-15 02:12  daves
+
+	- (apps/snmp_parse_args.c): Omit deprecated options from optarg handling.
+	
+2000-02-11 15:48  hardaker
+
+	- (manager/*): /usr/local/bin/perl -> /usr/bin/perl
+	
+2000-02-11 15:47  hardaker
+
+	- (makedepend.in): /usr/local/bin/perl -> /usr/bin/perl
+	
+2000-02-11 15:38  hardaker
+
+	- (rsnmp): perl5 -> perl
+	
+2000-02-11 15:17  hardaker
+
+	- (man/Makefile.in): install snmp_trap_api.3
+	
+2000-02-11 14:20  hardaker
+
+	- (local/Makefile.in): last minute makefile touchup
+	
+2000-02-11 14:03  hardaker
+
+	- (NEWS): update for 4.1.1
+	
+2000-02-11 13:47  hardaker
+
+	- (ChangeLog): Update for 4.1.1
+	
+2000-02-11 13:29  hardaker
+
+	- (version.h bug-report sedscript.in): version tag ( 4.1.1 )
+	
+2000-02-11 12:53  hardaker
+
+	- (T016snmpv2cgetfail, T017snmpv2ctov1getfail): update for Timeout for v2c.
+	
+2000-02-11 12:49  hardaker
+
+	- (local/Makefile.in): don't cp for snmpcheck
+	
+2000-02-11 12:44  hardaker
+
+	- (local/Makefile.in): fix for seperate build path
+	
+2000-02-11 12:30  hardaker
+
+	- (sysORTable.h): Patch from Niels Baggesen:
+	  - compiler warning fix.
+	
+2000-02-11 12:29  hardaker
+
+	- (snmp_agent.c): patch from Niels:
+	  - don't send autherror responses for v2c.
+	  - send authFailure trap.
+	
+2000-02-11 12:22  hardaker
+
+	- (acconfig.h, config.h.in): change perl path to /usr/bin.
+	
+2000-02-11 06:58  hardaker
+
+	- (acconfig.h, config.h.in): Dont define PROCFIXCMD and EXECFIXCMD by default.
+	
+2000-02-10 11:14  mslifcak
+
+	fix for older platforms to use pass_persist; not included by default.
+	
+2000-02-10 10:33  mslifcak
+
+	[no log message]
+	
+2000-02-10 10:32  hardaker
+
+	- (hr_swinst.c): minor fixes pointed out by Michael.
+	
+2000-02-10 10:28  hardaker
+
+	- (snmpv3.c): fix setup engineID buffer overflow found by Mike Baer.
+	
+2000-02-10 08:39  nba
+
+	- man/*: set the dates on the pages to reflect the revision date
+	
+2000-02-10 08:13  mslifcak
+
+	fix varargs decl/defn of snmp_log
+	
+2000-02-10 08:00  mslifcak
+
+	typedef int ssize_t (one line added) for build on SunOS 4.
+	
+2000-02-10 07:54  hardaker
+
+	- (FAQ): mention the tutorial.
+	
+2000-02-10 07:14  daves
+
+	- (FAQ): Explicit examples of sending traps by hand
+	
+2000-02-10 04:41  daves
+
+	- (snmplib/{snmp_api,snmp_client}.c apps/snmpnetstat/inet6.c):
+	  -  Comment unused code more informatively as to why it is omitted.
+	
+2000-02-09 13:53  hardaker
+
+	- (eval_tools.sh, T023snmpv3getMD5DES, T024snmpv3getSHA1, T025snmpv3getSHADES):
+	  - skip ssl tests we can't perform.
+	
+2000-02-09 13:51  mslifcak
+
+	include sys/param.h to get PATH_MAX on FreeBSD.
+	
+2000-02-09 13:38  hardaker
+
+	- (Sv3SHADESconfig, T024snmpv3getSHA1, T025snmpv3getSHADES):
+	  - make SHA tests actually work.
+	
+2000-02-09 13:32  hardaker
+
+	- (Sv3configsha): sha config support
+	
+2000-02-09 13:31  hardaker
+
+	- (T003snmpv1getfail, T016snmpv2cgetfail, T017snmpv2ctov1getfail,
+	  T018snmpv1tov2cgetfail): fix for proper ACM error outputs.
+	
+2000-02-09 13:30  mslifcak
+
+	Define SNMP_MAXPATH, and use it.
+	
+2000-02-09 13:30  hardaker
+
+	- (T024snmpv3getSHA1 T025snmpv3getSHADES): new tests
+	
+2000-02-09 13:16  hardaker
+
+	- (UCD-SNMP-MIB.txt): mention a new ucdExperimental registration (wavlan).
+	
+2000-02-09 13:16  hardaker
+
+	- (agent_callbacks.h, agent_registry.c, agent_registry.h,
+	  snmp_agent.c, vacm_vars.c):
+	  - fix posible acm DoS problems by checking access tables early on.
+	
+2000-02-09 11:38  hardaker
+
+	- (hr_swinst.c): patch from redhat for better RPM support.
+	
+2000-02-09 10:43  hardaker
+
+	- (configure.in): change mode to autoconf.
+	
+2000-02-09 10:41  hardaker
+
+	- (Makefile.in): fix rsnmp build.  Really.  I mean it.
+	
+2000-02-09 10:41  hardaker
+
+	- (hr_filesys.c, hr_storage.c): Patch from Andy HOOD:
+	  - Solaris patches.
+	
+2000-02-09 10:37  hardaker
+
+	- (Makefile.in):
+	  - fix rsnmp.made.
+	  - use $(MAKE).
+	
+2000-02-09 08:41  hardaker
+
+	- (vmstat_solaris2.c, vmstat_solaris2.h): Update from Jochen Kmietsch
+	
+2000-02-07 11:49  marz
+
+	oops missing important fix for win32 build - fd_set must be same size as in winsock
+	
+2000-02-07 11:18  mslifcak
+
+	Undo last change; on Sun, additional platform info was not obtained;
+	the proper solution would be to remove the second token (hostname).
+	
+2000-02-07 10:43  mslifcak
+
+	Keep customer's nodename out of the published 'uname' information.
+	
+2000-02-07 07:20  hardaker
+
+	- (PORTING): Michael likes diff -u.
+	
+2000-02-06 06:11  nba
+
+	- read_config.c: Fix one final ':' to ENV_SEPARATOR_CHAR
+	
+2000-02-05 17:39  hardaker
+
+	- (snmpv3.c): correct some awful text -> engineID creation mistakes.
+	
+2000-02-05 08:37  hardaker
+
+	- (snmptrapd.c): fix wrapped line continuation in usage message.
+	
+2000-02-05 06:56  marz
+
+	fix version  number
+	
+2000-02-04 18:55  marz
+
+	weird delay in creation of pid files
+	
+2000-02-04 18:21  marz
+
+	brain-o
+	
+-------------------------------------------------------------------------------
+
+Changes: V4.1 -> V4.1.1
+
+marz  5 Feb 00 06:56:43
+    fix version  number
+
+hardaker  5 Feb 00 08:37:27
+    - (snmptrapd.c): fix wrapped line continuation in usage message.
+
+hardaker  5 Feb 00 17:39:54
+    - (snmpv3.c): correct some awful text -> engineID creation mistakes.
+
+nba  6 Feb 00 06:11:59
+    - read_config.c: Fix one final ':' to ENV_SEPARATOR_CHAR
+
+hardaker  7 Feb 00 07:20:24
+    - (PORTING): Michael likes diff -u.
+
+mslifcak  7 Feb 00 10:43:29
+    Keep customer's nodename out of the published 'uname' information.
+
+mslifcak  7 Feb 00 11:18:26
+    Undo last change; on Sun, additional platform info was not obtained;
+    the proper solution would be to remove the second token (hostname).
+
+marz  7 Feb 00 11:49:01
+    oops missing important fix for win32 build - fd_set must be same size as in winsock
+
+hardaker  9 Feb 00 08:41:11
+    - (vmstat_solaris2.c, vmstat_solaris2.h): Update from Jochen Kmietsch
+
+hardaker  9 Feb 00 10:37:00
+    - (Makefile.in):
+      - fix rsnmp.made.
+      - use $(MAKE).
+
+hardaker  9 Feb 00 10:41:14
+    - (hr_filesys.c, hr_storage.c): Patch from Andy HOOD:
+      - Solaris patches.
+
+hardaker  9 Feb 00 10:41:44
+    - (Makefile.in): fix rsnmp build.  Really.  I mean it.
+
+hardaker  9 Feb 00 10:43:05
+    - (configure.in): change mode to autoconf.
+
+hardaker  9 Feb 00 11:38:42
+    - (hr_swinst.c): patch from redhat for better RPM support.
+
+hardaker  9 Feb 00 13:16:17
+    - (agent_callbacks.h, agent_registry.c, agent_registry.h,
+      snmp_agent.c, vacm_vars.c):
+      - fix posible acm DoS problems by checking access tables early on.
+
+hardaker  9 Feb 00 13:16:58
+    - (UCD-SNMP-MIB.txt): mention a new ucdExperimental registration (wavlan).
+
+mslifcak  9 Feb 00 13:31:01
+    Define SNMP_MAXPATH, and use it.
+
+hardaker  9 Feb 00 13:31:24
+    - (T003snmpv1getfail, T016snmpv2cgetfail, T017snmpv2ctov1getfail,
+      T018snmpv1tov2cgetfail): fix for proper ACM error outputs.
+
+mslifcak  9 Feb 00 13:51:12
+    include sys/param.h to get PATH_MAX on FreeBSD.
+
+hardaker  9 Feb 00 13:53:37
+    - (eval_tools.sh, T023snmpv3getMD5DES, T024snmpv3getSHA1, T025snmpv3getSHADES):
+      - skip ssl tests we can't perform.
+
+daves 10 Feb 00 04:41:10
+    - (snmplib/{snmp_api,snmp_client}.c apps/snmpnetstat/inet6.c):
+      -  Comment unused code more informatively as to why it is omitted.
+
+daves 10 Feb 00 07:14:51
+    - (FAQ): Explicit examples of sending traps by hand
+
+hardaker 10 Feb 00 07:54:46
+    - (FAQ): mention the tutorial.
+
+mslifcak 10 Feb 00 08:00:26
+    typedef int ssize_t (one line added) for build on SunOS 4.
+
+mslifcak 10 Feb 00 08:13:14
+    fix varargs decl/defn of snmp_log
+
+nba 10 Feb 00 08:40:04
+    - man/*: set the dates on the pages to reflect the revision date
+
+hardaker 10 Feb 00 10:28:21
+    - (snmpv3.c): fix setup engineID buffer overflow found by Mike Baer.
+
+hardaker 10 Feb 00 10:32:08
+    - (hr_swinst.c): minor fixes pointed out by Michael.
+
+mslifcak 10 Feb 00 10:33:47
+    *** empty log message ***
+
+mslifcak 10 Feb 00 11:14:58
+    fix for older platforms to use pass_persist; not included by default.
+
+hardaker 11 Feb 00 06:58:03
+    - (acconfig.h, config.h.in): Dont define PROCFIXCMD and EXECFIXCMD by default.
+
+hardaker 11 Feb 00 12:22:10
+    - (acconfig.h, config.h.in): change perl path to /usr/bin.
+
+hardaker 11 Feb 00 12:29:37
+    - (snmp_agent.c): patch from Niels:
+      - don't send autherror responses for v2c.
+      - send authFailure trap.
+
+hardaker 11 Feb 00 12:30:02
+    - (sysORTable.h): Patch from Niels Baggesen:
+      - compiler warning fix.
+
+hardaker 11 Feb 00 12:44:23
+    - (local/Makefile.in): fix for seperate build path
+
+hardaker 11 Feb 00 12:49:03
+    - (local/Makefile.in): don't cp for snmpcheck
+
+hardaker 11 Feb 00 12:53:15
+    - (T016snmpv2cgetfail, T017snmpv2ctov1getfail): update for Timeout for v2c.
+
+hardaker 11 Feb 00 13:29:29
+    - (version.h bug-report sedscript.in): version tag ( 4.1.1 )
+
+	
+-------------------------------------------------------------------------------
+
+Changes: V4.0.1 -> V4.1
+
+mslifcak 24 Aug 99 04:44:47
+    Clean CRs from read_config,snmp_logging; comment define USE_ASN_SHORT_LEN.
+
+mslifcak 24 Aug 99 05:11:13
+    Remove ASN_SHORT_LEN hack - known to dump core in agent.
+
+mslifcak 24 Aug 99 06:19:49
+    Add "." to PATH for RUNTESTS; Drop optreset to build most platforms
+
+mslifcak 24 Aug 99 10:25:53
+    -(testing/eval_tools) - let some (AIX) agents settle before firing requests.
+
+hardaker 24 Aug 99 12:48:21
+    - (vacm_vars.c): correct sysORTable entry.
+
+hardaker 24 Aug 99 13:36:35
+    - (snmpusm.c): check for null response pointer.
+
+hardaker 24 Aug 99 13:37:31
+    - (snmp_parse_args.c, default_store.h, snmp_api.c, snmpv3.c):
+      - provide defVersion token support in snmp.conf (sort of hackish).
+
+hardaker 24 Aug 99 13:41:18
+    - (TODO): remove snmpv3 support :-)
+
+mslifcak 24 Aug 99 14:05:39
+    -(top/Makefile.in) - remove more generated files with distclean rule.
+
+hardaker 24 Aug 99 14:15:40
+    - (all_system.h): remove.  again.
+
+mslifcak 24 Aug 99 14:17:33
+    -(host/hr_swrun;mibII/icmp,ip;ucd-snmp/disk,proc) log_perror --> snmp_log_perror
+
+mslifcak 24 Aug 99 15:14:18
+    -(smux.c) apply Nick Amato's patch: prevent SMUX close on parse or error.
+
+hardaker 24 Aug 99 15:59:42
+    - (snmp_api.c): remove version setting in snmp_api.c.  Not needed there.
+
+hardaker 24 Aug 99 16:01:55
+    - (NEWS): 4.0.1 update
+
+mslifcak 24 Aug 99 16:05:15
+    -(configure.*) move statement about ucdDemoPublic into comment field.
+
+mslifcak 24 Aug 99 16:49:22
+    -(testing/*) run tests when package is not installed, and when
+    the build tree is not the same as the source tree.
+
+hardaker 24 Aug 99 17:13:25
+    - (ChangeLog): update for 4.0.1
+
+hardaker 24 Aug 99 17:14:50
+    - (version.h bug-report sedscript.in): version tag ( 4.0.1 )
+
+mslifcak 24 Aug 99 17:39:54
+    -(RUNTESTS) export PATH before use
+
+mslifcak 24 Aug 99 17:43:04
+    -(testing/Makefile.in) no need to build targets in test rule.
+
+mslifcak 26 Aug 99 13:18:31
+    -(testing/RUNTESTS) improved PATH set
+
+mslifcak 26 Aug 99 13:40:13
+    -(testing/Makefile.in) don't built targets that are no longer used
+
+mslifcak 27 Aug 99 07:35:10
+    -(configure*, sedscript*) change ...EXTENIS...  to ...EXTENSI...
+
+mslifcak 27 Aug 99 08:03:46
+    Howard Spindel suggests an API for traps with pass_persist.
+
+hardaker 27 Aug 99 09:17:08
+    - (icmp.c, interfaces.c, ip.c, route_write.c, tcp.c, udp.c, var_route.c):
+      - Susanne Osted pointed out a lack of #if HAVE_SYS_PARAM_H.
+
+hardaker 28 Aug 99 07:19:16
+    - (Makefile.in): install snmp_alarm.3.
+
+hardaker 28 Aug 99 07:29:48
+    - (acconfig.h, config.h.in, configure, configure.in, read_config.c):
+      - add /etc/snmp to default conf file path to make RedHat happy.
+
+hardaker 30 Aug 99 09:33:41
+    - (Makefile.in, agent_read_config.c, agent_registry.c, agent_trap.c,
+      agent_trap.h, ds_agent.h, snmp_agent.c, snmp_agent.h, snmp_vars.c,
+      snmpd.c, util_funcs.c, sysORTable.c, callback.c, callback.h,
+      default_store.h, read_config.c, snmp_api.c):
+      - restructure the agent into two pieces: a library and a application.
+        - needs much more work.
+        - many parameters are now controlled by new default_store settings
+          to help relieve compile time bindings.
+      - merge init_snmp and the custom version called inside the agent.
+      - add a new place for trap specific agent code (agent_trap.[ch]).
+      - probably other things I've forgotten that I did.
+
+hardaker 30 Aug 99 09:38:18
+    - (client.c, master.c, master_request.c, protocol.c, subagent.c):
+      - debugging statements.
+      - use new default_store settings instead of external variables.
+
+hardaker 30 Aug 99 10:30:56
+    - (master.c, master_request.c): yet more debugging.
+
+nba 30 Aug 99 13:02:18
+    - man/snmpd.conf.5.def: document smuxpeer directive
+
+nba 30 Aug 99 13:03:40
+    - apps/snmp_parse_args.c: properly handle MIB:oid construct
+
+nba 30 Aug 99 13:05:02
+    - apps/snmptrapd.c: fix argument parser
+
+nba 31 Aug 99 00:08:45
+    - agent/snmpd.c: don't try to parse a packet when there is an error in
+    	recvfrom
+
+mslifcak 31 Aug 99 08:17:24
+    -(agent_trap.c) fix recent memory leak, and sizeof(objid_snmptrap) bug.
+
+mslifcak 31 Aug 99 09:26:14
+    -(agent_trap.c) always free PDU after snmp_send.
+
+daves  2 Sep 99 06:38:16
+    - (agent/mibgroup/misc/ipfwacc.h): Fix MIB location of ipfwacc module
+
+daves  2 Sep 99 06:38:53
+    - (agent/mibgroup/misc/ipfwacc.c): Fix MIB location of ipfwacc module
+
+hardaker  2 Sep 99 07:07:04
+    - (subagent.c): shutdown_subagent -> subagent_shutdown so configure
+      doesn't find it.
+
+hardaker  2 Sep 99 08:52:48
+    - (subagent.c): opps.  Forgot a shutdown name change instance.
+
+hardaker  3 Sep 99 13:15:15
+    - (history.c, history.h, snmp_vars.linux.h): removed. No longer needed.
+
+hardaker  3 Sep 99 13:15:33
+    - (Makefile.in): install agent header files.
+
+hardaker  3 Sep 99 13:27:13
+    - (Makefile.in):
+      - install libagent.a.
+      - mkdirheir on needed new installation directories.
+
+hardaker  3 Sep 99 13:30:36
+    - (snmplib/Makefile.in): install more library headers.
+
+hardaker  3 Sep 99 14:28:46
+    - (snmp_vars.c): don't fall off the end of the search tree.
+
+hardaker  3 Sep 99 15:01:39
+    - (FAQ): more BSDI system versions listed.
+
+nba  6 Sep 99 23:53:07
+    - (man/snmp_api.3 snmplib/snmp_api.c agent/snmpd.c apps/snmptrap.c):
+    	fix memory leak when agent sends traps by implementing the missing
+    	free of TRAP pdu in snmp_send.
+
+nba  6 Sep 99 23:55:38
+    - if.c: correct calls of snmp_fix_pdu to use GETNEXT
+
+mslifcak  7 Sep 99 14:47:18
+    -(parse.*) fix small memory leaks; allow INDEX{INTEGER...} clauses;
+               allow larger DESCRIPTION clauses [max 8192].
+
+mslifcak  7 Sep 99 15:22:14
+    snmpv3.c - silence type warning from MSVC++.
+
+mslifcak  7 Sep 99 15:23:02
+    (default_store.*) - make 3rd param to ds_set_string type of const char *.
+
+mslifcak  7 Sep 99 15:23:51
+    (win32/config.h) - set SNMPCONFPATH to succeed compile;
+    (win32*libsnmp.def) - add new snmp_get_token to list.
+
+mslifcak  7 Sep 99 15:32:00
+    -(snmp_api.h) struct pdu and snmp_session agree: long type for version member.
+
+mslifcak  7 Sep 99 15:32:59
+    -(parse.c) remove unneeded strdup to File variable from init_mib_internals.
+
+mslifcak  7 Sep 99 15:57:13
+    -(parse.c) fix Unlinked OID print when object identifier has no parent.
+
+mslifcak  7 Sep 99 20:12:57
+    -(agent_trap.c,snmptrap.c,snmp_api.[3c]) - snmp_free_pdu fix Bug #54 per Niels B.
+    -(snmpnetstat/if.c) - fix for GETNEXT per Niels B.
+
+mslifcak  7 Sep 99 20:19:52
+    snmptrap.c - rework fix bug #54 (missed else).
+
+mslifcak  8 Sep 99 05:16:34
+    include read_config.h
+
+nba  8 Sep 99 07:45:54
+    - (configure.in, loadave.c): Solaris 2.7 has getloadavg prototype
+
+nba  8 Sep 99 07:46:51
+    - snmp_api.h: move inclusion protection to the real beginning/end of the file
+
+nba  8 Sep 99 07:48:03
+    - var_struct.h: the Agentx code uses unsigned values for the variable type.
+
+nba  8 Sep 99 07:50:37
+    - (various): fix compiler warnings
+
+nba  8 Sep 99 07:51:26
+    - snmpd.1.def: fix a formatting problem
+
+nba  8 Sep 99 07:52:23
+    - apps/snmptrapd.c: fix argument processing (-ld and similar)
+
+mslifcak  8 Sep 99 13:00:40
+    -(testing/RUNTESTS) prefix PATH with . and .. , as the script changes dir.
+
+mslifcak  8 Sep 99 13:04:55
+    -(snmplib/snmp_client.*) add snmp_split_pdu, snmp_varbind_len methods.
+
+mslifcak  8 Sep 99 17:02:37
+    mibincl.h, mibgroup/mibII/* - fixup for CygWin32 build
+
+mslifcak  8 Sep 99 17:49:13
+    -(config*,win32/*,snmplib/*) resource locking originally from Markku Laukkanen
+
+mslifcak  8 Sep 99 17:52:47
+    -(mt_support.*) Original by Markku Laukkanen, changes by M. Slifcak
+
+mslifcak  8 Sep 99 22:30:29
+    -(smux.c) var_smux_write fixed per Mike Michaud and Nick Amato
+
+mslifcak  8 Sep 99 22:34:37
+    -(mibincl.h) comment out duplicate #include header lines.
+
+daves  9 Sep 99 01:32:15
+    - (mibs/SNMPv2-CONF.txt): Omit unnecessary import clause
+
+mslifcak  9 Sep 99 02:21:50
+    -(winstub.c) Hack to allow snmpnetstat -a to work on AIX4 (sic).
+
+mslifcak  9 Sep 99 02:31:26
+    -(*config*) turn on resource locking with --enable-reentrant.
+
+mslifcak  9 Sep 99 13:59:26
+    -(mib.c, parse.c) mib.c print_tree_node test display null type with range
+                      parse.c work around core dump freeing TCs that specify ranges.
+
+nba 12 Sep 99 21:50:23
+    - var_route.c: Linux cleanup. Required for Linux/SPARC
+
+nba 12 Sep 99 21:57:18
+    - agent/*, snmplib/*: malloc fixes, some provoked by the corrected
+    	snmp_send semantics.
+
+nba 12 Sep 99 21:58:17
+    - TESTCONF.sh: fix some exports to export the right variable.
+
+nba 12 Sep 99 21:59:34
+    - protocol.c: add a missing include file.
+
+nba 12 Sep 99 22:00:33
+    - snmp_impl.h: removed some unused/unneeded defines/structs
+
+nba 13 Sep 99 04:35:18
+    - var_route.c: Linux cleanup. Required for Linux/SPARC
+
+nba 13 Sep 99 13:32:07
+    - snmpd.c: fix a buffer overflow
+
+hardaker 13 Sep 99 15:01:54
+    - (agent_callbacks.h, agent_read_config.c, agent_registry.c,
+      agent_registry.h, snmp_agent.c, snmp_vars.c, snmpd.c, subagent.c,
+      subagent.h, sysORTable.c, vacm_vars.c, vacm_vars.h):
+      - further separation of agent church and state:
+        - use callbacks everywhere needed to not call mib module code directly.
+        - get rid of all instances of USING_ in libagent code.
+
+mslifcak 13 Sep 99 20:20:54
+    -(snmp_api.c) re-assert Niels' patch to snmp_send to free v2/v1 Trap-PDUs
+
+mslifcak 14 Sep 99 09:54:05
+    -(FAQ, man/snmpcmd.1, snmplib/parse.*) add replace MIB capability(experimental)
+
+marz 14 Sep 99 13:00:12
+      (apps/snmp_parse_args.c, snmplib/snmp_api.[ch]): fix spurious error message when snmp_parse_oid fails
+
+mslifcak 14 Sep 99 13:22:39
+    parse.c - another fix for node: consider NULL name or NULL parent
+
+mslifcak 15 Sep 99 06:08:32
+    include mibgroup/mib_module_includes.h for benefit of mib_module_dot_conf.h
+
+hardaker 15 Sep 99 09:45:35
+    - (Makefile.in, snmp_close.3, snmp_free_pdu.3, snmp_open.3,
+      snmp_read.3, snmp_select_info.3, snmp_send.3,
+      snmp_sess_async_send.3, snmp_sess_close.3, snmp_sess_error.3,
+      snmp_sess_init.3, snmp_sess_open.3, snmp_sess_read.3,
+      snmp_sess_select_info.3, snmp_sess_send.3, snmp_sess_sess_timeout.3,
+      snmp_sess_session.3, snmp_timeout.3): Patch from Mark H. Wood:
+      - create some fake sourcing man pages for functions.
+
+mslifcak 15 Sep 99 11:30:58
+    fine tuning mt support
+
+mslifcak 16 Sep 99 14:16:38
+    -per agreement with Markku, no support needed for Solaris-specific threads.
+
+hardaker 17 Sep 99 07:17:21
+    - (snmp_api.3): Patch from Mark H. Wood:
+      - fix comments.
+
+mslifcak 17 Sep 99 11:19:42
+    -(parse.c) - remove unneeded use of static var "last"
+
+mslifcak 17 Sep 99 11:24:48
+    -remove old-style init for replace mib feature.
+
+mslifcak 17 Sep 99 11:42:17
+    make module_map* and tokens structures static (only used in parse.c ?)
+
+hardaker 17 Sep 99 15:37:41
+    - (configure): update to 2.13.
+
+daves 21 Sep 99 09:21:59
+    - (snmplib/snmp_api.c): handle adding 'error' type variables to a PDU
+
+daves 21 Sep 99 09:25:25
+    - (agent/mibgroup/agentx/protocol.c): Handle parsing null-length variables
+
+daves 21 Sep 99 09:32:27
+    - (agent_registry.c snmpd.c): Simple run-time dump of registered MIBs
+
+mslifcak 21 Sep 99 10:40:43
+    -(mib.c) undo erroneous change to init_mib (thanks NB!)
+
+daves 22 Sep 99 09:27:37
+    - (agent/snmpd.c): stupid typo
+
+daves 22 Sep 99 09:31:08
+    - (agent/agent_registry.c): stupid typo
+
+daves 22 Sep 99 09:33:51
+    - (agent/agent_registry.[ch]): Provide method for prioritised registration
+
+daves 22 Sep 99 09:35:09
+    - (agent/mibgroup/mibII/sysORTable.c):
+      - Ensure local sysORTable takes precedence over subagent versions
+
+daves 22 Sep 99 09:54:02
+    - (agent_registry.c snmp_vars.c var_struct.h):
+      Change the way the MIB registry handles registered ranges.
+      This should work more reliably (as well as being rather simpler, IMHO)
+
+daves 22 Sep 99 09:58:12
+    - (agent_registry.c): remove redundant routines
+
+daves 22 Sep 99 10:00:56
+    - (agent_registry.c): Ensure registry is initialised correctly on subagents
+
+daves 22 Sep 99 10:01:45
+    - (mibgroup/agentx/master_request.c): Improved AgentX response handling
+
+mslifcak 22 Sep 99 12:51:00
+    -(snmp_api.c) - Improved error status aggregation.
+
+hardaker 27 Sep 99 16:22:20
+    - (read_config.c): Opps: DS_LIB_DONT_READ_CONFIGS needed an !.
+
+hardaker 28 Sep 99 16:52:04
+    - (Makefile.in, mib_modules.c, mib_modules.h, snmp_vars.c, snmpd.c):
+      - make libucdagent and libucdmibs as seperate libraries.  In theory,
+        you shouldn't need libucdmibs to use libucdagent.
+
+daves 29 Sep 99 11:14:42
+    - (snmplib/snmp_api.c): protect snmp_close() against a null Sessions list
+
+daves 29 Sep 99 11:17:01
+    - (mt_support.h snmp_api.[ch]): Support for session and incoming transaction IDs
+
+daves 29 Sep 99 11:23:40
+    - (agent_registry.c): Correct value of default registration priority
+
+daves 29 Sep 99 11:36:43
+    - (agent_registry.[ch]):
+      - Improve registry error handling
+      - Correctly handle unregistering MIB regions
+
+daves 29 Sep 99 11:38:22
+    - (agent_registry.c):
+      - 'Children' nodes now have a different status, and shouldn't be freed. Oops!
+
+daves 29 Sep 99 11:43:00
+    - (agent_registry.[ch]): Provision to unregister MIBs by session
+
+daves 29 Sep 99 11:46:02
+    - (agent/snmp_vars.c):
+      - Move setting agent start time to earlier in the initialisation sequence
+        (so that it can be overridden in subagents with the master's value)
+
+daves 29 Sep 99 11:48:55
+    - (agent/mibgroup/mibII/sysORTable.c): Change in MIB registration interface
+
+daves 29 Sep 99 12:19:56
+    - (agent/mibgroup/agentx/*):  Assorted improvements!
+
+mslifcak 29 Sep 99 14:31:48
+    Robust copy of information to tree, import_list, display hints.
+
+hardaker 29 Sep 99 16:35:43
+    - (config.h.in, configure, configure.in):
+      - fix RANLIB testing for --enable-shared.
+
+hardaker 29 Sep 99 16:36:07
+    - (README): added Mike Michaud to the thank you list.
+
+hardaker 29 Sep 99 16:38:34
+    - (header_complex.c, header_complex.h):
+      - new extraction and freeing functions.
+      - bug fix, missing a malloc size by one (electric fence is very cool).
+
+hardaker 29 Sep 99 16:38:59
+    - (client.c): thats "timeval" not "timevale" Dave (hehe).
+
+hardaker 29 Sep 99 16:39:21
+    - (client.h): define DEFAULT_MIB_PRIORITY to 255.
+
+hardaker 29 Sep 99 16:39:42
+    - (master_admin.c): -Wall fixes and found a missing }.
+
+hardaker 29 Sep 99 16:40:08
+    - (pass.c): run ntohl on ip addresses stored in a long.
+
+hardaker 29 Sep 99 16:40:30
+    - (mib2c.vartypes.conf): removed extra \n.
+
+hardaker 29 Sep 99 17:01:28
+    - (agent_registry.c, agent_registry.h): fix bugs.
+
+hardaker 29 Sep 99 17:01:50
+    - (mib_modules.c): include netinet/in.h
+
+mslifcak 29 Sep 99 23:42:49
+    Remove unused file.. snmplib/hpux.c
+
+daves 30 Sep 99 01:09:25
+    - (mibgroup/host/hr_system.c):
+      - protect against NULL utmp file (from Fabrice Dupre)
+
+daves  1 Oct 99 09:48:20
+    - (agent/Makefile.in): Fix incompatability in agent library names
+
+daves  2 Oct 99 14:28:20
+    - (mibgroup/agentx/master_admin.c mibgroup/agentx/subagent.c):
+      - Fix a problem with re-used PDU structures being freed twice.
+
+daves  4 Oct 99 03:58:22
+    - (agent_registry.[ch] mibgroup/agentx/client.h):
+      - consolidate definitions of default MIB registration priority
+
+daves  4 Oct 99 09:53:48
+    - (agent_registry.[ch] snmp_vars.h mibII/sysORTable.c
+       agentx/client.[ch] agentx/master_admin.c):
+       - Handle MIB range registration, and clean up wrapper interfaces
+
+daves  4 Oct 99 09:58:26
+    - (mib_modules.c mibgroup/agentx/subagent.[ch]):
+      - Ensure subagent is initialised early (prior to MIB registration, etc)
+
+daves  4 Oct 99 10:15:38
+    - (snmplib/callback.h): Increase number of application callbacks supported
+
+daves  4 Oct 99 10:17:53
+    - (agent_callbacks.h  mibgroup/mibII/sysORTable.[ch]
+       mibgroup/agentx/master_admin.c mibgroup/agentx/subagent.c):
+       - Complete subagent handling of Agent Capabilities / sysORTable
+
+daves  4 Oct 99 10:22:25
+    - (agentx/client.[ch] agentx/master_admin.c): Trivial 'ping' implementation
+
+nba  4 Oct 99 11:48:51
+    - (snmp_api?, int64.? snmptrap.c): add some error checking for variables
+
+nba  4 Oct 99 11:50:50
+    - Makefile.in:	always use $(MAKE) for make in Makefiles
+
+nba  4 Oct 99 11:52:25
+    - configure.in:	remove -pedantic from --with-developer, and the system headers
+    	are not prepared for it (at least on Linux and NetBSD)
+
+nba  4 Oct 99 13:38:19
+    - various: include additions and fixes to kill warnings
+
+hardaker  4 Oct 99 13:51:51
+    - (system_mib.c): make sysServices configurable.
+
+nba  4 Oct 99 13:52:20
+    - subagent.h, subagent.c, mib_modules.c: pre_init_subagent confuses
+    	configure into believing there is a init_subagent function.
+    	Rename to subagent_pre_init
+
+hardaker  4 Oct 99 16:32:19
+    - (header_complex.c, header_complex.h): added header_complex_find_entry().
+
+daves  5 Oct 99 07:23:45
+    - (agentx/master_request.c agentx/subagent.c): Working SET support
+
+nba  5 Oct 99 21:49:22
+    - snmp_debug.h: make the DEBUG* macros safe for use in compound statements
+
+nba  5 Oct 99 22:18:46
+    - snmp_parse_args.c: fixes to report invalid engineId
+
+nba  5 Oct 99 22:22:54
+    - subagent.c: include system.h for prototype for calculate_time_diff
+
+hardaker  6 Oct 99 08:57:42
+    - (fixproc): new commented version.
+
+hardaker  6 Oct 99 16:31:53
+    - (acconfig.h, config.h.in, read_config.c, snmp_api.c, snmp_client.c):
+      - Save and parse older persistent storage files to make sure data is
+        not lost during storage crashes.
+      - Fix SNMPv3 engineID probes: PDU's are allowed to have a NULL varbindlist.
+
+daves  7 Oct 99 07:26:20
+    - (agent_trap.c agent_trap.h agent_read_config.c snmpd.h):
+      -  Re-write of agent trap handling:
+    	Provision for v1 traps with varbinds
+    	Consolidate v1 and v2 trap sink lists
+    	Preliminary INFORM support
+
+daves  7 Oct 99 08:42:15
+    - (agent_trap.[ch]): Improve accessibility for subagents
+
+daves  7 Oct 99 09:01:25
+    - (agentx/subagent.c agentx/master_admin.c): Notification support
+
+mslifcak 12 Oct 99 05:58:28
+    mib.c : quick_print is exposed for CMU_COMPATIBLE builds.
+    lcd_time.c : commented unused dump_etimelist_entry under SNMP_TESTING_CODE.
+
+mslifcak 12 Oct 99 06:07:44
+    Define address length for FreeBSD platform.
+
+mslifcak 13 Oct 99 03:54:02
+    add missing proto for save_persistent.
+
+nba 13 Oct 99 07:09:36
+    - master_admin.c, system_mib.h: includes for prototypes
+
+mslifcak 15 Oct 99 07:09:14
+    -(default_store.c, callback.c) fix
+    bug in array-boundary check in snmplib/callback.c
+    reported by Bert Holstein 15 Oct 1999.
+
+hardaker 20 Oct 99 17:26:59
+    - (header_complex.c): parsed strings from oid's include null terminators.
+
+hardaker 20 Oct 99 18:08:39
+    - (mib.c): enable oid parser to handle simple embedded strings in oids
+      and to translate them into oid segments.
+      EG: .1.3.\"hello\".\'hi\' -> .1.3.5.104.101.108.108.111.104.105
+
+hardaker 21 Oct 99 10:07:00
+    - (mib.c): enable oidname."hi".'there' in get_module_node() as well.
+
+mslifcak 21 Oct 99 10:20:15
+    Note  SNMPERR_UNKNOWN_OBJID error without specifying snmp_errno _outside_ the library.
+
+mslifcak 21 Oct 99 10:26:29
+    Note  SNMPERR_UNKNOWN_OBJID error from within the library.
+
+mslifcak 21 Oct 99 10:37:49
+    mib.c - restore line stomped in my last update.
+    read_config.c - drop unused variable.
+    snmp_api.c - new method snmp_open_ex replaces set internal hook functions.
+
+mslifcak 21 Oct 99 10:39:09
+    Fixups for building with MSVC++. (no hpux.c, supply MAX_PERSISTENT_BACKUPS).
+
+mslifcak 21 Oct 99 10:41:38
+    reminders for snmp_sess_perror usage after open.
+    snmptable.c - open/close session from main().
+    netstat/main.c - use snmp_sess_perror.
+
+mslifcak 21 Oct 99 10:42:28
+    use snmp_open_ex.
+
+mslifcak 21 Oct 99 12:09:51
+    Fix BUG#78
+
+mslifcak 21 Oct 99 12:31:28
+    small patch from M. Laukkanen to fix HP aCC build.
+
+nba 21 Oct 99 12:52:26
+    - memory_solaris.c: reorder computations to avoid overflow.
+
+nba 21 Oct 99 12:54:41
+    - memory_solaris2.c: reorder computations to avoid overflow.
+
+mslifcak 22 Oct 99 06:29:16
+    In fixing bug #83 on 4.0 branch, discovered that 3.6 branch
+    did not have "octet" token support.  Added.
+
+mslifcak 22 Oct 99 06:29:52
+    Fix BUG #83.
+
+mslifcak 22 Oct 99 07:39:01
+    Removed duplicated variable in a nested block. ARg!
+
+hardaker 22 Oct 99 09:59:39
+    - (mib.c): enable hex strings inside oids.
+
+mslifcak 22 Oct 99 10:12:26
+    Display _some_ octet string indices of object identifiers as quoted printable.
+    Should be expanded to handle other INDEX types.
+
+hardaker 22 Oct 99 15:28:59
+    - (acconfig.h, config.h.in, configure, configure.in, keytools.c,
+      keytools.h, scapi.c):
+      - use openssl for md5/sha support (from Olafur Gudmundsson).
+
+hardaker 22 Oct 99 15:29:38
+    - (mib.c): print string based OIDs better.
+
+hardaker 24 Oct 99 08:24:02
+    - (configure, configure.in): SNMPCONFPATH uses sysconfdir not datadir.
+
+hardaker 24 Oct 99 08:24:21
+    - (README.snmpv3): typo.
+
+hardaker 24 Oct 99 08:25:35
+    - (mib.c): fix "mibs" and "mibdirs" .conf directives to properly
+      handle multiple calls (additive) and '+'s and things.
+
+hardaker 24 Oct 99 08:27:28
+    - (read_config.c):
+      - premib directives weren't getting read due to a missing negation (!).
+      - more parsing debugging statements added.
+
+mslifcak 25 Oct 99 08:06:32
+    minor rework to clarify signed compares and remove unused variables.
+
+nba 25 Oct 99 13:39:27
+    - interfaces.c: fix a memory leak in the Linux part
+
+nba 25 Oct 99 13:41:01
+    - configure.in, proc.c: support for FreeBSD 2.1 where ps doesn't have c flag
+
+nba 25 Oct 99 13:51:22
+    - hr_system.c: play it safe when no utmp file exists
+
+nba 25 Oct 99 13:53:26
+    - snmptrapd.c, snmptrapd_handlers.c: support for traphandle DEFAULT
+
+nba 25 Oct 99 13:56:26
+    - RUNTESTS, TESTCONF.sh eval_onescript.sh eval_tools.sh: support non-bash
+    	shells (echo -n vs echo \\c). Don't require . in PATH
+
+nba 25 Oct 99 13:58:03
+    - snmptranslate.c: let ':' in OID do "the right thing"
+
+nba 25 Oct 99 13:59:05
+    - pass.c: do an htonl when passing ip address
+
+nba 25 Oct 99 14:07:11
+    - snmpdelta.c: COUNTER64 will dereference freed pointer
+
+nba 25 Oct 99 14:08:25
+    - snmpd.conf.5.def: minor quirk
+
+nba 25 Oct 99 14:13:57
+    - *: configure support for dmalloc malloc debugger (www.dmalloc.com)
+
+hardaker 25 Oct 99 14:35:51
+    - (snmptranslate.c): enable -p printing of only a section of the mib tree.
+
+hardaker 25 Oct 99 16:05:03
+    - (snmptranslate.c, parse.c): hack to do wild card searches for a mib node.
+
+mslifcak 26 Oct 99 10:34:40
+    Allow unsigned range for counter/gauge/timeticks (fix BUG#84 per Sander Steffann).
+
+hardaker 27 Oct 99 14:33:33
+    - (Makefile.in): fix up ucd-snmp-config.h building.
+
+hardaker 27 Oct 99 14:34:10
+    - (snmp_agent.h): prototype agent_check_and_process().
+
+hardaker 27 Oct 99 14:34:55
+    - (Makefile.in, ucd-snmp-agent-includes.h): added a header file to
+      wrap around the various agent include files.
+
+hardaker 27 Oct 99 14:35:27
+    - (master_admin.c): simple debugging so you can watch stuff register.
+
+hardaker 27 Oct 99 14:36:21
+    - (Makefile.in, default_store.3, default_store.3.bot,
+      default_store.3.h, default_store.3.top, snmp_agent_api.3):
+      - new manual pages: default_store.3, snmp_agent_api.3.
+
+hardaker 27 Oct 99 14:36:55
+    - (default_store.h):
+      - mark regions to be included in the default_store.3 manual page.
+
+hardaker 27 Oct 99 14:37:49
+    - (lcd_time.h): define and comment LCD_TIME_SYNC_OPT better.
+
+hardaker 27 Oct 99 14:38:06
+    - (ucd-snmp-includes.h): add default_store.h and snmp_logging.h
+
+hardaker 27 Oct 99 17:12:01
+    - (ucd-snmp-includes.h): added more include files.
+
+hardaker 27 Oct 99 17:12:59
+    - (mib.c): bail if we can't find an index in the mib tree to use for
+      breaking an oid apart.
+
+hardaker 27 Oct 99 17:30:25
+    - (vacm_vars.c): watch for null communities when printing debug statements.
+
+mslifcak 28 Oct 99 04:55:52
+    Dave's comment about pre_parse etc. was too good to lose in e-mail.
+
+mslifcak 28 Oct 99 05:23:05
+    u_int8/16/32_t types no longer needed for WIN32 builds.
+
+mslifcak 28 Oct 99 05:25:02
+    Oops! restore version r1.131.
+
+mslifcak 28 Oct 99 06:49:03
+    rephrase subtree not found code in _get_symbol.
+
+hardaker 28 Oct 99 13:47:57
+    - (snmptosql): debugging and error checking.
+
+hardaker 29 Oct 99 08:58:17
+    - (mib2c.conf, mib2c.vartypes.conf): Patch from Keith Tuson:
+      - misc fixes.
+
+hardaker 29 Oct 99 09:28:11
+    - (FAQ): added reference to an above question for perl installation.
+
+hardaker 29 Oct 99 09:28:43
+    - (ucd-snmp-agent-includes.h): added var_struct.h and agent_read_config.h
+
+hardaker 29 Oct 99 09:52:18
+    - (default_store.h, mib.c): two new printing options:
+      - printNumericOids
+      - printNumericEnums
+
+hardaker 29 Oct 99 10:06:03
+    - (ds_agent.h, snmp_agent.c, snmpd.c, snmp_parse_args.c):
+      - snmp over TCP options: -T TCP.
+      - new quick print options: -qo -qe for numeric oids and enums.
+
+hardaker 29 Oct 99 10:13:44
+    - (snmpcmd.1): document -T and -q[oe]
+
+hardaker 29 Oct 99 10:15:01
+    -(default_store.3{,.h}): removed from CVS since they are built
+
+hardaker 29 Oct 99 10:15:43
+    - (.cvsignore): ignore default_store.3{,.h}
+
+hardaker 29 Oct 99 16:58:07
+    - (tkmib): make it do snmpv3.  Added many things to the options menu.
+
+marz 29 Oct 99 19:54:10
+     (apps/snmp_parse_args.c, snmplib/snmpv3.c): make engineID setup conditional on app type to prevent apps from easily ending up with the same engineID as agent on same host
+
+hardaker  1 Nov 99 13:18:00
+    - (snmp_parse_args.c, default_store.h, mib.c, snmp_alarm.c):
+      - don't break oids into pieces if quick_print is turned on.
+      - ditto if the new default_store option is turned on.
+      - made a default_store option to not use sigalrm for snmp_alarms.
+
+hardaker  2 Nov 99 09:57:31
+    - (Makefile.in): install other header files needed by SNMP.pm.
+
+mslifcak  2 Nov 99 15:37:05
+    Use HAVE_STDARG_H when deciding to use varargs vs ANSI-C prototypes.
+
+mslifcak  2 Nov 99 15:46:08
+    Install snmp_agent_api.3
+
+mslifcak  3 Nov 99 06:11:03
+    declare find_best_tree_node for MSVC build.
+
+mslifcak  3 Nov 99 06:49:30
+    Near line 663 : close(fd) before invoking wait_on_exec
+
+mslifcak  3 Nov 99 13:18:59
+    Following call to fdopen (near get_exec_output), do not close(fd).
+
+mslifcak  3 Nov 99 13:20:16
+    Fix build problem on Linux RedHat 6.0 : key off GNU_LIBRARY value.
+
+mslifcak  4 Nov 99 02:42:15
+    Patch to build BSD/OS 4.0.1; from Bert Driehuis -- driehuis@playbeing.org
+
+mslifcak  4 Nov 99 04:14:28
+    More STDC_HEADERS cleanup: use HAVE_STRING_H, HAVE_STDLIB_H instead.
+
+mslifcak  4 Nov 99 04:33:32
+    Change example away from STDC_HEADERS.
+
+mslifcak  4 Nov 99 05:08:31
+    Every #define is given a value; set to 1 if no value was specified.
+
+mslifcak  4 Nov 99 05:13:05
+    First pass support for FreeBSD 4.0 [problems with proc table lookups].
+
+mslifcak  4 Nov 99 06:11:48
+    Use sysctl(CTL_VM..) to get virtual memory stats.
+
+hardaker  4 Nov 99 10:03:47
+    - (Makefile.in, acconfig.h, config.h.in, configure, configure.in, mib.c):
+      - define IN_UCD_SNMP_SOURCE in config.h but not in ucd-snmp-config.h.
+      - move ucd-snmp-config.h up in the build order before subdirs.
+      - Make default MIBDIRS search path include $HOME/.snmp/mibs.
+      - Make MIBDIRS parsing handle $HOME variables in it.
+
+hardaker  4 Nov 99 10:04:42
+    - (mib2c.conf): include headers for compilation for both internal and
+      external to the ucd-snmp source.
+
+mslifcak  4 Nov 99 10:19:35
+    Redo FreeBSD 4.0: define freebsd3 in s/freebsd4.h; reduce "define" thrashing.
+
+hardaker  4 Nov 99 10:28:44
+    - (snmp_parse_args.c, snmpcmd.1): move -q flags to -O.
+
+mslifcak  4 Nov 99 13:43:40
+    Speed up sprint_variable: halve the number of calls to get_symbol.
+
+mslifcak  5 Nov 99 06:22:52
+    Say goodbye to SNMP_MALLOC, malloc_zero, xcalloc, xmalloc, and xstrdup.
+    Respectively replaced with calloc, calloc, calloc, malloc, and strdup.
+
+nba  9 Nov 99 01:50:09
+    - mib.c,parse.c: make error reporting in parser work according to spec (-Pe)
+    	show defining modules in snmptranslate -d
+    	use ds_toggle_boolean
+
+nba  9 Nov 99 12:59:52
+    - snmptrapd.c,snmptrapd_handlers.c: make it compile with VC++ 5.0
+    	(but no handlers (yet))
+
+hardaker  9 Nov 99 13:02:17
+    - (snmpd.c): fix -H.
+
+hardaker  9 Nov 99 13:02:41
+    - (ucd_snmp.h): require the DEMO-MIB (just for tutorial purposes).
+
+hardaker  9 Nov 99 13:09:21
+    - (vacm_vars.c, vacm_vars.h): simple new .conf tokens: rocommunity, rwcommity.
+
+hardaker  9 Nov 99 13:09:40
+    - (Makefile.in): install the DEMO-MIB.
+
+nba  9 Nov 99 15:16:03
+    - various: adapt tools to use getopt (and put one in for Win32)
+
+nba  9 Nov 99 22:20:52
+    . snmp_parse_args.c: a glitch in the conversion to getopt (thanks to
+    	driehuis@playbeing.org)
+
+nba  9 Nov 99 23:30:03
+    - getopt.h: arguments to getopt did not match those in getopt.c
+
+nba 10 Nov 99 08:30:13
+    - win32/*: fixes to the VC++ build projects
+
+nba 10 Nov 99 08:32:00
+    - win32/*: VC++ project updates
+
+daves 10 Nov 99 08:57:00
+    - (agent/agent_read_config.c): Only set up trap sinks on the master agent
+
+daves 10 Nov 99 08:58:38
+    - (agent/agent_trap.[ch]): minor re-structure to allow subagent trap "sinks"
+
+daves 10 Nov 99 08:59:45
+    - (agentx/subagent.c): Fix AgentX notify support
+
+nba 10 Nov 99 12:20:47
+    - win32/*.dsp: yet another round of making this crap work
+
+nba 10 Nov 99 15:29:18
+    - apps/*: changes for getopt usage, and reworking of snmp_parse_args
+
+nba 10 Nov 99 22:12:08
+    - win32/*: clean up repository files, and add proper .cvsignore files
+
+daves 11 Nov 99 03:37:59
+    - (agentx/client.c): Silly typo in start time synchronisation
+
+nba 11 Nov 99 22:14:27
+    - snmpcmd.1: update man page to correspond to the new getopt situation
+    	Note: even though some options have been removed from this
+    	page, they still work!
+
+nba 11 Nov 99 22:50:00
+    - snmp_parse_args.c, mib.c: alignment of option code.
+    	Some enhancements to the snmptranslate -d output.
+
+daves 12 Nov 99 08:46:33
+    - (snmplib/snmp_api.c): Provide a unique ID for all incoming PDUs
+
+marz 12 Nov 99 13:01:08
+     (lcd_time.[ch], snmpusm.c): fix enginetime update algorithm to conform to spec rfc2574 3.2.7.b.1
+
+nba 14 Nov 99 01:48:51
+    - snmptable, snmp_parse_args: allow the application specific options to
+
+nba 14 Nov 99 01:51:57
+    - snmptable: add in the application specific snmptable options between
+    	the normal options.
+
+nba 14 Nov 99 01:53:16
+    - snmpbulkget: new tool to issue a single GETBULK request
+
+nba 14 Nov 99 01:54:17
+    - snmp_parse_args: changes to support multi-valued options
+
+nba 14 Nov 99 01:59:20
+    - mibs/*, vacm_vars.h: update the mib files to rfc 2571-2575. Also add
+    	SNMP_COMMUNITY_MIB from the coex draft.
+
+nba 14 Nov 99 02:00:00
+    - vacm_vars.c: kill a warning
+
+nba 14 Nov 99 02:01:37
+    - pass.c, snmpd.conf.5.def: add an UNSIGNED return type
+
+nba 14 Nov 99 02:04:46
+    - mib.c, snmptranslate.c: move the MIB:id handling inside read_objid for
+    	consistency. Also fixes a buffer overrun in mib.c
+
+nba 14 Nov 99 02:42:38
+    - SNMPv2-CONF.txt: comment out the IMPORT clause
+
+nba 14 Nov 99 06:12:03
+    - snmptrapd.c: add the new common -O option set
+
+nba 14 Nov 99 06:15:01
+    - snmptrapd.8: add the new common -O option set
+
+nba 14 Nov 99 06:32:25
+    - ipc6: Add the IPv6 code from the Kame project. I have only massaged
+    	it so much as to still compile on non-IPv6 systems, and detect
+    	Linux, INRIA, Solaris IPv6. No code for them yet. Original
+    	author: itojun@iijlab.net
+
+daves 15 Nov 99 07:56:06
+    - (agent/snmp_vars.c): Fix handling of failed GET/SET requests
+
+mslifcak 15 Nov 99 08:29:06
+    Fix description of read_objid return value.
+
+nba 15 Nov 99 14:00:20
+    - snmp_parse_args.c: further error checking, courtesy mslifcak
+      snmpbulkget.c: needs #include <getopt.h> (Thanks to Robert Story)
+
+nba 15 Nov 99 14:03:36
+    - mibs/: replace RFC1271-MIN.txt with RMON-MIB.txt (RFC 1757 version)
+
+nba 15 Nov 99 14:05:57
+    - parse.c: fix a spelling error in the MIB replacement table.
+
+nba 15 Nov 99 14:09:29
+    - .cvsignore: updates to keep cvs silent about generated files.
+
+hardaker 15 Nov 99 15:18:46
+    - (FAQ, README): new mirror in Australia.
+
+hardaker 15 Nov 99 15:19:22
+    - (mib_modules.c, snmp_vars.c): move subagent_pre_init() to init_agent().
+
+hardaker 15 Nov 99 15:19:47
+    - (TODO): memory int -> uint.
+
+hardaker 15 Nov 99 15:20:10
+    - (header_complex.c): set to '\0' instead of NULL for -Wall.
+
+hardaker 15 Nov 99 15:21:07
+    - (mib2c, tkmib): remove -w.
+
+hardaker 15 Nov 99 15:21:28
+    - (snmp_agent_api.3): don't call subagent_pre_init().
+
+hardaker 15 Nov 99 15:21:57
+    - (mib2c.storage.conf): debugging statements inserted.
+
+hardaker 15 Nov 99 15:22:24
+    - (asn1.c, asn1.h): new function: asn_check_packet().
+
+hardaker 15 Nov 99 15:36:26
+    - (snmpdelta.c, snmptable.c, snmptest.c, snmptranslate.c, snmptrapd.c):
+      - add default_store.h
+
+hardaker 15 Nov 99 15:38:25
+    - (default_store.h, mib.c): move more options to the ds_* routines.
+
+hardaker 15 Nov 99 15:41:38
+    - (snmp_api.c, snmp_api.h):
+      - move more options to the ds_* routines.
+      - implement support for TCP broken SNMP packets by storing buffers
+        and dealing with pieces of incoming data till we have a full packet.
+
+mslifcak 15 Nov 99 16:43:25
+    Don't add NULL varbind when ENDOFMIBVIEW is reached.
+
+hardaker 15 Nov 99 17:41:10
+    - (snmp_agent.c, master.c, protocol.c, protocol.h, subagent.c,
+      snmp_api.c, snmp_api.h):
+      - make TCP support better for agentx.  Still has a problem (I broke agentx).
+
+mslifcak 15 Nov 99 21:57:36
+    Fix bug#75: build --without-opaque-types
+
+mslifcak 16 Nov 99 03:36:09
+    Fix spelling misteak.
+
+nba 16 Nov 99 06:21:25
+    - snmp_parse_args.c, snmptranslate.c, mib.c: redo the snmptranslate options
+    	to follow the common option set. Issue warnings when someone
+    	uses the old form, advising about the new.
+
+mslifcak 16 Nov 99 08:48:31
+    Embrace all HP-9000/6xx,7xx, 8xx series platforms, without regrets.
+
+daves 16 Nov 99 09:13:59
+    - (snmplib/asn1.c): Fix encoding of root OIDs.
+
+hardaker 16 Nov 99 10:24:59
+    - (protocol.c): add the header length to the packet length estimate.
+
+hardaker 16 Nov 99 10:26:02
+    - (snmp_parse_args.c): add the T: flag for -T to getopt
+
+mslifcak 16 Nov 99 14:41:50
+    MSVC touchups:
+    Added snmptrapd project .DSP file; All .DS[PW] files CR-LF line terminated;
+    Fix warnings in asn1.c and snmp_api.c; Remove unused var in snmptranslate.c.
+
+mslifcak 16 Nov 99 14:56:59
+    Build with getopt.
+
+mslifcak 17 Nov 99 05:59:15
+    Replace u_int16_t with more universally supported u_short.
+
+mslifcak 17 Nov 99 07:35:03
+    Project file for building snmpbulkget using MSVC++ gratis Robert Story.
+
+mslifcak 17 Nov 99 07:36:58
+    Add snmpbulkget to list of apps to build.
+
+hardaker 17 Nov 99 11:55:41
+    - (ds_agent.h, kernel.c, snmpd.c, snmpd.1.def):
+      - run time rootless running support for snmpd, by reqest of Joe. (-r)
+
+hardaker 17 Nov 99 12:21:26
+    - (snmptosql):
+      - move to Net::SMTP.
+      - Make new authgroup and authhost tables to contain SNMP::Session defaults.
+
+hardaker 17 Nov 99 13:05:00
+    - (configure.in): update the so LD for linux to $(CC).
+
+hardaker 17 Nov 99 13:08:17
+    - (configure): update.
+
+hardaker 17 Nov 99 13:09:14
+    - (mib2c.storage.conf): update.  Deals with RowStatus objects better.
+
+nba 17 Nov 99 21:51:19
+    - default_store.c: ds_toggle_boolean missed a mask
+
+mslifcak 18 Nov 99 17:58:47
+    Check-in agent changes to support Win32 agent built with MSVC++.
+    Thanks to Robert Story.
+
+mslifcak 18 Nov 99 18:14:58
+    More touchup per MSVC++ Win32 agent work.
+
+mslifcak 18 Nov 99 18:20:45
+    More MSVC++ Win32 agent files, gratis Robert Story.
+
+daves 19 Nov 99 11:06:26
+    - (agent/agent_registry.h): Provide missing index allocation defines.
+
+hardaker 19 Nov 99 13:47:01
+    - (mib2c.storage.conf): fix mib2c.storage.conf.
+
+hardaker 19 Nov 99 14:20:25
+    - (snmp_vars.c, snmpd.c, snmp_alarm.h, snmp_api.c):
+      - make snmp_select_info possibly handle alarm timers.
+      - make snmpd use them and call snmp_run_alarms().
+
+hardaker 19 Nov 99 15:24:15
+    - (acconfig.h, config.h.in, configure, configure.in, sedscript.in,
+      disk.c, disk.h, UCD-SNMP-MIB.txt): Patch from Andy HOOD:
+      - monitor disk inode percentages.
+
+nba 22 Nov 99 05:27:15
+    - configure.in: configure test for netinet/ip.h
+
+nba 22 Nov 99 05:28:09
+     snmp_logging.c: only timestamp efter a newline
+
+nba 22 Nov 99 05:28:45
+    - snmpd.c: reinstate snmpd -a functionality
+
+nba 22 Nov 99 05:29:37
+    - pass.c: remove a const casting warning
+
+nba 22 Nov 99 05:32:05
+    - IPV6-TCP-MIB, IPV6-UDP-MIB, ipv6.c, tcp.c: move the IPv6 tcp and udp
+    	tables to their proper position in the tree, according to the RFC.
+
+nba 22 Nov 99 06:59:46
+    - ipv6.c: upgrade to the current Kame patch
+
+nba 22 Nov 99 07:16:59
+    - ipv6.c: some more ANSI prototypes
+
+daves 22 Nov 99 07:30:06
+    - (agent_registry.[ch] agentx/client.[ch] agentx/master_admin.c):
+      Index de-allocation, and AgentX index support.
+
+mslifcak 22 Nov 99 08:20:29
+    Retry add MSVC++ project file.
+
+mslifcak 22 Nov 99 08:21:58
+    Add CVS ignore list for win32/libagent.
+
+hardaker 22 Nov 99 08:29:33
+    - (snmptable.c): Patch from Robert Story:
+      - Added ability to use MIB to query tables with non-sequential column OIDs.
+      - Added code to handle sparse tables.
+
+hardaker 22 Nov 99 09:00:45
+    - (usmUser.c): fix oid -> char conversions pointed out by Michael Slifcak.
+
+hardaker 22 Nov 99 09:07:34
+    - (README): added more people to the thanks list.
+
+hardaker 22 Nov 99 09:18:15
+    - (configure, configure.in, host_res.h, hr_filesys.c, hr_storage.c,
+      hr_swrun.c, hr_system.c, bsdi4.h): Patch from Bert Driehuis:
+      - bsdi support for the host resources mib.
+
+hardaker 22 Nov 99 09:24:51
+    - (T016snmpv2cgetfail, T017snmpv2ctov1getfail): update tests for new
+      error messages.
+
+hardaker 22 Nov 99 12:30:05
+    - (vmstat.c, vmstat_freebsd2.c): use header_generic not header_simple_table
+
+hardaker 22 Nov 99 12:49:21
+    - (vacm_vars.c, pass.c): fix oid -> char conversions.
+
+nba 22 Nov 99 12:54:08
+    - *: change the first argument of the config parser functions to a
+    	const string
+
+hardaker 22 Nov 99 13:05:05
+    - (acconfig.h, config.h.in, configure, configure.in, tcp.c): Patch
+      from Garrett Wollman:
+      - FreeBSD 4.x fixes.
+
+hardaker 22 Nov 99 16:48:54
+    - (snmp_vars.c): remove creation of initial and template* users.
+
+hardaker 22 Nov 99 16:50:25
+    - (vacm_vars.c, usmUser.c): new config tokens allowing easy user and
+      vacm/user configuration and setup.
+
+hardaker 22 Nov 99 17:02:11
+    - (scapi.c): fix length check of key space.
+
+hardaker 22 Nov 99 17:52:36
+    - (README.snmpv3): update to reflect new and easier .conf mechanisms.
+
+nba 23 Nov 99 01:23:16
+    - ipv6.h: remove an __P that had sneaked in
+
+nba 23 Nov 99 01:24:37
+    - IPSEC-MIB.txt: change some underlines into dashes, and repair the
+    	::= (maybe I should have looked at this file before adding it :-))
+
+nba 23 Nov 99 01:26:26
+    - pass_persist.c: fix some arguments (int => size_t). Thanks to
+    	Anthony Shipman <ashipman@erggroup.com>
+
+daves 23 Nov 99 01:37:29
+    - (host/hr_swrun.c): Fix linux process memory usage figures.
+    	(Reported by Mitch Shields)
+
+daves 23 Nov 99 02:11:43
+    - (host/hr_storage.c host/hr_swrun.c): Guard against calculation overflow
+
+nba 23 Nov 99 02:20:13
+    - snmp_agent.c: #include <unistd.h> for select prototype
+
+daves 23 Nov 99 05:21:58
+    - (snmp_agent.c agentx/subagent.c):
+       Make main session structure visible throughout the agent,
+       and use this for AgentX subagent as well.
+
+daves 23 Nov 99 05:40:09
+    - (agent_registry.[ch]):
+      - Make index registration API more immediately convenient
+      - Associate such registrations with the main session
+      - new routine to unregister all indexes for a given session
+      - differentiate between ANY index and NEW index
+      - clean up assorted compiler warnings
+
+hardaker 23 Nov 99 17:51:44
+    - (snmptosql): fix from address line, other misc fixes.
+
+daves 24 Nov 99 09:03:00
+    - (agentx/master_admin.c): Release allocated indexes on subagent shutdown.
+
+hardaker 24 Nov 99 09:09:08
+    - (acconfig.h, config.h.in, configure, configure.in, usmUser.c,
+      keytools.c, keytools.h, lcd_time.c, scapi.h, tools.c,
+      keymanagetest.c, scapitest.c, config.h):
+      - force --enable-developer for CVS checkouts.
+      - remove all references to KMT.
+
+hardaker 24 Nov 99 09:16:02
+    - (INSTALL): change editing of config.h note.
+
+hardaker 24 Nov 99 10:43:08
+    - (vacm_vars.c): Patch from Frank Strauss:
+      - allow seperation of mask with both . and :.
+
+mslifcak 24 Nov 99 11:07:05
+    Fix BUG#57 using modified patch supplied by zany@triq.net.
+
+mslifcak 24 Nov 99 11:07:49
+    Fix BUG#57 using 2/3 of patch supplied by zany@triq.net.
+
+nba 25 Nov 99 14:32:47
+    - snmp_api.c, agent_trap.c, snmp_agent.c, snmp_mib.h, snmp_mib.c:
+    	fix misalignment of statistics counters
+
+nba 25 Nov 99 14:33:15
+    - snmp_mib.h: fix misalignment of statistics counters
+
+nba 25 Nov 99 14:52:57
+    - usmUser.c: new user is not added unless both auth and priv is specified
+    	on createUser directive
+
+nba 25 Nov 99 14:56:12
+    - defaults_store.h, snmp_api.c, snmp_parse_args.c: add defCommunity
+    	directive
+    - snmp_api.h, snmp_api.c: add errorcode for malloc failure
+
+nba 25 Nov 99 14:57:57
+    - mib.c: kill yet another silly warning from gcc
+
+nba 26 Nov 99 11:18:23
+    - default_store.c: although read_config is case insensitive, ds_handle_config
+    	was not. At the same time it failed to report the problem that
+    	it was called but didn't know what to do.
+
+marz 27 Nov 99 06:31:11
+     (agent/kernel.c, testing/eval_tools.sh): fix -r switch to supress error messages about failed kernel and add -r to default testing code so 'make test can be run by user
+
+hardaker 27 Nov 99 09:18:15
+    - (vacm_vars.c): redo rwuser/rouser to allow specification of auth type.
+
+mslifcak 29 Nov 99 05:50:27
+    More HP-UX aCC fixes supplied by Markku Laukkanen.
+
+mslifcak 29 Nov 99 10:30:51
+    Use ntohs macro to carefully obtain the default service port.
+
+mslifcak 29 Nov 99 10:33:45
+    Fix reference to snmplib.
+
+mslifcak 29 Nov 99 10:36:43
+    Remove last vestiges of DEBUG_MALLOC_INC fragments.
+
+mslifcak 29 Nov 99 11:58:37
+    Free STREAM packet buffer when session is closed;
+    Test for close in progress for read, write, select, and timeout functions.
+
+mslifcak 29 Nov 99 12:43:34
+    Use size_t for name_len member.
+
+hardaker 29 Nov 99 14:02:08
+    - (system.c, system.h): implement strcasestr (from Michael Slifcak).
+
+hardaker 29 Nov 99 14:02:50
+    - (parse.c): make best matching (-b) use regex when available.
+
+hardaker 29 Nov 99 14:03:49
+    - (config.h.in, configure, configure.in):
+      - check for regex.h, regcomp, strcasestr.
+
+hardaker 29 Nov 99 14:04:09
+    - (README): another name.
+
+nba 30 Nov 99 03:01:34
+    - snmp_api.h, snmp_mib.[ch]: A couple additional SNMP statistics points
+
+daves 30 Nov 99 07:07:01
+    - (agentx/master.c): Remove redundent routine.
+
+daves 30 Nov 99 07:08:43
+    - (agentx/master_request.c): Fix handling of multi-variable requests to subagents.
+
+mslifcak 30 Nov 99 13:10:40
+    Fix -Td usage description; use switch when current_name is NULL.
+
+mslifcak 30 Nov 99 13:11:14
+    Include ctype.h
+
+hardaker 30 Nov 99 14:30:32
+    - (snmp_parse_args.c, mib.c, mib.h, parse.c): implement regex matching
+      everywhere.
+
+mslifcak 30 Nov 99 14:47:36
+    Use Wes' cool new get_wild_node match method.
+
+mslifcak 30 Nov 99 16:50:41
+    Add multiple match capability to find_best_tree_node, and use it in
+    snmptranslate (new -B option).
+
+mslifcak  1 Dec 99 06:40:07
+    Error check and free resources during regex processing.
+
+mslifcak  1 Dec 99 10:38:18
+    Prevent overflow of object ID in get_module_node.
+    In find_best_tree_node, treat result from recursed call same for match = 0.
+
+mslifcak  1 Dec 99 15:55:56
+    Fix bug #112 and finish patch supplied by Anthony Shipman.
+
+mslifcak  1 Dec 99 16:32:14
+    Use SNMP_MAXBUF when defining large static buffer storage.
+
+nba  2 Dec 99 04:41:55
+    - mib.c: accessing and freeeing env_var misplaces around NULL test
+
+nba  2 Dec 99 04:42:57
+    - snmptrapd.c: fix snmp_clone_pdu2 by using the snmplib version
+
+nba  2 Dec 99 05:06:55
+    - usmUser.c snmpv3.[ch]: move usm_parse_create_usmUser from the agent
+     	to the library, so that snmptrapd can use it.
+
+mslifcak  2 Dec 99 09:21:45
+    Fix bug #81 - continue install after error creating persistent directory.
+
+hardaker  2 Dec 99 16:59:55
+    - (parse.c): turn on REGEX_EXTENDED.
+
+nba  3 Dec 99 15:03:48
+    - snmptrapd.c: correct handling of SIGHUP tp reconfigure.
+
+nba  3 Dec 99 15:04:16
+    - snmptrapd_handlers.c: a little nicer error message
+
+nba  3 Dec 99 15:05:13
+    - parse.c: remember to NULL a freed pointer
+
+hardaker  3 Dec 99 16:51:43
+    - (configure, configure.in): switch to PIC from pic.
+
+hardaker  3 Dec 99 16:52:16
+    - (Makefile.in): use $(MAKE) instead of make.
+
+hardaker  3 Dec 99 16:52:51
+    - (vmstat.c): remove duplicate limits.h include.
+
+nba  5 Dec 99 21:49:50
+    - pass.c, pass_persist.c: ensure proper byte ordering when pass'ing
+    	ipaddress.
+
+mslifcak  6 Dec 99 09:19:08
+    Show all non-printable subids in dump_oid_to_string.
+    Recurse clear_tree_flags only if necessary.
+
+hardaker  6 Dec 99 13:47:41
+    - (snmp_parse_args.c): default specifications for auth/priv types.
+
+hardaker  6 Dec 99 13:51:34
+    - (snmp_parse_args.c): print error strings returned by generate_Ku().
+
+nba  6 Dec 99 14:32:22
+    - .cvsignore: Make CVS silent about installation files
+
+hardaker  6 Dec 99 14:48:08
+    - (snmpusm.c):
+      - make snmpusm usable again, changing arguments slightly.
+      - make it also use defaults for passphrases, user, etc.
+
+hardaker  6 Dec 99 14:56:21
+    - (Sv3config, T030snmpv3usercreation): make v3 testing work again.
+
+hardaker  6 Dec 99 14:58:28
+    - (snmpusm.c): fix usage for new args.
+
+mslifcak  6 Dec 99 15:09:53
+    Convert USM_ERR* to SNMPERR_USM*.
+
+nba  6 Dec 99 15:13:21
+    - system.c, config.h, win32.dsw, *.dsp, libsnmp.def: cleaning up for VC builds
+
+mslifcak  6 Dec 99 16:31:26
+    More fun updating MS VC build of apps and library.
+
+mslifcak  7 Dec 99 08:03:06
+    Use argv[0] since the app wont be snmpgetnext, probably.
+
+daves  7 Dec 99 08:29:55
+    - (agent/agent_read_config.[ch] agent/snmp_vars.[ch] agent/snmpd.[ch]
+       snmplib/read_config.[ch] snmplib/snmp_api.c):
+       -  Use the saved application name for registering config handlers
+    	(N.B: This change will need to be applied to MIB modules as well)
+
+hardaker  7 Dec 99 09:14:30
+    - (hr_other.c): shorten cpu description length.
+
+hardaker  7 Dec 99 09:17:41
+    - (sysORTable.c): make sysOrIndex not-accessible, as it should be.
+
+hardaker  7 Dec 99 09:32:02
+    - (UCD-SNMP-MIB.txt): Patch from Juergen Schoenwaelder:
+      - convert to SMIv2 and cleanup.
+
+hardaker  7 Dec 99 13:45:59
+    - (snmpwalk.c):
+      - New ability to peform a get on the requested OID when either no
+        results are returned or when the user requests an inclusive option.
+      - New ability to print number of variables found at the end.
+
+hardaker  7 Dec 99 13:54:11
+    - (snmpwalk.1): document -Ci and -Cp (badly).
+
+mslifcak  7 Dec 99 15:23:44
+    Eliminate multiplying by sizeof(char) or sizeof(unsigned char);
+    agentx/client.c - snmp_free_varbind replaces free in four places;
+    snmpv3/usmUser.c - usm_free_user replaces free in one place.
+
+hardaker  8 Dec 99 09:19:08
+    - (mib.c): register a config token for suffix printing.
+
+hardaker  8 Dec 99 14:08:20
+    - (UCD-SNMP-MIB.txt): make mrIndex IMPLIED since it is in the code.
+
+hardaker  8 Dec 99 14:41:53
+    - (mib.c): fix -Os and index based oid printing to work again.
+
+mslifcak  8 Dec 99 15:01:20
+    Include getopt.h to define optarg.
+
+mslifcak  8 Dec 99 15:04:54
+    Add missing dskPercentNode to DskEntry (thanks to
+             Michael Kirkham <support@iwl.com>).
+
+hardaker  8 Dec 99 15:23:07
+    - (mib.c, parse.c, parse.h):
+      - remembered IMPLIED indexes.
+      - properly print OIDs with length prefixes on parsed OIDs so
+        cutting/pasting of them works.
+      - properly print strings and oids that are IMPLIED.
+      - print strings in either ' or " quotes depending on if their IMPLIED.
+
+hardaker  8 Dec 99 15:26:51
+    - (README): add Juergen.
+
+hardaker  8 Dec 99 15:28:54
+    - (*..Makefile.in): make depend.
+
+hardaker  8 Dec 99 15:29:52
+    - (snmpd.c): move sys/param out of ifdef FD_SET.
+
+hardaker  8 Dec 99 15:47:02
+    - (*..Makefile.in): A real make depend with no ssl dependancies, etc.
+
+hardaker  8 Dec 99 15:49:32
+    - (makefileindepend.pl, makenosysdepend.pl, remove-files):
+      - move the make depend perl scripts to the top level where they only
+        need to be edited once.
+
+hardaker  8 Dec 99 17:13:17
+    - (acconfig.h, config.h.in, master.c, read_config.c, system.c, system.h):
+      - implement mkdirhier() and use it for persistent storage and agentx
+        socket file creation.
+
+daves  9 Dec 99 07:34:03
+    - (man/snmp_trap_api.3): Initial documentation for agent trap generation.
+
+nba  9 Dec 99 07:34:08
+    - mib.c: implement MIB::label
+
+nba  9 Dec 99 07:49:34
+    - snmpcmd.1: support MIB::label
+
+mslifcak  9 Dec 99 08:14:59
+    Patches supplied by Juergen Schoenwaelder.
+
+hardaker  9 Dec 99 10:08:26
+    - (Makefile.top, config.h.in, configure, configure.in,
+      agent/Makefile.in, snmplib/Makefile.in):
+      - fixed --enable-shared (at least on linux).
+
+hardaker  9 Dec 99 15:26:23
+    - (keytools.c): Patch from Leonard Gomelsky:
+      - generate_Ku() speed improvements.
+
+hardaker  9 Dec 99 16:16:40
+    - (UCD-SNMP-MIB.txt): changed all instances of kb to kB.
+
+hardaker  9 Dec 99 16:53:14
+    - (snmpnetstat/Makefile.in): fix for --enable-shared
+
+hardaker  9 Dec 99 17:09:23
+    - (agent/*Makefile.in): fix for --enable-shared on hpux
+
+nba 10 Dec 99 03:06:18
+    - master.c: add a missing #include <netinet/in.h> (at least for Solaris).
+
+nba 10 Dec 99 03:07:06
+    - pass.c: fix some buf/buf2 confusion
+
+nba 10 Dec 99 03:09:33
+    - pass_persist.c: fix some buf/buf2 confusion
+
+nba 10 Dec 99 03:10:30
+    - read_config.c: add some missing const specifiers
+
+nba 10 Dec 99 03:20:10
+    - (various): changes to compile snmpd with VC++ 5.0 (Release mode)
+
+mslifcak 10 Dec 99 07:28:33
+    Fix to build executable agent on HP-UX.
+
+mslifcak 10 Dec 99 10:23:36
+    Apply Dave's patch to fix max varbinds testing on GETBULK.
+
+marz 10 Dec 99 10:44:29
+     (snmlib/snmp_api.c): fix bug in _sess_copy where pointers that were not owned by newly created session could get mistakenly freed if errors were encountered during session copy - also eliminate some redundant copying of security{Auth|Priv}Key data
+
+mslifcak 10 Dec 99 13:03:58
+    Fix HP-UX problem with ipDefaultTTL.
+
+daves 13 Dec 99 03:17:41
+    - (agent_registry.c): Handle delegated MIB regions properly when split.
+
+daves 13 Dec 99 03:18:38
+    - (agent_trap.c): allow specification of enterprise OID when sending traps
+
+daves 13 Dec 99 04:43:14
+    - (agent/snmpd.c agent/mibgroup/smux/smux.[ch]):
+      - Patch to get SMUX support working with the new agent architecture.
+        This is probably not The Right Way To Do Things Now, but it works.
+        Thanks to Nick Amato and Mike Michaud.
+
+mslifcak 13 Dec 99 09:49:28
+    Added patch from M.Michaud to use send_enterprise_trap_vars.
+
+hardaker 13 Dec 99 09:57:37
+    - (DLMOD-MIB.txt, UCD-DLMOD-MIB.inc, UCD-DLMOD-MIB.txt):
+      - Juergens patch to move DLMOD-MIB -> UCD-DLMOD-MIB and -> SMIv2.
+      - moved to the experimental tree.
+
+mslifcak 13 Dec 99 12:04:15
+    Clean also removes generated default_store.3.h .
+
+mslifcak 13 Dec 99 13:54:27
+    Sanity checks added to _get_symbol.
+
+hardaker 13 Dec 99 14:20:10
+    - (config.h.in, configure, configure.in): --with-efence implemented.
+      - (forced checking for --enable-developer and CVS checkouts)
+
+mslifcak 13 Dec 99 14:54:31
+    Fix problem printing IMPLIED indices of OBJECTID type.
+
+mslifcak 13 Dec 99 15:12:01
+    Finish symbol conversion with numeric when subtree is leaf node.
+
+mslifcak 13 Dec 99 16:03:00
+    Allow sprint_variable to work even if no MIB files were read.
+
+hardaker 14 Dec 99 08:08:00
+    - (snmp_parse_args.c, snmptranslate.c, snmptrapd.c, default_store.h,
+      mib.c, mib.h):
+      - argument shuffling...
+        -I for input args created, and -OR moved there.
+        -Ib created.
+        -TB created for snmptranslate (was -B).
+
+hardaker 14 Dec 99 08:41:41
+    - (IANAifType-MIB.txt, UCD-SNMP-MIB.txt): Patch from Juergen Schoenwaelder:
+      - updates.
+
+hardaker 14 Dec 99 14:54:09
+    - (keytools.c): reverse generate_Ku optimizations, as they don't work.
+
+hardaker 14 Dec 99 15:19:35
+    - (Makefile.in): DLMOD -> UCD-DLMOD
+
+hardaker 14 Dec 99 16:05:08
+    - (configure, configure.in): move -lefence check up to front (last in link).
+
+hardaker 14 Dec 99 16:05:37
+    - (header_complex.c): get next in link list before deleting root.
+
+mslifcak 15 Dec 99 04:21:27
+    Isolate and retouch deprecated command line options.
+
+mslifcak 15 Dec 99 05:51:00
+    Share kstat fd iff ucd-snmp/memory_solaris2 is also configured.
+
+hardaker 15 Dec 99 09:17:03
+    - (EtherLike-MIB.txt, IPFILTER.txt, UCD-IPFILTER-MIB.inc,
+      UCD-IPFILTER-MIB.txt): Patch from Juergen Schoenwaelder:
+      - Even more updates.
+
+hardaker 15 Dec 99 09:19:14
+    - (SNMPv2-PARTY-MIB.txt SNMPv2-M2M-MIB.txt ): removed.
+
+mslifcak 15 Dec 99 09:42:44
+    Remove snmp_log_syslog, snmp_log_filelog, snmp_log_stderrlog;
+    Simplify snmp_log_string.
+
+mslifcak 15 Dec 99 09:56:24
+    Add time marker create, set, and delta time check methods.
+
+mslifcak 15 Dec 99 11:08:19
+    Replace kc from memory_solaris2.c with kstat_fd, defined in kernel_sunos5.c.
+
+nba 16 Dec 99 23:05:47
+    - kernel.c: output error string, not number
+
+nba 16 Dec 99 23:06:58
+    - snmpd.c: \n terminate some log messages
+
+nba 16 Dec 99 23:08:02
+    - smux.[ch]: fix some prototypes and includes.
+
+nba 16 Dec 99 23:08:54
+    - snmptranslate.c: be explicit in the -t warning
+
+nba 16 Dec 99 23:09:42
+    - mib.c: fix a tail recursion elimination problem printing oids
+
+nba 16 Dec 99 23:10:31
+    - snmpv3.c: a more spevific help message for defVersion
+
+nba 17 Dec 99 02:08:17
+    - mib.c: kill that tail recursion elimination, it just adds too many
+    	conditionals. Properly output an empty string index.
+
+nba 17 Dec 99 02:09:18
+    - snmp_parse_args.c: remove some superfluous usage() calls.
+
+nba 17 Dec 99 02:14:18
+    - snmptable.c: cleanup of the "new" mib walk to determine fields. Make it
+    	default (don't even document the -C compatibility option). Ignore
+    	not-accessible fields in the walk.
+
+nba 17 Dec 99 02:18:30
+    - snmptrapd.c: make the oids given to trapd handlers properly .0 terminated.
+    	Add a SNMP-COMMUNITY-MIB::snmpTrapAddress.0
+    	Add syslog of v2 traps and informs
+
+nba 17 Dec 99 03:22:39
+    - libsnmp.def: add some function names
+
+hardaker 17 Dec 99 07:03:09
+    - (snmpcmd.1): document -I and -O flags.
+
+hardaker 17 Dec 99 07:05:08
+    - (snmpcmd.1): mention that -IR and -Ib are actually used by default.
+
+hardaker 17 Dec 99 07:13:03
+    - (snmp.conf.5.def): document a bunch of new configuration options.
+
+hardaker 17 Dec 99 07:26:05
+    - (snmpd.conf.5.def): document rocommunity, rwcommunity, rouser, rwuser.
+
+hardaker 17 Dec 99 07:28:34
+    - (snmpd.conf.5.def): document the file directive.
+
+hardaker 17 Dec 99 07:40:43
+    - (snmpd.conf.5.def): document createUser.
+
+hardaker 17 Dec 99 10:10:42
+    - (NEWS): first pass at changes.
+
+hardaker 17 Dec 99 10:11:02
+    - (sedscript.in): PERSISTENT_DIRECTORY token added.
+
+hardaker 17 Dec 99 10:11:34
+    - (snmpd.c): reorder init() routines for -H to prevent segfaulting.
+
+hardaker 17 Dec 99 10:16:32
+    - (Makefile.in): put snmpd.o into the object list, and remove it from
+      direct compilation in the CC link line.
+
+hardaker 17 Dec 99 10:17:05
+    - (usmUser.c): changed help line of createUser to seperate DES token
+      from the passphrase.
+
+hardaker 17 Dec 99 10:17:28
+    - (snmp_parse_args.c): removed -R from the -h output.
+
+hardaker 17 Dec 99 10:18:24
+    - (NEWS): second pass.
+
+hardaker 17 Dec 99 10:18:42
+    - (snmp_agent_api.3): re-structure based on recent changes.
+
+mslifcak 17 Dec 99 14:23:25
+    Fixed a few spelilng errors.
+
+mslifcak 17 Dec 99 15:21:39
+    Add Bill Fumerola's patch for FreeBSD 4.x to use swapinfo.
+    Include FreeBSD 4.x specific memory and vmstat when building that agent.
+
+mslifcak 17 Dec 99 15:41:14
+    No dummy values for FreeBSD, please.
+
+hardaker 17 Dec 99 15:46:08
+    - (snmp_alarm.c): missing ! operater on signal test.
+
+hardaker 17 Dec 99 15:55:48
+    - (NEWS): mention -I.
+
+hardaker 17 Dec 99 15:56:27
+    - (agent_read_config.c, agent_registry.c, snmp_vars.c):
+      - include "snmp_alarm.h" for mib modules that need the callback def.
+
+hardaker 17 Dec 99 15:57:10
+    - (header_complex.c, header_complex.h): completely restructured.
+      - drasticly reduces memory usage for large data sets (1/3).
+
+daves 20 Dec 99 03:01:49
+    - (agentx/README.agentx): Updated to describe current status.
+
+daves 20 Dec 99 04:15:55
+    - (agent_trap.c snmp_vars.c mibII.[ch] mibII/*.c mibII/sysORTable.h):
+      - Use SNMP_OID prefix definitions in OID specifications.
+      - Register the various MIB-2 modules separately in sysORTable.
+
+hardaker 20 Dec 99 06:43:40
+    - (snmp_parse_args.c): Force set to 1 for -D so multiple switches can
+      be given (ie, don't toggle the value).
+
+hardaker 20 Dec 99 06:48:24
+    - (Makefile.in): moved kernel.o into the libucdagent library.
+
+hardaker 20 Dec 99 13:23:25
+    - (IPSEC-MIB.txt): removed
+
+hardaker 20 Dec 99 13:25:15
+    - (IPFWACC-MIB.txt): moved to UCD-IPFWACC-MIB.txt
+
+hardaker 20 Dec 99 13:26:09
+    - (UCD-IPFWACC-MIB.txt): moved and updated from IPFWACC-MIB.txt
+
+hardaker 20 Dec 99 13:30:06
+    - (UCD-IPFWACC-MIB.txt): moved table to one level deeper under mib node.
+
+hardaker 20 Dec 99 13:30:36
+    - (ipfwacc.c): moved table to one level deeper under mib node.
+
+hardaker 20 Dec 99 15:38:34
+    - (Makefile.in): IPFWACC-MIB.txt -> UCD-IPFWACC-MIB.txt
+
+hardaker 20 Dec 99 17:19:18
+    - (agent_trap.c): make uptime a long for 64bit architectures.
+
+hardaker 20 Dec 99 17:20:15
+    - (agentx/protocol.c): make a things size_t instead of u_int (for 64bit code).
+
+hardaker 20 Dec 99 17:20:55
+    - (snmp_api.c): Digital Unix hack for bad recvfrom implementation.
+
+hardaker 20 Dec 99 17:31:45
+    - (EXAMPLE.conf.def): minor note.
+
+hardaker 20 Dec 99 17:32:23
+    - (NEWS): mention SMIv2 updates.
+
+hardaker 20 Dec 99 17:32:37
+    - (mibincl.h): add agent_trap.h
+
+hardaker 20 Dec 99 17:34:31
+    - (version.h bug-report sedscript.in): version tag ( 4.1.pre1 )
+
+nba 21 Dec 99 02:37:19
+    - snmpd.c, smux.c, snmp_api.c: take away some unused variables.
+
+nba 22 Dec 99 02:41:42
+    - memory_freebsd2.c: make it work (again) for FreeBSD-2 :-)
+
+nba 22 Dec 99 02:43:15
+    - hr_storage.c: kill a dummy value
+
+nba 22 Dec 99 05:46:21
+    - system.c: naughty, naughty Niels, just reindenting ...
+
+nba 22 Dec 99 05:47:11
+    - system_mib.c: use some #defines i place of numbers
+
+nba 22 Dec 99 05:58:18
+    - vacm routines: alignment with RFC mibs, preparing for trap generation
+    	and a better integration with variable tree walking
+
+hardaker 22 Dec 99 15:12:26
+    - (master.c): use snmp_sess_open for the second try at opening the
+      master port.
+
+hardaker 22 Dec 99 15:13:05
+    - (master_request.c): increase max vars to 64 (was 16).  I have a
+      table with more than that number in columns, which breaks snmptable.
+
+hardaker 22 Dec 99 16:30:01
+    - (vmstat_solaris2.c, vmstat_solaris2.h): Patch from Jochen Kmietsch:
+      - first pass at vmstat support for solaris.
+
+hardaker 23 Dec 99 08:21:37
+    - (vmstat_solaris2.c): Patch from Jochen Kmietsch:
+      - non 80-column wrapped version.
+
+hardaker 28 Dec 99 15:42:08
+    - (master_request.c): remove the ! in front of in_a_view, which changed.
+
+hardaker 30 Dec 99 07:51:36
+    - (snmpd.c): usage line order messed up, as pointed out by Robert Story.
+
+mslifcak 30 Dec 99 12:00:58
+    Fix compile errors.
+
+mslifcak 31 Dec 99 09:31:12
+    Fix bug # 122
+
+mslifcak 31 Dec 99 09:32:58
+    Apply patch provided by Serg Trushnikov <sat@zmail.ru> for AIX 4.2.1 knlist
+
+mslifcak 31 Dec 99 10:11:12
+    Fix bug #125 - insert underscore into struct snmp_ipaddr member names.
+
+mslifcak 31 Dec 99 10:33:16
+    Autoconf patch c/o Albert Chin-A-Young <china@thewrittenword.com>
+
+mslifcak 31 Dec 99 10:36:46
+    Fix warnings of uninitialized variables.
+
+mslifcak 31 Dec 99 12:43:50
+    Fix bug #48 : no strcasecmp/strncasecmp for Sinix
+
+mslifcak 31 Dec 99 13:27:44
+    Apply some NetBSD 1.3.x, 1.4 patches c/o Grea A. Woods <woods@planix.com>
+
+nba  3 Jan 00 15:23:21
+    - EXAMPLE.conf.def: adapt to changes in valid vacm syntax
+
+nba  3 Jan 00 15:26:07
+    - snmp_vars.c: include agent_registry.h only once
+
+nba  3 Jan 00 15:26:51
+    - snmpd.c: add a missing const specifier
+
+nba  3 Jan 00 15:27:29
+    - mibII.h: add prototype for init_mibII
+
+nba  3 Jan 00 15:28:24
+    - wombat.[ch]: correct prototype for wombat_parse_config
+
+nba  3 Jan 00 15:30:26
+    - system.h: add prototype for strcasecmp
+
+nba  3 Jan 00 15:32:59
+    - parse.c: fix File variable being left pointing into the stack.
+    	Ignore .index file on WIN32 platform
+
+nba  3 Jan 00 15:34:22
+    - mib.c: also note TEXTUAL CONVENTION in -Td output
+
+nba  3 Jan 00 15:39:40
+    - snmpcmd.1: add snmpbulkget to list of applications
+    - snmptranslate.1: explain -T outputs
+    - snmptrapd.conf.5.def: defalt traphandler is implemented
+
+hardaker  4 Jan 00 08:58:24
+    - (README, FAQ): Japan mirror location change.
+
+hardaker  4 Jan 00 10:33:54
+    - (Makefile.in): install struct.h
+
+hardaker  4 Jan 00 10:35:06
+    - (snmp_agent.c): deal with blocking better in snmp_agent_check_and_process().
+
+hardaker  4 Jan 00 16:27:45
+    - (config.h.in, configure, configure.in): Patch from Sander Steffann:
+      - Add -I/usr/include/rpm because of badly written rpm header files.
+
+nba  4 Jan 00 22:12:10
+    - EXAMPLE.conf.def, FAQ, snmpd.conf.5.def: remove all traces of security
+    	model "any" in "group" configuration directives
+
+nba  4 Jan 00 23:50:27
+    - parse.c: #ifdef some variables not used under win32
+
+nba  4 Jan 00 23:51:11
+    - snmptrapd.c: implement trand handlers for win32
+
+daves  6 Jan 00 01:58:56
+    - (mibgroup/mibII.c): Remove redundant file
+
+hardaker  6 Jan 00 08:57:31
+    - (util_funcs.h): properly wrap struct.h include directive for
+      non-source-directory include.
+
+marz  6 Jan 00 12:56:50
+    update syntax (exact)
+
+marz  6 Jan 00 13:07:03
+    we should not print to stderr if stderr logging is diabled - this thows off the alignment of test output for 'make test' in both ucd-snmp and Perl/SNMP
+
+marz  6 Jan 00 13:14:10
+    update config access syntax (exact)
+
+hardaker  6 Jan 00 15:08:28
+    - (COPYING): y2k bug.
+
+hardaker  6 Jan 00 15:08:48
+    - (mib2c): removed a debugging statement.
+
+hardaker  6 Jan 00 15:09:20
+    - (mib2c.conf): unquoted quotes quoted.
+
+hardaker  7 Jan 00 09:29:06
+    - (snmp_agent.c): better handling of write failures.
+
+hardaker  7 Jan 00 10:38:48
+    - (snmpTargetAddrEntry.c, snmpTargetParamsEntry.c): update to v4 API set code.
+
+hardaker  7 Jan 00 11:22:40
+    - (snmptranslate.c): Patch from Robert Story:
+      - handle multiple translated OIDs.
+
+hardaker  7 Jan 00 16:21:50
+    - (vacm_vars.c): properly group rw/rousers into usm not v1/v2c.
+
+nba  7 Jan 00 23:43:10
+    - configure.in: some missing "x" in tests for --with-openssl and
+    	--disable-developer
+
+nba  8 Jan 00 00:56:30
+    - configure.in: bugfix for a bugfix bug
+
+mslifcak  8 Jan 00 11:44:58
+    Fix build for Linux RedHat 6.1 (cant link libwrap without libnsl).
+
+mslifcak  8 Jan 00 12:07:44
+    Use knlist iff aix4 and HAVE_KNLIST [not complete w/o configure mods]
+
+daves 10 Jan 00 01:37:32
+    - (agent/mibgroup/mibII.h): Re-remove redundant prototype.
+
+daves 10 Jan 00 02:31:39
+    - (snmplib/snmp_api.c): Differentiate max-repetition and non-repeater errors.
+
+daves 10 Jan 00 03:06:42
+    - (agent/snmp_agent.c): Count numbers of variables requested/set
+
+daves 10 Jan 00 06:12:40
+    - (snmplib/system.c): Re-structure get_uptime() to cache boot time.
+
+mslifcak 10 Jan 00 13:14:03
+    Allow MSVC++ 5.x users to build using this workspace.
+
+mslifcak 10 Jan 00 13:21:30
+    Qualify use of withval to define library and include search paths.
+
+marz 10 Jan 00 14:21:14
+    Checking in SNMP-3.1.0b1
+
+marz 10 Jan 00 14:34:50
+    *** empty log message ***
+
+marz 10 Jan 00 14:40:04
+    add mibload
+
+hardaker 10 Jan 00 15:36:18
+    - (mibincl.h): include stdlib.h and malloc.h.
+
+hardaker 10 Jan 00 15:36:40
+    - (Sv3config): remove the trailing space.
+
+hardaker 10 Jan 00 15:38:44
+    - (config.h.in, configure, configure.in):
+      - make --without-efence work.
+      - check for -lnsl more explicitly.
+
+mslifcak 10 Jan 00 16:30:51
+    ucdDemoPublic.c - remove uninitialized variables from write method.
+    snmp_vars.c     - proper oid compare; no copy from save if oids exact match
+    snmpd.c         - terminate statement.
+
+mslifcak 10 Jan 00 16:31:16
+    snmptranslate.1   - remove junk line.
+
+mslifcak 10 Jan 00 16:31:38
+    snmptranslate.c  - simple default case.
+
+mslifcak 10 Jan 00 16:32:08
+    snmp_api.c    - better comment for snmp_oid_compare.
+    read_config.c - remove sizeof(u_char) from malloc size calc.
+    scapi.h       - spell check.
+
+mslifcak 11 Jan 00 01:33:45
+    Trolling for malloc errors; more graceful degradation.
+
+mslifcak 11 Jan 00 01:53:08
+    Glean refs to mibII.o from this makefile.
+
+mslifcak 11 Jan 00 07:44:50
+    Add IN_UCD_SNMP_SOURCE to not break Win32 builds.
+
+mslifcak 11 Jan 00 07:59:23
+    Keep win32 release build from breaking.
+
+mslifcak 11 Jan 00 08:10:10
+    Init file count at zero, not by incrementing random value.
+
+mslifcak 11 Jan 00 09:13:38
+    Restore memdup usage to its former luster.
+
+marz 11 Jan 00 10:37:21
+    remove bad session test - session.t has it already - note the call to gethostbyname can hang for some time if DNS is not setup correctly - anyone know a way arround this?
+
+mslifcak 11 Jan 00 15:05:09
+    Use CFLAGS when linking (could have profile switch, etc).
+
+hardaker 12 Jan 00 11:16:27
+    - (snmpv3.c): cast malloc returns.
+
+mslifcak 12 Jan 00 21:09:47
+    Use DEBUGMSGOID liberally, replacing sprint_objid; small speedup.
+
+daves 13 Jan 00 02:46:47
+    - (agent/snmp_vars.c): Remove extraneous bracket.
+
+mslifcak 13 Jan 00 05:36:21
+    No get_boottime support for cygwin (yet). Hopefully a temporary condition.
+
+daves 13 Jan 00 06:31:44
+    - (snmplib/parse.[ch]): Unload MIB module
+    	(N.B: Somewhat simplistic with regard to multiply-loaded nodes)
+
+daves 13 Jan 00 06:33:40
+    - (snmplib/parse.c): More complete handling of unloading MIB modules.
+
+mslifcak 14 Jan 00 09:33:39
+    Small compile fix and debug message restoration.
+
+hardaker 14 Jan 00 11:34:25
+    - (bug-report): grep for configure flags
+
+hardaker 14 Jan 00 16:09:09
+    - (scapi.c): implement DES encryption.
+
+hardaker 14 Jan 00 16:10:29
+    - (NEWS): remove export control note about DES.
+
+daves 17 Jan 00 06:13:39
+    - (man/snmptrapd.8): Describe default logging behaviour.
+
+daves 17 Jan 00 09:02:32
+    - (agent/snmp_vars.c): Discard "too-late" responses from overlapped regions.
+
+marz 17 Jan 00 12:47:58
+    added v2 trap
+
+marz 18 Jan 00 07:00:26
+    modified for v2-trap.
+
+marz 18 Jan 00 07:54:12
+    fix error messages and return vals for trap funcs, clean up pdu
+
+mslifcak 18 Jan 00 08:14:42
+    Prevent array bounds error when creating specific trap oid.
+
+mslifcak 18 Jan 00 14:23:44
+    Latest vmstat_solaris2 from the author Jochen Kmietsch.
+
+mslifcak 18 Jan 00 21:22:06
+    Cleanup around ip6_vars.h include (no #if 0)
+
+mslifcak 18 Jan 00 21:25:53
+    Remove commented out objects that are MAX-ACCESS not-accessible.
+
+mslifcak 18 Jan 00 21:29:01
+    1.Make snmp_get_do_logging visible from DLL
+    2.Apply Win32 patch from R.Story to activate mib stats module (snmp_mib).
+
+mslifcak 18 Jan 00 21:37:02
+    Consistent getpagesize (first divide by 1024).
+
+daves 20 Jan 00 04:25:05
+    - (snmplib/snmp_api.c): Support selective binding of server addresses.
+
+mslifcak 21 Jan 00 01:46:04
+    Remove party crud; spell check.
+
+mslifcak 21 Jan 00 01:46:41
+    Add const to cleanup a few signatures.
+
+mslifcak 21 Jan 00 01:49:35
+    Minimize data handling and use register variabies in
+    snmp_oid_compare and compare_tree.
+
+marz 21 Jan 00 07:27:13
+    added v3 inform
+
+marz 21 Jan 00 08:00:27
+    inform.
+
+marz 21 Jan 00 08:13:25
+    inform
+
+marz 21 Jan 00 10:47:24
+    *** empty log message ***
+
+mslifcak 21 Jan 00 11:19:09
+    config_arch_require solaris2 version of vmstat.
+
+nba 23 Jan 00 08:51:39
+    - parse.c: add some more error checking to getoid
+
+nba 23 Jan 00 12:42:11
+    - parse.c: fix merging of anonymous nodes when they are named
+
+nba 23 Jan 00 12:43:54
+    - parse.c: errenous => erroneous
+
+marz 23 Jan 00 16:41:06
+    handle adding OPAQUE vars for setting and traps etc.
+
+daves 24 Jan 00 07:21:34
+    - (examples/{example,wombat}.[ch]):
+      - Consolidated example modules into one, including config and SET support.
+
+marz 24 Jan 00 08:59:32
+    *** empty log message ***
+
+mslifcak 24 Jan 00 09:44:45
+    Make sure kstat_fd is initialized before being used.
+
+mslifcak 24 Jan 00 09:55:32
+    Fix Bug #144 items 1,3,4 : case insensitive check for "all" keyword.
+
+mslifcak 24 Jan 00 10:05:12
+    Itojun's netbsd ELF patch + remove wombat [Dave's example fix]
+
+mslifcak 24 Jan 00 10:14:56
+    Fix printing IMPLIED index (from associate of J. Kmietsch) modified and applied.
+
+marz 24 Jan 00 10:36:43
+    *** empty log message ***
+
+marz 25 Jan 00 06:49:43
+    syntax for win32 build
+
+marz 25 Jan 00 11:47:12
+    add missing synbols for perl/SNMP module
+
+marz 25 Jan 00 12:05:59
+    additional win32 install notes
+
+nba 25 Jan 00 13:52:42
+    - parse.c: fix a missing initialization of tc_index
+
+hardaker 25 Jan 00 13:55:33
+    - (vestinternett/diskio.[ch]): Ragnar Kjrstad's diskio mib.
+
+hardaker 25 Jan 00 13:56:02
+    - (VEST-INTERNETT-MIB.txt): Ragnar Kjrstad's diskio mib.
+
+nba 25 Jan 00 14:12:58
+    - HOST-RESOURCES-MIB.txt, HOST-RESOURCES-TYPES.txt, Makefile.in:
+    	Update to the current draft HOST-RESOURCES (draft-ops-hostmib-01)
+
+hardaker 25 Jan 00 14:47:59
+    - (configure): help update
+
+hardaker 25 Jan 00 14:50:56
+    - (snmp_alarm.3, snmp_alarm.c): Patch from Frank Strauss:
+      - fix registration function to do what it says it should do.
+
+mslifcak 25 Jan 00 19:30:51
+    Larger buffer for print_module_name; Fix possible null deref in get_tc.
+
+mslifcak 25 Jan 00 21:46:14
+    mib.c:print_tree_node - show module name once in -- FROM;
+    parse.c: show "Cannot find module" once per missing module.
+
+mslifcak 26 Jan 00 07:14:50
+    fix compile error when --without-root-access is used (strauss@ibr.cs.tu-bs.de)
+
+mslifcak 26 Jan 00 07:26:22
+    Acknowledge more contributors.
+
+hardaker 26 Jan 00 10:24:21
+    - (getValues.pm) getValues.pm was noted missing
+
+hardaker 26 Jan 00 15:29:54
+    - (UCD-DISKIO-MIB.inc, UCD-DISKIO-MIB.txt, VEST-INTERNETT-MIB.txt):
+      Patch from Juergen Schoenwaelder:
+      - fix the diskio mib, convert to SMIv2, and move to ucdExperimental.
+
+hardaker 26 Jan 00 15:30:42
+    - (UCD-DLMOD-MIB.txt): Patch from Juergen Schoenwaelder:
+      - prefix oid with "ucd".
+
+hardaker 26 Jan 00 15:31:00
+    - (UCD-IPFILTER-MIB.txt): Patch from Juergen Schoenwaelder:
+      - prefix oids with "ucd".
+
+hardaker 26 Jan 00 15:32:25
+    - (UCD-SNMP-MIB.txt): Patch from Juergen Schoenwaelder:
+      - clean up and reformat sub-registration comments.
+
+hardaker 26 Jan 00 15:34:20
+    - (UCD-DEMO-MIB.txt, UCD-DISKIO-MIB.txt, UCD-DLMOD-MIB.txt,
+      UCD-IPFILTER-MIB.txt, UCD-IPFWACC-MIB.txt, UCD-SNMP-MIB.txt):
+      - correct ucd-snmp-coders email address to replace "ece" with "ucd-snmp".
+
+hardaker 26 Jan 00 16:06:31
+    - (agent_trap.c, agent_trap.h, snmpd.conf.5.def): Patch from Frank Strauss:
+      - add ability to allow sending traps to ports other than 162.
+
+hardaker 26 Jan 00 16:28:22
+    - (Makefile.in, Makefile.in, Makefile.in, Makefile.in):
+      - make depend.
+
+hardaker 26 Jan 00 16:53:41
+    - (snmpv3.c): fix priv key length extrapolation.  Should be done differently?.
+
+hardaker 26 Jan 00 16:54:43
+    - (Sv3DESconfig, T023snmpv3getMD5DES): fix DES test so it works.
+
+hardaker 26 Jan 00 17:15:07
+    - (snmpcmd.1, snmptrapd.conf.5.def, snmpusm.1):
+     - badly done updates.
+
+hardaker 26 Jan 00 17:18:17
+    - (version.h bug-report sedscript.in): version tag ( 4.1.pre2 )
+
+hardaker 26 Jan 00 17:32:41
+    - (configure, configure.in): allow ',' seperated --with-*-modules flag values.
+
+hardaker 26 Jan 00 19:22:53
+    - (configure, configure.in): comma, comma, comma, comma, comma-chameleon.
+
+hardaker 27 Jan 00 08:33:43
+    - (default_store.c): make config parser handle "" (null) parsed strings.
+
+marz 27 Jan 00 11:14:09
+    remove no-op snmp_synch_setup
+
+mslifcak 27 Jan 00 14:51:39
+     1. Fix memory leak when anonymously named nodes are used.
+     2. Hack around smicng's "SMI " statements to prevent other memory leaks.
+
+mslifcak 27 Jan 00 16:13:58
+    Remove hack around "SMI" token; keep the good part of the previous patch.
+
+mslifcak 28 Jan 00 07:18:09
+    Some variable renaming for consistency, error checking
+    improved, missing string.h included.  Patch supplied by author.
+
+mslifcak 28 Jan 00 12:30:20
+    Fix spell LITTLE_ENDIAN. Thanks to talman@hitt.nl.
+
+mslifcak 28 Jan 00 12:38:22
+    Change agentx_{build,parse}_short . Thanks to Gerard Talman@hitt.nl.
+
+mslifcak 28 Jan 00 12:52:25
+    This with previous two changes completes a patch for items 2,3,4
+    for bug #149.
+
+nba 30 Jan 00 03:01:52
+    - host.h: config_require_mib(HOST-RESOURCES-TYPES)
+
+nba 30 Jan 00 03:04:22
+    - hr_disk.c: convert to 1k blocks
+
+nba 30 Jan 00 03:09:38
+    - hr_storage.c: convert from pages to 1k blocks
+
+nba 30 Jan 00 03:11:28
+    - if.c: defensive test for missing objects (it might fail to show
+    	down status properly)
+
+marz 30 Jan 00 08:19:34
+    create V3 user entry, cleanup
+
+marz 30 Jan 00 10:42:36
+    clean up before release - update version, release notes
+    
+    Note: KNOWN BUGS
+    the new quoted OCTETSTR instance identifiers returned by get_symbol
+    are not compatible with the perl/SNMP module (__get_label_iid)
+
+marz 30 Jan 00 10:44:37
+    clean up before release - update version, release notes
+    
+    Note: KNOWN BUGS
+    the new quoted OCTETSTR instance identifiers returned by get_symbol
+    are not compatible with the perl/SNMP module (__get_label_iid)
+    
+    not sure that this ever worked - will have to look at old OCTETSTR
+    behaviour and see how to recreate it
+
+marz 30 Jan 00 10:58:02
+    clean up before release - update version, release notes etc.
+
+daves 31 Jan 00 01:05:16
+    - (agent/agent_registry.h): Log failed MIB registrations.
+
+daves 31 Jan 00 01:45:15
+    - (agent/agent_trap.c): Include instance subidentifier in snmpTrapOID and
+    	snmpTrapEnterprise OID definitions.  (Thanks to Gerard Talman)
+
+daves 31 Jan 00 02:40:02
+    - (snmplib/snmp_api.[ch]): Restore traditional socket field names.
+
+daves 31 Jan 00 03:00:16
+    - (snmplib/snmp_api.h): Alternative approach to Irix socket handling.
+
+daves 31 Jan 00 03:03:15
+    - (acconfig.h config.h.in configure.in configure):
+      - Attempt to detect non-traditional socket address structure (on Irix 6.x).
+
+daves 31 Jan 00 03:14:50
+    - (snmplib/snmp_api.c): Initialize addrlen in _sess_read().  (Frank Strauss)
+
+daves 31 Jan 00 03:41:08
+    - (AGENT.txt): Revised and updated version.
+
+daves 31 Jan 00 07:49:50
+    - (acconfig.h config.h.in configure.in configure):
+      - Improved checking for Irix-style socket address structure.
+
+daves 31 Jan 00 07:51:54
+    - (snmplib/snmp_api.h): Attempt to mimic Irix-style socket address structure.
+
+daves 31 Jan 00 07:53:52
+    - (snmplib/asn1.c snmplib/snmp.c snmplib/snmp_api.c snmplib/snmpusm.c):
+      - Don't assume size_t is signed (Pekka Kytolaakso)
+
+daves 31 Jan 00 07:55:06
+    - (snmplib/snmpv3.[ch]): Don't assume size_t is signed (Pekka Kytolaakso)
+      - N.B: This changes the interface of snmpv3_generate_engineID() slightly.
+
+daves 31 Jan 00 07:56:38
+    - (apps/snmptest.c): Don't assume size_t is signed (Pekka Kytolaakso)
+
+daves 31 Jan 00 07:57:56
+    - (mibgroup/examples/example.[ch]):
+      - Provide an example for how to trigger a trap.
+
+marz 31 Jan 00 10:41:16
+    set DS_LIB_DONT_BREAKDOWN_OIDS to get previoulsy released behaviour of get_symbol wrt octet based instance ids (i.e., no double-quoting)
+
+daves  1 Feb 00 01:49:55
+    - (acconfig.h config.h.in configure.in configure snmplib/snmp_api.h):
+      - Fix broken setting of socket address structure choice.
+
+daves  1 Feb 00 03:37:25
+    - (agentx/master_request.c): Fix session ID handling when delegating requests.
+
+daves  1 Feb 00 04:19:16
+    - (configure.in configure): Catch common invalid configure options.
+
+daves  1 Feb 00 05:27:03
+    - (FAQ): Expand the description of generating traps from the agent slightly.
+
+hardaker  1 Feb 00 08:32:03
+    - (diskio.*): moved to the ucd-snmp directory
+
+hardaker  1 Feb 00 08:34:09
+    - (diskio.h): load the mib.
+
+hardaker  1 Feb 00 08:34:24
+    - (diskio.c): move to ucdExperimental.15.
+
+hardaker  1 Feb 00 08:43:03
+    - (NEWS): update (again).
+
+hardaker  1 Feb 00 08:45:41
+    - (snmpcmd.1): .PP -> .IP for -Ob.
+
+hardaker  1 Feb 00 08:46:07
+    - (snmpusm.1): changed context string in examples to "".
+
+mslifcak  1 Feb 00 11:26:36
+    Fixup more signed/unsigned comparisons.
+
+daves  2 Feb 00 01:12:37
+    - (host/hr_disk.c): Fix solaris initialisation, plus extra debugging info.
+
+mslifcak  2 Feb 00 04:44:23
+    Remove dependencies on (moved) vestinternett/diskio
+
+nba  2 Feb 00 06:44:31
+    - solaris2.8.h: Solaris 8 seems close to Solaris 7
+
+nba  2 Feb 00 06:45:25
+    - hr_disk.c: add NetBSD support
+
+hardaker  2 Feb 00 07:17:28
+    - (configure, configure.in): updated --help
+
+daves  2 Feb 00 08:02:46
+    - (agent/snmp_vars.c): Correctly handle individually excluded instances
+
+mslifcak  2 Feb 00 08:42:17
+    Allow -Co to affect the outcome.
+
+mslifcak  2 Feb 00 08:52:43
+    fix the fat-fingering patch I just made. feh.
+
+hardaker  2 Feb 00 10:52:33
+    - (smux.c): Patch from Robert Miles:
+      - various fixes:
+        1) The first registration request could be lost.
+        2) Registration delete requests never received a response.
+        3) Registration delete requests were not finding the registration when the
+           delete's priority was set to -1.
+        4) Non-zero values were not being encoded properly in registration
+           responses.
+
+marz  2 Feb 00 14:18:09
+    add instructions for building w/ OpenSSL on VC++
+
+mslifcak  2 Feb 00 14:18:22
+    Let hrProcessorLoad out of the genie's bottle.
+
+mslifcak  2 Feb 00 16:24:15
+    Touchup for building more MIB modules in Win32 (MSVC).
+
+mslifcak  2 Feb 00 16:36:21
+    Touchup to build more MIB modules on Win32.
+
+daves  3 Feb 00 01:35:12
+    - (FAQ): Document changes to access control stuff.
+
+mslifcak  3 Feb 00 04:12:57
+    Undo uninformed change : load average != average time that CPU is idle.
+
+mslifcak  3 Feb 00 06:43:10
+    include mib_module_config.h to make the USING_ constants visible.
+
+marz  3 Feb 00 09:44:37
+    update my email
+
+mslifcak  3 Feb 00 09:56:48
+    Include mib_module_config.h from mibincl.h, not top level config.h.
+
+marz  3 Feb 00 10:48:37
+    add -u PIDFILE to snmptrapd, now we need -c -C :), btw is the value of optarg reliable after getopt has been called again...it seems to work
+
+mslifcak  3 Feb 00 12:57:20
+    Remove DOS-style line termination (CR-LF --> LF).
+    libsnmp.def - remove unneeded comment about obsolete v2party.
+
+mslifcak  3 Feb 00 12:58:27
+    Note the wombat is replaced by example in more places.
+
+mslifcak  3 Feb 00 13:28:31
+    Follow condition HAVE_GETPID for pid_file object.
+
+hardaker  3 Feb 00 14:29:19
+    - (dummy/*): removed, use example instead.
+
+hardaker  3 Feb 00 14:44:33
+    - (subagent.c): include mib_module_config.h.
+
+hardaker  3 Feb 00 14:46:10
+    - (subagent.c): protect sysORTable callbacks with #ifdefs.
+
+hardaker  3 Feb 00 14:51:40
+    - (README): remove dummy reference.
+
+nba  3 Feb 00 23:57:49
+    - agent/registry.c, agent_trap.c, client.c: change some type casts from
+    	(char *) to (u_char *) top silence some warnings.
+
+nba  3 Feb 00 23:59:57
+    - mt_support.h: another way of doing nothing, not giving a "null effect"
+    	warning from gcc.
+
+nba  4 Feb 00 00:16:01
+    - read_config.c, mib.c: fix some PATH separators from constant : to
+    	ENV_SEPARATOR{_CHAR}
+
+nba  4 Feb 00 00:17:48
+    - hr_disk.c: A little cleanup of the disk device definitions, also adding
+    	SCSI to FreeBSD 3
+
+nba  4 Feb 00 01:20:55
+    - vacm_vars.c: slight rewording of warning message
+
+nba  4 Feb 00 04:00:27
+    - hr_disk.c: really do that FreBSD scsi thing
+
+marz  4 Feb 00 06:44:24
+     have mib loading api return result codes
+
+marz  4 Feb 00 08:55:42
+    add defaults for v2 trap params
+
+hardaker  4 Feb 00 12:01:32
+    - (configure, configure.in, Makefile.in): find, locate, and use perl if found.
+
+hardaker  4 Feb 00 12:47:26
+    - (snmp_api.c, snmp_api.h, snmpv3.c): provide v3 defaults.
+
+hardaker  4 Feb 00 13:12:18
+    - (read_config.c): don't print failed access errors (EACCES).
+
+hardaker  4 Feb 00 13:15:51
+    - (Makefile.in, Makefile.in, Makefile.in, Makefile.in, Makefile.in,
+      Makefile.in): final make depend.
+
+hardaker  4 Feb 00 13:50:15
+    - (agent_read_config.c): don't read the opt config file or call
+      post_config callbacks, since the library takes care of that now.
+
+marz  4 Feb 00 13:52:08
+    updates for perl/SNMP build
+
+hardaker  4 Feb 00 13:56:19
+    - (snmptrapd.c):
+      - implement -c and -C flags for Joe.
+      - redid the init structure to make it look more like the current agent.
+
+hardaker  4 Feb 00 14:01:30
+    - (snmptrapd.8): document -c and -C.
+
+marz  4 Feb 00 15:21:41
+    build fixes and test enhancements
+
+marz  4 Feb 00 15:44:44
+    updates for perl/SNMP build
+
+-------------------------------------------------------------------------------
+
+Changes: V4.0 -> V4.0.1
+
+hardaker 23 Aug 99 16:44:27
+    - (Makefile.in): install the snmpusm.1 manual page.
+
+mslifcak 24 Aug 99 04:44:47
+    Clean CRs from read_config,snmp_logging; comment define USE_ASN_SHORT_LEN.
+
+mslifcak 24 Aug 99 05:11:13
+    Remove ASN_SHORT_LEN hack - known to dump core in agent.
+
+mslifcak 24 Aug 99 06:19:49
+    Add "." to PATH for RUNTESTS; Drop optreset to build most platforms
+
+mslifcak 24 Aug 99 10:25:53
+    -(testing/eval_tools) - let some (AIX) agents settle before firing requests.
+
+hardaker 24 Aug 99 12:48:21
+    - (vacm_vars.c): correct sysORTable entry.
+
+hardaker 24 Aug 99 13:36:35
+    - (snmpusm.c): check for null response pointer.
+
+hardaker 24 Aug 99 13:37:31
+    - (snmp_parse_args.c, default_store.h, snmp_api.c, snmpv3.c):
+      - provide defVersion token support in snmp.conf (sort of hackish).
+
+hardaker 24 Aug 99 13:41:18
+    - (TODO): remove snmpv3 support :-)
+
+mslifcak 24 Aug 99 14:05:39
+    -(top/Makefile.in) - remove more generated files with distclean rule.
+
+hardaker 24 Aug 99 14:15:40
+    - (all_system.h): remove.  again.
+
+mslifcak 24 Aug 99 14:17:33
+    -(host/hr_swrun;mibII/icmp,ip;ucd-snmp/disk,proc) log_perror --> snmp_log_perror
+
+mslifcak 24 Aug 99 15:14:18
+    -(smux.c) apply Nick Amato's patch: prevent SMUX close on parse or error.
+
+hardaker 24 Aug 99 15:59:42
+    - (snmp_api.c): remove version setting in snmp_api.c.  Not needed there.
+
+hardaker 24 Aug 99 16:01:55
+    - (NEWS): 4.0.1 update
+
+mslifcak 24 Aug 99 16:05:15
+    -(configure.*) move statement about ucdDemoPublic into comment field.
+
+mslifcak 24 Aug 99 16:49:22
+    -(testing/*) run tests when package is not installed, and when
+    the build tree is not the same as the source tree.
+
+-------------------------------------------------------------------------------
+
+Changes: V3.6.2 -> V4.0
+
+hardaker 14 Sep 98 09:11:57
+    - (acconfig.h, config.h.in, configure, configure.in):
+      - change the PERSISTENTFILE define to PERSISTENTDIR.
+
+hardaker 14 Sep 98 09:17:45
+    - (agent_read_config.c, snmpd.c, snmpd.h, system.c):
+      - move persistent cache capability into the library from the
+        agent. (snmptrapd, and others will need this as well).
+      - implement some new functions: init_snmpv3(), snmpv3_shutdown(),
+        snmpv3_get_engine_boots(), etc.
+      - agentBoots -> engineBoots.
+
+hardaker 14 Sep 98 09:21:05
+    - (Makefile.in, read_config.c, snmp_api.c, snmp_api.h, snmpv3.c, snmpv3.h):
+      - move persistent cache capability into the library from the
+        agent. (snmptrapd, and others will need this as well).
+      - implement some new functions: init_snmpv3(), snmpv3_shutdown(),
+        snmpv3_get_engine_boots(), etc.
+      - agentBoots -> engineBoots.
+
+hardaker 14 Sep 98 09:23:09
+    - (snmp_parse_args.c, snmp_parse_args.h, snmpbulkwalk.c, snmpdelta.c,
+      snmpget.c, snmpgetnext.c, snmpset.c, snmpstatus.c, snmptable.c,
+      snmptest.c, snmptrap.c, snmpwalk.c):
+      - pass app name to snmp_parse_args, so it can pass it to
+        init_snmp(), which now needs it for persistent cache reading.
+
+hardaker 14 Sep 98 09:25:13
+    - (snmpEngine.c, snmpEngine.h):
+      - Begin implementation of the SNMP-FRAMEWORK-MIB.
+
+hardaker 14 Sep 98 17:43:12
+    - (acconfig.h, config.h.in): define ENTERPRISE_NUMBER to 2021.
+
+hardaker 14 Sep 98 17:43:50
+    - (snmpv3.c, snmpv3.h): implement snmpEngineID creation and configuration.
+
+hardaker 14 Sep 98 17:44:06
+    - (snmpEngine.c): report snmpEngineID properly.
+
+hardaker 14 Sep 98 17:49:15
+    - (snmpv3mibs.h): high-level module created to import v3 releated mibs.
+
+hardaker 14 Sep 98 21:09:41
+    - (util_funcs.[ch], snmpEngine.c, snmpv3.[ch], system.[ch]):
+      - move snmpEngineTime calculation to snmplib/snmpv3.c.
+      - move calculate_time_diff() to system.c from util_funcs.c.
+
+hardaker 14 Sep 98 22:29:55
+    - (snmpMPDStats.c, snmpMPDStats.h):
+     - implement SNMP-MPD-MIB.
+
+hardaker 14 Sep 98 22:30:10
+    - (snmpv3mibs.h): add snmpMPDStats module.
+
+hardaker 14 Sep 98 22:40:24
+    - (snmpEngine.c, snmpMPDStats.c): register the modules in sysORTable.
+
+hardaker 16 Sep 98 07:04:11
+    - (snmpMPDStats.c): double blank -> single.
+
+hardaker 16 Sep 98 07:04:58
+    - (usmStats.c, usmStats.h): implement the usmStats portion of the
+      SNMP-USER-BASED-SM-MIB.
+
+hardaker 16 Sep 98 07:05:43
+    - (snmpv3mibs.h): add usmStats to require list.
+
+hardaker 18 Sep 98 09:54:08
+    - (snmp_api.c): change sprintf_oid buf length in DEBUGPOID to 4096.
+
+hardaker 18 Sep 98 09:55:07
+    - (snmpd.c): init_snmpv3 needs to go above init_agent for engineID creation.
+
+hardaker 18 Sep 98 09:59:20
+    - (snmpv3mibs.h, usmUser.c, usmUser.h, Makefile.in, snmpusm.c,
+      snmpusm.h, snmpv3.c, snmpv3.h):
+      - basic usmUser structure created for the libray with support
+        functions:
+        - struct usmUser *usm_get_user(*engineID,  engineIDLen,  *name, *userList);
+        - struct usmUser *usm_add_user(*user, *userList);
+        - struct usmUser *usm_free_user(*user);
+        - struct usmUser *usm_clone_user(*from);
+        - struct usmUser *usm_create_initial_user();
+      - first pass at basic USM module support added to the agent.
+
+hardaker 18 Sep 98 12:42:46
+    - (snmp-tc.h): create a new .h file to store common textual convention defines.
+
+hardaker 18 Sep 98 12:46:38
+    - (usmUser.c, snmpusm.c, snmpusm.h):
+      - create and use storageType/userStatus in the usmUser structure.
+      - fix the auth/priv protocol pointer initializations for the "initial" user.
+
+hardaker 20 Sep 98 11:46:13
+    - (snmp_vars.c): include snmpusm.h and snmpv3.h.
+
+hardaker 20 Sep 98 11:47:17
+    - (snmp_agent.c): if a mib module returns an error > SNMP_GEN_ERR,
+      translate the error to SNMP_GEN_ERR for v1 requests.
+
+hardaker 20 Sep 98 11:49:04
+    - (mib2c):
+      - fprintf -> DEBUGP.
+      - __P -> ANSI.
+
+hardaker 20 Sep 98 11:52:08
+    - (usmUser.c, usmUser.h):
+      - getNext bug fixes.
+      - make usmPublic truely writable.
+      - implement usm_parse_oid() to parse an oid into engineID/name.
+      - implement the usmUserSpinLock.
+      - misc other bug fixes.
+
+hardaker 21 Sep 98 11:12:49
+    - (snmp_vars.c): finally fixed the write_method's for creation problem.
+
+hardaker 23 Sep 98 10:40:04
+    - (SNMPv2-TC.txt): rejustify a table.
+
+hardaker 23 Sep 98 10:45:13
+    - (usmUser.c):
+      - Make usmUserStatus actually writable and capable of creating new rows.
+      - Begin (broken) cloneFrom setting.
+      - Fixes:
+        - properly malloc space.
+        - properly use double char name and engineID pointers.
+        - do proper oid comparisons for getNexts.
+        - check to see that uptr is defined before using it to retrieve data.
+        - cloneFrom should always return the ZeroDotZero OID.
+
+hardaker 23 Sep 98 10:46:35
+    - (snmpusm.c):
+      - fix usm_add_user() from always adding the user at the end of the list.
+      - set default values for auth/priv protocols on new users.
+
+hardaker 23 Sep 98 10:47:28
+    - (snmp_api.c, snmp_api.h): create snmp_duplicate_objid() to malloc a new oid.
+
+hardaker 23 Sep 98 12:15:11
+    - (ISSUES): update
+
+hardaker 23 Sep 98 12:24:04
+    - (ISSUES): took one.
+
+hardaker 23 Sep 98 17:58:49
+    - (ISSUES): cloning/malloc issue.
+
+hardaker 23 Sep 98 17:59:40
+    - (snmpusm.c, snmpusm.h): created usm_cloneFrom_user() to clone sec info.
+
+hardaker 23 Sep 98 18:00:21
+    - (usmUser.c): make usmCloneFrom actually work (is setable).
+
+hardaker 23 Sep 98 20:15:57
+    - (ISSUES): storage type issues.
+
+hardaker 23 Sep 98 20:16:24
+    - (usmUser.c): make usmUserAuthProtocol and usmUserPrivProtocol writable.
+
+hardaker 23 Sep 98 20:50:05
+    - (ISSUES): RowStatus question added.
+
+hardaker 23 Sep 98 20:50:45
+    - (snmpusm.c, snmpusm.h): create usm_remove_user() to remove a user
+      from a list.
+
+hardaker 23 Sep 98 20:51:46
+    - (usmUser.c): make usmUserStatus destroy's actually remove a user.
+
+hardaker 27 Sep 98 22:53:53
+    - (ISSUES): more stuff.
+
+hardaker 27 Sep 98 22:55:09
+    - (read_config.c, read_config.h, snmpusm.c, snmpusm.h):
+      - bug fixes.
+      - new support functions for saving users to the persistent cache.
+
+hardaker 27 Sep 98 22:57:00
+    - (usmUser.c, usmUser.h):
+      - bug fixes.
+      - usmUserStatus is setable (to either volatile or nonVolatile).
+      - users created by set's are saved (if set to nonVolatile) on agent shutdown.
+
+hardaker 29 Sep 98 20:11:20
+    - (ISSUES): error mapping (coex work).
+
+marz  1 Oct 98 12:58:42
+    - (snmp.h, snmpusm.[ch], snmp_api.[ch]): added USM api and snmpv3_build, some tweaks to parse in prep for snmpv3_parse
+
+marz  1 Oct 98 14:05:45
+    - (snmp_api.c): fixes to snmpv3_parse
+
+marz  4 Oct 98 17:20:30
+     - (snmp_api.[ch], snmp_client.c, snmpusm.c): added snmpv3 parsing routines
+
+hardaker  5 Oct 98 20:05:03
+    - (ISSUES): more stuff.
+
+hardaker  5 Oct 98 20:06:57
+    - (snmp_api.c, snmp_api.h): breakdown of snmpv3_build() into sub-functions.
+
+hardaker  5 Oct 98 21:59:26
+    - (snmpusm.c): make generateRequestMsg do something generic.
+
+hardaker  5 Oct 98 22:00:22
+    - (snmpv3.c, snmpv3.h): return a u_char * instead of a char * for engineIDs.
+
+hardaker  5 Oct 98 22:01:04
+    - (snmp_api.c): misc bug fixes.
+
+hardaker  5 Oct 98 22:50:10
+    - (snmp_api.c): last of known bugs in snmpv3_build fixed (a pointer
+      was being used twice in overlapping needed time periods).
+
+marz  7 Oct 98 13:02:40
+     -(snmp_parse_args.c): add v3 support
+
+marz  7 Oct 98 13:06:41
+     -(snmp_api.[ch], snmpusm.[ch], snmpv3.c): added pdu field to hold sec state ref, fixed usm prototypes, added check for null hent return
+
+hardaker  7 Oct 98 15:36:05
+    - (snmpusm.c): flush out a generic processIncomingMsg().
+
+hardaker  7 Oct 98 15:36:36
+    - (snmp_impl.h): add securityName to the agent's packet_info structure.
+
+hardaker  7 Oct 98 15:38:00
+    - (snmp_api.c): many many bug fixes to v3 parse/build routines.
+
+hardaker  7 Oct 98 15:39:17
+    - (vacm_vars.c): recognize the securityName when USM model is in use.
+
+hardaker  7 Oct 98 17:17:10
+    - (snmp_agent.c): initial pass at v3.  Will fail on sending error messages.
+
+hardaker  7 Oct 98 17:45:22
+    - (snmp_api.c): pass in the sec_parms length to processIncomingMsg
+
+hardaker  7 Oct 98 17:46:04
+    - (snmp_agent.c): bug fix: using an array as a pointer (used to be one).
+
+hardaker  7 Oct 98 22:40:43
+    - (snmp_api.c, snmpv3.c, snmpv3.h):
+      - default snmpv3 parameters can be specified in a snmp.conf file.
+
+hardaker  8 Oct 98 10:13:23
+    - (ISSUES): everyone loves issues!
+
+hardaker  9 Oct 98 08:03:57
+    - (config.h.in, configure, configure.in): use zlib when using rpm libraries.
+
+dreeder  9 Oct 98 13:59:12
+    - (ISSUES): Need a pass for traditional UN*X system programming holes.
+
+hardaker  9 Oct 98 18:23:27
+    - (snmpusm.c): generateRequestMsg() doesn't ASN encode the sec_params.
+
+hardaker  9 Oct 98 18:24:02
+    - (snmp_api.c): restructure the packet building to use less memcpy's.
+
+hardaker  9 Oct 98 18:24:26
+    - (snmp_agent.c): use snmp_build_packet() to construct all v3 data.
+
+dreeder 12 Oct 98 07:18:56
+    - (ISSUES): proof memory invocation/disposal; put time stamps in log files.
+
+hardaker 12 Oct 98 07:19:28
+    - (snmp_api.c, snmp_api.h):
+      - new stats counter API.
+      - bug fixes.
+
+hardaker 12 Oct 98 07:42:28
+    - (snmp_api.c, snmp_api.h): bug fixes with counters (returns u_int, EG).
+
+hardaker 12 Oct 98 07:44:55
+    - (snmp_agent.c):
+      - make v3 code return errors properly.
+      - bug fixes.
+
+hardaker 12 Oct 98 07:45:11
+    - (snmpMPDStats.c, snmpMPDStats.h, usmStats.c, usmStats.h):
+      - use the new stats counter API.
+
+marz 12 Oct 98 07:56:30
+     -(snmp_parse_args.c): merged hex to bin funcs - There can be only One
+
+marz 12 Oct 98 08:11:46
+     -(snmp_api.[ch], snmpusm.[ch]): merged hex to bin funcs, fixed MP/USM api, implemented noAuthNoPriv USM, implemented engine probe algorithm
+
+hardaker 12 Oct 98 09:23:49
+    - (ISSUES): note on David's issue.
+
+hardaker 12 Oct 98 12:26:06
+    - (acconfig.h, config.h.in, configure, configure.in):
+      - look for /dev/random and define HAVE_DEV_RANDOM.
+      - look for libkmt and libcrypto and define HAVE_LIBXXX.
+
+marz 12 Oct 98 15:46:36
+    - (snmpusm.c): fixed header size issues (difference between asn_build_header and asn_build_sequence)
+
+hardaker 12 Oct 98 21:56:42
+    - (system.c, system.h): make calculate_time_diff take a pointer.
+
+hardaker 12 Oct 98 21:59:53
+    - (snmpv3.c): use new calculate_time_diff().
+
+hardaker 12 Oct 98 22:04:06
+    - (snmp_client.c): bug fixes:
+      - snmp_synch_input() needs to clone a report pdu too.
+      - snmp_clone_pdu() needs to copy contextEngineID, contextName, and
+        securityName
+
+hardaker 12 Oct 98 22:12:50
+    - (snmp_api.c, snmp_api.h):
+      - make snmp_increment_statistic() return the changed value.
+      - create new function: snmp_free_varbind() to free a list.
+      - \n's to the end of the new debugging messages for engineID discovery.
+      - Merge response/report handling to make report's call their
+        callback as well (engineID discovery was never returning).
+
+hardaker 12 Oct 98 22:19:54
+    - (configure, configure.in): remove incorrect comment.
+
+hardaker 12 Oct 98 22:22:36
+    - (ISSUES): wierd memory question.
+
+hardaker 12 Oct 98 22:23:16
+    - (system.c): use new calculate_time_diff().
+
+hardaker 12 Oct 98 22:25:06
+    - (snmp_agent.c): handle engineID discovery requests.
+
+hardaker 12 Oct 98 22:58:26
+    - (usmUser.c): new function to return the userList.
+
+hardaker 12 Oct 98 22:58:55
+    - (snmpusm.c, snmpusm.h): new function usm_check_secLevel(int, struct *usmUser);
+
+hardaker 12 Oct 98 22:59:36
+    - (snmp_agent.c): handle unknownSecurityName and unsupportedSecurityLevel.
+
+hardaker 13 Oct 98 13:27:14
+    - (acconfig.h, config.h.in, configure, configure.in):
+      - new options: --disable-privacy, --enable-v2p-md5.
+
+hardaker 13 Oct 98 13:31:22
+    - (acconfig.h, config.h.in): comment formatting.
+
+hardaker 14 Oct 98 13:29:05
+    - (snmp_api.c): make snmp_add_var set the size of the oid buffer.
+
+hardaker 14 Oct 98 13:29:40
+    - (snmpusm.c, snmpusm.h): moved the default userList into the library.
+
+hardaker 14 Oct 98 13:31:29
+    - (usmUser.c): use the new library default user list.
+
+hardaker 14 Oct 98 13:32:58
+    - (snmp_agent.c):
+      - use the new library default user list.
+      - don't free a nonexistent pdu (it only exists for v3 requests).
+
+hardaker 14 Oct 98 13:47:56
+    - (snmp_agent.c): make sure pdu->securityName is null terminated.
+
+hardaker 14 Oct 98 17:52:23
+    - (aclocal.m4, configure, configure.in, Makefile.in):
+      - new arguments to configure to set CFLAGS and LIBS:
+        - --with-KMT=path
+        - --with-SSLeay=path
+      - fix to agent/mibgroup/Makefile to keep the above from getting the
+        wrong asn1.h from the SSLeay package.
+
+hardaker 14 Oct 98 20:41:07
+    - (aclocal.m4, config.h.in, configure, configure.in, */Makefile.in):
+      - check for kmt.h
+      - re-order CPPFLAGS to put -I flags last.
+
+hardaker 14 Oct 98 20:45:51
+    - (usmUser.c, usmUser.h, snmpusm.c, snmpusm.h):
+      - move usm_parse_config_usmUser to the library.
+
+hardaker 14 Oct 98 20:47:48
+    - (agent_read_config.c): include snmpusm.h
+
+dreeder 15 Oct 98 12:02:40
+    - Base for SCAPI + some formatting on the path to snmpv3 startup and shutdown.
+    - Shuffling in header files to defeat warnings of #define redundancies:
+    	notably, s/freebsd*.h and snmplib/system.h
+    - Debug & tini toolbag in snmplib/{debug,tools}.*
+    - Changed configure option --enable-v2p-md5 to --enable-internal-md5.
+    - Consolidated library system and local header include sequences into
+    	snmplib/all_*.h files.  Possibly better solutions for this...
+
+hardaker 15 Oct 98 22:24:52
+    - (usmUser.c): removed usm_parse_config_usmUser that David put back by
+      accident when doing formating.
+
+hardaker 15 Oct 98 22:25:17
+    - (keytools.c, keytools.h): added length to engineID.
+
+hardaker 15 Oct 98 22:25:58
+    - (read_config.c, read_config.h): make copy_word return a pointer.
+
+hardaker 15 Oct 98 22:26:21
+    - (scapi.c, scapi.h): move #includes from .h to .c.
+
+hardaker 15 Oct 98 22:27:03
+    - (snmpusm.c, snmpusm.h): new config options to change keys.
+
+hardaker 15 Oct 98 22:27:58
+    - (snmpv3.c): don't call init_kmt() unless HAVE_LIBKMT is defined.
+
+hardaker 15 Oct 98 22:42:00
+    - (keytools.c, keytools.h): move #include from .h to .c.
+
+hardaker 15 Oct 98 22:47:56
+    - (usmUser.c, usmUser.h):
+      - use do_keychange() to implement the key change write methods.
+      - a bit of -Wall cleanup.
+
+dreeder 16 Oct 98 11:28:12
+    - Updated SCAPI crypting functions to identify transforms OIDs not #define's.
+    - Moved "global" definitions of OID transforms to snmpusm.h, and out of
+    	usmUser.c and snmpusm.c.
+    - sc_generate_keyed_hash() stands as a good example of what other functions
+    	will look like.
+
+dreeder 16 Oct 98 11:50:09
+    - (scapi.c, scapi.h) Output buffer arguments for (en|de)crypting are
+    	single-pointers.
+
+lewis 16 Oct 98 13:15:16
+    - - (snmpusm.h):
+      - Added USM_ERR symbols used by usm_generate_out_msg
+
+lewis 16 Oct 98 13:20:07
+    - - (snmpusm.c)
+      - Rewrote usm_generate_out_msg, renaming old implementation to
+        usm_generate_out_msg_NULL
+      - This code compiled on FreeBSD, not tested for linking or running
+      - Added functions to calculate indicies (asn_predict_int_length,
+        asn_predict_length, usm_calc_offsets) and to make the CBC-DES
+        initialization vector (usm_set_salt).
+
+dreeder 18 Oct 98 21:14:09
+    - SCAPI code complete, but not completely tested.
+    	Added testing/ directory.
+    	Verified that Ed's recent changes compile cleanly.
+    	Tried to patch up "critical" -Wall warnings.
+
+hardaker 19 Oct 98 07:10:27
+    - (Makefile.top): remove -Wall requirement.
+
+dreeder 19 Oct 98 15:12:57
+    - Core SCAPI routines appear sound.  testing/ directory is no longer
+    	commented out.  SNMPv3 style key manipulations untested yet.
+    	Created (?) a slew of new warnings from files early in compile sequence.
+
+dreeder 20 Oct 98 11:38:42
+    - Tests for generate_Ku and generate_kul.  (testing/ktest -h for help.)
+    	Cleaned up new set of "critical" warnings -- mostly adding #include's.
+    	Fixed KMT/apps/randtest.c so it compiles under Linux.
+
+marz 21 Oct 98 08:18:03
+     -(snmp_api.[ch]): add fields for authKey and privKey
+
+lewis 21 Oct 98 12:07:16
+    - - (snmp.h)
+      - Added SNMP_ERR_ error symbolic constants for the auth/priv (USM) module
+        reported errors.
+      - Used values 19-27, updated MAX_SNMP_ERR to 27.
+
+lewis 21 Oct 98 12:08:24
+    - - (snmpusm.h)
+      - Added symbolic constants for errors found processing incoming messages.
+      - Equated the symbols with those added to snmp.h
+
+hardaker 21 Oct 98 12:10:03
+    - (snmp_api.h): added ASN/SNMP counters to the counter list.
+
+marz 21 Oct 98 12:50:24
+     -(snmp_api.[ch]): correctly add #define sizes for authKey and privKey
+
+marz 21 Oct 98 13:38:57
+     -(snmp_api.[ch]): added auth/priv protocol type fields to session
+
+marz 21 Oct 98 13:49:11
+     -(snmp_api.c): added cast for internal pdu (internal pdu should be elimianted someday)
+
+hardaker 21 Oct 98 13:53:38
+    - (snmp_api.h): STAT_MAX_STATS -> MAX_STATS.
+
+hardaker 21 Oct 98 17:54:08
+    - (snmpv3.c): remove snmp_perror() defined as perror().  It's a real function.
+
+hardaker 21 Oct 98 17:58:08
+    - (asn1.c): asn_build_string: allow a null string to build a 00 padded string.
+
+hardaker 21 Oct 98 18:00:07
+    - (snmp_api.c):
+      - engineID discovery debugging messages.
+      - zero length contextNames ok.
+      - set max length before usm_generate_out_msg().
+
+hardaker 21 Oct 98 19:04:35
+    - (snmp_api.c): move the engineID discovery to snmp_sess_open().
+
+hardaker 21 Oct 98 19:05:12
+    - (snmp_api.h): synch snmp_pdu and internal_snmp_pdu.
+
+dreeder 21 Oct 98 19:55:15
+    - Shook the bugs out of key manipulation routines (generate_kul, generate_Ku).
+    	Completed and tested KeyChange TC code ({encode,decode}_keychange).
+    	Created initial elements of an automated test harness in testing/.
+    	Created data files and test scripts to demonstrate compliance.
+    	Miscellaneous additions to snmplib/tools.?, some temporary/transitional.
+
+marz 21 Oct 98 19:58:11
+     -(snmp_parse_args.c): add auth/priv proto flags, add auth priv key flags
+
+marz 21 Oct 98 20:19:08
+    - (snmp_api.[ch]): updated auth/priv prot and key fileds in session, added suport in snmp_sess_open and close (yanked fields from PDU - did I do that?)
+
+hardaker 21 Oct 98 21:21:41
+    - (lcd_time.c): minor warning fixes.
+
+hardaker 21 Oct 98 21:22:07
+    - (tools.c, tools.h): new tool: memdup().
+
+hardaker 21 Oct 98 22:08:07
+    - (snmp_api.c):
+      - generate a usm user from session data if needed.
+      - check the result from the usm and fail if it does.
+
+marz 22 Oct 98 08:02:11
+     -(snmp_api.c): added DEBUGP code to trace message version and secLevel for demo
+
+lewis 22 Oct 98 13:37:34
+    - - (snmpusm.c)
+      - Not a working/tested version, but it compiles.
+      - Fixed one bug - "&" to "==" in an if()
+      - Did not alter code to deny null engine id users
+      - Added much code in process incoming message
+      - New use of errors and DEBUGP
+      - Still waiting on updates to lcd_time.h to implement
+        step #3 of RFC 2274, s3.2.
+
+dreeder 23 Oct 98 09:45:47
+    - LCD Time API prototypes are complete.  90% stable.
+    	Draft of automated testing harness in testing/.
+    		Use testing/eval_suite.sh to run all current tests.
+
+lewis 23 Oct 98 11:38:25
+    - - (lcd_time.h)
+      - added definitions for TRUE and FALSE (if not previously defined)
+      - fixed a compilation bug in the ensure entry macro
+
+lewis 23 Oct 98 11:47:37
+    - - (snmpusm.c)
+      - Added the step 3 code to process outgoing messages function
+      - Still un-run
+
+dreeder 23 Oct 98 15:39:02
+    - Complete code for LCD time API.  Awaiting serious tests.
+    	Changed snmpv3_get_engine{Time,Boots} to snmpv3_local_snmpEngine*
+
+dreeder 24 Oct 98 23:07:54
+    - Shook bugs out of LCD to manage engine IDs/time ("testing/etest -a").
+    	Added a function dump_snmpEngineID ("testing/misctest -1").
+    		Made sprint_hexstring not-static... (temporary change I think).
+    	Added comments/questions about building snmpEngineID.  (snmpv3.c)
+    	Added TRUE/FALSE defines to snmpusm.c.  (These should be standardized.)
+    	Added SNMP_MAXBUF_SMALL.  (tools.h)
+    	Cleaned up (clarified?) test harness description.
+
+marz 25 Oct 98 14:48:06
+     -(snmp_parse_args.c): move key generation (generate_Ku) after init_snmp
+
+hardaker 25 Oct 98 20:59:33
+    - (snmp_agent.c): debugging parse/build statements and errno fixes.
+
+hardaker 25 Oct 98 21:00:15
+    - (system.h): created DEBUGPL to do DEBUGP with file/line statements.
+
+hardaker 25 Oct 98 21:01:00
+    - (tools.c): check memdup() for NULL passed in.
+
+hardaker 25 Oct 98 21:01:58
+    - (read_config.c): bug fixes: misc NULL checks.
+
+hardaker 25 Oct 98 21:02:40
+    - (snmp_client.c): default to setting secNameLen and contextNameLen to -1.
+
+dreeder 25 Oct 98 22:28:18
+    - Mostly shuffling pre-existing things about --
+            Used USE_INTERNAL_MD5 put kmt_hash parallel with v2p MD5 hash.
+            sc_encrypt/sc_decrypt now also return: SNMPERR_SC_NOT_CONFIGURED.
+            Tested and "fixed" build with on&off settings of:
+                    USE_V2PARTY_PROTOCOL, SCAPI_AUTHPRIV, USE_INTERNAL_MD5.
+            Greatest damage done in agent/snmp_agent.c, snmplib/snmp_client.c.
+            Repaired use of key manipulation functions in snmpusm.c.
+                    (Could use peer review as my expectations of use may differ.)
+            Added (and removed 1) some XXX's in party code...
+
+hardaker 26 Oct 98 13:34:03
+    - (snmpusm.c): enable NULL engineIDs in user storage.
+
+hardaker 26 Oct 98 13:37:03
+    - (snmp_api.c, snmp_api.h):
+      - creating users from a session:  create_user_from_session().
+      - make probing use the above twice (once for NULL engineID and once
+        for probed engineID).
+      - bug fix:  snmp version printed in debugging was off by -1.
+
+hardaker 26 Oct 98 20:41:19
+    - (snmp_agent.c): set context name on engineID report.
+
+hardaker 26 Oct 98 20:42:06
+    - (snmpd.c): create the "initial" user for engineID:null.
+
+hardaker 26 Oct 98 22:12:17
+    - (keytools.c): check for NULL pointer, not *pointer.
+
+hardaker 26 Oct 98 22:15:01
+    - (snmpusm.c): malloc kul space in usm_set_password().
+
+dreeder 28 Oct 98 09:39:57
+    - get_enginetime() now returns <0,0> tuple for NULL/""/len=0 engineIDs.
+    	sc_{check,generate}_keyed_hash() process hashes <= hash output len.
+    		(Stable, but expect an expanded test in scapitest.c soon.)
+    	Misc: Put MD5_HASHSIZE_BYTES in party.h; SNMP_ZERO in tools.h
+
+lewis 28 Oct 98 13:16:54
+    - - (snmpusm.c)
+      - Debugged running of usm_generate... function so that it runs with no
+        authentication / no privacy options.  (Don't have a way yet to test
+        with the fancy security.)
+      - Added a line for debugging which sets all bytes of the security header
+        and the PDU's resting place to FF - for debugging purposes only.  This
+        lets me see what bytes remain to be punched in.  This line is flush left
+        in the file, indicating that it is to be cut out if we reach release.
+      - Added "emergency_print," an uncalled routine I like to have when running
+        in gdb.  It dumps a field of x bytes in hex, 25 values to a line.
+
+dreeder 28 Oct 98 14:19:52
+    - Bounded KMT code with #define's for HAVE_LIBKMT
+    	- Will not compile without either HAVE_LIBKMT -or- USE_INTERNAL_MD5.
+    	- Added new error code: SNMPERR_KT_NOT_AVAILABLE.
+    	- Added a test for previous changes to sc_*_keyed_hash() functions.
+    		(Augmented test_dokeyedhash() in keymanagement.c.)
+
+lewis 29 Oct 98 09:56:08
+    - - (snmpusm.c)
+      - Made fixes to process incoming
+      - Began to add code for the security state reference
+
+lewis 29 Oct 98 10:27:37
+    - - (snmpusm.h)
+      - Added prototype for set_reportErrorOnUnknownID
+
+lewis 29 Oct 98 10:29:16
+    - - (snmpusm.c)
+      - Fixed some of Wes' reported problems.
+      - Added code to store secStateRef
+      - Still need to use it in generate_outgoing
+
+lewis 29 Oct 98 14:30:18
+    - - (snmpusm.c)
+      - Now makes use of the stored secStateRef in generate outgoing
+      - I hope - I still haven't been able to get message back and forth,
+        it's time to figure out how to run the snmpd stuff I guess.
+
+marz 29 Oct 98 15:06:49
+    add #idef gaurds for kmt.h and kmt_algs.h dependent on existence of headers rather than libkmt
+
+lewis 30 Oct 98 06:45:24
+    - - (snmpusm.h)
+      - Added a state reference free routine
+      - Changed name of the routine to set the report-on-error flag so that it
+        begins with "usm_".
+
+lewis 30 Oct 98 06:46:52
+    - - (snmpusm.c)
+      - Modified the free state ref routine to take a void * instead of a
+        struct whatever *, this plus adding it to the .h file makes is useable
+        by the Message Processor.
+
+lewis 30 Oct 98 07:34:26
+    - - (snmpusm.c)
+      - Removed a potential memory hole (returning on error from the process
+        incoming routine without freeing the security state reference).
+
+hardaker 30 Oct 98 08:38:53
+    - (snmpv3.c): snmp_perror() -> perror() ["malloc"].
+
+hardaker 30 Oct 98 08:43:52
+    - (snmpd.c):
+      - Make -D a toggle.
+      - use usm_set_reportErrorOnUnknownID().
+
+hardaker 30 Oct 98 08:45:09
+    - (snmp_parse_args.c):
+      - Make -D a toggle.
+
+hardaker 30 Oct 98 16:44:43
+    - (snmp_agent.c): make the agent watch the error status from packet
+      parsing instead of doing checks itself.
+
+hardaker 30 Oct 98 16:52:03
+    - (snmpusm.c): usm_get_user(): allow a null length (but non null
+      pointer) engineID.
+
+marz  1 Nov 98 15:55:11
+     -(asn1.c, lcd_time.c, snmp_api.c, snmp_api.h, snmp_client.c, snmpusm.c, snmpv3.c): remove internal pdu/varlist, pdu_free update, handle initial user as discussed, remove initial user hack, remove engineID probe/Report hack, handle securityStateRef as discussed, handle zero-length context, normalize _enginetime arg order, include wes's patches for null engineid and secNameLen++
+
+hardaker  1 Nov 98 19:32:43
+    - (snmp_parse_args.c, snmp_parse_args.h, snmpbulkwalk.c, snmpdelta.c,
+      snmpget.c, snmpgetnext.c, snmpset.c, snmpstatus.c, snmptable.c,
+      snmptest.c, snmptrap.c, snmpwalk.c):
+      - use "snmpapp" as configuration file name.
+
+hardaker  1 Nov 98 19:36:59
+    - (snmp_api.c): generate user->Kul from session->Ku.
+
+hardaker  1 Nov 98 19:38:29
+    - (snmp_agent.c): generate all sorts of new SNMP reports when needed.
+
+hardaker  1 Nov 98 19:39:29
+    - (snmpd.c): use snmp_perror() if snmp_agent_parse() returns 0.
+
+hardaker  2 Nov 98 09:00:25
+    - (vacm.c): allow a security level >=, not ==.
+
+hardaker  2 Nov 98 09:01:07
+    - (snmpv3.c): remove usm_create_initial() and set_enginetime().
+
+hardaker  2 Nov 98 09:06:04
+    - (snmpusm.c, snmpusm.h):
+      - new function: init_usm_post_config(void);
+      - make usm_get_user_from_list() handle a bogus initial user flag.
+
+hardaker  2 Nov 98 09:09:35
+    - (snmp_api.c):
+      - use init_usm_post_config();
+      - use usm_get_user_from_list to ask not to return the default initial user.
+      - fix snmp_var_add_variable() to allow counters.
+
+hardaker  2 Nov 98 09:10:15
+    - (snmp_parse_args.c): typo on des key initialization, forgot the 'X'.
+
+hardaker  2 Nov 98 09:13:36
+    - (snmp_agent.c):
+      - fix report OIDs to be correct.
+      - debugging statement when sending a report.
+      - added unsupported security level report.
+      - send a counter instead of an integer.
+
+hardaker  2 Nov 98 16:01:24
+    - (snmp_parse_args.c): generate Ku for priv protocol using auth protocol hash.
+
+hardaker  3 Nov 98 09:37:03
+    - (lcd_time.c): first byte==0 engine ID's are valid.
+
+lewis  4 Nov 98 11:35:29
+    - - (snmpusm.c)
+      - Better handling of null and unknown engine IDs.
+
+dreeder  4 Nov 98 11:45:08
+    - (lcd_time.c) Special cases for NULL or 0 length engineIDs.
+
+hardaker  4 Nov 98 21:53:32
+    - (snmp_agent.c): check engineID to make sure its us.
+
+lewis  5 Nov 98 09:52:35
+    - - (snmpusm.c)
+      - Fixed call to predict integer length routine to give it the *whole*
+        number, not just one (first/last depends on endian) of the number.
+        Doh! scale rating 9.
+      - Altered that routine to be more like the asn_build_int ... i.e., no
+        longer assumes the length of the length is 1.  Doh! rating a 1.
+
+lewis  5 Nov 98 11:03:24
+    - - (snmpusm.c)
+      - Fixed some DEBUGP calls to show the right function, perhaps these will
+        become DEBUGPL in the future.
+
+dreeder  5 Nov 98 15:37:29
+    - Mostly function header comments in read_config.c, util_funcs.c, snmpv3.c.
+      	(Please feel free to check for accuracy...)
+      Check for NULL in register_config_handler().
+      Added length argument to snmpv3_get_engineID().
+      Check for length(P)<USM_LENGTH_P_MIN in generate_Ku().
+      Note: "etest -a" has a new failure; to be fixed when Time LCD re-stabilizes.
+
+marz  6 Nov 98 16:13:37
+     -(snmp_api.[ch], snmp_client.c): handle Reports to trigger resend, except for unknownEngineID, pass secStateRef to receive securityState from USM *WARNING* getting authorization failure in USM* please help - this was not happening before so doubtless it is my fault?
+
+marz  7 Nov 98 12:33:49
+     -(snmp_api.c, lcd_time.[ch], snmpusm.c): clean up problems caused when we began using secStateRef, other USM errors, implement LCD_TIME_SYNC_OPT optimization
+
+marz  7 Nov 98 12:37:21
+     -(snmp_agent.c, snmpd.c): clean up problems caused when we began using secStateRef, set_enginetime in LCD post config read, LCD_TIME_SYNC_OPT time lerning optimization, include file for lcd_time added, moved make_report to snmplib - report generation is still in agent
+
+hardaker  9 Nov 98 13:29:19
+    - (snmp_api.c): generate_kul should use authprotocol.
+
+marz 11 Nov 98 07:51:43
+     -(lcd_time.c, snmpusm.c): fixes to handle null engine ID - tolerated when sending, unknown when receiving
+
+marz 11 Nov 98 08:03:24
+     -(snmp_agent.c): remove workaround to detect unknownEngineID error - now doen in USM as spec'd
+
+hardaker 11 Nov 98 12:37:47
+    - (snmpd.c, snmp_api.c, snmpv3.c, snmpv3.h):
+      - move initial set_enginetime() from agent to snmpv3.c.
+      - new snmp.conf configure file tokens: defAuthType, defPrivType,
+        defPassphrase, defAuthPassphrase, defPrivPassphrase.
+      - minimum boots used is 1, not 0.
+
+hardaker 11 Nov 98 13:09:26
+    - (snmpd.c): added needed init_() routines.
+
+hardaker 11 Nov 98 13:11:02
+    - (snmpv3.c): don't print oids to %s's.
+
+hardaker 13 Nov 98 07:59:04
+    - (snmpd.c): create the correct initial user after engineID configuration.
+
+hardaker 13 Nov 98 08:03:45
+    - (usmUser.c): don't initialize user here.
+
+hardaker 13 Nov 98 08:04:42
+    - (snmpv3.c): make engineID configuration lines get parsed early.
+
+hardaker 13 Nov 98 08:14:04
+    - (snmpusm.c):
+      - more appropriate engineID checking for users (was a bug).
+      - usm_add_user(): don't duplicate users with the same name/engineID.
+
+hardaker 15 Nov 98 10:19:55
+    - (snmpd.c): move post_config init routines to beyond persistent reading.
+
+hardaker 15 Nov 98 12:55:38
+    - (Makefile.in):
+      - new make target: test
+      - make all doesn't compile the testing directory.
+
+hardaker 15 Nov 98 13:00:41
+    - (usmUser.c, snmpusm.c, snmpusm.h):
+      - usm_remove_user():
+        - properly updates the list pointer.
+          - requires a ** pointer to the list to do this.
+        - check against a NULL list pointer.
+      - usm_cloneFrom_user():
+        - the keys were not being properly duplicated.
+      - usm_clone_user(): deleted.
+      - usm_create_user(): created, and used in place of usm_clone_user(NULL).
+
+hardaker 15 Nov 98 13:01:27
+    - (etimetest.c): fix calls to set/get_enginetime().
+
+hardaker 15 Nov 98 14:14:07
+    - (ISSUES): finished a couple of things.
+
+hardaker 15 Nov 98 14:19:21
+    - (ISSUES, snmp_agent.c): fix pdu freeing problem, thanks to Joe's
+      merge of the pdu structures.
+
+hardaker 15 Nov 98 15:50:33
+    - (ISSUES): misc date changes and mark that I'm working on something.
+
+hardaker 15 Nov 98 15:53:24
+    - (snmpd.c, read_config.c, snmp_api.c):
+      - create/call snmp_shutdown().
+      - remove the "persistent." part of the persistent .conf name.
+      - rename instead of unlink old persistent .conf file.
+
+hardaker 15 Nov 98 17:37:00
+    - (ISSUES, snmpv3.c): when engineID changes from the previous run,
+      reset engineBoots to 1.  (requires storing the last engineID used).
+
+hardaker 16 Nov 98 20:10:19
+    - (snmp_agent.c, snmpd.c, snmp_mib.c, snmp_mib.h, snmp_api.c,
+      snmp_api.h):
+      - use new library based statistics counter everywhere.
+
+hardaker 16 Nov 98 20:17:01
+    - (util_funcs.c, util_funcs.h, interfaces.c, system.c, registry.c):
+      - use header_generic in a few more places.
+      - standardize the MATCH_FAILED and MATCH_SUCCEEDED definitions.
+
+hardaker 22 Nov 98 07:24:56
+    - (snmpusm.c): usm_create_initial_user() accepts name & auth/priv types.
+
+hardaker 22 Nov 98 07:25:52
+    - (snmpd.c):
+      - log PID to file using -P.
+      - create template users:  templateMD5 & templateSHA.
+
+hardaker 22 Nov 98 07:26:30
+    - (keymanagetest.c): new flag: -q = quiet.
+
+hardaker 22 Nov 98 07:27:12
+    - (demo): script to run list of commands required for the demo.
+
+hardaker 22 Nov 98 07:28:58
+    - (.cvsignore): ignore testing targets.
+
+hardaker 22 Nov 98 14:36:53
+    - (demo): quote the pass phrase.
+
+hardaker 22 Nov 98 22:16:44
+    - (demo):
+      - pass/fail type output.
+      - hosts other than localhost.
+      - capability to look for stuff in output of commands.
+
+hardaker 22 Nov 98 22:26:28
+    - (demo): turn encryption on for tests that need it.
+
+hardaker 23 Nov 98 07:14:05
+    - (keymanagetest.c): print MD5/SHA before the keychange string.
+
+hardaker 23 Nov 98 07:16:01
+    - (demo): fix the key change string extraction to look for the MD5 version.
+
+hardaker 23 Nov 98 07:38:44
+    - (keymanagetest.c): bequiet should be 0 by default.
+
+hardaker 23 Nov 98 08:06:34
+    - (demo): bug fixes.
+
+dreeder 24 Nov 98 16:43:50
+    Fixed bug in USM preventing exchange of crypted packets.  Code added
+    	to properly estimate size of crypted text given un-padded plaintext.
+    	Found/fixed KMT prototype conflict that caused the given IV to be
+    	ignored at crypt/decrypt time.
+    setup_engineID() has a new argument to allow ID strings to be returned
+    	to caller.
+    New file snmplib/transform_oids.h to put static declarations in a single
+    	place...
+    Failure of stat increments in USM no longer cause failure in the calling
+    	function.
+    Added utility apps/encode_keychange.  (-h for usage.)
+    DIFFTIME macro to replace oft repeated code.
+    Shortened some VACM debugging output to a single line from many.
+    More comments.  More trouble spots marked XXX.
+    Converted oft used magic numbers to symbolic constants (some pre-existing).
+    Cleaned up some simply fixed build warnings.
+    Updated nonexport/crypto/README.  Still needs work.
+
+marz 25 Nov 98 07:44:28
+     -(snmp_parse_args.c): added -T <boots> <time> to set an initial (authenticated) time value for the destination engineIDs boots/time)
+
+marz 25 Nov 98 07:48:49
+     -(snmp_api.[ch], snmp.h, snmp_client.c): handle incoming Reports - propagate STAT_ERROR to apps with approp. error message, handle recoverable error notInTimeWindow and engineId discovery, send reports with secLevel==noAuthNoPriv except notInTimeWindow
+
+marz 25 Nov 98 07:51:50
+     -(tools.c): oops back out little compile workaround I did not mean to commit
+
+marz 25 Nov 98 07:54:01
+     -(snmpd.c, snmp_agent.c): initialize pid_dile, only allocate engineID mem for Reports when sending Report, fix version info in debug message
+
+hardaker 25 Nov 98 07:56:30
+    - (snmpEngine.c, snmpMPDStats.c, usmUser.c, usmUser.h):
+      - Added a couple of DEUBGP statements and a couple of comment clairifications.
+
+hardaker 25 Nov 98 12:39:01
+    - (snmpusm.c): changes in comments for clarification.
+
+hardaker 25 Nov 98 12:40:35
+    - (snmpv3.c): changes in comments for clarification.
+
+hardaker 25 Nov 98 12:54:08
+    - (snmp_agent.c): version checks against v2c/v2p -> !v1.
+
+hardaker 25 Nov 98 13:04:02
+    - (snmpd.c): comment clarification.
+
+hardaker 25 Nov 98 17:12:02
+    - (demo):
+      - encode_keychange usage.
+      - move closer to 42, but leave room for a few more things.
+
+hardaker 25 Nov 98 22:58:43
+    - (config.h.in, configure, configure.in): check for tcgetattr.
+
+hardaker 25 Nov 98 22:59:56
+    - (snmpv3.c, snmpv3.h): create snmpv3_set_engineBootsAndTime().
+
+hardaker 25 Nov 98 23:00:47
+    - (tools.c): dump_engineID should *never ever* modify the passed length param.
+
+hardaker 25 Nov 98 23:02:49
+    - (demo):
+      - -s: 1 sec sleep instead of keypress.
+      - do time tests.
+      - use encode_keychange.
+
+hardaker 25 Nov 98 23:04:10
+    - (snmpEngine.c, snmpEngine.h):
+      - Shhhhh.....  boots and time are writable...  Don't tell anyone... Shhh...
+
+hardaker 25 Nov 98 23:15:05
+    - (encode_keychange.c):
+      - use u_char's where appropriate.
+      - some debugging statements added.
+
+hardaker 25 Nov 98 23:32:51
+    - (usmUser.c):
+      - keychange needs a temp buffer.
+      - a few debugging statements.
+
+hardaker 27 Nov 98 10:20:45
+    - (snmpusm.c): usm_set_salt() accepts a key which is too long (SHA for DES).
+
+hardaker 27 Nov 98 10:23:03
+    - (snmp_api.c): snmpv3_send_report() removes the secStateReference
+      from the pdu is there is one.  It shouldn't be used for reports.
+
+hardaker 27 Nov 98 10:31:12
+    - (demo): final fixes for all current tests to work.
+
+hardaker 27 Nov 98 15:15:25
+    - (demo):
+      - -T: pause after test completions.
+      - **** 42/42 tests passed
+
+hardaker 27 Nov 98 16:55:15
+    - (snmppass.c): beginnings of a snmp password changer:
+      - stole most code from snmpset.c and encode_keychange.c.
+      - need to fix: must specify most everything on the command line (ie,
+        .conf file tokens don't work here).
+      - very unclean and a quick hack.
+      - differs from encode_keychange, in that it actually preforms the set.
+
+hardaker 27 Nov 98 16:55:23
+    - (Makefile.in): add snmppass.c
+
+hardaker 27 Nov 98 16:56:47
+    - (.cvsignore): snmppass and encode_keychange
+
+hardaker 28 Nov 98 11:41:02
+    - (usmUser.c, usmUser.h):
+      - merge write_ keyChange and ownKeyChange functions into one.  Since
+        the user name is not passed in, the calling module will have to
+        check for it until we're willing to change the API or the VACM is
+        fixed and the ownKeyChnage objects can be obsoleted.
+
+hardaker 28 Nov 98 11:41:36
+    - (snmppass.c): -o: use the ownKeyChange object.
+
+marz 29 Nov 98 19:32:21
+     (demo): fix time sync test to test for timeout as expected when app clock is set ahead
+
+marz 29 Nov 98 19:34:41
+     -(snmp_api.c): move commandline based boots/time setting code after engineID discovery in case engineID was not supplied on command line as well
+
+hardaker 30 Nov 98 22:00:23
+    - (demo): better document the required .conf file pieces.
+
+hardaker 30 Nov 98 22:12:10
+    - (demo): enable -C: auto-configure the agent.
+
+wbabson  1 Dec 98 07:56:55
+    Fixed a library search order bug which had /usr/local/ssl/lib and /usr/local/lib
+    searched before ../snmplib. This caused unresolved references when trying to
+    link snmpd and the applications. To do this LOCAL_LIBS was created and ../snmplib
+    was removed from LIBS and placed there. Then LOCAL_LIBS was added before
+    LDFLAGS in the link commands. agent/Makefile.in and apps/Makefile.in were modified.
+
+hardaker  1 Dec 98 14:54:28
+    - (snmp_api.c): include kmt.h and related.
+
+hardaker  1 Dec 98 14:55:28
+    - (tools.c): include kmt.h and related.
+
+hardaker  1 Dec 98 14:55:49
+    - (usmUser.c): include kmt.h and related.
+
+hardaker  1 Dec 98 14:55:55
+    - (snmppass.c): include kmt.h and related.
+
+marz  2 Dec 98 08:32:29
+     -(demo.c): test #38 will show the 6 message exchange since it is initialized with a simulated authentic oots/time which defeats the LCD_TINE_SYNC_OPT
+
+hardaker  2 Dec 98 14:26:08
+    - (snmp_agent.c): after detection of snmp version, error codes were reversed.
+
+hardaker  2 Dec 98 15:18:53
+    - (snmpd.conf.5.def): added v3 specific token notes.
+
+hardaker  2 Dec 98 15:19:47
+    - (Makefile.in, snmp.conf.5.def): created a snmp.conf manual page.
+
+hardaker  2 Dec 98 17:03:27
+    - (.cvsignore): snmp.conf.5 ignored.
+
+hardaker  2 Dec 98 17:03:48
+    - (snmp.conf.5.def): mibdirs, mibs, and mibfiles documented.
+
+hardaker  2 Dec 98 19:38:12
+    - (lcd_time.c): comment clairification.
+
+hardaker  2 Dec 98 19:39:22
+    - (mib.c): unneeded XXX removed.
+
+hardaker  2 Dec 98 19:39:47
+    - (read_config.c): make copy_word() skip ahead of space on returned pointer.
+
+dreeder  3 Dec 98 18:44:49
+    Co-checkin with new version of KMT (located in nonexport/KMT-snmp).
+    kmt_random() signature changed in sc_random().
+    Second verson testing/demo at testing/demo2* .
+
+hardaker  3 Dec 98 22:20:06
+    - (acconfig.h, config.h.in, configure, configure.in):
+      - new flag and define --enable-testing-code -> SNMP_TESTING_CODE.
+
+hardaker  3 Dec 98 22:22:59
+    - (keytools.c): use SNMP_TESTING_CODE def to protect some sections.
+
+hardaker  3 Dec 98 22:23:48
+    - (scapi.c): testing DEBUGP for printing out keys.
+
+hardaker  3 Dec 98 22:26:40
+    - (snmpusm.c, snmpusm.h):
+      - protect sections with SNMP_TESTING_CODE.
+      - allow *'s in fields for engineIDs for key setting .conf entries.
+
+hardaker  3 Dec 98 22:32:20
+    - (snmpEngine.c, snmpEngine.h):
+      - only make time/boots setable when SNMP_TESTING_CODE is defined.
+
+hardaker  3 Dec 98 23:17:17
+    - (demo): removed.
+
+marz  4 Dec 98 08:05:59
+     -(snmpcmd.1): update man page for new V3 parse args
+
+hardaker  4 Dec 98 11:03:14
+    - (Makefile.in, snmppass.c, snmpusm.c):
+      - delete snmppass.
+      - create first pass snmpusm.c.
+
+hardaker  4 Dec 98 11:04:09
+    - (snmpd.conf.5.def): document the * for engineID feature.
+
+hardaker  4 Dec 98 16:45:43
+    - (UCD-DEMO-MIB.txt): demo mib objects.
+
+hardaker  4 Dec 98 16:46:09
+    - (UCD-SNMP-MIB.txt): mention/reserve the demo object group in a comment.
+
+hardaker  4 Dec 98 16:49:21
+    - (.cvsignore): .gdb stuff
+
+hardaker  4 Dec 98 16:50:04
+    - (ucdDemoPublic.c, ucdDemoPublic.h):
+      - examples/ucdDemoPublic module:  simple objects for doing demos,
+        including remote resetting of keys to a known passwords for a list
+        of users.
+
+hardaker  4 Dec 98 16:50:28
+    - (ucdDemoPublic.cmds): commands to run to set up for the demo.
+
+hardaker  4 Dec 98 16:50:38
+    - (ucdDemoPublic.conf): configuration file lines needed for the demo.
+
+hardaker  4 Dec 98 18:38:05
+    - (version.h, sedscript.in, bug-report): 4.0.pre1 tag
+
+dreeder  5 Dec 98 16:52:49
+    Extended demo2 into demo.remote to allow testing between <here> and
+    ucd-snmp.ucdavis.edu.
+
+marz 13 Dec 98 14:57:02
+     -(snmp_api.[ch], snmp_client.c): add support for msgID which is different from reqid and which increments with each retry. Note: late Responses will be dropped if they arrive after timeout - this is different from v1 behaviour where a late Response to the initial try will be accepted up to the time where the last retry times out
+
+hardaker 13 Dec 98 18:39:02
+    - (mib2c): minor update (needs more) for newer snmp perl mod.
+
+hardaker 13 Dec 98 18:39:44
+    - (.cvsignore): .gdb.auto.init
+
+hardaker 13 Dec 98 18:41:11
+    - (encode_keychange.c): removed unneeded linux ifdef.
+
+hardaker 17 Dec 98 15:59:10
+    - (read_config.c): wrap config line print's in SNMP_TESTING_CODE checks.
+
+hardaker  2 Dec 98 21:55:04
+    - (just about all files): merge of V3-b1 changes into V3-b2 branch.
+
+hardaker  2 Dec 98 22:27:54
+    - (agent_read_config.c, snmpd.c, usmUser.c, snmp_parse_args.c,
+      read_config.h, snmp_api.c, snmpusm.c, snmpv3.c, tools.h):
+      - final changes? to V3-b2 merge.
+
+hardaker  2 Dec 98 22:29:52
+    - (read_config.c): make that 28 errors from whitespace changes.
+
+hardaker  2 Dec 98 22:37:08
+    - (snmpd.c): call init_snmpv3 before -H usage info.
+
+hardaker 13 Dec 98 10:33:45
+    - (*): merge1 to V3-b3.
+
+hardaker 13 Dec 98 18:56:18
+    - (*): merge2 to V3-b3.
+
+dreeder 17 Dec 98 08:05:04
+    Creature comfort: /etc script to (re)start and stop snmpd and snmptrapd
+    and keep (compressed) copies of previous logfiles.  Intended to be universal
+    to Linux, Solaris, FreeBSD, ... .
+
+hardaker 21 Dec 98 17:36:37
+    - (configure, configure.in): define USE_INTERNAL_MD5 if KMT isn't available.
+
+hardaker 21 Dec 98 17:49:38
+    - (all_system.h, keytools.c, lcd_time.c, md5.c, md5.h, scapi.c,
+      scapi.h, snmp_api.c, snmp_auth.c, tools.c):
+      - internal MD5 support done.
+        - tested with and without kmt to opposite and same side apps/agents.
+        - tested against older 4.0.pre1 agent on bandit as well.
+        - all but one testing/* test passes (which was failing before anyway).
+        - the older demo script passes as well.
+      - Modified many other routines.  Everything should use SCAPI now and
+        KMT should never be called directly outside the scapi.c and
+        keytools.c files.
+        - new scapi routine:  sc_hash().
+      - Could, as always, use a bit more clean up, but I needed to check
+        something in that worked before I break it again (ahem).
+
+hardaker 21 Dec 98 17:53:10
+    - (snmpget.c, snmpusm.c): unneeded KMT includes removed.
+
+hardaker 21 Dec 98 17:54:38
+    - (keymanagetest.c): surround a few KMT specific items with #ifdefs.
+
+hardaker 21 Dec 98 17:56:56
+    - (snmp_agent.c): remove unneeded KMT includes.
+
+hardaker 22 Dec 98 19:40:12
+    - (keytools.c): decode_keychange() wasn't setting the returned buffer length.
+
+hardaker 22 Dec 98 19:43:50
+    - (snmp_api.c): DEBUGP of probed engineID printed 00's as 0's.
+
+hardaker 22 Dec 98 21:09:38
+    - (snmp_agent.c, usmStats.c, usmStats.h, usmUser.h,
+      SNMP-USER-BASED-SM-MIB.txt):
+      - updated USM mib, including the move from snmpModules.12 to .15.
+      - make reports generated include the .0 suffix for the instance specifier.
+
+hardaker 22 Dec 98 21:10:28
+    - (tools.c): wrap dump_engineID in #ifdef SNMP_TESTING_CODE.
+
+hardaker 22 Dec 98 21:17:25
+    - (lcd_time.c): wrap dump_etimelist() in #ifdef SNMP_TESTING_CODE.
+
+hardaker 22 Dec 98 21:20:31
+    - (encode_keychange.c):
+      - don't use dump_snmpEngineID() unless testing.
+      - Note: this utility is not really needed anymore.
+
+hardaker 22 Dec 98 22:12:32
+    - (SNMP-USER-BASED-SM-MIB.txt): typo (cut and paste missed a line).
+
+hardaker 23 Dec 98 21:07:33
+    - (snmpusm.c): msgSecurityParams should contain the *salt*, not the IV,
+      as defined by the USM document, section 8.1.1.1 (and common sense).
+
+hardaker 23 Dec 98 21:47:44
+    - (snmp_api.c):
+      - Send only authNoPriv reports for notInTimeWindow reports.
+      - report length check increased by one to accomodate for the .0 suffix.
+
+hardaker 23 Dec 98 22:06:25
+    - (snmpusm.c): allow generate_out_msg() to use unknown security names
+      for secLevel = noAuthNoPriv.
+      - this is required since unknownUser reports need to go out with the
+        same user name as the bad request that came in.
+
+hardaker 29 Dec 98 17:01:24
+    - (vacm.c): Enable multiple side by side views in the view family
+      tree.  The views already existed, but weren't checked and only the
+      first view was found.
+      - Not done in a clean fashion.  Much of the structure definitions
+        should be rewritten with sub-pieces to do it properly with greater
+        speed.
+
+hardaker 29 Dec 98 17:28:31
+    - (config*): define u_int{8,16,32}_t for KMT headers.
+
+hardaker 31 Dec 98 17:55:39
+    - (snmpusm.c): USM oid's were wrong
+
+hardaker 31 Dec 98 17:58:19
+    - (version.h bug-report sedscript.in): version tag ( 4.0.pre2 )
+
+hardaker  6 Jan 99 07:46:02
+    - (snmpusm.c): usm_set_salt() was using a host specific byte ordering
+      for generating the salt from the enigineBoots value and from the
+      arbitrary integer.  This technically shouldn't matter, but since
+      we're shooting to be a reference platform...
+
+hardaker 19 Jan 99 19:20:07
+    - (ISSUES): need random int for IV.
+
+wbabson 26 Jan 99 05:52:19
+     Changed MIN() macro to SNMP_MIN() because we explicitly
+     define that in tools.h... This was needed to allow successful
+     linkage in Solaris 2.6
+
+hardaker 27 Jan 99 20:37:56
+    - (SNMP-TARGET-MIB.txt): target mib was improperly located at .15 not .12.
+
+hardaker 27 Jan 99 20:51:12
+    - (snmp_parse_args.c): accept security level abbreviations.
+
+hardaker 27 Jan 99 21:07:59
+    - (acconfig.h, config.h.in, configure, configure.in, read_config.c):
+      - create --with-persistent-directory configure script flag.
+
+dreeder 29 Jan 99 15:20:51
+    Repaired tests to reflect changes in the codebase.
+
+marz 31 Jan 99 13:57:13
+     -(snmp_api.c): zero lenght user name for enineID discovery
+
+dreeder  2 Feb 99 14:04:48
+    Resolve OID collisions: 1) between demo MIB and UCD enterprise MIB; 2)
+    inside demo MIB.
+
+hardaker  2 Feb 99 22:04:38
+    - (snmptrapd.c): support -H.
+
+hardaker  2 Feb 99 22:13:41
+    - (read_config.c):
+      - allow env variable SNMP_PERSISTENT_FILE to override persistent
+        storage locaction.
+      - merge in Mike's changes to copy_word().
+
+hardaker  2 Feb 99 22:14:46
+    - (target.h): merge mike's target mibgroup into the 4.0 line.
+
+marz  6 Feb 99 15:04:13
+     -(snmp_api.[ch],snmp_parse_args.c,snmpv3.[ch],snmpusm.c,snmpcmd.1): allow contextEngineID and securityEngineID to be different, added -E/-e to parse_args, fixed engineID discovery which broke after name used in probe switched to zero length string
+
+hardaker  7 Feb 99 20:43:15
+    - (read_config.c): -Wall fix.
+
+hardaker  7 Feb 99 20:45:17
+    - (snmpv3.c, snmpv3.h): a few -Wall fixes:
+      - protoype init_snmpv3_post_config(void).
+      - remove unneeded variables.
+      - don't compile in set_engineBootsAndTime interface function if not needed.
+
+hardaker  7 Feb 99 20:47:59
+    - (snmp2p.c, snmp_agent.c, snmp_agent.h, snmp_vars.c, snmp_vars.h,
+      snmpd.c, snmpd.h, vacm_vars.c, vacm_vars.h, snmp_api.c, snmp_api.h,
+      snmp_auth.c, snmp_impl.h): Patch from Dave Shield:
+      - implement agent using libraries parsing and handling routines
+        instead of duplicating it.
+
+hardaker  8 Feb 99 00:11:59
+    - (snmp_agent.c, util_funcs.c, ucdDemoPublic.c, route_write.c,
+      snmp_mib.c, system.c, snmpEngine.c, usmUser.c, extensible.c, pass.c,
+      pass_persist.c, proc.c, versioninfo.c):
+      - modified to work with new write variable api.
+      - fixed a missing feature in Dave's code: creation.
+
+hardaker  8 Feb 99 12:22:13
+    - (COPYING): It's 1999.
+
+wbabson  8 Feb 99 13:34:39
+    Changed the function prototype for snmpv3_set_engineBootsand Time
+    from int f(); to void f(); to match the function definition i
+    snmpv3.c .
+
+wbabson  8 Feb 99 13:40:27
+    fixed casting error... *(long) changed to *(long *)
+
+dreeder 17 Feb 99 16:23:43
+    Random IV; fixed salt construction.
+    Fixed NULL dereference show-stopper introduced by merge of D. Sheld's changes.
+    configure.in+Makefile.in automatically create PERSISTENT_DIRECTORY.
+    Minor compile warnings, out-of-date comments fixed, clarified debug outout,
+    	clarified pre-compile code in scapi.c.
+    Discovered where pdu->securityEngineID was being multiply free'd, but not
+    	the *first* time... (open problem)
+
+hardaker 17 Feb 99 20:59:29
+    - (snmpd.c): -Wall fixes.
+
+hardaker 17 Feb 99 21:00:07
+    - (snmp_agent.c):
+      - fix getbulks.
+      - fix snmpset's to allow creation.
+
+hardaker 17 Feb 99 21:00:22
+    - (dlmod_mib.c): don't define MATCH_SUCCEEDED at all.
+
+hardaker 17 Feb 99 21:00:36
+    - (util_funcs.c): -Wall variable removing.
+
+hardaker 17 Feb 99 21:00:58
+    - (route_write.c, snmp_mib.c, system.c):
+      - -Wall variable removing.
+
+hardaker 17 Feb 99 21:01:36
+    - (usmUser.c, extensible.c, pass.c, proc.c, versioninfo.c):
+      - -Wall variable removing.
+
+hardaker 17 Feb 99 21:05:28
+    - (keytools.c, md5.c, read_config.c, scapi.h, snmp_api.c, snmp_auth.c,
+      snmp_client.c, snmpusm.c, transform_oids.h):
+      - -Wall fixes.
+
+hardaker 17 Feb 99 21:28:57
+    - (keytools.c): opps.  Deleted a variable I shouldn't have.
+
+hardaker 17 Feb 99 21:30:11
+    - (snmp_agent.c): You can't assign a NULL to a union, only to a sub-type.
+
+hardaker 17 Feb 99 21:45:23
+    - (testing/Makefile.in): remove references to subdirs since there are
+      none and it breaks simplier versions of sh when no arguments to
+      foreach exist.
+
+marz 24 Feb 99 09:31:29
+     -(snmplib/snmp_api.[ch],snmplib/snmp.h,agent/snmpd.h,agent/snmp_agent.h): moved Reports into snmplib, conform to spec on criterria for sending Reports, lay ground work for maxMsgSize, default contextEngineID to securityEngineID when not explicitly set itself
+
+marz 25 Feb 99 14:04:05
+     -(snmp_api.c,snmp_client.c): fixed bug in snmp_clone_pdu (not cloning securityEnigineID), uncommented _snmp_free
+
+wbabson  9 Mar 99 08:54:12
+    First cut at snmptrapd modification. Receives authPriv and lower security
+    level traps.
+
+wbabson  9 Mar 99 09:02:07
+    Changed DEBUGP() statement to get securityName from PDU rather than session
+    as session was not yet initialized during engine ID discovery and the NULL
+    value caused a segmentaion fault.
+
+marz 10 Mar 99 08:04:47
+     -(snmp_api.c): fix engineId discovery when context engineID is specified (needed to discover proxy engineID if all you know is proxied agent's engineID)
+
+wbabson 17 Mar 99 13:27:59
+    Changed DEBUGP() statement about Building the SNMP message so that
+    even if securityName is uninitialized (NULL), program will continue
+    without core dumping. Later, someone should see about fixing the logic
+    so that securityName will not be a NULL pointer here, or
+    repair the debugging scheme, if that's valid.
+
+hardaker 24 Mar 99 20:30:12
+    - (mibincl.h): add agent_read_config.h
+
+hardaker 24 Mar 99 20:32:44
+    - (testing/Makefile.in): remove subdirs.
+
+hardaker 28 Mar 99 16:03:04
+    - (vacm_vars.h): relocate VACM node where it should be (13->16).
+
+hardaker 28 Mar 99 16:16:38
+    - (read_config.c): skip space after copying a word in copy_word()
+
+hardaker 30 Mar 99 09:51:21
+    - (ucdDemoPublic.c): added help strings to conf parsers.
+
+hardaker  6 Apr 99 15:27:29
+    - (Makefile.in): remove accidentially comitted conflict.
+
+hardaker 15 Apr 99 07:25:48
+    - (keytools.c): Allow short passphrases when SNMP_TESTING_CODE is set.
+
+marz 19 Apr 99 14:14:23
+     -(snmp_api.[ch],snmp_client.c): fixed bug where msgId and reqId were not treated correctly in responses if orginal request happened to have msgId or reqId equal to arbitrary default(0)
+
+marz 19 May 99 07:14:44
+    
+    adding v3 packet generator perl5 script (requires Convert::BER)
+    .
+
+marz 19 May 99 07:16:41
+    
+    example data file to generate a V3 packet with pktgen.pl
+
+marz 19 May 99 08:02:24
+    README for pktgen.pl
+
+marz 19 May 99 08:44:03
+    *** empty log message ***
+
+marz 19 May 99 08:45:15
+    pktgen.pl
+
+marz 19 May 99 10:31:14
+    remove last submit
+
+marz 20 May 99 12:35:03
+    *** empty log message ***
+
+marz 23 May 99 08:04:03
+    handle seq_of to allow arbitrary number of varbinds, bug fixes, send/receive, pretty print debugging packet dump
+
+hardaker 26 May 99 11:18:42
+    - (ipfwacc.h): properly locate the mib.
+
+hardaker 26 May 99 11:20:04
+    - (vmstat.c): include limits.h.
+
+hardaker 26 May 99 15:14:32
+    - (hr_swinst.c): make software application type unknown instead of app.
+
+hardaker 26 May 99 15:18:46
+    - (IPFWACC-MIB.txt): change to counters.
+
+hardaker 26 May 99 15:20:11
+    - (ipfwacc.h): make into counters.
+
+hardaker 26 May 99 15:33:05
+    - (agent_read_config.c, hr_filesys.c, interfaces.c, tcp.c, udp.c):
+      Patch from Derek J. Balling:
+      - freebsd2 fixes.
+
+hardaker 26 May 99 15:52:57
+    - (acconfig.h, config.h.in): increase MAXREADCOUNT
+
+hardaker 26 May 99 15:54:22
+    - (snmp_vars.c): include sys/queue.h.
+
+marz  1 Jun 99 07:25:55
+    (pktgen.pl, packet.txt): added authentication support (md5 and sha1)
+
+daves  1 Jun 99 08:37:47
+    - (agent/mibgroup/host/hr_swinst.c): Determine type of RPM packages
+
+marz 16 Jun 99 09:30:55
+    (pktgen.pl, packet.txt): added encryption/privact support (des-cbc)
+
+marz 16 Jun 99 12:50:29
+    (pktgen.pl, packet.txt): latest attempt to fix privacy/encryption
+
+marz 23 Jun 99 08:18:59
+    (pktgen.pl, packet.txt): latest attempt to fix privacy/encryption(working with Crypt::DES/Crypt::CBC+patch)
+
+hardaker  6 Apr 99 15:13:40
+    - (*): Merged the 4.0 line into the 3.6.1 line.
+
+hardaker  6 Apr 99 15:38:45
+    - (mibincl.h, ucdDemoPublic.c, vacm_vars.h, snmptrapd.c, snmp_api.c,
+      Makefile.in): final merge pieces of recent v3 line changes.
+
+mslifcak  6 Apr 99 21:24:22
+    - changes for ANSI headers; POSIX(index vs strchr); minor fixes
+
+mslifcak  6 Apr 99 22:13:59
+    - (vacm_vars.c) - set global ptrs = 0.
+
+mslifcak  6 Apr 99 22:14:43
+    - (snmp_vars.c) more v2party rework needed
+
+mslifcak  7 Apr 99 06:17:28
+    - () more ANSI header fixups; touchup for M$ Win32 build
+
+hardaker  7 Apr 99 10:42:10
+    - (config.h.in, snmp_vars.c, encode_keychange.c, snmptrapd.c,
+      Makefile.in, all_general_local.h, keytools.c, keytools.h,
+      lcd_time.c, md5.c, read_config.c, scapi.c, snmp_api.c, snmpusm.c,
+      snmpv3.c, tools.c, tools.h):
+      - misc merging, including fixes and debugging statement changes to
+        newer model.
+      - a few -Wall fixes.
+
+hardaker  7 Apr 99 10:48:07
+    - (snmp_mib.c): removed unnneeded header_snmp().
+
+hardaker  7 Apr 99 11:28:02
+    - (ucdDemoPublic.c, sysORTable.c, vacm_vars.c, smux.c, snmpEngine.c,
+      usmUser.c, snmpTargetAddrEntry.c, snmpTargetParamsEntry.c):
+      - debugging statement conversion
+
+mslifcak  7 Apr 99 12:00:20
+    - (agent/snmp2p.c agent/snmp_agent.c agent/snmp_vars.h
+    agent/view_parse.c agent/mibgroup/util_funcs.c
+    agent/mibgroup/examples/ucdDemoPublic.c
+    agent/mibgroup/host/hr_filesys.c
+    agent/mibgroup/host/hr_storage.c
+    agent/mibgroup/host/hr_swrun.c agent/mibgroup/host/hr_system.c
+    agent/mibgroup/mibII/at.c agent/mibgroup/mibII/icmp.c
+    agent/mibgroup/mibII/interfaces.c agent/mibgroup/mibII/ip.c
+    agent/mibgroup/mibII/system_mib.c agent/mibgroup/mibII/tcp.c
+    agent/mibgroup/mibII/udp.c agent/mibgroup/mibII/vacm_vars.c
+    agent/mibgroup/mibII/var_route.c agent/mibgroup/misc/ipfwacc.c
+    agent/mibgroup/snmpv3/usmUser.c
+    agent/mibgroup/ucd-snmp/extensible.c
+    agent/mibgroup/ucd-snmp/hpux.c agent/mibgroup/ucd-snmp/pass.c
+    agent/mibgroup/ucd-snmp/pass_persist.c
+    agent/mibgroup/ucd-snmp/proc.c
+    agent/mibgroup/v2party/context_vars.c
+    agent/mibgroup/v2party/party_vars.c
+    agent/mibgroup/v2party/view_vars.c apps/snmpdelta.c
+    apps/snmptest.c apps/snmptrapd.c apps/snmpnetstat/route.c
+    apps/snmpnetstat/winstub.c snmplib/acl_parse.c
+    snmplib/context.h snmplib/context_parse.c snmplib/party.h
+    snmplib/party_parse.c snmplib/read_config.c snmplib/snmp_api.c
+    snmplib/snmp_auth.c snmplib/snmp_impl.h snmplib/vacm.h
+    snmplib/view.h)  fgets use sizeof mostly, oid base size is MAX_OID_LEN
+
+mslifcak  7 Apr 99 12:17:23
+    -(ipfwchains.c) remove multiple definitions of MATCH_FAILED
+
+mslifcak  7 Apr 99 15:00:39
+    -(usmUser.c,system.c) plug mem leak; (snmp_api.c) enforce array limit.
+
+hardaker 12 Apr 99 22:14:31
+    - (mibincl.h): include sys/time.h.
+
+hardaker 12 Apr 99 22:15:39
+    - (hr_utils.h): remove variable names from prototypes (was causing problems).
+
+hardaker 12 Apr 99 22:16:45
+    - (tkmib): make displayed mib node info into two columns instead of one.
+
+hardaker 12 Apr 99 22:25:09
+    - (snmp_api.c): make snmp_varlist_add_variable to possible create a
+      varlist before adding something to it.
+
+hardaker 13 Apr 99 15:19:20
+    - (configure, configure.in, Makefile.in): Patch from Daniel Hagerty:
+      - fix libwrap to only add the library to the agent.
+
+hardaker 13 Apr 99 15:20:00
+    - (system_mib.c): make sysDescr read-only.
+
+hardaker 13 Apr 99 15:32:23
+    - (pass.c): Patch from Jim Mar:
+      - add capability for binary octet strings in pass scripts.
+
+hardaker 13 Apr 99 15:36:31
+    - (SNMP-NOTIFICATION-MIB.txt, SNMP-PROXY-MIB.txt,
+      SNMP-VIEW-BASED-ACM-MIB.txt): Patch from Niels Baggesen:
+      - fix module locations for broken mibs.
+
+hardaker 13 Apr 99 15:54:48
+    - (freebsd.h, freebsd2.h): Patch from Niels Baggesen:
+      - freebsd utmp cleanups.
+
+hardaker 13 Apr 99 15:56:53
+    - (snmpd.c): Patch from Niels Baggesen:
+      - log with timestamp at shutdown.
+
+hardaker 13 Apr 99 15:57:24
+    - (vacm_vars.c): Patch from Niels Baggesen:
+      - better checking of .conf file parsing line requirements.
+
+hardaker 13 Apr 99 15:58:02
+    - (snmptranslate.c): Patch from Niels Baggesen:
+      - support -P.
+
+hardaker 13 Apr 99 15:58:27
+    - (snmp_config.5.def, snmptrap.1, snmptrapd.conf.5.def): Patch from
+      Niels Baggesen:
+      - clean up small bugs.
+
+hardaker 13 Apr 99 16:00:49
+    - (parse.c, parse.h): Patch from Niels Baggesen:
+      - nicer parser messages (include file names). Correct help for -Pc.
+      - Add FRAME-RELAY-DTE-MIB as replacement for RFC-1315
+
+hardaker 13 Apr 99 16:03:29
+    - (snmptrapd.c): Patch from Niels Baggesen:
+      - snmptrapd option to ignore auth traps, add -S option, log termination.
+
+mslifcak 14 Apr 99 15:29:58
+    - (snmptranslate.c) init_snmp takes argument; "" used.
+
+mslifcak 14 Apr 99 15:30:34
+    - (parse.c) File pointer initialized to "" before first use.
+
+hardaker 14 Apr 99 15:52:35
+    - (snmptranslate.c): init_snmp("snmpapp").
+
+mslifcak 14 Apr 99 16:31:55
+    - (snmp_agent,c, snmp_api.[ch], snmp_client.[ch]) fix variable_list with built-in storage
+
+mslifcak 14 Apr 99 16:56:37
+    - apps that use snmp_fix_pdu must clean up the response PDU !
+
+mslifcak 16 Apr 99 07:30:29
+    - (IPFWACC-MIB.txt) change module name from IPFWADM-MIB to IPFWACC-MIB.
+
+mslifcak 16 Apr 99 07:54:22
+    - (IPFWCHAINS-MIB.txt) ipfwChainTable {ipfw 1} fix
+
+mslifcak 16 Apr 99 08:33:16
+    - (mib.c) "-m" or MIBS : can specify MIB module by file name.
+
+hardaker 16 Apr 99 21:10:06
+    - (README): Added v3 team members.
+
+hardaker 16 Apr 99 21:11:48
+    - (configure.in): changed default store location to /var/ucd-snmp
+
+hardaker 16 Apr 99 21:15:14
+    - (snmp.h): SNMPADMINLENGTH definition.
+
+hardaker 16 Apr 99 21:16:16
+    - (snmp_auth.c): removed fix note.
+
+hardaker 16 Apr 99 21:27:06
+    - (NEWS): updated
+
+hardaker 16 Apr 99 21:27:41
+    - (snmptrapd.8): man patch from Niels
+
+hardaker 16 Apr 99 21:34:49
+    - (version.h bug-report sedscript.in): version tag ( 4.0.pre3 )
+
+mslifcak 18 Apr 99 06:54:26
+    - (ipfwacc.h) subdir change per Joe Pruettt : 9 -> 10
+
+hardaker 19 Apr 99 21:01:15
+    - (mib2c, mib2c.conf, mib2c.vartypes.conf):
+      - rewrote mib2c to be more dependent on .conf files.  The main .conf
+        file now contains the code itself.
+      - need to write a foreach(mibnode) type parser next.
+
+hardaker 19 Apr 99 21:09:27
+    - (mibincl.h): add read_config.h.
+
+hardaker 19 Apr 99 21:12:17
+    - (read_config.c, read_config.h):
+      - created a more convenient read_config_read_data() function to
+        generically read a token into a given variable.
+      - cleaned up persistent storage parsing routines.
+      - use previously malloced space in some routines, or malloc it for
+        them if the storage area is NULL.
+
+hardaker 19 Apr 99 21:14:28
+    - (snmp_api.c): Don't snmp_set_var_objid if name is NULL in
+      snmp_varlist_add_variable().
+
+hardaker 20 Apr 99 11:28:14
+    - (mib2c, mib2c.conf, mib2c.vartypes.conf): more updates.
+
+hardaker 20 Apr 99 15:31:35
+    - (mib2c, mib2c.conf, mib2c.vartypes.conf):
+      - completely re-hacked:
+        - entire code base is now put into the .conf files rather than in
+          the mib2c program.  This should entitle mib2c to be used more
+          generically, and could produce different types of code templates
+          based on the .conf file it is given.  In theory, it should be
+          able to produce C code for a non-ucd-snmp agent, or even better,
+          any type of code (not just C) for something else based on mib
+          information.
+        - The down side, is that the current .conf files are now ambiguous
+          again and difficult to understand without being, well, me.  The
+          up side is that I'm sure Dave Shield will go through and clean
+          it up for me like he did last time.  Ha ha.  I wonder if he'll
+          read this? (If so, see me first).
+
+hardaker 20 Apr 99 16:04:17
+    - (mib2c, mib2c.conf): variable name conversions:
+      - variableTypes -> variables
+      - cname -> NAME
+
+hardaker 20 Apr 99 16:10:44
+    - (mib2c, mib2c.conf): a little more clean up.
+
+hardaker 20 Apr 99 21:38:42
+    - (mib2c.conf): clean up skipif regexps a bit.
+
+hardaker 22 Apr 99 07:54:44
+    - (read_config.c, read_config.h): created *read_config_store_data();
+
+hardaker 22 Apr 99 07:56:03
+    - (mib2c, mib2c.conf): allow NoAccess to be processed, and use skipif:
+      directives where needed because of it.
+
+hardaker 22 Apr 99 10:51:30
+    - (snmp_client.c, snmp_api.c, snmp_api.h, keytools.c): Another v3 branch update.
+
+mslifcak 26 Apr 99 09:21:06
+    - (snmplib.c) - use request callback's data if request specifies a callback.
+
+nba 26 Apr 99 11:21:10
+    
+    (parse.h) Silly speling misteak (ACCESS_CRAETE)
+
+nba 26 Apr 99 11:48:57
+    
+    
+    - snmplib/parse.h, snmplib/parse.c: new mib printer: mib_print_tree
+      inspired by a reference to snmx in comp.protocols.snmp
+    - apps/snmptranslate: let the -p option call this new printer
+    - snmplib/snmp_api.c: some left over __P macros
+
+nba 26 Apr 99 12:03:47
+    
+    (if.c) make the width of snmpnet -i (and -o) adapt to the length of returned
+    	strings
+
+nba 26 Apr 99 12:09:35
+    
+    
+    apps/*.c: use snmp_perror to report errors from read_objid and friends
+    apps/snmptrapd.c: fix a bus error when using -S and receiving an
+    	enterprise specific trap.
+
+nba 26 Apr 99 12:13:50
+    
+    */*: replace horrible (char *)"string" with const specifiers in relevant
+    	functions.
+
+mslifcak 26 Apr 99 12:37:09
+    - (snmp_api.c) - fix other use of request's callback data
+
+mslifcak 27 Apr 99 09:51:35
+    - (interfaces.c) add if_type_from_name to convert interface name to type.
+
+hardaker 29 Apr 99 07:32:39
+    - (Makefile.in, callback.c, callback.h): callback API.
+
+hardaker 29 Apr 99 07:39:45
+    - (agent_read_config.c, snmpd.c, snmptrapd.c, snmp_api.c, snmpusm.c,
+      snmpusm.h, snmpv3.c, snmpv3.h):
+      - use the callback mechanism for post-config stuff.
+
+hardaker  3 May 99 07:07:15
+    - (agent_read_config.c, usmUser.c, usmUser.h, snmpTargetAddrEntry.c,
+      snmpTargetAddrEntry.h, snmpTargetParamsEntry.c,
+      snmpTargetParamsEntry.h, snmptrapd.c, callback.c, callback.h,
+      scapi.c, scapi.h, snmp_api.c, snmpv3.c, snmpv3.h):
+      - shutdown and store callback usage.
+
+hardaker  3 May 99 07:13:31
+    - (snmpd.c): fix -A flag, which got broken during someones changes.
+
+hardaker  3 May 99 12:58:19
+    - (Makefile.in, agent_read_config.c, Makefile.in, header_complex.c,
+      Makefile.in, encode_keychange.c, Makefile.in, Makefile.in,
+      all_general_local.h, all_system.h, keytools.c, lcd_time.c, scapi.c,
+      snmp_auth.c, snmpusm.c, tools.c, tools.h, Makefile.in, T.c,
+      etimetest.c, keymanagetest.c, misctest.c, scapitest.c):
+      - nuked all_general_local.h and all_system.h.
+      - makefileindepend as well.
+
+nba  3 May 99 15:40:11
+    (*.[ch]):	patches to types to wipe warnings from compilers
+    	with more strict noise levels. (also good when compiling
+    	with gcc -Wall -pedantic -Wwrite-strings -Wcast-qual)
+
+nba  4 May 99 00:47:44
+    (mib.c):	Fix problem (core dump) with MIBFILES environment variable.
+
+nba  4 May 99 00:51:16
+    (many):	remove const spec from FindVarMethod. That was wrong
+
+hardaker  4 May 99 11:08:55
+    - (configure, configure.in): Added --enable-developer flag.
+
+mslifcak  6 May 99 09:20:30
+    - (ucd-snmp/vmstat.c) - conditionally include limits.h per Eduard Koucky.
+
+nba 10 May 99 14:47:22
+    Fixing some more prototypes. Pointed out by Markku Laukkanen.
+
+nba 10 May 99 14:49:49
+    snmplib/snmp_api.c: Mix-up of V1_IN_V2/V2_IN_V1 error code when GETBULK
+    	inside V1 session.
+
+hardaker 11 May 99 14:02:48
+    - (util_funcs.c): read returns ssize_t not size_t.
+
+hardaker 11 May 99 14:03:25
+    - (memory.h): remove extern.
+
+hardaker 11 May 99 14:11:40
+    - (hpux.c, hpux.h): int -> size_t conversions.
+
+mslifcak 12 May 99 10:53:23
+    - (snmp_api.c snmp_client.c) call snmp_synch_reset from snmp_sess_close
+
+mslifcak 12 May 99 11:22:16
+    -(parse.c party_parse.c read_config.c) no exit() from library; return error
+
+daves 13 May 99 03:52:19
+    - (ip.c): Properly register IP module group on Free-BSD systems
+              (thanks to Mitchell Tasman)
+
+hardaker 13 May 99 09:09:18
+    - (vacm_vars.c): Set pointers to NULL after freeing them.
+
+mslifcak 14 May 99 06:54:51
+    - (agent/mibgroup/dummy/dummy.c agent/mibgroup/examples/example.c
+     agent/mibgroup/examples/example.h
+     agent/mibgroup/examples/wombat.c agent/mibgroup/misc/ipfwacc.c
+     agent/mibgroup/smux/smux.c
+     agent/mibgroup/snmpv3/snmpMPDStats.c
+     agent/mibgroup/snmpv3/usmStats.c
+     agent/mibgroup/snmpv3/usmUser.c snmplib/snmp_auth.c) more size_t fixes
+
+mslifcak 14 May 99 09:47:10
+    - (agent/mibgroup/examples/wombat.h agent/mibgroup/host/hr_disk.c
+     agent/mibgroup/mibII/interfaces.c
+     agent/mibgroup/mibII/var_route.c
+     agent/mibgroup/snmpv3/usmUser.c apps/encode_keychange.c
+     snmplib/parse.c) more ANSI-C touchups
+
+mslifcak 14 May 99 13:59:37
+    -(agent/mibgroup/mibII/interfaces.c snmplib/snmpusm.c) fixes to build HP & AIX
+
+daves 17 May 99 03:20:53
+    - (snmp_parse_args.c): Initialise session using library routine
+
+daves 17 May 99 04:34:55
+    - (snmplib/snmp_api.h snmplib/snmp_api.c snmplib/snmp_client.c
+       agent/snmpd.c agent/mibgroup/mibII/vacm_vars.c
+       agent/mibgroup/v2party/alarm.c agent/mibgroup/v2party/event.c
+       apps/snmpstatus.c apps/snmptest.c apps/snmptrap.c apps/snmptrapd.c):
+    
+      - Use the generic socket addresses 'struct sockaddr',
+        rather than the IP-specific 'struct sockaddr_in'
+
+daves 17 May 99 04:38:00
+    - (snmplib/snmp_api.h snmplib/snmp_api.c snmplib/snmp_client.c
+       agent/snmpd.c agent/mibgroup/mibII/vacm_vars.c
+       agent/mibgroup/v2party/alarm.c agent/mibgroup/v2party/event.c
+       apps/snmpstatus.c apps/snmptest.c apps/snmptrap.c apps/snmptrapd.c):
+    
+      - Use the generic socket address 'struct sockaddr',
+        rather than the IP-specific 'struct sockaddr_in'
+
+daves 17 May 99 07:18:02
+    - (snmplib/snmp_api.c snmplib/snmp_api.h agent/snmpd.c
+       apps/snmptrap.c apps/snmptrapd.c):
+    
+      - Use a single address field within the PDU structure
+                   (obsoleting 'agent_addr')
+
+daves 18 May 99 06:26:16
+    - (snmp_api.c snmp_api.h): More general handling of PDU flags
+
+mslifcak 18 May 99 09:01:46
+    - (xx/Makefile.in) remove references to as yet missing disman files.
+
+daves 18 May 99 09:23:50
+    - (configure.in snmplib/context_parse.c snmplib/read_config.c
+       snmplib/snmp_api.c snmplib/snmpv3.c snmplib/system.c
+       apps/snmp_parse_args.c apps/snmpbulkwalk.c apps/snmpdelta.c
+       apps/snmpget.c apps/snmpgetnext.c apps/snmpset.c
+       apps/snmpstatus.c apps/snmptable.c apps/snmptest.c
+       apps/snmptrap.c apps/snmpusm.c apps/snmpwalk.c
+       apps/snmpnetstat/if.c apps/snmpnetstat/inet.c
+       apps/snmpnetstat/main.c apps/snmpnetstat/route.c
+       apps/snmpnetstat/winstub.c):
+       -  Clean up conditionals protecting include files
+            ( #if HAVE_WINSOCK_H / #else / #endif )
+
+daves 19 May 99 02:33:07
+    - (config.h.in): Additional include protection entries
+
+daves 19 May 99 05:11:37
+    - (snmp_api.c): More generalised handling of socket addresses
+
+mslifcak 19 May 99 18:02:55
+    -(mibII/var_route.c) - fix Linux RouteMask c/o "Nancy" nam@cs.cmu.edu
+
+mslifcak 19 May 99 18:50:12
+    - (host_res.h) fix HAVE_NET_IF_VAR_H define (was HAVE_NET_IN_VAR_H)
+
+daves 20 May 99 03:46:24
+    - (snmp_api.h): Temporary fix to socket address problems
+
+mslifcak 21 May 99 05:24:23
+    -(read_config.c) cast fix per Markku Laukkanen
+
+daves 21 May 99 05:54:22
+    - (snmp_api.c snmp_api.h):
+      -  New API call to close down all open sessions
+         (also called on application shutdown)
+
+hardaker 21 May 99 11:10:44
+    - (mib2c.conf, mib2c.storage.conf):
+      - convert to size_t storages.
+      - misc eval fixes.
+      - more cleanup of the storage def.
+
+mslifcak 21 May 99 15:29:46
+    - library changes to build on Win32.
+
+mslifcak 24 May 99 05:36:13
+    -configure - save one which looks for netdb/socket headers
+
+hardaker 26 May 99 11:19:03
+    - (ipfwacc.h): properly locate the mib.
+
+hardaker 26 May 99 15:14:55
+    - (hr_swinst.c): make software application type unknown instead of app.
+
+hardaker 26 May 99 15:18:04
+    - (IPFWACC-MIB.txt): change to counters.
+
+hardaker 26 May 99 15:20:32
+    - (ipfwacc.h): make into counters.
+
+hardaker 26 May 99 15:56:03
+    - (acconfig.h, config.h.in): increase MAXREADCOUNT.
+
+hardaker 26 May 99 17:40:28
+    - (IPFWACC-MIB.txt): added SEQUENCE OF.
+
+mslifcak 27 May 99 05:16:25
+    -(encode_keychange, read_config, snmpusm) aCC fixes by PKY (Markku Laukkanen)
+
+hardaker 27 May 99 14:30:03
+    - (snmptrapd_handlers.c): implement the default trap handler.
+
+hardaker 27 May 99 14:30:15
+    - (snmptrapd.c): need an init_mib().
+
+hardaker 27 May 99 14:37:06
+    - (snmptrapd.conf.5.def): document default oid keyword.
+
+hardaker 27 May 99 14:37:32
+    - (snmptrapd.c): document default oid keyword in help line.
+
+daves 28 May 99 07:02:01
+    - (agent/Makefile.in agent/mibgroup/Makefile.in): fix problem with null macro
+
+daves 28 May 99 08:14:05
+    - (snmplib/snmp_api.c): save local socket address in internal session structure
+
+daves 28 May 99 08:57:19
+    - (snmplib/snmp_api.c): Unix domain (datagram) socket support
+
+daves 28 May 99 09:12:20
+    - (snmplib/snmp_api.c): Separate out copying a session and opening a new one
+
+mslifcak 28 May 99 09:24:56
+    -(snmp_api.c) -catch one more error close from snmp_sess_copy
+
+hardaker 28 May 99 16:17:13
+    - (mib.c, parse.c, parse.h): save and use index clauses.
+
+hardaker 28 May 99 16:44:42
+    - (Makefile.in, default_store.c, default_store.h):
+      - created generic default value storage space and parsers to reduce
+        the number of functions/etc created for values which configure the
+        library.
+
+daves  1 Jun 99 02:17:27
+    - (snmplib/snmp_api.c): Garbage collection for Traditional SAPI sessions
+
+daves  1 Jun 99 02:32:13
+    - (snmplib/snmp_api.c): Generalise handling of addresses (w.r.t sento/recvfrom)
+
+daves  1 Jun 99 07:30:42
+    - (snmplib/snmp_api.c snmplib/snmp_api.h): Support for stream-based sockets
+
+hardaker  1 Jun 99 17:21:53
+    - (Makefile.in, snmp_alarm.c, snmp_alarm.h, snmp_api.c):
+      - implemented a generic alarm handler to register alarm functions to
+        be called back after X period of time and it handles figuring out
+        which is next and calling alarm() and signal() appropriately.
+
+mslifcak  4 Jun 99 09:51:13
+    -(hr_filesys.c,interfaces.c,tcp.c,udp.c,freebsd3.h) fix FreeBSD3.1 incl Ken Key's tcp/udp patches
+
+mslifcak  7 Jun 99 07:44:06
+    -(interfaces.c, tcp.c, udp.c, ip.c) clone fixes from 3.6 line (FreeBSD3.1)
+
+mslifcak  7 Jun 99 13:04:21
+    -(if.c) check for valid pointer before de-referencing.
+
+mslifcak  8 Jun 99 07:43:10
+    -(hr_filesys.c) fix memory leak when HAVE_GETFSSTAT is defined.
+
+daves  8 Jun 99 08:43:59
+    - (agent/mibgroup/v2party/alarm.c
+       snmplib/snmp_api.c snmplib/snmp_api.h
+       snmplib/snmp_auth.c snmplib/snmp_impl.h):
+       -  removed all uses of 'struct packet_info' (subsumed into 'struct snmp_pdu')
+
+mslifcak  8 Jun 99 09:32:48
+    -(xx__freebsd2.c) - fix size_t to build on FreeBSD 2.2.x
+
+daves  9 Jun 99 06:32:02
+    - (snmp_api.h): reorder PDU and session fields more clearly
+
+hardaker  9 Jun 99 18:31:42
+    - (*): merged 3.6.2 changes into main branch.
+
+daves 15 Jun 99 03:59:23
+    - (snmp_agent.c): Removed duplicate code
+
+daves 15 Jun 99 08:28:00
+    - (snmp_agent.c snmp_agent.h):
+      - Move processing from 'handle_next_pass()' to 'handle_snmp_packet()'
+
+hardaker 15 Jun 99 16:25:57
+    - (snmp_api.c): fix allowed zerolength pdu->securityName problem for
+      v3 engineID discovery probes.
+
+daves 16 Jun 99 05:11:48
+    - (snmp.h snmp_api.c): move PDU validation, etc from 'send' to 'build' routines
+
+daves 16 Jun 99 05:49:38
+    - (snmp_api.c): handle responses in a more protocol-independent manner
+
+daves 16 Jun 99 06:56:14
+    - (snmp_api.c snmp_api.h): Hooks for building/parsing non-SNMP packets
+
+hardaker 16 Jun 99 16:24:58
+    - (default_store.c, default_store.h, mib.c, parse.c):
+      - first usage of the default_store() routines: move all the mib
+        parser variables to it, and add snmp.conf tokens for them.
+        - premib auto-registration of default_store needs cleaning up...  sigh...
+
+hardaker 16 Jun 99 16:51:11
+    - (snmp_api.c, snmp_debug.c, snmp_debug.h):
+      - 2 new snmp.conf tokens: doDebugging, debugTokens.
+
+hardaker 17 Jun 99 07:39:01
+    - (configure, configure.in): fix --help.
+
+mslifcak 17 Jun 99 13:18:35
+    fixups to build most apps under Win32 (MSVC++ 5.0 or later)
+
+mslifcak 18 Jun 99 05:01:54
+    applied fixes from M. Laukkanen
+
+daves 18 Jun 99 06:58:53
+    - (sysORTable.c sysORTable.h): new routine for removing sysORTable entries
+
+daves 18 Jun 99 07:56:46
+    - (snmp.h snmp_api.c): distinguish between SNMP protocol & PDU handling flags
+
+daves 18 Jun 99 08:00:34
+    - (snmp_client.c): Enable access to "empty" response PDUs (i.e. header only).
+    	(also make 'snmp_clone_mem' accessible to other files)
+
+daves 18 Jun 99 08:04:22
+    - (asn1.h snmp_api.c): New private types for OID ranges
+
+daves 18 Jun 99 08:44:11
+    - (snmp_api.h): New socket address structure
+
+daves 18 Jun 99 08:47:38
+    - (snmp_api.c): protocol-independent non-response handling in 'snmp_sess_read'
+
+daves 18 Jun 99 08:49:52
+    - (snmp_api.c):
+      - accomodate servers that require an accessible client-end unix stream socket
+                  (in particular, the CMU AgentX master agent)
+
+daves 18 Jun 99 08:55:32
+    - (snmp_api.h Makefile.in agentx.c agentx.h agentx_client.c):
+      - basic AgentX protocol handling
+
+daves 18 Jun 99 09:00:16
+    - (snmp_vars.c): protocol-independent means of bypassing VACM checks
+
+daves 18 Jun 99 09:14:58
+    - (snmpd.c snmpd.h snmp_vars.c snmp_agent.c snmp_agent.h
+       mibgroup/mibII/sysORTable.c):
+       - initial AgentX sub-agent implementation
+
+mslifcak 18 Jun 99 10:02:03
+    -(sysORTable.c) fix ptr test
+
+mslifcak 22 Jun 99 05:21:03
+     invoke snmp_sess_init before any MIB processing (fixes master agent).
+
+nba 22 Jun 99 05:25:13
+    TODO:	need for Counter64 support in snmpdelta
+
+daves 28 Jun 99 03:08:42
+    - (snmp_agent.c snmp_agent.h): make SNMP packet handling routine re-entrant.
+
+daves 28 Jun 99 04:07:36
+    - {Makefile.in agent_read_config.c snmp_vars.c agent_registry.c):
+      - Consolidate all registry handling into one file
+
+daves 28 Jun 99 09:52:08
+    - (agent_registry.c snmp_vars.c snmp_vars.h var_struct.h):
+      - Non-recursive MIB registry implementation
+
+hardaker 28 Jun 99 14:59:41
+    - (snmpd.c): init_snmp_alarm().
+
+hardaker 28 Jun 99 15:01:14
+    - (snmptrapd.c): init_snmp_alarm();
+
+daves 30 Jun 99 01:37:11
+    - (sysORTable.c sysORTable.h): Indicate success/failure of {un}registration
+
+daves 30 Jun 99 01:45:26
+    - (agent_registry.c snmp_vars.h): Indicate success/failure of {un}registration
+
+daves 30 Jun 99 01:48:34
+    - (snmp_agent.c snmp_agent.h): 'agent_snmp_session' initialisation routine
+
+daves 30 Jun 99 02:32:03
+    - (snmp_api.c): Correct the setup of stream-based accepted internal sessions
+
+daves 30 Jun 99 03:20:46
+    - (agent_read_config.h): omit redundant declarations
+
+daves 30 Jun 99 05:05:44
+    - (snmp_api.c): Provide the correct size of socket addresses
+
+daves 30 Jun 99 05:06:52
+    - (config.h.in configure.in configure): check for sys/un.h
+
+daves 30 Jun 99 05:48:40
+    - (snmp_api.c): Missed one 'sendto' call
+
+hardaker 30 Jun 99 19:37:36
+    - (default_store.c, default_store.h, mib.c, mib.h, snmp_api.c,
+      snmpv3.c, snmpv3.h):
+      - convert more stuff to the default_store space.
+
+daves  2 Jul 99 02:39:41
+    - (snmp_api.c): Fix that last 'sendto' case *correctly* this time
+
+daves  2 Jul 99 05:13:42
+    - (snmplib/asn1.h agent/snmp_vars.h agent/snmp_agent.c):
+      - implement an interface for delegating requests to subagents
+
+daves  2 Jul 99 05:15:56
+    - (var_struct.h agent_registry.c):
+      - map between MIB registrations and the supporting (subagent) session
+
+daves  2 Jul 99 05:16:41
+    - (snmp_api.h): support lists of sessions (and subsessions)
+
+hardaker  2 Jul 99 08:27:30
+    - (snmptranslate.c): register debugging tokens with -D
+
+daves  6 Jul 99 02:20:57
+    - (snmp_agent.c): Fix handling of SNMPv1 noSuchName
+
+daves  7 Jul 99 06:54:53
+    - (asn1.c asn1.h snmp.c snmp.h snmp_api.c snmp_api.h
+       snmp_auth.c snmp_impl.h agentx.c):
+       - First attempt at formatted display of packet data
+
+daves  8 Jul 99 02:16:15
+    - (snmp_api.c): Retain community string in responses
+
+daves  8 Jul 99 06:25:07
+    - (mibII/system_mib.c mibII/snmp_mib.c):
+      - Update 'write' routines for V4 architecture,
+        and using the full SET multi-pass algorithm
+
+hardaker  8 Jul 99 14:29:35
+    - (config.h): comment change for internal md5.
+
+hardaker  8 Jul 99 14:30:47
+    - (asn1.c): -Wall fixes.
+
+hardaker  8 Jul 99 14:36:52
+    - (configure, configure.in, Makefile.in, snmp2p.c, snmp_agent.c,
+      snmp_vars.c, snmpd.c, view_parse.c, vacm_vars.c, snmp_parse_args.c,
+      snmptrapd.c, snmptrapd_handlers.c, main.c, Makefile.in, acl.c,
+      acl.h, acl_parse.c, context.c, context.h, context_parse.c,
+      libsnmp.h, party.c, party.h, party_parse.c, snmp.h, snmp_api.c,
+      snmp_auth.c, snmp_client.c, view.c, view.h):
+      - v2party support is finally gone!
+
+hardaker  8 Jul 99 14:49:08
+    - (*/Makefile.in): make depend
+
+hardaker  8 Jul 99 15:16:35
+    - (snmpdelta.c, int64.c, int64.h): minimal c64 support for snmpdelta. Untested.
+
+hardaker  8 Jul 99 16:02:58
+    - (snmpd.c): Patch from Ragnar Kjørstad:
+      - Add options for switching to a given uid and gid.
+
+daves  9 Jul 99 01:49:49
+    - (snmpd.c): Clean up gid/uid change logging
+
+daves  9 Jul 99 08:27:39
+    - (*/Makefile.in snmplib/snmp_api.c
+       agent/agent_registry.c agent/snmp_agent.[ch] agent/snmp_vars.[ch]
+       agent/snmpd.[ch] agent/mibgroup/mibII/sysORTable.c):
+       - Move AgentX handling out of the main SNMP library
+
+mslifcak  9 Jul 99 12:12:50
+    -(snmp_client.*) remove snmp_synch_setup, snmp_synch_reset
+
+mslifcak  9 Jul 99 14:20:23
+    -(win32,snmplib,apps,agent) add snmp_socket_length to hide sockaddr_un; Win32 touchups
+
+mslifcak 11 Jul 99 18:36:24
+    Reduce use of snmp_errno - fix memory leak, unused vars, and unset var.
+
+daves 12 Jul 99 07:14:36
+    - (agent/mibgroup/Makefile.in): remove dependency on snmplib/agentx.h
+
+daves 12 Jul 99 08:32:27
+    - (mibgroup/host/*): Dynamically register all Host Resource modules
+
+mslifcak 14 Jul 99 13:14:30
+    -(snmp_api.c) - snmp_add_var returns SNMPERR; MAY set snmp_errno
+
+mslifcak 14 Jul 99 13:46:53
+    -(snmplib/mib.c) - conditionally allow for not setting snmp_errno
+
+hardaker 15 Jul 99 08:46:00
+    - (asn1.c, snmp_api.c, snmp_auth.c, snmp_debug.c, snmp_debug.h):
+      - beginning of a -Ddump version of packet dumping.
+      - needs a lot more work and clean up.
+      - I need comments...  Tell me what you think...
+
+hardaker 20 Jul 99 14:02:26
+    - (auto_nlist.c, history.c, kernel.c, snmp_agent.c, snmpd.c,
+      dlmod_mib.c, kernel_sunos5.c, mibincl.h, util_funcs.c, ipfwchains.c,
+      at.c, interfaces.c, ip.c, route_write.c, system_mib.c, tcp.c, udp.c,
+      vacm_vars.c, var_route.c, dlmod.c, smux.c, disk.c, extensible.c,
+      loadave.c, memory_solaris2.c, pass.c, pass_persist.c, proc.c,
+      versioninfo.c, alarm.c, event.c, Makefile.in, parse.c, snmp.c,
+      snmp_debug.c, snmp_logging.c, snmp_logging.h): Patch from Ragnar
+      Kjørstad:
+      - do file, stderr, and syslog support.
+
+hardaker 20 Jul 99 17:06:53
+    - (auto_nlist.c, snmp_agent.c, snmpd.c, dlmod_mib.c, kernel_sunos5.c,
+      ipfwchains.c, interfaces.c, dlmod.c, smux.c, versioninfo.c,
+      alarm.c):
+      - convert snmp_log(LOG_DEBUG) to DEBUGMSGTL().
+
+mslifcak 20 Jul 99 18:11:50
+    -minor changes to build Win32 platforms using CygWin-egcs and MSVC compilers.
+
+mslifcak 20 Jul 99 19:33:26
+    - no printf in ascii_to_binary
+
+hardaker 21 Jul 99 16:06:52
+    - (tkmib, mib2c): udpate to use indexes (requires a perl patch.
+
+hardaker 23 Jul 99 10:36:54
+    - (snmp_parse_args.c): log to stderr.
+
+hardaker 23 Jul 99 10:44:17
+    - (aclocal.m4, config.h.in, configure, configure.in, snmp_agent.c,
+      snmp_vars.c, snmpd.c, kernel_sunos5.c, util_funcs.c, interfaces.c,
+      interfaces.h, system_mib.c, var_route.c, snmpEngine.c,
+      snmpTargetParamsEntry.c, snmptrapd.c, HOST-RESOURCES-MIB.txt,
+      IANAifType-MIB.txt, IF-MIB.txt, IP-MIB.txt, TCP-MIB.txt,
+      UDP-MIB.txt, parse.c, snmp_alarm.c, snmp_logging.c, snmp_logging.h):
+      - merge from V3-line post 3.6.2 to current.
+      - misc bug fixes.
+      - make apps turn on stderr logging by default.
+
+hardaker 23 Jul 99 13:18:23
+    - (snmpd.c): more snmp_log conversions.
+
+hardaker 23 Jul 99 13:18:44
+    - (util_funcs.c): change malloc size().
+
+hardaker 23 Jul 99 13:19:20
+    - (asn1.c): null terminate parsed strings, just in case.
+
+hardaker 23 Jul 99 13:20:02
+    - (snmp.c): xdump fixes.
+
+hardaker 23 Jul 99 13:20:33
+    - (keytools.c, parse.c, read_config.c, snmp_api.c): snmp_log conversions.
+
+hardaker 23 Jul 99 14:19:39
+    - (asn1.c, asn1.h, snmp.c, snmp_api.c, snmp_auth.c, snmp_impl.h):
+      - revert to non-dparse versions of asn decoding.
+
+hardaker 23 Jul 99 14:26:57
+    - (snmpd.c): init debugging.
+
+hardaker 23 Jul 99 15:22:02
+    - (snmpbulkwalk.c, snmpdelta.c, snmpget.c, snmpgetnext.c, snmpset.c,
+      snmpstatus.c, snmptable.c, snmptest.c, snmptranslate.c, snmptrap.c,
+      snmptrapd.c, snmpusm.c, snmpwalk.c, snmp_api.c, snmp_api.h,
+      snmp_client.c):
+      - make and use snmp_sess_perror(str, sess) for error printing.
+
+mslifcak 24 Jul 99 07:11:30
+    -(asn1.c) - fix compare error at line 386; remove unused vars elsewhere
+
+mslifcak 24 Jul 99 07:18:13
+    -(libsnmp.def) - add decls for new error logging functions.
+
+mslifcak 24 Jul 99 07:45:59
+    -(snmp_client.c) - use SET_SNMP_ERROR for restored snmp_errno sets.
+
+mslifcak 24 Jul 99 08:11:05
+    -(md5.c) - wrap unused MD5print with SNMP_TESTING_CODE ifdef
+
+hardaker 26 Jul 99 07:37:09
+    - (SNMPv2-CONF.txt): removed bogus IMPORTS clause
+
+hardaker 26 Jul 99 09:04:09
+    - (*/Makefile.in): make depend
+
+hardaker 26 Jul 99 09:14:24
+    - (NEWS): updated a bit
+
+hardaker 26 Jul 99 11:51:22
+    - (version.h bug-report sedscript.in): version tag ( 4.0.pre4 )
+
+hardaker 26 Jul 99 14:32:17
+    - (mib.c): BIT_string: -> BITS:
+
+mslifcak 26 Jul 99 15:12:45
+    -(asn1.c,asn1.h,snmp.c,snmp_api.c,snmp_auth.c,snmpusm.c) more detailed parse error messages.
+
+hardaker 26 Jul 99 15:59:10
+    - (agent/mibgroup/Makefile.in): fix make depend.
+
+hardaker 26 Jul 99 17:06:03
+    - (interfaces.c): Patch from Markku Laukkanen:
+      - variable naming change.
+
+hardaker 26 Jul 99 17:06:47
+    - (hpux.h): Patch from Markku Laukkanen:
+      - define hpux
+
+hardaker 26 Jul 99 17:07:31
+    - (keytools.c, keytools.h, parse.c, scapi.c): Patch from Markku Laukkanen:
+      - size_t changes.
+
+mslifcak 27 Jul 99 04:24:08
+    add include net/if_dl.h suggested by Tom Ivar Helbekkmo
+
+daves 27 Jul 99 06:38:09
+    - (agent/mibgroup/ucd-snmp/*.c): tweak registry labels
+
+mslifcak 27 Jul 99 07:52:37
+    -(agent/kernel.c,agent/dlmods/dlmod_mib.c,agent/dlmods/example.c,
+    agent/mibgroup/kernel_sunos5.c,agent/mibgroup/util_funcs.c,
+    agent/mibgroup/agentx/master_request.c,
+    agent/mibgroup/agentx/protocol.c,agent/mibgroup/dummy/dummy.c,
+    agent/mibgroup/examples/example.c,
+    agent/mibgroup/examples/ucdDemoPublic.c,
+    agent/mibgroup/examples/wombat.c,
+    agent/mibgroup/host/hr_device.c,agent/mibgroup/host/hr_disk.c,
+    agent/mibgroup/host/hr_filesys.c,
+    agent/mibgroup/host/hr_network.c,
+    agent/mibgroup/host/hr_partition.c,
+    agent/mibgroup/host/hr_print.c,agent/mibgroup/host/hr_proc.c,
+    agent/mibgroup/host/hr_storage.c,
+    agent/mibgroup/host/hr_swinst.c,agent/mibgroup/host/hr_swrun.c,
+    agent/mibgroup/host/hr_system.c,
+    agent/mibgroup/ipfwchains/ipfwchains.c,
+    agent/mibgroup/mibII/at.c,agent/mibgroup/mibII/icmp.c,
+    agent/mibgroup/mibII/interfaces.c,agent/mibgroup/mibII/ip.c,
+    agent/mibgroup/mibII/route_write.c,
+    agent/mibgroup/mibII/snmp_mib.c,
+    agent/mibgroup/mibII/sysORTable.c,
+    agent/mibgroup/mibII/system_mib.c,agent/mibgroup/mibII/tcp.c,
+    agent/mibgroup/mibII/udp.c,agent/mibgroup/mibII/var_route.c,
+    agent/mibgroup/misc/dlmod.c,agent/mibgroup/snmpv3/snmpEngine.c,
+    agent/mibgroup/snmpv3/usmUser.c,
+    agent/mibgroup/target/snmpTargetAddrEntry.c,
+    agent/mibgroup/target/snmpTargetParamsEntry.c,
+    agent/mibgroup/ucd-snmp/file.c,
+    agent/mibgroup/ucd-snmp/registry.c,
+    agent/mibgroup/v2party/acl_vars.c,
+    agent/mibgroup/v2party/alarm.c,
+    agent/mibgroup/v2party/context_vars.c,
+    agent/mibgroup/v2party/event.c,
+    agent/mibgroup/v2party/party_vars.c,
+    agent/mibgroup/v2party/view_vars.c,apps/encode_keychange.c,
+    snmplib/asn1.c,snmplib/scapi.c,snmplib/snmp_client.c,
+    snmplib/snmp_client.h)  ERROR_MSG, printf --> DEBUGMSGTL
+
+mslifcak 27 Jul 99 09:33:43
+    -(agent/kernel.c,agent/snmpd.c,agent/mibgroup/util_funcs.c,
+    agent/mibgroup/agentx/master.c,
+    agent/mibgroup/agentx/subagent.c,
+    agent/mibgroup/host/hr_swrun.c,agent/mibgroup/mibII/at.c,
+    agent/mibgroup/mibII/icmp.c,agent/mibgroup/mibII/ip.c,
+    agent/mibgroup/mibII/route_write.c,agent/mibgroup/mibII/tcp.c,
+    agent/mibgroup/mibII/udp.c,agent/mibgroup/ucd-snmp/disk.c,
+    agent/mibgroup/ucd-snmp/errormib.c,
+    agent/mibgroup/ucd-snmp/proc.c,
+    agent/mibgroup/ucd-snmp/vmstat.c,
+    agent/mibgroup/v2party/alarm.c,agent/mibgroup/v2party/event.c,
+    apps/snmpbulkwalk.c,apps/snmpdelta.c,apps/snmpget.c,
+    apps/snmpgetnext.c,apps/snmpset.c,apps/snmpstatus.c,
+    apps/snmptable.c,apps/snmptest.c,apps/snmptrap.c,
+    apps/snmptrapd.c,apps/snmpusm.c,apps/snmpwalk.c,
+    apps/snmpnetstat/inet.c,apps/snmpnetstat/main.c,
+    apps/snmpnetstat/route.c,snmplib/parse.c,snmplib/read_config.c,
+    snmplib/snmpv3.c) fix snmp_sess_perror use; use log_perror for perror
+
+mslifcak 27 Jul 99 12:00:37
+    -(encode_keychange.dsp,snmpusm.dsp) -build using common Win32 compiler
+
+mslifcak 27 Jul 99 12:24:03
+    -(apps:encode_keychange.c,snmpdelta.c,snmptable.c, snmpusm.c;
+    snmplib:read_config.c,snmpv3.c; win32/libsnmp_dll/libsnmp.def) -
+     adjust headers, build Win32 snmpusm+encode_keychange
+
+mslifcak 27 Jul 99 16:06:35
+    -(interfaces.c) - fix error setting if_ibytes for Linux 2.0
+
+hardaker 27 Jul 99 16:14:28
+    - (asn1.c, mib.c, mib.h, snmp_api.c, snmp_debug.c, snmp_debug.h, snmpusm.c):
+      - cleaned up debugging dump output.
+      - added more dump parse headers for v3 dumps.
+
+hardaker 27 Jul 99 16:20:46
+    - (asn1.c): fix header dump.
+
+mslifcak 27 Jul 99 17:15:01
+    including mib.h requires stdio.h to define FILE *.
+
+mslifcak 27 Jul 99 19:02:31
+    -(snmp_parse_args) in snmp_parse_oid, try get_node if read_objid fails.
+
+mslifcak 27 Jul 99 19:06:08
+    -(mib.c) fix walking OID length pointer, numeric sub-id not found
+    in read_objid and parse_subtree.
+
+mslifcak 27 Jul 99 23:34:59
+    -(snmpd.c) invoke log functions from child (correct process ID in syslog)
+
+mslifcak 27 Jul 99 23:58:51
+    -(keytools.c,md5.c,md5.h,scapi.c,snmp.c,snmp_api.c,snmp_auth.c) catch MD5 errors
+
+mslifcak 28 Jul 99 02:42:32
+    hr_swrun - reset pointer in module init (help HP/UX 9)
+    snmp_logging - use vsprintf for HP/UX-9
+
+hardaker 28 Jul 99 06:45:19
+    - (bug-report): change mail addr to ucd-snmp-bugs
+
+daves 29 Jul 99 03:29:40
+    - (mibII/vacm_vars.c): Catch use of unconfigured EXAMPLE.conf files
+
+mslifcak 29 Jul 99 08:34:59
+    memory_solaris2 : handle malloc errors
+    kernel_sunos5 : share kstat fildes [SHARE_KSTAT_FD]
+
+mslifcak 29 Jul 99 13:28:36
+    -(apps/Makefile.in) - comment unneeded TRAPSPECIAL line
+
+mslifcak 29 Jul 99 13:59:02
+    -(agent/snmpd.c) - log standard error until init is completed.
+
+mslifcak 29 Jul 99 15:04:49
+    auto_nlist, kernel : place log_perror to catch errno value in report.
+
+hardaker 29 Jul 99 17:03:25
+    - (configure, configure.in, Makefile.in): remove trap_special stuff.
+
+hardaker 29 Jul 99 17:06:56
+    - (mibgroup/v2party): removed files.
+
+mslifcak 30 Jul 99 03:51:31
+    Removed duplicate HAVE_GET???BYNAME; Removed unused _CRTIMP
+
+mslifcak 30 Jul 99 03:57:23
+    Removed hint of v2party from comment.
+
+mslifcak 30 Jul 99 04:00:28
+    -(agent/agent_read_config.c,agent/history.c,agent/snmp_vars.c,
+    agent/snmpd.c,snmplib/read_config.c,snmplib/snmp_alarm.c,
+    snmplib/snmp_api.c,snmplib/snmp_logging.c,snmplib/snmpv3.c,
+    snmplib/system.c) - psos diffs offered by Anthony Symons
+
+mslifcak 30 Jul 99 04:37:20
+    rename local var 'last' to 'last_ipch' - avoid shadow global decl
+
+mslifcak 30 Jul 99 04:39:38
+    decl log_perror
+
+mslifcak 30 Jul 99 04:42:48
+    rename sd to ifsd - avoid global shadow decl
+
+mslifcak 30 Jul 99 05:42:34
+    hr_storage.c - auto_nlist for HR_STORE_SIZE
+    hr_swrun.c - fix global shadow decl
+    snmp_logging.c - change filter for openlog per A. Symons patch
+
+daves 30 Jul 99 06:01:08
+    - (agent/agent_registry.c agent/snmp_vars.c agent/snmpd.c
+       apps/snmp_parse_args.c apps/snmptest.c apps/snmptrap.c
+       apps/snmptrapd.c apps/snmpnetstat/main.c snmplib/snmp_api.c
+       snmplib/snmp_api.h snmplib/snmp_client.c
+       agent/mibgroup/v2party.c agent/mibgroup/v2party.h):
+       -  Removed last traces of v2p support
+
+daves 30 Jul 99 06:23:06
+    - (agent_read_config.c agent_registry.c snmp_vars.c snmp_vars_m2m.h):
+      - Removed last traces of obsolete v2party Manager-to-Manager support
+
+mslifcak 30 Jul 99 06:30:30
+    system - use sizeof
+
+mslifcak 30 Jul 99 06:30:59
+    win32/config.h - define HAVE_GETHOSTNAME
+
+mslifcak 30 Jul 99 06:46:22
+    use traditional K&R commenting; not all "C" compilers accept "//" comments.
+
+mslifcak 30 Jul 99 06:58:08
+    remove references to non-existent snmp_vars_m2m.h
+
+daves 30 Jul 99 07:01:46
+    - (configure.in configure): Check for libdb/libdb1 & librpm separately
+
+daves 30 Jul 99 07:31:56
+    - (acconfig.h): Check for libdb/libdb1 & librpm separately
+
+mslifcak 30 Jul 99 08:01:18
+    add vsnprintf check and HAVE_VSNPRINTF constant
+
+mslifcak 30 Jul 99 08:32:28
+    no struct sockaddr_dl in AIX 3.
+
+hardaker 30 Jul 99 14:10:05
+    - (config.h.in): autoheader run.
+
+hardaker 30 Jul 99 14:10:30
+    - (Makefile.in): make /var/ucd-snmp exist.  We should do a permission
+      set as well.
+
+hardaker 30 Jul 99 14:18:55
+    - (*/Makefile.in): make depend
+
+hardaker 30 Jul 99 14:19:21
+    - (version.h bug-report sedscript.in): version tag ( 4.0.pre5 )
+
+mslifcak  2 Aug 99 04:29:35
+    asn1, parse) fixes supplied by Markku Laukkanen (MJS-use xcalloc in parse)
+
+mslifcak  2 Aug 99 04:37:46
+    parse - shame on me for not compile testing first!
+
+mslifcak  2 Aug 99 22:29:37
+    snmp_debug - DEBUGMSG macros call snmp_get_do_debugging before invoking debugmsg* functions.
+
+mslifcak  3 Aug 99 04:46:41
+    snmp_api.c - remove "BY" from HAVE_GETHOSTBYNAME (Solaris 2.5.1 wrong!)
+
+mslifcak  3 Aug 99 06:59:50
+    asn1.c - fix out-of-bound array write and memory leak in parsing strings.
+
+mslifcak  3 Aug 99 07:00:16
+    snmp_debug.c - remove trace messages from debugmsg_hextli.
+
+mslifcak  3 Aug 99 07:03:14
+    snmp_debug.h - move DEBUGTRACE from debugmsg_hextli to DEBUGDUMPSETUP
+
+mslifcak  3 Aug 99 07:58:49
+    vacm_vars.c - copy community string, null terminate, then debug print
+
+mslifcak  3 Aug 99 12:53:32
+    snmp_debug.h - fix "warning: ANSI C forbids conditional expr with only one void side".
+
+mslifcak  3 Aug 99 14:06:33
+    snmp_debug.c - signed comparison for len in debugmsg_hextli.
+
+mslifcak  4 Aug 99 03:48:02
+    -(smux.c) - patch supplied by Nick Amato to fix ASN_IPADDRESS parse.
+
+mslifcak  4 Aug 99 05:03:11
+    undo patch around Solaris' configure failure to register HAVE_GETHOSTBYNAME.
+
+mslifcak  4 Aug 99 09:17:18
+    -(configure*) - Ken Hornstein: fix test xxgethostbyname, xxgetservbyname.
+
+mslifcak  4 Aug 99 12:33:56
+    snmp_api.c - dummy functions snmp_synch_{setup,reset} and snmp_get_errno.
+
+mslifcak  5 Aug 99 03:25:55
+    config.sub - patch from Markku Laukkanen to support HPUX 11
+
+mslifcak  5 Aug 99 11:11:53
+    snmp_api.3 - describe snmp_error(), replaces snmp_errno and snmp_get_errno()
+
+daves  6 Aug 99 05:59:46
+    - (acconfig.h config.h.in configure.in configure):
+      - configure-time flag to control provision of "dummy" values
+
+daves  6 Aug 99 06:02:15
+    - (mibII/*.c host/*.c): Don't provide "dummy" values (unless explicitly configured)
+
+nba  9 Aug 99 00:24:37
+    parse.c:	parse agent capabilities
+
+daves  9 Aug 99 01:02:15
+    - (FAQ): Nine new questions, plus assorted tweaks for the new release.
+
+mslifcak  9 Aug 99 06:48:47
+    mib.*, parse.* - move print_oid_report and minions wholly into mib.c
+
+mslifcak  9 Aug 99 06:50:36
+     snmpdelta, translate, trapd) - list all options in usage; remove disables for print_oid_report in translate.
+
+mslifcak  9 Aug 99 06:52:47
+    snmpd.c - list all options in usage
+
+mslifcak  9 Aug 99 06:54:01
+    libsnmp.def - remove print_oid_report disable options
+
+mslifcak  9 Aug 99 09:45:15
+    -(snmp.c) fix buffer overflow in xdump, of all places (77 s/b 78; using 80)
+
+nba  9 Aug 99 10:43:28
+    (many):	nuke various prototype warnings
+
+mslifcak  9 Aug 99 11:40:25
+    -(md5.c) fix read past end problem
+    -(snmp_api.c) fix losing community string problem
+
+hardaker  9 Aug 99 13:12:35
+    - (acconfig.h, config.h.in, configure, configure.in): remove /dev/random test.
+
+mslifcak  9 Aug 99 15:07:24
+    snmpusm.c - always clear field_len if ref is valid ptr;
+    snmp_api.c - don't overwrite community pointer with securityAuthProto pointer
+
+nba 10 Aug 99 04:45:17
+    configure.in config.h.in configure s/netbsd agent/mibgroup/host/hr_storage.c:
+    	support for NetBSD/sparc and NetBSD 1.4
+
+nba 10 Aug 99 04:46:35
+    snmplib/mib.c:	fix handling of numeric oids and reporting errors
+
+nba 10 Aug 99 04:47:22
+    agent/kernel.c:	abort on kvm_open failures
+
+nba 10 Aug 99 04:48:41
+    snmpnetstat/if.c:	fixes for snmpnetstat -i on virtual interfaces
+
+nba 10 Aug 99 04:50:52
+    interfaces.c var_route.c snmp_logging.c: fix compiler warnings
+
+mslifcak 10 Aug 99 09:19:10
+    read_config.c, snmp_api.c - convert fprintf(stderr to snmp_log(LOG_ERR,WARNING)
+
+mslifcak 10 Aug 99 10:04:40
+    Fix for build (no pagesize var defined for linux).
+
+hardaker 10 Aug 99 11:05:38
+    - (snmpd.c): log version number after stderr is optionally closed.
+
+hardaker 10 Aug 99 14:26:33
+    - (snmp_vars.c): protect against evil mib modules from modifying
+      memory they shouldn't be modifying yet.
+      - (ifdef'ed for speed profiling later).
+
+hardaker 10 Aug 99 15:54:33
+    - (snmp_parse_args.c): force v3 engineID setting to something bogus to
+      get around local configuration data store time synchronization conflicts.
+
+hardaker 10 Aug 99 17:23:59
+    - (snmpd.c): print -H usage to stderr.
+
+hardaker 11 Aug 99 13:04:50
+    - (acconfig.h, config.h.in, read_config.c):
+      - Make persistent cache conform to a more secure umask.
+
+nba 11 Aug 99 21:52:26
+    hr_storage.c:	remove to forgotten debug lines.
+
+nba 11 Aug 99 21:53:31
+    snmpnetstat/if.c:	handle non-contiguous ifTable. Also make the
+    	counters unsigned.
+
+hardaker 12 Aug 99 16:16:01
+    - (snmp.conf.5.def): updated with the newer token list.
+
+hardaker 12 Aug 99 16:41:22
+    - (FAQ, snmpcmd.1, snmptrap.1): minor doc updates.
+
+hardaker 12 Aug 99 16:46:34
+    - (NEWS, README): minor updates.
+
+daves 13 Aug 99 02:47:00
+    - (examples/ucdDemoPublic.[ch]
+       ipfwchains/ipfwchains.[ch] misc/ipfwacc.[ch]
+       target/snmpTarget{Addr,Params}Entry.[ch]
+       smux/snmp_*.[ch]):
+       - Register modules dynamically at run-time
+
+hardaker 13 Aug 99 07:11:35
+    - (Makefile.in): "make test" in top level Makefile.
+
+hardaker 13 Aug 99 07:12:18
+    - (NEWS, README.snmpv3, configure, configure.in): documentation updates.
+
+hardaker 13 Aug 99 07:16:51
+    - (Makefile.in, Makefile.in, Makefile.in, Makefile.in): make depend.
+
+hardaker 13 Aug 99 09:33:40
+    - (configure, configure.in): don't use NO_DUMMY_VALUES by default.
+
+mslifcak 13 Aug 99 11:14:39
+    (host/hr_device.c,host/hr_print.c, host/hr_proc.c,host/hr_storage.c,
+    host/hr_swinst.c,host/hr_swrun.c, host/hr_system.c,mibII/at.c,
+    mibII/interfaces.c,mibII/ip.c, mibII/system_mib.c,mibII/tcp.c,
+    mibII/udp.c,mibII/var_route.c) - #if NO_DUMMY_VALUES (help out configure)
+
+hardaker 13 Aug 99 11:55:31
+    - (var_route.c): don't do caching for NO_DUMMY_VALUES.
+
+mslifcak 13 Aug 99 12:18:17
+    var_route.c - #ifdef NO_DUMMY --> #if NO_DUMMY (like the other uses).
+
+hardaker 13 Aug 99 12:49:35
+    - (configure, configure.in): properly do what --without-dummy-values
+      should do.
+
+hardaker 13 Aug 99 15:22:53
+    - (configure, configure.in): remove config_load_mib parsing.
+
+hardaker 13 Aug 99 15:35:54
+    - (Makefile.in): don't remove mib_module_loads.h.
+
+hardaker 13 Aug 99 16:05:42
+    - (remove-files): remove the ISSUES file for releases.
+
+hardaker 13 Aug 99 16:06:51
+    - (version.h bug-report sedscript.in): version tag ( 4.0.pre6 )
+
+nba 16 Aug 99 14:58:40
+    snmpnetstat/if.c: allow -i and -o outputs even with incomplete responses
+    	from snmpd (such as Linux that does not return ifInNUCastPkts
+    	with the new DUMMY setup)
+
+nba 16 Aug 99 14:59:29
+    snmpnetstat/main.c: enable_stderrlog() so that we get an error message
+    	for bad host names.
+
+nba 18 Aug 99 02:40:48
+    agent/snmpd.c:	move the termination processing from the signal handler
+    	to after the main loop has terminated.
+
+nba 18 Aug 99 02:51:57
+    - snmpd.c, agent_read_config.?, versioninfo.c: move the reconfiguration
+    	outside the signal handler.
+
+nba 18 Aug 99 09:26:35
+    - interfaces.?: updates for Linux to handle large counters and virtual
+    	interfaces.
+
+nba 18 Aug 99 09:31:06
+    - (many):	change the names of the logging functions to be snmp_*
+    	default do_stderr_logging to 1.
+
+nba 19 Aug 99 02:33:56
+    - interfaces.c: remove some left over debug output
+
+nba 19 Aug 99 02:35:10
+    - snmp_logging.c, agent/various: reinstate -a and -V logging (almost).
+    	timestamp file and stderr logging.
+
+nba 19 Aug 99 10:38:02
+    - snmp_api.c:	correcly call pre-parse hook, also when not debugging
+    	(this killed the libwrap check in snmpd)
+
+nba 19 Aug 99 10:38:48
+    - smux.c: remove some extraneous \n from snmp_log_perror calls.
+
+nba 19 Aug 99 10:40:22
+    - snmpd.c: remove some superfluous : from snmp_log_perror.
+    	Log when snmpd reconfigures following a SIGHUP
+
+nba 19 Aug 99 14:09:25
+    - snmp_api.?, snmpd.c, snmptrap.c, snmptrapd.c: reinstate agent_addr in
+    	the pdu structure (used for v1 traps).
+
+hardaker 19 Aug 99 16:09:54
+    - (snmpget.c, snmpgetnext.c, snmpset.c): Patch from dlengel@home.com:
+      - check argument count for minimum number.
+
+nba 20 Aug 99 03:43:37
+    - agentx/*: various prototype fixes, to keep number of warnings down
+
+hardaker 20 Aug 99 13:43:56
+    - (default_store.h, snmp_api.c, snmp_logging.c, snmp_logging.h):
+      - make logging of timestamps optional by a snmp.conf directive.
+
+hardaker 20 Aug 99 13:56:57
+    - (snmp.conf.5.def, default_store.h, snmp_logging.c):
+      - turn off time stamp logging by default.  It must be explicitly
+        requested in the snmp.conf file to turn it on.
+        (the reason is that a lot of logging is incremental in nature and
+        is not line buffered before being sent to the logging routines.
+        The other solution is to have the logging routines detect when to
+        print timestamps by watching out for \n's.  But, not this round.
+
+hardaker 20 Aug 99 16:39:21
+    - (snmp_api.h, snmp_api.c, snmp_auth.c, snmp_impl.h, asn1.c): 64bit cleanup.
+
+hardaker 20 Aug 99 17:08:17
+    - (NEWS): last minute changes
+
+hardaker 20 Aug 99 17:10:26
+    - (version.h bug-report sedscript.in): version tag ( 4.0.pre7 )
+
+hardaker 22 Aug 99 17:33:00
+    - (ipfchains): removed from distribution.  Newer one in ftp's contrib dir.
+
+hardaker 22 Aug 99 17:54:57
+    - (configure, configure.in):
+      - --without-dummy-values is default again.
+      - cleanup of --help stuff.
+      - fix of peristent directory creation.
+
+hardaker 22 Aug 99 17:56:27
+    - (Makefile.in, Makefile.in): make depend.
+
+hardaker 22 Aug 99 17:57:27
+    - (snmp_api.h): version -> u_long.
+
+mslifcak 23 Aug 99 06:14:39
+    Remove last vestiges of config_load_mib
+
+hardaker 23 Aug 99 07:02:43
+    - (NEWS): ansi mentioned.
+
+mslifcak 23 Aug 99 09:00:59
+    Win32 build fixes
+
+nba 23 Aug 99 13:54:32
+    - agent/snmpd.c, agent/snmp_vars.c: move some -v logging to a more rational
+    	place.
+
+mslifcak 23 Aug 99 14:02:51
+    Describe USE_ASN_SHORT_LEN in FAQ, and implement in _snmp_build.
+
+mslifcak 23 Aug 99 15:32:21
+    HACK! fixup short length (first put correct community string in pdu-> ).
+
+hardaker 23 Aug 99 16:14:00
+    - (T028snmpv3getfail): snmpv3 get failure test.
+
+hardaker 23 Aug 99 16:14:00
+    - (INSTALL): remove version specific information
+
+-------------------------------------------------------------------------------
+
+Changes: V3.6.1 -> V3.6.2
+
+hardaker 16 Mar 99 08:15:18
+    - (dlmod.c): removed a bogus new-line.
+
+hardaker 16 Mar 99 10:34:03
+    - (hr_swrun.c): fix file descriptor leak on freebsd.
+
+mslifcak 16 Mar 99 11:23:30
+    -(snmp_api.c) consistent error return.
+
+mslifcak 16 Mar 99 11:33:52
+    - move MATCH_FAILED/MATCH_SUCCEEDED from util_funcs.h to mibincl.h
+
+mslifcak 17 Mar 99 13:53:48
+    -(hr_swrun.c) - prevent SunOS 4.1 core (sunos4 still primitive)
+
+mslifcak 18 Mar 99 08:37:45
+    - (mibII/ip.c) fix MIB_IPCOUNTER_SYMBOL usage
+
+hardaker 19 Mar 99 09:23:38
+    - (snmpget.c, snmpwalk.c): fixed initialization and usage of "failures".
+
+hardaker 23 Mar 99 10:09:47
+    - (Makefile.in): add more targets.
+
+hardaker 23 Mar 99 10:10:11
+    - (read_config.c): make copy_word() return the next token, not the
+      next space.
+
+hardaker 23 Mar 99 10:11:03
+    - (mibdefs.h, struct.h, extensible.c, extensible.h, proc.c, proc.h,
+      snmpd.conf.5.def, UCD-SNMP-MIB.txt):
+      - per-process/exec fix scripts created.
+
+hardaker 23 Mar 99 10:23:21
+    - (versiontag): regexp fix.
+
+hardaker 28 Mar 99 16:11:32
+    - (snmpTargetAddrEntry.h, snmpTargetParamsEntry.h): relocate to
+      snmpModules.12, where they should be.
+
+hardaker 28 Mar 99 16:17:24
+    - (snmpTargetAddrEntry.c, snmpTargetParamsEntry.c):
+      - when using copy_word() don't skip spaces, since it does that.
+
+mslifcak  1 Apr 99 13:10:47
+    - (libsnmp.h) Asymptotically closer to supporting CMU constants.
+
+mslifcak  5 Apr 99 11:06:27
+    - (snmp_api.c, main.c, snmp_parse_args.c) Joe Marzot's fix to copy even an empty community name.
+
+mslifcak  5 Apr 99 14:10:14
+    - build snmpnetstat with CygWin32
+
+mslifcak  5 Apr 99 14:22:43
+    - Build with CygWin32
+
+mslifcak  5 Apr 99 15:59:20
+    - Build using CygWin32 (includes Niels B.'s snmp_vars.c patch).
+
+hardaker  6 Apr 99 09:23:16
+    - (config.guess, config.sub): new versions from autoconf 2.13.
+
+mslifcak  6 Apr 99 10:59:05
+    - (extensible.c) quell warning about comparing pointer with non-pointer.
+
+mslifcak  6 Apr 99 11:33:54
+    - another round of ANSI-fying the agent completed.
+
+hardaker  6 Apr 99 15:13:40
+    - (*): Merged the 4.0 line into the 3.6.1 line.
+
+hardaker  6 Apr 99 15:38:45
+    - (mibincl.h, ucdDemoPublic.c, vacm_vars.h, snmptrapd.c, snmp_api.c,
+      Makefile.in): final merge pieces of recent v3 line changes.
+
+mslifcak  6 Apr 99 21:24:22
+    - changes for ANSI headers; POSIX(index vs strchr); minor fixes
+
+mslifcak  6 Apr 99 22:13:59
+    - (vacm_vars.c) - set global ptrs = 0.
+
+mslifcak  6 Apr 99 22:14:43
+    - (snmp_vars.c) more v2party rework needed
+
+mslifcak  7 Apr 99 06:17:28
+    - () more ANSI header fixups; touchup for M$ Win32 build
+
+hardaker  7 Apr 99 10:42:10
+    - (config.h.in, snmp_vars.c, encode_keychange.c, snmptrapd.c,
+      Makefile.in, all_general_local.h, keytools.c, keytools.h,
+      lcd_time.c, md5.c, read_config.c, scapi.c, snmp_api.c, snmpusm.c,
+      snmpv3.c, tools.c, tools.h):
+      - misc merging, including fixes and debugging statement changes to
+        newer model.
+      - a few -Wall fixes.
+
+hardaker  7 Apr 99 10:48:07
+    - (snmp_mib.c): removed unnneeded header_snmp().
+
+hardaker  7 Apr 99 11:28:02
+    - (ucdDemoPublic.c, sysORTable.c, vacm_vars.c, smux.c, snmpEngine.c,
+      usmUser.c, snmpTargetAddrEntry.c, snmpTargetParamsEntry.c):
+      - debugging statement conversion
+
+mslifcak  7 Apr 99 12:00:20
+    - (agent/snmp2p.c agent/snmp_agent.c agent/snmp_vars.h
+    agent/view_parse.c agent/mibgroup/util_funcs.c
+    agent/mibgroup/examples/ucdDemoPublic.c
+    agent/mibgroup/host/hr_filesys.c
+    agent/mibgroup/host/hr_storage.c
+    agent/mibgroup/host/hr_swrun.c agent/mibgroup/host/hr_system.c
+    agent/mibgroup/mibII/at.c agent/mibgroup/mibII/icmp.c
+    agent/mibgroup/mibII/interfaces.c agent/mibgroup/mibII/ip.c
+    agent/mibgroup/mibII/system_mib.c agent/mibgroup/mibII/tcp.c
+    agent/mibgroup/mibII/udp.c agent/mibgroup/mibII/vacm_vars.c
+    agent/mibgroup/mibII/var_route.c agent/mibgroup/misc/ipfwacc.c
+    agent/mibgroup/snmpv3/usmUser.c
+    agent/mibgroup/ucd-snmp/extensible.c
+    agent/mibgroup/ucd-snmp/hpux.c agent/mibgroup/ucd-snmp/pass.c
+    agent/mibgroup/ucd-snmp/pass_persist.c
+    agent/mibgroup/ucd-snmp/proc.c
+    agent/mibgroup/v2party/context_vars.c
+    agent/mibgroup/v2party/party_vars.c
+    agent/mibgroup/v2party/view_vars.c apps/snmpdelta.c
+    apps/snmptest.c apps/snmptrapd.c apps/snmpnetstat/route.c
+    apps/snmpnetstat/winstub.c snmplib/acl_parse.c
+    snmplib/context.h snmplib/context_parse.c snmplib/party.h
+    snmplib/party_parse.c snmplib/read_config.c snmplib/snmp_api.c
+    snmplib/snmp_auth.c snmplib/snmp_impl.h snmplib/vacm.h
+    snmplib/view.h)  fgets use sizeof mostly, oid base size is MAX_OID_LEN
+
+mslifcak  7 Apr 99 12:17:23
+    -(ipfwchains.c) remove multiple definitions of MATCH_FAILED
+
+mslifcak  7 Apr 99 15:00:39
+    -(usmUser.c,system.c) plug mem leak; (snmp_api.c) enforce array limit.
+
+hardaker 12 Apr 99 22:14:31
+    - (mibincl.h): include sys/time.h.
+
+hardaker 12 Apr 99 22:15:39
+    - (hr_utils.h): remove variable names from prototypes (was causing problems).
+
+hardaker 12 Apr 99 22:16:45
+    - (tkmib): make displayed mib node info into two columns instead of one.
+
+hardaker 12 Apr 99 22:25:09
+    - (snmp_api.c): make snmp_varlist_add_variable to possible create a
+      varlist before adding something to it.
+
+hardaker 13 Apr 99 15:19:20
+    - (configure, configure.in, Makefile.in): Patch from Daniel Hagerty:
+      - fix libwrap to only add the library to the agent.
+
+hardaker 13 Apr 99 15:20:00
+    - (system_mib.c): make sysDescr read-only.
+
+hardaker 13 Apr 99 15:32:23
+    - (pass.c): Patch from Jim Mar:
+      - add capability for binary octet strings in pass scripts.
+
+hardaker 13 Apr 99 15:36:31
+    - (SNMP-NOTIFICATION-MIB.txt, SNMP-PROXY-MIB.txt,
+      SNMP-VIEW-BASED-ACM-MIB.txt): Patch from Niels Baggesen:
+      - fix module locations for broken mibs.
+
+hardaker 13 Apr 99 15:54:48
+    - (freebsd.h, freebsd2.h): Patch from Niels Baggesen:
+      - freebsd utmp cleanups.
+
+hardaker 13 Apr 99 15:56:53
+    - (snmpd.c): Patch from Niels Baggesen:
+      - log with timestamp at shutdown.
+
+hardaker 13 Apr 99 15:57:24
+    - (vacm_vars.c): Patch from Niels Baggesen:
+      - better checking of .conf file parsing line requirements.
+
+hardaker 13 Apr 99 15:58:02
+    - (snmptranslate.c): Patch from Niels Baggesen:
+      - support -P.
+
+hardaker 13 Apr 99 15:58:27
+    - (snmp_config.5.def, snmptrap.1, snmptrapd.conf.5.def): Patch from
+      Niels Baggesen:
+      - clean up small bugs.
+
+hardaker 13 Apr 99 16:00:49
+    - (parse.c, parse.h): Patch from Niels Baggesen:
+      - nicer parser messages (include file names). Correct help for -Pc.
+      - Add FRAME-RELAY-DTE-MIB as replacement for RFC-1315
+
+hardaker 13 Apr 99 16:03:29
+    - (snmptrapd.c): Patch from Niels Baggesen:
+      - snmptrapd option to ignore auth traps, add -S option, log termination.
+
+mslifcak 14 Apr 99 15:29:58
+    - (snmptranslate.c) init_snmp takes argument; "" used.
+
+mslifcak 14 Apr 99 15:30:34
+    - (parse.c) File pointer initialized to "" before first use.
+
+hardaker 14 Apr 99 15:52:35
+    - (snmptranslate.c): init_snmp("snmpapp").
+
+mslifcak 14 Apr 99 16:31:55
+    - (snmp_agent,c, snmp_api.[ch], snmp_client.[ch]) fix variable_list with built-in storage
+
+mslifcak 14 Apr 99 16:56:37
+    - apps that use snmp_fix_pdu must clean up the response PDU !
+
+mslifcak 16 Apr 99 07:30:29
+    - (IPFWACC-MIB.txt) change module name from IPFWADM-MIB to IPFWACC-MIB.
+
+mslifcak 16 Apr 99 07:54:22
+    - (IPFWCHAINS-MIB.txt) ipfwChainTable {ipfw 1} fix
+
+mslifcak 16 Apr 99 08:33:16
+    - (mib.c) "-m" or MIBS : can specify MIB module by file name.
+
+hardaker 16 Apr 99 21:10:06
+    - (README): Added v3 team members.
+
+hardaker 16 Apr 99 21:11:48
+    - (configure.in): changed default store location to /var/ucd-snmp
+
+hardaker 16 Apr 99 21:15:14
+    - (snmp.h): SNMPADMINLENGTH definition.
+
+hardaker 16 Apr 99 21:16:16
+    - (snmp_auth.c): removed fix note.
+
+hardaker 16 Apr 99 21:27:06
+    - (NEWS): updated
+
+hardaker 16 Apr 99 21:27:41
+    - (snmptrapd.8): man patch from Niels
+
+hardaker 16 Apr 99 21:34:49
+    - (version.h bug-report sedscript.in): version tag ( 4.0.pre3 )
+
+mslifcak 18 Apr 99 06:54:26
+    - (ipfwacc.h) subdir change per Joe Pruettt : 9 -> 10
+
+hardaker 19 Apr 99 21:01:15
+    - (mib2c, mib2c.conf, mib2c.vartypes.conf):
+      - rewrote mib2c to be more dependent on .conf files.  The main .conf
+        file now contains the code itself.
+      - need to write a foreach(mibnode) type parser next.
+
+hardaker 19 Apr 99 21:09:27
+    - (mibincl.h): add read_config.h.
+
+hardaker 19 Apr 99 21:12:17
+    - (read_config.c, read_config.h):
+      - created a more convenient read_config_read_data() function to
+        generically read a token into a given variable.
+      - cleaned up persistent storage parsing routines.
+      - use previously malloced space in some routines, or malloc it for
+        them if the storage area is NULL.
+
+hardaker 19 Apr 99 21:14:28
+    - (snmp_api.c): Don't snmp_set_var_objid if name is NULL in
+      snmp_varlist_add_variable().
+
+hardaker 20 Apr 99 11:28:14
+    - (mib2c, mib2c.conf, mib2c.vartypes.conf): more updates.
+
+hardaker 20 Apr 99 15:31:35
+    - (mib2c, mib2c.conf, mib2c.vartypes.conf):
+      - completely re-hacked:
+        - entire code base is now put into the .conf files rather than in
+          the mib2c program.  This should entitle mib2c to be used more
+          generically, and could produce different types of code templates
+          based on the .conf file it is given.  In theory, it should be
+          able to produce C code for a non-ucd-snmp agent, or even better,
+          any type of code (not just C) for something else based on mib
+          information.
+        - The down side, is that the current .conf files are now ambiguous
+          again and difficult to understand without being, well, me.  The
+          up side is that I'm sure Dave Shield will go through and clean
+          it up for me like he did last time.  Ha ha.  I wonder if he'll
+          read this? (If so, see me first).
+
+hardaker 20 Apr 99 16:04:17
+    - (mib2c, mib2c.conf): variable name conversions:
+      - variableTypes -> variables
+      - cname -> NAME
+
+hardaker 20 Apr 99 16:10:44
+    - (mib2c, mib2c.conf): a little more clean up.
+
+hardaker 20 Apr 99 21:38:42
+    - (mib2c.conf): clean up skipif regexps a bit.
+
+hardaker 22 Apr 99 07:54:44
+    - (read_config.c, read_config.h): created *read_config_store_data();
+
+hardaker 22 Apr 99 07:56:03
+    - (mib2c, mib2c.conf): allow NoAccess to be processed, and use skipif:
+      directives where needed because of it.
+
+hardaker 22 Apr 99 10:51:30
+    - (snmp_client.c, snmp_api.c, snmp_api.h, keytools.c): Another v3 branch update.
+
+mslifcak 26 Apr 99 09:21:06
+    - (snmplib.c) - use request callback's data if request specifies a callback.
+
+nba 26 Apr 99 11:21:10
+    
+    (parse.h) Silly speling misteak (ACCESS_CRAETE)
+
+nba 26 Apr 99 11:48:57
+    
+    
+    - snmplib/parse.h, snmplib/parse.c: new mib printer: mib_print_tree
+      inspired by a reference to snmx in comp.protocols.snmp
+    - apps/snmptranslate: let the -p option call this new printer
+    - snmplib/snmp_api.c: some left over __P macros
+
+nba 26 Apr 99 12:03:47
+    
+    (if.c) make the width of snmpnet -i (and -o) adapt to the length of returned
+    	strings
+
+nba 26 Apr 99 12:09:35
+    
+    
+    apps/*.c: use snmp_perror to report errors from read_objid and friends
+    apps/snmptrapd.c: fix a bus error when using -S and receiving an
+    	enterprise specific trap.
+
+nba 26 Apr 99 12:13:50
+    
+    */*: replace horrible (char *)"string" with const specifiers in relevant
+    	functions.
+
+mslifcak 26 Apr 99 12:37:09
+    - (snmp_api.c) - fix other use of request's callback data
+
+mslifcak 27 Apr 99 09:51:35
+    - (interfaces.c) add if_type_from_name to convert interface name to type.
+
+hardaker 29 Apr 99 07:32:39
+    - (Makefile.in, callback.c, callback.h): callback API.
+
+hardaker 29 Apr 99 07:39:45
+    - (agent_read_config.c, snmpd.c, snmptrapd.c, snmp_api.c, snmpusm.c,
+      snmpusm.h, snmpv3.c, snmpv3.h):
+      - use the callback mechanism for post-config stuff.
+
+hardaker  3 May 99 07:07:15
+    - (agent_read_config.c, usmUser.c, usmUser.h, snmpTargetAddrEntry.c,
+      snmpTargetAddrEntry.h, snmpTargetParamsEntry.c,
+      snmpTargetParamsEntry.h, snmptrapd.c, callback.c, callback.h,
+      scapi.c, scapi.h, snmp_api.c, snmpv3.c, snmpv3.h):
+      - shutdown and store callback usage.
+
+hardaker  3 May 99 07:13:31
+    - (snmpd.c): fix -A flag, which got broken during someones changes.
+
+hardaker  3 May 99 12:58:19
+    - (Makefile.in, agent_read_config.c, Makefile.in, header_complex.c,
+      Makefile.in, encode_keychange.c, Makefile.in, Makefile.in,
+      all_general_local.h, all_system.h, keytools.c, lcd_time.c, scapi.c,
+      snmp_auth.c, snmpusm.c, tools.c, tools.h, Makefile.in, T.c,
+      etimetest.c, keymanagetest.c, misctest.c, scapitest.c):
+      - nuked all_general_local.h and all_system.h.
+      - makefileindepend as well.
+
+nba  3 May 99 15:40:11
+    (*.[ch]):	patches to types to wipe warnings from compilers
+    	with more strict noise levels. (also good when compiling
+    	with gcc -Wall -pedantic -Wwrite-strings -Wcast-qual)
+
+nba  4 May 99 00:47:44
+    (mib.c):	Fix problem (core dump) with MIBFILES environment variable.
+
+nba  4 May 99 00:51:16
+    (many):	remove const spec from FindVarMethod. That was wrong
+
+hardaker  4 May 99 11:08:55
+    - (configure, configure.in): Added --enable-developer flag.
+
+mslifcak  6 May 99 09:20:30
+    - (ucd-snmp/vmstat.c) - conditionally include limits.h per Eduard Koucky.
+
+nba 10 May 99 14:47:22
+    Fixing some more prototypes. Pointed out by Markku Laukkanen.
+
+nba 10 May 99 14:49:49
+    snmplib/snmp_api.c: Mix-up of V1_IN_V2/V2_IN_V1 error code when GETBULK
+    	inside V1 session.
+
+hardaker 11 May 99 14:02:48
+    - (util_funcs.c): read returns ssize_t not size_t.
+
+hardaker 11 May 99 14:03:25
+    - (memory.h): remove extern.
+
+hardaker 11 May 99 14:11:40
+    - (hpux.c, hpux.h): int -> size_t conversions.
+
+mslifcak 12 May 99 10:53:23
+    - (snmp_api.c snmp_client.c) call snmp_synch_reset from snmp_sess_close
+
+mslifcak 12 May 99 11:22:16
+    -(parse.c party_parse.c read_config.c) no exit() from library; return error
+
+daves 13 May 99 03:52:19
+    - (ip.c): Properly register IP module group on Free-BSD systems
+              (thanks to Mitchell Tasman)
+
+hardaker 13 May 99 09:09:18
+    - (vacm_vars.c): Set pointers to NULL after freeing them.
+
+mslifcak 14 May 99 06:54:51
+    - (agent/mibgroup/dummy/dummy.c agent/mibgroup/examples/example.c
+     agent/mibgroup/examples/example.h
+     agent/mibgroup/examples/wombat.c agent/mibgroup/misc/ipfwacc.c
+     agent/mibgroup/smux/smux.c
+     agent/mibgroup/snmpv3/snmpMPDStats.c
+     agent/mibgroup/snmpv3/usmStats.c
+     agent/mibgroup/snmpv3/usmUser.c snmplib/snmp_auth.c) more size_t fixes
+
+mslifcak 14 May 99 09:47:10
+    - (agent/mibgroup/examples/wombat.h agent/mibgroup/host/hr_disk.c
+     agent/mibgroup/mibII/interfaces.c
+     agent/mibgroup/mibII/var_route.c
+     agent/mibgroup/snmpv3/usmUser.c apps/encode_keychange.c
+     snmplib/parse.c) more ANSI-C touchups
+
+mslifcak 14 May 99 13:59:37
+    -(agent/mibgroup/mibII/interfaces.c snmplib/snmpusm.c) fixes to build HP & AIX
+
+daves 17 May 99 03:20:53
+    - (snmp_parse_args.c): Initialise session using library routine
+
+daves 17 May 99 04:34:55
+    - (snmplib/snmp_api.h snmplib/snmp_api.c snmplib/snmp_client.c
+       agent/snmpd.c agent/mibgroup/mibII/vacm_vars.c
+       agent/mibgroup/v2party/alarm.c agent/mibgroup/v2party/event.c
+       apps/snmpstatus.c apps/snmptest.c apps/snmptrap.c apps/snmptrapd.c):
+    
+      - Use the generic socket addresses 'struct sockaddr',
+        rather than the IP-specific 'struct sockaddr_in'
+
+daves 17 May 99 04:38:00
+    - (snmplib/snmp_api.h snmplib/snmp_api.c snmplib/snmp_client.c
+       agent/snmpd.c agent/mibgroup/mibII/vacm_vars.c
+       agent/mibgroup/v2party/alarm.c agent/mibgroup/v2party/event.c
+       apps/snmpstatus.c apps/snmptest.c apps/snmptrap.c apps/snmptrapd.c):
+    
+      - Use the generic socket address 'struct sockaddr',
+        rather than the IP-specific 'struct sockaddr_in'
+
+daves 17 May 99 07:18:02
+    - (snmplib/snmp_api.c snmplib/snmp_api.h agent/snmpd.c
+       apps/snmptrap.c apps/snmptrapd.c):
+    
+      - Use a single address field within the PDU structure
+                   (obsoleting 'agent_addr')
+
+daves 18 May 99 06:26:16
+    - (snmp_api.c snmp_api.h): More general handling of PDU flags
+
+mslifcak 18 May 99 09:01:46
+    - (xx/Makefile.in) remove references to as yet missing disman files.
+
+daves 18 May 99 09:23:50
+    - (configure.in snmplib/context_parse.c snmplib/read_config.c
+       snmplib/snmp_api.c snmplib/snmpv3.c snmplib/system.c
+       apps/snmp_parse_args.c apps/snmpbulkwalk.c apps/snmpdelta.c
+       apps/snmpget.c apps/snmpgetnext.c apps/snmpset.c
+       apps/snmpstatus.c apps/snmptable.c apps/snmptest.c
+       apps/snmptrap.c apps/snmpusm.c apps/snmpwalk.c
+       apps/snmpnetstat/if.c apps/snmpnetstat/inet.c
+       apps/snmpnetstat/main.c apps/snmpnetstat/route.c
+       apps/snmpnetstat/winstub.c):
+       -  Clean up conditionals protecting include files
+            ( #if HAVE_WINSOCK_H / #else / #endif )
+
+daves 19 May 99 02:33:07
+    - (config.h.in): Additional include protection entries
+
+daves 19 May 99 05:11:37
+    - (snmp_api.c): More generalised handling of socket addresses
+
+mslifcak 19 May 99 18:02:55
+    -(mibII/var_route.c) - fix Linux RouteMask c/o "Nancy" nam@cs.cmu.edu
+
+mslifcak 19 May 99 18:50:12
+    - (host_res.h) fix HAVE_NET_IF_VAR_H define (was HAVE_NET_IN_VAR_H)
+
+daves 20 May 99 03:46:24
+    - (snmp_api.h): Temporary fix to socket address problems
+
+mslifcak 21 May 99 05:24:23
+    -(read_config.c) cast fix per Markku Laukkanen
+
+daves 21 May 99 05:54:22
+    - (snmp_api.c snmp_api.h):
+      -  New API call to close down all open sessions
+         (also called on application shutdown)
+
+hardaker 21 May 99 11:10:44
+    - (mib2c.conf, mib2c.storage.conf):
+      - convert to size_t storages.
+      - misc eval fixes.
+      - more cleanup of the storage def.
+
+mslifcak 21 May 99 15:29:46
+    - library changes to build on Win32.
+
+mslifcak 24 May 99 05:36:13
+    -configure - save one which looks for netdb/socket headers
+
+hardaker 26 May 99 11:19:03
+    - (ipfwacc.h): properly locate the mib.
+
+hardaker 26 May 99 15:14:55
+    - (hr_swinst.c): make software application type unknown instead of app.
+
+hardaker 26 May 99 15:18:04
+    - (IPFWACC-MIB.txt): change to counters.
+
+hardaker 26 May 99 15:20:32
+    - (ipfwacc.h): make into counters.
+
+hardaker 26 May 99 15:56:03
+    - (acconfig.h, config.h.in): increase MAXREADCOUNT.
+
+hardaker 26 May 99 17:40:28
+    - (IPFWACC-MIB.txt): added SEQUENCE OF.
+
+mslifcak 27 May 99 05:16:25
+    -(encode_keychange, read_config, snmpusm) aCC fixes by PKY (Markku Laukkanen)
+
+hardaker 27 May 99 14:30:03
+    - (snmptrapd_handlers.c): implement the default trap handler.
+
+hardaker 27 May 99 14:30:15
+    - (snmptrapd.c): need an init_mib().
+
+hardaker 27 May 99 14:37:06
+    - (snmptrapd.conf.5.def): document default oid keyword.
+
+hardaker 27 May 99 14:37:32
+    - (snmptrapd.c): document default oid keyword in help line.
+
+daves 28 May 99 07:02:01
+    - (agent/Makefile.in agent/mibgroup/Makefile.in): fix problem with null macro
+
+daves 28 May 99 08:14:05
+    - (snmplib/snmp_api.c): save local socket address in internal session structure
+
+daves 28 May 99 08:57:19
+    - (snmplib/snmp_api.c): Unix domain (datagram) socket support
+
+daves 28 May 99 09:12:20
+    - (snmplib/snmp_api.c): Separate out copying a session and opening a new one
+
+mslifcak 28 May 99 09:24:56
+    -(snmp_api.c) -catch one more error close from snmp_sess_copy
+
+hardaker 28 May 99 16:17:13
+    - (mib.c, parse.c, parse.h): save and use index clauses.
+
+hardaker 28 May 99 16:44:42
+    - (Makefile.in, default_store.c, default_store.h):
+      - created generic default value storage space and parsers to reduce
+        the number of functions/etc created for values which configure the
+        library.
+
+daves  1 Jun 99 02:17:27
+    - (snmplib/snmp_api.c): Garbage collection for Traditional SAPI sessions
+
+daves  1 Jun 99 02:32:13
+    - (snmplib/snmp_api.c): Generalise handling of addresses (w.r.t sento/recvfrom)
+
+daves  1 Jun 99 07:30:42
+    - (snmplib/snmp_api.c snmplib/snmp_api.h): Support for stream-based sockets
+
+hardaker  1 Jun 99 17:21:53
+    - (Makefile.in, snmp_alarm.c, snmp_alarm.h, snmp_api.c):
+      - implemented a generic alarm handler to register alarm functions to
+        be called back after X period of time and it handles figuring out
+        which is next and calling alarm() and signal() appropriately.
+
+mslifcak  4 Jun 99 09:51:13
+    -(hr_filesys.c,interfaces.c,tcp.c,udp.c,freebsd3.h) fix FreeBSD3.1 incl Ken Key's tcp/udp patches
+
+mslifcak  7 Jun 99 07:44:06
+    -(interfaces.c, tcp.c, udp.c, ip.c) clone fixes from 3.6 line (FreeBSD3.1)
+
+mslifcak  7 Jun 99 13:04:21
+    -(if.c) check for valid pointer before de-referencing.
+
+mslifcak 11 May 99 14:39:58
+    - (agent/agent_read_config.c agent/snmp_vars.c agent/snmpd.c
+       agent/mibgroup/mibII/interfaces.c agent/mibgroup/mibII/ip.c
+       agent/mibgroup/mibII/vacm_vars.c
+       agent/mibgroup/mibII/vacm_vars.h apps/snmptranslate.c
+       apps/snmptrapd.c local/mib2c local/tkmib man/snmp_config.5.def
+       man/snmpd.1.def man/snmptrap.1 man/snmptrapd.8
+       man/snmptrapd.conf.5.def mibs/SNMP-NOTIFICATION-MIB.txt
+       mibs/SNMP-PROXY-MIB.txt mibs/SNMP-TARGET-MIB.txt
+       mibs/SNMP-USER-BASED-SM-MIB.txt
+       mibs/SNMP-VIEW-BASED-ACM-MIB.txt s/freebsd.h s/freebsd2.h
+       snmplib/mib.c snmplib/parse.c snmplib/parse.h
+       snmplib/snmp_api.c snmplib/vacm.c) - changes c/o Niels Baggesen
+
+mslifcak 11 May 99 18:58:37
+    -(cygwin.h) - use to build on CygWin platform.
+
+mslifcak 11 May 99 19:54:04
+    -(agent/snmp2p.c agent/snmp_vars.h agent/view_parse.c
+       agent/mibgroup/util_funcs.c agent/mibgroup/dummy/dummy.h
+       agent/mibgroup/examples/wombat.h
+       agent/mibgroup/host/hr_filesys.c
+       agent/mibgroup/host/hr_storage.c
+       agent/mibgroup/host/hr_swrun.c agent/mibgroup/host/hr_system.c
+       agent/mibgroup/ipfwchains/ipfwchains.c
+       agent/mibgroup/mibII/at.c agent/mibgroup/mibII/icmp.c
+       agent/mibgroup/mibII/interfaces.c
+       agent/mibgroup/mibII/system_mib.c agent/mibgroup/mibII/tcp.c
+       agent/mibgroup/mibII/udp.c agent/mibgroup/mibII/vacm_vars.c
+       agent/mibgroup/mibII/var_route.c agent/mibgroup/misc/ipfwacc.c
+       agent/mibgroup/misc/ipfwacc.h
+       agent/mibgroup/ucd-snmp/extensible.c
+       agent/mibgroup/ucd-snmp/hpux.c
+       agent/mibgroup/ucd-snmp/loadave.c
+       agent/mibgroup/ucd-snmp/pass.c
+       agent/mibgroup/ucd-snmp/pass_persist.c
+       agent/mibgroup/ucd-snmp/proc.c
+       agent/mibgroup/v2party/context_vars.c
+       agent/mibgroup/v2party/party_vars.c
+       agent/mibgroup/v2party/view_vars.c apps/snmpdelta.c
+       apps/snmptest.c apps/snmptrapd.c apps/snmpnetstat/if.c
+       apps/snmpnetstat/route.c apps/snmpnetstat/winstub.c
+       apps/snmpnetstat/winstub.h snmplib/acl_parse.c
+       snmplib/context.h snmplib/context_parse.c snmplib/party.h
+       snmplib/party_parse.c snmplib/read_config.c snmplib/snmp_api.c)
+      Port some of the fixes from the current development branch
+
+mslifcak 12 May 99 10:45:05
+    - (snmp_api.c snmp_client.c) call snmp_synch_reset from snmp_sess_close
+
+mslifcak 12 May 99 11:28:07
+    -(mib.c parse.c party_parse.c read_config.c) no exit() from library; return error
+
+daves 13 May 99 03:38:03
+    
+    (mib.c): Fixed minor typo
+
+daves 13 May 99 03:55:06
+    - (ip.c): Properly register IP module group on Free-BSD systems
+              (thanks to Mitchell Tasman)
+
+hardaker 13 May 99 09:07:13
+    - (vmstat.c): include limits.h.
+
+hardaker 13 May 99 09:07:39
+    - (vacm_vars.c): Set pointers to NULL after freeing them.
+
+hardaker 13 May 99 15:42:48
+    - (version.h bug-report sedscript.in): version tag ( 3.6.2 )
+
+daves 17 May 99 03:20:10
+    - (snmp_parse_args.c): Initialise session using library routine
+
+mslifcak 19 May 99 18:01:48
+    -(mibII/var_route.c) - fix Linux RouteMask c/o "Nancy" nam@cs.cmu.edu
+
+mslifcak 19 May 99 18:49:25
+    - (host_res.h) fix HAVE_NET_IF_VAR_H define (was HAVE_NET_IN_VAR_H)
+
+hardaker 25 May 99 20:20:31
+    - (version.h bug-report sedscript.in): version tag ( 3.6.2.pre1 )
+
+nba 26 May 99 07:57:42
+    
+      Tag: V3-line
+    
+    if.c: dynamic width for -i and -o option
+
+mslifcak 26 May 99 08:00:07
+    - fix-ups to build Win32 MSVisualC++
+
+nba 26 May 99 08:24:35
+    
+    
+    Some fixes for Solaris 2.7 (proc access still does not work when compiled
+    with gcc (32-bit compiler)
+
+nba 26 May 99 08:29:26
+    
+    Fixes for FreeBSD 2.1 from Derek J. Balling <dballing@yahoo-inc.com>
+
+hardaker 26 May 99 16:07:16
+    - (acconfig.h, config.h.in): increase MAXREADCOUNT.
+
+hardaker 26 May 99 16:07:42
+    - (hr_swinst.c): make swinstall be "unknown" since we can't truly know.
+
+hardaker 26 May 99 16:08:09
+    - (ipfwacc.h): move to correct location.
+
+hardaker 26 May 99 16:08:28
+    - (IPFWACC-MIB.txt): make counters.
+
+hardaker 26 May 99 17:31:25
+    - (proc.c): ultrix fixes.
+
+hardaker 26 May 99 17:38:56
+    - (IPFWACC-MIB.txt): added SEQUENCE OF.
+
+nba 27 May 99 02:56:25
+    
+    
+    host/hr_swrun.c, ucd-snmp/proc.c: Fixes for Solaris 2.7
+
+nba 27 May 99 02:59:16
+    
+    snmpd.c:	Properly handle the case of no community specified
+    	for agent traps.
+
+nba 27 May 99 23:55:09
+    
+    solaris2.?.h:	define _SLASH_PROC_METHOD_ as 1
+
+nba 27 May 99 23:55:49
+    
+    read_config.c:	complain about existing but unreadable config files.
+
+nba 27 May 99 23:59:37
+    
+    inet.c:	0 IS a valid short (and port address for remote ends of ports
+    	in LISTEN state)
+
+nba 28 May 99 03:25:29
+    
+    change the trapsink/trap2sink directives to support a community parameter.
+
+nba 29 May 99 02:49:47
+    
+    - smux.c: fix a missing ntohs in a debug message
+
+nba  1 Jun 99 00:27:36
+    
+    - proc.c: YAPBO (Yet another possible buffer overflow)
+
+nba  1 Jun 99 00:29:35
+    
+    - snmp_agent.c: change noCreation return to noAccess. There are probably
+    	situations where the former is correct, but this is less confusing
+
+nba  1 Jun 99 00:33:52
+    
+    - kernel_sunos5.?, hr_swrun.c, at.c, interfaces.c: fix at.atTable and
+    	ip.ipNetToMediaTable for Solaris. Also a tweak for getKstatInt.
+
+hardaker  2 Jun 99 07:27:46
+    - (version.h bug-report sedscript.in): version tag ( 3.6.2.pre2 )
+
+mslifcak  2 Jun 99 13:46:34
+    -(hr_filesys.c,interfaces.c,freebsd3.h) fix build on FreeBSD 3.1
+
+nba  3 Jun 99 14:31:18
+    
+    - kernel.c:	add some sanity checks when running without root access.
+
+nba  3 Jun 99 14:34:50
+    
+    - hr_swrun.c:	add a blank between process parameters
+
+nba  3 Jun 99 14:38:18
+    
+    - netbsd.h, tcp.c, udp.c:	fix socket tables for NetBSD 1.3/1.4
+
+nba  3 Jun 99 15:12:01
+    
+    - snmptrap.c: fix a bad free when calling snmpinform.
+
+nba  3 Jun 99 15:21:09
+    - tcp.c: lost a ';' for the FreeBSD case ....
+
+daves  4 Jun 99 04:51:04
+    - (agent/mibgroup/host/hr_swinst.c): Fix RPM handling
+
+daves  4 Jun 99 05:06:44
+    - (configure.in configure): Additional library for RPM handling
+
+mslifcak  4 Jun 99 09:30:12
+    -(tcp.c, udp.c) apply Ken Key's fix for FreeBSD3.1
+
+nba  4 Jun 99 11:52:38
+    - ip.c: Fix for FreeBSD 3 from Ken Key
+
+nba  4 Jun 99 11:53:32
+    - kernel_sunos5.c, asn1.c: Fixes for 64-bit Solaris 7
+
+nba  5 Jun 99 05:47:20
+    - interfaces.c,tcp.c,udp.c: cleanup of conditionals for FreeBSD
+
+nba  5 Jun 99 06:02:52
+    - configure.in: proper configure check for sys/socketvar.h
+
+mslifcak  7 Jun 99 07:45:10
+    -(ip.c, var_route.c) fix sizeof, CPP #endif
+
+hardaker  7 Jun 99 10:52:32
+    - (Makefile.in): Patch from Chris Smith:
+      - don't put CFLAGS in the link line.
+
+hardaker  7 Jun 99 10:54:21
+    - (README.win32): added to the 3.6.2 line.
+
+hardaker  7 Jun 99 11:25:27
+    - (FAQ, README): update for 3.6.2.
+
+hardaker  7 Jun 99 11:27:15
+    - (NEWS): 3.6.2 update.
+
+hardaker  7 Jun 99 11:30:40
+    - (EXAMPLE.conf.def): update for 3.6.2.
+
+hardaker  7 Jun 99 11:32:54
+    - (INSTALL): update for 3.6.2.
+
+mslifcak  7 Jun 99 13:02:10
+    -(if.c) - check for valid pointer before de-referencing.
+
+hardaker  7 Jun 99 15:46:26
+    - (configure, configure.in): check for libdb1 before libdb for rpm usage.
+
+hardaker  7 Jun 99 15:50:01
+    - (FAQ): merge
+
+hardaker  7 Jun 99 16:03:25
+    - (configure.in, configure): check for -ldb1 then -ldb for rpm usage.
+
+hardaker  7 Jun 99 16:43:50
+    - (config.h.in, configure, configure.in): check for rpmGetPath to help
+      determine which version of RPM we're using (3 or 2).
+
+pjl  7 Jun 99 17:30:33
+    Added RPM v3 support
+
+mslifcak  8 Jun 99 03:40:36
+    -(mibII/*,snmplib/*) Markku L.'s fixes to compile on HP-UX with aCC
+
+mslifcak  8 Jun 99 03:54:50
+    spell check COMMUNITY
+
+-------------------------------------------------------------------------------
+
+Changes: V3.6 -> V3.6.1
+	
+mslifcak  8 Mar 99 04:02:01
+    (parse.c) - fix subid init; remove useless '-Pl' option.
+
+mslifcak  8 Mar 99 04:14:41
+    - (snmp_api.c) use request data with request callback
+
+mslifcak  8 Mar 99 05:01:49
+    -(win32/config.h) remove unused SYS_TIME_NAME,GLOBALSECURITY. add new constants.
+
+mslifcak  8 Mar 99 05:07:13
+    - (AGENT) MAX_NAME_LEN --> MAX_OID_LEN in example
+
+mslifcak  8 Mar 99 09:58:17
+    - (snmplib/parse.c) Complete Dave Shields' patch for continue after error.
+
+mslifcak  8 Mar 99 14:28:20
+    - (snmpnetstat:if.c, route.c) limit interface name sizes to fit fixed length buffers.
+
+hardaker 10 Mar 99 15:07:31
+    - (EXAMPLE.conf.def): group lines were backwards.
+
+hardaker 11 Mar 99 15:48:22
+    - (README): Added Mike Baer.
+
+hardaker 11 Mar 99 15:48:52
+    - (memory_solaris2.c): changed some comments to /* */ instead of //.
+
+hardaker 11 Mar 99 16:10:31
+    - (AGENT): removed AGENT
+
+hardaker 11 Mar 99 16:10:47
+    - (mib2c): fixed a couple of bugs and ansi'ified things.
+
+hardaker 11 Mar 99 16:22:43
+    - (util_funcs.c, util_funcs.h): move MATCH_SUCCEEDED defs to .h.
+
+hardaker 11 Mar 99 16:23:44
+    - (snmp_api.h, snmp_debug.h): Patch from Erik Jacobsen:
+      - fixed prototypes for DEBUGP() and DEBUGPOID().
+
+mslifcak 12 Mar 99 07:08:40
+    - (dlmod_mib.c) : Use MATCH_FAIL/SUCCEEDED in util_funcs.h
+
+hardaker 12 Mar 99 09:15:14
+    - (mibincl.h, dummy.c, wombat.c, hr_device.c, hr_disk.c, hr_filesys.c,
+      hr_network.c, hr_partition.c, hr_print.c, hr_proc.c, hr_storage.c,
+      hr_swinst.c, hr_swrun.c, hr_system.c, icmp.c, interfaces.c, ip.c,
+      snmp_mib.c, sysORTable.c, system_mib.c, tcp.c, udp.c, dlmod.c,
+      registry.c): fixed MATCH_FAILED/SUCCEEDED defines -> util_funcs.h.
+
+mslifcak 12 Mar 99 11:31:16
+    - (dlmod_mib.c) : explicit test for MATCH_FAILED
+
+hardaker 12 Mar 99 12:20:12
+    - (mib2c): fix asn_parse functions to pass a pointer to the size variable.
+
+hardaker 12 Mar 99 14:17:08
+    - (NEWS): update.
+
+hardaker 12 Mar 99 14:17:44
+    - (smux.c): protect strcpy() against a null password specified on the
+      config line.
+
+mslifcak 12 Mar 99 14:34:12
+    - (hr_system.h) - don't require hr_util; done in mibgroup/host.h
+    - (hr_swrun.c) - solaris2 : make sure kvm_open is called before kd is used.
+    - (hr_swrun.c) - add lame sunos4 equivalent in HRSWRUNPERF_CPU.
+
+mslifcak 12 Mar 99 14:35:38
+    - (target.h, target/*.h) require util_funcs once.
+
+hardaker 12 Mar 99 14:36:39
+    - (util_funcs.h): MATCH_FAILED -> -1, since some use it.
+
+mslifcak 12 Mar 99 14:54:51
+    - restore config_require logic; fix sprintf calls to compile under SunOS 4.1.x.
+
+hardaker 12 Mar 99 15:23:18
+    - (INSTALL): don't print module list here...  tell them to look at
+      configure --help.
+
+hardaker 12 Mar 99 15:24:37
+    - (configure, configure.in, IPFWCHAINS-MIB.txt, README,
+      ipfwc_kernel_headers.h, ipfwchains.c, ipfwchains.h, libipfwc.c,
+      libipfwc.h): Patch from Didier Dhaenens:
+      - new modules: ipfwchains.
+
+mslifcak 15 Mar 99 05:54:07
+    - (Makefile.in libsnmp.h mib.c snmp.h snmp_api.c) update CMU_COMPATIBLE
+
+hardaker 15 Mar 99 08:49:10
+    - (Makefile.in, snmp_api.c):
+      - revert to snmp_parse.
+      - don't install libsnmp.h.
+
+mslifcak 15 Mar 99 09:42:34
+    - second pass at CMU_COMPAT : Disable by default, leave snmp_parse alone.
+
+hardaker 15 Mar 99 14:30:45
+    - (snmp.h): remove unneeded commented out define.
+
+hardaker 15 Mar 99 14:31:23
+    - (acconfig.h): added CMU_COMPATIBLE
+
+hardaker 15 Mar 99 15:21:02
+    - (hr_proc.c, hr_proc.h, loadave.c, loadave.h): fix try_loadave for solaris.
+
+hardaker 15 Mar 99 15:31:51
+    - (configure, configure.in, interfaces.c, linux.h): detect
+      /proc/net/dev version at run time, not compile time.
+
+hardaker 15 Mar 99 15:46:12
+    - (interfaces.c): fixes for linux 2.2 interface scanning.
+
+hardaker 15 Mar 99 15:55:35
+    - (Makefile.in): makefileindepend.
+
+hardaker 15 Mar 99 15:58:07
+    - (FAQ, NEWS): updates to talk about the AGENT.txt file.
+	
+-------------------------------------------------------------------------------
+
+Changes: V3.5.3 -> V3.6
+
+hardaker 19 Jun 98 13:14:43
+    - (ChangeLog): update for 3.5.
+
+hardaker 22 Jun 98 09:16:32
+    - (main.c): Patch from Jerry G. DeLapp:
+      - commented out trailing #endif comment.
+
+hardaker 24 Jun 98 10:30:19
+    - (Makefile.in): man->html make specification.
+
+hardaker 24 Jun 98 10:31:22
+    - (Makefile.in, snmp_api.c, snmp_api.h): create snmp_pdu_add_variable().
+
+hardaker 24 Jun 98 10:56:46
+    - (snmpset.c, snmptest.c, snmptrap.c, snmp_api.c, snmp_api.h):
+      - moved hex_to_binary, ascii_to_binary, and snmp_add_var to snmplib.
+
+hardaker 24 Jun 98 11:08:41
+    - (UCD-SNMP-MIB.txt): Patch from Niels Baggesen:
+      - shutdown trap specifications.
+      - misc mib fixes.
+
+hardaker 24 Jun 98 11:40:40
+    - (snmpd.c, snmpd.h):
+      - created (poorly) send_trap_pdu() for sending v2 traps from mib modules.
+
+hardaker 26 Jun 98 10:42:32
+    - (disk.c): Patch from Michael Douglass:
+      - fix calculation of totaldisk by doing block division first to
+        protect against 32 bit overflows.
+
+hardaker 26 Jun 98 10:45:15
+    - (smux.c, snmp_bgp.c, snmp_ospf.c, snmp_rip2.c, snmp_rip2.h): Patch
+      from Niels Baggesen:
+      - Fix for new defines and proper header includes.
+
+hardaker 26 Jun 98 15:03:38
+    - (generic.h): put in a comment to keep compilers from complaining too much.
+
+hardaker 28 Jun 98 09:30:34
+    - (snmp_api.c): fix snmp_add_var().
+
+hardaker  1 Jul 98 11:28:17
+    - (configure, configure.in, Makefile.in, agent_read_config.c,
+      agent_read_config.h, snmp_vars.c, snmp_vars.h, snmpd.c, Makefile.in,
+      struct.h, pass.h, Makefile.in, snmptrapd.c, snmptrapd_handlers.c,
+      snmptrapd_handlers.h, Makefile.in, read_config.c, read_config.h,
+      snmp_api.c, snmp_api.h):
+      - moved read_config support into the library and use it.
+      - beginnings of snmptrapd extensibility.
+
+hardaker  1 Jul 98 15:56:12
+    - (snmp_api.c, snmp_api.h, system.h):
+      - added DEBUGPOID(name, namelen);
+      - moved DEBUGP definition into snmp_api.h where it belongs.
+
+hardaker  1 Jul 98 15:57:53
+    - (snmptrapd.c, snmptrapd_handlers.c):
+      - fix extensiblity checking of oids.
+      - seperate running of external command into new function.
+
+hardaker  8 Jul 98 12:26:25
+    - (freebsd2.h): use _UTMP_PATH if available.
+
+hardaker  8 Jul 98 12:26:34
+    - (irix.h): define _KMEMUSER
+
+hardaker  8 Jul 98 12:27:12
+    - (win32.opt, libsnmp.dsp, libsnmp.plg, libsnmp.def, libsnmp_dll.plg,
+      snmpbulkwalk.dsp, snmpbulkwalk.plg, snmpget.dsp, snmpget.plg,
+      snmpgetnext.dsp, snmpgetnext.plg, snmpset.dsp, snmpset.plg,
+      snmpstatus.dsp, snmpstatus.plg, snmptranslate.dsp,
+      snmptranslate.plg, snmpwalk.dsp, snmpwalk.plg): Patch from Joe
+      Marzot:
+      - win32 update.
+
+hardaker  8 Jul 98 12:34:26
+    - (struct.h, util_funcs.c, util_funcs.h, pass-persist.c,
+      pass-persist.h): Patch from Michael Douglass:
+      - create a pass-persist module to handle continuously running pass throughs.
+
+hardaker  8 Jul 98 12:56:46
+    - (read_config.c, read_config.h): removed from agent dir.
+
+hardaker  8 Jul 98 12:57:06
+    - (ucd_snmp.h): added pass-persist module.
+
+hardaker  8 Jul 98 12:58:03
+    - (snmp_api.c): Patch from Joe Marzot:
+      - fix "number of retries" bug.
+      - remove odd timeout calculation code for retries > 3.
+
+hardaker  8 Jul 98 13:02:06
+    - (interfaces.c): make hp_interfaces structure static.
+
+hardaker  8 Jul 98 13:03:36
+    - (system.c): don't free env pointers that are created.
+
+hardaker  8 Jul 98 13:08:18
+    - (UCD-SNMP-MIB.txt): Patch from Niels Baggesen:
+      - fix for missing object identifier labels.
+
+hardaker  8 Jul 98 14:04:22
+    - (Makefile.in, Makefile.top, configure, configure.in, Makefile.in,
+      .cvsignore, Makefile.in, dlmod_mib.c, dlmod_mib.h, example.c,
+      example.h, dlmod.c, dlmod.h, Makefile.in, Makefile.in,
+      DLMOD-MIB.txt, Makefile.in, Makefile.in): Patch from Eugene
+      Polovnikov:
+      - new dlmod set.
+      - fix configure script.
+
+hardaker  8 Jul 98 14:20:42
+     - (dlmod.c): use snmpd_ register_read_config() wrappers.
+
+hardaker  8 Jul 98 14:43:56
+    - (snmp_vars.c): include fixes.
+
+hardaker  8 Jul 98 14:44:25
+    - (ucd_snmp.h): removed ucd-snmp/pass_persist from default include list.
+
+hardaker  8 Jul 98 14:44:34
+    - (pass.c): include sys/wait.h
+
+hardaker  8 Jul 98 14:44:41
+    - (versioninfo.c): include system.h
+
+hardaker  8 Jul 98 14:45:22
+    - (parse.c): include snmp_api.h
+
+hardaker  8 Jul 98 14:45:42
+    - (snmp_api.c): include fixes.
+
+hardaker  8 Jul 98 15:31:36
+    - (snmptrapd.c, snmptrapd_handlers.c): -Wall fixes.
+
+hardaker  8 Jul 98 15:31:50
+    - (agent_read_config.c, snmpd.c): -Wall fixes.
+
+hardaker  8 Jul 98 15:51:28
+    version tag ( 3.6.pre1 )
+
+hardaker 10 Jul 98 09:42:16
+    - (snmpd.c): wrong pdu pointer for snmpv2c traps.
+
+hardaker 15 Jul 98 15:46:28
+    - (sedscript.in): using_module changes.
+
+hardaker 15 Jul 98 15:46:55
+    - (memory.h): MEMSWAPMINIMUM wasn't being used.
+
+hardaker 17 Jul 98 13:11:10
+    - (UCD-SNMP-MIB.inc, UCD-SNMP-MIB.txt):
+      - created smicng input file.
+      - fixed the UCD-SNMP mib to deal with most smic errors.
+
+hardaker 20 Jul 98 17:14:21
+    - (snmpcheck.def): work around for new multi-depth mib tables..
+
+hardaker 22 Jul 98 15:35:07
+    - (mib.c): don't change running environment variables with strtok.
+
+hardaker 22 Jul 98 16:23:45
+    - (Makefile.in, sedscript.in): fix sedscript includes.
+
+hardaker 31 Aug 98 13:02:27
+    - (interfaces.c): missing return on ifInErrors results.
+
+hardaker 31 Aug 98 13:32:43
+    - (snmptrapd.c): add a blank line to the end of the trapd output for parsing.
+
+hardaker  2 Sep 98 18:43:30
+    - (TODO): added security checks.
+
+hardaker  2 Sep 98 18:44:38
+    - (acconfig.h, config.h.in, configure, configure.in):
+      - persistent config file question.
+
+hardaker  2 Sep 98 18:44:53
+    - (Makefile.in): typo.
+
+hardaker  2 Sep 98 18:47:15
+    - (mib.c, mib.h, read_config.c, read_config.h):
+      - pre/post mib loading config files.
+      - create init_snmp() to wrap other fuctions.
+      - new snmp.conf directives: mibs, mibdirs, mibfile.
+
+hardaker  2 Sep 98 18:47:48
+    - (snmp_api.c, snmp_api.h): init_snmp().
+
+hardaker  2 Sep 98 18:48:25
+    - (libsnmp.def): find_module.
+
+hardaker  2 Sep 98 18:48:40
+    - (snmp_parse_args.c): use init_snmp instead of init_mib().
+
+hardaker  2 Sep 98 18:50:34
+    - (agent_read_config.c, agent_read_config.h, snmp_vars.c, snmpd.c,
+      snmpd.h):
+      - support mib-module shutdown functions.
+      - do a minimal persistent cache implementation and read it at start up.
+      - test with beginnings (wrong place) of agentBoots variable.
+
+nba  3 Sep 98 14:29:03
+    - (fixproc): added comment to test CVS.
+
+hardaker  9 Sep 98 16:12:32
+    - (*): Merge into main branch from 3.5.1 branch.
+
+hardaker  9 Sep 98 16:55:04
+    - (snmpd.c): fix trap stuff broken by the code merge.
+
+hardaker 11 Sep 98 09:26:42
+    - (*): Merged the MT changes into the main branch.
+
+hardaker 12 Sep 98 08:46:01
+    - (snmp_api.c): prototype move init_snmp() above init_snmp_session.
+
+hardaker 12 Sep 98 08:53:23
+    - (acconfig.h, config.h.in): move un-configured defines above @TOP@.
+
+hardaker 12 Sep 98 08:54:24
+    - (configure, configure.in): Don't force cc anymore, allow gcc to go first.
+
+hardaker 12 Sep 98 08:56:51
+    - (ov/Makefile.in, mibs/Makefile.in): Patch from Michael Slifcak:
+      - remove duplicate sections already defined in Makefile.top.
+
+hardaker 12 Sep 98 09:02:37
+    - (snmp_api.c): Patch from Michael Slifcak:
+      - bug fix to check for NULL session pointer before using it.
+
+hardaker 12 Sep 98 09:08:46
+    - (acconfig.h, config.h.in): Move CAN_USE_NLIST tests below arch .h files.
+
+hardaker 13 Sep 98 18:24:00
+    - (snmp_api.c): Patch from Michael Slifcak:
+      - exit -> return.
+
+hardaker 13 Sep 98 20:12:09
+    - (snmptable.c, snmptranslate.c, mib.c, mib.h, parse.c, parse.h):
+      - merge into main line from the 3-6-pre1-trans branch.
+
+hardaker 13 Sep 98 20:18:10
+    - (snmp_api.c): define usage mispelling SNMP_BAD_PARSE -> SNMPERR_BAD_PARSE.
+
+hardaker 13 Sep 98 20:30:38
+    - (snmp_api.c): prevent double init_snmp()s.
+
+hardaker 13 Sep 98 21:05:26
+    - (README): Name addition.
+
+hardaker 13 Sep 98 21:06:52
+    - (mib.c, read_config.c): refix the non-malloced configuration vars.
+
+hardaker 13 Sep 98 21:09:36
+    version update: 3.6.pre2
+
+hardaker 14 Sep 98 12:35:10
+    - (Makefile.in): Patch from Michael Slifcak:
+      - install snmp_sess_api.3.
+
+hardaker 14 Sep 98 12:43:32
+    - (agent_read_config.c, snmp_vars.c, dlmod_mib.c, util_funcs.c,
+      dummy.c, wombat.c, hr_device.c, hr_disk.c, hr_filesys.c,
+      hr_network.c, hr_partition.c, hr_print.c, hr_proc.c, hr_storage.c,
+      hr_swinst.c, hr_swrun.c, hr_system.c, at.c, icmp.c, interfaces.c,
+      ip.c, snmp_mib.c, system.c, tcp.c, udp.c, var_route.c, snmp_bgp.c,
+      snmp_ospf.c, snmp_rip2.c, hpux.c, pass.c, pass_persist.c,
+      registry.c, acl_vars.c, alarm.c, context_vars.c, event.c,
+      party_vars.c, view_vars.c, snmptrapd.c, snmptrapd_handlers.c,
+      snmp_api.c, snmp_api.h): Patch from Michael Slifcak:
+      - rename compare -> snmp_oid_compare().
+
+hardaker 15 Sep 98 13:02:34
+    - (inet.c): Patch from Michael Slifcak:
+      - memory related fixes.
+
+hardaker 15 Sep 98 13:07:05
+    - (mib.c): // comment -> /* */ comment.
+
+hardaker 15 Sep 98 13:07:45
+    - (snmp_api.c): Patch from Michael Slifcak:
+      - fix init_snmp calls from session routines.
+
+hardaker 18 Sep 98 13:20:11
+    - (UCD-SNMP-MIB.txt): added the FileTable submitted by Jonas Olsson.
+
+hardaker 18 Sep 98 14:01:51
+    - (ucd_snmp.h): add the file mib module.
+
+hardaker 18 Sep 98 14:04:43
+    - (UCD-SNMP-MIB.txt): Change file return code from TruthValue to
+      integer since 1/2 does not fit the current 0/1 return code scheme.
+
+hardaker 21 Sep 98 11:11:39
+    - (snmp_vars.c): finally fixed the write_method's for creation problem.
+
+hardaker 23 Sep 98 13:07:07
+    - (acconfig.h, config.h.in, configure, configure.in, parse.c): New flag:
+      - --enable-eol-terminated-comments.
+
+hardaker 25 Sep 98 17:05:40
+    - (snmp_api.c): don't rely on the getservbyname pointer to stay around.
+
+hardaker 25 Sep 98 17:15:22
+    - (snmp_api.c, snmp_api.h, snmp_client.c): Patch from Michael Slifcak:
+     - The CMU library has an optimization in snmp_clone_pdu() that does
+       not copy zero length strings.  I had merged this in with changes
+       made for multi-thread support.  Unfortunately, I did not make sure
+       the cloned PDU had no pointer for this case.  Oops!
+     - Another problem in snmp_clone_pdu() was the test for zero length
+       string was not being performed on the first varbind in the chain.
+
+hardaker 25 Sep 98 17:24:16
+    - (mib.c, mib.h, read_config.c, snmp_api.c, snmp_api.h): Patch from
+      Michael Slifcak:
+      - fix compiler warnings, errors.
+
+hardaker 25 Sep 98 17:25:10
+    - (snmptable.c): process args directly instead of relying on get_opt().
+
+hardaker 25 Sep 98 17:33:06
+    - (config.h, win32.dsw, libsnmp.dsp, libsnmp.def, libsnmp_dll.dsp,
+       snmptable.dsp): Patch from Michael Slifcak:
+      - stupid OS update.
+
+hardaker 25 Sep 98 17:55:50
+    - (Makefile.in): Patch from Michael Slifcak:
+      - install more headers.
+
+hardaker 25 Sep 98 17:56:43
+    - (Makefile.in): don't install libsnmp.h.  It's going to change too
+      much in the future.
+
+hardaker 25 Sep 98 18:03:27
+    - (Makefile.in): install version.h, and strip includes out of config.h
+
+hardaker 25 Sep 98 18:04:11
+    - (snmp_api.c): remove unneeded comment-out.
+
+hardaker 25 Sep 98 18:14:20
+    - (configure, configure.in, util_funcs.c): use USLEEP if available for
+      small sleep times while waiting for processes to finish.
+
+hardaker 30 Sep 98 14:57:11
+    - (ChangeLog, EXAMPLE.conf.def, NEWS, configure, configure.in,
+      interfaces.c, memory.c, snmptest.c, snmptrap.c, parse.c):
+      - merge 3.5.3 changes into main trunk.
+
+hardaker  5 Oct 98 16:53:23
+    - (dummy.c, dummy.h): update to remove common_header.h
+
+hardaker  5 Oct 98 17:03:34
+    - (hr_proc.c): possible fix for solaris's process percentage.
+
+hardaker  6 Oct 98 15:18:03
+    - (var_route.c): hack fixes for hpux10 and rtentry.
+
+hardaker  6 Oct 98 15:18:16
+    - (hpux.h): hack fixes for hpux10 and rtentry.
+
+hardaker  6 Oct 98 15:18:55
+    - (config.h.in): setup define for HAVE_USLEEP.
+
+hardaker  6 Oct 98 15:34:58
+    - (remove-files): update.
+
+hardaker  6 Oct 98 15:35:06
+    - (versiontag): fix for cvs 1.10.
+
+hardaker  6 Oct 98 15:38:49
+    - (versiontag): typo.
+
+hardaker  6 Oct 98 15:38:56
+    - (version.h bug-report sedscript.in): version tag ( 3.6.pre3 )
+
+hardaker  7 Oct 98 16:49:11
+    - (Makefile.in): Patch from Michael Slifcak:
+      - properly locate version.h in $(srcdir).
+
+hardaker  7 Oct 98 16:49:30
+    - (Makefile.in): Patch from Michael Slifcak:
+      - fix make html.
+
+hardaker  7 Oct 98 16:50:23
+    - (parse.c): Patch from Michael Slifcak:
+      - remove un-needed headers.
+
+hardaker  7 Oct 98 16:51:56
+    - (snmp_api.c): fix default port problems (again).
+
+hardaker  7 Oct 98 16:54:38
+    - (snmpdelta.c): Patch from Michael Slifcak:
+      - fix exiting problems on NT.
+
+hardaker  7 Oct 98 17:00:40
+    - (libsnmp.dsp, libsnmp_dll.dsp): Patch from Michael Slifcak:
+      - winNT project file updates.
+
+hardaker  9 Oct 98 08:09:12
+    - (config.h.in, configure, configure.in): use zlib when using rpm libraries.
+
+hardaker  9 Oct 98 23:08:18
+    - (parse.c): Patch from Dave Shield:
+      - Check for fully qualified oid statements.
+
+hardaker  9 Oct 98 23:12:02
+    - (parse.c): Patch from Dave Shield:
+      - support for strict (case sensitive) option to the mib compiler.
+
+hardaker  9 Oct 98 23:20:25
+    - (FAQ): Dave Shield explains in wonderous detail all about the VACM module.
+
+hardaker 14 Oct 98 09:17:02
+    - (EXAMPLE.conf.def): change public community examples -> private.
+
+hardaker 14 Oct 98 09:41:12
+    - (config.h.in, configure, configure.in): check for machine/types.h.
+
+hardaker 14 Oct 98 09:41:38
+    - (host_res.h): net/in_var.h for freebsd3.
+
+hardaker 14 Oct 98 09:42:20
+    - (hr_storage.c): machine/types.h and sys/vmmeter.h for freebsd3.
+
+hardaker 14 Oct 98 09:50:26
+    - (freebsd3.h): define freebsd2 and MOUNT_NFS.
+
+hardaker 14 Oct 98 09:51:58
+    - (freebsd3.h): opps:  define MOUNT_NFS as "nfs".
+
+hardaker 14 Oct 98 16:40:05
+    - (snmpd.c): -A: append to log file.
+
+hardaker 14 Oct 98 16:41:52
+    - (snmpd.c): document -A.
+
+hardaker 14 Oct 98 16:42:10
+    - (snmpd.1.def): document -A.
+
+hardaker 14 Oct 98 16:49:03
+    - (mib.c): Patch from Michael Slifcak:
+      - fix for broken compiler warnings on NT.
+
+hardaker 14 Oct 98 16:52:51
+    - (memory.c): fix for hpux9.
+
+hardaker 16 Oct 98 08:38:39
+    - (at.c, icmp.c, interfaces.c, aix.h): aix header file fixes.
+
+hardaker 21 Oct 98 10:54:49
+    - (parse.c): Patch from Dave Shield:
+      - Fix parser to deal with anonymous children properly.
+
+hardaker 21 Oct 98 11:08:56
+    - (hr_filesys.c): Patch from Dave Shield:
+      - watch out for empty file names passed in.
+
+hardaker 21 Oct 98 17:01:12
+    - (.cvsignore, Makefile.in, read_config.3.def):
+      - new unproofread manual on the read_config api (most of it).
+
+hardaker 23 Oct 98 07:57:17
+    - (hr_filesys.c): Patch from Dave Shield:
+      - NULL checking on the filesystem mount point.
+
+hardaker 23 Oct 98 13:54:11
+    - (Makefile.in): insert @ sign.
+
+hardaker 23 Oct 98 13:54:47
+    - (at.c, icmp.c, interfaces.c): bug fixes, missing #endif.
+
+hardaker 23 Oct 98 13:56:09
+    - (tkmib): editable oid field.
+
+hardaker 23 Oct 98 13:59:44
+    - (acconfig.h, config.h.in, configure, configure.in,
+      agent_read_config.c, agent_read_config.h, snmpd.c, wombat.h,
+      system.h, vacm_vars.h, dlmod.c, disk.h, extensible.h, file.h,
+      loadave.h, memory.h, memory_freebsd2.h, pass.h, pass_persist.h,
+      proc.h, snmp_parse_args.c, snmptrapd.c, mib.c, read_config.c,
+      read_config.h):
+      - new option -H on command line to print out .conf file directives
+        that the application understands.
+      - created a new option to the read config registration to allow
+        specifying of a help line.
+
+hardaker  6 Nov 98 17:23:46
+    - (snmpd.c): fix v2 trap generation.
+
+hardaker  6 Nov 98 17:44:43
+    - (snmpd.c): v2 trap send debugging.
+
+hardaker 16 Nov 98 22:10:08
+    - (tkmib): too many improvements to count.
+
+hardaker 23 Nov 98 15:42:52
+    - (interfaces.c, irix.h): fix location of _KERNEL define for irix.
+
+hardaker 23 Nov 98 16:35:40
+    - (snmp_parse_args.c, mib.c, parse.c, parse.h): Patch from Michael Slifcak:
+      - misc parsing bug fixes.
+      - -w & -W options to default application parse_args.
+      - runtime options to control underscore and comment parsing in mibs.
+
+hardaker 13 Dec 98 07:42:44
+    - (config.h.in, configure, configure.in, mib.c, snmp_api.c):
+      - use setlocale() if available to correct isprint problems.
+
+hardaker 13 Dec 98 07:48:53
+    - (parse.c, parse.h): new functions: snmp_mib_toggle_options() and usage.
+
+hardaker 13 Dec 98 07:49:43
+    - (snmp_parse_args.c): -P flag for toggling new mib parsing options.
+
+hardaker 13 Dec 98 08:06:33
+    - (NEWS): beginning notes for 3.6.
+
+hardaker 13 Dec 98 08:07:24
+    - (disk.c): fix disk size error flag reporting on Solaris.
+
+hardaker 13 Dec 98 08:12:13
+    - (parse.c): spacing in mib option usage fixes.
+
+hardaker 13 Dec 98 08:14:44
+    - (snmp_parse_args.c): remove -w/-W flag in usage.
+
+hardaker 13 Dec 98 08:18:07
+    - (kernel_sunos5.c): remove a few defines that were messing up solaris 7.
+
+hardaker 13 Dec 98 08:41:55
+    - (hr_filesys.c): watch out for NULL file pointers.
+
+hardaker 13 Dec 98 08:42:20
+    - (inet.c): init pointer to NULL.
+
+hardaker 13 Dec 98 08:48:38
+    - (hr_swinst.c): Patch from Jeff Johnson:
+      - protect against memory leaks with the RPM package info calls.
+
+hardaker 13 Dec 98 08:57:52
+    - (README): added Jeff Johnson to the contributors list.
+
+hardaker 13 Dec 98 08:59:16
+    - (version.h bug-report sedscript.in): version tag ( 3.6.pre5 )
+
+hardaker 16 Dec 98 07:31:26
+    - (snmp_api.c): Patch from Michael Slifcak:
+      - pointer checks before freeing memory.
+
+hardaker 18 Dec 98 11:36:39
+    - (UCD-SNMP-MIB.txt): Patch from Michael Slifcak:
+      - typo.
+
+hardaker 18 Dec 98 18:10:24
+    - (parse.c, read_config.c, read_config.h):
+      - fixes from Michael Slifcak.
+      - misc read_config functions pulled in from the v3 work.
+
+hardaker 18 Dec 98 18:11:03
+    - (libsnmp.def): update from Michael Slifcak.
+
+hardaker 18 Dec 98 18:12:54
+    - (snmp_parse_args.c): include read_config.h.
+
+hardaker 18 Dec 98 18:16:33
+    - (acconfig.h, config.h.in, configure, configure.in):
+      - store configure flags to a define.
+
+hardaker 18 Dec 98 18:16:53
+    - (versioninfo.c, versioninfo.h): mib object to display configure options.
+
+hardaker 21 Dec 98 18:19:12
+    - (file.h, UCD-SNMP-MIB.txt): move the file mib to .15 so it doesn't
+      conflict with the demo mib.
+
+hardaker 21 Dec 98 18:20:25
+    - (system.c): Patch from Michael Slifcak:
+      - Win32 memory leak fixes for opendir(), etc.
+
+hardaker 22 Dec 98 08:50:29
+    - (Makefile.in): don't compile dlmods
+
+hardaker 22 Dec 98 14:56:44
+    - (mib.c, snmp_api.c): Patch from Michael Slifcak:
+      - fix my broken set_locale stuff.
+
+hardaker 26 Dec 98 10:35:23
+    - (dlmod.c): Patch from Michael Slifcak:
+      - fix dlmod compilation in snmpd_register_config_handler() call.
+
+hardaker 29 Dec 98 16:55:54
+    - (mib.c): Patch from Michael Slifcak:
+      - remove newlines from sprint_value() where applicable.
+
+hardaker 29 Dec 98 17:02:33
+    - (vacm.c): Enable multiple side by side views in the view family
+      tree.  The views already existed, but weren't checked and only the
+      first view was found.
+      - Not done in a clean fashion.  Much of the structure definitions
+        should be rewritten with sub-pieces to do it properly with greater
+        speed.
+
+hardaker 31 Dec 98 17:46:11
+    - (event.c): Patch from David Tiller:
+      - memcmp's sizes were wrong.
+
+hardaker 31 Dec 98 17:48:57
+    - (snmp_client.c): Patch from David Tiller:
+      - need to read_objid() the context oid base, not the party oid base
+        in one location.
+
+hardaker 31 Dec 98 17:49:51
+    - (snmp_vars.c): Patch from David Tiller:
+      - oidLen's were wrong for m2m oids.
+
+hardaker  2 Jan 99 08:48:29
+    - (IANAifType-MIB.txt): Patch from Jakob Ellerstedt:
+      - new complete list of ifTypes.
+
+hardaker  5 Jan 99 10:41:52
+    - (snmptable.c): Make field separator take arguments directly after the -f.
+
+hardaker  5 Jan 99 10:48:51
+    - (snmpbulkwalk.c, snmpget.c, snmpgetnext.c, snmpset.c, snmpstatus.c,
+      snmptable.c, snmpwalk.c): Patch from mslifcak@iss.net:
+      - make main() return an int instead of void.
+
+hardaker  9 Jan 99 20:28:21
+    - (mib.c, parse.c, read_config.c, snmp_api.c, snmp_api.h, vacm.c):
+      - Implement the new token based debugging message support.
+
+hardaker  9 Jan 99 20:30:12
+    - (snmptable.c): change internal debug variable to localdebug.
+
+hardaker  9 Jan 99 20:30:47
+    - (snmp_parse_args.c): make -D register the debugging tokens specified.
+
+hardaker  9 Jan 99 20:49:29
+    - (FAQ, README): URL changes.
+
+hardaker  9 Jan 99 20:50:15
+    - (snmptrapd.c, snmptrapd_handlers.c): use the new debugging functions.
+
+hardaker  9 Jan 99 20:50:28
+    - (if.c, main.c): use the new debugging functions.
+
+hardaker  9 Jan 99 20:52:10
+    - (snmp_api.c, snmp_api.h): DEBUGPOID replacement: DEBUGMSGOID.
+
+hardaker  9 Jan 99 20:52:22
+    - (snmpcmd.1): discuss -D usage change.
+
+hardaker  9 Jan 99 21:50:13
+    - (agent/*.c):
+      - use the new debugging functions.
+      - implement needed -D flag changes.
+
+hardaker 14 Jan 99 09:02:36
+    - (mib2c): update for SNMP.pm 1.8.
+
+hardaker 15 Jan 99 11:10:09
+    - (snmp2p.c): Patch from Michael Slifcak:
+      - remove reverse_bytes() usage.
+
+hardaker 15 Jan 99 11:12:22
+    - (snmpd.c, snmpd.h):
+      - remove reverse_bytes() usage.
+
+hardaker 15 Jan 99 15:24:02
+    - (agent/mibgroup/*):
+      - made all (ok, some. !host) mib modules use snmpd_register_config_handler().
+      - made all (ok, some. !host) mib modules use register_mib().
+
+hardaker 15 Jan 99 15:58:20
+    - (Makefile.in, Makefile.in): makefileindepend.
+
+hardaker 15 Jan 99 15:58:50
+    - (vacm.c): DEBUGMSG typo.
+
+hardaker 15 Jan 99 16:17:05
+    - (smux.c, smux.h): Patch from Nick Amato:
+      - smux patches.
+
+hardaker 16 Jan 99 23:04:12
+    - (snmpcmd.1): updated -D description.
+
+hardaker 16 Jan 99 23:12:03
+    - (snmplib/*.[ch]): Patch from Markku Laukkanen:
+      - asni'ify all functions.
+
+hardaker 16 Jan 99 23:13:10
+    - (version.h bug-report sedscript.in): version tag ( 3.6.pre6 )
+
+hardaker 18 Jan 99 10:47:36
+    - (README, apps, agent, acconfig.h): Patch from Markku Laukkanen:
+      - ansi'ify everything.
+
+hardaker 19 Jan 99 19:59:53
+    - (config.h.in, configure, configure.in): remove __P checking.
+
+hardaker 19 Jan 99 20:01:59
+    - (snmptable.c, mib.c, parse.c, snmp_auth.c, libsnmp.def): Patch from
+      Michael J. Slifcak:
+      - apps/snmptable.c - some compilers warn comparing pointer with integer
+      - snmplib/mib.c - already mentioned before; here for complete-ness
+      - snmplib/parse.c - minor touchup of includes; system.h dup removed
+      - snmplib/snmp_api.h - MSVisual C++ doesn't have __FUNCTION__
+      - snmplib/snmp_auth.c - minor fix of comment
+      - win32/libsnmp_dll/libsnmp.def - snmp_parse_args needs a new function
+
+hardaker 20 Jan 99 12:20:08
+    - (FAQ): perl-SNMP and y2k questions added.
+
+hardaker 20 Jan 99 12:21:35
+    - (acconfig.h): unneeded comment removed.
+
+hardaker 20 Jan 99 12:21:57
+    - (interfaces.c): typo in ansi changes.
+
+hardaker 20 Jan 99 12:24:34
+    - (agent_read_config.c, auto_nlist.c, snmp_agent.c, snmpd.c,
+      host_res.h, mibincl.h, .cvsignore, snmp_parse_args.c, snmptrapd.c,
+      snmptrapd_handlers.c, if.c, Makefile.in, mib.c, parse.c,
+      read_config.c, snmp_api.c, snmp_api.h, snmp_debug.c, snmp_debug.h,
+      vacm.c): debugging support code moved to snmp_debug.[ch].
+
+hardaker 20 Jan 99 15:11:59
+    - (Makefile.in): version tag creation.
+
+hardaker 20 Jan 99 15:14:13
+    - (config.h.in, configure, configure.in):
+      - check for asm/page.h (linux).
+      - check for sys/stream.h (SCO).
+      - Fix rtentry test.
+
+hardaker 20 Jan 99 15:14:42
+    - (agent_read_config.c, snmp_vars.c): include sys/stream.h for SCO.
+
+hardaker 20 Jan 99 15:14:58
+    - (versiontag): version tagging ability to do many things.
+
+hardaker 20 Jan 99 15:16:34
+    - (at.c, interfaces.c, ip.c, route_write.c, tcp.c, udp.c,
+      var_route.c):
+      - sys/stream.h needed by SCO.
+      - interfaces scan fixes for linux 2.0 vs 2.1 can be configured elsewhere now.
+      - protect get_address calls against NULL pointer returns.
+
+hardaker 20 Jan 99 15:17:17
+    - (disk.c, errormib.c, extensible.c, loadave.c, memory.c):
+      - linux 2.1 kernel needs asm/page.h (all includes need to be re-written).
+
+hardaker 20 Jan 99 15:17:41
+    - (linux.h): define LINUX_INTERFACE_SCAN_LINE.
+
+hardaker 20 Jan 99 15:20:04
+    - (Makefile.in): install ucd-snmp-includes.h.
+
+hardaker 20 Jan 99 15:22:08
+    - (Makefile.in): make depend.
+
+hardaker 20 Jan 99 15:22:38
+    - (FAQ, README): added version stamp.
+
+hardaker 20 Jan 99 15:30:58
+    - (COPYING): It's 1999
+
+hardaker 20 Jan 99 15:31:13
+    - (README): helping out changes.
+
+hardaker 20 Jan 99 15:48:53
+    - (smux.c): typo
+
+hardaker 20 Jan 99 15:49:30
+    - (hr_swinst): #ifdef RPM protect a free routine.
+
+hardaker 20 Jan 99 15:50:17
+    - (Makefile.in): remove ucd specific mib module make requirements.
+
+hardaker 20 Jan 99 15:54:02
+    - (snmpd.c): export sdlist and sdlen variables.
+
+hardaker 20 Jan 99 15:54:36
+    - (smux.c): debugging changes.
+
+hardaker 20 Jan 99 16:41:20
+    - (acconfig.h, config.h.in, snmp_parse_args.c, main.c, snmp_api.c):
+      Patch from Michael Slifcak:
+      - allow zero length (legal) community strings.
+
+hardaker 20 Jan 99 17:02:37
+    - (config.h.in): ran autoheader
+
+hardaker 20 Jan 99 17:11:26
+    - (version.h bug-report sedscript.in): version tag ( 3.6.pre7 )
+
+hardaker 21 Jan 99 08:39:34
+    - (FAQ): Patch from Michael J. Slifcak:
+      - typo on Joe's name fixed.
+
+hardaker 21 Jan 99 08:40:26
+    - (acconfig.h, config.h.in, snmp_api.c, config.h): Patch from Michael
+      J. Slifcak:
+      - NO_NULL_COMUNITY -> NO_ZEROLENGTH_COMMUNITY.
+
+hardaker 21 Jan 99 08:42:17
+    - (Makefile.in): remove ucd specific module depends.
+
+hardaker 22 Jan 99 07:23:13
+    - (snmp_api.c): Patch from Michael Slifcak:
+      - Check for NULL on session closes.
+
+hardaker 25 Jan 99 10:28:08
+    - (snmpdelta.c, snmpstatus.c, snmptest.c, snmptrap.c,
+      snmptrapd_handlers.c, inet.c, main.c): Patch from Markku Laukkanen:
+      - more ansi fixes.
+
+hardaker 25 Jan 99 10:28:26
+    - (versiontag): typo.
+
+hardaker 25 Jan 99 10:28:41
+    - (linux.h): 2.2 define update.
+
+hardaker 25 Jan 99 10:33:24
+    - (context_parse.c, mib.c, parse.c, read_config.c, snmp_api.c,
+      snmp_client.c, system.c): Patch from Markku Laukkanen:
+      - ansi fixes.
+
+hardaker 25 Jan 99 10:34:11
+    - (system.c): fix strings.h include.
+
+hardaker 25 Jan 99 11:11:49
+    - (acconfig.h, config.h.in, configure, configure.in):
+      - test if __FUNCTION__ is supported by the compiler.
+
+hardaker 25 Jan 99 11:15:53
+    - (agent_read_config.c, snmp_vars.h, snmpd.c, host_res.h, mibincl.h,
+      file.c, inet.c, parse.c, snmp_debug.c):
+      - -Wall fixes.
+
+hardaker 25 Jan 99 11:16:16
+    - (linux.h): comment typo.
+
+hardaker 25 Jan 99 16:25:37
+    - (README, README.mib2c): mib2c readme file.
+
+hardaker 26 Jan 99 09:45:42
+    - (EXAMPLE.conf.def): change reference IP net addresses to 10.10.10.0.
+
+hardaker  2 Feb 99 13:33:25
+    2036 -> 2038
+
+hardaker  2 Feb 99 13:34:36
+    - (snmpd.c): typo: -L -> -A in help strings docs.
+
+hardaker  2 Feb 99 22:00:13
+    - (FAQ): mention lack of solaris memory support.
+
+hardaker  2 Feb 99 22:01:01
+    - (TODO): Remove unsuppored mib nodes from output instead of returning 0's.
+
+hardaker  2 Feb 99 22:02:04
+    - (hr_proc.c): use [0] index of load average table.
+
+hardaker  2 Feb 99 22:02:41
+    - (UCD-SNMP-MIB.txt):
+      - mention that the memory section isn't supported on all
+        architectures.
+
+hardaker  8 Feb 99 12:21:25
+    - (smux.c): Patch from John Polstra:
+      - call accept() to get the socket file descriptor.
+
+hardaker  8 Feb 99 15:08:57
+    - (FAQ): Patch from Michael Slifcak:
+      - Tk.pm mention.
+
+hardaker  8 Feb 99 15:13:01
+    - (snmpd.c): Patch from Michael Slifcak:
+      - variable renaming index -> iindex.
+
+hardaker  8 Feb 99 15:14:42
+    - (snmpdelta.c): Patch from Michael Slifcak:
+      - variable renaming time -> m_time.
+
+hardaker  8 Feb 99 15:17:50
+    - (route.c): Patch from Michael Slifcak:
+      - variable renaming index -> IfIndex.
+
+hardaker  8 Feb 99 15:18:08
+    - (inet.c): proper bracket indentation.
+
+hardaker  8 Feb 99 15:19:22
+    - (parse.c): Patch from Michael Slifcak:
+      - use size_t instead of "unsigned" for xmalloc, etc.
+
+hardaker  8 Feb 99 15:20:47
+    - (snmp_api.c, snmp_api.h): Patch from Michael Slifcak:
+      - make snmp_oid_compare use const's.
+
+hardaker  8 Feb 99 23:22:33
+    - (agent/*): Patch from Michael Slifcak:
+      - typedef all of the var_xxx and write method functions.
+
+hardaker  8 Feb 99 23:23:41
+    - (kernel_sunos5.c, mibincl.h) Patch from Michael Slifcak:
+      - include updates.
+
+hardaker  9 Feb 99 14:10:33
+    - (Makefile.in): make FAQ.html.
+
+hardaker  9 Feb 99 14:10:52
+    - (mib2c): typo.
+
+hardaker  9 Feb 99 14:35:46
+    - (mib.c): increase buffer size for oid printing.
+
+hardaker 11 Feb 99 16:10:39
+    - (*): Patch from Michael Slifcak:
+      - convert MAX_NAME_LEN -> MAX_OID_LEN.
+      - convert temporary character storage buffers to SPRINT_MAX_LEN.
+      - make the libraries print_ functions use the fprint_ function
+        already defined and pass it stdout.
+
+hardaker 11 Feb 99 16:22:03
+    - (host_res.h): include snmp_vars.h ahead of var_struct.h.
+
+hardaker 11 Feb 99 16:23:16
+    - (acl_parse.c, context_parse.c, party_parse.c, read_config.c, snmp_api.c):
+      - More buf size standardizations that Michael missed.
+      - A few MAX_NAME_LEN -> MAX_OID_LEN conversions that Michael missed.
+
+hardaker 11 Feb 99 16:34:00
+    - (tcp.c): var_tcpEntry was checking against the incoming oid with the
+      wrong length and could succeed at times when it shouldn't have.
+
+hardaker 11 Feb 99 16:46:48
+    - (version.h bug-report sedscript.in): version tag ( Ext-3-6-pre8 )
+
+hardaker 11 Feb 99 16:48:07
+    - (version.h bug-report sedscript.in): version tag ( 3.6.pre8 )
+
+hardaker 11 Feb 99 16:48:29
+    - (versiontag): update.
+
+hardaker 16 Feb 99 17:05:45
+    - (mib2c, mib2c.conf): updated mib2c program...  still in progress...
+
+hardaker 17 Feb 99 15:10:00
+    - (interfaces.c): Patch from Michael L. Hitch:
+      - fix if_name variable by making it static.
+
+hardaker 17 Feb 99 15:13:38
+    - (snmpd.h): Patch from Michael Slifcak:
+      - remove reverse_bytes() prototype.
+
+hardaker 17 Feb 99 15:13:58
+    - (snmptranslate.c): Patch from Michael Slifcak:
+      - usage fix.
+
+hardaker 17 Feb 99 15:15:59
+    - (if.c, inet.c, main.c, netstat.h, route.c): Patch from Michael Slifcak:
+      - make snmpnetstat win32 compatible.
+
+hardaker 17 Feb 99 15:16:17
+    - (mib2c, mib2c.conf): update again for better still output.
+
+hardaker 17 Feb 99 15:17:13
+    - (Makefile.in): separate target for generated manual pages.
+
+hardaker 17 Feb 99 15:18:06
+    - (IANAifType-MIB.txt): Patch from Michael Slifcak:
+      - use a '-' instead of a '.' for IEEE802-11.
+
+hardaker 17 Feb 99 15:19:03
+    - (asn1.c): Patch from Michael Slifcak:
+      - comment reformatting.
+
+hardaker 17 Feb 99 15:19:52
+    - (context_parse.c): Patch from Michael Slifcak:
+      - don't use a variable called 'time'.  Tsk tsk.
+
+hardaker 17 Feb 99 15:21:25
+    - (mib.c): Patch from Michael Slifcak:
+      - fix fprint_variable to not recurse.
+
+hardaker 17 Feb 99 15:23:44
+    - (parse.c, party_parse.c, snmp_auth.c): Patch from Michael Slifcak:
+      - variable name conflict fixes.
+
+hardaker 17 Feb 99 15:28:54
+    - (config.h, win32.dsw, libsnmp.dsp, libsnmp.def, libsnmp_dll.dsp,
+      snmpnetstat.dsp, snmptable.dsp): Patch from Michael Slifcak:
+      - win32 updates.
+
+hardaker 17 Feb 99 16:13:47
+    - (snmpd.c, dummy.c, wombat.c, system_mib.c, vacm_vars.c, dlmod.c,
+      disk.c, extensible.c, file.c, loadave.c, memory.c,
+      memory_freebsd2.c, pass.c, pass_persist.c, proc.c, mib.c,
+      read_config.c): word -> token ("word" is reserved in some compilers.
+
+hardaker 22 Feb 99 09:11:52
+    - (parse.c): Patch from mslifcak@iss.net:
+      - The command line option to select "allow underscore in MIB
+        symbols" is missing.
+
+hardaker 22 Feb 99 09:44:21
+    - (parse.c): Patch from Michael Slifcak:
+      - Don't print "can't find module XXX" messages without warnings turned on.
+
+hardaker 24 Feb 99 14:43:21
+    - (IANAifType-MIB.txt): update.
+
+hardaker 24 Feb 99 17:10:13
+    - (acconfig.h, config.h.in, configure, configure.in, linux.h):
+      - Check for and handle 2.2 /proc/net/dev changes.
+
+hardaker 25 Feb 99 10:03:41
+    - (README, ucd_snmp.h, memory_solaris2.c, memory_solaris2.h): Patch
+      from David F. Newman:
+      - memory support for solaris2.
+
+hardaker 26 Feb 99 15:02:55
+    - (loadave.c, loadave.h, UCD-SNMP-MIB.txt):
+      - implement load average reporting as a integer and as a float.
+
+hardaker 26 Feb 99 15:42:31
+    - (mib.c, parse.c, parse.h): Patch from Michael Slifcak:
+      - Unlinked OID ... ccitt 0 fix courtesy of Dave Shield.
+      - Continue after reserved word error fix courtesy of Dave Shield.
+      - Modification to #2 courtesy of Niels Baggesen.
+      - Modification to print sub-identifier == 0
+      - variable renaming.
+      - Instead of re-ordering all singly-linked lists, use a new member
+        that flags when a report has begun.
+
+hardaker 26 Feb 99 16:06:49
+    - (EXAMPLE.conf.def): update and made better examples.
+
+hardaker 26 Feb 99 16:10:21
+    - (NEWS): update for 3.6 release.
+
+hardaker 26 Feb 99 16:10:47
+    - (snmptrapd.c): usage update, and -H support.
+
+hardaker 26 Feb 99 16:11:49
+    - (Makefile.in, read_config.3.def, snmp.conf.5.def, snmp_config.5.def,
+      snmpd.conf.5.def, snmptrapd.8, snmptrapd.conf.5.def):
+      - new documentation on configuration capabilities.
+
+hardaker 26 Feb 99 16:33:09
+    - (version.h bug-report sedscript.in): version tag ( 3.6.pre9 )
+
+hardaker  1 Mar 99 10:48:03
+    - (UCD-SNMP-MIB.txt): typo: fileMax -> fileErrorFlag name change.
+
+hardaker  1 Mar 99 12:27:12
+    - (snmpd.c): Patch from Mike Slifcak:
+      - renaming of variables away from system function names (index -> lindex).
+
+hardaker  1 Mar 99 12:27:30
+    - (errormib.c): Patch from Mike Slifcak:
+      - remove errno variable.
+
+hardaker  1 Mar 99 12:27:45
+    - (if.c): Patch from Mike Slifcak:
+      - free the interface table.
+
+hardaker  1 Mar 99 12:28:17
+    - (parse.c): Patch from Mike Slifcak:
+      - remove duplicate case entries.
+
+hardaker  1 Mar 99 12:29:05
+    - (snmp_api.c): put a proper (void) into the function prototype.
+
+hardaker  1 Mar 99 12:29:45
+    - (snmp_client.c): Patch from Mike Slifcak:
+      - variable renaming.
+
+hardaker  1 Mar 99 12:30:19
+    - (asn1.h): Patch from Mike Slifcak:
+      - added MIN_OID_LEN for instructional use mostly (its unused).
+
+hardaker  1 Mar 99 13:03:15
+    - (context_parse.c, mib.c): Patch from Michael Slifcak:
+      - typecasting for certain functions to (char *).
+
+hardaker  1 Mar 99 13:59:14
+    - (snmp_vars.c, snmp_vars.h): make compare_tree() global.
+
+hardaker  1 Mar 99 14:04:05
+    - (smux.c, smux.h): Patch from Nick Amato:
+      - completely re-written smux modules.
+
+hardaker  1 Mar 99 14:20:11
+    - (smux.c, smux.h): 3.6ified.
+
+hardaker  1 Mar 99 16:10:57
+    - (alarm.c): Patch from Michael Slifcak:
+      - Cast to pointer to int may overflow the return buffer.
+
+hardaker  1 Mar 99 16:11:49
+    - (Makefile.in): Patch from David F. Newman:
+      - removed a trailing backslash that wasn't needed.
+
+hardaker  1 Mar 99 16:17:36
+    - (mib_api.3, read_config.3.def, snmp.conf.5.def, snmp_config.5.def,
+      snmpd.1.def, snmpd.conf.5.def, snmptest.1, snmptrapd.conf.5.def,
+      variables.5): Michael Slifcak:
+      - spell check.
+
+hardaker  1 Mar 99 16:19:56
+    - (snmp.conf.5.def, snmp_config.5.def, snmpd.1.def, snmptrapd.conf.5.def):
+      - remove reference to ECE dept.
+
+hardaker  1 Mar 99 16:22:40
+    - (asn1.h): put back in MAX_NAME_LEN temporarily.
+
+hardaker  1 Mar 99 17:43:49
+    - (smux.c):
+      - allow null length passwords.
+      - clean up debugging output.
+
+hardaker  2 Mar 99 08:47:29
+    - (asn1.h): Patch from Dave Shield:
+      - Don't define MAX_NAME_LEN if defined somewhere else.
+
+hardaker  2 Mar 99 10:42:34
+    - (system_mib.c, vacm_vars.c, ipfwacc.c): Patch from Michael Slifcak:
+      - Suggested fixes to eliminate more shadowed global references.
+      - fixups for prototype [(void) replacing ()].
+
+hardaker  2 Mar 99 13:23:57
+    - (var_route.c): don't return a pointer to a pointer.
+
+hardaker  2 Mar 99 15:17:53
+    - (acconfig.h, config.h.in, configure, configure.in, snmp_debug.c,
+      snmp_debug.h):
+      - new flag:  --disable-debugging to completely turn off its support.
+      - renaming of DODEBUG to SNMP_ALWAYS_DEBUG.
+      - clean up of the configure script options listed, including putting
+        a list of available modules for compilation into the agent.
+
+hardaker  2 Mar 99 15:18:59
+    - (snmpd.conf.5.def): typo.
+
+hardaker  2 Mar 99 15:21:34
+    - (smux.c): Patch from Michael Slifcak:
+      - Linux compiles die at SO_RCVTIMEO.
+      - -Wall type fixes.
+
+hardaker  3 Mar 99 08:25:33
+    - (README): Added Nick.
+
+hardaker  3 Mar 99 08:28:05
+    - (configure): ran autoconf...
+
+hardaker  3 Mar 99 11:40:11
+    - (proc.c, solaris.h): Patch from Chris Hughes:
+      - Use /proc on solaris.
+
+hardaker  3 Mar 99 17:51:26
+    - (ChangeLog, FAQ, NEWS, PORTING, README, TODO, bug-report, snmpd.c,
+      README.mib2c): ece.ucdavis.edu -> ucd-snmp.ucdavis.edu.
+
+hardaker  3 Mar 99 18:00:51
+    - (NEWS): mention name change.
+
+hardaker  3 Mar 99 18:02:07
+    - (NEWS): mention SMUX.
+
+hardaker  3 Mar 99 18:02:23
+    - (version.h bug-report sedscript.in): version tag ( 3.6.pre10 )
+
+mslifcak  4 Mar 99 04:08:01
+    
+    (snmpnetstat/if.c) - add void to empty formal parameter list
+
+hardaker  4 Mar 99 08:36:39
+    - (versiontag): repository move.
+
+hardaker  4 Mar 99 08:36:46
+    - (README.smux): add Nick.
+
+hardaker  4 Mar 99 09:07:07
+    - (configure.in, configure): fix void test for ansi compilers.
+
+mslifcak  4 Mar 99 09:20:08
+    
+    
+    (agent/snmpd.c, snmplib/snmp_client.c) : remove duplicate includes
+    
+    (agent/mibgroup/target/snmpTargetAddrEntry.c, agent/mibgroup/target/snmpTargetParamsEntry.c, agent/mibgroup/ucd-snmp/memory_solaris2.c, apps/snmptrapd_handlers.c) : change "*word" to "*token" to help some compiler
+
+mslifcak  4 Mar 99 09:24:26
+    
+    
+    (Makefile.in) - find mibdefs.h when not building in the source tree
+
+hardaker  4 Mar 99 09:33:31
+    - (loadave.c): Patch from Chris Hughes:
+      - fix load average on solaris.
+
+hardaker  4 Mar 99 09:38:28
+    - (remove-files, ece-snmpd.conf, fixproc.conf):
+      - removed ece specific config files from the repository.
+      - don't remove local/*.conf in the first place anymore.
+
+hardaker  4 Mar 99 09:46:37
+    - (hr_swinst.c): Patch from mslifcak@iss.net:
+      - When the agent is compiled with HAVE_LIBRPM set, yet no database
+        is found, agent will core...
+
+hardaker  4 Mar 99 13:18:47
+    - (acconfig.h, config.h.in, configure, configure.in): removed void check.
+
+mslifcak  4 Mar 99 15:13:00
+    
+    
+    (hr_proc.c, loadave.c) - fixed core on getloadavg in a different way
+
+mslifcak  4 Mar 99 15:25:53
+    
+    (disk.c) - explicit braces to avoid ambiguous `else'
+
+mslifcak  4 Mar 99 15:29:24
+    
+    (hr_disk.c) - conditionally use defined DKC disk types
+
+hardaker  4 Mar 99 15:45:02
+    - (util_funcs.c, util_funcs.h, example.c, sysORTable.c, ipfwacc.c,
+      disk.c, extensible.c, file.c, loadave.c, memory.c, proc.c, vmstat.c,
+      vmstat_freebsd2.c):
+      - create and use header_simple_table to replace checkmib().
+
+hardaker  4 Mar 99 16:14:16
+    - (README.smux): Patch from Nick Amato:
+      - update.
+
+hardaker  4 Mar 99 16:26:26
+    - (freebsd2.h): Patch from Nick Amato:
+      - fixes for duplicate defines.
+
+hardaker  4 Mar 99 16:32:16
+    - (mib2c): Update from Dave Shield.
+
+hardaker  4 Mar 99 16:50:16
+    - (util_funcs.c, dummy.c, example.c, wombat.c, tcp.c, hpux.c,
+      memory.c, alarm.c, snmp_api.c):
+      - misc fixes, -Wall mostly.
+
+mslifcak  4 Mar 99 17:00:50
+    
+    (sysORTable.c) - remove static u_long long_return, for consistency.
+
+mslifcak  4 Mar 99 17:07:10
+    
+    (solaris.h) - undo _SLASH_PROC_METHOD_ : another time
+
+mslifcak  4 Mar 99 17:50:29
+    
+    Replace uses of bzero with memset, bcopy with memcpy.
+    Fix prototypes.
+
+mslifcak  4 Mar 99 18:11:37
+    
+    (snmp_api.c) - expose snmp_free; snmp_pdu_add_variable returns ptr to var for
+    future improved error recovery.
+
+mslifcak  5 Mar 99 09:40:11
+    
+    Fix Win32 version of gettimeofday : tv_usec was millisecs , return now = 0
+
+hardaker  5 Mar 99 10:11:29
+    - (mib2c, mib2c.conf): Patch from Dave Shield:
+      - the use of 'header_simple_table' rather than 'checkmib'
+      - explicit comparison with MATCH_FAILED
+      - don't set defaults for 'write_method' and 'var_len'
+    		(since both 'header_generic' and 'checkmib' do this anyway)
+      - Use defined constants for variable initialisation in the
+    		write routine (similarly in the mib2c.conf patch)
+          [This is one of my hobby-horses with our students, so I don't
+    		 see why "professional" programmers should be exempt!]
+    
+      - Make proper use of the three-phase nature of SETs
+
+hardaker  5 Mar 99 10:21:25
+    - (FAQ): update from Dave: rearranging and cleaning.
+
+hardaker  5 Mar 99 10:42:40
+    - (snmp_agent.c): Patch from Dave Shield:
+      - switch COMMIT and ACTION phases.
+
+mslifcak  5 Mar 99 11:02:34
+    
+    (tcp.c) - break out of infinite loop when klookup fails.
+
+hardaker  5 Mar 99 15:13:02
+    - (acconfig.h, config.h.in, configure, configure.in):
+      - remove persistent storage info, since its not used this release.
+
+hardaker  5 Mar 99 15:31:52
+    - (snmp_impl.h): create UNDO
+
+hardaker  5 Mar 99 15:38:32
+    - (tkmib): update.
+
+hardaker  5 Mar 99 15:57:36
+    - (kernel_sunos5.c, wombat.c, hr_network.c, snmp_mib.h, system_mib.h,
+      disk.h, errormib.h, extensible.h, file.h, memory_solaris2.h, pass.h,
+      proc.h, registry.h, versioninfo.h):
+      - -Wall fixes, mostly init_() routines declaired in the appropriate .h files.
+
+hardaker  5 Mar 99 16:02:06
+    - (configure, configure.in): updated --help's module list.
+
+hardaker  5 Mar 99 16:10:30
+    - (vmstat.h): declair init_vmstat().
+
+hardaker  5 Mar 99 17:08:21
+    - (FAQ): reference AGENT document.
+
+hardaker  5 Mar 99 17:11:48
+    - (mibII/system.h): removed
+
+hardaker  5 Mar 99 17:19:14
+    - (FAQ, NEWS): final updates.
+
+
+
+-------------------------------------------------------------------------------
+
+Changes: V3.5.2 -> V3.5.3
+
+hardaker 12 Sep 98 09:02:37
+    - (snmp_api.c): Patch from Michael Slifcak:
+      - bug fix to check for NULL session pointer before using it.
+
+hardaker 20 Sep 98 11:47:17
+    - (snmp_agent.c): if a mib module returns an error > SNMP_GEN_ERR,
+      translate the error to SNMP_GEN_ERR for v1 requests.
+
+hardaker 21 Sep 98 11:13:19
+    - (snmp_vars.c): finally fixed the write_method's for creation problem.
+
+hardaker 25 Sep 98 16:53:31
+    - (EXAMPLE.conf.def): update.
+
+hardaker 25 Sep 98 17:02:39
+    - (configure, configure.in): perl eq -> test = (opps).
+
+hardaker 25 Sep 98 17:08:25
+    - (parse.c): Patch from Michael Slifcak:
+      - check for a null name.
+
+hardaker 25 Sep 98 17:42:10
+    - (parse.c): Patch from Joe Marzot:
+      - use a memset to zero out new pointers instead of doing it by hand.
+
+hardaker 28 Sep 98 13:09:06
+    - (interfaces.c): don't use a & on osf3 for arpcom.ac_enaddr.
+
+hardaker 28 Sep 98 13:09:45
+    - (snmp_api.c): typecast the default community string to (u_char *).
+
+hardaker 28 Sep 98 15:42:21
+    - (memory.c): /etc/swapinfo -> /usr/sbin/swapinfo for hpux10.
+
+-------------------------------------------------------------------------------
+
+Changes: V3.5.1 -> V3.5.2
+
+hardaker  8 Sep 98 09:26:13
+    - (NEWS): update.
+
+hardaker  8 Sep 98 09:33:25
+    - (ChangeLog): update for 3.5.1.
+
+hardaker  8 Sep 98 09:35:55
+    version tag ( 3.5.1 )
+
+hardaker  9 Sep 98 09:45:24
+    - (Makefile.in): Put an @ sign in front of the last echo line.
+
+hardaker  9 Sep 98 09:46:35
+    - (memory.c, memory.h, memory_freebsd2.c, memory_freebsd2.h):
+      - Change all instances of USED -> AVAIL since thats really what
+        we're reporting.
+
+hardaker  9 Sep 98 09:50:22
+    - (memory.c, memory.h, memory_freebsd2.c, memory_freebsd2.h):
+      - correct work I stupidly made when tired.
+
+hardaker  9 Sep 98 11:00:44
+    - (NEWS): update for 3.5.2.
+
+marz  9 Sep 98  18:31:00
+    - (snmptrap.c, snmptest.c): add SOCK_ macros for win32 support
+	
+-------------------------------------------------------------------------------
+	
+Changes: V3.5 -> V3.5.1
+
+hardaker 22 Jun 98 09:16:32
+    - (main.c): Patch from Jerry G. DeLapp:
+      - commented out trailing #endif comment.
+
+hardaker 24 Jun 98 10:30:19
+    - (Makefile.in): man->html make specification.
+
+hardaker 24 Jun 98 11:08:41
+    - (UCD-SNMP-MIB.txt): Patch from Niels Baggesen:
+      - shutdown trap specifications.
+      - misc mib fixes.
+
+hardaker 26 Jun 98 10:42:32
+    - (disk.c): Patch from Michael Douglass:
+      - fix calculation of totaldisk by doing block division first to
+        protect against 32 bit overflows.
+
+hardaker 26 Jun 98 10:45:15
+    - (smux.c, snmp_bgp.c, snmp_ospf.c, snmp_rip2.c, snmp_rip2.h): Patch
+      from Niels Baggesen:
+      - Fix for new defines and proper header includes.
+
+hardaker 26 Jun 98 15:03:38
+    - (generic.h): put in a comment to keep compilers from complaining too much.
+
+hardaker  8 Jul 98 12:26:25
+    - (freebsd2.h): use _UTMP_PATH if available.
+
+hardaker  8 Jul 98 12:26:34
+    - (irix.h): define _KMEMUSER
+
+hardaker  8 Jul 98 12:27:12
+    - (win32.opt, libsnmp.dsp, libsnmp.plg, libsnmp.def, libsnmp_dll.plg,
+      snmpbulkwalk.dsp, snmpbulkwalk.plg, snmpget.dsp, snmpget.plg,
+      snmpgetnext.dsp, snmpgetnext.plg, snmpset.dsp, snmpset.plg,
+      snmpstatus.dsp, snmpstatus.plg, snmptranslate.dsp,
+      snmptranslate.plg, snmpwalk.dsp, snmpwalk.plg): Patch from Joe
+      Marzot:
+      - win32 update.
+
+hardaker  8 Jul 98 12:58:03
+    - (snmp_api.c): Patch from Joe Marzot:
+      - fix "number of retries" bug.
+      - remove odd timeout calculation code for retries > 3.
+hardaker  8 Jul 98 13:02:06
+    - (interfaces.c): make hp_interfaces structure static.
+
+hardaker  8 Jul 98 13:03:36
+    - (system.c): don't free env pointers that are created.
+
+hardaker  8 Jul 98 13:08:18
+    - (UCD-SNMP-MIB.txt): Patch from Niels Baggesen:
+      - fix for missing object identifier labels.
+
+hardaker  8 Jul 98 14:43:56
+    - (snmp_vars.c): include fixes.
+hardaker  8 Jul 98 14:44:34
+    - (pass.c): include sys/wait.h
+
+hardaker  8 Jul 98 14:44:41
+    - (versioninfo.c): include system.h
+
+hardaker  8 Jul 98 14:45:22
+    - (parse.c): include snmp_api.h
+
+hardaker  8 Jul 98 14:45:42
+    - (snmp_api.c): include fixes.
+
+hardaker 15 Jul 98 15:46:28
+    - (sedscript.in): using_module changes.
+
+hardaker 15 Jul 98 15:46:55
+    - (memory.h): MEMSWAPMINIMUM wasn't being used.
+
+hardaker 17 Jul 98 13:11:10
+    - (UCD-SNMP-MIB.inc, UCD-SNMP-MIB.txt):
+      - created smicng input file.
+      - fixed the UCD-SNMP mib to deal with most smic errors.
+
+hardaker 17 Jul 98 13:22:32
+    - (RFC-1215.txt): created an empty mib module for importing of TRAP-TYPE.
+
+hardaker 17 Jul 98 16:59:51
+    - (*): update for 3.5.1.
+
+hardaker 20 Jul 98 17:14:21
+    - (snmpcheck.def): work around for new multi-depth mib tables..
+
+hardaker 22 Jul 98 15:35:07
+    - (mib.c): don't change running environment variables with strtok.
+
+hardaker 22 Jul 98 16:23:45
+    - (Makefile.in, sedscript.in): fix sedscript includes.
+
+hardaker 24 Jul 98 09:25:33
+    - (disk.c): increment index by 1 so it doesn't start at 0.
+
+hardaker 24 Jul 98 10:02:14
+    - (snmpd.conf.5.def): various documenation updates and notes.
+
+hardaker 24 Jul 98 10:02:25
+    - (snmptranslate.1): nroff error.
+
+hardaker 24 Jul 98 10:25:44
+    - (snmptrapd.8): brought up to date.
+
+hardaker 24 Jul 98 12:10:07
+    - (snmp.c): include sys/select.h for AIX.
+
+hardaker 24 Jul 98 12:24:22
+    - (acl.h, asn1.h, md5.h, mib.h, parse.h, snmp.h, snmp_api.h,
+      snmp_client.h, snmp_impl.h, vacm.h, view.h):
+      - protect against multiple inclusions.
+
+hardaker 29 Jul 98 13:44:22
+    - (Makefile.in): make install should do a real make all first.
+
+hardaker 12 Aug 98 15:57:18
+    - (snmp_vars.c): ifdef fixes for v2part modules.
+
+hardaker 12 Aug 98 15:57:42
+    - (extensible.c, proc.c): fixit problems with array index wrong.
+
+hardaker 12 Aug 98 15:57:52
+    - (libsnmp.def): find_module added.
+
+hardaker 12 Aug 98 16:05:28
+    - (configure, configure.in):
+      - libwrap command line fixes.
+      - --with-ldflags command line option created.
+
+hardaker 12 Aug 98 16:55:32
+    - (mib_api.3, snmpd.1.def, variables.5): updates to remove mib.txt references.
+
+hardaker 12 Aug 98 16:58:11
+    - (acconfig.h, config.h.in, configure, configure.in):
+      - don't include libraries that aren't needed if gethostbyname isn't in one.
+
+hardaker 12 Aug 98 16:59:50
+    - (snmp_impl.h): Patch from Michael Slifcak:
+      - fix the ERROR_MSG() macro to use snmp_set_detail.
+
+hardaker 14 Aug 98 08:21:44
+    - (snmp_parse_args.c, snmptranslate.c): usage fixes and -m/-M to snmptranslate.
+
+hardaker 14 Aug 98 08:42:49
+    - (auto_nlist.c): fix for stupid aix kernels.
+
+hardaker 14 Aug 98 08:44:07
+    - (ucd_snmp.h, memory_freebsd2.c, vmstat_freebsd2.c): Patch from Jonas Olsson:
+      - make the memory and vmstat module work under freebsd2.
+
+hardaker 14 Aug 98 08:44:07
+    file memory_freebsd2.c was initially added on branch Ext-3-5-patches.
+
+hardaker 14 Aug 98 08:44:07
+    file vmstat_freebsd2.c was initially added on branch Ext-3-5-patches.
+
+hardaker 14 Aug 98 08:44:29
+    - (README): Added two new names to the thankyou list.
+
+hardaker 14 Aug 98 08:44:37
+    - (sedscript.in): correct include files.
+
+hardaker 14 Aug 98 08:44:52
+    - (Makefile.in): CPP needs to check agent/mibgroup for headers.
+
+hardaker 14 Aug 98 08:52:32
+    - (mib.c, parse.c): Patch from Dave Shield:
+      - adopt unknown children into the correct place if IMPORTS are screwed up.
+
+hardaker 14 Aug 98 09:32:45
+    - (snmptranslate.c): Patch from James H. Young:
+      - usage output clean up.
+
+hardaker 14 Aug 98 10:13:13
+    - (COPYING): copyright change.
+
+hardaker 14 Aug 98 10:14:06
+    - (parse.c): Patch from Niels Baggesen:
+      - Malloc -> xmalloc.
+      - parser changes.
+
+hardaker 14 Aug 98 10:14:59
+    - (at.c): fixes for linux.
+
+hardaker 31 Aug 98 13:03:02
+    - (interfaces.c): missing return on ifInErrors results.
+
+hardaker 31 Aug 98 13:32:43
+    - (snmptrapd.c): add a blank line to the end of the trapd output for parsing.
+
+hardaker 31 Aug 98 16:10:25
+    - (snmp_vars.c): in_a_view(): create new function, and use it.
+
+hardaker 31 Aug 98 16:10:50
+    - (snmp_agent.c, snmp_impl.h): fix read/write checks.
+
+hardaker 31 Aug 98 13:03:02
+    - (interfaces.c): missing return on ifInErrors results.
+
+hardaker 31 Aug 98 13:32:43
+    - (snmptrapd.c): add a blank line to the end of the trapd output for parsing.
+
+hardaker 31 Aug 98 16:10:25
+    - (snmp_vars.c): in_a_view(): create new function, and use it.
+
+hardaker 31 Aug 98 16:10:50
+    - (snmp_agent.c, snmp_impl.h): fix read/write checks.
+
+hardaker 31 Aug 98 16:37:04
+    - (ChangeLog, NEWS): update for 3.5.1.
+
+hardaker 31 Aug 98 16:37:15
+    version tag ( 3.5.1.pre1 )
+
+hardaker  2 Sep 98 10:55:52
+    - (configure, configure.in, read_config.c, snmp2p.c, snmp_agent.c,
+      snmp_vars.c, snmpd.c, snmpd.h, util_funcs.c, interfaces.c, system.h,
+      tcp.c, smux.c, snmp_bgp.c, snmp_bgp.h, snmp_ospf.c, snmp_ospf.h,
+      snmp_rip2.c, snmp_rip2.h, extensible.c, loadave.c,
+      snmp_parse_args.c, snmpdelta.c, snmptranslate.c, snmptrap.c,
+      snmptrapd.c, inet.c, main.c, netstat.h, mib_api.3, snmp_api.3,
+      snmpd.1.def, freebsd.h, freebsd2.h, netbsd.h, asn1.h, mib.c,
+      parse.c, parse.h, snmp_api.c, snmp_api.h, snmp_client.c): Patch from
+      Niels Baggesen:
+      - prototypes, as usual (when is everybody starting to use -Wall
+        -Wstrict-prototypes ....)
+      - snmpd send an enterprise specific trap when it terminates
+      - possibility for sending v2c traps (or informs), via trap2sink directive
+      - fixes to snmplib and snmptrapd for bugs uncovered when snmpd sends
+        an INFORM instead of a TRAP
+      - -m and -M option for snmptrapd
+      - -D option for snmptranslate
+      - fixes to configure to correctly call ALL module init functions
+      - major rework of tcp.c, for netbsd. I hope this is OK now, I havent had
+        time to test it on all platforms yet - but till friday :-)
+      - snmpnetstat prints udp socket table
+      - some CMU_COMPATIBLE stuff
+      - man page fixes, with an include list that works!
+
+hardaker  2 Sep 98 10:58:10
+    - (tcp.c): Patch from Dave Shield:
+    -  Combine the two (almost) identical non-solaris cases
+    -  Add support for the missing Linux entries (InErrs/OutRsts)
+    -  Add support for the missing Solaris entry (OutRsts)
+
+hardaker  2 Sep 98 11:03:33
+    - (tcp.c): reverse Dave's changes since they conflict with Niels'.
+
+hardaker  2 Sep 98 12:19:03
+    - (extensible.c, proc.c): use correct name index for lookups on writes.
+
+hardaker  2 Sep 98 12:19:33
+    - (snmp_agent.c): check to make sure operation is not a SET when
+      returning an error code such as noSuchName.
+
+hardaker  2 Sep 98 14:04:42
+    - (configure, configure.in): don't include modules not requested even
+      if required by another module.
+
+hardaker  2 Sep 98 14:10:53
+    version tag ( 3.5.1.pre2 )
+
+hardaker  2 Sep 98 18:43:30
+    - (TODO): added security checks.
+
+nba  3 Sep 98 14:29:03
+    - (fixproc): added comment to test CVS.
+
+hardaker  4 Sep 98 10:09:47
+    - (interfaces.c): fix for sgi's.
+
+hardaker  4 Sep 98 14:14:19
+    - (configure, configure.in, Makefile.in, Makefile.in):
+      - fix to allow non-source directory builds.
+
+hardaker  7 Sep 98 10:10:05
+    - (loadave.c): Patch from Niels Baggesen:
+      - ifdef re-ordering fixes for alpha/linux.
+
+hardaker  7 Sep 98 10:47:00
+    - (proc.c): Patch from Michael Slifcak:
+      - solaris 2.6 fixes.
+
+hardaker  7 Sep 98 10:48:09
+    - (asn1.c): Patch from Michael Slifcak:
+      - Catch subidentifier correctly.
+
+hardaker  7 Sep 98 10:49:08
+    - (asn1.h): remove __P() definition.
+
+hardaker  7 Sep 98 10:49:53
+    - (mib.c): Patch from Michael Slifcak:
+      - malloc corrections for ENV vars..
+
+hardaker  7 Sep 98 10:51:22
+    - (parse.c): Patch from Michael Slifcak:
+      - protect against multiple init_mib_internal() calls.
+
+hardaker  7 Sep 98 10:53:11
+    - (system.c): Patch from Michael Slifcak:
+      - exit -> return on win32 system routines.
+
+hardaker  7 Sep 98 10:55:51
+    - (snmp_api.c): Patch from Michael Slifcak:
+      - NULL return by malloc protected.
+
+hardaker  7 Sep 98 12:17:36
+    - (snmpd.conf.5.def): Patch from Niels Baggesen:
+      - better description of the view mask.
+
+hardaker  7 Sep 98 12:27:42
+    - (memory_freebsd2.h, vmstat_freebsd2.h): created from memory.h and vmstat.h
+
+hardaker  7 Sep 98 12:27:42
+    file memory_freebsd2.h was initially added on branch Ext-3-5-patches.
+
+hardaker  7 Sep 98 12:27:42
+    file vmstat_freebsd2.h was initially added on branch Ext-3-5-patches.
+
+hardaker  7 Sep 98 12:47:37
+    - (parse.c): include snmp_api.h for snmp_get_do_debugging().
+
+hardaker  7 Sep 98 12:54:16
+    - (snmp_api.c): Patch from Michael Slifcak:
+      - check malloc calls more carefully.
+      - misc bug fixes.
+
+hardaker  7 Sep 98 13:15:26
+    - (Makefile.in): install config.h as $(includedir)/ucd-snmp-config.h.
+
+hardaker  7 Sep 98 13:21:18
+    - (memory.c, memory.h):
+      - MEMUSEDREAL -> MEMAVAILREAL (typedef renaming to match functionality).
+
+hardaker  7 Sep 98 14:06:21
+    - (tcp.c): back out Niels' changes since they broke other architectures.
+
+hardaker  7 Sep 98 14:19:24
+    - (Makefile.in(s)): make depends.
+
+hardaker  7 Sep 98 16:39:59
+    - (icmp.c, interfaces.c, ip.c, tcp.c): 64bit long return clean ups.
+
+marz  7 Sep 98 19:01:01
+    update headers for win32, add return to main
+
+marz  7 Sep 98 19:02:01
+    update headers for win32, add return to main,fix win32 compile error w/ non integralswitch case
+
+marz  7 Sep 98 19:03:33
+    update headers for win32, add return to main, resolve conflict w/ std lib log function
+
+marz  7 Sep 98 19:30:11
+    rename and static link debug targets, dll to bin dir, added snmptest, snmptrap, snmpdelta projects
+
+marz  7 Sep 98 19:42:35
+    file snmpdelta.dsp was initially added on branch Ext-3-5-patches.
+
+marz  7 Sep 98 19:42:35
+    file snmpdelta.plg was initially added on branch Ext-3-5-patches.
+
+marz  7 Sep 98 19:42:35
+    file snmptest.dsp was initially added on branch Ext-3-5-patches.
+
+marz  7 Sep 98 19:42:35
+    file snmptest.plg was initially added on branch Ext-3-5-patches.
+
+marz  7 Sep 98 19:42:35
+    file snmptrap.dsp was initially added on branch Ext-3-5-patches.
+
+marz  7 Sep 98 19:42:35
+    file snmptrap.plg was initially added on branch Ext-3-5-patches.
+
+marz  7 Sep 98 19:42:35
+    rename and static link debug targets, dll to bin dir, added snmptest, snmptrap, snmpdelta projects
+
+hardaker  8 Sep 98 09:26:13
+    - (NEWS): update.
+
+-------------------------------------------------------------------------------
+
+Changes: V3.4 -> V3.5
+
+hardaker 24 May 98 15:22:21
+    - (FAQ): update to change a few things.
+
+hardaker 24 May 98 15:22:38
+    - (NEWS): change vacm news wording.
+
+hardaker 24 May 98 15:22:57
+    - (ip.c): Patch from Niels Baggesen:
+      - fix for netbsd < 1.3.
+
+hardaker 29 May 98 10:14:32
+    - (at.c): Patch from Chris Smith: fix for irix.
+
+hardaker 29 May 98 10:24:54
+    - (snmp_api.c, snmp_impl.h): Patch from Joe Marzot:
+      - fix community name length problems and increase size.
+
+hardaker 29 May 98 11:26:47
+    - (configure.in): patch from Niels: include sys/socket in if_mtu test.
+
+hardaker 29 May 98 11:27:59
+    - (configure): make of configure.
+
+hardaker 29 May 98 11:34:53
+    - (configure, configure.in, Makefile.in):
+      - Add a dependancy line for snmp_vars.o for all the module includes.
+
+hardaker 29 May 98 15:20:53
+    - (TODO): winSNMP mention.
+
+hardaker 29 May 98 15:21:13
+    - (snmp_parse_args.c): add ability to specify mib information on the cmd line.
+
+hardaker 29 May 98 16:21:08
+    - (configure, configure.in, agent/mibgroup/*):
+      - moved most mibgroup pieces into relevent sub-directories.
+        - changed all header file and #ifdef USING_* lines to reflect this.
+
+hardaker 29 May 98 16:21:51
+    - (snmp_impl.h): change pdu version from long to int.
+
+hardaker 31 May 98 17:55:45
+    - (asn1.c, asn1.h, int64.c, int64.h, mib.c, snmp.c, snmp_api.c,
+      snmp_api.h, snmp_impl.h):
+      - implement special data types via opaques: float, double, int64, uint64s.
+
+hardaker 31 May 98 17:56:07
+    - (snmpset.c): enable setting of opaque floats, doubles, int64s, uint64s.
+
+hardaker 31 May 98 17:56:55
+    - (acconfig.h, config.h.in, configure, configure.in):
+      - make it possible not to use opaque special types with new cmd line flag.
+
+hardaker  2 Jun 98 14:23:15
+    - (auto_nlist.c, auto_nlist.h, kernel.c, snmp_agent.c, snmpd.c,
+      hr_device.c, hr_disk.c, hr_filesys.c, hr_network.c, hr_other.c,
+      hr_partition.c, hr_print.c, hr_proc.c, hr_storage.c, hr_swinst.c,
+      hr_swrun.c, hr_system.c, hr_utils.c, at.c, interfaces.c,
+      var_route.c, snmp_parse_args.c, snmpdelta.c, snmptable.c,
+      snmptranslate.c, snmptrapd.c, freebsd2.h, hpux.h, linux.h, netbsd.h,
+      solaris.h, sysv.h, asn1.c, mib.c, parse.c, parse.h, snmp_auth.c,
+      snmp_impl.h): Patch from Niels Baggensen:
+      - make host resources work under NetBSD, FreeBSD, Solaris and Linux.
+        - SunOS4 almost works.
+      - Add -s/-S to command line options for printing of shorter oids.
+      - numerous bug fixes.
+
+hardaker  3 Jun 98 10:51:10
+    - (smux.c, smux.h, smux_gated.h, snmp_bgp.c, snmp_bgp.h, snmp_ospf.c,
+      snmp_ospf.h, snmp_rip2.c, snmp_rip2.h, smux.c, smux.h, snmp_bgp.c,
+      snmp_bgp.h, snmp_ospf.c, snmp_ospf.h, snmp_rip2.c, snmp_rip2.h):
+      - moved smux stuff into a smux sub-directory.
+
+hardaker  3 Jun 98 10:58:15
+    - (ipfwacc.c, ipfwacc.h, IPFWACC-MIB.txt, UCD-SNMP-MIB.txt):
+      - moved ipfwacc to ucdavis.13 and removed ^Ms and some blank lines.
+
+hardaker  3 Jun 98 10:58:44
+    - (INSTALL): mention ipfwacc
+
+hardaker  3 Jun 98 10:58:59
+    - (README): mention Cristian Estan in the coders list.
+
+hardaker  3 Jun 98 11:06:47
+    - (example.c, example.h, dlmod.c, dlmod.h): Patch from Eugene Polovnikov:
+      - implement a dynamic loading module for loading shared object mib modules.
+
+hardaker  3 Jun 98 11:10:48
+    - (README, example.c, example.h, wombat.c, wombat.h, example.c,
+      example.h, wombat.c, wombat.h):
+      - moved wombat and example to examples/ directory.
+
+hardaker  3 Jun 98 11:27:27
+    - (snmp_agent.c, snmpd.c): include mibII/snmp_mib.h.
+
+hardaker  3 Jun 98 11:29:04
+    - (mib.c): missed a needed OPAQUE_SPECIAL_TYPES ifdef.
+
+hardaker  3 Jun 98 12:17:00
+    - (snmp_agent.c, snmp_api.c, snmp_auth.c, snmp_impl.h):
+      - fix pdu->versions to be all ints.
+
+hardaker  3 Jun 98 13:39:12
+    - (configure, configure.in): New flags:
+      - --with-cc=CC
+      - --with-cflags=CFLAGS
+
+hardaker  3 Jun 98 13:43:47
+    - (config.h.in, configure, configure.in, snmptrapd.c):
+      - check for getdtablesize and use a generic if not available.
+
+hardaker  3 Jun 98 13:52:28
+    - (config.h.in, configure, configure.in, freebsd2.h):
+      - move configurable defines to configure rather than in freebsd2.h.
+
+hardaker  3 Jun 98 13:55:40
+    - (i386.h, i586.h, i686.h): removed these (unused) headers.
+
+hardaker  3 Jun 98 14:02:34
+    - (configure, configure.in): fix new --with-cc and --with-cflags arguments.
+
+hardaker  3 Jun 98 14:21:10
+    - (hr_disk.c, hr_swinst.c, hr_swrun.c, hr_system.c, snmpset.c, asn1.h,
+      int64.c, int64.h, mib.c, snmp_api.c):
+      - -Wall fixes.
+
+hardaker  3 Jun 98 14:23:14
+    - (Makefile.in's): make depend.
+
+hardaker  3 Jun 98 14:24:58
+    - (Makefile.in): read_config.o is mibmodule header dependant too.
+
+hardaker  3 Jun 98 14:26:10
+    version tag ( 3.5.pre1 )
+
+hardaker  5 Jun 98 10:52:11
+    - (configure, configure.in): Patch from Niels Baggesen:
+      - test for setenv.
+
+hardaker  5 Jun 98 10:52:40
+    - (maketarget): Patch from Niels Baggesen:
+      - support for larger tree depths.
+
+hardaker  5 Jun 98 10:54:31
+    - (asn1.c, mib.c, parse.h, system.c, system.h): Patch from Niels Baggesen:
+      - MIB_ACCESS define changes.
+      - setenv implementation.
+      - ifdef wrappers for OPAQUE_SPECIAL_TYPES.
+
+hardaker  8 Jun 98 10:50:12
+    - (FAQ): url type splitting.
+
+hardaker  8 Jun 98 12:34:09
+    - (Makefile.in): create a .c -> .o rule to make sure and place the
+      object files in the appropriate subdirectories.
+
+hardaker  8 Jun 98 13:59:08
+    - (README): Added Eugene's name.
+
+hardaker  8 Jun 98 13:59:25
+    - (snmpd.conf.5.def): update rfc # for vacm reference.
+
+hardaker  8 Jun 98 14:12:37
+    - (Makefile.in): Patch from Joe Marzot:
+      - remove more config created headers on make configclean.
+
+hardaker  8 Jun 98 14:16:26
+    - (libsnmp.def): Patch from Joe Marzot: w32 update.
+
+hardaker  8 Jun 98 14:22:50
+    - (parse.c, parse.h, snmp_api.c, snmp_api.h, snmp_client.c): Patch
+     from Joe Marzot:
+      - async stuff added.
+      - get_tc added.
+      - better comments in some places.
+
+hardaker  8 Jun 98 14:55:53
+    - (snmp_api.c): undid redo of comment of gettimeofday().
+
+hardaker 10 Jun 98 07:11:44
+    - (config.h.in): have_setenv.
+
+hardaker 10 Jun 98 08:53:53
+    - (Makefile.in, snmp2p.c, snmpd.c): Patch from Dave Shield:
+      -  starts to separate out the historic SNMPv2 stuff.
+      -  does a bit of 'code tidying'.
+      -  starts to move towards port-specific handlers.
+
+hardaker 10 Jun 98 14:15:47
+    version tag ( 3.5.pre2 )
+
+hardaker 10 Jun 98 15:30:59
+    - (TODO): added Dave's list.
+
+hardaker 10 Jun 98 15:31:12
+    - (NEWS): update.
+
+hardaker 10 Jun 98 15:47:59
+    - (snmp2p.c, snmpd.c, snmpd.h): -Wall cleanups.
+
+hardaker 12 Jun 98 08:52:28
+    - (EXAMPLE.conf.def, FAQ): Patch from Dave Shield:
+      - update for VACM stuff.
+
+hardaker 12 Jun 98 10:12:27
+    - (EXAMPLE.conf.def): show vacm example for public/private from anywhere.
+
+hardaker 12 Jun 98 10:12:40
+    - (NEWS): minor update.
+
+hardaker 12 Jun 98 13:13:12
+    - (snmp_api.c): trap types were int's not longs (failed under 64bit arch).
+
+hardaker 12 Jun 98 13:13:27
+    - (parse.c): function name typo.
+
+hardaker 12 Jun 98 13:13:39
+    - (win32/config.h): don't have setenv.
+
+hardaker 12 Jun 98 13:13:57
+    - (libsnmp.def): add setenv to the list.
+
+hardaker 12 Jun 98 13:43:41
+    - (NEWS): 64bit fix mentioned.
+
+hardaker 12 Jun 98 13:48:21
+    - (kernel.c): don't print klread errors unless in debugging mode.
+
+hardaker 12 Jun 98 15:17:47
+    - (ipfwacc.h, IPFWACC-MIB.txt, UCD-SNMP-MIB.txt):
+      - create and use a ucdExperimental section for the ipfwacc mib till
+        it stabilizes.
+
+hardaker 17 Jun 98 08:08:23
+    - (snmp2p.c, snmpd.c, snmpd.h): Patch from Niels Baggesen:
+      - misc type fixes.
+
+hardaker 17 Jun 98 08:08:58
+    - (snmpdelta.c): usage() update.
+
+hardaker 17 Jun 98 08:10:02
+    - (Makefile.in, snmpbulkwalk.1, snmpcmd.1, snmpdelta.1, snmpget.1,
+      snmpgetnext.1, snmpset.1, snmpstatus.1, snmptable.1, snmptrap.1,
+      snmpwalk.1): Patch from Niels Baggesen:
+      - documentation cleanup and centralization of common options.
+
+hardaker 17 Jun 98 08:10:54
+    - (asn1.c): Patch from Niels Baggesen:
+      - bcopy -> memcpy.
+
+hardaker 17 Jun 98 08:11:22
+    - (mib.h): Patch from Niels Baggesen:
+      - remove 2nd init_mib() prototype.
+
+hardaker 17 Jun 98 08:21:53
+    - (README, AddModuleForDummies.txt, DUMMY-MIB.txt, dummy.c, dummy.h):
+      Patch from Jakob Ellerstedt:
+      - mib module documentation and example for dummies.
+
+hardaker 17 Jun 98 15:27:13
+    - (README): mention dummy group.
+
+hardaker 19 Jun 98 08:41:00
+    - (FAQ): update from Dave Shield: not found modules with configure?.
+
+hardaker 19 Jun 98 08:46:31
+    - (configure, configure.in): warn BSDI users against /usr/ucb/cc.
+
+hardaker 19 Jun 98 08:58:05
+    - (EXAMPLE.conf.def): Patch from Cristian Estan:
+      - example output corrections.
+
+hardaker 19 Jun 98 08:59:53
+    - (Makefile.in): Patch from Cristian Estan:
+      - install IPFWACC mib.
+
+hardaker 19 Jun 98 12:03:48
+    - (snmp_vars.c): fix register_mib() to init pointers to null.
+
+hardaker 19 Jun 98 12:50:55
+    - (util_funcs.c): fix checkmib() in case we get called on a get when
+      we really shouldn't (bad artifact of new tree structure).
+
+hardaker 19 Jun 98 12:53:22
+    - (snmp_vars.c): memset to 0 the entire subtree struct.
+
+hardaker 19 Jun 98 13:01:47
+    - (Makefile.in): make depend.
+
+hardaker 19 Jun 98 13:12:55
+    - (NEWS): Last update for 3.5.
+
+-------------------------------------------------------------------------------
+
+Changes: V3.3 -> V3.4
+
+hardaker  1 Dec 97 12:44:24
+    - (*): 3.3.1 branch merged into main development branch.
+
+hardaker  5 Dec 97 08:46:50
+    - (snmp_api.h): Patch from Niels Baggesen:
+      - make trap variables long's not ints for 64bit machines to match
+        asn_build_int functions.
+
+hardaker  5 Dec 97 11:58:52
+    - (apps/*.c): support random access requests on all apps via -R switch.
+
+hardaker  5 Dec 97 14:30:06
+    - (configure, configure.in): warn instead of error for config_require macro's.
+
+hardaker 15 Dec 97 11:08:01
+    - (acconfig.h, config.h.in, configure, configure.in):
+      - new macro to change default MIBS when modules are compiled:
+        config_add_mib().
+
+hardaker 15 Dec 97 11:08:19
+    - (host.h, ucd_snmp.h, v2party.h):
+      - use config_add_mib().
+
+hardaker 15 Dec 97 11:14:18
+    - (at.c, example.c, hr_proc.c, hr_storage.c, hr_swrun.c, hr_system.c,
+      icmp.c, interfaces.c, interfaces.h, ip.c, loadave.c, memory.c,
+      route_write.c, tcp.c, udp.c, var_route.c, wombat.c, common_header.h):
+      - Patch from Simon Leinen to improve irix 6.2 support.
+
+hardaker 15 Dec 97 15:07:26
+    - (UCD-fields, oid_to_sym.in, oid_to_type.in): Patch from TANAKA Takashi:
+      - support more OS types in the ov/ directory files.
+      - mistake:  bsdi was getting defined as irix.
+      - don't core dump on -v without any arguments.
+
+hardaker 15 Dec 97 15:07:59
+    - (UCD-fields, oid_to_sym.in, oid_to_type.in, snmp_parse_args.c, acconfig.h):
+      - Patch from TANAKA Takashi:
+        - support more OS types in the ov/ directory files.
+        - mistake:  bsdi was getting defined as irix.
+        - don't core dump on -v without any arguments.
+
+hardaker 23 Dec 97 11:20:04
+    - (hr_swrun.c): Correct a non-casted malloc.
+
+hardaker 23 Dec 97 11:33:59
+    - (hr_filesys.c): Solaris specific fixes.
+
+hardaker 23 Dec 97 11:35:26
+    - (acconfig.h, config.h.in, sedscript.in): BSDI definition fixes.
+
+hardaker 23 Dec 97 11:41:49
+    - (config.h.in, configure, configure.in): Patch from Johannes Grosen:
+      - fix non-existent nlist.h problems under linux redhat 5.0.
+
+hardaker 23 Dec 97 11:42:28
+    - (mibgroup/*.c, common_header.h): Patch from Johannes Grosen:
+      - fix non-existent nlist.h problems under linux redhat 5.0.
+
+hardaker 23 Dec 97 11:42:39
+    - (snmptrap.c): Patch from Johannes Grosen:
+      - fix non-existent nlist.h problems under linux redhat 5.0.
+
+hardaker 23 Dec 97 11:42:54
+    - (snmplib/system.c): Patch from Johannes Grosen:
+      - fix non-existent nlist.h problems under linux redhat 5.0.
+
+hardaker 23 Dec 97 11:46:08
+    - (hpux.c): #ifdef'ed out unused writeHP function.
+
+hardaker 23 Dec 97 12:32:21
+    - (snmptrapd.c): Patch from Ted Rule:
+      - Use syslog option LOG_PID on startup.
+      - fork if syslog enabled.
+      - Enable logging to other syslog facilities.
+      - print all trap data to a single syslog line.
+
+hardaker 23 Dec 97 12:48:31
+    - (snmptrapd.c):
+      - Change -f flag to -l and make -f no-fork.
+      - fix patch which munged ability to generate both -P and -s simultaneously.
+
+hardaker 23 Dec 97 14:40:36
+    - (README): Add Ted Rule to coders list.
+
+hardaker 23 Dec 97 14:42:47
+    - (*): Turn all debugging routines into library calls that can be
+      turned on and off at run time.
+      - DEBUGP() is now a typical printf style function and is used everywhere.
+      - void snmp_set_do_debugging(int).
+      - int snmp_get_do_debugging().
+
+hardaker 23 Dec 97 14:44:38
+    - (snmpd.1.def, snmptrapd.8): debugging flag additions.
+
+hardaker 23 Dec 97 14:47:08
+    - (at.c, icmp.c, interfaces.c, ip.c, snmp_mib.c, system.c, tcp.c, udp.c):
+      - Patch from Dave Shield to break up common_header.h.
+
+hardaker 23 Dec 97 15:27:54
+    - (at.c, at.h, host_res.h, icmp.h, interfaces.c, interfaces.h, ip.h,
+      tcp.c, tcp.h, udp.c, udp.h, read_config.c, snmp_vars.c):
+      - clean up required headers for linux.
+
+hardaker 23 Dec 97 15:56:18
+    - (versioninfo.c, versioninfo.h): Create a mib variable to set/report
+      if debugging is on or off.
+
+hardaker 23 Dec 97 15:59:03
+    - (UCD-SNMP-MIB.txt): Create a mib variable to set/report if debugging
+      is on or off.
+
+hardaker 23 Dec 97 16:30:47
+    version tag ( 3.4.pre1 )
+
+hardaker 29 Dec 97 09:37:06
+    - (tkmib): First implementation.
+
+hardaker 30 Dec 97 14:00:03
+    - (tkmib):
+      - new command: table to display snmptables as a table.
+      - misc...
+
+hardaker 30 Dec 97 17:01:57
+    - (tkmib): Create a graphing widget.
+
+hardaker  5 Jan 98 13:27:38
+    - (mib_api.3): change "all" to "ALL".
+
+hardaker  5 Jan 98 13:28:00
+    - (mib.c, parse.c, parse.h): add a find_module() routine.
+
+hardaker  5 Jan 98 13:28:22
+    - (snmptranslate.c): put init_mib back in place (opps).
+
+hardaker  5 Jan 98 13:28:42
+    - (TODO): snmpv3
+
+hardaker  5 Jan 98 16:29:39
+    - (asn1.c): Patch from Niels Baggesen:
+      - fix asn1_build_objid.
+
+hardaker  5 Jan 98 17:33:07
+    - (parse.c): swap args to merge_anon_children().
+
+hardaker 12 Jan 98 09:14:54
+    - (parse.c): Patch from Dave Shield:  fix anon_children invalid memory access.
+
+hardaker 12 Jan 98 09:18:50
+    - (mib_api.3, snmp_api.3): Patch from Niels Baggesen:
+      - doc update to reflect moved headers.
+
+hardaker 12 Jan 98 09:19:10
+    - (Makefile.in): Patch from Niels Baggesen: link directly to lib.
+
+hardaker 12 Jan 98 09:19:47
+    - (Makefile.in, snmpbulkwalk.c, snmpdelta.c, snmpget.c, snmpgetnext.c,
+      snmpset.c, snmpstatus.c, snmptable.c, snmptest.c, snmptrap.c,
+      snmptrapd.c, snmpwalk.c): Patch from Niels Baggesen:
+      - remove unused headers.
+      - snmp_perror changes.
+
+hardaker 12 Jan 98 09:21:56
+    - (alarm.c, at.c, context_vars.c, event.c, hr_device.c, hr_filesys.c,
+      hr_partition.c, hr_storage.c, hr_swinst.c, hr_swrun.c, icmp.c,
+      interfaces.c, ip.c, proc.c, system.c, tcp.c, udp.c, var_route.c):
+      Patch from Niels Baggesen:
+      - Fix headers for FreeBSD and NetBSD.
+
+hardaker 12 Jan 98 09:40:36
+    - (FAQ, INSTALL, Makefile.in): Patch from Niels Baggesen:
+      - Documentation update to fix paths from recent changes.
+
+hardaker 12 Jan 98 09:41:38
+    - (read_config.c, snmp_vars.c, snmpd.c): Patch from Niels Baggesen:
+      - header fixes.
+      - snmp_perror usage.
+
+hardaker 12 Jan 98 09:44:51
+    - (asn1.c, mib.c, snmp_api.h, snmp_impl.h, system.h): Patch from Niels
+      Baggesen:
+      - header changes and boolean check corrections.
+
+hardaker 12 Jan 98 09:51:27
+    - (parse.c): Undid anon-children change.
+
+hardaker 12 Jan 98 09:56:14
+    - (kernel_sunos5.c): Patch from Niels Baggesen:
+      - increase buffer size to increase max interfaces reported on Solaris.
+
+hardaker 16 Jan 98 09:44:56
+    - (snmpd.c): Patch from Sheshadri Yagati:
+      - signal a trap (2) when the agent is shut down.
+
+hardaker 21 Jan 98 11:08:39
+    - (COPYING): update.
+
+hardaker 21 Jan 98 11:12:01
+    - (*/Makefile.in, Makefile.top, acconfig.h, config.h.in, configure,
+      configure.in):
+      - begin support for creating and using shared libraries.
+      - all Makefiles now include a Makefile.top for easier future global changes.
+
+hardaker 21 Jan 98 11:12:22
+    - (read_config.c, snmp_agent.c, snmp_vars.c, snmpd.c):
+      - include struct.h explicitly.
+
+hardaker 21 Jan 98 11:12:34
+    - (disk.c, errormib.c, extensible.c, interfaces.c, loadave.c,
+      memory.c, pass.c, proc.c, system.c, util_funcs.c, var_route.c,
+      versioninfo.c):
+      - include struct.h explicitly.
+
+hardaker 21 Jan 98 17:33:24
+    - (Makefile.top, configure, configure.in, */Makefile.in):
+      - Do a better version of shlib support.  Should be useable now at least.
+
+hardaker 21 Jan 98 22:05:44
+    - (acconfig.h, config.h.in, configure, configure.in):
+      - create m/ and s/ directories and use them for supplemental config
+        include files based on the config.guess output.
+
+hardaker 23 Jan 98 08:30:35
+    - (memory.c): Patch from Niels Baggesen:
+      - don't close file descriptor in linux's FILE_TO_BUF macro.
+
+hardaker 23 Jan 98 11:19:12
+    - (generic.h, i386.h, i586.h, i686.h): m/*.h file beginnings.
+
+hardaker 23 Jan 98 11:19:33
+    - (bsd.h, generic.h, linux.h, sysv.h): s/* beginnings.
+
+hardaker 23 Jan 98 16:12:02
+    - (read_config.c, read_config.h, snmp_vars.c, snmp_vars.h,
+      extensible.c, pass.c):
+      - create new functions:
+        - register_subtree()
+        - register_mib()
+        - unregister_mib().
+      - get rid of read_config special stuff for extensibility and put it
+        in their own submodules which now call register_mib().
+
+hardaker 23 Jan 98 16:14:20
+    - (registry.[ch], UCD-SNMP-MIB.txt):
+      - create a new table at ucdavis.103 to display registered mibs.
+
+hardaker 23 Jan 98 16:15:05
+    - (at.c, disk.c, host_res.h, hr_other.h, icmp.c, interfaces.c, ip.c,
+      snmp_mib.c, system.c, tcp.c, ucd_snmp.h, udp.c, versioninfo.c):
+      - #include "snmp_api.h"
+
+hardaker 23 Jan 98 16:34:43
+    - (configure, configure.in, snmp_vars.c, snmp_vars.h, var_struct.h,
+      extensible.c, pass.c, registry.c, registry.h, UCD-SNMP-MIB.txt):
+      - make the mib registry record and display a mib module name as well.
+
+hardaker 30 Jan 98 08:57:54
+    - (configure, configure.in): test for 'ps aux' (redhat 5.0).
+
+hardaker 30 Jan 98 09:01:06
+    - (UCD-SNMP-MIB.txt, memory.c, memory.h): Patch from Luuk de Boer:
+      - report cached, buffer, and shared statistics for linux.
+
+hardaker 30 Jan 98 09:24:19
+    - (read_config.c, snmp_vars.c, var_struct.h): Patch from Dave Shield:
+      - new subtree structure system.
+
+hardaker 30 Jan 98 10:40:26
+    - (pass.c): put pass_comapre here.
+
+hardaker 30 Jan 98 10:41:53
+    - (read_config.c, snmp_vars.c, snmp_vars.h, var_struct.h):
+      - merge Dave's code with mine.  Still a few bugs to work through.
+
+hardaker 30 Jan 98 10:42:17
+    - (registry.c, registry.h): begin munging for new hierarchy.
+
+hardaker 30 Jan 98 10:43:28
+    - (UCD-SNMP-MIB.txt): change module indexing to use oid instead of a numeric.
+
+hardaker 30 Jan 98 10:49:59
+    - (disk.c, host_res.h, pass.c, registry.c, snmp_mib.c, system.c,
+      versioninfo.c, snmp_api.h):
+      - include netinet/in.h for address structure.
+
+hardaker 30 Jan 98 10:55:20
+    version tag ( 3.4.pre2 )
+
+hardaker 30 Jan 98 13:49:56
+    - (README): I can't really have forgotten Simon's name in the list
+      could I?
+
+hardaker 30 Jan 98 13:50:28
+    - (aclocal.m4, configure): define ifnet for linux.
+
+hardaker 30 Jan 98 14:31:58
+    - (acconfig.h, config.h.in, configure, configure.in): check for if_speed.
+
+hardaker 30 Jan 98 14:32:13
+    - (interfaces.c): finish linux problems and use if_speed.
+
+hardaker 30 Jan 98 15:25:02
+    - (snmp_parse_args.c, snmptrap.c): fix default port for snmptrap.
+
+hardaker  2 Feb 98 08:57:41
+    - (configure, configure.in): Patch from John Hawkinson:
+      - fix typo in configure for shared library extension w/o shared libraries.
+
+hardaker  6 Feb 98 13:29:40
+    - (at.c, icmp.c, interfaces.c, ip.c, tcp.c, udp.c): protect against nlist.h
+
+hardaker  6 Feb 98 13:44:44
+    - (hr_disk.c): close() got caught inside an else it shouldn't have due
+      to an ifdef error.
+
+hardaker  6 Feb 98 17:10:53
+    - (Makefile.in, acconfig.h, config.h.in, configure, configure.in,
+      auto_nlist.c, auto_nlist.h, autonlist.h, kernel.c, snmp_vars.c, ip.c):
+      - created a new auto_nlist function and use it in ip.c.
+
+hardaker  6 Feb 98 17:11:25
+    - (generic.h, hpux.h, irix.h, linux.h, solaris.h):
+      - update for auto_nlist symbols.
+
+hardaker  9 Feb 98 11:03:02
+    - (at.c, disk.c, errormib.c, extensible.c, hpux.c, hr_proc.c,
+      hr_storage.c, hr_swrun.c, hr_system.c, icmp.c, interfaces.c, ip.c,
+      kernel_sunos5.c, loadave.c, memory.c, proc.c, tcp.c, udp.c,
+      var_route.c):
+      - use auto_nlist.
+
+hardaker  9 Feb 98 11:03:17
+    - (auto_nlist.h): prototype wrapper.
+
+hardaker  9 Feb 98 11:03:56
+    - (configure, configure.in):
+      - changed --with-shared-libraries to --enable-shared to match other pkgs.
+      - display arguments found for --enable-shared.
+
+hardaker  9 Feb 98 11:04:31
+    - (bsd.h, bsdi.h, freebsd.h, freebsd3.h, generic.h, hpux.h, netbsd.h,
+      solaris.h):
+      - define symbols for auto_nlist to use.
+
+hardaker  9 Feb 98 11:06:53
+    - (snmp_vars.c): Patch from Dave Shield:
+      - fix prototypes on my broken table walking routines.
+
+hardaker  9 Feb 98 11:17:52
+    version tag ( 3.4.pre3 )
+
+hardaker  9 Feb 98 11:18:45
+    - (configure.in): check for ioctls.h
+
+hardaker  9 Feb 98 11:18:59
+    - (interfaces.c):  include ioctls.h if available.
+
+hardaker  9 Feb 98 11:20:00
+    - (config.h.in, configure): check for ioctls.h.
+
+hardaker 11 Feb 98 09:19:33
+    - (generic.h, auto_nlist.c, at.c, hr_proc.c, hr_storage.c, memory.c,
+      tcp.c, udp.c, var_route.c): Patch from Dave Shield:
+      - fix all my typos ;-).
+      - create auto_nlist_value to return the looked-up value.
+
+hardaker 11 Feb 98 09:28:09
+    - (configure, configure.in):
+      - ps aux should define aux not -aux.
+
+hardaker 11 Feb 98 09:28:33
+    - (host_res.h): Patch from Dave Shield:
+      - don't include config.h
+
+hardaker 11 Feb 98 09:28:44
+    - (hr_network.c): Patch from Dave Shield:
+      - solaris fixes.
+
+hardaker 11 Feb 98 09:29:06
+    - (solaris.h): Patch from Dave Shield:
+      - undef IP_FORWARDING_SYMBOL before defining it.
+
+hardaker 11 Feb 98 16:44:13
+    - (configure, configure.in): sed doesn't like [a-z]+ type expressions.
+
+hardaker 13 Feb 98 09:07:31
+    - (FAQ): typo: authtrapsenable -> authtrapenable.
+
+hardaker 17 Feb 98 09:50:43
+    - (snmp_api.c, snmp_api.h):
+      - use snmp_ipaddr instead of ipaddr to avoid hpux conflicts.
+
+hardaker 17 Feb 98 09:53:12
+    - (auto_nlist.c, autonlist.h, snmp_vars.c):
+      - use appropriate mallocs, and NULL initialization of pointers.
+      - malloc the symbol rather than using a fixed length.
+      - insert debugging code.
+      - enable printing of the nlist tree if TESTING is defined.
+
+hardaker 17 Feb 98 09:54:01
+    - (tcp.c, udp.c):
+      - nlist symbol name errors.
+
+hardaker 18 Feb 98 08:06:00
+    - (EXAMPLE.conf.def, vmstat.c, vmstat.h, ucd_snmp.h,
+      UCD-SNMP-MIB.txt): Patch from Luuk de Boer:
+      - implment a vmstat mib group on linux.
+
+hardaker 18 Feb 98 08:15:56
+    - (config.h.in, configure, configure.in): Patch from Simon Leinen:
+      - check for sys/sysmp.h.
+
+hardaker 18 Feb 98 08:16:21
+    - (auto_nlist.c): Patch from Simon Leinen:
+      - fix a debugging statement (missing a variable).
+
+hardaker 18 Feb 98 08:18:05
+    - (at.c, icmp.c, interfaces.c, ip.c, tcp.c, udp.c, irix.h):
+      Patch from Simon Leinen:
+      - port to irix.
+
+hardaker 18 Feb 98 11:45:20
+    - (sedscript.in): define LIBDIR and DATADIR.
+
+hardaker 18 Feb 98 11:46:48
+    - (snmpd.1.def, snmpd.conf.5.def): change to DATADIR from LIBDIR.
+
+hardaker 18 Feb 98 13:31:07
+    - (disk.h, extensible.h, loadave.h, proc.h, UCD-SNMP-MIB.txt):
+      - turn these mibs into real tables.  Required changing the mib though.
+
+hardaker 18 Feb 98 13:34:55
+    - (snmpd.conf.5.def): authtrapsenable -> authtrapenable.
+
+hardaker 18 Feb 98 13:44:13
+    - (at.c, example.c, hpux.c, hr_device.c, hr_disk.c, hr_filesys.c,
+      hr_network.c, hr_partition.c, hr_print.c, hr_proc.c, hr_storage.c,
+      hr_swinst.c, hr_swrun.c, hr_system.c, icmp.c, interfaces.c, ip.c,
+      pass.c, registry.c, smux.c, snmp_mib.c, system.c, tcp.c, udp.c,
+      var_route.c, wombat.c):
+      - all bcopys -> memcpy.
+      - include a few extra headers for DEBUGP statements.
+
+hardaker 18 Feb 98 14:25:53
+    - (acl_vars.c, at.c, context_vars.c, disk.c, host_res.h, hr_disk.c,
+      hr_filesys.c, hr_storage.c, hr_swinst.c, hr_swrun.c, hr_utils.c,
+      icmp.c, interfaces.c, interfaces.h, ip.c, memory.c, mibincl.h,
+      party_vars.c, pass.c, proc.c, registry.c, smux.c, snmp_mib.c,
+      system.c, tcp.c, udp.c, var_route.c, versioninfo.c, view_vars.c,
+      vmstat.c):
+      - massive -Wall and --strict-prototypes checking.
+      - bzero -> memset.
+
+hardaker 18 Feb 98 14:32:05
+    - (read_config.c, snmp_vars.c):
+      - prototyping and --Wall checks.
+
+hardaker 18 Feb 98 14:32:38
+    - (snmp_api.c, snmp_api.h): prototyping checks.
+
+hardaker 18 Feb 98 16:28:51
+    - (openbsd.h): created.
+
+hardaker 18 Feb 98 16:29:58
+    - (acconfig.h, UCD-SNMP-MIB.txt):
+      - removed unneeded stuff.
+      - added openbsd.
+
+hardaker 18 Feb 98 16:30:47
+    - (at.c, proc.c, tcp.c, udp.c, var_route.c, bsd.h, bsdi.h, freebsd.h,
+      generic.h, hpux.h, netbsd.h):
+      - tried to merge some things into s/*.h defines instead.  There is a
+        lot to go still.
+
+hardaker 18 Feb 98 16:33:14
+    - (config.h.in): openbsd defines.
+
+hardaker 18 Feb 98 16:33:43
+    - (*/Makefile.in): make depend.
+
+hardaker 18 Feb 98 16:51:18
+    version tag ( 3.4.pre4 )
+
+hardaker 20 Feb 98 09:19:00
+    - (interfaces.c): Patch from Simon Leinen:
+      - fix include file dependancies on irix with _KERNEL defined.
+
+hardaker 20 Feb 98 11:15:14
+    - (*/Makefile.in): fix make depend to look for and strip /usr/lib/*.
+
+hardaker 25 Feb 98 07:27:09
+    - (read_config.c, snmpd.c): Patch from Niels Baggesen:
+      - fix read_config parser's end of line problems.
+
+hardaker  4 Mar 98 15:49:32
+    - (COPYING): documentation requirement change.
+
+hardaker  6 Mar 98 14:01:52
+    - (Makefile.in, kernel.c, read_config.c, read_config.h, snmp_agent.c,
+      snmp_vars.c, snmpd.c, acl_vars.c, alarm.c, context_vars.c, disk.c,
+      event.c, extensible.c, icmp.c, interfaces.c, ip.c, mibincl.h,
+      party_vars.c, pass.c, proc.c, registry.c, registry.h, route_write.c,
+      snmp_mib.c, system.c, tcp.c, udp.c, vacm_vars.c, vacm_vars.h,
+      var_route.c, versioninfo.c, view_vars.c, snmp_parse_args.c,
+      snmpdelta.c, snmpget.c, snmpgetnext.c, snmpset.c, snmpstatus.c,
+      snmptable.c, snmptest.c, snmptranslate.c, snmptrap.c, snmptrapd.c,
+      if.c, inet.c, route.c, snmpd.conf.5.def, snmptable.1, .index,
+      Makefile.in, SNMP-FRAMEWORK-MIB.txt, SNMP-MPD-MIB.txt,
+      SNMP-NOTIFICATION-MIB.txt, SNMP-PROXY-MIB.txt, SNMP-TARGET-MIB.txt,
+      SNMP-USER-BASED-SM-MIB.txt, SNMP-VIEW-BASED-ACM-MIB.txt,
+      Makefile.in, acl.h, acl_parse.c, asn1.c, context.h, context_parse.c,
+      mib.c, party.h, party_parse.c, snmp.c, snmp.h, snmp_api.c,
+      snmp_auth.c, snmp_client.c, snmp_impl.h, system.c, vacm.c, vacm.h,
+      view.c): Patch from Niels Baggesen:
+      - Implement the SNMPv3 View Based Access Control Model (RFC 2275).
+      - header fixes.
+      - better header-file #define names to include SNMP_, ASN_, etc. prefixes.
+
+hardaker  6 Mar 98 15:47:01
+    - (util_funcs.c):
+      - remove GLOBAL-SECURITY checks.
+
+hardaker  6 Mar 98 15:47:19
+    - (mibII.h): add vacm_vars.
+
+hardaker  6 Mar 98 15:47:40
+    - (host_res.h): move snmp_api.h up above snmp_impl.h.
+
+hardaker  6 Mar 98 15:48:33
+    - (acconfig.h, config.h.in, configure, configure.in):
+      - remove security type prompts.
+
+hardaker  9 Mar 98 17:40:04
+    - (mibII.c, mibII.h, sysORTable.c, sysORTable.h, system.c, v2party.c,
+      vacm_vars.c, vacm_vars.h):
+      - implement sysORTable.
+      - register mibs under it.
+
+hardaker 11 Mar 98 08:06:17
+    - (*/*/*/*): Patch from Niels Baggesen:
+      - fix auto_nlist on preceeding _ architectures.
+      - Change *all* define usage to new SNMP_ and ASN_ prefixes.
+      - leave mib access open if no com2sec statements were found in snmpd.conf.
+
+hardaker 11 Mar 98 09:40:42
+    - (hpux.h, hr_filesys.h, memory.h, snmp_bgp.h, snmp_ospf.h,
+      snmp_rip2.h, sysORTable.h, vmstat.h):
+      - finish converting a few of the files that Niels missed.
+
+hardaker 11 Mar 98 10:30:50
+    - (sysORTable.c, sysORTable.h, system.c, system.h):
+      - fix time values and move sysORLastChanged to the system group.
+
+hardaker 11 Mar 98 12:14:09
+    - (*): Patch from Craig Bevins for OpenBSD
+
+hardaker 11 Mar 98 12:27:01
+    - (interfaces.c, tcp.c, udp.c, var_route.c, var_route.h): Patch from
+      Craig Bevins:
+      - port to OpenBSD.
+
+hardaker 11 Mar 98 12:45:46
+    - (*): patch from Garrett Wollman for FreeBSD.
+
+hardaker 11 Mar 98 12:56:37
+    - (aclocal.m4, config.h.in, configure, configure.in, icmp.c,
+      interfaces.c, ip.c, tcp.c, udp.c, var_route.c): Patch from Garrett
+      Wollman:
+      - freebsd 3 sysctl implementations.
+
+hardaker 11 Mar 98 14:41:11
+    - (read_config.c, read_config.h, snmp_agent.c, snmp_vars.c, snmpd.c,
+      host_res.h, hr_device.c, hr_device.h, hr_disk.c, hr_disk.h,
+      hr_filesys.c, hr_filesys.h, hr_network.c, hr_network.h, hr_other.c,
+      hr_partition.c, hr_partition.h, hr_print.c, hr_print.h, hr_proc.c,
+      hr_proc.h, hr_storage.c, hr_storage.h, hr_swinst.c, hr_swinst.h,
+      hr_swrun.c, hr_swrun.h, hr_system.c, hr_system.h, interfaces.c,
+      ip.c, mibII.c, mibII.h, sysORTable.c, v2party.c, v2party.h,
+      vacm_vars.c, vacm_vars.h):
+      - massive prototyping and --Wall fixes.
+      - fixed things broken by the freebsd patch (only some I'm sure).
+
+hardaker 11 Mar 98 15:42:35
+    - (auto_nlist.c): better debugging printfs
+
+hardaker 11 Mar 98 15:45:22
+    - (hpux.h): switch incorrect arptab symbols.
+
+hardaker 11 Mar 98 15:56:13
+    - (README): name update.
+
+hardaker 11 Mar 98 15:57:16
+    - (*/Makefile.in): depend update.
+
+hardaker 11 Mar 98 17:05:41
+    - (system.c): don't chomp new line on read_config utils.
+
+hardaker 18 Mar 98 09:17:42
+    - (README): changed OV path's to newer release paths.
+
+hardaker 18 Mar 98 13:10:35
+    - (acconfig.h, config.h.in, sedscript.in, UCD-SNMP-MIB.txt):
+      - re-numbering of the new table modules.
+
+hardaker 18 Mar 98 13:26:22
+    - (extensible.c, memory.c, pass.c, proc.c, util_funcs.c, util_funcs.h):
+      - wait for pid after get_exec_output() with new wait_on_exec() function.
+
+hardaker 18 Mar 98 13:56:16
+    - (acconfig.h, config.h.in, configure, configure.in, read_config.c,
+      snmpd.c, snmp_parse_args.c, snmptrapd.c, main.c, mib_api.3,
+      config.h):
+      - SNMPLIBPATH -> SNMPSHAREPATH
+      - a real SNMPLIBPATH
+      - make the agent read .conf files from SNMPSHAREPATH:SNMPLIBPATH.
+
+hardaker 18 Mar 98 14:09:31
+    version tag ( 3.4.pre5 )
+
+hardaker 22 Mar 98 18:13:41
+    - (pass.c, proc.c, vacm_vars.c): Patch from Simon Burge:
+      - move sys/types.h up for ultrix.
+
+hardaker 25 Mar 98 09:15:45
+    - (tcp.c): include tcpip.h for digital unix.
+
+hardaker 25 Mar 98 10:39:13
+    - (read_config.c, read_config.h, snmp_vars.c, registry.c, registry.h):
+      - fix the registry mib to use the new module structure.
+      - create a working find_subtree() and find_subtree_next().
+
+hardaker 25 Mar 98 10:39:50
+    - (acconfig.h, config.h.in): simply don't define CAN_USE_NLIST on linux.
+
+hardaker 25 Mar 98 10:44:06
+    - (snmpd.c, snmp_api.c): Spelling errors from the CMU code fixed.
+
+hardaker 25 Mar 98 10:46:36
+    - (acconfig.h, config.h.in, linux.h): new define: DONT_USE_NLIST.
+
+hardaker 25 Mar 98 10:59:20
+    - (interfaces.c): Patch from Niels Baggesen:
+      - Add an & to arpcom.ac_enaddr in memset.
+
+hardaker 25 Mar 98 12:48:30
+    - (Makefile.in, int64.c, int64.h, mib.c): Code from David T. Perkins:
+      - integrated David's code to print counter64s as integers rather than hex.
+
+hardaker 25 Mar 98 13:07:00
+    - (v2party.c, mibII.c, vacm_vars.c): declair registration variables staticly.
+
+hardaker 25 Mar 98 16:49:56
+    - (hpux.c): fix write_method declaration.
+
+hardaker 26 Mar 98 07:22:30
+    - (*.c): Patch from Niels Baggesen:
+      - misc porting improvements (the bsd groups, sunos, ...).
+      - switch auto_nlists calling order of _ vs non _ lookups.
+      - reverse all string.h/strings.h include possibilities.
+
+hardaker 27 Mar 98 09:20:04
+    - (snmptrapd.c):
+      - Beta version of an extensible trap demon.
+        - -C 'command' on the command line runs the command and feeds it
+          stdin information about the trap.
+        - v1 traps are converted to v2 traps for consistancy of
+          information sent to the scripts.
+
+hardaker 27 Mar 98 11:20:21
+    - (read_config.c, read_config.h):
+      - create config_pwarn() that doesn't increase the error count to
+        prevent exiting.  Used for disks, since some might by process or
+        nfs mounted.
+
+hardaker 27 Mar 98 11:20:54
+    - (disk.c): use config_pwarn() for missing disks.
+
+hardaker 27 Mar 98 11:22:35
+    - (hr_device.c): check device index against maximum (segfault on HPUX).
+
+hardaker 27 Mar 98 16:10:05
+    - (README, config.h.in, configure, configure.in, snmpd.c): Patch from
+      Arthur Hyun:
+      - tcpwrappers support.
+
+hardaker 27 Mar 98 16:23:03
+    - (interfaces.c): Interfaces_Scan_Next needed a 4th (NULL) argument.
+
+hardaker 27 Mar 98 16:23:33
+    - (acconfig.h, config.h.in, configure, configure.in, snmpd.c):
+      - correctly #ifdef out the tcpwrappers patch.
+
+hardaker 27 Mar 98 16:42:13
+    - (INSTALL): document libwrap.
+
+hardaker 27 Mar 98 16:43:06
+    - (snmp_vars.c, snmp_vars.h, interfaces.c, ip.c, registry.c):
+      - prototyping and -Wall fixes.
+
+hardaker  1 Apr 98 09:52:32
+    - (snmp_client.c): enterprise_length is sizeof(oid) dependent.
+
+hardaker  1 Apr 98 13:27:07
+    - (auto_nlist.c):
+      - remove no longer needed debugging statements of tree traversal.
+
+hardaker  1 Apr 98 13:31:29
+    - (NEWS, PORTING): updates for 3.4.
+
+hardaker  1 Apr 98 13:47:55
+    - (FAQ, README): more 3.4 updates.
+
+hardaker  1 Apr 98 13:53:27
+    - (EXAMPLE.conf.def): added vacm example configuration.
+
+hardaker  1 Apr 98 13:54:11
+    - (snmpd.conf.5.def): moved the view example section above the access section.
+
+hardaker  1 Apr 98 14:10:07
+    - (TODO): removed a few things!
+
+hardaker  1 Apr 98 14:11:49
+    - (Makefile.in): make depend.
+
+hardaker  1 Apr 98 14:40:44
+    - (snmp_vars.c, snmp_vars.h): make unregestering of mibs work.
+      - (in most cases :-?)
+
+hardaker  1 Apr 98 14:43:14
+    version tag ( 3.4.pre6 )
+
+hardaker  1 Apr 98 16:35:59
+    - (snmptrapd.c): always send enterprise and trapoid to scripts.
+
+hardaker 20 Apr 98 10:31:08
+    - (snmpd.c): change oid from textual to numeric to allow now mibs to
+      be loaded.
+
+hardaker 20 Apr 98 15:54:29
+    - (host_res.h, hr_disk.c, hr_filesys.c, hr_partition.c, hr_storage.c):
+      - Patch from Dave Shield:
+        - consolidate the system-specific stuff a bit (should make it easier
+          to follow)
+        - Re-structures the Disk searching, in such a way that it can set up
+          via the config file. (which I still need to do)
+        - Speed up disk searching (by caching invalid results - a *major* win!)
+        - Handle partitions sensibly (arther than one per disk)
+        - Improve Solaris support for the Device group
+
+hardaker 20 Apr 98 15:56:50
+    - (config.h.in, configure, configure.in): check for sys/dkio.h
+
+hardaker 20 Apr 98 15:59:12
+    - (hr_filesys.c, hr_swrun.c): Patch from Niels Baggesen:
+      - fix some host resources for solaris.
+
+hardaker 20 Apr 98 16:00:36
+    - (snmpd.c): Patch from Niels Baggesen:
+      - appropriate use of strdup during startup and better flag checking.
+
+hardaker 20 Apr 98 16:00:56
+    - (interfaces.c): Patch from Niels Baggesen:
+      - header moves.
+
+hardaker 20 Apr 98 16:02:12
+    - (ip.c): Patch from Niels Baggesen:
+      - test symbol defines and cleanup.
+
+hardaker 20 Apr 98 16:03:03
+    - (snmptable.c): Patch from Niels Baggesen:
+      - prototyping and other cleanups.
+
+hardaker 20 Apr 98 16:05:00
+    - (snmptrapd.c): Patch from Niels Baggesen:
+      - gethostbyaddr moves up.
+      - include sys/wait.h.
+      - syslog %d -> %ld for long specific_type.
+
+hardaker 20 Apr 98 16:05:34
+    - (vacm_vars.c): Patch from Niels Baggesen:
+      - typecast a pointer.
+
+hardaker 20 Apr 98 16:06:03
+    - (tcp.c, udp.c, var_route.c): Patch from Niels Baggesen:
+      - #ifdef checks on symbols and header movement.
+
+hardaker 20 Apr 98 16:06:21
+    - (solaris.h): Patch from Niels Baggesen:
+      - undefine a bunch of nlist symbols.
+
+hardaker 20 Apr 98 16:07:10
+    - (snmp_client.c): Patch from Niels Baggesen:
+      - needed pointer copies.
+
+hardaker 22 Apr 98 07:49:21
+    - (UCD-SNMP-MIB.txt): changed wording, cleaned up a bit.
+
+hardaker 22 Apr 98 08:35:29
+    - (parse.c): Patch from Niels Baggesen:
+      - parse BITS keywords.
+
+hardaker 24 Apr 98 10:00:06
+    - (acconfig.h, config.h.in): mib oid location updates for ucd-snmp mib.
+
+hardaker 24 Apr 98 10:02:29
+    - (UCD-SNMP-MIB.txt):
+      - renamed labels to be unique from the old definitions.
+      - renumbered again.
+      - commented on the desgin of the mib at the top.
+      - Changed back to SMIv1.
+      - removed lockd section.
+      - removed vmstat section till it gets implemented.
+      - removed sequences of scalers.
+
+hardaker 24 Apr 98 10:22:00
+    - (UCD-SNMP-MIB.txt): the textual descriptions were updated some.
+
+hardaker 24 Apr 98 14:03:26
+    - (UCD-SNMP-MIB.txt): more cleaning and renaming.
+
+hardaker 24 Apr 98 14:32:12
+    - (acconfig.h, config.h.in, configure, configure.in):
+      - check statvfs.h for f_bavail.
+
+hardaker 24 Apr 98 14:33:08
+    - (hr_filesys.c): include sys/param.h to define MAXPATHLEN.
+
+hardaker 24 Apr 98 14:33:24
+    - (hr_partition.c): close file descriptor just opened.
+
+hardaker 24 Apr 98 14:33:58
+    - (disk.c): calculate vfs block size if possible and size > 255 bytes.
+
+hardaker 24 Apr 98 16:31:30
+    - (tcp.c): include netinet/tcpip.h for DU4.0.
+
+hardaker 24 Apr 98 16:32:05
+    - (auto_nlist.c, auto_nlist.h): n_value is a long:
+      - return the value from auto_nlist_value as an unsigned long.
+
+hardaker 24 Apr 98 16:40:45
+    - (var_route.c): watch out for single route loops.
+
+hardaker 27 Apr 98 10:59:19
+    - (Makefile.top): removed unneeded variable.
+
+hardaker 27 Apr 98 11:00:08
+    - (configure, configure.in): define SHLIB_LDCONFIG_CMD as ":" for
+      static library cases.
+
+hardaker 27 Apr 98 11:00:44
+    - (snmpbulkwalk.c, snmpdelta.c, snmpget.c, snmpgetnext.c, snmpset.c,
+      snmpstatus.c, snmptable.c, snmptest.c, snmpwalk.c):
+      - Put the word "Timeout: " in front of the "No Response" errors.
+
+hardaker 27 Apr 98 13:31:10
+    version tag ( 3.4.pre7 )
+
+hardaker 27 Apr 98 16:24:34
+    - (tkmib): bug fixes and new mib menu to load new mibs.
+
+hardaker 27 Apr 98 16:46:28
+    - (tkmib): New mib menu command: load a mib module by ID name.
+
+hardaker 27 Apr 98 16:48:02
+    - (tkmib): bug fixes.
+
+hardaker 29 Apr 98 08:56:44
+    - (snmptable.c): Patch from Niels Baggesen:
+      - fix -H header printing.
+
+hardaker 29 Apr 98 10:26:58
+    - (tcp.c): don't use TCPSTAT_SYMBOL unless defined.
+
+hardaker 29 Apr 98 10:34:12
+    - (example.c, proc.c, var_route.c, wombat.c):
+      - nlist cleanups.
+
+hardaker 29 Apr 98 10:43:04
+    - (example.c, example.h, wombat.c, wombat.h): more clean ups.
+
+hardaker 29 Apr 98 11:31:43
+    - (vmstat.c, vmstat.h): moves, changes, removals, and fixes.
+
+hardaker 29 Apr 98 11:32:01
+    - (UCD-SNMP-MIB.txt): put vmstat back in and renamed to systemStats.
+
+hardaker 29 Apr 98 11:41:58
+    - (tkmib):
+      - display unloaded module error.
+      - don't try to load a file on a cancel.
+
+hardaker  6 May 98 11:22:56
+    - (Makefile.in): install tkmib.
+
+hardaker  6 May 98 14:06:57
+    - (UCD-SNMP-MIB.txt):
+      - added internal table section.
+      - mib number corrections to match the source.
+
+hardaker  6 May 98 14:58:23
+    - (disk.c, errormib.c, example.c, example.h, extensible.c, loadave.c,
+      memory.c, proc.c, sysORTable.c, system.c, util_funcs.c,
+      util_funcs.h, versioninfo.c, vmstat.c):
+      - remove the newname requirement from checkmib().
+      - create header_generic() for simple scalar tests.
+      - use header_generic() in all ucd specific scalar mibs, and example.[ch].
+
+hardaker  6 May 98 21:06:59
+    - (NEWS): minor wording change.
+
+hardaker  6 May 98 21:07:28
+    - (util_funcs.c, util_funcs.h):
+      - new function: calculate_time_diff(t1, t2).
+
+hardaker  6 May 98 21:08:00
+    - (UCD-SNMP-MIB.txt): make bogus index's be 0.
+
+hardaker  6 May 98 21:08:37
+    - (mib2c): created a mib2c template creator.
+
+hardaker  6 May 98 22:28:47
+    - (win32/config.h): update from Joe Marzot.
+
+hardaker  7 May 98 09:05:55
+    - (COPYING): correction for dates.
+
+hardaker  7 May 98 09:07:06
+    - (configure, configure.in): sys/stat inclusion in fs checks.
+
+hardaker  7 May 98 09:07:46
+    - (read_config.c): debug info for config files read.
+
+hardaker  8 May 98 10:57:49
+    - (config*): check for pkglocs.h.
+
+hardaker  8 May 98 11:01:24
+    - (hr_swinst.c, hr_disk.c): Patch from Dave Shields.
+
+hardaker  8 May 98 14:53:36
+    - (disk.c): wording change.
+
+hardaker 11 May 98 08:08:37
+    - (util_funcs.c): blank line removal.
+
+hardaker 11 May 98 08:08:53
+    - (tkmib): optional port number.
+
+hardaker 11 May 98 08:09:58
+    - (mib2c):
+      - counter64s.
+      - consolodation of variable declarations.
+      - more error stings in all files for unknown variable types.
+
+hardaker 11 May 98 08:10:30
+    - (parse.c): opaque's can have a size specifier.
+
+hardaker 11 May 98 08:10:46
+    - (int64.c): add incrByU32().
+
+hardaker 11 May 98 10:29:16
+    - (read_config.c, snmp_vars.h, snmpd.c, snmpd.h, var_struct.h): Patch
+      from Niels Baggesen:
+      - free routines for vacm (to allow -HUP)
+      - free routines for the trapsink directives in snmpd
+
+hardaker 11 May 98 10:30:01
+    - (hr_disk.c, hr_filesys.c, hr_partition.c, vacm_vars.c): Patch from
+      Niels Baggesen:
+      - some prototypes for the hr_*.c files (needs Dave's recent patch)
+        Warning: the proc part still does not work with Solaris!
+
+hardaker 11 May 98 10:30:18
+    - (snmptranslate.c): Patch from Niels Baggesen:
+      - implement the long since announced -H option to snmptable
+
+hardaker 11 May 98 10:30:37
+    - (snmptranslate.1): Patch from Niels Baggesen:
+      - implement the long since announced -H option to snmptable.
+
+hardaker 11 May 98 10:31:33
+    - (SNMPv2-TC.txt): Patch from Niels Baggesen:
+      - this last [parser] may find errors in old MIBs (including the
+        version of SNMPv2-TC that we ship).
+
+hardaker 11 May 98 10:32:27
+    - (UCD-SNMP-MIB.txt): Patch from Niels Baggesen:
+      - Corrections of disk entry capitilazation problems.
+
+hardaker 11 May 98 10:34:38
+    - (mib.c, parse.c, parse.h, snmp_api.h, vacm.c, vacm.h): Patch from
+      Niels Baggesen:
+      - free routines for vacm (to allow -HUP)
+      - fix the parser to report unlinked OIDs. This did reveal an error in a
+        Cisco MIB (CISCO-IPMCAST-MIB) that I had been using (it needs an
+        IMPORTS ciscoExperiment FROM CISCO-SMI)
+        Actually the parser worked ok, except for the missing error messages.
+      - rewrite of the parsers lexical analyser, to correct the errors that
+        Dave Perkins and others have pointed out recently (name::= , DESCRIPTION"
+        and proper handling of -- partial line comments --). Watch out! this last
+        may find errors in old MIBs (including the version of SNMPv2-TC that
+        we ship). My Fore Systems MIBs had errors with this.
+      - implement the long since announced -H option to snmptable
+
+hardaker 12 May 98 10:52:16
+    - (hr_swinst.c): Patch from Dave Shield:
+      - more swinst fixes for rpm modules.
+
+hardaker 12 May 98 10:52:57
+    - (snmptrapd.c): Patch from Dave Shield:
+      - include a getdtablesize() function for hpux9.
+
+hardaker 12 May 98 11:10:42
+    - (NEWS): more updates.
+
+hardaker 12 May 98 11:11:10
+    - (acconfig.h, config.h.in, configure, configure.in):
+      - munge rpm lib check to link with -ldb as well.
+
+hardaker 12 May 98 11:11:32
+    - (disk.c): NULL -> 0.
+
+hardaker 12 May 98 11:45:21
+    - (vmstat.c): correct strings inclusion.
+
+hardaker 12 May 98 11:45:51
+    - (snmp_api.c, system.c):
+      - move debugging code from system.c to snmp_api.c, where it should be.
+
+hardaker 12 May 98 15:14:48
+    - (disk.c, example.c, interfaces.c, loadave.c, memory.c, pass.c,
+      proc.c, util_funcs.h, vmstat.c):
+      - include time.h properly instead of relying on util_funcs.h to do it.
+
+hardaker 12 May 98 15:15:01
+    version tag ( 3.4.pre8 )
+
+hardaker 13 May 98 21:21:22
+    - (int64.c, int64.h, mib.c): make int64.c use counter64's structure.
+
+hardaker 13 May 98 21:21:42
+    - (snmp_vars.c): don't return a counter64 to a snmpv1 request.
+
+hardaker 13 May 98 21:22:09
+    - (ip.c): include net/route.h and syslog.h for bsdi.
+
+hardaker 13 May 98 21:22:17
+    - (memory.c): include sys/param.h for bsdi
+
+hardaker 13 May 98 21:25:39
+    - (mib.c): sprint_by_type() didn't handle counter64's.
+
+hardaker 14 May 98 07:17:34
+    - (memory.c): move sys/param.h up above fs.h headers.
+
+hardaker 14 May 98 08:21:55
+    - (FAQ): new FAQ from Dave Shields.
+
+hardaker 14 May 98 08:22:08
+    - (NEWS): mib2c mentioned.
+
+hardaker 14 May 98 08:25:57
+    - (configure.in, configure): typos.
+
+hardaker 15 May 98 10:13:16
+    - (parse.c): single quote missing module names.
+
+hardaker 15 May 98 10:17:36
+    - (read_config.c, hr_filesys.c, hr_storage.c, hr_swrun.c, hr_system.c,
+      hr_system.h, hr_utils.c, util_funcs.c, var_route.c,
+      snmp_parse_args.c, snmptable.c, snmptranslate.c, snmptranslate.1,
+      bsd.h, solaris.h, sunos.h, int64.h, mib.c, mib.h, parse.c, parse.h):
+      Patch from Niels Baggesen:
+      - snmptranslate supports -R and -r.
+      - miscellaneous warning fixes.
+      - oid searcher always ignores case.
+      - fixed hr_system to compile on SunOS4.
+
+hardaker 15 May 98 10:19:05
+    - (mib.c): Patch from Dave Shield:
+      - provide ability to do random searches specifying a module name to look in.
+
+hardaker 15 May 98 11:17:44
+    - (FAQ, mib.c): Patch from Dave Shield:
+      - handle random lookups with multiple oid segments.
+
+hardaker 15 May 98 11:19:10
+    - (config.h, win32.opt, libsnmp.dsp, libsnmp.plg, libsnmp.def,
+      libsnmp_dll.dsp, libsnmp_dll.plg, snmpbulkwalk.plg, snmpget.plg,
+      snmpgetnext.plg, snmpset.plg, snmpstatus.plg, snmptranslate.plg,
+      snmpwalk.plg): Patch from Joe Marzot:
+      - win32 file updates.
+
+hardaker 18 May 98 11:18:21
+    - (acconfig.h, config.h.in, configure, configure.in):
+      - fix rtentry structure test on re-configures.
+
+hardaker 18 May 98 13:13:18
+    - (hr_swinst.c): protect using the date pointer against NULL settings.
+
+hardaker 18 May 98 15:39:38
+    version tag ( 3.4.pre9 )
+
+hardaker 18 May 98 18:14:19
+    - (int64.c):
+      - include header changes for win32.
+
+hardaker 19 May 98 10:41:14
+    - (at.c): set to do nothing when CAN_USE_SYSCTL.
+
+hardaker 19 May 98 10:41:49
+    - (memory.c): fix swapinfo on hpux10 systems. (/etc/swapinfo -r).
+
+hardaker 20 May 98 07:33:02
+    - (mib.c, parse.c): Patch from Niels Baggesen:
+      - extend random lookups further.
+
+hardaker 20 May 98 07:34:31
+    - (FAQ): Update from Dave Shield.
+
+hardaker 20 May 98 07:36:14
+    - (util_funcs.c): make checmib() use oid not int for newname.
+
+hardaker 20 May 98 07:37:33
+    - (snmp_impl.h): version should be a long.
+
+hardaker 20 May 98 08:25:41
+    - (read_config.c): config_perror() -> config_pwarn() for missing tokens.
+
+hardaker 20 May 98 08:27:06
+    - (*/Makefile.in): make depend.
+	
+-------------------------------------------------------------------------------
+
+Changes: V3.2 -> V3.3
+
+whardake 11 Jun 97 04:53:53
+    - (mib.c): Patch from Niels Baggesen to make MIBFILES env var work correctly.
+
+whardake 11 Jun 97 05:46:18
+    - (ChangeLog): whoops.
+
+whardake 23 Jun 97 23:40:28
+    - (Makefile.in): Patch from John Charlton to fix leading spaces in sedscript.
+
+whardake 23 Jun 97 23:41:58
+    - (configure*): bsdi3 needs to define bsdi2, not itself (duh).
+
+whardake 23 Jun 97 23:42:36
+    - (agent/mibgroup/README): need 2 leading '-'s on --with-mib-modules flag.
+
+whardake 26 Jun 97 23:39:32
+    - (smux.c): __P macros were called with too many arguments (needed (args)).
+
+whardake 30 Jun 97 05:53:57
+    - (agent/snmp_{agent,vars}.c, alarm.c, event.c, apps/*,
+       snmplib/snmp{,_api,_auth}.c):
+       - Added basic (mostly conforming?) v2c support.
+       - Merged arg parsing of apps/* clients into one file.
+
+whardake 30 Jun 97 05:54:36
+    - (agent/mibgroup/interfaces.c): Don't put & in front of osf4 ac_enaddr.
+
+whardake 30 Jun 97 06:33:08
+    - (snmptest.c): Patch from Niels Baggesen to fix get -> fget '\n' problem.
+      - Also makes sure it handles up and lower cases.
+
+whardake 30 Jun 97 06:38:43
+    - (wombat.h): better document config_load_mib() example.
+
+whardake 30 Jun 97 06:49:45
+    - (config*, memory.c): Patch from vlad@misery.rosprint.ru:
+      - implement memory section of ucd mib on linux.
+
+whardake 30 Jun 97 06:58:49
+    - (mib_api.3, parse.[ch]): Patch from Dave Shield:
+      - Handle mib module replacements through new function and replacement table.
+
+whardake 30 Jun 97 07:19:51
+    - (mib.c, parse.c, snmp_api.c): Suggestions from Laukkanen Markku NRC/Hki:
+      - Malloc typecasts and other corrections in casting.
+
+whardake  1 Jul 97 01:10:00
+    - (smux.c): fix prototyping failures.
+
+whardake  1 Jul 97 05:41:58
+    - (config*, common_header.h, interfaces.c, var_route.c, UCD-SNMP-MIB.txt):
+      - fix freebsd3 specific problems (based on suggestions from Bill Fenner).
+
+whardake  1 Jul 97 06:02:57
+    - (apps/*.c): Better usage information and usage() standarization.
+
+whardake  1 Jul 97 06:41:44
+    - (disk.c, errormib.c, loadave.c, memory.c): bsdi3 specific headers.
+
+whardake  1 Jul 97 07:20:25
+    - (config*): bsdi3 specific headers.
+
+whardake  1 Jul 97 08:37:51
+    version tag ( 3.3.pre1 )
+
+whardake  3 Jul 97 23:33:23
+    - (snmptranslate.c, mib.[ch], parse.[ch]):
+      - New option to snmptranslate (-a) to output a ascii dump of the mib
+        database capable of being used by the parser for quick OID translations.
+
+whardake  3 Jul 97 23:34:14
+    version tag ( 3.3.pre2 )
+
+whardake 24 Jul 97 23:50:48
+    - (snmp_api.c): Patch from Eddy J. Gurney:  uncomment gettimeofday() call.
+
+whardake  7 Aug 97 00:29:24
+    - (TODO): better error messages by apps.
+
+whardake  7 Aug 97 01:11:54
+    - (config*, load.c, disk.c, parse.c, snmp.c): Patch from Simon Burge:
+      - Ultrix fixes for statfs, loadave.
+      - implement strdup if not found in system.
+      - test for test flags for kernel checking.
+      - watch out for ps'es that return egrep with the ps arg on the line.
+      - up maximum disks to 50.
+
+whardake  7 Aug 97 01:33:38
+    - (kernel.c, proc.c): Patch from Simon Burge:
+      - Implement real process table walks on Ultrix.
+
+whardake  7 Aug 97 02:34:45
+    - (config*, memory.c):
+     - fix swap on HPUX 10.20
+
+whardake 13 Aug 97 04:47:49
+    - (snmpstatus.c): optarg/optind need to be declaired under ultrix4.
+
+whardake 13 Aug 97 08:11:42
+    - (version.h, agent/*, agent/mibgroup/*):
+      - move version string to a global header.
+      - insert USING_*_MODULE macro's in many places to make module
+        removal more possible.  You can now compile with almost no modules
+        installed.
+
+whardake 14 Aug 97 00:46:38
+    - (snmp_parse_args.c, snmptrap.c, snmptrapd.c, main.c):
+      - add -V version flage.
+
+whardake 14 Aug 97 07:38:17
+    - (config*, FAQ, README, agent/mibgroup/*.c, apps/*.c):
+      - Patch from David Paul Zimmerman:
+        - port to AIX 4.1.5.
+        - fix more type casting problems.
+
+whardake 14 Aug 97 08:15:42
+    - (configure*):
+      - Typo's when copying in a autoconf test.
+      - Add errormib to default module list (since its no longer required).
+      - backquote a . in a sed regexp to watch out for module names
+        beginning with the letter o.
+
+whardake 14 Aug 97 08:16:12
+    - (agent/mibgroup/README): Point out that mib list must be in descending order.
+
+whardake 14 Aug 97 08:16:37
+    - (proc.c): don't use seterrorstatus() if not using the errormib.
+
+whardake 14 Aug 97 08:21:26
+    - (interfaces.c): Patch from David C. Lawrence for netbsd * bsd/os 2.0.
+
+whardake 15 Aug 97 02:30:59
+    - (config*, snmpd.c, snmp_client.[ch], system.[ch]):
+      - fix more long/int problems on 64 bit machines u_long -> in_addr_t.
+      - Check for SIOCGIFADDR in sys/ioctl.h and use it in get_myaddr() if
+        defined.
+
+whardake 15 Aug 97 06:46:39
+    version tag ( 3.3.pre3 )
+
+whardake 25 Aug 97 00:21:23
+    - (memory.c): typo in ifdef.
+
+whardake 25 Aug 97 00:21:41
+    - (versiontag): checkin version.h.
+
+whardake 25 Aug 97 00:22:18
+    - (interfaces.c): Patch from Dave Shields for netbsd.
+
+hardaker 14 Oct 97 15:15:23
+    - (mib_api.3): doc addition:  add_mibdir() return value.
+
+hardaker 14 Oct 97 15:16:36
+    - (parse.c): From Dave Shields:
+      - self contained mib .txt files with multiple modules.
+
+hardaker 14 Oct 97 15:19:16
+    - (config*, common_header.h): dynix doesn't have net/route.h.
+
+hardaker 14 Oct 97 15:21:57
+    - (FAQ): From Dave Shields: refer reader to another answer as well.
+
+hardaker 14 Oct 97 15:33:03
+    - (agent/mibgroup/*.c): YMWRAMFSFN:
+      - (yet more warning removals and memory function standardizations from Niels).
+      - minor linux/netbsd/bsdi clean ups.
+
+hardaker 15 Oct 97 09:50:08
+    - (view_parse.c, snmp_vars.c): From Niels: warning removals and standardization.
+
+hardaker 15 Oct 97 09:58:36
+    - (apps/*.c, agent/snmpd.c, snmplib/*.c): Patch from Niels:
+      - warning fixes.
+      - remove the printf's from the library and set a snmp 'errno' equivalent.
+
+hardaker 15 Oct 97 12:12:02
+    - (apps/*.c, agent/snmpd.c, snmplib/*.c):
+      - create and use new function:  snmp_perror(char *)
+      - free allocated space of snmp_detail upon usage by snmp_api_errstring().
+
+hardaker 15 Oct 97 18:40:38
+    - (config*, agent/mibgroup/hr*): Host resources mib from Dave Shield.
+      - minor patches by me, mostly pointer errors.
+    - (memory.c): fixed a null pointer problem under linux.
+
+hardaker 20 Oct 97 11:45:58
+    - (FAQ): Changes from Dave.
+
+hardaker 20 Oct 97 11:51:34
+    - (config*, agent/snmp*, agent/mibgroup/*.[ch]):
+      - Created a new mibmodule.h configuration macro called
+        config_parse_dot_conf() which can be called to request parsing of
+        the snmpd.conf file(s) on a per module basis.
+      - All related parsing has been striped from read_config.c and move
+        to their correct module instead.
+      - New function: config_perror(char *): print error with file & line #.
+      - basic -Wall cleanups in hr* as well (not nearly done yet).
+
+hardaker 20 Oct 97 16:05:14
+    - (pass.c) don't null last char in command line.
+
+hardaker 20 Oct 97 16:06:16
+    - (read_config.c):
+      - don't report an error if you can't find a snmpd.conf file.
+      - don't report all lines as an error (opps).
+
+hardaker 20 Oct 97 16:38:33
+    - (mib.c): From Dave:  patch DEFAULT_MIBS to take '+' in front.
+
+hardaker 20 Oct 97 16:44:37
+    - (mib.c): patch all other env-vars to take '+' in front.
+
+hardaker 20 Oct 97 17:01:48
+    - (config*, agent/mibgroup/hr_*.c):
+      - A module.c file is no longer required.  Only the .h file is
+        necessary, for people who want to have one module wrap a bunch of others.
+      - removed host.c
+      - renamed all hr_init functions to be auto-called.
+
+hardaker 20 Oct 97 17:15:51
+    - (agent/mibgroup/README, wombat.[ch]):
+      - documentation update to reflect config_parse_dot_conf() usage.
+
+hardaker 20 Oct 97 17:16:58
+    - (config*, agent/mibgroup/hr_*.c):
+      - A module.c file is no longer required.  Only the .h file is
+        necessary, for people who want to have one module wrap a bunch of others.
+      - removed host.c
+      - renamed all hr_init functions to be auto-called.
+
+hardaker 20 Oct 97 18:01:46
+    - (config*, agent/mibgroup/v2party.h, ucd_snmp.h, smux_gated.h):
+      - created new wrappers for the various modules to make them easy to
+        add and remove as needed.
+
+hardaker 20 Oct 97 19:42:46
+    - (acconfig.h, config.h.in): define linux's OS type.
+
+hardaker 20 Oct 97 19:43:13
+    - (snmp_vars.c): define at least blank func nlist_init() on linux.
+
+hardaker 21 Oct 97 10:15:54
+    - (PORTING, README): minor updates.
+
+hardaker 21 Oct 97 10:45:47
+    - (snmp_parse_args.c): allow -v 2h and 2p for party code.
+
+hardaker 21 Oct 97 11:00:57
+    - (hr_storage.c, hr_swrun.c, memory.c): close open files on linux.
+
+hardaker 21 Oct 97 11:01:27
+    - (NEWS): beginnings of NEWS updates.
+
+hardaker 21 Oct 97 11:02:46
+    version tag ( 3.3.pre4 )
+
+hardaker 21 Oct 97 12:25:03
+    - (agent/read_config.[ch], snmpd.c, snmp_vars.c, mibgroup/*):
+      - moved read_config.[ch] up a level to always be compiled in.
+
+hardaker 21 Oct 97 12:31:54
+    - (*/Makefile.in): make makefileindepend setup.
+
+hardaker 21 Oct 97 12:32:08
+    - (*/Makefile.in): make makefileindepend..
+
+hardaker 21 Oct 97 12:36:33
+    - (*/Makefile.in): did a make depend.
+
+hardaker 21 Oct 97 12:36:39
+    version tag ( 3.3.pre5 )
+
+hardaker 22 Oct 97 11:40:06
+    - (common_header.h, read_config.c, disk.c, snmp_parse_args.c):
+      - Typo's fixed by Niels.
+
+hardaker 27 Oct 97 09:56:26
+    - (config*, agent/mibgroup/*.h):
+      - new config macro:  config_arch_require(arch, module).
+      - moved arch dependant modules (memory, hpux, kernel_sunos5) loads
+        from the configure into the appropriate .h files.
+    - (interfaces.c, var_route.c):
+      - typecast klookup calls for freebsd2.
+
+hardaker 27 Oct 97 14:03:15
+    - (agent/snmp_agent.c snmp_vars.c): Changes from Joe Marzot and David Perkins:
+      - v2h -> v2p, v2 -> v2c.
+
+hardaker 27 Oct 97 14:04:33
+    - (apps/*.c):
+      - changes for WIN32 support.
+      - support for command line flags without spaces.
+      - v2h -> v2p.
+
+hardaker 27 Oct 97 14:16:42
+    - (snmplib/*.[ch]): Changes from Joe Marzot and David Perkins:
+      - changes for WIN32 support.
+      - v2h -> v2p.
+
+hardaker 27 Oct 97 14:19:18
+    - (win32): Changes from Joe Marzot and David Perkins:
+      - project dir for WIN32 support.
+
+hardaker 27 Oct 97 14:19:18
+    file config.h was initially added on branch V2C-WIN32-3-3-pre3.
+
+hardaker 27 Oct 97 14:19:18
+    file win32.dsw was initially added on branch V2C-WIN32-3-3-pre3.
+
+hardaker 27 Oct 97 14:19:18
+    file win32.opt was initially added on branch V2C-WIN32-3-3-pre3.
+
+hardaker 27 Oct 97 14:19:25
+    - (win32): Changes from Joe Marzot and David Perkins:
+      - project dir for WIN32 support.
+
+hardaker 27 Oct 97 14:19:25
+    file libsnmp.dsp was initially added on branch V2C-WIN32-3-3-pre3.
+
+hardaker 27 Oct 97 14:19:25
+    file libsnmp.plg was initially added on branch V2C-WIN32-3-3-pre3.
+
+hardaker 27 Oct 97 14:19:28
+    - (win32): Changes from Joe Marzot and David Perkins:
+      - project dir for WIN32 support.
+
+hardaker 27 Oct 97 14:19:28
+    file libsnmp.def was initially added on branch V2C-WIN32-3-3-pre3.
+
+hardaker 27 Oct 97 14:19:28
+    file libsnmp_dll.dsp was initially added on branch V2C-WIN32-3-3-pre3.
+
+hardaker 27 Oct 97 14:19:28
+    file libsnmp_dll.plg was initially added on branch V2C-WIN32-3-3-pre3.
+
+hardaker 27 Oct 97 14:19:31
+    - (win32): Changes from Joe Marzot and David Perkins:
+      - project dir for WIN32 support.
+
+hardaker 27 Oct 97 14:19:31
+    file snmpbulkwalk.dsp was initially added on branch V2C-WIN32-3-3-pre3.
+
+hardaker 27 Oct 97 14:19:31
+    file snmpbulkwalk.plg was initially added on branch V2C-WIN32-3-3-pre3.
+
+hardaker 27 Oct 97 14:19:34
+    - (win32): Changes from Joe Marzot and David Perkins:
+      - project dir for WIN32 support.
+
+hardaker 27 Oct 97 14:19:34
+    file snmpget.dsp was initially added on branch V2C-WIN32-3-3-pre3.
+
+hardaker 27 Oct 97 14:19:34
+    file snmpget.plg was initially added on branch V2C-WIN32-3-3-pre3.
+
+hardaker 27 Oct 97 14:19:37
+    - (win32): Changes from Joe Marzot and David Perkins:
+      - project dir for WIN32 support.
+
+hardaker 27 Oct 97 14:19:37
+    file snmpgetnext.dsp was initially added on branch V2C-WIN32-3-3-pre3.
+
+hardaker 27 Oct 97 14:19:37
+    file snmpgetnext.plg was initially added on branch V2C-WIN32-3-3-pre3.
+
+hardaker 27 Oct 97 14:19:41
+    - (win32): Changes from Joe Marzot and David Perkins:
+      - project dir for WIN32 support.
+
+hardaker 27 Oct 97 14:19:41
+    file snmpset.dsp was initially added on branch V2C-WIN32-3-3-pre3.
+
+hardaker 27 Oct 97 14:19:41
+    file snmpset.plg was initially added on branch V2C-WIN32-3-3-pre3.
+
+hardaker 27 Oct 97 14:19:44
+    - (win32): Changes from Joe Marzot and David Perkins:
+      - project dir for WIN32 support.
+
+hardaker 27 Oct 97 14:19:44
+    file snmpstatus.dsp was initially added on branch V2C-WIN32-3-3-pre3.
+
+hardaker 27 Oct 97 14:19:44
+    file snmpstatus.plg was initially added on branch V2C-WIN32-3-3-pre3.
+
+hardaker 27 Oct 97 14:19:47
+    - (win32): Changes from Joe Marzot and David Perkins:
+      - project dir for WIN32 support.
+
+hardaker 27 Oct 97 14:19:47
+    file snmptranslate.dsp was initially added on branch V2C-WIN32-3-3-pre3.
+
+hardaker 27 Oct 97 14:19:47
+    file snmptranslate.plg was initially added on branch V2C-WIN32-3-3-pre3.
+
+hardaker 27 Oct 97 14:19:52
+    - (win32): Changes from Joe Marzot and David Perkins:
+      - project dir for WIN32 support.
+
+hardaker 27 Oct 97 14:19:52
+    file snmpwalk.dsp was initially added on branch V2C-WIN32-3-3-pre3.
+
+hardaker 27 Oct 97 14:19:52
+    file snmpwalk.plg was initially added on branch V2C-WIN32-3-3-pre3.
+
+hardaker 27 Oct 97 15:17:11
+    - (config*) win32 header checks.
+
+hardaker 27 Oct 97 15:17:50
+    - (agent/kernel.c, snmp_agent.c):
+      - ERROR() -> ERROR_MSG().
+      - funtion renames.
+
+hardaker 27 Oct 97 15:18:16
+    - (agent/mibgroup/*.c):
+      - ERROR() -> ERROR_MSG().
+
+hardaker 27 Oct 97 15:21:53
+    - (apps/snmp_parse_args.c):
+      - put tabs back in help string.
+      - put version string request back in.
+      - make error strings better and put back in periods.
+      - don't bomb on unknown parameters for future use.
+
+hardaker 27 Oct 97 15:22:21
+    - (snmplib/snmp.c): put strdup declairation back in.
+
+hardaker 27 Oct 97 15:23:20
+    - (snmplib/snmp_auth.c):
+      - remove #ifdef OLD requirement.
+      - change back int->long argument change for snmp_comstr_build.
+
+hardaker 27 Oct 97 15:37:46
+    - (snmplib/snmp.h):
+      - snmp version #define clairification on future implementations.
+      - more clearly state purpose of future SNMPV3.
+
+hardaker 27 Oct 97 16:26:57
+    - (*): merge of W32 port and main version branch.
+
+hardaker 27 Oct 97 16:34:45
+    - (snmp_api.[ch]): fix perror losses from merge.
+
+hardaker 27 Oct 97 17:04:51
+    - (hr_*.c): ERROR -> ERROR_MSG.
+
+hardaker 27 Oct 97 17:05:12
+    - (snmpstatus.c): remove duplicate declairation.
+
+hardaker 27 Oct 97 17:42:55
+    - (snmp_vars.c): two modules for extensible count.
+
+hardaker 27 Oct 97 17:43:22
+    - (agent/mibgroup/hr_*.h): proper init_ prototypes.
+
+hardaker 27 Oct 97 17:43:50
+    - (snmp_parse_args.c): missing a else statement (sigh).
+
+hardaker 27 Oct 97 17:44:27
+    - (snmp_auth.c): merge bugs.  Missing brackets.
+
+hardaker 27 Oct 97 17:47:00
+    - (snmp_api.c): merge bugs: else check against pdu command type.
+
+hardaker 27 Oct 97 18:02:56
+    win32 files
+
+hardaker 27 Oct 97 18:05:36
+    - (win32):  add files on main branch.
+
+hardaker 27 Oct 97 18:18:36
+    - (snmpwalk.c): remove gotroot var.
+
+hardaker 27 Oct 97 18:18:57
+    - (snmplib/*.c): use snmp_set_detail to handle malloc/free of snmp_detail.
+
+hardaker 27 Oct 97 18:26:41
+    - (configure.in): fix config_arch_require macro to actually work.
+
+hardaker 27 Oct 97 18:31:34
+    version tag ( 3.3.pre6 )
+
+hardaker 28 Oct 97 09:56:11
+    - (acconfig.h, system.[ch], snmp.c): move strdup def to system.[ch].
+
+hardaker 28 Oct 97 14:30:55
+    - (acconfig.h, mib.c): use ';'s for DOS env paths.
+
+hardaker 28 Oct 97 14:42:23
+    - (config*): fix rtentry structure checks for the *bsd groups.
+
+hardaker 28 Oct 97 14:54:24
+    - (*.*.*.*): rename macro __P -> __UCD_P to reduce stupid conflicts.
+
+hardaker 28 Oct 97 15:50:05
+    - (config*, route_write.c, var_route.c):
+      - fix rtentry problems once and for probably never.
+
+hardaker 28 Oct 97 17:09:57
+    - (acconfig.h, UCD-SNMP-MIB.txt): define bsdi agent type.
+
+hardaker 28 Oct 97 17:10:58
+    - (util_funcs.c): Patch from Nobuo_Okabe@yokogawa.co.jp:
+      - fix unwrapped fopen() by adding return NULL check.
+
+hardaker 28 Oct 97 17:12:00
+    version tag ( 3.3.pre7 )
+
+hardaker 29 Oct 97 09:41:54
+    - (snmptrap.c): remove unused nlist struct.
+
+hardaker 29 Oct 97 09:42:07
+    - (snmp_parse_args.c): add sys/select.h for aix.
+
+hardaker 29 Oct 97 09:57:48
+    - (disk.[ch], struct.h, sedscript.in, snmpd.conf.5.def, UCD-SNMP-MIB.txt):
+      - Patch from Simon Burge to allow a minimum percentage on disk space.
+        - (was originally a maximum, but I changed it to minimum instead).
+
+hardaker 29 Oct 97 10:06:11
+    - (disk.c): fix pointer problems from old read_config form to new.
+
+hardaker 29 Oct 97 10:06:34
+    - (snmpd.conf.5.def): remove space before % sign.
+
+hardaker 29 Oct 97 10:25:31
+    - (*/Makefile.in, man/*):
+      - Patch from Simon Burge to change installation paths.
+        - (modified to point agent to sbindir instead of etcdir).
+
+hardaker 29 Oct 97 10:48:18
+    - (config*, */Makefile.in):
+      - Move snmplibpath to @datadir@ which defaults to /usr/local/share/snmp.
+
+hardaker 29 Oct 97 10:54:07
+    - (agent/Makefile.in): opps, forgot to put in @exec_path@.
+
+hardaker 29 Oct 97 11:20:54
+    - (acconfig.h, asn1.c, mib.[ch], parse.h,apps/*,errormib.c,loadave.c,
+       extensible.c, disk.c, snmpdelta*): Patch from Niels Baggesen:
+      - the now wellknown NetBSD fix,
+      - SunOS4 cc doesn't like unsigned literals or strtoul,
+      - added a char version of ";",
+      - added fprint_variable, fprint_objid etc
+      - changed the apps to print all error messages to stderr,
+      - completed the access and status values in snmplib/parse.h
+      - added a roughly patched version of snmpdelta.
+
+hardaker 29 Oct 97 12:23:26
+    - (parse.h): STATUS_KW_OPTIONAL -> STATUS_OPTIONAL
+
+hardaker 29 Oct 97 12:43:44
+    - (*.*.*): __UCD_P -> __P, and a configure check to look for it.
+
+hardaker 29 Oct 97 12:57:48
+    - (config*): check and include sys/cdefs.h in config.h.
+
+hardaker 29 Oct 97 12:58:01
+    - (host_res.h): don't include config.h twice.
+
+hardaker 29 Oct 97 14:00:38
+    version tag ( 3.3.pre8 )
+
+hardaker  4 Nov 97 12:47:12
+    - (read_config.c):
+      - #include mib_module_config.h
+      - USING_EXTENSIBLE_MIB_MODULE -> USING_EXTENSIBLE_MIB_MODULE
+
+hardaker  4 Nov 97 12:47:59
+    - (configure.in):
+      - Check for $prefix being defined as NONE for other vars.
+
+hardaker  5 Nov 97 13:42:57
+    - (apps/Makefile.in): put snmptrapd in @sbindir@
+
+hardaker  5 Nov 97 13:44:58
+    - (common_header.h): Patch from Dave Shields for hpux10 re-defining problems.
+
+hardaker  5 Nov 97 13:45:23
+    - (hr_disk.c): new version for hpux10 support from Dave Shield.
+
+hardaker  5 Nov 97 13:46:17
+    - (hr_filesys.c, hr_swrun.c, hr_utils.c): Patches from Dave Shield:
+      - bug fixes and hpux10 support.
+
+hardaker  5 Nov 97 13:46:46
+    - (var_route.c): from Dave Shield: don't prototype malloc.
+
+hardaker  5 Nov 97 13:48:07
+    - (*): merge from Dave's pre6 patches.
+
+hardaker  5 Nov 97 13:52:00
+    - (snmp_agent.c, snmp_vars.c, snmpd.c, disk.c, proc.c, util_funcs.c):
+      - #include "mib_module_config.h".
+
+hardaker  5 Nov 97 13:56:58
+    - (at.c, icmp.c, interfaces.c, ip.c, tcp.c, udp.c):
+      - #include "mib_module_config.h"
+
+hardaker  5 Nov 97 14:00:09
+    - (Makefile.in, kernel_sunos5.c, mib.c): Patch from Niels Baggesen:
+      - octet counters for solaris.
+      - Makefile.in patches.
+
+hardaker  5 Nov 97 14:40:07
+    - (memory.c): protect vmmeter.h from multiple inclusions on netbsd.
+
+hardaker  5 Nov 97 15:29:50
+    version tag ( 3.3.pre9 )
+
+hardaker  7 Nov 97 12:24:22
+    - (configure.in): check for linux/hdreg.h
+
+hardaker  7 Nov 97 12:25:35
+    - (hr_swrun.c): don't print a variable that doesn't exist under linux.
+
+hardaker  7 Nov 97 12:28:03
+    - (kernel_sunos5.c): patch from Niels for solaris >2.6.
+
+hardaker  7 Nov 97 13:37:14
+    - (read_config.c, snmp_agent.c, snmpd.c): USING.*_MIB_MODULE -> USING.*_MODULE.
+
+hardaker  7 Nov 97 13:37:44
+    - (hr_network.c): don't pass char ** to interfaces_scan_next().
+
+hardaker  7 Nov 97 13:38:36
+    - (snmpwalk.c): stop on no response from host.
+
+hardaker  7 Nov 97 15:19:24
+    - (acconfig.h): patch from Joe Marzot:
+      - define _CRTIMP for unix due to W32 bad OS designs.
+
+hardaker  7 Nov 97 15:19:59
+    - (snmpgetnext.h): patch from Joe Marzot:
+      - use _CRTIMP in front of errno declaration.
+
+hardaker  7 Nov 97 15:20:54
+    - (parse.[ch], snmp_client.c): patch from Joe Marzot:
+      - use _CRTIMP in front of errno declaration.
+      - define find_node externally.
+
+hardaker  7 Nov 97 15:22:09
+    - (win32/*): patch from Joe Marzot:
+      - win32 specific changes.
+
+hardaker  7 Nov 97 15:28:59
+    - (*): merge to main branch:  patches from Joe Marzot.
+
+hardaker  7 Nov 97 16:16:53
+    - (configure.in): watch out for /usr/ucb/cc on solaris and don't use it.
+
+hardaker  7 Nov 97 16:37:01
+    - (NEWS, README, TODO): Documentation updates.
+
+hardaker  7 Nov 97 16:38:49
+    version tag ( 3.3.pre10 )
+
+hardaker 12 Nov 97 07:42:24
+    - (snmptranslate.c): Patch from Joe Marzot: W32 specific fixes.
+
+hardaker 12 Nov 97 08:26:45
+    - (snmp_client.c): Patch from Joe Marzot:
+      - Free a pdu in a spot that should technically never be needed, but
+        is nice for people reading the code.
+
+hardaker 12 Nov 97 09:17:08
+    - (FAQ): Doc update from Dave Shield.
+
+hardaker 12 Nov 97 09:17:28
+    - (mib_api.3): Doc update from Dave Shield.
+
+hardaker 12 Nov 97 09:18:02
+    - (hr_swrun.c): Patch from Dave Shield for linux/hpux10 problems.
+
+hardaker 12 Nov 97 10:25:30
+    - (NEWS, TODO): Patch from Niels Baggesen:
+      - doc update.
+
+hardaker 12 Nov 97 10:27:08
+    - (*/Makefile.in): Patch from Niels Baggesen:
+      - add @datadir@ to files that needed it.
+
+hardaker 12 Nov 97 10:27:46
+    - (kernel_sunos5.c): Patch from Niels Baggesen:
+      - solaris patches.
+
+hardaker 12 Nov 97 10:28:11
+    - (party_vars.c): Patch from Niels Baggesen:
+      - include netinet/in.h if available.
+
+hardaker 12 Nov 97 10:29:42
+    - (Makefile.in): Patch from Niels Baggesen:
+      - add @datadir@ to files that needed it.
+
+hardaker 12 Nov 97 10:30:57
+    - (apps/*.c): Patch from Niels Baggesen:
+      - various (remove unneeded vars, etc).
+      - add snmptable.
+      - make snmptrapd multi-lingual.
+
+hardaker 12 Nov 97 10:32:22
+    - (snmpnetstat/main.c): Patch from Niels Baggesen:
+      - snmpv2c support and argument parsing changes.
+
+hardaker 12 Nov 97 10:33:20
+    - (man/snmpdelta.1,snmptable.1,snmptrapd.8): Patch from Niels Baggesen:
+      - documentation changes and additions.
+
+hardaker 12 Nov 97 10:38:36
+    - (parse.c, parse.h): Patch from Niels Baggesen:
+      - parser improvements.
+      - parser directory caching.
+      - save_descriptions/mib_warnings set functions.
+
+hardaker 12 Nov 97 10:44:47
+    - (NEWS): doc update.
+
+hardaker 12 Nov 97 15:10:27
+    - (system.h): Don't include config.h!
+
+hardaker 12 Nov 97 15:16:44
+    - (party_vars.c): include STDC_HEADERS for AIX.
+
+hardaker 12 Nov 97 15:21:41
+    - (parse.c): include STDC_HEADERS for AIX.
+
+hardaker 12 Nov 97 15:42:02
+    - (*/Makefile.in): make depend.
+
+hardaker 12 Nov 97 16:05:47
+    version tag ( 3.3.pre11 )
+
+hardaker 12 Nov 97 20:27:11
+    - (win32/libsnmp_dll/libsnmp.def): Patch from Joe Marzot: function changes.
+
+hardaker 12 Nov 97 20:35:00
+    - (): Patch from David Zimmerman:
+      - Fixes for AIX.
+
+hardaker 12 Nov 97 20:35:27
+    - (var_route.c, read_config.c, snmpdelta.c): Patch from David Zimmerman:
+      - Fixes for AIX.
+
+hardaker 12 Nov 97 20:43:33
+    - (var_route.c, read_config.c): fix qsort params for STDC.
+
+hardaker 12 Nov 97 20:47:47
+    - (var_route.c, read_config.c): STDC typos.
+
+hardaker 14 Nov 97 08:31:41
+    - (wombat.c): code comments from Alan Batie.
+
+hardaker 14 Nov 97 08:32:26
+    - (README): coder list update.
+
+hardaker 14 Nov 97 12:21:10
+    - (wombat.c): quick doc change.
+
+hardaker 14 Nov 97 12:35:19
+    - (FAQ, NEWS, README): last documentation updates.
+
+	
+	
+-------------------------------------------------------------------------------
+
+Changes: V3.1.3 -> V3.2
+
+whardake 11 Feb 97 12:48:06
+    - (snmp_vars.c, snmp_var_route.c, snmp_vars.linux.h): Patch from Jennifer Bray:
+      - Get agent working on linux.
+
+whardake 11 Feb 97 12:50:46
+    - (snmp_vars.linux.h): Removed non-linux specific stuff.
+
+whardake 11 Feb 97 12:54:36
+    - (snmp_vars.c): Patch from Dave Shield:  Fix hpux specific problems.
+
+whardake 11 Feb 97 13:11:21
+    - (*Makefile.in): Patch from Philip Guenther:
+      - Fix all Makefile.in's to support a different src dir.
+
+whardake 11 Feb 97 13:12:19
+    - (README): Update people supplying patches list.
+
+whardake 11 Feb 97 13:19:37
+    - (all .c with main(), snmplib/*): Patch from Philip Guenther:
+      - Make better support for shared lib possibilities.
+
+whardake 11 Feb 97 14:10:11
+    - (snmp_vars.linux.h): Fix #ifdef.
+
+whardake 11 Feb 97 14:11:24
+    - ({local,man,ov}/Makefile.in): Remove spaces in front of tabs.
+
+whardake 11 Feb 97 14:13:34
+    - (snmp_auth.c): remove non-static md5digest prototype.
+
+whardake 11 Feb 97 14:14:05
+    version tag ( 3.1.4.pre1 )
+
+whardake 11 Feb 97 16:42:02
+    - (apps/Makefile.in): Patch from Simon Leinin to descend when make cleaning.
+
+whardake 11 Feb 97 16:44:08
+    - (man/Makefile.in): Patch from Simon Leinin to fix srcdir problems.
+
+whardake 11 Feb 97 17:00:26
+    - (Makefile.in): Rest of Philip's patch to fix srcdir problems (sh vars).
+
+whardake 17 Feb 97 14:41:08
+    - (agent/snmp_vars, agent/mibgroup): Dave Shield split up the
+      snmp_vars.c and related files into pieces for easier management.
+      The results of his work are in the new agent/mibgroup directory.
+
+whardake 17 Feb 97 14:47:13
+    - (mib.c, snmp_api.c, snmp_api.h): Patch from Dave Shield to remove
+      ANSI specific requirements.
+
+whardake 17 Feb 97 14:53:24
+    - (agent/*Makefile.in):  Make depend.
+
+whardake 17 Feb 97 15:30:04
+    - (alarm.c): typedef for getStatPtr().
+
+whardake 17 Feb 97 15:30:36
+    - (event.c): Was passing an int to bcopy instead of &int.
+
+whardake 17 Feb 97 15:31:25
+    - (icmp.c): don't use ret variable, since it's not defined.
+
+whardake 17 Feb 97 15:32:30
+    - (interfaces.c): Remove MAX_NAME_LENGTH requirements.
+
+whardake 17 Feb 97 16:11:09
+    version tag ( 3.1.4.pre2 )
+
+whardake  4 Mar 97 15:46:30
+    - (config*, mibgroup/Makefile.in):
+      - mibgroup compile list is build by configure and can be augmented
+        by the --with-mib-modules="list of modules" command line to configure.
+
+whardake  5 Mar 97 09:49:59
+    - (config*, agent/*, agent/mibgroup/*):
+      - Added .o file list to agent/Makefile.in generated by configure.
+      - new files generated by configure:
+        - mibgroup/mib_module_includes.h:  A list of mib .h files for snmp_vars.h.
+                                       (every module *must* have a .h file)
+        - mibgroup/mib_module_inits.h: A list of init_wombat() type functions.
+                                       (only present if exist in wombat.c).
+        - mibgroup/mib_module_loads.h: This file is generated by a new macro in
+                                       the mib.h files called
+                                       config_load_mib(), which simplifies
+                                       the loading of the mib sections.
+
+whardake  5 Mar 97 10:03:58
+    - (system.c): removed system nlist (unused).
+
+whardake  5 Mar 97 11:17:44
+    - (snmp_client.c): Patch from Elwyn B Davies:
+      - Fix a PDU cloning bug.
+
+whardake  5 Mar 97 11:28:20
+    - (*.c, *.h): Patch from Niels Baggesen to prototype *everything*.
+
+whardake  5 Mar 97 11:28:23
+    file kernel.h was initially added on branch Ext-3-1-4-pre2-niels.
+
+whardake  5 Mar 97 11:28:45
+    - (*.c, *.h): Patch from Niels Baggesen to prototype *everything*.
+
+whardake  5 Mar 97 11:28:48
+    file snmpd.h was initially added on branch Ext-3-1-4-pre2-niels.
+
+whardake  5 Mar 97 11:35:18
+    - (*.c, *.h): Patch from Niels Baggesen to prototype *everything*.
+
+whardake  5 Mar 97 11:37:35
+    - (README): Contributer name addition.
+
+whardake  5 Mar 97 15:06:41
+    - (*.c, *.h): Patch from Niels Baggesen to prototype *everything*.
+
+whardake  5 Mar 97 16:13:38
+    - (acl_vars.c): incorrectly fixed prototyping errors for write_acl().
+
+whardake  5 Mar 97 16:15:54
+    - (snmp_api.c): fixed prototyping errors in snmp_parse.  Possibly wrong.
+
+whardake  5 Mar 97 16:29:05
+    - (snmp_api.c): Yep. It was wrong.  Tested and works now.
+
+whardake  7 Mar 97 09:06:34
+    - (extensible/* -> mibgroup/*): moved extensible stuff to mib modules.
+
+whardake  7 Mar 97 09:07:07
+    - (snmp_vars.c): removed more non-mibgroup specific calls and headers.
+
+whardake  7 Mar 97 09:59:28
+    - (snmp_vars.h, mibgroup/*): strict-prototyping and config_require()s.
+
+whardake  7 Mar 97 10:07:53
+    - (mibmodule/versiontag): moved into place from extensible/
+
+whardake  7 Mar 97 10:34:53
+    - (hpux.[ch]): Added hpux specific files from extensible dir.
+
+whardake  7 Mar 97 10:43:08
+    - (extensible/*): cvs removing files.
+
+whardake  7 Mar 97 10:49:00
+    - (mibgroup/struct.h): moved to here.
+
+whardake  7 Mar 97 11:43:05
+    - (config*): generate a mib_module_config.h with defines of whats being used.
+
+whardake  7 Mar 97 13:39:24
+    - (makedepend.in): new make depend script
+
+whardake  7 Mar 97 13:40:40
+    - (remove-files): add makedepend.in
+
+whardake  7 Mar 97 13:46:15
+    - (Makefile.in, sedscript.in): Fix sedscript generation.  sigh.
+
+whardake  7 Mar 97 13:47:45
+    - (agent/Makefile.in): make depend and extensible/ removes.
+
+whardake  7 Mar 97 13:48:59
+    - (snmp_agent.c, snmp_vars.c, snmpd.c): remove extproto.h include.
+
+whardake  7 Mar 97 13:50:15
+    - (mibgroup/Makefile.in, apps/Makefile.in, snmplib/Makefile.in): depend.
+
+whardake  7 Mar 97 13:50:52
+    - (hpux.c): ifdef a few headers for correct make depend.
+
+whardake  7 Mar 97 13:51:30
+    - (snmplib/snmp.c): remove second ctype.h include.
+
+whardake  7 Mar 97 14:01:51
+    version tag ( 3.1.4.pre3 )
+
+whardake  7 Mar 97 15:01:05
+    - (mibgroup/*): removed {} requirement from config_load_mib() calls.
+
+whardake  7 Mar 97 15:02:18
+    - (configure): removed {} requirement from config_load_mib() calls.
+
+whardake  7 Mar 97 16:09:58
+    - (config*): make new configure options respect $(srcdir).
+
+whardake  7 Mar 97 16:11:50
+    - (common_header.h): comment out end of #endif.
+
+whardake 10 Mar 97 16:55:46
+    - (configure.in): New configure option:  --with-out-mib-modules="list".
+
+whardake 10 Mar 97 17:28:29
+    - (configure.in): space protect modules when checking for with grep.
+
+whardake 11 Mar 97 09:04:03
+    - (ip.c): freebsd2 patch.
+
+whardake 11 Mar 97 17:39:23
+    - (mibgroup/*):
+      - remove trailing ;s on bunches of functions.
+      - make everything but interfaces.c compile on irix6.3.
+    - (config*,system.c): use uname and gethostname if available.
+    - (configure.in, configure): Don't check _KERNEL if ifnet.if_mtu already works.
+
+whardake 12 Mar 97 09:28:04
+    - (mibgroup/snmp.[hc] -> mibgroup/snmp_mib.[hc]): Moved due to name clashes.
+
+whardake 12 Mar 97 15:47:00
+    - (configure.in, snmpd.c, snmp_agent.c, route_write.[ch],
+      var_route.[ch], ip.[ch], snmp.[ch] -> snmp_mib.[ch]):
+      - Moved snmp mib module -> snmp_mib for naming conflicts with snmplib.
+      - Moved snmp_var_route.c -> mibgroup/var_route.c
+      - Moved write_route.c -> mibgroup/write_route.c
+
+whardake 12 Mar 97 15:48:37
+    - (*/Makefile.in): make depend update.
+
+whardake 12 Mar 97 15:55:20
+    - (mibgroup/README): doc update from Dave Shield.
+
+whardake 12 Mar 97 17:15:20
+    - (snmp_api.c): returns from inet_addr are in_addr_t (u_int) not u_long.
+
+whardake 13 Mar 97 09:37:37
+    - (config*): check for in_addr_t and define as u_int (32 bits) if not present.
+    - (apps/*.c, party_parse.c): use it.
+
+whardake 13 Mar 97 10:14:59
+    - (extensible_subtrees.h): Removed file.
+
+whardake 13 Mar 97 14:35:05
+    - (agent/*, mibgroup/*): moved alarm, context, views, event, party,
+      and acl variable groups to mibgroup/.
+
+whardake 13 Mar 97 14:44:55
+    - (kernel_sunos5.[ch]): moved to mibgroup/.
+    - (route_write.c, snmp_var_route.c): delete from agent dir.
+
+whardake 13 Mar 97 15:35:26
+    - (hpux.c, memory.c, memory.h): Patch from Dave Shields to fix minor problems.
+
+whardake 13 Mar 97 15:36:14
+    - (view_vars.c, context_vars.c, acl_vars.c): don't include snmpv2_vars.h.
+
+whardake 13 Mar 97 15:45:14
+    - (config*): check for system dependent modules.
+
+whardake 13 Mar 97 15:46:16
+    - (*/Makefile.in): New make depend rules to seperate system/non dependent stuff.
+
+whardake 13 Mar 97 16:07:52
+    - (*/Makefile.in): make depend and rule fixes as well.
+
+whardake 13 Mar 97 16:10:58
+    - (config*): remove duplicate gethostname check.
+
+whardake 13 Mar 97 16:17:59
+    - (apps/*/Makefile.in): depend problems fix.
+
+whardake 13 Mar 97 17:17:32
+    - (common_header.h): fix path to alarm.h.
+
+whardake 13 Mar 97 17:47:32
+    - (many): Patch from Niels Baggensen:
+      - A large number of problems with the Linux port
+      - Some problems with NetBSD 1.2C, but it's still not perfect
+      - More (symbolic) debug output from snmpd, when using -V. -d implies -V
+        Shows you variable requested and value returned
+      - Return ipRouteMask under Solaris
+      - snmpnetstat -r shows non-standard netmasks
+      - snmpnetstat -o (new) shows interface octets, without enquiring for mtu
+        and other variables not present for a Cisco Frame-Relay virtual circuit
+        interface
+      - snmpnetstat tcp/udp print-out had ntohs/htons in wrong places for port
+        numbers (shows up on little-endian architectures)
+      - adds a maketarget script that can be used to create a parallel symlinked
+        source directory. Useful if your make does not support VPATH
+
+whardake 14 Mar 97 09:39:15
+    - (ucd-snmp.txt, mib.txt, Makefile.in): Don't build mib files anymore.
+
+whardake 14 Mar 97 09:46:31
+    - (ucd-snmp.txt): moved to mibs/.
+
+whardake 14 Mar 97 09:47:47
+    - (mib.txt): streamed down.
+
+whardake 14 Mar 97 09:50:03
+    - (mibs/{rfc1271,snmpv2,ucd-snmp}.txt): New mibs directory for sub-mibs.
+
+whardake 14 Mar 97 10:48:35
+    - (Makefile.in, config*, mibs/Makefile.in): enable mibs/ make install.
+
+whardake 14 Mar 97 10:49:03
+    - (ucd-snmp.txt): remove the last of the sed script defs.
+
+whardake 14 Mar 97 11:01:19
+    - (snmpd.1.def): Updated to include -c/-C and SNMPCONFPATH env var.
+
+whardake 14 Mar 97 11:07:16
+    - (Makefile.in): Fix sedscript to include s# as well as s/ commands.
+
+whardake 14 Mar 97 11:17:06
+    - (makedepend.in): run on snmpnetstat dir also.
+
+whardake 14 Mar 97 11:18:17
+    - (agent/Makefile.in, apps/snmpnetstat/Makefile.in): make depend.
+
+whardake 14 Mar 97 11:20:39
+    - (snmp_vars_event.h): axe.
+
+whardake 14 Mar 97 11:22:29
+    - (snmp_groupvars.h): axe.
+
+whardake 14 Mar 97 13:51:59
+    - (configure.in, apps/Makefile.in): fix trap by including optional .o files.
+
+whardake 14 Mar 97 13:53:22
+    - (snmpd.c, context_parse.c, party_parse.c, system.[ch]):
+      - 64bit fix: get_myaddr() should return int not long.
+
+whardake 14 Mar 97 13:54:22
+    - (acconfig.h, ucd-snmp.txt): recognize new hosts for sysObjectId.
+
+whardake 14 Mar 97 13:55:50
+    version tag ( 3.1.4.pre4 )
+
+whardake 14 Mar 97 16:16:52
+    - (mibgroup/README): Update from Dave Shield.
+
+whardake 18 Mar 97 16:52:34
+    - (FAQ): Update from Dave Shield.
+
+whardake 18 Mar 97 16:53:26
+    - (FAQ): snmp.conf -> snmpd.conf
+
+whardake 24 Mar 97 09:49:54
+    - (memory.c): prototype write function better.
+
+whardake 24 Mar 97 09:50:49
+    - (example.c,.h): New example mib module duplicating the passtest
+      script in C code.
+
+whardake 24 Mar 97 09:51:16
+    - (Makefile.in): Watch out for multiple spaces in C defs.
+
+whardake 24 Mar 97 09:51:33
+    - (README): runs on bsdi 2.1.
+
+whardake 24 Mar 97 13:56:50
+    - (FAQ): Patch from Dave Shield.
+
+whardake 25 Mar 97 09:39:01
+    - (EXAMPLE.conf.def): added syslocation and syscontact examples.
+
+whardake 25 Mar 97 13:30:05
+    - (INSTALL): minor doc update for new flags.
+
+whardake 26 Mar 97 17:05:11
+    - (mibgroup/system.c): report agent uptime rather than system uptime.
+
+whardake 22 Apr 97 08:42:01
+    - (FAQ): various updates.
+
+whardake 22 Apr 97 15:02:56
+    - (many): Patch from Niels Baggesen to fix various things, mostly on linux.
+
+whardake 22 Apr 97 15:20:30
+    - (README.smux, smux.c, smux.h, snmp_bgp.c, snmp_ospf.c, snmp_rip2.c):
+      - smux support for gated from Rohit Dube.
+
+whardake 22 Apr 97 15:47:06
+    - (common_header.h): remove duplicate (warning) TCP defines on osf4 systems.
+
+whardake 22 Apr 97 15:51:44
+    - (snmp_bgp.[ch], snmp_rip2.[ch], snmp_ospf.[ch]):
+      - conform to new module standards of coding.
+
+whardake 22 Apr 97 16:41:10
+    - (snmp_bgp.c, snmp_rip2.c, snmp_ospf.c, smux.[ch]):
+      - standardize headers for autoconf.
+      - smux_init() -> init_smux().
+      - SMUXDEBUG -> DODEBUG (--enable-debugging turns this on automatically).
+
+whardake 22 Apr 97 17:45:09
+    - (config*, smux.c): Check for headers and define FD_COPY if not defined.
+
+whardake 22 Apr 97 20:49:15
+    version tag ( 3.1.4.pre5 )
+
+whardake  9 May 97 22:38:15
+    - (mib.[ch], parse.[ch], Makefile.in): New parser from Dave Shield:
+      - Run-time control of initial module loading
+              (uses env variables MIBDIRS, MIBS, and MIBFILE)
+      - Defined interfaces for loading modules and retreiving entries
+      - Module scoping now includes Textual Conventions
+      - Tokens implemented internally no longer require importing the
+        corresponding modules
+
+whardake  9 May 97 22:46:30
+    - (smux.c, config*):
+      - check for sgtty.h and prototype better.
+
+whardake  9 May 97 22:46:46
+    - (TODO): Update.
+
+whardake  9 May 97 23:52:40
+    - (smux.[ch]): patches from Niels Baggesen: prototyping.
+
+whardake 10 May 97 00:03:32
+    - (mib.c, parse.c): patches from Niels Baggesen: prototyping (mostly).
+
+whardake 10 May 97 00:28:25
+    - (parse.c): Patch from Dave Shields:  negative numbers in mibs.
+
+whardake 10 May 97 00:46:44
+    - (parse.c): Patch from Dave Shields:  deal with anonymous IDs.
+
+whardake 10 May 97 00:50:20
+    - (parse.c): Patch from Dave Shields:  deal with anonymous IDs (even better).
+
+whardake 10 May 97 16:41:23
+    - (bug-report): Patch from Dave Shields:  don't submit blank bug-reports.
+
+whardake 10 May 97 16:45:14
+    - (FAQ): Patch from Dave Shields:  update.
+
+whardake 10 May 97 16:52:11
+    - (mib_api.3): New file from Dave Shield.
+
+whardake 10 May 97 17:23:21
+    - (snmpd.c, read_config.c, system.c): Patch from Niels Baggesen:
+      - default trap community.
+      - multiple trap sinks.
+
+whardake 12 May 97 08:43:59
+    - (config*, extensible.c):  BSDI3 specific headers and defines.
+
+whardake 12 May 97 08:44:19
+    - (agent/Makefile.in): removed CCHACK ???.
+
+whardake 12 May 97 08:48:13
+    - (INSTALL, README, TODO): documentation update.
+
+whardake 12 May 97 08:49:23
+    - (man/Makefile.in): install mib_api.3.
+
+whardake 12 May 97 08:52:48
+    - (mibs/ucd-snmp.txt): Patch from Mario DeFazio to fix typos.
+      - compiles under SNMPc 4.1g.
+
+whardake 13 May 97 10:51:28
+    - (IF-MIB.txt): New mib file from Niels Baggesen.
+
+whardake 13 May 97 10:51:29
+    - (ucd.txt): New mib file from Niels Baggesen.
+
+whardake 13 May 97 10:51:31
+    - (EtherLike-MIB.txt): New mib file from Niels Baggesen.
+
+whardake 13 May 97 10:51:32
+    - (HOST-RESOURCES-MIB.txt): New mib file from Niels Baggesen.
+
+whardake 13 May 97 10:51:33
+    - (IANAifType-MIB.txt): New mib file from Niels Baggesen.
+
+whardake 13 May 97 10:51:35
+    - (IP-MIB.txt): New mib file from Niels Baggesen.
+
+whardake 13 May 97 10:51:36
+    - (SNMPv2-CONF.txt): New mib file from Niels Baggesen.
+
+whardake 13 May 97 10:51:37
+    - (SNMPv2-MIB.txt): New mib file from Niels Baggesen.
+
+whardake 13 May 97 10:51:39
+    - (SNMPv2-SMI.txt): New mib file from Niels Baggesen.
+
+whardake 13 May 97 10:51:40
+    - (SNMPv2-TC.txt): New mib file from Niels Baggesen.
+
+whardake 13 May 97 10:51:42
+    - (SNMPv2-TM.txt): New mib file from Niels Baggesen.
+
+whardake 13 May 97 10:51:43
+    - (TCP-MIB.txt): New mib file from Niels Baggesen.
+
+whardake 13 May 97 10:51:45
+    - (UDP-MIB.txt): New mib file from Niels Baggesen.
+
+whardake 13 May 97 10:51:46
+    - (SNMPv2-PARTY-MIB.txt): New mib file from Niels Baggesen.
+
+whardake 13 May 97 10:51:48
+    - (SNMPv2-M2M-MIB.txt): New mib file from Niels Baggesen.
+
+whardake 13 May 97 10:51:49
+    - (RFC1271-MIB.txt): New mib file from Niels Baggesen.
+
+whardake 13 May 97 10:51:51
+    - (RFC1155-SMI.txt): New mib file from Niels Baggesen.
+
+whardake 13 May 97 10:51:52
+    - (RFC1213-MIB.txt): New mib file from Niels Baggesen.
+
+whardake 13 May 97 10:52:12
+    - (ucd.txt): whoops.  Removed.
+
+whardake 13 May 97 11:57:10
+    - (rfc1271.txt): removed.
+
+whardake 13 May 97 12:02:26
+    - (snmpv2.txt): removed.
+
+whardake 13 May 97 12:03:04
+    - (mibs/Makefile.in): removed snmpv2.txt, rfc1271.txt.
+
+whardake 13 May 97 14:48:59
+    - (ucd-snmp.txt): Changed ID to UCD-SNMP
+
+whardake 13 May 97 15:05:28
+    - (config*, INSTALL): New flags to set prompted values instead of prompting.
+
+whardake 13 May 97 15:05:53
+    - (README): architecture list update.
+
+whardake 13 May 97 15:36:08
+    - (UCD-SNMP-MIB.txt): moved from ucd-snmp.txt.
+
+whardake 13 May 97 15:36:51
+    - (ucd-snmp.txt): moved to UCD-SNMP-MIB.txt
+
+whardake 13 May 97 15:38:47
+    - (mibs/Makefile.in): ucd-snmp.txt -> UCD-SNMP-MIB.txt.
+
+whardake 13 May 97 16:22:13
+    - (config*,mib.c): New configure option --with-default-mibs="list:list".
+
+whardake 14 May 97 11:41:09
+    - (Makefile.in, mib.txt): removed mib.txt from distribution.  No longer needed.
+
+whardake 14 May 97 13:13:19
+    - (Makefile.in): warn if mib.txt is installed from a previous release.
+
+whardake 14 May 97 13:18:02
+    - (Makefile.in, agent/Makefile.in): Patch from Oddbjorn Steffensen:
+      - Protect against bash needing ';'s on multiple subdir makes.
+
+whardake 14 May 97 13:45:24
+    - (snmpd.c):  Typecast malloc.
+
+whardake 14 May 97 15:00:22
+    version tag ( 3.1.4.pre6 )
+
+whardake 15 May 97 11:22:18
+    - (interfaces.c): patch from Martin Jacobsson for FreeBSD
+
+whardake 15 May 97 11:23:29
+    - (parse.c): Patch from Dave Shield to fix purely numeric OIDs.
+
+whardake 15 May 97 11:28:15
+    - (INSTALL): patch from Niels Baggesen to reference the maketarget script.
+
+whardake 15 May 97 11:29:33
+    - (mib_api.3): patch from Niels Baggesen:  MIBS variable can be set to ALL.
+
+whardake 15 May 97 11:30:01
+    - (UCD-SNMP-MIB.txt): patch from Niels Baggesen:  import indentifiers.
+
+whardake 15 May 97 11:31:01
+    - (SNMPv2-SMI.txt): patch from Niels Baggesen:  ccitt -> 0.
+
+whardake 15 May 97 11:32:56
+    - (mib.c, parse.c): patch from Niels Baggesen:
+      - prototyping and null checking.
+      - if MIBS is set to ALL, parse everything found.
+
+whardake 15 May 97 14:37:39
+    - (parse.c): patch from Dave Shield:
+      - deal with multiple module ID's being referenced or nodes defined.
+      - supress "name clash" warnings for anonymous nodes.
+
+whardake 15 May 97 15:22:51
+    - (parse.h): Patch from Dave Shield:  Add new node structure entries.
+
+whardake 15 May 97 16:01:18
+    - (config*, mib.c):
+      - Changed env variable MIBFILE -> MIBFILES (since it is a list now).
+        (will accept MIBFILE for backwards compatibility).
+      - By default, *no* additional mibfiles are loaded (ie, mib.txt is no
+        longer loaded) and must be turned on through configure or the env var.
+      - New configure options to set default MIBS, MIBFILES, MIBDIRS.
+
+whardake 15 May 97 16:22:19
+    - (configure*, INSTALL):
+      - Display defaults in configure --help lines.
+
+whardake 15 May 97 16:26:12
+    - (configure*, INSTALL):
+      - Wording and order changes in configure --help lines.
+
+whardake 15 May 97 16:43:37
+    - (udp.c): Patch from Martin Jacobssen:
+      - Fix udp_inpcb structures.
+
+whardake 16 May 97 11:25:30
+    - (parse.c): Protect malloc against 0 external imports.
+
+whardake 20 May 97 08:03:35
+    - (udp.c): Only do Martin Jacobssen's fixes for freebsd2.
+
+whardake 20 May 97 08:18:49
+    - (SNMPv2-TC.txt): Comment out ObjectSyntax import.
+
+whardake 20 May 97 08:19:12
+    - (parse.c): protect against 0 import calls.
+
+whardake 20 May 97 08:19:28
+    - (mib.c, snmp_auth.c): include sys/select.h for AIX.
+
+whardake 20 May 97 10:08:25
+    version tag ( 3.1.4.pre7 )
+
+whardake 20 May 97 11:24:27
+    - (udp.c): Patch from Martin Jacobsson:  Fix my cpp stupidity.
+
+whardake 20 May 97 16:50:18
+    - (TODO): snmpset should check against size defined in mib.
+
+whardake 20 May 97 16:50:55
+    - (parse.c): code from Dave Shield: add back in find_node() for perl usage.
+
+whardake 21 May 97 10:13:38
+    - (NEWS): Update for 3.2.
+
+whardake 21 May 97 15:38:32
+    - (NEWS): Changes from Dave.
+
+whardake 21 May 97 15:40:31
+    - (FAQ): Changes from Dave.
+
+whardake 22 May 97 13:13:59
+    - (SNMPv2-M2M-MIB.txt): restored.  Got truncated.
+
+whardake 23 May 97 13:35:14
+    - (acconfig.h, config.h.in): Set default MIB list.
+
+whardake 23 May 97 13:36:17
+    - (snmpd.c): Patch from Niels Bagessen to fix endiannes problems.
+
+whardake 23 May 97 13:37:02
+    - (HOST-RESOURCES-MIB.txt, SNMPv2-TC.txt): From Niels: change import clauses.
+
+whardake 23 May 97 13:37:39
+    - (snmp_client.c): Patch from Niels Bagessen to fix endiennes problems.
+
+whardake 23 May 97 13:38:13
+    - (snmp_api.c): Patch from Niels Bagessen to fix multiple frees in v2 pdu's.
+
+whardake 23 May 97 13:40:09
+    - (mib.c): Patch from Dave Shields to fix SNMP perl again.
+
+whardake 23 May 97 13:40:32
+    - (snmp_api.h): Change trap types from int to long.
+
+whardake 23 May 97 16:23:56
+    version tag ( 3.1.4.pre8 )
+
+whardake 23 May 97 16:34:33
+    - (mib_api.3): Modifiy to note default mibs.
+
+whardake 26 May 97 10:50:20
+    - (INSTALL, configure): default mibs listed correctly.
+
+whardake 26 May 97 10:52:12
+    - (snmp_api.h): trap long's back to ints, bad solution.
+
+whardake 26 May 97 10:56:19
+    - (snmpcheck.def): new variables to set walk/get/set command line usage.
+
+whardake 26 May 97 11:38:41
+    - (parse.c): Patch from niels Baggesen to:
+      - close mibfiles for MIBS=ALL.
+      - Allow SYNTAX DisplayString (SIZE(1..255)) inside OBJECT-TYPE.
+	
+-------------------------------------------------------------------------------
+
+Changes: V3.1.2.1 -> V3.1.3
+
+whardake 10 Jan 97 08:43:42
+    - (COPYING):  Update for 97.
+
+whardake 10 Jan 97 08:46:00
+    - (config*): Check for /dev/ksyms for solaris kernel.
+
+whardake 10 Jan 97 08:46:36
+    - (snmptrapd.c): Remove broken FD_SET code.
+
+whardake 14 Jan 97 16:45:33
+    - (PORTING, README, TODO):  Added ucd-snmp-coders as default mail address.
+
+whardake 17 Jan 97 09:28:56
+    patch niels.0
+
+whardake 17 Jan 97 11:51:40
+    - (snmpd.c, extensible.c):
+      - New arg -c FILE:  	   Read FILE as a configuration file as well.
+      - New arg -C:       	   Don't read default configuration files.
+      - New env SNMPCONFPATH:  Read snmpd{,.local}.conf files in : seperated path.
+
+whardake 17 Jan 97 11:58:46
+    - (snmpd.c):
+      - Usage() update and version printout update.
+
+whardake 17 Jan 97 14:55:28
+    Dave Shield patches
+
+whardake 20 Jan 97 11:17:53
+    Niel's patches integrated
+
+whardake 20 Jan 97 15:09:25
+    - Patches from Dave Shield <D.T.Shield@csc.liv.ac.uk>:
+     - implemented: interfaces.ifTable.ifEntry.ifSpecific,
+          ip.ipRoutingDiscards,
+          ip.ipAddrTable.ipAddrEntry.ipAdEntReasmMaxSize,
+          ip.ipRouteTable.ipRouteEntry.ipRouteMask ,
+          ip.ipRouteTable.ipRouteEntry.ipRouteMetric5,
+          ip.ipRouteTable.ipRouteEntry.ipRouteInfo, ip.ipNetToMediaTable,
+          udp.udpTable.
+     - udp connection table.
+     - ipNetToMedia.
+    
+    - Patches from Niels Baggesen <Niels.Baggesen@uni-c.dk>:
+     - udpNoPort, tcpInErrs fixes for Solaris.
+     - linux application support.
+     - snmp variable group.
+     - simple cold start traps via exec('snmptrap').
+     - MIB parser fixes.
+     - Memory/free allocation fixes.
+
+whardake 20 Jan 97 15:22:53
+    - Patches from Niels Baggesen <Niels.Baggesen@uni-c.dk>:
+     - (snmp_client.c): Wait 120 seconds before returning.
+
+whardake 20 Jan 97 15:37:08
+    - (config*): Autoheader is dumb:  Put macro defines belowe @BOTTOM@ symbol.
+
+whardake 20 Jan 97 15:38:59
+    - (snmp_vars.c, extensible.c, read_config.c): Remove ANSI cpp #elif's.
+
+whardake 20 Jan 97 15:50:37
+    - (snmp_vars.c): bsdi #ifdef fixes.
+
+whardake 20 Jan 97 15:55:45
+    - (snmp_vars.c): Patch from Martin Jacobsson <martin@exmandato.se>:
+      - add bsdi to some #ifdefs.
+
+whardake 20 Jan 97 15:58:51
+    - (extensible.c): Patch from Martin Jacobsson <martin@exmandato.se>:
+      - watch out for string lengths on version desc and sysname.
+
+whardake 20 Jan 97 16:38:20
+    patrice.1 patch
+
+whardake 20 Jan 97 16:43:25
+    - (snmp_api.c, snmp_client.[ch]):
+      - Patch from Patrice VANACKER <vanacker@worldnet.fr>:
+        - fix request deletions in snmp_read().
+        - added return argument to snmp_add_null_var().
+
+whardake 20 Jan 97 16:59:02
+    - (extensible.c): Patch from sxjzhang@sss.ssi1.com:
+        - fix disk reporting on sunos 4.1.3 with ODS 1.0.
+
+whardake 20 Jan 97 16:59:56
+    version tag ( 3.1.3.pre1 )
+
+whardake 21 Jan 97 08:33:04
+    - (read_config.c): Patch from Karl Lehenbauer <karl@hammer1.ops.NeoSoft.com>:
+      - #if DODEBUG -> #ifdef DODEBUG.
+
+whardake 21 Jan 97 08:33:52
+    - (snmpd.c): remove second char definition.
+
+whardake 21 Jan 97 08:34:32
+    - (snmp_client.h): remove second (wrong) function prototype.
+
+whardake 21 Jan 97 09:17:42
+    - (snmp_var_route.c, snmp_vars.c):
+      - Patch from Karl Lehenbauer <karl@hammer1.ops.NeoSoft.com>
+        - handle multiple interface names > 10 properly.
+
+whardake 29 Jan 97 10:47:40
+    bug reporting script add
+
+whardake 29 Jan 97 12:07:00
+    - (bug-report):
+     - Always use multipart: version info and config.cache are one.
+     - re-arranged a bit.
+     - Added introduction.
+     - Guess at domain name if possible.
+
+whardake 29 Jan 97 12:07:59
+    - (acconfig.h):
+     - SNMPBLOCK = !SNMPBLOCK
+
+whardake 29 Jan 97 12:09:05
+    - (aclocal.m4): Fix check_struct_for to define things correctly.
+
+whardake 29 Jan 97 12:10:28
+    - (configure.in): New ps options to check for.
+
+whardake 29 Jan 97 12:11:04
+    - (FAQ): revision one!
+
+whardake 29 Jan 97 12:11:29
+    - (config.h.in, configure): update
+
+whardake 29 Jan 97 12:58:46
+    - (kernel.c, snmp_agent.c, snmpd.c): Patch from Niels Baggesen:
+      - Fix various warnings/errors.
+      - Implement real traps.
+
+whardake 29 Jan 97 13:03:15
+    - (versiontag): Modify ../../bug-report as well.
+
+whardake 29 Jan 97 13:08:11
+    - (bug-report):
+      - change to address (back) to ucd-snmp-coders.
+      - Add a trap on signals to remove tmp files.
+
+whardake 31 Jan 97 09:58:10
+    - (config*): Check for kstat.h and if sysctl can read the boottime.
+
+whardake 31 Jan 97 10:01:59
+    - (snmp_var_route.c, snmp_vars.c): Patch from Martin Jacobsson:
+      - Change some system specific ifdefs to CAN_USE_SYSCTL.
+      - Fix compliation errors on bsdi2.
+      - Fix routing tables for similar.
+
+whardake 31 Jan 97 10:49:07
+    - (versiontag): uh, commit it again.
+
+whardake 31 Jan 97 10:50:04
+    - (configure.in, configure): fire off ksh if hpux && sh.
+
+whardake 31 Jan 97 10:59:43
+    - (configure.in, configure): changed arch to hppa and make sure /bin/ksh exists.
+
+whardake 31 Jan 97 11:03:11
+    version tag update
+
+whardake  3 Feb 97 10:02:12
+    - (bug-report): Patch from Dave Shield:
+      - domain name fix and editor bomb out.
+
+whardake  3 Feb 97 10:03:10
+    - (EXAMPLE.conf.def): comment out possible security problem lines.
+
+whardake  3 Feb 97 10:46:02
+    - (configure.in):
+      - Check for whoami, logname.
+      - Don't pass null args to ksh.
+
+whardake  3 Feb 97 10:47:04
+    - (snmp_vars.c): Patch from Dave Shield
+      - Mark stuff for later changes.
+
+whardake  3 Feb 97 10:48:06
+    - (snmplib/system.c):  Use CAN_USE_SYSCTL instead of bsdlike.
+
+whardake  3 Feb 97 11:50:23
+    - (config*):
+      - Check for irix 6.2 headers.
+      - Check if _KERNEL needs to be defined for irix and ifnet usage.
+      - Use the found UNAME program instead of assuming we have it.
+
+whardake  3 Feb 97 12:44:51
+    - (snmplib/system.c): typo:  needs a space between 'static' and 'struct'.
+
+whardake  3 Feb 97 12:47:58
+    - (snmp_vars.c): add some irix appropriate includes.
+
+whardake  3 Feb 97 12:51:04
+    - (README): remove project history.
+
+whardake  3 Feb 97 13:15:11
+    - (README):
+      - added FAQ pointer.
+      - Dave's English pointers (ie, he proofed it and I, uh, don't...).
+      - switch ftp mirror.
+      - bug-report script mentioned.
+      - I -> We, me -> us...
+
+whardake  3 Feb 97 13:33:11
+    - (README, NEWS, TODO): Update for 3.1.3.
+
+whardake  3 Feb 97 13:53:04
+    - (bug-report): move config.cache to end of message.
+
+whardake  3 Feb 97 13:55:05
+    version tag ( 3.1.3.pre3 )
+
+whardake  4 Feb 97 09:35:02
+    - (FAQ): Dave's latest revision.
+
+whardake  4 Feb 97 09:35:37
+    - (TODO): Added suggestions from ucd-snmp-coders.
+
+whardake  4 Feb 97 09:36:43
+    - (configure, configure.in): Fix hpux problems, *again*.
+
+whardake  4 Feb 97 09:37:26
+    - (mib.c): Patch from Simon: comment #ifdef endings for ANSI compliers.
+
+whardake  4 Feb 97 09:41:39
+    - (FAQ): Added TOC and autor notes ;-).
+
+whardake  5 Feb 97 16:33:01
+    - (FAQ): Dave updated architecture lists.
+
+whardake  5 Feb 97 16:33:32
+    - (TODO): misc requested additions.
+
+whardake  5 Feb 97 17:07:25
+    - (configure, configure.in): Put /dev/ksyms ahead of /kernel/unix.
+
+whardake  5 Feb 97 17:11:15
+    - (many): Patch from Niels Baggesen:
+      - snmp mib group cleanups.
+      - trap generation cleanups.
+      - added man entries for trap generation.
+      - improved agent debugging output with agent's -d flag.
+
+whardake  5 Feb 97 17:13:09
+    - (system.c): Patch from Dave Shield to fix nlist problems.
+
+whardake  5 Feb 97 17:20:10
+    - (bug-report): Change subject line to shorten and force better description.
+
+whardake  5 Feb 97 17:23:41
+    - (tcl, tk, snmptcl): Nuked.
+
+whardake  5 Feb 97 17:25:03
+    - (NEWS): removed tcl stuff.
+
+whardake  5 Feb 97 17:29:54
+    - (Makefile.in, configure.in): removed tcl stuff.
+
+whardake  5 Feb 97 17:41:50
+    version tag ( 3.1.3.pre4 )
+
+whardake 10 Feb 97 09:22:03
+    - (FAQ): Dave Shields' additions:  finding more info.
+
+whardake 10 Feb 97 09:22:53
+    - (snmpnetstat/main.c): Remove malloc prototype, now in stdlib.h.
+
+-------------------------------------------------------------------------------
+
+Changes: V3.1.2 -> V3.1.2.1
+
+whardake  5 Dec 96 09:13:56
+    - (if.c): #ifndef -> #ifdef for sigset.
+ 
+whardake  5 Dec 96 09:14:59
+    - (md5.c): remove ansi specific C features (unsigned constants).
+ 
+-------------------------------------------------------------------------------
+
+Changes: V3.1.1 -> V3.1.2
+
+whardake 17 Oct 96 07:02:58
+    version tag ( 3.1.1.BSDI )
+
+whardake 30 Oct 96 13:47:21
+    - (PORTING,README): Add a new PORTING file to reference autoconf plee.
+
+whardake 30 Oct 96 13:49:09
+    - (config*, ece-mib.def):
+      - Change extensible mib location to ucdavis enterprise mib: 2021.
+      - Remove associated prompting from configure script and etc.
+
+whardake 31 Oct 96 17:06:16
+    - (read_config.c): numdisks was being incremented before last usage.
+
+whardake  1 Nov 96 08:54:11
+    - (asn1.c): Patch from Simon Leinen  <simon@switch.ch>:
+      - asn_build_unsigned_int, asn_build_unsigned_int64:
+        - Don't try to strip FFs from the high end of unsigned values.
+        - Skip the stripping code entirely if we have to add a null byte.
+
+whardake  4 Nov 96 09:30:46
+    - (config*, snmp_vars.c, extensible.c):  More include checks for linux.
+
+whardake  4 Nov 96 10:08:49
+    - (config*): Check for nlist in -lmld (irix).
+
+whardake  7 Nov 96 09:16:45
+    - NetBSD 3.1.0.1 branch merge.
+
+whardake  7 Nov 96 09:24:23
+    - Niels 3.1.1 branch merge.
+
+whardake  7 Nov 96 09:35:52
+    - BSDi2 3.1.1 branch merge.
+
+whardake  7 Nov 96 09:57:16
+    - (versiontag): Only tag release versions (Ext*).
+
+whardake  7 Nov 96 14:16:00
+    - (configure.in, configure): Changed default SNMPV2AUTH to SNMPV1.
+
+whardake  7 Nov 96 14:16:39
+    - (snmp_var_route.c): ifdef's around strings.h.
+
+whardake  7 Nov 96 14:17:17
+    - (snmp_vars.c): ifdef typos.
+
+whardake  7 Nov 96 14:19:33
+    - (mib.c): typecast for sprint_objid().
+
+whardake  8 Nov 96 17:03:47
+    - (Makefile.in): Created a 'touchit' to touch config files properly.
+
+whardake  8 Nov 96 17:06:46
+    - (Makefile.in): Fixed 'touchit'.
+
+whardake 14 Nov 96 15:14:50
+    - (extensible.c): Use statfs if statvfs is unavailable.
+
+whardake 14 Nov 96 15:16:22
+    - (snmp_vars.c):
+      - #ifdef typo.
+      - prototype for Interface_Scan_Init().
+      - Check for existance of tcpstat.tcps_rcvmemdrop before using.
+
+whardake 14 Nov 96 15:17:36
+    - (config*):
+      - Check for existance of tcpstat.tcps_rcvmemdrop.
+      - Check for sys/vfs.h.
+
+whardake 14 Nov 96 15:24:24
+    - (snmptrap.c, inet.c, route.c): typecasting warning fixes.
+
+whardake 15 Nov 96 16:43:33
+    - (config*, extensible.c): Make uname calls work correctly.
+
+whardake 15 Nov 96 16:44:11
+    - (parse.c):  Add back in "reading mib..." debugging statments.
+
+whardake 22 Nov 96 08:18:29
+    - (snmp_vars.c): Trash interface caching.
+
+whardake 22 Nov 96 09:06:10
+    - (snmp_vars.c): Merge from FreeBSD2-3-1-1.
+      - Add checks for ifnet.[io]bytes.
+
+whardake 22 Nov 96 09:14:22
+    - (config*): Add checks for ifnet.[io]bytes.
+
+whardake 22 Nov 96 11:35:29
+    - (agent/extensible/*.c, new: extproto.h):  Removed all -Wall warnings!
+
+whardake 22 Nov 96 14:38:05
+    - (config*, install-sh, mkinstalldirs): Upgraded to autoconf 2.11.
+
+whardake 22 Nov 96 15:10:36
+    - (extensible.c, read_config.c): removed more -Wall warnings.
+
+whardake 24 Nov 96 16:25:07
+    - (kernel.c, config*, INSTALL):  New configure switch:  --without-root-access.
+      - The agent doesn't exit if it can't open /dev/kmem.
+
+whardake 24 Nov 96 16:45:27
+    version tag ( 3.1.2.pre1 )
+
+whardake 25 Nov 96 08:44:03
+    - ({agent,apps}/Makefile.in): Put libsnmp.a in front of -l libs.
+
+whardake 25 Nov 96 09:15:57
+    - (config*, snmp_impl.h): Moved void -> char define to a configure test.
+
+whardake 27 Nov 96 08:02:06
+    - (snmp_vars.c): Patch from Dave Shield <D.T.Shield@csc.liv.ac.uk>:
+      - Change comments to reflect what its actually looking at.
+      - Remove ifdef around ifnet declarations.
+
+whardake 27 Nov 96 08:03:47
+    - (extensible.c): Patch from Dave Shield <D.T.Shield@csc.liv.ac.uk>:
+      - Remove return(0) on void init_extensible().
+
+whardake 27 Nov 96 08:06:04
+    - (configure, configure.in): Default sysloc UCDavis -> Unknown.
+
+whardake 27 Nov 96 08:21:20
+    - (INSTALL): Typo:  3.1.3 -> 3.0.3.
+
+whardake 27 Nov 96 08:21:34
+    - (README): Update.
+
+whardake 27 Nov 96 08:34:12
+    - (if.c): Patch from Dave Shield <D.T.Shield@csc.liv.ac.uk>:
+      - Watch out for interface names with ' ' in them.
+      - Reset signal on BSD signal implementations.
+
+whardake 27 Nov 96 08:45:46
+    - (if.c): Reset signal on all types of signal implementations.
+
+whardake 27 Nov 96 08:56:44
+    - (configure.in, configure): Truncate system names beyond [-_].*.
+
+whardake  2 Dec 96 08:55:49
+    - (snmp_vars.c): Patch from Dave Shield <D.T.Shield@csc.liv.ac.uk>:
+      - ifPhysAddr - in Interface_Get_Ether_By_Index, HP-UX has the same
+            EtherAddr strucure as MIPS.
+    
+      - ipAdEntIfIndex - in var_ipAddrEntry, there is a false match on
+            the loopback interface, giving the wrong answer of the first
+            interface index.
+    
+      - udpInErrors - in var_udp, the count of UDP errors omits discarded
+            packets.  Some systems (i.e. HP-UX) have extended the udpstat
+            structure to include these.  I'v tweaked this analogous to a
+            similar addition in the tcpstat structure.
+    
+      - tcpConnState - HP-UX has added an extra state into the list, which
+            throws the rest of them out.
+
+whardake  3 Dec 96 10:04:02
+    - (config*, snmp_vars.c):
+      - Wrote AC_CHECK_STRUCT_FOR and use it.
+      - Make AC_CHECK_IFNET_FOR use above.
+      - Changequote '[]' -> '' around sed expression with []s (-Dostype).
+
+whardake  3 Dec 96 10:05:17
+    - (md5.c): Put 'U'nsigned marker at end of constants to remove gcc warns.
+
+whardake  3 Dec 96 11:04:33
+    - (snmp_vars.c): From Dave Shield <D.T.Shield@csc.liv.ac.uk>:
+      - Fix arp table for hpux.
+    - (config*): Check for arphd.at_next and use in above.
+
+whardake  3 Dec 96 11:14:43
+    - (EXAMPLE.conf.def, passtest): Move passtest to ucdavis subtree.
+
+whardake  3 Dec 96 14:51:24
+    - (ece-mib.def): Used -> Avail in memory sequence.
+
+whardake  4 Dec 96 09:16:09
+    - (asn1.c, parse.c, snmp_api.c, snmp_client.c):
+      - Patch from Niels Baggesen <Niels.Baggesen@uni-c.dk>:
+        - Parser fixes for multiple nodes.
+        - memmove/copy deletes.
+
+whardake  4 Dec 96 09:49:38
+    - (PORTING, README):  Update for release 3.1.2.
+
+-------------------------------------------------------------------------------
+
+Changes: V3.1.0.1 -> V3.1.1
+
+whardake 11 Sep 96 08:49:14
+    - (read_config.c): Fixed community number checks.
+
+whardake 24 Sep 96 16:54:59
+    - (config*, snmp_api.c, snmp_client.c): Added sys/select.h for AIX.
+
+whardake 24 Sep 96 16:59:26
+    - (snmp_var_route.c, snmp_vars.c): typos.
+
+whardake 24 Sep 96 17:02:47
+    - (snmp_vars.c): Moved a variable declairation.
+
+whardake 24 Sep 96 17:16:58
+    - (snmp_var_route.c): typo fixing a typo (sigh..).
+
+whardake 25 Sep 96 14:14:53
+    - (snmp_var_route.c): freebsd2 typecast.
+
+whardake  1 Oct 96 15:30:46
+    - (parse.c, parse.h): From Joe Marzot:
+      - allows the CMU lib to retain the TC information associated with a
+        particular object. In particular this allows DisplayStrings to be
+        differentiated from OctetStrings when they are looked up in the
+        Mib Tree.
+
+whardake  1 Oct 96 15:54:22
+    - (extensible.c): int -> double to support larger disk sizes.
+
+whardake  1 Oct 96 16:28:52
+    - (config*, read_config.c):
+      - Check for mntent.h and include it.
+      - Check for /etc/mnttab or /etc/mtab and use appropriately.
+    - (read_config.c):
+      - pick getmntent over getfsfile if both are available.
+      - debug cleanup (ofile -> stderr, check for DODEBUG instead of const var).
+
+whardake  3 Oct 96 16:05:47
+    - (snmp_agent.c):
+      - Make agent properly check snmpset exit codes and use them (on COMMIT).
+
+whardake  3 Oct 96 16:08:59
+    - (pass.c):
+      - Check for passthru existance before returning ERR_NOERROR, else
+        return ERR_NOSUCHNAME.
+      - Correctly check for and pass "not-writable" and "wrong-type" pass returns.
+
+whardake  3 Oct 96 16:10:38
+    - (snmp_impl.h):  Turn on old CMU debugging statments with --enable-debugging.
+
+whardake  4 Oct 96 09:43:40
+    - (EXAMPLE.conf.def): Added snmpget/set to pass example.
+
+whardake  4 Oct 96 09:44:26
+    - (Makefile.in): Remove spaces from sedscript when using broken cpp (gcc).
+
+whardake  4 Oct 96 09:46:09
+    - (snmpd.conf.5.def):
+      - Cleaned up man page formatting.
+      - Added note about SNMPset community strings.
+      - minor proof-reading (major proofing needed still).
+      - Re-organized a bit.
+
+whardake  4 Oct 96 10:01:20
+    - (snmpd.conf.5.def): lib -> lib/snmp path correction in FILES section.
+    - (snmpd.1.def):
+      - Added a FILES section.
+      - General clean up.
+
+whardake  7 Oct 96 07:41:40
+    - (parse.c):  Now loads all mibs (files) in the directory SNMPLIB/mibs.
+
+whardake  7 Oct 96 07:49:59
+    - (parse.c):  Proper autoconf dirent headers.
+
+whardake  7 Oct 96 08:01:43
+    - (Makefile.in): Mib installation changed to reflect new mib directory.
+
+whardake  7 Oct 96 08:53:06
+    - (config*): check correctly for get/setmntent.
+
+whardake  7 Oct 96 09:11:43
+    - (snmp_agent.c): Removed snmp version check on error return from set.
+
+whardake  7 Oct 96 09:12:23
+    - (read_config.c): Use getmntent correctly.  Pain.
+
+whardake  7 Oct 96 10:22:47
+    - (Makefile.in):
+      - added --recheck to config.status call to regenerate self.
+      - Changed ece-mib.txt -> ucd-snmp.txt and install (and generate) properly.
+
+whardake  7 Oct 96 10:23:32
+    - (extensible.c): Chomp newline on uname output.
+
+whardake  7 Oct 96 10:24:12
+    - (read_config.c): Added 'syscontact' and 'syslocation' parsing.
+
+whardake  7 Oct 96 11:00:10
+    - (configure.in):
+      - timestamp stamp-h at end.
+      - emacs local vars.
+
+whardake  7 Oct 96 11:01:25
+    - (read_config.c): Remove extra args from strcpy (was strncpy).
+
+whardake  7 Oct 96 11:02:46
+    - (configure.in):
+      - timestamp stamp-h at end.
+      - emacs local vars.
+
+whardake  7 Oct 96 12:23:05
+    - (snmpd.1.def): Changed to reflect SNMPLIB/mibs.
+
+whardake  7 Oct 96 12:23:27
+    - (snmpd.conf.5.def): Added syscontact and syslocation.
+
+whardake  9 Oct 96 08:04:14
+    - (parse.c):
+      - Parse OBJECT-IDENTY as OBJECT-GROUP (saves only description).
+      - Change print_error(), read_mib() to reflect file and correct line number.
+
+whardake  9 Oct 96 08:30:29
+    - (parse.c):
+      - print a new line in print_error() if debugging is turned on.
+      - tossObjectIdentifier(): catch multiple bracket clauses (IE { {0 0} } ).
+
+whardake  9 Oct 96 14:36:03
+    - (read_config.c):
+      - strncmp -> strncasecmp.
+      - NULL -> 0.
+
+whardake  9 Oct 96 14:38:05
+    - (extensible.c):
+      - sort pass thrus by miboid to prevent passing off to wrong one.
+      - typos:  exsten -> exten.
+      - init_extensible() calls update_config() to reduce duplications.
+
+whardake  9 Oct 96 15:18:42
+    - (snmp_api.c): From: gah@bellcore.com (Gary A. Hayward)
+      - Free pdu community to quelch purify.
+
+whardake  9 Oct 96 15:22:23
+    - (README): Added thanks name.
+
+-------------------------------------------------------------------------------
+
+Changes: V3.1 -> V3.1.0.1
+
+whardake 26 Aug 96 10:36:08
+    - (NEWS) Typo, extra quotation mark.
+
+whardake 26 Aug 96 10:37:05
+    - (TODO) Extra mib parsing ideas added.
+
+whardake 26 Aug 96 10:37:36
+    - (ece-mib.def):  commas out of place.
+
+whardake 26 Aug 96 16:55:51
+    - (snmp_api.c): Fixed a gcc/FreeBSD optimization bug (stupid compiler)
+
+whardake 26 Aug 96 16:58:03
+    - (event.c, kernel.c, route_write.c): FreeBSD modifications
+
+whardake 27 Aug 96 08:46:43
+    - (extensible.c):  FreeBSD changes and use getloadavg if available.
+
+whardake 27 Aug 96 08:47:57
+    - (snmptrapd.c): Fix byte order problem (convert to network before sending).
+
+whardake 27 Aug 96 09:01:10
+    - (snmptrap.c):
+      - FreeBSD specific changes.
+      - more autoconf complete: paths to libraries and kernel location.
+
+whardake 27 Aug 96 09:38:33
+    - (snmp_var_route.c): FreeBSD specific changes.
+
+whardake 27 Aug 96 10:00:15
+    - (snmp_vars.c): More warped FreeBSD changes
+
+whardake 27 Aug 96 10:04:56
+    - (autoconf*):
+      - FreeBSD additions.
+      - New kernel location:  /kernel (ick).
+      - Log file default intelligently checks for /var/log and /usr/adm.
+      - Checks for getloadavg().
+
+whardake 29 Aug 96 14:42:20
+    - (extensible/*.c): Patch from Niels Baggesen <recnba@mediator.uni-c.dk>
+      - cleaned up gcc warnings.
+      - fixed a spelling error.
+
+whardake 29 Aug 96 14:59:55
+    - (apps/*.c): Patch from Niels Baggesen <recnba@mediator.uni-c.dk>
+      - set exit codes of 0 for all apps.
+      - Removed SVR4 #ifdefs.
+      - Greatly improved snmptrap.
+
+whardake 29 Aug 96 15:03:12
+    - (man/snmptrap.1):  added by Niels Baggesen <recnba@mediator.uni-c.dk>
+
+whardake 29 Aug 96 15:06:21
+    - (asn1.c): Patch from Niels Baggesen <recnba@mediator.uni-c.dk>
+      - uchar(s) can't be less than 0.
+
+whardake 29 Aug 96 15:06:50
+    - (mib.c): Patch from Niels Baggesen <recnba@mediator.uni-c.dk>
+      - prototypes for gcc warnings
+
+whardake 29 Aug 96 15:07:56
+    - (parse.c): Patch from Niels Baggesen <recnba@mediator.uni-c.dk>
+      - save mib descriptions for snmptranslate and other apps that need it.
+
+whardake 29 Aug 96 15:08:28
+    - (snmp_api.c): Patch from Niels Baggesen <recnba@mediator.uni-c.dk>
+      - gcc warnings NULL -> 0
+
+whardake 29 Aug 96 15:58:10
+    - (snmpstatus.c): Patch from Trevor Bourget <tbourget@qualcomm.com>
+      - malloc sysdesc instead of assuming < 128 bytes.
+
+whardake 29 Aug 96 16:03:44
+    - (snmpwalk.c): Removed SVR4 ifdefs
+
+whardake 29 Aug 96 16:22:25
+    - (autoconf*, snmp_vars.c): Removed some solaris ifdefs.
+
+whardake 29 Aug 96 16:29:10
+    - Changed my email address to my new one.
+
+whardake 30 Aug 96 09:23:05
+    - (configure, configure.in):
+      - removed -Xs flag for gcc on solaris.
+      - logfile checks for existance of /var/log and /usr/adm.
+
+whardake 30 Aug 96 09:23:42
+    - (snmptrap.c): patch screwed up.
+
+whardake 30 Aug 96 09:24:31
+    - (apps/Makefile.in):  Added kernel_sunos5.o to snmptrap for getKstat.
+	
+whardake 30 Aug 96 09:34:09
+    - (NEWS, ChangeLog): Updated for 3.1.0.1
+
+whardake 30 Aug 96 09:34:48
+    version tag ( 3.1.0.1 )
+
+whardake 30 Aug 96 10:15:18
+    - (README): Updated for 3.1.0.1
+
+whardake 30 Aug 96 11:49:38
+    - (snmp_vars.c): removed malloc prototype due to conflictions.
+
+-------------------------------------------------------------------------------
+
+Changes: V3.0.7.2 -> V3.1
+
+hardaker  3 May 96 14:34:03
+    - (acconfig.h, configure.in, snmplib/Makefile.in)
+      - Added a check for various random functions.
+      - Included another ifdef to ensure no #define loops occur with str/index fns.
+
+hardaker  3 May 96 14:35:27
+    - (agent/snmp_var_route.c,snmp_vars.c)
+      - Changed the interface counter to a short for all architectures (bus err)
+      - Undefed a function that is never used.
+
+hardaker  3 May 96 14:37:17
+    - (agent/snmp_vars.c) Solaris fix for interfaces.
+      - From Dan A. Dickey <ddickey@transition.com>
+
+hardaker  3 May 96 14:40:18
+    - (apps/snmptrap.c) Added #include<sys/sockio.h>
+
+hardaker  9 May 96 13:24:00
+    - (apps/snmpset.c) Added '.' as a delimiter for decimal encoded strings.
+
+hardaker  9 May 96 13:27:40
+    - (acconfig.h, configure.in, snmplib/Makefile.in)
+      - Added a check for various random functions.
+      - Included another ifdef to ensure no #define loops occur with str/index fns.
+
+hardaker  9 May 96 13:33:12
+    - (acconfig.h,agent/{Makefile,snmp_vars.c},agent/extensible/many):
+      - Added support for passthru mibs.  Total control is handed to exec's.
+
+hardaker  9 May 96 16:14:28
+    - (configure.in): Solaris specific cpp flags added for SUNspro's cpp.
+    - (agent/{snmp_vars,snmpd}.c,agent/extensible/{extensible,misc,pass}.c,
+       snmplib/{mib,snmp_client}.c):
+      - Cleaned up prototypes to match more carefully (with Solaris's spro cc).
+
+hardaker 10 May 96 10:27:14
+    - (kernel_sunos5.c): A patch to fix a virtual interface problem.
+      - patch supplied by "Dan A. Dickey" <ddickey@transition.com>
+
+hardaker 10 May 96 18:16:57
+    - (many): Mereged baggesen-3-0-7-2 branch into main trunk.
+
+hardaker 13 May 96 15:56:45
+    - (agent/extensible/misc.c): exec Names were getting included in the command.
+
+hardaker 13 May 96 15:57:43
+    - (agent/extensible/misc.c): close file descriptors before re-starting agent.
+
+hardaker 13 May 96 15:58:44
+    - (agent/snmp_agent.c, agent/snmp_vars.c, agent/extensible/extensible.c):
+      - Bug fix: GLOBALSECURITY bug:  save rightmost two bits in acl.
+
+hardaker 13 May 96 15:59:30
+    - (snmplib/snmp_impl.h): Change RWRITE to include Write for V2 bits.
+
+hardaker 15 May 96 08:59:51
+    - (agent/extensible/pass.c) Patch from Niels Baggesen <recnba@mediator.uni-c.dk>
+      - Implemented missing parts of interface address and network output (-i)
+
+hardaker 15 May 96 09:02:24
+    - (agent/kernel_sunos5.c) Patch from "Dan A. Dickey" <ddickey@transition.com>
+      - Better caching algorithm for improved speed.
+
+hardaker 15 May 96 09:05:49
+    - (*/.cvsignore) ignore file update.
+
+hardaker 15 May 96 09:06:49
+    - (Makefile.in,sedscript.in) Added PREFIX to the sedscript.
+
+hardaker 15 May 96 09:07:35
+    - (EXAMPLE.conf.def, man/snmpd.conf.5.def): documented pass thru mibs.
+
+hardaker 15 May 96 09:29:21
+    - (COPYING, README, TODO) Release docs updated.
+
+hardaker 15 May 96 09:50:15
+    - (agent/kernel_sunos5.c) patch mistake.
+
+hardaker 15 May 96 09:51:12
+    - (agent/extensible/read_config.c): ansi semantic fix for '<'.
+
+hardaker 15 May 96 09:51:37
+    version tag ( 3.1.A1 )
+
+hardaker 15 May 96 12:00:57
+    - (INSTALL) make install as root.
+
+hardaker 15 May 96 12:03:54
+    - (README) Added a note (pointer to docs) on the agent's extensiblity.
+
+hardaker 15 May 96 12:23:40
+    - (apps/snmpnetstat/if.c) removed & in front of array passed as arg.
+
+hardaker 15 May 96 12:35:16
+    - (sedscript.in) Fixed a horrible typo.  P -> PREFIX
+
+hardaker 22 May 96 08:50:28
+    - (man/Makefile.in) Updated the way sedscript is used.
+
+hardaker 22 May 96 08:51:01
+    - (config.guess, configure, install-sh, mkinstalldirs): Autoconf-2.10
+
+hardaker 22 May 96 12:50:24
+    - (agent/kernel_sunos5.c, snmp_vars.c,
+       agent/extensible/extensible.c,readconfig.c,snmp_vars.c):
+      - Patch from Niels Baggesen <recnba@mediator.uni-c.dk>:
+        - finally nailed that missing initialization that gave problems
+          with the AT subtree
+        - I also implemented the disk part of the extensibility in the
+          attached patch.
+
+hardaker 22 May 96 12:55:33
+    - (apps/snmpnetstat/if.c): Patch from Niels Baggesen <recnba@mediator.uni-c.dk>
+      - reworked the way snmpnetstat -i works.
+
+hardaker 23 May 96 14:43:49
+    - (acconfig.h, config.h.in): Don't define random if it already exists.
+
+hardaker 23 May 96 14:44:15
+    - (extensible.c):  Added a disk warning to stderr.
+
+hardaker 23 May 96 14:44:39
+    - (acl.c, party.c, view.c): removed NULL defines.
+
+hardaker 23 May 96 14:56:42
+    - (if.c): type casting bugs.
+
+hardaker 23 May 96 16:28:08
+    - (acl.c, party.c): include stdio.h
+
+hardaker 23 May 96 17:09:24
+    - (config*, extensible.c): fixed disk checks on Solaris and alpha's
+      - use statvfs over fstab if both present.
+
+hardaker 23 May 96 17:48:09
+    - (config*): check for getmntent.
+
+hardaker 24 May 96 12:23:52
+    - (snmplib/parse.c):  parsing fixes from Mike Perik <mikep@crt.com>
+
+hardaker 24 May 96 12:39:51
+    - (README): Added a thanks section.
+
+hardaker 24 May 96 13:08:28
+    - (EXAMPLE.conf.def): minor example file changes.
+
+hardaker 24 May 96 13:09:02
+    - (config*):  Check for sys/mnttab.h
+
+hardaker 24 May 96 13:09:52
+    - (read_config.c): ifdef cleanup
+
+hardaker 24 May 96 13:10:34
+    - (parse.c): declarations cleanup
+
+hardaker 24 May 96 13:13:21
+    - (snmpd.conf.5.def):  note on creating comments added.
+
+hardaker 24 May 96 13:38:46
+    - (read_config.c): #ifdef typo
+
+hardaker 24 May 96 13:54:25
+    - (acconfig.h, config.h.in):  define memmove if not defined and memcpy is.
+
+hardaker 24 May 96 13:55:14
+    - (if.c, route.c): cast returns from index to char *.
+
+hardaker 24 May 96 14:02:53
+    - (config*): check for memmove before you define it.
+
+hardaker 24 May 96 14:53:20
+    - (read_config.c): printf -> DODEBUG check
+
+hardaker 24 May 96 15:28:41
+    - (accconfig.h, config.h.in): #ifdef typos
+
+hardaker 24 May 96 15:29:13
+    - (snmp_vars.c): removed some ifdef requirements.
+
+hardaker 24 May 96 15:29:29
+    - (snmp_vars.h): reorganized
+
+-------------------------------------------------------------------------------
+
+Changes:  V3.0.7.1 -> V3.0.7.2
+
+Niels Baggesen <recnba@mediator.uni-c.dk> 1 May 96 12:37:35
+    - (many) Fixes for Solaris (2.5) submitted by
+             Niels Baggesen <recnba@mediator.uni-c.dk>:
+        "Some are my own, others are from Yuri Rabover who originally
+         created the patch. Some of this is there to eliminate the
+         dependency on the ucblib compatibility stuff, some is "cosmetic",
+         but it also fixes a serious problem in the agent, where walking
+         the mib tree can loop endlessly if you have multiple network
+         interfaces."
+
+hardaker  1 May 96 13:54:18
+    - (configure*, agent/extensible/{read_config,extenisble}.c):
+      - configurified (new word) some of Niels' changes and the bcopy/memmove stuff.
+
+hardaker  1 May 96 13:55:16
+    - (man/snmpd.1.def,snmpd.conf.5.def) .C -> .B, to increase nroff portability.
+
+hardaker  1 May 96 14:35:23
+    - (agent/route_write.c,agent/extensible/extensible.c):
+      - netbsd1.1B specific fixes: clash with sys_errlist and rt_dst defines.
+
+hardaker  1 May 96 14:37:09
+    - (local/snmpcheck) Tk-b10 fixes.
+
+hardaker  1 May 96 14:37:25
+    - (sedscript.in) forgot NETBSD1ID def.
+
+hardaker  1 May 96 14:56:21
+    - (acconfig.h,agent/extensible/mibdefs.h): removed coments/spaces from defines.
+
+-------------------------------------------------------------------------------
+
+Changes:  V3.0.7 -> V3.0.7.1
+
+hardaker 25 Apr 96 12:18:43
+    - (ChangeLog, acconfig.h, config.h.in) Defined DEBUGP if DODEBUG is not defined.
+
+-------------------------------------------------------------------------------
+
+Changes:  V3.0.6 -> V3.0.7
+
+hardaker  5 Apr 96 16:11:39
+    - (local/snmpcheck.def) Tk-b8 => Tk-b10 changes
+
+hardaker  5 Apr 96 16:12:22
+    - (configure) autoconf-2.7 -> autoconf-2.9
+
+hardaker  5 Apr 96 16:15:11
+    - (snmplib/asn1.c) removed a required 'unix' define surrounding a header file.
+
+hardaker  5 Apr 96 16:19:35
+    - (man/Makefile.in) Added a 'clean' definition to the Makefile.
+
+hardaker 12 Apr 96 14:51:08
+    - Changed nlist warnings to only print if DODEBUG is defined in config.h
+
+hardaker 12 Apr 96 14:51:42
+    - (agent/snmp_vars.c, agent/extensible.c)
+      - Changed nlist warnings to only print if DODEBUG is defined in config.h
+
+hardaker 12 Apr 96 16:49:23
+    - (snmp_var_route.c)
+      - Changed nlist warnings to only print if DODEBUG is defined in config.h
+    - (many) Added support for hppa1.1-hp-hpux10.01
+      - totally! redid the routing tables for BSD 4.4 derived systems
+        (alpha, hpux10.01+, netbsd) since hpux10 doesn't have 4.3 compat structs.
+    - (ece-mib.def) Capitalization problem.
+    - (configure.in)
+      - Cleaned up kernel checking
+      - Started using a autoconf 2.8 feature to check for cache values.
+
+hardaker 15 Apr 96 12:53:40
+    - (configure) New command line option:  --enable-debugging.  Turns on debugging.
+    - (configure) Fixes for type checking of 4.4 rtentry structures on alphas.
+
+hardaker 15 Apr 96 14:11:39
+    - (configure) New command line option:  --with-defaults.  Don't prompt the user.
+    - (configure) bug fixes:  wasn't quoting kernel and dmem location.
+    - (configure) gcc cpp requires -x c to accept .in file suffix.
+
+hardaker 15 Apr 96 14:36:48
+    - (agent/snmpd.c) Fixed 2 gettimeofday calls -- added a NULL timezone ptr.
+
+hardaker 16 Apr 96 09:47:18
+    - (configure) I forgot DMEM_LOC needs to be #undef'ed if not found
+
+hardaker 16 Apr 96 09:48:06
+    - (agent/{route_write.c,snmp_var_route.c}) OSF3.2 specific changes.  arg.
+
+hardaker 16 Apr 96 18:08:29
+    - (snmpd.c) Added fflush calls after printing packet dumps
+
+hardaker 24 Apr 96 08:36:06
+    - (configure.in) More header file checks (vm/vm.h (+ others) and ufs/ffs/fs.h)
+
+hardaker 24 Apr 96 08:36:50
+    - (agent/extensible/extensible.c) Include ufs/ffs/fs.h if available.
+
+hardaker 24 Apr 96 08:37:13
+    - (agent/Makefile.in) Forgot a quote.  (why hasn't this appeared before?)
+
+hardaker 24 Apr 96 08:38:18
+    - (agent/alarm.c) Fixed some define naming conflicts for NetBSD (timeradd()).
+
+hardaker 24 Apr 96 08:44:45
+    - (agent/snmp_var_route.c,snmp_vars.c) more config files for NetBSD.
+    - (agent/snmp_vars.c) removed arp tables for netbsd.
+
+hardaker 24 Apr 96 08:54:07
+    - (acconfig.h, config.h.in, ece-mib.def, ov/*) Added NetBSD to sys-OID returned.
+
+hardaker 24 Apr 96 08:54:39
+    - (man/.cvsignore) added snmpd.1
+
+hardaker 24 Apr 96 09:00:21
+    - (README) updated
+
+hardaker 24 Apr 96 09:07:40
+    - (INSTALL) updated
+
+hardaker 24 Apr 96 11:46:52
+    - (agent/snmp_var_route.c) Checked for sys/mbuf for determining rtentry.rt_next
+
+hardaker 24 Apr 96 11:55:10
+    - (agent/snmp_var_route.c) @#$%ing solaris
+
+hardaker 24 Apr 96 13:25:48
+    - (config*,agent/snmp_var_route.c) config checking for rtentry.rt_next
+
+hardaker 24 Apr 96 14:37:47
+    - (local/snmpcheck) new pref:  don't pop forward on new problems.
+
+-------------------------------------------------------------------------------
+
+Changes:  V3.0.5 -> V3.0.6
+
+hardaker 24 Jan 96 16:31:20
+    - Returning EXTENSIBLEDOTMIB.AGENTID as the new objectid
+
+Dave Shield <D.T.Shield@csc.liv.ac.uk> 24 Jan 96 16:33:08
+    - Patch from Dave Shield <D.T.Shield@csc.liv.ac.uk>
+      - fixes -p PORT command line option to actually use the requested port.
+      - fixes the -l LOGFILE command line option to actually use it.
+
+hardaker 24 Jan 96 16:36:51
+    - (Makefile, config.h, ece-mib.*, sedscript.in)
+      - changed the way mib.txt is built
+        - split the command into two parts to build a ece-mib.txt as well
+      - added a new ObjectID addition to ece-mib.txt
+      - DEFMAXLOADAVE -> DREMOVEMEEFMAXLOADAVE
+
+hardaker 26 Jan 96 08:25:08
+    - The Solaris 2.5 kernel has moved to /kernel/genunix
+      - Thanks goes to pommier@volnay.stortek.com (Vincent Pommier (Toulouse))
+
+hardaker  9 Feb 96 17:05:00
+    - Better OpenView support
+      - Returns different sysObjectID's for each architecture
+      - Added a 'ov' directory for OpenView support files
+        - currently contains necessary files to support a UCD bitmap file
+          for hosts using the ucd-snmp agent.  See the ov/README file for details.
+
+hardaker 12 Feb 96 14:28:27
+    - (acconfig.h, config.hin, agent/extensible/misc.c)
+      - The agent now sets an alarm to restart rather than doing at the
+        snmpset time to return a value to the snmpset request.
+
+hardaker 16 Feb 96 16:32:41
+    - (acconfig.h,config.h.in, agent/snmp_agent.c, agent/extensible/read_config.c)
+      - .conf file addition:  "community N STRING" to change community names
+
+hardaker 21 Feb 96 16:12:39
+    - (Makefile.in, sedscript.in, man/Makefile.in, man/snmpd.conf.5.def)
+      - Added the beginnings of a snmpd.conf manual page.
+
+hardaker 21 Feb 96 16:15:36
+    - (apps/Makefile.in, apps/snmptrap.c)
+      - Added apps/snmptrap
+        - code taken from 2.0.1 and submitted to me by francus@metsny.delphi.com.
+        - I have yet to test it.
+
+hardaker  6 Mar 96 09:09:15
+    - (agent/snmpd.c) Added O_TRUNC to the logfile open() call.
+
+hardaker  6 Mar 96 10:06:24
+    - (agent/extensible/read_config.c) small bugs fixed
+      - disk entries with no size specified caused seg-faults.
+      - better type checking on MIB for 'exec MIB' entries.
+      - more error messages added.
+
+hardaker  6 Mar 96 16:38:16
+    - (ece-mib.def)
+      - Changed capitalization schemes to be mosy compliant.
+      - Made the memory mib SYNTAX point to the Memory sequence like it should.
+
+hardaker  6 Mar 96 16:58:11
+    - (snmplib/mib.c) printed values for timeticks are no longer negative.
+
+hardaker  8 Mar 96 10:31:34
+    - (snmplib/snmp_client.c) Check if variable content is NULL before using.
+
+hardaker  8 Mar 96 16:56:08
+    - (agent/extensible/exec.c)
+       - relocatable exec's failed to close the cache file.
+
+hardaker 11 Mar 96 13:37:25
+    - (snmp_var_route.c, snmp_vars.c, extensible.c): commented out nlist warnings.
+
+hardaker 11 Mar 96 15:17:26
+    - (man/{Makefile.in,snmpd.1.def,snmpd.conf.5.def},versiontag,sedscript.in):
+      - cleaned up documentation more and added the version number to the trailers.
+
+hardaker 11 Mar 96 15:17:57
+    - (README): cleaned up, re-arranged, shortened (sections moved to man/* docs).
+
+hardaker 11 Mar 96 15:40:17
+
+    - (README): more clean up and added reference to the ucd-snmp mailing list.
+
+Giovanni S. Marzot <gmarzot@baynetworks.com> 11 Mar 96 15:57:20
+
+    - (snmplib/snmp_api.c): fixed a timeout bug caused by architectures
+      with an unsigned timeval.tv_sec value.
+      - Thanks goes to Giovanni S. Marzot <gmarzot@baynetworks.com> for
+	the patch!
+
+-------------------------------------------------------------------------------
+
+Changes since V3.0.4
+
+hardaker 19 Jan 96 17:31:16
+    - (configure*)
+      - updated to autoconf v2.7
+      - Hopefully now using correct 'make' definitions
+
+hardaker 19 Jan 96 17:32:57
+    - (agent/extensible/*.c)
+      - Declaired more static variables (long_ret) to fix sun4s exit codes (again).
+
+hardaker 22 Jan 96 16:27:30
+    - (acconfig.h, agent/snmp_vars.c, agent/extensible/*.c)
+      - Added new defines to turn on/off sections of the extensible mib.
+      - This also fixes the mib.txt file definitions if something is turned off.
+    - (Makefile.in) removed ${srcdir} from the front of stamp-h.in
+
+hardaker 22 Jan 96 17:18:58
+    - (local/Makefile.in) Added a chmod to make the snmpcheck script executable
+
+hardaker 22 Jan 96 17:23:17
+    - (local/snmpcheck)
+      - added agent controls:  restart, updateconfig, clearcache.
+      - removed an old debugging printf.
+      - ctrl-f => fixall.
+      - Added keyboard accelerators to the associated menu items.
+      - Made highlightThickness a global parameter via $window->option('add').
+      - Added a entry box to the executable commands with the command to run.
+
+
+-------------------------------------------------------------------------------
+
+Changes since V3.0.3
+
+hardaker 23 Oct 95 16:37:43
+    - (extensible.c) stopped reporting anything for the disk mib if no
+      disks were defined in the snmpd.conf file.  This was causing an
+      error in the agent's error mib when no disks were defined and
+      someone walks the disk mib.
+
+hardaker 20 Nov 95 16:04:47
+    - (README) Added pointer to this file via ftp
+
+hardaker 20 Nov 95 16:05:12
+    - (TODO) Find and fix memory leak sometime
+
+hardaker 20 Nov 95 16:07:45
+    - (configure.in) Check for -lelf for solaris 2.3 and younger
+    - (configure.in) More solaris specifics:  -DSVR4
+    - (configure.in) Caches initial prompt in the configure script so you
+      won't be bugged twice by the initial question.
+
+hardaker 20 Nov 95 16:08:49
+    - (config.h.in) Check for -lelf for solaris 2.3 and younger
+
+hardaker 20 Nov 95 16:09:37
+    - (all autoconf built files) Updated everything to autoconf 2.5
+
+hardaker 20 Nov 95 16:10:49
+    - (trapnotif) Logs no-response errors.
+    - (trapnotif) Better string checking (quotes all variables now)
+
+hardaker  1 Dec 95 16:20:13
+    - local/snmpcheck:       *new features*
+      - handles failed snmpwalk/get/sets much more gracefully now
+      - new preference:  You can pick what types of problems to check for
+        - -f on the command line only checks for fixable problems
+      - no longer ping::echos hosts before checking them
+        - instead relies on 'No Response' type replies from snmpwalk/get to
+          determine if a host is up.
+        - ping the host is still an option (through the command line and menus)
+      - converted from Tk-b4 to Tk-b8
+      - Added a logging window for debugging and tracking of actions.
+        - new command line options:  -V NUM  initial log verbosity level
+                                     -L      show the log window at startup
+      - Now translates mib numbers into more reasonable names
+
+hardaker  5 Dec 95 14:57:14
+    - (configure*) added AC_TYPE_PID_T to the configure checks
+
+hardaker  5 Dec 95 15:01:10
+    - (snmpcheck)
+      - New flag:  -d, don't start checking anything.  Just bring up interface.
+      - check for blank output of snmpget before parsing with s///g
+        constructs.
+
+hardaker  5 Dec 95 15:05:20
+    - (agent/extensible)
+      - Bug fix:  alphas and sunoses were reporting incorrect extensible
+        exit codes.  (yet another 64/32 bit bug found).
+      - Bug fix: agent-update,restart, and cache mib flush entries were
+        returning values instead of pointers to values.
+
+hardaker 13 Dec 95 15:27:19
+    - (agent/extensible/misc.c) bug fixes for exec items:
+      - a second snmpwalk of the exec item would return the old cache
+        file.  Fixed by reseting the last cachetime to 0 to always rescan
+        after fork/pipe/memory/etc errors.
+      - Made lastresult a static var.  Was returning wrong exit codes
+        under, strangely enough, only sunos-4 machines.
+
+hardaker 20 Dec 95 09:53:10
+    - snmp_open calls getservbyname only once now, at the request of Gary
+      Hayward <gah@dirac.bellcore.com>.
+
+hardaker 20 Dec 95 15:56:16
+    - Found and fixed a memory leak in the routing table mib.
+
+hardaker 28 Dec 95 10:01:35
+    - Added sedscript to the .cvsignore file.
+
+hardaker 28 Dec 95 10:24:37
+    - Added a sedscript which is built from config.h and agent/extensible/mibdefs.h
+      - used to dynamically build mib.txt and local/snmpcheck.
+
+hardaker 28 Dec 95 12:06:49
+    - Created a EXAMPLE.conf file for example usage.
+
+-------------------------------------------------------------------------------
+
+Changes since V3.0.2.1
+
+hardaker 29 Sep 95 13:43:49
+    - ported to GNU's autoconfig2.4
+      - to install, you must now run ./configure first to generate the
+        Makefiles and config.h
+      - almost all of the code is now dynamically checked for problems
+        rather than being dependant on architecture names.
+    - system name now dynamically determined at run time (from uname -n)
+    - created a 'make depend' call (finally).
+    - (agent/snmp_vars.h) changed SYSNAME define to SYSTEMNAME define to
+      avoid a conflict with a solaris header file.
+    - protecting better against include header files twice.
+    - Most of port to Solaris 2.4 finished.  The kernel reads still need work.
+
+hardaker 29 Sep 95 13:46:43
+    - (NEWS) updated the news file.
+
+hardaker  3 Oct 95 09:24:00
+    (acconfig.h) Minor bug:  recursive comments not correct for compilers (AIX)
+
+hardaker  3 Oct 95 09:43:54
+    (versioninfo.c) Added 3-0-3-A1 tag
+
+hardaker  4 Oct 95 16:53:39
+    version tag of versioninfo.c
+
+hardaker  5 Oct 95 15:23:05
+    - More Solaris porting.
+      - Most mibII entries now work.
+         - Haven't checked returned information for accuracy
+      - sysUpTime still fails.
+      - cc and gcc both compile everything now.
+
+hardaker  5 Oct 95 15:48:23
+    version tag of versioninfo.c
+
+hardaker  6 Oct 95 11:37:00
+    - (README) Moved INSTALLATION instructions to INSTALL
+               Changed listing of supported architectures
+               Updated AVAILABILITY section
+
+hardaker  6 Oct 95 16:28:48
+    version tag of versioninfo.c
+
+hardaker  6 Oct 95 16:32:04
+    - (snmpd.c) Added two new flags:
+      -h for help
+      -v for version information
+
+hardaker  6 Oct 95 16:32:43
+    - (parse.c, snmp.c) added config.h to the list of includes.
+
+hardaker  6 Oct 95 16:40:38
+    - (snmpd.c) Usage of --help and --version should work now...  GNU standard.
+
+hardaker  6 Oct 95 16:41:18
+    - (NEWS/-TODO) -h/--help, -v/--version command line options
+
+hardaker 11 Oct 95 17:33:26
+    - The configure script now prompts for important values to be put in
+      config.h.  Some things need to use $(prefix) instead however.
+    - (Makefile.in, agent/Makefile.in, apps/Makefile.in)
+      + linking to ../snmplib/libsnmp.a instead of ../lib/libsnmp.a to
+        remove install requirement.
+      +  put ../lib/libsnmp.a in application
+
+hardaker 13 Oct 95 15:45:28
+    - (snmpd.c) Added -p port to --help output
+    - (config) Setup to use --prefix to look for config files.
+
+hardaker 16 Oct 95 13:01:39
+    - (Makefiles) Fairly decent 'make install' now possible.  Installs
+      into the directory specified by --prefix for the ./configure script.
+    - (extensible.c) config file re-location: now uses the SNMPLIBPATH
+      defined loosely as $(prefix)/lib/snmp/.
+
+hardaker 16 Oct 95 15:02:01
+    - (Makefiles) make install echos what its doing in a more clear fashion
+    - (INSTALL) added better instructions to the INSTALL file.
+    - (README) minor wording changes
+
+hardaker 16 Oct 95 16:21:43
+    - (snmpd.c) was still looking in /etc for two .conf files.
+
+hardaker 16 Oct 95 16:43:12
+    - (apps) all apps were still looking in /etc/ for .conf files
+
+hardaker 17 Oct 95 16:58:32
+    version tag ( 3.0.3 ) of versioninfo.c
+
+hardaker 17 Oct 95 17:00:22
+    - ChangeLog update
+
+
+-------------------------------------------------------------------------------
+
+Changes since V3.0.2
+
+hardaker 21 Sep 95 09:27:18
+    (snmplib/md5.c) Forgot to include sys/types.h for u_long definition.
+
+-------------------------------------------------------------------------------
+
+Changes since V3.0.1
+
+hardaker 26 Jul 95 16:31:41
+    - Added a new #define: EXIT_ON_BAD_KLREAD to config.h
+      If defined, and an error occurs while reading the kernel contents,
+      the agent will exit.  This was the default.  I wanted it to
+      continue.
+    
+    - Port to dec-alpha/OSF 3.1
+      - alpha's long is 8 bytes, not 4.
+      - should be (mostly) 64 bit clean now.
+      - cleaned up a LOT of bugs CMU code in the process.
+
+hardaker 28 Jul 95 14:23:41
+    Yet more problems fixed in the alpha port.
+      -- more int -> long checking.
+
+hardaker 31 Jul 95 16:27:47
+    - snmpcheck changes:
+      - terminal (ascii) based supported fixed.
+        - Detects presence of a DISPLAY variable.
+        - Now requires the Term::Readkey package.
+        - asks users weather to fix problems
+      - raises and deiconifies when new problems are found
+      - sets the background color of new problems to pinkish
+      - new preference:  ping host?
+      - global key bindings:
+          ctrl-q = quit; ctrl-h = hide; ctrl-s = seen all
+
+hardaker  1 Sep 95 11:57:52
+    - Fixed alpha's kernel lookups:
+      * CMU code was passing ints into lseek (needs long).
+
+hardaker 18 Sep 95 16:09:25
+    Minor mods to README file.
+
+hardaker 18 Sep 95 16:13:49
+    Minor bug:
+      (sh_count_procs) check if returned file descriptor > 0 before continuing
+
+-------------------------------------------------------------------------------
+
+Changes since V3.0
+
+hardaker 16 Jun 95 10:13:53
+    Removed 'gmake' -> 'make' in agent/Makefile
+
+hardaker 16 Jun 95 10:15:42
+    House cleaning
+      - Compiles cleanly on hpux/gcc
+    	(except one include file error I don't have control over.)
+      - Change VERSION_ID -> VERSIONID to avoid conflicts with HP's includes.
+
+hardaker 16 Jun 95 14:13:53
+    House Cleaning:
+      Took out gcc/ansi requirement for the agent.
+      perror() is called more frequently for log archival
+    
+    New Bug/Haven't solved:
+      HP-UX:  if agent/*.c and agent/extensible/*.c are built with gcc,
+    	  DisplayStrings return garbage.  No clue as to why.
+
+hardaker 16 Jun 95 14:20:48
+    House Cleaning:
+      Missed a VERSION_ID
+
+hardaker 21 Jun 95 09:11:27
+    Changed another "empty" error message in the CMU code to a real warning.
+
+hardaker 21 Jun 95 09:15:31
+    Bug Fix:
+      Stopped returning a pointer to a non-static char array...  (-> static char)
+      Passing wrong pointer to seterrorstatus() in setPerrorstatus()
+    
+    Feature:
+      Added a setable mib entry to the version mib to re-read the config file(s).
+
+hardaker 21 Jun 95 09:18:37
+    ece-mib.def:
+    Bug Fix:
+      Loadave mib:  Integer -> DisplayString
+      versionClearCache:  -> read-write (was read-only)
+    
+    Feature:
+      Added a setable mib entry to the version mib to re-read the config file(s).
+
+hardaker 21 Jun 95 09:19:17
+    Changed default CC to cc again.
+
+hardaker 21 Jun 95 09:20:23
+    snmplib:
+      Bug fix:  fdset -> (int *) fdset in select call.
+
+hardaker 10 Jul 95 11:27:00
+    Two new command line options:
+      -l LOGFILE       Outputs stderr/out to LOGFILE (overrides config.h def)
+      -L               Do NOT write to a log file (overrides config.h)
+
+hardaker 10 Jul 95 12:29:32
+    - More perror()s converted to set the snmp error status flag on the agent.
+    - error status flag is now prioritized.  perrors get the highest so
+      other errors won't override them if they happen at a later time.
+    - Added the beginnings of a restart mib to the version mib of the
+      agent.  Setting this writable mib to one will cause it to exec
+      itself again (for remote restart/updates).
+
+hardaker 10 Jul 95 12:30:19
+    Minor comment change in config.h
+
+hardaker 14 Jul 95 15:12:40
+    - Finished the restart mib.  This is a setable sub-mib of the version
+      mib, default to VERSION.12(.1).  If snmp-set to '1', it will restart
+      the agent.
+    
+      *  A side effect of this is that it restarts 3 times or so, since it
+         never returns a responce to the program generating the request.
+         If said program tries to resend the request (which most do), it
+         will AGAIN restart the agent...  oh well.
+
+hardaker 14 Jul 95 15:15:31
+    - snmpcheck (tk-perl-b4 script) is pretty stable at this point.  I
+      lost curses support, and need to re-add it still, so it is still
+      beta.  It does expect a log file of problems to exist (point it to
+      /dev/null), and needs to know the locations of the mibs to check
+      (which aren't configured by 'make'), so it needs some work.
+      However, it will query an agent, check its problems based on the
+      status of the error flag (or return code) being >1 and report them
+      with neat GUI-buttons and stuff (oh wow).  No documentation on it though.
+
+-------------------------------------------------------------------------------
+
+Changes since 3-0A1:
+
+hardaker  2 Jun 95 16:23:46
+    - version update
+
+hardaker  5 Jun 95 12:44:46
+    - agent/extensible/Makefile:
+        --  no longer requires GNU make
+        --  etags no longer run by default
+    
+    - SunOS additions:
+        -- loadaverage checking MIB enabled
+        -- disk checking MIB enabled
+
+hardaker  9 Jun 95 10:21:07
+    - Added a SNMPBLOCK option to the config.h file.  Supposedily setting
+      this to zero (now the default) will allow snmp requests to time out.
+      Haven't tested it throughly.
+        -- Contributed by Sanjai Narain <narain@thumper.bellcore.com>
+
+hardaker  9 Jun 95 10:21:51
+    - Correctly ordered the mib table list.
+      --  Need to write a dynamic checker/re-orderer.
+
+hardaker  9 Jun 95 10:23:35
+    - Correct usage for snmpwalk is now possible.  IE, snmpwalk target
+      .1.3.6.1 will now browse the entire tree.
+      -- Still fails on relocatable extensible mibs and will until I
+         write a dynamic tree builder.
+
+hardaker  9 Jun 95 14:08:15
+    - Changed test -x to test -f in snmplib/Makefile.  Not all OSes
+      (ie ultrix) handle this.
+
+hardaker 12 Jun 95 10:35:38
+    - local/trapnotif:
+      -- uses snmpv2 now (correctly)
+
+hardaker 12 Jun 95 10:37:46
+    - Reports all errors through the error mib now instead of through perror().
+    - Cleaned up error handling.  Shouldn't handle errors nicely if system
+      errors occur when scanning an extensible mib.
+
+hardaker 14 Jun 95 11:24:20
+    agent:
+    - Mib table is now qsorted at run time and the extensible variables are
+      sorted in at this time.  This brings the agent up to correct
+      SNMPwalk/getnext protocols.  You can now walk the entire tree
+      including the extensible sections and it won't stop.
+      * This has an added bonus of checking the mib table
+        (agent/snmp_vars.c) for correct order.  I have added things to the
+        wrong location too many times and caused the agent to function
+        incorrectly.  Major win.
+
+hardaker 14 Jun 95 12:56:49
+    - Cleaned up/Added more documentation to config.h
+    - GLOBALSECURITY now uses the left most four bits in the MIB acl.
+      This is more compatible with the CMU code than using the left most
+      2, which was done previously.
+
+
+hardaker 14 Jun 95 13:43:38
+    - Added more documentation to the README file.
+    - Created a mailing list to handle announcements
+      (ucd-snmp-announce@ucd-snmp.ucdavis.edu)
+
+
+# generated using:
+#  cvs2cl -b -r -f ChangeLog.add -F V4-2-patches --no-wrap -S
+#  perl dist/changelogfix < ChangeLog.add > ChangeLog.reallyadd
diff -Naur tomato/release/src/router/snmp/CodingStyle tomato121/release/src/router/snmp/CodingStyle
--- tomato/release/src/router/snmp/CodingStyle	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/CodingStyle	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,64 @@
+The discussion about coding style on the net-snmp-coders mailing list
+can be found at the following web address:
+  http://www.geocrawler.com/mail/thread.php3?subject=design+proposal+-+coding+style&list=6845
+
+----------------------------------------------------------------------
+Indentation: 
+
+We've adopted the following indent style:
+
+   indent -orig -nbc -bap -nut -nfca -T netsnmp_mib_handler -T netsnmp_handler_registration -T netsnmp_delegated_cache -T netsnmp_mib_handler_methods -T netsnmp_old_api_info -T netsnmp_old_api_cache -T netsnmp_set_info -T netsnmp_request_info -T netsnmp_set_info -T netsnmp_tree_cache -T netsnmp_agent_request_info -T netsnmp_cachemap -T netsnmp_agent_session -T netsnmp_array_group_item -T netsnmp_array_group -T netsnmp_table_array_callbacks -T netsnmp_table_row -T netsnmp_table_data -T netsnmp_table_data_set_storage -T netsnmp_table_data_set -T netsnmp_column_info -T netsnmp_table_registration_info -T netsnmp_table_request_info -T netsnmp_iterator_info -T netsnmp_data_list -T netsnmp_oid_array_header -T netsnmp_oid_array_header_wrapper -T netsnmp_oid_stash_node -T netsnmp_pdu -T netsnmp_request_list -T netsnmp_callback_pass -T netsnmp_callback_info -T netsnmp_transport -T netsnmp_transport_list -T netsnmp_tdomain
+
+[wow, what an annoying list!  The above -T list can be (re)generated by
+running:
+  perl -n -e 'print "-T $1 " if (/}\s*(netsnmp_\w+)\s*;/);' */*.h
+in the include/net-snmp directory]
+
+If possible, please run all new code submitted to the project through
+the above command.  However, if sending a patch, please do *not* send
+a patch that reformats the entire file.  Just the new sections of code
+should be in the above style to make it easier for us to dissect what
+you did in your patch.
+
+Briefly, here's a description of the style:
+
+	Blank lines:
+		after procedures
+		not (forced) after blocks of declarations or block comments
+		multiple declarations not split onto separate lines
+
+	Comments:
+		Block comments indented 4 spaces from surrounding code
+		Start/End on separate lines
+		Solid '*' on the left of block comments
+		"One-line" comments start in column 33
+
+	Bracing/Indent/etc:
+		K&R-style bracing (including "cuddle-else")
+		'case' statements in line with 'switch'
+		No space between procedure name and opening parenthesis
+		variable declarations lined up, and start in column 16
+		Procedure return type on a separate line to the procedure name
+		Four character basic and continuation line indent
+                No tabs used in the file, always use 8 spaces instead.
+		Continuation paramters lined up with opening parenthesis
+
+----------------------------------------------------------------------
+Function names and Variable names:
+
+should_be_like_this and notLikeThis
+
+----------------------------------------------------------------------
+Structures:
+
+We have decided to typedef all structures into names using the
+following convention:
+
+typedef struct netsnmp_wombat_s {
+  int something_cool;
+} netsnmp_wombat;
+
+The important things to note here are that the struct name ends in a
+"_s", the typedef name doesn't end in "_t", and the typedef is not to a
+pointer and everything begins with "netsnmp_".
+
diff -Naur tomato/release/src/router/snmp/config/snmp.webservices tomato121/release/src/router/snmp/config/snmp.webservices
--- tomato/release/src/router/snmp/config/snmp.webservices	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/config/snmp.webservices	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,32 @@
+
+<fieldset>
+	<legend><% tran("service.snmp_legend"); %></legend>
+	<div class="setting">
+		<div class="label"><% tran("service.snmp_srv"); %></div>
+		<input class="spaceradio" type="radio" name="snmpd_enable" value="1" <% nvram_selmatch("snmpd_enable", "1", "checked"); %> onclick="show_layer_ext(this, 'idsnmp', true)" /><% tran("share.enable"); %>&nbsp;
+		<input class="spaceradio" type="radio" name="snmpd_enable" value="0" <% nvram_selmatch("snmpd_enable", "0", "checked"); %> onclick="show_layer_ext(this, 'idsnmp', false)" /><% tran("share.disable"); %>
+	</div>
+	<div id="idsnmp">
+		<div class="setting">
+			<div class="label"><% tran("service.snmp_loc"); %></div>
+			<input maxlength="100" size="25" name="snmpd_syslocation" value="<% nvram_get("snmpd_syslocation"); %>" />
+		</div>
+		<div class="setting">
+			<div class="label"><% tran("service.snmp_contact"); %></div>
+			<input maxlength="100" size="25" name="snmpd_syscontact" value="<% nvram_get("snmpd_syscontact"); %>" />
+		</div>
+		<div class="setting">
+			<div class="label"><% tran("service.snmp_name"); %></div>
+			<input maxlength="100" size="25" name="snmpd_sysname" value="<% nvram_get("snmpd_sysname"); %>" />
+		</div>
+		<div class="setting">
+			<div class="label"><% tran("service.snmp_read"); %></div>
+			<input maxlength="100" size="25" name="snmpd_rocommunity" value="<% nvram_get("snmpd_rocommunity"); %>" />
+		</div>
+		<div class="setting">
+			<div class="label"><% tran("service.snmp_write"); %></div>
+			<input maxlength="100" size="25" name="snmpd_rwcommunity" value="<% nvram_get("snmpd_rwcommunity"); %>" />
+		</div>
+	</div>
+</fieldset><br />
+
diff -Naur tomato/release/src/router/snmp/config.guess tomato121/release/src/router/snmp/config.guess
--- tomato/release/src/router/snmp/config.guess	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/config.guess	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,1363 @@
+#! /bin/sh
+# Attempt to guess a canonical system name.
+#   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
+#   2000, 2001, 2002 Free Software Foundation, Inc.
+
+timestamp='2002-10-21'
+
+# This file is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# Originally written by Per Bothner <per@bothner.com>.
+# Please send patches to <config-patches@gnu.org>.  Submit a context
+# diff and a properly formatted ChangeLog entry.
+#
+# This script attempts to guess a canonical system name similar to
+# config.sub.  If it succeeds, it prints the system name on stdout, and
+# exits with 0.  Otherwise, it exits with 1.
+#
+# The plan is that this can be called by configure scripts if you
+# don't specify an explicit build system type.
+
+me=`echo "$0" | sed -e 's,.*/,,'`
+
+usage="\
+Usage: $0 [OPTION]
+
+Output the configuration name of the system \`$me' is run on.
+
+Operation modes:
+  -h, --help         print this help, then exit
+  -t, --time-stamp   print date of last modification, then exit
+  -v, --version      print version number, then exit
+
+Report bugs and patches to <config-patches@gnu.org>."
+
+version="\
+GNU config.guess ($timestamp)
+
+Originally written by Per Bothner.
+Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
+Free Software Foundation, Inc.
+
+This is free software; see the source for copying conditions.  There is NO
+warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
+
+help="
+Try \`$me --help' for more information."
+
+# Parse command line
+while test $# -gt 0 ; do
+  case $1 in
+    --time-stamp | --time* | -t )
+       echo "$timestamp" ; exit 0 ;;
+    --version | -v )
+       echo "$version" ; exit 0 ;;
+    --help | --h* | -h )
+       echo "$usage"; exit 0 ;;
+    -- )     # Stop option processing
+       shift; break ;;
+    - )	# Use stdin as input.
+       break ;;
+    -* )
+       echo "$me: invalid option $1$help" >&2
+       exit 1 ;;
+    * )
+       break ;;
+  esac
+done
+
+if test $# != 0; then
+  echo "$me: too many arguments$help" >&2
+  exit 1
+fi
+
+trap 'exit 1' 1 2 15
+
+# CC_FOR_BUILD -- compiler used by this script. Note that the use of a
+# compiler to aid in system detection is discouraged as it requires
+# temporary files to be created and, as you can see below, it is a
+# headache to deal with in a portable fashion.
+
+# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still
+# use `HOST_CC' if defined, but it is deprecated.
+
+# This shell variable is my proudest work .. or something. --bje
+
+set_cc_for_build='tmpdir=${TMPDIR-/tmp}/config-guess-$$ ;
+(old=`umask` && umask 077 && mkdir $tmpdir && umask $old && unset old)
+   || (echo "$me: cannot create $tmpdir" >&2 && exit 1) ;
+dummy=$tmpdir/dummy ;
+files="$dummy.c $dummy.o $dummy.rel $dummy" ;
+trap '"'"'rm -f $files; rmdir $tmpdir; exit 1'"'"' 1 2 15 ;
+case $CC_FOR_BUILD,$HOST_CC,$CC in
+ ,,)    echo "int x;" > $dummy.c ;
+	for c in cc gcc c89 c99 ; do
+	  if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then
+	     CC_FOR_BUILD="$c"; break ;
+	  fi ;
+	done ;
+	rm -f $files ;
+	if test x"$CC_FOR_BUILD" = x ; then
+	  CC_FOR_BUILD=no_compiler_found ;
+	fi
+	;;
+ ,,*)   CC_FOR_BUILD=$CC ;;
+ ,*,*)  CC_FOR_BUILD=$HOST_CC ;;
+esac ;
+unset files'
+
+# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
+# (ghazi@noc.rutgers.edu 1994-08-24)
+if (test -f /.attbin/uname) >/dev/null 2>&1 ; then
+	PATH=$PATH:/.attbin ; export PATH
+fi
+
+UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
+UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
+UNAME_SYSTEM=`(uname -s) 2>/dev/null`  || UNAME_SYSTEM=unknown
+UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
+
+# Note: order is significant - the case branches are not exclusive.
+
+case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
+    *:NetBSD:*:*)
+	# NetBSD (nbsd) targets should (where applicable) match one or
+	# more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*,
+	# *-*-netbsdecoff* and *-*-netbsd*.  For targets that recently
+	# switched to ELF, *-*-netbsd* would select the old
+	# object file format.  This provides both forward
+	# compatibility and a consistent mechanism for selecting the
+	# object file format.
+	#
+	# Note: NetBSD doesn't particularly care about the vendor
+	# portion of the name.  We always set it to "unknown".
+	sysctl="sysctl -n hw.machine_arch"
+	UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \
+	    /usr/sbin/$sysctl 2>/dev/null || echo unknown)`
+	case "${UNAME_MACHINE_ARCH}" in
+	    armeb) machine=armeb-unknown ;;
+	    arm*) machine=arm-unknown ;;
+	    sh3el) machine=shl-unknown ;;
+	    sh3eb) machine=sh-unknown ;;
+	    *) machine=${UNAME_MACHINE_ARCH}-unknown ;;
+	esac
+	# The Operating System including object format, if it has switched
+	# to ELF recently, or will in the future.
+	case "${UNAME_MACHINE_ARCH}" in
+	    arm*|i386|m68k|ns32k|sh3*|sparc|vax)
+		eval $set_cc_for_build
+		if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
+			| grep __ELF__ >/dev/null
+		then
+		    # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
+		    # Return netbsd for either.  FIX?
+		    os=netbsd
+		else
+		    os=netbsdelf
+		fi
+		;;
+	    *)
+	        os=netbsd
+		;;
+	esac
+	# The OS release
+	release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
+	# Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
+	# contains redundant information, the shorter form:
+	# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
+	echo "${machine}-${os}${release}"
+	exit 0 ;;
+    amiga:OpenBSD:*:*)
+	echo m68k-unknown-openbsd${UNAME_RELEASE}
+	exit 0 ;;
+    arc:OpenBSD:*:*)
+	echo mipsel-unknown-openbsd${UNAME_RELEASE}
+	exit 0 ;;
+    hp300:OpenBSD:*:*)
+	echo m68k-unknown-openbsd${UNAME_RELEASE}
+	exit 0 ;;
+    mac68k:OpenBSD:*:*)
+	echo m68k-unknown-openbsd${UNAME_RELEASE}
+	exit 0 ;;
+    macppc:OpenBSD:*:*)
+	echo powerpc-unknown-openbsd${UNAME_RELEASE}
+	exit 0 ;;
+    mvme68k:OpenBSD:*:*)
+	echo m68k-unknown-openbsd${UNAME_RELEASE}
+	exit 0 ;;
+    mvme88k:OpenBSD:*:*)
+	echo m88k-unknown-openbsd${UNAME_RELEASE}
+	exit 0 ;;
+    mvmeppc:OpenBSD:*:*)
+	echo powerpc-unknown-openbsd${UNAME_RELEASE}
+	exit 0 ;;
+    pmax:OpenBSD:*:*)
+	echo mipsel-unknown-openbsd${UNAME_RELEASE}
+	exit 0 ;;
+    sgi:OpenBSD:*:*)
+	echo mipseb-unknown-openbsd${UNAME_RELEASE}
+	exit 0 ;;
+    sun3:OpenBSD:*:*)
+	echo m68k-unknown-openbsd${UNAME_RELEASE}
+	exit 0 ;;
+    wgrisc:OpenBSD:*:*)
+	echo mipsel-unknown-openbsd${UNAME_RELEASE}
+	exit 0 ;;
+    *:OpenBSD:*:*)
+	echo ${UNAME_MACHINE}-unknown-openbsd${UNAME_RELEASE}
+	exit 0 ;;
+    alpha:OSF1:*:*)
+	if test $UNAME_RELEASE = "V4.0"; then
+		UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
+	fi
+	# A Vn.n version is a released version.
+	# A Tn.n version is a released field test version.
+	# A Xn.n version is an unreleased experimental baselevel.
+	# 1.2 uses "1.2" for uname -r.
+	eval $set_cc_for_build
+	cat <<EOF >$dummy.s
+	.data
+\$Lformat:
+	.byte 37,100,45,37,120,10,0	# "%d-%x\n"
+
+	.text
+	.globl main
+	.align 4
+	.ent main
+main:
+	.frame \$30,16,\$26,0
+	ldgp \$29,0(\$27)
+	.prologue 1
+	.long 0x47e03d80 # implver \$0
+	lda \$2,-1
+	.long 0x47e20c21 # amask \$2,\$1
+	lda \$16,\$Lformat
+	mov \$0,\$17
+	not \$1,\$18
+	jsr \$26,printf
+	ldgp \$29,0(\$26)
+	mov 0,\$16
+	jsr \$26,exit
+	.end main
+EOF
+	$CC_FOR_BUILD -o $dummy $dummy.s 2>/dev/null
+	if test "$?" = 0 ; then
+		case `$dummy` in
+			0-0)
+				UNAME_MACHINE="alpha"
+				;;
+			1-0)
+				UNAME_MACHINE="alphaev5"
+				;;
+			1-1)
+				UNAME_MACHINE="alphaev56"
+				;;
+			1-101)
+				UNAME_MACHINE="alphapca56"
+				;;
+			2-303)
+				UNAME_MACHINE="alphaev6"
+				;;
+			2-307)
+				UNAME_MACHINE="alphaev67"
+				;;
+			2-1307)
+				UNAME_MACHINE="alphaev68"
+				;;
+			3-1307)
+				UNAME_MACHINE="alphaev7"
+				;;
+		esac
+	fi
+	rm -f $dummy.s $dummy && rmdir $tmpdir
+	echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+	exit 0 ;;
+    Alpha\ *:Windows_NT*:*)
+	# How do we know it's Interix rather than the generic POSIX subsystem?
+	# Should we change UNAME_MACHINE based on the output of uname instead
+	# of the specific Alpha model?
+	echo alpha-pc-interix
+	exit 0 ;;
+    21064:Windows_NT:50:3)
+	echo alpha-dec-winnt3.5
+	exit 0 ;;
+    Amiga*:UNIX_System_V:4.0:*)
+	echo m68k-unknown-sysv4
+	exit 0;;
+    *:[Aa]miga[Oo][Ss]:*:*)
+	echo ${UNAME_MACHINE}-unknown-amigaos
+	exit 0 ;;
+    *:[Mm]orph[Oo][Ss]:*:*)
+	echo ${UNAME_MACHINE}-unknown-morphos
+	exit 0 ;;
+    *:OS/390:*:*)
+	echo i370-ibm-openedition
+	exit 0 ;;
+    arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
+	echo arm-acorn-riscix${UNAME_RELEASE}
+	exit 0;;
+    SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
+	echo hppa1.1-hitachi-hiuxmpp
+	exit 0;;
+    Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)
+	# akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
+	if test "`(/bin/universe) 2>/dev/null`" = att ; then
+		echo pyramid-pyramid-sysv3
+	else
+		echo pyramid-pyramid-bsd
+	fi
+	exit 0 ;;
+    NILE*:*:*:dcosx)
+	echo pyramid-pyramid-svr4
+	exit 0 ;;
+    DRS?6000:UNIX_SV:4.2*:7*)
+	case `/usr/bin/uname -p` in
+	    sparc) echo sparc-icl-nx7 && exit 0 ;;
+	esac ;;
+    sun4H:SunOS:5.*:*)
+	echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+	exit 0 ;;
+    sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
+	echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+	exit 0 ;;
+    i86pc:SunOS:5.*:*)
+	echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+	exit 0 ;;
+    sun4*:SunOS:6*:*)
+	# According to config.sub, this is the proper way to canonicalize
+	# SunOS6.  Hard to guess exactly what SunOS6 will be like, but
+	# it's likely to be more like Solaris than SunOS4.
+	echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+	exit 0 ;;
+    sun4*:SunOS:*:*)
+	case "`/usr/bin/arch -k`" in
+	    Series*|S4*)
+		UNAME_RELEASE=`uname -v`
+		;;
+	esac
+	# Japanese Language versions have a version number like `4.1.3-JL'.
+	echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'`
+	exit 0 ;;
+    sun3*:SunOS:*:*)
+	echo m68k-sun-sunos${UNAME_RELEASE}
+	exit 0 ;;
+    sun*:*:4.2BSD:*)
+	UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
+	test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3
+	case "`/bin/arch`" in
+	    sun3)
+		echo m68k-sun-sunos${UNAME_RELEASE}
+		;;
+	    sun4)
+		echo sparc-sun-sunos${UNAME_RELEASE}
+		;;
+	esac
+	exit 0 ;;
+    aushp:SunOS:*:*)
+	echo sparc-auspex-sunos${UNAME_RELEASE}
+	exit 0 ;;
+    # The situation for MiNT is a little confusing.  The machine name
+    # can be virtually everything (everything which is not
+    # "atarist" or "atariste" at least should have a processor
+    # > m68000).  The system name ranges from "MiNT" over "FreeMiNT"
+    # to the lowercase version "mint" (or "freemint").  Finally
+    # the system name "TOS" denotes a system which is actually not
+    # MiNT.  But MiNT is downward compatible to TOS, so this should
+    # be no problem.
+    atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
+        echo m68k-atari-mint${UNAME_RELEASE}
+	exit 0 ;;
+    atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
+	echo m68k-atari-mint${UNAME_RELEASE}
+        exit 0 ;;
+    *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
+        echo m68k-atari-mint${UNAME_RELEASE}
+	exit 0 ;;
+    milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
+        echo m68k-milan-mint${UNAME_RELEASE}
+        exit 0 ;;
+    hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
+        echo m68k-hades-mint${UNAME_RELEASE}
+        exit 0 ;;
+    *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
+        echo m68k-unknown-mint${UNAME_RELEASE}
+        exit 0 ;;
+    powerpc:machten:*:*)
+	echo powerpc-apple-machten${UNAME_RELEASE}
+	exit 0 ;;
+    RISC*:Mach:*:*)
+	echo mips-dec-mach_bsd4.3
+	exit 0 ;;
+    RISC*:ULTRIX:*:*)
+	echo mips-dec-ultrix${UNAME_RELEASE}
+	exit 0 ;;
+    VAX*:ULTRIX*:*:*)
+	echo vax-dec-ultrix${UNAME_RELEASE}
+	exit 0 ;;
+    2020:CLIX:*:* | 2430:CLIX:*:*)
+	echo clipper-intergraph-clix${UNAME_RELEASE}
+	exit 0 ;;
+    mips:*:*:UMIPS | mips:*:*:RISCos)
+	eval $set_cc_for_build
+	sed 's/^	//' << EOF >$dummy.c
+#ifdef __cplusplus
+#include <stdio.h>  /* for printf() prototype */
+	int main (int argc, char *argv[]) {
+#else
+	int main (argc, argv) int argc; char *argv[]; {
+#endif
+	#if defined (host_mips) && defined (MIPSEB)
+	#if defined (SYSTYPE_SYSV)
+	  printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0);
+	#endif
+	#if defined (SYSTYPE_SVR4)
+	  printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0);
+	#endif
+	#if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
+	  printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0);
+	#endif
+	#endif
+	  exit (-1);
+	}
+EOF
+	$CC_FOR_BUILD -o $dummy $dummy.c \
+	  && $dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \
+	  && rm -f $dummy.c $dummy && rmdir $tmpdir && exit 0
+	rm -f $dummy.c $dummy && rmdir $tmpdir
+	echo mips-mips-riscos${UNAME_RELEASE}
+	exit 0 ;;
+    Motorola:PowerMAX_OS:*:*)
+	echo powerpc-motorola-powermax
+	exit 0 ;;
+    Motorola:*:4.3:PL8-*)
+	echo powerpc-harris-powermax
+	exit 0 ;;
+    Night_Hawk:*:*:PowerMAX_OS)
+	echo powerpc-harris-powermax
+	exit 0 ;;
+    Night_Hawk:Power_UNIX:*:*)
+	echo powerpc-harris-powerunix
+	exit 0 ;;
+    m88k:CX/UX:7*:*)
+	echo m88k-harris-cxux7
+	exit 0 ;;
+    m88k:*:4*:R4*)
+	echo m88k-motorola-sysv4
+	exit 0 ;;
+    m88k:*:3*:R3*)
+	echo m88k-motorola-sysv3
+	exit 0 ;;
+    AViiON:dgux:*:*)
+        # DG/UX returns AViiON for all architectures
+        UNAME_PROCESSOR=`/usr/bin/uname -p`
+	if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ]
+	then
+	    if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \
+	       [ ${TARGET_BINARY_INTERFACE}x = x ]
+	    then
+		echo m88k-dg-dgux${UNAME_RELEASE}
+	    else
+		echo m88k-dg-dguxbcs${UNAME_RELEASE}
+	    fi
+	else
+	    echo i586-dg-dgux${UNAME_RELEASE}
+	fi
+ 	exit 0 ;;
+    M88*:DolphinOS:*:*)	# DolphinOS (SVR3)
+	echo m88k-dolphin-sysv3
+	exit 0 ;;
+    M88*:*:R3*:*)
+	# Delta 88k system running SVR3
+	echo m88k-motorola-sysv3
+	exit 0 ;;
+    XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
+	echo m88k-tektronix-sysv3
+	exit 0 ;;
+    Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
+	echo m68k-tektronix-bsd
+	exit 0 ;;
+    *:IRIX*:*:*)
+	echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'`
+	exit 0 ;;
+    ????????:AIX?:[12].1:2)   # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
+	echo romp-ibm-aix      # uname -m gives an 8 hex-code CPU id
+	exit 0 ;;              # Note that: echo "'`uname -s`'" gives 'AIX '
+    i*86:AIX:*:*)
+	echo i386-ibm-aix
+	exit 0 ;;
+    ia64:AIX:*:*)
+	if [ -x /usr/bin/oslevel ] ; then
+		IBM_REV=`/usr/bin/oslevel`
+	else
+		IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
+	fi
+	echo ${UNAME_MACHINE}-ibm-aix${IBM_REV}
+	exit 0 ;;
+    *:AIX:2:3)
+	if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
+		eval $set_cc_for_build
+		sed 's/^		//' << EOF >$dummy.c
+		#include <sys/systemcfg.h>
+
+		main()
+			{
+			if (!__power_pc())
+				exit(1);
+			puts("powerpc-ibm-aix3.2.5");
+			exit(0);
+			}
+EOF
+		$CC_FOR_BUILD -o $dummy $dummy.c && $dummy && rm -f $dummy.c $dummy && rmdir $tmpdir && exit 0
+		rm -f $dummy.c $dummy && rmdir $tmpdir
+		echo rs6000-ibm-aix3.2.5
+	elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
+		echo rs6000-ibm-aix3.2.4
+	else
+		echo rs6000-ibm-aix3.2
+	fi
+	exit 0 ;;
+    *:AIX:*:[45])
+	IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
+	if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
+		IBM_ARCH=rs6000
+	else
+		IBM_ARCH=powerpc
+	fi
+	if [ -x /usr/bin/oslevel ] ; then
+		IBM_REV=`/usr/bin/oslevel`
+	else
+		IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
+	fi
+	echo ${IBM_ARCH}-ibm-aix${IBM_REV}
+	exit 0 ;;
+    *:AIX:*:*)
+	echo rs6000-ibm-aix
+	exit 0 ;;
+    ibmrt:4.4BSD:*|romp-ibm:BSD:*)
+	echo romp-ibm-bsd4.4
+	exit 0 ;;
+    ibmrt:*BSD:*|romp-ibm:BSD:*)            # covers RT/PC BSD and
+	echo romp-ibm-bsd${UNAME_RELEASE}   # 4.3 with uname added to
+	exit 0 ;;                           # report: romp-ibm BSD 4.3
+    *:BOSX:*:*)
+	echo rs6000-bull-bosx
+	exit 0 ;;
+    DPX/2?00:B.O.S.:*:*)
+	echo m68k-bull-sysv3
+	exit 0 ;;
+    9000/[34]??:4.3bsd:1.*:*)
+	echo m68k-hp-bsd
+	exit 0 ;;
+    hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
+	echo m68k-hp-bsd4.4
+	exit 0 ;;
+    9000/[34678]??:HP-UX:*:*)
+	HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
+	case "${UNAME_MACHINE}" in
+	    9000/31? )            HP_ARCH=m68000 ;;
+	    9000/[34]?? )         HP_ARCH=m68k ;;
+	    9000/[678][0-9][0-9])
+		if [ -x /usr/bin/getconf ]; then
+		    sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
+                    sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
+                    case "${sc_cpu_version}" in
+                      523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0
+                      528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1
+                      532)                      # CPU_PA_RISC2_0
+                        case "${sc_kernel_bits}" in
+                          32) HP_ARCH="hppa2.0n" ;;
+                          64) HP_ARCH="hppa2.0w" ;;
+			  '') HP_ARCH="hppa2.0" ;;   # HP-UX 10.20
+                        esac ;;
+                    esac
+		fi
+		if [ "${HP_ARCH}" = "" ]; then
+		    eval $set_cc_for_build
+		    sed 's/^              //' << EOF >$dummy.c
+
+              #define _HPUX_SOURCE
+              #include <stdlib.h>
+              #include <unistd.h>
+
+              int main ()
+              {
+              #if defined(_SC_KERNEL_BITS)
+                  long bits = sysconf(_SC_KERNEL_BITS);
+              #endif
+                  long cpu  = sysconf (_SC_CPU_VERSION);
+
+                  switch (cpu)
+              	{
+              	case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
+              	case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
+              	case CPU_PA_RISC2_0:
+              #if defined(_SC_KERNEL_BITS)
+              	    switch (bits)
+              		{
+              		case 64: puts ("hppa2.0w"); break;
+              		case 32: puts ("hppa2.0n"); break;
+              		default: puts ("hppa2.0"); break;
+              		} break;
+              #else  /* !defined(_SC_KERNEL_BITS) */
+              	    puts ("hppa2.0"); break;
+              #endif
+              	default: puts ("hppa1.0"); break;
+              	}
+                  exit (0);
+              }
+EOF
+		    (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy`
+		    if test -z "$HP_ARCH"; then HP_ARCH=hppa; fi
+		    rm -f $dummy.c $dummy && rmdir $tmpdir
+		fi ;;
+	esac
+	echo ${HP_ARCH}-hp-hpux${HPUX_REV}
+	exit 0 ;;
+    ia64:HP-UX:*:*)
+	HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
+	echo ia64-hp-hpux${HPUX_REV}
+	exit 0 ;;
+    3050*:HI-UX:*:*)
+	eval $set_cc_for_build
+	sed 's/^	//' << EOF >$dummy.c
+	#include <unistd.h>
+	int
+	main ()
+	{
+	  long cpu = sysconf (_SC_CPU_VERSION);
+	  /* The order matters, because CPU_IS_HP_MC68K erroneously returns
+	     true for CPU_PA_RISC1_0.  CPU_IS_PA_RISC returns correct
+	     results, however.  */
+	  if (CPU_IS_PA_RISC (cpu))
+	    {
+	      switch (cpu)
+		{
+		  case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;
+		  case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;
+		  case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;
+		  default: puts ("hppa-hitachi-hiuxwe2"); break;
+		}
+	    }
+	  else if (CPU_IS_HP_MC68K (cpu))
+	    puts ("m68k-hitachi-hiuxwe2");
+	  else puts ("unknown-hitachi-hiuxwe2");
+	  exit (0);
+	}
+EOF
+	$CC_FOR_BUILD -o $dummy $dummy.c && $dummy && rm -f $dummy.c $dummy && rmdir $tmpdir && exit 0
+	rm -f $dummy.c $dummy && rmdir $tmpdir
+	echo unknown-hitachi-hiuxwe2
+	exit 0 ;;
+    9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
+	echo hppa1.1-hp-bsd
+	exit 0 ;;
+    9000/8??:4.3bsd:*:*)
+	echo hppa1.0-hp-bsd
+	exit 0 ;;
+    *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*)
+	echo hppa1.0-hp-mpeix
+	exit 0 ;;
+    hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* )
+	echo hppa1.1-hp-osf
+	exit 0 ;;
+    hp8??:OSF1:*:*)
+	echo hppa1.0-hp-osf
+	exit 0 ;;
+    i*86:OSF1:*:*)
+	if [ -x /usr/sbin/sysversion ] ; then
+	    echo ${UNAME_MACHINE}-unknown-osf1mk
+	else
+	    echo ${UNAME_MACHINE}-unknown-osf1
+	fi
+	exit 0 ;;
+    parisc*:Lites*:*:*)
+	echo hppa1.1-hp-lites
+	exit 0 ;;
+    C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
+	echo c1-convex-bsd
+        exit 0 ;;
+    C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
+	if getsysinfo -f scalar_acc
+	then echo c32-convex-bsd
+	else echo c2-convex-bsd
+	fi
+        exit 0 ;;
+    C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
+	echo c34-convex-bsd
+        exit 0 ;;
+    C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
+	echo c38-convex-bsd
+        exit 0 ;;
+    C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
+	echo c4-convex-bsd
+        exit 0 ;;
+    CRAY*Y-MP:*:*:*)
+	echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+	exit 0 ;;
+    CRAY*[A-Z]90:*:*:*)
+	echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \
+	| sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
+	      -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \
+	      -e 's/\.[^.]*$/.X/'
+	exit 0 ;;
+    CRAY*TS:*:*:*)
+	echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+	exit 0 ;;
+    CRAY*T3D:*:*:*)
+	echo alpha-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+	exit 0 ;;
+    CRAY*T3E:*:*:*)
+	echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+	exit 0 ;;
+    CRAY*SV1:*:*:*)
+	echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+	exit 0 ;;
+    F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
+	FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+        FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
+        FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
+        echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
+        exit 0 ;;
+    i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
+	echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
+	exit 0 ;;
+    sparc*:BSD/OS:*:*)
+	echo sparc-unknown-bsdi${UNAME_RELEASE}
+	exit 0 ;;
+    *:BSD/OS:*:*)
+	echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
+	exit 0 ;;
+    *:FreeBSD:*:*)
+	# Determine whether the default compiler uses glibc.
+	eval $set_cc_for_build
+	sed 's/^	//' << EOF >$dummy.c
+	#include <features.h>
+	#if __GLIBC__ >= 2
+	LIBC=gnu
+	#else
+	LIBC=
+	#endif
+EOF
+	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=`
+	rm -f $dummy.c && rmdir $tmpdir
+	echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`${LIBC:+-$LIBC}
+	exit 0 ;;
+    i*:CYGWIN*:*)
+	echo ${UNAME_MACHINE}-pc-cygwin
+	exit 0 ;;
+    i*:MINGW*:*)
+	echo ${UNAME_MACHINE}-pc-mingw32
+	exit 0 ;;
+    i*:PW*:*)
+	echo ${UNAME_MACHINE}-pc-pw32
+	exit 0 ;;
+    x86:Interix*:3*)
+	echo i386-pc-interix3
+	exit 0 ;;
+    i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
+	# How do we know it's Interix rather than the generic POSIX subsystem?
+	# It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
+	# UNAME_MACHINE based on the output of uname instead of i386?
+	echo i386-pc-interix
+	exit 0 ;;
+    i*:UWIN*:*)
+	echo ${UNAME_MACHINE}-pc-uwin
+	exit 0 ;;
+    p*:CYGWIN*:*)
+	echo powerpcle-unknown-cygwin
+	exit 0 ;;
+    prep*:SunOS:5.*:*)
+	echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+	exit 0 ;;
+    *:GNU:*:*)
+	echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
+	exit 0 ;;
+    i*86:Minix:*:*)
+	echo ${UNAME_MACHINE}-pc-minix
+	exit 0 ;;
+    arm*:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	exit 0 ;;
+    ia64:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	exit 0 ;;
+    m68*:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	exit 0 ;;
+    mips:Linux:*:*)
+	eval $set_cc_for_build
+	sed 's/^	//' << EOF >$dummy.c
+	#undef CPU
+	#undef mips
+	#undef mipsel
+	#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
+	CPU=mipsel
+	#else
+	#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
+	CPU=mips
+	#else
+	CPU=
+	#endif
+	#endif
+EOF
+	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=`
+	rm -f $dummy.c && rmdir $tmpdir
+	test x"${CPU}" != x && echo "${CPU}-pc-linux-gnu" && exit 0
+	;;
+    ppc:Linux:*:*)
+	echo powerpc-unknown-linux-gnu
+	exit 0 ;;
+    ppc64:Linux:*:*)
+	echo powerpc64-unknown-linux-gnu
+	exit 0 ;;
+    alpha:Linux:*:*)
+	case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
+	  EV5)   UNAME_MACHINE=alphaev5 ;;
+	  EV56)  UNAME_MACHINE=alphaev56 ;;
+	  PCA56) UNAME_MACHINE=alphapca56 ;;
+	  PCA57) UNAME_MACHINE=alphapca56 ;;
+	  EV6)   UNAME_MACHINE=alphaev6 ;;
+	  EV67)  UNAME_MACHINE=alphaev67 ;;
+	  EV68*) UNAME_MACHINE=alphaev68 ;;
+        esac
+	objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null
+	if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
+	echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
+	exit 0 ;;
+    parisc:Linux:*:* | hppa:Linux:*:*)
+	# Look for CPU level
+	case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
+	  PA7*) echo hppa1.1-unknown-linux-gnu ;;
+	  PA8*) echo hppa2.0-unknown-linux-gnu ;;
+	  *)    echo hppa-unknown-linux-gnu ;;
+	esac
+	exit 0 ;;
+    parisc64:Linux:*:* | hppa64:Linux:*:*)
+	echo hppa64-unknown-linux-gnu
+	exit 0 ;;
+    s390:Linux:*:* | s390x:Linux:*:*)
+	echo ${UNAME_MACHINE}-ibm-linux
+	exit 0 ;;
+    sh*:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	exit 0 ;;
+    sparc:Linux:*:* | sparc64:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	exit 0 ;;
+    x86_64:Linux:*:*)
+	echo x86_64-unknown-linux-gnu
+	exit 0 ;;
+    i*86:Linux:*:*)
+	# The BFD linker knows what the default object file format is, so
+	# first see if it will tell us. cd to the root directory to prevent
+	# problems with other programs or directories called `ld' in the path.
+	# Set LC_ALL=C to ensure ld outputs messages in English.
+	ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \
+			 | sed -ne '/supported targets:/!d
+				    s/[ 	][ 	]*/ /g
+				    s/.*supported targets: *//
+				    s/ .*//
+				    p'`
+        case "$ld_supported_targets" in
+	  elf32-i386)
+		TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu"
+		;;
+	  a.out-i386-linux)
+		echo "${UNAME_MACHINE}-pc-linux-gnuaout"
+		exit 0 ;;
+	  coff-i386)
+		echo "${UNAME_MACHINE}-pc-linux-gnucoff"
+		exit 0 ;;
+	  "")
+		# Either a pre-BFD a.out linker (linux-gnuoldld) or
+		# one that does not give us useful --help.
+		echo "${UNAME_MACHINE}-pc-linux-gnuoldld"
+		exit 0 ;;
+	esac
+	# Determine whether the default compiler is a.out or elf
+	eval $set_cc_for_build
+	sed 's/^	//' << EOF >$dummy.c
+	#include <features.h>
+	#ifdef __ELF__
+	# ifdef __GLIBC__
+	#  if __GLIBC__ >= 2
+	LIBC=gnu
+	#  else
+	LIBC=gnulibc1
+	#  endif
+	# else
+	LIBC=gnulibc1
+	# endif
+	#else
+	#ifdef __INTEL_COMPILER
+	LIBC=gnu
+	#else
+	LIBC=gnuaout
+	#endif
+	#endif
+EOF
+	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=`
+	rm -f $dummy.c && rmdir $tmpdir
+	test x"${LIBC}" != x && echo "${UNAME_MACHINE}-pc-linux-${LIBC}" && exit 0
+	test x"${TENTATIVE}" != x && echo "${TENTATIVE}" && exit 0
+	;;
+    i*86:DYNIX/ptx:4*:*)
+	# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
+	# earlier versions are messed up and put the nodename in both
+	# sysname and nodename.
+	echo i386-sequent-sysv4
+	exit 0 ;;
+    i*86:UNIX_SV:4.2MP:2.*)
+        # Unixware is an offshoot of SVR4, but it has its own version
+        # number series starting with 2...
+        # I am not positive that other SVR4 systems won't match this,
+	# I just have to hope.  -- rms.
+        # Use sysv4.2uw... so that sysv4* matches it.
+	echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
+	exit 0 ;;
+    i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*)
+	UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'`
+	if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
+		echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL}
+	else
+		echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL}
+	fi
+	exit 0 ;;
+    i*86:*:5:[78]*)
+	case `/bin/uname -X | grep "^Machine"` in
+	    *486*)	     UNAME_MACHINE=i486 ;;
+	    *Pentium)	     UNAME_MACHINE=i586 ;;
+	    *Pent*|*Celeron) UNAME_MACHINE=i686 ;;
+	esac
+	echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}
+	exit 0 ;;
+    i*86:*:3.2:*)
+	if test -f /usr/options/cb.name; then
+		UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
+		echo ${UNAME_MACHINE}-pc-isc$UNAME_REL
+	elif /bin/uname -X 2>/dev/null >/dev/null ; then
+		UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')`
+		(/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486
+		(/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \
+			&& UNAME_MACHINE=i586
+		(/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \
+			&& UNAME_MACHINE=i686
+		(/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \
+			&& UNAME_MACHINE=i686
+		echo ${UNAME_MACHINE}-pc-sco$UNAME_REL
+	else
+		echo ${UNAME_MACHINE}-pc-sysv32
+	fi
+	exit 0 ;;
+    i*86:*DOS:*:*)
+	echo ${UNAME_MACHINE}-pc-msdosdjgpp
+	exit 0 ;;
+    pc:*:*:*)
+	# Left here for compatibility:
+        # uname -m prints for DJGPP always 'pc', but it prints nothing about
+        # the processor, so we play safe by assuming i386.
+	echo i386-pc-msdosdjgpp
+        exit 0 ;;
+    Intel:Mach:3*:*)
+	echo i386-pc-mach3
+	exit 0 ;;
+    paragon:*:*:*)
+	echo i860-intel-osf1
+	exit 0 ;;
+    i860:*:4.*:*) # i860-SVR4
+	if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
+	  echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4
+	else # Add other i860-SVR4 vendors below as they are discovered.
+	  echo i860-unknown-sysv${UNAME_RELEASE}  # Unknown i860-SVR4
+	fi
+	exit 0 ;;
+    mini*:CTIX:SYS*5:*)
+	# "miniframe"
+	echo m68010-convergent-sysv
+	exit 0 ;;
+    mc68k:UNIX:SYSTEM5:3.51m)
+	echo m68k-convergent-sysv
+	exit 0 ;;
+    M68*:*:R3V[567]*:*)
+	test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;;
+    3[34]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0)
+	OS_REL=''
+	test -r /etc/.relid \
+	&& OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
+	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
+	  && echo i486-ncr-sysv4.3${OS_REL} && exit 0
+	/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
+	  && echo i586-ncr-sysv4.3${OS_REL} && exit 0 ;;
+    3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
+        /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
+          && echo i486-ncr-sysv4 && exit 0 ;;
+    m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
+	echo m68k-unknown-lynxos${UNAME_RELEASE}
+	exit 0 ;;
+    mc68030:UNIX_System_V:4.*:*)
+	echo m68k-atari-sysv4
+	exit 0 ;;
+    i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*)
+	echo i386-unknown-lynxos${UNAME_RELEASE}
+	exit 0 ;;
+    TSUNAMI:LynxOS:2.*:*)
+	echo sparc-unknown-lynxos${UNAME_RELEASE}
+	exit 0 ;;
+    rs6000:LynxOS:2.*:*)
+	echo rs6000-unknown-lynxos${UNAME_RELEASE}
+	exit 0 ;;
+    PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*)
+	echo powerpc-unknown-lynxos${UNAME_RELEASE}
+	exit 0 ;;
+    SM[BE]S:UNIX_SV:*:*)
+	echo mips-dde-sysv${UNAME_RELEASE}
+	exit 0 ;;
+    RM*:ReliantUNIX-*:*:*)
+	echo mips-sni-sysv4
+	exit 0 ;;
+    RM*:SINIX-*:*:*)
+	echo mips-sni-sysv4
+	exit 0 ;;
+    *:SINIX-*:*:*)
+	if uname -p 2>/dev/null >/dev/null ; then
+		UNAME_MACHINE=`(uname -p) 2>/dev/null`
+		echo ${UNAME_MACHINE}-sni-sysv4
+	else
+		echo ns32k-sni-sysv
+	fi
+	exit 0 ;;
+    PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
+                      # says <Richard.M.Bartel@ccMail.Census.GOV>
+        echo i586-unisys-sysv4
+        exit 0 ;;
+    *:UNIX_System_V:4*:FTX*)
+	# From Gerald Hewes <hewes@openmarket.com>.
+	# How about differentiating between stratus architectures? -djm
+	echo hppa1.1-stratus-sysv4
+	exit 0 ;;
+    *:*:*:FTX*)
+	# From seanf@swdc.stratus.com.
+	echo i860-stratus-sysv4
+	exit 0 ;;
+    *:VOS:*:*)
+	# From Paul.Green@stratus.com.
+	echo hppa1.1-stratus-vos
+	exit 0 ;;
+    mc68*:A/UX:*:*)
+	echo m68k-apple-aux${UNAME_RELEASE}
+	exit 0 ;;
+    news*:NEWS-OS:6*:*)
+	echo mips-sony-newsos6
+	exit 0 ;;
+    R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
+	if [ -d /usr/nec ]; then
+	        echo mips-nec-sysv${UNAME_RELEASE}
+	else
+	        echo mips-unknown-sysv${UNAME_RELEASE}
+	fi
+        exit 0 ;;
+    BeBox:BeOS:*:*)	# BeOS running on hardware made by Be, PPC only.
+	echo powerpc-be-beos
+	exit 0 ;;
+    BeMac:BeOS:*:*)	# BeOS running on Mac or Mac clone, PPC only.
+	echo powerpc-apple-beos
+	exit 0 ;;
+    BePC:BeOS:*:*)	# BeOS running on Intel PC compatible.
+	echo i586-pc-beos
+	exit 0 ;;
+    SX-4:SUPER-UX:*:*)
+	echo sx4-nec-superux${UNAME_RELEASE}
+	exit 0 ;;
+    SX-5:SUPER-UX:*:*)
+	echo sx5-nec-superux${UNAME_RELEASE}
+	exit 0 ;;
+    SX-6:SUPER-UX:*:*)
+	echo sx6-nec-superux${UNAME_RELEASE}
+	exit 0 ;;
+    Power*:Rhapsody:*:*)
+	echo powerpc-apple-rhapsody${UNAME_RELEASE}
+	exit 0 ;;
+    *:Rhapsody:*:*)
+	echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE}
+	exit 0 ;;
+    *:Darwin:*:*)
+	echo `uname -p`-apple-darwin${UNAME_RELEASE}
+	exit 0 ;;
+    *:procnto*:*:* | *:QNX:[0123456789]*:*)
+	UNAME_PROCESSOR=`uname -p`
+	if test "$UNAME_PROCESSOR" = "x86"; then
+		UNAME_PROCESSOR=i386
+		UNAME_MACHINE=pc
+	fi
+	echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE}
+	exit 0 ;;
+    *:QNX:*:4*)
+	echo i386-pc-qnx
+	exit 0 ;;
+    NSR-[DGKLNPTVW]:NONSTOP_KERNEL:*:*)
+	echo nsr-tandem-nsk${UNAME_RELEASE}
+	exit 0 ;;
+    *:NonStop-UX:*:*)
+	echo mips-compaq-nonstopux
+	exit 0 ;;
+    BS2000:POSIX*:*:*)
+	echo bs2000-siemens-sysv
+	exit 0 ;;
+    DS/*:UNIX_System_V:*:*)
+	echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE}
+	exit 0 ;;
+    *:Plan9:*:*)
+	# "uname -m" is not consistent, so use $cputype instead. 386
+	# is converted to i386 for consistency with other x86
+	# operating systems.
+	if test "$cputype" = "386"; then
+	    UNAME_MACHINE=i386
+	else
+	    UNAME_MACHINE="$cputype"
+	fi
+	echo ${UNAME_MACHINE}-unknown-plan9
+	exit 0 ;;
+    i*86:OS/2:*:*)
+	# If we were able to find `uname', then EMX Unix compatibility
+	# is probably installed.
+	echo ${UNAME_MACHINE}-pc-os2-emx
+	exit 0 ;;
+    *:TOPS-10:*:*)
+	echo pdp10-unknown-tops10
+	exit 0 ;;
+    *:TENEX:*:*)
+	echo pdp10-unknown-tenex
+	exit 0 ;;
+    KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*)
+	echo pdp10-dec-tops20
+	exit 0 ;;
+    XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*)
+	echo pdp10-xkl-tops20
+	exit 0 ;;
+    *:TOPS-20:*:*)
+	echo pdp10-unknown-tops20
+	exit 0 ;;
+    *:ITS:*:*)
+	echo pdp10-unknown-its
+	exit 0 ;;
+    i*86:XTS-300:*:STOP)
+	echo ${UNAME_MACHINE}-unknown-stop
+	exit 0 ;;
+    i*86:atheos:*:*)
+	echo ${UNAME_MACHINE}-unknown-atheos
+	exit 0 ;;
+esac
+
+#echo '(No uname command or uname output not recognized.)' 1>&2
+#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2
+
+eval $set_cc_for_build
+cat >$dummy.c <<EOF
+#ifdef _SEQUENT_
+# include <sys/types.h>
+# include <sys/utsname.h>
+#endif
+main ()
+{
+#if defined (sony)
+#if defined (MIPSEB)
+  /* BFD wants "bsd" instead of "newsos".  Perhaps BFD should be changed,
+     I don't know....  */
+  printf ("mips-sony-bsd\n"); exit (0);
+#else
+#include <sys/param.h>
+  printf ("m68k-sony-newsos%s\n",
+#ifdef NEWSOS4
+          "4"
+#else
+	  ""
+#endif
+         ); exit (0);
+#endif
+#endif
+
+#if defined (__arm) && defined (__acorn) && defined (__unix)
+  printf ("arm-acorn-riscix"); exit (0);
+#endif
+
+#if defined (hp300) && !defined (hpux)
+  printf ("m68k-hp-bsd\n"); exit (0);
+#endif
+
+#if defined (NeXT)
+#if !defined (__ARCHITECTURE__)
+#define __ARCHITECTURE__ "m68k"
+#endif
+  int version;
+  version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
+  if (version < 4)
+    printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
+  else
+    printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version);
+  exit (0);
+#endif
+
+#if defined (MULTIMAX) || defined (n16)
+#if defined (UMAXV)
+  printf ("ns32k-encore-sysv\n"); exit (0);
+#else
+#if defined (CMU)
+  printf ("ns32k-encore-mach\n"); exit (0);
+#else
+  printf ("ns32k-encore-bsd\n"); exit (0);
+#endif
+#endif
+#endif
+
+#if defined (__386BSD__)
+  printf ("i386-pc-bsd\n"); exit (0);
+#endif
+
+#if defined (sequent)
+#if defined (i386)
+  printf ("i386-sequent-dynix\n"); exit (0);
+#endif
+#if defined (ns32000)
+  printf ("ns32k-sequent-dynix\n"); exit (0);
+#endif
+#endif
+
+#if defined (_SEQUENT_)
+    struct utsname un;
+
+    uname(&un);
+
+    if (strncmp(un.version, "V2", 2) == 0) {
+	printf ("i386-sequent-ptx2\n"); exit (0);
+    }
+    if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
+	printf ("i386-sequent-ptx1\n"); exit (0);
+    }
+    printf ("i386-sequent-ptx\n"); exit (0);
+
+#endif
+
+#if defined (vax)
+# if !defined (ultrix)
+#  include <sys/param.h>
+#  if defined (BSD)
+#   if BSD == 43
+      printf ("vax-dec-bsd4.3\n"); exit (0);
+#   else
+#    if BSD == 199006
+      printf ("vax-dec-bsd4.3reno\n"); exit (0);
+#    else
+      printf ("vax-dec-bsd\n"); exit (0);
+#    endif
+#   endif
+#  else
+    printf ("vax-dec-bsd\n"); exit (0);
+#  endif
+# else
+    printf ("vax-dec-ultrix\n"); exit (0);
+# endif
+#endif
+
+#if defined (alliant) && defined (i860)
+  printf ("i860-alliant-bsd\n"); exit (0);
+#endif
+
+  exit (1);
+}
+EOF
+
+$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && $dummy && rm -f $dummy.c $dummy && rmdir $tmpdir && exit 0
+rm -f $dummy.c $dummy && rmdir $tmpdir
+
+# Apollos put the system type in the environment.
+
+test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit 0; }
+
+# Convex versions that predate uname can use getsysinfo(1)
+
+if [ -x /usr/convex/getsysinfo ]
+then
+    case `getsysinfo -f cpu_type` in
+    c1*)
+	echo c1-convex-bsd
+	exit 0 ;;
+    c2*)
+	if getsysinfo -f scalar_acc
+	then echo c32-convex-bsd
+	else echo c2-convex-bsd
+	fi
+	exit 0 ;;
+    c34*)
+	echo c34-convex-bsd
+	exit 0 ;;
+    c38*)
+	echo c38-convex-bsd
+	exit 0 ;;
+    c4*)
+	echo c4-convex-bsd
+	exit 0 ;;
+    esac
+fi
+
+cat >&2 <<EOF
+$0: unable to guess system type
+
+This script, last modified $timestamp, has failed to recognize
+the operating system you are using. It is advised that you
+download the most up to date version of the config scripts from
+
+    ftp://ftp.gnu.org/pub/gnu/config/
+
+If the version you run ($0) is already up to date, please
+send the following data and any information you think might be
+pertinent to <config-patches@gnu.org> in order to provide the needed
+information to handle your system.
+
+config.guess timestamp = $timestamp
+
+uname -m = `(uname -m) 2>/dev/null || echo unknown`
+uname -r = `(uname -r) 2>/dev/null || echo unknown`
+uname -s = `(uname -s) 2>/dev/null || echo unknown`
+uname -v = `(uname -v) 2>/dev/null || echo unknown`
+
+/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null`
+/bin/uname -X     = `(/bin/uname -X) 2>/dev/null`
+
+hostinfo               = `(hostinfo) 2>/dev/null`
+/bin/universe          = `(/bin/universe) 2>/dev/null`
+/usr/bin/arch -k       = `(/usr/bin/arch -k) 2>/dev/null`
+/bin/arch              = `(/bin/arch) 2>/dev/null`
+/usr/bin/oslevel       = `(/usr/bin/oslevel) 2>/dev/null`
+/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null`
+
+UNAME_MACHINE = ${UNAME_MACHINE}
+UNAME_RELEASE = ${UNAME_RELEASE}
+UNAME_SYSTEM  = ${UNAME_SYSTEM}
+UNAME_VERSION = ${UNAME_VERSION}
+EOF
+
+exit 1
+
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "timestamp='"
+# time-stamp-format: "%:y-%02m-%02d"
+# time-stamp-end: "'"
+# End:
diff -Naur tomato/release/src/router/snmp/config.sub tomato121/release/src/router/snmp/config.sub
--- tomato/release/src/router/snmp/config.sub	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/config.sub	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,1470 @@
+#! /bin/sh
+# Configuration validation subroutine script.
+#   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
+#   2000, 2001, 2002 Free Software Foundation, Inc.
+
+timestamp='2002-09-05'
+
+# This file is (in principle) common to ALL GNU software.
+# The presence of a machine in this file suggests that SOME GNU software
+# can handle that machine.  It does not imply ALL GNU software can.
+#
+# This file is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330,
+# Boston, MA 02111-1307, USA.
+
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# Please send patches to <config-patches@gnu.org>.  Submit a context
+# diff and a properly formatted ChangeLog entry.
+#
+# Configuration subroutine to validate and canonicalize a configuration type.
+# Supply the specified configuration type as an argument.
+# If it is invalid, we print an error message on stderr and exit with code 1.
+# Otherwise, we print the canonical config type on stdout and succeed.
+
+# This file is supposed to be the same for all GNU packages
+# and recognize all the CPU types, system types and aliases
+# that are meaningful with *any* GNU software.
+# Each package is responsible for reporting which valid configurations
+# it does not support.  The user should be able to distinguish
+# a failure to support a valid configuration from a meaningless
+# configuration.
+
+# The goal of this file is to map all the various variations of a given
+# machine specification into a single specification in the form:
+#	CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
+# or in some cases, the newer four-part form:
+#	CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
+# It is wrong to echo any other type of specification.
+
+me=`echo "$0" | sed -e 's,.*/,,'`
+
+usage="\
+Usage: $0 [OPTION] CPU-MFR-OPSYS
+       $0 [OPTION] ALIAS
+
+Canonicalize a configuration name.
+
+Operation modes:
+  -h, --help         print this help, then exit
+  -t, --time-stamp   print date of last modification, then exit
+  -v, --version      print version number, then exit
+
+Report bugs and patches to <config-patches@gnu.org>."
+
+version="\
+GNU config.sub ($timestamp)
+
+Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
+Free Software Foundation, Inc.
+
+This is free software; see the source for copying conditions.  There is NO
+warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
+
+help="
+Try \`$me --help' for more information."
+
+# Parse command line
+while test $# -gt 0 ; do
+  case $1 in
+    --time-stamp | --time* | -t )
+       echo "$timestamp" ; exit 0 ;;
+    --version | -v )
+       echo "$version" ; exit 0 ;;
+    --help | --h* | -h )
+       echo "$usage"; exit 0 ;;
+    -- )     # Stop option processing
+       shift; break ;;
+    - )	# Use stdin as input.
+       break ;;
+    -* )
+       echo "$me: invalid option $1$help"
+       exit 1 ;;
+
+    *local*)
+       # First pass through any local machine types.
+       echo $1
+       exit 0;;
+
+    * )
+       break ;;
+  esac
+done
+
+case $# in
+ 0) echo "$me: missing argument$help" >&2
+    exit 1;;
+ 1) ;;
+ *) echo "$me: too many arguments$help" >&2
+    exit 1;;
+esac
+
+# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any).
+# Here we must recognize all the valid KERNEL-OS combinations.
+maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
+case $maybe_os in
+  nto-qnx* | linux-gnu* | freebsd*-gnu* | storm-chaos* | os2-emx* | windows32-* | rtmk-nova*)
+    os=-$maybe_os
+    basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
+    ;;
+  *)
+    basic_machine=`echo $1 | sed 's/-[^-]*$//'`
+    if [ $basic_machine != $1 ]
+    then os=`echo $1 | sed 's/.*-/-/'`
+    else os=; fi
+    ;;
+esac
+
+### Let's recognize common machines as not being operating systems so
+### that things like config.sub decstation-3100 work.  We also
+### recognize some manufacturers as not being operating systems, so we
+### can provide default operating systems below.
+case $os in
+	-sun*os*)
+		# Prevent following clause from handling this invalid input.
+		;;
+	-dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \
+	-att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \
+	-unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \
+	-convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
+	-c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
+	-harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
+	-apple | -axis)
+		os=
+		basic_machine=$1
+		;;
+	-sim | -cisco | -oki | -wec | -winbond)
+		os=
+		basic_machine=$1
+		;;
+	-scout)
+		;;
+	-wrs)
+		os=-vxworks
+		basic_machine=$1
+		;;
+	-chorusos*)
+		os=-chorusos
+		basic_machine=$1
+		;;
+ 	-chorusrdb)
+ 		os=-chorusrdb
+		basic_machine=$1
+ 		;;
+	-hiux*)
+		os=-hiuxwe2
+		;;
+	-sco5)
+		os=-sco3.2v5
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		;;
+	-sco4)
+		os=-sco3.2v4
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		;;
+	-sco3.2.[4-9]*)
+		os=`echo $os | sed -e 's/sco3.2./sco3.2v/'`
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		;;
+	-sco3.2v[4-9]*)
+		# Don't forget version if it is 3.2v4 or newer.
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		;;
+	-sco*)
+		os=-sco3.2v2
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		;;
+	-udk*)
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		;;
+	-isc)
+		os=-isc2.2
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		;;
+	-clix*)
+		basic_machine=clipper-intergraph
+		;;
+	-isc*)
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		;;
+	-lynx*)
+		os=-lynxos
+		;;
+	-ptx*)
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'`
+		;;
+	-windowsnt*)
+		os=`echo $os | sed -e 's/windowsnt/winnt/'`
+		;;
+	-psos*)
+		os=-psos
+		;;
+	-mint | -mint[0-9]*)
+		basic_machine=m68k-atari
+		os=-mint
+		;;
+esac
+
+# Decode aliases for certain CPU-COMPANY combinations.
+case $basic_machine in
+	# Recognize the basic CPU types without company name.
+	# Some are omitted here because they have special meanings below.
+	1750a | 580 \
+	| a29k \
+	| alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
+	| alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
+	| arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \
+	| clipper \
+	| d10v | d30v | dlx | dsp16xx \
+	| fr30 | frv \
+	| h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
+	| i370 | i860 | i960 | ia64 \
+	| ip2k \
+	| m32r | m68000 | m68k | m88k | mcore \
+	| mips | mipsbe | mipseb | mipsel | mipsle \
+	| mips16 \
+	| mips64 | mips64el \
+	| mips64vr | mips64vrel \
+	| mips64orion | mips64orionel \
+	| mips64vr4100 | mips64vr4100el \
+	| mips64vr4300 | mips64vr4300el \
+	| mips64vr5000 | mips64vr5000el \
+	| mipsisa32 | mipsisa32el \
+	| mipsisa64 | mipsisa64el \
+	| mipsisa64sb1 | mipsisa64sb1el \
+	| mipsisa64sr71k | mipsisa64sr71kel \
+	| mipstx39 | mipstx39el \
+	| mn10200 | mn10300 \
+	| ns16k | ns32k \
+	| openrisc | or32 \
+	| pdp10 | pdp11 | pj | pjl \
+	| powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \
+	| pyramid \
+	| sh | sh[1234] | sh3e | sh[34]eb | shbe | shle | sh[1234]le | sh3ele \
+	| sh64 | sh64le \
+	| sparc | sparc64 | sparc86x | sparclet | sparclite | sparcv9 | sparcv9b \
+	| strongarm \
+	| tahoe | thumb | tic80 | tron \
+	| v850 | v850e \
+	| we32k \
+	| x86 | xscale | xstormy16 | xtensa \
+	| z8k)
+		basic_machine=$basic_machine-unknown
+		;;
+	m6811 | m68hc11 | m6812 | m68hc12)
+		# Motorola 68HC11/12.
+		basic_machine=$basic_machine-unknown
+		os=-none
+		;;
+	m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k)
+		;;
+
+	# We use `pc' rather than `unknown'
+	# because (1) that's what they normally are, and
+	# (2) the word "unknown" tends to confuse beginning users.
+	i*86 | x86_64)
+	  basic_machine=$basic_machine-pc
+	  ;;
+	# Object if more than one company name word.
+	*-*-*)
+		echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
+		exit 1
+		;;
+	# Recognize the basic CPU types with company name.
+	580-* \
+	| a29k-* \
+	| alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \
+	| alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \
+	| alphapca5[67]-* | alpha64pca5[67]-* | arc-* \
+	| arm-*  | armbe-* | armle-* | armeb-* | armv*-* \
+	| avr-* \
+	| bs2000-* \
+	| c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* \
+	| clipper-* | cydra-* \
+	| d10v-* | d30v-* | dlx-* \
+	| elxsi-* \
+	| f30[01]-* | f700-* | fr30-* | frv-* | fx80-* \
+	| h8300-* | h8500-* \
+	| hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
+	| i*86-* | i860-* | i960-* | ia64-* \
+	| ip2k-* \
+	| m32r-* \
+	| m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
+	| m88110-* | m88k-* | mcore-* \
+	| mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
+	| mips16-* \
+	| mips64-* | mips64el-* \
+	| mips64vr-* | mips64vrel-* \
+	| mips64orion-* | mips64orionel-* \
+	| mips64vr4100-* | mips64vr4100el-* \
+	| mips64vr4300-* | mips64vr4300el-* \
+	| mips64vr5000-* | mips64vr5000el-* \
+	| mipsisa32-* | mipsisa32el-* \
+	| mipsisa64-* | mipsisa64el-* \
+	| mipsisa64sb1-* | mipsisa64sb1el-* \
+	| mipsisa64sr71k-* | mipsisa64sr71kel-* \
+	| mipstx39 | mipstx39el \
+	| none-* | np1-* | ns16k-* | ns32k-* \
+	| orion-* \
+	| pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
+	| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \
+	| pyramid-* \
+	| romp-* | rs6000-* \
+	| sh-* | sh[1234]-* | sh3e-* | sh[34]eb-* | shbe-* \
+	| shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
+	| sparc-* | sparc64-* | sparc86x-* | sparclet-* | sparclite-* \
+	| sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \
+	| tahoe-* | thumb-* | tic30-* | tic4x-* | tic54x-* | tic80-* | tron-* \
+	| v850-* | v850e-* | vax-* \
+	| we32k-* \
+	| x86-* | x86_64-* | xps100-* | xscale-* | xstormy16-* \
+	| xtensa-* \
+	| ymp-* \
+	| z8k-*)
+		;;
+	# Recognize the various machine names and aliases which stand
+	# for a CPU type and a company and sometimes even an OS.
+	386bsd)
+		basic_machine=i386-unknown
+		os=-bsd
+		;;
+	3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc)
+		basic_machine=m68000-att
+		;;
+	3b*)
+		basic_machine=we32k-att
+		;;
+	a29khif)
+		basic_machine=a29k-amd
+		os=-udi
+		;;
+	adobe68k)
+		basic_machine=m68010-adobe
+		os=-scout
+		;;
+	alliant | fx80)
+		basic_machine=fx80-alliant
+		;;
+	altos | altos3068)
+		basic_machine=m68k-altos
+		;;
+	am29k)
+		basic_machine=a29k-none
+		os=-bsd
+		;;
+	amdahl)
+		basic_machine=580-amdahl
+		os=-sysv
+		;;
+	amiga | amiga-*)
+		basic_machine=m68k-unknown
+		;;
+	amigaos | amigados)
+		basic_machine=m68k-unknown
+		os=-amigaos
+		;;
+	amigaunix | amix)
+		basic_machine=m68k-unknown
+		os=-sysv4
+		;;
+	apollo68)
+		basic_machine=m68k-apollo
+		os=-sysv
+		;;
+	apollo68bsd)
+		basic_machine=m68k-apollo
+		os=-bsd
+		;;
+	aux)
+		basic_machine=m68k-apple
+		os=-aux
+		;;
+	balance)
+		basic_machine=ns32k-sequent
+		os=-dynix
+		;;
+	c90)
+		basic_machine=c90-cray
+		os=-unicos
+		;;
+	convex-c1)
+		basic_machine=c1-convex
+		os=-bsd
+		;;
+	convex-c2)
+		basic_machine=c2-convex
+		os=-bsd
+		;;
+	convex-c32)
+		basic_machine=c32-convex
+		os=-bsd
+		;;
+	convex-c34)
+		basic_machine=c34-convex
+		os=-bsd
+		;;
+	convex-c38)
+		basic_machine=c38-convex
+		os=-bsd
+		;;
+	cray | j90)
+		basic_machine=j90-cray
+		os=-unicos
+		;;
+	crds | unos)
+		basic_machine=m68k-crds
+		;;
+	cris | cris-* | etrax*)
+		basic_machine=cris-axis
+		;;
+	da30 | da30-*)
+		basic_machine=m68k-da30
+		;;
+	decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn)
+		basic_machine=mips-dec
+		;;
+	decsystem10* | dec10*)
+		basic_machine=pdp10-dec
+		os=-tops10
+		;;
+	decsystem20* | dec20*)
+		basic_machine=pdp10-dec
+		os=-tops20
+		;;
+	delta | 3300 | motorola-3300 | motorola-delta \
+	      | 3300-motorola | delta-motorola)
+		basic_machine=m68k-motorola
+		;;
+	delta88)
+		basic_machine=m88k-motorola
+		os=-sysv3
+		;;
+	dpx20 | dpx20-*)
+		basic_machine=rs6000-bull
+		os=-bosx
+		;;
+	dpx2* | dpx2*-bull)
+		basic_machine=m68k-bull
+		os=-sysv3
+		;;
+	ebmon29k)
+		basic_machine=a29k-amd
+		os=-ebmon
+		;;
+	elxsi)
+		basic_machine=elxsi-elxsi
+		os=-bsd
+		;;
+	encore | umax | mmax)
+		basic_machine=ns32k-encore
+		;;
+	es1800 | OSE68k | ose68k | ose | OSE)
+		basic_machine=m68k-ericsson
+		os=-ose
+		;;
+	fx2800)
+		basic_machine=i860-alliant
+		;;
+	genix)
+		basic_machine=ns32k-ns
+		;;
+	gmicro)
+		basic_machine=tron-gmicro
+		os=-sysv
+		;;
+	go32)
+		basic_machine=i386-pc
+		os=-go32
+		;;
+	h3050r* | hiux*)
+		basic_machine=hppa1.1-hitachi
+		os=-hiuxwe2
+		;;
+	h8300hms)
+		basic_machine=h8300-hitachi
+		os=-hms
+		;;
+	h8300xray)
+		basic_machine=h8300-hitachi
+		os=-xray
+		;;
+	h8500hms)
+		basic_machine=h8500-hitachi
+		os=-hms
+		;;
+	harris)
+		basic_machine=m88k-harris
+		os=-sysv3
+		;;
+	hp300-*)
+		basic_machine=m68k-hp
+		;;
+	hp300bsd)
+		basic_machine=m68k-hp
+		os=-bsd
+		;;
+	hp300hpux)
+		basic_machine=m68k-hp
+		os=-hpux
+		;;
+	hp3k9[0-9][0-9] | hp9[0-9][0-9])
+		basic_machine=hppa1.0-hp
+		;;
+	hp9k2[0-9][0-9] | hp9k31[0-9])
+		basic_machine=m68000-hp
+		;;
+	hp9k3[2-9][0-9])
+		basic_machine=m68k-hp
+		;;
+	hp9k6[0-9][0-9] | hp6[0-9][0-9])
+		basic_machine=hppa1.0-hp
+		;;
+	hp9k7[0-79][0-9] | hp7[0-79][0-9])
+		basic_machine=hppa1.1-hp
+		;;
+	hp9k78[0-9] | hp78[0-9])
+		# FIXME: really hppa2.0-hp
+		basic_machine=hppa1.1-hp
+		;;
+	hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893)
+		# FIXME: really hppa2.0-hp
+		basic_machine=hppa1.1-hp
+		;;
+	hp9k8[0-9][13679] | hp8[0-9][13679])
+		basic_machine=hppa1.1-hp
+		;;
+	hp9k8[0-9][0-9] | hp8[0-9][0-9])
+		basic_machine=hppa1.0-hp
+		;;
+	hppa-next)
+		os=-nextstep3
+		;;
+	hppaosf)
+		basic_machine=hppa1.1-hp
+		os=-osf
+		;;
+	hppro)
+		basic_machine=hppa1.1-hp
+		os=-proelf
+		;;
+	i370-ibm* | ibm*)
+		basic_machine=i370-ibm
+		;;
+# I'm not sure what "Sysv32" means.  Should this be sysv3.2?
+	i*86v32)
+		basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+		os=-sysv32
+		;;
+	i*86v4*)
+		basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+		os=-sysv4
+		;;
+	i*86v)
+		basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+		os=-sysv
+		;;
+	i*86sol2)
+		basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+		os=-solaris2
+		;;
+	i386mach)
+		basic_machine=i386-mach
+		os=-mach
+		;;
+	i386-vsta | vsta)
+		basic_machine=i386-unknown
+		os=-vsta
+		;;
+	iris | iris4d)
+		basic_machine=mips-sgi
+		case $os in
+		    -irix*)
+			;;
+		    *)
+			os=-irix4
+			;;
+		esac
+		;;
+	isi68 | isi)
+		basic_machine=m68k-isi
+		os=-sysv
+		;;
+	m88k-omron*)
+		basic_machine=m88k-omron
+		;;
+	magnum | m3230)
+		basic_machine=mips-mips
+		os=-sysv
+		;;
+	merlin)
+		basic_machine=ns32k-utek
+		os=-sysv
+		;;
+	mingw32)
+		basic_machine=i386-pc
+		os=-mingw32
+		;;
+	miniframe)
+		basic_machine=m68000-convergent
+		;;
+	*mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*)
+		basic_machine=m68k-atari
+		os=-mint
+		;;
+	mips3*-*)
+		basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`
+		;;
+	mips3*)
+		basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown
+		;;
+	mmix*)
+		basic_machine=mmix-knuth
+		os=-mmixware
+		;;
+	monitor)
+		basic_machine=m68k-rom68k
+		os=-coff
+		;;
+	morphos)
+		basic_machine=powerpc-unknown
+		os=-morphos
+		;;
+	msdos)
+		basic_machine=i386-pc
+		os=-msdos
+		;;
+	mvs)
+		basic_machine=i370-ibm
+		os=-mvs
+		;;
+	ncr3000)
+		basic_machine=i486-ncr
+		os=-sysv4
+		;;
+	netbsd386)
+		basic_machine=i386-unknown
+		os=-netbsd
+		;;
+	netwinder)
+		basic_machine=armv4l-rebel
+		os=-linux
+		;;
+	news | news700 | news800 | news900)
+		basic_machine=m68k-sony
+		os=-newsos
+		;;
+	news1000)
+		basic_machine=m68030-sony
+		os=-newsos
+		;;
+	news-3600 | risc-news)
+		basic_machine=mips-sony
+		os=-newsos
+		;;
+	necv70)
+		basic_machine=v70-nec
+		os=-sysv
+		;;
+	next | m*-next )
+		basic_machine=m68k-next
+		case $os in
+		    -nextstep* )
+			;;
+		    -ns2*)
+		      os=-nextstep2
+			;;
+		    *)
+		      os=-nextstep3
+			;;
+		esac
+		;;
+	nh3000)
+		basic_machine=m68k-harris
+		os=-cxux
+		;;
+	nh[45]000)
+		basic_machine=m88k-harris
+		os=-cxux
+		;;
+	nindy960)
+		basic_machine=i960-intel
+		os=-nindy
+		;;
+	mon960)
+		basic_machine=i960-intel
+		os=-mon960
+		;;
+	nonstopux)
+		basic_machine=mips-compaq
+		os=-nonstopux
+		;;
+	np1)
+		basic_machine=np1-gould
+		;;
+	nsr-tandem)
+		basic_machine=nsr-tandem
+		;;
+	op50n-* | op60c-*)
+		basic_machine=hppa1.1-oki
+		os=-proelf
+		;;
+	or32 | or32-*)
+		basic_machine=or32-unknown
+		os=-coff
+		;;
+	OSE68000 | ose68000)
+		basic_machine=m68000-ericsson
+		os=-ose
+		;;
+	os68k)
+		basic_machine=m68k-none
+		os=-os68k
+		;;
+	pa-hitachi)
+		basic_machine=hppa1.1-hitachi
+		os=-hiuxwe2
+		;;
+	paragon)
+		basic_machine=i860-intel
+		os=-osf
+		;;
+	pbd)
+		basic_machine=sparc-tti
+		;;
+	pbb)
+		basic_machine=m68k-tti
+		;;
+	pc532 | pc532-*)
+		basic_machine=ns32k-pc532
+		;;
+	pentium | p5 | k5 | k6 | nexgen | viac3)
+		basic_machine=i586-pc
+		;;
+	pentiumpro | p6 | 6x86 | athlon | athlon_*)
+		basic_machine=i686-pc
+		;;
+	pentiumii | pentium2)
+		basic_machine=i686-pc
+		;;
+	pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*)
+		basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	pentiumpro-* | p6-* | 6x86-* | athlon-*)
+		basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	pentiumii-* | pentium2-*)
+		basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	pn)
+		basic_machine=pn-gould
+		;;
+	power)	basic_machine=power-ibm
+		;;
+	ppc)	basic_machine=powerpc-unknown
+		;;
+	ppc-*)	basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	ppcle | powerpclittle | ppc-le | powerpc-little)
+		basic_machine=powerpcle-unknown
+		;;
+	ppcle-* | powerpclittle-*)
+		basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	ppc64)	basic_machine=powerpc64-unknown
+		;;
+	ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	ppc64le | powerpc64little | ppc64-le | powerpc64-little)
+		basic_machine=powerpc64le-unknown
+		;;
+	ppc64le-* | powerpc64little-*)
+		basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	ps2)
+		basic_machine=i386-ibm
+		;;
+	pw32)
+		basic_machine=i586-unknown
+		os=-pw32
+		;;
+	rom68k)
+		basic_machine=m68k-rom68k
+		os=-coff
+		;;
+	rm[46]00)
+		basic_machine=mips-siemens
+		;;
+	rtpc | rtpc-*)
+		basic_machine=romp-ibm
+		;;
+	s390 | s390-*)
+		basic_machine=s390-ibm
+		;;
+	s390x | s390x-*)
+		basic_machine=s390x-ibm
+		;;
+	sa29200)
+		basic_machine=a29k-amd
+		os=-udi
+		;;
+	sb1)
+		basic_machine=mipsisa64sb1-unknown
+		;;
+	sb1el)
+		basic_machine=mipsisa64sb1el-unknown
+		;;
+	sequent)
+		basic_machine=i386-sequent
+		;;
+	sh)
+		basic_machine=sh-hitachi
+		os=-hms
+		;;
+	sparclite-wrs | simso-wrs)
+		basic_machine=sparclite-wrs
+		os=-vxworks
+		;;
+	sps7)
+		basic_machine=m68k-bull
+		os=-sysv2
+		;;
+	spur)
+		basic_machine=spur-unknown
+		;;
+	st2000)
+		basic_machine=m68k-tandem
+		;;
+	stratus)
+		basic_machine=i860-stratus
+		os=-sysv4
+		;;
+	sun2)
+		basic_machine=m68000-sun
+		;;
+	sun2os3)
+		basic_machine=m68000-sun
+		os=-sunos3
+		;;
+	sun2os4)
+		basic_machine=m68000-sun
+		os=-sunos4
+		;;
+	sun3os3)
+		basic_machine=m68k-sun
+		os=-sunos3
+		;;
+	sun3os4)
+		basic_machine=m68k-sun
+		os=-sunos4
+		;;
+	sun4os3)
+		basic_machine=sparc-sun
+		os=-sunos3
+		;;
+	sun4os4)
+		basic_machine=sparc-sun
+		os=-sunos4
+		;;
+	sun4sol2)
+		basic_machine=sparc-sun
+		os=-solaris2
+		;;
+	sun3 | sun3-*)
+		basic_machine=m68k-sun
+		;;
+	sun4)
+		basic_machine=sparc-sun
+		;;
+	sun386 | sun386i | roadrunner)
+		basic_machine=i386-sun
+		;;
+	sv1)
+		basic_machine=sv1-cray
+		os=-unicos
+		;;
+	symmetry)
+		basic_machine=i386-sequent
+		os=-dynix
+		;;
+	t3d)
+		basic_machine=alpha-cray
+		os=-unicos
+		;;
+	t3e)
+		basic_machine=alphaev5-cray
+		os=-unicos
+		;;
+	t90)
+		basic_machine=t90-cray
+		os=-unicos
+		;;
+        tic4x | c4x*)
+		basic_machine=tic4x-unknown
+		os=-coff
+		;;
+	tic54x | c54x*)
+		basic_machine=tic54x-unknown
+		os=-coff
+		;;
+	tx39)
+		basic_machine=mipstx39-unknown
+		;;
+	tx39el)
+		basic_machine=mipstx39el-unknown
+		;;
+	toad1)
+		basic_machine=pdp10-xkl
+		os=-tops20
+		;;
+	tower | tower-32)
+		basic_machine=m68k-ncr
+		;;
+	udi29k)
+		basic_machine=a29k-amd
+		os=-udi
+		;;
+	ultra3)
+		basic_machine=a29k-nyu
+		os=-sym1
+		;;
+	v810 | necv810)
+		basic_machine=v810-nec
+		os=-none
+		;;
+	vaxv)
+		basic_machine=vax-dec
+		os=-sysv
+		;;
+	vms)
+		basic_machine=vax-dec
+		os=-vms
+		;;
+	vpp*|vx|vx-*)
+		basic_machine=f301-fujitsu
+		;;
+	vxworks960)
+		basic_machine=i960-wrs
+		os=-vxworks
+		;;
+	vxworks68)
+		basic_machine=m68k-wrs
+		os=-vxworks
+		;;
+	vxworks29k)
+		basic_machine=a29k-wrs
+		os=-vxworks
+		;;
+	w65*)
+		basic_machine=w65-wdc
+		os=-none
+		;;
+	w89k-*)
+		basic_machine=hppa1.1-winbond
+		os=-proelf
+		;;
+	windows32)
+		basic_machine=i386-pc
+		os=-windows32-msvcrt
+		;;
+	xps | xps100)
+		basic_machine=xps100-honeywell
+		;;
+	ymp)
+		basic_machine=ymp-cray
+		os=-unicos
+		;;
+	z8k-*-coff)
+		basic_machine=z8k-unknown
+		os=-sim
+		;;
+	none)
+		basic_machine=none-none
+		os=-none
+		;;
+
+# Here we handle the default manufacturer of certain CPU types.  It is in
+# some cases the only manufacturer, in others, it is the most popular.
+	w89k)
+		basic_machine=hppa1.1-winbond
+		;;
+	op50n)
+		basic_machine=hppa1.1-oki
+		;;
+	op60c)
+		basic_machine=hppa1.1-oki
+		;;
+	romp)
+		basic_machine=romp-ibm
+		;;
+	rs6000)
+		basic_machine=rs6000-ibm
+		;;
+	vax)
+		basic_machine=vax-dec
+		;;
+	pdp10)
+		# there are many clones, so DEC is not a safe bet
+		basic_machine=pdp10-unknown
+		;;
+	pdp11)
+		basic_machine=pdp11-dec
+		;;
+	we32k)
+		basic_machine=we32k-att
+		;;
+	sh3 | sh4 | sh3eb | sh4eb | sh[1234]le | sh3ele)
+		basic_machine=sh-unknown
+		;;
+	sh64)
+		basic_machine=sh64-unknown
+		;;
+	sparc | sparcv9 | sparcv9b)
+		basic_machine=sparc-sun
+		;;
+	cydra)
+		basic_machine=cydra-cydrome
+		;;
+	orion)
+		basic_machine=orion-highlevel
+		;;
+	orion105)
+		basic_machine=clipper-highlevel
+		;;
+	mac | mpw | mac-mpw)
+		basic_machine=m68k-apple
+		;;
+	pmac | pmac-mpw)
+		basic_machine=powerpc-apple
+		;;
+	*-unknown)
+		# Make sure to match an already-canonicalized machine name.
+		;;
+	*)
+		echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
+		exit 1
+		;;
+esac
+
+# Here we canonicalize certain aliases for manufacturers.
+case $basic_machine in
+	*-digital*)
+		basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'`
+		;;
+	*-commodore*)
+		basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'`
+		;;
+	*)
+		;;
+esac
+
+# Decode manufacturer-specific aliases for certain operating systems.
+
+if [ x"$os" != x"" ]
+then
+case $os in
+        # First match some system type aliases
+        # that might get confused with valid system types.
+	# -solaris* is a basic system type, with this one exception.
+	-solaris1 | -solaris1.*)
+		os=`echo $os | sed -e 's|solaris1|sunos4|'`
+		;;
+	-solaris)
+		os=-solaris2
+		;;
+	-svr4*)
+		os=-sysv4
+		;;
+	-unixware*)
+		os=-sysv4.2uw
+		;;
+	-gnu/linux*)
+		os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'`
+		;;
+	# First accept the basic system types.
+	# The portable systems comes first.
+	# Each alternative MUST END IN A *, to match a version number.
+	# -sysv* is not here because it comes later, after sysvr4.
+	-gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
+	      | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\
+	      | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \
+	      | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
+	      | -aos* \
+	      | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
+	      | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
+	      | -hiux* | -386bsd* | -netbsd* | -openbsd* | -freebsd* | -riscix* \
+	      | -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
+	      | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
+	      | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
+	      | -chorusos* | -chorusrdb* \
+	      | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
+	      | -mingw32* | -linux-gnu* | -uxpv* | -beos* | -mpeix* | -udk* \
+	      | -interix* | -uwin* | -rhapsody* | -darwin* | -opened* \
+	      | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
+	      | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \
+	      | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
+	      | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* | -powermax*)
+	# Remember, each alternative MUST END IN *, to match a version number.
+		;;
+	-qnx*)
+		case $basic_machine in
+		    x86-* | i*86-*)
+			;;
+		    *)
+			os=-nto$os
+			;;
+		esac
+		;;
+	-nto*)
+		os=-nto-qnx
+		;;
+	-sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \
+	      | -windows* | -osx | -abug | -netware* | -os9* | -beos* \
+	      | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*)
+		;;
+	-mac*)
+		os=`echo $os | sed -e 's|mac|macos|'`
+		;;
+	-linux*)
+		os=`echo $os | sed -e 's|linux|linux-gnu|'`
+		;;
+	-sunos5*)
+		os=`echo $os | sed -e 's|sunos5|solaris2|'`
+		;;
+	-sunos6*)
+		os=`echo $os | sed -e 's|sunos6|solaris3|'`
+		;;
+	-opened*)
+		os=-openedition
+		;;
+	-wince*)
+		os=-wince
+		;;
+	-osfrose*)
+		os=-osfrose
+		;;
+	-osf*)
+		os=-osf
+		;;
+	-utek*)
+		os=-bsd
+		;;
+	-dynix*)
+		os=-bsd
+		;;
+	-acis*)
+		os=-aos
+		;;
+	-atheos*)
+		os=-atheos
+		;;
+	-386bsd)
+		os=-bsd
+		;;
+	-ctix* | -uts*)
+		os=-sysv
+		;;
+	-nova*)
+		os=-rtmk-nova
+		;;
+	-ns2 )
+		os=-nextstep2
+		;;
+	-nsk*)
+		os=-nsk
+		;;
+	# Preserve the version number of sinix5.
+	-sinix5.*)
+		os=`echo $os | sed -e 's|sinix|sysv|'`
+		;;
+	-sinix*)
+		os=-sysv4
+		;;
+	-triton*)
+		os=-sysv3
+		;;
+	-oss*)
+		os=-sysv3
+		;;
+	-svr4)
+		os=-sysv4
+		;;
+	-svr3)
+		os=-sysv3
+		;;
+	-sysvr4)
+		os=-sysv4
+		;;
+	# This must come after -sysvr4.
+	-sysv*)
+		;;
+	-ose*)
+		os=-ose
+		;;
+	-es1800*)
+		os=-ose
+		;;
+	-xenix)
+		os=-xenix
+		;;
+	-*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
+		os=-mint
+		;;
+	-none)
+		;;
+	*)
+		# Get rid of the `-' at the beginning of $os.
+		os=`echo $os | sed 's/[^-]*-//'`
+		echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2
+		exit 1
+		;;
+esac
+else
+
+# Here we handle the default operating systems that come with various machines.
+# The value should be what the vendor currently ships out the door with their
+# machine or put another way, the most popular os provided with the machine.
+
+# Note that if you're going to try to match "-MANUFACTURER" here (say,
+# "-sun"), then you have to tell the case statement up towards the top
+# that MANUFACTURER isn't an operating system.  Otherwise, code above
+# will signal an error saying that MANUFACTURER isn't an operating
+# system, and we'll never get to this point.
+
+case $basic_machine in
+	*-acorn)
+		os=-riscix1.2
+		;;
+	arm*-rebel)
+		os=-linux
+		;;
+	arm*-semi)
+		os=-aout
+		;;
+	# This must come before the *-dec entry.
+	pdp10-*)
+		os=-tops20
+		;;
+	pdp11-*)
+		os=-none
+		;;
+	*-dec | vax-*)
+		os=-ultrix4.2
+		;;
+	m68*-apollo)
+		os=-domain
+		;;
+	i386-sun)
+		os=-sunos4.0.2
+		;;
+	m68000-sun)
+		os=-sunos3
+		# This also exists in the configure program, but was not the
+		# default.
+		# os=-sunos4
+		;;
+	m68*-cisco)
+		os=-aout
+		;;
+	mips*-cisco)
+		os=-elf
+		;;
+	mips*-*)
+		os=-elf
+		;;
+	or32-*)
+		os=-coff
+		;;
+	*-tti)	# must be before sparc entry or we get the wrong os.
+		os=-sysv3
+		;;
+	sparc-* | *-sun)
+		os=-sunos4.1.1
+		;;
+	*-be)
+		os=-beos
+		;;
+	*-ibm)
+		os=-aix
+		;;
+	*-wec)
+		os=-proelf
+		;;
+	*-winbond)
+		os=-proelf
+		;;
+	*-oki)
+		os=-proelf
+		;;
+	*-hp)
+		os=-hpux
+		;;
+	*-hitachi)
+		os=-hiux
+		;;
+	i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent)
+		os=-sysv
+		;;
+	*-cbm)
+		os=-amigaos
+		;;
+	*-dg)
+		os=-dgux
+		;;
+	*-dolphin)
+		os=-sysv3
+		;;
+	m68k-ccur)
+		os=-rtu
+		;;
+	m88k-omron*)
+		os=-luna
+		;;
+	*-next )
+		os=-nextstep
+		;;
+	*-sequent)
+		os=-ptx
+		;;
+	*-crds)
+		os=-unos
+		;;
+	*-ns)
+		os=-genix
+		;;
+	i370-*)
+		os=-mvs
+		;;
+	*-next)
+		os=-nextstep3
+		;;
+	*-gould)
+		os=-sysv
+		;;
+	*-highlevel)
+		os=-bsd
+		;;
+	*-encore)
+		os=-bsd
+		;;
+	*-sgi)
+		os=-irix
+		;;
+	*-siemens)
+		os=-sysv4
+		;;
+	*-masscomp)
+		os=-rtu
+		;;
+	f30[01]-fujitsu | f700-fujitsu)
+		os=-uxpv
+		;;
+	*-rom68k)
+		os=-coff
+		;;
+	*-*bug)
+		os=-coff
+		;;
+	*-apple)
+		os=-macos
+		;;
+	*-atari*)
+		os=-mint
+		;;
+	*)
+		os=-none
+		;;
+esac
+fi
+
+# Here we handle the case where we know the os, and the CPU type, but not the
+# manufacturer.  We pick the logical manufacturer.
+vendor=unknown
+case $basic_machine in
+	*-unknown)
+		case $os in
+			-riscix*)
+				vendor=acorn
+				;;
+			-sunos*)
+				vendor=sun
+				;;
+			-aix*)
+				vendor=ibm
+				;;
+			-beos*)
+				vendor=be
+				;;
+			-hpux*)
+				vendor=hp
+				;;
+			-mpeix*)
+				vendor=hp
+				;;
+			-hiux*)
+				vendor=hitachi
+				;;
+			-unos*)
+				vendor=crds
+				;;
+			-dgux*)
+				vendor=dg
+				;;
+			-luna*)
+				vendor=omron
+				;;
+			-genix*)
+				vendor=ns
+				;;
+			-mvs* | -opened*)
+				vendor=ibm
+				;;
+			-ptx*)
+				vendor=sequent
+				;;
+			-vxsim* | -vxworks* | -windiss*)
+				vendor=wrs
+				;;
+			-aux*)
+				vendor=apple
+				;;
+			-hms*)
+				vendor=hitachi
+				;;
+			-mpw* | -macos*)
+				vendor=apple
+				;;
+			-*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
+				vendor=atari
+				;;
+			-vos*)
+				vendor=stratus
+				;;
+		esac
+		basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"`
+		;;
+esac
+
+echo $basic_machine$os
+exit 0
+
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "timestamp='"
+# time-stamp-format: "%:y-%02m-%02d"
+# time-stamp-end: "'"
+# End:
diff -Naur tomato/release/src/router/snmp/configure tomato121/release/src/router/snmp/configure
--- tomato/release/src/router/snmp/configure	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/configure	2008-04-22 00:36:39.000000000 +1000
@@ -0,0 +1,18299 @@
+#! /bin/sh
+
+# Guess values for system-dependent variables and create Makefiles.
+# Generated automatically using autoconf version 2.13 
+# Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc.
+#
+# This configure script is free software; the Free Software Foundation
+# gives unlimited permission to copy, distribute and modify it.
+
+# Defaults:
+ac_help=
+ac_default_prefix=/usr/local
+# Any additions from configure.in:
+ac_help="$ac_help
+
+Compiler Options:
+  --with-cc=CC                    use CC to compile (default=gcc)."
+ac_help="$ac_help
+  --with-ar=AR                    use AR as the archiver."
+ac_help="$ac_help
+  --with-endianness=big|little    define endianness of target platform when
+                                  cross-compiling."
+ac_help="$ac_help
+  --with-cflags=CFLAGS            use CFLAGS as compile time arguments."
+ac_help="$ac_help
+  --with-ldflags=LDFLAGS          use LDFLAGS as link time arguments to ld."
+ac_help="$ac_help
+  --with-libs=LIBS                use LIBS as link time arguments to ld."
+ac_help="$ac_help
+  --enable-silent-libtool         Pass --silent to libtool."
+ac_help="$ac_help
+  --enable-mini-agent             Build a minimal agent."
+ac_help="$ac_help
+  --enable-ipv6                   Generate IPv6 ready version."
+ac_help="$ac_help
+  --enable-debugging              Outputs extra debugging information at all
+                                  times.  Normally, you should not enable this,
+                                  but instead use the -D flag of the commands,
+                                  which toggles debbuging output at runtime.
+  --disable-debugging             Disallows debugging code to be built in.
+                                  This might provide some speed benefits."
+ac_help="$ac_help
+  --enable-developer              Turns on super-duper-extra-compile-warnings
+                                  when using gcc."
+ac_help="$ac_help
+  --with-dmalloc=PATH             Use dmalloc library (www.dmalloc.com)"
+ac_help="$ac_help
+  --with-efence                   Look for and use libefence (malloc)."
+ac_help="$ac_help
+  --with-rsaref=PATH              Look for librsaref in PATH/lib."
+ac_help="$ac_help
+  --with-openssl=PATH             Look for openssl in PATH/lib."
+ac_help="$ac_help
+  --disable-privacy               Don't compile in support for privacy."
+ac_help="$ac_help
+  --enable-internal-md5           Use the internal MD5 support."
+ac_help="$ac_help
+  --without-opaque-special-types  Don't use special opaque encodings.
+                                  SNMP normally cannot handle
+                                  floating numbers, nor large 64 bit
+                                  integers well.  By default, the
+                                  net-snmp package compiles in
+                                  support for these extra datatypes
+                                  (in a legal way)"
+ac_help="$ac_help
+  --with-mibdirs=\"dir1:dir2:\"     Default directories to look for mibs.
+                                    (Default: \$HOME/.snmp/mibs:DATADIR/snmp/mibs)"
+ac_help="$ac_help
+  --with-mibs=\"item1:item2:\"      Default mib IDs to read.
+                                    (The default list is \"IP-MIB:IF-MIB:
+                                    TCP-MIB:UDP-MIB:SNMPv2-MIB:RFC1213-MIB\"
+                                    with the addition of any mibs used
+                                    by the mib modules the agent is
+                                    configured with)"
+ac_help="$ac_help
+  --with-mibfiles=\"file1:file2\"   Default mib files to load.
+                                    (Default:  none.  uses IDs above instead.)"
+ac_help="$ac_help
+  --enable-testing-code           Enables some code sections that should 
+                                  only be used for testing of certain
+                                  SNMP functionalities.  This should *not* 
+                                  be turned on for production use.  Ever."
+ac_help="$ac_help
+  --enable-reentrant              Enables locking functions that protect
+                                  library resources in some multi-threading
+                                  environments.  This does not guarantee
+                                  thread-safe operation.
+                                  Currently an experimental setting."
+ac_help="$ac_help
+
+Configuring the agent:
+  --without-root-access           The snmpd agent won't require root access to
+                                  run it.  The information it returns in the
+                                  mib-II tree may not be correct, however."
+ac_help="$ac_help
+
+Configuring the agent:
+  --without-kmem-usage            Do not include any code related to the use
+                                  of kmem. This option can only be used with
+                                  the option --enable-mini-agent."
+ac_help="$ac_help
+  --with-dummy-values             Provide 'placeholder' dummy values where
+                                  the necessary information is not available.
+                                  This is technically not compliant with the
+                                  SNMP specifications, but was how the agent
+                                  operated for versions < 4.0."
+ac_help="$ac_help
+  --with-persistent-directory=\"directory\"
+                                  Default directory for persistent data storage."
+ac_help="$ac_help
+  --with-copy-persistent-files=\"no\" Don't copy persistent files
+                                       (or use \"yes\" to copy them).
+                                       (Default: yes)"
+ac_help="$ac_help
+  --with-default-snmp-version=\"3\" Default version of SNMP to use.
+                                  (Default: 3)
+                                  Legal values: 1, 2 (for SNMPv2c) or 3."
+ac_help="$ac_help
+  --with-sys-contact=\"who@where\"  Default system contact.
+                                    (Default: LOGIN@DOMAINNAME)"
+ac_help="$ac_help
+  --with-sys-location=\"location\"  Default system location.
+                                    (Default: Unknown)"
+ac_help="$ac_help
+  --with-logfile=\"location\"       Default log file location for snmpd."
+ac_help="$ac_help
+  --with-transports=\"t1 t2 ...\"   Compile in the given SNMP transport
+                                    modules (space separated list)."
+ac_help="$ac_help
+  --with-out-transports=\"t1 ...\"  Exclude listed SNMP transports
+                                    (space separated list).
+
+  Available SNMP transport modules are:
+
+    UDP         support for SNMP over UDP/IP.
+                This transport is always compiled in.
+    UDPIPv6     support for SNMP over UDP/IPv6.
+                This transport is available for Linux, Solaris and
+                FreeBSD.
+                It is never compiled in by default.
+    TCPIPv6     support for SNMP over UDP/IPv6.
+                This transport is available for Linux, Solaris and
+                FreeBSD.
+                It is never compiled in by default.
+    TCP         support for SNMP over TCP/IP.
+                This transport is compiled in by default, but may be omitted.
+    Unix        support for SNMP over Unix domain protocols.
+                This transport is compiled in by default except on Win32
+                platforms, and may be omitted.
+    Callback    support for SNMP over an internal locally connected pair
+                of snmp_sessions.
+    AAL5PVC     support for SNMP over AAL5 PVCs.
+                This transport is presently only available for Linux,
+                is never compiled in by default and may be omitted.
+    IPX         support for SNMP over IPX per RFC 1420.
+                This transport is presently only available for Linux,
+                is never compiled in by default and may be omitted.
+"
+ac_help="$ac_help
+"
+ac_help="$ac_help
+"
+ac_help="$ac_help
+  --with-security-modules=\"s1 s2 ...\"   Compile in the given SNMP security
+                                    module services (space separated list).
+
+  Available SNMP security services:
+
+        usm                support for user based SNMP security
+                           (required and always compiled in)
+        ksm                support for kerberos based SNMP security
+"
+ac_help="$ac_help
+  --with-mib-modules=\"item1 ...\"  Compile with additional mib modules
+                                    (Space separated list)."
+ac_help="$ac_help
+  --with-out-mib-modules=\"list\"   Compile without these mib modules.
+
+  Default mib modules compiled into the agent (which can be removed):
+  
+    mibII                  support for the mib-II tree.
+    snmpv3mibs             support for the snmpv3 mib modules.
+    ucd_snmp               UCD-SNMP-MIB specific extensions.
+    agent_mibs             NET-SNMP-AGENT-MIB extensions
+    agentx                 (see below)
+    notification           mibs supporting specification of trap destinations.
+    target                 Support for the SNMP WGs TARGET-MIB.
+    utilities              general agent configuration utilities.
+
+  Optional mib modules that can be built into the agent include:
+    host                   host resources mib support.
+                             (beta level code for linux, hpux, solaris, bsdi)
+    disman/event-mib       support for the DISMAN-EVENT-MIB (beta)
+                             (supports self monitoring and notification 
+                              delivery when error conditions are found)
+    smux                   smux support to allow subagents to attach to snmpd.
+    mibII/mta_sendmail     Sendmail statistics monitoring (MTA-MIB)
+    misc/ipfwacc           accounting rules IP firewall information (linux).
+    ipfwchains/ipfwchains  firewall chains under ipfw for linux.
+                           (Download separately from the ucd-snmp ftp site.)
+    ucd-snmp/diskio        Table of io-devices and how much data they have
+                           read/written.  (only tested on Solaris)
+    tunnel                 Linux TUNNEL-MIB support (ifTable extension)
+
+  AgentX support:  (warning: beta code)
+    agentx/subagent        allows the agent to run as either a snmp agent
+                           or as an agentX sub-agent.
+    agentx/master          makes the agent run as an agentX master agent
+                           as well as a normal snmp agent.
+    agentx                 includes both agentx/master and agentx/client.
+
+  Optional modules for C coders to look at and/or include as extension examples:
+  
+    examples/ucdDemoPublic  SNMPv3 interoperability testing mib.
+    examples/example        example C code extension."
+ac_help="$ac_help
+Enterprise OIDs:  (warning: this should be used with caution.)
+
+  --with-enterprise-oid              The enterprise number assigned to the
+                                     vendor by IANA.  See
+                                     http://www.iana.org/cgi-bin/enterprise.pl
+                                     to get one, though using the default is
+                                     probably the right choice is most cases.
+                                     (default 8072 = "enterprise.net-snmp")"
+ac_help="$ac_help
+
+  --with-enterprise-sysoid           The base OID for the sysObjectID
+                                     of the system group
+                                     (default .1.3.6.1.4.1.8072.3.2... = 
+                                      "netSnmpAgentOIDs...")"
+ac_help="$ac_help
+
+  --with-enterprise-notification-oid The OID used for the root of
+				     enterprise specific notifications.
+                                     (default .1.3.6.1.4.1.2021 = "enterprise.ucdavis")"
+ac_help="$ac_help
+"
+ac_help="$ac_help
+"
+ac_help="$ac_help
+
+Perl:
+  --with-perl-modules[=ARGS]      Install the perl modules along with the rest
+                                  of the net-snmp toolkit.  If ARGS is
+                                  specified, they're passed to the
+                                  Makefile.PL script."
+ac_help="$ac_help
+
+  --enable-embedded-perl          Embed perl in the SNMP agent.
+                                  [forces --with-perl-modules as well.]"
+ac_help="$ac_help
+
+Miscellaneous:
+  --with-defaults          Use defaults for prompted values."
+ac_help="$ac_help
+--enable-ucd-snmp-compatibility  Install ucd-snmp look-alike headers and libs."
+ac_help="$ac_help
+  --enable-shared[=PKGS]  build shared libraries [default=yes]"
+ac_help="$ac_help
+  --enable-static[=PKGS]  build static libraries [default=yes]"
+ac_help="$ac_help
+  --enable-fast-install[=PKGS]  optimize for fast installation [default=yes]"
+ac_help="$ac_help
+  --with-gnu-ld           assume the C compiler uses GNU ld [default=no]"
+
+# Find the correct PATH separator.  Usually this is `:', but
+# DJGPP uses `;' like DOS.
+if test "X${PATH_SEPARATOR+set}" != Xset; then
+  UNAME=${UNAME-`uname 2>/dev/null`}
+  case X$UNAME in
+    *-DOS) lt_cv_sys_path_separator=';' ;;
+    *)     lt_cv_sys_path_separator=':' ;;
+  esac
+  PATH_SEPARATOR=$lt_cv_sys_path_separator
+fi
+
+
+# Check that we are running under the correct shell.
+SHELL=${CONFIG_SHELL-/bin/sh}
+
+case X$ECHO in
+X*--fallback-echo)
+  # Remove one level of quotation (which was required for Make).
+  ECHO=`echo "$ECHO" | sed 's,\\\\\$\\$0,'$0','`
+  ;;
+esac
+
+echo=${ECHO-echo}
+if test "X$1" = X--no-reexec; then
+  # Discard the --no-reexec flag, and continue.
+  shift
+elif test "X$1" = X--fallback-echo; then
+  # Avoid inline document here, it may be left over
+  :
+elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then
+  # Yippee, $echo works!
+  :
+else
+  # Restart under the correct shell.
+  exec $SHELL "$0" --no-reexec ${1+"$@"}
+fi
+
+if test "X$1" = X--fallback-echo; then
+  # used as fallback echo
+  shift
+  cat <<EOF
+
+EOF
+  exit 0
+fi
+
+# The HP-UX ksh and POSIX shell print the target directory to stdout
+# if CDPATH is set.
+if test "X${CDPATH+set}" = Xset; then CDPATH=:; export CDPATH; fi
+
+if test -z "$ECHO"; then
+if test "X${echo_test_string+set}" != Xset; then
+# find a string as large as possible, as long as the shell can cope with it
+  for cmd in 'sed 50q "$0"' 'sed 20q "$0"' 'sed 10q "$0"' 'sed 2q "$0"' 'echo test'; do
+    # expected sizes: less than 2Kb, 1Kb, 512 bytes, 16 bytes, ...
+    if (echo_test_string="`eval $cmd`") 2>/dev/null &&
+       echo_test_string="`eval $cmd`" &&
+       (test "X$echo_test_string" = "X$echo_test_string") 2>/dev/null
+    then
+      break
+    fi
+  done
+fi
+
+if test "X`($echo '\t') 2>/dev/null`" = 'X\t' &&
+   echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` &&
+   test "X$echo_testing_string" = "X$echo_test_string"; then
+  :
+else
+  # The Solaris, AIX, and Digital Unix default echo programs unquote
+  # backslashes.  This makes it impossible to quote backslashes using
+  #   echo "$something" | sed 's/\\/\\\\/g'
+  #
+  # So, first we look for a working echo in the user's PATH.
+
+  IFS="${IFS= 	}"; save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+  for dir in $PATH /usr/ucb; do
+    if (test -f $dir/echo || test -f $dir/echo$ac_exeext) &&
+       test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' &&
+       echo_testing_string=`($dir/echo "$echo_test_string") 2>/dev/null` &&
+       test "X$echo_testing_string" = "X$echo_test_string"; then
+      echo="$dir/echo"
+      break
+    fi
+  done
+  IFS="$save_ifs"
+
+  if test "X$echo" = Xecho; then
+    # We didn't find a better echo, so look for alternatives.
+    if test "X`(print -r '\t') 2>/dev/null`" = 'X\t' &&
+       echo_testing_string=`(print -r "$echo_test_string") 2>/dev/null` &&
+       test "X$echo_testing_string" = "X$echo_test_string"; then
+      # This shell has a builtin print -r that does the trick.
+      echo='print -r'
+    elif (test -f /bin/ksh || test -f /bin/ksh$ac_exeext) &&
+	 test "X$CONFIG_SHELL" != X/bin/ksh; then
+      # If we have ksh, try running configure again with it.
+      ORIGINAL_CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
+      export ORIGINAL_CONFIG_SHELL
+      CONFIG_SHELL=/bin/ksh
+      export CONFIG_SHELL
+      exec $CONFIG_SHELL "$0" --no-reexec ${1+"$@"}
+    else
+      # Try using printf.
+      echo='printf %s\n'
+      if test "X`($echo '\t') 2>/dev/null`" = 'X\t' &&
+	 echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` &&
+	 test "X$echo_testing_string" = "X$echo_test_string"; then
+	# Cool, printf works
+	:
+      elif echo_testing_string=`($ORIGINAL_CONFIG_SHELL "$0" --fallback-echo '\t') 2>/dev/null` &&
+	   test "X$echo_testing_string" = 'X\t' &&
+	   echo_testing_string=`($ORIGINAL_CONFIG_SHELL "$0" --fallback-echo "$echo_test_string") 2>/dev/null` &&
+	   test "X$echo_testing_string" = "X$echo_test_string"; then
+	CONFIG_SHELL=$ORIGINAL_CONFIG_SHELL
+	export CONFIG_SHELL
+	SHELL="$CONFIG_SHELL"
+	export SHELL
+	echo="$CONFIG_SHELL $0 --fallback-echo"
+      elif echo_testing_string=`($CONFIG_SHELL "$0" --fallback-echo '\t') 2>/dev/null` &&
+	   test "X$echo_testing_string" = 'X\t' &&
+	   echo_testing_string=`($CONFIG_SHELL "$0" --fallback-echo "$echo_test_string") 2>/dev/null` &&
+	   test "X$echo_testing_string" = "X$echo_test_string"; then
+	echo="$CONFIG_SHELL $0 --fallback-echo"
+      else
+	# maybe with a smaller string...
+	prev=:
+
+	for cmd in 'echo test' 'sed 2q "$0"' 'sed 10q "$0"' 'sed 20q "$0"' 'sed 50q "$0"'; do
+	  if (test "X$echo_test_string" = "X`eval $cmd`") 2>/dev/null
+	  then
+	    break
+	  fi
+	  prev="$cmd"
+	done
+
+	if test "$prev" != 'sed 50q "$0"'; then
+	  echo_test_string=`eval $prev`
+	  export echo_test_string
+	  exec ${ORIGINAL_CONFIG_SHELL-${CONFIG_SHELL-/bin/sh}} "$0" ${1+"$@"}
+	else
+	  # Oops.  We lost completely, so just stick with echo.
+	  echo=echo
+	fi
+      fi
+    fi
+  fi
+fi
+fi
+
+# Copy echo and quote the copy suitably for passing to libtool from
+# the Makefile, instead of quoting the original, which is used later.
+ECHO=$echo
+if test "X$ECHO" = "X$CONFIG_SHELL $0 --fallback-echo"; then
+   ECHO="$CONFIG_SHELL \\\$\$0 --fallback-echo"
+fi
+
+
+ac_help="$ac_help
+  --disable-libtool-lock  avoid locking (might break parallel builds)"
+ac_help="$ac_help
+  --with-pic              try to use only PIC/non-PIC objects [default=use both]"
+ac_help="$ac_help
+  --with-libwrap[=LIBPATH] Compile in libwrap (tcp_wrappers) support."
+ac_help="$ac_help
+  --with-zlib[=DIR]        use libz in DIR"
+
+# Initialize some variables set by options.
+# The variables have the same names as the options, with
+# dashes changed to underlines.
+build=NONE
+cache_file=./config.cache
+exec_prefix=NONE
+host=NONE
+no_create=
+nonopt=NONE
+no_recursion=
+prefix=NONE
+program_prefix=NONE
+program_suffix=NONE
+program_transform_name=s,x,x,
+silent=
+site=
+srcdir=
+target=NONE
+verbose=
+x_includes=NONE
+x_libraries=NONE
+bindir='${exec_prefix}/bin'
+sbindir='${exec_prefix}/sbin'
+libexecdir='${exec_prefix}/libexec'
+datadir='${prefix}/share'
+sysconfdir='${prefix}/etc'
+sharedstatedir='${prefix}/com'
+localstatedir='${prefix}/var'
+libdir='${exec_prefix}/lib'
+includedir='${prefix}/include'
+oldincludedir='/usr/include'
+infodir='${prefix}/info'
+mandir='${prefix}/man'
+
+# Initialize some other variables.
+subdirs=
+MFLAGS= MAKEFLAGS=
+SHELL=${CONFIG_SHELL-/bin/sh}
+# Maximum number of lines to put in a shell here document.
+ac_max_here_lines=12
+
+ac_prev=
+for ac_option
+do
+
+  # If the previous option needs an argument, assign it.
+  if test -n "$ac_prev"; then
+    eval "$ac_prev=\$ac_option"
+    ac_prev=
+    continue
+  fi
+
+  case "$ac_option" in
+  -*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
+  *) ac_optarg= ;;
+  esac
+
+  # Accept the important Cygnus configure options, so we can diagnose typos.
+
+  case "$ac_option" in
+
+  -bindir | --bindir | --bindi | --bind | --bin | --bi)
+    ac_prev=bindir ;;
+  -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*)
+    bindir="$ac_optarg" ;;
+
+  -build | --build | --buil | --bui | --bu)
+    ac_prev=build ;;
+  -build=* | --build=* | --buil=* | --bui=* | --bu=*)
+    build="$ac_optarg" ;;
+
+  -cache-file | --cache-file | --cache-fil | --cache-fi \
+  | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c)
+    ac_prev=cache_file ;;
+  -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \
+  | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*)
+    cache_file="$ac_optarg" ;;
+
+  -datadir | --datadir | --datadi | --datad | --data | --dat | --da)
+    ac_prev=datadir ;;
+  -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \
+  | --da=*)
+    datadir="$ac_optarg" ;;
+
+  -disable-* | --disable-*)
+    ac_feature=`echo $ac_option|sed -e 's/-*disable-//'`
+    # Reject names that are not valid shell variable names.
+    if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then
+      { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; }
+    fi
+    ac_feature=`echo $ac_feature| sed 's/-/_/g'`
+    eval "enable_${ac_feature}=no" ;;
+
+  -enable-* | --enable-*)
+    ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'`
+    # Reject names that are not valid shell variable names.
+    if test -n "`echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then
+      { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; }
+    fi
+    ac_feature=`echo $ac_feature| sed 's/-/_/g'`
+    case "$ac_option" in
+      *=*) ;;
+      *) ac_optarg=yes ;;
+    esac
+    eval "enable_${ac_feature}='$ac_optarg'" ;;
+
+  -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \
+  | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \
+  | --exec | --exe | --ex)
+    ac_prev=exec_prefix ;;
+  -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \
+  | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \
+  | --exec=* | --exe=* | --ex=*)
+    exec_prefix="$ac_optarg" ;;
+
+  -gas | --gas | --ga | --g)
+    # Obsolete; use --with-gas.
+    with_gas=yes ;;
+
+  -help | --help | --hel | --he)
+    # Omit some internal or obsolete options to make the list less imposing.
+    # This message is too long to be a string in the A/UX 3.1 sh.
+    cat << EOF
+Usage: configure [options] [host]
+Options: [defaults in brackets after descriptions]
+Configuration:
+  --cache-file=FILE       cache test results in FILE
+  --help                  print this message
+  --no-create             do not create output files
+  --quiet, --silent       do not print \`checking...' messages
+  --version               print the version of autoconf that created configure
+Directory and file names:
+  --prefix=PREFIX         install architecture-independent files in PREFIX
+                          [$ac_default_prefix]
+  --exec-prefix=EPREFIX   install architecture-dependent files in EPREFIX
+                          [same as prefix]
+  --bindir=DIR            user executables in DIR [EPREFIX/bin]
+  --sbindir=DIR           system admin executables in DIR [EPREFIX/sbin]
+  --libexecdir=DIR        program executables in DIR [EPREFIX/libexec]
+  --datadir=DIR           read-only architecture-independent data in DIR
+                          [PREFIX/share]
+  --sysconfdir=DIR        read-only single-machine data in DIR [PREFIX/etc]
+  --sharedstatedir=DIR    modifiable architecture-independent data in DIR
+                          [PREFIX/com]
+  --localstatedir=DIR     modifiable single-machine data in DIR [PREFIX/var]
+  --libdir=DIR            object code libraries in DIR [EPREFIX/lib]
+  --includedir=DIR        C header files in DIR [PREFIX/include]
+  --oldincludedir=DIR     C header files for non-gcc in DIR [/usr/include]
+  --infodir=DIR           info documentation in DIR [PREFIX/info]
+  --mandir=DIR            man documentation in DIR [PREFIX/man]
+  --srcdir=DIR            find the sources in DIR [configure dir or ..]
+  --program-prefix=PREFIX prepend PREFIX to installed program names
+  --program-suffix=SUFFIX append SUFFIX to installed program names
+  --program-transform-name=PROGRAM
+                          run sed PROGRAM on installed program names
+EOF
+    cat << EOF
+Host type:
+  --build=BUILD           configure for building on BUILD [BUILD=HOST]
+  --host=HOST             configure for HOST [guessed]
+  --target=TARGET         configure for TARGET [TARGET=HOST]
+Features and packages:
+  --disable-FEATURE       do not include FEATURE (same as --enable-FEATURE=no)
+  --enable-FEATURE[=ARG]  include FEATURE [ARG=yes]
+  --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
+  --without-PACKAGE       do not use PACKAGE (same as --with-PACKAGE=no)
+  --x-includes=DIR        X include files are in DIR
+  --x-libraries=DIR       X library files are in DIR
+EOF
+    if test -n "$ac_help"; then
+      echo "--enable and --with options recognized:$ac_help"
+    fi
+    exit 0 ;;
+
+  -host | --host | --hos | --ho)
+    ac_prev=host ;;
+  -host=* | --host=* | --hos=* | --ho=*)
+    host="$ac_optarg" ;;
+
+  -includedir | --includedir | --includedi | --included | --include \
+  | --includ | --inclu | --incl | --inc)
+    ac_prev=includedir ;;
+  -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \
+  | --includ=* | --inclu=* | --incl=* | --inc=*)
+    includedir="$ac_optarg" ;;
+
+  -infodir | --infodir | --infodi | --infod | --info | --inf)
+    ac_prev=infodir ;;
+  -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*)
+    infodir="$ac_optarg" ;;
+
+  -libdir | --libdir | --libdi | --libd)
+    ac_prev=libdir ;;
+  -libdir=* | --libdir=* | --libdi=* | --libd=*)
+    libdir="$ac_optarg" ;;
+
+  -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \
+  | --libexe | --libex | --libe)
+    ac_prev=libexecdir ;;
+  -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \
+  | --libexe=* | --libex=* | --libe=*)
+    libexecdir="$ac_optarg" ;;
+
+  -localstatedir | --localstatedir | --localstatedi | --localstated \
+  | --localstate | --localstat | --localsta | --localst \
+  | --locals | --local | --loca | --loc | --lo)
+    ac_prev=localstatedir ;;
+  -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \
+  | --localstate=* | --localstat=* | --localsta=* | --localst=* \
+  | --locals=* | --local=* | --loca=* | --loc=* | --lo=*)
+    localstatedir="$ac_optarg" ;;
+
+  -mandir | --mandir | --mandi | --mand | --man | --ma | --m)
+    ac_prev=mandir ;;
+  -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*)
+    mandir="$ac_optarg" ;;
+
+  -nfp | --nfp | --nf)
+    # Obsolete; use --without-fp.
+    with_fp=no ;;
+
+  -no-create | --no-create | --no-creat | --no-crea | --no-cre \
+  | --no-cr | --no-c)
+    no_create=yes ;;
+
+  -no-recursion | --no-recursion | --no-recursio | --no-recursi \
+  | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r)
+    no_recursion=yes ;;
+
+  -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \
+  | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \
+  | --oldin | --oldi | --old | --ol | --o)
+    ac_prev=oldincludedir ;;
+  -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \
+  | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \
+  | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*)
+    oldincludedir="$ac_optarg" ;;
+
+  -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
+    ac_prev=prefix ;;
+  -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
+    prefix="$ac_optarg" ;;
+
+  -program-prefix | --program-prefix | --program-prefi | --program-pref \
+  | --program-pre | --program-pr | --program-p)
+    ac_prev=program_prefix ;;
+  -program-prefix=* | --program-prefix=* | --program-prefi=* \
+  | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*)
+    program_prefix="$ac_optarg" ;;
+
+  -program-suffix | --program-suffix | --program-suffi | --program-suff \
+  | --program-suf | --program-su | --program-s)
+    ac_prev=program_suffix ;;
+  -program-suffix=* | --program-suffix=* | --program-suffi=* \
+  | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*)
+    program_suffix="$ac_optarg" ;;
+
+  -program-transform-name | --program-transform-name \
+  | --program-transform-nam | --program-transform-na \
+  | --program-transform-n | --program-transform- \
+  | --program-transform | --program-transfor \
+  | --program-transfo | --program-transf \
+  | --program-trans | --program-tran \
+  | --progr-tra | --program-tr | --program-t)
+    ac_prev=program_transform_name ;;
+  -program-transform-name=* | --program-transform-name=* \
+  | --program-transform-nam=* | --program-transform-na=* \
+  | --program-transform-n=* | --program-transform-=* \
+  | --program-transform=* | --program-transfor=* \
+  | --program-transfo=* | --program-transf=* \
+  | --program-trans=* | --program-tran=* \
+  | --progr-tra=* | --program-tr=* | --program-t=*)
+    program_transform_name="$ac_optarg" ;;
+
+  -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+  | -silent | --silent | --silen | --sile | --sil)
+    silent=yes ;;
+
+  -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
+    ac_prev=sbindir ;;
+  -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
+  | --sbi=* | --sb=*)
+    sbindir="$ac_optarg" ;;
+
+  -sharedstatedir | --sharedstatedir | --sharedstatedi \
+  | --sharedstated | --sharedstate | --sharedstat | --sharedsta \
+  | --sharedst | --shareds | --shared | --share | --shar \
+  | --sha | --sh)
+    ac_prev=sharedstatedir ;;
+  -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \
+  | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \
+  | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \
+  | --sha=* | --sh=*)
+    sharedstatedir="$ac_optarg" ;;
+
+  -site | --site | --sit)
+    ac_prev=site ;;
+  -site=* | --site=* | --sit=*)
+    site="$ac_optarg" ;;
+
+  -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
+    ac_prev=srcdir ;;
+  -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
+    srcdir="$ac_optarg" ;;
+
+  -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \
+  | --syscon | --sysco | --sysc | --sys | --sy)
+    ac_prev=sysconfdir ;;
+  -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \
+  | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*)
+    sysconfdir="$ac_optarg" ;;
+
+  -target | --target | --targe | --targ | --tar | --ta | --t)
+    ac_prev=target ;;
+  -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)
+    target="$ac_optarg" ;;
+
+  -v | -verbose | --verbose | --verbos | --verbo | --verb)
+    verbose=yes ;;
+
+  -version | --version | --versio | --versi | --vers)
+    echo "configure generated by autoconf version 2.13"
+    exit 0 ;;
+
+  -with-* | --with-*)
+    ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'`
+    # Reject names that are not valid shell variable names.
+    if test -n "`echo $ac_package| sed 's/[-_a-zA-Z0-9]//g'`"; then
+      { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; }
+    fi
+    ac_package=`echo $ac_package| sed 's/-/_/g'`
+    case "$ac_option" in
+      *=*) ;;
+      *) ac_optarg=yes ;;
+    esac
+    eval "with_${ac_package}='$ac_optarg'" ;;
+
+  -without-* | --without-*)
+    ac_package=`echo $ac_option|sed -e 's/-*without-//'`
+    # Reject names that are not valid shell variable names.
+    if test -n "`echo $ac_package| sed 's/[-a-zA-Z0-9_]//g'`"; then
+      { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; }
+    fi
+    ac_package=`echo $ac_package| sed 's/-/_/g'`
+    eval "with_${ac_package}=no" ;;
+
+  --x)
+    # Obsolete; use --with-x.
+    with_x=yes ;;
+
+  -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \
+  | --x-incl | --x-inc | --x-in | --x-i)
+    ac_prev=x_includes ;;
+  -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \
+  | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*)
+    x_includes="$ac_optarg" ;;
+
+  -x-libraries | --x-libraries | --x-librarie | --x-librari \
+  | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l)
+    ac_prev=x_libraries ;;
+  -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \
+  | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*)
+    x_libraries="$ac_optarg" ;;
+
+  -*) { echo "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; }
+    ;;
+
+  *)
+    if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then
+      echo "configure: warning: $ac_option: invalid host type" 1>&2
+    fi
+    if test "x$nonopt" != xNONE; then
+      { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; }
+    fi
+    nonopt="$ac_option"
+    ;;
+
+  esac
+done
+
+if test -n "$ac_prev"; then
+  { echo "configure: error: missing argument to --`echo $ac_prev | sed 's/_/-/g'`" 1>&2; exit 1; }
+fi
+
+trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15
+
+# File descriptor usage:
+# 0 standard input
+# 1 file creation
+# 2 errors and warnings
+# 3 some systems may open it to /dev/tty
+# 4 used on the Kubota Titan
+# 6 checking for... messages and results
+# 5 compiler messages saved in config.log
+if test "$silent" = yes; then
+  exec 6>/dev/null
+else
+  exec 6>&1
+fi
+exec 5>./config.log
+
+echo "\
+This file contains any messages produced by compilers while
+running configure, to aid debugging if configure makes a mistake.
+" 1>&5
+
+# Strip out --no-create and --no-recursion so they do not pile up.
+# Also quote any args containing shell metacharacters.
+ac_configure_args=
+for ac_arg
+do
+  case "$ac_arg" in
+  -no-create | --no-create | --no-creat | --no-crea | --no-cre \
+  | --no-cr | --no-c) ;;
+  -no-recursion | --no-recursion | --no-recursio | --no-recursi \
+  | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;;
+  *" "*|*"	"*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*)
+  ac_configure_args="$ac_configure_args '$ac_arg'" ;;
+  *) ac_configure_args="$ac_configure_args $ac_arg" ;;
+  esac
+done
+
+# NLS nuisances.
+# Only set these to C if already set.  These must not be set unconditionally
+# because not all systems understand e.g. LANG=C (notably SCO).
+# Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'!
+# Non-C LC_CTYPE values break the ctype check.
+if test "${LANG+set}"   = set; then LANG=C;   export LANG;   fi
+if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi
+if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi
+if test "${LC_CTYPE+set}"    = set; then LC_CTYPE=C;    export LC_CTYPE;    fi
+
+# confdefs.h avoids OS command line length limits that DEFS can exceed.
+rm -rf conftest* confdefs.h
+# AIX cpp loses on an empty file, so make sure it contains at least a newline.
+echo > confdefs.h
+
+# A filename unique to this package, relative to the directory that
+# configure is in, which we can look for to find out if srcdir is correct.
+ac_unique_file=agent/mibgroup/ucd-snmp/extensible.c
+
+# Find the source files, if location was not specified.
+if test -z "$srcdir"; then
+  ac_srcdir_defaulted=yes
+  # Try the directory containing this script, then its parent.
+  ac_prog=$0
+  ac_confdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'`
+  test "x$ac_confdir" = "x$ac_prog" && ac_confdir=.
+  srcdir=$ac_confdir
+  if test ! -r $srcdir/$ac_unique_file; then
+    srcdir=..
+  fi
+else
+  ac_srcdir_defaulted=no
+fi
+if test ! -r $srcdir/$ac_unique_file; then
+  if test "$ac_srcdir_defaulted" = yes; then
+    { echo "configure: error: can not find sources in $ac_confdir or .." 1>&2; exit 1; }
+  else
+    { echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; }
+  fi
+fi
+srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'`
+
+# Prefer explicitly selected file to automatically selected ones.
+if test -z "$CONFIG_SITE"; then
+  if test "x$prefix" != xNONE; then
+    CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site"
+  else
+    CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site"
+  fi
+fi
+for ac_site_file in $CONFIG_SITE; do
+  if test -r "$ac_site_file"; then
+    echo "loading site script $ac_site_file"
+    . "$ac_site_file"
+  fi
+done
+
+if test -r "$cache_file"; then
+  echo "loading cache $cache_file"
+  . $cache_file
+else
+  echo "creating cache $cache_file"
+  > $cache_file
+fi
+
+ac_ext=c
+# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
+ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
+cross_compiling=$ac_cv_prog_cc_cross
+
+ac_exeext=
+ac_objext=o
+if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then
+  # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu.
+  if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then
+    ac_n= ac_c='
+' ac_t='	'
+  else
+    ac_n=-n ac_c= ac_t=
+  fi
+else
+  ac_n= ac_c='\c' ac_t=
+fi
+
+
+
+
+  rm -f configure-summary
+
+
+cat >> confdefs.h <<EOF
+#define CONFIGURE_OPTIONS "\"$ac_configure_args\""
+EOF
+
+CONFIGURE_OPTIONS="\"$ac_configure_args\""
+
+
+# Check whether --with-cc or --without-cc was given.
+if test "${with_cc+set}" = set; then
+  withval="$with_cc"
+  CC=$with_cc;export CC
+fi
+
+
+# Check whether --with-ar or --without-ar was given.
+if test "${with_ar+set}" = set; then
+  withval="$with_ar"
+  AR=$with_ar; export AR
+fi
+
+
+# Check whether --with-endianness or --without-endianness was given.
+if test "${with_endianness+set}" = set; then
+  withval="$with_endianness"
+  if test $with_endianness != "big" -a $with_endianness != "little" ; then
+       { echo "configure: error: Endianness must be big or little, not \"$with_endianness\"." 1>&2; exit 1; };
+     fi
+
+fi
+
+
+# Check whether --with-cflags or --without-cflags was given.
+if test "${with_cflags+set}" = set; then
+  withval="$with_cflags"
+  CFLAGS=$with_cflags; export CFLAGS
+fi
+
+
+# Check whether --with-ldflags or --without-ldflags was given.
+if test "${with_ldflags+set}" = set; then
+  withval="$with_ldflags"
+  LDFLAGS=$with_ldflags; export LDFLAGS
+fi
+
+
+# Check whether --with-libs or --without-libs was given.
+if test "${with_libs+set}" = set; then
+  withval="$with_libs"
+  LIBS=$with_libs; export LIBS
+fi
+
+
+# Check whether --enable-silent-libtool or --disable-silent-libtool was given.
+if test "${enable_silent_libtool+set}" = set; then
+  enableval="$enable_silent_libtool"
+  LIBTOOLFLAGS=--silent
+fi
+
+
+
+# Check whether --enable-mini_agent or --disable-mini_agent was given.
+if test "${enable_mini_agent+set}" = set; then
+  enableval="$enable_mini_agent"
+  mini_agent="yes"
+else
+  mini_agent="no"
+fi
+
+
+# Check whether --enable-ipv6 or --disable-ipv6 was given.
+if test "${enable_ipv6+set}" = set; then
+  enableval="$enable_ipv6"
+  if test "x$enable_ipv6" = "xyes"; then
+      cat >> confdefs.h <<\EOF
+#define INET6 1
+EOF
+
+    fi
+fi
+
+
+# Check whether --enable-debugging or --disable-debugging was given.
+if test "${enable_debugging+set}" = set; then
+  enableval="$enable_debugging"
+  cat >> confdefs.h <<\EOF
+#define SNMP_ALWAYS_DEBUG 1
+EOF
+
+fi
+
+
+# Check whether --enable-developer or --disable-developer was given.
+if test "${enable_developer+set}" = set; then
+  enableval="$enable_developer"
+  developer=yes
+fi
+
+
+if test "x$enable_debugging" = "xno"; then
+    cat >> confdefs.h <<\EOF
+#define SNMP_NO_DEBUGGING 1
+EOF
+
+fi
+
+# Check whether --with-dmalloc or --without-dmalloc was given.
+if test "${with_dmalloc+set}" = set; then
+  withval="$with_dmalloc"
+  if test "x$withval" = "xyes"; then
+      LIBS="$LIBS -ldmalloc"
+      cat >> confdefs.h <<\EOF
+#define HAVE_DMALLOC_H 1
+EOF
+
+    elif test -d "$withval"; then
+      
+  if test "x$withval" != x -a -d $withval; then
+     if test -d $withval/lib; then
+       LDFLAGS="-L$withval/lib $LDFLAGS"
+     fi
+     if test -d $withval/include; then
+	CPPFLAGS="-I$withval/include $CPPFLAGS"
+     fi
+  fi
+
+      LIBS="$LIBS -ldmalloc"
+      cat >> confdefs.h <<\EOF
+#define HAVE_DMALLOC_H 1
+EOF
+
+    fi
+
+fi
+
+
+
+# Check whether --with-efence or --without-efence was given.
+if test "${with_efence+set}" = set; then
+  withval="$with_efence"
+  use_efence="$withval"
+fi
+
+
+tryrsaref=no
+# Check whether --with-rsaref or --without-rsaref was given.
+if test "${with_rsaref+set}" = set; then
+  withval="$with_rsaref"
+  if test "x$withval" = "xyes"; then
+      tryrsaref=yes
+    elif test "x$withval" = "xno"; then
+      tryrsaref=no
+    elif test -d "$withval"; then
+      
+  if test "x$withval" != x -a -d $withval; then
+     if test -d $withval/lib; then
+       LDFLAGS="-L$withval/lib $LDFLAGS"
+     fi
+     if test -d $withval/include; then
+	CPPFLAGS="-I$withval/include $CPPFLAGS"
+     fi
+  fi
+
+      tryrsaref=yes
+    fi
+fi
+
+
+tryopenssl=defaultyes
+askedopenssl=no
+# Check whether --with-openssl or --without-openssl was given.
+if test "${with_openssl+set}" = set; then
+  withval="$with_openssl"
+  if test "x$withval" = "xyes"; then
+      tryopenssl=yes
+      askedopenssl=yes
+    elif test "x$withval" = "xno"; then
+      tryopenssl=no
+    elif test -d "$withval"; then
+      
+  if test "x$withval" != x -a -d $withval; then
+     if test -d $withval/lib; then
+       LDFLAGS="-L$withval/lib $LDFLAGS"
+     fi
+     if test -d $withval/include; then
+	CPPFLAGS="-I$withval/include $CPPFLAGS"
+     fi
+  fi
+
+      tryopenssl=yes
+      askedopenssl=yes
+    fi
+fi
+
+if test "x$tryopenssl" = "xdefaultyes"; then
+      
+  if test "x/usr/local/ssl" != x -a -d /usr/local/ssl; then
+     if test -d /usr/local/ssl/lib; then
+       LDFLAGS="-L/usr/local/ssl/lib $LDFLAGS"
+     fi
+     if test -d /usr/local/ssl/include; then
+	CPPFLAGS="-I/usr/local/ssl/include $CPPFLAGS"
+     fi
+  fi
+
+      tryopenssl=yes
+fi
+
+
+# Check whether --enable-privacy or --disable-privacy was given.
+if test "${enable_privacy+set}" = set; then
+  enableval="$enable_privacy"
+  :
+fi
+
+if test "x$enable_privacy" != "xno"; then
+  cat >> confdefs.h <<\EOF
+#define SCAPI_AUTHPRIV 1
+EOF
+
+fi
+
+# Check whether --enable-internal-md5 or --disable-internal-md5 was given.
+if test "${enable_internal_md5+set}" = set; then
+  enableval="$enable_internal_md5"
+  cat >> confdefs.h <<\EOF
+#define USE_INTERNAL_MD5 1
+EOF
+
+fi
+
+
+
+# Check whether --with-opaque-special-types or --without-opaque-special-types was given.
+if test "${with_opaque_special_types+set}" = set; then
+  withval="$with_opaque_special_types"
+  :
+fi
+
+
+# Check whether --with-mibdirs or --without-mibdirs was given.
+if test "${with_mibdirs+set}" = set; then
+  withval="$with_mibdirs"
+  DEFAULT_MIBDIRS="$with_mibdirs"
+    cat >> confdefs.h <<EOF
+#define DEFAULT_MIBDIRS "$with_mibdirs"
+EOF
+
+fi
+
+
+# Check whether --with-mibs or --without-mibs was given.
+if test "${with_mibs+set}" = set; then
+  withval="$with_mibs"
+  DEFAULT_MIBS="$with_mibs"
+fi
+
+
+# Check whether --with-mibfiles or --without-mibfiles was given.
+if test "${with_mibfiles+set}" = set; then
+  withval="$with_mibfiles"
+  cat >> confdefs.h <<EOF
+#define DEFAULT_MIBFILES "$with_mibfiles"
+EOF
+
+fi
+
+
+
+# Check whether --enable-testing-code or --disable-testing-code was given.
+if test "${enable_testing_code+set}" = set; then
+  enableval="$enable_testing_code"
+  cat >> confdefs.h <<\EOF
+#define SNMP_TESTING_CODE 1
+EOF
+
+fi
+
+
+# Check whether --enable-reentrant or --disable-reentrant was given.
+if test "${enable_reentrant+set}" = set; then
+  enableval="$enable_reentrant"
+  with_res_locks="yes"
+else
+  with_res_locks="no"
+fi
+
+
+# Check whether --with-root-access or --without-root-access was given.
+if test "${with_root_access+set}" = set; then
+  withval="$with_root_access"
+  :
+fi
+
+
+# Check whether --with-kmem-usage or --without-kmem-usage was given.
+if test "${with_kmem_usage+set}" = set; then
+  withval="$with_kmem_usage"
+  :
+fi
+
+
+# Check whether --with-dummy-values or --without-dummy-values was given.
+if test "${with_dummy_values+set}" = set; then
+  withval="$with_dummy_values"
+  :
+fi
+
+
+# Check whether --with-persistent-directory or --without-persistent-directory was given.
+if test "${with_persistent_directory+set}" = set; then
+  withval="$with_persistent_directory"
+  ac_cv_user_prompt_PERSISTENT_DIRECTORY="$with_persistent_directory"
+fi
+
+
+# Check whether --with-copy_persistent_files or --without-copy_persistent_files was given.
+if test "${with_copy_persistent_files+set}" = set; then
+  withval="$with_copy_persistent_files"
+  ac_cv_user_prompt_COPY_PERSISTENT_FILES="$with_copy_persistent_files"
+fi
+
+
+# Check whether --with-default-snmp-version or --without-default-snmp-version was given.
+if test "${with_default_snmp_version+set}" = set; then
+  withval="$with_default_snmp_version"
+  ac_cv_user_prompt_DEFAULT_SNMP_VERSION="$with_default_snmp_version"
+fi
+
+
+if test "x$ac_cv_user_prompt_DEFAULT_SNMP_VERSION" != "x"; then
+  if test "$ac_cv_user_prompt_DEFAULT_SNMP_VERSION" != "1" -a "$ac_cv_user_prompt_DEFAULT_SNMP_VERSION" != "2" -a "$ac_cv_user_prompt_DEFAULT_SNMP_VERSION" != "3"; then
+    { echo "configure: error: Illegal version number passed to --with-default-snmp-version" 1>&2; exit 1; }
+  fi
+fi
+
+# Check whether --with-sys_contact or --without-sys_contact was given.
+if test "${with_sys_contact+set}" = set; then
+  withval="$with_sys_contact"
+  ac_cv_user_prompt_SYS_CONTACT="$with_sys_contact"
+fi
+
+
+# Check whether --with-sys_location or --without-sys_location was given.
+if test "${with_sys_location+set}" = set; then
+  withval="$with_sys_location"
+  ac_cv_user_prompt_SYS_LOC="$with_sys_location"
+fi
+
+
+# Check whether --with-logfile or --without-logfile was given.
+if test "${with_logfile+set}" = set; then
+  withval="$with_logfile"
+  ac_cv_user_prompt_LOGFILE="$with_logfile"
+fi
+
+
+
+
+# Check whether --with-transports or --without-transports was given.
+if test "${with_transports+set}" = set; then
+  withval="$with_transports"
+  :
+fi
+
+# Check whether --with-out_transports or --without-out_transports was given.
+if test "${with_out_transports+set}" = set; then
+  withval="$with_out_transports"
+  :
+fi
+
+
+# Check whether --with-transport or --without-transport was given.
+if test "${with_transport+set}" = set; then
+  withval="$with_transport"
+  { echo "configure: error:  Invalid option. Use --with-transports instead " 1>&2; exit 1; }     
+fi
+
+# Check whether --with-out_transport or --without-out_transport was given.
+if test "${with_out_transport+set}" = set; then
+  withval="$with_out_transport"
+  { echo "configure: error:  Invalid option. Use --with-out-transports instead " 1>&2; exit 1; } 
+fi
+
+
+
+# Check whether --with-security-modules or --without-security-modules was given.
+if test "${with_security_modules+set}" = set; then
+  withval="$with_security_modules"
+  :
+fi
+
+
+
+# Check whether --with-mib_modules or --without-mib_modules was given.
+if test "${with_mib_modules+set}" = set; then
+  withval="$with_mib_modules"
+  :
+fi
+
+
+# Check whether --with-out_mib_modules or --without-out_mib_modules was given.
+if test "${with_out_mib_modules+set}" = set; then
+  withval="$with_out_mib_modules"
+  :
+fi
+
+
+
+# Check whether --with-enterprise-oid or --without-enterprise-oid was given.
+if test "${with_enterprise_oid+set}" = set; then
+  withval="$with_enterprise_oid"
+  
+  if test "$withval" = yes; then
+    { echo "configure: error:  Please provide a value for the enterprise number " 1>&2; exit 1; };
+  fi
+  cat >> confdefs.h <<EOF
+#define ENTERPRISE_OID $withval
+EOF
+
+  ent_oid="1,3,6,1,4,1,$withval"
+  cat >> confdefs.h <<EOF
+#define ENTERPRISE_MIB $ent_oid
+EOF
+
+  ent_dot_oid="1.3.6.1.4.1.$withval"
+  cat >> confdefs.h <<EOF
+#define ENTERPRISE_DOT_MIB $ent_dot_oid
+EOF
+
+  echo "$ac_t""using enterprise number $withval" 1>&6
+
+else
+  
+  echo "$ac_t""using default "enterprise.net-snmp"" 1>&6
+
+fi
+
+
+# Check whether --with-enterprise-sysoid or --without-enterprise-sysoid was given.
+if test "${with_enterprise_sysoid+set}" = set; then
+  withval="$with_enterprise_sysoid"
+  
+  if test "$withval" = yes; then
+    { echo "configure: error:  Please provide a base OID value " 1>&2; exit 1; };
+  fi
+  sys_oid=`echo "$withval" | sed 's/^\.//' | sed 's/\./\,/g'`
+  cat >> confdefs.h <<EOF
+#define SYSTEM_MIB $sys_oid
+EOF
+
+  sys_dot_oid=`echo "$withval" | sed 's/^\.//'`
+  cat >> confdefs.h <<EOF
+#define SYSTEM_DOT_MIB $sys_dot_oid
+EOF
+
+  sysoid_len=`echo "$withval" | sed 's/^\.//g' | awk -F\. '{ print NF }'`
+  cat >> confdefs.h <<EOF
+#define SYSTEM_DOT_MIB_LENGTH $sysoid_len
+EOF
+
+  echo "$ac_t""using enterprise sysOID $withval ...." 1>&6
+
+else
+  
+  echo "$ac_t""using default enterprise sysOID "NET-SNMP-MIB::netSnmpAgentOIDs..."" 1>&6
+
+fi
+
+
+# Check whether --with-enterprise-notification-oid or --without-enterprise-notification-oid was given.
+if test "${with_enterprise_notification_oid+set}" = set; then
+  withval="$with_enterprise_notification_oid"
+  
+  if test "$withval" = yes; then
+    { echo "configure: error:  Please provide a base OID value " 1>&2; exit 1; };
+  fi
+  notification_oid=`echo "$withval" | sed 's/^\.//' | sed 's/\./\,/g'`
+  cat >> confdefs.h <<EOF
+#define NOTIFICATION_MIB $notification_oid
+EOF
+
+  notification_dot_oid=`echo "$withval" | sed 's/^\.//'`
+  cat >> confdefs.h <<EOF
+#define NOTIFICATION_DOT_MIB $notification_dot_oid
+EOF
+
+  notificationoid_len=`echo "$withval" | sed 's/^\.//g' | awk -F\. '{ print NF }'`
+  cat >> confdefs.h <<EOF
+#define NOTIFICATION_DOT_MIB_LENGTH $notificationoid_len
+EOF
+
+  echo "$ac_t""using enterprise notifications $withval" 1>&6
+
+else
+  
+  echo "$ac_t""using default notifications "NET-SNMP-MIB::netSnmpNotifications"" 1>&6
+
+fi
+
+# Check whether --with-mib_module or --without-mib_module was given.
+if test "${with_mib_module+set}" = set; then
+  withval="$with_mib_module"
+  { echo "configure: error:  Invalid option. Use --with-mib-modules instead " 1>&2; exit 1; }     
+fi
+
+# Check whether --with-out_mib_module or --without-out_mib_module was given.
+if test "${with_out_mib_module+set}" = set; then
+  withval="$with_out_mib_module"
+  { echo "configure: error:  Invalid option. Use --with-out-mib-modules instead " 1>&2; exit 1; } 
+fi
+
+
+# Check whether --with-perl-modules or --without-perl-modules was given.
+if test "${with_perl_modules+set}" = set; then
+  withval="$with_perl_modules"
+  
+    install_perl=yes
+    if test "$withval" = yes; then
+      PERLARGS=""
+    else
+      PERLARGS="$withval"
+    fi
+
+fi
+
+
+# Check whether --enable-embedded-perl or --disable-embedded-perl was given.
+if test "${enable_embedded_perl+set}" = set; then
+  enableval="$enable_embedded_perl"
+  embed_perl="yes"
+else
+  embed_perl="no"
+fi
+
+
+# Check whether --with-defaults or --without-defaults was given.
+if test "${with_defaults+set}" = set; then
+  withval="$with_defaults"
+  defaults="yes"
+else
+  defaults="no"
+fi
+
+
+# Check whether --enable-ucd-snmp-compatibility or --disable-ucd-snmp-compatibility was given.
+if test "${enable_ucd_snmp_compatibility+set}" = set; then
+  enableval="$enable_ucd_snmp_compatibility"
+  ucd_compat=yes
+else
+  ucd_compat=no
+fi
+
+if test "x$ucd_compat" != "xno" ; then	
+  installucdheaders=installucdheaders
+  installucdlibs=installucdlibs
+  
+  cat >> configure-summary << EOF
+  UCD-SNMP compatability:     enabled
+EOF
+
+fi
+
+
+
+if test "x$with_root_access" = "xno"; then
+  cat >> confdefs.h <<\EOF
+#define NO_ROOT_ACCESS 1
+EOF
+
+fi
+
+if test "x$with_kmem_usage" = "xno"; then
+  cat >> confdefs.h <<\EOF
+#define NO_KMEM_USAGE 1
+EOF
+
+fi
+
+if test "x$with_dummy_values" != "xyes"; then
+  cat >> confdefs.h <<\EOF
+#define NO_DUMMY_VALUES 1
+EOF
+
+fi
+
+if test "x$with_opaque_special_types" != "xno"; then
+  cat >> confdefs.h <<\EOF
+#define OPAQUE_SPECIAL_TYPES 1
+EOF
+
+fi
+
+
+
+echo $ac_n "checking if I need to feed myself to ksh""... $ac_c" 1>&6
+echo "configure:1543: checking if I need to feed myself to ksh" >&5
+if test -f /hp-ux -a -f /bin/ksh; then
+  if (PATH=.; alias -x) >/dev/null 2>&1; then
+    echo "$ac_t""no" 1>&6
+  else
+    echo "$ac_t""yes" 1>&6
+    if test "x$1" = "x"; then
+      exec /bin/ksh $0
+    else
+      exec /bin/ksh $0 "$@"
+    fi
+  fi
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+if test "x$developer" != "xno" -a -f $srcdir/remove-files; then
+    developer="yes"
+fi
+
+if test "x$developer" = "xyes"; then
+    if test "${enable_shared+set}" != set; then
+    enable_shared=no
+  fi
+fi
+
+if test "x$embed_perl" = "xyes"; then
+    if test "x$enable_shared" != "xyes"; then
+      { echo "configure: error: --enable-embedded-perl requires --enable-shared" 1>&2; exit 1; }
+    fi
+fi
+
+# Extract the first word of "gcc", so it can be a program name with args.
+set dummy gcc; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:1578: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  if test -n "$CC"; then
+  ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS=":"
+  ac_dummy="$PATH"
+  for ac_dir in $ac_dummy; do
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/$ac_word; then
+      ac_cv_prog_CC="gcc"
+      break
+    fi
+  done
+  IFS="$ac_save_ifs"
+fi
+fi
+CC="$ac_cv_prog_CC"
+if test -n "$CC"; then
+  echo "$ac_t""$CC" 1>&6
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+if test -z "$CC"; then
+  # Extract the first word of "cc", so it can be a program name with args.
+set dummy cc; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:1608: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  if test -n "$CC"; then
+  ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS=":"
+  ac_prog_rejected=no
+  ac_dummy="$PATH"
+  for ac_dir in $ac_dummy; do
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/$ac_word; then
+      if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then
+        ac_prog_rejected=yes
+	continue
+      fi
+      ac_cv_prog_CC="cc"
+      break
+    fi
+  done
+  IFS="$ac_save_ifs"
+if test $ac_prog_rejected = yes; then
+  # We found a bogon in the path, so make sure we never use it.
+  set dummy $ac_cv_prog_CC
+  shift
+  if test $# -gt 0; then
+    # We chose a different compiler from the bogus one.
+    # However, it has the same basename, so the bogon will be chosen
+    # first if we set CC to just the basename; use the full file name.
+    shift
+    set dummy "$ac_dir/$ac_word" "$@"
+    shift
+    ac_cv_prog_CC="$@"
+  fi
+fi
+fi
+fi
+CC="$ac_cv_prog_CC"
+if test -n "$CC"; then
+  echo "$ac_t""$CC" 1>&6
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+  if test -z "$CC"; then
+    case "`uname -s`" in
+    *win32* | *WIN32*)
+      # Extract the first word of "cl", so it can be a program name with args.
+set dummy cl; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:1659: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  if test -n "$CC"; then
+  ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS=":"
+  ac_dummy="$PATH"
+  for ac_dir in $ac_dummy; do
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/$ac_word; then
+      ac_cv_prog_CC="cl"
+      break
+    fi
+  done
+  IFS="$ac_save_ifs"
+fi
+fi
+CC="$ac_cv_prog_CC"
+if test -n "$CC"; then
+  echo "$ac_t""$CC" 1>&6
+else
+  echo "$ac_t""no" 1>&6
+fi
+ ;;
+    esac
+  fi
+  test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; }
+fi
+
+echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6
+echo "configure:1691: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
+
+ac_ext=c
+# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
+ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
+cross_compiling=$ac_cv_prog_cc_cross
+
+cat > conftest.$ac_ext << EOF
+
+#line 1702 "configure"
+#include "confdefs.h"
+
+main(){return(0);}
+EOF
+if { (eval echo configure:1707: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  ac_cv_prog_cc_works=yes
+  # If we can't run a trivial program, we are probably using a cross compiler.
+  if (./conftest; exit) 2>/dev/null; then
+    ac_cv_prog_cc_cross=no
+  else
+    ac_cv_prog_cc_cross=yes
+  fi
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  ac_cv_prog_cc_works=no
+fi
+rm -fr conftest*
+ac_ext=c
+# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
+ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
+cross_compiling=$ac_cv_prog_cc_cross
+
+echo "$ac_t""$ac_cv_prog_cc_works" 1>&6
+if test $ac_cv_prog_cc_works = no; then
+  { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; }
+fi
+echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6
+echo "configure:1733: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
+echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6
+cross_compiling=$ac_cv_prog_cc_cross
+
+echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6
+echo "configure:1738: checking whether we are using GNU C" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.c <<EOF
+#ifdef __GNUC__
+  yes;
+#endif
+EOF
+if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1747: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
+  ac_cv_prog_gcc=yes
+else
+  ac_cv_prog_gcc=no
+fi
+fi
+
+echo "$ac_t""$ac_cv_prog_gcc" 1>&6
+
+if test $ac_cv_prog_gcc = yes; then
+  GCC=yes
+else
+  GCC=
+fi
+
+ac_test_CFLAGS="${CFLAGS+set}"
+ac_save_CFLAGS="$CFLAGS"
+CFLAGS=
+echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
+echo "configure:1766: checking whether ${CC-cc} accepts -g" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  echo 'void f(){}' > conftest.c
+if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then
+  ac_cv_prog_cc_g=yes
+else
+  ac_cv_prog_cc_g=no
+fi
+rm -f conftest*
+
+fi
+
+echo "$ac_t""$ac_cv_prog_cc_g" 1>&6
+if test "$ac_test_CFLAGS" = set; then
+  CFLAGS="$ac_save_CFLAGS"
+elif test $ac_cv_prog_cc_g = yes; then
+  if test "$GCC" = yes; then
+    CFLAGS="-g -O2"
+  else
+    CFLAGS="-g"
+  fi
+else
+  if test "$GCC" = yes; then
+    CFLAGS="-O2"
+  else
+    CFLAGS=
+  fi
+fi
+
+echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
+echo "configure:1798: checking how to run the C preprocessor" >&5
+# On Suns, sometimes $CPP names a directory.
+if test -n "$CPP" && test -d "$CPP"; then
+  CPP=
+fi
+if test -z "$CPP"; then
+if eval "test \"`echo '$''{'ac_cv_prog_CPP'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+    # This must be in double quotes, not single quotes, because CPP may get
+  # substituted into the Makefile and "${CC-cc}" will confuse make.
+  CPP="${CC-cc} -E"
+  # On the NeXT, cc -E runs the code through the compiler's parser,
+  # not just through cpp.
+  cat > conftest.$ac_ext <<EOF
+#line 1813 "configure"
+#include "confdefs.h"
+#include <assert.h>
+Syntax Error
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:1819: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+  :
+else
+  echo "$ac_err" >&5
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  CPP="${CC-cc} -E -traditional-cpp"
+  cat > conftest.$ac_ext <<EOF
+#line 1830 "configure"
+#include "confdefs.h"
+#include <assert.h>
+Syntax Error
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:1836: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+  :
+else
+  echo "$ac_err" >&5
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  CPP="${CC-cc} -nologo -E"
+  cat > conftest.$ac_ext <<EOF
+#line 1847 "configure"
+#include "confdefs.h"
+#include <assert.h>
+Syntax Error
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:1853: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+  :
+else
+  echo "$ac_err" >&5
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  CPP=/lib/cpp
+fi
+rm -f conftest*
+fi
+rm -f conftest*
+fi
+rm -f conftest*
+  ac_cv_prog_CPP="$CPP"
+fi
+  CPP="$ac_cv_prog_CPP"
+else
+  ac_cv_prog_CPP="$CPP"
+fi
+echo "$ac_t""$CPP" 1>&6
+
+echo $ac_n "checking for AIX""... $ac_c" 1>&6
+echo "configure:1878: checking for AIX" >&5
+cat > conftest.$ac_ext <<EOF
+#line 1880 "configure"
+#include "confdefs.h"
+#ifdef _AIX
+  yes
+#endif
+
+EOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  egrep "yes" >/dev/null 2>&1; then
+  rm -rf conftest*
+  echo "$ac_t""yes" 1>&6; cat >> confdefs.h <<\EOF
+#define _ALL_SOURCE 1
+EOF
+
+else
+  rm -rf conftest*
+  echo "$ac_t""no" 1>&6
+fi
+rm -f conftest*
+
+
+echo $ac_n "checking for Cygwin environment""... $ac_c" 1>&6
+echo "configure:1902: checking for Cygwin environment" >&5
+if eval "test \"`echo '$''{'ac_cv_cygwin'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 1907 "configure"
+#include "confdefs.h"
+
+int main() {
+
+#ifndef __CYGWIN__
+#define __CYGWIN__ __CYGWIN32__
+#endif
+return __CYGWIN__;
+; return 0; }
+EOF
+if { (eval echo configure:1918: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  ac_cv_cygwin=yes
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  ac_cv_cygwin=no
+fi
+rm -f conftest*
+rm -f conftest*
+fi
+
+echo "$ac_t""$ac_cv_cygwin" 1>&6
+CYGWIN=
+test "$ac_cv_cygwin" = yes && CYGWIN=yes
+echo $ac_n "checking for mingw32 environment""... $ac_c" 1>&6
+echo "configure:1935: checking for mingw32 environment" >&5
+if eval "test \"`echo '$''{'ac_cv_mingw32'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 1940 "configure"
+#include "confdefs.h"
+
+int main() {
+return __MINGW32__;
+; return 0; }
+EOF
+if { (eval echo configure:1947: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  ac_cv_mingw32=yes
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  ac_cv_mingw32=no
+fi
+rm -f conftest*
+rm -f conftest*
+fi
+
+echo "$ac_t""$ac_cv_mingw32" 1>&6
+MINGW32=
+test "$ac_cv_mingw32" = yes && MINGW32=yes
+
+
+echo $ac_n "checking for executable suffix""... $ac_c" 1>&6
+echo "configure:1966: checking for executable suffix" >&5
+if eval "test \"`echo '$''{'ac_cv_exeext'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  if test "$CYGWIN" = yes || test "$MINGW32" = yes; then
+  ac_cv_exeext=.exe
+else
+  rm -f conftest*
+  echo 'int main () { return 0; }' > conftest.$ac_ext
+  ac_cv_exeext=
+  if { (eval echo configure:1976: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
+    for file in conftest.*; do
+      case $file in
+      *.c | *.o | *.obj) ;;
+      *) ac_cv_exeext=`echo $file | sed -e s/conftest//` ;;
+      esac
+    done
+  else
+    { echo "configure: error: installation or configuration problem: compiler cannot create executables." 1>&2; exit 1; }
+  fi
+  rm -f conftest*
+  test x"${ac_cv_exeext}" = x && ac_cv_exeext=no
+fi
+fi
+
+EXEEXT=""
+test x"${ac_cv_exeext}" != xno && EXEEXT=${ac_cv_exeext}
+echo "$ac_t""${ac_cv_exeext}" 1>&6
+ac_exeext=$EXEEXT
+
+
+
+
+ac_aux_dir=
+for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do
+  if test -f $ac_dir/install-sh; then
+    ac_aux_dir=$ac_dir
+    ac_install_sh="$ac_aux_dir/install-sh -c"
+    break
+  elif test -f $ac_dir/install.sh; then
+    ac_aux_dir=$ac_dir
+    ac_install_sh="$ac_aux_dir/install.sh -c"
+    break
+  fi
+done
+if test -z "$ac_aux_dir"; then
+  { echo "configure: error: can not find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." 1>&2; exit 1; }
+fi
+ac_config_guess=$ac_aux_dir/config.guess
+ac_config_sub=$ac_aux_dir/config.sub
+ac_configure=$ac_aux_dir/configure # This should be Cygnus configure.
+
+# Find the correct PATH separator.  Usually this is `:', but
+# DJGPP uses `;' like DOS.
+if test "X${PATH_SEPARATOR+set}" != Xset; then
+  UNAME=${UNAME-`uname 2>/dev/null`}
+  case X$UNAME in
+    *-DOS) lt_cv_sys_path_separator=';' ;;
+    *)     lt_cv_sys_path_separator=':' ;;
+  esac
+  PATH_SEPARATOR=$lt_cv_sys_path_separator
+fi
+
+# Check whether --enable-shared or --disable-shared was given.
+if test "${enable_shared+set}" = set; then
+  enableval="$enable_shared"
+  p=${PACKAGE-default}
+case $enableval in
+yes) enable_shared=yes ;;
+no) enable_shared=no ;;
+*)
+  enable_shared=no
+  # Look at the argument we got.  We use all the common list separators.
+  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
+  for pkg in $enableval; do
+    if test "X$pkg" = "X$p"; then
+      enable_shared=yes
+    fi
+  done
+  IFS="$ac_save_ifs"
+  ;;
+esac
+else
+  enable_shared=yes
+fi
+
+# Check whether --enable-static or --disable-static was given.
+if test "${enable_static+set}" = set; then
+  enableval="$enable_static"
+  p=${PACKAGE-default}
+case $enableval in
+yes) enable_static=yes ;;
+no) enable_static=no ;;
+*)
+  enable_static=no
+  # Look at the argument we got.  We use all the common list separators.
+  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
+  for pkg in $enableval; do
+    if test "X$pkg" = "X$p"; then
+      enable_static=yes
+    fi
+  done
+  IFS="$ac_save_ifs"
+  ;;
+esac
+else
+  enable_static=yes
+fi
+
+# Check whether --enable-fast-install or --disable-fast-install was given.
+if test "${enable_fast_install+set}" = set; then
+  enableval="$enable_fast_install"
+  p=${PACKAGE-default}
+case $enableval in
+yes) enable_fast_install=yes ;;
+no) enable_fast_install=no ;;
+*)
+  enable_fast_install=no
+  # Look at the argument we got.  We use all the common list separators.
+  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
+  for pkg in $enableval; do
+    if test "X$pkg" = "X$p"; then
+      enable_fast_install=yes
+    fi
+  done
+  IFS="$ac_save_ifs"
+  ;;
+esac
+else
+  enable_fast_install=yes
+fi
+
+
+# Make sure we can run config.sub.
+if ${CONFIG_SHELL-/bin/sh} $ac_config_sub sun4 >/dev/null 2>&1; then :
+else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; }
+fi
+
+echo $ac_n "checking host system type""... $ac_c" 1>&6
+echo "configure:2105: checking host system type" >&5
+
+host_alias=$host
+case "$host_alias" in
+NONE)
+  case $nonopt in
+  NONE)
+    if host_alias=`${CONFIG_SHELL-/bin/sh} $ac_config_guess`; then :
+    else { echo "configure: error: can not guess host type; you must specify one" 1>&2; exit 1; }
+    fi ;;
+  *) host_alias=$nonopt ;;
+  esac ;;
+esac
+
+host=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $host_alias`
+host_cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
+host_vendor=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
+host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
+echo "$ac_t""$host" 1>&6
+
+echo $ac_n "checking build system type""... $ac_c" 1>&6
+echo "configure:2126: checking build system type" >&5
+
+build_alias=$build
+case "$build_alias" in
+NONE)
+  case $nonopt in
+  NONE) build_alias=$host_alias ;;
+  *) build_alias=$nonopt ;;
+  esac ;;
+esac
+
+build=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $build_alias`
+build_cpu=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
+build_vendor=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
+build_os=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
+echo "$ac_t""$build" 1>&6
+
+# Check whether --with-gnu-ld or --without-gnu-ld was given.
+if test "${with_gnu_ld+set}" = set; then
+  withval="$with_gnu_ld"
+  test "$withval" = no || with_gnu_ld=yes
+else
+  with_gnu_ld=no
+fi
+
+ac_prog=ld
+if test "$GCC" = yes; then
+  # Check if gcc -print-prog-name=ld gives a path.
+  echo $ac_n "checking for ld used by GCC""... $ac_c" 1>&6
+echo "configure:2155: checking for ld used by GCC" >&5
+  case $host in
+  *-*-mingw*)
+    # gcc leaves a trailing carriage return which upsets mingw
+    ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
+  *)
+    ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
+  esac
+  case $ac_prog in
+    # Accept absolute paths.
+    [\\/]* | [A-Za-z]:[\\/]*)
+      re_direlt='/[^/][^/]*/\.\./'
+      # Canonicalize the path of ld
+      ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'`
+      while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
+	ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
+      done
+      test -z "$LD" && LD="$ac_prog"
+      ;;
+  "")
+    # If it fails, then pretend we aren't using GCC.
+    ac_prog=ld
+    ;;
+  *)
+    # If it is relative, then search for the first ld in PATH.
+    with_gnu_ld=unknown
+    ;;
+  esac
+elif test "$with_gnu_ld" = yes; then
+  echo $ac_n "checking for GNU ld""... $ac_c" 1>&6
+echo "configure:2185: checking for GNU ld" >&5
+else
+  echo $ac_n "checking for non-GNU ld""... $ac_c" 1>&6
+echo "configure:2188: checking for non-GNU ld" >&5
+fi
+if eval "test \"`echo '$''{'lt_cv_path_LD'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  if test -z "$LD"; then
+  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+  for ac_dir in $PATH; do
+    test -z "$ac_dir" && ac_dir=.
+    if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
+      lt_cv_path_LD="$ac_dir/$ac_prog"
+      # Check to see if the program is GNU ld.  I'd rather use --version,
+      # but apparently some GNU ld's only accept -v.
+      # Break only if it was the GNU/non-GNU ld that we prefer.
+      if "$lt_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then
+	test "$with_gnu_ld" != no && break
+      else
+	test "$with_gnu_ld" != yes && break
+      fi
+    fi
+  done
+  IFS="$ac_save_ifs"
+else
+  lt_cv_path_LD="$LD" # Let the user override the test with a path.
+fi
+fi
+
+LD="$lt_cv_path_LD"
+if test -n "$LD"; then
+  echo "$ac_t""$LD" 1>&6
+else
+  echo "$ac_t""no" 1>&6
+fi
+test -z "$LD" && { echo "configure: error: no acceptable ld found in \$PATH" 1>&2; exit 1; }
+echo $ac_n "checking if the linker ($LD) is GNU ld""... $ac_c" 1>&6
+echo "configure:2223: checking if the linker ($LD) is GNU ld" >&5
+if eval "test \"`echo '$''{'lt_cv_prog_gnu_ld'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  # I'd rather use --version here, but apparently some GNU ld's only accept -v.
+if $LD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then
+  lt_cv_prog_gnu_ld=yes
+else
+  lt_cv_prog_gnu_ld=no
+fi
+fi
+
+echo "$ac_t""$lt_cv_prog_gnu_ld" 1>&6
+with_gnu_ld=$lt_cv_prog_gnu_ld
+
+
+echo $ac_n "checking for $LD option to reload object files""... $ac_c" 1>&6
+echo "configure:2240: checking for $LD option to reload object files" >&5
+if eval "test \"`echo '$''{'lt_cv_ld_reload_flag'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  lt_cv_ld_reload_flag='-r'
+fi
+
+echo "$ac_t""$lt_cv_ld_reload_flag" 1>&6
+reload_flag=$lt_cv_ld_reload_flag
+test -n "$reload_flag" && reload_flag=" $reload_flag"
+
+echo $ac_n "checking for BSD-compatible nm""... $ac_c" 1>&6
+echo "configure:2252: checking for BSD-compatible nm" >&5
+if eval "test \"`echo '$''{'lt_cv_path_NM'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  if test -n "$NM"; then
+  # Let the user override the test.
+  lt_cv_path_NM="$NM"
+else
+  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+  for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do
+    test -z "$ac_dir" && ac_dir=.
+    tmp_nm=$ac_dir/${ac_tool_prefix}nm
+    if test -f $tmp_nm || test -f $tmp_nm$ac_exeext ; then
+      # Check to see if the nm accepts a BSD-compat flag.
+      # Adding the `sed 1q' prevents false positives on HP-UX, which says:
+      #   nm: unknown option "B" ignored
+      # Tru64's nm complains that /dev/null is an invalid object file
+      if ($tmp_nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep '(/dev/null|Invalid file or object type)' >/dev/null; then
+	lt_cv_path_NM="$tmp_nm -B"
+	break
+      elif ($tmp_nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
+	lt_cv_path_NM="$tmp_nm -p"
+	break
+      else
+	lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but
+	continue # so that we can try to find one that supports BSD flags
+      fi
+    fi
+  done
+  IFS="$ac_save_ifs"
+  test -z "$lt_cv_path_NM" && lt_cv_path_NM=nm
+fi
+fi
+
+NM="$lt_cv_path_NM"
+echo "$ac_t""$NM" 1>&6
+
+echo $ac_n "checking for a sed that does not truncate output""... $ac_c" 1>&6
+echo "configure:2290: checking for a sed that does not truncate output" >&5
+if eval "test \"`echo '$''{'lt_cv_path_SED'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  # Loop through the user's path and test for sed and gsed.
+# Then use that list of sed's as ones to test for truncation.
+as_executable_p="test -f"
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_prog in sed gsed; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
+      if $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then
+        _sed_list="$_sed_list $as_dir/$ac_prog$ac_exec_ext"
+      fi
+    done
+  done
+done
+
+  # Create a temporary directory, and hook for its removal unless debugging.
+$debug ||
+{
+  trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0
+  trap '{ (exit 1); exit 1; }' 1 2 13 15
+}
+
+# Create a (secure) tmp directory for tmp files.
+: ${TMPDIR=/tmp}
+{
+  tmp=`(umask 077 && mktemp -d -q "$TMPDIR/sedXXXXXX") 2>/dev/null` &&
+  test -n "$tmp" && test -d "$tmp"
+}  ||
+{
+  tmp=$TMPDIR/sed$$-$RANDOM
+  (umask 077 && mkdir $tmp)
+} ||
+{
+   echo "$me: cannot create a temporary directory in $TMPDIR" >&2
+   { (exit 1); exit 1; }
+}
+  _max=0
+  _count=0
+  # Add /usr/xpg4/bin/sed as it is typically found on Solaris
+  # along with /bin/sed that truncates output.
+  for _sed in $_sed_list /usr/xpg4/bin/sed; do
+    test ! -f ${_sed} && break
+    cat /dev/null > "$tmp/sed.in"
+    _count=0
+    echo ${ECHO_N-$ac_n} "0123456789${ECHO_C-$ac_c}" >"$tmp/sed.in"
+    # Check for GNU sed and select it if it is found.
+    if "${_sed}" --version 2>&1 < /dev/null | egrep '(GNU)' > /dev/null; then
+      lt_cv_path_SED=${_sed}
+      break
+    fi
+    while true; do
+      cat "$tmp/sed.in" "$tmp/sed.in" >"$tmp/sed.tmp"
+      mv "$tmp/sed.tmp" "$tmp/sed.in"
+      cp "$tmp/sed.in" "$tmp/sed.nl"
+      echo >>"$tmp/sed.nl"
+      ${_sed} -e 's/a$//' < "$tmp/sed.nl" >"$tmp/sed.out" || break
+      cmp -s "$tmp/sed.out" "$tmp/sed.nl" || break
+      # 40000 chars as input seems more than enough
+      test $_count -gt 10 && break
+      _count=`expr $_count + 1`
+      if test $_count -gt $_max; then
+        _max=$_count
+        lt_cv_path_SED=$_sed
+      fi
+    done
+  done
+  rm -rf "$tmp"
+
+fi
+
+if test "X$SED" != "X"; then
+  lt_cv_path_SED=$SED
+else
+  SED=$lt_cv_path_SED
+fi
+echo "$ac_t""$SED" 1>&6
+
+echo $ac_n "checking whether ln -s works""... $ac_c" 1>&6
+echo "configure:2374: checking whether ln -s works" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_LN_S'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  rm -f conftestdata
+if ln -s X conftestdata 2>/dev/null
+then
+  rm -f conftestdata
+  ac_cv_prog_LN_S="ln -s"
+else
+  ac_cv_prog_LN_S=ln
+fi
+fi
+LN_S="$ac_cv_prog_LN_S"
+if test "$ac_cv_prog_LN_S" = "ln -s"; then
+  echo "$ac_t""yes" 1>&6
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+echo $ac_n "checking how to recognise dependent libraries""... $ac_c" 1>&6
+echo "configure:2395: checking how to recognise dependent libraries" >&5
+if eval "test \"`echo '$''{'lt_cv_deplibs_check_method'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  lt_cv_file_magic_cmd='$MAGIC_CMD'
+lt_cv_file_magic_test_file=
+lt_cv_deplibs_check_method='unknown'
+# Need to set the preceding variable on all platforms that support
+# interlibrary dependencies.
+# 'none' -- dependencies not supported.
+# `unknown' -- same as none, but documents that we really don't know.
+# 'pass_all' -- all dependencies passed with no checks.
+# 'test_compile' -- check by making test program.
+# 'file_magic [[regex]]' -- check by looking for files in library path
+# which responds to the $file_magic_cmd with a given egrep regex.
+# If you have `file' or equivalent on your system and you're not sure
+# whether `pass_all' will *always* work, you probably want this one.
+
+case $host_os in
+aix4* | aix5*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+beos*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+bsdi4*)
+  lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)'
+  lt_cv_file_magic_cmd='/usr/bin/file -L'
+  lt_cv_file_magic_test_file=/shlib/libc.so
+  ;;
+
+cygwin* | mingw* | pw32*)
+  lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?'
+  lt_cv_file_magic_cmd='$OBJDUMP -f'
+  ;;
+
+darwin* | rhapsody*)
+  lt_cv_deplibs_check_method='file_magic Mach-O dynamically linked shared library'
+  lt_cv_file_magic_cmd='/usr/bin/file -L'
+  case "$host_os" in
+  rhapsody* | darwin1.[012])
+    lt_cv_file_magic_test_file=`echo /System/Library/Frameworks/System.framework/Versions/*/System | head -1`
+    ;;
+  *) # Darwin 1.3 on
+    lt_cv_file_magic_test_file='/usr/lib/libSystem.dylib'
+    ;;
+  esac
+  ;;
+
+freebsd*)
+  if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
+    case $host_cpu in
+    i*86 )
+      # Not sure whether the presence of OpenBSD here was a mistake.
+      # Let's accept both of them until this is cleared up.
+      lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD)/i[3-9]86 (compact )?demand paged shared library'
+      lt_cv_file_magic_cmd=/usr/bin/file
+      lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*`
+      ;;
+    esac
+  else
+    lt_cv_deplibs_check_method=pass_all
+  fi
+  ;;
+
+gnu*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+hpux10.20*|hpux11*)
+  lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9].[0-9]) shared library'
+  lt_cv_file_magic_cmd=/usr/bin/file
+  lt_cv_file_magic_test_file=/usr/lib/libc.sl
+  ;;
+
+irix5* | irix6* | nonstopux*)
+  case $host_os in
+  irix5* | nonstopux*)
+    # this will be overridden with pass_all, but let us keep it just in case
+    lt_cv_deplibs_check_method="file_magic ELF 32-bit MSB dynamic lib MIPS - version 1"
+    ;;
+  *)
+    case $LD in
+    *-32|*"-32 ") libmagic=32-bit;;
+    *-n32|*"-n32 ") libmagic=N32;;
+    *-64|*"-64 ") libmagic=64-bit;;
+    *) libmagic=never-match;;
+    esac
+    # this will be overridden with pass_all, but let us keep it just in case
+    lt_cv_deplibs_check_method="file_magic ELF ${libmagic} MSB mips-[1234] dynamic lib MIPS - version 1"
+    ;;
+  esac
+  lt_cv_file_magic_test_file=`echo /lib${libsuff}/libc.so*`
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+# This must be Linux ELF.
+linux-gnu*)
+  case $host_cpu in
+  alpha* | hppa* | i*86 | mips | mipsel | powerpc* | sparc* | ia64*)
+    lt_cv_deplibs_check_method=pass_all ;;
+  *)
+    # glibc up to 2.1.1 does not perform some relocations on ARM
+    lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )' ;;
+  esac
+  lt_cv_file_magic_test_file=`echo /lib/libc.so* /lib/libc-*.so`
+  ;;
+
+netbsd*)
+  if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
+    lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$'
+  else
+    lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so$'
+  fi
+  ;;
+
+newos6*)
+  lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (executable|dynamic lib)'
+  lt_cv_file_magic_cmd=/usr/bin/file
+  lt_cv_file_magic_test_file=/usr/lib/libnls.so
+  ;;
+
+openbsd*)
+  lt_cv_file_magic_cmd=/usr/bin/file
+  lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*`
+  if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+    lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB shared object'
+  else
+    lt_cv_deplibs_check_method='file_magic OpenBSD.* shared library'
+  fi
+  ;;
+
+osf3* | osf4* | osf5*)
+  # this will be overridden with pass_all, but let us keep it just in case
+  lt_cv_deplibs_check_method='file_magic COFF format alpha shared library'
+  lt_cv_file_magic_test_file=/shlib/libc.so
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+sco3.2v5*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+solaris*)
+  lt_cv_deplibs_check_method=pass_all
+  lt_cv_file_magic_test_file=/lib/libc.so
+  ;;
+
+sysv5uw[78]* | sysv4*uw2*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
+  case $host_vendor in
+  motorola)
+    lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib) M[0-9][0-9]* Version [0-9]'
+    lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*`
+    ;;
+  ncr)
+    lt_cv_deplibs_check_method=pass_all
+    ;;
+  sequent)
+    lt_cv_file_magic_cmd='/bin/file'
+    lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )'
+    ;;
+  sni)
+    lt_cv_file_magic_cmd='/bin/file'
+    lt_cv_deplibs_check_method="file_magic ELF [0-9][0-9]*-bit [LM]SB dynamic lib"
+    lt_cv_file_magic_test_file=/lib/libc.so
+    ;;
+  siemens)
+    lt_cv_deplibs_check_method=pass_all
+    ;;
+  esac
+  ;;
+esac
+
+fi
+
+echo "$ac_t""$lt_cv_deplibs_check_method" 1>&6
+file_magic_cmd=$lt_cv_file_magic_cmd
+deplibs_check_method=$lt_cv_deplibs_check_method
+
+echo $ac_n "checking for object suffix""... $ac_c" 1>&6
+echo "configure:2581: checking for object suffix" >&5
+if eval "test \"`echo '$''{'ac_cv_objext'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  rm -f conftest*
+echo 'int i = 1;' > conftest.$ac_ext
+if { (eval echo configure:2587: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  for ac_file in conftest.*; do
+    case $ac_file in
+    *.c) ;;
+    *) ac_cv_objext=`echo $ac_file | sed -e s/conftest.//` ;;
+    esac
+  done
+else
+  { echo "configure: error: installation or configuration problem; compiler does not work" 1>&2; exit 1; }
+fi
+rm -f conftest*
+fi
+
+echo "$ac_t""$ac_cv_objext" 1>&6
+OBJEXT=$ac_cv_objext
+ac_objext=$ac_cv_objext
+
+if test $host != $build; then
+  ac_tool_prefix=${host_alias}-
+else
+  ac_tool_prefix=
+fi
+
+
+
+
+# Check for command to grab the raw symbol name followed by C symbol from nm.
+echo $ac_n "checking command to parse $NM output""... $ac_c" 1>&6
+echo "configure:2615: checking command to parse $NM output" >&5
+if eval "test \"`echo '$''{'lt_cv_sys_global_symbol_pipe'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+# These are sane defaults that work on at least a few old systems.
+# [They come from Ultrix.  What could be older than Ultrix?!! ;)]
+
+# Character class describing NM global symbol codes.
+symcode='[BCDEGRST]'
+
+# Regexp to match symbols that can be accessed directly from C.
+sympat='\([_A-Za-z][_A-Za-z0-9]*\)'
+
+# Transform the above into a raw symbol and a C symbol.
+symxfrm='\1 \2\3 \3'
+
+# Transform an extracted symbol line into a proper C declaration
+lt_cv_global_symbol_to_cdecl="sed -n -e 's/^. .* \(.*\)$/extern char \1;/p'"
+
+# Transform an extracted symbol line into symbol name and symbol address
+lt_cv_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/  {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode \([^ ]*\) \([^ ]*\)$/  {\"\2\", (lt_ptr) \&\2},/p'"
+
+# Define system-specific variables.
+case $host_os in
+aix*)
+  symcode='[BCDT]'
+  ;;
+cygwin* | mingw* | pw32*)
+  symcode='[ABCDGISTW]'
+  ;;
+hpux*) # Its linker distinguishes data from code symbols
+  lt_cv_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern char \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'"
+  lt_cv_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/  {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/  {\"\2\", (lt_ptr) \&\2},/p'"
+  ;;
+irix* | nonstopux*)
+  symcode='[BCDEGRST]'
+  ;;
+osf*)
+  symcode='[BCDEGQRST]'
+  ;;
+solaris* | sysv5*)
+  symcode='[BDT]'
+  ;;
+sysv4)
+  symcode='[DFNSTU]'
+  ;;
+esac
+
+# Handle CRLF in mingw tool chain
+opt_cr=
+case $host_os in
+mingw*)
+  opt_cr=`echo 'x\{0,1\}' | tr x '\015'` # option cr in regexp
+  ;;
+esac
+
+# If we're using GNU nm, then use its standard symbol codes.
+if $NM -V 2>&1 | egrep '(GNU|with BFD)' > /dev/null; then
+  symcode='[ABCDGISTW]'
+fi
+
+# Try without a prefix undercore, then with it.
+for ac_symprfx in "" "_"; do
+
+  # Write the raw and C identifiers.
+lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[ 	]\($symcode$symcode*\)[ 	][ 	]*\($ac_symprfx\)$sympat$opt_cr$/$symxfrm/p'"
+
+  # Check to see that the pipe works correctly.
+  pipe_works=no
+  rm -f conftest*
+  cat > conftest.$ac_ext <<EOF
+#ifdef __cplusplus
+extern "C" {
+#endif
+char nm_test_var;
+void nm_test_func(){}
+#ifdef __cplusplus
+}
+#endif
+int main(){nm_test_var='a';nm_test_func();return(0);}
+EOF
+
+  if { (eval echo configure:2698: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+    # Now try to grab the symbols.
+    nlist=conftest.nm
+    if { (eval echo configure:2701: \"$NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist\") 1>&5; (eval $NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist) 2>&5; } && test -s "$nlist"; then
+      # Try sorting and uniquifying the output.
+      if sort "$nlist" | uniq > "$nlist"T; then
+	mv -f "$nlist"T "$nlist"
+      else
+	rm -f "$nlist"T
+      fi
+
+      # Make sure that we snagged all the symbols we need.
+      if egrep ' nm_test_var$' "$nlist" >/dev/null; then
+	if egrep ' nm_test_func$' "$nlist" >/dev/null; then
+	  cat <<EOF > conftest.$ac_ext
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+EOF
+	  # Now generate the symbol file.
+	  eval "$lt_cv_global_symbol_to_cdecl"' < "$nlist" >> conftest.$ac_ext'
+
+	  cat <<EOF >> conftest.$ac_ext
+#if defined (__STDC__) && __STDC__
+# define lt_ptr void *
+#else
+# define lt_ptr char *
+# define const
+#endif
+
+/* The mapping between symbol names and symbols. */
+const struct {
+  const char *name;
+  lt_ptr address;
+}
+lt_preloaded_symbols[] =
+{
+EOF
+	  sed "s/^$symcode$symcode* \(.*\) \(.*\)$/  {\"\2\", (lt_ptr) \&\2},/" < "$nlist" >> conftest.$ac_ext
+	  cat <<\EOF >> conftest.$ac_ext
+  {0, (lt_ptr) 0}
+};
+
+#ifdef __cplusplus
+}
+#endif
+EOF
+	  # Now try linking the two files.
+	  mv conftest.$ac_objext conftstm.$ac_objext
+	  save_LIBS="$LIBS"
+	  save_CFLAGS="$CFLAGS"
+	  LIBS="conftstm.$ac_objext"
+	  CFLAGS="$CFLAGS$no_builtin_flag"
+	  if { (eval echo configure:2752: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest$ac_exeext; then
+	    pipe_works=yes
+	  fi
+	  LIBS="$save_LIBS"
+	  CFLAGS="$save_CFLAGS"
+	else
+	  echo "cannot find nm_test_func in $nlist" >&5
+	fi
+      else
+	echo "cannot find nm_test_var in $nlist" >&5
+      fi
+    else
+      echo "cannot run $lt_cv_sys_global_symbol_pipe" >&5
+    fi
+  else
+    echo "$progname: failed program was:" >&5
+    cat conftest.$ac_ext >&5
+  fi
+  rm -f conftest* conftst*
+
+  # Do not use the global_symbol_pipe unless it works.
+  if test "$pipe_works" = yes; then
+    break
+  else
+    lt_cv_sys_global_symbol_pipe=
+  fi
+done
+
+fi
+
+global_symbol_pipe="$lt_cv_sys_global_symbol_pipe"
+if test -z "$lt_cv_sys_global_symbol_pipe"; then
+  global_symbol_to_cdecl=
+  global_symbol_to_c_name_address=
+else
+  global_symbol_to_cdecl="$lt_cv_global_symbol_to_cdecl"
+  global_symbol_to_c_name_address="$lt_cv_global_symbol_to_c_name_address"
+fi
+if test -z "$global_symbol_pipe$global_symbol_to_cdec$global_symbol_to_c_name_address";
+then
+  echo "$ac_t""failed" 1>&6
+else
+  echo "$ac_t""ok" 1>&6
+fi
+
+for ac_hdr in dlfcn.h
+do
+ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+echo "configure:2801: checking for $ac_hdr" >&5
+if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 2806 "configure"
+#include "confdefs.h"
+#include <$ac_hdr>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:2811: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=yes"
+else
+  echo "$ac_err" >&5
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_hdr 1
+EOF
+ 
+else
+  echo "$ac_t""no" 1>&6
+fi
+done
+
+
+
+
+
+
+# Only perform the check for file, if the check method requires it
+case $deplibs_check_method in
+file_magic*)
+  if test "$file_magic_cmd" = '$MAGIC_CMD'; then
+    echo $ac_n "checking for ${ac_tool_prefix}file""... $ac_c" 1>&6
+echo "configure:2847: checking for ${ac_tool_prefix}file" >&5
+if eval "test \"`echo '$''{'lt_cv_path_MAGIC_CMD'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  case $MAGIC_CMD in
+  /*)
+  lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path.
+  ;;
+  ?:/*)
+  lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a dos path.
+  ;;
+  *)
+  ac_save_MAGIC_CMD="$MAGIC_CMD"
+  IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS=":"
+  ac_dummy="/usr/bin:$PATH"
+  for ac_dir in $ac_dummy; do
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/${ac_tool_prefix}file; then
+      lt_cv_path_MAGIC_CMD="$ac_dir/${ac_tool_prefix}file"
+      if test -n "$file_magic_test_file"; then
+	case $deplibs_check_method in
+	"file_magic "*)
+	  file_magic_regex="`expr \"$deplibs_check_method\" : \"file_magic \(.*\)\"`"
+	  MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+	  if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null |
+	    egrep "$file_magic_regex" > /dev/null; then
+	    :
+	  else
+	    cat <<EOF 1>&2
+
+*** Warning: the command libtool uses to detect shared libraries,
+*** $file_magic_cmd, produces output that libtool cannot recognize.
+*** The result is that libtool may fail to recognize shared libraries
+*** as such.  This will affect the creation of libtool libraries that
+*** depend on shared libraries, but programs linked with such libtool
+*** libraries will work regardless of this problem.  Nevertheless, you
+*** may want to report the problem to your system manager and/or to
+*** bug-libtool@gnu.org
+
+EOF
+	  fi ;;
+	esac
+      fi
+      break
+    fi
+  done
+  IFS="$ac_save_ifs"
+  MAGIC_CMD="$ac_save_MAGIC_CMD"
+  ;;
+esac
+fi
+
+MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+if test -n "$MAGIC_CMD"; then
+  echo "$ac_t""$MAGIC_CMD" 1>&6
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+if test -z "$lt_cv_path_MAGIC_CMD"; then
+  if test -n "$ac_tool_prefix"; then
+    echo $ac_n "checking for file""... $ac_c" 1>&6
+echo "configure:2909: checking for file" >&5
+if eval "test \"`echo '$''{'lt_cv_path_MAGIC_CMD'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  case $MAGIC_CMD in
+  /*)
+  lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path.
+  ;;
+  ?:/*)
+  lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a dos path.
+  ;;
+  *)
+  ac_save_MAGIC_CMD="$MAGIC_CMD"
+  IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS=":"
+  ac_dummy="/usr/bin:$PATH"
+  for ac_dir in $ac_dummy; do
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/file; then
+      lt_cv_path_MAGIC_CMD="$ac_dir/file"
+      if test -n "$file_magic_test_file"; then
+	case $deplibs_check_method in
+	"file_magic "*)
+	  file_magic_regex="`expr \"$deplibs_check_method\" : \"file_magic \(.*\)\"`"
+	  MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+	  if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null |
+	    egrep "$file_magic_regex" > /dev/null; then
+	    :
+	  else
+	    cat <<EOF 1>&2
+
+*** Warning: the command libtool uses to detect shared libraries,
+*** $file_magic_cmd, produces output that libtool cannot recognize.
+*** The result is that libtool may fail to recognize shared libraries
+*** as such.  This will affect the creation of libtool libraries that
+*** depend on shared libraries, but programs linked with such libtool
+*** libraries will work regardless of this problem.  Nevertheless, you
+*** may want to report the problem to your system manager and/or to
+*** bug-libtool@gnu.org
+
+EOF
+	  fi ;;
+	esac
+      fi
+      break
+    fi
+  done
+  IFS="$ac_save_ifs"
+  MAGIC_CMD="$ac_save_MAGIC_CMD"
+  ;;
+esac
+fi
+
+MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+if test -n "$MAGIC_CMD"; then
+  echo "$ac_t""$MAGIC_CMD" 1>&6
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+  else
+    MAGIC_CMD=:
+  fi
+fi
+
+  fi
+  ;;
+esac
+
+# Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args.
+set dummy ${ac_tool_prefix}ranlib; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:2980: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  if test -n "$RANLIB"; then
+  ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test.
+else
+  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS=":"
+  ac_dummy="$PATH"
+  for ac_dir in $ac_dummy; do
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/$ac_word; then
+      ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib"
+      break
+    fi
+  done
+  IFS="$ac_save_ifs"
+fi
+fi
+RANLIB="$ac_cv_prog_RANLIB"
+if test -n "$RANLIB"; then
+  echo "$ac_t""$RANLIB" 1>&6
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+
+if test -z "$ac_cv_prog_RANLIB"; then
+if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "ranlib", so it can be a program name with args.
+set dummy ranlib; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:3012: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  if test -n "$RANLIB"; then
+  ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test.
+else
+  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS=":"
+  ac_dummy="$PATH"
+  for ac_dir in $ac_dummy; do
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/$ac_word; then
+      ac_cv_prog_RANLIB="ranlib"
+      break
+    fi
+  done
+  IFS="$ac_save_ifs"
+  test -z "$ac_cv_prog_RANLIB" && ac_cv_prog_RANLIB=":"
+fi
+fi
+RANLIB="$ac_cv_prog_RANLIB"
+if test -n "$RANLIB"; then
+  echo "$ac_t""$RANLIB" 1>&6
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+else
+  RANLIB=":"
+fi
+fi
+
+# Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args.
+set dummy ${ac_tool_prefix}strip; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:3047: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_STRIP'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  if test -n "$STRIP"; then
+  ac_cv_prog_STRIP="$STRIP" # Let the user override the test.
+else
+  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS=":"
+  ac_dummy="$PATH"
+  for ac_dir in $ac_dummy; do
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/$ac_word; then
+      ac_cv_prog_STRIP="${ac_tool_prefix}strip"
+      break
+    fi
+  done
+  IFS="$ac_save_ifs"
+fi
+fi
+STRIP="$ac_cv_prog_STRIP"
+if test -n "$STRIP"; then
+  echo "$ac_t""$STRIP" 1>&6
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+
+if test -z "$ac_cv_prog_STRIP"; then
+if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "strip", so it can be a program name with args.
+set dummy strip; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:3079: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_STRIP'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  if test -n "$STRIP"; then
+  ac_cv_prog_STRIP="$STRIP" # Let the user override the test.
+else
+  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS=":"
+  ac_dummy="$PATH"
+  for ac_dir in $ac_dummy; do
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/$ac_word; then
+      ac_cv_prog_STRIP="strip"
+      break
+    fi
+  done
+  IFS="$ac_save_ifs"
+  test -z "$ac_cv_prog_STRIP" && ac_cv_prog_STRIP=":"
+fi
+fi
+STRIP="$ac_cv_prog_STRIP"
+if test -n "$STRIP"; then
+  echo "$ac_t""$STRIP" 1>&6
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+else
+  STRIP=":"
+fi
+fi
+
+
+enable_dlopen=yes
+enable_win32_dll=yes
+
+# Check whether --enable-libtool-lock or --disable-libtool-lock was given.
+if test "${enable_libtool_lock+set}" = set; then
+  enableval="$enable_libtool_lock"
+  :
+fi
+
+test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes
+
+# Some flags need to be propagated to the compiler or linker for good
+# libtool support.
+case $host in
+*-*-irix6*)
+  # Find out which ABI we are using.
+  echo '#line 3128 "configure"' > conftest.$ac_ext
+  if { (eval echo configure:3129: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+    case `/usr/bin/file conftest.$ac_objext` in
+    *32-bit*)
+      LD="${LD-ld} -32"
+      ;;
+    *N32*)
+      LD="${LD-ld} -n32"
+      ;;
+    *64-bit*)
+      LD="${LD-ld} -64"
+      ;;
+    esac
+  fi
+  rm -rf conftest*
+  ;;
+
+*-*-sco3.2v5*)
+  # On SCO OpenServer 5, we need -belf to get full-featured binaries.
+  SAVE_CFLAGS="$CFLAGS"
+  CFLAGS="$CFLAGS -belf"
+  echo $ac_n "checking whether the C compiler needs -belf""... $ac_c" 1>&6
+echo "configure:3150: checking whether the C compiler needs -belf" >&5
+if eval "test \"`echo '$''{'lt_cv_cc_needs_belf'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+     ac_ext=c
+# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
+ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
+cross_compiling=$ac_cv_prog_cc_cross
+
+     cat > conftest.$ac_ext <<EOF
+#line 3163 "configure"
+#include "confdefs.h"
+
+int main() {
+
+; return 0; }
+EOF
+if { (eval echo configure:3170: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  lt_cv_cc_needs_belf=yes
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  lt_cv_cc_needs_belf=no
+fi
+rm -f conftest*
+     ac_ext=c
+# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
+ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
+cross_compiling=$ac_cv_prog_cc_cross
+
+fi
+
+echo "$ac_t""$lt_cv_cc_needs_belf" 1>&6
+  if test x"$lt_cv_cc_needs_belf" != x"yes"; then
+    # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf
+    CFLAGS="$SAVE_CFLAGS"
+  fi
+  ;;
+
+*-*-cygwin* | *-*-mingw* | *-*-pw32*)
+  # Extract the first word of "${ac_tool_prefix}dlltool", so it can be a program name with args.
+set dummy ${ac_tool_prefix}dlltool; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:3200: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_DLLTOOL'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  if test -n "$DLLTOOL"; then
+  ac_cv_prog_DLLTOOL="$DLLTOOL" # Let the user override the test.
+else
+  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS=":"
+  ac_dummy="$PATH"
+  for ac_dir in $ac_dummy; do
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/$ac_word; then
+      ac_cv_prog_DLLTOOL="${ac_tool_prefix}dlltool"
+      break
+    fi
+  done
+  IFS="$ac_save_ifs"
+fi
+fi
+DLLTOOL="$ac_cv_prog_DLLTOOL"
+if test -n "$DLLTOOL"; then
+  echo "$ac_t""$DLLTOOL" 1>&6
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+
+if test -z "$ac_cv_prog_DLLTOOL"; then
+if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "dlltool", so it can be a program name with args.
+set dummy dlltool; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:3232: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_DLLTOOL'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  if test -n "$DLLTOOL"; then
+  ac_cv_prog_DLLTOOL="$DLLTOOL" # Let the user override the test.
+else
+  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS=":"
+  ac_dummy="$PATH"
+  for ac_dir in $ac_dummy; do
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/$ac_word; then
+      ac_cv_prog_DLLTOOL="dlltool"
+      break
+    fi
+  done
+  IFS="$ac_save_ifs"
+  test -z "$ac_cv_prog_DLLTOOL" && ac_cv_prog_DLLTOOL="false"
+fi
+fi
+DLLTOOL="$ac_cv_prog_DLLTOOL"
+if test -n "$DLLTOOL"; then
+  echo "$ac_t""$DLLTOOL" 1>&6
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+else
+  DLLTOOL="false"
+fi
+fi
+
+  # Extract the first word of "${ac_tool_prefix}as", so it can be a program name with args.
+set dummy ${ac_tool_prefix}as; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:3267: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_AS'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  if test -n "$AS"; then
+  ac_cv_prog_AS="$AS" # Let the user override the test.
+else
+  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS=":"
+  ac_dummy="$PATH"
+  for ac_dir in $ac_dummy; do
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/$ac_word; then
+      ac_cv_prog_AS="${ac_tool_prefix}as"
+      break
+    fi
+  done
+  IFS="$ac_save_ifs"
+fi
+fi
+AS="$ac_cv_prog_AS"
+if test -n "$AS"; then
+  echo "$ac_t""$AS" 1>&6
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+
+if test -z "$ac_cv_prog_AS"; then
+if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "as", so it can be a program name with args.
+set dummy as; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:3299: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_AS'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  if test -n "$AS"; then
+  ac_cv_prog_AS="$AS" # Let the user override the test.
+else
+  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS=":"
+  ac_dummy="$PATH"
+  for ac_dir in $ac_dummy; do
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/$ac_word; then
+      ac_cv_prog_AS="as"
+      break
+    fi
+  done
+  IFS="$ac_save_ifs"
+  test -z "$ac_cv_prog_AS" && ac_cv_prog_AS="false"
+fi
+fi
+AS="$ac_cv_prog_AS"
+if test -n "$AS"; then
+  echo "$ac_t""$AS" 1>&6
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+else
+  AS="false"
+fi
+fi
+
+  # Extract the first word of "${ac_tool_prefix}objdump", so it can be a program name with args.
+set dummy ${ac_tool_prefix}objdump; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:3334: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_OBJDUMP'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  if test -n "$OBJDUMP"; then
+  ac_cv_prog_OBJDUMP="$OBJDUMP" # Let the user override the test.
+else
+  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS=":"
+  ac_dummy="$PATH"
+  for ac_dir in $ac_dummy; do
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/$ac_word; then
+      ac_cv_prog_OBJDUMP="${ac_tool_prefix}objdump"
+      break
+    fi
+  done
+  IFS="$ac_save_ifs"
+fi
+fi
+OBJDUMP="$ac_cv_prog_OBJDUMP"
+if test -n "$OBJDUMP"; then
+  echo "$ac_t""$OBJDUMP" 1>&6
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+
+if test -z "$ac_cv_prog_OBJDUMP"; then
+if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "objdump", so it can be a program name with args.
+set dummy objdump; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:3366: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_OBJDUMP'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  if test -n "$OBJDUMP"; then
+  ac_cv_prog_OBJDUMP="$OBJDUMP" # Let the user override the test.
+else
+  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS=":"
+  ac_dummy="$PATH"
+  for ac_dir in $ac_dummy; do
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/$ac_word; then
+      ac_cv_prog_OBJDUMP="objdump"
+      break
+    fi
+  done
+  IFS="$ac_save_ifs"
+  test -z "$ac_cv_prog_OBJDUMP" && ac_cv_prog_OBJDUMP="false"
+fi
+fi
+OBJDUMP="$ac_cv_prog_OBJDUMP"
+if test -n "$OBJDUMP"; then
+  echo "$ac_t""$OBJDUMP" 1>&6
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+else
+  OBJDUMP="false"
+fi
+fi
+
+
+  # recent cygwin and mingw systems supply a stub DllMain which the user
+  # can override, but on older systems we have to supply one
+  echo $ac_n "checking if libtool should supply DllMain function""... $ac_c" 1>&6
+echo "configure:3402: checking if libtool should supply DllMain function" >&5
+if eval "test \"`echo '$''{'lt_cv_need_dllmain'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 3407 "configure"
+#include "confdefs.h"
+
+int main() {
+extern int __attribute__((__stdcall__)) DllMain(void*, int, void*);
+      DllMain (0, 0, 0);
+; return 0; }
+EOF
+if { (eval echo configure:3415: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  lt_cv_need_dllmain=no
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  lt_cv_need_dllmain=yes
+fi
+rm -f conftest*
+fi
+
+echo "$ac_t""$lt_cv_need_dllmain" 1>&6
+
+  case $host/$CC in
+  *-*-cygwin*/gcc*-mno-cygwin*|*-*-mingw*)
+    # old mingw systems require "-dll" to link a DLL, while more recent ones
+    # require "-mdll"
+    SAVE_CFLAGS="$CFLAGS"
+    CFLAGS="$CFLAGS -mdll"
+    echo $ac_n "checking how to link DLLs""... $ac_c" 1>&6
+echo "configure:3436: checking how to link DLLs" >&5
+if eval "test \"`echo '$''{'lt_cv_cc_dll_switch'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 3441 "configure"
+#include "confdefs.h"
+
+int main() {
+
+; return 0; }
+EOF
+if { (eval echo configure:3448: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  lt_cv_cc_dll_switch=-mdll
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  lt_cv_cc_dll_switch=-dll
+fi
+rm -f conftest*
+fi
+
+echo "$ac_t""$lt_cv_cc_dll_switch" 1>&6
+    CFLAGS="$SAVE_CFLAGS" ;;
+  *-*-cygwin* | *-*-pw32*)
+    # cygwin systems need to pass --dll to the linker, and not link
+    # crt.o which will require a WinMain@16 definition.
+    lt_cv_cc_dll_switch="-Wl,--dll -nostartfiles" ;;
+  esac
+  ;;
+  
+esac
+
+# Sed substitution that helps us do robust quoting.  It backslashifies
+# metacharacters that are still active within double-quoted strings.
+Xsed='sed -e s/^X//'
+sed_quote_subst='s/\([\\"\\`$\\\\]\)/\\\1/g'
+
+# Same as above, but do not quote variable references.
+double_quote_subst='s/\([\\"\\`\\\\]\)/\\\1/g'
+
+# Sed substitution to delay expansion of an escaped shell variable in a
+# double_quote_subst'ed string.
+delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g'
+
+# Constants:
+rm="rm -f"
+
+# Global variables:
+default_ofile=libtool
+can_build_shared=yes
+
+# All known linkers require a `.a' archive for static linking (except M$VC,
+# which needs '.lib').
+libext=a
+ltmain="$ac_aux_dir/ltmain.sh"
+ofile="$default_ofile"
+with_gnu_ld="$lt_cv_prog_gnu_ld"
+need_locks="$enable_libtool_lock"
+
+old_CC="$CC"
+old_CFLAGS="$CFLAGS"
+
+# Set sane defaults for various variables
+test -z "$AR" && AR=ar
+test -z "$AR_FLAGS" && AR_FLAGS=cru
+test -z "$AS" && AS=as
+test -z "$CC" && CC=cc
+test -z "$DLLTOOL" && DLLTOOL=dlltool
+test -z "$LD" && LD=ld
+test -z "$LN_S" && LN_S="ln -s"
+test -z "$MAGIC_CMD" && MAGIC_CMD=file
+test -z "$NM" && NM=nm
+test -z "$OBJDUMP" && OBJDUMP=objdump
+test -z "$RANLIB" && RANLIB=:
+test -z "$STRIP" && STRIP=:
+test -z "$ac_objext" && ac_objext=o
+
+if test x"$host" != x"$build"; then
+  ac_tool_prefix=${host_alias}-
+else
+  ac_tool_prefix=
+fi
+
+# Transform linux* to *-*-linux-gnu*, to support old configure scripts.
+case $host_os in
+linux-gnu*) ;;
+linux*) host=`echo $host | sed 's/^\(.*-.*-linux\)\(.*\)$/\1-gnu\2/'`
+esac
+
+case $host_os in
+aix3*)
+  # AIX sometimes has problems with the GCC collect2 program.  For some
+  # reason, if we set the COLLECT_NAMES environment variable, the problems
+  # vanish in a puff of smoke.
+  if test "X${COLLECT_NAMES+set}" != Xset; then
+    COLLECT_NAMES=
+    export COLLECT_NAMES
+  fi
+  ;;
+esac
+
+# Determine commands to create old-style static archives.
+old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs$old_deplibs'
+old_postinstall_cmds='chmod 644 $oldlib'
+old_postuninstall_cmds=
+
+if test -n "$RANLIB"; then
+  case $host_os in
+  openbsd*)
+    old_postinstall_cmds="\$RANLIB -t \$oldlib~$old_postinstall_cmds"
+    ;;
+  *)
+    old_postinstall_cmds="\$RANLIB \$oldlib~$old_postinstall_cmds"
+    ;;
+  esac
+  old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib"
+fi
+
+# Allow CC to be a program name with arguments.
+set dummy $CC
+compiler="$2"
+
+## FIXME: this should be a separate macro
+##
+echo $ac_n "checking for objdir""... $ac_c" 1>&6
+echo "configure:3564: checking for objdir" >&5
+rm -f .libs 2>/dev/null
+mkdir .libs 2>/dev/null
+if test -d .libs; then
+  objdir=.libs
+else
+  # MS-DOS does not allow filenames that begin with a dot.
+  objdir=_libs
+fi
+rmdir .libs 2>/dev/null
+echo "$ac_t""$objdir" 1>&6
+##
+## END FIXME
+
+
+## FIXME: this should be a separate macro
+##
+# Check whether --with-pic or --without-pic was given.
+if test "${with_pic+set}" = set; then
+  withval="$with_pic"
+  pic_mode="$withval"
+else
+  pic_mode=default
+fi
+
+test -z "$pic_mode" && pic_mode=default
+
+# We assume here that the value for lt_cv_prog_cc_pic will not be cached
+# in isolation, and that seeing it set (from the cache) indicates that
+# the associated values are set (in the cache) correctly too.
+echo $ac_n "checking for $compiler option to produce PIC""... $ac_c" 1>&6
+echo "configure:3595: checking for $compiler option to produce PIC" >&5
+if eval "test \"`echo '$''{'lt_cv_prog_cc_pic'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+   lt_cv_prog_cc_pic=
+  lt_cv_prog_cc_shlib=
+  lt_cv_prog_cc_wl=
+  lt_cv_prog_cc_static=
+  lt_cv_prog_cc_no_builtin=
+  lt_cv_prog_cc_can_build_shared=$can_build_shared
+
+  if test "$GCC" = yes; then
+    lt_cv_prog_cc_wl='-Wl,'
+    lt_cv_prog_cc_static='-static'
+
+    case $host_os in
+    aix*)
+      # Below there is a dirty hack to force normal static linking with -ldl
+      # The problem is because libdl dynamically linked with both libc and
+      # libC (AIX C++ library), which obviously doesn't included in libraries
+      # list by gcc. This cause undefined symbols with -static flags.
+      # This hack allows C programs to be linked with "-static -ldl", but
+      # not sure about C++ programs.
+      lt_cv_prog_cc_static="$lt_cv_prog_cc_static ${lt_cv_prog_cc_wl}-lC"
+      ;;
+    amigaos*)
+      # FIXME: we need at least 68020 code to build shared libraries, but
+      # adding the `-m68020' flag to GCC prevents building anything better,
+      # like `-m68040'.
+      lt_cv_prog_cc_pic='-m68020 -resident32 -malways-restore-a4'
+      ;;
+    beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
+      # PIC is the default for these OSes.
+      ;;
+    darwin* | rhapsody*)
+      # PIC is the default on this platform
+      # Common symbols not allowed in MH_DYLIB files
+      lt_cv_prog_cc_pic='-fno-common'
+      ;;
+    cygwin* | mingw* | pw32* | os2*)
+      # This hack is so that the source file can tell whether it is being
+      # built for inclusion in a dll (and should export symbols for example).
+      lt_cv_prog_cc_pic='-DDLL_EXPORT'
+      ;;
+    sysv4*MP*)
+      if test -d /usr/nec; then
+	 lt_cv_prog_cc_pic=-Kconform_pic
+      fi
+      ;;
+    *)
+      lt_cv_prog_cc_pic='-fPIC'
+      ;;
+    esac
+  else
+    # PORTME Check for PIC flags for the system compiler.
+    case $host_os in
+    aix3* | aix4* | aix5*)
+      lt_cv_prog_cc_wl='-Wl,'
+      # All AIX code is PIC.
+      if test "$host_cpu" = ia64; then
+	# AIX 5 now supports IA64 processor
+	lt_cv_prog_cc_static='-Bstatic'
+      else
+	lt_cv_prog_cc_static='-bnso -bI:/lib/syscalls.exp'
+      fi
+      ;;
+
+    hpux9* | hpux10* | hpux11*)
+      # Is there a better lt_cv_prog_cc_static that works with the bundled CC?
+      lt_cv_prog_cc_wl='-Wl,'
+      lt_cv_prog_cc_static="${lt_cv_prog_cc_wl}-a ${lt_cv_prog_cc_wl}archive"
+      lt_cv_prog_cc_pic='+Z'
+      ;;
+
+    irix5* | irix6* | nonstopux*)
+      lt_cv_prog_cc_wl='-Wl,'
+      lt_cv_prog_cc_static='-non_shared'
+      # PIC (with -KPIC) is the default.
+      ;;
+
+    cygwin* | mingw* | pw32* | os2*)
+      # This hack is so that the source file can tell whether it is being
+      # built for inclusion in a dll (and should export symbols for example).
+      lt_cv_prog_cc_pic='-DDLL_EXPORT'
+      ;;
+
+    newsos6)
+      lt_cv_prog_cc_pic='-KPIC'
+      lt_cv_prog_cc_static='-Bstatic'
+      ;;
+
+    osf3* | osf4* | osf5*)
+      # All OSF/1 code is PIC.
+      lt_cv_prog_cc_wl='-Wl,'
+      lt_cv_prog_cc_static='-non_shared'
+      ;;
+
+    sco3.2v5*)
+      lt_cv_prog_cc_pic='-Kpic'
+      lt_cv_prog_cc_static='-dn'
+      lt_cv_prog_cc_shlib='-belf'
+      ;;
+
+    solaris*)
+      lt_cv_prog_cc_pic='-KPIC'
+      lt_cv_prog_cc_static='-Bstatic'
+      lt_cv_prog_cc_wl='-Wl,'
+      ;;
+
+    sunos4*)
+      lt_cv_prog_cc_pic='-PIC'
+      lt_cv_prog_cc_static='-Bstatic'
+      lt_cv_prog_cc_wl='-Qoption ld '
+      ;;
+
+    sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
+      lt_cv_prog_cc_pic='-KPIC'
+      lt_cv_prog_cc_static='-Bstatic'
+      lt_cv_prog_cc_wl='-Wl,'
+      ;;
+
+    uts4*)
+      lt_cv_prog_cc_pic='-pic'
+      lt_cv_prog_cc_static='-Bstatic'
+      ;;
+
+    sysv4*MP*)
+      if test -d /usr/nec ;then
+	lt_cv_prog_cc_pic='-Kconform_pic'
+	lt_cv_prog_cc_static='-Bstatic'
+      fi
+      ;;
+
+    *)
+      lt_cv_prog_cc_can_build_shared=no
+      ;;
+    esac
+  fi
+
+fi
+
+if test -z "$lt_cv_prog_cc_pic"; then
+  echo "$ac_t""none" 1>&6
+else
+  echo "$ac_t""$lt_cv_prog_cc_pic" 1>&6
+
+  # Check to make sure the pic_flag actually works.
+  echo $ac_n "checking if $compiler PIC flag $lt_cv_prog_cc_pic works""... $ac_c" 1>&6
+echo "configure:3743: checking if $compiler PIC flag $lt_cv_prog_cc_pic works" >&5
+  if eval "test \"`echo '$''{'lt_cv_prog_cc_pic_works'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+      save_CFLAGS="$CFLAGS"
+    CFLAGS="$CFLAGS $lt_cv_prog_cc_pic -DPIC"
+    cat > conftest.$ac_ext <<EOF
+#line 3750 "configure"
+#include "confdefs.h"
+
+int main() {
+
+; return 0; }
+EOF
+if { (eval echo configure:3757: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+        case $host_os in
+      hpux9* | hpux10* | hpux11*)
+	# On HP-UX, both CC and GCC only warn that PIC is supported... then
+	# they create non-PIC objects.  So, if there were any warnings, we
+	# assume that PIC is not supported.
+	if test -s conftest.err; then
+	  lt_cv_prog_cc_pic_works=no
+	else
+	  lt_cv_prog_cc_pic_works=yes
+	fi
+	;;
+      *)
+	lt_cv_prog_cc_pic_works=yes
+	;;
+      esac
+    
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+        lt_cv_prog_cc_pic_works=no
+    
+fi
+rm -f conftest*
+    CFLAGS="$save_CFLAGS"
+  
+fi
+
+
+  if test "X$lt_cv_prog_cc_pic_works" = Xno; then
+    lt_cv_prog_cc_pic=
+    lt_cv_prog_cc_can_build_shared=no
+  else
+    lt_cv_prog_cc_pic=" $lt_cv_prog_cc_pic"
+  fi
+
+  echo "$ac_t""$lt_cv_prog_cc_pic_works" 1>&6
+fi
+##
+## END FIXME
+
+# Check for any special shared library compilation flags.
+if test -n "$lt_cv_prog_cc_shlib"; then
+  echo "configure: warning: \`$CC' requires \`$lt_cv_prog_cc_shlib' to build shared libraries" 1>&2
+  if echo "$old_CC $old_CFLAGS " | egrep -e "[ 	]$lt_cv_prog_cc_shlib[ 	]" >/dev/null; then :
+  else
+   echo "configure: warning: add \`$lt_cv_prog_cc_shlib' to the CC or CFLAGS env variable and reconfigure" 1>&2
+    lt_cv_prog_cc_can_build_shared=no
+  fi
+fi
+
+## FIXME: this should be a separate macro
+##
+echo $ac_n "checking if $compiler static flag $lt_cv_prog_cc_static works""... $ac_c" 1>&6
+echo "configure:3813: checking if $compiler static flag $lt_cv_prog_cc_static works" >&5
+if eval "test \"`echo '$''{'lt_cv_prog_cc_static_works'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+    lt_cv_prog_cc_static_works=no
+  save_LDFLAGS="$LDFLAGS"
+  LDFLAGS="$LDFLAGS $lt_cv_prog_cc_static"
+  cat > conftest.$ac_ext <<EOF
+#line 3821 "configure"
+#include "confdefs.h"
+
+int main() {
+
+; return 0; }
+EOF
+if { (eval echo configure:3828: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  lt_cv_prog_cc_static_works=yes
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+fi
+rm -f conftest*
+  LDFLAGS="$save_LDFLAGS"
+
+fi
+
+
+# Belt *and* braces to stop my trousers falling down:
+test "X$lt_cv_prog_cc_static_works" = Xno && lt_cv_prog_cc_static=
+echo "$ac_t""$lt_cv_prog_cc_static_works" 1>&6
+
+pic_flag="$lt_cv_prog_cc_pic"
+special_shlib_compile_flags="$lt_cv_prog_cc_shlib"
+wl="$lt_cv_prog_cc_wl"
+link_static_flag="$lt_cv_prog_cc_static"
+no_builtin_flag="$lt_cv_prog_cc_no_builtin"
+can_build_shared="$lt_cv_prog_cc_can_build_shared"
+##
+## END FIXME
+
+
+## FIXME: this should be a separate macro
+##
+# Check to see if options -o and -c are simultaneously supported by compiler
+echo $ac_n "checking if $compiler supports -c -o file.$ac_objext""... $ac_c" 1>&6
+echo "configure:3859: checking if $compiler supports -c -o file.$ac_objext" >&5
+if eval "test \"`echo '$''{'lt_cv_compiler_c_o'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+$rm -r conftest 2>/dev/null
+mkdir conftest
+cd conftest
+echo "int some_variable = 0;" > conftest.$ac_ext
+mkdir out
+# According to Tom Tromey, Ian Lance Taylor reported there are C compilers
+# that will create temporary files in the current directory regardless of
+# the output directory.  Thus, making CWD read-only will cause this test
+# to fail, enabling locking or at least warning the user not to do parallel
+# builds.
+chmod -w .
+save_CFLAGS="$CFLAGS"
+CFLAGS="$CFLAGS -o out/conftest2.$ac_objext"
+compiler_c_o=no
+if { (eval echo configure:3878: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>out/conftest.err; } && test -s out/conftest2.$ac_objext; then
+  # The compiler can only warn and ignore the option if not recognized
+  # So say no if there are warnings
+  if test -s out/conftest.err; then
+    lt_cv_compiler_c_o=no
+  else
+    lt_cv_compiler_c_o=yes
+  fi
+else
+  # Append any errors to the config.log.
+  cat out/conftest.err 1>&5
+  lt_cv_compiler_c_o=no
+fi
+CFLAGS="$save_CFLAGS"
+chmod u+w .
+$rm conftest* out/*
+rmdir out
+cd ..
+rmdir conftest
+$rm -r conftest 2>/dev/null
+
+fi
+
+compiler_c_o=$lt_cv_compiler_c_o
+echo "$ac_t""$compiler_c_o" 1>&6
+
+if test x"$compiler_c_o" = x"yes"; then
+  # Check to see if we can write to a .lo
+  echo $ac_n "checking if $compiler supports -c -o file.lo""... $ac_c" 1>&6
+echo "configure:3907: checking if $compiler supports -c -o file.lo" >&5
+  if eval "test \"`echo '$''{'lt_cv_compiler_o_lo'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+  lt_cv_compiler_o_lo=no
+  save_CFLAGS="$CFLAGS"
+  CFLAGS="$CFLAGS -c -o conftest.lo"
+  save_objext="$ac_objext"
+  ac_objext=lo
+  cat > conftest.$ac_ext <<EOF
+#line 3918 "configure"
+#include "confdefs.h"
+
+int main() {
+int some_variable = 0;
+; return 0; }
+EOF
+if { (eval echo configure:3925: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+      # The compiler can only warn and ignore the option if not recognized
+    # So say no if there are warnings
+    if test -s conftest.err; then
+      lt_cv_compiler_o_lo=no
+    else
+      lt_cv_compiler_o_lo=yes
+    fi
+  
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+fi
+rm -f conftest*
+  ac_objext="$save_objext"
+  CFLAGS="$save_CFLAGS"
+  
+fi
+
+  compiler_o_lo=$lt_cv_compiler_o_lo
+  echo "$ac_t""$compiler_o_lo" 1>&6
+else
+  compiler_o_lo=no
+fi
+##
+## END FIXME
+
+## FIXME: this should be a separate macro
+##
+# Check to see if we can do hard links to lock some files if needed
+hard_links="nottested"
+if test "$compiler_c_o" = no && test "$need_locks" != no; then
+  # do not overwrite the value of need_locks provided by the user
+  echo $ac_n "checking if we can lock with hard links""... $ac_c" 1>&6
+echo "configure:3960: checking if we can lock with hard links" >&5
+  hard_links=yes
+  $rm conftest*
+  ln conftest.a conftest.b 2>/dev/null && hard_links=no
+  touch conftest.a
+  ln conftest.a conftest.b 2>&5 || hard_links=no
+  ln conftest.a conftest.b 2>/dev/null && hard_links=no
+  echo "$ac_t""$hard_links" 1>&6
+  if test "$hard_links" = no; then
+    echo "configure: warning: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" 1>&2
+    need_locks=warn
+  fi
+else
+  need_locks=no
+fi
+##
+## END FIXME
+
+## FIXME: this should be a separate macro
+##
+if test "$GCC" = yes; then
+  # Check to see if options -fno-rtti -fno-exceptions are supported by compiler
+  echo $ac_n "checking if $compiler supports -fno-rtti -fno-exceptions""... $ac_c" 1>&6
+echo "configure:3983: checking if $compiler supports -fno-rtti -fno-exceptions" >&5
+  echo "int some_variable = 0;" > conftest.$ac_ext
+  save_CFLAGS="$CFLAGS"
+  CFLAGS="$CFLAGS -fno-rtti -fno-exceptions -c conftest.$ac_ext"
+  compiler_rtti_exceptions=no
+  cat > conftest.$ac_ext <<EOF
+#line 3989 "configure"
+#include "confdefs.h"
+
+int main() {
+int some_variable = 0;
+; return 0; }
+EOF
+if { (eval echo configure:3996: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+      # The compiler can only warn and ignore the option if not recognized
+    # So say no if there are warnings
+    if test -s conftest.err; then
+      compiler_rtti_exceptions=no
+    else
+      compiler_rtti_exceptions=yes
+    fi
+  
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+fi
+rm -f conftest*
+  CFLAGS="$save_CFLAGS"
+  echo "$ac_t""$compiler_rtti_exceptions" 1>&6
+
+  if test "$compiler_rtti_exceptions" = "yes"; then
+    no_builtin_flag=' -fno-builtin -fno-rtti -fno-exceptions'
+  else
+    no_builtin_flag=' -fno-builtin'
+  fi
+fi
+##
+## END FIXME
+
+## FIXME: this should be a separate macro
+##
+# See if the linker supports building shared libraries.
+echo $ac_n "checking whether the linker ($LD) supports shared libraries""... $ac_c" 1>&6
+echo "configure:4027: checking whether the linker ($LD) supports shared libraries" >&5
+
+allow_undefined_flag=
+no_undefined_flag=
+need_lib_prefix=unknown
+need_version=unknown
+# when you set need_version to no, make sure it does not cause -set_version
+# flags to be left without arguments
+archive_cmds=
+archive_expsym_cmds=
+old_archive_from_new_cmds=
+old_archive_from_expsyms_cmds=
+export_dynamic_flag_spec=
+whole_archive_flag_spec=
+thread_safe_flag_spec=
+hardcode_into_libs=no
+hardcode_libdir_flag_spec=
+hardcode_libdir_separator=
+hardcode_direct=no
+hardcode_minus_L=no
+hardcode_shlibpath_var=unsupported
+runpath_var=
+link_all_deplibs=unknown
+always_export_symbols=no
+export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | sed '\''s/.* //'\'' | sort | uniq > $export_symbols'
+# include_expsyms should be a list of space-separated symbols to be *always*
+# included in the symbol list
+include_expsyms=
+# exclude_expsyms can be an egrep regular expression of symbols to exclude
+# it will be wrapped by ` (' and `)$', so one must not match beginning or
+# end of line.  Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc',
+# as well as any symbol that contains `d'.
+exclude_expsyms="_GLOBAL_OFFSET_TABLE_"
+# Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out
+# platforms (ab)use it in PIC code, but their linkers get confused if
+# the symbol is explicitly referenced.  Since portable code cannot
+# rely on this symbol name, it's probably fine to never include it in
+# preloaded symbol tables.
+extract_expsyms_cmds=
+
+case $host_os in
+cygwin* | mingw* | pw32*)
+  # FIXME: the MSVC++ port hasn't been tested in a loooong time
+  # When not using gcc, we currently assume that we are using
+  # Microsoft Visual C++.
+  if test "$GCC" != yes; then
+    with_gnu_ld=no
+  fi
+  ;;
+openbsd*)
+  with_gnu_ld=no
+  ;;
+esac
+
+ld_shlibs=yes
+if test "$with_gnu_ld" = yes; then
+  # If archive_cmds runs LD, not CC, wlarc should be empty
+  wlarc='${wl}'
+
+  # See if GNU ld supports shared libraries.
+  case $host_os in
+  aix3* | aix4* | aix5*)
+    # On AIX, the GNU linker is very broken
+    # Note:Check GNU linker on AIX 5-IA64 when/if it becomes available.
+    ld_shlibs=no
+    cat <<EOF 1>&2
+
+*** Warning: the GNU linker, at least up to release 2.9.1, is reported
+*** to be unable to reliably create shared libraries on AIX.
+*** Therefore, libtool is disabling shared libraries support.  If you
+*** really care for shared libraries, you may want to modify your PATH
+*** so that a non-GNU linker is found, and then restart.
+
+EOF
+    ;;
+
+  amigaos*)
+    archive_cmds='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
+    hardcode_libdir_flag_spec='-L$libdir'
+    hardcode_minus_L=yes
+
+    # Samuel A. Falvo II <kc5tja@dolphin.openprojects.net> reports
+    # that the semantics of dynamic libraries on AmigaOS, at least up
+    # to version 4, is to share data among multiple programs linked
+    # with the same dynamic library.  Since this doesn't match the
+    # behavior of shared libraries on other platforms, we can use
+    # them.
+    ld_shlibs=no
+    ;;
+
+  beos*)
+    if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then
+      allow_undefined_flag=unsupported
+      # Joseph Beckenbach <jrb3@best.com> says some releases of gcc
+      # support --undefined.  This deserves some investigation.  FIXME
+      archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+    else
+      ld_shlibs=no
+    fi
+    ;;
+
+  cygwin* | mingw* | pw32*)
+    # hardcode_libdir_flag_spec is actually meaningless, as there is
+    # no search path for DLLs.
+    hardcode_libdir_flag_spec='-L$libdir'
+    allow_undefined_flag=unsupported
+    always_export_symbols=yes
+
+    extract_expsyms_cmds='test -f $output_objdir/impgen.c || \
+      sed -e "/^# \/\* impgen\.c starts here \*\//,/^# \/\* impgen.c ends here \*\// { s/^# //;s/^# *$//; p; }" -e d < $''0 > $output_objdir/impgen.c~
+      test -f $output_objdir/impgen.exe || (cd $output_objdir && \
+      if test "x$HOST_CC" != "x" ; then $HOST_CC -o impgen impgen.c ; \
+      else $CC -o impgen impgen.c ; fi)~
+      $output_objdir/impgen $dir/$soroot > $output_objdir/$soname-def'
+
+    old_archive_from_expsyms_cmds='$DLLTOOL --as=$AS --dllname $soname --def $output_objdir/$soname-def --output-lib $output_objdir/$newlib'
+
+    # cygwin and mingw dlls have different entry points and sets of symbols
+    # to exclude.
+    # FIXME: what about values for MSVC?
+    dll_entry=__cygwin_dll_entry@12
+    dll_exclude_symbols=DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12~
+    case $host_os in
+    mingw*)
+      # mingw values
+      dll_entry=_DllMainCRTStartup@12
+      dll_exclude_symbols=DllMain@12,DllMainCRTStartup@12,DllEntryPoint@12~
+      ;;
+    esac
+
+    # mingw and cygwin differ, and it's simplest to just exclude the union
+    # of the two symbol sets.
+    dll_exclude_symbols=DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12,DllMainCRTStartup@12,DllEntryPoint@12
+
+    # recent cygwin and mingw systems supply a stub DllMain which the user
+    # can override, but on older systems we have to supply one (in ltdll.c)
+    if test "x$lt_cv_need_dllmain" = "xyes"; then
+      ltdll_obj='$output_objdir/$soname-ltdll.'"$ac_objext "
+      ltdll_cmds='test -f $output_objdir/$soname-ltdll.c || sed -e "/^# \/\* ltdll\.c starts here \*\//,/^# \/\* ltdll.c ends here \*\// { s/^# //; p; }" -e d < $''0 > $output_objdir/$soname-ltdll.c~
+	test -f $output_objdir/$soname-ltdll.$ac_objext || (cd $output_objdir && $CC -c $soname-ltdll.c)~'
+    else
+      ltdll_obj=
+      ltdll_cmds=
+    fi
+
+    # Extract the symbol export list from an `--export-all' def file,
+    # then regenerate the def file from the symbol export list, so that
+    # the compiled dll only exports the symbol export list.
+    # Be careful not to strip the DATA tag left be newer dlltools.
+    export_symbols_cmds="$ltdll_cmds"'
+      $DLLTOOL --export-all --exclude-symbols '$dll_exclude_symbols' --output-def $output_objdir/$soname-def '$ltdll_obj'$libobjs $convenience~
+      sed -e "1,/EXPORTS/d" -e "s/ @ [0-9]*//" -e "s/ *;.*$//" < $output_objdir/$soname-def > $export_symbols'
+
+    # If the export-symbols file already is a .def file (1st line
+    # is EXPORTS), use it as is.
+    # If DATA tags from a recent dlltool are present, honour them!
+    archive_expsym_cmds='if test "x`sed 1q $export_symbols`" = xEXPORTS; then
+	cp $export_symbols $output_objdir/$soname-def;
+      else
+	echo EXPORTS > $output_objdir/$soname-def;
+	_lt_hint=1;
+	cat $export_symbols | while read symbol; do
+	 set dummy \$symbol;
+	 case \$# in
+	   2) echo "   \$2 @ \$_lt_hint ; " >> $output_objdir/$soname-def;;
+	   4) echo "   \$2 \$3 \$4 ; " >> $output_objdir/$soname-def; _lt_hint=`expr \$_lt_hint - 1`;;
+	   *) echo "     \$2 @ \$_lt_hint \$3 ; " >> $output_objdir/$soname-def;;
+	 esac;
+	 _lt_hint=`expr 1 + \$_lt_hint`;
+	done;
+      fi~
+      '"$ltdll_cmds"'
+      $CC -Wl,--base-file,$output_objdir/$soname-base '$lt_cv_cc_dll_switch' -Wl,-e,'$dll_entry' -o $output_objdir/$soname '$ltdll_obj'$libobjs $deplibs $compiler_flags~
+      $DLLTOOL --as=$AS --dllname $soname --exclude-symbols '$dll_exclude_symbols' --def $output_objdir/$soname-def --base-file $output_objdir/$soname-base --output-exp $output_objdir/$soname-exp~
+      $CC -Wl,--base-file,$output_objdir/$soname-base $output_objdir/$soname-exp '$lt_cv_cc_dll_switch' -Wl,-e,'$dll_entry' -o $output_objdir/$soname '$ltdll_obj'$libobjs $deplibs $compiler_flags~
+      $DLLTOOL --as=$AS --dllname $soname --exclude-symbols '$dll_exclude_symbols' --def $output_objdir/$soname-def --base-file $output_objdir/$soname-base --output-exp $output_objdir/$soname-exp --output-lib $output_objdir/$libname.dll.a~
+      $CC $output_objdir/$soname-exp '$lt_cv_cc_dll_switch' -Wl,-e,'$dll_entry' -o $output_objdir/$soname '$ltdll_obj'$libobjs $deplibs $compiler_flags'
+    ;;
+
+  netbsd*)
+    if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
+      archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib'
+      wlarc=
+    else
+      archive_cmds='$CC -shared -nodefaultlibs $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+      archive_expsym_cmds='$CC -shared -nodefaultlibs $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+    fi
+    ;;
+
+  solaris* | sysv5*)
+    if $LD -v 2>&1 | egrep 'BFD 2\.8' > /dev/null; then
+      ld_shlibs=no
+      cat <<EOF 1>&2
+
+*** Warning: The releases 2.8.* of the GNU linker cannot reliably
+*** create shared libraries on Solaris systems.  Therefore, libtool
+*** is disabling shared libraries support.  We urge you to upgrade GNU
+*** binutils to release 2.9.1 or newer.  Another option is to modify
+*** your PATH or compiler configuration so that the native linker is
+*** used, and then restart.
+
+EOF
+    elif $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then
+      archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+      archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+    else
+      ld_shlibs=no
+    fi
+    ;;
+
+  sunos4*)
+    archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+    wlarc=
+    hardcode_direct=yes
+    hardcode_shlibpath_var=no
+    ;;
+
+  *)
+    if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then
+      archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+      archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+    else
+      ld_shlibs=no
+    fi
+    ;;
+  esac
+
+  if test "$ld_shlibs" = yes; then
+    runpath_var=LD_RUN_PATH
+    hardcode_libdir_flag_spec='${wl}--rpath ${wl}$libdir'
+    export_dynamic_flag_spec='${wl}--export-dynamic'
+    case $host_os in
+    cygwin* | mingw* | pw32*)
+      # dlltool doesn't understand --whole-archive et. al.
+      whole_archive_flag_spec=
+      ;;
+    *)
+      # ancient GNU ld didn't support --whole-archive et. al.
+      if $LD --help 2>&1 | egrep 'no-whole-archive' > /dev/null; then
+	whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+      else
+	whole_archive_flag_spec=
+      fi
+      ;;
+    esac
+  fi
+else
+  # PORTME fill in a description of your system's linker (not GNU ld)
+  case $host_os in
+  aix3*)
+    allow_undefined_flag=unsupported
+    always_export_symbols=yes
+    archive_expsym_cmds='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname'
+    # Note: this linker hardcodes the directories in LIBPATH if there
+    # are no directories specified by -L.
+    hardcode_minus_L=yes
+    if test "$GCC" = yes && test -z "$link_static_flag"; then
+      # Neither direct hardcoding nor static linking is supported with a
+      # broken collect2.
+      hardcode_direct=unsupported
+    fi
+    ;;
+
+  aix4* | aix5*)
+    if test "$host_cpu" = ia64; then
+      # On IA64, the linker does run time linking by default, so we don't
+      # have to do anything special.
+      aix_use_runtimelinking=no
+      exp_sym_flag='-Bexport'
+      no_entry_flag=""
+    else
+      aix_use_runtimelinking=no
+
+      # Test if we are trying to use run time linking or normal
+      # AIX style linking. If -brtl is somewhere in LDFLAGS, we
+      # need to do runtime linking.
+      case $host_os in aix4.[23]|aix4.[23].*|aix5*)
+	for ld_flag in $LDFLAGS; do
+	  case $ld_flag in
+	  *-brtl*)
+	    aix_use_runtimelinking=yes
+	    break
+	  ;;
+	  esac
+	done
+      esac
+
+      exp_sym_flag='-bexport'
+      no_entry_flag='-bnoentry'
+    fi
+
+    # When large executables or shared objects are built, AIX ld can
+    # have problems creating the table of contents.  If linking a library
+    # or program results in "error TOC overflow" add -mminimal-toc to
+    # CXXFLAGS/CFLAGS for g++/gcc.  In the cases where that is not
+    # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS.
+
+    hardcode_direct=yes
+    archive_cmds=''
+    hardcode_libdir_separator=':'
+    if test "$GCC" = yes; then
+      case $host_os in aix4.[012]|aix4.[012].*)
+	collect2name=`${CC} -print-prog-name=collect2`
+	if test -f "$collect2name" && \
+	  strings "$collect2name" | grep resolve_lib_name >/dev/null
+	then
+	  # We have reworked collect2
+	  hardcode_direct=yes
+	else
+	  # We have old collect2
+	  hardcode_direct=unsupported
+	  # It fails to find uninstalled libraries when the uninstalled
+	  # path is not listed in the libpath.  Setting hardcode_minus_L
+	  # to unsupported forces relinking
+	  hardcode_minus_L=yes
+	  hardcode_libdir_flag_spec='-L$libdir'
+	  hardcode_libdir_separator=
+	fi
+      esac
+
+      shared_flag='-shared'
+    else
+      # not using gcc
+      if test "$host_cpu" = ia64; then
+	shared_flag='${wl}-G'
+      else
+	if test "$aix_use_runtimelinking" = yes; then
+	  shared_flag='${wl}-G'
+	else
+	  shared_flag='${wl}-bM:SRE'
+	fi
+      fi
+    fi
+
+    # It seems that -bexpall can do strange things, so it is better to
+    # generate a list of symbols to export.
+    always_export_symbols=yes
+    if test "$aix_use_runtimelinking" = yes; then
+      # Warning - without using the other runtime loading flags (-brtl),
+      # -berok will link without error, but may produce a broken library.
+      allow_undefined_flag='-berok'
+      hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:/usr/lib:/lib'
+      archive_expsym_cmds="\$CC"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols $shared_flag"
+    else
+      if test "$host_cpu" = ia64; then
+	hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib'
+	allow_undefined_flag="-z nodefs"
+	archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname ${wl}-h$soname $libobjs $deplibs $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols"
+      else
+	hardcode_libdir_flag_spec='${wl}-bnolibpath ${wl}-blibpath:$libdir:/usr/lib:/lib'
+	# Warning - without using the other run time loading flags,
+	# -berok will link without error, but may produce a broken library.
+	allow_undefined_flag='${wl}-berok'
+	# This is a bit strange, but is similar to how AIX traditionally builds
+	# it's shared libraries.
+	archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols"' ~$AR -crlo $objdir/$libname$release.a $objdir/$soname'
+      fi
+    fi
+    ;;
+
+  amigaos*)
+    archive_cmds='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
+    hardcode_libdir_flag_spec='-L$libdir'
+    hardcode_minus_L=yes
+    # see comment about different semantics on the GNU ld section
+    ld_shlibs=no
+    ;;
+
+  cygwin* | mingw* | pw32*)
+    # When not using gcc, we currently assume that we are using
+    # Microsoft Visual C++.
+    # hardcode_libdir_flag_spec is actually meaningless, as there is
+    # no search path for DLLs.
+    hardcode_libdir_flag_spec=' '
+    allow_undefined_flag=unsupported
+    # Tell ltmain to make .lib files, not .a files.
+    libext=lib
+    # FIXME: Setting linknames here is a bad hack.
+    archive_cmds='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | sed -e '\''s/ -lc$//'\''` -link -dll~linknames='
+    # The linker will automatically build a .lib file if we build a DLL.
+    old_archive_from_new_cmds='true'
+    # FIXME: Should let the user specify the lib program.
+    old_archive_cmds='lib /OUT:$oldlib$oldobjs$old_deplibs'
+    fix_srcfile_path='`cygpath -w "$srcfile"`'
+    ;;
+
+  darwin* | rhapsody*)
+    case "$host_os" in
+    rhapsody* | darwin1.[012])
+      allow_undefined_flag='-undefined suppress'
+      ;;
+    *) # Darwin 1.3 on
+      allow_undefined_flag='-flat_namespace -undefined suppress'
+      ;;
+    esac
+    # FIXME: Relying on posixy $() will cause problems for
+    #        cross-compilation, but unfortunately the echo tests do not
+    #        yet detect zsh echo's removal of \ escapes.  Also zsh mangles
+    #	     `"' quotes if we put them in here... so don't!
+    archive_cmds='$CC -r -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs && $CC $(test .$module = .yes && echo -bundle || echo -dynamiclib) $allow_undefined_flag -o $lib ${lib}-master.o $deplibs$linker_flags $(test .$module != .yes && echo -install_name $rpath/$soname $verstring)'
+    # We need to add '_' to the symbols in $export_symbols first
+    #archive_expsym_cmds="$archive_cmds"' && strip -s $export_symbols'
+    hardcode_direct=yes
+    hardcode_shlibpath_var=no
+    whole_archive_flag_spec='-all_load $convenience'
+    ;;
+
+  freebsd1*)
+    ld_shlibs=no
+    ;;
+
+  # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor
+  # support.  Future versions do this automatically, but an explicit c++rt0.o
+  # does not break anything, and helps significantly (at the cost of a little
+  # extra space).
+  freebsd2.2*)
+    archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o'
+    hardcode_libdir_flag_spec='-R$libdir'
+    hardcode_direct=yes
+    hardcode_shlibpath_var=no
+    ;;
+
+  # Unfortunately, older versions of FreeBSD 2 do not have this feature.
+  freebsd2*)
+    archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+    hardcode_direct=yes
+    hardcode_minus_L=yes
+    hardcode_shlibpath_var=no
+    ;;
+
+  # FreeBSD 3 and greater uses gcc -shared to do shared libraries.
+  freebsd*)
+    archive_cmds='$CC -shared -o $lib $libobjs $deplibs $compiler_flags'
+    hardcode_libdir_flag_spec='-R$libdir'
+    hardcode_direct=yes
+    hardcode_shlibpath_var=no
+    ;;
+
+  hpux9* | hpux10* | hpux11*)
+    case $host_os in
+    hpux9*) archive_cmds='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' ;;
+    *) archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' ;;
+    esac
+    hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
+    hardcode_libdir_separator=:
+    hardcode_direct=yes
+    hardcode_minus_L=yes # Not in the search PATH, but as the default
+			 # location of the library.
+    export_dynamic_flag_spec='${wl}-E'
+    ;;
+
+  irix5* | irix6* | nonstopux*)
+    if test "$GCC" = yes; then
+      archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+      hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+    else
+      archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
+      hardcode_libdir_flag_spec='-rpath $libdir'
+    fi
+    hardcode_libdir_separator=:
+    link_all_deplibs=yes
+    ;;
+
+  netbsd*)
+    if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
+      archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'  # a.out
+    else
+      archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linker_flags'      # ELF
+    fi
+    hardcode_libdir_flag_spec='-R$libdir'
+    hardcode_direct=yes
+    hardcode_shlibpath_var=no
+    ;;
+
+  newsos6)
+    archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+    hardcode_direct=yes
+    hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+    hardcode_libdir_separator=:
+    hardcode_shlibpath_var=no
+    ;;
+
+  openbsd*)
+    hardcode_direct=yes
+    hardcode_shlibpath_var=no
+    if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+      archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+      hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
+      export_dynamic_flag_spec='${wl}-E'
+    else
+      case "$host_os" in
+      openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*)
+	archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+	hardcode_libdir_flag_spec='-R$libdir'
+        ;;
+      *)
+        archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+        hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
+        ;;
+      esac
+    fi
+    ;;
+
+  os2*)
+    hardcode_libdir_flag_spec='-L$libdir'
+    hardcode_minus_L=yes
+    allow_undefined_flag=unsupported
+    archive_cmds='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def'
+    old_archive_from_new_cmds='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def'
+    ;;
+
+  osf3*)
+    if test "$GCC" = yes; then
+      allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
+      archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+    else
+      allow_undefined_flag=' -expect_unresolved \*'
+      archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
+    fi
+    hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+    hardcode_libdir_separator=:
+    ;;
+
+  osf4* | osf5*)	# as osf3* with the addition of -msym flag
+    if test "$GCC" = yes; then
+      allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
+      archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+      hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+    else
+      allow_undefined_flag=' -expect_unresolved \*'
+      archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
+      archive_expsym_cmds='for i in `cat $export_symbols`; do printf "-exported_symbol " >> $lib.exp; echo "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~
+      $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib~$rm $lib.exp'
+
+      #Both c and cxx compiler support -rpath directly
+      hardcode_libdir_flag_spec='-rpath $libdir'
+    fi
+    hardcode_libdir_separator=:
+    ;;
+
+  sco3.2v5*)
+    archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+    hardcode_shlibpath_var=no
+    runpath_var=LD_RUN_PATH
+    hardcode_runpath_var=yes
+    export_dynamic_flag_spec='${wl}-Bexport'
+    ;;
+
+  solaris*)
+    # gcc --version < 3.0 without binutils cannot create self contained
+    # shared libraries reliably, requiring libgcc.a to resolve some of
+    # the object symbols generated in some cases.  Libraries that use
+    # assert need libgcc.a to resolve __eprintf, for example.  Linking
+    # a copy of libgcc.a into every shared library to guarantee resolving
+    # such symbols causes other problems:  According to Tim Van Holder
+    # <tim.van.holder@pandora.be>, C++ libraries end up with a separate
+    # (to the application) exception stack for one thing.
+    no_undefined_flag=' -z defs'
+    if test "$GCC" = yes; then
+      case `$CC --version 2>/dev/null` in
+      [12].*)
+	cat <<EOF 1>&2
+
+*** Warning: Releases of GCC earlier than version 3.0 cannot reliably
+*** create self contained shared libraries on Solaris systems, without
+*** introducing a dependency on libgcc.a.  Therefore, libtool is disabling
+*** -no-undefined support, which will at least allow you to build shared
+*** libraries.  However, you may find that when you link such libraries
+*** into an application without using GCC, you have to manually add
+*** \`gcc --print-libgcc-file-name\` to the link command.  We urge you to
+*** upgrade to a newer version of GCC.  Another option is to rebuild your
+*** current GCC to use the GNU linker from GNU binutils 2.9.1 or newer.
+
+EOF
+        no_undefined_flag=
+	;;
+      esac
+    fi
+    # $CC -shared without GNU ld will not create a library from C++
+    # object files and a static libstdc++, better avoid it by now
+    archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags'
+    archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
+		$LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp'
+    hardcode_libdir_flag_spec='-R$libdir'
+    hardcode_shlibpath_var=no
+    case $host_os in
+    solaris2.[0-5] | solaris2.[0-5].*) ;;
+    *) # Supported since Solaris 2.6 (maybe 2.5.1?)
+      whole_archive_flag_spec='-z allextract$convenience -z defaultextract' ;;
+    esac
+    link_all_deplibs=yes
+    ;;
+
+  sunos4*)
+    if test "x$host_vendor" = xsequent; then
+      # Use $CC to link under sequent, because it throws in some extra .o
+      # files that make .init and .fini sections work.
+      archive_cmds='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags'
+    else
+      archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags'
+    fi
+    hardcode_libdir_flag_spec='-L$libdir'
+    hardcode_direct=yes
+    hardcode_minus_L=yes
+    hardcode_shlibpath_var=no
+    ;;
+
+  sysv4)
+    case $host_vendor in
+      sni)
+        archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+        hardcode_direct=yes # is this really true???
+        ;;
+      siemens)
+        ## LD is ld it makes a PLAMLIB
+        ## CC just makes a GrossModule.
+        archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags'
+        reload_cmds='$CC -r -o $output$reload_objs'
+        hardcode_direct=no
+        ;;
+      motorola)
+        archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+        hardcode_direct=no #Motorola manual says yes, but my tests say they lie
+        ;;
+    esac
+    runpath_var='LD_RUN_PATH'
+    hardcode_shlibpath_var=no
+    ;;
+
+  sysv4.3*)
+    archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+    hardcode_shlibpath_var=no
+    export_dynamic_flag_spec='-Bexport'
+    ;;
+
+  sysv5*)
+    no_undefined_flag=' -z text'
+    # $CC -shared without GNU ld will not create a library from C++
+    # object files and a static libstdc++, better avoid it by now
+    archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags'
+    archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
+		$LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp'
+    hardcode_libdir_flag_spec=
+    hardcode_shlibpath_var=no
+    runpath_var='LD_RUN_PATH'
+    ;;
+
+  uts4*)
+    archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+    hardcode_libdir_flag_spec='-L$libdir'
+    hardcode_shlibpath_var=no
+    ;;
+
+  dgux*)
+    archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+    hardcode_libdir_flag_spec='-L$libdir'
+    hardcode_shlibpath_var=no
+    ;;
+
+  sysv4*MP*)
+    if test -d /usr/nec; then
+      archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      hardcode_shlibpath_var=no
+      runpath_var=LD_RUN_PATH
+      hardcode_runpath_var=yes
+      ld_shlibs=yes
+    fi
+    ;;
+
+  sysv4.2uw2*)
+    archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags'
+    hardcode_direct=yes
+    hardcode_minus_L=no
+    hardcode_shlibpath_var=no
+    hardcode_runpath_var=yes
+    runpath_var=LD_RUN_PATH
+    ;;
+
+  sysv5uw7* | unixware7*)
+    no_undefined_flag='${wl}-z ${wl}text'
+    if test "$GCC" = yes; then
+      archive_cmds='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+    else
+      archive_cmds='$CC -G ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+    fi
+    runpath_var='LD_RUN_PATH'
+    hardcode_shlibpath_var=no
+    ;;
+
+  *)
+    ld_shlibs=no
+    ;;
+  esac
+fi
+echo "$ac_t""$ld_shlibs" 1>&6
+test "$ld_shlibs" = no && can_build_shared=no
+##
+## END FIXME
+
+## FIXME: this should be a separate macro
+##
+# Check hardcoding attributes.
+echo $ac_n "checking how to hardcode library paths into programs""... $ac_c" 1>&6
+echo "configure:4730: checking how to hardcode library paths into programs" >&5
+hardcode_action=
+if test -n "$hardcode_libdir_flag_spec" || \
+   test -n "$runpath_var"; then
+
+  # We can hardcode non-existant directories.
+  if test "$hardcode_direct" != no &&
+     # If the only mechanism to avoid hardcoding is shlibpath_var, we
+     # have to relink, otherwise we might link with an installed library
+     # when we should be linking with a yet-to-be-installed one
+     ## test "$hardcode_shlibpath_var" != no &&
+     test "$hardcode_minus_L" != no; then
+    # Linking always hardcodes the temporary library directory.
+    hardcode_action=relink
+  else
+    # We can link without hardcoding, and we can hardcode nonexisting dirs.
+    hardcode_action=immediate
+  fi
+else
+  # We cannot hardcode anything, or else we can only hardcode existing
+  # directories.
+  hardcode_action=unsupported
+fi
+echo "$ac_t""$hardcode_action" 1>&6
+##
+## END FIXME
+
+## FIXME: this should be a separate macro
+##
+striplib=
+old_striplib=
+echo $ac_n "checking whether stripping libraries is possible""... $ac_c" 1>&6
+echo "configure:4762: checking whether stripping libraries is possible" >&5
+if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then
+  test -z "$old_striplib" && old_striplib="$STRIP --strip-debug"
+  test -z "$striplib" && striplib="$STRIP --strip-unneeded"
+  echo "$ac_t""yes" 1>&6
+else
+  echo "$ac_t""no" 1>&6
+fi
+##
+## END FIXME
+
+reload_cmds='$LD$reload_flag -o $output$reload_objs'
+test -z "$deplibs_check_method" && deplibs_check_method=unknown
+
+## FIXME: this should be a separate macro
+##
+# PORTME Fill in your ld.so characteristics
+echo $ac_n "checking dynamic linker characteristics""... $ac_c" 1>&6
+echo "configure:4780: checking dynamic linker characteristics" >&5
+library_names_spec=
+libname_spec='lib$name'
+soname_spec=
+postinstall_cmds=
+postuninstall_cmds=
+finish_cmds=
+finish_eval=
+shlibpath_var=
+shlibpath_overrides_runpath=unknown
+version_type=none
+dynamic_linker="$host_os ld.so"
+sys_lib_dlsearch_path_spec="/lib /usr/lib"
+sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib"
+
+case $host_os in
+aix3*)
+  version_type=linux
+  library_names_spec='${libname}${release}.so$versuffix $libname.a'
+  shlibpath_var=LIBPATH
+
+  # AIX has no versioning support, so we append a major version to the name.
+  soname_spec='${libname}${release}.so$major'
+  ;;
+
+aix4* | aix5*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  hardcode_into_libs=yes
+  if test "$host_cpu" = ia64; then
+    # AIX 5 supports IA64
+    library_names_spec='${libname}${release}.so$major ${libname}${release}.so$versuffix $libname.so'
+    shlibpath_var=LD_LIBRARY_PATH
+  else
+    # With GCC up to 2.95.x, collect2 would create an import file
+    # for dependence libraries.  The import file would start with
+    # the line `#! .'.  This would cause the generated library to
+    # depend on `.', always an invalid library.  This was fixed in
+    # development snapshots of GCC prior to 3.0.
+    case $host_os in
+      aix4 | aix4.[01] | aix4.[01].*)
+	if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)'
+	     echo ' yes '
+	     echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then
+	  :
+	else
+	  can_build_shared=no
+	fi
+	;;
+    esac
+    # AIX (on Power*) has no versioning support, so currently we can
+    # not hardcode correct soname into executable. Probably we can
+    # add versioning support to collect2, so additional links can
+    # be useful in future.
+    if test "$aix_use_runtimelinking" = yes; then
+      # If using run time linking (on AIX 4.2 or later) use lib<name>.so
+      # instead of lib<name>.a to let people know that these are not
+      # typical AIX shared libraries.
+      library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
+    else
+      # We preserve .a as extension for shared libraries through AIX4.2
+      # and later when we are not doing run time linking.
+      library_names_spec='${libname}${release}.a $libname.a'
+      soname_spec='${libname}${release}.so$major'
+    fi
+    shlibpath_var=LIBPATH
+  fi
+  hardcode_into_libs=yes
+  ;;
+
+amigaos*)
+  library_names_spec='$libname.ixlibrary $libname.a'
+  # Create ${libname}_ixlibrary.a entries in /sys/libs.
+  finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "(cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a)"; (cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a) || exit 1; done'
+  ;;
+
+beos*)
+  library_names_spec='${libname}.so'
+  dynamic_linker="$host_os ld.so"
+  shlibpath_var=LIBRARY_PATH
+  ;;
+
+bsdi4*)
+  version_type=linux
+  need_version=no
+  library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
+  soname_spec='${libname}${release}.so$major'
+  finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib"
+  sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib"
+  export_dynamic_flag_spec=-rdynamic
+  # the default ld.so.conf also contains /usr/contrib/lib and
+  # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow
+  # libtool to hard-code these into programs
+  ;;
+
+cygwin* | mingw* | pw32*)
+  version_type=windows
+  need_version=no
+  need_lib_prefix=no
+  case $GCC,$host_os in
+  yes,cygwin*)
+    library_names_spec='$libname.dll.a'
+    soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | sed -e 's/[.]/-/g'`${versuffix}.dll'
+    postinstall_cmds='dlpath=`bash 2>&1 -c '\''. $dir/${file}i;echo \$dlname'\''`~
+      dldir=$destdir/`dirname \$dlpath`~
+      test -d \$dldir || mkdir -p \$dldir~
+      $install_prog .libs/$dlname \$dldir/$dlname'
+    postuninstall_cmds='dldll=`bash 2>&1 -c '\''. $file; echo \$dlname'\''`~
+      dlpath=$dir/\$dldll~
+       $rm \$dlpath'
+    ;;
+  yes,mingw*)
+    library_names_spec='${libname}`echo ${release} | sed -e 's/[.]/-/g'`${versuffix}.dll'
+    sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | sed -e "s/^libraries://" -e "s/;/ /g" -e "s,=/,/,g"`
+    ;;
+  yes,pw32*)
+    library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | sed -e 's/./-/g'`${versuffix}.dll'
+    ;;
+  *)
+    library_names_spec='${libname}`echo ${release} | sed -e 's/[.]/-/g'`${versuffix}.dll $libname.lib'
+    ;;
+  esac
+  dynamic_linker='Win32 ld.exe'
+  # FIXME: first we should search . and the directory the executable is in
+  shlibpath_var=PATH
+  ;;
+
+darwin* | rhapsody*)
+  dynamic_linker="$host_os dyld"
+  version_type=darwin
+  need_lib_prefix=no
+  need_version=no
+  # FIXME: Relying on posixy $() will cause problems for
+  #        cross-compilation, but unfortunately the echo tests do not
+  #        yet detect zsh echo's removal of \ escapes.
+  library_names_spec='${libname}${release}${versuffix}.$(test .$module = .yes && echo so || echo dylib) ${libname}${release}${major}.$(test .$module = .yes && echo so || echo dylib) ${libname}.$(test .$module = .yes && echo so || echo dylib)'
+  soname_spec='${libname}${release}${major}.$(test .$module = .yes && echo so || echo dylib)'
+  shlibpath_overrides_runpath=yes
+  shlibpath_var=DYLD_LIBRARY_PATH
+  ;;
+
+freebsd1*)
+  dynamic_linker=no
+  ;;
+
+freebsd*)
+  objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout`
+  version_type=freebsd-$objformat
+  case $version_type in
+    freebsd-elf*)
+      library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so $libname.so'
+      need_version=no
+      need_lib_prefix=no
+      ;;
+    freebsd-*)
+      library_names_spec='${libname}${release}.so$versuffix $libname.so$versuffix'
+      need_version=yes
+      ;;
+  esac
+  shlibpath_var=LD_LIBRARY_PATH
+  case $host_os in
+  freebsd2*)
+    shlibpath_overrides_runpath=yes
+    ;;
+  *)
+    shlibpath_overrides_runpath=no
+    hardcode_into_libs=yes
+    ;;
+  esac
+  ;;
+
+gnu*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so${major} ${libname}.so'
+  soname_spec='${libname}${release}.so$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  hardcode_into_libs=yes
+  ;;
+
+hpux9* | hpux10* | hpux11*)
+  # Give a soname corresponding to the major version so that dld.sl refuses to
+  # link against other versions.
+  dynamic_linker="$host_os dld.sl"
+  version_type=sunos
+  need_lib_prefix=no
+  need_version=no
+  shlibpath_var=SHLIB_PATH
+  shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH
+  library_names_spec='${libname}${release}.sl$versuffix ${libname}${release}.sl$major $libname.sl'
+  soname_spec='${libname}${release}.sl$major'
+  # HP-UX runs *really* slowly unless shared libraries are mode 555.
+  postinstall_cmds='chmod 555 $lib'
+  ;;
+
+irix5* | irix6* | nonstopux*)
+  case $host_os in
+    nonstopux*) version_type=nonstopux ;;
+    *)          version_type=irix ;;
+  esac
+  need_lib_prefix=no
+  need_version=no
+  soname_spec='${libname}${release}.so$major'
+  library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major ${libname}${release}.so $libname.so'
+  case $host_os in
+  irix5* | nonstopux*)
+    libsuff= shlibsuff=
+    ;;
+  *)
+    case $LD in # libtool.m4 will add one of these switches to LD
+    *-32|*"-32 ") libsuff= shlibsuff= libmagic=32-bit;;
+    *-n32|*"-n32 ") libsuff=32 shlibsuff=N32 libmagic=N32;;
+    *-64|*"-64 ") libsuff=64 shlibsuff=64 libmagic=64-bit;;
+    *) libsuff= shlibsuff= libmagic=never-match;;
+    esac
+    ;;
+  esac
+  shlibpath_var=LD_LIBRARY${shlibsuff}_PATH
+  shlibpath_overrides_runpath=no
+  sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}"
+  sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}"
+  ;;
+
+# No shared lib support for Linux oldld, aout, or coff.
+linux-gnuoldld* | linux-gnuaout* | linux-gnucoff*)
+  dynamic_linker=no
+  ;;
+
+# This must be Linux ELF.
+linux-gnu*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
+  soname_spec='${libname}${release}.so$major'
+  finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  # This implies no fast_install, which is unacceptable.
+  # Some rework will be needed to allow for fast_install
+  # before this can be enabled.
+  hardcode_into_libs=yes
+
+  # We used to test for /lib/ld.so.1 and disable shared libraries on
+  # powerpc, because MkLinux only supported shared libraries with the
+  # GNU dynamic linker.  Since this was broken with cross compilers,
+  # most powerpc-linux boxes support dynamic linking these days and
+  # people can always --disable-shared, the test was removed, and we
+  # assume the GNU/Linux dynamic linker is in use.
+  dynamic_linker='GNU/Linux ld.so'
+  ;;
+
+netbsd*)
+  version_type=sunos
+  need_lib_prefix=no
+  need_version=no
+  if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
+    library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix'
+    finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
+    dynamic_linker='NetBSD (a.out) ld.so'
+  else
+    library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major ${libname}${release}.so ${libname}.so'
+    soname_spec='${libname}${release}.so$major'
+    dynamic_linker='NetBSD ld.elf_so'
+  fi
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  hardcode_into_libs=yes
+  ;;
+
+newsos6)
+  version_type=linux
+  library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  ;;
+
+openbsd*)
+  version_type=sunos
+  need_lib_prefix=no
+  need_version=no
+  if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+    case "$host_os" in
+    openbsd2.[89] | openbsd2.[89].*)
+      shlibpath_overrides_runpath=no
+      ;;
+    *)
+      shlibpath_overrides_runpath=yes
+      ;;
+    esac
+  else
+    shlibpath_overrides_runpath=yes
+  fi
+  library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix'
+  finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  ;;
+
+os2*)
+  libname_spec='$name'
+  need_lib_prefix=no
+  library_names_spec='$libname.dll $libname.a'
+  dynamic_linker='OS/2 ld.exe'
+  shlibpath_var=LIBPATH
+  ;;
+
+osf3* | osf4* | osf5*)
+  version_type=osf
+  need_version=no
+  soname_spec='${libname}${release}.so$major'
+  library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
+  shlibpath_var=LD_LIBRARY_PATH
+  sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib"
+  sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec"
+  hardcode_into_libs=yes
+  ;;
+
+sco3.2v5*)
+  version_type=osf
+  soname_spec='${libname}${release}.so$major'
+  library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
+  shlibpath_var=LD_LIBRARY_PATH
+  ;;
+
+solaris*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
+  soname_spec='${libname}${release}.so$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  hardcode_into_libs=yes
+  # ldd complains unless libraries are executable
+  postinstall_cmds='chmod +x $lib'
+  ;;
+
+sunos4*)
+  version_type=sunos
+  library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix'
+  finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  if test "$with_gnu_ld" = yes; then
+    need_lib_prefix=no
+  fi
+  need_version=yes
+  ;;
+
+sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
+  version_type=linux
+  library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
+  soname_spec='${libname}${release}.so$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  case $host_vendor in
+    sni)
+      shlibpath_overrides_runpath=no
+      need_lib_prefix=no
+      export_dynamic_flag_spec='${wl}-Blargedynsym'
+      runpath_var=LD_RUN_PATH
+      ;;
+    siemens)
+      need_lib_prefix=no
+      ;;
+    motorola)
+      need_lib_prefix=no
+      need_version=no
+      shlibpath_overrides_runpath=no
+      sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib'
+      ;;
+  esac
+  ;;
+
+uts4*)
+  version_type=linux
+  library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
+  soname_spec='${libname}${release}.so$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  ;;
+
+dgux*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
+  soname_spec='${libname}${release}.so$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  ;;
+
+sysv4*MP*)
+  if test -d /usr/nec ;then
+    version_type=linux
+    library_names_spec='$libname.so.$versuffix $libname.so.$major $libname.so'
+    soname_spec='$libname.so.$major'
+    shlibpath_var=LD_LIBRARY_PATH
+  fi
+  ;;
+
+*)
+  dynamic_linker=no
+  ;;
+esac
+echo "$ac_t""$dynamic_linker" 1>&6
+test "$dynamic_linker" = no && can_build_shared=no
+##
+## END FIXME
+
+## FIXME: this should be a separate macro
+##
+# Report the final consequences.
+echo $ac_n "checking if libtool supports shared libraries""... $ac_c" 1>&6
+echo "configure:5195: checking if libtool supports shared libraries" >&5
+echo "$ac_t""$can_build_shared" 1>&6
+##
+## END FIXME
+
+## FIXME: this should be a separate macro
+##
+echo $ac_n "checking whether to build shared libraries""... $ac_c" 1>&6
+echo "configure:5203: checking whether to build shared libraries" >&5
+test "$can_build_shared" = "no" && enable_shared=no
+
+# On AIX, shared libraries and static libraries use the same namespace, and
+# are all built from PIC.
+case "$host_os" in
+aix3*)
+  test "$enable_shared" = yes && enable_static=no
+  if test -n "$RANLIB"; then
+    archive_cmds="$archive_cmds~\$RANLIB \$lib"
+    postinstall_cmds='$RANLIB $lib'
+  fi
+  ;;
+
+aix4*)
+  if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then
+    test "$enable_shared" = yes && enable_static=no
+  fi
+  ;;
+esac
+echo "$ac_t""$enable_shared" 1>&6
+##
+## END FIXME
+
+## FIXME: this should be a separate macro
+##
+echo $ac_n "checking whether to build static libraries""... $ac_c" 1>&6
+echo "configure:5230: checking whether to build static libraries" >&5
+# Make sure either enable_shared or enable_static is yes.
+test "$enable_shared" = yes || enable_static=yes
+echo "$ac_t""$enable_static" 1>&6
+##
+## END FIXME
+
+if test "$hardcode_action" = relink; then
+  # Fast installation is not supported
+  enable_fast_install=no
+elif test "$shlibpath_overrides_runpath" = yes ||
+     test "$enable_shared" = no; then
+  # Fast installation is not necessary
+  enable_fast_install=needless
+fi
+
+variables_saved_for_relink="PATH $shlibpath_var $runpath_var"
+if test "$GCC" = yes; then
+  variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
+fi
+
+if test "x$enable_dlopen" != xyes; then
+  enable_dlopen=unknown
+  enable_dlopen_self=unknown
+  enable_dlopen_self_static=unknown
+else
+  lt_cv_dlopen=no
+  lt_cv_dlopen_libs=
+
+  case $host_os in
+  beos*)
+    lt_cv_dlopen="load_add_on"
+    lt_cv_dlopen_libs=
+    lt_cv_dlopen_self=yes
+    ;;
+
+  cygwin* | mingw* | pw32*)
+    lt_cv_dlopen="LoadLibrary"
+    lt_cv_dlopen_libs=
+   ;;
+
+  *)
+    echo $ac_n "checking for shl_load""... $ac_c" 1>&6
+echo "configure:5273: checking for shl_load" >&5
+if eval "test \"`echo '$''{'ac_cv_func_shl_load'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 5278 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char shl_load(); below.  */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char shl_load();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_shl_load) || defined (__stub___shl_load)
+choke me
+#else
+shl_load();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:5301: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_func_shl_load=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_func_shl_load=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'shl_load`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  lt_cv_dlopen="shl_load"
+else
+  echo "$ac_t""no" 1>&6
+echo $ac_n "checking for shl_load in -ldld""... $ac_c" 1>&6
+echo "configure:5319: checking for shl_load in -ldld" >&5
+ac_lib_var=`echo dld'_'shl_load | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  ac_save_LIBS="$LIBS"
+LIBS="-ldld  $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 5327 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char shl_load();
+
+int main() {
+shl_load()
+; return 0; }
+EOF
+if { (eval echo configure:5338: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-dld"
+else
+  echo "$ac_t""no" 1>&6
+echo $ac_n "checking for dlopen""... $ac_c" 1>&6
+echo "configure:5357: checking for dlopen" >&5
+if eval "test \"`echo '$''{'ac_cv_func_dlopen'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 5362 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char dlopen(); below.  */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char dlopen();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_dlopen) || defined (__stub___dlopen)
+choke me
+#else
+dlopen();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:5385: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_func_dlopen=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_func_dlopen=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'dlopen`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  lt_cv_dlopen="dlopen"
+else
+  echo "$ac_t""no" 1>&6
+echo $ac_n "checking for dlopen in -ldl""... $ac_c" 1>&6
+echo "configure:5403: checking for dlopen in -ldl" >&5
+ac_lib_var=`echo dl'_'dlopen | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  ac_save_LIBS="$LIBS"
+LIBS="-ldl  $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 5411 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char dlopen();
+
+int main() {
+dlopen()
+; return 0; }
+EOF
+if { (eval echo configure:5422: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"
+else
+  echo "$ac_t""no" 1>&6
+echo $ac_n "checking for dlopen in -lsvld""... $ac_c" 1>&6
+echo "configure:5441: checking for dlopen in -lsvld" >&5
+ac_lib_var=`echo svld'_'dlopen | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  ac_save_LIBS="$LIBS"
+LIBS="-lsvld  $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 5449 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char dlopen();
+
+int main() {
+dlopen()
+; return 0; }
+EOF
+if { (eval echo configure:5460: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"
+else
+  echo "$ac_t""no" 1>&6
+echo $ac_n "checking for dld_link in -ldld""... $ac_c" 1>&6
+echo "configure:5479: checking for dld_link in -ldld" >&5
+ac_lib_var=`echo dld'_'dld_link | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  ac_save_LIBS="$LIBS"
+LIBS="-ldld  $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 5487 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char dld_link();
+
+int main() {
+dld_link()
+; return 0; }
+EOF
+if { (eval echo configure:5498: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-dld"
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+	      
+fi
+
+	    
+fi
+
+	  
+fi
+
+	
+fi
+
+      
+fi
+
+    ;;
+  esac
+
+  if test "x$lt_cv_dlopen" != xno; then
+    enable_dlopen=yes
+  else
+    enable_dlopen=no
+  fi
+
+  case $lt_cv_dlopen in
+  dlopen)
+    save_CPPFLAGS="$CPPFLAGS"
+        test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H"
+
+    save_LDFLAGS="$LDFLAGS"
+    eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\"
+
+    save_LIBS="$LIBS"
+    LIBS="$lt_cv_dlopen_libs $LIBS"
+
+    echo $ac_n "checking whether a program can dlopen itself""... $ac_c" 1>&6
+echo "configure:5554: checking whether a program can dlopen itself" >&5
+if eval "test \"`echo '$''{'lt_cv_dlopen_self'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  	  if test "$cross_compiling" = yes; then :
+  lt_cv_dlopen_self=cross
+else
+    lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
+  lt_status=$lt_dlunknown
+  cat > conftest.$ac_ext <<EOF
+#line 5564 "configure"
+#include "confdefs.h"
+
+#if HAVE_DLFCN_H
+#include <dlfcn.h>
+#endif
+
+#include <stdio.h>
+
+#ifdef RTLD_GLOBAL
+#  define LT_DLGLOBAL		RTLD_GLOBAL
+#else
+#  ifdef DL_GLOBAL
+#    define LT_DLGLOBAL		DL_GLOBAL
+#  else
+#    define LT_DLGLOBAL		0
+#  endif
+#endif
+
+/* We may have to define LT_DLLAZY_OR_NOW in the command line if we
+   find out it does not work in some platform. */
+#ifndef LT_DLLAZY_OR_NOW
+#  ifdef RTLD_LAZY
+#    define LT_DLLAZY_OR_NOW		RTLD_LAZY
+#  else
+#    ifdef DL_LAZY
+#      define LT_DLLAZY_OR_NOW		DL_LAZY
+#    else
+#      ifdef RTLD_NOW
+#        define LT_DLLAZY_OR_NOW	RTLD_NOW
+#      else
+#        ifdef DL_NOW
+#          define LT_DLLAZY_OR_NOW	DL_NOW
+#        else
+#          define LT_DLLAZY_OR_NOW	0
+#        endif
+#      endif
+#    endif
+#  endif
+#endif
+
+#ifdef __cplusplus
+extern "C" void exit (int);
+#endif
+
+void fnord() { int i=42;}
+int main ()
+{
+  void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW);
+  int status = $lt_dlunknown;
+
+  if (self)
+    {
+      if (dlsym (self,"fnord"))       status = $lt_dlno_uscore;
+      else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore;
+      /* dlclose (self); */
+    }
+
+    exit (status);
+}
+EOF
+  if { (eval echo configure:5625: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} 2>/dev/null; then
+    (./conftest; exit; ) 2>/dev/null
+    lt_status=$?
+    case x$lt_status in
+      x$lt_dlno_uscore) lt_cv_dlopen_self=yes ;;
+      x$lt_dlneed_uscore) lt_cv_dlopen_self=yes ;;
+      x$lt_unknown|x*) lt_cv_dlopen_self=no ;;
+    esac
+  else :
+    # compilation failed
+    lt_cv_dlopen_self=no
+  fi
+fi
+rm -fr conftest*
+
+    
+fi
+
+echo "$ac_t""$lt_cv_dlopen_self" 1>&6
+
+    if test "x$lt_cv_dlopen_self" = xyes; then
+      LDFLAGS="$LDFLAGS $link_static_flag"
+      echo $ac_n "checking whether a statically linked program can dlopen itself""... $ac_c" 1>&6
+echo "configure:5648: checking whether a statically linked program can dlopen itself" >&5
+if eval "test \"`echo '$''{'lt_cv_dlopen_self_static'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  	  if test "$cross_compiling" = yes; then :
+  lt_cv_dlopen_self_static=cross
+else
+    lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
+  lt_status=$lt_dlunknown
+  cat > conftest.$ac_ext <<EOF
+#line 5658 "configure"
+#include "confdefs.h"
+
+#if HAVE_DLFCN_H
+#include <dlfcn.h>
+#endif
+
+#include <stdio.h>
+
+#ifdef RTLD_GLOBAL
+#  define LT_DLGLOBAL		RTLD_GLOBAL
+#else
+#  ifdef DL_GLOBAL
+#    define LT_DLGLOBAL		DL_GLOBAL
+#  else
+#    define LT_DLGLOBAL		0
+#  endif
+#endif
+
+/* We may have to define LT_DLLAZY_OR_NOW in the command line if we
+   find out it does not work in some platform. */
+#ifndef LT_DLLAZY_OR_NOW
+#  ifdef RTLD_LAZY
+#    define LT_DLLAZY_OR_NOW		RTLD_LAZY
+#  else
+#    ifdef DL_LAZY
+#      define LT_DLLAZY_OR_NOW		DL_LAZY
+#    else
+#      ifdef RTLD_NOW
+#        define LT_DLLAZY_OR_NOW	RTLD_NOW
+#      else
+#        ifdef DL_NOW
+#          define LT_DLLAZY_OR_NOW	DL_NOW
+#        else
+#          define LT_DLLAZY_OR_NOW	0
+#        endif
+#      endif
+#    endif
+#  endif
+#endif
+
+#ifdef __cplusplus
+extern "C" void exit (int);
+#endif
+
+void fnord() { int i=42;}
+int main ()
+{
+  void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW);
+  int status = $lt_dlunknown;
+
+  if (self)
+    {
+      if (dlsym (self,"fnord"))       status = $lt_dlno_uscore;
+      else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore;
+      /* dlclose (self); */
+    }
+
+    exit (status);
+}
+EOF
+  if { (eval echo configure:5719: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} 2>/dev/null; then
+    (./conftest; exit; ) 2>/dev/null
+    lt_status=$?
+    case x$lt_status in
+      x$lt_dlno_uscore) lt_cv_dlopen_self_static=yes ;;
+      x$lt_dlneed_uscore) lt_cv_dlopen_self_static=yes ;;
+      x$lt_unknown|x*) lt_cv_dlopen_self_static=no ;;
+    esac
+  else :
+    # compilation failed
+    lt_cv_dlopen_self_static=no
+  fi
+fi
+rm -fr conftest*
+
+      
+fi
+
+echo "$ac_t""$lt_cv_dlopen_self_static" 1>&6
+    fi
+
+    CPPFLAGS="$save_CPPFLAGS"
+    LDFLAGS="$save_LDFLAGS"
+    LIBS="$save_LIBS"
+    ;;
+  esac
+
+  case $lt_cv_dlopen_self in
+  yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;;
+  *) enable_dlopen_self=unknown ;;
+  esac
+
+  case $lt_cv_dlopen_self_static in
+  yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;;
+  *) enable_dlopen_self_static=unknown ;;
+  esac
+fi
+
+
+## FIXME: this should be a separate macro
+##
+if test "$enable_shared" = yes && test "$GCC" = yes; then
+  case $archive_cmds in
+  *'~'*)
+    # FIXME: we may have to deal with multi-command sequences.
+    ;;
+  '$CC '*)
+    # Test whether the compiler implicitly links with -lc since on some
+    # systems, -lgcc has to come before -lc. If gcc already passes -lc
+    # to ld, don't add -lc before -lgcc.
+    echo $ac_n "checking whether -lc should be explicitly linked in""... $ac_c" 1>&6
+echo "configure:5770: checking whether -lc should be explicitly linked in" >&5
+    if eval "test \"`echo '$''{'lt_cv_archive_cmds_need_lc'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  $rm conftest*
+    echo 'static int dummy;' > conftest.$ac_ext
+
+    if { (eval echo configure:5777: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+      soname=conftest
+      lib=conftest
+      libobjs=conftest.$ac_objext
+      deplibs=
+      wl=$lt_cv_prog_cc_wl
+      compiler_flags=-v
+      linker_flags=-v
+      verstring=
+      output_objdir=.
+      libname=conftest
+      save_allow_undefined_flag=$allow_undefined_flag
+      allow_undefined_flag=
+      if { (eval echo configure:5790: \"$archive_cmds 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1\") 1>&5; (eval $archive_cmds 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) 2>&5; }
+      then
+	lt_cv_archive_cmds_need_lc=no
+      else
+	lt_cv_archive_cmds_need_lc=yes
+      fi
+      allow_undefined_flag=$save_allow_undefined_flag
+    else
+      cat conftest.err 1>&5
+    fi
+fi
+
+    echo "$ac_t""$lt_cv_archive_cmds_need_lc" 1>&6
+    ;;
+  esac
+fi
+need_lc=${lt_cv_archive_cmds_need_lc-yes}
+##
+## END FIXME
+
+## FIXME: this should be a separate macro
+##
+# The second clause should only fire when bootstrapping the
+# libtool distribution, otherwise you forgot to ship ltmain.sh
+# with your package, and you will get complaints that there are
+# no rules to generate ltmain.sh.
+if test -f "$ltmain"; then
+  :
+else
+  # If there is no Makefile yet, we rely on a make rule to execute
+  # `config.status --recheck' to rerun these tests and create the
+  # libtool script then.
+  test -f Makefile && make "$ltmain"
+fi
+
+if test -f "$ltmain"; then
+  trap "$rm \"${ofile}T\"; exit 1" 1 2 15
+  $rm -f "${ofile}T"
+
+  echo creating $ofile
+
+  # Now quote all the things that may contain metacharacters while being
+  # careful not to overquote the AC_SUBSTed values.  We take copies of the
+  # variables and quote the copies for generation of the libtool script.
+  for var in echo old_CC old_CFLAGS SED \
+    AR AR_FLAGS CC LD LN_S NM SHELL \
+    reload_flag reload_cmds wl \
+    pic_flag link_static_flag no_builtin_flag export_dynamic_flag_spec \
+    thread_safe_flag_spec whole_archive_flag_spec libname_spec \
+    library_names_spec soname_spec \
+    RANLIB old_archive_cmds old_archive_from_new_cmds old_postinstall_cmds \
+    old_postuninstall_cmds archive_cmds archive_expsym_cmds postinstall_cmds \
+    postuninstall_cmds extract_expsyms_cmds old_archive_from_expsyms_cmds \
+    old_striplib striplib file_magic_cmd export_symbols_cmds \
+    deplibs_check_method allow_undefined_flag no_undefined_flag \
+    finish_cmds finish_eval global_symbol_pipe global_symbol_to_cdecl \
+    global_symbol_to_c_name_address \
+    hardcode_libdir_flag_spec hardcode_libdir_separator  \
+    sys_lib_search_path_spec sys_lib_dlsearch_path_spec \
+    compiler_c_o compiler_o_lo need_locks exclude_expsyms include_expsyms; do
+
+    case $var in
+    reload_cmds | old_archive_cmds | old_archive_from_new_cmds | \
+    old_postinstall_cmds | old_postuninstall_cmds | \
+    export_symbols_cmds | archive_cmds | archive_expsym_cmds | \
+    extract_expsyms_cmds | old_archive_from_expsyms_cmds | \
+    postinstall_cmds | postuninstall_cmds | \
+    finish_cmds | sys_lib_search_path_spec | sys_lib_dlsearch_path_spec)
+      # Double-quote double-evaled strings.
+      eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\""
+      ;;
+    *)
+      eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\""
+      ;;
+    esac
+  done
+
+  cat <<__EOF__ > "${ofile}T"
+#! $SHELL
+
+# `$echo "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services.
+# Generated automatically by $PROGRAM (GNU $PACKAGE $VERSION$TIMESTAMP)
+# NOTE: Changes made to this file will be lost: look at ltmain.sh.
+#
+# Copyright (C) 1996-2000 Free Software Foundation, Inc.
+# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# A sed that does not truncate output.
+SED=$lt_SED
+
+# Sed that helps us avoid accidentally triggering echo(1) options like -n.
+Xsed="${SED} -e s/^X//"
+
+# The HP-UX ksh and POSIX shell print the target directory to stdout
+# if CDPATH is set.
+if test "X\${CDPATH+set}" = Xset; then CDPATH=:; export CDPATH; fi
+
+# ### BEGIN LIBTOOL CONFIG
+
+# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
+
+# Shell to use when invoking shell scripts.
+SHELL=$lt_SHELL
+
+# Whether or not to build shared libraries.
+build_libtool_libs=$enable_shared
+
+# Whether or not to build static libraries.
+build_old_libs=$enable_static
+
+# Whether or not to add -lc for building shared libraries.
+build_libtool_need_lc=$need_lc
+
+# Whether or not to optimize for fast installation.
+fast_install=$enable_fast_install
+
+# The host system.
+host_alias=$host_alias
+host=$host
+
+# An echo program that does not interpret backslashes.
+echo=$lt_echo
+
+# The archiver.
+AR=$lt_AR
+AR_FLAGS=$lt_AR_FLAGS
+
+# The default C compiler.
+CC=$lt_CC
+
+# Is the compiler the GNU C compiler?
+with_gcc=$GCC
+
+# The linker used to build libraries.
+LD=$lt_LD
+
+# Whether we need hard or soft links.
+LN_S=$lt_LN_S
+
+# A BSD-compatible nm program.
+NM=$lt_NM
+
+# A symbol stripping program
+STRIP=$STRIP
+
+# Used to examine libraries when file_magic_cmd begins "file"
+MAGIC_CMD=$MAGIC_CMD
+
+# Used on cygwin: DLL creation program.
+DLLTOOL="$DLLTOOL"
+
+# Used on cygwin: object dumper.
+OBJDUMP="$OBJDUMP"
+
+# Used on cygwin: assembler.
+AS="$AS"
+
+# The name of the directory that contains temporary libtool files.
+objdir=$objdir
+
+# How to create reloadable object files.
+reload_flag=$lt_reload_flag
+reload_cmds=$lt_reload_cmds
+
+# How to pass a linker flag through the compiler.
+wl=$lt_wl
+
+# Object file suffix (normally "o").
+objext="$ac_objext"
+
+# Old archive suffix (normally "a").
+libext="$libext"
+
+# Executable file suffix (normally "").
+exeext="$exeext"
+
+# Additional compiler flags for building library objects.
+pic_flag=$lt_pic_flag
+pic_mode=$pic_mode
+
+# Does compiler simultaneously support -c and -o options?
+compiler_c_o=$lt_compiler_c_o
+
+# Can we write directly to a .lo ?
+compiler_o_lo=$lt_compiler_o_lo
+
+# Must we lock files when doing compilation ?
+need_locks=$lt_need_locks
+
+# Do we need the lib prefix for modules?
+need_lib_prefix=$need_lib_prefix
+
+# Do we need a version for libraries?
+need_version=$need_version
+
+# Whether dlopen is supported.
+dlopen_support=$enable_dlopen
+
+# Whether dlopen of programs is supported.
+dlopen_self=$enable_dlopen_self
+
+# Whether dlopen of statically linked programs is supported.
+dlopen_self_static=$enable_dlopen_self_static
+
+# Compiler flag to prevent dynamic linking.
+link_static_flag=$lt_link_static_flag
+
+# Compiler flag to turn off builtin functions.
+no_builtin_flag=$lt_no_builtin_flag
+
+# Compiler flag to allow reflexive dlopens.
+export_dynamic_flag_spec=$lt_export_dynamic_flag_spec
+
+# Compiler flag to generate shared objects directly from archives.
+whole_archive_flag_spec=$lt_whole_archive_flag_spec
+
+# Compiler flag to generate thread-safe objects.
+thread_safe_flag_spec=$lt_thread_safe_flag_spec
+
+# Library versioning type.
+version_type=$version_type
+
+# Format of library name prefix.
+libname_spec=$lt_libname_spec
+
+# List of archive names.  First name is the real one, the rest are links.
+# The last name is the one that the linker finds with -lNAME.
+library_names_spec=$lt_library_names_spec
+
+# The coded name of the library, if different from the real name.
+soname_spec=$lt_soname_spec
+
+# Commands used to build and install an old-style archive.
+RANLIB=$lt_RANLIB
+old_archive_cmds=$lt_old_archive_cmds
+old_postinstall_cmds=$lt_old_postinstall_cmds
+old_postuninstall_cmds=$lt_old_postuninstall_cmds
+
+# Create an old-style archive from a shared archive.
+old_archive_from_new_cmds=$lt_old_archive_from_new_cmds
+
+# Create a temporary old-style archive to link instead of a shared archive.
+old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds
+
+# Commands used to build and install a shared archive.
+archive_cmds=$lt_archive_cmds
+archive_expsym_cmds=$lt_archive_expsym_cmds
+postinstall_cmds=$lt_postinstall_cmds
+postuninstall_cmds=$lt_postuninstall_cmds
+
+# Commands to strip libraries.
+old_striplib=$lt_old_striplib
+striplib=$lt_striplib
+
+# Method to check whether dependent libraries are shared objects.
+deplibs_check_method=$lt_deplibs_check_method
+
+# Command to use when deplibs_check_method == file_magic.
+file_magic_cmd=$lt_file_magic_cmd
+
+# Flag that allows shared libraries with undefined symbols to be built.
+allow_undefined_flag=$lt_allow_undefined_flag
+
+# Flag that forces no undefined symbols.
+no_undefined_flag=$lt_no_undefined_flag
+
+# Commands used to finish a libtool library installation in a directory.
+finish_cmds=$lt_finish_cmds
+
+# Same as above, but a single script fragment to be evaled but not shown.
+finish_eval=$lt_finish_eval
+
+# Take the output of nm and produce a listing of raw symbols and C names.
+global_symbol_pipe=$lt_global_symbol_pipe
+
+# Transform the output of nm in a proper C declaration
+global_symbol_to_cdecl=$lt_global_symbol_to_cdecl
+
+# Transform the output of nm in a C name address pair
+global_symbol_to_c_name_address=$lt_global_symbol_to_c_name_address
+
+# This is the shared library runtime path variable.
+runpath_var=$runpath_var
+
+# This is the shared library path variable.
+shlibpath_var=$shlibpath_var
+
+# Is shlibpath searched before the hard-coded library search path?
+shlibpath_overrides_runpath=$shlibpath_overrides_runpath
+
+# How to hardcode a shared library path into an executable.
+hardcode_action=$hardcode_action
+
+# Whether we should hardcode library paths into libraries.
+hardcode_into_libs=$hardcode_into_libs
+
+# Flag to hardcode \$libdir into a binary during linking.
+# This must work even if \$libdir does not exist.
+hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec
+
+# Whether we need a single -rpath flag with a separated argument.
+hardcode_libdir_separator=$lt_hardcode_libdir_separator
+
+# Set to yes if using DIR/libNAME.so during linking hardcodes DIR into the
+# resulting binary.
+hardcode_direct=$hardcode_direct
+
+# Set to yes if using the -LDIR flag during linking hardcodes DIR into the
+# resulting binary.
+hardcode_minus_L=$hardcode_minus_L
+
+# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into
+# the resulting binary.
+hardcode_shlibpath_var=$hardcode_shlibpath_var
+
+# Variables whose values should be saved in libtool wrapper scripts and
+# restored at relink time.
+variables_saved_for_relink="$variables_saved_for_relink"
+
+# Whether libtool must link a program against all its dependency libraries.
+link_all_deplibs=$link_all_deplibs
+
+# Compile-time system search path for libraries
+sys_lib_search_path_spec=$lt_sys_lib_search_path_spec
+
+# Run-time system search path for libraries
+sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec
+
+# Fix the shell variable \$srcfile for the compiler.
+fix_srcfile_path="$fix_srcfile_path"
+
+# Set to yes if exported symbols are required.
+always_export_symbols=$always_export_symbols
+
+# The commands to list exported symbols.
+export_symbols_cmds=$lt_export_symbols_cmds
+
+# The commands to extract the exported symbol list from a shared archive.
+extract_expsyms_cmds=$lt_extract_expsyms_cmds
+
+# Symbols that should not be listed in the preloaded symbols.
+exclude_expsyms=$lt_exclude_expsyms
+
+# Symbols that must always be exported.
+include_expsyms=$lt_include_expsyms
+
+# ### END LIBTOOL CONFIG
+
+__EOF__
+
+  case $host_os in
+  aix3*)
+    cat <<\EOF >> "${ofile}T"
+
+# AIX sometimes has problems with the GCC collect2 program.  For some
+# reason, if we set the COLLECT_NAMES environment variable, the problems
+# vanish in a puff of smoke.
+if test "X${COLLECT_NAMES+set}" != Xset; then
+  COLLECT_NAMES=
+  export COLLECT_NAMES
+fi
+EOF
+    ;;
+  esac
+
+  case $host_os in
+  cygwin* | mingw* | pw32* | os2*)
+    cat <<'EOF' >> "${ofile}T"
+      # This is a source program that is used to create dlls on Windows
+      # Don't remove nor modify the starting and closing comments
+# /* ltdll.c starts here */
+# #define WIN32_LEAN_AND_MEAN
+# #include <windows.h>
+# #undef WIN32_LEAN_AND_MEAN
+# #include <stdio.h>
+#
+# #ifndef __CYGWIN__
+# #  ifdef __CYGWIN32__
+# #    define __CYGWIN__ __CYGWIN32__
+# #  endif
+# #endif
+#
+# #ifdef __cplusplus
+# extern "C" {
+# #endif
+# BOOL APIENTRY DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved);
+# #ifdef __cplusplus
+# }
+# #endif
+#
+# #ifdef __CYGWIN__
+# #include <cygwin/cygwin_dll.h>
+# DECLARE_CYGWIN_DLL( DllMain );
+# #endif
+# HINSTANCE __hDllInstance_base;
+#
+# BOOL APIENTRY
+# DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved)
+# {
+#   __hDllInstance_base = hInst;
+#   return TRUE;
+# }
+# /* ltdll.c ends here */
+	# This is a source program that is used to create import libraries
+	# on Windows for dlls which lack them. Don't remove nor modify the
+	# starting and closing comments
+# /* impgen.c starts here */
+# /*   Copyright (C) 1999-2000 Free Software Foundation, Inc.
+#
+#  This file is part of GNU libtool.
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#  */
+#
+# #include <stdio.h>		/* for printf() */
+# #include <unistd.h>		/* for open(), lseek(), read() */
+# #include <fcntl.h>		/* for O_RDONLY, O_BINARY */
+# #include <string.h>		/* for strdup() */
+#
+# /* O_BINARY isn't required (or even defined sometimes) under Unix */
+# #ifndef O_BINARY
+# #define O_BINARY 0
+# #endif
+#
+# static unsigned int
+# pe_get16 (fd, offset)
+#      int fd;
+#      int offset;
+# {
+#   unsigned char b[2];
+#   lseek (fd, offset, SEEK_SET);
+#   read (fd, b, 2);
+#   return b[0] + (b[1]<<8);
+# }
+#
+# static unsigned int
+# pe_get32 (fd, offset)
+#     int fd;
+#     int offset;
+# {
+#   unsigned char b[4];
+#   lseek (fd, offset, SEEK_SET);
+#   read (fd, b, 4);
+#   return b[0] + (b[1]<<8) + (b[2]<<16) + (b[3]<<24);
+# }
+#
+# static unsigned int
+# pe_as32 (ptr)
+#      void *ptr;
+# {
+#   unsigned char *b = ptr;
+#   return b[0] + (b[1]<<8) + (b[2]<<16) + (b[3]<<24);
+# }
+#
+# int
+# main (argc, argv)
+#     int argc;
+#     char *argv[];
+# {
+#     int dll;
+#     unsigned long pe_header_offset, opthdr_ofs, num_entries, i;
+#     unsigned long export_rva, export_size, nsections, secptr, expptr;
+#     unsigned long name_rvas, nexp;
+#     unsigned char *expdata, *erva;
+#     char *filename, *dll_name;
+#
+#     filename = argv[1];
+#
+#     dll = open(filename, O_RDONLY|O_BINARY);
+#     if (dll < 1)
+# 	return 1;
+#
+#     dll_name = filename;
+#
+#     for (i=0; filename[i]; i++)
+# 	if (filename[i] == '/' || filename[i] == '\\'  || filename[i] == ':')
+# 	    dll_name = filename + i +1;
+#
+#     pe_header_offset = pe_get32 (dll, 0x3c);
+#     opthdr_ofs = pe_header_offset + 4 + 20;
+#     num_entries = pe_get32 (dll, opthdr_ofs + 92);
+#
+#     if (num_entries < 1) /* no exports */
+# 	return 1;
+#
+#     export_rva = pe_get32 (dll, opthdr_ofs + 96);
+#     export_size = pe_get32 (dll, opthdr_ofs + 100);
+#     nsections = pe_get16 (dll, pe_header_offset + 4 +2);
+#     secptr = (pe_header_offset + 4 + 20 +
+# 	      pe_get16 (dll, pe_header_offset + 4 + 16));
+#
+#     expptr = 0;
+#     for (i = 0; i < nsections; i++)
+#     {
+# 	char sname[8];
+# 	unsigned long secptr1 = secptr + 40 * i;
+# 	unsigned long vaddr = pe_get32 (dll, secptr1 + 12);
+# 	unsigned long vsize = pe_get32 (dll, secptr1 + 16);
+# 	unsigned long fptr = pe_get32 (dll, secptr1 + 20);
+# 	lseek(dll, secptr1, SEEK_SET);
+# 	read(dll, sname, 8);
+# 	if (vaddr <= export_rva && vaddr+vsize > export_rva)
+# 	{
+# 	    expptr = fptr + (export_rva - vaddr);
+# 	    if (export_rva + export_size > vaddr + vsize)
+# 		export_size = vsize - (export_rva - vaddr);
+# 	    break;
+# 	}
+#     }
+#
+#     expdata = (unsigned char*)malloc(export_size);
+#     lseek (dll, expptr, SEEK_SET);
+#     read (dll, expdata, export_size);
+#     erva = expdata - export_rva;
+#
+#     nexp = pe_as32 (expdata+24);
+#     name_rvas = pe_as32 (expdata+32);
+#
+#     printf ("EXPORTS\n");
+#     for (i = 0; i<nexp; i++)
+#     {
+# 	unsigned long name_rva = pe_as32 (erva+name_rvas+i*4);
+# 	printf ("\t%s @ %ld ;\n", erva+name_rva, 1+ i);
+#     }
+#
+#     return 0;
+# }
+# /* impgen.c ends here */
+
+EOF
+    ;;
+  esac
+
+  # We use sed instead of cat because bash on DJGPP gets confused if
+  # if finds mixed CR/LF and LF-only lines.  Since sed operates in
+  # text mode, it properly converts lines to CR/LF.  This bash problem
+  # is reportedly fixed, but why not run on old versions too?
+  sed '$q' "$ltmain" >> "${ofile}T" || (rm -f "${ofile}T"; exit 1)
+
+  mv -f "${ofile}T" "$ofile" || \
+    (rm -f "$ofile" && cp "${ofile}T" "$ofile" && rm -f "${ofile}T")
+  chmod +x "$ofile"
+fi
+##
+## END FIXME
+
+
+
+
+
+# This can be used to rebuild libtool when needed
+LIBTOOL_DEPS="$ac_aux_dir/ltmain.sh"
+
+# Always use our own libtool.
+LIBTOOL='$(SHELL) $(top_builddir)/libtool'
+
+# Prevent multiple expansion
+
+
+
+# Find a good install program.  We prefer a C program (faster),
+# so one script is as good as another.  But avoid the broken or
+# incompatible versions:
+# SysV /etc/install, /usr/sbin/install
+# SunOS /usr/etc/install
+# IRIX /sbin/install
+# AIX /bin/install
+# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag
+# AFS /usr/afsws/bin/install, which mishandles nonexistent args
+# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
+# ./install, which can be erroneously created by make from ./install.sh.
+echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6
+echo "configure:6393: checking for a BSD compatible install" >&5
+if test -z "$INSTALL"; then
+if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+    IFS="${IFS= 	}"; ac_save_IFS="$IFS"; IFS=":"
+  for ac_dir in $PATH; do
+    # Account for people who put trailing slashes in PATH elements.
+    case "$ac_dir/" in
+    /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;;
+    *)
+      # OSF1 and SCO ODT 3.0 have their own names for install.
+      # Don't use installbsd from OSF since it installs stuff as root
+      # by default.
+      for ac_prog in ginstall scoinst install; do
+        if test -f $ac_dir/$ac_prog; then
+	  if test $ac_prog = install &&
+            grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then
+	    # AIX install.  It has an incompatible calling convention.
+	    :
+	  else
+	    ac_cv_path_install="$ac_dir/$ac_prog -c"
+	    break 2
+	  fi
+	fi
+      done
+      ;;
+    esac
+  done
+  IFS="$ac_save_IFS"
+
+fi
+  if test "${ac_cv_path_install+set}" = set; then
+    INSTALL="$ac_cv_path_install"
+  else
+    # As a last resort, use the slow shell script.  We don't cache a
+    # path for INSTALL within a source directory, because that will
+    # break other packages using the cache if that directory is
+    # removed, or if the path is relative.
+    INSTALL="$ac_install_sh"
+  fi
+fi
+echo "$ac_t""$INSTALL" 1>&6
+
+# Use test -z because SunOS4 sh mishandles braces in ${var-val}.
+# It thinks the first close brace ends the variable substitution.
+test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
+
+test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}'
+
+test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
+
+echo $ac_n "checking whether ln -s works""... $ac_c" 1>&6
+echo "configure:6446: checking whether ln -s works" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_LN_S'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  rm -f conftestdata
+if ln -s X conftestdata 2>/dev/null
+then
+  rm -f conftestdata
+  ac_cv_prog_LN_S="ln -s"
+else
+  ac_cv_prog_LN_S=ln
+fi
+fi
+LN_S="$ac_cv_prog_LN_S"
+if test "$ac_cv_prog_LN_S" = "ln -s"; then
+  echo "$ac_t""yes" 1>&6
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6
+echo "configure:6467: checking whether ${MAKE-make} sets \${MAKE}" >&5
+set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftestmake <<\EOF
+all:
+	@echo 'ac_maketemp="${MAKE}"'
+EOF
+# GNU make sometimes prints "make[1]: Entering...", which would confuse us.
+eval `${MAKE-make} -f conftestmake 2>/dev/null | grep temp=`
+if test -n "$ac_maketemp"; then
+  eval ac_cv_prog_make_${ac_make}_set=yes
+else
+  eval ac_cv_prog_make_${ac_make}_set=no
+fi
+rm -f conftestmake
+fi
+if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  SET_MAKE=
+else
+  echo "$ac_t""no" 1>&6
+  SET_MAKE="MAKE=${MAKE-make}"
+fi
+
+# Extract the first word of "ps", so it can be a program name with args.
+set dummy ps; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:6496: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_path_PSPROG'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  case "$PSPROG" in
+  /*)
+  ac_cv_path_PSPROG="$PSPROG" # Let the user override the test with a path.
+  ;;
+  ?:/*)			 
+  ac_cv_path_PSPROG="$PSPROG" # Let the user override the test with a dos path.
+  ;;
+  *)
+  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS=":"
+  ac_dummy="$PATH"
+  for ac_dir in $ac_dummy; do 
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/$ac_word; then
+      ac_cv_path_PSPROG="$ac_dir/$ac_word"
+      break
+    fi
+  done
+  IFS="$ac_save_ifs"
+  ;;
+esac
+fi
+PSPROG="$ac_cv_path_PSPROG"
+if test -n "$PSPROG"; then
+  echo "$ac_t""$PSPROG" 1>&6
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+# Extract the first word of "perl", so it can be a program name with args.
+set dummy perl; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:6531: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_path_PERLPROG'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  case "$PERLPROG" in
+  /*)
+  ac_cv_path_PERLPROG="$PERLPROG" # Let the user override the test with a path.
+  ;;
+  ?:/*)			 
+  ac_cv_path_PERLPROG="$PERLPROG" # Let the user override the test with a dos path.
+  ;;
+  *)
+  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS=":"
+  ac_dummy="$PATH"
+  for ac_dir in $ac_dummy; do 
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/$ac_word; then
+      ac_cv_path_PERLPROG="$ac_dir/$ac_word"
+      break
+    fi
+  done
+  IFS="$ac_save_ifs"
+  ;;
+esac
+fi
+PERLPROG="$ac_cv_path_PERLPROG"
+if test -n "$PERLPROG"; then
+  echo "$ac_t""$PERLPROG" 1>&6
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+for ac_prog in whoami logname
+do
+# Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:6568: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_WHOAMI'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  if test -n "$WHOAMI"; then
+  ac_cv_prog_WHOAMI="$WHOAMI" # Let the user override the test.
+else
+  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS=":"
+  ac_dummy="$PATH"
+  for ac_dir in $ac_dummy; do
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/$ac_word; then
+      ac_cv_prog_WHOAMI="$ac_prog"
+      break
+    fi
+  done
+  IFS="$ac_save_ifs"
+fi
+fi
+WHOAMI="$ac_cv_prog_WHOAMI"
+if test -n "$WHOAMI"; then
+  echo "$ac_t""$WHOAMI" 1>&6
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+test -n "$WHOAMI" && break
+done
+test -n "$WHOAMI" || WHOAMI="whoami"
+
+for ac_prog in sed gsed
+do
+# Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:6603: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_SED'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  if test -n "$SED"; then
+  ac_cv_prog_SED="$SED" # Let the user override the test.
+else
+  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS=":"
+  ac_dummy="$PATH"
+  for ac_dir in $ac_dummy; do
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/$ac_word; then
+      ac_cv_prog_SED="$ac_prog"
+      break
+    fi
+  done
+  IFS="$ac_save_ifs"
+fi
+fi
+SED="$ac_cv_prog_SED"
+if test -n "$SED"; then
+  echo "$ac_t""$SED" 1>&6
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+test -n "$SED" && break
+done
+
+# Extract the first word of "autoconf", so it can be a program name with args.
+set dummy autoconf; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:6635: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_AUTOCONF'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  if test -n "$AUTOCONF"; then
+  ac_cv_prog_AUTOCONF="$AUTOCONF" # Let the user override the test.
+else
+  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS=":"
+  ac_dummy="$PATH"
+  for ac_dir in $ac_dummy; do
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/$ac_word; then
+      ac_cv_prog_AUTOCONF=""
+      break
+    fi
+  done
+  IFS="$ac_save_ifs"
+fi
+fi
+AUTOCONF="$ac_cv_prog_AUTOCONF"
+if test -n "$AUTOCONF"; then
+  echo "$ac_t""$AUTOCONF" 1>&6
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+# Extract the first word of "autoheader", so it can be a program name with args.
+set dummy autoheader; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:6664: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_AUTOHEADER'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  if test -n "$AUTOHEADER"; then
+  ac_cv_prog_AUTOHEADER="$AUTOHEADER" # Let the user override the test.
+else
+  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS=":"
+  ac_dummy="$PATH"
+  for ac_dir in $ac_dummy; do
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/$ac_word; then
+      ac_cv_prog_AUTOHEADER=""
+      break
+    fi
+  done
+  IFS="$ac_save_ifs"
+fi
+fi
+AUTOHEADER="$ac_cv_prog_AUTOHEADER"
+if test -n "$AUTOHEADER"; then
+  echo "$ac_t""$AUTOHEADER" 1>&6
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+if test "x$ac_cv_prog_AUTOCONF" = "x"; then
+	AUTOCONF=":"
+	
+fi
+if test "x$ac_cv_prog_AUTOHEADER" = "x"; then
+	AUTOHEADER=":"
+	
+fi
+
+# Extract the first word of "uname", so it can be a program name with args.
+set dummy uname; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:6702: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_path_UNAMEPROG'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  case "$UNAMEPROG" in
+  /*)
+  ac_cv_path_UNAMEPROG="$UNAMEPROG" # Let the user override the test with a path.
+  ;;
+  ?:/*)			 
+  ac_cv_path_UNAMEPROG="$UNAMEPROG" # Let the user override the test with a dos path.
+  ;;
+  *)
+  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS=":"
+  ac_dummy="$PATH"
+  for ac_dir in $ac_dummy; do 
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/$ac_word; then
+      ac_cv_path_UNAMEPROG="$ac_dir/$ac_word"
+      break
+    fi
+  done
+  IFS="$ac_save_ifs"
+  ;;
+esac
+fi
+UNAMEPROG="$ac_cv_path_UNAMEPROG"
+if test -n "$UNAMEPROG"; then
+  echo "$ac_t""$UNAMEPROG" 1>&6
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+cat >> confdefs.h <<EOF
+#define UNAMEPROG "$UNAMEPROG"
+EOF
+
+
+echo $ac_n "checking for working const""... $ac_c" 1>&6
+echo "configure:6740: checking for working const" >&5
+if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 6745 "configure"
+#include "confdefs.h"
+
+int main() {
+
+/* Ultrix mips cc rejects this.  */
+typedef int charset[2]; const charset x;
+/* SunOS 4.1.1 cc rejects this.  */
+char const *const *ccp;
+char **p;
+/* NEC SVR4.0.2 mips cc rejects this.  */
+struct point {int x, y;};
+static struct point const zero = {0,0};
+/* AIX XL C 1.02.0.0 rejects this.
+   It does not let you subtract one const X* pointer from another in an arm
+   of an if-expression whose if-part is not a constant expression */
+const char *g = "string";
+ccp = &g + (g ? g-g : 0);
+/* HPUX 7.0 cc rejects these. */
+++ccp;
+p = (char**) ccp;
+ccp = (char const *const *) p;
+{ /* SCO 3.2v4 cc rejects this.  */
+  char *t;
+  char const *s = 0 ? (char *) 0 : (char const *) 0;
+
+  *t++ = 0;
+}
+{ /* Someone thinks the Sun supposedly-ANSI compiler will reject this.  */
+  int x[] = {25, 17};
+  const int *foo = &x[0];
+  ++foo;
+}
+{ /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */
+  typedef const int *iptr;
+  iptr p = 0;
+  ++p;
+}
+{ /* AIX XL C 1.02.0.0 rejects this saying
+     "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */
+  struct s { int j; const int *ap[3]; };
+  struct s *b; b->j = 5;
+}
+{ /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */
+  const int foo = 10;
+}
+
+; return 0; }
+EOF
+if { (eval echo configure:6794: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  ac_cv_c_const=yes
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  ac_cv_c_const=no
+fi
+rm -f conftest*
+fi
+
+echo "$ac_t""$ac_cv_c_const" 1>&6
+if test $ac_cv_c_const = no; then
+  cat >> confdefs.h <<\EOF
+#define const 
+EOF
+
+fi
+
+echo $ac_n "checking for inline""... $ac_c" 1>&6
+echo "configure:6815: checking for inline" >&5
+if eval "test \"`echo '$''{'ac_cv_c_inline'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  ac_cv_c_inline=no
+for ac_kw in inline __inline__ __inline; do
+  cat > conftest.$ac_ext <<EOF
+#line 6822 "configure"
+#include "confdefs.h"
+
+int main() {
+} $ac_kw foo() {
+; return 0; }
+EOF
+if { (eval echo configure:6829: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  ac_cv_c_inline=$ac_kw; break
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+fi
+rm -f conftest*
+done
+
+fi
+
+echo "$ac_t""$ac_cv_c_inline" 1>&6
+case "$ac_cv_c_inline" in
+  inline | yes) ;;
+  no) cat >> confdefs.h <<\EOF
+#define inline 
+EOF
+ ;;
+  *)  cat >> confdefs.h <<EOF
+#define inline $ac_cv_c_inline
+EOF
+ ;;
+esac
+
+
+echo $ac_n "checking for net-snmp version number""... $ac_c" 1>&6
+echo "configure:6856: checking for net-snmp version number" >&5
+VERSION=`grep NetSnmpVersionInfo.*= $srcdir/snmplib/snmp_version.c | sed 's/";.*//;s/.*"//;s/pre/0./;'`
+
+RELEASEVERSION=`echo $VERSION | sed 's/^\([0-9]\)\.\([0-9]\)/\1:\2:0/'`
+
+
+
+echo "$ac_t""$VERSION" 1>&6
+
+  cat >> configure-summary << EOF
+  Net-SNMP Version:           $VERSION
+EOF
+
+
+echo $ac_n "checking for developer gcc flags""... $ac_c" 1>&6
+echo "configure:6871: checking for developer gcc flags" >&5
+if test "x$developer" = "xyes" -a "x$ac_cv_prog_gcc" = "xyes"; then
+  DEVFLAGS="-Wall -Wstrict-prototypes -Wwrite-strings -Wcast-qual -Wno-char-subscripts"
+else
+  DEVFLAGS=""
+fi
+echo "$ac_t""$DEVFLAGS" 1>&6
+
+
+
+# Do some error checking and defaulting for the host and target type.
+# The inputs are:
+#    configure --host=HOST --target=TARGET --build=BUILD NONOPT
+#
+# The rules are:
+# 1. You are not allowed to specify --host, --target, and nonopt at the
+#    same time.
+# 2. Host defaults to nonopt.
+# 3. If nonopt is not specified, then host defaults to the current host,
+#    as determined by config.guess.
+# 4. Target and build default to nonopt.
+# 5. If nonopt is not specified, then target and build default to host.
+
+# The aliases save the names the user supplied, while $host etc.
+# will get canonicalized.
+case $host---$target---$nonopt in
+NONE---*---* | *---NONE---* | *---*---NONE) ;;
+*) { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; } ;;
+esac
+
+
+# Make sure we can run config.sub.
+if ${CONFIG_SHELL-/bin/sh} $ac_config_sub sun4 >/dev/null 2>&1; then :
+else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; }
+fi
+
+echo $ac_n "checking host system type""... $ac_c" 1>&6
+echo "configure:6908: checking host system type" >&5
+
+host_alias=$host
+case "$host_alias" in
+NONE)
+  case $nonopt in
+  NONE)
+    if host_alias=`${CONFIG_SHELL-/bin/sh} $ac_config_guess`; then :
+    else { echo "configure: error: can not guess host type; you must specify one" 1>&2; exit 1; }
+    fi ;;
+  *) host_alias=$nonopt ;;
+  esac ;;
+esac
+
+host=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $host_alias`
+host_cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
+host_vendor=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
+host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
+echo "$ac_t""$host" 1>&6
+
+echo $ac_n "checking target system type""... $ac_c" 1>&6
+echo "configure:6929: checking target system type" >&5
+
+target_alias=$target
+case "$target_alias" in
+NONE)
+  case $nonopt in
+  NONE) target_alias=$host_alias ;;
+  *) target_alias=$nonopt ;;
+  esac ;;
+esac
+
+target=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $target_alias`
+target_cpu=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
+target_vendor=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
+target_os=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
+echo "$ac_t""$target" 1>&6
+
+echo $ac_n "checking build system type""... $ac_c" 1>&6
+echo "configure:6947: checking build system type" >&5
+
+build_alias=$build
+case "$build_alias" in
+NONE)
+  case $nonopt in
+  NONE) build_alias=$host_alias ;;
+  *) build_alias=$nonopt ;;
+  esac ;;
+esac
+
+build=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $build_alias`
+build_cpu=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
+build_vendor=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
+build_os=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
+echo "$ac_t""$build" 1>&6
+
+test "$host_alias" != "$target_alias" &&
+  test "$program_prefix$program_suffix$program_transform_name" = \
+    NONENONEs,x,x, &&
+  program_prefix=${target_alias}-
+
+
+PARTIALTARGETOS=`echo $target_os | sed 's/[-._].*//'`
+CFLAGS="$CFLAGS -D$PARTIALTARGETOS"
+
+
+  cat >> configure-summary << EOF
+  Building for:               $PARTIALTARGETOS
+EOF
+
+
+
+echo $ac_n "checking for system include file""... $ac_c" 1>&6
+echo "configure:6981: checking for system include file" >&5
+
+filebase=$target_os
+filebase=`echo $filebase | sed 's/elf//'`
+filebase=`echo $filebase | sed 's/aout//'`
+filebase=`echo $filebase | sed 's/ecoff//'`
+filebase=`echo $filebase | sed 's/coff//'`
+while test "x$filebase" != "x$last" -a ! -f $srcdir/include/net-snmp/system/$filebase.h
+do
+    last=$filebase
+    filebase=`echo $filebase | sed 's/[-._][^-._]*$//'`
+    if test "x$filebase" = "x$last"; then
+	filebase=`echo $filebase | sed 's/[0-9]*$//'`
+    fi
+done
+
+if test "x$filebase" = "x$last"; then
+    filebase="generic"
+fi
+ac_cv_SYSTEM_INCLUDE_FILE="net-snmp/system/$filebase.h"
+
+
+echo "$ac_t""$ac_cv_SYSTEM_INCLUDE_FILE" 1>&6
+cat >> confdefs.h <<EOF
+#define SYSTEM_INCLUDE_FILE "$ac_cv_SYSTEM_INCLUDE_FILE"
+EOF
+
+
+
+echo $ac_n "checking for machine-type include file""... $ac_c" 1>&6
+echo "configure:7011: checking for machine-type include file" >&5
+
+filebase=$target_cpu
+while test "x$filebase" != "x$last" -a ! -f $srcdir/include/net-snmp/machine/$filebase.h
+do
+    last=$filebase
+    filebase=`echo $filebase | sed 's/[-._][^-._]*$//'`
+done
+
+if test "x$filebase" = "x$last"; then
+    filebase="generic"
+fi
+ac_cv_MACHINE_INCLUDE_FILE="net-snmp/machine/$filebase.h"
+
+
+echo "$ac_t""$ac_cv_MACHINE_INCLUDE_FILE" 1>&6
+cat >> confdefs.h <<EOF
+#define MACHINE_INCLUDE_FILE "$ac_cv_MACHINE_INCLUDE_FILE"
+EOF
+
+
+# Extract the first word of "$CC", so it can be a program name with args.
+set dummy $CC; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:7035: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_path_CCPATH'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  case "$CCPATH" in
+  /*)
+  ac_cv_path_CCPATH="$CCPATH" # Let the user override the test with a path.
+  ;;
+  ?:/*)			 
+  ac_cv_path_CCPATH="$CCPATH" # Let the user override the test with a dos path.
+  ;;
+  *)
+  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS=":"
+  ac_dummy="$PATH"
+  for ac_dir in $ac_dummy; do 
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/$ac_word; then
+      ac_cv_path_CCPATH="$ac_dir/$ac_word"
+      break
+    fi
+  done
+  IFS="$ac_save_ifs"
+  ;;
+esac
+fi
+CCPATH="$ac_cv_path_CCPATH"
+if test -n "$CCPATH"; then
+  echo "$ac_t""$CCPATH" 1>&6
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+case $target_os in
+    bsdi*)
+	if test "x$CCPATH" = "x/usr/ucb/cc" -o "x$CCPATH" = "x/usr/bin/cc"; then
+	    { echo "configure: error: 
+
+*** The BSDI /usr/ucb/cc compiler does not work with this package.  
+*** Please run configure with --with-cc=gcc
+" 1>&2; exit 1; }
+	fi
+    ;;
+    solaris*)
+	if test "x$CCPATH" = "x/usr/ucb/cc"; then
+	    { echo "configure: error: 
+
+*** The solaris /usr/ucb/cc compiler does not work with this package.  
+*** Please put a different compiler in your path first or run
+*** configure with --with-cc=XX, where XX is the compiler you want to use.
+" 1>&2; exit 1; }
+	fi
+    ;;
+esac
+    
+echo $ac_n "checking for additional cpp flags""... $ac_c" 1>&6
+echo "configure:7090: checking for additional cpp flags" >&5
+if test "x$GCC" = "xyes" -a "x$CPP" = "x$CC -E"; then
+    EXTRACPPFLAGS="-x c"
+else
+  EXTRACPPFLAGS=""
+fi
+
+if test "x$GCC" != "xyes"; then
+  case $target_os in
+    solaris*) EXTRACPPFLAGS="$EXTRACPPFLAGS -Xs" ;;
+  esac
+fi
+
+
+echo "$ac_t""$EXTRACPPFLAGS" 1>&6
+
+
+if test "x$prefix" = "xNONE"; then
+  prefix=/usr/local
+fi
+
+fch=`echo $prefix | sed 's/\(.\).*/\1/'`
+if test $fch != "/" ; then
+   prefix=`pwd`/$prefix
+   echo "adjusting prefix to $prefix"
+fi
+
+if test "x$exec_prefix" = "xNONE"; then
+  exec_prefix=$prefix
+fi
+
+fch=`echo $exec_prefix | sed 's/\(.\).*/\1/'`
+if test $fch != "/" ; then
+   exec_prefix=`pwd`/$exec_prefix
+   echo "adjusting exec_prefix to $exec_prefix"
+fi
+
+
+SNMPLIBPATH=""
+tmpset="$libdir/snmp"
+while test "x$tmpset" != "x$SNMPLIBPATH"; do
+  SNMPLIBPATH="$tmpset"
+  eval tmpset="$tmpset"
+done
+cat >> confdefs.h <<EOF
+#define SNMPLIBPATH "$SNMPLIBPATH"
+EOF
+
+cat >> confdefs.h <<EOF
+#define SNMPDLMODPATH "$SNMPLIBPATH/dlmod"
+EOF
+
+
+SNMPSHAREPATH=""
+tmpset="$datadir/snmp"
+while test "x$tmpset" != "x$SNMPSHAREPATH"; do
+  SNMPSHAREPATH="$tmpset"
+  eval tmpset="$tmpset"
+done
+cat >> confdefs.h <<EOF
+#define SNMPSHAREPATH "$SNMPSHAREPATH"
+EOF
+
+
+if test "x$DEFAULT_MIBDIRS" = "x"; then
+  cat >> confdefs.h <<EOF
+#define DEFAULT_MIBDIRS "\$HOME/.snmp/mibs:$SNMPSHAREPATH/mibs"
+EOF
+
+fi
+
+SNMPCONFPATH=""
+tmpset="$sysconfdir/snmp"
+while test "x$tmpset" != "x$SNMPCONFPATH"; do
+  SNMPCONFPATH="$tmpset"
+  eval tmpset="$tmpset"
+done
+cat >> confdefs.h <<EOF
+#define SNMPCONFPATH "$SNMPCONFPATH"
+EOF
+
+
+
+if test "x$enable_ipv6" = "xyes"; then
+	v6type=unknown
+	v6lib=none
+	v6trylibc=no
+
+	echo $ac_n "checking ipv6 stack type""... $ac_c" 1>&6
+echo "configure:7179: checking ipv6 stack type" >&5
+	for i in v6d toshiba kame inria zeta linux-glibc linux-inet6; do
+		case $i in
+		v6d)
+			cat > conftest.$ac_ext <<EOF
+#line 7184 "configure"
+#include "confdefs.h"
+dnl
+#include </usr/local/v6/include/sys/types.h>
+#ifdef __V6D__
+yes
+#endif
+EOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  egrep "yes" >/dev/null 2>&1; then
+  rm -rf conftest*
+  v6type=$i; v6lib=v6;
+				v6libdir=/usr/local/v6/lib;
+				CFLAGS="-I/usr/local/v6/include $CFLAGS"
+fi
+rm -f conftest*
+
+			;;
+		toshiba)
+			cat > conftest.$ac_ext <<EOF
+#line 7204 "configure"
+#include "confdefs.h"
+dnl
+#include <sys/param.h>
+#ifdef _TOSHIBA_INET6
+yes
+#endif
+EOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  egrep "yes" >/dev/null 2>&1; then
+  rm -rf conftest*
+  v6type=$i; v6lib=inet6;
+				v6libdir=/usr/local/v6/lib;
+				CFLAGS="-DINET6 $CFLAGS"
+fi
+rm -f conftest*
+
+			;;
+		kame)
+			cat > conftest.$ac_ext <<EOF
+#line 7224 "configure"
+#include "confdefs.h"
+dnl
+#include <netinet/in.h>
+#ifdef __KAME__
+yes
+#endif
+EOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  egrep "yes" >/dev/null 2>&1; then
+  rm -rf conftest*
+  v6type=$i; v6lib=inet6;
+				v6libdir=/usr/local/v6/lib;
+				v6trylibc=yes;
+				CFLAGS="-DINET6 $CFLAGS"
+fi
+rm -f conftest*
+
+			;;
+		inria)
+			cat > conftest.$ac_ext <<EOF
+#line 7245 "configure"
+#include "confdefs.h"
+dnl
+#include <netinet/in.h>
+#ifdef IPV6_INRIA_VERSION
+yes
+#endif
+EOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  egrep "yes" >/dev/null 2>&1; then
+  rm -rf conftest*
+  v6type=$i;
+				v6lib=dummy;
+				v6libdir=none;
+				v6trylibc=yes;
+				CFLAGS="-DINET6 $CFLAGS"
+fi
+rm -f conftest*
+
+			;;
+		zeta)
+			cat > conftest.$ac_ext <<EOF
+#line 7267 "configure"
+#include "confdefs.h"
+dnl
+#include <sys/param.h>
+#ifdef _ZETA_MINAMI_INET6
+A
+yes
+#endif
+EOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  egrep "yes" >/dev/null 2>&1; then
+  rm -rf conftest*
+  v6type=$i; v6lib=inet6;
+				v6libdir=/usr/local/v6/lib;
+				CFLAGS="-DINET6 $CFLAGS"
+fi
+rm -f conftest*
+
+			;;
+		linux-glibc)
+			cat > conftest.$ac_ext <<EOF
+#line 7288 "configure"
+#include "confdefs.h"
+dnl
+#include <features.h>
+#if defined(__GLIBC__) && ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1) || (__GLIBC_ > 2))
+yes
+#endif
+EOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  egrep "yes" >/dev/null 2>&1; then
+  rm -rf conftest*
+  v6type=$i;
+				v6lib=dummy;
+				v6libdir=none;
+				v6trylibc=yes;
+				CFLAGS="-DINET6 $CFLAGS"
+fi
+rm -f conftest*
+
+			;;
+		linux-inet6)
+			if test -d /usr/inet6; then
+				v6type=$i
+				v6lib=inet6
+				v6libdir=/usr/inet6/lib
+				CFLAGS="-DINET6 $CFLAGS"
+			fi
+			;;
+		esac
+		if test "$v6type" != "unknown"; then
+			break
+		fi
+	done
+
+	if test "$v6lib" != "none"; then
+		if test -d $v6libdir -a -f $v6libdir/lib$v6lib.a; then
+			LIBS="-L$v6libdir -l$v6lib $LIBS"
+			enable_ipv6="yes"
+			echo "$ac_t"""$v6type, $enable_ipv6, using lib$v6lib"" 1>&6
+		elif test "$v6trylibc" = "yes"; then
+			enable_ipv6="yes"
+			echo "$ac_t"""$v6type, $enable_ipv6, using libc"" 1>&6
+		else
+			{ echo "configure: error: no IPv6 library lib$v6lib.a found." 1>&2; exit 1; }
+			exit 1
+		fi
+	else
+		enable_ipv6="no"
+		echo "$ac_t"""$v6type, $enable_ipv6"" 1>&6
+	fi
+fi
+
+
+if test "x$with_res_locks" = "xyes"; then
+  cat >> confdefs.h <<\EOF
+#define NS_REENTRANT 1
+EOF
+
+EOF
+
+    case $target_os in
+
+    aix*)
+	CC_RUNTIME_ARG="$CC_RUNTIME_ARG -lpthreads"
+	;;
+
+    *)
+	;;
+
+    esac
+fi
+
+echo $ac_n "checking whether we have to build PIC code""... $ac_c" 1>&6
+echo "configure:7361: checking whether we have to build PIC code" >&5
+echo "$with_mib_modules" | grep "ucd-snmp/dlmod" >/dev/null
+if test $? -eq 0 ; then
+	DLLIBS="-ldl"
+        LIB_CFLAGS="$LIB_CFLAGS $SHLIB_CFLAGS"
+	echo "$ac_t""yes" 1>&6
+else
+	DLLIBS=""
+	echo "$ac_t""no" 1>&6
+fi
+
+echo $ac_n "checking for and configuring transport modules to use""... $ac_c" 1>&6
+echo "configure:7373: checking for and configuring transport modules to use" >&5
+transport_src_list=""
+transport_hdr_list=""
+transport_def_list=""
+transport_result_list=""
+transport_add_list=""
+new_with_transport_list=`echo $with_transports | sed 's/,/ /g;'`
+new_with_out_transport_list=`echo $with_out_transports | sed 's/,/ /g;'`
+
+if test "x$PARTIALTARGETOS" = "xcygwin"; then
+  transport_default_list="UDP TCP Callback"
+else
+  transport_default_list="UDP TCP Unix Callback"
+fi
+if test "x$enable_ipv6" = "xyes"; then
+  transport_default_list="UDPIPv6 TCPIPv6 $transport_default_list"
+fi
+for i in $transport_default_list; do
+  if echo " $new_with_transport_list " | grep " $i " >/dev/null; then
+    :
+  else
+    transport_add_list="$i $transport_add_list"
+  fi
+done
+new_transport_list="$transport_add_list $new_with_transport_list"
+
+for i in $new_transport_list; do
+  if echo " $new_with_out_transport_list " | grep " $i " >/dev/null; then
+    if test "x$i" = "xUDP"; then
+      echo
+      { echo "configure: error: It is not possible to compile without UDP/IP support." 1>&2; exit 1; }
+    fi
+  else
+    if test "x$i" = "xAAL5PVC"; then
+      if test "x$PARTIALTARGETOS" != "xlinux"; then
+        echo
+        { echo "configure: error: AAL5 PVC support unavailable for this platform (Linux only)" 1>&2; exit 1; }
+      fi
+    fi
+    if test "x$i" = "xIPX"; then
+      if test "x$PARTIALTARGETOS" != "xlinux"; then
+        echo
+        { echo "configure: error: IPX support unavailable for this platform (Linux only)" 1>&2; exit 1; }
+      fi
+    fi
+    if test "x$i" = "xUnix"; then
+      if test "x$PARTIALTARGETOS" = "xcygwin"; then
+        echo
+        { echo "configure: error: Unix domain protocol support unavailable for this platform" 1>&2; exit 1; }
+      fi
+    fi
+    transport_src="snmp"$i"Domain.c"
+    transport_hdr="snmp"$i"Domain.h"
+    rel_transport_src="snmplib/"$transport_src
+    rel_transport_hdr="include/net-snmp/library/"$transport_hdr
+    if test -f "$srcdir/$rel_transport_src"; then
+      transport_result_list="$transport_result_list $i"
+      transport_src_list="$transport_src $transport_src_list"
+      if test -f "$srcdir/$rel_transport_hdr"; then
+        transport_hdr_list="$transport_hdr $transport_hdr_list"
+      fi
+      transport_def=`echo $i | sed 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
+      transport_def_list="SNMP_TRANSPORT_"$transport_def"_DOMAIN $transport_def_list"
+    else
+      echo
+      { echo "configure: error: Cannot find file $transport_src to support SNMP transport domain $i." 1>&2; exit 1; }
+    fi
+  fi
+done
+transport_obj_list=`echo " $transport_src_list " | sed 's/\.c/\.o/g'`
+transport_lobj_list=`echo " $transport_src_list " | sed 's/\.c/\.lo/g'`
+
+
+
+
+for i in $transport_def_list; do
+  cat >> confdefs.h <<EOF
+#define $i 1
+EOF
+
+done
+echo "$ac_t""$transport_result_list." 1>&6
+
+  cat >> configure-summary << EOF
+  Network transport support: $transport_result_list
+EOF
+
+
+
+echo $ac_n "checking for security modules to use""... $ac_c" 1>&6
+echo "configure:7463: checking for security modules to use" >&5
+security_def_list="usm"
+security_src_list=""
+security_obj_list=""
+security_lobj_list=""
+security_init_file="snmplib/snmpsm_init.h"
+security_incl_file="include/net-snmp/library/snmpv3-security-includes.h"
+new_with_security=`echo $with_security_modules | sed 's/,/ /g;'`
+new_with_out_security=`echo $with_out_security_modules | sed 's/,/ /g;'`
+
+if test ! -d include; then
+  mkdir include
+fi
+if test ! -d include/net-snmp; then
+  mkdir include/net-snmp
+fi
+if test ! -d include/net-snmp/agent; then
+  mkdir include/net-snmp/agent
+fi
+if test ! -d include/net-snmp/library; then
+  mkdir include/net-snmp/library
+fi
+if test ! -d include/ucd-snmp; then
+  mkdir include/ucd-snmp
+fi
+
+if test ! -d snmplib; then
+  mkdir snmplib
+fi
+echo "/* This file is automatically generated by configure.  Do not modify by hand. */" > $security_init_file
+echo "/* This file is automatically generated by configure.  Do not modify by hand. */" > $security_incl_file
+
+for i in $security_def_list; do
+  if echo " $new_with_out_security " | grep " $i " > /dev/null; then
+    if test "x$i" = "xusm"; then
+	echo
+        { echo "configure: error: The USM security module is mandatory" 1>&2; exit 1; }
+    fi
+  else
+    new_with_security="$new_with_security $i"
+  fi
+done
+
+for i in $new_with_security; do
+  cfile="snmp"$i".c"
+  hfile="snmp"$i".h"
+
+  # make sure support exists for it
+  if test -f $srcdir"/snmplib/"$cfile -a -f $srcdir"/include/net-snmp/library/"$hfile; then
+    :
+  else
+    echo
+    { echo "configure: error: No such security module: $i / $cfile / $hfile" 1>&2; exit 1; }
+  fi
+
+  # define a bunch of stuff to enable it
+  security_src_list="$security_src_list $cfile"
+  security_hdr_list="$security_hdr_list $hfile"
+  security_obj_list="$security_obj_list snmp"$i".o"
+  security_lobj_list="$security_lobj_list snmp"$i".lo"
+  def_name="SNMP_SECMOD_"`echo $i | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+  echo "init_"$i"();" >> $security_init_file
+  echo "#include <net-snmp/library/$hfile>" >> $security_incl_file
+  cat >> confdefs.h <<EOF
+#define $def_name 1
+EOF
+
+done
+
+
+
+
+
+echo "$ac_t""$new_with_security" 1>&6
+
+  cat >> configure-summary << EOF
+  SNMPv3 Security Modules:   $new_with_security
+EOF
+
+
+
+for sec in $new_with_security
+do
+  if test x$sec = xksm; then
+    echo $ac_n "checking to see which crypto API we need to use""... $ac_c" 1>&6
+echo "configure:7548: checking to see which crypto API we need to use" >&5
+
+    echo $ac_n "checking for krb5_c_encrypt""... $ac_c" 1>&6
+echo "configure:7551: checking for krb5_c_encrypt" >&5
+if eval "test \"`echo '$''{'ac_cv_func_krb5_c_encrypt'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 7556 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char krb5_c_encrypt(); below.  */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char krb5_c_encrypt();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_krb5_c_encrypt) || defined (__stub___krb5_c_encrypt)
+choke me
+#else
+krb5_c_encrypt();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:7579: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_func_krb5_c_encrypt=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_func_krb5_c_encrypt=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'krb5_c_encrypt`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  
+      echo "$ac_t""new MIT crypto API" 1>&6
+      cat >> confdefs.h <<\EOF
+#define MIT_NEW_CRYPTO 1
+EOF
+
+else
+  echo "$ac_t""no" 1>&6
+
+      echo "$ac_t""old MIT crypto API" 1>&6
+fi
+
+  fi
+done
+
+echo $ac_n "checking for and configuring mib modules to use""... $ac_c" 1>&6
+echo "configure:7609: checking for and configuring mib modules to use" >&5
+
+
+mibdir="agent/mibgroup"
+module_list=""
+module_list_code=""
+new_with_mib_modules=`echo $with_mib_modules | sed 's/,/ /g;'`
+new_with_out_mib_modules=`echo $with_out_mib_modules | sed 's/,/ /g;'`
+new_module_list="mibII ucd_snmp snmpv3mibs notification target agent_mibs agentx agent_mibs utilities $new_with_mib_modules"
+default_mibs=IP-MIB:IF-MIB:TCP-MIB:UDP-MIB:SNMPv2-MIB:RFC1213-MIB:NOTIFICATION-LOG-MIB
+
+if test "x$mini_agent" = "xyes"; then
+new_with_out_mib_modules="mibII $new_with_out_mib_modules"
+new_module_list="snmpv3mibs mibII/snmp_mib mibII/system_mib mibII/sysORTable mibII/vacm_vars $new_with_mib_modules"
+default_mibs=SNMPv2-MIB:RFC1213-MIB
+default_mibs_install=" "
+fi
+
+
+if test "x$enable_ipv6" = "xyes"; then
+	new_module_list="$new_module_list mibII/ipv6"
+fi
+
+if test ! -d agent; then
+  mkdir agent
+fi
+if test ! -d agent/mibgroup; then
+  mkdir agent/mibgroup
+fi
+for i in $mibdir/mib_module_includes.h $mibdir/mib_module_inits.h $mibdir/mib_module_shutdown.h include/net-snmp/agent/mib_module_config.h $mibdir/mib_module_dot_conf.h; do
+  rm -f $i
+  echo "/* This file is automatically generated by configure.  Do not modify by hand. */" > $i
+done
+
+test_modules="$new_module_list"
+new_module_list=""
+module_list_h=""
+
+for i in $test_modules
+ do
+  if echo " $new_with_out_mib_modules " | grep " $i " > /dev/null; then
+    :
+  else
+    new_module_list="$new_module_list $i"
+  fi
+done
+
+
+echo "$ac_t""$new_module_list." 1>&6
+
+  cat >> configure-summary << EOF
+  Agent MIB code:            $new_module_list
+EOF
+
+
+echo $ac_n "checking for and configuring mib modules pieces to use""... $ac_c" 1>&6
+echo "configure:7665: checking for and configuring mib modules pieces to use" >&5
+FD=6
+
+
+while test "x$new_module_list" != "x"; do
+  for i in $new_module_list
+    do
+    if echo " $new_with_out_mib_modules " | grep " $i " > /dev/null; then
+      :
+    else
+      if test -f $srcdir/$mibdir/$i.h; then
+        new_list=""
+        new_list_arch=`grep config_arch_require $srcdir/$mibdir/$i.h | sed 's/.*config_arch_require(\(.*\), *\(.*\)).*/\1-xarchx-\2/'`
+	if test "x$new_list_arch" != "x"; then
+          for j in $new_list_arch
+	    do
+	    archtest=`echo $j | sed 's/-xarchx-.*//'`
+	    if test "x$target_os" = "x$archtest" -o "x$PARTIALTARGETOS" = "x$archtest"; then
+	      new_list="$new_list `echo $j | sed 's/.*-xarchx-//'`"
+	    fi
+	  done
+	fi
+	new_list="$new_list `grep config_require $srcdir/$mibdir/$i.h | sed 's/.*config_require(\(.*\)).*/\1/'`"
+	if test "x$new_list" != "x"; then
+	  for j in $new_list
+	    do
+	    if test ! -f $srcdir/$mibdir/$j.h; then
+              
+	      { echo "configure: error: mib module "$i" requires module "$j" but $j.h or $j.c could not be found in $srcdir/$mibdir" 1>&2; exit 1; }
+              
+	    elif echo " $new_with_out_mib_modules " | grep " $j " > /dev/null; then
+              
+	      echo "configure: warning: mib module "$i" requires module "$j" but you told me to compile without it" 1>&2
+              
+	    elif echo " $module_list $new_list_two $new_module_list " | grep " $j " > /dev/null; then
+	      :
+	    else
+	      new_list_two="$new_list_two $j"
+	    fi
+	  done
+	fi
+	new_mibs=`grep config_add_mib $srcdir/$mibdir/$i.h | sed 's/.*config_add_mib(\(.*\)).*/\1/'`
+	if test "x$new_mibs" != "x"; then
+	    for j in $new_mibs
+		do
+		if test "x`echo :$default_mibs: | grep :$j:`" = "x"; then
+		    default_mibs="$default_mibs:$j"
+		fi
+		if test -f $srcdir/mibs/$j.txt; then
+		    if echo $default_mibs_install | grep " $j " > /dev/null; then
+			    :
+		    else
+			    default_mibs_install="$default_mibs_install $j.txt"
+		    fi
+		fi
+	    done
+	fi
+      else
+        
+	{ echo "configure: error: module files $i.h or $i.c could not be found in $srcdir/$mibdir" 1>&2; exit 1; }
+        
+      fi
+      module_list="$module_list $i"
+      echo '#include "'"mibgroup/$i.h"'"' >> $mibdir/mib_module_includes.h
+      module_list_h="$module_list_h mibgroup/$i.h"
+      if test -f $srcdir/$mibdir/$i.c; then
+        module_list_code="$module_list_code $i"
+        mnm=`echo $i | sed 's/.*\///;s/\.c$//;'`
+        temp_init=`grep init_$mnm $srcdir/$mibdir/$i.c | grep -v _init_$mnm`
+	if test "x$temp_init" != "x"; then
+	    echo "  if (should_init(\"$mnm\")) init_$mnm();" >> $mibdir/mib_module_inits.h
+	fi
+	if grep shutdown_`basename $i` $srcdir/$mibdir/$i.c > /dev/null; then
+	    echo "  if (should_init(\"`basename $i`\")) shutdown_`basename $i`();" >> $mibdir/mib_module_shutdown.h
+	fi
+      fi
+      if test "x`echo $i | sed 's/\///g;'`" != "x$i"; then
+	mnd=`echo $i | sed 's/\/[^/]*$//;'`
+	if test ! -d ./$mibdir/$mnd; then
+	    module_directories="$module_directories ./$mibdir/$mnd"
+	fi
+      fi
+      if grep config_load_mib $srcdir/$mibdir/$i.h > /dev/null 2>&1; then
+        
+      	echo "configure: warning: mib module "$i" uses the "config_load_mib" directive" 1>&2
+        
+      fi
+      grep config_parse_dot_conf $srcdir/$mibdir/$i.h | sed 's@.*config_parse_dot_conf(\([^)]*\), *\([^),]*\), *\([^),]*\), *\([^),]*\)).*@register_config_handler("snmpd",\1, \2, \3, \4);@' >> $mibdir/mib_module_dot_conf.h
+      sym="`echo ${i} | sed 's/[^a-zA-Z0-9_]/_/g' | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`"
+      echo "/* Define if compiling with the ${i} module files.  */" >> include/net-snmp/agent/mib_module_config.h
+      echo "#define USING_${sym}_MODULE 1" >> include/net-snmp/agent/mib_module_config.h
+      echo " " >> include/net-snmp/agent/mib_module_config.h
+      echo $ac_n " $i$ac_c" >&$FD
+    fi
+  done
+  new_module_list="$new_list_two"
+  new_list_two=""
+done
+module_list_o=`echo "$module_list_code " | sed 's/\([^ ]\) /\1.o /g'`
+module_list_lo=`echo "$module_list_code " | sed 's/\([^ ]\) /\1.lo /g'`
+module_list_c=`echo "$module_list_code " | sed 's/\([^ ]\) /\1.c /g'`
+mibgroup_list_o=`echo " $module_list_o " | sed 's@ \([^ ]*\)\.o@ mibgroup/\1.o @g'`
+mibgroup_list_lo=`echo " $module_list_lo " | sed 's@ \([^ ]*\)\.lo@ mibgroup/\1.lo @g'`
+
+MODULE_LIST=$module_list_code
+
+
+
+
+
+
+
+
+
+
+echo "$ac_t""." 1>&6
+
+echo $ac_n "checking if directories need to be created""... $ac_c" 1>&6
+echo "configure:7783: checking if directories need to be created" >&5
+for i in $module_directories; do
+  $srcdir/mkinstalldirs $i
+done
+echo "$ac_t""." 1>&6
+
+echo $ac_n "checking default mib files to read""... $ac_c" 1>&6
+echo "configure:7790: checking default mib files to read" >&5
+if test "x$DEFAULT_MIBS" = "x"; then
+  DEFAULT_MIBS="$default_mibs"
+fi
+cat >> confdefs.h <<EOF
+#define DEFAULT_MIBS "$DEFAULT_MIBS"
+EOF
+
+echo "$ac_t""$DEFAULT_MIBS" 1>&6
+
+
+echo $ac_n "checking for location of system kernel""... $ac_c" 1>&6
+echo "configure:7802: checking for location of system kernel" >&5
+if eval "test \"`echo '$''{'ac_cv_KERNEL_LOC'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  ac_cv_KERNEL_LOC="unknown"
+
+if test -c /dev/null; then
+  CFLAG="-c"
+elif test -f /dev/null; then
+  CFLAG="-f"
+else
+    CFLAG="-f"
+fi
+for i in /vmunix /hp-ux /stand/vmunix /dev/ksyms /kernel/unix /kernel/genunix /netbsd /unix /kernel /bsd /mach_kernel
+  do
+  if test -f $i -o $CFLAG $i; then
+    ac_cv_KERNEL_LOC="$i"
+    break;
+  fi
+done
+if test $i = "unknown"; then
+  echo "configure: warning: Can't find system kernel...  Setting to /vmunix" 1>&2
+  ac_cv_KERNEL_LOC="/vmunix"
+fi
+
+fi
+
+echo "$ac_t""$ac_cv_KERNEL_LOC" 1>&6
+
+cat >> confdefs.h <<EOF
+#define KERNEL_LOC "$ac_cv_KERNEL_LOC"
+EOF
+
+
+
+echo $ac_n "checking for mount table location""... $ac_c" 1>&6
+echo "configure:7838: checking for mount table location" >&5
+if eval "test \"`echo '$''{'ac_cv_ETC_MNTTAB'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  ac_cv_ETC_MNTTAB="/etc/mtab"
+fi
+
+echo "$ac_t""$ac_cv_ETC_MNTTAB" 1>&6
+
+cat >> confdefs.h <<EOF
+#define ETC_MNTTAB "$ac_cv_ETC_MNTTAB"
+EOF
+
+
+echo $ac_n "checking for location of swap device""... $ac_c" 1>&6
+echo "configure:7861: checking for location of swap device" >&5
+if eval "test \"`echo '$''{'ac_cv_DMEM_LOC'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+
+if test -f /dev/kmem; then
+  CTEST="test -f"
+elif test -c /dev/kmem; then
+  CTEST="test -c"
+else
+    CTEST="test -f"
+fi
+
+if $CTEST /dev/dmem; then
+  ac_cv_DMEM_LOC="/dev/dmem"
+elif $CTEST /dev/drum; then
+  ac_cv_DMEM_LOC="/dev/drum"
+else
+  ac_cv_DMEM_LOC="none"
+fi
+
+fi
+
+echo "$ac_t""$ac_cv_DMEM_LOC" 1>&6
+
+if test "x$ac_cv_DMEM_LOC" != "xnone"; then
+  cat >> confdefs.h <<EOF
+#define DMEM_LOC "$ac_cv_DMEM_LOC"
+EOF
+
+fi
+
+
+if test "x$use_efence" = "xyes"; then
+    echo $ac_n "checking for EF_Exit in -lefence""... $ac_c" 1>&6
+echo "configure:7897: checking for EF_Exit in -lefence" >&5
+ac_lib_var=`echo efence'_'EF_Exit | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  ac_save_LIBS="$LIBS"
+LIBS="-lefence  $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 7905 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char EF_Exit();
+
+int main() {
+EF_Exit()
+; return 0; }
+EOF
+if { (eval echo configure:7916: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_lib=HAVE_LIB`echo efence | sed -e 's/[^a-zA-Z0-9_]/_/g' \
+    -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_lib 1
+EOF
+
+  LIBS="-lefence $LIBS"
+
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+fi
+
+echo $ac_n "checking for asin in -lm""... $ac_c" 1>&6
+echo "configure:7946: checking for asin in -lm" >&5
+ac_lib_var=`echo m'_'asin | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  ac_save_LIBS="$LIBS"
+LIBS="-lm  $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 7954 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char asin();
+
+int main() {
+asin()
+; return 0; }
+EOF
+if { (eval echo configure:7965: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_lib=HAVE_LIB`echo m | sed -e 's/[^a-zA-Z0-9_]/_/g' \
+    -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_lib 1
+EOF
+
+  LIBS="-lm $LIBS"
+
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+echo $ac_n "checking for nlist in -lelf""... $ac_c" 1>&6
+echo "configure:7993: checking for nlist in -lelf" >&5
+ac_lib_var=`echo elf'_'nlist | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  ac_save_LIBS="$LIBS"
+LIBS="-lelf  $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 8001 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char nlist();
+
+int main() {
+nlist()
+; return 0; }
+EOF
+if { (eval echo configure:8012: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_lib=HAVE_LIB`echo elf | sed -e 's/[^a-zA-Z0-9_]/_/g' \
+    -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_lib 1
+EOF
+
+  LIBS="-lelf $LIBS"
+
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+
+echo $ac_n "checking for gethostbyname""... $ac_c" 1>&6
+echo "configure:8041: checking for gethostbyname" >&5
+if eval "test \"`echo '$''{'ac_cv_func_gethostbyname'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 8046 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char gethostbyname(); below.  */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char gethostbyname();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_gethostbyname) || defined (__stub___gethostbyname)
+choke me
+#else
+gethostbyname();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:8069: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_func_gethostbyname=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_func_gethostbyname=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'gethostbyname`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  cat >> confdefs.h <<\EOF
+#define HAVE_GETHOSTBYNAME 1
+EOF
+
+else
+  echo "$ac_t""no" 1>&6
+echo $ac_n "checking for gethostbyname in -lnsl""... $ac_c" 1>&6
+echo "configure:8090: checking for gethostbyname in -lnsl" >&5
+ac_lib_var=`echo nsl'_'gethostbyname | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  ac_save_LIBS="$LIBS"
+LIBS="-lnsl  $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 8098 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char gethostbyname();
+
+int main() {
+gethostbyname()
+; return 0; }
+EOF
+if { (eval echo configure:8109: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  cat >> confdefs.h <<\EOF
+#define HAVE_GETHOSTBYNAME 1
+EOF
+
+	LIBS="${LIBS} -lnsl"
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+fi
+
+echo $ac_n "checking for getservbyname""... $ac_c" 1>&6
+echo "configure:8136: checking for getservbyname" >&5
+if eval "test \"`echo '$''{'ac_cv_func_getservbyname'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 8141 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char getservbyname(); below.  */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char getservbyname();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_getservbyname) || defined (__stub___getservbyname)
+choke me
+#else
+getservbyname();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:8164: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_func_getservbyname=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_func_getservbyname=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'getservbyname`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  cat >> confdefs.h <<\EOF
+#define HAVE_GETSERVBYNAME 1
+EOF
+
+else
+  echo "$ac_t""no" 1>&6
+echo $ac_n "checking for getservbyname in -lsocket""... $ac_c" 1>&6
+echo "configure:8185: checking for getservbyname in -lsocket" >&5
+ac_lib_var=`echo socket'_'getservbyname | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  ac_save_LIBS="$LIBS"
+LIBS="-lsocket  $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 8193 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char getservbyname();
+
+int main() {
+getservbyname()
+; return 0; }
+EOF
+if { (eval echo configure:8204: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  cat >> confdefs.h <<\EOF
+#define HAVE_GETSERVBYNAME 1
+EOF
+
+	LIBS="${LIBS} -lsocket"
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+fi
+
+
+echo $ac_n "checking for kstat_lookup in -lkstat""... $ac_c" 1>&6
+echo "configure:8232: checking for kstat_lookup in -lkstat" >&5
+ac_lib_var=`echo kstat'_'kstat_lookup | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  ac_save_LIBS="$LIBS"
+LIBS="-lkstat  $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 8240 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char kstat_lookup();
+
+int main() {
+kstat_lookup()
+; return 0; }
+EOF
+if { (eval echo configure:8251: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_lib=HAVE_LIB`echo kstat | sed -e 's/[^a-zA-Z0-9_]/_/g' \
+    -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_lib 1
+EOF
+
+  LIBS="-lkstat $LIBS"
+
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+echo $ac_n "checking for nlist in -lmld""... $ac_c" 1>&6
+echo "configure:8279: checking for nlist in -lmld" >&5
+ac_lib_var=`echo mld'_'nlist | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  ac_save_LIBS="$LIBS"
+LIBS="-lmld  $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 8287 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char nlist();
+
+int main() {
+nlist()
+; return 0; }
+EOF
+if { (eval echo configure:8298: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_lib=HAVE_LIB`echo mld | sed -e 's/[^a-zA-Z0-9_]/_/g' \
+    -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_lib 1
+EOF
+
+  LIBS="-lmld $LIBS"
+
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+
+if test "x$tryopenssl" != "xno"; then
+    if test "x$tryrsaref" != "xno"; then
+         echo $ac_n "checking for RSAPrivateDecrypt in -lrsaref""... $ac_c" 1>&6
+echo "configure:8329: checking for RSAPrivateDecrypt in -lrsaref" >&5
+ac_lib_var=`echo rsaref'_'RSAPrivateDecrypt | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  ac_save_LIBS="$LIBS"
+LIBS="-lrsaref  $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 8337 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char RSAPrivateDecrypt();
+
+int main() {
+RSAPrivateDecrypt()
+; return 0; }
+EOF
+if { (eval echo configure:8348: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_lib=HAVE_LIB`echo rsaref | sed -e 's/[^a-zA-Z0-9_]/_/g' \
+    -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_lib 1
+EOF
+
+  LIBS="-lrsaref $LIBS"
+
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+         echo $ac_n "checking for RSA_PKCS1_RSAref in -lRSAglue""... $ac_c" 1>&6
+echo "configure:8376: checking for RSA_PKCS1_RSAref in -lRSAglue" >&5
+ac_lib_var=`echo RSAglue'_'RSA_PKCS1_RSAref | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  ac_save_LIBS="$LIBS"
+LIBS="-lRSAglue  $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 8384 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char RSA_PKCS1_RSAref();
+
+int main() {
+RSA_PKCS1_RSAref()
+; return 0; }
+EOF
+if { (eval echo configure:8395: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_lib=HAVE_LIB`echo RSAglue | sed -e 's/[^a-zA-Z0-9_]/_/g' \
+    -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_lib 1
+EOF
+
+  LIBS="-lRSAglue $LIBS"
+
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+    fi
+
+    echo $ac_n "checking for EVP_md5 in -lcrypto""... $ac_c" 1>&6
+echo "configure:8425: checking for EVP_md5 in -lcrypto" >&5
+ac_lib_var=`echo crypto'_'EVP_md5 | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  ac_save_LIBS="$LIBS"
+LIBS="-lcrypto  $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 8433 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char EVP_md5();
+
+int main() {
+EVP_md5()
+; return 0; }
+EOF
+if { (eval echo configure:8444: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_lib=HAVE_LIB`echo crypto | sed -e 's/[^a-zA-Z0-9_]/_/g' \
+    -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_lib 1
+EOF
+
+  LIBS="-lcrypto $LIBS"
+
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+    for ac_func in AES_cfb128_encrypt
+do
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:8474: checking for $ac_func" >&5
+if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 8479 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char $ac_func(); below.  */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char $ac_func();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+$ac_func();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:8502: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_func 1
+EOF
+ 
+else
+  echo "$ac_t""no" 1>&6
+fi
+done
+
+fi
+
+NONAGENTLIBS=$LIBS
+
+_cppflags="${CPPFLAGS}"
+_ldflags="${LDFLAGS}"
+
+# Check whether --with-libwrap or --without-libwrap was given.
+if test "${with_libwrap+set}" = set; then
+  withval="$with_libwrap"
+  
+  if test "$with_libwrap" != "no"; then
+    if test "$with_libwrap" != "yes"; then
+      CPPFLAGS="${CPPFLAGS} -I$with_libwrap/include"
+      LDFLAGS="${LDFLAGS} -L$with_libwrap/lib"
+    fi
+
+    _libs=${LIBS}
+    ac_safe=`echo "tcpd.h" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for tcpd.h""... $ac_c" 1>&6
+echo "configure:8546: checking for tcpd.h" >&5
+if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 8551 "configure"
+#include "confdefs.h"
+#include <tcpd.h>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:8556: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=yes"
+else
+  echo "$ac_err" >&5
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  :
+else
+  echo "$ac_t""no" 1>&6
+{ echo "configure: error: Asked to use libwrap but I couldn't find tcpd.h." 1>&2; exit 1; }
+fi
+
+
+    LIBS="$LIBS -lwrap"
+	echo $ac_n "checking for TCP wrappers library -lwrap""... $ac_c" 1>&6
+echo "configure:8581: checking for TCP wrappers library -lwrap" >&5
+	cat > conftest.$ac_ext <<EOF
+#line 8583 "configure"
+#include "confdefs.h"
+#include <tcpd.h>
+		     int allow_severity = 0;
+		     int deny_severity  = 0;
+		    
+int main() {
+hosts_access((void *)0)
+; return 0; }
+EOF
+if { (eval echo configure:8593: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  
+	    echo "$ac_t""yes" 1>&6
+	    cat >> confdefs.h <<\EOF
+#define USE_LIBWRAP 1
+EOF
+
+	    test "$with_libwrap" != no -a "$with_libwrap" != yes && WRAPLIBS="-L$with_libwrap/lib"
+	    WRAPLIBS="$WRAPLIBS -lwrap"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  
+	    echo "$ac_t""no" 1>&6
+	    	    echo $ac_n "checking for yp_get_default_domain""... $ac_c" 1>&6
+echo "configure:8610: checking for yp_get_default_domain" >&5
+if eval "test \"`echo '$''{'ac_cv_func_yp_get_default_domain'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 8615 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char yp_get_default_domain(); below.  */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char yp_get_default_domain();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_yp_get_default_domain) || defined (__stub___yp_get_default_domain)
+choke me
+#else
+yp_get_default_domain();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:8638: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_func_yp_get_default_domain=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_func_yp_get_default_domain=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'yp_get_default_domain`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  :
+else
+  echo "$ac_t""no" 1>&6
+echo $ac_n "checking for yp_get_default_domain in -lnsl""... $ac_c" 1>&6
+echo "configure:8656: checking for yp_get_default_domain in -lnsl" >&5
+ac_lib_var=`echo nsl'_'yp_get_default_domain | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  ac_save_LIBS="$LIBS"
+LIBS="-lnsl  $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 8664 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char yp_get_default_domain();
+
+int main() {
+yp_get_default_domain()
+; return 0; }
+EOF
+if { (eval echo configure:8675: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_lib=HAVE_LIB`echo nsl | sed -e 's/^a-zA-Z0-9_/_/g' \
+    -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_lib 1
+EOF
+
+  LIBS="-lnsl $LIBS"
+
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+fi
+
+	    echo $ac_n "checking for TCP wrappers library -lwrap linked with -lnsl""... $ac_c" 1>&6
+echo "configure:8705: checking for TCP wrappers library -lwrap linked with -lnsl" >&5
+	    cat > conftest.$ac_ext <<EOF
+#line 8707 "configure"
+#include "confdefs.h"
+#include <tcpd.h>
+		         int allow_severity = 0;
+	                 int deny_severity  = 0;
+	 		
+int main() {
+hosts_access((void *)0)
+; return 0; }
+EOF
+if { (eval echo configure:8717: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  echo "$ac_t""yes" 1>&6
+			cat >> confdefs.h <<\EOF
+#define USE_LIBWRAP 1
+EOF
+
+			test "$with_libwrap" != no -a "$with_libwrap" != yes && WRAPLIBS="-L$with_libwrap/lib"
+			WRAPLIBS="$WRAPLIBS -lwrap -lnsl"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  echo "$ac_t""no" 1>&6
+			{ echo "configure: error: Asked to use libwrap but I couldn't find it." 1>&2; exit 1; }
+fi
+rm -f conftest*
+        
+fi
+rm -f conftest*
+    CPPFLAGS=${_cppflags}
+    LDFLAGS=${_ldflags}
+    LIBS=${_libs}
+  fi
+
+fi
+
+
+if echo " $module_list " | grep " host/hr_swinst " > /dev/null; then
+      _rpmlibs=""
+
+    _cppflags="${CPPFLAGS}"
+  _ldflags="${LDFLAGS}"
+
+  # Check whether --with-zlib or --without-zlib was given.
+if test "${with_zlib+set}" = set; then
+  withval="$with_zlib"
+  
+    if test -d "$withval"; then
+      CPPFLAGS="${CPPFLAGS} -I$withval/include"
+      LDFLAGS="${LDFLAGS} -L$withval/lib"
+    fi
+  
+fi
+
+
+    ac_safe=`echo "zlib.h" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for zlib.h""... $ac_c" 1>&6
+echo "configure:8765: checking for zlib.h" >&5
+if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 8770 "configure"
+#include "confdefs.h"
+#include <zlib.h>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:8775: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=yes"
+else
+  echo "$ac_err" >&5
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  echo $ac_n "checking for gzread in -lz""... $ac_c" 1>&6
+echo "configure:8792: checking for gzread in -lz" >&5
+ac_lib_var=`echo z'_'gzread | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  ac_save_LIBS="$LIBS"
+LIBS="-lz  $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 8800 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char gzread();
+
+int main() {
+gzread()
+; return 0; }
+EOF
+if { (eval echo configure:8811: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_lib=HAVE_LIB`echo z | sed -e 's/^a-zA-Z0-9_/_/g' \
+    -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_lib 1
+EOF
+
+  LIBS="-lz $LIBS"
+
+else
+  echo "$ac_t""no" 1>&6
+CPPFLAGS=${_cppflags} LDFLAGS=${_ldflags}
+fi
+
+else
+  echo "$ac_t""no" 1>&6
+CPPFLAGS=${_cppflags} LDFLAGS=${_ldflags}
+fi
+
+
+    echo $ac_n "checking for bzread in -lbz2""... $ac_c" 1>&6
+echo "configure:8846: checking for bzread in -lbz2" >&5
+ac_lib_var=`echo bz2'_'bzread | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  ac_save_LIBS="$LIBS"
+LIBS="-lbz2  $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 8854 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char bzread();
+
+int main() {
+bzread()
+; return 0; }
+EOF
+if { (eval echo configure:8865: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  _rpmlibs="$_rpmlibs -lbz2"
+else
+  echo "$ac_t""no" 1>&6
+echo $ac_n "checking for BZ2_bzread in -lbz2""... $ac_c" 1>&6
+echo "configure:8884: checking for BZ2_bzread in -lbz2" >&5
+ac_lib_var=`echo bz2'_'BZ2_bzread | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  ac_save_LIBS="$LIBS"
+LIBS="-lbz2  $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 8892 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char BZ2_bzread();
+
+int main() {
+BZ2_bzread()
+; return 0; }
+EOF
+if { (eval echo configure:8903: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  _rpmlibs="$_rpmlibs -lbz2"
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+fi
+
+
+    echo $ac_n "checking for dbopen in -ldb1""... $ac_c" 1>&6
+echo "configure:8927: checking for dbopen in -ldb1" >&5
+ac_lib_var=`echo db1'_'dbopen | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  ac_save_LIBS="$LIBS"
+LIBS="-ldb1  $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 8935 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char dbopen();
+
+int main() {
+dbopen()
+; return 0; }
+EOF
+if { (eval echo configure:8946: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  _rpmlibs="-ldb1 $_rpmlibs"
+else
+  echo "$ac_t""no" 1>&6
+echo $ac_n "checking for dbopen in -ldb""... $ac_c" 1>&6
+echo "configure:8965: checking for dbopen in -ldb" >&5
+ac_lib_var=`echo db'_'dbopen | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  ac_save_LIBS="$LIBS"
+LIBS="-ldb  $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 8973 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char dbopen();
+
+int main() {
+dbopen()
+; return 0; }
+EOF
+if { (eval echo configure:8984: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  _rpmlibs="-ldb $_rpmlibs"
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+fi
+
+
+    echo $ac_n "checking for db_create in -ldb-3.1""... $ac_c" 1>&6
+echo "configure:9008: checking for db_create in -ldb-3.1" >&5
+ac_lib_var=`echo db-3.1'_'db_create | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  ac_save_LIBS="$LIBS"
+LIBS="-ldb-3.1  $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 9016 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char db_create();
+
+int main() {
+db_create()
+; return 0; }
+EOF
+if { (eval echo configure:9027: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  _rpmlibs="-ldb-3.1 $_rpmlibs"
+else
+  echo "$ac_t""no" 1>&6
+echo $ac_n "checking for db_create in -ldb-3.0""... $ac_c" 1>&6
+echo "configure:9046: checking for db_create in -ldb-3.0" >&5
+ac_lib_var=`echo db-3.0'_'db_create | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  ac_save_LIBS="$LIBS"
+LIBS="-ldb-3.0  $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 9054 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char db_create();
+
+int main() {
+db_create()
+; return 0; }
+EOF
+if { (eval echo configure:9065: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  _rpmlibs="-ldb-3.0 $_rpmlibs"
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+fi
+
+  
+    echo $ac_n "checking for poptParseArgvString in -lpopt""... $ac_c" 1>&6
+echo "configure:9089: checking for poptParseArgvString in -lpopt" >&5
+ac_lib_var=`echo popt'_'poptParseArgvString | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  ac_save_LIBS="$LIBS"
+LIBS="-lpopt  $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 9097 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char poptParseArgvString();
+
+int main() {
+poptParseArgvString()
+; return 0; }
+EOF
+if { (eval echo configure:9108: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  _rpmlibs="-lpopt $_rpmlibs"
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+  
+    echo $ac_n "checking for Fopen in -lrpmio""... $ac_c" 1>&6
+echo "configure:9130: checking for Fopen in -lrpmio" >&5
+ac_lib_var=`echo rpmio'_'Fopen | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  ac_save_LIBS="$LIBS"
+LIBS="-lrpmio $_rpmlibs $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 9138 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char Fopen();
+
+int main() {
+Fopen()
+; return 0; }
+EOF
+if { (eval echo configure:9149: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  _rpmlibs="-lrpmio $_rpmlibs"
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+  
+    echo $ac_n "checking for rpmGetFilesystemList in -lrpm""... $ac_c" 1>&6
+echo "configure:9171: checking for rpmGetFilesystemList in -lrpm" >&5
+ac_lib_var=`echo rpm'_'rpmGetFilesystemList | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  ac_save_LIBS="$LIBS"
+LIBS="-lrpm  $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 9179 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char rpmGetFilesystemList();
+
+int main() {
+rpmGetFilesystemList()
+; return 0; }
+EOF
+if { (eval echo configure:9190: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  
+    cat >> confdefs.h <<\EOF
+#define HAVE_LIBRPM 1
+EOF
+
+    LIBS="-lrpm $_rpmlibs $LIBS"
+    CFLAGS="$CFLAGS -I/usr/include/rpm"
+  
+else
+  echo "$ac_t""no" 1>&6
+
+        echo $ac_n "checking for rpmdbOpen in -lrpmdb""... $ac_c" 1>&6
+echo "configure:9217: checking for rpmdbOpen in -lrpmdb" >&5
+ac_lib_var=`echo rpmdb'_'rpmdbOpen | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  ac_save_LIBS="$LIBS"
+LIBS="-lrpmdb -lrpm $_rpmlibs $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 9225 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char rpmdbOpen();
+
+int main() {
+rpmdbOpen()
+; return 0; }
+EOF
+if { (eval echo configure:9236: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  
+      cat >> confdefs.h <<\EOF
+#define HAVE_LIBRPM 1
+EOF
+
+      LIBS="-lrpmdb -lrpm $_rpmlibs $LIBS"
+      CFLAGS="$CFLAGS -I/usr/include/rpm"
+    
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+  
+fi
+
+fi
+  
+echo $ac_n "checking for kvm_read in -lkvm""... $ac_c" 1>&6
+echo "configure:9269: checking for kvm_read in -lkvm" >&5
+ac_lib_var=`echo kvm'_'kvm_read | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  ac_save_LIBS="$LIBS"
+LIBS="-lkvm  $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 9277 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char kvm_read();
+
+int main() {
+kvm_read()
+; return 0; }
+EOF
+if { (eval echo configure:9288: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_lib=HAVE_LIB`echo kvm | sed -e 's/[^a-zA-Z0-9_]/_/g' \
+    -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_lib 1
+EOF
+
+  LIBS="-lkvm $LIBS"
+
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+echo $ac_n "checking for dlopen in -ldl""... $ac_c" 1>&6
+echo "configure:9316: checking for dlopen in -ldl" >&5
+ac_lib_var=`echo dl'_'dlopen | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  ac_save_LIBS="$LIBS"
+LIBS="-ldl  $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 9324 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char dlopen();
+
+int main() {
+dlopen()
+; return 0; }
+EOF
+if { (eval echo configure:9335: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_lib=HAVE_LIB`echo dl | sed -e 's/[^a-zA-Z0-9_]/_/g' \
+    -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_lib 1
+EOF
+
+  LIBS="-ldl $LIBS"
+
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+for ac_func in dlopen
+do
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:9365: checking for $ac_func" >&5
+if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 9370 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char $ac_func(); below.  */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char $ac_func();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+$ac_func();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:9393: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_func 1
+EOF
+ 
+else
+  echo "$ac_t""no" 1>&6
+fi
+done
+
+
+for ac_func in kvm_openfiles nlist knlist kvm_getprocs
+do
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:9421: checking for $ac_func" >&5
+if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 9426 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char $ac_func(); below.  */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char $ac_func();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+$ac_func();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:9449: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_func 1
+EOF
+ 
+else
+  echo "$ac_t""no" 1>&6
+fi
+done
+
+echo "$with_mib_modules" | grep "ucd-snmp/diskio" >/dev/null
+if test $? -eq 0 ; then
+	echo $ac_n "checking for getdevs""... $ac_c" 1>&6
+echo "configure:9476: checking for getdevs" >&5
+if eval "test \"`echo '$''{'ac_cv_func_getdevs'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 9481 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char getdevs(); below.  */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char getdevs();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_getdevs) || defined (__stub___getdevs)
+choke me
+#else
+getdevs();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:9504: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_func_getdevs=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_func_getdevs=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'getdevs`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  cat >> confdefs.h <<\EOF
+#define HAVE_GETDEVS 1
+EOF
+
+else
+  echo "$ac_t""no" 1>&6
+echo $ac_n "checking for getdevs in -ldevstat""... $ac_c" 1>&6
+echo "configure:9525: checking for getdevs in -ldevstat" >&5
+ac_lib_var=`echo devstat'_'getdevs | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  ac_save_LIBS="$LIBS"
+LIBS="-ldevstat  $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 9533 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char getdevs();
+
+int main() {
+getdevs()
+; return 0; }
+EOF
+if { (eval echo configure:9544: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  cat >> confdefs.h <<\EOF
+#define HAVE_GETDEVS 1
+EOF
+
+		LIBS="${LIBS} -ldevstat"
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+fi
+
+fi
+
+
+
+if test "x$embed_perl" = "xyes" -a "x$install_perl" = "xno" ; then
+  install_perl="yes"
+fi
+if test "x$install_perl" != "x" -a "x$install_perl" != "xno"; then
+    PERLTARGS="perlmodules"
+    PERLINSTALLTARGS="perlinstall"
+    
+    
+    
+    
+  cat >> configure-summary << EOF
+  SNMP Perl modules:          enabled
+EOF
+
+fi
+
+if test "x$embed_perl" = "xyes"; then
+    myperl=$ac_cv_path_PERLPROG
+    if test $myperl = "no"; then
+      { echo "configure: error: --enable-embedded-perl requested but no perl executable found" 1>&2; exit 1; }
+    fi
+
+    echo $ac_n "checking for perl CFLAGS""... $ac_c" 1>&6
+echo "configure:9597: checking for perl CFLAGS" >&5
+    perlcflags=`$myperl -MExtUtils::Embed -e ccopts`
+    echo "$ac_t""$perlcflags" 1>&6
+    CPPFLAGS="$CPPFLAGS $perlcflags"
+
+    echo $ac_n "checking for perl LDFLAGS""... $ac_c" 1>&6
+echo "configure:9603: checking for perl LDFLAGS" >&5
+    perlldopts=`$myperl -MExtUtils::Embed -e ldopts`
+    echo "$ac_t""$perlldopts" 1>&6
+    LIBS="$LIBS $perlldopts"
+
+        for ac_func in eval_pv perl_eval_pv
+do
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:9611: checking for $ac_func" >&5
+if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 9616 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char $ac_func(); below.  */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char $ac_func();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+$ac_func();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:9639: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_func 1
+EOF
+ 
+else
+  echo "$ac_t""no" 1>&6
+fi
+done
+
+
+    cat >> confdefs.h <<\EOF
+#define NETSNMP_EMBEDDED_PERL 1
+EOF
+
+    OTHERAGENTLIBOBJS="snmp_perl.o"
+    OTHERAGENTLIBLOBJS="snmp_perl.lo"
+
+    EMBEDPERLINSTALL="embedperlinstall"
+    
+    
+  cat >> configure-summary << EOF
+  Embedded perl support:      enabled
+EOF
+
+fi
+
+AGENTLIBS=$LIBS
+LIBS=$NONAGENTLIBS
+
+echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6
+echo "configure:9684: checking for ANSI C header files" >&5
+if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 9689 "configure"
+#include "confdefs.h"
+#include <stdlib.h>
+#include <stdarg.h>
+#include <string.h>
+#include <float.h>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:9697: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+  rm -rf conftest*
+  ac_cv_header_stdc=yes
+else
+  echo "$ac_err" >&5
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+if test $ac_cv_header_stdc = yes; then
+  # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
+cat > conftest.$ac_ext <<EOF
+#line 9714 "configure"
+#include "confdefs.h"
+#include <string.h>
+EOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  egrep "memchr" >/dev/null 2>&1; then
+  :
+else
+  rm -rf conftest*
+  ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+  # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
+cat > conftest.$ac_ext <<EOF
+#line 9732 "configure"
+#include "confdefs.h"
+#include <stdlib.h>
+EOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  egrep "free" >/dev/null 2>&1; then
+  :
+else
+  rm -rf conftest*
+  ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+  # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
+if test "$cross_compiling" = yes; then
+  :
+else
+  cat > conftest.$ac_ext <<EOF
+#line 9753 "configure"
+#include "confdefs.h"
+#include <ctype.h>
+#define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
+#define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
+#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
+int main () { int i; for (i = 0; i < 256; i++)
+if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2);
+exit (0); }
+
+EOF
+if { (eval echo configure:9764: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+then
+  :
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -fr conftest*
+  ac_cv_header_stdc=no
+fi
+rm -fr conftest*
+fi
+
+fi
+fi
+
+echo "$ac_t""$ac_cv_header_stdc" 1>&6
+if test $ac_cv_header_stdc = yes; then
+  cat >> confdefs.h <<\EOF
+#define STDC_HEADERS 1
+EOF
+
+fi
+
+ac_header_dirent=no
+for ac_hdr in dirent.h sys/ndir.h sys/dir.h ndir.h
+do
+ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for $ac_hdr that defines DIR""... $ac_c" 1>&6
+echo "configure:9792: checking for $ac_hdr that defines DIR" >&5
+if eval "test \"`echo '$''{'ac_cv_header_dirent_$ac_safe'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 9797 "configure"
+#include "confdefs.h"
+#include <sys/types.h>
+#include <$ac_hdr>
+int main() {
+DIR *dirp = 0;
+; return 0; }
+EOF
+if { (eval echo configure:9805: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  eval "ac_cv_header_dirent_$ac_safe=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_header_dirent_$ac_safe=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_header_dirent_'$ac_safe`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_hdr 1
+EOF
+ ac_header_dirent=$ac_hdr; break
+else
+  echo "$ac_t""no" 1>&6
+fi
+done
+# Two versions of opendir et al. are in -ldir and -lx on SCO Xenix.
+if test $ac_header_dirent = dirent.h; then
+echo $ac_n "checking for opendir in -ldir""... $ac_c" 1>&6
+echo "configure:9830: checking for opendir in -ldir" >&5
+ac_lib_var=`echo dir'_'opendir | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  ac_save_LIBS="$LIBS"
+LIBS="-ldir  $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 9838 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char opendir();
+
+int main() {
+opendir()
+; return 0; }
+EOF
+if { (eval echo configure:9849: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  LIBS="$LIBS -ldir"
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+else
+echo $ac_n "checking for opendir in -lx""... $ac_c" 1>&6
+echo "configure:9871: checking for opendir in -lx" >&5
+ac_lib_var=`echo x'_'opendir | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  ac_save_LIBS="$LIBS"
+LIBS="-lx  $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 9879 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char opendir();
+
+int main() {
+opendir()
+; return 0; }
+EOF
+if { (eval echo configure:9890: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  LIBS="$LIBS -lx"
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+fi
+
+echo $ac_n "checking for sys/wait.h that is POSIX.1 compatible""... $ac_c" 1>&6
+echo "configure:9913: checking for sys/wait.h that is POSIX.1 compatible" >&5
+if eval "test \"`echo '$''{'ac_cv_header_sys_wait_h'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 9918 "configure"
+#include "confdefs.h"
+#include <sys/types.h>
+#include <sys/wait.h>
+#ifndef WEXITSTATUS
+#define WEXITSTATUS(stat_val) ((unsigned)(stat_val) >> 8)
+#endif
+#ifndef WIFEXITED
+#define WIFEXITED(stat_val) (((stat_val) & 255) == 0)
+#endif
+int main() {
+int s;
+wait (&s);
+s = WIFEXITED (s) ? WEXITSTATUS (s) : 1;
+; return 0; }
+EOF
+if { (eval echo configure:9934: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  ac_cv_header_sys_wait_h=yes
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  ac_cv_header_sys_wait_h=no
+fi
+rm -f conftest*
+fi
+
+echo "$ac_t""$ac_cv_header_sys_wait_h" 1>&6
+if test $ac_cv_header_sys_wait_h = yes; then
+  cat >> confdefs.h <<\EOF
+#define HAVE_SYS_WAIT_H 1
+EOF
+
+fi
+
+for ac_hdr in stdarg.h string.h fcntl.h limits.h sys/file.h sys/ioctl.h syslog.h unistd.h netinet/tcpip.h netinet/in.h netinet/ip.h netinet/ip_icmp.h net/if.h netdb.h sys/dmap.h machine/pte.h xti.h sys/sockio.h sys/socket.h sys/un.h fstab.h sys/fs.h mtab.h ufs/fs.h ufs/ffs/fs.h sys/fixpoint.h machine/param.h sys/vm.h vm/vm.h sys/vmmeter.h sys/vmparam.h sys/vmmac.h sys/vmsystm.h sys/mbuf.h sys/time.h sys/swap.h inet/mib2.h sys/vfs.h sys/mnttab.h sys/user.h sys/proc.h sys/select.h mntent.h sys/mntent.h kstat.h utsname.h sys/utsname.h sys/cdefs.h getopt.h locale.h pthread.h sys/loadavg.h regex.h linux/tasks.h pwd.h grp.h utmpx.h
+do
+ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+echo "configure:9958: checking for $ac_hdr" >&5
+if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 9963 "configure"
+#include "confdefs.h"
+#include <$ac_hdr>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:9968: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=yes"
+else
+  echo "$ac_err" >&5
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_hdr 1
+EOF
+ 
+else
+  echo "$ac_t""no" 1>&6
+fi
+done
+
+for ac_hdr in malloc.h sys/param.h net/if_dl.h sys/sysctl.h stdlib.h net/if_mib.h net/if_types.h net/if_var.h sys/queue.h osreldate.h machine/types.h sys/socketvar.h
+do
+ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+echo "configure:9998: checking for $ac_hdr" >&5
+if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 10003 "configure"
+#include "confdefs.h"
+#include <$ac_hdr>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:10008: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=yes"
+else
+  echo "$ac_err" >&5
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_hdr 1
+EOF
+ 
+else
+  echo "$ac_t""no" 1>&6
+fi
+done
+
+for ac_hdr in sys/conf.h netinet/in_systm.h netinet/tcp.h netinet/udp.h netinet/in_var.h netinet/if_ether.h netinet/ip_var.h netinet/tcp_timer.h netinet/tcp_var.h netinet/tcp_fsm.h netinet/udp_var.h netinet/icmp_var.h sys/protosw.h nlist.h ioctls.h asm/page.h netipx/ipx.h
+do
+ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+echo "configure:10038: checking for $ac_hdr" >&5
+if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 10043 "configure"
+#include "confdefs.h"
+#include <$ac_hdr>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:10048: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=yes"
+else
+  echo "$ac_err" >&5
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_hdr 1
+EOF
+ 
+else
+  echo "$ac_t""no" 1>&6
+fi
+done
+
+for ac_hdr in arpa/inet.h kvm.h sys/pool.h uvm/uvm_param.h uvm/uvm_extern.h vm/vm_param.h vm/vm_extern.h
+do
+ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+echo "configure:10078: checking for $ac_hdr" >&5
+if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 10083 "configure"
+#include "confdefs.h"
+#include <$ac_hdr>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:10088: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=yes"
+else
+  echo "$ac_err" >&5
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_hdr 1
+EOF
+ 
+else
+  echo "$ac_t""no" 1>&6
+fi
+done
+
+for ac_hdr in sys/mount.h vm/swap_pager.h ufs/ufs/dinode.h
+do
+ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+echo "configure:10118: checking for $ac_hdr" >&5
+if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 10123 "configure"
+#include "confdefs.h"
+#include <$ac_hdr>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:10128: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=yes"
+else
+  echo "$ac_err" >&5
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_hdr 1
+EOF
+ 
+else
+  echo "$ac_t""no" 1>&6
+fi
+done
+
+for ac_hdr in sys/stat.h sys/vnode.h ufs/ufs/quota.h ufs/ufs/inode.h
+do
+ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+echo "configure:10158: checking for $ac_hdr" >&5
+if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 10163 "configure"
+#include "confdefs.h"
+#include <$ac_hdr>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:10168: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=yes"
+else
+  echo "$ac_err" >&5
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_hdr 1
+EOF
+ 
+else
+  echo "$ac_t""no" 1>&6
+fi
+done
+
+for ac_hdr in sys/hashing.h sys/tcpipstats.h sys/sysmp.h
+do
+ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+echo "configure:10198: checking for $ac_hdr" >&5
+if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 10203 "configure"
+#include "confdefs.h"
+#include <$ac_hdr>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:10208: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=yes"
+else
+  echo "$ac_err" >&5
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_hdr 1
+EOF
+ 
+else
+  echo "$ac_t""no" 1>&6
+fi
+done
+
+for ac_hdr in err.h sys/filio.h sgtty.h
+do
+ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+echo "configure:10238: checking for $ac_hdr" >&5
+if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 10243 "configure"
+#include "confdefs.h"
+#include <$ac_hdr>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:10248: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=yes"
+else
+  echo "$ac_err" >&5
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_hdr 1
+EOF
+ 
+else
+  echo "$ac_t""no" 1>&6
+fi
+done
+
+for ac_hdr in sys/statfs.h
+do
+ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+echo "configure:10278: checking for $ac_hdr" >&5
+if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 10283 "configure"
+#include "confdefs.h"
+#include <$ac_hdr>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:10288: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=yes"
+else
+  echo "$ac_err" >&5
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_hdr 1
+EOF
+ 
+else
+  echo "$ac_t""no" 1>&6
+fi
+done
+
+for ac_hdr in net/route.h
+do
+ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+echo "configure:10318: checking for $ac_hdr" >&5
+if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 10323 "configure"
+#include "confdefs.h"
+#include <$ac_hdr>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:10328: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=yes"
+else
+  echo "$ac_err" >&5
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_hdr 1
+EOF
+ 
+else
+  echo "$ac_t""no" 1>&6
+fi
+done
+
+for ac_hdr in sys/dkio.h sys/diskio.h sys/pstat.h linux/hdreg.h pkglocs.h
+do
+ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+echo "configure:10358: checking for $ac_hdr" >&5
+if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 10363 "configure"
+#include "confdefs.h"
+#include <$ac_hdr>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:10368: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=yes"
+else
+  echo "$ac_err" >&5
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_hdr 1
+EOF
+ 
+else
+  echo "$ac_t""no" 1>&6
+fi
+done
+
+for ac_hdr in pkginfo.h
+do
+ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+echo "configure:10398: checking for $ac_hdr" >&5
+if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 10403 "configure"
+#include "confdefs.h"
+#include <$ac_hdr>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:10408: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=yes"
+else
+  echo "$ac_err" >&5
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_hdr 1
+EOF
+ echo $ac_n "checking for pkginfo in -ladm""... $ac_c" 1>&6
+echo "configure:10429: checking for pkginfo in -ladm" >&5
+ac_lib_var=`echo adm'_'pkginfo | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  ac_save_LIBS="$LIBS"
+LIBS="-ladm  $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 10437 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char pkginfo();
+
+int main() {
+pkginfo()
+; return 0; }
+EOF
+if { (eval echo configure:10448: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  cat >> confdefs.h <<\EOF
+#define HAVE_PKGINFO 1
+EOF
+
+    LIBS="${LIBS} -ladm"
+    AGENTLIBS="${AGENTLIBS} -ladm"
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+else
+  echo "$ac_t""no" 1>&6
+fi
+done
+
+for ac_hdr in winsock.h
+do
+ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+echo "configure:10482: checking for $ac_hdr" >&5
+if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 10487 "configure"
+#include "confdefs.h"
+#include <$ac_hdr>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:10492: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=yes"
+else
+  echo "$ac_err" >&5
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_hdr 1
+EOF
+ AGENTLIBS="${AGENTLIBS} -liphlpapi"
+else
+  echo "$ac_t""no" 1>&6
+fi
+done
+
+for ac_hdr in io.h
+do
+ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+echo "configure:10522: checking for $ac_hdr" >&5
+if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 10527 "configure"
+#include "confdefs.h"
+#include <$ac_hdr>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:10532: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=yes"
+else
+  echo "$ac_err" >&5
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_hdr 1
+EOF
+ 
+else
+  echo "$ac_t""no" 1>&6
+fi
+done
+
+for ac_hdr in sys/stream.h
+do
+ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+echo "configure:10562: checking for $ac_hdr" >&5
+if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 10567 "configure"
+#include "confdefs.h"
+#include <$ac_hdr>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:10572: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=yes"
+else
+  echo "$ac_err" >&5
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_hdr 1
+EOF
+ 
+else
+  echo "$ac_t""no" 1>&6
+fi
+done
+
+for ac_hdr in netinet/ip6.h netinet6/in6_var.h netinet6/in6_pcb.h netinet6/ip6_var.h netinet6/tcp6.h netinet6/tcp6_fsm.h netinet6/nd6.h netinet6/tcp6_timer.h netinet6/tcp6_var.h
+do
+ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+echo "configure:10602: checking for $ac_hdr" >&5
+if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 10607 "configure"
+#include "confdefs.h"
+#include <$ac_hdr>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:10612: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=yes"
+else
+  echo "$ac_err" >&5
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_hdr 1
+EOF
+ 
+else
+  echo "$ac_t""no" 1>&6
+fi
+done
+
+for ac_hdr in dlfcn.h
+do
+ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+echo "configure:10642: checking for $ac_hdr" >&5
+if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 10647 "configure"
+#include "confdefs.h"
+#include <$ac_hdr>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:10652: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=yes"
+else
+  echo "$ac_err" >&5
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_hdr 1
+EOF
+ 
+else
+  echo "$ac_t""no" 1>&6
+fi
+done
+
+for ac_hdr in search.h
+do
+ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+echo "configure:10682: checking for $ac_hdr" >&5
+if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 10687 "configure"
+#include "confdefs.h"
+#include <$ac_hdr>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:10692: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=yes"
+else
+  echo "$ac_err" >&5
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_hdr 1
+EOF
+ 
+else
+  echo "$ac_t""no" 1>&6
+fi
+done
+
+
+if echo " $module_list " | grep " host/hr_swinst " > /dev/null; then
+  for ac_hdr in rpmio.h
+do
+ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+echo "configure:10724: checking for $ac_hdr" >&5
+if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 10729 "configure"
+#include "confdefs.h"
+#include <$ac_hdr>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:10734: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=yes"
+else
+  echo "$ac_err" >&5
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_hdr 1
+EOF
+ 
+else
+  echo "$ac_t""no" 1>&6
+for ac_hdr in rpm/rpmio.h
+do
+ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+echo "configure:10761: checking for $ac_hdr" >&5
+if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 10766 "configure"
+#include "confdefs.h"
+#include <$ac_hdr>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:10771: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=yes"
+else
+  echo "$ac_err" >&5
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_hdr 1
+EOF
+ CFLAGS="-I/usr/include/rpm $CFLAGS"
+else
+  echo "$ac_t""no" 1>&6
+fi
+done
+
+  
+fi
+done
+
+fi
+
+echo $ac_n "checking for netinet/in_pcb.h""... $ac_c" 1>&6
+echo "configure:10804: checking for netinet/in_pcb.h" >&5
+if eval "test \"`echo '$''{'cv_have_netinet_in_pcb_h'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+   cat > conftest.$ac_ext <<EOF
+#line 10809 "configure"
+#include "confdefs.h"
+
+#include <netinet/in.h>
+#include <netinet/in_pcb.h>
+
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:10817: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+  rm -rf conftest*
+  cv_have_netinet_in_pcb_h=yes
+else
+  echo "$ac_err" >&5
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  cv_have_netinet_in_pcb_h=no
+fi
+rm -f conftest*
+fi
+
+echo "$ac_t""$cv_have_netinet_in_pcb_h" 1>&6
+if test $cv_have_netinet_in_pcb_h = yes; then
+  cat >> confdefs.h <<\EOF
+#define HAVE_NETINET_IN_PCB_H 1
+EOF
+
+fi
+
+echo $ac_n "checking for sys/disklabel.h""... $ac_c" 1>&6
+echo "configure:10841: checking for sys/disklabel.h" >&5
+if eval "test \"`echo '$''{'cv_have_sys_disklabel_h'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+   cat > conftest.$ac_ext <<EOF
+#line 10846 "configure"
+#include "confdefs.h"
+
+#include <machine/types.h>
+#include <sys/disklabel.h>
+
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:10854: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+  rm -rf conftest*
+  cv_have_sys_disklabel_h=yes
+else
+  echo "$ac_err" >&5
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  cv_have_sys_disklabel_h=no
+fi
+rm -f conftest*
+fi
+
+echo "$ac_t""$cv_have_sys_disklabel_h" 1>&6
+if test $cv_have_sys_disklabel_h = yes; then
+  cat >> confdefs.h <<\EOF
+#define HAVE_SYS_DISKLABEL_H 1
+EOF
+
+fi
+
+for ac_hdr in openssl/hmac.h openssl/evp.h openssl/aes.h openssl/des.h
+do
+ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+echo "configure:10881: checking for $ac_hdr" >&5
+if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 10886 "configure"
+#include "confdefs.h"
+#include <$ac_hdr>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:10891: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=yes"
+else
+  echo "$ac_err" >&5
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_hdr 1
+EOF
+ 
+else
+  echo "$ac_t""no" 1>&6
+fi
+done
+
+
+# Extract the first word of "lpstat", so it can be a program name with args.
+set dummy lpstat; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:10921: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_path_LPSTAT_PATH'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  case "$LPSTAT_PATH" in
+  /*)
+  ac_cv_path_LPSTAT_PATH="$LPSTAT_PATH" # Let the user override the test with a path.
+  ;;
+  ?:/*)			 
+  ac_cv_path_LPSTAT_PATH="$LPSTAT_PATH" # Let the user override the test with a dos path.
+  ;;
+  *)
+  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS=":"
+  ac_dummy="$PATH"
+  for ac_dir in $ac_dummy; do 
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/$ac_word; then
+      ac_cv_path_LPSTAT_PATH="$ac_dir/$ac_word"
+      break
+    fi
+  done
+  IFS="$ac_save_ifs"
+  ;;
+esac
+fi
+LPSTAT_PATH="$ac_cv_path_LPSTAT_PATH"
+if test -n "$LPSTAT_PATH"; then
+  echo "$ac_t""$LPSTAT_PATH" 1>&6
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+if test x$LPSTAT_PATH != x; then
+    cat >> confdefs.h <<EOF
+#define LPSTAT_PATH "$LPSTAT_PATH"
+EOF
+
+    cat >> confdefs.h <<\EOF
+#define HAVE_LPSTAT 1
+EOF
+
+fi
+for ac_func in cgetnext
+do
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:10966: checking for $ac_func" >&5
+if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 10971 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char $ac_func(); below.  */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char $ac_func();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+$ac_func();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:10994: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_func 1
+EOF
+ 
+else
+  echo "$ac_t""no" 1>&6
+fi
+done
+
+if test -r /etc/printcap; then
+    cat >> confdefs.h <<\EOF
+#define HAVE_PRINTCAP 1
+EOF
+
+fi
+
+echo $ac_n "checking for authentication support""... $ac_c" 1>&6
+echo "configure:11026: checking for authentication support" >&5
+if test "x$ac_cv_lib_crypto_EVP_md5" != "xyes" -o "x$ac_cv_header_openssl_hmac_h" != "xyes" -o "x$ac_cv_header_openssl_hmac_h" != "xyes"; then
+    cat >> confdefs.h <<\EOF
+#define USE_INTERNAL_MD5 1
+EOF
+
+    authmodes="MD5"
+    encrmodes=""
+    echo "$ac_t""Internal MD5 Support" 1>&6
+    if test "x$askedopenssl" = "xyes"; then
+	{ echo "configure: error: Asked to use OpenSSL but I couldn't find it." 1>&2; exit 1; }
+    fi
+else
+    if test "x$tryopenssl" = "xno"; then
+        authmodes="MD5"
+        encrmodes=""
+	cat >> confdefs.h <<\EOF
+#define USE_INTERNAL_MD5 1
+EOF
+
+	echo "$ac_t""Internal MD5 Support" 1>&6
+    else
+        authmodes="MD5 SHA1"
+        if test "x$enable_privacy" != "xno" ; then
+	    if test $ac_cv_header_openssl_aes_h = "yes" ; then
+	        encrmodes="DES AES128 AES192 AES256"
+	    else
+	        encrmodes="DES"
+	    fi
+        else
+	    encrmodes="disabled"
+        fi
+	cat >> confdefs.h <<\EOF
+#define USE_OPENSSL 1
+EOF
+
+	echo "$ac_t""OpenSSL Support" 1>&6
+    fi
+fi
+
+
+  cat >> configure-summary << EOF
+  Authentication support:     $authmodes
+EOF
+
+
+  cat >> configure-summary << EOF
+  Encryption support:         $encrmodes
+EOF
+
+
+echo $ac_n "checking for off_t""... $ac_c" 1>&6
+echo "configure:11078: checking for off_t" >&5
+if eval "test \"`echo '$''{'ac_cv_type_off_t'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 11083 "configure"
+#include "confdefs.h"
+#include <sys/types.h>
+#if STDC_HEADERS
+#include <stdlib.h>
+#include <stddef.h>
+#endif
+EOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  egrep "(^|[^a-zA-Z_0-9])off_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then
+  rm -rf conftest*
+  ac_cv_type_off_t=yes
+else
+  rm -rf conftest*
+  ac_cv_type_off_t=no
+fi
+rm -f conftest*
+
+fi
+echo "$ac_t""$ac_cv_type_off_t" 1>&6
+if test $ac_cv_type_off_t = no; then
+  cat >> confdefs.h <<\EOF
+#define off_t long
+EOF
+
+fi
+
+echo $ac_n "checking for pid_t""... $ac_c" 1>&6
+echo "configure:11111: checking for pid_t" >&5
+if eval "test \"`echo '$''{'ac_cv_type_pid_t'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 11116 "configure"
+#include "confdefs.h"
+#include <sys/types.h>
+#if STDC_HEADERS
+#include <stdlib.h>
+#include <stddef.h>
+#endif
+EOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  egrep "(^|[^a-zA-Z_0-9])pid_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then
+  rm -rf conftest*
+  ac_cv_type_pid_t=yes
+else
+  rm -rf conftest*
+  ac_cv_type_pid_t=no
+fi
+rm -f conftest*
+
+fi
+echo "$ac_t""$ac_cv_type_pid_t" 1>&6
+if test $ac_cv_type_pid_t = no; then
+  cat >> confdefs.h <<\EOF
+#define pid_t int
+EOF
+
+fi
+
+echo $ac_n "checking whether time.h and sys/time.h may both be included""... $ac_c" 1>&6
+echo "configure:11144: checking whether time.h and sys/time.h may both be included" >&5
+if eval "test \"`echo '$''{'ac_cv_header_time'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 11149 "configure"
+#include "confdefs.h"
+#include <sys/types.h>
+#include <sys/time.h>
+#include <time.h>
+int main() {
+struct tm *tp;
+; return 0; }
+EOF
+if { (eval echo configure:11158: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  ac_cv_header_time=yes
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  ac_cv_header_time=no
+fi
+rm -f conftest*
+fi
+
+echo "$ac_t""$ac_cv_header_time" 1>&6
+if test $ac_cv_header_time = yes; then
+  cat >> confdefs.h <<\EOF
+#define TIME_WITH_SYS_TIME 1
+EOF
+
+fi
+
+
+echo $ac_n "checking for socklen_t""... $ac_c" 1>&6
+echo "configure:11180: checking for socklen_t" >&5
+if eval "test \"`echo '$''{'ac_cv_type_$1'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 11185 "configure"
+#include "confdefs.h"
+#include <sys/types.h>
+#if STDC_HEADERS
+#include <stdlib.h>
+#include <stddef.h>
+#endif
+#ifdef HAVE_SYS_SOCKET_H
+#include <sys/socket.h>
+#endif
+EOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  egrep "socklen_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then
+  rm -rf conftest*
+  ac_cv_type_socklen_t=yes
+else
+  rm -rf conftest*
+  ac_cv_type_socklen_t=no
+fi
+rm -f conftest*
+
+fi
+
+echo "$ac_t""$ac_cv_type_socklen_t" 1>&6
+if test $ac_cv_type_socklen_t = yes; then
+  cat >> confdefs.h <<\EOF
+#define HAVE_SOCKLEN_T 1
+EOF
+
+fi
+
+echo $ac_n "checking for in_addr_t""... $ac_c" 1>&6
+echo "configure:11217: checking for in_addr_t" >&5
+if eval "test \"`echo '$''{'ac_cv_type_$1'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 11222 "configure"
+#include "confdefs.h"
+#include <sys/types.h>
+#if STDC_HEADERS
+#include <stdlib.h>
+#include <stddef.h>
+#endif
+#ifdef HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+EOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  egrep "in_addr_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then
+  rm -rf conftest*
+  ac_cv_type_in_addr_t=yes
+else
+  rm -rf conftest*
+  ac_cv_type_in_addr_t=no
+fi
+rm -f conftest*
+
+fi
+
+echo "$ac_t""$ac_cv_type_in_addr_t" 1>&6
+if test $ac_cv_type_in_addr_t = yes; then
+  cat >> confdefs.h <<\EOF
+#define HAVE_IN_ADDR_T 1
+EOF
+
+fi
+
+echo $ac_n "checking for correct flags to ps""... $ac_c" 1>&6
+echo "configure:11254: checking for correct flags to ps" >&5
+if eval "test \"`echo '$''{'ac_cv_ps_flags'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  if test "`($PSPROG -e 2>&1) | egrep ' (ps) *$' | awk '{print $NF}'`" = "ps" ; then
+  ac_cv_ps_flags="-e"
+elif test "`($PSPROG -el 2>&1) | egrep ' (ps) *$' | awk '{print $NF}'`" = "ps" ; then
+  ac_cv_ps_flags="-el"
+elif test "`($PSPROG acx 2>&1) | egrep ' (ps) *$' | awk '{print $NF}'`" = "ps" ; then
+  ac_cv_ps_flags="acx"
+elif test "`($PSPROG -acx 2>&1) | egrep ' (ps) *$' | awk '{print $NF}'`" = "ps" ; then
+  ac_cv_ps_flags="-acx"
+elif test "`($PSPROG -o pid,tt,state,time,ucomm 2>&1) | egrep ' ps *$' | awk '{print $NF}'`" = "ps" ; then
+  ac_cv_ps_flags="-o pid,tt,state,time,ucomm"
+elif test "`($PSPROG ax 2>&1) | egrep ' (ps) *$' | awk '{print $NF}'`" = "ps" ; then
+  ac_cv_ps_flags="ax"
+else
+  echo "configure: warning: Unable to determine valid ps flags...  defaulting..." 1>&2
+  ac_cv_ps_flags="-acx"
+fi
+
+fi
+
+echo "$ac_t""$ac_cv_ps_flags" 1>&6
+
+PSCMD="$PSPROG $ac_cv_ps_flags"
+
+cat >> confdefs.h <<EOF
+#define PSCMD "$PSPROG $ac_cv_ps_flags"
+EOF
+
+
+if test $cross_compiling = yes; then
+  if test $with_endianness = "big"; then
+    cat >> confdefs.h <<\EOF
+#define WORDS_BIGENDIAN 1
+EOF
+
+  elif test -z $with_endianness; then
+    { echo "configure: error: You are cross-compiling, but you have not specified the target's endianness" 1>&2; exit 1; }
+  fi
+else
+  if test $with_endianness; then
+    { echo "configure: error: Endianness has been specified, but you are not cross-compiling." 1>&2; exit 1; }
+  fi
+  echo $ac_n "checking whether byte ordering is bigendian""... $ac_c" 1>&6
+echo "configure:11300: checking whether byte ordering is bigendian" >&5
+if eval "test \"`echo '$''{'ac_cv_c_bigendian'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  ac_cv_c_bigendian=unknown
+# See if sys/param.h defines the BYTE_ORDER macro.
+cat > conftest.$ac_ext <<EOF
+#line 11307 "configure"
+#include "confdefs.h"
+#include <sys/types.h>
+#include <sys/param.h>
+int main() {
+
+#if !BYTE_ORDER || !BIG_ENDIAN || !LITTLE_ENDIAN
+ bogus endian macros
+#endif
+; return 0; }
+EOF
+if { (eval echo configure:11318: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  # It does; now see whether it defined to BIG_ENDIAN or not.
+cat > conftest.$ac_ext <<EOF
+#line 11322 "configure"
+#include "confdefs.h"
+#include <sys/types.h>
+#include <sys/param.h>
+int main() {
+
+#if BYTE_ORDER != BIG_ENDIAN
+ not big endian
+#endif
+; return 0; }
+EOF
+if { (eval echo configure:11333: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  ac_cv_c_bigendian=yes
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  ac_cv_c_bigendian=no
+fi
+rm -f conftest*
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+fi
+rm -f conftest*
+if test $ac_cv_c_bigendian = unknown; then
+if test "$cross_compiling" = yes; then
+    { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
+else
+  cat > conftest.$ac_ext <<EOF
+#line 11353 "configure"
+#include "confdefs.h"
+main () {
+  /* Are we little or big endian?  From Harbison&Steele.  */
+  union
+  {
+    long l;
+    char c[sizeof (long)];
+  } u;
+  u.l = 1;
+  exit (u.c[sizeof (long) - 1] == 1);
+}
+EOF
+if { (eval echo configure:11366: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+then
+  ac_cv_c_bigendian=no
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -fr conftest*
+  ac_cv_c_bigendian=yes
+fi
+rm -fr conftest*
+fi
+
+fi
+fi
+
+echo "$ac_t""$ac_cv_c_bigendian" 1>&6
+if test $ac_cv_c_bigendian = yes; then
+  cat >> confdefs.h <<\EOF
+#define WORDS_BIGENDIAN 1
+EOF
+
+fi
+
+fi
+
+# The Ultrix 4.2 mips builtin alloca declared by alloca.h only works
+# for constant arguments.  Useless!
+echo $ac_n "checking for working alloca.h""... $ac_c" 1>&6
+echo "configure:11394: checking for working alloca.h" >&5
+if eval "test \"`echo '$''{'ac_cv_header_alloca_h'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 11399 "configure"
+#include "confdefs.h"
+#include <alloca.h>
+int main() {
+char *p = alloca(2 * sizeof(int));
+; return 0; }
+EOF
+if { (eval echo configure:11406: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  ac_cv_header_alloca_h=yes
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  ac_cv_header_alloca_h=no
+fi
+rm -f conftest*
+fi
+
+echo "$ac_t""$ac_cv_header_alloca_h" 1>&6
+if test $ac_cv_header_alloca_h = yes; then
+  cat >> confdefs.h <<\EOF
+#define HAVE_ALLOCA_H 1
+EOF
+
+fi
+
+echo $ac_n "checking for alloca""... $ac_c" 1>&6
+echo "configure:11427: checking for alloca" >&5
+if eval "test \"`echo '$''{'ac_cv_func_alloca_works'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 11432 "configure"
+#include "confdefs.h"
+
+#ifdef __GNUC__
+# define alloca __builtin_alloca
+#else
+# ifdef _MSC_VER
+#  include <malloc.h>
+#  define alloca _alloca
+# else
+#  if HAVE_ALLOCA_H
+#   include <alloca.h>
+#  else
+#   ifdef _AIX
+ #pragma alloca
+#   else
+#    ifndef alloca /* predefined by HP cc +Olibcalls */
+char *alloca ();
+#    endif
+#   endif
+#  endif
+# endif
+#endif
+
+int main() {
+char *p = (char *) alloca(1);
+; return 0; }
+EOF
+if { (eval echo configure:11460: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  ac_cv_func_alloca_works=yes
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  ac_cv_func_alloca_works=no
+fi
+rm -f conftest*
+fi
+
+echo "$ac_t""$ac_cv_func_alloca_works" 1>&6
+if test $ac_cv_func_alloca_works = yes; then
+  cat >> confdefs.h <<\EOF
+#define HAVE_ALLOCA 1
+EOF
+
+fi
+
+if test $ac_cv_func_alloca_works = no; then
+  # The SVR3 libPW and SVR4 libucb both contain incompatible functions
+  # that cause trouble.  Some versions do not even contain alloca or
+  # contain a buggy version.  If you still want to use their alloca,
+  # use ar to extract alloca.o from them instead of compiling alloca.c.
+  ALLOCA=alloca.${ac_objext}
+  cat >> confdefs.h <<\EOF
+#define C_ALLOCA 1
+EOF
+
+
+echo $ac_n "checking whether alloca needs Cray hooks""... $ac_c" 1>&6
+echo "configure:11492: checking whether alloca needs Cray hooks" >&5
+if eval "test \"`echo '$''{'ac_cv_os_cray'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 11497 "configure"
+#include "confdefs.h"
+#if defined(CRAY) && ! defined(CRAY2)
+webecray
+#else
+wenotbecray
+#endif
+
+EOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  egrep "webecray" >/dev/null 2>&1; then
+  rm -rf conftest*
+  ac_cv_os_cray=yes
+else
+  rm -rf conftest*
+  ac_cv_os_cray=no
+fi
+rm -f conftest*
+
+fi
+
+echo "$ac_t""$ac_cv_os_cray" 1>&6
+if test $ac_cv_os_cray = yes; then
+for ac_func in _getb67 GETB67 getb67; do
+  echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:11522: checking for $ac_func" >&5
+if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 11527 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char $ac_func(); below.  */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char $ac_func();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+$ac_func();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:11550: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  cat >> confdefs.h <<EOF
+#define CRAY_STACKSEG_END $ac_func
+EOF
+
+  break
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+done
+fi
+
+echo $ac_n "checking stack direction for C alloca""... $ac_c" 1>&6
+echo "configure:11577: checking stack direction for C alloca" >&5
+if eval "test \"`echo '$''{'ac_cv_c_stack_direction'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  if test "$cross_compiling" = yes; then
+  ac_cv_c_stack_direction=0
+else
+  cat > conftest.$ac_ext <<EOF
+#line 11585 "configure"
+#include "confdefs.h"
+find_stack_direction ()
+{
+  static char *addr = 0;
+  auto char dummy;
+  if (addr == 0)
+    {
+      addr = &dummy;
+      return find_stack_direction ();
+    }
+  else
+    return (&dummy > addr) ? 1 : -1;
+}
+main ()
+{
+  exit (find_stack_direction() < 0);
+}
+EOF
+if { (eval echo configure:11604: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+then
+  ac_cv_c_stack_direction=1
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -fr conftest*
+  ac_cv_c_stack_direction=-1
+fi
+rm -fr conftest*
+fi
+
+fi
+
+echo "$ac_t""$ac_cv_c_stack_direction" 1>&6
+cat >> confdefs.h <<EOF
+#define STACK_DIRECTION $ac_cv_c_stack_direction
+EOF
+
+fi
+
+if test $ac_cv_prog_gcc = yes; then
+    echo $ac_n "checking whether ${CC-cc} needs -traditional""... $ac_c" 1>&6
+echo "configure:11627: checking whether ${CC-cc} needs -traditional" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_gcc_traditional'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+    ac_pattern="Autoconf.*'x'"
+  cat > conftest.$ac_ext <<EOF
+#line 11633 "configure"
+#include "confdefs.h"
+#include <sgtty.h>
+Autoconf TIOCGETP
+EOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  egrep "$ac_pattern" >/dev/null 2>&1; then
+  rm -rf conftest*
+  ac_cv_prog_gcc_traditional=yes
+else
+  rm -rf conftest*
+  ac_cv_prog_gcc_traditional=no
+fi
+rm -f conftest*
+
+
+  if test $ac_cv_prog_gcc_traditional = no; then
+    cat > conftest.$ac_ext <<EOF
+#line 11651 "configure"
+#include "confdefs.h"
+#include <termio.h>
+Autoconf TCGETA
+EOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  egrep "$ac_pattern" >/dev/null 2>&1; then
+  rm -rf conftest*
+  ac_cv_prog_gcc_traditional=yes
+fi
+rm -f conftest*
+
+  fi
+fi
+
+echo "$ac_t""$ac_cv_prog_gcc_traditional" 1>&6
+  if test $ac_cv_prog_gcc_traditional = yes; then
+    CC="$CC -traditional"
+  fi
+fi
+
+echo $ac_n "checking for 8-bit clean memcmp""... $ac_c" 1>&6
+echo "configure:11673: checking for 8-bit clean memcmp" >&5
+if eval "test \"`echo '$''{'ac_cv_func_memcmp_clean'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  if test "$cross_compiling" = yes; then
+  ac_cv_func_memcmp_clean=no
+else
+  cat > conftest.$ac_ext <<EOF
+#line 11681 "configure"
+#include "confdefs.h"
+
+main()
+{
+  char c0 = 0x40, c1 = 0x80, c2 = 0x81;
+  exit(memcmp(&c0, &c2, 1) < 0 && memcmp(&c1, &c2, 1) < 0 ? 0 : 1);
+}
+
+EOF
+if { (eval echo configure:11691: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+then
+  ac_cv_func_memcmp_clean=yes
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -fr conftest*
+  ac_cv_func_memcmp_clean=no
+fi
+rm -fr conftest*
+fi
+
+fi
+
+echo "$ac_t""$ac_cv_func_memcmp_clean" 1>&6
+test $ac_cv_func_memcmp_clean = no && LIBOBJS="$LIBOBJS memcmp.${ac_objext}"
+
+echo $ac_n "checking return type of signal handlers""... $ac_c" 1>&6
+echo "configure:11709: checking return type of signal handlers" >&5
+if eval "test \"`echo '$''{'ac_cv_type_signal'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 11714 "configure"
+#include "confdefs.h"
+#include <sys/types.h>
+#include <signal.h>
+#ifdef signal
+#undef signal
+#endif
+#ifdef __cplusplus
+extern "C" void (*signal (int, void (*)(int)))(int);
+#else
+void (*signal ()) ();
+#endif
+
+int main() {
+int i;
+; return 0; }
+EOF
+if { (eval echo configure:11731: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  ac_cv_type_signal=void
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  ac_cv_type_signal=int
+fi
+rm -f conftest*
+fi
+
+echo "$ac_t""$ac_cv_type_signal" 1>&6
+cat >> confdefs.h <<EOF
+#define RETSIGTYPE $ac_cv_type_signal
+EOF
+
+
+# getmntent is in -lsun on Irix 4, -lseq on Dynix/PTX, -lgen on Unixware.
+echo $ac_n "checking for getmntent in -lsun""... $ac_c" 1>&6
+echo "configure:11751: checking for getmntent in -lsun" >&5
+ac_lib_var=`echo sun'_'getmntent | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  ac_save_LIBS="$LIBS"
+LIBS="-lsun  $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 11759 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char getmntent();
+
+int main() {
+getmntent()
+; return 0; }
+EOF
+if { (eval echo configure:11770: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  LIBS="-lsun $LIBS"
+else
+  echo "$ac_t""no" 1>&6
+echo $ac_n "checking for getmntent in -lseq""... $ac_c" 1>&6
+echo "configure:11789: checking for getmntent in -lseq" >&5
+ac_lib_var=`echo seq'_'getmntent | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  ac_save_LIBS="$LIBS"
+LIBS="-lseq  $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 11797 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char getmntent();
+
+int main() {
+getmntent()
+; return 0; }
+EOF
+if { (eval echo configure:11808: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  LIBS="-lseq $LIBS"
+else
+  echo "$ac_t""no" 1>&6
+echo $ac_n "checking for getmntent in -lgen""... $ac_c" 1>&6
+echo "configure:11827: checking for getmntent in -lgen" >&5
+ac_lib_var=`echo gen'_'getmntent | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  ac_save_LIBS="$LIBS"
+LIBS="-lgen  $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 11835 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char getmntent();
+
+int main() {
+getmntent()
+; return 0; }
+EOF
+if { (eval echo configure:11846: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  LIBS="-lgen $LIBS"
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+fi
+
+fi
+
+echo $ac_n "checking for getmntent""... $ac_c" 1>&6
+echo "configure:11871: checking for getmntent" >&5
+if eval "test \"`echo '$''{'ac_cv_func_getmntent'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 11876 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char getmntent(); below.  */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char getmntent();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_getmntent) || defined (__stub___getmntent)
+choke me
+#else
+getmntent();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:11899: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_func_getmntent=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_func_getmntent=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'getmntent`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  cat >> confdefs.h <<\EOF
+#define HAVE_GETMNTENT 1
+EOF
+
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+for ac_func in setmntent gethostname uname gettimeofday select socket strtol strtoul strlcpy
+do
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:11924: checking for $ac_func" >&5
+if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 11929 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char $ac_func(); below.  */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char $ac_func();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+$ac_func();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:11952: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_func 1
+EOF
+ 
+else
+  echo "$ac_t""no" 1>&6
+fi
+done
+
+for ac_func in strchr strdup memcpy memmove index bcopy strcasestr regcomp
+do
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:11979: checking for $ac_func" >&5
+if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 11984 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char $ac_func(); below.  */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char $ac_func();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+$ac_func();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:12007: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_func 1
+EOF
+ 
+else
+  echo "$ac_t""no" 1>&6
+fi
+done
+
+for ac_func in signal setsid sigset sigblock sighold strerror setenv vsnprintf snprintf
+do
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:12034: checking for $ac_func" >&5
+if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 12039 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char $ac_func(); below.  */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char $ac_func();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+$ac_func();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:12062: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_func 1
+EOF
+ 
+else
+  echo "$ac_t""no" 1>&6
+fi
+done
+
+for ac_func in sigaction
+do
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:12089: checking for $ac_func" >&5
+if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 12094 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char $ac_func(); below.  */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char $ac_func();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+$ac_func();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:12117: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_func 1
+EOF
+ 
+else
+  echo "$ac_t""no" 1>&6
+fi
+done
+
+for ac_func in snprintf strtoul
+do
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:12144: checking for $ac_func" >&5
+if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 12149 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char $ac_func(); below.  */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char $ac_func();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+$ac_func();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:12172: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_func 1
+EOF
+ 
+else
+  echo "$ac_t""no" 1>&6
+fi
+done
+
+for ac_func in random lrand48 rand
+do
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:12199: checking for $ac_func" >&5
+if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 12204 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char $ac_func(); below.  */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char $ac_func();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+$ac_func();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:12227: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_func 1
+EOF
+ 
+else
+  echo "$ac_t""no" 1>&6
+fi
+done
+
+for ac_func in execv system fork getpid strncasecmp sigalrm
+do
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:12254: checking for $ac_func" >&5
+if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 12259 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char $ac_func(); below.  */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char $ac_func();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+$ac_func();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:12282: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_func 1
+EOF
+ 
+else
+  echo "$ac_t""no" 1>&6
+fi
+done
+
+if echo " $module_list " | grep " host/hr_swinst " > /dev/null; then
+  OLDLIBS=$LIBS
+  LIBS=$AGENTLIBS
+  for ac_func in rpmGetPath
+do
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:12312: checking for $ac_func" >&5
+if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 12317 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char $ac_func(); below.  */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char $ac_func();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+$ac_func();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:12340: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_func 1
+EOF
+ 
+else
+  echo "$ac_t""no" 1>&6
+fi
+done
+
+  LIBS=$OLDLIBS
+fi
+
+for ac_func in getloadavg
+do
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:12370: checking for $ac_func" >&5
+if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 12375 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char $ac_func(); below.  */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char $ac_func();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+$ac_func();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:12398: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_func 1
+EOF
+ 
+else
+  echo "$ac_t""no" 1>&6
+fi
+done
+
+for ac_func in getaddrinfo getipnodebyname
+do
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:12425: checking for $ac_func" >&5
+if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 12430 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char $ac_func(); below.  */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char $ac_func();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+$ac_func();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:12453: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_func 1
+EOF
+ 
+else
+  echo "$ac_t""no" 1>&6
+fi
+done
+
+for ac_func in statfs
+do
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:12480: checking for $ac_func" >&5
+if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 12485 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char $ac_func(); below.  */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char $ac_func();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+$ac_func();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:12508: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_func 1
+EOF
+ 
+else
+  echo "$ac_t""no" 1>&6
+fi
+done
+
+for ac_func in getdtablesize
+do
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:12535: checking for $ac_func" >&5
+if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 12540 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char $ac_func(); below.  */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char $ac_func();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+$ac_func();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:12563: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_func 1
+EOF
+ 
+else
+  echo "$ac_t""no" 1>&6
+fi
+done
+
+for ac_func in getfsstat
+do
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:12590: checking for $ac_func" >&5
+if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 12595 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char $ac_func(); below.  */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char $ac_func();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+$ac_func();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:12618: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_func 1
+EOF
+ 
+else
+  echo "$ac_t""no" 1>&6
+fi
+done
+
+for ac_func in usleep
+do
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:12645: checking for $ac_func" >&5
+if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 12650 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char $ac_func(); below.  */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char $ac_func();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+$ac_func();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:12673: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_func 1
+EOF
+ 
+else
+  echo "$ac_t""no" 1>&6
+fi
+done
+
+#for ac_func in setlocale
+#do
+#echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+#echo "configure:12700: checking for $ac_func" >&5
+#if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+#  echo $ac_n "(cached) $ac_c" 1>&6
+#else
+#  cat > conftest.$ac_ext <<EOF
+##line 12705 "configure"
+##include "confdefs.h"
+#/* System header to define __stub macros and hopefully few prototypes,
+#    which can conflict with char $ac_func(); below.  */
+##include <assert.h>
+#/* Override any gcc2 internal prototype to avoid an error.  */
+#/* We use char because int might match the return type of a gcc2
+#    builtin and then its argument prototype would still apply.  */
+#char $ac_func();
+#
+#int main() {
+#
+#/* The GNU C library defines this for functions which it implements
+#    to always fail with ENOSYS.  Some functions are actually named
+#    something starting with __ and the normal name is an alias.  */
+##if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+#choke me
+##else
+#$ac_func();
+#endif
+#
+#; return 0; }
+#EOF
+#if { (eval echo configure:12728: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+#  rm -rf conftest*
+#  eval "ac_cv_func_$ac_func=yes"
+#else
+#  echo "configure: failed program was:" >&5
+#  cat conftest.$ac_ext >&5
+#  rm -rf conftest*
+#  eval "ac_cv_func_$ac_func=no"
+#fi
+#rm -f conftest*
+#fi
+#
+#if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+#  echo "$ac_t""yes" 1>&6
+#    ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+#  cat >> confdefs.h <<EOF
+##define $ac_tr_func 1
+#EOF
+# 
+#else
+#  echo "$ac_t""no" 1>&6
+#fi
+#done
+
+for ac_func in tcgetattr
+do
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:12755: checking for $ac_func" >&5
+if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 12760 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char $ac_func(); below.  */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char $ac_func();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+$ac_func();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:12783: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_func 1
+EOF
+ 
+else
+  echo "$ac_t""no" 1>&6
+fi
+done
+
+for ac_func in if_nameindex if_freenameindex
+do
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:12810: checking for $ac_func" >&5
+if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 12815 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char $ac_func(); below.  */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char $ac_func();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+$ac_func();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:12838: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_func 1
+EOF
+ 
+else
+  echo "$ac_t""no" 1>&6
+fi
+done
+
+for ac_func in getpagesize
+do
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:12865: checking for $ac_func" >&5
+if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 12870 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char $ac_func(); below.  */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char $ac_func();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+$ac_func();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:12893: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_func 1
+EOF
+ 
+else
+  echo "$ac_t""no" 1>&6
+fi
+done
+
+for ac_func in mkstemp
+do
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:12920: checking for $ac_func" >&5
+if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 12925 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char $ac_func(); below.  */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char $ac_func();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+$ac_func();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:12948: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_func 1
+EOF
+ 
+else
+  echo "$ac_t""no" 1>&6
+fi
+done
+
+for ac_func in getpwnam getgrnam setgid setuid setgroups
+do
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:12975: checking for $ac_func" >&5
+if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 12980 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char $ac_func(); below.  */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char $ac_func();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+$ac_func();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:13003: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_func 1
+EOF
+ 
+else
+  echo "$ac_t""no" 1>&6
+fi
+done
+
+for ac_func in setitimer
+do
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:13030: checking for $ac_func" >&5
+if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 13035 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char $ac_func(); below.  */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char $ac_func();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+$ac_func();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:13058: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_func 1
+EOF
+ 
+else
+  echo "$ac_t""no" 1>&6
+fi
+done
+
+
+echo $ac_n "checking for SIOCGIFADDR in sys/ioctl.h""... $ac_c" 1>&6
+echo "configure:13084: checking for SIOCGIFADDR in sys/ioctl.h" >&5
+if eval "test \"`echo '$''{'cv_sys_ioctl_h_has_SIOCGIFADDR'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+   cat > conftest.$ac_ext <<EOF
+#line 13089 "configure"
+#include "confdefs.h"
+
+#ifdef HAVE_SYS_IOCTL_H
+#include <sys/ioctl.h>
+#endif
+#ifdef SIOCGIFADDR
+xxxyesxxx
+#endif
+
+EOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  egrep "xxxyesxxx" >/dev/null 2>&1; then
+  rm -rf conftest*
+  cv_sys_ioctl_h_has_SIOCGIFADDR=yes
+else
+  rm -rf conftest*
+  cv_sys_ioctl_h_has_SIOCGIFADDR=no
+fi
+rm -f conftest*
+
+fi
+
+echo "$ac_t""$cv_sys_ioctl_h_has_SIOCGIFADDR" 1>&6
+if test $cv_sys_ioctl_h_has_SIOCGIFADDR = yes; then
+  cat >> confdefs.h <<\EOF
+#define SYS_IOCTL_H_HAS_SIOCGIFADDR 1
+EOF
+
+fi
+
+# ultrix
+echo $ac_n "checking for two-argument statfs with struct fs_data (Ultrix)""... $ac_c" 1>&6
+echo "configure:13122: checking for two-argument statfs with struct fs_data (Ultrix)" >&5
+if eval "test \"`echo '$''{'fu_cv_sys_stat_fs_data'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  if test "$cross_compiling" = yes; then
+  fu_cv_sys_stat_fs_data=no
+else
+  cat > conftest.$ac_ext <<EOF
+#line 13130 "configure"
+#include "confdefs.h"
+
+#ifdef HAVE_SYS_PARAM_H
+#include <sys/param.h>
+#endif
+#include <sys/types.h>
+#ifdef HAVE_SYS_MOUNT_H
+#include <sys/mount.h>
+#endif
+#ifdef HAVE_SYS_FS_TYPES_H
+#include <sys/fs_types.h>
+#endif
+main ()
+{
+struct fs_data fsd;
+/* Ultrix's statfs returns 1 for success,
+   0 for not mounted, -1 for failure.  */
+exit (statfs (".", &fsd) != 1);
+}
+EOF
+if { (eval echo configure:13151: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+then
+  fu_cv_sys_stat_fs_data=yes
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -fr conftest*
+  fu_cv_sys_stat_fs_data=no
+fi
+rm -fr conftest*
+fi
+
+fi
+
+echo "$ac_t""$fu_cv_sys_stat_fs_data" 1>&6
+if test $fu_cv_sys_stat_fs_data = yes; then
+  cat >> confdefs.h <<\EOF
+#define STAT_STATFS_FS_DATA 1
+EOF
+
+fi
+
+echo $ac_n "checking if __FUNCTION__ is defined""... $ac_c" 1>&6
+echo "configure:13174: checking if __FUNCTION__ is defined" >&5
+if eval "test \"`echo '$''{'ac_cv_HAVE_CPP_UNDERBAR_FUNCTION_DEFINED'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+cat > conftest.$ac_ext <<EOF
+#line 13180 "configure"
+#include "confdefs.h"
+
+int main() {
+
+    char *cp = __FUNCTION__;
+
+; return 0; }
+EOF
+if { (eval echo configure:13189: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  ac_cv_HAVE_CPP_UNDERBAR_FUNCTION_DEFINED=yes
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  ac_cv_HAVE_CPP_UNDERBAR_FUNCTION_DEFINED=no
+fi
+rm -f conftest*
+fi
+
+echo "$ac_t""$ac_cv_HAVE_CPP_UNDERBAR_FUNCTION_DEFINED" 1>&6
+
+if test "x$ac_cv_HAVE_CPP_UNDERBAR_FUNCTION_DEFINED" = "xyes"; then
+  cat >> confdefs.h <<\EOF
+#define HAVE_CPP_UNDERBAR_FUNCTION_DEFINED 1
+EOF
+
+fi
+
+
+
+ac_safe_struct=`echo "sigaction" | sed 'y%./+-%__p_%'`
+ac_safe_member=`echo "sa_sigaction" | 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 $ac_n "checking for sigaction.sa_sigaction""... $ac_c" 1>&6
+echo "configure:13218: checking for sigaction.sa_sigaction" >&5
+if eval "test \"`echo '$''{'$ac_safe_all'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+if test "xno" = "x"; then
+  defineit="= 0"
+elif test "xno" = "xno"; then
+  defineit=""
+else
+  defineit="no"
+fi
+cat > conftest.$ac_ext <<EOF
+#line 13231 "configure"
+#include "confdefs.h"
+
+
+#ifdef HAVE_SYS_PARAM_H
+#include <sys/param.h>
+#endif
+#include <sys/types.h>
+#include <sys/signal.h>
+
+
+int main() {
+
+struct sigaction testit; 
+testit.sa_sigaction $defineit;
+
+; return 0; }
+EOF
+if { (eval echo configure:13249: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  eval "${ac_safe_all}=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "${ac_safe_all}=no" 
+fi
+rm -f conftest*
+
+fi
+
+
+if eval "test \"x$`echo ${ac_safe_all}`\" = \"xyes\""; then
+  echo "$ac_t""yes" 1>&6
+  cat >> confdefs.h <<EOF
+#define $ac_uc_define 1
+EOF
+
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+
+
+
+
+ac_safe_struct=`echo "sockaddr" | sed 'y%./+-%__p_%'`
+ac_safe_member=`echo "sa_len" | 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 $ac_n "checking for sockaddr.sa_len""... $ac_c" 1>&6
+echo "configure:13283: checking for sockaddr.sa_len" >&5
+if eval "test \"`echo '$''{'$ac_safe_all'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+if test "xno" = "x"; then
+  defineit="= 0"
+elif test "xno" = "xno"; then
+  defineit=""
+else
+  defineit="no"
+fi
+cat > conftest.$ac_ext <<EOF
+#line 13296 "configure"
+#include "confdefs.h"
+
+
+#ifdef HAVE_SYS_PARAM_H
+#include <sys/param.h>
+#endif
+#include <sys/types.h>
+#define KERNEL
+#define _KERNEL
+#include <sys/socket.h>
+#undef KERNEL
+#undef _KERNEL
+
+
+int main() {
+
+struct sockaddr testit; 
+testit.sa_len $defineit;
+
+; return 0; }
+EOF
+if { (eval echo configure:13318: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  eval "${ac_safe_all}=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "${ac_safe_all}=no" 
+fi
+rm -f conftest*
+
+fi
+
+
+if eval "test \"x$`echo ${ac_safe_all}`\" = \"xyes\""; then
+  echo "$ac_t""yes" 1>&6
+  cat >> confdefs.h <<EOF
+#define $ac_uc_define 1
+EOF
+
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+
+
+
+
+ac_safe_struct=`echo "sockaddr" | sed 'y%./+-%__p_%'`
+ac_safe_member=`echo "sa_union.sa_generic.sa_family2" | 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 $ac_n "checking for sockaddr.sa_union.sa_generic.sa_family2""... $ac_c" 1>&6
+echo "configure:13352: checking for sockaddr.sa_union.sa_generic.sa_family2" >&5
+if eval "test \"`echo '$''{'$ac_safe_all'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+if test "xno" = "x"; then
+  defineit="= 0"
+elif test "xno" = "xno"; then
+  defineit=""
+else
+  defineit="no"
+fi
+cat > conftest.$ac_ext <<EOF
+#line 13365 "configure"
+#include "confdefs.h"
+
+
+#ifdef HAVE_SYS_PARAM_H
+#include <sys/param.h>
+#endif
+#include <sys/types.h>
+#define KERNEL
+#define _KERNEL
+#include <sys/socket.h>
+#undef KERNEL
+#undef _KERNEL
+
+
+int main() {
+
+struct sockaddr testit; 
+testit.sa_union.sa_generic.sa_family2 $defineit;
+
+; return 0; }
+EOF
+if { (eval echo configure:13387: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  eval "${ac_safe_all}=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "${ac_safe_all}=no" 
+fi
+rm -f conftest*
+
+fi
+
+
+if eval "test \"x$`echo ${ac_safe_all}`\" = \"xyes\""; then
+  echo "$ac_t""yes" 1>&6
+  cat >> confdefs.h <<EOF
+#define $ac_uc_define 1
+EOF
+
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+
+
+
+
+ac_safe_struct=`echo "rtentry" | sed 'y%./+-%__p_%'`
+ac_safe_member=`echo "rt_dst" | 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 $ac_n "checking for rtentry.rt_dst""... $ac_c" 1>&6
+echo "configure:13421: checking for rtentry.rt_dst" >&5
+if eval "test \"`echo '$''{'$ac_safe_all'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+if test "xno" = "x"; then
+  defineit="= 0"
+elif test "xno" = "xno"; then
+  defineit=""
+else
+  defineit="no"
+fi
+cat > conftest.$ac_ext <<EOF
+#line 13434 "configure"
+#include "confdefs.h"
+
+
+#ifdef HAVE_SYS_PARAM_H
+#include <sys/param.h>
+#endif
+#include <sys/types.h>
+#define KERNEL
+#define _KERNEL
+#include <sys/socket.h>
+#undef KERNEL
+#undef _KERNEL
+#include <net/route.h>
+
+
+int main() {
+
+struct rtentry testit; 
+testit.rt_dst $defineit;
+
+; return 0; }
+EOF
+if { (eval echo configure:13457: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  eval "${ac_safe_all}=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "${ac_safe_all}=no" 
+fi
+rm -f conftest*
+
+fi
+
+
+if eval "test \"x$`echo ${ac_safe_all}`\" = \"xyes\""; then
+  echo "$ac_t""yes" 1>&6
+  cat >> confdefs.h <<EOF
+#define $ac_uc_define 1
+EOF
+
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+
+
+echo $ac_n "checking type of rtentry structure""... $ac_c" 1>&6
+echo "configure:13484: checking type of rtentry structure" >&5
+if eval "test \"`echo '$''{'ac_cv_RTENTRY_TYPE'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+
+cat > conftest.$ac_ext <<EOF
+#line 13491 "configure"
+#include "confdefs.h"
+
+#ifdef HAVE_SYS_PARAM_H
+#include <sys/param.h>
+#endif
+#include <sys/types.h>
+#define KERNEL
+#define _KERNEL
+#include <sys/socket.h>
+#undef KERNEL
+#undef _KERNEL
+#include <net/route.h>
+
+int main() {
+
+
+#ifndef STRUCT_RTENTRY_HAS_RT_DST
+#define rt_dst rt_nodes->rn_key
+#endif
+
+  struct rtentry rt; 
+  rt.rt_nodes[0].rn_flags = 1;
+  rt.rt_dst;
+  
+; return 0; }
+EOF
+if { (eval echo configure:13518: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  ac_cv_RTENTRY_TYPE="BSD-4.4"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+fi
+rm -f conftest*
+
+if test "x$ac_cv_RTENTRY_TYPE" = "x"; then
+cat > conftest.$ac_ext <<EOF
+#line 13529 "configure"
+#include "confdefs.h"
+
+#ifdef HAVE_SYS_PARAM_H
+#include <sys/param.h>
+#endif
+#include <sys/types.h>
+#define KERNEL
+#define _KERNEL
+#include <sys/socket.h>
+#undef KERNEL
+#undef _KERNEL
+#include <net/route.h>
+
+int main() {
+
+struct rtentry rt; 
+rt.rt_hash;
+
+; return 0; }
+EOF
+if { (eval echo configure:13550: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  ac_cv_RTENTRY_TYPE="BSD-4.3"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+fi
+rm -f conftest*
+fi
+
+if test "x$ac_cv_RTENTRY_TYPE" = "x"; then
+  echo "$ac_t""Unknown" 1>&6
+  ac_cv_RTENTRY_TYPE="unknown"
+fi
+
+
+fi
+
+echo "$ac_t""$ac_cv_RTENTRY_TYPE" 1>&6
+
+if test "x$ac_cv_RTENTRY_TYPE" = "xBSD-4.4"; then
+  cat >> confdefs.h <<\EOF
+#define RTENTRY_4_4 1
+EOF
+
+fi
+
+if test "x$ac_cv_RTENTRY_TYPE" = "xunknown"; then
+echo $ac_n "checking for struct rtentry""... $ac_c" 1>&6
+echo "configure:13579: checking for struct rtentry" >&5
+if eval "test \"`echo '$''{'ac_cv_struct_rtentry'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 13584 "configure"
+#include "confdefs.h"
+#define KERNEL
+#include <net/route.h>
+
+EOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  egrep "ortentry" >/dev/null 2>&1; then
+  rm -rf conftest*
+  ac_cv_struct_rtentry=ortentry
+else
+  rm -rf conftest*
+  ac_cv_struct_rtentry=rtentry 
+fi
+rm -f conftest*
+
+if test "x$ac_cv_struct_rtentry" = "xrtentry" ; then
+  ac_cv_struct_rtentry="rtentry"
+else
+  ac_cv_struct_rtentry="ortentry"
+fi
+
+fi
+
+echo "$ac_t""$ac_cv_struct_rtentry" 1>&6
+else
+  RTENTRY_TYPE="rtentry"
+  ac_cv_struct_rtentry="rtentry"
+fi
+
+if test "x$ac_cv_struct_rtentry" != "x"; then
+  cat >> confdefs.h <<EOF
+#define RTENTRY struct ${ac_cv_struct_rtentry}
+EOF
+
+else
+  cat >> confdefs.h <<\EOF
+#define RTENTRY struct rtentry
+EOF
+
+fi
+
+if test "x$ac_cv_RTENTRY_TYPE" = "xBSD-4.3"; then
+echo $ac_n "checking for struct rtentry has a rt_next node""... $ac_c" 1>&6
+echo "configure:13628: checking for struct rtentry has a rt_next node" >&5
+if eval "test \"`echo '$''{'ac_cv_struct_rtentry_rt_next'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+cat > conftest.$ac_ext <<EOF
+#line 13634 "configure"
+#include "confdefs.h"
+
+#ifdef HAVE_SYS_PARAM_H
+#include <sys/param.h>
+#endif
+#include <sys/types.h>
+#define KERNEL
+#define _KERNEL
+#include <sys/socket.h>
+#undef KERNEL
+#undef _KERNEL
+#include <net/route.h>
+
+int main() {
+
+struct rtentry rt; 
+rt.rt_next;
+
+; return 0; }
+EOF
+if { (eval echo configure:13655: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  ac_cv_struct_rtentry_rt_next=yes
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  ac_cv_struct_rtentry_rt_next=no 
+fi
+rm -f conftest*
+
+fi
+
+echo "$ac_t""$ac_cv_struct_rtentry_rt_next" 1>&6
+
+if test "x$ac_cv_struct_rtentry_rt_next" = "xyes"; then
+  cat >> confdefs.h <<\EOF
+#define RTENTRY_RT_NEXT 1
+EOF
+
+fi
+
+fi
+
+
+
+ac_safe_struct=`echo "rtentry" | sed 'y%./+-%__p_%'`
+ac_safe_member=`echo "rt_unit" | 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 $ac_n "checking for rtentry.rt_unit""... $ac_c" 1>&6
+echo "configure:13687: checking for rtentry.rt_unit" >&5
+if eval "test \"`echo '$''{'$ac_safe_all'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+if test "x" = "x"; then
+  defineit="= 0"
+elif test "x" = "xno"; then
+  defineit=""
+else
+  defineit=""
+fi
+cat > conftest.$ac_ext <<EOF
+#line 13700 "configure"
+#include "confdefs.h"
+
+
+#ifdef HAVE_SYS_PARAM_H
+#include <sys/param.h>
+#endif
+#include <sys/types.h>
+#define KERNEL
+#define _KERNEL
+#include <sys/socket.h>
+#undef KERNEL
+#undef _KERNEL
+#include <net/route.h>
+
+
+int main() {
+
+struct rtentry testit; 
+testit.rt_unit $defineit;
+
+; return 0; }
+EOF
+if { (eval echo configure:13723: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  eval "${ac_safe_all}=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "${ac_safe_all}=no" 
+fi
+rm -f conftest*
+
+fi
+
+
+if eval "test \"x$`echo ${ac_safe_all}`\" = \"xyes\""; then
+  echo "$ac_t""yes" 1>&6
+  cat >> confdefs.h <<EOF
+#define $ac_uc_define 1
+EOF
+
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+
+
+
+
+ac_safe_struct=`echo "rtentry" | sed 'y%./+-%__p_%'`
+ac_safe_member=`echo "rt_refcnt" | 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 $ac_n "checking for rtentry.rt_refcnt""... $ac_c" 1>&6
+echo "configure:13757: checking for rtentry.rt_refcnt" >&5
+if eval "test \"`echo '$''{'$ac_safe_all'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+if test "x" = "x"; then
+  defineit="= 0"
+elif test "x" = "xno"; then
+  defineit=""
+else
+  defineit=""
+fi
+cat > conftest.$ac_ext <<EOF
+#line 13770 "configure"
+#include "confdefs.h"
+
+
+#ifdef HAVE_SYS_PARAM_H
+#include <sys/param.h>
+#endif
+#include <sys/types.h>
+#define KERNEL
+#define _KERNEL
+#include <sys/socket.h>
+#undef KERNEL
+#undef _KERNEL
+#include <net/route.h>
+
+
+int main() {
+
+struct rtentry testit; 
+testit.rt_refcnt $defineit;
+
+; return 0; }
+EOF
+if { (eval echo configure:13793: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  eval "${ac_safe_all}=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "${ac_safe_all}=no" 
+fi
+rm -f conftest*
+
+fi
+
+
+if eval "test \"x$`echo ${ac_safe_all}`\" = \"xyes\""; then
+  echo "$ac_t""yes" 1>&6
+  cat >> confdefs.h <<EOF
+#define $ac_uc_define 1
+EOF
+
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+
+
+
+
+ac_safe_struct=`echo "rtentry" | sed 'y%./+-%__p_%'`
+ac_safe_member=`echo "rt_hash" | 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 $ac_n "checking for rtentry.rt_hash""... $ac_c" 1>&6
+echo "configure:13827: checking for rtentry.rt_hash" >&5
+if eval "test \"`echo '$''{'$ac_safe_all'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+if test "x" = "x"; then
+  defineit="= 0"
+elif test "x" = "xno"; then
+  defineit=""
+else
+  defineit=""
+fi
+cat > conftest.$ac_ext <<EOF
+#line 13840 "configure"
+#include "confdefs.h"
+
+
+#ifdef HAVE_SYS_PARAM_H
+#include <sys/param.h>
+#endif
+#include <sys/types.h>
+#define KERNEL
+#define _KERNEL
+#include <sys/socket.h>
+#undef KERNEL
+#undef _KERNEL
+#include <net/route.h>
+
+
+int main() {
+
+struct rtentry testit; 
+testit.rt_hash $defineit;
+
+; return 0; }
+EOF
+if { (eval echo configure:13863: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  eval "${ac_safe_all}=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "${ac_safe_all}=no" 
+fi
+rm -f conftest*
+
+fi
+
+
+if eval "test \"x$`echo ${ac_safe_all}`\" = \"xyes\""; then
+  echo "$ac_t""yes" 1>&6
+  cat >> confdefs.h <<EOF
+#define $ac_uc_define 1
+EOF
+
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+
+
+
+
+ac_safe_struct=`echo "rtentry" | sed 'y%./+-%__p_%'`
+ac_safe_member=`echo "rt_use" | 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 $ac_n "checking for rtentry.rt_use""... $ac_c" 1>&6
+echo "configure:13897: checking for rtentry.rt_use" >&5
+if eval "test \"`echo '$''{'$ac_safe_all'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+if test "x" = "x"; then
+  defineit="= 0"
+elif test "x" = "xno"; then
+  defineit=""
+else
+  defineit=""
+fi
+cat > conftest.$ac_ext <<EOF
+#line 13910 "configure"
+#include "confdefs.h"
+
+
+#ifdef HAVE_SYS_PARAM_H
+#include <sys/param.h>
+#endif
+#include <sys/types.h>
+#define KERNEL
+#define _KERNEL
+#include <sys/socket.h>
+#undef KERNEL
+#undef _KERNEL
+#include <net/route.h>
+
+
+int main() {
+
+struct rtentry testit; 
+testit.rt_use $defineit;
+
+; return 0; }
+EOF
+if { (eval echo configure:13933: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  eval "${ac_safe_all}=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "${ac_safe_all}=no" 
+fi
+rm -f conftest*
+
+fi
+
+
+if eval "test \"x$`echo ${ac_safe_all}`\" = \"xyes\""; then
+  echo "$ac_t""yes" 1>&6
+  cat >> confdefs.h <<EOF
+#define $ac_uc_define 1
+EOF
+
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+
+
+
+
+ac_safe_struct=`echo "tcpstat" | sed 'y%./+-%__p_%'`
+ac_safe_member=`echo "tcp_rcvmemdrop" | 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 $ac_n "checking for tcpstat.tcp_rcvmemdrop""... $ac_c" 1>&6
+echo "configure:13967: checking for tcpstat.tcp_rcvmemdrop" >&5
+if eval "test \"`echo '$''{'$ac_safe_all'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+if test "x" = "x"; then
+  defineit="= 0"
+elif test "x" = "xno"; then
+  defineit=""
+else
+  defineit=""
+fi
+cat > conftest.$ac_ext <<EOF
+#line 13980 "configure"
+#include "confdefs.h"
+
+
+#ifdef HAVE_SYS_PARAM_H
+#include <sys/param.h>
+#endif
+#include <sys/types.h>
+#include <netinet/tcp.h>
+#ifdef HAVE_NETINET_TCP_TIMER_H
+#include <netinet/tcp_timer.h>
+#endif
+
+#ifdef HAVE_NETINET_TCP_VAR_H
+#include <netinet/tcp_var.h>
+#endif
+
+
+int main() {
+
+struct tcpstat testit; 
+testit.tcp_rcvmemdrop $defineit;
+
+; return 0; }
+EOF
+if { (eval echo configure:14005: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  eval "${ac_safe_all}=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "${ac_safe_all}=no" 
+fi
+rm -f conftest*
+
+fi
+
+
+if eval "test \"x$`echo ${ac_safe_all}`\" = \"xyes\""; then
+  echo "$ac_t""yes" 1>&6
+  cat >> confdefs.h <<EOF
+#define $ac_uc_define 1
+EOF
+
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+
+
+
+
+
+ac_safe_struct=`echo "ifnet" | sed 'y%./+-%__p_%'`
+ac_safe_member=`echo "if_mtu" | 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 $ac_n "checking for ifnet.if_mtu""... $ac_c" 1>&6
+echo "configure:14040: checking for ifnet.if_mtu" >&5
+if eval "test \"`echo '$''{'$ac_safe_all'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+if test "x" = "x"; then
+  defineit="= 0"
+elif test "x" = "xno"; then
+  defineit=""
+else
+  defineit=""
+fi
+cat > conftest.$ac_ext <<EOF
+#line 14053 "configure"
+#include "confdefs.h"
+
+
+#ifdef HAVE_SYS_PARAM_H
+#include <sys/param.h>
+#endif
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <net/if.h>
+#ifdef HAVE_NET_IF_VAR_H
+#include <net/if_var.h>
+#endif
+
+
+int main() {
+
+struct ifnet testit; 
+testit.if_mtu $defineit;
+
+; return 0; }
+EOF
+if { (eval echo configure:14075: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  eval "${ac_safe_all}=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "${ac_safe_all}=no" 
+fi
+rm -f conftest*
+
+fi
+
+
+if eval "test \"x$`echo ${ac_safe_all}`\" = \"xyes\""; then
+  echo "$ac_t""yes" 1>&6
+  cat >> confdefs.h <<EOF
+#define $ac_uc_define 1
+EOF
+
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+
+
+if test "x$ac_cv_struct_ifnet_has_if_mtu" = "xno"; then
+echo $ac_n "checking if _KERNEL needs to be defined for if_mtu""... $ac_c" 1>&6
+echo "configure:14103: checking if _KERNEL needs to be defined for if_mtu" >&5
+if eval "test \"`echo '$''{'ac_cv_IFNET_NEEDS_KERNEL'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+if test "x$ac_cv_struct_ifnet_has_if_mtu" = "xyes"; then
+  ac_cv_IFNET_NEEDS_KERNEL=no
+else
+cat > conftest.$ac_ext <<EOF
+#line 14112 "configure"
+#include "confdefs.h"
+
+#define _KERNEL 1
+#ifdef HAVE_SYS_PARAM_H
+#include <sys/param.h>
+#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
+
+int main() {
+
+struct ifnet testit;
+testit.if_mtu = 0;
+
+; return 0; }
+EOF
+if { (eval echo configure:14136: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  ac_cv_IFNET_NEEDS_KERNEL=yes
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  ac_cv_IFNET_NEEDS_KERNEL=no
+fi
+rm -f conftest*
+fi
+
+fi
+
+echo "$ac_t""$ac_cv_IFNET_NEEDS_KERNEL" 1>&6
+
+if test "x$ac_cv_IFNET_NEEDS_KERNEL" = "xyes"; then
+  cat >> confdefs.h <<\EOF
+#define IFNET_NEEDS_KERNEL 1
+EOF
+
+fi
+fi
+
+
+
+ac_safe_struct=`echo "ifaddr" | sed 'y%./+-%__p_%'`
+ac_safe_member=`echo "ifa_next" | 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 $ac_n "checking for ifaddr.ifa_next""... $ac_c" 1>&6
+echo "configure:14168: checking for ifaddr.ifa_next" >&5
+if eval "test \"`echo '$''{'$ac_safe_all'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+if test "x" = "x"; then
+  defineit="= 0"
+elif test "x" = "xno"; then
+  defineit=""
+else
+  defineit=""
+fi
+cat > conftest.$ac_ext <<EOF
+#line 14181 "configure"
+#include "confdefs.h"
+
+
+#ifdef IFNET_NEEDS_KERNEL
+#define _KERNEL 1
+#endif
+#ifdef HAVE_SYS_PARAM_H
+#include <sys/param.h>
+#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
+
+
+int main() {
+
+struct ifaddr testit; 
+testit.ifa_next $defineit;
+
+; return 0; }
+EOF
+if { (eval echo configure:14209: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  eval "${ac_safe_all}=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "${ac_safe_all}=no" 
+fi
+rm -f conftest*
+
+fi
+
+
+if eval "test \"x$`echo ${ac_safe_all}`\" = \"xyes\""; then
+  echo "$ac_t""yes" 1>&6
+  cat >> confdefs.h <<EOF
+#define $ac_uc_define 1
+EOF
+
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+
+
+
+
+
+ac_safe_struct=`echo "ifnet" | sed 'y%./+-%__p_%'`
+ac_safe_member=`echo "if_baudrate" | 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 $ac_n "checking for ifnet.if_baudrate""... $ac_c" 1>&6
+echo "configure:14244: checking for ifnet.if_baudrate" >&5
+if eval "test \"`echo '$''{'$ac_safe_all'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+if test "x" = "x"; then
+  defineit="= 0"
+elif test "x" = "xno"; then
+  defineit=""
+else
+  defineit=""
+fi
+cat > conftest.$ac_ext <<EOF
+#line 14257 "configure"
+#include "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_baudrate $defineit;
+
+; return 0; }
+EOF
+if { (eval echo configure:14317: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  eval "${ac_safe_all}=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "${ac_safe_all}=no" 
+fi
+rm -f conftest*
+
+fi
+
+
+if eval "test \"x$`echo ${ac_safe_all}`\" = \"xyes\""; then
+  echo "$ac_t""yes" 1>&6
+  cat >> confdefs.h <<EOF
+#define $ac_uc_define 1
+EOF
+
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+
+
+
+
+
+ac_safe_struct=`echo "ifnet" | sed 'y%./+-%__p_%'`
+ac_safe_member=`echo "if_baudrate.ifs_value" | 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 $ac_n "checking for ifnet.if_baudrate.ifs_value""... $ac_c" 1>&6
+echo "configure:14352: checking for ifnet.if_baudrate.ifs_value" >&5
+if eval "test \"`echo '$''{'$ac_safe_all'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+if test "x" = "x"; then
+  defineit="= 0"
+elif test "x" = "xno"; then
+  defineit=""
+else
+  defineit=""
+fi
+cat > conftest.$ac_ext <<EOF
+#line 14365 "configure"
+#include "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_baudrate.ifs_value $defineit;
+
+; return 0; }
+EOF
+if { (eval echo configure:14425: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  eval "${ac_safe_all}=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "${ac_safe_all}=no" 
+fi
+rm -f conftest*
+
+fi
+
+
+if eval "test \"x$`echo ${ac_safe_all}`\" = \"xyes\""; then
+  echo "$ac_t""yes" 1>&6
+  cat >> confdefs.h <<EOF
+#define $ac_uc_define 1
+EOF
+
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+
+
+
+
+
+ac_safe_struct=`echo "ifnet" | sed 'y%./+-%__p_%'`
+ac_safe_member=`echo "if_speed" | 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 $ac_n "checking for ifnet.if_speed""... $ac_c" 1>&6
+echo "configure:14460: checking for ifnet.if_speed" >&5
+if eval "test \"`echo '$''{'$ac_safe_all'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+if test "x" = "x"; then
+  defineit="= 0"
+elif test "x" = "xno"; then
+  defineit=""
+else
+  defineit=""
+fi
+cat > conftest.$ac_ext <<EOF
+#line 14473 "configure"
+#include "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_speed $defineit;
+
+; return 0; }
+EOF
+if { (eval echo configure:14533: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  eval "${ac_safe_all}=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "${ac_safe_all}=no" 
+fi
+rm -f conftest*
+
+fi
+
+
+if eval "test \"x$`echo ${ac_safe_all}`\" = \"xyes\""; then
+  echo "$ac_t""yes" 1>&6
+  cat >> confdefs.h <<EOF
+#define $ac_uc_define 1
+EOF
+
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+
+
+
+
+
+ac_safe_struct=`echo "ifnet" | sed 'y%./+-%__p_%'`
+ac_safe_member=`echo "if_type" | 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 $ac_n "checking for ifnet.if_type""... $ac_c" 1>&6
+echo "configure:14568: checking for ifnet.if_type" >&5
+if eval "test \"`echo '$''{'$ac_safe_all'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+if test "x" = "x"; then
+  defineit="= 0"
+elif test "x" = "xno"; then
+  defineit=""
+else
+  defineit=""
+fi
+cat > conftest.$ac_ext <<EOF
+#line 14581 "configure"
+#include "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_type $defineit;
+
+; return 0; }
+EOF
+if { (eval echo configure:14641: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  eval "${ac_safe_all}=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "${ac_safe_all}=no" 
+fi
+rm -f conftest*
+
+fi
+
+
+if eval "test \"x$`echo ${ac_safe_all}`\" = \"xyes\""; then
+  echo "$ac_t""yes" 1>&6
+  cat >> confdefs.h <<EOF
+#define $ac_uc_define 1
+EOF
+
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+
+
+
+
+
+ac_safe_struct=`echo "ifnet" | sed 'y%./+-%__p_%'`
+ac_safe_member=`echo "if_imcasts" | 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 $ac_n "checking for ifnet.if_imcasts""... $ac_c" 1>&6
+echo "configure:14676: checking for ifnet.if_imcasts" >&5
+if eval "test \"`echo '$''{'$ac_safe_all'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+if test "x" = "x"; then
+  defineit="= 0"
+elif test "x" = "xno"; then
+  defineit=""
+else
+  defineit=""
+fi
+cat > conftest.$ac_ext <<EOF
+#line 14689 "configure"
+#include "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_imcasts $defineit;
+
+; return 0; }
+EOF
+if { (eval echo configure:14749: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  eval "${ac_safe_all}=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "${ac_safe_all}=no" 
+fi
+rm -f conftest*
+
+fi
+
+
+if eval "test \"x$`echo ${ac_safe_all}`\" = \"xyes\""; then
+  echo "$ac_t""yes" 1>&6
+  cat >> confdefs.h <<EOF
+#define $ac_uc_define 1
+EOF
+
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+
+
+
+
+
+ac_safe_struct=`echo "ifnet" | sed 'y%./+-%__p_%'`
+ac_safe_member=`echo "if_iqdrops" | 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 $ac_n "checking for ifnet.if_iqdrops""... $ac_c" 1>&6
+echo "configure:14784: checking for ifnet.if_iqdrops" >&5
+if eval "test \"`echo '$''{'$ac_safe_all'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+if test "x" = "x"; then
+  defineit="= 0"
+elif test "x" = "xno"; then
+  defineit=""
+else
+  defineit=""
+fi
+cat > conftest.$ac_ext <<EOF
+#line 14797 "configure"
+#include "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_iqdrops $defineit;
+
+; return 0; }
+EOF
+if { (eval echo configure:14857: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  eval "${ac_safe_all}=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "${ac_safe_all}=no" 
+fi
+rm -f conftest*
+
+fi
+
+
+if eval "test \"x$`echo ${ac_safe_all}`\" = \"xyes\""; then
+  echo "$ac_t""yes" 1>&6
+  cat >> confdefs.h <<EOF
+#define $ac_uc_define 1
+EOF
+
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+
+
+
+
+
+ac_safe_struct=`echo "ifnet" | sed 'y%./+-%__p_%'`
+ac_safe_member=`echo "if_noproto" | 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 $ac_n "checking for ifnet.if_noproto""... $ac_c" 1>&6
+echo "configure:14892: checking for ifnet.if_noproto" >&5
+if eval "test \"`echo '$''{'$ac_safe_all'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+if test "x" = "x"; then
+  defineit="= 0"
+elif test "x" = "xno"; then
+  defineit=""
+else
+  defineit=""
+fi
+cat > conftest.$ac_ext <<EOF
+#line 14905 "configure"
+#include "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_noproto $defineit;
+
+; return 0; }
+EOF
+if { (eval echo configure:14965: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  eval "${ac_safe_all}=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "${ac_safe_all}=no" 
+fi
+rm -f conftest*
+
+fi
+
+
+if eval "test \"x$`echo ${ac_safe_all}`\" = \"xyes\""; then
+  echo "$ac_t""yes" 1>&6
+  cat >> confdefs.h <<EOF
+#define $ac_uc_define 1
+EOF
+
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+
+
+
+
+
+ac_safe_struct=`echo "ifnet" | sed 'y%./+-%__p_%'`
+ac_safe_member=`echo "if_omcasts" | 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 $ac_n "checking for ifnet.if_omcasts""... $ac_c" 1>&6
+echo "configure:15000: checking for ifnet.if_omcasts" >&5
+if eval "test \"`echo '$''{'$ac_safe_all'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+if test "x" = "x"; then
+  defineit="= 0"
+elif test "x" = "xno"; then
+  defineit=""
+else
+  defineit=""
+fi
+cat > conftest.$ac_ext <<EOF
+#line 15013 "configure"
+#include "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_omcasts $defineit;
+
+; return 0; }
+EOF
+if { (eval echo configure:15073: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  eval "${ac_safe_all}=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "${ac_safe_all}=no" 
+fi
+rm -f conftest*
+
+fi
+
+
+if eval "test \"x$`echo ${ac_safe_all}`\" = \"xyes\""; then
+  echo "$ac_t""yes" 1>&6
+  cat >> confdefs.h <<EOF
+#define $ac_uc_define 1
+EOF
+
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+
+
+
+
+
+ac_safe_struct=`echo "ifnet" | sed 'y%./+-%__p_%'`
+ac_safe_member=`echo "if_xname" | 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 $ac_n "checking for ifnet.if_xname""... $ac_c" 1>&6
+echo "configure:15108: checking for ifnet.if_xname" >&5
+if eval "test \"`echo '$''{'$ac_safe_all'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+if test "xno" = "x"; then
+  defineit="= 0"
+elif test "xno" = "xno"; then
+  defineit=""
+else
+  defineit="no"
+fi
+cat > conftest.$ac_ext <<EOF
+#line 15121 "configure"
+#include "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_xname $defineit;
+
+; return 0; }
+EOF
+if { (eval echo configure:15181: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  eval "${ac_safe_all}=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "${ac_safe_all}=no" 
+fi
+rm -f conftest*
+
+fi
+
+
+if eval "test \"x$`echo ${ac_safe_all}`\" = \"xyes\""; then
+  echo "$ac_t""yes" 1>&6
+  cat >> confdefs.h <<EOF
+#define $ac_uc_define 1
+EOF
+
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+
+
+
+
+
+ac_safe_struct=`echo "ifnet" | sed 'y%./+-%__p_%'`
+ac_safe_member=`echo "if_lastchange.tv_sec" | 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 $ac_n "checking for ifnet.if_lastchange.tv_sec""... $ac_c" 1>&6
+echo "configure:15216: checking for ifnet.if_lastchange.tv_sec" >&5
+if eval "test \"`echo '$''{'$ac_safe_all'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+if test "x" = "x"; then
+  defineit="= 0"
+elif test "x" = "xno"; then
+  defineit=""
+else
+  defineit=""
+fi
+cat > conftest.$ac_ext <<EOF
+#line 15229 "configure"
+#include "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_sec $defineit;
+
+; return 0; }
+EOF
+if { (eval echo configure:15289: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  eval "${ac_safe_all}=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "${ac_safe_all}=no" 
+fi
+rm -f conftest*
+
+fi
+
+
+if eval "test \"x$`echo ${ac_safe_all}`\" = \"xyes\""; then
+  echo "$ac_t""yes" 1>&6
+  cat >> confdefs.h <<EOF
+#define $ac_uc_define 1
+EOF
+
+else
+  echo "$ac_t""no" 1>&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___%'`
+
+echo $ac_n "checking for ifnet.if_obytes""... $ac_c" 1>&6
+echo "configure:15324: checking for ifnet.if_obytes" >&5
+if eval "test \"`echo '$''{'$ac_safe_all'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+if test "x" = "x"; then
+  defineit="= 0"
+elif test "x" = "xno"; then
+  defineit=""
+else
+  defineit=""
+fi
+cat > conftest.$ac_ext <<EOF
+#line 15337 "configure"
+#include "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_obytes $defineit;
+
+; return 0; }
+EOF
+if { (eval echo configure:15397: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  eval "${ac_safe_all}=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "${ac_safe_all}=no" 
+fi
+rm -f conftest*
+
+fi
+
+
+if eval "test \"x$`echo ${ac_safe_all}`\" = \"xyes\""; then
+  echo "$ac_t""yes" 1>&6
+  cat >> confdefs.h <<EOF
+#define $ac_uc_define 1
+EOF
+
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+
+
+
+
+
+ac_safe_struct=`echo "ifnet" | sed 'y%./+-%__p_%'`
+ac_safe_member=`echo "if_ibytes" | 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 $ac_n "checking for ifnet.if_ibytes""... $ac_c" 1>&6
+echo "configure:15432: checking for ifnet.if_ibytes" >&5
+if eval "test \"`echo '$''{'$ac_safe_all'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+if test "x" = "x"; then
+  defineit="= 0"
+elif test "x" = "xno"; then
+  defineit=""
+else
+  defineit=""
+fi
+cat > conftest.$ac_ext <<EOF
+#line 15445 "configure"
+#include "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_ibytes $defineit;
+
+; return 0; }
+EOF
+if { (eval echo configure:15505: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  eval "${ac_safe_all}=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "${ac_safe_all}=no" 
+fi
+rm -f conftest*
+
+fi
+
+
+if eval "test \"x$`echo ${ac_safe_all}`\" = \"xyes\""; then
+  echo "$ac_t""yes" 1>&6
+  cat >> confdefs.h <<EOF
+#define $ac_uc_define 1
+EOF
+
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+
+
+
+
+
+ac_safe_struct=`echo "ifnet" | sed 'y%./+-%__p_%'`
+ac_safe_member=`echo "if_addrlist" | 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 $ac_n "checking for ifnet.if_addrlist""... $ac_c" 1>&6
+echo "configure:15540: checking for ifnet.if_addrlist" >&5
+if eval "test \"`echo '$''{'$ac_safe_all'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+if test "x" = "x"; then
+  defineit="= 0"
+elif test "x" = "xno"; then
+  defineit=""
+else
+  defineit=""
+fi
+cat > conftest.$ac_ext <<EOF
+#line 15553 "configure"
+#include "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_addrlist $defineit;
+
+; return 0; }
+EOF
+if { (eval echo configure:15613: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  eval "${ac_safe_all}=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "${ac_safe_all}=no" 
+fi
+rm -f conftest*
+
+fi
+
+
+if eval "test \"x$`echo ${ac_safe_all}`\" = \"xyes\""; then
+  echo "$ac_t""yes" 1>&6
+  cat >> confdefs.h <<EOF
+#define $ac_uc_define 1
+EOF
+
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+
+
+
+
+
+ac_safe_struct=`echo "ifnet" | sed 'y%./+-%__p_%'`
+ac_safe_member=`echo "if_addrhead.tqh_first" | 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 $ac_n "checking for ifnet.if_addrhead.tqh_first""... $ac_c" 1>&6
+echo "configure:15648: checking for ifnet.if_addrhead.tqh_first" >&5
+if eval "test \"`echo '$''{'$ac_safe_all'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+if test "x" = "x"; then
+  defineit="= 0"
+elif test "x" = "xno"; then
+  defineit=""
+else
+  defineit=""
+fi
+cat > conftest.$ac_ext <<EOF
+#line 15661 "configure"
+#include "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_addrhead.tqh_first $defineit;
+
+; return 0; }
+EOF
+if { (eval echo configure:15721: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  eval "${ac_safe_all}=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "${ac_safe_all}=no" 
+fi
+rm -f conftest*
+
+fi
+
+
+if eval "test \"x$`echo ${ac_safe_all}`\" = \"xyes\""; then
+  echo "$ac_t""yes" 1>&6
+  cat >> confdefs.h <<EOF
+#define $ac_uc_define 1
+EOF
+
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+
+
+
+
+
+ac_safe_struct=`echo "udpstat" | sed 'y%./+-%__p_%'`
+ac_safe_member=`echo "udps_discard" | 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 $ac_n "checking for udpstat.udps_discard""... $ac_c" 1>&6
+echo "configure:15756: checking for udpstat.udps_discard" >&5
+if eval "test \"`echo '$''{'$ac_safe_all'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+if test "x" = "x"; then
+  defineit="= 0"
+elif test "x" = "xno"; then
+  defineit=""
+else
+  defineit=""
+fi
+cat > conftest.$ac_ext <<EOF
+#line 15769 "configure"
+#include "confdefs.h"
+
+
+#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
+#if HAVE_NETINET_UDP_H
+#include <netinet/udp.h>
+#endif
+#if HAVE_NETINET_UDP_VAR_H
+#include <netinet/udp_var.h>
+#endif
+
+
+int main() {
+
+struct udpstat testit; 
+testit.udps_discard $defineit;
+
+; return 0; }
+EOF
+if { (eval echo configure:15795: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  eval "${ac_safe_all}=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "${ac_safe_all}=no" 
+fi
+rm -f conftest*
+
+fi
+
+
+if eval "test \"x$`echo ${ac_safe_all}`\" = \"xyes\""; then
+  echo "$ac_t""yes" 1>&6
+  cat >> confdefs.h <<EOF
+#define $ac_uc_define 1
+EOF
+
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+
+
+
+
+ac_safe_struct=`echo "udpstat" | sed 'y%./+-%__p_%'`
+ac_safe_member=`echo "udps_noport" | 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 $ac_n "checking for udpstat.udps_noport""... $ac_c" 1>&6
+echo "configure:15829: checking for udpstat.udps_noport" >&5
+if eval "test \"`echo '$''{'$ac_safe_all'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+if test "x" = "x"; then
+  defineit="= 0"
+elif test "x" = "xno"; then
+  defineit=""
+else
+  defineit=""
+fi
+cat > conftest.$ac_ext <<EOF
+#line 15842 "configure"
+#include "confdefs.h"
+
+
+#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
+#if HAVE_NETINET_UDP_H
+#include <netinet/udp.h>
+#endif
+#if HAVE_NETINET_UDP_VAR_H
+#include <netinet/udp_var.h>
+#endif
+
+
+int main() {
+
+struct udpstat testit; 
+testit.udps_noport $defineit;
+
+; return 0; }
+EOF
+if { (eval echo configure:15868: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  eval "${ac_safe_all}=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "${ac_safe_all}=no" 
+fi
+rm -f conftest*
+
+fi
+
+
+if eval "test \"x$`echo ${ac_safe_all}`\" = \"xyes\""; then
+  echo "$ac_t""yes" 1>&6
+  cat >> confdefs.h <<EOF
+#define $ac_uc_define 1
+EOF
+
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+
+
+
+
+ac_safe_struct=`echo "udpstat" | sed 'y%./+-%__p_%'`
+ac_safe_member=`echo "udps_noportbcast" | 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 $ac_n "checking for udpstat.udps_noportbcast""... $ac_c" 1>&6
+echo "configure:15902: checking for udpstat.udps_noportbcast" >&5
+if eval "test \"`echo '$''{'$ac_safe_all'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+if test "x" = "x"; then
+  defineit="= 0"
+elif test "x" = "xno"; then
+  defineit=""
+else
+  defineit=""
+fi
+cat > conftest.$ac_ext <<EOF
+#line 15915 "configure"
+#include "confdefs.h"
+
+
+#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
+#if HAVE_NETINET_UDP_H
+#include <netinet/udp.h>
+#endif
+#if HAVE_NETINET_UDP_VAR_H
+#include <netinet/udp_var.h>
+#endif
+
+
+int main() {
+
+struct udpstat testit; 
+testit.udps_noportbcast $defineit;
+
+; return 0; }
+EOF
+if { (eval echo configure:15941: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  eval "${ac_safe_all}=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "${ac_safe_all}=no" 
+fi
+rm -f conftest*
+
+fi
+
+
+if eval "test \"x$`echo ${ac_safe_all}`\" = \"xyes\""; then
+  echo "$ac_t""yes" 1>&6
+  cat >> confdefs.h <<EOF
+#define $ac_uc_define 1
+EOF
+
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+
+
+
+
+ac_safe_struct=`echo "udpstat" | sed 'y%./+-%__p_%'`
+ac_safe_member=`echo "udps_fullsock" | 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 $ac_n "checking for udpstat.udps_fullsock""... $ac_c" 1>&6
+echo "configure:15975: checking for udpstat.udps_fullsock" >&5
+if eval "test \"`echo '$''{'$ac_safe_all'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+if test "x" = "x"; then
+  defineit="= 0"
+elif test "x" = "xno"; then
+  defineit=""
+else
+  defineit=""
+fi
+cat > conftest.$ac_ext <<EOF
+#line 15988 "configure"
+#include "confdefs.h"
+
+
+#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
+#if HAVE_NETINET_UDP_H
+#include <netinet/udp.h>
+#endif
+#if HAVE_NETINET_UDP_VAR_H
+#include <netinet/udp_var.h>
+#endif
+
+
+int main() {
+
+struct udpstat testit; 
+testit.udps_fullsock $defineit;
+
+; return 0; }
+EOF
+if { (eval echo configure:16014: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  eval "${ac_safe_all}=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "${ac_safe_all}=no" 
+fi
+rm -f conftest*
+
+fi
+
+
+if eval "test \"x$`echo ${ac_safe_all}`\" = \"xyes\""; then
+  echo "$ac_t""yes" 1>&6
+  cat >> confdefs.h <<EOF
+#define $ac_uc_define 1
+EOF
+
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+
+
+
+
+ac_safe_struct=`echo "arphd" | sed 'y%./+-%__p_%'`
+ac_safe_member=`echo "at_next" | 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 $ac_n "checking for arphd.at_next""... $ac_c" 1>&6
+echo "configure:16048: checking for arphd.at_next" >&5
+if eval "test \"`echo '$''{'$ac_safe_all'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+if test "x" = "x"; then
+  defineit="= 0"
+elif test "x" = "xno"; then
+  defineit=""
+else
+  defineit=""
+fi
+cat > conftest.$ac_ext <<EOF
+#line 16061 "configure"
+#include "confdefs.h"
+
+
+#ifdef HAVE_SYS_PARAM_H
+#include <sys/param.h>
+#endif
+#include <sys/types.h>
+#include <sys/socket.h>
+#ifdef HAVE_SYS_TIME_H
+#include <sys/time.h>
+#endif
+#include <net/if.h>
+#if HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+#if HAVE_NETINET_IF_ETHER_H
+#include <netinet/if_ether.h>
+#endif
+
+
+int main() {
+
+struct arphd testit; 
+testit.at_next $defineit;
+
+; return 0; }
+EOF
+if { (eval echo configure:16089: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  eval "${ac_safe_all}=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "${ac_safe_all}=no" 
+fi
+rm -f conftest*
+
+fi
+
+
+if eval "test \"x$`echo ${ac_safe_all}`\" = \"xyes\""; then
+  echo "$ac_t""yes" 1>&6
+  cat >> confdefs.h <<EOF
+#define $ac_uc_define 1
+EOF
+
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+
+
+
+
+ac_safe_struct=`echo "swdevt" | sed 'y%./+-%__p_%'`
+ac_safe_member=`echo "sw_nblksenabled" | 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 $ac_n "checking for swdevt.sw_nblksenabled""... $ac_c" 1>&6
+echo "configure:16123: checking for swdevt.sw_nblksenabled" >&5
+if eval "test \"`echo '$''{'$ac_safe_all'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+if test "x" = "x"; then
+  defineit="= 0"
+elif test "x" = "xno"; then
+  defineit=""
+else
+  defineit=""
+fi
+cat > conftest.$ac_ext <<EOF
+#line 16136 "configure"
+#include "confdefs.h"
+
+
+#if HAVE_SYS_CONF_H
+#include <sys/conf.h>
+#endif
+
+
+int main() {
+
+struct swdevt testit; 
+testit.sw_nblksenabled $defineit;
+
+; return 0; }
+EOF
+if { (eval echo configure:16152: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  eval "${ac_safe_all}=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "${ac_safe_all}=no" 
+fi
+rm -f conftest*
+
+fi
+
+
+if eval "test \"x$`echo ${ac_safe_all}`\" = \"xyes\""; then
+  echo "$ac_t""yes" 1>&6
+  cat >> confdefs.h <<EOF
+#define $ac_uc_define 1
+EOF
+
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+
+
+
+ac_safe_struct=`echo "statfs" | sed 'y%./+-%__p_%'`
+ac_safe_member=`echo "f_files" | 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 $ac_n "checking for statfs.f_files""... $ac_c" 1>&6
+echo "configure:16324: checking for statfs.f_files" >&5
+if eval "test \"`echo '$''{'$ac_safe_all'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+if test "x" = "x"; then
+  defineit="= 0"
+elif test "x" = "xno"; then
+  defineit=""
+else
+  defineit=""
+fi
+cat > conftest.$ac_ext <<EOF
+#line 16337 "configure"
+#include "confdefs.h"
+
+
+#ifdef HAVE_SYS_STAT_H
+#include <sys/stat.h>
+#endif
+#if HAVE_SYS_STATFS_H
+#include <sys/statfs.h>
+#endif
+#ifdef HAVE_SYS_PARAM_H
+#include <sys/param.h>
+#include <sys/types.h>
+#endif
+#ifdef HAVE_SYS_MOUNT_H
+#include <sys/mount.h>
+#endif
+
+
+int main() {
+
+struct statfs testit; 
+testit.f_files $defineit;
+
+; return 0; }
+EOF
+if { (eval echo configure:16363: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  eval "${ac_safe_all}=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "${ac_safe_all}=no" 
+fi
+rm -f conftest*
+
+fi
+
+
+if eval "test \"x$`echo ${ac_safe_all}`\" = \"xyes\""; then
+  echo "$ac_t""yes" 1>&6
+  cat >> confdefs.h <<EOF
+#define $ac_uc_define 1
+EOF
+
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+
+
+
+
+ac_safe_struct=`echo "statfs" | sed 'y%./+-%__p_%'`
+ac_safe_member=`echo "f_ffree" | 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 $ac_n "checking for statfs.f_ffree""... $ac_c" 1>&6
+echo "configure:16397: checking for statfs.f_ffree" >&5
+if eval "test \"`echo '$''{'$ac_safe_all'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+if test "x" = "x"; then
+  defineit="= 0"
+elif test "x" = "xno"; then
+  defineit=""
+else
+  defineit=""
+fi
+cat > conftest.$ac_ext <<EOF
+#line 16410 "configure"
+#include "confdefs.h"
+
+
+#ifdef HAVE_SYS_STAT_H
+#include <sys/stat.h>
+#endif
+#if HAVE_SYS_STATFS_H
+#include <sys/statfs.h>
+#endif
+#ifdef HAVE_SYS_PARAM_H
+#include <sys/param.h>
+#include <sys/types.h>
+#endif
+#ifdef HAVE_SYS_MOUNT_H
+#include <sys/mount.h>
+#endif
+
+
+int main() {
+
+struct statfs testit; 
+testit.f_ffree $defineit;
+
+; return 0; }
+EOF
+if { (eval echo configure:16436: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  eval "${ac_safe_all}=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "${ac_safe_all}=no" 
+fi
+rm -f conftest*
+
+fi
+
+
+if eval "test \"x$`echo ${ac_safe_all}`\" = \"xyes\""; then
+  echo "$ac_t""yes" 1>&6
+  cat >> confdefs.h <<EOF
+#define $ac_uc_define 1
+EOF
+
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+
+
+
+
+ac_safe_struct=`echo "statfs" | sed 'y%./+-%__p_%'`
+ac_safe_member=`echo "f_favail" | 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 $ac_n "checking for statfs.f_favail""... $ac_c" 1>&6
+echo "configure:16470: checking for statfs.f_favail" >&5
+if eval "test \"`echo '$''{'$ac_safe_all'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+if test "x" = "x"; then
+  defineit="= 0"
+elif test "x" = "xno"; then
+  defineit=""
+else
+  defineit=""
+fi
+cat > conftest.$ac_ext <<EOF
+#line 16483 "configure"
+#include "confdefs.h"
+
+
+#ifdef HAVE_SYS_STAT_H
+#include <sys/stat.h>
+#endif
+#if HAVE_SYS_STATFS_H
+#include <sys/statfs.h>
+#endif
+#ifdef HAVE_SYS_PARAM_H
+#include <sys/param.h>
+#include <sys/types.h>
+#endif
+#ifdef HAVE_SYS_MOUNT_H
+#include <sys/mount.h>
+#endif
+
+
+int main() {
+
+struct statfs testit; 
+testit.f_favail $defineit;
+
+; return 0; }
+EOF
+if { (eval echo configure:16509: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  eval "${ac_safe_all}=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "${ac_safe_all}=no" 
+fi
+rm -f conftest*
+
+fi
+
+
+if eval "test \"x$`echo ${ac_safe_all}`\" = \"xyes\""; then
+  echo "$ac_t""yes" 1>&6
+  cat >> confdefs.h <<EOF
+#define $ac_uc_define 1
+EOF
+
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+
+
+
+
+ac_safe_struct=`echo "nlist" | sed 'y%./+-%__p_%'`
+ac_safe_member=`echo "n_value" | 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 $ac_n "checking for nlist.n_value""... $ac_c" 1>&6
+echo "configure:16543: checking for nlist.n_value" >&5
+if eval "test \"`echo '$''{'$ac_safe_all'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+if test "x" = "x"; then
+  defineit="= 0"
+elif test "x" = "xno"; then
+  defineit=""
+else
+  defineit=""
+fi
+cat > conftest.$ac_ext <<EOF
+#line 16556 "configure"
+#include "confdefs.h"
+
+
+#if HAVE_NLIST_H
+#include <nlist.h>
+#endif
+
+
+int main() {
+
+struct nlist testit; 
+testit.n_value $defineit;
+
+; return 0; }
+EOF
+if { (eval echo configure:16572: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  eval "${ac_safe_all}=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "${ac_safe_all}=no" 
+fi
+rm -f conftest*
+
+fi
+
+
+if eval "test \"x$`echo ${ac_safe_all}`\" = \"xyes\""; then
+  echo "$ac_t""yes" 1>&6
+  cat >> confdefs.h <<EOF
+#define $ac_uc_define 1
+EOF
+
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+
+
+
+
+ac_safe_struct=`echo "ipstat" | sed 'y%./+-%__p_%'`
+ac_safe_member=`echo "ips_cantforward" | 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 $ac_n "checking for ipstat.ips_cantforward""... $ac_c" 1>&6
+echo "configure:16606: checking for ipstat.ips_cantforward" >&5
+if eval "test \"`echo '$''{'$ac_safe_all'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+if test "x" = "x"; then
+  defineit="= 0"
+elif test "x" = "xno"; then
+  defineit=""
+else
+  defineit=""
+fi
+cat > conftest.$ac_ext <<EOF
+#line 16619 "configure"
+#include "confdefs.h"
+
+
+#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
+
+
+int main() {
+
+struct ipstat testit; 
+testit.ips_cantforward $defineit;
+
+; return 0; }
+EOF
+if { (eval echo configure:16639: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  eval "${ac_safe_all}=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "${ac_safe_all}=no" 
+fi
+rm -f conftest*
+
+fi
+
+
+if eval "test \"x$`echo ${ac_safe_all}`\" = \"xyes\""; then
+  echo "$ac_t""yes" 1>&6
+  cat >> confdefs.h <<EOF
+#define $ac_uc_define 1
+EOF
+
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+
+
+
+
+ac_safe_struct=`echo "ipstat" | sed 'y%./+-%__p_%'`
+ac_safe_member=`echo "ips_cantfrag" | 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 $ac_n "checking for ipstat.ips_cantfrag""... $ac_c" 1>&6
+echo "configure:16673: checking for ipstat.ips_cantfrag" >&5
+if eval "test \"`echo '$''{'$ac_safe_all'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+if test "x" = "x"; then
+  defineit="= 0"
+elif test "x" = "xno"; then
+  defineit=""
+else
+  defineit=""
+fi
+cat > conftest.$ac_ext <<EOF
+#line 16686 "configure"
+#include "confdefs.h"
+
+
+#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
+
+
+int main() {
+
+struct ipstat testit; 
+testit.ips_cantfrag $defineit;
+
+; return 0; }
+EOF
+if { (eval echo configure:16706: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  eval "${ac_safe_all}=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "${ac_safe_all}=no" 
+fi
+rm -f conftest*
+
+fi
+
+
+if eval "test \"x$`echo ${ac_safe_all}`\" = \"xyes\""; then
+  echo "$ac_t""yes" 1>&6
+  cat >> confdefs.h <<EOF
+#define $ac_uc_define 1
+EOF
+
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+
+
+
+
+ac_safe_struct=`echo "ipstat" | sed 'y%./+-%__p_%'`
+ac_safe_member=`echo "ips_delivered" | 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 $ac_n "checking for ipstat.ips_delivered""... $ac_c" 1>&6
+echo "configure:16740: checking for ipstat.ips_delivered" >&5
+if eval "test \"`echo '$''{'$ac_safe_all'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+if test "x" = "x"; then
+  defineit="= 0"
+elif test "x" = "xno"; then
+  defineit=""
+else
+  defineit=""
+fi
+cat > conftest.$ac_ext <<EOF
+#line 16753 "configure"
+#include "confdefs.h"
+
+
+#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
+
+
+int main() {
+
+struct ipstat testit; 
+testit.ips_delivered $defineit;
+
+; return 0; }
+EOF
+if { (eval echo configure:16773: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  eval "${ac_safe_all}=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "${ac_safe_all}=no" 
+fi
+rm -f conftest*
+
+fi
+
+
+if eval "test \"x$`echo ${ac_safe_all}`\" = \"xyes\""; then
+  echo "$ac_t""yes" 1>&6
+  cat >> confdefs.h <<EOF
+#define $ac_uc_define 1
+EOF
+
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+
+
+
+
+ac_safe_struct=`echo "ipstat" | sed 'y%./+-%__p_%'`
+ac_safe_member=`echo "ips_fragdropped" | 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 $ac_n "checking for ipstat.ips_fragdropped""... $ac_c" 1>&6
+echo "configure:16807: checking for ipstat.ips_fragdropped" >&5
+if eval "test \"`echo '$''{'$ac_safe_all'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+if test "x" = "x"; then
+  defineit="= 0"
+elif test "x" = "xno"; then
+  defineit=""
+else
+  defineit=""
+fi
+cat > conftest.$ac_ext <<EOF
+#line 16820 "configure"
+#include "confdefs.h"
+
+
+#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
+
+
+int main() {
+
+struct ipstat testit; 
+testit.ips_fragdropped $defineit;
+
+; return 0; }
+EOF
+if { (eval echo configure:16840: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  eval "${ac_safe_all}=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "${ac_safe_all}=no" 
+fi
+rm -f conftest*
+
+fi
+
+
+if eval "test \"x$`echo ${ac_safe_all}`\" = \"xyes\""; then
+  echo "$ac_t""yes" 1>&6
+  cat >> confdefs.h <<EOF
+#define $ac_uc_define 1
+EOF
+
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+
+
+
+
+ac_safe_struct=`echo "ipstat" | sed 'y%./+-%__p_%'`
+ac_safe_member=`echo "ips_fragtimeout" | 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 $ac_n "checking for ipstat.ips_fragtimeout""... $ac_c" 1>&6
+echo "configure:16874: checking for ipstat.ips_fragtimeout" >&5
+if eval "test \"`echo '$''{'$ac_safe_all'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+if test "x" = "x"; then
+  defineit="= 0"
+elif test "x" = "xno"; then
+  defineit=""
+else
+  defineit=""
+fi
+cat > conftest.$ac_ext <<EOF
+#line 16887 "configure"
+#include "confdefs.h"
+
+
+#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
+
+
+int main() {
+
+struct ipstat testit; 
+testit.ips_fragtimeout $defineit;
+
+; return 0; }
+EOF
+if { (eval echo configure:16907: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  eval "${ac_safe_all}=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "${ac_safe_all}=no" 
+fi
+rm -f conftest*
+
+fi
+
+
+if eval "test \"x$`echo ${ac_safe_all}`\" = \"xyes\""; then
+  echo "$ac_t""yes" 1>&6
+  cat >> confdefs.h <<EOF
+#define $ac_uc_define 1
+EOF
+
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+
+
+
+
+ac_safe_struct=`echo "ipstat" | sed 'y%./+-%__p_%'`
+ac_safe_member=`echo "ips_localout" | 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 $ac_n "checking for ipstat.ips_localout""... $ac_c" 1>&6
+echo "configure:16941: checking for ipstat.ips_localout" >&5
+if eval "test \"`echo '$''{'$ac_safe_all'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+if test "x" = "x"; then
+  defineit="= 0"
+elif test "x" = "xno"; then
+  defineit=""
+else
+  defineit=""
+fi
+cat > conftest.$ac_ext <<EOF
+#line 16954 "configure"
+#include "confdefs.h"
+
+
+#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
+
+
+int main() {
+
+struct ipstat testit; 
+testit.ips_localout $defineit;
+
+; return 0; }
+EOF
+if { (eval echo configure:16974: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  eval "${ac_safe_all}=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "${ac_safe_all}=no" 
+fi
+rm -f conftest*
+
+fi
+
+
+if eval "test \"x$`echo ${ac_safe_all}`\" = \"xyes\""; then
+  echo "$ac_t""yes" 1>&6
+  cat >> confdefs.h <<EOF
+#define $ac_uc_define 1
+EOF
+
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+
+
+
+
+ac_safe_struct=`echo "ipstat" | sed 'y%./+-%__p_%'`
+ac_safe_member=`echo "ips_noproto" | 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 $ac_n "checking for ipstat.ips_noproto""... $ac_c" 1>&6
+echo "configure:17008: checking for ipstat.ips_noproto" >&5
+if eval "test \"`echo '$''{'$ac_safe_all'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+if test "x" = "x"; then
+  defineit="= 0"
+elif test "x" = "xno"; then
+  defineit=""
+else
+  defineit=""
+fi
+cat > conftest.$ac_ext <<EOF
+#line 17021 "configure"
+#include "confdefs.h"
+
+
+#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
+
+
+int main() {
+
+struct ipstat testit; 
+testit.ips_noproto $defineit;
+
+; return 0; }
+EOF
+if { (eval echo configure:17041: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  eval "${ac_safe_all}=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "${ac_safe_all}=no" 
+fi
+rm -f conftest*
+
+fi
+
+
+if eval "test \"x$`echo ${ac_safe_all}`\" = \"xyes\""; then
+  echo "$ac_t""yes" 1>&6
+  cat >> confdefs.h <<EOF
+#define $ac_uc_define 1
+EOF
+
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+
+
+
+
+ac_safe_struct=`echo "ipstat" | sed 'y%./+-%__p_%'`
+ac_safe_member=`echo "ips_noroute" | 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 $ac_n "checking for ipstat.ips_noroute""... $ac_c" 1>&6
+echo "configure:17075: checking for ipstat.ips_noroute" >&5
+if eval "test \"`echo '$''{'$ac_safe_all'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+if test "x" = "x"; then
+  defineit="= 0"
+elif test "x" = "xno"; then
+  defineit=""
+else
+  defineit=""
+fi
+cat > conftest.$ac_ext <<EOF
+#line 17088 "configure"
+#include "confdefs.h"
+
+
+#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
+
+
+int main() {
+
+struct ipstat testit; 
+testit.ips_noroute $defineit;
+
+; return 0; }
+EOF
+if { (eval echo configure:17108: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  eval "${ac_safe_all}=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "${ac_safe_all}=no" 
+fi
+rm -f conftest*
+
+fi
+
+
+if eval "test \"x$`echo ${ac_safe_all}`\" = \"xyes\""; then
+  echo "$ac_t""yes" 1>&6
+  cat >> confdefs.h <<EOF
+#define $ac_uc_define 1
+EOF
+
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+
+
+
+
+ac_safe_struct=`echo "ipstat" | sed 'y%./+-%__p_%'`
+ac_safe_member=`echo "ips_odropped" | 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 $ac_n "checking for ipstat.ips_odropped""... $ac_c" 1>&6
+echo "configure:17142: checking for ipstat.ips_odropped" >&5
+if eval "test \"`echo '$''{'$ac_safe_all'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+if test "x" = "x"; then
+  defineit="= 0"
+elif test "x" = "xno"; then
+  defineit=""
+else
+  defineit=""
+fi
+cat > conftest.$ac_ext <<EOF
+#line 17155 "configure"
+#include "confdefs.h"
+
+
+#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
+
+
+int main() {
+
+struct ipstat testit; 
+testit.ips_odropped $defineit;
+
+; return 0; }
+EOF
+if { (eval echo configure:17175: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  eval "${ac_safe_all}=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "${ac_safe_all}=no" 
+fi
+rm -f conftest*
+
+fi
+
+
+if eval "test \"x$`echo ${ac_safe_all}`\" = \"xyes\""; then
+  echo "$ac_t""yes" 1>&6
+  cat >> confdefs.h <<EOF
+#define $ac_uc_define 1
+EOF
+
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+
+
+
+
+ac_safe_struct=`echo "ipstat" | sed 'y%./+-%__p_%'`
+ac_safe_member=`echo "ips_ofragments" | 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 $ac_n "checking for ipstat.ips_ofragments""... $ac_c" 1>&6
+echo "configure:17209: checking for ipstat.ips_ofragments" >&5
+if eval "test \"`echo '$''{'$ac_safe_all'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+if test "x" = "x"; then
+  defineit="= 0"
+elif test "x" = "xno"; then
+  defineit=""
+else
+  defineit=""
+fi
+cat > conftest.$ac_ext <<EOF
+#line 17222 "configure"
+#include "confdefs.h"
+
+
+#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
+
+
+int main() {
+
+struct ipstat testit; 
+testit.ips_ofragments $defineit;
+
+; return 0; }
+EOF
+if { (eval echo configure:17242: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  eval "${ac_safe_all}=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "${ac_safe_all}=no" 
+fi
+rm -f conftest*
+
+fi
+
+
+if eval "test \"x$`echo ${ac_safe_all}`\" = \"xyes\""; then
+  echo "$ac_t""yes" 1>&6
+  cat >> confdefs.h <<EOF
+#define $ac_uc_define 1
+EOF
+
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+
+
+
+
+ac_safe_struct=`echo "ipstat" | sed 'y%./+-%__p_%'`
+ac_safe_member=`echo "ips_reassembled" | 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 $ac_n "checking for ipstat.ips_reassembled""... $ac_c" 1>&6
+echo "configure:17276: checking for ipstat.ips_reassembled" >&5
+if eval "test \"`echo '$''{'$ac_safe_all'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+if test "x" = "x"; then
+  defineit="= 0"
+elif test "x" = "xno"; then
+  defineit=""
+else
+  defineit=""
+fi
+cat > conftest.$ac_ext <<EOF
+#line 17289 "configure"
+#include "confdefs.h"
+
+
+#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
+
+
+int main() {
+
+struct ipstat testit; 
+testit.ips_reassembled $defineit;
+
+; return 0; }
+EOF
+if { (eval echo configure:17309: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  eval "${ac_safe_all}=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "${ac_safe_all}=no" 
+fi
+rm -f conftest*
+
+fi
+
+
+if eval "test \"x$`echo ${ac_safe_all}`\" = \"xyes\""; then
+  echo "$ac_t""yes" 1>&6
+  cat >> confdefs.h <<EOF
+#define $ac_uc_define 1
+EOF
+
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+
+
+if test "x$ac_cv_header_openssl_des_h" = "xyes" ; then
+
+
+ac_safe_struct=`echo "des_ks_struct" | sed 'y%./+-%__p_%'`
+ac_safe_member=`echo "weak_key" | 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 $ac_n "checking for des_ks_struct.weak_key""... $ac_c" 1>&6
+echo "configure:17344: checking for des_ks_struct.weak_key" >&5
+if eval "test \"`echo '$''{'$ac_safe_all'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+if test "x" = "x"; then
+  defineit="= 0"
+elif test "x" = "xno"; then
+  defineit=""
+else
+  defineit=""
+fi
+cat > conftest.$ac_ext <<EOF
+#line 17357 "configure"
+#include "confdefs.h"
+
+
+#include <openssl/des.h>
+
+
+int main() {
+
+struct des_ks_struct testit; 
+testit.weak_key $defineit;
+
+; return 0; }
+EOF
+if { (eval echo configure:17371: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  eval "${ac_safe_all}=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "${ac_safe_all}=no" 
+fi
+rm -f conftest*
+
+fi
+
+
+if eval "test \"x$`echo ${ac_safe_all}`\" = \"xyes\""; then
+  echo "$ac_t""yes" 1>&6
+  cat >> confdefs.h <<EOF
+#define $ac_uc_define 1
+EOF
+
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+
+fi
+
+
+if test $cross_compiling = yes; then
+  echo "configure: warning: Can't check sysctl, manually define CAN_USE_SYSCTL if platform support available" 1>&2
+else
+  echo $ac_n "checking if sysctl can read kernel information""... $ac_c" 1>&6
+echo "configure:17403: checking if sysctl can read kernel information" >&5
+if eval "test \"`echo '$''{'ac_cv_CAN_USE_SYSCTL'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  if test "$cross_compiling" = yes; then
+  ac_cv_CAN_USE_SYSCTL=no
+else
+  cat > conftest.$ac_ext <<EOF
+#line 17411 "configure"
+#include "confdefs.h"
+
+#if TIME_WITH_SYS_TIME
+# include <sys/time.h>
+# include <time.h>
+#else
+# if HAVE_SYS_TIME_H
+#  include <sys/time.h>
+# else
+#  include <time.h>
+# endif
+#endif
+#if HAVE_SYS_PARAM_H
+# include <sys/param.h>
+#endif
+#include <sys/types.h>
+#if HAVE_SYS_SYSCTL_H
+# include <sys/sysctl.h>
+#endif
+
+main() {
+  int                 mib[2];
+  size_t              len;
+  struct timeval boottime;
+  
+  mib[0] = CTL_KERN;
+  mib[1] = KERN_BOOTTIME;
+  
+  len = sizeof(boottime);
+  sysctl(mib, 2, &boottime, &len, NULL, NULL);
+  if (boottime.tv_sec != 0)
+    exit(0);
+  else
+    exit(1);
+}
+  
+EOF
+if { (eval echo configure:17449: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+then
+  ac_cv_CAN_USE_SYSCTL=yes
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -fr conftest*
+  ac_cv_CAN_USE_SYSCTL=no
+fi
+rm -fr conftest*
+fi
+
+fi
+
+echo "$ac_t""$ac_cv_CAN_USE_SYSCTL" 1>&6
+fi
+
+if test "x$ac_cv_CAN_USE_SYSCTL" = "xyes"; then
+  cat >> confdefs.h <<\EOF
+#define CAN_USE_SYSCTL 1
+EOF
+
+fi
+
+echo $ac_n "checking whether TCP timers depend on \`hz'""... $ac_c" 1>&6
+echo "configure:17474: checking whether TCP timers depend on \`hz'" >&5
+if eval "test \"`echo '$''{'ac_cv_TCPTV_NEEDS_HZ'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 17479 "configure"
+#include "confdefs.h"
+#include <netinet/tcp_timer.h>
+TCPTV_SRTTDFLT
+
+EOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  egrep "hz" >/dev/null 2>&1; then
+  rm -rf conftest*
+  ac_cv_TCPTV_NEEDS_HZ=yes
+else
+  rm -rf conftest*
+  ac_cv_TCPTV_NEEDS_HZ=no
+fi
+rm -f conftest*
+
+fi
+
+echo "$ac_t""$ac_cv_TCPTV_NEEDS_HZ" 1>&6
+
+if test "x$ac_cv_TCPTV_NEEDS_HZ" = "xyes"; then
+  cat >> confdefs.h <<\EOF
+#define TCPTV_NEEDS_HZ 1
+EOF
+
+fi
+
+
+
+
+
+
+if test "x$ac_cv_user_prompt_LOGFILE" = "x" -o "x$ac_cv_user_prompt_SYS_LOC" = "x" -o "x$ac_cv_user_prompt_SYS_CONTACT" = "x" -o "x$ac_cv_user_prompt_DEFAULT_SNMP_VERSION" = "x"; then
+echo $ac_n "checking if you have run configure before""... $ac_c" 1>&6
+echo "configure:17513: checking if you have run configure before" >&5
+if eval "test \"`echo '$''{'ac_cv_have_warned'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+if test "x$defaults" = "xno"; then
+cat << EOF
+
+	 ************** Configuration Section **************
+
+	You are about to be prompted with a series of questions.  Answer
+them carefully, as they determine how the SNMP agent and related
+applications are to function.
+
+	After the configure script finishes, you can browse the newly
+created config.h file for further - less important - parameters to
+modify.  Be careful if you re-run configure though, since config.h will
+be overwritten.
+
+-Press return to continue-
+EOF
+
+read tmpinput
+ac_cv_have_warned="yes"
+echo $ac_n "disabling above prompt for future runs...  $ac_c"
+else
+  ac_cv_have_warned="no"
+fi
+
+fi
+
+echo "$ac_t""$ac_cv_have_warned" 1>&6
+else
+  ac_cv_have_warned="yes"
+fi
+
+ME=`$WHOAMI`
+if test -f /etc/resolv.conf; then
+  LOC=`cat /etc/resolv.conf | grep '^domain' | tail -1 | awk '{print $NF}'`
+else
+  LOC="@no.where"
+fi
+
+
+MSG_CHECK=`echo "
+
+*** Default SNMP Version:
+
+	Starting with Net-SNMP 5.0, you can choose the default version of
+the SNMP protocol to use when no version is given explicitly on the
+command line, or via an 'snmp.conf' file.  In the past this was set to
+SNMPv1, but you can use this to switch to SNMPv3 if desired.  SNMPv3
+will provide a more secure management environment (and thus you're
+encouraged to switch to SNMPv3), but may break existing scripts that
+rely on the old behaviour.  (Though such scripts will probably need to
+be changed to use the '-c' community flag anyway, as the SNMPv1
+command line usage has changed as well.).
+   At this prompt you can select \"1\", \"2\" (for SNMPv2c), or \"3\" as
+the default version for the command tools (snmpget, ...) to use.  This
+can always be overridden at runtime using the -v flag to the tools, or
+by using the \"defVersion\" token in your snmp.conf file.
+   Providing the --with-default-snmp-version=\"x\" parameter to ./configure
+will avoid this prompt.
+
+Default version of SNMP to use" | tail -1`
+echo $ac_n "checking $MSG_CHECK""... $ac_c" 1>&6
+echo "configure:17579: checking $MSG_CHECK" >&5
+if eval "test \"`echo '$''{'ac_cv_user_prompt_DEFAULT_SNMP_VERSION'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  echo "" >&6
+
+if test "x$defaults" = "xno"; then
+echo $ac_n "
+
+*** Default SNMP Version:
+
+	Starting with Net-SNMP 5.0, you can choose the default version of
+the SNMP protocol to use when no version is given explicitly on the
+command line, or via an 'snmp.conf' file.  In the past this was set to
+SNMPv1, but you can use this to switch to SNMPv3 if desired.  SNMPv3
+will provide a more secure management environment (and thus you're
+encouraged to switch to SNMPv3), but may break existing scripts that
+rely on the old behaviour.  (Though such scripts will probably need to
+be changed to use the '-c' community flag anyway, as the SNMPv1
+command line usage has changed as well.).
+   At this prompt you can select \"1\", \"2\" (for SNMPv2c), or \"3\" as
+the default version for the command tools (snmpget, ...) to use.  This
+can always be overridden at runtime using the -v flag to the tools, or
+by using the \"defVersion\" token in your snmp.conf file.
+   Providing the --with-default-snmp-version=\"x\" parameter to ./configure
+will avoid this prompt.
+
+Default version of SNMP to use (3): $ac_c"
+read tmpinput
+if test "$tmpinput" = "" -a "3" != ""; then
+  tmpinput="3"
+fi
+eval DEFAULT_SNMP_VERSION=\"$tmpinput\"
+else
+tmpinput="3"
+eval DEFAULT_SNMP_VERSION=\"$tmpinput\"
+fi
+
+
+eval ac_cv_user_prompt_DEFAULT_SNMP_VERSION=\$DEFAULT_SNMP_VERSION
+echo $ac_n "setting $MSG_CHECK to...  $ac_c" >&6
+
+fi
+
+echo "$ac_t""$ac_cv_user_prompt_DEFAULT_SNMP_VERSION" 1>&6
+if test "$ac_cv_user_prompt_DEFAULT_SNMP_VERSION" != "none"; then
+  if test "xunquoted" = "xquoted" -o "xunquoted" = "xQUOTED"; then
+    cat >> confdefs.h <<EOF
+#define DEFAULT_SNMP_VERSION "$ac_cv_user_prompt_DEFAULT_SNMP_VERSION"
+EOF
+
+  else
+    cat >> confdefs.h <<EOF
+#define DEFAULT_SNMP_VERSION $ac_cv_user_prompt_DEFAULT_SNMP_VERSION
+EOF
+
+  fi
+fi
+
+
+if test "$ac_cv_user_prompt_DEFAULT_SNMP_VERSION" != "1" -a "$ac_cv_user_prompt_DEFAULT_SNMP_VERSION" != "2" -a "$ac_cv_user_prompt_DEFAULT_SNMP_VERSION" != "3"; then
+  { echo "configure: error: Illegal version number.  Only 1, 2 (for SNMPv2c) and 3 are supported." 1>&2; exit 1; }
+fi
+
+
+MSG_CHECK=`echo "
+
+*** System Contact Information:
+
+	Describes who should be contacted about the host the agent is
+running on.  This information is available in the MIB-II tree.  This
+can also be over-ridden using the \"syscontact\" syntax in the agent's
+configuration files.
+  Providing the --with-sys-contact=\"contact\" parameter to ./configure
+will avoid this prompt.
+
+System Contact Information" | tail -1`
+echo $ac_n "checking $MSG_CHECK""... $ac_c" 1>&6
+echo "configure:17657: checking $MSG_CHECK" >&5
+if eval "test \"`echo '$''{'ac_cv_user_prompt_SYS_CONTACT'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  echo "" >&6
+
+if test "x$defaults" = "xno"; then
+echo $ac_n "
+
+*** System Contact Information:
+
+	Describes who should be contacted about the host the agent is
+running on.  This information is available in the MIB-II tree.  This
+can also be over-ridden using the \"syscontact\" syntax in the agent's
+configuration files.
+  Providing the --with-sys-contact=\"contact\" parameter to ./configure
+will avoid this prompt.
+
+System Contact Information ($ME@$LOC): $ac_c"
+read tmpinput
+if test "$tmpinput" = "" -a "$ME@$LOC" != ""; then
+  tmpinput="$ME@$LOC"
+fi
+eval SYS_CONTACT=\"$tmpinput\"
+else
+tmpinput="$ME@$LOC"
+eval SYS_CONTACT=\"$tmpinput\"
+fi
+
+
+eval ac_cv_user_prompt_SYS_CONTACT=\$SYS_CONTACT
+echo $ac_n "setting $MSG_CHECK to...  $ac_c" >&6
+
+fi
+
+echo "$ac_t""$ac_cv_user_prompt_SYS_CONTACT" 1>&6
+if test "$ac_cv_user_prompt_SYS_CONTACT" != "none"; then
+  if test "xquoted" = "xquoted" -o "xquoted" = "xQUOTED"; then
+    cat >> confdefs.h <<EOF
+#define SYS_CONTACT "$ac_cv_user_prompt_SYS_CONTACT"
+EOF
+
+  else
+    cat >> confdefs.h <<EOF
+#define SYS_CONTACT $ac_cv_user_prompt_SYS_CONTACT
+EOF
+
+  fi
+fi
+
+
+
+MSG_CHECK=`echo "
+
+*** System Location:
+
+	Describes the location of the system.  This information is
+available in the MIB-II tree.  this can also be over-ridden using the
+\"syslocation\" syntax in the agent's configuration files.
+  Providing the --with-sys-location=\"location\" parameter to ./configure
+will avoid this prompt.
+
+System Location" | tail -1`
+echo $ac_n "checking $MSG_CHECK""... $ac_c" 1>&6
+echo "configure:17721: checking $MSG_CHECK" >&5
+if eval "test \"`echo '$''{'ac_cv_user_prompt_SYS_LOC'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  echo "" >&6
+
+if test "x$defaults" = "xno"; then
+echo $ac_n "
+
+*** System Location:
+
+	Describes the location of the system.  This information is
+available in the MIB-II tree.  this can also be over-ridden using the
+\"syslocation\" syntax in the agent's configuration files.
+  Providing the --with-sys-location=\"location\" parameter to ./configure
+will avoid this prompt.
+
+System Location (Unknown): $ac_c"
+read tmpinput
+if test "$tmpinput" = "" -a "Unknown" != ""; then
+  tmpinput="Unknown"
+fi
+eval SYS_LOC=\"$tmpinput\"
+else
+tmpinput="Unknown"
+eval SYS_LOC=\"$tmpinput\"
+fi
+
+
+eval ac_cv_user_prompt_SYS_LOC=\$SYS_LOC
+echo $ac_n "setting $MSG_CHECK to...  $ac_c" >&6
+
+fi
+
+echo "$ac_t""$ac_cv_user_prompt_SYS_LOC" 1>&6
+if test "$ac_cv_user_prompt_SYS_LOC" != "none"; then
+  if test "xquoted" = "xquoted" -o "xquoted" = "xQUOTED"; then
+    cat >> confdefs.h <<EOF
+#define SYS_LOC "$ac_cv_user_prompt_SYS_LOC"
+EOF
+
+  else
+    cat >> confdefs.h <<EOF
+#define SYS_LOC $ac_cv_user_prompt_SYS_LOC
+EOF
+
+  fi
+fi
+
+
+if test -d /var/log; then
+  defaultlog="/var/log/snmpd.log"
+else
+  defaultlog="/usr/adm/snmpd.log"
+fi
+  
+
+MSG_CHECK=`echo "
+
+*** Logfile location:
+
+	Enter the default location for the snmpd agent to dump
+information & errors to.  If not defined (enter the keyword \"none\"
+at the prompt below) the agent will use stdout and stderr instead.
+(Note: This value can be over-ridden using command line options.)
+  Providing the --with-logfile=\"path\" parameter to ./configure
+will avoid this prompt.
+
+Location to write logfile" | tail -1`
+echo $ac_n "checking $MSG_CHECK""... $ac_c" 1>&6
+echo "configure:17791: checking $MSG_CHECK" >&5
+if eval "test \"`echo '$''{'ac_cv_user_prompt_LOGFILE'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  echo "" >&6
+
+if test "x$defaults" = "xno"; then
+echo $ac_n "
+
+*** Logfile location:
+
+	Enter the default location for the snmpd agent to dump
+information & errors to.  If not defined (enter the keyword \"none\"
+at the prompt below) the agent will use stdout and stderr instead.
+(Note: This value can be over-ridden using command line options.)
+  Providing the --with-logfile=\"path\" parameter to ./configure
+will avoid this prompt.
+
+Location to write logfile ($defaultlog): $ac_c"
+read tmpinput
+if test "$tmpinput" = "" -a "$defaultlog" != ""; then
+  tmpinput="$defaultlog"
+fi
+eval LOGFILE=\"$tmpinput\"
+else
+tmpinput="$defaultlog"
+eval LOGFILE=\"$tmpinput\"
+fi
+
+
+eval ac_cv_user_prompt_LOGFILE=\$LOGFILE
+echo $ac_n "setting $MSG_CHECK to...  $ac_c" >&6
+
+fi
+
+echo "$ac_t""$ac_cv_user_prompt_LOGFILE" 1>&6
+if test "$ac_cv_user_prompt_LOGFILE" != "none"; then
+  if test "xquoted" = "xquoted" -o "xquoted" = "xQUOTED"; then
+    cat >> confdefs.h <<EOF
+#define LOGFILE "$ac_cv_user_prompt_LOGFILE"
+EOF
+
+  else
+    cat >> confdefs.h <<EOF
+#define LOGFILE $ac_cv_user_prompt_LOGFILE
+EOF
+
+  fi
+fi
+
+
+if test -d /var; then
+  defaultstore="/var/net-snmp"
+  ucddefaultstore="/var/ucd-snmp"
+else
+  defaultstore="/etc/net-snmp"
+  ucddefaultstore="/etc/ucd-snmp"
+fi
+  
+
+MSG_CHECK=`echo "
+
+*** snmpd persistent storage location:
+
+	Enter a directory for the SNMP library to store persistent
+data in the form of a configuration file.  This default location is
+different than the old default location (which was for ucd-snmp).  If
+you stay with the new path, I'll ask you in a second if you wish to
+copy your files over to the new location (once only).  If you pick
+some other path than the default, you'll have to copy them yourself.
+There is nothing wrong with picking the old path ($ucddefaultstore) if
+you'd rather.
+  Providing the --with-persistent-directory=\"path\" parameter to
+./configure will avoid this prompt.
+
+Location to write persistent information" | tail -1`
+echo $ac_n "checking $MSG_CHECK""... $ac_c" 1>&6
+echo "configure:17868: checking $MSG_CHECK" >&5
+if eval "test \"`echo '$''{'ac_cv_user_prompt_PERSISTENT_DIRECTORY'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  echo "" >&6
+
+if test "x$defaults" = "xno"; then
+echo $ac_n "
+
+*** snmpd persistent storage location:
+
+	Enter a directory for the SNMP library to store persistent
+data in the form of a configuration file.  This default location is
+different than the old default location (which was for ucd-snmp).  If
+you stay with the new path, I'll ask you in a second if you wish to
+copy your files over to the new location (once only).  If you pick
+some other path than the default, you'll have to copy them yourself.
+There is nothing wrong with picking the old path ($ucddefaultstore) if
+you'd rather.
+  Providing the --with-persistent-directory=\"path\" parameter to
+./configure will avoid this prompt.
+
+Location to write persistent information ($defaultstore): $ac_c"
+read tmpinput
+if test "$tmpinput" = "" -a "$defaultstore" != ""; then
+  tmpinput="$defaultstore"
+fi
+eval PERSISTENT_DIRECTORY=\"$tmpinput\"
+else
+tmpinput="$defaultstore"
+eval PERSISTENT_DIRECTORY=\"$tmpinput\"
+fi
+
+
+eval ac_cv_user_prompt_PERSISTENT_DIRECTORY=\$PERSISTENT_DIRECTORY
+echo $ac_n "setting $MSG_CHECK to...  $ac_c" >&6
+
+fi
+
+echo "$ac_t""$ac_cv_user_prompt_PERSISTENT_DIRECTORY" 1>&6
+if test "$ac_cv_user_prompt_PERSISTENT_DIRECTORY" != "none"; then
+  if test "xquoted" = "xquoted" -o "xquoted" = "xQUOTED"; then
+    cat >> confdefs.h <<EOF
+#define PERSISTENT_DIRECTORY "$ac_cv_user_prompt_PERSISTENT_DIRECTORY"
+EOF
+
+  else
+    cat >> confdefs.h <<EOF
+#define PERSISTENT_DIRECTORY $ac_cv_user_prompt_PERSISTENT_DIRECTORY
+EOF
+
+  fi
+fi
+
+
+PERSISTENT_DIRECTORY=$ac_cv_user_prompt_PERSISTENT_DIRECTORY
+
+UCDPERSISTENT_DIRECTORY=$ucddefaultstore
+
+
+if test $PERSISTENT_DIRECTORY = "$defaultstore" -a -d "$ucddefaultstore" -a ! -d "$defaultstore" ; then
+echo $ac_n "checking If we should copy the old persistent directory""... $ac_c" 1>&6
+echo "configure:17930: checking If we should copy the old persistent directory" >&5
+if eval "test \"`echo '$''{'ac_cv_user_prompt_COPY_PERSISTENT_FILES'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+
+if test "x$defaults" = "xno"; then
+echo $ac_n "
+
+*** Copying old ucd-snmp persistent files to net-snmp persistent directory:
+
+	Would you like to copy the older ucd-snmp persistent files
+into your new net-snmp persistent file path?  This will functionally
+save all your ucd-snmp data and let it be used within the net-snmp
+tools.  This will only be done once when you run make install.  If you
+wish to do this, enter "yes" at the prompt.
+  Providing the --with-copy-persistent-files=\"no\" (or \"yes\")
+parameters to ./configure will avoid this prompt.
+
+Copy ucd-snmp data into the net-snmp data directory ("yes"): $ac_c"
+read tmpinput
+if test "$tmpinput" = "" -a ""yes"" != ""; then
+  tmpinput=""yes""
+fi
+eval ac_cv_user_prompt_COPY_PERSISTENT_FILES=\"$tmpinput\"
+else
+tmpinput=""yes""
+eval ac_cv_user_prompt_COPY_PERSISTENT_FILES=\"$tmpinput\"
+fi
+
+
+
+fi
+
+echo "$ac_t""$ac_cv_user_prompt_COPY_PERSISTENT_FILES" 1>&6
+else
+ac_cv_user_prompt_COPY_PERSISTENT_FILES="no"
+fi
+COPY_PERSISTENT_FILES="$ac_cv_user_prompt_COPY_PERSISTENT_FILES"
+
+
+
+
+trap '' 1 2 15
+cat > confcache <<\EOF
+# This file is a shell script that caches the results of configure
+# tests run on this system so they can be shared between configure
+# scripts and configure runs.  It is not useful on other systems.
+# If it contains results you don't want to keep, you may remove or edit it.
+#
+# By default, configure uses ./config.cache as the cache file,
+# creating it if it does not exist already.  You can give configure
+# the --cache-file=FILE option to use a different cache file; that is
+# what configure does when it calls configure scripts in
+# subdirectories, so they share the cache.
+# Giving --cache-file=/dev/null disables caching, for debugging configure.
+# config.status only pays attention to the cache file if you give it the
+# --recheck option to rerun configure.
+#
+EOF
+# The following way of writing the cache mishandles newlines in values,
+# but we know of no workaround that is simple, portable, and efficient.
+# So, don't put newlines in cache variables' values.
+# Ultrix sh set writes to stderr and can't be redirected directly,
+# and sets the high bit in the cache file unless we assign to the vars.
+(set) 2>&1 |
+  case `(ac_space=' '; set | grep ac_space) 2>&1` in
+  *ac_space=\ *)
+    # `set' does not quote correctly, so add quotes (double-quote substitution
+    # turns \\\\ into \\, and sed turns \\ into \).
+    sed -n \
+      -e "s/'/'\\\\''/g" \
+      -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p"
+    ;;
+  *)
+    # `set' quotes correctly as required by POSIX, so do not add quotes.
+    sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p'
+    ;;
+  esac >> confcache
+if cmp -s $cache_file confcache; then
+  :
+else
+  if test -w $cache_file; then
+    echo "updating cache $cache_file"
+    cat confcache > $cache_file
+  else
+    echo "not updating unwritable cache $cache_file"
+  fi
+fi
+rm -f confcache
+
+trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15
+
+test "x$prefix" = xNONE && prefix=$ac_default_prefix
+# Let make expand exec_prefix.
+test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
+
+# Any assignment to VPATH causes Sun make to only execute
+# the first set of double-colon rules, so remove it if not needed.
+# If there is a colon in the path, we need to keep it.
+if test "x$srcdir" = x.; then
+  ac_vpsub='/^[ 	]*VPATH[ 	]*=[^:]*$/d'
+fi
+
+trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15
+
+DEFS=-DHAVE_CONFIG_H
+
+# Without the "./", some shells look in PATH for config.status.
+: ${CONFIG_STATUS=./config.status}
+
+echo creating $CONFIG_STATUS
+rm -f $CONFIG_STATUS
+cat > $CONFIG_STATUS <<EOF
+#! /bin/sh
+# Generated automatically by configure.
+# Run this file to recreate the current configuration.
+# This directory was configured as follows,
+# on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
+#
+# $0 $ac_configure_args
+#
+# Compiler output produced by configure, useful for debugging
+# configure, is in ./config.log if it exists.
+
+ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]"
+for ac_option
+do
+  case "\$ac_option" in
+  -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
+    echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion"
+    exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;;
+  -version | --version | --versio | --versi | --vers | --ver | --ve | --v)
+    echo "$CONFIG_STATUS generated by autoconf version 2.13"
+    exit 0 ;;
+  -help | --help | --hel | --he | --h)
+    echo "\$ac_cs_usage"; exit 0 ;;
+  *) echo "\$ac_cs_usage"; exit 1 ;;
+  esac
+done
+
+ac_given_srcdir=$srcdir
+ac_given_INSTALL="$INSTALL"
+
+trap 'rm -fr `echo "
+ Makefile:Makefile.top:Makefile.in:Makefile.rules
+ snmplib/Makefile:Makefile.top:snmplib/Makefile.in:Makefile.rules:snmplib/Makefile.depend
+ apps/Makefile:Makefile.top:apps/Makefile.in:Makefile.rules:apps/Makefile.depend
+ apps/snmpnetstat/Makefile:Makefile.top:apps/snmpnetstat/Makefile.in:Makefile.rules:apps/snmpnetstat/Makefile.depend
+ agent/Makefile:Makefile.top:agent/Makefile.in:Makefile.rules:agent/Makefile.depend
+ agent/helpers/Makefile:Makefile.top:agent/helpers/Makefile.in:Makefile.rules:agent/helpers/Makefile.depend
+ agent/mibgroup/Makefile:Makefile.top:agent/mibgroup/Makefile.in:Makefile.rules:agent/mibgroup/Makefile.depend
+ local/Makefile:Makefile.top:local/Makefile.in:Makefile.rules
+ testing/Makefile:Makefile.top:testing/Makefile.in
+ man/Makefile:Makefile.top:man/Makefile.in:Makefile.rules
+ mibs/Makefile:Makefile.top:mibs/Makefile.in:Makefile.rules
+ net-snmp-config:net-snmp-config.in
+ include/net-snmp/net-snmp-config.h" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15
+EOF
+cat >> $CONFIG_STATUS <<EOF
+
+# Protect against being on the right side of a sed subst in config.status.
+sed 's/%@/@@/; s/@%/@@/; s/%g\$/@g/; /@g\$/s/[\\\\&%]/\\\\&/g;
+ s/@@/%@/; s/@@/@%/; s/@g\$/%g/' > conftest.subs <<\\CEOF
+$ac_vpsub
+$extrasub
+s%@SHELL@%$SHELL%g
+s%@CFLAGS@%$CFLAGS%g
+s%@CPPFLAGS@%$CPPFLAGS%g
+s%@CXXFLAGS@%$CXXFLAGS%g
+s%@FFLAGS@%$FFLAGS%g
+s%@DEFS@%$DEFS%g
+s%@LDFLAGS@%$LDFLAGS%g
+s%@LIBS@%$LIBS%g
+s%@exec_prefix@%$exec_prefix%g
+s%@prefix@%$prefix%g
+s%@program_transform_name@%$program_transform_name%g
+s%@bindir@%$bindir%g
+s%@sbindir@%$sbindir%g
+s%@libexecdir@%$libexecdir%g
+s%@datadir@%$datadir%g
+s%@sysconfdir@%$sysconfdir%g
+s%@sharedstatedir@%$sharedstatedir%g
+s%@localstatedir@%$localstatedir%g
+s%@libdir@%$libdir%g
+s%@includedir@%$includedir%g
+s%@oldincludedir@%$oldincludedir%g
+s%@infodir@%$infodir%g
+s%@mandir@%$mandir%g
+s%@CONFIGURE_OPTIONS@%$CONFIGURE_OPTIONS%g
+s%@LIBTOOLFLAGS@%$LIBTOOLFLAGS%g
+s%@HAVE_DMALLOC_H@%$HAVE_DMALLOC_H%g
+s%@WRAPLIBS@%$WRAPLIBS%g
+s%@installucdheaders@%$installucdheaders%g
+s%@installucdlibs@%$installucdlibs%g
+s%@CC@%$CC%g
+s%@CPP@%$CPP%g
+s%@EXEEXT@%$EXEEXT%g
+s%@host@%$host%g
+s%@host_alias@%$host_alias%g
+s%@host_cpu@%$host_cpu%g
+s%@host_vendor@%$host_vendor%g
+s%@host_os@%$host_os%g
+s%@build@%$build%g
+s%@build_alias@%$build_alias%g
+s%@build_cpu@%$build_cpu%g
+s%@build_vendor@%$build_vendor%g
+s%@build_os@%$build_os%g
+s%@LN_S@%$LN_S%g
+s%@OBJEXT@%$OBJEXT%g
+s%@ECHO@%$ECHO%g
+s%@RANLIB@%$RANLIB%g
+s%@STRIP@%$STRIP%g
+s%@DLLTOOL@%$DLLTOOL%g
+s%@AS@%$AS%g
+s%@OBJDUMP@%$OBJDUMP%g
+s%@LIBTOOL@%$LIBTOOL%g
+s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g
+s%@INSTALL_SCRIPT@%$INSTALL_SCRIPT%g
+s%@INSTALL_DATA@%$INSTALL_DATA%g
+s%@SET_MAKE@%$SET_MAKE%g
+s%@PSPROG@%$PSPROG%g
+s%@PERLPROG@%$PERLPROG%g
+s%@WHOAMI@%$WHOAMI%g
+s%@SED@%$SED%g
+s%@AUTOCONF@%$AUTOCONF%g
+s%@AUTOHEADER@%$AUTOHEADER%g
+s%@UNAMEPROG@%$UNAMEPROG%g
+s%@VERSION@%$VERSION%g
+s%@RELEASEVERSION@%$RELEASEVERSION%g
+s%@DEVFLAGS@%$DEVFLAGS%g
+s%@target@%$target%g
+s%@target_alias@%$target_alias%g
+s%@target_cpu@%$target_cpu%g
+s%@target_vendor@%$target_vendor%g
+s%@target_os@%$target_os%g
+s%@CCPATH@%$CCPATH%g
+s%@EXTRACPPFLAGS@%$EXTRACPPFLAGS%g
+s%@SNMPCONFPATH@%$SNMPCONFPATH%g
+s%@transport_hdr_list@%$transport_hdr_list%g
+s%@transport_src_list@%$transport_src_list%g
+s%@transport_obj_list@%$transport_obj_list%g
+s%@transport_lobj_list@%$transport_lobj_list%g
+s%@security_src_list@%$security_src_list%g
+s%@security_obj_list@%$security_obj_list%g
+s%@security_lobj_list@%$security_lobj_list%g
+s%@security_hdr_list@%$security_hdr_list%g
+s%@MODULE_LIST@%$MODULE_LIST%g
+s%@module_list_c@%$module_list_c%g
+s%@module_list_h@%$module_list_h%g
+s%@module_list_o@%$module_list_o%g
+s%@module_list_lo@%$module_list_lo%g
+s%@mibgroup_list_o@%$mibgroup_list_o%g
+s%@mibgroup_list_lo@%$mibgroup_list_lo%g
+s%@module_list@%$module_list%g
+s%@default_mibs_install@%$default_mibs_install%g
+s%@PERLTARGS@%$PERLTARGS%g
+s%@PERLINSTALLTARGS@%$PERLINSTALLTARGS%g
+s%@PERLARGS@%$PERLARGS%g
+s%@EMBEDPERLINSTALL@%$EMBEDPERLINSTALL%g
+s%@LPSTAT_PATH@%$LPSTAT_PATH%g
+s%@PSCMD@%$PSCMD%g
+s%@ALLOCA@%$ALLOCA%g
+s%@LIBOBJS@%$LIBOBJS%g
+s%@AGENTLIBS@%$AGENTLIBS%g
+s%@OTHERAGENTLIBOBJS@%$OTHERAGENTLIBOBJS%g
+s%@OTHERAGENTLIBLOBJS@%$OTHERAGENTLIBLOBJS%g
+s%@PERSISTENT_DIRECTORY@%$PERSISTENT_DIRECTORY%g
+s%@UCDPERSISTENT_DIRECTORY@%$UCDPERSISTENT_DIRECTORY%g
+s%@COPY_PERSISTENT_FILES@%$COPY_PERSISTENT_FILES%g
+s%@DLLIBS@%$DLLIBS%g
+
+CEOF
+EOF
+
+cat >> $CONFIG_STATUS <<\EOF
+
+# Split the substitutions into bite-sized pieces for seds with
+# small command number limits, like on Digital OSF/1 and HP-UX.
+ac_max_sed_cmds=90 # Maximum number of lines to put in a sed script.
+ac_file=1 # Number of current file.
+ac_beg=1 # First line for current file.
+ac_end=$ac_max_sed_cmds # Line after last line for current file.
+ac_more_lines=:
+ac_sed_cmds=""
+while $ac_more_lines; do
+  if test $ac_beg -gt 1; then
+    sed "1,${ac_beg}d; ${ac_end}q" conftest.subs > conftest.s$ac_file
+  else
+    sed "${ac_end}q" conftest.subs > conftest.s$ac_file
+  fi
+  if test ! -s conftest.s$ac_file; then
+    ac_more_lines=false
+    rm -f conftest.s$ac_file
+  else
+    if test -z "$ac_sed_cmds"; then
+      ac_sed_cmds="sed -f conftest.s$ac_file"
+    else
+      ac_sed_cmds="$ac_sed_cmds | sed -f conftest.s$ac_file"
+    fi
+    ac_file=`expr $ac_file + 1`
+    ac_beg=$ac_end
+    ac_end=`expr $ac_end + $ac_max_sed_cmds`
+  fi
+done
+if test -z "$ac_sed_cmds"; then
+  ac_sed_cmds=cat
+fi
+EOF
+
+cat >> $CONFIG_STATUS <<EOF
+
+CONFIG_FILES=\${CONFIG_FILES-"Makefile:Makefile.top:Makefile.in:Makefile.rules
+ snmplib/Makefile:Makefile.top:snmplib/Makefile.in:Makefile.rules:snmplib/Makefile.depend
+ apps/Makefile:Makefile.top:apps/Makefile.in:Makefile.rules:apps/Makefile.depend
+ apps/snmpnetstat/Makefile:Makefile.top:apps/snmpnetstat/Makefile.in:Makefile.rules:apps/snmpnetstat/Makefile.depend
+ agent/Makefile:Makefile.top:agent/Makefile.in:Makefile.rules:agent/Makefile.depend
+ agent/helpers/Makefile:Makefile.top:agent/helpers/Makefile.in:Makefile.rules:agent/helpers/Makefile.depend
+ agent/mibgroup/Makefile:Makefile.top:agent/mibgroup/Makefile.in:Makefile.rules:agent/mibgroup/Makefile.depend
+ local/Makefile:Makefile.top:local/Makefile.in:Makefile.rules
+ testing/Makefile:Makefile.top:testing/Makefile.in
+ man/Makefile:Makefile.top:man/Makefile.in:Makefile.rules
+ mibs/Makefile:Makefile.top:mibs/Makefile.in:Makefile.rules
+ net-snmp-config:net-snmp-config.in
+"}
+EOF
+cat >> $CONFIG_STATUS <<\EOF
+for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then
+  # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
+  case "$ac_file" in
+  *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'`
+       ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
+  *) ac_file_in="${ac_file}.in" ;;
+  esac
+
+  # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories.
+
+  # Remove last slash and all that follows it.  Not all systems have dirname.
+  ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'`
+  if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then
+    # The file is in a subdirectory.
+    test ! -d "$ac_dir" && mkdir "$ac_dir"
+    ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`"
+    # A "../" for each directory in $ac_dir_suffix.
+    ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'`
+  else
+    ac_dir_suffix= ac_dots=
+  fi
+
+  case "$ac_given_srcdir" in
+  .)  srcdir=.
+      if test -z "$ac_dots"; then top_srcdir=.
+      else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;;
+  /*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;;
+  *) # Relative path.
+    srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix"
+    top_srcdir="$ac_dots$ac_given_srcdir" ;;
+  esac
+
+  case "$ac_given_INSTALL" in
+  [/$]*) INSTALL="$ac_given_INSTALL" ;;
+  *) INSTALL="$ac_dots$ac_given_INSTALL" ;;
+  esac
+
+  echo creating "$ac_file"
+  rm -f "$ac_file"
+  configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure."
+  case "$ac_file" in
+  *Makefile*) ac_comsub="1i\\
+# $configure_input" ;;
+  *) ac_comsub= ;;
+  esac
+
+  ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"`
+  sed -e "$ac_comsub
+s%@configure_input@%$configure_input%g
+s%@srcdir@%$srcdir%g
+s%@top_srcdir@%$top_srcdir%g
+s%@INSTALL@%$INSTALL%g
+" $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file
+fi; done
+rm -f conftest.s*
+
+# These sed commands are passed to sed as "A NAME B NAME C VALUE D", where
+# NAME is the cpp macro being defined and VALUE is the value it is being given.
+#
+# ac_d sets the value in "#define NAME VALUE" lines.
+ac_dA='s%^\([ 	]*\)#\([ 	]*define[ 	][ 	]*\)'
+ac_dB='\([ 	][ 	]*\)[^ 	]*%\1#\2'
+ac_dC='\3'
+ac_dD='%g'
+# ac_u turns "#undef NAME" with trailing blanks into "#define NAME VALUE".
+ac_uA='s%^\([ 	]*\)#\([ 	]*\)undef\([ 	][ 	]*\)'
+ac_uB='\([ 	]\)%\1#\2define\3'
+ac_uC=' '
+ac_uD='\4%g'
+# ac_e turns "#undef NAME" without trailing blanks into "#define NAME VALUE".
+ac_eA='s%^\([ 	]*\)#\([ 	]*\)undef\([ 	][ 	]*\)'
+ac_eB='$%\1#\2define\3'
+ac_eC=' '
+ac_eD='%g'
+
+if test "${CONFIG_HEADERS+set}" != set; then
+EOF
+cat >> $CONFIG_STATUS <<EOF
+  CONFIG_HEADERS="include/net-snmp/net-snmp-config.h"
+EOF
+cat >> $CONFIG_STATUS <<\EOF
+fi
+for ac_file in .. $CONFIG_HEADERS; do if test "x$ac_file" != x..; then
+  # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
+  case "$ac_file" in
+  *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'`
+       ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
+  *) ac_file_in="${ac_file}.in" ;;
+  esac
+
+  echo creating $ac_file
+
+  rm -f conftest.frag conftest.in conftest.out
+  ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"`
+  cat $ac_file_inputs > conftest.in
+
+EOF
+
+# Transform confdefs.h into a sed script conftest.vals that substitutes
+# the proper values into config.h.in to produce config.h.  And first:
+# Protect against being on the right side of a sed subst in config.status.
+# Protect against being in an unquoted here document in config.status.
+rm -f conftest.vals
+cat > conftest.hdr <<\EOF
+s/[\\&%]/\\&/g
+s%[\\$`]%\\&%g
+s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD}%gp
+s%ac_d%ac_u%gp
+s%ac_u%ac_e%gp
+EOF
+sed -n -f conftest.hdr confdefs.h > conftest.vals
+rm -f conftest.hdr
+
+# This sed command replaces #undef with comments.  This is necessary, for
+# example, in the case of _POSIX_SOURCE, which is predefined and required
+# on some systems where configure will not decide to define it.
+cat >> conftest.vals <<\EOF
+s%^[ 	]*#[ 	]*undef[ 	][ 	]*[a-zA-Z_][a-zA-Z_0-9]*%/* & */%
+EOF
+
+# Break up conftest.vals because some shells have a limit on
+# the size of here documents, and old seds have small limits too.
+
+rm -f conftest.tail
+while :
+do
+  ac_lines=`grep -c . conftest.vals`
+  # grep -c gives empty output for an empty file on some AIX systems.
+  if test -z "$ac_lines" || test "$ac_lines" -eq 0; then break; fi
+  # Write a limited-size here document to conftest.frag.
+  echo '  cat > conftest.frag <<CEOF' >> $CONFIG_STATUS
+  sed ${ac_max_here_lines}q conftest.vals >> $CONFIG_STATUS
+  echo 'CEOF
+  sed -f conftest.frag conftest.in > conftest.out
+  rm -f conftest.in
+  mv conftest.out conftest.in
+' >> $CONFIG_STATUS
+  sed 1,${ac_max_here_lines}d conftest.vals > conftest.tail
+  rm -f conftest.vals
+  mv conftest.tail conftest.vals
+done
+rm -f conftest.vals
+
+cat >> $CONFIG_STATUS <<\EOF
+  rm -f conftest.frag conftest.h
+  echo "/* $ac_file.  Generated automatically by configure.  */" > conftest.h
+  cat conftest.in >> conftest.h
+  rm -f conftest.in
+  if cmp -s $ac_file conftest.h 2>/dev/null; then
+    echo "$ac_file is unchanged"
+    rm -f conftest.h
+  else
+    # Remove last slash and all that follows it.  Not all systems have dirname.
+      ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'`
+      if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then
+      # The file is in a subdirectory.
+      test ! -d "$ac_dir" && mkdir "$ac_dir"
+    fi
+    rm -f $ac_file
+    mv conftest.h $ac_file
+  fi
+fi; done
+
+EOF
+cat >> $CONFIG_STATUS <<EOF
+
+EOF
+cat >> $CONFIG_STATUS <<\EOF
+
+ echo timestamp > stamp-h
+ chmod 755 net-snmp-config
+
+exit 0
+EOF
+chmod +x $CONFIG_STATUS
+rm -fr confdefs* $ac_clean_files
+test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1
+
+
+
+  echo ""
+  echo "---------------------------------------------------------"
+  echo "            Net-SNMP configuration summary:"
+  echo "---------------------------------------------------------"
+  echo ""
+  cat configure-summary
+  echo ""
+  echo "---------------------------------------------------------"
+  echo ""
+
+
diff -Naur tomato/release/src/router/snmp/configure.bak tomato121/release/src/router/snmp/configure.bak
--- tomato/release/src/router/snmp/configure.bak	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/configure.bak	2008-04-22 00:27:53.000000000 +1000
@@ -0,0 +1,18438 @@
+#! /bin/sh
+
+# Guess values for system-dependent variables and create Makefiles.
+# Generated automatically using autoconf version 2.13 
+# Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc.
+#
+# This configure script is free software; the Free Software Foundation
+# gives unlimited permission to copy, distribute and modify it.
+
+# Defaults:
+ac_help=
+ac_default_prefix=/usr/local
+# Any additions from configure.in:
+ac_help="$ac_help
+
+Compiler Options:
+  --with-cc=CC                    use CC to compile (default=gcc)."
+ac_help="$ac_help
+  --with-ar=AR                    use AR as the archiver."
+ac_help="$ac_help
+  --with-endianness=big|little    define endianness of target platform when
+                                  cross-compiling."
+ac_help="$ac_help
+  --with-cflags=CFLAGS            use CFLAGS as compile time arguments."
+ac_help="$ac_help
+  --with-ldflags=LDFLAGS          use LDFLAGS as link time arguments to ld."
+ac_help="$ac_help
+  --with-libs=LIBS                use LIBS as link time arguments to ld."
+ac_help="$ac_help
+  --enable-silent-libtool         Pass --silent to libtool."
+ac_help="$ac_help
+  --enable-mini-agent             Build a minimal agent."
+ac_help="$ac_help
+  --enable-ipv6                   Generate IPv6 ready version."
+ac_help="$ac_help
+  --enable-debugging              Outputs extra debugging information at all
+                                  times.  Normally, you should not enable this,
+                                  but instead use the -D flag of the commands,
+                                  which toggles debbuging output at runtime.
+  --disable-debugging             Disallows debugging code to be built in.
+                                  This might provide some speed benefits."
+ac_help="$ac_help
+  --enable-developer              Turns on super-duper-extra-compile-warnings
+                                  when using gcc."
+ac_help="$ac_help
+  --with-dmalloc=PATH             Use dmalloc library (www.dmalloc.com)"
+ac_help="$ac_help
+  --with-efence                   Look for and use libefence (malloc)."
+ac_help="$ac_help
+  --with-rsaref=PATH              Look for librsaref in PATH/lib."
+ac_help="$ac_help
+  --with-openssl=PATH             Look for openssl in PATH/lib."
+ac_help="$ac_help
+  --disable-privacy               Don't compile in support for privacy."
+ac_help="$ac_help
+  --enable-internal-md5           Use the internal MD5 support."
+ac_help="$ac_help
+  --without-opaque-special-types  Don't use special opaque encodings.
+                                  SNMP normally cannot handle
+                                  floating numbers, nor large 64 bit
+                                  integers well.  By default, the
+                                  net-snmp package compiles in
+                                  support for these extra datatypes
+                                  (in a legal way)"
+ac_help="$ac_help
+  --with-mibdirs=\"dir1:dir2:\"     Default directories to look for mibs.
+                                    (Default: \$HOME/.snmp/mibs:DATADIR/snmp/mibs)"
+ac_help="$ac_help
+  --with-mibs=\"item1:item2:\"      Default mib IDs to read.
+                                    (The default list is \"IP-MIB:IF-MIB:
+                                    TCP-MIB:UDP-MIB:SNMPv2-MIB:RFC1213-MIB\"
+                                    with the addition of any mibs used
+                                    by the mib modules the agent is
+                                    configured with)"
+ac_help="$ac_help
+  --with-mibfiles=\"file1:file2\"   Default mib files to load.
+                                    (Default:  none.  uses IDs above instead.)"
+ac_help="$ac_help
+  --enable-testing-code           Enables some code sections that should 
+                                  only be used for testing of certain
+                                  SNMP functionalities.  This should *not* 
+                                  be turned on for production use.  Ever."
+ac_help="$ac_help
+  --enable-reentrant              Enables locking functions that protect
+                                  library resources in some multi-threading
+                                  environments.  This does not guarantee
+                                  thread-safe operation.
+                                  Currently an experimental setting."
+ac_help="$ac_help
+
+Configuring the agent:
+  --without-root-access           The snmpd agent won't require root access to
+                                  run it.  The information it returns in the
+                                  mib-II tree may not be correct, however."
+ac_help="$ac_help
+
+Configuring the agent:
+  --without-kmem-usage            Do not include any code related to the use
+                                  of kmem. This option can only be used with
+                                  the option --enable-mini-agent."
+ac_help="$ac_help
+  --with-dummy-values             Provide 'placeholder' dummy values where
+                                  the necessary information is not available.
+                                  This is technically not compliant with the
+                                  SNMP specifications, but was how the agent
+                                  operated for versions < 4.0."
+ac_help="$ac_help
+  --with-persistent-directory=\"directory\"
+                                  Default directory for persistent data storage."
+ac_help="$ac_help
+  --with-copy-persistent-files=\"no\" Don't copy persistent files
+                                       (or use \"yes\" to copy them).
+                                       (Default: yes)"
+ac_help="$ac_help
+  --with-default-snmp-version=\"3\" Default version of SNMP to use.
+                                  (Default: 3)
+                                  Legal values: 1, 2 (for SNMPv2c) or 3."
+ac_help="$ac_help
+  --with-sys-contact=\"who@where\"  Default system contact.
+                                    (Default: LOGIN@DOMAINNAME)"
+ac_help="$ac_help
+  --with-sys-location=\"location\"  Default system location.
+                                    (Default: Unknown)"
+ac_help="$ac_help
+  --with-logfile=\"location\"       Default log file location for snmpd."
+ac_help="$ac_help
+  --with-transports=\"t1 t2 ...\"   Compile in the given SNMP transport
+                                    modules (space separated list)."
+ac_help="$ac_help
+  --with-out-transports=\"t1 ...\"  Exclude listed SNMP transports
+                                    (space separated list).
+
+  Available SNMP transport modules are:
+
+    UDP         support for SNMP over UDP/IP.
+                This transport is always compiled in.
+    UDPIPv6     support for SNMP over UDP/IPv6.
+                This transport is available for Linux, Solaris and
+                FreeBSD.
+                It is never compiled in by default.
+    TCPIPv6     support for SNMP over UDP/IPv6.
+                This transport is available for Linux, Solaris and
+                FreeBSD.
+                It is never compiled in by default.
+    TCP         support for SNMP over TCP/IP.
+                This transport is compiled in by default, but may be omitted.
+    Unix        support for SNMP over Unix domain protocols.
+                This transport is compiled in by default except on Win32
+                platforms, and may be omitted.
+    Callback    support for SNMP over an internal locally connected pair
+                of snmp_sessions.
+    AAL5PVC     support for SNMP over AAL5 PVCs.
+                This transport is presently only available for Linux,
+                is never compiled in by default and may be omitted.
+    IPX         support for SNMP over IPX per RFC 1420.
+                This transport is presently only available for Linux,
+                is never compiled in by default and may be omitted.
+"
+ac_help="$ac_help
+"
+ac_help="$ac_help
+"
+ac_help="$ac_help
+  --with-security-modules=\"s1 s2 ...\"   Compile in the given SNMP security
+                                    module services (space separated list).
+
+  Available SNMP security services:
+
+        usm                support for user based SNMP security
+                           (required and always compiled in)
+        ksm                support for kerberos based SNMP security
+"
+ac_help="$ac_help
+  --with-mib-modules=\"item1 ...\"  Compile with additional mib modules
+                                    (Space separated list)."
+ac_help="$ac_help
+  --with-out-mib-modules=\"list\"   Compile without these mib modules.
+
+  Default mib modules compiled into the agent (which can be removed):
+  
+    mibII                  support for the mib-II tree.
+    snmpv3mibs             support for the snmpv3 mib modules.
+    ucd_snmp               UCD-SNMP-MIB specific extensions.
+    agent_mibs             NET-SNMP-AGENT-MIB extensions
+    agentx                 (see below)
+    notification           mibs supporting specification of trap destinations.
+    target                 Support for the SNMP WGs TARGET-MIB.
+    utilities              general agent configuration utilities.
+
+  Optional mib modules that can be built into the agent include:
+    host                   host resources mib support.
+                             (beta level code for linux, hpux, solaris, bsdi)
+    disman/event-mib       support for the DISMAN-EVENT-MIB (beta)
+                             (supports self monitoring and notification 
+                              delivery when error conditions are found)
+    smux                   smux support to allow subagents to attach to snmpd.
+    mibII/mta_sendmail     Sendmail statistics monitoring (MTA-MIB)
+    misc/ipfwacc           accounting rules IP firewall information (linux).
+    ipfwchains/ipfwchains  firewall chains under ipfw for linux.
+                           (Download separately from the ucd-snmp ftp site.)
+    ucd-snmp/diskio        Table of io-devices and how much data they have
+                           read/written.  (only tested on Solaris)
+    tunnel                 Linux TUNNEL-MIB support (ifTable extension)
+
+  AgentX support:  (warning: beta code)
+    agentx/subagent        allows the agent to run as either a snmp agent
+                           or as an agentX sub-agent.
+    agentx/master          makes the agent run as an agentX master agent
+                           as well as a normal snmp agent.
+    agentx                 includes both agentx/master and agentx/client.
+
+  Optional modules for C coders to look at and/or include as extension examples:
+  
+    examples/ucdDemoPublic  SNMPv3 interoperability testing mib.
+    examples/example        example C code extension."
+ac_help="$ac_help
+Enterprise OIDs:  (warning: this should be used with caution.)
+
+  --with-enterprise-oid              The enterprise number assigned to the
+                                     vendor by IANA.  See
+                                     http://www.iana.org/cgi-bin/enterprise.pl
+                                     to get one, though using the default is
+                                     probably the right choice is most cases.
+                                     (default 8072 = "enterprise.net-snmp")"
+ac_help="$ac_help
+
+  --with-enterprise-sysoid           The base OID for the sysObjectID
+                                     of the system group
+                                     (default .1.3.6.1.4.1.8072.3.2... = 
+                                      "netSnmpAgentOIDs...")"
+ac_help="$ac_help
+
+  --with-enterprise-notification-oid The OID used for the root of
+				     enterprise specific notifications.
+                                     (default .1.3.6.1.4.1.2021 = "enterprise.ucdavis")"
+ac_help="$ac_help
+"
+ac_help="$ac_help
+"
+ac_help="$ac_help
+
+Perl:
+  --with-perl-modules[=ARGS]      Install the perl modules along with the rest
+                                  of the net-snmp toolkit.  If ARGS is
+                                  specified, they're passed to the
+                                  Makefile.PL script."
+ac_help="$ac_help
+
+  --enable-embedded-perl          Embed perl in the SNMP agent.
+                                  [forces --with-perl-modules as well.]"
+ac_help="$ac_help
+
+Miscellaneous:
+  --with-defaults          Use defaults for prompted values."
+ac_help="$ac_help
+--enable-ucd-snmp-compatibility  Install ucd-snmp look-alike headers and libs."
+ac_help="$ac_help
+  --enable-shared[=PKGS]  build shared libraries [default=yes]"
+ac_help="$ac_help
+  --enable-static[=PKGS]  build static libraries [default=yes]"
+ac_help="$ac_help
+  --enable-fast-install[=PKGS]  optimize for fast installation [default=yes]"
+ac_help="$ac_help
+  --with-gnu-ld           assume the C compiler uses GNU ld [default=no]"
+
+# Find the correct PATH separator.  Usually this is `:', but
+# DJGPP uses `;' like DOS.
+if test "X${PATH_SEPARATOR+set}" != Xset; then
+  UNAME=${UNAME-`uname 2>/dev/null`}
+  case X$UNAME in
+    *-DOS) lt_cv_sys_path_separator=';' ;;
+    *)     lt_cv_sys_path_separator=':' ;;
+  esac
+  PATH_SEPARATOR=$lt_cv_sys_path_separator
+fi
+
+
+# Check that we are running under the correct shell.
+SHELL=${CONFIG_SHELL-/bin/sh}
+
+case X$ECHO in
+X*--fallback-echo)
+  # Remove one level of quotation (which was required for Make).
+  ECHO=`echo "$ECHO" | sed 's,\\\\\$\\$0,'$0','`
+  ;;
+esac
+
+echo=${ECHO-echo}
+if test "X$1" = X--no-reexec; then
+  # Discard the --no-reexec flag, and continue.
+  shift
+elif test "X$1" = X--fallback-echo; then
+  # Avoid inline document here, it may be left over
+  :
+elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then
+  # Yippee, $echo works!
+  :
+else
+  # Restart under the correct shell.
+  exec $SHELL "$0" --no-reexec ${1+"$@"}
+fi
+
+if test "X$1" = X--fallback-echo; then
+  # used as fallback echo
+  shift
+  cat <<EOF
+
+EOF
+  exit 0
+fi
+
+# The HP-UX ksh and POSIX shell print the target directory to stdout
+# if CDPATH is set.
+if test "X${CDPATH+set}" = Xset; then CDPATH=:; export CDPATH; fi
+
+if test -z "$ECHO"; then
+if test "X${echo_test_string+set}" != Xset; then
+# find a string as large as possible, as long as the shell can cope with it
+  for cmd in 'sed 50q "$0"' 'sed 20q "$0"' 'sed 10q "$0"' 'sed 2q "$0"' 'echo test'; do
+    # expected sizes: less than 2Kb, 1Kb, 512 bytes, 16 bytes, ...
+    if (echo_test_string="`eval $cmd`") 2>/dev/null &&
+       echo_test_string="`eval $cmd`" &&
+       (test "X$echo_test_string" = "X$echo_test_string") 2>/dev/null
+    then
+      break
+    fi
+  done
+fi
+
+if test "X`($echo '\t') 2>/dev/null`" = 'X\t' &&
+   echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` &&
+   test "X$echo_testing_string" = "X$echo_test_string"; then
+  :
+else
+  # The Solaris, AIX, and Digital Unix default echo programs unquote
+  # backslashes.  This makes it impossible to quote backslashes using
+  #   echo "$something" | sed 's/\\/\\\\/g'
+  #
+  # So, first we look for a working echo in the user's PATH.
+
+  IFS="${IFS= 	}"; save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+  for dir in $PATH /usr/ucb; do
+    if (test -f $dir/echo || test -f $dir/echo$ac_exeext) &&
+       test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' &&
+       echo_testing_string=`($dir/echo "$echo_test_string") 2>/dev/null` &&
+       test "X$echo_testing_string" = "X$echo_test_string"; then
+      echo="$dir/echo"
+      break
+    fi
+  done
+  IFS="$save_ifs"
+
+  if test "X$echo" = Xecho; then
+    # We didn't find a better echo, so look for alternatives.
+    if test "X`(print -r '\t') 2>/dev/null`" = 'X\t' &&
+       echo_testing_string=`(print -r "$echo_test_string") 2>/dev/null` &&
+       test "X$echo_testing_string" = "X$echo_test_string"; then
+      # This shell has a builtin print -r that does the trick.
+      echo='print -r'
+    elif (test -f /bin/ksh || test -f /bin/ksh$ac_exeext) &&
+	 test "X$CONFIG_SHELL" != X/bin/ksh; then
+      # If we have ksh, try running configure again with it.
+      ORIGINAL_CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
+      export ORIGINAL_CONFIG_SHELL
+      CONFIG_SHELL=/bin/ksh
+      export CONFIG_SHELL
+      exec $CONFIG_SHELL "$0" --no-reexec ${1+"$@"}
+    else
+      # Try using printf.
+      echo='printf %s\n'
+      if test "X`($echo '\t') 2>/dev/null`" = 'X\t' &&
+	 echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` &&
+	 test "X$echo_testing_string" = "X$echo_test_string"; then
+	# Cool, printf works
+	:
+      elif echo_testing_string=`($ORIGINAL_CONFIG_SHELL "$0" --fallback-echo '\t') 2>/dev/null` &&
+	   test "X$echo_testing_string" = 'X\t' &&
+	   echo_testing_string=`($ORIGINAL_CONFIG_SHELL "$0" --fallback-echo "$echo_test_string") 2>/dev/null` &&
+	   test "X$echo_testing_string" = "X$echo_test_string"; then
+	CONFIG_SHELL=$ORIGINAL_CONFIG_SHELL
+	export CONFIG_SHELL
+	SHELL="$CONFIG_SHELL"
+	export SHELL
+	echo="$CONFIG_SHELL $0 --fallback-echo"
+      elif echo_testing_string=`($CONFIG_SHELL "$0" --fallback-echo '\t') 2>/dev/null` &&
+	   test "X$echo_testing_string" = 'X\t' &&
+	   echo_testing_string=`($CONFIG_SHELL "$0" --fallback-echo "$echo_test_string") 2>/dev/null` &&
+	   test "X$echo_testing_string" = "X$echo_test_string"; then
+	echo="$CONFIG_SHELL $0 --fallback-echo"
+      else
+	# maybe with a smaller string...
+	prev=:
+
+	for cmd in 'echo test' 'sed 2q "$0"' 'sed 10q "$0"' 'sed 20q "$0"' 'sed 50q "$0"'; do
+	  if (test "X$echo_test_string" = "X`eval $cmd`") 2>/dev/null
+	  then
+	    break
+	  fi
+	  prev="$cmd"
+	done
+
+	if test "$prev" != 'sed 50q "$0"'; then
+	  echo_test_string=`eval $prev`
+	  export echo_test_string
+	  exec ${ORIGINAL_CONFIG_SHELL-${CONFIG_SHELL-/bin/sh}} "$0" ${1+"$@"}
+	else
+	  # Oops.  We lost completely, so just stick with echo.
+	  echo=echo
+	fi
+      fi
+    fi
+  fi
+fi
+fi
+
+# Copy echo and quote the copy suitably for passing to libtool from
+# the Makefile, instead of quoting the original, which is used later.
+ECHO=$echo
+if test "X$ECHO" = "X$CONFIG_SHELL $0 --fallback-echo"; then
+   ECHO="$CONFIG_SHELL \\\$\$0 --fallback-echo"
+fi
+
+
+ac_help="$ac_help
+  --disable-libtool-lock  avoid locking (might break parallel builds)"
+ac_help="$ac_help
+  --with-pic              try to use only PIC/non-PIC objects [default=use both]"
+ac_help="$ac_help
+  --with-libwrap[=LIBPATH] Compile in libwrap (tcp_wrappers) support."
+ac_help="$ac_help
+  --with-zlib[=DIR]        use libz in DIR"
+
+# Initialize some variables set by options.
+# The variables have the same names as the options, with
+# dashes changed to underlines.
+build=NONE
+cache_file=./config.cache
+exec_prefix=NONE
+host=NONE
+no_create=
+nonopt=NONE
+no_recursion=
+prefix=NONE
+program_prefix=NONE
+program_suffix=NONE
+program_transform_name=s,x,x,
+silent=
+site=
+srcdir=
+target=NONE
+verbose=
+x_includes=NONE
+x_libraries=NONE
+bindir='${exec_prefix}/bin'
+sbindir='${exec_prefix}/sbin'
+libexecdir='${exec_prefix}/libexec'
+datadir='${prefix}/share'
+sysconfdir='${prefix}/etc'
+sharedstatedir='${prefix}/com'
+localstatedir='${prefix}/var'
+libdir='${exec_prefix}/lib'
+includedir='${prefix}/include'
+oldincludedir='/usr/include'
+infodir='${prefix}/info'
+mandir='${prefix}/man'
+
+# Initialize some other variables.
+subdirs=
+MFLAGS= MAKEFLAGS=
+SHELL=${CONFIG_SHELL-/bin/sh}
+# Maximum number of lines to put in a shell here document.
+ac_max_here_lines=12
+
+ac_prev=
+for ac_option
+do
+
+  # If the previous option needs an argument, assign it.
+  if test -n "$ac_prev"; then
+    eval "$ac_prev=\$ac_option"
+    ac_prev=
+    continue
+  fi
+
+  case "$ac_option" in
+  -*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
+  *) ac_optarg= ;;
+  esac
+
+  # Accept the important Cygnus configure options, so we can diagnose typos.
+
+  case "$ac_option" in
+
+  -bindir | --bindir | --bindi | --bind | --bin | --bi)
+    ac_prev=bindir ;;
+  -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*)
+    bindir="$ac_optarg" ;;
+
+  -build | --build | --buil | --bui | --bu)
+    ac_prev=build ;;
+  -build=* | --build=* | --buil=* | --bui=* | --bu=*)
+    build="$ac_optarg" ;;
+
+  -cache-file | --cache-file | --cache-fil | --cache-fi \
+  | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c)
+    ac_prev=cache_file ;;
+  -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \
+  | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*)
+    cache_file="$ac_optarg" ;;
+
+  -datadir | --datadir | --datadi | --datad | --data | --dat | --da)
+    ac_prev=datadir ;;
+  -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \
+  | --da=*)
+    datadir="$ac_optarg" ;;
+
+  -disable-* | --disable-*)
+    ac_feature=`echo $ac_option|sed -e 's/-*disable-//'`
+    # Reject names that are not valid shell variable names.
+    if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then
+      { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; }
+    fi
+    ac_feature=`echo $ac_feature| sed 's/-/_/g'`
+    eval "enable_${ac_feature}=no" ;;
+
+  -enable-* | --enable-*)
+    ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'`
+    # Reject names that are not valid shell variable names.
+    if test -n "`echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then
+      { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; }
+    fi
+    ac_feature=`echo $ac_feature| sed 's/-/_/g'`
+    case "$ac_option" in
+      *=*) ;;
+      *) ac_optarg=yes ;;
+    esac
+    eval "enable_${ac_feature}='$ac_optarg'" ;;
+
+  -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \
+  | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \
+  | --exec | --exe | --ex)
+    ac_prev=exec_prefix ;;
+  -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \
+  | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \
+  | --exec=* | --exe=* | --ex=*)
+    exec_prefix="$ac_optarg" ;;
+
+  -gas | --gas | --ga | --g)
+    # Obsolete; use --with-gas.
+    with_gas=yes ;;
+
+  -help | --help | --hel | --he)
+    # Omit some internal or obsolete options to make the list less imposing.
+    # This message is too long to be a string in the A/UX 3.1 sh.
+    cat << EOF
+Usage: configure [options] [host]
+Options: [defaults in brackets after descriptions]
+Configuration:
+  --cache-file=FILE       cache test results in FILE
+  --help                  print this message
+  --no-create             do not create output files
+  --quiet, --silent       do not print \`checking...' messages
+  --version               print the version of autoconf that created configure
+Directory and file names:
+  --prefix=PREFIX         install architecture-independent files in PREFIX
+                          [$ac_default_prefix]
+  --exec-prefix=EPREFIX   install architecture-dependent files in EPREFIX
+                          [same as prefix]
+  --bindir=DIR            user executables in DIR [EPREFIX/bin]
+  --sbindir=DIR           system admin executables in DIR [EPREFIX/sbin]
+  --libexecdir=DIR        program executables in DIR [EPREFIX/libexec]
+  --datadir=DIR           read-only architecture-independent data in DIR
+                          [PREFIX/share]
+  --sysconfdir=DIR        read-only single-machine data in DIR [PREFIX/etc]
+  --sharedstatedir=DIR    modifiable architecture-independent data in DIR
+                          [PREFIX/com]
+  --localstatedir=DIR     modifiable single-machine data in DIR [PREFIX/var]
+  --libdir=DIR            object code libraries in DIR [EPREFIX/lib]
+  --includedir=DIR        C header files in DIR [PREFIX/include]
+  --oldincludedir=DIR     C header files for non-gcc in DIR [/usr/include]
+  --infodir=DIR           info documentation in DIR [PREFIX/info]
+  --mandir=DIR            man documentation in DIR [PREFIX/man]
+  --srcdir=DIR            find the sources in DIR [configure dir or ..]
+  --program-prefix=PREFIX prepend PREFIX to installed program names
+  --program-suffix=SUFFIX append SUFFIX to installed program names
+  --program-transform-name=PROGRAM
+                          run sed PROGRAM on installed program names
+EOF
+    cat << EOF
+Host type:
+  --build=BUILD           configure for building on BUILD [BUILD=HOST]
+  --host=HOST             configure for HOST [guessed]
+  --target=TARGET         configure for TARGET [TARGET=HOST]
+Features and packages:
+  --disable-FEATURE       do not include FEATURE (same as --enable-FEATURE=no)
+  --enable-FEATURE[=ARG]  include FEATURE [ARG=yes]
+  --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
+  --without-PACKAGE       do not use PACKAGE (same as --with-PACKAGE=no)
+  --x-includes=DIR        X include files are in DIR
+  --x-libraries=DIR       X library files are in DIR
+EOF
+    if test -n "$ac_help"; then
+      echo "--enable and --with options recognized:$ac_help"
+    fi
+    exit 0 ;;
+
+  -host | --host | --hos | --ho)
+    ac_prev=host ;;
+  -host=* | --host=* | --hos=* | --ho=*)
+    host="$ac_optarg" ;;
+
+  -includedir | --includedir | --includedi | --included | --include \
+  | --includ | --inclu | --incl | --inc)
+    ac_prev=includedir ;;
+  -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \
+  | --includ=* | --inclu=* | --incl=* | --inc=*)
+    includedir="$ac_optarg" ;;
+
+  -infodir | --infodir | --infodi | --infod | --info | --inf)
+    ac_prev=infodir ;;
+  -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*)
+    infodir="$ac_optarg" ;;
+
+  -libdir | --libdir | --libdi | --libd)
+    ac_prev=libdir ;;
+  -libdir=* | --libdir=* | --libdi=* | --libd=*)
+    libdir="$ac_optarg" ;;
+
+  -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \
+  | --libexe | --libex | --libe)
+    ac_prev=libexecdir ;;
+  -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \
+  | --libexe=* | --libex=* | --libe=*)
+    libexecdir="$ac_optarg" ;;
+
+  -localstatedir | --localstatedir | --localstatedi | --localstated \
+  | --localstate | --localstat | --localsta | --localst \
+  | --locals | --local | --loca | --loc | --lo)
+    ac_prev=localstatedir ;;
+  -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \
+  | --localstate=* | --localstat=* | --localsta=* | --localst=* \
+  | --locals=* | --local=* | --loca=* | --loc=* | --lo=*)
+    localstatedir="$ac_optarg" ;;
+
+  -mandir | --mandir | --mandi | --mand | --man | --ma | --m)
+    ac_prev=mandir ;;
+  -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*)
+    mandir="$ac_optarg" ;;
+
+  -nfp | --nfp | --nf)
+    # Obsolete; use --without-fp.
+    with_fp=no ;;
+
+  -no-create | --no-create | --no-creat | --no-crea | --no-cre \
+  | --no-cr | --no-c)
+    no_create=yes ;;
+
+  -no-recursion | --no-recursion | --no-recursio | --no-recursi \
+  | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r)
+    no_recursion=yes ;;
+
+  -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \
+  | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \
+  | --oldin | --oldi | --old | --ol | --o)
+    ac_prev=oldincludedir ;;
+  -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \
+  | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \
+  | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*)
+    oldincludedir="$ac_optarg" ;;
+
+  -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
+    ac_prev=prefix ;;
+  -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
+    prefix="$ac_optarg" ;;
+
+  -program-prefix | --program-prefix | --program-prefi | --program-pref \
+  | --program-pre | --program-pr | --program-p)
+    ac_prev=program_prefix ;;
+  -program-prefix=* | --program-prefix=* | --program-prefi=* \
+  | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*)
+    program_prefix="$ac_optarg" ;;
+
+  -program-suffix | --program-suffix | --program-suffi | --program-suff \
+  | --program-suf | --program-su | --program-s)
+    ac_prev=program_suffix ;;
+  -program-suffix=* | --program-suffix=* | --program-suffi=* \
+  | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*)
+    program_suffix="$ac_optarg" ;;
+
+  -program-transform-name | --program-transform-name \
+  | --program-transform-nam | --program-transform-na \
+  | --program-transform-n | --program-transform- \
+  | --program-transform | --program-transfor \
+  | --program-transfo | --program-transf \
+  | --program-trans | --program-tran \
+  | --progr-tra | --program-tr | --program-t)
+    ac_prev=program_transform_name ;;
+  -program-transform-name=* | --program-transform-name=* \
+  | --program-transform-nam=* | --program-transform-na=* \
+  | --program-transform-n=* | --program-transform-=* \
+  | --program-transform=* | --program-transfor=* \
+  | --program-transfo=* | --program-transf=* \
+  | --program-trans=* | --program-tran=* \
+  | --progr-tra=* | --program-tr=* | --program-t=*)
+    program_transform_name="$ac_optarg" ;;
+
+  -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+  | -silent | --silent | --silen | --sile | --sil)
+    silent=yes ;;
+
+  -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
+    ac_prev=sbindir ;;
+  -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
+  | --sbi=* | --sb=*)
+    sbindir="$ac_optarg" ;;
+
+  -sharedstatedir | --sharedstatedir | --sharedstatedi \
+  | --sharedstated | --sharedstate | --sharedstat | --sharedsta \
+  | --sharedst | --shareds | --shared | --share | --shar \
+  | --sha | --sh)
+    ac_prev=sharedstatedir ;;
+  -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \
+  | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \
+  | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \
+  | --sha=* | --sh=*)
+    sharedstatedir="$ac_optarg" ;;
+
+  -site | --site | --sit)
+    ac_prev=site ;;
+  -site=* | --site=* | --sit=*)
+    site="$ac_optarg" ;;
+
+  -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
+    ac_prev=srcdir ;;
+  -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
+    srcdir="$ac_optarg" ;;
+
+  -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \
+  | --syscon | --sysco | --sysc | --sys | --sy)
+    ac_prev=sysconfdir ;;
+  -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \
+  | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*)
+    sysconfdir="$ac_optarg" ;;
+
+  -target | --target | --targe | --targ | --tar | --ta | --t)
+    ac_prev=target ;;
+  -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)
+    target="$ac_optarg" ;;
+
+  -v | -verbose | --verbose | --verbos | --verbo | --verb)
+    verbose=yes ;;
+
+  -version | --version | --versio | --versi | --vers)
+    echo "configure generated by autoconf version 2.13"
+    exit 0 ;;
+
+  -with-* | --with-*)
+    ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'`
+    # Reject names that are not valid shell variable names.
+    if test -n "`echo $ac_package| sed 's/[-_a-zA-Z0-9]//g'`"; then
+      { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; }
+    fi
+    ac_package=`echo $ac_package| sed 's/-/_/g'`
+    case "$ac_option" in
+      *=*) ;;
+      *) ac_optarg=yes ;;
+    esac
+    eval "with_${ac_package}='$ac_optarg'" ;;
+
+  -without-* | --without-*)
+    ac_package=`echo $ac_option|sed -e 's/-*without-//'`
+    # Reject names that are not valid shell variable names.
+    if test -n "`echo $ac_package| sed 's/[-a-zA-Z0-9_]//g'`"; then
+      { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; }
+    fi
+    ac_package=`echo $ac_package| sed 's/-/_/g'`
+    eval "with_${ac_package}=no" ;;
+
+  --x)
+    # Obsolete; use --with-x.
+    with_x=yes ;;
+
+  -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \
+  | --x-incl | --x-inc | --x-in | --x-i)
+    ac_prev=x_includes ;;
+  -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \
+  | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*)
+    x_includes="$ac_optarg" ;;
+
+  -x-libraries | --x-libraries | --x-librarie | --x-librari \
+  | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l)
+    ac_prev=x_libraries ;;
+  -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \
+  | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*)
+    x_libraries="$ac_optarg" ;;
+
+  -*) { echo "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; }
+    ;;
+
+  *)
+    if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then
+      echo "configure: warning: $ac_option: invalid host type" 1>&2
+    fi
+    if test "x$nonopt" != xNONE; then
+      { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; }
+    fi
+    nonopt="$ac_option"
+    ;;
+
+  esac
+done
+
+if test -n "$ac_prev"; then
+  { echo "configure: error: missing argument to --`echo $ac_prev | sed 's/_/-/g'`" 1>&2; exit 1; }
+fi
+
+trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15
+
+# File descriptor usage:
+# 0 standard input
+# 1 file creation
+# 2 errors and warnings
+# 3 some systems may open it to /dev/tty
+# 4 used on the Kubota Titan
+# 6 checking for... messages and results
+# 5 compiler messages saved in config.log
+if test "$silent" = yes; then
+  exec 6>/dev/null
+else
+  exec 6>&1
+fi
+exec 5>./config.log
+
+echo "\
+This file contains any messages produced by compilers while
+running configure, to aid debugging if configure makes a mistake.
+" 1>&5
+
+# Strip out --no-create and --no-recursion so they do not pile up.
+# Also quote any args containing shell metacharacters.
+ac_configure_args=
+for ac_arg
+do
+  case "$ac_arg" in
+  -no-create | --no-create | --no-creat | --no-crea | --no-cre \
+  | --no-cr | --no-c) ;;
+  -no-recursion | --no-recursion | --no-recursio | --no-recursi \
+  | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;;
+  *" "*|*"	"*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*)
+  ac_configure_args="$ac_configure_args '$ac_arg'" ;;
+  *) ac_configure_args="$ac_configure_args $ac_arg" ;;
+  esac
+done
+
+# NLS nuisances.
+# Only set these to C if already set.  These must not be set unconditionally
+# because not all systems understand e.g. LANG=C (notably SCO).
+# Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'!
+# Non-C LC_CTYPE values break the ctype check.
+if test "${LANG+set}"   = set; then LANG=C;   export LANG;   fi
+if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi
+if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi
+if test "${LC_CTYPE+set}"    = set; then LC_CTYPE=C;    export LC_CTYPE;    fi
+
+# confdefs.h avoids OS command line length limits that DEFS can exceed.
+rm -rf conftest* confdefs.h
+# AIX cpp loses on an empty file, so make sure it contains at least a newline.
+echo > confdefs.h
+
+# A filename unique to this package, relative to the directory that
+# configure is in, which we can look for to find out if srcdir is correct.
+ac_unique_file=agent/mibgroup/ucd-snmp/extensible.c
+
+# Find the source files, if location was not specified.
+if test -z "$srcdir"; then
+  ac_srcdir_defaulted=yes
+  # Try the directory containing this script, then its parent.
+  ac_prog=$0
+  ac_confdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'`
+  test "x$ac_confdir" = "x$ac_prog" && ac_confdir=.
+  srcdir=$ac_confdir
+  if test ! -r $srcdir/$ac_unique_file; then
+    srcdir=..
+  fi
+else
+  ac_srcdir_defaulted=no
+fi
+if test ! -r $srcdir/$ac_unique_file; then
+  if test "$ac_srcdir_defaulted" = yes; then
+    { echo "configure: error: can not find sources in $ac_confdir or .." 1>&2; exit 1; }
+  else
+    { echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; }
+  fi
+fi
+srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'`
+
+# Prefer explicitly selected file to automatically selected ones.
+if test -z "$CONFIG_SITE"; then
+  if test "x$prefix" != xNONE; then
+    CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site"
+  else
+    CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site"
+  fi
+fi
+for ac_site_file in $CONFIG_SITE; do
+  if test -r "$ac_site_file"; then
+    echo "loading site script $ac_site_file"
+    . "$ac_site_file"
+  fi
+done
+
+if test -r "$cache_file"; then
+  echo "loading cache $cache_file"
+  . $cache_file
+else
+  echo "creating cache $cache_file"
+  > $cache_file
+fi
+
+ac_ext=c
+# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
+ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
+cross_compiling=$ac_cv_prog_cc_cross
+
+ac_exeext=
+ac_objext=o
+if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then
+  # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu.
+  if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then
+    ac_n= ac_c='
+' ac_t='	'
+  else
+    ac_n=-n ac_c= ac_t=
+  fi
+else
+  ac_n= ac_c='\c' ac_t=
+fi
+
+
+
+
+  rm -f configure-summary
+
+
+cat >> confdefs.h <<EOF
+#define CONFIGURE_OPTIONS "\"$ac_configure_args\""
+EOF
+
+CONFIGURE_OPTIONS="\"$ac_configure_args\""
+
+
+# Check whether --with-cc or --without-cc was given.
+if test "${with_cc+set}" = set; then
+  withval="$with_cc"
+  CC=$with_cc;export CC
+fi
+
+
+# Check whether --with-ar or --without-ar was given.
+if test "${with_ar+set}" = set; then
+  withval="$with_ar"
+  AR=$with_ar; export AR
+fi
+
+
+# Check whether --with-endianness or --without-endianness was given.
+if test "${with_endianness+set}" = set; then
+  withval="$with_endianness"
+  if test $with_endianness != "big" -a $with_endianness != "little" ; then
+       { echo "configure: error: Endianness must be big or little, not \"$with_endianness\"." 1>&2; exit 1; };
+     fi
+
+fi
+
+
+# Check whether --with-cflags or --without-cflags was given.
+if test "${with_cflags+set}" = set; then
+  withval="$with_cflags"
+  CFLAGS=$with_cflags; export CFLAGS
+fi
+
+
+# Check whether --with-ldflags or --without-ldflags was given.
+if test "${with_ldflags+set}" = set; then
+  withval="$with_ldflags"
+  LDFLAGS=$with_ldflags; export LDFLAGS
+fi
+
+
+# Check whether --with-libs or --without-libs was given.
+if test "${with_libs+set}" = set; then
+  withval="$with_libs"
+  LIBS=$with_libs; export LIBS
+fi
+
+
+# Check whether --enable-silent-libtool or --disable-silent-libtool was given.
+if test "${enable_silent_libtool+set}" = set; then
+  enableval="$enable_silent_libtool"
+  LIBTOOLFLAGS=--silent
+fi
+
+
+
+# Check whether --enable-mini_agent or --disable-mini_agent was given.
+if test "${enable_mini_agent+set}" = set; then
+  enableval="$enable_mini_agent"
+  mini_agent="yes"
+else
+  mini_agent="no"
+fi
+
+
+# Check whether --enable-ipv6 or --disable-ipv6 was given.
+if test "${enable_ipv6+set}" = set; then
+  enableval="$enable_ipv6"
+  if test "x$enable_ipv6" = "xyes"; then
+      cat >> confdefs.h <<\EOF
+#define INET6 1
+EOF
+
+    fi
+fi
+
+
+# Check whether --enable-debugging or --disable-debugging was given.
+if test "${enable_debugging+set}" = set; then
+  enableval="$enable_debugging"
+  cat >> confdefs.h <<\EOF
+#define SNMP_ALWAYS_DEBUG 1
+EOF
+
+fi
+
+
+# Check whether --enable-developer or --disable-developer was given.
+if test "${enable_developer+set}" = set; then
+  enableval="$enable_developer"
+  developer=yes
+fi
+
+
+if test "x$enable_debugging" = "xno"; then
+    cat >> confdefs.h <<\EOF
+#define SNMP_NO_DEBUGGING 1
+EOF
+
+fi
+
+# Check whether --with-dmalloc or --without-dmalloc was given.
+if test "${with_dmalloc+set}" = set; then
+  withval="$with_dmalloc"
+  if test "x$withval" = "xyes"; then
+      LIBS="$LIBS -ldmalloc"
+      cat >> confdefs.h <<\EOF
+#define HAVE_DMALLOC_H 1
+EOF
+
+    elif test -d "$withval"; then
+      
+  if test "x$withval" != x -a -d $withval; then
+     if test -d $withval/lib; then
+       LDFLAGS="-L$withval/lib $LDFLAGS"
+     fi
+     if test -d $withval/include; then
+	CPPFLAGS="-I$withval/include $CPPFLAGS"
+     fi
+  fi
+
+      LIBS="$LIBS -ldmalloc"
+      cat >> confdefs.h <<\EOF
+#define HAVE_DMALLOC_H 1
+EOF
+
+    fi
+
+fi
+
+
+
+# Check whether --with-efence or --without-efence was given.
+if test "${with_efence+set}" = set; then
+  withval="$with_efence"
+  use_efence="$withval"
+fi
+
+
+tryrsaref=no
+# Check whether --with-rsaref or --without-rsaref was given.
+if test "${with_rsaref+set}" = set; then
+  withval="$with_rsaref"
+  if test "x$withval" = "xyes"; then
+      tryrsaref=yes
+    elif test "x$withval" = "xno"; then
+      tryrsaref=no
+    elif test -d "$withval"; then
+      
+  if test "x$withval" != x -a -d $withval; then
+     if test -d $withval/lib; then
+       LDFLAGS="-L$withval/lib $LDFLAGS"
+     fi
+     if test -d $withval/include; then
+	CPPFLAGS="-I$withval/include $CPPFLAGS"
+     fi
+  fi
+
+      tryrsaref=yes
+    fi
+fi
+
+
+tryopenssl=defaultyes
+askedopenssl=no
+# Check whether --with-openssl or --without-openssl was given.
+if test "${with_openssl+set}" = set; then
+  withval="$with_openssl"
+  if test "x$withval" = "xyes"; then
+      tryopenssl=yes
+      askedopenssl=yes
+    elif test "x$withval" = "xno"; then
+      tryopenssl=no
+    elif test -d "$withval"; then
+      
+  if test "x$withval" != x -a -d $withval; then
+     if test -d $withval/lib; then
+       LDFLAGS="-L$withval/lib $LDFLAGS"
+     fi
+     if test -d $withval/include; then
+	CPPFLAGS="-I$withval/include $CPPFLAGS"
+     fi
+  fi
+
+      tryopenssl=yes
+      askedopenssl=yes
+    fi
+fi
+
+if test "x$tryopenssl" = "xdefaultyes"; then
+      
+  if test "x/usr/local/ssl" != x -a -d /usr/local/ssl; then
+     if test -d /usr/local/ssl/lib; then
+       LDFLAGS="-L/usr/local/ssl/lib $LDFLAGS"
+     fi
+     if test -d /usr/local/ssl/include; then
+	CPPFLAGS="-I/usr/local/ssl/include $CPPFLAGS"
+     fi
+  fi
+
+      tryopenssl=yes
+fi
+
+
+# Check whether --enable-privacy or --disable-privacy was given.
+if test "${enable_privacy+set}" = set; then
+  enableval="$enable_privacy"
+  :
+fi
+
+if test "x$enable_privacy" != "xno"; then
+  cat >> confdefs.h <<\EOF
+#define SCAPI_AUTHPRIV 1
+EOF
+
+fi
+
+# Check whether --enable-internal-md5 or --disable-internal-md5 was given.
+if test "${enable_internal_md5+set}" = set; then
+  enableval="$enable_internal_md5"
+  cat >> confdefs.h <<\EOF
+#define USE_INTERNAL_MD5 1
+EOF
+
+fi
+
+
+
+# Check whether --with-opaque-special-types or --without-opaque-special-types was given.
+if test "${with_opaque_special_types+set}" = set; then
+  withval="$with_opaque_special_types"
+  :
+fi
+
+
+# Check whether --with-mibdirs or --without-mibdirs was given.
+if test "${with_mibdirs+set}" = set; then
+  withval="$with_mibdirs"
+  DEFAULT_MIBDIRS="$with_mibdirs"
+    cat >> confdefs.h <<EOF
+#define DEFAULT_MIBDIRS "$with_mibdirs"
+EOF
+
+fi
+
+
+# Check whether --with-mibs or --without-mibs was given.
+if test "${with_mibs+set}" = set; then
+  withval="$with_mibs"
+  DEFAULT_MIBS="$with_mibs"
+fi
+
+
+# Check whether --with-mibfiles or --without-mibfiles was given.
+if test "${with_mibfiles+set}" = set; then
+  withval="$with_mibfiles"
+  cat >> confdefs.h <<EOF
+#define DEFAULT_MIBFILES "$with_mibfiles"
+EOF
+
+fi
+
+
+
+# Check whether --enable-testing-code or --disable-testing-code was given.
+if test "${enable_testing_code+set}" = set; then
+  enableval="$enable_testing_code"
+  cat >> confdefs.h <<\EOF
+#define SNMP_TESTING_CODE 1
+EOF
+
+fi
+
+
+# Check whether --enable-reentrant or --disable-reentrant was given.
+if test "${enable_reentrant+set}" = set; then
+  enableval="$enable_reentrant"
+  with_res_locks="yes"
+else
+  with_res_locks="no"
+fi
+
+
+# Check whether --with-root-access or --without-root-access was given.
+if test "${with_root_access+set}" = set; then
+  withval="$with_root_access"
+  :
+fi
+
+
+# Check whether --with-kmem-usage or --without-kmem-usage was given.
+if test "${with_kmem_usage+set}" = set; then
+  withval="$with_kmem_usage"
+  :
+fi
+
+
+# Check whether --with-dummy-values or --without-dummy-values was given.
+if test "${with_dummy_values+set}" = set; then
+  withval="$with_dummy_values"
+  :
+fi
+
+
+# Check whether --with-persistent-directory or --without-persistent-directory was given.
+if test "${with_persistent_directory+set}" = set; then
+  withval="$with_persistent_directory"
+  ac_cv_user_prompt_PERSISTENT_DIRECTORY="$with_persistent_directory"
+fi
+
+
+# Check whether --with-copy_persistent_files or --without-copy_persistent_files was given.
+if test "${with_copy_persistent_files+set}" = set; then
+  withval="$with_copy_persistent_files"
+  ac_cv_user_prompt_COPY_PERSISTENT_FILES="$with_copy_persistent_files"
+fi
+
+
+# Check whether --with-default-snmp-version or --without-default-snmp-version was given.
+if test "${with_default_snmp_version+set}" = set; then
+  withval="$with_default_snmp_version"
+  ac_cv_user_prompt_DEFAULT_SNMP_VERSION="$with_default_snmp_version"
+fi
+
+
+if test "x$ac_cv_user_prompt_DEFAULT_SNMP_VERSION" != "x"; then
+  if test "$ac_cv_user_prompt_DEFAULT_SNMP_VERSION" != "1" -a "$ac_cv_user_prompt_DEFAULT_SNMP_VERSION" != "2" -a "$ac_cv_user_prompt_DEFAULT_SNMP_VERSION" != "3"; then
+    { echo "configure: error: Illegal version number passed to --with-default-snmp-version" 1>&2; exit 1; }
+  fi
+fi
+
+# Check whether --with-sys_contact or --without-sys_contact was given.
+if test "${with_sys_contact+set}" = set; then
+  withval="$with_sys_contact"
+  ac_cv_user_prompt_SYS_CONTACT="$with_sys_contact"
+fi
+
+
+# Check whether --with-sys_location or --without-sys_location was given.
+if test "${with_sys_location+set}" = set; then
+  withval="$with_sys_location"
+  ac_cv_user_prompt_SYS_LOC="$with_sys_location"
+fi
+
+
+# Check whether --with-logfile or --without-logfile was given.
+if test "${with_logfile+set}" = set; then
+  withval="$with_logfile"
+  ac_cv_user_prompt_LOGFILE="$with_logfile"
+fi
+
+
+
+
+# Check whether --with-transports or --without-transports was given.
+if test "${with_transports+set}" = set; then
+  withval="$with_transports"
+  :
+fi
+
+# Check whether --with-out_transports or --without-out_transports was given.
+if test "${with_out_transports+set}" = set; then
+  withval="$with_out_transports"
+  :
+fi
+
+
+# Check whether --with-transport or --without-transport was given.
+if test "${with_transport+set}" = set; then
+  withval="$with_transport"
+  { echo "configure: error:  Invalid option. Use --with-transports instead " 1>&2; exit 1; }     
+fi
+
+# Check whether --with-out_transport or --without-out_transport was given.
+if test "${with_out_transport+set}" = set; then
+  withval="$with_out_transport"
+  { echo "configure: error:  Invalid option. Use --with-out-transports instead " 1>&2; exit 1; } 
+fi
+
+
+
+# Check whether --with-security-modules or --without-security-modules was given.
+if test "${with_security_modules+set}" = set; then
+  withval="$with_security_modules"
+  :
+fi
+
+
+
+# Check whether --with-mib_modules or --without-mib_modules was given.
+if test "${with_mib_modules+set}" = set; then
+  withval="$with_mib_modules"
+  :
+fi
+
+
+# Check whether --with-out_mib_modules or --without-out_mib_modules was given.
+if test "${with_out_mib_modules+set}" = set; then
+  withval="$with_out_mib_modules"
+  :
+fi
+
+
+
+# Check whether --with-enterprise-oid or --without-enterprise-oid was given.
+if test "${with_enterprise_oid+set}" = set; then
+  withval="$with_enterprise_oid"
+  
+  if test "$withval" = yes; then
+    { echo "configure: error:  Please provide a value for the enterprise number " 1>&2; exit 1; };
+  fi
+  cat >> confdefs.h <<EOF
+#define ENTERPRISE_OID $withval
+EOF
+
+  ent_oid="1,3,6,1,4,1,$withval"
+  cat >> confdefs.h <<EOF
+#define ENTERPRISE_MIB $ent_oid
+EOF
+
+  ent_dot_oid="1.3.6.1.4.1.$withval"
+  cat >> confdefs.h <<EOF
+#define ENTERPRISE_DOT_MIB $ent_dot_oid
+EOF
+
+  echo "$ac_t""using enterprise number $withval" 1>&6
+
+else
+  
+  echo "$ac_t""using default "enterprise.net-snmp"" 1>&6
+
+fi
+
+
+# Check whether --with-enterprise-sysoid or --without-enterprise-sysoid was given.
+if test "${with_enterprise_sysoid+set}" = set; then
+  withval="$with_enterprise_sysoid"
+  
+  if test "$withval" = yes; then
+    { echo "configure: error:  Please provide a base OID value " 1>&2; exit 1; };
+  fi
+  sys_oid=`echo "$withval" | sed 's/^\.//' | sed 's/\./\,/g'`
+  cat >> confdefs.h <<EOF
+#define SYSTEM_MIB $sys_oid
+EOF
+
+  sys_dot_oid=`echo "$withval" | sed 's/^\.//'`
+  cat >> confdefs.h <<EOF
+#define SYSTEM_DOT_MIB $sys_dot_oid
+EOF
+
+  sysoid_len=`echo "$withval" | sed 's/^\.//g' | awk -F\. '{ print NF }'`
+  cat >> confdefs.h <<EOF
+#define SYSTEM_DOT_MIB_LENGTH $sysoid_len
+EOF
+
+  echo "$ac_t""using enterprise sysOID $withval ...." 1>&6
+
+else
+  
+  echo "$ac_t""using default enterprise sysOID "NET-SNMP-MIB::netSnmpAgentOIDs..."" 1>&6
+
+fi
+
+
+# Check whether --with-enterprise-notification-oid or --without-enterprise-notification-oid was given.
+if test "${with_enterprise_notification_oid+set}" = set; then
+  withval="$with_enterprise_notification_oid"
+  
+  if test "$withval" = yes; then
+    { echo "configure: error:  Please provide a base OID value " 1>&2; exit 1; };
+  fi
+  notification_oid=`echo "$withval" | sed 's/^\.//' | sed 's/\./\,/g'`
+  cat >> confdefs.h <<EOF
+#define NOTIFICATION_MIB $notification_oid
+EOF
+
+  notification_dot_oid=`echo "$withval" | sed 's/^\.//'`
+  cat >> confdefs.h <<EOF
+#define NOTIFICATION_DOT_MIB $notification_dot_oid
+EOF
+
+  notificationoid_len=`echo "$withval" | sed 's/^\.//g' | awk -F\. '{ print NF }'`
+  cat >> confdefs.h <<EOF
+#define NOTIFICATION_DOT_MIB_LENGTH $notificationoid_len
+EOF
+
+  echo "$ac_t""using enterprise notifications $withval" 1>&6
+
+else
+  
+  echo "$ac_t""using default notifications "NET-SNMP-MIB::netSnmpNotifications"" 1>&6
+
+fi
+
+# Check whether --with-mib_module or --without-mib_module was given.
+if test "${with_mib_module+set}" = set; then
+  withval="$with_mib_module"
+  { echo "configure: error:  Invalid option. Use --with-mib-modules instead " 1>&2; exit 1; }     
+fi
+
+# Check whether --with-out_mib_module or --without-out_mib_module was given.
+if test "${with_out_mib_module+set}" = set; then
+  withval="$with_out_mib_module"
+  { echo "configure: error:  Invalid option. Use --with-out-mib-modules instead " 1>&2; exit 1; } 
+fi
+
+
+# Check whether --with-perl-modules or --without-perl-modules was given.
+if test "${with_perl_modules+set}" = set; then
+  withval="$with_perl_modules"
+  
+    install_perl=yes
+    if test "$withval" = yes; then
+      PERLARGS=""
+    else
+      PERLARGS="$withval"
+    fi
+
+fi
+
+
+# Check whether --enable-embedded-perl or --disable-embedded-perl was given.
+if test "${enable_embedded_perl+set}" = set; then
+  enableval="$enable_embedded_perl"
+  embed_perl="yes"
+else
+  embed_perl="no"
+fi
+
+
+# Check whether --with-defaults or --without-defaults was given.
+if test "${with_defaults+set}" = set; then
+  withval="$with_defaults"
+  defaults="yes"
+else
+  defaults="no"
+fi
+
+
+# Check whether --enable-ucd-snmp-compatibility or --disable-ucd-snmp-compatibility was given.
+if test "${enable_ucd_snmp_compatibility+set}" = set; then
+  enableval="$enable_ucd_snmp_compatibility"
+  ucd_compat=yes
+else
+  ucd_compat=no
+fi
+
+if test "x$ucd_compat" != "xno" ; then	
+  installucdheaders=installucdheaders
+  installucdlibs=installucdlibs
+  
+  cat >> configure-summary << EOF
+  UCD-SNMP compatability:     enabled
+EOF
+
+fi
+
+
+
+if test "x$with_root_access" = "xno"; then
+  cat >> confdefs.h <<\EOF
+#define NO_ROOT_ACCESS 1
+EOF
+
+fi
+
+if test "x$with_kmem_usage" = "xno"; then
+  cat >> confdefs.h <<\EOF
+#define NO_KMEM_USAGE 1
+EOF
+
+fi
+
+if test "x$with_dummy_values" != "xyes"; then
+  cat >> confdefs.h <<\EOF
+#define NO_DUMMY_VALUES 1
+EOF
+
+fi
+
+if test "x$with_opaque_special_types" != "xno"; then
+  cat >> confdefs.h <<\EOF
+#define OPAQUE_SPECIAL_TYPES 1
+EOF
+
+fi
+
+
+
+echo $ac_n "checking if I need to feed myself to ksh""... $ac_c" 1>&6
+echo "configure:1543: checking if I need to feed myself to ksh" >&5
+if test -f /hp-ux -a -f /bin/ksh; then
+  if (PATH=.; alias -x) >/dev/null 2>&1; then
+    echo "$ac_t""no" 1>&6
+  else
+    echo "$ac_t""yes" 1>&6
+    if test "x$1" = "x"; then
+      exec /bin/ksh $0
+    else
+      exec /bin/ksh $0 "$@"
+    fi
+  fi
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+if test "x$developer" != "xno" -a -f $srcdir/remove-files; then
+    developer="yes"
+fi
+
+if test "x$developer" = "xyes"; then
+    if test "${enable_shared+set}" != set; then
+    enable_shared=no
+  fi
+fi
+
+if test "x$embed_perl" = "xyes"; then
+    if test "x$enable_shared" != "xyes"; then
+      { echo "configure: error: --enable-embedded-perl requires --enable-shared" 1>&2; exit 1; }
+    fi
+fi
+
+# Extract the first word of "gcc", so it can be a program name with args.
+set dummy gcc; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:1578: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  if test -n "$CC"; then
+  ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS=":"
+  ac_dummy="$PATH"
+  for ac_dir in $ac_dummy; do
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/$ac_word; then
+      ac_cv_prog_CC="gcc"
+      break
+    fi
+  done
+  IFS="$ac_save_ifs"
+fi
+fi
+CC="$ac_cv_prog_CC"
+if test -n "$CC"; then
+  echo "$ac_t""$CC" 1>&6
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+if test -z "$CC"; then
+  # Extract the first word of "cc", so it can be a program name with args.
+set dummy cc; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:1608: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  if test -n "$CC"; then
+  ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS=":"
+  ac_prog_rejected=no
+  ac_dummy="$PATH"
+  for ac_dir in $ac_dummy; do
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/$ac_word; then
+      if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then
+        ac_prog_rejected=yes
+	continue
+      fi
+      ac_cv_prog_CC="cc"
+      break
+    fi
+  done
+  IFS="$ac_save_ifs"
+if test $ac_prog_rejected = yes; then
+  # We found a bogon in the path, so make sure we never use it.
+  set dummy $ac_cv_prog_CC
+  shift
+  if test $# -gt 0; then
+    # We chose a different compiler from the bogus one.
+    # However, it has the same basename, so the bogon will be chosen
+    # first if we set CC to just the basename; use the full file name.
+    shift
+    set dummy "$ac_dir/$ac_word" "$@"
+    shift
+    ac_cv_prog_CC="$@"
+  fi
+fi
+fi
+fi
+CC="$ac_cv_prog_CC"
+if test -n "$CC"; then
+  echo "$ac_t""$CC" 1>&6
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+  if test -z "$CC"; then
+    case "`uname -s`" in
+    *win32* | *WIN32*)
+      # Extract the first word of "cl", so it can be a program name with args.
+set dummy cl; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:1659: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  if test -n "$CC"; then
+  ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS=":"
+  ac_dummy="$PATH"
+  for ac_dir in $ac_dummy; do
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/$ac_word; then
+      ac_cv_prog_CC="cl"
+      break
+    fi
+  done
+  IFS="$ac_save_ifs"
+fi
+fi
+CC="$ac_cv_prog_CC"
+if test -n "$CC"; then
+  echo "$ac_t""$CC" 1>&6
+else
+  echo "$ac_t""no" 1>&6
+fi
+ ;;
+    esac
+  fi
+  test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; }
+fi
+
+echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6
+echo "configure:1691: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
+
+ac_ext=c
+# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
+ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
+cross_compiling=$ac_cv_prog_cc_cross
+
+cat > conftest.$ac_ext << EOF
+
+#line 1702 "configure"
+#include "confdefs.h"
+
+main(){return(0);}
+EOF
+if { (eval echo configure:1707: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  ac_cv_prog_cc_works=yes
+  # If we can't run a trivial program, we are probably using a cross compiler.
+  if (./conftest; exit) 2>/dev/null; then
+    ac_cv_prog_cc_cross=no
+  else
+    ac_cv_prog_cc_cross=yes
+  fi
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  ac_cv_prog_cc_works=no
+fi
+rm -fr conftest*
+ac_ext=c
+# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
+ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
+cross_compiling=$ac_cv_prog_cc_cross
+
+echo "$ac_t""$ac_cv_prog_cc_works" 1>&6
+if test $ac_cv_prog_cc_works = no; then
+  { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; }
+fi
+echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6
+echo "configure:1733: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
+echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6
+cross_compiling=$ac_cv_prog_cc_cross
+
+echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6
+echo "configure:1738: checking whether we are using GNU C" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.c <<EOF
+#ifdef __GNUC__
+  yes;
+#endif
+EOF
+if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1747: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
+  ac_cv_prog_gcc=yes
+else
+  ac_cv_prog_gcc=no
+fi
+fi
+
+echo "$ac_t""$ac_cv_prog_gcc" 1>&6
+
+if test $ac_cv_prog_gcc = yes; then
+  GCC=yes
+else
+  GCC=
+fi
+
+ac_test_CFLAGS="${CFLAGS+set}"
+ac_save_CFLAGS="$CFLAGS"
+CFLAGS=
+echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
+echo "configure:1766: checking whether ${CC-cc} accepts -g" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  echo 'void f(){}' > conftest.c
+if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then
+  ac_cv_prog_cc_g=yes
+else
+  ac_cv_prog_cc_g=no
+fi
+rm -f conftest*
+
+fi
+
+echo "$ac_t""$ac_cv_prog_cc_g" 1>&6
+if test "$ac_test_CFLAGS" = set; then
+  CFLAGS="$ac_save_CFLAGS"
+elif test $ac_cv_prog_cc_g = yes; then
+  if test "$GCC" = yes; then
+    CFLAGS="-g -O2"
+  else
+    CFLAGS="-g"
+  fi
+else
+  if test "$GCC" = yes; then
+    CFLAGS="-O2"
+  else
+    CFLAGS=
+  fi
+fi
+
+echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
+echo "configure:1798: checking how to run the C preprocessor" >&5
+# On Suns, sometimes $CPP names a directory.
+if test -n "$CPP" && test -d "$CPP"; then
+  CPP=
+fi
+if test -z "$CPP"; then
+if eval "test \"`echo '$''{'ac_cv_prog_CPP'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+    # This must be in double quotes, not single quotes, because CPP may get
+  # substituted into the Makefile and "${CC-cc}" will confuse make.
+  CPP="${CC-cc} -E"
+  # On the NeXT, cc -E runs the code through the compiler's parser,
+  # not just through cpp.
+  cat > conftest.$ac_ext <<EOF
+#line 1813 "configure"
+#include "confdefs.h"
+#include <assert.h>
+Syntax Error
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:1819: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+  :
+else
+  echo "$ac_err" >&5
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  CPP="${CC-cc} -E -traditional-cpp"
+  cat > conftest.$ac_ext <<EOF
+#line 1830 "configure"
+#include "confdefs.h"
+#include <assert.h>
+Syntax Error
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:1836: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+  :
+else
+  echo "$ac_err" >&5
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  CPP="${CC-cc} -nologo -E"
+  cat > conftest.$ac_ext <<EOF
+#line 1847 "configure"
+#include "confdefs.h"
+#include <assert.h>
+Syntax Error
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:1853: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+  :
+else
+  echo "$ac_err" >&5
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  CPP=/lib/cpp
+fi
+rm -f conftest*
+fi
+rm -f conftest*
+fi
+rm -f conftest*
+  ac_cv_prog_CPP="$CPP"
+fi
+  CPP="$ac_cv_prog_CPP"
+else
+  ac_cv_prog_CPP="$CPP"
+fi
+echo "$ac_t""$CPP" 1>&6
+
+echo $ac_n "checking for AIX""... $ac_c" 1>&6
+echo "configure:1878: checking for AIX" >&5
+cat > conftest.$ac_ext <<EOF
+#line 1880 "configure"
+#include "confdefs.h"
+#ifdef _AIX
+  yes
+#endif
+
+EOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  egrep "yes" >/dev/null 2>&1; then
+  rm -rf conftest*
+  echo "$ac_t""yes" 1>&6; cat >> confdefs.h <<\EOF
+#define _ALL_SOURCE 1
+EOF
+
+else
+  rm -rf conftest*
+  echo "$ac_t""no" 1>&6
+fi
+rm -f conftest*
+
+
+echo $ac_n "checking for Cygwin environment""... $ac_c" 1>&6
+echo "configure:1902: checking for Cygwin environment" >&5
+if eval "test \"`echo '$''{'ac_cv_cygwin'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 1907 "configure"
+#include "confdefs.h"
+
+int main() {
+
+#ifndef __CYGWIN__
+#define __CYGWIN__ __CYGWIN32__
+#endif
+return __CYGWIN__;
+; return 0; }
+EOF
+if { (eval echo configure:1918: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  ac_cv_cygwin=yes
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  ac_cv_cygwin=no
+fi
+rm -f conftest*
+rm -f conftest*
+fi
+
+echo "$ac_t""$ac_cv_cygwin" 1>&6
+CYGWIN=
+test "$ac_cv_cygwin" = yes && CYGWIN=yes
+echo $ac_n "checking for mingw32 environment""... $ac_c" 1>&6
+echo "configure:1935: checking for mingw32 environment" >&5
+if eval "test \"`echo '$''{'ac_cv_mingw32'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 1940 "configure"
+#include "confdefs.h"
+
+int main() {
+return __MINGW32__;
+; return 0; }
+EOF
+if { (eval echo configure:1947: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  ac_cv_mingw32=yes
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  ac_cv_mingw32=no
+fi
+rm -f conftest*
+rm -f conftest*
+fi
+
+echo "$ac_t""$ac_cv_mingw32" 1>&6
+MINGW32=
+test "$ac_cv_mingw32" = yes && MINGW32=yes
+
+
+echo $ac_n "checking for executable suffix""... $ac_c" 1>&6
+echo "configure:1966: checking for executable suffix" >&5
+if eval "test \"`echo '$''{'ac_cv_exeext'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  if test "$CYGWIN" = yes || test "$MINGW32" = yes; then
+  ac_cv_exeext=.exe
+else
+  rm -f conftest*
+  echo 'int main () { return 0; }' > conftest.$ac_ext
+  ac_cv_exeext=
+  if { (eval echo configure:1976: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
+    for file in conftest.*; do
+      case $file in
+      *.c | *.o | *.obj) ;;
+      *) ac_cv_exeext=`echo $file | sed -e s/conftest//` ;;
+      esac
+    done
+  else
+    { echo "configure: error: installation or configuration problem: compiler cannot create executables." 1>&2; exit 1; }
+  fi
+  rm -f conftest*
+  test x"${ac_cv_exeext}" = x && ac_cv_exeext=no
+fi
+fi
+
+EXEEXT=""
+test x"${ac_cv_exeext}" != xno && EXEEXT=${ac_cv_exeext}
+echo "$ac_t""${ac_cv_exeext}" 1>&6
+ac_exeext=$EXEEXT
+
+
+
+
+ac_aux_dir=
+for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do
+  if test -f $ac_dir/install-sh; then
+    ac_aux_dir=$ac_dir
+    ac_install_sh="$ac_aux_dir/install-sh -c"
+    break
+  elif test -f $ac_dir/install.sh; then
+    ac_aux_dir=$ac_dir
+    ac_install_sh="$ac_aux_dir/install.sh -c"
+    break
+  fi
+done
+if test -z "$ac_aux_dir"; then
+  { echo "configure: error: can not find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." 1>&2; exit 1; }
+fi
+ac_config_guess=$ac_aux_dir/config.guess
+ac_config_sub=$ac_aux_dir/config.sub
+ac_configure=$ac_aux_dir/configure # This should be Cygnus configure.
+
+# Find the correct PATH separator.  Usually this is `:', but
+# DJGPP uses `;' like DOS.
+if test "X${PATH_SEPARATOR+set}" != Xset; then
+  UNAME=${UNAME-`uname 2>/dev/null`}
+  case X$UNAME in
+    *-DOS) lt_cv_sys_path_separator=';' ;;
+    *)     lt_cv_sys_path_separator=':' ;;
+  esac
+  PATH_SEPARATOR=$lt_cv_sys_path_separator
+fi
+
+# Check whether --enable-shared or --disable-shared was given.
+if test "${enable_shared+set}" = set; then
+  enableval="$enable_shared"
+  p=${PACKAGE-default}
+case $enableval in
+yes) enable_shared=yes ;;
+no) enable_shared=no ;;
+*)
+  enable_shared=no
+  # Look at the argument we got.  We use all the common list separators.
+  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
+  for pkg in $enableval; do
+    if test "X$pkg" = "X$p"; then
+      enable_shared=yes
+    fi
+  done
+  IFS="$ac_save_ifs"
+  ;;
+esac
+else
+  enable_shared=yes
+fi
+
+# Check whether --enable-static or --disable-static was given.
+if test "${enable_static+set}" = set; then
+  enableval="$enable_static"
+  p=${PACKAGE-default}
+case $enableval in
+yes) enable_static=yes ;;
+no) enable_static=no ;;
+*)
+  enable_static=no
+  # Look at the argument we got.  We use all the common list separators.
+  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
+  for pkg in $enableval; do
+    if test "X$pkg" = "X$p"; then
+      enable_static=yes
+    fi
+  done
+  IFS="$ac_save_ifs"
+  ;;
+esac
+else
+  enable_static=yes
+fi
+
+# Check whether --enable-fast-install or --disable-fast-install was given.
+if test "${enable_fast_install+set}" = set; then
+  enableval="$enable_fast_install"
+  p=${PACKAGE-default}
+case $enableval in
+yes) enable_fast_install=yes ;;
+no) enable_fast_install=no ;;
+*)
+  enable_fast_install=no
+  # Look at the argument we got.  We use all the common list separators.
+  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
+  for pkg in $enableval; do
+    if test "X$pkg" = "X$p"; then
+      enable_fast_install=yes
+    fi
+  done
+  IFS="$ac_save_ifs"
+  ;;
+esac
+else
+  enable_fast_install=yes
+fi
+
+
+# Make sure we can run config.sub.
+if ${CONFIG_SHELL-/bin/sh} $ac_config_sub sun4 >/dev/null 2>&1; then :
+else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; }
+fi
+
+echo $ac_n "checking host system type""... $ac_c" 1>&6
+echo "configure:2105: checking host system type" >&5
+
+host_alias=$host
+case "$host_alias" in
+NONE)
+  case $nonopt in
+  NONE)
+    if host_alias=`${CONFIG_SHELL-/bin/sh} $ac_config_guess`; then :
+    else { echo "configure: error: can not guess host type; you must specify one" 1>&2; exit 1; }
+    fi ;;
+  *) host_alias=$nonopt ;;
+  esac ;;
+esac
+
+host=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $host_alias`
+host_cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
+host_vendor=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
+host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
+echo "$ac_t""$host" 1>&6
+
+echo $ac_n "checking build system type""... $ac_c" 1>&6
+echo "configure:2126: checking build system type" >&5
+
+build_alias=$build
+case "$build_alias" in
+NONE)
+  case $nonopt in
+  NONE) build_alias=$host_alias ;;
+  *) build_alias=$nonopt ;;
+  esac ;;
+esac
+
+build=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $build_alias`
+build_cpu=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
+build_vendor=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
+build_os=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
+echo "$ac_t""$build" 1>&6
+
+# Check whether --with-gnu-ld or --without-gnu-ld was given.
+if test "${with_gnu_ld+set}" = set; then
+  withval="$with_gnu_ld"
+  test "$withval" = no || with_gnu_ld=yes
+else
+  with_gnu_ld=no
+fi
+
+ac_prog=ld
+if test "$GCC" = yes; then
+  # Check if gcc -print-prog-name=ld gives a path.
+  echo $ac_n "checking for ld used by GCC""... $ac_c" 1>&6
+echo "configure:2155: checking for ld used by GCC" >&5
+  case $host in
+  *-*-mingw*)
+    # gcc leaves a trailing carriage return which upsets mingw
+    ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
+  *)
+    ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
+  esac
+  case $ac_prog in
+    # Accept absolute paths.
+    [\\/]* | [A-Za-z]:[\\/]*)
+      re_direlt='/[^/][^/]*/\.\./'
+      # Canonicalize the path of ld
+      ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'`
+      while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
+	ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
+      done
+      test -z "$LD" && LD="$ac_prog"
+      ;;
+  "")
+    # If it fails, then pretend we aren't using GCC.
+    ac_prog=ld
+    ;;
+  *)
+    # If it is relative, then search for the first ld in PATH.
+    with_gnu_ld=unknown
+    ;;
+  esac
+elif test "$with_gnu_ld" = yes; then
+  echo $ac_n "checking for GNU ld""... $ac_c" 1>&6
+echo "configure:2185: checking for GNU ld" >&5
+else
+  echo $ac_n "checking for non-GNU ld""... $ac_c" 1>&6
+echo "configure:2188: checking for non-GNU ld" >&5
+fi
+if eval "test \"`echo '$''{'lt_cv_path_LD'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  if test -z "$LD"; then
+  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+  for ac_dir in $PATH; do
+    test -z "$ac_dir" && ac_dir=.
+    if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
+      lt_cv_path_LD="$ac_dir/$ac_prog"
+      # Check to see if the program is GNU ld.  I'd rather use --version,
+      # but apparently some GNU ld's only accept -v.
+      # Break only if it was the GNU/non-GNU ld that we prefer.
+      if "$lt_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then
+	test "$with_gnu_ld" != no && break
+      else
+	test "$with_gnu_ld" != yes && break
+      fi
+    fi
+  done
+  IFS="$ac_save_ifs"
+else
+  lt_cv_path_LD="$LD" # Let the user override the test with a path.
+fi
+fi
+
+LD="$lt_cv_path_LD"
+if test -n "$LD"; then
+  echo "$ac_t""$LD" 1>&6
+else
+  echo "$ac_t""no" 1>&6
+fi
+test -z "$LD" && { echo "configure: error: no acceptable ld found in \$PATH" 1>&2; exit 1; }
+echo $ac_n "checking if the linker ($LD) is GNU ld""... $ac_c" 1>&6
+echo "configure:2223: checking if the linker ($LD) is GNU ld" >&5
+if eval "test \"`echo '$''{'lt_cv_prog_gnu_ld'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  # I'd rather use --version here, but apparently some GNU ld's only accept -v.
+if $LD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then
+  lt_cv_prog_gnu_ld=yes
+else
+  lt_cv_prog_gnu_ld=no
+fi
+fi
+
+echo "$ac_t""$lt_cv_prog_gnu_ld" 1>&6
+with_gnu_ld=$lt_cv_prog_gnu_ld
+
+
+echo $ac_n "checking for $LD option to reload object files""... $ac_c" 1>&6
+echo "configure:2240: checking for $LD option to reload object files" >&5
+if eval "test \"`echo '$''{'lt_cv_ld_reload_flag'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  lt_cv_ld_reload_flag='-r'
+fi
+
+echo "$ac_t""$lt_cv_ld_reload_flag" 1>&6
+reload_flag=$lt_cv_ld_reload_flag
+test -n "$reload_flag" && reload_flag=" $reload_flag"
+
+echo $ac_n "checking for BSD-compatible nm""... $ac_c" 1>&6
+echo "configure:2252: checking for BSD-compatible nm" >&5
+if eval "test \"`echo '$''{'lt_cv_path_NM'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  if test -n "$NM"; then
+  # Let the user override the test.
+  lt_cv_path_NM="$NM"
+else
+  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+  for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do
+    test -z "$ac_dir" && ac_dir=.
+    tmp_nm=$ac_dir/${ac_tool_prefix}nm
+    if test -f $tmp_nm || test -f $tmp_nm$ac_exeext ; then
+      # Check to see if the nm accepts a BSD-compat flag.
+      # Adding the `sed 1q' prevents false positives on HP-UX, which says:
+      #   nm: unknown option "B" ignored
+      # Tru64's nm complains that /dev/null is an invalid object file
+      if ($tmp_nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep '(/dev/null|Invalid file or object type)' >/dev/null; then
+	lt_cv_path_NM="$tmp_nm -B"
+	break
+      elif ($tmp_nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
+	lt_cv_path_NM="$tmp_nm -p"
+	break
+      else
+	lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but
+	continue # so that we can try to find one that supports BSD flags
+      fi
+    fi
+  done
+  IFS="$ac_save_ifs"
+  test -z "$lt_cv_path_NM" && lt_cv_path_NM=nm
+fi
+fi
+
+NM="$lt_cv_path_NM"
+echo "$ac_t""$NM" 1>&6
+
+echo $ac_n "checking for a sed that does not truncate output""... $ac_c" 1>&6
+echo "configure:2290: checking for a sed that does not truncate output" >&5
+if eval "test \"`echo '$''{'lt_cv_path_SED'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  # Loop through the user's path and test for sed and gsed.
+# Then use that list of sed's as ones to test for truncation.
+as_executable_p="test -f"
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_prog in sed gsed; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
+      if $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then
+        _sed_list="$_sed_list $as_dir/$ac_prog$ac_exec_ext"
+      fi
+    done
+  done
+done
+
+  # Create a temporary directory, and hook for its removal unless debugging.
+$debug ||
+{
+  trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0
+  trap '{ (exit 1); exit 1; }' 1 2 13 15
+}
+
+# Create a (secure) tmp directory for tmp files.
+: ${TMPDIR=/tmp}
+{
+  tmp=`(umask 077 && mktemp -d -q "$TMPDIR/sedXXXXXX") 2>/dev/null` &&
+  test -n "$tmp" && test -d "$tmp"
+}  ||
+{
+  tmp=$TMPDIR/sed$$-$RANDOM
+  (umask 077 && mkdir $tmp)
+} ||
+{
+   echo "$me: cannot create a temporary directory in $TMPDIR" >&2
+   { (exit 1); exit 1; }
+}
+  _max=0
+  _count=0
+  # Add /usr/xpg4/bin/sed as it is typically found on Solaris
+  # along with /bin/sed that truncates output.
+  for _sed in $_sed_list /usr/xpg4/bin/sed; do
+    test ! -f ${_sed} && break
+    cat /dev/null > "$tmp/sed.in"
+    _count=0
+    echo ${ECHO_N-$ac_n} "0123456789${ECHO_C-$ac_c}" >"$tmp/sed.in"
+    # Check for GNU sed and select it if it is found.
+    if "${_sed}" --version 2>&1 < /dev/null | egrep '(GNU)' > /dev/null; then
+      lt_cv_path_SED=${_sed}
+      break
+    fi
+    while true; do
+      cat "$tmp/sed.in" "$tmp/sed.in" >"$tmp/sed.tmp"
+      mv "$tmp/sed.tmp" "$tmp/sed.in"
+      cp "$tmp/sed.in" "$tmp/sed.nl"
+      echo >>"$tmp/sed.nl"
+      ${_sed} -e 's/a$//' < "$tmp/sed.nl" >"$tmp/sed.out" || break
+      cmp -s "$tmp/sed.out" "$tmp/sed.nl" || break
+      # 40000 chars as input seems more than enough
+      test $_count -gt 10 && break
+      _count=`expr $_count + 1`
+      if test $_count -gt $_max; then
+        _max=$_count
+        lt_cv_path_SED=$_sed
+      fi
+    done
+  done
+  rm -rf "$tmp"
+
+fi
+
+if test "X$SED" != "X"; then
+  lt_cv_path_SED=$SED
+else
+  SED=$lt_cv_path_SED
+fi
+echo "$ac_t""$SED" 1>&6
+
+echo $ac_n "checking whether ln -s works""... $ac_c" 1>&6
+echo "configure:2374: checking whether ln -s works" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_LN_S'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  rm -f conftestdata
+if ln -s X conftestdata 2>/dev/null
+then
+  rm -f conftestdata
+  ac_cv_prog_LN_S="ln -s"
+else
+  ac_cv_prog_LN_S=ln
+fi
+fi
+LN_S="$ac_cv_prog_LN_S"
+if test "$ac_cv_prog_LN_S" = "ln -s"; then
+  echo "$ac_t""yes" 1>&6
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+echo $ac_n "checking how to recognise dependent libraries""... $ac_c" 1>&6
+echo "configure:2395: checking how to recognise dependent libraries" >&5
+if eval "test \"`echo '$''{'lt_cv_deplibs_check_method'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  lt_cv_file_magic_cmd='$MAGIC_CMD'
+lt_cv_file_magic_test_file=
+lt_cv_deplibs_check_method='unknown'
+# Need to set the preceding variable on all platforms that support
+# interlibrary dependencies.
+# 'none' -- dependencies not supported.
+# `unknown' -- same as none, but documents that we really don't know.
+# 'pass_all' -- all dependencies passed with no checks.
+# 'test_compile' -- check by making test program.
+# 'file_magic [[regex]]' -- check by looking for files in library path
+# which responds to the $file_magic_cmd with a given egrep regex.
+# If you have `file' or equivalent on your system and you're not sure
+# whether `pass_all' will *always* work, you probably want this one.
+
+case $host_os in
+aix4* | aix5*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+beos*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+bsdi4*)
+  lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)'
+  lt_cv_file_magic_cmd='/usr/bin/file -L'
+  lt_cv_file_magic_test_file=/shlib/libc.so
+  ;;
+
+cygwin* | mingw* | pw32*)
+  lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?'
+  lt_cv_file_magic_cmd='$OBJDUMP -f'
+  ;;
+
+darwin* | rhapsody*)
+  lt_cv_deplibs_check_method='file_magic Mach-O dynamically linked shared library'
+  lt_cv_file_magic_cmd='/usr/bin/file -L'
+  case "$host_os" in
+  rhapsody* | darwin1.[012])
+    lt_cv_file_magic_test_file=`echo /System/Library/Frameworks/System.framework/Versions/*/System | head -1`
+    ;;
+  *) # Darwin 1.3 on
+    lt_cv_file_magic_test_file='/usr/lib/libSystem.dylib'
+    ;;
+  esac
+  ;;
+
+freebsd*)
+  if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
+    case $host_cpu in
+    i*86 )
+      # Not sure whether the presence of OpenBSD here was a mistake.
+      # Let's accept both of them until this is cleared up.
+      lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD)/i[3-9]86 (compact )?demand paged shared library'
+      lt_cv_file_magic_cmd=/usr/bin/file
+      lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*`
+      ;;
+    esac
+  else
+    lt_cv_deplibs_check_method=pass_all
+  fi
+  ;;
+
+gnu*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+hpux10.20*|hpux11*)
+  lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9].[0-9]) shared library'
+  lt_cv_file_magic_cmd=/usr/bin/file
+  lt_cv_file_magic_test_file=/usr/lib/libc.sl
+  ;;
+
+irix5* | irix6* | nonstopux*)
+  case $host_os in
+  irix5* | nonstopux*)
+    # this will be overridden with pass_all, but let us keep it just in case
+    lt_cv_deplibs_check_method="file_magic ELF 32-bit MSB dynamic lib MIPS - version 1"
+    ;;
+  *)
+    case $LD in
+    *-32|*"-32 ") libmagic=32-bit;;
+    *-n32|*"-n32 ") libmagic=N32;;
+    *-64|*"-64 ") libmagic=64-bit;;
+    *) libmagic=never-match;;
+    esac
+    # this will be overridden with pass_all, but let us keep it just in case
+    lt_cv_deplibs_check_method="file_magic ELF ${libmagic} MSB mips-[1234] dynamic lib MIPS - version 1"
+    ;;
+  esac
+  lt_cv_file_magic_test_file=`echo /lib${libsuff}/libc.so*`
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+# This must be Linux ELF.
+linux-gnu*)
+  case $host_cpu in
+  alpha* | hppa* | i*86 | mips | mipsel | powerpc* | sparc* | ia64*)
+    lt_cv_deplibs_check_method=pass_all ;;
+  *)
+    # glibc up to 2.1.1 does not perform some relocations on ARM
+    lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )' ;;
+  esac
+  lt_cv_file_magic_test_file=`echo /lib/libc.so* /lib/libc-*.so`
+  ;;
+
+netbsd*)
+  if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
+    lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$'
+  else
+    lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so$'
+  fi
+  ;;
+
+newos6*)
+  lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (executable|dynamic lib)'
+  lt_cv_file_magic_cmd=/usr/bin/file
+  lt_cv_file_magic_test_file=/usr/lib/libnls.so
+  ;;
+
+openbsd*)
+  lt_cv_file_magic_cmd=/usr/bin/file
+  lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*`
+  if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+    lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB shared object'
+  else
+    lt_cv_deplibs_check_method='file_magic OpenBSD.* shared library'
+  fi
+  ;;
+
+osf3* | osf4* | osf5*)
+  # this will be overridden with pass_all, but let us keep it just in case
+  lt_cv_deplibs_check_method='file_magic COFF format alpha shared library'
+  lt_cv_file_magic_test_file=/shlib/libc.so
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+sco3.2v5*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+solaris*)
+  lt_cv_deplibs_check_method=pass_all
+  lt_cv_file_magic_test_file=/lib/libc.so
+  ;;
+
+sysv5uw[78]* | sysv4*uw2*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
+  case $host_vendor in
+  motorola)
+    lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib) M[0-9][0-9]* Version [0-9]'
+    lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*`
+    ;;
+  ncr)
+    lt_cv_deplibs_check_method=pass_all
+    ;;
+  sequent)
+    lt_cv_file_magic_cmd='/bin/file'
+    lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )'
+    ;;
+  sni)
+    lt_cv_file_magic_cmd='/bin/file'
+    lt_cv_deplibs_check_method="file_magic ELF [0-9][0-9]*-bit [LM]SB dynamic lib"
+    lt_cv_file_magic_test_file=/lib/libc.so
+    ;;
+  siemens)
+    lt_cv_deplibs_check_method=pass_all
+    ;;
+  esac
+  ;;
+esac
+
+fi
+
+echo "$ac_t""$lt_cv_deplibs_check_method" 1>&6
+file_magic_cmd=$lt_cv_file_magic_cmd
+deplibs_check_method=$lt_cv_deplibs_check_method
+
+echo $ac_n "checking for object suffix""... $ac_c" 1>&6
+echo "configure:2581: checking for object suffix" >&5
+if eval "test \"`echo '$''{'ac_cv_objext'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  rm -f conftest*
+echo 'int i = 1;' > conftest.$ac_ext
+if { (eval echo configure:2587: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  for ac_file in conftest.*; do
+    case $ac_file in
+    *.c) ;;
+    *) ac_cv_objext=`echo $ac_file | sed -e s/conftest.//` ;;
+    esac
+  done
+else
+  { echo "configure: error: installation or configuration problem; compiler does not work" 1>&2; exit 1; }
+fi
+rm -f conftest*
+fi
+
+echo "$ac_t""$ac_cv_objext" 1>&6
+OBJEXT=$ac_cv_objext
+ac_objext=$ac_cv_objext
+
+if test $host != $build; then
+  ac_tool_prefix=${host_alias}-
+else
+  ac_tool_prefix=
+fi
+
+
+
+
+# Check for command to grab the raw symbol name followed by C symbol from nm.
+echo $ac_n "checking command to parse $NM output""... $ac_c" 1>&6
+echo "configure:2615: checking command to parse $NM output" >&5
+if eval "test \"`echo '$''{'lt_cv_sys_global_symbol_pipe'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+# These are sane defaults that work on at least a few old systems.
+# [They come from Ultrix.  What could be older than Ultrix?!! ;)]
+
+# Character class describing NM global symbol codes.
+symcode='[BCDEGRST]'
+
+# Regexp to match symbols that can be accessed directly from C.
+sympat='\([_A-Za-z][_A-Za-z0-9]*\)'
+
+# Transform the above into a raw symbol and a C symbol.
+symxfrm='\1 \2\3 \3'
+
+# Transform an extracted symbol line into a proper C declaration
+lt_cv_global_symbol_to_cdecl="sed -n -e 's/^. .* \(.*\)$/extern char \1;/p'"
+
+# Transform an extracted symbol line into symbol name and symbol address
+lt_cv_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/  {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode \([^ ]*\) \([^ ]*\)$/  {\"\2\", (lt_ptr) \&\2},/p'"
+
+# Define system-specific variables.
+case $host_os in
+aix*)
+  symcode='[BCDT]'
+  ;;
+cygwin* | mingw* | pw32*)
+  symcode='[ABCDGISTW]'
+  ;;
+hpux*) # Its linker distinguishes data from code symbols
+  lt_cv_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern char \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'"
+  lt_cv_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/  {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/  {\"\2\", (lt_ptr) \&\2},/p'"
+  ;;
+irix* | nonstopux*)
+  symcode='[BCDEGRST]'
+  ;;
+osf*)
+  symcode='[BCDEGQRST]'
+  ;;
+solaris* | sysv5*)
+  symcode='[BDT]'
+  ;;
+sysv4)
+  symcode='[DFNSTU]'
+  ;;
+esac
+
+# Handle CRLF in mingw tool chain
+opt_cr=
+case $host_os in
+mingw*)
+  opt_cr=`echo 'x\{0,1\}' | tr x '\015'` # option cr in regexp
+  ;;
+esac
+
+# If we're using GNU nm, then use its standard symbol codes.
+if $NM -V 2>&1 | egrep '(GNU|with BFD)' > /dev/null; then
+  symcode='[ABCDGISTW]'
+fi
+
+# Try without a prefix undercore, then with it.
+for ac_symprfx in "" "_"; do
+
+  # Write the raw and C identifiers.
+lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[ 	]\($symcode$symcode*\)[ 	][ 	]*\($ac_symprfx\)$sympat$opt_cr$/$symxfrm/p'"
+
+  # Check to see that the pipe works correctly.
+  pipe_works=no
+  rm -f conftest*
+  cat > conftest.$ac_ext <<EOF
+#ifdef __cplusplus
+extern "C" {
+#endif
+char nm_test_var;
+void nm_test_func(){}
+#ifdef __cplusplus
+}
+#endif
+int main(){nm_test_var='a';nm_test_func();return(0);}
+EOF
+
+  if { (eval echo configure:2698: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+    # Now try to grab the symbols.
+    nlist=conftest.nm
+    if { (eval echo configure:2701: \"$NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist\") 1>&5; (eval $NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist) 2>&5; } && test -s "$nlist"; then
+      # Try sorting and uniquifying the output.
+      if sort "$nlist" | uniq > "$nlist"T; then
+	mv -f "$nlist"T "$nlist"
+      else
+	rm -f "$nlist"T
+      fi
+
+      # Make sure that we snagged all the symbols we need.
+      if egrep ' nm_test_var$' "$nlist" >/dev/null; then
+	if egrep ' nm_test_func$' "$nlist" >/dev/null; then
+	  cat <<EOF > conftest.$ac_ext
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+EOF
+	  # Now generate the symbol file.
+	  eval "$lt_cv_global_symbol_to_cdecl"' < "$nlist" >> conftest.$ac_ext'
+
+	  cat <<EOF >> conftest.$ac_ext
+#if defined (__STDC__) && __STDC__
+# define lt_ptr void *
+#else
+# define lt_ptr char *
+# define const
+#endif
+
+/* The mapping between symbol names and symbols. */
+const struct {
+  const char *name;
+  lt_ptr address;
+}
+lt_preloaded_symbols[] =
+{
+EOF
+	  sed "s/^$symcode$symcode* \(.*\) \(.*\)$/  {\"\2\", (lt_ptr) \&\2},/" < "$nlist" >> conftest.$ac_ext
+	  cat <<\EOF >> conftest.$ac_ext
+  {0, (lt_ptr) 0}
+};
+
+#ifdef __cplusplus
+}
+#endif
+EOF
+	  # Now try linking the two files.
+	  mv conftest.$ac_objext conftstm.$ac_objext
+	  save_LIBS="$LIBS"
+	  save_CFLAGS="$CFLAGS"
+	  LIBS="conftstm.$ac_objext"
+	  CFLAGS="$CFLAGS$no_builtin_flag"
+	  if { (eval echo configure:2752: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest$ac_exeext; then
+	    pipe_works=yes
+	  fi
+	  LIBS="$save_LIBS"
+	  CFLAGS="$save_CFLAGS"
+	else
+	  echo "cannot find nm_test_func in $nlist" >&5
+	fi
+      else
+	echo "cannot find nm_test_var in $nlist" >&5
+      fi
+    else
+      echo "cannot run $lt_cv_sys_global_symbol_pipe" >&5
+    fi
+  else
+    echo "$progname: failed program was:" >&5
+    cat conftest.$ac_ext >&5
+  fi
+  rm -f conftest* conftst*
+
+  # Do not use the global_symbol_pipe unless it works.
+  if test "$pipe_works" = yes; then
+    break
+  else
+    lt_cv_sys_global_symbol_pipe=
+  fi
+done
+
+fi
+
+global_symbol_pipe="$lt_cv_sys_global_symbol_pipe"
+if test -z "$lt_cv_sys_global_symbol_pipe"; then
+  global_symbol_to_cdecl=
+  global_symbol_to_c_name_address=
+else
+  global_symbol_to_cdecl="$lt_cv_global_symbol_to_cdecl"
+  global_symbol_to_c_name_address="$lt_cv_global_symbol_to_c_name_address"
+fi
+if test -z "$global_symbol_pipe$global_symbol_to_cdec$global_symbol_to_c_name_address";
+then
+  echo "$ac_t""failed" 1>&6
+else
+  echo "$ac_t""ok" 1>&6
+fi
+
+for ac_hdr in dlfcn.h
+do
+ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+echo "configure:2801: checking for $ac_hdr" >&5
+if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 2806 "configure"
+#include "confdefs.h"
+#include <$ac_hdr>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:2811: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=yes"
+else
+  echo "$ac_err" >&5
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_hdr 1
+EOF
+ 
+else
+  echo "$ac_t""no" 1>&6
+fi
+done
+
+
+
+
+
+
+# Only perform the check for file, if the check method requires it
+case $deplibs_check_method in
+file_magic*)
+  if test "$file_magic_cmd" = '$MAGIC_CMD'; then
+    echo $ac_n "checking for ${ac_tool_prefix}file""... $ac_c" 1>&6
+echo "configure:2847: checking for ${ac_tool_prefix}file" >&5
+if eval "test \"`echo '$''{'lt_cv_path_MAGIC_CMD'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  case $MAGIC_CMD in
+  /*)
+  lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path.
+  ;;
+  ?:/*)
+  lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a dos path.
+  ;;
+  *)
+  ac_save_MAGIC_CMD="$MAGIC_CMD"
+  IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS=":"
+  ac_dummy="/usr/bin:$PATH"
+  for ac_dir in $ac_dummy; do
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/${ac_tool_prefix}file; then
+      lt_cv_path_MAGIC_CMD="$ac_dir/${ac_tool_prefix}file"
+      if test -n "$file_magic_test_file"; then
+	case $deplibs_check_method in
+	"file_magic "*)
+	  file_magic_regex="`expr \"$deplibs_check_method\" : \"file_magic \(.*\)\"`"
+	  MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+	  if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null |
+	    egrep "$file_magic_regex" > /dev/null; then
+	    :
+	  else
+	    cat <<EOF 1>&2
+
+*** Warning: the command libtool uses to detect shared libraries,
+*** $file_magic_cmd, produces output that libtool cannot recognize.
+*** The result is that libtool may fail to recognize shared libraries
+*** as such.  This will affect the creation of libtool libraries that
+*** depend on shared libraries, but programs linked with such libtool
+*** libraries will work regardless of this problem.  Nevertheless, you
+*** may want to report the problem to your system manager and/or to
+*** bug-libtool@gnu.org
+
+EOF
+	  fi ;;
+	esac
+      fi
+      break
+    fi
+  done
+  IFS="$ac_save_ifs"
+  MAGIC_CMD="$ac_save_MAGIC_CMD"
+  ;;
+esac
+fi
+
+MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+if test -n "$MAGIC_CMD"; then
+  echo "$ac_t""$MAGIC_CMD" 1>&6
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+if test -z "$lt_cv_path_MAGIC_CMD"; then
+  if test -n "$ac_tool_prefix"; then
+    echo $ac_n "checking for file""... $ac_c" 1>&6
+echo "configure:2909: checking for file" >&5
+if eval "test \"`echo '$''{'lt_cv_path_MAGIC_CMD'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  case $MAGIC_CMD in
+  /*)
+  lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path.
+  ;;
+  ?:/*)
+  lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a dos path.
+  ;;
+  *)
+  ac_save_MAGIC_CMD="$MAGIC_CMD"
+  IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS=":"
+  ac_dummy="/usr/bin:$PATH"
+  for ac_dir in $ac_dummy; do
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/file; then
+      lt_cv_path_MAGIC_CMD="$ac_dir/file"
+      if test -n "$file_magic_test_file"; then
+	case $deplibs_check_method in
+	"file_magic "*)
+	  file_magic_regex="`expr \"$deplibs_check_method\" : \"file_magic \(.*\)\"`"
+	  MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+	  if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null |
+	    egrep "$file_magic_regex" > /dev/null; then
+	    :
+	  else
+	    cat <<EOF 1>&2
+
+*** Warning: the command libtool uses to detect shared libraries,
+*** $file_magic_cmd, produces output that libtool cannot recognize.
+*** The result is that libtool may fail to recognize shared libraries
+*** as such.  This will affect the creation of libtool libraries that
+*** depend on shared libraries, but programs linked with such libtool
+*** libraries will work regardless of this problem.  Nevertheless, you
+*** may want to report the problem to your system manager and/or to
+*** bug-libtool@gnu.org
+
+EOF
+	  fi ;;
+	esac
+      fi
+      break
+    fi
+  done
+  IFS="$ac_save_ifs"
+  MAGIC_CMD="$ac_save_MAGIC_CMD"
+  ;;
+esac
+fi
+
+MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+if test -n "$MAGIC_CMD"; then
+  echo "$ac_t""$MAGIC_CMD" 1>&6
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+  else
+    MAGIC_CMD=:
+  fi
+fi
+
+  fi
+  ;;
+esac
+
+# Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args.
+set dummy ${ac_tool_prefix}ranlib; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:2980: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  if test -n "$RANLIB"; then
+  ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test.
+else
+  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS=":"
+  ac_dummy="$PATH"
+  for ac_dir in $ac_dummy; do
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/$ac_word; then
+      ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib"
+      break
+    fi
+  done
+  IFS="$ac_save_ifs"
+fi
+fi
+RANLIB="$ac_cv_prog_RANLIB"
+if test -n "$RANLIB"; then
+  echo "$ac_t""$RANLIB" 1>&6
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+
+if test -z "$ac_cv_prog_RANLIB"; then
+if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "ranlib", so it can be a program name with args.
+set dummy ranlib; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:3012: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  if test -n "$RANLIB"; then
+  ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test.
+else
+  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS=":"
+  ac_dummy="$PATH"
+  for ac_dir in $ac_dummy; do
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/$ac_word; then
+      ac_cv_prog_RANLIB="ranlib"
+      break
+    fi
+  done
+  IFS="$ac_save_ifs"
+  test -z "$ac_cv_prog_RANLIB" && ac_cv_prog_RANLIB=":"
+fi
+fi
+RANLIB="$ac_cv_prog_RANLIB"
+if test -n "$RANLIB"; then
+  echo "$ac_t""$RANLIB" 1>&6
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+else
+  RANLIB=":"
+fi
+fi
+
+# Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args.
+set dummy ${ac_tool_prefix}strip; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:3047: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_STRIP'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  if test -n "$STRIP"; then
+  ac_cv_prog_STRIP="$STRIP" # Let the user override the test.
+else
+  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS=":"
+  ac_dummy="$PATH"
+  for ac_dir in $ac_dummy; do
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/$ac_word; then
+      ac_cv_prog_STRIP="${ac_tool_prefix}strip"
+      break
+    fi
+  done
+  IFS="$ac_save_ifs"
+fi
+fi
+STRIP="$ac_cv_prog_STRIP"
+if test -n "$STRIP"; then
+  echo "$ac_t""$STRIP" 1>&6
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+
+if test -z "$ac_cv_prog_STRIP"; then
+if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "strip", so it can be a program name with args.
+set dummy strip; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:3079: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_STRIP'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  if test -n "$STRIP"; then
+  ac_cv_prog_STRIP="$STRIP" # Let the user override the test.
+else
+  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS=":"
+  ac_dummy="$PATH"
+  for ac_dir in $ac_dummy; do
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/$ac_word; then
+      ac_cv_prog_STRIP="strip"
+      break
+    fi
+  done
+  IFS="$ac_save_ifs"
+  test -z "$ac_cv_prog_STRIP" && ac_cv_prog_STRIP=":"
+fi
+fi
+STRIP="$ac_cv_prog_STRIP"
+if test -n "$STRIP"; then
+  echo "$ac_t""$STRIP" 1>&6
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+else
+  STRIP=":"
+fi
+fi
+
+
+enable_dlopen=yes
+enable_win32_dll=yes
+
+# Check whether --enable-libtool-lock or --disable-libtool-lock was given.
+if test "${enable_libtool_lock+set}" = set; then
+  enableval="$enable_libtool_lock"
+  :
+fi
+
+test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes
+
+# Some flags need to be propagated to the compiler or linker for good
+# libtool support.
+case $host in
+*-*-irix6*)
+  # Find out which ABI we are using.
+  echo '#line 3128 "configure"' > conftest.$ac_ext
+  if { (eval echo configure:3129: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+    case `/usr/bin/file conftest.$ac_objext` in
+    *32-bit*)
+      LD="${LD-ld} -32"
+      ;;
+    *N32*)
+      LD="${LD-ld} -n32"
+      ;;
+    *64-bit*)
+      LD="${LD-ld} -64"
+      ;;
+    esac
+  fi
+  rm -rf conftest*
+  ;;
+
+*-*-sco3.2v5*)
+  # On SCO OpenServer 5, we need -belf to get full-featured binaries.
+  SAVE_CFLAGS="$CFLAGS"
+  CFLAGS="$CFLAGS -belf"
+  echo $ac_n "checking whether the C compiler needs -belf""... $ac_c" 1>&6
+echo "configure:3150: checking whether the C compiler needs -belf" >&5
+if eval "test \"`echo '$''{'lt_cv_cc_needs_belf'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+     ac_ext=c
+# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
+ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
+cross_compiling=$ac_cv_prog_cc_cross
+
+     cat > conftest.$ac_ext <<EOF
+#line 3163 "configure"
+#include "confdefs.h"
+
+int main() {
+
+; return 0; }
+EOF
+if { (eval echo configure:3170: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  lt_cv_cc_needs_belf=yes
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  lt_cv_cc_needs_belf=no
+fi
+rm -f conftest*
+     ac_ext=c
+# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
+ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
+cross_compiling=$ac_cv_prog_cc_cross
+
+fi
+
+echo "$ac_t""$lt_cv_cc_needs_belf" 1>&6
+  if test x"$lt_cv_cc_needs_belf" != x"yes"; then
+    # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf
+    CFLAGS="$SAVE_CFLAGS"
+  fi
+  ;;
+
+*-*-cygwin* | *-*-mingw* | *-*-pw32*)
+  # Extract the first word of "${ac_tool_prefix}dlltool", so it can be a program name with args.
+set dummy ${ac_tool_prefix}dlltool; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:3200: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_DLLTOOL'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  if test -n "$DLLTOOL"; then
+  ac_cv_prog_DLLTOOL="$DLLTOOL" # Let the user override the test.
+else
+  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS=":"
+  ac_dummy="$PATH"
+  for ac_dir in $ac_dummy; do
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/$ac_word; then
+      ac_cv_prog_DLLTOOL="${ac_tool_prefix}dlltool"
+      break
+    fi
+  done
+  IFS="$ac_save_ifs"
+fi
+fi
+DLLTOOL="$ac_cv_prog_DLLTOOL"
+if test -n "$DLLTOOL"; then
+  echo "$ac_t""$DLLTOOL" 1>&6
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+
+if test -z "$ac_cv_prog_DLLTOOL"; then
+if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "dlltool", so it can be a program name with args.
+set dummy dlltool; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:3232: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_DLLTOOL'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  if test -n "$DLLTOOL"; then
+  ac_cv_prog_DLLTOOL="$DLLTOOL" # Let the user override the test.
+else
+  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS=":"
+  ac_dummy="$PATH"
+  for ac_dir in $ac_dummy; do
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/$ac_word; then
+      ac_cv_prog_DLLTOOL="dlltool"
+      break
+    fi
+  done
+  IFS="$ac_save_ifs"
+  test -z "$ac_cv_prog_DLLTOOL" && ac_cv_prog_DLLTOOL="false"
+fi
+fi
+DLLTOOL="$ac_cv_prog_DLLTOOL"
+if test -n "$DLLTOOL"; then
+  echo "$ac_t""$DLLTOOL" 1>&6
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+else
+  DLLTOOL="false"
+fi
+fi
+
+  # Extract the first word of "${ac_tool_prefix}as", so it can be a program name with args.
+set dummy ${ac_tool_prefix}as; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:3267: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_AS'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  if test -n "$AS"; then
+  ac_cv_prog_AS="$AS" # Let the user override the test.
+else
+  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS=":"
+  ac_dummy="$PATH"
+  for ac_dir in $ac_dummy; do
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/$ac_word; then
+      ac_cv_prog_AS="${ac_tool_prefix}as"
+      break
+    fi
+  done
+  IFS="$ac_save_ifs"
+fi
+fi
+AS="$ac_cv_prog_AS"
+if test -n "$AS"; then
+  echo "$ac_t""$AS" 1>&6
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+
+if test -z "$ac_cv_prog_AS"; then
+if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "as", so it can be a program name with args.
+set dummy as; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:3299: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_AS'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  if test -n "$AS"; then
+  ac_cv_prog_AS="$AS" # Let the user override the test.
+else
+  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS=":"
+  ac_dummy="$PATH"
+  for ac_dir in $ac_dummy; do
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/$ac_word; then
+      ac_cv_prog_AS="as"
+      break
+    fi
+  done
+  IFS="$ac_save_ifs"
+  test -z "$ac_cv_prog_AS" && ac_cv_prog_AS="false"
+fi
+fi
+AS="$ac_cv_prog_AS"
+if test -n "$AS"; then
+  echo "$ac_t""$AS" 1>&6
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+else
+  AS="false"
+fi
+fi
+
+  # Extract the first word of "${ac_tool_prefix}objdump", so it can be a program name with args.
+set dummy ${ac_tool_prefix}objdump; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:3334: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_OBJDUMP'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  if test -n "$OBJDUMP"; then
+  ac_cv_prog_OBJDUMP="$OBJDUMP" # Let the user override the test.
+else
+  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS=":"
+  ac_dummy="$PATH"
+  for ac_dir in $ac_dummy; do
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/$ac_word; then
+      ac_cv_prog_OBJDUMP="${ac_tool_prefix}objdump"
+      break
+    fi
+  done
+  IFS="$ac_save_ifs"
+fi
+fi
+OBJDUMP="$ac_cv_prog_OBJDUMP"
+if test -n "$OBJDUMP"; then
+  echo "$ac_t""$OBJDUMP" 1>&6
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+
+if test -z "$ac_cv_prog_OBJDUMP"; then
+if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "objdump", so it can be a program name with args.
+set dummy objdump; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:3366: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_OBJDUMP'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  if test -n "$OBJDUMP"; then
+  ac_cv_prog_OBJDUMP="$OBJDUMP" # Let the user override the test.
+else
+  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS=":"
+  ac_dummy="$PATH"
+  for ac_dir in $ac_dummy; do
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/$ac_word; then
+      ac_cv_prog_OBJDUMP="objdump"
+      break
+    fi
+  done
+  IFS="$ac_save_ifs"
+  test -z "$ac_cv_prog_OBJDUMP" && ac_cv_prog_OBJDUMP="false"
+fi
+fi
+OBJDUMP="$ac_cv_prog_OBJDUMP"
+if test -n "$OBJDUMP"; then
+  echo "$ac_t""$OBJDUMP" 1>&6
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+else
+  OBJDUMP="false"
+fi
+fi
+
+
+  # recent cygwin and mingw systems supply a stub DllMain which the user
+  # can override, but on older systems we have to supply one
+  echo $ac_n "checking if libtool should supply DllMain function""... $ac_c" 1>&6
+echo "configure:3402: checking if libtool should supply DllMain function" >&5
+if eval "test \"`echo '$''{'lt_cv_need_dllmain'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 3407 "configure"
+#include "confdefs.h"
+
+int main() {
+extern int __attribute__((__stdcall__)) DllMain(void*, int, void*);
+      DllMain (0, 0, 0);
+; return 0; }
+EOF
+if { (eval echo configure:3415: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  lt_cv_need_dllmain=no
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  lt_cv_need_dllmain=yes
+fi
+rm -f conftest*
+fi
+
+echo "$ac_t""$lt_cv_need_dllmain" 1>&6
+
+  case $host/$CC in
+  *-*-cygwin*/gcc*-mno-cygwin*|*-*-mingw*)
+    # old mingw systems require "-dll" to link a DLL, while more recent ones
+    # require "-mdll"
+    SAVE_CFLAGS="$CFLAGS"
+    CFLAGS="$CFLAGS -mdll"
+    echo $ac_n "checking how to link DLLs""... $ac_c" 1>&6
+echo "configure:3436: checking how to link DLLs" >&5
+if eval "test \"`echo '$''{'lt_cv_cc_dll_switch'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 3441 "configure"
+#include "confdefs.h"
+
+int main() {
+
+; return 0; }
+EOF
+if { (eval echo configure:3448: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  lt_cv_cc_dll_switch=-mdll
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  lt_cv_cc_dll_switch=-dll
+fi
+rm -f conftest*
+fi
+
+echo "$ac_t""$lt_cv_cc_dll_switch" 1>&6
+    CFLAGS="$SAVE_CFLAGS" ;;
+  *-*-cygwin* | *-*-pw32*)
+    # cygwin systems need to pass --dll to the linker, and not link
+    # crt.o which will require a WinMain@16 definition.
+    lt_cv_cc_dll_switch="-Wl,--dll -nostartfiles" ;;
+  esac
+  ;;
+  
+esac
+
+# Sed substitution that helps us do robust quoting.  It backslashifies
+# metacharacters that are still active within double-quoted strings.
+Xsed='sed -e s/^X//'
+sed_quote_subst='s/\([\\"\\`$\\\\]\)/\\\1/g'
+
+# Same as above, but do not quote variable references.
+double_quote_subst='s/\([\\"\\`\\\\]\)/\\\1/g'
+
+# Sed substitution to delay expansion of an escaped shell variable in a
+# double_quote_subst'ed string.
+delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g'
+
+# Constants:
+rm="rm -f"
+
+# Global variables:
+default_ofile=libtool
+can_build_shared=yes
+
+# All known linkers require a `.a' archive for static linking (except M$VC,
+# which needs '.lib').
+libext=a
+ltmain="$ac_aux_dir/ltmain.sh"
+ofile="$default_ofile"
+with_gnu_ld="$lt_cv_prog_gnu_ld"
+need_locks="$enable_libtool_lock"
+
+old_CC="$CC"
+old_CFLAGS="$CFLAGS"
+
+# Set sane defaults for various variables
+test -z "$AR" && AR=ar
+test -z "$AR_FLAGS" && AR_FLAGS=cru
+test -z "$AS" && AS=as
+test -z "$CC" && CC=cc
+test -z "$DLLTOOL" && DLLTOOL=dlltool
+test -z "$LD" && LD=ld
+test -z "$LN_S" && LN_S="ln -s"
+test -z "$MAGIC_CMD" && MAGIC_CMD=file
+test -z "$NM" && NM=nm
+test -z "$OBJDUMP" && OBJDUMP=objdump
+test -z "$RANLIB" && RANLIB=:
+test -z "$STRIP" && STRIP=:
+test -z "$ac_objext" && ac_objext=o
+
+if test x"$host" != x"$build"; then
+  ac_tool_prefix=${host_alias}-
+else
+  ac_tool_prefix=
+fi
+
+# Transform linux* to *-*-linux-gnu*, to support old configure scripts.
+case $host_os in
+linux-gnu*) ;;
+linux*) host=`echo $host | sed 's/^\(.*-.*-linux\)\(.*\)$/\1-gnu\2/'`
+esac
+
+case $host_os in
+aix3*)
+  # AIX sometimes has problems with the GCC collect2 program.  For some
+  # reason, if we set the COLLECT_NAMES environment variable, the problems
+  # vanish in a puff of smoke.
+  if test "X${COLLECT_NAMES+set}" != Xset; then
+    COLLECT_NAMES=
+    export COLLECT_NAMES
+  fi
+  ;;
+esac
+
+# Determine commands to create old-style static archives.
+old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs$old_deplibs'
+old_postinstall_cmds='chmod 644 $oldlib'
+old_postuninstall_cmds=
+
+if test -n "$RANLIB"; then
+  case $host_os in
+  openbsd*)
+    old_postinstall_cmds="\$RANLIB -t \$oldlib~$old_postinstall_cmds"
+    ;;
+  *)
+    old_postinstall_cmds="\$RANLIB \$oldlib~$old_postinstall_cmds"
+    ;;
+  esac
+  old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib"
+fi
+
+# Allow CC to be a program name with arguments.
+set dummy $CC
+compiler="$2"
+
+## FIXME: this should be a separate macro
+##
+echo $ac_n "checking for objdir""... $ac_c" 1>&6
+echo "configure:3564: checking for objdir" >&5
+rm -f .libs 2>/dev/null
+mkdir .libs 2>/dev/null
+if test -d .libs; then
+  objdir=.libs
+else
+  # MS-DOS does not allow filenames that begin with a dot.
+  objdir=_libs
+fi
+rmdir .libs 2>/dev/null
+echo "$ac_t""$objdir" 1>&6
+##
+## END FIXME
+
+
+## FIXME: this should be a separate macro
+##
+# Check whether --with-pic or --without-pic was given.
+if test "${with_pic+set}" = set; then
+  withval="$with_pic"
+  pic_mode="$withval"
+else
+  pic_mode=default
+fi
+
+test -z "$pic_mode" && pic_mode=default
+
+# We assume here that the value for lt_cv_prog_cc_pic will not be cached
+# in isolation, and that seeing it set (from the cache) indicates that
+# the associated values are set (in the cache) correctly too.
+echo $ac_n "checking for $compiler option to produce PIC""... $ac_c" 1>&6
+echo "configure:3595: checking for $compiler option to produce PIC" >&5
+if eval "test \"`echo '$''{'lt_cv_prog_cc_pic'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+   lt_cv_prog_cc_pic=
+  lt_cv_prog_cc_shlib=
+  lt_cv_prog_cc_wl=
+  lt_cv_prog_cc_static=
+  lt_cv_prog_cc_no_builtin=
+  lt_cv_prog_cc_can_build_shared=$can_build_shared
+
+  if test "$GCC" = yes; then
+    lt_cv_prog_cc_wl='-Wl,'
+    lt_cv_prog_cc_static='-static'
+
+    case $host_os in
+    aix*)
+      # Below there is a dirty hack to force normal static linking with -ldl
+      # The problem is because libdl dynamically linked with both libc and
+      # libC (AIX C++ library), which obviously doesn't included in libraries
+      # list by gcc. This cause undefined symbols with -static flags.
+      # This hack allows C programs to be linked with "-static -ldl", but
+      # not sure about C++ programs.
+      lt_cv_prog_cc_static="$lt_cv_prog_cc_static ${lt_cv_prog_cc_wl}-lC"
+      ;;
+    amigaos*)
+      # FIXME: we need at least 68020 code to build shared libraries, but
+      # adding the `-m68020' flag to GCC prevents building anything better,
+      # like `-m68040'.
+      lt_cv_prog_cc_pic='-m68020 -resident32 -malways-restore-a4'
+      ;;
+    beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
+      # PIC is the default for these OSes.
+      ;;
+    darwin* | rhapsody*)
+      # PIC is the default on this platform
+      # Common symbols not allowed in MH_DYLIB files
+      lt_cv_prog_cc_pic='-fno-common'
+      ;;
+    cygwin* | mingw* | pw32* | os2*)
+      # This hack is so that the source file can tell whether it is being
+      # built for inclusion in a dll (and should export symbols for example).
+      lt_cv_prog_cc_pic='-DDLL_EXPORT'
+      ;;
+    sysv4*MP*)
+      if test -d /usr/nec; then
+	 lt_cv_prog_cc_pic=-Kconform_pic
+      fi
+      ;;
+    *)
+      lt_cv_prog_cc_pic='-fPIC'
+      ;;
+    esac
+  else
+    # PORTME Check for PIC flags for the system compiler.
+    case $host_os in
+    aix3* | aix4* | aix5*)
+      lt_cv_prog_cc_wl='-Wl,'
+      # All AIX code is PIC.
+      if test "$host_cpu" = ia64; then
+	# AIX 5 now supports IA64 processor
+	lt_cv_prog_cc_static='-Bstatic'
+      else
+	lt_cv_prog_cc_static='-bnso -bI:/lib/syscalls.exp'
+      fi
+      ;;
+
+    hpux9* | hpux10* | hpux11*)
+      # Is there a better lt_cv_prog_cc_static that works with the bundled CC?
+      lt_cv_prog_cc_wl='-Wl,'
+      lt_cv_prog_cc_static="${lt_cv_prog_cc_wl}-a ${lt_cv_prog_cc_wl}archive"
+      lt_cv_prog_cc_pic='+Z'
+      ;;
+
+    irix5* | irix6* | nonstopux*)
+      lt_cv_prog_cc_wl='-Wl,'
+      lt_cv_prog_cc_static='-non_shared'
+      # PIC (with -KPIC) is the default.
+      ;;
+
+    cygwin* | mingw* | pw32* | os2*)
+      # This hack is so that the source file can tell whether it is being
+      # built for inclusion in a dll (and should export symbols for example).
+      lt_cv_prog_cc_pic='-DDLL_EXPORT'
+      ;;
+
+    newsos6)
+      lt_cv_prog_cc_pic='-KPIC'
+      lt_cv_prog_cc_static='-Bstatic'
+      ;;
+
+    osf3* | osf4* | osf5*)
+      # All OSF/1 code is PIC.
+      lt_cv_prog_cc_wl='-Wl,'
+      lt_cv_prog_cc_static='-non_shared'
+      ;;
+
+    sco3.2v5*)
+      lt_cv_prog_cc_pic='-Kpic'
+      lt_cv_prog_cc_static='-dn'
+      lt_cv_prog_cc_shlib='-belf'
+      ;;
+
+    solaris*)
+      lt_cv_prog_cc_pic='-KPIC'
+      lt_cv_prog_cc_static='-Bstatic'
+      lt_cv_prog_cc_wl='-Wl,'
+      ;;
+
+    sunos4*)
+      lt_cv_prog_cc_pic='-PIC'
+      lt_cv_prog_cc_static='-Bstatic'
+      lt_cv_prog_cc_wl='-Qoption ld '
+      ;;
+
+    sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
+      lt_cv_prog_cc_pic='-KPIC'
+      lt_cv_prog_cc_static='-Bstatic'
+      lt_cv_prog_cc_wl='-Wl,'
+      ;;
+
+    uts4*)
+      lt_cv_prog_cc_pic='-pic'
+      lt_cv_prog_cc_static='-Bstatic'
+      ;;
+
+    sysv4*MP*)
+      if test -d /usr/nec ;then
+	lt_cv_prog_cc_pic='-Kconform_pic'
+	lt_cv_prog_cc_static='-Bstatic'
+      fi
+      ;;
+
+    *)
+      lt_cv_prog_cc_can_build_shared=no
+      ;;
+    esac
+  fi
+
+fi
+
+if test -z "$lt_cv_prog_cc_pic"; then
+  echo "$ac_t""none" 1>&6
+else
+  echo "$ac_t""$lt_cv_prog_cc_pic" 1>&6
+
+  # Check to make sure the pic_flag actually works.
+  echo $ac_n "checking if $compiler PIC flag $lt_cv_prog_cc_pic works""... $ac_c" 1>&6
+echo "configure:3743: checking if $compiler PIC flag $lt_cv_prog_cc_pic works" >&5
+  if eval "test \"`echo '$''{'lt_cv_prog_cc_pic_works'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+      save_CFLAGS="$CFLAGS"
+    CFLAGS="$CFLAGS $lt_cv_prog_cc_pic -DPIC"
+    cat > conftest.$ac_ext <<EOF
+#line 3750 "configure"
+#include "confdefs.h"
+
+int main() {
+
+; return 0; }
+EOF
+if { (eval echo configure:3757: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+        case $host_os in
+      hpux9* | hpux10* | hpux11*)
+	# On HP-UX, both CC and GCC only warn that PIC is supported... then
+	# they create non-PIC objects.  So, if there were any warnings, we
+	# assume that PIC is not supported.
+	if test -s conftest.err; then
+	  lt_cv_prog_cc_pic_works=no
+	else
+	  lt_cv_prog_cc_pic_works=yes
+	fi
+	;;
+      *)
+	lt_cv_prog_cc_pic_works=yes
+	;;
+      esac
+    
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+        lt_cv_prog_cc_pic_works=no
+    
+fi
+rm -f conftest*
+    CFLAGS="$save_CFLAGS"
+  
+fi
+
+
+  if test "X$lt_cv_prog_cc_pic_works" = Xno; then
+    lt_cv_prog_cc_pic=
+    lt_cv_prog_cc_can_build_shared=no
+  else
+    lt_cv_prog_cc_pic=" $lt_cv_prog_cc_pic"
+  fi
+
+  echo "$ac_t""$lt_cv_prog_cc_pic_works" 1>&6
+fi
+##
+## END FIXME
+
+# Check for any special shared library compilation flags.
+if test -n "$lt_cv_prog_cc_shlib"; then
+  echo "configure: warning: \`$CC' requires \`$lt_cv_prog_cc_shlib' to build shared libraries" 1>&2
+  if echo "$old_CC $old_CFLAGS " | egrep -e "[ 	]$lt_cv_prog_cc_shlib[ 	]" >/dev/null; then :
+  else
+   echo "configure: warning: add \`$lt_cv_prog_cc_shlib' to the CC or CFLAGS env variable and reconfigure" 1>&2
+    lt_cv_prog_cc_can_build_shared=no
+  fi
+fi
+
+## FIXME: this should be a separate macro
+##
+echo $ac_n "checking if $compiler static flag $lt_cv_prog_cc_static works""... $ac_c" 1>&6
+echo "configure:3813: checking if $compiler static flag $lt_cv_prog_cc_static works" >&5
+if eval "test \"`echo '$''{'lt_cv_prog_cc_static_works'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+    lt_cv_prog_cc_static_works=no
+  save_LDFLAGS="$LDFLAGS"
+  LDFLAGS="$LDFLAGS $lt_cv_prog_cc_static"
+  cat > conftest.$ac_ext <<EOF
+#line 3821 "configure"
+#include "confdefs.h"
+
+int main() {
+
+; return 0; }
+EOF
+if { (eval echo configure:3828: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  lt_cv_prog_cc_static_works=yes
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+fi
+rm -f conftest*
+  LDFLAGS="$save_LDFLAGS"
+
+fi
+
+
+# Belt *and* braces to stop my trousers falling down:
+test "X$lt_cv_prog_cc_static_works" = Xno && lt_cv_prog_cc_static=
+echo "$ac_t""$lt_cv_prog_cc_static_works" 1>&6
+
+pic_flag="$lt_cv_prog_cc_pic"
+special_shlib_compile_flags="$lt_cv_prog_cc_shlib"
+wl="$lt_cv_prog_cc_wl"
+link_static_flag="$lt_cv_prog_cc_static"
+no_builtin_flag="$lt_cv_prog_cc_no_builtin"
+can_build_shared="$lt_cv_prog_cc_can_build_shared"
+##
+## END FIXME
+
+
+## FIXME: this should be a separate macro
+##
+# Check to see if options -o and -c are simultaneously supported by compiler
+echo $ac_n "checking if $compiler supports -c -o file.$ac_objext""... $ac_c" 1>&6
+echo "configure:3859: checking if $compiler supports -c -o file.$ac_objext" >&5
+if eval "test \"`echo '$''{'lt_cv_compiler_c_o'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+$rm -r conftest 2>/dev/null
+mkdir conftest
+cd conftest
+echo "int some_variable = 0;" > conftest.$ac_ext
+mkdir out
+# According to Tom Tromey, Ian Lance Taylor reported there are C compilers
+# that will create temporary files in the current directory regardless of
+# the output directory.  Thus, making CWD read-only will cause this test
+# to fail, enabling locking or at least warning the user not to do parallel
+# builds.
+chmod -w .
+save_CFLAGS="$CFLAGS"
+CFLAGS="$CFLAGS -o out/conftest2.$ac_objext"
+compiler_c_o=no
+if { (eval echo configure:3878: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>out/conftest.err; } && test -s out/conftest2.$ac_objext; then
+  # The compiler can only warn and ignore the option if not recognized
+  # So say no if there are warnings
+  if test -s out/conftest.err; then
+    lt_cv_compiler_c_o=no
+  else
+    lt_cv_compiler_c_o=yes
+  fi
+else
+  # Append any errors to the config.log.
+  cat out/conftest.err 1>&5
+  lt_cv_compiler_c_o=no
+fi
+CFLAGS="$save_CFLAGS"
+chmod u+w .
+$rm conftest* out/*
+rmdir out
+cd ..
+rmdir conftest
+$rm -r conftest 2>/dev/null
+
+fi
+
+compiler_c_o=$lt_cv_compiler_c_o
+echo "$ac_t""$compiler_c_o" 1>&6
+
+if test x"$compiler_c_o" = x"yes"; then
+  # Check to see if we can write to a .lo
+  echo $ac_n "checking if $compiler supports -c -o file.lo""... $ac_c" 1>&6
+echo "configure:3907: checking if $compiler supports -c -o file.lo" >&5
+  if eval "test \"`echo '$''{'lt_cv_compiler_o_lo'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+  lt_cv_compiler_o_lo=no
+  save_CFLAGS="$CFLAGS"
+  CFLAGS="$CFLAGS -c -o conftest.lo"
+  save_objext="$ac_objext"
+  ac_objext=lo
+  cat > conftest.$ac_ext <<EOF
+#line 3918 "configure"
+#include "confdefs.h"
+
+int main() {
+int some_variable = 0;
+; return 0; }
+EOF
+if { (eval echo configure:3925: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+      # The compiler can only warn and ignore the option if not recognized
+    # So say no if there are warnings
+    if test -s conftest.err; then
+      lt_cv_compiler_o_lo=no
+    else
+      lt_cv_compiler_o_lo=yes
+    fi
+  
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+fi
+rm -f conftest*
+  ac_objext="$save_objext"
+  CFLAGS="$save_CFLAGS"
+  
+fi
+
+  compiler_o_lo=$lt_cv_compiler_o_lo
+  echo "$ac_t""$compiler_o_lo" 1>&6
+else
+  compiler_o_lo=no
+fi
+##
+## END FIXME
+
+## FIXME: this should be a separate macro
+##
+# Check to see if we can do hard links to lock some files if needed
+hard_links="nottested"
+if test "$compiler_c_o" = no && test "$need_locks" != no; then
+  # do not overwrite the value of need_locks provided by the user
+  echo $ac_n "checking if we can lock with hard links""... $ac_c" 1>&6
+echo "configure:3960: checking if we can lock with hard links" >&5
+  hard_links=yes
+  $rm conftest*
+  ln conftest.a conftest.b 2>/dev/null && hard_links=no
+  touch conftest.a
+  ln conftest.a conftest.b 2>&5 || hard_links=no
+  ln conftest.a conftest.b 2>/dev/null && hard_links=no
+  echo "$ac_t""$hard_links" 1>&6
+  if test "$hard_links" = no; then
+    echo "configure: warning: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" 1>&2
+    need_locks=warn
+  fi
+else
+  need_locks=no
+fi
+##
+## END FIXME
+
+## FIXME: this should be a separate macro
+##
+if test "$GCC" = yes; then
+  # Check to see if options -fno-rtti -fno-exceptions are supported by compiler
+  echo $ac_n "checking if $compiler supports -fno-rtti -fno-exceptions""... $ac_c" 1>&6
+echo "configure:3983: checking if $compiler supports -fno-rtti -fno-exceptions" >&5
+  echo "int some_variable = 0;" > conftest.$ac_ext
+  save_CFLAGS="$CFLAGS"
+  CFLAGS="$CFLAGS -fno-rtti -fno-exceptions -c conftest.$ac_ext"
+  compiler_rtti_exceptions=no
+  cat > conftest.$ac_ext <<EOF
+#line 3989 "configure"
+#include "confdefs.h"
+
+int main() {
+int some_variable = 0;
+; return 0; }
+EOF
+if { (eval echo configure:3996: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+      # The compiler can only warn and ignore the option if not recognized
+    # So say no if there are warnings
+    if test -s conftest.err; then
+      compiler_rtti_exceptions=no
+    else
+      compiler_rtti_exceptions=yes
+    fi
+  
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+fi
+rm -f conftest*
+  CFLAGS="$save_CFLAGS"
+  echo "$ac_t""$compiler_rtti_exceptions" 1>&6
+
+  if test "$compiler_rtti_exceptions" = "yes"; then
+    no_builtin_flag=' -fno-builtin -fno-rtti -fno-exceptions'
+  else
+    no_builtin_flag=' -fno-builtin'
+  fi
+fi
+##
+## END FIXME
+
+## FIXME: this should be a separate macro
+##
+# See if the linker supports building shared libraries.
+echo $ac_n "checking whether the linker ($LD) supports shared libraries""... $ac_c" 1>&6
+echo "configure:4027: checking whether the linker ($LD) supports shared libraries" >&5
+
+allow_undefined_flag=
+no_undefined_flag=
+need_lib_prefix=unknown
+need_version=unknown
+# when you set need_version to no, make sure it does not cause -set_version
+# flags to be left without arguments
+archive_cmds=
+archive_expsym_cmds=
+old_archive_from_new_cmds=
+old_archive_from_expsyms_cmds=
+export_dynamic_flag_spec=
+whole_archive_flag_spec=
+thread_safe_flag_spec=
+hardcode_into_libs=no
+hardcode_libdir_flag_spec=
+hardcode_libdir_separator=
+hardcode_direct=no
+hardcode_minus_L=no
+hardcode_shlibpath_var=unsupported
+runpath_var=
+link_all_deplibs=unknown
+always_export_symbols=no
+export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | sed '\''s/.* //'\'' | sort | uniq > $export_symbols'
+# include_expsyms should be a list of space-separated symbols to be *always*
+# included in the symbol list
+include_expsyms=
+# exclude_expsyms can be an egrep regular expression of symbols to exclude
+# it will be wrapped by ` (' and `)$', so one must not match beginning or
+# end of line.  Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc',
+# as well as any symbol that contains `d'.
+exclude_expsyms="_GLOBAL_OFFSET_TABLE_"
+# Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out
+# platforms (ab)use it in PIC code, but their linkers get confused if
+# the symbol is explicitly referenced.  Since portable code cannot
+# rely on this symbol name, it's probably fine to never include it in
+# preloaded symbol tables.
+extract_expsyms_cmds=
+
+case $host_os in
+cygwin* | mingw* | pw32*)
+  # FIXME: the MSVC++ port hasn't been tested in a loooong time
+  # When not using gcc, we currently assume that we are using
+  # Microsoft Visual C++.
+  if test "$GCC" != yes; then
+    with_gnu_ld=no
+  fi
+  ;;
+openbsd*)
+  with_gnu_ld=no
+  ;;
+esac
+
+ld_shlibs=yes
+if test "$with_gnu_ld" = yes; then
+  # If archive_cmds runs LD, not CC, wlarc should be empty
+  wlarc='${wl}'
+
+  # See if GNU ld supports shared libraries.
+  case $host_os in
+  aix3* | aix4* | aix5*)
+    # On AIX, the GNU linker is very broken
+    # Note:Check GNU linker on AIX 5-IA64 when/if it becomes available.
+    ld_shlibs=no
+    cat <<EOF 1>&2
+
+*** Warning: the GNU linker, at least up to release 2.9.1, is reported
+*** to be unable to reliably create shared libraries on AIX.
+*** Therefore, libtool is disabling shared libraries support.  If you
+*** really care for shared libraries, you may want to modify your PATH
+*** so that a non-GNU linker is found, and then restart.
+
+EOF
+    ;;
+
+  amigaos*)
+    archive_cmds='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
+    hardcode_libdir_flag_spec='-L$libdir'
+    hardcode_minus_L=yes
+
+    # Samuel A. Falvo II <kc5tja@dolphin.openprojects.net> reports
+    # that the semantics of dynamic libraries on AmigaOS, at least up
+    # to version 4, is to share data among multiple programs linked
+    # with the same dynamic library.  Since this doesn't match the
+    # behavior of shared libraries on other platforms, we can use
+    # them.
+    ld_shlibs=no
+    ;;
+
+  beos*)
+    if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then
+      allow_undefined_flag=unsupported
+      # Joseph Beckenbach <jrb3@best.com> says some releases of gcc
+      # support --undefined.  This deserves some investigation.  FIXME
+      archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+    else
+      ld_shlibs=no
+    fi
+    ;;
+
+  cygwin* | mingw* | pw32*)
+    # hardcode_libdir_flag_spec is actually meaningless, as there is
+    # no search path for DLLs.
+    hardcode_libdir_flag_spec='-L$libdir'
+    allow_undefined_flag=unsupported
+    always_export_symbols=yes
+
+    extract_expsyms_cmds='test -f $output_objdir/impgen.c || \
+      sed -e "/^# \/\* impgen\.c starts here \*\//,/^# \/\* impgen.c ends here \*\// { s/^# //;s/^# *$//; p; }" -e d < $''0 > $output_objdir/impgen.c~
+      test -f $output_objdir/impgen.exe || (cd $output_objdir && \
+      if test "x$HOST_CC" != "x" ; then $HOST_CC -o impgen impgen.c ; \
+      else $CC -o impgen impgen.c ; fi)~
+      $output_objdir/impgen $dir/$soroot > $output_objdir/$soname-def'
+
+    old_archive_from_expsyms_cmds='$DLLTOOL --as=$AS --dllname $soname --def $output_objdir/$soname-def --output-lib $output_objdir/$newlib'
+
+    # cygwin and mingw dlls have different entry points and sets of symbols
+    # to exclude.
+    # FIXME: what about values for MSVC?
+    dll_entry=__cygwin_dll_entry@12
+    dll_exclude_symbols=DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12~
+    case $host_os in
+    mingw*)
+      # mingw values
+      dll_entry=_DllMainCRTStartup@12
+      dll_exclude_symbols=DllMain@12,DllMainCRTStartup@12,DllEntryPoint@12~
+      ;;
+    esac
+
+    # mingw and cygwin differ, and it's simplest to just exclude the union
+    # of the two symbol sets.
+    dll_exclude_symbols=DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12,DllMainCRTStartup@12,DllEntryPoint@12
+
+    # recent cygwin and mingw systems supply a stub DllMain which the user
+    # can override, but on older systems we have to supply one (in ltdll.c)
+    if test "x$lt_cv_need_dllmain" = "xyes"; then
+      ltdll_obj='$output_objdir/$soname-ltdll.'"$ac_objext "
+      ltdll_cmds='test -f $output_objdir/$soname-ltdll.c || sed -e "/^# \/\* ltdll\.c starts here \*\//,/^# \/\* ltdll.c ends here \*\// { s/^# //; p; }" -e d < $''0 > $output_objdir/$soname-ltdll.c~
+	test -f $output_objdir/$soname-ltdll.$ac_objext || (cd $output_objdir && $CC -c $soname-ltdll.c)~'
+    else
+      ltdll_obj=
+      ltdll_cmds=
+    fi
+
+    # Extract the symbol export list from an `--export-all' def file,
+    # then regenerate the def file from the symbol export list, so that
+    # the compiled dll only exports the symbol export list.
+    # Be careful not to strip the DATA tag left be newer dlltools.
+    export_symbols_cmds="$ltdll_cmds"'
+      $DLLTOOL --export-all --exclude-symbols '$dll_exclude_symbols' --output-def $output_objdir/$soname-def '$ltdll_obj'$libobjs $convenience~
+      sed -e "1,/EXPORTS/d" -e "s/ @ [0-9]*//" -e "s/ *;.*$//" < $output_objdir/$soname-def > $export_symbols'
+
+    # If the export-symbols file already is a .def file (1st line
+    # is EXPORTS), use it as is.
+    # If DATA tags from a recent dlltool are present, honour them!
+    archive_expsym_cmds='if test "x`sed 1q $export_symbols`" = xEXPORTS; then
+	cp $export_symbols $output_objdir/$soname-def;
+      else
+	echo EXPORTS > $output_objdir/$soname-def;
+	_lt_hint=1;
+	cat $export_symbols | while read symbol; do
+	 set dummy \$symbol;
+	 case \$# in
+	   2) echo "   \$2 @ \$_lt_hint ; " >> $output_objdir/$soname-def;;
+	   4) echo "   \$2 \$3 \$4 ; " >> $output_objdir/$soname-def; _lt_hint=`expr \$_lt_hint - 1`;;
+	   *) echo "     \$2 @ \$_lt_hint \$3 ; " >> $output_objdir/$soname-def;;
+	 esac;
+	 _lt_hint=`expr 1 + \$_lt_hint`;
+	done;
+      fi~
+      '"$ltdll_cmds"'
+      $CC -Wl,--base-file,$output_objdir/$soname-base '$lt_cv_cc_dll_switch' -Wl,-e,'$dll_entry' -o $output_objdir/$soname '$ltdll_obj'$libobjs $deplibs $compiler_flags~
+      $DLLTOOL --as=$AS --dllname $soname --exclude-symbols '$dll_exclude_symbols' --def $output_objdir/$soname-def --base-file $output_objdir/$soname-base --output-exp $output_objdir/$soname-exp~
+      $CC -Wl,--base-file,$output_objdir/$soname-base $output_objdir/$soname-exp '$lt_cv_cc_dll_switch' -Wl,-e,'$dll_entry' -o $output_objdir/$soname '$ltdll_obj'$libobjs $deplibs $compiler_flags~
+      $DLLTOOL --as=$AS --dllname $soname --exclude-symbols '$dll_exclude_symbols' --def $output_objdir/$soname-def --base-file $output_objdir/$soname-base --output-exp $output_objdir/$soname-exp --output-lib $output_objdir/$libname.dll.a~
+      $CC $output_objdir/$soname-exp '$lt_cv_cc_dll_switch' -Wl,-e,'$dll_entry' -o $output_objdir/$soname '$ltdll_obj'$libobjs $deplibs $compiler_flags'
+    ;;
+
+  netbsd*)
+    if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
+      archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib'
+      wlarc=
+    else
+      archive_cmds='$CC -shared -nodefaultlibs $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+      archive_expsym_cmds='$CC -shared -nodefaultlibs $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+    fi
+    ;;
+
+  solaris* | sysv5*)
+    if $LD -v 2>&1 | egrep 'BFD 2\.8' > /dev/null; then
+      ld_shlibs=no
+      cat <<EOF 1>&2
+
+*** Warning: The releases 2.8.* of the GNU linker cannot reliably
+*** create shared libraries on Solaris systems.  Therefore, libtool
+*** is disabling shared libraries support.  We urge you to upgrade GNU
+*** binutils to release 2.9.1 or newer.  Another option is to modify
+*** your PATH or compiler configuration so that the native linker is
+*** used, and then restart.
+
+EOF
+    elif $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then
+      archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+      archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+    else
+      ld_shlibs=no
+    fi
+    ;;
+
+  sunos4*)
+    archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+    wlarc=
+    hardcode_direct=yes
+    hardcode_shlibpath_var=no
+    ;;
+
+  *)
+    if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then
+      archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+      archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+    else
+      ld_shlibs=no
+    fi
+    ;;
+  esac
+
+  if test "$ld_shlibs" = yes; then
+    runpath_var=LD_RUN_PATH
+    hardcode_libdir_flag_spec='${wl}--rpath ${wl}$libdir'
+    export_dynamic_flag_spec='${wl}--export-dynamic'
+    case $host_os in
+    cygwin* | mingw* | pw32*)
+      # dlltool doesn't understand --whole-archive et. al.
+      whole_archive_flag_spec=
+      ;;
+    *)
+      # ancient GNU ld didn't support --whole-archive et. al.
+      if $LD --help 2>&1 | egrep 'no-whole-archive' > /dev/null; then
+	whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+      else
+	whole_archive_flag_spec=
+      fi
+      ;;
+    esac
+  fi
+else
+  # PORTME fill in a description of your system's linker (not GNU ld)
+  case $host_os in
+  aix3*)
+    allow_undefined_flag=unsupported
+    always_export_symbols=yes
+    archive_expsym_cmds='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname'
+    # Note: this linker hardcodes the directories in LIBPATH if there
+    # are no directories specified by -L.
+    hardcode_minus_L=yes
+    if test "$GCC" = yes && test -z "$link_static_flag"; then
+      # Neither direct hardcoding nor static linking is supported with a
+      # broken collect2.
+      hardcode_direct=unsupported
+    fi
+    ;;
+
+  aix4* | aix5*)
+    if test "$host_cpu" = ia64; then
+      # On IA64, the linker does run time linking by default, so we don't
+      # have to do anything special.
+      aix_use_runtimelinking=no
+      exp_sym_flag='-Bexport'
+      no_entry_flag=""
+    else
+      aix_use_runtimelinking=no
+
+      # Test if we are trying to use run time linking or normal
+      # AIX style linking. If -brtl is somewhere in LDFLAGS, we
+      # need to do runtime linking.
+      case $host_os in aix4.[23]|aix4.[23].*|aix5*)
+	for ld_flag in $LDFLAGS; do
+	  case $ld_flag in
+	  *-brtl*)
+	    aix_use_runtimelinking=yes
+	    break
+	  ;;
+	  esac
+	done
+      esac
+
+      exp_sym_flag='-bexport'
+      no_entry_flag='-bnoentry'
+    fi
+
+    # When large executables or shared objects are built, AIX ld can
+    # have problems creating the table of contents.  If linking a library
+    # or program results in "error TOC overflow" add -mminimal-toc to
+    # CXXFLAGS/CFLAGS for g++/gcc.  In the cases where that is not
+    # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS.
+
+    hardcode_direct=yes
+    archive_cmds=''
+    hardcode_libdir_separator=':'
+    if test "$GCC" = yes; then
+      case $host_os in aix4.[012]|aix4.[012].*)
+	collect2name=`${CC} -print-prog-name=collect2`
+	if test -f "$collect2name" && \
+	  strings "$collect2name" | grep resolve_lib_name >/dev/null
+	then
+	  # We have reworked collect2
+	  hardcode_direct=yes
+	else
+	  # We have old collect2
+	  hardcode_direct=unsupported
+	  # It fails to find uninstalled libraries when the uninstalled
+	  # path is not listed in the libpath.  Setting hardcode_minus_L
+	  # to unsupported forces relinking
+	  hardcode_minus_L=yes
+	  hardcode_libdir_flag_spec='-L$libdir'
+	  hardcode_libdir_separator=
+	fi
+      esac
+
+      shared_flag='-shared'
+    else
+      # not using gcc
+      if test "$host_cpu" = ia64; then
+	shared_flag='${wl}-G'
+      else
+	if test "$aix_use_runtimelinking" = yes; then
+	  shared_flag='${wl}-G'
+	else
+	  shared_flag='${wl}-bM:SRE'
+	fi
+      fi
+    fi
+
+    # It seems that -bexpall can do strange things, so it is better to
+    # generate a list of symbols to export.
+    always_export_symbols=yes
+    if test "$aix_use_runtimelinking" = yes; then
+      # Warning - without using the other runtime loading flags (-brtl),
+      # -berok will link without error, but may produce a broken library.
+      allow_undefined_flag='-berok'
+      hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:/usr/lib:/lib'
+      archive_expsym_cmds="\$CC"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols $shared_flag"
+    else
+      if test "$host_cpu" = ia64; then
+	hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib'
+	allow_undefined_flag="-z nodefs"
+	archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname ${wl}-h$soname $libobjs $deplibs $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols"
+      else
+	hardcode_libdir_flag_spec='${wl}-bnolibpath ${wl}-blibpath:$libdir:/usr/lib:/lib'
+	# Warning - without using the other run time loading flags,
+	# -berok will link without error, but may produce a broken library.
+	allow_undefined_flag='${wl}-berok'
+	# This is a bit strange, but is similar to how AIX traditionally builds
+	# it's shared libraries.
+	archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols"' ~$AR -crlo $objdir/$libname$release.a $objdir/$soname'
+      fi
+    fi
+    ;;
+
+  amigaos*)
+    archive_cmds='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
+    hardcode_libdir_flag_spec='-L$libdir'
+    hardcode_minus_L=yes
+    # see comment about different semantics on the GNU ld section
+    ld_shlibs=no
+    ;;
+
+  cygwin* | mingw* | pw32*)
+    # When not using gcc, we currently assume that we are using
+    # Microsoft Visual C++.
+    # hardcode_libdir_flag_spec is actually meaningless, as there is
+    # no search path for DLLs.
+    hardcode_libdir_flag_spec=' '
+    allow_undefined_flag=unsupported
+    # Tell ltmain to make .lib files, not .a files.
+    libext=lib
+    # FIXME: Setting linknames here is a bad hack.
+    archive_cmds='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | sed -e '\''s/ -lc$//'\''` -link -dll~linknames='
+    # The linker will automatically build a .lib file if we build a DLL.
+    old_archive_from_new_cmds='true'
+    # FIXME: Should let the user specify the lib program.
+    old_archive_cmds='lib /OUT:$oldlib$oldobjs$old_deplibs'
+    fix_srcfile_path='`cygpath -w "$srcfile"`'
+    ;;
+
+  darwin* | rhapsody*)
+    case "$host_os" in
+    rhapsody* | darwin1.[012])
+      allow_undefined_flag='-undefined suppress'
+      ;;
+    *) # Darwin 1.3 on
+      allow_undefined_flag='-flat_namespace -undefined suppress'
+      ;;
+    esac
+    # FIXME: Relying on posixy $() will cause problems for
+    #        cross-compilation, but unfortunately the echo tests do not
+    #        yet detect zsh echo's removal of \ escapes.  Also zsh mangles
+    #	     `"' quotes if we put them in here... so don't!
+    archive_cmds='$CC -r -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs && $CC $(test .$module = .yes && echo -bundle || echo -dynamiclib) $allow_undefined_flag -o $lib ${lib}-master.o $deplibs$linker_flags $(test .$module != .yes && echo -install_name $rpath/$soname $verstring)'
+    # We need to add '_' to the symbols in $export_symbols first
+    #archive_expsym_cmds="$archive_cmds"' && strip -s $export_symbols'
+    hardcode_direct=yes
+    hardcode_shlibpath_var=no
+    whole_archive_flag_spec='-all_load $convenience'
+    ;;
+
+  freebsd1*)
+    ld_shlibs=no
+    ;;
+
+  # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor
+  # support.  Future versions do this automatically, but an explicit c++rt0.o
+  # does not break anything, and helps significantly (at the cost of a little
+  # extra space).
+  freebsd2.2*)
+    archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o'
+    hardcode_libdir_flag_spec='-R$libdir'
+    hardcode_direct=yes
+    hardcode_shlibpath_var=no
+    ;;
+
+  # Unfortunately, older versions of FreeBSD 2 do not have this feature.
+  freebsd2*)
+    archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+    hardcode_direct=yes
+    hardcode_minus_L=yes
+    hardcode_shlibpath_var=no
+    ;;
+
+  # FreeBSD 3 and greater uses gcc -shared to do shared libraries.
+  freebsd*)
+    archive_cmds='$CC -shared -o $lib $libobjs $deplibs $compiler_flags'
+    hardcode_libdir_flag_spec='-R$libdir'
+    hardcode_direct=yes
+    hardcode_shlibpath_var=no
+    ;;
+
+  hpux9* | hpux10* | hpux11*)
+    case $host_os in
+    hpux9*) archive_cmds='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' ;;
+    *) archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' ;;
+    esac
+    hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
+    hardcode_libdir_separator=:
+    hardcode_direct=yes
+    hardcode_minus_L=yes # Not in the search PATH, but as the default
+			 # location of the library.
+    export_dynamic_flag_spec='${wl}-E'
+    ;;
+
+  irix5* | irix6* | nonstopux*)
+    if test "$GCC" = yes; then
+      archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+      hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+    else
+      archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
+      hardcode_libdir_flag_spec='-rpath $libdir'
+    fi
+    hardcode_libdir_separator=:
+    link_all_deplibs=yes
+    ;;
+
+  netbsd*)
+    if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
+      archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'  # a.out
+    else
+      archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linker_flags'      # ELF
+    fi
+    hardcode_libdir_flag_spec='-R$libdir'
+    hardcode_direct=yes
+    hardcode_shlibpath_var=no
+    ;;
+
+  newsos6)
+    archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+    hardcode_direct=yes
+    hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+    hardcode_libdir_separator=:
+    hardcode_shlibpath_var=no
+    ;;
+
+  openbsd*)
+    hardcode_direct=yes
+    hardcode_shlibpath_var=no
+    if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+      archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+      hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
+      export_dynamic_flag_spec='${wl}-E'
+    else
+      case "$host_os" in
+      openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*)
+	archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+	hardcode_libdir_flag_spec='-R$libdir'
+        ;;
+      *)
+        archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+        hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
+        ;;
+      esac
+    fi
+    ;;
+
+  os2*)
+    hardcode_libdir_flag_spec='-L$libdir'
+    hardcode_minus_L=yes
+    allow_undefined_flag=unsupported
+    archive_cmds='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def'
+    old_archive_from_new_cmds='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def'
+    ;;
+
+  osf3*)
+    if test "$GCC" = yes; then
+      allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
+      archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+    else
+      allow_undefined_flag=' -expect_unresolved \*'
+      archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
+    fi
+    hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+    hardcode_libdir_separator=:
+    ;;
+
+  osf4* | osf5*)	# as osf3* with the addition of -msym flag
+    if test "$GCC" = yes; then
+      allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
+      archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+      hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+    else
+      allow_undefined_flag=' -expect_unresolved \*'
+      archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
+      archive_expsym_cmds='for i in `cat $export_symbols`; do printf "-exported_symbol " >> $lib.exp; echo "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~
+      $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib~$rm $lib.exp'
+
+      #Both c and cxx compiler support -rpath directly
+      hardcode_libdir_flag_spec='-rpath $libdir'
+    fi
+    hardcode_libdir_separator=:
+    ;;
+
+  sco3.2v5*)
+    archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+    hardcode_shlibpath_var=no
+    runpath_var=LD_RUN_PATH
+    hardcode_runpath_var=yes
+    export_dynamic_flag_spec='${wl}-Bexport'
+    ;;
+
+  solaris*)
+    # gcc --version < 3.0 without binutils cannot create self contained
+    # shared libraries reliably, requiring libgcc.a to resolve some of
+    # the object symbols generated in some cases.  Libraries that use
+    # assert need libgcc.a to resolve __eprintf, for example.  Linking
+    # a copy of libgcc.a into every shared library to guarantee resolving
+    # such symbols causes other problems:  According to Tim Van Holder
+    # <tim.van.holder@pandora.be>, C++ libraries end up with a separate
+    # (to the application) exception stack for one thing.
+    no_undefined_flag=' -z defs'
+    if test "$GCC" = yes; then
+      case `$CC --version 2>/dev/null` in
+      [12].*)
+	cat <<EOF 1>&2
+
+*** Warning: Releases of GCC earlier than version 3.0 cannot reliably
+*** create self contained shared libraries on Solaris systems, without
+*** introducing a dependency on libgcc.a.  Therefore, libtool is disabling
+*** -no-undefined support, which will at least allow you to build shared
+*** libraries.  However, you may find that when you link such libraries
+*** into an application without using GCC, you have to manually add
+*** \`gcc --print-libgcc-file-name\` to the link command.  We urge you to
+*** upgrade to a newer version of GCC.  Another option is to rebuild your
+*** current GCC to use the GNU linker from GNU binutils 2.9.1 or newer.
+
+EOF
+        no_undefined_flag=
+	;;
+      esac
+    fi
+    # $CC -shared without GNU ld will not create a library from C++
+    # object files and a static libstdc++, better avoid it by now
+    archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags'
+    archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
+		$LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp'
+    hardcode_libdir_flag_spec='-R$libdir'
+    hardcode_shlibpath_var=no
+    case $host_os in
+    solaris2.[0-5] | solaris2.[0-5].*) ;;
+    *) # Supported since Solaris 2.6 (maybe 2.5.1?)
+      whole_archive_flag_spec='-z allextract$convenience -z defaultextract' ;;
+    esac
+    link_all_deplibs=yes
+    ;;
+
+  sunos4*)
+    if test "x$host_vendor" = xsequent; then
+      # Use $CC to link under sequent, because it throws in some extra .o
+      # files that make .init and .fini sections work.
+      archive_cmds='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags'
+    else
+      archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags'
+    fi
+    hardcode_libdir_flag_spec='-L$libdir'
+    hardcode_direct=yes
+    hardcode_minus_L=yes
+    hardcode_shlibpath_var=no
+    ;;
+
+  sysv4)
+    case $host_vendor in
+      sni)
+        archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+        hardcode_direct=yes # is this really true???
+        ;;
+      siemens)
+        ## LD is ld it makes a PLAMLIB
+        ## CC just makes a GrossModule.
+        archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags'
+        reload_cmds='$CC -r -o $output$reload_objs'
+        hardcode_direct=no
+        ;;
+      motorola)
+        archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+        hardcode_direct=no #Motorola manual says yes, but my tests say they lie
+        ;;
+    esac
+    runpath_var='LD_RUN_PATH'
+    hardcode_shlibpath_var=no
+    ;;
+
+  sysv4.3*)
+    archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+    hardcode_shlibpath_var=no
+    export_dynamic_flag_spec='-Bexport'
+    ;;
+
+  sysv5*)
+    no_undefined_flag=' -z text'
+    # $CC -shared without GNU ld will not create a library from C++
+    # object files and a static libstdc++, better avoid it by now
+    archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags'
+    archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
+		$LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp'
+    hardcode_libdir_flag_spec=
+    hardcode_shlibpath_var=no
+    runpath_var='LD_RUN_PATH'
+    ;;
+
+  uts4*)
+    archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+    hardcode_libdir_flag_spec='-L$libdir'
+    hardcode_shlibpath_var=no
+    ;;
+
+  dgux*)
+    archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+    hardcode_libdir_flag_spec='-L$libdir'
+    hardcode_shlibpath_var=no
+    ;;
+
+  sysv4*MP*)
+    if test -d /usr/nec; then
+      archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      hardcode_shlibpath_var=no
+      runpath_var=LD_RUN_PATH
+      hardcode_runpath_var=yes
+      ld_shlibs=yes
+    fi
+    ;;
+
+  sysv4.2uw2*)
+    archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags'
+    hardcode_direct=yes
+    hardcode_minus_L=no
+    hardcode_shlibpath_var=no
+    hardcode_runpath_var=yes
+    runpath_var=LD_RUN_PATH
+    ;;
+
+  sysv5uw7* | unixware7*)
+    no_undefined_flag='${wl}-z ${wl}text'
+    if test "$GCC" = yes; then
+      archive_cmds='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+    else
+      archive_cmds='$CC -G ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+    fi
+    runpath_var='LD_RUN_PATH'
+    hardcode_shlibpath_var=no
+    ;;
+
+  *)
+    ld_shlibs=no
+    ;;
+  esac
+fi
+echo "$ac_t""$ld_shlibs" 1>&6
+test "$ld_shlibs" = no && can_build_shared=no
+##
+## END FIXME
+
+## FIXME: this should be a separate macro
+##
+# Check hardcoding attributes.
+echo $ac_n "checking how to hardcode library paths into programs""... $ac_c" 1>&6
+echo "configure:4730: checking how to hardcode library paths into programs" >&5
+hardcode_action=
+if test -n "$hardcode_libdir_flag_spec" || \
+   test -n "$runpath_var"; then
+
+  # We can hardcode non-existant directories.
+  if test "$hardcode_direct" != no &&
+     # If the only mechanism to avoid hardcoding is shlibpath_var, we
+     # have to relink, otherwise we might link with an installed library
+     # when we should be linking with a yet-to-be-installed one
+     ## test "$hardcode_shlibpath_var" != no &&
+     test "$hardcode_minus_L" != no; then
+    # Linking always hardcodes the temporary library directory.
+    hardcode_action=relink
+  else
+    # We can link without hardcoding, and we can hardcode nonexisting dirs.
+    hardcode_action=immediate
+  fi
+else
+  # We cannot hardcode anything, or else we can only hardcode existing
+  # directories.
+  hardcode_action=unsupported
+fi
+echo "$ac_t""$hardcode_action" 1>&6
+##
+## END FIXME
+
+## FIXME: this should be a separate macro
+##
+striplib=
+old_striplib=
+echo $ac_n "checking whether stripping libraries is possible""... $ac_c" 1>&6
+echo "configure:4762: checking whether stripping libraries is possible" >&5
+if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then
+  test -z "$old_striplib" && old_striplib="$STRIP --strip-debug"
+  test -z "$striplib" && striplib="$STRIP --strip-unneeded"
+  echo "$ac_t""yes" 1>&6
+else
+  echo "$ac_t""no" 1>&6
+fi
+##
+## END FIXME
+
+reload_cmds='$LD$reload_flag -o $output$reload_objs'
+test -z "$deplibs_check_method" && deplibs_check_method=unknown
+
+## FIXME: this should be a separate macro
+##
+# PORTME Fill in your ld.so characteristics
+echo $ac_n "checking dynamic linker characteristics""... $ac_c" 1>&6
+echo "configure:4780: checking dynamic linker characteristics" >&5
+library_names_spec=
+libname_spec='lib$name'
+soname_spec=
+postinstall_cmds=
+postuninstall_cmds=
+finish_cmds=
+finish_eval=
+shlibpath_var=
+shlibpath_overrides_runpath=unknown
+version_type=none
+dynamic_linker="$host_os ld.so"
+sys_lib_dlsearch_path_spec="/lib /usr/lib"
+sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib"
+
+case $host_os in
+aix3*)
+  version_type=linux
+  library_names_spec='${libname}${release}.so$versuffix $libname.a'
+  shlibpath_var=LIBPATH
+
+  # AIX has no versioning support, so we append a major version to the name.
+  soname_spec='${libname}${release}.so$major'
+  ;;
+
+aix4* | aix5*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  hardcode_into_libs=yes
+  if test "$host_cpu" = ia64; then
+    # AIX 5 supports IA64
+    library_names_spec='${libname}${release}.so$major ${libname}${release}.so$versuffix $libname.so'
+    shlibpath_var=LD_LIBRARY_PATH
+  else
+    # With GCC up to 2.95.x, collect2 would create an import file
+    # for dependence libraries.  The import file would start with
+    # the line `#! .'.  This would cause the generated library to
+    # depend on `.', always an invalid library.  This was fixed in
+    # development snapshots of GCC prior to 3.0.
+    case $host_os in
+      aix4 | aix4.[01] | aix4.[01].*)
+	if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)'
+	     echo ' yes '
+	     echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then
+	  :
+	else
+	  can_build_shared=no
+	fi
+	;;
+    esac
+    # AIX (on Power*) has no versioning support, so currently we can
+    # not hardcode correct soname into executable. Probably we can
+    # add versioning support to collect2, so additional links can
+    # be useful in future.
+    if test "$aix_use_runtimelinking" = yes; then
+      # If using run time linking (on AIX 4.2 or later) use lib<name>.so
+      # instead of lib<name>.a to let people know that these are not
+      # typical AIX shared libraries.
+      library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
+    else
+      # We preserve .a as extension for shared libraries through AIX4.2
+      # and later when we are not doing run time linking.
+      library_names_spec='${libname}${release}.a $libname.a'
+      soname_spec='${libname}${release}.so$major'
+    fi
+    shlibpath_var=LIBPATH
+  fi
+  hardcode_into_libs=yes
+  ;;
+
+amigaos*)
+  library_names_spec='$libname.ixlibrary $libname.a'
+  # Create ${libname}_ixlibrary.a entries in /sys/libs.
+  finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "(cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a)"; (cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a) || exit 1; done'
+  ;;
+
+beos*)
+  library_names_spec='${libname}.so'
+  dynamic_linker="$host_os ld.so"
+  shlibpath_var=LIBRARY_PATH
+  ;;
+
+bsdi4*)
+  version_type=linux
+  need_version=no
+  library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
+  soname_spec='${libname}${release}.so$major'
+  finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib"
+  sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib"
+  export_dynamic_flag_spec=-rdynamic
+  # the default ld.so.conf also contains /usr/contrib/lib and
+  # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow
+  # libtool to hard-code these into programs
+  ;;
+
+cygwin* | mingw* | pw32*)
+  version_type=windows
+  need_version=no
+  need_lib_prefix=no
+  case $GCC,$host_os in
+  yes,cygwin*)
+    library_names_spec='$libname.dll.a'
+    soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | sed -e 's/[.]/-/g'`${versuffix}.dll'
+    postinstall_cmds='dlpath=`bash 2>&1 -c '\''. $dir/${file}i;echo \$dlname'\''`~
+      dldir=$destdir/`dirname \$dlpath`~
+      test -d \$dldir || mkdir -p \$dldir~
+      $install_prog .libs/$dlname \$dldir/$dlname'
+    postuninstall_cmds='dldll=`bash 2>&1 -c '\''. $file; echo \$dlname'\''`~
+      dlpath=$dir/\$dldll~
+       $rm \$dlpath'
+    ;;
+  yes,mingw*)
+    library_names_spec='${libname}`echo ${release} | sed -e 's/[.]/-/g'`${versuffix}.dll'
+    sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | sed -e "s/^libraries://" -e "s/;/ /g" -e "s,=/,/,g"`
+    ;;
+  yes,pw32*)
+    library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | sed -e 's/./-/g'`${versuffix}.dll'
+    ;;
+  *)
+    library_names_spec='${libname}`echo ${release} | sed -e 's/[.]/-/g'`${versuffix}.dll $libname.lib'
+    ;;
+  esac
+  dynamic_linker='Win32 ld.exe'
+  # FIXME: first we should search . and the directory the executable is in
+  shlibpath_var=PATH
+  ;;
+
+darwin* | rhapsody*)
+  dynamic_linker="$host_os dyld"
+  version_type=darwin
+  need_lib_prefix=no
+  need_version=no
+  # FIXME: Relying on posixy $() will cause problems for
+  #        cross-compilation, but unfortunately the echo tests do not
+  #        yet detect zsh echo's removal of \ escapes.
+  library_names_spec='${libname}${release}${versuffix}.$(test .$module = .yes && echo so || echo dylib) ${libname}${release}${major}.$(test .$module = .yes && echo so || echo dylib) ${libname}.$(test .$module = .yes && echo so || echo dylib)'
+  soname_spec='${libname}${release}${major}.$(test .$module = .yes && echo so || echo dylib)'
+  shlibpath_overrides_runpath=yes
+  shlibpath_var=DYLD_LIBRARY_PATH
+  ;;
+
+freebsd1*)
+  dynamic_linker=no
+  ;;
+
+freebsd*)
+  objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout`
+  version_type=freebsd-$objformat
+  case $version_type in
+    freebsd-elf*)
+      library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so $libname.so'
+      need_version=no
+      need_lib_prefix=no
+      ;;
+    freebsd-*)
+      library_names_spec='${libname}${release}.so$versuffix $libname.so$versuffix'
+      need_version=yes
+      ;;
+  esac
+  shlibpath_var=LD_LIBRARY_PATH
+  case $host_os in
+  freebsd2*)
+    shlibpath_overrides_runpath=yes
+    ;;
+  *)
+    shlibpath_overrides_runpath=no
+    hardcode_into_libs=yes
+    ;;
+  esac
+  ;;
+
+gnu*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so${major} ${libname}.so'
+  soname_spec='${libname}${release}.so$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  hardcode_into_libs=yes
+  ;;
+
+hpux9* | hpux10* | hpux11*)
+  # Give a soname corresponding to the major version so that dld.sl refuses to
+  # link against other versions.
+  dynamic_linker="$host_os dld.sl"
+  version_type=sunos
+  need_lib_prefix=no
+  need_version=no
+  shlibpath_var=SHLIB_PATH
+  shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH
+  library_names_spec='${libname}${release}.sl$versuffix ${libname}${release}.sl$major $libname.sl'
+  soname_spec='${libname}${release}.sl$major'
+  # HP-UX runs *really* slowly unless shared libraries are mode 555.
+  postinstall_cmds='chmod 555 $lib'
+  ;;
+
+irix5* | irix6* | nonstopux*)
+  case $host_os in
+    nonstopux*) version_type=nonstopux ;;
+    *)          version_type=irix ;;
+  esac
+  need_lib_prefix=no
+  need_version=no
+  soname_spec='${libname}${release}.so$major'
+  library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major ${libname}${release}.so $libname.so'
+  case $host_os in
+  irix5* | nonstopux*)
+    libsuff= shlibsuff=
+    ;;
+  *)
+    case $LD in # libtool.m4 will add one of these switches to LD
+    *-32|*"-32 ") libsuff= shlibsuff= libmagic=32-bit;;
+    *-n32|*"-n32 ") libsuff=32 shlibsuff=N32 libmagic=N32;;
+    *-64|*"-64 ") libsuff=64 shlibsuff=64 libmagic=64-bit;;
+    *) libsuff= shlibsuff= libmagic=never-match;;
+    esac
+    ;;
+  esac
+  shlibpath_var=LD_LIBRARY${shlibsuff}_PATH
+  shlibpath_overrides_runpath=no
+  sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}"
+  sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}"
+  ;;
+
+# No shared lib support for Linux oldld, aout, or coff.
+linux-gnuoldld* | linux-gnuaout* | linux-gnucoff*)
+  dynamic_linker=no
+  ;;
+
+# This must be Linux ELF.
+linux-gnu*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
+  soname_spec='${libname}${release}.so$major'
+  finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  # This implies no fast_install, which is unacceptable.
+  # Some rework will be needed to allow for fast_install
+  # before this can be enabled.
+  hardcode_into_libs=yes
+
+  # We used to test for /lib/ld.so.1 and disable shared libraries on
+  # powerpc, because MkLinux only supported shared libraries with the
+  # GNU dynamic linker.  Since this was broken with cross compilers,
+  # most powerpc-linux boxes support dynamic linking these days and
+  # people can always --disable-shared, the test was removed, and we
+  # assume the GNU/Linux dynamic linker is in use.
+  dynamic_linker='GNU/Linux ld.so'
+  ;;
+
+netbsd*)
+  version_type=sunos
+  need_lib_prefix=no
+  need_version=no
+  if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
+    library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix'
+    finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
+    dynamic_linker='NetBSD (a.out) ld.so'
+  else
+    library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major ${libname}${release}.so ${libname}.so'
+    soname_spec='${libname}${release}.so$major'
+    dynamic_linker='NetBSD ld.elf_so'
+  fi
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  hardcode_into_libs=yes
+  ;;
+
+newsos6)
+  version_type=linux
+  library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  ;;
+
+openbsd*)
+  version_type=sunos
+  need_lib_prefix=no
+  need_version=no
+  if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+    case "$host_os" in
+    openbsd2.[89] | openbsd2.[89].*)
+      shlibpath_overrides_runpath=no
+      ;;
+    *)
+      shlibpath_overrides_runpath=yes
+      ;;
+    esac
+  else
+    shlibpath_overrides_runpath=yes
+  fi
+  library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix'
+  finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  ;;
+
+os2*)
+  libname_spec='$name'
+  need_lib_prefix=no
+  library_names_spec='$libname.dll $libname.a'
+  dynamic_linker='OS/2 ld.exe'
+  shlibpath_var=LIBPATH
+  ;;
+
+osf3* | osf4* | osf5*)
+  version_type=osf
+  need_version=no
+  soname_spec='${libname}${release}.so$major'
+  library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
+  shlibpath_var=LD_LIBRARY_PATH
+  sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib"
+  sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec"
+  hardcode_into_libs=yes
+  ;;
+
+sco3.2v5*)
+  version_type=osf
+  soname_spec='${libname}${release}.so$major'
+  library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
+  shlibpath_var=LD_LIBRARY_PATH
+  ;;
+
+solaris*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
+  soname_spec='${libname}${release}.so$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  hardcode_into_libs=yes
+  # ldd complains unless libraries are executable
+  postinstall_cmds='chmod +x $lib'
+  ;;
+
+sunos4*)
+  version_type=sunos
+  library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix'
+  finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  if test "$with_gnu_ld" = yes; then
+    need_lib_prefix=no
+  fi
+  need_version=yes
+  ;;
+
+sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
+  version_type=linux
+  library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
+  soname_spec='${libname}${release}.so$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  case $host_vendor in
+    sni)
+      shlibpath_overrides_runpath=no
+      need_lib_prefix=no
+      export_dynamic_flag_spec='${wl}-Blargedynsym'
+      runpath_var=LD_RUN_PATH
+      ;;
+    siemens)
+      need_lib_prefix=no
+      ;;
+    motorola)
+      need_lib_prefix=no
+      need_version=no
+      shlibpath_overrides_runpath=no
+      sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib'
+      ;;
+  esac
+  ;;
+
+uts4*)
+  version_type=linux
+  library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
+  soname_spec='${libname}${release}.so$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  ;;
+
+dgux*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
+  soname_spec='${libname}${release}.so$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  ;;
+
+sysv4*MP*)
+  if test -d /usr/nec ;then
+    version_type=linux
+    library_names_spec='$libname.so.$versuffix $libname.so.$major $libname.so'
+    soname_spec='$libname.so.$major'
+    shlibpath_var=LD_LIBRARY_PATH
+  fi
+  ;;
+
+*)
+  dynamic_linker=no
+  ;;
+esac
+echo "$ac_t""$dynamic_linker" 1>&6
+test "$dynamic_linker" = no && can_build_shared=no
+##
+## END FIXME
+
+## FIXME: this should be a separate macro
+##
+# Report the final consequences.
+echo $ac_n "checking if libtool supports shared libraries""... $ac_c" 1>&6
+echo "configure:5195: checking if libtool supports shared libraries" >&5
+echo "$ac_t""$can_build_shared" 1>&6
+##
+## END FIXME
+
+## FIXME: this should be a separate macro
+##
+echo $ac_n "checking whether to build shared libraries""... $ac_c" 1>&6
+echo "configure:5203: checking whether to build shared libraries" >&5
+test "$can_build_shared" = "no" && enable_shared=no
+
+# On AIX, shared libraries and static libraries use the same namespace, and
+# are all built from PIC.
+case "$host_os" in
+aix3*)
+  test "$enable_shared" = yes && enable_static=no
+  if test -n "$RANLIB"; then
+    archive_cmds="$archive_cmds~\$RANLIB \$lib"
+    postinstall_cmds='$RANLIB $lib'
+  fi
+  ;;
+
+aix4*)
+  if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then
+    test "$enable_shared" = yes && enable_static=no
+  fi
+  ;;
+esac
+echo "$ac_t""$enable_shared" 1>&6
+##
+## END FIXME
+
+## FIXME: this should be a separate macro
+##
+echo $ac_n "checking whether to build static libraries""... $ac_c" 1>&6
+echo "configure:5230: checking whether to build static libraries" >&5
+# Make sure either enable_shared or enable_static is yes.
+test "$enable_shared" = yes || enable_static=yes
+echo "$ac_t""$enable_static" 1>&6
+##
+## END FIXME
+
+if test "$hardcode_action" = relink; then
+  # Fast installation is not supported
+  enable_fast_install=no
+elif test "$shlibpath_overrides_runpath" = yes ||
+     test "$enable_shared" = no; then
+  # Fast installation is not necessary
+  enable_fast_install=needless
+fi
+
+variables_saved_for_relink="PATH $shlibpath_var $runpath_var"
+if test "$GCC" = yes; then
+  variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
+fi
+
+if test "x$enable_dlopen" != xyes; then
+  enable_dlopen=unknown
+  enable_dlopen_self=unknown
+  enable_dlopen_self_static=unknown
+else
+  lt_cv_dlopen=no
+  lt_cv_dlopen_libs=
+
+  case $host_os in
+  beos*)
+    lt_cv_dlopen="load_add_on"
+    lt_cv_dlopen_libs=
+    lt_cv_dlopen_self=yes
+    ;;
+
+  cygwin* | mingw* | pw32*)
+    lt_cv_dlopen="LoadLibrary"
+    lt_cv_dlopen_libs=
+   ;;
+
+  *)
+    echo $ac_n "checking for shl_load""... $ac_c" 1>&6
+echo "configure:5273: checking for shl_load" >&5
+if eval "test \"`echo '$''{'ac_cv_func_shl_load'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 5278 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char shl_load(); below.  */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char shl_load();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_shl_load) || defined (__stub___shl_load)
+choke me
+#else
+shl_load();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:5301: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_func_shl_load=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_func_shl_load=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'shl_load`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  lt_cv_dlopen="shl_load"
+else
+  echo "$ac_t""no" 1>&6
+echo $ac_n "checking for shl_load in -ldld""... $ac_c" 1>&6
+echo "configure:5319: checking for shl_load in -ldld" >&5
+ac_lib_var=`echo dld'_'shl_load | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  ac_save_LIBS="$LIBS"
+LIBS="-ldld  $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 5327 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char shl_load();
+
+int main() {
+shl_load()
+; return 0; }
+EOF
+if { (eval echo configure:5338: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-dld"
+else
+  echo "$ac_t""no" 1>&6
+echo $ac_n "checking for dlopen""... $ac_c" 1>&6
+echo "configure:5357: checking for dlopen" >&5
+if eval "test \"`echo '$''{'ac_cv_func_dlopen'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 5362 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char dlopen(); below.  */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char dlopen();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_dlopen) || defined (__stub___dlopen)
+choke me
+#else
+dlopen();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:5385: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_func_dlopen=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_func_dlopen=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'dlopen`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  lt_cv_dlopen="dlopen"
+else
+  echo "$ac_t""no" 1>&6
+echo $ac_n "checking for dlopen in -ldl""... $ac_c" 1>&6
+echo "configure:5403: checking for dlopen in -ldl" >&5
+ac_lib_var=`echo dl'_'dlopen | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  ac_save_LIBS="$LIBS"
+LIBS="-ldl  $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 5411 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char dlopen();
+
+int main() {
+dlopen()
+; return 0; }
+EOF
+if { (eval echo configure:5422: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"
+else
+  echo "$ac_t""no" 1>&6
+echo $ac_n "checking for dlopen in -lsvld""... $ac_c" 1>&6
+echo "configure:5441: checking for dlopen in -lsvld" >&5
+ac_lib_var=`echo svld'_'dlopen | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  ac_save_LIBS="$LIBS"
+LIBS="-lsvld  $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 5449 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char dlopen();
+
+int main() {
+dlopen()
+; return 0; }
+EOF
+if { (eval echo configure:5460: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"
+else
+  echo "$ac_t""no" 1>&6
+echo $ac_n "checking for dld_link in -ldld""... $ac_c" 1>&6
+echo "configure:5479: checking for dld_link in -ldld" >&5
+ac_lib_var=`echo dld'_'dld_link | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  ac_save_LIBS="$LIBS"
+LIBS="-ldld  $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 5487 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char dld_link();
+
+int main() {
+dld_link()
+; return 0; }
+EOF
+if { (eval echo configure:5498: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-dld"
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+	      
+fi
+
+	    
+fi
+
+	  
+fi
+
+	
+fi
+
+      
+fi
+
+    ;;
+  esac
+
+  if test "x$lt_cv_dlopen" != xno; then
+    enable_dlopen=yes
+  else
+    enable_dlopen=no
+  fi
+
+  case $lt_cv_dlopen in
+  dlopen)
+    save_CPPFLAGS="$CPPFLAGS"
+        test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H"
+
+    save_LDFLAGS="$LDFLAGS"
+    eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\"
+
+    save_LIBS="$LIBS"
+    LIBS="$lt_cv_dlopen_libs $LIBS"
+
+    echo $ac_n "checking whether a program can dlopen itself""... $ac_c" 1>&6
+echo "configure:5554: checking whether a program can dlopen itself" >&5
+if eval "test \"`echo '$''{'lt_cv_dlopen_self'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  	  if test "$cross_compiling" = yes; then :
+  lt_cv_dlopen_self=cross
+else
+    lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
+  lt_status=$lt_dlunknown
+  cat > conftest.$ac_ext <<EOF
+#line 5564 "configure"
+#include "confdefs.h"
+
+#if HAVE_DLFCN_H
+#include <dlfcn.h>
+#endif
+
+#include <stdio.h>
+
+#ifdef RTLD_GLOBAL
+#  define LT_DLGLOBAL		RTLD_GLOBAL
+#else
+#  ifdef DL_GLOBAL
+#    define LT_DLGLOBAL		DL_GLOBAL
+#  else
+#    define LT_DLGLOBAL		0
+#  endif
+#endif
+
+/* We may have to define LT_DLLAZY_OR_NOW in the command line if we
+   find out it does not work in some platform. */
+#ifndef LT_DLLAZY_OR_NOW
+#  ifdef RTLD_LAZY
+#    define LT_DLLAZY_OR_NOW		RTLD_LAZY
+#  else
+#    ifdef DL_LAZY
+#      define LT_DLLAZY_OR_NOW		DL_LAZY
+#    else
+#      ifdef RTLD_NOW
+#        define LT_DLLAZY_OR_NOW	RTLD_NOW
+#      else
+#        ifdef DL_NOW
+#          define LT_DLLAZY_OR_NOW	DL_NOW
+#        else
+#          define LT_DLLAZY_OR_NOW	0
+#        endif
+#      endif
+#    endif
+#  endif
+#endif
+
+#ifdef __cplusplus
+extern "C" void exit (int);
+#endif
+
+void fnord() { int i=42;}
+int main ()
+{
+  void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW);
+  int status = $lt_dlunknown;
+
+  if (self)
+    {
+      if (dlsym (self,"fnord"))       status = $lt_dlno_uscore;
+      else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore;
+      /* dlclose (self); */
+    }
+
+    exit (status);
+}
+EOF
+  if { (eval echo configure:5625: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} 2>/dev/null; then
+    (./conftest; exit; ) 2>/dev/null
+    lt_status=$?
+    case x$lt_status in
+      x$lt_dlno_uscore) lt_cv_dlopen_self=yes ;;
+      x$lt_dlneed_uscore) lt_cv_dlopen_self=yes ;;
+      x$lt_unknown|x*) lt_cv_dlopen_self=no ;;
+    esac
+  else :
+    # compilation failed
+    lt_cv_dlopen_self=no
+  fi
+fi
+rm -fr conftest*
+
+    
+fi
+
+echo "$ac_t""$lt_cv_dlopen_self" 1>&6
+
+    if test "x$lt_cv_dlopen_self" = xyes; then
+      LDFLAGS="$LDFLAGS $link_static_flag"
+      echo $ac_n "checking whether a statically linked program can dlopen itself""... $ac_c" 1>&6
+echo "configure:5648: checking whether a statically linked program can dlopen itself" >&5
+if eval "test \"`echo '$''{'lt_cv_dlopen_self_static'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  	  if test "$cross_compiling" = yes; then :
+  lt_cv_dlopen_self_static=cross
+else
+    lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
+  lt_status=$lt_dlunknown
+  cat > conftest.$ac_ext <<EOF
+#line 5658 "configure"
+#include "confdefs.h"
+
+#if HAVE_DLFCN_H
+#include <dlfcn.h>
+#endif
+
+#include <stdio.h>
+
+#ifdef RTLD_GLOBAL
+#  define LT_DLGLOBAL		RTLD_GLOBAL
+#else
+#  ifdef DL_GLOBAL
+#    define LT_DLGLOBAL		DL_GLOBAL
+#  else
+#    define LT_DLGLOBAL		0
+#  endif
+#endif
+
+/* We may have to define LT_DLLAZY_OR_NOW in the command line if we
+   find out it does not work in some platform. */
+#ifndef LT_DLLAZY_OR_NOW
+#  ifdef RTLD_LAZY
+#    define LT_DLLAZY_OR_NOW		RTLD_LAZY
+#  else
+#    ifdef DL_LAZY
+#      define LT_DLLAZY_OR_NOW		DL_LAZY
+#    else
+#      ifdef RTLD_NOW
+#        define LT_DLLAZY_OR_NOW	RTLD_NOW
+#      else
+#        ifdef DL_NOW
+#          define LT_DLLAZY_OR_NOW	DL_NOW
+#        else
+#          define LT_DLLAZY_OR_NOW	0
+#        endif
+#      endif
+#    endif
+#  endif
+#endif
+
+#ifdef __cplusplus
+extern "C" void exit (int);
+#endif
+
+void fnord() { int i=42;}
+int main ()
+{
+  void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW);
+  int status = $lt_dlunknown;
+
+  if (self)
+    {
+      if (dlsym (self,"fnord"))       status = $lt_dlno_uscore;
+      else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore;
+      /* dlclose (self); */
+    }
+
+    exit (status);
+}
+EOF
+  if { (eval echo configure:5719: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} 2>/dev/null; then
+    (./conftest; exit; ) 2>/dev/null
+    lt_status=$?
+    case x$lt_status in
+      x$lt_dlno_uscore) lt_cv_dlopen_self_static=yes ;;
+      x$lt_dlneed_uscore) lt_cv_dlopen_self_static=yes ;;
+      x$lt_unknown|x*) lt_cv_dlopen_self_static=no ;;
+    esac
+  else :
+    # compilation failed
+    lt_cv_dlopen_self_static=no
+  fi
+fi
+rm -fr conftest*
+
+      
+fi
+
+echo "$ac_t""$lt_cv_dlopen_self_static" 1>&6
+    fi
+
+    CPPFLAGS="$save_CPPFLAGS"
+    LDFLAGS="$save_LDFLAGS"
+    LIBS="$save_LIBS"
+    ;;
+  esac
+
+  case $lt_cv_dlopen_self in
+  yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;;
+  *) enable_dlopen_self=unknown ;;
+  esac
+
+  case $lt_cv_dlopen_self_static in
+  yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;;
+  *) enable_dlopen_self_static=unknown ;;
+  esac
+fi
+
+
+## FIXME: this should be a separate macro
+##
+if test "$enable_shared" = yes && test "$GCC" = yes; then
+  case $archive_cmds in
+  *'~'*)
+    # FIXME: we may have to deal with multi-command sequences.
+    ;;
+  '$CC '*)
+    # Test whether the compiler implicitly links with -lc since on some
+    # systems, -lgcc has to come before -lc. If gcc already passes -lc
+    # to ld, don't add -lc before -lgcc.
+    echo $ac_n "checking whether -lc should be explicitly linked in""... $ac_c" 1>&6
+echo "configure:5770: checking whether -lc should be explicitly linked in" >&5
+    if eval "test \"`echo '$''{'lt_cv_archive_cmds_need_lc'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  $rm conftest*
+    echo 'static int dummy;' > conftest.$ac_ext
+
+    if { (eval echo configure:5777: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+      soname=conftest
+      lib=conftest
+      libobjs=conftest.$ac_objext
+      deplibs=
+      wl=$lt_cv_prog_cc_wl
+      compiler_flags=-v
+      linker_flags=-v
+      verstring=
+      output_objdir=.
+      libname=conftest
+      save_allow_undefined_flag=$allow_undefined_flag
+      allow_undefined_flag=
+      if { (eval echo configure:5790: \"$archive_cmds 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1\") 1>&5; (eval $archive_cmds 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) 2>&5; }
+      then
+	lt_cv_archive_cmds_need_lc=no
+      else
+	lt_cv_archive_cmds_need_lc=yes
+      fi
+      allow_undefined_flag=$save_allow_undefined_flag
+    else
+      cat conftest.err 1>&5
+    fi
+fi
+
+    echo "$ac_t""$lt_cv_archive_cmds_need_lc" 1>&6
+    ;;
+  esac
+fi
+need_lc=${lt_cv_archive_cmds_need_lc-yes}
+##
+## END FIXME
+
+## FIXME: this should be a separate macro
+##
+# The second clause should only fire when bootstrapping the
+# libtool distribution, otherwise you forgot to ship ltmain.sh
+# with your package, and you will get complaints that there are
+# no rules to generate ltmain.sh.
+if test -f "$ltmain"; then
+  :
+else
+  # If there is no Makefile yet, we rely on a make rule to execute
+  # `config.status --recheck' to rerun these tests and create the
+  # libtool script then.
+  test -f Makefile && make "$ltmain"
+fi
+
+if test -f "$ltmain"; then
+  trap "$rm \"${ofile}T\"; exit 1" 1 2 15
+  $rm -f "${ofile}T"
+
+  echo creating $ofile
+
+  # Now quote all the things that may contain metacharacters while being
+  # careful not to overquote the AC_SUBSTed values.  We take copies of the
+  # variables and quote the copies for generation of the libtool script.
+  for var in echo old_CC old_CFLAGS SED \
+    AR AR_FLAGS CC LD LN_S NM SHELL \
+    reload_flag reload_cmds wl \
+    pic_flag link_static_flag no_builtin_flag export_dynamic_flag_spec \
+    thread_safe_flag_spec whole_archive_flag_spec libname_spec \
+    library_names_spec soname_spec \
+    RANLIB old_archive_cmds old_archive_from_new_cmds old_postinstall_cmds \
+    old_postuninstall_cmds archive_cmds archive_expsym_cmds postinstall_cmds \
+    postuninstall_cmds extract_expsyms_cmds old_archive_from_expsyms_cmds \
+    old_striplib striplib file_magic_cmd export_symbols_cmds \
+    deplibs_check_method allow_undefined_flag no_undefined_flag \
+    finish_cmds finish_eval global_symbol_pipe global_symbol_to_cdecl \
+    global_symbol_to_c_name_address \
+    hardcode_libdir_flag_spec hardcode_libdir_separator  \
+    sys_lib_search_path_spec sys_lib_dlsearch_path_spec \
+    compiler_c_o compiler_o_lo need_locks exclude_expsyms include_expsyms; do
+
+    case $var in
+    reload_cmds | old_archive_cmds | old_archive_from_new_cmds | \
+    old_postinstall_cmds | old_postuninstall_cmds | \
+    export_symbols_cmds | archive_cmds | archive_expsym_cmds | \
+    extract_expsyms_cmds | old_archive_from_expsyms_cmds | \
+    postinstall_cmds | postuninstall_cmds | \
+    finish_cmds | sys_lib_search_path_spec | sys_lib_dlsearch_path_spec)
+      # Double-quote double-evaled strings.
+      eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\""
+      ;;
+    *)
+      eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\""
+      ;;
+    esac
+  done
+
+  cat <<__EOF__ > "${ofile}T"
+#! $SHELL
+
+# `$echo "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services.
+# Generated automatically by $PROGRAM (GNU $PACKAGE $VERSION$TIMESTAMP)
+# NOTE: Changes made to this file will be lost: look at ltmain.sh.
+#
+# Copyright (C) 1996-2000 Free Software Foundation, Inc.
+# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# A sed that does not truncate output.
+SED=$lt_SED
+
+# Sed that helps us avoid accidentally triggering echo(1) options like -n.
+Xsed="${SED} -e s/^X//"
+
+# The HP-UX ksh and POSIX shell print the target directory to stdout
+# if CDPATH is set.
+if test "X\${CDPATH+set}" = Xset; then CDPATH=:; export CDPATH; fi
+
+# ### BEGIN LIBTOOL CONFIG
+
+# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
+
+# Shell to use when invoking shell scripts.
+SHELL=$lt_SHELL
+
+# Whether or not to build shared libraries.
+build_libtool_libs=$enable_shared
+
+# Whether or not to build static libraries.
+build_old_libs=$enable_static
+
+# Whether or not to add -lc for building shared libraries.
+build_libtool_need_lc=$need_lc
+
+# Whether or not to optimize for fast installation.
+fast_install=$enable_fast_install
+
+# The host system.
+host_alias=$host_alias
+host=$host
+
+# An echo program that does not interpret backslashes.
+echo=$lt_echo
+
+# The archiver.
+AR=$lt_AR
+AR_FLAGS=$lt_AR_FLAGS
+
+# The default C compiler.
+CC=$lt_CC
+
+# Is the compiler the GNU C compiler?
+with_gcc=$GCC
+
+# The linker used to build libraries.
+LD=$lt_LD
+
+# Whether we need hard or soft links.
+LN_S=$lt_LN_S
+
+# A BSD-compatible nm program.
+NM=$lt_NM
+
+# A symbol stripping program
+STRIP=$STRIP
+
+# Used to examine libraries when file_magic_cmd begins "file"
+MAGIC_CMD=$MAGIC_CMD
+
+# Used on cygwin: DLL creation program.
+DLLTOOL="$DLLTOOL"
+
+# Used on cygwin: object dumper.
+OBJDUMP="$OBJDUMP"
+
+# Used on cygwin: assembler.
+AS="$AS"
+
+# The name of the directory that contains temporary libtool files.
+objdir=$objdir
+
+# How to create reloadable object files.
+reload_flag=$lt_reload_flag
+reload_cmds=$lt_reload_cmds
+
+# How to pass a linker flag through the compiler.
+wl=$lt_wl
+
+# Object file suffix (normally "o").
+objext="$ac_objext"
+
+# Old archive suffix (normally "a").
+libext="$libext"
+
+# Executable file suffix (normally "").
+exeext="$exeext"
+
+# Additional compiler flags for building library objects.
+pic_flag=$lt_pic_flag
+pic_mode=$pic_mode
+
+# Does compiler simultaneously support -c and -o options?
+compiler_c_o=$lt_compiler_c_o
+
+# Can we write directly to a .lo ?
+compiler_o_lo=$lt_compiler_o_lo
+
+# Must we lock files when doing compilation ?
+need_locks=$lt_need_locks
+
+# Do we need the lib prefix for modules?
+need_lib_prefix=$need_lib_prefix
+
+# Do we need a version for libraries?
+need_version=$need_version
+
+# Whether dlopen is supported.
+dlopen_support=$enable_dlopen
+
+# Whether dlopen of programs is supported.
+dlopen_self=$enable_dlopen_self
+
+# Whether dlopen of statically linked programs is supported.
+dlopen_self_static=$enable_dlopen_self_static
+
+# Compiler flag to prevent dynamic linking.
+link_static_flag=$lt_link_static_flag
+
+# Compiler flag to turn off builtin functions.
+no_builtin_flag=$lt_no_builtin_flag
+
+# Compiler flag to allow reflexive dlopens.
+export_dynamic_flag_spec=$lt_export_dynamic_flag_spec
+
+# Compiler flag to generate shared objects directly from archives.
+whole_archive_flag_spec=$lt_whole_archive_flag_spec
+
+# Compiler flag to generate thread-safe objects.
+thread_safe_flag_spec=$lt_thread_safe_flag_spec
+
+# Library versioning type.
+version_type=$version_type
+
+# Format of library name prefix.
+libname_spec=$lt_libname_spec
+
+# List of archive names.  First name is the real one, the rest are links.
+# The last name is the one that the linker finds with -lNAME.
+library_names_spec=$lt_library_names_spec
+
+# The coded name of the library, if different from the real name.
+soname_spec=$lt_soname_spec
+
+# Commands used to build and install an old-style archive.
+RANLIB=$lt_RANLIB
+old_archive_cmds=$lt_old_archive_cmds
+old_postinstall_cmds=$lt_old_postinstall_cmds
+old_postuninstall_cmds=$lt_old_postuninstall_cmds
+
+# Create an old-style archive from a shared archive.
+old_archive_from_new_cmds=$lt_old_archive_from_new_cmds
+
+# Create a temporary old-style archive to link instead of a shared archive.
+old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds
+
+# Commands used to build and install a shared archive.
+archive_cmds=$lt_archive_cmds
+archive_expsym_cmds=$lt_archive_expsym_cmds
+postinstall_cmds=$lt_postinstall_cmds
+postuninstall_cmds=$lt_postuninstall_cmds
+
+# Commands to strip libraries.
+old_striplib=$lt_old_striplib
+striplib=$lt_striplib
+
+# Method to check whether dependent libraries are shared objects.
+deplibs_check_method=$lt_deplibs_check_method
+
+# Command to use when deplibs_check_method == file_magic.
+file_magic_cmd=$lt_file_magic_cmd
+
+# Flag that allows shared libraries with undefined symbols to be built.
+allow_undefined_flag=$lt_allow_undefined_flag
+
+# Flag that forces no undefined symbols.
+no_undefined_flag=$lt_no_undefined_flag
+
+# Commands used to finish a libtool library installation in a directory.
+finish_cmds=$lt_finish_cmds
+
+# Same as above, but a single script fragment to be evaled but not shown.
+finish_eval=$lt_finish_eval
+
+# Take the output of nm and produce a listing of raw symbols and C names.
+global_symbol_pipe=$lt_global_symbol_pipe
+
+# Transform the output of nm in a proper C declaration
+global_symbol_to_cdecl=$lt_global_symbol_to_cdecl
+
+# Transform the output of nm in a C name address pair
+global_symbol_to_c_name_address=$lt_global_symbol_to_c_name_address
+
+# This is the shared library runtime path variable.
+runpath_var=$runpath_var
+
+# This is the shared library path variable.
+shlibpath_var=$shlibpath_var
+
+# Is shlibpath searched before the hard-coded library search path?
+shlibpath_overrides_runpath=$shlibpath_overrides_runpath
+
+# How to hardcode a shared library path into an executable.
+hardcode_action=$hardcode_action
+
+# Whether we should hardcode library paths into libraries.
+hardcode_into_libs=$hardcode_into_libs
+
+# Flag to hardcode \$libdir into a binary during linking.
+# This must work even if \$libdir does not exist.
+hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec
+
+# Whether we need a single -rpath flag with a separated argument.
+hardcode_libdir_separator=$lt_hardcode_libdir_separator
+
+# Set to yes if using DIR/libNAME.so during linking hardcodes DIR into the
+# resulting binary.
+hardcode_direct=$hardcode_direct
+
+# Set to yes if using the -LDIR flag during linking hardcodes DIR into the
+# resulting binary.
+hardcode_minus_L=$hardcode_minus_L
+
+# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into
+# the resulting binary.
+hardcode_shlibpath_var=$hardcode_shlibpath_var
+
+# Variables whose values should be saved in libtool wrapper scripts and
+# restored at relink time.
+variables_saved_for_relink="$variables_saved_for_relink"
+
+# Whether libtool must link a program against all its dependency libraries.
+link_all_deplibs=$link_all_deplibs
+
+# Compile-time system search path for libraries
+sys_lib_search_path_spec=$lt_sys_lib_search_path_spec
+
+# Run-time system search path for libraries
+sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec
+
+# Fix the shell variable \$srcfile for the compiler.
+fix_srcfile_path="$fix_srcfile_path"
+
+# Set to yes if exported symbols are required.
+always_export_symbols=$always_export_symbols
+
+# The commands to list exported symbols.
+export_symbols_cmds=$lt_export_symbols_cmds
+
+# The commands to extract the exported symbol list from a shared archive.
+extract_expsyms_cmds=$lt_extract_expsyms_cmds
+
+# Symbols that should not be listed in the preloaded symbols.
+exclude_expsyms=$lt_exclude_expsyms
+
+# Symbols that must always be exported.
+include_expsyms=$lt_include_expsyms
+
+# ### END LIBTOOL CONFIG
+
+__EOF__
+
+  case $host_os in
+  aix3*)
+    cat <<\EOF >> "${ofile}T"
+
+# AIX sometimes has problems with the GCC collect2 program.  For some
+# reason, if we set the COLLECT_NAMES environment variable, the problems
+# vanish in a puff of smoke.
+if test "X${COLLECT_NAMES+set}" != Xset; then
+  COLLECT_NAMES=
+  export COLLECT_NAMES
+fi
+EOF
+    ;;
+  esac
+
+  case $host_os in
+  cygwin* | mingw* | pw32* | os2*)
+    cat <<'EOF' >> "${ofile}T"
+      # This is a source program that is used to create dlls on Windows
+      # Don't remove nor modify the starting and closing comments
+# /* ltdll.c starts here */
+# #define WIN32_LEAN_AND_MEAN
+# #include <windows.h>
+# #undef WIN32_LEAN_AND_MEAN
+# #include <stdio.h>
+#
+# #ifndef __CYGWIN__
+# #  ifdef __CYGWIN32__
+# #    define __CYGWIN__ __CYGWIN32__
+# #  endif
+# #endif
+#
+# #ifdef __cplusplus
+# extern "C" {
+# #endif
+# BOOL APIENTRY DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved);
+# #ifdef __cplusplus
+# }
+# #endif
+#
+# #ifdef __CYGWIN__
+# #include <cygwin/cygwin_dll.h>
+# DECLARE_CYGWIN_DLL( DllMain );
+# #endif
+# HINSTANCE __hDllInstance_base;
+#
+# BOOL APIENTRY
+# DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved)
+# {
+#   __hDllInstance_base = hInst;
+#   return TRUE;
+# }
+# /* ltdll.c ends here */
+	# This is a source program that is used to create import libraries
+	# on Windows for dlls which lack them. Don't remove nor modify the
+	# starting and closing comments
+# /* impgen.c starts here */
+# /*   Copyright (C) 1999-2000 Free Software Foundation, Inc.
+#
+#  This file is part of GNU libtool.
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#  */
+#
+# #include <stdio.h>		/* for printf() */
+# #include <unistd.h>		/* for open(), lseek(), read() */
+# #include <fcntl.h>		/* for O_RDONLY, O_BINARY */
+# #include <string.h>		/* for strdup() */
+#
+# /* O_BINARY isn't required (or even defined sometimes) under Unix */
+# #ifndef O_BINARY
+# #define O_BINARY 0
+# #endif
+#
+# static unsigned int
+# pe_get16 (fd, offset)
+#      int fd;
+#      int offset;
+# {
+#   unsigned char b[2];
+#   lseek (fd, offset, SEEK_SET);
+#   read (fd, b, 2);
+#   return b[0] + (b[1]<<8);
+# }
+#
+# static unsigned int
+# pe_get32 (fd, offset)
+#     int fd;
+#     int offset;
+# {
+#   unsigned char b[4];
+#   lseek (fd, offset, SEEK_SET);
+#   read (fd, b, 4);
+#   return b[0] + (b[1]<<8) + (b[2]<<16) + (b[3]<<24);
+# }
+#
+# static unsigned int
+# pe_as32 (ptr)
+#      void *ptr;
+# {
+#   unsigned char *b = ptr;
+#   return b[0] + (b[1]<<8) + (b[2]<<16) + (b[3]<<24);
+# }
+#
+# int
+# main (argc, argv)
+#     int argc;
+#     char *argv[];
+# {
+#     int dll;
+#     unsigned long pe_header_offset, opthdr_ofs, num_entries, i;
+#     unsigned long export_rva, export_size, nsections, secptr, expptr;
+#     unsigned long name_rvas, nexp;
+#     unsigned char *expdata, *erva;
+#     char *filename, *dll_name;
+#
+#     filename = argv[1];
+#
+#     dll = open(filename, O_RDONLY|O_BINARY);
+#     if (dll < 1)
+# 	return 1;
+#
+#     dll_name = filename;
+#
+#     for (i=0; filename[i]; i++)
+# 	if (filename[i] == '/' || filename[i] == '\\'  || filename[i] == ':')
+# 	    dll_name = filename + i +1;
+#
+#     pe_header_offset = pe_get32 (dll, 0x3c);
+#     opthdr_ofs = pe_header_offset + 4 + 20;
+#     num_entries = pe_get32 (dll, opthdr_ofs + 92);
+#
+#     if (num_entries < 1) /* no exports */
+# 	return 1;
+#
+#     export_rva = pe_get32 (dll, opthdr_ofs + 96);
+#     export_size = pe_get32 (dll, opthdr_ofs + 100);
+#     nsections = pe_get16 (dll, pe_header_offset + 4 +2);
+#     secptr = (pe_header_offset + 4 + 20 +
+# 	      pe_get16 (dll, pe_header_offset + 4 + 16));
+#
+#     expptr = 0;
+#     for (i = 0; i < nsections; i++)
+#     {
+# 	char sname[8];
+# 	unsigned long secptr1 = secptr + 40 * i;
+# 	unsigned long vaddr = pe_get32 (dll, secptr1 + 12);
+# 	unsigned long vsize = pe_get32 (dll, secptr1 + 16);
+# 	unsigned long fptr = pe_get32 (dll, secptr1 + 20);
+# 	lseek(dll, secptr1, SEEK_SET);
+# 	read(dll, sname, 8);
+# 	if (vaddr <= export_rva && vaddr+vsize > export_rva)
+# 	{
+# 	    expptr = fptr + (export_rva - vaddr);
+# 	    if (export_rva + export_size > vaddr + vsize)
+# 		export_size = vsize - (export_rva - vaddr);
+# 	    break;
+# 	}
+#     }
+#
+#     expdata = (unsigned char*)malloc(export_size);
+#     lseek (dll, expptr, SEEK_SET);
+#     read (dll, expdata, export_size);
+#     erva = expdata - export_rva;
+#
+#     nexp = pe_as32 (expdata+24);
+#     name_rvas = pe_as32 (expdata+32);
+#
+#     printf ("EXPORTS\n");
+#     for (i = 0; i<nexp; i++)
+#     {
+# 	unsigned long name_rva = pe_as32 (erva+name_rvas+i*4);
+# 	printf ("\t%s @ %ld ;\n", erva+name_rva, 1+ i);
+#     }
+#
+#     return 0;
+# }
+# /* impgen.c ends here */
+
+EOF
+    ;;
+  esac
+
+  # We use sed instead of cat because bash on DJGPP gets confused if
+  # if finds mixed CR/LF and LF-only lines.  Since sed operates in
+  # text mode, it properly converts lines to CR/LF.  This bash problem
+  # is reportedly fixed, but why not run on old versions too?
+  sed '$q' "$ltmain" >> "${ofile}T" || (rm -f "${ofile}T"; exit 1)
+
+  mv -f "${ofile}T" "$ofile" || \
+    (rm -f "$ofile" && cp "${ofile}T" "$ofile" && rm -f "${ofile}T")
+  chmod +x "$ofile"
+fi
+##
+## END FIXME
+
+
+
+
+
+# This can be used to rebuild libtool when needed
+LIBTOOL_DEPS="$ac_aux_dir/ltmain.sh"
+
+# Always use our own libtool.
+LIBTOOL='$(SHELL) $(top_builddir)/libtool'
+
+# Prevent multiple expansion
+
+
+
+# Find a good install program.  We prefer a C program (faster),
+# so one script is as good as another.  But avoid the broken or
+# incompatible versions:
+# SysV /etc/install, /usr/sbin/install
+# SunOS /usr/etc/install
+# IRIX /sbin/install
+# AIX /bin/install
+# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag
+# AFS /usr/afsws/bin/install, which mishandles nonexistent args
+# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
+# ./install, which can be erroneously created by make from ./install.sh.
+echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6
+echo "configure:6393: checking for a BSD compatible install" >&5
+if test -z "$INSTALL"; then
+if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+    IFS="${IFS= 	}"; ac_save_IFS="$IFS"; IFS=":"
+  for ac_dir in $PATH; do
+    # Account for people who put trailing slashes in PATH elements.
+    case "$ac_dir/" in
+    /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;;
+    *)
+      # OSF1 and SCO ODT 3.0 have their own names for install.
+      # Don't use installbsd from OSF since it installs stuff as root
+      # by default.
+      for ac_prog in ginstall scoinst install; do
+        if test -f $ac_dir/$ac_prog; then
+	  if test $ac_prog = install &&
+            grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then
+	    # AIX install.  It has an incompatible calling convention.
+	    :
+	  else
+	    ac_cv_path_install="$ac_dir/$ac_prog -c"
+	    break 2
+	  fi
+	fi
+      done
+      ;;
+    esac
+  done
+  IFS="$ac_save_IFS"
+
+fi
+  if test "${ac_cv_path_install+set}" = set; then
+    INSTALL="$ac_cv_path_install"
+  else
+    # As a last resort, use the slow shell script.  We don't cache a
+    # path for INSTALL within a source directory, because that will
+    # break other packages using the cache if that directory is
+    # removed, or if the path is relative.
+    INSTALL="$ac_install_sh"
+  fi
+fi
+echo "$ac_t""$INSTALL" 1>&6
+
+# Use test -z because SunOS4 sh mishandles braces in ${var-val}.
+# It thinks the first close brace ends the variable substitution.
+test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
+
+test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}'
+
+test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
+
+echo $ac_n "checking whether ln -s works""... $ac_c" 1>&6
+echo "configure:6446: checking whether ln -s works" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_LN_S'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  rm -f conftestdata
+if ln -s X conftestdata 2>/dev/null
+then
+  rm -f conftestdata
+  ac_cv_prog_LN_S="ln -s"
+else
+  ac_cv_prog_LN_S=ln
+fi
+fi
+LN_S="$ac_cv_prog_LN_S"
+if test "$ac_cv_prog_LN_S" = "ln -s"; then
+  echo "$ac_t""yes" 1>&6
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6
+echo "configure:6467: checking whether ${MAKE-make} sets \${MAKE}" >&5
+set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftestmake <<\EOF
+all:
+	@echo 'ac_maketemp="${MAKE}"'
+EOF
+# GNU make sometimes prints "make[1]: Entering...", which would confuse us.
+eval `${MAKE-make} -f conftestmake 2>/dev/null | grep temp=`
+if test -n "$ac_maketemp"; then
+  eval ac_cv_prog_make_${ac_make}_set=yes
+else
+  eval ac_cv_prog_make_${ac_make}_set=no
+fi
+rm -f conftestmake
+fi
+if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  SET_MAKE=
+else
+  echo "$ac_t""no" 1>&6
+  SET_MAKE="MAKE=${MAKE-make}"
+fi
+
+# Extract the first word of "ps", so it can be a program name with args.
+set dummy ps; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:6496: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_path_PSPROG'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  case "$PSPROG" in
+  /*)
+  ac_cv_path_PSPROG="$PSPROG" # Let the user override the test with a path.
+  ;;
+  ?:/*)			 
+  ac_cv_path_PSPROG="$PSPROG" # Let the user override the test with a dos path.
+  ;;
+  *)
+  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS=":"
+  ac_dummy="$PATH"
+  for ac_dir in $ac_dummy; do 
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/$ac_word; then
+      ac_cv_path_PSPROG="$ac_dir/$ac_word"
+      break
+    fi
+  done
+  IFS="$ac_save_ifs"
+  ;;
+esac
+fi
+PSPROG="$ac_cv_path_PSPROG"
+if test -n "$PSPROG"; then
+  echo "$ac_t""$PSPROG" 1>&6
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+# Extract the first word of "perl", so it can be a program name with args.
+set dummy perl; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:6531: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_path_PERLPROG'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  case "$PERLPROG" in
+  /*)
+  ac_cv_path_PERLPROG="$PERLPROG" # Let the user override the test with a path.
+  ;;
+  ?:/*)			 
+  ac_cv_path_PERLPROG="$PERLPROG" # Let the user override the test with a dos path.
+  ;;
+  *)
+  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS=":"
+  ac_dummy="$PATH"
+  for ac_dir in $ac_dummy; do 
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/$ac_word; then
+      ac_cv_path_PERLPROG="$ac_dir/$ac_word"
+      break
+    fi
+  done
+  IFS="$ac_save_ifs"
+  ;;
+esac
+fi
+PERLPROG="$ac_cv_path_PERLPROG"
+if test -n "$PERLPROG"; then
+  echo "$ac_t""$PERLPROG" 1>&6
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+for ac_prog in whoami logname
+do
+# Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:6568: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_WHOAMI'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  if test -n "$WHOAMI"; then
+  ac_cv_prog_WHOAMI="$WHOAMI" # Let the user override the test.
+else
+  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS=":"
+  ac_dummy="$PATH"
+  for ac_dir in $ac_dummy; do
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/$ac_word; then
+      ac_cv_prog_WHOAMI="$ac_prog"
+      break
+    fi
+  done
+  IFS="$ac_save_ifs"
+fi
+fi
+WHOAMI="$ac_cv_prog_WHOAMI"
+if test -n "$WHOAMI"; then
+  echo "$ac_t""$WHOAMI" 1>&6
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+test -n "$WHOAMI" && break
+done
+test -n "$WHOAMI" || WHOAMI="whoami"
+
+for ac_prog in sed gsed
+do
+# Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:6603: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_SED'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  if test -n "$SED"; then
+  ac_cv_prog_SED="$SED" # Let the user override the test.
+else
+  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS=":"
+  ac_dummy="$PATH"
+  for ac_dir in $ac_dummy; do
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/$ac_word; then
+      ac_cv_prog_SED="$ac_prog"
+      break
+    fi
+  done
+  IFS="$ac_save_ifs"
+fi
+fi
+SED="$ac_cv_prog_SED"
+if test -n "$SED"; then
+  echo "$ac_t""$SED" 1>&6
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+test -n "$SED" && break
+done
+
+# Extract the first word of "autoconf", so it can be a program name with args.
+set dummy autoconf; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:6635: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_AUTOCONF'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  if test -n "$AUTOCONF"; then
+  ac_cv_prog_AUTOCONF="$AUTOCONF" # Let the user override the test.
+else
+  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS=":"
+  ac_dummy="$PATH"
+  for ac_dir in $ac_dummy; do
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/$ac_word; then
+      ac_cv_prog_AUTOCONF=""
+      break
+    fi
+  done
+  IFS="$ac_save_ifs"
+fi
+fi
+AUTOCONF="$ac_cv_prog_AUTOCONF"
+if test -n "$AUTOCONF"; then
+  echo "$ac_t""$AUTOCONF" 1>&6
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+# Extract the first word of "autoheader", so it can be a program name with args.
+set dummy autoheader; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:6664: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_AUTOHEADER'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  if test -n "$AUTOHEADER"; then
+  ac_cv_prog_AUTOHEADER="$AUTOHEADER" # Let the user override the test.
+else
+  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS=":"
+  ac_dummy="$PATH"
+  for ac_dir in $ac_dummy; do
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/$ac_word; then
+      ac_cv_prog_AUTOHEADER=""
+      break
+    fi
+  done
+  IFS="$ac_save_ifs"
+fi
+fi
+AUTOHEADER="$ac_cv_prog_AUTOHEADER"
+if test -n "$AUTOHEADER"; then
+  echo "$ac_t""$AUTOHEADER" 1>&6
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+if test "x$ac_cv_prog_AUTOCONF" = "x"; then
+	AUTOCONF=":"
+	
+fi
+if test "x$ac_cv_prog_AUTOHEADER" = "x"; then
+	AUTOHEADER=":"
+	
+fi
+
+# Extract the first word of "uname", so it can be a program name with args.
+set dummy uname; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:6702: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_path_UNAMEPROG'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  case "$UNAMEPROG" in
+  /*)
+  ac_cv_path_UNAMEPROG="$UNAMEPROG" # Let the user override the test with a path.
+  ;;
+  ?:/*)			 
+  ac_cv_path_UNAMEPROG="$UNAMEPROG" # Let the user override the test with a dos path.
+  ;;
+  *)
+  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS=":"
+  ac_dummy="$PATH"
+  for ac_dir in $ac_dummy; do 
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/$ac_word; then
+      ac_cv_path_UNAMEPROG="$ac_dir/$ac_word"
+      break
+    fi
+  done
+  IFS="$ac_save_ifs"
+  ;;
+esac
+fi
+UNAMEPROG="$ac_cv_path_UNAMEPROG"
+if test -n "$UNAMEPROG"; then
+  echo "$ac_t""$UNAMEPROG" 1>&6
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+cat >> confdefs.h <<EOF
+#define UNAMEPROG "$UNAMEPROG"
+EOF
+
+
+echo $ac_n "checking for working const""... $ac_c" 1>&6
+echo "configure:6740: checking for working const" >&5
+if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 6745 "configure"
+#include "confdefs.h"
+
+int main() {
+
+/* Ultrix mips cc rejects this.  */
+typedef int charset[2]; const charset x;
+/* SunOS 4.1.1 cc rejects this.  */
+char const *const *ccp;
+char **p;
+/* NEC SVR4.0.2 mips cc rejects this.  */
+struct point {int x, y;};
+static struct point const zero = {0,0};
+/* AIX XL C 1.02.0.0 rejects this.
+   It does not let you subtract one const X* pointer from another in an arm
+   of an if-expression whose if-part is not a constant expression */
+const char *g = "string";
+ccp = &g + (g ? g-g : 0);
+/* HPUX 7.0 cc rejects these. */
+++ccp;
+p = (char**) ccp;
+ccp = (char const *const *) p;
+{ /* SCO 3.2v4 cc rejects this.  */
+  char *t;
+  char const *s = 0 ? (char *) 0 : (char const *) 0;
+
+  *t++ = 0;
+}
+{ /* Someone thinks the Sun supposedly-ANSI compiler will reject this.  */
+  int x[] = {25, 17};
+  const int *foo = &x[0];
+  ++foo;
+}
+{ /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */
+  typedef const int *iptr;
+  iptr p = 0;
+  ++p;
+}
+{ /* AIX XL C 1.02.0.0 rejects this saying
+     "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */
+  struct s { int j; const int *ap[3]; };
+  struct s *b; b->j = 5;
+}
+{ /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */
+  const int foo = 10;
+}
+
+; return 0; }
+EOF
+if { (eval echo configure:6794: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  ac_cv_c_const=yes
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  ac_cv_c_const=no
+fi
+rm -f conftest*
+fi
+
+echo "$ac_t""$ac_cv_c_const" 1>&6
+if test $ac_cv_c_const = no; then
+  cat >> confdefs.h <<\EOF
+#define const 
+EOF
+
+fi
+
+echo $ac_n "checking for inline""... $ac_c" 1>&6
+echo "configure:6815: checking for inline" >&5
+if eval "test \"`echo '$''{'ac_cv_c_inline'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  ac_cv_c_inline=no
+for ac_kw in inline __inline__ __inline; do
+  cat > conftest.$ac_ext <<EOF
+#line 6822 "configure"
+#include "confdefs.h"
+
+int main() {
+} $ac_kw foo() {
+; return 0; }
+EOF
+if { (eval echo configure:6829: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  ac_cv_c_inline=$ac_kw; break
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+fi
+rm -f conftest*
+done
+
+fi
+
+echo "$ac_t""$ac_cv_c_inline" 1>&6
+case "$ac_cv_c_inline" in
+  inline | yes) ;;
+  no) cat >> confdefs.h <<\EOF
+#define inline 
+EOF
+ ;;
+  *)  cat >> confdefs.h <<EOF
+#define inline $ac_cv_c_inline
+EOF
+ ;;
+esac
+
+
+echo $ac_n "checking for net-snmp version number""... $ac_c" 1>&6
+echo "configure:6856: checking for net-snmp version number" >&5
+VERSION=`grep NetSnmpVersionInfo.*= $srcdir/snmplib/snmp_version.c | sed 's/";.*//;s/.*"//;s/pre/0./;'`
+
+RELEASEVERSION=`echo $VERSION | sed 's/^\([0-9]\)\.\([0-9]\)/\1:\2:0/'`
+
+
+
+echo "$ac_t""$VERSION" 1>&6
+
+  cat >> configure-summary << EOF
+  Net-SNMP Version:           $VERSION
+EOF
+
+
+echo $ac_n "checking for developer gcc flags""... $ac_c" 1>&6
+echo "configure:6871: checking for developer gcc flags" >&5
+if test "x$developer" = "xyes" -a "x$ac_cv_prog_gcc" = "xyes"; then
+  DEVFLAGS="-Wall -Wstrict-prototypes -Wwrite-strings -Wcast-qual -Wno-char-subscripts"
+else
+  DEVFLAGS=""
+fi
+echo "$ac_t""$DEVFLAGS" 1>&6
+
+
+
+# Do some error checking and defaulting for the host and target type.
+# The inputs are:
+#    configure --host=HOST --target=TARGET --build=BUILD NONOPT
+#
+# The rules are:
+# 1. You are not allowed to specify --host, --target, and nonopt at the
+#    same time.
+# 2. Host defaults to nonopt.
+# 3. If nonopt is not specified, then host defaults to the current host,
+#    as determined by config.guess.
+# 4. Target and build default to nonopt.
+# 5. If nonopt is not specified, then target and build default to host.
+
+# The aliases save the names the user supplied, while $host etc.
+# will get canonicalized.
+case $host---$target---$nonopt in
+NONE---*---* | *---NONE---* | *---*---NONE) ;;
+*) { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; } ;;
+esac
+
+
+# Make sure we can run config.sub.
+if ${CONFIG_SHELL-/bin/sh} $ac_config_sub sun4 >/dev/null 2>&1; then :
+else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; }
+fi
+
+echo $ac_n "checking host system type""... $ac_c" 1>&6
+echo "configure:6908: checking host system type" >&5
+
+host_alias=$host
+case "$host_alias" in
+NONE)
+  case $nonopt in
+  NONE)
+    if host_alias=`${CONFIG_SHELL-/bin/sh} $ac_config_guess`; then :
+    else { echo "configure: error: can not guess host type; you must specify one" 1>&2; exit 1; }
+    fi ;;
+  *) host_alias=$nonopt ;;
+  esac ;;
+esac
+
+host=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $host_alias`
+host_cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
+host_vendor=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
+host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
+echo "$ac_t""$host" 1>&6
+
+echo $ac_n "checking target system type""... $ac_c" 1>&6
+echo "configure:6929: checking target system type" >&5
+
+target_alias=$target
+case "$target_alias" in
+NONE)
+  case $nonopt in
+  NONE) target_alias=$host_alias ;;
+  *) target_alias=$nonopt ;;
+  esac ;;
+esac
+
+target=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $target_alias`
+target_cpu=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
+target_vendor=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
+target_os=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
+echo "$ac_t""$target" 1>&6
+
+echo $ac_n "checking build system type""... $ac_c" 1>&6
+echo "configure:6947: checking build system type" >&5
+
+build_alias=$build
+case "$build_alias" in
+NONE)
+  case $nonopt in
+  NONE) build_alias=$host_alias ;;
+  *) build_alias=$nonopt ;;
+  esac ;;
+esac
+
+build=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $build_alias`
+build_cpu=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
+build_vendor=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
+build_os=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
+echo "$ac_t""$build" 1>&6
+
+test "$host_alias" != "$target_alias" &&
+  test "$program_prefix$program_suffix$program_transform_name" = \
+    NONENONEs,x,x, &&
+  program_prefix=${target_alias}-
+
+
+PARTIALTARGETOS=`echo $target_os | sed 's/[-._].*//'`
+CFLAGS="$CFLAGS -D$PARTIALTARGETOS"
+
+
+  cat >> configure-summary << EOF
+  Building for:               $PARTIALTARGETOS
+EOF
+
+
+
+echo $ac_n "checking for system include file""... $ac_c" 1>&6
+echo "configure:6981: checking for system include file" >&5
+
+filebase=$target_os
+filebase=`echo $filebase | sed 's/elf//'`
+filebase=`echo $filebase | sed 's/aout//'`
+filebase=`echo $filebase | sed 's/ecoff//'`
+filebase=`echo $filebase | sed 's/coff//'`
+while test "x$filebase" != "x$last" -a ! -f $srcdir/include/net-snmp/system/$filebase.h
+do
+    last=$filebase
+    filebase=`echo $filebase | sed 's/[-._][^-._]*$//'`
+    if test "x$filebase" = "x$last"; then
+	filebase=`echo $filebase | sed 's/[0-9]*$//'`
+    fi
+done
+
+if test "x$filebase" = "x$last"; then
+    filebase="generic"
+fi
+ac_cv_SYSTEM_INCLUDE_FILE="net-snmp/system/$filebase.h"
+
+
+echo "$ac_t""$ac_cv_SYSTEM_INCLUDE_FILE" 1>&6
+cat >> confdefs.h <<EOF
+#define SYSTEM_INCLUDE_FILE "$ac_cv_SYSTEM_INCLUDE_FILE"
+EOF
+
+
+
+echo $ac_n "checking for machine-type include file""... $ac_c" 1>&6
+echo "configure:7011: checking for machine-type include file" >&5
+
+filebase=$target_cpu
+while test "x$filebase" != "x$last" -a ! -f $srcdir/include/net-snmp/machine/$filebase.h
+do
+    last=$filebase
+    filebase=`echo $filebase | sed 's/[-._][^-._]*$//'`
+done
+
+if test "x$filebase" = "x$last"; then
+    filebase="generic"
+fi
+ac_cv_MACHINE_INCLUDE_FILE="net-snmp/machine/$filebase.h"
+
+
+echo "$ac_t""$ac_cv_MACHINE_INCLUDE_FILE" 1>&6
+cat >> confdefs.h <<EOF
+#define MACHINE_INCLUDE_FILE "$ac_cv_MACHINE_INCLUDE_FILE"
+EOF
+
+
+# Extract the first word of "$CC", so it can be a program name with args.
+set dummy $CC; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:7035: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_path_CCPATH'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  case "$CCPATH" in
+  /*)
+  ac_cv_path_CCPATH="$CCPATH" # Let the user override the test with a path.
+  ;;
+  ?:/*)			 
+  ac_cv_path_CCPATH="$CCPATH" # Let the user override the test with a dos path.
+  ;;
+  *)
+  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS=":"
+  ac_dummy="$PATH"
+  for ac_dir in $ac_dummy; do 
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/$ac_word; then
+      ac_cv_path_CCPATH="$ac_dir/$ac_word"
+      break
+    fi
+  done
+  IFS="$ac_save_ifs"
+  ;;
+esac
+fi
+CCPATH="$ac_cv_path_CCPATH"
+if test -n "$CCPATH"; then
+  echo "$ac_t""$CCPATH" 1>&6
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+case $target_os in
+    bsdi*)
+	if test "x$CCPATH" = "x/usr/ucb/cc" -o "x$CCPATH" = "x/usr/bin/cc"; then
+	    { echo "configure: error: 
+
+*** The BSDI /usr/ucb/cc compiler does not work with this package.  
+*** Please run configure with --with-cc=gcc
+" 1>&2; exit 1; }
+	fi
+    ;;
+    solaris*)
+	if test "x$CCPATH" = "x/usr/ucb/cc"; then
+	    { echo "configure: error: 
+
+*** The solaris /usr/ucb/cc compiler does not work with this package.  
+*** Please put a different compiler in your path first or run
+*** configure with --with-cc=XX, where XX is the compiler you want to use.
+" 1>&2; exit 1; }
+	fi
+    ;;
+esac
+    
+echo $ac_n "checking for additional cpp flags""... $ac_c" 1>&6
+echo "configure:7090: checking for additional cpp flags" >&5
+if test "x$GCC" = "xyes" -a "x$CPP" = "x$CC -E"; then
+    EXTRACPPFLAGS="-x c"
+else
+  EXTRACPPFLAGS=""
+fi
+
+if test "x$GCC" != "xyes"; then
+  case $target_os in
+    solaris*) EXTRACPPFLAGS="$EXTRACPPFLAGS -Xs" ;;
+  esac
+fi
+
+
+echo "$ac_t""$EXTRACPPFLAGS" 1>&6
+
+
+if test "x$prefix" = "xNONE"; then
+  prefix=/usr/local
+fi
+
+fch=`echo $prefix | sed 's/\(.\).*/\1/'`
+if test $fch != "/" ; then
+   prefix=`pwd`/$prefix
+   echo "adjusting prefix to $prefix"
+fi
+
+if test "x$exec_prefix" = "xNONE"; then
+  exec_prefix=$prefix
+fi
+
+fch=`echo $exec_prefix | sed 's/\(.\).*/\1/'`
+if test $fch != "/" ; then
+   exec_prefix=`pwd`/$exec_prefix
+   echo "adjusting exec_prefix to $exec_prefix"
+fi
+
+
+SNMPLIBPATH=""
+tmpset="$libdir/snmp"
+while test "x$tmpset" != "x$SNMPLIBPATH"; do
+  SNMPLIBPATH="$tmpset"
+  eval tmpset="$tmpset"
+done
+cat >> confdefs.h <<EOF
+#define SNMPLIBPATH "$SNMPLIBPATH"
+EOF
+
+cat >> confdefs.h <<EOF
+#define SNMPDLMODPATH "$SNMPLIBPATH/dlmod"
+EOF
+
+
+SNMPSHAREPATH=""
+tmpset="$datadir/snmp"
+while test "x$tmpset" != "x$SNMPSHAREPATH"; do
+  SNMPSHAREPATH="$tmpset"
+  eval tmpset="$tmpset"
+done
+cat >> confdefs.h <<EOF
+#define SNMPSHAREPATH "$SNMPSHAREPATH"
+EOF
+
+
+if test "x$DEFAULT_MIBDIRS" = "x"; then
+  cat >> confdefs.h <<EOF
+#define DEFAULT_MIBDIRS "\$HOME/.snmp/mibs:$SNMPSHAREPATH/mibs"
+EOF
+
+fi
+
+SNMPCONFPATH=""
+tmpset="$sysconfdir/snmp"
+while test "x$tmpset" != "x$SNMPCONFPATH"; do
+  SNMPCONFPATH="$tmpset"
+  eval tmpset="$tmpset"
+done
+cat >> confdefs.h <<EOF
+#define SNMPCONFPATH "$SNMPCONFPATH"
+EOF
+
+
+
+if test "x$enable_ipv6" = "xyes"; then
+	v6type=unknown
+	v6lib=none
+	v6trylibc=no
+
+	echo $ac_n "checking ipv6 stack type""... $ac_c" 1>&6
+echo "configure:7179: checking ipv6 stack type" >&5
+	for i in v6d toshiba kame inria zeta linux-glibc linux-inet6; do
+		case $i in
+		v6d)
+			cat > conftest.$ac_ext <<EOF
+#line 7184 "configure"
+#include "confdefs.h"
+dnl
+#include </usr/local/v6/include/sys/types.h>
+#ifdef __V6D__
+yes
+#endif
+EOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  egrep "yes" >/dev/null 2>&1; then
+  rm -rf conftest*
+  v6type=$i; v6lib=v6;
+				v6libdir=/usr/local/v6/lib;
+				CFLAGS="-I/usr/local/v6/include $CFLAGS"
+fi
+rm -f conftest*
+
+			;;
+		toshiba)
+			cat > conftest.$ac_ext <<EOF
+#line 7204 "configure"
+#include "confdefs.h"
+dnl
+#include <sys/param.h>
+#ifdef _TOSHIBA_INET6
+yes
+#endif
+EOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  egrep "yes" >/dev/null 2>&1; then
+  rm -rf conftest*
+  v6type=$i; v6lib=inet6;
+				v6libdir=/usr/local/v6/lib;
+				CFLAGS="-DINET6 $CFLAGS"
+fi
+rm -f conftest*
+
+			;;
+		kame)
+			cat > conftest.$ac_ext <<EOF
+#line 7224 "configure"
+#include "confdefs.h"
+dnl
+#include <netinet/in.h>
+#ifdef __KAME__
+yes
+#endif
+EOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  egrep "yes" >/dev/null 2>&1; then
+  rm -rf conftest*
+  v6type=$i; v6lib=inet6;
+				v6libdir=/usr/local/v6/lib;
+				v6trylibc=yes;
+				CFLAGS="-DINET6 $CFLAGS"
+fi
+rm -f conftest*
+
+			;;
+		inria)
+			cat > conftest.$ac_ext <<EOF
+#line 7245 "configure"
+#include "confdefs.h"
+dnl
+#include <netinet/in.h>
+#ifdef IPV6_INRIA_VERSION
+yes
+#endif
+EOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  egrep "yes" >/dev/null 2>&1; then
+  rm -rf conftest*
+  v6type=$i;
+				v6lib=dummy;
+				v6libdir=none;
+				v6trylibc=yes;
+				CFLAGS="-DINET6 $CFLAGS"
+fi
+rm -f conftest*
+
+			;;
+		zeta)
+			cat > conftest.$ac_ext <<EOF
+#line 7267 "configure"
+#include "confdefs.h"
+dnl
+#include <sys/param.h>
+#ifdef _ZETA_MINAMI_INET6
+A
+yes
+#endif
+EOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  egrep "yes" >/dev/null 2>&1; then
+  rm -rf conftest*
+  v6type=$i; v6lib=inet6;
+				v6libdir=/usr/local/v6/lib;
+				CFLAGS="-DINET6 $CFLAGS"
+fi
+rm -f conftest*
+
+			;;
+		linux-glibc)
+			cat > conftest.$ac_ext <<EOF
+#line 7288 "configure"
+#include "confdefs.h"
+dnl
+#include <features.h>
+#if defined(__GLIBC__) && ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1) || (__GLIBC_ > 2))
+yes
+#endif
+EOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  egrep "yes" >/dev/null 2>&1; then
+  rm -rf conftest*
+  v6type=$i;
+				v6lib=dummy;
+				v6libdir=none;
+				v6trylibc=yes;
+				CFLAGS="-DINET6 $CFLAGS"
+fi
+rm -f conftest*
+
+			;;
+		linux-inet6)
+			if test -d /usr/inet6; then
+				v6type=$i
+				v6lib=inet6
+				v6libdir=/usr/inet6/lib
+				CFLAGS="-DINET6 $CFLAGS"
+			fi
+			;;
+		esac
+		if test "$v6type" != "unknown"; then
+			break
+		fi
+	done
+
+	if test "$v6lib" != "none"; then
+		if test -d $v6libdir -a -f $v6libdir/lib$v6lib.a; then
+			LIBS="-L$v6libdir -l$v6lib $LIBS"
+			enable_ipv6="yes"
+			echo "$ac_t"""$v6type, $enable_ipv6, using lib$v6lib"" 1>&6
+		elif test "$v6trylibc" = "yes"; then
+			enable_ipv6="yes"
+			echo "$ac_t"""$v6type, $enable_ipv6, using libc"" 1>&6
+		else
+			{ echo "configure: error: no IPv6 library lib$v6lib.a found." 1>&2; exit 1; }
+			exit 1
+		fi
+	else
+		enable_ipv6="no"
+		echo "$ac_t"""$v6type, $enable_ipv6"" 1>&6
+	fi
+fi
+
+
+if test "x$with_res_locks" = "xyes"; then
+  cat >> confdefs.h <<\EOF
+#define NS_REENTRANT 1
+EOF
+
+EOF
+
+    case $target_os in
+
+    aix*)
+	CC_RUNTIME_ARG="$CC_RUNTIME_ARG -lpthreads"
+	;;
+
+    *)
+	;;
+
+    esac
+fi
+
+echo $ac_n "checking whether we have to build PIC code""... $ac_c" 1>&6
+echo "configure:7361: checking whether we have to build PIC code" >&5
+echo "$with_mib_modules" | grep "ucd-snmp/dlmod" >/dev/null
+if test $? -eq 0 ; then
+	DLLIBS="-ldl"
+        LIB_CFLAGS="$LIB_CFLAGS $SHLIB_CFLAGS"
+	echo "$ac_t""yes" 1>&6
+else
+	DLLIBS=""
+	echo "$ac_t""no" 1>&6
+fi
+
+echo $ac_n "checking for and configuring transport modules to use""... $ac_c" 1>&6
+echo "configure:7373: checking for and configuring transport modules to use" >&5
+transport_src_list=""
+transport_hdr_list=""
+transport_def_list=""
+transport_result_list=""
+transport_add_list=""
+new_with_transport_list=`echo $with_transports | sed 's/,/ /g;'`
+new_with_out_transport_list=`echo $with_out_transports | sed 's/,/ /g;'`
+
+if test "x$PARTIALTARGETOS" = "xcygwin"; then
+  transport_default_list="UDP TCP Callback"
+else
+  transport_default_list="UDP TCP Unix Callback"
+fi
+if test "x$enable_ipv6" = "xyes"; then
+  transport_default_list="UDPIPv6 TCPIPv6 $transport_default_list"
+fi
+for i in $transport_default_list; do
+  if echo " $new_with_transport_list " | grep " $i " >/dev/null; then
+    :
+  else
+    transport_add_list="$i $transport_add_list"
+  fi
+done
+new_transport_list="$transport_add_list $new_with_transport_list"
+
+for i in $new_transport_list; do
+  if echo " $new_with_out_transport_list " | grep " $i " >/dev/null; then
+    if test "x$i" = "xUDP"; then
+      echo
+      { echo "configure: error: It is not possible to compile without UDP/IP support." 1>&2; exit 1; }
+    fi
+  else
+    if test "x$i" = "xAAL5PVC"; then
+      if test "x$PARTIALTARGETOS" != "xlinux"; then
+        echo
+        { echo "configure: error: AAL5 PVC support unavailable for this platform (Linux only)" 1>&2; exit 1; }
+      fi
+    fi
+    if test "x$i" = "xIPX"; then
+      if test "x$PARTIALTARGETOS" != "xlinux"; then
+        echo
+        { echo "configure: error: IPX support unavailable for this platform (Linux only)" 1>&2; exit 1; }
+      fi
+    fi
+    if test "x$i" = "xUnix"; then
+      if test "x$PARTIALTARGETOS" = "xcygwin"; then
+        echo
+        { echo "configure: error: Unix domain protocol support unavailable for this platform" 1>&2; exit 1; }
+      fi
+    fi
+    transport_src="snmp"$i"Domain.c"
+    transport_hdr="snmp"$i"Domain.h"
+    rel_transport_src="snmplib/"$transport_src
+    rel_transport_hdr="include/net-snmp/library/"$transport_hdr
+    if test -f "$srcdir/$rel_transport_src"; then
+      transport_result_list="$transport_result_list $i"
+      transport_src_list="$transport_src $transport_src_list"
+      if test -f "$srcdir/$rel_transport_hdr"; then
+        transport_hdr_list="$transport_hdr $transport_hdr_list"
+      fi
+      transport_def=`echo $i | sed 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
+      transport_def_list="SNMP_TRANSPORT_"$transport_def"_DOMAIN $transport_def_list"
+    else
+      echo
+      { echo "configure: error: Cannot find file $transport_src to support SNMP transport domain $i." 1>&2; exit 1; }
+    fi
+  fi
+done
+transport_obj_list=`echo " $transport_src_list " | sed 's/\.c/\.o/g'`
+transport_lobj_list=`echo " $transport_src_list " | sed 's/\.c/\.lo/g'`
+
+
+
+
+for i in $transport_def_list; do
+  cat >> confdefs.h <<EOF
+#define $i 1
+EOF
+
+done
+echo "$ac_t""$transport_result_list." 1>&6
+
+  cat >> configure-summary << EOF
+  Network transport support: $transport_result_list
+EOF
+
+
+
+echo $ac_n "checking for security modules to use""... $ac_c" 1>&6
+echo "configure:7463: checking for security modules to use" >&5
+security_def_list="usm"
+security_src_list=""
+security_obj_list=""
+security_lobj_list=""
+security_init_file="snmplib/snmpsm_init.h"
+security_incl_file="include/net-snmp/library/snmpv3-security-includes.h"
+new_with_security=`echo $with_security_modules | sed 's/,/ /g;'`
+new_with_out_security=`echo $with_out_security_modules | sed 's/,/ /g;'`
+
+if test ! -d include; then
+  mkdir include
+fi
+if test ! -d include/net-snmp; then
+  mkdir include/net-snmp
+fi
+if test ! -d include/net-snmp/agent; then
+  mkdir include/net-snmp/agent
+fi
+if test ! -d include/net-snmp/library; then
+  mkdir include/net-snmp/library
+fi
+if test ! -d include/ucd-snmp; then
+  mkdir include/ucd-snmp
+fi
+
+if test ! -d snmplib; then
+  mkdir snmplib
+fi
+echo "/* This file is automatically generated by configure.  Do not modify by hand. */" > $security_init_file
+echo "/* This file is automatically generated by configure.  Do not modify by hand. */" > $security_incl_file
+
+for i in $security_def_list; do
+  if echo " $new_with_out_security " | grep " $i " > /dev/null; then
+    if test "x$i" = "xusm"; then
+	echo
+        { echo "configure: error: The USM security module is mandatory" 1>&2; exit 1; }
+    fi
+  else
+    new_with_security="$new_with_security $i"
+  fi
+done
+
+for i in $new_with_security; do
+  cfile="snmp"$i".c"
+  hfile="snmp"$i".h"
+
+  # make sure support exists for it
+  if test -f $srcdir"/snmplib/"$cfile -a -f $srcdir"/include/net-snmp/library/"$hfile; then
+    :
+  else
+    echo
+    { echo "configure: error: No such security module: $i / $cfile / $hfile" 1>&2; exit 1; }
+  fi
+
+  # define a bunch of stuff to enable it
+  security_src_list="$security_src_list $cfile"
+  security_hdr_list="$security_hdr_list $hfile"
+  security_obj_list="$security_obj_list snmp"$i".o"
+  security_lobj_list="$security_lobj_list snmp"$i".lo"
+  def_name="SNMP_SECMOD_"`echo $i | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+  echo "init_"$i"();" >> $security_init_file
+  echo "#include <net-snmp/library/$hfile>" >> $security_incl_file
+  cat >> confdefs.h <<EOF
+#define $def_name 1
+EOF
+
+done
+
+
+
+
+
+echo "$ac_t""$new_with_security" 1>&6
+
+  cat >> configure-summary << EOF
+  SNMPv3 Security Modules:   $new_with_security
+EOF
+
+
+
+for sec in $new_with_security
+do
+  if test x$sec = xksm; then
+    echo $ac_n "checking to see which crypto API we need to use""... $ac_c" 1>&6
+echo "configure:7548: checking to see which crypto API we need to use" >&5
+
+    echo $ac_n "checking for krb5_c_encrypt""... $ac_c" 1>&6
+echo "configure:7551: checking for krb5_c_encrypt" >&5
+if eval "test \"`echo '$''{'ac_cv_func_krb5_c_encrypt'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 7556 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char krb5_c_encrypt(); below.  */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char krb5_c_encrypt();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_krb5_c_encrypt) || defined (__stub___krb5_c_encrypt)
+choke me
+#else
+krb5_c_encrypt();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:7579: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_func_krb5_c_encrypt=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_func_krb5_c_encrypt=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'krb5_c_encrypt`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  
+      echo "$ac_t""new MIT crypto API" 1>&6
+      cat >> confdefs.h <<\EOF
+#define MIT_NEW_CRYPTO 1
+EOF
+
+else
+  echo "$ac_t""no" 1>&6
+
+      echo "$ac_t""old MIT crypto API" 1>&6
+fi
+
+  fi
+done
+
+echo $ac_n "checking for and configuring mib modules to use""... $ac_c" 1>&6
+echo "configure:7609: checking for and configuring mib modules to use" >&5
+
+
+mibdir="agent/mibgroup"
+module_list=""
+module_list_code=""
+new_with_mib_modules=`echo $with_mib_modules | sed 's/,/ /g;'`
+new_with_out_mib_modules=`echo $with_out_mib_modules | sed 's/,/ /g;'`
+new_module_list="mibII ucd_snmp snmpv3mibs notification target agent_mibs agentx agent_mibs utilities $new_with_mib_modules"
+default_mibs=IP-MIB:IF-MIB:TCP-MIB:UDP-MIB:SNMPv2-MIB:RFC1213-MIB:NOTIFICATION-LOG-MIB
+
+if test "x$mini_agent" = "xyes"; then
+new_with_out_mib_modules="mibII $new_with_out_mib_modules"
+new_module_list="snmpv3mibs mibII/snmp_mib mibII/system_mib mibII/sysORTable mibII/vacm_vars $new_with_mib_modules"
+default_mibs=SNMPv2-MIB:RFC1213-MIB
+default_mibs_install=" "
+fi
+
+
+if test "x$enable_ipv6" = "xyes"; then
+	new_module_list="$new_module_list mibII/ipv6"
+fi
+
+if test ! -d agent; then
+  mkdir agent
+fi
+if test ! -d agent/mibgroup; then
+  mkdir agent/mibgroup
+fi
+for i in $mibdir/mib_module_includes.h $mibdir/mib_module_inits.h $mibdir/mib_module_shutdown.h include/net-snmp/agent/mib_module_config.h $mibdir/mib_module_dot_conf.h; do
+  rm -f $i
+  echo "/* This file is automatically generated by configure.  Do not modify by hand. */" > $i
+done
+
+test_modules="$new_module_list"
+new_module_list=""
+module_list_h=""
+
+for i in $test_modules
+ do
+  if echo " $new_with_out_mib_modules " | grep " $i " > /dev/null; then
+    :
+  else
+    new_module_list="$new_module_list $i"
+  fi
+done
+
+
+echo "$ac_t""$new_module_list." 1>&6
+
+  cat >> configure-summary << EOF
+  Agent MIB code:            $new_module_list
+EOF
+
+
+echo $ac_n "checking for and configuring mib modules pieces to use""... $ac_c" 1>&6
+echo "configure:7665: checking for and configuring mib modules pieces to use" >&5
+FD=6
+
+
+while test "x$new_module_list" != "x"; do
+  for i in $new_module_list
+    do
+    if echo " $new_with_out_mib_modules " | grep " $i " > /dev/null; then
+      :
+    else
+      if test -f $srcdir/$mibdir/$i.h; then
+        new_list=""
+        new_list_arch=`grep config_arch_require $srcdir/$mibdir/$i.h | sed 's/.*config_arch_require(\(.*\), *\(.*\)).*/\1-xarchx-\2/'`
+	if test "x$new_list_arch" != "x"; then
+          for j in $new_list_arch
+	    do
+	    archtest=`echo $j | sed 's/-xarchx-.*//'`
+	    if test "x$target_os" = "x$archtest" -o "x$PARTIALTARGETOS" = "x$archtest"; then
+	      new_list="$new_list `echo $j | sed 's/.*-xarchx-//'`"
+	    fi
+	  done
+	fi
+	new_list="$new_list `grep config_require $srcdir/$mibdir/$i.h | sed 's/.*config_require(\(.*\)).*/\1/'`"
+	if test "x$new_list" != "x"; then
+	  for j in $new_list
+	    do
+	    if test ! -f $srcdir/$mibdir/$j.h; then
+              
+	      { echo "configure: error: mib module "$i" requires module "$j" but $j.h or $j.c could not be found in $srcdir/$mibdir" 1>&2; exit 1; }
+              
+	    elif echo " $new_with_out_mib_modules " | grep " $j " > /dev/null; then
+              
+	      echo "configure: warning: mib module "$i" requires module "$j" but you told me to compile without it" 1>&2
+              
+	    elif echo " $module_list $new_list_two $new_module_list " | grep " $j " > /dev/null; then
+	      :
+	    else
+	      new_list_two="$new_list_two $j"
+	    fi
+	  done
+	fi
+	new_mibs=`grep config_add_mib $srcdir/$mibdir/$i.h | sed 's/.*config_add_mib(\(.*\)).*/\1/'`
+	if test "x$new_mibs" != "x"; then
+	    for j in $new_mibs
+		do
+		if test "x`echo :$default_mibs: | grep :$j:`" = "x"; then
+		    default_mibs="$default_mibs:$j"
+		fi
+		if test -f $srcdir/mibs/$j.txt; then
+		    if echo $default_mibs_install | grep " $j " > /dev/null; then
+			    :
+		    else
+			    default_mibs_install="$default_mibs_install $j.txt"
+		    fi
+		fi
+	    done
+	fi
+      else
+        
+	{ echo "configure: error: module files $i.h or $i.c could not be found in $srcdir/$mibdir" 1>&2; exit 1; }
+        
+      fi
+      module_list="$module_list $i"
+      echo '#include "'"mibgroup/$i.h"'"' >> $mibdir/mib_module_includes.h
+      module_list_h="$module_list_h mibgroup/$i.h"
+      if test -f $srcdir/$mibdir/$i.c; then
+        module_list_code="$module_list_code $i"
+        mnm=`echo $i | sed 's/.*\///;s/\.c$//;'`
+        temp_init=`grep init_$mnm $srcdir/$mibdir/$i.c | grep -v _init_$mnm`
+	if test "x$temp_init" != "x"; then
+	    echo "  if (should_init(\"$mnm\")) init_$mnm();" >> $mibdir/mib_module_inits.h
+	fi
+	if grep shutdown_`basename $i` $srcdir/$mibdir/$i.c > /dev/null; then
+	    echo "  if (should_init(\"`basename $i`\")) shutdown_`basename $i`();" >> $mibdir/mib_module_shutdown.h
+	fi
+      fi
+      if test "x`echo $i | sed 's/\///g;'`" != "x$i"; then
+	mnd=`echo $i | sed 's/\/[^/]*$//;'`
+	if test ! -d ./$mibdir/$mnd; then
+	    module_directories="$module_directories ./$mibdir/$mnd"
+	fi
+      fi
+      if grep config_load_mib $srcdir/$mibdir/$i.h > /dev/null 2>&1; then
+        
+      	echo "configure: warning: mib module "$i" uses the "config_load_mib" directive" 1>&2
+        
+      fi
+      grep config_parse_dot_conf $srcdir/$mibdir/$i.h | sed 's@.*config_parse_dot_conf(\([^)]*\), *\([^),]*\), *\([^),]*\), *\([^),]*\)).*@register_config_handler("snmpd",\1, \2, \3, \4);@' >> $mibdir/mib_module_dot_conf.h
+      sym="`echo ${i} | sed 's/[^a-zA-Z0-9_]/_/g' | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`"
+      echo "/* Define if compiling with the ${i} module files.  */" >> include/net-snmp/agent/mib_module_config.h
+      echo "#define USING_${sym}_MODULE 1" >> include/net-snmp/agent/mib_module_config.h
+      echo " " >> include/net-snmp/agent/mib_module_config.h
+      echo $ac_n " $i$ac_c" >&$FD
+    fi
+  done
+  new_module_list="$new_list_two"
+  new_list_two=""
+done
+module_list_o=`echo "$module_list_code " | sed 's/\([^ ]\) /\1.o /g'`
+module_list_lo=`echo "$module_list_code " | sed 's/\([^ ]\) /\1.lo /g'`
+module_list_c=`echo "$module_list_code " | sed 's/\([^ ]\) /\1.c /g'`
+mibgroup_list_o=`echo " $module_list_o " | sed 's@ \([^ ]*\)\.o@ mibgroup/\1.o @g'`
+mibgroup_list_lo=`echo " $module_list_lo " | sed 's@ \([^ ]*\)\.lo@ mibgroup/\1.lo @g'`
+
+MODULE_LIST=$module_list_code
+
+
+
+
+
+
+
+
+
+
+echo "$ac_t""." 1>&6
+
+echo $ac_n "checking if directories need to be created""... $ac_c" 1>&6
+echo "configure:7783: checking if directories need to be created" >&5
+for i in $module_directories; do
+  $srcdir/mkinstalldirs $i
+done
+echo "$ac_t""." 1>&6
+
+echo $ac_n "checking default mib files to read""... $ac_c" 1>&6
+echo "configure:7790: checking default mib files to read" >&5
+if test "x$DEFAULT_MIBS" = "x"; then
+  DEFAULT_MIBS="$default_mibs"
+fi
+cat >> confdefs.h <<EOF
+#define DEFAULT_MIBS "$DEFAULT_MIBS"
+EOF
+
+echo "$ac_t""$DEFAULT_MIBS" 1>&6
+
+
+echo $ac_n "checking for location of system kernel""... $ac_c" 1>&6
+echo "configure:7802: checking for location of system kernel" >&5
+if eval "test \"`echo '$''{'ac_cv_KERNEL_LOC'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  ac_cv_KERNEL_LOC="unknown"
+
+if test -c /dev/null; then
+  CFLAG="-c"
+elif test -f /dev/null; then
+  CFLAG="-f"
+else
+    CFLAG="-f"
+fi
+for i in /vmunix /hp-ux /stand/vmunix /dev/ksyms /kernel/unix /kernel/genunix /netbsd /unix /kernel /bsd /mach_kernel
+  do
+  if test -f $i -o $CFLAG $i; then
+    ac_cv_KERNEL_LOC="$i"
+    break;
+  fi
+done
+if test $i = "unknown"; then
+  echo "configure: warning: Can't find system kernel...  Setting to /vmunix" 1>&2
+  ac_cv_KERNEL_LOC="/vmunix"
+fi
+
+fi
+
+echo "$ac_t""$ac_cv_KERNEL_LOC" 1>&6
+
+cat >> confdefs.h <<EOF
+#define KERNEL_LOC "$ac_cv_KERNEL_LOC"
+EOF
+
+
+
+echo $ac_n "checking for mount table location""... $ac_c" 1>&6
+echo "configure:7838: checking for mount table location" >&5
+if eval "test \"`echo '$''{'ac_cv_ETC_MNTTAB'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  ac_cv_ETC_MNTTAB="/etc/mtab"
+fi
+
+echo "$ac_t""$ac_cv_ETC_MNTTAB" 1>&6
+
+cat >> confdefs.h <<EOF
+#define ETC_MNTTAB "$ac_cv_ETC_MNTTAB"
+EOF
+
+
+echo $ac_n "checking for location of swap device""... $ac_c" 1>&6
+echo "configure:7861: checking for location of swap device" >&5
+if eval "test \"`echo '$''{'ac_cv_DMEM_LOC'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+
+if test -f /dev/kmem; then
+  CTEST="test -f"
+elif test -c /dev/kmem; then
+  CTEST="test -c"
+else
+    CTEST="test -f"
+fi
+
+if $CTEST /dev/dmem; then
+  ac_cv_DMEM_LOC="/dev/dmem"
+elif $CTEST /dev/drum; then
+  ac_cv_DMEM_LOC="/dev/drum"
+else
+  ac_cv_DMEM_LOC="none"
+fi
+
+fi
+
+echo "$ac_t""$ac_cv_DMEM_LOC" 1>&6
+
+if test "x$ac_cv_DMEM_LOC" != "xnone"; then
+  cat >> confdefs.h <<EOF
+#define DMEM_LOC "$ac_cv_DMEM_LOC"
+EOF
+
+fi
+
+
+if test "x$use_efence" = "xyes"; then
+    echo $ac_n "checking for EF_Exit in -lefence""... $ac_c" 1>&6
+echo "configure:7897: checking for EF_Exit in -lefence" >&5
+ac_lib_var=`echo efence'_'EF_Exit | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  ac_save_LIBS="$LIBS"
+LIBS="-lefence  $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 7905 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char EF_Exit();
+
+int main() {
+EF_Exit()
+; return 0; }
+EOF
+if { (eval echo configure:7916: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_lib=HAVE_LIB`echo efence | sed -e 's/[^a-zA-Z0-9_]/_/g' \
+    -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_lib 1
+EOF
+
+  LIBS="-lefence $LIBS"
+
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+fi
+
+echo $ac_n "checking for asin in -lm""... $ac_c" 1>&6
+echo "configure:7946: checking for asin in -lm" >&5
+ac_lib_var=`echo m'_'asin | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  ac_save_LIBS="$LIBS"
+LIBS="-lm  $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 7954 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char asin();
+
+int main() {
+asin()
+; return 0; }
+EOF
+if { (eval echo configure:7965: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_lib=HAVE_LIB`echo m | sed -e 's/[^a-zA-Z0-9_]/_/g' \
+    -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_lib 1
+EOF
+
+  LIBS="-lm $LIBS"
+
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+echo $ac_n "checking for nlist in -lelf""... $ac_c" 1>&6
+echo "configure:7993: checking for nlist in -lelf" >&5
+ac_lib_var=`echo elf'_'nlist | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  ac_save_LIBS="$LIBS"
+LIBS="-lelf  $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 8001 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char nlist();
+
+int main() {
+nlist()
+; return 0; }
+EOF
+if { (eval echo configure:8012: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_lib=HAVE_LIB`echo elf | sed -e 's/[^a-zA-Z0-9_]/_/g' \
+    -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_lib 1
+EOF
+
+  LIBS="-lelf $LIBS"
+
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+
+echo $ac_n "checking for gethostbyname""... $ac_c" 1>&6
+echo "configure:8041: checking for gethostbyname" >&5
+if eval "test \"`echo '$''{'ac_cv_func_gethostbyname'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 8046 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char gethostbyname(); below.  */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char gethostbyname();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_gethostbyname) || defined (__stub___gethostbyname)
+choke me
+#else
+gethostbyname();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:8069: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_func_gethostbyname=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_func_gethostbyname=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'gethostbyname`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  cat >> confdefs.h <<\EOF
+#define HAVE_GETHOSTBYNAME 1
+EOF
+
+else
+  echo "$ac_t""no" 1>&6
+echo $ac_n "checking for gethostbyname in -lnsl""... $ac_c" 1>&6
+echo "configure:8090: checking for gethostbyname in -lnsl" >&5
+ac_lib_var=`echo nsl'_'gethostbyname | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  ac_save_LIBS="$LIBS"
+LIBS="-lnsl  $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 8098 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char gethostbyname();
+
+int main() {
+gethostbyname()
+; return 0; }
+EOF
+if { (eval echo configure:8109: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  cat >> confdefs.h <<\EOF
+#define HAVE_GETHOSTBYNAME 1
+EOF
+
+	LIBS="${LIBS} -lnsl"
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+fi
+
+echo $ac_n "checking for getservbyname""... $ac_c" 1>&6
+echo "configure:8136: checking for getservbyname" >&5
+if eval "test \"`echo '$''{'ac_cv_func_getservbyname'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 8141 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char getservbyname(); below.  */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char getservbyname();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_getservbyname) || defined (__stub___getservbyname)
+choke me
+#else
+getservbyname();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:8164: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_func_getservbyname=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_func_getservbyname=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'getservbyname`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  cat >> confdefs.h <<\EOF
+#define HAVE_GETSERVBYNAME 1
+EOF
+
+else
+  echo "$ac_t""no" 1>&6
+echo $ac_n "checking for getservbyname in -lsocket""... $ac_c" 1>&6
+echo "configure:8185: checking for getservbyname in -lsocket" >&5
+ac_lib_var=`echo socket'_'getservbyname | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  ac_save_LIBS="$LIBS"
+LIBS="-lsocket  $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 8193 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char getservbyname();
+
+int main() {
+getservbyname()
+; return 0; }
+EOF
+if { (eval echo configure:8204: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  cat >> confdefs.h <<\EOF
+#define HAVE_GETSERVBYNAME 1
+EOF
+
+	LIBS="${LIBS} -lsocket"
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+fi
+
+
+echo $ac_n "checking for kstat_lookup in -lkstat""... $ac_c" 1>&6
+echo "configure:8232: checking for kstat_lookup in -lkstat" >&5
+ac_lib_var=`echo kstat'_'kstat_lookup | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  ac_save_LIBS="$LIBS"
+LIBS="-lkstat  $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 8240 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char kstat_lookup();
+
+int main() {
+kstat_lookup()
+; return 0; }
+EOF
+if { (eval echo configure:8251: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_lib=HAVE_LIB`echo kstat | sed -e 's/[^a-zA-Z0-9_]/_/g' \
+    -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_lib 1
+EOF
+
+  LIBS="-lkstat $LIBS"
+
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+echo $ac_n "checking for nlist in -lmld""... $ac_c" 1>&6
+echo "configure:8279: checking for nlist in -lmld" >&5
+ac_lib_var=`echo mld'_'nlist | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  ac_save_LIBS="$LIBS"
+LIBS="-lmld  $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 8287 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char nlist();
+
+int main() {
+nlist()
+; return 0; }
+EOF
+if { (eval echo configure:8298: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_lib=HAVE_LIB`echo mld | sed -e 's/[^a-zA-Z0-9_]/_/g' \
+    -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_lib 1
+EOF
+
+  LIBS="-lmld $LIBS"
+
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+
+if test "x$tryopenssl" != "xno"; then
+    if test "x$tryrsaref" != "xno"; then
+         echo $ac_n "checking for RSAPrivateDecrypt in -lrsaref""... $ac_c" 1>&6
+echo "configure:8329: checking for RSAPrivateDecrypt in -lrsaref" >&5
+ac_lib_var=`echo rsaref'_'RSAPrivateDecrypt | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  ac_save_LIBS="$LIBS"
+LIBS="-lrsaref  $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 8337 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char RSAPrivateDecrypt();
+
+int main() {
+RSAPrivateDecrypt()
+; return 0; }
+EOF
+if { (eval echo configure:8348: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_lib=HAVE_LIB`echo rsaref | sed -e 's/[^a-zA-Z0-9_]/_/g' \
+    -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_lib 1
+EOF
+
+  LIBS="-lrsaref $LIBS"
+
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+         echo $ac_n "checking for RSA_PKCS1_RSAref in -lRSAglue""... $ac_c" 1>&6
+echo "configure:8376: checking for RSA_PKCS1_RSAref in -lRSAglue" >&5
+ac_lib_var=`echo RSAglue'_'RSA_PKCS1_RSAref | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  ac_save_LIBS="$LIBS"
+LIBS="-lRSAglue  $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 8384 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char RSA_PKCS1_RSAref();
+
+int main() {
+RSA_PKCS1_RSAref()
+; return 0; }
+EOF
+if { (eval echo configure:8395: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_lib=HAVE_LIB`echo RSAglue | sed -e 's/[^a-zA-Z0-9_]/_/g' \
+    -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_lib 1
+EOF
+
+  LIBS="-lRSAglue $LIBS"
+
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+    fi
+
+    echo $ac_n "checking for EVP_md5 in -lcrypto""... $ac_c" 1>&6
+echo "configure:8425: checking for EVP_md5 in -lcrypto" >&5
+ac_lib_var=`echo crypto'_'EVP_md5 | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  ac_save_LIBS="$LIBS"
+LIBS="-lcrypto  $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 8433 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char EVP_md5();
+
+int main() {
+EVP_md5()
+; return 0; }
+EOF
+if { (eval echo configure:8444: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_lib=HAVE_LIB`echo crypto | sed -e 's/[^a-zA-Z0-9_]/_/g' \
+    -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_lib 1
+EOF
+
+  LIBS="-lcrypto $LIBS"
+
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+    for ac_func in AES_cfb128_encrypt
+do
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:8474: checking for $ac_func" >&5
+if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 8479 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char $ac_func(); below.  */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char $ac_func();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+$ac_func();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:8502: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_func 1
+EOF
+ 
+else
+  echo "$ac_t""no" 1>&6
+fi
+done
+
+fi
+
+NONAGENTLIBS=$LIBS
+
+_cppflags="${CPPFLAGS}"
+_ldflags="${LDFLAGS}"
+
+# Check whether --with-libwrap or --without-libwrap was given.
+if test "${with_libwrap+set}" = set; then
+  withval="$with_libwrap"
+  
+  if test "$with_libwrap" != "no"; then
+    if test "$with_libwrap" != "yes"; then
+      CPPFLAGS="${CPPFLAGS} -I$with_libwrap/include"
+      LDFLAGS="${LDFLAGS} -L$with_libwrap/lib"
+    fi
+
+    _libs=${LIBS}
+    ac_safe=`echo "tcpd.h" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for tcpd.h""... $ac_c" 1>&6
+echo "configure:8546: checking for tcpd.h" >&5
+if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 8551 "configure"
+#include "confdefs.h"
+#include <tcpd.h>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:8556: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=yes"
+else
+  echo "$ac_err" >&5
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  :
+else
+  echo "$ac_t""no" 1>&6
+{ echo "configure: error: Asked to use libwrap but I couldn't find tcpd.h." 1>&2; exit 1; }
+fi
+
+
+    LIBS="$LIBS -lwrap"
+	echo $ac_n "checking for TCP wrappers library -lwrap""... $ac_c" 1>&6
+echo "configure:8581: checking for TCP wrappers library -lwrap" >&5
+	cat > conftest.$ac_ext <<EOF
+#line 8583 "configure"
+#include "confdefs.h"
+#include <tcpd.h>
+		     int allow_severity = 0;
+		     int deny_severity  = 0;
+		    
+int main() {
+hosts_access((void *)0)
+; return 0; }
+EOF
+if { (eval echo configure:8593: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  
+	    echo "$ac_t""yes" 1>&6
+	    cat >> confdefs.h <<\EOF
+#define USE_LIBWRAP 1
+EOF
+
+	    test "$with_libwrap" != no -a "$with_libwrap" != yes && WRAPLIBS="-L$with_libwrap/lib"
+	    WRAPLIBS="$WRAPLIBS -lwrap"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  
+	    echo "$ac_t""no" 1>&6
+	    	    echo $ac_n "checking for yp_get_default_domain""... $ac_c" 1>&6
+echo "configure:8610: checking for yp_get_default_domain" >&5
+if eval "test \"`echo '$''{'ac_cv_func_yp_get_default_domain'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 8615 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char yp_get_default_domain(); below.  */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char yp_get_default_domain();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_yp_get_default_domain) || defined (__stub___yp_get_default_domain)
+choke me
+#else
+yp_get_default_domain();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:8638: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_func_yp_get_default_domain=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_func_yp_get_default_domain=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'yp_get_default_domain`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  :
+else
+  echo "$ac_t""no" 1>&6
+echo $ac_n "checking for yp_get_default_domain in -lnsl""... $ac_c" 1>&6
+echo "configure:8656: checking for yp_get_default_domain in -lnsl" >&5
+ac_lib_var=`echo nsl'_'yp_get_default_domain | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  ac_save_LIBS="$LIBS"
+LIBS="-lnsl  $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 8664 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char yp_get_default_domain();
+
+int main() {
+yp_get_default_domain()
+; return 0; }
+EOF
+if { (eval echo configure:8675: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_lib=HAVE_LIB`echo nsl | sed -e 's/^a-zA-Z0-9_/_/g' \
+    -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_lib 1
+EOF
+
+  LIBS="-lnsl $LIBS"
+
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+fi
+
+	    echo $ac_n "checking for TCP wrappers library -lwrap linked with -lnsl""... $ac_c" 1>&6
+echo "configure:8705: checking for TCP wrappers library -lwrap linked with -lnsl" >&5
+	    cat > conftest.$ac_ext <<EOF
+#line 8707 "configure"
+#include "confdefs.h"
+#include <tcpd.h>
+		         int allow_severity = 0;
+	                 int deny_severity  = 0;
+	 		
+int main() {
+hosts_access((void *)0)
+; return 0; }
+EOF
+if { (eval echo configure:8717: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  echo "$ac_t""yes" 1>&6
+			cat >> confdefs.h <<\EOF
+#define USE_LIBWRAP 1
+EOF
+
+			test "$with_libwrap" != no -a "$with_libwrap" != yes && WRAPLIBS="-L$with_libwrap/lib"
+			WRAPLIBS="$WRAPLIBS -lwrap -lnsl"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  echo "$ac_t""no" 1>&6
+			{ echo "configure: error: Asked to use libwrap but I couldn't find it." 1>&2; exit 1; }
+fi
+rm -f conftest*
+        
+fi
+rm -f conftest*
+    CPPFLAGS=${_cppflags}
+    LDFLAGS=${_ldflags}
+    LIBS=${_libs}
+  fi
+
+fi
+
+
+if echo " $module_list " | grep " host/hr_swinst " > /dev/null; then
+      _rpmlibs=""
+
+    _cppflags="${CPPFLAGS}"
+  _ldflags="${LDFLAGS}"
+
+  # Check whether --with-zlib or --without-zlib was given.
+if test "${with_zlib+set}" = set; then
+  withval="$with_zlib"
+  
+    if test -d "$withval"; then
+      CPPFLAGS="${CPPFLAGS} -I$withval/include"
+      LDFLAGS="${LDFLAGS} -L$withval/lib"
+    fi
+  
+fi
+
+
+    ac_safe=`echo "zlib.h" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for zlib.h""... $ac_c" 1>&6
+echo "configure:8765: checking for zlib.h" >&5
+if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 8770 "configure"
+#include "confdefs.h"
+#include <zlib.h>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:8775: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=yes"
+else
+  echo "$ac_err" >&5
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  echo $ac_n "checking for gzread in -lz""... $ac_c" 1>&6
+echo "configure:8792: checking for gzread in -lz" >&5
+ac_lib_var=`echo z'_'gzread | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  ac_save_LIBS="$LIBS"
+LIBS="-lz  $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 8800 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char gzread();
+
+int main() {
+gzread()
+; return 0; }
+EOF
+if { (eval echo configure:8811: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_lib=HAVE_LIB`echo z | sed -e 's/^a-zA-Z0-9_/_/g' \
+    -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_lib 1
+EOF
+
+  LIBS="-lz $LIBS"
+
+else
+  echo "$ac_t""no" 1>&6
+CPPFLAGS=${_cppflags} LDFLAGS=${_ldflags}
+fi
+
+else
+  echo "$ac_t""no" 1>&6
+CPPFLAGS=${_cppflags} LDFLAGS=${_ldflags}
+fi
+
+
+    echo $ac_n "checking for bzread in -lbz2""... $ac_c" 1>&6
+echo "configure:8846: checking for bzread in -lbz2" >&5
+ac_lib_var=`echo bz2'_'bzread | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  ac_save_LIBS="$LIBS"
+LIBS="-lbz2  $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 8854 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char bzread();
+
+int main() {
+bzread()
+; return 0; }
+EOF
+if { (eval echo configure:8865: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  _rpmlibs="$_rpmlibs -lbz2"
+else
+  echo "$ac_t""no" 1>&6
+echo $ac_n "checking for BZ2_bzread in -lbz2""... $ac_c" 1>&6
+echo "configure:8884: checking for BZ2_bzread in -lbz2" >&5
+ac_lib_var=`echo bz2'_'BZ2_bzread | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  ac_save_LIBS="$LIBS"
+LIBS="-lbz2  $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 8892 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char BZ2_bzread();
+
+int main() {
+BZ2_bzread()
+; return 0; }
+EOF
+if { (eval echo configure:8903: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  _rpmlibs="$_rpmlibs -lbz2"
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+fi
+
+
+    echo $ac_n "checking for dbopen in -ldb1""... $ac_c" 1>&6
+echo "configure:8927: checking for dbopen in -ldb1" >&5
+ac_lib_var=`echo db1'_'dbopen | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  ac_save_LIBS="$LIBS"
+LIBS="-ldb1  $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 8935 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char dbopen();
+
+int main() {
+dbopen()
+; return 0; }
+EOF
+if { (eval echo configure:8946: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  _rpmlibs="-ldb1 $_rpmlibs"
+else
+  echo "$ac_t""no" 1>&6
+echo $ac_n "checking for dbopen in -ldb""... $ac_c" 1>&6
+echo "configure:8965: checking for dbopen in -ldb" >&5
+ac_lib_var=`echo db'_'dbopen | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  ac_save_LIBS="$LIBS"
+LIBS="-ldb  $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 8973 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char dbopen();
+
+int main() {
+dbopen()
+; return 0; }
+EOF
+if { (eval echo configure:8984: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  _rpmlibs="-ldb $_rpmlibs"
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+fi
+
+
+    echo $ac_n "checking for db_create in -ldb-3.1""... $ac_c" 1>&6
+echo "configure:9008: checking for db_create in -ldb-3.1" >&5
+ac_lib_var=`echo db-3.1'_'db_create | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  ac_save_LIBS="$LIBS"
+LIBS="-ldb-3.1  $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 9016 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char db_create();
+
+int main() {
+db_create()
+; return 0; }
+EOF
+if { (eval echo configure:9027: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  _rpmlibs="-ldb-3.1 $_rpmlibs"
+else
+  echo "$ac_t""no" 1>&6
+echo $ac_n "checking for db_create in -ldb-3.0""... $ac_c" 1>&6
+echo "configure:9046: checking for db_create in -ldb-3.0" >&5
+ac_lib_var=`echo db-3.0'_'db_create | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  ac_save_LIBS="$LIBS"
+LIBS="-ldb-3.0  $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 9054 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char db_create();
+
+int main() {
+db_create()
+; return 0; }
+EOF
+if { (eval echo configure:9065: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  _rpmlibs="-ldb-3.0 $_rpmlibs"
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+fi
+
+  
+    echo $ac_n "checking for poptParseArgvString in -lpopt""... $ac_c" 1>&6
+echo "configure:9089: checking for poptParseArgvString in -lpopt" >&5
+ac_lib_var=`echo popt'_'poptParseArgvString | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  ac_save_LIBS="$LIBS"
+LIBS="-lpopt  $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 9097 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char poptParseArgvString();
+
+int main() {
+poptParseArgvString()
+; return 0; }
+EOF
+if { (eval echo configure:9108: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  _rpmlibs="-lpopt $_rpmlibs"
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+  
+    echo $ac_n "checking for Fopen in -lrpmio""... $ac_c" 1>&6
+echo "configure:9130: checking for Fopen in -lrpmio" >&5
+ac_lib_var=`echo rpmio'_'Fopen | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  ac_save_LIBS="$LIBS"
+LIBS="-lrpmio $_rpmlibs $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 9138 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char Fopen();
+
+int main() {
+Fopen()
+; return 0; }
+EOF
+if { (eval echo configure:9149: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  _rpmlibs="-lrpmio $_rpmlibs"
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+  
+    echo $ac_n "checking for rpmGetFilesystemList in -lrpm""... $ac_c" 1>&6
+echo "configure:9171: checking for rpmGetFilesystemList in -lrpm" >&5
+ac_lib_var=`echo rpm'_'rpmGetFilesystemList | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  ac_save_LIBS="$LIBS"
+LIBS="-lrpm  $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 9179 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char rpmGetFilesystemList();
+
+int main() {
+rpmGetFilesystemList()
+; return 0; }
+EOF
+if { (eval echo configure:9190: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  
+    cat >> confdefs.h <<\EOF
+#define HAVE_LIBRPM 1
+EOF
+
+    LIBS="-lrpm $_rpmlibs $LIBS"
+    CFLAGS="$CFLAGS -I/usr/include/rpm"
+  
+else
+  echo "$ac_t""no" 1>&6
+
+        echo $ac_n "checking for rpmdbOpen in -lrpmdb""... $ac_c" 1>&6
+echo "configure:9217: checking for rpmdbOpen in -lrpmdb" >&5
+ac_lib_var=`echo rpmdb'_'rpmdbOpen | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  ac_save_LIBS="$LIBS"
+LIBS="-lrpmdb -lrpm $_rpmlibs $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 9225 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char rpmdbOpen();
+
+int main() {
+rpmdbOpen()
+; return 0; }
+EOF
+if { (eval echo configure:9236: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  
+      cat >> confdefs.h <<\EOF
+#define HAVE_LIBRPM 1
+EOF
+
+      LIBS="-lrpmdb -lrpm $_rpmlibs $LIBS"
+      CFLAGS="$CFLAGS -I/usr/include/rpm"
+    
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+  
+fi
+
+fi
+  
+echo $ac_n "checking for kvm_read in -lkvm""... $ac_c" 1>&6
+echo "configure:9269: checking for kvm_read in -lkvm" >&5
+ac_lib_var=`echo kvm'_'kvm_read | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  ac_save_LIBS="$LIBS"
+LIBS="-lkvm  $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 9277 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char kvm_read();
+
+int main() {
+kvm_read()
+; return 0; }
+EOF
+if { (eval echo configure:9288: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_lib=HAVE_LIB`echo kvm | sed -e 's/[^a-zA-Z0-9_]/_/g' \
+    -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_lib 1
+EOF
+
+  LIBS="-lkvm $LIBS"
+
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+echo $ac_n "checking for dlopen in -ldl""... $ac_c" 1>&6
+echo "configure:9316: checking for dlopen in -ldl" >&5
+ac_lib_var=`echo dl'_'dlopen | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  ac_save_LIBS="$LIBS"
+LIBS="-ldl  $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 9324 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char dlopen();
+
+int main() {
+dlopen()
+; return 0; }
+EOF
+if { (eval echo configure:9335: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_lib=HAVE_LIB`echo dl | sed -e 's/[^a-zA-Z0-9_]/_/g' \
+    -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_lib 1
+EOF
+
+  LIBS="-ldl $LIBS"
+
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+for ac_func in dlopen
+do
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:9365: checking for $ac_func" >&5
+if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 9370 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char $ac_func(); below.  */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char $ac_func();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+$ac_func();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:9393: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_func 1
+EOF
+ 
+else
+  echo "$ac_t""no" 1>&6
+fi
+done
+
+
+for ac_func in kvm_openfiles nlist knlist kvm_getprocs
+do
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:9421: checking for $ac_func" >&5
+if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 9426 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char $ac_func(); below.  */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char $ac_func();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+$ac_func();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:9449: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_func 1
+EOF
+ 
+else
+  echo "$ac_t""no" 1>&6
+fi
+done
+
+echo "$with_mib_modules" | grep "ucd-snmp/diskio" >/dev/null
+if test $? -eq 0 ; then
+	echo $ac_n "checking for getdevs""... $ac_c" 1>&6
+echo "configure:9476: checking for getdevs" >&5
+if eval "test \"`echo '$''{'ac_cv_func_getdevs'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 9481 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char getdevs(); below.  */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char getdevs();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_getdevs) || defined (__stub___getdevs)
+choke me
+#else
+getdevs();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:9504: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_func_getdevs=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_func_getdevs=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'getdevs`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  cat >> confdefs.h <<\EOF
+#define HAVE_GETDEVS 1
+EOF
+
+else
+  echo "$ac_t""no" 1>&6
+echo $ac_n "checking for getdevs in -ldevstat""... $ac_c" 1>&6
+echo "configure:9525: checking for getdevs in -ldevstat" >&5
+ac_lib_var=`echo devstat'_'getdevs | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  ac_save_LIBS="$LIBS"
+LIBS="-ldevstat  $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 9533 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char getdevs();
+
+int main() {
+getdevs()
+; return 0; }
+EOF
+if { (eval echo configure:9544: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  cat >> confdefs.h <<\EOF
+#define HAVE_GETDEVS 1
+EOF
+
+		LIBS="${LIBS} -ldevstat"
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+fi
+
+fi
+
+
+
+if test "x$embed_perl" = "xyes" -a "x$install_perl" = "xno" ; then
+  install_perl="yes"
+fi
+if test "x$install_perl" != "x" -a "x$install_perl" != "xno"; then
+    PERLTARGS="perlmodules"
+    PERLINSTALLTARGS="perlinstall"
+    
+    
+    
+    
+  cat >> configure-summary << EOF
+  SNMP Perl modules:          enabled
+EOF
+
+fi
+
+if test "x$embed_perl" = "xyes"; then
+    myperl=$ac_cv_path_PERLPROG
+    if test $myperl = "no"; then
+      { echo "configure: error: --enable-embedded-perl requested but no perl executable found" 1>&2; exit 1; }
+    fi
+
+    echo $ac_n "checking for perl CFLAGS""... $ac_c" 1>&6
+echo "configure:9597: checking for perl CFLAGS" >&5
+    perlcflags=`$myperl -MExtUtils::Embed -e ccopts`
+    echo "$ac_t""$perlcflags" 1>&6
+    CPPFLAGS="$CPPFLAGS $perlcflags"
+
+    echo $ac_n "checking for perl LDFLAGS""... $ac_c" 1>&6
+echo "configure:9603: checking for perl LDFLAGS" >&5
+    perlldopts=`$myperl -MExtUtils::Embed -e ldopts`
+    echo "$ac_t""$perlldopts" 1>&6
+    LIBS="$LIBS $perlldopts"
+
+        for ac_func in eval_pv perl_eval_pv
+do
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:9611: checking for $ac_func" >&5
+if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 9616 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char $ac_func(); below.  */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char $ac_func();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+$ac_func();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:9639: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_func 1
+EOF
+ 
+else
+  echo "$ac_t""no" 1>&6
+fi
+done
+
+
+    cat >> confdefs.h <<\EOF
+#define NETSNMP_EMBEDDED_PERL 1
+EOF
+
+    OTHERAGENTLIBOBJS="snmp_perl.o"
+    OTHERAGENTLIBLOBJS="snmp_perl.lo"
+
+    EMBEDPERLINSTALL="embedperlinstall"
+    
+    
+  cat >> configure-summary << EOF
+  Embedded perl support:      enabled
+EOF
+
+fi
+
+AGENTLIBS=$LIBS
+LIBS=$NONAGENTLIBS
+
+echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6
+echo "configure:9684: checking for ANSI C header files" >&5
+if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 9689 "configure"
+#include "confdefs.h"
+#include <stdlib.h>
+#include <stdarg.h>
+#include <string.h>
+#include <float.h>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:9697: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+  rm -rf conftest*
+  ac_cv_header_stdc=yes
+else
+  echo "$ac_err" >&5
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+if test $ac_cv_header_stdc = yes; then
+  # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
+cat > conftest.$ac_ext <<EOF
+#line 9714 "configure"
+#include "confdefs.h"
+#include <string.h>
+EOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  egrep "memchr" >/dev/null 2>&1; then
+  :
+else
+  rm -rf conftest*
+  ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+  # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
+cat > conftest.$ac_ext <<EOF
+#line 9732 "configure"
+#include "confdefs.h"
+#include <stdlib.h>
+EOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  egrep "free" >/dev/null 2>&1; then
+  :
+else
+  rm -rf conftest*
+  ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+  # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
+if test "$cross_compiling" = yes; then
+  :
+else
+  cat > conftest.$ac_ext <<EOF
+#line 9753 "configure"
+#include "confdefs.h"
+#include <ctype.h>
+#define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
+#define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
+#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
+int main () { int i; for (i = 0; i < 256; i++)
+if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2);
+exit (0); }
+
+EOF
+if { (eval echo configure:9764: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+then
+  :
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -fr conftest*
+  ac_cv_header_stdc=no
+fi
+rm -fr conftest*
+fi
+
+fi
+fi
+
+echo "$ac_t""$ac_cv_header_stdc" 1>&6
+if test $ac_cv_header_stdc = yes; then
+  cat >> confdefs.h <<\EOF
+#define STDC_HEADERS 1
+EOF
+
+fi
+
+ac_header_dirent=no
+for ac_hdr in dirent.h sys/ndir.h sys/dir.h ndir.h
+do
+ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for $ac_hdr that defines DIR""... $ac_c" 1>&6
+echo "configure:9792: checking for $ac_hdr that defines DIR" >&5
+if eval "test \"`echo '$''{'ac_cv_header_dirent_$ac_safe'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 9797 "configure"
+#include "confdefs.h"
+#include <sys/types.h>
+#include <$ac_hdr>
+int main() {
+DIR *dirp = 0;
+; return 0; }
+EOF
+if { (eval echo configure:9805: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  eval "ac_cv_header_dirent_$ac_safe=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_header_dirent_$ac_safe=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_header_dirent_'$ac_safe`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_hdr 1
+EOF
+ ac_header_dirent=$ac_hdr; break
+else
+  echo "$ac_t""no" 1>&6
+fi
+done
+# Two versions of opendir et al. are in -ldir and -lx on SCO Xenix.
+if test $ac_header_dirent = dirent.h; then
+echo $ac_n "checking for opendir in -ldir""... $ac_c" 1>&6
+echo "configure:9830: checking for opendir in -ldir" >&5
+ac_lib_var=`echo dir'_'opendir | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  ac_save_LIBS="$LIBS"
+LIBS="-ldir  $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 9838 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char opendir();
+
+int main() {
+opendir()
+; return 0; }
+EOF
+if { (eval echo configure:9849: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  LIBS="$LIBS -ldir"
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+else
+echo $ac_n "checking for opendir in -lx""... $ac_c" 1>&6
+echo "configure:9871: checking for opendir in -lx" >&5
+ac_lib_var=`echo x'_'opendir | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  ac_save_LIBS="$LIBS"
+LIBS="-lx  $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 9879 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char opendir();
+
+int main() {
+opendir()
+; return 0; }
+EOF
+if { (eval echo configure:9890: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  LIBS="$LIBS -lx"
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+fi
+
+echo $ac_n "checking for sys/wait.h that is POSIX.1 compatible""... $ac_c" 1>&6
+echo "configure:9913: checking for sys/wait.h that is POSIX.1 compatible" >&5
+if eval "test \"`echo '$''{'ac_cv_header_sys_wait_h'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 9918 "configure"
+#include "confdefs.h"
+#include <sys/types.h>
+#include <sys/wait.h>
+#ifndef WEXITSTATUS
+#define WEXITSTATUS(stat_val) ((unsigned)(stat_val) >> 8)
+#endif
+#ifndef WIFEXITED
+#define WIFEXITED(stat_val) (((stat_val) & 255) == 0)
+#endif
+int main() {
+int s;
+wait (&s);
+s = WIFEXITED (s) ? WEXITSTATUS (s) : 1;
+; return 0; }
+EOF
+if { (eval echo configure:9934: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  ac_cv_header_sys_wait_h=yes
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  ac_cv_header_sys_wait_h=no
+fi
+rm -f conftest*
+fi
+
+echo "$ac_t""$ac_cv_header_sys_wait_h" 1>&6
+if test $ac_cv_header_sys_wait_h = yes; then
+  cat >> confdefs.h <<\EOF
+#define HAVE_SYS_WAIT_H 1
+EOF
+
+fi
+
+for ac_hdr in stdarg.h string.h fcntl.h limits.h sys/file.h sys/ioctl.h syslog.h unistd.h netinet/tcpip.h netinet/in.h netinet/ip.h netinet/ip_icmp.h net/if.h netdb.h sys/dmap.h machine/pte.h xti.h sys/sockio.h sys/socket.h sys/un.h fstab.h sys/fs.h mtab.h ufs/fs.h ufs/ffs/fs.h sys/fixpoint.h machine/param.h sys/vm.h vm/vm.h sys/vmmeter.h sys/vmparam.h sys/vmmac.h sys/vmsystm.h sys/mbuf.h sys/time.h sys/swap.h inet/mib2.h sys/statvfs.h sys/vfs.h sys/mnttab.h sys/user.h sys/proc.h sys/select.h mntent.h sys/mntent.h kstat.h utsname.h sys/utsname.h sys/cdefs.h getopt.h locale.h pthread.h sys/loadavg.h regex.h linux/tasks.h pwd.h grp.h utmpx.h
+do
+ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+echo "configure:9958: checking for $ac_hdr" >&5
+if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 9963 "configure"
+#include "confdefs.h"
+#include <$ac_hdr>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:9968: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=yes"
+else
+  echo "$ac_err" >&5
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_hdr 1
+EOF
+ 
+else
+  echo "$ac_t""no" 1>&6
+fi
+done
+
+for ac_hdr in malloc.h sys/param.h net/if_dl.h sys/sysctl.h stdlib.h net/if_mib.h net/if_types.h net/if_var.h sys/queue.h osreldate.h machine/types.h sys/socketvar.h
+do
+ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+echo "configure:9998: checking for $ac_hdr" >&5
+if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 10003 "configure"
+#include "confdefs.h"
+#include <$ac_hdr>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:10008: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=yes"
+else
+  echo "$ac_err" >&5
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_hdr 1
+EOF
+ 
+else
+  echo "$ac_t""no" 1>&6
+fi
+done
+
+for ac_hdr in sys/conf.h netinet/in_systm.h netinet/tcp.h netinet/udp.h netinet/in_var.h netinet/if_ether.h netinet/ip_var.h netinet/tcp_timer.h netinet/tcp_var.h netinet/tcp_fsm.h netinet/udp_var.h netinet/icmp_var.h sys/protosw.h nlist.h ioctls.h asm/page.h netipx/ipx.h
+do
+ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+echo "configure:10038: checking for $ac_hdr" >&5
+if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 10043 "configure"
+#include "confdefs.h"
+#include <$ac_hdr>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:10048: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=yes"
+else
+  echo "$ac_err" >&5
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_hdr 1
+EOF
+ 
+else
+  echo "$ac_t""no" 1>&6
+fi
+done
+
+for ac_hdr in arpa/inet.h kvm.h sys/pool.h uvm/uvm_param.h uvm/uvm_extern.h vm/vm_param.h vm/vm_extern.h
+do
+ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+echo "configure:10078: checking for $ac_hdr" >&5
+if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 10083 "configure"
+#include "confdefs.h"
+#include <$ac_hdr>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:10088: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=yes"
+else
+  echo "$ac_err" >&5
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_hdr 1
+EOF
+ 
+else
+  echo "$ac_t""no" 1>&6
+fi
+done
+
+for ac_hdr in sys/mount.h vm/swap_pager.h ufs/ufs/dinode.h
+do
+ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+echo "configure:10118: checking for $ac_hdr" >&5
+if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 10123 "configure"
+#include "confdefs.h"
+#include <$ac_hdr>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:10128: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=yes"
+else
+  echo "$ac_err" >&5
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_hdr 1
+EOF
+ 
+else
+  echo "$ac_t""no" 1>&6
+fi
+done
+
+for ac_hdr in sys/stat.h sys/vnode.h ufs/ufs/quota.h ufs/ufs/inode.h
+do
+ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+echo "configure:10158: checking for $ac_hdr" >&5
+if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 10163 "configure"
+#include "confdefs.h"
+#include <$ac_hdr>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:10168: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=yes"
+else
+  echo "$ac_err" >&5
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_hdr 1
+EOF
+ 
+else
+  echo "$ac_t""no" 1>&6
+fi
+done
+
+for ac_hdr in sys/hashing.h sys/tcpipstats.h sys/sysmp.h
+do
+ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+echo "configure:10198: checking for $ac_hdr" >&5
+if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 10203 "configure"
+#include "confdefs.h"
+#include <$ac_hdr>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:10208: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=yes"
+else
+  echo "$ac_err" >&5
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_hdr 1
+EOF
+ 
+else
+  echo "$ac_t""no" 1>&6
+fi
+done
+
+for ac_hdr in err.h sys/filio.h sgtty.h
+do
+ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+echo "configure:10238: checking for $ac_hdr" >&5
+if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 10243 "configure"
+#include "confdefs.h"
+#include <$ac_hdr>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:10248: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=yes"
+else
+  echo "$ac_err" >&5
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_hdr 1
+EOF
+ 
+else
+  echo "$ac_t""no" 1>&6
+fi
+done
+
+for ac_hdr in sys/statfs.h
+do
+ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+echo "configure:10278: checking for $ac_hdr" >&5
+if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 10283 "configure"
+#include "confdefs.h"
+#include <$ac_hdr>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:10288: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=yes"
+else
+  echo "$ac_err" >&5
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_hdr 1
+EOF
+ 
+else
+  echo "$ac_t""no" 1>&6
+fi
+done
+
+for ac_hdr in net/route.h
+do
+ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+echo "configure:10318: checking for $ac_hdr" >&5
+if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 10323 "configure"
+#include "confdefs.h"
+#include <$ac_hdr>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:10328: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=yes"
+else
+  echo "$ac_err" >&5
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_hdr 1
+EOF
+ 
+else
+  echo "$ac_t""no" 1>&6
+fi
+done
+
+for ac_hdr in sys/dkio.h sys/diskio.h sys/pstat.h linux/hdreg.h pkglocs.h
+do
+ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+echo "configure:10358: checking for $ac_hdr" >&5
+if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 10363 "configure"
+#include "confdefs.h"
+#include <$ac_hdr>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:10368: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=yes"
+else
+  echo "$ac_err" >&5
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_hdr 1
+EOF
+ 
+else
+  echo "$ac_t""no" 1>&6
+fi
+done
+
+for ac_hdr in pkginfo.h
+do
+ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+echo "configure:10398: checking for $ac_hdr" >&5
+if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 10403 "configure"
+#include "confdefs.h"
+#include <$ac_hdr>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:10408: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=yes"
+else
+  echo "$ac_err" >&5
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_hdr 1
+EOF
+ echo $ac_n "checking for pkginfo in -ladm""... $ac_c" 1>&6
+echo "configure:10429: checking for pkginfo in -ladm" >&5
+ac_lib_var=`echo adm'_'pkginfo | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  ac_save_LIBS="$LIBS"
+LIBS="-ladm  $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 10437 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char pkginfo();
+
+int main() {
+pkginfo()
+; return 0; }
+EOF
+if { (eval echo configure:10448: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  cat >> confdefs.h <<\EOF
+#define HAVE_PKGINFO 1
+EOF
+
+    LIBS="${LIBS} -ladm"
+    AGENTLIBS="${AGENTLIBS} -ladm"
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+else
+  echo "$ac_t""no" 1>&6
+fi
+done
+
+for ac_hdr in winsock.h
+do
+ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+echo "configure:10482: checking for $ac_hdr" >&5
+if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 10487 "configure"
+#include "confdefs.h"
+#include <$ac_hdr>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:10492: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=yes"
+else
+  echo "$ac_err" >&5
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_hdr 1
+EOF
+ AGENTLIBS="${AGENTLIBS} -liphlpapi"
+else
+  echo "$ac_t""no" 1>&6
+fi
+done
+
+for ac_hdr in io.h
+do
+ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+echo "configure:10522: checking for $ac_hdr" >&5
+if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 10527 "configure"
+#include "confdefs.h"
+#include <$ac_hdr>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:10532: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=yes"
+else
+  echo "$ac_err" >&5
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_hdr 1
+EOF
+ 
+else
+  echo "$ac_t""no" 1>&6
+fi
+done
+
+for ac_hdr in sys/stream.h
+do
+ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+echo "configure:10562: checking for $ac_hdr" >&5
+if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 10567 "configure"
+#include "confdefs.h"
+#include <$ac_hdr>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:10572: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=yes"
+else
+  echo "$ac_err" >&5
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_hdr 1
+EOF
+ 
+else
+  echo "$ac_t""no" 1>&6
+fi
+done
+
+for ac_hdr in netinet/ip6.h netinet6/in6_var.h netinet6/in6_pcb.h netinet6/ip6_var.h netinet6/tcp6.h netinet6/tcp6_fsm.h netinet6/nd6.h netinet6/tcp6_timer.h netinet6/tcp6_var.h
+do
+ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+echo "configure:10602: checking for $ac_hdr" >&5
+if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 10607 "configure"
+#include "confdefs.h"
+#include <$ac_hdr>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:10612: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=yes"
+else
+  echo "$ac_err" >&5
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_hdr 1
+EOF
+ 
+else
+  echo "$ac_t""no" 1>&6
+fi
+done
+
+for ac_hdr in dlfcn.h
+do
+ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+echo "configure:10642: checking for $ac_hdr" >&5
+if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 10647 "configure"
+#include "confdefs.h"
+#include <$ac_hdr>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:10652: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=yes"
+else
+  echo "$ac_err" >&5
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_hdr 1
+EOF
+ 
+else
+  echo "$ac_t""no" 1>&6
+fi
+done
+
+for ac_hdr in search.h
+do
+ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+echo "configure:10682: checking for $ac_hdr" >&5
+if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 10687 "configure"
+#include "confdefs.h"
+#include <$ac_hdr>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:10692: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=yes"
+else
+  echo "$ac_err" >&5
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_hdr 1
+EOF
+ 
+else
+  echo "$ac_t""no" 1>&6
+fi
+done
+
+
+if echo " $module_list " | grep " host/hr_swinst " > /dev/null; then
+  for ac_hdr in rpmio.h
+do
+ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+echo "configure:10724: checking for $ac_hdr" >&5
+if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 10729 "configure"
+#include "confdefs.h"
+#include <$ac_hdr>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:10734: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=yes"
+else
+  echo "$ac_err" >&5
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_hdr 1
+EOF
+ 
+else
+  echo "$ac_t""no" 1>&6
+for ac_hdr in rpm/rpmio.h
+do
+ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+echo "configure:10761: checking for $ac_hdr" >&5
+if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 10766 "configure"
+#include "confdefs.h"
+#include <$ac_hdr>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:10771: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=yes"
+else
+  echo "$ac_err" >&5
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_hdr 1
+EOF
+ CFLAGS="-I/usr/include/rpm $CFLAGS"
+else
+  echo "$ac_t""no" 1>&6
+fi
+done
+
+  
+fi
+done
+
+fi
+
+echo $ac_n "checking for netinet/in_pcb.h""... $ac_c" 1>&6
+echo "configure:10804: checking for netinet/in_pcb.h" >&5
+if eval "test \"`echo '$''{'cv_have_netinet_in_pcb_h'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+   cat > conftest.$ac_ext <<EOF
+#line 10809 "configure"
+#include "confdefs.h"
+
+#include <netinet/in.h>
+#include <netinet/in_pcb.h>
+
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:10817: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+  rm -rf conftest*
+  cv_have_netinet_in_pcb_h=yes
+else
+  echo "$ac_err" >&5
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  cv_have_netinet_in_pcb_h=no
+fi
+rm -f conftest*
+fi
+
+echo "$ac_t""$cv_have_netinet_in_pcb_h" 1>&6
+if test $cv_have_netinet_in_pcb_h = yes; then
+  cat >> confdefs.h <<\EOF
+#define HAVE_NETINET_IN_PCB_H 1
+EOF
+
+fi
+
+echo $ac_n "checking for sys/disklabel.h""... $ac_c" 1>&6
+echo "configure:10841: checking for sys/disklabel.h" >&5
+if eval "test \"`echo '$''{'cv_have_sys_disklabel_h'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+   cat > conftest.$ac_ext <<EOF
+#line 10846 "configure"
+#include "confdefs.h"
+
+#include <machine/types.h>
+#include <sys/disklabel.h>
+
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:10854: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+  rm -rf conftest*
+  cv_have_sys_disklabel_h=yes
+else
+  echo "$ac_err" >&5
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  cv_have_sys_disklabel_h=no
+fi
+rm -f conftest*
+fi
+
+echo "$ac_t""$cv_have_sys_disklabel_h" 1>&6
+if test $cv_have_sys_disklabel_h = yes; then
+  cat >> confdefs.h <<\EOF
+#define HAVE_SYS_DISKLABEL_H 1
+EOF
+
+fi
+
+for ac_hdr in openssl/hmac.h openssl/evp.h openssl/aes.h openssl/des.h
+do
+ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+echo "configure:10881: checking for $ac_hdr" >&5
+if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 10886 "configure"
+#include "confdefs.h"
+#include <$ac_hdr>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:10891: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=yes"
+else
+  echo "$ac_err" >&5
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_hdr 1
+EOF
+ 
+else
+  echo "$ac_t""no" 1>&6
+fi
+done
+
+
+# Extract the first word of "lpstat", so it can be a program name with args.
+set dummy lpstat; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:10921: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_path_LPSTAT_PATH'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  case "$LPSTAT_PATH" in
+  /*)
+  ac_cv_path_LPSTAT_PATH="$LPSTAT_PATH" # Let the user override the test with a path.
+  ;;
+  ?:/*)			 
+  ac_cv_path_LPSTAT_PATH="$LPSTAT_PATH" # Let the user override the test with a dos path.
+  ;;
+  *)
+  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS=":"
+  ac_dummy="$PATH"
+  for ac_dir in $ac_dummy; do 
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/$ac_word; then
+      ac_cv_path_LPSTAT_PATH="$ac_dir/$ac_word"
+      break
+    fi
+  done
+  IFS="$ac_save_ifs"
+  ;;
+esac
+fi
+LPSTAT_PATH="$ac_cv_path_LPSTAT_PATH"
+if test -n "$LPSTAT_PATH"; then
+  echo "$ac_t""$LPSTAT_PATH" 1>&6
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+if test x$LPSTAT_PATH != x; then
+    cat >> confdefs.h <<EOF
+#define LPSTAT_PATH "$LPSTAT_PATH"
+EOF
+
+    cat >> confdefs.h <<\EOF
+#define HAVE_LPSTAT 1
+EOF
+
+fi
+for ac_func in cgetnext
+do
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:10966: checking for $ac_func" >&5
+if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 10971 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char $ac_func(); below.  */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char $ac_func();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+$ac_func();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:10994: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_func 1
+EOF
+ 
+else
+  echo "$ac_t""no" 1>&6
+fi
+done
+
+if test -r /etc/printcap; then
+    cat >> confdefs.h <<\EOF
+#define HAVE_PRINTCAP 1
+EOF
+
+fi
+
+echo $ac_n "checking for authentication support""... $ac_c" 1>&6
+echo "configure:11026: checking for authentication support" >&5
+if test "x$ac_cv_lib_crypto_EVP_md5" != "xyes" -o "x$ac_cv_header_openssl_hmac_h" != "xyes" -o "x$ac_cv_header_openssl_hmac_h" != "xyes"; then
+    cat >> confdefs.h <<\EOF
+#define USE_INTERNAL_MD5 1
+EOF
+
+    authmodes="MD5"
+    encrmodes=""
+    echo "$ac_t""Internal MD5 Support" 1>&6
+    if test "x$askedopenssl" = "xyes"; then
+	{ echo "configure: error: Asked to use OpenSSL but I couldn't find it." 1>&2; exit 1; }
+    fi
+else
+    if test "x$tryopenssl" = "xno"; then
+        authmodes="MD5"
+        encrmodes=""
+	cat >> confdefs.h <<\EOF
+#define USE_INTERNAL_MD5 1
+EOF
+
+	echo "$ac_t""Internal MD5 Support" 1>&6
+    else
+        authmodes="MD5 SHA1"
+        if test "x$enable_privacy" != "xno" ; then
+	    if test $ac_cv_header_openssl_aes_h = "yes" ; then
+	        encrmodes="DES AES128 AES192 AES256"
+	    else
+	        encrmodes="DES"
+	    fi
+        else
+	    encrmodes="disabled"
+        fi
+	cat >> confdefs.h <<\EOF
+#define USE_OPENSSL 1
+EOF
+
+	echo "$ac_t""OpenSSL Support" 1>&6
+    fi
+fi
+
+
+  cat >> configure-summary << EOF
+  Authentication support:     $authmodes
+EOF
+
+
+  cat >> configure-summary << EOF
+  Encryption support:         $encrmodes
+EOF
+
+
+echo $ac_n "checking for off_t""... $ac_c" 1>&6
+echo "configure:11078: checking for off_t" >&5
+if eval "test \"`echo '$''{'ac_cv_type_off_t'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 11083 "configure"
+#include "confdefs.h"
+#include <sys/types.h>
+#if STDC_HEADERS
+#include <stdlib.h>
+#include <stddef.h>
+#endif
+EOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  egrep "(^|[^a-zA-Z_0-9])off_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then
+  rm -rf conftest*
+  ac_cv_type_off_t=yes
+else
+  rm -rf conftest*
+  ac_cv_type_off_t=no
+fi
+rm -f conftest*
+
+fi
+echo "$ac_t""$ac_cv_type_off_t" 1>&6
+if test $ac_cv_type_off_t = no; then
+  cat >> confdefs.h <<\EOF
+#define off_t long
+EOF
+
+fi
+
+echo $ac_n "checking for pid_t""... $ac_c" 1>&6
+echo "configure:11111: checking for pid_t" >&5
+if eval "test \"`echo '$''{'ac_cv_type_pid_t'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 11116 "configure"
+#include "confdefs.h"
+#include <sys/types.h>
+#if STDC_HEADERS
+#include <stdlib.h>
+#include <stddef.h>
+#endif
+EOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  egrep "(^|[^a-zA-Z_0-9])pid_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then
+  rm -rf conftest*
+  ac_cv_type_pid_t=yes
+else
+  rm -rf conftest*
+  ac_cv_type_pid_t=no
+fi
+rm -f conftest*
+
+fi
+echo "$ac_t""$ac_cv_type_pid_t" 1>&6
+if test $ac_cv_type_pid_t = no; then
+  cat >> confdefs.h <<\EOF
+#define pid_t int
+EOF
+
+fi
+
+echo $ac_n "checking whether time.h and sys/time.h may both be included""... $ac_c" 1>&6
+echo "configure:11144: checking whether time.h and sys/time.h may both be included" >&5
+if eval "test \"`echo '$''{'ac_cv_header_time'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 11149 "configure"
+#include "confdefs.h"
+#include <sys/types.h>
+#include <sys/time.h>
+#include <time.h>
+int main() {
+struct tm *tp;
+; return 0; }
+EOF
+if { (eval echo configure:11158: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  ac_cv_header_time=yes
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  ac_cv_header_time=no
+fi
+rm -f conftest*
+fi
+
+echo "$ac_t""$ac_cv_header_time" 1>&6
+if test $ac_cv_header_time = yes; then
+  cat >> confdefs.h <<\EOF
+#define TIME_WITH_SYS_TIME 1
+EOF
+
+fi
+
+
+echo $ac_n "checking for socklen_t""... $ac_c" 1>&6
+echo "configure:11180: checking for socklen_t" >&5
+if eval "test \"`echo '$''{'ac_cv_type_$1'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 11185 "configure"
+#include "confdefs.h"
+#include <sys/types.h>
+#if STDC_HEADERS
+#include <stdlib.h>
+#include <stddef.h>
+#endif
+#ifdef HAVE_SYS_SOCKET_H
+#include <sys/socket.h>
+#endif
+EOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  egrep "socklen_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then
+  rm -rf conftest*
+  ac_cv_type_socklen_t=yes
+else
+  rm -rf conftest*
+  ac_cv_type_socklen_t=no
+fi
+rm -f conftest*
+
+fi
+
+echo "$ac_t""$ac_cv_type_socklen_t" 1>&6
+if test $ac_cv_type_socklen_t = yes; then
+  cat >> confdefs.h <<\EOF
+#define HAVE_SOCKLEN_T 1
+EOF
+
+fi
+
+echo $ac_n "checking for in_addr_t""... $ac_c" 1>&6
+echo "configure:11217: checking for in_addr_t" >&5
+if eval "test \"`echo '$''{'ac_cv_type_$1'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 11222 "configure"
+#include "confdefs.h"
+#include <sys/types.h>
+#if STDC_HEADERS
+#include <stdlib.h>
+#include <stddef.h>
+#endif
+#ifdef HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+EOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  egrep "in_addr_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then
+  rm -rf conftest*
+  ac_cv_type_in_addr_t=yes
+else
+  rm -rf conftest*
+  ac_cv_type_in_addr_t=no
+fi
+rm -f conftest*
+
+fi
+
+echo "$ac_t""$ac_cv_type_in_addr_t" 1>&6
+if test $ac_cv_type_in_addr_t = yes; then
+  cat >> confdefs.h <<\EOF
+#define HAVE_IN_ADDR_T 1
+EOF
+
+fi
+
+echo $ac_n "checking for correct flags to ps""... $ac_c" 1>&6
+echo "configure:11254: checking for correct flags to ps" >&5
+if eval "test \"`echo '$''{'ac_cv_ps_flags'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  if test "`($PSPROG -e 2>&1) | egrep ' (ps) *$' | awk '{print $NF}'`" = "ps" ; then
+  ac_cv_ps_flags="-e"
+elif test "`($PSPROG -el 2>&1) | egrep ' (ps) *$' | awk '{print $NF}'`" = "ps" ; then
+  ac_cv_ps_flags="-el"
+elif test "`($PSPROG acx 2>&1) | egrep ' (ps) *$' | awk '{print $NF}'`" = "ps" ; then
+  ac_cv_ps_flags="acx"
+elif test "`($PSPROG -acx 2>&1) | egrep ' (ps) *$' | awk '{print $NF}'`" = "ps" ; then
+  ac_cv_ps_flags="-acx"
+elif test "`($PSPROG -o pid,tt,state,time,ucomm 2>&1) | egrep ' ps *$' | awk '{print $NF}'`" = "ps" ; then
+  ac_cv_ps_flags="-o pid,tt,state,time,ucomm"
+elif test "`($PSPROG ax 2>&1) | egrep ' (ps) *$' | awk '{print $NF}'`" = "ps" ; then
+  ac_cv_ps_flags="ax"
+else
+  echo "configure: warning: Unable to determine valid ps flags...  defaulting..." 1>&2
+  ac_cv_ps_flags="-acx"
+fi
+
+fi
+
+echo "$ac_t""$ac_cv_ps_flags" 1>&6
+
+PSCMD="$PSPROG $ac_cv_ps_flags"
+
+cat >> confdefs.h <<EOF
+#define PSCMD "$PSPROG $ac_cv_ps_flags"
+EOF
+
+
+if test $cross_compiling = yes; then
+  if test $with_endianness = "big"; then
+    cat >> confdefs.h <<\EOF
+#define WORDS_BIGENDIAN 1
+EOF
+
+  elif test -z $with_endianness; then
+    { echo "configure: error: You are cross-compiling, but you have not specified the target's endianness" 1>&2; exit 1; }
+  fi
+else
+  if test $with_endianness; then
+    { echo "configure: error: Endianness has been specified, but you are not cross-compiling." 1>&2; exit 1; }
+  fi
+  echo $ac_n "checking whether byte ordering is bigendian""... $ac_c" 1>&6
+echo "configure:11300: checking whether byte ordering is bigendian" >&5
+if eval "test \"`echo '$''{'ac_cv_c_bigendian'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  ac_cv_c_bigendian=unknown
+# See if sys/param.h defines the BYTE_ORDER macro.
+cat > conftest.$ac_ext <<EOF
+#line 11307 "configure"
+#include "confdefs.h"
+#include <sys/types.h>
+#include <sys/param.h>
+int main() {
+
+#if !BYTE_ORDER || !BIG_ENDIAN || !LITTLE_ENDIAN
+ bogus endian macros
+#endif
+; return 0; }
+EOF
+if { (eval echo configure:11318: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  # It does; now see whether it defined to BIG_ENDIAN or not.
+cat > conftest.$ac_ext <<EOF
+#line 11322 "configure"
+#include "confdefs.h"
+#include <sys/types.h>
+#include <sys/param.h>
+int main() {
+
+#if BYTE_ORDER != BIG_ENDIAN
+ not big endian
+#endif
+; return 0; }
+EOF
+if { (eval echo configure:11333: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  ac_cv_c_bigendian=yes
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  ac_cv_c_bigendian=no
+fi
+rm -f conftest*
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+fi
+rm -f conftest*
+if test $ac_cv_c_bigendian = unknown; then
+if test "$cross_compiling" = yes; then
+    { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
+else
+  cat > conftest.$ac_ext <<EOF
+#line 11353 "configure"
+#include "confdefs.h"
+main () {
+  /* Are we little or big endian?  From Harbison&Steele.  */
+  union
+  {
+    long l;
+    char c[sizeof (long)];
+  } u;
+  u.l = 1;
+  exit (u.c[sizeof (long) - 1] == 1);
+}
+EOF
+if { (eval echo configure:11366: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+then
+  ac_cv_c_bigendian=no
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -fr conftest*
+  ac_cv_c_bigendian=yes
+fi
+rm -fr conftest*
+fi
+
+fi
+fi
+
+echo "$ac_t""$ac_cv_c_bigendian" 1>&6
+if test $ac_cv_c_bigendian = yes; then
+  cat >> confdefs.h <<\EOF
+#define WORDS_BIGENDIAN 1
+EOF
+
+fi
+
+fi
+
+# The Ultrix 4.2 mips builtin alloca declared by alloca.h only works
+# for constant arguments.  Useless!
+echo $ac_n "checking for working alloca.h""... $ac_c" 1>&6
+echo "configure:11394: checking for working alloca.h" >&5
+if eval "test \"`echo '$''{'ac_cv_header_alloca_h'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 11399 "configure"
+#include "confdefs.h"
+#include <alloca.h>
+int main() {
+char *p = alloca(2 * sizeof(int));
+; return 0; }
+EOF
+if { (eval echo configure:11406: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  ac_cv_header_alloca_h=yes
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  ac_cv_header_alloca_h=no
+fi
+rm -f conftest*
+fi
+
+echo "$ac_t""$ac_cv_header_alloca_h" 1>&6
+if test $ac_cv_header_alloca_h = yes; then
+  cat >> confdefs.h <<\EOF
+#define HAVE_ALLOCA_H 1
+EOF
+
+fi
+
+echo $ac_n "checking for alloca""... $ac_c" 1>&6
+echo "configure:11427: checking for alloca" >&5
+if eval "test \"`echo '$''{'ac_cv_func_alloca_works'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 11432 "configure"
+#include "confdefs.h"
+
+#ifdef __GNUC__
+# define alloca __builtin_alloca
+#else
+# ifdef _MSC_VER
+#  include <malloc.h>
+#  define alloca _alloca
+# else
+#  if HAVE_ALLOCA_H
+#   include <alloca.h>
+#  else
+#   ifdef _AIX
+ #pragma alloca
+#   else
+#    ifndef alloca /* predefined by HP cc +Olibcalls */
+char *alloca ();
+#    endif
+#   endif
+#  endif
+# endif
+#endif
+
+int main() {
+char *p = (char *) alloca(1);
+; return 0; }
+EOF
+if { (eval echo configure:11460: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  ac_cv_func_alloca_works=yes
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  ac_cv_func_alloca_works=no
+fi
+rm -f conftest*
+fi
+
+echo "$ac_t""$ac_cv_func_alloca_works" 1>&6
+if test $ac_cv_func_alloca_works = yes; then
+  cat >> confdefs.h <<\EOF
+#define HAVE_ALLOCA 1
+EOF
+
+fi
+
+if test $ac_cv_func_alloca_works = no; then
+  # The SVR3 libPW and SVR4 libucb both contain incompatible functions
+  # that cause trouble.  Some versions do not even contain alloca or
+  # contain a buggy version.  If you still want to use their alloca,
+  # use ar to extract alloca.o from them instead of compiling alloca.c.
+  ALLOCA=alloca.${ac_objext}
+  cat >> confdefs.h <<\EOF
+#define C_ALLOCA 1
+EOF
+
+
+echo $ac_n "checking whether alloca needs Cray hooks""... $ac_c" 1>&6
+echo "configure:11492: checking whether alloca needs Cray hooks" >&5
+if eval "test \"`echo '$''{'ac_cv_os_cray'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 11497 "configure"
+#include "confdefs.h"
+#if defined(CRAY) && ! defined(CRAY2)
+webecray
+#else
+wenotbecray
+#endif
+
+EOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  egrep "webecray" >/dev/null 2>&1; then
+  rm -rf conftest*
+  ac_cv_os_cray=yes
+else
+  rm -rf conftest*
+  ac_cv_os_cray=no
+fi
+rm -f conftest*
+
+fi
+
+echo "$ac_t""$ac_cv_os_cray" 1>&6
+if test $ac_cv_os_cray = yes; then
+for ac_func in _getb67 GETB67 getb67; do
+  echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:11522: checking for $ac_func" >&5
+if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 11527 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char $ac_func(); below.  */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char $ac_func();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+$ac_func();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:11550: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  cat >> confdefs.h <<EOF
+#define CRAY_STACKSEG_END $ac_func
+EOF
+
+  break
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+done
+fi
+
+echo $ac_n "checking stack direction for C alloca""... $ac_c" 1>&6
+echo "configure:11577: checking stack direction for C alloca" >&5
+if eval "test \"`echo '$''{'ac_cv_c_stack_direction'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  if test "$cross_compiling" = yes; then
+  ac_cv_c_stack_direction=0
+else
+  cat > conftest.$ac_ext <<EOF
+#line 11585 "configure"
+#include "confdefs.h"
+find_stack_direction ()
+{
+  static char *addr = 0;
+  auto char dummy;
+  if (addr == 0)
+    {
+      addr = &dummy;
+      return find_stack_direction ();
+    }
+  else
+    return (&dummy > addr) ? 1 : -1;
+}
+main ()
+{
+  exit (find_stack_direction() < 0);
+}
+EOF
+if { (eval echo configure:11604: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+then
+  ac_cv_c_stack_direction=1
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -fr conftest*
+  ac_cv_c_stack_direction=-1
+fi
+rm -fr conftest*
+fi
+
+fi
+
+echo "$ac_t""$ac_cv_c_stack_direction" 1>&6
+cat >> confdefs.h <<EOF
+#define STACK_DIRECTION $ac_cv_c_stack_direction
+EOF
+
+fi
+
+if test $ac_cv_prog_gcc = yes; then
+    echo $ac_n "checking whether ${CC-cc} needs -traditional""... $ac_c" 1>&6
+echo "configure:11627: checking whether ${CC-cc} needs -traditional" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_gcc_traditional'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+    ac_pattern="Autoconf.*'x'"
+  cat > conftest.$ac_ext <<EOF
+#line 11633 "configure"
+#include "confdefs.h"
+#include <sgtty.h>
+Autoconf TIOCGETP
+EOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  egrep "$ac_pattern" >/dev/null 2>&1; then
+  rm -rf conftest*
+  ac_cv_prog_gcc_traditional=yes
+else
+  rm -rf conftest*
+  ac_cv_prog_gcc_traditional=no
+fi
+rm -f conftest*
+
+
+  if test $ac_cv_prog_gcc_traditional = no; then
+    cat > conftest.$ac_ext <<EOF
+#line 11651 "configure"
+#include "confdefs.h"
+#include <termio.h>
+Autoconf TCGETA
+EOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  egrep "$ac_pattern" >/dev/null 2>&1; then
+  rm -rf conftest*
+  ac_cv_prog_gcc_traditional=yes
+fi
+rm -f conftest*
+
+  fi
+fi
+
+echo "$ac_t""$ac_cv_prog_gcc_traditional" 1>&6
+  if test $ac_cv_prog_gcc_traditional = yes; then
+    CC="$CC -traditional"
+  fi
+fi
+
+echo $ac_n "checking for 8-bit clean memcmp""... $ac_c" 1>&6
+echo "configure:11673: checking for 8-bit clean memcmp" >&5
+if eval "test \"`echo '$''{'ac_cv_func_memcmp_clean'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  if test "$cross_compiling" = yes; then
+  ac_cv_func_memcmp_clean=no
+else
+  cat > conftest.$ac_ext <<EOF
+#line 11681 "configure"
+#include "confdefs.h"
+
+main()
+{
+  char c0 = 0x40, c1 = 0x80, c2 = 0x81;
+  exit(memcmp(&c0, &c2, 1) < 0 && memcmp(&c1, &c2, 1) < 0 ? 0 : 1);
+}
+
+EOF
+if { (eval echo configure:11691: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+then
+  ac_cv_func_memcmp_clean=yes
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -fr conftest*
+  ac_cv_func_memcmp_clean=no
+fi
+rm -fr conftest*
+fi
+
+fi
+
+echo "$ac_t""$ac_cv_func_memcmp_clean" 1>&6
+test $ac_cv_func_memcmp_clean = no && LIBOBJS="$LIBOBJS memcmp.${ac_objext}"
+
+echo $ac_n "checking return type of signal handlers""... $ac_c" 1>&6
+echo "configure:11709: checking return type of signal handlers" >&5
+if eval "test \"`echo '$''{'ac_cv_type_signal'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 11714 "configure"
+#include "confdefs.h"
+#include <sys/types.h>
+#include <signal.h>
+#ifdef signal
+#undef signal
+#endif
+#ifdef __cplusplus
+extern "C" void (*signal (int, void (*)(int)))(int);
+#else
+void (*signal ()) ();
+#endif
+
+int main() {
+int i;
+; return 0; }
+EOF
+if { (eval echo configure:11731: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  ac_cv_type_signal=void
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  ac_cv_type_signal=int
+fi
+rm -f conftest*
+fi
+
+echo "$ac_t""$ac_cv_type_signal" 1>&6
+cat >> confdefs.h <<EOF
+#define RETSIGTYPE $ac_cv_type_signal
+EOF
+
+
+# getmntent is in -lsun on Irix 4, -lseq on Dynix/PTX, -lgen on Unixware.
+echo $ac_n "checking for getmntent in -lsun""... $ac_c" 1>&6
+echo "configure:11751: checking for getmntent in -lsun" >&5
+ac_lib_var=`echo sun'_'getmntent | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  ac_save_LIBS="$LIBS"
+LIBS="-lsun  $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 11759 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char getmntent();
+
+int main() {
+getmntent()
+; return 0; }
+EOF
+if { (eval echo configure:11770: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  LIBS="-lsun $LIBS"
+else
+  echo "$ac_t""no" 1>&6
+echo $ac_n "checking for getmntent in -lseq""... $ac_c" 1>&6
+echo "configure:11789: checking for getmntent in -lseq" >&5
+ac_lib_var=`echo seq'_'getmntent | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  ac_save_LIBS="$LIBS"
+LIBS="-lseq  $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 11797 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char getmntent();
+
+int main() {
+getmntent()
+; return 0; }
+EOF
+if { (eval echo configure:11808: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  LIBS="-lseq $LIBS"
+else
+  echo "$ac_t""no" 1>&6
+echo $ac_n "checking for getmntent in -lgen""... $ac_c" 1>&6
+echo "configure:11827: checking for getmntent in -lgen" >&5
+ac_lib_var=`echo gen'_'getmntent | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  ac_save_LIBS="$LIBS"
+LIBS="-lgen  $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 11835 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char getmntent();
+
+int main() {
+getmntent()
+; return 0; }
+EOF
+if { (eval echo configure:11846: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  LIBS="-lgen $LIBS"
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+fi
+
+fi
+
+echo $ac_n "checking for getmntent""... $ac_c" 1>&6
+echo "configure:11871: checking for getmntent" >&5
+if eval "test \"`echo '$''{'ac_cv_func_getmntent'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 11876 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char getmntent(); below.  */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char getmntent();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_getmntent) || defined (__stub___getmntent)
+choke me
+#else
+getmntent();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:11899: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_func_getmntent=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_func_getmntent=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'getmntent`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  cat >> confdefs.h <<\EOF
+#define HAVE_GETMNTENT 1
+EOF
+
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+for ac_func in setmntent gethostname uname gettimeofday select socket strtol strtoul strlcpy
+do
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:11924: checking for $ac_func" >&5
+if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 11929 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char $ac_func(); below.  */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char $ac_func();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+$ac_func();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:11952: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_func 1
+EOF
+ 
+else
+  echo "$ac_t""no" 1>&6
+fi
+done
+
+for ac_func in strchr strdup memcpy memmove index bcopy strcasestr regcomp
+do
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:11979: checking for $ac_func" >&5
+if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 11984 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char $ac_func(); below.  */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char $ac_func();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+$ac_func();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:12007: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_func 1
+EOF
+ 
+else
+  echo "$ac_t""no" 1>&6
+fi
+done
+
+for ac_func in signal setsid sigset sigblock sighold strerror setenv vsnprintf snprintf
+do
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:12034: checking for $ac_func" >&5
+if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 12039 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char $ac_func(); below.  */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char $ac_func();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+$ac_func();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:12062: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_func 1
+EOF
+ 
+else
+  echo "$ac_t""no" 1>&6
+fi
+done
+
+for ac_func in sigaction
+do
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:12089: checking for $ac_func" >&5
+if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 12094 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char $ac_func(); below.  */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char $ac_func();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+$ac_func();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:12117: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_func 1
+EOF
+ 
+else
+  echo "$ac_t""no" 1>&6
+fi
+done
+
+for ac_func in snprintf strtoul
+do
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:12144: checking for $ac_func" >&5
+if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 12149 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char $ac_func(); below.  */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char $ac_func();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+$ac_func();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:12172: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_func 1
+EOF
+ 
+else
+  echo "$ac_t""no" 1>&6
+fi
+done
+
+for ac_func in random lrand48 rand
+do
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:12199: checking for $ac_func" >&5
+if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 12204 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char $ac_func(); below.  */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char $ac_func();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+$ac_func();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:12227: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_func 1
+EOF
+ 
+else
+  echo "$ac_t""no" 1>&6
+fi
+done
+
+for ac_func in execv system fork getpid strncasecmp sigalrm
+do
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:12254: checking for $ac_func" >&5
+if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 12259 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char $ac_func(); below.  */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char $ac_func();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+$ac_func();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:12282: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_func 1
+EOF
+ 
+else
+  echo "$ac_t""no" 1>&6
+fi
+done
+
+if echo " $module_list " | grep " host/hr_swinst " > /dev/null; then
+  OLDLIBS=$LIBS
+  LIBS=$AGENTLIBS
+  for ac_func in rpmGetPath
+do
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:12312: checking for $ac_func" >&5
+if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 12317 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char $ac_func(); below.  */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char $ac_func();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+$ac_func();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:12340: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_func 1
+EOF
+ 
+else
+  echo "$ac_t""no" 1>&6
+fi
+done
+
+  LIBS=$OLDLIBS
+fi
+
+for ac_func in getloadavg
+do
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:12370: checking for $ac_func" >&5
+if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 12375 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char $ac_func(); below.  */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char $ac_func();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+$ac_func();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:12398: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_func 1
+EOF
+ 
+else
+  echo "$ac_t""no" 1>&6
+fi
+done
+
+for ac_func in getaddrinfo getipnodebyname
+do
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:12425: checking for $ac_func" >&5
+if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 12430 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char $ac_func(); below.  */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char $ac_func();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+$ac_func();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:12453: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_func 1
+EOF
+ 
+else
+  echo "$ac_t""no" 1>&6
+fi
+done
+
+for ac_func in statvfs statfs
+do
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:12480: checking for $ac_func" >&5
+if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 12485 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char $ac_func(); below.  */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char $ac_func();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+$ac_func();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:12508: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_func 1
+EOF
+ 
+else
+  echo "$ac_t""no" 1>&6
+fi
+done
+
+for ac_func in getdtablesize
+do
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:12535: checking for $ac_func" >&5
+if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 12540 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char $ac_func(); below.  */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char $ac_func();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+$ac_func();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:12563: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_func 1
+EOF
+ 
+else
+  echo "$ac_t""no" 1>&6
+fi
+done
+
+for ac_func in getfsstat
+do
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:12590: checking for $ac_func" >&5
+if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 12595 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char $ac_func(); below.  */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char $ac_func();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+$ac_func();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:12618: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_func 1
+EOF
+ 
+else
+  echo "$ac_t""no" 1>&6
+fi
+done
+
+for ac_func in usleep
+do
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:12645: checking for $ac_func" >&5
+if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 12650 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char $ac_func(); below.  */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char $ac_func();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+$ac_func();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:12673: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_func 1
+EOF
+ 
+else
+  echo "$ac_t""no" 1>&6
+fi
+done
+
+#for ac_func in setlocale
+#do
+#echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+#echo "configure:12700: checking for $ac_func" >&5
+#if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+#  echo $ac_n "(cached) $ac_c" 1>&6
+#else
+#  cat > conftest.$ac_ext <<EOF
+##line 12705 "configure"
+##include "confdefs.h"
+#/* System header to define __stub macros and hopefully few prototypes,
+#    which can conflict with char $ac_func(); below.  */
+##include <assert.h>
+#/* Override any gcc2 internal prototype to avoid an error.  */
+#/* We use char because int might match the return type of a gcc2
+#    builtin and then its argument prototype would still apply.  */
+#char $ac_func();
+#
+#int main() {
+#
+#/* The GNU C library defines this for functions which it implements
+#    to always fail with ENOSYS.  Some functions are actually named
+#    something starting with __ and the normal name is an alias.  */
+##if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+#choke me
+##else
+#$ac_func();
+#endif
+#
+#; return 0; }
+#EOF
+#if { (eval echo configure:12728: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+#  rm -rf conftest*
+#  eval "ac_cv_func_$ac_func=yes"
+#else
+#  echo "configure: failed program was:" >&5
+#  cat conftest.$ac_ext >&5
+#  rm -rf conftest*
+#  eval "ac_cv_func_$ac_func=no"
+#fi
+#rm -f conftest*
+#fi
+#
+#if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+#  echo "$ac_t""yes" 1>&6
+#    ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+#  cat >> confdefs.h <<EOF
+##define $ac_tr_func 1
+#EOF
+# 
+#else
+#  echo "$ac_t""no" 1>&6
+#fi
+#done
+
+for ac_func in tcgetattr
+do
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:12755: checking for $ac_func" >&5
+if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 12760 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char $ac_func(); below.  */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char $ac_func();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+$ac_func();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:12783: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_func 1
+EOF
+ 
+else
+  echo "$ac_t""no" 1>&6
+fi
+done
+
+for ac_func in if_nameindex if_freenameindex
+do
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:12810: checking for $ac_func" >&5
+if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 12815 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char $ac_func(); below.  */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char $ac_func();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+$ac_func();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:12838: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_func 1
+EOF
+ 
+else
+  echo "$ac_t""no" 1>&6
+fi
+done
+
+for ac_func in getpagesize
+do
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:12865: checking for $ac_func" >&5
+if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 12870 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char $ac_func(); below.  */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char $ac_func();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+$ac_func();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:12893: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_func 1
+EOF
+ 
+else
+  echo "$ac_t""no" 1>&6
+fi
+done
+
+for ac_func in mkstemp
+do
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:12920: checking for $ac_func" >&5
+if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 12925 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char $ac_func(); below.  */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char $ac_func();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+$ac_func();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:12948: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_func 1
+EOF
+ 
+else
+  echo "$ac_t""no" 1>&6
+fi
+done
+
+for ac_func in getpwnam getgrnam setgid setuid setgroups
+do
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:12975: checking for $ac_func" >&5
+if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 12980 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char $ac_func(); below.  */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char $ac_func();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+$ac_func();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:13003: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_func 1
+EOF
+ 
+else
+  echo "$ac_t""no" 1>&6
+fi
+done
+
+for ac_func in setitimer
+do
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:13030: checking for $ac_func" >&5
+if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 13035 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char $ac_func(); below.  */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char $ac_func();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+$ac_func();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:13058: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_func 1
+EOF
+ 
+else
+  echo "$ac_t""no" 1>&6
+fi
+done
+
+
+echo $ac_n "checking for SIOCGIFADDR in sys/ioctl.h""... $ac_c" 1>&6
+echo "configure:13084: checking for SIOCGIFADDR in sys/ioctl.h" >&5
+if eval "test \"`echo '$''{'cv_sys_ioctl_h_has_SIOCGIFADDR'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+   cat > conftest.$ac_ext <<EOF
+#line 13089 "configure"
+#include "confdefs.h"
+
+#ifdef HAVE_SYS_IOCTL_H
+#include <sys/ioctl.h>
+#endif
+#ifdef SIOCGIFADDR
+xxxyesxxx
+#endif
+
+EOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  egrep "xxxyesxxx" >/dev/null 2>&1; then
+  rm -rf conftest*
+  cv_sys_ioctl_h_has_SIOCGIFADDR=yes
+else
+  rm -rf conftest*
+  cv_sys_ioctl_h_has_SIOCGIFADDR=no
+fi
+rm -f conftest*
+
+fi
+
+echo "$ac_t""$cv_sys_ioctl_h_has_SIOCGIFADDR" 1>&6
+if test $cv_sys_ioctl_h_has_SIOCGIFADDR = yes; then
+  cat >> confdefs.h <<\EOF
+#define SYS_IOCTL_H_HAS_SIOCGIFADDR 1
+EOF
+
+fi
+
+# ultrix
+echo $ac_n "checking for two-argument statfs with struct fs_data (Ultrix)""... $ac_c" 1>&6
+echo "configure:13122: checking for two-argument statfs with struct fs_data (Ultrix)" >&5
+if eval "test \"`echo '$''{'fu_cv_sys_stat_fs_data'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  if test "$cross_compiling" = yes; then
+  fu_cv_sys_stat_fs_data=no
+else
+  cat > conftest.$ac_ext <<EOF
+#line 13130 "configure"
+#include "confdefs.h"
+
+#ifdef HAVE_SYS_PARAM_H
+#include <sys/param.h>
+#endif
+#include <sys/types.h>
+#ifdef HAVE_SYS_MOUNT_H
+#include <sys/mount.h>
+#endif
+#ifdef HAVE_SYS_FS_TYPES_H
+#include <sys/fs_types.h>
+#endif
+main ()
+{
+struct fs_data fsd;
+/* Ultrix's statfs returns 1 for success,
+   0 for not mounted, -1 for failure.  */
+exit (statfs (".", &fsd) != 1);
+}
+EOF
+if { (eval echo configure:13151: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+then
+  fu_cv_sys_stat_fs_data=yes
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -fr conftest*
+  fu_cv_sys_stat_fs_data=no
+fi
+rm -fr conftest*
+fi
+
+fi
+
+echo "$ac_t""$fu_cv_sys_stat_fs_data" 1>&6
+if test $fu_cv_sys_stat_fs_data = yes; then
+  cat >> confdefs.h <<\EOF
+#define STAT_STATFS_FS_DATA 1
+EOF
+
+fi
+
+echo $ac_n "checking if __FUNCTION__ is defined""... $ac_c" 1>&6
+echo "configure:13174: checking if __FUNCTION__ is defined" >&5
+if eval "test \"`echo '$''{'ac_cv_HAVE_CPP_UNDERBAR_FUNCTION_DEFINED'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+cat > conftest.$ac_ext <<EOF
+#line 13180 "configure"
+#include "confdefs.h"
+
+int main() {
+
+    char *cp = __FUNCTION__;
+
+; return 0; }
+EOF
+if { (eval echo configure:13189: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  ac_cv_HAVE_CPP_UNDERBAR_FUNCTION_DEFINED=yes
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  ac_cv_HAVE_CPP_UNDERBAR_FUNCTION_DEFINED=no
+fi
+rm -f conftest*
+fi
+
+echo "$ac_t""$ac_cv_HAVE_CPP_UNDERBAR_FUNCTION_DEFINED" 1>&6
+
+if test "x$ac_cv_HAVE_CPP_UNDERBAR_FUNCTION_DEFINED" = "xyes"; then
+  cat >> confdefs.h <<\EOF
+#define HAVE_CPP_UNDERBAR_FUNCTION_DEFINED 1
+EOF
+
+fi
+
+
+
+ac_safe_struct=`echo "sigaction" | sed 'y%./+-%__p_%'`
+ac_safe_member=`echo "sa_sigaction" | 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 $ac_n "checking for sigaction.sa_sigaction""... $ac_c" 1>&6
+echo "configure:13218: checking for sigaction.sa_sigaction" >&5
+if eval "test \"`echo '$''{'$ac_safe_all'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+if test "xno" = "x"; then
+  defineit="= 0"
+elif test "xno" = "xno"; then
+  defineit=""
+else
+  defineit="no"
+fi
+cat > conftest.$ac_ext <<EOF
+#line 13231 "configure"
+#include "confdefs.h"
+
+
+#ifdef HAVE_SYS_PARAM_H
+#include <sys/param.h>
+#endif
+#include <sys/types.h>
+#include <sys/signal.h>
+
+
+int main() {
+
+struct sigaction testit; 
+testit.sa_sigaction $defineit;
+
+; return 0; }
+EOF
+if { (eval echo configure:13249: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  eval "${ac_safe_all}=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "${ac_safe_all}=no" 
+fi
+rm -f conftest*
+
+fi
+
+
+if eval "test \"x$`echo ${ac_safe_all}`\" = \"xyes\""; then
+  echo "$ac_t""yes" 1>&6
+  cat >> confdefs.h <<EOF
+#define $ac_uc_define 1
+EOF
+
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+
+
+
+
+ac_safe_struct=`echo "sockaddr" | sed 'y%./+-%__p_%'`
+ac_safe_member=`echo "sa_len" | 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 $ac_n "checking for sockaddr.sa_len""... $ac_c" 1>&6
+echo "configure:13283: checking for sockaddr.sa_len" >&5
+if eval "test \"`echo '$''{'$ac_safe_all'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+if test "xno" = "x"; then
+  defineit="= 0"
+elif test "xno" = "xno"; then
+  defineit=""
+else
+  defineit="no"
+fi
+cat > conftest.$ac_ext <<EOF
+#line 13296 "configure"
+#include "confdefs.h"
+
+
+#ifdef HAVE_SYS_PARAM_H
+#include <sys/param.h>
+#endif
+#include <sys/types.h>
+#define KERNEL
+#define _KERNEL
+#include <sys/socket.h>
+#undef KERNEL
+#undef _KERNEL
+
+
+int main() {
+
+struct sockaddr testit; 
+testit.sa_len $defineit;
+
+; return 0; }
+EOF
+if { (eval echo configure:13318: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  eval "${ac_safe_all}=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "${ac_safe_all}=no" 
+fi
+rm -f conftest*
+
+fi
+
+
+if eval "test \"x$`echo ${ac_safe_all}`\" = \"xyes\""; then
+  echo "$ac_t""yes" 1>&6
+  cat >> confdefs.h <<EOF
+#define $ac_uc_define 1
+EOF
+
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+
+
+
+
+ac_safe_struct=`echo "sockaddr" | sed 'y%./+-%__p_%'`
+ac_safe_member=`echo "sa_union.sa_generic.sa_family2" | 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 $ac_n "checking for sockaddr.sa_union.sa_generic.sa_family2""... $ac_c" 1>&6
+echo "configure:13352: checking for sockaddr.sa_union.sa_generic.sa_family2" >&5
+if eval "test \"`echo '$''{'$ac_safe_all'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+if test "xno" = "x"; then
+  defineit="= 0"
+elif test "xno" = "xno"; then
+  defineit=""
+else
+  defineit="no"
+fi
+cat > conftest.$ac_ext <<EOF
+#line 13365 "configure"
+#include "confdefs.h"
+
+
+#ifdef HAVE_SYS_PARAM_H
+#include <sys/param.h>
+#endif
+#include <sys/types.h>
+#define KERNEL
+#define _KERNEL
+#include <sys/socket.h>
+#undef KERNEL
+#undef _KERNEL
+
+
+int main() {
+
+struct sockaddr testit; 
+testit.sa_union.sa_generic.sa_family2 $defineit;
+
+; return 0; }
+EOF
+if { (eval echo configure:13387: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  eval "${ac_safe_all}=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "${ac_safe_all}=no" 
+fi
+rm -f conftest*
+
+fi
+
+
+if eval "test \"x$`echo ${ac_safe_all}`\" = \"xyes\""; then
+  echo "$ac_t""yes" 1>&6
+  cat >> confdefs.h <<EOF
+#define $ac_uc_define 1
+EOF
+
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+
+
+
+
+ac_safe_struct=`echo "rtentry" | sed 'y%./+-%__p_%'`
+ac_safe_member=`echo "rt_dst" | 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 $ac_n "checking for rtentry.rt_dst""... $ac_c" 1>&6
+echo "configure:13421: checking for rtentry.rt_dst" >&5
+if eval "test \"`echo '$''{'$ac_safe_all'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+if test "xno" = "x"; then
+  defineit="= 0"
+elif test "xno" = "xno"; then
+  defineit=""
+else
+  defineit="no"
+fi
+cat > conftest.$ac_ext <<EOF
+#line 13434 "configure"
+#include "confdefs.h"
+
+
+#ifdef HAVE_SYS_PARAM_H
+#include <sys/param.h>
+#endif
+#include <sys/types.h>
+#define KERNEL
+#define _KERNEL
+#include <sys/socket.h>
+#undef KERNEL
+#undef _KERNEL
+#include <net/route.h>
+
+
+int main() {
+
+struct rtentry testit; 
+testit.rt_dst $defineit;
+
+; return 0; }
+EOF
+if { (eval echo configure:13457: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  eval "${ac_safe_all}=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "${ac_safe_all}=no" 
+fi
+rm -f conftest*
+
+fi
+
+
+if eval "test \"x$`echo ${ac_safe_all}`\" = \"xyes\""; then
+  echo "$ac_t""yes" 1>&6
+  cat >> confdefs.h <<EOF
+#define $ac_uc_define 1
+EOF
+
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+
+
+echo $ac_n "checking type of rtentry structure""... $ac_c" 1>&6
+echo "configure:13484: checking type of rtentry structure" >&5
+if eval "test \"`echo '$''{'ac_cv_RTENTRY_TYPE'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+
+cat > conftest.$ac_ext <<EOF
+#line 13491 "configure"
+#include "confdefs.h"
+
+#ifdef HAVE_SYS_PARAM_H
+#include <sys/param.h>
+#endif
+#include <sys/types.h>
+#define KERNEL
+#define _KERNEL
+#include <sys/socket.h>
+#undef KERNEL
+#undef _KERNEL
+#include <net/route.h>
+
+int main() {
+
+
+#ifndef STRUCT_RTENTRY_HAS_RT_DST
+#define rt_dst rt_nodes->rn_key
+#endif
+
+  struct rtentry rt; 
+  rt.rt_nodes[0].rn_flags = 1;
+  rt.rt_dst;
+  
+; return 0; }
+EOF
+if { (eval echo configure:13518: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  ac_cv_RTENTRY_TYPE="BSD-4.4"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+fi
+rm -f conftest*
+
+if test "x$ac_cv_RTENTRY_TYPE" = "x"; then
+cat > conftest.$ac_ext <<EOF
+#line 13529 "configure"
+#include "confdefs.h"
+
+#ifdef HAVE_SYS_PARAM_H
+#include <sys/param.h>
+#endif
+#include <sys/types.h>
+#define KERNEL
+#define _KERNEL
+#include <sys/socket.h>
+#undef KERNEL
+#undef _KERNEL
+#include <net/route.h>
+
+int main() {
+
+struct rtentry rt; 
+rt.rt_hash;
+
+; return 0; }
+EOF
+if { (eval echo configure:13550: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  ac_cv_RTENTRY_TYPE="BSD-4.3"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+fi
+rm -f conftest*
+fi
+
+if test "x$ac_cv_RTENTRY_TYPE" = "x"; then
+  echo "$ac_t""Unknown" 1>&6
+  ac_cv_RTENTRY_TYPE="unknown"
+fi
+
+
+fi
+
+echo "$ac_t""$ac_cv_RTENTRY_TYPE" 1>&6
+
+if test "x$ac_cv_RTENTRY_TYPE" = "xBSD-4.4"; then
+  cat >> confdefs.h <<\EOF
+#define RTENTRY_4_4 1
+EOF
+
+fi
+
+if test "x$ac_cv_RTENTRY_TYPE" = "xunknown"; then
+echo $ac_n "checking for struct rtentry""... $ac_c" 1>&6
+echo "configure:13579: checking for struct rtentry" >&5
+if eval "test \"`echo '$''{'ac_cv_struct_rtentry'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 13584 "configure"
+#include "confdefs.h"
+#define KERNEL
+#include <net/route.h>
+
+EOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  egrep "ortentry" >/dev/null 2>&1; then
+  rm -rf conftest*
+  ac_cv_struct_rtentry=ortentry
+else
+  rm -rf conftest*
+  ac_cv_struct_rtentry=rtentry 
+fi
+rm -f conftest*
+
+if test "x$ac_cv_struct_rtentry" = "xrtentry" ; then
+  ac_cv_struct_rtentry="rtentry"
+else
+  ac_cv_struct_rtentry="ortentry"
+fi
+
+fi
+
+echo "$ac_t""$ac_cv_struct_rtentry" 1>&6
+else
+  RTENTRY_TYPE="rtentry"
+  ac_cv_struct_rtentry="rtentry"
+fi
+
+if test "x$ac_cv_struct_rtentry" != "x"; then
+  cat >> confdefs.h <<EOF
+#define RTENTRY struct ${ac_cv_struct_rtentry}
+EOF
+
+else
+  cat >> confdefs.h <<\EOF
+#define RTENTRY struct rtentry
+EOF
+
+fi
+
+if test "x$ac_cv_RTENTRY_TYPE" = "xBSD-4.3"; then
+echo $ac_n "checking for struct rtentry has a rt_next node""... $ac_c" 1>&6
+echo "configure:13628: checking for struct rtentry has a rt_next node" >&5
+if eval "test \"`echo '$''{'ac_cv_struct_rtentry_rt_next'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+cat > conftest.$ac_ext <<EOF
+#line 13634 "configure"
+#include "confdefs.h"
+
+#ifdef HAVE_SYS_PARAM_H
+#include <sys/param.h>
+#endif
+#include <sys/types.h>
+#define KERNEL
+#define _KERNEL
+#include <sys/socket.h>
+#undef KERNEL
+#undef _KERNEL
+#include <net/route.h>
+
+int main() {
+
+struct rtentry rt; 
+rt.rt_next;
+
+; return 0; }
+EOF
+if { (eval echo configure:13655: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  ac_cv_struct_rtentry_rt_next=yes
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  ac_cv_struct_rtentry_rt_next=no 
+fi
+rm -f conftest*
+
+fi
+
+echo "$ac_t""$ac_cv_struct_rtentry_rt_next" 1>&6
+
+if test "x$ac_cv_struct_rtentry_rt_next" = "xyes"; then
+  cat >> confdefs.h <<\EOF
+#define RTENTRY_RT_NEXT 1
+EOF
+
+fi
+
+fi
+
+
+
+ac_safe_struct=`echo "rtentry" | sed 'y%./+-%__p_%'`
+ac_safe_member=`echo "rt_unit" | 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 $ac_n "checking for rtentry.rt_unit""... $ac_c" 1>&6
+echo "configure:13687: checking for rtentry.rt_unit" >&5
+if eval "test \"`echo '$''{'$ac_safe_all'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+if test "x" = "x"; then
+  defineit="= 0"
+elif test "x" = "xno"; then
+  defineit=""
+else
+  defineit=""
+fi
+cat > conftest.$ac_ext <<EOF
+#line 13700 "configure"
+#include "confdefs.h"
+
+
+#ifdef HAVE_SYS_PARAM_H
+#include <sys/param.h>
+#endif
+#include <sys/types.h>
+#define KERNEL
+#define _KERNEL
+#include <sys/socket.h>
+#undef KERNEL
+#undef _KERNEL
+#include <net/route.h>
+
+
+int main() {
+
+struct rtentry testit; 
+testit.rt_unit $defineit;
+
+; return 0; }
+EOF
+if { (eval echo configure:13723: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  eval "${ac_safe_all}=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "${ac_safe_all}=no" 
+fi
+rm -f conftest*
+
+fi
+
+
+if eval "test \"x$`echo ${ac_safe_all}`\" = \"xyes\""; then
+  echo "$ac_t""yes" 1>&6
+  cat >> confdefs.h <<EOF
+#define $ac_uc_define 1
+EOF
+
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+
+
+
+
+ac_safe_struct=`echo "rtentry" | sed 'y%./+-%__p_%'`
+ac_safe_member=`echo "rt_refcnt" | 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 $ac_n "checking for rtentry.rt_refcnt""... $ac_c" 1>&6
+echo "configure:13757: checking for rtentry.rt_refcnt" >&5
+if eval "test \"`echo '$''{'$ac_safe_all'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+if test "x" = "x"; then
+  defineit="= 0"
+elif test "x" = "xno"; then
+  defineit=""
+else
+  defineit=""
+fi
+cat > conftest.$ac_ext <<EOF
+#line 13770 "configure"
+#include "confdefs.h"
+
+
+#ifdef HAVE_SYS_PARAM_H
+#include <sys/param.h>
+#endif
+#include <sys/types.h>
+#define KERNEL
+#define _KERNEL
+#include <sys/socket.h>
+#undef KERNEL
+#undef _KERNEL
+#include <net/route.h>
+
+
+int main() {
+
+struct rtentry testit; 
+testit.rt_refcnt $defineit;
+
+; return 0; }
+EOF
+if { (eval echo configure:13793: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  eval "${ac_safe_all}=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "${ac_safe_all}=no" 
+fi
+rm -f conftest*
+
+fi
+
+
+if eval "test \"x$`echo ${ac_safe_all}`\" = \"xyes\""; then
+  echo "$ac_t""yes" 1>&6
+  cat >> confdefs.h <<EOF
+#define $ac_uc_define 1
+EOF
+
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+
+
+
+
+ac_safe_struct=`echo "rtentry" | sed 'y%./+-%__p_%'`
+ac_safe_member=`echo "rt_hash" | 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 $ac_n "checking for rtentry.rt_hash""... $ac_c" 1>&6
+echo "configure:13827: checking for rtentry.rt_hash" >&5
+if eval "test \"`echo '$''{'$ac_safe_all'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+if test "x" = "x"; then
+  defineit="= 0"
+elif test "x" = "xno"; then
+  defineit=""
+else
+  defineit=""
+fi
+cat > conftest.$ac_ext <<EOF
+#line 13840 "configure"
+#include "confdefs.h"
+
+
+#ifdef HAVE_SYS_PARAM_H
+#include <sys/param.h>
+#endif
+#include <sys/types.h>
+#define KERNEL
+#define _KERNEL
+#include <sys/socket.h>
+#undef KERNEL
+#undef _KERNEL
+#include <net/route.h>
+
+
+int main() {
+
+struct rtentry testit; 
+testit.rt_hash $defineit;
+
+; return 0; }
+EOF
+if { (eval echo configure:13863: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  eval "${ac_safe_all}=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "${ac_safe_all}=no" 
+fi
+rm -f conftest*
+
+fi
+
+
+if eval "test \"x$`echo ${ac_safe_all}`\" = \"xyes\""; then
+  echo "$ac_t""yes" 1>&6
+  cat >> confdefs.h <<EOF
+#define $ac_uc_define 1
+EOF
+
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+
+
+
+
+ac_safe_struct=`echo "rtentry" | sed 'y%./+-%__p_%'`
+ac_safe_member=`echo "rt_use" | 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 $ac_n "checking for rtentry.rt_use""... $ac_c" 1>&6
+echo "configure:13897: checking for rtentry.rt_use" >&5
+if eval "test \"`echo '$''{'$ac_safe_all'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+if test "x" = "x"; then
+  defineit="= 0"
+elif test "x" = "xno"; then
+  defineit=""
+else
+  defineit=""
+fi
+cat > conftest.$ac_ext <<EOF
+#line 13910 "configure"
+#include "confdefs.h"
+
+
+#ifdef HAVE_SYS_PARAM_H
+#include <sys/param.h>
+#endif
+#include <sys/types.h>
+#define KERNEL
+#define _KERNEL
+#include <sys/socket.h>
+#undef KERNEL
+#undef _KERNEL
+#include <net/route.h>
+
+
+int main() {
+
+struct rtentry testit; 
+testit.rt_use $defineit;
+
+; return 0; }
+EOF
+if { (eval echo configure:13933: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  eval "${ac_safe_all}=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "${ac_safe_all}=no" 
+fi
+rm -f conftest*
+
+fi
+
+
+if eval "test \"x$`echo ${ac_safe_all}`\" = \"xyes\""; then
+  echo "$ac_t""yes" 1>&6
+  cat >> confdefs.h <<EOF
+#define $ac_uc_define 1
+EOF
+
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+
+
+
+
+ac_safe_struct=`echo "tcpstat" | sed 'y%./+-%__p_%'`
+ac_safe_member=`echo "tcp_rcvmemdrop" | 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 $ac_n "checking for tcpstat.tcp_rcvmemdrop""... $ac_c" 1>&6
+echo "configure:13967: checking for tcpstat.tcp_rcvmemdrop" >&5
+if eval "test \"`echo '$''{'$ac_safe_all'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+if test "x" = "x"; then
+  defineit="= 0"
+elif test "x" = "xno"; then
+  defineit=""
+else
+  defineit=""
+fi
+cat > conftest.$ac_ext <<EOF
+#line 13980 "configure"
+#include "confdefs.h"
+
+
+#ifdef HAVE_SYS_PARAM_H
+#include <sys/param.h>
+#endif
+#include <sys/types.h>
+#include <netinet/tcp.h>
+#ifdef HAVE_NETINET_TCP_TIMER_H
+#include <netinet/tcp_timer.h>
+#endif
+
+#ifdef HAVE_NETINET_TCP_VAR_H
+#include <netinet/tcp_var.h>
+#endif
+
+
+int main() {
+
+struct tcpstat testit; 
+testit.tcp_rcvmemdrop $defineit;
+
+; return 0; }
+EOF
+if { (eval echo configure:14005: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  eval "${ac_safe_all}=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "${ac_safe_all}=no" 
+fi
+rm -f conftest*
+
+fi
+
+
+if eval "test \"x$`echo ${ac_safe_all}`\" = \"xyes\""; then
+  echo "$ac_t""yes" 1>&6
+  cat >> confdefs.h <<EOF
+#define $ac_uc_define 1
+EOF
+
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+
+
+
+
+
+ac_safe_struct=`echo "ifnet" | sed 'y%./+-%__p_%'`
+ac_safe_member=`echo "if_mtu" | 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 $ac_n "checking for ifnet.if_mtu""... $ac_c" 1>&6
+echo "configure:14040: checking for ifnet.if_mtu" >&5
+if eval "test \"`echo '$''{'$ac_safe_all'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+if test "x" = "x"; then
+  defineit="= 0"
+elif test "x" = "xno"; then
+  defineit=""
+else
+  defineit=""
+fi
+cat > conftest.$ac_ext <<EOF
+#line 14053 "configure"
+#include "confdefs.h"
+
+
+#ifdef HAVE_SYS_PARAM_H
+#include <sys/param.h>
+#endif
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <net/if.h>
+#ifdef HAVE_NET_IF_VAR_H
+#include <net/if_var.h>
+#endif
+
+
+int main() {
+
+struct ifnet testit; 
+testit.if_mtu $defineit;
+
+; return 0; }
+EOF
+if { (eval echo configure:14075: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  eval "${ac_safe_all}=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "${ac_safe_all}=no" 
+fi
+rm -f conftest*
+
+fi
+
+
+if eval "test \"x$`echo ${ac_safe_all}`\" = \"xyes\""; then
+  echo "$ac_t""yes" 1>&6
+  cat >> confdefs.h <<EOF
+#define $ac_uc_define 1
+EOF
+
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+
+
+if test "x$ac_cv_struct_ifnet_has_if_mtu" = "xno"; then
+echo $ac_n "checking if _KERNEL needs to be defined for if_mtu""... $ac_c" 1>&6
+echo "configure:14103: checking if _KERNEL needs to be defined for if_mtu" >&5
+if eval "test \"`echo '$''{'ac_cv_IFNET_NEEDS_KERNEL'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+if test "x$ac_cv_struct_ifnet_has_if_mtu" = "xyes"; then
+  ac_cv_IFNET_NEEDS_KERNEL=no
+else
+cat > conftest.$ac_ext <<EOF
+#line 14112 "configure"
+#include "confdefs.h"
+
+#define _KERNEL 1
+#ifdef HAVE_SYS_PARAM_H
+#include <sys/param.h>
+#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
+
+int main() {
+
+struct ifnet testit;
+testit.if_mtu = 0;
+
+; return 0; }
+EOF
+if { (eval echo configure:14136: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  ac_cv_IFNET_NEEDS_KERNEL=yes
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  ac_cv_IFNET_NEEDS_KERNEL=no
+fi
+rm -f conftest*
+fi
+
+fi
+
+echo "$ac_t""$ac_cv_IFNET_NEEDS_KERNEL" 1>&6
+
+if test "x$ac_cv_IFNET_NEEDS_KERNEL" = "xyes"; then
+  cat >> confdefs.h <<\EOF
+#define IFNET_NEEDS_KERNEL 1
+EOF
+
+fi
+fi
+
+
+
+ac_safe_struct=`echo "ifaddr" | sed 'y%./+-%__p_%'`
+ac_safe_member=`echo "ifa_next" | 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 $ac_n "checking for ifaddr.ifa_next""... $ac_c" 1>&6
+echo "configure:14168: checking for ifaddr.ifa_next" >&5
+if eval "test \"`echo '$''{'$ac_safe_all'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+if test "x" = "x"; then
+  defineit="= 0"
+elif test "x" = "xno"; then
+  defineit=""
+else
+  defineit=""
+fi
+cat > conftest.$ac_ext <<EOF
+#line 14181 "configure"
+#include "confdefs.h"
+
+
+#ifdef IFNET_NEEDS_KERNEL
+#define _KERNEL 1
+#endif
+#ifdef HAVE_SYS_PARAM_H
+#include <sys/param.h>
+#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
+
+
+int main() {
+
+struct ifaddr testit; 
+testit.ifa_next $defineit;
+
+; return 0; }
+EOF
+if { (eval echo configure:14209: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  eval "${ac_safe_all}=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "${ac_safe_all}=no" 
+fi
+rm -f conftest*
+
+fi
+
+
+if eval "test \"x$`echo ${ac_safe_all}`\" = \"xyes\""; then
+  echo "$ac_t""yes" 1>&6
+  cat >> confdefs.h <<EOF
+#define $ac_uc_define 1
+EOF
+
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+
+
+
+
+
+ac_safe_struct=`echo "ifnet" | sed 'y%./+-%__p_%'`
+ac_safe_member=`echo "if_baudrate" | 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 $ac_n "checking for ifnet.if_baudrate""... $ac_c" 1>&6
+echo "configure:14244: checking for ifnet.if_baudrate" >&5
+if eval "test \"`echo '$''{'$ac_safe_all'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+if test "x" = "x"; then
+  defineit="= 0"
+elif test "x" = "xno"; then
+  defineit=""
+else
+  defineit=""
+fi
+cat > conftest.$ac_ext <<EOF
+#line 14257 "configure"
+#include "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_baudrate $defineit;
+
+; return 0; }
+EOF
+if { (eval echo configure:14317: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  eval "${ac_safe_all}=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "${ac_safe_all}=no" 
+fi
+rm -f conftest*
+
+fi
+
+
+if eval "test \"x$`echo ${ac_safe_all}`\" = \"xyes\""; then
+  echo "$ac_t""yes" 1>&6
+  cat >> confdefs.h <<EOF
+#define $ac_uc_define 1
+EOF
+
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+
+
+
+
+
+ac_safe_struct=`echo "ifnet" | sed 'y%./+-%__p_%'`
+ac_safe_member=`echo "if_baudrate.ifs_value" | 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 $ac_n "checking for ifnet.if_baudrate.ifs_value""... $ac_c" 1>&6
+echo "configure:14352: checking for ifnet.if_baudrate.ifs_value" >&5
+if eval "test \"`echo '$''{'$ac_safe_all'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+if test "x" = "x"; then
+  defineit="= 0"
+elif test "x" = "xno"; then
+  defineit=""
+else
+  defineit=""
+fi
+cat > conftest.$ac_ext <<EOF
+#line 14365 "configure"
+#include "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_baudrate.ifs_value $defineit;
+
+; return 0; }
+EOF
+if { (eval echo configure:14425: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  eval "${ac_safe_all}=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "${ac_safe_all}=no" 
+fi
+rm -f conftest*
+
+fi
+
+
+if eval "test \"x$`echo ${ac_safe_all}`\" = \"xyes\""; then
+  echo "$ac_t""yes" 1>&6
+  cat >> confdefs.h <<EOF
+#define $ac_uc_define 1
+EOF
+
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+
+
+
+
+
+ac_safe_struct=`echo "ifnet" | sed 'y%./+-%__p_%'`
+ac_safe_member=`echo "if_speed" | 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 $ac_n "checking for ifnet.if_speed""... $ac_c" 1>&6
+echo "configure:14460: checking for ifnet.if_speed" >&5
+if eval "test \"`echo '$''{'$ac_safe_all'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+if test "x" = "x"; then
+  defineit="= 0"
+elif test "x" = "xno"; then
+  defineit=""
+else
+  defineit=""
+fi
+cat > conftest.$ac_ext <<EOF
+#line 14473 "configure"
+#include "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_speed $defineit;
+
+; return 0; }
+EOF
+if { (eval echo configure:14533: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  eval "${ac_safe_all}=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "${ac_safe_all}=no" 
+fi
+rm -f conftest*
+
+fi
+
+
+if eval "test \"x$`echo ${ac_safe_all}`\" = \"xyes\""; then
+  echo "$ac_t""yes" 1>&6
+  cat >> confdefs.h <<EOF
+#define $ac_uc_define 1
+EOF
+
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+
+
+
+
+
+ac_safe_struct=`echo "ifnet" | sed 'y%./+-%__p_%'`
+ac_safe_member=`echo "if_type" | 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 $ac_n "checking for ifnet.if_type""... $ac_c" 1>&6
+echo "configure:14568: checking for ifnet.if_type" >&5
+if eval "test \"`echo '$''{'$ac_safe_all'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+if test "x" = "x"; then
+  defineit="= 0"
+elif test "x" = "xno"; then
+  defineit=""
+else
+  defineit=""
+fi
+cat > conftest.$ac_ext <<EOF
+#line 14581 "configure"
+#include "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_type $defineit;
+
+; return 0; }
+EOF
+if { (eval echo configure:14641: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  eval "${ac_safe_all}=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "${ac_safe_all}=no" 
+fi
+rm -f conftest*
+
+fi
+
+
+if eval "test \"x$`echo ${ac_safe_all}`\" = \"xyes\""; then
+  echo "$ac_t""yes" 1>&6
+  cat >> confdefs.h <<EOF
+#define $ac_uc_define 1
+EOF
+
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+
+
+
+
+
+ac_safe_struct=`echo "ifnet" | sed 'y%./+-%__p_%'`
+ac_safe_member=`echo "if_imcasts" | 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 $ac_n "checking for ifnet.if_imcasts""... $ac_c" 1>&6
+echo "configure:14676: checking for ifnet.if_imcasts" >&5
+if eval "test \"`echo '$''{'$ac_safe_all'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+if test "x" = "x"; then
+  defineit="= 0"
+elif test "x" = "xno"; then
+  defineit=""
+else
+  defineit=""
+fi
+cat > conftest.$ac_ext <<EOF
+#line 14689 "configure"
+#include "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_imcasts $defineit;
+
+; return 0; }
+EOF
+if { (eval echo configure:14749: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  eval "${ac_safe_all}=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "${ac_safe_all}=no" 
+fi
+rm -f conftest*
+
+fi
+
+
+if eval "test \"x$`echo ${ac_safe_all}`\" = \"xyes\""; then
+  echo "$ac_t""yes" 1>&6
+  cat >> confdefs.h <<EOF
+#define $ac_uc_define 1
+EOF
+
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+
+
+
+
+
+ac_safe_struct=`echo "ifnet" | sed 'y%./+-%__p_%'`
+ac_safe_member=`echo "if_iqdrops" | 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 $ac_n "checking for ifnet.if_iqdrops""... $ac_c" 1>&6
+echo "configure:14784: checking for ifnet.if_iqdrops" >&5
+if eval "test \"`echo '$''{'$ac_safe_all'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+if test "x" = "x"; then
+  defineit="= 0"
+elif test "x" = "xno"; then
+  defineit=""
+else
+  defineit=""
+fi
+cat > conftest.$ac_ext <<EOF
+#line 14797 "configure"
+#include "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_iqdrops $defineit;
+
+; return 0; }
+EOF
+if { (eval echo configure:14857: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  eval "${ac_safe_all}=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "${ac_safe_all}=no" 
+fi
+rm -f conftest*
+
+fi
+
+
+if eval "test \"x$`echo ${ac_safe_all}`\" = \"xyes\""; then
+  echo "$ac_t""yes" 1>&6
+  cat >> confdefs.h <<EOF
+#define $ac_uc_define 1
+EOF
+
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+
+
+
+
+
+ac_safe_struct=`echo "ifnet" | sed 'y%./+-%__p_%'`
+ac_safe_member=`echo "if_noproto" | 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 $ac_n "checking for ifnet.if_noproto""... $ac_c" 1>&6
+echo "configure:14892: checking for ifnet.if_noproto" >&5
+if eval "test \"`echo '$''{'$ac_safe_all'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+if test "x" = "x"; then
+  defineit="= 0"
+elif test "x" = "xno"; then
+  defineit=""
+else
+  defineit=""
+fi
+cat > conftest.$ac_ext <<EOF
+#line 14905 "configure"
+#include "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_noproto $defineit;
+
+; return 0; }
+EOF
+if { (eval echo configure:14965: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  eval "${ac_safe_all}=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "${ac_safe_all}=no" 
+fi
+rm -f conftest*
+
+fi
+
+
+if eval "test \"x$`echo ${ac_safe_all}`\" = \"xyes\""; then
+  echo "$ac_t""yes" 1>&6
+  cat >> confdefs.h <<EOF
+#define $ac_uc_define 1
+EOF
+
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+
+
+
+
+
+ac_safe_struct=`echo "ifnet" | sed 'y%./+-%__p_%'`
+ac_safe_member=`echo "if_omcasts" | 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 $ac_n "checking for ifnet.if_omcasts""... $ac_c" 1>&6
+echo "configure:15000: checking for ifnet.if_omcasts" >&5
+if eval "test \"`echo '$''{'$ac_safe_all'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+if test "x" = "x"; then
+  defineit="= 0"
+elif test "x" = "xno"; then
+  defineit=""
+else
+  defineit=""
+fi
+cat > conftest.$ac_ext <<EOF
+#line 15013 "configure"
+#include "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_omcasts $defineit;
+
+; return 0; }
+EOF
+if { (eval echo configure:15073: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  eval "${ac_safe_all}=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "${ac_safe_all}=no" 
+fi
+rm -f conftest*
+
+fi
+
+
+if eval "test \"x$`echo ${ac_safe_all}`\" = \"xyes\""; then
+  echo "$ac_t""yes" 1>&6
+  cat >> confdefs.h <<EOF
+#define $ac_uc_define 1
+EOF
+
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+
+
+
+
+
+ac_safe_struct=`echo "ifnet" | sed 'y%./+-%__p_%'`
+ac_safe_member=`echo "if_xname" | 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 $ac_n "checking for ifnet.if_xname""... $ac_c" 1>&6
+echo "configure:15108: checking for ifnet.if_xname" >&5
+if eval "test \"`echo '$''{'$ac_safe_all'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+if test "xno" = "x"; then
+  defineit="= 0"
+elif test "xno" = "xno"; then
+  defineit=""
+else
+  defineit="no"
+fi
+cat > conftest.$ac_ext <<EOF
+#line 15121 "configure"
+#include "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_xname $defineit;
+
+; return 0; }
+EOF
+if { (eval echo configure:15181: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  eval "${ac_safe_all}=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "${ac_safe_all}=no" 
+fi
+rm -f conftest*
+
+fi
+
+
+if eval "test \"x$`echo ${ac_safe_all}`\" = \"xyes\""; then
+  echo "$ac_t""yes" 1>&6
+  cat >> confdefs.h <<EOF
+#define $ac_uc_define 1
+EOF
+
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+
+
+
+
+
+ac_safe_struct=`echo "ifnet" | sed 'y%./+-%__p_%'`
+ac_safe_member=`echo "if_lastchange.tv_sec" | 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 $ac_n "checking for ifnet.if_lastchange.tv_sec""... $ac_c" 1>&6
+echo "configure:15216: checking for ifnet.if_lastchange.tv_sec" >&5
+if eval "test \"`echo '$''{'$ac_safe_all'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+if test "x" = "x"; then
+  defineit="= 0"
+elif test "x" = "xno"; then
+  defineit=""
+else
+  defineit=""
+fi
+cat > conftest.$ac_ext <<EOF
+#line 15229 "configure"
+#include "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_sec $defineit;
+
+; return 0; }
+EOF
+if { (eval echo configure:15289: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  eval "${ac_safe_all}=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "${ac_safe_all}=no" 
+fi
+rm -f conftest*
+
+fi
+
+
+if eval "test \"x$`echo ${ac_safe_all}`\" = \"xyes\""; then
+  echo "$ac_t""yes" 1>&6
+  cat >> confdefs.h <<EOF
+#define $ac_uc_define 1
+EOF
+
+else
+  echo "$ac_t""no" 1>&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___%'`
+
+echo $ac_n "checking for ifnet.if_obytes""... $ac_c" 1>&6
+echo "configure:15324: checking for ifnet.if_obytes" >&5
+if eval "test \"`echo '$''{'$ac_safe_all'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+if test "x" = "x"; then
+  defineit="= 0"
+elif test "x" = "xno"; then
+  defineit=""
+else
+  defineit=""
+fi
+cat > conftest.$ac_ext <<EOF
+#line 15337 "configure"
+#include "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_obytes $defineit;
+
+; return 0; }
+EOF
+if { (eval echo configure:15397: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  eval "${ac_safe_all}=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "${ac_safe_all}=no" 
+fi
+rm -f conftest*
+
+fi
+
+
+if eval "test \"x$`echo ${ac_safe_all}`\" = \"xyes\""; then
+  echo "$ac_t""yes" 1>&6
+  cat >> confdefs.h <<EOF
+#define $ac_uc_define 1
+EOF
+
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+
+
+
+
+
+ac_safe_struct=`echo "ifnet" | sed 'y%./+-%__p_%'`
+ac_safe_member=`echo "if_ibytes" | 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 $ac_n "checking for ifnet.if_ibytes""... $ac_c" 1>&6
+echo "configure:15432: checking for ifnet.if_ibytes" >&5
+if eval "test \"`echo '$''{'$ac_safe_all'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+if test "x" = "x"; then
+  defineit="= 0"
+elif test "x" = "xno"; then
+  defineit=""
+else
+  defineit=""
+fi
+cat > conftest.$ac_ext <<EOF
+#line 15445 "configure"
+#include "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_ibytes $defineit;
+
+; return 0; }
+EOF
+if { (eval echo configure:15505: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  eval "${ac_safe_all}=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "${ac_safe_all}=no" 
+fi
+rm -f conftest*
+
+fi
+
+
+if eval "test \"x$`echo ${ac_safe_all}`\" = \"xyes\""; then
+  echo "$ac_t""yes" 1>&6
+  cat >> confdefs.h <<EOF
+#define $ac_uc_define 1
+EOF
+
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+
+
+
+
+
+ac_safe_struct=`echo "ifnet" | sed 'y%./+-%__p_%'`
+ac_safe_member=`echo "if_addrlist" | 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 $ac_n "checking for ifnet.if_addrlist""... $ac_c" 1>&6
+echo "configure:15540: checking for ifnet.if_addrlist" >&5
+if eval "test \"`echo '$''{'$ac_safe_all'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+if test "x" = "x"; then
+  defineit="= 0"
+elif test "x" = "xno"; then
+  defineit=""
+else
+  defineit=""
+fi
+cat > conftest.$ac_ext <<EOF
+#line 15553 "configure"
+#include "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_addrlist $defineit;
+
+; return 0; }
+EOF
+if { (eval echo configure:15613: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  eval "${ac_safe_all}=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "${ac_safe_all}=no" 
+fi
+rm -f conftest*
+
+fi
+
+
+if eval "test \"x$`echo ${ac_safe_all}`\" = \"xyes\""; then
+  echo "$ac_t""yes" 1>&6
+  cat >> confdefs.h <<EOF
+#define $ac_uc_define 1
+EOF
+
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+
+
+
+
+
+ac_safe_struct=`echo "ifnet" | sed 'y%./+-%__p_%'`
+ac_safe_member=`echo "if_addrhead.tqh_first" | 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 $ac_n "checking for ifnet.if_addrhead.tqh_first""... $ac_c" 1>&6
+echo "configure:15648: checking for ifnet.if_addrhead.tqh_first" >&5
+if eval "test \"`echo '$''{'$ac_safe_all'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+if test "x" = "x"; then
+  defineit="= 0"
+elif test "x" = "xno"; then
+  defineit=""
+else
+  defineit=""
+fi
+cat > conftest.$ac_ext <<EOF
+#line 15661 "configure"
+#include "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_addrhead.tqh_first $defineit;
+
+; return 0; }
+EOF
+if { (eval echo configure:15721: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  eval "${ac_safe_all}=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "${ac_safe_all}=no" 
+fi
+rm -f conftest*
+
+fi
+
+
+if eval "test \"x$`echo ${ac_safe_all}`\" = \"xyes\""; then
+  echo "$ac_t""yes" 1>&6
+  cat >> confdefs.h <<EOF
+#define $ac_uc_define 1
+EOF
+
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+
+
+
+
+
+ac_safe_struct=`echo "udpstat" | sed 'y%./+-%__p_%'`
+ac_safe_member=`echo "udps_discard" | 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 $ac_n "checking for udpstat.udps_discard""... $ac_c" 1>&6
+echo "configure:15756: checking for udpstat.udps_discard" >&5
+if eval "test \"`echo '$''{'$ac_safe_all'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+if test "x" = "x"; then
+  defineit="= 0"
+elif test "x" = "xno"; then
+  defineit=""
+else
+  defineit=""
+fi
+cat > conftest.$ac_ext <<EOF
+#line 15769 "configure"
+#include "confdefs.h"
+
+
+#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
+#if HAVE_NETINET_UDP_H
+#include <netinet/udp.h>
+#endif
+#if HAVE_NETINET_UDP_VAR_H
+#include <netinet/udp_var.h>
+#endif
+
+
+int main() {
+
+struct udpstat testit; 
+testit.udps_discard $defineit;
+
+; return 0; }
+EOF
+if { (eval echo configure:15795: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  eval "${ac_safe_all}=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "${ac_safe_all}=no" 
+fi
+rm -f conftest*
+
+fi
+
+
+if eval "test \"x$`echo ${ac_safe_all}`\" = \"xyes\""; then
+  echo "$ac_t""yes" 1>&6
+  cat >> confdefs.h <<EOF
+#define $ac_uc_define 1
+EOF
+
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+
+
+
+
+ac_safe_struct=`echo "udpstat" | sed 'y%./+-%__p_%'`
+ac_safe_member=`echo "udps_noport" | 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 $ac_n "checking for udpstat.udps_noport""... $ac_c" 1>&6
+echo "configure:15829: checking for udpstat.udps_noport" >&5
+if eval "test \"`echo '$''{'$ac_safe_all'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+if test "x" = "x"; then
+  defineit="= 0"
+elif test "x" = "xno"; then
+  defineit=""
+else
+  defineit=""
+fi
+cat > conftest.$ac_ext <<EOF
+#line 15842 "configure"
+#include "confdefs.h"
+
+
+#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
+#if HAVE_NETINET_UDP_H
+#include <netinet/udp.h>
+#endif
+#if HAVE_NETINET_UDP_VAR_H
+#include <netinet/udp_var.h>
+#endif
+
+
+int main() {
+
+struct udpstat testit; 
+testit.udps_noport $defineit;
+
+; return 0; }
+EOF
+if { (eval echo configure:15868: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  eval "${ac_safe_all}=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "${ac_safe_all}=no" 
+fi
+rm -f conftest*
+
+fi
+
+
+if eval "test \"x$`echo ${ac_safe_all}`\" = \"xyes\""; then
+  echo "$ac_t""yes" 1>&6
+  cat >> confdefs.h <<EOF
+#define $ac_uc_define 1
+EOF
+
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+
+
+
+
+ac_safe_struct=`echo "udpstat" | sed 'y%./+-%__p_%'`
+ac_safe_member=`echo "udps_noportbcast" | 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 $ac_n "checking for udpstat.udps_noportbcast""... $ac_c" 1>&6
+echo "configure:15902: checking for udpstat.udps_noportbcast" >&5
+if eval "test \"`echo '$''{'$ac_safe_all'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+if test "x" = "x"; then
+  defineit="= 0"
+elif test "x" = "xno"; then
+  defineit=""
+else
+  defineit=""
+fi
+cat > conftest.$ac_ext <<EOF
+#line 15915 "configure"
+#include "confdefs.h"
+
+
+#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
+#if HAVE_NETINET_UDP_H
+#include <netinet/udp.h>
+#endif
+#if HAVE_NETINET_UDP_VAR_H
+#include <netinet/udp_var.h>
+#endif
+
+
+int main() {
+
+struct udpstat testit; 
+testit.udps_noportbcast $defineit;
+
+; return 0; }
+EOF
+if { (eval echo configure:15941: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  eval "${ac_safe_all}=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "${ac_safe_all}=no" 
+fi
+rm -f conftest*
+
+fi
+
+
+if eval "test \"x$`echo ${ac_safe_all}`\" = \"xyes\""; then
+  echo "$ac_t""yes" 1>&6
+  cat >> confdefs.h <<EOF
+#define $ac_uc_define 1
+EOF
+
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+
+
+
+
+ac_safe_struct=`echo "udpstat" | sed 'y%./+-%__p_%'`
+ac_safe_member=`echo "udps_fullsock" | 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 $ac_n "checking for udpstat.udps_fullsock""... $ac_c" 1>&6
+echo "configure:15975: checking for udpstat.udps_fullsock" >&5
+if eval "test \"`echo '$''{'$ac_safe_all'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+if test "x" = "x"; then
+  defineit="= 0"
+elif test "x" = "xno"; then
+  defineit=""
+else
+  defineit=""
+fi
+cat > conftest.$ac_ext <<EOF
+#line 15988 "configure"
+#include "confdefs.h"
+
+
+#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
+#if HAVE_NETINET_UDP_H
+#include <netinet/udp.h>
+#endif
+#if HAVE_NETINET_UDP_VAR_H
+#include <netinet/udp_var.h>
+#endif
+
+
+int main() {
+
+struct udpstat testit; 
+testit.udps_fullsock $defineit;
+
+; return 0; }
+EOF
+if { (eval echo configure:16014: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  eval "${ac_safe_all}=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "${ac_safe_all}=no" 
+fi
+rm -f conftest*
+
+fi
+
+
+if eval "test \"x$`echo ${ac_safe_all}`\" = \"xyes\""; then
+  echo "$ac_t""yes" 1>&6
+  cat >> confdefs.h <<EOF
+#define $ac_uc_define 1
+EOF
+
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+
+
+
+
+ac_safe_struct=`echo "arphd" | sed 'y%./+-%__p_%'`
+ac_safe_member=`echo "at_next" | 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 $ac_n "checking for arphd.at_next""... $ac_c" 1>&6
+echo "configure:16048: checking for arphd.at_next" >&5
+if eval "test \"`echo '$''{'$ac_safe_all'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+if test "x" = "x"; then
+  defineit="= 0"
+elif test "x" = "xno"; then
+  defineit=""
+else
+  defineit=""
+fi
+cat > conftest.$ac_ext <<EOF
+#line 16061 "configure"
+#include "confdefs.h"
+
+
+#ifdef HAVE_SYS_PARAM_H
+#include <sys/param.h>
+#endif
+#include <sys/types.h>
+#include <sys/socket.h>
+#ifdef HAVE_SYS_TIME_H
+#include <sys/time.h>
+#endif
+#include <net/if.h>
+#if HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+#if HAVE_NETINET_IF_ETHER_H
+#include <netinet/if_ether.h>
+#endif
+
+
+int main() {
+
+struct arphd testit; 
+testit.at_next $defineit;
+
+; return 0; }
+EOF
+if { (eval echo configure:16089: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  eval "${ac_safe_all}=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "${ac_safe_all}=no" 
+fi
+rm -f conftest*
+
+fi
+
+
+if eval "test \"x$`echo ${ac_safe_all}`\" = \"xyes\""; then
+  echo "$ac_t""yes" 1>&6
+  cat >> confdefs.h <<EOF
+#define $ac_uc_define 1
+EOF
+
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+
+
+
+
+ac_safe_struct=`echo "swdevt" | sed 'y%./+-%__p_%'`
+ac_safe_member=`echo "sw_nblksenabled" | 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 $ac_n "checking for swdevt.sw_nblksenabled""... $ac_c" 1>&6
+echo "configure:16123: checking for swdevt.sw_nblksenabled" >&5
+if eval "test \"`echo '$''{'$ac_safe_all'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+if test "x" = "x"; then
+  defineit="= 0"
+elif test "x" = "xno"; then
+  defineit=""
+else
+  defineit=""
+fi
+cat > conftest.$ac_ext <<EOF
+#line 16136 "configure"
+#include "confdefs.h"
+
+
+#if HAVE_SYS_CONF_H
+#include <sys/conf.h>
+#endif
+
+
+int main() {
+
+struct swdevt testit; 
+testit.sw_nblksenabled $defineit;
+
+; return 0; }
+EOF
+if { (eval echo configure:16152: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  eval "${ac_safe_all}=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "${ac_safe_all}=no" 
+fi
+rm -f conftest*
+
+fi
+
+
+if eval "test \"x$`echo ${ac_safe_all}`\" = \"xyes\""; then
+  echo "$ac_t""yes" 1>&6
+  cat >> confdefs.h <<EOF
+#define $ac_uc_define 1
+EOF
+
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+
+
+
+
+ac_safe_struct=`echo "statvfs" | sed 'y%./+-%__p_%'`
+ac_safe_member=`echo "f_frsize" | 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 $ac_n "checking for statvfs.f_frsize""... $ac_c" 1>&6
+echo "configure:16186: checking for statvfs.f_frsize" >&5
+if eval "test \"`echo '$''{'$ac_safe_all'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+if test "x" = "x"; then
+  defineit="= 0"
+elif test "x" = "xno"; then
+  defineit=""
+else
+  defineit=""
+fi
+cat > conftest.$ac_ext <<EOF
+#line 16199 "configure"
+#include "confdefs.h"
+
+
+#ifdef HAVE_SYS_STAT_H
+#include <sys/stat.h>
+#endif
+#if HAVE_SYS_STATFS_H
+#include <sys/statfs.h>
+#endif
+#if HAVE_SYS_STATVFS_H
+#include <sys/statvfs.h>
+#endif
+
+
+int main() {
+
+struct statvfs testit; 
+testit.f_frsize $defineit;
+
+; return 0; }
+EOF
+if { (eval echo configure:16221: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  eval "${ac_safe_all}=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "${ac_safe_all}=no" 
+fi
+rm -f conftest*
+
+fi
+
+
+if eval "test \"x$`echo ${ac_safe_all}`\" = \"xyes\""; then
+  echo "$ac_t""yes" 1>&6
+  cat >> confdefs.h <<EOF
+#define $ac_uc_define 1
+EOF
+
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+
+
+
+
+ac_safe_struct=`echo "statvfs" | sed 'y%./+-%__p_%'`
+ac_safe_member=`echo "f_files" | 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 $ac_n "checking for statvfs.f_files""... $ac_c" 1>&6
+echo "configure:16255: checking for statvfs.f_files" >&5
+if eval "test \"`echo '$''{'$ac_safe_all'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+if test "x" = "x"; then
+  defineit="= 0"
+elif test "x" = "xno"; then
+  defineit=""
+else
+  defineit=""
+fi
+cat > conftest.$ac_ext <<EOF
+#line 16268 "configure"
+#include "confdefs.h"
+
+
+#ifdef HAVE_SYS_STAT_H
+#include <sys/stat.h>
+#endif
+#if HAVE_SYS_STATFS_H
+#include <sys/statfs.h>
+#endif
+#if HAVE_SYS_STATVFS_H
+#include <sys/statvfs.h>
+#endif
+
+
+int main() {
+
+struct statvfs testit; 
+testit.f_files $defineit;
+
+; return 0; }
+EOF
+if { (eval echo configure:16290: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  eval "${ac_safe_all}=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "${ac_safe_all}=no" 
+fi
+rm -f conftest*
+
+fi
+
+
+if eval "test \"x$`echo ${ac_safe_all}`\" = \"xyes\""; then
+  echo "$ac_t""yes" 1>&6
+  cat >> confdefs.h <<EOF
+#define $ac_uc_define 1
+EOF
+
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+
+
+
+
+ac_safe_struct=`echo "statfs" | sed 'y%./+-%__p_%'`
+ac_safe_member=`echo "f_files" | 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 $ac_n "checking for statfs.f_files""... $ac_c" 1>&6
+echo "configure:16324: checking for statfs.f_files" >&5
+if eval "test \"`echo '$''{'$ac_safe_all'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+if test "x" = "x"; then
+  defineit="= 0"
+elif test "x" = "xno"; then
+  defineit=""
+else
+  defineit=""
+fi
+cat > conftest.$ac_ext <<EOF
+#line 16337 "configure"
+#include "confdefs.h"
+
+
+#ifdef HAVE_SYS_STAT_H
+#include <sys/stat.h>
+#endif
+#if HAVE_SYS_STATFS_H
+#include <sys/statfs.h>
+#endif
+#ifdef HAVE_SYS_PARAM_H
+#include <sys/param.h>
+#include <sys/types.h>
+#endif
+#ifdef HAVE_SYS_MOUNT_H
+#include <sys/mount.h>
+#endif
+
+
+int main() {
+
+struct statfs testit; 
+testit.f_files $defineit;
+
+; return 0; }
+EOF
+if { (eval echo configure:16363: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  eval "${ac_safe_all}=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "${ac_safe_all}=no" 
+fi
+rm -f conftest*
+
+fi
+
+
+if eval "test \"x$`echo ${ac_safe_all}`\" = \"xyes\""; then
+  echo "$ac_t""yes" 1>&6
+  cat >> confdefs.h <<EOF
+#define $ac_uc_define 1
+EOF
+
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+
+
+
+
+ac_safe_struct=`echo "statfs" | sed 'y%./+-%__p_%'`
+ac_safe_member=`echo "f_ffree" | 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 $ac_n "checking for statfs.f_ffree""... $ac_c" 1>&6
+echo "configure:16397: checking for statfs.f_ffree" >&5
+if eval "test \"`echo '$''{'$ac_safe_all'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+if test "x" = "x"; then
+  defineit="= 0"
+elif test "x" = "xno"; then
+  defineit=""
+else
+  defineit=""
+fi
+cat > conftest.$ac_ext <<EOF
+#line 16410 "configure"
+#include "confdefs.h"
+
+
+#ifdef HAVE_SYS_STAT_H
+#include <sys/stat.h>
+#endif
+#if HAVE_SYS_STATFS_H
+#include <sys/statfs.h>
+#endif
+#ifdef HAVE_SYS_PARAM_H
+#include <sys/param.h>
+#include <sys/types.h>
+#endif
+#ifdef HAVE_SYS_MOUNT_H
+#include <sys/mount.h>
+#endif
+
+
+int main() {
+
+struct statfs testit; 
+testit.f_ffree $defineit;
+
+; return 0; }
+EOF
+if { (eval echo configure:16436: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  eval "${ac_safe_all}=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "${ac_safe_all}=no" 
+fi
+rm -f conftest*
+
+fi
+
+
+if eval "test \"x$`echo ${ac_safe_all}`\" = \"xyes\""; then
+  echo "$ac_t""yes" 1>&6
+  cat >> confdefs.h <<EOF
+#define $ac_uc_define 1
+EOF
+
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+
+
+
+
+ac_safe_struct=`echo "statfs" | sed 'y%./+-%__p_%'`
+ac_safe_member=`echo "f_favail" | 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 $ac_n "checking for statfs.f_favail""... $ac_c" 1>&6
+echo "configure:16470: checking for statfs.f_favail" >&5
+if eval "test \"`echo '$''{'$ac_safe_all'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+if test "x" = "x"; then
+  defineit="= 0"
+elif test "x" = "xno"; then
+  defineit=""
+else
+  defineit=""
+fi
+cat > conftest.$ac_ext <<EOF
+#line 16483 "configure"
+#include "confdefs.h"
+
+
+#ifdef HAVE_SYS_STAT_H
+#include <sys/stat.h>
+#endif
+#if HAVE_SYS_STATFS_H
+#include <sys/statfs.h>
+#endif
+#ifdef HAVE_SYS_PARAM_H
+#include <sys/param.h>
+#include <sys/types.h>
+#endif
+#ifdef HAVE_SYS_MOUNT_H
+#include <sys/mount.h>
+#endif
+
+
+int main() {
+
+struct statfs testit; 
+testit.f_favail $defineit;
+
+; return 0; }
+EOF
+if { (eval echo configure:16509: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  eval "${ac_safe_all}=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "${ac_safe_all}=no" 
+fi
+rm -f conftest*
+
+fi
+
+
+if eval "test \"x$`echo ${ac_safe_all}`\" = \"xyes\""; then
+  echo "$ac_t""yes" 1>&6
+  cat >> confdefs.h <<EOF
+#define $ac_uc_define 1
+EOF
+
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+
+
+
+
+ac_safe_struct=`echo "nlist" | sed 'y%./+-%__p_%'`
+ac_safe_member=`echo "n_value" | 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 $ac_n "checking for nlist.n_value""... $ac_c" 1>&6
+echo "configure:16543: checking for nlist.n_value" >&5
+if eval "test \"`echo '$''{'$ac_safe_all'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+if test "x" = "x"; then
+  defineit="= 0"
+elif test "x" = "xno"; then
+  defineit=""
+else
+  defineit=""
+fi
+cat > conftest.$ac_ext <<EOF
+#line 16556 "configure"
+#include "confdefs.h"
+
+
+#if HAVE_NLIST_H
+#include <nlist.h>
+#endif
+
+
+int main() {
+
+struct nlist testit; 
+testit.n_value $defineit;
+
+; return 0; }
+EOF
+if { (eval echo configure:16572: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  eval "${ac_safe_all}=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "${ac_safe_all}=no" 
+fi
+rm -f conftest*
+
+fi
+
+
+if eval "test \"x$`echo ${ac_safe_all}`\" = \"xyes\""; then
+  echo "$ac_t""yes" 1>&6
+  cat >> confdefs.h <<EOF
+#define $ac_uc_define 1
+EOF
+
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+
+
+
+
+ac_safe_struct=`echo "ipstat" | sed 'y%./+-%__p_%'`
+ac_safe_member=`echo "ips_cantforward" | 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 $ac_n "checking for ipstat.ips_cantforward""... $ac_c" 1>&6
+echo "configure:16606: checking for ipstat.ips_cantforward" >&5
+if eval "test \"`echo '$''{'$ac_safe_all'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+if test "x" = "x"; then
+  defineit="= 0"
+elif test "x" = "xno"; then
+  defineit=""
+else
+  defineit=""
+fi
+cat > conftest.$ac_ext <<EOF
+#line 16619 "configure"
+#include "confdefs.h"
+
+
+#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
+
+
+int main() {
+
+struct ipstat testit; 
+testit.ips_cantforward $defineit;
+
+; return 0; }
+EOF
+if { (eval echo configure:16639: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  eval "${ac_safe_all}=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "${ac_safe_all}=no" 
+fi
+rm -f conftest*
+
+fi
+
+
+if eval "test \"x$`echo ${ac_safe_all}`\" = \"xyes\""; then
+  echo "$ac_t""yes" 1>&6
+  cat >> confdefs.h <<EOF
+#define $ac_uc_define 1
+EOF
+
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+
+
+
+
+ac_safe_struct=`echo "ipstat" | sed 'y%./+-%__p_%'`
+ac_safe_member=`echo "ips_cantfrag" | 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 $ac_n "checking for ipstat.ips_cantfrag""... $ac_c" 1>&6
+echo "configure:16673: checking for ipstat.ips_cantfrag" >&5
+if eval "test \"`echo '$''{'$ac_safe_all'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+if test "x" = "x"; then
+  defineit="= 0"
+elif test "x" = "xno"; then
+  defineit=""
+else
+  defineit=""
+fi
+cat > conftest.$ac_ext <<EOF
+#line 16686 "configure"
+#include "confdefs.h"
+
+
+#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
+
+
+int main() {
+
+struct ipstat testit; 
+testit.ips_cantfrag $defineit;
+
+; return 0; }
+EOF
+if { (eval echo configure:16706: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  eval "${ac_safe_all}=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "${ac_safe_all}=no" 
+fi
+rm -f conftest*
+
+fi
+
+
+if eval "test \"x$`echo ${ac_safe_all}`\" = \"xyes\""; then
+  echo "$ac_t""yes" 1>&6
+  cat >> confdefs.h <<EOF
+#define $ac_uc_define 1
+EOF
+
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+
+
+
+
+ac_safe_struct=`echo "ipstat" | sed 'y%./+-%__p_%'`
+ac_safe_member=`echo "ips_delivered" | 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 $ac_n "checking for ipstat.ips_delivered""... $ac_c" 1>&6
+echo "configure:16740: checking for ipstat.ips_delivered" >&5
+if eval "test \"`echo '$''{'$ac_safe_all'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+if test "x" = "x"; then
+  defineit="= 0"
+elif test "x" = "xno"; then
+  defineit=""
+else
+  defineit=""
+fi
+cat > conftest.$ac_ext <<EOF
+#line 16753 "configure"
+#include "confdefs.h"
+
+
+#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
+
+
+int main() {
+
+struct ipstat testit; 
+testit.ips_delivered $defineit;
+
+; return 0; }
+EOF
+if { (eval echo configure:16773: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  eval "${ac_safe_all}=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "${ac_safe_all}=no" 
+fi
+rm -f conftest*
+
+fi
+
+
+if eval "test \"x$`echo ${ac_safe_all}`\" = \"xyes\""; then
+  echo "$ac_t""yes" 1>&6
+  cat >> confdefs.h <<EOF
+#define $ac_uc_define 1
+EOF
+
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+
+
+
+
+ac_safe_struct=`echo "ipstat" | sed 'y%./+-%__p_%'`
+ac_safe_member=`echo "ips_fragdropped" | 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 $ac_n "checking for ipstat.ips_fragdropped""... $ac_c" 1>&6
+echo "configure:16807: checking for ipstat.ips_fragdropped" >&5
+if eval "test \"`echo '$''{'$ac_safe_all'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+if test "x" = "x"; then
+  defineit="= 0"
+elif test "x" = "xno"; then
+  defineit=""
+else
+  defineit=""
+fi
+cat > conftest.$ac_ext <<EOF
+#line 16820 "configure"
+#include "confdefs.h"
+
+
+#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
+
+
+int main() {
+
+struct ipstat testit; 
+testit.ips_fragdropped $defineit;
+
+; return 0; }
+EOF
+if { (eval echo configure:16840: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  eval "${ac_safe_all}=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "${ac_safe_all}=no" 
+fi
+rm -f conftest*
+
+fi
+
+
+if eval "test \"x$`echo ${ac_safe_all}`\" = \"xyes\""; then
+  echo "$ac_t""yes" 1>&6
+  cat >> confdefs.h <<EOF
+#define $ac_uc_define 1
+EOF
+
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+
+
+
+
+ac_safe_struct=`echo "ipstat" | sed 'y%./+-%__p_%'`
+ac_safe_member=`echo "ips_fragtimeout" | 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 $ac_n "checking for ipstat.ips_fragtimeout""... $ac_c" 1>&6
+echo "configure:16874: checking for ipstat.ips_fragtimeout" >&5
+if eval "test \"`echo '$''{'$ac_safe_all'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+if test "x" = "x"; then
+  defineit="= 0"
+elif test "x" = "xno"; then
+  defineit=""
+else
+  defineit=""
+fi
+cat > conftest.$ac_ext <<EOF
+#line 16887 "configure"
+#include "confdefs.h"
+
+
+#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
+
+
+int main() {
+
+struct ipstat testit; 
+testit.ips_fragtimeout $defineit;
+
+; return 0; }
+EOF
+if { (eval echo configure:16907: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  eval "${ac_safe_all}=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "${ac_safe_all}=no" 
+fi
+rm -f conftest*
+
+fi
+
+
+if eval "test \"x$`echo ${ac_safe_all}`\" = \"xyes\""; then
+  echo "$ac_t""yes" 1>&6
+  cat >> confdefs.h <<EOF
+#define $ac_uc_define 1
+EOF
+
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+
+
+
+
+ac_safe_struct=`echo "ipstat" | sed 'y%./+-%__p_%'`
+ac_safe_member=`echo "ips_localout" | 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 $ac_n "checking for ipstat.ips_localout""... $ac_c" 1>&6
+echo "configure:16941: checking for ipstat.ips_localout" >&5
+if eval "test \"`echo '$''{'$ac_safe_all'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+if test "x" = "x"; then
+  defineit="= 0"
+elif test "x" = "xno"; then
+  defineit=""
+else
+  defineit=""
+fi
+cat > conftest.$ac_ext <<EOF
+#line 16954 "configure"
+#include "confdefs.h"
+
+
+#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
+
+
+int main() {
+
+struct ipstat testit; 
+testit.ips_localout $defineit;
+
+; return 0; }
+EOF
+if { (eval echo configure:16974: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  eval "${ac_safe_all}=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "${ac_safe_all}=no" 
+fi
+rm -f conftest*
+
+fi
+
+
+if eval "test \"x$`echo ${ac_safe_all}`\" = \"xyes\""; then
+  echo "$ac_t""yes" 1>&6
+  cat >> confdefs.h <<EOF
+#define $ac_uc_define 1
+EOF
+
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+
+
+
+
+ac_safe_struct=`echo "ipstat" | sed 'y%./+-%__p_%'`
+ac_safe_member=`echo "ips_noproto" | 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 $ac_n "checking for ipstat.ips_noproto""... $ac_c" 1>&6
+echo "configure:17008: checking for ipstat.ips_noproto" >&5
+if eval "test \"`echo '$''{'$ac_safe_all'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+if test "x" = "x"; then
+  defineit="= 0"
+elif test "x" = "xno"; then
+  defineit=""
+else
+  defineit=""
+fi
+cat > conftest.$ac_ext <<EOF
+#line 17021 "configure"
+#include "confdefs.h"
+
+
+#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
+
+
+int main() {
+
+struct ipstat testit; 
+testit.ips_noproto $defineit;
+
+; return 0; }
+EOF
+if { (eval echo configure:17041: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  eval "${ac_safe_all}=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "${ac_safe_all}=no" 
+fi
+rm -f conftest*
+
+fi
+
+
+if eval "test \"x$`echo ${ac_safe_all}`\" = \"xyes\""; then
+  echo "$ac_t""yes" 1>&6
+  cat >> confdefs.h <<EOF
+#define $ac_uc_define 1
+EOF
+
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+
+
+
+
+ac_safe_struct=`echo "ipstat" | sed 'y%./+-%__p_%'`
+ac_safe_member=`echo "ips_noroute" | 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 $ac_n "checking for ipstat.ips_noroute""... $ac_c" 1>&6
+echo "configure:17075: checking for ipstat.ips_noroute" >&5
+if eval "test \"`echo '$''{'$ac_safe_all'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+if test "x" = "x"; then
+  defineit="= 0"
+elif test "x" = "xno"; then
+  defineit=""
+else
+  defineit=""
+fi
+cat > conftest.$ac_ext <<EOF
+#line 17088 "configure"
+#include "confdefs.h"
+
+
+#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
+
+
+int main() {
+
+struct ipstat testit; 
+testit.ips_noroute $defineit;
+
+; return 0; }
+EOF
+if { (eval echo configure:17108: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  eval "${ac_safe_all}=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "${ac_safe_all}=no" 
+fi
+rm -f conftest*
+
+fi
+
+
+if eval "test \"x$`echo ${ac_safe_all}`\" = \"xyes\""; then
+  echo "$ac_t""yes" 1>&6
+  cat >> confdefs.h <<EOF
+#define $ac_uc_define 1
+EOF
+
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+
+
+
+
+ac_safe_struct=`echo "ipstat" | sed 'y%./+-%__p_%'`
+ac_safe_member=`echo "ips_odropped" | 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 $ac_n "checking for ipstat.ips_odropped""... $ac_c" 1>&6
+echo "configure:17142: checking for ipstat.ips_odropped" >&5
+if eval "test \"`echo '$''{'$ac_safe_all'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+if test "x" = "x"; then
+  defineit="= 0"
+elif test "x" = "xno"; then
+  defineit=""
+else
+  defineit=""
+fi
+cat > conftest.$ac_ext <<EOF
+#line 17155 "configure"
+#include "confdefs.h"
+
+
+#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
+
+
+int main() {
+
+struct ipstat testit; 
+testit.ips_odropped $defineit;
+
+; return 0; }
+EOF
+if { (eval echo configure:17175: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  eval "${ac_safe_all}=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "${ac_safe_all}=no" 
+fi
+rm -f conftest*
+
+fi
+
+
+if eval "test \"x$`echo ${ac_safe_all}`\" = \"xyes\""; then
+  echo "$ac_t""yes" 1>&6
+  cat >> confdefs.h <<EOF
+#define $ac_uc_define 1
+EOF
+
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+
+
+
+
+ac_safe_struct=`echo "ipstat" | sed 'y%./+-%__p_%'`
+ac_safe_member=`echo "ips_ofragments" | 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 $ac_n "checking for ipstat.ips_ofragments""... $ac_c" 1>&6
+echo "configure:17209: checking for ipstat.ips_ofragments" >&5
+if eval "test \"`echo '$''{'$ac_safe_all'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+if test "x" = "x"; then
+  defineit="= 0"
+elif test "x" = "xno"; then
+  defineit=""
+else
+  defineit=""
+fi
+cat > conftest.$ac_ext <<EOF
+#line 17222 "configure"
+#include "confdefs.h"
+
+
+#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
+
+
+int main() {
+
+struct ipstat testit; 
+testit.ips_ofragments $defineit;
+
+; return 0; }
+EOF
+if { (eval echo configure:17242: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  eval "${ac_safe_all}=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "${ac_safe_all}=no" 
+fi
+rm -f conftest*
+
+fi
+
+
+if eval "test \"x$`echo ${ac_safe_all}`\" = \"xyes\""; then
+  echo "$ac_t""yes" 1>&6
+  cat >> confdefs.h <<EOF
+#define $ac_uc_define 1
+EOF
+
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+
+
+
+
+ac_safe_struct=`echo "ipstat" | sed 'y%./+-%__p_%'`
+ac_safe_member=`echo "ips_reassembled" | 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 $ac_n "checking for ipstat.ips_reassembled""... $ac_c" 1>&6
+echo "configure:17276: checking for ipstat.ips_reassembled" >&5
+if eval "test \"`echo '$''{'$ac_safe_all'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+if test "x" = "x"; then
+  defineit="= 0"
+elif test "x" = "xno"; then
+  defineit=""
+else
+  defineit=""
+fi
+cat > conftest.$ac_ext <<EOF
+#line 17289 "configure"
+#include "confdefs.h"
+
+
+#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
+
+
+int main() {
+
+struct ipstat testit; 
+testit.ips_reassembled $defineit;
+
+; return 0; }
+EOF
+if { (eval echo configure:17309: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  eval "${ac_safe_all}=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "${ac_safe_all}=no" 
+fi
+rm -f conftest*
+
+fi
+
+
+if eval "test \"x$`echo ${ac_safe_all}`\" = \"xyes\""; then
+  echo "$ac_t""yes" 1>&6
+  cat >> confdefs.h <<EOF
+#define $ac_uc_define 1
+EOF
+
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+
+
+if test "x$ac_cv_header_openssl_des_h" = "xyes" ; then
+
+
+ac_safe_struct=`echo "des_ks_struct" | sed 'y%./+-%__p_%'`
+ac_safe_member=`echo "weak_key" | 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 $ac_n "checking for des_ks_struct.weak_key""... $ac_c" 1>&6
+echo "configure:17344: checking for des_ks_struct.weak_key" >&5
+if eval "test \"`echo '$''{'$ac_safe_all'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+if test "x" = "x"; then
+  defineit="= 0"
+elif test "x" = "xno"; then
+  defineit=""
+else
+  defineit=""
+fi
+cat > conftest.$ac_ext <<EOF
+#line 17357 "configure"
+#include "confdefs.h"
+
+
+#include <openssl/des.h>
+
+
+int main() {
+
+struct des_ks_struct testit; 
+testit.weak_key $defineit;
+
+; return 0; }
+EOF
+if { (eval echo configure:17371: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  eval "${ac_safe_all}=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "${ac_safe_all}=no" 
+fi
+rm -f conftest*
+
+fi
+
+
+if eval "test \"x$`echo ${ac_safe_all}`\" = \"xyes\""; then
+  echo "$ac_t""yes" 1>&6
+  cat >> confdefs.h <<EOF
+#define $ac_uc_define 1
+EOF
+
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+
+fi
+
+
+if test $cross_compiling = yes; then
+  echo "configure: warning: Can't check sysctl, manually define CAN_USE_SYSCTL if platform support available" 1>&2
+else
+  echo $ac_n "checking if sysctl can read kernel information""... $ac_c" 1>&6
+echo "configure:17403: checking if sysctl can read kernel information" >&5
+if eval "test \"`echo '$''{'ac_cv_CAN_USE_SYSCTL'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  if test "$cross_compiling" = yes; then
+  ac_cv_CAN_USE_SYSCTL=no
+else
+  cat > conftest.$ac_ext <<EOF
+#line 17411 "configure"
+#include "confdefs.h"
+
+#if TIME_WITH_SYS_TIME
+# include <sys/time.h>
+# include <time.h>
+#else
+# if HAVE_SYS_TIME_H
+#  include <sys/time.h>
+# else
+#  include <time.h>
+# endif
+#endif
+#if HAVE_SYS_PARAM_H
+# include <sys/param.h>
+#endif
+#include <sys/types.h>
+#if HAVE_SYS_SYSCTL_H
+# include <sys/sysctl.h>
+#endif
+
+main() {
+  int                 mib[2];
+  size_t              len;
+  struct timeval boottime;
+  
+  mib[0] = CTL_KERN;
+  mib[1] = KERN_BOOTTIME;
+  
+  len = sizeof(boottime);
+  sysctl(mib, 2, &boottime, &len, NULL, NULL);
+  if (boottime.tv_sec != 0)
+    exit(0);
+  else
+    exit(1);
+}
+  
+EOF
+if { (eval echo configure:17449: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+then
+  ac_cv_CAN_USE_SYSCTL=yes
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -fr conftest*
+  ac_cv_CAN_USE_SYSCTL=no
+fi
+rm -fr conftest*
+fi
+
+fi
+
+echo "$ac_t""$ac_cv_CAN_USE_SYSCTL" 1>&6
+fi
+
+if test "x$ac_cv_CAN_USE_SYSCTL" = "xyes"; then
+  cat >> confdefs.h <<\EOF
+#define CAN_USE_SYSCTL 1
+EOF
+
+fi
+
+echo $ac_n "checking whether TCP timers depend on \`hz'""... $ac_c" 1>&6
+echo "configure:17474: checking whether TCP timers depend on \`hz'" >&5
+if eval "test \"`echo '$''{'ac_cv_TCPTV_NEEDS_HZ'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 17479 "configure"
+#include "confdefs.h"
+#include <netinet/tcp_timer.h>
+TCPTV_SRTTDFLT
+
+EOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  egrep "hz" >/dev/null 2>&1; then
+  rm -rf conftest*
+  ac_cv_TCPTV_NEEDS_HZ=yes
+else
+  rm -rf conftest*
+  ac_cv_TCPTV_NEEDS_HZ=no
+fi
+rm -f conftest*
+
+fi
+
+echo "$ac_t""$ac_cv_TCPTV_NEEDS_HZ" 1>&6
+
+if test "x$ac_cv_TCPTV_NEEDS_HZ" = "xyes"; then
+  cat >> confdefs.h <<\EOF
+#define TCPTV_NEEDS_HZ 1
+EOF
+
+fi
+
+
+
+
+
+
+if test "x$ac_cv_user_prompt_LOGFILE" = "x" -o "x$ac_cv_user_prompt_SYS_LOC" = "x" -o "x$ac_cv_user_prompt_SYS_CONTACT" = "x" -o "x$ac_cv_user_prompt_DEFAULT_SNMP_VERSION" = "x"; then
+echo $ac_n "checking if you have run configure before""... $ac_c" 1>&6
+echo "configure:17513: checking if you have run configure before" >&5
+if eval "test \"`echo '$''{'ac_cv_have_warned'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+if test "x$defaults" = "xno"; then
+cat << EOF
+
+	 ************** Configuration Section **************
+
+	You are about to be prompted with a series of questions.  Answer
+them carefully, as they determine how the SNMP agent and related
+applications are to function.
+
+	After the configure script finishes, you can browse the newly
+created config.h file for further - less important - parameters to
+modify.  Be careful if you re-run configure though, since config.h will
+be overwritten.
+
+-Press return to continue-
+EOF
+
+read tmpinput
+ac_cv_have_warned="yes"
+echo $ac_n "disabling above prompt for future runs...  $ac_c"
+else
+  ac_cv_have_warned="no"
+fi
+
+fi
+
+echo "$ac_t""$ac_cv_have_warned" 1>&6
+else
+  ac_cv_have_warned="yes"
+fi
+
+ME=`$WHOAMI`
+if test -f /etc/resolv.conf; then
+  LOC=`cat /etc/resolv.conf | grep '^domain' | tail -1 | awk '{print $NF}'`
+else
+  LOC="@no.where"
+fi
+
+
+MSG_CHECK=`echo "
+
+*** Default SNMP Version:
+
+	Starting with Net-SNMP 5.0, you can choose the default version of
+the SNMP protocol to use when no version is given explicitly on the
+command line, or via an 'snmp.conf' file.  In the past this was set to
+SNMPv1, but you can use this to switch to SNMPv3 if desired.  SNMPv3
+will provide a more secure management environment (and thus you're
+encouraged to switch to SNMPv3), but may break existing scripts that
+rely on the old behaviour.  (Though such scripts will probably need to
+be changed to use the '-c' community flag anyway, as the SNMPv1
+command line usage has changed as well.).
+   At this prompt you can select \"1\", \"2\" (for SNMPv2c), or \"3\" as
+the default version for the command tools (snmpget, ...) to use.  This
+can always be overridden at runtime using the -v flag to the tools, or
+by using the \"defVersion\" token in your snmp.conf file.
+   Providing the --with-default-snmp-version=\"x\" parameter to ./configure
+will avoid this prompt.
+
+Default version of SNMP to use" | tail -1`
+echo $ac_n "checking $MSG_CHECK""... $ac_c" 1>&6
+echo "configure:17579: checking $MSG_CHECK" >&5
+if eval "test \"`echo '$''{'ac_cv_user_prompt_DEFAULT_SNMP_VERSION'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  echo "" >&6
+
+if test "x$defaults" = "xno"; then
+echo $ac_n "
+
+*** Default SNMP Version:
+
+	Starting with Net-SNMP 5.0, you can choose the default version of
+the SNMP protocol to use when no version is given explicitly on the
+command line, or via an 'snmp.conf' file.  In the past this was set to
+SNMPv1, but you can use this to switch to SNMPv3 if desired.  SNMPv3
+will provide a more secure management environment (and thus you're
+encouraged to switch to SNMPv3), but may break existing scripts that
+rely on the old behaviour.  (Though such scripts will probably need to
+be changed to use the '-c' community flag anyway, as the SNMPv1
+command line usage has changed as well.).
+   At this prompt you can select \"1\", \"2\" (for SNMPv2c), or \"3\" as
+the default version for the command tools (snmpget, ...) to use.  This
+can always be overridden at runtime using the -v flag to the tools, or
+by using the \"defVersion\" token in your snmp.conf file.
+   Providing the --with-default-snmp-version=\"x\" parameter to ./configure
+will avoid this prompt.
+
+Default version of SNMP to use (3): $ac_c"
+read tmpinput
+if test "$tmpinput" = "" -a "3" != ""; then
+  tmpinput="3"
+fi
+eval DEFAULT_SNMP_VERSION=\"$tmpinput\"
+else
+tmpinput="3"
+eval DEFAULT_SNMP_VERSION=\"$tmpinput\"
+fi
+
+
+eval ac_cv_user_prompt_DEFAULT_SNMP_VERSION=\$DEFAULT_SNMP_VERSION
+echo $ac_n "setting $MSG_CHECK to...  $ac_c" >&6
+
+fi
+
+echo "$ac_t""$ac_cv_user_prompt_DEFAULT_SNMP_VERSION" 1>&6
+if test "$ac_cv_user_prompt_DEFAULT_SNMP_VERSION" != "none"; then
+  if test "xunquoted" = "xquoted" -o "xunquoted" = "xQUOTED"; then
+    cat >> confdefs.h <<EOF
+#define DEFAULT_SNMP_VERSION "$ac_cv_user_prompt_DEFAULT_SNMP_VERSION"
+EOF
+
+  else
+    cat >> confdefs.h <<EOF
+#define DEFAULT_SNMP_VERSION $ac_cv_user_prompt_DEFAULT_SNMP_VERSION
+EOF
+
+  fi
+fi
+
+
+if test "$ac_cv_user_prompt_DEFAULT_SNMP_VERSION" != "1" -a "$ac_cv_user_prompt_DEFAULT_SNMP_VERSION" != "2" -a "$ac_cv_user_prompt_DEFAULT_SNMP_VERSION" != "3"; then
+  { echo "configure: error: Illegal version number.  Only 1, 2 (for SNMPv2c) and 3 are supported." 1>&2; exit 1; }
+fi
+
+
+MSG_CHECK=`echo "
+
+*** System Contact Information:
+
+	Describes who should be contacted about the host the agent is
+running on.  This information is available in the MIB-II tree.  This
+can also be over-ridden using the \"syscontact\" syntax in the agent's
+configuration files.
+  Providing the --with-sys-contact=\"contact\" parameter to ./configure
+will avoid this prompt.
+
+System Contact Information" | tail -1`
+echo $ac_n "checking $MSG_CHECK""... $ac_c" 1>&6
+echo "configure:17657: checking $MSG_CHECK" >&5
+if eval "test \"`echo '$''{'ac_cv_user_prompt_SYS_CONTACT'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  echo "" >&6
+
+if test "x$defaults" = "xno"; then
+echo $ac_n "
+
+*** System Contact Information:
+
+	Describes who should be contacted about the host the agent is
+running on.  This information is available in the MIB-II tree.  This
+can also be over-ridden using the \"syscontact\" syntax in the agent's
+configuration files.
+  Providing the --with-sys-contact=\"contact\" parameter to ./configure
+will avoid this prompt.
+
+System Contact Information ($ME@$LOC): $ac_c"
+read tmpinput
+if test "$tmpinput" = "" -a "$ME@$LOC" != ""; then
+  tmpinput="$ME@$LOC"
+fi
+eval SYS_CONTACT=\"$tmpinput\"
+else
+tmpinput="$ME@$LOC"
+eval SYS_CONTACT=\"$tmpinput\"
+fi
+
+
+eval ac_cv_user_prompt_SYS_CONTACT=\$SYS_CONTACT
+echo $ac_n "setting $MSG_CHECK to...  $ac_c" >&6
+
+fi
+
+echo "$ac_t""$ac_cv_user_prompt_SYS_CONTACT" 1>&6
+if test "$ac_cv_user_prompt_SYS_CONTACT" != "none"; then
+  if test "xquoted" = "xquoted" -o "xquoted" = "xQUOTED"; then
+    cat >> confdefs.h <<EOF
+#define SYS_CONTACT "$ac_cv_user_prompt_SYS_CONTACT"
+EOF
+
+  else
+    cat >> confdefs.h <<EOF
+#define SYS_CONTACT $ac_cv_user_prompt_SYS_CONTACT
+EOF
+
+  fi
+fi
+
+
+
+MSG_CHECK=`echo "
+
+*** System Location:
+
+	Describes the location of the system.  This information is
+available in the MIB-II tree.  this can also be over-ridden using the
+\"syslocation\" syntax in the agent's configuration files.
+  Providing the --with-sys-location=\"location\" parameter to ./configure
+will avoid this prompt.
+
+System Location" | tail -1`
+echo $ac_n "checking $MSG_CHECK""... $ac_c" 1>&6
+echo "configure:17721: checking $MSG_CHECK" >&5
+if eval "test \"`echo '$''{'ac_cv_user_prompt_SYS_LOC'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  echo "" >&6
+
+if test "x$defaults" = "xno"; then
+echo $ac_n "
+
+*** System Location:
+
+	Describes the location of the system.  This information is
+available in the MIB-II tree.  this can also be over-ridden using the
+\"syslocation\" syntax in the agent's configuration files.
+  Providing the --with-sys-location=\"location\" parameter to ./configure
+will avoid this prompt.
+
+System Location (Unknown): $ac_c"
+read tmpinput
+if test "$tmpinput" = "" -a "Unknown" != ""; then
+  tmpinput="Unknown"
+fi
+eval SYS_LOC=\"$tmpinput\"
+else
+tmpinput="Unknown"
+eval SYS_LOC=\"$tmpinput\"
+fi
+
+
+eval ac_cv_user_prompt_SYS_LOC=\$SYS_LOC
+echo $ac_n "setting $MSG_CHECK to...  $ac_c" >&6
+
+fi
+
+echo "$ac_t""$ac_cv_user_prompt_SYS_LOC" 1>&6
+if test "$ac_cv_user_prompt_SYS_LOC" != "none"; then
+  if test "xquoted" = "xquoted" -o "xquoted" = "xQUOTED"; then
+    cat >> confdefs.h <<EOF
+#define SYS_LOC "$ac_cv_user_prompt_SYS_LOC"
+EOF
+
+  else
+    cat >> confdefs.h <<EOF
+#define SYS_LOC $ac_cv_user_prompt_SYS_LOC
+EOF
+
+  fi
+fi
+
+
+if test -d /var/log; then
+  defaultlog="/var/log/snmpd.log"
+else
+  defaultlog="/usr/adm/snmpd.log"
+fi
+  
+
+MSG_CHECK=`echo "
+
+*** Logfile location:
+
+	Enter the default location for the snmpd agent to dump
+information & errors to.  If not defined (enter the keyword \"none\"
+at the prompt below) the agent will use stdout and stderr instead.
+(Note: This value can be over-ridden using command line options.)
+  Providing the --with-logfile=\"path\" parameter to ./configure
+will avoid this prompt.
+
+Location to write logfile" | tail -1`
+echo $ac_n "checking $MSG_CHECK""... $ac_c" 1>&6
+echo "configure:17791: checking $MSG_CHECK" >&5
+if eval "test \"`echo '$''{'ac_cv_user_prompt_LOGFILE'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  echo "" >&6
+
+if test "x$defaults" = "xno"; then
+echo $ac_n "
+
+*** Logfile location:
+
+	Enter the default location for the snmpd agent to dump
+information & errors to.  If not defined (enter the keyword \"none\"
+at the prompt below) the agent will use stdout and stderr instead.
+(Note: This value can be over-ridden using command line options.)
+  Providing the --with-logfile=\"path\" parameter to ./configure
+will avoid this prompt.
+
+Location to write logfile ($defaultlog): $ac_c"
+read tmpinput
+if test "$tmpinput" = "" -a "$defaultlog" != ""; then
+  tmpinput="$defaultlog"
+fi
+eval LOGFILE=\"$tmpinput\"
+else
+tmpinput="$defaultlog"
+eval LOGFILE=\"$tmpinput\"
+fi
+
+
+eval ac_cv_user_prompt_LOGFILE=\$LOGFILE
+echo $ac_n "setting $MSG_CHECK to...  $ac_c" >&6
+
+fi
+
+echo "$ac_t""$ac_cv_user_prompt_LOGFILE" 1>&6
+if test "$ac_cv_user_prompt_LOGFILE" != "none"; then
+  if test "xquoted" = "xquoted" -o "xquoted" = "xQUOTED"; then
+    cat >> confdefs.h <<EOF
+#define LOGFILE "$ac_cv_user_prompt_LOGFILE"
+EOF
+
+  else
+    cat >> confdefs.h <<EOF
+#define LOGFILE $ac_cv_user_prompt_LOGFILE
+EOF
+
+  fi
+fi
+
+
+if test -d /var; then
+  defaultstore="/var/net-snmp"
+  ucddefaultstore="/var/ucd-snmp"
+else
+  defaultstore="/etc/net-snmp"
+  ucddefaultstore="/etc/ucd-snmp"
+fi
+  
+
+MSG_CHECK=`echo "
+
+*** snmpd persistent storage location:
+
+	Enter a directory for the SNMP library to store persistent
+data in the form of a configuration file.  This default location is
+different than the old default location (which was for ucd-snmp).  If
+you stay with the new path, I'll ask you in a second if you wish to
+copy your files over to the new location (once only).  If you pick
+some other path than the default, you'll have to copy them yourself.
+There is nothing wrong with picking the old path ($ucddefaultstore) if
+you'd rather.
+  Providing the --with-persistent-directory=\"path\" parameter to
+./configure will avoid this prompt.
+
+Location to write persistent information" | tail -1`
+echo $ac_n "checking $MSG_CHECK""... $ac_c" 1>&6
+echo "configure:17868: checking $MSG_CHECK" >&5
+if eval "test \"`echo '$''{'ac_cv_user_prompt_PERSISTENT_DIRECTORY'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  echo "" >&6
+
+if test "x$defaults" = "xno"; then
+echo $ac_n "
+
+*** snmpd persistent storage location:
+
+	Enter a directory for the SNMP library to store persistent
+data in the form of a configuration file.  This default location is
+different than the old default location (which was for ucd-snmp).  If
+you stay with the new path, I'll ask you in a second if you wish to
+copy your files over to the new location (once only).  If you pick
+some other path than the default, you'll have to copy them yourself.
+There is nothing wrong with picking the old path ($ucddefaultstore) if
+you'd rather.
+  Providing the --with-persistent-directory=\"path\" parameter to
+./configure will avoid this prompt.
+
+Location to write persistent information ($defaultstore): $ac_c"
+read tmpinput
+if test "$tmpinput" = "" -a "$defaultstore" != ""; then
+  tmpinput="$defaultstore"
+fi
+eval PERSISTENT_DIRECTORY=\"$tmpinput\"
+else
+tmpinput="$defaultstore"
+eval PERSISTENT_DIRECTORY=\"$tmpinput\"
+fi
+
+
+eval ac_cv_user_prompt_PERSISTENT_DIRECTORY=\$PERSISTENT_DIRECTORY
+echo $ac_n "setting $MSG_CHECK to...  $ac_c" >&6
+
+fi
+
+echo "$ac_t""$ac_cv_user_prompt_PERSISTENT_DIRECTORY" 1>&6
+if test "$ac_cv_user_prompt_PERSISTENT_DIRECTORY" != "none"; then
+  if test "xquoted" = "xquoted" -o "xquoted" = "xQUOTED"; then
+    cat >> confdefs.h <<EOF
+#define PERSISTENT_DIRECTORY "$ac_cv_user_prompt_PERSISTENT_DIRECTORY"
+EOF
+
+  else
+    cat >> confdefs.h <<EOF
+#define PERSISTENT_DIRECTORY $ac_cv_user_prompt_PERSISTENT_DIRECTORY
+EOF
+
+  fi
+fi
+
+
+PERSISTENT_DIRECTORY=$ac_cv_user_prompt_PERSISTENT_DIRECTORY
+
+UCDPERSISTENT_DIRECTORY=$ucddefaultstore
+
+
+if test $PERSISTENT_DIRECTORY = "$defaultstore" -a -d "$ucddefaultstore" -a ! -d "$defaultstore" ; then
+echo $ac_n "checking If we should copy the old persistent directory""... $ac_c" 1>&6
+echo "configure:17930: checking If we should copy the old persistent directory" >&5
+if eval "test \"`echo '$''{'ac_cv_user_prompt_COPY_PERSISTENT_FILES'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+
+if test "x$defaults" = "xno"; then
+echo $ac_n "
+
+*** Copying old ucd-snmp persistent files to net-snmp persistent directory:
+
+	Would you like to copy the older ucd-snmp persistent files
+into your new net-snmp persistent file path?  This will functionally
+save all your ucd-snmp data and let it be used within the net-snmp
+tools.  This will only be done once when you run make install.  If you
+wish to do this, enter "yes" at the prompt.
+  Providing the --with-copy-persistent-files=\"no\" (or \"yes\")
+parameters to ./configure will avoid this prompt.
+
+Copy ucd-snmp data into the net-snmp data directory ("yes"): $ac_c"
+read tmpinput
+if test "$tmpinput" = "" -a ""yes"" != ""; then
+  tmpinput=""yes""
+fi
+eval ac_cv_user_prompt_COPY_PERSISTENT_FILES=\"$tmpinput\"
+else
+tmpinput=""yes""
+eval ac_cv_user_prompt_COPY_PERSISTENT_FILES=\"$tmpinput\"
+fi
+
+
+
+fi
+
+echo "$ac_t""$ac_cv_user_prompt_COPY_PERSISTENT_FILES" 1>&6
+else
+ac_cv_user_prompt_COPY_PERSISTENT_FILES="no"
+fi
+COPY_PERSISTENT_FILES="$ac_cv_user_prompt_COPY_PERSISTENT_FILES"
+
+
+
+
+trap '' 1 2 15
+cat > confcache <<\EOF
+# This file is a shell script that caches the results of configure
+# tests run on this system so they can be shared between configure
+# scripts and configure runs.  It is not useful on other systems.
+# If it contains results you don't want to keep, you may remove or edit it.
+#
+# By default, configure uses ./config.cache as the cache file,
+# creating it if it does not exist already.  You can give configure
+# the --cache-file=FILE option to use a different cache file; that is
+# what configure does when it calls configure scripts in
+# subdirectories, so they share the cache.
+# Giving --cache-file=/dev/null disables caching, for debugging configure.
+# config.status only pays attention to the cache file if you give it the
+# --recheck option to rerun configure.
+#
+EOF
+# The following way of writing the cache mishandles newlines in values,
+# but we know of no workaround that is simple, portable, and efficient.
+# So, don't put newlines in cache variables' values.
+# Ultrix sh set writes to stderr and can't be redirected directly,
+# and sets the high bit in the cache file unless we assign to the vars.
+(set) 2>&1 |
+  case `(ac_space=' '; set | grep ac_space) 2>&1` in
+  *ac_space=\ *)
+    # `set' does not quote correctly, so add quotes (double-quote substitution
+    # turns \\\\ into \\, and sed turns \\ into \).
+    sed -n \
+      -e "s/'/'\\\\''/g" \
+      -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p"
+    ;;
+  *)
+    # `set' quotes correctly as required by POSIX, so do not add quotes.
+    sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p'
+    ;;
+  esac >> confcache
+if cmp -s $cache_file confcache; then
+  :
+else
+  if test -w $cache_file; then
+    echo "updating cache $cache_file"
+    cat confcache > $cache_file
+  else
+    echo "not updating unwritable cache $cache_file"
+  fi
+fi
+rm -f confcache
+
+trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15
+
+test "x$prefix" = xNONE && prefix=$ac_default_prefix
+# Let make expand exec_prefix.
+test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
+
+# Any assignment to VPATH causes Sun make to only execute
+# the first set of double-colon rules, so remove it if not needed.
+# If there is a colon in the path, we need to keep it.
+if test "x$srcdir" = x.; then
+  ac_vpsub='/^[ 	]*VPATH[ 	]*=[^:]*$/d'
+fi
+
+trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15
+
+DEFS=-DHAVE_CONFIG_H
+
+# Without the "./", some shells look in PATH for config.status.
+: ${CONFIG_STATUS=./config.status}
+
+echo creating $CONFIG_STATUS
+rm -f $CONFIG_STATUS
+cat > $CONFIG_STATUS <<EOF
+#! /bin/sh
+# Generated automatically by configure.
+# Run this file to recreate the current configuration.
+# This directory was configured as follows,
+# on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
+#
+# $0 $ac_configure_args
+#
+# Compiler output produced by configure, useful for debugging
+# configure, is in ./config.log if it exists.
+
+ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]"
+for ac_option
+do
+  case "\$ac_option" in
+  -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
+    echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion"
+    exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;;
+  -version | --version | --versio | --versi | --vers | --ver | --ve | --v)
+    echo "$CONFIG_STATUS generated by autoconf version 2.13"
+    exit 0 ;;
+  -help | --help | --hel | --he | --h)
+    echo "\$ac_cs_usage"; exit 0 ;;
+  *) echo "\$ac_cs_usage"; exit 1 ;;
+  esac
+done
+
+ac_given_srcdir=$srcdir
+ac_given_INSTALL="$INSTALL"
+
+trap 'rm -fr `echo "
+ Makefile:Makefile.top:Makefile.in:Makefile.rules
+ snmplib/Makefile:Makefile.top:snmplib/Makefile.in:Makefile.rules:snmplib/Makefile.depend
+ apps/Makefile:Makefile.top:apps/Makefile.in:Makefile.rules:apps/Makefile.depend
+ apps/snmpnetstat/Makefile:Makefile.top:apps/snmpnetstat/Makefile.in:Makefile.rules:apps/snmpnetstat/Makefile.depend
+ agent/Makefile:Makefile.top:agent/Makefile.in:Makefile.rules:agent/Makefile.depend
+ agent/helpers/Makefile:Makefile.top:agent/helpers/Makefile.in:Makefile.rules:agent/helpers/Makefile.depend
+ agent/mibgroup/Makefile:Makefile.top:agent/mibgroup/Makefile.in:Makefile.rules:agent/mibgroup/Makefile.depend
+ local/Makefile:Makefile.top:local/Makefile.in:Makefile.rules
+ testing/Makefile:Makefile.top:testing/Makefile.in
+ man/Makefile:Makefile.top:man/Makefile.in:Makefile.rules
+ mibs/Makefile:Makefile.top:mibs/Makefile.in:Makefile.rules
+ net-snmp-config:net-snmp-config.in
+ include/net-snmp/net-snmp-config.h" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15
+EOF
+cat >> $CONFIG_STATUS <<EOF
+
+# Protect against being on the right side of a sed subst in config.status.
+sed 's/%@/@@/; s/@%/@@/; s/%g\$/@g/; /@g\$/s/[\\\\&%]/\\\\&/g;
+ s/@@/%@/; s/@@/@%/; s/@g\$/%g/' > conftest.subs <<\\CEOF
+$ac_vpsub
+$extrasub
+s%@SHELL@%$SHELL%g
+s%@CFLAGS@%$CFLAGS%g
+s%@CPPFLAGS@%$CPPFLAGS%g
+s%@CXXFLAGS@%$CXXFLAGS%g
+s%@FFLAGS@%$FFLAGS%g
+s%@DEFS@%$DEFS%g
+s%@LDFLAGS@%$LDFLAGS%g
+s%@LIBS@%$LIBS%g
+s%@exec_prefix@%$exec_prefix%g
+s%@prefix@%$prefix%g
+s%@program_transform_name@%$program_transform_name%g
+s%@bindir@%$bindir%g
+s%@sbindir@%$sbindir%g
+s%@libexecdir@%$libexecdir%g
+s%@datadir@%$datadir%g
+s%@sysconfdir@%$sysconfdir%g
+s%@sharedstatedir@%$sharedstatedir%g
+s%@localstatedir@%$localstatedir%g
+s%@libdir@%$libdir%g
+s%@includedir@%$includedir%g
+s%@oldincludedir@%$oldincludedir%g
+s%@infodir@%$infodir%g
+s%@mandir@%$mandir%g
+s%@CONFIGURE_OPTIONS@%$CONFIGURE_OPTIONS%g
+s%@LIBTOOLFLAGS@%$LIBTOOLFLAGS%g
+s%@HAVE_DMALLOC_H@%$HAVE_DMALLOC_H%g
+s%@WRAPLIBS@%$WRAPLIBS%g
+s%@installucdheaders@%$installucdheaders%g
+s%@installucdlibs@%$installucdlibs%g
+s%@CC@%$CC%g
+s%@CPP@%$CPP%g
+s%@EXEEXT@%$EXEEXT%g
+s%@host@%$host%g
+s%@host_alias@%$host_alias%g
+s%@host_cpu@%$host_cpu%g
+s%@host_vendor@%$host_vendor%g
+s%@host_os@%$host_os%g
+s%@build@%$build%g
+s%@build_alias@%$build_alias%g
+s%@build_cpu@%$build_cpu%g
+s%@build_vendor@%$build_vendor%g
+s%@build_os@%$build_os%g
+s%@LN_S@%$LN_S%g
+s%@OBJEXT@%$OBJEXT%g
+s%@ECHO@%$ECHO%g
+s%@RANLIB@%$RANLIB%g
+s%@STRIP@%$STRIP%g
+s%@DLLTOOL@%$DLLTOOL%g
+s%@AS@%$AS%g
+s%@OBJDUMP@%$OBJDUMP%g
+s%@LIBTOOL@%$LIBTOOL%g
+s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g
+s%@INSTALL_SCRIPT@%$INSTALL_SCRIPT%g
+s%@INSTALL_DATA@%$INSTALL_DATA%g
+s%@SET_MAKE@%$SET_MAKE%g
+s%@PSPROG@%$PSPROG%g
+s%@PERLPROG@%$PERLPROG%g
+s%@WHOAMI@%$WHOAMI%g
+s%@SED@%$SED%g
+s%@AUTOCONF@%$AUTOCONF%g
+s%@AUTOHEADER@%$AUTOHEADER%g
+s%@UNAMEPROG@%$UNAMEPROG%g
+s%@VERSION@%$VERSION%g
+s%@RELEASEVERSION@%$RELEASEVERSION%g
+s%@DEVFLAGS@%$DEVFLAGS%g
+s%@target@%$target%g
+s%@target_alias@%$target_alias%g
+s%@target_cpu@%$target_cpu%g
+s%@target_vendor@%$target_vendor%g
+s%@target_os@%$target_os%g
+s%@CCPATH@%$CCPATH%g
+s%@EXTRACPPFLAGS@%$EXTRACPPFLAGS%g
+s%@SNMPCONFPATH@%$SNMPCONFPATH%g
+s%@transport_hdr_list@%$transport_hdr_list%g
+s%@transport_src_list@%$transport_src_list%g
+s%@transport_obj_list@%$transport_obj_list%g
+s%@transport_lobj_list@%$transport_lobj_list%g
+s%@security_src_list@%$security_src_list%g
+s%@security_obj_list@%$security_obj_list%g
+s%@security_lobj_list@%$security_lobj_list%g
+s%@security_hdr_list@%$security_hdr_list%g
+s%@MODULE_LIST@%$MODULE_LIST%g
+s%@module_list_c@%$module_list_c%g
+s%@module_list_h@%$module_list_h%g
+s%@module_list_o@%$module_list_o%g
+s%@module_list_lo@%$module_list_lo%g
+s%@mibgroup_list_o@%$mibgroup_list_o%g
+s%@mibgroup_list_lo@%$mibgroup_list_lo%g
+s%@module_list@%$module_list%g
+s%@default_mibs_install@%$default_mibs_install%g
+s%@PERLTARGS@%$PERLTARGS%g
+s%@PERLINSTALLTARGS@%$PERLINSTALLTARGS%g
+s%@PERLARGS@%$PERLARGS%g
+s%@EMBEDPERLINSTALL@%$EMBEDPERLINSTALL%g
+s%@LPSTAT_PATH@%$LPSTAT_PATH%g
+s%@PSCMD@%$PSCMD%g
+s%@ALLOCA@%$ALLOCA%g
+s%@LIBOBJS@%$LIBOBJS%g
+s%@AGENTLIBS@%$AGENTLIBS%g
+s%@OTHERAGENTLIBOBJS@%$OTHERAGENTLIBOBJS%g
+s%@OTHERAGENTLIBLOBJS@%$OTHERAGENTLIBLOBJS%g
+s%@PERSISTENT_DIRECTORY@%$PERSISTENT_DIRECTORY%g
+s%@UCDPERSISTENT_DIRECTORY@%$UCDPERSISTENT_DIRECTORY%g
+s%@COPY_PERSISTENT_FILES@%$COPY_PERSISTENT_FILES%g
+s%@DLLIBS@%$DLLIBS%g
+
+CEOF
+EOF
+
+cat >> $CONFIG_STATUS <<\EOF
+
+# Split the substitutions into bite-sized pieces for seds with
+# small command number limits, like on Digital OSF/1 and HP-UX.
+ac_max_sed_cmds=90 # Maximum number of lines to put in a sed script.
+ac_file=1 # Number of current file.
+ac_beg=1 # First line for current file.
+ac_end=$ac_max_sed_cmds # Line after last line for current file.
+ac_more_lines=:
+ac_sed_cmds=""
+while $ac_more_lines; do
+  if test $ac_beg -gt 1; then
+    sed "1,${ac_beg}d; ${ac_end}q" conftest.subs > conftest.s$ac_file
+  else
+    sed "${ac_end}q" conftest.subs > conftest.s$ac_file
+  fi
+  if test ! -s conftest.s$ac_file; then
+    ac_more_lines=false
+    rm -f conftest.s$ac_file
+  else
+    if test -z "$ac_sed_cmds"; then
+      ac_sed_cmds="sed -f conftest.s$ac_file"
+    else
+      ac_sed_cmds="$ac_sed_cmds | sed -f conftest.s$ac_file"
+    fi
+    ac_file=`expr $ac_file + 1`
+    ac_beg=$ac_end
+    ac_end=`expr $ac_end + $ac_max_sed_cmds`
+  fi
+done
+if test -z "$ac_sed_cmds"; then
+  ac_sed_cmds=cat
+fi
+EOF
+
+cat >> $CONFIG_STATUS <<EOF
+
+CONFIG_FILES=\${CONFIG_FILES-"Makefile:Makefile.top:Makefile.in:Makefile.rules
+ snmplib/Makefile:Makefile.top:snmplib/Makefile.in:Makefile.rules:snmplib/Makefile.depend
+ apps/Makefile:Makefile.top:apps/Makefile.in:Makefile.rules:apps/Makefile.depend
+ apps/snmpnetstat/Makefile:Makefile.top:apps/snmpnetstat/Makefile.in:Makefile.rules:apps/snmpnetstat/Makefile.depend
+ agent/Makefile:Makefile.top:agent/Makefile.in:Makefile.rules:agent/Makefile.depend
+ agent/helpers/Makefile:Makefile.top:agent/helpers/Makefile.in:Makefile.rules:agent/helpers/Makefile.depend
+ agent/mibgroup/Makefile:Makefile.top:agent/mibgroup/Makefile.in:Makefile.rules:agent/mibgroup/Makefile.depend
+ local/Makefile:Makefile.top:local/Makefile.in:Makefile.rules
+ testing/Makefile:Makefile.top:testing/Makefile.in
+ man/Makefile:Makefile.top:man/Makefile.in:Makefile.rules
+ mibs/Makefile:Makefile.top:mibs/Makefile.in:Makefile.rules
+ net-snmp-config:net-snmp-config.in
+"}
+EOF
+cat >> $CONFIG_STATUS <<\EOF
+for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then
+  # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
+  case "$ac_file" in
+  *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'`
+       ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
+  *) ac_file_in="${ac_file}.in" ;;
+  esac
+
+  # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories.
+
+  # Remove last slash and all that follows it.  Not all systems have dirname.
+  ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'`
+  if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then
+    # The file is in a subdirectory.
+    test ! -d "$ac_dir" && mkdir "$ac_dir"
+    ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`"
+    # A "../" for each directory in $ac_dir_suffix.
+    ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'`
+  else
+    ac_dir_suffix= ac_dots=
+  fi
+
+  case "$ac_given_srcdir" in
+  .)  srcdir=.
+      if test -z "$ac_dots"; then top_srcdir=.
+      else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;;
+  /*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;;
+  *) # Relative path.
+    srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix"
+    top_srcdir="$ac_dots$ac_given_srcdir" ;;
+  esac
+
+  case "$ac_given_INSTALL" in
+  [/$]*) INSTALL="$ac_given_INSTALL" ;;
+  *) INSTALL="$ac_dots$ac_given_INSTALL" ;;
+  esac
+
+  echo creating "$ac_file"
+  rm -f "$ac_file"
+  configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure."
+  case "$ac_file" in
+  *Makefile*) ac_comsub="1i\\
+# $configure_input" ;;
+  *) ac_comsub= ;;
+  esac
+
+  ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"`
+  sed -e "$ac_comsub
+s%@configure_input@%$configure_input%g
+s%@srcdir@%$srcdir%g
+s%@top_srcdir@%$top_srcdir%g
+s%@INSTALL@%$INSTALL%g
+" $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file
+fi; done
+rm -f conftest.s*
+
+# These sed commands are passed to sed as "A NAME B NAME C VALUE D", where
+# NAME is the cpp macro being defined and VALUE is the value it is being given.
+#
+# ac_d sets the value in "#define NAME VALUE" lines.
+ac_dA='s%^\([ 	]*\)#\([ 	]*define[ 	][ 	]*\)'
+ac_dB='\([ 	][ 	]*\)[^ 	]*%\1#\2'
+ac_dC='\3'
+ac_dD='%g'
+# ac_u turns "#undef NAME" with trailing blanks into "#define NAME VALUE".
+ac_uA='s%^\([ 	]*\)#\([ 	]*\)undef\([ 	][ 	]*\)'
+ac_uB='\([ 	]\)%\1#\2define\3'
+ac_uC=' '
+ac_uD='\4%g'
+# ac_e turns "#undef NAME" without trailing blanks into "#define NAME VALUE".
+ac_eA='s%^\([ 	]*\)#\([ 	]*\)undef\([ 	][ 	]*\)'
+ac_eB='$%\1#\2define\3'
+ac_eC=' '
+ac_eD='%g'
+
+if test "${CONFIG_HEADERS+set}" != set; then
+EOF
+cat >> $CONFIG_STATUS <<EOF
+  CONFIG_HEADERS="include/net-snmp/net-snmp-config.h"
+EOF
+cat >> $CONFIG_STATUS <<\EOF
+fi
+for ac_file in .. $CONFIG_HEADERS; do if test "x$ac_file" != x..; then
+  # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
+  case "$ac_file" in
+  *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'`
+       ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
+  *) ac_file_in="${ac_file}.in" ;;
+  esac
+
+  echo creating $ac_file
+
+  rm -f conftest.frag conftest.in conftest.out
+  ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"`
+  cat $ac_file_inputs > conftest.in
+
+EOF
+
+# Transform confdefs.h into a sed script conftest.vals that substitutes
+# the proper values into config.h.in to produce config.h.  And first:
+# Protect against being on the right side of a sed subst in config.status.
+# Protect against being in an unquoted here document in config.status.
+rm -f conftest.vals
+cat > conftest.hdr <<\EOF
+s/[\\&%]/\\&/g
+s%[\\$`]%\\&%g
+s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD}%gp
+s%ac_d%ac_u%gp
+s%ac_u%ac_e%gp
+EOF
+sed -n -f conftest.hdr confdefs.h > conftest.vals
+rm -f conftest.hdr
+
+# This sed command replaces #undef with comments.  This is necessary, for
+# example, in the case of _POSIX_SOURCE, which is predefined and required
+# on some systems where configure will not decide to define it.
+cat >> conftest.vals <<\EOF
+s%^[ 	]*#[ 	]*undef[ 	][ 	]*[a-zA-Z_][a-zA-Z_0-9]*%/* & */%
+EOF
+
+# Break up conftest.vals because some shells have a limit on
+# the size of here documents, and old seds have small limits too.
+
+rm -f conftest.tail
+while :
+do
+  ac_lines=`grep -c . conftest.vals`
+  # grep -c gives empty output for an empty file on some AIX systems.
+  if test -z "$ac_lines" || test "$ac_lines" -eq 0; then break; fi
+  # Write a limited-size here document to conftest.frag.
+  echo '  cat > conftest.frag <<CEOF' >> $CONFIG_STATUS
+  sed ${ac_max_here_lines}q conftest.vals >> $CONFIG_STATUS
+  echo 'CEOF
+  sed -f conftest.frag conftest.in > conftest.out
+  rm -f conftest.in
+  mv conftest.out conftest.in
+' >> $CONFIG_STATUS
+  sed 1,${ac_max_here_lines}d conftest.vals > conftest.tail
+  rm -f conftest.vals
+  mv conftest.tail conftest.vals
+done
+rm -f conftest.vals
+
+cat >> $CONFIG_STATUS <<\EOF
+  rm -f conftest.frag conftest.h
+  echo "/* $ac_file.  Generated automatically by configure.  */" > conftest.h
+  cat conftest.in >> conftest.h
+  rm -f conftest.in
+  if cmp -s $ac_file conftest.h 2>/dev/null; then
+    echo "$ac_file is unchanged"
+    rm -f conftest.h
+  else
+    # Remove last slash and all that follows it.  Not all systems have dirname.
+      ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'`
+      if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then
+      # The file is in a subdirectory.
+      test ! -d "$ac_dir" && mkdir "$ac_dir"
+    fi
+    rm -f $ac_file
+    mv conftest.h $ac_file
+  fi
+fi; done
+
+EOF
+cat >> $CONFIG_STATUS <<EOF
+
+EOF
+cat >> $CONFIG_STATUS <<\EOF
+
+ echo timestamp > stamp-h
+ chmod 755 net-snmp-config
+
+exit 0
+EOF
+chmod +x $CONFIG_STATUS
+rm -fr confdefs* $ac_clean_files
+test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1
+
+
+
+  echo ""
+  echo "---------------------------------------------------------"
+  echo "            Net-SNMP configuration summary:"
+  echo "---------------------------------------------------------"
+  echo ""
+  cat configure-summary
+  echo ""
+  echo "---------------------------------------------------------"
+  echo ""
+
+
diff -Naur tomato/release/src/router/snmp/configure.in tomato121/release/src/router/snmp/configure.in
--- tomato/release/src/router/snmp/configure.in	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/configure.in	2008-04-22 00:18:37.000000000 +1000
@@ -0,0 +1,2699 @@
+dnl Portions of this file are subject to the following copyright.  See
+dnl the Net-SNMP's COPYING file for more details and other copyrights
+dnl that may apply:
+dnl
+dnl Copyright © 2003 Sun Microsystems, Inc. All rights reserved.
+dnl Use is subject to license terms specified in the COPYING file
+dnl distributed with the Net-SNMP package.
+dnl
+
+dnl
+dnl Process this file with autoconf to produce a configure script.
+dnl
+AC_INIT(agent/mibgroup/ucd-snmp/extensible.c)
+AC_CONFIG_HEADER(include/net-snmp/net-snmp-config.h)
+AC_MSG_CACHE_INIT()
+
+dnl
+dnl save the configure arguments
+dnl
+AC_DEFINE_UNQUOTED(CONFIGURE_OPTIONS,"\"$ac_configure_args\"")
+CONFIGURE_OPTIONS="\"$ac_configure_args\""
+AC_SUBST(CONFIGURE_OPTIONS)
+
+dnl
+dnl Compilation setup
+dnl
+AC_ARG_WITH(cc, [
+Compiler Options:
+  --with-cc=CC                    use CC to compile (default=gcc).],
+    [CC=$with_cc;export CC])
+
+AC_ARG_WITH(ar,
+[  --with-ar=AR                    use AR as the archiver.],
+    [AR=$with_ar; export AR])
+
+AC_ARG_WITH(endianness,
+[  --with-endianness=big|little    define endianness of target platform when
+                                  cross-compiling.],
+    [if test $with_endianness != "big" -a $with_endianness != "little" ; then
+       AC_MSG_ERROR([Endianness must be big or little, not \"$with_endianness\".]);
+     fi
+])
+
+AC_ARG_WITH(cflags,
+[  --with-cflags=CFLAGS            use CFLAGS as compile time arguments.],
+    [CFLAGS=$with_cflags; export CFLAGS])
+
+AC_ARG_WITH(ldflags,
+[  --with-ldflags=LDFLAGS          use LDFLAGS as link time arguments to ld.],
+    [LDFLAGS=$with_ldflags; export LDFLAGS])
+
+AC_ARG_WITH(libs,
+[  --with-libs=LIBS                use LIBS as link time arguments to ld.],
+    [LIBS=$with_libs; export LIBS])
+
+AC_ARG_ENABLE(silent-libtool,
+[  --enable-silent-libtool         Pass --silent to libtool.],
+	LIBTOOLFLAGS=--silent)
+AC_SUBST(LIBTOOLFLAGS)
+
+AC_ARG_ENABLE(mini_agent,
+[  --enable-mini-agent             Build a minimal agent.],
+    mini_agent="yes",mini_agent="no")
+
+AC_ARG_ENABLE(ipv6,
+[  --enable-ipv6                   Generate IPv6 ready version.],
+    [if test "x$enable_ipv6" = "xyes"; then
+      AC_DEFINE(INET6)
+    fi])
+
+AC_ARG_ENABLE(debugging,
+[  --enable-debugging              Outputs extra debugging information at all
+                                  times.  Normally, you should not enable this,
+                                  but instead use the -D flag of the commands,
+                                  which toggles debbuging output at runtime.
+  --disable-debugging             Disallows debugging code to be built in.
+                                  This might provide some speed benefits.],
+    AC_DEFINE(SNMP_ALWAYS_DEBUG))
+
+AC_ARG_ENABLE(developer,
+[  --enable-developer              Turns on super-duper-extra-compile-warnings
+                                  when using gcc.],
+    developer=yes)
+
+if test "x$enable_debugging" = "xno"; then
+    AC_DEFINE(SNMP_NO_DEBUGGING)
+fi
+
+AC_ARG_WITH(dmalloc,
+[  --with-dmalloc=PATH             Use dmalloc library (www.dmalloc.com)],
+    if test "x$withval" = "xyes"; then
+      LIBS="$LIBS -ldmalloc"
+      AC_DEFINE(HAVE_DMALLOC_H)
+    elif test -d "$withval"; then
+      AC_ADD_SEARCH_PATH($withval)
+      LIBS="$LIBS -ldmalloc"
+      AC_DEFINE(HAVE_DMALLOC_H)
+    fi
+)
+AC_SUBST(HAVE_DMALLOC_H)
+
+AC_ARG_WITH(efence,
+[  --with-efence                   Look for and use libefence (malloc).],
+      use_efence="$withval")
+
+tryrsaref=no
+AC_ARG_WITH(rsaref,
+[  --with-rsaref=PATH              Look for librsaref in PATH/lib.],
+    if test "x$withval" = "xyes"; then
+      tryrsaref=yes
+    elif test "x$withval" = "xno"; then
+      tryrsaref=no
+    elif test -d "$withval"; then
+      AC_ADD_SEARCH_PATH($withval)
+      tryrsaref=yes
+    fi,
+)
+
+tryopenssl=defaultyes
+askedopenssl=no
+AC_ARG_WITH(openssl,
+[  --with-openssl=PATH             Look for openssl in PATH/lib.],
+    if test "x$withval" = "xyes"; then
+      tryopenssl=yes
+      askedopenssl=yes
+    elif test "x$withval" = "xno"; then
+      tryopenssl=no
+    elif test -d "$withval"; then
+      AC_ADD_SEARCH_PATH($withval)
+      tryopenssl=yes
+      askedopenssl=yes
+    fi,
+)
+if test "x$tryopenssl" = "xdefaultyes"; then
+      AC_ADD_SEARCH_PATH(/usr/local/ssl)
+      tryopenssl=yes
+fi
+
+
+AC_ARG_ENABLE(privacy,
+[  --disable-privacy               Don't compile in support for privacy.])
+if test "x$enable_privacy" != "xno"; then
+  AC_DEFINE(SCAPI_AUTHPRIV)
+fi
+
+AC_ARG_ENABLE(internal-md5,
+[  --enable-internal-md5           Use the internal MD5 support.],
+AC_DEFINE(USE_INTERNAL_MD5))
+
+
+AC_ARG_WITH(opaque-special-types,
+[  --without-opaque-special-types  Don't use special opaque encodings.
+                                  SNMP normally cannot handle
+                                  floating numbers, nor large 64 bit
+                                  integers well.  By default, the
+                                  net-snmp package compiles in
+                                  support for these extra datatypes
+                                  (in a legal way)])
+
+AC_ARG_WITH(mibdirs,
+[  --with-mibdirs=\"dir1:dir2:\"     Default directories to look for mibs.
+                                    (Default: \$HOME/.snmp/mibs:DATADIR/snmp/mibs)],
+    [DEFAULT_MIBDIRS="$with_mibdirs"
+    AC_DEFINE_UNQUOTED(DEFAULT_MIBDIRS,"$with_mibdirs")])
+
+AC_ARG_WITH(mibs,
+[  --with-mibs=\"item1:item2:\"      Default mib IDs to read.
+                                    (The default list is \"IP-MIB:IF-MIB:
+                                    TCP-MIB:UDP-MIB:SNMPv2-MIB:RFC1213-MIB\"
+                                    with the addition of any mibs used
+                                    by the mib modules the agent is
+                                    configured with)],
+    DEFAULT_MIBS="$with_mibs")
+
+AC_ARG_WITH(mibfiles,
+[  --with-mibfiles=\"file1:file2\"   Default mib files to load.
+                                    (Default:  none.  uses IDs above instead.)],
+    AC_DEFINE_UNQUOTED(DEFAULT_MIBFILES,"$with_mibfiles"))
+
+
+AC_ARG_ENABLE(testing-code,
+[  --enable-testing-code           Enables some code sections that should 
+                                  only be used for testing of certain
+                                  SNMP functionalities.  This should *not* 
+                                  be turned on for production use.  Ever.],
+    AC_DEFINE(SNMP_TESTING_CODE))
+
+AC_ARG_ENABLE(reentrant,
+[  --enable-reentrant              Enables locking functions that protect
+                                  library resources in some multi-threading
+                                  environments.  This does not guarantee
+                                  thread-safe operation.
+                                  Currently an experimental setting.],
+    with_res_locks="yes",with_res_locks="no")
+
+AC_ARG_WITH(root-access,
+[
+Configuring the agent:
+  --without-root-access           The snmpd agent won't require root access to
+                                  run it.  The information it returns in the
+                                  mib-II tree may not be correct, however.])
+
+AC_ARG_WITH(kmem-usage,
+[
+Configuring the agent:
+  --without-kmem-usage            Do not include any code related to the use
+                                  of kmem. This option can only be used with
+                                  the option --enable-mini-agent.])
+
+AC_ARG_WITH(dummy-values,
+[  --with-dummy-values             Provide 'placeholder' dummy values where
+                                  the necessary information is not available.
+                                  This is technically not compliant with the
+                                  SNMP specifications, but was how the agent
+                                  operated for versions < 4.0.])
+
+AC_ARG_WITH(persistent-directory,
+[  --with-persistent-directory=\"directory\"
+                                  Default directory for persistent data storage.],ac_cv_user_prompt_PERSISTENT_DIRECTORY="$with_persistent_directory")
+
+AC_ARG_WITH(copy_persistent_files,
+[  --with-copy-persistent-files=\"no\" Don't copy persistent files
+                                       (or use \"yes\" to copy them).
+                                       (Default: yes)],
+    ac_cv_user_prompt_COPY_PERSISTENT_FILES="$with_copy_persistent_files")
+
+AC_ARG_WITH(default-snmp-version,
+[  --with-default-snmp-version=\"3\" Default version of SNMP to use.
+                                  (Default: 3)
+                                  Legal values: 1, 2 (for SNMPv2c) or 3.],
+    ac_cv_user_prompt_DEFAULT_SNMP_VERSION="$with_default_snmp_version")
+
+dnl we test this now and later as well.  we test it now so configure can die
+dnl early on with an error rather than waiting till the end of the script.
+if test "x$ac_cv_user_prompt_DEFAULT_SNMP_VERSION" != "x"; then
+  if test "$ac_cv_user_prompt_DEFAULT_SNMP_VERSION" != "1" -a "$ac_cv_user_prompt_DEFAULT_SNMP_VERSION" != "2" -a "$ac_cv_user_prompt_DEFAULT_SNMP_VERSION" != "3"; then
+    AC_MSG_ERROR(Illegal version number passed to --with-default-snmp-version)
+  fi
+fi
+
+AC_ARG_WITH(sys_contact,
+[  --with-sys-contact=\"who@where\"  Default system contact.
+                                    (Default: LOGIN@DOMAINNAME)],
+    ac_cv_user_prompt_SYS_CONTACT="$with_sys_contact")
+
+AC_ARG_WITH(sys_location,
+[  --with-sys-location=\"location\"  Default system location.
+                                    (Default: Unknown)],
+    ac_cv_user_prompt_SYS_LOC="$with_sys_location")
+
+AC_ARG_WITH(logfile,
+[  --with-logfile=\"location\"       Default log file location for snmpd.],
+    ac_cv_user_prompt_LOGFILE="$with_logfile")
+
+dnl This can't be within AC_ARG_WITH.  I don't want to read autoconf m4
+dnl to find out why.
+AC_SUBST(WRAPLIBS)
+
+AC_ARG_WITH(transports,
+[  --with-transports=\"t1 t2 ...\"   Compile in the given SNMP transport
+                                    modules (space separated list).])
+AC_ARG_WITH(out_transports,
+[  --with-out-transports=\"t1 ...\"  Exclude listed SNMP transports
+                                    (space separated list).
+
+  Available SNMP transport modules are:
+
+    UDP         support for SNMP over UDP/IP.
+                This transport is always compiled in.
+    UDPIPv6     support for SNMP over UDP/IPv6.
+                This transport is available for Linux, Solaris and
+                FreeBSD.
+                It is never compiled in by default.
+    TCPIPv6     support for SNMP over UDP/IPv6.
+                This transport is available for Linux, Solaris and
+                FreeBSD.
+                It is never compiled in by default.
+    TCP         support for SNMP over TCP/IP.
+                This transport is compiled in by default, but may be omitted.
+    Unix        support for SNMP over Unix domain protocols.
+                This transport is compiled in by default except on Win32
+                platforms, and may be omitted.
+    Callback    support for SNMP over an internal locally connected pair
+                of snmp_sessions.
+    AAL5PVC     support for SNMP over AAL5 PVCs.
+                This transport is presently only available for Linux,
+                is never compiled in by default and may be omitted.
+    IPX         support for SNMP over IPX per RFC 1420.
+                This transport is presently only available for Linux,
+                is never compiled in by default and may be omitted.
+])
+
+dnl
+dnl Catch common mistakes in transport options
+dnl
+AC_ARG_WITH(transport,,    AC_MSG_ERROR([ Invalid option. Use --with-transports instead ])     )
+AC_ARG_WITH(out_transport,,AC_MSG_ERROR([ Invalid option. Use --with-out-transports instead ]) )
+
+dnl
+dnl security modules
+dnl
+
+AC_ARG_WITH(security-modules,
+[  --with-security-modules=\"s1 s2 ...\"   Compile in the given SNMP security
+                                    module services (space separated list).
+
+  Available SNMP security services:
+
+        usm                support for user based SNMP security
+                           (required and always compiled in)
+        ksm                support for kerberos based SNMP security
+])
+
+dnl
+dnl mib modules
+dnl
+
+AC_ARG_WITH(mib_modules,
+[  --with-mib-modules=\"item1 ...\"  Compile with additional mib modules
+                                    (Space separated list).])
+
+AC_ARG_WITH(out_mib_modules,
+[  --with-out-mib-modules=\"list\"   Compile without these mib modules.
+
+  Default mib modules compiled into the agent (which can be removed):
+  
+    mibII                  support for the mib-II tree.
+    snmpv3mibs             support for the snmpv3 mib modules.
+    ucd_snmp               UCD-SNMP-MIB specific extensions.
+    agent_mibs             NET-SNMP-AGENT-MIB extensions
+    agentx                 (see below)
+    notification           mibs supporting specification of trap destinations.
+    target                 Support for the SNMP WGs TARGET-MIB.
+    utilities              general agent configuration utilities.
+
+  Optional mib modules that can be built into the agent include:
+    host                   host resources mib support.
+                             (beta level code for linux, hpux, solaris, bsdi)
+    disman/event-mib       support for the DISMAN-EVENT-MIB (beta)
+                             (supports self monitoring and notification 
+                              delivery when error conditions are found)
+    smux                   smux support to allow subagents to attach to snmpd.
+    mibII/mta_sendmail     Sendmail statistics monitoring (MTA-MIB)
+    misc/ipfwacc           accounting rules IP firewall information (linux).
+    ipfwchains/ipfwchains  firewall chains under ipfw for linux.
+                           (Download separately from the ucd-snmp ftp site.)
+    ucd-snmp/diskio        Table of io-devices and how much data they have
+                           read/written.  (only tested on Solaris)
+    tunnel                 Linux TUNNEL-MIB support (ifTable extension)
+
+  AgentX support:  (warning: beta code)
+    agentx/subagent        allows the agent to run as either a snmp agent
+                           or as an agentX sub-agent.
+    agentx/master          makes the agent run as an agentX master agent
+                           as well as a normal snmp agent.
+    agentx                 includes both agentx/master and agentx/client.
+
+  Optional modules for C coders to look at and/or include as extension examples:
+  
+    examples/ucdDemoPublic  SNMPv3 interoperability testing mib.
+    examples/example        example C code extension.])
+
+
+dnl
+AC_ARG_WITH(enterprise-oid,
+[Enterprise OIDs:  (warning: this should be used with caution.)
+
+  --with-enterprise-oid              The enterprise number assigned to the
+                                     vendor by IANA.  See
+                                     http://www.iana.org/cgi-bin/enterprise.pl
+                                     to get one, though using the default is
+                                     probably the right choice is most cases.
+                                     (default 8072 = "enterprise.net-snmp")],[
+  if test "$withval" = yes; then
+    AC_MSG_ERROR([ Please provide a value for the enterprise number ]);
+  fi
+  AC_DEFINE_UNQUOTED(ENTERPRISE_OID, $withval)
+  ent_oid="1,3,6,1,4,1,$withval"
+  AC_DEFINE_UNQUOTED(ENTERPRISE_MIB, $ent_oid)
+  ent_dot_oid="1.3.6.1.4.1.$withval"
+  AC_DEFINE_UNQUOTED(ENTERPRISE_DOT_MIB, $ent_dot_oid)
+  AC_MSG_RESULT(using enterprise number $withval)
+],[
+  AC_MSG_RESULT(using default "enterprise.net-snmp")
+])
+
+AC_ARG_WITH(enterprise-sysoid,
+[
+  --with-enterprise-sysoid           The base OID for the sysObjectID
+                                     of the system group
+                                     (default .1.3.6.1.4.1.8072.3.2... = 
+                                      "netSnmpAgentOIDs...")],[
+  if test "$withval" = yes; then
+    AC_MSG_ERROR([ Please provide a base OID value ]);
+  fi
+  sys_oid=`echo "$withval" | sed 's/^\.//' | sed 's/\./\,/g'`
+  AC_DEFINE_UNQUOTED(SYSTEM_MIB, $sys_oid)
+  sys_dot_oid=`echo "$withval" | sed 's/^\.//'`
+  AC_DEFINE_UNQUOTED(SYSTEM_DOT_MIB, $sys_dot_oid)
+  sysoid_len=`echo "$withval" | sed 's/[^\.]//g' | awk -F\. '{ print NF }'`
+  AC_DEFINE_UNQUOTED(SYSTEM_DOT_MIB_LENGTH, $sysoid_len)
+  AC_MSG_RESULT(using enterprise sysOID $withval ....)
+],[
+  AC_MSG_RESULT(using default enterprise sysOID "NET-SNMP-MIB::netSnmpAgentOIDs...")
+])
+
+AC_ARG_WITH(enterprise-notification-oid,
+[
+  --with-enterprise-notification-oid The OID used for the root of
+				     enterprise specific notifications.
+                                     (default .1.3.6.1.4.1.2021 = "enterprise.ucdavis")],[
+  if test "$withval" = yes; then
+    AC_MSG_ERROR([ Please provide a base OID value ]);
+  fi
+  notification_oid=`echo "$withval" | sed 's/^\.//' | sed 's/\./\,/g'`
+  AC_DEFINE_UNQUOTED(NOTIFICATION_MIB, $notification_oid)
+  notification_dot_oid=`echo "$withval" | sed 's/^\.//'`
+  AC_DEFINE_UNQUOTED(NOTIFICATION_DOT_MIB, $notification_dot_oid)
+  notificationoid_len=`echo "$withval" | sed 's/[^\.]//g' | awk -F\. '{ print NF }'`
+  AC_DEFINE_UNQUOTED(NOTIFICATION_DOT_MIB_LENGTH, $notificationoid_len)
+  AC_MSG_RESULT(using enterprise notifications $withval)
+],[
+  AC_MSG_RESULT(using default notifications "NET-SNMP-MIB::netSnmpNotifications")
+])
+dnl
+dnl Catch common mistakes in configure options
+dnl
+AC_ARG_WITH(mib_module,,    AC_MSG_ERROR([ Invalid option. Use --with-mib-modules instead ])     )
+AC_ARG_WITH(out_mib_module,,AC_MSG_ERROR([ Invalid option. Use --with-out-mib-modules instead ]) )
+
+dnl
+dnl Perl specific
+dnl
+AC_ARG_WITH(perl-modules,
+[
+Perl:
+  --with-perl-modules[=ARGS]      Install the perl modules along with the rest
+                                  of the net-snmp toolkit.  If ARGS is
+                                  specified, they're passed to the
+                                  Makefile.PL script.],[
+    install_perl=yes
+    if test "$withval" = yes; then
+      PERLARGS=""
+    else
+      PERLARGS="$withval"
+    fi
+])
+
+AC_ARG_ENABLE(embedded-perl,
+[
+  --enable-embedded-perl          Embed perl in the SNMP agent.
+                                  [forces --with-perl-modules as well.]],
+    embed_perl="yes", embed_perl="no")
+
+dnl
+dnl otherwise prompted information
+dnl
+AC_ARG_WITH(defaults,
+[
+Miscellaneous:
+  --with-defaults          Use defaults for prompted values.],
+    defaults="yes",defaults="no")
+
+AC_ARG_ENABLE(ucd-snmp-compatibility,
+[--enable-ucd-snmp-compatibility  Install ucd-snmp look-alike headers and libs.], ucd_compat=yes, ucd_compat=no)
+dnl
+dnl setup install targets
+dnl
+if test "x$ucd_compat" != "xno" ; then	
+  installucdheaders=installucdheaders
+  installucdlibs=installucdlibs
+  AC_MSG_CACHE_ADD(UCD-SNMP compatability:     enabled)
+fi
+AC_SUBST(installucdheaders)
+AC_SUBST(installucdlibs)
+
+dnl Only define if specifically chosen as --without (i.e., default to true). 
+if test "x$with_root_access" = "xno"; then
+  AC_DEFINE(NO_ROOT_ACCESS)
+fi
+
+dnl Only define if specifically chosen as --without (i.e., default to true).
+if test "x$with_kmem_usage" = "xno"; then
+  AC_DEFINE(NO_KMEM_USAGE)
+fi
+
+dnl Define unless specifically suppressed (i.e., option defaults to false). 
+if test "x$with_dummy_values" != "xyes"; then
+  AC_DEFINE(NO_DUMMY_VALUES)
+fi
+
+dnl Only define if specifically chosen as --without (i.e., default to true). 
+if test "x$with_opaque_special_types" != "xno"; then
+  AC_DEFINE(OPAQUE_SPECIAL_TYPES)
+fi
+
+
+dnl overflow problems with hpux's sh
+dnl taken from Perl's Configure script 
+
+AC_MSG_CHECKING(if I need to feed myself to ksh)
+if test -f /hp-ux -a -f /bin/ksh; then
+  if (PATH=.; alias -x) >/dev/null 2>&1; then
+    AC_MSG_RESULT(no)
+  else
+    AC_MSG_RESULT(yes)
+    if test "x$1" = "x"; then
+      exec /bin/ksh $0
+    else
+      exec /bin/ksh $0 "$@"
+    fi
+  fi
+else
+  AC_MSG_RESULT(no)
+fi
+
+if test "x$developer" != "xno" -a -f $srcdir/remove-files; then
+  dnl turn on the developer flag when taken from a CVS checkout (not a release)
+  developer="yes"
+fi
+
+dnl disable --enable-shared by default in cvs/developer cases.
+if test "x$developer" = "xyes"; then
+  dnl don't do anything if option set via cmdline
+  if test "${enable_shared+set}" != set; then
+    enable_shared=no
+  fi
+fi
+
+dnl perl requires shared libs
+if test "x$embed_perl" = "xyes"; then
+    if test "x$enable_shared" != "xyes"; then
+      AC_MSG_ERROR(--enable-embedded-perl requires --enable-shared)
+    fi
+fi
+
+AC_PROG_CC
+AC_PROG_CPP
+AC_AIX
+AC_EXEEXT
+
+dnl libtool stuff for shared/static libraries.
+AC_LIBTOOL_DLOPEN
+AC_LIBTOOL_WIN32_DLL
+AC_PROG_LIBTOOL
+
+dnl Checks for programs.
+AC_PROG_INSTALL
+AC_PROG_LN_S
+AC_PROG_MAKE_SET
+AC_PATH_PROG(PSPROG,ps)
+AC_PATH_PROG(PERLPROG,perl)
+AC_CHECK_PROGS(WHOAMI, whoami logname, whoami)
+AC_CHECK_PROGS(SED,sed gsed)
+AC_CHECK_PROG(AUTOCONF, autoconf)
+AC_CHECK_PROG(AUTOHEADER, autoheader)
+if test "x$ac_cv_prog_AUTOCONF" = "x"; then
+	AUTOCONF=":"
+	AC_SUBST(AUTOCONF)
+fi
+if test "x$ac_cv_prog_AUTOHEADER" = "x"; then
+	AUTOHEADER=":"
+	AC_SUBST(AUTOHEADER)
+fi
+
+AC_PATH_PROG(UNAMEPROG,uname)
+AC_DEFINE_UNQUOTED(UNAMEPROG,"$UNAMEPROG")
+
+AC_C_CONST
+AC_C_INLINE
+
+dnl get version number.
+AC_MSG_CHECKING(for net-snmp version number)
+VERSION=`grep NetSnmpVersionInfo.*= $srcdir/snmplib/snmp_version.c | sed 's/";.*//;s/.*"//;s/pre/0./;'`
+changequote(, )
+RELEASEVERSION=`echo $VERSION | sed 's/^\([0-9]\)\.\([0-9]\)/\1:\2:0/'`
+changequote([, ])
+AC_SUBST(VERSION)
+AC_SUBST(RELEASEVERSION)
+AC_MSG_RESULT($VERSION)
+AC_MSG_CACHE_ADD(Net-SNMP Version:           $VERSION)
+
+dnl super type checking
+AC_MSG_CHECKING(for developer gcc flags)
+if test "x$developer" = "xyes" -a "x$ac_cv_prog_gcc" = "xyes"; then
+  DEVFLAGS="-Wall -Wstrict-prototypes -Wwrite-strings -Wcast-qual -Wno-char-subscripts"
+else
+  DEVFLAGS=""
+fi
+AC_MSG_RESULT($DEVFLAGS)
+AC_SUBST(DEVFLAGS)
+
+dnl system check
+AC_CANONICAL_SYSTEM
+changequote(, )
+PARTIALTARGETOS=`echo $target_os | sed 's/[-._].*//'`
+CFLAGS="$CFLAGS -D$PARTIALTARGETOS"
+changequote([, ])
+AC_MSG_CACHE_ADD(Building for:               $PARTIALTARGETOS)
+
+dnl
+dnl check for special includes and pick one
+dnl
+
+AC_MSG_CHECKING(for system include file)
+changequote(, )
+filebase=$target_os
+dnl ignore binary format indication
+filebase=`echo $filebase | sed 's/elf//'`
+filebase=`echo $filebase | sed 's/aout//'`
+filebase=`echo $filebase | sed 's/ecoff//'`
+filebase=`echo $filebase | sed 's/coff//'`
+while test "x$filebase" != "x$last" -a ! -f $srcdir/include/net-snmp/system/$filebase.h
+do
+    last=$filebase
+    filebase=`echo $filebase | sed 's/[-._][^-._]*$//'`
+    if test "x$filebase" = "x$last"; then
+	filebase=`echo $filebase | sed 's/[0-9]*$//'`
+    fi
+done
+
+if test "x$filebase" = "x$last"; then
+    filebase="generic"
+fi
+ac_cv_SYSTEM_INCLUDE_FILE="net-snmp/system/$filebase.h"
+
+changequote([, ])
+AC_MSG_RESULT($ac_cv_SYSTEM_INCLUDE_FILE)
+AC_DEFINE_UNQUOTED(SYSTEM_INCLUDE_FILE, "$ac_cv_SYSTEM_INCLUDE_FILE")
+
+dnl second part, the CPU type.
+
+AC_MSG_CHECKING(for machine-type include file)
+changequote(, )
+filebase=$target_cpu
+while test "x$filebase" != "x$last" -a ! -f $srcdir/include/net-snmp/machine/$filebase.h
+do
+    last=$filebase
+    filebase=`echo $filebase | sed 's/[-._][^-._]*$//'`
+done
+
+if test "x$filebase" = "x$last"; then
+    filebase="generic"
+fi
+ac_cv_MACHINE_INCLUDE_FILE="net-snmp/machine/$filebase.h"
+
+changequote([, ])
+AC_MSG_RESULT($ac_cv_MACHINE_INCLUDE_FILE)
+AC_DEFINE_UNQUOTED(MACHINE_INCLUDE_FILE, "$ac_cv_MACHINE_INCLUDE_FILE")
+
+AC_PATH_PROG(CCPATH,$CC)
+dnl watch out for /usr/ucb/cc on solaris, it doesn't work with this package.
+case $target_os in
+    bsdi*)
+	if test "x$CCPATH" = "x/usr/ucb/cc" -o "x$CCPATH" = "x/usr/bin/cc"; then
+	    AC_MSG_ERROR([
+
+*** The BSDI /usr/ucb/cc compiler does not work with this package.  
+*** Please run configure with --with-cc=gcc
+])
+	fi
+    ;;
+    solaris*)
+	if test "x$CCPATH" = "x/usr/ucb/cc"; then
+	    AC_MSG_ERROR([
+
+*** The solaris /usr/ucb/cc compiler does not work with this package.  
+*** Please put a different compiler in your path first or run
+*** configure with --with-cc=XX, where XX is the compiler you want to use.
+])
+	fi
+    ;;
+esac
+    
+AC_MSG_CHECKING(for additional cpp flags)
+dnl gcc extra CPPFLAGS
+if test "x$GCC" = "xyes" -a "x$CPP" = "x$CC -E"; then
+  dnl extra cpp flags for gnu c compiler to allow .in file extensions.
+  EXTRACPPFLAGS="-x c"
+else
+  EXTRACPPFLAGS=""
+fi
+
+dnl Solaris extra cpp flags.
+if test "x$GCC" != "xyes"; then
+  case $target_os in
+    solaris*) EXTRACPPFLAGS="$EXTRACPPFLAGS -Xs" ;;
+  esac
+fi
+
+AC_SUBST(EXTRACPPFLAGS)
+AC_MSG_RESULT($EXTRACPPFLAGS)
+
+dnl Prefixes must begin with "/"
+
+if test "x$prefix" = "xNONE"; then
+  prefix=/usr/local
+fi
+
+fch=`echo $prefix | sed 's/\(.\).*/\1/'`
+if test $fch != "/" ; then
+   prefix=`pwd`/$prefix
+   echo "adjusting prefix to $prefix"
+fi
+
+if test "x$exec_prefix" = "xNONE"; then
+  exec_prefix=$prefix
+fi
+
+fch=`echo $exec_prefix | sed 's/\(.\).*/\1/'`
+if test $fch != "/" ; then
+   exec_prefix=`pwd`/$exec_prefix
+   echo "adjusting exec_prefix to $exec_prefix"
+fi
+
+dnl Set SNMPLIBPATH & SNMPSHAREPATH
+
+SNMPLIBPATH=""
+tmpset="$libdir/snmp"
+while test "x$tmpset" != "x$SNMPLIBPATH"; do
+  SNMPLIBPATH="$tmpset"
+  eval tmpset="$tmpset"
+done
+AC_DEFINE_UNQUOTED(SNMPLIBPATH,"$SNMPLIBPATH")
+AC_DEFINE_UNQUOTED(SNMPDLMODPATH,"$SNMPLIBPATH/dlmod")
+
+SNMPSHAREPATH=""
+tmpset="$datadir/snmp"
+while test "x$tmpset" != "x$SNMPSHAREPATH"; do
+  SNMPSHAREPATH="$tmpset"
+  eval tmpset="$tmpset"
+done
+AC_DEFINE_UNQUOTED(SNMPSHAREPATH,"$SNMPSHAREPATH")
+
+if test "x$DEFAULT_MIBDIRS" = "x"; then
+  AC_DEFINE_UNQUOTED(DEFAULT_MIBDIRS,"\$HOME/.snmp/mibs:$SNMPSHAREPATH/mibs")
+fi
+
+SNMPCONFPATH=""
+tmpset="$sysconfdir/snmp"
+while test "x$tmpset" != "x$SNMPCONFPATH"; do
+  SNMPCONFPATH="$tmpset"
+  eval tmpset="$tmpset"
+done
+AC_DEFINE_UNQUOTED(SNMPCONFPATH,"$SNMPCONFPATH")
+AC_SUBST(SNMPCONFPATH)
+
+dnl guess IPv6 stack type.
+if test "x$enable_ipv6" = "xyes"; then
+	v6type=unknown
+	v6lib=none
+	v6trylibc=no
+
+	AC_MSG_CHECKING([ipv6 stack type])
+	for i in v6d toshiba kame inria zeta linux-glibc linux-inet6; do
+		case $i in
+		v6d)
+			AC_EGREP_CPP(yes, [dnl
+#include </usr/local/v6/include/sys/types.h>
+#ifdef __V6D__
+yes
+#endif],
+				[v6type=$i; v6lib=v6;
+				v6libdir=/usr/local/v6/lib;
+				CFLAGS="-I/usr/local/v6/include $CFLAGS"])
+			;;
+		toshiba)
+			AC_EGREP_CPP(yes, [dnl
+#include <sys/param.h>
+#ifdef _TOSHIBA_INET6
+yes
+#endif],
+				[v6type=$i; v6lib=inet6;
+				v6libdir=/usr/local/v6/lib;
+				CFLAGS="-DINET6 $CFLAGS"])
+			;;
+		kame)
+			AC_EGREP_CPP(yes, [dnl
+#include <netinet/in.h>
+#ifdef __KAME__
+yes
+#endif],
+				[v6type=$i; v6lib=inet6;
+				v6libdir=/usr/local/v6/lib;
+				v6trylibc=yes;
+				CFLAGS="-DINET6 $CFLAGS"])
+			;;
+		inria)
+			AC_EGREP_CPP(yes, [dnl
+#include <netinet/in.h>
+#ifdef IPV6_INRIA_VERSION
+yes
+#endif],
+				[v6type=$i;
+				v6lib=dummy;
+				v6libdir=none;
+				v6trylibc=yes;
+				CFLAGS="-DINET6 $CFLAGS"])
+			;;
+		zeta)
+			AC_EGREP_CPP(yes, [dnl
+#include <sys/param.h>
+#ifdef _ZETA_MINAMI_INET6
+A
+yes
+#endif],
+				[v6type=$i; v6lib=inet6;
+				v6libdir=/usr/local/v6/lib;
+				CFLAGS="-DINET6 $CFLAGS"])
+			;;
+		linux-glibc)
+			AC_EGREP_CPP(yes, [dnl
+#include <features.h>
+#if defined(__GLIBC__) && ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1) || (__GLIBC_ > 2))
+yes
+#endif],
+				[v6type=$i;
+				v6lib=dummy;
+				v6libdir=none;
+				v6trylibc=yes;
+				CFLAGS="-DINET6 $CFLAGS"])
+			;;
+		linux-inet6)
+			if test -d /usr/inet6; then
+				v6type=$i
+				v6lib=inet6
+				v6libdir=/usr/inet6/lib
+				CFLAGS="-DINET6 $CFLAGS"
+			fi
+			;;
+		esac
+		if test "$v6type" != "unknown"; then
+			break
+		fi
+	done
+
+	if test "$v6lib" != "none"; then
+		if test -d $v6libdir -a -f $v6libdir/lib$v6lib.a; then
+			LIBS="-L$v6libdir -l$v6lib $LIBS"
+			enable_ipv6="yes"
+			AC_MSG_RESULT(["$v6type, $enable_ipv6, using lib$v6lib"])
+		elif test "$v6trylibc" = "yes"; then
+			enable_ipv6="yes"
+			AC_MSG_RESULT(["$v6type, $enable_ipv6, using libc"])
+		else
+			AC_MSG_ERROR(no IPv6 library lib$v6lib.a found.)
+			exit 1
+		fi
+	else
+		enable_ipv6="no"
+		AC_MSG_RESULT(["$v6type, $enable_ipv6"])
+	fi
+fi
+
+dnl
+dnl Maybe add library extensions for thread mutex locking.
+dnl
+
+if test "x$with_res_locks" = "xyes"; then
+  AC_DEFINE(NS_REENTRANT)
+EOF
+
+    case $target_os in
+
+    aix*)
+	CC_RUNTIME_ARG="$CC_RUNTIME_ARG -lpthreads"
+	;;
+
+    *)
+	;;
+
+    esac
+fi
+
+AC_MSG_CHECKING(whether we have to build PIC code)
+echo "$with_mib_modules" | grep "ucd-snmp/dlmod" >/dev/null
+if test $? -eq 0 ; then
+	DLLIBS="-ldl"
+        LIB_CFLAGS="$LIB_CFLAGS $SHLIB_CFLAGS"
+	AC_MSG_RESULT(yes)
+else
+	DLLIBS=""
+	AC_MSG_RESULT(no)
+fi
+
+dnl
+dnl Do transport module processing.
+dnl
+AC_MSG_CHECKING(for and configuring transport modules to use)
+transport_src_list=""
+transport_hdr_list=""
+transport_def_list=""
+transport_result_list=""
+transport_add_list=""
+new_with_transport_list=`echo $with_transports | sed 's/,/ /g;'`
+new_with_out_transport_list=`echo $with_out_transports | sed 's/,/ /g;'`
+
+dnl
+dnl Add the default transports to the list
+dnl
+if test "x$PARTIALTARGETOS" = "xcygwin"; then
+  transport_default_list="UDP TCP Callback"
+else
+  transport_default_list="UDP TCP Unix Callback"
+fi
+if test "x$enable_ipv6" = "xyes"; then
+  transport_default_list="UDPIPv6 TCPIPv6 $transport_default_list"
+fi
+for i in $transport_default_list; do
+  if echo " $new_with_transport_list " | grep " $i " >/dev/null; then
+    :
+  else
+    transport_add_list="$i $transport_add_list"
+  fi
+done
+new_transport_list="$transport_add_list $new_with_transport_list"
+
+for i in $new_transport_list; do
+  if echo " $new_with_out_transport_list " | grep " $i " >/dev/null; then
+    if test "x$i" = "xUDP"; then
+      echo
+      AC_MSG_ERROR(It is not possible to compile without UDP/IP support.)
+    fi
+  else
+    if test "x$i" = "xAAL5PVC"; then
+      if test "x$PARTIALTARGETOS" != "xlinux"; then
+        echo
+        AC_MSG_ERROR(AAL5 PVC support unavailable for this platform (Linux only))
+      fi
+    fi
+    if test "x$i" = "xIPX"; then
+      if test "x$PARTIALTARGETOS" != "xlinux"; then
+        echo
+        AC_MSG_ERROR(IPX support unavailable for this platform (Linux only))
+      fi
+    fi
+    if test "x$i" = "xUnix"; then
+      if test "x$PARTIALTARGETOS" = "xcygwin"; then
+        echo
+        AC_MSG_ERROR(Unix domain protocol support unavailable for this platform)
+      fi
+    fi
+    transport_src="snmp"$i"Domain.c"
+    transport_hdr="snmp"$i"Domain.h"
+    rel_transport_src="snmplib/"$transport_src
+    rel_transport_hdr="include/net-snmp/library/"$transport_hdr
+    if test -f "$srcdir/$rel_transport_src"; then
+      transport_result_list="$transport_result_list $i"
+      transport_src_list="$transport_src $transport_src_list"
+      if test -f "$srcdir/$rel_transport_hdr"; then
+        transport_hdr_list="$transport_hdr $transport_hdr_list"
+      fi
+      transport_def=`echo $i | sed 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
+      transport_def_list="SNMP_TRANSPORT_"$transport_def"_DOMAIN $transport_def_list"
+    else
+      echo
+      AC_MSG_ERROR(Cannot find file $transport_src to support SNMP transport domain $i.)
+    fi
+  fi
+done
+transport_obj_list=`echo " $transport_src_list " | sed 's/\.c/\.o/g'`
+transport_lobj_list=`echo " $transport_src_list " | sed 's/\.c/\.lo/g'`
+AC_SUBST(transport_hdr_list)
+AC_SUBST(transport_src_list)
+AC_SUBST(transport_obj_list)
+AC_SUBST(transport_lobj_list)
+for i in $transport_def_list; do
+  AC_DEFINE_UNQUOTED($i)
+done
+AC_MSG_RESULT($transport_result_list.)
+AC_MSG_CACHE_ADD(Network transport support: $transport_result_list)
+
+dnl
+dnl Security modules to use
+dnl 
+
+AC_MSG_CHECKING(for security modules to use)
+security_def_list="usm"
+security_src_list=""
+security_obj_list=""
+security_lobj_list=""
+security_init_file="snmplib/snmpsm_init.h"
+security_incl_file="include/net-snmp/library/snmpv3-security-includes.h"
+new_with_security=`echo $with_security_modules | sed 's/,/ /g;'`
+new_with_out_security=`echo $with_out_security_modules | sed 's/,/ /g;'`
+
+if test ! -d include; then
+  mkdir include
+fi
+if test ! -d include/net-snmp; then
+  mkdir include/net-snmp
+fi
+if test ! -d include/net-snmp/agent; then
+  mkdir include/net-snmp/agent
+fi
+if test ! -d include/net-snmp/library; then
+  mkdir include/net-snmp/library
+fi
+if test ! -d include/ucd-snmp; then
+  mkdir include/ucd-snmp
+fi
+
+if test ! -d snmplib; then
+  mkdir snmplib
+fi
+echo "/* This file is automatically generated by configure.  Do not modify by hand. */" > $security_init_file
+echo "/* This file is automatically generated by configure.  Do not modify by hand. */" > $security_incl_file
+
+for i in $security_def_list; do
+  if echo " $new_with_out_security " | grep " $i " > /dev/null; then
+    if test "x$i" = "xusm"; then
+	echo
+        AC_MSG_ERROR(The USM security module is mandatory)
+    fi
+  else
+    new_with_security="$new_with_security $i"
+  fi
+done
+
+for i in $new_with_security; do
+  cfile="snmp"$i".c"
+  hfile="snmp"$i".h"
+
+  # make sure support exists for it
+  if test -f $srcdir"/snmplib/"$cfile -a -f $srcdir"/include/net-snmp/library/"$hfile; then
+    :
+  else
+    echo
+    AC_MSG_ERROR(No such security module: $i / $cfile / $hfile)
+  fi
+
+  # define a bunch of stuff to enable it
+  security_src_list="$security_src_list $cfile"
+  security_hdr_list="$security_hdr_list $hfile"
+  security_obj_list="$security_obj_list snmp"$i".o"
+  security_lobj_list="$security_lobj_list snmp"$i".lo"
+  def_name="SNMP_SECMOD_"`echo $i | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+  echo "init_"$i"();" >> $security_init_file
+  echo "#include <net-snmp/library/$hfile>" >> $security_incl_file
+  AC_DEFINE_UNQUOTED($def_name)
+done
+
+AC_SUBST(security_src_list)
+AC_SUBST(security_obj_list)
+AC_SUBST(security_lobj_list)
+AC_SUBST(security_hdr_list)
+AC_MSG_RESULT($new_with_security)
+AC_MSG_CACHE_ADD(SNMPv3 Security Modules:   $new_with_security)
+
+dnl
+dnl Handle the special case of KSM to see which crypto API we support
+dnl
+
+for sec in $new_with_security
+do
+  if test x$sec = xksm; then
+    AC_MSG_CHECKING(to see which crypto API we need to use)
+
+    AC_CHECK_FUNC(krb5_c_encrypt,[
+      AC_MSG_RESULT(new MIT crypto API)
+      AC_DEFINE(MIT_NEW_CRYPTO)],[
+      AC_MSG_RESULT(old MIT crypto API)])
+  fi
+done
+
+dnl
+dnl Do hairy agent module processing.
+dnl
+AC_MSG_CHECKING(for and configuring mib modules to use)
+changequote(, )
+
+mibdir="agent/mibgroup"
+module_list=""
+module_list_code=""
+new_with_mib_modules=`echo $with_mib_modules | sed 's/,/ /g;'`
+new_with_out_mib_modules=`echo $with_out_mib_modules | sed 's/,/ /g;'`
+new_module_list="mibII ucd_snmp snmpv3mibs notification target agent_mibs agentx agent_mibs utilities $new_with_mib_modules"
+default_mibs=IP-MIB:IF-MIB:TCP-MIB:UDP-MIB:SNMPv2-MIB:RFC1213-MIB:NOTIFICATION-LOG-MIB
+
+if test "x$mini_agent" = "xyes"; then
+new_with_out_mib_modules="mibII $new_with_out_mib_modules"
+new_module_list="snmpv3mibs mibII/snmp_mib mibII/system_mib mibII/sysORTable mibII/vacm_vars $new_with_mib_modules"
+default_mibs=SNMPv2-MIB:RFC1213-MIB
+default_mibs_install=" "
+fi
+
+
+if test "x$enable_ipv6" = "xyes"; then
+	new_module_list="$new_module_list mibII/ipv6"
+fi
+
+dnl Create include file list for snmp_vars.h to use.
+if test ! -d agent; then
+  mkdir agent
+fi
+if test ! -d agent/mibgroup; then
+  mkdir agent/mibgroup
+fi
+for i in $mibdir/mib_module_includes.h $mibdir/mib_module_inits.h $mibdir/mib_module_shutdown.h include/net-snmp/agent/mib_module_config.h $mibdir/mib_module_dot_conf.h; do
+  rm -f $i
+  echo "/* This file is automatically generated by configure.  Do not modify by hand. */" > $i
+done
+
+test_modules="$new_module_list"
+new_module_list=""
+module_list_h=""
+
+for i in $test_modules
+ do
+  if echo " $new_with_out_mib_modules " | grep " $i " > /dev/null; then
+    :
+  else
+    new_module_list="$new_module_list $i"
+  fi
+done
+
+changequote([, ])
+AC_MSG_RESULT($new_module_list.)
+AC_MSG_CACHE_ADD(Agent MIB code:            $new_module_list)
+
+AC_MSG_CHECKING(for and configuring mib modules pieces to use)
+FD=AC_FD_MSG
+changequote(, )
+
+while test "x$new_module_list" != "x"; do
+  for i in $new_module_list
+    do
+    if echo " $new_with_out_mib_modules " | grep " $i " > /dev/null; then
+      :
+    else
+      if test -f $srcdir/$mibdir/$i.h; then
+        new_list=""
+        new_list_arch=`grep config_arch_require $srcdir/$mibdir/$i.h | sed 's/.*config_arch_require(\(.*\), *\(.*\)).*/\1-xarchx-\2/'`
+	if test "x$new_list_arch" != "x"; then
+          for j in $new_list_arch
+	    do
+	    archtest=`echo $j | sed 's/-xarchx-.*//'`
+	    if test "x$target_os" = "x$archtest" -o "x$PARTIALTARGETOS" = "x$archtest"; then
+	      new_list="$new_list `echo $j | sed 's/.*-xarchx-//'`"
+	    fi
+	  done
+	fi
+	new_list="$new_list `grep config_require $srcdir/$mibdir/$i.h | sed 's/.*config_require(\(.*\)).*/\1/'`"
+	if test "x$new_list" != "x"; then
+	  for j in $new_list
+	    do
+	    if test ! -f $srcdir/$mibdir/$j.h; then
+              changequote([, ])
+	      AC_MSG_ERROR(mib module "$i" requires module "$j" but $j.h or $j.c could not be found in $srcdir/$mibdir)
+              changequote(, )
+	    elif echo " $new_with_out_mib_modules " | grep " $j " > /dev/null; then
+              changequote([, ])
+	      AC_MSG_WARN(mib module "$i" requires module "$j" but you told me to compile without it)
+              changequote(, )
+	    elif echo " $module_list $new_list_two $new_module_list " | grep " $j " > /dev/null; then
+	      :
+	    else
+	      new_list_two="$new_list_two $j"
+	    fi
+	  done
+	fi
+	new_mibs=`grep config_add_mib $srcdir/$mibdir/$i.h | sed 's/.*config_add_mib(\(.*\)).*/\1/'`
+	if test "x$new_mibs" != "x"; then
+	    for j in $new_mibs
+		do
+		if test "x`echo :$default_mibs: | grep :$j:`" = "x"; then
+		    default_mibs="$default_mibs:$j"
+		fi
+		if test -f $srcdir/mibs/$j.txt; then
+		    if echo $default_mibs_install | grep " $j " > /dev/null; then
+			    :
+		    else
+			    default_mibs_install="$default_mibs_install $j.txt"
+		    fi
+		fi
+	    done
+	fi
+      else
+        changequote([, ])
+	AC_MSG_ERROR(module files $i.h or $i.c could not be found in $srcdir/$mibdir)
+        changequote(, )
+      fi
+      module_list="$module_list $i"
+      echo '#include "'"mibgroup/$i.h"'"' >> $mibdir/mib_module_includes.h
+      module_list_h="$module_list_h mibgroup/$i.h"
+      if test -f $srcdir/$mibdir/$i.c; then
+        module_list_code="$module_list_code $i"
+        mnm=`echo $i | sed 's/.*\///;s/\.c$//;'`
+        temp_init=`grep init_$mnm $srcdir/$mibdir/$i.c | grep -v _init_$mnm`
+	if test "x$temp_init" != "x"; then
+	    echo "  if (should_init(\"$mnm\")) init_$mnm();" >> $mibdir/mib_module_inits.h
+	fi
+	if grep shutdown_`basename $i` $srcdir/$mibdir/$i.c > /dev/null; then
+	    echo "  if (should_init(\"`basename $i`\")) shutdown_`basename $i`();" >> $mibdir/mib_module_shutdown.h
+	fi
+      fi
+      if test "x`echo $i | sed 's/\///g;'`" != "x$i"; then
+	mnd=`echo $i | sed 's/\/[^/]*$//;'`
+	if test ! -d ./$mibdir/$mnd; then
+	    module_directories="$module_directories ./$mibdir/$mnd"
+	fi
+      fi
+      if grep config_load_mib $srcdir/$mibdir/$i.h > /dev/null 2>&1; then
+        changequote([, ])
+      	AC_MSG_WARN(mib module "$i" uses the "config_load_mib" directive, which is no longer supported.  It probably won't work.)
+        changequote(, )
+      fi
+      grep config_parse_dot_conf $srcdir/$mibdir/$i.h | sed 's@.*config_parse_dot_conf(\([^)]*\), *\([^),]*\), *\([^),]*\), *\([^),]*\)).*@register_config_handler("snmpd",\1, \2, \3, \4);@' >> $mibdir/mib_module_dot_conf.h
+      sym="`echo ${i} | sed 's/[^a-zA-Z0-9_]/_/g' | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`"
+      echo "/* Define if compiling with the ${i} module files.  */" >> include/net-snmp/agent/mib_module_config.h
+      echo "#define USING_${sym}_MODULE 1" >> include/net-snmp/agent/mib_module_config.h
+      echo " " >> include/net-snmp/agent/mib_module_config.h
+      echo $ac_n " $i$ac_c" >&$FD
+    fi
+  done
+  new_module_list="$new_list_two"
+  new_list_two=""
+done
+module_list_o=`echo "$module_list_code " | sed 's/\([^ ]\) /\1.o /g'`
+module_list_lo=`echo "$module_list_code " | sed 's/\([^ ]\) /\1.lo /g'`
+module_list_c=`echo "$module_list_code " | sed 's/\([^ ]\) /\1.c /g'`
+mibgroup_list_o=`echo " $module_list_o " | sed 's@ \([^ ]*\)\.o@ mibgroup/\1.o @g'`
+mibgroup_list_lo=`echo " $module_list_lo " | sed 's@ \([^ ]*\)\.lo@ mibgroup/\1.lo @g'`
+changequote([, ])
+MODULE_LIST=$module_list_code
+AC_SUBST(MODULE_LIST)
+AC_SUBST(module_list_c)
+AC_SUBST(module_list_h)
+AC_SUBST(module_list_o)
+AC_SUBST(module_list_lo)
+AC_SUBST(mibgroup_list_o)
+AC_SUBST(mibgroup_list_lo)
+AC_SUBST(module_list)
+AC_SUBST(default_mibs_install)
+
+AC_MSG_RESULT(.)
+
+AC_MSG_CHECKING(if directories need to be created)
+for i in $module_directories; do
+  $srcdir/mkinstalldirs $i
+done
+AC_MSG_RESULT(.)
+
+AC_MSG_CHECKING(default mib files to read)
+if test "x$DEFAULT_MIBS" = "x"; then
+  DEFAULT_MIBS="$default_mibs"
+fi
+AC_DEFINE_UNQUOTED(DEFAULT_MIBS,"$DEFAULT_MIBS")
+AC_MSG_RESULT($DEFAULT_MIBS)
+
+dnl
+dnl Check for kernel location
+dnl
+
+AC_CACHE_CHECK(for location of system kernel,ac_cv_KERNEL_LOC,
+[ac_cv_KERNEL_LOC="unknown"
+dnl First determine if test expects a -f or a -c (character device (SYSV))
+
+if test -c /dev/null; then
+  CFLAG="-c"
+elif test -f /dev/null; then
+  CFLAG="-f"
+else
+  dnl fall back
+  CFLAG="-f"
+fi
+for i in /vmunix /hp-ux /stand/vmunix /dev/ksyms /kernel/unix /kernel/genunix /netbsd /unix /kernel /bsd /mach_kernel
+  do
+  if test -f $i -o $CFLAG $i; then
+    ac_cv_KERNEL_LOC="$i"
+    break;
+  fi
+done
+if test $i = "unknown"; then
+  AC_MSG_WARN(Can't find system kernel...  Setting to /vmunix)
+  ac_cv_KERNEL_LOC="/vmunix"
+fi
+])
+
+AC_DEFINE_UNQUOTED(KERNEL_LOC,"$ac_cv_KERNEL_LOC")
+
+dnl
+dnl Check for mount table location
+dnl
+
+AC_CACHE_CHECK(for mount table location,ac_cv_ETC_MNTTAB,
+[ac_cv_ETC_MNTTAB="unknown"
+for i in /etc/mnttab /etc/mtab /etc/filesystems
+  do
+  if test -f $i; then
+    ac_cv_ETC_MNTTAB="$i"
+    break;
+  fi
+done
+])
+
+AC_DEFINE_UNQUOTED(ETC_MNTTAB,"$ac_cv_ETC_MNTTAB")
+
+dnl Check for /dev/dmem or /dev/drum location
+AC_CACHE_CHECK(for location of swap device,ac_cv_DMEM_LOC,
+[
+dnl First determine if test expects a -f or a -c (character device (SYSV))
+
+if test -f /dev/kmem; then
+  CTEST="test -f"
+elif test -c /dev/kmem; then
+  CTEST="test -c"
+else
+  dnl fall back
+  CTEST="test -f"
+fi
+
+if $CTEST /dev/dmem; then
+  ac_cv_DMEM_LOC="/dev/dmem"
+elif $CTEST /dev/drum; then
+  ac_cv_DMEM_LOC="/dev/drum"
+else
+  ac_cv_DMEM_LOC="none"
+fi
+])
+
+if test "x$ac_cv_DMEM_LOC" != "xnone"; then
+  AC_DEFINE_UNQUOTED(DMEM_LOC,"$ac_cv_DMEM_LOC")
+fi
+
+dnl forced efence turned off.
+dnl if test "x$developer" = "xyes" -a "x$use_efence" != "xno"; then
+dnl    use_efence="yes"
+dnl fi
+
+if test "x$use_efence" = "xyes"; then
+    AC_CHECK_LIB(efence, EF_Exit)
+fi
+
+dnl Checks for libraries.
+dnl AC_CHECK_LIB(des, main)
+AC_CHECK_LIB(m, asin)
+dnl nlist is needed for uptime on some sytems in the generic library
+AC_CHECK_LIB(elf, nlist)
+
+dnl On some platforms (Irix) libnsl and libsocket should not be used.
+AC_CHECK_FUNC(gethostbyname, AC_DEFINE(HAVE_GETHOSTBYNAME),
+	AC_CHECK_LIB(nsl, gethostbyname, AC_DEFINE(HAVE_GETHOSTBYNAME)
+	LIBS="${LIBS} -lnsl"))
+AC_CHECK_FUNC(getservbyname, AC_DEFINE(HAVE_GETSERVBYNAME),
+	AC_CHECK_LIB(socket, getservbyname, AC_DEFINE(HAVE_GETSERVBYNAME)
+	LIBS="${LIBS} -lsocket"))
+
+dnl Replace `main' with a function in -lkstat:
+AC_CHECK_LIB(kstat, kstat_lookup)
+dnl Check for nlist in mld (irix)
+AC_CHECK_LIB(mld, nlist)
+
+dnl Check for security related functions
+if test "x$tryopenssl" != "xno"; then
+    if test "x$tryrsaref" != "xno"; then
+         AC_CHECK_LIB(rsaref, RSAPrivateDecrypt)
+         AC_CHECK_LIB(RSAglue, RSA_PKCS1_RSAref)
+    fi
+
+    AC_CHECK_LIB(crypto, EVP_md5)
+    AC_CHECK_FUNCS(AES_cfb128_encrypt)
+fi
+
+dnl Check for libraries that the agent needs
+dnl saving old libraries
+NONAGENTLIBS=$LIBS
+
+dnl check for tcp wrapper support
+_cppflags="${CPPFLAGS}"
+_ldflags="${LDFLAGS}"
+
+AC_ARG_WITH(libwrap,
+[  --with-libwrap[=LIBPATH] Compile in libwrap (tcp_wrappers) support.],[
+  if test "$with_libwrap" != "no"; then
+    if test "$with_libwrap" != "yes"; then
+      CPPFLAGS="${CPPFLAGS} -I$with_libwrap/include"
+      LDFLAGS="${LDFLAGS} -L$with_libwrap/lib"
+    fi
+
+    _libs=${LIBS}
+    AC_CHECK_HEADER(tcpd.h, ,
+	    AC_MSG_ERROR(Asked to use libwrap but I couldn't find tcpd.h.))
+
+    LIBS="$LIBS -lwrap"
+	AC_MSG_CHECKING(for TCP wrappers library -lwrap)
+	AC_TRY_LINK([#include <tcpd.h>
+		     int allow_severity = 0;
+		     int deny_severity  = 0;
+		    ],[hosts_access((void *)0)],
+        [
+	    AC_MSG_RESULT(yes)
+	    AC_DEFINE(USE_LIBWRAP)
+	    test "$with_libwrap" != no -a "$with_libwrap" != yes && WRAPLIBS="-L$with_libwrap/lib"
+	    WRAPLIBS="$WRAPLIBS -lwrap"],
+        [
+	    AC_MSG_RESULT(no)
+	    dnl Linux RedHat 6.1 won't link libwrap without libnsl
+	    AC_CHECK_FUNC(yp_get_default_domain, ,
+		AC_CHECK_LIB(nsl, yp_get_default_domain))
+	    AC_MSG_CHECKING(for TCP wrappers library -lwrap linked with -lnsl)
+	    AC_TRY_LINK([#include <tcpd.h>
+		         int allow_severity = 0;
+	                 int deny_severity  = 0;
+	 		],[hosts_access((void *)0)],
+
+			AC_MSG_RESULT(yes)
+			AC_DEFINE(USE_LIBWRAP)
+			test "$with_libwrap" != no -a "$with_libwrap" != yes && WRAPLIBS="-L$with_libwrap/lib"
+			WRAPLIBS="$WRAPLIBS -lwrap -lnsl",
+
+			AC_MSG_RESULT(no)
+			AC_MSG_ERROR(Asked to use libwrap but I couldn't find it.))
+        ])
+    CPPFLAGS=${_cppflags}
+    LDFLAGS=${_ldflags}
+    LIBS=${_libs}
+  fi
+])
+
+dnl
+dnl rpm libraries only needed for the host resources mib software
+dnl installed tables (on linux in particular)
+dnl
+if echo " $module_list " | grep " host/hr_swinst " > /dev/null; then
+  dnl ARG.  RPM is a real pain.
+  dnl FWIW librpm.la, librpmio.la, and libpopt.la have correct dependencies.
+  _rpmlibs=""
+
+  dnl zlib is required for newer versions of rpm
+  _cppflags="${CPPFLAGS}"
+  _ldflags="${LDFLAGS}"
+
+  AC_ARG_WITH(zlib,
+  [  --with-zlib[=DIR]        use libz in DIR],[
+    if test -d "$withval"; then
+      CPPFLAGS="${CPPFLAGS} -I$withval/include"
+      LDFLAGS="${LDFLAGS} -L$withval/lib"
+    fi
+  ])
+
+  dnl dunno if this is needed for rpm-4.0.x, earlier probably needs.
+  AC_CHECK_HEADER(zlib.h,
+      AC_CHECK_LIB(z, gzread, , CPPFLAGS=${_cppflags} LDFLAGS=${_ldflags}),
+      CPPFLAGS=${_cppflags} LDFLAGS=${_ldflags})
+
+  dnl two variants of bzip2 need checking.
+  AC_CHECK_LIB(bz2, bzread, [_rpmlibs="$_rpmlibs -lbz2"],
+     AC_CHECK_LIB(bz2, BZ2_bzread, [_rpmlibs="$_rpmlibs -lbz2"],))
+
+  dnl two variants of db1 need checking.
+  AC_CHECK_LIB(db1, dbopen, [_rpmlibs="-ldb1 $_rpmlibs"],
+     AC_CHECK_LIB(db, dbopen, [_rpmlibs="-ldb $_rpmlibs"]))
+
+  dnl two variants of db3 need checking.
+  AC_CHECK_LIB(db-3.1, db_create, [_rpmlibs="-ldb-3.1 $_rpmlibs"],
+    AC_CHECK_LIB(db-3.0, db_create, [_rpmlibs="-ldb-3.0 $_rpmlibs"]))
+  
+  dnl rpm-3.0.5 and later needs popt.
+  AC_CHECK_LIB(popt, poptParseArgvString, [_rpmlibs="-lpopt $_rpmlibs"])
+  
+  dnl rpm-4.0.x needs rpmio.
+  AC_CHECK_LIB(rpmio, Fopen, [_rpmlibs="-lrpmio $_rpmlibs"],,$_rpmlibs)
+  
+  dnl now check for rpm using the appropriate libraries.
+  AC_CHECK_LIB(rpm, rpmGetFilesystemList,[
+    AC_DEFINE(HAVE_LIBRPM)
+    LIBS="-lrpm $_rpmlibs $LIBS"
+    CFLAGS="$CFLAGS -I/usr/include/rpm"
+  ],[
+    dnl rpm-4.0.3 librpmdb actually contains what we need.
+    AC_CHECK_LIB(rpmdb, rpmdbOpen,[
+      AC_DEFINE(HAVE_LIBRPM)
+      LIBS="-lrpmdb -lrpm $_rpmlibs $LIBS"
+      CFLAGS="$CFLAGS -I/usr/include/rpm"
+    ],,-lrpm $_rpmlibs)
+  ])
+fi
+  
+dnl Replace `main' with a function in -lkvm:
+AC_CHECK_LIB(kvm, kvm_read)
+dnl DYNAMIC MODULE SUPPORT
+AC_CHECK_LIB(dl, dlopen)
+AC_CHECK_FUNCS(dlopen)
+
+AC_CHECK_FUNCS(kvm_openfiles nlist knlist kvm_getprocs)
+echo "$with_mib_modules" | grep "ucd-snmp/diskio" >/dev/null
+dnl whether we need -ldevstat for diskio MIB
+if test $? -eq 0 ; then
+	AC_CHECK_FUNC(getdevs, AC_DEFINE(HAVE_GETDEVS),
+		AC_CHECK_LIB(devstat, getdevs, AC_DEFINE(HAVE_GETDEVS)
+		LIBS="${LIBS} -ldevstat"))
+fi
+
+
+dnl
+dnl Install the various perl modules
+dnl
+
+if test "x$embed_perl" = "xyes" -a "x$install_perl" = "xno" ; then
+  install_perl="yes"
+fi
+if test "x$install_perl" != "x" -a "x$install_perl" != "xno"; then
+    PERLTARGS="perlmodules"
+    PERLINSTALLTARGS="perlinstall"
+    AC_SUBST(PERLTARGS)
+    AC_SUBST(PERLINSTALLTARGS)
+    AC_SUBST(PERLARGS)
+    AC_MSG_CACHE_ADD(SNMP Perl modules:          enabled)
+fi
+
+dnl
+dnl Embedded Perl specific stuff
+dnl
+if test "x$embed_perl" = "xyes"; then
+    myperl=$ac_cv_path_PERLPROG
+    if test $myperl = "no"; then
+      AC_MSG_ERROR(--enable-embedded-perl requested but no perl executable found)
+    fi
+
+    AC_MSG_CHECKING(for perl CFLAGS)
+    perlcflags=`$myperl -MExtUtils::Embed -e ccopts`
+    AC_MSG_RESULT($perlcflags)
+    CPPFLAGS="$CPPFLAGS $perlcflags"
+
+    AC_MSG_CHECKING(for perl LDFLAGS)
+    perlldopts=`$myperl -MExtUtils::Embed -e ldopts`
+    AC_MSG_RESULT($perlldopts)
+    LIBS="$LIBS $perlldopts"
+
+    dnl newer perl vs older perl call functions
+    AC_CHECK_FUNCS(eval_pv perl_eval_pv)
+
+    AC_DEFINE(NETSNMP_EMBEDDED_PERL)
+    OTHERAGENTLIBOBJS="snmp_perl.o"
+    OTHERAGENTLIBLOBJS="snmp_perl.lo"
+
+    EMBEDPERLINSTALL="embedperlinstall"
+    AC_SUBST(EMBEDPERLINSTALL)
+    AC_MSG_CACHE_ADD(Embedded perl support:      enabled)
+fi
+
+dnl reset libs
+AGENTLIBS=$LIBS
+LIBS=$NONAGENTLIBS
+
+dnl Checks for header files.
+AC_HEADER_STDC
+AC_HEADER_DIRENT
+AC_HEADER_SYS_WAIT
+AC_CHECK_HEADERS(stdarg.h string.h fcntl.h limits.h sys/file.h sys/ioctl.h syslog.h unistd.h netinet/tcpip.h netinet/in.h netinet/ip.h netinet/ip_icmp.h net/if.h netdb.h sys/dmap.h machine/pte.h xti.h sys/sockio.h sys/socket.h sys/un.h fstab.h sys/fs.h mtab.h ufs/fs.h ufs/ffs/fs.h sys/fixpoint.h machine/param.h sys/vm.h vm/vm.h sys/vmmeter.h sys/vmparam.h sys/vmmac.h sys/vmsystm.h sys/mbuf.h sys/time.h sys/swap.h inet/mib2.h sys/statvfs.h sys/vfs.h sys/mnttab.h sys/user.h sys/proc.h sys/select.h mntent.h sys/mntent.h kstat.h utsname.h sys/utsname.h sys/cdefs.h getopt.h locale.h pthread.h sys/loadavg.h regex.h linux/tasks.h pwd.h grp.h utmpx.h)
+dnl FreeBSD required headers
+AC_CHECK_HEADERS(malloc.h sys/param.h net/if_dl.h sys/sysctl.h stdlib.h net/if_mib.h net/if_types.h net/if_var.h sys/queue.h osreldate.h machine/types.h sys/socketvar.h)
+dnl Linux
+AC_CHECK_HEADERS(sys/conf.h netinet/in_systm.h netinet/tcp.h netinet/udp.h netinet/in_var.h netinet/if_ether.h netinet/ip_var.h netinet/tcp_timer.h netinet/tcp_var.h netinet/tcp_fsm.h netinet/udp_var.h netinet/icmp_var.h sys/protosw.h nlist.h ioctls.h asm/page.h netipx/ipx.h)
+dnl NetBSD required headers
+AC_CHECK_HEADERS(arpa/inet.h kvm.h sys/pool.h uvm/uvm_param.h uvm/uvm_extern.h vm/vm_param.h vm/vm_extern.h)
+dnl BSDi2 headers
+AC_CHECK_HEADERS(sys/mount.h vm/swap_pager.h ufs/ufs/dinode.h)
+dnl BSDi3 headers
+AC_CHECK_HEADERS(sys/stat.h sys/vnode.h ufs/ufs/quota.h ufs/ufs/inode.h)
+dnl irix headers
+AC_CHECK_HEADERS(sys/hashing.h sys/tcpipstats.h sys/sysmp.h)
+dnl from smux stuff
+AC_CHECK_HEADERS(err.h sys/filio.h sgtty.h)
+dnl AIX needs this for statfs func
+AC_CHECK_HEADERS(sys/statfs.h)
+dnl Dynix
+AC_CHECK_HEADERS(net/route.h)
+dnl for HostRes (HP-UX at least)
+AC_CHECK_HEADERS(sys/dkio.h sys/diskio.h sys/pstat.h linux/hdreg.h pkglocs.h)
+dnl for HostRes (Solaris 2.x at least)
+AC_CHECK_HEADERS(pkginfo.h,
+    AC_CHECK_LIB(adm, pkginfo, AC_DEFINE(HAVE_PKGINFO)
+    LIBS="${LIBS} -ladm"
+    AGENTLIBS="${AGENTLIBS} -ladm"))
+dnl WIN32
+AC_CHECK_HEADERS(winsock.h, AGENTLIBS="${AGENTLIBS} -liphlpapi")
+AC_CHECK_HEADERS(io.h)
+dnl SCO
+AC_CHECK_HEADERS(sys/stream.h)
+dnl KAME
+AC_CHECK_HEADERS(netinet/ip6.h netinet6/in6_var.h netinet6/in6_pcb.h netinet6/ip6_var.h netinet6/tcp6.h netinet6/tcp6_fsm.h netinet6/nd6.h netinet6/tcp6_timer.h netinet6/tcp6_var.h)
+dnl DYNAMIC MODULE SUPPORT
+AC_CHECK_HEADERS(dlfcn.h)
+dnl table_array helper support
+AC_CHECK_HEADERS(search.h)
+
+dnl RPM subdirectory path (sigh)
+if echo " $module_list " | grep " host/hr_swinst " > /dev/null; then
+  AC_CHECK_HEADERS(rpmio.h,, [
+     AC_CHECK_HEADERS(rpm/rpmio.h, CFLAGS="-I/usr/include/rpm $CFLAGS")
+  ])
+fi
+
+dnl OpenBSD 2.6 needs netinet/in.h before netinet/in_pcb.h
+AC_MSG_CHECKING([for netinet/in_pcb.h])
+AC_CACHE_VAL(cv_have_netinet_in_pcb_h,
+[ AC_TRY_CPP( [
+#include <netinet/in.h>
+#include <netinet/in_pcb.h>
+], cv_have_netinet_in_pcb_h=yes, cv_have_netinet_in_pcb_h=no)])
+AC_MSG_RESULT($cv_have_netinet_in_pcb_h)
+if test $cv_have_netinet_in_pcb_h = yes; then
+  AC_DEFINE(HAVE_NETINET_IN_PCB_H)
+fi
+
+dnl NetBSD needs machine/types.h before sys/disklabel.h
+AC_MSG_CHECKING([for sys/disklabel.h])
+AC_CACHE_VAL(cv_have_sys_disklabel_h,
+[ AC_TRY_CPP( [
+#include <machine/types.h>
+#include <sys/disklabel.h>
+], cv_have_sys_disklabel_h=yes, cv_have_sys_disklabel_h=no)])
+AC_MSG_RESULT($cv_have_sys_disklabel_h)
+if test $cv_have_sys_disklabel_h = yes; then
+  AC_DEFINE(HAVE_SYS_DISKLABEL_H)
+fi
+
+dnl OpenSSL
+AC_CHECK_HEADERS(openssl/hmac.h openssl/evp.h openssl/aes.h openssl/des.h)
+
+dnl Printing
+AC_PATH_PROG(LPSTAT_PATH,lpstat)
+if test x$LPSTAT_PATH != x; then
+    AC_DEFINE_UNQUOTED(LPSTAT_PATH,"$LPSTAT_PATH")
+    AC_DEFINE(HAVE_LPSTAT)
+fi
+AC_CHECK_FUNCS(cgetnext)
+if test -r /etc/printcap; then
+    AC_DEFINE(HAVE_PRINTCAP)
+fi
+
+AC_MSG_CHECKING(for authentication support)
+if test "x$ac_cv_lib_crypto_EVP_md5" != "xyes" -o "x$ac_cv_header_openssl_hmac_h" != "xyes" -o "x$ac_cv_header_openssl_hmac_h" != "xyes"; then
+dnl if OpenSSL is not found, default to using internal md5 support.
+    AC_DEFINE(USE_INTERNAL_MD5)
+    authmodes="MD5"
+    encrmodes=""
+    AC_MSG_RESULT(Internal MD5 Support)
+    if test "x$askedopenssl" = "xyes"; then
+	AC_MSG_ERROR(Asked to use OpenSSL but I couldn't find it.)
+    fi
+else
+    if test "x$tryopenssl" = "xno"; then
+        authmodes="MD5"
+        encrmodes=""
+	AC_DEFINE(USE_INTERNAL_MD5)
+	AC_MSG_RESULT(Internal MD5 Support)
+    else
+        authmodes="MD5 SHA1"
+        if test "x$enable_privacy" != "xno" ; then
+	    if test $ac_cv_header_openssl_aes_h = "yes" ; then
+	        encrmodes="DES AES128 AES192 AES256"
+	    else
+	        encrmodes="DES"
+	    fi
+        else
+	    encrmodes="[disabled]"
+        fi
+	AC_DEFINE(USE_OPENSSL)
+	AC_MSG_RESULT(OpenSSL Support)
+    fi
+fi
+
+AC_MSG_CACHE_ADD(Authentication support:     $authmodes)
+AC_MSG_CACHE_ADD(Encryption support:         $encrmodes)
+
+dnl Checks for typedefs, structures, and compiler characteristics.
+AC_TYPE_OFF_T
+AC_TYPE_PID_T
+AC_HEADER_TIME
+
+dnl this should use AC_CHECK_TYPE, but it's broken at least in 2.13-14
+dnl so we do it by hand.
+AC_MSG_CHECKING(for socklen_t)
+AC_CACHE_VAL(ac_cv_type_$1,
+[AC_EGREP_CPP(dnl
+changequote(<<,>>)dnl
+<<socklen_t[^a-zA-Z_0-9]>>dnl
+changequote([,]), [#include <sys/types.h>
+#if STDC_HEADERS
+#include <stdlib.h>
+#include <stddef.h>
+#endif
+#ifdef HAVE_SYS_SOCKET_H
+#include <sys/socket.h>
+#endif], ac_cv_type_socklen_t=yes, ac_cv_type_socklen_t=no)])dnl
+
+AC_MSG_RESULT($ac_cv_type_socklen_t)
+if test $ac_cv_type_socklen_t = yes; then
+  AC_DEFINE(HAVE_SOCKLEN_T)
+fi
+
+dnl AIX keeps in_addr_t in /usr/include/netinet/in.h
+AC_MSG_CHECKING(for in_addr_t)
+AC_CACHE_VAL(ac_cv_type_$1,
+[AC_EGREP_CPP(dnl
+changequote(<<,>>)dnl
+<<in_addr_t[^a-zA-Z_0-9]>>dnl
+changequote([,]), [#include <sys/types.h>
+#if STDC_HEADERS
+#include <stdlib.h>
+#include <stddef.h>
+#endif
+#ifdef HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif], ac_cv_type_in_addr_t=yes, ac_cv_type_in_addr_t=no)])dnl
+
+AC_MSG_RESULT($ac_cv_type_in_addr_t)
+if test $ac_cv_type_in_addr_t = yes; then
+  AC_DEFINE(HAVE_IN_ADDR_T)
+fi
+
+dnl Check ps args
+AC_CACHE_CHECK(for correct flags to ps, ac_cv_ps_flags,
+[if test "`($PSPROG -e 2>&1) | egrep ' (ps) *$' | awk '{print $NF}'`" = "ps" ; then
+  ac_cv_ps_flags="-e"
+elif test "`($PSPROG -el 2>&1) | egrep ' (ps) *$' | awk '{print $NF}'`" = "ps" ; then
+  ac_cv_ps_flags="-el"
+elif test "`($PSPROG acx 2>&1) | egrep ' (ps) *$' | awk '{print $NF}'`" = "ps" ; then
+  ac_cv_ps_flags="acx"
+elif test "`($PSPROG -acx 2>&1) | egrep ' (ps) *$' | awk '{print $NF}'`" = "ps" ; then
+  ac_cv_ps_flags="-acx"
+elif test "`($PSPROG -o pid,tt,state,time,ucomm 2>&1) | egrep ' ps *$' | awk '{print $NF}'`" = "ps" ; then
+  ac_cv_ps_flags="-o pid,tt,state,time,ucomm"
+elif test "`($PSPROG ax 2>&1) | egrep ' (ps) *$' | awk '{print $NF}'`" = "ps" ; then
+  ac_cv_ps_flags="ax"
+else
+  AC_MSG_WARN(Unable to determine valid ps flags...  defaulting...)
+  ac_cv_ps_flags="-acx"
+fi
+])
+
+PSCMD="$PSPROG $ac_cv_ps_flags"
+AC_SUBST(PSCMD)
+AC_DEFINE_UNQUOTED(PSCMD, "$PSPROG $ac_cv_ps_flags")
+
+dnl Checks for byte order
+if test $cross_compiling = yes; then
+  if test $with_endianness = "big"; then
+    AC_DEFINE(WORDS_BIGENDIAN)
+  elif test -z $with_endianness; then
+    AC_MSG_ERROR([You are cross-compiling, but you have not specified the target's endianness])
+  fi
+else
+  if test $with_endianness; then
+    AC_MSG_ERROR([Endianness has been specified, but you are not cross-compiling.])
+  fi
+  AC_C_BIGENDIAN
+fi
+
+dnl Checks for library functions.
+AC_FUNC_ALLOCA
+AC_PROG_GCC_TRADITIONAL
+AC_FUNC_MEMCMP
+AC_TYPE_SIGNAL
+AC_FUNC_GETMNTENT
+AC_CHECK_FUNCS(setmntent gethostname uname gettimeofday select socket strtol strtoul strlcpy)
+AC_CHECK_FUNCS(strchr strdup memcpy memmove index bcopy strcasestr regcomp)
+AC_CHECK_FUNCS(signal setsid sigset sigblock sighold strerror setenv vsnprintf snprintf)
+AC_CHECK_FUNCS(sigaction)
+AC_CHECK_FUNCS(snprintf strtoul)
+AC_CHECK_FUNCS(random lrand48 rand)
+AC_CHECK_FUNCS(execv system fork getpid strncasecmp sigalrm)
+if echo " $module_list " | grep " host/hr_swinst " > /dev/null; then
+  OLDLIBS=$LIBS
+  LIBS=$AGENTLIBS
+  AC_CHECK_FUNCS(rpmGetPath)
+  LIBS=$OLDLIBS
+fi
+
+AC_CHECK_FUNCS(getloadavg)
+AC_CHECK_FUNCS(getaddrinfo getipnodebyname)
+dnl BSDi2 functions differ
+AC_CHECK_FUNCS(statvfs statfs)
+AC_CHECK_FUNCS(getdtablesize)
+dnl freebsd2 checks
+AC_CHECK_FUNCS(getfsstat)
+AC_CHECK_FUNCS(usleep)
+AC_CHECK_FUNCS(setlocale)
+AC_CHECK_FUNCS(tcgetattr)
+AC_CHECK_FUNCS(if_nameindex if_freenameindex)
+dnl solaris checks
+AC_CHECK_FUNCS(getpagesize)
+AC_CHECK_FUNCS(mkstemp)
+AC_CHECK_FUNCS(getpwnam getgrnam setgid setuid setgroups)
+dnl High resolution alarm support
+AC_CHECK_FUNCS(setitimer)
+
+AC_MSG_CHECKING([for SIOCGIFADDR in sys/ioctl.h])
+AC_CACHE_VAL(cv_sys_ioctl_h_has_SIOCGIFADDR,
+[ AC_EGREP_CPP(xxxyesxxx,
+[
+#ifdef HAVE_SYS_IOCTL_H
+#include <sys/ioctl.h>
+#endif
+#ifdef SIOCGIFADDR
+xxxyesxxx
+#endif
+], cv_sys_ioctl_h_has_SIOCGIFADDR=yes, cv_sys_ioctl_h_has_SIOCGIFADDR=no)])
+AC_MSG_RESULT($cv_sys_ioctl_h_has_SIOCGIFADDR)
+if test $cv_sys_ioctl_h_has_SIOCGIFADDR = yes; then
+  AC_DEFINE(SYS_IOCTL_H_HAS_SIOCGIFADDR)
+fi
+
+# ultrix
+AC_MSG_CHECKING([for two-argument statfs with struct fs_data (Ultrix)])
+AC_CACHE_VAL(fu_cv_sys_stat_fs_data,
+[AC_TRY_RUN([
+#ifdef HAVE_SYS_PARAM_H
+#include <sys/param.h>
+#endif
+#include <sys/types.h>
+#ifdef HAVE_SYS_MOUNT_H
+#include <sys/mount.h>
+#endif
+#ifdef HAVE_SYS_FS_TYPES_H
+#include <sys/fs_types.h>
+#endif
+main ()
+{
+struct fs_data fsd;
+/* Ultrix's statfs returns 1 for success,
+   0 for not mounted, -1 for failure.  */
+exit (statfs (".", &fsd) != 1);
+}],
+fu_cv_sys_stat_fs_data=yes,
+fu_cv_sys_stat_fs_data=no,
+fu_cv_sys_stat_fs_data=no)])
+AC_MSG_RESULT($fu_cv_sys_stat_fs_data)
+if test $fu_cv_sys_stat_fs_data = yes; then
+  AC_DEFINE(STAT_STATFS_FS_DATA)
+fi
+
+dnl check if compiler pre-processor defines __FUNCTION__
+AC_CACHE_CHECK(if __FUNCTION__ is defined,ac_cv_HAVE_CPP_UNDERBAR_FUNCTION_DEFINED,
+[
+AC_TRY_COMPILE(,[
+    char *cp = __FUNCTION__;
+], ac_cv_HAVE_CPP_UNDERBAR_FUNCTION_DEFINED=yes, ac_cv_HAVE_CPP_UNDERBAR_FUNCTION_DEFINED=no)])
+
+if test "x$ac_cv_HAVE_CPP_UNDERBAR_FUNCTION_DEFINED" = "xyes"; then
+  AC_DEFINE(HAVE_CPP_UNDERBAR_FUNCTION_DEFINED)
+fi
+
+AC_CHECK_STRUCT_FOR([
+#ifdef HAVE_SYS_PARAM_H
+#include <sys/param.h>
+#endif
+#include <sys/types.h>
+#include <sys/signal.h>
+], sigaction, sa_sigaction, no)
+
+AC_CHECK_STRUCT_FOR([
+#ifdef HAVE_SYS_PARAM_H
+#include <sys/param.h>
+#endif
+#include <sys/types.h>
+#define KERNEL
+#define _KERNEL
+#include <sys/socket.h>
+#undef KERNEL
+#undef _KERNEL
+], sockaddr, sa_len, no)
+
+AC_CHECK_STRUCT_FOR([
+#ifdef HAVE_SYS_PARAM_H
+#include <sys/param.h>
+#endif
+#include <sys/types.h>
+#define KERNEL
+#define _KERNEL
+#include <sys/socket.h>
+#undef KERNEL
+#undef _KERNEL
+], sockaddr, sa_union.sa_generic.sa_family2, no)
+
+AC_CHECK_STRUCT_FOR([
+#ifdef HAVE_SYS_PARAM_H
+#include <sys/param.h>
+#endif
+#include <sys/types.h>
+#define KERNEL
+#define _KERNEL
+#include <sys/socket.h>
+#undef KERNEL
+#undef _KERNEL
+#include <net/route.h>
+], rtentry, rt_dst, no)
+
+dnl checking for 4.3 vs 4.4 rtentry.
+AC_CACHE_CHECK(type of rtentry structure,ac_cv_RTENTRY_TYPE,
+[
+
+dnl 4.4 compat
+AC_TRY_COMPILE([
+#ifdef HAVE_SYS_PARAM_H
+#include <sys/param.h>
+#endif
+#include <sys/types.h>
+#define KERNEL
+#define _KERNEL
+#include <sys/socket.h>
+#undef KERNEL
+#undef _KERNEL
+#include <net/route.h>
+],[
+
+#ifndef STRUCT_RTENTRY_HAS_RT_DST
+#define rt_dst rt_nodes->rn_key
+#endif
+
+  struct rtentry rt; 
+  rt.rt_nodes[0].rn_flags = 1;
+  rt.rt_dst;
+  ], ac_cv_RTENTRY_TYPE="BSD-4.4")
+
+dnl 4.3 compat
+if test "x$ac_cv_RTENTRY_TYPE" = "x"; then
+AC_TRY_COMPILE([
+#ifdef HAVE_SYS_PARAM_H
+#include <sys/param.h>
+#endif
+#include <sys/types.h>
+#define KERNEL
+#define _KERNEL
+#include <sys/socket.h>
+#undef KERNEL
+#undef _KERNEL
+#include <net/route.h>
+],[
+struct rtentry rt; 
+rt.rt_hash;
+], ac_cv_RTENTRY_TYPE="BSD-4.3")
+fi
+
+dnl else ack.
+if test "x$ac_cv_RTENTRY_TYPE" = "x"; then
+  AC_MSG_RESULT(Unknown)
+  ac_cv_RTENTRY_TYPE="unknown"
+fi
+
+])
+
+if test "x$ac_cv_RTENTRY_TYPE" = "xBSD-4.4"; then
+  AC_DEFINE(RTENTRY_4_4)
+fi
+
+dnl checking for alpha's ortentry vs rtentry
+if test "x$ac_cv_RTENTRY_TYPE" = "xunknown"; then
+AC_CACHE_CHECK(for struct rtentry, ac_cv_struct_rtentry,
+[AC_EGREP_CPP(ortentry, [#define KERNEL
+#include <net/route.h>
+],  ac_cv_struct_rtentry=ortentry,  ac_cv_struct_rtentry=rtentry )
+if test "x$ac_cv_struct_rtentry" = "xrtentry" ; then
+  ac_cv_struct_rtentry="rtentry"
+else
+  ac_cv_struct_rtentry="ortentry"
+fi
+])
+else
+  RTENTRY_TYPE="rtentry"
+  ac_cv_struct_rtentry="rtentry"
+fi
+
+if test "x$ac_cv_struct_rtentry" != "x"; then
+  AC_DEFINE_UNQUOTED(RTENTRY,struct ${ac_cv_struct_rtentry})
+else
+  AC_DEFINE(RTENTRY,struct rtentry)
+fi
+
+dnl check for 4.3's rtentry->rt_next
+if test "x$ac_cv_RTENTRY_TYPE" = "xBSD-4.3"; then
+AC_CACHE_CHECK(for struct rtentry has a rt_next node, 
+	ac_cv_struct_rtentry_rt_next,
+[
+AC_TRY_COMPILE([
+#ifdef HAVE_SYS_PARAM_H
+#include <sys/param.h>
+#endif
+#include <sys/types.h>
+#define KERNEL
+#define _KERNEL
+#include <sys/socket.h>
+#undef KERNEL
+#undef _KERNEL
+#include <net/route.h>
+],[
+struct rtentry rt; 
+rt.rt_next;
+], ac_cv_struct_rtentry_rt_next=yes,  ac_cv_struct_rtentry_rt_next=no )
+])
+
+if test "x$ac_cv_struct_rtentry_rt_next" = "xyes"; then
+  AC_DEFINE(RTENTRY_RT_NEXT)
+fi
+
+fi
+
+dnl Check struct rtentry for various things.
+AC_CHECK_STRUCT_FOR([
+#ifdef HAVE_SYS_PARAM_H
+#include <sys/param.h>
+#endif
+#include <sys/types.h>
+#define KERNEL
+#define _KERNEL
+#include <sys/socket.h>
+#undef KERNEL
+#undef _KERNEL
+#include <net/route.h>
+], rtentry, rt_unit)
+
+AC_CHECK_STRUCT_FOR([
+#ifdef HAVE_SYS_PARAM_H
+#include <sys/param.h>
+#endif
+#include <sys/types.h>
+#define KERNEL
+#define _KERNEL
+#include <sys/socket.h>
+#undef KERNEL
+#undef _KERNEL
+#include <net/route.h>
+], rtentry, rt_refcnt)
+
+AC_CHECK_STRUCT_FOR([
+#ifdef HAVE_SYS_PARAM_H
+#include <sys/param.h>
+#endif
+#include <sys/types.h>
+#define KERNEL
+#define _KERNEL
+#include <sys/socket.h>
+#undef KERNEL
+#undef _KERNEL
+#include <net/route.h>
+], rtentry, rt_hash)
+
+AC_CHECK_STRUCT_FOR([
+#ifdef HAVE_SYS_PARAM_H
+#include <sys/param.h>
+#endif
+#include <sys/types.h>
+#define KERNEL
+#define _KERNEL
+#include <sys/socket.h>
+#undef KERNEL
+#undef _KERNEL
+#include <net/route.h>
+], rtentry, rt_use)
+
+dnl Check tcpstat for tcpstat.tcp_rcvmemdrop
+AC_CHECK_STRUCT_FOR([
+#ifdef HAVE_SYS_PARAM_H
+#include <sys/param.h>
+#endif
+#include <sys/types.h>
+#include <netinet/tcp.h>
+#ifdef HAVE_NETINET_TCP_TIMER_H
+#include <netinet/tcp_timer.h>
+#endif
+
+#ifdef HAVE_NETINET_TCP_VAR_H
+#include <netinet/tcp_var.h>
+#endif
+], tcpstat, tcp_rcvmemdrop)
+
+dnl irix checks
+
+AC_CHECK_STRUCT_FOR([
+#ifdef HAVE_SYS_PARAM_H
+#include <sys/param.h>
+#endif
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <net/if.h>
+#ifdef HAVE_NET_IF_VAR_H
+#include <net/if_var.h>
+#endif
+], ifnet, if_mtu)
+
+if test "x$ac_cv_struct_ifnet_has_if_mtu" = "xno"; then
+AC_CACHE_CHECK(if _KERNEL needs to be defined for if_mtu, ac_cv_IFNET_NEEDS_KERNEL,
+[
+if test "x$ac_cv_struct_ifnet_has_if_mtu" = "xyes"; then
+  ac_cv_IFNET_NEEDS_KERNEL=no
+else
+AC_TRY_COMPILE([
+#define _KERNEL 1
+#ifdef HAVE_SYS_PARAM_H
+#include <sys/param.h>
+#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
+],[
+struct ifnet testit;
+testit.if_mtu = 0;
+], ac_cv_IFNET_NEEDS_KERNEL=yes, ac_cv_IFNET_NEEDS_KERNEL=no)
+fi
+])
+
+if test "x$ac_cv_IFNET_NEEDS_KERNEL" = "xyes"; then
+  AC_DEFINE(IFNET_NEEDS_KERNEL)
+fi
+fi
+
+AC_CHECK_STRUCT_FOR([
+#ifdef IFNET_NEEDS_KERNEL
+#define _KERNEL 1
+#endif
+#ifdef HAVE_SYS_PARAM_H
+#include <sys/param.h>
+#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
+], ifaddr, ifa_next)
+
+dnl Check ifnet entries using macro defined in aclocal.m4.
+dnl
+dnl XXX  Broken on FreeBSD where these are #define'd in <net/if.h>
+dnl
+AC_CHECK_IFNET_FOR(if_baudrate)
+AC_CHECK_IFNET_FOR(if_baudrate.ifs_value)
+AC_CHECK_IFNET_FOR(if_speed)
+AC_CHECK_IFNET_FOR(if_type)
+AC_CHECK_IFNET_FOR(if_imcasts)
+AC_CHECK_IFNET_FOR(if_iqdrops)
+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_obytes)
+AC_CHECK_IFNET_FOR(if_ibytes)
+AC_CHECK_IFNET_FOR(if_addrlist)
+AC_CHECK_IFNET_FOR(if_addrhead.tqh_first)
+
+AC_CHECK_STRUCT_FOR([
+#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
+#if HAVE_NETINET_UDP_H
+#include <netinet/udp.h>
+#endif
+#if HAVE_NETINET_UDP_VAR_H
+#include <netinet/udp_var.h>
+#endif
+],udpstat,udps_discard)
+
+AC_CHECK_STRUCT_FOR([
+#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
+#if HAVE_NETINET_UDP_H
+#include <netinet/udp.h>
+#endif
+#if HAVE_NETINET_UDP_VAR_H
+#include <netinet/udp_var.h>
+#endif
+],udpstat,udps_noport)
+
+AC_CHECK_STRUCT_FOR([
+#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
+#if HAVE_NETINET_UDP_H
+#include <netinet/udp.h>
+#endif
+#if HAVE_NETINET_UDP_VAR_H
+#include <netinet/udp_var.h>
+#endif
+],udpstat,udps_noportbcast)
+
+AC_CHECK_STRUCT_FOR([
+#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
+#if HAVE_NETINET_UDP_H
+#include <netinet/udp.h>
+#endif
+#if HAVE_NETINET_UDP_VAR_H
+#include <netinet/udp_var.h>
+#endif
+],udpstat,udps_fullsock)
+
+AC_CHECK_STRUCT_FOR([
+#ifdef HAVE_SYS_PARAM_H
+#include <sys/param.h>
+#endif
+#include <sys/types.h>
+#include <sys/socket.h>
+#ifdef HAVE_SYS_TIME_H
+#include <sys/time.h>
+#endif
+#include <net/if.h>
+#if HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+#if HAVE_NETINET_IF_ETHER_H
+#include <netinet/if_ether.h>
+#endif
+],arphd,at_next)
+
+AC_CHECK_STRUCT_FOR([
+#if HAVE_SYS_CONF_H
+#include <sys/conf.h>
+#endif
+],swdevt,sw_nblksenabled)
+
+AC_CHECK_STRUCT_FOR([
+#ifdef HAVE_SYS_STAT_H
+#include <sys/stat.h>
+#endif
+#if HAVE_SYS_STATFS_H
+#include <sys/statfs.h>
+#endif
+#if HAVE_SYS_STATVFS_H
+#include <sys/statvfs.h>
+#endif
+],statvfs,f_frsize)
+
+AC_CHECK_STRUCT_FOR([
+#ifdef HAVE_SYS_STAT_H
+#include <sys/stat.h>
+#endif
+#if HAVE_SYS_STATFS_H
+#include <sys/statfs.h>
+#endif
+#if HAVE_SYS_STATVFS_H
+#include <sys/statvfs.h>
+#endif
+],statvfs,f_files)
+
+AC_CHECK_STRUCT_FOR([
+#ifdef HAVE_SYS_STAT_H
+#include <sys/stat.h>
+#endif
+#if HAVE_SYS_STATFS_H
+#include <sys/statfs.h>
+#endif
+#ifdef HAVE_SYS_PARAM_H
+#include <sys/param.h>
+#include <sys/types.h>
+#endif
+#ifdef HAVE_SYS_MOUNT_H
+#include <sys/mount.h>
+#endif
+],statfs,f_files)
+
+AC_CHECK_STRUCT_FOR([
+#ifdef HAVE_SYS_STAT_H
+#include <sys/stat.h>
+#endif
+#if HAVE_SYS_STATFS_H
+#include <sys/statfs.h>
+#endif
+#ifdef HAVE_SYS_PARAM_H
+#include <sys/param.h>
+#include <sys/types.h>
+#endif
+#ifdef HAVE_SYS_MOUNT_H
+#include <sys/mount.h>
+#endif
+],statfs,f_ffree)
+
+AC_CHECK_STRUCT_FOR([
+#ifdef HAVE_SYS_STAT_H
+#include <sys/stat.h>
+#endif
+#if HAVE_SYS_STATFS_H
+#include <sys/statfs.h>
+#endif
+#ifdef HAVE_SYS_PARAM_H
+#include <sys/param.h>
+#include <sys/types.h>
+#endif
+#ifdef HAVE_SYS_MOUNT_H
+#include <sys/mount.h>
+#endif
+],statfs,f_favail)
+
+AC_CHECK_STRUCT_FOR([
+#if HAVE_NLIST_H
+#include <nlist.h>
+#endif
+],nlist,n_value)
+
+dnl check struct ipstat for various things
+AC_CHECK_STRUCT_FOR([
+#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
+], ipstat, ips_cantforward)
+
+AC_CHECK_STRUCT_FOR([
+#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
+], ipstat, ips_cantfrag)
+
+AC_CHECK_STRUCT_FOR([
+#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
+], ipstat, ips_delivered)
+
+AC_CHECK_STRUCT_FOR([
+#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
+], ipstat, ips_fragdropped)
+
+AC_CHECK_STRUCT_FOR([
+#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
+], ipstat, ips_fragtimeout)
+
+AC_CHECK_STRUCT_FOR([
+#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
+], ipstat, ips_localout)
+
+AC_CHECK_STRUCT_FOR([
+#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
+], ipstat, ips_noproto)
+
+AC_CHECK_STRUCT_FOR([
+#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
+], ipstat, ips_noroute)
+
+AC_CHECK_STRUCT_FOR([
+#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
+], ipstat, ips_odropped)
+
+AC_CHECK_STRUCT_FOR([
+#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
+], ipstat, ips_ofragments)
+
+AC_CHECK_STRUCT_FOR([
+#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
+], ipstat, ips_reassembled)
+
+dnl check for the des_ks_struct.weak_key attribute, which indicates the 
+dnl older opensll version is being used.
+if test "x$ac_cv_header_openssl_des_h" = "xyes" ; then
+AC_CHECK_STRUCT_FOR([
+#include <openssl/des.h>
+], des_ks_struct, weak_key)
+fi
+
+dnl attempt to figure out if sysctl is usable
+
+if test $cross_compiling = yes; then
+  AC_MSG_WARN([Can't check sysctl, manually define CAN_USE_SYSCTL if platform support available])
+else
+  AC_CACHE_CHECK(if sysctl can read kernel information,ac_cv_CAN_USE_SYSCTL,
+  [AC_TRY_RUN([
+#if TIME_WITH_SYS_TIME
+# include <sys/time.h>
+# include <time.h>
+#else
+# if HAVE_SYS_TIME_H
+#  include <sys/time.h>
+# else
+#  include <time.h>
+# endif
+#endif
+#if HAVE_SYS_PARAM_H
+# include <sys/param.h>
+#endif
+#include <sys/types.h>
+#if HAVE_SYS_SYSCTL_H
+# include <sys/sysctl.h>
+#endif
+
+main() {
+  int                 mib[2];
+  size_t              len;
+  struct timeval boottime;
+  
+  mib[0] = CTL_KERN;
+  mib[1] = KERN_BOOTTIME;
+  
+  len = sizeof(boottime);
+  sysctl(mib, 2, &boottime, &len, NULL, NULL);
+  if (boottime.tv_sec != 0)
+    exit(0);
+  else
+    exit(1);
+}
+  ], ac_cv_CAN_USE_SYSCTL=yes, ac_cv_CAN_USE_SYSCTL=no, ac_cv_CAN_USE_SYSCTL=no)])
+fi
+
+if test "x$ac_cv_CAN_USE_SYSCTL" = "xyes"; then
+  AC_DEFINE(CAN_USE_SYSCTL)
+fi
+
+dnl
+dnl In FreeBSD 4.x, the TCP timer constants aren't.  They are defined
+dnl in terms of `hz', the kernel clock tick.  In this case,
+dnl we need to have a local variable `hz' in scope and set to a useful
+dnl value whenever we use one of these constants.
+dnl
+AC_CACHE_CHECK(whether TCP timers depend on \`hz',ac_cv_TCPTV_NEEDS_HZ,
+[AC_EGREP_CPP(hz,
+[#include <netinet/tcp_timer.h>
+TCPTV_SRTTDFLT
+], ac_cv_TCPTV_NEEDS_HZ=yes, ac_cv_TCPTV_NEEDS_HZ=no)])
+
+if test "x$ac_cv_TCPTV_NEEDS_HZ" = "xyes"; then
+  AC_DEFINE(TCPTV_NEEDS_HZ)
+fi
+
+dnl
+dnl define the agent libraries variable
+dnl
+AC_SUBST(AGENTLIBS)
+AC_SUBST(OTHERAGENTLIBOBJS)
+AC_SUBST(OTHERAGENTLIBLOBJS)
+
+dnl
+dnl Prompt for various bits of user information
+dnl
+
+if test "x$ac_cv_user_prompt_LOGFILE" = "x" -o "x$ac_cv_user_prompt_SYS_LOC" = "x" -o "x$ac_cv_user_prompt_SYS_CONTACT" = "x" -o "x$ac_cv_user_prompt_DEFAULT_SNMP_VERSION" = "x"; then
+AC_CACHE_CHECK(if you have run configure before, ac_cv_have_warned,
+[
+if test "x$defaults" = "xno"; then
+cat << EOF
+
+	 ************** Configuration Section **************
+
+	You are about to be prompted with a series of questions.  Answer
+them carefully, as they determine how the SNMP agent and related
+applications are to function.
+
+	After the configure script finishes, you can browse the newly
+created config.h file for further - less important - parameters to
+modify.  Be careful if you re-run configure though, since config.h will
+be overwritten.
+
+-Press return to continue-
+EOF
+
+read tmpinput
+ac_cv_have_warned="yes"
+echo $ac_n "disabling above prompt for future runs...  $ac_c"
+else
+  ac_cv_have_warned="no"
+fi
+])
+else
+  ac_cv_have_warned="yes"
+fi
+
+ME=`$WHOAMI`
+if test -f /etc/resolv.conf; then
+  LOC=`cat /etc/resolv.conf | grep '^domain' | tail -1 | awk '{print $NF}'`
+else
+  LOC="@no.where"
+fi
+
+AC_PROMPT_USER(DEFAULT_SNMP_VERSION,[
+
+*** Default SNMP Version:
+
+	Starting with Net-SNMP 5.0, you can choose the default version of
+the SNMP protocol to use when no version is given explicitly on the
+command line, or via an 'snmp.conf' file.  In the past this was set to
+SNMPv1, but you can use this to switch to SNMPv3 if desired.  SNMPv3
+will provide a more secure management environment (and thus you're
+encouraged to switch to SNMPv3), but may break existing scripts that
+rely on the old behaviour.  (Though such scripts will probably need to
+be changed to use the '-c' community flag anyway, as the SNMPv1
+command line usage has changed as well.).
+   At this prompt you can select \"1\", \"2\" (for SNMPv2c), or \"3\" as
+the default version for the command tools (snmpget, ...) to use.  This
+can always be overridden at runtime using the -v flag to the tools, or
+by using the \"defVersion\" token in your snmp.conf file.
+   Providing the --with-default-snmp-version=\"x\" parameter to ./configure
+will avoid this prompt.
+
+Default version of SNMP to use],3,unquoted)
+
+dnl we tested this above before the prompt, but the prompt may give a new value.
+if test "$ac_cv_user_prompt_DEFAULT_SNMP_VERSION" != "1" -a "$ac_cv_user_prompt_DEFAULT_SNMP_VERSION" != "2" -a "$ac_cv_user_prompt_DEFAULT_SNMP_VERSION" != "3"; then
+  AC_MSG_ERROR([Illegal version number.  Only 1, 2 (for SNMPv2c) and 3 are supported.])
+fi
+
+AC_PROMPT_USER(SYS_CONTACT,[
+
+*** System Contact Information:
+
+	Describes who should be contacted about the host the agent is
+running on.  This information is available in the MIB-II tree.  This
+can also be over-ridden using the \"syscontact\" syntax in the agent's
+configuration files.
+  Providing the --with-sys-contact=\"contact\" parameter to ./configure
+will avoid this prompt.
+
+System Contact Information],$ME@$LOC,quoted)
+
+AC_PROMPT_USER(SYS_LOC,[
+
+*** System Location:
+
+	Describes the location of the system.  This information is
+available in the MIB-II tree.  this can also be over-ridden using the
+\"syslocation\" syntax in the agent's configuration files.
+  Providing the --with-sys-location=\"location\" parameter to ./configure
+will avoid this prompt.
+
+System Location],Unknown,quoted)
+
+if test -d /var/log; then
+  defaultlog="/var/log/snmpd.log"
+else
+  defaultlog="/usr/adm/snmpd.log"
+fi
+  
+AC_PROMPT_USER(LOGFILE,[
+
+*** Logfile location:
+
+	Enter the default location for the snmpd agent to dump
+information & errors to.  If not defined (enter the keyword \"none\"
+at the prompt below) the agent will use stdout and stderr instead.
+(Note: This value can be over-ridden using command line options.)
+  Providing the --with-logfile=\"path\" parameter to ./configure
+will avoid this prompt.
+
+Location to write logfile],$defaultlog,quoted)
+
+if test -d /var; then
+  defaultstore="/var/net-snmp"
+  ucddefaultstore="/var/ucd-snmp"
+else
+  defaultstore="/etc/net-snmp"
+  ucddefaultstore="/etc/ucd-snmp"
+fi
+  
+AC_PROMPT_USER(PERSISTENT_DIRECTORY,[
+
+*** snmpd persistent storage location:
+
+	Enter a directory for the SNMP library to store persistent
+data in the form of a configuration file.  This default location is
+different than the old default location (which was for ucd-snmp).  If
+you stay with the new path, I'll ask you in a second if you wish to
+copy your files over to the new location (once only).  If you pick
+some other path than the default, you'll have to copy them yourself.
+There is nothing wrong with picking the old path ($ucddefaultstore) if
+you'd rather.
+  Providing the --with-persistent-directory=\"path\" parameter to
+./configure will avoid this prompt.
+
+Location to write persistent information],$defaultstore,quoted)
+
+PERSISTENT_DIRECTORY=$ac_cv_user_prompt_PERSISTENT_DIRECTORY
+AC_SUBST(PERSISTENT_DIRECTORY)
+UCDPERSISTENT_DIRECTORY=$ucddefaultstore
+AC_SUBST(UCDPERSISTENT_DIRECTORY)
+
+if test $PERSISTENT_DIRECTORY = "$defaultstore" -a -d "$ucddefaultstore" -a ! -d "$defaultstore" ; then
+AC_CACHE_CHECK(If we should copy the old persistent directory, ac_cv_user_prompt_COPY_PERSISTENT_FILES,
+[
+AC_PROMPT_USER_NO_DEFINE(ac_cv_user_prompt_COPY_PERSISTENT_FILES,[
+
+*** Copying old ucd-snmp persistent files to net-snmp persistent directory:
+
+	Would you like to copy the older ucd-snmp persistent files
+into your new net-snmp persistent file path?  This will functionally
+save all your ucd-snmp data and let it be used within the net-snmp
+tools.  This will only be done once when you run make install.  If you
+wish to do this, enter "yes" at the prompt.
+  Providing the --with-copy-persistent-files=\"no\" (or \"yes\")
+parameters to ./configure will avoid this prompt.
+
+Copy ucd-snmp data into the net-snmp data directory],"yes")
+])
+else
+ac_cv_user_prompt_COPY_PERSISTENT_FILES="no"
+fi
+COPY_PERSISTENT_FILES="$ac_cv_user_prompt_COPY_PERSISTENT_FILES"
+AC_SUBST(COPY_PERSISTENT_FILES)
+
+AC_SUBST(DLLIBS)
+
+AC_OUTPUT([
+ Makefile:Makefile.top:Makefile.in:Makefile.rules
+ snmplib/Makefile:Makefile.top:snmplib/Makefile.in:Makefile.rules:snmplib/Makefile.depend
+ apps/Makefile:Makefile.top:apps/Makefile.in:Makefile.rules:apps/Makefile.depend
+ apps/snmpnetstat/Makefile:Makefile.top:apps/snmpnetstat/Makefile.in:Makefile.rules:apps/snmpnetstat/Makefile.depend
+ agent/Makefile:Makefile.top:agent/Makefile.in:Makefile.rules:agent/Makefile.depend
+ agent/helpers/Makefile:Makefile.top:agent/helpers/Makefile.in:Makefile.rules:agent/helpers/Makefile.depend
+ agent/mibgroup/Makefile:Makefile.top:agent/mibgroup/Makefile.in:Makefile.rules:agent/mibgroup/Makefile.depend
+ local/Makefile:Makefile.top:local/Makefile.in:Makefile.rules
+ testing/Makefile:Makefile.top:testing/Makefile.in
+ man/Makefile:Makefile.top:man/Makefile.in:Makefile.rules
+ mibs/Makefile:Makefile.top:mibs/Makefile.in:Makefile.rules
+ net-snmp-config:net-snmp-config.in
+], [
+ echo timestamp > stamp-h
+ chmod 755 net-snmp-config
+])
+
+AC_MSG_CACHE_DISPLAY()
+
+dnl Local Variables:
+dnl mode: Autoconf
+dnl comment-start: "dnl"
+dnl End:
diff -Naur tomato/release/src/router/snmp/configure.mnttab tomato121/release/src/router/snmp/configure.mnttab
--- tomato/release/src/router/snmp/configure.mnttab	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/configure.mnttab	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,18446 @@
+#! /bin/sh
+
+# Guess values for system-dependent variables and create Makefiles.
+# Generated automatically using autoconf version 2.13 
+# Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc.
+#
+# This configure script is free software; the Free Software Foundation
+# gives unlimited permission to copy, distribute and modify it.
+
+# Defaults:
+ac_help=
+ac_default_prefix=/usr/local
+# Any additions from configure.in:
+ac_help="$ac_help
+
+Compiler Options:
+  --with-cc=CC                    use CC to compile (default=gcc)."
+ac_help="$ac_help
+  --with-ar=AR                    use AR as the archiver."
+ac_help="$ac_help
+  --with-endianness=big|little    define endianness of target platform when
+                                  cross-compiling."
+ac_help="$ac_help
+  --with-cflags=CFLAGS            use CFLAGS as compile time arguments."
+ac_help="$ac_help
+  --with-ldflags=LDFLAGS          use LDFLAGS as link time arguments to ld."
+ac_help="$ac_help
+  --with-libs=LIBS                use LIBS as link time arguments to ld."
+ac_help="$ac_help
+  --enable-silent-libtool         Pass --silent to libtool."
+ac_help="$ac_help
+  --enable-mini-agent             Build a minimal agent."
+ac_help="$ac_help
+  --enable-ipv6                   Generate IPv6 ready version."
+ac_help="$ac_help
+  --enable-debugging              Outputs extra debugging information at all
+                                  times.  Normally, you should not enable this,
+                                  but instead use the -D flag of the commands,
+                                  which toggles debbuging output at runtime.
+  --disable-debugging             Disallows debugging code to be built in.
+                                  This might provide some speed benefits."
+ac_help="$ac_help
+  --enable-developer              Turns on super-duper-extra-compile-warnings
+                                  when using gcc."
+ac_help="$ac_help
+  --with-dmalloc=PATH             Use dmalloc library (www.dmalloc.com)"
+ac_help="$ac_help
+  --with-efence                   Look for and use libefence (malloc)."
+ac_help="$ac_help
+  --with-rsaref=PATH              Look for librsaref in PATH/lib."
+ac_help="$ac_help
+  --with-openssl=PATH             Look for openssl in PATH/lib."
+ac_help="$ac_help
+  --disable-privacy               Don't compile in support for privacy."
+ac_help="$ac_help
+  --enable-internal-md5           Use the internal MD5 support."
+ac_help="$ac_help
+  --without-opaque-special-types  Don't use special opaque encodings.
+                                  SNMP normally cannot handle
+                                  floating numbers, nor large 64 bit
+                                  integers well.  By default, the
+                                  net-snmp package compiles in
+                                  support for these extra datatypes
+                                  (in a legal way)"
+ac_help="$ac_help
+  --with-mibdirs=\"dir1:dir2:\"     Default directories to look for mibs.
+                                    (Default: \$HOME/.snmp/mibs:DATADIR/snmp/mibs)"
+ac_help="$ac_help
+  --with-mibs=\"item1:item2:\"      Default mib IDs to read.
+                                    (The default list is \"IP-MIB:IF-MIB:
+                                    TCP-MIB:UDP-MIB:SNMPv2-MIB:RFC1213-MIB\"
+                                    with the addition of any mibs used
+                                    by the mib modules the agent is
+                                    configured with)"
+ac_help="$ac_help
+  --with-mibfiles=\"file1:file2\"   Default mib files to load.
+                                    (Default:  none.  uses IDs above instead.)"
+ac_help="$ac_help
+  --enable-testing-code           Enables some code sections that should 
+                                  only be used for testing of certain
+                                  SNMP functionalities.  This should *not* 
+                                  be turned on for production use.  Ever."
+ac_help="$ac_help
+  --enable-reentrant              Enables locking functions that protect
+                                  library resources in some multi-threading
+                                  environments.  This does not guarantee
+                                  thread-safe operation.
+                                  Currently an experimental setting."
+ac_help="$ac_help
+
+Configuring the agent:
+  --without-root-access           The snmpd agent won't require root access to
+                                  run it.  The information it returns in the
+                                  mib-II tree may not be correct, however."
+ac_help="$ac_help
+
+Configuring the agent:
+  --without-kmem-usage            Do not include any code related to the use
+                                  of kmem. This option can only be used with
+                                  the option --enable-mini-agent."
+ac_help="$ac_help
+  --with-dummy-values             Provide 'placeholder' dummy values where
+                                  the necessary information is not available.
+                                  This is technically not compliant with the
+                                  SNMP specifications, but was how the agent
+                                  operated for versions < 4.0."
+ac_help="$ac_help
+  --with-persistent-directory=\"directory\"
+                                  Default directory for persistent data storage."
+ac_help="$ac_help
+  --with-copy-persistent-files=\"no\" Don't copy persistent files
+                                       (or use \"yes\" to copy them).
+                                       (Default: yes)"
+ac_help="$ac_help
+  --with-default-snmp-version=\"3\" Default version of SNMP to use.
+                                  (Default: 3)
+                                  Legal values: 1, 2 (for SNMPv2c) or 3."
+ac_help="$ac_help
+  --with-sys-contact=\"who@where\"  Default system contact.
+                                    (Default: LOGIN@DOMAINNAME)"
+ac_help="$ac_help
+  --with-sys-location=\"location\"  Default system location.
+                                    (Default: Unknown)"
+ac_help="$ac_help
+  --with-logfile=\"location\"       Default log file location for snmpd."
+ac_help="$ac_help
+  --with-transports=\"t1 t2 ...\"   Compile in the given SNMP transport
+                                    modules (space separated list)."
+ac_help="$ac_help
+  --with-out-transports=\"t1 ...\"  Exclude listed SNMP transports
+                                    (space separated list).
+
+  Available SNMP transport modules are:
+
+    UDP         support for SNMP over UDP/IP.
+                This transport is always compiled in.
+    UDPIPv6     support for SNMP over UDP/IPv6.
+                This transport is available for Linux, Solaris and
+                FreeBSD.
+                It is never compiled in by default.
+    TCPIPv6     support for SNMP over UDP/IPv6.
+                This transport is available for Linux, Solaris and
+                FreeBSD.
+                It is never compiled in by default.
+    TCP         support for SNMP over TCP/IP.
+                This transport is compiled in by default, but may be omitted.
+    Unix        support for SNMP over Unix domain protocols.
+                This transport is compiled in by default except on Win32
+                platforms, and may be omitted.
+    Callback    support for SNMP over an internal locally connected pair
+                of snmp_sessions.
+    AAL5PVC     support for SNMP over AAL5 PVCs.
+                This transport is presently only available for Linux,
+                is never compiled in by default and may be omitted.
+    IPX         support for SNMP over IPX per RFC 1420.
+                This transport is presently only available for Linux,
+                is never compiled in by default and may be omitted.
+"
+ac_help="$ac_help
+"
+ac_help="$ac_help
+"
+ac_help="$ac_help
+  --with-security-modules=\"s1 s2 ...\"   Compile in the given SNMP security
+                                    module services (space separated list).
+
+  Available SNMP security services:
+
+        usm                support for user based SNMP security
+                           (required and always compiled in)
+        ksm                support for kerberos based SNMP security
+"
+ac_help="$ac_help
+  --with-mib-modules=\"item1 ...\"  Compile with additional mib modules
+                                    (Space separated list)."
+ac_help="$ac_help
+  --with-out-mib-modules=\"list\"   Compile without these mib modules.
+
+  Default mib modules compiled into the agent (which can be removed):
+  
+    mibII                  support for the mib-II tree.
+    snmpv3mibs             support for the snmpv3 mib modules.
+    ucd_snmp               UCD-SNMP-MIB specific extensions.
+    agent_mibs             NET-SNMP-AGENT-MIB extensions
+    agentx                 (see below)
+    notification           mibs supporting specification of trap destinations.
+    target                 Support for the SNMP WGs TARGET-MIB.
+    utilities              general agent configuration utilities.
+
+  Optional mib modules that can be built into the agent include:
+    host                   host resources mib support.
+                             (beta level code for linux, hpux, solaris, bsdi)
+    disman/event-mib       support for the DISMAN-EVENT-MIB (beta)
+                             (supports self monitoring and notification 
+                              delivery when error conditions are found)
+    smux                   smux support to allow subagents to attach to snmpd.
+    mibII/mta_sendmail     Sendmail statistics monitoring (MTA-MIB)
+    misc/ipfwacc           accounting rules IP firewall information (linux).
+    ipfwchains/ipfwchains  firewall chains under ipfw for linux.
+                           (Download separately from the ucd-snmp ftp site.)
+    ucd-snmp/diskio        Table of io-devices and how much data they have
+                           read/written.  (only tested on Solaris)
+    tunnel                 Linux TUNNEL-MIB support (ifTable extension)
+
+  AgentX support:  (warning: beta code)
+    agentx/subagent        allows the agent to run as either a snmp agent
+                           or as an agentX sub-agent.
+    agentx/master          makes the agent run as an agentX master agent
+                           as well as a normal snmp agent.
+    agentx                 includes both agentx/master and agentx/client.
+
+  Optional modules for C coders to look at and/or include as extension examples:
+  
+    examples/ucdDemoPublic  SNMPv3 interoperability testing mib.
+    examples/example        example C code extension."
+ac_help="$ac_help
+Enterprise OIDs:  (warning: this should be used with caution.)
+
+  --with-enterprise-oid              The enterprise number assigned to the
+                                     vendor by IANA.  See
+                                     http://www.iana.org/cgi-bin/enterprise.pl
+                                     to get one, though using the default is
+                                     probably the right choice is most cases.
+                                     (default 8072 = "enterprise.net-snmp")"
+ac_help="$ac_help
+
+  --with-enterprise-sysoid           The base OID for the sysObjectID
+                                     of the system group
+                                     (default .1.3.6.1.4.1.8072.3.2... = 
+                                      "netSnmpAgentOIDs...")"
+ac_help="$ac_help
+
+  --with-enterprise-notification-oid The OID used for the root of
+				     enterprise specific notifications.
+                                     (default .1.3.6.1.4.1.2021 = "enterprise.ucdavis")"
+ac_help="$ac_help
+"
+ac_help="$ac_help
+"
+ac_help="$ac_help
+
+Perl:
+  --with-perl-modules[=ARGS]      Install the perl modules along with the rest
+                                  of the net-snmp toolkit.  If ARGS is
+                                  specified, they're passed to the
+                                  Makefile.PL script."
+ac_help="$ac_help
+
+  --enable-embedded-perl          Embed perl in the SNMP agent.
+                                  [forces --with-perl-modules as well.]"
+ac_help="$ac_help
+
+Miscellaneous:
+  --with-defaults          Use defaults for prompted values."
+ac_help="$ac_help
+--enable-ucd-snmp-compatibility  Install ucd-snmp look-alike headers and libs."
+ac_help="$ac_help
+  --enable-shared[=PKGS]  build shared libraries [default=yes]"
+ac_help="$ac_help
+  --enable-static[=PKGS]  build static libraries [default=yes]"
+ac_help="$ac_help
+  --enable-fast-install[=PKGS]  optimize for fast installation [default=yes]"
+ac_help="$ac_help
+  --with-gnu-ld           assume the C compiler uses GNU ld [default=no]"
+
+# Find the correct PATH separator.  Usually this is `:', but
+# DJGPP uses `;' like DOS.
+if test "X${PATH_SEPARATOR+set}" != Xset; then
+  UNAME=${UNAME-`uname 2>/dev/null`}
+  case X$UNAME in
+    *-DOS) lt_cv_sys_path_separator=';' ;;
+    *)     lt_cv_sys_path_separator=':' ;;
+  esac
+  PATH_SEPARATOR=$lt_cv_sys_path_separator
+fi
+
+
+# Check that we are running under the correct shell.
+SHELL=${CONFIG_SHELL-/bin/sh}
+
+case X$ECHO in
+X*--fallback-echo)
+  # Remove one level of quotation (which was required for Make).
+  ECHO=`echo "$ECHO" | sed 's,\\\\\$\\$0,'$0','`
+  ;;
+esac
+
+echo=${ECHO-echo}
+if test "X$1" = X--no-reexec; then
+  # Discard the --no-reexec flag, and continue.
+  shift
+elif test "X$1" = X--fallback-echo; then
+  # Avoid inline document here, it may be left over
+  :
+elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then
+  # Yippee, $echo works!
+  :
+else
+  # Restart under the correct shell.
+  exec $SHELL "$0" --no-reexec ${1+"$@"}
+fi
+
+if test "X$1" = X--fallback-echo; then
+  # used as fallback echo
+  shift
+  cat <<EOF
+
+EOF
+  exit 0
+fi
+
+# The HP-UX ksh and POSIX shell print the target directory to stdout
+# if CDPATH is set.
+if test "X${CDPATH+set}" = Xset; then CDPATH=:; export CDPATH; fi
+
+if test -z "$ECHO"; then
+if test "X${echo_test_string+set}" != Xset; then
+# find a string as large as possible, as long as the shell can cope with it
+  for cmd in 'sed 50q "$0"' 'sed 20q "$0"' 'sed 10q "$0"' 'sed 2q "$0"' 'echo test'; do
+    # expected sizes: less than 2Kb, 1Kb, 512 bytes, 16 bytes, ...
+    if (echo_test_string="`eval $cmd`") 2>/dev/null &&
+       echo_test_string="`eval $cmd`" &&
+       (test "X$echo_test_string" = "X$echo_test_string") 2>/dev/null
+    then
+      break
+    fi
+  done
+fi
+
+if test "X`($echo '\t') 2>/dev/null`" = 'X\t' &&
+   echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` &&
+   test "X$echo_testing_string" = "X$echo_test_string"; then
+  :
+else
+  # The Solaris, AIX, and Digital Unix default echo programs unquote
+  # backslashes.  This makes it impossible to quote backslashes using
+  #   echo "$something" | sed 's/\\/\\\\/g'
+  #
+  # So, first we look for a working echo in the user's PATH.
+
+  IFS="${IFS= 	}"; save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+  for dir in $PATH /usr/ucb; do
+    if (test -f $dir/echo || test -f $dir/echo$ac_exeext) &&
+       test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' &&
+       echo_testing_string=`($dir/echo "$echo_test_string") 2>/dev/null` &&
+       test "X$echo_testing_string" = "X$echo_test_string"; then
+      echo="$dir/echo"
+      break
+    fi
+  done
+  IFS="$save_ifs"
+
+  if test "X$echo" = Xecho; then
+    # We didn't find a better echo, so look for alternatives.
+    if test "X`(print -r '\t') 2>/dev/null`" = 'X\t' &&
+       echo_testing_string=`(print -r "$echo_test_string") 2>/dev/null` &&
+       test "X$echo_testing_string" = "X$echo_test_string"; then
+      # This shell has a builtin print -r that does the trick.
+      echo='print -r'
+    elif (test -f /bin/ksh || test -f /bin/ksh$ac_exeext) &&
+	 test "X$CONFIG_SHELL" != X/bin/ksh; then
+      # If we have ksh, try running configure again with it.
+      ORIGINAL_CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
+      export ORIGINAL_CONFIG_SHELL
+      CONFIG_SHELL=/bin/ksh
+      export CONFIG_SHELL
+      exec $CONFIG_SHELL "$0" --no-reexec ${1+"$@"}
+    else
+      # Try using printf.
+      echo='printf %s\n'
+      if test "X`($echo '\t') 2>/dev/null`" = 'X\t' &&
+	 echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` &&
+	 test "X$echo_testing_string" = "X$echo_test_string"; then
+	# Cool, printf works
+	:
+      elif echo_testing_string=`($ORIGINAL_CONFIG_SHELL "$0" --fallback-echo '\t') 2>/dev/null` &&
+	   test "X$echo_testing_string" = 'X\t' &&
+	   echo_testing_string=`($ORIGINAL_CONFIG_SHELL "$0" --fallback-echo "$echo_test_string") 2>/dev/null` &&
+	   test "X$echo_testing_string" = "X$echo_test_string"; then
+	CONFIG_SHELL=$ORIGINAL_CONFIG_SHELL
+	export CONFIG_SHELL
+	SHELL="$CONFIG_SHELL"
+	export SHELL
+	echo="$CONFIG_SHELL $0 --fallback-echo"
+      elif echo_testing_string=`($CONFIG_SHELL "$0" --fallback-echo '\t') 2>/dev/null` &&
+	   test "X$echo_testing_string" = 'X\t' &&
+	   echo_testing_string=`($CONFIG_SHELL "$0" --fallback-echo "$echo_test_string") 2>/dev/null` &&
+	   test "X$echo_testing_string" = "X$echo_test_string"; then
+	echo="$CONFIG_SHELL $0 --fallback-echo"
+      else
+	# maybe with a smaller string...
+	prev=:
+
+	for cmd in 'echo test' 'sed 2q "$0"' 'sed 10q "$0"' 'sed 20q "$0"' 'sed 50q "$0"'; do
+	  if (test "X$echo_test_string" = "X`eval $cmd`") 2>/dev/null
+	  then
+	    break
+	  fi
+	  prev="$cmd"
+	done
+
+	if test "$prev" != 'sed 50q "$0"'; then
+	  echo_test_string=`eval $prev`
+	  export echo_test_string
+	  exec ${ORIGINAL_CONFIG_SHELL-${CONFIG_SHELL-/bin/sh}} "$0" ${1+"$@"}
+	else
+	  # Oops.  We lost completely, so just stick with echo.
+	  echo=echo
+	fi
+      fi
+    fi
+  fi
+fi
+fi
+
+# Copy echo and quote the copy suitably for passing to libtool from
+# the Makefile, instead of quoting the original, which is used later.
+ECHO=$echo
+if test "X$ECHO" = "X$CONFIG_SHELL $0 --fallback-echo"; then
+   ECHO="$CONFIG_SHELL \\\$\$0 --fallback-echo"
+fi
+
+
+ac_help="$ac_help
+  --disable-libtool-lock  avoid locking (might break parallel builds)"
+ac_help="$ac_help
+  --with-pic              try to use only PIC/non-PIC objects [default=use both]"
+ac_help="$ac_help
+  --with-libwrap[=LIBPATH] Compile in libwrap (tcp_wrappers) support."
+ac_help="$ac_help
+  --with-zlib[=DIR]        use libz in DIR"
+
+# Initialize some variables set by options.
+# The variables have the same names as the options, with
+# dashes changed to underlines.
+build=NONE
+cache_file=./config.cache
+exec_prefix=NONE
+host=NONE
+no_create=
+nonopt=NONE
+no_recursion=
+prefix=NONE
+program_prefix=NONE
+program_suffix=NONE
+program_transform_name=s,x,x,
+silent=
+site=
+srcdir=
+target=NONE
+verbose=
+x_includes=NONE
+x_libraries=NONE
+bindir='${exec_prefix}/bin'
+sbindir='${exec_prefix}/sbin'
+libexecdir='${exec_prefix}/libexec'
+datadir='${prefix}/share'
+sysconfdir='${prefix}/etc'
+sharedstatedir='${prefix}/com'
+localstatedir='${prefix}/var'
+libdir='${exec_prefix}/lib'
+includedir='${prefix}/include'
+oldincludedir='/usr/include'
+infodir='${prefix}/info'
+mandir='${prefix}/man'
+
+# Initialize some other variables.
+subdirs=
+MFLAGS= MAKEFLAGS=
+SHELL=${CONFIG_SHELL-/bin/sh}
+# Maximum number of lines to put in a shell here document.
+ac_max_here_lines=12
+
+ac_prev=
+for ac_option
+do
+
+  # If the previous option needs an argument, assign it.
+  if test -n "$ac_prev"; then
+    eval "$ac_prev=\$ac_option"
+    ac_prev=
+    continue
+  fi
+
+  case "$ac_option" in
+  -*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
+  *) ac_optarg= ;;
+  esac
+
+  # Accept the important Cygnus configure options, so we can diagnose typos.
+
+  case "$ac_option" in
+
+  -bindir | --bindir | --bindi | --bind | --bin | --bi)
+    ac_prev=bindir ;;
+  -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*)
+    bindir="$ac_optarg" ;;
+
+  -build | --build | --buil | --bui | --bu)
+    ac_prev=build ;;
+  -build=* | --build=* | --buil=* | --bui=* | --bu=*)
+    build="$ac_optarg" ;;
+
+  -cache-file | --cache-file | --cache-fil | --cache-fi \
+  | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c)
+    ac_prev=cache_file ;;
+  -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \
+  | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*)
+    cache_file="$ac_optarg" ;;
+
+  -datadir | --datadir | --datadi | --datad | --data | --dat | --da)
+    ac_prev=datadir ;;
+  -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \
+  | --da=*)
+    datadir="$ac_optarg" ;;
+
+  -disable-* | --disable-*)
+    ac_feature=`echo $ac_option|sed -e 's/-*disable-//'`
+    # Reject names that are not valid shell variable names.
+    if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then
+      { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; }
+    fi
+    ac_feature=`echo $ac_feature| sed 's/-/_/g'`
+    eval "enable_${ac_feature}=no" ;;
+
+  -enable-* | --enable-*)
+    ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'`
+    # Reject names that are not valid shell variable names.
+    if test -n "`echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then
+      { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; }
+    fi
+    ac_feature=`echo $ac_feature| sed 's/-/_/g'`
+    case "$ac_option" in
+      *=*) ;;
+      *) ac_optarg=yes ;;
+    esac
+    eval "enable_${ac_feature}='$ac_optarg'" ;;
+
+  -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \
+  | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \
+  | --exec | --exe | --ex)
+    ac_prev=exec_prefix ;;
+  -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \
+  | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \
+  | --exec=* | --exe=* | --ex=*)
+    exec_prefix="$ac_optarg" ;;
+
+  -gas | --gas | --ga | --g)
+    # Obsolete; use --with-gas.
+    with_gas=yes ;;
+
+  -help | --help | --hel | --he)
+    # Omit some internal or obsolete options to make the list less imposing.
+    # This message is too long to be a string in the A/UX 3.1 sh.
+    cat << EOF
+Usage: configure [options] [host]
+Options: [defaults in brackets after descriptions]
+Configuration:
+  --cache-file=FILE       cache test results in FILE
+  --help                  print this message
+  --no-create             do not create output files
+  --quiet, --silent       do not print \`checking...' messages
+  --version               print the version of autoconf that created configure
+Directory and file names:
+  --prefix=PREFIX         install architecture-independent files in PREFIX
+                          [$ac_default_prefix]
+  --exec-prefix=EPREFIX   install architecture-dependent files in EPREFIX
+                          [same as prefix]
+  --bindir=DIR            user executables in DIR [EPREFIX/bin]
+  --sbindir=DIR           system admin executables in DIR [EPREFIX/sbin]
+  --libexecdir=DIR        program executables in DIR [EPREFIX/libexec]
+  --datadir=DIR           read-only architecture-independent data in DIR
+                          [PREFIX/share]
+  --sysconfdir=DIR        read-only single-machine data in DIR [PREFIX/etc]
+  --sharedstatedir=DIR    modifiable architecture-independent data in DIR
+                          [PREFIX/com]
+  --localstatedir=DIR     modifiable single-machine data in DIR [PREFIX/var]
+  --libdir=DIR            object code libraries in DIR [EPREFIX/lib]
+  --includedir=DIR        C header files in DIR [PREFIX/include]
+  --oldincludedir=DIR     C header files for non-gcc in DIR [/usr/include]
+  --infodir=DIR           info documentation in DIR [PREFIX/info]
+  --mandir=DIR            man documentation in DIR [PREFIX/man]
+  --srcdir=DIR            find the sources in DIR [configure dir or ..]
+  --program-prefix=PREFIX prepend PREFIX to installed program names
+  --program-suffix=SUFFIX append SUFFIX to installed program names
+  --program-transform-name=PROGRAM
+                          run sed PROGRAM on installed program names
+EOF
+    cat << EOF
+Host type:
+  --build=BUILD           configure for building on BUILD [BUILD=HOST]
+  --host=HOST             configure for HOST [guessed]
+  --target=TARGET         configure for TARGET [TARGET=HOST]
+Features and packages:
+  --disable-FEATURE       do not include FEATURE (same as --enable-FEATURE=no)
+  --enable-FEATURE[=ARG]  include FEATURE [ARG=yes]
+  --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
+  --without-PACKAGE       do not use PACKAGE (same as --with-PACKAGE=no)
+  --x-includes=DIR        X include files are in DIR
+  --x-libraries=DIR       X library files are in DIR
+EOF
+    if test -n "$ac_help"; then
+      echo "--enable and --with options recognized:$ac_help"
+    fi
+    exit 0 ;;
+
+  -host | --host | --hos | --ho)
+    ac_prev=host ;;
+  -host=* | --host=* | --hos=* | --ho=*)
+    host="$ac_optarg" ;;
+
+  -includedir | --includedir | --includedi | --included | --include \
+  | --includ | --inclu | --incl | --inc)
+    ac_prev=includedir ;;
+  -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \
+  | --includ=* | --inclu=* | --incl=* | --inc=*)
+    includedir="$ac_optarg" ;;
+
+  -infodir | --infodir | --infodi | --infod | --info | --inf)
+    ac_prev=infodir ;;
+  -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*)
+    infodir="$ac_optarg" ;;
+
+  -libdir | --libdir | --libdi | --libd)
+    ac_prev=libdir ;;
+  -libdir=* | --libdir=* | --libdi=* | --libd=*)
+    libdir="$ac_optarg" ;;
+
+  -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \
+  | --libexe | --libex | --libe)
+    ac_prev=libexecdir ;;
+  -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \
+  | --libexe=* | --libex=* | --libe=*)
+    libexecdir="$ac_optarg" ;;
+
+  -localstatedir | --localstatedir | --localstatedi | --localstated \
+  | --localstate | --localstat | --localsta | --localst \
+  | --locals | --local | --loca | --loc | --lo)
+    ac_prev=localstatedir ;;
+  -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \
+  | --localstate=* | --localstat=* | --localsta=* | --localst=* \
+  | --locals=* | --local=* | --loca=* | --loc=* | --lo=*)
+    localstatedir="$ac_optarg" ;;
+
+  -mandir | --mandir | --mandi | --mand | --man | --ma | --m)
+    ac_prev=mandir ;;
+  -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*)
+    mandir="$ac_optarg" ;;
+
+  -nfp | --nfp | --nf)
+    # Obsolete; use --without-fp.
+    with_fp=no ;;
+
+  -no-create | --no-create | --no-creat | --no-crea | --no-cre \
+  | --no-cr | --no-c)
+    no_create=yes ;;
+
+  -no-recursion | --no-recursion | --no-recursio | --no-recursi \
+  | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r)
+    no_recursion=yes ;;
+
+  -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \
+  | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \
+  | --oldin | --oldi | --old | --ol | --o)
+    ac_prev=oldincludedir ;;
+  -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \
+  | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \
+  | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*)
+    oldincludedir="$ac_optarg" ;;
+
+  -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
+    ac_prev=prefix ;;
+  -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
+    prefix="$ac_optarg" ;;
+
+  -program-prefix | --program-prefix | --program-prefi | --program-pref \
+  | --program-pre | --program-pr | --program-p)
+    ac_prev=program_prefix ;;
+  -program-prefix=* | --program-prefix=* | --program-prefi=* \
+  | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*)
+    program_prefix="$ac_optarg" ;;
+
+  -program-suffix | --program-suffix | --program-suffi | --program-suff \
+  | --program-suf | --program-su | --program-s)
+    ac_prev=program_suffix ;;
+  -program-suffix=* | --program-suffix=* | --program-suffi=* \
+  | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*)
+    program_suffix="$ac_optarg" ;;
+
+  -program-transform-name | --program-transform-name \
+  | --program-transform-nam | --program-transform-na \
+  | --program-transform-n | --program-transform- \
+  | --program-transform | --program-transfor \
+  | --program-transfo | --program-transf \
+  | --program-trans | --program-tran \
+  | --progr-tra | --program-tr | --program-t)
+    ac_prev=program_transform_name ;;
+  -program-transform-name=* | --program-transform-name=* \
+  | --program-transform-nam=* | --program-transform-na=* \
+  | --program-transform-n=* | --program-transform-=* \
+  | --program-transform=* | --program-transfor=* \
+  | --program-transfo=* | --program-transf=* \
+  | --program-trans=* | --program-tran=* \
+  | --progr-tra=* | --program-tr=* | --program-t=*)
+    program_transform_name="$ac_optarg" ;;
+
+  -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+  | -silent | --silent | --silen | --sile | --sil)
+    silent=yes ;;
+
+  -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
+    ac_prev=sbindir ;;
+  -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
+  | --sbi=* | --sb=*)
+    sbindir="$ac_optarg" ;;
+
+  -sharedstatedir | --sharedstatedir | --sharedstatedi \
+  | --sharedstated | --sharedstate | --sharedstat | --sharedsta \
+  | --sharedst | --shareds | --shared | --share | --shar \
+  | --sha | --sh)
+    ac_prev=sharedstatedir ;;
+  -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \
+  | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \
+  | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \
+  | --sha=* | --sh=*)
+    sharedstatedir="$ac_optarg" ;;
+
+  -site | --site | --sit)
+    ac_prev=site ;;
+  -site=* | --site=* | --sit=*)
+    site="$ac_optarg" ;;
+
+  -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
+    ac_prev=srcdir ;;
+  -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
+    srcdir="$ac_optarg" ;;
+
+  -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \
+  | --syscon | --sysco | --sysc | --sys | --sy)
+    ac_prev=sysconfdir ;;
+  -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \
+  | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*)
+    sysconfdir="$ac_optarg" ;;
+
+  -target | --target | --targe | --targ | --tar | --ta | --t)
+    ac_prev=target ;;
+  -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)
+    target="$ac_optarg" ;;
+
+  -v | -verbose | --verbose | --verbos | --verbo | --verb)
+    verbose=yes ;;
+
+  -version | --version | --versio | --versi | --vers)
+    echo "configure generated by autoconf version 2.13"
+    exit 0 ;;
+
+  -with-* | --with-*)
+    ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'`
+    # Reject names that are not valid shell variable names.
+    if test -n "`echo $ac_package| sed 's/[-_a-zA-Z0-9]//g'`"; then
+      { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; }
+    fi
+    ac_package=`echo $ac_package| sed 's/-/_/g'`
+    case "$ac_option" in
+      *=*) ;;
+      *) ac_optarg=yes ;;
+    esac
+    eval "with_${ac_package}='$ac_optarg'" ;;
+
+  -without-* | --without-*)
+    ac_package=`echo $ac_option|sed -e 's/-*without-//'`
+    # Reject names that are not valid shell variable names.
+    if test -n "`echo $ac_package| sed 's/[-a-zA-Z0-9_]//g'`"; then
+      { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; }
+    fi
+    ac_package=`echo $ac_package| sed 's/-/_/g'`
+    eval "with_${ac_package}=no" ;;
+
+  --x)
+    # Obsolete; use --with-x.
+    with_x=yes ;;
+
+  -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \
+  | --x-incl | --x-inc | --x-in | --x-i)
+    ac_prev=x_includes ;;
+  -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \
+  | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*)
+    x_includes="$ac_optarg" ;;
+
+  -x-libraries | --x-libraries | --x-librarie | --x-librari \
+  | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l)
+    ac_prev=x_libraries ;;
+  -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \
+  | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*)
+    x_libraries="$ac_optarg" ;;
+
+  -*) { echo "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; }
+    ;;
+
+  *)
+    if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then
+      echo "configure: warning: $ac_option: invalid host type" 1>&2
+    fi
+    if test "x$nonopt" != xNONE; then
+      { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; }
+    fi
+    nonopt="$ac_option"
+    ;;
+
+  esac
+done
+
+if test -n "$ac_prev"; then
+  { echo "configure: error: missing argument to --`echo $ac_prev | sed 's/_/-/g'`" 1>&2; exit 1; }
+fi
+
+trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15
+
+# File descriptor usage:
+# 0 standard input
+# 1 file creation
+# 2 errors and warnings
+# 3 some systems may open it to /dev/tty
+# 4 used on the Kubota Titan
+# 6 checking for... messages and results
+# 5 compiler messages saved in config.log
+if test "$silent" = yes; then
+  exec 6>/dev/null
+else
+  exec 6>&1
+fi
+exec 5>./config.log
+
+echo "\
+This file contains any messages produced by compilers while
+running configure, to aid debugging if configure makes a mistake.
+" 1>&5
+
+# Strip out --no-create and --no-recursion so they do not pile up.
+# Also quote any args containing shell metacharacters.
+ac_configure_args=
+for ac_arg
+do
+  case "$ac_arg" in
+  -no-create | --no-create | --no-creat | --no-crea | --no-cre \
+  | --no-cr | --no-c) ;;
+  -no-recursion | --no-recursion | --no-recursio | --no-recursi \
+  | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;;
+  *" "*|*"	"*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*)
+  ac_configure_args="$ac_configure_args '$ac_arg'" ;;
+  *) ac_configure_args="$ac_configure_args $ac_arg" ;;
+  esac
+done
+
+# NLS nuisances.
+# Only set these to C if already set.  These must not be set unconditionally
+# because not all systems understand e.g. LANG=C (notably SCO).
+# Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'!
+# Non-C LC_CTYPE values break the ctype check.
+if test "${LANG+set}"   = set; then LANG=C;   export LANG;   fi
+if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi
+if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi
+if test "${LC_CTYPE+set}"    = set; then LC_CTYPE=C;    export LC_CTYPE;    fi
+
+# confdefs.h avoids OS command line length limits that DEFS can exceed.
+rm -rf conftest* confdefs.h
+# AIX cpp loses on an empty file, so make sure it contains at least a newline.
+echo > confdefs.h
+
+# A filename unique to this package, relative to the directory that
+# configure is in, which we can look for to find out if srcdir is correct.
+ac_unique_file=agent/mibgroup/ucd-snmp/extensible.c
+
+# Find the source files, if location was not specified.
+if test -z "$srcdir"; then
+  ac_srcdir_defaulted=yes
+  # Try the directory containing this script, then its parent.
+  ac_prog=$0
+  ac_confdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'`
+  test "x$ac_confdir" = "x$ac_prog" && ac_confdir=.
+  srcdir=$ac_confdir
+  if test ! -r $srcdir/$ac_unique_file; then
+    srcdir=..
+  fi
+else
+  ac_srcdir_defaulted=no
+fi
+if test ! -r $srcdir/$ac_unique_file; then
+  if test "$ac_srcdir_defaulted" = yes; then
+    { echo "configure: error: can not find sources in $ac_confdir or .." 1>&2; exit 1; }
+  else
+    { echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; }
+  fi
+fi
+srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'`
+
+# Prefer explicitly selected file to automatically selected ones.
+if test -z "$CONFIG_SITE"; then
+  if test "x$prefix" != xNONE; then
+    CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site"
+  else
+    CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site"
+  fi
+fi
+for ac_site_file in $CONFIG_SITE; do
+  if test -r "$ac_site_file"; then
+    echo "loading site script $ac_site_file"
+    . "$ac_site_file"
+  fi
+done
+
+if test -r "$cache_file"; then
+  echo "loading cache $cache_file"
+  . $cache_file
+else
+  echo "creating cache $cache_file"
+  > $cache_file
+fi
+
+ac_ext=c
+# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
+ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
+cross_compiling=$ac_cv_prog_cc_cross
+
+ac_exeext=
+ac_objext=o
+if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then
+  # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu.
+  if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then
+    ac_n= ac_c='
+' ac_t='	'
+  else
+    ac_n=-n ac_c= ac_t=
+  fi
+else
+  ac_n= ac_c='\c' ac_t=
+fi
+
+
+
+
+  rm -f configure-summary
+
+
+cat >> confdefs.h <<EOF
+#define CONFIGURE_OPTIONS "\"$ac_configure_args\""
+EOF
+
+CONFIGURE_OPTIONS="\"$ac_configure_args\""
+
+
+# Check whether --with-cc or --without-cc was given.
+if test "${with_cc+set}" = set; then
+  withval="$with_cc"
+  CC=$with_cc;export CC
+fi
+
+
+# Check whether --with-ar or --without-ar was given.
+if test "${with_ar+set}" = set; then
+  withval="$with_ar"
+  AR=$with_ar; export AR
+fi
+
+
+# Check whether --with-endianness or --without-endianness was given.
+if test "${with_endianness+set}" = set; then
+  withval="$with_endianness"
+  if test $with_endianness != "big" -a $with_endianness != "little" ; then
+       { echo "configure: error: Endianness must be big or little, not \"$with_endianness\"." 1>&2; exit 1; };
+     fi
+
+fi
+
+
+# Check whether --with-cflags or --without-cflags was given.
+if test "${with_cflags+set}" = set; then
+  withval="$with_cflags"
+  CFLAGS=$with_cflags; export CFLAGS
+fi
+
+
+# Check whether --with-ldflags or --without-ldflags was given.
+if test "${with_ldflags+set}" = set; then
+  withval="$with_ldflags"
+  LDFLAGS=$with_ldflags; export LDFLAGS
+fi
+
+
+# Check whether --with-libs or --without-libs was given.
+if test "${with_libs+set}" = set; then
+  withval="$with_libs"
+  LIBS=$with_libs; export LIBS
+fi
+
+
+# Check whether --enable-silent-libtool or --disable-silent-libtool was given.
+if test "${enable_silent_libtool+set}" = set; then
+  enableval="$enable_silent_libtool"
+  LIBTOOLFLAGS=--silent
+fi
+
+
+
+# Check whether --enable-mini_agent or --disable-mini_agent was given.
+if test "${enable_mini_agent+set}" = set; then
+  enableval="$enable_mini_agent"
+  mini_agent="yes"
+else
+  mini_agent="no"
+fi
+
+
+# Check whether --enable-ipv6 or --disable-ipv6 was given.
+if test "${enable_ipv6+set}" = set; then
+  enableval="$enable_ipv6"
+  if test "x$enable_ipv6" = "xyes"; then
+      cat >> confdefs.h <<\EOF
+#define INET6 1
+EOF
+
+    fi
+fi
+
+
+# Check whether --enable-debugging or --disable-debugging was given.
+if test "${enable_debugging+set}" = set; then
+  enableval="$enable_debugging"
+  cat >> confdefs.h <<\EOF
+#define SNMP_ALWAYS_DEBUG 1
+EOF
+
+fi
+
+
+# Check whether --enable-developer or --disable-developer was given.
+if test "${enable_developer+set}" = set; then
+  enableval="$enable_developer"
+  developer=yes
+fi
+
+
+if test "x$enable_debugging" = "xno"; then
+    cat >> confdefs.h <<\EOF
+#define SNMP_NO_DEBUGGING 1
+EOF
+
+fi
+
+# Check whether --with-dmalloc or --without-dmalloc was given.
+if test "${with_dmalloc+set}" = set; then
+  withval="$with_dmalloc"
+  if test "x$withval" = "xyes"; then
+      LIBS="$LIBS -ldmalloc"
+      cat >> confdefs.h <<\EOF
+#define HAVE_DMALLOC_H 1
+EOF
+
+    elif test -d "$withval"; then
+      
+  if test "x$withval" != x -a -d $withval; then
+     if test -d $withval/lib; then
+       LDFLAGS="-L$withval/lib $LDFLAGS"
+     fi
+     if test -d $withval/include; then
+	CPPFLAGS="-I$withval/include $CPPFLAGS"
+     fi
+  fi
+
+      LIBS="$LIBS -ldmalloc"
+      cat >> confdefs.h <<\EOF
+#define HAVE_DMALLOC_H 1
+EOF
+
+    fi
+
+fi
+
+
+
+# Check whether --with-efence or --without-efence was given.
+if test "${with_efence+set}" = set; then
+  withval="$with_efence"
+  use_efence="$withval"
+fi
+
+
+tryrsaref=no
+# Check whether --with-rsaref or --without-rsaref was given.
+if test "${with_rsaref+set}" = set; then
+  withval="$with_rsaref"
+  if test "x$withval" = "xyes"; then
+      tryrsaref=yes
+    elif test "x$withval" = "xno"; then
+      tryrsaref=no
+    elif test -d "$withval"; then
+      
+  if test "x$withval" != x -a -d $withval; then
+     if test -d $withval/lib; then
+       LDFLAGS="-L$withval/lib $LDFLAGS"
+     fi
+     if test -d $withval/include; then
+	CPPFLAGS="-I$withval/include $CPPFLAGS"
+     fi
+  fi
+
+      tryrsaref=yes
+    fi
+fi
+
+
+tryopenssl=defaultyes
+askedopenssl=no
+# Check whether --with-openssl or --without-openssl was given.
+if test "${with_openssl+set}" = set; then
+  withval="$with_openssl"
+  if test "x$withval" = "xyes"; then
+      tryopenssl=yes
+      askedopenssl=yes
+    elif test "x$withval" = "xno"; then
+      tryopenssl=no
+    elif test -d "$withval"; then
+      
+  if test "x$withval" != x -a -d $withval; then
+     if test -d $withval/lib; then
+       LDFLAGS="-L$withval/lib $LDFLAGS"
+     fi
+     if test -d $withval/include; then
+	CPPFLAGS="-I$withval/include $CPPFLAGS"
+     fi
+  fi
+
+      tryopenssl=yes
+      askedopenssl=yes
+    fi
+fi
+
+if test "x$tryopenssl" = "xdefaultyes"; then
+      
+  if test "x/usr/local/ssl" != x -a -d /usr/local/ssl; then
+     if test -d /usr/local/ssl/lib; then
+       LDFLAGS="-L/usr/local/ssl/lib $LDFLAGS"
+     fi
+     if test -d /usr/local/ssl/include; then
+	CPPFLAGS="-I/usr/local/ssl/include $CPPFLAGS"
+     fi
+  fi
+
+      tryopenssl=yes
+fi
+
+
+# Check whether --enable-privacy or --disable-privacy was given.
+if test "${enable_privacy+set}" = set; then
+  enableval="$enable_privacy"
+  :
+fi
+
+if test "x$enable_privacy" != "xno"; then
+  cat >> confdefs.h <<\EOF
+#define SCAPI_AUTHPRIV 1
+EOF
+
+fi
+
+# Check whether --enable-internal-md5 or --disable-internal-md5 was given.
+if test "${enable_internal_md5+set}" = set; then
+  enableval="$enable_internal_md5"
+  cat >> confdefs.h <<\EOF
+#define USE_INTERNAL_MD5 1
+EOF
+
+fi
+
+
+
+# Check whether --with-opaque-special-types or --without-opaque-special-types was given.
+if test "${with_opaque_special_types+set}" = set; then
+  withval="$with_opaque_special_types"
+  :
+fi
+
+
+# Check whether --with-mibdirs or --without-mibdirs was given.
+if test "${with_mibdirs+set}" = set; then
+  withval="$with_mibdirs"
+  DEFAULT_MIBDIRS="$with_mibdirs"
+    cat >> confdefs.h <<EOF
+#define DEFAULT_MIBDIRS "$with_mibdirs"
+EOF
+
+fi
+
+
+# Check whether --with-mibs or --without-mibs was given.
+if test "${with_mibs+set}" = set; then
+  withval="$with_mibs"
+  DEFAULT_MIBS="$with_mibs"
+fi
+
+
+# Check whether --with-mibfiles or --without-mibfiles was given.
+if test "${with_mibfiles+set}" = set; then
+  withval="$with_mibfiles"
+  cat >> confdefs.h <<EOF
+#define DEFAULT_MIBFILES "$with_mibfiles"
+EOF
+
+fi
+
+
+
+# Check whether --enable-testing-code or --disable-testing-code was given.
+if test "${enable_testing_code+set}" = set; then
+  enableval="$enable_testing_code"
+  cat >> confdefs.h <<\EOF
+#define SNMP_TESTING_CODE 1
+EOF
+
+fi
+
+
+# Check whether --enable-reentrant or --disable-reentrant was given.
+if test "${enable_reentrant+set}" = set; then
+  enableval="$enable_reentrant"
+  with_res_locks="yes"
+else
+  with_res_locks="no"
+fi
+
+
+# Check whether --with-root-access or --without-root-access was given.
+if test "${with_root_access+set}" = set; then
+  withval="$with_root_access"
+  :
+fi
+
+
+# Check whether --with-kmem-usage or --without-kmem-usage was given.
+if test "${with_kmem_usage+set}" = set; then
+  withval="$with_kmem_usage"
+  :
+fi
+
+
+# Check whether --with-dummy-values or --without-dummy-values was given.
+if test "${with_dummy_values+set}" = set; then
+  withval="$with_dummy_values"
+  :
+fi
+
+
+# Check whether --with-persistent-directory or --without-persistent-directory was given.
+if test "${with_persistent_directory+set}" = set; then
+  withval="$with_persistent_directory"
+  ac_cv_user_prompt_PERSISTENT_DIRECTORY="$with_persistent_directory"
+fi
+
+
+# Check whether --with-copy_persistent_files or --without-copy_persistent_files was given.
+if test "${with_copy_persistent_files+set}" = set; then
+  withval="$with_copy_persistent_files"
+  ac_cv_user_prompt_COPY_PERSISTENT_FILES="$with_copy_persistent_files"
+fi
+
+
+# Check whether --with-default-snmp-version or --without-default-snmp-version was given.
+if test "${with_default_snmp_version+set}" = set; then
+  withval="$with_default_snmp_version"
+  ac_cv_user_prompt_DEFAULT_SNMP_VERSION="$with_default_snmp_version"
+fi
+
+
+if test "x$ac_cv_user_prompt_DEFAULT_SNMP_VERSION" != "x"; then
+  if test "$ac_cv_user_prompt_DEFAULT_SNMP_VERSION" != "1" -a "$ac_cv_user_prompt_DEFAULT_SNMP_VERSION" != "2" -a "$ac_cv_user_prompt_DEFAULT_SNMP_VERSION" != "3"; then
+    { echo "configure: error: Illegal version number passed to --with-default-snmp-version" 1>&2; exit 1; }
+  fi
+fi
+
+# Check whether --with-sys_contact or --without-sys_contact was given.
+if test "${with_sys_contact+set}" = set; then
+  withval="$with_sys_contact"
+  ac_cv_user_prompt_SYS_CONTACT="$with_sys_contact"
+fi
+
+
+# Check whether --with-sys_location or --without-sys_location was given.
+if test "${with_sys_location+set}" = set; then
+  withval="$with_sys_location"
+  ac_cv_user_prompt_SYS_LOC="$with_sys_location"
+fi
+
+
+# Check whether --with-logfile or --without-logfile was given.
+if test "${with_logfile+set}" = set; then
+  withval="$with_logfile"
+  ac_cv_user_prompt_LOGFILE="$with_logfile"
+fi
+
+
+
+
+# Check whether --with-transports or --without-transports was given.
+if test "${with_transports+set}" = set; then
+  withval="$with_transports"
+  :
+fi
+
+# Check whether --with-out_transports or --without-out_transports was given.
+if test "${with_out_transports+set}" = set; then
+  withval="$with_out_transports"
+  :
+fi
+
+
+# Check whether --with-transport or --without-transport was given.
+if test "${with_transport+set}" = set; then
+  withval="$with_transport"
+  { echo "configure: error:  Invalid option. Use --with-transports instead " 1>&2; exit 1; }     
+fi
+
+# Check whether --with-out_transport or --without-out_transport was given.
+if test "${with_out_transport+set}" = set; then
+  withval="$with_out_transport"
+  { echo "configure: error:  Invalid option. Use --with-out-transports instead " 1>&2; exit 1; } 
+fi
+
+
+
+# Check whether --with-security-modules or --without-security-modules was given.
+if test "${with_security_modules+set}" = set; then
+  withval="$with_security_modules"
+  :
+fi
+
+
+
+# Check whether --with-mib_modules or --without-mib_modules was given.
+if test "${with_mib_modules+set}" = set; then
+  withval="$with_mib_modules"
+  :
+fi
+
+
+# Check whether --with-out_mib_modules or --without-out_mib_modules was given.
+if test "${with_out_mib_modules+set}" = set; then
+  withval="$with_out_mib_modules"
+  :
+fi
+
+
+
+# Check whether --with-enterprise-oid or --without-enterprise-oid was given.
+if test "${with_enterprise_oid+set}" = set; then
+  withval="$with_enterprise_oid"
+  
+  if test "$withval" = yes; then
+    { echo "configure: error:  Please provide a value for the enterprise number " 1>&2; exit 1; };
+  fi
+  cat >> confdefs.h <<EOF
+#define ENTERPRISE_OID $withval
+EOF
+
+  ent_oid="1,3,6,1,4,1,$withval"
+  cat >> confdefs.h <<EOF
+#define ENTERPRISE_MIB $ent_oid
+EOF
+
+  ent_dot_oid="1.3.6.1.4.1.$withval"
+  cat >> confdefs.h <<EOF
+#define ENTERPRISE_DOT_MIB $ent_dot_oid
+EOF
+
+  echo "$ac_t""using enterprise number $withval" 1>&6
+
+else
+  
+  echo "$ac_t""using default "enterprise.net-snmp"" 1>&6
+
+fi
+
+
+# Check whether --with-enterprise-sysoid or --without-enterprise-sysoid was given.
+if test "${with_enterprise_sysoid+set}" = set; then
+  withval="$with_enterprise_sysoid"
+  
+  if test "$withval" = yes; then
+    { echo "configure: error:  Please provide a base OID value " 1>&2; exit 1; };
+  fi
+  sys_oid=`echo "$withval" | sed 's/^\.//' | sed 's/\./\,/g'`
+  cat >> confdefs.h <<EOF
+#define SYSTEM_MIB $sys_oid
+EOF
+
+  sys_dot_oid=`echo "$withval" | sed 's/^\.//'`
+  cat >> confdefs.h <<EOF
+#define SYSTEM_DOT_MIB $sys_dot_oid
+EOF
+
+  sysoid_len=`echo "$withval" | sed 's/^\.//g' | awk -F\. '{ print NF }'`
+  cat >> confdefs.h <<EOF
+#define SYSTEM_DOT_MIB_LENGTH $sysoid_len
+EOF
+
+  echo "$ac_t""using enterprise sysOID $withval ...." 1>&6
+
+else
+  
+  echo "$ac_t""using default enterprise sysOID "NET-SNMP-MIB::netSnmpAgentOIDs..."" 1>&6
+
+fi
+
+
+# Check whether --with-enterprise-notification-oid or --without-enterprise-notification-oid was given.
+if test "${with_enterprise_notification_oid+set}" = set; then
+  withval="$with_enterprise_notification_oid"
+  
+  if test "$withval" = yes; then
+    { echo "configure: error:  Please provide a base OID value " 1>&2; exit 1; };
+  fi
+  notification_oid=`echo "$withval" | sed 's/^\.//' | sed 's/\./\,/g'`
+  cat >> confdefs.h <<EOF
+#define NOTIFICATION_MIB $notification_oid
+EOF
+
+  notification_dot_oid=`echo "$withval" | sed 's/^\.//'`
+  cat >> confdefs.h <<EOF
+#define NOTIFICATION_DOT_MIB $notification_dot_oid
+EOF
+
+  notificationoid_len=`echo "$withval" | sed 's/^\.//g' | awk -F\. '{ print NF }'`
+  cat >> confdefs.h <<EOF
+#define NOTIFICATION_DOT_MIB_LENGTH $notificationoid_len
+EOF
+
+  echo "$ac_t""using enterprise notifications $withval" 1>&6
+
+else
+  
+  echo "$ac_t""using default notifications "NET-SNMP-MIB::netSnmpNotifications"" 1>&6
+
+fi
+
+# Check whether --with-mib_module or --without-mib_module was given.
+if test "${with_mib_module+set}" = set; then
+  withval="$with_mib_module"
+  { echo "configure: error:  Invalid option. Use --with-mib-modules instead " 1>&2; exit 1; }     
+fi
+
+# Check whether --with-out_mib_module or --without-out_mib_module was given.
+if test "${with_out_mib_module+set}" = set; then
+  withval="$with_out_mib_module"
+  { echo "configure: error:  Invalid option. Use --with-out-mib-modules instead " 1>&2; exit 1; } 
+fi
+
+
+# Check whether --with-perl-modules or --without-perl-modules was given.
+if test "${with_perl_modules+set}" = set; then
+  withval="$with_perl_modules"
+  
+    install_perl=yes
+    if test "$withval" = yes; then
+      PERLARGS=""
+    else
+      PERLARGS="$withval"
+    fi
+
+fi
+
+
+# Check whether --enable-embedded-perl or --disable-embedded-perl was given.
+if test "${enable_embedded_perl+set}" = set; then
+  enableval="$enable_embedded_perl"
+  embed_perl="yes"
+else
+  embed_perl="no"
+fi
+
+
+# Check whether --with-defaults or --without-defaults was given.
+if test "${with_defaults+set}" = set; then
+  withval="$with_defaults"
+  defaults="yes"
+else
+  defaults="no"
+fi
+
+
+# Check whether --enable-ucd-snmp-compatibility or --disable-ucd-snmp-compatibility was given.
+if test "${enable_ucd_snmp_compatibility+set}" = set; then
+  enableval="$enable_ucd_snmp_compatibility"
+  ucd_compat=yes
+else
+  ucd_compat=no
+fi
+
+if test "x$ucd_compat" != "xno" ; then	
+  installucdheaders=installucdheaders
+  installucdlibs=installucdlibs
+  
+  cat >> configure-summary << EOF
+  UCD-SNMP compatability:     enabled
+EOF
+
+fi
+
+
+
+if test "x$with_root_access" = "xno"; then
+  cat >> confdefs.h <<\EOF
+#define NO_ROOT_ACCESS 1
+EOF
+
+fi
+
+if test "x$with_kmem_usage" = "xno"; then
+  cat >> confdefs.h <<\EOF
+#define NO_KMEM_USAGE 1
+EOF
+
+fi
+
+if test "x$with_dummy_values" != "xyes"; then
+  cat >> confdefs.h <<\EOF
+#define NO_DUMMY_VALUES 1
+EOF
+
+fi
+
+if test "x$with_opaque_special_types" != "xno"; then
+  cat >> confdefs.h <<\EOF
+#define OPAQUE_SPECIAL_TYPES 1
+EOF
+
+fi
+
+
+
+echo $ac_n "checking if I need to feed myself to ksh""... $ac_c" 1>&6
+echo "configure:1543: checking if I need to feed myself to ksh" >&5
+if test -f /hp-ux -a -f /bin/ksh; then
+  if (PATH=.; alias -x) >/dev/null 2>&1; then
+    echo "$ac_t""no" 1>&6
+  else
+    echo "$ac_t""yes" 1>&6
+    if test "x$1" = "x"; then
+      exec /bin/ksh $0
+    else
+      exec /bin/ksh $0 "$@"
+    fi
+  fi
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+if test "x$developer" != "xno" -a -f $srcdir/remove-files; then
+    developer="yes"
+fi
+
+if test "x$developer" = "xyes"; then
+    if test "${enable_shared+set}" != set; then
+    enable_shared=no
+  fi
+fi
+
+if test "x$embed_perl" = "xyes"; then
+    if test "x$enable_shared" != "xyes"; then
+      { echo "configure: error: --enable-embedded-perl requires --enable-shared" 1>&2; exit 1; }
+    fi
+fi
+
+# Extract the first word of "gcc", so it can be a program name with args.
+set dummy gcc; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:1578: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  if test -n "$CC"; then
+  ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS=":"
+  ac_dummy="$PATH"
+  for ac_dir in $ac_dummy; do
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/$ac_word; then
+      ac_cv_prog_CC="gcc"
+      break
+    fi
+  done
+  IFS="$ac_save_ifs"
+fi
+fi
+CC="$ac_cv_prog_CC"
+if test -n "$CC"; then
+  echo "$ac_t""$CC" 1>&6
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+if test -z "$CC"; then
+  # Extract the first word of "cc", so it can be a program name with args.
+set dummy cc; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:1608: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  if test -n "$CC"; then
+  ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS=":"
+  ac_prog_rejected=no
+  ac_dummy="$PATH"
+  for ac_dir in $ac_dummy; do
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/$ac_word; then
+      if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then
+        ac_prog_rejected=yes
+	continue
+      fi
+      ac_cv_prog_CC="cc"
+      break
+    fi
+  done
+  IFS="$ac_save_ifs"
+if test $ac_prog_rejected = yes; then
+  # We found a bogon in the path, so make sure we never use it.
+  set dummy $ac_cv_prog_CC
+  shift
+  if test $# -gt 0; then
+    # We chose a different compiler from the bogus one.
+    # However, it has the same basename, so the bogon will be chosen
+    # first if we set CC to just the basename; use the full file name.
+    shift
+    set dummy "$ac_dir/$ac_word" "$@"
+    shift
+    ac_cv_prog_CC="$@"
+  fi
+fi
+fi
+fi
+CC="$ac_cv_prog_CC"
+if test -n "$CC"; then
+  echo "$ac_t""$CC" 1>&6
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+  if test -z "$CC"; then
+    case "`uname -s`" in
+    *win32* | *WIN32*)
+      # Extract the first word of "cl", so it can be a program name with args.
+set dummy cl; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:1659: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  if test -n "$CC"; then
+  ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS=":"
+  ac_dummy="$PATH"
+  for ac_dir in $ac_dummy; do
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/$ac_word; then
+      ac_cv_prog_CC="cl"
+      break
+    fi
+  done
+  IFS="$ac_save_ifs"
+fi
+fi
+CC="$ac_cv_prog_CC"
+if test -n "$CC"; then
+  echo "$ac_t""$CC" 1>&6
+else
+  echo "$ac_t""no" 1>&6
+fi
+ ;;
+    esac
+  fi
+  test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; }
+fi
+
+echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6
+echo "configure:1691: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
+
+ac_ext=c
+# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
+ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
+cross_compiling=$ac_cv_prog_cc_cross
+
+cat > conftest.$ac_ext << EOF
+
+#line 1702 "configure"
+#include "confdefs.h"
+
+main(){return(0);}
+EOF
+if { (eval echo configure:1707: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  ac_cv_prog_cc_works=yes
+  # If we can't run a trivial program, we are probably using a cross compiler.
+  if (./conftest; exit) 2>/dev/null; then
+    ac_cv_prog_cc_cross=no
+  else
+    ac_cv_prog_cc_cross=yes
+  fi
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  ac_cv_prog_cc_works=no
+fi
+rm -fr conftest*
+ac_ext=c
+# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
+ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
+cross_compiling=$ac_cv_prog_cc_cross
+
+echo "$ac_t""$ac_cv_prog_cc_works" 1>&6
+if test $ac_cv_prog_cc_works = no; then
+  { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; }
+fi
+echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6
+echo "configure:1733: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
+echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6
+cross_compiling=$ac_cv_prog_cc_cross
+
+echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6
+echo "configure:1738: checking whether we are using GNU C" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.c <<EOF
+#ifdef __GNUC__
+  yes;
+#endif
+EOF
+if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1747: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
+  ac_cv_prog_gcc=yes
+else
+  ac_cv_prog_gcc=no
+fi
+fi
+
+echo "$ac_t""$ac_cv_prog_gcc" 1>&6
+
+if test $ac_cv_prog_gcc = yes; then
+  GCC=yes
+else
+  GCC=
+fi
+
+ac_test_CFLAGS="${CFLAGS+set}"
+ac_save_CFLAGS="$CFLAGS"
+CFLAGS=
+echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
+echo "configure:1766: checking whether ${CC-cc} accepts -g" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  echo 'void f(){}' > conftest.c
+if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then
+  ac_cv_prog_cc_g=yes
+else
+  ac_cv_prog_cc_g=no
+fi
+rm -f conftest*
+
+fi
+
+echo "$ac_t""$ac_cv_prog_cc_g" 1>&6
+if test "$ac_test_CFLAGS" = set; then
+  CFLAGS="$ac_save_CFLAGS"
+elif test $ac_cv_prog_cc_g = yes; then
+  if test "$GCC" = yes; then
+    CFLAGS="-g -O2"
+  else
+    CFLAGS="-g"
+  fi
+else
+  if test "$GCC" = yes; then
+    CFLAGS="-O2"
+  else
+    CFLAGS=
+  fi
+fi
+
+echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
+echo "configure:1798: checking how to run the C preprocessor" >&5
+# On Suns, sometimes $CPP names a directory.
+if test -n "$CPP" && test -d "$CPP"; then
+  CPP=
+fi
+if test -z "$CPP"; then
+if eval "test \"`echo '$''{'ac_cv_prog_CPP'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+    # This must be in double quotes, not single quotes, because CPP may get
+  # substituted into the Makefile and "${CC-cc}" will confuse make.
+  CPP="${CC-cc} -E"
+  # On the NeXT, cc -E runs the code through the compiler's parser,
+  # not just through cpp.
+  cat > conftest.$ac_ext <<EOF
+#line 1813 "configure"
+#include "confdefs.h"
+#include <assert.h>
+Syntax Error
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:1819: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+  :
+else
+  echo "$ac_err" >&5
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  CPP="${CC-cc} -E -traditional-cpp"
+  cat > conftest.$ac_ext <<EOF
+#line 1830 "configure"
+#include "confdefs.h"
+#include <assert.h>
+Syntax Error
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:1836: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+  :
+else
+  echo "$ac_err" >&5
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  CPP="${CC-cc} -nologo -E"
+  cat > conftest.$ac_ext <<EOF
+#line 1847 "configure"
+#include "confdefs.h"
+#include <assert.h>
+Syntax Error
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:1853: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+  :
+else
+  echo "$ac_err" >&5
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  CPP=/lib/cpp
+fi
+rm -f conftest*
+fi
+rm -f conftest*
+fi
+rm -f conftest*
+  ac_cv_prog_CPP="$CPP"
+fi
+  CPP="$ac_cv_prog_CPP"
+else
+  ac_cv_prog_CPP="$CPP"
+fi
+echo "$ac_t""$CPP" 1>&6
+
+echo $ac_n "checking for AIX""... $ac_c" 1>&6
+echo "configure:1878: checking for AIX" >&5
+cat > conftest.$ac_ext <<EOF
+#line 1880 "configure"
+#include "confdefs.h"
+#ifdef _AIX
+  yes
+#endif
+
+EOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  egrep "yes" >/dev/null 2>&1; then
+  rm -rf conftest*
+  echo "$ac_t""yes" 1>&6; cat >> confdefs.h <<\EOF
+#define _ALL_SOURCE 1
+EOF
+
+else
+  rm -rf conftest*
+  echo "$ac_t""no" 1>&6
+fi
+rm -f conftest*
+
+
+echo $ac_n "checking for Cygwin environment""... $ac_c" 1>&6
+echo "configure:1902: checking for Cygwin environment" >&5
+if eval "test \"`echo '$''{'ac_cv_cygwin'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 1907 "configure"
+#include "confdefs.h"
+
+int main() {
+
+#ifndef __CYGWIN__
+#define __CYGWIN__ __CYGWIN32__
+#endif
+return __CYGWIN__;
+; return 0; }
+EOF
+if { (eval echo configure:1918: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  ac_cv_cygwin=yes
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  ac_cv_cygwin=no
+fi
+rm -f conftest*
+rm -f conftest*
+fi
+
+echo "$ac_t""$ac_cv_cygwin" 1>&6
+CYGWIN=
+test "$ac_cv_cygwin" = yes && CYGWIN=yes
+echo $ac_n "checking for mingw32 environment""... $ac_c" 1>&6
+echo "configure:1935: checking for mingw32 environment" >&5
+if eval "test \"`echo '$''{'ac_cv_mingw32'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 1940 "configure"
+#include "confdefs.h"
+
+int main() {
+return __MINGW32__;
+; return 0; }
+EOF
+if { (eval echo configure:1947: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  ac_cv_mingw32=yes
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  ac_cv_mingw32=no
+fi
+rm -f conftest*
+rm -f conftest*
+fi
+
+echo "$ac_t""$ac_cv_mingw32" 1>&6
+MINGW32=
+test "$ac_cv_mingw32" = yes && MINGW32=yes
+
+
+echo $ac_n "checking for executable suffix""... $ac_c" 1>&6
+echo "configure:1966: checking for executable suffix" >&5
+if eval "test \"`echo '$''{'ac_cv_exeext'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  if test "$CYGWIN" = yes || test "$MINGW32" = yes; then
+  ac_cv_exeext=.exe
+else
+  rm -f conftest*
+  echo 'int main () { return 0; }' > conftest.$ac_ext
+  ac_cv_exeext=
+  if { (eval echo configure:1976: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
+    for file in conftest.*; do
+      case $file in
+      *.c | *.o | *.obj) ;;
+      *) ac_cv_exeext=`echo $file | sed -e s/conftest//` ;;
+      esac
+    done
+  else
+    { echo "configure: error: installation or configuration problem: compiler cannot create executables." 1>&2; exit 1; }
+  fi
+  rm -f conftest*
+  test x"${ac_cv_exeext}" = x && ac_cv_exeext=no
+fi
+fi
+
+EXEEXT=""
+test x"${ac_cv_exeext}" != xno && EXEEXT=${ac_cv_exeext}
+echo "$ac_t""${ac_cv_exeext}" 1>&6
+ac_exeext=$EXEEXT
+
+
+
+
+ac_aux_dir=
+for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do
+  if test -f $ac_dir/install-sh; then
+    ac_aux_dir=$ac_dir
+    ac_install_sh="$ac_aux_dir/install-sh -c"
+    break
+  elif test -f $ac_dir/install.sh; then
+    ac_aux_dir=$ac_dir
+    ac_install_sh="$ac_aux_dir/install.sh -c"
+    break
+  fi
+done
+if test -z "$ac_aux_dir"; then
+  { echo "configure: error: can not find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." 1>&2; exit 1; }
+fi
+ac_config_guess=$ac_aux_dir/config.guess
+ac_config_sub=$ac_aux_dir/config.sub
+ac_configure=$ac_aux_dir/configure # This should be Cygnus configure.
+
+# Find the correct PATH separator.  Usually this is `:', but
+# DJGPP uses `;' like DOS.
+if test "X${PATH_SEPARATOR+set}" != Xset; then
+  UNAME=${UNAME-`uname 2>/dev/null`}
+  case X$UNAME in
+    *-DOS) lt_cv_sys_path_separator=';' ;;
+    *)     lt_cv_sys_path_separator=':' ;;
+  esac
+  PATH_SEPARATOR=$lt_cv_sys_path_separator
+fi
+
+# Check whether --enable-shared or --disable-shared was given.
+if test "${enable_shared+set}" = set; then
+  enableval="$enable_shared"
+  p=${PACKAGE-default}
+case $enableval in
+yes) enable_shared=yes ;;
+no) enable_shared=no ;;
+*)
+  enable_shared=no
+  # Look at the argument we got.  We use all the common list separators.
+  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
+  for pkg in $enableval; do
+    if test "X$pkg" = "X$p"; then
+      enable_shared=yes
+    fi
+  done
+  IFS="$ac_save_ifs"
+  ;;
+esac
+else
+  enable_shared=yes
+fi
+
+# Check whether --enable-static or --disable-static was given.
+if test "${enable_static+set}" = set; then
+  enableval="$enable_static"
+  p=${PACKAGE-default}
+case $enableval in
+yes) enable_static=yes ;;
+no) enable_static=no ;;
+*)
+  enable_static=no
+  # Look at the argument we got.  We use all the common list separators.
+  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
+  for pkg in $enableval; do
+    if test "X$pkg" = "X$p"; then
+      enable_static=yes
+    fi
+  done
+  IFS="$ac_save_ifs"
+  ;;
+esac
+else
+  enable_static=yes
+fi
+
+# Check whether --enable-fast-install or --disable-fast-install was given.
+if test "${enable_fast_install+set}" = set; then
+  enableval="$enable_fast_install"
+  p=${PACKAGE-default}
+case $enableval in
+yes) enable_fast_install=yes ;;
+no) enable_fast_install=no ;;
+*)
+  enable_fast_install=no
+  # Look at the argument we got.  We use all the common list separators.
+  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
+  for pkg in $enableval; do
+    if test "X$pkg" = "X$p"; then
+      enable_fast_install=yes
+    fi
+  done
+  IFS="$ac_save_ifs"
+  ;;
+esac
+else
+  enable_fast_install=yes
+fi
+
+
+# Make sure we can run config.sub.
+if ${CONFIG_SHELL-/bin/sh} $ac_config_sub sun4 >/dev/null 2>&1; then :
+else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; }
+fi
+
+echo $ac_n "checking host system type""... $ac_c" 1>&6
+echo "configure:2105: checking host system type" >&5
+
+host_alias=$host
+case "$host_alias" in
+NONE)
+  case $nonopt in
+  NONE)
+    if host_alias=`${CONFIG_SHELL-/bin/sh} $ac_config_guess`; then :
+    else { echo "configure: error: can not guess host type; you must specify one" 1>&2; exit 1; }
+    fi ;;
+  *) host_alias=$nonopt ;;
+  esac ;;
+esac
+
+host=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $host_alias`
+host_cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
+host_vendor=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
+host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
+echo "$ac_t""$host" 1>&6
+
+echo $ac_n "checking build system type""... $ac_c" 1>&6
+echo "configure:2126: checking build system type" >&5
+
+build_alias=$build
+case "$build_alias" in
+NONE)
+  case $nonopt in
+  NONE) build_alias=$host_alias ;;
+  *) build_alias=$nonopt ;;
+  esac ;;
+esac
+
+build=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $build_alias`
+build_cpu=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
+build_vendor=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
+build_os=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
+echo "$ac_t""$build" 1>&6
+
+# Check whether --with-gnu-ld or --without-gnu-ld was given.
+if test "${with_gnu_ld+set}" = set; then
+  withval="$with_gnu_ld"
+  test "$withval" = no || with_gnu_ld=yes
+else
+  with_gnu_ld=no
+fi
+
+ac_prog=ld
+if test "$GCC" = yes; then
+  # Check if gcc -print-prog-name=ld gives a path.
+  echo $ac_n "checking for ld used by GCC""... $ac_c" 1>&6
+echo "configure:2155: checking for ld used by GCC" >&5
+  case $host in
+  *-*-mingw*)
+    # gcc leaves a trailing carriage return which upsets mingw
+    ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
+  *)
+    ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
+  esac
+  case $ac_prog in
+    # Accept absolute paths.
+    [\\/]* | [A-Za-z]:[\\/]*)
+      re_direlt='/[^/][^/]*/\.\./'
+      # Canonicalize the path of ld
+      ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'`
+      while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
+	ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
+      done
+      test -z "$LD" && LD="$ac_prog"
+      ;;
+  "")
+    # If it fails, then pretend we aren't using GCC.
+    ac_prog=ld
+    ;;
+  *)
+    # If it is relative, then search for the first ld in PATH.
+    with_gnu_ld=unknown
+    ;;
+  esac
+elif test "$with_gnu_ld" = yes; then
+  echo $ac_n "checking for GNU ld""... $ac_c" 1>&6
+echo "configure:2185: checking for GNU ld" >&5
+else
+  echo $ac_n "checking for non-GNU ld""... $ac_c" 1>&6
+echo "configure:2188: checking for non-GNU ld" >&5
+fi
+if eval "test \"`echo '$''{'lt_cv_path_LD'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  if test -z "$LD"; then
+  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+  for ac_dir in $PATH; do
+    test -z "$ac_dir" && ac_dir=.
+    if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
+      lt_cv_path_LD="$ac_dir/$ac_prog"
+      # Check to see if the program is GNU ld.  I'd rather use --version,
+      # but apparently some GNU ld's only accept -v.
+      # Break only if it was the GNU/non-GNU ld that we prefer.
+      if "$lt_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then
+	test "$with_gnu_ld" != no && break
+      else
+	test "$with_gnu_ld" != yes && break
+      fi
+    fi
+  done
+  IFS="$ac_save_ifs"
+else
+  lt_cv_path_LD="$LD" # Let the user override the test with a path.
+fi
+fi
+
+LD="$lt_cv_path_LD"
+if test -n "$LD"; then
+  echo "$ac_t""$LD" 1>&6
+else
+  echo "$ac_t""no" 1>&6
+fi
+test -z "$LD" && { echo "configure: error: no acceptable ld found in \$PATH" 1>&2; exit 1; }
+echo $ac_n "checking if the linker ($LD) is GNU ld""... $ac_c" 1>&6
+echo "configure:2223: checking if the linker ($LD) is GNU ld" >&5
+if eval "test \"`echo '$''{'lt_cv_prog_gnu_ld'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  # I'd rather use --version here, but apparently some GNU ld's only accept -v.
+if $LD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then
+  lt_cv_prog_gnu_ld=yes
+else
+  lt_cv_prog_gnu_ld=no
+fi
+fi
+
+echo "$ac_t""$lt_cv_prog_gnu_ld" 1>&6
+with_gnu_ld=$lt_cv_prog_gnu_ld
+
+
+echo $ac_n "checking for $LD option to reload object files""... $ac_c" 1>&6
+echo "configure:2240: checking for $LD option to reload object files" >&5
+if eval "test \"`echo '$''{'lt_cv_ld_reload_flag'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  lt_cv_ld_reload_flag='-r'
+fi
+
+echo "$ac_t""$lt_cv_ld_reload_flag" 1>&6
+reload_flag=$lt_cv_ld_reload_flag
+test -n "$reload_flag" && reload_flag=" $reload_flag"
+
+echo $ac_n "checking for BSD-compatible nm""... $ac_c" 1>&6
+echo "configure:2252: checking for BSD-compatible nm" >&5
+if eval "test \"`echo '$''{'lt_cv_path_NM'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  if test -n "$NM"; then
+  # Let the user override the test.
+  lt_cv_path_NM="$NM"
+else
+  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+  for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do
+    test -z "$ac_dir" && ac_dir=.
+    tmp_nm=$ac_dir/${ac_tool_prefix}nm
+    if test -f $tmp_nm || test -f $tmp_nm$ac_exeext ; then
+      # Check to see if the nm accepts a BSD-compat flag.
+      # Adding the `sed 1q' prevents false positives on HP-UX, which says:
+      #   nm: unknown option "B" ignored
+      # Tru64's nm complains that /dev/null is an invalid object file
+      if ($tmp_nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep '(/dev/null|Invalid file or object type)' >/dev/null; then
+	lt_cv_path_NM="$tmp_nm -B"
+	break
+      elif ($tmp_nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
+	lt_cv_path_NM="$tmp_nm -p"
+	break
+      else
+	lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but
+	continue # so that we can try to find one that supports BSD flags
+      fi
+    fi
+  done
+  IFS="$ac_save_ifs"
+  test -z "$lt_cv_path_NM" && lt_cv_path_NM=nm
+fi
+fi
+
+NM="$lt_cv_path_NM"
+echo "$ac_t""$NM" 1>&6
+
+echo $ac_n "checking for a sed that does not truncate output""... $ac_c" 1>&6
+echo "configure:2290: checking for a sed that does not truncate output" >&5
+if eval "test \"`echo '$''{'lt_cv_path_SED'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  # Loop through the user's path and test for sed and gsed.
+# Then use that list of sed's as ones to test for truncation.
+as_executable_p="test -f"
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_prog in sed gsed; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
+      if $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then
+        _sed_list="$_sed_list $as_dir/$ac_prog$ac_exec_ext"
+      fi
+    done
+  done
+done
+
+  # Create a temporary directory, and hook for its removal unless debugging.
+$debug ||
+{
+  trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0
+  trap '{ (exit 1); exit 1; }' 1 2 13 15
+}
+
+# Create a (secure) tmp directory for tmp files.
+: ${TMPDIR=/tmp}
+{
+  tmp=`(umask 077 && mktemp -d -q "$TMPDIR/sedXXXXXX") 2>/dev/null` &&
+  test -n "$tmp" && test -d "$tmp"
+}  ||
+{
+  tmp=$TMPDIR/sed$$-$RANDOM
+  (umask 077 && mkdir $tmp)
+} ||
+{
+   echo "$me: cannot create a temporary directory in $TMPDIR" >&2
+   { (exit 1); exit 1; }
+}
+  _max=0
+  _count=0
+  # Add /usr/xpg4/bin/sed as it is typically found on Solaris
+  # along with /bin/sed that truncates output.
+  for _sed in $_sed_list /usr/xpg4/bin/sed; do
+    test ! -f ${_sed} && break
+    cat /dev/null > "$tmp/sed.in"
+    _count=0
+    echo ${ECHO_N-$ac_n} "0123456789${ECHO_C-$ac_c}" >"$tmp/sed.in"
+    # Check for GNU sed and select it if it is found.
+    if "${_sed}" --version 2>&1 < /dev/null | egrep '(GNU)' > /dev/null; then
+      lt_cv_path_SED=${_sed}
+      break
+    fi
+    while true; do
+      cat "$tmp/sed.in" "$tmp/sed.in" >"$tmp/sed.tmp"
+      mv "$tmp/sed.tmp" "$tmp/sed.in"
+      cp "$tmp/sed.in" "$tmp/sed.nl"
+      echo >>"$tmp/sed.nl"
+      ${_sed} -e 's/a$//' < "$tmp/sed.nl" >"$tmp/sed.out" || break
+      cmp -s "$tmp/sed.out" "$tmp/sed.nl" || break
+      # 40000 chars as input seems more than enough
+      test $_count -gt 10 && break
+      _count=`expr $_count + 1`
+      if test $_count -gt $_max; then
+        _max=$_count
+        lt_cv_path_SED=$_sed
+      fi
+    done
+  done
+  rm -rf "$tmp"
+
+fi
+
+if test "X$SED" != "X"; then
+  lt_cv_path_SED=$SED
+else
+  SED=$lt_cv_path_SED
+fi
+echo "$ac_t""$SED" 1>&6
+
+echo $ac_n "checking whether ln -s works""... $ac_c" 1>&6
+echo "configure:2374: checking whether ln -s works" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_LN_S'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  rm -f conftestdata
+if ln -s X conftestdata 2>/dev/null
+then
+  rm -f conftestdata
+  ac_cv_prog_LN_S="ln -s"
+else
+  ac_cv_prog_LN_S=ln
+fi
+fi
+LN_S="$ac_cv_prog_LN_S"
+if test "$ac_cv_prog_LN_S" = "ln -s"; then
+  echo "$ac_t""yes" 1>&6
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+echo $ac_n "checking how to recognise dependent libraries""... $ac_c" 1>&6
+echo "configure:2395: checking how to recognise dependent libraries" >&5
+if eval "test \"`echo '$''{'lt_cv_deplibs_check_method'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  lt_cv_file_magic_cmd='$MAGIC_CMD'
+lt_cv_file_magic_test_file=
+lt_cv_deplibs_check_method='unknown'
+# Need to set the preceding variable on all platforms that support
+# interlibrary dependencies.
+# 'none' -- dependencies not supported.
+# `unknown' -- same as none, but documents that we really don't know.
+# 'pass_all' -- all dependencies passed with no checks.
+# 'test_compile' -- check by making test program.
+# 'file_magic [[regex]]' -- check by looking for files in library path
+# which responds to the $file_magic_cmd with a given egrep regex.
+# If you have `file' or equivalent on your system and you're not sure
+# whether `pass_all' will *always* work, you probably want this one.
+
+case $host_os in
+aix4* | aix5*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+beos*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+bsdi4*)
+  lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)'
+  lt_cv_file_magic_cmd='/usr/bin/file -L'
+  lt_cv_file_magic_test_file=/shlib/libc.so
+  ;;
+
+cygwin* | mingw* | pw32*)
+  lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?'
+  lt_cv_file_magic_cmd='$OBJDUMP -f'
+  ;;
+
+darwin* | rhapsody*)
+  lt_cv_deplibs_check_method='file_magic Mach-O dynamically linked shared library'
+  lt_cv_file_magic_cmd='/usr/bin/file -L'
+  case "$host_os" in
+  rhapsody* | darwin1.[012])
+    lt_cv_file_magic_test_file=`echo /System/Library/Frameworks/System.framework/Versions/*/System | head -1`
+    ;;
+  *) # Darwin 1.3 on
+    lt_cv_file_magic_test_file='/usr/lib/libSystem.dylib'
+    ;;
+  esac
+  ;;
+
+freebsd*)
+  if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
+    case $host_cpu in
+    i*86 )
+      # Not sure whether the presence of OpenBSD here was a mistake.
+      # Let's accept both of them until this is cleared up.
+      lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD)/i[3-9]86 (compact )?demand paged shared library'
+      lt_cv_file_magic_cmd=/usr/bin/file
+      lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*`
+      ;;
+    esac
+  else
+    lt_cv_deplibs_check_method=pass_all
+  fi
+  ;;
+
+gnu*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+hpux10.20*|hpux11*)
+  lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9].[0-9]) shared library'
+  lt_cv_file_magic_cmd=/usr/bin/file
+  lt_cv_file_magic_test_file=/usr/lib/libc.sl
+  ;;
+
+irix5* | irix6* | nonstopux*)
+  case $host_os in
+  irix5* | nonstopux*)
+    # this will be overridden with pass_all, but let us keep it just in case
+    lt_cv_deplibs_check_method="file_magic ELF 32-bit MSB dynamic lib MIPS - version 1"
+    ;;
+  *)
+    case $LD in
+    *-32|*"-32 ") libmagic=32-bit;;
+    *-n32|*"-n32 ") libmagic=N32;;
+    *-64|*"-64 ") libmagic=64-bit;;
+    *) libmagic=never-match;;
+    esac
+    # this will be overridden with pass_all, but let us keep it just in case
+    lt_cv_deplibs_check_method="file_magic ELF ${libmagic} MSB mips-[1234] dynamic lib MIPS - version 1"
+    ;;
+  esac
+  lt_cv_file_magic_test_file=`echo /lib${libsuff}/libc.so*`
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+# This must be Linux ELF.
+linux-gnu*)
+  case $host_cpu in
+  alpha* | hppa* | i*86 | mips | mipsel | powerpc* | sparc* | ia64*)
+    lt_cv_deplibs_check_method=pass_all ;;
+  *)
+    # glibc up to 2.1.1 does not perform some relocations on ARM
+    lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )' ;;
+  esac
+  lt_cv_file_magic_test_file=`echo /lib/libc.so* /lib/libc-*.so`
+  ;;
+
+netbsd*)
+  if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
+    lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$'
+  else
+    lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so$'
+  fi
+  ;;
+
+newos6*)
+  lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (executable|dynamic lib)'
+  lt_cv_file_magic_cmd=/usr/bin/file
+  lt_cv_file_magic_test_file=/usr/lib/libnls.so
+  ;;
+
+openbsd*)
+  lt_cv_file_magic_cmd=/usr/bin/file
+  lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*`
+  if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+    lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB shared object'
+  else
+    lt_cv_deplibs_check_method='file_magic OpenBSD.* shared library'
+  fi
+  ;;
+
+osf3* | osf4* | osf5*)
+  # this will be overridden with pass_all, but let us keep it just in case
+  lt_cv_deplibs_check_method='file_magic COFF format alpha shared library'
+  lt_cv_file_magic_test_file=/shlib/libc.so
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+sco3.2v5*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+solaris*)
+  lt_cv_deplibs_check_method=pass_all
+  lt_cv_file_magic_test_file=/lib/libc.so
+  ;;
+
+sysv5uw[78]* | sysv4*uw2*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
+  case $host_vendor in
+  motorola)
+    lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib) M[0-9][0-9]* Version [0-9]'
+    lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*`
+    ;;
+  ncr)
+    lt_cv_deplibs_check_method=pass_all
+    ;;
+  sequent)
+    lt_cv_file_magic_cmd='/bin/file'
+    lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )'
+    ;;
+  sni)
+    lt_cv_file_magic_cmd='/bin/file'
+    lt_cv_deplibs_check_method="file_magic ELF [0-9][0-9]*-bit [LM]SB dynamic lib"
+    lt_cv_file_magic_test_file=/lib/libc.so
+    ;;
+  siemens)
+    lt_cv_deplibs_check_method=pass_all
+    ;;
+  esac
+  ;;
+esac
+
+fi
+
+echo "$ac_t""$lt_cv_deplibs_check_method" 1>&6
+file_magic_cmd=$lt_cv_file_magic_cmd
+deplibs_check_method=$lt_cv_deplibs_check_method
+
+echo $ac_n "checking for object suffix""... $ac_c" 1>&6
+echo "configure:2581: checking for object suffix" >&5
+if eval "test \"`echo '$''{'ac_cv_objext'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  rm -f conftest*
+echo 'int i = 1;' > conftest.$ac_ext
+if { (eval echo configure:2587: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  for ac_file in conftest.*; do
+    case $ac_file in
+    *.c) ;;
+    *) ac_cv_objext=`echo $ac_file | sed -e s/conftest.//` ;;
+    esac
+  done
+else
+  { echo "configure: error: installation or configuration problem; compiler does not work" 1>&2; exit 1; }
+fi
+rm -f conftest*
+fi
+
+echo "$ac_t""$ac_cv_objext" 1>&6
+OBJEXT=$ac_cv_objext
+ac_objext=$ac_cv_objext
+
+if test $host != $build; then
+  ac_tool_prefix=${host_alias}-
+else
+  ac_tool_prefix=
+fi
+
+
+
+
+# Check for command to grab the raw symbol name followed by C symbol from nm.
+echo $ac_n "checking command to parse $NM output""... $ac_c" 1>&6
+echo "configure:2615: checking command to parse $NM output" >&5
+if eval "test \"`echo '$''{'lt_cv_sys_global_symbol_pipe'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+# These are sane defaults that work on at least a few old systems.
+# [They come from Ultrix.  What could be older than Ultrix?!! ;)]
+
+# Character class describing NM global symbol codes.
+symcode='[BCDEGRST]'
+
+# Regexp to match symbols that can be accessed directly from C.
+sympat='\([_A-Za-z][_A-Za-z0-9]*\)'
+
+# Transform the above into a raw symbol and a C symbol.
+symxfrm='\1 \2\3 \3'
+
+# Transform an extracted symbol line into a proper C declaration
+lt_cv_global_symbol_to_cdecl="sed -n -e 's/^. .* \(.*\)$/extern char \1;/p'"
+
+# Transform an extracted symbol line into symbol name and symbol address
+lt_cv_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/  {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode \([^ ]*\) \([^ ]*\)$/  {\"\2\", (lt_ptr) \&\2},/p'"
+
+# Define system-specific variables.
+case $host_os in
+aix*)
+  symcode='[BCDT]'
+  ;;
+cygwin* | mingw* | pw32*)
+  symcode='[ABCDGISTW]'
+  ;;
+hpux*) # Its linker distinguishes data from code symbols
+  lt_cv_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern char \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'"
+  lt_cv_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/  {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/  {\"\2\", (lt_ptr) \&\2},/p'"
+  ;;
+irix* | nonstopux*)
+  symcode='[BCDEGRST]'
+  ;;
+osf*)
+  symcode='[BCDEGQRST]'
+  ;;
+solaris* | sysv5*)
+  symcode='[BDT]'
+  ;;
+sysv4)
+  symcode='[DFNSTU]'
+  ;;
+esac
+
+# Handle CRLF in mingw tool chain
+opt_cr=
+case $host_os in
+mingw*)
+  opt_cr=`echo 'x\{0,1\}' | tr x '\015'` # option cr in regexp
+  ;;
+esac
+
+# If we're using GNU nm, then use its standard symbol codes.
+if $NM -V 2>&1 | egrep '(GNU|with BFD)' > /dev/null; then
+  symcode='[ABCDGISTW]'
+fi
+
+# Try without a prefix undercore, then with it.
+for ac_symprfx in "" "_"; do
+
+  # Write the raw and C identifiers.
+lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[ 	]\($symcode$symcode*\)[ 	][ 	]*\($ac_symprfx\)$sympat$opt_cr$/$symxfrm/p'"
+
+  # Check to see that the pipe works correctly.
+  pipe_works=no
+  rm -f conftest*
+  cat > conftest.$ac_ext <<EOF
+#ifdef __cplusplus
+extern "C" {
+#endif
+char nm_test_var;
+void nm_test_func(){}
+#ifdef __cplusplus
+}
+#endif
+int main(){nm_test_var='a';nm_test_func();return(0);}
+EOF
+
+  if { (eval echo configure:2698: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+    # Now try to grab the symbols.
+    nlist=conftest.nm
+    if { (eval echo configure:2701: \"$NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist\") 1>&5; (eval $NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist) 2>&5; } && test -s "$nlist"; then
+      # Try sorting and uniquifying the output.
+      if sort "$nlist" | uniq > "$nlist"T; then
+	mv -f "$nlist"T "$nlist"
+      else
+	rm -f "$nlist"T
+      fi
+
+      # Make sure that we snagged all the symbols we need.
+      if egrep ' nm_test_var$' "$nlist" >/dev/null; then
+	if egrep ' nm_test_func$' "$nlist" >/dev/null; then
+	  cat <<EOF > conftest.$ac_ext
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+EOF
+	  # Now generate the symbol file.
+	  eval "$lt_cv_global_symbol_to_cdecl"' < "$nlist" >> conftest.$ac_ext'
+
+	  cat <<EOF >> conftest.$ac_ext
+#if defined (__STDC__) && __STDC__
+# define lt_ptr void *
+#else
+# define lt_ptr char *
+# define const
+#endif
+
+/* The mapping between symbol names and symbols. */
+const struct {
+  const char *name;
+  lt_ptr address;
+}
+lt_preloaded_symbols[] =
+{
+EOF
+	  sed "s/^$symcode$symcode* \(.*\) \(.*\)$/  {\"\2\", (lt_ptr) \&\2},/" < "$nlist" >> conftest.$ac_ext
+	  cat <<\EOF >> conftest.$ac_ext
+  {0, (lt_ptr) 0}
+};
+
+#ifdef __cplusplus
+}
+#endif
+EOF
+	  # Now try linking the two files.
+	  mv conftest.$ac_objext conftstm.$ac_objext
+	  save_LIBS="$LIBS"
+	  save_CFLAGS="$CFLAGS"
+	  LIBS="conftstm.$ac_objext"
+	  CFLAGS="$CFLAGS$no_builtin_flag"
+	  if { (eval echo configure:2752: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest$ac_exeext; then
+	    pipe_works=yes
+	  fi
+	  LIBS="$save_LIBS"
+	  CFLAGS="$save_CFLAGS"
+	else
+	  echo "cannot find nm_test_func in $nlist" >&5
+	fi
+      else
+	echo "cannot find nm_test_var in $nlist" >&5
+      fi
+    else
+      echo "cannot run $lt_cv_sys_global_symbol_pipe" >&5
+    fi
+  else
+    echo "$progname: failed program was:" >&5
+    cat conftest.$ac_ext >&5
+  fi
+  rm -f conftest* conftst*
+
+  # Do not use the global_symbol_pipe unless it works.
+  if test "$pipe_works" = yes; then
+    break
+  else
+    lt_cv_sys_global_symbol_pipe=
+  fi
+done
+
+fi
+
+global_symbol_pipe="$lt_cv_sys_global_symbol_pipe"
+if test -z "$lt_cv_sys_global_symbol_pipe"; then
+  global_symbol_to_cdecl=
+  global_symbol_to_c_name_address=
+else
+  global_symbol_to_cdecl="$lt_cv_global_symbol_to_cdecl"
+  global_symbol_to_c_name_address="$lt_cv_global_symbol_to_c_name_address"
+fi
+if test -z "$global_symbol_pipe$global_symbol_to_cdec$global_symbol_to_c_name_address";
+then
+  echo "$ac_t""failed" 1>&6
+else
+  echo "$ac_t""ok" 1>&6
+fi
+
+for ac_hdr in dlfcn.h
+do
+ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+echo "configure:2801: checking for $ac_hdr" >&5
+if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 2806 "configure"
+#include "confdefs.h"
+#include <$ac_hdr>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:2811: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=yes"
+else
+  echo "$ac_err" >&5
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_hdr 1
+EOF
+ 
+else
+  echo "$ac_t""no" 1>&6
+fi
+done
+
+
+
+
+
+
+# Only perform the check for file, if the check method requires it
+case $deplibs_check_method in
+file_magic*)
+  if test "$file_magic_cmd" = '$MAGIC_CMD'; then
+    echo $ac_n "checking for ${ac_tool_prefix}file""... $ac_c" 1>&6
+echo "configure:2847: checking for ${ac_tool_prefix}file" >&5
+if eval "test \"`echo '$''{'lt_cv_path_MAGIC_CMD'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  case $MAGIC_CMD in
+  /*)
+  lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path.
+  ;;
+  ?:/*)
+  lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a dos path.
+  ;;
+  *)
+  ac_save_MAGIC_CMD="$MAGIC_CMD"
+  IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS=":"
+  ac_dummy="/usr/bin:$PATH"
+  for ac_dir in $ac_dummy; do
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/${ac_tool_prefix}file; then
+      lt_cv_path_MAGIC_CMD="$ac_dir/${ac_tool_prefix}file"
+      if test -n "$file_magic_test_file"; then
+	case $deplibs_check_method in
+	"file_magic "*)
+	  file_magic_regex="`expr \"$deplibs_check_method\" : \"file_magic \(.*\)\"`"
+	  MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+	  if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null |
+	    egrep "$file_magic_regex" > /dev/null; then
+	    :
+	  else
+	    cat <<EOF 1>&2
+
+*** Warning: the command libtool uses to detect shared libraries,
+*** $file_magic_cmd, produces output that libtool cannot recognize.
+*** The result is that libtool may fail to recognize shared libraries
+*** as such.  This will affect the creation of libtool libraries that
+*** depend on shared libraries, but programs linked with such libtool
+*** libraries will work regardless of this problem.  Nevertheless, you
+*** may want to report the problem to your system manager and/or to
+*** bug-libtool@gnu.org
+
+EOF
+	  fi ;;
+	esac
+      fi
+      break
+    fi
+  done
+  IFS="$ac_save_ifs"
+  MAGIC_CMD="$ac_save_MAGIC_CMD"
+  ;;
+esac
+fi
+
+MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+if test -n "$MAGIC_CMD"; then
+  echo "$ac_t""$MAGIC_CMD" 1>&6
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+if test -z "$lt_cv_path_MAGIC_CMD"; then
+  if test -n "$ac_tool_prefix"; then
+    echo $ac_n "checking for file""... $ac_c" 1>&6
+echo "configure:2909: checking for file" >&5
+if eval "test \"`echo '$''{'lt_cv_path_MAGIC_CMD'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  case $MAGIC_CMD in
+  /*)
+  lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path.
+  ;;
+  ?:/*)
+  lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a dos path.
+  ;;
+  *)
+  ac_save_MAGIC_CMD="$MAGIC_CMD"
+  IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS=":"
+  ac_dummy="/usr/bin:$PATH"
+  for ac_dir in $ac_dummy; do
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/file; then
+      lt_cv_path_MAGIC_CMD="$ac_dir/file"
+      if test -n "$file_magic_test_file"; then
+	case $deplibs_check_method in
+	"file_magic "*)
+	  file_magic_regex="`expr \"$deplibs_check_method\" : \"file_magic \(.*\)\"`"
+	  MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+	  if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null |
+	    egrep "$file_magic_regex" > /dev/null; then
+	    :
+	  else
+	    cat <<EOF 1>&2
+
+*** Warning: the command libtool uses to detect shared libraries,
+*** $file_magic_cmd, produces output that libtool cannot recognize.
+*** The result is that libtool may fail to recognize shared libraries
+*** as such.  This will affect the creation of libtool libraries that
+*** depend on shared libraries, but programs linked with such libtool
+*** libraries will work regardless of this problem.  Nevertheless, you
+*** may want to report the problem to your system manager and/or to
+*** bug-libtool@gnu.org
+
+EOF
+	  fi ;;
+	esac
+      fi
+      break
+    fi
+  done
+  IFS="$ac_save_ifs"
+  MAGIC_CMD="$ac_save_MAGIC_CMD"
+  ;;
+esac
+fi
+
+MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+if test -n "$MAGIC_CMD"; then
+  echo "$ac_t""$MAGIC_CMD" 1>&6
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+  else
+    MAGIC_CMD=:
+  fi
+fi
+
+  fi
+  ;;
+esac
+
+# Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args.
+set dummy ${ac_tool_prefix}ranlib; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:2980: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  if test -n "$RANLIB"; then
+  ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test.
+else
+  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS=":"
+  ac_dummy="$PATH"
+  for ac_dir in $ac_dummy; do
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/$ac_word; then
+      ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib"
+      break
+    fi
+  done
+  IFS="$ac_save_ifs"
+fi
+fi
+RANLIB="$ac_cv_prog_RANLIB"
+if test -n "$RANLIB"; then
+  echo "$ac_t""$RANLIB" 1>&6
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+
+if test -z "$ac_cv_prog_RANLIB"; then
+if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "ranlib", so it can be a program name with args.
+set dummy ranlib; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:3012: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  if test -n "$RANLIB"; then
+  ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test.
+else
+  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS=":"
+  ac_dummy="$PATH"
+  for ac_dir in $ac_dummy; do
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/$ac_word; then
+      ac_cv_prog_RANLIB="ranlib"
+      break
+    fi
+  done
+  IFS="$ac_save_ifs"
+  test -z "$ac_cv_prog_RANLIB" && ac_cv_prog_RANLIB=":"
+fi
+fi
+RANLIB="$ac_cv_prog_RANLIB"
+if test -n "$RANLIB"; then
+  echo "$ac_t""$RANLIB" 1>&6
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+else
+  RANLIB=":"
+fi
+fi
+
+# Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args.
+set dummy ${ac_tool_prefix}strip; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:3047: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_STRIP'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  if test -n "$STRIP"; then
+  ac_cv_prog_STRIP="$STRIP" # Let the user override the test.
+else
+  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS=":"
+  ac_dummy="$PATH"
+  for ac_dir in $ac_dummy; do
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/$ac_word; then
+      ac_cv_prog_STRIP="${ac_tool_prefix}strip"
+      break
+    fi
+  done
+  IFS="$ac_save_ifs"
+fi
+fi
+STRIP="$ac_cv_prog_STRIP"
+if test -n "$STRIP"; then
+  echo "$ac_t""$STRIP" 1>&6
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+
+if test -z "$ac_cv_prog_STRIP"; then
+if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "strip", so it can be a program name with args.
+set dummy strip; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:3079: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_STRIP'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  if test -n "$STRIP"; then
+  ac_cv_prog_STRIP="$STRIP" # Let the user override the test.
+else
+  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS=":"
+  ac_dummy="$PATH"
+  for ac_dir in $ac_dummy; do
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/$ac_word; then
+      ac_cv_prog_STRIP="strip"
+      break
+    fi
+  done
+  IFS="$ac_save_ifs"
+  test -z "$ac_cv_prog_STRIP" && ac_cv_prog_STRIP=":"
+fi
+fi
+STRIP="$ac_cv_prog_STRIP"
+if test -n "$STRIP"; then
+  echo "$ac_t""$STRIP" 1>&6
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+else
+  STRIP=":"
+fi
+fi
+
+
+enable_dlopen=yes
+enable_win32_dll=yes
+
+# Check whether --enable-libtool-lock or --disable-libtool-lock was given.
+if test "${enable_libtool_lock+set}" = set; then
+  enableval="$enable_libtool_lock"
+  :
+fi
+
+test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes
+
+# Some flags need to be propagated to the compiler or linker for good
+# libtool support.
+case $host in
+*-*-irix6*)
+  # Find out which ABI we are using.
+  echo '#line 3128 "configure"' > conftest.$ac_ext
+  if { (eval echo configure:3129: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+    case `/usr/bin/file conftest.$ac_objext` in
+    *32-bit*)
+      LD="${LD-ld} -32"
+      ;;
+    *N32*)
+      LD="${LD-ld} -n32"
+      ;;
+    *64-bit*)
+      LD="${LD-ld} -64"
+      ;;
+    esac
+  fi
+  rm -rf conftest*
+  ;;
+
+*-*-sco3.2v5*)
+  # On SCO OpenServer 5, we need -belf to get full-featured binaries.
+  SAVE_CFLAGS="$CFLAGS"
+  CFLAGS="$CFLAGS -belf"
+  echo $ac_n "checking whether the C compiler needs -belf""... $ac_c" 1>&6
+echo "configure:3150: checking whether the C compiler needs -belf" >&5
+if eval "test \"`echo '$''{'lt_cv_cc_needs_belf'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+     ac_ext=c
+# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
+ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
+cross_compiling=$ac_cv_prog_cc_cross
+
+     cat > conftest.$ac_ext <<EOF
+#line 3163 "configure"
+#include "confdefs.h"
+
+int main() {
+
+; return 0; }
+EOF
+if { (eval echo configure:3170: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  lt_cv_cc_needs_belf=yes
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  lt_cv_cc_needs_belf=no
+fi
+rm -f conftest*
+     ac_ext=c
+# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
+ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
+cross_compiling=$ac_cv_prog_cc_cross
+
+fi
+
+echo "$ac_t""$lt_cv_cc_needs_belf" 1>&6
+  if test x"$lt_cv_cc_needs_belf" != x"yes"; then
+    # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf
+    CFLAGS="$SAVE_CFLAGS"
+  fi
+  ;;
+
+*-*-cygwin* | *-*-mingw* | *-*-pw32*)
+  # Extract the first word of "${ac_tool_prefix}dlltool", so it can be a program name with args.
+set dummy ${ac_tool_prefix}dlltool; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:3200: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_DLLTOOL'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  if test -n "$DLLTOOL"; then
+  ac_cv_prog_DLLTOOL="$DLLTOOL" # Let the user override the test.
+else
+  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS=":"
+  ac_dummy="$PATH"
+  for ac_dir in $ac_dummy; do
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/$ac_word; then
+      ac_cv_prog_DLLTOOL="${ac_tool_prefix}dlltool"
+      break
+    fi
+  done
+  IFS="$ac_save_ifs"
+fi
+fi
+DLLTOOL="$ac_cv_prog_DLLTOOL"
+if test -n "$DLLTOOL"; then
+  echo "$ac_t""$DLLTOOL" 1>&6
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+
+if test -z "$ac_cv_prog_DLLTOOL"; then
+if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "dlltool", so it can be a program name with args.
+set dummy dlltool; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:3232: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_DLLTOOL'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  if test -n "$DLLTOOL"; then
+  ac_cv_prog_DLLTOOL="$DLLTOOL" # Let the user override the test.
+else
+  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS=":"
+  ac_dummy="$PATH"
+  for ac_dir in $ac_dummy; do
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/$ac_word; then
+      ac_cv_prog_DLLTOOL="dlltool"
+      break
+    fi
+  done
+  IFS="$ac_save_ifs"
+  test -z "$ac_cv_prog_DLLTOOL" && ac_cv_prog_DLLTOOL="false"
+fi
+fi
+DLLTOOL="$ac_cv_prog_DLLTOOL"
+if test -n "$DLLTOOL"; then
+  echo "$ac_t""$DLLTOOL" 1>&6
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+else
+  DLLTOOL="false"
+fi
+fi
+
+  # Extract the first word of "${ac_tool_prefix}as", so it can be a program name with args.
+set dummy ${ac_tool_prefix}as; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:3267: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_AS'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  if test -n "$AS"; then
+  ac_cv_prog_AS="$AS" # Let the user override the test.
+else
+  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS=":"
+  ac_dummy="$PATH"
+  for ac_dir in $ac_dummy; do
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/$ac_word; then
+      ac_cv_prog_AS="${ac_tool_prefix}as"
+      break
+    fi
+  done
+  IFS="$ac_save_ifs"
+fi
+fi
+AS="$ac_cv_prog_AS"
+if test -n "$AS"; then
+  echo "$ac_t""$AS" 1>&6
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+
+if test -z "$ac_cv_prog_AS"; then
+if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "as", so it can be a program name with args.
+set dummy as; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:3299: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_AS'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  if test -n "$AS"; then
+  ac_cv_prog_AS="$AS" # Let the user override the test.
+else
+  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS=":"
+  ac_dummy="$PATH"
+  for ac_dir in $ac_dummy; do
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/$ac_word; then
+      ac_cv_prog_AS="as"
+      break
+    fi
+  done
+  IFS="$ac_save_ifs"
+  test -z "$ac_cv_prog_AS" && ac_cv_prog_AS="false"
+fi
+fi
+AS="$ac_cv_prog_AS"
+if test -n "$AS"; then
+  echo "$ac_t""$AS" 1>&6
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+else
+  AS="false"
+fi
+fi
+
+  # Extract the first word of "${ac_tool_prefix}objdump", so it can be a program name with args.
+set dummy ${ac_tool_prefix}objdump; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:3334: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_OBJDUMP'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  if test -n "$OBJDUMP"; then
+  ac_cv_prog_OBJDUMP="$OBJDUMP" # Let the user override the test.
+else
+  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS=":"
+  ac_dummy="$PATH"
+  for ac_dir in $ac_dummy; do
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/$ac_word; then
+      ac_cv_prog_OBJDUMP="${ac_tool_prefix}objdump"
+      break
+    fi
+  done
+  IFS="$ac_save_ifs"
+fi
+fi
+OBJDUMP="$ac_cv_prog_OBJDUMP"
+if test -n "$OBJDUMP"; then
+  echo "$ac_t""$OBJDUMP" 1>&6
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+
+if test -z "$ac_cv_prog_OBJDUMP"; then
+if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "objdump", so it can be a program name with args.
+set dummy objdump; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:3366: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_OBJDUMP'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  if test -n "$OBJDUMP"; then
+  ac_cv_prog_OBJDUMP="$OBJDUMP" # Let the user override the test.
+else
+  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS=":"
+  ac_dummy="$PATH"
+  for ac_dir in $ac_dummy; do
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/$ac_word; then
+      ac_cv_prog_OBJDUMP="objdump"
+      break
+    fi
+  done
+  IFS="$ac_save_ifs"
+  test -z "$ac_cv_prog_OBJDUMP" && ac_cv_prog_OBJDUMP="false"
+fi
+fi
+OBJDUMP="$ac_cv_prog_OBJDUMP"
+if test -n "$OBJDUMP"; then
+  echo "$ac_t""$OBJDUMP" 1>&6
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+else
+  OBJDUMP="false"
+fi
+fi
+
+
+  # recent cygwin and mingw systems supply a stub DllMain which the user
+  # can override, but on older systems we have to supply one
+  echo $ac_n "checking if libtool should supply DllMain function""... $ac_c" 1>&6
+echo "configure:3402: checking if libtool should supply DllMain function" >&5
+if eval "test \"`echo '$''{'lt_cv_need_dllmain'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 3407 "configure"
+#include "confdefs.h"
+
+int main() {
+extern int __attribute__((__stdcall__)) DllMain(void*, int, void*);
+      DllMain (0, 0, 0);
+; return 0; }
+EOF
+if { (eval echo configure:3415: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  lt_cv_need_dllmain=no
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  lt_cv_need_dllmain=yes
+fi
+rm -f conftest*
+fi
+
+echo "$ac_t""$lt_cv_need_dllmain" 1>&6
+
+  case $host/$CC in
+  *-*-cygwin*/gcc*-mno-cygwin*|*-*-mingw*)
+    # old mingw systems require "-dll" to link a DLL, while more recent ones
+    # require "-mdll"
+    SAVE_CFLAGS="$CFLAGS"
+    CFLAGS="$CFLAGS -mdll"
+    echo $ac_n "checking how to link DLLs""... $ac_c" 1>&6
+echo "configure:3436: checking how to link DLLs" >&5
+if eval "test \"`echo '$''{'lt_cv_cc_dll_switch'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 3441 "configure"
+#include "confdefs.h"
+
+int main() {
+
+; return 0; }
+EOF
+if { (eval echo configure:3448: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  lt_cv_cc_dll_switch=-mdll
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  lt_cv_cc_dll_switch=-dll
+fi
+rm -f conftest*
+fi
+
+echo "$ac_t""$lt_cv_cc_dll_switch" 1>&6
+    CFLAGS="$SAVE_CFLAGS" ;;
+  *-*-cygwin* | *-*-pw32*)
+    # cygwin systems need to pass --dll to the linker, and not link
+    # crt.o which will require a WinMain@16 definition.
+    lt_cv_cc_dll_switch="-Wl,--dll -nostartfiles" ;;
+  esac
+  ;;
+  
+esac
+
+# Sed substitution that helps us do robust quoting.  It backslashifies
+# metacharacters that are still active within double-quoted strings.
+Xsed='sed -e s/^X//'
+sed_quote_subst='s/\([\\"\\`$\\\\]\)/\\\1/g'
+
+# Same as above, but do not quote variable references.
+double_quote_subst='s/\([\\"\\`\\\\]\)/\\\1/g'
+
+# Sed substitution to delay expansion of an escaped shell variable in a
+# double_quote_subst'ed string.
+delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g'
+
+# Constants:
+rm="rm -f"
+
+# Global variables:
+default_ofile=libtool
+can_build_shared=yes
+
+# All known linkers require a `.a' archive for static linking (except M$VC,
+# which needs '.lib').
+libext=a
+ltmain="$ac_aux_dir/ltmain.sh"
+ofile="$default_ofile"
+with_gnu_ld="$lt_cv_prog_gnu_ld"
+need_locks="$enable_libtool_lock"
+
+old_CC="$CC"
+old_CFLAGS="$CFLAGS"
+
+# Set sane defaults for various variables
+test -z "$AR" && AR=ar
+test -z "$AR_FLAGS" && AR_FLAGS=cru
+test -z "$AS" && AS=as
+test -z "$CC" && CC=cc
+test -z "$DLLTOOL" && DLLTOOL=dlltool
+test -z "$LD" && LD=ld
+test -z "$LN_S" && LN_S="ln -s"
+test -z "$MAGIC_CMD" && MAGIC_CMD=file
+test -z "$NM" && NM=nm
+test -z "$OBJDUMP" && OBJDUMP=objdump
+test -z "$RANLIB" && RANLIB=:
+test -z "$STRIP" && STRIP=:
+test -z "$ac_objext" && ac_objext=o
+
+if test x"$host" != x"$build"; then
+  ac_tool_prefix=${host_alias}-
+else
+  ac_tool_prefix=
+fi
+
+# Transform linux* to *-*-linux-gnu*, to support old configure scripts.
+case $host_os in
+linux-gnu*) ;;
+linux*) host=`echo $host | sed 's/^\(.*-.*-linux\)\(.*\)$/\1-gnu\2/'`
+esac
+
+case $host_os in
+aix3*)
+  # AIX sometimes has problems with the GCC collect2 program.  For some
+  # reason, if we set the COLLECT_NAMES environment variable, the problems
+  # vanish in a puff of smoke.
+  if test "X${COLLECT_NAMES+set}" != Xset; then
+    COLLECT_NAMES=
+    export COLLECT_NAMES
+  fi
+  ;;
+esac
+
+# Determine commands to create old-style static archives.
+old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs$old_deplibs'
+old_postinstall_cmds='chmod 644 $oldlib'
+old_postuninstall_cmds=
+
+if test -n "$RANLIB"; then
+  case $host_os in
+  openbsd*)
+    old_postinstall_cmds="\$RANLIB -t \$oldlib~$old_postinstall_cmds"
+    ;;
+  *)
+    old_postinstall_cmds="\$RANLIB \$oldlib~$old_postinstall_cmds"
+    ;;
+  esac
+  old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib"
+fi
+
+# Allow CC to be a program name with arguments.
+set dummy $CC
+compiler="$2"
+
+## FIXME: this should be a separate macro
+##
+echo $ac_n "checking for objdir""... $ac_c" 1>&6
+echo "configure:3564: checking for objdir" >&5
+rm -f .libs 2>/dev/null
+mkdir .libs 2>/dev/null
+if test -d .libs; then
+  objdir=.libs
+else
+  # MS-DOS does not allow filenames that begin with a dot.
+  objdir=_libs
+fi
+rmdir .libs 2>/dev/null
+echo "$ac_t""$objdir" 1>&6
+##
+## END FIXME
+
+
+## FIXME: this should be a separate macro
+##
+# Check whether --with-pic or --without-pic was given.
+if test "${with_pic+set}" = set; then
+  withval="$with_pic"
+  pic_mode="$withval"
+else
+  pic_mode=default
+fi
+
+test -z "$pic_mode" && pic_mode=default
+
+# We assume here that the value for lt_cv_prog_cc_pic will not be cached
+# in isolation, and that seeing it set (from the cache) indicates that
+# the associated values are set (in the cache) correctly too.
+echo $ac_n "checking for $compiler option to produce PIC""... $ac_c" 1>&6
+echo "configure:3595: checking for $compiler option to produce PIC" >&5
+if eval "test \"`echo '$''{'lt_cv_prog_cc_pic'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+   lt_cv_prog_cc_pic=
+  lt_cv_prog_cc_shlib=
+  lt_cv_prog_cc_wl=
+  lt_cv_prog_cc_static=
+  lt_cv_prog_cc_no_builtin=
+  lt_cv_prog_cc_can_build_shared=$can_build_shared
+
+  if test "$GCC" = yes; then
+    lt_cv_prog_cc_wl='-Wl,'
+    lt_cv_prog_cc_static='-static'
+
+    case $host_os in
+    aix*)
+      # Below there is a dirty hack to force normal static linking with -ldl
+      # The problem is because libdl dynamically linked with both libc and
+      # libC (AIX C++ library), which obviously doesn't included in libraries
+      # list by gcc. This cause undefined symbols with -static flags.
+      # This hack allows C programs to be linked with "-static -ldl", but
+      # not sure about C++ programs.
+      lt_cv_prog_cc_static="$lt_cv_prog_cc_static ${lt_cv_prog_cc_wl}-lC"
+      ;;
+    amigaos*)
+      # FIXME: we need at least 68020 code to build shared libraries, but
+      # adding the `-m68020' flag to GCC prevents building anything better,
+      # like `-m68040'.
+      lt_cv_prog_cc_pic='-m68020 -resident32 -malways-restore-a4'
+      ;;
+    beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
+      # PIC is the default for these OSes.
+      ;;
+    darwin* | rhapsody*)
+      # PIC is the default on this platform
+      # Common symbols not allowed in MH_DYLIB files
+      lt_cv_prog_cc_pic='-fno-common'
+      ;;
+    cygwin* | mingw* | pw32* | os2*)
+      # This hack is so that the source file can tell whether it is being
+      # built for inclusion in a dll (and should export symbols for example).
+      lt_cv_prog_cc_pic='-DDLL_EXPORT'
+      ;;
+    sysv4*MP*)
+      if test -d /usr/nec; then
+	 lt_cv_prog_cc_pic=-Kconform_pic
+      fi
+      ;;
+    *)
+      lt_cv_prog_cc_pic='-fPIC'
+      ;;
+    esac
+  else
+    # PORTME Check for PIC flags for the system compiler.
+    case $host_os in
+    aix3* | aix4* | aix5*)
+      lt_cv_prog_cc_wl='-Wl,'
+      # All AIX code is PIC.
+      if test "$host_cpu" = ia64; then
+	# AIX 5 now supports IA64 processor
+	lt_cv_prog_cc_static='-Bstatic'
+      else
+	lt_cv_prog_cc_static='-bnso -bI:/lib/syscalls.exp'
+      fi
+      ;;
+
+    hpux9* | hpux10* | hpux11*)
+      # Is there a better lt_cv_prog_cc_static that works with the bundled CC?
+      lt_cv_prog_cc_wl='-Wl,'
+      lt_cv_prog_cc_static="${lt_cv_prog_cc_wl}-a ${lt_cv_prog_cc_wl}archive"
+      lt_cv_prog_cc_pic='+Z'
+      ;;
+
+    irix5* | irix6* | nonstopux*)
+      lt_cv_prog_cc_wl='-Wl,'
+      lt_cv_prog_cc_static='-non_shared'
+      # PIC (with -KPIC) is the default.
+      ;;
+
+    cygwin* | mingw* | pw32* | os2*)
+      # This hack is so that the source file can tell whether it is being
+      # built for inclusion in a dll (and should export symbols for example).
+      lt_cv_prog_cc_pic='-DDLL_EXPORT'
+      ;;
+
+    newsos6)
+      lt_cv_prog_cc_pic='-KPIC'
+      lt_cv_prog_cc_static='-Bstatic'
+      ;;
+
+    osf3* | osf4* | osf5*)
+      # All OSF/1 code is PIC.
+      lt_cv_prog_cc_wl='-Wl,'
+      lt_cv_prog_cc_static='-non_shared'
+      ;;
+
+    sco3.2v5*)
+      lt_cv_prog_cc_pic='-Kpic'
+      lt_cv_prog_cc_static='-dn'
+      lt_cv_prog_cc_shlib='-belf'
+      ;;
+
+    solaris*)
+      lt_cv_prog_cc_pic='-KPIC'
+      lt_cv_prog_cc_static='-Bstatic'
+      lt_cv_prog_cc_wl='-Wl,'
+      ;;
+
+    sunos4*)
+      lt_cv_prog_cc_pic='-PIC'
+      lt_cv_prog_cc_static='-Bstatic'
+      lt_cv_prog_cc_wl='-Qoption ld '
+      ;;
+
+    sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
+      lt_cv_prog_cc_pic='-KPIC'
+      lt_cv_prog_cc_static='-Bstatic'
+      lt_cv_prog_cc_wl='-Wl,'
+      ;;
+
+    uts4*)
+      lt_cv_prog_cc_pic='-pic'
+      lt_cv_prog_cc_static='-Bstatic'
+      ;;
+
+    sysv4*MP*)
+      if test -d /usr/nec ;then
+	lt_cv_prog_cc_pic='-Kconform_pic'
+	lt_cv_prog_cc_static='-Bstatic'
+      fi
+      ;;
+
+    *)
+      lt_cv_prog_cc_can_build_shared=no
+      ;;
+    esac
+  fi
+
+fi
+
+if test -z "$lt_cv_prog_cc_pic"; then
+  echo "$ac_t""none" 1>&6
+else
+  echo "$ac_t""$lt_cv_prog_cc_pic" 1>&6
+
+  # Check to make sure the pic_flag actually works.
+  echo $ac_n "checking if $compiler PIC flag $lt_cv_prog_cc_pic works""... $ac_c" 1>&6
+echo "configure:3743: checking if $compiler PIC flag $lt_cv_prog_cc_pic works" >&5
+  if eval "test \"`echo '$''{'lt_cv_prog_cc_pic_works'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+      save_CFLAGS="$CFLAGS"
+    CFLAGS="$CFLAGS $lt_cv_prog_cc_pic -DPIC"
+    cat > conftest.$ac_ext <<EOF
+#line 3750 "configure"
+#include "confdefs.h"
+
+int main() {
+
+; return 0; }
+EOF
+if { (eval echo configure:3757: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+        case $host_os in
+      hpux9* | hpux10* | hpux11*)
+	# On HP-UX, both CC and GCC only warn that PIC is supported... then
+	# they create non-PIC objects.  So, if there were any warnings, we
+	# assume that PIC is not supported.
+	if test -s conftest.err; then
+	  lt_cv_prog_cc_pic_works=no
+	else
+	  lt_cv_prog_cc_pic_works=yes
+	fi
+	;;
+      *)
+	lt_cv_prog_cc_pic_works=yes
+	;;
+      esac
+    
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+        lt_cv_prog_cc_pic_works=no
+    
+fi
+rm -f conftest*
+    CFLAGS="$save_CFLAGS"
+  
+fi
+
+
+  if test "X$lt_cv_prog_cc_pic_works" = Xno; then
+    lt_cv_prog_cc_pic=
+    lt_cv_prog_cc_can_build_shared=no
+  else
+    lt_cv_prog_cc_pic=" $lt_cv_prog_cc_pic"
+  fi
+
+  echo "$ac_t""$lt_cv_prog_cc_pic_works" 1>&6
+fi
+##
+## END FIXME
+
+# Check for any special shared library compilation flags.
+if test -n "$lt_cv_prog_cc_shlib"; then
+  echo "configure: warning: \`$CC' requires \`$lt_cv_prog_cc_shlib' to build shared libraries" 1>&2
+  if echo "$old_CC $old_CFLAGS " | egrep -e "[ 	]$lt_cv_prog_cc_shlib[ 	]" >/dev/null; then :
+  else
+   echo "configure: warning: add \`$lt_cv_prog_cc_shlib' to the CC or CFLAGS env variable and reconfigure" 1>&2
+    lt_cv_prog_cc_can_build_shared=no
+  fi
+fi
+
+## FIXME: this should be a separate macro
+##
+echo $ac_n "checking if $compiler static flag $lt_cv_prog_cc_static works""... $ac_c" 1>&6
+echo "configure:3813: checking if $compiler static flag $lt_cv_prog_cc_static works" >&5
+if eval "test \"`echo '$''{'lt_cv_prog_cc_static_works'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+    lt_cv_prog_cc_static_works=no
+  save_LDFLAGS="$LDFLAGS"
+  LDFLAGS="$LDFLAGS $lt_cv_prog_cc_static"
+  cat > conftest.$ac_ext <<EOF
+#line 3821 "configure"
+#include "confdefs.h"
+
+int main() {
+
+; return 0; }
+EOF
+if { (eval echo configure:3828: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  lt_cv_prog_cc_static_works=yes
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+fi
+rm -f conftest*
+  LDFLAGS="$save_LDFLAGS"
+
+fi
+
+
+# Belt *and* braces to stop my trousers falling down:
+test "X$lt_cv_prog_cc_static_works" = Xno && lt_cv_prog_cc_static=
+echo "$ac_t""$lt_cv_prog_cc_static_works" 1>&6
+
+pic_flag="$lt_cv_prog_cc_pic"
+special_shlib_compile_flags="$lt_cv_prog_cc_shlib"
+wl="$lt_cv_prog_cc_wl"
+link_static_flag="$lt_cv_prog_cc_static"
+no_builtin_flag="$lt_cv_prog_cc_no_builtin"
+can_build_shared="$lt_cv_prog_cc_can_build_shared"
+##
+## END FIXME
+
+
+## FIXME: this should be a separate macro
+##
+# Check to see if options -o and -c are simultaneously supported by compiler
+echo $ac_n "checking if $compiler supports -c -o file.$ac_objext""... $ac_c" 1>&6
+echo "configure:3859: checking if $compiler supports -c -o file.$ac_objext" >&5
+if eval "test \"`echo '$''{'lt_cv_compiler_c_o'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+$rm -r conftest 2>/dev/null
+mkdir conftest
+cd conftest
+echo "int some_variable = 0;" > conftest.$ac_ext
+mkdir out
+# According to Tom Tromey, Ian Lance Taylor reported there are C compilers
+# that will create temporary files in the current directory regardless of
+# the output directory.  Thus, making CWD read-only will cause this test
+# to fail, enabling locking or at least warning the user not to do parallel
+# builds.
+chmod -w .
+save_CFLAGS="$CFLAGS"
+CFLAGS="$CFLAGS -o out/conftest2.$ac_objext"
+compiler_c_o=no
+if { (eval echo configure:3878: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>out/conftest.err; } && test -s out/conftest2.$ac_objext; then
+  # The compiler can only warn and ignore the option if not recognized
+  # So say no if there are warnings
+  if test -s out/conftest.err; then
+    lt_cv_compiler_c_o=no
+  else
+    lt_cv_compiler_c_o=yes
+  fi
+else
+  # Append any errors to the config.log.
+  cat out/conftest.err 1>&5
+  lt_cv_compiler_c_o=no
+fi
+CFLAGS="$save_CFLAGS"
+chmod u+w .
+$rm conftest* out/*
+rmdir out
+cd ..
+rmdir conftest
+$rm -r conftest 2>/dev/null
+
+fi
+
+compiler_c_o=$lt_cv_compiler_c_o
+echo "$ac_t""$compiler_c_o" 1>&6
+
+if test x"$compiler_c_o" = x"yes"; then
+  # Check to see if we can write to a .lo
+  echo $ac_n "checking if $compiler supports -c -o file.lo""... $ac_c" 1>&6
+echo "configure:3907: checking if $compiler supports -c -o file.lo" >&5
+  if eval "test \"`echo '$''{'lt_cv_compiler_o_lo'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+  lt_cv_compiler_o_lo=no
+  save_CFLAGS="$CFLAGS"
+  CFLAGS="$CFLAGS -c -o conftest.lo"
+  save_objext="$ac_objext"
+  ac_objext=lo
+  cat > conftest.$ac_ext <<EOF
+#line 3918 "configure"
+#include "confdefs.h"
+
+int main() {
+int some_variable = 0;
+; return 0; }
+EOF
+if { (eval echo configure:3925: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+      # The compiler can only warn and ignore the option if not recognized
+    # So say no if there are warnings
+    if test -s conftest.err; then
+      lt_cv_compiler_o_lo=no
+    else
+      lt_cv_compiler_o_lo=yes
+    fi
+  
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+fi
+rm -f conftest*
+  ac_objext="$save_objext"
+  CFLAGS="$save_CFLAGS"
+  
+fi
+
+  compiler_o_lo=$lt_cv_compiler_o_lo
+  echo "$ac_t""$compiler_o_lo" 1>&6
+else
+  compiler_o_lo=no
+fi
+##
+## END FIXME
+
+## FIXME: this should be a separate macro
+##
+# Check to see if we can do hard links to lock some files if needed
+hard_links="nottested"
+if test "$compiler_c_o" = no && test "$need_locks" != no; then
+  # do not overwrite the value of need_locks provided by the user
+  echo $ac_n "checking if we can lock with hard links""... $ac_c" 1>&6
+echo "configure:3960: checking if we can lock with hard links" >&5
+  hard_links=yes
+  $rm conftest*
+  ln conftest.a conftest.b 2>/dev/null && hard_links=no
+  touch conftest.a
+  ln conftest.a conftest.b 2>&5 || hard_links=no
+  ln conftest.a conftest.b 2>/dev/null && hard_links=no
+  echo "$ac_t""$hard_links" 1>&6
+  if test "$hard_links" = no; then
+    echo "configure: warning: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" 1>&2
+    need_locks=warn
+  fi
+else
+  need_locks=no
+fi
+##
+## END FIXME
+
+## FIXME: this should be a separate macro
+##
+if test "$GCC" = yes; then
+  # Check to see if options -fno-rtti -fno-exceptions are supported by compiler
+  echo $ac_n "checking if $compiler supports -fno-rtti -fno-exceptions""... $ac_c" 1>&6
+echo "configure:3983: checking if $compiler supports -fno-rtti -fno-exceptions" >&5
+  echo "int some_variable = 0;" > conftest.$ac_ext
+  save_CFLAGS="$CFLAGS"
+  CFLAGS="$CFLAGS -fno-rtti -fno-exceptions -c conftest.$ac_ext"
+  compiler_rtti_exceptions=no
+  cat > conftest.$ac_ext <<EOF
+#line 3989 "configure"
+#include "confdefs.h"
+
+int main() {
+int some_variable = 0;
+; return 0; }
+EOF
+if { (eval echo configure:3996: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+      # The compiler can only warn and ignore the option if not recognized
+    # So say no if there are warnings
+    if test -s conftest.err; then
+      compiler_rtti_exceptions=no
+    else
+      compiler_rtti_exceptions=yes
+    fi
+  
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+fi
+rm -f conftest*
+  CFLAGS="$save_CFLAGS"
+  echo "$ac_t""$compiler_rtti_exceptions" 1>&6
+
+  if test "$compiler_rtti_exceptions" = "yes"; then
+    no_builtin_flag=' -fno-builtin -fno-rtti -fno-exceptions'
+  else
+    no_builtin_flag=' -fno-builtin'
+  fi
+fi
+##
+## END FIXME
+
+## FIXME: this should be a separate macro
+##
+# See if the linker supports building shared libraries.
+echo $ac_n "checking whether the linker ($LD) supports shared libraries""... $ac_c" 1>&6
+echo "configure:4027: checking whether the linker ($LD) supports shared libraries" >&5
+
+allow_undefined_flag=
+no_undefined_flag=
+need_lib_prefix=unknown
+need_version=unknown
+# when you set need_version to no, make sure it does not cause -set_version
+# flags to be left without arguments
+archive_cmds=
+archive_expsym_cmds=
+old_archive_from_new_cmds=
+old_archive_from_expsyms_cmds=
+export_dynamic_flag_spec=
+whole_archive_flag_spec=
+thread_safe_flag_spec=
+hardcode_into_libs=no
+hardcode_libdir_flag_spec=
+hardcode_libdir_separator=
+hardcode_direct=no
+hardcode_minus_L=no
+hardcode_shlibpath_var=unsupported
+runpath_var=
+link_all_deplibs=unknown
+always_export_symbols=no
+export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | sed '\''s/.* //'\'' | sort | uniq > $export_symbols'
+# include_expsyms should be a list of space-separated symbols to be *always*
+# included in the symbol list
+include_expsyms=
+# exclude_expsyms can be an egrep regular expression of symbols to exclude
+# it will be wrapped by ` (' and `)$', so one must not match beginning or
+# end of line.  Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc',
+# as well as any symbol that contains `d'.
+exclude_expsyms="_GLOBAL_OFFSET_TABLE_"
+# Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out
+# platforms (ab)use it in PIC code, but their linkers get confused if
+# the symbol is explicitly referenced.  Since portable code cannot
+# rely on this symbol name, it's probably fine to never include it in
+# preloaded symbol tables.
+extract_expsyms_cmds=
+
+case $host_os in
+cygwin* | mingw* | pw32*)
+  # FIXME: the MSVC++ port hasn't been tested in a loooong time
+  # When not using gcc, we currently assume that we are using
+  # Microsoft Visual C++.
+  if test "$GCC" != yes; then
+    with_gnu_ld=no
+  fi
+  ;;
+openbsd*)
+  with_gnu_ld=no
+  ;;
+esac
+
+ld_shlibs=yes
+if test "$with_gnu_ld" = yes; then
+  # If archive_cmds runs LD, not CC, wlarc should be empty
+  wlarc='${wl}'
+
+  # See if GNU ld supports shared libraries.
+  case $host_os in
+  aix3* | aix4* | aix5*)
+    # On AIX, the GNU linker is very broken
+    # Note:Check GNU linker on AIX 5-IA64 when/if it becomes available.
+    ld_shlibs=no
+    cat <<EOF 1>&2
+
+*** Warning: the GNU linker, at least up to release 2.9.1, is reported
+*** to be unable to reliably create shared libraries on AIX.
+*** Therefore, libtool is disabling shared libraries support.  If you
+*** really care for shared libraries, you may want to modify your PATH
+*** so that a non-GNU linker is found, and then restart.
+
+EOF
+    ;;
+
+  amigaos*)
+    archive_cmds='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
+    hardcode_libdir_flag_spec='-L$libdir'
+    hardcode_minus_L=yes
+
+    # Samuel A. Falvo II <kc5tja@dolphin.openprojects.net> reports
+    # that the semantics of dynamic libraries on AmigaOS, at least up
+    # to version 4, is to share data among multiple programs linked
+    # with the same dynamic library.  Since this doesn't match the
+    # behavior of shared libraries on other platforms, we can use
+    # them.
+    ld_shlibs=no
+    ;;
+
+  beos*)
+    if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then
+      allow_undefined_flag=unsupported
+      # Joseph Beckenbach <jrb3@best.com> says some releases of gcc
+      # support --undefined.  This deserves some investigation.  FIXME
+      archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+    else
+      ld_shlibs=no
+    fi
+    ;;
+
+  cygwin* | mingw* | pw32*)
+    # hardcode_libdir_flag_spec is actually meaningless, as there is
+    # no search path for DLLs.
+    hardcode_libdir_flag_spec='-L$libdir'
+    allow_undefined_flag=unsupported
+    always_export_symbols=yes
+
+    extract_expsyms_cmds='test -f $output_objdir/impgen.c || \
+      sed -e "/^# \/\* impgen\.c starts here \*\//,/^# \/\* impgen.c ends here \*\// { s/^# //;s/^# *$//; p; }" -e d < $''0 > $output_objdir/impgen.c~
+      test -f $output_objdir/impgen.exe || (cd $output_objdir && \
+      if test "x$HOST_CC" != "x" ; then $HOST_CC -o impgen impgen.c ; \
+      else $CC -o impgen impgen.c ; fi)~
+      $output_objdir/impgen $dir/$soroot > $output_objdir/$soname-def'
+
+    old_archive_from_expsyms_cmds='$DLLTOOL --as=$AS --dllname $soname --def $output_objdir/$soname-def --output-lib $output_objdir/$newlib'
+
+    # cygwin and mingw dlls have different entry points and sets of symbols
+    # to exclude.
+    # FIXME: what about values for MSVC?
+    dll_entry=__cygwin_dll_entry@12
+    dll_exclude_symbols=DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12~
+    case $host_os in
+    mingw*)
+      # mingw values
+      dll_entry=_DllMainCRTStartup@12
+      dll_exclude_symbols=DllMain@12,DllMainCRTStartup@12,DllEntryPoint@12~
+      ;;
+    esac
+
+    # mingw and cygwin differ, and it's simplest to just exclude the union
+    # of the two symbol sets.
+    dll_exclude_symbols=DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12,DllMainCRTStartup@12,DllEntryPoint@12
+
+    # recent cygwin and mingw systems supply a stub DllMain which the user
+    # can override, but on older systems we have to supply one (in ltdll.c)
+    if test "x$lt_cv_need_dllmain" = "xyes"; then
+      ltdll_obj='$output_objdir/$soname-ltdll.'"$ac_objext "
+      ltdll_cmds='test -f $output_objdir/$soname-ltdll.c || sed -e "/^# \/\* ltdll\.c starts here \*\//,/^# \/\* ltdll.c ends here \*\// { s/^# //; p; }" -e d < $''0 > $output_objdir/$soname-ltdll.c~
+	test -f $output_objdir/$soname-ltdll.$ac_objext || (cd $output_objdir && $CC -c $soname-ltdll.c)~'
+    else
+      ltdll_obj=
+      ltdll_cmds=
+    fi
+
+    # Extract the symbol export list from an `--export-all' def file,
+    # then regenerate the def file from the symbol export list, so that
+    # the compiled dll only exports the symbol export list.
+    # Be careful not to strip the DATA tag left be newer dlltools.
+    export_symbols_cmds="$ltdll_cmds"'
+      $DLLTOOL --export-all --exclude-symbols '$dll_exclude_symbols' --output-def $output_objdir/$soname-def '$ltdll_obj'$libobjs $convenience~
+      sed -e "1,/EXPORTS/d" -e "s/ @ [0-9]*//" -e "s/ *;.*$//" < $output_objdir/$soname-def > $export_symbols'
+
+    # If the export-symbols file already is a .def file (1st line
+    # is EXPORTS), use it as is.
+    # If DATA tags from a recent dlltool are present, honour them!
+    archive_expsym_cmds='if test "x`sed 1q $export_symbols`" = xEXPORTS; then
+	cp $export_symbols $output_objdir/$soname-def;
+      else
+	echo EXPORTS > $output_objdir/$soname-def;
+	_lt_hint=1;
+	cat $export_symbols | while read symbol; do
+	 set dummy \$symbol;
+	 case \$# in
+	   2) echo "   \$2 @ \$_lt_hint ; " >> $output_objdir/$soname-def;;
+	   4) echo "   \$2 \$3 \$4 ; " >> $output_objdir/$soname-def; _lt_hint=`expr \$_lt_hint - 1`;;
+	   *) echo "     \$2 @ \$_lt_hint \$3 ; " >> $output_objdir/$soname-def;;
+	 esac;
+	 _lt_hint=`expr 1 + \$_lt_hint`;
+	done;
+      fi~
+      '"$ltdll_cmds"'
+      $CC -Wl,--base-file,$output_objdir/$soname-base '$lt_cv_cc_dll_switch' -Wl,-e,'$dll_entry' -o $output_objdir/$soname '$ltdll_obj'$libobjs $deplibs $compiler_flags~
+      $DLLTOOL --as=$AS --dllname $soname --exclude-symbols '$dll_exclude_symbols' --def $output_objdir/$soname-def --base-file $output_objdir/$soname-base --output-exp $output_objdir/$soname-exp~
+      $CC -Wl,--base-file,$output_objdir/$soname-base $output_objdir/$soname-exp '$lt_cv_cc_dll_switch' -Wl,-e,'$dll_entry' -o $output_objdir/$soname '$ltdll_obj'$libobjs $deplibs $compiler_flags~
+      $DLLTOOL --as=$AS --dllname $soname --exclude-symbols '$dll_exclude_symbols' --def $output_objdir/$soname-def --base-file $output_objdir/$soname-base --output-exp $output_objdir/$soname-exp --output-lib $output_objdir/$libname.dll.a~
+      $CC $output_objdir/$soname-exp '$lt_cv_cc_dll_switch' -Wl,-e,'$dll_entry' -o $output_objdir/$soname '$ltdll_obj'$libobjs $deplibs $compiler_flags'
+    ;;
+
+  netbsd*)
+    if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
+      archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib'
+      wlarc=
+    else
+      archive_cmds='$CC -shared -nodefaultlibs $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+      archive_expsym_cmds='$CC -shared -nodefaultlibs $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+    fi
+    ;;
+
+  solaris* | sysv5*)
+    if $LD -v 2>&1 | egrep 'BFD 2\.8' > /dev/null; then
+      ld_shlibs=no
+      cat <<EOF 1>&2
+
+*** Warning: The releases 2.8.* of the GNU linker cannot reliably
+*** create shared libraries on Solaris systems.  Therefore, libtool
+*** is disabling shared libraries support.  We urge you to upgrade GNU
+*** binutils to release 2.9.1 or newer.  Another option is to modify
+*** your PATH or compiler configuration so that the native linker is
+*** used, and then restart.
+
+EOF
+    elif $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then
+      archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+      archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+    else
+      ld_shlibs=no
+    fi
+    ;;
+
+  sunos4*)
+    archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+    wlarc=
+    hardcode_direct=yes
+    hardcode_shlibpath_var=no
+    ;;
+
+  *)
+    if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then
+      archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+      archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+    else
+      ld_shlibs=no
+    fi
+    ;;
+  esac
+
+  if test "$ld_shlibs" = yes; then
+    runpath_var=LD_RUN_PATH
+    hardcode_libdir_flag_spec='${wl}--rpath ${wl}$libdir'
+    export_dynamic_flag_spec='${wl}--export-dynamic'
+    case $host_os in
+    cygwin* | mingw* | pw32*)
+      # dlltool doesn't understand --whole-archive et. al.
+      whole_archive_flag_spec=
+      ;;
+    *)
+      # ancient GNU ld didn't support --whole-archive et. al.
+      if $LD --help 2>&1 | egrep 'no-whole-archive' > /dev/null; then
+	whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+      else
+	whole_archive_flag_spec=
+      fi
+      ;;
+    esac
+  fi
+else
+  # PORTME fill in a description of your system's linker (not GNU ld)
+  case $host_os in
+  aix3*)
+    allow_undefined_flag=unsupported
+    always_export_symbols=yes
+    archive_expsym_cmds='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname'
+    # Note: this linker hardcodes the directories in LIBPATH if there
+    # are no directories specified by -L.
+    hardcode_minus_L=yes
+    if test "$GCC" = yes && test -z "$link_static_flag"; then
+      # Neither direct hardcoding nor static linking is supported with a
+      # broken collect2.
+      hardcode_direct=unsupported
+    fi
+    ;;
+
+  aix4* | aix5*)
+    if test "$host_cpu" = ia64; then
+      # On IA64, the linker does run time linking by default, so we don't
+      # have to do anything special.
+      aix_use_runtimelinking=no
+      exp_sym_flag='-Bexport'
+      no_entry_flag=""
+    else
+      aix_use_runtimelinking=no
+
+      # Test if we are trying to use run time linking or normal
+      # AIX style linking. If -brtl is somewhere in LDFLAGS, we
+      # need to do runtime linking.
+      case $host_os in aix4.[23]|aix4.[23].*|aix5*)
+	for ld_flag in $LDFLAGS; do
+	  case $ld_flag in
+	  *-brtl*)
+	    aix_use_runtimelinking=yes
+	    break
+	  ;;
+	  esac
+	done
+      esac
+
+      exp_sym_flag='-bexport'
+      no_entry_flag='-bnoentry'
+    fi
+
+    # When large executables or shared objects are built, AIX ld can
+    # have problems creating the table of contents.  If linking a library
+    # or program results in "error TOC overflow" add -mminimal-toc to
+    # CXXFLAGS/CFLAGS for g++/gcc.  In the cases where that is not
+    # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS.
+
+    hardcode_direct=yes
+    archive_cmds=''
+    hardcode_libdir_separator=':'
+    if test "$GCC" = yes; then
+      case $host_os in aix4.[012]|aix4.[012].*)
+	collect2name=`${CC} -print-prog-name=collect2`
+	if test -f "$collect2name" && \
+	  strings "$collect2name" | grep resolve_lib_name >/dev/null
+	then
+	  # We have reworked collect2
+	  hardcode_direct=yes
+	else
+	  # We have old collect2
+	  hardcode_direct=unsupported
+	  # It fails to find uninstalled libraries when the uninstalled
+	  # path is not listed in the libpath.  Setting hardcode_minus_L
+	  # to unsupported forces relinking
+	  hardcode_minus_L=yes
+	  hardcode_libdir_flag_spec='-L$libdir'
+	  hardcode_libdir_separator=
+	fi
+      esac
+
+      shared_flag='-shared'
+    else
+      # not using gcc
+      if test "$host_cpu" = ia64; then
+	shared_flag='${wl}-G'
+      else
+	if test "$aix_use_runtimelinking" = yes; then
+	  shared_flag='${wl}-G'
+	else
+	  shared_flag='${wl}-bM:SRE'
+	fi
+      fi
+    fi
+
+    # It seems that -bexpall can do strange things, so it is better to
+    # generate a list of symbols to export.
+    always_export_symbols=yes
+    if test "$aix_use_runtimelinking" = yes; then
+      # Warning - without using the other runtime loading flags (-brtl),
+      # -berok will link without error, but may produce a broken library.
+      allow_undefined_flag='-berok'
+      hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:/usr/lib:/lib'
+      archive_expsym_cmds="\$CC"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols $shared_flag"
+    else
+      if test "$host_cpu" = ia64; then
+	hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib'
+	allow_undefined_flag="-z nodefs"
+	archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname ${wl}-h$soname $libobjs $deplibs $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols"
+      else
+	hardcode_libdir_flag_spec='${wl}-bnolibpath ${wl}-blibpath:$libdir:/usr/lib:/lib'
+	# Warning - without using the other run time loading flags,
+	# -berok will link without error, but may produce a broken library.
+	allow_undefined_flag='${wl}-berok'
+	# This is a bit strange, but is similar to how AIX traditionally builds
+	# it's shared libraries.
+	archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols"' ~$AR -crlo $objdir/$libname$release.a $objdir/$soname'
+      fi
+    fi
+    ;;
+
+  amigaos*)
+    archive_cmds='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
+    hardcode_libdir_flag_spec='-L$libdir'
+    hardcode_minus_L=yes
+    # see comment about different semantics on the GNU ld section
+    ld_shlibs=no
+    ;;
+
+  cygwin* | mingw* | pw32*)
+    # When not using gcc, we currently assume that we are using
+    # Microsoft Visual C++.
+    # hardcode_libdir_flag_spec is actually meaningless, as there is
+    # no search path for DLLs.
+    hardcode_libdir_flag_spec=' '
+    allow_undefined_flag=unsupported
+    # Tell ltmain to make .lib files, not .a files.
+    libext=lib
+    # FIXME: Setting linknames here is a bad hack.
+    archive_cmds='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | sed -e '\''s/ -lc$//'\''` -link -dll~linknames='
+    # The linker will automatically build a .lib file if we build a DLL.
+    old_archive_from_new_cmds='true'
+    # FIXME: Should let the user specify the lib program.
+    old_archive_cmds='lib /OUT:$oldlib$oldobjs$old_deplibs'
+    fix_srcfile_path='`cygpath -w "$srcfile"`'
+    ;;
+
+  darwin* | rhapsody*)
+    case "$host_os" in
+    rhapsody* | darwin1.[012])
+      allow_undefined_flag='-undefined suppress'
+      ;;
+    *) # Darwin 1.3 on
+      allow_undefined_flag='-flat_namespace -undefined suppress'
+      ;;
+    esac
+    # FIXME: Relying on posixy $() will cause problems for
+    #        cross-compilation, but unfortunately the echo tests do not
+    #        yet detect zsh echo's removal of \ escapes.  Also zsh mangles
+    #	     `"' quotes if we put them in here... so don't!
+    archive_cmds='$CC -r -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs && $CC $(test .$module = .yes && echo -bundle || echo -dynamiclib) $allow_undefined_flag -o $lib ${lib}-master.o $deplibs$linker_flags $(test .$module != .yes && echo -install_name $rpath/$soname $verstring)'
+    # We need to add '_' to the symbols in $export_symbols first
+    #archive_expsym_cmds="$archive_cmds"' && strip -s $export_symbols'
+    hardcode_direct=yes
+    hardcode_shlibpath_var=no
+    whole_archive_flag_spec='-all_load $convenience'
+    ;;
+
+  freebsd1*)
+    ld_shlibs=no
+    ;;
+
+  # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor
+  # support.  Future versions do this automatically, but an explicit c++rt0.o
+  # does not break anything, and helps significantly (at the cost of a little
+  # extra space).
+  freebsd2.2*)
+    archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o'
+    hardcode_libdir_flag_spec='-R$libdir'
+    hardcode_direct=yes
+    hardcode_shlibpath_var=no
+    ;;
+
+  # Unfortunately, older versions of FreeBSD 2 do not have this feature.
+  freebsd2*)
+    archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+    hardcode_direct=yes
+    hardcode_minus_L=yes
+    hardcode_shlibpath_var=no
+    ;;
+
+  # FreeBSD 3 and greater uses gcc -shared to do shared libraries.
+  freebsd*)
+    archive_cmds='$CC -shared -o $lib $libobjs $deplibs $compiler_flags'
+    hardcode_libdir_flag_spec='-R$libdir'
+    hardcode_direct=yes
+    hardcode_shlibpath_var=no
+    ;;
+
+  hpux9* | hpux10* | hpux11*)
+    case $host_os in
+    hpux9*) archive_cmds='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' ;;
+    *) archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' ;;
+    esac
+    hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
+    hardcode_libdir_separator=:
+    hardcode_direct=yes
+    hardcode_minus_L=yes # Not in the search PATH, but as the default
+			 # location of the library.
+    export_dynamic_flag_spec='${wl}-E'
+    ;;
+
+  irix5* | irix6* | nonstopux*)
+    if test "$GCC" = yes; then
+      archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+      hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+    else
+      archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
+      hardcode_libdir_flag_spec='-rpath $libdir'
+    fi
+    hardcode_libdir_separator=:
+    link_all_deplibs=yes
+    ;;
+
+  netbsd*)
+    if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
+      archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'  # a.out
+    else
+      archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linker_flags'      # ELF
+    fi
+    hardcode_libdir_flag_spec='-R$libdir'
+    hardcode_direct=yes
+    hardcode_shlibpath_var=no
+    ;;
+
+  newsos6)
+    archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+    hardcode_direct=yes
+    hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+    hardcode_libdir_separator=:
+    hardcode_shlibpath_var=no
+    ;;
+
+  openbsd*)
+    hardcode_direct=yes
+    hardcode_shlibpath_var=no
+    if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+      archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+      hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
+      export_dynamic_flag_spec='${wl}-E'
+    else
+      case "$host_os" in
+      openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*)
+	archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+	hardcode_libdir_flag_spec='-R$libdir'
+        ;;
+      *)
+        archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+        hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
+        ;;
+      esac
+    fi
+    ;;
+
+  os2*)
+    hardcode_libdir_flag_spec='-L$libdir'
+    hardcode_minus_L=yes
+    allow_undefined_flag=unsupported
+    archive_cmds='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def'
+    old_archive_from_new_cmds='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def'
+    ;;
+
+  osf3*)
+    if test "$GCC" = yes; then
+      allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
+      archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+    else
+      allow_undefined_flag=' -expect_unresolved \*'
+      archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
+    fi
+    hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+    hardcode_libdir_separator=:
+    ;;
+
+  osf4* | osf5*)	# as osf3* with the addition of -msym flag
+    if test "$GCC" = yes; then
+      allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
+      archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+      hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+    else
+      allow_undefined_flag=' -expect_unresolved \*'
+      archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
+      archive_expsym_cmds='for i in `cat $export_symbols`; do printf "-exported_symbol " >> $lib.exp; echo "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~
+      $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib~$rm $lib.exp'
+
+      #Both c and cxx compiler support -rpath directly
+      hardcode_libdir_flag_spec='-rpath $libdir'
+    fi
+    hardcode_libdir_separator=:
+    ;;
+
+  sco3.2v5*)
+    archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+    hardcode_shlibpath_var=no
+    runpath_var=LD_RUN_PATH
+    hardcode_runpath_var=yes
+    export_dynamic_flag_spec='${wl}-Bexport'
+    ;;
+
+  solaris*)
+    # gcc --version < 3.0 without binutils cannot create self contained
+    # shared libraries reliably, requiring libgcc.a to resolve some of
+    # the object symbols generated in some cases.  Libraries that use
+    # assert need libgcc.a to resolve __eprintf, for example.  Linking
+    # a copy of libgcc.a into every shared library to guarantee resolving
+    # such symbols causes other problems:  According to Tim Van Holder
+    # <tim.van.holder@pandora.be>, C++ libraries end up with a separate
+    # (to the application) exception stack for one thing.
+    no_undefined_flag=' -z defs'
+    if test "$GCC" = yes; then
+      case `$CC --version 2>/dev/null` in
+      [12].*)
+	cat <<EOF 1>&2
+
+*** Warning: Releases of GCC earlier than version 3.0 cannot reliably
+*** create self contained shared libraries on Solaris systems, without
+*** introducing a dependency on libgcc.a.  Therefore, libtool is disabling
+*** -no-undefined support, which will at least allow you to build shared
+*** libraries.  However, you may find that when you link such libraries
+*** into an application without using GCC, you have to manually add
+*** \`gcc --print-libgcc-file-name\` to the link command.  We urge you to
+*** upgrade to a newer version of GCC.  Another option is to rebuild your
+*** current GCC to use the GNU linker from GNU binutils 2.9.1 or newer.
+
+EOF
+        no_undefined_flag=
+	;;
+      esac
+    fi
+    # $CC -shared without GNU ld will not create a library from C++
+    # object files and a static libstdc++, better avoid it by now
+    archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags'
+    archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
+		$LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp'
+    hardcode_libdir_flag_spec='-R$libdir'
+    hardcode_shlibpath_var=no
+    case $host_os in
+    solaris2.[0-5] | solaris2.[0-5].*) ;;
+    *) # Supported since Solaris 2.6 (maybe 2.5.1?)
+      whole_archive_flag_spec='-z allextract$convenience -z defaultextract' ;;
+    esac
+    link_all_deplibs=yes
+    ;;
+
+  sunos4*)
+    if test "x$host_vendor" = xsequent; then
+      # Use $CC to link under sequent, because it throws in some extra .o
+      # files that make .init and .fini sections work.
+      archive_cmds='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags'
+    else
+      archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags'
+    fi
+    hardcode_libdir_flag_spec='-L$libdir'
+    hardcode_direct=yes
+    hardcode_minus_L=yes
+    hardcode_shlibpath_var=no
+    ;;
+
+  sysv4)
+    case $host_vendor in
+      sni)
+        archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+        hardcode_direct=yes # is this really true???
+        ;;
+      siemens)
+        ## LD is ld it makes a PLAMLIB
+        ## CC just makes a GrossModule.
+        archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags'
+        reload_cmds='$CC -r -o $output$reload_objs'
+        hardcode_direct=no
+        ;;
+      motorola)
+        archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+        hardcode_direct=no #Motorola manual says yes, but my tests say they lie
+        ;;
+    esac
+    runpath_var='LD_RUN_PATH'
+    hardcode_shlibpath_var=no
+    ;;
+
+  sysv4.3*)
+    archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+    hardcode_shlibpath_var=no
+    export_dynamic_flag_spec='-Bexport'
+    ;;
+
+  sysv5*)
+    no_undefined_flag=' -z text'
+    # $CC -shared without GNU ld will not create a library from C++
+    # object files and a static libstdc++, better avoid it by now
+    archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags'
+    archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
+		$LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp'
+    hardcode_libdir_flag_spec=
+    hardcode_shlibpath_var=no
+    runpath_var='LD_RUN_PATH'
+    ;;
+
+  uts4*)
+    archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+    hardcode_libdir_flag_spec='-L$libdir'
+    hardcode_shlibpath_var=no
+    ;;
+
+  dgux*)
+    archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+    hardcode_libdir_flag_spec='-L$libdir'
+    hardcode_shlibpath_var=no
+    ;;
+
+  sysv4*MP*)
+    if test -d /usr/nec; then
+      archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      hardcode_shlibpath_var=no
+      runpath_var=LD_RUN_PATH
+      hardcode_runpath_var=yes
+      ld_shlibs=yes
+    fi
+    ;;
+
+  sysv4.2uw2*)
+    archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags'
+    hardcode_direct=yes
+    hardcode_minus_L=no
+    hardcode_shlibpath_var=no
+    hardcode_runpath_var=yes
+    runpath_var=LD_RUN_PATH
+    ;;
+
+  sysv5uw7* | unixware7*)
+    no_undefined_flag='${wl}-z ${wl}text'
+    if test "$GCC" = yes; then
+      archive_cmds='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+    else
+      archive_cmds='$CC -G ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+    fi
+    runpath_var='LD_RUN_PATH'
+    hardcode_shlibpath_var=no
+    ;;
+
+  *)
+    ld_shlibs=no
+    ;;
+  esac
+fi
+echo "$ac_t""$ld_shlibs" 1>&6
+test "$ld_shlibs" = no && can_build_shared=no
+##
+## END FIXME
+
+## FIXME: this should be a separate macro
+##
+# Check hardcoding attributes.
+echo $ac_n "checking how to hardcode library paths into programs""... $ac_c" 1>&6
+echo "configure:4730: checking how to hardcode library paths into programs" >&5
+hardcode_action=
+if test -n "$hardcode_libdir_flag_spec" || \
+   test -n "$runpath_var"; then
+
+  # We can hardcode non-existant directories.
+  if test "$hardcode_direct" != no &&
+     # If the only mechanism to avoid hardcoding is shlibpath_var, we
+     # have to relink, otherwise we might link with an installed library
+     # when we should be linking with a yet-to-be-installed one
+     ## test "$hardcode_shlibpath_var" != no &&
+     test "$hardcode_minus_L" != no; then
+    # Linking always hardcodes the temporary library directory.
+    hardcode_action=relink
+  else
+    # We can link without hardcoding, and we can hardcode nonexisting dirs.
+    hardcode_action=immediate
+  fi
+else
+  # We cannot hardcode anything, or else we can only hardcode existing
+  # directories.
+  hardcode_action=unsupported
+fi
+echo "$ac_t""$hardcode_action" 1>&6
+##
+## END FIXME
+
+## FIXME: this should be a separate macro
+##
+striplib=
+old_striplib=
+echo $ac_n "checking whether stripping libraries is possible""... $ac_c" 1>&6
+echo "configure:4762: checking whether stripping libraries is possible" >&5
+if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then
+  test -z "$old_striplib" && old_striplib="$STRIP --strip-debug"
+  test -z "$striplib" && striplib="$STRIP --strip-unneeded"
+  echo "$ac_t""yes" 1>&6
+else
+  echo "$ac_t""no" 1>&6
+fi
+##
+## END FIXME
+
+reload_cmds='$LD$reload_flag -o $output$reload_objs'
+test -z "$deplibs_check_method" && deplibs_check_method=unknown
+
+## FIXME: this should be a separate macro
+##
+# PORTME Fill in your ld.so characteristics
+echo $ac_n "checking dynamic linker characteristics""... $ac_c" 1>&6
+echo "configure:4780: checking dynamic linker characteristics" >&5
+library_names_spec=
+libname_spec='lib$name'
+soname_spec=
+postinstall_cmds=
+postuninstall_cmds=
+finish_cmds=
+finish_eval=
+shlibpath_var=
+shlibpath_overrides_runpath=unknown
+version_type=none
+dynamic_linker="$host_os ld.so"
+sys_lib_dlsearch_path_spec="/lib /usr/lib"
+sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib"
+
+case $host_os in
+aix3*)
+  version_type=linux
+  library_names_spec='${libname}${release}.so$versuffix $libname.a'
+  shlibpath_var=LIBPATH
+
+  # AIX has no versioning support, so we append a major version to the name.
+  soname_spec='${libname}${release}.so$major'
+  ;;
+
+aix4* | aix5*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  hardcode_into_libs=yes
+  if test "$host_cpu" = ia64; then
+    # AIX 5 supports IA64
+    library_names_spec='${libname}${release}.so$major ${libname}${release}.so$versuffix $libname.so'
+    shlibpath_var=LD_LIBRARY_PATH
+  else
+    # With GCC up to 2.95.x, collect2 would create an import file
+    # for dependence libraries.  The import file would start with
+    # the line `#! .'.  This would cause the generated library to
+    # depend on `.', always an invalid library.  This was fixed in
+    # development snapshots of GCC prior to 3.0.
+    case $host_os in
+      aix4 | aix4.[01] | aix4.[01].*)
+	if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)'
+	     echo ' yes '
+	     echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then
+	  :
+	else
+	  can_build_shared=no
+	fi
+	;;
+    esac
+    # AIX (on Power*) has no versioning support, so currently we can
+    # not hardcode correct soname into executable. Probably we can
+    # add versioning support to collect2, so additional links can
+    # be useful in future.
+    if test "$aix_use_runtimelinking" = yes; then
+      # If using run time linking (on AIX 4.2 or later) use lib<name>.so
+      # instead of lib<name>.a to let people know that these are not
+      # typical AIX shared libraries.
+      library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
+    else
+      # We preserve .a as extension for shared libraries through AIX4.2
+      # and later when we are not doing run time linking.
+      library_names_spec='${libname}${release}.a $libname.a'
+      soname_spec='${libname}${release}.so$major'
+    fi
+    shlibpath_var=LIBPATH
+  fi
+  hardcode_into_libs=yes
+  ;;
+
+amigaos*)
+  library_names_spec='$libname.ixlibrary $libname.a'
+  # Create ${libname}_ixlibrary.a entries in /sys/libs.
+  finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "(cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a)"; (cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a) || exit 1; done'
+  ;;
+
+beos*)
+  library_names_spec='${libname}.so'
+  dynamic_linker="$host_os ld.so"
+  shlibpath_var=LIBRARY_PATH
+  ;;
+
+bsdi4*)
+  version_type=linux
+  need_version=no
+  library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
+  soname_spec='${libname}${release}.so$major'
+  finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib"
+  sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib"
+  export_dynamic_flag_spec=-rdynamic
+  # the default ld.so.conf also contains /usr/contrib/lib and
+  # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow
+  # libtool to hard-code these into programs
+  ;;
+
+cygwin* | mingw* | pw32*)
+  version_type=windows
+  need_version=no
+  need_lib_prefix=no
+  case $GCC,$host_os in
+  yes,cygwin*)
+    library_names_spec='$libname.dll.a'
+    soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | sed -e 's/[.]/-/g'`${versuffix}.dll'
+    postinstall_cmds='dlpath=`bash 2>&1 -c '\''. $dir/${file}i;echo \$dlname'\''`~
+      dldir=$destdir/`dirname \$dlpath`~
+      test -d \$dldir || mkdir -p \$dldir~
+      $install_prog .libs/$dlname \$dldir/$dlname'
+    postuninstall_cmds='dldll=`bash 2>&1 -c '\''. $file; echo \$dlname'\''`~
+      dlpath=$dir/\$dldll~
+       $rm \$dlpath'
+    ;;
+  yes,mingw*)
+    library_names_spec='${libname}`echo ${release} | sed -e 's/[.]/-/g'`${versuffix}.dll'
+    sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | sed -e "s/^libraries://" -e "s/;/ /g" -e "s,=/,/,g"`
+    ;;
+  yes,pw32*)
+    library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | sed -e 's/./-/g'`${versuffix}.dll'
+    ;;
+  *)
+    library_names_spec='${libname}`echo ${release} | sed -e 's/[.]/-/g'`${versuffix}.dll $libname.lib'
+    ;;
+  esac
+  dynamic_linker='Win32 ld.exe'
+  # FIXME: first we should search . and the directory the executable is in
+  shlibpath_var=PATH
+  ;;
+
+darwin* | rhapsody*)
+  dynamic_linker="$host_os dyld"
+  version_type=darwin
+  need_lib_prefix=no
+  need_version=no
+  # FIXME: Relying on posixy $() will cause problems for
+  #        cross-compilation, but unfortunately the echo tests do not
+  #        yet detect zsh echo's removal of \ escapes.
+  library_names_spec='${libname}${release}${versuffix}.$(test .$module = .yes && echo so || echo dylib) ${libname}${release}${major}.$(test .$module = .yes && echo so || echo dylib) ${libname}.$(test .$module = .yes && echo so || echo dylib)'
+  soname_spec='${libname}${release}${major}.$(test .$module = .yes && echo so || echo dylib)'
+  shlibpath_overrides_runpath=yes
+  shlibpath_var=DYLD_LIBRARY_PATH
+  ;;
+
+freebsd1*)
+  dynamic_linker=no
+  ;;
+
+freebsd*)
+  objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout`
+  version_type=freebsd-$objformat
+  case $version_type in
+    freebsd-elf*)
+      library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so $libname.so'
+      need_version=no
+      need_lib_prefix=no
+      ;;
+    freebsd-*)
+      library_names_spec='${libname}${release}.so$versuffix $libname.so$versuffix'
+      need_version=yes
+      ;;
+  esac
+  shlibpath_var=LD_LIBRARY_PATH
+  case $host_os in
+  freebsd2*)
+    shlibpath_overrides_runpath=yes
+    ;;
+  *)
+    shlibpath_overrides_runpath=no
+    hardcode_into_libs=yes
+    ;;
+  esac
+  ;;
+
+gnu*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so${major} ${libname}.so'
+  soname_spec='${libname}${release}.so$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  hardcode_into_libs=yes
+  ;;
+
+hpux9* | hpux10* | hpux11*)
+  # Give a soname corresponding to the major version so that dld.sl refuses to
+  # link against other versions.
+  dynamic_linker="$host_os dld.sl"
+  version_type=sunos
+  need_lib_prefix=no
+  need_version=no
+  shlibpath_var=SHLIB_PATH
+  shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH
+  library_names_spec='${libname}${release}.sl$versuffix ${libname}${release}.sl$major $libname.sl'
+  soname_spec='${libname}${release}.sl$major'
+  # HP-UX runs *really* slowly unless shared libraries are mode 555.
+  postinstall_cmds='chmod 555 $lib'
+  ;;
+
+irix5* | irix6* | nonstopux*)
+  case $host_os in
+    nonstopux*) version_type=nonstopux ;;
+    *)          version_type=irix ;;
+  esac
+  need_lib_prefix=no
+  need_version=no
+  soname_spec='${libname}${release}.so$major'
+  library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major ${libname}${release}.so $libname.so'
+  case $host_os in
+  irix5* | nonstopux*)
+    libsuff= shlibsuff=
+    ;;
+  *)
+    case $LD in # libtool.m4 will add one of these switches to LD
+    *-32|*"-32 ") libsuff= shlibsuff= libmagic=32-bit;;
+    *-n32|*"-n32 ") libsuff=32 shlibsuff=N32 libmagic=N32;;
+    *-64|*"-64 ") libsuff=64 shlibsuff=64 libmagic=64-bit;;
+    *) libsuff= shlibsuff= libmagic=never-match;;
+    esac
+    ;;
+  esac
+  shlibpath_var=LD_LIBRARY${shlibsuff}_PATH
+  shlibpath_overrides_runpath=no
+  sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}"
+  sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}"
+  ;;
+
+# No shared lib support for Linux oldld, aout, or coff.
+linux-gnuoldld* | linux-gnuaout* | linux-gnucoff*)
+  dynamic_linker=no
+  ;;
+
+# This must be Linux ELF.
+linux-gnu*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
+  soname_spec='${libname}${release}.so$major'
+  finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  # This implies no fast_install, which is unacceptable.
+  # Some rework will be needed to allow for fast_install
+  # before this can be enabled.
+  hardcode_into_libs=yes
+
+  # We used to test for /lib/ld.so.1 and disable shared libraries on
+  # powerpc, because MkLinux only supported shared libraries with the
+  # GNU dynamic linker.  Since this was broken with cross compilers,
+  # most powerpc-linux boxes support dynamic linking these days and
+  # people can always --disable-shared, the test was removed, and we
+  # assume the GNU/Linux dynamic linker is in use.
+  dynamic_linker='GNU/Linux ld.so'
+  ;;
+
+netbsd*)
+  version_type=sunos
+  need_lib_prefix=no
+  need_version=no
+  if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
+    library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix'
+    finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
+    dynamic_linker='NetBSD (a.out) ld.so'
+  else
+    library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major ${libname}${release}.so ${libname}.so'
+    soname_spec='${libname}${release}.so$major'
+    dynamic_linker='NetBSD ld.elf_so'
+  fi
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  hardcode_into_libs=yes
+  ;;
+
+newsos6)
+  version_type=linux
+  library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  ;;
+
+openbsd*)
+  version_type=sunos
+  need_lib_prefix=no
+  need_version=no
+  if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+    case "$host_os" in
+    openbsd2.[89] | openbsd2.[89].*)
+      shlibpath_overrides_runpath=no
+      ;;
+    *)
+      shlibpath_overrides_runpath=yes
+      ;;
+    esac
+  else
+    shlibpath_overrides_runpath=yes
+  fi
+  library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix'
+  finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  ;;
+
+os2*)
+  libname_spec='$name'
+  need_lib_prefix=no
+  library_names_spec='$libname.dll $libname.a'
+  dynamic_linker='OS/2 ld.exe'
+  shlibpath_var=LIBPATH
+  ;;
+
+osf3* | osf4* | osf5*)
+  version_type=osf
+  need_version=no
+  soname_spec='${libname}${release}.so$major'
+  library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
+  shlibpath_var=LD_LIBRARY_PATH
+  sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib"
+  sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec"
+  hardcode_into_libs=yes
+  ;;
+
+sco3.2v5*)
+  version_type=osf
+  soname_spec='${libname}${release}.so$major'
+  library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
+  shlibpath_var=LD_LIBRARY_PATH
+  ;;
+
+solaris*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
+  soname_spec='${libname}${release}.so$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  hardcode_into_libs=yes
+  # ldd complains unless libraries are executable
+  postinstall_cmds='chmod +x $lib'
+  ;;
+
+sunos4*)
+  version_type=sunos
+  library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix'
+  finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  if test "$with_gnu_ld" = yes; then
+    need_lib_prefix=no
+  fi
+  need_version=yes
+  ;;
+
+sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
+  version_type=linux
+  library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
+  soname_spec='${libname}${release}.so$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  case $host_vendor in
+    sni)
+      shlibpath_overrides_runpath=no
+      need_lib_prefix=no
+      export_dynamic_flag_spec='${wl}-Blargedynsym'
+      runpath_var=LD_RUN_PATH
+      ;;
+    siemens)
+      need_lib_prefix=no
+      ;;
+    motorola)
+      need_lib_prefix=no
+      need_version=no
+      shlibpath_overrides_runpath=no
+      sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib'
+      ;;
+  esac
+  ;;
+
+uts4*)
+  version_type=linux
+  library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
+  soname_spec='${libname}${release}.so$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  ;;
+
+dgux*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
+  soname_spec='${libname}${release}.so$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  ;;
+
+sysv4*MP*)
+  if test -d /usr/nec ;then
+    version_type=linux
+    library_names_spec='$libname.so.$versuffix $libname.so.$major $libname.so'
+    soname_spec='$libname.so.$major'
+    shlibpath_var=LD_LIBRARY_PATH
+  fi
+  ;;
+
+*)
+  dynamic_linker=no
+  ;;
+esac
+echo "$ac_t""$dynamic_linker" 1>&6
+test "$dynamic_linker" = no && can_build_shared=no
+##
+## END FIXME
+
+## FIXME: this should be a separate macro
+##
+# Report the final consequences.
+echo $ac_n "checking if libtool supports shared libraries""... $ac_c" 1>&6
+echo "configure:5195: checking if libtool supports shared libraries" >&5
+echo "$ac_t""$can_build_shared" 1>&6
+##
+## END FIXME
+
+## FIXME: this should be a separate macro
+##
+echo $ac_n "checking whether to build shared libraries""... $ac_c" 1>&6
+echo "configure:5203: checking whether to build shared libraries" >&5
+test "$can_build_shared" = "no" && enable_shared=no
+
+# On AIX, shared libraries and static libraries use the same namespace, and
+# are all built from PIC.
+case "$host_os" in
+aix3*)
+  test "$enable_shared" = yes && enable_static=no
+  if test -n "$RANLIB"; then
+    archive_cmds="$archive_cmds~\$RANLIB \$lib"
+    postinstall_cmds='$RANLIB $lib'
+  fi
+  ;;
+
+aix4*)
+  if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then
+    test "$enable_shared" = yes && enable_static=no
+  fi
+  ;;
+esac
+echo "$ac_t""$enable_shared" 1>&6
+##
+## END FIXME
+
+## FIXME: this should be a separate macro
+##
+echo $ac_n "checking whether to build static libraries""... $ac_c" 1>&6
+echo "configure:5230: checking whether to build static libraries" >&5
+# Make sure either enable_shared or enable_static is yes.
+test "$enable_shared" = yes || enable_static=yes
+echo "$ac_t""$enable_static" 1>&6
+##
+## END FIXME
+
+if test "$hardcode_action" = relink; then
+  # Fast installation is not supported
+  enable_fast_install=no
+elif test "$shlibpath_overrides_runpath" = yes ||
+     test "$enable_shared" = no; then
+  # Fast installation is not necessary
+  enable_fast_install=needless
+fi
+
+variables_saved_for_relink="PATH $shlibpath_var $runpath_var"
+if test "$GCC" = yes; then
+  variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
+fi
+
+if test "x$enable_dlopen" != xyes; then
+  enable_dlopen=unknown
+  enable_dlopen_self=unknown
+  enable_dlopen_self_static=unknown
+else
+  lt_cv_dlopen=no
+  lt_cv_dlopen_libs=
+
+  case $host_os in
+  beos*)
+    lt_cv_dlopen="load_add_on"
+    lt_cv_dlopen_libs=
+    lt_cv_dlopen_self=yes
+    ;;
+
+  cygwin* | mingw* | pw32*)
+    lt_cv_dlopen="LoadLibrary"
+    lt_cv_dlopen_libs=
+   ;;
+
+  *)
+    echo $ac_n "checking for shl_load""... $ac_c" 1>&6
+echo "configure:5273: checking for shl_load" >&5
+if eval "test \"`echo '$''{'ac_cv_func_shl_load'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 5278 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char shl_load(); below.  */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char shl_load();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_shl_load) || defined (__stub___shl_load)
+choke me
+#else
+shl_load();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:5301: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_func_shl_load=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_func_shl_load=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'shl_load`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  lt_cv_dlopen="shl_load"
+else
+  echo "$ac_t""no" 1>&6
+echo $ac_n "checking for shl_load in -ldld""... $ac_c" 1>&6
+echo "configure:5319: checking for shl_load in -ldld" >&5
+ac_lib_var=`echo dld'_'shl_load | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  ac_save_LIBS="$LIBS"
+LIBS="-ldld  $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 5327 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char shl_load();
+
+int main() {
+shl_load()
+; return 0; }
+EOF
+if { (eval echo configure:5338: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-dld"
+else
+  echo "$ac_t""no" 1>&6
+echo $ac_n "checking for dlopen""... $ac_c" 1>&6
+echo "configure:5357: checking for dlopen" >&5
+if eval "test \"`echo '$''{'ac_cv_func_dlopen'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 5362 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char dlopen(); below.  */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char dlopen();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_dlopen) || defined (__stub___dlopen)
+choke me
+#else
+dlopen();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:5385: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_func_dlopen=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_func_dlopen=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'dlopen`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  lt_cv_dlopen="dlopen"
+else
+  echo "$ac_t""no" 1>&6
+echo $ac_n "checking for dlopen in -ldl""... $ac_c" 1>&6
+echo "configure:5403: checking for dlopen in -ldl" >&5
+ac_lib_var=`echo dl'_'dlopen | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  ac_save_LIBS="$LIBS"
+LIBS="-ldl  $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 5411 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char dlopen();
+
+int main() {
+dlopen()
+; return 0; }
+EOF
+if { (eval echo configure:5422: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"
+else
+  echo "$ac_t""no" 1>&6
+echo $ac_n "checking for dlopen in -lsvld""... $ac_c" 1>&6
+echo "configure:5441: checking for dlopen in -lsvld" >&5
+ac_lib_var=`echo svld'_'dlopen | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  ac_save_LIBS="$LIBS"
+LIBS="-lsvld  $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 5449 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char dlopen();
+
+int main() {
+dlopen()
+; return 0; }
+EOF
+if { (eval echo configure:5460: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"
+else
+  echo "$ac_t""no" 1>&6
+echo $ac_n "checking for dld_link in -ldld""... $ac_c" 1>&6
+echo "configure:5479: checking for dld_link in -ldld" >&5
+ac_lib_var=`echo dld'_'dld_link | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  ac_save_LIBS="$LIBS"
+LIBS="-ldld  $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 5487 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char dld_link();
+
+int main() {
+dld_link()
+; return 0; }
+EOF
+if { (eval echo configure:5498: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-dld"
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+	      
+fi
+
+	    
+fi
+
+	  
+fi
+
+	
+fi
+
+      
+fi
+
+    ;;
+  esac
+
+  if test "x$lt_cv_dlopen" != xno; then
+    enable_dlopen=yes
+  else
+    enable_dlopen=no
+  fi
+
+  case $lt_cv_dlopen in
+  dlopen)
+    save_CPPFLAGS="$CPPFLAGS"
+        test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H"
+
+    save_LDFLAGS="$LDFLAGS"
+    eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\"
+
+    save_LIBS="$LIBS"
+    LIBS="$lt_cv_dlopen_libs $LIBS"
+
+    echo $ac_n "checking whether a program can dlopen itself""... $ac_c" 1>&6
+echo "configure:5554: checking whether a program can dlopen itself" >&5
+if eval "test \"`echo '$''{'lt_cv_dlopen_self'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  	  if test "$cross_compiling" = yes; then :
+  lt_cv_dlopen_self=cross
+else
+    lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
+  lt_status=$lt_dlunknown
+  cat > conftest.$ac_ext <<EOF
+#line 5564 "configure"
+#include "confdefs.h"
+
+#if HAVE_DLFCN_H
+#include <dlfcn.h>
+#endif
+
+#include <stdio.h>
+
+#ifdef RTLD_GLOBAL
+#  define LT_DLGLOBAL		RTLD_GLOBAL
+#else
+#  ifdef DL_GLOBAL
+#    define LT_DLGLOBAL		DL_GLOBAL
+#  else
+#    define LT_DLGLOBAL		0
+#  endif
+#endif
+
+/* We may have to define LT_DLLAZY_OR_NOW in the command line if we
+   find out it does not work in some platform. */
+#ifndef LT_DLLAZY_OR_NOW
+#  ifdef RTLD_LAZY
+#    define LT_DLLAZY_OR_NOW		RTLD_LAZY
+#  else
+#    ifdef DL_LAZY
+#      define LT_DLLAZY_OR_NOW		DL_LAZY
+#    else
+#      ifdef RTLD_NOW
+#        define LT_DLLAZY_OR_NOW	RTLD_NOW
+#      else
+#        ifdef DL_NOW
+#          define LT_DLLAZY_OR_NOW	DL_NOW
+#        else
+#          define LT_DLLAZY_OR_NOW	0
+#        endif
+#      endif
+#    endif
+#  endif
+#endif
+
+#ifdef __cplusplus
+extern "C" void exit (int);
+#endif
+
+void fnord() { int i=42;}
+int main ()
+{
+  void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW);
+  int status = $lt_dlunknown;
+
+  if (self)
+    {
+      if (dlsym (self,"fnord"))       status = $lt_dlno_uscore;
+      else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore;
+      /* dlclose (self); */
+    }
+
+    exit (status);
+}
+EOF
+  if { (eval echo configure:5625: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} 2>/dev/null; then
+    (./conftest; exit; ) 2>/dev/null
+    lt_status=$?
+    case x$lt_status in
+      x$lt_dlno_uscore) lt_cv_dlopen_self=yes ;;
+      x$lt_dlneed_uscore) lt_cv_dlopen_self=yes ;;
+      x$lt_unknown|x*) lt_cv_dlopen_self=no ;;
+    esac
+  else :
+    # compilation failed
+    lt_cv_dlopen_self=no
+  fi
+fi
+rm -fr conftest*
+
+    
+fi
+
+echo "$ac_t""$lt_cv_dlopen_self" 1>&6
+
+    if test "x$lt_cv_dlopen_self" = xyes; then
+      LDFLAGS="$LDFLAGS $link_static_flag"
+      echo $ac_n "checking whether a statically linked program can dlopen itself""... $ac_c" 1>&6
+echo "configure:5648: checking whether a statically linked program can dlopen itself" >&5
+if eval "test \"`echo '$''{'lt_cv_dlopen_self_static'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  	  if test "$cross_compiling" = yes; then :
+  lt_cv_dlopen_self_static=cross
+else
+    lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
+  lt_status=$lt_dlunknown
+  cat > conftest.$ac_ext <<EOF
+#line 5658 "configure"
+#include "confdefs.h"
+
+#if HAVE_DLFCN_H
+#include <dlfcn.h>
+#endif
+
+#include <stdio.h>
+
+#ifdef RTLD_GLOBAL
+#  define LT_DLGLOBAL		RTLD_GLOBAL
+#else
+#  ifdef DL_GLOBAL
+#    define LT_DLGLOBAL		DL_GLOBAL
+#  else
+#    define LT_DLGLOBAL		0
+#  endif
+#endif
+
+/* We may have to define LT_DLLAZY_OR_NOW in the command line if we
+   find out it does not work in some platform. */
+#ifndef LT_DLLAZY_OR_NOW
+#  ifdef RTLD_LAZY
+#    define LT_DLLAZY_OR_NOW		RTLD_LAZY
+#  else
+#    ifdef DL_LAZY
+#      define LT_DLLAZY_OR_NOW		DL_LAZY
+#    else
+#      ifdef RTLD_NOW
+#        define LT_DLLAZY_OR_NOW	RTLD_NOW
+#      else
+#        ifdef DL_NOW
+#          define LT_DLLAZY_OR_NOW	DL_NOW
+#        else
+#          define LT_DLLAZY_OR_NOW	0
+#        endif
+#      endif
+#    endif
+#  endif
+#endif
+
+#ifdef __cplusplus
+extern "C" void exit (int);
+#endif
+
+void fnord() { int i=42;}
+int main ()
+{
+  void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW);
+  int status = $lt_dlunknown;
+
+  if (self)
+    {
+      if (dlsym (self,"fnord"))       status = $lt_dlno_uscore;
+      else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore;
+      /* dlclose (self); */
+    }
+
+    exit (status);
+}
+EOF
+  if { (eval echo configure:5719: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} 2>/dev/null; then
+    (./conftest; exit; ) 2>/dev/null
+    lt_status=$?
+    case x$lt_status in
+      x$lt_dlno_uscore) lt_cv_dlopen_self_static=yes ;;
+      x$lt_dlneed_uscore) lt_cv_dlopen_self_static=yes ;;
+      x$lt_unknown|x*) lt_cv_dlopen_self_static=no ;;
+    esac
+  else :
+    # compilation failed
+    lt_cv_dlopen_self_static=no
+  fi
+fi
+rm -fr conftest*
+
+      
+fi
+
+echo "$ac_t""$lt_cv_dlopen_self_static" 1>&6
+    fi
+
+    CPPFLAGS="$save_CPPFLAGS"
+    LDFLAGS="$save_LDFLAGS"
+    LIBS="$save_LIBS"
+    ;;
+  esac
+
+  case $lt_cv_dlopen_self in
+  yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;;
+  *) enable_dlopen_self=unknown ;;
+  esac
+
+  case $lt_cv_dlopen_self_static in
+  yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;;
+  *) enable_dlopen_self_static=unknown ;;
+  esac
+fi
+
+
+## FIXME: this should be a separate macro
+##
+if test "$enable_shared" = yes && test "$GCC" = yes; then
+  case $archive_cmds in
+  *'~'*)
+    # FIXME: we may have to deal with multi-command sequences.
+    ;;
+  '$CC '*)
+    # Test whether the compiler implicitly links with -lc since on some
+    # systems, -lgcc has to come before -lc. If gcc already passes -lc
+    # to ld, don't add -lc before -lgcc.
+    echo $ac_n "checking whether -lc should be explicitly linked in""... $ac_c" 1>&6
+echo "configure:5770: checking whether -lc should be explicitly linked in" >&5
+    if eval "test \"`echo '$''{'lt_cv_archive_cmds_need_lc'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  $rm conftest*
+    echo 'static int dummy;' > conftest.$ac_ext
+
+    if { (eval echo configure:5777: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+      soname=conftest
+      lib=conftest
+      libobjs=conftest.$ac_objext
+      deplibs=
+      wl=$lt_cv_prog_cc_wl
+      compiler_flags=-v
+      linker_flags=-v
+      verstring=
+      output_objdir=.
+      libname=conftest
+      save_allow_undefined_flag=$allow_undefined_flag
+      allow_undefined_flag=
+      if { (eval echo configure:5790: \"$archive_cmds 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1\") 1>&5; (eval $archive_cmds 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) 2>&5; }
+      then
+	lt_cv_archive_cmds_need_lc=no
+      else
+	lt_cv_archive_cmds_need_lc=yes
+      fi
+      allow_undefined_flag=$save_allow_undefined_flag
+    else
+      cat conftest.err 1>&5
+    fi
+fi
+
+    echo "$ac_t""$lt_cv_archive_cmds_need_lc" 1>&6
+    ;;
+  esac
+fi
+need_lc=${lt_cv_archive_cmds_need_lc-yes}
+##
+## END FIXME
+
+## FIXME: this should be a separate macro
+##
+# The second clause should only fire when bootstrapping the
+# libtool distribution, otherwise you forgot to ship ltmain.sh
+# with your package, and you will get complaints that there are
+# no rules to generate ltmain.sh.
+if test -f "$ltmain"; then
+  :
+else
+  # If there is no Makefile yet, we rely on a make rule to execute
+  # `config.status --recheck' to rerun these tests and create the
+  # libtool script then.
+  test -f Makefile && make "$ltmain"
+fi
+
+if test -f "$ltmain"; then
+  trap "$rm \"${ofile}T\"; exit 1" 1 2 15
+  $rm -f "${ofile}T"
+
+  echo creating $ofile
+
+  # Now quote all the things that may contain metacharacters while being
+  # careful not to overquote the AC_SUBSTed values.  We take copies of the
+  # variables and quote the copies for generation of the libtool script.
+  for var in echo old_CC old_CFLAGS SED \
+    AR AR_FLAGS CC LD LN_S NM SHELL \
+    reload_flag reload_cmds wl \
+    pic_flag link_static_flag no_builtin_flag export_dynamic_flag_spec \
+    thread_safe_flag_spec whole_archive_flag_spec libname_spec \
+    library_names_spec soname_spec \
+    RANLIB old_archive_cmds old_archive_from_new_cmds old_postinstall_cmds \
+    old_postuninstall_cmds archive_cmds archive_expsym_cmds postinstall_cmds \
+    postuninstall_cmds extract_expsyms_cmds old_archive_from_expsyms_cmds \
+    old_striplib striplib file_magic_cmd export_symbols_cmds \
+    deplibs_check_method allow_undefined_flag no_undefined_flag \
+    finish_cmds finish_eval global_symbol_pipe global_symbol_to_cdecl \
+    global_symbol_to_c_name_address \
+    hardcode_libdir_flag_spec hardcode_libdir_separator  \
+    sys_lib_search_path_spec sys_lib_dlsearch_path_spec \
+    compiler_c_o compiler_o_lo need_locks exclude_expsyms include_expsyms; do
+
+    case $var in
+    reload_cmds | old_archive_cmds | old_archive_from_new_cmds | \
+    old_postinstall_cmds | old_postuninstall_cmds | \
+    export_symbols_cmds | archive_cmds | archive_expsym_cmds | \
+    extract_expsyms_cmds | old_archive_from_expsyms_cmds | \
+    postinstall_cmds | postuninstall_cmds | \
+    finish_cmds | sys_lib_search_path_spec | sys_lib_dlsearch_path_spec)
+      # Double-quote double-evaled strings.
+      eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\""
+      ;;
+    *)
+      eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\""
+      ;;
+    esac
+  done
+
+  cat <<__EOF__ > "${ofile}T"
+#! $SHELL
+
+# `$echo "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services.
+# Generated automatically by $PROGRAM (GNU $PACKAGE $VERSION$TIMESTAMP)
+# NOTE: Changes made to this file will be lost: look at ltmain.sh.
+#
+# Copyright (C) 1996-2000 Free Software Foundation, Inc.
+# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# A sed that does not truncate output.
+SED=$lt_SED
+
+# Sed that helps us avoid accidentally triggering echo(1) options like -n.
+Xsed="${SED} -e s/^X//"
+
+# The HP-UX ksh and POSIX shell print the target directory to stdout
+# if CDPATH is set.
+if test "X\${CDPATH+set}" = Xset; then CDPATH=:; export CDPATH; fi
+
+# ### BEGIN LIBTOOL CONFIG
+
+# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
+
+# Shell to use when invoking shell scripts.
+SHELL=$lt_SHELL
+
+# Whether or not to build shared libraries.
+build_libtool_libs=$enable_shared
+
+# Whether or not to build static libraries.
+build_old_libs=$enable_static
+
+# Whether or not to add -lc for building shared libraries.
+build_libtool_need_lc=$need_lc
+
+# Whether or not to optimize for fast installation.
+fast_install=$enable_fast_install
+
+# The host system.
+host_alias=$host_alias
+host=$host
+
+# An echo program that does not interpret backslashes.
+echo=$lt_echo
+
+# The archiver.
+AR=$lt_AR
+AR_FLAGS=$lt_AR_FLAGS
+
+# The default C compiler.
+CC=$lt_CC
+
+# Is the compiler the GNU C compiler?
+with_gcc=$GCC
+
+# The linker used to build libraries.
+LD=$lt_LD
+
+# Whether we need hard or soft links.
+LN_S=$lt_LN_S
+
+# A BSD-compatible nm program.
+NM=$lt_NM
+
+# A symbol stripping program
+STRIP=$STRIP
+
+# Used to examine libraries when file_magic_cmd begins "file"
+MAGIC_CMD=$MAGIC_CMD
+
+# Used on cygwin: DLL creation program.
+DLLTOOL="$DLLTOOL"
+
+# Used on cygwin: object dumper.
+OBJDUMP="$OBJDUMP"
+
+# Used on cygwin: assembler.
+AS="$AS"
+
+# The name of the directory that contains temporary libtool files.
+objdir=$objdir
+
+# How to create reloadable object files.
+reload_flag=$lt_reload_flag
+reload_cmds=$lt_reload_cmds
+
+# How to pass a linker flag through the compiler.
+wl=$lt_wl
+
+# Object file suffix (normally "o").
+objext="$ac_objext"
+
+# Old archive suffix (normally "a").
+libext="$libext"
+
+# Executable file suffix (normally "").
+exeext="$exeext"
+
+# Additional compiler flags for building library objects.
+pic_flag=$lt_pic_flag
+pic_mode=$pic_mode
+
+# Does compiler simultaneously support -c and -o options?
+compiler_c_o=$lt_compiler_c_o
+
+# Can we write directly to a .lo ?
+compiler_o_lo=$lt_compiler_o_lo
+
+# Must we lock files when doing compilation ?
+need_locks=$lt_need_locks
+
+# Do we need the lib prefix for modules?
+need_lib_prefix=$need_lib_prefix
+
+# Do we need a version for libraries?
+need_version=$need_version
+
+# Whether dlopen is supported.
+dlopen_support=$enable_dlopen
+
+# Whether dlopen of programs is supported.
+dlopen_self=$enable_dlopen_self
+
+# Whether dlopen of statically linked programs is supported.
+dlopen_self_static=$enable_dlopen_self_static
+
+# Compiler flag to prevent dynamic linking.
+link_static_flag=$lt_link_static_flag
+
+# Compiler flag to turn off builtin functions.
+no_builtin_flag=$lt_no_builtin_flag
+
+# Compiler flag to allow reflexive dlopens.
+export_dynamic_flag_spec=$lt_export_dynamic_flag_spec
+
+# Compiler flag to generate shared objects directly from archives.
+whole_archive_flag_spec=$lt_whole_archive_flag_spec
+
+# Compiler flag to generate thread-safe objects.
+thread_safe_flag_spec=$lt_thread_safe_flag_spec
+
+# Library versioning type.
+version_type=$version_type
+
+# Format of library name prefix.
+libname_spec=$lt_libname_spec
+
+# List of archive names.  First name is the real one, the rest are links.
+# The last name is the one that the linker finds with -lNAME.
+library_names_spec=$lt_library_names_spec
+
+# The coded name of the library, if different from the real name.
+soname_spec=$lt_soname_spec
+
+# Commands used to build and install an old-style archive.
+RANLIB=$lt_RANLIB
+old_archive_cmds=$lt_old_archive_cmds
+old_postinstall_cmds=$lt_old_postinstall_cmds
+old_postuninstall_cmds=$lt_old_postuninstall_cmds
+
+# Create an old-style archive from a shared archive.
+old_archive_from_new_cmds=$lt_old_archive_from_new_cmds
+
+# Create a temporary old-style archive to link instead of a shared archive.
+old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds
+
+# Commands used to build and install a shared archive.
+archive_cmds=$lt_archive_cmds
+archive_expsym_cmds=$lt_archive_expsym_cmds
+postinstall_cmds=$lt_postinstall_cmds
+postuninstall_cmds=$lt_postuninstall_cmds
+
+# Commands to strip libraries.
+old_striplib=$lt_old_striplib
+striplib=$lt_striplib
+
+# Method to check whether dependent libraries are shared objects.
+deplibs_check_method=$lt_deplibs_check_method
+
+# Command to use when deplibs_check_method == file_magic.
+file_magic_cmd=$lt_file_magic_cmd
+
+# Flag that allows shared libraries with undefined symbols to be built.
+allow_undefined_flag=$lt_allow_undefined_flag
+
+# Flag that forces no undefined symbols.
+no_undefined_flag=$lt_no_undefined_flag
+
+# Commands used to finish a libtool library installation in a directory.
+finish_cmds=$lt_finish_cmds
+
+# Same as above, but a single script fragment to be evaled but not shown.
+finish_eval=$lt_finish_eval
+
+# Take the output of nm and produce a listing of raw symbols and C names.
+global_symbol_pipe=$lt_global_symbol_pipe
+
+# Transform the output of nm in a proper C declaration
+global_symbol_to_cdecl=$lt_global_symbol_to_cdecl
+
+# Transform the output of nm in a C name address pair
+global_symbol_to_c_name_address=$lt_global_symbol_to_c_name_address
+
+# This is the shared library runtime path variable.
+runpath_var=$runpath_var
+
+# This is the shared library path variable.
+shlibpath_var=$shlibpath_var
+
+# Is shlibpath searched before the hard-coded library search path?
+shlibpath_overrides_runpath=$shlibpath_overrides_runpath
+
+# How to hardcode a shared library path into an executable.
+hardcode_action=$hardcode_action
+
+# Whether we should hardcode library paths into libraries.
+hardcode_into_libs=$hardcode_into_libs
+
+# Flag to hardcode \$libdir into a binary during linking.
+# This must work even if \$libdir does not exist.
+hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec
+
+# Whether we need a single -rpath flag with a separated argument.
+hardcode_libdir_separator=$lt_hardcode_libdir_separator
+
+# Set to yes if using DIR/libNAME.so during linking hardcodes DIR into the
+# resulting binary.
+hardcode_direct=$hardcode_direct
+
+# Set to yes if using the -LDIR flag during linking hardcodes DIR into the
+# resulting binary.
+hardcode_minus_L=$hardcode_minus_L
+
+# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into
+# the resulting binary.
+hardcode_shlibpath_var=$hardcode_shlibpath_var
+
+# Variables whose values should be saved in libtool wrapper scripts and
+# restored at relink time.
+variables_saved_for_relink="$variables_saved_for_relink"
+
+# Whether libtool must link a program against all its dependency libraries.
+link_all_deplibs=$link_all_deplibs
+
+# Compile-time system search path for libraries
+sys_lib_search_path_spec=$lt_sys_lib_search_path_spec
+
+# Run-time system search path for libraries
+sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec
+
+# Fix the shell variable \$srcfile for the compiler.
+fix_srcfile_path="$fix_srcfile_path"
+
+# Set to yes if exported symbols are required.
+always_export_symbols=$always_export_symbols
+
+# The commands to list exported symbols.
+export_symbols_cmds=$lt_export_symbols_cmds
+
+# The commands to extract the exported symbol list from a shared archive.
+extract_expsyms_cmds=$lt_extract_expsyms_cmds
+
+# Symbols that should not be listed in the preloaded symbols.
+exclude_expsyms=$lt_exclude_expsyms
+
+# Symbols that must always be exported.
+include_expsyms=$lt_include_expsyms
+
+# ### END LIBTOOL CONFIG
+
+__EOF__
+
+  case $host_os in
+  aix3*)
+    cat <<\EOF >> "${ofile}T"
+
+# AIX sometimes has problems with the GCC collect2 program.  For some
+# reason, if we set the COLLECT_NAMES environment variable, the problems
+# vanish in a puff of smoke.
+if test "X${COLLECT_NAMES+set}" != Xset; then
+  COLLECT_NAMES=
+  export COLLECT_NAMES
+fi
+EOF
+    ;;
+  esac
+
+  case $host_os in
+  cygwin* | mingw* | pw32* | os2*)
+    cat <<'EOF' >> "${ofile}T"
+      # This is a source program that is used to create dlls on Windows
+      # Don't remove nor modify the starting and closing comments
+# /* ltdll.c starts here */
+# #define WIN32_LEAN_AND_MEAN
+# #include <windows.h>
+# #undef WIN32_LEAN_AND_MEAN
+# #include <stdio.h>
+#
+# #ifndef __CYGWIN__
+# #  ifdef __CYGWIN32__
+# #    define __CYGWIN__ __CYGWIN32__
+# #  endif
+# #endif
+#
+# #ifdef __cplusplus
+# extern "C" {
+# #endif
+# BOOL APIENTRY DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved);
+# #ifdef __cplusplus
+# }
+# #endif
+#
+# #ifdef __CYGWIN__
+# #include <cygwin/cygwin_dll.h>
+# DECLARE_CYGWIN_DLL( DllMain );
+# #endif
+# HINSTANCE __hDllInstance_base;
+#
+# BOOL APIENTRY
+# DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved)
+# {
+#   __hDllInstance_base = hInst;
+#   return TRUE;
+# }
+# /* ltdll.c ends here */
+	# This is a source program that is used to create import libraries
+	# on Windows for dlls which lack them. Don't remove nor modify the
+	# starting and closing comments
+# /* impgen.c starts here */
+# /*   Copyright (C) 1999-2000 Free Software Foundation, Inc.
+#
+#  This file is part of GNU libtool.
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#  */
+#
+# #include <stdio.h>		/* for printf() */
+# #include <unistd.h>		/* for open(), lseek(), read() */
+# #include <fcntl.h>		/* for O_RDONLY, O_BINARY */
+# #include <string.h>		/* for strdup() */
+#
+# /* O_BINARY isn't required (or even defined sometimes) under Unix */
+# #ifndef O_BINARY
+# #define O_BINARY 0
+# #endif
+#
+# static unsigned int
+# pe_get16 (fd, offset)
+#      int fd;
+#      int offset;
+# {
+#   unsigned char b[2];
+#   lseek (fd, offset, SEEK_SET);
+#   read (fd, b, 2);
+#   return b[0] + (b[1]<<8);
+# }
+#
+# static unsigned int
+# pe_get32 (fd, offset)
+#     int fd;
+#     int offset;
+# {
+#   unsigned char b[4];
+#   lseek (fd, offset, SEEK_SET);
+#   read (fd, b, 4);
+#   return b[0] + (b[1]<<8) + (b[2]<<16) + (b[3]<<24);
+# }
+#
+# static unsigned int
+# pe_as32 (ptr)
+#      void *ptr;
+# {
+#   unsigned char *b = ptr;
+#   return b[0] + (b[1]<<8) + (b[2]<<16) + (b[3]<<24);
+# }
+#
+# int
+# main (argc, argv)
+#     int argc;
+#     char *argv[];
+# {
+#     int dll;
+#     unsigned long pe_header_offset, opthdr_ofs, num_entries, i;
+#     unsigned long export_rva, export_size, nsections, secptr, expptr;
+#     unsigned long name_rvas, nexp;
+#     unsigned char *expdata, *erva;
+#     char *filename, *dll_name;
+#
+#     filename = argv[1];
+#
+#     dll = open(filename, O_RDONLY|O_BINARY);
+#     if (dll < 1)
+# 	return 1;
+#
+#     dll_name = filename;
+#
+#     for (i=0; filename[i]; i++)
+# 	if (filename[i] == '/' || filename[i] == '\\'  || filename[i] == ':')
+# 	    dll_name = filename + i +1;
+#
+#     pe_header_offset = pe_get32 (dll, 0x3c);
+#     opthdr_ofs = pe_header_offset + 4 + 20;
+#     num_entries = pe_get32 (dll, opthdr_ofs + 92);
+#
+#     if (num_entries < 1) /* no exports */
+# 	return 1;
+#
+#     export_rva = pe_get32 (dll, opthdr_ofs + 96);
+#     export_size = pe_get32 (dll, opthdr_ofs + 100);
+#     nsections = pe_get16 (dll, pe_header_offset + 4 +2);
+#     secptr = (pe_header_offset + 4 + 20 +
+# 	      pe_get16 (dll, pe_header_offset + 4 + 16));
+#
+#     expptr = 0;
+#     for (i = 0; i < nsections; i++)
+#     {
+# 	char sname[8];
+# 	unsigned long secptr1 = secptr + 40 * i;
+# 	unsigned long vaddr = pe_get32 (dll, secptr1 + 12);
+# 	unsigned long vsize = pe_get32 (dll, secptr1 + 16);
+# 	unsigned long fptr = pe_get32 (dll, secptr1 + 20);
+# 	lseek(dll, secptr1, SEEK_SET);
+# 	read(dll, sname, 8);
+# 	if (vaddr <= export_rva && vaddr+vsize > export_rva)
+# 	{
+# 	    expptr = fptr + (export_rva - vaddr);
+# 	    if (export_rva + export_size > vaddr + vsize)
+# 		export_size = vsize - (export_rva - vaddr);
+# 	    break;
+# 	}
+#     }
+#
+#     expdata = (unsigned char*)malloc(export_size);
+#     lseek (dll, expptr, SEEK_SET);
+#     read (dll, expdata, export_size);
+#     erva = expdata - export_rva;
+#
+#     nexp = pe_as32 (expdata+24);
+#     name_rvas = pe_as32 (expdata+32);
+#
+#     printf ("EXPORTS\n");
+#     for (i = 0; i<nexp; i++)
+#     {
+# 	unsigned long name_rva = pe_as32 (erva+name_rvas+i*4);
+# 	printf ("\t%s @ %ld ;\n", erva+name_rva, 1+ i);
+#     }
+#
+#     return 0;
+# }
+# /* impgen.c ends here */
+
+EOF
+    ;;
+  esac
+
+  # We use sed instead of cat because bash on DJGPP gets confused if
+  # if finds mixed CR/LF and LF-only lines.  Since sed operates in
+  # text mode, it properly converts lines to CR/LF.  This bash problem
+  # is reportedly fixed, but why not run on old versions too?
+  sed '$q' "$ltmain" >> "${ofile}T" || (rm -f "${ofile}T"; exit 1)
+
+  mv -f "${ofile}T" "$ofile" || \
+    (rm -f "$ofile" && cp "${ofile}T" "$ofile" && rm -f "${ofile}T")
+  chmod +x "$ofile"
+fi
+##
+## END FIXME
+
+
+
+
+
+# This can be used to rebuild libtool when needed
+LIBTOOL_DEPS="$ac_aux_dir/ltmain.sh"
+
+# Always use our own libtool.
+LIBTOOL='$(SHELL) $(top_builddir)/libtool'
+
+# Prevent multiple expansion
+
+
+
+# Find a good install program.  We prefer a C program (faster),
+# so one script is as good as another.  But avoid the broken or
+# incompatible versions:
+# SysV /etc/install, /usr/sbin/install
+# SunOS /usr/etc/install
+# IRIX /sbin/install
+# AIX /bin/install
+# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag
+# AFS /usr/afsws/bin/install, which mishandles nonexistent args
+# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
+# ./install, which can be erroneously created by make from ./install.sh.
+echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6
+echo "configure:6393: checking for a BSD compatible install" >&5
+if test -z "$INSTALL"; then
+if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+    IFS="${IFS= 	}"; ac_save_IFS="$IFS"; IFS=":"
+  for ac_dir in $PATH; do
+    # Account for people who put trailing slashes in PATH elements.
+    case "$ac_dir/" in
+    /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;;
+    *)
+      # OSF1 and SCO ODT 3.0 have their own names for install.
+      # Don't use installbsd from OSF since it installs stuff as root
+      # by default.
+      for ac_prog in ginstall scoinst install; do
+        if test -f $ac_dir/$ac_prog; then
+	  if test $ac_prog = install &&
+            grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then
+	    # AIX install.  It has an incompatible calling convention.
+	    :
+	  else
+	    ac_cv_path_install="$ac_dir/$ac_prog -c"
+	    break 2
+	  fi
+	fi
+      done
+      ;;
+    esac
+  done
+  IFS="$ac_save_IFS"
+
+fi
+  if test "${ac_cv_path_install+set}" = set; then
+    INSTALL="$ac_cv_path_install"
+  else
+    # As a last resort, use the slow shell script.  We don't cache a
+    # path for INSTALL within a source directory, because that will
+    # break other packages using the cache if that directory is
+    # removed, or if the path is relative.
+    INSTALL="$ac_install_sh"
+  fi
+fi
+echo "$ac_t""$INSTALL" 1>&6
+
+# Use test -z because SunOS4 sh mishandles braces in ${var-val}.
+# It thinks the first close brace ends the variable substitution.
+test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
+
+test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}'
+
+test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
+
+echo $ac_n "checking whether ln -s works""... $ac_c" 1>&6
+echo "configure:6446: checking whether ln -s works" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_LN_S'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  rm -f conftestdata
+if ln -s X conftestdata 2>/dev/null
+then
+  rm -f conftestdata
+  ac_cv_prog_LN_S="ln -s"
+else
+  ac_cv_prog_LN_S=ln
+fi
+fi
+LN_S="$ac_cv_prog_LN_S"
+if test "$ac_cv_prog_LN_S" = "ln -s"; then
+  echo "$ac_t""yes" 1>&6
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6
+echo "configure:6467: checking whether ${MAKE-make} sets \${MAKE}" >&5
+set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftestmake <<\EOF
+all:
+	@echo 'ac_maketemp="${MAKE}"'
+EOF
+# GNU make sometimes prints "make[1]: Entering...", which would confuse us.
+eval `${MAKE-make} -f conftestmake 2>/dev/null | grep temp=`
+if test -n "$ac_maketemp"; then
+  eval ac_cv_prog_make_${ac_make}_set=yes
+else
+  eval ac_cv_prog_make_${ac_make}_set=no
+fi
+rm -f conftestmake
+fi
+if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  SET_MAKE=
+else
+  echo "$ac_t""no" 1>&6
+  SET_MAKE="MAKE=${MAKE-make}"
+fi
+
+# Extract the first word of "ps", so it can be a program name with args.
+set dummy ps; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:6496: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_path_PSPROG'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  case "$PSPROG" in
+  /*)
+  ac_cv_path_PSPROG="$PSPROG" # Let the user override the test with a path.
+  ;;
+  ?:/*)			 
+  ac_cv_path_PSPROG="$PSPROG" # Let the user override the test with a dos path.
+  ;;
+  *)
+  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS=":"
+  ac_dummy="$PATH"
+  for ac_dir in $ac_dummy; do 
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/$ac_word; then
+      ac_cv_path_PSPROG="$ac_dir/$ac_word"
+      break
+    fi
+  done
+  IFS="$ac_save_ifs"
+  ;;
+esac
+fi
+PSPROG="$ac_cv_path_PSPROG"
+if test -n "$PSPROG"; then
+  echo "$ac_t""$PSPROG" 1>&6
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+# Extract the first word of "perl", so it can be a program name with args.
+set dummy perl; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:6531: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_path_PERLPROG'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  case "$PERLPROG" in
+  /*)
+  ac_cv_path_PERLPROG="$PERLPROG" # Let the user override the test with a path.
+  ;;
+  ?:/*)			 
+  ac_cv_path_PERLPROG="$PERLPROG" # Let the user override the test with a dos path.
+  ;;
+  *)
+  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS=":"
+  ac_dummy="$PATH"
+  for ac_dir in $ac_dummy; do 
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/$ac_word; then
+      ac_cv_path_PERLPROG="$ac_dir/$ac_word"
+      break
+    fi
+  done
+  IFS="$ac_save_ifs"
+  ;;
+esac
+fi
+PERLPROG="$ac_cv_path_PERLPROG"
+if test -n "$PERLPROG"; then
+  echo "$ac_t""$PERLPROG" 1>&6
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+for ac_prog in whoami logname
+do
+# Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:6568: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_WHOAMI'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  if test -n "$WHOAMI"; then
+  ac_cv_prog_WHOAMI="$WHOAMI" # Let the user override the test.
+else
+  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS=":"
+  ac_dummy="$PATH"
+  for ac_dir in $ac_dummy; do
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/$ac_word; then
+      ac_cv_prog_WHOAMI="$ac_prog"
+      break
+    fi
+  done
+  IFS="$ac_save_ifs"
+fi
+fi
+WHOAMI="$ac_cv_prog_WHOAMI"
+if test -n "$WHOAMI"; then
+  echo "$ac_t""$WHOAMI" 1>&6
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+test -n "$WHOAMI" && break
+done
+test -n "$WHOAMI" || WHOAMI="whoami"
+
+for ac_prog in sed gsed
+do
+# Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:6603: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_SED'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  if test -n "$SED"; then
+  ac_cv_prog_SED="$SED" # Let the user override the test.
+else
+  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS=":"
+  ac_dummy="$PATH"
+  for ac_dir in $ac_dummy; do
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/$ac_word; then
+      ac_cv_prog_SED="$ac_prog"
+      break
+    fi
+  done
+  IFS="$ac_save_ifs"
+fi
+fi
+SED="$ac_cv_prog_SED"
+if test -n "$SED"; then
+  echo "$ac_t""$SED" 1>&6
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+test -n "$SED" && break
+done
+
+# Extract the first word of "autoconf", so it can be a program name with args.
+set dummy autoconf; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:6635: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_AUTOCONF'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  if test -n "$AUTOCONF"; then
+  ac_cv_prog_AUTOCONF="$AUTOCONF" # Let the user override the test.
+else
+  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS=":"
+  ac_dummy="$PATH"
+  for ac_dir in $ac_dummy; do
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/$ac_word; then
+      ac_cv_prog_AUTOCONF=""
+      break
+    fi
+  done
+  IFS="$ac_save_ifs"
+fi
+fi
+AUTOCONF="$ac_cv_prog_AUTOCONF"
+if test -n "$AUTOCONF"; then
+  echo "$ac_t""$AUTOCONF" 1>&6
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+# Extract the first word of "autoheader", so it can be a program name with args.
+set dummy autoheader; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:6664: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_AUTOHEADER'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  if test -n "$AUTOHEADER"; then
+  ac_cv_prog_AUTOHEADER="$AUTOHEADER" # Let the user override the test.
+else
+  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS=":"
+  ac_dummy="$PATH"
+  for ac_dir in $ac_dummy; do
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/$ac_word; then
+      ac_cv_prog_AUTOHEADER=""
+      break
+    fi
+  done
+  IFS="$ac_save_ifs"
+fi
+fi
+AUTOHEADER="$ac_cv_prog_AUTOHEADER"
+if test -n "$AUTOHEADER"; then
+  echo "$ac_t""$AUTOHEADER" 1>&6
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+if test "x$ac_cv_prog_AUTOCONF" = "x"; then
+	AUTOCONF=":"
+	
+fi
+if test "x$ac_cv_prog_AUTOHEADER" = "x"; then
+	AUTOHEADER=":"
+	
+fi
+
+# Extract the first word of "uname", so it can be a program name with args.
+set dummy uname; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:6702: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_path_UNAMEPROG'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  case "$UNAMEPROG" in
+  /*)
+  ac_cv_path_UNAMEPROG="$UNAMEPROG" # Let the user override the test with a path.
+  ;;
+  ?:/*)			 
+  ac_cv_path_UNAMEPROG="$UNAMEPROG" # Let the user override the test with a dos path.
+  ;;
+  *)
+  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS=":"
+  ac_dummy="$PATH"
+  for ac_dir in $ac_dummy; do 
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/$ac_word; then
+      ac_cv_path_UNAMEPROG="$ac_dir/$ac_word"
+      break
+    fi
+  done
+  IFS="$ac_save_ifs"
+  ;;
+esac
+fi
+UNAMEPROG="$ac_cv_path_UNAMEPROG"
+if test -n "$UNAMEPROG"; then
+  echo "$ac_t""$UNAMEPROG" 1>&6
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+cat >> confdefs.h <<EOF
+#define UNAMEPROG "$UNAMEPROG"
+EOF
+
+
+echo $ac_n "checking for working const""... $ac_c" 1>&6
+echo "configure:6740: checking for working const" >&5
+if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 6745 "configure"
+#include "confdefs.h"
+
+int main() {
+
+/* Ultrix mips cc rejects this.  */
+typedef int charset[2]; const charset x;
+/* SunOS 4.1.1 cc rejects this.  */
+char const *const *ccp;
+char **p;
+/* NEC SVR4.0.2 mips cc rejects this.  */
+struct point {int x, y;};
+static struct point const zero = {0,0};
+/* AIX XL C 1.02.0.0 rejects this.
+   It does not let you subtract one const X* pointer from another in an arm
+   of an if-expression whose if-part is not a constant expression */
+const char *g = "string";
+ccp = &g + (g ? g-g : 0);
+/* HPUX 7.0 cc rejects these. */
+++ccp;
+p = (char**) ccp;
+ccp = (char const *const *) p;
+{ /* SCO 3.2v4 cc rejects this.  */
+  char *t;
+  char const *s = 0 ? (char *) 0 : (char const *) 0;
+
+  *t++ = 0;
+}
+{ /* Someone thinks the Sun supposedly-ANSI compiler will reject this.  */
+  int x[] = {25, 17};
+  const int *foo = &x[0];
+  ++foo;
+}
+{ /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */
+  typedef const int *iptr;
+  iptr p = 0;
+  ++p;
+}
+{ /* AIX XL C 1.02.0.0 rejects this saying
+     "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */
+  struct s { int j; const int *ap[3]; };
+  struct s *b; b->j = 5;
+}
+{ /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */
+  const int foo = 10;
+}
+
+; return 0; }
+EOF
+if { (eval echo configure:6794: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  ac_cv_c_const=yes
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  ac_cv_c_const=no
+fi
+rm -f conftest*
+fi
+
+echo "$ac_t""$ac_cv_c_const" 1>&6
+if test $ac_cv_c_const = no; then
+  cat >> confdefs.h <<\EOF
+#define const 
+EOF
+
+fi
+
+echo $ac_n "checking for inline""... $ac_c" 1>&6
+echo "configure:6815: checking for inline" >&5
+if eval "test \"`echo '$''{'ac_cv_c_inline'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  ac_cv_c_inline=no
+for ac_kw in inline __inline__ __inline; do
+  cat > conftest.$ac_ext <<EOF
+#line 6822 "configure"
+#include "confdefs.h"
+
+int main() {
+} $ac_kw foo() {
+; return 0; }
+EOF
+if { (eval echo configure:6829: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  ac_cv_c_inline=$ac_kw; break
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+fi
+rm -f conftest*
+done
+
+fi
+
+echo "$ac_t""$ac_cv_c_inline" 1>&6
+case "$ac_cv_c_inline" in
+  inline | yes) ;;
+  no) cat >> confdefs.h <<\EOF
+#define inline 
+EOF
+ ;;
+  *)  cat >> confdefs.h <<EOF
+#define inline $ac_cv_c_inline
+EOF
+ ;;
+esac
+
+
+echo $ac_n "checking for net-snmp version number""... $ac_c" 1>&6
+echo "configure:6856: checking for net-snmp version number" >&5
+VERSION=`grep NetSnmpVersionInfo.*= $srcdir/snmplib/snmp_version.c | sed 's/";.*//;s/.*"//;s/pre/0./;'`
+
+RELEASEVERSION=`echo $VERSION | sed 's/^\([0-9]\)\.\([0-9]\)/\1:\2:0/'`
+
+
+
+echo "$ac_t""$VERSION" 1>&6
+
+  cat >> configure-summary << EOF
+  Net-SNMP Version:           $VERSION
+EOF
+
+
+echo $ac_n "checking for developer gcc flags""... $ac_c" 1>&6
+echo "configure:6871: checking for developer gcc flags" >&5
+if test "x$developer" = "xyes" -a "x$ac_cv_prog_gcc" = "xyes"; then
+  DEVFLAGS="-Wall -Wstrict-prototypes -Wwrite-strings -Wcast-qual -Wno-char-subscripts"
+else
+  DEVFLAGS=""
+fi
+echo "$ac_t""$DEVFLAGS" 1>&6
+
+
+
+# Do some error checking and defaulting for the host and target type.
+# The inputs are:
+#    configure --host=HOST --target=TARGET --build=BUILD NONOPT
+#
+# The rules are:
+# 1. You are not allowed to specify --host, --target, and nonopt at the
+#    same time.
+# 2. Host defaults to nonopt.
+# 3. If nonopt is not specified, then host defaults to the current host,
+#    as determined by config.guess.
+# 4. Target and build default to nonopt.
+# 5. If nonopt is not specified, then target and build default to host.
+
+# The aliases save the names the user supplied, while $host etc.
+# will get canonicalized.
+case $host---$target---$nonopt in
+NONE---*---* | *---NONE---* | *---*---NONE) ;;
+*) { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; } ;;
+esac
+
+
+# Make sure we can run config.sub.
+if ${CONFIG_SHELL-/bin/sh} $ac_config_sub sun4 >/dev/null 2>&1; then :
+else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; }
+fi
+
+echo $ac_n "checking host system type""... $ac_c" 1>&6
+echo "configure:6908: checking host system type" >&5
+
+host_alias=$host
+case "$host_alias" in
+NONE)
+  case $nonopt in
+  NONE)
+    if host_alias=`${CONFIG_SHELL-/bin/sh} $ac_config_guess`; then :
+    else { echo "configure: error: can not guess host type; you must specify one" 1>&2; exit 1; }
+    fi ;;
+  *) host_alias=$nonopt ;;
+  esac ;;
+esac
+
+host=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $host_alias`
+host_cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
+host_vendor=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
+host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
+echo "$ac_t""$host" 1>&6
+
+echo $ac_n "checking target system type""... $ac_c" 1>&6
+echo "configure:6929: checking target system type" >&5
+
+target_alias=$target
+case "$target_alias" in
+NONE)
+  case $nonopt in
+  NONE) target_alias=$host_alias ;;
+  *) target_alias=$nonopt ;;
+  esac ;;
+esac
+
+target=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $target_alias`
+target_cpu=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
+target_vendor=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
+target_os=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
+echo "$ac_t""$target" 1>&6
+
+echo $ac_n "checking build system type""... $ac_c" 1>&6
+echo "configure:6947: checking build system type" >&5
+
+build_alias=$build
+case "$build_alias" in
+NONE)
+  case $nonopt in
+  NONE) build_alias=$host_alias ;;
+  *) build_alias=$nonopt ;;
+  esac ;;
+esac
+
+build=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $build_alias`
+build_cpu=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
+build_vendor=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
+build_os=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
+echo "$ac_t""$build" 1>&6
+
+test "$host_alias" != "$target_alias" &&
+  test "$program_prefix$program_suffix$program_transform_name" = \
+    NONENONEs,x,x, &&
+  program_prefix=${target_alias}-
+
+
+PARTIALTARGETOS=`echo $target_os | sed 's/[-._].*//'`
+CFLAGS="$CFLAGS -D$PARTIALTARGETOS"
+
+
+  cat >> configure-summary << EOF
+  Building for:               $PARTIALTARGETOS
+EOF
+
+
+
+echo $ac_n "checking for system include file""... $ac_c" 1>&6
+echo "configure:6981: checking for system include file" >&5
+
+filebase=$target_os
+filebase=`echo $filebase | sed 's/elf//'`
+filebase=`echo $filebase | sed 's/aout//'`
+filebase=`echo $filebase | sed 's/ecoff//'`
+filebase=`echo $filebase | sed 's/coff//'`
+while test "x$filebase" != "x$last" -a ! -f $srcdir/include/net-snmp/system/$filebase.h
+do
+    last=$filebase
+    filebase=`echo $filebase | sed 's/[-._][^-._]*$//'`
+    if test "x$filebase" = "x$last"; then
+	filebase=`echo $filebase | sed 's/[0-9]*$//'`
+    fi
+done
+
+if test "x$filebase" = "x$last"; then
+    filebase="generic"
+fi
+ac_cv_SYSTEM_INCLUDE_FILE="net-snmp/system/$filebase.h"
+
+
+echo "$ac_t""$ac_cv_SYSTEM_INCLUDE_FILE" 1>&6
+cat >> confdefs.h <<EOF
+#define SYSTEM_INCLUDE_FILE "$ac_cv_SYSTEM_INCLUDE_FILE"
+EOF
+
+
+
+echo $ac_n "checking for machine-type include file""... $ac_c" 1>&6
+echo "configure:7011: checking for machine-type include file" >&5
+
+filebase=$target_cpu
+while test "x$filebase" != "x$last" -a ! -f $srcdir/include/net-snmp/machine/$filebase.h
+do
+    last=$filebase
+    filebase=`echo $filebase | sed 's/[-._][^-._]*$//'`
+done
+
+if test "x$filebase" = "x$last"; then
+    filebase="generic"
+fi
+ac_cv_MACHINE_INCLUDE_FILE="net-snmp/machine/$filebase.h"
+
+
+echo "$ac_t""$ac_cv_MACHINE_INCLUDE_FILE" 1>&6
+cat >> confdefs.h <<EOF
+#define MACHINE_INCLUDE_FILE "$ac_cv_MACHINE_INCLUDE_FILE"
+EOF
+
+
+# Extract the first word of "$CC", so it can be a program name with args.
+set dummy $CC; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:7035: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_path_CCPATH'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  case "$CCPATH" in
+  /*)
+  ac_cv_path_CCPATH="$CCPATH" # Let the user override the test with a path.
+  ;;
+  ?:/*)			 
+  ac_cv_path_CCPATH="$CCPATH" # Let the user override the test with a dos path.
+  ;;
+  *)
+  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS=":"
+  ac_dummy="$PATH"
+  for ac_dir in $ac_dummy; do 
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/$ac_word; then
+      ac_cv_path_CCPATH="$ac_dir/$ac_word"
+      break
+    fi
+  done
+  IFS="$ac_save_ifs"
+  ;;
+esac
+fi
+CCPATH="$ac_cv_path_CCPATH"
+if test -n "$CCPATH"; then
+  echo "$ac_t""$CCPATH" 1>&6
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+case $target_os in
+    bsdi*)
+	if test "x$CCPATH" = "x/usr/ucb/cc" -o "x$CCPATH" = "x/usr/bin/cc"; then
+	    { echo "configure: error: 
+
+*** The BSDI /usr/ucb/cc compiler does not work with this package.  
+*** Please run configure with --with-cc=gcc
+" 1>&2; exit 1; }
+	fi
+    ;;
+    solaris*)
+	if test "x$CCPATH" = "x/usr/ucb/cc"; then
+	    { echo "configure: error: 
+
+*** The solaris /usr/ucb/cc compiler does not work with this package.  
+*** Please put a different compiler in your path first or run
+*** configure with --with-cc=XX, where XX is the compiler you want to use.
+" 1>&2; exit 1; }
+	fi
+    ;;
+esac
+    
+echo $ac_n "checking for additional cpp flags""... $ac_c" 1>&6
+echo "configure:7090: checking for additional cpp flags" >&5
+if test "x$GCC" = "xyes" -a "x$CPP" = "x$CC -E"; then
+    EXTRACPPFLAGS="-x c"
+else
+  EXTRACPPFLAGS=""
+fi
+
+if test "x$GCC" != "xyes"; then
+  case $target_os in
+    solaris*) EXTRACPPFLAGS="$EXTRACPPFLAGS -Xs" ;;
+  esac
+fi
+
+
+echo "$ac_t""$EXTRACPPFLAGS" 1>&6
+
+
+if test "x$prefix" = "xNONE"; then
+  prefix=/usr/local
+fi
+
+fch=`echo $prefix | sed 's/\(.\).*/\1/'`
+if test $fch != "/" ; then
+   prefix=`pwd`/$prefix
+   echo "adjusting prefix to $prefix"
+fi
+
+if test "x$exec_prefix" = "xNONE"; then
+  exec_prefix=$prefix
+fi
+
+fch=`echo $exec_prefix | sed 's/\(.\).*/\1/'`
+if test $fch != "/" ; then
+   exec_prefix=`pwd`/$exec_prefix
+   echo "adjusting exec_prefix to $exec_prefix"
+fi
+
+
+SNMPLIBPATH=""
+tmpset="$libdir/snmp"
+while test "x$tmpset" != "x$SNMPLIBPATH"; do
+  SNMPLIBPATH="$tmpset"
+  eval tmpset="$tmpset"
+done
+cat >> confdefs.h <<EOF
+#define SNMPLIBPATH "$SNMPLIBPATH"
+EOF
+
+cat >> confdefs.h <<EOF
+#define SNMPDLMODPATH "$SNMPLIBPATH/dlmod"
+EOF
+
+
+SNMPSHAREPATH=""
+tmpset="$datadir/snmp"
+while test "x$tmpset" != "x$SNMPSHAREPATH"; do
+  SNMPSHAREPATH="$tmpset"
+  eval tmpset="$tmpset"
+done
+cat >> confdefs.h <<EOF
+#define SNMPSHAREPATH "$SNMPSHAREPATH"
+EOF
+
+
+if test "x$DEFAULT_MIBDIRS" = "x"; then
+  cat >> confdefs.h <<EOF
+#define DEFAULT_MIBDIRS "\$HOME/.snmp/mibs:$SNMPSHAREPATH/mibs"
+EOF
+
+fi
+
+SNMPCONFPATH=""
+tmpset="$sysconfdir/snmp"
+while test "x$tmpset" != "x$SNMPCONFPATH"; do
+  SNMPCONFPATH="$tmpset"
+  eval tmpset="$tmpset"
+done
+cat >> confdefs.h <<EOF
+#define SNMPCONFPATH "$SNMPCONFPATH"
+EOF
+
+
+
+if test "x$enable_ipv6" = "xyes"; then
+	v6type=unknown
+	v6lib=none
+	v6trylibc=no
+
+	echo $ac_n "checking ipv6 stack type""... $ac_c" 1>&6
+echo "configure:7179: checking ipv6 stack type" >&5
+	for i in v6d toshiba kame inria zeta linux-glibc linux-inet6; do
+		case $i in
+		v6d)
+			cat > conftest.$ac_ext <<EOF
+#line 7184 "configure"
+#include "confdefs.h"
+dnl
+#include </usr/local/v6/include/sys/types.h>
+#ifdef __V6D__
+yes
+#endif
+EOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  egrep "yes" >/dev/null 2>&1; then
+  rm -rf conftest*
+  v6type=$i; v6lib=v6;
+				v6libdir=/usr/local/v6/lib;
+				CFLAGS="-I/usr/local/v6/include $CFLAGS"
+fi
+rm -f conftest*
+
+			;;
+		toshiba)
+			cat > conftest.$ac_ext <<EOF
+#line 7204 "configure"
+#include "confdefs.h"
+dnl
+#include <sys/param.h>
+#ifdef _TOSHIBA_INET6
+yes
+#endif
+EOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  egrep "yes" >/dev/null 2>&1; then
+  rm -rf conftest*
+  v6type=$i; v6lib=inet6;
+				v6libdir=/usr/local/v6/lib;
+				CFLAGS="-DINET6 $CFLAGS"
+fi
+rm -f conftest*
+
+			;;
+		kame)
+			cat > conftest.$ac_ext <<EOF
+#line 7224 "configure"
+#include "confdefs.h"
+dnl
+#include <netinet/in.h>
+#ifdef __KAME__
+yes
+#endif
+EOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  egrep "yes" >/dev/null 2>&1; then
+  rm -rf conftest*
+  v6type=$i; v6lib=inet6;
+				v6libdir=/usr/local/v6/lib;
+				v6trylibc=yes;
+				CFLAGS="-DINET6 $CFLAGS"
+fi
+rm -f conftest*
+
+			;;
+		inria)
+			cat > conftest.$ac_ext <<EOF
+#line 7245 "configure"
+#include "confdefs.h"
+dnl
+#include <netinet/in.h>
+#ifdef IPV6_INRIA_VERSION
+yes
+#endif
+EOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  egrep "yes" >/dev/null 2>&1; then
+  rm -rf conftest*
+  v6type=$i;
+				v6lib=dummy;
+				v6libdir=none;
+				v6trylibc=yes;
+				CFLAGS="-DINET6 $CFLAGS"
+fi
+rm -f conftest*
+
+			;;
+		zeta)
+			cat > conftest.$ac_ext <<EOF
+#line 7267 "configure"
+#include "confdefs.h"
+dnl
+#include <sys/param.h>
+#ifdef _ZETA_MINAMI_INET6
+A
+yes
+#endif
+EOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  egrep "yes" >/dev/null 2>&1; then
+  rm -rf conftest*
+  v6type=$i; v6lib=inet6;
+				v6libdir=/usr/local/v6/lib;
+				CFLAGS="-DINET6 $CFLAGS"
+fi
+rm -f conftest*
+
+			;;
+		linux-glibc)
+			cat > conftest.$ac_ext <<EOF
+#line 7288 "configure"
+#include "confdefs.h"
+dnl
+#include <features.h>
+#if defined(__GLIBC__) && ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1) || (__GLIBC_ > 2))
+yes
+#endif
+EOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  egrep "yes" >/dev/null 2>&1; then
+  rm -rf conftest*
+  v6type=$i;
+				v6lib=dummy;
+				v6libdir=none;
+				v6trylibc=yes;
+				CFLAGS="-DINET6 $CFLAGS"
+fi
+rm -f conftest*
+
+			;;
+		linux-inet6)
+			if test -d /usr/inet6; then
+				v6type=$i
+				v6lib=inet6
+				v6libdir=/usr/inet6/lib
+				CFLAGS="-DINET6 $CFLAGS"
+			fi
+			;;
+		esac
+		if test "$v6type" != "unknown"; then
+			break
+		fi
+	done
+
+	if test "$v6lib" != "none"; then
+		if test -d $v6libdir -a -f $v6libdir/lib$v6lib.a; then
+			LIBS="-L$v6libdir -l$v6lib $LIBS"
+			enable_ipv6="yes"
+			echo "$ac_t"""$v6type, $enable_ipv6, using lib$v6lib"" 1>&6
+		elif test "$v6trylibc" = "yes"; then
+			enable_ipv6="yes"
+			echo "$ac_t"""$v6type, $enable_ipv6, using libc"" 1>&6
+		else
+			{ echo "configure: error: no IPv6 library lib$v6lib.a found." 1>&2; exit 1; }
+			exit 1
+		fi
+	else
+		enable_ipv6="no"
+		echo "$ac_t"""$v6type, $enable_ipv6"" 1>&6
+	fi
+fi
+
+
+if test "x$with_res_locks" = "xyes"; then
+  cat >> confdefs.h <<\EOF
+#define NS_REENTRANT 1
+EOF
+
+EOF
+
+    case $target_os in
+
+    aix*)
+	CC_RUNTIME_ARG="$CC_RUNTIME_ARG -lpthreads"
+	;;
+
+    *)
+	;;
+
+    esac
+fi
+
+echo $ac_n "checking whether we have to build PIC code""... $ac_c" 1>&6
+echo "configure:7361: checking whether we have to build PIC code" >&5
+echo "$with_mib_modules" | grep "ucd-snmp/dlmod" >/dev/null
+if test $? -eq 0 ; then
+	DLLIBS="-ldl"
+        LIB_CFLAGS="$LIB_CFLAGS $SHLIB_CFLAGS"
+	echo "$ac_t""yes" 1>&6
+else
+	DLLIBS=""
+	echo "$ac_t""no" 1>&6
+fi
+
+echo $ac_n "checking for and configuring transport modules to use""... $ac_c" 1>&6
+echo "configure:7373: checking for and configuring transport modules to use" >&5
+transport_src_list=""
+transport_hdr_list=""
+transport_def_list=""
+transport_result_list=""
+transport_add_list=""
+new_with_transport_list=`echo $with_transports | sed 's/,/ /g;'`
+new_with_out_transport_list=`echo $with_out_transports | sed 's/,/ /g;'`
+
+if test "x$PARTIALTARGETOS" = "xcygwin"; then
+  transport_default_list="UDP TCP Callback"
+else
+  transport_default_list="UDP TCP Unix Callback"
+fi
+if test "x$enable_ipv6" = "xyes"; then
+  transport_default_list="UDPIPv6 TCPIPv6 $transport_default_list"
+fi
+for i in $transport_default_list; do
+  if echo " $new_with_transport_list " | grep " $i " >/dev/null; then
+    :
+  else
+    transport_add_list="$i $transport_add_list"
+  fi
+done
+new_transport_list="$transport_add_list $new_with_transport_list"
+
+for i in $new_transport_list; do
+  if echo " $new_with_out_transport_list " | grep " $i " >/dev/null; then
+    if test "x$i" = "xUDP"; then
+      echo
+      { echo "configure: error: It is not possible to compile without UDP/IP support." 1>&2; exit 1; }
+    fi
+  else
+    if test "x$i" = "xAAL5PVC"; then
+      if test "x$PARTIALTARGETOS" != "xlinux"; then
+        echo
+        { echo "configure: error: AAL5 PVC support unavailable for this platform (Linux only)" 1>&2; exit 1; }
+      fi
+    fi
+    if test "x$i" = "xIPX"; then
+      if test "x$PARTIALTARGETOS" != "xlinux"; then
+        echo
+        { echo "configure: error: IPX support unavailable for this platform (Linux only)" 1>&2; exit 1; }
+      fi
+    fi
+    if test "x$i" = "xUnix"; then
+      if test "x$PARTIALTARGETOS" = "xcygwin"; then
+        echo
+        { echo "configure: error: Unix domain protocol support unavailable for this platform" 1>&2; exit 1; }
+      fi
+    fi
+    transport_src="snmp"$i"Domain.c"
+    transport_hdr="snmp"$i"Domain.h"
+    rel_transport_src="snmplib/"$transport_src
+    rel_transport_hdr="include/net-snmp/library/"$transport_hdr
+    if test -f "$srcdir/$rel_transport_src"; then
+      transport_result_list="$transport_result_list $i"
+      transport_src_list="$transport_src $transport_src_list"
+      if test -f "$srcdir/$rel_transport_hdr"; then
+        transport_hdr_list="$transport_hdr $transport_hdr_list"
+      fi
+      transport_def=`echo $i | sed 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
+      transport_def_list="SNMP_TRANSPORT_"$transport_def"_DOMAIN $transport_def_list"
+    else
+      echo
+      { echo "configure: error: Cannot find file $transport_src to support SNMP transport domain $i." 1>&2; exit 1; }
+    fi
+  fi
+done
+transport_obj_list=`echo " $transport_src_list " | sed 's/\.c/\.o/g'`
+transport_lobj_list=`echo " $transport_src_list " | sed 's/\.c/\.lo/g'`
+
+
+
+
+for i in $transport_def_list; do
+  cat >> confdefs.h <<EOF
+#define $i 1
+EOF
+
+done
+echo "$ac_t""$transport_result_list." 1>&6
+
+  cat >> configure-summary << EOF
+  Network transport support: $transport_result_list
+EOF
+
+
+
+echo $ac_n "checking for security modules to use""... $ac_c" 1>&6
+echo "configure:7463: checking for security modules to use" >&5
+security_def_list="usm"
+security_src_list=""
+security_obj_list=""
+security_lobj_list=""
+security_init_file="snmplib/snmpsm_init.h"
+security_incl_file="include/net-snmp/library/snmpv3-security-includes.h"
+new_with_security=`echo $with_security_modules | sed 's/,/ /g;'`
+new_with_out_security=`echo $with_out_security_modules | sed 's/,/ /g;'`
+
+if test ! -d include; then
+  mkdir include
+fi
+if test ! -d include/net-snmp; then
+  mkdir include/net-snmp
+fi
+if test ! -d include/net-snmp/agent; then
+  mkdir include/net-snmp/agent
+fi
+if test ! -d include/net-snmp/library; then
+  mkdir include/net-snmp/library
+fi
+if test ! -d include/ucd-snmp; then
+  mkdir include/ucd-snmp
+fi
+
+if test ! -d snmplib; then
+  mkdir snmplib
+fi
+echo "/* This file is automatically generated by configure.  Do not modify by hand. */" > $security_init_file
+echo "/* This file is automatically generated by configure.  Do not modify by hand. */" > $security_incl_file
+
+for i in $security_def_list; do
+  if echo " $new_with_out_security " | grep " $i " > /dev/null; then
+    if test "x$i" = "xusm"; then
+	echo
+        { echo "configure: error: The USM security module is mandatory" 1>&2; exit 1; }
+    fi
+  else
+    new_with_security="$new_with_security $i"
+  fi
+done
+
+for i in $new_with_security; do
+  cfile="snmp"$i".c"
+  hfile="snmp"$i".h"
+
+  # make sure support exists for it
+  if test -f $srcdir"/snmplib/"$cfile -a -f $srcdir"/include/net-snmp/library/"$hfile; then
+    :
+  else
+    echo
+    { echo "configure: error: No such security module: $i / $cfile / $hfile" 1>&2; exit 1; }
+  fi
+
+  # define a bunch of stuff to enable it
+  security_src_list="$security_src_list $cfile"
+  security_hdr_list="$security_hdr_list $hfile"
+  security_obj_list="$security_obj_list snmp"$i".o"
+  security_lobj_list="$security_lobj_list snmp"$i".lo"
+  def_name="SNMP_SECMOD_"`echo $i | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+  echo "init_"$i"();" >> $security_init_file
+  echo "#include <net-snmp/library/$hfile>" >> $security_incl_file
+  cat >> confdefs.h <<EOF
+#define $def_name 1
+EOF
+
+done
+
+
+
+
+
+echo "$ac_t""$new_with_security" 1>&6
+
+  cat >> configure-summary << EOF
+  SNMPv3 Security Modules:   $new_with_security
+EOF
+
+
+
+for sec in $new_with_security
+do
+  if test x$sec = xksm; then
+    echo $ac_n "checking to see which crypto API we need to use""... $ac_c" 1>&6
+echo "configure:7548: checking to see which crypto API we need to use" >&5
+
+    echo $ac_n "checking for krb5_c_encrypt""... $ac_c" 1>&6
+echo "configure:7551: checking for krb5_c_encrypt" >&5
+if eval "test \"`echo '$''{'ac_cv_func_krb5_c_encrypt'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 7556 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char krb5_c_encrypt(); below.  */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char krb5_c_encrypt();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_krb5_c_encrypt) || defined (__stub___krb5_c_encrypt)
+choke me
+#else
+krb5_c_encrypt();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:7579: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_func_krb5_c_encrypt=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_func_krb5_c_encrypt=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'krb5_c_encrypt`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  
+      echo "$ac_t""new MIT crypto API" 1>&6
+      cat >> confdefs.h <<\EOF
+#define MIT_NEW_CRYPTO 1
+EOF
+
+else
+  echo "$ac_t""no" 1>&6
+
+      echo "$ac_t""old MIT crypto API" 1>&6
+fi
+
+  fi
+done
+
+echo $ac_n "checking for and configuring mib modules to use""... $ac_c" 1>&6
+echo "configure:7609: checking for and configuring mib modules to use" >&5
+
+
+mibdir="agent/mibgroup"
+module_list=""
+module_list_code=""
+new_with_mib_modules=`echo $with_mib_modules | sed 's/,/ /g;'`
+new_with_out_mib_modules=`echo $with_out_mib_modules | sed 's/,/ /g;'`
+new_module_list="mibII ucd_snmp snmpv3mibs notification target agent_mibs agentx agent_mibs utilities $new_with_mib_modules"
+default_mibs=IP-MIB:IF-MIB:TCP-MIB:UDP-MIB:SNMPv2-MIB:RFC1213-MIB:NOTIFICATION-LOG-MIB
+
+if test "x$mini_agent" = "xyes"; then
+new_with_out_mib_modules="mibII $new_with_out_mib_modules"
+new_module_list="snmpv3mibs mibII/snmp_mib mibII/system_mib mibII/sysORTable mibII/vacm_vars $new_with_mib_modules"
+default_mibs=SNMPv2-MIB:RFC1213-MIB
+default_mibs_install=" "
+fi
+
+
+if test "x$enable_ipv6" = "xyes"; then
+	new_module_list="$new_module_list mibII/ipv6"
+fi
+
+if test ! -d agent; then
+  mkdir agent
+fi
+if test ! -d agent/mibgroup; then
+  mkdir agent/mibgroup
+fi
+for i in $mibdir/mib_module_includes.h $mibdir/mib_module_inits.h $mibdir/mib_module_shutdown.h include/net-snmp/agent/mib_module_config.h $mibdir/mib_module_dot_conf.h; do
+  rm -f $i
+  echo "/* This file is automatically generated by configure.  Do not modify by hand. */" > $i
+done
+
+test_modules="$new_module_list"
+new_module_list=""
+module_list_h=""
+
+for i in $test_modules
+ do
+  if echo " $new_with_out_mib_modules " | grep " $i " > /dev/null; then
+    :
+  else
+    new_module_list="$new_module_list $i"
+  fi
+done
+
+
+echo "$ac_t""$new_module_list." 1>&6
+
+  cat >> configure-summary << EOF
+  Agent MIB code:            $new_module_list
+EOF
+
+
+echo $ac_n "checking for and configuring mib modules pieces to use""... $ac_c" 1>&6
+echo "configure:7665: checking for and configuring mib modules pieces to use" >&5
+FD=6
+
+
+while test "x$new_module_list" != "x"; do
+  for i in $new_module_list
+    do
+    if echo " $new_with_out_mib_modules " | grep " $i " > /dev/null; then
+      :
+    else
+      if test -f $srcdir/$mibdir/$i.h; then
+        new_list=""
+        new_list_arch=`grep config_arch_require $srcdir/$mibdir/$i.h | sed 's/.*config_arch_require(\(.*\), *\(.*\)).*/\1-xarchx-\2/'`
+	if test "x$new_list_arch" != "x"; then
+          for j in $new_list_arch
+	    do
+	    archtest=`echo $j | sed 's/-xarchx-.*//'`
+	    if test "x$target_os" = "x$archtest" -o "x$PARTIALTARGETOS" = "x$archtest"; then
+	      new_list="$new_list `echo $j | sed 's/.*-xarchx-//'`"
+	    fi
+	  done
+	fi
+	new_list="$new_list `grep config_require $srcdir/$mibdir/$i.h | sed 's/.*config_require(\(.*\)).*/\1/'`"
+	if test "x$new_list" != "x"; then
+	  for j in $new_list
+	    do
+	    if test ! -f $srcdir/$mibdir/$j.h; then
+              
+	      { echo "configure: error: mib module "$i" requires module "$j" but $j.h or $j.c could not be found in $srcdir/$mibdir" 1>&2; exit 1; }
+              
+	    elif echo " $new_with_out_mib_modules " | grep " $j " > /dev/null; then
+              
+	      echo "configure: warning: mib module "$i" requires module "$j" but you told me to compile without it" 1>&2
+              
+	    elif echo " $module_list $new_list_two $new_module_list " | grep " $j " > /dev/null; then
+	      :
+	    else
+	      new_list_two="$new_list_two $j"
+	    fi
+	  done
+	fi
+	new_mibs=`grep config_add_mib $srcdir/$mibdir/$i.h | sed 's/.*config_add_mib(\(.*\)).*/\1/'`
+	if test "x$new_mibs" != "x"; then
+	    for j in $new_mibs
+		do
+		if test "x`echo :$default_mibs: | grep :$j:`" = "x"; then
+		    default_mibs="$default_mibs:$j"
+		fi
+		if test -f $srcdir/mibs/$j.txt; then
+		    if echo $default_mibs_install | grep " $j " > /dev/null; then
+			    :
+		    else
+			    default_mibs_install="$default_mibs_install $j.txt"
+		    fi
+		fi
+	    done
+	fi
+      else
+        
+	{ echo "configure: error: module files $i.h or $i.c could not be found in $srcdir/$mibdir" 1>&2; exit 1; }
+        
+      fi
+      module_list="$module_list $i"
+      echo '#include "'"mibgroup/$i.h"'"' >> $mibdir/mib_module_includes.h
+      module_list_h="$module_list_h mibgroup/$i.h"
+      if test -f $srcdir/$mibdir/$i.c; then
+        module_list_code="$module_list_code $i"
+        mnm=`echo $i | sed 's/.*\///;s/\.c$//;'`
+        temp_init=`grep init_$mnm $srcdir/$mibdir/$i.c | grep -v _init_$mnm`
+	if test "x$temp_init" != "x"; then
+	    echo "  if (should_init(\"$mnm\")) init_$mnm();" >> $mibdir/mib_module_inits.h
+	fi
+	if grep shutdown_`basename $i` $srcdir/$mibdir/$i.c > /dev/null; then
+	    echo "  if (should_init(\"`basename $i`\")) shutdown_`basename $i`();" >> $mibdir/mib_module_shutdown.h
+	fi
+      fi
+      if test "x`echo $i | sed 's/\///g;'`" != "x$i"; then
+	mnd=`echo $i | sed 's/\/[^/]*$//;'`
+	if test ! -d ./$mibdir/$mnd; then
+	    module_directories="$module_directories ./$mibdir/$mnd"
+	fi
+      fi
+      if grep config_load_mib $srcdir/$mibdir/$i.h > /dev/null 2>&1; then
+        
+      	echo "configure: warning: mib module "$i" uses the "config_load_mib" directive" 1>&2
+        
+      fi
+      grep config_parse_dot_conf $srcdir/$mibdir/$i.h | sed 's@.*config_parse_dot_conf(\([^)]*\), *\([^),]*\), *\([^),]*\), *\([^),]*\)).*@register_config_handler("snmpd",\1, \2, \3, \4);@' >> $mibdir/mib_module_dot_conf.h
+      sym="`echo ${i} | sed 's/[^a-zA-Z0-9_]/_/g' | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`"
+      echo "/* Define if compiling with the ${i} module files.  */" >> include/net-snmp/agent/mib_module_config.h
+      echo "#define USING_${sym}_MODULE 1" >> include/net-snmp/agent/mib_module_config.h
+      echo " " >> include/net-snmp/agent/mib_module_config.h
+      echo $ac_n " $i$ac_c" >&$FD
+    fi
+  done
+  new_module_list="$new_list_two"
+  new_list_two=""
+done
+module_list_o=`echo "$module_list_code " | sed 's/\([^ ]\) /\1.o /g'`
+module_list_lo=`echo "$module_list_code " | sed 's/\([^ ]\) /\1.lo /g'`
+module_list_c=`echo "$module_list_code " | sed 's/\([^ ]\) /\1.c /g'`
+mibgroup_list_o=`echo " $module_list_o " | sed 's@ \([^ ]*\)\.o@ mibgroup/\1.o @g'`
+mibgroup_list_lo=`echo " $module_list_lo " | sed 's@ \([^ ]*\)\.lo@ mibgroup/\1.lo @g'`
+
+MODULE_LIST=$module_list_code
+
+
+
+
+
+
+
+
+
+
+echo "$ac_t""." 1>&6
+
+echo $ac_n "checking if directories need to be created""... $ac_c" 1>&6
+echo "configure:7783: checking if directories need to be created" >&5
+for i in $module_directories; do
+  $srcdir/mkinstalldirs $i
+done
+echo "$ac_t""." 1>&6
+
+echo $ac_n "checking default mib files to read""... $ac_c" 1>&6
+echo "configure:7790: checking default mib files to read" >&5
+if test "x$DEFAULT_MIBS" = "x"; then
+  DEFAULT_MIBS="$default_mibs"
+fi
+cat >> confdefs.h <<EOF
+#define DEFAULT_MIBS "$DEFAULT_MIBS"
+EOF
+
+echo "$ac_t""$DEFAULT_MIBS" 1>&6
+
+
+echo $ac_n "checking for location of system kernel""... $ac_c" 1>&6
+echo "configure:7802: checking for location of system kernel" >&5
+if eval "test \"`echo '$''{'ac_cv_KERNEL_LOC'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  ac_cv_KERNEL_LOC="unknown"
+
+if test -c /dev/null; then
+  CFLAG="-c"
+elif test -f /dev/null; then
+  CFLAG="-f"
+else
+    CFLAG="-f"
+fi
+for i in /vmunix /hp-ux /stand/vmunix /dev/ksyms /kernel/unix /kernel/genunix /netbsd /unix /kernel /bsd /mach_kernel
+  do
+  if test -f $i -o $CFLAG $i; then
+    ac_cv_KERNEL_LOC="$i"
+    break;
+  fi
+done
+if test $i = "unknown"; then
+  echo "configure: warning: Can't find system kernel...  Setting to /vmunix" 1>&2
+  ac_cv_KERNEL_LOC="/vmunix"
+fi
+
+fi
+
+echo "$ac_t""$ac_cv_KERNEL_LOC" 1>&6
+
+cat >> confdefs.h <<EOF
+#define KERNEL_LOC "$ac_cv_KERNEL_LOC"
+EOF
+
+
+
+echo $ac_n "checking for mount table location""... $ac_c" 1>&6
+echo "configure:7838: checking for mount table location" >&5
+if eval "test \"`echo '$''{'ac_cv_ETC_MNTTAB'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  ac_cv_ETC_MNTTAB="unknown"
+for i in /etc/mnttab /etc/mtab /etc/filesystems
+  do
+  if test -f $i; then
+    ac_cv_ETC_MNTTAB="$i"
+    break;
+  fi
+done
+
+fi
+
+echo "$ac_t""$ac_cv_ETC_MNTTAB" 1>&6
+
+cat >> confdefs.h <<EOF
+#define ETC_MNTTAB "$ac_cv_ETC_MNTTAB"
+EOF
+
+
+echo $ac_n "checking for location of swap device""... $ac_c" 1>&6
+echo "configure:7861: checking for location of swap device" >&5
+if eval "test \"`echo '$''{'ac_cv_DMEM_LOC'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+
+if test -f /dev/kmem; then
+  CTEST="test -f"
+elif test -c /dev/kmem; then
+  CTEST="test -c"
+else
+    CTEST="test -f"
+fi
+
+if $CTEST /dev/dmem; then
+  ac_cv_DMEM_LOC="/dev/dmem"
+elif $CTEST /dev/drum; then
+  ac_cv_DMEM_LOC="/dev/drum"
+else
+  ac_cv_DMEM_LOC="none"
+fi
+
+fi
+
+echo "$ac_t""$ac_cv_DMEM_LOC" 1>&6
+
+if test "x$ac_cv_DMEM_LOC" != "xnone"; then
+  cat >> confdefs.h <<EOF
+#define DMEM_LOC "$ac_cv_DMEM_LOC"
+EOF
+
+fi
+
+
+if test "x$use_efence" = "xyes"; then
+    echo $ac_n "checking for EF_Exit in -lefence""... $ac_c" 1>&6
+echo "configure:7897: checking for EF_Exit in -lefence" >&5
+ac_lib_var=`echo efence'_'EF_Exit | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  ac_save_LIBS="$LIBS"
+LIBS="-lefence  $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 7905 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char EF_Exit();
+
+int main() {
+EF_Exit()
+; return 0; }
+EOF
+if { (eval echo configure:7916: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_lib=HAVE_LIB`echo efence | sed -e 's/[^a-zA-Z0-9_]/_/g' \
+    -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_lib 1
+EOF
+
+  LIBS="-lefence $LIBS"
+
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+fi
+
+echo $ac_n "checking for asin in -lm""... $ac_c" 1>&6
+echo "configure:7946: checking for asin in -lm" >&5
+ac_lib_var=`echo m'_'asin | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  ac_save_LIBS="$LIBS"
+LIBS="-lm  $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 7954 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char asin();
+
+int main() {
+asin()
+; return 0; }
+EOF
+if { (eval echo configure:7965: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_lib=HAVE_LIB`echo m | sed -e 's/[^a-zA-Z0-9_]/_/g' \
+    -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_lib 1
+EOF
+
+  LIBS="-lm $LIBS"
+
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+echo $ac_n "checking for nlist in -lelf""... $ac_c" 1>&6
+echo "configure:7993: checking for nlist in -lelf" >&5
+ac_lib_var=`echo elf'_'nlist | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  ac_save_LIBS="$LIBS"
+LIBS="-lelf  $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 8001 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char nlist();
+
+int main() {
+nlist()
+; return 0; }
+EOF
+if { (eval echo configure:8012: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_lib=HAVE_LIB`echo elf | sed -e 's/[^a-zA-Z0-9_]/_/g' \
+    -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_lib 1
+EOF
+
+  LIBS="-lelf $LIBS"
+
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+
+echo $ac_n "checking for gethostbyname""... $ac_c" 1>&6
+echo "configure:8041: checking for gethostbyname" >&5
+if eval "test \"`echo '$''{'ac_cv_func_gethostbyname'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 8046 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char gethostbyname(); below.  */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char gethostbyname();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_gethostbyname) || defined (__stub___gethostbyname)
+choke me
+#else
+gethostbyname();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:8069: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_func_gethostbyname=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_func_gethostbyname=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'gethostbyname`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  cat >> confdefs.h <<\EOF
+#define HAVE_GETHOSTBYNAME 1
+EOF
+
+else
+  echo "$ac_t""no" 1>&6
+echo $ac_n "checking for gethostbyname in -lnsl""... $ac_c" 1>&6
+echo "configure:8090: checking for gethostbyname in -lnsl" >&5
+ac_lib_var=`echo nsl'_'gethostbyname | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  ac_save_LIBS="$LIBS"
+LIBS="-lnsl  $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 8098 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char gethostbyname();
+
+int main() {
+gethostbyname()
+; return 0; }
+EOF
+if { (eval echo configure:8109: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  cat >> confdefs.h <<\EOF
+#define HAVE_GETHOSTBYNAME 1
+EOF
+
+	LIBS="${LIBS} -lnsl"
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+fi
+
+echo $ac_n "checking for getservbyname""... $ac_c" 1>&6
+echo "configure:8136: checking for getservbyname" >&5
+if eval "test \"`echo '$''{'ac_cv_func_getservbyname'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 8141 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char getservbyname(); below.  */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char getservbyname();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_getservbyname) || defined (__stub___getservbyname)
+choke me
+#else
+getservbyname();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:8164: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_func_getservbyname=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_func_getservbyname=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'getservbyname`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  cat >> confdefs.h <<\EOF
+#define HAVE_GETSERVBYNAME 1
+EOF
+
+else
+  echo "$ac_t""no" 1>&6
+echo $ac_n "checking for getservbyname in -lsocket""... $ac_c" 1>&6
+echo "configure:8185: checking for getservbyname in -lsocket" >&5
+ac_lib_var=`echo socket'_'getservbyname | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  ac_save_LIBS="$LIBS"
+LIBS="-lsocket  $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 8193 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char getservbyname();
+
+int main() {
+getservbyname()
+; return 0; }
+EOF
+if { (eval echo configure:8204: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  cat >> confdefs.h <<\EOF
+#define HAVE_GETSERVBYNAME 1
+EOF
+
+	LIBS="${LIBS} -lsocket"
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+fi
+
+
+echo $ac_n "checking for kstat_lookup in -lkstat""... $ac_c" 1>&6
+echo "configure:8232: checking for kstat_lookup in -lkstat" >&5
+ac_lib_var=`echo kstat'_'kstat_lookup | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  ac_save_LIBS="$LIBS"
+LIBS="-lkstat  $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 8240 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char kstat_lookup();
+
+int main() {
+kstat_lookup()
+; return 0; }
+EOF
+if { (eval echo configure:8251: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_lib=HAVE_LIB`echo kstat | sed -e 's/[^a-zA-Z0-9_]/_/g' \
+    -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_lib 1
+EOF
+
+  LIBS="-lkstat $LIBS"
+
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+echo $ac_n "checking for nlist in -lmld""... $ac_c" 1>&6
+echo "configure:8279: checking for nlist in -lmld" >&5
+ac_lib_var=`echo mld'_'nlist | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  ac_save_LIBS="$LIBS"
+LIBS="-lmld  $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 8287 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char nlist();
+
+int main() {
+nlist()
+; return 0; }
+EOF
+if { (eval echo configure:8298: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_lib=HAVE_LIB`echo mld | sed -e 's/[^a-zA-Z0-9_]/_/g' \
+    -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_lib 1
+EOF
+
+  LIBS="-lmld $LIBS"
+
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+
+if test "x$tryopenssl" != "xno"; then
+    if test "x$tryrsaref" != "xno"; then
+         echo $ac_n "checking for RSAPrivateDecrypt in -lrsaref""... $ac_c" 1>&6
+echo "configure:8329: checking for RSAPrivateDecrypt in -lrsaref" >&5
+ac_lib_var=`echo rsaref'_'RSAPrivateDecrypt | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  ac_save_LIBS="$LIBS"
+LIBS="-lrsaref  $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 8337 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char RSAPrivateDecrypt();
+
+int main() {
+RSAPrivateDecrypt()
+; return 0; }
+EOF
+if { (eval echo configure:8348: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_lib=HAVE_LIB`echo rsaref | sed -e 's/[^a-zA-Z0-9_]/_/g' \
+    -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_lib 1
+EOF
+
+  LIBS="-lrsaref $LIBS"
+
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+         echo $ac_n "checking for RSA_PKCS1_RSAref in -lRSAglue""... $ac_c" 1>&6
+echo "configure:8376: checking for RSA_PKCS1_RSAref in -lRSAglue" >&5
+ac_lib_var=`echo RSAglue'_'RSA_PKCS1_RSAref | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  ac_save_LIBS="$LIBS"
+LIBS="-lRSAglue  $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 8384 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char RSA_PKCS1_RSAref();
+
+int main() {
+RSA_PKCS1_RSAref()
+; return 0; }
+EOF
+if { (eval echo configure:8395: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_lib=HAVE_LIB`echo RSAglue | sed -e 's/[^a-zA-Z0-9_]/_/g' \
+    -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_lib 1
+EOF
+
+  LIBS="-lRSAglue $LIBS"
+
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+    fi
+
+    echo $ac_n "checking for EVP_md5 in -lcrypto""... $ac_c" 1>&6
+echo "configure:8425: checking for EVP_md5 in -lcrypto" >&5
+ac_lib_var=`echo crypto'_'EVP_md5 | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  ac_save_LIBS="$LIBS"
+LIBS="-lcrypto  $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 8433 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char EVP_md5();
+
+int main() {
+EVP_md5()
+; return 0; }
+EOF
+if { (eval echo configure:8444: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_lib=HAVE_LIB`echo crypto | sed -e 's/[^a-zA-Z0-9_]/_/g' \
+    -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_lib 1
+EOF
+
+  LIBS="-lcrypto $LIBS"
+
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+    for ac_func in AES_cfb128_encrypt
+do
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:8474: checking for $ac_func" >&5
+if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 8479 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char $ac_func(); below.  */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char $ac_func();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+$ac_func();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:8502: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_func 1
+EOF
+ 
+else
+  echo "$ac_t""no" 1>&6
+fi
+done
+
+fi
+
+NONAGENTLIBS=$LIBS
+
+_cppflags="${CPPFLAGS}"
+_ldflags="${LDFLAGS}"
+
+# Check whether --with-libwrap or --without-libwrap was given.
+if test "${with_libwrap+set}" = set; then
+  withval="$with_libwrap"
+  
+  if test "$with_libwrap" != "no"; then
+    if test "$with_libwrap" != "yes"; then
+      CPPFLAGS="${CPPFLAGS} -I$with_libwrap/include"
+      LDFLAGS="${LDFLAGS} -L$with_libwrap/lib"
+    fi
+
+    _libs=${LIBS}
+    ac_safe=`echo "tcpd.h" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for tcpd.h""... $ac_c" 1>&6
+echo "configure:8546: checking for tcpd.h" >&5
+if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 8551 "configure"
+#include "confdefs.h"
+#include <tcpd.h>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:8556: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=yes"
+else
+  echo "$ac_err" >&5
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  :
+else
+  echo "$ac_t""no" 1>&6
+{ echo "configure: error: Asked to use libwrap but I couldn't find tcpd.h." 1>&2; exit 1; }
+fi
+
+
+    LIBS="$LIBS -lwrap"
+	echo $ac_n "checking for TCP wrappers library -lwrap""... $ac_c" 1>&6
+echo "configure:8581: checking for TCP wrappers library -lwrap" >&5
+	cat > conftest.$ac_ext <<EOF
+#line 8583 "configure"
+#include "confdefs.h"
+#include <tcpd.h>
+		     int allow_severity = 0;
+		     int deny_severity  = 0;
+		    
+int main() {
+hosts_access((void *)0)
+; return 0; }
+EOF
+if { (eval echo configure:8593: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  
+	    echo "$ac_t""yes" 1>&6
+	    cat >> confdefs.h <<\EOF
+#define USE_LIBWRAP 1
+EOF
+
+	    test "$with_libwrap" != no -a "$with_libwrap" != yes && WRAPLIBS="-L$with_libwrap/lib"
+	    WRAPLIBS="$WRAPLIBS -lwrap"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  
+	    echo "$ac_t""no" 1>&6
+	    	    echo $ac_n "checking for yp_get_default_domain""... $ac_c" 1>&6
+echo "configure:8610: checking for yp_get_default_domain" >&5
+if eval "test \"`echo '$''{'ac_cv_func_yp_get_default_domain'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 8615 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char yp_get_default_domain(); below.  */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char yp_get_default_domain();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_yp_get_default_domain) || defined (__stub___yp_get_default_domain)
+choke me
+#else
+yp_get_default_domain();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:8638: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_func_yp_get_default_domain=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_func_yp_get_default_domain=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'yp_get_default_domain`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  :
+else
+  echo "$ac_t""no" 1>&6
+echo $ac_n "checking for yp_get_default_domain in -lnsl""... $ac_c" 1>&6
+echo "configure:8656: checking for yp_get_default_domain in -lnsl" >&5
+ac_lib_var=`echo nsl'_'yp_get_default_domain | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  ac_save_LIBS="$LIBS"
+LIBS="-lnsl  $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 8664 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char yp_get_default_domain();
+
+int main() {
+yp_get_default_domain()
+; return 0; }
+EOF
+if { (eval echo configure:8675: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_lib=HAVE_LIB`echo nsl | sed -e 's/^a-zA-Z0-9_/_/g' \
+    -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_lib 1
+EOF
+
+  LIBS="-lnsl $LIBS"
+
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+fi
+
+	    echo $ac_n "checking for TCP wrappers library -lwrap linked with -lnsl""... $ac_c" 1>&6
+echo "configure:8705: checking for TCP wrappers library -lwrap linked with -lnsl" >&5
+	    cat > conftest.$ac_ext <<EOF
+#line 8707 "configure"
+#include "confdefs.h"
+#include <tcpd.h>
+		         int allow_severity = 0;
+	                 int deny_severity  = 0;
+	 		
+int main() {
+hosts_access((void *)0)
+; return 0; }
+EOF
+if { (eval echo configure:8717: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  echo "$ac_t""yes" 1>&6
+			cat >> confdefs.h <<\EOF
+#define USE_LIBWRAP 1
+EOF
+
+			test "$with_libwrap" != no -a "$with_libwrap" != yes && WRAPLIBS="-L$with_libwrap/lib"
+			WRAPLIBS="$WRAPLIBS -lwrap -lnsl"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  echo "$ac_t""no" 1>&6
+			{ echo "configure: error: Asked to use libwrap but I couldn't find it." 1>&2; exit 1; }
+fi
+rm -f conftest*
+        
+fi
+rm -f conftest*
+    CPPFLAGS=${_cppflags}
+    LDFLAGS=${_ldflags}
+    LIBS=${_libs}
+  fi
+
+fi
+
+
+if echo " $module_list " | grep " host/hr_swinst " > /dev/null; then
+      _rpmlibs=""
+
+    _cppflags="${CPPFLAGS}"
+  _ldflags="${LDFLAGS}"
+
+  # Check whether --with-zlib or --without-zlib was given.
+if test "${with_zlib+set}" = set; then
+  withval="$with_zlib"
+  
+    if test -d "$withval"; then
+      CPPFLAGS="${CPPFLAGS} -I$withval/include"
+      LDFLAGS="${LDFLAGS} -L$withval/lib"
+    fi
+  
+fi
+
+
+    ac_safe=`echo "zlib.h" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for zlib.h""... $ac_c" 1>&6
+echo "configure:8765: checking for zlib.h" >&5
+if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 8770 "configure"
+#include "confdefs.h"
+#include <zlib.h>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:8775: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=yes"
+else
+  echo "$ac_err" >&5
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  echo $ac_n "checking for gzread in -lz""... $ac_c" 1>&6
+echo "configure:8792: checking for gzread in -lz" >&5
+ac_lib_var=`echo z'_'gzread | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  ac_save_LIBS="$LIBS"
+LIBS="-lz  $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 8800 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char gzread();
+
+int main() {
+gzread()
+; return 0; }
+EOF
+if { (eval echo configure:8811: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_lib=HAVE_LIB`echo z | sed -e 's/^a-zA-Z0-9_/_/g' \
+    -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_lib 1
+EOF
+
+  LIBS="-lz $LIBS"
+
+else
+  echo "$ac_t""no" 1>&6
+CPPFLAGS=${_cppflags} LDFLAGS=${_ldflags}
+fi
+
+else
+  echo "$ac_t""no" 1>&6
+CPPFLAGS=${_cppflags} LDFLAGS=${_ldflags}
+fi
+
+
+    echo $ac_n "checking for bzread in -lbz2""... $ac_c" 1>&6
+echo "configure:8846: checking for bzread in -lbz2" >&5
+ac_lib_var=`echo bz2'_'bzread | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  ac_save_LIBS="$LIBS"
+LIBS="-lbz2  $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 8854 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char bzread();
+
+int main() {
+bzread()
+; return 0; }
+EOF
+if { (eval echo configure:8865: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  _rpmlibs="$_rpmlibs -lbz2"
+else
+  echo "$ac_t""no" 1>&6
+echo $ac_n "checking for BZ2_bzread in -lbz2""... $ac_c" 1>&6
+echo "configure:8884: checking for BZ2_bzread in -lbz2" >&5
+ac_lib_var=`echo bz2'_'BZ2_bzread | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  ac_save_LIBS="$LIBS"
+LIBS="-lbz2  $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 8892 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char BZ2_bzread();
+
+int main() {
+BZ2_bzread()
+; return 0; }
+EOF
+if { (eval echo configure:8903: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  _rpmlibs="$_rpmlibs -lbz2"
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+fi
+
+
+    echo $ac_n "checking for dbopen in -ldb1""... $ac_c" 1>&6
+echo "configure:8927: checking for dbopen in -ldb1" >&5
+ac_lib_var=`echo db1'_'dbopen | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  ac_save_LIBS="$LIBS"
+LIBS="-ldb1  $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 8935 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char dbopen();
+
+int main() {
+dbopen()
+; return 0; }
+EOF
+if { (eval echo configure:8946: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  _rpmlibs="-ldb1 $_rpmlibs"
+else
+  echo "$ac_t""no" 1>&6
+echo $ac_n "checking for dbopen in -ldb""... $ac_c" 1>&6
+echo "configure:8965: checking for dbopen in -ldb" >&5
+ac_lib_var=`echo db'_'dbopen | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  ac_save_LIBS="$LIBS"
+LIBS="-ldb  $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 8973 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char dbopen();
+
+int main() {
+dbopen()
+; return 0; }
+EOF
+if { (eval echo configure:8984: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  _rpmlibs="-ldb $_rpmlibs"
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+fi
+
+
+    echo $ac_n "checking for db_create in -ldb-3.1""... $ac_c" 1>&6
+echo "configure:9008: checking for db_create in -ldb-3.1" >&5
+ac_lib_var=`echo db-3.1'_'db_create | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  ac_save_LIBS="$LIBS"
+LIBS="-ldb-3.1  $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 9016 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char db_create();
+
+int main() {
+db_create()
+; return 0; }
+EOF
+if { (eval echo configure:9027: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  _rpmlibs="-ldb-3.1 $_rpmlibs"
+else
+  echo "$ac_t""no" 1>&6
+echo $ac_n "checking for db_create in -ldb-3.0""... $ac_c" 1>&6
+echo "configure:9046: checking for db_create in -ldb-3.0" >&5
+ac_lib_var=`echo db-3.0'_'db_create | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  ac_save_LIBS="$LIBS"
+LIBS="-ldb-3.0  $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 9054 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char db_create();
+
+int main() {
+db_create()
+; return 0; }
+EOF
+if { (eval echo configure:9065: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  _rpmlibs="-ldb-3.0 $_rpmlibs"
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+fi
+
+  
+    echo $ac_n "checking for poptParseArgvString in -lpopt""... $ac_c" 1>&6
+echo "configure:9089: checking for poptParseArgvString in -lpopt" >&5
+ac_lib_var=`echo popt'_'poptParseArgvString | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  ac_save_LIBS="$LIBS"
+LIBS="-lpopt  $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 9097 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char poptParseArgvString();
+
+int main() {
+poptParseArgvString()
+; return 0; }
+EOF
+if { (eval echo configure:9108: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  _rpmlibs="-lpopt $_rpmlibs"
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+  
+    echo $ac_n "checking for Fopen in -lrpmio""... $ac_c" 1>&6
+echo "configure:9130: checking for Fopen in -lrpmio" >&5
+ac_lib_var=`echo rpmio'_'Fopen | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  ac_save_LIBS="$LIBS"
+LIBS="-lrpmio $_rpmlibs $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 9138 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char Fopen();
+
+int main() {
+Fopen()
+; return 0; }
+EOF
+if { (eval echo configure:9149: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  _rpmlibs="-lrpmio $_rpmlibs"
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+  
+    echo $ac_n "checking for rpmGetFilesystemList in -lrpm""... $ac_c" 1>&6
+echo "configure:9171: checking for rpmGetFilesystemList in -lrpm" >&5
+ac_lib_var=`echo rpm'_'rpmGetFilesystemList | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  ac_save_LIBS="$LIBS"
+LIBS="-lrpm  $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 9179 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char rpmGetFilesystemList();
+
+int main() {
+rpmGetFilesystemList()
+; return 0; }
+EOF
+if { (eval echo configure:9190: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  
+    cat >> confdefs.h <<\EOF
+#define HAVE_LIBRPM 1
+EOF
+
+    LIBS="-lrpm $_rpmlibs $LIBS"
+    CFLAGS="$CFLAGS -I/usr/include/rpm"
+  
+else
+  echo "$ac_t""no" 1>&6
+
+        echo $ac_n "checking for rpmdbOpen in -lrpmdb""... $ac_c" 1>&6
+echo "configure:9217: checking for rpmdbOpen in -lrpmdb" >&5
+ac_lib_var=`echo rpmdb'_'rpmdbOpen | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  ac_save_LIBS="$LIBS"
+LIBS="-lrpmdb -lrpm $_rpmlibs $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 9225 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char rpmdbOpen();
+
+int main() {
+rpmdbOpen()
+; return 0; }
+EOF
+if { (eval echo configure:9236: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  
+      cat >> confdefs.h <<\EOF
+#define HAVE_LIBRPM 1
+EOF
+
+      LIBS="-lrpmdb -lrpm $_rpmlibs $LIBS"
+      CFLAGS="$CFLAGS -I/usr/include/rpm"
+    
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+  
+fi
+
+fi
+  
+echo $ac_n "checking for kvm_read in -lkvm""... $ac_c" 1>&6
+echo "configure:9269: checking for kvm_read in -lkvm" >&5
+ac_lib_var=`echo kvm'_'kvm_read | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  ac_save_LIBS="$LIBS"
+LIBS="-lkvm  $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 9277 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char kvm_read();
+
+int main() {
+kvm_read()
+; return 0; }
+EOF
+if { (eval echo configure:9288: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_lib=HAVE_LIB`echo kvm | sed -e 's/[^a-zA-Z0-9_]/_/g' \
+    -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_lib 1
+EOF
+
+  LIBS="-lkvm $LIBS"
+
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+echo $ac_n "checking for dlopen in -ldl""... $ac_c" 1>&6
+echo "configure:9316: checking for dlopen in -ldl" >&5
+ac_lib_var=`echo dl'_'dlopen | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  ac_save_LIBS="$LIBS"
+LIBS="-ldl  $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 9324 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char dlopen();
+
+int main() {
+dlopen()
+; return 0; }
+EOF
+if { (eval echo configure:9335: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_lib=HAVE_LIB`echo dl | sed -e 's/[^a-zA-Z0-9_]/_/g' \
+    -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_lib 1
+EOF
+
+  LIBS="-ldl $LIBS"
+
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+for ac_func in dlopen
+do
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:9365: checking for $ac_func" >&5
+if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 9370 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char $ac_func(); below.  */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char $ac_func();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+$ac_func();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:9393: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_func 1
+EOF
+ 
+else
+  echo "$ac_t""no" 1>&6
+fi
+done
+
+
+for ac_func in kvm_openfiles nlist knlist kvm_getprocs
+do
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:9421: checking for $ac_func" >&5
+if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 9426 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char $ac_func(); below.  */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char $ac_func();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+$ac_func();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:9449: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_func 1
+EOF
+ 
+else
+  echo "$ac_t""no" 1>&6
+fi
+done
+
+echo "$with_mib_modules" | grep "ucd-snmp/diskio" >/dev/null
+if test $? -eq 0 ; then
+	echo $ac_n "checking for getdevs""... $ac_c" 1>&6
+echo "configure:9476: checking for getdevs" >&5
+if eval "test \"`echo '$''{'ac_cv_func_getdevs'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 9481 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char getdevs(); below.  */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char getdevs();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_getdevs) || defined (__stub___getdevs)
+choke me
+#else
+getdevs();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:9504: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_func_getdevs=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_func_getdevs=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'getdevs`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  cat >> confdefs.h <<\EOF
+#define HAVE_GETDEVS 1
+EOF
+
+else
+  echo "$ac_t""no" 1>&6
+echo $ac_n "checking for getdevs in -ldevstat""... $ac_c" 1>&6
+echo "configure:9525: checking for getdevs in -ldevstat" >&5
+ac_lib_var=`echo devstat'_'getdevs | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  ac_save_LIBS="$LIBS"
+LIBS="-ldevstat  $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 9533 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char getdevs();
+
+int main() {
+getdevs()
+; return 0; }
+EOF
+if { (eval echo configure:9544: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  cat >> confdefs.h <<\EOF
+#define HAVE_GETDEVS 1
+EOF
+
+		LIBS="${LIBS} -ldevstat"
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+fi
+
+fi
+
+
+
+if test "x$embed_perl" = "xyes" -a "x$install_perl" = "xno" ; then
+  install_perl="yes"
+fi
+if test "x$install_perl" != "x" -a "x$install_perl" != "xno"; then
+    PERLTARGS="perlmodules"
+    PERLINSTALLTARGS="perlinstall"
+    
+    
+    
+    
+  cat >> configure-summary << EOF
+  SNMP Perl modules:          enabled
+EOF
+
+fi
+
+if test "x$embed_perl" = "xyes"; then
+    myperl=$ac_cv_path_PERLPROG
+    if test $myperl = "no"; then
+      { echo "configure: error: --enable-embedded-perl requested but no perl executable found" 1>&2; exit 1; }
+    fi
+
+    echo $ac_n "checking for perl CFLAGS""... $ac_c" 1>&6
+echo "configure:9597: checking for perl CFLAGS" >&5
+    perlcflags=`$myperl -MExtUtils::Embed -e ccopts`
+    echo "$ac_t""$perlcflags" 1>&6
+    CPPFLAGS="$CPPFLAGS $perlcflags"
+
+    echo $ac_n "checking for perl LDFLAGS""... $ac_c" 1>&6
+echo "configure:9603: checking for perl LDFLAGS" >&5
+    perlldopts=`$myperl -MExtUtils::Embed -e ldopts`
+    echo "$ac_t""$perlldopts" 1>&6
+    LIBS="$LIBS $perlldopts"
+
+        for ac_func in eval_pv perl_eval_pv
+do
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:9611: checking for $ac_func" >&5
+if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 9616 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char $ac_func(); below.  */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char $ac_func();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+$ac_func();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:9639: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_func 1
+EOF
+ 
+else
+  echo "$ac_t""no" 1>&6
+fi
+done
+
+
+    cat >> confdefs.h <<\EOF
+#define NETSNMP_EMBEDDED_PERL 1
+EOF
+
+    OTHERAGENTLIBOBJS="snmp_perl.o"
+    OTHERAGENTLIBLOBJS="snmp_perl.lo"
+
+    EMBEDPERLINSTALL="embedperlinstall"
+    
+    
+  cat >> configure-summary << EOF
+  Embedded perl support:      enabled
+EOF
+
+fi
+
+AGENTLIBS=$LIBS
+LIBS=$NONAGENTLIBS
+
+echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6
+echo "configure:9684: checking for ANSI C header files" >&5
+if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 9689 "configure"
+#include "confdefs.h"
+#include <stdlib.h>
+#include <stdarg.h>
+#include <string.h>
+#include <float.h>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:9697: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+  rm -rf conftest*
+  ac_cv_header_stdc=yes
+else
+  echo "$ac_err" >&5
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+if test $ac_cv_header_stdc = yes; then
+  # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
+cat > conftest.$ac_ext <<EOF
+#line 9714 "configure"
+#include "confdefs.h"
+#include <string.h>
+EOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  egrep "memchr" >/dev/null 2>&1; then
+  :
+else
+  rm -rf conftest*
+  ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+  # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
+cat > conftest.$ac_ext <<EOF
+#line 9732 "configure"
+#include "confdefs.h"
+#include <stdlib.h>
+EOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  egrep "free" >/dev/null 2>&1; then
+  :
+else
+  rm -rf conftest*
+  ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+  # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
+if test "$cross_compiling" = yes; then
+  :
+else
+  cat > conftest.$ac_ext <<EOF
+#line 9753 "configure"
+#include "confdefs.h"
+#include <ctype.h>
+#define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
+#define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
+#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
+int main () { int i; for (i = 0; i < 256; i++)
+if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2);
+exit (0); }
+
+EOF
+if { (eval echo configure:9764: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+then
+  :
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -fr conftest*
+  ac_cv_header_stdc=no
+fi
+rm -fr conftest*
+fi
+
+fi
+fi
+
+echo "$ac_t""$ac_cv_header_stdc" 1>&6
+if test $ac_cv_header_stdc = yes; then
+  cat >> confdefs.h <<\EOF
+#define STDC_HEADERS 1
+EOF
+
+fi
+
+ac_header_dirent=no
+for ac_hdr in dirent.h sys/ndir.h sys/dir.h ndir.h
+do
+ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for $ac_hdr that defines DIR""... $ac_c" 1>&6
+echo "configure:9792: checking for $ac_hdr that defines DIR" >&5
+if eval "test \"`echo '$''{'ac_cv_header_dirent_$ac_safe'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 9797 "configure"
+#include "confdefs.h"
+#include <sys/types.h>
+#include <$ac_hdr>
+int main() {
+DIR *dirp = 0;
+; return 0; }
+EOF
+if { (eval echo configure:9805: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  eval "ac_cv_header_dirent_$ac_safe=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_header_dirent_$ac_safe=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_header_dirent_'$ac_safe`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_hdr 1
+EOF
+ ac_header_dirent=$ac_hdr; break
+else
+  echo "$ac_t""no" 1>&6
+fi
+done
+# Two versions of opendir et al. are in -ldir and -lx on SCO Xenix.
+if test $ac_header_dirent = dirent.h; then
+echo $ac_n "checking for opendir in -ldir""... $ac_c" 1>&6
+echo "configure:9830: checking for opendir in -ldir" >&5
+ac_lib_var=`echo dir'_'opendir | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  ac_save_LIBS="$LIBS"
+LIBS="-ldir  $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 9838 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char opendir();
+
+int main() {
+opendir()
+; return 0; }
+EOF
+if { (eval echo configure:9849: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  LIBS="$LIBS -ldir"
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+else
+echo $ac_n "checking for opendir in -lx""... $ac_c" 1>&6
+echo "configure:9871: checking for opendir in -lx" >&5
+ac_lib_var=`echo x'_'opendir | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  ac_save_LIBS="$LIBS"
+LIBS="-lx  $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 9879 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char opendir();
+
+int main() {
+opendir()
+; return 0; }
+EOF
+if { (eval echo configure:9890: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  LIBS="$LIBS -lx"
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+fi
+
+echo $ac_n "checking for sys/wait.h that is POSIX.1 compatible""... $ac_c" 1>&6
+echo "configure:9913: checking for sys/wait.h that is POSIX.1 compatible" >&5
+if eval "test \"`echo '$''{'ac_cv_header_sys_wait_h'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 9918 "configure"
+#include "confdefs.h"
+#include <sys/types.h>
+#include <sys/wait.h>
+#ifndef WEXITSTATUS
+#define WEXITSTATUS(stat_val) ((unsigned)(stat_val) >> 8)
+#endif
+#ifndef WIFEXITED
+#define WIFEXITED(stat_val) (((stat_val) & 255) == 0)
+#endif
+int main() {
+int s;
+wait (&s);
+s = WIFEXITED (s) ? WEXITSTATUS (s) : 1;
+; return 0; }
+EOF
+if { (eval echo configure:9934: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  ac_cv_header_sys_wait_h=yes
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  ac_cv_header_sys_wait_h=no
+fi
+rm -f conftest*
+fi
+
+echo "$ac_t""$ac_cv_header_sys_wait_h" 1>&6
+if test $ac_cv_header_sys_wait_h = yes; then
+  cat >> confdefs.h <<\EOF
+#define HAVE_SYS_WAIT_H 1
+EOF
+
+fi
+
+for ac_hdr in stdarg.h string.h fcntl.h limits.h sys/file.h sys/ioctl.h syslog.h unistd.h netinet/tcpip.h netinet/in.h netinet/ip.h netinet/ip_icmp.h net/if.h netdb.h sys/dmap.h machine/pte.h xti.h sys/sockio.h sys/socket.h sys/un.h fstab.h sys/fs.h mtab.h ufs/fs.h ufs/ffs/fs.h sys/fixpoint.h machine/param.h sys/vm.h vm/vm.h sys/vmmeter.h sys/vmparam.h sys/vmmac.h sys/vmsystm.h sys/mbuf.h sys/time.h sys/swap.h inet/mib2.h sys/statvfs.h sys/vfs.h sys/mnttab.h sys/user.h sys/proc.h sys/select.h mntent.h sys/mntent.h kstat.h utsname.h sys/utsname.h sys/cdefs.h getopt.h locale.h pthread.h sys/loadavg.h regex.h linux/tasks.h pwd.h grp.h utmpx.h
+do
+ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+echo "configure:9958: checking for $ac_hdr" >&5
+if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 9963 "configure"
+#include "confdefs.h"
+#include <$ac_hdr>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:9968: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=yes"
+else
+  echo "$ac_err" >&5
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_hdr 1
+EOF
+ 
+else
+  echo "$ac_t""no" 1>&6
+fi
+done
+
+for ac_hdr in malloc.h sys/param.h net/if_dl.h sys/sysctl.h stdlib.h net/if_mib.h net/if_types.h net/if_var.h sys/queue.h osreldate.h machine/types.h sys/socketvar.h
+do
+ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+echo "configure:9998: checking for $ac_hdr" >&5
+if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 10003 "configure"
+#include "confdefs.h"
+#include <$ac_hdr>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:10008: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=yes"
+else
+  echo "$ac_err" >&5
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_hdr 1
+EOF
+ 
+else
+  echo "$ac_t""no" 1>&6
+fi
+done
+
+for ac_hdr in sys/conf.h netinet/in_systm.h netinet/tcp.h netinet/udp.h netinet/in_var.h netinet/if_ether.h netinet/ip_var.h netinet/tcp_timer.h netinet/tcp_var.h netinet/tcp_fsm.h netinet/udp_var.h netinet/icmp_var.h sys/protosw.h nlist.h ioctls.h asm/page.h netipx/ipx.h
+do
+ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+echo "configure:10038: checking for $ac_hdr" >&5
+if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 10043 "configure"
+#include "confdefs.h"
+#include <$ac_hdr>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:10048: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=yes"
+else
+  echo "$ac_err" >&5
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_hdr 1
+EOF
+ 
+else
+  echo "$ac_t""no" 1>&6
+fi
+done
+
+for ac_hdr in arpa/inet.h kvm.h sys/pool.h uvm/uvm_param.h uvm/uvm_extern.h vm/vm_param.h vm/vm_extern.h
+do
+ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+echo "configure:10078: checking for $ac_hdr" >&5
+if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 10083 "configure"
+#include "confdefs.h"
+#include <$ac_hdr>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:10088: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=yes"
+else
+  echo "$ac_err" >&5
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_hdr 1
+EOF
+ 
+else
+  echo "$ac_t""no" 1>&6
+fi
+done
+
+for ac_hdr in sys/mount.h vm/swap_pager.h ufs/ufs/dinode.h
+do
+ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+echo "configure:10118: checking for $ac_hdr" >&5
+if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 10123 "configure"
+#include "confdefs.h"
+#include <$ac_hdr>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:10128: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=yes"
+else
+  echo "$ac_err" >&5
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_hdr 1
+EOF
+ 
+else
+  echo "$ac_t""no" 1>&6
+fi
+done
+
+for ac_hdr in sys/stat.h sys/vnode.h ufs/ufs/quota.h ufs/ufs/inode.h
+do
+ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+echo "configure:10158: checking for $ac_hdr" >&5
+if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 10163 "configure"
+#include "confdefs.h"
+#include <$ac_hdr>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:10168: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=yes"
+else
+  echo "$ac_err" >&5
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_hdr 1
+EOF
+ 
+else
+  echo "$ac_t""no" 1>&6
+fi
+done
+
+for ac_hdr in sys/hashing.h sys/tcpipstats.h sys/sysmp.h
+do
+ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+echo "configure:10198: checking for $ac_hdr" >&5
+if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 10203 "configure"
+#include "confdefs.h"
+#include <$ac_hdr>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:10208: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=yes"
+else
+  echo "$ac_err" >&5
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_hdr 1
+EOF
+ 
+else
+  echo "$ac_t""no" 1>&6
+fi
+done
+
+for ac_hdr in err.h sys/filio.h sgtty.h
+do
+ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+echo "configure:10238: checking for $ac_hdr" >&5
+if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 10243 "configure"
+#include "confdefs.h"
+#include <$ac_hdr>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:10248: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=yes"
+else
+  echo "$ac_err" >&5
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_hdr 1
+EOF
+ 
+else
+  echo "$ac_t""no" 1>&6
+fi
+done
+
+for ac_hdr in sys/statfs.h
+do
+ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+echo "configure:10278: checking for $ac_hdr" >&5
+if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 10283 "configure"
+#include "confdefs.h"
+#include <$ac_hdr>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:10288: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=yes"
+else
+  echo "$ac_err" >&5
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_hdr 1
+EOF
+ 
+else
+  echo "$ac_t""no" 1>&6
+fi
+done
+
+for ac_hdr in net/route.h
+do
+ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+echo "configure:10318: checking for $ac_hdr" >&5
+if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 10323 "configure"
+#include "confdefs.h"
+#include <$ac_hdr>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:10328: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=yes"
+else
+  echo "$ac_err" >&5
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_hdr 1
+EOF
+ 
+else
+  echo "$ac_t""no" 1>&6
+fi
+done
+
+for ac_hdr in sys/dkio.h sys/diskio.h sys/pstat.h linux/hdreg.h pkglocs.h
+do
+ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+echo "configure:10358: checking for $ac_hdr" >&5
+if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 10363 "configure"
+#include "confdefs.h"
+#include <$ac_hdr>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:10368: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=yes"
+else
+  echo "$ac_err" >&5
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_hdr 1
+EOF
+ 
+else
+  echo "$ac_t""no" 1>&6
+fi
+done
+
+for ac_hdr in pkginfo.h
+do
+ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+echo "configure:10398: checking for $ac_hdr" >&5
+if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 10403 "configure"
+#include "confdefs.h"
+#include <$ac_hdr>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:10408: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=yes"
+else
+  echo "$ac_err" >&5
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_hdr 1
+EOF
+ echo $ac_n "checking for pkginfo in -ladm""... $ac_c" 1>&6
+echo "configure:10429: checking for pkginfo in -ladm" >&5
+ac_lib_var=`echo adm'_'pkginfo | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  ac_save_LIBS="$LIBS"
+LIBS="-ladm  $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 10437 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char pkginfo();
+
+int main() {
+pkginfo()
+; return 0; }
+EOF
+if { (eval echo configure:10448: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  cat >> confdefs.h <<\EOF
+#define HAVE_PKGINFO 1
+EOF
+
+    LIBS="${LIBS} -ladm"
+    AGENTLIBS="${AGENTLIBS} -ladm"
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+else
+  echo "$ac_t""no" 1>&6
+fi
+done
+
+for ac_hdr in winsock.h
+do
+ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+echo "configure:10482: checking for $ac_hdr" >&5
+if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 10487 "configure"
+#include "confdefs.h"
+#include <$ac_hdr>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:10492: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=yes"
+else
+  echo "$ac_err" >&5
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_hdr 1
+EOF
+ AGENTLIBS="${AGENTLIBS} -liphlpapi"
+else
+  echo "$ac_t""no" 1>&6
+fi
+done
+
+for ac_hdr in io.h
+do
+ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+echo "configure:10522: checking for $ac_hdr" >&5
+if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 10527 "configure"
+#include "confdefs.h"
+#include <$ac_hdr>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:10532: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=yes"
+else
+  echo "$ac_err" >&5
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_hdr 1
+EOF
+ 
+else
+  echo "$ac_t""no" 1>&6
+fi
+done
+
+for ac_hdr in sys/stream.h
+do
+ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+echo "configure:10562: checking for $ac_hdr" >&5
+if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 10567 "configure"
+#include "confdefs.h"
+#include <$ac_hdr>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:10572: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=yes"
+else
+  echo "$ac_err" >&5
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_hdr 1
+EOF
+ 
+else
+  echo "$ac_t""no" 1>&6
+fi
+done
+
+for ac_hdr in netinet/ip6.h netinet6/in6_var.h netinet6/in6_pcb.h netinet6/ip6_var.h netinet6/tcp6.h netinet6/tcp6_fsm.h netinet6/nd6.h netinet6/tcp6_timer.h netinet6/tcp6_var.h
+do
+ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+echo "configure:10602: checking for $ac_hdr" >&5
+if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 10607 "configure"
+#include "confdefs.h"
+#include <$ac_hdr>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:10612: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=yes"
+else
+  echo "$ac_err" >&5
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_hdr 1
+EOF
+ 
+else
+  echo "$ac_t""no" 1>&6
+fi
+done
+
+for ac_hdr in dlfcn.h
+do
+ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+echo "configure:10642: checking for $ac_hdr" >&5
+if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 10647 "configure"
+#include "confdefs.h"
+#include <$ac_hdr>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:10652: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=yes"
+else
+  echo "$ac_err" >&5
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_hdr 1
+EOF
+ 
+else
+  echo "$ac_t""no" 1>&6
+fi
+done
+
+for ac_hdr in search.h
+do
+ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+echo "configure:10682: checking for $ac_hdr" >&5
+if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 10687 "configure"
+#include "confdefs.h"
+#include <$ac_hdr>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:10692: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=yes"
+else
+  echo "$ac_err" >&5
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_hdr 1
+EOF
+ 
+else
+  echo "$ac_t""no" 1>&6
+fi
+done
+
+
+if echo " $module_list " | grep " host/hr_swinst " > /dev/null; then
+  for ac_hdr in rpmio.h
+do
+ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+echo "configure:10724: checking for $ac_hdr" >&5
+if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 10729 "configure"
+#include "confdefs.h"
+#include <$ac_hdr>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:10734: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=yes"
+else
+  echo "$ac_err" >&5
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_hdr 1
+EOF
+ 
+else
+  echo "$ac_t""no" 1>&6
+for ac_hdr in rpm/rpmio.h
+do
+ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+echo "configure:10761: checking for $ac_hdr" >&5
+if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 10766 "configure"
+#include "confdefs.h"
+#include <$ac_hdr>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:10771: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=yes"
+else
+  echo "$ac_err" >&5
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_hdr 1
+EOF
+ CFLAGS="-I/usr/include/rpm $CFLAGS"
+else
+  echo "$ac_t""no" 1>&6
+fi
+done
+
+  
+fi
+done
+
+fi
+
+echo $ac_n "checking for netinet/in_pcb.h""... $ac_c" 1>&6
+echo "configure:10804: checking for netinet/in_pcb.h" >&5
+if eval "test \"`echo '$''{'cv_have_netinet_in_pcb_h'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+   cat > conftest.$ac_ext <<EOF
+#line 10809 "configure"
+#include "confdefs.h"
+
+#include <netinet/in.h>
+#include <netinet/in_pcb.h>
+
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:10817: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+  rm -rf conftest*
+  cv_have_netinet_in_pcb_h=yes
+else
+  echo "$ac_err" >&5
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  cv_have_netinet_in_pcb_h=no
+fi
+rm -f conftest*
+fi
+
+echo "$ac_t""$cv_have_netinet_in_pcb_h" 1>&6
+if test $cv_have_netinet_in_pcb_h = yes; then
+  cat >> confdefs.h <<\EOF
+#define HAVE_NETINET_IN_PCB_H 1
+EOF
+
+fi
+
+echo $ac_n "checking for sys/disklabel.h""... $ac_c" 1>&6
+echo "configure:10841: checking for sys/disklabel.h" >&5
+if eval "test \"`echo '$''{'cv_have_sys_disklabel_h'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+   cat > conftest.$ac_ext <<EOF
+#line 10846 "configure"
+#include "confdefs.h"
+
+#include <machine/types.h>
+#include <sys/disklabel.h>
+
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:10854: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+  rm -rf conftest*
+  cv_have_sys_disklabel_h=yes
+else
+  echo "$ac_err" >&5
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  cv_have_sys_disklabel_h=no
+fi
+rm -f conftest*
+fi
+
+echo "$ac_t""$cv_have_sys_disklabel_h" 1>&6
+if test $cv_have_sys_disklabel_h = yes; then
+  cat >> confdefs.h <<\EOF
+#define HAVE_SYS_DISKLABEL_H 1
+EOF
+
+fi
+
+for ac_hdr in openssl/hmac.h openssl/evp.h openssl/aes.h openssl/des.h
+do
+ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+echo "configure:10881: checking for $ac_hdr" >&5
+if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 10886 "configure"
+#include "confdefs.h"
+#include <$ac_hdr>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:10891: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=yes"
+else
+  echo "$ac_err" >&5
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_hdr 1
+EOF
+ 
+else
+  echo "$ac_t""no" 1>&6
+fi
+done
+
+
+# Extract the first word of "lpstat", so it can be a program name with args.
+set dummy lpstat; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:10921: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_path_LPSTAT_PATH'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  case "$LPSTAT_PATH" in
+  /*)
+  ac_cv_path_LPSTAT_PATH="$LPSTAT_PATH" # Let the user override the test with a path.
+  ;;
+  ?:/*)			 
+  ac_cv_path_LPSTAT_PATH="$LPSTAT_PATH" # Let the user override the test with a dos path.
+  ;;
+  *)
+  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS=":"
+  ac_dummy="$PATH"
+  for ac_dir in $ac_dummy; do 
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/$ac_word; then
+      ac_cv_path_LPSTAT_PATH="$ac_dir/$ac_word"
+      break
+    fi
+  done
+  IFS="$ac_save_ifs"
+  ;;
+esac
+fi
+LPSTAT_PATH="$ac_cv_path_LPSTAT_PATH"
+if test -n "$LPSTAT_PATH"; then
+  echo "$ac_t""$LPSTAT_PATH" 1>&6
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+if test x$LPSTAT_PATH != x; then
+    cat >> confdefs.h <<EOF
+#define LPSTAT_PATH "$LPSTAT_PATH"
+EOF
+
+    cat >> confdefs.h <<\EOF
+#define HAVE_LPSTAT 1
+EOF
+
+fi
+for ac_func in cgetnext
+do
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:10966: checking for $ac_func" >&5
+if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 10971 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char $ac_func(); below.  */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char $ac_func();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+$ac_func();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:10994: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_func 1
+EOF
+ 
+else
+  echo "$ac_t""no" 1>&6
+fi
+done
+
+if test -r /etc/printcap; then
+    cat >> confdefs.h <<\EOF
+#define HAVE_PRINTCAP 1
+EOF
+
+fi
+
+echo $ac_n "checking for authentication support""... $ac_c" 1>&6
+echo "configure:11026: checking for authentication support" >&5
+if test "x$ac_cv_lib_crypto_EVP_md5" != "xyes" -o "x$ac_cv_header_openssl_hmac_h" != "xyes" -o "x$ac_cv_header_openssl_hmac_h" != "xyes"; then
+    cat >> confdefs.h <<\EOF
+#define USE_INTERNAL_MD5 1
+EOF
+
+    authmodes="MD5"
+    encrmodes=""
+    echo "$ac_t""Internal MD5 Support" 1>&6
+    if test "x$askedopenssl" = "xyes"; then
+	{ echo "configure: error: Asked to use OpenSSL but I couldn't find it." 1>&2; exit 1; }
+    fi
+else
+    if test "x$tryopenssl" = "xno"; then
+        authmodes="MD5"
+        encrmodes=""
+	cat >> confdefs.h <<\EOF
+#define USE_INTERNAL_MD5 1
+EOF
+
+	echo "$ac_t""Internal MD5 Support" 1>&6
+    else
+        authmodes="MD5 SHA1"
+        if test "x$enable_privacy" != "xno" ; then
+	    if test $ac_cv_header_openssl_aes_h = "yes" ; then
+	        encrmodes="DES AES128 AES192 AES256"
+	    else
+	        encrmodes="DES"
+	    fi
+        else
+	    encrmodes="disabled"
+        fi
+	cat >> confdefs.h <<\EOF
+#define USE_OPENSSL 1
+EOF
+
+	echo "$ac_t""OpenSSL Support" 1>&6
+    fi
+fi
+
+
+  cat >> configure-summary << EOF
+  Authentication support:     $authmodes
+EOF
+
+
+  cat >> configure-summary << EOF
+  Encryption support:         $encrmodes
+EOF
+
+
+echo $ac_n "checking for off_t""... $ac_c" 1>&6
+echo "configure:11078: checking for off_t" >&5
+if eval "test \"`echo '$''{'ac_cv_type_off_t'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 11083 "configure"
+#include "confdefs.h"
+#include <sys/types.h>
+#if STDC_HEADERS
+#include <stdlib.h>
+#include <stddef.h>
+#endif
+EOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  egrep "(^|[^a-zA-Z_0-9])off_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then
+  rm -rf conftest*
+  ac_cv_type_off_t=yes
+else
+  rm -rf conftest*
+  ac_cv_type_off_t=no
+fi
+rm -f conftest*
+
+fi
+echo "$ac_t""$ac_cv_type_off_t" 1>&6
+if test $ac_cv_type_off_t = no; then
+  cat >> confdefs.h <<\EOF
+#define off_t long
+EOF
+
+fi
+
+echo $ac_n "checking for pid_t""... $ac_c" 1>&6
+echo "configure:11111: checking for pid_t" >&5
+if eval "test \"`echo '$''{'ac_cv_type_pid_t'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 11116 "configure"
+#include "confdefs.h"
+#include <sys/types.h>
+#if STDC_HEADERS
+#include <stdlib.h>
+#include <stddef.h>
+#endif
+EOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  egrep "(^|[^a-zA-Z_0-9])pid_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then
+  rm -rf conftest*
+  ac_cv_type_pid_t=yes
+else
+  rm -rf conftest*
+  ac_cv_type_pid_t=no
+fi
+rm -f conftest*
+
+fi
+echo "$ac_t""$ac_cv_type_pid_t" 1>&6
+if test $ac_cv_type_pid_t = no; then
+  cat >> confdefs.h <<\EOF
+#define pid_t int
+EOF
+
+fi
+
+echo $ac_n "checking whether time.h and sys/time.h may both be included""... $ac_c" 1>&6
+echo "configure:11144: checking whether time.h and sys/time.h may both be included" >&5
+if eval "test \"`echo '$''{'ac_cv_header_time'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 11149 "configure"
+#include "confdefs.h"
+#include <sys/types.h>
+#include <sys/time.h>
+#include <time.h>
+int main() {
+struct tm *tp;
+; return 0; }
+EOF
+if { (eval echo configure:11158: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  ac_cv_header_time=yes
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  ac_cv_header_time=no
+fi
+rm -f conftest*
+fi
+
+echo "$ac_t""$ac_cv_header_time" 1>&6
+if test $ac_cv_header_time = yes; then
+  cat >> confdefs.h <<\EOF
+#define TIME_WITH_SYS_TIME 1
+EOF
+
+fi
+
+
+echo $ac_n "checking for socklen_t""... $ac_c" 1>&6
+echo "configure:11180: checking for socklen_t" >&5
+if eval "test \"`echo '$''{'ac_cv_type_$1'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 11185 "configure"
+#include "confdefs.h"
+#include <sys/types.h>
+#if STDC_HEADERS
+#include <stdlib.h>
+#include <stddef.h>
+#endif
+#ifdef HAVE_SYS_SOCKET_H
+#include <sys/socket.h>
+#endif
+EOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  egrep "socklen_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then
+  rm -rf conftest*
+  ac_cv_type_socklen_t=yes
+else
+  rm -rf conftest*
+  ac_cv_type_socklen_t=no
+fi
+rm -f conftest*
+
+fi
+
+echo "$ac_t""$ac_cv_type_socklen_t" 1>&6
+if test $ac_cv_type_socklen_t = yes; then
+  cat >> confdefs.h <<\EOF
+#define HAVE_SOCKLEN_T 1
+EOF
+
+fi
+
+echo $ac_n "checking for in_addr_t""... $ac_c" 1>&6
+echo "configure:11217: checking for in_addr_t" >&5
+if eval "test \"`echo '$''{'ac_cv_type_$1'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 11222 "configure"
+#include "confdefs.h"
+#include <sys/types.h>
+#if STDC_HEADERS
+#include <stdlib.h>
+#include <stddef.h>
+#endif
+#ifdef HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+EOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  egrep "in_addr_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then
+  rm -rf conftest*
+  ac_cv_type_in_addr_t=yes
+else
+  rm -rf conftest*
+  ac_cv_type_in_addr_t=no
+fi
+rm -f conftest*
+
+fi
+
+echo "$ac_t""$ac_cv_type_in_addr_t" 1>&6
+if test $ac_cv_type_in_addr_t = yes; then
+  cat >> confdefs.h <<\EOF
+#define HAVE_IN_ADDR_T 1
+EOF
+
+fi
+
+echo $ac_n "checking for correct flags to ps""... $ac_c" 1>&6
+echo "configure:11254: checking for correct flags to ps" >&5
+if eval "test \"`echo '$''{'ac_cv_ps_flags'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  if test "`($PSPROG -e 2>&1) | egrep ' (ps) *$' | awk '{print $NF}'`" = "ps" ; then
+  ac_cv_ps_flags="-e"
+elif test "`($PSPROG -el 2>&1) | egrep ' (ps) *$' | awk '{print $NF}'`" = "ps" ; then
+  ac_cv_ps_flags="-el"
+elif test "`($PSPROG acx 2>&1) | egrep ' (ps) *$' | awk '{print $NF}'`" = "ps" ; then
+  ac_cv_ps_flags="acx"
+elif test "`($PSPROG -acx 2>&1) | egrep ' (ps) *$' | awk '{print $NF}'`" = "ps" ; then
+  ac_cv_ps_flags="-acx"
+elif test "`($PSPROG -o pid,tt,state,time,ucomm 2>&1) | egrep ' ps *$' | awk '{print $NF}'`" = "ps" ; then
+  ac_cv_ps_flags="-o pid,tt,state,time,ucomm"
+elif test "`($PSPROG ax 2>&1) | egrep ' (ps) *$' | awk '{print $NF}'`" = "ps" ; then
+  ac_cv_ps_flags="ax"
+else
+  echo "configure: warning: Unable to determine valid ps flags...  defaulting..." 1>&2
+  ac_cv_ps_flags="-acx"
+fi
+
+fi
+
+echo "$ac_t""$ac_cv_ps_flags" 1>&6
+
+PSCMD="$PSPROG $ac_cv_ps_flags"
+
+cat >> confdefs.h <<EOF
+#define PSCMD "$PSPROG $ac_cv_ps_flags"
+EOF
+
+
+if test $cross_compiling = yes; then
+  if test $with_endianness = "big"; then
+    cat >> confdefs.h <<\EOF
+#define WORDS_BIGENDIAN 1
+EOF
+
+  elif test -z $with_endianness; then
+    { echo "configure: error: You are cross-compiling, but you have not specified the target's endianness" 1>&2; exit 1; }
+  fi
+else
+  if test $with_endianness; then
+    { echo "configure: error: Endianness has been specified, but you are not cross-compiling." 1>&2; exit 1; }
+  fi
+  echo $ac_n "checking whether byte ordering is bigendian""... $ac_c" 1>&6
+echo "configure:11300: checking whether byte ordering is bigendian" >&5
+if eval "test \"`echo '$''{'ac_cv_c_bigendian'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  ac_cv_c_bigendian=unknown
+# See if sys/param.h defines the BYTE_ORDER macro.
+cat > conftest.$ac_ext <<EOF
+#line 11307 "configure"
+#include "confdefs.h"
+#include <sys/types.h>
+#include <sys/param.h>
+int main() {
+
+#if !BYTE_ORDER || !BIG_ENDIAN || !LITTLE_ENDIAN
+ bogus endian macros
+#endif
+; return 0; }
+EOF
+if { (eval echo configure:11318: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  # It does; now see whether it defined to BIG_ENDIAN or not.
+cat > conftest.$ac_ext <<EOF
+#line 11322 "configure"
+#include "confdefs.h"
+#include <sys/types.h>
+#include <sys/param.h>
+int main() {
+
+#if BYTE_ORDER != BIG_ENDIAN
+ not big endian
+#endif
+; return 0; }
+EOF
+if { (eval echo configure:11333: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  ac_cv_c_bigendian=yes
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  ac_cv_c_bigendian=no
+fi
+rm -f conftest*
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+fi
+rm -f conftest*
+if test $ac_cv_c_bigendian = unknown; then
+if test "$cross_compiling" = yes; then
+    { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
+else
+  cat > conftest.$ac_ext <<EOF
+#line 11353 "configure"
+#include "confdefs.h"
+main () {
+  /* Are we little or big endian?  From Harbison&Steele.  */
+  union
+  {
+    long l;
+    char c[sizeof (long)];
+  } u;
+  u.l = 1;
+  exit (u.c[sizeof (long) - 1] == 1);
+}
+EOF
+if { (eval echo configure:11366: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+then
+  ac_cv_c_bigendian=no
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -fr conftest*
+  ac_cv_c_bigendian=yes
+fi
+rm -fr conftest*
+fi
+
+fi
+fi
+
+echo "$ac_t""$ac_cv_c_bigendian" 1>&6
+if test $ac_cv_c_bigendian = yes; then
+  cat >> confdefs.h <<\EOF
+#define WORDS_BIGENDIAN 1
+EOF
+
+fi
+
+fi
+
+# The Ultrix 4.2 mips builtin alloca declared by alloca.h only works
+# for constant arguments.  Useless!
+echo $ac_n "checking for working alloca.h""... $ac_c" 1>&6
+echo "configure:11394: checking for working alloca.h" >&5
+if eval "test \"`echo '$''{'ac_cv_header_alloca_h'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 11399 "configure"
+#include "confdefs.h"
+#include <alloca.h>
+int main() {
+char *p = alloca(2 * sizeof(int));
+; return 0; }
+EOF
+if { (eval echo configure:11406: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  ac_cv_header_alloca_h=yes
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  ac_cv_header_alloca_h=no
+fi
+rm -f conftest*
+fi
+
+echo "$ac_t""$ac_cv_header_alloca_h" 1>&6
+if test $ac_cv_header_alloca_h = yes; then
+  cat >> confdefs.h <<\EOF
+#define HAVE_ALLOCA_H 1
+EOF
+
+fi
+
+echo $ac_n "checking for alloca""... $ac_c" 1>&6
+echo "configure:11427: checking for alloca" >&5
+if eval "test \"`echo '$''{'ac_cv_func_alloca_works'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 11432 "configure"
+#include "confdefs.h"
+
+#ifdef __GNUC__
+# define alloca __builtin_alloca
+#else
+# ifdef _MSC_VER
+#  include <malloc.h>
+#  define alloca _alloca
+# else
+#  if HAVE_ALLOCA_H
+#   include <alloca.h>
+#  else
+#   ifdef _AIX
+ #pragma alloca
+#   else
+#    ifndef alloca /* predefined by HP cc +Olibcalls */
+char *alloca ();
+#    endif
+#   endif
+#  endif
+# endif
+#endif
+
+int main() {
+char *p = (char *) alloca(1);
+; return 0; }
+EOF
+if { (eval echo configure:11460: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  ac_cv_func_alloca_works=yes
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  ac_cv_func_alloca_works=no
+fi
+rm -f conftest*
+fi
+
+echo "$ac_t""$ac_cv_func_alloca_works" 1>&6
+if test $ac_cv_func_alloca_works = yes; then
+  cat >> confdefs.h <<\EOF
+#define HAVE_ALLOCA 1
+EOF
+
+fi
+
+if test $ac_cv_func_alloca_works = no; then
+  # The SVR3 libPW and SVR4 libucb both contain incompatible functions
+  # that cause trouble.  Some versions do not even contain alloca or
+  # contain a buggy version.  If you still want to use their alloca,
+  # use ar to extract alloca.o from them instead of compiling alloca.c.
+  ALLOCA=alloca.${ac_objext}
+  cat >> confdefs.h <<\EOF
+#define C_ALLOCA 1
+EOF
+
+
+echo $ac_n "checking whether alloca needs Cray hooks""... $ac_c" 1>&6
+echo "configure:11492: checking whether alloca needs Cray hooks" >&5
+if eval "test \"`echo '$''{'ac_cv_os_cray'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 11497 "configure"
+#include "confdefs.h"
+#if defined(CRAY) && ! defined(CRAY2)
+webecray
+#else
+wenotbecray
+#endif
+
+EOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  egrep "webecray" >/dev/null 2>&1; then
+  rm -rf conftest*
+  ac_cv_os_cray=yes
+else
+  rm -rf conftest*
+  ac_cv_os_cray=no
+fi
+rm -f conftest*
+
+fi
+
+echo "$ac_t""$ac_cv_os_cray" 1>&6
+if test $ac_cv_os_cray = yes; then
+for ac_func in _getb67 GETB67 getb67; do
+  echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:11522: checking for $ac_func" >&5
+if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 11527 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char $ac_func(); below.  */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char $ac_func();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+$ac_func();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:11550: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  cat >> confdefs.h <<EOF
+#define CRAY_STACKSEG_END $ac_func
+EOF
+
+  break
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+done
+fi
+
+echo $ac_n "checking stack direction for C alloca""... $ac_c" 1>&6
+echo "configure:11577: checking stack direction for C alloca" >&5
+if eval "test \"`echo '$''{'ac_cv_c_stack_direction'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  if test "$cross_compiling" = yes; then
+  ac_cv_c_stack_direction=0
+else
+  cat > conftest.$ac_ext <<EOF
+#line 11585 "configure"
+#include "confdefs.h"
+find_stack_direction ()
+{
+  static char *addr = 0;
+  auto char dummy;
+  if (addr == 0)
+    {
+      addr = &dummy;
+      return find_stack_direction ();
+    }
+  else
+    return (&dummy > addr) ? 1 : -1;
+}
+main ()
+{
+  exit (find_stack_direction() < 0);
+}
+EOF
+if { (eval echo configure:11604: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+then
+  ac_cv_c_stack_direction=1
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -fr conftest*
+  ac_cv_c_stack_direction=-1
+fi
+rm -fr conftest*
+fi
+
+fi
+
+echo "$ac_t""$ac_cv_c_stack_direction" 1>&6
+cat >> confdefs.h <<EOF
+#define STACK_DIRECTION $ac_cv_c_stack_direction
+EOF
+
+fi
+
+if test $ac_cv_prog_gcc = yes; then
+    echo $ac_n "checking whether ${CC-cc} needs -traditional""... $ac_c" 1>&6
+echo "configure:11627: checking whether ${CC-cc} needs -traditional" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_gcc_traditional'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+    ac_pattern="Autoconf.*'x'"
+  cat > conftest.$ac_ext <<EOF
+#line 11633 "configure"
+#include "confdefs.h"
+#include <sgtty.h>
+Autoconf TIOCGETP
+EOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  egrep "$ac_pattern" >/dev/null 2>&1; then
+  rm -rf conftest*
+  ac_cv_prog_gcc_traditional=yes
+else
+  rm -rf conftest*
+  ac_cv_prog_gcc_traditional=no
+fi
+rm -f conftest*
+
+
+  if test $ac_cv_prog_gcc_traditional = no; then
+    cat > conftest.$ac_ext <<EOF
+#line 11651 "configure"
+#include "confdefs.h"
+#include <termio.h>
+Autoconf TCGETA
+EOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  egrep "$ac_pattern" >/dev/null 2>&1; then
+  rm -rf conftest*
+  ac_cv_prog_gcc_traditional=yes
+fi
+rm -f conftest*
+
+  fi
+fi
+
+echo "$ac_t""$ac_cv_prog_gcc_traditional" 1>&6
+  if test $ac_cv_prog_gcc_traditional = yes; then
+    CC="$CC -traditional"
+  fi
+fi
+
+echo $ac_n "checking for 8-bit clean memcmp""... $ac_c" 1>&6
+echo "configure:11673: checking for 8-bit clean memcmp" >&5
+if eval "test \"`echo '$''{'ac_cv_func_memcmp_clean'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  if test "$cross_compiling" = yes; then
+  ac_cv_func_memcmp_clean=no
+else
+  cat > conftest.$ac_ext <<EOF
+#line 11681 "configure"
+#include "confdefs.h"
+
+main()
+{
+  char c0 = 0x40, c1 = 0x80, c2 = 0x81;
+  exit(memcmp(&c0, &c2, 1) < 0 && memcmp(&c1, &c2, 1) < 0 ? 0 : 1);
+}
+
+EOF
+if { (eval echo configure:11691: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+then
+  ac_cv_func_memcmp_clean=yes
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -fr conftest*
+  ac_cv_func_memcmp_clean=no
+fi
+rm -fr conftest*
+fi
+
+fi
+
+echo "$ac_t""$ac_cv_func_memcmp_clean" 1>&6
+test $ac_cv_func_memcmp_clean = no && LIBOBJS="$LIBOBJS memcmp.${ac_objext}"
+
+echo $ac_n "checking return type of signal handlers""... $ac_c" 1>&6
+echo "configure:11709: checking return type of signal handlers" >&5
+if eval "test \"`echo '$''{'ac_cv_type_signal'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 11714 "configure"
+#include "confdefs.h"
+#include <sys/types.h>
+#include <signal.h>
+#ifdef signal
+#undef signal
+#endif
+#ifdef __cplusplus
+extern "C" void (*signal (int, void (*)(int)))(int);
+#else
+void (*signal ()) ();
+#endif
+
+int main() {
+int i;
+; return 0; }
+EOF
+if { (eval echo configure:11731: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  ac_cv_type_signal=void
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  ac_cv_type_signal=int
+fi
+rm -f conftest*
+fi
+
+echo "$ac_t""$ac_cv_type_signal" 1>&6
+cat >> confdefs.h <<EOF
+#define RETSIGTYPE $ac_cv_type_signal
+EOF
+
+
+# getmntent is in -lsun on Irix 4, -lseq on Dynix/PTX, -lgen on Unixware.
+echo $ac_n "checking for getmntent in -lsun""... $ac_c" 1>&6
+echo "configure:11751: checking for getmntent in -lsun" >&5
+ac_lib_var=`echo sun'_'getmntent | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  ac_save_LIBS="$LIBS"
+LIBS="-lsun  $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 11759 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char getmntent();
+
+int main() {
+getmntent()
+; return 0; }
+EOF
+if { (eval echo configure:11770: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  LIBS="-lsun $LIBS"
+else
+  echo "$ac_t""no" 1>&6
+echo $ac_n "checking for getmntent in -lseq""... $ac_c" 1>&6
+echo "configure:11789: checking for getmntent in -lseq" >&5
+ac_lib_var=`echo seq'_'getmntent | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  ac_save_LIBS="$LIBS"
+LIBS="-lseq  $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 11797 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char getmntent();
+
+int main() {
+getmntent()
+; return 0; }
+EOF
+if { (eval echo configure:11808: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  LIBS="-lseq $LIBS"
+else
+  echo "$ac_t""no" 1>&6
+echo $ac_n "checking for getmntent in -lgen""... $ac_c" 1>&6
+echo "configure:11827: checking for getmntent in -lgen" >&5
+ac_lib_var=`echo gen'_'getmntent | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  ac_save_LIBS="$LIBS"
+LIBS="-lgen  $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 11835 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char getmntent();
+
+int main() {
+getmntent()
+; return 0; }
+EOF
+if { (eval echo configure:11846: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  LIBS="-lgen $LIBS"
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+fi
+
+fi
+
+echo $ac_n "checking for getmntent""... $ac_c" 1>&6
+echo "configure:11871: checking for getmntent" >&5
+if eval "test \"`echo '$''{'ac_cv_func_getmntent'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 11876 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char getmntent(); below.  */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char getmntent();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_getmntent) || defined (__stub___getmntent)
+choke me
+#else
+getmntent();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:11899: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_func_getmntent=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_func_getmntent=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'getmntent`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  cat >> confdefs.h <<\EOF
+#define HAVE_GETMNTENT 1
+EOF
+
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+for ac_func in setmntent gethostname uname gettimeofday select socket strtol strtoul strlcpy
+do
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:11924: checking for $ac_func" >&5
+if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 11929 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char $ac_func(); below.  */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char $ac_func();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+$ac_func();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:11952: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_func 1
+EOF
+ 
+else
+  echo "$ac_t""no" 1>&6
+fi
+done
+
+for ac_func in strchr strdup memcpy memmove index bcopy strcasestr regcomp
+do
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:11979: checking for $ac_func" >&5
+if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 11984 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char $ac_func(); below.  */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char $ac_func();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+$ac_func();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:12007: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_func 1
+EOF
+ 
+else
+  echo "$ac_t""no" 1>&6
+fi
+done
+
+for ac_func in signal setsid sigset sigblock sighold strerror setenv vsnprintf snprintf
+do
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:12034: checking for $ac_func" >&5
+if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 12039 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char $ac_func(); below.  */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char $ac_func();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+$ac_func();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:12062: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_func 1
+EOF
+ 
+else
+  echo "$ac_t""no" 1>&6
+fi
+done
+
+for ac_func in sigaction
+do
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:12089: checking for $ac_func" >&5
+if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 12094 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char $ac_func(); below.  */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char $ac_func();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+$ac_func();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:12117: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_func 1
+EOF
+ 
+else
+  echo "$ac_t""no" 1>&6
+fi
+done
+
+for ac_func in snprintf strtoul
+do
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:12144: checking for $ac_func" >&5
+if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 12149 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char $ac_func(); below.  */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char $ac_func();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+$ac_func();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:12172: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_func 1
+EOF
+ 
+else
+  echo "$ac_t""no" 1>&6
+fi
+done
+
+for ac_func in random lrand48 rand
+do
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:12199: checking for $ac_func" >&5
+if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 12204 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char $ac_func(); below.  */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char $ac_func();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+$ac_func();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:12227: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_func 1
+EOF
+ 
+else
+  echo "$ac_t""no" 1>&6
+fi
+done
+
+for ac_func in execv system fork getpid strncasecmp sigalrm
+do
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:12254: checking for $ac_func" >&5
+if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 12259 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char $ac_func(); below.  */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char $ac_func();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+$ac_func();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:12282: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_func 1
+EOF
+ 
+else
+  echo "$ac_t""no" 1>&6
+fi
+done
+
+if echo " $module_list " | grep " host/hr_swinst " > /dev/null; then
+  OLDLIBS=$LIBS
+  LIBS=$AGENTLIBS
+  for ac_func in rpmGetPath
+do
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:12312: checking for $ac_func" >&5
+if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 12317 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char $ac_func(); below.  */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char $ac_func();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+$ac_func();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:12340: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_func 1
+EOF
+ 
+else
+  echo "$ac_t""no" 1>&6
+fi
+done
+
+  LIBS=$OLDLIBS
+fi
+
+for ac_func in getloadavg
+do
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:12370: checking for $ac_func" >&5
+if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 12375 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char $ac_func(); below.  */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char $ac_func();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+$ac_func();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:12398: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_func 1
+EOF
+ 
+else
+  echo "$ac_t""no" 1>&6
+fi
+done
+
+for ac_func in getaddrinfo getipnodebyname
+do
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:12425: checking for $ac_func" >&5
+if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 12430 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char $ac_func(); below.  */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char $ac_func();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+$ac_func();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:12453: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_func 1
+EOF
+ 
+else
+  echo "$ac_t""no" 1>&6
+fi
+done
+
+for ac_func in statvfs statfs
+do
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:12480: checking for $ac_func" >&5
+if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 12485 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char $ac_func(); below.  */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char $ac_func();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+$ac_func();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:12508: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_func 1
+EOF
+ 
+else
+  echo "$ac_t""no" 1>&6
+fi
+done
+
+for ac_func in getdtablesize
+do
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:12535: checking for $ac_func" >&5
+if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 12540 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char $ac_func(); below.  */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char $ac_func();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+$ac_func();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:12563: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_func 1
+EOF
+ 
+else
+  echo "$ac_t""no" 1>&6
+fi
+done
+
+for ac_func in getfsstat
+do
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:12590: checking for $ac_func" >&5
+if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 12595 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char $ac_func(); below.  */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char $ac_func();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+$ac_func();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:12618: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_func 1
+EOF
+ 
+else
+  echo "$ac_t""no" 1>&6
+fi
+done
+
+for ac_func in usleep
+do
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:12645: checking for $ac_func" >&5
+if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 12650 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char $ac_func(); below.  */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char $ac_func();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+$ac_func();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:12673: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_func 1
+EOF
+ 
+else
+  echo "$ac_t""no" 1>&6
+fi
+done
+
+for ac_func in setlocale
+do
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:12700: checking for $ac_func" >&5
+if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 12705 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char $ac_func(); below.  */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char $ac_func();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+$ac_func();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:12728: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_func 1
+EOF
+ 
+else
+  echo "$ac_t""no" 1>&6
+fi
+done
+
+for ac_func in tcgetattr
+do
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:12755: checking for $ac_func" >&5
+if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 12760 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char $ac_func(); below.  */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char $ac_func();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+$ac_func();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:12783: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_func 1
+EOF
+ 
+else
+  echo "$ac_t""no" 1>&6
+fi
+done
+
+for ac_func in if_nameindex if_freenameindex
+do
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:12810: checking for $ac_func" >&5
+if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 12815 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char $ac_func(); below.  */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char $ac_func();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+$ac_func();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:12838: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_func 1
+EOF
+ 
+else
+  echo "$ac_t""no" 1>&6
+fi
+done
+
+for ac_func in getpagesize
+do
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:12865: checking for $ac_func" >&5
+if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 12870 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char $ac_func(); below.  */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char $ac_func();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+$ac_func();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:12893: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_func 1
+EOF
+ 
+else
+  echo "$ac_t""no" 1>&6
+fi
+done
+
+for ac_func in mkstemp
+do
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:12920: checking for $ac_func" >&5
+if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 12925 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char $ac_func(); below.  */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char $ac_func();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+$ac_func();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:12948: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_func 1
+EOF
+ 
+else
+  echo "$ac_t""no" 1>&6
+fi
+done
+
+for ac_func in getpwnam getgrnam setgid setuid setgroups
+do
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:12975: checking for $ac_func" >&5
+if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 12980 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char $ac_func(); below.  */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char $ac_func();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+$ac_func();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:13003: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_func 1
+EOF
+ 
+else
+  echo "$ac_t""no" 1>&6
+fi
+done
+
+for ac_func in setitimer
+do
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:13030: checking for $ac_func" >&5
+if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 13035 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char $ac_func(); below.  */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char $ac_func();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+$ac_func();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:13058: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_func 1
+EOF
+ 
+else
+  echo "$ac_t""no" 1>&6
+fi
+done
+
+
+echo $ac_n "checking for SIOCGIFADDR in sys/ioctl.h""... $ac_c" 1>&6
+echo "configure:13084: checking for SIOCGIFADDR in sys/ioctl.h" >&5
+if eval "test \"`echo '$''{'cv_sys_ioctl_h_has_SIOCGIFADDR'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+   cat > conftest.$ac_ext <<EOF
+#line 13089 "configure"
+#include "confdefs.h"
+
+#ifdef HAVE_SYS_IOCTL_H
+#include <sys/ioctl.h>
+#endif
+#ifdef SIOCGIFADDR
+xxxyesxxx
+#endif
+
+EOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  egrep "xxxyesxxx" >/dev/null 2>&1; then
+  rm -rf conftest*
+  cv_sys_ioctl_h_has_SIOCGIFADDR=yes
+else
+  rm -rf conftest*
+  cv_sys_ioctl_h_has_SIOCGIFADDR=no
+fi
+rm -f conftest*
+
+fi
+
+echo "$ac_t""$cv_sys_ioctl_h_has_SIOCGIFADDR" 1>&6
+if test $cv_sys_ioctl_h_has_SIOCGIFADDR = yes; then
+  cat >> confdefs.h <<\EOF
+#define SYS_IOCTL_H_HAS_SIOCGIFADDR 1
+EOF
+
+fi
+
+# ultrix
+echo $ac_n "checking for two-argument statfs with struct fs_data (Ultrix)""... $ac_c" 1>&6
+echo "configure:13122: checking for two-argument statfs with struct fs_data (Ultrix)" >&5
+if eval "test \"`echo '$''{'fu_cv_sys_stat_fs_data'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  if test "$cross_compiling" = yes; then
+  fu_cv_sys_stat_fs_data=no
+else
+  cat > conftest.$ac_ext <<EOF
+#line 13130 "configure"
+#include "confdefs.h"
+
+#ifdef HAVE_SYS_PARAM_H
+#include <sys/param.h>
+#endif
+#include <sys/types.h>
+#ifdef HAVE_SYS_MOUNT_H
+#include <sys/mount.h>
+#endif
+#ifdef HAVE_SYS_FS_TYPES_H
+#include <sys/fs_types.h>
+#endif
+main ()
+{
+struct fs_data fsd;
+/* Ultrix's statfs returns 1 for success,
+   0 for not mounted, -1 for failure.  */
+exit (statfs (".", &fsd) != 1);
+}
+EOF
+if { (eval echo configure:13151: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+then
+  fu_cv_sys_stat_fs_data=yes
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -fr conftest*
+  fu_cv_sys_stat_fs_data=no
+fi
+rm -fr conftest*
+fi
+
+fi
+
+echo "$ac_t""$fu_cv_sys_stat_fs_data" 1>&6
+if test $fu_cv_sys_stat_fs_data = yes; then
+  cat >> confdefs.h <<\EOF
+#define STAT_STATFS_FS_DATA 1
+EOF
+
+fi
+
+echo $ac_n "checking if __FUNCTION__ is defined""... $ac_c" 1>&6
+echo "configure:13174: checking if __FUNCTION__ is defined" >&5
+if eval "test \"`echo '$''{'ac_cv_HAVE_CPP_UNDERBAR_FUNCTION_DEFINED'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+cat > conftest.$ac_ext <<EOF
+#line 13180 "configure"
+#include "confdefs.h"
+
+int main() {
+
+    char *cp = __FUNCTION__;
+
+; return 0; }
+EOF
+if { (eval echo configure:13189: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  ac_cv_HAVE_CPP_UNDERBAR_FUNCTION_DEFINED=yes
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  ac_cv_HAVE_CPP_UNDERBAR_FUNCTION_DEFINED=no
+fi
+rm -f conftest*
+fi
+
+echo "$ac_t""$ac_cv_HAVE_CPP_UNDERBAR_FUNCTION_DEFINED" 1>&6
+
+if test "x$ac_cv_HAVE_CPP_UNDERBAR_FUNCTION_DEFINED" = "xyes"; then
+  cat >> confdefs.h <<\EOF
+#define HAVE_CPP_UNDERBAR_FUNCTION_DEFINED 1
+EOF
+
+fi
+
+
+
+ac_safe_struct=`echo "sigaction" | sed 'y%./+-%__p_%'`
+ac_safe_member=`echo "sa_sigaction" | 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 $ac_n "checking for sigaction.sa_sigaction""... $ac_c" 1>&6
+echo "configure:13218: checking for sigaction.sa_sigaction" >&5
+if eval "test \"`echo '$''{'$ac_safe_all'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+if test "xno" = "x"; then
+  defineit="= 0"
+elif test "xno" = "xno"; then
+  defineit=""
+else
+  defineit="no"
+fi
+cat > conftest.$ac_ext <<EOF
+#line 13231 "configure"
+#include "confdefs.h"
+
+
+#ifdef HAVE_SYS_PARAM_H
+#include <sys/param.h>
+#endif
+#include <sys/types.h>
+#include <sys/signal.h>
+
+
+int main() {
+
+struct sigaction testit; 
+testit.sa_sigaction $defineit;
+
+; return 0; }
+EOF
+if { (eval echo configure:13249: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  eval "${ac_safe_all}=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "${ac_safe_all}=no" 
+fi
+rm -f conftest*
+
+fi
+
+
+if eval "test \"x$`echo ${ac_safe_all}`\" = \"xyes\""; then
+  echo "$ac_t""yes" 1>&6
+  cat >> confdefs.h <<EOF
+#define $ac_uc_define 1
+EOF
+
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+
+
+
+
+ac_safe_struct=`echo "sockaddr" | sed 'y%./+-%__p_%'`
+ac_safe_member=`echo "sa_len" | 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 $ac_n "checking for sockaddr.sa_len""... $ac_c" 1>&6
+echo "configure:13283: checking for sockaddr.sa_len" >&5
+if eval "test \"`echo '$''{'$ac_safe_all'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+if test "xno" = "x"; then
+  defineit="= 0"
+elif test "xno" = "xno"; then
+  defineit=""
+else
+  defineit="no"
+fi
+cat > conftest.$ac_ext <<EOF
+#line 13296 "configure"
+#include "confdefs.h"
+
+
+#ifdef HAVE_SYS_PARAM_H
+#include <sys/param.h>
+#endif
+#include <sys/types.h>
+#define KERNEL
+#define _KERNEL
+#include <sys/socket.h>
+#undef KERNEL
+#undef _KERNEL
+
+
+int main() {
+
+struct sockaddr testit; 
+testit.sa_len $defineit;
+
+; return 0; }
+EOF
+if { (eval echo configure:13318: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  eval "${ac_safe_all}=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "${ac_safe_all}=no" 
+fi
+rm -f conftest*
+
+fi
+
+
+if eval "test \"x$`echo ${ac_safe_all}`\" = \"xyes\""; then
+  echo "$ac_t""yes" 1>&6
+  cat >> confdefs.h <<EOF
+#define $ac_uc_define 1
+EOF
+
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+
+
+
+
+ac_safe_struct=`echo "sockaddr" | sed 'y%./+-%__p_%'`
+ac_safe_member=`echo "sa_union.sa_generic.sa_family2" | 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 $ac_n "checking for sockaddr.sa_union.sa_generic.sa_family2""... $ac_c" 1>&6
+echo "configure:13352: checking for sockaddr.sa_union.sa_generic.sa_family2" >&5
+if eval "test \"`echo '$''{'$ac_safe_all'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+if test "xno" = "x"; then
+  defineit="= 0"
+elif test "xno" = "xno"; then
+  defineit=""
+else
+  defineit="no"
+fi
+cat > conftest.$ac_ext <<EOF
+#line 13365 "configure"
+#include "confdefs.h"
+
+
+#ifdef HAVE_SYS_PARAM_H
+#include <sys/param.h>
+#endif
+#include <sys/types.h>
+#define KERNEL
+#define _KERNEL
+#include <sys/socket.h>
+#undef KERNEL
+#undef _KERNEL
+
+
+int main() {
+
+struct sockaddr testit; 
+testit.sa_union.sa_generic.sa_family2 $defineit;
+
+; return 0; }
+EOF
+if { (eval echo configure:13387: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  eval "${ac_safe_all}=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "${ac_safe_all}=no" 
+fi
+rm -f conftest*
+
+fi
+
+
+if eval "test \"x$`echo ${ac_safe_all}`\" = \"xyes\""; then
+  echo "$ac_t""yes" 1>&6
+  cat >> confdefs.h <<EOF
+#define $ac_uc_define 1
+EOF
+
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+
+
+
+
+ac_safe_struct=`echo "rtentry" | sed 'y%./+-%__p_%'`
+ac_safe_member=`echo "rt_dst" | 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 $ac_n "checking for rtentry.rt_dst""... $ac_c" 1>&6
+echo "configure:13421: checking for rtentry.rt_dst" >&5
+if eval "test \"`echo '$''{'$ac_safe_all'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+if test "xno" = "x"; then
+  defineit="= 0"
+elif test "xno" = "xno"; then
+  defineit=""
+else
+  defineit="no"
+fi
+cat > conftest.$ac_ext <<EOF
+#line 13434 "configure"
+#include "confdefs.h"
+
+
+#ifdef HAVE_SYS_PARAM_H
+#include <sys/param.h>
+#endif
+#include <sys/types.h>
+#define KERNEL
+#define _KERNEL
+#include <sys/socket.h>
+#undef KERNEL
+#undef _KERNEL
+#include <net/route.h>
+
+
+int main() {
+
+struct rtentry testit; 
+testit.rt_dst $defineit;
+
+; return 0; }
+EOF
+if { (eval echo configure:13457: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  eval "${ac_safe_all}=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "${ac_safe_all}=no" 
+fi
+rm -f conftest*
+
+fi
+
+
+if eval "test \"x$`echo ${ac_safe_all}`\" = \"xyes\""; then
+  echo "$ac_t""yes" 1>&6
+  cat >> confdefs.h <<EOF
+#define $ac_uc_define 1
+EOF
+
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+
+
+echo $ac_n "checking type of rtentry structure""... $ac_c" 1>&6
+echo "configure:13484: checking type of rtentry structure" >&5
+if eval "test \"`echo '$''{'ac_cv_RTENTRY_TYPE'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+
+cat > conftest.$ac_ext <<EOF
+#line 13491 "configure"
+#include "confdefs.h"
+
+#ifdef HAVE_SYS_PARAM_H
+#include <sys/param.h>
+#endif
+#include <sys/types.h>
+#define KERNEL
+#define _KERNEL
+#include <sys/socket.h>
+#undef KERNEL
+#undef _KERNEL
+#include <net/route.h>
+
+int main() {
+
+
+#ifndef STRUCT_RTENTRY_HAS_RT_DST
+#define rt_dst rt_nodes->rn_key
+#endif
+
+  struct rtentry rt; 
+  rt.rt_nodes[0].rn_flags = 1;
+  rt.rt_dst;
+  
+; return 0; }
+EOF
+if { (eval echo configure:13518: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  ac_cv_RTENTRY_TYPE="BSD-4.4"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+fi
+rm -f conftest*
+
+if test "x$ac_cv_RTENTRY_TYPE" = "x"; then
+cat > conftest.$ac_ext <<EOF
+#line 13529 "configure"
+#include "confdefs.h"
+
+#ifdef HAVE_SYS_PARAM_H
+#include <sys/param.h>
+#endif
+#include <sys/types.h>
+#define KERNEL
+#define _KERNEL
+#include <sys/socket.h>
+#undef KERNEL
+#undef _KERNEL
+#include <net/route.h>
+
+int main() {
+
+struct rtentry rt; 
+rt.rt_hash;
+
+; return 0; }
+EOF
+if { (eval echo configure:13550: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  ac_cv_RTENTRY_TYPE="BSD-4.3"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+fi
+rm -f conftest*
+fi
+
+if test "x$ac_cv_RTENTRY_TYPE" = "x"; then
+  echo "$ac_t""Unknown" 1>&6
+  ac_cv_RTENTRY_TYPE="unknown"
+fi
+
+
+fi
+
+echo "$ac_t""$ac_cv_RTENTRY_TYPE" 1>&6
+
+if test "x$ac_cv_RTENTRY_TYPE" = "xBSD-4.4"; then
+  cat >> confdefs.h <<\EOF
+#define RTENTRY_4_4 1
+EOF
+
+fi
+
+if test "x$ac_cv_RTENTRY_TYPE" = "xunknown"; then
+echo $ac_n "checking for struct rtentry""... $ac_c" 1>&6
+echo "configure:13579: checking for struct rtentry" >&5
+if eval "test \"`echo '$''{'ac_cv_struct_rtentry'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 13584 "configure"
+#include "confdefs.h"
+#define KERNEL
+#include <net/route.h>
+
+EOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  egrep "ortentry" >/dev/null 2>&1; then
+  rm -rf conftest*
+  ac_cv_struct_rtentry=ortentry
+else
+  rm -rf conftest*
+  ac_cv_struct_rtentry=rtentry 
+fi
+rm -f conftest*
+
+if test "x$ac_cv_struct_rtentry" = "xrtentry" ; then
+  ac_cv_struct_rtentry="rtentry"
+else
+  ac_cv_struct_rtentry="ortentry"
+fi
+
+fi
+
+echo "$ac_t""$ac_cv_struct_rtentry" 1>&6
+else
+  RTENTRY_TYPE="rtentry"
+  ac_cv_struct_rtentry="rtentry"
+fi
+
+if test "x$ac_cv_struct_rtentry" != "x"; then
+  cat >> confdefs.h <<EOF
+#define RTENTRY struct ${ac_cv_struct_rtentry}
+EOF
+
+else
+  cat >> confdefs.h <<\EOF
+#define RTENTRY struct rtentry
+EOF
+
+fi
+
+if test "x$ac_cv_RTENTRY_TYPE" = "xBSD-4.3"; then
+echo $ac_n "checking for struct rtentry has a rt_next node""... $ac_c" 1>&6
+echo "configure:13628: checking for struct rtentry has a rt_next node" >&5
+if eval "test \"`echo '$''{'ac_cv_struct_rtentry_rt_next'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+cat > conftest.$ac_ext <<EOF
+#line 13634 "configure"
+#include "confdefs.h"
+
+#ifdef HAVE_SYS_PARAM_H
+#include <sys/param.h>
+#endif
+#include <sys/types.h>
+#define KERNEL
+#define _KERNEL
+#include <sys/socket.h>
+#undef KERNEL
+#undef _KERNEL
+#include <net/route.h>
+
+int main() {
+
+struct rtentry rt; 
+rt.rt_next;
+
+; return 0; }
+EOF
+if { (eval echo configure:13655: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  ac_cv_struct_rtentry_rt_next=yes
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  ac_cv_struct_rtentry_rt_next=no 
+fi
+rm -f conftest*
+
+fi
+
+echo "$ac_t""$ac_cv_struct_rtentry_rt_next" 1>&6
+
+if test "x$ac_cv_struct_rtentry_rt_next" = "xyes"; then
+  cat >> confdefs.h <<\EOF
+#define RTENTRY_RT_NEXT 1
+EOF
+
+fi
+
+fi
+
+
+
+ac_safe_struct=`echo "rtentry" | sed 'y%./+-%__p_%'`
+ac_safe_member=`echo "rt_unit" | 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 $ac_n "checking for rtentry.rt_unit""... $ac_c" 1>&6
+echo "configure:13687: checking for rtentry.rt_unit" >&5
+if eval "test \"`echo '$''{'$ac_safe_all'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+if test "x" = "x"; then
+  defineit="= 0"
+elif test "x" = "xno"; then
+  defineit=""
+else
+  defineit=""
+fi
+cat > conftest.$ac_ext <<EOF
+#line 13700 "configure"
+#include "confdefs.h"
+
+
+#ifdef HAVE_SYS_PARAM_H
+#include <sys/param.h>
+#endif
+#include <sys/types.h>
+#define KERNEL
+#define _KERNEL
+#include <sys/socket.h>
+#undef KERNEL
+#undef _KERNEL
+#include <net/route.h>
+
+
+int main() {
+
+struct rtentry testit; 
+testit.rt_unit $defineit;
+
+; return 0; }
+EOF
+if { (eval echo configure:13723: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  eval "${ac_safe_all}=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "${ac_safe_all}=no" 
+fi
+rm -f conftest*
+
+fi
+
+
+if eval "test \"x$`echo ${ac_safe_all}`\" = \"xyes\""; then
+  echo "$ac_t""yes" 1>&6
+  cat >> confdefs.h <<EOF
+#define $ac_uc_define 1
+EOF
+
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+
+
+
+
+ac_safe_struct=`echo "rtentry" | sed 'y%./+-%__p_%'`
+ac_safe_member=`echo "rt_refcnt" | 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 $ac_n "checking for rtentry.rt_refcnt""... $ac_c" 1>&6
+echo "configure:13757: checking for rtentry.rt_refcnt" >&5
+if eval "test \"`echo '$''{'$ac_safe_all'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+if test "x" = "x"; then
+  defineit="= 0"
+elif test "x" = "xno"; then
+  defineit=""
+else
+  defineit=""
+fi
+cat > conftest.$ac_ext <<EOF
+#line 13770 "configure"
+#include "confdefs.h"
+
+
+#ifdef HAVE_SYS_PARAM_H
+#include <sys/param.h>
+#endif
+#include <sys/types.h>
+#define KERNEL
+#define _KERNEL
+#include <sys/socket.h>
+#undef KERNEL
+#undef _KERNEL
+#include <net/route.h>
+
+
+int main() {
+
+struct rtentry testit; 
+testit.rt_refcnt $defineit;
+
+; return 0; }
+EOF
+if { (eval echo configure:13793: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  eval "${ac_safe_all}=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "${ac_safe_all}=no" 
+fi
+rm -f conftest*
+
+fi
+
+
+if eval "test \"x$`echo ${ac_safe_all}`\" = \"xyes\""; then
+  echo "$ac_t""yes" 1>&6
+  cat >> confdefs.h <<EOF
+#define $ac_uc_define 1
+EOF
+
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+
+
+
+
+ac_safe_struct=`echo "rtentry" | sed 'y%./+-%__p_%'`
+ac_safe_member=`echo "rt_hash" | 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 $ac_n "checking for rtentry.rt_hash""... $ac_c" 1>&6
+echo "configure:13827: checking for rtentry.rt_hash" >&5
+if eval "test \"`echo '$''{'$ac_safe_all'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+if test "x" = "x"; then
+  defineit="= 0"
+elif test "x" = "xno"; then
+  defineit=""
+else
+  defineit=""
+fi
+cat > conftest.$ac_ext <<EOF
+#line 13840 "configure"
+#include "confdefs.h"
+
+
+#ifdef HAVE_SYS_PARAM_H
+#include <sys/param.h>
+#endif
+#include <sys/types.h>
+#define KERNEL
+#define _KERNEL
+#include <sys/socket.h>
+#undef KERNEL
+#undef _KERNEL
+#include <net/route.h>
+
+
+int main() {
+
+struct rtentry testit; 
+testit.rt_hash $defineit;
+
+; return 0; }
+EOF
+if { (eval echo configure:13863: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  eval "${ac_safe_all}=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "${ac_safe_all}=no" 
+fi
+rm -f conftest*
+
+fi
+
+
+if eval "test \"x$`echo ${ac_safe_all}`\" = \"xyes\""; then
+  echo "$ac_t""yes" 1>&6
+  cat >> confdefs.h <<EOF
+#define $ac_uc_define 1
+EOF
+
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+
+
+
+
+ac_safe_struct=`echo "rtentry" | sed 'y%./+-%__p_%'`
+ac_safe_member=`echo "rt_use" | 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 $ac_n "checking for rtentry.rt_use""... $ac_c" 1>&6
+echo "configure:13897: checking for rtentry.rt_use" >&5
+if eval "test \"`echo '$''{'$ac_safe_all'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+if test "x" = "x"; then
+  defineit="= 0"
+elif test "x" = "xno"; then
+  defineit=""
+else
+  defineit=""
+fi
+cat > conftest.$ac_ext <<EOF
+#line 13910 "configure"
+#include "confdefs.h"
+
+
+#ifdef HAVE_SYS_PARAM_H
+#include <sys/param.h>
+#endif
+#include <sys/types.h>
+#define KERNEL
+#define _KERNEL
+#include <sys/socket.h>
+#undef KERNEL
+#undef _KERNEL
+#include <net/route.h>
+
+
+int main() {
+
+struct rtentry testit; 
+testit.rt_use $defineit;
+
+; return 0; }
+EOF
+if { (eval echo configure:13933: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  eval "${ac_safe_all}=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "${ac_safe_all}=no" 
+fi
+rm -f conftest*
+
+fi
+
+
+if eval "test \"x$`echo ${ac_safe_all}`\" = \"xyes\""; then
+  echo "$ac_t""yes" 1>&6
+  cat >> confdefs.h <<EOF
+#define $ac_uc_define 1
+EOF
+
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+
+
+
+
+ac_safe_struct=`echo "tcpstat" | sed 'y%./+-%__p_%'`
+ac_safe_member=`echo "tcp_rcvmemdrop" | 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 $ac_n "checking for tcpstat.tcp_rcvmemdrop""... $ac_c" 1>&6
+echo "configure:13967: checking for tcpstat.tcp_rcvmemdrop" >&5
+if eval "test \"`echo '$''{'$ac_safe_all'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+if test "x" = "x"; then
+  defineit="= 0"
+elif test "x" = "xno"; then
+  defineit=""
+else
+  defineit=""
+fi
+cat > conftest.$ac_ext <<EOF
+#line 13980 "configure"
+#include "confdefs.h"
+
+
+#ifdef HAVE_SYS_PARAM_H
+#include <sys/param.h>
+#endif
+#include <sys/types.h>
+#include <netinet/tcp.h>
+#ifdef HAVE_NETINET_TCP_TIMER_H
+#include <netinet/tcp_timer.h>
+#endif
+
+#ifdef HAVE_NETINET_TCP_VAR_H
+#include <netinet/tcp_var.h>
+#endif
+
+
+int main() {
+
+struct tcpstat testit; 
+testit.tcp_rcvmemdrop $defineit;
+
+; return 0; }
+EOF
+if { (eval echo configure:14005: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  eval "${ac_safe_all}=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "${ac_safe_all}=no" 
+fi
+rm -f conftest*
+
+fi
+
+
+if eval "test \"x$`echo ${ac_safe_all}`\" = \"xyes\""; then
+  echo "$ac_t""yes" 1>&6
+  cat >> confdefs.h <<EOF
+#define $ac_uc_define 1
+EOF
+
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+
+
+
+
+
+ac_safe_struct=`echo "ifnet" | sed 'y%./+-%__p_%'`
+ac_safe_member=`echo "if_mtu" | 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 $ac_n "checking for ifnet.if_mtu""... $ac_c" 1>&6
+echo "configure:14040: checking for ifnet.if_mtu" >&5
+if eval "test \"`echo '$''{'$ac_safe_all'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+if test "x" = "x"; then
+  defineit="= 0"
+elif test "x" = "xno"; then
+  defineit=""
+else
+  defineit=""
+fi
+cat > conftest.$ac_ext <<EOF
+#line 14053 "configure"
+#include "confdefs.h"
+
+
+#ifdef HAVE_SYS_PARAM_H
+#include <sys/param.h>
+#endif
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <net/if.h>
+#ifdef HAVE_NET_IF_VAR_H
+#include <net/if_var.h>
+#endif
+
+
+int main() {
+
+struct ifnet testit; 
+testit.if_mtu $defineit;
+
+; return 0; }
+EOF
+if { (eval echo configure:14075: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  eval "${ac_safe_all}=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "${ac_safe_all}=no" 
+fi
+rm -f conftest*
+
+fi
+
+
+if eval "test \"x$`echo ${ac_safe_all}`\" = \"xyes\""; then
+  echo "$ac_t""yes" 1>&6
+  cat >> confdefs.h <<EOF
+#define $ac_uc_define 1
+EOF
+
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+
+
+if test "x$ac_cv_struct_ifnet_has_if_mtu" = "xno"; then
+echo $ac_n "checking if _KERNEL needs to be defined for if_mtu""... $ac_c" 1>&6
+echo "configure:14103: checking if _KERNEL needs to be defined for if_mtu" >&5
+if eval "test \"`echo '$''{'ac_cv_IFNET_NEEDS_KERNEL'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+if test "x$ac_cv_struct_ifnet_has_if_mtu" = "xyes"; then
+  ac_cv_IFNET_NEEDS_KERNEL=no
+else
+cat > conftest.$ac_ext <<EOF
+#line 14112 "configure"
+#include "confdefs.h"
+
+#define _KERNEL 1
+#ifdef HAVE_SYS_PARAM_H
+#include <sys/param.h>
+#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
+
+int main() {
+
+struct ifnet testit;
+testit.if_mtu = 0;
+
+; return 0; }
+EOF
+if { (eval echo configure:14136: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  ac_cv_IFNET_NEEDS_KERNEL=yes
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  ac_cv_IFNET_NEEDS_KERNEL=no
+fi
+rm -f conftest*
+fi
+
+fi
+
+echo "$ac_t""$ac_cv_IFNET_NEEDS_KERNEL" 1>&6
+
+if test "x$ac_cv_IFNET_NEEDS_KERNEL" = "xyes"; then
+  cat >> confdefs.h <<\EOF
+#define IFNET_NEEDS_KERNEL 1
+EOF
+
+fi
+fi
+
+
+
+ac_safe_struct=`echo "ifaddr" | sed 'y%./+-%__p_%'`
+ac_safe_member=`echo "ifa_next" | 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 $ac_n "checking for ifaddr.ifa_next""... $ac_c" 1>&6
+echo "configure:14168: checking for ifaddr.ifa_next" >&5
+if eval "test \"`echo '$''{'$ac_safe_all'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+if test "x" = "x"; then
+  defineit="= 0"
+elif test "x" = "xno"; then
+  defineit=""
+else
+  defineit=""
+fi
+cat > conftest.$ac_ext <<EOF
+#line 14181 "configure"
+#include "confdefs.h"
+
+
+#ifdef IFNET_NEEDS_KERNEL
+#define _KERNEL 1
+#endif
+#ifdef HAVE_SYS_PARAM_H
+#include <sys/param.h>
+#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
+
+
+int main() {
+
+struct ifaddr testit; 
+testit.ifa_next $defineit;
+
+; return 0; }
+EOF
+if { (eval echo configure:14209: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  eval "${ac_safe_all}=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "${ac_safe_all}=no" 
+fi
+rm -f conftest*
+
+fi
+
+
+if eval "test \"x$`echo ${ac_safe_all}`\" = \"xyes\""; then
+  echo "$ac_t""yes" 1>&6
+  cat >> confdefs.h <<EOF
+#define $ac_uc_define 1
+EOF
+
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+
+
+
+
+
+ac_safe_struct=`echo "ifnet" | sed 'y%./+-%__p_%'`
+ac_safe_member=`echo "if_baudrate" | 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 $ac_n "checking for ifnet.if_baudrate""... $ac_c" 1>&6
+echo "configure:14244: checking for ifnet.if_baudrate" >&5
+if eval "test \"`echo '$''{'$ac_safe_all'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+if test "x" = "x"; then
+  defineit="= 0"
+elif test "x" = "xno"; then
+  defineit=""
+else
+  defineit=""
+fi
+cat > conftest.$ac_ext <<EOF
+#line 14257 "configure"
+#include "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_baudrate $defineit;
+
+; return 0; }
+EOF
+if { (eval echo configure:14317: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  eval "${ac_safe_all}=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "${ac_safe_all}=no" 
+fi
+rm -f conftest*
+
+fi
+
+
+if eval "test \"x$`echo ${ac_safe_all}`\" = \"xyes\""; then
+  echo "$ac_t""yes" 1>&6
+  cat >> confdefs.h <<EOF
+#define $ac_uc_define 1
+EOF
+
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+
+
+
+
+
+ac_safe_struct=`echo "ifnet" | sed 'y%./+-%__p_%'`
+ac_safe_member=`echo "if_baudrate.ifs_value" | 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 $ac_n "checking for ifnet.if_baudrate.ifs_value""... $ac_c" 1>&6
+echo "configure:14352: checking for ifnet.if_baudrate.ifs_value" >&5
+if eval "test \"`echo '$''{'$ac_safe_all'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+if test "x" = "x"; then
+  defineit="= 0"
+elif test "x" = "xno"; then
+  defineit=""
+else
+  defineit=""
+fi
+cat > conftest.$ac_ext <<EOF
+#line 14365 "configure"
+#include "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_baudrate.ifs_value $defineit;
+
+; return 0; }
+EOF
+if { (eval echo configure:14425: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  eval "${ac_safe_all}=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "${ac_safe_all}=no" 
+fi
+rm -f conftest*
+
+fi
+
+
+if eval "test \"x$`echo ${ac_safe_all}`\" = \"xyes\""; then
+  echo "$ac_t""yes" 1>&6
+  cat >> confdefs.h <<EOF
+#define $ac_uc_define 1
+EOF
+
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+
+
+
+
+
+ac_safe_struct=`echo "ifnet" | sed 'y%./+-%__p_%'`
+ac_safe_member=`echo "if_speed" | 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 $ac_n "checking for ifnet.if_speed""... $ac_c" 1>&6
+echo "configure:14460: checking for ifnet.if_speed" >&5
+if eval "test \"`echo '$''{'$ac_safe_all'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+if test "x" = "x"; then
+  defineit="= 0"
+elif test "x" = "xno"; then
+  defineit=""
+else
+  defineit=""
+fi
+cat > conftest.$ac_ext <<EOF
+#line 14473 "configure"
+#include "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_speed $defineit;
+
+; return 0; }
+EOF
+if { (eval echo configure:14533: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  eval "${ac_safe_all}=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "${ac_safe_all}=no" 
+fi
+rm -f conftest*
+
+fi
+
+
+if eval "test \"x$`echo ${ac_safe_all}`\" = \"xyes\""; then
+  echo "$ac_t""yes" 1>&6
+  cat >> confdefs.h <<EOF
+#define $ac_uc_define 1
+EOF
+
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+
+
+
+
+
+ac_safe_struct=`echo "ifnet" | sed 'y%./+-%__p_%'`
+ac_safe_member=`echo "if_type" | 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 $ac_n "checking for ifnet.if_type""... $ac_c" 1>&6
+echo "configure:14568: checking for ifnet.if_type" >&5
+if eval "test \"`echo '$''{'$ac_safe_all'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+if test "x" = "x"; then
+  defineit="= 0"
+elif test "x" = "xno"; then
+  defineit=""
+else
+  defineit=""
+fi
+cat > conftest.$ac_ext <<EOF
+#line 14581 "configure"
+#include "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_type $defineit;
+
+; return 0; }
+EOF
+if { (eval echo configure:14641: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  eval "${ac_safe_all}=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "${ac_safe_all}=no" 
+fi
+rm -f conftest*
+
+fi
+
+
+if eval "test \"x$`echo ${ac_safe_all}`\" = \"xyes\""; then
+  echo "$ac_t""yes" 1>&6
+  cat >> confdefs.h <<EOF
+#define $ac_uc_define 1
+EOF
+
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+
+
+
+
+
+ac_safe_struct=`echo "ifnet" | sed 'y%./+-%__p_%'`
+ac_safe_member=`echo "if_imcasts" | 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 $ac_n "checking for ifnet.if_imcasts""... $ac_c" 1>&6
+echo "configure:14676: checking for ifnet.if_imcasts" >&5
+if eval "test \"`echo '$''{'$ac_safe_all'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+if test "x" = "x"; then
+  defineit="= 0"
+elif test "x" = "xno"; then
+  defineit=""
+else
+  defineit=""
+fi
+cat > conftest.$ac_ext <<EOF
+#line 14689 "configure"
+#include "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_imcasts $defineit;
+
+; return 0; }
+EOF
+if { (eval echo configure:14749: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  eval "${ac_safe_all}=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "${ac_safe_all}=no" 
+fi
+rm -f conftest*
+
+fi
+
+
+if eval "test \"x$`echo ${ac_safe_all}`\" = \"xyes\""; then
+  echo "$ac_t""yes" 1>&6
+  cat >> confdefs.h <<EOF
+#define $ac_uc_define 1
+EOF
+
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+
+
+
+
+
+ac_safe_struct=`echo "ifnet" | sed 'y%./+-%__p_%'`
+ac_safe_member=`echo "if_iqdrops" | 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 $ac_n "checking for ifnet.if_iqdrops""... $ac_c" 1>&6
+echo "configure:14784: checking for ifnet.if_iqdrops" >&5
+if eval "test \"`echo '$''{'$ac_safe_all'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+if test "x" = "x"; then
+  defineit="= 0"
+elif test "x" = "xno"; then
+  defineit=""
+else
+  defineit=""
+fi
+cat > conftest.$ac_ext <<EOF
+#line 14797 "configure"
+#include "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_iqdrops $defineit;
+
+; return 0; }
+EOF
+if { (eval echo configure:14857: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  eval "${ac_safe_all}=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "${ac_safe_all}=no" 
+fi
+rm -f conftest*
+
+fi
+
+
+if eval "test \"x$`echo ${ac_safe_all}`\" = \"xyes\""; then
+  echo "$ac_t""yes" 1>&6
+  cat >> confdefs.h <<EOF
+#define $ac_uc_define 1
+EOF
+
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+
+
+
+
+
+ac_safe_struct=`echo "ifnet" | sed 'y%./+-%__p_%'`
+ac_safe_member=`echo "if_noproto" | 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 $ac_n "checking for ifnet.if_noproto""... $ac_c" 1>&6
+echo "configure:14892: checking for ifnet.if_noproto" >&5
+if eval "test \"`echo '$''{'$ac_safe_all'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+if test "x" = "x"; then
+  defineit="= 0"
+elif test "x" = "xno"; then
+  defineit=""
+else
+  defineit=""
+fi
+cat > conftest.$ac_ext <<EOF
+#line 14905 "configure"
+#include "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_noproto $defineit;
+
+; return 0; }
+EOF
+if { (eval echo configure:14965: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  eval "${ac_safe_all}=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "${ac_safe_all}=no" 
+fi
+rm -f conftest*
+
+fi
+
+
+if eval "test \"x$`echo ${ac_safe_all}`\" = \"xyes\""; then
+  echo "$ac_t""yes" 1>&6
+  cat >> confdefs.h <<EOF
+#define $ac_uc_define 1
+EOF
+
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+
+
+
+
+
+ac_safe_struct=`echo "ifnet" | sed 'y%./+-%__p_%'`
+ac_safe_member=`echo "if_omcasts" | 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 $ac_n "checking for ifnet.if_omcasts""... $ac_c" 1>&6
+echo "configure:15000: checking for ifnet.if_omcasts" >&5
+if eval "test \"`echo '$''{'$ac_safe_all'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+if test "x" = "x"; then
+  defineit="= 0"
+elif test "x" = "xno"; then
+  defineit=""
+else
+  defineit=""
+fi
+cat > conftest.$ac_ext <<EOF
+#line 15013 "configure"
+#include "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_omcasts $defineit;
+
+; return 0; }
+EOF
+if { (eval echo configure:15073: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  eval "${ac_safe_all}=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "${ac_safe_all}=no" 
+fi
+rm -f conftest*
+
+fi
+
+
+if eval "test \"x$`echo ${ac_safe_all}`\" = \"xyes\""; then
+  echo "$ac_t""yes" 1>&6
+  cat >> confdefs.h <<EOF
+#define $ac_uc_define 1
+EOF
+
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+
+
+
+
+
+ac_safe_struct=`echo "ifnet" | sed 'y%./+-%__p_%'`
+ac_safe_member=`echo "if_xname" | 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 $ac_n "checking for ifnet.if_xname""... $ac_c" 1>&6
+echo "configure:15108: checking for ifnet.if_xname" >&5
+if eval "test \"`echo '$''{'$ac_safe_all'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+if test "xno" = "x"; then
+  defineit="= 0"
+elif test "xno" = "xno"; then
+  defineit=""
+else
+  defineit="no"
+fi
+cat > conftest.$ac_ext <<EOF
+#line 15121 "configure"
+#include "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_xname $defineit;
+
+; return 0; }
+EOF
+if { (eval echo configure:15181: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  eval "${ac_safe_all}=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "${ac_safe_all}=no" 
+fi
+rm -f conftest*
+
+fi
+
+
+if eval "test \"x$`echo ${ac_safe_all}`\" = \"xyes\""; then
+  echo "$ac_t""yes" 1>&6
+  cat >> confdefs.h <<EOF
+#define $ac_uc_define 1
+EOF
+
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+
+
+
+
+
+ac_safe_struct=`echo "ifnet" | sed 'y%./+-%__p_%'`
+ac_safe_member=`echo "if_lastchange.tv_sec" | 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 $ac_n "checking for ifnet.if_lastchange.tv_sec""... $ac_c" 1>&6
+echo "configure:15216: checking for ifnet.if_lastchange.tv_sec" >&5
+if eval "test \"`echo '$''{'$ac_safe_all'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+if test "x" = "x"; then
+  defineit="= 0"
+elif test "x" = "xno"; then
+  defineit=""
+else
+  defineit=""
+fi
+cat > conftest.$ac_ext <<EOF
+#line 15229 "configure"
+#include "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_sec $defineit;
+
+; return 0; }
+EOF
+if { (eval echo configure:15289: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  eval "${ac_safe_all}=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "${ac_safe_all}=no" 
+fi
+rm -f conftest*
+
+fi
+
+
+if eval "test \"x$`echo ${ac_safe_all}`\" = \"xyes\""; then
+  echo "$ac_t""yes" 1>&6
+  cat >> confdefs.h <<EOF
+#define $ac_uc_define 1
+EOF
+
+else
+  echo "$ac_t""no" 1>&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___%'`
+
+echo $ac_n "checking for ifnet.if_obytes""... $ac_c" 1>&6
+echo "configure:15324: checking for ifnet.if_obytes" >&5
+if eval "test \"`echo '$''{'$ac_safe_all'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+if test "x" = "x"; then
+  defineit="= 0"
+elif test "x" = "xno"; then
+  defineit=""
+else
+  defineit=""
+fi
+cat > conftest.$ac_ext <<EOF
+#line 15337 "configure"
+#include "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_obytes $defineit;
+
+; return 0; }
+EOF
+if { (eval echo configure:15397: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  eval "${ac_safe_all}=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "${ac_safe_all}=no" 
+fi
+rm -f conftest*
+
+fi
+
+
+if eval "test \"x$`echo ${ac_safe_all}`\" = \"xyes\""; then
+  echo "$ac_t""yes" 1>&6
+  cat >> confdefs.h <<EOF
+#define $ac_uc_define 1
+EOF
+
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+
+
+
+
+
+ac_safe_struct=`echo "ifnet" | sed 'y%./+-%__p_%'`
+ac_safe_member=`echo "if_ibytes" | 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 $ac_n "checking for ifnet.if_ibytes""... $ac_c" 1>&6
+echo "configure:15432: checking for ifnet.if_ibytes" >&5
+if eval "test \"`echo '$''{'$ac_safe_all'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+if test "x" = "x"; then
+  defineit="= 0"
+elif test "x" = "xno"; then
+  defineit=""
+else
+  defineit=""
+fi
+cat > conftest.$ac_ext <<EOF
+#line 15445 "configure"
+#include "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_ibytes $defineit;
+
+; return 0; }
+EOF
+if { (eval echo configure:15505: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  eval "${ac_safe_all}=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "${ac_safe_all}=no" 
+fi
+rm -f conftest*
+
+fi
+
+
+if eval "test \"x$`echo ${ac_safe_all}`\" = \"xyes\""; then
+  echo "$ac_t""yes" 1>&6
+  cat >> confdefs.h <<EOF
+#define $ac_uc_define 1
+EOF
+
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+
+
+
+
+
+ac_safe_struct=`echo "ifnet" | sed 'y%./+-%__p_%'`
+ac_safe_member=`echo "if_addrlist" | 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 $ac_n "checking for ifnet.if_addrlist""... $ac_c" 1>&6
+echo "configure:15540: checking for ifnet.if_addrlist" >&5
+if eval "test \"`echo '$''{'$ac_safe_all'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+if test "x" = "x"; then
+  defineit="= 0"
+elif test "x" = "xno"; then
+  defineit=""
+else
+  defineit=""
+fi
+cat > conftest.$ac_ext <<EOF
+#line 15553 "configure"
+#include "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_addrlist $defineit;
+
+; return 0; }
+EOF
+if { (eval echo configure:15613: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  eval "${ac_safe_all}=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "${ac_safe_all}=no" 
+fi
+rm -f conftest*
+
+fi
+
+
+if eval "test \"x$`echo ${ac_safe_all}`\" = \"xyes\""; then
+  echo "$ac_t""yes" 1>&6
+  cat >> confdefs.h <<EOF
+#define $ac_uc_define 1
+EOF
+
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+
+
+
+
+
+ac_safe_struct=`echo "ifnet" | sed 'y%./+-%__p_%'`
+ac_safe_member=`echo "if_addrhead.tqh_first" | 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 $ac_n "checking for ifnet.if_addrhead.tqh_first""... $ac_c" 1>&6
+echo "configure:15648: checking for ifnet.if_addrhead.tqh_first" >&5
+if eval "test \"`echo '$''{'$ac_safe_all'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+if test "x" = "x"; then
+  defineit="= 0"
+elif test "x" = "xno"; then
+  defineit=""
+else
+  defineit=""
+fi
+cat > conftest.$ac_ext <<EOF
+#line 15661 "configure"
+#include "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_addrhead.tqh_first $defineit;
+
+; return 0; }
+EOF
+if { (eval echo configure:15721: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  eval "${ac_safe_all}=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "${ac_safe_all}=no" 
+fi
+rm -f conftest*
+
+fi
+
+
+if eval "test \"x$`echo ${ac_safe_all}`\" = \"xyes\""; then
+  echo "$ac_t""yes" 1>&6
+  cat >> confdefs.h <<EOF
+#define $ac_uc_define 1
+EOF
+
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+
+
+
+
+
+ac_safe_struct=`echo "udpstat" | sed 'y%./+-%__p_%'`
+ac_safe_member=`echo "udps_discard" | 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 $ac_n "checking for udpstat.udps_discard""... $ac_c" 1>&6
+echo "configure:15756: checking for udpstat.udps_discard" >&5
+if eval "test \"`echo '$''{'$ac_safe_all'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+if test "x" = "x"; then
+  defineit="= 0"
+elif test "x" = "xno"; then
+  defineit=""
+else
+  defineit=""
+fi
+cat > conftest.$ac_ext <<EOF
+#line 15769 "configure"
+#include "confdefs.h"
+
+
+#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
+#if HAVE_NETINET_UDP_H
+#include <netinet/udp.h>
+#endif
+#if HAVE_NETINET_UDP_VAR_H
+#include <netinet/udp_var.h>
+#endif
+
+
+int main() {
+
+struct udpstat testit; 
+testit.udps_discard $defineit;
+
+; return 0; }
+EOF
+if { (eval echo configure:15795: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  eval "${ac_safe_all}=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "${ac_safe_all}=no" 
+fi
+rm -f conftest*
+
+fi
+
+
+if eval "test \"x$`echo ${ac_safe_all}`\" = \"xyes\""; then
+  echo "$ac_t""yes" 1>&6
+  cat >> confdefs.h <<EOF
+#define $ac_uc_define 1
+EOF
+
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+
+
+
+
+ac_safe_struct=`echo "udpstat" | sed 'y%./+-%__p_%'`
+ac_safe_member=`echo "udps_noport" | 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 $ac_n "checking for udpstat.udps_noport""... $ac_c" 1>&6
+echo "configure:15829: checking for udpstat.udps_noport" >&5
+if eval "test \"`echo '$''{'$ac_safe_all'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+if test "x" = "x"; then
+  defineit="= 0"
+elif test "x" = "xno"; then
+  defineit=""
+else
+  defineit=""
+fi
+cat > conftest.$ac_ext <<EOF
+#line 15842 "configure"
+#include "confdefs.h"
+
+
+#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
+#if HAVE_NETINET_UDP_H
+#include <netinet/udp.h>
+#endif
+#if HAVE_NETINET_UDP_VAR_H
+#include <netinet/udp_var.h>
+#endif
+
+
+int main() {
+
+struct udpstat testit; 
+testit.udps_noport $defineit;
+
+; return 0; }
+EOF
+if { (eval echo configure:15868: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  eval "${ac_safe_all}=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "${ac_safe_all}=no" 
+fi
+rm -f conftest*
+
+fi
+
+
+if eval "test \"x$`echo ${ac_safe_all}`\" = \"xyes\""; then
+  echo "$ac_t""yes" 1>&6
+  cat >> confdefs.h <<EOF
+#define $ac_uc_define 1
+EOF
+
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+
+
+
+
+ac_safe_struct=`echo "udpstat" | sed 'y%./+-%__p_%'`
+ac_safe_member=`echo "udps_noportbcast" | 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 $ac_n "checking for udpstat.udps_noportbcast""... $ac_c" 1>&6
+echo "configure:15902: checking for udpstat.udps_noportbcast" >&5
+if eval "test \"`echo '$''{'$ac_safe_all'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+if test "x" = "x"; then
+  defineit="= 0"
+elif test "x" = "xno"; then
+  defineit=""
+else
+  defineit=""
+fi
+cat > conftest.$ac_ext <<EOF
+#line 15915 "configure"
+#include "confdefs.h"
+
+
+#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
+#if HAVE_NETINET_UDP_H
+#include <netinet/udp.h>
+#endif
+#if HAVE_NETINET_UDP_VAR_H
+#include <netinet/udp_var.h>
+#endif
+
+
+int main() {
+
+struct udpstat testit; 
+testit.udps_noportbcast $defineit;
+
+; return 0; }
+EOF
+if { (eval echo configure:15941: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  eval "${ac_safe_all}=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "${ac_safe_all}=no" 
+fi
+rm -f conftest*
+
+fi
+
+
+if eval "test \"x$`echo ${ac_safe_all}`\" = \"xyes\""; then
+  echo "$ac_t""yes" 1>&6
+  cat >> confdefs.h <<EOF
+#define $ac_uc_define 1
+EOF
+
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+
+
+
+
+ac_safe_struct=`echo "udpstat" | sed 'y%./+-%__p_%'`
+ac_safe_member=`echo "udps_fullsock" | 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 $ac_n "checking for udpstat.udps_fullsock""... $ac_c" 1>&6
+echo "configure:15975: checking for udpstat.udps_fullsock" >&5
+if eval "test \"`echo '$''{'$ac_safe_all'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+if test "x" = "x"; then
+  defineit="= 0"
+elif test "x" = "xno"; then
+  defineit=""
+else
+  defineit=""
+fi
+cat > conftest.$ac_ext <<EOF
+#line 15988 "configure"
+#include "confdefs.h"
+
+
+#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
+#if HAVE_NETINET_UDP_H
+#include <netinet/udp.h>
+#endif
+#if HAVE_NETINET_UDP_VAR_H
+#include <netinet/udp_var.h>
+#endif
+
+
+int main() {
+
+struct udpstat testit; 
+testit.udps_fullsock $defineit;
+
+; return 0; }
+EOF
+if { (eval echo configure:16014: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  eval "${ac_safe_all}=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "${ac_safe_all}=no" 
+fi
+rm -f conftest*
+
+fi
+
+
+if eval "test \"x$`echo ${ac_safe_all}`\" = \"xyes\""; then
+  echo "$ac_t""yes" 1>&6
+  cat >> confdefs.h <<EOF
+#define $ac_uc_define 1
+EOF
+
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+
+
+
+
+ac_safe_struct=`echo "arphd" | sed 'y%./+-%__p_%'`
+ac_safe_member=`echo "at_next" | 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 $ac_n "checking for arphd.at_next""... $ac_c" 1>&6
+echo "configure:16048: checking for arphd.at_next" >&5
+if eval "test \"`echo '$''{'$ac_safe_all'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+if test "x" = "x"; then
+  defineit="= 0"
+elif test "x" = "xno"; then
+  defineit=""
+else
+  defineit=""
+fi
+cat > conftest.$ac_ext <<EOF
+#line 16061 "configure"
+#include "confdefs.h"
+
+
+#ifdef HAVE_SYS_PARAM_H
+#include <sys/param.h>
+#endif
+#include <sys/types.h>
+#include <sys/socket.h>
+#ifdef HAVE_SYS_TIME_H
+#include <sys/time.h>
+#endif
+#include <net/if.h>
+#if HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+#if HAVE_NETINET_IF_ETHER_H
+#include <netinet/if_ether.h>
+#endif
+
+
+int main() {
+
+struct arphd testit; 
+testit.at_next $defineit;
+
+; return 0; }
+EOF
+if { (eval echo configure:16089: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  eval "${ac_safe_all}=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "${ac_safe_all}=no" 
+fi
+rm -f conftest*
+
+fi
+
+
+if eval "test \"x$`echo ${ac_safe_all}`\" = \"xyes\""; then
+  echo "$ac_t""yes" 1>&6
+  cat >> confdefs.h <<EOF
+#define $ac_uc_define 1
+EOF
+
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+
+
+
+
+ac_safe_struct=`echo "swdevt" | sed 'y%./+-%__p_%'`
+ac_safe_member=`echo "sw_nblksenabled" | 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 $ac_n "checking for swdevt.sw_nblksenabled""... $ac_c" 1>&6
+echo "configure:16123: checking for swdevt.sw_nblksenabled" >&5
+if eval "test \"`echo '$''{'$ac_safe_all'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+if test "x" = "x"; then
+  defineit="= 0"
+elif test "x" = "xno"; then
+  defineit=""
+else
+  defineit=""
+fi
+cat > conftest.$ac_ext <<EOF
+#line 16136 "configure"
+#include "confdefs.h"
+
+
+#if HAVE_SYS_CONF_H
+#include <sys/conf.h>
+#endif
+
+
+int main() {
+
+struct swdevt testit; 
+testit.sw_nblksenabled $defineit;
+
+; return 0; }
+EOF
+if { (eval echo configure:16152: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  eval "${ac_safe_all}=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "${ac_safe_all}=no" 
+fi
+rm -f conftest*
+
+fi
+
+
+if eval "test \"x$`echo ${ac_safe_all}`\" = \"xyes\""; then
+  echo "$ac_t""yes" 1>&6
+  cat >> confdefs.h <<EOF
+#define $ac_uc_define 1
+EOF
+
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+
+
+
+
+ac_safe_struct=`echo "statvfs" | sed 'y%./+-%__p_%'`
+ac_safe_member=`echo "f_frsize" | 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 $ac_n "checking for statvfs.f_frsize""... $ac_c" 1>&6
+echo "configure:16186: checking for statvfs.f_frsize" >&5
+if eval "test \"`echo '$''{'$ac_safe_all'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+if test "x" = "x"; then
+  defineit="= 0"
+elif test "x" = "xno"; then
+  defineit=""
+else
+  defineit=""
+fi
+cat > conftest.$ac_ext <<EOF
+#line 16199 "configure"
+#include "confdefs.h"
+
+
+#ifdef HAVE_SYS_STAT_H
+#include <sys/stat.h>
+#endif
+#if HAVE_SYS_STATFS_H
+#include <sys/statfs.h>
+#endif
+#if HAVE_SYS_STATVFS_H
+#include <sys/statvfs.h>
+#endif
+
+
+int main() {
+
+struct statvfs testit; 
+testit.f_frsize $defineit;
+
+; return 0; }
+EOF
+if { (eval echo configure:16221: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  eval "${ac_safe_all}=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "${ac_safe_all}=no" 
+fi
+rm -f conftest*
+
+fi
+
+
+if eval "test \"x$`echo ${ac_safe_all}`\" = \"xyes\""; then
+  echo "$ac_t""yes" 1>&6
+  cat >> confdefs.h <<EOF
+#define $ac_uc_define 1
+EOF
+
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+
+
+
+
+ac_safe_struct=`echo "statvfs" | sed 'y%./+-%__p_%'`
+ac_safe_member=`echo "f_files" | 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 $ac_n "checking for statvfs.f_files""... $ac_c" 1>&6
+echo "configure:16255: checking for statvfs.f_files" >&5
+if eval "test \"`echo '$''{'$ac_safe_all'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+if test "x" = "x"; then
+  defineit="= 0"
+elif test "x" = "xno"; then
+  defineit=""
+else
+  defineit=""
+fi
+cat > conftest.$ac_ext <<EOF
+#line 16268 "configure"
+#include "confdefs.h"
+
+
+#ifdef HAVE_SYS_STAT_H
+#include <sys/stat.h>
+#endif
+#if HAVE_SYS_STATFS_H
+#include <sys/statfs.h>
+#endif
+#if HAVE_SYS_STATVFS_H
+#include <sys/statvfs.h>
+#endif
+
+
+int main() {
+
+struct statvfs testit; 
+testit.f_files $defineit;
+
+; return 0; }
+EOF
+if { (eval echo configure:16290: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  eval "${ac_safe_all}=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "${ac_safe_all}=no" 
+fi
+rm -f conftest*
+
+fi
+
+
+if eval "test \"x$`echo ${ac_safe_all}`\" = \"xyes\""; then
+  echo "$ac_t""yes" 1>&6
+  cat >> confdefs.h <<EOF
+#define $ac_uc_define 1
+EOF
+
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+
+
+
+
+ac_safe_struct=`echo "statfs" | sed 'y%./+-%__p_%'`
+ac_safe_member=`echo "f_files" | 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 $ac_n "checking for statfs.f_files""... $ac_c" 1>&6
+echo "configure:16324: checking for statfs.f_files" >&5
+if eval "test \"`echo '$''{'$ac_safe_all'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+if test "x" = "x"; then
+  defineit="= 0"
+elif test "x" = "xno"; then
+  defineit=""
+else
+  defineit=""
+fi
+cat > conftest.$ac_ext <<EOF
+#line 16337 "configure"
+#include "confdefs.h"
+
+
+#ifdef HAVE_SYS_STAT_H
+#include <sys/stat.h>
+#endif
+#if HAVE_SYS_STATFS_H
+#include <sys/statfs.h>
+#endif
+#ifdef HAVE_SYS_PARAM_H
+#include <sys/param.h>
+#include <sys/types.h>
+#endif
+#ifdef HAVE_SYS_MOUNT_H
+#include <sys/mount.h>
+#endif
+
+
+int main() {
+
+struct statfs testit; 
+testit.f_files $defineit;
+
+; return 0; }
+EOF
+if { (eval echo configure:16363: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  eval "${ac_safe_all}=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "${ac_safe_all}=no" 
+fi
+rm -f conftest*
+
+fi
+
+
+if eval "test \"x$`echo ${ac_safe_all}`\" = \"xyes\""; then
+  echo "$ac_t""yes" 1>&6
+  cat >> confdefs.h <<EOF
+#define $ac_uc_define 1
+EOF
+
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+
+
+
+
+ac_safe_struct=`echo "statfs" | sed 'y%./+-%__p_%'`
+ac_safe_member=`echo "f_ffree" | 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 $ac_n "checking for statfs.f_ffree""... $ac_c" 1>&6
+echo "configure:16397: checking for statfs.f_ffree" >&5
+if eval "test \"`echo '$''{'$ac_safe_all'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+if test "x" = "x"; then
+  defineit="= 0"
+elif test "x" = "xno"; then
+  defineit=""
+else
+  defineit=""
+fi
+cat > conftest.$ac_ext <<EOF
+#line 16410 "configure"
+#include "confdefs.h"
+
+
+#ifdef HAVE_SYS_STAT_H
+#include <sys/stat.h>
+#endif
+#if HAVE_SYS_STATFS_H
+#include <sys/statfs.h>
+#endif
+#ifdef HAVE_SYS_PARAM_H
+#include <sys/param.h>
+#include <sys/types.h>
+#endif
+#ifdef HAVE_SYS_MOUNT_H
+#include <sys/mount.h>
+#endif
+
+
+int main() {
+
+struct statfs testit; 
+testit.f_ffree $defineit;
+
+; return 0; }
+EOF
+if { (eval echo configure:16436: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  eval "${ac_safe_all}=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "${ac_safe_all}=no" 
+fi
+rm -f conftest*
+
+fi
+
+
+if eval "test \"x$`echo ${ac_safe_all}`\" = \"xyes\""; then
+  echo "$ac_t""yes" 1>&6
+  cat >> confdefs.h <<EOF
+#define $ac_uc_define 1
+EOF
+
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+
+
+
+
+ac_safe_struct=`echo "statfs" | sed 'y%./+-%__p_%'`
+ac_safe_member=`echo "f_favail" | 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 $ac_n "checking for statfs.f_favail""... $ac_c" 1>&6
+echo "configure:16470: checking for statfs.f_favail" >&5
+if eval "test \"`echo '$''{'$ac_safe_all'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+if test "x" = "x"; then
+  defineit="= 0"
+elif test "x" = "xno"; then
+  defineit=""
+else
+  defineit=""
+fi
+cat > conftest.$ac_ext <<EOF
+#line 16483 "configure"
+#include "confdefs.h"
+
+
+#ifdef HAVE_SYS_STAT_H
+#include <sys/stat.h>
+#endif
+#if HAVE_SYS_STATFS_H
+#include <sys/statfs.h>
+#endif
+#ifdef HAVE_SYS_PARAM_H
+#include <sys/param.h>
+#include <sys/types.h>
+#endif
+#ifdef HAVE_SYS_MOUNT_H
+#include <sys/mount.h>
+#endif
+
+
+int main() {
+
+struct statfs testit; 
+testit.f_favail $defineit;
+
+; return 0; }
+EOF
+if { (eval echo configure:16509: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  eval "${ac_safe_all}=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "${ac_safe_all}=no" 
+fi
+rm -f conftest*
+
+fi
+
+
+if eval "test \"x$`echo ${ac_safe_all}`\" = \"xyes\""; then
+  echo "$ac_t""yes" 1>&6
+  cat >> confdefs.h <<EOF
+#define $ac_uc_define 1
+EOF
+
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+
+
+
+
+ac_safe_struct=`echo "nlist" | sed 'y%./+-%__p_%'`
+ac_safe_member=`echo "n_value" | 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 $ac_n "checking for nlist.n_value""... $ac_c" 1>&6
+echo "configure:16543: checking for nlist.n_value" >&5
+if eval "test \"`echo '$''{'$ac_safe_all'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+if test "x" = "x"; then
+  defineit="= 0"
+elif test "x" = "xno"; then
+  defineit=""
+else
+  defineit=""
+fi
+cat > conftest.$ac_ext <<EOF
+#line 16556 "configure"
+#include "confdefs.h"
+
+
+#if HAVE_NLIST_H
+#include <nlist.h>
+#endif
+
+
+int main() {
+
+struct nlist testit; 
+testit.n_value $defineit;
+
+; return 0; }
+EOF
+if { (eval echo configure:16572: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  eval "${ac_safe_all}=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "${ac_safe_all}=no" 
+fi
+rm -f conftest*
+
+fi
+
+
+if eval "test \"x$`echo ${ac_safe_all}`\" = \"xyes\""; then
+  echo "$ac_t""yes" 1>&6
+  cat >> confdefs.h <<EOF
+#define $ac_uc_define 1
+EOF
+
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+
+
+
+
+ac_safe_struct=`echo "ipstat" | sed 'y%./+-%__p_%'`
+ac_safe_member=`echo "ips_cantforward" | 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 $ac_n "checking for ipstat.ips_cantforward""... $ac_c" 1>&6
+echo "configure:16606: checking for ipstat.ips_cantforward" >&5
+if eval "test \"`echo '$''{'$ac_safe_all'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+if test "x" = "x"; then
+  defineit="= 0"
+elif test "x" = "xno"; then
+  defineit=""
+else
+  defineit=""
+fi
+cat > conftest.$ac_ext <<EOF
+#line 16619 "configure"
+#include "confdefs.h"
+
+
+#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
+
+
+int main() {
+
+struct ipstat testit; 
+testit.ips_cantforward $defineit;
+
+; return 0; }
+EOF
+if { (eval echo configure:16639: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  eval "${ac_safe_all}=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "${ac_safe_all}=no" 
+fi
+rm -f conftest*
+
+fi
+
+
+if eval "test \"x$`echo ${ac_safe_all}`\" = \"xyes\""; then
+  echo "$ac_t""yes" 1>&6
+  cat >> confdefs.h <<EOF
+#define $ac_uc_define 1
+EOF
+
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+
+
+
+
+ac_safe_struct=`echo "ipstat" | sed 'y%./+-%__p_%'`
+ac_safe_member=`echo "ips_cantfrag" | 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 $ac_n "checking for ipstat.ips_cantfrag""... $ac_c" 1>&6
+echo "configure:16673: checking for ipstat.ips_cantfrag" >&5
+if eval "test \"`echo '$''{'$ac_safe_all'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+if test "x" = "x"; then
+  defineit="= 0"
+elif test "x" = "xno"; then
+  defineit=""
+else
+  defineit=""
+fi
+cat > conftest.$ac_ext <<EOF
+#line 16686 "configure"
+#include "confdefs.h"
+
+
+#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
+
+
+int main() {
+
+struct ipstat testit; 
+testit.ips_cantfrag $defineit;
+
+; return 0; }
+EOF
+if { (eval echo configure:16706: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  eval "${ac_safe_all}=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "${ac_safe_all}=no" 
+fi
+rm -f conftest*
+
+fi
+
+
+if eval "test \"x$`echo ${ac_safe_all}`\" = \"xyes\""; then
+  echo "$ac_t""yes" 1>&6
+  cat >> confdefs.h <<EOF
+#define $ac_uc_define 1
+EOF
+
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+
+
+
+
+ac_safe_struct=`echo "ipstat" | sed 'y%./+-%__p_%'`
+ac_safe_member=`echo "ips_delivered" | 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 $ac_n "checking for ipstat.ips_delivered""... $ac_c" 1>&6
+echo "configure:16740: checking for ipstat.ips_delivered" >&5
+if eval "test \"`echo '$''{'$ac_safe_all'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+if test "x" = "x"; then
+  defineit="= 0"
+elif test "x" = "xno"; then
+  defineit=""
+else
+  defineit=""
+fi
+cat > conftest.$ac_ext <<EOF
+#line 16753 "configure"
+#include "confdefs.h"
+
+
+#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
+
+
+int main() {
+
+struct ipstat testit; 
+testit.ips_delivered $defineit;
+
+; return 0; }
+EOF
+if { (eval echo configure:16773: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  eval "${ac_safe_all}=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "${ac_safe_all}=no" 
+fi
+rm -f conftest*
+
+fi
+
+
+if eval "test \"x$`echo ${ac_safe_all}`\" = \"xyes\""; then
+  echo "$ac_t""yes" 1>&6
+  cat >> confdefs.h <<EOF
+#define $ac_uc_define 1
+EOF
+
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+
+
+
+
+ac_safe_struct=`echo "ipstat" | sed 'y%./+-%__p_%'`
+ac_safe_member=`echo "ips_fragdropped" | 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 $ac_n "checking for ipstat.ips_fragdropped""... $ac_c" 1>&6
+echo "configure:16807: checking for ipstat.ips_fragdropped" >&5
+if eval "test \"`echo '$''{'$ac_safe_all'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+if test "x" = "x"; then
+  defineit="= 0"
+elif test "x" = "xno"; then
+  defineit=""
+else
+  defineit=""
+fi
+cat > conftest.$ac_ext <<EOF
+#line 16820 "configure"
+#include "confdefs.h"
+
+
+#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
+
+
+int main() {
+
+struct ipstat testit; 
+testit.ips_fragdropped $defineit;
+
+; return 0; }
+EOF
+if { (eval echo configure:16840: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  eval "${ac_safe_all}=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "${ac_safe_all}=no" 
+fi
+rm -f conftest*
+
+fi
+
+
+if eval "test \"x$`echo ${ac_safe_all}`\" = \"xyes\""; then
+  echo "$ac_t""yes" 1>&6
+  cat >> confdefs.h <<EOF
+#define $ac_uc_define 1
+EOF
+
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+
+
+
+
+ac_safe_struct=`echo "ipstat" | sed 'y%./+-%__p_%'`
+ac_safe_member=`echo "ips_fragtimeout" | 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 $ac_n "checking for ipstat.ips_fragtimeout""... $ac_c" 1>&6
+echo "configure:16874: checking for ipstat.ips_fragtimeout" >&5
+if eval "test \"`echo '$''{'$ac_safe_all'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+if test "x" = "x"; then
+  defineit="= 0"
+elif test "x" = "xno"; then
+  defineit=""
+else
+  defineit=""
+fi
+cat > conftest.$ac_ext <<EOF
+#line 16887 "configure"
+#include "confdefs.h"
+
+
+#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
+
+
+int main() {
+
+struct ipstat testit; 
+testit.ips_fragtimeout $defineit;
+
+; return 0; }
+EOF
+if { (eval echo configure:16907: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  eval "${ac_safe_all}=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "${ac_safe_all}=no" 
+fi
+rm -f conftest*
+
+fi
+
+
+if eval "test \"x$`echo ${ac_safe_all}`\" = \"xyes\""; then
+  echo "$ac_t""yes" 1>&6
+  cat >> confdefs.h <<EOF
+#define $ac_uc_define 1
+EOF
+
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+
+
+
+
+ac_safe_struct=`echo "ipstat" | sed 'y%./+-%__p_%'`
+ac_safe_member=`echo "ips_localout" | 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 $ac_n "checking for ipstat.ips_localout""... $ac_c" 1>&6
+echo "configure:16941: checking for ipstat.ips_localout" >&5
+if eval "test \"`echo '$''{'$ac_safe_all'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+if test "x" = "x"; then
+  defineit="= 0"
+elif test "x" = "xno"; then
+  defineit=""
+else
+  defineit=""
+fi
+cat > conftest.$ac_ext <<EOF
+#line 16954 "configure"
+#include "confdefs.h"
+
+
+#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
+
+
+int main() {
+
+struct ipstat testit; 
+testit.ips_localout $defineit;
+
+; return 0; }
+EOF
+if { (eval echo configure:16974: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  eval "${ac_safe_all}=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "${ac_safe_all}=no" 
+fi
+rm -f conftest*
+
+fi
+
+
+if eval "test \"x$`echo ${ac_safe_all}`\" = \"xyes\""; then
+  echo "$ac_t""yes" 1>&6
+  cat >> confdefs.h <<EOF
+#define $ac_uc_define 1
+EOF
+
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+
+
+
+
+ac_safe_struct=`echo "ipstat" | sed 'y%./+-%__p_%'`
+ac_safe_member=`echo "ips_noproto" | 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 $ac_n "checking for ipstat.ips_noproto""... $ac_c" 1>&6
+echo "configure:17008: checking for ipstat.ips_noproto" >&5
+if eval "test \"`echo '$''{'$ac_safe_all'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+if test "x" = "x"; then
+  defineit="= 0"
+elif test "x" = "xno"; then
+  defineit=""
+else
+  defineit=""
+fi
+cat > conftest.$ac_ext <<EOF
+#line 17021 "configure"
+#include "confdefs.h"
+
+
+#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
+
+
+int main() {
+
+struct ipstat testit; 
+testit.ips_noproto $defineit;
+
+; return 0; }
+EOF
+if { (eval echo configure:17041: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  eval "${ac_safe_all}=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "${ac_safe_all}=no" 
+fi
+rm -f conftest*
+
+fi
+
+
+if eval "test \"x$`echo ${ac_safe_all}`\" = \"xyes\""; then
+  echo "$ac_t""yes" 1>&6
+  cat >> confdefs.h <<EOF
+#define $ac_uc_define 1
+EOF
+
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+
+
+
+
+ac_safe_struct=`echo "ipstat" | sed 'y%./+-%__p_%'`
+ac_safe_member=`echo "ips_noroute" | 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 $ac_n "checking for ipstat.ips_noroute""... $ac_c" 1>&6
+echo "configure:17075: checking for ipstat.ips_noroute" >&5
+if eval "test \"`echo '$''{'$ac_safe_all'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+if test "x" = "x"; then
+  defineit="= 0"
+elif test "x" = "xno"; then
+  defineit=""
+else
+  defineit=""
+fi
+cat > conftest.$ac_ext <<EOF
+#line 17088 "configure"
+#include "confdefs.h"
+
+
+#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
+
+
+int main() {
+
+struct ipstat testit; 
+testit.ips_noroute $defineit;
+
+; return 0; }
+EOF
+if { (eval echo configure:17108: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  eval "${ac_safe_all}=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "${ac_safe_all}=no" 
+fi
+rm -f conftest*
+
+fi
+
+
+if eval "test \"x$`echo ${ac_safe_all}`\" = \"xyes\""; then
+  echo "$ac_t""yes" 1>&6
+  cat >> confdefs.h <<EOF
+#define $ac_uc_define 1
+EOF
+
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+
+
+
+
+ac_safe_struct=`echo "ipstat" | sed 'y%./+-%__p_%'`
+ac_safe_member=`echo "ips_odropped" | 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 $ac_n "checking for ipstat.ips_odropped""... $ac_c" 1>&6
+echo "configure:17142: checking for ipstat.ips_odropped" >&5
+if eval "test \"`echo '$''{'$ac_safe_all'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+if test "x" = "x"; then
+  defineit="= 0"
+elif test "x" = "xno"; then
+  defineit=""
+else
+  defineit=""
+fi
+cat > conftest.$ac_ext <<EOF
+#line 17155 "configure"
+#include "confdefs.h"
+
+
+#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
+
+
+int main() {
+
+struct ipstat testit; 
+testit.ips_odropped $defineit;
+
+; return 0; }
+EOF
+if { (eval echo configure:17175: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  eval "${ac_safe_all}=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "${ac_safe_all}=no" 
+fi
+rm -f conftest*
+
+fi
+
+
+if eval "test \"x$`echo ${ac_safe_all}`\" = \"xyes\""; then
+  echo "$ac_t""yes" 1>&6
+  cat >> confdefs.h <<EOF
+#define $ac_uc_define 1
+EOF
+
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+
+
+
+
+ac_safe_struct=`echo "ipstat" | sed 'y%./+-%__p_%'`
+ac_safe_member=`echo "ips_ofragments" | 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 $ac_n "checking for ipstat.ips_ofragments""... $ac_c" 1>&6
+echo "configure:17209: checking for ipstat.ips_ofragments" >&5
+if eval "test \"`echo '$''{'$ac_safe_all'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+if test "x" = "x"; then
+  defineit="= 0"
+elif test "x" = "xno"; then
+  defineit=""
+else
+  defineit=""
+fi
+cat > conftest.$ac_ext <<EOF
+#line 17222 "configure"
+#include "confdefs.h"
+
+
+#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
+
+
+int main() {
+
+struct ipstat testit; 
+testit.ips_ofragments $defineit;
+
+; return 0; }
+EOF
+if { (eval echo configure:17242: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  eval "${ac_safe_all}=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "${ac_safe_all}=no" 
+fi
+rm -f conftest*
+
+fi
+
+
+if eval "test \"x$`echo ${ac_safe_all}`\" = \"xyes\""; then
+  echo "$ac_t""yes" 1>&6
+  cat >> confdefs.h <<EOF
+#define $ac_uc_define 1
+EOF
+
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+
+
+
+
+ac_safe_struct=`echo "ipstat" | sed 'y%./+-%__p_%'`
+ac_safe_member=`echo "ips_reassembled" | 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 $ac_n "checking for ipstat.ips_reassembled""... $ac_c" 1>&6
+echo "configure:17276: checking for ipstat.ips_reassembled" >&5
+if eval "test \"`echo '$''{'$ac_safe_all'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+if test "x" = "x"; then
+  defineit="= 0"
+elif test "x" = "xno"; then
+  defineit=""
+else
+  defineit=""
+fi
+cat > conftest.$ac_ext <<EOF
+#line 17289 "configure"
+#include "confdefs.h"
+
+
+#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
+
+
+int main() {
+
+struct ipstat testit; 
+testit.ips_reassembled $defineit;
+
+; return 0; }
+EOF
+if { (eval echo configure:17309: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  eval "${ac_safe_all}=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "${ac_safe_all}=no" 
+fi
+rm -f conftest*
+
+fi
+
+
+if eval "test \"x$`echo ${ac_safe_all}`\" = \"xyes\""; then
+  echo "$ac_t""yes" 1>&6
+  cat >> confdefs.h <<EOF
+#define $ac_uc_define 1
+EOF
+
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+
+
+if test "x$ac_cv_header_openssl_des_h" = "xyes" ; then
+
+
+ac_safe_struct=`echo "des_ks_struct" | sed 'y%./+-%__p_%'`
+ac_safe_member=`echo "weak_key" | 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 $ac_n "checking for des_ks_struct.weak_key""... $ac_c" 1>&6
+echo "configure:17344: checking for des_ks_struct.weak_key" >&5
+if eval "test \"`echo '$''{'$ac_safe_all'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+if test "x" = "x"; then
+  defineit="= 0"
+elif test "x" = "xno"; then
+  defineit=""
+else
+  defineit=""
+fi
+cat > conftest.$ac_ext <<EOF
+#line 17357 "configure"
+#include "confdefs.h"
+
+
+#include <openssl/des.h>
+
+
+int main() {
+
+struct des_ks_struct testit; 
+testit.weak_key $defineit;
+
+; return 0; }
+EOF
+if { (eval echo configure:17371: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  eval "${ac_safe_all}=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "${ac_safe_all}=no" 
+fi
+rm -f conftest*
+
+fi
+
+
+if eval "test \"x$`echo ${ac_safe_all}`\" = \"xyes\""; then
+  echo "$ac_t""yes" 1>&6
+  cat >> confdefs.h <<EOF
+#define $ac_uc_define 1
+EOF
+
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+
+fi
+
+
+if test $cross_compiling = yes; then
+  echo "configure: warning: Can't check sysctl, manually define CAN_USE_SYSCTL if platform support available" 1>&2
+else
+  echo $ac_n "checking if sysctl can read kernel information""... $ac_c" 1>&6
+echo "configure:17403: checking if sysctl can read kernel information" >&5
+if eval "test \"`echo '$''{'ac_cv_CAN_USE_SYSCTL'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  if test "$cross_compiling" = yes; then
+  ac_cv_CAN_USE_SYSCTL=no
+else
+  cat > conftest.$ac_ext <<EOF
+#line 17411 "configure"
+#include "confdefs.h"
+
+#if TIME_WITH_SYS_TIME
+# include <sys/time.h>
+# include <time.h>
+#else
+# if HAVE_SYS_TIME_H
+#  include <sys/time.h>
+# else
+#  include <time.h>
+# endif
+#endif
+#if HAVE_SYS_PARAM_H
+# include <sys/param.h>
+#endif
+#include <sys/types.h>
+#if HAVE_SYS_SYSCTL_H
+# include <sys/sysctl.h>
+#endif
+
+main() {
+  int                 mib[2];
+  size_t              len;
+  struct timeval boottime;
+  
+  mib[0] = CTL_KERN;
+  mib[1] = KERN_BOOTTIME;
+  
+  len = sizeof(boottime);
+  sysctl(mib, 2, &boottime, &len, NULL, NULL);
+  if (boottime.tv_sec != 0)
+    exit(0);
+  else
+    exit(1);
+}
+  
+EOF
+if { (eval echo configure:17449: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+then
+  ac_cv_CAN_USE_SYSCTL=yes
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -fr conftest*
+  ac_cv_CAN_USE_SYSCTL=no
+fi
+rm -fr conftest*
+fi
+
+fi
+
+echo "$ac_t""$ac_cv_CAN_USE_SYSCTL" 1>&6
+fi
+
+if test "x$ac_cv_CAN_USE_SYSCTL" = "xyes"; then
+  cat >> confdefs.h <<\EOF
+#define CAN_USE_SYSCTL 1
+EOF
+
+fi
+
+echo $ac_n "checking whether TCP timers depend on \`hz'""... $ac_c" 1>&6
+echo "configure:17474: checking whether TCP timers depend on \`hz'" >&5
+if eval "test \"`echo '$''{'ac_cv_TCPTV_NEEDS_HZ'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 17479 "configure"
+#include "confdefs.h"
+#include <netinet/tcp_timer.h>
+TCPTV_SRTTDFLT
+
+EOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  egrep "hz" >/dev/null 2>&1; then
+  rm -rf conftest*
+  ac_cv_TCPTV_NEEDS_HZ=yes
+else
+  rm -rf conftest*
+  ac_cv_TCPTV_NEEDS_HZ=no
+fi
+rm -f conftest*
+
+fi
+
+echo "$ac_t""$ac_cv_TCPTV_NEEDS_HZ" 1>&6
+
+if test "x$ac_cv_TCPTV_NEEDS_HZ" = "xyes"; then
+  cat >> confdefs.h <<\EOF
+#define TCPTV_NEEDS_HZ 1
+EOF
+
+fi
+
+
+
+
+
+
+if test "x$ac_cv_user_prompt_LOGFILE" = "x" -o "x$ac_cv_user_prompt_SYS_LOC" = "x" -o "x$ac_cv_user_prompt_SYS_CONTACT" = "x" -o "x$ac_cv_user_prompt_DEFAULT_SNMP_VERSION" = "x"; then
+echo $ac_n "checking if you have run configure before""... $ac_c" 1>&6
+echo "configure:17513: checking if you have run configure before" >&5
+if eval "test \"`echo '$''{'ac_cv_have_warned'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+if test "x$defaults" = "xno"; then
+cat << EOF
+
+	 ************** Configuration Section **************
+
+	You are about to be prompted with a series of questions.  Answer
+them carefully, as they determine how the SNMP agent and related
+applications are to function.
+
+	After the configure script finishes, you can browse the newly
+created config.h file for further - less important - parameters to
+modify.  Be careful if you re-run configure though, since config.h will
+be overwritten.
+
+-Press return to continue-
+EOF
+
+read tmpinput
+ac_cv_have_warned="yes"
+echo $ac_n "disabling above prompt for future runs...  $ac_c"
+else
+  ac_cv_have_warned="no"
+fi
+
+fi
+
+echo "$ac_t""$ac_cv_have_warned" 1>&6
+else
+  ac_cv_have_warned="yes"
+fi
+
+ME=`$WHOAMI`
+if test -f /etc/resolv.conf; then
+  LOC=`cat /etc/resolv.conf | grep '^domain' | tail -1 | awk '{print $NF}'`
+else
+  LOC="@no.where"
+fi
+
+
+MSG_CHECK=`echo "
+
+*** Default SNMP Version:
+
+	Starting with Net-SNMP 5.0, you can choose the default version of
+the SNMP protocol to use when no version is given explicitly on the
+command line, or via an 'snmp.conf' file.  In the past this was set to
+SNMPv1, but you can use this to switch to SNMPv3 if desired.  SNMPv3
+will provide a more secure management environment (and thus you're
+encouraged to switch to SNMPv3), but may break existing scripts that
+rely on the old behaviour.  (Though such scripts will probably need to
+be changed to use the '-c' community flag anyway, as the SNMPv1
+command line usage has changed as well.).
+   At this prompt you can select \"1\", \"2\" (for SNMPv2c), or \"3\" as
+the default version for the command tools (snmpget, ...) to use.  This
+can always be overridden at runtime using the -v flag to the tools, or
+by using the \"defVersion\" token in your snmp.conf file.
+   Providing the --with-default-snmp-version=\"x\" parameter to ./configure
+will avoid this prompt.
+
+Default version of SNMP to use" | tail -1`
+echo $ac_n "checking $MSG_CHECK""... $ac_c" 1>&6
+echo "configure:17579: checking $MSG_CHECK" >&5
+if eval "test \"`echo '$''{'ac_cv_user_prompt_DEFAULT_SNMP_VERSION'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  echo "" >&6
+
+if test "x$defaults" = "xno"; then
+echo $ac_n "
+
+*** Default SNMP Version:
+
+	Starting with Net-SNMP 5.0, you can choose the default version of
+the SNMP protocol to use when no version is given explicitly on the
+command line, or via an 'snmp.conf' file.  In the past this was set to
+SNMPv1, but you can use this to switch to SNMPv3 if desired.  SNMPv3
+will provide a more secure management environment (and thus you're
+encouraged to switch to SNMPv3), but may break existing scripts that
+rely on the old behaviour.  (Though such scripts will probably need to
+be changed to use the '-c' community flag anyway, as the SNMPv1
+command line usage has changed as well.).
+   At this prompt you can select \"1\", \"2\" (for SNMPv2c), or \"3\" as
+the default version for the command tools (snmpget, ...) to use.  This
+can always be overridden at runtime using the -v flag to the tools, or
+by using the \"defVersion\" token in your snmp.conf file.
+   Providing the --with-default-snmp-version=\"x\" parameter to ./configure
+will avoid this prompt.
+
+Default version of SNMP to use (3): $ac_c"
+read tmpinput
+if test "$tmpinput" = "" -a "3" != ""; then
+  tmpinput="3"
+fi
+eval DEFAULT_SNMP_VERSION=\"$tmpinput\"
+else
+tmpinput="3"
+eval DEFAULT_SNMP_VERSION=\"$tmpinput\"
+fi
+
+
+eval ac_cv_user_prompt_DEFAULT_SNMP_VERSION=\$DEFAULT_SNMP_VERSION
+echo $ac_n "setting $MSG_CHECK to...  $ac_c" >&6
+
+fi
+
+echo "$ac_t""$ac_cv_user_prompt_DEFAULT_SNMP_VERSION" 1>&6
+if test "$ac_cv_user_prompt_DEFAULT_SNMP_VERSION" != "none"; then
+  if test "xunquoted" = "xquoted" -o "xunquoted" = "xQUOTED"; then
+    cat >> confdefs.h <<EOF
+#define DEFAULT_SNMP_VERSION "$ac_cv_user_prompt_DEFAULT_SNMP_VERSION"
+EOF
+
+  else
+    cat >> confdefs.h <<EOF
+#define DEFAULT_SNMP_VERSION $ac_cv_user_prompt_DEFAULT_SNMP_VERSION
+EOF
+
+  fi
+fi
+
+
+if test "$ac_cv_user_prompt_DEFAULT_SNMP_VERSION" != "1" -a "$ac_cv_user_prompt_DEFAULT_SNMP_VERSION" != "2" -a "$ac_cv_user_prompt_DEFAULT_SNMP_VERSION" != "3"; then
+  { echo "configure: error: Illegal version number.  Only 1, 2 (for SNMPv2c) and 3 are supported." 1>&2; exit 1; }
+fi
+
+
+MSG_CHECK=`echo "
+
+*** System Contact Information:
+
+	Describes who should be contacted about the host the agent is
+running on.  This information is available in the MIB-II tree.  This
+can also be over-ridden using the \"syscontact\" syntax in the agent's
+configuration files.
+  Providing the --with-sys-contact=\"contact\" parameter to ./configure
+will avoid this prompt.
+
+System Contact Information" | tail -1`
+echo $ac_n "checking $MSG_CHECK""... $ac_c" 1>&6
+echo "configure:17657: checking $MSG_CHECK" >&5
+if eval "test \"`echo '$''{'ac_cv_user_prompt_SYS_CONTACT'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  echo "" >&6
+
+if test "x$defaults" = "xno"; then
+echo $ac_n "
+
+*** System Contact Information:
+
+	Describes who should be contacted about the host the agent is
+running on.  This information is available in the MIB-II tree.  This
+can also be over-ridden using the \"syscontact\" syntax in the agent's
+configuration files.
+  Providing the --with-sys-contact=\"contact\" parameter to ./configure
+will avoid this prompt.
+
+System Contact Information ($ME@$LOC): $ac_c"
+read tmpinput
+if test "$tmpinput" = "" -a "$ME@$LOC" != ""; then
+  tmpinput="$ME@$LOC"
+fi
+eval SYS_CONTACT=\"$tmpinput\"
+else
+tmpinput="$ME@$LOC"
+eval SYS_CONTACT=\"$tmpinput\"
+fi
+
+
+eval ac_cv_user_prompt_SYS_CONTACT=\$SYS_CONTACT
+echo $ac_n "setting $MSG_CHECK to...  $ac_c" >&6
+
+fi
+
+echo "$ac_t""$ac_cv_user_prompt_SYS_CONTACT" 1>&6
+if test "$ac_cv_user_prompt_SYS_CONTACT" != "none"; then
+  if test "xquoted" = "xquoted" -o "xquoted" = "xQUOTED"; then
+    cat >> confdefs.h <<EOF
+#define SYS_CONTACT "$ac_cv_user_prompt_SYS_CONTACT"
+EOF
+
+  else
+    cat >> confdefs.h <<EOF
+#define SYS_CONTACT $ac_cv_user_prompt_SYS_CONTACT
+EOF
+
+  fi
+fi
+
+
+
+MSG_CHECK=`echo "
+
+*** System Location:
+
+	Describes the location of the system.  This information is
+available in the MIB-II tree.  this can also be over-ridden using the
+\"syslocation\" syntax in the agent's configuration files.
+  Providing the --with-sys-location=\"location\" parameter to ./configure
+will avoid this prompt.
+
+System Location" | tail -1`
+echo $ac_n "checking $MSG_CHECK""... $ac_c" 1>&6
+echo "configure:17721: checking $MSG_CHECK" >&5
+if eval "test \"`echo '$''{'ac_cv_user_prompt_SYS_LOC'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  echo "" >&6
+
+if test "x$defaults" = "xno"; then
+echo $ac_n "
+
+*** System Location:
+
+	Describes the location of the system.  This information is
+available in the MIB-II tree.  this can also be over-ridden using the
+\"syslocation\" syntax in the agent's configuration files.
+  Providing the --with-sys-location=\"location\" parameter to ./configure
+will avoid this prompt.
+
+System Location (Unknown): $ac_c"
+read tmpinput
+if test "$tmpinput" = "" -a "Unknown" != ""; then
+  tmpinput="Unknown"
+fi
+eval SYS_LOC=\"$tmpinput\"
+else
+tmpinput="Unknown"
+eval SYS_LOC=\"$tmpinput\"
+fi
+
+
+eval ac_cv_user_prompt_SYS_LOC=\$SYS_LOC
+echo $ac_n "setting $MSG_CHECK to...  $ac_c" >&6
+
+fi
+
+echo "$ac_t""$ac_cv_user_prompt_SYS_LOC" 1>&6
+if test "$ac_cv_user_prompt_SYS_LOC" != "none"; then
+  if test "xquoted" = "xquoted" -o "xquoted" = "xQUOTED"; then
+    cat >> confdefs.h <<EOF
+#define SYS_LOC "$ac_cv_user_prompt_SYS_LOC"
+EOF
+
+  else
+    cat >> confdefs.h <<EOF
+#define SYS_LOC $ac_cv_user_prompt_SYS_LOC
+EOF
+
+  fi
+fi
+
+
+if test -d /var/log; then
+  defaultlog="/var/log/snmpd.log"
+else
+  defaultlog="/usr/adm/snmpd.log"
+fi
+  
+
+MSG_CHECK=`echo "
+
+*** Logfile location:
+
+	Enter the default location for the snmpd agent to dump
+information & errors to.  If not defined (enter the keyword \"none\"
+at the prompt below) the agent will use stdout and stderr instead.
+(Note: This value can be over-ridden using command line options.)
+  Providing the --with-logfile=\"path\" parameter to ./configure
+will avoid this prompt.
+
+Location to write logfile" | tail -1`
+echo $ac_n "checking $MSG_CHECK""... $ac_c" 1>&6
+echo "configure:17791: checking $MSG_CHECK" >&5
+if eval "test \"`echo '$''{'ac_cv_user_prompt_LOGFILE'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  echo "" >&6
+
+if test "x$defaults" = "xno"; then
+echo $ac_n "
+
+*** Logfile location:
+
+	Enter the default location for the snmpd agent to dump
+information & errors to.  If not defined (enter the keyword \"none\"
+at the prompt below) the agent will use stdout and stderr instead.
+(Note: This value can be over-ridden using command line options.)
+  Providing the --with-logfile=\"path\" parameter to ./configure
+will avoid this prompt.
+
+Location to write logfile ($defaultlog): $ac_c"
+read tmpinput
+if test "$tmpinput" = "" -a "$defaultlog" != ""; then
+  tmpinput="$defaultlog"
+fi
+eval LOGFILE=\"$tmpinput\"
+else
+tmpinput="$defaultlog"
+eval LOGFILE=\"$tmpinput\"
+fi
+
+
+eval ac_cv_user_prompt_LOGFILE=\$LOGFILE
+echo $ac_n "setting $MSG_CHECK to...  $ac_c" >&6
+
+fi
+
+echo "$ac_t""$ac_cv_user_prompt_LOGFILE" 1>&6
+if test "$ac_cv_user_prompt_LOGFILE" != "none"; then
+  if test "xquoted" = "xquoted" -o "xquoted" = "xQUOTED"; then
+    cat >> confdefs.h <<EOF
+#define LOGFILE "$ac_cv_user_prompt_LOGFILE"
+EOF
+
+  else
+    cat >> confdefs.h <<EOF
+#define LOGFILE $ac_cv_user_prompt_LOGFILE
+EOF
+
+  fi
+fi
+
+
+if test -d /var; then
+  defaultstore="/var/net-snmp"
+  ucddefaultstore="/var/ucd-snmp"
+else
+  defaultstore="/etc/net-snmp"
+  ucddefaultstore="/etc/ucd-snmp"
+fi
+  
+
+MSG_CHECK=`echo "
+
+*** snmpd persistent storage location:
+
+	Enter a directory for the SNMP library to store persistent
+data in the form of a configuration file.  This default location is
+different than the old default location (which was for ucd-snmp).  If
+you stay with the new path, I'll ask you in a second if you wish to
+copy your files over to the new location (once only).  If you pick
+some other path than the default, you'll have to copy them yourself.
+There is nothing wrong with picking the old path ($ucddefaultstore) if
+you'd rather.
+  Providing the --with-persistent-directory=\"path\" parameter to
+./configure will avoid this prompt.
+
+Location to write persistent information" | tail -1`
+echo $ac_n "checking $MSG_CHECK""... $ac_c" 1>&6
+echo "configure:17868: checking $MSG_CHECK" >&5
+if eval "test \"`echo '$''{'ac_cv_user_prompt_PERSISTENT_DIRECTORY'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  echo "" >&6
+
+if test "x$defaults" = "xno"; then
+echo $ac_n "
+
+*** snmpd persistent storage location:
+
+	Enter a directory for the SNMP library to store persistent
+data in the form of a configuration file.  This default location is
+different than the old default location (which was for ucd-snmp).  If
+you stay with the new path, I'll ask you in a second if you wish to
+copy your files over to the new location (once only).  If you pick
+some other path than the default, you'll have to copy them yourself.
+There is nothing wrong with picking the old path ($ucddefaultstore) if
+you'd rather.
+  Providing the --with-persistent-directory=\"path\" parameter to
+./configure will avoid this prompt.
+
+Location to write persistent information ($defaultstore): $ac_c"
+read tmpinput
+if test "$tmpinput" = "" -a "$defaultstore" != ""; then
+  tmpinput="$defaultstore"
+fi
+eval PERSISTENT_DIRECTORY=\"$tmpinput\"
+else
+tmpinput="$defaultstore"
+eval PERSISTENT_DIRECTORY=\"$tmpinput\"
+fi
+
+
+eval ac_cv_user_prompt_PERSISTENT_DIRECTORY=\$PERSISTENT_DIRECTORY
+echo $ac_n "setting $MSG_CHECK to...  $ac_c" >&6
+
+fi
+
+echo "$ac_t""$ac_cv_user_prompt_PERSISTENT_DIRECTORY" 1>&6
+if test "$ac_cv_user_prompt_PERSISTENT_DIRECTORY" != "none"; then
+  if test "xquoted" = "xquoted" -o "xquoted" = "xQUOTED"; then
+    cat >> confdefs.h <<EOF
+#define PERSISTENT_DIRECTORY "$ac_cv_user_prompt_PERSISTENT_DIRECTORY"
+EOF
+
+  else
+    cat >> confdefs.h <<EOF
+#define PERSISTENT_DIRECTORY $ac_cv_user_prompt_PERSISTENT_DIRECTORY
+EOF
+
+  fi
+fi
+
+
+PERSISTENT_DIRECTORY=$ac_cv_user_prompt_PERSISTENT_DIRECTORY
+
+UCDPERSISTENT_DIRECTORY=$ucddefaultstore
+
+
+if test $PERSISTENT_DIRECTORY = "$defaultstore" -a -d "$ucddefaultstore" -a ! -d "$defaultstore" ; then
+echo $ac_n "checking If we should copy the old persistent directory""... $ac_c" 1>&6
+echo "configure:17930: checking If we should copy the old persistent directory" >&5
+if eval "test \"`echo '$''{'ac_cv_user_prompt_COPY_PERSISTENT_FILES'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+
+if test "x$defaults" = "xno"; then
+echo $ac_n "
+
+*** Copying old ucd-snmp persistent files to net-snmp persistent directory:
+
+	Would you like to copy the older ucd-snmp persistent files
+into your new net-snmp persistent file path?  This will functionally
+save all your ucd-snmp data and let it be used within the net-snmp
+tools.  This will only be done once when you run make install.  If you
+wish to do this, enter "yes" at the prompt.
+  Providing the --with-copy-persistent-files=\"no\" (or \"yes\")
+parameters to ./configure will avoid this prompt.
+
+Copy ucd-snmp data into the net-snmp data directory ("yes"): $ac_c"
+read tmpinput
+if test "$tmpinput" = "" -a ""yes"" != ""; then
+  tmpinput=""yes""
+fi
+eval ac_cv_user_prompt_COPY_PERSISTENT_FILES=\"$tmpinput\"
+else
+tmpinput=""yes""
+eval ac_cv_user_prompt_COPY_PERSISTENT_FILES=\"$tmpinput\"
+fi
+
+
+
+fi
+
+echo "$ac_t""$ac_cv_user_prompt_COPY_PERSISTENT_FILES" 1>&6
+else
+ac_cv_user_prompt_COPY_PERSISTENT_FILES="no"
+fi
+COPY_PERSISTENT_FILES="$ac_cv_user_prompt_COPY_PERSISTENT_FILES"
+
+
+
+
+trap '' 1 2 15
+cat > confcache <<\EOF
+# This file is a shell script that caches the results of configure
+# tests run on this system so they can be shared between configure
+# scripts and configure runs.  It is not useful on other systems.
+# If it contains results you don't want to keep, you may remove or edit it.
+#
+# By default, configure uses ./config.cache as the cache file,
+# creating it if it does not exist already.  You can give configure
+# the --cache-file=FILE option to use a different cache file; that is
+# what configure does when it calls configure scripts in
+# subdirectories, so they share the cache.
+# Giving --cache-file=/dev/null disables caching, for debugging configure.
+# config.status only pays attention to the cache file if you give it the
+# --recheck option to rerun configure.
+#
+EOF
+# The following way of writing the cache mishandles newlines in values,
+# but we know of no workaround that is simple, portable, and efficient.
+# So, don't put newlines in cache variables' values.
+# Ultrix sh set writes to stderr and can't be redirected directly,
+# and sets the high bit in the cache file unless we assign to the vars.
+(set) 2>&1 |
+  case `(ac_space=' '; set | grep ac_space) 2>&1` in
+  *ac_space=\ *)
+    # `set' does not quote correctly, so add quotes (double-quote substitution
+    # turns \\\\ into \\, and sed turns \\ into \).
+    sed -n \
+      -e "s/'/'\\\\''/g" \
+      -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p"
+    ;;
+  *)
+    # `set' quotes correctly as required by POSIX, so do not add quotes.
+    sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p'
+    ;;
+  esac >> confcache
+if cmp -s $cache_file confcache; then
+  :
+else
+  if test -w $cache_file; then
+    echo "updating cache $cache_file"
+    cat confcache > $cache_file
+  else
+    echo "not updating unwritable cache $cache_file"
+  fi
+fi
+rm -f confcache
+
+trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15
+
+test "x$prefix" = xNONE && prefix=$ac_default_prefix
+# Let make expand exec_prefix.
+test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
+
+# Any assignment to VPATH causes Sun make to only execute
+# the first set of double-colon rules, so remove it if not needed.
+# If there is a colon in the path, we need to keep it.
+if test "x$srcdir" = x.; then
+  ac_vpsub='/^[ 	]*VPATH[ 	]*=[^:]*$/d'
+fi
+
+trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15
+
+DEFS=-DHAVE_CONFIG_H
+
+# Without the "./", some shells look in PATH for config.status.
+: ${CONFIG_STATUS=./config.status}
+
+echo creating $CONFIG_STATUS
+rm -f $CONFIG_STATUS
+cat > $CONFIG_STATUS <<EOF
+#! /bin/sh
+# Generated automatically by configure.
+# Run this file to recreate the current configuration.
+# This directory was configured as follows,
+# on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
+#
+# $0 $ac_configure_args
+#
+# Compiler output produced by configure, useful for debugging
+# configure, is in ./config.log if it exists.
+
+ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]"
+for ac_option
+do
+  case "\$ac_option" in
+  -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
+    echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion"
+    exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;;
+  -version | --version | --versio | --versi | --vers | --ver | --ve | --v)
+    echo "$CONFIG_STATUS generated by autoconf version 2.13"
+    exit 0 ;;
+  -help | --help | --hel | --he | --h)
+    echo "\$ac_cs_usage"; exit 0 ;;
+  *) echo "\$ac_cs_usage"; exit 1 ;;
+  esac
+done
+
+ac_given_srcdir=$srcdir
+ac_given_INSTALL="$INSTALL"
+
+trap 'rm -fr `echo "
+ Makefile:Makefile.top:Makefile.in:Makefile.rules
+ snmplib/Makefile:Makefile.top:snmplib/Makefile.in:Makefile.rules:snmplib/Makefile.depend
+ apps/Makefile:Makefile.top:apps/Makefile.in:Makefile.rules:apps/Makefile.depend
+ apps/snmpnetstat/Makefile:Makefile.top:apps/snmpnetstat/Makefile.in:Makefile.rules:apps/snmpnetstat/Makefile.depend
+ agent/Makefile:Makefile.top:agent/Makefile.in:Makefile.rules:agent/Makefile.depend
+ agent/helpers/Makefile:Makefile.top:agent/helpers/Makefile.in:Makefile.rules:agent/helpers/Makefile.depend
+ agent/mibgroup/Makefile:Makefile.top:agent/mibgroup/Makefile.in:Makefile.rules:agent/mibgroup/Makefile.depend
+ local/Makefile:Makefile.top:local/Makefile.in:Makefile.rules
+ testing/Makefile:Makefile.top:testing/Makefile.in
+ man/Makefile:Makefile.top:man/Makefile.in:Makefile.rules
+ mibs/Makefile:Makefile.top:mibs/Makefile.in:Makefile.rules
+ net-snmp-config:net-snmp-config.in
+ include/net-snmp/net-snmp-config.h" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15
+EOF
+cat >> $CONFIG_STATUS <<EOF
+
+# Protect against being on the right side of a sed subst in config.status.
+sed 's/%@/@@/; s/@%/@@/; s/%g\$/@g/; /@g\$/s/[\\\\&%]/\\\\&/g;
+ s/@@/%@/; s/@@/@%/; s/@g\$/%g/' > conftest.subs <<\\CEOF
+$ac_vpsub
+$extrasub
+s%@SHELL@%$SHELL%g
+s%@CFLAGS@%$CFLAGS%g
+s%@CPPFLAGS@%$CPPFLAGS%g
+s%@CXXFLAGS@%$CXXFLAGS%g
+s%@FFLAGS@%$FFLAGS%g
+s%@DEFS@%$DEFS%g
+s%@LDFLAGS@%$LDFLAGS%g
+s%@LIBS@%$LIBS%g
+s%@exec_prefix@%$exec_prefix%g
+s%@prefix@%$prefix%g
+s%@program_transform_name@%$program_transform_name%g
+s%@bindir@%$bindir%g
+s%@sbindir@%$sbindir%g
+s%@libexecdir@%$libexecdir%g
+s%@datadir@%$datadir%g
+s%@sysconfdir@%$sysconfdir%g
+s%@sharedstatedir@%$sharedstatedir%g
+s%@localstatedir@%$localstatedir%g
+s%@libdir@%$libdir%g
+s%@includedir@%$includedir%g
+s%@oldincludedir@%$oldincludedir%g
+s%@infodir@%$infodir%g
+s%@mandir@%$mandir%g
+s%@CONFIGURE_OPTIONS@%$CONFIGURE_OPTIONS%g
+s%@LIBTOOLFLAGS@%$LIBTOOLFLAGS%g
+s%@HAVE_DMALLOC_H@%$HAVE_DMALLOC_H%g
+s%@WRAPLIBS@%$WRAPLIBS%g
+s%@installucdheaders@%$installucdheaders%g
+s%@installucdlibs@%$installucdlibs%g
+s%@CC@%$CC%g
+s%@CPP@%$CPP%g
+s%@EXEEXT@%$EXEEXT%g
+s%@host@%$host%g
+s%@host_alias@%$host_alias%g
+s%@host_cpu@%$host_cpu%g
+s%@host_vendor@%$host_vendor%g
+s%@host_os@%$host_os%g
+s%@build@%$build%g
+s%@build_alias@%$build_alias%g
+s%@build_cpu@%$build_cpu%g
+s%@build_vendor@%$build_vendor%g
+s%@build_os@%$build_os%g
+s%@LN_S@%$LN_S%g
+s%@OBJEXT@%$OBJEXT%g
+s%@ECHO@%$ECHO%g
+s%@RANLIB@%$RANLIB%g
+s%@STRIP@%$STRIP%g
+s%@DLLTOOL@%$DLLTOOL%g
+s%@AS@%$AS%g
+s%@OBJDUMP@%$OBJDUMP%g
+s%@LIBTOOL@%$LIBTOOL%g
+s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g
+s%@INSTALL_SCRIPT@%$INSTALL_SCRIPT%g
+s%@INSTALL_DATA@%$INSTALL_DATA%g
+s%@SET_MAKE@%$SET_MAKE%g
+s%@PSPROG@%$PSPROG%g
+s%@PERLPROG@%$PERLPROG%g
+s%@WHOAMI@%$WHOAMI%g
+s%@SED@%$SED%g
+s%@AUTOCONF@%$AUTOCONF%g
+s%@AUTOHEADER@%$AUTOHEADER%g
+s%@UNAMEPROG@%$UNAMEPROG%g
+s%@VERSION@%$VERSION%g
+s%@RELEASEVERSION@%$RELEASEVERSION%g
+s%@DEVFLAGS@%$DEVFLAGS%g
+s%@target@%$target%g
+s%@target_alias@%$target_alias%g
+s%@target_cpu@%$target_cpu%g
+s%@target_vendor@%$target_vendor%g
+s%@target_os@%$target_os%g
+s%@CCPATH@%$CCPATH%g
+s%@EXTRACPPFLAGS@%$EXTRACPPFLAGS%g
+s%@SNMPCONFPATH@%$SNMPCONFPATH%g
+s%@transport_hdr_list@%$transport_hdr_list%g
+s%@transport_src_list@%$transport_src_list%g
+s%@transport_obj_list@%$transport_obj_list%g
+s%@transport_lobj_list@%$transport_lobj_list%g
+s%@security_src_list@%$security_src_list%g
+s%@security_obj_list@%$security_obj_list%g
+s%@security_lobj_list@%$security_lobj_list%g
+s%@security_hdr_list@%$security_hdr_list%g
+s%@MODULE_LIST@%$MODULE_LIST%g
+s%@module_list_c@%$module_list_c%g
+s%@module_list_h@%$module_list_h%g
+s%@module_list_o@%$module_list_o%g
+s%@module_list_lo@%$module_list_lo%g
+s%@mibgroup_list_o@%$mibgroup_list_o%g
+s%@mibgroup_list_lo@%$mibgroup_list_lo%g
+s%@module_list@%$module_list%g
+s%@default_mibs_install@%$default_mibs_install%g
+s%@PERLTARGS@%$PERLTARGS%g
+s%@PERLINSTALLTARGS@%$PERLINSTALLTARGS%g
+s%@PERLARGS@%$PERLARGS%g
+s%@EMBEDPERLINSTALL@%$EMBEDPERLINSTALL%g
+s%@LPSTAT_PATH@%$LPSTAT_PATH%g
+s%@PSCMD@%$PSCMD%g
+s%@ALLOCA@%$ALLOCA%g
+s%@LIBOBJS@%$LIBOBJS%g
+s%@AGENTLIBS@%$AGENTLIBS%g
+s%@OTHERAGENTLIBOBJS@%$OTHERAGENTLIBOBJS%g
+s%@OTHERAGENTLIBLOBJS@%$OTHERAGENTLIBLOBJS%g
+s%@PERSISTENT_DIRECTORY@%$PERSISTENT_DIRECTORY%g
+s%@UCDPERSISTENT_DIRECTORY@%$UCDPERSISTENT_DIRECTORY%g
+s%@COPY_PERSISTENT_FILES@%$COPY_PERSISTENT_FILES%g
+s%@DLLIBS@%$DLLIBS%g
+
+CEOF
+EOF
+
+cat >> $CONFIG_STATUS <<\EOF
+
+# Split the substitutions into bite-sized pieces for seds with
+# small command number limits, like on Digital OSF/1 and HP-UX.
+ac_max_sed_cmds=90 # Maximum number of lines to put in a sed script.
+ac_file=1 # Number of current file.
+ac_beg=1 # First line for current file.
+ac_end=$ac_max_sed_cmds # Line after last line for current file.
+ac_more_lines=:
+ac_sed_cmds=""
+while $ac_more_lines; do
+  if test $ac_beg -gt 1; then
+    sed "1,${ac_beg}d; ${ac_end}q" conftest.subs > conftest.s$ac_file
+  else
+    sed "${ac_end}q" conftest.subs > conftest.s$ac_file
+  fi
+  if test ! -s conftest.s$ac_file; then
+    ac_more_lines=false
+    rm -f conftest.s$ac_file
+  else
+    if test -z "$ac_sed_cmds"; then
+      ac_sed_cmds="sed -f conftest.s$ac_file"
+    else
+      ac_sed_cmds="$ac_sed_cmds | sed -f conftest.s$ac_file"
+    fi
+    ac_file=`expr $ac_file + 1`
+    ac_beg=$ac_end
+    ac_end=`expr $ac_end + $ac_max_sed_cmds`
+  fi
+done
+if test -z "$ac_sed_cmds"; then
+  ac_sed_cmds=cat
+fi
+EOF
+
+cat >> $CONFIG_STATUS <<EOF
+
+CONFIG_FILES=\${CONFIG_FILES-"Makefile:Makefile.top:Makefile.in:Makefile.rules
+ snmplib/Makefile:Makefile.top:snmplib/Makefile.in:Makefile.rules:snmplib/Makefile.depend
+ apps/Makefile:Makefile.top:apps/Makefile.in:Makefile.rules:apps/Makefile.depend
+ apps/snmpnetstat/Makefile:Makefile.top:apps/snmpnetstat/Makefile.in:Makefile.rules:apps/snmpnetstat/Makefile.depend
+ agent/Makefile:Makefile.top:agent/Makefile.in:Makefile.rules:agent/Makefile.depend
+ agent/helpers/Makefile:Makefile.top:agent/helpers/Makefile.in:Makefile.rules:agent/helpers/Makefile.depend
+ agent/mibgroup/Makefile:Makefile.top:agent/mibgroup/Makefile.in:Makefile.rules:agent/mibgroup/Makefile.depend
+ local/Makefile:Makefile.top:local/Makefile.in:Makefile.rules
+ testing/Makefile:Makefile.top:testing/Makefile.in
+ man/Makefile:Makefile.top:man/Makefile.in:Makefile.rules
+ mibs/Makefile:Makefile.top:mibs/Makefile.in:Makefile.rules
+ net-snmp-config:net-snmp-config.in
+"}
+EOF
+cat >> $CONFIG_STATUS <<\EOF
+for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then
+  # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
+  case "$ac_file" in
+  *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'`
+       ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
+  *) ac_file_in="${ac_file}.in" ;;
+  esac
+
+  # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories.
+
+  # Remove last slash and all that follows it.  Not all systems have dirname.
+  ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'`
+  if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then
+    # The file is in a subdirectory.
+    test ! -d "$ac_dir" && mkdir "$ac_dir"
+    ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`"
+    # A "../" for each directory in $ac_dir_suffix.
+    ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'`
+  else
+    ac_dir_suffix= ac_dots=
+  fi
+
+  case "$ac_given_srcdir" in
+  .)  srcdir=.
+      if test -z "$ac_dots"; then top_srcdir=.
+      else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;;
+  /*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;;
+  *) # Relative path.
+    srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix"
+    top_srcdir="$ac_dots$ac_given_srcdir" ;;
+  esac
+
+  case "$ac_given_INSTALL" in
+  [/$]*) INSTALL="$ac_given_INSTALL" ;;
+  *) INSTALL="$ac_dots$ac_given_INSTALL" ;;
+  esac
+
+  echo creating "$ac_file"
+  rm -f "$ac_file"
+  configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure."
+  case "$ac_file" in
+  *Makefile*) ac_comsub="1i\\
+# $configure_input" ;;
+  *) ac_comsub= ;;
+  esac
+
+  ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"`
+  sed -e "$ac_comsub
+s%@configure_input@%$configure_input%g
+s%@srcdir@%$srcdir%g
+s%@top_srcdir@%$top_srcdir%g
+s%@INSTALL@%$INSTALL%g
+" $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file
+fi; done
+rm -f conftest.s*
+
+# These sed commands are passed to sed as "A NAME B NAME C VALUE D", where
+# NAME is the cpp macro being defined and VALUE is the value it is being given.
+#
+# ac_d sets the value in "#define NAME VALUE" lines.
+ac_dA='s%^\([ 	]*\)#\([ 	]*define[ 	][ 	]*\)'
+ac_dB='\([ 	][ 	]*\)[^ 	]*%\1#\2'
+ac_dC='\3'
+ac_dD='%g'
+# ac_u turns "#undef NAME" with trailing blanks into "#define NAME VALUE".
+ac_uA='s%^\([ 	]*\)#\([ 	]*\)undef\([ 	][ 	]*\)'
+ac_uB='\([ 	]\)%\1#\2define\3'
+ac_uC=' '
+ac_uD='\4%g'
+# ac_e turns "#undef NAME" without trailing blanks into "#define NAME VALUE".
+ac_eA='s%^\([ 	]*\)#\([ 	]*\)undef\([ 	][ 	]*\)'
+ac_eB='$%\1#\2define\3'
+ac_eC=' '
+ac_eD='%g'
+
+if test "${CONFIG_HEADERS+set}" != set; then
+EOF
+cat >> $CONFIG_STATUS <<EOF
+  CONFIG_HEADERS="include/net-snmp/net-snmp-config.h"
+EOF
+cat >> $CONFIG_STATUS <<\EOF
+fi
+for ac_file in .. $CONFIG_HEADERS; do if test "x$ac_file" != x..; then
+  # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
+  case "$ac_file" in
+  *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'`
+       ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
+  *) ac_file_in="${ac_file}.in" ;;
+  esac
+
+  echo creating $ac_file
+
+  rm -f conftest.frag conftest.in conftest.out
+  ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"`
+  cat $ac_file_inputs > conftest.in
+
+EOF
+
+# Transform confdefs.h into a sed script conftest.vals that substitutes
+# the proper values into config.h.in to produce config.h.  And first:
+# Protect against being on the right side of a sed subst in config.status.
+# Protect against being in an unquoted here document in config.status.
+rm -f conftest.vals
+cat > conftest.hdr <<\EOF
+s/[\\&%]/\\&/g
+s%[\\$`]%\\&%g
+s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD}%gp
+s%ac_d%ac_u%gp
+s%ac_u%ac_e%gp
+EOF
+sed -n -f conftest.hdr confdefs.h > conftest.vals
+rm -f conftest.hdr
+
+# This sed command replaces #undef with comments.  This is necessary, for
+# example, in the case of _POSIX_SOURCE, which is predefined and required
+# on some systems where configure will not decide to define it.
+cat >> conftest.vals <<\EOF
+s%^[ 	]*#[ 	]*undef[ 	][ 	]*[a-zA-Z_][a-zA-Z_0-9]*%/* & */%
+EOF
+
+# Break up conftest.vals because some shells have a limit on
+# the size of here documents, and old seds have small limits too.
+
+rm -f conftest.tail
+while :
+do
+  ac_lines=`grep -c . conftest.vals`
+  # grep -c gives empty output for an empty file on some AIX systems.
+  if test -z "$ac_lines" || test "$ac_lines" -eq 0; then break; fi
+  # Write a limited-size here document to conftest.frag.
+  echo '  cat > conftest.frag <<CEOF' >> $CONFIG_STATUS
+  sed ${ac_max_here_lines}q conftest.vals >> $CONFIG_STATUS
+  echo 'CEOF
+  sed -f conftest.frag conftest.in > conftest.out
+  rm -f conftest.in
+  mv conftest.out conftest.in
+' >> $CONFIG_STATUS
+  sed 1,${ac_max_here_lines}d conftest.vals > conftest.tail
+  rm -f conftest.vals
+  mv conftest.tail conftest.vals
+done
+rm -f conftest.vals
+
+cat >> $CONFIG_STATUS <<\EOF
+  rm -f conftest.frag conftest.h
+  echo "/* $ac_file.  Generated automatically by configure.  */" > conftest.h
+  cat conftest.in >> conftest.h
+  rm -f conftest.in
+  if cmp -s $ac_file conftest.h 2>/dev/null; then
+    echo "$ac_file is unchanged"
+    rm -f conftest.h
+  else
+    # Remove last slash and all that follows it.  Not all systems have dirname.
+      ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'`
+      if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then
+      # The file is in a subdirectory.
+      test ! -d "$ac_dir" && mkdir "$ac_dir"
+    fi
+    rm -f $ac_file
+    mv conftest.h $ac_file
+  fi
+fi; done
+
+EOF
+cat >> $CONFIG_STATUS <<EOF
+
+EOF
+cat >> $CONFIG_STATUS <<\EOF
+
+ echo timestamp > stamp-h
+ chmod 755 net-snmp-config
+
+exit 0
+EOF
+chmod +x $CONFIG_STATUS
+rm -fr confdefs* $ac_clean_files
+test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1
+
+
+
+  echo ""
+  echo "---------------------------------------------------------"
+  echo "            Net-SNMP configuration summary:"
+  echo "---------------------------------------------------------"
+  echo ""
+  cat configure-summary
+  echo ""
+  echo "---------------------------------------------------------"
+  echo ""
+
+
diff -Naur tomato/release/src/router/snmp/conf.sh tomato121/release/src/router/snmp/conf.sh
--- tomato/release/src/router/snmp/conf.sh	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/conf.sh	2008-04-22 19:02:31.000000000 +1000
@@ -0,0 +1,2 @@
+rm config.cache
+/bin/sh ./configure  --quiet --prefix=/tmp/snmp --host=mipsel --with-cc=mipsel-uclibc-gcc --with-ar=mipsel-uclibc-ar --with-endianness=little --with-cflags="-Os -pipe -DCAN_USE_SYSCTL=1" --enable-mini-agent --disable-debugging --disable-privacy --without-opaque-special-types --with-persistent-directory=/tmp/snmp-persist --with-default-snmp-version=3 --with-sys-contact=root --with-sys-location=Unknown --with-logfile=/dev/null --with-out-transports=UDPIPv6,TCPIPv6,AAL5PVC,IPX,TCP,Unix --enable-shared=no --enable-static --with-gnu-ld --enable-internal-md5 --with-copy-persistent-files=no --without-openssl --sysconfdir=/etc --with-mib-modules=mibII,host,mibII/ip,mibII/tcp,mibII/udp,mibII/icmp,mibII/var_route,mibII/kernel_linux,qos,ucd_snmp,ieee802dot11,avc802dot11 --with-out-mib-modules=snmpv3mibs,agent_mips,agentx,notification,utilities,target --disable-ipv6 --with-defaults --without-efence --without-rsaref --without-kmem-usage --without-rpm --without-dmalloc
diff -Naur tomato/release/src/router/snmp/COPYING tomato121/release/src/router/snmp/COPYING
--- tomato/release/src/router/snmp/COPYING	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/COPYING	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,149 @@
+Various copyrights apply to this package, listed in 4 separate parts
+below.  Please make sure that you read all the parts.  Up until 2001,
+the project was based at UC Davis, and the first part covers all code
+written during this time.  From 2001 onwards, the project has been
+based at SourceForge, and Networks Associates Technology, Inc hold the
+copyright on behalf of the wider Net-SNMP community, covering all
+derivative work done since then.  An additional copyright section has
+been added as Part 3 below also under a BSD license for the work
+contributed by Cambridge Broadband Ltd. to the project since 2001.
+An additional copyright section has been added as Part 4 below also
+under a BSD license for the work contributed by Sun Microsystems, Inc.
+to the project since 2003.
+
+Code has been contributed to this project by many people over
+the years it has been in development, and a full list of contributors
+can be found in the README file under the THANKS section.
+
+
+---- Part 1: CMU/UCD copyright notice: (BSD like) -----
+
+
+       Copyright 1989, 1991, 1992 by Carnegie Mellon University
+
+		  Derivative Work - 1996, 1998-2000
+Copyright 1996, 1998-2000 The Regents of the University of California
+
+			 All Rights Reserved
+
+Permission to use, copy, modify and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appears in all copies and
+that both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of CMU and The Regents of
+the University of California not be used in advertising or publicity
+pertaining to distribution of the software without specific written
+permission.
+
+CMU AND THE REGENTS OF THE UNIVERSITY OF CALIFORNIA DISCLAIM ALL
+WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS.  IN NO EVENT SHALL CMU OR
+THE REGENTS OF THE UNIVERSITY OF CALIFORNIA BE LIABLE FOR ANY SPECIAL,
+INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+FROM THE LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
+CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
+CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+
+---- Part 2: Networks Associates Technology, Inc copyright notice (BSD) -----
+
+Copyright (c) 2001-2003, Networks Associates Technology, Inc
+All rights reserved.
+ 
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+ 
+*  Redistributions of source code must retain the above copyright notice,
+   this list of conditions and the following disclaimer.
+ 
+*  Redistributions in binary form must reproduce the above copyright
+   notice, this list of conditions and the following disclaimer in the
+   documentation and/or other materials provided with the distribution.
+ 
+*  Neither the name of the Networks Associates Technology, Inc nor the
+   names of its contributors may be used to endorse or promote
+   products derived from this software without specific prior written
+   permission.
+ 
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS
+IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR
+CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+---- Part 3: Cambridge Broadband Ltd. copyright notice (BSD) -----
+
+Portions of this code are copyright (c) 2001-2003, Cambridge Broadband Ltd.
+All rights reserved.
+ 
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+ 
+*  Redistributions of source code must retain the above copyright notice,
+   this list of conditions and the following disclaimer.
+ 
+*  Redistributions in binary form must reproduce the above copyright
+   notice, this list of conditions and the following disclaimer in the
+   documentation and/or other materials provided with the distribution.
+ 
+*  The name of Cambridge Broadband Ltd. may not be used to endorse or
+   promote products derived from this software without specific prior
+   written permission.
+ 
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER ``AS IS'' AND ANY
+EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT HOLDER BE
+LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+---- Part 4: Sun Microsystems, Inc. copyright notice (BSD) -----
+
+Copyright © 2003 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 
+California 95054, U.S.A. All rights reserved.
+
+Use is subject to license terms below.
+
+This distribution may include materials developed by third parties.
+
+Sun, Sun Microsystems, the Sun logo and Solaris are trademarks or registered 
+trademarks of Sun Microsystems, Inc. in the U.S. and other countries.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+*  Redistributions of source code must retain the above copyright notice,
+    this list of conditions and the following disclaimer.
+
+*  Redistributions in binary form must reproduce the above copyright
+    notice, this list of conditions and the following disclaimer in the
+    documentation and/or other materials provided with the distribution.
+
+*  Neither the name of the Sun Microsystems, Inc. nor the
+    names of its contributors may be used to endorse or promote
+    products derived from this software without specific prior written
+    permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS
+IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR
+CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff -Naur tomato/release/src/router/snmp/.cvsignore tomato121/release/src/router/snmp/.cvsignore
--- tomato/release/src/router/snmp/.cvsignore	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/.cvsignore	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,2 @@
+EXAMPLE.conf
+sedscript
diff -Naur tomato/release/src/router/snmp/dist/.cvsignore tomato121/release/src/router/snmp/dist/.cvsignore
--- tomato/release/src/router/snmp/dist/.cvsignore	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/dist/.cvsignore	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1 @@
+rpm
diff -Naur tomato/release/src/router/snmp/dist/cvsshow tomato121/release/src/router/snmp/dist/cvsshow
--- tomato/release/src/router/snmp/dist/cvsshow	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/dist/cvsshow	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,46 @@
+#!/bin/bash
+#
+# $Id: cvsshow,v 1.1.2.1 2004/06/20 21:54:34 nikki Exp $
+#
+export CVS_RSH=ssh
+TAG=
+
+if [ $# -eq 0 ]; then
+	DIR=.
+else
+	if [ $# -ne 1 ]; then
+		echo "usage: $0 <working directory>"
+		exit
+	fi
+	DIR=$1
+fi
+
+if [ ! -d $DIR ]; then
+	echo "no such directory '$DIR'"
+	exit
+fi
+
+if [ ! -d $DIR/CVS ]; then
+	echo "'$DIR' has no CVS directory!"
+	exit
+fi
+
+if [ ! -f $DIR/CVS/Repository ]; then
+	echo "'$DIR' has no CVS/Repository!"
+	exit
+fi
+
+if [ ! -f $DIR/CVS/Root ]; then
+	echo "'$DIR' has no CVS/Root!"
+	exit
+fi
+
+if [ -f $DIR/CVS/Tag ]; then
+	TAG="-r `cat $DIR/CVS/Tag | cut -c 2-`"
+fi
+
+REP="`cat $DIR/CVS/Repository`"
+ROOT="`cat $DIR/CVS/Root`"
+
+echo "Directory $DIR is rooted at $ROOT, $TAG $REP..."
+echo "update with cvs -z3 -d $ROOT -q co $TAG -d $DIR $REP"
diff -Naur tomato/release/src/router/snmp/dist/cvsup tomato121/release/src/router/snmp/dist/cvsup
--- tomato/release/src/router/snmp/dist/cvsup	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/dist/cvsup	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,70 @@
+#!/bin/bash
+#
+# $Id: cvsup,v 1.1.2.1 2004/06/20 21:54:34 nikki Exp $
+#
+export CVS_RSH=ssh
+TAG=
+WO=0
+
+
+if [ $# -eq 0 ]; then
+    DIR=.
+else
+    if [ $# -ne 1 ]; then
+        echo "usage: $0 <working directory>"
+        exit
+    fi
+    DIR=$1
+fi
+
+if [ ! -d $DIR ]; then
+    echo "no such directory '$DIR'"
+    exit
+fi
+
+if [ ! -d $DIR/CVS ]; then
+    echo "'$DIR' has no CVS directory!"
+    exit
+fi
+
+if [ ! -f $DIR/CVS/Repository ]; then
+    echo "'$DIR' has no CVS/Repository!"
+    exit
+fi
+
+if [ ! -f $DIR/CVS/Root ]; then
+    echo "'$DIR' has no CVS/Root!"
+    exit
+fi
+
+if [ -f $DIR/CVS/Tag ]; then
+    TAG="-r `cat $DIR/CVS/Tag | cut -c 2-`"
+fi
+
+REP="`cat $DIR/CVS/Repository`"
+ROOT="`cat $DIR/CVS/Root`"
+
+if [ "x$DIR" = "x." ]; then
+    COMMAND="cvs -q -z3 -d $ROOT update -P -d $TAG"
+else
+    COMMAND="cvs -q -z3 -d $ROOT co $TAG -d $DIR $REP"
+fi
+
+if [ ! -w $DIR/CVS ]; then
+    if [ -O $DIR/CVS ]; then
+        WO=1
+        echo "Making $DIR writable"
+        chmod -R u+w $DIR
+    fi
+fi
+
+echo "Updating directory $DIR with $TAG $REP..."
+echo "$COMMAND"
+
+$COMMAND
+
+if [ $WO -eq 1 ]; then
+    echo "Making $DIR read-only"
+    chmod -R a-w $DIR
+fi
+
diff -Naur tomato/release/src/router/snmp/dist/Makefile tomato121/release/src/router/snmp/dist/Makefile
--- tomato/release/src/router/snmp/dist/Makefile	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/dist/Makefile	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,124 @@
+# ======================================================================
+# $Source: /repository/WRT54G/src/router/snmp/dist/Attic/Makefile,v $
+# $Revision: 1.1.2.1 $
+# $Date: 2004/06/20 21:54:34 $
+# $Author: nikki $
+# $Name: branch-nikki-snmp-end $
+# $State: Exp $
+# ======================================================================
+
+# Makefile for generating rpm package files (.rpm) for net-snmp.
+
+# GNU 'make'-specific features are used in this makefile.
+# Other makes may or may not work with it.
+# See http://www.gnu.org/manual/make/index.html for details.
+
+SHELL = /bin/sh
+
+# Define the RPM package name
+NAME = net-snmp
+
+# Define the default RPM release number.
+VERSION = 5.0.6
+RELEASE = 1
+
+VERSION_TAG=`echo Ext-$(VERSION) | sed 's/\./-/g;'`
+
+VER=$(VERSION)
+REL=$(RELEASE)
+
+# Define the RPM architecture, i.e., 'noarch', 'i386', 'i686', etc.
+ARCH = i386
+
+# Directory structure expected by 'rpm' program
+RPM_BASE := $(PWD)/rpm
+
+RPM_TREE := \
+    $(RPM_BASE)/BUILD \
+    $(RPM_BASE)/RPMS \
+    $(RPM_BASE)/SOURCES \
+    $(RPM_BASE)/SPECS \
+    $(RPM_BASE)/SRPMS
+
+.PHONY:	all clean gzip_tar rpm_files binary_rpm source_rpm
+
+all:	rpm_files
+
+# Delete all generated files.
+clean:
+	rm -rf $(RPM_BASE)
+
+# --------------------------------------------------------------------
+# Macros and rules for updating net-snmp-x.x.x.tar.gz.
+# 'rpm' expects a compressed archive (.tar.gz) of the source directory
+# to exist (in the rpm/SOURCES directory) before it is run.
+# --------------------------------------------------------------------
+CVSROOT = :pserver:anonymous@cvs.net-snmp.sourceforge.net:/cvsroot/net-snmp
+
+PKG_VER := $(NAME)-$(VER)
+
+GZIP_TAR := $(RPM_BASE)/SOURCES/$(PKG_VER).tar.gz
+
+gzip_tar:	$(GZIP_TAR)
+
+$(GZIP_TAR):	$(RPM_BASE)/SOURCES
+	@echo "Creating a compressed archive of the package's source files..."
+	(cd $(RPM_BASE)/SOURCES; \
+	cvs -d$(CVSROOT) login; \
+	cvs -z3 -d$(CVSROOT) export -r$(VERSION_TAG) $(NAME); \
+	mv $(NAME) $(PKG_VER); \
+	tar cf $(PKG_VER).tar $(PKG_VER); \
+	gzip $(PKG_VER).tar)
+	@echo "A compressed archive of the package's source-file tree has been created."
+
+# --------------------------------------------------------------------
+# Macros and rules for updating the binary and source RPM package files.
+# --------------------------------------------------------------------
+# Redefine '%_topdir' to allow an RPM package file to be built anywhere,
+# instead of in the /usr/src/redhat directory tree.
+#
+# Don't want 'rpmbuild' to strip your executable programs?
+# Then add this line:
+#   --define='_os_install_post /usr/lib/rpm/brp-compress' \
+# to the RPM_OPTS macro definition.  This will eliminate the 
+# stripping of binaries, but still retain the compression of
+# manual pages.
+#
+RPM_OPTS := \
+    --define='_topdir $(PWD)/rpm' \
+    --define='_includedir /usr/include/net-snmp' \
+    --define='version $(VER)' \
+    --define='release $(REL)' \
+    --target $(ARCH)
+
+SPEC_FILE  := $(NAME).spec
+RPM_SPEC   := $(RPM_BASE)/SPECS/$(SPEC_FILE)
+
+BINARY_RPM := $(RPM_BASE)/RPMS/$(ARCH)/$(PKG_VER)-$(REL).$(ARCH).rpm
+SOURCE_RPM := $(RPM_BASE)/SRPMS/$(PKG_VER)-$(REL).src.rpm
+
+rpm_files:	$(GZIP_TAR) binary_rpm source_rpm
+binary_rpm:	$(BINARY_RPM)
+source_rpm:	$(SOURCE_RPM)
+
+$(BINARY_RPM):	$(RPM_TREE) $(RPM_SPEC)
+	(cd $(RPM_BASE)/SPECS; \
+	rpmbuild -bb $(RPM_OPTS) $(SPEC_FILE))
+
+$(SOURCE_RPM):	$(RPM_TREE) $(RPM_SPEC)
+	(cd $(RPM_BASE)/SPECS; \
+	rpmbuild -bs $(RPM_OPTS) $(SPEC_FILE))
+
+$(RPM_SPEC):	$(RPM_BASE)/SPECS $(SPEC_FILE)
+	cp $(SPEC_FILE) $@
+
+$(RPM_TREE):
+	mkdir -p $@
+
+$(SPEC_FILE):
+	@echo "ERROR: missing '$(SPEC_FILE)' in the current directory"
+	@exit 1
+
+FORCE:
+
+# === End of Makefile === #
diff -Naur tomato/release/src/router/snmp/dist/net-snmp.spec tomato121/release/src/router/snmp/dist/net-snmp.spec
--- tomato/release/src/router/snmp/dist/net-snmp.spec	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/dist/net-snmp.spec	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,127 @@
+Summary: Tools and servers for the SNMP protocol
+Name: net-snmp
+Version: %version
+Release: %release
+URL: http://net-snmp.sourceforge.net/
+Copyright: BSDish
+Group: System Environment/Daemons
+Source: http://prdownloads.sourceforge.net/net-snmp/net-snmp-%{version}.tar.gz
+Prereq: openssl
+Obsoletes: cmu-snmp ucd-snmp ucd-snmp-utils
+BuildRoot: /tmp/%{name}-root
+Packager: The Net-SNMP Coders <http://sourceforge.net/projects/net-snmp/>
+%description
+
+Net-SNMP provides tools and libraries relating to the Simple Network
+Management Protocol including: An extensible agent, An SNMP library,
+tools to request or set information from SNMP agents, tools to
+generate and handle SNMP traps, etc.  Using SNMP you can check the
+status of a network of computers, routers, switches, servers, ... to
+evaluate the state of your network.
+
+%package devel
+Group: Development/Libraries
+Summary: The includes and static libraries from the Net-SNMP package.
+Requires: net-snmp = %{version}
+Obsoletes: cmu-snmp-devel ucd-snmp-devel
+
+%description devel
+The net-snmp-devel package contains headers and libraries which are
+useful for building SNMP applications, agents, and sub-agents.
+
+%prep
+%setup -q
+
+
+%build
+%configure --with-defaults --with-sys-contact="Unknown" \
+	--with-mib-modules="host disman/event-mib"      \
+	--with-sysconfdir="/etc/net-snmp"               \
+	--enable-shared					\
+	--with-cflags="$RPM_OPT_FLAGS"
+
+make
+
+%install
+# ----------------------------------------------------------------------
+# 'install' sets the current directory to _topdir/BUILD/{name}-{version}
+# ----------------------------------------------------------------------
+rm -rf $RPM_BUILD_ROOT
+
+%makeinstall
+
+# Remove 'snmpinform' from the temporary directory because it is a
+# symbolic link, which cannot be handled by the rpm installation process.
+%__rm -f $RPM_BUILD_ROOT%{_prefix}/bin/snmpinform
+
+%post
+# ----------------------------------------------------------------------
+# The 'post' script is executed just after the package is installed.
+# ----------------------------------------------------------------------
+# Create the symbolic link 'snmpinform' after all other files have
+# been installed.
+%__rm -f $RPM_INSTALL_PREFIX/bin/snmpinform
+%__ln_s $RPM_INSTALL_PREFIX/bin/snmptrap $RPM_INSTALL_PREFIX/bin/snmpinform
+
+# run ldconfig
+PATH="$PATH:/sbin" ldconfig -n $RPM_INSTALL_PREFIX/lib
+
+%preun
+# ----------------------------------------------------------------------
+# The 'preun' script is executed just before the package is erased.
+# ----------------------------------------------------------------------
+# Remove the symbolic link 'snmpinform' before anything else, in case
+# it is in a directory that rpm wants to remove (at present, it isn't).
+%__rm -f $RPM_INSTALL_PREFIX/bin/snmpinform
+
+%postun
+# ----------------------------------------------------------------------
+# The 'postun' script is executed just after the package is erased.
+# ----------------------------------------------------------------------
+PATH="$PATH:/sbin" ldconfig -n $RPM_INSTALL_PREFIX/lib
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+%files
+%defattr(-,root,root)
+
+# Install the following documentation in _defaultdocdir/{name}-{version}/
+%doc AGENT.txt ChangeLog CodingStyle COPYING
+%doc EXAMPLE.conf.def FAQ INSTALL NEWS PORTING TODO
+%doc README README.agentx README.hpux11 README.krb5
+%doc README.snmpv3 README.solaris README.thread README.win32
+	 
+%dir %{_datadir}/snmp/
+
+#%config(noreplace) /etc/net-snmp/snmpd.conf
+	 
+%{_datadir}/snmp/snmpconf-data
+
+%{_bindir}
+%{_sbindir}
+%{_mandir}/man1/*
+%{_mandir}/man5/*
+%{_mandir}/man8/*
+/usr/lib/*.so*
+
+%files devel
+%defattr(-,root,root)
+
+%{_includedir}
+%{_libdir}/*.a
+%{_libdir}/*.la
+%{_mandir}/man3/*
+
+%verifyscript
+echo "No additional verification is done for net-snmp"
+
+%changelog
+* Wed Oct 09 2002 Wes Hardaker <hardaker@users.sourceforge.net>
+- Incorperated most of Mark Harig's better version of the rpm spec and Makefile
+
+* Wed Oct 09 2002 Wes Hardaker <hardaker@users.sourceforge.net>
+- Made it possibly almost usable.
+
+* Mon Apr 22 2002 Robert Story <rstory@users.sourceforge.net>
+- created
diff -Naur tomato/release/src/router/snmp/dist/nsb-config tomato121/release/src/router/snmp/dist/nsb-config
--- tomato/release/src/router/snmp/dist/nsb-config	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/dist/nsb-config	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,83 @@
+#!/bin/bash
+#
+# $Id: nsb-config,v 1.1.2.1 2004/06/20 21:54:34 nikki Exp $
+# Author: Robert Story <rstory@freesnmp.com>
+#
+########################################################################
+########################################################################
+
+usage()
+{
+   echo "Usage: $0  [-d|-x] [-s SRCD]"
+   echo ""
+   echo " -s SRCDIR  : soure directory [$HOME/src/net-snmp-VERSION]"
+   echo ""
+   echo " -x : configure extra features for pre-release testing"
+   echo " -d : configure for binary distribution"
+   exit 1
+}
+
+#set -x
+
+
+#
+# find nsb-platform based on te path to this script
+#
+EXE_PATH=${0%nsb-config}
+EXE_PATH=${EXE_PATH%/}
+if [ -f $EXE_PATH/nsb-functions ];then
+   source $EXE_PATH/nsb-functions
+elif [ -f $HOME/bin/nsb-functions ]; then
+   source $HOME/bin/nsb-functions
+elif [ -f nsb-functions ];then
+   source nsb-functions
+else
+   echo "Cannot find nsb-functions in $EXE_PATH, $HOME/bin or $PWD"
+   exit 1
+fi
+
+
+########################################################################
+########################################################################
+NSB_CONFIG_ALL=2
+
+#      x)  x=$OPTARG ;;
+while getopts ds:x opt
+do
+    case "$opt" in
+      d)  NSB_CONFIG_ALL=0;;
+      s)  SRCD=$OPTARG ;;
+      x)  NSB_CONFIG_ALL=1;;
+      \?)# unknown flag
+        usage;;
+    esac
+done
+shift `expr $OPTIND - 1`
+
+if [ $NSB_CONFIG_ALL -eq 2 ]; then
+   echo "You must specify -d or -x"
+   usage
+fi
+
+if [ -z "$SRCD" ]; then
+   for x in . $HOME/src/net-snmp
+   do
+      if [ -f $x/configure ]; then
+         SRCD=$x
+         break
+      fi
+   done
+   if [ -z "$SRCD" ]; then
+      echo "Couldn't find a source directory. Please specify one for me."
+      usage
+   fi
+fi
+
+
+########################################################################
+########################################################################
+if [ $NSB_CONFIG_ALL -eq 0 ];then
+    nsb-config-dist $SRCD
+else
+    nsb-config-all $SRCD
+fi
diff -Naur tomato/release/src/router/snmp/dist/nsb-functions tomato121/release/src/router/snmp/dist/nsb-functions
--- tomato/release/src/router/snmp/dist/nsb-functions	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/dist/nsb-functions	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,398 @@
+#!/bin/bash
+#----------------------------------------------------------------------
+# $Id: nsb-functions,v 1.1.2.1 2004/06/20 21:54:35 nikki Exp $
+# Author: Robert Story <rstory@freesnmp.com>
+
+#----------------------------------------------------------------------
+#
+# Utility vars
+#
+NSB_BUILD_DIR=${NSB_BUILD_DIR:=""}
+NSB_SRC_DIR=${NSB_SRC_DIR:=""}
+NSB_INSTALL_DIR=${NSB_INSTALL_DIR:=""}
+NSB_QUIET=0
+NSB_PROMPT=0
+NSB_CLEAN=1
+NSB_CONFIG_ALL=0
+NSB_SKIP_CONFIG=0
+NSB_SKIP_BUILD=0
+NSB_SKIP_TEST=0
+NSB_SKIP_INSTALL=0
+NSB_DIST_TRANSPORTS="UDP TCP Unix"
+NSB_EXTRA_TRANSPORTS="Callback UDPIPv6 TCPIPv6 IPX"
+NSB_DIST_MODULES="host disman/event-mib smux"
+NSB_EXTRA_MODULES="examples examples/example testhandler smux Rmon disman/event-mib"
+NSB_EXTRA_CONFIG=${NSB_EXTRA_CONFIG:=""}
+NSB_VIEW=cat
+NSB_SCP=`which scp`
+NSB_PERL=
+#NSB_PERL=--enable-embedded-perl
+NSB_FLOW=
+DATE=`date +%y%m%d_%H%M`
+
+#----------------------------------------------------------------------
+#
+# Utility functions
+#
+
+nsb-abort()
+{
+   echo
+   echo "ABORTING: $@" >&2
+   exit 255
+}
+
+nsb-info()
+{
+   if [ $NSB_QUIET -ne 1 ]; then
+      echo $@
+   fi
+}
+
+nsb-prompt()
+{
+   if [ "x$1" = "x-f" ]; then
+      shift 1
+      tmp_nsb_prompt=1
+   else
+      tmp_nsb_prompt=$NSB_PROMPT
+   fi
+   if [ $tmp_nsb_prompt -eq 1 ]; then
+      echo $@
+      read nsb_prompt_dummy
+   else
+      echo "$@ (PROMPT SKIPPED)"
+   fi
+}
+
+nsb-flow()
+{
+    NSB_FLOW=$NSB_FLOW:$@
+    echo "Running $@" >&2
+}
+
+#----------------------------------------------------------------------
+#
+nsb-config-dist()
+{
+   nsb-flow config-dist
+   if [ $# -lt 1 ]; then
+      nsb-abort "usage: nsb-config-dist src_dir"
+   fi
+   ngc_src=$1
+   if [ ! -d $ngc_src ]; then
+      nsb-abort "$ngc_src does not exist!"
+   fi
+   if [ ! -d $ngc_src/agent/mibgroup ]; then
+      nsb-abort "agent/mibgroup directory in $ngc_src does not exist!"
+   fi
+
+   #
+   # some modules might be release specific, so make sure they
+   # exist before we send them off to configure
+   #
+   NSB_FINAL_MODULES=
+   for ncd_x in $NSB_DIST_MODULES
+   do
+	if [ -a $ngc_src/agent/mibgroup/$ncd_x.h ]; then
+		NSB_FINAL_MODULES="$NSB_FINAL_MODULES $ncd_x"
+	fi
+   done
+
+   #
+   # NOTE: for some reason, bash does not expand variables
+   # inside of single quotes, so use double quotes
+   #
+   echo $ngc_src/configure --with-sys-location=Unknown \
+      --disable-developer $NSB_EXTRA_CONFIG \
+      --with-sys-contact='System Administrator' \
+      --with-defaults --with-mib-modules="$NSB_FINAL_MODULES"
+   $ngc_src/configure --with-sys-location=Unknown \
+      --disable-developer $NSB_EXTRA_CONFIG \
+      --with-sys-contact='System Administrator' \
+      --with-defaults --with-mib-modules="$NSB_FINAL_MODULES"
+   # I'd like to add ' | tee nsb-config.$DATE' to save output, but then
+   # I'd lose the rc from configure, which I need... sigh
+   ngc_rc=$?
+   if [ $ngc_rc -ne 0 ];then
+      nsb-abort "Error during configure dist (rc=$ngc_rc)"
+   fi
+}
+
+nsb-config-all()
+{
+   nsb-flow config-all
+   if [ $# -lt 1 ]; then
+      nsb-abort "usage: nsb-config-with src_dir"
+   fi
+   ngc_src=$1
+   if [ ! -d $ngc_src ]; then
+      nsb-abort "$ngc_src does not exist!"
+   fi
+   if [ ! -d $ngc_src/agent/mibgroup ]; then
+      nsb-abort "agent/mibgroup directory in $ngc_src does not exist!"
+   fi
+
+   #
+   # System specific additions
+   #
+   case `uname -s` in
+
+   Linux)
+      NSB_EXTRA_TRANSPORTS="UDPIPv6 TCPIPv6 IPX"
+      ;;
+
+   Darwin)
+      ;;
+
+   *)
+      NSB_EXTRA_TRANSPORTS="UDPIPv6 TCPIPv6"
+      ;;
+   esac
+
+   #
+   # some modules might be release specific, so make sure they
+   # exist before we send them off to configure
+   #
+   NSB_FINAL_MODULES=
+   for ncd_x in $NSB_DIST_MODULES $NSB_EXTRA_MODULES
+   do
+	if [ -a $ngc_src/agent/mibgroup/$ncd_x.h ]; then
+		NSB_FINAL_MODULES="$NSB_FINAL_MODULES $ncd_x"
+	fi
+   done
+
+   #
+   # configure
+   #
+   # NOTE: for some reason, bash does not expand variables
+   # inside of single quotes, so use double quotes
+   #
+   echo $ngc_src/configure  --with-defaults \
+      --disable-developer $NSB_EXTRA_CONFIG \
+      "--with-mib-modules=$NSB_FINAL_MODULES" \
+      "--with-transports=$NSB_DIST_TRANSPORTS $NSB_EXTRA_TRANSPORTS" \
+       $NSB_PERL --enable-shared --with-libwrap
+   $ngc_src/configure  --with-defaults \
+      --disable-developer $NSB_EXTRA_CONFIG \
+      "--with-mib-modules=$NSB_FINAL_MODULES" \
+      "--with-transports=$NSB_DIST_TRANSPORTS $NSB_EXTRA_TRANSPORTS" \
+      $NSB_PERL --enable-shared --with-libwrap
+   # I'd like to add ' | tee nsb-config.$DATE' to save output, but then
+   # I'd lose the rc from configure, which I need... sigh
+   ngc_rc=$?
+   if [ $ngc_rc -ne 0 ];then
+      nsb-abort "Error during configure all (rc=$ngc_rc)"
+   fi
+}
+
+nsb-sysname()
+{
+   echo `uname -mrs | tr ' /' '__'`
+}
+
+nsb-zip()
+{
+   if [ $# -ne 3 ]; then
+      nsb-abort "usage: $0 release build_directory dest_dir"
+   fi
+
+   release=$1
+   build_dir=$2
+   dest_dir=$3
+
+   platform=`nsb-sysname`
+   build=$build_dir/$platform
+
+   if [ ! -d $build ]; then
+      nsb-abort "$build directory does not exist!"
+   fi
+
+   if [ ! -d $build/usr ]; then
+      nsb-abort "install directory $build/usr directory does not exist!"
+   fi
+
+   cd $build
+
+   rm -f $dest_dir/$release-$platform.tar
+   nsb-info "tar cf $dest_dir/$release-$platform.tar usr"
+   tar cf $dest_dir/$release-$platform.tar usr
+
+   nsb-info "gzip --best $dest_dir/$release-$platform.tar"
+   gzip --best $dest_dir/$release-$platform.tar
+
+   if [ $NSB_QUIET -ne 1 ]; then
+      ls -lt $dest_dir
+   fi
+}
+
+nsb-upload()
+{
+   nsb-flow upload
+   build_dir=$1
+   target=$2
+   dir=$PWD
+   cd $build_dir
+   $NSB_SCP config.log configure-summary nsb-make-all.* \
+                 $target
+   cd $dir
+}
+
+nsb-make()
+{
+   nsb-flow make $1
+   target=$1
+   shift 1
+   parms=$@
+
+   if [ -z $NSB_MAKE ];then
+      #nsb-info "Searching for GNU make (set NSB_MAKE to skip this step)"
+      for p in `echo $PATH | tr ':' ' '`
+      do
+         #echo $p
+         if [ -x $p/make ];then
+            dummy=`$p/make --version 2>&1 | grep GNU`
+            if [ $? -eq 0 ];then
+	       #nsb-info "using $p/make ($dummy)"
+               NSB_MAKE=$p/make
+               break
+            fi
+         fi
+         if [ -x $p/gmake ];then
+            dummy=`$p/gmake --version 2>&1 | grep GNU`
+            if [ $? -eq 0 ];then
+	       #nsb-info "using $p/gmake ($dummy)"
+               NSB_MAKE=$p/gmake
+               break
+            fi
+         fi
+      done
+      if [ -z $NSB_MAKE ];then
+         nsb-abort "GNU make not found. Set NSB_MAKE to your make executable."
+      fi
+   fi
+
+   nsb_make_OUTPUT=nsb-make-$target.$DATE
+   nsb-info "Making $target... (log is $nsb_make_OUTPUT)"
+   #
+   if [ "x$target" = "xall" ]; then
+      $NSB_MAKE NOAUTODEPS=y touchit 2>&1 | tee $nsb_make_OUTPUT
+   fi
+   $NSB_MAKE NOAUTODEPS=y start-flag $target $parms end-flag 2>&1 | tee -a $nsb_make_OUTPUT
+   # checking $? would only get us the rc from tee, which is useless
+
+   nsb-info "Checking for errors..."
+   egrep "[Ee]rror|FAIL|[Ww]arn|No |exists|\*\*\*" $nsb_make_OUTPUT \
+         > nsb-make-$target-allerrs.$DATE
+   # allow for a few exceptions
+   egrep -v "[Ww]arn|error(mib|\.3)" nsb-make-$target-allerrs.$DATE \
+         > nsb-make-$target-errs.$DATE
+   if [ -s nsb-make-$target-errs.$DATE ]; then
+      nsb-prompt "press enter to view errors"
+      grep ':' $nsb_make_OUTPUT >&2
+#      cat nsb-make-$target-allerrs.$DATE >&2
+      nsb-abort "Error(s) during make $target"
+   fi
+
+   if [ -f build-in-progress-flag ];then
+     nsb-abort "make $target incomplete"
+   fi
+}
+
+nsb-default-paths()
+{
+   if [ -z "$NSB_SRC_DIR" ]; then
+      NSB_SRC_DIR=$HOME/src/net-snmp-$VERSION
+   fi
+   if [ -z "$NSB_BUILD_DIR" ]; then
+      NSB_BUILD_DIR=$HOME/build
+   fi
+   if [ -z "$NSB_INSTALL_DIR" ]; then
+      NSB_INSTALL_DIR=$NSB_BUILD_DIR/usr/local
+   fi
+}
+
+nsb-build()
+{
+   if [ $# -lt 5 ]; then
+      nsb-abort "usage: $0 release src_dir build_directory dest_dir config_all_flag ($@)"
+   fi
+
+   nsb_config_all=0
+   release=$1
+   src_dir=$2
+   build_dir=$3
+   dest_dir=$4
+   nsb_config_all=$5
+   shift 5
+
+   nsb-flow build in $build_dir
+
+
+   if [ ! -d $src_dir ]; then
+      nsb-abort "$src_dir does not exist!"
+   fi
+
+   if [ ! -d $build_dir ]; then
+      mkdir $build_dir
+      if [ ! -d $build_dir ]; then
+         nsb-abort "$build_dir directory does not exist!"
+      fi
+   fi
+
+   nsb-info "Changing directories to $build_dir"
+   cd $build_dir
+
+   if [ $NSB_CLEAN -gt 0 ]; then
+      nsb-info "Cleaning up..."
+      if [ $NSB_CLEAN -eq 2 ];then
+        if [ "x$PWD" = "/" ]; then
+           nsb-abort "Not running rm -fR from /"
+        fi
+        nsb-info "rm -fR * .[a-zA-Z]* 2>&1 > /dev/null"
+        rm -fR * .[a-zA-Z]* 2>&1 > /dev/null
+      else
+        nsb-info "rm -fR nsb-* $dest_dir 2>&1 > /dev/null"
+        rm -fR nsb-* $dest_dir 2>&1 > /dev/null
+        if [ -f Makefile ]; then
+            nsb-make NOAUTODEPS=y distclean
+            nsb_build_rc=$?
+            if [ $nsb_build_rc -ne 0 ]; then
+                nsb-abort "Error during make distclean (rc=$nsb_build_rc)"
+            fi
+        fi
+      fi
+   fi
+
+   if [ $NSB_SKIP_CONFIG -ne 1 ]; then
+      nsb-info "Configuring... (log is nsb-config.$DATE)"
+      if [ $nsb_config_all -eq 0 ]; then
+          nsb-config-dist $src_dir
+      else
+          nsb-config-all $src_dir
+      fi
+      nsb-prompt "press enter to continue"
+   fi
+
+   if [ $NSB_SKIP_BUILD -eq 1 ]; then
+      nsb-info "Skipping 'make all'"
+   else
+      nsb-make all
+   fi
+
+   if [ $NSB_SKIP_TEST -eq 1 ]; then
+      nsb-info "Skipping 'make test'"
+   else
+      nsb-prompt "No errors found, press enter to run tests"
+      nsb-make test
+   fi
+
+   if [ $NSB_SKIP_INSTALL -eq 1 ]; then
+      nsb-info "Skipping 'make install'"
+   else
+      nsb-prompt "No errors found, press enter to install"
+      nsb-make install prefix=$dest_dir exec_prefix=$dest_dir
+   fi
+
+   return 0
+}
diff -Naur tomato/release/src/router/snmp/dist/nsb-nightly tomato121/release/src/router/snmp/dist/nsb-nightly
--- tomato/release/src/router/snmp/dist/nsb-nightly	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/dist/nsb-nightly	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,118 @@
+#!/bin/bash
+#
+# $Id: nsb-nightly,v 1.1.2.1 2004/06/20 21:54:35 nikki Exp $
+# Author: Robert Story <rstory@freesnmp.com>
+#
+########################################################################
+########################################################################
+
+usage()
+{
+   echo "Usage: $0  [optional params] VERSION"
+   echo ""
+   echo " optional params: [-x] [-s SRCD] [-b BUILDD] [-i INSTALLD]"
+   echo "                  [-h host] [-p path]"
+   echo " VERSION    : relase number (eg 5.0.3)"
+   echo " -s SRCDIR  : soure directory [$HOME/src/net-snmp-VERSION]"
+   echo " -b BUILDD  : build directory [$HOME/build/]"
+   echo "              NOTE-platform will be appended to build directory"
+   echo " -i INSTALLD: install directory [$HOME/build/\$PLATFORM/usr/local]"
+   echo ""
+   echo " -x : configure extra features for pre-release testing"
+   echo ""
+   echo " -h : host to upload results to"
+   echo " -p : path to upload results to"
+   exit 1
+}
+
+#set -x
+
+#
+# find nsb-platform based on te path to this script
+#
+EXE_PATH=${0%nsb-nightly}
+EXE_PATH=${EXE_PATH%/}
+if [ -f $EXE_PATH/nsb-functions ];then
+   source $EXE_PATH/nsb-functions
+elif [ -f $HOME/bin/nsb-functions ]; then
+   source $HOME/bin/nsb-functions
+   EXE_PATH=$HOME/bin
+elif [ -f nsb-functions ];then
+   source nsb-functions
+   EXE_APTH=$PWD
+else
+   echo "Cannot find nsb-functions in $EXE_PATH, $HOME/bin or $PWD"
+   exit 1
+fi
+
+if [ -f $HOME/.nsb-nightly ];then
+   source $HOME/.nsb-nightly
+fi
+
+########################################################################
+########################################################################
+
+# -c -d
+PARMS="$PARMS -r"
+NIGHTLY_VERBOSE=0
+
+while getopts b:i:s:xh:p:v opt
+do
+    case "$opt" in
+      b)  NSB_BUILD_DIR=$OPTARG;;
+      i)  PARMS="-i $OPTARG $PARMS";;
+      s)  NSB_SRC_DIR=$OPTARG;;
+      h)  PARMS="-h $OPTARG $PARMS";;
+      p)  PARMS="-p $OPTARG $PARMS";;
+      x)  PARMS="-x $PARMS";;
+      v)  NIGHTLY_VERBOSE=1;;
+      \?)# unknown flag
+        usage;;
+    esac
+done
+shift `expr $OPTIND - 1`
+
+if [ $# -ne 1 ]; then
+   echo "expecting 1 argument, got $# ($@)"
+   usage
+fi
+
+VERSION=$1
+
+nsb-default-paths
+
+PARMS="$PARMS -b $NSB_BUILD_DIR -s $NSB_SRC_DIR"
+
+# do this AFTER setting params... so we use same
+# dir that nsb-package will use
+if [ $NSB_SRC_DIR != $NSB_BUILD_DIR ];then
+   NSB_BUILD_DIR=$NSB_BUILD_DIR/$VERSION-`nsb-sysname`
+fi
+
+########################################################################
+########################################################################
+echo "Start: `date`"
+echo "Running nsb-package $PARMS $VERSION"
+if [ $NIGHTLY_VERBOSE = 1 ]; then
+    $EXE_PATH/nsb-package $PARMS $VERSION
+else
+    $EXE_PATH/nsb-package $PARMS $VERSION > /dev/null
+fi
+RC=$?
+if [ ! -z $NSB_SCP_HOST ]; then
+   nsb-upload $NSB_BUILD_DIR $NSB_SCP_HOST:$NSB_SCP_DEST/$VERSION-`nsb-sysname`
+fi
+echo "Finish: `date`"
+echo -n "Result: "
+case $RC in
+    0)  echo "Success!"
+        nsb-prompt "press enter to remove $NSB_BUILD_DIR"
+        if [ "x$NSB_BUILD_DIR" = "/" ]; then
+            nsb-abort "Not running rm -fR from /"
+        fi
+        /bin/rm -fR $NSB_BUILD_DIR > /dev/null 2>&1
+        ;;
+    *) echo "Error!";;
+esac
+
+exit $RC
diff -Naur tomato/release/src/router/snmp/dist/nsb-package tomato121/release/src/router/snmp/dist/nsb-package
--- tomato/release/src/router/snmp/dist/nsb-package	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/dist/nsb-package	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,125 @@
+#!/bin/bash
+#
+# $Id: nsb-package,v 1.1.2.1 2004/06/20 21:54:35 nikki Exp $
+# Author: Robert Story <rstory@freesnmp.com>
+#
+########################################################################
+########################################################################
+
+usage()
+{
+   echo "Usage: $0  [params] VERSION"
+   echo ""
+   echo "  params: [-c] [-d] [-P] [-s NSB_SRC_DIR] [-b BUILDD] [-i NSB_INSTALL_DIR]"
+   echo "          [-h host] [-p path]"
+   echo ""
+   echo " VERSION    : relase number (eg 5.0.3)"
+   echo " -s NSB_SRC_DIRIR  : soure directory [$HOME/src/net-snmp-VERSION]"
+   echo " -b BUILDD  : build directory [$HOME/build/]"
+   echo "              NOTE-platform will be appended to build directory"
+   echo " -i NSB_INSTALL_DIR: install directory [$HOME/build/\$PLATFORM/usr/local]"
+   echo ""
+   echo " -x : configure extra features for pre-release testing"
+   echo " -c : skip configure"
+   echo " -d : dirty build (don't make distclean)"
+   echo " -m : skip 'make all'"
+   echo " -P : pause at prompts in between stages"
+   echo " -r : remove build dir (rm -fR) before build"
+   echo " -R : remove build dir (rm -fR) after successful build"
+   echo " -t : skip 'make test'"
+   echo ""
+   echo " -h : host to upload results to"
+   echo " -p : path to upload results to"
+   exit 1
+}
+
+#trap exit SIGINT
+
+#set -x
+
+#
+# find nsb-platform based on te path to this script
+#
+EXE_PATH=${0%nsb-package}
+EXE_PATH=${EXE_PATH%/}
+if [ -f $EXE_PATH/nsb-functions ];then
+   source $EXE_PATH/nsb-functions
+elif [ -f $HOME/bin/nsb-functions ]; then
+   source $HOME/bin/nsb-functions
+   EXE_PATH=$HOME/bin
+elif [ -f nsb-functions ];then
+   source nsb-functions
+else
+   echo "Cannot find nsb-functions in $EXE_PATH, $HOME/bin or $PWD"
+   exit 1
+fi
+
+
+########################################################################
+########################################################################
+
+REMOVE_SUCCESS=0
+
+#      x)  x=$OPTARG ;;
+while getopts b:cdh:i:mPp:rRs:tx opt
+do
+    case "$opt" in
+      b)  NSB_BUILD_DIR=$OPTARG ;;
+      c)  NSB_SKIP_CONFIG=1 ;;
+      d)  NSB_CLEAN=0 ;;
+      h)  NSB_SCP_HOST=$OPTARG ;;
+      i)  NSB_INSTALL_DIR=$OPTARG ;;
+      m)  NSB_SKIP_BUILD=1 ;;
+      P)  NSB_PROMPT=1 ;;
+      p)  NSB_SCP_DEST=$OPTARG ;;
+      r)  NSB_CLEAN=2 ;;
+      R)  REMOVE_SUCCESS=1 ;;
+      s)  NSB_SRC_DIR=$OPTARG ;;
+      t)  NSB_SKIP_TEST=1 ;;
+      x)  NSB_CONFIG_ALL=1;;
+      \?)# unknown flag
+        usage;;
+    esac
+done
+shift `expr $OPTIND - 1`
+
+if [ $# -ne 1 ]; then
+   echo "expecting 1 argument, got $# ($@)"
+   usage
+fi
+
+if [ $NSB_CLEAN -eq 1 ]; then
+   if [ $NSB_SKIP_CONFIG -eq 1 ]; then
+      echo "A clean build also requires configuration (-d and -c"
+      echo "cannot both be specified)."
+      usage
+   fi
+fi
+
+VERSION=$1
+
+nsb-default-paths
+
+if [ $NSB_SRC_DIR != $NSB_BUILD_DIR ];then
+   NSB_BUILD_DIR=$NSB_BUILD_DIR/$VERSION-`nsb-sysname`
+fi
+
+
+########################################################################
+########################################################################
+nsb-prompt "press enter to build $NSB_SRC_DIR in $NSB_BUILD_DIR, and install in $NSB_INSTALL_DIR"
+nsb-build $VERSION $NSB_SRC_DIR $NSB_BUILD_DIR $NSB_INSTALL_DIR $NSB_CONFIG_ALL
+rc=$?
+if [ ! -z $NSB_SCP_HOST ]; then
+   nsb-upload $NSB_BUILD_DIR $NSB_SCP_HOST:$NSB_SCP_DEST/$VERSION-`nsb-sysname`
+fi
+if [ $rc -eq 0 ] && [ $REMOVE_SUCCESS -eq 1 ];then
+    nsb-prompt "press enter to remove $NSB_BUILD_DIR"
+    if [ "x$NSB_BUILD_DIR" = "/" ]; then
+       nsb-abort "Not running rm -fR from /"
+    fi
+    /bin/rm -fR $NSB_BUILD_DIR > /dev/null 2>&1
+fi
+
+nsb-prompt "press enter to exit with rc $RC"
+exit $rc
diff -Naur tomato/release/src/router/snmp/dist/nsb-platform tomato121/release/src/router/snmp/dist/nsb-platform
--- tomato/release/src/router/snmp/dist/nsb-platform	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/dist/nsb-platform	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,28 @@
+#!/bin/bash
+#
+# $Id: nsb-platform,v 1.1.2.1 2004/06/20 21:54:35 nikki Exp $
+# Author: Robert Story <rstory@freesnmp.com>
+#
+########################################################################
+########################################################################
+
+#
+# find nsb-platform based on te path to this script
+#
+EXE_PATH=${0%nsb-platform}
+EXE_PATH=${EXE_PATH%/}
+if [ -f $EXE_PATH/nsb-functions ];then
+   source $EXE_PATH/nsb-functions
+elif [ -f $HOME/bin/nsb-functions ]; then
+   source $HOME/bin/nsb-functions
+elif [ -f nsb-functions ];then
+   source nsb-functions
+else
+   echo "Cannot find nsb-functions in $EXE_PATH, $HOME/bin or $PWD"
+   exit 1
+fi
+
+########################################################################
+########################################################################
+
+nsb-sysname
diff -Naur tomato/release/src/router/snmp/dist/README.build-scripts tomato121/release/src/router/snmp/dist/README.build-scripts
--- tomato/release/src/router/snmp/dist/README.build-scripts	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/dist/README.build-scripts	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,108 @@
+******************************************************************************
+*
+* README.build-scripts
+*
+* Author: Robert Story <rstory@freesnmp.com>
+*
+* $Id: README.build-scripts,v 1.1.2.1 2004/06/20 21:54:34 nikki Exp $
+*
+******************************************************************************
+
+
+Introduction
+============
+
+The automated build script will automatically run configure, 'make all',
+'make test' and 'make install'. Log files are kept for each step, and the
+scripts should abort when errors occur.
+
+The usage of nsb-package is:
+
+ Usage: nsb-package [-c] [-d] [-p] [-s SRCD] [-b BUILDD] [-i INSTALLD] VERSION
+  
+    VERSION    : relase number (eg 5.0.3)
+    -s SRCDIR  : soure directory [$HOME/src/net-snmp-VERSION]
+    -b BUILDD  : build directory [$HOME/build/]
+                 NOTE-platform will be appended to build directory
+    -i INSTALLD: install directory [$HOME/build/\$PLATFORM/usr/local]
+   
+    -c : skip configure
+    -d : dirty build (don't make distclean)
+    -m : skip 'make all'
+    -p : don't pause at prompts in between stages
+    -t : skip 'make test'
+
+
+The defaults assume you have a 'src', 'build' and 'binaries' directory in
+your home directory.
+
+
+
+Recommended Procedure
+=====================
+
+1) Log into Sourceforge Compile Farm Server
+
+2) Update source (this will likely be automated in the future)
+
+   For example, for release 5.0.3:
+
+   $ cd ~/src
+   $ CVS_RSH=ssh cvs -d $USER@cvs.net-snmp.org:/cvsroot/net-snmp \
+         -q co -r Ext-5-0-3 -d ~/src/net-snmp-Ext-5-0-3 net-snmp
+
+3) Run the package script. 
+
+   $ $HOME/src/net-snmp-cvs/dist/nsb-package -r \
+        -s $HOME/src/net-snmp-5.0.5 5.0.5
+
+4) Create tarball (assuming no errors; see next section if there are errors)
+
+   $ cd ~/build/`nsb-platform`
+   $ tar cvf net-snmp-5.0.3-`nsb-platform`.tar usr
+   $ gzip --best *.tar
+
+5) Copy tarball to Sourceforge shell sever
+
+   $ scp *.gz net-snmp.sourceforge.net:~/binaries/
+
+6) Log out of compile farm server, log into shell server
+
+7) Upload to Sourceforge
+
+   $ ftp upload.sourceforge.net
+     >bin
+     >put *.gz
+
+8) Update binaries vi Sourceforge admin page
+
+
+
+Builds with errors
+==================
+
+Should you encounter a build error, you will most likely want to skip the
+'make distclean' and configure step (assuming the problem wasn't with
+configure!). To do this, specify the 'dirty' and 'skip configure' options:
+
+   $ nsb-package -p -d -c Ext-5-0-3
+
+
+Should the build succeed, but some tests fail during 'make test', you probably
+can to skip the test step to get to the install step:
+
+   $ nsb-package -p -d -c -t Ext-5-0-3
+
+
+OTHER PROBLEMS
+--------------
+* "Cannot find nsb-functions"
+  
+   It's a hack, but symlink nsb-functions and nsb-package to your local
+   bin directory ($HOME/bin).  I'm trying to think of a better solution.
+
+* "gcc: snmp_version.lo: No such file or directory"
+
+   This is a good indication that you have previously built in your
+   source directory. 'make distclean' in your source directory, or
+   check out a fresh new version from CVS.
diff -Naur tomato/release/src/router/snmp/dist/snmpd-init.d tomato121/release/src/router/snmp/dist/snmpd-init.d
--- tomato/release/src/router/snmp/dist/snmpd-init.d	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/dist/snmpd-init.d	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,73 @@
+#!/bin/sh
+#
+# snmpd	This shell script takes care of starting and stopping
+#	the net-snmp SNMP daemon
+#
+# chkconfig: - 26 74
+# description: snmpd is net-snmp SNMP daemon.
+
+# Source function library.
+. /etc/init.d/functions
+
+# Source networking configuration.
+. /etc/sysconfig/network
+
+# Check that networking is up.
+[ ${NETWORKING} = "no" ] && exit 0
+
+RETVAL=0
+name="snmpd"
+prog="/usr/local/sbin/snmpd"
+
+[ -x $prog -a -f /usr/local/share/snmp/snmpd.conf ] || exit 0
+
+start() {
+        # Start daemons.
+        echo -n $"Starting $name: "
+        daemon $prog
+	RETVAL=$?
+        echo
+        [ $RETVAL -eq 0 ] && touch /var/lock/subsys/$name
+	return $RETVAL
+}
+
+stop() {
+        # Stop daemons.
+        echo -n $"Shutting down $name: "
+	killproc $prog
+	RETVAL=$?
+        echo
+        [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/$name
+	return $RETVAL
+}
+
+# See how we were called.
+case "$1" in
+  start)
+	start
+        ;;
+  stop)
+	stop
+        ;;
+  status)
+	status $name
+	RETVAL=$?
+	;;
+  restart|reload)
+	stop
+	start
+	RETVAL=$?
+	;;
+  condrestart)
+	if [ -f /var/lock/subsys/$name ]; then
+	    stop
+	    start
+	    RETVAL=$?
+	fi
+	;;
+  *)
+        echo $"Usage: $0 {start|stop|restart|condrestart|status}"
+        exit 1
+esac
+
+exit $RETVAL
diff -Naur tomato/release/src/router/snmp/dotgdbinit tomato121/release/src/router/snmp/dotgdbinit
--- tomato/release/src/router/snmp/dotgdbinit	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/dotgdbinit	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,129 @@
+#
+# this file defines some utilities for printing various structures
+# found in the net-snmp source code.  You can source it from within
+# gdb and then use it to print variable chains, oids, etc directly
+# from memory.
+# 
+# as an example, consider the variables:
+#
+#   oid    *name;
+#   size_t name_len;
+#
+# normally display oids is difficult under gdb, and the best you can
+# do is to use x/12dw name or so to print the first 12 numbers of the
+# oid array.  however, with this file you can now use:
+#
+#   gdb> printoid name_len name
+#   .1.3.6.1.2.1.1.0
+#
+# which will print oids in a more readable fashion.  etc...
+#
+
+define initme
+  set $varindent = ""
+end
+
+define hookpost-run
+  initme
+end
+
+define printvarval
+  printf "value: "
+  if $arg0->type == 2
+    printf "int: %d\n", $arg0->val.integer
+  end
+  if $arg0->type == 4
+    printf "string: %s\n", $arg0->val.string
+  end
+  if $arg0->type == 5
+    printf "ASN NULL\n"
+  end
+  if $arg0->type == 6
+    printoid (($arg0->val_len)/sizeof(oid)) $arg0->val.objid
+  end
+  if $arg0->type == 128
+    printf "NO SUCH NAME\n"
+  end
+  if $arg0->type == 129
+    printf "NO SUCH INSTANCE\n"
+  end
+  if $arg0->type == 130
+    printf "END OF MIB VIEW\n"
+  end
+  if $arg0->type == 194
+    printf "AGENTX INCL RANGE: "
+    printoid (($arg0->val_len)/sizeof(oid)) $arg0->val.objid
+  end
+  if $arg0->type == 195
+    printf "AGENTX EXCL RANGE: "
+    printoid (($arg0->val_len)/sizeof(oid)) $arg0->val.objid
+  end
+end
+document printvarval
+  printvarval VARPTR
+  prints the value part of a net-snmp "struct variable".
+  This is called from inside printvar.
+end
+
+  
+
+define printvar
+  printf "%stype: %d\n", $varindent, $arg0->type
+  printf "%soid: ", $varindent
+  printoid $arg0->name_length $arg0->name
+  printf "%s", $varindent
+  printvarval $arg0
+end
+document printvar
+  printvar VARPTR
+  prints the variable information contained in a net-snmp struct
+  variable.  printvarval POINTER will print it's oid, value type and
+  value contents
+end
+
+define printvars
+  set $tmpcount = 1
+  set $tmpvar = $arg0
+  set $varindent = "  "
+  while $tmpvar != 0
+    printf "VARIABLE #%d\n", $tmpcount
+    printvar $tmpvar
+    set $tmpvar = $tmpvar->next_variable
+    set $tmpcount = $tmpcount + 1
+  end
+  set $varindent = ""
+end
+document printvars
+  printvars VARPTR
+  calls printvar repeatedly on a chain of variables, displaying all
+  the variables in a net-snmp struct variable chain.
+end
+
+define printoid
+  set $printoid_tmp = 0
+  while $printoid_tmp < $arg0
+    printf ".%d", $arg1[$printoid_tmp]
+    set $printoid_tmp = $printoid_tmp + 1
+  end
+  printf "\n"
+end
+document printoid
+  printoid LENGTH OIDPTR
+  prints an oid (.x.y.z...) given it's length and a pointer.
+end
+
+define poid
+  printoid $arg0_len $arg0
+end
+document poid
+  poid NAME
+  shorthand for 'printoid NAME_len NAME"
+end
+
+define poidl
+  printoid $arg0_length $arg0
+end
+document poidl
+  poid NAME
+  shorthand for 'printoid NAME_length NAME"
+end
diff -Naur tomato/release/src/router/snmp/doxygen.conf tomato121/release/src/router/snmp/doxygen.conf
--- tomato/release/src/router/snmp/doxygen.conf	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/doxygen.conf	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,838 @@
+# Doxyfile 1.2.11
+
+# This file describes the settings to be used by the documentation system
+# doxygen (www.doxygen.org) for a project
+#
+# All text after a hash (#) is considered a comment and will be ignored
+# The format is:
+#       TAG = value [value, ...]
+# For lists items can also be appended using:
+#       TAG += value [value, ...]
+# Values that contain spaces should be placed between quotes (" ")
+
+#---------------------------------------------------------------------------
+# General configuration options
+#---------------------------------------------------------------------------
+
+# The PROJECT_NAME tag is a single word (or a sequence of words surrounded 
+# by quotes) that should identify the project.
+
+PROJECT_NAME           = net-snmp
+
+# The PROJECT_NUMBER tag can be used to enter a project or revision number. 
+# This could be handy for archiving the generated documentation or 
+# if some version control system is used.
+
+PROJECT_NUMBER         = 5.0.8
+
+# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) 
+# base path where the generated documentation will be put. 
+# If a relative path is entered, it will be relative to the location 
+# where doxygen was started. If left blank the current directory will be used.
+
+OUTPUT_DIRECTORY       = docs
+
+# The OUTPUT_LANGUAGE tag is used to specify the language in which all 
+# documentation generated by doxygen is written. Doxygen will use this 
+# information to generate all constant output in the proper language. 
+# The default language is English, other supported languages are: 
+# Brazilian, Chinese, Croatian, Czech, Danish, Dutch, Finnish, French, 
+# German, Hungarian, Italian, Japanese, Korean, Norwegian, Polish, 
+# Portuguese, Romanian, Russian, Slovak, Slovene, Spanish and Swedish.
+
+OUTPUT_LANGUAGE        = English
+
+# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in 
+# documentation are documented, even if no documentation was available. 
+# Private class members and static file members will be hidden unless 
+# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES
+
+EXTRACT_ALL            = NO
+
+# If the EXTRACT_PRIVATE tag is set to YES all private members of a class 
+# will be included in the documentation.
+
+EXTRACT_PRIVATE        = NO
+
+# If the EXTRACT_STATIC tag is set to YES all static members of a file 
+# will be included in the documentation.
+
+EXTRACT_STATIC         = NO
+
+# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all 
+# undocumented members of documented classes, files or namespaces. 
+# If set to NO (the default) these members will be included in the 
+# various overviews, but no documentation section is generated. 
+# This option has no effect if EXTRACT_ALL is enabled.
+
+HIDE_UNDOC_MEMBERS     = NO
+
+# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all 
+# undocumented classes that are normally visible in the class hierarchy. 
+# If set to NO (the default) these class will be included in the various 
+# overviews. This option has no effect if EXTRACT_ALL is enabled.
+
+HIDE_UNDOC_CLASSES     = NO
+
+# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will 
+# include brief member descriptions after the members that are listed in 
+# the file and class documentation (similar to JavaDoc). 
+# Set to NO to disable this.
+
+BRIEF_MEMBER_DESC      = YES
+
+# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend 
+# the brief description of a member or function before the detailed description. 
+# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the 
+# brief descriptions will be completely suppressed.
+
+REPEAT_BRIEF           = YES
+
+# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then 
+# Doxygen will generate a detailed section even if there is only a brief 
+# description.
+
+ALWAYS_DETAILED_SEC    = YES
+
+# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full 
+# path before files name in the file list and in the header files. If set 
+# to NO the shortest path that makes the file name unique will be used.
+
+FULL_PATH_NAMES        = NO
+
+# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag 
+# can be used to strip a user defined part of the path. Stripping is 
+# only done if one of the specified strings matches the left-hand part of 
+# the path. It is allowed to use relative paths in the argument list.
+
+STRIP_FROM_PATH        = 
+
+# The INTERNAL_DOCS tag determines if documentation 
+# that is typed after a \internal command is included. If the tag is set 
+# to NO (the default) then the documentation will be excluded. 
+# Set it to YES to include the internal documentation.
+
+INTERNAL_DOCS          = NO
+
+# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will 
+# generate a class diagram (in Html and LaTeX) for classes with base or 
+# super classes. Setting the tag to NO turns the diagrams off.
+
+CLASS_DIAGRAMS         = YES
+
+# If the SOURCE_BROWSER tag is set to YES then a list of source files will 
+# be generated. Documented entities will be cross-referenced with these sources.
+
+SOURCE_BROWSER         = YES
+
+# Setting the INLINE_SOURCES tag to YES will include the body 
+# of functions and classes directly in the documentation.
+
+INLINE_SOURCES         = NO
+
+# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct 
+# doxygen to hide any special comment blocks from generated source code 
+# fragments. Normal C and C++ comments will always remain visible.
+
+STRIP_CODE_COMMENTS    = YES
+
+# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate 
+# file names in lower case letters. If set to YES upper case letters are also 
+# allowed. This is useful if you have classes or files whose names only differ 
+# in case and if your file system supports case sensitive file names. Windows 
+# users are adviced to set this option to NO.
+
+CASE_SENSE_NAMES       = YES
+
+# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter 
+# (but less readable) file names. This can be useful is your file systems 
+# doesn't support long names like on DOS, Mac, or CD-ROM.
+
+SHORT_NAMES            = NO
+
+# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen 
+# will show members with their full class and namespace scopes in the 
+# documentation. If set to YES the scope will be hidden.
+
+HIDE_SCOPE_NAMES       = NO
+
+# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen 
+# will generate a verbatim copy of the header file for each class for 
+# which an include is specified. Set to NO to disable this.
+
+VERBATIM_HEADERS       = YES
+
+# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen 
+# will put list of the files that are included by a file in the documentation 
+# of that file.
+
+SHOW_INCLUDE_FILES     = YES
+
+# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen 
+# will interpret the first line (until the first dot) of a JavaDoc-style 
+# comment as the brief description. If set to NO, the JavaDoc 
+# comments  will behave just like the Qt-style comments (thus requiring an 
+# explict @brief command for a brief description.
+
+JAVADOC_AUTOBRIEF      = YES
+
+# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented 
+# member inherits the documentation from any documented member that it 
+# reimplements.
+
+INHERIT_DOCS           = YES
+
+# If the INLINE_INFO tag is set to YES (the default) then a tag [inline] 
+# is inserted in the documentation for inline members.
+
+INLINE_INFO            = YES
+
+# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen 
+# will sort the (detailed) documentation of file and class members 
+# alphabetically by member name. If set to NO the members will appear in 
+# declaration order.
+
+SORT_MEMBER_DOCS       = YES
+
+# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC 
+# tag is set to YES, then doxygen will reuse the documentation of the first 
+# member in the group (if any) for the other members of the group. By default 
+# all members of a group must be documented explicitly.
+
+DISTRIBUTE_GROUP_DOC   = NO
+
+# The TAB_SIZE tag can be used to set the number of spaces in a tab. 
+# Doxygen uses this value to replace tabs by spaces in code fragments.
+
+TAB_SIZE               = 8
+
+# The GENERATE_TODOLIST tag can be used to enable (YES) or 
+# disable (NO) the todo list. This list is created by putting \todo 
+# commands in the documentation.
+
+GENERATE_TODOLIST      = YES
+
+# The GENERATE_TESTLIST tag can be used to enable (YES) or 
+# disable (NO) the test list. This list is created by putting \test 
+# commands in the documentation.
+
+GENERATE_TESTLIST      = YES
+
+# The GENERATE_BUGLIST tag can be used to enable (YES) or 
+# disable (NO) the bug list. This list is created by putting \bug 
+# commands in the documentation.
+
+GENERATE_BUGLIST       = YES
+
+# This tag can be used to specify a number of aliases that acts 
+# as commands in the documentation. An alias has the form "name=value". 
+# For example adding "sideeffect=\par Side Effects:\n" will allow you to 
+# put the command \sideeffect (or @sideeffect) in the documentation, which 
+# will result in a user defined paragraph with heading "Side Effects:". 
+# You can put \n's in the value part of an alias to insert newlines.
+
+ALIASES                = 
+
+# The ENABLED_SECTIONS tag can be used to enable conditional 
+# documentation sections, marked by \if sectionname ... \endif.
+
+ENABLED_SECTIONS       = 
+
+# The MAX_INITIALIZER_LINES tag determines the maximum number of lines 
+# the initial value of a variable or define consist of for it to appear in 
+# the documentation. If the initializer consists of more lines than specified 
+# here it will be hidden. Use a value of 0 to hide initializers completely. 
+# The appearance of the initializer of individual variables and defines in the 
+# documentation can be controlled using \showinitializer or \hideinitializer 
+# command in the documentation regardless of this setting.
+
+MAX_INITIALIZER_LINES  = 30
+
+# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C sources 
+# only. Doxygen will then generate output that is more tailored for C. 
+# For instance some of the names that are used will be different. The list 
+# of all members will be omitted, etc.
+
+OPTIMIZE_OUTPUT_FOR_C  = YES
+
+# Set the SHOW_USED_FILES tag to NO to disable the list of files generated 
+# at the bottom of the documentation of classes and structs. If set to YES the 
+# list will mention the files that were used to generate the documentation.
+
+SHOW_USED_FILES        = YES
+
+#---------------------------------------------------------------------------
+# configuration options related to warning and progress messages
+#---------------------------------------------------------------------------
+
+# The QUIET tag can be used to turn on/off the messages that are generated 
+# by doxygen. Possible values are YES and NO. If left blank NO is used.
+
+QUIET                  = YES
+
+# The WARNINGS tag can be used to turn on/off the warning messages that are 
+# generated by doxygen. Possible values are YES and NO. If left blank 
+# NO is used.
+
+WARNINGS               = YES
+
+# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings 
+# for undocumented members. If EXTRACT_ALL is set to YES then this flag will 
+# automatically be disabled.
+
+WARN_IF_UNDOCUMENTED   = YES
+
+# The WARN_FORMAT tag determines the format of the warning messages that 
+# doxygen can produce. The string should contain the $file, $line, and $text 
+# tags, which will be replaced by the file and line number from which the 
+# warning originated and the warning text.
+
+WARN_FORMAT            = 
+
+# The WARN_LOGFILE tag can be used to specify a file to which warning 
+# and error messages should be written. If left blank the output is written 
+# to stderr.
+
+WARN_LOGFILE           = 
+
+#---------------------------------------------------------------------------
+# configuration options related to the input files
+#---------------------------------------------------------------------------
+
+# The INPUT tag can be used to specify the files and/or directories that contain 
+# documented source files. You may enter file names like "myfile.cpp" or 
+# directories like "/usr/src/myproject". Separate the files or directories 
+# with spaces.
+
+INPUT                  = $(srcdir) $(srcdir)/agent $(srcdir)/snmplib $(srcdir)/agent/helpers $(srcdir)/agent/mibgroup/examples
+
+# If the value of the INPUT tag contains directories, you can use the 
+# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp 
+# and *.h) to filter out the source-files in the directories. If left 
+# blank all files are included.
+
+FILE_PATTERNS          = *.c *.h
+
+# The RECURSIVE tag can be used to turn specify whether or not subdirectories 
+# should be searched for input files as well. Possible values are YES and NO. 
+# If left blank NO is used.
+
+RECURSIVE              = NO
+
+# The EXCLUDE tag can be used to specify files and/or directories that should 
+# excluded from the INPUT source files. This way you can easily exclude a 
+# subdirectory from a directory tree whose root is specified with the INPUT tag.
+
+EXCLUDE                = 
+
+# If the value of the INPUT tag contains directories, you can use the 
+# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude 
+# certain files from those directories.
+
+EXCLUDE_PATTERNS       = 
+
+# The EXAMPLE_PATH tag can be used to specify one or more files or 
+# directories that contain example code fragments that are included (see 
+# the \include command).
+
+EXAMPLE_PATH           = $(srcdir)/agent/mibgroup/examples
+
+# If the value of the EXAMPLE_PATH tag contains directories, you can use the 
+# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp 
+# and *.h) to filter out the source-files in the directories. If left 
+# blank all files are included.
+
+EXAMPLE_PATTERNS       = 
+
+# The IMAGE_PATH tag can be used to specify one or more files or 
+# directories that contain image that are included in the documentation (see 
+# the \image command).
+
+IMAGE_PATH             = 
+
+# The INPUT_FILTER tag can be used to specify a program that doxygen should 
+# invoke to filter for each input file. Doxygen will invoke the filter program 
+# by executing (via popen()) the command <filter> <input-file>, where <filter> 
+# is the value of the INPUT_FILTER tag, and <input-file> is the name of an 
+# input file. Doxygen will then use the output that the filter program writes 
+# to standard output.
+
+INPUT_FILTER           = 
+
+# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using 
+# INPUT_FILTER) will be used to filter the input files when producing source 
+# files to browse.
+
+FILTER_SOURCE_FILES    = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the alphabetical class index
+#---------------------------------------------------------------------------
+
+# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index 
+# of all compounds will be generated. Enable this if the project 
+# contains a lot of classes, structs, unions or interfaces.
+
+ALPHABETICAL_INDEX     = NO
+
+# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then 
+# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns 
+# in which this list will be split (can be a number in the range [1..20])
+
+COLS_IN_ALPHA_INDEX    = 5
+
+# In case all classes in a project start with a common prefix, all 
+# classes will be put under the same header in the alphabetical index. 
+# The IGNORE_PREFIX tag can be used to specify one or more prefixes that 
+# should be ignored while generating the index headers.
+
+IGNORE_PREFIX          = 
+
+#---------------------------------------------------------------------------
+# configuration options related to the HTML output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_HTML tag is set to YES (the default) Doxygen will 
+# generate HTML output.
+
+GENERATE_HTML          = YES
+
+# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. 
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be 
+# put in front of it. If left blank `html' will be used as the default path.
+
+HTML_OUTPUT            = 
+
+# The HTML_HEADER tag can be used to specify a personal HTML header for 
+# each generated HTML page. If it is left blank doxygen will generate a 
+# standard header.
+
+HTML_HEADER            = 
+
+# The HTML_FOOTER tag can be used to specify a personal HTML footer for 
+# each generated HTML page. If it is left blank doxygen will generate a 
+# standard footer.
+
+HTML_FOOTER            = 
+
+# The HTML_STYLESHEET tag can be used to specify a user defined cascading 
+# style sheet that is used by each HTML page. It can be used to 
+# fine-tune the look of the HTML output. If the tag is left blank doxygen 
+# will generate a default style sheet
+
+HTML_STYLESHEET        = 
+
+# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes, 
+# files or namespaces will be aligned in HTML using tables. If set to 
+# NO a bullet list will be used.
+
+HTML_ALIGN_MEMBERS     = YES
+
+# If the GENERATE_HTMLHELP tag is set to YES, additional index files 
+# will be generated that can be used as input for tools like the 
+# Microsoft HTML help workshop to generate a compressed HTML help file (.chm) 
+# of the generated HTML documentation.
+
+GENERATE_HTMLHELP      = NO
+
+# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag 
+# controls if a separate .chi index file is generated (YES) or that 
+# it should be included in the master .chm file (NO).
+
+GENERATE_CHI           = NO
+
+# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag 
+# controls whether a binary table of contents is generated (YES) or a 
+# normal table of contents (NO) in the .chm file.
+
+BINARY_TOC             = NO
+
+# The TOC_EXPAND flag can be set to YES to add extra items for group members 
+# to the contents of the Html help documentation and to the tree view.
+
+TOC_EXPAND             = NO
+
+# The DISABLE_INDEX tag can be used to turn on/off the condensed index at 
+# top of each HTML page. The value NO (the default) enables the index and 
+# the value YES disables it.
+
+DISABLE_INDEX          = NO
+
+# This tag can be used to set the number of enum values (range [1..20]) 
+# that doxygen will group on one line in the generated HTML documentation.
+
+ENUM_VALUES_PER_LINE   = 4
+
+# If the GENERATE_TREEVIEW tag is set to YES, a side panel will be
+# generated containing a tree-like index structure (just like the one that 
+# is generated for HTML Help). For this to work a browser that supports 
+# JavaScript and frames is required (for instance Netscape 4.0+ 
+# or Internet explorer 4.0+).
+
+GENERATE_TREEVIEW      = NO
+
+# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be 
+# used to set the initial width (in pixels) of the frame in which the tree 
+# is shown.
+
+TREEVIEW_WIDTH         = 250
+
+#---------------------------------------------------------------------------
+# configuration options related to the LaTeX output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will 
+# generate Latex output.
+
+GENERATE_LATEX         = YES
+
+# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. 
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be 
+# put in front of it. If left blank `latex' will be used as the default path.
+
+LATEX_OUTPUT           = 
+
+# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact 
+# LaTeX documents. This may be useful for small projects and may help to 
+# save some trees in general.
+
+COMPACT_LATEX          = NO
+
+# The PAPER_TYPE tag can be used to set the paper type that is used 
+# by the printer. Possible values are: a4, a4wide, letter, legal and 
+# executive. If left blank a4wide will be used.
+
+PAPER_TYPE             = a4wide
+
+# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX 
+# packages that should be included in the LaTeX output.
+
+EXTRA_PACKAGES         = 
+
+# The LATEX_HEADER tag can be used to specify a personal LaTeX header for 
+# the generated latex document. The header should contain everything until 
+# the first chapter. If it is left blank doxygen will generate a 
+# standard header. Notice: only use this tag if you know what you are doing!
+
+LATEX_HEADER           = 
+
+# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated 
+# is prepared for conversion to pdf (using ps2pdf). The pdf file will 
+# contain links (just like the HTML output) instead of page references 
+# This makes the output suitable for online browsing using a pdf viewer.
+
+PDF_HYPERLINKS         = NO
+
+# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of 
+# plain latex in the generated Makefile. Set this option to YES to get a 
+# higher quality PDF documentation.
+
+USE_PDFLATEX           = NO
+
+# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode. 
+# command to the generated LaTeX files. This will instruct LaTeX to keep 
+# running if errors occur, instead of asking the user for help. 
+# This option is also used when generating formulas in HTML.
+
+LATEX_BATCHMODE        = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the RTF output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output 
+# The RTF output is optimised for Word 97 and may not look very pretty with 
+# other RTF readers or editors.
+
+GENERATE_RTF           = NO
+
+# The RTF_OUTPUT tag is used to specify where the RTF docs will be put. 
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be 
+# put in front of it. If left blank `rtf' will be used as the default path.
+
+RTF_OUTPUT             = 
+
+# If the COMPACT_RTF tag is set to YES Doxygen generates more compact 
+# RTF documents. This may be useful for small projects and may help to 
+# save some trees in general.
+
+COMPACT_RTF            = NO
+
+# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated 
+# will contain hyperlink fields. The RTF file will 
+# contain links (just like the HTML output) instead of page references. 
+# This makes the output suitable for online browsing using WORD or other 
+# programs which support those fields. 
+# Note: wordpad (write) and others do not support links.
+
+RTF_HYPERLINKS         = NO
+
+# Load stylesheet definitions from file. Syntax is similar to doxygen's 
+# config file, i.e. a series of assigments. You only have to provide 
+# replacements, missing definitions are set to their default value.
+
+RTF_STYLESHEET_FILE    = 
+
+# Set optional variables used in the generation of an rtf document. 
+# Syntax is similar to doxygen's config file.
+
+RTF_EXTENSIONS_FILE    = 
+
+#---------------------------------------------------------------------------
+# configuration options related to the man page output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_MAN tag is set to YES (the default) Doxygen will 
+# generate man pages
+
+GENERATE_MAN           = YES
+
+# The MAN_OUTPUT tag is used to specify where the man pages will be put. 
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be 
+# put in front of it. If left blank `man' will be used as the default path.
+
+MAN_OUTPUT             = 
+
+# The MAN_EXTENSION tag determines the extension that is added to 
+# the generated man pages (default is the subroutine's section .3)
+
+MAN_EXTENSION          = 
+
+# If the MAN_LINKS tag is set to YES and Doxygen generates man output,
+# then it will generate one additional man file for each entity
+# documented in the real man page(s). These additional files
+# only source the real man page, but without them the man command
+# would be unable to find the correct page. The default is NO.
+
+MAN_LINKS              = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the XML output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_XML tag is set to YES Doxygen will 
+# generate an XML file that captures the structure of 
+# the code including all documentation. Note that this 
+# feature is still experimental and incomplete at the 
+# moment.
+
+GENERATE_XML           = NO
+
+#---------------------------------------------------------------------------
+# Configuration options related to the preprocessor   
+#---------------------------------------------------------------------------
+
+# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will 
+# evaluate all C-preprocessor directives found in the sources and include 
+# files.
+
+ENABLE_PREPROCESSING   = YES
+
+# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro 
+# names in the source code. If set to NO (the default) only conditional 
+# compilation will be performed. Macro expansion can be done in a controlled 
+# way by setting EXPAND_ONLY_PREDEF to YES.
+
+MACRO_EXPANSION        = NO
+
+# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES 
+# then the macro expansion is limited to the macros specified with the 
+# PREDEFINED and EXPAND_AS_PREDEFINED tags.
+
+EXPAND_ONLY_PREDEF     = NO
+
+# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files 
+# in the INCLUDE_PATH (see below) will be search if a #include is found.
+
+SEARCH_INCLUDES        = YES
+
+# The INCLUDE_PATH tag can be used to specify one or more directories that 
+# contain include files that are not input files but should be processed by 
+# the preprocessor.
+
+INCLUDE_PATH           = 
+
+# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard 
+# patterns (like *.h and *.hpp) to filter out the header-files in the 
+# directories. If left blank, the patterns specified with FILE_PATTERNS will 
+# be used.
+
+INCLUDE_FILE_PATTERNS  = 
+
+# The PREDEFINED tag can be used to specify one or more macro names that 
+# are defined before the preprocessor is started (similar to the -D option of 
+# gcc). The argument of the tag is a list of macros of the form: name 
+# or name=definition (no spaces). If the definition and the = are 
+# omitted =1 is assumed.
+
+PREDEFINED             = DOXYGEN_SHOULD_SKIP_THIS
+
+# If the MACRO_EXPANSION and EXPAND_PREDEF_ONLY tags are set to YES then 
+# this tag can be used to specify a list of macro names that should be expanded. 
+# The macro definition that is found in the sources will be used. 
+# Use the PREDEFINED tag if you want to use a different macro definition.
+
+EXPAND_AS_DEFINED      = 
+
+# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then 
+# doxygen's preprocessor will remove all function-like macros that are alone 
+# on a line and do not end with a semicolon. Such function macros are typically 
+# used for boiler-plate code, and will confuse the parser if not removed.
+
+SKIP_FUNCTION_MACROS   = YES
+
+#---------------------------------------------------------------------------
+# Configuration::addtions related to external references   
+#---------------------------------------------------------------------------
+
+# The TAGFILES tag can be used to specify one or more tagfiles.
+
+TAGFILES               = 
+
+# When a file name is specified after GENERATE_TAGFILE, doxygen will create 
+# a tag file that is based on the input files it reads.
+
+GENERATE_TAGFILE       = 
+
+# If the ALLEXTERNALS tag is set to YES all external classes will be listed 
+# in the class index. If set to NO only the inherited external classes 
+# will be listed.
+
+ALLEXTERNALS           = NO
+
+# The PERL_PATH should be the absolute path and name of the perl script 
+# interpreter (i.e. the result of `which perl').
+
+PERL_PATH              = 
+
+#---------------------------------------------------------------------------
+# Configuration options related to the dot tool   
+#---------------------------------------------------------------------------
+
+# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is 
+# available from the path. This tool is part of Graphviz, a graph visualization 
+# toolkit from AT&T and Lucent Bell Labs. The other options in this section 
+# have no effect if this option is set to NO (the default)
+
+HAVE_DOT               = NO
+
+# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen 
+# will generate a graph for each documented class showing the direct and 
+# indirect inheritance relations. Setting this tag to YES will force the 
+# the CLASS_DIAGRAMS tag to NO.
+
+CLASS_GRAPH            = YES
+
+# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen 
+# will generate a graph for each documented class showing the direct and 
+# indirect implementation dependencies (inheritance, containment, and 
+# class references variables) of the class with other documented classes.
+
+COLLABORATION_GRAPH    = YES
+
+# If set to YES, the inheritance and collaboration graphs will show the 
+# relations between templates and their instances.
+
+TEMPLATE_RELATIONS     = YES
+
+# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT 
+# tags are set to YES then doxygen will generate a graph for each documented 
+# file showing the direct and indirect include dependencies of the file with 
+# other documented files.
+
+INCLUDE_GRAPH          = YES
+
+# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and 
+# HAVE_DOT tags are set to YES then doxygen will generate a graph for each 
+# documented header file showing the documented files that directly or 
+# indirectly include this file.
+
+INCLUDED_BY_GRAPH      = YES
+
+# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen 
+# will graphical hierarchy of all classes instead of a textual one.
+
+GRAPHICAL_HIERARCHY    = YES
+
+# The tag DOT_PATH can be used to specify the path where the dot tool can be 
+# found. If left blank, it is assumed the dot tool can be found on the path.
+
+DOT_PATH               = 
+
+# The DOTFILE_DIRS tag can be used to specify one or more directories that 
+# contain dot files that are included in the documentation (see the 
+# \dotfile command).
+
+DOTFILE_DIRS           = 
+
+# The MAX_DOT_GRAPH_WIDTH tag can be used to set the maximum allowed width 
+# (in pixels) of the graphs generated by dot. If a graph becomes larger than 
+# this value, doxygen will try to truncate the graph, so that it fits within 
+# the specified constraint. Beware that most browsers cannot cope with very 
+# large images.
+
+MAX_DOT_GRAPH_WIDTH    = 1024
+
+# The MAX_DOT_GRAPH_HEIGHT tag can be used to set the maximum allows height 
+# (in pixels) of the graphs generated by dot. If a graph becomes larger than 
+# this value, doxygen will try to truncate the graph, so that it fits within 
+# the specified constraint. Beware that most browsers cannot cope with very 
+# large images.
+
+MAX_DOT_GRAPH_HEIGHT   = 1024
+
+# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will 
+# generate a legend page explaining the meaning of the various boxes and 
+# arrows in the dot generated graphs.
+
+GENERATE_LEGEND        = YES
+
+# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will 
+# remove the intermedate dot files that are used to generate 
+# the various graphs.
+
+DOT_CLEANUP            = YES
+
+#---------------------------------------------------------------------------
+# Configuration::addtions related to the search engine   
+#---------------------------------------------------------------------------
+
+# The SEARCHENGINE tag specifies whether or not a search engine should be 
+# used. If set to NO the values of all tags below this one will be ignored.
+
+SEARCHENGINE           = NO
+
+# The CGI_NAME tag should be the name of the CGI script that 
+# starts the search engine (doxysearch) with the correct parameters. 
+# A script with this name will be generated by doxygen.
+
+CGI_NAME               = 
+
+# The CGI_URL tag should be the absolute URL to the directory where the 
+# cgi binaries are located. See the documentation of your http daemon for 
+# details.
+
+CGI_URL                = 
+
+# The DOC_URL tag should be the absolute URL to the directory where the 
+# documentation is located. If left blank the absolute path to the 
+# documentation, with file:// prepended to it, will be used.
+
+DOC_URL                = 
+
+# The DOC_ABSPATH tag should be the absolute path to the directory where the 
+# documentation is located. If left blank the directory on the local machine 
+# will be used.
+
+DOC_ABSPATH            = 
+
+# The BIN_ABSPATH tag must point to the directory where the doxysearch binary 
+# is installed.
+
+BIN_ABSPATH            = 
+
+# The EXT_DOC_PATHS tag can be used to specify one or more paths to 
+# documentation generated for other projects. This allows doxysearch to search 
+# the documentation for these projects as well.
+
+EXT_DOC_PATHS          = 
diff -Naur tomato/release/src/router/snmp/EXAMPLE.conf.def tomato121/release/src/router/snmp/EXAMPLE.conf.def
--- tomato/release/src/router/snmp/EXAMPLE.conf.def	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/EXAMPLE.conf.def	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,417 @@
+###############################################################################
+#
+# EXAMPLE.conf:
+#   An example configuration file for configuring the ucd-snmp snmpd agent.
+#
+###############################################################################
+#
+# This file is intended to only be an example.  If, however, you want
+# to use it, it should be placed in SYSCONFDIR/share/snmp/snmpd.conf.
+# When the snmpd agent starts up, this is where it will look for it.
+#
+# You might be interested in generating your own snmpd.conf file using
+# the "snmpconf" program (perl script) instead.  It's a nice menu
+# based interface to writing well commented configuration files.  Try it!
+#
+# Note: This file is automatically generated from EXAMPLE.conf.def.
+# Do NOT read the EXAMPLE.conf.def file! Instead, after you have run
+# configure & make, and then make sure you read the EXAMPLE.conf file
+# instead, as it will tailor itself to your configuration.
+
+# All lines beginning with a '#' are comments and are intended for you
+# to read.  All other lines are configuration commands for the agent.
+
+#
+# PLEASE: read the snmpd.conf(5) manual page as well!
+#
+
+
+###############################################################################
+# Access Control
+###############################################################################
+
+# YOU SHOULD CHANGE THE "COMMUNITY" TOKEN BELOW TO A NEW KEYWORD ONLY
+# KNOWN AT YOUR SITE.  YOU *MUST* CHANGE THE NETWORK TOKEN BELOW TO
+# SOMETHING REFLECTING YOUR LOCAL NETWORK ADDRESS SPACE.
+
+# By far, the most common question I get about the agent is "why won't
+# it work?", when really it should be "how do I configure the agent to
+# allow me to access it?"
+#
+# By default, the agent responds to the "public" community for read
+# only access, if run out of the box without any configuration file in 
+# place.  The following examples show you other ways of configuring
+# the agent so that you can change the community names, and give
+# yourself write access as well.
+#
+# The following lines change the access permissions of the agent so
+# that the COMMUNITY string provides read-only access to your entire
+# NETWORK (EG: 10.10.10.0/24), and read/write access to only the
+# localhost (127.0.0.1, not its real ipaddress).
+#
+# For more information, read the FAQ as well as the snmpd.conf(5)
+# manual page.
+
+####
+# First, map the community name (COMMUNITY) into a security name
+# (local and mynetwork, depending on where the request is coming
+# from):
+
+#       sec.name  source          community
+com2sec local     localhost       COMMUNITY
+com2sec mynetwork NETWORK/24      COMMUNITY
+
+####
+# Second, map the security names into group names:
+
+#             	sec.model  sec.name
+group MyRWGroup	v1         local
+group MyRWGroup	v2c        local
+group MyRWGroup	usm        local
+group MyROGroup v1         mynetwork
+group MyROGroup v2c        mynetwork
+group MyROGroup usm        mynetwork
+
+####
+# Third, create a view for us to let the groups have rights to:
+
+#           incl/excl subtree                          mask
+view all    included  .1                               80
+
+####
+# Finally, grant the 2 groups access to the 1 view with different
+# write permissions:
+
+#                context sec.model sec.level match  read   write  notif
+access MyROGroup ""      any       noauth    exact  all    none   none
+access MyRWGroup ""      any       noauth    exact  all    all    none
+
+# -----------------------------------------------------------------------------
+
+
+###############################################################################
+# System contact information
+#
+
+# It is also possible to set the sysContact and sysLocation system
+# variables through the snmpd.conf file.  **PLEASE NOTE** that setting
+# the value of these objects here makes these objects READ-ONLY
+# (regardless of any access control settings).  Any attempt to set the
+# value of an object whose value is given here will fail with an error
+# status of notWritable.
+
+syslocation Right here, right now.
+syscontact Me <me@somewhere.org>
+
+# Example output of snmpwalk:
+#   % snmpwalk -v 1 -c public localhost system
+#   system.sysDescr.0 = "SunOS name sun4c"
+#   system.sysObjectID.0 = OID: enterprises.ucdavis.ucdSnmpAgent.sunos4
+#   system.sysUpTime.0 = Timeticks: (595637548) 68 days, 22:32:55
+#   system.sysContact.0 = "Me <me@somewhere.org>"
+#   system.sysName.0 = "name"
+#   system.sysLocation.0 = "Right here, right now."
+#   system.sysServices.0 = 72
+
+
+# -----------------------------------------------------------------------------
+
+
+###############################################################################
+# Process checks.
+#
+#  The following are examples of how to use the agent to check for
+#  processes running on the host.  The syntax looks something like:
+#
+#  proc NAME [MAX=0] [MIN=0]
+#
+#  NAME:  the name of the process to check for.  It must match
+#         exactly (ie, http will not find httpd processes).
+#  MAX:   the maximum number allowed to be running.  Defaults to 0.
+#  MIN:   the minimum number to be running.  Defaults to 0.
+
+#
+#  Examples:
+#
+
+#  Make sure mountd is running
+proc mountd
+
+#  Make sure there are no more than 4 ntalkds running, but 0 is ok too.
+proc ntalkd 4
+
+#  Make sure at least one sendmail, but less than or equal to 10 are running.
+proc sendmail 10 1
+
+#  A snmpwalk of the prTable would look something like this:
+# 
+# % snmpwalk -v 1 -c public localhost .EXTENSIBLEDOTMIB.PROCMIBNUM
+# enterprises.ucdavis.procTable.prEntry.prIndex.1 = 1
+# enterprises.ucdavis.procTable.prEntry.prIndex.2 = 2
+# enterprises.ucdavis.procTable.prEntry.prIndex.3 = 3
+# enterprises.ucdavis.procTable.prEntry.prNames.1 = "mountd"
+# enterprises.ucdavis.procTable.prEntry.prNames.2 = "ntalkd"
+# enterprises.ucdavis.procTable.prEntry.prNames.3 = "sendmail"
+# enterprises.ucdavis.procTable.prEntry.prMin.1 = 0
+# enterprises.ucdavis.procTable.prEntry.prMin.2 = 0
+# enterprises.ucdavis.procTable.prEntry.prMin.3 = 1
+# enterprises.ucdavis.procTable.prEntry.prMax.1 = 0
+# enterprises.ucdavis.procTable.prEntry.prMax.2 = 4
+# enterprises.ucdavis.procTable.prEntry.prMax.3 = 10
+# enterprises.ucdavis.procTable.prEntry.prCount.1 = 0
+# enterprises.ucdavis.procTable.prEntry.prCount.2 = 0
+# enterprises.ucdavis.procTable.prEntry.prCount.3 = 1
+# enterprises.ucdavis.procTable.prEntry.prErrorFlag.1 = 1
+# enterprises.ucdavis.procTable.prEntry.prErrorFlag.2 = 0
+# enterprises.ucdavis.procTable.prEntry.prErrorFlag.3 = 0
+# enterprises.ucdavis.procTable.prEntry.prErrMessage.1 = "No mountd process running."
+# enterprises.ucdavis.procTable.prEntry.prErrMessage.2 = ""
+# enterprises.ucdavis.procTable.prEntry.prErrMessage.3 = ""
+# enterprises.ucdavis.procTable.prEntry.prErrFix.1 = 0
+# enterprises.ucdavis.procTable.prEntry.prErrFix.2 = 0
+# enterprises.ucdavis.procTable.prEntry.prErrFix.3 = 0
+#
+#  Note that the errorFlag for mountd is set to 1 because one is not
+#  running (in this case an rpc.mountd is, but thats not good enough),
+#  and the ErrMessage tells you what's wrong.  The configuration
+#  imposed in the snmpd.conf file is also shown.  
+# 
+#  Special Case:  When the min and max numbers are both 0, it assumes
+#  you want a max of infinity and a min of 1.
+#
+
+
+# -----------------------------------------------------------------------------
+
+
+###############################################################################
+# Executables/scripts
+#
+
+#
+#  You can also have programs run by the agent that return a single
+#  line of output and an exit code.  Here are two examples.
+#
+#  exec NAME PROGRAM [ARGS ...]
+#
+#  NAME:     A generic name.
+#  PROGRAM:  The program to run.  Include the path!
+#  ARGS:     optional arguments to be passed to the program
+
+# a simple hello world
+exec echotest /bin/echo hello world
+
+# Run a shell script containing:
+#
+# #!/bin/sh
+# echo hello world
+# echo hi there
+# exit 35
+#
+# Note:  this has been specifically commented out to prevent
+# accidental security holes due to someone else on your system writing
+# a /tmp/shtest before you do.  Uncomment to use it.
+#
+#exec shelltest /bin/sh /tmp/shtest
+
+# Then, 
+# % snmpwalk -v 1 -c public localhost .EXTENSIBLEDOTMIB.SHELLMIBNUM
+# enterprises.ucdavis.extTable.extEntry.extIndex.1 = 1
+# enterprises.ucdavis.extTable.extEntry.extIndex.2 = 2
+# enterprises.ucdavis.extTable.extEntry.extNames.1 = "echotest"
+# enterprises.ucdavis.extTable.extEntry.extNames.2 = "shelltest"
+# enterprises.ucdavis.extTable.extEntry.extCommand.1 = "/bin/echo hello world"
+# enterprises.ucdavis.extTable.extEntry.extCommand.2 = "/bin/sh /tmp/shtest"
+# enterprises.ucdavis.extTable.extEntry.extResult.1 = 0
+# enterprises.ucdavis.extTable.extEntry.extResult.2 = 35
+# enterprises.ucdavis.extTable.extEntry.extOutput.1 = "hello world."
+# enterprises.ucdavis.extTable.extEntry.extOutput.2 = "hello world."
+# enterprises.ucdavis.extTable.extEntry.extErrFix.1 = 0
+# enterprises.ucdavis.extTable.extEntry.extErrFix.2 = 0
+
+# Note that the second line of the /tmp/shtest shell script is cut
+# off.  Also note that the exit status of 35 was returned.
+
+# -----------------------------------------------------------------------------
+
+
+###############################################################################
+# disk checks
+#
+
+# The agent can check the amount of available disk space, and make
+# sure it is above a set limit.  
+
+# disk PATH [MIN=DEFDISKMINIMUMSPACE]
+#
+# PATH:  mount path to the disk in question.
+# MIN:   Disks with space below this value will have the Mib's errorFlag set.
+#        Default value = DEFDISKMINIMUMSPACE.
+
+# Check the / partition and make sure it contains at least 10 megs.
+
+disk / 10000
+
+# % snmpwalk -v 1 -c public localhost .EXTENSIBLEDOTMIB.DISKMIBNUM
+# enterprises.ucdavis.diskTable.dskEntry.diskIndex.1 = 0
+# enterprises.ucdavis.diskTable.dskEntry.diskPath.1 = "/" Hex: 2F 
+# enterprises.ucdavis.diskTable.dskEntry.diskDevice.1 = "/dev/dsk/c201d6s0"
+# enterprises.ucdavis.diskTable.dskEntry.diskMinimum.1 = 10000
+# enterprises.ucdavis.diskTable.dskEntry.diskTotal.1 = 837130
+# enterprises.ucdavis.diskTable.dskEntry.diskAvail.1 = 316325
+# enterprises.ucdavis.diskTable.dskEntry.diskUsed.1 = 437092
+# enterprises.ucdavis.diskTable.dskEntry.diskPercent.1 = 58
+# enterprises.ucdavis.diskTable.dskEntry.diskErrorFlag.1 = 0
+# enterprises.ucdavis.diskTable.dskEntry.diskErrorMsg.1 = ""
+
+# -----------------------------------------------------------------------------
+
+
+###############################################################################
+# load average checks
+#
+
+# load [1MAX=DEFMAXLOADAVE] [5MAX=DEFMAXLOADAVE] [15MAX=DEFMAXLOADAVE]
+#
+# 1MAX:   If the 1 minute load average is above this limit at query
+#         time, the errorFlag will be set.
+# 5MAX:   Similar, but for 5 min average.
+# 15MAX:  Similar, but for 15 min average.
+
+# Check for loads:
+load 12 14 14
+
+# % snmpwalk -v 1 -c public localhost .EXTENSIBLEDOTMIB.LOADAVEMIBNUM
+# enterprises.ucdavis.loadTable.laEntry.loadaveIndex.1 = 1
+# enterprises.ucdavis.loadTable.laEntry.loadaveIndex.2 = 2
+# enterprises.ucdavis.loadTable.laEntry.loadaveIndex.3 = 3
+# enterprises.ucdavis.loadTable.laEntry.loadaveNames.1 = "Load-1"
+# enterprises.ucdavis.loadTable.laEntry.loadaveNames.2 = "Load-5"
+# enterprises.ucdavis.loadTable.laEntry.loadaveNames.3 = "Load-15"
+# enterprises.ucdavis.loadTable.laEntry.loadaveLoad.1 = "0.49" Hex: 30 2E 34 39 
+# enterprises.ucdavis.loadTable.laEntry.loadaveLoad.2 = "0.31" Hex: 30 2E 33 31 
+# enterprises.ucdavis.loadTable.laEntry.loadaveLoad.3 = "0.26" Hex: 30 2E 32 36 
+# enterprises.ucdavis.loadTable.laEntry.loadaveConfig.1 = "12.00"
+# enterprises.ucdavis.loadTable.laEntry.loadaveConfig.2 = "14.00"
+# enterprises.ucdavis.loadTable.laEntry.loadaveConfig.3 = "14.00"
+# enterprises.ucdavis.loadTable.laEntry.loadaveErrorFlag.1 = 0
+# enterprises.ucdavis.loadTable.laEntry.loadaveErrorFlag.2 = 0
+# enterprises.ucdavis.loadTable.laEntry.loadaveErrorFlag.3 = 0
+# enterprises.ucdavis.loadTable.laEntry.loadaveErrMessage.1 = ""
+# enterprises.ucdavis.loadTable.laEntry.loadaveErrMessage.2 = ""
+# enterprises.ucdavis.loadTable.laEntry.loadaveErrMessage.3 = ""
+
+# -----------------------------------------------------------------------------
+
+
+###############################################################################
+# Extensible sections.
+# 
+
+# This alleviates the multiple line output problem found in the
+# previous executable mib by placing each mib in its own mib table:
+
+# Run a shell script containing:
+#
+# #!/bin/sh
+# echo hello world
+# echo hi there
+# exit 35
+#
+# Note:  this has been specifically commented out to prevent
+# accidental security holes due to someone else on your system writing
+# a /tmp/shtest before you do.  Uncomment to use it.
+#
+# exec .EXTENSIBLEDOTMIB.50 shelltest /bin/sh /tmp/shtest
+
+# % snmpwalk -v 1 -c public localhost .EXTENSIBLEDOTMIB.50
+# enterprises.ucdavis.50.1.1 = 1
+# enterprises.ucdavis.50.2.1 = "shelltest"
+# enterprises.ucdavis.50.3.1 = "/bin/sh /tmp/shtest"
+# enterprises.ucdavis.50.100.1 = 35
+# enterprises.ucdavis.50.101.1 = "hello world."
+# enterprises.ucdavis.50.101.2 = "hi there."
+# enterprises.ucdavis.50.102.1 = 0
+
+# Now the Output has grown to two lines, and we can see the 'hi
+# there.' output as the second line from our shell script.
+#
+# Note that you must alter the mib.txt file to be correct if you want
+# the .50.* outputs above to change to reasonable text descriptions.
+
+# Other ideas:
+# 
+# exec .EXTENSIBLEDOTMIB.51 ps /bin/ps 
+# exec .EXTENSIBLEDOTMIB.52 top /usr/local/bin/top
+# exec .EXTENSIBLEDOTMIB.53 mailq /usr/bin/mailq
+
+# -----------------------------------------------------------------------------
+
+
+###############################################################################
+# Pass through control.
+# 
+
+# Usage:
+#   pass MIBOID EXEC-COMMAND
+#
+# This will pass total control of the mib underneath the MIBOID
+# portion of the mib to the EXEC-COMMAND.  
+#
+# Note:  You'll have to change the path of the passtest script to your
+# source directory or install it in the given location.
+# 
+# Example:  (see the script for details)
+#           (commented out here since it requires that you place the
+#           script in the right location. (its not installed by default))
+
+# pass .EXTENSIBLEDOTMIB.255 /bin/sh PREFIX/local/passtest
+
+# % snmpwalk -v 1 -c public localhost .EXTENSIBLEDOTMIB.255
+# enterprises.ucdavis.255.1 = "life the universe and everything"
+# enterprises.ucdavis.255.2.1 = 42
+# enterprises.ucdavis.255.2.2 = OID: 42.42.42
+# enterprises.ucdavis.255.3 = Timeticks: (363136200) 42 days, 0:42:42
+# enterprises.ucdavis.255.4 = IpAddress: 127.0.0.1
+# enterprises.ucdavis.255.5 = 42
+# enterprises.ucdavis.255.6 = Gauge: 42
+#
+# % snmpget -v 1 -c public localhost .EXTENSIBLEDOTMIB.255.5
+# enterprises.ucdavis.255.5 = 42
+#
+# % snmpset -v 1 -c public localhost .EXTENSIBLEDOTMIB.255.1 s "New string"
+# enterprises.ucdavis.255.1 = "New string"
+#
+
+# For specific usage information, see the man/snmpd.conf.5 manual page
+# as well as the local/passtest script used in the above example.
+
+###############################################################################
+# Subagent control
+#
+
+# The agent can support subagents using a number of extension mechanisms.
+# From the 4.2.1 release, AgentX support is being compiled in by default.
+# However, this is still experimental code, so should not be used on
+# critical production systems.
+#   Please see the file README.agentx for more details.
+#
+# If having read, marked, learnt and inwardly digested this information,
+# you decide that you do wish to make use of this mechanism, simply
+# uncomment the following directive.
+#
+#  master  agentx
+#
+# I repeat - this is *NOT* regarded as suitable for front-line production
+# systems, though it is probably stable enough for day-to-day use.
+# Probably.
+#
+# No refunds will be given.
+
+
+###############################################################################
+# Further Information
+#
+#  See the snmpd.conf manual page, and the output of "snmpd -H".
+#  MUCH more can be done with the snmpd.conf than is shown as an
+#  example here.
diff -Naur tomato/release/src/router/snmp/FAQ tomato121/release/src/router/snmp/FAQ
--- tomato/release/src/router/snmp/FAQ	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/FAQ	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,2942 @@
+      Frequently Asked Questions (FAQ) for the UCD/Net SNMP package
+      =============================================================
+		       FAQ Author: Dave Shield
+		        net-snmp Version: 5.0.9
+	    net-snmp/ucd-snmp Project Leader: Wes Hardaker
+	     Email: net-snmp-coders@lists.sourceforge.net
+
+TABLE OF CONTENTS
+=================
+
+ TABLE OF CONTENTS
+ GENERAL
+   What is it?
+   Where can I get it?
+   What documentation is available?
+   Are there binaries available?
+   What's the difference between UCD-SNMP and Net-SNMP?
+   What operating systems does it run on?
+   What happens if mine isn't listed?
+   Does it run on Windows?
+   How do I find out about new releases?
+   How can I find out what other people are doing?
+   How do I submit a patch or bug report?
+   Can I reuse the code in my commercial application?
+   What's the difference between SNMPv1, SNMPv2 and SNMPv3?
+   What are all these different SNMPv2's anyway?
+   Which versions of SNMP are supported in this package?
+   Can I use SNMPv1 requests with an SNMPv2 MIB (or vice versa)?
+   Where can I find more information about network management?
+   Is ucd-snmp thread safe?
+ APPLICATIONS
+   How do I add a MIB?
+   How do I add a MIB to the tools?
+   Why can't I see anything from the agent?
+   Why can't I see values in the <INSERT ENTERPRISE HERE> tree?
+   Requests always seem to timeout, and don't give me anything back.  Why?
+   I can see the system group, but nothing else.  Why?
+   The agent worked for a while, then stopped responding.  Why?
+   Requesting an object fails with "Unknown Object Identifier"  Why?
+   Why do I get "noSuchName" when asking for "sysUpTime" (or similar)?
+   Why do I sometimes get "End of MIB" when walking a tree, and sometimes not?
+   I cannot set any variables in the MIB.
+   Variables seem to disappear when I try to set them.  Why?
+   I still can't change sysLocation, though the access settings allow
+       it.  Why not?
+   I get an error when trying to set a negative value - why?
+   I get an error when trying to get a string-indexed table value - why?
+   How do I send traps and notifications?
+   How do I handle traps and notifications?
+   My traphandler script doesn't work when run like this - why not?
+   The ucdShutdown trap OID received by my manager is wrong. Why?
+   Why does snmptrapd complain about AgentX?
+   How do I use SNMPv3?
+   How big can an SNMP request (or reply) be?
+   How can I monitor my systems (disk, memory, etc)?
+   Applications complain about entries in your example 'snmp.conf' file.  Why?
+   OK, what should I put in snmp.conf?
+ PERL
+   Where can I get the perl SNMP package?
+   How do I install the Perl SNMP modules?
+   But compiling this fails! Why?
+   Compiling the perl module works OK, but 'make test' fails. Why?
+   The perl 'make test' fails on the OID tests. Is it safe to continue?
+   I'm trying to use mib2c (or tkmib) and it can't locate SNMP.pm?
+   I'm trying to use mib2c (or tkmib) and it can't load SNMP.so?
+   I'm trying to use tkmib and it can't locate Tk.pm?
+   I've got a problem with the Net-SNMP module.  Can you help?
+ MIBS
+   Where can I find a MIB compiler?
+   I can't load any of the mib files, and they seem to be missing
+       the first two characters of the filename.  What's happening?
+   Why aren't my mib files being read in?
+   I'm getting answers, but they're all numbers. Why?
+   What does "Cannot find module (XXX-MIB)" mean?
+   What about "unlinked OID"?
+   The parser doesn't handle comments properly. Why not?
+   How do I replace MIB values with new ones?
+   How can I get more information about these MIB file problems?
+   What's this about "too many imported symbols"?
+ AGENT
+   What MIBs are supported?
+   What protocols are supported?
+   How do I configure the agent?
+   How do I add a MIB to the agent?
+   What's the difference between 'exec', 'sh' and 'pass'?
+   What's the difference between AgentX, SMUX and proxied SNMP?
+   What about 'dlmod' - what's that about?
+   Which should I use?
+   Can I use AgentX when running under Windows?
+   How can I run AgentX with a different socket address?
+   How can I combine two copies of the 'mib2' tree from separate subagents?
+   What traps are sent by the agent?
+   How can I send a particular trap to selected destinations?
+   Why does calling 'snmp_v2trap' generate an SNMPv1 trap (or vice versa)?
+   When I run the agent it runs and then quits without staying around. Why?
+   After a while the agent stops responding, and starts eating CPU time.  Why?
+   How can I stop other people getting at my agent?
+   How can I listen on just one particular interface?
+   How do I configure access control?
+   I don't understand the new access control stuff - what does it mean?
+   How do I configure SNMPv3 users?
+   The 'createUser' line disappears when I start the agent.  Why?
+   What's the difference between /var/ucd-snmp and /usr/local/share/snmp?
+   My new agent is ignoring the old snmpd.conf file. Why?
+   Why am I getting "Connection refused"?
+   I'm getting errors about "bad security model" - why?
+   I'm getting errors about "bad prefix match parameter" - why?
+   Why can't I see values in the UCDavis 'extensible' or 'disk' trees?
+   Why can't I see values in the UCDavis 'memory' or 'vmstat' tree?
+   What do the CPU statistics mean - is this the load average?
+   What about multi-processor systems?
+   The speed/type of my network interfaces is wrong - how can I fix it?
+   The interface statistics for my subinterfaces are all zero - why?
+   What does "klread:  bad address" mean?
+   What does "nlist err:  wombat not found" (or similar) mean?
+   How about "Can't open /dev/kmem"?
+   The agent is complaining about 'snmpd.conf'.  Where is this?
+   The system uptime (sysUpTime) returned is wrong!
+   How can I reduce the memory footprint?
+ CODING
+   How do I compile with 'cc' instead of 'gcc'?
+   But gcc doesn't compile it successfully on my new Solaris system. Why not?
+   How do I write C code to integrate with the agent?
+   How does the agent fetch the value of a variable from the system?
+   I've created a new module with 'mib2c' but it doesn't work.  Why not?
+   Where should I put the files produced by 'mib2c'?
+   Mib2c only handles a single table in my MIB. How can I fix this?
+   Mib2c complains about a missing "mib reference" - what does this mean?
+   Mib2c complains about not having a "valid OID" - what does this mean?
+   Mib2c ignores my MIB and generates a pair of 'mib-2' code files.  Why?
+   Mib2c talks about "configuration files". Why has this stopped working?
+   How can I get the agent to generate a trap (or inform)?
+   What if I'm using an AgentX sub-agent instead?
+   I'm getting an error "autoheader: not found" - what's wrong?
+   What about a failed dependency on 'libcrypto'?  Where can I get that?
+   Why is the project workspace empty under Visual C++?
+   Why are packets requesting the same information larger with UC-Davis SNMP?
+   What ASN.1 parser is used?
+   What is the Official Slogan of the ucd-snmp-coders list?
+
+
+GENERAL
+=======
+
+What is it?
+----------
+
+  - Various tools relating to the Simple Network Management Protocol
+    including:
+
+	* An extensible agent
+	* An SNMP library
+	* tools to request or set information from SNMP agents
+	* tools to generate and handle SNMP traps
+	* a version of the unix 'netstat' command using SNMP
+	* a graphical Perl/Tk/SNMP based mib browser
+
+    This package is originally based on the Carnegie Mellon University
+    SNMP implementation (version 2.1.2.1), but has developed significantly
+    since then.
+
+
+
+Where can I get it?
+------------------
+
+  Download:
+    - http://www.net-snmp.org/download/
+    - ftp://ftp.net-snmp.org/pub/sourceforge/net-snmp/
+  MD5 Sums:
+    - http://www.net-snmp.org/md5/
+  Web page:
+    - http://www.net-snmp.org/
+  Sourceforge Project page:
+    - http://www.net-snmp.org/project/
+  Mirrors (note that sourceforge download servers are mirrored themselves):
+    - US:          ftp://ftp.freesnmp.com/mirrors/net-snmp/
+    - Bulgaria:    http://rtfm.uni-svishtov.bg/net-snmp/
+    - Japan:       ftp://ftp.ayamura.org/pub/net-snmp/
+    - Germany:     ftp://ftp.mpg.goe.ni.schule.de/pub/internet/net-snmp/
+
+  The old ucd-snmp.ucdavis.edu web site and ftp server is now
+  offline and should not be accessed any longer.
+
+
+
+What documentation is available?
+-------------------------------
+
+	This FAQ (!)
+	README
+	INSTALL
+	PORTING
+	EXAMPLE.conf
+	man pages for the individual tools, files and the API
+	A guide for extending the agent
+	Tutorials for both ucd-snmp v4 and net-snmp v5
+           at  http://www.net-snmp.org/tutorial/
+           and http://www.net-snmp.org/tutorial-5/ respectively
+
+      Most of this documentation (plus archives of the mailing lists)
+	 is also available on our web page:
+
+        	http://www.net-snmp.org/
+
+
+
+Are there binaries available?
+----------------------------
+
+  - There are binaries for some systems available in the binaries
+    directory on the ftp site.
+
+
+
+What's the difference between UCD-SNMP and Net-SNMP?
+---------------------------------------------------
+
+  Not a great deal, really.
+  Although the project originally started at UC Davis (hence the name),
+  and it has always been based there, most of the contributors have had
+  little or no connection with this institution.
+
+    The move to SourceForge was intended to provide a more flexible
+  environment for the project, and to distribute the administrative
+  workload more evenly.  The change of name simply reflects this move,
+  which was the last remaining link with UC Davis.
+
+    The 4.2.x line is the last release line that uses the ucd-snmp name,
+  and all releases under this banner will be bug-fixes only.  Release
+  5.0 is the first version using the net-snmp name, and all new features
+  and significant development will be released under this name.
+    (Though the dividing line between a bug-fix and a new feature is
+  something of a vague one, so some changes in the 4.2.x line may be
+  relatively non-trivial!)
+ 
+    Starting with the 5.0 release, we are also trying to review and
+  rework the underlying code base to improve the readability and
+  maintainability of the package.  The 5.0 changes have mostly
+  concentrated on the agent architecture, though there have been some
+  significant changes to the library as well.  Future releases may
+  include further restructuring of the library.
+    This process will probably result in some changes to the API,
+  though we will attempt to retain some form of backwards
+  compatibility as far as possible, and clearly mark anything that has
+  changed.  The most significant change with the 5.0 release is a
+  restructuring of the header file organisation - not least a change
+  from <ucd-snmp/xxx.h> to <net-snmp/yyy.h>.
+
+
+
+What operating systems does it run on?
+-------------------------------------
+
+  Both the applications and the agent have been reported as running
+  (at least in part) on the following operating systems:
+
+	* HP-UX (10.20 to 9.01 and 11.0 -- see README.hpux11)
+	* Ultrix (4.5 to 4.2)
+	* Solaris (2.8 to 2.3) and SunOS (4.1.4 to 4.1.2)
+	* OSF (4.0, 3.2)
+	* NetBSD (1.5alpha to 1.0)
+	* FreeBSD (4.1 to 2.2)
+	* BSDi (4.0.1 to 2.1)
+	* Linux (kernels 2.4 to 1.3)
+	* AIX (4.1.5, 3.2.5)
+	* OpenBSD (2.8, 2.6)
+	* Irix (6.5 to 5.1)
+	* OS X (10.1.1 and 10.1.2)
+	* Dynix/PTX 4.4
+
+  We have also been informed about a port to the Stratus VOS.
+  See http://ftp.stratus.com/vos/network/network.html for details.
+
+  See the next question but one for the status of Windows support.
+
+  Certain systems (e.g. HP-UX 11, Irix?) fail to compile particular
+  portions of the agent.  These can usually be persuaded to compile
+  (at the loss of some functionality) by omitting the modules affected.
+  See the next question for more details.
+
+  Also note that the presence of a particular configuration in this
+  list does not imply a perfect or complete implementation.  This is
+  simply what various people have reported as seeming to work. (Or more
+  frequently, the configurations people have reported problems with
+  that we think we've fixed!)
+
+
+
+What happens if mine isn't listed?
+---------------------------------
+
+    It's probably worth trying to compile it anyway.  If your system
+  is reasonably similar to another supported configuration, it may
+  well compile with little or no difficulty.  The most likely source
+  of problems will be MIB modules within the agent, as this tends to
+  be where the most system-specific code is found.
+
+    If only a few modules fail to compile, try removing them from
+  the agent by running "configure --with-out-mib-module=xxx,yyy",
+  and re-compiling.  If a large number of modules fail, then it
+  might be easier to start from a relatively bare system, using
+  "configure --enable-mini-agent --with-defaults".  Then if this
+  minimal agent compiles and runs successfully, try adding the
+  missing mibgroups using the configure option '--with-mib-module'.
+  
+    If configure fails with "invalid configuration" messages, or
+  you get completely stuck, contact the coders list for advice.
+  Similarly, if you manage to get this working on a new system,
+  please let us know both details of the hardware you're using,
+  and what versions of the operating system you've tried it on.
+  The entry 'host' in the file 'config.status' will show this
+  information.  Oh, and congratulations!
+
+
+
+Does it run on Windows?
+----------------------
+
+    The suite should compile and run on Win32 platforms, including
+  the library, command-line tools and the basic agent framework.
+  Note that the agent now includes support for the MIB-II module,
+  but this requires Microsoft's Core Platform SDK.  Instructions
+  for how to install this are given in README.win32.
+
+    Some other MIB modules, including the UCD pass-through extensions,
+  do not currently work under Windows.  Volunteers to assist in
+  these missing modules are likely to welcomed with open arms :-)
+
+    Further details of Windows support (currently Visual C++ and
+  Cygnus cygwin32) is available in the file README.win32
+
+
+
+How do I find out about new releases?
+------------------------------------
+
+  There is a mailing list for these announcements
+
+  	net-snmp-announce@lists.sourceforge.net
+
+  To be added to (or removed from) this list, visit
+  http://www.net-snmp.org/lists/net-snmp-announce/.  Or you can send a
+  message to the address
+  'net-snmp-announce-request@lists.sourceforge.net' with a subject
+  line of 'subscribe' (or 'unsubscribe' as appropriate).
+
+  Major code revisions may be announced more widely (e.g. on the
+  SNMP mailing lists, or comp.protocols.snmp) but this list is the most
+  reliable way to keep in touch with the status of this package.
+
+  Patches to fix known problems are also made available via the web site:
+
+        http://www.net-snmp.org/patches/
+
+
+
+How can I find out what other people are doing?
+----------------------------------------------
+
+  There is a general purpose discussion list
+
+  	net-snmp-users@lists.sourceforge.net
+
+  To be added to (or removed from) this list, visit
+  http://www.net-snmp.org/lists/net-snmp-users.  Or you can send a
+  message to the address 'net-snmp-users-request@lists.sourceforge.net'
+  with a subject line of 'subscribe' (or 'unsubscribe' as appropriate).
+
+  To find out what the developers are doing, and to help them out, please
+  read the PORTING file enclosed with the package.
+
+  There is also an net-snmp IRC channel set up on the freenode.net IRC
+  chat servers (you can use irc.freenode.net to connect and/or see
+  http://www.freenode.net/ for getting started with irc).  Multiple
+  core developers hang out there on a regular basis.
+
+
+
+How do I submit a patch or bug report?
+-------------------------------------
+
+  All bug reports should be submitted to the bug database through the
+  interface found at http://www.net-snmp.org/bugs/.  Be
+  sure to include the version of the package that you've been working
+  with, the output of the command 'uname -a', the precise command that
+  triggers the problem and a copy of the output it produces.
+
+    All patches should be submitted to the patch manager at
+  http://www.net-snmp.org/patches/.  If possible, submit a
+  bug report describing the patch as well (referencing it by its patch
+  number) since the patch manager doesn't contain a decent description
+  field.
+
+    Questions about using the package should be directed at the
+  net-snmp-users@lists.sourceforge.net mailing list.  Note that this
+  mailing list is relatively busy, and the people answering these
+  questions are doing so out of the goodness of their hearts, and in
+  addition to their main employment.  Please note the following:
+
+     - use plain text mail, rather than HTML
+     - don't resend questions more than once
+          (even if no-one answered immediately)
+     - include full details of exact commands and error messages
+          ("I've tried everything, and it doesn't work" isn't much use!)
+     - do *NOT* send messages to -users and -coders mailing lists
+          (most developers read both anyway)
+     - don't mail the developers privately - keep everything on the list
+
+  Remember that this is basically an unsupported package.  Fundamentally
+  it's Open Source, so you have the source code.  If you need something
+  fixing badly enough, it's up to you to do the work.
+
+    We can't promise to be able to solve all problems, but we'll
+  certainly try and help.  But remember that this is basically an
+  unsupported package.  It's Open Source, so if you need something
+  fixing badly enough,  fundamentally it's up to you to do the work.
+
+Can I reuse the code in my commercial application?
+-------------------------------------------------
+
+The details of the COPYRIGHTs on the package can be found in the
+COPYING file.  You should have your lawyer read this file if you wish
+to use the code in your commercial application.  We will not summarize
+here what is in the file, as we're not lawyers and are unqualified to
+do so.
+
+
+What's the difference between SNMPv1, SNMPv2 and SNMPv3?
+-------------------------------------------------------
+What are all these different SNMPv2's anyway?
+--------------------------------------------
+
+
+  A full description is probably beyond the scope of this FAQ.
+  Very briefly, the original protocol and framework was described
+  in RFCs 1155-1157, and is now known as SNMPv1.
+
+    Practical experience showed up various problems and
+  deficiencies with this, and a revised framework was developed to
+  try and address these.  This was described in RFCs 1441-1452, and
+  known as "SNMPv2 classic".
+  The changes proposed include:
+
+	* new ways of defining information (MIB structure)
+		(SMI, Textual conventions, conformance statements)
+	* new protocol packet types and transport mappings
+	* new mechanisms for administration and security
+	* mechanisms for remote configuration
+
+  Unfortunately, while many of these were generally accepted, there
+  was some disagreement in these last two areas, security/admin
+  and remote configuration.  This resulted in a number of variants and
+  alternative proposals:
+
+	SNMPv2c		Contains the new protocol and MIB structure elements,
+			using the existing SNMPv1 administration structure.
+			This is the de-facto SNMPv2 standard (described in
+			RFCs 1901-1908), superseding SNMPv2 classic, and is
+			known as "Community-based SNMPv2" or simply "SNMPv2".
+
+
+	SNMPv2 usec	} Alternative proposals to address the
+	SNMPv2*		} limitations of SNMPv1 administration
+			} These are both super-sets of SNMPv2c
+
+			
+	SNMP-NG		An attempt to reach agreement between
+			the proponents of usec and v2star.
+
+  The formal successor to the SNMP-NG work has been termed SNMPv3.
+  This has now been effectively finalised, and is described in RFCs
+  2571-2575.  This is currently a Proposed Standard, but is likely
+  to progress to full Standard in the relatively near future.
+
+
+
+Which versions of SNMP are supported in this package?
+----------------------------------------------------
+
+  This package currently supports the original SNMPv1, Community-based
+  SNMPv2 (i.e. RFCs 1901-1908), and SNMPv3 (i.e. RFCs 2571-2575).
+    The agent will respond to requests using any of these protocols,
+  and all the tools take a command-line option to determine which
+  version to use.
+
+  Support for SNMPv2 classic (a.k.a. "SNMPv2 historic" - RFCs 1441-1452)
+  was dropped with the 4.0 release of the UCD-snmp package.
+
+
+
+Can I use SNMPv1 requests with an SNMPv2 MIB (or vice versa)?
+------------------------------------------------------------
+
+    Yes.
+
+    The version of the syntax used to define a MIB file
+  is better referred to as SMIv1 or SMIv2, and is purely
+  concerned with defining the characteristics of the
+  various management objects.  This is (almost) completely
+  unrelated to the versions of the protocol operations.
+  So it is quite reasonable to use SNMPv1 requests on
+  objects defined using SMIv2, or SNMPv2 (or SNMPv3)
+  requests on objects defined using SMIv1.
+
+    The one exception is objects of syntax Counter64,
+  which are only accessible using SNMPv2 or higher.
+  SNMPv1 requests will either treat such objects as an
+  error, or skip over them completely.
+
+  
+
+Where can I find more information about network management?
+----------------------------------------------------------
+
+  There are a number of sites with network management information on
+  the World Wide Web. Three of the most useful are
+
+      http://netman.cit.buffalo.edu/index.html
+      http://www.snmplink.org/
+      http://wwwsnmp.cs.utwente.nl/
+
+  There are two Usenet newsgroups which are relevant.
+	'comp.dcom.net-management'
+		which discusses general issues relating to network management
+	'comp.protocols.snmp'
+		which is specifically concerned with use of SNMP in particular
+
+  (though there is a large overlap between these two groups).
+  The SNMP group also has an FAQ (split into two parts) which discusses more
+  general issues related to SNMP, including books, software, other sites,
+  how to get an enterprise number, etc, etc.
+  This is available from
+
+      ftp://rtfm.mit.edu/pub/usenet/comp.protocols.snmp/
+
+  or via any of the Web sites above.
+
+
+
+Is ucd-snmp thread safe?
+-----------------------
+
+  Strictly speaking, no.  However, it should be possible to use the
+  library in a thread-safe manner.  This is covered in detail in the file
+  README.thread (shipped with the standard distribution), but can be
+  summarised as follows:
+
+    -	Call 'snmp_sess_init()' prior to activating any threads.
+	This reads in and parses MIB information (which isn't thread-safe)
+	as well as preparing a session structure for subsequent use.
+
+    -	Open an SNMP session using 'snmp_sess_open()' which returns an
+	opaque session handle, which is essentially independent of any
+	other sessions (regardless of thread).
+
+    -	Resource locking is not handled within the library, and is the
+	responsibility of the main application.
+
+  The applications and the agent have not been designed for threaded use.
+
+
+
+APPLICATIONS
+============
+
+How do I add a MIB?
+------------------
+
+  This is actually two separate questions, depending on whether you
+  are referring to the tools, or the agent (or both).
+    See the next question or the next section respectively.
+
+
+
+How do I add a MIB to the tools?
+-------------------------------
+
+  Firstly,
+
+	cp MY-MIB.txt /usr/local/share/snmp/mibs
+
+          or
+
+        mkdir $HOME/.snmp
+        mkdir $HOME/.snmp/mibs
+	cp MY-MIB.txt $HOME/.snmp/mibs
+
+  And then,
+
+	export MIBS=+MY-MIB
+
+          or alternatively:
+
+        echo "mibs +MY-MIB" >> $HOME/.snmp/snmp.conf
+
+  Note that you need *both* steps.
+  The first command copies the file defining the new MIB to a
+  expected location for MIB files.  This defaults to
+  /usr/local/share/snmp/mibs (or PREFIX/share/snmp/mibs if the the
+  suite was installed into a different base location).  Some
+  ready-packaged distributions (such as Linux RPM packages) may look
+  for MIB files in a different location, such as /etc/snmp/mibs - put
+  the new file in this directory instead.  This makes it available for
+  everyone on the system.
+  The tools will also look for mibs in your personal $HOME/.snmp/mibs
+  directory, but this will only work for you.
+
+  The second command tells the tools to load in this new MIB file as well
+  as the default set.   Note that the tools do *not* load every MIB found
+  in the directory - this is to avoid slowing them down excessively when
+  there is a large collection of MIB files.  If you do want the tools to
+  load all the MIB files, set the environmental variable MIBS to the special
+  value "ALL".
+
+     Note that the value for this variable is the name of the MIB module,
+  *not* the name of the MIB file.   These are typically the same (apart
+  from the .txt suffix), but if in doubt, check the contents of the file.
+  The value to use is the token immediately before the word DEFINITIONS
+  at the start of the file.  Of course, if you load 'ALL' mibs, then this
+  distinction is irrelevant.
+
+    Most of the tools (apart from 'snmptable') will work quite happily
+  without any MIB files at all, as long as you are prepared to work with
+  numeric OIDs throughout.  The MIB files are only used for translating
+  between numeric and textual forms for queries and responses.
+    The same holds true for the agent - see the AGENT section for details.
+
+
+
+Why can't I see anything from the agent?
+---------------------------------------
+
+  There are two main general causes of problems retrieving information
+  from the agent.   Firstly, the variable (or variables) specified may
+  not be recognised by the tools as valid names.  In this case, the
+  tools will typically reject the request without ever contacting the
+  remote agent.
+
+    Alternatively, the tool may be happy with the request, but the agent
+  does not return the corresponding value(s).  It may return an explicit
+  error message instead, or the request may time out without any response
+  being sent back at all.  The next few entries look at these in more detail.
+
+
+
+Why can't I see values in the <INSERT ENTERPRISE HERE> tree?
+-----------------------------------------------------------
+
+  Having said that there are two main reasons for not getting a response,
+  the most likely cause of this problem is actually something else again.
+
+  The 'snmpwalk' command takes a point in the overall MIB tree, and tries
+  to display all the values that lie within this subtree.  However, it
+  actually does this by issuing a series of "getnext" requests, until
+  the variable returned lies outside the subtree of interest.  If the
+  very first request returns such an undesired value, then the command
+  will terminate, without having displayed anything at all.
+
+    If an expicit starting point is given to 'snmpwalk', then it is reasonably
+  clear what is happening, and that there is simply nothing in the subtree
+  specified.  However, if 'snmpwalk' is called without giving an explicit
+  starting point, then it will display the contents of the 'mib-2' subtree.
+  It will not attempt to traverse any 'private.enterprise' subtree, such as
+  the UCD-specific objects (including any local extensions).
+
+    To walk the whole tree, specify a starting point of '.iso'
+  To walk a specific enterprise subtree, specify the root of this as
+  the starting point - e.g:
+
+	snmpwalk -v1 -c public localhost ucdavis
+ 
+  Or, of course, you can walk a selected portion of an enterprise subtree
+  by specifying the appropriate starting point - e.g:
+
+	snmpwalk -v1 -c public localhost ucdavis.version
+  
+  If you still can't see any information, keep reading.  The next few
+  questions will probably help you.
+
+
+
+Requests always seem to timeout, and don't give me anything back.  Why?
+----------------------------------------------------------------------
+
+  There are a number of possible causes of this.
+
+  The most likely is a problem with access control - the agent is not
+  configured to allow you to access these variables.  This is commonly
+  seen with community-based requests (i.e. SNMPv1 and SNMPv2).  While
+  you might expect this to return an error, the specification of the
+  protocol actually defines this as not returning any response at all.
+  The tools will retry the request a number of times, and then report
+  a timeout error.
+
+    See the entries on access control in the AGENT section for how to
+  configure the UCD agent to allow suitable access.  For other vendors'
+  agents, you will need to consult the relevant documentation.
+
+    Other possibilities to check:
+	- is the machine you are querying up and running?
+		(does it respond to 'ping' or similar requests?)
+	- is there an SNMP agent running on it?
+	- is the agent simply taking a long time to respond?
+		(try again with a long timeout value - e.g. '-t 120')
+	- are there firewall or TCP wrapper settings that block this request?
+		(see the entry 'Why am I getting "Connection refused"?')
+
+  But the most likely cause is definitely access control settings.
+
+
+
+I can see the system group, but nothing else.  Why?
+--------------------------------------------------
+
+  This is probably the same as the previous question - a problem with
+  the access configuration of the agent.  Many pre-configured systems
+  (such as most Linux distributions) will only allow access to the system
+  group by default, and need to be configured to enable more general access.
+
+    The easiest way to test this is to try a GETNEXT request, that ought
+  to return the entry of interest.
+  e.g.
+	snmpgetnext -v1 -c public localhost ucdavis.version.versionTag
+  instead of
+	snmpget     -v1 -c public localhost ucdavis.version.versionTag.0
+
+  If the agent responds with "end of MIB" or a different object, then
+  either the agent doesn't implement that particular object at all, or
+  the access control won't allow you access to it.
+
+  See the entries on access control in the AGENT section for how to
+  configure the UCD agent, or consult the agent's own documentation.
+
+
+
+The agent worked for a while, then stopped responding.  Why?
+-----------------------------------------------------------
+
+  Assuming that the agent hasn't crashed completely, the most likely
+  explanation is that it's simply overloaded, and is taking longer to
+  respond than the querying tool is waiting.  Since the agent handles
+  each request in turn, without regard to earlier activity, and most
+  tools will retry a request when it times out, the list of outstanding
+  requests can grow longer and longer.
+
+    To determine whether this is the cause or not, try leaving the
+  agent undisturbed for a while, and then probe it using a longer
+  timeout (e.g. '-t 120').  This should give the agent time to handle
+  each request first time round, and avoids overloading it with
+  duplicate requests.
+
+  This is not a full solution, of course, but at least it should
+  allow you to isolate the offending portion of the tree. The
+  developers may then be able to offer a more long-term solution.
+
+
+
+Requesting an object fails with "Unknown Object Identifier"  Why?
+----------------------------------------------------------------
+
+  If a general snmpwalk shows the entry, but asking for it more
+  specifically gives a "sub-identifier not found:" or "Unknown Object
+  Identifier" error, then that's a problem with the tool, rather than
+  the agent.
+
+    Firstly, make sure that you're asking for the object by the right name.
+  Object descriptors are case-sensitive, so asking for 'sysuptime' will
+  not be recognised, but 'sysUpTime' will.
+
+    Secondly, the object may be defined in a MIB that hasn't been loaded.
+  Try loading in all the MIB files:
+
+	snmpget -m ALL -v1 -c public localhost sysUpTime.0
+
+  (though if snmpwalk translates it OK, that's less likely to be the cause).
+
+    Thirdly, earlier versions of the UCD software expected "full" paths
+  for object names, either based at the root of the whole MIB tree
+  (".iso.org.dod.internet.mgmt.mib-2.system.sysUpTime") or the 'mib-2'
+  subtree ("system.sysUpTime").  Try:
+  
+	snmpget -v1 -c public myhost system.sysUpTime.0
+
+  These earlier versions of the tools may take a command-line option '-R'
+  or '-IR' (depending on vintage) to invoke this "random-access" mode.
+  Note that snmptranslate still requires "random-access" to be specified
+  explicitly - all other command tools now use this mode by defaults.
+
+  All versions of the UCD tools accept the syntax
+
+	snmpget -v1 -c public myhost RFC1213-MIB:sysUpTime.0
+
+  to denote a particular object in a specific MIB module.  Note that this
+  uses the name of the *module*, not the name of the file.  See the second
+  question in this section for the distinction.
+
+
+
+Why do I get "noSuchName" when asking for "sysUpTime" (or similar)?
+------------------------------------------------------------------
+
+  There are a number of possible causes of this (scattered throughout
+  this FAQ, so keep reading!).   But one of the most likely snares for
+  the unwary is forgetting the instance subidentifier for 'non-table'
+  objects.  If you walk the 'system' tree, you'll notice that all the
+  results (apart from the sysORTable), have a '.0' at the end of the OID.
+  This is the "instance sub-identifier" - which *must* be included for
+  a GET request.
+     Compare the following:
+
+	$ snmpget -v1 -c public localhost sysUpTime
+	Error in packet
+	Reason: (noSuchName) There is no such variable name in this MIB.
+	This name doesn't exist: system.sysUpTime
+	$ snmpget -v1 -c public localhost sysUpTime.0
+	system.sysUpTime.0 = Timeticks: (69189271) 8 days, 0:11:32.71
+
+  This is a little less obscure when using SNMPv2c or v3 requests:
+
+	$ snmpget -v 2c -c public localhost sysUpTime
+	system.sysUpTime = No Such Instance currently exists
+
+
+
+Why do I sometimes get "End of MIB" when walking a tree, and sometimes not?
+--------------------------------------------------------------------------
+
+  This depends on which MIB modules are supported by the agent you are
+  querying and what you're asking for.
+
+  Recall that a tree is walked by repeatedly asking for "the next entry" until
+  all the values under that tree have been retrieved.  However, the agent has
+  no idea that this is what's happening - all it sees is a request for "the
+  next entry after X".
+
+  If the object X happens to be the last entry in a sub-tree, the agent will
+  provide the next object supported (as requested) even though this will be
+  in a different subtree.  It's up to the querying tool to recognise that
+  this last result lies outside the area of interest, and simply discard it.
+
+  If the object X happens to be the last entry supported by the agent, it
+  doesn't have another object to provide, so returns an "end of MIB"
+  indication.  The UCD tools report this with the message above.
+
+  But in either case, the actual information provided will be the same.
+
+
+
+I cannot set any variables in the MIB.
+-------------------------------------
+
+  There are three possible reasons for this:
+
+  The majority of MIB objects are defined as "read-only" and inherently
+  cannot be changed via SET requests.
+
+  Of those that can in principle be changed, not all have been implemented
+  as such in this agent.
+
+  Even if SET support has been implemented, the agent may not be configured
+  to allow write access to this object.
+
+  The example configuration file shipped with the basic distribution only
+  allows write access for the local host itself (and a suitable community
+  name must be configured first).
+    Ready-installed distributions (such as those shipped with Linux) tend
+  to be configured with read-only access to part of the mib tree (typically
+  just the system group) and no write access at all.
+
+  To change this, you will need to set up the agent's access control
+  configuration.  See the AGENT section for more details.
+
+    Note that neither the community string "public" nor "private" can be
+  used to set variables in a typical default configuration.
+
+
+
+Variables seem to disappear when I try to set them.  Why?
+--------------------------------------------------------
+
+  This is actually the same as the previous question - it just isn't
+  particularly obvious, particularly when using SNMPv1.  A typical
+  example of this effect would be
+
+	$ snmpget -v1 -c public localhost system.sysLocation.0
+	system.sysLocation.0 = somewhere nearby
+
+	$ snmpset -v1 -c public localhost system.sysLocation.0 s "right here"
+	Error in packet.
+	Reason: (noSuchName) There is no such variable name in this MIB.
+	This name doesn't exist: system.sysLocation.0
+
+  Trying the same request using SNMPv2 or above is somewhat more informative:
+
+	$ snmpset -v 2c -c public localhost system.sysLocation.0 s "right here"
+        Error in packet.
+        Reason: notWritable
+
+  The SNMPv1 error 'noSuchName' actually means:
+
+	"You can't do that to this variable"
+
+  This might be because the variable doesn't exist, it does exist but
+  you don't have access to it (but someone else may do), or it exists
+  but you can't perform that particular operation (i.e. changing it).
+    Similarly, the SNMPv2 error 'notWritable' means "not writable in
+  this particular case" rather than "not writable under any circumstances".
+
+  If you are sure that the object is writable (and has been implemented
+  as such), then you probably need to look at the agent access control.
+  See the AGENT section for more details.
+
+
+
+I still can't change sysLocation, though the access settings allow it.  Why not?
+-------------------------------------------------------------------------------
+
+    One other possibility for the 'sysLocation' and 'sysContact' objects,
+  is that you've got a configuration option in the 'snmpd.conf' file which
+  already sets the corresponding value there.
+
+    Earlier versions of the agent would allow you to write to these objects,
+  but the new value would be forgotten the next time the agent was re-started.
+  More recent versions of the agent reject such write requests if there's a
+  value set via the config file.   If there isn't such a config setting, then
+  the write request will succeed (assuming the access settings allow it), and
+  the new value will be retained the next time the agent restarts.
+
+
+
+I get an error when trying to set a negative value - why?
+--------------------------------------------------------
+
+    This is a different problem.  What's happening here is that the
+  routine that parses the arguments to the 'snmpset' command is seeing
+  the '-' of the new value, and treating it as a command-line option.
+  This normally generates an error (since digits probably aren't valid
+  command line option).
+
+    The easiest way to solve this is include the "end-of-option"
+  indicator '--' in the command line, somewhere before the new value
+  (but after all of the options, obviously).  For example:
+
+	snmpset -v 2c -c public localhost -- versionRestartAgent.0 i -1
+
+  (This will also fail, since -1 isn't an acceptable value for this
+  object, but it will be rejected by the agent, rather than confusing
+  the snmpset command!)
+
+
+
+I get an error when trying to get a string-indexed table value - why?
+--------------------------------------------------------------------
+
+    This is probably due to the shell swallowing the quotes, before
+  they ever get to the SNMP command's OID parser.  Try escaping them:
+
+	snmpget .....   vacmSecurityModel.0.\"wes\"
+  or	snmpget .....  'vacmSecurityModel.0."wes"'
+
+
+  
+How do I send traps and notifications?
+---------------------------------------
+
+    Traps and notifications can be sent using the command 'snmptrap'.
+  The following examples generate the generic trap 'coldStart' and a
+  (dummy) enterprise specific trap '99' respectively:
+
+	snmptrap -v 1 -c public localhost "" "" 0 0  ""
+	snmptrap -v 1 -c public localhost "" "" 6 99 ""
+  
+  The empty parameters "" will use suitable defaults for the relevant 
+  values (enterprise OID, address of sender and current sysuptime).
+
+    An SNMPv2 or SNMPv3 notification (either trap or inform) takes
+  the OID of the trap to send:
+
+	snmptrap -v 2c -c public localhost "" UCD-SNMP-MIB::ucdStart
+	snmptrap -v 2c -c public localhost "" .1.3.6.1.4.1.2021.251.1
+
+  (These two are equivalent ways of specifying the same trap).
+
+  Any of these commands can be followed by one or more varbinds,
+  using the same (OID/type/value) syntax as for 'snmpset':
+
+	snmptrap -v 2c -c public localhost "" ucdStart sysContact.0 s "Dave"
+
+  Generating traps from within the agent is covered in the AGENT and
+  CODING sections.
+
+  You should also read the snmptrap tutorial at
+	http://www.net-snmp.org/tutorial-5/commands/snmptrap.html
+  which will help you understand everything you need to know about traps.
+
+
+
+How do I handle traps and notifications?
+---------------------------------------
+
+    Handling received traps is done using the tool 'snmptrapd'.
+  This can log these traps via the syslog mechanism:
+
+	snmptrapd -s -l7	(log to 'LOCAL7')
+
+  printed to standard output
+
+	snmptrapd -f -P
+
+  or pass them to an external command.  This last approach uses
+  a 'traphandle' directive in the configuration file 'snmptrapd.conf'.
+  A typical file might look something like:
+
+	traphandle .1.3.6.1.6.3.1.5.1       page_me up
+	traphandle .1.3.6.1.4.1.2021.251.1  page_me up
+	traphandle .1.3.6.1.4.1.2021.251.2  page_me down
+	traphandle default                  log_it
+
+  where 'page_me' and 'log_it' are the command to be run.  (You probably
+  need to specify full pathnames, to ensure that the commands will be
+  found.  They're just short here for readability).
+
+  Note that the first entry uses the OID corresponding to the SNMPv1
+  'coldStart' trap.  See the co-existence RFC (RFC 2576) for details
+  of mapping SNMPv1 traps to SNMPv2 OIDs.
+
+  There's a tutorial with more details on the web site at
+	http://www.net-snmp.org/tutorial-5/commands/snmptrap.html
+  
+
+
+My traphandler script doesn't work when run like this - why not?
+---------------------------------------------------------------
+
+    If a traphandler script works fine when run manually from the
+  command line, but generates an error when triggered by an incoming
+  notification, then this is probably down to one of two likely causes.
+
+    Firstly, the interactive shell environment may not be precisely
+  the same as that for programs executed by the snmptrapd daemon.
+  In particular, it's quite possible that the PATH environmental
+  variable may not include all the additional directories that are
+  commonly set up for a personal login configuration.  To avoid this
+  problem (particularly for traphandler shell scripts), it's worth
+  giving the full path to all programs used within the script.
+
+    Secondly, the snmptrapd daemon may not always recognise the
+  appropriate interpreter to use for a particular trap handler.
+  If this is the case, then you can specify this interpreter
+  explicitly as part of the trap handle directive:
+
+	traphandle default /usr/bin/perl /usr/local/bin/log_it
+
+  Note that in this case, it's almost certain that you'll also
+  need to give the full path to the traphandle script (as shown)
+
+
+
+The ucdShutdown trap OID received by my manager is wrong. Why?
+-------------------------------------------------------------
+
+    This is due to the way that traps are converted between
+  SNMPv1 and SNMPv2 formats.  The algorithm used for converting
+  from an SNMPv1 enterprise-specific trap number, to an SNMPv2
+  trap OID results in a penultimate '0' subidentifier, before
+  the trap number itself.  The definition of the trap objects
+  in the UCD-SNMP-MIB file does not include this subidentifier.
+
+    In due course, the intention is to define a new set of MIB
+  objects, under the 'net-snmp' enterprise tree.  This will
+  include new trap OIDs, which will be designed such that
+  this problem does not arise in the future.
+
+
+
+Why does snmptrapd complain about AgentX?
+----------------------------------------
+
+    Starting from the v5 release, the trap handling daemon has
+  implemented the notification logging aspects of the NOTIFICATION-MIB
+  (RFC 3014).  This is handled by the trap handler daemon registering
+  as an AgentX subagent, to supply this statistical information.
+
+    If there is no AgentX master agent available, this registration
+  fails, generating the warning about "failed to connect to the agentx
+  master".  This warning only appears between version 5.0 and 5.0.4
+  (in 5.0.4 and after the warning was silenced).  This failure does
+  not affect the main operation of the trap handler.  It simply means
+  that the nsmLog information won't be available for query via SNMP.
+
+    Basically, this is a warning that can safely be ignored.
+
+
+
+How do I use SNMPv3?
+-------------------
+
+    The simplest form of SNMPv3 request (unauthenticated, unencrypted)
+  would be something like:
+
+	snmpget -v 3 -l noAuthNoPriv localhost sysUpTime.0
+
+    An authenticated request would specify a username and pass phrase:
+
+	snmpget -v 3 -l authNoPriv -u dave -A "Open the Door"
+				localhost sysUpTime.0
+
+    A fully secure request would also specify the privacy pass phrase:
+
+	snmpget -v 3 -l authPriv -u dave -A "Open the Door"
+			-X "Bet you can't see me"  localhost sysUpTime.0
+
+  In practise, most of these would probably be set via configuration
+  directives in a personal $HOME/.snmp/snmp.conf file (note, *not* the
+  agent's snmpd.conf file).  The equivalent settings for the third
+  example would be:
+
+	defSecurityName		dave
+	defSecurityLevel	authPriv
+	defAuthPassphrase	"Open the Door"
+	defPrivPassphrase	"Bet you can't see me"
+
+  If the AuthPassphrase and the PrivPassphrase are the same, then you
+  can use the setting
+		defPassphrase	"Open the Door and see me"
+							instead
+
+  For how to configure the agent to respond to SNMPv3 requests, see
+  the AGENT section.
+ 
+
+
+How big can an SNMP request (or reply) be?
+-----------------------------------------
+
+    The protocol definition specifies a "minimum maximum" packet size
+  (484 bytes for UDP), which all systems must support, but does not
+  attempt to define an upper bound for this maximum size.  This is left
+  to each individual implementation.
+
+    The UCD software uses a fixed size buffer of 1472 bytes to hold the
+  encoded packet, so all requests and responses must fit within this.
+  Unfortunately, it's not possible to predict how many varbinds this
+  corresponds to, since it depends on the type and actual values being
+  sent, as well as the corresponding OIDs.
+
+    As a rule of thumb, sending 400 integer-valued varbinds seems to
+  work OK, while 300 string-valued varbinds triggers an overrun.
+
+
+
+How can I monitor my systems (disk, memory, etc)?
+------------------------------------------------
+
+    In general, the UCD suite consists of relatively low-level tools,
+  and there is nothing included that is designed for high-level,
+  long-term monitoring of trends in network traffic, disk or memory
+  usage, etc.
+
+    There are a number of packages available that are designed for this
+  purpose.  Two of the most widely used are MRTG (http://www.mrtg.org/)
+  and Cricket (http://cricket.sourceforge.net/).  There are details of
+  how to set up Cricket to monitor some of the UCD extensions at
+  http://www.afn.org/~jam/software/cricket/
+
+     We have also set up a page that describes in detail how MRTG
+  can be set up to monitor disk, memory and cpu activity at
+  http://www.net-snmp.org/tutorial-5/mrtg/index.html
+
+    The net-snmp package contains a web based manager itself that
+  runs on top of a mysql database, but it is extremely beta in
+  nature.  See the manager/README file for details.
+
+
+
+Applications complain about entries in your example 'snmp.conf' file.  Why?
+--------------------------------------------------------------------------
+
+    The example configuration file 'EXAMPLE.conf' is designed as a config
+  for the agent, and should be installed as 'snmpd.conf' (note the 'd').
+  The file 'snmp.conf' is intended for general configuration options,
+  applicable to all applications (via the SNMP library).
+    Rename (or merge) the 'snmp.conf' file to 'snmpd.conf', and this should
+  fix the problem.
+    Note that there is no example snmp.conf shipped with the standard
+  distribution.
+
+
+
+OK, what should I put in snmp.conf?
+----------------------------------
+
+    This is used to set common configuration values for most of the
+  applications, to avoid having to specify them every time.  Examples
+  include the SNMPv3 settings mentioned above, defaults for which MIBs
+  to load and where from, and the default SNMP version, port and
+  (if appropriate) the community string to use.
+
+    Some of these (such as the MIB file location), might belong in a
+  shared snmp.conf file (typically /usr/local/share/snmp/snmp.conf or
+  /etc/snmp/snmp.conf) to apply to all users of the system.  Others
+  (particularly the SNMPv3 security settings), are more likely to refer
+  to a particular user, and should go in a personal snmp.conf file
+  (typically $HOME/.snmp/snmp.conf).
+
+    Note that the UCD package does not come with an example snmp.conf file.
+  See 'snmpget -H' and/or the snmp.conf(5) man page for more details.
+
+    You can also use the "snmpconf" command to help you generate your
+  snmp.conf configuration file (just run it and answer its questions).
+
+
+
+PERL
+====
+
+Where can I get the perl SNMP package?
+-------------------------------------
+
+  Joe Marzot's excellent perl SNMP module, which requires the ucd-snmp
+  library, is now included in the ucd-snmp source release.  It's
+  located in the perl/SNMP subdirectory of the ucd-snmp source tree.
+
+  It can also be found at any Comprehensive Perl Archive Network
+  (CPAN) site mirror in modules/by-module/SNMP.  To find the CPAN site
+  nearest you, please see http://www.cpan.org/SITES.html.
+
+  With the v5 release of the Net-SNMP suite, this is now accompanied by
+  a number of perl modules grouped together under the NetSNMP namespace.
+
+  Consult the README file in the SNMP perl module distribution to find 
+  out what version of the ucd-snmp library it needs to be linked against.
+
+
+
+How do I install the Perl SNMP modules?
+--------------------------------------
+
+  Assuming you have a reasonably new (and properly configured) perl system,
+  this should be simply:
+
+        cd perl		(for 5.0.x)
+  or    cd perl/SNMP	(for 4.2.x)
+	perl Makefile.PL
+	    (press RETURN when prompted for host and community)
+	make
+	make test
+	make install  (probably as root)
+
+  Note that with the 5.0 release line, there are additional SNMP-related
+  perl modules that should probably be installed as well.  These can also
+  be found under the 'perl' subdirectory.  At the very least, install the
+  'default_store' module.
+    This is not necessary with the 4.2.x releases.
+
+
+
+But compiling this fails! Why?
+-----------------------------
+
+  The perl module tends to delve quite deeply into the internals of the
+  main UCD snmp library, and so is quite sensitive to changes within the
+  library.  It's important to use the correct version of the module, that
+  corresponds to the version of the library you have installed.  If you're
+  working with the main UCD distribution, the appropriate version of the
+  perl module is shipped as part of this, but you *must* have
+  run "make install" on the main UCD distribution *first*.
+
+  If you're working with a ready-installed version of the library, make
+  sure you obtain a compatible version of the perl module.
+
+    Note that the perl modules will be compiled using the compiler
+  (and compiler settings) used for compiling the original perl binary,
+  *not* those used for compiling the Net-SNMP (or UCD) library.
+  If these are different (e.g. 'gcc' used for one and 'cc' for the other)
+  then this may well cause problems.  It's much safer to use a consistent
+  environment for both.  This issue is discussed in greater detail in
+  the README.solaris file.
+
+    Also note that the v5 Net-SNMP suite *must* be configured to provide
+  shared libraries in order for the perl modules to work correctly.  This
+  is not necessary with the v4 UCD-SNMP libraries.
+
+
+
+Compiling the perl module works OK, but 'make test' fails. Why?
+--------------------------------------------------------------
+
+  That's difficult to answer in general.
+  Some of the perl tests are rather picky, so this may simply be
+  some minor inconsistency between your precise setup, and the
+  expectations of the test environment.
+
+    Check that you are working with the perl distribution that matches
+  the SNMP libraries (use the 'perl/SNMP' in preference to CPAN), and
+  that you have installed the main libraries successfully (uninstall
+  any old versions if you're having trouble).
+
+    If all this looks OK, and if most of the tests pass, then it's
+  probably safe to run 'make install' anyway.   Probably.
+
+
+
+The perl 'make test' fails on the OID tests. Is it safe to continue?
+-------------------------------------------------------------------
+
+  No.  Almost certainly not.  If the "perl/OID" tests fail the first
+  four tests, and then crashes out complaining about a "netsnmp_oidPtr",
+  then this is a sign of a more fundamental problem.
+
+  The 4.2.x line perl support was a single module, so was independent
+  of the way that the C library was configured.  In contrast to this, 
+  the 5.0.x perl support consist of a number of inter-cooperating modules,
+  which rely on sharing a consistent C library environment.  In practise,
+  this means that the perl modules *MUST* be configured and compiled using
+  a shared version of the C library.   Unfortunately, the default for
+  most early versions of the Net-SNMP suite was to compile using static
+  libraries unless explicitly configured to use shared libraries.  The
+  default should be to use shared libraries from 5.0.7 onwards.
+
+  The error "oid1 is not of type netsnmp_oidPtr" is a fairly sure indication
+  that the C library was compiled statically.   You'll need to re-configure
+  the main Net-SNMP package using the "--enable-shared" configure flag.
+  Then re-install the C library before re-configuring and re-compiling
+  the perl module support.
+
+  Note that this problem does not arise when using the 4.2.x version
+  of perl support.
+
+
+
+I'm trying to use mib2c (or tkmib) and it can't locate SNMP.pm?
+------------------------------------------------------------
+
+  That's probably because the SNMP perl module hasn't been installed.
+  It's not part of the standard perl distribution, nor is it installed
+  by default in RedHat Linux (for example).
+    You'll need to install it.  See the previous two questions.
+
+
+
+I'm trying to use mib2c (or tkmib) and it can't load SNMP.so?
+------------------------------------------------------------
+
+    This is probably the same problem.  Either the SNMP module
+  hasn't been installed, or it's the wrong version.  See the
+  previous two questions.
+
+
+
+I'm trying to use tkmib and it can't locate Tk.pm?
+-------------------------------------------------
+
+  Tk.pm is another Perl package that needs to be installed before tkmib
+  will run.  It's also available on Perl CPAN.  We suggest using version
+  "Tk800.011" or later.  It can be installed by issuing the command:
+
+		perl -MCPAN -e shell ; "install Tk"
+
+
+
+I've got a problem with the Net-SNMP module.  Can you help?
+----------------------------------------------------------
+
+  Sorry, despite the similar-sounding name, the Net-SNMP (or Net::SNMP)
+  module is nothing to do with this package, or the NetSNMP modules.
+  Net::SNMP is a "pure-perl" implementation of SNMP support, developed
+  by David Town.  The developers of the (C-based) Net-SNMP suite do
+  not have any significant experience in using this particular module,
+  and you'll probably be better off asking for help via CPAN or some
+  other perl-related forum.
+
+
+
+MIBS
+====
+
+Where can I find a MIB compiler?
+-------------------------------
+
+  That depends what you mean by a "MIB compiler".  There are at least two
+  types of tool that are commonly referred to by this name.
+
+  The first is a tool to check MIB files for validity.  The functionality
+  of this is mostly integrated within the MIB parser (part of the UCD library)
+  and hence included in all the applications.  The tool 'snmptranslate' is
+  probably the most appropriate for this purpose.
+    Note that the parser is fairly forgiving (see 'What ASN.1 parser is used'
+  below), so this should not be regarded as a stamp of approval.
+
+    The second type of tool is one to turn a MIB specification into C code,
+  specifically one designed to aid agent implementation.  The command 'mib2c'
+  is an example of such a tool for the UCD agent.  
+  See the CODING section for more information.
+
+
+
+I can't load any of the mib files, and they seem to be missing
+the first two characters of the filename.  What's happening?
+-----------------------------------------------------------
+
+  This is a problem experienced with Sun systems when the tools have
+  been compiled with a mixture of BSD and Solaris environments.
+  You'll need to re-configure and compile the tools, making sure that
+  '/usr/ucb' is not in your PATH (or at least comes at the end).
+
+
+
+Why aren't my mib files being read in?
+-------------------------------------
+
+    The UCD library only loads a subset of MIB files by default.  This
+  list is set at when the suite is first configured and compiled, and
+  basically corresponds to the list of modules that the agent supports.
+  (This is a simplification, but is a reasonable first approximation).
+
+    You can override this by using the command-line option '-m', the
+  environmental variable 'MIBS' or the snmp.conf directive 'mibs'.
+  Each of these take a (colon-separated) list of MIB module names
+  to load.   Starting the list with a '+' character will add them to
+  the default list - otherwise it replaces the defaults.
+
+    Using the special value 'ALL' will load all the MIB files that
+  the library can find.
+
+
+    Alternatively, the tools may be looking in the wrong place.
+  The default location for the mib files is /usr/local/share/snmp/mibs.
+  Again, this is set when the suite is first configured and compiled.
+  This can be changed using the environmental variable 'MIBDIRS'
+  or the snmp.conf directive 'mibdirs'.
+
+    Note that this may very well affect you if you've installed a
+  new version of the suite manually, replacing one provided by the
+  supplier (which typically would use a more 'central' location).
+
+
+    Finally, are you sure that you've installed the MIB files?
+  If you've compiled the suite from scratch, you need to run
+  "make install" at least once, before the tools will be able to
+  find the MIB files.  This is unlikely to be a problem if you've
+  been working with the tools for a while, but can bite those coming
+  fresh to the SNMP world.
+
+
+
+I'm getting answers, but they're all numbers. Why?
+-------------------------------------------------
+
+  This is actually the same as the previous question.  Because the tools
+  don't read in every MIB module they can find, it is quite possible
+  for results from an agent to refer to modules that have not been loaded
+  (particularly with GETNEXT requests, or when walking a tree).
+     The tools will report the answer quite correctly, but won't translate
+  identifiers and enumerations into readable strings.  To fix this, use
+  the environmental variables MIBS or MIBFILES (or the '-m' and '-M' flags)
+  to read in the relevant module files.
+
+
+
+What does "Cannot find module (XXX-MIB)" mean?
+---------------------------------------------
+
+    This is similar to the previous questions.   In this case, it's
+  stating that it can't find the specified module - either because
+  it's not installed properly, or the name used is subtly wrong.
+
+    If it's just one or two modules that are not being found, check
+  that the files are in the expected location, are readable, and the
+  name being used is correct.  Note that the name reported is the
+  name of the MIB module, which is not necessarily the same as the
+  name of the file. See the question 'How do I add a MIB to the tools?'
+  for more details on this.
+
+    If the tool is generating a whole slew of errors, then it's
+  likely that either the MIB files haven't been installed at all,
+  or the library is looking in the wrong place.   See the previous
+  two questions.
+
+
+
+What about "unlinked OID"?
+-------------------------
+
+    This means that the library has been able to find the MIB module,
+  and parse the individual objects defined in it, but is having problems
+  linking them together into a consistent tree.  In particular, it
+  can't find an object corresponding to the name within the braces
+  (i.e. the 'xxx' in '{xxx 99}').
+
+    This is probably due either to a typo in this name (remember that
+  names are case sensitive, so a reference to 'xxx' will *not* match
+  a definition of 'Xxx'), or else the name is defined in another MIB
+  file, and this dependency is missing from the IMPORT clause of this
+  MIB file.
+
+
+
+The parser doesn't handle comments properly. Why not?
+------------------------------------------------------------
+
+  The most likely reason is that the line in question contains two
+  (or more) sequences of pairs of dashes.  This is often used to try
+  and "comment out" an unwanted line that already contains a comment:
+
+	--   broken ::= { myMIB 1 }   -- This isn't working yet
+
+  The assumption here is that a comment continues to the end of the line.
+  Unfortunately, this assumption is not correct.
+    A comment will continue either to the end of the line, or the next
+  occurance of a pair of dashes.  Thus in this case, the definition of
+  "broken" is commented out (as intended) but the following text is
+  treated as part of the MIB, and will generate an error.
+
+    A similar effect can be obtained when a line of dashes has been used
+  to try and mark separate parts of a MIB file.
+
+    Most of the applications have a command-line option (-Pc) which will
+  work around this problem by treating the whole line as a comment.  But
+  this is not strictly legal, and the offending MIB file should really be
+  corrected.
+
+
+
+How do I replace MIB values with new ones?
+-----------------------------------------
+
+  The UCD parser generally takes the first definition it sees for each
+  object in the MIB hierarchy.   Even if you specify your file to be read
+  first, if the IMPORTS clauses reference a MIB with competing objects,
+  those objects will be parsed first.
+
+  When specifying the Replace MIB command-line option (-PR), the parser
+  will use definitions sourced from the most recent MIB file.
+  The parser will replace MIB objects when the sub-identifier and name match.
+
+  Caution: Using Replace MIB, there is NO guarantee that the resulting
+  MIB tree will be correct.  Other MIB objects matching the name but
+  not the sub-identifier will persist.  Sub-hierarchies may be reparented.
+  In particular, random access searching [see man 1 snmpcmd]
+  may give unexpected result.
+  The Replace MIB option is experimental, buyer beware, carpe diem, etc.
+
+  Here are a few considerations to help you obtain good results.
+  These hold true even if you never use the Replace MIB feature.
+  Your suggestions for improvement are welcomed.
+
+    1. The parser searches the specified directories and attempt
+       to parse every file whose path does not begin with "." (period).
+       Remove (or rename) older MIB files from these directories.
+       Rename "README" to ".README" , etc.
+
+    2. Hint: the parser's module list is in LIFO order. You may see better
+       results if the directory with the most correct MIB files is
+       specified last in the MIBDIRS environment.
+
+    3. Constrain the parser to not read in default MIB files by setting
+       the MIBS environmental variable to the appropriate separator character
+       (semi-colon on win32, colon everywhere else).
+       Setting this to "" may also have the same effect.
+
+    4. The MIBFILES environment can specify the path of the new MIB file.
+
+  Within a program, the call:
+	 /*  4.2.x  */
+	 ds_set_boolean(DS_LIBRARY_ID, DS_LIB_MIB_REPLACE, 1 | 0);
+
+  or, if using the 5.0.x series code:
+	/*  5.0.x  */
+	netsnmp_ds_set_boolean(NETSNMP_DS_LIBRARY_ID,
+			       NETSNMP_DS_LIB_MIB_REPLACE, 1 | 0);
+
+  will enable or disable the Replace MIB feature respectively.
+  If you're having problems loading a particular MIB file, this
+  call can be used to disable this feature, before using read_mib() to
+  load the required file, and then re-enabling the Replace MIB feature.
+  (or vice versa, as appropriate).
+
+
+
+How can I get more information about these MIB file problems?
+------------------------------------------------------------
+
+  The command 'snmptranslate' is used to translate between numeric
+  and symbolic forms of OIDs.  It uses the same routines as the
+  'active' commands, but does not rely on communicating successfully
+  with a network management agent.  As such, it is a useful tool
+  for identifying problems with reading in MIB files.
+
+    In particular, the following options may be useful in
+  identifying problems:
+	-Pw  warns about conflicting symbols
+	-PW  prints more verbose warnings about other problems as well
+		(in both cases, ignore the 'xmalloc' reports)
+	-T   provides sub-options for various views of these entries
+
+  There are other '-P' options to control various aspects of MIB parsing.
+  See the 'snmptranslate(1)' and 'snmpcmd(1)' man pages for more details,
+  or the tutorial at
+	http://www.net-snmp.org/tutorial-5/commands/snmptranslate.html
+
+
+
+What's this about "too many imported symbols"?
+---------------------------------------------
+
+  Any MIB file starts with an (optional) list of identifiers that
+  it "imports" from other files.  The parser implements this using
+  a fixed size buffer to hold the import information.
+    There are two circumstances in which this can result in the
+  error message shown above.
+
+    Firstly, if the MIB file refers to an unusually large number
+  of external identifiers.  Handling this case requires a (trivial)
+  patch to the parsing code.  Contact the coders list for advice.
+     (This is extremely rare - the only example that
+      we've come across is the Cabletron Trap MIB).
+
+    Much more common is a syntax error in the IMPORTS clause of the
+  MIB file in question.  In particular, check that this ends in a
+  semicolon, before going on to the main definition section.
+  
+
+
+AGENT
+=====
+
+What MIBs are supported?
+-----------------------
+
+  The following MIBs are supported (at least in part and on some systems):
+
+	- MIB-2  General network statistics (RFC 1213)
+	- UCD agent extensions
+		(processes, disks, memory, load average,
+		 shell commands, error handling)
+	- Host Resources (RFC 1514) initial implementation
+	- SNMPv3 MIBS (RFCs 2571-6)
+
+  The SNMPv2 Party and Manager-to-Manager MIBs (RFCs 1447 & 1451) have been
+  withdrawn.
+
+
+
+What protocols are supported?
+----------------------------
+
+  The agent supports all three current versions of SNMP (v1, v2c and v3),
+  over both UDP and TCP transports, as well as a SMUX (RFC 1227) master
+  agent, AgentX (RFC 2257 ) in both master and subagent roles, and SNMP
+  proxying.
+
+
+
+How do I configure the agent?
+----------------------------
+
+  That depends on what you want it to do.  See the snmpd.conf(5) manual
+  page for the possibilities.
+
+  You can also run the "snmpconf" perl script to help you create this
+  file.  Start off with 'snmpconf -g basic_setup' to get you going.
+
+
+
+How do I add a MIB to the agent?
+-------------------------------
+How do I add functionality?
+--------------------------
+
+  While simply adding a file to the MIB directory (and possibly tweaking
+  the list of MIBs to load) is sufficient for the tools, unfortunately
+  extending the functionality of the agent to include this is not so simple.
+  In fact, the agent makes little or no use of these files, and will work
+  quite happily without them.  All the information about the syntax and
+  scope of the variables supported is hardwired into the implementation
+  of the agent.
+
+  There are a number of alternative ways to add functionality for a new
+  MIB to the agent.
+
+  Firstly, it is possible that the agent distribution already includes
+  the desired functionality, but this has simply not been configured in
+  to the running version.  This is done using the configure option
+		--with-mib-modules="list"
+  (where "list" is a space-separated list of modules to include) then
+  recompiling the agent.
+  Note that some functionality concerned with monitoring and managing
+  unix hosts is included in the UCD extension modules, which are located
+  within the 'private' branch of the MIB tree.  This is covered in a later
+  question in this FAQ.
+
+  Secondly, it is possible for the agent to run commands or shell scripts
+  in response to queries.  These can obtain and report the necessary
+  information, or perform actions as required.
+  Detailed information and examples are provided in the snmpd(8) and
+  snmpd.conf(5) manual pages, and the EXAMPLE.conf file.
+  This is known as "pass-through" support.
+
+  Thirdly, it may be possible to link another agent (which already
+  supports the desired MIB), as a "subagent" of the UCD master (or
+  vice versa).  The possibilities here are SMUX, AgentX or proxied
+  SNMP (see the next question but one).
+
+  Finally, the agent itself can be extended to support additional MIB
+  groups, by writing the necessary C code, and including this within
+  the main agent - either statically compiled in, or dynamically loaded.
+  This is covered further in the next section.
+
+    Note that there is no visible difference between 'pass-through'
+  MIB support, subagents, and modules implemented within the main agent
+  itself. Tools querying the agent will see a single MIB structure.
+ 
+
+
+What's the difference between 'exec', 'sh' and 'pass'?
+-----------------------------------------------------
+
+    'exec' will fork off the specified command and return the exit status
+  and/or the output.  Arguments are passed directly to the command.
+
+    'sh' is similar, but invokes a shell to run the command line given.
+  This means that quoted arguments will be recognised as such, and also
+  allows redirection, and other similar shell interpretation.
+
+  Neither of these mechanisms require the command to have any knowledge
+  of the fact that they are being used in this manner.  Note that return
+  values are cached within the agent for 30 seconds, rather than invoking
+  the command for every request.
+
+
+    'pass' is a more general mechanism for extending the agent, and the
+  command given will be invoked for any request within the specific MIB
+  subtree.  Details of precisely how this command will be called in
+  various circumstances is given in the 'snmpd.conf(5)' man page.
+
+    'pass-persist' is similar, but the command will continue running
+  even once the initial request has been answered.
+
+  See 'snmpd.conf(5)' for more details.
+
+  
+
+What's the difference between AgentX, SMUX and proxied SNMP?
+-----------------------------------------------------------
+
+    All three are protocols that can be used to make two or more agents
+  appear as one to the querying application.  In each case, one agent
+  takes the role of "master", and delegates requests to one of the others
+  as and where this is appropriate.  The differences between them mainly
+  relate to how data is represented, and the mechanisms for communication
+  between master and subagents.
+
+    SMUX and proxy SNMP both essentially use the standard SNMP packet format.
+  The main difference is that a proxy SNMP subagent need not be aware that
+  it is acting in such a role.  It typically listens on a non-standard port,
+  and simply receives requests as usual, forwarded from the master agent. 
+  The main issue to be aware of is that such requests will usually appear
+  to come from the local host, and this may affect how the access control
+  mechanisms need to be set up.
+
+    SMUX uses a similar packet format, but the subagent "registers" with
+  the master agent, providing a suitable password.  The UCD agent includes
+  the possibility of acting as a SMUX master agent, but the suite does not
+  include a subagent API.   Note that the SMUX protocol has essentially
+  been superceded by AgentX, but is still provided in order to support
+  existing SMUX subagents.
+    See the file 'agent/mibgroup/README.smux' for details.
+
+    AgentX uses a more compact (and simpler) packet format, with a richer
+  range of administrative commands, and provides a more flexible and reliable
+  extension mechanism.  The UCD agent can be used in both master and subagent
+  roles, and the agent library can also be used to embed an AgentX subagent
+  within another application.
+    See the file 'README.agentx' for details.
+
+  Note that support for SMUX is not configured in by default.  You will
+  need to run configure with the option
+
+		--with-mib-modules=smux
+
+  Starting from release 4.2.1, AgentX support is now included by default,
+  but needs to be explicitly activated in the master agent.  Do this by
+  adding the line
+
+		master agentx
+
+  to the snmpd.conf file before starting the agent.  Note that there are
+  a number of known problems with the AgentX support in the 4.x line, and
+  this should not be used on production systems.  The 5.0 AgentX support
+  has been significantly improved, and production use is less foolhardy.
+    See README.agentx for details.
+
+
+
+What about 'dlmod' - what's that about?
+--------------------------------------
+
+  Dynamically loaded modules are a means of including a MIB implementation
+  module within the main SNMP agent (or an AgentX subagent) without needing
+  to re-compile and re-link the agent binary.  Instead, details of the
+  module(s) to load are specified in the configuration file, and the agent
+  locates the files listed, and merges them in at run time.
+
+  See http://www.net-snmp.org/tutorial-5/toolkit/dlmod/ for more information.
+
+
+
+Which should I use?
+------------------
+
+  That's a difficult question.
+
+  Comparing the three protocols, SNMP was not originally designed
+  as an internal subagent-communication protocol, and there are
+  certain architectural limitations to SMUX, which were addressed
+  as part of the design of AgentX.  These include such aspects as
+  reliable handling of SET requests (particularly in the face of
+  failures), a common value for sysUpTime, and a mechanism for
+  sharing tables across multiple subagents.
+    So from a purely functional point of view, AgentX is the most
+  appropriate choice for subagent communication.
+
+  In terms of implementation, SMUX is the most mature of the three,
+  but is no longer being actively maintained.  The original author
+  has moved on, and the current developers don't use this facility.
+  It also only includes master agent support - the package does not
+  provide a SMUX sub-agent API.
+    The AgentX support in the 4.x line has a number of known problems,
+  and is not suitable for use in front-line situations (though it's
+  probably sufficiently stable and functional for simple day-to-day
+  use).  The 5.0 agent has seen a significant amount of development,
+  and is a much more reliable beast.
+    Bear in mind that the AgentX and proxy SNMP implementations are
+  relatively new code, so have not received the same level of active
+  service that the core agent has.  But with that caveat, either of
+  these options should be suitable for most use.
+
+    This decision will probably be dictated by external considerations
+  (i.e. the other agents you need to combine with).  Ideally, you
+  should be looking towards AgentX, but this is not always possible.
+
+  Dynamically loaded modules serve a somewhat different purpose,
+  and are purely concerned with how the individual MIB implementation
+  modules are located.  These can be combined with either a "pure SNMP"
+  model, an AgentX subagent or a proxied SNMP agent.  They will involve
+  a slightly greater load on agent start-up (plus an extra level of
+  complexity if things go wrong) - balanced against the ability to
+  avoid re-compiling and re-linking a working binary.
+
+    Note that as far as individual MIB modules are concerned, the
+  protocol used to transport the request is more or less irrelevant.
+  The same information is being requested (or set) each time, so
+  a MIB module ought to be protocol-independent.  This was one of
+  the design aims of the AgentX support, and the exact same module
+  code can be included as part of a pure-SNMP master agent, or an
+  AgentX subagent, either compiled in or dynamically loaded with no
+  modifications needed to the MIB module code itself.
+
+
+
+Can I use AgentX when running under Windows?
+-------------------------------------------
+
+  Yes, but there are a couple of things to be aware of.
+
+  Firstly, by default the AgentX master listens on the Unix domain
+  socket '/var/agentx/master', which doesn't work under Windows.
+  You'll need to tell it to listen on a TCP port, either by using
+  the command-line option "-x localhost:705",  or by adding the
+  directive "agentxAddress localhost:705" to the snmpd.conf file.
+
+  Secondly, be aware that the security of AgentX connectivity is not
+  particularly strong.  The examples given here would allow any process
+  running on the local machine to register as an AgentX subagent.  The
+  more obvious settings "-x 705" or "agentxAddress 705" would allow
+  a system *anywhere* on the network (or even from remote networks) to
+  register as an AgentX subagent.  This could potentially be used to
+  hijack the agent, or provide false information.
+
+
+
+How can I run AgentX with a different socket address?
+----------------------------------------------------
+
+  There are two sides to an AgentX connection, and they need to
+  agree about which socket address to use.  So if you want to use
+  a different socket, you need to configure both sides accordingly.
+
+  For the Net-SNMP master agent, this is done using the command-line
+  option '-x'.  The command
+		"snmpd -x localhost:705 ...."
+  would start the agent listening on the TCP port 705 for connections
+  from the local system.
+
+  The main Net-SNMP agent can also be run in a "subagent" mode, and
+  this uses the same command-line option to specify a different
+  AgentX socket.  So
+		"snmpd -X -x localhost:705 ...."
+  would start it as a subagent, and connect to the master agent
+  listening on TCP port 705 on the same system.
+
+  A subagent running embedded within some other application will
+  typically not understand the same command-line options.  This
+  will need to set the same configuration programmatically.
+  For example, the example subagent driving code from the Net-SNMP
+  "subagent program" tutorial (on the project web pages) could
+  be made to connect to the same TCP port by adding the line
+     netsnmp_ds_set_string(NETSNMP_DS_APPLICATION_ID,
+                           NETSNMP_DS_AGENT_X_SOCKET, "localhost:705");
+  before the 'init_agent' call.
+
+  However, see the mention of AgentX security (or the lack of it!)
+  in the previous entry.
+
+
+
+How can I combine two copies of the 'mib2' tree from separate subagents?
+-----------------------------------------------------------------------
+
+  With the 4.x line agent, you can't.  Sorry about that.
+
+  With the 5.0 agent, this is possible by using the SNMPv3 context string
+  to distinguish between parallel MIB trees.  This can be set up for an
+  individual MIB implementation module when it registers itself with the
+  main agent framework (either directly, or via AgentX).  It can also
+  be set up for a proxied subagent as part of the proxy configuration
+  entry (see 'snmpd.conf(5)').
+    This facility is not currently available for SNMPv1 or SNMPv2c
+  requests (although it ought to be possible to use the community
+  string in a similar way).
+
+    Another way to handle this would be to tweak one of the subagents to
+  use a different set of (non-standard) OID assignments - perhaps by
+  relocating the whole of the subtree to another (private) OID.  This
+  is not ideal, but should work with all configurations.
+
+
+
+What traps are sent by the agent?
+--------------------------------
+
+  The agent sends a 'coldStart(0)' trap when it first starts up, and a
+  UCD-specific trap 'ucdShutdown' when it stops.  It can also be configured
+  to send an 'authenticationFailure(4)' trap when it receives an SNMPv1
+  request using an unknown community name.  It does not currently generate
+  either 'coldStart(0)' or 'warmStart(1)' traps on being re-configured,
+  though this would be fairly simple to add.  (The main difficulty would
+  be determining whether the configuration had changed or not).
+
+    The agent does not send 'linkUp' or 'linkDown' traps.  Nor does it
+  generate traps when one of the monitored characteristics (disk usage,
+  running processes, etc) enters or leaves an error state.  Generating such
+  traps would be simple enough, but the difficulty is in recognising when
+  they should be generated.  See the question on generating traps in the
+  CODING section for more discussion of this.
+
+    With all these alerts, the agent also needs to be configured with
+  (one or more) destinations to send them to, specifying the type of
+  notification (v1 or v2 trap, or v2 inform) and the community name to
+  use.  This uses the snmpd.conf directives 'trapsink', 'trap2sink' and
+  'informsink' for the destination type, and 'trapcommunity' for the
+  community name.  SNMPv3 destinations can be configured using the directive
+  'trapsess'.   See the snmpd.conf man page for details.
+
+    Note that all notifications will be sent to all destinations.  The
+  agent does not (currently) support notification filtering.
+ 
+
+
+How can I send a particular trap to selected destinations?
+----------------------------------------------------------
+
+    With the 4.2.x agent, this isn't possible (or at least not
+  easily).  When you request the agent to generate a trap (using
+  either 'snmp_v2trap' or 'snmp_easy_trap'), this will be send
+  to all the known destinations.
+
+    The 5.0 agent introduces preliminary support for the
+  snmpNotifyFilterTable which is designed to allow this sort of
+  selective trap direction, though this is not currently active.
+  (The tables are present, but the information is not consulted)
+  Documentation on how to use this facility will appear once the
+  functionality is working properly.
+
+
+
+Why does calling 'snmp_v2trap' generate an SNMPv1 trap (or vice versa)?
+----------------------------------------------------------------------
+
+    The two versions of the trap API calls are concerned with how
+  the trap is represented when it is passed *in* to the API, not
+  the version of the trap PDU that will actually be generated by
+  the agent.  That is determined by the configuration token used
+  to set up the trap destination.
+
+    Remember that in general, all traps are sent to all destinations.
+  This means that a trap specified using the SNMPv1 trap syntax
+  needs to be converted to the SNMPv2 format before it can be sent
+  to an SNMPv2 (or SNMPv3) destination.  Similarly, a trap specified
+  using the SNMPv2 syntax needs to be converted to the SNMPv1 format
+  before it can be sent to an SNMPv1 sink.
+
+    Essentially, the API call to use depends on what you asking for,
+  which is not necessarily what the recipients will actually get!
+
+
+
+When I run the agent it runs and then quits without staying around. Why?
+-----------------------------------------------------------------------
+
+  Firstly, are you certain that this is what is happening?
+
+  The normal operation of the agent is to 'fork' itself into the
+  background, detaching itself so that it will continue running even
+  when you log out, and freeing the command line for subsequent use.
+  This looks at first sight as if the agent has died, but using 'ps'
+  to show all processes should reveal that the agent is still running.
+
+  To prevent this behaviour (such as when attempting to debug the
+  agent), you can start it with the '-f' flag.  This suppresses the
+  fork, and the agent will run as a 'normal' command.  It's also often
+  useful to use the '-L' flag, to log messages to stdout.
+
+  On the other hand, if 'ps' shows that the agent is not running, then
+  this is an error, and probably show that something went wrong in
+  starting the agent up.  Check the agent log file for any error messages,
+  or run it with '-f -L' and see what it reports.
+
+  One known example of this is the 'ucd-snmp' RPM distributed by RedHat.
+  This agent crashes if there is a 'disk' configuration entry in the
+  snmpd.conf file.  It is not currently known what causes this, as this
+  setting works correctly if the agent is compiled from source.
+
+
+
+After a while the agent stops responding, and starts eating CPU time.  Why?
+--------------------------------------------------------------------------
+
+  This is most commonly seen when performing an "snmpwalk" on an agent
+  that's either using a default "vendor provided" configuration
+  (typically access to the 'system' group only), or which is trying
+  to restrict access for individual users or communities to a subset
+  of the whole OID tree.
+
+  The agent implementation of "GetNext" processing is relatively
+  inefficient when dealing with inaccessible objects, and it is quite
+  easy for the clients to time-out and retry a request, while the agent
+  is still trying to process the original.  If this happens continually
+  (as is typically the case with an snmpwalk), the agent can get swamped
+  by this backlog.
+
+  The 5.0.x line has now addressed this, starting with the 5.0.7 release.
+  The 4.2.x line still suffers from this problem, and it is unlikely that
+  this will be fixed.  (The 5.0.7 approach relies on some of the new
+  features in the 5.0.x line, and it has not proved possible to apply
+  this to the 4.2.x code base).
+
+
+
+How can I stop other people getting at my agent?
+-----------------------------------------------
+
+  Firstly, are you concerned with read access or write access?
+
+  As far as changing things on the agent is concerned, there is relatively
+  little that can actually be altered (see the answer to " I cannot set
+  any variables in the MIB" above).
+
+    If you are using the example config file, this is set up to allow
+  read access from your local network, and write access only from the
+  system itself (accessed as 'localhost'), both using the community name
+  specified.  You will need to set appropriate values for both NETWORK
+  and COMMUNITY in this file before using it.
+    This mechanism can also be used to control access much more precisely.
+  (see the next questions for details)
+
+  Other options include:
+	- Blocking access to port 161 from outside your organisation
+		(using filters on network routers)
+	- Configuring TCP wrapper support ("--with-libwrap")
+		This uses the TCP 'libwrap' library (available separately)
+		to allow/deny access via /etc/hosts.{allow,deny}
+
+  For strict security you should use only SNMPv3, which is the secure
+  form of the protocol.
+
+
+
+How can I listen on just one particular interface?
+-------------------------------------------------
+
+    Normally, the agent will bind to the specified port on all interfaces
+  on the system, and accept request received from any of them.  With
+  version 4.2, the '-p' option can now be used to listen on individual
+  interfaces.  For example,
+	
+			snmpd -p 161@127.0.0.1
+
+  will listen (on the standard port) on the loopback interface only, and
+
+			snmpd -p 6161@10.0.0.1
+
+  will listen on port 6161, on the (internal network) interface with address
+  10.0.0.1.   If you want to listen on multiple interfaces (but not all),
+  then simply repeat this option for each one:
+
+		snmpd -p 161@127.0.0.1 -p 6161@10.0.0.1
+
+  The 5.0 agent has a similar facility, but does not use the '-p' command
+  line option flag.  Instead, the ports and/or interfaces to listen on are
+  simply listed on the command line, following any other options.  Also,
+  the syntax of port and interface is slightly different (interface:port).
+    So the three examples above would be
+
+			snmpd 127.0.0.1:161
+			snmpd 127.0.0.1:6161
+			snmpd 127.0.0.1:161 127.0.0.1:6161
+
+  The AgentX port option ('-x') works in much the same way, using the
+  "host:port" syntax (in both 4.2 and 5.0 lines - and yes, this *is* an
+  inconsistency in 4.2!)
+
+
+
+How do I configure access control?
+---------------------------------
+
+    The simplest way is to use the configure directives:
+
+		rocommunity public	(for SNMPv1/2c)
+		rwcommunity private
+  or
+		rouser user1		(for SNMPv3)
+		rwuser user2
+
+  These specify the community names or security names to accept for
+  read-only and read-write access to the whole of the supported MIB tree.
+  (Obviously you should change these names to match your requirements -
+  which is a particularly good idea in the case of 'rwcommunity'!)
+
+    These can also be restricted to particular subtrees, and/or request
+  sources.  Similarly, the configure directives 'rouser' and 'rwuser'
+  can be used to allow the specified SNMPv3-authenticated users access
+  to all or part of the MIB tree.  See 'snmpd.conf(5)'.
+
+    These are effectively wrappers round the core access control
+  mechanisms.  This uses four directives 'com2sec', 'group', 'view'
+  and 'access',  and provides a more efficient and flexible control
+  over who can access what portions of the tree.
+
+    See the next question for the gory details, and the entry after
+  that for setting up SNMPv3 users.
+
+
+
+I don't understand the new access control stuff - what does it mean?
+-------------------------------------------------------------------
+
+  The idea behind the new access control model is to give a more flexible
+  way of specifying who can see and do what within the MIB tree.
+  It's more complicated to understand than the simple example above, but
+  that's because it can do a whole lot more.
+
+    There are four configuration keywords in the new scheme:
+	'com2sec', 'group', 'view', and 'access'
+
+  We'll consider these one at a time, starting with 'access'.
+  (Because I feel like starting with the last one, that's why - OK?)
+
+
+  The "access" keyword has the job of specifying who has access to
+  which bits of the MIB tree.  This has eight parameters, so can look
+  rather offputting. Most of these can be safely left with default values
+  in most cases (so don't you worry your pretty little head about them).
+  The syntax is
+
+	access {group} "" any noauth exact {read-tree} {write-tree} {notify-tree}
+
+  where the entries in braces need to be defined elsewhere (I'm coming
+  to that - be patient!), and the rest can be left as shown here.
+
+	[ If you really want to know, the 'sec.model' field can be used
+	  to have an access line that's only relevant to particular
+	  versions of SNMP (such v1 or v2c) rather than "any" version,
+	  and the 'sec.level' field can be used to ensure that the
+	  request is authenticated or encrypted.
+	    You'll have to ask Niels about the other two!]
+
+
+  The "view" keyword is used to define particular bits of the MIB tree,
+  for use in the last three field of the access entry.
+  This has the syntax
+
+	view  {name}  included/excluded  {subtree}   {mask}
+
+  where {name} is the identifier to be used for this view (i.e. what should
+  appear in the access entry), and {subtree} is the portion of the MIB tree
+  that this name refers to (in either numeric or named form).
+    Note that the name of the view does not have to have anything to do
+  with the MIB sub-identifier names - it's purely an identifying tag for
+  use within the config file (though choosing a meaningful name is, as
+  always, a very good idea).
+  
+    The {mask} field can be used to control which elements of the OID subtree
+  should be regarded as relevant when determining which view an OID is in.
+  Normally, the whole of the OID should be included, and in this case the
+  mask field can be omitted.  See snmpd.conf for a description of how this
+  might be used.
+  The third field can be used to include or exclude particular portions
+  of the MIB from the view, and different lines can use the same view name
+  to build up a more complicated view, if that's what's needed.
+
+    The three view fields in the access line are used to control which
+  portions of the MIB tree a particular {group} can see (GET et al),
+  alter (SET), or request NOTIFYs on.
+
+
+
+    That's dealt with the "what" - now for the "who".
+  This is the role of the "group" and "com2sec" entries.
+
+  The "group" keyword gives general control, by mapping between a "security
+  name" (for a particular protocol version), and the internal name used in the
+  access line.  Note that the token "any" is no longer acceptable for the
+  security model - the original support for this was due due to a misreading
+  of the RFC.  You should replace any such line with separate versions for
+  each of the desired security models ('v1', 'v2c' & 'usm').
+
+    For SNMPv1 and SNMPv2c, the group line is just an intermediate step
+  between the "access" line and the "com2sec" line, which is the last bit
+  of the jigsaw.  The "com2sec" entry is used to determine a "security name"
+  from the traditional community string, taking into account where the request
+  has come from.  Thus the same community string can give access to  different
+  portions of the tree, depending on where the request is sent from.
+
+     For example, in an earlier version of the example config file, there
+  were two com2sec lines with the community string "public" - one was valid
+  from anywhere (with the security name "public") and one was only valid
+  from the local network (using the security name "mynet").
+     The group lines converted these security names into the groups "public"
+  and "mygroup" respectively, and the access lines gave these two groups
+  the ability to GET values in the 'system' sub-tree (from anywhere) or
+  the 'mib-2' sub-tree (from the local network).  Neither of these could
+  SET any values though, (since the write-tree was "none" in both cases).
+    Someone on the local machine, using the community string "private",
+  had the security name "local" and the group name "local", and hence had
+  full access (both GET and SET, as well as NOTIFY) to the whole of the
+  MIB tree (or at least everything under .1, which covers most things!)
+
+     Note that the three occurrences of "public", as community string,
+  security name and group name, were three totally separate things.
+  You can't use a community string in a security name field, or either
+  of these as a group name (or vice versa), unless you set up suitable
+  entries to map one name onto the other.
+
+    With SNMPv3, the security name is part of the basic protocol, and can
+  be used directly in a group definition.
+
+  And here concludes our tour of the view-based access control mechanism.
+  Phew!
+
+
+
+How do I configure SNMPv3 users?
+-------------------------------
+
+    Create a file /var/ucd-snmp/snmpd.conf file, containing the line
+
+	createUser {myUser} MD5 {myPassword} DES
+
+  (where {myUser} and {myPassword} are the appropriate values, _without_
+  the braces!).  Then start (or re-start) the snmpd agent.
+  This will create the new user.  See the access control entries above
+  for how to use this, and the file 'README.snmpv3' for more details.
+
+
+
+The 'createUser' line disappears when I start the agent.  Why?
+-------------------------------------------------------------
+
+    That's deliberate.   The agent removes the (human-readable) 'createUser'
+  directive, and replaces it with an equivalent 'usmUser'.  This
+  contains the same information, but in a form that's only meaningful
+  internally.  This means that the password is not longer stored in
+  a human-readable form.  Additionally, the password has been converted
+  to a key that can only be used to access the local machine.  If someone
+  stole the new usmUser line on this machine, they could not use that
+  information to access any of your other agents.
+
+
+
+What's the difference between /var/ucd-snmp and /usr/local/share/snmp?
+---------------------------------------------------------------------
+
+    Most "static" agent configuration should go in the traditional location
+  (typically /usr/local/share/snmp/snmpd.conf or /etc/snmp).   The
+  /var/ucd-snmp (or /var/net-snmp) location is used for information set during
+  the running of the agent, which needs to be persistent between one run of
+  the agent and the next.
+
+    Putting the 'createUser' line in this persistent file is an exception,
+  for security reasons (see above).  In general you shouldn't need to put
+  anything else here.
+
+
+
+My new agent is ignoring the old snmpd.conf file. Why?
+-----------------------------------------------------
+
+    The most likely explanation is that the new version of the agent is
+  looking in a different location than the previous one.  This is commonly
+  experienced when replacing a ready-installed version (e.g. from a Linux
+  distribution), with the current release installed from the source.
+
+    The default location for this file with the basic distribution is
+  /usr/local/share/snmp/snmpd.conf (or PREFIX/share/snmp/snmpd.conf).
+  Ready-installed versions often look for the file as /etc/snmpd.conf,
+  or /etc/snmp/snmpd.conf.  Try moving the old config file to the new
+  location, and restart the agent.
+
+    With release 5.0, the name of the package is changing from "ucd-snmp"
+  to "net-snmp", and this change is reflected in the name of the persistent
+  /var directory.  So a 5.0 agent will not look in /var/ucd-snmp/snmpd.conf
+  for settings from a previous (UCD) agent.
+
+
+
+Why am I getting "Connection refused"?
+-------------------------------------
+
+    This is actually nothing to do with the access control mechanism
+  (though that's an understandable mistake).  This is the result of
+  the TCP wrapper mechanism using the files 'hosts.allow' and 'hosts.deny'
+  to control access to the service.  Some distributions may come with
+  this enabled automatically - otherwise you need to select it explicitly
+  by configuring using '--with-libwrap'.
+
+    The simplest way to avoid this problem is to add the line
+
+		snmpd: ALL
+
+  in the file /etc/hosts.allow (or wherever this file is on your system).
+  Though be aware that doing this removes one level of protection and allows
+  anyone to try and query your agent (though the agent's own access control
+  mechanisms can still be used to restrict what - if anything - they can see).
+
+  Note that personal firewalls (such as Linux' ipchains mechanism) may have
+  a similar effect (though typically this won't be logged).
+
+
+ 
+I'm getting errors about "bad security model" - why?
+----------------------------------------------------
+
+  Until release 4.2, the access control handling accepted the token "any" 
+  to cover all of the recognised security models.  This is explicitly
+  forbidden in the relevant RFC, so support for this is being withdrawn.
+    As an interim measure, it is currently accepted (with the warning you
+  see), but this will not be the case in future releases of the agent.
+ 
+    You should replace the token 'any' with 'v1', 'v2c' or 'usm' as
+  appropriate.  If you want to support all three of these security models,
+  you'll need to use three distinct group lines, one for each. See the
+  example snmpd.conf file for details.
+
+  
+
+I'm getting errors about "bad prefix match parameter" - why?
+------------------------------------------------------------
+
+  This is similar to the previous question.  With 4.2, the syntax of the
+  'access' configure line has changed, and a value of '0' is no longer
+  acceptable for the sixth field.  Simply replace this with the word 'exact'.
+
+
+  
+Why can't I see values in the UCDavis 'extensible' or 'disk' trees?
+------------------------------------------------------------------
+
+  Both these trees are designed to report things you ask it to report
+  on.  If you don't declare anything in the snmpd.conf file for it to
+  monitor, it will not report anything.  See the snmpd.conf manual page
+  and the EXAMPLE.conf file for details on configuring the agent.
+
+  Optionally, run snmpconf -g monitoring to help you set up this
+  section of the snmpd.conf file.
+
+
+
+Why can't I see values in the UCDavis 'memory' or 'vmstat' trees?
+----------------------------------------------------------------
+
+  These mib modules are not supported on all operating systems, and
+  will not be included on any other system.  Currently, they are only
+  supported on Linux, HP-UX (memory only), Solaris, BSDi (vmstat on
+  BSDi4 only), Dynix, FreeBSD, NetBSD and OpenBSD.
+    If you want to help port it to other systems, let us know.
+
+  Note that these subtrees only report the current usage when
+  explicitly queried.  They do *not* generate traps when the
+  usage strays outside the configured bounds.
+
+
+
+What do the CPU statistics mean - is this the load average?
+----------------------------------------------------------
+
+  No.  Unfortunately, the original definition of the various CPU statistics
+  was a little vague.  It referred to a "percentage", without specifying
+  what period this should be calculated over.  It was therefore
+  implemented slightly differently on different architectures.
+
+    Recent releases includes "raw counters", which can be used to
+  calculate the percentage usage over any desired period.  This is
+  the "right" way to handle things in the SNMP model.  The original
+  flawed percentage objects should not be used, and will be removed
+  in a future release of the agent.
+
+    Note that this is different from the Unix load average, which is
+  available via the loadTable, and is supported on all architectures.
+
+
+
+What about multi-processor systems?
+----------------------------------
+
+    Sorry - the CPU statistics (both original percentages, and the
+  newer raw statistics) both refer to the system as a whole.  There
+  is currently no way to access individual statistics for a particular
+  processor.
+
+    Note that although the Host Resources table includes a hrProcessorTable,
+  the current implementation suffers from two major flaws.  Firstly, it
+  doesn't currently recognise the presence of multiple processors, and
+  simply assumes that all systems have precisely one CPU.  Secondly, it
+  doesn't calculate the hrProcessorLoad value correctly, and either returns
+  a dummy value (based on the load average) or nothing at all.
+
+    If you want to monitor a multi-processor system, you're currently
+  out of luck.  We hope to address this in a future release of the agent.
+  But you've got the source, so you can always have a go yourself :-)
+
+
+
+The speed/type of my network interfaces is wrong - how can I fix it?
+-------------------------------------------------------------------
+
+    Some operating systems will provide a mechanism for determining
+  the speed and type of network interfaces, but many do not.  In this
+  case, the agent attempts to guess the most appropriate values, based
+  on the name of the interface.
+    Version 4.2 allows you to override these guessed values, using the
+  configuration directive 'interface', specifying the name, type and
+  speed of a particular interface.  This is particularly useful for
+  fast-ethernet, or dial-up interfaces, where the speed cannot be
+  guessed from the name.
+    See the snmpd.conf(5) man page for details.
+  
+
+
+The interface statistics for my subinterfaces are all zero - why?
+----------------------------------------------------------------
+
+    Unfortunately, most kernels that support multiple logical
+  interfaces on a single physical interface, don't keep separate
+  statistics for each of these.  They simply report the overall
+  statistics for the physical interface itself.
+    There's no easy way around this problem - the agent can only
+  report such values as it can find out.  If the kernel doesn't
+  keep track of these figures, the agent can't report them.
+    Sorry!
+
+
+What does "klread:  bad address" mean?
+-------------------------------------
+
+  This means that the agent was unable to extract some of the
+  necessary information from the kernel structures.  This is
+  possibly due to:
+	- either looking in the wrong place for kernel information
+		(check the value of KERNEL_LOC)
+	- an error in the implementation of part of the MIB tree
+		for that architecture.  Try and identify which
+		OID is generating the error, and contact the
+		list 'net-snmp-coders@lists.sourceforge.net'
+		Remember to tell us what architecture you have!
+
+
+
+What does "nlist err:  wombat not found" (or similar) mean?
+----------------------------------------------------------
+
+  This means that the agent wasn't able to locate one of the
+  kernel structures it was looking for.  This may or may not
+  be important - some systems provide alternative mechanisms
+  for obtaining the necessary information - Solaris, for example,
+  can produce a whole slew of such messages, but still provide
+  the correct information.
+    This error only occurs if you have used the flag
+  '--enable-debugging' as part of the initial configuration.
+  Reconfigure the agent with '--disable-debugging' and these
+  messages will disappear.  (It won't fix the underlying problem,
+  but at least you won't be nagged about it).
+
+
+
+How about "Can't open /dev/kmem"?
+--------------------------------
+
+  This device is normally restricted to just being accessible by root
+  (or possibly by a special group such as 'kmem' or 'sys').  The agent
+  must be able to read this device to obtain the necessary information
+  about the running system.
+    Check that the agent was started by root, and is running with UID 0
+  (or suitable GID if appropriate).  The agent will normally continue
+  to run without this level of access permission, but won't be able to
+  report values for many of the variables (particularly those relating
+  to network statistics).
+
+ 
+
+The agent is complaining about 'snmpd.conf'.  Where is this?
+-----------------------------------------------------------
+
+  It doesn't exist in the distribution as shipped.  You need to
+  create it to reflect your local requirement.
+    To get started, you can either just create this as an empty file,
+  or run snmpconf to help you create one.
+    See the snmpd.conf(5) manual page for further details.
+
+
+
+The system uptime (sysUpTime) returned is wrong!
+-----------------------------------------------
+
+  Oh no it's not.
+  The defined meaning of 'sysUpTime' is
+	"the time ... since the *network management*
+	 portion of the system was re-initialized."
+
+  In other words, when the snmp agent was started, not when the
+  system itself last booted.  This latter information is available
+  in the Host Resources MIB as "host.hrSystem.hrSystemUpTime"
+  Note that even if the full Host Resources is not supported on
+  your system, it's worth configuring in the system portion using
+
+		'--with-mib-modules=host/hr_system'
+
+  and recompiling.  This particular group is reasonably likely to
+  work, even if some of the other more system-specific groups don't.
+
+
+
+How can I reduce the memory footprint?
+--------------------------------------
+
+  In order to reduce the memory footprint (for instance, to
+  embed the snmpd into a device), the following configure options
+  could be used.
+
+  '--disable-debugging'
+     This turns off all compilation of debugging info.
+
+  '--enable-mini-agent' '--with-out-mib-modules=examples/ucdDemoPublic'
+     This creates an agent the minimum amount of MIB modules
+     compiled in.
+     NOTE: If you need more MIB modules add then with the option
+     '--with-mib-modules=...' you add of course extra memory footprint.
+
+  '--with-transports=UDP'
+     This option specifies the transports domain you need.
+     For a simple agent UDP should be sufficient.
+
+   '--without-kmem-usage'
+     This can be used in order not to include the code that
+     operates on the /dev/kmem. This option cannot be used when
+     you do want a MIB module compiled in that depends on it.
+
+   '--with-mibdirs=' and '--with-mibs='
+     These options specify not loading the MIB modules for the
+     agent. It reduces the memory footprint only during
+     runtime.
+
+  On top of this one could even attempt to exclude the complete
+  MIB loading functionality, but there is currently no
+  configure option for this.
+
+  Once the agent (snmpd) has been linked, you might also try running
+  'strip snmpd' to remove un-necessary debug/symbol information.
+
+
+
+CODING
+======
+
+How do I compile with 'cc' instead of 'gcc'?
+-------------------------------------------
+
+  Run configure with --with-cc=cc
+
+  Note that if you've already run configure once, it will probably have
+  detected the presence of 'gcc', cached this information, and may still
+  try to use this anyway.   In which case, simply remove the 'config.cache'
+  file before re-running configure.
+ 
+
+
+But gcc doesn't compile it successfully on my new Solaris system. Why not?
+-------------------------------------------------------------------------
+
+  Whenever you upgrade the operating system under Solaris, you need to
+  reinstall gcc, and run the 'fixincludes' script.  (This is probably
+  a sensible step to take when you upgrade any operating system).
+    Under Solaris 2.6, there is also a bug in the gcc 'fixinc.sv4' script.
+  This needs an additional line as follows:
+
+*** fixinc.svr4.cln     Thu Jun 15 22:03:29 1995
+--- fixinc.svr4 Tue Nov 25 09:47:57 1997
+***************
+*** 191,191 ****
+--- 191,192 ----
+          s/__STDC__ - 0 == 0/!defined (__STRICT_ANSI__)/g
++         s/__STDC__ - 0 == 1/defined (__STRICT_ANSI__)/g
+
+
+
+How do I write C code to integrate with the agent?
+-------------------------------------------------
+
+  At the moment, there are three methods for integrating external C code
+  within the agent.
+
+    The code can be included within the agent itself, statically configured
+  and linked in when the agent is compiled.  Alternatively, with the 4.2
+  release of the agent, it's possible to dynamically load MIB modules once
+  the agent is running.  Finally, the agent can be configured to pass certain
+  portions of the MIB tree off to one or more subagents.  See the earlier
+  question on AgentX, SMUX and proxied SNMP for more details.
+
+    All three mechanisms use the same module API.  This is described (in
+  excruciating detail) in the file AGENT.txt, shipped with the standard
+  distribution.  There is also an HTML version accessible via the project
+  web page.  This task can be aided using the tool 'mib2c' which generates
+  most of the necessary skeleton code from the description in the MIB file.
+
+    Note that the UCD suite does not include support for SMUX subagents.
+
+
+
+How does the agent fetch the value of a variable from the system?
+----------------------------------------------------------------
+
+  Much of the information is extracted from kernel memory - usually
+  by seeking to the appropriate location and reading the structures
+  directly.
+    Some systems provide cleaner interfaces to such kernel information
+  (it would be hard to think of a less clean interface!), via ioctl()
+  calls or similar system routines and these mechanisms are usually used
+  in preference.
+
+
+
+I've created a new module with 'mib2c' but it doesn't work.  Why not?
+--------------------------------------------------------------------
+
+    Remember that 'mib2c' generates a template for the MIB implementation.
+  It doesn't fill in all the details for you.  In particular, it cannot
+  know how to obtain the information needed to answer particular queries.
+  That's the job of the MIB module programmer (you!) -  See the previous
+  question for how to proceed.
+
+    Essentially mib2c handles the syntax of the MIB implementation,
+  leaving you to concentrate on the semantics.
+
+
+
+Where should I put the files produced by 'mib2c'?
+------------------------------------------------
+
+  If you're using the main source tree to compile your new module, then
+  put these two files (mymib.[ch]) in the directory 'agent/mibgroup'.
+  You should then re-run configure to add in your new module
+  ("configure --with-mib-modules=mymib") and recompile.
+
+    If you've got a number of new modules to add, it might be
+  sensible to put them all into a single subdirectory of 'mibgroup'.
+  Then create a header file, listing the individual components.
+  This might look something like:
+
+		config_require(mymib/myObjects)
+		config_require(mymib/myTable)
+		config_require(mymib/myOtherTable)
+
+  If this was saved as the file 'mymib.h', then the same configure
+  line given above, would pull in all three modules.  See the
+  current contents of 'agent/mibgroup' for examples of this.
+
+
+
+Mib2c only handles a single table in my MIB. How can I fix this?
+---------------------------------------------------------------
+
+    This was a bug in the mib2c script, which was corrected with
+  the 4.2 release.  Earlier versions can be fixed by applying the
+  following patch:
+
+	$ diff -u mib2c.cln mib2c
+	--- mib2c.cln   Wed Nov 29 15:12:47 2000
+	+++ mib2c       Wed Nov 29 15:13:18 2000
+	@@ -132,6 +132,6 @@
+	 #============================================
+	 foreach $vtable (@table_list) {
+	     foreach $ptable (@processtable) {
+	-       $variables{$ptable}{'processed'} = 
+	+       $variables{$ptable}{'processed'} .= 
+	            (eval "\"$variables{$ptable}{'code'}\"") . "\n\n";
+	     }
+
+
+
+Mib2c complains about a missing "mib reference" - what does this mean?
+---------------------------------------------------------------------
+
+    This basically means that it hasn't loaded the MIB file containing
+  the definition of the MIB subtree you're trying to implement.  This
+  might be because it hasn't been installed, the name is wrong, or
+  (most likely), because it isn't in the default list.  See the MIBS
+  section for more details.
+
+
+
+Mib2c complains about not having a "valid OID" - what does this mean?
+---------------------------------------------------------------------
+
+    This probably means that you gave it the name of a MIB file (or
+  module), rather than the name of an object defined in that file.
+  Mib2c expects the name of a 'root' object, and will generate a
+  template for the sub-tree starting from there.
+
+    If you've got a file 'MY-MIB.txt', defining the MIB module
+  'MY-MIB' which contains a subtree based on the object 'myMib',
+  then you should invoke mib2c as
+            "mib2c .... myMib"
+  rather than
+            "mib2c .... MY-MIB.txt"
+  or        "mib2c .... MY-MIB"
+
+    Note that you'll probably also have to add your MIB to the list of
+  MIBs that are loaded automatically, in order for mib2c to recognise
+  the name of this object.  So the command would typically be
+            "MIBS=+MY-MIB mib2c .... myMib"
+  or        "MIBS=ALL     mib2c .... myMib"
+
+
+
+Mib2c ignores my MIB and generates a pair of 'mib-2' code files.  Why?
+---------------------------------------------------------------------
+
+    This is the same problem as above -  giving mib2c the name of
+  the file containing the MIB, rather than an object within it.
+  Earlier versions of mib2c didn't detect this situation, and
+  rather than report an error, it merrily constructed a template
+  for a default starting point of the mib-2 node.
+
+  More recent versions issue the error mentioned above, instead.
+
+
+
+Mib2c talks about "configuration files". Why has this stopped working?
+---------------------------------------------------------------------
+
+    You've probably upgraded to the v5 net-snmp release (from the
+  v4 ucd-snmp release).  This introduced a new approach to agent
+  module development, including a number of different "helpers".
+  The mib2c tool comes with configurations to generate code for
+  many of these, but you'll need to select which is most convenient
+  for your particular case.
+
+
+
+How can I get the agent to generate a trap (or inform)?
+------------------------------------------------------
+
+    Actually generating a trap is reasonably simple - just call one
+  of the utility routines 'send_easy_trap()' or 'send_v2trap' with
+  the relevant information (trap values, or varbind list respectively).
+  See the 'snmp_trap_api(3)' man page for details.  But note that
+  these interfaces are only available within the agent (or subagents).
+  They are not available to stand-alone applications.  See the code
+  for 'snmptrap' for the approach to use in this case.
+
+    Determining _when_ to generate the trap is often harder.
+  If the trap is generated in response to some action within the
+  agent, (e.g. as the result of a SET), then this isn't too much
+  of a problem.
+
+    But if the trap is intended to report on a change of status
+  (e.g. a network interface going up or down, or a disk filling up),
+  then actually detecting this is non-trivial.   It's necessary to
+  poll the value(s) on a regular basis, save the results and compare
+  them with the new values the next time round.
+    This can be done using the routines documented in 'snmp_alarm(3)',
+  though unfortunately we don't have any examples of how to do this.
+  Eventually, the intention is to implement the Event MIB (from the
+  Distributed Management working group), which will provide this
+  functionality in a flexible, standardised manner.
+
+    In the meantime, the simplest approach is probably to set up
+  an external program, to poll the agent for the desired values,
+  and generate a trap when values change.  E.g:
+
+		old_value=`snmpget myObject.0`
+		while true
+		do
+		    sleep 60
+		    new_value=`snmpget myObject.0`
+		    if [ $old_value != $new_value ]
+		    then
+			snmptrap .... myObject.0 i $new_value
+		    fi
+		    old_value=$new_value
+		done
+
+   (Obviously, this is not complete, but should give you the
+   general idea).
+
+
+
+What if I'm using an AgentX sub-agent instead?
+---------------------------------------------
+
+    That doesn't matter - the routines described in 'snmp_trap_api(3)'
+  can still be used, and the subagent will do the Right Thing.
+  
+  One of the original design aims of the AgentX support was that this
+  should be transparent to a MIB module implementer.  The agent-module
+  interface should be independent of the protocol used to receive the
+  original request.  So the exact same MIB module code could be used
+  within a traditional SNMP-only agent, or an AgentX subagent, with no
+  changes needed.
+    In fact, the main agent supplied as part of the package can indeed
+  be run as an SNMP agent or an AgentX subagent, simply based on command
+  line flags (or similar configuration options).
+
+
+
+I'm getting an error "autoheader: not found" - what's wrong?
+-----------------------------------------------------------
+
+    This usually appears when compiling the current development source
+  version, obtained via CVS.  Unfortunately, the timestamps on some of
+  the configure files are such that make assumes (mistakenly) that the
+  configure script needs to be re-generated.
+    A similar problem may arise relating to 'autoconf'.
+
+    In both cases, this can be corrected by running the command
+  "make -k touchit" before attempting to make the main package.
+
+
+
+What about a failed dependency on 'libcrypto'?  Where can I get that?
+--------------------------------------------------------------------
+
+    This is typically encountered when installing a Linux RPM of
+  the ucd-snmp package.  This library is part of the 'openssl'
+  suite, so simply install that RPM first, or download the source
+  from ftp://ftp.openssl.org and compile and install that.
+
+    When compiling {UCD,Net}-SNMP from source, the configure script
+  should detect that this library is not present, and use alternative
+  arrangements for MD5-based authentication.
+
+    If encryption (or SHA1-based authentication) is required, then
+  this typically requires compiling from source.  Under Linux, both
+  the 'openssl' and 'openssl-devel' RPMs should be installed, and the
+  'config.cache' file removed before running "configure --with-openssl"
+  and re-compiling.
+
+
+
+Why is the project workspace empty under Visual C++?
+---------------------------------------------------
+
+    This is probably due to the different ways that Unix and Windows
+  handle text file line termination.  Older versions of WinZip don't
+  handle this properly, and Visual C++ gets confused (poor dear!).
+  The latest version of WinZip is reported to unpack this correctly.
+
+
+
+Why are packets requesting the same information larger with UC-Davis SNMP?
+-------------------------------------------------------------------------
+
+    This shouldn't happen with version 4.2 or later, but for older
+  version the following still applies:
+
+    Some users note that UCD-SNMP applications always generate larger PDUs
+  than other SNMP packages, even if the information requested is the same.
+  Further, there are some agents that refuse PDUs from UCD-SNMP applications
+  but accept PDUs from other applications.
+
+  UCD-SNMP is based on the CMU code from a long time ago which encoded things
+  using the long form of length encoding.  Some agents use the short form
+  of length encoding only, and do not understand the long form.
+
+    Get version 4.2 or higher to use the shorter encoding lengths.
+
+
+
+What ASN.1 parser is used?
+-------------------------
+
+  The parser used by both the agent and client programs is coded by hand.
+  This parser has recently been re-vamped to allow control of which of 
+  the available MIBs should be included, and to handle duplicate object
+  subidentifiers.
+    The source code can be found in the snmplib directory (in 'parse.c'),
+  and the parser is usually bundled into the library 'libsnmp.a'
+
+    Note that the parser attempts to be fairly forgiving of some common
+  errors and incompatibilities in MIB files.  The UCD tools accepting a
+  MIB file without complaint does not imply that the MIB is strictly
+  correct.
+    Certain MIBs may need some amendments to allow them to be read
+  correctly by the parser.  Contact the coders' list for advice.
+
+
+
+What is the Official Slogan of the ucd-snmp-coders list?
+-------------------------------------------------------
+
+  "The current implementation is non-obvious and may need to be improved."
+	(with thanks to Rohit Dube)
+
+  And an alternate, added 26-Apr-2000:
+  
+  "In theory, it shouldn't be that hard, but it just needs to be done."
+
+
+
diff -Naur tomato/release/src/router/snmp/include/net-snmp/agent/agent_callbacks.h tomato121/release/src/router/snmp/include/net-snmp/agent/agent_callbacks.h
--- tomato/release/src/router/snmp/include/net-snmp/agent/agent_callbacks.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/include/net-snmp/agent/agent_callbacks.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,18 @@
+#ifndef AGENT_CALLBACKS_H
+#define AGENT_CALLBACKS_H
+
+#define SNMPD_CALLBACK_ACM_CHECK         0
+#define SNMPD_CALLBACK_REGISTER_OID      1
+#define SNMPD_CALLBACK_UNREGISTER_OID    2
+#define SNMPD_CALLBACK_REG_SYSOR         3
+#define SNMPD_CALLBACK_UNREG_SYSOR       4
+#define SNMPD_CALLBACK_ACM_CHECK_INITIAL 5
+#define SNMPD_CALLBACK_SEND_TRAP1        6
+#define SNMPD_CALLBACK_SEND_TRAP2        7
+#define SNMPD_CALLBACK_REGISTER_NOTIFICATIONS 8
+#define SNMPD_CALLBACK_PRE_UPDATE_CONFIG 9
+#define SNMPD_CALLBACK_INDEX_START	 10
+#define SNMPD_CALLBACK_INDEX_STOP	 11
+#define SNMPD_CALLBACK_ACM_CHECK_SUBTREE 12
+
+#endif                          /* AGENT_CALLBACKS_H */
diff -Naur tomato/release/src/router/snmp/include/net-snmp/agent/agent_handler.h tomato121/release/src/router/snmp/include/net-snmp/agent/agent_handler.h
--- tomato/release/src/router/snmp/include/net-snmp/agent/agent_handler.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/include/net-snmp/agent/agent_handler.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,181 @@
+#ifndef AGENT_HANDLER_H
+#define AGENT_HANDLER_H
+
+#ifdef __cplusplus
+extern          "C" {
+#endif
+
+/** @addgroup handler */
+
+    struct netsnmp_handler_registration_s;
+
+    typedef struct netsnmp_mib_handler_s {
+        char           *handler_name;
+        void           *myvoid; /* for handler's internal use */
+
+        int             (*access_method) (struct netsnmp_mib_handler_s *,
+                                          struct
+                                          netsnmp_handler_registration_s *,
+                                          struct
+                                          netsnmp_agent_request_info_s *,
+                                          struct netsnmp_request_info_s *);
+
+        struct netsnmp_mib_handler_s *next;
+        struct netsnmp_mib_handler_s *prev;
+    } netsnmp_mib_handler;
+
+#define HANDLER_CAN_GETANDGETNEXT     0x1       /* must be able to do both */
+#define HANDLER_CAN_SET               0x2
+#define HANDLER_CAN_GETBULK           0x4
+
+#define HANDLER_CAN_RONLY   (HANDLER_CAN_GETANDGETNEXT)
+#define HANDLER_CAN_RWRITE  (HANDLER_CAN_GETANDGETNEXT | HANDLER_CAN_SET)
+#define HANDLER_CAN_DEFAULT HANDLER_CAN_RONLY
+
+    /*
+     * root registration info 
+     */
+    typedef struct netsnmp_handler_registration_s {
+
+        char           *handlerName;    /* for mrTable listings, and other uses */
+        char           *contextName;    /* NULL = default context */
+
+        /*
+         * where are we registered at? 
+         */
+        oid            *rootoid;
+        size_t          rootoid_len;
+
+        /*
+         * handler details 
+         */
+        netsnmp_mib_handler *handler;
+        int             modes;
+
+        /*
+         * more optional stuff 
+         */
+        int             priority;
+        int             range_subid;
+        oid             range_ubound;
+        int             timeout;
+        int             global_cacheid;
+
+    } netsnmp_handler_registration;
+
+    /*
+     * function handler definitions 
+     */
+    typedef int     (Netsnmp_Node_Handler) (netsnmp_mib_handler *handler, netsnmp_handler_registration *reginfo,        /* pointer to registration struct */
+                                            netsnmp_agent_request_info *reqinfo,        /* pointer to current transaction */
+                                            netsnmp_request_info
+                                            *requests);
+
+    typedef struct netsnmp_delegated_cache_s {
+        int             transaction_id;
+        netsnmp_mib_handler *handler;
+        netsnmp_handler_registration *reginfo;
+        netsnmp_agent_request_info *reqinfo;
+        netsnmp_request_info *requests;
+        void           *localinfo;
+    } netsnmp_delegated_cache;
+
+    /*
+     * handler API functions 
+     */
+    void            netsnmp_init_handler_conf(void);
+    int             netsnmp_register_handler(netsnmp_handler_registration
+                                             *reginfo);
+    int            
+        netsnmp_register_handler_nocallback(netsnmp_handler_registration
+                                            *reginfo);
+    int             netsnmp_inject_handler(netsnmp_handler_registration
+                                           *reginfo,
+                                           netsnmp_mib_handler *handler);
+    netsnmp_mib_handler
+        *netsnmp_find_handler_by_name(netsnmp_handler_registration
+                                      *reginfo, const char *name);
+    void          
+        *netsnmp_find_handler_data_by_name(netsnmp_handler_registration
+                                           *reginfo, const char *name);
+    int             netsnmp_call_handlers(netsnmp_handler_registration
+                                          *reginfo,
+                                          netsnmp_agent_request_info
+                                          *reqinfo,
+                                          netsnmp_request_info *requests);
+    int             netsnmp_call_handler(netsnmp_mib_handler *next_handler,
+                                         netsnmp_handler_registration
+                                         *reginfo,
+                                         netsnmp_agent_request_info
+                                         *reqinfo,
+                                         netsnmp_request_info *requests);
+    int             netsnmp_call_next_handler(netsnmp_mib_handler *current,
+                                              netsnmp_handler_registration
+                                              *reginfo,
+                                              netsnmp_agent_request_info
+                                              *reqinfo,
+                                              netsnmp_request_info
+                                              *requests);
+    int             netsnmp_call_next_handler_one_request(netsnmp_mib_handler *current,
+                                                          netsnmp_handler_registration *reginfo,
+                                                          netsnmp_agent_request_info *reqinfo,
+                                                          netsnmp_request_info *requests);
+    
+    netsnmp_mib_handler *netsnmp_create_handler(const char *name,
+                                                Netsnmp_Node_Handler *
+                                                handler_access_method);
+    netsnmp_handler_registration *
+        netsnmp_create_handler_registration(const char *name,
+                                            Netsnmp_Node_Handler *
+                                               handler_access_method,
+                                            oid * reg_oid,
+                                            size_t reg_oid_len,
+                                            int modes);
+
+    NETSNMP_INLINE netsnmp_delegated_cache
+        *netsnmp_create_delegated_cache(netsnmp_mib_handler *,
+                                        netsnmp_handler_registration *,
+                                        netsnmp_agent_request_info *,
+                                        netsnmp_request_info *, void *);
+    NETSNMP_INLINE void     netsnmp_free_delegated_cache(netsnmp_delegated_cache
+                                                 *dcache);
+    NETSNMP_INLINE netsnmp_delegated_cache
+        *netsnmp_handler_check_cache(netsnmp_delegated_cache *dcache);
+    void            netsnmp_register_handler_by_name(const char *,
+                                                     netsnmp_mib_handler
+                                                     *);
+
+    NETSNMP_INLINE void
+        netsnmp_request_add_list_data(netsnmp_request_info *request,
+                                      netsnmp_data_list *node);
+
+    NETSNMP_INLINE void    *netsnmp_request_get_list_data(netsnmp_request_info
+                                                  *request,
+                                                  const char *name);
+
+    NETSNMP_INLINE void
+              netsnmp_free_request_data_set(netsnmp_request_info *request);
+
+    NETSNMP_INLINE void
+             netsnmp_free_request_data_sets(netsnmp_request_info *request);
+
+    void            netsnmp_handler_free(netsnmp_mib_handler *);
+    netsnmp_mib_handler *netsnmp_handler_dup(netsnmp_mib_handler *);
+    netsnmp_handler_registration
+        *netsnmp_handler_registration_dup(netsnmp_handler_registration *);
+    void           
+        netsnmp_handler_registration_free(netsnmp_handler_registration *);
+
+#define REQUEST_IS_DELEGATED     1
+#define REQUEST_IS_NOT_DELEGATED 0
+    void           
+        netsnmp_handler_mark_requests_as_delegated(netsnmp_request_info *,
+                                                   int);
+    void           *netsnmp_handler_get_parent_data(netsnmp_request_info *,
+                                                    const char *);
+
+#ifdef __cplusplus
+};
+#endif
+
+#endif                          /* AGENT_HANDLER_H */
diff -Naur tomato/release/src/router/snmp/include/net-snmp/agent/agent_index.h tomato121/release/src/router/snmp/include/net-snmp/agent/agent_index.h
--- tomato/release/src/router/snmp/include/net-snmp/agent/agent_index.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/include/net-snmp/agent/agent_index.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,46 @@
+#ifndef AGENT_INDEX_H
+#define AGENT_INDEX_H
+
+#ifdef __cplusplus
+extern          "C" {
+#endif
+
+#define ALLOCATE_THIS_INDEX		0x0
+#define ALLOCATE_ANY_INDEX		0x1
+#define ALLOCATE_NEW_INDEX		0x3
+        /*
+         * N.B: it's deliberate that NEW_INDEX & ANY_INDEX == ANY_INDEX 
+         */
+
+#define ANY_INTEGER_INDEX		-1
+#define ANY_STRING_INDEX		NULL
+#define ANY_OID_INDEX			NULL
+
+#define	INDEX_ERR_GENERR		-1
+#define	INDEX_ERR_WRONG_TYPE		-2
+#define	INDEX_ERR_NOT_ALLOCATED		-3
+#define	INDEX_ERR_WRONG_SESSION		-4
+
+char           *register_string_index(oid *, size_t, char *);
+int             register_int_index(oid *, size_t, int);
+netsnmp_variable_list *register_oid_index(oid *, size_t, oid *, size_t);
+netsnmp_variable_list *register_index(netsnmp_variable_list *, int,
+                                      netsnmp_session *);
+
+int             unregister_string_index(oid *, size_t, char *);
+int             unregister_int_index(oid *, size_t, int);
+int             unregister_oid_index(oid *, size_t, oid *, size_t);
+
+int             release_index(netsnmp_variable_list *);
+int             remove_index(netsnmp_variable_list *, netsnmp_session *);
+void            unregister_index_by_session(netsnmp_session *);
+int             unregister_index(netsnmp_variable_list *, int,
+                                 netsnmp_session *);
+
+unsigned long   count_indexes(oid * name, size_t namelen,
+                              int include_unallocated);
+
+#ifdef __cplusplus
+}
+#endif
+#endif                          /* AGENT_INDEX_H */
diff -Naur tomato/release/src/router/snmp/include/net-snmp/agent/agent_read_config.h tomato121/release/src/router/snmp/include/net-snmp/agent/agent_read_config.h
--- tomato/release/src/router/snmp/include/net-snmp/agent/agent_read_config.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/include/net-snmp/agent/agent_read_config.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,26 @@
+/*
+ * agent_read_config.h: reads configuration files for extensible sections.
+ *
+ */
+#ifndef _AGENT_READ_CONFIG_H
+#define _AGENT_READ_CONFIG_H
+
+#ifdef __cplusplus
+extern          "C" {
+#endif
+
+    void            init_agent_read_config(const char *);
+    void            update_config(void);
+    void            snmpd_register_config_handler(const char *,
+                                                  void (*parser) (const
+                                                                  char *,
+                                                                  char *),
+                                                  void (*releaser) (void),
+                                                  const char *);
+    void            snmpd_unregister_config_handler(const char *);
+    void            snmpd_store_config(const char *);
+
+#ifdef __cplusplus
+}
+#endif
+#endif                          /* _AGENT_READ_CONFIG_H */
diff -Naur tomato/release/src/router/snmp/include/net-snmp/agent/agent_registry.h tomato121/release/src/router/snmp/include/net-snmp/agent/agent_registry.h
--- tomato/release/src/router/snmp/include/net-snmp/agent/agent_registry.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/include/net-snmp/agent/agent_registry.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,200 @@
+#ifndef AGENT_REGISTRY_H
+#define AGENT_REGISTRY_H
+
+/***********************************************************************/
+/*
+ * new version2 agent handler API structures 
+ */
+/***********************************************************************/
+
+#include <net-snmp/agent/snmp_agent.h>
+
+#ifdef __cplusplus
+extern          "C" {
+#endif
+
+/***********************************************************************/
+    /*
+     * requests api definitions 
+     */
+/***********************************************************************/
+
+    /*
+     * the structure of parameters passed to registered ACM modules 
+     */
+struct view_parameters {
+    netsnmp_pdu    *pdu;
+    oid            *name;
+    size_t          namelen;
+    int             test;
+    int             errorcode;		/*  Do not change unless you're
+					    specifying an error, as it starts
+					    in a success state.  */
+    int             check_subtree;
+};
+
+struct register_parameters {
+    oid            *name;
+    size_t          namelen;
+    int             priority;
+    int             range_subid;
+    oid             range_ubound;
+    int             timeout;
+    u_char          flags;
+};
+
+typedef struct subtree_context_cache_s {
+    char				*context_name;
+    struct netsnmp_subtree_s		*first_subtree;
+    struct subtree_context_cache_s	*next;
+} subtree_context_cache;
+
+
+
+void             setup_tree		  (void);
+
+netsnmp_subtree *netsnmp_subtree_find	  (oid *, size_t, netsnmp_subtree *,
+					   const char *context_name);
+
+netsnmp_subtree *netsnmp_subtree_find_next(oid *, size_t, netsnmp_subtree *,
+					   const char *context_name);
+
+netsnmp_subtree *netsnmp_subtree_find_prev(oid *, size_t,netsnmp_subtree *,
+					   const char *context_name);
+
+netsnmp_subtree *netsnmp_subtree_find_first(const char *context_name);
+
+netsnmp_session *get_session_for_oid	   (oid *, size_t, 
+					    const char *context_name);
+
+subtree_context_cache *get_top_context_cache(void);
+
+void netsnmp_set_lookup_cache_size(int newsize);
+int netsnmp_get_lookup_cache_size(void);
+
+#define MIB_REGISTERED_OK		 0
+#define MIB_DUPLICATE_REGISTRATION	-1
+#define MIB_REGISTRATION_FAILED		-2
+#define MIB_UNREGISTERED_OK		 0
+#define MIB_NO_SUCH_REGISTRATION	-1
+#define MIB_UNREGISTRATION_FAILED	-2
+#define DEFAULT_MIB_PRIORITY		127
+
+int             register_mib		   (const char *, struct variable *,
+					    size_t, size_t, oid *, size_t);
+
+int             register_mib_priority	   (const char *, struct variable *,
+					    size_t, size_t, oid *, size_t,
+					    int);
+
+int             register_mib_range	   (const char *, struct variable *,
+					    size_t, size_t, oid *, size_t, 
+					    int, int, oid, netsnmp_session *);
+
+int		register_mib_context	   (const char *, struct variable *,
+					    size_t, size_t, oid *, size_t,
+					    int, int, oid, netsnmp_session *,
+					    const char *, int, int);
+
+int	netsnmp_register_mib_table_row	   (const char *, struct variable *,
+					    size_t, size_t, oid *, size_t, 
+					    int, int, netsnmp_session *,
+					    const char *, int, int);
+
+int		unregister_mib		   (oid *, size_t);
+
+int             unregister_mib_priority	   (oid *, size_t, int);
+int             unregister_mib_range	   (oid *, size_t, int, int, oid);
+int             unregister_mib_context	   (oid *, size_t, int, int, oid,
+					    const char *);
+void            unregister_mibs_by_session (netsnmp_session *);
+int     netsnmp_unregister_mib_table_row   (oid *mibloc, size_t mibloclen,
+					    int priority, int var_subid,
+					    oid range_ubound,
+					    const char *context);
+
+int             compare_tree		   (const oid *, size_t, 
+					    const oid *, size_t);
+int             in_a_view		   (oid *, size_t *, 
+					    netsnmp_pdu *, int);
+int             check_access		   (netsnmp_pdu *pdu);
+int             netsnmp_acm_check_subtree  (netsnmp_pdu *, oid *, size_t);
+void            register_mib_reattach	   (void);
+void            register_mib_detach	   (void);
+
+/*
+ * REGISTER_MIB(): This macro simply loads register_mib with less pain:
+ * 
+ * descr:   A short description of the mib group being loaded.
+ * var:     The variable structure to load.
+ * vartype: The variable structure used to define it (variable[2, 4, ...])
+ * theoid:  An *initialized* *exact length* oid pointer.
+ *          (sizeof(theoid) *must* return the number of elements!) 
+ */
+
+#define REGISTER_MIB(descr, var, vartype, theoid)                      \
+  if (register_mib(descr, (struct variable *) var, sizeof(struct vartype), \
+               sizeof(var)/sizeof(struct vartype),                     \
+               theoid, sizeof(theoid)/sizeof(oid)) != MIB_REGISTERED_OK ) \
+	DEBUGMSGTL(("register_mib", "%s registration failed\n", descr));
+
+
+
+#define NUM_EXTERNAL_FDS 32
+#define FD_REGISTERED_OK		 0
+#define FD_REGISTRATION_FAILED		-2
+#define FD_UNREGISTERED_OK		 0
+#define FD_NO_SUCH_REGISTRATION		-1
+
+extern int      external_readfd[NUM_EXTERNAL_FDS],   external_readfdlen;
+extern int      external_writefd[NUM_EXTERNAL_FDS],  external_writefdlen;
+extern int      external_exceptfd[NUM_EXTERNAL_FDS], external_exceptfdlen;
+
+extern void     (*external_readfdfunc[NUM_EXTERNAL_FDS])   (int, void *);
+extern void     (*external_writefdfunc[NUM_EXTERNAL_FDS])  (int, void *);
+extern void     (*external_exceptfdfunc[NUM_EXTERNAL_FDS]) (int, void *);
+
+extern void    *external_readfd_data[NUM_EXTERNAL_FDS];
+extern void    *external_writefd_data[NUM_EXTERNAL_FDS];
+extern void    *external_exceptfd_data[NUM_EXTERNAL_FDS];
+
+int             register_readfd(int, void (*func)(int, void *),   void *);
+int             register_writefd(int, void (*func)(int, void *),  void *);
+int             register_exceptfd(int, void (*func)(int, void *), void *);
+int             unregister_readfd(int);
+int             unregister_writefd(int);
+int             unregister_exceptfd(int);
+
+
+
+#define NUM_EXTERNAL_SIGS 32
+#define SIG_REGISTERED_OK		 0
+#define SIG_REGISTRATION_FAILED		-2
+#define SIG_UNREGISTERED_OK		 0
+
+extern int      external_signal_scheduled[NUM_EXTERNAL_SIGS];
+extern void     (*external_signal_handler[NUM_EXTERNAL_SIGS])(int);
+
+int             register_signal(int, void (*func)(int));
+int             unregister_signal(int);
+
+
+
+/*
+ * internal API.  Don't use this.  Use netsnmp_register_handler instead 
+ */
+
+struct netsnmp_handler_registration_s;
+
+int             netsnmp_register_mib(const char *, struct variable *,
+				     size_t, size_t, oid *, size_t,
+				     int, int, oid, netsnmp_session *,
+				     const char *, int, int,
+				     struct netsnmp_handler_registration_s *,
+				     int);
+
+#ifdef __cplusplus
+};
+#endif
+
+#endif                          /* AGENT_REGISTRY_H */
diff -Naur tomato/release/src/router/snmp/include/net-snmp/agent/agent_trap.h tomato121/release/src/router/snmp/include/net-snmp/agent/agent_trap.h
--- tomato/release/src/router/snmp/include/net-snmp/agent/agent_trap.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/include/net-snmp/agent/agent_trap.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,40 @@
+#ifndef AGENT_TRAP_H
+#define AGENT_TRAP_H
+
+#ifdef __cplusplus
+extern          "C" {
+#endif
+
+struct agent_add_trap_args {
+    netsnmp_session *ss;
+    int             confirm;
+};
+
+void            init_traps(void);
+void            send_easy_trap(int, int);
+void            send_trap_pdu(netsnmp_pdu *);
+void            send_v2trap(netsnmp_variable_list *);
+void            send_trap_vars(int, int, netsnmp_variable_list *);
+void            send_enterprise_trap_vars(int trap, int specific,
+                                          oid * enterprise,
+                                          int enterprise_length,
+                                          netsnmp_variable_list * vars);
+void            snmpd_parse_config_authtrap(const char *, char *);
+void            snmpd_parse_config_trapsink(const char *, char *);
+void            snmpd_parse_config_trap2sink(const char *, char *);
+void            snmpd_parse_config_informsink(const char *, char *);
+void            snmpd_parse_config_trapsess(const char *, char *);
+void            snmpd_free_trapsinks(void);
+void            snmpd_parse_config_trapcommunity(const char *, char *);
+void            snmpd_free_trapcommunity(void);
+void            send_trap_to_sess(netsnmp_session * sess,
+                                  netsnmp_pdu *template_pdu);
+
+int             create_trap_session(char *, u_short, char *, int, int);
+int             add_trap_session(netsnmp_session *, int, int, int);
+int             remove_trap_session(netsnmp_session *);
+
+#ifdef __cplusplus
+}
+#endif
+#endif                          /* AGENT_TRAP_H */
diff -Naur tomato/release/src/router/snmp/include/net-snmp/agent/all_helpers.h tomato121/release/src/router/snmp/include/net-snmp/agent/all_helpers.h
--- tomato/release/src/router/snmp/include/net-snmp/agent/all_helpers.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/include/net-snmp/agent/all_helpers.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,33 @@
+#ifndef ALL_HANDLERS_H
+#define ALL_HANDLERS_H
+
+#ifdef __cplusplus
+extern          "C" {
+#endif
+
+#include <net-snmp/agent/instance.h>
+#include <net-snmp/agent/multiplexer.h>
+#include <net-snmp/agent/null.h>
+#include <net-snmp/agent/debug_handler.h>
+#include <net-snmp/agent/old_api.h>
+#include <net-snmp/agent/read_only.h>
+#include <net-snmp/agent/serialize.h>
+#include <net-snmp/agent/bulk_to_next.h>
+#include <net-snmp/agent/mode_end_call.h>
+/*
+ * #include <net-snmp/agent/set_helper.h> 
+ */
+#include <net-snmp/agent/table.h>
+#include <net-snmp/agent/table_data.h>
+#include <net-snmp/agent/table_dataset.h>
+#include <net-snmp/agent/table_iterator.h>
+/*
+ * #include <net-snmp/agent/table_array.h> 
+ */
+
+void            netsnmp_init_helpers(void);
+
+#ifdef __cplusplus
+}
+#endif
+#endif                          /* ALL_HANDLERS_H */
diff -Naur tomato/release/src/router/snmp/include/net-snmp/agent/auto_nlist.h tomato121/release/src/router/snmp/include/net-snmp/agent/auto_nlist.h
--- tomato/release/src/router/snmp/include/net-snmp/agent/auto_nlist.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/include/net-snmp/agent/auto_nlist.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,28 @@
+/*
+ * auto_nlist.h
+ */
+#ifndef AUTO_NLIST_H
+#define AUTO_NLIST_H
+#ifdef __cplusplus
+extern          "C" {
+#endif
+
+#if defined(irix6) && defined(IRIX64)
+#define nlist nlist64
+#endif
+
+#ifdef CAN_USE_NLIST
+int             auto_nlist(const char *, char *, int);
+long            auto_nlist_value(const char *);
+int             KNLookup(struct nlist *, int, char *, int);
+#else
+int             auto_nlist_noop(void);
+#	define auto_nlist(x,y,z) auto_nlist_noop()
+#	define auto_nlist_value(z) auto_nlist_noop()
+#	define KNLookup(w,x,y,z) auto_nlist_noop()
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff -Naur tomato/release/src/router/snmp/include/net-snmp/agent/bulk_to_next.h tomato121/release/src/router/snmp/include/net-snmp/agent/bulk_to_next.h
--- tomato/release/src/router/snmp/include/net-snmp/agent/bulk_to_next.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/include/net-snmp/agent/bulk_to_next.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,28 @@
+/*
+ * bulk_to_next.h 
+ */
+#ifndef BULK_TO_NEXT_H
+#define BULK_TO_NEXT_H
+
+#ifdef __cplusplus
+extern          "C" {
+#endif
+
+
+/*
+ * The helper merely intercepts GETBULK requests and converts them to
+ * * GETNEXT reequests.
+ */
+
+
+netsnmp_mib_handler *netsnmp_get_bulk_to_next_handler(void);
+void            netsnmp_init_bulk_to_next_helper(void);
+void            netsnmp_bulk_to_next_fix_requests(netsnmp_request_info
+                                                  *requests);
+
+Netsnmp_Node_Handler netsnmp_bulk_to_next_helper;
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff -Naur tomato/release/src/router/snmp/include/net-snmp/agent/.cvsignore tomato121/release/src/router/snmp/include/net-snmp/agent/.cvsignore
--- tomato/release/src/router/snmp/include/net-snmp/agent/.cvsignore	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/include/net-snmp/agent/.cvsignore	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1 @@
+mib_module_config.h
diff -Naur tomato/release/src/router/snmp/include/net-snmp/agent/debug_handler.h tomato121/release/src/router/snmp/include/net-snmp/agent/debug_handler.h
--- tomato/release/src/router/snmp/include/net-snmp/agent/debug_handler.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/include/net-snmp/agent/debug_handler.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,16 @@
+#ifndef DEBUG_HANDLER_H
+#define DEBUG_HANDLER_H
+
+#ifdef __cplusplus
+extern          "C" {
+#endif
+
+netsnmp_mib_handler *netsnmp_get_debug_handler(void);
+void            netsnmp_init_debug_helper(void);
+
+Netsnmp_Node_Handler netsnmp_debug_helper;
+
+#ifdef __cplusplus
+}
+#endif
+#endif                          /* DEBUG_HANDLER_H */
diff -Naur tomato/release/src/router/snmp/include/net-snmp/agent/ds_agent.h tomato121/release/src/router/snmp/include/net-snmp/agent/ds_agent.h
--- tomato/release/src/router/snmp/include/net-snmp/agent/ds_agent.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/include/net-snmp/agent/ds_agent.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,37 @@
+#ifndef NETSNMP_DS_AGENT_H
+#define NETSNMP_DS_AGENT_H
+/*
+ * defines agent's default store registrations 
+ */
+
+/*
+ * booleans 
+ */
+#define NETSNMP_DS_AGENT_VERBOSE        0       /* 1 if verbose output desired */
+#define NETSNMP_DS_AGENT_ROLE           1       /* 0 if master, 1 if client */
+#define NETSNMP_DS_AGENT_NO_ROOT_ACCESS 2       /* 1 if we can't get root access */
+#define NETSNMP_DS_AGENT_AGENTX_MASTER  3       /* 1 if AgentX desired */
+#define NETSNMP_DS_AGENT_QUIT_IMMEDIATELY 4     /* 1 to never start the agent */
+#define NETSNMP_DS_AGENT_DISABLE_PERL   5       /* 1 to never start the agent */
+#define NETSNMP_DS_AGENT_NO_CONNECTION_WARNINGS 6 /* 1 = !see !connect msgs */
+#define NETSNMP_DS_AGENT_LEAVE_PIDFILE  7       /* 1 = leave PID file on exit */
+/*
+ * strings 
+ */
+#define NETSNMP_DS_AGENT_PROGNAME 0     /* argv[0] */
+#define NETSNMP_DS_AGENT_X_SOCKET 1     /* AF_UNIX or ip:port socket addr */
+#define NETSNMP_DS_AGENT_PORTS    2     /* localhost:9161,tcp:localhost:9161... */
+#define NETSNMP_DS_AGENT_INTERNAL_SECNAME  3    /* used by disman/mteTriggerTable. */
+#define NETSNMP_DS_AGENT_PERL_INIT_FILE    4    /* used by embedded perl */
+
+/*
+ * integers 
+ */
+#define NETSNMP_DS_AGENT_FLAGS    0     /* session.flags */
+#define NETSNMP_DS_AGENT_USERID   1
+#define NETSNMP_DS_AGENT_GROUPID  2
+#define NETSNMP_DS_AGENT_AGENTX_PING_INTERVAL 3 /* ping master every SECONDS */
+#define NETSNMP_DS_AGENT_AGENTX_TIMEOUT  4
+#define NETSNMP_DS_AGENT_AGENTX_RETRIES  5
+
+#endif
diff -Naur tomato/release/src/router/snmp/include/net-snmp/agent/instance.h tomato121/release/src/router/snmp/include/net-snmp/agent/instance.h
--- tomato/release/src/router/snmp/include/net-snmp/agent/instance.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/include/net-snmp/agent/instance.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,92 @@
+/*
+ * testhandler.h 
+ */
+#ifndef NETSNMP_INSTANCE_H
+#define NETSNMP_INSTANCE_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * The instance helper is designed to simplify the task of adding simple
+ * * instances to the mib tree.
+ */
+
+/*
+ * GETNEXTs are auto-converted to a GET.
+ * * non-valid GETs are dropped.
+ * * The client can assume that if you're called for a GET, it shouldn't
+ * * have to check the oid at all.  Just answer.
+ */
+
+int             netsnmp_register_instance(netsnmp_handler_registration
+                                          *reginfo);
+int            
+netsnmp_register_read_only_instance(netsnmp_handler_registration *reginfo);
+
+#define INSTANCE_HANDLER_NAME "instance"
+
+netsnmp_mib_handler *netsnmp_get_instance_handler(void);
+
+int             netsnmp_register_read_only_ulong_instance(const char *name,
+                                                          oid * reg_oid,
+                                                          size_t
+                                                          reg_oid_len,
+                                                          u_long * it,
+                                                          Netsnmp_Node_Handler
+                                                          * subhandler);
+int             netsnmp_register_ulong_instance(const char *name,
+                                                oid * reg_oid,
+                                                size_t reg_oid_len,
+                                                u_long * it,
+                                                Netsnmp_Node_Handler *
+                                                subhandler);
+int             netsnmp_register_read_only_counter32_instance(const char
+                                                              *name,
+                                                              oid *
+                                                              reg_oid,
+                                                              size_t
+                                                              reg_oid_len,
+                                                              u_long * it,
+                                                              Netsnmp_Node_Handler
+                                                              *
+                                                              subhandler);
+int             netsnmp_register_read_only_long_instance(const char *name,
+                                                         oid * reg_oid,
+                                                         size_t
+                                                         reg_oid_len,
+                                                         long *it,
+                                                         Netsnmp_Node_Handler
+                                                         * subhandler);
+int             netsnmp_register_long_instance(const char *name,
+                                               oid * reg_oid,
+                                               size_t reg_oid_len,
+                                               long *it,
+                                               Netsnmp_Node_Handler *
+                                               subhandler);
+
+int             netsnmp_register_read_only_int_instance(const char *name,
+                                              oid * reg_oid,
+                                              size_t reg_oid_len, int *it,
+                                              Netsnmp_Node_Handler *
+                                              subhandler);
+
+int             netsnmp_register_int_instance(const char *name,
+                                              oid * reg_oid,
+                                              size_t reg_oid_len, int *it,
+                                              Netsnmp_Node_Handler *
+                                              subhandler);
+
+
+Netsnmp_Node_Handler netsnmp_instance_helper_handler;
+Netsnmp_Node_Handler netsnmp_instance_ulong_handler;
+Netsnmp_Node_Handler netsnmp_instance_long_handler;
+Netsnmp_Node_Handler netsnmp_instance_int_handler;
+Netsnmp_Node_Handler netsnmp_instance_counter32_handler;
+
+#ifdef __cplusplus
+};
+#endif
+
+#endif /** NETSNMP_INSTANCE_H */
diff -Naur tomato/release/src/router/snmp/include/net-snmp/agent/mib_modules.h tomato121/release/src/router/snmp/include/net-snmp/agent/mib_modules.h
--- tomato/release/src/router/snmp/include/net-snmp/agent/mib_modules.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/include/net-snmp/agent/mib_modules.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,23 @@
+#ifndef MIB_MODULES_H
+#define MIB_MODULES_H
+
+#ifdef __cplusplus
+extern          "C" {
+#endif
+
+#define DO_INITIALIZE   1
+#define DONT_INITIALIZE 0
+
+struct module_init_list {
+    char           *module_name;
+    struct module_init_list *next;
+};
+
+void            add_to_init_list(char *module_list);
+int             should_init(const char *module_name);
+void            init_mib_modules(void);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff -Naur tomato/release/src/router/snmp/include/net-snmp/agent/mode_end_call.h tomato121/release/src/router/snmp/include/net-snmp/agent/mode_end_call.h
--- tomato/release/src/router/snmp/include/net-snmp/agent/mode_end_call.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/include/net-snmp/agent/mode_end_call.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,39 @@
+/*
+ * mode_end_call.h 
+ */
+#ifndef MODE_END_CALL_H
+#define MODE_END_CALL_H
+
+#ifdef __cplusplus
+extern          "C" {
+#endif
+
+#define NETSNMP_MODE_END_ALL_MODES -999
+
+typedef struct netsnmp_mode_handler_list_s {
+   struct netsnmp_mode_handler_list_s *next;
+   int mode;
+   netsnmp_mib_handler *callback_handler;
+} netsnmp_mode_handler_list;
+
+/*
+ * The helper calls another handler after each mode has been
+ * processed.
+ */
+
+/* public functions */
+netsnmp_mib_handler *
+netsnmp_get_mode_end_call_handler(netsnmp_mode_handler_list *endlist);
+
+netsnmp_mode_handler_list *
+netsnmp_mode_end_call_add_mode_callback(netsnmp_mode_handler_list *endlist,
+                                        int mode,
+                                        netsnmp_mib_handler *callbackh);
+
+/* internal */
+Netsnmp_Node_Handler netsnmp_mode_end_call_helper;
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff -Naur tomato/release/src/router/snmp/include/net-snmp/agent/multiplexer.h tomato121/release/src/router/snmp/include/net-snmp/agent/multiplexer.h
--- tomato/release/src/router/snmp/include/net-snmp/agent/multiplexer.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/include/net-snmp/agent/multiplexer.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,39 @@
+#ifndef NETSNMP_MULTIPLEXER_H
+#define NETSNMP_MULTIPLEXER_H
+
+#ifdef __cplusplus
+extern          "C" {
+#endif
+
+/*
+ * The multiplexer helper 
+ */
+
+/** @name multiplexer
+ *  @{ */
+
+/** @struct netsnmp_mib_handler_methods
+ *  Defines the subhandlers to be called by the multiplexer helper
+ */
+typedef struct netsnmp_mib_handler_methods_s {
+   /** called when a GET request is received */
+    netsnmp_mib_handler *get_handler;
+   /** called when a GETNEXT request is received */
+    netsnmp_mib_handler *getnext_handler;
+   /** called when a GETBULK request is received */
+    netsnmp_mib_handler *getbulk_handler;
+   /** called when a SET request is received */
+    netsnmp_mib_handler *set_handler;
+} netsnmp_mib_handler_methods;
+
+/** @} */
+
+netsnmp_mib_handler
+    *netsnmp_get_multiplexer_handler(netsnmp_mib_handler_methods *);
+
+Netsnmp_Node_Handler netsnmp_multiplexer_helper_handler;
+
+#ifdef __cplusplus
+}
+#endif
+#endif                          /* NETSNMP_MULTIPLEXER_H */
diff -Naur tomato/release/src/router/snmp/include/net-snmp/agent/net-snmp-agent-includes.h tomato121/release/src/router/snmp/include/net-snmp/agent/net-snmp-agent-includes.h
--- tomato/release/src/router/snmp/include/net-snmp/agent/net-snmp-agent-includes.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/include/net-snmp/agent/net-snmp-agent-includes.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,21 @@
+/*
+ * A simple helpful wrapper to include lots of agent specific include
+ * * files for people wanting to embed and snmp agent into an external
+ * * application
+ */
+#ifndef NET_SNMP_AGENT_INCLUDES_H
+#define NET_SNMP_AGENT_INCLUDES_H
+
+#include <net-snmp/agent/snmp_agent.h>
+#include <net-snmp/agent/snmp_vars.h>
+#include <net-snmp/agent/ds_agent.h>
+#include <net-snmp/agent/agent_handler.h>
+#include <net-snmp/agent/agent_read_config.h>
+#include <net-snmp/agent/agent_trap.h>
+#include <net-snmp/agent/agent_handler.h>
+#include <net-snmp/agent/all_helpers.h>
+#include <net-snmp/agent/var_struct.h>
+
+#include <net-snmp/agent/mib_module_config.h>
+
+#endif                          /* NET_SNMP_AGENT_INCLUDES_H */
diff -Naur tomato/release/src/router/snmp/include/net-snmp/agent/null.h tomato121/release/src/router/snmp/include/net-snmp/agent/null.h
--- tomato/release/src/router/snmp/include/net-snmp/agent/null.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/include/net-snmp/agent/null.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,25 @@
+#ifndef AGENT_NULL_H
+#define AGENT_NULL_H
+
+#ifdef __cplusplus
+extern          "C" {
+#endif
+
+/*
+ * null.h 
+ */
+
+/*
+ * literally does nothing and is used as a final handler for
+ * "do-nothing" nodes that must exist solely for mib tree storage
+ * usage..
+ */
+
+int             netsnmp_register_null(oid *, size_t);
+
+Netsnmp_Node_Handler netsnmp_null_handler;
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff -Naur tomato/release/src/router/snmp/include/net-snmp/agent/object_monitor.h tomato121/release/src/router/snmp/include/net-snmp/agent/object_monitor.h
--- tomato/release/src/router/snmp/include/net-snmp/agent/object_monitor.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/include/net-snmp/agent/object_monitor.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,186 @@
+/**************************************************************************
+ * object_monitor.h
+ *
+ * Contributed by: Robert Story <rstory@freesnmp.com>
+ *
+ * $Id: object_monitor.h,v 1.1.2.1 2004/06/20 21:54:36 nikki Exp $
+ *
+ * functions and data structures for cooperating code to monitor objects.
+ *
+ * WARNING! WARNING! WARNING! WARNING! WARNING! WARNING! WARNING! WARNING!
+ * WARNING!                                                       WARNING!
+ * WARNING!                                                       WARNING!
+ * WARNING!         This code is under active development         WARNING!
+ * WARNING!         and is subject to change at any time.         WARNING!
+ * WARNING!                                                       WARNING!
+ * WARNING!                                                       WARNING!
+ * WARNING! WARNING! WARNING! WARNING! WARNING! WARNING! WARNING! WARNING!
+ */
+#ifndef OBJECT_MONITOR_H
+#define OBJECT_MONITOR_H
+
+#ifdef __cplusplus
+extern          "C" {
+#endif
+
+    /*
+     * notification types
+     */
+    enum {
+        /*
+         * cooperative notification from the object being watched
+         */
+        NOTIFICATION_COOPERATIVE = 1,
+        /*
+         * notification that an object has been set vi SNMP-SET
+         */
+        NOTIFICATION_SET_REQUEST,
+        /*
+         * end of current notification types
+         */
+        NOTIFICATION_END
+    };
+
+    /*
+     * COOPERATIVE event types
+     */
+    enum {
+        EVENT_ROW_ADD = 1,
+        EVENT_ROW_MOD,
+        EVENT_ROW_DEL,
+        EVENT_COL_MOD,
+        EVENT_OBJ_MOD,
+        EVENT_END
+    };
+
+    /*
+     * data structures
+     */
+
+
+    /*
+     * callback header
+     */
+    typedef struct netsnmp_monitor_callback_header_s {
+
+   /** callback type */
+        unsigned int    event;
+
+   /** registered oid */
+        netsnmp_index   monitored_object;
+
+   /** priority */
+        int             priority;
+
+   /** pointer given by watcher at registration */
+        void           *watcher_data;
+
+   /** pointer passed from the monitored object */
+        void           *object_info;
+
+   /** DO NOT USE, INTERNAL USE ONLY */
+        struct netsnmp_monitor_callback_header_s *private;
+        int             refs;
+
+
+    } netsnmp_monitor_callback_header;
+
+    /*
+     *
+     */
+    typedef struct netsnmp_monitor_callback_set_request_s {
+
+    /** header */
+        netsnmp_monitor_callback_header hdr;
+
+    /** handler that registered to handle this object */
+        netsnmp_mib_handler *handler;
+
+    /** pdu containing the set request */
+        netsnmp_pdu    *pdu;
+
+    /** the set request */
+        netsnmp_request_info *request;
+
+    } netsnmp_monitor_set_request_data;
+
+    /*
+     *
+     */
+    typedef struct netsnmp_monitor_callback_cooperative_s {
+
+   /** header */
+        netsnmp_monitor_callback_header hdr;
+
+    } netsnmp_monitor_callback_cooperative;
+
+
+
+    typedef void   
+        (netsnmp_object_monitor_callback) (netsnmp_monitor_callback_header
+                                           *);
+
+
+
+
+    /**********************************************************************
+     * Registration function prototypes
+     */
+
+    /*
+     * Register a callback for the specified object.
+     */
+    int             netsnmp_monitor_register(oid * object, size_t oid_len,
+                                             int priority,
+                                             unsigned int events,
+                                             void *watcher_data,
+                                             netsnmp_object_monitor_callback
+                                             * cb);
+
+    /*
+     * Unregister a callback for the specified object.
+     */
+    int             netsnmp_monitor_unregister(oid * object,
+                                               size_t oid_len,
+                                               int priority,
+                                               void *watcher_data,
+                                               netsnmp_object_monitor_callback
+                                               * cb);
+
+    /*
+     * check to see if a registration exists for an object/event combination
+     */
+    int             netsnmp_monitor_check_registered(int event, oid * oid,
+                                                     int oid_len);
+
+
+    /**********************************************************************
+     * function prototypes
+     */
+
+    /*
+     * Notifies the object monitor of an event.
+     */
+    void            netsnmp_notify_monitor(netsnmp_monitor_callback_header
+                                           * cbh);
+
+
+
+
+    /**********************************************************************
+     * function prototypes
+     */
+
+    /*
+     * Notifies the object monitor of a cooperative event.
+     */
+    void            netsnmp_notify_cooperative(int event, oid * object,
+                                               size_t len, char oid_steal,
+                                               void *object_info);
+
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif /** OBJECT_MONITOR_H */
diff -Naur tomato/release/src/router/snmp/include/net-snmp/agent/old_api.h tomato121/release/src/router/snmp/include/net-snmp/agent/old_api.h
--- tomato/release/src/router/snmp/include/net-snmp/agent/old_api.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/include/net-snmp/agent/old_api.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,49 @@
+#ifndef OLD_API_H
+#define OLD_API_H
+
+#ifdef __cplusplus
+extern          "C" {
+#endif
+
+#define OLD_API_NAME "old_api"
+
+typedef struct netsnmp_old_api_info_s {
+    struct variable *var;
+    size_t          varsize;
+    size_t          numvars;
+
+    /*
+     * old stuff 
+     */
+    netsnmp_session *ss;
+    int             flags;
+} netsnmp_old_api_info;
+
+typedef struct old_opi_cache_s {
+    u_char         *data;
+    WriteMethod    *write_method;
+} netsnmp_old_api_cache;
+
+int             netsnmp_register_old_api(const char *moduleName,
+                                         struct variable *var,
+                                         size_t varsize,
+                                         size_t numvars,
+                                         oid * mibloc,
+                                         size_t mibloclen,
+                                         int priority,
+                                         int range_subid,
+                                         oid range_ubound,
+                                         netsnmp_session * ss,
+                                         const char *context,
+                                         int timeout, int flags);
+Netsnmp_Node_Handler netsnmp_old_api_helper;
+
+/*
+ * really shouldn't be used 
+ */
+netsnmp_agent_session *netsnmp_get_current_agent_session(void);
+
+#ifdef __cplusplus
+}
+#endif
+#endif                          /* OLD_API_H */
diff -Naur tomato/release/src/router/snmp/include/net-snmp/agent/read_only.h tomato121/release/src/router/snmp/include/net-snmp/agent/read_only.h
--- tomato/release/src/router/snmp/include/net-snmp/agent/read_only.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/include/net-snmp/agent/read_only.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,29 @@
+#ifndef READ_ONLY_H
+#define READ_ONLY_H
+
+#ifdef __cplusplus
+extern          "C" {
+#endif
+
+/*
+ * read_only.h 
+ */
+
+/*
+ * The helper merely intercepts SET requests and handles them early on
+ * making everything read-only (no SETs are actually permitted).
+ * Useful as a helper to handlers that are implementing MIBs with no
+ * SET support.
+ */
+
+
+netsnmp_mib_handler *netsnmp_get_read_only_handler(void);
+void            netsnmp_init_read_only_helper(void);
+
+Netsnmp_Node_Handler netsnmp_read_only_helper;
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff -Naur tomato/release/src/router/snmp/include/net-snmp/agent/scalar.h tomato121/release/src/router/snmp/include/net-snmp/agent/scalar.h
--- tomato/release/src/router/snmp/include/net-snmp/agent/scalar.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/include/net-snmp/agent/scalar.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,36 @@
+/*
+ * scalar.h 
+ */
+#ifndef NETSNMP_SCALAR_H
+#define NETSNMP_SCALAR_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * The scalar helper is designed to simplify the task of adding simple
+ * scalar objects to the mib tree.
+ */
+
+/*
+ * GETNEXTs are auto-converted to a GET.
+ * * non-valid GETs are dropped.
+ * * The client can assume that if you're called for a GET, it shouldn't
+ * * have to check the oid at all.  Just answer.
+ */
+
+int netsnmp_register_scalar(netsnmp_handler_registration *reginfo);
+int netsnmp_register_read_only_scalar(netsnmp_handler_registration *reginfo);
+
+#define SCALAR_HANDLER_NAME "scalar"
+
+netsnmp_mib_handler *netsnmp_get_scalar_handler(void);
+
+Netsnmp_Node_Handler netsnmp_scalar_helper_handler;
+
+#ifdef __cplusplus
+};
+#endif
+
+#endif /** NETSNMP_SCALAR_H */
diff -Naur tomato/release/src/router/snmp/include/net-snmp/agent/serialize.h tomato121/release/src/router/snmp/include/net-snmp/agent/serialize.h
--- tomato/release/src/router/snmp/include/net-snmp/agent/serialize.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/include/net-snmp/agent/serialize.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,24 @@
+#ifndef SERIALIZE_H
+#define SERIALIZE_H
+
+/*
+ * The serialized helper merely calls its clients multiple times for a
+ * * given request set, so they don't have to loop through the requests
+ * * themselves.
+ */
+
+#ifdef __cplusplus
+extern          "C" {
+#endif
+
+    netsnmp_mib_handler *netsnmp_get_serialize_handler(void);
+    int             netsnmp_register_serialize(netsnmp_handler_registration
+                                               *reginfo);
+    void            netsnmp_init_serialize(void);
+
+    Netsnmp_Node_Handler netsnmp_serialize_helper_handler;
+
+#ifdef __cplusplus
+};
+#endif
+#endif
diff -Naur tomato/release/src/router/snmp/include/net-snmp/agent/set_helper.h tomato121/release/src/router/snmp/include/net-snmp/agent/set_helper.h
--- tomato/release/src/router/snmp/include/net-snmp/agent/set_helper.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/include/net-snmp/agent/set_helper.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,25 @@
+#ifndef SET_HELPER_H
+#define SET_HELPER_H
+
+#ifdef __cplusplus
+extern          "C" {
+#endif
+
+typedef struct netsnmp_set_info_s {
+    int             action;
+    void           *stateRef;
+
+    /*
+     * don't use yet: 
+     */
+    void          **oldData;
+    int             setCleanupFlags;    /* XXX: client sets this to: */
+#define AUTO_FREE_STATEREF 0x01 /* calls free(stateRef) */
+#define AUTO_FREE_OLDDATA  0x02 /* calls free(*oldData) */
+#define AUTO_UNDO          0x04 /* ... */
+} netsnmp_set_info;
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff -Naur tomato/release/src/router/snmp/include/net-snmp/agent/snmp_agent.h tomato121/release/src/router/snmp/include/net-snmp/agent/snmp_agent.h
--- tomato/release/src/router/snmp/include/net-snmp/agent/snmp_agent.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/include/net-snmp/agent/snmp_agent.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,226 @@
+/*
+ * snmp_agent.h
+ *
+ * External definitions for functions and variables in snmp_agent.c.
+ */
+
+#ifndef SNMP_AGENT_H
+#define SNMP_AGENT_H
+
+#ifdef __cplusplus
+extern          "C" {
+#endif
+
+#include <net-snmp/library/snmp_impl.h>
+#include <net-snmp/library/tools.h>
+#include <net-snmp/library/data_list.h>
+
+#define SNMP_MAX_PDU_SIZE 64000 /* local constraint on PDU size sent by agent
+                                 * (see also SNMP_MAX_MSG_SIZE in snmp_api.h) */
+
+    /*
+     * If non-zero, causes the addresses of peers to be logged when receptions
+     * occur.  
+     */
+
+    extern int      log_addresses;
+
+    /*
+     * How many ticks since we last aged the address cache entries.  
+     */
+
+    extern int      lastAddrAge;
+
+    typedef struct netsnmp_request_info_s {
+        netsnmp_variable_list *requestvb;
+
+        /*
+         * can be used to pass information on a per-request basis from a
+         * helper to the later handlers 
+         */
+        netsnmp_data_list *parent_data;
+
+        oid            *range_end;      /* don't free, reference to (struct tree)->end */
+        size_t          range_end_len;
+        int             delegated;
+        int             processed;
+        int             inclusive;
+        int             status;
+        int             index; /* index in original pdu */
+ 
+       /* get-bulk */
+        int             repeat;
+        int             orig_repeat;
+        netsnmp_variable_list *requestvb_start;
+
+        struct netsnmp_request_info_s *next;
+        struct netsnmp_request_info_s *prev;
+        struct netsnmp_subtree_s      *subtree;
+    } netsnmp_request_info;
+
+    typedef struct netsnmp_set_info_s {
+        int             action;
+        void           *stateRef;
+
+        /*
+         * don't use yet: 
+         */
+        void          **oldData;
+        int             setCleanupFlags;
+#define AUTO_FREE_STATEREF 0x01 /* calls free(stateRef) */
+#define AUTO_FREE_OLDDATA  0x02 /* calls free(*oldData) */
+#define AUTO_UNDO          0x03 /* ... */
+    } netsnmp_set_info;
+
+    typedef struct netsnmp_tree_cache_s {
+        struct netsnmp_subtree_s *subtree;
+        netsnmp_request_info *requests_begin;
+        netsnmp_request_info *requests_end;
+    } netsnmp_tree_cache;
+
+#define MODE_GET              SNMP_MSG_GET
+#define MODE_GETNEXT          SNMP_MSG_GETNEXT
+#define MODE_GETBULK          SNMP_MSG_GETBULK
+#define MODE_IS_GET(x)        (x == SNMP_MSG_GET || x == SNMP_MSG_GETNEXT || x == SNMP_MSG_GETBULK)
+
+#define MODE_SET_BEGIN        SNMP_MSG_INTERNAL_SET_BEGIN
+#define MODE_SET_RESERVE1     SNMP_MSG_INTERNAL_SET_RESERVE1
+#define MODE_SET_RESERVE2     SNMP_MSG_INTERNAL_SET_RESERVE2
+#define MODE_SET_ACTION       SNMP_MSG_INTERNAL_SET_ACTION
+#define MODE_SET_COMMIT       SNMP_MSG_INTERNAL_SET_COMMIT
+#define MODE_SET_FREE         SNMP_MSG_INTERNAL_SET_FREE
+#define MODE_SET_UNDO         SNMP_MSG_INTERNAL_SET_UNDO
+#define MODE_IS_SET(x)         (!MODE_IS_GET(x))
+
+    typedef struct netsnmp_agent_request_info_s {
+        int             mode;
+        netsnmp_pdu    *pdu;    /* pdu contains authinfo, eg */
+        struct netsnmp_agent_session_s *asp;    /* may not be needed */
+        /*
+         * can be used to pass information on a per-pdu basis from a
+         * helper to the later handlers 
+         */
+        netsnmp_data_list *agent_data;
+        /*
+         * ... 
+         */
+    } netsnmp_agent_request_info;
+
+    typedef struct netsnmp_cachemap_s {
+        int             globalid;
+        int             cacheid;
+        struct netsnmp_cachemap_s *next;
+    } netsnmp_cachemap;
+
+    typedef struct netsnmp_agent_session_s {
+        int             mode;
+        netsnmp_session *session;
+        netsnmp_pdu    *pdu;
+        netsnmp_pdu    *orig_pdu;
+        int             rw;
+        int             exact;
+        int             status;
+        int             index;
+        int             oldmode;
+
+        struct netsnmp_agent_session_s *next;
+
+        /*
+         * new API pointers 
+         */
+        netsnmp_agent_request_info *reqinfo;
+        netsnmp_request_info *requests;
+        netsnmp_tree_cache *treecache;
+        netsnmp_variable_list **bulkcache;
+        int             treecache_len;  /* length of cache array */
+        int             treecache_num;  /* number of current cache entries */
+        netsnmp_cachemap *cache_store;
+        int             vbcount;
+    } netsnmp_agent_session;
+
+    /*
+     * Address cache handling functions.  
+     */
+
+    void            netsnmp_addrcache_initialise(void);
+    void            netsnmp_addrcache_age(void);
+
+
+    /*
+     * config file parsing routines 
+     */
+    int             handle_snmp_packet(int, netsnmp_session *, int,
+                                       netsnmp_pdu *, void *);
+    void            snmp_agent_parse_config(char *, char *);
+    netsnmp_agent_session *init_agent_snmp_session(netsnmp_session *,
+                                                   netsnmp_pdu *);
+    void            free_agent_snmp_session(netsnmp_agent_session *);
+    void           
+        netsnmp_remove_and_free_agent_snmp_session(netsnmp_agent_session
+                                                   *asp);
+#ifdef SNMP_NEED_REQUEST_LIST
+    void           
+        netsnmp_free_agent_snmp_session_by_session(netsnmp_session * sess,
+                                                   void (*free_request)
+                                                   (netsnmp_request_list
+                                                    *));
+#endif
+    int             getNextSessID(void);
+    void            dump_sess_list(void);
+    int             init_master_agent(void);
+    int             agent_check_and_process(int block);
+    void            netsnmp_check_outstanding_agent_requests(void);
+    int             netsnmp_set_mode_request_error(int mode,
+                                                   netsnmp_request_info
+                                                   *request,
+                                                   int error_value);
+    int             netsnmp_set_request_error(netsnmp_agent_request_info
+                                              *reqinfo,
+                                              netsnmp_request_info
+                                              *request, int error_value);
+    int            
+        netsnmp_set_all_requests_error(netsnmp_agent_request_info *reqinfo,
+                                       netsnmp_request_info *requests,
+                                       int error_value);
+    u_long          netsnmp_marker_uptime(marker_t pm);
+    u_long          netsnmp_timeval_uptime(struct timeval *tv);
+    u_long          netsnmp_get_agent_uptime(void);
+    int             netsnmp_check_transaction_id(int transaction_id);
+    int             netsnmp_agent_check_packet(netsnmp_session *,
+                                               struct netsnmp_transport_s
+                                               *, void *, int);
+    int             netsnmp_agent_check_parse(netsnmp_session *,
+                                              netsnmp_pdu *, int);
+    int             netsnmp_allocate_globalcacheid(void);
+
+    int netsnmp_remove_delegated_requests_for_session(netsnmp_session *sess);
+
+    /*
+     * Register and de-register agent NSAPs.  
+     */
+
+    struct netsnmp_transport_s;
+
+    int             netsnmp_register_agent_nsap(struct netsnmp_transport_s
+                                                *t);
+    void            netsnmp_deregister_agent_nsap(int handle);
+
+    NETSNMP_INLINE void
+        netsnmp_agent_add_list_data(netsnmp_agent_request_info *agent,
+                                    netsnmp_data_list *node);
+
+    NETSNMP_INLINE void    *netsnmp_agent_get_list_data(netsnmp_agent_request_info
+                                                *agent, const char *name);
+
+    NETSNMP_INLINE void
+            netsnmp_free_agent_data_set(netsnmp_agent_request_info *agent);
+
+    NETSNMP_INLINE void
+           netsnmp_free_agent_data_sets(netsnmp_agent_request_info *agent);
+    NETSNMP_INLINE void    
+        netsnmp_free_agent_request_info(netsnmp_agent_request_info *ari);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff -Naur tomato/release/src/router/snmp/include/net-snmp/agent/snmp_vars.h tomato121/release/src/router/snmp/include/net-snmp/agent/snmp_vars.h
--- tomato/release/src/router/snmp/include/net-snmp/agent/snmp_vars.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/include/net-snmp/agent/snmp_vars.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,103 @@
+/*
+ * Definitions for SNMP (RFC 1067) agent variable finder.
+ *
+ */
+
+#ifndef _SNMP_VARS_H_
+#define _SNMP_VARS_H_
+
+#ifdef __cplusplus
+extern          "C" {
+#endif
+
+/***********************************************************
+	Copyright 1988, 1989 by Carnegie Mellon University
+	Copyright 1989	TGV, Incorporated
+
+		      All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of CMU and TGV not be used
+in advertising or publicity pertaining to distribution of the software
+without specific, written prior permission.
+
+CMU AND TGV DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+EVENT SHALL CMU OR TGV BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
+USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
+OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+PERFORMANCE OF THIS SOFTWARE.
+******************************************************************/
+
+    struct variable;
+
+    /*
+     * Function pointer called by the master agent for writes. 
+     */
+    typedef int     (WriteMethod) (int action,
+                                   u_char * var_val,
+                                   u_char var_val_type,
+                                   size_t var_val_len,
+                                   u_char * statP,
+                                   oid * name, size_t length);
+
+    /*
+     * Function pointer called by the master agent for mib information retrieval 
+     */
+    typedef u_char *(FindVarMethod) (struct variable * vp,
+                                     oid * name,
+                                     size_t * length,
+                                     int exact,
+                                     size_t * var_len,
+                                     WriteMethod ** write_method);
+
+    /*
+     * Function pointer called by the master agent for setting up subagent requests 
+     */
+    typedef int     (AddVarMethod) (netsnmp_agent_session *asp,
+                                    netsnmp_variable_list * vbp);
+
+    struct nlist;
+
+    extern long     long_return;
+    extern u_char   return_buf[];
+
+    extern oid      nullOid[];
+    extern int      nullOidLen;
+
+#define INST	0xFFFFFFFF      /* used to fill out the instance field of the variables table */
+
+    struct variable {
+        u_char          magic;  /* passed to function as a hint */
+        char            type;   /* type of variable */
+        /*
+         * See important comment in snmp_vars.c relating to acl 
+         */
+        u_short         acl;    /* access control list for variable */
+        FindVarMethod  *findVar;        /* function that finds variable */
+        u_char          namelen;        /* length of above */
+        oid             name[MAX_OID_LEN];      /* object identifier of variable */
+    };
+
+    int             init_agent(const char *);
+
+#ifndef _AGENT_REGISTRY_H
+#include <net-snmp/agent/agent_handler.h>
+#include <net-snmp/agent/var_struct.h>
+#include <net-snmp/agent/agent_registry.h>
+#endif
+
+    /*
+     * fail overloads non-negative integer value. it must be -1 ! 
+     */
+#define MATCH_FAILED	(-1)
+#define MATCH_SUCCEEDED	0
+
+#ifdef __cplusplus
+}
+#endif
+#endif                          /* _SNMP_VARS_H_ */
diff -Naur tomato/release/src/router/snmp/include/net-snmp/agent/table_array.h tomato121/release/src/router/snmp/include/net-snmp/agent/table_array.h
--- tomato/release/src/router/snmp/include/net-snmp/agent/table_array.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/include/net-snmp/agent/table_array.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,152 @@
+/*
+ * table_array.h
+ * $Id: table_array.h,v 1.1.2.1 2004/06/20 21:54:36 nikki Exp $
+ */
+#ifndef _TABLE_ARRAY_HANDLER_H_
+#define _TABLE_ARRAY_HANDLER_H_
+
+#ifdef __cplusplus
+extern          "C" {
+#endif
+
+    /*
+     * The table array helper is designed to simplify the task of
+     * writing a table handler for the net-snmp agent when the data being
+     * accessed is in an oid sorted form and must be accessed externally.
+     * 
+     * Functionally, it is a specialized version of the more
+     * generic table helper but easies the burden of GETNEXT processing by
+     * retrieving the appropriate row for ead index through
+     * function calls which should be supplied by the module that wishes
+     * help.  The module the table_array helps should, afterwards,
+     * never be called for the case of "MODE_GETNEXT" and only for the GET
+     * and SET related modes instead.
+     */
+
+#include <net-snmp/library/container.h>
+#include <net-snmp/agent/table.h>
+
+#define TABLE_ARRAY_NAME "table_array"
+
+    /*
+     * group_item is to allow us to keep a list of requests without
+     * disrupting the actual netsnmp_request_info list.
+     */
+    typedef struct netsnmp_request_group_item_s {
+        netsnmp_request_info *ri;
+        netsnmp_table_request_info *tri;
+        struct netsnmp_request_group_item_s *next;
+    } netsnmp_request_group_item;
+
+    /*
+     * structure to keep a list of requests for each unique index
+     */
+    typedef struct netsnmp_request_group_s {
+       /*
+        * index for this row. points to someone else's memory, so
+        * don't free it!
+        */
+        netsnmp_index               index;
+
+       /*
+        * container in which rows belong
+        */
+        netsnmp_container           *table;
+
+       /*
+        * actual old and new rows
+        */
+        netsnmp_index               *existing_row;
+        netsnmp_index               *undo_info;
+
+       /*
+        * flags
+        */
+       char                          row_created;
+       char                          row_deleted;
+       char                          fill1;
+       char                          fill2;
+
+       /*
+        * requests for this row
+        */
+        netsnmp_request_group_item  *list;
+
+        int                          status;
+
+        void                        *rg_void;
+
+    } netsnmp_request_group;
+
+    typedef int     (Netsnmp_User_Row_Operation_c) (const void *lhs,
+                                                    const void *rhs);
+    typedef int     (Netsnmp_User_Row_Operation) (void *lhs, void *rhs);
+    typedef int     (Netsnmp_User_Get_Processor) (netsnmp_request_info *,
+                                                  netsnmp_index
+                                                  *,
+                                                  netsnmp_table_request_info
+                                                  *);
+    typedef netsnmp_index
+        *(UserRowMethod) (netsnmp_index *);
+    typedef int     (Netsnmp_User_Row_Action) (netsnmp_index *,
+                                               netsnmp_index *,
+                                               netsnmp_request_group *);
+    typedef void    (Netsnmp_User_Group_Method) (netsnmp_request_group *);
+
+    /*
+     * structure for array callbacks
+     */
+    typedef struct netsnmp_table_array_callbacks_s {
+
+        Netsnmp_User_Row_Operation   *row_copy;
+        Netsnmp_User_Row_Operation_c *row_compare;
+
+        Netsnmp_User_Get_Processor *get_value;
+
+
+        Netsnmp_User_Row_Action *can_activate;
+        Netsnmp_User_Row_Action *activated;
+        Netsnmp_User_Row_Action *can_deactivate;
+        Netsnmp_User_Row_Action *deactivated;
+        Netsnmp_User_Row_Action *can_delete;
+
+        UserRowMethod  *create_row;
+        UserRowMethod  *duplicate_row;
+        UserRowMethod  *delete_row;
+
+        Netsnmp_User_Group_Method *set_reserve1;
+        Netsnmp_User_Group_Method *set_reserve2;
+        Netsnmp_User_Group_Method *set_action;
+        Netsnmp_User_Group_Method *set_commit;
+        Netsnmp_User_Group_Method *set_free;
+        Netsnmp_User_Group_Method *set_undo;
+
+       /** not callbacks, but this is a useful place for them... */
+       netsnmp_container* container;
+       char can_set;
+
+    } netsnmp_table_array_callbacks;
+
+
+    int            
+        netsnmp_table_container_register(netsnmp_handler_registration *reginfo,
+                                     netsnmp_table_registration_info
+                                     *tabreq,
+                                     netsnmp_table_array_callbacks *cb,
+                                     netsnmp_container *container,
+                                     int group_rows);
+
+    netsnmp_container * netsnmp_extract_array_context(netsnmp_request_info *);
+
+    Netsnmp_Node_Handler netsnmp_table_array_helper_handler;
+
+    int
+    netsnmp_table_array_check_row_status(netsnmp_table_array_callbacks *cb,
+                                         netsnmp_request_group *ag,
+                                         long *rs_new, long *rs_old);
+
+#ifdef __cplusplus
+};
+#endif
+
+#endif                          /* _TABLE_ARRAY_HANDLER_H_ */
diff -Naur tomato/release/src/router/snmp/include/net-snmp/agent/table_data.h tomato121/release/src/router/snmp/include/net-snmp/agent/table_data.h
--- tomato/release/src/router/snmp/include/net-snmp/agent/table_data.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/include/net-snmp/agent/table_data.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,110 @@
+/*
+ * table_iterator.h 
+ */
+#ifndef _TABLE_DATA_HANDLER_H_
+#define _TABLE_DATA_HANDLER_H_
+
+#ifdef __cplusplus
+extern          "C" {
+#endif
+
+    /*
+     * This helper is designed to completely automate the task of storing
+     * tables of data within the agent that are not tied to external data
+     * sources (like the kernel, hardware, or other processes, etc).  IE,
+     * all rows within a table are expected to be added manually using
+     * functions found below.
+     */
+
+#define TABLE_DATA_NAME "table_data"
+
+    typedef struct netsnmp_table_row_s {
+        netsnmp_variable_list *indexes; /* stored permanently if store_indexes = 1 */
+        oid            *index_oid;
+        size_t          index_oid_len;
+        void           *data;   /* the data to store */
+
+        struct netsnmp_table_row_s *next, *prev;        /* if used in a list */
+    } netsnmp_table_row;
+
+    typedef struct netsnmp_table_data_s {
+        netsnmp_variable_list *indexes_template;        /* containing only types */
+        char           *name;   /* if !NULL, it's registered globally */
+        int             flags;  /* not currently used */
+        int             store_indexes;
+        netsnmp_table_row *first_row;
+    } netsnmp_table_data;
+
+    netsnmp_mib_handler *netsnmp_get_table_data_handler(netsnmp_table_data
+                                                        *table);
+    void            netsnmp_table_data_generate_index_oid(netsnmp_table_row
+                                                          *row);
+    int             netsnmp_table_data_add_row(netsnmp_table_data *table,
+                                               netsnmp_table_row *row);
+    netsnmp_table_row *netsnmp_table_data_remove_row(netsnmp_table_data
+                                                     *table,
+                                                     netsnmp_table_row
+                                                     *row);
+    void           *netsnmp_table_data_delete_row(netsnmp_table_row *row);
+    void          
+        *netsnmp_table_data_remove_and_delete_row(netsnmp_table_data
+                                                  *table,
+                                                  netsnmp_table_row *row);
+
+    netsnmp_table_row *netsnmp_table_data_get(netsnmp_table_data *table,
+                                              netsnmp_variable_list *
+                                              indexes);
+
+    netsnmp_table_row *netsnmp_table_data_get_from_oid(netsnmp_table_data
+                                                       *table,
+                                                       oid * searchfor,
+                                                       size_t
+                                                       searchfor_len);
+
+    int            
+        netsnmp_register_table_data(netsnmp_handler_registration *reginfo,
+                                    netsnmp_table_data *table,
+                                    netsnmp_table_registration_info
+                                    *table_info);
+    int            
+        netsnmp_register_read_only_table_data(netsnmp_handler_registration
+                                              *reginfo,
+                                              netsnmp_table_data *table,
+                                              netsnmp_table_registration_info
+                                              *table_info);
+
+    netsnmp_table_row *netsnmp_extract_table_row(netsnmp_request_info *);
+    void           *netsnmp_extract_table_row_data(netsnmp_request_info *);
+    netsnmp_table_data *netsnmp_create_table_data(const char *name);
+    netsnmp_table_row *netsnmp_create_table_data_row(void);
+    netsnmp_table_row *netsnmp_table_data_clone_row(netsnmp_table_row
+                                                    *row);
+    NETSNMP_INLINE void     netsnmp_table_data_replace_row(netsnmp_table_data
+                                                   *table,
+                                                   netsnmp_table_row
+                                                   *origrow,
+                                                   netsnmp_table_row
+                                                   *newrow);
+
+    int            
+        netsnmp_table_data_build_result(netsnmp_handler_registration
+                                        *reginfo,
+                                        netsnmp_agent_request_info
+                                        *reqinfo,
+                                        netsnmp_request_info *request,
+                                        netsnmp_table_row *row, int column,
+                                        u_char type, u_char * result_data,
+                                        size_t result_data_len);
+
+
+#define netsnmp_table_data_add_index(thetable, type) snmp_varlist_add_variable(&thetable->indexes_template, NULL, 0, type, NULL, 0)
+#define netsnmp_table_row_add_index(row, type, value, value_len) snmp_varlist_add_variable(&row->indexes, NULL, 0, type, (const u_char *) value, value_len)
+
+
+    Netsnmp_Node_Handler netsnmp_table_data_helper_handler;
+
+#ifdef __cplusplus
+};
+#endif
+
+#endif                          /* _TABLE_DATA_HANDLER_H_ */
diff -Naur tomato/release/src/router/snmp/include/net-snmp/agent/table_dataset.h tomato121/release/src/router/snmp/include/net-snmp/agent/table_dataset.h
--- tomato/release/src/router/snmp/include/net-snmp/agent/table_dataset.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/include/net-snmp/agent/table_dataset.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,165 @@
+/*
+ * table_iterator.h 
+ */
+#ifndef _TABLE_DATA_SET_HANDLER_H_
+#define _TABLE_DATA_SET_HANDLER_H_
+
+#ifdef __cplusplus
+extern          "C" {
+#endif
+
+    /*
+     * This helper is designed to completely automate the task of storing
+     * tables of data within the agent that are not tied to external data
+     * sources (like the kernel, hardware, or other processes, etc).  IE,
+     * all rows within a table are expected to be added manually using
+     * functions found below.
+     */
+
+#define TABLE_DATA_SET_NAME "netsnmp_table_data_set"
+
+    /*
+     * return SNMP_ERR_NOERROR or some SNMP specific protocol error id 
+     */
+    typedef int     (Netsnmp_Value_Change_Ok) (char *old_value,
+                                               size_t old_value_len,
+                                               char *new_value,
+                                               size_t new_value_len,
+                                               void *mydata);
+
+    /*
+     * stored within a given row 
+     */
+    typedef struct netsnmp_table_data_set_storage_s {
+        unsigned int    column;
+
+        /*
+         * info about it? 
+         */
+        char            writable;
+        Netsnmp_Value_Change_Ok *change_ok_fn;
+        void           *my_change_data;
+
+        /*
+         * data actually stored 
+         */
+        u_char          type;
+        union {                 /* value of variable */
+            void           *voidp;
+            long           *integer;
+            u_char         *string;
+            oid            *objid;
+            u_char         *bitstring;
+            struct counter64 *counter64;
+#ifdef OPAQUE_SPECIAL_TYPES
+            float          *floatVal;
+            double         *doubleVal;
+#endif                          /* OPAQUE_SPECIAL_TYPES */
+        } data;
+        u_long          data_len;
+
+        struct netsnmp_table_data_set_storage_s *next;
+    } netsnmp_table_data_set_storage;
+
+    typedef struct netsnmp_table_data_set_s {
+        netsnmp_table_data *table;
+        netsnmp_table_data_set_storage *default_row;
+        int             allow_creation; /* set to 1 to allow creation of new rows */
+        unsigned int    rowstatus_column;
+    } netsnmp_table_data_set;
+
+    Netsnmp_Node_Handler netsnmp_table_data_set_helper_handler;
+
+    /*
+     * to set, add column, type, (writable) ? 1 : 0 
+     */
+    /*
+     * default value, if not NULL, is the default value used in row
+     * creation.  It is copied into the storage template (free your
+     * calling argument). 
+     */
+    int            
+        netsnmp_table_set_add_default_row(netsnmp_table_data_set *,
+                                          unsigned int, int, int,
+                                          void *default_value,
+                                          size_t default_value_len);
+
+    /*
+     * to set, add column, type, (writable) ? 1 : 0, ... 
+     */
+#if HAVE_STDARG_H
+    void           
+        netsnmp_table_set_multi_add_default_row(netsnmp_table_data_set *,
+                                                ...);
+#else
+    void            netsnmp_table_set_multi_add_default_row(va_alist);
+#endif
+    int             netsnmp_set_row_column(netsnmp_table_row *,
+                                           unsigned int, int, const char *,
+                                           size_t);
+    netsnmp_table_data_set_storage
+        *netsnmp_table_data_set_find_column(netsnmp_table_data_set_storage
+                                            *, unsigned int);
+    netsnmp_table_data_set_storage
+       *netsnmp_extract_table_data_set_column(netsnmp_request_info *,
+                                              unsigned int);
+    int            
+        netsnmp_register_table_data_set(netsnmp_handler_registration *,
+                                        netsnmp_table_data_set *,
+                                        netsnmp_table_registration_info *);
+    netsnmp_mib_handler
+        *netsnmp_get_table_data_set_handler(netsnmp_table_data_set *);
+    netsnmp_table_data_set *netsnmp_create_table_data_set(const char *);
+    int             netsnmp_mark_row_column_writable(netsnmp_table_row
+                                                     *row, int column,
+                                                     int writable);
+    NETSNMP_INLINE netsnmp_table_data_set
+        *netsnmp_extract_table_data_set(netsnmp_request_info *request);
+    void            netsnmp_config_parse_table_set(const char *token,
+                                                   char *line);
+    void            netsnmp_config_parse_add_row(const char *token,
+                                                 char *line);
+    NETSNMP_INLINE void     netsnmp_table_dataset_add_index(netsnmp_table_data_set
+                                                    *table, u_char type);
+    NETSNMP_INLINE void     netsnmp_table_dataset_add_row(netsnmp_table_data_set
+                                                  *table,
+                                                  netsnmp_table_row *row);
+    NETSNMP_INLINE void     netsnmp_table_dataset_remove_row(netsnmp_table_data_set
+                                                     *table,
+                                                     netsnmp_table_row
+                                                     *row);
+    NETSNMP_INLINE void     netsnmp_table_dataset_delete_row(netsnmp_table_row
+                                                     *row);
+    NETSNMP_INLINE void    
+        netsnmp_table_dataset_remove_and_delete_row(netsnmp_table_data_set
+                                                    *table,
+                                                    netsnmp_table_row
+                                                    *row);
+    NETSNMP_INLINE void    
+        netsnmp_table_dataset_delete_all_data
+        (netsnmp_table_data_set_storage *data);
+    NETSNMP_INLINE void    
+        netsnmp_table_dataset_replace_row(netsnmp_table_data_set *table,
+                                          netsnmp_table_row *origrow,
+                                          netsnmp_table_row *newrow);
+    netsnmp_table_row *netsnmp_table_data_set_clone_row(netsnmp_table_row
+                                                        *row);
+    void            netsnmp_register_auto_data_table(netsnmp_table_data_set
+                                                     *table_set,
+                                                     char
+                                                     *registration_name);
+
+#if HAVE_STDARG_H
+    void           
+        netsnmp_table_set_add_indexes(netsnmp_table_data_set *tset, ...);
+#else
+    void            netsnmp_table_helper_add_indexes(va_alist);
+#endif
+
+#ifdef __cplusplus
+};
+#endif
+
+#define netsnmp_table_row_add_column(row, type, value, value_len) snmp_varlist_add_variable(&row->indexes, NULL, 0, type, (u_char *) value, value_len)
+
+#endif                          /* _TABLE_DATA_SET_HANDLER_H_ */
diff -Naur tomato/release/src/router/snmp/include/net-snmp/agent/table.h tomato121/release/src/router/snmp/include/net-snmp/agent/table.h
--- tomato/release/src/router/snmp/include/net-snmp/agent/table.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/include/net-snmp/agent/table.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,157 @@
+/*
+ * testhandler.h 
+ */
+#ifndef _TABLE_HANDLER_H_
+#define _TABLE_HANDLER_H_
+
+#ifdef __cplusplus
+extern          "C" {
+#endif
+
+    /*
+     * The table helper is designed to simplify the task of writing a
+     * * table handler for the net-snmp agent.  You should create a normal
+     * * handler and register it using the netsnmp_register_table() function instead
+     * * of the netsnmp_register_handler() function.
+     */
+
+    /*
+     * Notes:
+     *
+     *   1) illegal indexes automatically get handled for get/set cases.
+     *      Simply check to make sure the value is type ASN_NULL before
+     *      you answer a request.
+     */
+
+    /*
+     * used as an index to parent_data lookups 
+     */
+#define TABLE_HANDLER_NAME "table"
+
+    /*
+     * column info struct.  OVERLAPPING RANGES ARE NOT SUPPORTED.
+     */
+    typedef struct netsnmp_column_info_t {
+        char            isRange;
+        char            list_count;     /* only useful if isRange == 0 */
+
+        union {
+            unsigned int    range[2];
+            unsigned int   *list;
+        } details;
+
+        struct netsnmp_column_info_t *next;
+
+    } netsnmp_column_info;
+
+    typedef struct netsnmp_table_registration_info_s {
+        netsnmp_variable_list *indexes; /* list of varbinds with only 'type' set */
+        unsigned int    number_indexes; /* calculated automatically */
+
+        /*
+         * the minimum and maximum columns numbers. If there are columns
+         * * in-between which are not valid, use valid_columns to get
+         * * automatic column range checking.
+         */
+        unsigned int    min_column;
+        unsigned int    max_column;
+
+        netsnmp_column_info *valid_columns;     /* more details on columns */
+
+    } netsnmp_table_registration_info;
+
+    typedef struct netsnmp_table_request_info_s {
+        unsigned int    colnum; /* 0 if OID not long enough */
+        unsigned int    number_indexes; /* 0 if failure to parse any */
+        netsnmp_variable_list *indexes; /* contents freed by helper upon exit */
+        oid             index_oid[MAX_OID_LEN];
+        size_t          index_oid_len;
+        netsnmp_table_registration_info *reg_info;
+    } netsnmp_table_request_info;
+
+    netsnmp_mib_handler
+        *netsnmp_get_table_handler(netsnmp_table_registration_info
+                                   *tabreq);
+    int             netsnmp_register_table(netsnmp_handler_registration
+                                           *reginfo,
+                                           netsnmp_table_registration_info
+                                           *tabreq);
+    int             netsnmp_table_build_oid(netsnmp_handler_registration
+                                            *reginfo,
+                                            netsnmp_request_info *reqinfo,
+                                            netsnmp_table_request_info
+                                            *table_info);
+    int            
+        netsnmp_table_build_oid_from_index(netsnmp_handler_registration
+                                           *reginfo,
+                                           netsnmp_request_info *reqinfo,
+                                           netsnmp_table_request_info
+                                           *table_info);
+    int             netsnmp_table_build_result(netsnmp_handler_registration
+                                               *reginfo,
+                                               netsnmp_request_info
+                                               *reqinfo,
+                                               netsnmp_table_request_info
+                                               *table_info, u_char type,
+                                               u_char * result,
+                                               size_t result_len);
+    int            
+        netsnmp_update_variable_list_from_index(netsnmp_table_request_info
+                                                *);
+    int            
+        netsnmp_update_indexes_from_variable_list
+        (netsnmp_table_request_info *tri);
+    netsnmp_table_registration_info
+        *netsnmp_find_table_registration_info(netsnmp_handler_registration
+                                              *reginfo);
+
+    unsigned int    netsnmp_closest_column(unsigned int current,
+                                           netsnmp_column_info
+                                           *valid_columns);
+
+    Netsnmp_Node_Handler table_helper_handler;
+
+#define netsnmp_table_helper_add_index(tinfo, type) snmp_varlist_add_variable(&tinfo->indexes, NULL, 0, (u_char)type, NULL, 0);
+
+#if HAVE_STDARG_H
+    void           
+        netsnmp_table_helper_add_indexes(netsnmp_table_registration_info
+                                         *tinfo, ...);
+#else
+    void            netsnmp_table_helper_add_indexes(va_alist);
+#endif
+
+    int
+     
+        
+        
+        
+        
+        
+        
+        
+        
+        
+        
+        
+        
+        
+        
+        netsnmp_check_getnext_reply(netsnmp_request_info *request,
+                                    oid * prefix, size_t prefix_len,
+                                    netsnmp_variable_list * newvar,
+                                    netsnmp_variable_list ** outvar);
+
+    netsnmp_table_request_info
+        *netsnmp_extract_table_info(netsnmp_request_info *);
+    netsnmp_oid_stash_node
+        **netsnmp_table_get_or_create_row_stash(netsnmp_agent_request_info
+                                                *reqinfo,
+                                                const u_char *
+                                                storage_name);
+
+#ifdef __cplusplus
+};
+#endif
+
+#endif                          /* _TABLE_HANDLER_H_ */
diff -Naur tomato/release/src/router/snmp/include/net-snmp/agent/table_iterator.h tomato121/release/src/router/snmp/include/net-snmp/agent/table_iterator.h
--- tomato/release/src/router/snmp/include/net-snmp/agent/table_iterator.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/include/net-snmp/agent/table_iterator.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,75 @@
+/*
+ * table_iterator.h 
+ */
+#ifndef _TABLE_ITERATOR_HANDLER_H_
+#define _TABLE_ITERATOR_HANDLER_H_
+
+#ifdef __cplusplus
+extern          "C" {
+#endif
+
+    struct netsnmp_iterator_info_s;
+
+    typedef netsnmp_variable_list *(Netsnmp_First_Data_Point) (void
+                                                               **loop_context,
+                                                               void
+                                                               **data_context,
+                                                               netsnmp_variable_list
+                                                               *,
+                                                               struct
+                                                               netsnmp_iterator_info_s
+                                                               *);
+    typedef netsnmp_variable_list *(Netsnmp_Next_Data_Point) (void
+                                                              **loop_context,
+                                                              void
+                                                              **data_context,
+                                                              netsnmp_variable_list
+                                                              *,
+                                                              struct
+                                                              netsnmp_iterator_info_s
+                                                              *);
+    typedef void   *(Netsnmp_Make_Data_Context) (void *loop_context,
+                                                 struct
+                                                 netsnmp_iterator_info_s
+                                                 *);
+    typedef void    (Netsnmp_Free_Loop_Context) (void *,
+                                                 struct
+                                                 netsnmp_iterator_info_s
+                                                 *);
+    typedef void    (Netsnmp_Free_Data_Context) (void *,
+                                                 struct
+                                                 netsnmp_iterator_info_s
+                                                 *);
+
+    typedef struct netsnmp_iterator_info_s {
+        Netsnmp_First_Data_Point *get_first_data_point;
+        Netsnmp_Next_Data_Point *get_next_data_point;
+        Netsnmp_Make_Data_Context *make_data_context;
+        Netsnmp_Free_Loop_Context *free_loop_context;
+        Netsnmp_Free_Data_Context *free_data_context;
+        Netsnmp_Free_Loop_Context *free_loop_context_at_end;
+
+        void           *myvoid;
+
+        netsnmp_table_registration_info *table_reginfo;
+    } netsnmp_iterator_info;
+
+#define TABLE_ITERATOR_NAME "table_iterator"
+
+    netsnmp_mib_handler
+        *netsnmp_get_table_iterator_handler(netsnmp_iterator_info *iinfo);
+    int            
+        netsnmp_register_table_iterator(netsnmp_handler_registration
+                                        *reginfo,
+                                        netsnmp_iterator_info *iinfo);
+
+    void           *netsnmp_extract_iterator_context(netsnmp_request_info
+                                                     *);
+
+    Netsnmp_Node_Handler netsnmp_table_iterator_helper_handler;
+
+#ifdef __cplusplus
+};
+#endif
+
+#endif                          /* _TABLE_ITERATOR_HANDLER_H_ */
diff -Naur tomato/release/src/router/snmp/include/net-snmp/agent/var_struct.h tomato121/release/src/router/snmp/include/net-snmp/agent/var_struct.h
--- tomato/release/src/router/snmp/include/net-snmp/agent/var_struct.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/include/net-snmp/agent/var_struct.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,115 @@
+#ifndef VAR_STRUCT_H
+#define VAR_STRUCT_H
+/*
+ * The subtree structure contains a subtree prefix which applies to
+ * all variables in the associated variable list.
+ *
+ * By converting to a tree of subtree structures, entries can
+ * now be subtrees of another subtree in the structure. i.e:
+ * 1.2
+ * 1.2.0
+ */
+
+#define UCD_REGISTRY_OID_MAX_LEN	128
+
+/*
+ * subtree flags 
+ */
+#define FULLY_QUALIFIED_INSTANCE    0x01
+#define SUBTREE_ATTACHED	    	0x02
+
+typedef struct netsnmp_subtree_s {
+    oid		   *name_a;	/* objid prefix of registered subtree */
+    u_char          namelen;    /* number of subid's in name above */
+    oid            *start_a;	/* objid of start of covered range */
+    u_char          start_len;  /* number of subid's in start name */
+    oid            *end_a;	/* objid of end of covered range   */
+    u_char          end_len;    /* number of subid's in end name */
+    struct variable *variables; /* pointer to variables array */
+    int             variables_len;      /* number of entries in above array */
+    int             variables_width;    /* sizeof each variable entry */
+    char           *label_a;	/* calling module's label */
+    netsnmp_session *session;
+    u_char          flags;
+    u_char          priority;
+    int             timeout;
+    struct netsnmp_subtree_s *next;       /* List of 'sibling' subtrees */
+    struct netsnmp_subtree_s *prev;       /* (doubly-linked list) */
+    struct netsnmp_subtree_s *children;   /* List of 'child' subtrees */
+    int             range_subid;
+    oid             range_ubound;
+    netsnmp_handler_registration *reginfo;      /* new API */
+    int             cacheid;
+    int             global_cacheid;
+} netsnmp_subtree;
+
+/*
+ * This is a new variable structure that doesn't have as much memory
+ * tied up in the object identifier.  It's elements have also been re-arranged
+ * so that the name field can be variable length.  Any number of these
+ * structures can be created with lengths tailor made to a particular
+ * application.  The first 5 elements of the structure must remain constant.
+ */
+struct variable1 {
+    u_char          magic;      /* passed to function as a hint */
+    u_char          type;       /* type of variable */
+    u_short         acl;        /* access control list for variable */
+    FindVarMethod  *findVar;    /* function that finds variable */
+    u_char          namelen;    /* length of name below */
+    oid             name[1];    /* object identifier of variable */
+};
+
+struct variable2 {
+    u_char          magic;      /* passed to function as a hint */
+    u_char          type;       /* type of variable */
+    u_short         acl;        /* access control list for variable */
+    FindVarMethod  *findVar;    /* function that finds variable */
+    u_char          namelen;    /* length of name below */
+    oid             name[2];    /* object identifier of variable */
+};
+
+struct variable3 {
+    u_char          magic;      /* passed to function as a hint */
+    u_char          type;       /* type of variable */
+    u_short         acl;        /* access control list for variable */
+    FindVarMethod  *findVar;    /* function that finds variable */
+    u_char          namelen;    /* length of name below */
+    oid             name[3];    /* object identifier of variable */
+};
+
+struct variable4 {
+    u_char          magic;      /* passed to function as a hint */
+    u_char          type;       /* type of variable */
+    u_short         acl;        /* access control list for variable */
+    FindVarMethod  *findVar;    /* function that finds variable */
+    u_char          namelen;    /* length of name below */
+    oid             name[4];    /* object identifier of variable */
+};
+
+struct variable7 {
+    u_char          magic;      /* passed to function as a hint */
+    u_char          type;       /* type of variable */
+    u_short         acl;        /* access control list for variable */
+    FindVarMethod  *findVar;    /* function that finds variable */
+    u_char          namelen;    /* length of name below */
+    oid             name[7];    /* object identifier of variable */
+};
+
+struct variable8 {
+    u_char          magic;      /* passed to function as a hint */
+    u_char          type;       /* type of variable */
+    u_short         acl;        /* access control list for variable */
+    FindVarMethod  *findVar;    /* function that finds variable */
+    u_char          namelen;    /* length of name below */
+    oid             name[8];    /* object identifier of variable */
+};
+
+struct variable13 {
+    u_char          magic;      /* passed to function as a hint */
+    u_char          type;       /* type of variable */
+    u_short         acl;        /* access control list for variable */
+    FindVarMethod  *findVar;    /* function that finds variable */
+    u_char          namelen;    /* length of name below */
+    oid             name[13];   /* object identifier of variable */
+};
+#endif                          /* VAR_STRUCT_H */
diff -Naur tomato/release/src/router/snmp/include/net-snmp/agent/watcher.h tomato121/release/src/router/snmp/include/net-snmp/agent/watcher.h
--- tomato/release/src/router/snmp/include/net-snmp/agent/watcher.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/include/net-snmp/agent/watcher.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,42 @@
+/*
+ * watcher.h 
+ */
+#ifndef NETSNMP_WATCHER_H
+#define NETSNMP_WATCHER_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define WATCHER_FIXED_SIZE    0x01
+#define WATCHER_MAX_SIZE      0x02
+
+typedef struct netsnmp_watcher_info_s {
+    void     *data;
+    size_t    data_size;
+    size_t    max_size;
+    u_char    type;
+    int       flags;
+} netsnmp_watcher_info;
+
+int netsnmp_register_watched_instance( netsnmp_handler_registration *reginfo,
+                                       netsnmp_watcher_info         *winfo);
+int netsnmp_register_watched_scalar(   netsnmp_handler_registration *reginfo,
+                                       netsnmp_watcher_info         *winfo);
+int netsnmp_register_watched_timestamp(netsnmp_handler_registration *reginfo,
+                                       marker_t *timestamp);
+
+#define WATCHER_HANDLER_NAME "watcher"
+
+netsnmp_mib_handler  *netsnmp_get_watcher_handler(void);
+netsnmp_watcher_info *netsnmp_create_watcher_info(void *, size_t, u_char, int);
+Netsnmp_Node_Handler  netsnmp_watcher_helper_handler;
+
+netsnmp_mib_handler  *netsnmp_get_watched_timestamp_handler(void);
+Netsnmp_Node_Handler  netsnmp_watched_timestamp_handler;
+
+#ifdef __cplusplus
+};
+#endif
+
+#endif /** NETSNMP_WATCHER_H */
diff -Naur tomato/release/src/router/snmp/include/net-snmp/config_api.h tomato121/release/src/router/snmp/include/net-snmp/config_api.h
--- tomato/release/src/router/snmp/include/net-snmp/config_api.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/include/net-snmp/config_api.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,30 @@
+#ifndef NET_SNMP_CONFIG_API_H
+#define NET_SNMP_CONFIG_API_H
+
+    /**
+     *  Library API routines concerned with configuration and control
+     *    of the behaviour of the library, agent and other applications.
+     */
+
+#include <net-snmp/types.h>
+
+    /*
+     *  For the initial release, this will just refer to the
+     *  relevant UCD header files.
+     *    In due course, the routines relevant to this area of the
+     *  API will be identified, and listed here directly.
+     *
+     *  But for the time being, this header file is a placeholder,
+     *  to allow application writers to adopt the new header file names.
+     */
+#include <net-snmp/library/snmp_api.h>
+
+#include <net-snmp/library/read_config.h>
+#include <net-snmp/library/default_store.h>
+
+#include <stdio.h>              /* for FILE definition */
+#include <net-snmp/library/snmp_parse_args.h>
+#include <net-snmp/library/snmp_enum.h>
+#include <net-snmp/library/vacm.h>
+
+#endif                          /* NET_SNMP_CONFIG_API_H */
diff -Naur tomato/release/src/router/snmp/include/net-snmp/.cvsignore tomato121/release/src/router/snmp/include/net-snmp/.cvsignore
--- tomato/release/src/router/snmp/include/net-snmp/.cvsignore	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/include/net-snmp/.cvsignore	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1 @@
+net-snmp-config.h
diff -Naur tomato/release/src/router/snmp/include/net-snmp/definitions.h tomato121/release/src/router/snmp/include/net-snmp/definitions.h
--- tomato/release/src/router/snmp/include/net-snmp/definitions.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/include/net-snmp/definitions.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,32 @@
+#ifndef NET_SNMP_DEFINITIONS_H
+#define NET_SNMP_DEFINITIONS_H
+
+    /**
+     *  Defined constants, and other similar enumerations.
+     */
+
+#define MAX_OID_LEN	    128 /* max subid's in an oid */
+
+#define ONE_SEC         1000000L
+
+    /*
+     *  For the initial release, this will just refer to the
+     *  relevant UCD header files.
+     *    In due course, the relevant definitions will be
+     *  identified, and listed here directly.
+     *
+     *  But for the time being, this header file is primarily a placeholder,
+     *  to allow application writers to adopt the new header file names.
+     */
+
+#include <net-snmp/types.h>     /* for oid */
+#include <net-snmp/library/snmp_api.h>
+#include <net-snmp/library/asn1.h>
+#include <net-snmp/library/snmp_impl.h>
+#include <net-snmp/library/snmp.h>
+#include <net-snmp/library/snmp-tc.h>
+/*
+ * #include <net-snmp/library/libsnmp.h> 
+ */
+
+#endif                          /* NET_SNMP_DEFINITIONS_H */
diff -Naur tomato/release/src/router/snmp/include/net-snmp/library/asn1.h tomato121/release/src/router/snmp/include/net-snmp/library/asn1.h
--- tomato/release/src/router/snmp/include/net-snmp/library/asn1.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/include/net-snmp/library/asn1.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,444 @@
+#ifndef ASN1_H
+#define ASN1_H
+
+#ifdef __cplusplus
+extern          "C" {
+#endif
+
+#define PARSE_PACKET	0
+#define DUMP_PACKET	1
+
+    /*
+     * Definitions for Abstract Syntax Notation One, ASN.1
+     * As defined in ISO/IS 8824 and ISO/IS 8825
+     *
+     *
+     */
+/***********************************************************
+	Copyright 1988, 1989 by Carnegie Mellon University
+
+                      All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its 
+documentation for any purpose and without fee is hereby granted, 
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in 
+supporting documentation, and that the name of CMU not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.  
+
+CMU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+CMU BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+******************************************************************/
+
+
+#ifndef MAX_SUBID               /* temporary - duplicate definition protection */
+#ifndef EIGHTBIT_SUBIDS
+    typedef u_long  oid;
+#define MAX_SUBID   0xFFFFFFFF
+#else
+    typedef u_char  oid;
+#define MAX_SUBID   0xFF
+#endif
+#endif
+
+#define MIN_OID_LEN	    2
+#define MAX_OID_LEN	    128 /* max subid's in an oid */
+#ifndef MAX_NAME_LEN            /* conflicts with some libraries */
+#define MAX_NAME_LEN	    MAX_OID_LEN /* obsolete. use MAX_OID_LEN */
+#endif
+
+#define OID_LENGTH(x)  (sizeof(x)/sizeof(oid))
+
+
+#define ASN_BOOLEAN	    ((u_char)0x01)
+#define ASN_INTEGER	    ((u_char)0x02)
+#define ASN_BIT_STR	    ((u_char)0x03)
+#define ASN_OCTET_STR	    ((u_char)0x04)
+#define ASN_NULL	    ((u_char)0x05)
+#define ASN_OBJECT_ID	    ((u_char)0x06)
+#define ASN_SEQUENCE	    ((u_char)0x10)
+#define ASN_SET		    ((u_char)0x11)
+
+#define ASN_UNIVERSAL	    ((u_char)0x00)
+#define ASN_APPLICATION     ((u_char)0x40)
+#define ASN_CONTEXT	    ((u_char)0x80)
+#define ASN_PRIVATE	    ((u_char)0xC0)
+
+#define ASN_PRIMITIVE	    ((u_char)0x00)
+#define ASN_CONSTRUCTOR	    ((u_char)0x20)
+
+#define ASN_LONG_LEN	    (0x80)
+#define ASN_EXTENSION_ID    (0x1F)
+#define ASN_BIT8	    (0x80)
+
+#define IS_CONSTRUCTOR(byte)	((byte) & ASN_CONSTRUCTOR)
+#define IS_EXTENSION_ID(byte)	(((byte) & ASN_EXTENSION_ID) == ASN_EXTENSION_ID)
+
+    struct counter64 {
+        u_long          high;
+        u_long          low;
+    };
+
+#ifdef OPAQUE_SPECIAL_TYPES
+    typedef struct counter64 integer64;
+    typedef struct counter64 unsigned64;
+
+    /*
+     * The BER inside an OPAQUE is an context specific with a value of 48 (0x30)
+     * plus the "normal" tag. For a Counter64, the tag is 0x46 (i.e., an
+     * applications specific tag with value 6). So the value for a 64 bit
+     * counter is 0x46 + 0x30, or 0x76 (118 base 10). However, values
+     * greater than 30 can not be encoded in one octet. So the first octet
+     * has the class, in this case context specific (ASN_CONTEXT), and
+     * the special value (i.e., 31) to indicate that the real value follows
+     * in one or more octets. The high order bit of each following octet
+     * indicates if the value is encoded in additional octets. A high order
+     * bit of zero, indicates the last. For this "hack", only one octet
+     * will be used for the value. 
+     */
+
+    /*
+     * first octet of the tag 
+     */
+#define ASN_OPAQUE_TAG1 (ASN_CONTEXT | ASN_EXTENSION_ID)
+    /*
+     * base value for the second octet of the tag - the
+     * second octet was the value for the tag 
+     */
+#define ASN_OPAQUE_TAG2 ((u_char)0x30)
+
+#define ASN_OPAQUE_TAG2U ((u_char)0x2f) /* second octet of tag for union */
+
+    /*
+     * All the ASN.1 types for SNMP "should have been" defined in this file,
+     * but they were not. (They are defined in snmp_impl.h)  Thus, the tag for
+     * Opaque and Counter64 is defined, again, here with a different names. 
+     */
+#define ASN_APP_OPAQUE (ASN_APPLICATION | 4)
+#define ASN_APP_COUNTER64 (ASN_APPLICATION | 6)
+#define ASN_APP_FLOAT (ASN_APPLICATION | 8)
+#define ASN_APP_DOUBLE (ASN_APPLICATION | 9)
+#define ASN_APP_I64 (ASN_APPLICATION | 10)
+#define ASN_APP_U64 (ASN_APPLICATION | 11)
+#define ASN_APP_UNION (ASN_PRIVATE | 1) /* or ASN_PRIV_UNION ? */
+
+    /*
+     * value for Counter64 
+     */
+#define ASN_OPAQUE_COUNTER64 (ASN_OPAQUE_TAG2 + ASN_APP_COUNTER64)
+    /*
+     * max size of BER encoding of Counter64 
+     */
+#define ASN_OPAQUE_COUNTER64_MX_BER_LEN 12
+
+    /*
+     * value for Float 
+     */
+#define ASN_OPAQUE_FLOAT (ASN_OPAQUE_TAG2 + ASN_APP_FLOAT)
+    /*
+     * size of BER encoding of Float 
+     */
+#define ASN_OPAQUE_FLOAT_BER_LEN 7
+
+    /*
+     * value for Double 
+     */
+#define ASN_OPAQUE_DOUBLE (ASN_OPAQUE_TAG2 + ASN_APP_DOUBLE)
+    /*
+     * size of BER encoding of Double 
+     */
+#define ASN_OPAQUE_DOUBLE_BER_LEN 11
+
+    /*
+     * value for Integer64 
+     */
+#define ASN_OPAQUE_I64 (ASN_OPAQUE_TAG2 + ASN_APP_I64)
+    /*
+     * max size of BER encoding of Integer64 
+     */
+#define ASN_OPAQUE_I64_MX_BER_LEN 11
+
+    /*
+     * value for Unsigned64 
+     */
+#define ASN_OPAQUE_U64 (ASN_OPAQUE_TAG2 + ASN_APP_U64)
+    /*
+     * max size of BER encoding of Unsigned64 
+     */
+#define ASN_OPAQUE_U64_MX_BER_LEN 12
+
+#endif                          /* OPAQUE_SPECIAL_TYPES */
+
+
+#define ASN_PRIV_INCL_RANGE (ASN_PRIVATE | 2)
+#define ASN_PRIV_EXCL_RANGE (ASN_PRIVATE | 3)
+#define ASN_PRIV_DELEGATED  (ASN_PRIVATE | 5)
+#define ASN_PRIV_IMPLIED_OCTET_STR  (ASN_PRIVATE | ASN_OCTET_STR)       /* 4 */
+#define ASN_PRIV_IMPLIED_OBJECT_ID  (ASN_PRIVATE | ASN_OBJECT_ID)       /* 6 */
+#define ASN_PRIV_RETRY      (ASN_PRIVATE | 7)
+#define IS_DELEGATED(x)   ((x) == ASN_PRIV_DELEGATED)
+
+
+    int             asn_check_packet(u_char *, size_t);
+    u_char         *asn_parse_int(u_char *, size_t *, u_char *, long *,
+                                  size_t);
+    u_char         *asn_build_int(u_char *, size_t *, u_char, long *,
+                                  size_t);
+    u_char         *asn_parse_unsigned_int(u_char *, size_t *, u_char *,
+                                           u_long *, size_t);
+    u_char         *asn_build_unsigned_int(u_char *, size_t *, u_char,
+                                           u_long *, size_t);
+    u_char         *asn_parse_string(u_char *, size_t *, u_char *,
+                                     u_char *, size_t *);
+    u_char         *asn_build_string(u_char *, size_t *, u_char,
+                                     const u_char *, size_t);
+    u_char         *asn_parse_header(u_char *, size_t *, u_char *);
+    u_char         *asn_parse_sequence(u_char *, size_t *, u_char *, u_char expected_type,      /* must be this type */
+                                       const char *estr);       /* error message prefix */
+    u_char         *asn_build_header(u_char *, size_t *, u_char, size_t);
+    u_char         *asn_build_sequence(u_char *, size_t *, u_char, size_t);
+    u_char         *asn_parse_length(u_char *, u_long *);
+    u_char         *asn_build_length(u_char *, size_t *, size_t);
+    u_char         *asn_parse_objid(u_char *, size_t *, u_char *, oid *,
+                                    size_t *);
+    u_char         *asn_build_objid(u_char *, size_t *, u_char, oid *,
+                                    size_t);
+    u_char         *asn_parse_null(u_char *, size_t *, u_char *);
+    u_char         *asn_build_null(u_char *, size_t *, u_char);
+    u_char         *asn_parse_bitstring(u_char *, size_t *, u_char *,
+                                        u_char *, size_t *);
+    u_char         *asn_build_bitstring(u_char *, size_t *, u_char,
+                                        u_char *, size_t);
+    u_char         *asn_parse_unsigned_int64(u_char *, size_t *, u_char *,
+                                             struct counter64 *, size_t);
+    u_char         *asn_build_unsigned_int64(u_char *, size_t *, u_char,
+                                             struct counter64 *, size_t);
+    u_char         *asn_parse_signed_int64(u_char *, size_t *, u_char *,
+                                           struct counter64 *, size_t);
+    u_char         *asn_build_signed_int64(u_char *, size_t *, u_char,
+                                           struct counter64 *, size_t);
+    u_char         *asn_build_float(u_char *, size_t *, u_char, float *,
+                                    size_t);
+    u_char         *asn_parse_float(u_char *, size_t *, u_char *, float *,
+                                    size_t);
+    u_char         *asn_build_double(u_char *, size_t *, u_char, double *,
+                                     size_t);
+    u_char         *asn_parse_double(u_char *, size_t *, u_char *,
+                                     double *, size_t);
+
+#ifdef USE_REVERSE_ASNENCODING
+
+    /*
+     * Re-allocator function for below.  
+     */
+
+    int             asn_realloc(u_char **, size_t *);
+
+    /*
+     * Re-allocating reverse ASN.1 encoder functions.  Synopsis:
+     * 
+     * u_char *buf = (u_char*)malloc(100);
+     * u_char type = (ASN_UNIVERSAL | ASN_PRIMITIVE | ASN_INTEGER);
+     * size_t buf_len = 100, offset = 0;
+     * long data = 12345;
+     * int allow_realloc = 1;
+     * 
+     * if (asn_realloc_rbuild_int(&buf, &buf_len, &offset, allow_realloc,
+     * type, &data, sizeof(long)) == 0) {
+     * error;
+     * }
+     * 
+     * NOTE WELL: after calling one of these functions with allow_realloc
+     * non-zero, buf might have moved, buf_len might have grown and
+     * offset will have increased by the size of the encoded data.
+     * You should **NEVER** do something like this:
+     * 
+     * u_char *buf = (u_char *)malloc(100), *ptr;
+     * u_char type = (ASN_UNIVERSAL | ASN_PRIMITIVE | ASN_INTEGER);
+     * size_t buf_len = 100, offset = 0;
+     * long data1 = 1234, data2 = 5678;
+     * int rc = 0, allow_realloc = 1;
+     * 
+     * rc  = asn_realloc_rbuild_int(&buf, &buf_len, &offset, allow_realloc,
+     * type, &data1, sizeof(long));
+     * ptr = buf[buf_len - offset];   / * points at encoding of data1 * /
+     * if (rc == 0) {
+     * error;
+     * }
+     * rc  = asn_realloc_rbuild_int(&buf, &buf_len, &offset, allow_realloc,
+     * type, &data2, sizeof(long));
+     * make use of ptr here;
+     * 
+     * 
+     * ptr is **INVALID** at this point.  In general, you should store the
+     * offset value and compute pointers when you need them:
+     * 
+     * 
+     * 
+     * u_char *buf = (u_char *)malloc(100), *ptr;
+     * u_char type = (ASN_UNIVERSAL | ASN_PRIMITIVE | ASN_INTEGER);
+     * size_t buf_len = 100, offset = 0, ptr_offset;
+     * long data1 = 1234, data2 = 5678;
+     * int rc = 0, allow_realloc = 1;
+     * 
+     * rc  = asn_realloc_rbuild_int(&buf, &buf_len, &offset, allow_realloc,
+     * type, &data1, sizeof(long));
+     * ptr_offset = offset;
+     * if (rc == 0) {
+     * error;
+     * }
+     * rc  = asn_realloc_rbuild_int(&buf, &buf_len, &offset, allow_realloc,
+     * type, &data2, sizeof(long));
+     * ptr = buf + buf_len - ptr_offset
+     * make use of ptr here;
+     * 
+     * 
+     * 
+     * Here, you can see that ptr will be a valid pointer even if the block of
+     * memory has been moved, as it may well have been.  Plenty of examples of
+     * usage all over asn1.c, snmp_api.c, snmpusm.c.
+     * 
+     * The other thing you should **NEVER** do is to pass a pointer to a buffer
+     * on the stack as the first argument when allow_realloc is non-zero, unless
+     * you really know what you are doing and your machine/compiler allows you to
+     * free non-heap memory.  There are rumours that such things exist, but many
+     * consider them no more than the wild tales of a fool.
+     * 
+     * Of course, you can pass allow_realloc as zero, to indicate that you do not
+     * wish the packet buffer to be reallocated for some reason; perhaps because
+     * it is on the stack.  This may be useful to emulate the functionality of
+     * the old API:
+     * 
+     * u_char my_static_buffer[100], *cp = NULL;
+     * size_t my_static_buffer_len = 100;
+     * float my_pi = (float)22/(float)7;
+     * 
+     * cp = asn_rbuild_float(my_static_buffer, &my_static_buffer_len,
+     * ASN_OPAQUE_FLOAT, &my_pi, sizeof(float));
+     * if (cp == NULL) {
+     * error;
+     * }
+     * 
+     * 
+     * IS EQUIVALENT TO:
+     * 
+     * 
+     * u_char my_static_buffer[100];
+     * size_t my_static_buffer_len = 100, my_offset = 0;
+     * float my_pi = (float)22/(float)7;
+     * int rc = 0;
+     * 
+     * rc = asn_realloc_rbuild_float(&my_static_buffer, &my_static_buffer_len,
+     * &my_offset, 0,
+     * ASN_OPAQUE_FLOAT, &my_pi, sizeof(float));
+     * if (rc == 0) {
+     * error;
+     * }
+     * 
+     * 
+     */
+
+
+    int             asn_realloc_rbuild_int(u_char ** pkt, size_t * pkt_len,
+                                           size_t * offset,
+                                           int allow_realloc, u_char type,
+                                           long *data, size_t data_size);
+
+    int             asn_realloc_rbuild_string(u_char ** pkt,
+                                              size_t * pkt_len,
+                                              size_t * offset,
+                                              int allow_realloc,
+                                              u_char type,
+                                              const u_char * data,
+                                              size_t data_size);
+
+    int             asn_realloc_rbuild_unsigned_int(u_char ** pkt,
+                                                    size_t * pkt_len,
+                                                    size_t * offset,
+                                                    int allow_realloc,
+                                                    u_char type,
+                                                    u_long * data,
+                                                    size_t data_size);
+
+    int             asn_realloc_rbuild_header(u_char ** pkt,
+                                              size_t * pkt_len,
+                                              size_t * offset,
+                                              int allow_realloc,
+                                              u_char type,
+                                              size_t data_size);
+
+    int             asn_realloc_rbuild_sequence(u_char ** pkt,
+                                                size_t * pkt_len,
+                                                size_t * offset,
+                                                int allow_realloc,
+                                                u_char type,
+                                                size_t data_size);
+
+    int             asn_realloc_rbuild_length(u_char ** pkt,
+                                              size_t * pkt_len,
+                                              size_t * offset,
+                                              int allow_realloc,
+                                              size_t data_size);
+
+    int             asn_realloc_rbuild_objid(u_char ** pkt,
+                                             size_t * pkt_len,
+                                             size_t * offset,
+                                             int allow_realloc,
+                                             u_char type, const oid *,
+                                             size_t);
+
+    int             asn_realloc_rbuild_null(u_char ** pkt,
+                                            size_t * pkt_len,
+                                            size_t * offset,
+                                            int allow_realloc,
+                                            u_char type);
+
+    int             asn_realloc_rbuild_bitstring(u_char ** pkt,
+                                                 size_t * pkt_len,
+                                                 size_t * offset,
+                                                 int allow_realloc,
+                                                 u_char type,
+                                                 u_char * data,
+                                                 size_t data_size);
+
+    int             asn_realloc_rbuild_unsigned_int64(u_char ** pkt,
+                                                      size_t * pkt_len,
+                                                      size_t * offset,
+                                                      int allow_realloc,
+                                                      u_char type,
+                                                      struct counter64
+                                                      *data, size_t);
+
+    int             asn_realloc_rbuild_signed_int64(u_char ** pkt,
+                                                    size_t * pkt_len,
+                                                    size_t * offset,
+                                                    int allow_realloc,
+                                                    u_char type,
+                                                    struct counter64 *data,
+                                                    size_t);
+
+    int             asn_realloc_rbuild_float(u_char ** pkt,
+                                             size_t * pkt_len,
+                                             size_t * offset,
+                                             int allow_realloc,
+                                             u_char type, float *data,
+                                             size_t data_size);
+
+    int             asn_realloc_rbuild_double(u_char ** pkt,
+                                              size_t * pkt_len,
+                                              size_t * offset,
+                                              int allow_realloc,
+                                              u_char type, double *data,
+                                              size_t data_size);
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+#endif                          /* ASN1_H */
diff -Naur tomato/release/src/router/snmp/include/net-snmp/library/callback.h tomato121/release/src/router/snmp/include/net-snmp/library/callback.h
--- tomato/release/src/router/snmp/include/net-snmp/library/callback.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/include/net-snmp/library/callback.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,59 @@
+/*
+ * callback.c: A generic callback mechanism 
+ */
+
+#ifndef CALLBACK_H
+#define CALLBACK_H
+
+#ifdef __cplusplus
+extern          "C" {
+#endif
+
+#define MAX_CALLBACK_IDS    2
+#define MAX_CALLBACK_SUBIDS 16
+
+    /*
+     * Callback Major Types 
+     */
+#define SNMP_CALLBACK_LIBRARY     0
+#define SNMP_CALLBACK_APPLICATION 1
+
+    /*
+     * SNMP_CALLBACK_LIBRARY minor types 
+     */
+#define SNMP_CALLBACK_POST_READ_CONFIG	        0
+#define SNMP_CALLBACK_STORE_DATA	        1
+#define SNMP_CALLBACK_SHUTDOWN		        2
+#define SNMP_CALLBACK_POST_PREMIB_READ_CONFIG	3
+#define SNMP_CALLBACK_LOGGING			4
+#define SNMP_CALLBACK_SESSION_INIT		5
+
+    typedef int     (SNMPCallback) (int majorID, int minorID,
+                                    void *serverarg, void *clientarg);
+
+    struct snmp_gen_callback {
+        SNMPCallback   *sc_callback;
+        void           *sc_client_arg;
+        struct snmp_gen_callback *next;
+    };
+
+    /*
+     * function prototypes 
+     */
+    void            init_callbacks(void);
+    int             snmp_register_callback(int major, int minor,
+                                           SNMPCallback * new_callback,
+                                           void *arg);
+    int             snmp_call_callbacks(int major, int minor,
+                                        void *caller_arg);
+    int             snmp_callback_available(int major, int minor);      /* is >1 available */
+    int             snmp_count_callbacks(int major, int minor); /* ret the number registered */
+    int             snmp_unregister_callback(int major, int minor,
+                                             SNMPCallback * new_callback,
+                                             void *arg, int matchargs);
+    struct snmp_gen_callback *snmp_callback_list(int major, int minor);
+
+#ifdef __cplusplus
+}
+#endif
+#endif                          /* CALLBACK_H */
diff -Naur tomato/release/src/router/snmp/include/net-snmp/library/check_varbind.h tomato121/release/src/router/snmp/include/net-snmp/library/check_varbind.h
--- tomato/release/src/router/snmp/include/net-snmp/library/check_varbind.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/include/net-snmp/library/check_varbind.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,29 @@
+#ifndef SNMP_CHECK_VARBIND_H
+#define SNMP_CHECK_VARBIND_H
+
+#ifdef __cplusplus
+extern          "C" {
+#endif
+
+    /*
+     * Assorted convience routines to check the contents of a
+     * netsnmp_variable_list instance.
+     */
+
+    int netsnmp_check_vb_type_and_size(netsnmp_variable_list *var, int type,
+                                       size_t size);
+
+    int netsnmp_check_vb_int_range(netsnmp_variable_list *var, int low,
+                                   int high);
+
+    int netsnmp_check_vb_truthvalue(netsnmp_variable_list *var);
+
+    int netsnmp_check_vb_rowstatus(netsnmp_variable_list *var, int old_val);
+
+    int netsnmp_check_vb_storagetype(netsnmp_variable_list *var, int old_val);
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif                          /* SNMP_CHECK_VARBIND_H */
diff -Naur tomato/release/src/router/snmp/include/net-snmp/library/cmu_compat.h tomato121/release/src/router/snmp/include/net-snmp/library/cmu_compat.h
--- tomato/release/src/router/snmp/include/net-snmp/library/cmu_compat.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/include/net-snmp/library/cmu_compat.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,280 @@
+/*
+ *  CMU compatability definitions and structures.
+ *
+ *    (since the UCD package split from the CMU one
+ *     about 8 years ago, that's probably enough time
+ *     for people to convert any outstanding code!)
+ */
+
+#ifndef NET_SNMP_CMU_COMPAT_H
+#define NET_SNMP_CMU_COMPAT_H
+
+#ifdef __cplusplus
+extern          "C" {
+#endif
+
+    /*
+     * ============================
+     * *
+     * * Enumerations and definitions
+     * *
+     * * ============================ 
+     */
+#include <net-snmp/definitions.h>
+    /*
+     * From parse.h 
+     */
+#define ACCESS_READONLY		MIB_ACCESS_READONLY
+#define ACCESS_READWRITE	MIB_ACCESS_READWRITE
+#define ACCESS_WRITEONLY	MIB_ACCESS_WRITEONLY
+#define ACCESS_NOACCESS		MIB_ACCESS_NOACCESS
+#define ACCESS_NOTIFY		MIB_ACCESS_NOTIFY
+#define ACCESS_CREATE		MIB_ACCESS_CREATE
+#define STATUS_MANDATORY	MIB_STATUS_MANDATORY
+#define STATUS_OPTIONAL		MIB_STATUS_OPTIONAL
+#define STATUS_OBSOLETE		MIB_STATUS_OBSOLETE
+#define STATUS_DEPRECATED	MIB_STATUS_DEPRECATED
+#define STATUS_CURRENT		MIB_STATUS_CURRENT
+    /*
+     * From smnp_impl.h 
+     */
+#define INTEGER	    ASN_INTEGER
+#define STRING	    ASN_OCTET_STR
+#define OBJID	    ASN_OBJECT_ID
+#define NULLOBJ	    ASN_NULL
+#define BITSTRING   ASN_BIT_STR /* HISTORIC - don't use */
+#define IPADDRESS   ASN_IPADDRESS
+#define COUNTER	    ASN_COUNTER
+#define GAUGE	    ASN_GAUGE
+#define UNSIGNED    ASN_UNSIGNED
+#define TIMETICKS   ASN_TIMETICKS
+#define ASNT_OPAQUE ASN_OPAQUE
+#define NSAP	    ASN_NSAP
+#define COUNTER64   ASN_COUNTER64
+#define UINTEGER    ASN_UINTEGER
+    /*
+     * From snmp.h 
+     */
+#define GET_REQ_MSG	    SNMP_MSG_GET
+#define GETNEXT_REQ_MSG	    SNMP_MSG_GETNEXT
+#define GET_RSP_MSG	    SNMP_MSG_RESPONSE
+#define SET_REQ_MSG	    SNMP_MSG_SET
+#define TRP_REQ_MSG	    SNMP_MSG_TRAP
+#define BULK_REQ_MSG	    SNMP_MSG_GETBULK
+#define INFORM_REQ_MSG	    SNMP_MSG_INFORM
+#define TRP2_REQ_MSG	    SNMP_MSG_TRAP2
+#define REPORT_RSP_MSG	    SNMP_MSG_REPORT
+    /*
+     * since CMU V1.5 
+     */
+#define SNMP_PDU_GET	    SNMP_MSG_GET
+#define SNMP_PDU_GETNEXT    SNMP_MSG_GETNEXT
+#define SNMP_PDU_RESPONSE   SNMP_MSG_RESPONSE
+#define SNMP_PDU_SET        SNMP_MSG_SET
+#define SNMP_PDU_GETBULK    SNMP_MSG_GETBULK
+#define SNMP_PDU_INFORM     SNMP_MSG_INFORM
+#define SNMP_PDU_V2TRAP     SNMP_MSG_TRAP2
+#define SNMP_PDU_REPORT     SNMP_MSG_REPORT
+#define SNMP_TRAP_AUTHENTICATIONFAILURE SNMP_TRAP_AUTHFAIL
+#define SMI_INTEGER     ASN_INTEGER
+#define SMI_STRING      ASN_OCTET_STR
+#define SMI_OBJID       ASN_OBJECT_ID
+#define SMI_NULLOBJ     ASN_NULL
+#define SMI_IPADDRESS   ASN_IPADDRESS
+#define SMI_COUNTER32	ASN_COUNTER
+#define SMI_GAUGE32	ASN_GAUGE
+#define SMI_UNSIGNED32  SMI_GAUGE32
+#define SMI_TIMETICKS   ASN_TIMETICKS
+#define SMI_OPAQUE      ASN_OPAQUE
+#define SMI_COUNTER64   ASN_COUNTER64
+    /*
+     * ============================
+     * *
+     * *     Function declarations
+     * *     and global variables
+     * *
+     * * ============================ 
+     */
+extern int      snmp_dump_packet;       /* from snmp_api.h */
+extern int      quick_print;    /* from snmp_api.h */
+
+#include <net-snmp/types.h>     /* for snmp_pdu & snmp_session */
+
+int             mib_TxtToOid(char *, oid **, size_t *); /* from snmp.h */
+int             mib_OidToTxt(oid *, size_t, char *, size_t);    /* from snmp.h */
+char           *snmp_pdu_type(netsnmp_pdu *);   /* from snmp.h */
+u_char         *cmu_snmp_parse(netsnmp_session * session, netsnmp_pdu *pdu, u_char * data, size_t length);      /* from snmp.h */
+
+
+
+
+        /*
+         * ============================
+         * *
+         * * MIB-II data structures
+         * *    (from mib.h) 
+         * *
+         * * ============================ 
+         */
+
+
+struct mib_system {
+    char            sysDescr[32];       /* textual description */
+    u_char          sysObjectID[16];    /* OBJECT IDENTIFIER of system */
+    u_char          ObjIDLen;   /* length of sysObjectID */
+    u_int           sysUpTime;  /* Uptime in 100/s of a second */
+};
+
+struct mib_interface {
+    int             ifNumber;   /* number of interfaces */
+};
+
+struct mib_ifEntry {
+    int             ifIndex;    /* index of this interface  */
+    char            ifDescr[32];        /* english description of interface */
+    int             ifType;     /* network type of device   */
+    int             ifMtu;      /* size of largest packet in bytes  */
+    u_int           ifSpeed;    /* bandwidth in bits/sec    */
+    u_char          ifPhysAddress[11];  /* interface's address */
+    u_char          PhysAddrLen;        /* length of physAddr */
+    int             ifAdminStatus;      /* desired state of interface */
+    int             ifOperStatus;       /* current operational status */
+    u_int           ifLastChange;       /* value of sysUpTime when current state entered */
+    u_int           ifInOctets; /* number of octets received on interface */
+    u_int           ifInUcastPkts;      /* number of unicast packets delivered */
+    u_int           ifInNUcastPkts;     /* number of broadcasts or multicasts */
+    u_int           ifInDiscards;       /* number of packets discarded with no error */
+    u_int           ifInErrors; /* number of packets containing errors */
+    u_int           ifInUnknownProtos;  /* number of packets with unknown protocol */
+    u_int           ifOutOctets;        /* number of octets transmitted */
+    u_int           ifOutUcastPkts;     /* number of unicast packets sent */
+    u_int           ifOutNUcastPkts;    /* number of broadcast or multicast pkts */
+    u_int           ifOutDiscards;      /* number of packets discarded with no error */
+    u_int           ifOutErrors;        /* number of pkts discarded with an error */
+    u_int           ifOutQLen;  /* number of packets in output queue */
+};
+
+struct mib_atEntry {
+    int             atIfIndex;  /* interface on which this entry maps */
+    u_char          atPhysAddress[11];  /* physical address of destination */
+    u_char          PhysAddressLen;     /* length of atPhysAddress */
+    u_int           atNetAddress;       /* IP address of physical address */
+};
+
+struct mib_ip {
+    int             ipForwarding;       /* 1 if gateway, 2 if host */
+    int             ipDefaultTTL;       /* default TTL for pkts originating here */
+    u_int           ipInReceives;       /* no. of IP packets received from interfaces */
+    u_int           ipInHdrErrors;      /* number of pkts discarded due to header errors */
+    u_int           ipInAddrErrors;     /* no. of pkts discarded due to bad address */
+    u_int           ipForwDatagrams;    /* number pf pkts forwarded through this entity */
+    u_int           ipInUnknownProtos;  /* no. of local-addressed pkts w/unknown proto */
+    u_int           ipInDiscards;       /* number of error-free packets discarded */
+    u_int           ipInDelivers;       /* number of datagrams delivered to upper level */
+    u_int           ipOutRequests;      /* number of IP datagrams originating locally */
+    u_int           ipOutDiscards;      /* number of error-free output IP pkts discarded */
+    u_int           ipOutNoRoutes;      /* number of IP pkts discarded due to no route */
+    int             ipReasmTimeout;     /* seconds fragment is held awaiting reassembly */
+    u_int           ipReasmReqds;       /* no. of fragments needing reassembly (here) */
+    u_int           ipReasmOKs; /* number of fragments reassembled */
+    u_int           ipReasmFails;       /* number of failures in IP reassembly */
+    u_int           ipFragOKs;  /* number of datagrams fragmented here */
+    u_int           ipFragFails;        /* no. pkts unable to be fragmented here */
+    u_int           ipFragCreates;      /* number of IP fragments created here */
+};
+
+struct mib_ipAddrEntry {
+    u_int           ipAdEntAddr;        /* IP address of this entry */
+    int             ipAdEntIfIndex;     /* IF for this entry */
+    u_int           ipAdEntNetMask;     /* subnet mask of this entry */
+    int             ipAdEntBcastAddr;   /* read the MIB for this one */
+};
+
+struct mib_ipRouteEntry {
+    u_int           ipRouteDest;        /* destination IP addr for this route */
+    int             ipRouteIfIndex;     /* index of local IF for this route */
+    int             ipRouteMetric1;     /* Primary routing metric */
+    int             ipRouteMetric2;     /* Alternate routing metric */
+    int             ipRouteMetric3;     /* Alternate routing metric */
+    int             ipRouteMetric4;     /* Alternate routing metric */
+    u_int           ipRouteNextHop;     /* IP addr of next hop */
+    int             ipRouteType;        /* Type of this route */
+    int             ipRouteProto;       /* How this route was learned */
+    int             ipRouteAge; /* No. of seconds since updating this route */
+};
+
+struct mib_icmp {
+    u_int           icmpInMsgs; /* Total of ICMP msgs received */
+    u_int           icmpInErrors;       /* Total of ICMP msgs received with errors */
+    u_int           icmpInDestUnreachs;
+    u_int           icmpInTimeExcds;
+    u_int           icmpInParmProbs;
+    u_int           icmpInSrcQuenchs;
+    u_int           icmpInRedirects;
+    u_int           icmpInEchos;
+    u_int           icmpInEchoReps;
+    u_int           icmpInTimestamps;
+    u_int           icmpInTimestampReps;
+    u_int           icmpInAddrMasks;
+    u_int           icmpInAddrMaskReps;
+    u_int           icmpOutMsgs;
+    u_int           icmpOutErrors;
+    u_int           icmpOutDestUnreachs;
+    u_int           icmpOutTimeExcds;
+    u_int           icmpOutParmProbs;
+    u_int           icmpOutSrcQuenchs;
+    u_int           icmpOutRedirects;
+    u_int           icmpOutEchos;
+    u_int           icmpOutEchoReps;
+    u_int           icmpOutTimestamps;
+    u_int           icmpOutTimestampReps;
+    u_int           icmpOutAddrMasks;
+    u_int           icmpOutAddrMaskReps;
+};
+
+struct mib_tcp {
+    int             tcpRtoAlgorithm;    /* retransmission timeout algorithm */
+    int             tcpRtoMin;  /* minimum retransmission timeout (mS) */
+    int             tcpRtoMax;  /* maximum retransmission timeout (mS) */
+    int             tcpMaxConn; /* maximum tcp connections possible */
+    u_int           tcpActiveOpens;     /* number of SYN-SENT -> CLOSED transitions */
+    u_int           tcpPassiveOpens;    /* number of SYN-RCVD -> LISTEN transitions */
+    u_int           tcpAttemptFails;    /*(SYN-SENT,SYN-RCVD)->CLOSED or SYN-RCVD->LISTEN */
+    u_int           tcpEstabResets;     /* (ESTABLISHED,CLOSE-WAIT) -> CLOSED */
+    u_int           tcpCurrEstab;       /* number in ESTABLISHED or CLOSE-WAIT state */
+    u_int           tcpInSegs;  /* number of segments received */
+    u_int           tcpOutSegs; /* number of segments sent */
+    u_int           tcpRetransSegs;     /* number of retransmitted segments */
+};
+
+struct mib_tcpConnEntry {
+    int             tcpConnState;       /* State of this connection */
+    u_int           tcpConnLocalAddress;        /* local IP address for this connection */
+    int             tcpConnLocalPort;   /* local port for this connection */
+    u_int           tcpConnRemAddress;  /* remote IP address for this connection */
+    int             tcpConnRemPort;     /* remote port for this connection */
+};
+
+struct mib_udp {
+    u_int           udpInDatagrams;     /* No. of UDP datagrams delivered to users */
+    u_int           udpNoPorts; /* No. of UDP datagrams to port with no listener */
+    u_int           udpInErrors;        /* No. of UDP datagrams unable to be delivered */
+    u_int           udpOutDatagrams;    /* No. of UDP datagrams sent from this entity */
+};
+
+struct mib_egp {
+    u_int           egpInMsgs;  /* No. of EGP msgs received without error */
+    u_int           egpInErrors;        /* No. of EGP msgs received with error */
+    u_int           egpOutMsgs; /* No. of EGP msgs sent */
+    u_int           egpOutErrors;       /* No. of (outgoing) EGP msgs dropped due to error */
+};
+
+struct mib_egpNeighEntry {
+    int             egpNeighState;      /* local EGP state with this entry's neighbor */
+    u_int           egpNeighAddr;       /* IP address of this entry's neighbor */
+};
+
+#ifdef __cplusplus
+}
+#endif
+#endif                          /* NET_SNMP_CMU_COMPAT_H */
diff -Naur tomato/release/src/router/snmp/include/net-snmp/library/container_binary_array.h tomato121/release/src/router/snmp/include/net-snmp/library/container_binary_array.h
--- tomato/release/src/router/snmp/include/net-snmp/library/container_binary_array.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/include/net-snmp/library/container_binary_array.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,31 @@
+/*
+ * binary_array.h
+ * $Id: container_binary_array.h,v 1.1.2.1 2004/06/20 21:54:38 nikki Exp $
+ */
+
+#ifndef BINARY_ARRAY_H
+#define BINARY_ARRAY_H
+
+#ifdef __cplusplus
+extern          "C" {
+#endif
+
+#include <net-snmp/library/asn1.h>
+#include <net-snmp/library/container.h>
+#include <net-snmp/library/factory.h>
+
+    /*
+     * get an container which uses an binary_array for storage
+     */
+    netsnmp_container *   netsnmp_container_get_binary_array(void);
+    int netsnmp_container_get_binary_array_noalloc(netsnmp_container *c);
+
+    /*
+     * get a factory for producing binary_array objects
+     */
+    netsnmp_factory *     netsnmp_container_get_binary_array_factory(void);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff -Naur tomato/release/src/router/snmp/include/net-snmp/library/container.h tomato121/release/src/router/snmp/include/net-snmp/library/container.h
--- tomato/release/src/router/snmp/include/net-snmp/library/container.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/include/net-snmp/library/container.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,399 @@
+#ifndef NETSNMP_CONTAINER_H
+#define NETSNMP_CONTAINER_H
+
+/*
+ * WARNING: This is a recently created file, and all of it's contents are
+ *          subject to change at any time.
+ *
+ * A basic container template. A generic way for code to store and
+ * retrieve data. Allows for interchangable storage algorithms.
+ */
+#ifndef NET_SNMP_CONFIG_H
+#error "Please include <net-snmp/net-snmp-config.h> before this file"
+#endif
+
+#include <net-snmp/types.h>
+#include <net-snmp/library/factory.h>
+
+#ifdef  __cplusplus
+extern "C" {
+#endif
+
+    /*************************************************************************
+     *
+     * function pointer definitions
+     *
+     *************************************************************************/
+    struct netsnmp_iterator_s; /** forward declare */
+    struct netsnmp_container_s; /** forward declare */
+
+    /*
+     * function returning an int for an operation on a container
+     */
+    typedef int (netsnmp_container_rc)(struct netsnmp_container_s *);
+
+    /*
+     * function returning an int for an operation on a container
+     */
+    typedef struct netsnmp_iterator_s * (netsnmp_container_it)
+        (struct netsnmp_container_s *);
+
+    /*
+     * function returning a size_t for an operation on a container
+     */
+    typedef size_t (netsnmp_container_size)(struct netsnmp_container_s *);
+
+    /*
+     * function returning an int for an operation on an object and
+     * a container
+     */
+    typedef int (netsnmp_container_op)(struct netsnmp_container_s *,
+                                       const void *data);
+
+    /*
+     * function returning an oject for an operation on an object and a
+     * container
+     */
+    typedef void * (netsnmp_container_rtn)(struct netsnmp_container_s *,
+                                           const void *data);
+
+    /*
+     * function with no return which acts on an object
+     */
+    typedef void (netsnmp_container_obj_func)(void *data, void *context);
+
+    /*
+     * function with no return which acts on an object
+     */
+    typedef void (netsnmp_container_func)(struct netsnmp_container_s *,
+                                          netsnmp_container_obj_func *,
+                                          void *context);
+
+    /*
+     * function returning an array of objects for an operation on an
+     * ojbect and a container
+     */
+    typedef netsnmp_void_array * (netsnmp_container_set)
+        (struct netsnmp_container_s *, void *data);
+
+    /*
+     * function returning an int for a comparison between two objects
+     */
+    typedef int (netsnmp_container_compare)(const void *lhs,
+                                            const void *rhs);
+
+    /*************************************************************************
+     *
+     * Basic container
+     *
+     *************************************************************************/
+    typedef struct netsnmp_container_s {
+       
+       /*
+        * pointer for container
+        */
+       void *         private;
+
+       /*
+        * returns the number of items in a container
+        */
+       netsnmp_container_size  *get_size;
+       
+       /*
+        * initialize a container
+        */
+       netsnmp_container_rc    *init;
+
+       /*
+        * release memory used by a container.
+        *
+        * Note: if your data structures contained allcoated
+        * memory, you are responsible for releasing that
+        * memory before calling this function!
+        */
+       netsnmp_container_rc    *cfree;
+
+       /*
+        * add an entry to the container
+        */
+       netsnmp_container_op    *insert;
+
+       /*
+        * remove an entry from the container
+        */
+       netsnmp_container_op    *remove;
+
+       /*
+        * Note: do not change the key!  If you need to
+        * change a key, remove the entry, change the key,
+        * and the re-add the entry.
+        */
+
+       /*
+        * find the entry in the container with the same key
+        *
+        */
+       netsnmp_container_rtn   *find;
+
+       /*
+        * find the first entry in the container with a key greater than
+        * the specified key.
+        *
+        * If the key is NULL, return the first item in the container.
+        */
+       netsnmp_container_rtn   *find_next;
+
+       /*
+        * find all entries iin the container which match the partial key
+        */
+       netsnmp_container_set            *get_subset;
+
+       /*
+        * function to return an iterator for the container
+        */
+       struct netsnmp_container_it    *get_iterator;
+
+       /*
+        * function to call another function for each object in the container
+        */
+       netsnmp_container_func         *for_each;
+
+       /*
+        * function to compare two object stored in the container.
+        *
+        * Returns:
+        *
+        *   -1  LHS < RHS
+        *    0  LHS = RHS
+        *    1  LHS > RHS
+        */
+       netsnmp_container_compare        *compare;
+
+       /*
+        * same as compare, but RHS will be a partial key
+        */
+       netsnmp_container_compare        *ncompare;
+
+       /*
+        * containers can contain other containers (additional indexes)
+        */
+       struct netsnmp_container_s *next, *prev;
+
+    } netsnmp_container;
+
+    /*
+     * initialize a container of container factories. used by
+     * netsnmp_container_find* functions.
+     */
+    void netsnmp_container_init_list(void);
+
+    /*
+     * register a new container factory
+     */
+    int netsnmp_container_register(const char* name, netsnmp_factory *f);
+
+    /*
+     * search for and create a container from a list of types or a
+     * specific type.
+     */
+    netsnmp_container * netsnmp_container_find(const char *type_list);
+    netsnmp_container * netsnmp_container_get(const char *type);
+
+    /*
+     * search for and create a container from a list of types or a
+     * specific type, using the provided container structure
+     */
+    int netsnmp_container_find_noalloc(const char *type_list,
+                                       netsnmp_container* c);
+    int netsnmp_container_get_noalloc(const char *type, netsnmp_container* c);
+
+    /*
+     * utility routines
+     */
+    void netsnmp_container_add_index(netsnmp_container *primary,
+                                     netsnmp_container *new_index);
+
+
+    /*
+     * commone comparison routines
+     */
+    /** first data element is a 'netsnmp_index' */
+    int netsnmp_compare_netsnmp_index(const void *lhs, const void *rhs);
+    int netsnmp_ncompare_netsnmp_index(const void *lhs, const void *rhs);
+
+    /** first data element is a 'char *' */
+    int netsnmp_compare_cstring(const void * lhs, const void * rhs);
+    int netsnmp_ncompare_cstring(const void * lhs, const void * rhs);
+
+    /** useful for octet strings */
+    int netsnmp_compare_mem(const char * lhs, size_t lhs_len,
+                            const char * rhs, size_t rhs_len);
+
+
+    /*
+     * useful macros
+     */
+#define CONTAINER_FIRST(x)          (x)->find(x,NULL)
+#define CONTAINER_FIND(x,k)         (x)->find(x,k)
+#define CONTAINER_NEXT(x,k)         (x)->find_next(x,k)
+#define CONTAINER_GET_SUBSET(x,k)   (x)->get_subset(x,k)
+#define CONTAINER_SIZE(x)           (x)->get_size(x)
+#define CONTAINER_ITERATOR(x)       (x)->get_iterator(x)
+#define CONTAINER_COMPARE(x,l,r)    (x)->compare(l,r)
+#define CONTAINER_FOR_EACH(x,f,c)   (x)->for_each(x,f,c)
+
+    /*
+     * if you are getting multiple definitions of these three
+     * inline functions, you most likely have optimizations turned off for your
+     * compiler (-O flag). Either turn them back on, or make sure that
+     * NETSNMP_INLINE is not defined in net-snmp-config.h.
+     */
+#ifdef NETSNMP_NO_INLINE
+    int CONTAINER_INSERT(netsnmp_container *x, const void *k);
+    int CONTAINER_REMOVE(netsnmp_container *x, const void *k);
+    int CONTAINER_FREE(netsnmp_container *x);
+#else
+    /*------------------------------------------------------------------
+     * These functions should EXACTLY match the function version in
+     * container.c. If you change one, change them both.
+     */
+    static NETSNMP_INLINE /* gcc docs recommend static w/inline */
+    int CONTAINER_INSERT(netsnmp_container *x, const void *k)
+    {
+        int rc;
+        
+        rc = x->insert(x,k);
+        if (NULL != x->next) {
+            netsnmp_container *tmp = x->next;
+            int                rc2;
+            while(tmp) {
+                rc2 = tmp->insert(tmp,k);
+                if (rc2)
+                    snmp_log(LOG_ERR,"error on subcontainer insert (%d)\n", rc2);
+                tmp = tmp->next;
+            }
+        }
+        return rc;
+    }
+    
+    /*------------------------------------------------------------------
+     * These functions should EXACTLY match the function version in
+     * container.c. If you change one, change them both.
+     */
+    static NETSNMP_INLINE /* gcc docs recommend static w/inline */
+    int CONTAINER_REMOVE(netsnmp_container *x, const void *k)
+    {
+        if (NULL != x->next) {
+            netsnmp_container *tmp = x->next;
+            int                rc;
+            while(tmp->next)
+                tmp = tmp->next;
+            while(tmp) {
+                rc = tmp->remove(tmp,k);
+                if (rc)
+                    snmp_log(LOG_ERR,"error on subcontainer remove (%d)\n", rc);
+                tmp = tmp->prev;
+            }
+        }
+        return x->remove(x,k);
+    }
+    
+    /*------------------------------------------------------------------
+     * These functions should EXACTLY match the function version in
+     * container.c. If you change one, change them both.
+     */
+    static NETSNMP_INLINE /* gcc docs recommend static w/inline */
+    int CONTAINER_FREE(netsnmp_container *x)
+    {
+        if (NULL != x->next) {
+            netsnmp_container *prev, *tmp = x->next;
+            int                rc;
+            while(tmp->next)
+                tmp = tmp->next;
+            while(tmp) {
+                prev = tmp->prev;
+                rc = tmp->cfree(tmp);
+                if (rc)
+                    snmp_log(LOG_ERR,"error on subcontainer cfree (%d)\n", rc);
+                tmp = prev;
+            }
+        }
+        return x->cfree(x);
+    }
+#endif
+
+    /*************************************************************************
+     *
+     * container iterator
+     *
+     *************************************************************************/
+    /*
+     * function returning an int for an operation on an iterator
+     */
+    typedef int (netsnmp_iterator_rc)(struct netsnmp_iterator_s *);
+
+    /*
+     * function returning an int for an operation on an iterator and
+     * an object in the container.
+     */
+    typedef int (netsnmp_iterator_rc_op)(struct netsnmp_iterator_s *,
+                                         void *data);
+
+    /*
+     * function returning an oject for an operation on an iterator
+     */
+    typedef void * (netsnmp_iterator_rtn)(struct netsnmp_iterator_s *);
+
+    typedef struct netsnmp_iterator_s {
+
+       netsnmp_container              *container;
+
+       void                           *context;
+
+       netsnmp_iterator_rc           *init;
+       netsnmp_iterator_rc_op        *position;
+       netsnmp_iterator_rtn          *first;
+       netsnmp_iterator_rtn          *next;
+       netsnmp_iterator_rtn          *last;
+
+    } netsnmp_iterator;
+
+
+#define ITERATOR_FIRST(x)  x->first(x)
+#define ITERATOR_NEXT(x)   x->next(x)
+#define ITERATOR_LAST(x)   x->last(x)
+
+
+    /*************************************************************************
+     *
+     * Sorted container
+     *
+     *************************************************************************/
+    typedef struct netsnmp_sorted_container_s {
+       
+       netsnmp_container                bc;
+       
+       /*
+        * methods to manipulate container
+        */
+
+       netsnmp_container_rtn            *first;
+       netsnmp_container_rtn            *next;
+       netsnmp_container_set            *subset;
+       
+    } netsnmp_sorted_container;
+    
+
+    void
+    netsnmp_init_sorted_container(netsnmp_sorted_container  *sc,
+                                  netsnmp_container_rtn     *first,
+                                  netsnmp_container_rtn     *next,
+                                  netsnmp_container_set     *subset);
+    
+    
+    
+#ifdef  __cplusplus
+};
+#endif
+
+#endif /** NETSNMP_CONTAINER_H */
diff -Naur tomato/release/src/router/snmp/include/net-snmp/library/.cvsignore tomato121/release/src/router/snmp/include/net-snmp/library/.cvsignore
--- tomato/release/src/router/snmp/include/net-snmp/library/.cvsignore	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/include/net-snmp/library/.cvsignore	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1 @@
+snmpv3-security-includes.h
diff -Naur tomato/release/src/router/snmp/include/net-snmp/library/data_list.h tomato121/release/src/router/snmp/include/net-snmp/library/data_list.h
--- tomato/release/src/router/snmp/include/net-snmp/library/data_list.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/include/net-snmp/library/data_list.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,48 @@
+/*
+ * netsnmp_data_list.h
+ *
+ * $Id: data_list.h,v 1.1.2.1 2004/06/20 21:54:38 nikki Exp $
+ *
+ * External definitions for functions and variables in netsnmp_data_list.c.
+ */
+
+#ifndef DATA_LIST_H
+#define DATA_LIST_H
+
+#ifdef __cplusplus
+extern          "C" {
+#endif
+
+#include <net-snmp/library/snmp_impl.h>
+#include <net-snmp/library/tools.h>
+
+    typedef void    (Netsnmp_Free_List_Data) (void *);
+
+    typedef struct netsnmp_data_list_s {
+        struct netsnmp_data_list_s *next;
+        char           *name;
+        void           *data;   /* The pointer to the data passed on. */
+        Netsnmp_Free_List_Data *free_func;      /* must know how to free netsnmp_data_list->data */
+    } netsnmp_data_list;
+
+
+    NETSNMP_INLINE netsnmp_data_list *netsnmp_create_data_list(const char *,
+                                                       void *,
+                                                       Netsnmp_Free_List_Data
+                                                       *);
+    void            netsnmp_add_list_data(netsnmp_data_list **head,
+                                          netsnmp_data_list *node);
+    void           *netsnmp_get_list_data(netsnmp_data_list *head,
+                                          const char *node);
+    void            netsnmp_free_list_data(netsnmp_data_list *head);    /* single */
+    void            netsnmp_free_all_list_data(netsnmp_data_list *head);        /* multiple */
+    int             netsnmp_remove_list_node(netsnmp_data_list **realhead,
+                                             const char *name);
+    NETSNMP_INLINE void    *netsnmp_get_list_node(netsnmp_data_list *head,
+                                          const char *name);
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff -Naur tomato/release/src/router/snmp/include/net-snmp/library/default_store.h tomato121/release/src/router/snmp/include/net-snmp/library/default_store.h
--- tomato/release/src/router/snmp/include/net-snmp/library/default_store.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/include/net-snmp/library/default_store.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,124 @@
+/*
+ * default_store.h: storage space for defaults 
+ */
+#ifndef DEFAULT_STORE_H
+#define DEFAULT_STORE_H
+
+#ifdef __cplusplus
+extern          "C" {
+#endif
+
+#define NETSNMP_DS_MAX_IDS 3
+#define NETSNMP_DS_MAX_SUBIDS 32        /* needs to be a multiple of 8 */
+
+    /*
+     * begin storage definitions 
+     */
+    /*
+     * These definitions correspond with the "storid" argument to the API 
+     */
+#define NETSNMP_DS_LIBRARY_ID     0
+#define NETSNMP_DS_APPLICATION_ID 1
+#define NETSNMP_DS_TOKEN_ID       2
+
+    /*
+     * These definitions correspond with the "which" argument to the API,
+     * when the storeid argument is NETSNMP_DS_LIBRARY_ID 
+     */
+    /*
+     * library booleans 
+     */
+#define NETSNMP_DS_LIB_MIB_ERRORS          0
+#define NETSNMP_DS_LIB_SAVE_MIB_DESCRS     1
+#define NETSNMP_DS_LIB_MIB_COMMENT_TERM    2
+#define NETSNMP_DS_LIB_MIB_PARSE_LABEL     3
+#define NETSNMP_DS_LIB_DUMP_PACKET         4
+#define NETSNMP_DS_LIB_LOG_TIMESTAMP       5
+#define NETSNMP_DS_LIB_DONT_READ_CONFIGS   6
+#define NETSNMP_DS_LIB_MIB_REPLACE         7    /* replace objects from latest module */
+#define NETSNMP_DS_LIB_PRINT_NUMERIC_ENUM  8    /* print only numeric enum values */
+#define NETSNMP_DS_LIB_PRINT_NUMERIC_OIDS  9    /* print only numeric enum values */
+#define NETSNMP_DS_LIB_DONT_BREAKDOWN_OIDS 10   /* dont print oid indexes specially */
+#define NETSNMP_DS_LIB_ALARM_DONT_USE_SIG  11   /* don't use the alarm() signal */
+#define NETSNMP_DS_LIB_PRINT_FULL_OID      12   /* print fully qualified oids */
+#define NETSNMP_DS_LIB_QUICK_PRINT         13   /* print very brief output for parsing */
+#define NETSNMP_DS_LIB_RANDOM_ACCESS	   14   /* random access to oid labels */
+#define NETSNMP_DS_LIB_REGEX_ACCESS	   15   /* regex matching to oid labels */
+#define NETSNMP_DS_LIB_DONT_CHECK_RANGE    16   /* don't check values for ranges on send */
+#define NETSNMP_DS_LIB_NO_TOKEN_WARNINGS   17   /* no warn about unknown config tokens */
+#define NETSNMP_DS_LIB_NUMERIC_TIMETICKS   18   /* print timeticks as a number */
+#define NETSNMP_DS_LIB_ESCAPE_QUOTES       19   /* shell escape quote marks in oids */
+#define NETSNMP_DS_LIB_REVERSE_ENCODE      20   /* encode packets from back to front */
+#define NETSNMP_DS_LIB_PRINT_BARE_VALUE	   21   /* just print value (not OID = value) */
+#define NETSNMP_DS_LIB_EXTENDED_INDEX	   22   /* print extended index format [x1][x2] */
+#define NETSNMP_DS_LIB_PRINT_HEX_TEXT      23   /* print ASCII text along with hex strings */
+#define NETSNMP_DS_LIB_PRINT_UCD_STYLE_OID 24   /* print OID's using the UCD-style prefix suppression */
+#define NETSNMP_DS_LIB_READ_UCD_STYLE_OID  25   /* require top-level OIDs to be prefixed with a dot */
+#define NETSNMP_DS_LIB_HAVE_READ_PREMIB_CONFIG 26       /* have the pre-mib parsing config tokens been processed */
+#define NETSNMP_DS_LIB_HAVE_READ_CONFIG    27   /* have the config tokens been processed */
+#define NETSNMP_DS_LIB_QUICKE_PRINT        28   
+#define NETSNMP_DS_LIB_DONT_PRINT_UNITS    29 /* don't print UNITS suffix */
+#define NETSNMP_DS_LIB_NO_DISPLAY_HINT     30 /* don't apply DISPLAY-HINTs */
+#define NETSNMP_DS_LIB_16BIT_IDS           31   /* restrict requestIDs, etc to 16-bit values */
+
+    /*
+     * library integers 
+     */
+#define NETSNMP_DS_LIB_MIB_WARNINGS  0
+#define NETSNMP_DS_LIB_SECLEVEL      1
+#define NETSNMP_DS_LIB_SNMPVERSION   2
+#define NETSNMP_DS_LIB_DEFAULT_PORT  3
+#define NETSNMP_DS_LIB_OID_OUTPUT_FORMAT  4
+#define NETSNMP_DS_LIB_PRINT_SUFFIX_ONLY  NETSNMP_DS_LIB_OID_OUTPUT_FORMAT
+#define NETSNMP_DS_LIB_STRING_OUTPUT_FORMAT 5
+
+    /*
+     * special meanings for the default SNMP version slot (NETSNMP_DS_LIB_SNMPVERSION) 
+     */
+#define NETSNMP_DS_SNMP_VERSION_1    128        /* bogus */
+#define NETSNMP_DS_SNMP_VERSION_2c   1  /* real */
+#define NETSNMP_DS_SNMP_VERSION_3    3  /* real */
+
+
+    /*
+     * library strings 
+     */
+#define NETSNMP_DS_LIB_SECNAME           0
+#define NETSNMP_DS_LIB_CONTEXT           1
+#define NETSNMP_DS_LIB_PASSPHRASE        2
+#define NETSNMP_DS_LIB_AUTHPASSPHRASE    3
+#define NETSNMP_DS_LIB_PRIVPASSPHRASE    4
+#define NETSNMP_DS_LIB_OPTIONALCONFIG    5
+#define NETSNMP_DS_LIB_APPTYPE           6
+#define NETSNMP_DS_LIB_COMMUNITY         7
+#define NETSNMP_DS_LIB_PERSISTENT_DIR    8
+#define NETSNMP_DS_LIB_CONFIGURATION_DIR 9
+#define NETSNMP_DS_LIB_SECMODEL          10
+#define NETSNMP_DS_LIB_MIBDIRS           11
+
+    /*
+     * end storage definitions 
+     */
+
+    int             netsnmp_ds_set_boolean(int storeid, int which, int value);
+    int             netsnmp_ds_get_boolean(int storeid, int which);
+    int             netsnmp_ds_toggle_boolean(int storeid, int which);
+    int             netsnmp_ds_set_int(int storeid, int which, int value);
+    int             netsnmp_ds_get_int(int storeid, int which);
+    int             netsnmp_ds_set_string(int storeid, int which,
+                                  const char *value);
+    char           *netsnmp_ds_get_string(int storeid, int which);
+    int             netsnmp_ds_set_void(int storeid, int which, void *value);
+    void           *netsnmp_ds_get_void(int storeid, int which);
+    int             netsnmp_ds_register_config(u_char type, const char *ftype,
+                                       const char *token, int storeid,
+                                       int which);
+    int             netsnmp_ds_register_premib(u_char type, const char *ftype,
+                                       const char *token, int storeid,
+                                       int which);
+    void            netsnmp_ds_shutdown(void);
+
+#ifdef __cplusplus
+}
+#endif
+#endif                          /* DEFAULT_STORE_H */
diff -Naur tomato/release/src/router/snmp/include/net-snmp/library/factory.h tomato121/release/src/router/snmp/include/net-snmp/library/factory.h
--- tomato/release/src/router/snmp/include/net-snmp/library/factory.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/include/net-snmp/library/factory.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,72 @@
+#ifndef NETSNMP_FACTORY_H
+#define NETSNMP_FACTORY_H
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+    typedef void * (netsnmp_factory_produce_f)(void);
+    typedef int (netsnmp_factory_produce_noalloc_f)(void *);
+
+    typedef struct netsnmp_factory_s {
+        /*
+         * a string describing the product the factory creates
+         */
+        const char                           *product;
+
+        /*
+         * a function to create an object in newly allcoated memory
+         */
+        netsnmp_factory_produce_f            *produce;
+
+        /*
+         * a function to create an object in previously allcoated memory
+         */
+        netsnmp_factory_produce_noalloc_f    *produce_noalloc;
+
+    } netsnmp_factory;
+
+    /*
+     * init factory registry
+     */
+    void netsnmp_factory_init(void);
+
+    /*
+     * register a factory type
+     */
+    int  netsnmp_factory_register(netsnmp_factory *f);
+
+    /*
+     * get a factory
+     */
+    netsnmp_factory* netsnmp_factory_get(const char* product);
+
+    /*
+     * ask a factory to produce an object
+     */
+    void * netsnmp_factory_produce(const char* product);
+
+    /*
+     * ask a factory to produce an object in the provided memory
+     */
+    int netsnmp_factory_produce_noalloc(const char *product, void *memory);
+
+    /*
+     * factory return codes
+     */
+    enum {
+        FACTORY_NOERROR = 0,
+        FACTORY_EXISTS,
+        FACTORY_NOTFOUND,
+        FACTORY_NOMEMORY,
+        FACTORY_GENERR,
+        FACTORY_MAXIMUM_ERROR
+    };
+
+#ifdef __cplusplus
+};
+#endif
+
+
+#endif /* NETSNMP_FACTORY_H */
diff -Naur tomato/release/src/router/snmp/include/net-snmp/library/getopt.h tomato121/release/src/router/snmp/include/net-snmp/library/getopt.h
--- tomato/release/src/router/snmp/include/net-snmp/library/getopt.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/include/net-snmp/library/getopt.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,15 @@
+#ifndef _GETOPT_H_
+#define _GETOPT_H_ 1
+
+#ifdef __cplusplus
+extern          "C" {
+#endif
+
+    extern int      getopt(int, char *const *, const char *);
+    extern char    *optarg;
+    extern int      optind, opterr, optopt, optreset;
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff -Naur tomato/release/src/router/snmp/include/net-snmp/library/int64.h tomato121/release/src/router/snmp/include/net-snmp/library/int64.h
--- tomato/release/src/router/snmp/include/net-snmp/library/int64.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/include/net-snmp/library/int64.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,27 @@
+#ifndef INT64_INCLUDED
+#define INT64_INCLUDED
+
+#ifdef __cplusplus
+extern          "C" {
+#endif
+
+    typedef struct counter64 U64;
+
+#define I64CHARSZ 21
+
+    void            divBy10(U64, U64 *, unsigned int *);
+    void            multBy10(U64, U64 *);
+    void            incrByU16(U64 *, unsigned int);
+    void            incrByU32(U64 *, unsigned int);
+    void            zeroU64(U64 *);
+    int             isZeroU64(U64 *);
+    void            printU64(char *, U64 *);
+    void            printI64(char *, U64 *);
+    int             read64(U64 *, const char *);
+    void            u64Subtract(U64 * pu64one, U64 * pu64two,
+                                U64 * pu64out);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff -Naur tomato/release/src/router/snmp/include/net-snmp/library/keytools.h tomato121/release/src/router/snmp/include/net-snmp/library/keytools.h
--- tomato/release/src/router/snmp/include/net-snmp/library/keytools.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/include/net-snmp/library/keytools.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,60 @@
+/*
+ * keytools.h
+ */
+
+#ifndef _KEYTOOLS_H
+#define _KEYTOOLS_H
+
+#ifdef __cplusplus
+extern          "C" {
+#endif
+
+
+#define USM_LENGTH_EXPANDED_PASSPHRASE	(1024 * 1024)   /* 1Meg. */
+
+#define USM_LENGTH_KU_HASHBLOCK		64      /* In bytes. */
+
+#define USM_LENGTH_P_MIN		8       /* In characters. */
+    /*
+     * Recommended practice given in <draft-ietf-snmpv3-usm-v2-02.txt>,
+     * * Section 11.2 "Defining Users".  Move into cmdline app argument
+     * * parsing, and out of the internal routine?  XXX
+     */
+
+    /*
+     * Prototypes.h
+     */
+    int             generate_Ku(const oid * hashtype, u_int hashtype_len,
+                                u_char * P, size_t pplen,
+                                u_char * Ku, size_t * kulen);
+
+    int             generate_kul(const oid * hashtype, u_int hashtype_len,
+                                 u_char * engineID, size_t engineID_len,
+                                 u_char * Ku, size_t ku_len,
+                                 u_char * Kul, size_t * kul_len);
+
+    int             encode_keychange(const oid * hashtype,
+                                     u_int hashtype_len, u_char * oldkey,
+                                     size_t oldkey_len, u_char * newkey,
+                                     size_t newkey_len, u_char * kcstring,
+                                     size_t * kcstring_len);
+
+    int             decode_keychange(const oid * hashtype,
+                                     u_int hashtype_len, u_char * oldkey,
+                                     size_t oldkey_len, u_char * kcstring,
+                                     size_t kcstring_len, u_char * newkey,
+                                     size_t * newkey_len);
+
+
+    /*
+     * All functions devolve to the following block if we can't do cryptography
+     */
+#define	_KEYTOOLS_NOT_AVAILABLE			\
+{						\
+	return SNMPERR_KT_NOT_AVAILABLE;	\
+}
+
+#ifdef __cplusplus
+}
+#endif
+#endif                          /* _KEYTOOLS_H */
diff -Naur tomato/release/src/router/snmp/include/net-snmp/library/lcd_time.h tomato121/release/src/router/snmp/include/net-snmp/library/lcd_time.h
--- tomato/release/src/router/snmp/include/net-snmp/library/lcd_time.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/include/net-snmp/library/lcd_time.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,135 @@
+/*
+ * lcd_time.h
+ */
+
+#ifndef _LCD_TIME_H
+#define _LCD_TIME_H
+
+#ifdef __cplusplus
+extern          "C" {
+#endif
+
+
+    /*
+     * undefine to enable time synchronization only on authenticated packets 
+     */
+#define LCD_TIME_SYNC_OPT 1
+
+    /*
+     * Macros and definitions.
+     */
+#define ETIMELIST_SIZE	23
+
+
+
+    typedef struct enginetime_struct {
+        u_char         *engineID;
+        u_int           engineID_len;
+
+        u_int           engineTime;
+        u_int           engineBoot;
+        /*
+         * Time & boots values received from last authenticated
+         * *   message within the previous time window.
+         */
+
+        time_t          lastReceivedEngineTime;
+        /*
+         * Timestamp made when engineTime/engineBoots was last
+         * *   updated.  Measured in seconds.
+         */
+
+#ifdef LCD_TIME_SYNC_OPT
+        u_int           authenticatedFlag;
+#endif
+        struct enginetime_struct *next;
+    } enginetime   , *Enginetime;
+
+
+
+
+    /*
+     * Macros for streamlined engineID existence checks --
+     *
+     *      e       is char *engineID,
+     *      e_l     is u_int engineID_len.
+     *
+     *
+     *  ISENGINEKNOWN(e, e_l)
+     *      Returns:
+     *              TRUE    If engineID is recoreded in the EngineID List;
+     *              FALSE   Otherwise.
+     *
+     *  ENSURE_ENGINE_RECORD(e, e_l)
+     *      Adds the given engineID to the EngineID List if it does not exist
+     *              already.  engineID is added with a <enginetime, engineboots>
+     *              tuple of <0,0>.  ALWAYS succeeds -- except in case of a
+     *              fatal internal error.
+     *      Returns:
+     *              SNMPERR_SUCCESS On success;
+     *              SNMPERR_GENERR  Otherwise.
+     *
+     *  MAKENEW_ENGINE_RECORD(e, e_l)
+     *      Returns:
+     *              SNMPERR_SUCCESS If engineID already exists in the EngineID List;
+     *              SNMPERR_GENERR  Otherwise -and- invokes ENSURE_ENGINE_RECORD()
+     *                                      to add an entry to the EngineID List.
+     *
+     * XXX  Requres the following declaration in modules calling ISENGINEKNOWN():
+     *      static u_int    dummy_etime, dummy_eboot;
+     */
+#define ISENGINEKNOWN(e, e_l)					\
+	( (get_enginetime(e, e_l,				\
+		&dummy_eboot, &dummy_etime, TRUE) == SNMPERR_SUCCESS)	\
+		? TRUE						\
+		: FALSE )
+
+#define ENSURE_ENGINE_RECORD(e, e_l)				\
+	( (set_enginetime(e, e_l, 0, 0, FALSE) == SNMPERR_SUCCESS)	\
+		? SNMPERR_SUCCESS				\
+		: SNMPERR_GENERR )
+
+#define MAKENEW_ENGINE_RECORD(e, e_l)				\
+	( (ISENGINEKNOWN(e, e_l) == TRUE)			\
+		? SNMPERR_SUCCESS				\
+		: (ENSURE_ENGINE_RECORD(e, e_l), SNMPERR_GENERR) )
+
+
+
+    /*
+     * Prototypes.
+     */
+    int             get_enginetime(u_char * engineID, u_int engineID_len,
+                                   u_int * engine_boot,
+                                   u_int * engine_time,
+                                   u_int authenticated);
+
+    int             get_enginetime_ex(u_char * engineID,
+                                      u_int engineID_len,
+                                      u_int * engine_boot,
+                                      u_int * engine_time,
+                                      u_int * last_engine_time,
+                                      u_int authenticated);
+
+    int             set_enginetime(u_char * engineID, u_int engineID_len,
+                                   u_int engine_boot, u_int engine_time,
+                                   u_int authenticated);
+
+         
+         
+         
+         
+         
+         
+        Enginetime
+        search_enginetime_list(u_char * engineID, u_int engineID_len);
+
+    int             hash_engineID(u_char * engineID, u_int engineID_len);
+
+    void            dump_etimelist_entry(Enginetime e, int count);
+    void            dump_etimelist(void);
+
+#ifdef __cplusplus
+}
+#endif
+#endif                          /* _LCD_TIME_H */
diff -Naur tomato/release/src/router/snmp/include/net-snmp/library/libsnmp.h tomato121/release/src/router/snmp/include/net-snmp/library/libsnmp.h
--- tomato/release/src/router/snmp/include/net-snmp/library/libsnmp.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/include/net-snmp/library/libsnmp.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,180 @@
+#ifndef _LIBSNMP_H_
+#define _LIBSNMP_H_
+
+#ifdef __cplusplus
+extern          "C" {
+#endif
+
+    /*
+     * Definitions for the Simple Network Management Protocol (RFC 1067).
+     *
+     */
+/**********************************************************************
+ *
+ *           Copyright 1998 by Carnegie Mellon University
+ * 
+ *                       All Rights Reserved
+ * 
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation for any purpose and without fee is hereby granted,
+ * provided that the above copyright notice appear in all copies and that
+ * both that copyright notice and this permission notice appear in
+ * supporting documentation, and that the name of CMU not be
+ * used in advertising or publicity pertaining to distribution of the
+ * software without specific, written prior permission.
+ * 
+ * CMU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+ * CMU BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+ * SOFTWARE.
+ * 
+ * $Id: libsnmp.h,v 1.1.2.1 2004/06/20 21:54:38 nikki Exp $
+ * 
+ **********************************************************************/
+
+#include <ucd-snmp/ucd-snmp-config.h>
+
+#if HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#if HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#if HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+#include <sys/types.h>
+#if HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+#if TIME_WITH_SYS_TIME
+# ifdef WIN32
+#  include <sys/timeb.h>
+# else
+#  include <sys/time.h>
+# endif
+# include <time.h>
+#else
+# if HAVE_SYS_TIME_H
+#  include <sys/time.h>
+# else
+#  include <time.h>
+# endif
+#endif
+#if HAVE_SYS_SELECT_H
+#include <sys/select.h>
+#endif
+#include <stdio.h>
+#include <ctype.h>
+#if HAVE_WINSOCK_H
+#include <winsock.h>
+#else
+#include <netdb.h>
+#endif
+#if HAVE_ARPA_INET_H
+#include <arpa/inet.h>
+#endif
+
+#ifdef UCD_SNMP_LIBRARY
+
+#define snmp_parse cmu_snmp_parse
+
+#include <ucd-snmp/asn1.h>
+#include <ucd-snmp/snmp_api.h>
+#include <ucd-snmp/snmp_impl.h>
+#include <ucd-snmp/snmp_client.h>
+#include <ucd-snmp/mib.h>
+#include <ucd-snmp/parse.h>
+#include <ucd-snmp/snmp.h>
+#include <ucd-snmp/system.h>
+#include <ucd-snmp/int64.h>
+#include <ucd-snmp/version.h>
+
+#define Version version         /* netsnmp_session member */
+
+#define SMI_NOSUCHOBJECT      SNMP_NOSUCHOBJECT
+#define SMI_NOSUCHINSTANCE    SNMP_NOSUCHINSTANCE
+#define SMI_ENDOFMIBVIEW      SNMP_ENDOFMIBVIEW
+
+
+#else                           /* !UCD_SNMP_LIBRARY */
+
+#include <sys/types.h>
+#ifndef WIN32
+#include <netinet/in.h>
+#endif
+
+#include <snmp/asn1.h>
+#include <snmp/snmp_error.h>
+#include <snmp/mibii.h>
+#include <snmp/snmp_extra.h>
+#include <snmp/snmp_dump.h>
+
+#include <snmp/snmp_session.h>
+
+#include <snmp/snmp_vars.h>
+#include <snmp/snmp_pdu.h>
+#include <snmp/snmp_msg.h>
+
+#include <snmp/snmp_coexist.h>
+#include <snmp/version.h>
+#include <snmp/snmp_api_error.h>
+#include <snmp/mini-client.h>
+
+#include <snmp/snmp_impl.h>
+#include <snmp/snmp_api.h>
+#include <snmp/snmp_client.h>
+#include <snmp/snmp-internal.h>
+#include <snmp/mib.h>
+#include <snmp/parse.h>
+#include <snmp/snmp_compat.h>
+
+    /*
+     * Load UC-Davis differential 
+     */
+
+#define SNMP_MSG_GET GET_REQ_MSG
+#define SNMP_MSG_GETNEXT GETNEXT_REQ_MSG
+#define SNMP_MSG_RESPONSE GET_RSP_MSG
+#define SNMP_MSG_SET SET_REQ_MSG
+#define SNMP_MSG_TRAP TRP_REQ_MSG
+#define SNMP_MSG_GETBULK    (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x5)
+#define SNMP_MSG_INFORM     (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x6)
+#define SNMP_MSG_TRAP2      (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x7)
+#define SNMP_MSG_REPORT     (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x8)
+#define SNMP_NOSUCHOBJECT    SMI_NOSUCHOBJECT
+#define SNMP_NOSUCHINSTANCE  SMI_NOSUCHINSTANCE
+#define SNMP_ENDOFMIBVIEW    SMI_ENDOFMIBVIEW
+
+#define ASN_IPADDRESS   (ASN_APPLICATION | 0)
+#define ASN_UNSIGNED    (ASN_APPLICATION | 2)   /* RFC 1902 - same as GAUGE */
+#define ASN_TIMETICKS   (ASN_APPLICATION | 3)
+
+#define snmp_perror(X) perror(X)
+#define snmp_set_dump_packet(X)
+#define snmp_set_quick_print(X)
+#define snmp_set_do_debugging(X)
+#define snmp_set_full_objid(X)
+#define snmp_set_suffix_only(X)
+
+#define VersionInfo snmp_Version
+#define get_node read_objid
+#define version Version         /* netsnmp_session member */
+
+#define SNMP_VERSION_2c SNMP_VERSION_2
+#define SNMP_VERSION_2p 129
+
+#define SOCK_STARTUP winsock_startup()
+#define SOCK_CLEANUP winsock_cleanup()
+
+#endif                          /* !UCD_SNMP_LIBRARY */
+
+#ifdef __cplusplus
+}
+#endif
+#endif                          /* _LIBSNMP_H_ */
diff -Naur tomato/release/src/router/snmp/include/net-snmp/library/md5.h tomato121/release/src/router/snmp/include/net-snmp/library/md5.h
--- tomato/release/src/router/snmp/include/net-snmp/library/md5.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/include/net-snmp/library/md5.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,71 @@
+/*
+ * ** **************************************************************************
+ * ** md5.h -- Header file for implementation of MD5 Message Digest Algorithm **
+ * ** Updated: 2/13/90 by Ronald L. Rivest                                    **
+ * ** (C) 1990 RSA Data Security, Inc.                                        **
+ * ** **************************************************************************
+ */
+
+#ifndef MD5_H
+#define MD5_H
+
+#ifdef __cplusplus
+extern          "C" {
+#endif
+
+
+    /*
+     * MDstruct is the data structure for a message digest computation.
+     */
+    typedef struct {
+        unsigned int    buffer[4];      /* Holds 4-word result of MD computation */
+        unsigned char   count[8];       /* Number of bits processed so far */
+        unsigned int    done;   /* Nonzero means MD computation finished */
+    } MDstruct     , *MDptr;
+
+    /*
+     * MDbegin(MD)
+     * ** Input: MD -- an MDptr
+     * ** Initialize the MDstruct prepatory to doing a message digest computation.
+     */
+    extern void     MDbegin(MDptr);
+
+    /*
+     * MDupdate(MD,X,count)
+     * ** Input: MD -- an MDptr
+     * **        X -- a pointer to an array of unsigned characters.
+     * **        count -- the number of bits of X to use (an unsigned int).
+     * ** Updates MD using the first ``count'' bits of X.
+     * ** The array pointed to by X is not modified.
+     * ** If count is not a multiple of 8, MDupdate uses high bits of last byte.
+     * ** This is the basic input routine for a user.
+     * ** The routine terminates the MD computation when count < 512, so
+     * ** every MD computation should end with one call to MDupdate with a
+     * ** count less than 512.  Zero is OK for a count.
+     */
+    extern int      MDupdate(MDptr, unsigned char *, unsigned int);
+
+    /*
+     * MDprint(MD)
+     * ** Input: MD -- an MDptr
+     * ** Prints message digest buffer MD as 32 hexadecimal digits.
+     * ** Order is from low-order byte of buffer[0] to high-order byte of buffer[3].
+     * ** Each byte is printed with high-order hexadecimal digit first.
+     */
+    extern void     MDprint(MDptr);
+
+    int             MDchecksum(u_char * data, size_t len, u_char * mac,
+                               size_t maclen);
+    int             MDsign(u_char * data, size_t len, u_char * mac,
+                           size_t maclen, u_char * secret,
+                           size_t secretlen);
+    void            MDget(MDstruct * MD, u_char * buf, size_t buflen);
+
+    /*
+     * ** End of md5.h
+     * ****************************(cut)****************************************
+     */
+#ifdef __cplusplus
+}
+#endif
+#endif                          /* MD5_H */
diff -Naur tomato/release/src/router/snmp/include/net-snmp/library/mib.h tomato121/release/src/router/snmp/include/net-snmp/library/mib.h
--- tomato/release/src/router/snmp/include/net-snmp/library/mib.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/include/net-snmp/library/mib.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,510 @@
+#ifndef MIB_H
+#define MIB_H
+
+#ifdef __cplusplus
+extern          "C" {
+#endif
+    /*
+     * mib.h - Definitions for the variables as defined in the MIB
+     *
+     * Update: 1998-07-17 <jhy@gsu.edu>
+     * Added prototypes for print_oid_report* functions.
+     */
+/***********************************************************
+	Copyright 1988, 1989 by Carnegie Mellon University
+
+                      All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its 
+documentation for any purpose and without fee is hereby granted, 
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in 
+supporting documentation, and that the name of CMU not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.  
+
+CMU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+CMU BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+******************************************************************/
+
+#include <stdio.h>              /* for FILE */
+
+#define MIB 1, 3, 6, 1, 2, 1
+
+#define MIB_IFTYPE_OTHER		    1
+#define MIB_IFTYPE_REGULAR1822		    2
+#define MIB_IFTYPE_HDH1822		    3
+#define MIB_IFTYPE_DDNX25		    4
+#define MIB_IFTYPE_RFC877X25		    5
+#define MIB_IFTYPE_ETHERNETCSMACD	    6
+#define MIB_IFTYPE_ISO88023CSMACD	    7
+#define MIB_IFTYPE_ISO88024TOKENBUS	    8
+#define MIB_IFTYPE_ISO88025TOKENRING	    9
+#define MIB_IFTYPE_ISO88026MAN		    10
+#define MIB_IFTYPE_STARLAN		    11
+#define MIB_IFTYPE_PROTEON10MBIT	    12
+#define MIB_IFTYPE_PROTEON80MBIT	    13
+#define MIB_IFTYPE_HYPERCHANNEL		    14
+#define MIB_IFTYPE_FDDI			    15
+#define MIB_IFTYPE_LAPB			    16
+#define MIB_IFTYPE_SDLC			    17
+#define MIB_IFTYPE_T1CARRIER		    18
+#define MIB_IFTYPE_CEPT			    19
+#define MIB_IFTYPE_BASICISDN		    20
+#define MIB_IFTYPE_PRIMARYISDN		    21
+#define MIB_IFTYPE_PROPPOINTTOPOINTSERIAL   22
+
+#define MIB_IFSTATUS_UP		1
+#define MIB_IFSTATUS_DOWN	2
+#define MIB_IFSTATUS_TESTING	3
+
+#define MIB_FORWARD_GATEWAY	1
+#define MIB_FORWARD_HOST	2
+
+#define MIB_IPROUTETYPE_OTHER	1
+#define MIB_IPROUTETYPE_INVALID	2
+#define MIB_IPROUTETYPE_DIRECT	3
+#define MIB_IPROUTETYPE_REMOTE	4
+
+#define MIB_IPROUTEPROTO_OTHER	    1
+#define MIB_IPROUTEPROTO_LOCAL	    2
+#define MIB_IPROUTEPROTO_NETMGMT    3
+#define MIB_IPROUTEPROTO_ICMP	    4
+#define MIB_IPROUTEPROTO_EGP	    5
+#define MIB_IPROUTEPROTO_GGP	    6
+#define MIB_IPROUTEPROTO_HELLO	    7
+#define MIB_IPROUTEPROTO_RIP	    8
+#define MIB_IPROUTEPROTO_ISIS	    9
+#define MIB_IPROUTEPROTO_ESIS	    10
+#define MIB_IPROUTEPROTO_CISCOIGRP  11
+#define MIB_IPROUTEPROTO_BBNSPFIGP  12
+#define MIB_IPROUTEPROTO_OIGP	    13
+
+#define MIB_TCPRTOALG_OTHER	1
+#define MIB_TCPRTOALG_CONSTANT	2
+#define MIB_TCPRTOALG_RSRE	3
+#define MIB_TCPRTOALG_VANJ	4
+
+#define MIB_TCPCONNSTATE_CLOSED		1
+#define MIB_TCPCONNSTATE_LISTEN		2
+#define MIB_TCPCONNSTATE_SYNSENT	3
+#define MIB_TCPCONNSTATE_SYNRECEIVED	4
+#define MIB_TCPCONNSTATE_ESTABLISHED	5
+#define MIB_TCPCONNSTATE_FINWAIT1	6
+#define MIB_TCPCONNSTATE_FINWAIT2	7
+#define MIB_TCPCONNSTATE_CLOSEWAIT	8
+#define MIB_TCPCONNSTATE_LASTACK	9
+#define MIB_TCPCONNSTATE_CLOSING	10
+#define MIB_TCPCONNSTATE_TIMEWAIT	11
+
+#define MIB_EGPNEIGHSTATE_IDLE		1
+#define MIB_EGPNEIGHSTATE_AQUISITION	2
+#define MIB_EGPNEIGHSTATE_DOWN		3
+#define MIB_EGPNEIGHSTATE_UP		4
+#define MIB_EGPNEIGHSTATE_CEASE		5
+
+    struct variable_list;
+    struct enum_list;
+
+    void            print_mib(FILE * fp);
+    void            print_ascii_dump(FILE *);
+    int             read_objid(const char *, oid *, size_t *);
+    void            register_mib_handlers(void);
+    void            netsnmp_set_mib_directory(const char *dir);
+    char            *netsnmp_get_mib_directory(void);
+    void            netsnmp_fixup_mib_directory(void);
+    void            init_mib(void);
+    void            shutdown_mib(void);
+    void            print_description(oid *, size_t, int);
+    void            fprint_description(FILE *, oid *, size_t, int);
+    int             get_module_node(const char *, const char *, oid *,
+                                    size_t *);
+    int             get_wild_node(const char *, oid *, size_t *);
+    int             get_node(const char *, oid *, size_t *);
+    oid            *snmp_parse_oid(const char *, oid *, size_t *);
+    struct tree    *get_symbol(oid *, size_t, struct tree *, char *);
+    struct tree    *get_tree(const oid *, size_t, struct tree *);
+    struct tree    *get_tree_head(void);
+    void            set_function(struct tree *);
+
+    int             parse_one_oid_index(oid ** oidStart, size_t * oidLen,
+                                        netsnmp_variable_list * data,
+                                        int complete);
+    int             parse_oid_indexes(oid * oidIndex, size_t oidLen,
+                                      netsnmp_variable_list * data);
+    int             build_oid_noalloc(oid * in, size_t in_len,
+                                      size_t * out_len, oid * prefix,
+                                      size_t prefix_len,
+                                      netsnmp_variable_list * indexes);
+    int             build_oid(oid ** out, size_t * out_len, oid * prefix,
+                              size_t prefix_len,
+                              netsnmp_variable_list * indexes);
+    int             build_oid_segment(netsnmp_variable_list * var);
+
+
+    void            print_variable(const oid * objid, size_t objidlen,
+                                   const netsnmp_variable_list * variable);
+
+    void            fprint_variable(FILE * fp,
+                                    const oid * objid, size_t objidlen,
+                                    const netsnmp_variable_list * variable);
+
+    int             snprint_variable(char *buf, size_t buf_len,
+                                     const oid * objid, size_t objidlen,
+                                     const netsnmp_variable_list * variable);
+
+    int             sprint_realloc_variable(u_char ** buf,
+                                            size_t * buf_len,
+                                            size_t * out_len,
+                                            int allow_realloc,
+                                            const oid * objid,
+                                            size_t objidlen,
+                                            const netsnmp_variable_list *
+                                            variable);
+
+    struct tree    *netsnmp_sprint_realloc_objid_tree(u_char ** buf,
+                                                      size_t * buf_len,
+                                                      size_t * out_len,
+                                                      int allow_realloc,
+                                                      int *buf_overflow,
+                                                      const oid * objid,
+                                                      size_t objidlen);
+
+    void            print_value(const oid * objid, size_t objidlen,
+                                const netsnmp_variable_list * variable);
+
+    void            fprint_value(FILE * fp,
+                                 const oid * objid, size_t objidlen,
+                                 const netsnmp_variable_list * variable);
+
+    int             snprint_value(char *buf, size_t buf_len,
+                                  const oid * objid, size_t objidlen,
+                                  const netsnmp_variable_list * variable);
+
+    int             sprint_realloc_value(u_char ** buf, size_t * buf_len,
+                                         size_t * out_len,
+                                         int allow_realloc,
+                                         const oid * objid,
+                                         size_t objidlen,
+                                         const netsnmp_variable_list * variable);
+
+
+    void            print_objid(const oid * objid, size_t objidlen);
+
+    void            fprint_objid(FILE * fp,
+                                 const oid * objid, size_t objidlen);
+
+    int             snprint_objid(char *buf, size_t buf_len,
+                                  const oid * objid, size_t objidlen);
+
+    int             sprint_realloc_objid(u_char ** buf, size_t * buf_len,
+                                         size_t * out_len,
+                                         int allow_realloc,
+                                         const oid * objid,
+                                         size_t objidlen);
+
+
+    int             sprint_realloc_by_type(u_char ** buf, size_t * buf_len,
+                                           size_t * out_len,
+                                           int allow_realloc,
+                                           const netsnmp_variable_list * var,
+                                           const struct enum_list *enums,
+                                           const char *hint,
+                                           const char *units);
+
+    int             sprint_realloc_hexstring(u_char ** buf,
+                                             size_t * buf_len,
+                                             size_t * out_len,
+                                             int allow_realloc,
+                                             const u_char *, size_t);
+
+    int             sprint_realloc_asciistring(u_char ** buf,
+                                               size_t * buf_len,
+                                               size_t * out_len,
+                                               int allow_realloc,
+                                               const u_char * cp,
+                                               size_t len);
+
+    int             sprint_realloc_octet_string(u_char ** buf,
+                                                size_t * buf_len,
+                                                size_t * out_len,
+                                                int allow_realloc,
+                                                const netsnmp_variable_list *,
+                                                const struct enum_list *,
+                                                const char *,
+                                                const char *);
+
+    int             sprint_realloc_opaque(u_char ** buf, size_t * buf_len,
+                                          size_t * out_len,
+                                          int allow_realloc,
+                                          const netsnmp_variable_list *,
+                                          const struct enum_list *, const char *,
+                                          const char *);
+
+    int             sprint_realloc_object_identifier(u_char ** buf,
+                                                     size_t * buf_len,
+                                                     size_t * out_len,
+                                                     int allow_realloc,
+                                                     const netsnmp_variable_list
+                                                     *, const struct enum_list *,
+                                                     const char *,
+                                                     const char *);
+
+    int             sprint_realloc_timeticks(u_char ** buf,
+                                             size_t * buf_len,
+                                             size_t * out_len,
+                                             int allow_realloc,
+                                             const netsnmp_variable_list *,
+                                             const struct enum_list *,
+                                             const char *, const char *);
+
+    int             sprint_realloc_hinted_integer(u_char ** buf,
+                                                  size_t * buf_len,
+                                                  size_t * out_len,
+                                                  int allow_realloc, long,
+                                                  const char, const char *,
+                                                  const char *);
+
+    int             sprint_realloc_integer(u_char ** buf, size_t * buf_len,
+                                           size_t * out_len,
+                                           int allow_realloc,
+                                           const netsnmp_variable_list *,
+                                           const struct enum_list *,
+                                           const char *, const char *);
+
+    int             sprint_realloc_uinteger(u_char ** buf,
+                                            size_t * buf_len,
+                                            size_t * out_len,
+                                            int allow_realloc,
+                                            const netsnmp_variable_list *,
+                                            const struct enum_list *,
+                                            const char *, const char *);
+
+    int             sprint_realloc_gauge(u_char ** buf, size_t * buf_len,
+                                         size_t * out_len,
+                                         int allow_realloc,
+                                         const netsnmp_variable_list *,
+                                         const struct enum_list *, const char *,
+                                         const char *);
+
+    int             sprint_realloc_counter(u_char ** buf, size_t * buf_len,
+                                           size_t * out_len,
+                                           int allow_realloc,
+                                           const netsnmp_variable_list *,
+                                           const struct enum_list *,
+                                           const char *, const char *);
+
+    int             sprint_realloc_networkaddress(u_char ** buf,
+                                                  size_t * buf_len,
+                                                  size_t * out_len,
+                                                  int allow_realloc,
+                                                  const netsnmp_variable_list *,
+                                                  const struct enum_list *,
+                                                  const char *,
+                                                  const char *);
+
+    int             sprint_realloc_ipaddress(u_char ** buf,
+                                             size_t * buf_len,
+                                             size_t * out_len,
+                                             int allow_realloc,
+                                             const netsnmp_variable_list *,
+                                             const struct enum_list *,
+                                             const char *, const char *);
+
+    int             sprint_realloc_null(u_char ** buf, size_t * buf_len,
+                                        size_t * out_len,
+                                        int allow_realloc,
+                                        const netsnmp_variable_list *,
+                                        const struct enum_list *, const char *,
+                                        const char *);
+
+    int             sprint_realloc_bitstring(u_char ** buf,
+                                             size_t * buf_len,
+                                             size_t * out_len,
+                                             int allow_realloc,
+                                             const netsnmp_variable_list *,
+                                             const struct enum_list *,
+                                             const char *, const char *);
+
+    int             sprint_realloc_nsapaddress(u_char ** buf,
+                                               size_t * buf_len,
+                                               size_t * out_len,
+                                               int allow_realloc,
+                                               const netsnmp_variable_list *,
+                                               const struct enum_list *,
+                                               const char *, const char *);
+
+    int             sprint_realloc_counter64(u_char ** buf,
+                                             size_t * buf_len,
+                                             size_t * out_len,
+                                             int allow_realloc,
+                                             const netsnmp_variable_list *,
+                                             const struct enum_list *,
+                                             const char *, const char *);
+
+    int             sprint_realloc_badtype(u_char ** buf, size_t * buf_len,
+                                           size_t * out_len,
+                                           int allow_realloc,
+                                           const netsnmp_variable_list *,
+                                           const struct enum_list *,
+                                           const char *, const char *);
+
+#ifdef OPAQUE_SPECIAL_TYPES
+    int             sprint_realloc_float(u_char ** buf, size_t * buf_len,
+                                         size_t * out_len,
+                                         int allow_realloc,
+                                         const netsnmp_variable_list *,
+                                         const struct enum_list *, const char *,
+                                         const char *);
+
+    int             sprint_realloc_double(u_char ** buf, size_t * buf_len,
+                                          size_t * out_len,
+                                          int allow_realloc,
+                                          const netsnmp_variable_list *,
+                                          const struct enum_list *, const char *,
+                                          const char *);
+#endif
+
+
+    int             snprint_by_type(char *buf, size_t buf_len,
+                                    netsnmp_variable_list * var,
+                                    const struct enum_list *enums,
+                                    const char *hint, const char *units);
+
+    int             snprint_hexstring(char *buf, size_t buf_len,
+                                      const u_char *, size_t);
+
+    int             snprint_asciistring(char *buf, size_t buf_len,
+                                        const u_char * cp, size_t len);
+
+    int             snprint_octet_string(char *buf, size_t buf_len,
+                                         const netsnmp_variable_list *,
+                                         const struct enum_list *, const char *,
+                                         const char *);
+
+    int             snprint_opaque(char *buf, size_t buf_len,
+                                   const netsnmp_variable_list *,
+                                   const struct enum_list *, const char *,
+                                   const char *);
+
+    int             snprint_object_identifier(char *buf, size_t buf_len,
+                                              const netsnmp_variable_list *,
+                                              const struct enum_list *,
+                                              const char *, const char *);
+
+    int             snprint_timeticks(char *buf, size_t buf_len,
+                                      const netsnmp_variable_list *,
+                                      const struct enum_list *, const char *,
+                                      const char *);
+
+    int             snprint_hinted_integer(char *buf, size_t buf_len,
+                                           long, const char *,
+                                           const char *);
+
+    int             snprint_integer(char *buf, size_t buf_len,
+                                    const netsnmp_variable_list *,
+                                    const struct enum_list *, const char *,
+                                    const char *);
+
+    int             snprint_uinteger(char *buf, size_t buf_len,
+                                     const netsnmp_variable_list *,
+                                     const struct enum_list *, const char *,
+                                     const char *);
+
+    int             snprint_gauge(char *buf, size_t buf_len,
+                                  const netsnmp_variable_list *,
+                                  const struct enum_list *, const char *,
+                                  const char *);
+
+    int             snprint_counter(char *buf, size_t buf_len,
+                                    const netsnmp_variable_list *,
+                                    const struct enum_list *, const char *,
+                                    const char *);
+
+    int             snprint_networkaddress(char *buf, size_t buf_len,
+                                           const netsnmp_variable_list *,
+                                           const struct enum_list *,
+                                           const char *, const char *);
+
+    int             snprint_ipaddress(char *buf, size_t buf_len,
+                                      const netsnmp_variable_list *,
+                                      const struct enum_list *, const char *,
+                                      const char *);
+
+    int             snprint_null(char *buf, size_t buf_len,
+                                 const netsnmp_variable_list *,
+                                 const struct enum_list *, const char *,
+                                 const char *);
+
+    int             snprint_bitstring(char *buf, size_t buf_len,
+                                      const netsnmp_variable_list *,
+                                      const struct enum_list *, const char *,
+                                      const char *);
+
+    int             snprint_nsapaddress(char *buf, size_t buf_len,
+                                        const netsnmp_variable_list *,
+                                        const struct enum_list *, const char *,
+                                        const char *);
+
+    int             snprint_counter64(char *buf, size_t buf_len,
+                                      const netsnmp_variable_list *,
+                                      const struct enum_list *, const char *,
+                                      const char *);
+
+    int             snprint_badtype(char *buf, size_t buf_len,
+                                    const netsnmp_variable_list *,
+                                    const struct enum_list *, const char *,
+                                    const char *);
+
+#ifdef OPAQUE_SPECIAL_TYPES
+    int             snprint_float(char *buf, size_t buf_len,
+                                  const netsnmp_variable_list *,
+                                  const struct enum_list *, const char *,
+                                  const char *);
+
+    int             snprint_double(char *buf, size_t buf_len,
+                                   const netsnmp_variable_list *,
+                                   const struct enum_list *, const char *,
+                                   const char *);
+#endif
+
+    void            print_oid_report(FILE *);
+    void            print_oid_report_enable_labeledoid(void);
+    void            print_oid_report_enable_oid(void);
+    void            print_oid_report_enable_suffix(void);
+    void            print_oid_report_enable_symbolic(void);
+
+    const char     *parse_octet_hint(const char *hint, const char *value,
+	                             unsigned char **new_val, int *new_val_len);
+
+    void            clear_tree_flags(register struct tree *tp);
+
+    char           *snmp_out_toggle_options(char *);
+    void            snmp_out_toggle_options_usage(const char *, FILE *);
+    char           *snmp_in_toggle_options(char *);
+    void            snmp_in_toggle_options_usage(const char *, FILE *);
+    u_char          mib_to_asn_type(int mib_type);
+
+
+    int             netsnmp_str2oid(const char *S, oid * O, int L);
+
+
+#define NETSNMP_STRING_OUTPUT_GUESS  1
+#define NETSNMP_STRING_OUTPUT_ASCII  2
+#define NETSNMP_STRING_OUTPUT_HEX    3
+
+#define NETSNMP_OID_OUTPUT_SUFFIX  1
+#define NETSNMP_OID_OUTPUT_MODULE  2
+#define NETSNMP_OID_OUTPUT_FULL    3
+#define NETSNMP_OID_OUTPUT_NUMERIC 4
+#define NETSNMP_OID_OUTPUT_UCD     5
+#define NETSNMP_OID_OUTPUT_NONE    6
+#ifdef __cplusplus
+}
+#endif
+#endif                          /* MIB_H */
diff -Naur tomato/release/src/router/snmp/include/net-snmp/library/mt_support.h tomato121/release/src/router/snmp/include/net-snmp/library/mt_support.h
--- tomato/release/src/router/snmp/include/net-snmp/library/mt_support.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/include/net-snmp/library/mt_support.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,85 @@
+/*
+ * mt_support.h - multi-thread resource locking support declarations 
+ */
+/*
+ * Author: Markku Laukkanen
+ * Created: 6-Sep-1999
+ * History:
+ *  8-Sep-1999 M. Slifcak method names changed;
+ *                        use array of resource locking structures.
+ */
+
+#ifndef MT_SUPPORT_H
+#define MT_SUPPORT_H
+
+#ifdef __cplusplus
+extern          "C" {
+#endif
+  
+/*
+ * Lock group identifiers 
+ */
+
+#define MT_LIBRARY_ID      0
+#define MT_APPLICATION_ID  1
+#define MT_TOKEN_ID        2
+
+#define MT_MAX_IDS         3    /* one greater than last from above */
+#define MT_MAX_SUBIDS      10
+
+
+/*
+ * Lock resource identifiers for library resources 
+ */
+
+#define MT_LIB_NONE        0
+#define MT_LIB_SESSION     1
+#define MT_LIB_REQUESTID   2
+#define MT_LIB_MESSAGEID   3
+#define MT_LIB_SESSIONID   4
+#define MT_LIB_TRANSID     5
+
+#define MT_LIB_MAXIMUM     6    /* must be one greater than the last one */
+
+
+#if defined(NS_REENTRANT) || defined(WIN32)
+
+#if HAVE_PTHREAD_H
+#include <pthread.h>
+typedef pthread_mutex_t mutex_type;
+#ifdef pthread_mutexattr_default
+#define MT_MUTEX_INIT_DEFAULT pthread_mutexattr_default
+#else
+#define MT_MUTEX_INIT_DEFAULT 0
+#endif
+
+#elif defined(WIN32) || defined(cygwin)
+
+#include <windows.h>
+typedef CRITICAL_SECTION mutex_type;
+
+#else  /*  HAVE_PTHREAD_H  */
+error "There is no re-entrant support as defined."
+#endif /*  HAVE_PTHREAD_H  */
+
+
+int             snmp_res_init(void);
+int             snmp_res_lock(int groupID, int resourceID);
+int             snmp_res_unlock(int groupID, int resourceID);
+int             snmp_res_destroy_mutex(int groupID, int resourceID);
+
+#else /*  NS_REENTRANT  */
+
+#ifndef WIN32
+#define snmp_res_init() do {} while (0)
+#define snmp_res_lock(x,y) do {} while (0)
+#define snmp_res_unlock(x,y) do {} while (0)
+#define snmp_res_destroy_mutex(x,y) do {} while (0)
+#endif /*  WIN32  */
+
+#endif /*  NS_REENTRANT  */
+
+#ifdef __cplusplus
+}
+#endif
+#endif /*  MT_SUPPORT_H  */
diff -Naur tomato/release/src/router/snmp/include/net-snmp/library/oid_stash.h tomato121/release/src/router/snmp/include/net-snmp/library/oid_stash.h
--- tomato/release/src/router/snmp/include/net-snmp/library/oid_stash.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/include/net-snmp/library/oid_stash.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,72 @@
+#ifndef OID_STASH_H
+#define OID_STASH_H
+
+/*
+ * designed to store/retrieve information associated with a given oid.
+ * * Storage is done in an efficient manner for fast lookups.
+ */
+
+#define OID_STASH_CHILDREN_SIZE 31
+
+#ifdef __cplusplus
+extern          "C" {
+#endif
+
+    struct netsnmp_oid_stash_node_s;
+
+    /* args: buffer, sizeof(buffer), yourdata, stashnode */
+    typedef int     (NetSNMPStashDump) (char *, size_t,
+                                        void *,
+                                        struct netsnmp_oid_stash_node_s *);
+    typedef void    (NetSNMPStashFreeNode) (void *);
+
+    typedef struct netsnmp_oid_stash_node_s {
+        oid             value;
+        struct netsnmp_oid_stash_node_s **children;     /* array of children */
+        size_t          children_size;
+        struct netsnmp_oid_stash_node_s *next_sibling;  /* cache too small links */
+        struct netsnmp_oid_stash_node_s *prev_sibling;
+        /*
+         * struct netsnmp_oid_stash_node_s *parent; 
+         *
+         * XXX? 
+         */
+
+        void           *thedata;
+    } netsnmp_oid_stash_node;
+
+    typedef struct netsnmp_oid_stash_save_info_s {
+       const char *token;
+       netsnmp_oid_stash_node **root;
+       NetSNMPStashDump *dumpfn;
+    } netsnmp_oid_stash_save_info;
+
+    int             netsnmp_oid_stash_add_data(netsnmp_oid_stash_node
+                                               **root, oid * lookup,
+                                               size_t lookup_len,
+                                               void *mydata);
+    SNMPCallback netsnmp_oid_stash_store_all;
+
+
+    netsnmp_oid_stash_node
+        *netsnmp_oid_stash_get_node(netsnmp_oid_stash_node *root,
+                                    oid * lookup, size_t lookup_len);
+    void           *netsnmp_oid_stash_get_data(netsnmp_oid_stash_node
+                                               *root, oid * lookup,
+                                               size_t lookup_len);
+
+    netsnmp_oid_stash_node *netsnmp_oid_stash_create_sized_node(size_t
+                                                                mysize);
+    netsnmp_oid_stash_node *netsnmp_oid_stash_create_node(void);        /* returns a malloced node */
+
+    void netsnmp_oid_stash_store(netsnmp_oid_stash_node *root,
+                                 const char *tokenname, NetSNMPStashDump *dumpfn,
+                                 oid *curoid, size_t curoid_len);
+
+/* a noop function that can be passed to netsnmp_oid_stash_node to NOT free the data */
+void netsnmp_oid_stash_no_free(void *bogus);
+
+#ifdef __cplusplus
+}
+#endif
+#endif                          /* OID_STASH_H */
diff -Naur tomato/release/src/router/snmp/include/net-snmp/library/parse.h tomato121/release/src/router/snmp/include/net-snmp/library/parse.h
--- tomato/release/src/router/snmp/include/net-snmp/library/parse.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/include/net-snmp/library/parse.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,246 @@
+#ifndef PARSE_H
+#define PARSE_H
+
+#ifdef __cplusplus
+extern          "C" {
+#endif
+    /*
+     * parse.h
+     */
+/***********************************************************
+        Copyright 1989 by Carnegie Mellon University
+
+                      All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of CMU not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+CMU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+CMU BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+******************************************************************/
+
+#define MAXLABEL        64      /* maximum characters in a label */
+#define MAXTOKEN        128     /* maximum characters in a token */
+#define MAXQUOTESTR     4096    /* maximum characters in a quoted string */
+
+    struct variable_list;
+
+    /*
+     * A linked list of tag-value pairs for enumerated integers.
+     */
+    struct enum_list {
+        struct enum_list *next;
+        int             value;
+        char           *label;
+    };
+
+    /*
+     * A linked list of ranges
+     */
+    struct range_list {
+        struct range_list *next;
+        int             low, high;
+    };
+
+    /*
+     * A linked list of indexes
+     */
+    struct index_list {
+        struct index_list *next;
+        char           *ilabel;
+        char            isimplied;
+    };
+
+    /*
+     * A linked list of varbinds
+     */
+    struct varbind_list {
+        struct varbind_list *next;
+        char           *vblabel;
+    };
+
+    /*
+     * A linked list of nodes.
+     */
+    struct node {
+        struct node    *next;
+        char           *label;  /* This node's (unique) textual name */
+        u_long          subid;  /* This node's integer subidentifier */
+        int             modid;  /* The module containing this node */
+        char           *parent; /* The parent's textual name */
+        int             tc_index;       /* index into tclist (-1 if NA) */
+        int             type;   /* The type of object this represents */
+        int             access;
+        int             status;
+        struct enum_list *enums;        /* (optional) list of enumerated integers */
+        struct range_list *ranges;
+        struct index_list *indexes;
+        char           *augments;
+        struct varbind_list *varbinds;
+        char           *hint;
+        char           *units;
+        char           *description;    /* description (a quoted string) */
+        char           *defaultValue;
+	char           *filename;
+        int             lineno;
+    };
+
+    /*
+     * A tree in the format of the tree structure of the MIB.
+     */
+    struct tree {
+        struct tree    *child_list;     /* list of children of this node */
+        struct tree    *next_peer;      /* Next node in list of peers */
+        struct tree    *next;   /* Next node in hashed list of names */
+        struct tree    *parent;
+        char           *label;  /* This node's textual name */
+        u_long          subid;  /* This node's integer subidentifier */
+        int             modid;  /* The module containing this node */
+        int             number_modules;
+        int            *module_list;    /* To handle multiple modules */
+        int             tc_index;       /* index into tclist (-1 if NA) */
+        int             type;   /* This node's object type */
+        int             access; /* This nodes access */
+        int             status; /* This nodes status */
+        struct enum_list *enums;        /* (optional) list of enumerated integers */
+        struct range_list *ranges;
+        struct index_list *indexes;
+        char           *augments;
+        struct varbind_list *varbinds;
+        char           *hint;
+        char           *units;
+        int             (*printomat) (u_char **, size_t *, size_t *, int,
+                                      const netsnmp_variable_list *,
+                                      const struct enum_list *, const char *,
+                                      const char *);
+        void            (*printer) (char *, const netsnmp_variable_list *, const struct enum_list *, const char *, const char *);   /* Value printing function */
+        char           *description;    /* description (a quoted string) */
+        int             reported;       /* 1=report started in print_subtree... */
+        char           *defaultValue;
+    };
+
+    /*
+     * Information held about each MIB module
+     */
+    struct module_import {
+        char           *label;  /* The descriptor being imported */
+        int             modid;  /* The module imported from */
+    };
+
+    struct module {
+        char           *name;   /* This module's name */
+        char           *file;   /* The file containing the module */
+        struct module_import *imports;  /* List of descriptors being imported */
+        int             no_imports;     /* The number of such import descriptors */
+        /*
+         * -1 implies the module hasn't been read in yet 
+         */
+        int             modid;  /* The index number of this module */
+        struct module  *next;   /* Linked list pointer */
+    };
+
+    struct module_compatability {
+        const char     *old_module;
+        const char     *new_module;
+        const char     *tag;    /* NULL implies unconditional replacement,
+                                 * otherwise node identifier or prefix */
+        size_t          tag_len;        /* 0 implies exact match (or unconditional) */
+        struct module_compatability *next;      /* linked list */
+    };
+
+
+    /*
+     * non-aggregate types for tree end nodes 
+     */
+#define TYPE_OTHER          0
+#define TYPE_OBJID          1
+#define TYPE_OCTETSTR       2
+#define TYPE_INTEGER        3
+#define TYPE_NETADDR        4
+#define TYPE_IPADDR         5
+#define TYPE_COUNTER        6
+#define TYPE_GAUGE          7
+#define TYPE_TIMETICKS      8
+#define TYPE_OPAQUE         9
+#define TYPE_NULL           10
+#define TYPE_COUNTER64      11
+#define TYPE_BITSTRING      12
+#define TYPE_NSAPADDRESS    13
+#define TYPE_UINTEGER       14
+#define TYPE_UNSIGNED32     15
+#define TYPE_INTEGER32      16
+
+#define TYPE_SIMPLE_LAST    16
+
+#define TYPE_TRAPTYPE	    20
+#define TYPE_NOTIFTYPE      21
+#define TYPE_OBJGROUP	    22
+#define TYPE_NOTIFGROUP	    23
+#define TYPE_MODID	    24
+#define TYPE_AGENTCAP       25
+#define TYPE_MODCOMP        26
+
+#define MIB_ACCESS_READONLY    18
+#define MIB_ACCESS_READWRITE   19
+#define	MIB_ACCESS_WRITEONLY   20
+#define MIB_ACCESS_NOACCESS    21
+#define MIB_ACCESS_NOTIFY      67
+#define MIB_ACCESS_CREATE      48
+
+#define MIB_STATUS_MANDATORY   23
+#define MIB_STATUS_OPTIONAL    24
+#define MIB_STATUS_OBSOLETE    25
+#define MIB_STATUS_DEPRECATED  39
+#define MIB_STATUS_CURRENT     57
+
+#define	ANON	"anonymous#"
+#define	ANON_LEN  strlen(ANON)
+
+    struct tree    *read_module(const char *);
+    struct tree    *read_mib(const char *);
+    struct tree    *read_all_mibs(void);
+    int             unload_module(const char *name);
+    void            unload_all_mibs(void);
+    void            init_mib_internals(void);
+    int             add_mibdir(const char *);
+    void            add_module_replacement(const char *, const char *,
+                                           const char *, int);
+    int             which_module(const char *);
+    char           *module_name(int, char *);
+    void            print_subtree(FILE *, struct tree *, int);
+    void            print_ascii_dump_tree(FILE *, struct tree *, int);
+    struct tree    *find_tree_node(const char *, int);
+    const char     *get_tc_descriptor(int);
+    struct tree    *find_best_tree_node(const char *, struct tree *,
+                                        u_int *);
+    /*
+     * backwards compatability 
+     */
+    struct tree    *find_node(const char *, struct tree *);
+    struct module  *find_module(int);
+    void            adopt_orphans(void);
+    char           *snmp_mib_toggle_options(char *options);
+    void            snmp_mib_toggle_options_usage(const char *lead,
+                                                  FILE * outf);
+    void            print_mib(FILE *);
+    void            print_mib_tree(FILE *, struct tree *, int);
+    int             get_mib_parse_error_count(void);
+    int             snmp_get_token(FILE * fp, char *token, int maxtlen);
+    struct tree    *find_best_tree_node(const char *name,
+                                        struct tree *tree_top,
+                                        u_int * match);
+
+#ifdef __cplusplus
+}
+#endif
+#endif                          /* PARSE_H */
diff -Naur tomato/release/src/router/snmp/include/net-snmp/library/read_config.h tomato121/release/src/router/snmp/include/net-snmp/library/read_config.h
--- tomato/release/src/router/snmp/include/net-snmp/library/read_config.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/include/net-snmp/library/read_config.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,141 @@
+/*
+ *  read_config.h: reads configuration files for extensible sections.
+ *
+ */
+#ifndef READ_CONFIG_H
+#define READ_CONFIG_H
+
+#ifdef __cplusplus
+extern          "C" {
+#endif
+
+#define STRINGMAX 1024
+
+#define NORMAL_CONFIG 0
+#define PREMIB_CONFIG 1
+#define EITHER_CONFIG 2
+
+
+
+    /*
+     * Defines a set of file types and the parse and free functions
+     * which process the syntax following a given token in a given file.
+     */
+    struct config_files {
+        char           *fileHeader;     /* Label for entire file. */
+        struct config_line *start;
+        struct config_files *next;
+    };
+
+    struct config_line {
+        char           *config_token;   /* Label for each line parser
+                                         * in the given file. */
+        void            (*parse_line) (const char *, char *);
+        void            (*free_func) (void);
+        struct config_line *next;
+        char            config_time;    /* {NORMAL,PREMIB,EITHER}_CONFIG */
+        char           *help;
+    };
+
+    struct read_config_memory {
+        char           *line;
+        struct read_config_memory *next;
+    };
+
+
+    int             netsnmp_config(char *);     /* parse a simple line: token=values */
+    void            netsnmp_config_remember(char *);    /* process later, during snmp_init() */
+    void            netsnmp_config_process_memories(void);      /* run all memories through parser */
+    void            read_config(const char *, struct config_line *, int);
+    void            read_configs(void);
+    void            read_premib_configs(void);
+    void            read_config_files(int);
+    void            free_config(void);
+    void            config_perror(const char *);
+    void            config_pwarn(const char *);
+    char           *skip_white(char *);
+    char           *skip_not_white(char *);
+    char           *skip_token(char *);
+    char           *copy_nword(char *, char *, int);
+    char           *copy_word(char *, char *);  /* do not use */
+    void            read_config_with_type(const char *, const char *);
+    struct config_line *register_config_handler(const char *, const char *,
+                                                void (*parser) (const char
+                                                                *, char *),
+                                                void (*releaser) (void),
+                                                const char *);
+    struct config_line *register_app_config_handler(const char *,
+                                                    void (*parser) (const
+                                                                    char *,
+                                                                    char
+                                                                    *),
+                                                    void (*releaser)
+                                                    (void), const char *);
+    struct config_line *register_prenetsnmp_mib_handler(const char *,
+                                                        const char *,
+                                                        void (*parser)
+                                                        (const char *,
+                                                         char *),
+                                                        void (*releaser)
+                                                        (void),
+                                                        const char *);
+    struct config_line *register_app_prenetsnmp_mib_handler(const char *,
+                                                            void (*parser)
+                                                            (const char *,
+                                                             char *),
+                                                            void
+                                                            (*releaser)
+                                                            (void),
+                                                            const char *);
+    void            unregister_config_handler(const char *, const char *);
+    void            unregister_app_config_handler(const char *);
+    void            unregister_all_config_handlers(void);
+    void            read_config_print_usage(const char *lead);
+    char           *read_config_save_octet_string(char *saveto,
+                                                  u_char * str,
+                                                  size_t len);
+    char           *read_config_read_octet_string(char *readfrom,
+                                                  u_char ** str,
+                                                  size_t * len);
+    char           *read_config_read_objid(char *readfrom, oid ** objid,
+                                           size_t * len);
+    char           *read_config_save_objid(char *saveto, oid * objid,
+                                           size_t len);
+    char           *read_config_read_data(int type, char *readfrom,
+                                          void *dataptr, size_t * len);
+    char           *read_config_read_memory(int type, char *readfrom,
+                                            char *dataptr, size_t * len);
+    char           *read_config_store_data(int type, char *storeto,
+                                           void *dataptr, size_t * len);
+    char           *read_config_store_data_prefix(char prefix, int type,
+                                                  char *storeto,
+                                                  void *dataptr, size_t len);
+    void            read_config_store(const char *type, const char *line);
+    void            read_app_config_store(const char *line);
+    void            snmp_save_persistent(const char *type);
+    void            snmp_clean_persistent(const char *type);
+    struct config_line *read_config_get_handlers(const char *type);
+
+    /*
+     * external memory list handlers 
+     */
+    void            snmp_config_remember_in_list(char *line,
+                                                 struct read_config_memory
+                                                 **mem);
+    void            snmp_config_process_memory_list(struct
+                                                    read_config_memory
+                                                    **mem, int, int);
+    void            snmp_config_remember_free_list(struct
+                                                   read_config_memory
+                                                   **mem);
+
+    void            set_configuration_directory(const char *dir);
+    const char     *get_configuration_directory(void);
+    void            set_persistent_directory(const char *dir);
+    const char     *get_persistent_directory(void);
+    void            handle_long_opt(const char *myoptarg);
+
+#ifdef __cplusplus
+}
+#endif
+#endif                          /* READ_CONFIG_H */
diff -Naur tomato/release/src/router/snmp/include/net-snmp/library/README tomato121/release/src/router/snmp/include/net-snmp/library/README
--- tomato/release/src/router/snmp/include/net-snmp/library/README	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/include/net-snmp/library/README	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,67 @@
+One of the goals of the Net-SNMP v5 development line, is to try and
+clarify the distinction between the "public" library API, and routines
+that are regarded as being more "internal" to the library.
+
+  This doesn't mean that application writers are discouraged from
+making use of such internal routines.  There is a strong feeling
+within the development team that as much as possible of the library
+should be made externally visible, to support writing as wide a
+range of applications as possible.  To that end, most routines
+will be declared within an installed header file, rather than
+privately within the library code files themselves.
+
+  The public/internal categorisation is rather concerned with issues
+of documentation, stability, and ease of programming.  The public
+API routines have been selected as those covering the more common
+requirements (e.g. creating SNMP requests, sending them to other SNMP
+agents, and interpreting the results), together with certain supporting
+activities (e.g. run-time configuration).
+
+  The intention is that these routines should be properly documented,
+and remain relatively stable.  We will attempt to avoid changing the
+profile of these interfaces, and would normally provide some mechanism
+to retain backward compatability if need be.
+
+  On the other hand, the internal API routines are regarded as just
+that - "internal" - so may legitimately be changed without providing
+any compatability mechanism.  You are perfectly free to make use of
+these routines, but be aware that you do so "at your own risk".
+
+[This statement is in no way intended to challenge or amend the status
+ of the disclaimers in the top-level 'COPYING' file, which remain
+ unchanged  as the legal basis for using this code]
+
+
+  There are (currently) eight main "public API" header files, relating
+to various areas of SNMP programming, plus a combined "all-in-one"
+header file (net-snmp-includes.h).
+  Currently these simply include the relevant library header files
+following the UCD-SNMP organisation.  However, the intention is for
+future releases to declare the public API calls directly within these
+top-level header files, and use the 'library/*.h' files for the more
+internal calls.  (i.e. those that are more likely to change over time).
+
+  Until this process can be started, the best approximation to the
+"public API" list is probably those routines that are documented
+in manual pages.  Apologies for any confusion, but hopefully this
+process will result in a clearer end result than at present.
+
+Applications writers are encouraged to start #including the new header
+files as soon as possible - either individually, or using the combined
+wrapper file.  Hopefully, with only a handful of top-level files, it
+will be reasonably clear which file(s) might be appropriate for any
+particular programming requirement.
+
+
+
+  One final disclaimer:  The above description represents my own
+personal aims and understanding of the likely development of the
+library API.  While I have every confidence in having the support of
+the other developers (or being able to persuade them of the benefits
+of this approach!), it may turn out that things actually take a different
+route.  Anyone wishing to influence the organisation of the eventual
+library API is encouraged to subscribe to the net-snmp-coders mailing
+list, and contribute to the discussions there.
+
+Dave Shield
+February 2002
diff -Naur tomato/release/src/router/snmp/include/net-snmp/library/scapi.h tomato121/release/src/router/snmp/include/net-snmp/library/scapi.h
--- tomato/release/src/router/snmp/include/net-snmp/library/scapi.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/include/net-snmp/library/scapi.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,109 @@
+/*
+ * scapi.h
+ */
+
+#ifndef _SCAPI_H
+#define _SCAPI_H
+
+#ifdef __cplusplus
+extern          "C" {
+#endif
+
+    /*
+     * Authentication/privacy transform bitlengths.
+     */
+#define SNMP_TRANS_AUTHLEN_HMACMD5	128
+#define SNMP_TRANS_AUTHLEN_HMACSHA1	160
+
+#define SNMP_TRANS_AUTHLEN_HMAC96	96
+
+#define SNMP_TRANS_PRIVLEN_1DES		64
+#define SNMP_TRANS_PRIVLEN_1DES_IV	64
+
+#define SNMP_TRANS_PRIVLEN_AES128	128
+#define SNMP_TRANS_PRIVLEN_AES128_IV	128
+#define SNMP_TRANS_AES_AES128_PADSIZE   128
+
+#define SNMP_TRANS_PRIVLEN_AES192	192
+#define SNMP_TRANS_PRIVLEN_AES192_IV	192
+#define SNMP_TRANS_AES_AES192_PADSIZE   128
+
+#define SNMP_TRANS_PRIVLEN_AES256	256
+#define SNMP_TRANS_PRIVLEN_AES256_IV	256
+#define SNMP_TRANS_AES_AES256_PADSIZE   128
+
+    /*
+     * Prototypes.
+     */
+    int             sc_get_properlength(const oid * hashtype,
+                                        u_int hashtype_len);
+
+    int             sc_init(void);
+    int             sc_shutdown(int majorID, int minorID, void *serverarg,
+                                void *clientarg);
+
+    int             sc_random(u_char * buf, size_t * buflen);
+
+    int             sc_generate_keyed_hash(const oid * authtype,
+                                           size_t authtypelen,
+                                           u_char * key, u_int keylen,
+                                           u_char * message, u_int msglen,
+                                           u_char * MAC, size_t * maclen);
+
+    int             sc_check_keyed_hash(const oid * authtype,
+                                        size_t authtypelen, u_char * key,
+                                        u_int keylen, u_char * message,
+                                        u_int msglen, u_char * MAC,
+                                        u_int maclen);
+
+    int             sc_encrypt(const oid * privtype, size_t privtypelen,
+                               u_char * key, u_int keylen,
+                               u_char * iv, u_int ivlen,
+                               u_char * plaintext, u_int ptlen,
+                               u_char * ciphertext, size_t * ctlen);
+
+    int             sc_decrypt(const oid * privtype, size_t privtypelen,
+                               u_char * key, u_int keylen,
+                               u_char * iv, u_int ivlen,
+                               u_char * ciphertext, u_int ctlen,
+                               u_char * plaintext, size_t * ptlen);
+
+    int             sc_hash(const oid * hashtype, size_t hashtypelen,
+                            u_char * buf, size_t buf_len,
+                            u_char * MAC, size_t * MAC_len);
+
+    int             sc_get_transform_type(oid * hashtype,
+                                          u_int hashtype_len,
+                                          int (**hash_fn) (const int mode,
+                                                           void **context,
+                                                           const u_char *
+                                                           data,
+                                                           const int
+                                                           data_len,
+                                                           u_char **
+                                                           digest,
+                                                           size_t *
+                                                           digest_len));
+
+
+    /*
+     * All functions devolve to the following block if we can't do cryptography
+     */
+#define	_SCAPI_NOT_CONFIGURED					\
+{								\
+        snmp_log(LOG_ERR, "Encryption support not enabled.\n"); \
+        DEBUGMSGTL(("scapi", "SCAPI not configured"));		\
+	return SNMPERR_SC_NOT_CONFIGURED;			\
+}
+
+    /*
+     * define a transform type if we're using the internal md5 support 
+     */
+#ifdef USE_INTERNAL_MD5
+#define INTERNAL_MD5 1
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+#endif                          /* _SCAPI_H */
diff -Naur tomato/release/src/router/snmp/include/net-snmp/library/snmpAAL5PVCDomain.h tomato121/release/src/router/snmp/include/net-snmp/library/snmpAAL5PVCDomain.h
--- tomato/release/src/router/snmp/include/net-snmp/library/snmpAAL5PVCDomain.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/include/net-snmp/library/snmpAAL5PVCDomain.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,35 @@
+#ifndef _SNMPAAL5PVCDOMAIN_H
+#define _SNMPAAL5PVCDOMAIN_H
+
+#ifdef SNMP_TRANSPORT_AAL5PVC_DOMAIN
+
+#ifdef __cplusplus
+extern          "C" {
+#endif
+
+#if HAVE_SYS_SOCKET_H
+#include <sys/socket.h>
+#endif
+
+#include <atm.h>
+
+#include <net-snmp/library/snmp_transport.h>
+#include <net-snmp/library/asn1.h>
+
+extern oid  netsnmp_AAL5PVCDomain[]; /* = { ENTERPRISE_MIB, 3, 3, 3 }; */
+
+netsnmp_transport *netsnmp_aal5pvc_transport(struct sockaddr_atmpvc *addr,
+                                             int local);
+
+/*
+ * "Constructor" for transport domain object.  
+ */
+
+void            netsnmp_aal5pvc_ctor(void);
+
+#ifdef __cplusplus
+}
+#endif
+#endif                          /*SNMP_TRANSPORT_AAL5PVC_DOMAIN */
+
+#endif/*_SNMPAAL5PVCDOMAIN_H*/
diff -Naur tomato/release/src/router/snmp/include/net-snmp/library/snmp_alarm.h tomato121/release/src/router/snmp/include/net-snmp/library/snmp_alarm.h
--- tomato/release/src/router/snmp/include/net-snmp/library/snmp_alarm.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/include/net-snmp/library/snmp_alarm.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,60 @@
+#ifndef SNMP_ALARM_H
+#define SNMP_ALARM_H
+
+#ifdef __cplusplus
+extern          "C" {
+#endif
+
+    typedef void    (SNMPAlarmCallback) (unsigned int clientreg,
+                                         void *clientarg);
+
+    /*
+     * alarm flags 
+     */
+#define SA_REPEAT 0x01          /* keep repeating every X seconds */
+
+    struct snmp_alarm {
+        struct timeval  t;
+        unsigned int    flags;
+        unsigned int    clientreg;
+        struct timeval  t_last;
+        struct timeval  t_next;
+        void           *clientarg;
+        SNMPAlarmCallback *thecallback;
+        struct snmp_alarm *next;
+    };
+
+    /*
+     * the ones you should need 
+     */
+    void            snmp_alarm_unregister(unsigned int clientreg);
+    void	    snmp_alarm_unregister_all(void);
+    unsigned int    snmp_alarm_register(unsigned int when,
+                                        unsigned int flags,
+                                        SNMPAlarmCallback * thecallback,
+                                        void *clientarg);
+
+    unsigned int    snmp_alarm_register_hr(struct timeval t,
+                                           unsigned int flags,
+                                           SNMPAlarmCallback * cb,
+                                           void *cd);
+
+
+    /*
+     * the ones you shouldn't 
+     */
+    void            init_snmp_alarm(void);
+    int             init_alarm_post_config(int majorid, int minorid,
+                                           void *serverarg,
+                                           void *clientarg);
+    void            sa_update_entry(struct snmp_alarm *alrm);
+    struct snmp_alarm *sa_find_next(void);
+    void            run_alarms(void);
+    RETSIGTYPE      alarm_handler(int a);
+    void            set_an_alarm(void);
+    int             get_next_alarm_delay_time(struct timeval *delta);
+
+#ifdef __cplusplus
+}
+#endif
+#endif                          /* SNMP_ALARM_H */
diff -Naur tomato/release/src/router/snmp/include/net-snmp/library/snmp_api.h tomato121/release/src/router/snmp/include/net-snmp/library/snmp_api.h
--- tomato/release/src/router/snmp/include/net-snmp/library/snmp_api.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/include/net-snmp/library/snmp_api.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,950 @@
+#ifndef SNMP_API_H
+#define SNMP_API_H
+
+/*
+ * snmp_api.h - API for access to snmp.
+ *
+ * Caution: when using this library in a multi-threaded application,
+ * the values of global variables "snmp_errno" and "snmp_detail"
+ * cannot be reliably determined.  Suggest using snmp_error()
+ * to obtain the library error codes.
+ */
+
+#ifndef DONT_SHARE_ERROR_WITH_OTHER_THREADS
+#define SET_SNMP_ERROR(x) snmp_errno=(x)
+#else
+#define SET_SNMP_ERROR(x)
+#endif
+
+
+#ifdef __cplusplus
+extern          "C" {
+#endif
+
+/***********************************************************
+	Copyright 1989 by Carnegie Mellon University
+
+                      All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of CMU not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+CMU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+CMU BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+******************************************************************/
+
+struct variable_list;
+typedef struct variable_list netsnmp_variable_list;
+struct timeval;
+struct netsnmp_transport_s;
+
+#define USM_AUTH_KU_LEN     32
+#define USM_PRIV_KU_LEN     32
+
+typedef struct snmp_pdu {
+
+    /*
+     * Protocol-version independent fields
+     */
+    long            version;
+    int             command;        /* Type of this PDU */
+    long            reqid;  /* Request id - note: not incremented on retries */
+    long            msgid;  /* Message id for V3 messages 
+			     * note: incremented for each retry */
+    long            transid;        /* Unique ID for incoming transactions */
+    long            sessid; 	    /* Session id for AgentX messages */
+    long            errstat;        /* Error status (non_repeaters in GetBulk) */
+    long            errindex;       /* Error index (max_repetitions in GetBulk) */
+    u_long          time;   /* Uptime */
+    u_long          flags;
+
+    int             securityModel;
+    int             securityLevel;  /* noAuthNoPriv, authNoPriv, authPriv */
+    int             msgParseModel;
+
+    /*
+     * Transport-specific opaque data.  This replaces the IP-centric address
+     * field.  
+     */
+    
+    void           *transport_data;
+    int             transport_data_length;
+
+    /*
+     * The actual transport domain.  This SHOULD NOT BE FREE()D.  
+     */
+
+    const oid      *tDomain;
+    size_t          tDomainLen;
+
+    netsnmp_variable_list *variables;
+
+
+    /*
+     * SNMPv1 & SNMPv2c fields
+     */
+    u_char         *community;      /* community for outgoing requests. */
+    size_t          community_len;  /* Length of community name. */
+
+    /*
+     * Trap information
+     */
+    oid            *enterprise;     /* System OID */
+    size_t          enterprise_length;
+    long            trap_type;      /* trap type */
+    long            specific_type;  /* specific type */
+    unsigned char   agent_addr[4];  /* This is ONLY used for v1 TRAPs  */
+
+    /*
+     * SNMPv3 fields
+     */
+    u_char         *contextEngineID;        /* context snmpEngineID */
+    size_t          contextEngineIDLen;     /* Length of contextEngineID */
+    char           *contextName;    /* authoritative contextName */
+    size_t          contextNameLen; /* Length of contextName */
+    u_char         *securityEngineID;       /* authoritative snmpEngineID for security */
+    size_t          securityEngineIDLen;    /* Length of securityEngineID */
+    char           *securityName;   /* on behalf of this principal */
+    size_t          securityNameLen;        /* Length of securityName. */
+    
+    /*
+     * AgentX fields
+     *      (also uses SNMPv1 community field)
+     */
+    int             priority;
+    int             range_subid;
+    
+    void           *securityStateRef;
+} netsnmp_pdu;
+
+struct snmp_session;
+typedef struct snmp_session netsnmp_session;
+
+typedef int     (*snmp_callback) (int, netsnmp_session *, int,
+                                      netsnmp_pdu *, void *);
+typedef int     (*netsnmp_callback) (int, netsnmp_session *, int,
+                                         netsnmp_pdu *, void *);
+
+struct snmp_session {
+    /*
+     * Protocol-version independent fields
+     */
+    long            version;
+    int             retries;        /* Number of retries before timeout. */
+    long            timeout;        /* Number of uS until first timeout, then exponential backoff */
+    u_long          flags;
+    struct snmp_session *subsession;
+    struct snmp_session *next;
+
+    char           *peername;       /* Domain name or dotted IP address of default peer */
+    u_short         remote_port;    /* UDP port number of peer. */
+    u_short         local_port;     /* My UDP port number, 0 for default, picked randomly */
+    /*
+     * Authentication function or NULL if null authentication is used 
+     */
+    u_char         *(*authenticator) (u_char *, size_t *, u_char *, size_t);
+    netsnmp_callback callback;      /* Function to interpret incoming data */
+    /*
+     * Pointer to data that the callback function may consider important 
+     */
+    void           *callback_magic;
+
+    int             s_errno;        /* copy of system errno */
+    int             s_snmp_errno;   /* copy of library errno */
+    long            sessid; /* Session id - AgentX only */
+
+    /*
+     * SNMPv1 & SNMPv2c fields
+     */
+    u_char         *community;      /* community for outgoing requests. */
+    size_t          community_len;  /* Length of community name. */
+    
+    size_t          rcvMsgMaxSize;  /*  Largest message to try to receive.  */
+    size_t          sndMsgMaxSize;  /*  Largest message to try to send.  */
+
+    /*
+     * SNMPv3 fields
+     */
+    u_char          isAuthoritative;        /* are we the authoritative engine? */
+    u_char         *contextEngineID;        /* authoritative snmpEngineID */
+    size_t          contextEngineIDLen;     /* Length of contextEngineID */
+    u_int           engineBoots;    /* initial engineBoots for remote engine */
+    u_int           engineTime;     /* initial engineTime for remote engine */
+    char           *contextName;    /* authoritative contextName */
+    size_t          contextNameLen; /* Length of contextName */
+    u_char         *securityEngineID;       /* authoritative snmpEngineID */
+    size_t          securityEngineIDLen;    /* Length of contextEngineID */
+    char           *securityName;   /* on behalf of this principal */
+    size_t          securityNameLen;        /* Length of securityName. */
+    oid            *securityAuthProto;      /* auth protocol oid */
+    size_t          securityAuthProtoLen;   /* Length of auth protocol oid */
+    u_char          securityAuthKey[USM_AUTH_KU_LEN];       /* Ku for auth protocol XXX */
+    size_t          securityAuthKeyLen;     /* Length of Ku for auth protocol */
+    oid            *securityPrivProto;      /* priv protocol oid */
+    size_t          securityPrivProtoLen;   /* Length of priv protocol oid */
+    u_char          securityPrivKey[USM_PRIV_KU_LEN];       /* Ku for privacy protocol XXX */
+    size_t          securityPrivKeyLen;     /* Length of Ku for priv protocol */
+    int             securityModel;
+    int             securityLevel;  /* noAuthNoPriv, authNoPriv, authPriv */
+    
+    /*
+     * security module specific 
+     */
+    void           *securityInfo;
+
+    /*
+     * use as you want data 
+     */
+    void           *myvoid;
+};
+
+/*
+ * A list of all the outstanding requests for a particular session.
+ */
+#ifdef SNMP_NEED_REQUEST_LIST
+typedef struct request_list {
+    struct request_list *next_request;
+    long            request_id;     /* request id */
+    long            message_id;     /* message id */
+    netsnmp_callback callback;      /* user callback per request (NULL if unused) */
+    void           *cb_data;        /* user callback data per request (NULL if unused) */
+    int             retries;        /* Number of retries */
+    u_long          timeout;        /* length to wait for timeout */
+    struct timeval  time;   /* Time this request was made */
+    struct timeval  expire; /* time this request is due to expire */
+    struct snmp_session *session;
+    netsnmp_pdu    *pdu;    /* The pdu for this request
+			     * (saved so it can be retransmitted */
+} netsnmp_request_list;
+#endif                          /* SNMP_NEED_REQUEST_LIST */
+
+    /*
+     * Set fields in session and pdu to the following to get a default or unconfigured value.
+     */
+#define SNMP_DEFAULT_COMMUNITY_LEN  0   /* to get a default community name */
+#define SNMP_DEFAULT_RETRIES	    -1
+#define SNMP_DEFAULT_TIMEOUT	    -1
+#define SNMP_DEFAULT_REMPORT	    0
+#define SNMP_DEFAULT_REQID	    -1
+#define SNMP_DEFAULT_MSGID	    -1
+#define SNMP_DEFAULT_ERRSTAT	    -1
+#define SNMP_DEFAULT_ERRINDEX	    -1
+#define SNMP_DEFAULT_ADDRESS	    0
+#define SNMP_DEFAULT_PEERNAME	    NULL
+#define SNMP_DEFAULT_ENTERPRISE_LENGTH	0
+#define SNMP_DEFAULT_TIME	    0
+#define SNMP_DEFAULT_VERSION	    -1
+#define SNMP_DEFAULT_SECMODEL	    -1
+#define SNMP_DEFAULT_CONTEXT        ""
+#define SNMP_DEFAULT_AUTH_PROTO     usmHMACMD5AuthProtocol
+#define SNMP_DEFAULT_AUTH_PROTOLEN  USM_LENGTH_OID_TRANSFORM
+#define SNMP_DEFAULT_PRIV_PROTO     usmDESPrivProtocol
+#define SNMP_DEFAULT_PRIV_PROTOLEN  USM_LENGTH_OID_TRANSFORM
+
+    extern const char *snmp_api_errstring(int);
+    extern void     snmp_perror(const char *);
+    extern void     snmp_set_detail(const char *);
+
+#define SNMP_MAX_MSG_SIZE          1472 /* ethernet MTU minus IP/UDP header */
+#define SNMP_MAX_MSG_V3_HDRS       (4+3+4+7+7+3+7+16)   /* fudge factor=16 */
+#define SNMP_MAX_ENG_SIZE          32
+#define SNMP_MAX_SEC_NAME_SIZE     256
+#define SNMP_MAX_CONTEXT_SIZE      256
+#define SNMP_SEC_PARAM_BUF_SIZE    256
+
+    /*
+     * set to one to ignore unauthenticated Reports 
+     */
+#define SNMPV3_IGNORE_UNAUTH_REPORTS 0
+
+    /*
+     * authoritative engine definitions 
+     */
+#define SNMP_SESS_NONAUTHORITATIVE 0    /* should be 0 to default to this */
+#define SNMP_SESS_AUTHORITATIVE    1    /* don't learn engineIDs */
+#define SNMP_SESS_UNKNOWNAUTH      2    /* sometimes (like NRs) */
+
+    /*
+     * to determine type of Report from varbind_list 
+     */
+#define REPORT_STATS_LEN 9
+#define REPORT_snmpUnknownSecurityModels_NUM 1
+#define REPORT_snmpInvalidMsgs_NUM 2
+#define REPORT_usmStatsUnsupportedSecLevels_NUM 1
+#define REPORT_usmStatsNotInTimeWindows_NUM 2
+#define REPORT_usmStatsUnknownUserNames_NUM 3
+#define REPORT_usmStatsUnknownEngineIDs_NUM 4
+#define REPORT_usmStatsWrongDigests_NUM 5
+#define REPORT_usmStatsDecryptionErrors_NUM 6
+
+#define SNMP_DETAIL_SIZE        512
+
+#define SNMP_FLAGS_DONT_PROBE      0x100        /* don't probe for an engineID */
+#define SNMP_FLAGS_STREAM_SOCKET   0x80
+#define SNMP_FLAGS_LISTENING       0x40 /* Server stream sockets only */
+#define SNMP_FLAGS_SUBSESSION      0x20
+#define SNMP_FLAGS_STRIKE2         0x02
+#define SNMP_FLAGS_STRIKE1         0x01
+
+#define CLEAR_SNMP_STRIKE_FLAGS(x) \
+	x &= ~(SNMP_FLAGS_STRIKE2|SNMP_FLAGS_STRIKE1)
+
+    /*
+     * returns '1' if the session is to be regarded as dead,
+     * otherwise set the strike flags appropriately, and return 0
+     */
+#define SET_SNMP_STRIKE_FLAGS(x) \
+	((   x & SNMP_FLAGS_STRIKE2 ) ? 1 :				\
+	 ((( x & SNMP_FLAGS_STRIKE1 ) ? ( x |= SNMP_FLAGS_STRIKE2 ) :	\
+	                                ( x |= SNMP_FLAGS_STRIKE1 )),	\
+	                                0))
+
+    /*
+     * Error return values.
+     *
+     * SNMPERR_SUCCESS is the non-PDU "success" code.
+     *
+     * XXX  These should be merged with SNMP_ERR_* defines and confined
+     *      to values < 0.  ???
+     */
+#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
+#define SNMPERR_GENERR			(-1)
+#define SNMPERR_BAD_LOCPORT		(-2)
+#define SNMPERR_BAD_ADDRESS		(-3)
+#define SNMPERR_BAD_SESSION		(-4)
+#define SNMPERR_TOO_LONG		(-5)
+#define SNMPERR_NO_SOCKET		(-6)
+#define SNMPERR_V2_IN_V1		(-7)
+#define SNMPERR_V1_IN_V2		(-8)
+#define SNMPERR_BAD_REPEATERS		(-9)
+#define SNMPERR_BAD_REPETITIONS		(-10)
+#define SNMPERR_BAD_ASN1_BUILD		(-11)
+#define SNMPERR_BAD_SENDTO		(-12)
+#define SNMPERR_BAD_PARSE		(-13)
+#define SNMPERR_BAD_VERSION		(-14)
+#define SNMPERR_BAD_SRC_PARTY		(-15)
+#define SNMPERR_BAD_DST_PARTY		(-16)
+#define SNMPERR_BAD_CONTEXT		(-17)
+#define SNMPERR_BAD_COMMUNITY		(-18)
+#define SNMPERR_NOAUTH_DESPRIV		(-19)
+#define SNMPERR_BAD_ACL			(-20)
+#define SNMPERR_BAD_PARTY		(-21)
+#define SNMPERR_ABORT			(-22)
+#define SNMPERR_UNKNOWN_PDU		(-23)
+#define SNMPERR_TIMEOUT 		(-24)
+#define SNMPERR_BAD_RECVFROM 		(-25)
+#define SNMPERR_BAD_ENG_ID 		(-26)
+#define SNMPERR_BAD_SEC_NAME 		(-27)
+#define SNMPERR_BAD_SEC_LEVEL 		(-28)
+#define SNMPERR_ASN_PARSE_ERR           (-29)
+#define SNMPERR_UNKNOWN_SEC_MODEL 	(-30)
+#define SNMPERR_INVALID_MSG             (-31)
+#define SNMPERR_UNKNOWN_ENG_ID          (-32)
+#define SNMPERR_UNKNOWN_USER_NAME 	(-33)
+#define SNMPERR_UNSUPPORTED_SEC_LEVEL 	(-34)
+#define SNMPERR_AUTHENTICATION_FAILURE 	(-35)
+#define SNMPERR_NOT_IN_TIME_WINDOW 	(-36)
+#define SNMPERR_DECRYPTION_ERR          (-37)
+#define SNMPERR_SC_GENERAL_FAILURE	(-38)
+#define SNMPERR_SC_NOT_CONFIGURED	(-39)
+#define SNMPERR_KT_NOT_AVAILABLE	(-40)
+#define SNMPERR_UNKNOWN_REPORT          (-41)
+#define SNMPERR_USM_GENERICERROR		(-42)
+#define SNMPERR_USM_UNKNOWNSECURITYNAME		(-43)
+#define SNMPERR_USM_UNSUPPORTEDSECURITYLEVEL	(-44)
+#define SNMPERR_USM_ENCRYPTIONERROR		(-45)
+#define SNMPERR_USM_AUTHENTICATIONFAILURE	(-46)
+#define SNMPERR_USM_PARSEERROR			(-47)
+#define SNMPERR_USM_UNKNOWNENGINEID		(-48)
+#define SNMPERR_USM_NOTINTIMEWINDOW		(-49)
+#define SNMPERR_USM_DECRYPTIONERROR		(-50)
+#define SNMPERR_NOMIB			(-51)
+#define SNMPERR_RANGE			(-52)
+#define SNMPERR_MAX_SUBID		(-53)
+#define SNMPERR_BAD_SUBID		(-54)
+#define SNMPERR_LONG_OID		(-55)
+#define SNMPERR_BAD_NAME		(-56)
+#define SNMPERR_VALUE			(-57)
+#define SNMPERR_UNKNOWN_OBJID		(-58)
+#define SNMPERR_NULL_PDU		(-59)
+#define SNMPERR_NO_VARS			(-60)
+#define SNMPERR_VAR_TYPE		(-61)
+#define SNMPERR_MALLOC			(-62)
+#define SNMPERR_KRB5			(-63)
+
+#define SNMPERR_MAX			(-63)
+
+#define non_repeaters	errstat
+#define max_repetitions errindex
+
+struct variable_list {
+    struct variable_list *next_variable;    /* NULL for last variable */
+    oid            *name;   /* Object identifier of variable */
+    size_t          name_length;    /* number of subid's in name */
+    u_char          type;   /* ASN type of variable */
+    union {                 /* value of variable */
+	long           *integer;
+	u_char         *string;
+	oid            *objid;
+	u_char         *bitstring;
+	struct counter64 *counter64;
+#ifdef OPAQUE_SPECIAL_TYPES
+	float          *floatVal;
+	double         *doubleVal;
+	/*
+	 * t_union *unionVal; 
+	 */
+#endif                          /* OPAQUE_SPECIAL_TYPES */
+    } val;
+    size_t          val_len;
+    oid             name_loc[MAX_OID_LEN];  /* 90 percentile < 24. */
+    u_char          buf[40];        /* 90 percentile < 40. */
+    void           *data;   /* (Opaque) hook for additional data */
+    void            (*dataFreeHook)(void *);       /* callback to free above */
+    int             index;
+};
+
+
+
+    /*
+     * netsnmp_session *snmp_open(session)
+     *      netsnmp_session *session;
+     *
+     * Sets up the session with the snmp_session information provided
+     * by the user.  Then opens and binds the necessary UDP port.
+     * A handle to the created session is returned (this is different than
+     * the pointer passed to snmp_open()).  On any error, NULL is returned
+     * and snmp_errno is set to the appropriate error code.
+     */
+    netsnmp_session *snmp_open(netsnmp_session *);
+
+    /*
+     * int snmp_close(session)
+     *     netsnmp_session *session;
+     *
+     * Close the input session.  Frees all data allocated for the session,
+     * dequeues any pending requests, and closes any sockets allocated for
+     * the session.  Returns 0 on error, 1 otherwise.
+     *
+     * snmp_close_sessions() does the same thing for all open sessions
+     */
+    int             snmp_close(netsnmp_session *);
+    int             snmp_close_sessions(void);
+
+
+    /*
+     * int snmp_send(session, pdu)
+     *     netsnmp_session *session;
+     *     netsnmp_pdu      *pdu;
+     *
+     * Sends the input pdu on the session after calling snmp_build to create
+     * a serialized packet.  If necessary, set some of the pdu data from the
+     * session defaults.  Add a request corresponding to this pdu to the list
+     * of outstanding requests on this session, then send the pdu.
+     * Returns the request id of the generated packet if applicable, otherwise 1.
+     * On any error, 0 is returned.
+     * The pdu is freed by snmp_send() unless a failure occured.
+     */
+    int             snmp_send(netsnmp_session *, netsnmp_pdu *);
+
+    /*
+     * int snmp_async_send(session, pdu, callback, cb_data)
+     *     netsnmp_session *session;
+     *     netsnmp_pdu      *pdu;
+     *     netsnmp_callback callback;
+     *     void   *cb_data;
+     *
+     * Sends the input pdu on the session after calling snmp_build to create
+     * a serialized packet.  If necessary, set some of the pdu data from the
+     * session defaults.  Add a request corresponding to this pdu to the list
+     * of outstanding requests on this session and store callback and data,
+     * then send the pdu.
+     * Returns the request id of the generated packet if applicable, otherwise 1.
+     * On any error, 0 is returned.
+     * The pdu is freed by snmp_send() unless a failure occured.
+     */
+    int             snmp_async_send(netsnmp_session *, netsnmp_pdu *,
+                                    netsnmp_callback, void *);
+
+
+    /*
+     * void snmp_read(fdset)
+     *     fd_set  *fdset;
+     *
+     * Checks to see if any of the fd's set in the fdset belong to
+     * snmp.  Each socket with it's fd set has a packet read from it
+     * and snmp_parse is called on the packet received.  The resulting pdu
+     * is passed to the callback routine for that session.  If the callback
+     * routine returns successfully, the pdu and it's request are deleted.
+     */
+    void            snmp_read(fd_set *);
+
+
+
+    /*
+     * void
+     * snmp_free_pdu(pdu)
+     *     netsnmp_pdu *pdu;
+     *
+     * Frees the pdu and any malloc'd data associated with it.
+     */
+    void            snmp_free_pdu(netsnmp_pdu *);
+
+    void            snmp_free_var(netsnmp_variable_list *);     /* frees just this one */
+
+    void            snmp_free_varbind(netsnmp_variable_list * var);     /* frees all in list */
+
+    /*
+     * int snmp_select_info(numfds, fdset, timeout, block)
+     * int *numfds;
+     * fd_set   *fdset;
+     * struct timeval *timeout;
+     * int *block;
+     *
+     * Returns info about what snmp requires from a select statement.
+     * numfds is the number of fds in the list that are significant.
+     * All file descriptors opened for SNMP are OR'd into the fdset.
+     * If activity occurs on any of these file descriptors, snmp_read
+     * should be called with that file descriptor set.
+     *
+     * The timeout is the latest time that SNMP can wait for a timeout.  The
+     * select should be done with the minimum time between timeout and any other
+     * timeouts necessary.  This should be checked upon each invocation of select.
+     * If a timeout is received, snmp_timeout should be called to check if the
+     * timeout was for SNMP.  (snmp_timeout is idempotent)
+     *
+     * Block is 1 if the select is requested to block indefinitely, rather than
+     * time out.  If block is input as 1, the timeout value will be treated as
+     * undefined, but it must be available for setting in snmp_select_info.  On
+     * return, if block is true, the value of timeout will be undefined.
+     *
+     * snmp_select_info returns the number of open sockets.  (i.e. The number
+     * of sessions open)
+     */
+    int             snmp_select_info(int *, fd_set *, struct timeval *,
+                                     int *);
+
+
+
+    /*
+     * void snmp_timeout();
+     *
+     * snmp_timeout should be called whenever the timeout from snmp_select_info
+     * expires, but it is idempotent, so snmp_timeout can be polled (probably a
+     * cpu expensive proposition).  snmp_timeout checks to see if any of the
+     * sessions have an outstanding request that has timed out.  If it finds one
+     * (or more), and that pdu has more retries available, a new packet is formed
+     * from the pdu and is resent.  If there are no more retries available, the
+     * callback for the session is used to alert the user of the timeout.
+     */
+
+    void            snmp_timeout(void);
+
+
+    /*
+     * This routine must be supplied by the application:
+     *
+     * u_char *authenticator(pdu, length, community, community_len)
+     * u_char *pdu;         The rest of the PDU to be authenticated
+     * int *length;         The length of the PDU (updated by the authenticator)
+     * u_char *community;   The community name to authenticate under.
+     * int  community_len   The length of the community name.
+     *
+     * Returns the authenticated pdu, or NULL if authentication failed.
+     * If null authentication is used, the authenticator in snmp_session can be
+     * set to NULL(0).
+     */
+
+
+
+    /*
+     * This routine must be supplied by the application:
+     *
+     * int callback(operation, session, reqid, pdu, magic)
+     * int operation;
+     * netsnmp_session *session;    The session authenticated under.
+     * int reqid;                       The request id of this pdu (0 for TRAP)
+     * netsnmp_pdu *pdu;        The pdu information.
+     * void *magic                      A link to the data for this routine.
+     *
+     * Returns 1 if request was successful, 0 if it should be kept pending.
+     * Any data in the pdu must be copied because it will be freed elsewhere.
+     * Operations are defined below:
+     */
+
+#define NETSNMP_CALLBACK_OP_RECEIVED_MESSAGE	1
+#define NETSNMP_CALLBACK_OP_TIMED_OUT		2
+#define NETSNMP_CALLBACK_OP_SEND_FAILED		3
+#define NETSNMP_CALLBACK_OP_CONNECT		4
+#define NETSNMP_CALLBACK_OP_DISCONNECT		5
+
+    long            snmp_get_next_msgid(void);
+    long            snmp_get_next_reqid(void);
+    long            snmp_get_next_sessid(void);
+    long            snmp_get_next_transid(void);
+
+    int             snmp_oid_compare(const oid *, size_t, const oid *,
+                                     size_t);
+    int             snmp_oid_ncompare(const oid *, size_t, const oid *,
+                                      size_t, size_t);
+    int             snmp_oidtree_compare(const oid *, size_t, const oid *,
+                                         size_t);
+    int             netsnmp_oid_equals(const oid *, size_t, const oid *,
+                                       size_t);
+    int             netsnmp_oid_tree_equals(const oid *, size_t, const oid *,
+                                            size_t);
+    int             netsnmp_oid_is_subtree(const oid *, size_t, const oid *,
+                                           size_t);
+    int             netsnmp_oid_find_prefix(const oid * in_name1, size_t len1,
+                                            const oid * in_name2, size_t len2);
+    void            init_snmp(const char *);
+    u_char         *snmp_pdu_build(netsnmp_pdu *, u_char *, size_t *);
+#ifdef USE_REVERSE_ASNENCODING
+    u_char         *snmp_pdu_rbuild(netsnmp_pdu *, u_char *, size_t *);
+#endif
+    int             snmpv3_parse(netsnmp_pdu *, u_char *, size_t *,
+                                 u_char **, netsnmp_session *);
+    int             snmpv3_packet_build(netsnmp_session *,
+                                        netsnmp_pdu *pdu, u_char * packet,
+                                        size_t * out_length,
+                                        u_char * pdu_data,
+                                        size_t pdu_data_len);
+    int             snmpv3_packet_rbuild(netsnmp_session *,
+                                         netsnmp_pdu *pdu, u_char * packet,
+                                         size_t * out_length,
+                                         u_char * pdu_data,
+                                         size_t pdu_data_len);
+    int             snmpv3_make_report(netsnmp_pdu *pdu, int error);
+    int             snmpv3_get_report_type(netsnmp_pdu *pdu);
+    int             snmp_pdu_parse(netsnmp_pdu *pdu, u_char * data,
+                                   size_t * length);
+    u_char         *snmpv3_scopedPDU_parse(netsnmp_pdu *pdu, u_char * cp,
+                                           size_t * length);
+    void            snmp_store(const char *type);
+    void            snmp_shutdown(const char *type);
+    netsnmp_variable_list *snmp_pdu_add_variable(netsnmp_pdu *, const oid *,
+                                                 size_t, u_char, const u_char *,
+                                                 size_t);
+    netsnmp_variable_list *snmp_varlist_add_variable(netsnmp_variable_list
+                                                     ** varlist,
+                                                     const oid * name,
+                                                     size_t name_length,
+                                                     u_char type,
+                                                     const u_char * value,
+                                                     size_t len);
+    int             snmp_add_var(netsnmp_pdu *, const oid *, size_t, char,
+                                 const char *);
+    oid            *snmp_duplicate_objid(const oid * objToCopy, size_t);
+    u_int           snmp_increment_statistic(int which);
+    u_int           snmp_increment_statistic_by(int which, int count);
+    u_int           snmp_get_statistic(int which);
+    void            snmp_init_statistics(void);
+    int             create_user_from_session(netsnmp_session * session);
+
+    /*
+     * New re-allocating reverse encoding functions.  
+     */
+#ifdef USE_REVERSE_ASNENCODING
+
+    int        snmpv3_packet_realloc_rbuild(u_char ** pkt, size_t * pkt_len,
+                                     size_t * offset,
+                                     netsnmp_session * session,
+                                     netsnmp_pdu *pdu, u_char * pdu_data,
+                                     size_t pdu_data_len);
+
+    int        snmp_pdu_realloc_rbuild(u_char ** pkt, size_t * pkt_len,
+                                size_t * offset, netsnmp_pdu *pdu);
+#endif
+
+
+
+    /*
+     * Extended open; fpre_parse has changed.  
+     */
+
+    netsnmp_session *snmp_open_ex(netsnmp_session *,
+                                  int (*fpre_parse) (netsnmp_session *,
+                                                     struct
+                                                     netsnmp_transport_s *,
+                                                     void *, int),
+                                  int (*fparse) (netsnmp_session *,
+                                                 netsnmp_pdu *, u_char *,
+                                                 size_t),
+                                  int (*fpost_parse) (netsnmp_session *,
+                                                      netsnmp_pdu *, int),
+                                  int (*fbuild) (netsnmp_session *,
+                                                 netsnmp_pdu *, u_char *,
+                                                 size_t *),
+                                  int (*frbuild) (netsnmp_session *,
+                                                  netsnmp_pdu *, u_char **,
+                                                  size_t *, size_t *),
+                                  int (*fcheck) (u_char *, size_t));
+
+    /*
+     * provided for backwards compatability.  Don't use these functions.
+     * See snmp_debug.h and snmp_debug.c instead.
+     */
+
+    void            snmp_set_do_debugging(int);
+    int             snmp_get_do_debugging(void);
+
+
+    /*
+     * snmp_error - return error data
+     * Inputs :  address of errno, address of snmp_errno, address of string
+     * Caller must free the string returned after use.
+     */
+    void            snmp_error(netsnmp_session *, int *, int *, char **);
+    /*
+     * single session API.
+     *
+     * These functions perform similar actions as snmp_XX functions,
+     * but operate on a single session only.
+     *
+     * Synopsis:
+     
+     void * sessp;
+     netsnmp_session session, *ss;
+     netsnmp_pdu *pdu, *response;
+     
+     snmp_sess_init(&session);
+     session.retries = ...
+     session.remote_port = ...
+     sessp = snmp_sess_open(&session);
+     ss = snmp_sess_session(sessp);
+     if (ss == NULL)
+     exit(1);
+     ...
+     if (ss->community) free(ss->community);
+     ss->community = strdup(gateway);
+     ss->community_len = strlen(gateway);
+     ...
+     snmp_sess_synch_response(sessp, pdu, &response);
+     ...
+     snmp_sess_close(sessp);
+     
+     * See also:
+     * snmp_sess_synch_response, in snmp_client.h.
+     
+     * Notes:
+     *  1. Invoke snmp_sess_session after snmp_sess_open.
+     *  2. snmp_sess_session return value is an opaque pointer.
+     *  3. Do NOT free memory returned by snmp_sess_session.
+     *  4. Replace snmp_send(ss,pdu) with snmp_sess_send(sessp,pdu)
+     */
+
+    void            snmp_sess_init(netsnmp_session *);
+    void           *snmp_sess_open(netsnmp_session *);
+    void           *snmp_sess_pointer(netsnmp_session *);
+    netsnmp_session *snmp_sess_session(void *);
+
+    /*
+     * Return the netsnmp_transport structure associated with the given opaque
+     * pointer.  
+     */
+
+    struct netsnmp_transport_s *snmp_sess_transport(void *);
+    void            snmp_sess_transport_set(void *,
+					    struct netsnmp_transport_s *);
+
+    /*
+     * EXPERIMENTAL API EXTENSIONS ------------------------------------------ 
+     * 
+     * snmp_sess_add_ex, snmp_sess_add, snmp_add 
+     * 
+     * Analogous to snmp_open family of functions, but taking an
+     * netsnmp_transport pointer as an extra argument.  Unlike snmp_open et
+     * al. it doesn't attempt to interpret the in_session->peername as a
+     * transport endpoint specifier, but instead uses the supplied transport.
+     * JBPN
+     * 
+     */
+
+    void           *snmp_sess_add_ex(netsnmp_session *,
+                                     struct netsnmp_transport_s *,
+                                     int (*fpre_parse) (netsnmp_session *,
+                                                        struct
+                                                        netsnmp_transport_s
+                                                        *, void *, int),
+                                     int (*fparse) (netsnmp_session *,
+                                                    struct snmp_pdu *,
+                                                    u_char *, size_t),
+                                     int (*fpost_parse) (netsnmp_session *,
+                                                         struct snmp_pdu *,
+                                                         int),
+                                     int (*fbuild) (netsnmp_session *,
+                                                    struct snmp_pdu *,
+                                                    u_char *, size_t *),
+                                     int (*frbuild) (netsnmp_session *,
+                                                     struct snmp_pdu *,
+                                                     u_char **, size_t *,
+                                                     size_t *),
+                                     int (*fcheck) (u_char *, size_t),
+                                     netsnmp_pdu *(*fcreate_pdu) (struct
+                                                                  netsnmp_transport_s
+                                                                  *,
+                                                                  void *,
+                                                                  size_t));
+
+    void           *snmp_sess_add(netsnmp_session *,
+                                  struct netsnmp_transport_s *,
+                                  int (*fpre_parse) (netsnmp_session *,
+                                                     struct
+                                                     netsnmp_transport_s *,
+                                                     void *, int),
+                                  int (*fpost_parse) (netsnmp_session *,
+                                                      netsnmp_pdu *, int));
+
+    netsnmp_session *snmp_add(netsnmp_session *,
+                              struct netsnmp_transport_s *,
+                              int (*fpre_parse) (netsnmp_session *,
+                                                 struct netsnmp_transport_s
+                                                 *, void *, int),
+                              int (*fpost_parse) (netsnmp_session *,
+                                                  netsnmp_pdu *, int));
+    netsnmp_session *snmp_add_full(netsnmp_session * in_session,
+                                   struct netsnmp_transport_s *transport,
+                                   int (*fpre_parse) (netsnmp_session *,
+                                                      struct
+                                                      netsnmp_transport_s
+                                                      *, void *, int),
+                                   int (*fparse) (netsnmp_session *,
+                                                  netsnmp_pdu *, u_char *,
+                                                  size_t),
+                                   int (*fpost_parse) (netsnmp_session *,
+                                                       netsnmp_pdu *, int),
+                                   int (*fbuild) (netsnmp_session *,
+                                                  netsnmp_pdu *, u_char *,
+                                                  size_t *),
+                                   int (*frbuild) (netsnmp_session *,
+                                                   netsnmp_pdu *,
+                                                   u_char **, size_t *,
+                                                   size_t *),
+                                   int (*fcheck) (u_char *, size_t),
+                                   netsnmp_pdu *(*fcreate_pdu) (struct
+                                                                netsnmp_transport_s
+                                                                *, void *,
+                                                                size_t)
+        );
+
+    /*
+     * use return value from snmp_sess_open as void * parameter 
+     */
+
+    int             snmp_sess_send(void *, netsnmp_pdu *);
+    int             snmp_sess_async_send(void *, netsnmp_pdu *,
+                                         netsnmp_callback, void *);
+    int             snmp_sess_select_info(void *, int *, fd_set *,
+                                          struct timeval *, int *);
+    int             snmp_sess_read(void *, fd_set *);
+    void            snmp_sess_timeout(void *);
+    int             snmp_sess_close(void *);
+
+    void            snmp_sess_error(void *, int *, int *, char **);
+    void            netsnmp_sess_log_error(int priority,
+                                           const char *prog_string,
+                                           netsnmp_session * ss);
+    void            snmp_sess_perror(const char *prog_string,
+                                     netsnmp_session * ss);
+
+    /*
+     * end single session API 
+     */
+
+    /*
+     * generic statistic counters 
+     */
+
+    /*
+     * snmpv3 statistics 
+     */
+
+    /*
+     * mpd stats 
+     */
+#define   STAT_SNMPUNKNOWNSECURITYMODELS     0
+#define   STAT_SNMPINVALIDMSGS               1
+#define   STAT_SNMPUNKNOWNPDUHANDLERS        2
+#define   STAT_MPD_STATS_START               STAT_SNMPUNKNOWNSECURITYMODELS
+#define   STAT_MPD_STATS_END                 STAT_SNMPUNKNOWNPDUHANDLERS
+
+    /*
+     * usm stats 
+     */
+#define   STAT_USMSTATSUNSUPPORTEDSECLEVELS  3
+#define   STAT_USMSTATSNOTINTIMEWINDOWS      4
+#define   STAT_USMSTATSUNKNOWNUSERNAMES      5
+#define   STAT_USMSTATSUNKNOWNENGINEIDS      6
+#define   STAT_USMSTATSWRONGDIGESTS          7
+#define   STAT_USMSTATSDECRYPTIONERRORS      8
+#define   STAT_USM_STATS_START               STAT_USMSTATSUNSUPPORTEDSECLEVELS
+#define   STAT_USM_STATS_END                 STAT_USMSTATSDECRYPTIONERRORS
+
+    /*
+     * snmp counters 
+     */
+#define  STAT_SNMPINPKTS                     9
+#define  STAT_SNMPOUTPKTS                    10
+#define  STAT_SNMPINBADVERSIONS              11
+#define  STAT_SNMPINBADCOMMUNITYNAMES        12
+#define  STAT_SNMPINBADCOMMUNITYUSES         13
+#define  STAT_SNMPINASNPARSEERRS             14
+    /*
+     * #define  STAT_SNMPINBADTYPES              15 
+     */
+#define  STAT_SNMPINTOOBIGS                  16
+#define  STAT_SNMPINNOSUCHNAMES              17
+#define  STAT_SNMPINBADVALUES                18
+#define  STAT_SNMPINREADONLYS                19
+#define  STAT_SNMPINGENERRS                  20
+#define  STAT_SNMPINTOTALREQVARS             21
+#define  STAT_SNMPINTOTALSETVARS             22
+#define  STAT_SNMPINGETREQUESTS              23
+#define  STAT_SNMPINGETNEXTS                 24
+#define  STAT_SNMPINSETREQUESTS              25
+#define  STAT_SNMPINGETRESPONSES             26
+#define  STAT_SNMPINTRAPS                    27
+#define  STAT_SNMPOUTTOOBIGS                 28
+#define  STAT_SNMPOUTNOSUCHNAMES             29
+#define  STAT_SNMPOUTBADVALUES               30
+    /*
+     * #define  STAT_SNMPOUTREADONLYS            31 
+     */
+#define  STAT_SNMPOUTGENERRS                 32
+#define  STAT_SNMPOUTGETREQUESTS             33
+#define  STAT_SNMPOUTGETNEXTS                34
+#define  STAT_SNMPOUTSETREQUESTS             35
+#define  STAT_SNMPOUTGETRESPONSES            36
+#define  STAT_SNMPOUTTRAPS                   37
+    /*
+     * AUTHTRAPENABLE                            38 
+     */
+#define  STAT_SNMPSILENTDROPS		     39
+#define  STAT_SNMPPROXYDROPS		     40
+#define  STAT_SNMP_STATS_START               STAT_SNMPINPKTS
+#define  STAT_SNMP_STATS_END                 STAT_SNMPPROXYDROPS
+
+    /*
+     * target mib counters 
+     */
+#define  STAT_SNMPUNAVAILABLECONTEXTS	     41
+#define  STAT_SNMPUNKNOWNCONTEXTS	     42
+#define  STAT_TARGET_STATS_START             STAT_SNMPUNAVAILABLECONTEXTS
+#define  STAT_TARGET_STATS_END               STAT_SNMPUNKNOWNCONTEXTS
+
+#define  MAX_STATS                           43
+
+#ifdef __cplusplus
+}
+#endif
+#endif                          /* SNMP_API_H */
diff -Naur tomato/release/src/router/snmp/include/net-snmp/library/snmp_assert.h tomato121/release/src/router/snmp/include/net-snmp/library/snmp_assert.h
--- tomato/release/src/router/snmp/include/net-snmp/library/snmp_assert.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/include/net-snmp/library/snmp_assert.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,47 @@
+#ifndef SNMP_ASSERT_H
+#define SNMP_ASSERT_H
+
+#ifdef NETSNMP_USE_ASSERT
+#   include <assert.h>
+#else
+#   include <net-snmp/library/snmp_logging.h>
+#endif
+
+
+/*
+ * MACROs don't need extern "C"
+ */
+
+#ifdef DEBUG
+
+#ifdef NETSNMP_USE_ASSERT
+/*   void netsnmp_assert( int );*/
+#   define netsnmp_assert(x)  assert( x )
+#else
+#   ifdef  HAVE_CPP_UNDERBAR_FUNCTION_DEFINED
+#      define netsnmp_assert(x)  do { \
+                 if ( x ) \
+                    ; \
+                 else \
+                    snmp_log(LOG_ERR,"netsnmp_assert %s failed %s:%d %s()\n", \
+                             __STRING(x),__FILE__,__LINE__,__FUNCTION__); \
+              }while(0)
+#   else
+#      define netsnmp_assert(x)  do { \
+                 if( x )\
+                    ; \
+                 else \
+                    snmp_log(LOG_ERR,"netsnmp_assert %s failed %s:%d\n", \
+                             __STRING(x),__FILE__,__LINE__); \
+              }while(0)
+#   endif
+#endif
+
+#else
+
+#define netsnmp_assert(x)
+
+#endif
+
+
+#endif /* SNMP_ASSERT_H */
diff -Naur tomato/release/src/router/snmp/include/net-snmp/library/snmpCallbackDomain.h tomato121/release/src/router/snmp/include/net-snmp/library/snmpCallbackDomain.h
--- tomato/release/src/router/snmp/include/net-snmp/library/snmpCallbackDomain.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/include/net-snmp/library/snmpCallbackDomain.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,56 @@
+#ifndef _SNMPCALLBACKDOMAIN_H
+#define _SNMPCALLBACKDOMAIN_H
+
+#ifdef __cplusplus
+extern          "C" {
+#endif
+
+#include <net-snmp/library/snmp_transport.h>
+
+typedef struct netsnmp_callback_pass_s {
+    int             return_transport_num;
+    netsnmp_pdu    *pdu;
+    struct netsnmp_callback_pass_s *next;
+} netsnmp_callback_pass;
+
+typedef struct netsnmp_callback_info_s {
+    int             linkedto;
+    void           *parent_data;
+    netsnmp_callback_pass *data;
+    int             callback_num;
+    int             pipefds[2];
+} netsnmp_callback_info;
+
+netsnmp_transport *netsnmp_callback_transport(int);
+int             netsnmp_callback_hook_parse(netsnmp_session * sp,
+                                            netsnmp_pdu *pdu,
+                                            u_char * packetptr,
+                                            size_t len);
+int             netsnmp_callback_hook_build(netsnmp_session * sp,
+                                            netsnmp_pdu *pdu,
+                                            u_char * ptk, size_t * len);
+int             netsnmp_callback_check_packet(u_char * pkt, size_t len);
+netsnmp_pdu    *netsnmp_callback_create_pdu(netsnmp_transport *transport,
+                                            void *opaque, size_t olength);
+netsnmp_session *netsnmp_callback_open(int attach_to,
+                                       int (*return_func) (int op,
+                                                           netsnmp_session
+                                                           * session,
+                                                           int reqid,
+                                                           netsnmp_pdu
+                                                           *pdu,
+                                                           void *magic),
+                                       int (*fpre_parse) (netsnmp_session
+                                                          *,
+                                                          struct
+                                                          netsnmp_transport_s
+                                                          *, void *, int),
+                                       int (*fpost_parse) (netsnmp_session
+                                                           *,
+                                                           netsnmp_pdu *,
+                                                           int));
+
+#ifdef __cplusplus
+}
+#endif
+#endif/*_SNMPCALLBACKDOMAIN_H*/
diff -Naur tomato/release/src/router/snmp/include/net-snmp/library/snmp_client.h tomato121/release/src/router/snmp/include/net-snmp/library/snmp_client.h
--- tomato/release/src/router/snmp/include/net-snmp/library/snmp_client.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/include/net-snmp/library/snmp_client.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,100 @@
+/*
+ * snmp_client.h
+ */
+/***********************************************************
+	Copyright 1988, 1989 by Carnegie Mellon University
+
+                      All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its 
+documentation for any purpose and without fee is hereby granted, 
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in 
+supporting documentation, and that the name of CMU not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.  
+
+CMU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+CMU BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+******************************************************************/
+
+#ifndef SNMP_CLIENT_H
+#define SNMP_CLIENT_H
+
+#ifdef __cplusplus
+extern          "C" {
+#endif
+
+
+    struct snmp_pdu;
+    struct snmp_session;
+    struct variable_list;
+
+    struct synch_state {
+        int             waiting;
+        int             status;
+        /*
+         * status codes 
+         */
+#define STAT_SUCCESS	0
+#define STAT_ERROR	1
+#define STAT_TIMEOUT 2
+        int             reqid;
+        netsnmp_pdu    *pdu;
+    };
+
+    int             snmp_set_var_value(netsnmp_variable_list *,
+                                       const u_char *, size_t);
+    int             snmp_set_var_objid(netsnmp_variable_list * vp,
+                                       const oid * objid,
+                                       size_t name_length);
+    int             snmp_set_var_typed_value(netsnmp_variable_list *
+                                             newvar, u_char type,
+                                             const u_char * val_str,
+                                             size_t val_len);
+    void            snmp_replace_var_types(netsnmp_variable_list * vbl,
+                                           u_char old_type,
+                                           u_char new_type);
+    void            snmp_reset_var_buffers(netsnmp_variable_list * var);
+    void            snmp_reset_var_types(netsnmp_variable_list * vbl,
+                                         u_char new_type);
+    int             count_varbinds(netsnmp_variable_list * var_ptr);
+    int             count_varbinds_of_type(netsnmp_variable_list * var_ptr,
+                                           u_char type);
+    netsnmp_variable_list *find_varbind_of_type(netsnmp_variable_list *
+                                                var_ptr, u_char type);
+
+    netsnmp_variable_list *snmp_add_null_var(netsnmp_pdu *, const oid *, size_t);
+    netsnmp_pdu    *snmp_pdu_create(int);
+    netsnmp_pdu    *snmp_fix_pdu(netsnmp_pdu *, int);
+    netsnmp_pdu    *snmp_clone_pdu(netsnmp_pdu *);
+    netsnmp_pdu    *snmp_split_pdu(netsnmp_pdu *, int skipCount,
+                                   int copyCount);
+
+    unsigned long   snmp_varbind_len(netsnmp_pdu *pdu);
+    int             snmp_clone_var(netsnmp_variable_list *,
+                                   netsnmp_variable_list *);
+    netsnmp_variable_list *snmp_clone_varbind(netsnmp_variable_list *);
+    const char     *snmp_errstring(int);
+    int             snmp_synch_response(netsnmp_session *, netsnmp_pdu *,
+                                        netsnmp_pdu **);
+    int             snmp_synch_response_cb(netsnmp_session *,
+                                           netsnmp_pdu *, netsnmp_pdu **,
+                                           snmp_callback);
+    int             snmp_clone_mem(void **, void *, unsigned);
+
+    /*
+     * single session API - see snmp_api.h for full details 
+     */
+    int             snmp_sess_synch_response(void *, netsnmp_pdu *,
+                                             netsnmp_pdu **);
+
+#ifdef __cplusplus
+}
+#endif
+#endif                          /* SNMP_CLIENT_H */
diff -Naur tomato/release/src/router/snmp/include/net-snmp/library/snmp_debug.h tomato121/release/src/router/snmp/include/net-snmp/library/snmp_debug.h
--- tomato/release/src/router/snmp/include/net-snmp/library/snmp_debug.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/include/net-snmp/library/snmp_debug.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,241 @@
+#ifndef SNMP_DEBUG_H
+#define SNMP_DEBUG_H
+
+#ifdef __cplusplus
+extern          "C" {
+#endif
+
+    /*
+     * snmp_debug.h:
+     * 
+     * - prototypes for snmp debugging routines.
+     * - easy to use macros to wrap around the functions.  This also provides
+     * the ability to remove debugging code easily from the applications at
+     * compile time.
+     */
+
+
+    /*
+     * These functions should not be used, if at all possible.  Instead, use
+     * the macros below. 
+     */
+#if HAVE_STDARG_H
+    void            debugmsg(const char *token, const char *format, ...);
+    void            debugmsgtoken(const char *token, const char *format,
+                                  ...);
+#else
+    void            debugmsg(va_alist);
+    void            debugmsgtoken(va_alist);
+#endif
+    void            debugmsg_oid(const char *token, const oid * theoid,
+                                 size_t len);
+    void            debugmsg_var(const char *token,
+                                 netsnmp_variable_list * var);
+    void            debugmsg_oidrange(const char *token,
+                                      const oid * theoid, size_t len,
+                                      size_t var_subid, oid range_ubound);
+    void            debugmsg_hex(const char *token, u_char * thedata,
+                                 size_t len);
+    void            debugmsg_hextli(const char *token, u_char * thedata,
+                                    size_t len);
+    void            debug_indent_add(int amount);
+    char           *debug_indent(void);
+
+    /*
+     * Use these macros instead of the functions above to allow them to be
+     * re-defined at compile time to NOP for speed optimization.
+     * 
+     * They need to be called enclosing all the arguments in a single set of ()s.
+     * Example:
+     * DEBUGMSGTL(("token", "debugging of something %s related\n", "snmp"));
+     * 
+     * Usage:
+     * All of the functions take a "token" argument that helps determine when
+     * the output in question should be printed.  See the snmpcmd.1 manual page
+     * on the -D flag to turn on/off output for a given token on the command line.
+     * 
+     * DEBUGMSG((token, format, ...)):      equivalent to printf(format, ...)
+     * (if "token" debugging output
+     * is requested by the user)
+     * 
+     * DEBUGMSGT((token, format, ...)):     equivalent to DEBUGMSG, but prints
+     * "token: " at the beginning of the
+     * line for you.
+     * 
+     * DEBUGTRACE                           Insert this token anywhere you want
+     * tracing output displayed when the
+     * "trace" debugging token is selected.
+     * 
+     * DEBUGMSGL((token, format, ...)):     equivalent to DEBUGMSG, but includes
+     * DEBUGTRACE debugging line just before
+     * yours.
+     * 
+     * DEBUGMSGTL((token, format, ...)):    Same as DEBUGMSGL and DEBUGMSGT
+     * combined.
+     * 
+     * Important:
+     * It is considered best if you use DEBUGMSGTL() everywhere possible, as it
+     * gives the nicest format output and provides tracing support just before
+     * every debugging statement output.
+     * 
+     * To print multiple pieces to a single line in one call, use:
+     * 
+     * DEBUGMSGTL(("token", "line part 1"));
+     * DEBUGMSG  (("token", " and part 2\n"));
+     * 
+     * to get:
+     * 
+     * token: line part 1 and part 2
+     * 
+     * as debugging output.
+     */
+
+#ifndef SNMP_NO_DEBUGGING       /* make sure we're wanted */
+
+    /*
+     * define two macros : one macro with, one without,
+     *                     a test if debugging is enabled.
+     * 
+     * Generally, use the macro with _DBG_IF_
+     */
+
+/******************* Start private macros ************************/
+#define _DBG_IF_            snmp_get_do_debugging()
+#define DEBUGIF(x)         if (_DBG_IF_ && debug_is_token_registered(x) == SNMPERR_SUCCESS)
+
+#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
+
+#ifdef  HAVE_CPP_UNDERBAR_FUNCTION_DEFINED
+#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d\n",__FUNCTION__,\
+                                 __FILE__,__LINE__))
+#else
+#define __DBGTRACE       __DBGMSGT(("trace"," %s, %d\n", __FILE__,__LINE__))
+#endif
+
+#define __DBGMSGL(x)     __DBGTRACE, debugmsg x
+#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
+#define __DBGMSGOID(x)     debugmsg_oid x
+#define __DBGMSGVAR(x)     debugmsg_var x
+#define __DBGMSGOIDRANGE(x) debugmsg_oidrange x
+#define __DBGMSGHEX(x)     debugmsg_hex x
+#define __DBGMSGHEXTLI(x)  debugmsg_hextli x
+#define __DBGINDENT()      debug_indent()
+#define __DBGINDENTADD(x)  debug_indent_add(x)
+#define __DBGINDENTMORE()  debug_indent_add(2)
+#define __DBGINDENTLESS()  debug_indent_add(-2)
+#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%s", __DBGINDENT()))
+
+#define __DBGDUMPHEADER(token,x) \
+        __DBGPRINTINDENT("dumph_" token); \
+        debugmsg("dumph_" token,x); \
+        if (debug_is_token_registered("dumpx" token) == SNMPERR_SUCCESS ||    \
+            debug_is_token_registered("dumpv" token) == SNMPERR_SUCCESS ||    \
+            (debug_is_token_registered("dumpx_" token) != SNMPERR_SUCCESS &&  \
+             debug_is_token_registered("dumpv_" token) != SNMPERR_SUCCESS)) { \
+            debugmsg("dumph_" token,"\n"); \
+        } else { \
+            debugmsg("dumph_" token,"  "); \
+        } \
+        __DBGINDENTMORE()
+
+#define __DBGDUMPSECTION(token,x) \
+        __DBGPRINTINDENT("dumph_" token); \
+        debugmsg("dumph_" token,x); \
+        debugmsg("dumph_" token,"\n"); \
+        __DBGINDENTMORE()
+
+#define __DBGDUMPSETUP(token,buf,len) \
+        debugmsg("dumpx" token, "dumpx_%s:%s", token, __DBGINDENT()); \
+        __DBGMSGHEX(("dumpx_" token,buf,len)); \
+        if (debug_is_token_registered("dumpv" token) == SNMPERR_SUCCESS || \
+            debug_is_token_registered("dumpv_" token) != SNMPERR_SUCCESS) { \
+            debugmsg("dumpx_" token,"\n"); \
+        } else { \
+            debugmsg("dumpx_" token,"  "); \
+        } \
+        debugmsg("dumpv" token, "dumpv_%s:%s", token, __DBGINDENT());
+
+/******************* End   private macros ************************/
+/*****************************************************************/
+
+/*****************************************************************/
+/********************Start public  macros ************************/
+
+#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
+#define DEBUGMSGT(x)       do {if (_DBG_IF_) {__DBGMSGT(x);} }while(0)
+#define DEBUGTRACE         do {if (_DBG_IF_) {__DBGTRACE;} }while(0)
+#define DEBUGMSGL(x)       do {if (_DBG_IF_) {__DBGMSGL(x);} }while(0)
+#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
+#define DEBUGMSGOID(x)     do {if (_DBG_IF_) {__DBGMSGOID(x);} }while(0)
+#define DEBUGMSGVAR(x)     do {if (_DBG_IF_) {__DBGMSGVAR(x);} }while(0)
+#define DEBUGMSGOIDRANGE(x) do {if (_DBG_IF_) {__DBGMSGOIDRANGE(x);} }while(0)
+#define DEBUGMSGHEX(x)     do {if (_DBG_IF_) {__DBGMSGHEX(x);} }while(0)
+#define DEBUGMSGHEXTLI(x)  do {if (_DBG_IF_) {__DBGMSGHEXTLI(x);} }while(0)
+#define DEBUGINDENT()      do {if (_DBG_IF_) {__DBGINDENT();} }while(0)
+#define DEBUGINDENTADD(x)  do {if (_DBG_IF_) {__DBGINDENTADD(x);} }while(0)
+#define DEBUGINDENTMORE()  do {if (_DBG_IF_) {__DBGINDENTMORE();} }while(0)
+#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
+#define DEBUGPRINTINDENT(token) \
+	do {if (_DBG_IF_) {__DBGPRINTINDENT(token);} }while(0)
+
+
+#define DEBUGDUMPHEADER(token,x) \
+	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
+
+#define DEBUGDUMPSECTION(token,x) \
+	do {if (_DBG_IF_) {__DBGDUMPSECTION(token,x);} }while(0)
+
+#define DEBUGDUMPSETUP(token,buf,len) \
+	do {if (_DBG_IF_) {__DBGDUMPSETUP(token,buf,len);} }while(0)
+
+#else                           /* SNMP_NO_DEBUGGING := enable streamlining of the code */
+
+#define DEBUGMSG(x)
+#define DEBUGMSGT(x)
+#define DEBUGTRACE
+#define DEBUGMSGL(x)
+#define DEBUGMSGTL(x)
+#define DEBUGMSGOID(x)
+#define DEBUGMSGVAR(x)
+#define DEBUGMSGOIDRANGE(x)
+#define DEBUGMSGHEX(x)
+#define DEBUGIF(x)        if(0)
+#define DEBUGDUMP(t,b,l,p)
+#define DEBUGINDENT()
+#define DEBUGINDENTMORE()
+#define DEBUGINDENTLESS()
+#define DEBUGINDENTADD(x)
+#define DEBUGMSGHEXTLI(x)
+#define DEBUGPRINTINDENT(token)
+#define DEBUGDUMPHEADER(token,x)
+#define DEBUGDUMPSECTION(token,x)
+#define DEBUGDUMPSETUP(token, buf, len)
+
+#endif
+
+#define MAX_DEBUG_TOKENS 256
+#define MAX_DEBUG_TOKEN_LEN 128
+#define DEBUG_TOKEN_DELIMITER ","
+#define DEBUG_ALWAYS_TOKEN "all"
+
+    /*
+     * setup routines:
+     * 
+     * debug_register_tokens(char *):     registers a list of tokens to
+     * print debugging output for.
+     * 
+     * debug_is_token_registered(char *): returns SNMPERR_SUCCESS or SNMPERR_GENERR
+     * if a token has been registered or
+     * not (and debugging output is "on").
+     * snmp_debug_init(void):             registers .conf handlers.
+     */
+    void            debug_register_tokens(char *tokens);
+    int             debug_is_token_registered(const char *token);
+    void            snmp_debug_init(void);
+    void            snmp_set_do_debugging(int);
+    int             snmp_get_do_debugging(void);
+
+#ifdef __cplusplus
+}
+#endif
+#endif                          /* SNMP_DEBUG_H */
diff -Naur tomato/release/src/router/snmp/include/net-snmp/library/snmp_enum.h tomato121/release/src/router/snmp/include/net-snmp/library/snmp_enum.h
--- tomato/release/src/router/snmp/include/net-snmp/library/snmp_enum.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/include/net-snmp/library/snmp_enum.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,81 @@
+#ifndef SNMP_ENUM_H
+#define SNMP_ENUM_H
+
+#ifdef __cplusplus
+extern          "C" {
+#endif
+
+    struct snmp_enum_list {
+        struct snmp_enum_list *next;
+        int             value;
+        char           *label;
+    };
+
+#define SE_MAX_IDS 5
+#define SE_MAX_SUBIDS 32        /* needs to be a multiple of 8 */
+
+    /*
+     * begin storage definitions 
+     */
+    /*
+     * These definitions correspond with the "storid" argument to the API 
+     */
+#define SE_LIBRARY_ID     0
+#define SE_MIB_ID         1
+#define SE_APPLICATION_ID 2
+#define SE_ASSIGNED_ID    3
+
+    /*
+     * library specific enum locations 
+     */
+
+    /*
+     * error codes 
+     */
+#define SE_OK            0
+#define SE_NOMEM         1
+#define SE_ALREADY_THERE 2
+#define SE_DNE           -2
+
+    int             init_snmp_enum(void);
+    struct snmp_enum_list *se_find_list(unsigned int major,
+                                        unsigned int minor);
+    int             se_store_list(struct snmp_enum_list *,
+                                  unsigned int major, unsigned int minor);
+    struct snmp_enum_list *se_find_list(unsigned int major,
+                                        unsigned int minor);
+    int             se_find_value(unsigned int major, unsigned int minor,
+                                  char *label);
+    char           *se_find_label(unsigned int major, unsigned int minor,
+                                  int value);
+    int             se_add_pair(unsigned int major, unsigned int minor,
+                                char *label, int value);
+
+    /*
+     * finds a list of enums in a list of enum structs associated by a name. 
+     */
+    /*
+     * not as fast as the above routines, since two lists must be traversed. 
+     */
+    char           *se_find_label_in_slist(const char *listname,
+                                           int value);
+    int             se_find_value_in_slist(const char *listname,
+                                           char *label);
+    int             se_add_pair_to_slist(const char *listname, char *label,
+                                         int value);
+
+    /*
+     * operates directly on a possibly external list 
+     */
+    char           *se_find_label_in_list(struct snmp_enum_list *list,
+                                          int value);
+    int             se_find_value_in_list(struct snmp_enum_list *list,
+                                          char *label);
+    int             se_add_pair_to_list(struct snmp_enum_list **list,
+                                        char *label, int value);
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif                          /* SNMP_ENUM_H */
diff -Naur tomato/release/src/router/snmp/include/net-snmp/library/snmp.h tomato121/release/src/router/snmp/include/net-snmp/library/snmp.h
--- tomato/release/src/router/snmp/include/net-snmp/library/snmp.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/include/net-snmp/library/snmp.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,312 @@
+#ifndef SNMP_H
+#define SNMP_H
+
+#ifdef __cplusplus
+extern          "C" {
+#endif
+    /*
+     * Definitions for the Simple Network Management Protocol (RFC 1067).
+     *
+     *
+     */
+/***********************************************************
+	Copyright 1988, 1989 by Carnegie Mellon University
+
+                      All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its 
+documentation for any purpose and without fee is hereby granted, 
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in 
+supporting documentation, and that the name of CMU not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.  
+
+CMU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+CMU BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+******************************************************************/
+
+
+#define SNMP_PORT	    161 /* standard UDP port for SNMP agents
+                                 * to receive requests messages */
+#define SNMP_TRAP_PORT	    162 /* standard UDP port for SNMP
+                                 * managers to receive notificaion
+                                 * (trap and inform) messages */
+
+#define SNMP_MAX_LEN	    1500        /* typical maximum message size */
+#define SNMP_MIN_MAX_LEN    484 /* minimum maximum message size */
+
+    /*
+     * SNMP versions 
+     */
+    /*
+     * There currently exists the following SNMP versions.
+     * * (Note that only SNMPv1 is in widespread usage, and this code supports
+     * *  only SNMPv1, SNMPv2c, and SNMPv3.
+     * *
+     * *  SNMPv1 - (full) the original version, defined by RFC 1157
+     * *  SNMPsec - (historic) the first attempt to add strong security
+     * *             to SNMPv1, defined by RFCs 1351, 1352, and 1353.
+     * *  SNMPv2p - (historic) party-based SNMP, which was another
+     * *             attempt to add strong security to SNMP, defined
+     * *             by RFCs 1441, 1445, 1446, 1448, and 1449.
+     * *  SNMPv2c - (experimental) community string-based SNMPv2,
+     * *             which was an attempt to combine the protocol
+     * *             operations of SNMPv2 with the security of
+     * *             SNMPv1, defined by RFCs 1901, 1905, and 1906.
+     * *  SNMPv2u - (experimental) user-based SNMPv2, which provided
+     * *             security based on user names and protocol
+     * *             operations of SNMPv2, defined by RFCs 1905,
+     * *             1909, and 1910.
+     * *  SNMPv2* (or SNMPv2star) - (experimental) an attempt to add the
+     * *             best features of SNMPv2p and SNMPv2u, defined
+     * *             by unpublished documents found at WEB site
+     * *             owned by SNMP Research (a leading SNMP vendor)
+     * *  SNMPv3 - the current attempt by the IETF working group to merge
+     * *             the SNMPv2u and SNMPv2* proposals into a more widly
+     * *             accepted SNMPv3.  It is defined by not yet published
+     * *             documents of the IETF SNMPv3 WG.
+     * *
+     * * SNMPv1, SNMPv2c, SNMPv2u, and SNMPv3 messages have a common
+     * * form, which is an ASN.1 sequence containing a message version 
+     * * field, followed by version dependent fields.
+     * * SNMPsec, SNMPv2p, and SNMPv2* messages have a common form,
+     * * which is a tagged ASN.1 context specific sequence containing
+     * * message dependent fields.
+     * *
+     * * In the #defines for the message versions below, the value
+     * * for SNMPv1, SNMPv2c, SNMPv2u, and SNMPv3 messages is the
+     * * value of the message version field. Since SNMPsec, SNMPv2p,
+     * * and SNMPv2* messages do not have a message version field,
+     * * the value in the defines for them is choosen to be a large
+     * * arbitrary number.
+     * *
+     * * Note that many of the version ID's are defined below purely for
+     * * documentational purposes.  At this point the only protocol planned
+     * * for future implementations is SNMP3, as the other v2 protocols will
+     * * not be supported by the IETF (ie, v2u, v2sec, v2star) or used by
+     * * the snmp community at large (at the time of this writing).  
+     */
+
+    /*
+     * versions based on version field 
+     */
+#define SNMP_VERSION_1	   0
+#define SNMP_VERSION_2c    1
+#define SNMP_VERSION_2u    2    /* not (will never be) supported by this code */
+#define SNMP_VERSION_3     3
+
+    /*
+     * versions not based on a version field 
+     */
+#define SNMP_VERSION_sec   128  /* not (will never be) supported by this code */
+#define SNMP_VERSION_2p	   129
+#define SNMP_VERSION_2star 130  /* not (will never be) supported by this code */
+
+    /*
+     * PDU types in SNMPv1, SNMPsec, SNMPv2p, SNMPv2c, SNMPv2u, SNMPv2*, and SNMPv3 
+     */
+#define SNMP_MSG_GET	    (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x0)
+#define SNMP_MSG_GETNEXT    (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x1)
+#define SNMP_MSG_RESPONSE   (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x2)
+#define SNMP_MSG_SET	    (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x3)
+
+    /*
+     * PDU types in SNMPv1 and SNMPsec 
+     */
+#define SNMP_MSG_TRAP	    (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x4)       /* c4 = 196 */
+
+    /*
+     * PDU types in SNMPv2p, SNMPv2c, SNMPv2u, SNMPv2*, and SNMPv3 
+     */
+#define SNMP_MSG_GETBULK    (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x5)       /* c5 = 197 */
+#define SNMP_MSG_INFORM	    (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x6)       /* c6 = 198 */
+#define SNMP_MSG_TRAP2	    (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x7)       /* c7 = 199 */
+
+    /*
+     * PDU types in SNMPv2u, SNMPv2*, and SNMPv3 
+     */
+#define SNMP_MSG_REPORT	    (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x8)       /* c8 = 200 */
+
+    /*
+     * internal modes that should never be used by the protocol for the
+     * pdu type. 
+     */
+#define SNMP_MSG_INTERNAL_SET_BEGIN        -1
+#define SNMP_MSG_INTERNAL_SET_RESERVE1     0    /* these should match snmp.h */
+#define SNMP_MSG_INTERNAL_SET_RESERVE2     1
+#define SNMP_MSG_INTERNAL_SET_ACTION       2
+#define SNMP_MSG_INTERNAL_SET_COMMIT       3
+#define SNMP_MSG_INTERNAL_SET_FREE         4
+#define SNMP_MSG_INTERNAL_SET_UNDO         5
+
+    /*
+     * test for member of Confirmed Class i.e., reportable 
+     */
+#define SNMP_CMD_CONFIRMED(c) (c == SNMP_MSG_INFORM || c == SNMP_MSG_GETBULK ||\
+                               c == SNMP_MSG_GETNEXT || c == SNMP_MSG_GET || \
+                               c == SNMP_MSG_SET)
+
+    /*
+     * Exception values for SNMPv2p, SNMPv2c, SNMPv2u, SNMPv2*, and SNMPv3 
+     */
+#define SNMP_NOSUCHOBJECT    (ASN_CONTEXT | ASN_PRIMITIVE | 0x0)        /* 80 = 128 */
+#define SNMP_NOSUCHINSTANCE  (ASN_CONTEXT | ASN_PRIMITIVE | 0x1)        /* 81 = 129 */
+#define SNMP_ENDOFMIBVIEW    (ASN_CONTEXT | ASN_PRIMITIVE | 0x2)        /* 82 = 130 */
+
+    /*
+     * Error codes (the value of the field error-status in PDUs) 
+     */
+
+    /*
+     * in SNMPv1, SNMPsec, SNMPv2p, SNMPv2c, SNMPv2u, SNMPv2*, and SNMPv3 PDUs 
+     */
+#define SNMP_ERR_NOERROR                (0)     /* XXX  Used only for PDUs? */
+#define SNMP_ERR_TOOBIG	                (1)
+#define SNMP_ERR_NOSUCHNAME             (2)
+#define SNMP_ERR_BADVALUE               (3)
+#define SNMP_ERR_READONLY               (4)
+#define SNMP_ERR_GENERR	                (5)
+
+    /*
+     * in SNMPv2p, SNMPv2c, SNMPv2u, SNMPv2*, and SNMPv3 PDUs 
+     */
+#define SNMP_ERR_NOACCESS		(6)
+#define SNMP_ERR_WRONGTYPE		(7)
+#define SNMP_ERR_WRONGLENGTH		(8)
+#define SNMP_ERR_WRONGENCODING		(9)
+#define SNMP_ERR_WRONGVALUE		(10)
+#define SNMP_ERR_NOCREATION		(11)
+#define SNMP_ERR_INCONSISTENTVALUE	(12)
+#define SNMP_ERR_RESOURCEUNAVAILABLE	(13)
+#define SNMP_ERR_COMMITFAILED		(14)
+#define SNMP_ERR_UNDOFAILED		(15)
+#define SNMP_ERR_AUTHORIZATIONERROR	(16)
+#define SNMP_ERR_NOTWRITABLE		(17)
+
+    /*
+     * in SNMPv2c, SNMPv2u, SNMPv2*, and SNMPv3 PDUs 
+     */
+#define SNMP_ERR_INCONSISTENTNAME	(18)
+
+#define MAX_SNMP_ERR	18
+
+
+    /*
+     * values of the generic-trap field in trap PDUs 
+     */
+#define SNMP_TRAP_COLDSTART		(0)
+#define SNMP_TRAP_WARMSTART		(1)
+#define SNMP_TRAP_LINKDOWN		(2)
+#define SNMP_TRAP_LINKUP		(3)
+#define SNMP_TRAP_AUTHFAIL		(4)
+#define SNMP_TRAP_EGPNEIGHBORLOSS	(5)
+#define SNMP_TRAP_ENTERPRISESPECIFIC	(6)
+
+    /*
+     * row status values 
+     */
+#define SNMP_ROW_NONEXISTENT		0
+#define SNMP_ROW_ACTIVE			1
+#define SNMP_ROW_NOTINSERVICE		2
+#define SNMP_ROW_NOTREADY		3
+#define SNMP_ROW_CREATEANDGO		4
+#define SNMP_ROW_CREATEANDWAIT		5
+#define SNMP_ROW_DESTROY		6
+
+    /*
+     * row storage values 
+     */
+#define SNMP_STORAGE_NONE  0
+#define SNMP_STORAGE_OTHER		1
+#define SNMP_STORAGE_VOLATILE		2
+#define SNMP_STORAGE_NONVOLATILE	3
+#define SNMP_STORAGE_PERMANENT		4
+#define SNMP_STORAGE_READONLY		5
+
+    /*
+     * message processing models 
+     */
+#define SNMP_MP_MODEL_SNMPv1		0
+#define SNMP_MP_MODEL_SNMPv2c		1
+#define SNMP_MP_MODEL_SNMPv2u		2
+#define SNMP_MP_MODEL_SNMPv3		3
+#define SNMP_MP_MODEL_SNMPv2p		256
+
+    /*
+     * security values 
+     */
+#define SNMP_SEC_MODEL_ANY		0
+#define SNMP_SEC_MODEL_SNMPv1		1
+#define SNMP_SEC_MODEL_SNMPv2c		2
+#define SNMP_SEC_MODEL_USM		3
+#define SNMP_SEC_MODEL_SNMPv2p		256
+
+#define SNMP_SEC_LEVEL_NOAUTH		1
+#define SNMP_SEC_LEVEL_AUTHNOPRIV	2
+#define SNMP_SEC_LEVEL_AUTHPRIV		3
+
+#define SNMP_MSG_FLAG_AUTH_BIT          0x01
+#define SNMP_MSG_FLAG_PRIV_BIT          0x02
+#define SNMP_MSG_FLAG_RPRT_BIT          0x04
+
+    /*
+     * control PDU handling characteristics 
+     */
+#define UCD_MSG_FLAG_RESPONSE_PDU            0x100
+#define UCD_MSG_FLAG_EXPECT_RESPONSE         0x200
+#define UCD_MSG_FLAG_FORCE_PDU_COPY          0x400
+#define UCD_MSG_FLAG_ALWAYS_IN_VIEW          0x800
+#define UCD_MSG_FLAG_PDU_TIMEOUT            0x1000
+#define UCD_MSG_FLAG_ONE_PASS_ONLY          0x2000
+
+    /*
+     * view status 
+     */
+#define SNMP_VIEW_INCLUDED		1
+#define SNMP_VIEW_EXCLUDED		2
+
+    /*
+     * basic oid values 
+     */
+#define SNMP_OID_INTERNET		1, 3, 6, 1
+#define SNMP_OID_ENTERPRISES		SNMP_OID_INTERNET, 4, 1
+#define SNMP_OID_MIB2			SNMP_OID_INTERNET, 2, 1
+#define SNMP_OID_SNMPV2			SNMP_OID_INTERNET, 6
+#define SNMP_OID_SNMPMODULES		SNMP_OID_SNMPV2, 3
+
+    /*
+     * lengths as defined by TCs 
+     */
+#define SNMPADMINLENGTH 255
+
+
+    char           *uptime_string(u_long, char *);
+    void            xdump(const u_char *, size_t, const char *);
+    u_char         *snmp_parse_var_op(u_char *, oid *, size_t *, u_char *,
+                                      size_t *, u_char **, size_t *);
+    u_char         *snmp_build_var_op(u_char *, oid *, size_t *, u_char,
+                                      size_t, u_char *, size_t *);
+
+
+#ifdef USE_REVERSE_ASNENCODING
+    int             snmp_realloc_rbuild_var_op(u_char ** pkt,
+                                               size_t * pkt_len,
+                                               size_t * offset,
+                                               int allow_realloc,
+                                               const oid * name,
+                                               size_t * name_len,
+                                               u_char value_type,
+                                               u_char * value,
+                                               size_t value_length);
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+#endif                          /* SNMP_H */
diff -Naur tomato/release/src/router/snmp/include/net-snmp/library/snmp_impl.h tomato121/release/src/router/snmp/include/net-snmp/library/snmp_impl.h
--- tomato/release/src/router/snmp/include/net-snmp/library/snmp_impl.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/include/net-snmp/library/snmp_impl.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,141 @@
+#ifndef SNMP_IMPL_H
+#define SNMP_IMPL_H
+
+#ifdef __cplusplus
+extern          "C" {
+#endif
+    /*
+     * * file: snmp_impl.h
+     */
+
+    /*
+     * Definitions for SNMP implementation.
+     *
+     *
+     */
+/***********************************************************
+	Copyright 1988, 1989 by Carnegie Mellon University
+
+                      All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its 
+documentation for any purpose and without fee is hereby granted, 
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in 
+supporting documentation, and that the name of CMU not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.  
+
+CMU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+CMU BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+******************************************************************/
+
+#include<stdio.h>
+#include<net-snmp/types.h>      /* for 'u_char', etc */
+
+#define COMMUNITY_MAX_LEN	256
+
+    /*
+     * Space for character representation of an object identifier 
+     */
+#define SPRINT_MAX_LEN		2560
+
+
+#ifndef NULL
+#define NULL 0
+#endif
+
+#ifndef TRUE
+#define TRUE	1
+#endif
+#ifndef FALSE
+#define FALSE	0
+#endif
+
+#define READ	    1
+#define WRITE	    0
+
+#define RESERVE1    0
+#define RESERVE2    1
+#define ACTION	    2
+#define COMMIT      3
+#define FREE        4
+#define UNDO        5
+#define FINISHED_SUCCESS        9
+#define FINISHED_FAILURE	10
+
+    /*
+     * Access control statements for the agent 
+     */
+#define RONLY	0x1             /* read access only */
+#define RWRITE	0x2             /* read and write access (must have 0x2 bit set) */
+
+#define NOACCESS 0x0000         /* no access for anybody */
+
+    /*
+     * defined types (from the SMI, RFC 1157) 
+     */
+#define ASN_IPADDRESS   (ASN_APPLICATION | 0)
+#define ASN_COUNTER	(ASN_APPLICATION | 1)
+#define ASN_GAUGE	(ASN_APPLICATION | 2)
+#define ASN_UNSIGNED    (ASN_APPLICATION | 2)   /* RFC 1902 - same as GAUGE */
+#define ASN_TIMETICKS   (ASN_APPLICATION | 3)
+#define ASN_OPAQUE	(ASN_APPLICATION | 4)   /* changed so no conflict with other includes */
+
+    /*
+     * defined types (from the SMI, RFC 1442) 
+     */
+#define ASN_NSAP	(ASN_APPLICATION | 5)   /* historic - don't use */
+#define ASN_COUNTER64   (ASN_APPLICATION | 6)
+#define ASN_UINTEGER    (ASN_APPLICATION | 7)   /* historic - don't use */
+
+#ifdef OPAQUE_SPECIAL_TYPES
+    /*
+     * defined types from draft-perkins-opaque-01.txt 
+     */
+#define ASN_FLOAT	    (ASN_APPLICATION | 8)
+#define ASN_DOUBLE	    (ASN_APPLICATION | 9)
+#define ASN_INTEGER64        (ASN_APPLICATION | 10)
+#define ASN_UNSIGNED64       (ASN_APPLICATION | 11)
+#endif                          /* OPAQUE_SPECIAL_TYPES */
+
+    /*
+     * changed to ERROR_MSG to eliminate conflict with other includes 
+     */
+#ifndef ERROR_MSG
+#define ERROR_MSG(string)	snmp_set_detail(string)
+#endif
+
+    /*
+     * from snmp.c 
+     */
+    extern u_char   sid[];      /* size SID_MAX_LEN */
+    extern int      snmp_errno;
+
+
+    /*
+     * For calling secauth_build, FIRST_PASS is an indication that a new nonce
+     * and lastTimeStamp should be recorded.  LAST_PASS is an indication that
+     * the packet should be checksummed and encrypted if applicable, in
+     * preparation for transmission.
+     * 0 means do neither, FIRST_PASS | LAST_PASS means do both.
+     * For secauth_parse, FIRST_PASS means decrypt the packet, otherwise leave it
+     * alone.  LAST_PASS is ignored.
+     */
+#define FIRST_PASS	1
+#define	LAST_PASS	2
+    u_char         *snmp_comstr_parse(u_char *, size_t *, u_char *,
+                                      size_t *, long *);
+    u_char         *snmp_comstr_build(u_char *, size_t *, u_char *,
+                                      size_t *, long *, size_t);
+
+    int             has_access(u_char, int, int, int);
+#ifdef __cplusplus
+}
+#endif
+#endif                          /* SNMP_IMPL_H */
diff -Naur tomato/release/src/router/snmp/include/net-snmp/library/snmpIPXDomain.h tomato121/release/src/router/snmp/include/net-snmp/library/snmpIPXDomain.h
--- tomato/release/src/router/snmp/include/net-snmp/library/snmpIPXDomain.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/include/net-snmp/library/snmpIPXDomain.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,35 @@
+#ifndef _SNMPIPXDOMAIN_H
+#define _SNMPIPXDOMAIN_H
+
+#ifdef __cplusplus
+extern          "C" {
+#endif
+
+#include <net-snmp/library/snmp_transport.h>
+#include <net-snmp/library/asn1.h>
+#if HAVE_NETIPX_IPX_H
+#include <netipx/ipx.h>
+#endif
+
+
+netsnmp_transport *netsnmp_ipx_transport(struct sockaddr_ipx *addr, int local);
+
+/*
+ * Convert an textually formatted IPX address into a sockaddr_ipx
+ * structure which is written to *addr.  Returns 1 if the conversion
+ * was successful, or 0 if it failed.  
+ */
+
+int             netsnmp_sockaddr_ipx(struct sockaddr_ipx *addr,
+                                     const char *peername);
+
+/*
+ * "Constructor" for transport domain object.  
+ */
+
+void            netsnmp_ipx_ctor(void);
+
+#ifdef __cplusplus
+}
+#endif
+#endif/*_SNMPIPXDOMAIN_H*/
diff -Naur tomato/release/src/router/snmp/include/net-snmp/library/snmpksm.h tomato121/release/src/router/snmp/include/net-snmp/library/snmpksm.h
--- tomato/release/src/router/snmp/include/net-snmp/library/snmpksm.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/include/net-snmp/library/snmpksm.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,31 @@
+/*
+ * Header file for Kerberos Security Model support
+ */
+
+#ifndef SNMPKSM_H
+#define SNMPKSM_H
+
+#ifdef __cplusplus
+extern          "C" {
+#endif
+
+    int             ksm_rgenerate_out_msg(struct
+                                          snmp_secmod_outgoing_params *);
+    int             ksm_process_in_msg(struct snmp_secmod_incoming_params
+                                       *);
+    void            init_usm(void);
+
+    /*
+     * This is the "key usage" that is used by the new crypto API.  It's used
+     * generally only if you are using derived keys.  The specifical says that
+     * 1024-2047 are to be used by applications, and that even usage numbers are
+     * to be used for encryption and odd numbers are to be used for checksums.
+     */
+
+#define KSM_KEY_USAGE_ENCRYPTION	1030
+#define KSM_KEY_USAGE_CHECKSUM		1031
+
+#ifdef __cplusplus
+}
+#endif
+#endif                          /* SNMPKSM_H */
diff -Naur tomato/release/src/router/snmp/include/net-snmp/library/snmp_locking.h tomato121/release/src/router/snmp/include/net-snmp/library/snmp_locking.h
--- tomato/release/src/router/snmp/include/net-snmp/library/snmp_locking.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/include/net-snmp/library/snmp_locking.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,56 @@
+
+/*
+ * snmp_locking.h - multi-thread resource locking support declarations 
+ */
+/*
+ * Author: Markku Laukkanen
+ * Created: 6-Sep-1999
+ * History:
+ *  8-Sep-1999 M. Slifcak method names changed;
+ *                        use array of resource locking structures.
+ *  3-Jan-2001 R. Story   copy mt_resource.h to snmp_locking.h
+ */
+
+#ifndef SNMP_LOCKING_H
+#define SNMP_LOCKING_H
+
+#ifdef __cplusplus
+extern          "C" {
+#endif
+
+#ifdef NS_REENTRANT
+
+#if HAVE_PTHREAD_H
+#include <pthread.h>
+typedef pthread_mutex_t mutex_type;
+#ifdef pthread_mutexattr_default
+#define MT_MUTEX_INIT_DEFAULT pthread_mutexattr_default
+#else
+#define MT_MUTEX_INIT_DEFAULT 0
+#endif
+
+#elif defined(WIN32) || defined(cygwin)
+#include <windows.h>
+typedef CRITICAL_SECTION mutex_type;
+#else
+                    error "There is no re-entrant support as defined."
+#endif  /*  HAVE_PTHREAD_H  */
+
+int	netsnmp_mutex_init(mutex_type *);
+int     netsnmp_mutex_lock(mutex_type *);
+int     netsnmp_mutex_unlock(mutex_type *);
+int     netsnmp_mutex_destroy_mutex(mutex_type *);
+
+#else                           /* !NS_REENTRANT */
+
+#define netsnmp_mutex_init(x) do {} while (0)
+#define netsnmp_mutex_lock(x) do {} while (0)
+#define netsnmp_mutex_unlock(x) do {} while (0)
+#define netsnmp_mutex_destroy_mutex(x) do {} while (0)
+
+#endif                          /* !NS_REENTRANT */
+
+#ifdef __cplusplus
+}
+#endif
+#endif /*  SNMP_LOCKING_H  */
diff -Naur tomato/release/src/router/snmp/include/net-snmp/library/snmp_logging.h tomato121/release/src/router/snmp/include/net-snmp/library/snmp_logging.h
--- tomato/release/src/router/snmp/include/net-snmp/library/snmp_logging.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/include/net-snmp/library/snmp_logging.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,77 @@
+#ifndef SNMP_LOGGING_H
+#define SNMP_LOGGING_H
+
+#ifdef __cplusplus
+extern          "C" {
+#endif
+
+#if HAVE_SYSLOG_H
+#include <syslog.h>
+#endif
+#if HAVE_STDARG_H
+#include <stdarg.h>
+#else
+#include <varargs.h>
+#endif
+
+#ifndef LOG_ERR
+#define LOG_EMERG       0       /* system is unusable */
+#define LOG_ALERT       1       /* action must be taken immediately */
+#define LOG_CRIT        2       /* critical conditions */
+#define LOG_ERR         3       /* error conditions */
+#define LOG_WARNING     4       /* warning conditions */
+#define LOG_NOTICE      5       /* normal but significant condition */
+#define LOG_INFO        6       /* informational */
+#define LOG_DEBUG       7       /* debug-level messages */
+#endif
+
+    struct snmp_log_message {
+        int             priority;
+        const char     *msg;
+    };
+
+#ifndef DEFAULT_LOG_ID
+#define DEFAULT_LOG_ID "net-snmp"
+#endif
+
+    void            init_snmp_logging(void);
+    int             snmp_get_do_logging(void);
+    void            snmp_disable_syslog(void);
+    void            snmp_disable_filelog(void);
+    void            snmp_disable_stderrlog(void);
+    void            snmp_disable_calllog(void);
+    void            snmp_disable_log(void);
+    void            snmp_enable_syslog(void);
+    void            snmp_enable_syslog_ident(const char *ident,
+                                             const int   facility);
+    void            snmp_enable_filelog(const char *logfilename,
+                                        int dont_zero_log);
+    void            snmp_enable_stderrlog(void);
+    void            snmp_enable_calllog(void);
+
+#if HAVE_STDARG_H
+    int             snmp_log(int priority, const char *format, ...);
+#else
+    int             snmp_log(va_alist);
+#endif
+    int             snmp_vlog(int priority, const char *format,
+                              va_list ap);
+    /*
+     * 0 - successful message formatting 
+     */
+    /*
+     * -1 - Could not format log-string 
+     */
+    /*
+     * -2 - Could not allocate memory for log-message 
+     */
+    /*
+     * -3 - Log-message too long! 
+     */
+
+    void            snmp_log_perror(const char *s);
+
+#ifdef __cplusplus
+}
+#endif
+#endif                          /* SNMP_LOGGING_H */
diff -Naur tomato/release/src/router/snmp/include/net-snmp/library/snmp_parse_args.h tomato121/release/src/router/snmp/include/net-snmp/library/snmp_parse_args.h
--- tomato/release/src/router/snmp/include/net-snmp/library/snmp_parse_args.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/include/net-snmp/library/snmp_parse_args.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,17 @@
+#ifndef SNMP_PARSE_ARGS_H
+#define SNMP_PARSE_ARGS_H
+#ifdef __cplusplus
+extern          "C" {
+#endif
+
+    int             snmp_parse_args(int, char *const *, netsnmp_session *,
+                                    const char *, void (*)(int,
+                                                           char *const *,
+                                                           int));
+    void            snmp_parse_args_descriptions(FILE *);
+    void            snmp_parse_args_usage(FILE *);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff -Naur tomato/release/src/router/snmp/include/net-snmp/library/snmp_secmod.h tomato121/release/src/router/snmp/include/net-snmp/library/snmp_secmod.h
--- tomato/release/src/router/snmp/include/net-snmp/library/snmp_secmod.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/include/net-snmp/library/snmp_secmod.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,141 @@
+#ifndef SNMPSECMOD_H
+#define SNMPSECMOD_H
+
+#ifdef __cplusplus
+extern          "C" {
+#endif
+
+struct snmp_secmod_def;
+
+/*
+ * parameter information passed to security model routines
+ */
+struct snmp_secmod_outgoing_params {
+    int             msgProcModel;
+    u_char         *globalData;
+    size_t          globalDataLen;
+    int             maxMsgSize;
+    int             secModel;
+    u_char         *secEngineID;
+    size_t          secEngineIDLen;
+    char           *secName;
+    size_t          secNameLen;
+    int             secLevel;
+    u_char         *scopedPdu;
+    size_t          scopedPduLen;
+    void           *secStateRef;
+    u_char         *secParams;
+    size_t         *secParamsLen;
+    u_char        **wholeMsg;
+    size_t         *wholeMsgLen;
+    size_t         *wholeMsgOffset;
+    netsnmp_pdu    *pdu;        /* IN - the pdu getting encoded            */
+    netsnmp_session *session;   /* IN - session sending the message        */
+};
+
+struct snmp_secmod_incoming_params {
+    int             msgProcModel;       /* IN */
+    size_t          maxMsgSize; /* IN     - Used to calc maxSizeResponse.  */
+
+    u_char         *secParams;  /* IN     - BER encoded securityParameters. */
+    int             secModel;   /* IN */
+    int             secLevel;   /* IN     - AuthNoPriv; authPriv etc.      */
+
+    u_char         *wholeMsg;   /* IN     - Original v3 message.           */
+    size_t          wholeMsgLen;        /* IN     - Msg length.                    */
+
+    u_char         *secEngineID;        /* OUT    - Pointer snmpEngineID.          */
+    size_t         *secEngineIDLen;     /* IN/OUT - Len available; len returned.   */
+    /*
+     * NOTE: Memory provided by caller.      
+     */
+
+    char           *secName;    /* OUT    - Pointer to securityName.       */
+    size_t         *secNameLen; /* IN/OUT - Len available; len returned.   */
+
+    u_char        **scopedPdu;  /* OUT    - Pointer to plaintext scopedPdu. */
+    size_t         *scopedPduLen;       /* IN/OUT - Len available; len returned.   */
+
+    size_t         *maxSizeResponse;    /* OUT    - Max size of Response PDU.      */
+    void          **secStateRef;        /* OUT    - Ref to security state.         */
+    netsnmp_session *sess;      /* IN     - session which got the message  */
+    netsnmp_pdu    *pdu;        /* IN     - the pdu getting parsed         */
+    u_char          msg_flags;  /* IN     - v3 Message flags.              */
+};
+
+
+/*
+ * function pointers:
+ */
+
+/*
+ * free's a given security module's data; called at unregistration time 
+ */
+typedef int     (SecmodSessionCallback) (netsnmp_session *);
+typedef int     (SecmodPduCallback) (netsnmp_pdu *);
+typedef int     (Secmod2PduCallback) (netsnmp_pdu *, netsnmp_pdu *);
+typedef int     (SecmodOutMsg) (struct snmp_secmod_outgoing_params *);
+typedef int     (SecmodInMsg) (struct snmp_secmod_incoming_params *);
+typedef void    (SecmodFreeState) (void *);
+
+/*
+ * definition of a security module
+ */
+
+/*
+ * all of these callback functions except the encoding and decoding
+ * routines are optional.  The rest of them are available if need.  
+ */
+struct snmp_secmod_def {
+    /*
+     * session maniplation functions 
+     */
+    SecmodSessionCallback *session_open;        /* called in snmp_sess_open()  */
+    SecmodSessionCallback *session_close;       /* called in snmp_sess_close() */
+
+    /*
+     * pdu manipulation routines 
+     */
+    SecmodPduCallback *pdu_free;        /* called in free_pdu() */
+    Secmod2PduCallback *pdu_clone;      /* called in snmp_clone_pdu() */
+    SecmodPduCallback *pdu_timeout;     /* called when request timesout */
+    SecmodFreeState *pdu_free_state_ref;        /* frees pdu->securityStateRef */
+
+    /*
+     * de/encoding routines: mandatory 
+     */
+    SecmodOutMsg   *encode_reverse;     /* encode packet back to front */
+    SecmodOutMsg   *encode_forward;     /* encode packet forward */
+    SecmodInMsg    *decode;     /* decode & validate incoming */
+};
+
+
+/*
+ * internal list
+ */
+struct snmp_secmod_list {
+    int             securityModel;
+    struct snmp_secmod_def *secDef;
+    struct snmp_secmod_list *next;
+};
+
+
+/*
+ * register a security service 
+ */
+int             register_sec_mod(int, const char *,
+                                 struct snmp_secmod_def *);
+/*
+ * find a security service definition 
+ */
+struct snmp_secmod_def *find_sec_mod(int);
+/*
+ * register a security service 
+ */
+int             unregister_sec_mod(int);        /* register a security service */
+void            init_secmod(void);
+
+#ifdef __cplusplus
+}
+#endif
+#endif                          /* SNMPSECMOD_H */
diff -Naur tomato/release/src/router/snmp/include/net-snmp/library/snmp-tc.h tomato121/release/src/router/snmp/include/net-snmp/library/snmp-tc.h
--- tomato/release/src/router/snmp/include/net-snmp/library/snmp-tc.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/include/net-snmp/library/snmp-tc.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,52 @@
+#ifndef SNMP_TC_H
+#define SNMP_TC_H
+
+#ifdef __cplusplus
+extern          "C" {
+#endif
+    /*
+     * snmp-tc.h: Provide some standard #defines for Textual Convention
+     * related value information 
+     */
+
+    u_char         *date_n_time(time_t *, size_t *);
+    time_t          ctime_to_timet(char *);
+
+    /*
+     * TrueValue 
+     */
+#define TV_TRUE 1
+#define TV_FALSE 2
+
+    /*
+     * RowStatus 
+     */
+#define RS_NONEXISTENT    0
+#define RS_ACTIVE	        1
+#define RS_NOTINSERVICE	        2
+#define RS_NOTREADY	        3
+#define RS_CREATEANDGO	        4
+#define RS_CREATEANDWAIT	5
+#define RS_DESTROY		6
+
+#define RS_IS_GOING_ACTIVE( x ) ( x == RS_CREATEANDGO || x == RS_ACTIVE )
+#define RS_IS_ACTIVE( x ) ( x == RS_ACTIVE )
+#define RS_IS_NOT_ACTIVE( x ) ( ! RS_GOING_ACTIVE(x) )
+
+    /*
+     * StorageType 
+     */
+#define ST_NONE 0
+#define ST_OTHER	1
+#define ST_VOLATILE	2
+#define ST_NONVOLATILE	3
+#define ST_PERMANENT	4
+#define ST_READONLY	5
+
+    char            check_rowstatus_transition(int old_val, int new_val);
+    char            check_storage_transition(int old_val, int new_val);
+
+#ifdef __cplusplus
+}
+#endif
+#endif                          /* SNMP_TC_H */
diff -Naur tomato/release/src/router/snmp/include/net-snmp/library/snmpTCPDomain.h tomato121/release/src/router/snmp/include/net-snmp/library/snmpTCPDomain.h
--- tomato/release/src/router/snmp/include/net-snmp/library/snmpTCPDomain.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/include/net-snmp/library/snmpTCPDomain.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,35 @@
+#ifndef _SNMPTCPDOMAIN_H
+#define _SNMPTCPDOMAIN_H
+
+#ifdef SNMP_TRANSPORT_TCP_DOMAIN
+
+#ifdef __cplusplus
+extern          "C" {
+#endif
+
+#include <net-snmp/library/snmp_transport.h>
+#include <net-snmp/library/asn1.h>
+
+#if HAVE_SYS_SOCKET_H
+#include <sys/socket.h>
+#endif
+#if HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+
+extern oid netsnmp_snmpTCPDomain[8];	/*  = { 1, 3, 6, 1, 3, 91, 1, 1 };  */
+
+netsnmp_transport *netsnmp_tcp_transport(struct sockaddr_in *addr, int local);
+
+/*
+ * "Constructor" for transport domain object.  
+ */
+
+void            netsnmp_tcp_ctor(void);
+
+#ifdef __cplusplus
+}
+#endif
+#endif                          /*SNMP_TRANSPORT_TCP_DOMAIN */
+
+#endif/*_SNMPTCPDOMAIN_H*/
diff -Naur tomato/release/src/router/snmp/include/net-snmp/library/snmpTCPIPv6Domain.h tomato121/release/src/router/snmp/include/net-snmp/library/snmpTCPIPv6Domain.h
--- tomato/release/src/router/snmp/include/net-snmp/library/snmpTCPIPv6Domain.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/include/net-snmp/library/snmpTCPIPv6Domain.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,25 @@
+#ifndef _SNMPTCPIPV6DOMAIN_H
+#define _SNMPTCPIPV6DOMAIN_H
+
+#ifdef __cplusplus
+extern          "C" {
+#endif
+
+#include <net-snmp/library/snmp_transport.h>
+#include <net-snmp/library/asn1.h>
+
+extern oid      netsnmp_TCPIPv6Domain[]; /* = { ENTERPRISE_MIB, 3, 3, 5 }; */
+
+netsnmp_transport *netsnmp_tcp6_transport(struct sockaddr_in6 *addr, 
+					  int local);
+
+/*
+ * "Constructor" for transport domain object.  
+ */
+
+void            netsnmp_tcp6_ctor(void);
+
+#ifdef __cplusplus
+}
+#endif
+#endif/*_SNMPTCPIPV6DOMAIN_H*/
diff -Naur tomato/release/src/router/snmp/include/net-snmp/library/snmp_transport.h tomato121/release/src/router/snmp/include/net-snmp/library/snmp_transport.h
--- tomato/release/src/router/snmp/include/net-snmp/library/snmp_transport.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/include/net-snmp/library/snmp_transport.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,159 @@
+#ifndef _SNMP_TRANSPORT_H
+#define _SNMP_TRANSPORT_H
+
+#include <sys/types.h>
+#include <net-snmp/library/asn1.h>
+
+#ifdef __cplusplus
+extern          "C" {
+#endif
+
+/*  Some transport-type constants.  */
+
+#ifndef NETSNMP_STREAM_QUEUE_LEN
+#define	NETSNMP_STREAM_QUEUE_LEN	5
+#endif
+
+/*  Some transport-type flags.  */
+
+#define		NETSNMP_TRANSPORT_FLAG_STREAM	0x01
+#define		NETSNMP_TRANSPORT_FLAG_LISTEN	0x02
+
+/*  The standard SNMP domains.  */
+
+extern oid      netsnmpUDPDomain[]; 	/*      = { 1, 3, 6, 1, 6, 1, 1 };  */
+extern oid      netsnmpCLNSDomain[];    /*      = { 1, 3, 6, 1, 6, 1, 2 };  */
+extern oid      netsnmpCONSDomain[];    /*      = { 1, 3, 6, 1, 6, 1, 3 };  */
+extern oid      netsnmpDDPDomain[]; 	/*      = { 1, 3, 6, 1, 6, 1, 4 };  */
+extern oid      netsnmpIPXDomain[]; 	/*      = { 1, 3, 6, 1, 6, 1, 5 };  */
+extern size_t   netsnmpUDPDomain_len;
+extern size_t   netsnmpCLNSDomain_len;
+extern size_t   netsnmpCONSDomain_len;
+extern size_t   netsnmpDDPDomain_len;
+extern size_t   netsnmpIPXDomain_len;
+
+/*  Structure which defines the transport-independent API.  */
+
+typedef struct netsnmp_transport_s {
+    /*  The transport domain object identifier.  */
+
+    const oid      *domain;
+    int             domain_length;  /*  In sub-IDs, not octets.  */
+
+    /*  Local transport address (in relevant SNMP-style encoding).  */
+    
+    unsigned char  *local;
+    int             local_length;   /*  In octets.  */
+
+    /*  Remote transport address (in relevant SNMP-style encoding).  */
+
+    unsigned char  *remote;
+    int             remote_length;  /*  In octets.  */
+
+    /*  The actual socket.  */
+    
+    int             sock;
+
+    /*  Flags (see #definitions above).  */
+
+    unsigned int    flags;
+
+    /*  Protocol-specific opaque data pointer.  */
+
+    void           *data;
+    int             data_length;
+
+    /*  Maximum size of PDU that can be sent/received by this transport.  */
+
+    size_t          msgMaxSize;
+
+    /*  Callbacks.  Arguments are:
+     *		
+     *              "this" pointer, fd, buf, size, *opaque, *opaque_length  
+     */
+
+    int             (*f_recv)   (struct netsnmp_transport_s *, void *,
+				 int, void **, int *);
+    int             (*f_send)   (struct netsnmp_transport_s *, void *,
+				 int, void **, int *);
+    int             (*f_close)  (struct netsnmp_transport_s *);
+
+    /*  This callback is only necessary for stream-oriented transports.  */
+
+    int             (*f_accept) (struct netsnmp_transport_s *);
+
+    /*  Optional callback to format a transport address.  */
+
+    char           *(*f_fmtaddr)(struct netsnmp_transport_s *, void *,
+				 int);
+} netsnmp_transport;
+
+typedef struct netsnmp_transport_list_s {
+    netsnmp_transport *transport;
+    struct netsnmp_transport_list_s *next;
+} netsnmp_transport_list;
+
+typedef struct netsnmp_tdomain_s {
+    const oid      *name;
+    size_t          name_length;
+    const char    **prefix;
+    netsnmp_transport *(*f_create_from_tstring) (const char *, int);
+    netsnmp_transport *(*f_create_from_ostring) (const u_char *,  size_t, int);
+
+    struct netsnmp_tdomain_s *next;
+} netsnmp_tdomain;
+
+
+/*  Some utility functions.  */
+
+int netsnmp_transport_add_to_list(netsnmp_transport_list **transport_list,
+				  netsnmp_transport *transport);
+int netsnmp_transport_remove_from_list(netsnmp_transport_list **transport_list,
+				       netsnmp_transport *transport);
+
+
+/*
+ * Return an exact (deep) copy of t, or NULL if there is a memory allocation
+ * problem (for instance).
+ */
+
+netsnmp_transport *netsnmp_transport_copy(netsnmp_transport *t);
+
+
+/*  Free an netsnmp_transport.  */
+
+void            netsnmp_transport_free(netsnmp_transport *t);
+
+
+/*
+ * If the passed oid (in_oid, in_len) corresponds to a supported transport
+ * domain, return 1; if not return 0.  If out_oid is not NULL and out_len is
+ * not NULL, then the "internal" oid which should be used to identify this
+ * domain (e.g. in pdu->tDomain etc.) is written to *out_oid and its length to
+ * *out_len.
+ */
+
+int             netsnmp_tdomain_support(const oid *in_oid, size_t in_len,
+					const oid **out_oid, size_t *out_len);
+
+int             netsnmp_tdomain_register(netsnmp_tdomain *domain);
+    
+int             netsnmp_tdomain_unregister(netsnmp_tdomain *domain);
+
+void            netsnmp_tdomain_init(void);
+
+netsnmp_transport *netsnmp_tdomain_transport(const char *string,
+					     int local,
+					     const char
+					     *default_domain);
+
+netsnmp_transport *netsnmp_tdomain_transport_oid(const oid * dom,
+						 size_t dom_len,
+						 const u_char * o,
+						 size_t o_len,
+						 int local);
+
+#ifdef __cplusplus
+}
+#endif
+#endif/*_SNMP_TRANSPORT_H*/
diff -Naur tomato/release/src/router/snmp/include/net-snmp/library/snmpUDPDomain.h tomato121/release/src/router/snmp/include/net-snmp/library/snmpUDPDomain.h
--- tomato/release/src/router/snmp/include/net-snmp/library/snmpUDPDomain.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/include/net-snmp/library/snmpUDPDomain.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,53 @@
+#ifndef _SNMPUDPDOMAIN_H
+#define _SNMPUDPDOMAIN_H
+
+#ifdef __cplusplus
+extern          "C" {
+#endif
+
+#include <net-snmp/library/snmp_transport.h>
+#include <net-snmp/library/asn1.h>
+
+#if HAVE_SYS_SOCKET_H
+#include <sys/socket.h>
+#endif
+#if HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+
+netsnmp_transport *netsnmp_udp_transport(struct sockaddr_in *addr, int local);
+
+
+/*
+ * Convert a "traditional" peername into a sockaddr_in structure which is
+ * written to *addr.  Returns 1 if the conversion was successful, or 0 if it
+ * failed.  
+ */
+
+int             netsnmp_sockaddr_in(struct sockaddr_in *addr,
+                                    const char *peername, int remote_port);
+
+
+/*
+ * Register any configuration tokens specific to the agent.  
+ */
+
+void            netsnmp_udp_agent_config_tokens_register(void);
+
+void            netsnmp_udp_parse_security(const char *token, char *param);
+
+int             netsnmp_udp_getSecName(void *opaque, int olength,
+                                       const char *community,
+                                       size_t community_len,
+                                       char **secname);
+
+/*
+ * "Constructor" for transport domain object.  
+ */
+
+void            netsnmp_udp_ctor(void);
+
+#ifdef __cplusplus
+}
+#endif
+#endif/*_SNMPUDPDOMAIN_H*/
diff -Naur tomato/release/src/router/snmp/include/net-snmp/library/snmpUDPIPv6Domain.h tomato121/release/src/router/snmp/include/net-snmp/library/snmpUDPIPv6Domain.h
--- tomato/release/src/router/snmp/include/net-snmp/library/snmpUDPIPv6Domain.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/include/net-snmp/library/snmpUDPIPv6Domain.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,44 @@
+#ifndef _SNMPUDPIPV6DOMAIN_H
+#define _SNMPUDPIPV6DOMAIN_H
+
+#ifdef __cplusplus
+extern          "C" {
+#endif
+
+#include <net-snmp/library/snmp_transport.h>
+#include <net-snmp/library/asn1.h>
+
+extern oid      netsnmp_UDPIPv6Domain[]; /* = { ENTERPRISE_MIB, 3, 3, 4 }; */
+
+netsnmp_transport *snmp_udp6_transport(struct sockaddr_in6 *addr,
+                                       int local);
+
+
+/*
+ * Convert a "traditional" peername into a sockaddr_in6 structure which is
+ * written to *addr.  Returns 1 if the conversion was successful, or 0 if it
+ * failed.  
+ */
+
+int             netsnmp_sockaddr_in6(struct sockaddr_in6 *addr,
+                                     const char *peername,
+                                     int remote_port);
+
+void            netsnmp_udp6_agent_config_tokens_register(void);
+void            netsnmp_udp6_parse_security(const char *token,
+                                            char *param);
+
+int             netsnmp_udp6_getSecName(void *opaque, int olength,
+                                        const char *community,
+                                        int community_len, char **secname);
+
+/*
+ * "Constructor" for transport domain object.  
+ */
+
+void            netsnmp_udp6_ctor(void);
+
+#ifdef __cplusplus
+}
+#endif
+#endif/*_SNMPUDPIPV6DOMAIN_H*/
diff -Naur tomato/release/src/router/snmp/include/net-snmp/library/snmpUnixDomain.h tomato121/release/src/router/snmp/include/net-snmp/library/snmpUnixDomain.h
--- tomato/release/src/router/snmp/include/net-snmp/library/snmpUnixDomain.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/include/net-snmp/library/snmpUnixDomain.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,35 @@
+#ifndef _SNMPUNIXDOMAIN_H
+#define _SNMPUNIXDOMAIN_H
+
+#ifdef SNMP_TRANSPORT_UNIX_DOMAIN
+
+#ifdef __cplusplus
+extern          "C" {
+#endif
+
+#if HAVE_SYS_SOCKET_H
+#include <sys/socket.h>
+#endif
+#if HAVE_SYS_UN_H
+#include <sys/un.h>
+#endif
+
+#include <net-snmp/library/snmp_transport.h>
+#include <net-snmp/library/asn1.h>
+
+extern oid netsnmp_UnixDomain[10];   /*  = { ENTERPRISE_MIB, 3, 3, 2 };  */
+
+netsnmp_transport *netsnmp_unix_transport(struct sockaddr_un *addr,
+                                          int local);
+/*
+ * "Constructor" for transport domain object.  
+ */
+
+void            netsnmp_unix_ctor(void);
+
+#ifdef __cplusplus
+}
+#endif
+#endif                          /*SNMP_TRANSPORT_UNIX_DOMAIN */
+
+#endif/*_SNMPUNIXDOMAIN_H*/
diff -Naur tomato/release/src/router/snmp/include/net-snmp/library/snmpusm.h tomato121/release/src/router/snmp/include/net-snmp/library/snmpusm.h
--- tomato/release/src/router/snmp/include/net-snmp/library/snmpusm.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/include/net-snmp/library/snmpusm.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,238 @@
+/*
+ * snmpusm.h
+ *
+ * Header file for USM support.
+ */
+
+#ifndef SNMPUSM_H
+#define SNMPUSM_H
+
+#ifdef __cplusplus
+extern          "C" {
+#endif
+
+#define WILDCARDSTRING "*"
+
+    /*
+     * General.
+     */
+#define USM_MAX_ID_LENGTH		1024    /* In bytes. */
+#define USM_MAX_SALT_LENGTH		128     /* In BITS. */
+#define USM_DES_SALT_LENGTH		64      /* In BITS. */
+#define USM_AES_SALT_LENGTH		128     /* In BITS. */
+#define USM_MAX_KEYEDHASH_LENGTH	128     /* In BITS. */
+
+#define USM_TIME_WINDOW			150
+#define USM_MD5_AND_SHA_AUTH_LEN        12      /* bytes */
+#define USM_MAX_AUTHSIZE                USM_MD5_AND_SHA_AUTH_LEN
+
+#define USM_SEC_MODEL_NUMBER            3
+
+    /*
+     * Structures.
+     */
+    struct usmStateReference {
+        char           *usr_name;
+        size_t          usr_name_length;
+        u_char         *usr_engine_id;
+        size_t          usr_engine_id_length;
+        oid            *usr_auth_protocol;
+        size_t          usr_auth_protocol_length;
+        u_char         *usr_auth_key;
+        size_t          usr_auth_key_length;
+        oid            *usr_priv_protocol;
+        size_t          usr_priv_protocol_length;
+        u_char         *usr_priv_key;
+        size_t          usr_priv_key_length;
+        u_int           usr_sec_level;
+    };
+
+
+    /*
+     * struct usmUser: a structure to represent a given user in a list 
+     */
+    /*
+     * Note: Any changes made to this structure need to be reflected in
+     * the following functions: 
+     */
+
+    struct usmUser;
+    struct usmUser {
+        u_char         *engineID;
+        size_t          engineIDLen;
+        char           *name;
+        char           *secName;
+        oid            *cloneFrom;
+        size_t          cloneFromLen;
+        oid            *authProtocol;
+        size_t          authProtocolLen;
+        u_char         *authKey;
+        size_t          authKeyLen;
+        oid            *privProtocol;
+        size_t          privProtocolLen;
+        u_char         *privKey;
+        size_t          privKeyLen;
+        u_char         *userPublicString;
+        int             userStatus;
+        int             userStorageType;
+        struct usmUser *next;
+        struct usmUser *prev;
+    };
+
+
+
+    /*
+     * Prototypes.
+     */
+    struct usmStateReference *usm_malloc_usmStateReference(void);
+
+    void            usm_free_usmStateReference(void *old);
+
+    int             usm_set_usmStateReference_name(struct usmStateReference
+                                                   *ref, char *name,
+                                                   size_t name_len);
+
+    int             usm_set_usmStateReference_engine_id(struct
+                                                        usmStateReference
+                                                        *ref,
+                                                        u_char * engine_id,
+                                                        size_t
+                                                        engine_id_len);
+
+    int             usm_set_usmStateReference_auth_protocol(struct
+                                                            usmStateReference
+                                                            *ref,
+                                                            oid *
+                                                            auth_protocol,
+                                                            size_t
+                                                            auth_protocol_len);
+
+    int             usm_set_usmStateReference_auth_key(struct
+                                                       usmStateReference
+                                                       *ref,
+                                                       u_char * auth_key,
+                                                       size_t
+                                                       auth_key_len);
+
+    int             usm_set_usmStateReference_priv_protocol(struct
+                                                            usmStateReference
+                                                            *ref,
+                                                            oid *
+                                                            priv_protocol,
+                                                            size_t
+                                                            priv_protocol_len);
+
+    int             usm_set_usmStateReference_priv_key(struct
+                                                       usmStateReference
+                                                       *ref,
+                                                       u_char * priv_key,
+                                                       size_t
+                                                       priv_key_len);
+
+    int             usm_set_usmStateReference_sec_level(struct
+                                                        usmStateReference
+                                                        *ref,
+                                                        int sec_level);
+
+#ifdef SNMP_TESTING_CODE
+    void            emergency_print(u_char * field, u_int length);
+#endif
+
+    int             asn_predict_int_length(int type, long number,
+                                           size_t len);
+
+    int             asn_predict_length(int type, u_char * ptr,
+                                       size_t u_char_len);
+
+    int             usm_set_salt(u_char * iv,
+                                 size_t * iv_length,
+                                 u_char * priv_salt,
+                                 size_t priv_salt_length,
+                                 u_char * msgSalt);
+
+    int             usm_parse_security_parameters(u_char * secParams,
+                                                  size_t remaining,
+                                                  u_char * secEngineID,
+                                                  size_t * secEngineIDLen,
+                                                  u_int * boots_uint,
+                                                  u_int * time_uint,
+                                                  char *secName,
+                                                  size_t * secNameLen,
+                                                  u_char * signature,
+                                                  size_t *
+                                                  signature_length,
+                                                  u_char * salt,
+                                                  size_t * salt_length,
+                                                  u_char ** data_ptr);
+
+    int             usm_check_and_update_timeliness(u_char * secEngineID,
+                                                    size_t secEngineIDLen,
+                                                    u_int boots_uint,
+                                                    u_int time_uint,
+                                                    int *error);
+
+    SecmodOutMsg    usm_secmod_generate_out_msg;
+    SecmodOutMsg    usm_secmod_generate_out_msg;
+    SecmodInMsg     usm_secmod_process_in_msg;
+    int             usm_generate_out_msg(int, u_char *, size_t, int, int,
+                                         u_char *, size_t, char *, size_t,
+                                         int, u_char *, size_t, void *,
+                                         u_char *, size_t *, u_char **,
+                                         size_t *);
+    int             usm_rgenerate_out_msg(int, u_char *, size_t, int, int,
+                                          u_char *, size_t, char *, size_t,
+                                          int, u_char *, size_t, void *,
+                                          u_char **, size_t *, size_t *);
+
+    int             usm_process_in_msg(int, size_t, u_char *, int, int,
+                                       u_char *, size_t, u_char *,
+                                       size_t *, char *, size_t *,
+                                       u_char **, size_t *, size_t *,
+                                       void **, netsnmp_session *, u_char);
+
+    int             usm_check_secLevel(int level, struct usmUser *user);
+    struct usmUser *usm_get_userList(void);
+    struct usmUser *usm_get_user(u_char * engineID, size_t engineIDLen,
+                                 char *name);
+    struct usmUser *usm_get_user_from_list(u_char * engineID,
+                                           size_t engineIDLen, char *name,
+                                           struct usmUser *userList,
+                                           int use_default);
+    struct usmUser *usm_add_user(struct usmUser *user);
+    struct usmUser *usm_add_user_to_list(struct usmUser *user,
+                                         struct usmUser *userList);
+    struct usmUser *usm_free_user(struct usmUser *user);
+    struct usmUser *usm_create_user(void);
+    struct usmUser *usm_create_initial_user(const char *name,
+                                            const oid * authProtocol,
+                                            size_t authProtocolLen,
+                                            const oid * privProtocol,
+                                            size_t privProtocolLen);
+    struct usmUser *usm_cloneFrom_user(struct usmUser *from,
+                                       struct usmUser *to);
+    struct usmUser *usm_remove_user(struct usmUser *user);
+    struct usmUser *usm_remove_user_from_list(struct usmUser *user,
+                                              struct usmUser **userList);
+    char           *get_objid(char *line, oid ** optr, size_t * len);
+    void            usm_save_users(const char *token, const char *type);
+    void            usm_save_users_from_list(struct usmUser *user,
+                                             const char *token,
+                                             const char *type);
+    void            usm_save_user(struct usmUser *user, const char *token,
+                                  const char *type);
+    SNMPCallback    usm_store_users;
+    struct usmUser *usm_read_user(char *line);
+    void            usm_parse_config_usmUser(const char *token,
+                                             char *line);
+
+    void            usm_set_password(const char *token, char *line);
+    void            usm_set_user_password(struct usmUser *user,
+                                          const char *token, char *line);
+    void            init_usm(void);
+    int             init_usm_post_config(int majorid, int minorid,
+                                         void *serverarg, void *clientarg);
+
+#ifdef __cplusplus
+}
+#endif
+#endif                          /* SNMPUSM_H */
diff -Naur tomato/release/src/router/snmp/include/net-snmp/library/snmpv3.h tomato121/release/src/router/snmp/include/net-snmp/library/snmpv3.h
--- tomato/release/src/router/snmp/include/net-snmp/library/snmpv3.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/include/net-snmp/library/snmpv3.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,56 @@
+/*
+ * snmpv3.h
+ */
+
+#ifndef SNMPV3_H
+#define SNMPV3_H
+
+#ifdef __cplusplus
+extern          "C" {
+#endif
+
+#define MAX_ENGINEID_LENGTH 128
+
+#define ENGINEID_TYPE_IPV4    1
+#define ENGINEID_TYPE_IPV6    2
+#define ENGINEID_TYPE_MACADDR 3
+#define ENGINEID_TYPE_TEXT    4
+#define ENGINEID_TYPE_UCD_RND 128
+
+#define	DEFAULT_NIC "eth0"
+
+    int             setup_engineID(u_char ** eidp, const char *text);
+    void            engineID_conf(const char *word, char *cptr);
+    void            engineBoots_conf(const char *, char *);
+    void            engineIDType_conf(const char *, char *);
+    void            engineIDNic_conf(const char *, char *);
+    void            snmpv3_authtype_conf(const char *word, char *cptr);
+    void            snmpv3_privtype_conf(const char *word, char *cptr);
+    void            usm_parse_create_usmUser(const char *token,
+                                             char *line);
+    void            init_snmpv3(const char *);
+    int             init_snmpv3_post_config(int majorid, int minorid,
+                                            void *serverarg,
+                                            void *clientarg);
+    int             init_snmpv3_post_premib_config(int majorid,
+                                                   int minorid,
+                                                   void *serverarg,
+                                                   void *clientarg);
+    void            shutdown_snmpv3(const char *type);
+    int             snmpv3_store(int majorID, int minorID, void *serverarg,
+                                 void *clientarg);
+    u_long          snmpv3_local_snmpEngineBoots(void);
+    int             snmpv3_clone_engineID(u_char **, size_t *, u_char *,
+                                          size_t);
+    size_t          snmpv3_get_engineID(u_char * buf, size_t buflen);
+    u_char         *snmpv3_generate_engineID(size_t *);
+    u_long          snmpv3_local_snmpEngineTime(void);
+    int             get_default_secLevel(void);
+    const oid      *get_default_authtype(size_t *);
+    const oid      *get_default_privtype(size_t *);
+    void            snmpv3_set_engineBootsAndTime(int boots, int ttime);
+
+#ifdef __cplusplus
+}
+#endif
+#endif                          /* SNMPV3_H */
diff -Naur tomato/release/src/router/snmp/include/net-snmp/library/snmpv3-security-includes.h tomato121/release/src/router/snmp/include/net-snmp/library/snmpv3-security-includes.h
--- tomato/release/src/router/snmp/include/net-snmp/library/snmpv3-security-includes.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/include/net-snmp/library/snmpv3-security-includes.h	2008-10-12 17:03:12.000000000 +1100
@@ -0,0 +1,2 @@
+/* This file is automatically generated by configure.  Do not modify by hand. */
+#include <net-snmp/library/snmpusm.h>
diff -Naur tomato/release/src/router/snmp/include/net-snmp/library/system.h tomato121/release/src/router/snmp/include/net-snmp/library/system.h
--- tomato/release/src/router/snmp/include/net-snmp/library/system.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/include/net-snmp/library/system.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,129 @@
+#ifndef SNMP_SYSTEM_H
+#define SNMP_SYSTEM_H
+
+#ifdef __cplusplus
+extern          "C" {
+#endif
+
+/* Portions of this file are subject to the following copyrights.  See
+ * the Net-SNMP's COPYING file for more details and other copyrights
+ * that may apply:
+ */
+/***********************************************************
+        Copyright 1993 by Carnegie Mellon University
+
+                      All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of CMU not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+CMU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+CMU BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+******************************************************************/
+/*
+ * Copyright © 2003 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms specified in the COPYING file
+ * distributed with the Net-SNMP package.
+ */
+    /*
+     * Definitions for the system dependent library file
+     */
+#ifndef MSVC_PERL
+#ifdef WIN32
+
+    /*
+     * structure of a directory entry 
+     */
+    typedef struct direct {
+        long            d_ino;  /* inode number (not used by MS-DOS) */
+        int             d_namlen;       /* Name length */
+        char            d_name[257];    /* file name */
+    } _DIRECT;
+
+    /*
+     * structure for dir operations 
+     */
+    typedef struct _dir_struc {
+        char           *start;  /* Starting position */
+        char           *curr;   /* Current position */
+        long            size;   /* Size of string table */
+        long            nfiles; /* number if filenames in table */
+        struct direct   dirstr; /* Directory structure to return */
+    } DIR;
+
+    DIR            *opendir(const char *filename);
+    struct direct  *readdir(DIR * dirp);
+    int             closedir(DIR * dirp);
+
+#ifndef HAVE_GETTIMEOFDAY
+    int             gettimeofday(struct timeval *, struct timezone *tz);
+#endif
+#ifndef HAVE_STRCASECMP
+    int             strcasecmp(const char *s1, const char *s2);
+#endif
+#ifndef HAVE_STRNCASECMP
+    int             strncasecmp(const char *s1, const char *s2, size_t n);
+#endif
+
+    char           *winsock_startup(void);
+    void            winsock_cleanup(void);
+
+#define SOCK_STARTUP winsock_startup()
+#define SOCK_CLEANUP winsock_cleanup()
+
+#else                           /* !WIN32 */
+
+#define SOCK_STARTUP
+#define SOCK_CLEANUP
+
+#endif                          /* WIN32 */
+#endif				/* MSVC_PERL */
+
+#include <net-snmp/types.h>     /* For definition of in_addr_t */
+
+    in_addr_t       get_myaddr(void);
+    long            get_uptime(void);
+
+#ifndef HAVE_STRDUP
+    char           *strdup(const char *);
+#endif
+#ifndef HAVE_SETENV
+    int             setenv(const char *, const char *, int);
+#endif
+
+    int             calculate_time_diff(struct timeval *,
+                                        struct timeval *);
+
+#ifndef HAVE_STRCASESTR
+    char           *strcasestr(const char *, const char *);
+#endif
+#ifndef HAVE_STRTOL
+    long            strtol(const char *, char **, int);
+#endif
+#ifndef HAVE_STRTOUL
+    unsigned long   strtoul(const char *, char **, int);
+#endif
+#ifndef HAVE_SNPRINTF
+    int             snprintf(char *, size_t, const char *, ...);
+#endif
+
+    int             mkdirhier(const char *pathname, mode_t mode,
+                              int skiplast);
+#ifndef HAVE_STRLCPY
+    size_t            strlcpy(char *, const char *, size_t);
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+#endif                          /* SNMP_SYSTEM_H */
diff -Naur tomato/release/src/router/snmp/include/net-snmp/library/tools.h tomato121/release/src/router/snmp/include/net-snmp/library/tools.h
--- tomato/release/src/router/snmp/include/net-snmp/library/tools.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/include/net-snmp/library/tools.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,175 @@
+/*
+ * tools.h
+ */
+
+#ifndef _TOOLS_H
+#define _TOOLS_H
+
+#ifdef __cplusplus
+extern          "C" {
+#endif
+
+
+
+    /*
+     * General acros and constants.
+     */
+#ifdef WIN32
+#  define SNMP_MAXPATH MAX_PATH
+#else
+#  ifdef PATH_MAX
+#    define SNMP_MAXPATH PATH_MAX
+#  else
+#    ifdef MAXPATHLEN
+#      define SNMP_MAXPATH MAXPATHLEN
+#    else
+#      define SNMP_MAXPATH 1024		/* Should be safe enough */
+#    endif
+#  endif
+#endif
+
+#define SNMP_MAXBUF		(1024 * 4)
+#define SNMP_MAXBUF_MEDIUM	1024
+#define SNMP_MAXBUF_SMALL	512
+
+#define SNMP_MAXBUF_MESSAGE	1500
+
+#define SNMP_MAXOID		64
+
+#define SNMP_FILEMODE_CLOSED	0600
+#define SNMP_FILEMODE_OPEN	0644
+
+#define BYTESIZE(bitsize)       ((bitsize + 7) >> 3)
+#define ROUNDUP8(x)		( ( (x+7) >> 3 ) * 8 )
+
+
+
+#define SNMP_FREE(s)		do { if (s) { free((void *)s); s=NULL; } } while(0)
+
+    /*
+     * XXX Not optimal everywhere. 
+     */
+#define SNMP_MALLOC_STRUCT(s)   (struct s *) calloc(1, sizeof(struct s))
+#define SNMP_MALLOC_TYPEDEF(td)  (td *) calloc(1, sizeof(td))
+#define SNMP_ZERO(s,l)		if (s) memset(s, 0, l);
+
+
+#define TOUPPER(c)	(c >= 'a' && c <= 'z' ? c - ('a' - 'A') : c)
+#define TOLOWER(c)	(c >= 'A' && c <= 'Z' ? c + ('a' - 'A') : c)
+
+#define HEX2VAL(s) \
+	((isalpha(s) ? (TOLOWER(s)-'a'+10) : (TOLOWER(s)-'0')) & 0xf)
+#define VAL2HEX(s)	( (s) + (((s) >= 10) ? ('a'-10) : '0') )
+
+
+#define SNMP_MAX(a,b) ((a) > (b) ? (a) : (b))
+#define SNMP_MIN(a,b) ((a) > (b) ? (b) : (a))
+
+#ifndef FALSE
+#define FALSE 0
+#endif
+#ifndef TRUE
+#define TRUE  1
+#endif
+
+    /*
+     * QUIT the FUNction:
+     *      e       Error code variable
+     *      l       Label to goto to cleanup and get out of the function.
+     *
+     * XXX  It would be nice if the label could be constructed by the
+     *      preprocessor in context.  Limited to a single error return value.
+     *      Temporary hack at best.
+     */
+#define QUITFUN(e, l)			\
+	if ( (e) != SNMPERR_SUCCESS) {	\
+		rval = SNMPERR_GENERR;	\
+		goto l ;		\
+	}
+
+    /*
+     * DIFFTIMEVAL
+     *      Set <diff> to the difference between <now> (current) and <then> (past).
+     *
+     * ASSUMES that all inputs are (struct timeval)'s.
+     * Cf. system.c:calculate_time_diff().
+     */
+#define DIFFTIMEVAL(now, then, diff) 			\
+{							\
+	now.tv_sec--;					\
+	now.tv_usec += 1000000L;			\
+	diff.tv_sec  = now.tv_sec  - then.tv_sec;	\
+	diff.tv_usec = now.tv_usec - then.tv_usec;	\
+	if (diff.tv_usec > 1000000L){			\
+		diff.tv_usec -= 1000000L;		\
+		diff.tv_sec++;				\
+	}						\
+}
+
+
+    /*
+     * ISTRANSFORM
+     * ASSUMES the minimum length for ttype and toid.
+     */
+#define USM_LENGTH_OID_TRANSFORM	10
+
+#define ISTRANSFORM(ttype, toid)					\
+	!snmp_oid_compare(ttype, USM_LENGTH_OID_TRANSFORM,		\
+		usm ## toid ## Protocol, USM_LENGTH_OID_TRANSFORM)
+
+#define ENGINETIME_MAX	2147483647      /* ((2^31)-1) */
+#define ENGINEBOOT_MAX	2147483647      /* ((2^31)-1) */
+
+
+
+
+    /*
+     * Prototypes.
+     */
+
+    int             snmp_realloc(u_char ** buf, size_t * buf_len);
+
+    void            free_zero(void *buf, size_t size);
+
+    u_char         *malloc_random(size_t * size);
+    u_char         *malloc_zero(size_t size);
+    int             memdup(u_char ** to, const u_char * from, size_t size);
+
+    u_int           binary_to_hex(const u_char * input, size_t len,
+                                  char **output);
+    int             hex_to_binary2(const u_char * input, size_t len,
+                                   char **output);
+
+    int             snmp_decimal_to_binary(u_char ** buf, size_t * buf_len,
+                                           size_t * out_len,
+                                           int allow_realloc,
+                                           const char *decimal);
+    int             snmp_hex_to_binary(u_char ** buf, size_t * buf_len,
+                                       size_t * out_len, int allow_realloc,
+                                       const char *hex);
+    int             snmp_strcat(u_char ** buf, size_t * buf_len,
+                                size_t * out_len, int allow_realloc,
+                                const u_char * s);
+    char           *netsnmp_strdup_and_null(const u_char * from,
+                                            size_t from_len);
+
+    void            dump_chunk(const char *debugtoken, const char *title,
+                               const u_char * buf, int size);
+    char           *dump_snmpEngineID(const u_char * buf, size_t * buflen);
+
+    typedef void   *marker_t;
+    marker_t        atime_newMarker(void);
+    void            atime_setMarker(marker_t pm);
+    long            atime_diff(marker_t first, marker_t second);
+    u_long          uatime_diff(marker_t first, marker_t second);       /* 1/1000th sec */
+    u_long          uatime_hdiff(marker_t first, marker_t second);      /* 1/100th sec */
+    int             atime_ready(marker_t pm, int deltaT);
+    int             uatime_ready(marker_t pm, unsigned int deltaT);
+
+    int             marker_tticks(marker_t pm);
+    int             timeval_tticks(struct timeval *tv);
+
+#ifdef __cplusplus
+}
+#endif
+#endif                          /* _TOOLS_H */
diff -Naur tomato/release/src/router/snmp/include/net-snmp/library/transform_oids.h tomato121/release/src/router/snmp/include/net-snmp/library/transform_oids.h
--- tomato/release/src/router/snmp/include/net-snmp/library/transform_oids.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/include/net-snmp/library/transform_oids.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,37 @@
+#ifndef _net_snmp_transform_oids_h
+#define _net_snmp_transform_oids_h
+
+#ifdef __cplusplus
+extern          "C" {
+#endif
+/*
+ * transform_oids.h
+ *
+ * Numeric MIB names for auth and priv transforms.
+ */
+
+extern oid      usmNoAuthProtocol[10];  /* == { 1,3,6,1,6,3,10,1,1,1 }; */
+extern oid      usmHMACMD5AuthProtocol[10];     /* == { 1,3,6,1,6,3,10,1,1,2 }; */
+extern oid      usmHMACSHA1AuthProtocol[10];    /* == { 1,3,6,1,6,3,10,1,1,3 }; */
+extern oid      usmNoPrivProtocol[10];  /* == { 1,3,6,1,6,3,10,1,2,1 }; */
+extern oid      usmDESPrivProtocol[10]; /* == { 1,3,6,1,6,3,10,1,2,2 }; */
+
+/* XXX: OIDs not defined yet */
+extern oid      usmAES128PrivProtocol[10]; /* == { XXX, 1, 2 }; */
+extern oid      usmAES192PrivProtocol[10]; /* == { XXX, 1, 3 }; */
+extern oid      usmAES256PrivProtocol[10]; /* == { XXX, 1, 4 }; */
+
+#define USM_AUTH_PROTO_NOAUTH_LEN 10
+#define USM_AUTH_PROTO_MD5_LEN 10
+#define USM_AUTH_PROTO_SHA_LEN 10
+#define USM_PRIV_PROTO_NOPRIV_LEN 10
+#define USM_PRIV_PROTO_DES_LEN 10
+
+#define USM_PRIV_PROTO_AES128_LEN 10
+#define USM_PRIV_PROTO_AES192_LEN 10
+#define USM_PRIV_PROTO_AES256_LEN 10
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff -Naur tomato/release/src/router/snmp/include/net-snmp/library/ucd_compat.h tomato121/release/src/router/snmp/include/net-snmp/library/ucd_compat.h
--- tomato/release/src/router/snmp/include/net-snmp/library/ucd_compat.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/include/net-snmp/library/ucd_compat.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,39 @@
+/*
+ *  UCD compatability definitions & declarations
+ *
+ */
+
+#ifndef NET_SNMP_UCD_COMPAT_H
+#define NET_SNMP_UCD_COMPAT_H
+
+#ifdef __cplusplus
+extern          "C" {
+#endif
+
+        /*
+         * from snmp_api.h 
+         */
+void            snmp_set_dump_packet(int);
+int             snmp_get_dump_packet(void);
+void            snmp_set_quick_print(int);
+int             snmp_get_quick_print(void);
+void            snmp_set_suffix_only(int);
+int             snmp_get_suffix_only(void);
+void            snmp_set_full_objid(int);
+int             snmp_get_full_objid(void);
+void            snmp_set_random_access(int);
+int             snmp_get_random_access(void);
+
+        /*
+         * from parse.h 
+         */
+void            snmp_set_mib_warnings(int);
+void            snmp_set_mib_errors(int);
+void            snmp_set_save_descriptions(int);
+void            snmp_set_mib_comment_term(int);
+void            snmp_set_mib_parse_label(int);
+
+#ifdef __cplusplus
+}
+#endif
+#endif                          /* NET_SNMP_UCD_COMPAT_H */
diff -Naur tomato/release/src/router/snmp/include/net-snmp/library/vacm.h tomato121/release/src/router/snmp/include/net-snmp/library/vacm.h
--- tomato/release/src/router/snmp/include/net-snmp/library/vacm.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/include/net-snmp/library/vacm.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,198 @@
+/*
+ * vacm.h
+ *
+ * SNMPv3 View-based Access Control Model
+ */
+
+#ifndef VACM_H
+#define VACM_H
+
+#ifdef __cplusplus
+extern          "C" {
+#endif
+
+#define VACM_SUCCESS       0
+#define VACM_NOSECNAME     1
+#define VACM_NOGROUP       2
+#define VACM_NOACCESS      3
+#define VACM_NOVIEW        4
+#define VACM_NOTINVIEW     5
+#define VACM_NOSUCHCONTEXT 6
+#define VACM_SUBTREE_UNKNOWN 7
+
+#define SECURITYMODEL	1
+#define SECURITYNAME	2
+#define SECURITYGROUP	3
+#define SECURITYSTORAGE	4
+#define SECURITYSTATUS	5
+
+#define ACCESSPREFIX	1
+#define ACCESSMODEL	2
+#define ACCESSLEVEL	3
+#define ACCESSMATCH	4
+#define ACCESSREAD	5
+#define ACCESSWRITE	6
+#define ACCESSNOTIFY	7
+#define ACCESSSTORAGE	8
+#define ACCESSSTATUS	9
+
+#define VACMVIEWSPINLOCK 1
+#define VIEWNAME	2
+#define VIEWSUBTREE	3
+#define VIEWMASK	4
+#define VIEWTYPE	5
+#define VIEWSTORAGE	6
+#define VIEWSTATUS	7
+
+#define VACM_MAX_STRING 32
+#define VACMSTRINGLEN   34      /* VACM_MAX_STRING + 2 */
+
+    struct vacm_groupEntry {
+        int             securityModel;
+        char            securityName[VACMSTRINGLEN];
+        char            groupName[VACMSTRINGLEN];
+        int             storageType;
+        int             status;
+
+        u_long          bitMask;
+        struct vacm_groupEntry *reserved;
+        struct vacm_groupEntry *next;
+    };
+
+#define CONTEXT_MATCH_EXACT  1
+#define CONTEXT_MATCH_PREFIX 2
+    struct vacm_accessEntry {
+        char            groupName[VACMSTRINGLEN];
+        char            contextPrefix[VACMSTRINGLEN];
+        int             securityModel;
+        int             securityLevel;
+        int             contextMatch;
+        char            readView[VACMSTRINGLEN];
+        char            writeView[VACMSTRINGLEN];
+        char            notifyView[VACMSTRINGLEN];
+        int             storageType;
+        int             status;
+
+        u_long          bitMask;
+        struct vacm_accessEntry *reserved;
+        struct vacm_accessEntry *next;
+    };
+
+    struct vacm_viewEntry {
+        char            viewName[VACMSTRINGLEN];
+        oid             viewSubtree[MAX_OID_LEN];
+        size_t          viewSubtreeLen;
+        u_char          viewMask[VACMSTRINGLEN];
+        size_t          viewMaskLen;
+        int             viewType;
+        int             viewStorageType;
+        int             viewStatus;
+
+        u_long          bitMask;
+
+        struct vacm_viewEntry *reserved;
+        struct vacm_viewEntry *next;
+    };
+
+    void            vacm_destroyViewEntry(const char *, oid *, size_t);
+    void            vacm_destroyAllViewEntries(void);
+
+#define VACM_MODE_FIND                0
+#define VACM_MODE_IGNORE_MASK         1
+#define VACM_MODE_CHECK_SUBTREE       2
+    struct vacm_viewEntry *vacm_getViewEntry(const char *, oid *, size_t,
+                                             int);
+    /*
+     * Returns a pointer to the viewEntry with the
+     * same viewName and viewSubtree
+     * Returns NULL if that entry does not exist.
+     */
+
+    int vacm_checkSubtree(const char *, oid *, size_t);
+
+    /*
+     * Check to see if everything within a subtree is in view, not in view,
+     * or possibly both.
+     *
+     * Returns:
+     *   VACM_SUCCESS          The OID is included in the view.
+     *   VACM_NOTINVIEW        If no entry in the view list includes the
+     *                         provided OID, or the OID is explicitly excluded
+     *                         from the view. 
+     *   VACM_SUBTREE_UNKNOWN  The entire subtree has both allowed and
+     *                         disallowed portions.
+     */
+
+    void
+                    vacm_scanViewInit(void);
+    /*
+     * Initialized the scan routines so that they will begin at the
+     * beginning of the list of viewEntries.
+     *
+     */
+
+
+    struct vacm_viewEntry *vacm_scanViewNext(void);
+    /*
+     * Returns a pointer to the next viewEntry.
+     * These entries are returned in no particular order,
+     * but if N entries exist, N calls to view_scanNext() will
+     * return all N entries once.
+     * Returns NULL if all entries have been returned.
+     * view_scanInit() starts the scan over.
+     */
+
+    struct vacm_viewEntry *vacm_createViewEntry(const char *, oid *,
+                                                size_t);
+    /*
+     * Creates a viewEntry with the given index
+     * and returns a pointer to it.
+     * The status of this entry is created as invalid.
+     */
+
+    void            vacm_destroyGroupEntry(int, const char *);
+    void            vacm_destroyAllGroupEntries(void);
+    struct vacm_groupEntry *vacm_createGroupEntry(int, const char *);
+    struct vacm_groupEntry *vacm_getGroupEntry(int, const char *);
+    void            vacm_scanGroupInit(void);
+    struct vacm_groupEntry *vacm_scanGroupNext(void);
+
+    void            vacm_destroyAccessEntry(const char *, const char *,
+                                            int, int);
+    void            vacm_destroyAllAccessEntries(void);
+    struct vacm_accessEntry *vacm_createAccessEntry(const char *,
+                                                    const char *, int,
+                                                    int);
+    struct vacm_accessEntry *vacm_getAccessEntry(const char *,
+                                                 const char *, int, int);
+    void            vacm_scanAccessInit(void);
+    struct vacm_accessEntry *vacm_scanAccessNext(void);
+
+    void            vacm_destroySecurityEntry(const char *);
+    struct vacm_securityEntry *vacm_createSecurityEntry(const char *);
+    struct vacm_securityEntry *vacm_getSecurityEntry(const char *);
+    void            vacm_scanSecurityInit(void);
+    struct vacm_securityEntry *vacm_scanSecurityEntry(void);
+    int             vacm_is_configured(void);
+
+    void            vacm_save(const char *token, const char *type);
+    void            vacm_save_view(struct vacm_viewEntry *view,
+                                   const char *token, const char *type);
+    void            vacm_save_access(struct vacm_accessEntry *access_entry,
+                                     const char *token, const char *type);
+    void            vacm_save_group(struct vacm_groupEntry *group_entry,
+                                    const char *token, const char *type);
+
+    void            vacm_parse_config_view(const char *token, char *line);
+    void            vacm_parse_config_group(const char *token, char *line);
+    void            vacm_parse_config_access(const char *token,
+                                             char *line);
+
+    int             store_vacm(int majorID, int minorID, void *serverarg,
+                               void *clientarg);
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif                          /* VACM_H */
diff -Naur tomato/release/src/router/snmp/include/net-snmp/library/winservice.h tomato121/release/src/router/snmp/include/net-snmp/library/winservice.h
--- tomato/release/src/router/snmp/include/net-snmp/library/winservice.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/include/net-snmp/library/winservice.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,224 @@
+#ifndef WINSERVICE_H
+#define WINSERVICE_H
+
+    /*
+     * 
+     * *Windows Service related functions declaration
+     * *By Raju Krishanppa(raju_krishnappa@yahoo.com)
+     * *
+     */ 
+    
+#ifdef __cplusplus
+extern          "C" {
+    
+#endif  /* 
 */
+    
+        /*
+         * 
+         * * Define Constants for Register, De-register , Run As service or Console mode
+         */ 
+#define REGISTER_SERVICE 0
+#define UN_REGISTER_SERVICE 1
+#define RUN_AS_SERVICE 2
+#define RUN_AS_CONSOLE 3
+    
+        /*
+         * 
+         * * Define Message catalog ID
+         * * MessageId: DISPLAY_MSG
+         * * MessageText:
+         * *  %1.
+         */ 
+#define DISPLAY_MSG                      0x00000064L
+    
+        /*
+         * 
+         * * Hint Value to SCM to wait before sending successive commands to service
+         */ 
+#define SCM_WAIT_INTERVAL 7000
+    
+        /*
+         * 
+         * * Define Generic String Size, to hold Error or Information
+         */ 
+#define MAX_STR_SIZE  1024
+    
+        /*
+         * Delcare Global variables, which are visible to other modules 
+         */ 
+    extern BOOL     g_fRunningAsService;
+                   

+        /*
+         * Input parameter structure to thread 
+         */            
+    typedef struct _InputParams 
 {
+        
DWORD Argc;
+        
LPTSTR * Argv;
+    
} InputParams;
+                   

+        /*
+         * 
+         * * Define Service Related functions
+         */            
+                   
+        /*
+         * To register application as windows service with SCM 
+         */            
+     
+        
+        
+        
+        
+        
+        
+        
+        
+        
+        
+        
+        
+        
+        
+        VOID RegisterService(LPCTSTR lpszServiceName,
+                             LPCTSTR lpszServiceDisplayName,
+                             LPCTSTR lpszServiceDescription,
+                             InputParams * StartUpArg);
+                   

+        /*
+         * To unregister servcie 
+         */            
+                    VOID UnregisterService(LPCSTR lpszServiceName);
+                   

+        /*
+         * To parse command line for startup option 
+         */            
+     
+        
+        
+        
+        
+        
+        
+                INT ParseCmdLineForServiceOption(INT argc, TCHAR * argv[]);
+                   

+        /*
+         * To write to windows event log 
+         */            
+     
+        
+        
+        
+        
+                  VOID WriteToEventLog(WORD wType, LPCTSTR pszFormat, ...);
+                   

+        /*
+         * To display generic windows error 
+         */            
+                    VOID DisplayError(LPCTSTR pszTitle);
+                   

+        /*
+         * To update windows service status to SCM 
+         */            
+    static BOOL     UpdateServiceStatus(DWORD dwStatus, DWORD dwErrorCode,
+                                        DWORD dwWaitHint);
+                   

+        /*
+         * To Report current service status to SCM 
+         */            
+    static BOOL     ReportCurrentServiceStatus();
+                   

+        /*
+         * Service Main function,  Which will spawn a thread, and calls the
+         * * Service run part
+         */            
+                    VOID WINAPI ServiceMain(DWORD argc, LPTSTR argv[]);
+                   

+        /*
+         * To start Service 
+         */            
+     
+        
+        
+        
+        
+                  BOOL RunAsService(INT(*ServiceFunction) (INT, LPTSTR *));
+                   

+        /*
+         * Call back function to process SCM Requests 
+         */            
+                    VOID WINAPI ControlHandler(DWORD dwControl);
+                   

+        /*
+         * To Stop the service 
+         */            
+                    VOID ProcessServiceStop(VOID);
+                   

+        /*
+         * To Pause service 
+         */            
+                    VOID ProcessServicePause(VOID);
+                   

+        /*
+         * To Continue paused service 
+         */            
+                    VOID ProcessServiceContinue(VOID);
+                   

+        /*
+         * To send Current Serivce status to SCM when INTERROGATE command is sent 
+         */            
+                    VOID ProcessServiceInterrogate(VOID);
+                   

+        /*
+         * To allocate and Set security descriptor 
+         */            
+     
+        
+        
+        
+        
+        
+        
+        
+        
+        
+        
+        
+        
+        
+        
+        BOOL SetSimpleSecurityAttributes(SECURITY_ATTRIBUTES *
+                                         pSecurityAttr);
+                   

+        /*
+         * To free Securtiy Descriptor 
+         */            
+     
+        
+        
+        
+        
+        
+        
+        
+        
+        
+        
+        
+        
+          VOID FreeSecurityAttributes(SECURITY_ATTRIBUTES * pSecurityAttr);
+                   

+        /*
+         * TheadFunction - To spawan as thread - Invokes registered service function 
+         */            
+                    DWORD WINAPI ThreadFunction(LPVOID lpParam);
+                   

+        /*
+         * Service STOP function registration with this framewrok
+         * * this function must be invoked before calling RunAsService
+         */            
+                    VOID RegisterStopFunction(VOID(*StopFunc) ());
+                   

+#ifdef __cplusplus
+}              
+#endif  /* 
 */
+#endif  /* WINSERVICE_H */
diff -Naur tomato/release/src/router/snmp/include/net-snmp/machine/generic.h tomato121/release/src/router/snmp/include/net-snmp/machine/generic.h
--- tomato/release/src/router/snmp/include/net-snmp/machine/generic.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/include/net-snmp/machine/generic.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,3 @@
+/*
+ * chip specific definitions go here 
+ */
diff -Naur tomato/release/src/router/snmp/include/net-snmp/mib_api.h tomato121/release/src/router/snmp/include/net-snmp/mib_api.h
--- tomato/release/src/router/snmp/include/net-snmp/mib_api.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/include/net-snmp/mib_api.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,28 @@
+#ifndef NET_SNMP_MIB_API_H
+#define NET_SNMP_MIB_API_H
+
+    /**
+     *  Library API routines concerned with MIB files and objects, and OIDs
+     */
+
+#include <net-snmp/types.h>
+
+    /*
+     *  For the initial release, this will just refer to the
+     *  relevant UCD header files.
+     *    In due course, the routines relevant to this area of the
+     *  API will be identified, and listed here directly.
+     *
+     *  But for the time being, this header file is a placeholder,
+     *  to allow application writers to adopt the new header file names.
+     */
+
+#include <net-snmp/library/snmp_api.h>
+
+#include <net-snmp/library/mib.h>
+#include <net-snmp/library/parse.h>
+#include <net-snmp/library/callback.h>
+#include <net-snmp/library/oid_stash.h>
+#include <net-snmp/library/ucd_compat.h>
+
+#endif                          /* NET_SNMP_MIB_API_H */
diff -Naur tomato/release/src/router/snmp/include/net-snmp/net-snmp-config.h.in tomato121/release/src/router/snmp/include/net-snmp/net-snmp-config.h.in
--- tomato/release/src/router/snmp/include/net-snmp/net-snmp-config.h.in	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/include/net-snmp/net-snmp-config.h.in	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,1323 @@
+/* include/net-snmp/net-snmp-config.h.in.  Generated automatically from configure.in by autoheader.  */
+#ifndef NET_SNMP_CONFIG_H
+#define NET_SNMP_CONFIG_H
+
+/* config.h:  a general config file */
+
+/* Default (SNMP) version number for the tools to use */
+#define DEFAULT_SNMP_VERSION 3
+
+/* don't change these values! */
+#define SNMPV1      0xAAAA       /* readable by anyone */
+#define SNMPV2ANY   0xA000       /* V2 Any type (includes NoAuth) */
+#define SNMPV2AUTH  0x8000       /* V2 Authenticated requests only */
+
+/* default list of mibs to load */
+
+#define DEFAULT_MIBS "IP-MIB:IF-MIB:TCP-MIB:UDP-MIB:SNMPv2-MIB:RFC1213-MIB"
+
+/* default location to look for mibs to load using the above tokens
+   and/or those in the MIBS envrionment variable*/
+
+#undef DEFAULT_MIBDIRS
+
+/* default mib files to load, specified by path. */
+
+#undef DEFAULT_MIBFILES
+
+/* should we compile to use special opaque types: float, double,
+   counter64, i64, ui64, union? */
+#undef OPAQUE_SPECIAL_TYPES
+
+/* comment the next line if you are compiling with libsnmp.h 
+   and are not using the UC-Davis SNMP library. */
+#define UCD_SNMP_LIBRARY 1
+
+/* define if you want to compile support for both authentication and
+   privacy support. */
+#undef SCAPI_AUTHPRIV
+
+/* define if you are using the MD5 code ...*/
+#undef USE_INTERNAL_MD5
+
+/* add in recent CMU library extensions (not complete) */
+#undef CMU_COMPATIBLE
+
+/* add in recent resource lock functions (not complete) */
+#undef _REENTRANT
+
+/* debugging stuff */
+#undef SNMP_NO_DEBUGGING           /* if defined, we optimize the code
+                                      to exclude all debugging calls. */
+#define SNMP_ALWAYS_DEBUG 0        /* Always print debugging information and
+                                      ignore the -D flag passed to the cmds */
+
+/* reverse encoding BER packets is both faster and more efficient in space. */
+#define USE_REVERSE_ASNENCODING       1
+#define DEFAULT_ASNENCODING_DIRECTION 1 /* 1 = reverse, 0 = forwards */
+
+/* PERSISTENT_DIRECTORY: If defined, the library is capabile of saving
+   persisant information to this directory in the form of configuration
+   lines: PERSISTENT_DIRECTORY/NAME.persistent.conf */
+#define PERSISTENT_DIRECTORY "/var/snmp"
+
+/* PERSISTENT_MASK: the umask permissions to set up the persistent files with */
+#define PERSISTENT_MASK 077
+
+/* AGENT_DIRECTORY_MODE: the mode the agents should use to create
+   directories with. Since the data stored here is probably sensitive, it
+   probably should be read-only by root/administrator. */
+#define AGENT_DIRECTORY_MODE 0700
+
+/* MAX_PERSISTENT_BACKUPS:
+ *   The maximum number of persistent backups the library will try to
+ *   read from the persistent cache directory.  If an application fails to
+ *   close down successfully more than this number of times, data will be lost.
+ */
+#define MAX_PERSISTENT_BACKUPS 10
+
+
+/* Define if on AIX 3.
+   System headers sometimes define this.
+   We just want to avoid a redefinition error message.  */
+#ifndef _ALL_SOURCE
+#undef _ALL_SOURCE
+#endif
+
+/* Define if using alloca.c.  */
+#undef C_ALLOCA
+
+/* Define to empty if the keyword does not work.  */
+#undef const
+
+/* Define to one of _getb67, GETB67, getb67 for Cray-2 and Cray-YMP systems.
+   This function is required for alloca.c support on those systems.  */
+#undef CRAY_STACKSEG_END
+
+/* Define if you have alloca, as a function or macro.  */
+#undef HAVE_ALLOCA
+
+/* Define if you have <alloca.h> and it should be used (not on Ultrix).  */
+#undef HAVE_ALLOCA_H
+
+/* Define if you have the getmntent function.  */
+#undef HAVE_GETMNTENT
+
+/* Define if you have <sys/wait.h> that is POSIX.1 compatible.  */
+#undef HAVE_SYS_WAIT_H
+
+/* Define as __inline if that's what the C compiler calls it.  */
+#undef inline
+
+/* Define to `long' if <sys/types.h> doesn't define.  */
+#undef off_t
+
+/* Define to `int' if <sys/types.h> doesn't define.  */
+#undef pid_t
+
+/* Define as the return type of signal handlers (int or void).  */
+#undef RETSIGTYPE
+
+/* If using the C implementation of alloca, define if you know the
+   direction of stack growth for your system; otherwise it will be
+   automatically deduced at run-time.
+ STACK_DIRECTION > 0 => grows toward higher addresses
+ STACK_DIRECTION < 0 => grows toward lower addresses
+ STACK_DIRECTION = 0 => direction of growth unknown
+ */
+#undef STACK_DIRECTION
+
+/* Define if you have the ANSI C header files.  */
+#undef STDC_HEADERS
+
+/* Define if you can safely include both <sys/time.h> and <time.h>.  */
+#undef TIME_WITH_SYS_TIME
+
+/* Define if your processor stores words with the most significant
+   byte first (like Motorola and SPARC, unlike Intel and VAX).  */
+#undef WORDS_BIGENDIAN
+
+/* define if you are embedding perl in the main agent */
+#undef NETSNMP_EMBEDDED_PERL
+
+/* define the system type include file here */
+#define SYSTEM_INCLUDE_FILE <net-snmp/system/generic.h>
+
+/* define the machine (cpu) type include file here */
+#define MACHINE_INCLUDE_FILE <net-snmp/machine/generic.h>
+
+#undef SNMPLIBPATH
+#undef SNMPSHAREPATH
+#undef SNMPCONFPATH
+#undef SNMPDLMODPATH
+
+/* LOGFILE:  If defined it closes stdout/err/in and opens this in out/err's
+   place.  (stdin is closed so that sh scripts won't wait for it) */
+
+#undef LOGFILE
+
+/* default system contact */
+#undef SYS_CONTACT
+
+/* system location */
+#undef SYS_LOC
+
+/* Use libwrap to handle allow/deny hosts? */
+#undef USE_LIBWRAP
+
+/* Use dmalloc to do malloc debugging? */
+#undef HAVE_DMALLOC_H
+
+/* location of UNIX kernel */
+#define KERNEL_LOC "/vmunix"
+
+/* location of mount table list */
+#define ETC_MNTTAB "/etc/mnttab"
+
+/* location of swap device (ok if not found) */
+#undef DMEM_LOC
+
+#define PSCMD "/bin/ps"
+
+/* Where is the uname command */
+#define UNAMEPROG "/bin/uname"
+
+/* testing code sections. */
+#undef SNMP_TESTING_CODE 
+
+/* If you don't have root access don't exit upon kmem errors */
+#undef NO_ROOT_ACCESS
+
+/* If we don't want to use kmem. */
+#undef NO_KMEM_USAGE
+
+/* If you don't want the agent to report on variables it doesn't have data for */
+#undef NO_DUMMY_VALUES
+
+/* Define if statfs takes 2 args and the second argument has
+   type struct fs_data. [Ultrix] */
+#undef STAT_STATFS_FS_DATA
+
+/* Define if the TCP timer constants in <netinet/tcp_timer.h>
+   depend on the integer variable `hz'.  [FreeBSD 4.x] */
+#undef TCPTV_NEEDS_HZ
+
+/* Define if you have the AES_cfb128_encrypt function.  */
+#undef HAVE_AES_CFB128_ENCRYPT
+
+/* Define if you have the bcopy function.  */
+#undef HAVE_BCOPY
+
+/* Define if you have the cgetnext function.  */
+#undef HAVE_CGETNEXT
+
+/* Define if you have the dlopen function.  */
+#undef HAVE_DLOPEN
+
+/* Define if you have the eval_pv function.  */
+#undef HAVE_EVAL_PV
+
+/* Define if you have the execv function.  */
+#undef HAVE_EXECV
+
+/* Define if you have the fork function.  */
+#undef HAVE_FORK
+
+/* Define if you have the getaddrinfo function.  */
+#undef HAVE_GETADDRINFO
+
+/* Define if you have the getdtablesize function.  */
+#undef HAVE_GETDTABLESIZE
+
+/* Define if you have the getfsstat function.  */
+#undef HAVE_GETFSSTAT
+
+/* Define if you have the getgrnam function.  */
+#undef HAVE_GETGRNAM
+
+/* Define if you have the gethostname function.  */
+#undef HAVE_GETHOSTNAME
+
+/* Define if you have the getipnodebyname function.  */
+#undef HAVE_GETIPNODEBYNAME
+
+/* Define if you have the getloadavg function.  */
+#undef HAVE_GETLOADAVG
+
+/* Define if you have the getpagesize function.  */
+#undef HAVE_GETPAGESIZE
+
+/* Define if you have the getpid function.  */
+#undef HAVE_GETPID
+
+/* Define if you have the getpwnam function.  */
+#undef HAVE_GETPWNAM
+
+/* Define if you have the gettimeofday function.  */
+#undef HAVE_GETTIMEOFDAY
+
+/* Define if you have the if_freenameindex function.  */
+#undef HAVE_IF_FREENAMEINDEX
+
+/* Define if you have the if_nameindex function.  */
+#undef HAVE_IF_NAMEINDEX
+
+/* Define if you have the index function.  */
+#undef HAVE_INDEX
+
+/* Define if you have the knlist function.  */
+#undef HAVE_KNLIST
+
+/* Define if you have the kvm_getprocs function.  */
+#undef HAVE_KVM_GETPROCS
+
+/* Define if you have the kvm_openfiles function.  */
+#undef HAVE_KVM_OPENFILES
+
+/* Define if you have the lrand48 function.  */
+#undef HAVE_LRAND48
+
+/* Define if you have the memcpy function.  */
+#undef HAVE_MEMCPY
+
+/* Define if you have the memmove function.  */
+#undef HAVE_MEMMOVE
+
+/* Define if you have the mkstemp function.  */
+#undef HAVE_MKSTEMP
+
+/* Define if you have the nlist function.  */
+#undef HAVE_NLIST
+
+/* Define if you have the perl_eval_pv function.  */
+#undef HAVE_PERL_EVAL_PV
+
+/* Define if you have the rand function.  */
+#undef HAVE_RAND
+
+/* Define if you have the random function.  */
+#undef HAVE_RANDOM
+
+/* Define if you have the regcomp function.  */
+#undef HAVE_REGCOMP
+
+/* Define if you have the rpmGetPath function.  */
+#undef HAVE_RPMGETPATH
+
+/* Define if you have the select function.  */
+#undef HAVE_SELECT
+
+/* Define if you have the setenv function.  */
+#undef HAVE_SETENV
+
+/* Define if you have the setgid function.  */
+#undef HAVE_SETGID
+
+/* Define if you have the setgroups function.  */
+#undef HAVE_SETGROUPS
+
+/* Define if you have the setitimer function.  */
+#undef HAVE_SETITIMER
+
+/* Define if you have the setlocale function.  */
+#undef HAVE_SETLOCALE
+
+/* Define if you have the setmntent function.  */
+#undef HAVE_SETMNTENT
+
+/* Define if you have the setsid function.  */
+#undef HAVE_SETSID
+
+/* Define if you have the setuid function.  */
+#undef HAVE_SETUID
+
+/* Define if you have the sigaction function.  */
+#undef HAVE_SIGACTION
+
+/* Define if you have the sigalrm function.  */
+#undef HAVE_SIGALRM
+
+/* Define if you have the sigblock function.  */
+#undef HAVE_SIGBLOCK
+
+/* Define if you have the sighold function.  */
+#undef HAVE_SIGHOLD
+
+/* Define if you have the signal function.  */
+#undef HAVE_SIGNAL
+
+/* Define if you have the sigset function.  */
+#undef HAVE_SIGSET
+
+/* Define if you have the snprintf function.  */
+#undef HAVE_SNPRINTF
+
+/* Define if you have the socket function.  */
+#undef HAVE_SOCKET
+
+/* Define if you have the statfs function.  */
+#undef HAVE_STATFS
+
+/* Define if you have the statvfs function.  */
+#undef HAVE_STATVFS
+
+/* Define if you have the strcasestr function.  */
+#undef HAVE_STRCASESTR
+
+/* Define if you have the strchr function.  */
+#undef HAVE_STRCHR
+
+/* Define if you have the strdup function.  */
+#undef HAVE_STRDUP
+
+/* Define if you have the strerror function.  */
+#undef HAVE_STRERROR
+
+/* Define if you have the strlcpy function.  */
+#undef HAVE_STRLCPY
+
+/* Define if you have the strncasecmp function.  */
+#undef HAVE_STRNCASECMP
+
+/* Define if you have the strtol function.  */
+#undef HAVE_STRTOL
+
+/* Define if you have the strtoul function.  */
+#undef HAVE_STRTOUL
+
+/* Define if you have the system function.  */
+#undef HAVE_SYSTEM
+
+/* Define if you have the tcgetattr function.  */
+#undef HAVE_TCGETATTR
+
+/* Define if you have the uname function.  */
+#undef HAVE_UNAME
+
+/* Define if you have the usleep function.  */
+#undef HAVE_USLEEP
+
+/* Define if you have the vsnprintf function.  */
+#undef HAVE_VSNPRINTF
+
+/* Define if you have the <arpa/inet.h> header file.  */
+#undef HAVE_ARPA_INET_H
+
+/* Define if you have the <asm/page.h> header file.  */
+#undef HAVE_ASM_PAGE_H
+
+/* Define if you have the <dirent.h> header file.  */
+#undef HAVE_DIRENT_H
+
+/* Define if you have the <dlfcn.h> header file.  */
+#undef HAVE_DLFCN_H
+
+/* Define if you have the <err.h> header file.  */
+#undef HAVE_ERR_H
+
+/* Define if you have the <fcntl.h> header file.  */
+#undef HAVE_FCNTL_H
+
+/* Define if you have the <fstab.h> header file.  */
+#undef HAVE_FSTAB_H
+
+/* Define if you have the <getopt.h> header file.  */
+#undef HAVE_GETOPT_H
+
+/* Define if you have the <grp.h> header file.  */
+#undef HAVE_GRP_H
+
+/* Define if you have the <inet/mib2.h> header file.  */
+#undef HAVE_INET_MIB2_H
+
+/* Define if you have the <io.h> header file.  */
+#undef HAVE_IO_H
+
+/* Define if you have the <ioctls.h> header file.  */
+#undef HAVE_IOCTLS_H
+
+/* Define if you have the <kstat.h> header file.  */
+#undef HAVE_KSTAT_H
+
+/* Define if you have the <kvm.h> header file.  */
+#undef HAVE_KVM_H
+
+/* Define if you have the <limits.h> header file.  */
+#undef HAVE_LIMITS_H
+
+/* Define if you have the <linux/hdreg.h> header file.  */
+#undef HAVE_LINUX_HDREG_H
+
+/* Define if you have the <linux/tasks.h> header file.  */
+#undef HAVE_LINUX_TASKS_H
+
+/* Define if you have the <locale.h> header file.  */
+#undef HAVE_LOCALE_H
+
+/* Define if you have the <machine/param.h> header file.  */
+#undef HAVE_MACHINE_PARAM_H
+
+/* Define if you have the <machine/pte.h> header file.  */
+#undef HAVE_MACHINE_PTE_H
+
+/* Define if you have the <machine/types.h> header file.  */
+#undef HAVE_MACHINE_TYPES_H
+
+/* Define if you have the <malloc.h> header file.  */
+#undef HAVE_MALLOC_H
+
+/* Define if you have the <mntent.h> header file.  */
+#undef HAVE_MNTENT_H
+
+/* Define if you have the <mtab.h> header file.  */
+#undef HAVE_MTAB_H
+
+/* Define if you have the <ndir.h> header file.  */
+#undef HAVE_NDIR_H
+
+/* Define if you have the <net/if.h> header file.  */
+#undef HAVE_NET_IF_H
+
+/* Define if you have the <net/if_dl.h> header file.  */
+#undef HAVE_NET_IF_DL_H
+
+/* Define if you have the <net/if_mib.h> header file.  */
+#undef HAVE_NET_IF_MIB_H
+
+/* Define if you have the <net/if_types.h> header file.  */
+#undef HAVE_NET_IF_TYPES_H
+
+/* Define if you have the <net/if_var.h> header file.  */
+#undef HAVE_NET_IF_VAR_H
+
+/* Define if you have the <net/route.h> header file.  */
+#undef HAVE_NET_ROUTE_H
+
+/* Define if you have the <netdb.h> header file.  */
+#undef HAVE_NETDB_H
+
+/* Define if you have the <netinet/icmp_var.h> header file.  */
+#undef HAVE_NETINET_ICMP_VAR_H
+
+/* Define if you have the <netinet/if_ether.h> header file.  */
+#undef HAVE_NETINET_IF_ETHER_H
+
+/* Define if you have the <netinet/in.h> header file.  */
+#undef HAVE_NETINET_IN_H
+
+/* Define if you have the <netinet/in_systm.h> header file.  */
+#undef HAVE_NETINET_IN_SYSTM_H
+
+/* Define if you have the <netinet/in_var.h> header file.  */
+#undef HAVE_NETINET_IN_VAR_H
+
+/* Define if you have the <netinet/ip.h> header file.  */
+#undef HAVE_NETINET_IP_H
+
+/* Define if you have the <netinet/ip6.h> header file.  */
+#undef HAVE_NETINET_IP6_H
+
+/* Define if you have the <netinet/ip_icmp.h> header file.  */
+#undef HAVE_NETINET_IP_ICMP_H
+
+/* Define if you have the <netinet/ip_var.h> header file.  */
+#undef HAVE_NETINET_IP_VAR_H
+
+/* Define if you have the <netinet/tcp.h> header file.  */
+#undef HAVE_NETINET_TCP_H
+
+/* Define if you have the <netinet/tcp_fsm.h> header file.  */
+#undef HAVE_NETINET_TCP_FSM_H
+
+/* Define if you have the <netinet/tcp_timer.h> header file.  */
+#undef HAVE_NETINET_TCP_TIMER_H
+
+/* Define if you have the <netinet/tcp_var.h> header file.  */
+#undef HAVE_NETINET_TCP_VAR_H
+
+/* Define if you have the <netinet/tcpip.h> header file.  */
+#undef HAVE_NETINET_TCPIP_H
+
+/* Define if you have the <netinet/udp.h> header file.  */
+#undef HAVE_NETINET_UDP_H
+
+/* Define if you have the <netinet/udp_var.h> header file.  */
+#undef HAVE_NETINET_UDP_VAR_H
+
+/* Define if you have the <netinet6/in6_pcb.h> header file.  */
+#undef HAVE_NETINET6_IN6_PCB_H
+
+/* Define if you have the <netinet6/in6_var.h> header file.  */
+#undef HAVE_NETINET6_IN6_VAR_H
+
+/* Define if you have the <netinet6/ip6_var.h> header file.  */
+#undef HAVE_NETINET6_IP6_VAR_H
+
+/* Define if you have the <netinet6/nd6.h> header file.  */
+#undef HAVE_NETINET6_ND6_H
+
+/* Define if you have the <netinet6/tcp6.h> header file.  */
+#undef HAVE_NETINET6_TCP6_H
+
+/* Define if you have the <netinet6/tcp6_fsm.h> header file.  */
+#undef HAVE_NETINET6_TCP6_FSM_H
+
+/* Define if you have the <netinet6/tcp6_timer.h> header file.  */
+#undef HAVE_NETINET6_TCP6_TIMER_H
+
+/* Define if you have the <netinet6/tcp6_var.h> header file.  */
+#undef HAVE_NETINET6_TCP6_VAR_H
+
+/* Define if you have the <netipx/ipx.h> header file.  */
+#undef HAVE_NETIPX_IPX_H
+
+/* Define if you have the <nlist.h> header file.  */
+#undef HAVE_NLIST_H
+
+/* Define if you have the <openssl/aes.h> header file.  */
+#undef HAVE_OPENSSL_AES_H
+
+/* Define if you have the <openssl/des.h> header file.  */
+#undef HAVE_OPENSSL_DES_H
+
+/* Define if you have the <openssl/evp.h> header file.  */
+#undef HAVE_OPENSSL_EVP_H
+
+/* Define if you have the <openssl/hmac.h> header file.  */
+#undef HAVE_OPENSSL_HMAC_H
+
+/* Define if you have the <osreldate.h> header file.  */
+#undef HAVE_OSRELDATE_H
+
+/* Define if you have the <pkginfo.h> header file.  */
+#undef HAVE_PKGINFO_H
+
+/* Define if you have the <pkglocs.h> header file.  */
+#undef HAVE_PKGLOCS_H
+
+/* Define if you have the <pthread.h> header file.  */
+#undef HAVE_PTHREAD_H
+
+/* Define if you have the <pwd.h> header file.  */
+#undef HAVE_PWD_H
+
+/* Define if you have the <regex.h> header file.  */
+#undef HAVE_REGEX_H
+
+/* Define if you have the <rpmio.h> header file.  */
+#undef HAVE_RPMIO_H
+
+/* Define if you have the <search.h> header file.  */
+#undef HAVE_SEARCH_H
+
+/* Define if you have the <sgtty.h> header file.  */
+#undef HAVE_SGTTY_H
+
+/* Define if you have the <stdarg.h> header file.  */
+#undef HAVE_STDARG_H
+
+/* Define if you have the <stdlib.h> header file.  */
+#undef HAVE_STDLIB_H
+
+/* Define if you have the <string.h> header file.  */
+#undef HAVE_STRING_H
+
+/* Define if you have the <sys/cdefs.h> header file.  */
+#undef HAVE_SYS_CDEFS_H
+
+/* Define if you have the <sys/conf.h> header file.  */
+#undef HAVE_SYS_CONF_H
+
+/* Define if you have the <sys/dir.h> header file.  */
+#undef HAVE_SYS_DIR_H
+
+/* Define if you have the <sys/diskio.h> header file.  */
+#undef HAVE_SYS_DISKIO_H
+
+/* Define if you have the <sys/dkio.h> header file.  */
+#undef HAVE_SYS_DKIO_H
+
+/* Define if you have the <sys/dmap.h> header file.  */
+#undef HAVE_SYS_DMAP_H
+
+/* Define if you have the <sys/file.h> header file.  */
+#undef HAVE_SYS_FILE_H
+
+/* Define if you have the <sys/filio.h> header file.  */
+#undef HAVE_SYS_FILIO_H
+
+/* Define if you have the <sys/fixpoint.h> header file.  */
+#undef HAVE_SYS_FIXPOINT_H
+
+/* Define if you have the <sys/fs.h> header file.  */
+#undef HAVE_SYS_FS_H
+
+/* Define if you have the <sys/hashing.h> header file.  */
+#undef HAVE_SYS_HASHING_H
+
+/* Define if you have the <sys/ioctl.h> header file.  */
+#undef HAVE_SYS_IOCTL_H
+
+/* Define if you have the <sys/loadavg.h> header file.  */
+#undef HAVE_SYS_LOADAVG_H
+
+/* Define if you have the <sys/mbuf.h> header file.  */
+#undef HAVE_SYS_MBUF_H
+
+/* Define if you have the <sys/mntent.h> header file.  */
+#undef HAVE_SYS_MNTENT_H
+
+/* Define if you have the <sys/mnttab.h> header file.  */
+#undef HAVE_SYS_MNTTAB_H
+
+/* Define if you have the <sys/mount.h> header file.  */
+#undef HAVE_SYS_MOUNT_H
+
+/* Define if you have the <sys/ndir.h> header file.  */
+#undef HAVE_SYS_NDIR_H
+
+/* Define if you have the <sys/param.h> header file.  */
+#undef HAVE_SYS_PARAM_H
+
+/* Define if you have the <sys/pool.h> header file.  */
+#undef HAVE_SYS_POOL_H
+
+/* Define if you have the <sys/proc.h> header file.  */
+#undef HAVE_SYS_PROC_H
+
+/* Define if you have the <sys/protosw.h> header file.  */
+#undef HAVE_SYS_PROTOSW_H
+
+/* Define if you have the <sys/pstat.h> header file.  */
+#undef HAVE_SYS_PSTAT_H
+
+/* Define if you have the <sys/queue.h> header file.  */
+#undef HAVE_SYS_QUEUE_H
+
+/* Define if you have the <sys/select.h> header file.  */
+#undef HAVE_SYS_SELECT_H
+
+/* Define if you have the <sys/socket.h> header file.  */
+#undef HAVE_SYS_SOCKET_H
+
+/* Define if you have the <sys/socketvar.h> header file.  */
+#undef HAVE_SYS_SOCKETVAR_H
+
+/* Define if you have the <sys/sockio.h> header file.  */
+#undef HAVE_SYS_SOCKIO_H
+
+/* Define if you have the <sys/stat.h> header file.  */
+#undef HAVE_SYS_STAT_H
+
+/* Define if you have the <sys/statfs.h> header file.  */
+#undef HAVE_SYS_STATFS_H
+
+/* Define if you have the <sys/statvfs.h> header file.  */
+#undef HAVE_SYS_STATVFS_H
+
+/* Define if you have the <sys/stream.h> header file.  */
+#undef HAVE_SYS_STREAM_H
+
+/* Define if you have the <sys/swap.h> header file.  */
+#undef HAVE_SYS_SWAP_H
+
+/* Define if you have the <sys/sysctl.h> header file.  */
+#undef HAVE_SYS_SYSCTL_H
+
+/* Define if you have the <sys/sysmp.h> header file.  */
+#undef HAVE_SYS_SYSMP_H
+
+/* Define if you have the <sys/tcpipstats.h> header file.  */
+#undef HAVE_SYS_TCPIPSTATS_H
+
+/* Define if you have the <sys/time.h> header file.  */
+#undef HAVE_SYS_TIME_H
+
+/* Define if you have the <sys/un.h> header file.  */
+#undef HAVE_SYS_UN_H
+
+/* Define if you have the <sys/user.h> header file.  */
+#undef HAVE_SYS_USER_H
+
+/* Define if you have the <sys/utsname.h> header file.  */
+#undef HAVE_SYS_UTSNAME_H
+
+/* Define if you have the <sys/vfs.h> header file.  */
+#undef HAVE_SYS_VFS_H
+
+/* Define if you have the <sys/vm.h> header file.  */
+#undef HAVE_SYS_VM_H
+
+/* Define if you have the <sys/vmmac.h> header file.  */
+#undef HAVE_SYS_VMMAC_H
+
+/* Define if you have the <sys/vmmeter.h> header file.  */
+#undef HAVE_SYS_VMMETER_H
+
+/* Define if you have the <sys/vmparam.h> header file.  */
+#undef HAVE_SYS_VMPARAM_H
+
+/* Define if you have the <sys/vmsystm.h> header file.  */
+#undef HAVE_SYS_VMSYSTM_H
+
+/* Define if you have the <sys/vnode.h> header file.  */
+#undef HAVE_SYS_VNODE_H
+
+/* Define if you have the <syslog.h> header file.  */
+#undef HAVE_SYSLOG_H
+
+/* Define if you have the <ufs/ffs/fs.h> header file.  */
+#undef HAVE_UFS_FFS_FS_H
+
+/* Define if you have the <ufs/fs.h> header file.  */
+#undef HAVE_UFS_FS_H
+
+/* Define if you have the <ufs/ufs/dinode.h> header file.  */
+#undef HAVE_UFS_UFS_DINODE_H
+
+/* Define if you have the <ufs/ufs/inode.h> header file.  */
+#undef HAVE_UFS_UFS_INODE_H
+
+/* Define if you have the <ufs/ufs/quota.h> header file.  */
+#undef HAVE_UFS_UFS_QUOTA_H
+
+/* Define if you have the <unistd.h> header file.  */
+#undef HAVE_UNISTD_H
+
+/* Define if you have the <utmpx.h> header file.  */
+#undef HAVE_UTMPX_H
+
+/* Define if you have the <utsname.h> header file.  */
+#undef HAVE_UTSNAME_H
+
+/* Define if you have the <uvm/uvm_extern.h> header file.  */
+#undef HAVE_UVM_UVM_EXTERN_H
+
+/* Define if you have the <uvm/uvm_param.h> header file.  */
+#undef HAVE_UVM_UVM_PARAM_H
+
+/* Define if you have the <vm/swap_pager.h> header file.  */
+#undef HAVE_VM_SWAP_PAGER_H
+
+/* Define if you have the <vm/vm.h> header file.  */
+#undef HAVE_VM_VM_H
+
+/* Define if you have the <vm/vm_extern.h> header file.  */
+#undef HAVE_VM_VM_EXTERN_H
+
+/* Define if you have the <vm/vm_param.h> header file.  */
+#undef HAVE_VM_VM_PARAM_H
+
+/* Define if you have the <winsock.h> header file.  */
+#undef HAVE_WINSOCK_H
+
+/* Define if you have the <xti.h> header file.  */
+#undef HAVE_XTI_H
+
+/* Define if you have the RSAglue library (-lRSAglue).  */
+#undef HAVE_LIBRSAGLUE
+
+/* Define if you have the crypto library (-lcrypto).  */
+#undef HAVE_LIBCRYPTO
+
+/* Define if you have the dl library (-ldl).  */
+#undef HAVE_LIBDL
+
+/* Define if you have the efence library (-lefence).  */
+#undef HAVE_LIBEFENCE
+
+/* Define if you have the elf library (-lelf).  */
+#undef HAVE_LIBELF
+
+/* Define if you have the kstat library (-lkstat).  */
+#undef HAVE_LIBKSTAT
+
+/* Define if you have the kvm library (-lkvm).  */
+#undef HAVE_LIBKVM
+
+/* Define if you have the m library (-lm).  */
+#undef HAVE_LIBM
+
+/* Define if you have the mld library (-lmld).  */
+#undef HAVE_LIBMLD
+
+/* Define if you have the nsl library (-lnsl).  */
+#undef HAVE_LIBNSL
+
+/* Define if you have the rsaref library (-lrsaref).  */
+#undef HAVE_LIBRSAREF
+
+/* Define if you have the z library (-lz).  */
+#undef HAVE_LIBZ
+
+/* define if you have getdevs() */
+#undef HAVE_GETDEVS
+
+/* define if you have <netinet/in_pcb.h> */
+#undef HAVE_NETINET_IN_PCB_H
+
+/* define if you have <sys/disklabel.h> */
+#undef HAVE_SYS_DISKLABEL_H
+
+/* define if you are using linux and /proc/net/dev has the compressed
+   field, which exists in linux kernels 2.2 and greater. */
+#undef PROC_NET_DEV_HAS_COMPRESSED
+
+/* define rtentry to ortentry on SYSV machines (alphas) */
+#undef RTENTRY
+
+/* Use BSD 4.4 routing table entries? */
+#undef RTENTRY_4_4
+
+/* Does struct sigaction have a sa_sigaction field? */
+#undef STRUCT_SIGACTION_HAS_SA_SIGACTION
+
+/* Does struct sockaddr have a sa_len field? */
+#undef STRUCT_SOCKADDR_HAS_SA_LEN
+
+/* Does struct sockaddr have a sa_family2 field? */
+#undef STRUCT_SOCKADDR_HAS_SA_UNION_SA_GENERIC_SA_FAMILY2
+
+/* rtentry structure tests */
+#undef RTENTRY_RT_NEXT
+#undef STRUCT_RTENTRY_HAS_RT_DST
+#undef STRUCT_RTENTRY_HAS_RT_UNIT
+#undef STRUCT_RTENTRY_HAS_RT_USE
+#undef STRUCT_RTENTRY_HAS_RT_REFCNT
+#undef STRUCT_RTENTRY_HAS_RT_HASH
+
+/* ifnet structure tests */
+#undef STRUCT_IFNET_HAS_IF_BAUDRATE
+#undef STRUCT_IFNET_HAS_IF_BAUDRATE_IFS_VALUE
+#undef STRUCT_IFNET_HAS_IF_SPEED
+#undef STRUCT_IFNET_HAS_IF_TYPE
+#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_NOPROTO
+#undef STRUCT_IFNET_HAS_IF_OMCASTS
+#undef STRUCT_IFNET_HAS_IF_XNAME
+#undef STRUCT_IFNET_HAS_IF_OBYTES
+#undef STRUCT_IFNET_HAS_IF_IBYTES
+#undef STRUCT_IFNET_HAS_IF_ADDRLIST
+
+/* tcpstat.tcps_rcvmemdrop */
+#undef STRUCT_TCPSTAT_HAS_TCPS_RCVMEMDROP
+
+/* udpstat.udps_discard */
+#undef STRUCT_UDPSTAT_HAS_UDPS_DISCARD
+
+/* udpstat.udps_discard */
+#undef STRUCT_UDPSTAT_HAS_UDPS_NOPORT
+
+/* udpstat.udps_discard */
+#undef STRUCT_UDPSTAT_HAS_UDPS_NOPORTBCAST
+
+/* udpstat.udps_discard */
+#undef STRUCT_UDPSTAT_HAS_UDPS_FULLSOCK
+
+/* arphd.at_next */
+#undef STRUCT_ARPHD_HAS_AT_NEXT
+
+/* ifaddr.ifa_next */
+#undef STRUCT_IFADDR_HAS_IFA_NEXT
+
+/* ifnet.if_mtu */
+#undef STRUCT_IFNET_HAS_IF_MTU
+
+/* swdevt.sw_nblksenabled */
+#undef STRUCT_SWDEVT_HAS_SW_NBLKSENABLED
+
+/* nlist.n_value */
+#undef STRUCT_NLIST_HAS_N_VALUE
+
+/* ipstat structure tests */
+#undef STRUCT_IPSTAT_HAS_IPS_CANTFORWARD
+#undef STRUCT_IPSTAT_HAS_IPS_CANTFRAG
+#undef STRUCT_IPSTAT_HAS_IPS_DELIVERED
+#undef STRUCT_IPSTAT_HAS_IPS_FRAGDROPPED
+#undef STRUCT_IPSTAT_HAS_IPS_FRAGTIMEOUT
+#undef STRUCT_IPSTAT_HAS_IPS_LOCALOUT
+#undef STRUCT_IPSTAT_HAS_IPS_NOPROTO
+#undef STRUCT_IPSTAT_HAS_IPS_NOROUTE
+#undef STRUCT_IPSTAT_HAS_IPS_ODROPPED
+#undef STRUCT_IPSTAT_HAS_IPS_OFRAGMENTS
+#undef STRUCT_IPSTAT_HAS_IPS_REASSEMBLED
+
+/* vfsstat.f_frsize */
+#undef STRUCT_STATVFS_HAS_F_FRSIZE
+
+/* vfsstat.f_files */
+#undef STRUCT_STATVFS_HAS_F_FILES
+
+/* statfs inode structure tests*/
+#undef STRUCT_STATFS_HAS_F_FILES
+#undef STRUCT_STATFS_HAS_F_FFREE
+#undef STRUCT_STATFS_HAS_F_FAVAIL
+
+/* des_ks_struct.weak_key */
+#undef STRUCT_DES_KS_STRUCT_HAS_WEAK_KEY
+
+/* ifnet needs to have _KERNEL defined */
+#undef IFNET_NEEDS_KERNEL
+
+/* sysctl works to get boottime, etc... */
+#undef CAN_USE_SYSCTL
+
+/* type check for in_addr_t */
+#undef in_addr_t
+
+/* define if SIOCGIFADDR exists in sys/ioctl.h */
+#undef SYS_IOCTL_H_HAS_SIOCGIFADDR
+
+/* define if your compiler (processor) defines __FUNCTION__ for you */
+#undef HAVE_CPP_UNDERBAR_FUNCTION_DEFINED
+
+/* Mib-2 tree Info */
+/* These are the system information variables. */
+
+#define VERS_DESC   "unknown"             /* overridden at run time */
+#define SYS_NAME    "unknown"             /* overridden at run time */
+
+/* comment out the second define to turn off functionality for any of
+   these: (See README for details) */
+
+/*   proc PROCESSNAME [MAX] [MIN] */
+#define PROCMIBNUM 2
+
+/*   exec/shell NAME COMMAND      */
+#define SHELLMIBNUM 8
+
+/*   swap MIN                     */
+#define MEMMIBNUM 4
+
+/*   disk DISK MINSIZE            */
+#define DISKMIBNUM 9
+
+/*   load 1 5 15                  */
+#define LOADAVEMIBNUM 10
+
+/* which version are you using? This mibloc will tell you */
+#define VERSIONMIBNUM 100
+
+/* Reports errors the agent runs into */
+/* (typically its "can't fork, no mem" problems) */
+#define ERRORMIBNUM 101
+
+/* The sub id of EXTENSIBLEMIB returned to queries of
+   .iso.org.dod.internet.mgmt.mib-2.system.sysObjectID.0 */
+#define AGENTID 250
+
+/* This ID is returned after the AGENTID above.  IE, the resulting
+   value returned by a query to sysObjectID is
+   EXTENSIBLEMIB.AGENTID.???, where ??? is defined below by OSTYPE */
+
+#define HPUX9ID 1
+#define SUNOS4ID 2 
+#define SOLARISID 3
+#define OSFID 4
+#define ULTRIXID 5
+#define HPUX10ID 6
+#define NETBSD1ID 7
+#define FREEBSDID 8
+#define IRIXID 9
+#define LINUXID 10
+#define BSDIID 11
+#define OPENBSDID 12
+#define WIN32ID 13
+#define HPUX11ID 14
+#define UNKNOWNID 255
+
+#ifdef hpux9
+#define OSTYPE HPUX9ID
+#endif
+#ifdef hpux10
+#define OSTYPE HPUX10ID
+#endif
+#ifdef hpux11
+#define OSTYPE HPUX11ID
+#endif
+#ifdef sunos4
+#define OSTYPE SUNOS4ID
+#endif
+#ifdef solaris2
+#define OSTYPE SOLARISID
+#endif
+#if defined(osf3) || defined(osf4)
+#define OSTYPE OSFID
+#endif
+#ifdef ultrix4
+#define OSTYPE ULTRIXID
+#endif
+#ifdef netbsd1
+#define OSTYPE NETBSD1ID
+#endif
+#ifdef freebsd2
+#define OSTYPE FREEBSDID
+#endif
+#if defined(irix6) || defined(irix5)
+#define OSTYPE IRIXID
+#endif
+#ifdef linux
+#define OSTYPE LINUXID
+#endif
+#if defined(bsdi2) || defined(bsdi3) || defined(bsdi4)
+#define OSTYPE BSDIID
+#endif
+#ifdef openbsd2
+#define OSTYPE OPENBSDID
+#endif
+/* unknown */
+#ifndef OSTYPE
+#define OSTYPE UNKNOWNID
+#endif
+
+/* The enterprise number has been assigned by the IANA group.   */
+/* Optionally, this may point to the location in the tree your  */
+/* company/organization has been allocated.                     */
+/* The assigned enterprise number for the NET_SNMP MIB modules. */
+#define ENTERPRISE_OID			8072
+#define ENTERPRISE_MIB			1,3,6,1,4,1,8072
+#define ENTERPRISE_DOT_MIB		1.3.6.1.4.1.8072
+#define ENTERPRISE_DOT_MIB_LENGTH	7
+
+/* The assigned enterprise number for sysObjectID. */
+#define SYSTEM_MIB		1,3,6,1,4,1,8072,3,2,OSTYPE
+#define SYSTEM_DOT_MIB		1.3.6.1.4.1.8072.3.2.OSTYPE
+#define SYSTEM_DOT_MIB_LENGTH	10
+
+/* The assigned enterprise number for notifications. */
+#define NOTIFICATION_MIB		1,3,6,1,4,1,8072,4
+#define NOTIFICATION_DOT_MIB		1.3.6.1.4.1.8072.4
+#define NOTIFICATION_DOT_MIB_LENGTH	8
+
+/* this is the location of the ucdavis mib tree.  It shouldn't be
+   changed, as the places it is used are expected to be constant
+   values or are directly tied to the UCD-SNMP-MIB. */
+#define UCDAVIS_OID		2021
+#define UCDAVIS_MIB		1,3,6,1,4,1,2021
+#define UCDAVIS_DOT_MIB		1.3.6.1.4.1.2021
+#define UCDAVIS_DOT_MIB_LENGTH	7
+
+/* how long to wait (seconds) for error querys before reseting the error trap.*/
+#define ERRORTIMELENGTH 600 
+
+/* Exec command to fix PROC problems */
+/* %s will be replaced by the process name in error */
+
+/* #define PROCFIXCMD "/usr/bin/perl /local/scripts/fixproc %s" */
+
+/* Exec command to fix EXEC problems */
+/* %s will be replaced by the exec/script name in error */
+
+/* #define EXECFIXCMD "/usr/bin/perl /local/scripts/fixproc %s" */
+
+/* Should exec output Cashing be used (speeds up things greatly), and
+   if so, After how many seconds should the cache re-newed?  Note:
+   Don't define CASHETIME to disable cashing completely */
+
+#define EXCACHETIME 30
+#define CACHEFILE ".snmp-exec-cache"
+#define MAXCACHESIZE (200*80)   /* roughly 200 lines max */
+
+#define MAXDISKS 50                      /* can't scan more than this number */
+
+/* misc defaults */
+
+/* default of 100 meg minimum if the minimum size is not specified in
+   the config file */
+#define DEFDISKMINIMUMSPACE 100000
+
+#define DEFMAXLOADAVE 12.0      /* default maximum load average before error */
+
+#define MAXREADCOUNT 100   /* max times to loop reading output from
+                              execs.  Because of sleep(1)s, this will also
+                              be time to wait (in seconds) for exec to finish */
+
+#define SNMPBLOCK 1       /* Set to 1 if you want snmpgets to block and never
+                             timeout.  Original CMU code had this
+                             hardcoded into the code as = 1 */
+
+#define RESTARTSLEEP 5    /* How long to wait after a snmpset to
+                             EXTENSIBLEMIB.VERSIONMIBNUM.VERRESTARTAGENT
+                             before restarting the agent.  This is
+                             necessary to finish the snmpset reply
+                             before restarting. */
+
+/* Number of community strings to store */
+#define NUM_COMMUNITIES	5
+
+/* UNdefine to allow specifying zero-length community string */
+/* #define NO_ZEROLENGTH_COMMUNITY 1 */
+
+/* #define EXIT_ON_BAD_KLREAD  */
+/* define to exit the agent on a bad kernel read */
+
+#define LASTFIELD -1      /* internal define */
+
+/* configure options specified */
+#define CONFIGURE_OPTIONS ""
+
+/* got socklen_t? */
+#undef HAVE_SOCKLEN_T
+
+/* got in_addr_t? */
+#undef HAVE_IN_ADDR_T
+
+#ifndef HAVE_STRCHR
+#ifdef HAVE_INDEX
+# define strchr index
+# define strrchr rindex
+#endif
+#endif
+
+#ifndef HAVE_INDEX
+#ifdef HAVE_STRCHR
+# define index strchr
+# define rindex strrchr
+#endif
+#endif
+
+#ifndef HAVE_MEMCPY
+#ifdef HAVE_BCOPY
+# define memcpy(d, s, n) bcopy ((s), (d), (n))
+# define memmove(d, s, n) bcopy ((s), (d), (n))
+# define memcmp bcmp
+#endif
+#endif
+
+#ifndef HAVE_MEMMOVE
+#ifdef HAVE_MEMCPY
+# define memmove memcpy
+#endif
+#endif
+
+#ifndef HAVE_BCOPY
+#ifdef HAVE_MEMCPY
+# define bcopy(s, d, n) memcpy ((d), (s), (n))
+# define bzero(p,n) memset((p),(0),(n))
+# define bcmp memcmp
+#endif
+#endif
+
+/* If you have openssl 0.9.7 or above, you likely have AES support. */
+#undef USE_OPENSSL
+#if defined(USE_OPENSSL) && defined(HAVE_OPENSSL_AES_H) && defined(HAVE_AES_CFB128_ENCRYPT)
+#define HAVE_AES 1
+#endif
+
+/* define random functions */
+
+#ifndef HAVE_RANDOM
+#ifdef HAVE_LRAND48
+#define random lrand48
+#define srandom(s) srand48(s)
+#else
+#ifdef HAVE_RAND
+#define random rand
+#define srandom(s) srand(s)
+#endif
+#endif
+#endif
+
+/* define signal if DNE */
+
+#ifndef HAVE_SIGNAL
+#ifdef HAVE_SIGSET
+#define signal(a,b) sigset(a,b)
+#endif
+#endif
+
+/* define if you have librpm and libdb */
+#undef HAVE_LIBDB
+#undef HAVE_LIBRPM
+
+/* define if you have pkginfo */
+#undef HAVE_PKGINFO
+
+/* define if you have gethostbyname */
+#undef HAVE_GETHOSTBYNAME
+
+/* define if you have getservbyname */
+#undef HAVE_GETSERVBYNAME
+
+/* printing system */
+#undef HAVE_LPSTAT
+#undef LPSTAT_PATH
+#undef HAVE_PRINTCAP
+
+/*  Pluggable transports.  */
+
+/*  This is defined if support for the UDP/IP transport domain is
+    available.   */
+#undef SNMP_TRANSPORT_UDP_DOMAIN
+
+/*  This is defined if support for the TCP/IP transport domain is
+    available.  */
+#undef SNMP_TRANSPORT_TCP_DOMAIN
+
+/*  This is defined if support for the Unix transport domain
+    (a.k.a. "local IPC") is available.  */
+#undef SNMP_TRANSPORT_UNIX_DOMAIN
+
+/*  This is defined if support for the AAL5 PVC transport domain is
+    available.  */
+#undef SNMP_TRANSPORT_AAL5PVC_DOMAIN
+
+/*  This is defined if support for the IPX transport domain is
+    available.  */
+#undef SNMP_TRANSPORT_IPX_DOMAIN
+
+/*  This is defined if support for the UDP/IPv6 transport domain is
+    available.  */
+#undef SNMP_TRANSPORT_UDPIPV6_DOMAIN
+
+/*  This is defined if support for the TCP/IPv6 transport domain is
+    available.  */
+#undef SNMP_TRANSPORT_TCPIPV6_DOMAIN
+
+/* define this if the USM security module is available */
+#undef SNMP_SECMOD_USM
+
+/* define this if the KSM (kerberos based snmp) security module is available */
+#undef SNMP_SECMOD_KSM
+
+/* define this if we're using the new MIT crypto API */
+#undef MIT_NEW_CRYPTO
+
+/* define if you want to build with reentrant/threaded code */
+#undef NS_REENTRANT
+
+/* Not-to-be-compiled macros for use by configure only */
+#define config_require(x)
+#define config_arch_require(x,y)
+#define config_parse_dot_conf(w,x,y,z)
+#define config_add_mib(x)
+  
+#ifdef WIN32
+#define ENV_SEPARATOR ";"
+#define ENV_SEPARATOR_CHAR ';'
+#else
+#define ENV_SEPARATOR ":"
+#define ENV_SEPARATOR_CHAR ':'
+#endif
+
+#include SYSTEM_INCLUDE_FILE
+#include MACHINE_INCLUDE_FILE
+
+#if defined(HAVE_NLIST) && defined(STRUCT_NLIST_HAS_N_VALUE) && !defined(DONT_USE_NLIST) && !defined(NO_KMEM_USAGE)
+#define CAN_USE_NLIST
+#endif
+
+#if HAVE_DMALLOC_H
+#define DMALLOC_FUNC_CHECK
+#endif
+
+#undef INET6
+
+#ifndef NETSNMP_INLINE
+#   define NETSNMP_NO_INLINE
+#   define NETSNMP_INLINE
+#endif
+
+#endif /* NET_SNMP_CONFIG_H */
diff -Naur tomato/release/src/router/snmp/include/net-snmp/net-snmp-includes.h tomato121/release/src/router/snmp/include/net-snmp/net-snmp-includes.h
--- tomato/release/src/router/snmp/include/net-snmp/net-snmp-includes.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/include/net-snmp/net-snmp-includes.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,78 @@
+#ifndef NET_SNMP_INCLUDES_H
+#define NET_SNMP_INCLUDES_H
+
+    /**
+     *  Convenience header file to pull in the full
+     *     Net-SNMP library API in one go, together with
+     *     certain commonly-required system header files.
+     */
+
+
+    /*
+     *  Common system header requirements
+     */
+#include <stdio.h>
+#include <sys/types.h>
+
+#if HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+
+#if HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#if HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+
+#if TIME_WITH_SYS_TIME
+# ifdef WIN32
+#  include <sys/timeb.h>
+# else
+#  include <sys/time.h>
+# endif
+# include <time.h>
+#else
+# if HAVE_SYS_TIME_H
+#  include <sys/time.h>
+# else
+#  include <time.h>
+# endif
+#endif
+
+/*
+ * Must be right after system headers, but before library code for best usage 
+ */
+#if HAVE_DMALLOC_H
+#include <dmalloc.h>
+#endif
+
+  /*
+   * The check for missing 'in_addr_t' is handled
+   * within the main net-snmp-config.h file 
+   */
+
+
+    /*
+     *  The full Net-SNMP API
+     */
+#include <net-snmp/definitions.h>
+#include <net-snmp/types.h>
+
+#include <net-snmp/utilities.h>
+#include <net-snmp/session_api.h>
+#include <net-snmp/pdu_api.h>
+#include <net-snmp/mib_api.h>
+#include <net-snmp/varbind_api.h>
+#include <net-snmp/config_api.h>
+#include <net-snmp/output_api.h>
+#include <net-snmp/utilities.h>
+#include <net-snmp/snmpv3_api.h>
+
+#ifdef CMU_COMPATIBLE
+#include <net-snmp/library/cmu_compat.h>
+#endif
+
+#endif                          /* NET_SNMP_INCLUDES_H */
diff -Naur tomato/release/src/router/snmp/include/net-snmp/output_api.h tomato121/release/src/router/snmp/include/net-snmp/output_api.h
--- tomato/release/src/router/snmp/include/net-snmp/output_api.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/include/net-snmp/output_api.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,29 @@
+#ifndef NET_SNMP_LOGGING_API_H
+#define NET_SNMP_LOGGING_API_H
+
+    /**
+     *  Library API routines concerned with logging and message output
+     *    (including error handling and debugging).
+     */
+
+#include <net-snmp/types.h>
+
+    /*
+     *  For the initial release, this will just refer to the
+     *  relevant UCD header files.
+     *    In due course, the routines relevant to this area of the
+     *  API will be identified, and listed here directly.
+     *
+     *  But for the time being, this header file is a placeholder,
+     *  to allow application writers to adopt the new header file names.
+     */
+
+#include <net-snmp/library/snmp_client.h>
+#include <net-snmp/library/snmp_debug.h>
+#include <net-snmp/library/snmp_logging.h>
+
+#ifndef ERROR_MSG
+#define ERROR_MSG(string)	snmp_set_detail(string)
+#endif
+
+#endif                          /* NET_SNMP_LOGGING_API_H */
diff -Naur tomato/release/src/router/snmp/include/net-snmp/pdu_api.h tomato121/release/src/router/snmp/include/net-snmp/pdu_api.h
--- tomato/release/src/router/snmp/include/net-snmp/pdu_api.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/include/net-snmp/pdu_api.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,24 @@
+#ifndef NET_SNMP_PDU_API_H
+#define NET_SNMP_PDU_API_H
+
+    /**
+     *  Library API routines concerned with SNMP PDUs.
+     */
+
+#include <net-snmp/types.h>
+
+    /*
+     *  For the initial release, this will just refer to the
+     *  relevant UCD header files.
+     *    In due course, the routines relevant to this area of the
+     *  API will be identified, and listed here directly.
+     *
+     *  But for the time being, this header file is a placeholder,
+     *  to allow application writers to adopt the new header file names.
+     */
+
+#include <net-snmp/library/snmp_api.h>
+#include <net-snmp/library/snmp_client.h>
+#include <net-snmp/library/asn1.h>
+
+#endif                          /* NET_SNMP_PDU_API_H */
diff -Naur tomato/release/src/router/snmp/include/net-snmp/session_api.h tomato121/release/src/router/snmp/include/net-snmp/session_api.h
--- tomato/release/src/router/snmp/include/net-snmp/session_api.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/include/net-snmp/session_api.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,52 @@
+#ifndef NET_SNMP_SESSION_API_H
+#define NET_SNMP_SESSION_API_H
+
+    /**
+     *  Library API routines concerned with specifying and using SNMP "sessions"
+     *    including sending and receiving requests.
+     */
+
+#include <net-snmp/types.h>
+
+    /*
+     *  For the initial release, this will just refer to the
+     *  relevant UCD header files.
+     *    In due course, the routines relevant to this area of the
+     *  API will be identified, and listed here directly.
+     *
+     *  But for the time being, this header file is a placeholder,
+     *  to allow application writers to adopt the new header file names.
+     */
+
+#include <net-snmp/library/snmp_api.h>
+#include <net-snmp/library/snmp_client.h>
+#include <net-snmp/library/asn1.h>
+#include <net-snmp/library/callback.h>
+
+#include <net-snmp/library/snmp_transport.h>
+#include <net-snmp/library/snmpCallbackDomain.h>
+#ifdef SNMP_TRANSPORT_UNIX_DOMAIN
+#include <net-snmp/library/snmpUnixDomain.h>
+#endif
+#ifdef SNMP_TRANSPORT_UDP_DOMAIN
+#include <net-snmp/library/snmpUDPDomain.h>
+#endif
+#ifdef SNMP_TRANSPORT_TCP_DOMAIN
+#include <net-snmp/library/snmpTCPDomain.h>
+#endif
+#ifdef SNMP_TRANSPORT_UDPIPV6_DOMAIN
+#include <net-snmp/library/snmpUDPIPv6Domain.h>
+#endif
+#ifdef SNMP_TRANSPORT_TCPIPV6_DOMAIN
+#include <net-snmp/library/snmpTCPIPv6Domain.h>
+#endif
+#ifdef SNMP_TRANSPORT_IPX_DOMAIN
+#include <net-snmp/library/snmpIPXDomain.h>
+#endif
+#ifdef SNMP_TRANSPORT_AAL5PVC_DOMAIN
+#include <net-snmp/library/snmpAAL5PVCDomain.h>
+#endif
+
+#include <net-snmp/library/ucd_compat.h>
+
+#endif                          /* NET_SNMP_SESSION_API_H */
diff -Naur tomato/release/src/router/snmp/include/net-snmp/snmpv3_api.h tomato121/release/src/router/snmp/include/net-snmp/snmpv3_api.h
--- tomato/release/src/router/snmp/include/net-snmp/snmpv3_api.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/include/net-snmp/snmpv3_api.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,38 @@
+#ifndef NET_SNMP_SNMPV3_H
+#define NET_SNMP_SNMPV3_H
+
+    /**
+     *  Library API routines concerned with SNMPv3 handling.
+     *
+     *  Most of these would typically not be used directly,
+     *     but be invoked via version-independent API routines.
+     */
+
+#include <net-snmp/types.h>
+
+    /*
+     *  For the initial release, this will just refer to the
+     *  relevant UCD header files.
+     *    In due course, the routines relevant to this area of the
+     *  API will be identified, and listed here directly.
+     *
+     *  But for the time being, this header file is a placeholder,
+     *  to allow application writers to adopt the new header file names.
+     */
+
+#include <net-snmp/library/snmp_api.h>
+
+#include <net-snmp/library/callback.h>
+#include <net-snmp/library/snmpv3.h>
+#include <net-snmp/library/transform_oids.h>
+#include <net-snmp/library/keytools.h>
+#include <net-snmp/library/scapi.h>
+#include <net-snmp/library/lcd_time.h>
+#ifdef USE_INTERNAL_MD5
+#include <net-snmp/library/md5.h>
+#endif
+
+#include <net-snmp/library/snmp_secmod.h>
+#include <net-snmp/library/snmpv3-security-includes.h>
+
+#endif                          /* NET_SNMP_SNMPV3_H */
diff -Naur tomato/release/src/router/snmp/include/net-snmp/system/aix.h tomato121/release/src/router/snmp/include/net-snmp/system/aix.h
--- tomato/release/src/router/snmp/include/net-snmp/system/aix.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/include/net-snmp/system/aix.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,4 @@
+#include "generic.h"
+#include <sys/select.h>
+#undef TOTAL_MEMORY_SYMBOL
+
diff -Naur tomato/release/src/router/snmp/include/net-snmp/system/bsd.h tomato121/release/src/router/snmp/include/net-snmp/system/bsd.h
--- tomato/release/src/router/snmp/include/net-snmp/system/bsd.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/include/net-snmp/system/bsd.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,19 @@
+#include "generic.h"
+
+/*
+ * the bsd route symbol adds an 's' at the end to this symbol name 
+ */
+#undef RTTABLES_SYMBOL
+#define RTTABLES_SYMBOL "rt_tables"
+
+/*
+ * BSD systems use a different method of looking up sockaddr_in values 
+ */
+#define NEED_KLGETSA 1
+
+/*
+ * ARP_Scan_Next needs a 4th ifIndex argument 
+ */
+#define ARP_SCAN_FOUR_ARGUMENTS 1
+
+#define UTMP_HAS_NO_TYPE 1
diff -Naur tomato/release/src/router/snmp/include/net-snmp/system/bsdi3.h tomato121/release/src/router/snmp/include/net-snmp/system/bsdi3.h
--- tomato/release/src/router/snmp/include/net-snmp/system/bsdi3.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/include/net-snmp/system/bsdi3.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,2 @@
+#include "bsdi.h"
+#define bsdi2 1                 /* bsdi3 is a superset of bsdi2 */
diff -Naur tomato/release/src/router/snmp/include/net-snmp/system/bsdi4.h tomato121/release/src/router/snmp/include/net-snmp/system/bsdi4.h
--- tomato/release/src/router/snmp/include/net-snmp/system/bsdi4.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/include/net-snmp/system/bsdi4.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,11 @@
+#include "bsdi.h"
+#define bsdi2 1                 /* bsdi4 is a superset of bsdi2 */
+#undef NPROC_SYMBOL
+#undef PROC_SYMBOL
+
+#define MNTTYPE_UFS	"ufs"
+#define BerkelyFS	1
+#define MNTTYPE_MSDOS	"msdos"
+#define MNTTYPE_ISO9660 "cd9660"
+#define MNTTYPE_NFS 	"nfs"
+#define MNTTYPE_MFS 	"mfs"
diff -Naur tomato/release/src/router/snmp/include/net-snmp/system/bsdi.h tomato121/release/src/router/snmp/include/net-snmp/system/bsdi.h
--- tomato/release/src/router/snmp/include/net-snmp/system/bsdi.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/include/net-snmp/system/bsdi.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,3 @@
+#include "bsd.h"
+
+#define CHECK_RT_FLAGS 1
diff -Naur tomato/release/src/router/snmp/include/net-snmp/system/cygwin.h tomato121/release/src/router/snmp/include/net-snmp/system/cygwin.h
--- tomato/release/src/router/snmp/include/net-snmp/system/cygwin.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/include/net-snmp/system/cygwin.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,6 @@
+#include "generic.h"
+
+#undef HAVE_WINSOCK_H
+#undef bsdlike
+#undef MBSTAT_SYMBOL
+#undef TOTAL_MEMORY_SYMBOL
diff -Naur tomato/release/src/router/snmp/include/net-snmp/system/darwin.h tomato121/release/src/router/snmp/include/net-snmp/system/darwin.h
--- tomato/release/src/router/snmp/include/net-snmp/system/darwin.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/include/net-snmp/system/darwin.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,7 @@
+#include "freebsd4.h"
+#define darwin 1
+/*
+ * Although Darwin does have an fstab.h file, getfsfile etc. always return null.
+ * At least, as of 5.3.
+ */
+#undef HAVE_FSTAB_H
diff -Naur tomato/release/src/router/snmp/include/net-snmp/system/dynix.h tomato121/release/src/router/snmp/include/net-snmp/system/dynix.h
--- tomato/release/src/router/snmp/include/net-snmp/system/dynix.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/include/net-snmp/system/dynix.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,106 @@
+/*
+ * dynix.h
+ * 
+ * Date Created: Sat Jan 12 10:50:50 BST 2002
+ * Author:       Patrick Hess  <phess@hds.com>
+ */
+
+#include "generic.h"
+
+/*
+ * from s/sysv.h 
+ */
+#define SYSV 1
+
+/*
+ * to make these changes work... 
+ */
+/*
+ * maybe I should have used _SEQUENT_ in all this code..  dunno 
+ */
+#define dynix 1
+
+#undef TOTAL_MEMORY_SYMBOL
+#undef MBSTAT_SYMBOL
+
+/*
+ * Not enough alcohool in bloodstream [fmc] 
+ */
+#ifdef NPROC_SYMBOL
+#undef NPROC_SYMBOL
+#endif
+/*
+ * there might be a way to get NPROC...  this might work..  might not 
+ */
+/*
+ * #define NPROC_SYMBOL "procNPROC" 
+ */
+#ifdef PROC_SYMBOL
+#undef PROC_SYMBOL
+#endif
+
+/*
+ * stole these from Solaris... 
+ */
+#ifndef TCPTV_MIN
+#define TCPTV_MIN       (1*PR_SLOWHZ)   /* minimum allowable value */
+#endif
+#ifndef TCPTV_REXMTMAX
+#define TCPTV_REXMTMAX  (64*PR_SLOWHZ)  /* max allowable REXMT value */
+#endif
+
+/*
+ * some of the system headers wanna include asm code...  let's not 
+ */
+#define __NO_ASM_MACRO 1
+
+/*
+ * Dynix doesn't seem to set this.  Guess I'll set it here 
+ */
+#ifndef L_SET
+#define L_SET   SEEK_SET
+#endif
+
+
+/*
+ * configure fails to detect these properly 
+ */
+/*
+ * lives in libnsl.so 
+ */
+#define HAVE_GETHOSTNAME 1
+
+/*
+ * outta place...  lives in /usr/include/sys 
+ */
+#define  HAVE_NET_IF_DL_H 1
+
+/*
+ * got this library...  dunno why configure didn't find it 
+ */
+#define HAVE_LIBNSL 1
+
+/*
+ * My Dynix box has nearly 400 filesystems and well over 50 disks 
+ */
+/*
+ * #define MAXDISKS 500  
+ */
+
+/*
+ * lives in libsocket.so 
+ */
+#define HAVE_GETHOSTBYNAME 1
+
+/*
+ * lives in libsocket.so 
+ */
+#define HAVE_GETSERVBYNAME 1
+
+/*
+ * Might as well include this here, since a significant
+ * number of files seem to need it.  DTS 
+ */
+#if HAVE_SYS_SELECT_H
+#include <sys/select.h>
+#endif
diff -Naur tomato/release/src/router/snmp/include/net-snmp/system/freebsd2.h tomato121/release/src/router/snmp/include/net-snmp/system/freebsd2.h
--- tomato/release/src/router/snmp/include/net-snmp/system/freebsd2.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/include/net-snmp/system/freebsd2.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,10 @@
+#include "freebsd.h"
+
+/*
+ * this is not good enough before freebsd3! 
+ */
+#undef HAVE_NET_IF_MIB_H
+#undef PROC_SYMBOL
+#undef NPROC_SYMBOL
+#undef LOADAVE_SYMBOL
+#undef TOTAL_MEMORY_SYMBOL
diff -Naur tomato/release/src/router/snmp/include/net-snmp/system/freebsd3.h tomato121/release/src/router/snmp/include/net-snmp/system/freebsd3.h
--- tomato/release/src/router/snmp/include/net-snmp/system/freebsd3.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/include/net-snmp/system/freebsd3.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,11 @@
+#include "freebsd.h"
+
+#define freebsd2 1              /* freebsd3 is a superset of freebsd2 */
+
+#undef IFADDR_SYMBOL
+#define IFADDR_SYMBOL "in_ifaddrhead"
+
+#undef PROC_SYMBOL
+#undef NPROC_SYMBOL
+
+#undef TOTAL_MEMORY_SYMBOL
diff -Naur tomato/release/src/router/snmp/include/net-snmp/system/freebsd4.h tomato121/release/src/router/snmp/include/net-snmp/system/freebsd4.h
--- tomato/release/src/router/snmp/include/net-snmp/system/freebsd4.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/include/net-snmp/system/freebsd4.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,18 @@
+#include "freebsd.h"
+
+/*
+ * freebsd4 is a superset of freebsd2 and freebsd3 
+ */
+#define freebsd2 1
+#define freebsd3 1
+
+#undef IFADDR_SYMBOL
+#define IFADDR_SYMBOL "in_ifaddrhead"
+
+#undef PROC_SYMBOL
+#define PROC_SYMBOL "allproc"
+
+#undef NPROC_SYMBOL
+#define NPROC_SYMBOL "nprocs"
+
+#undef TOTAL_MEMORY_SYMBOL
diff -Naur tomato/release/src/router/snmp/include/net-snmp/system/freebsd.h tomato121/release/src/router/snmp/include/net-snmp/system/freebsd.h
--- tomato/release/src/router/snmp/include/net-snmp/system/freebsd.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/include/net-snmp/system/freebsd.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,21 @@
+#include "bsd.h"
+
+#define CHECK_RT_FLAGS 1
+
+/*
+ * udp_inpcb list symbol 
+ */
+#undef INP_NEXT_SYMBOL
+#define INP_NEXT_SYMBOL inp_list.le_next
+
+#undef INP_PREV_SYMBOL
+#define INP_PREV_SYMBOL inp_list.le_prev
+
+#undef TCP_TTL_SYMBOL
+#define TCP_TTL_SYMBOL "ip_defttl"
+
+#ifdef _PATH_UTMP
+#define UTMP_FILE _PATH_UTMP
+#else
+#define UTMP_FILE "/var/run/utmp"
+#endif
diff -Naur tomato/release/src/router/snmp/include/net-snmp/system/generic.h tomato121/release/src/router/snmp/include/net-snmp/system/generic.h
--- tomato/release/src/router/snmp/include/net-snmp/system/generic.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/include/net-snmp/system/generic.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,74 @@
+
+#define bsdlike 1
+
+/*
+ * nlist symbols in ip.c 
+ */
+#define IPSTAT_SYMBOL "ipstat"
+#define IP_FORWARDING_SYMBOL "ipforwarding"
+#define TCP_TTL_SYMBOL "tcpDefaultTTL"
+
+/*
+ * nlist symbols in interfaces.c 
+ */
+#define IFNET_SYMBOL "ifnet"
+#define IFADDR_SYMBOL "in_ifaddr"
+
+/*
+ * nlist symbols in at.c 
+ */
+#define ARPTAB_SYMBOL "arptab"
+#define ARPTAB_SIZE_SYMBOL "arptab_size"
+
+/*
+ * load average lookup symbol 
+ */
+#define LOADAVE_SYMBOL "avenrun"
+
+/*
+ * nlist symbols in hr_proc.c and memory.c 
+ */
+#define PHYSMEM_SYMBOL "physmem"
+#define TOTAL_MEMORY_SYMBOL "total"
+#define MBSTAT_SYMBOL "mbstat"
+#define SWDEVT_SYMBOL "swdevt"
+#define FSWDEVT_SYMBOL "fswdevt"
+#define NSWAPFS_SYMBOL "nswapfs"
+#define NSWAPDEV_SYMBOL "nswapdev"
+
+/*
+ * process nlist symbols. 
+ */
+#define NPROC_SYMBOL "nproc"
+#define PROC_SYMBOL "proc"
+
+/*
+ * icmp.c nlist symbols 
+ */
+#define ICMPSTAT_SYMBOL "icmpstat"
+
+/*
+ * tcp.c nlist symbols 
+ */
+#define TCPSTAT_SYMBOL "tcpstat"
+#define TCP_SYMBOL "tcb"
+
+/*
+ * upd.c nlist symbols 
+ */
+#define UDPSTAT_SYMBOL "udpstat"
+#define UDB_SYMBOL "udb"
+
+/*
+ * var_route.c nlist symbols 
+ */
+#define RTTABLES_SYMBOL "rt_table"
+#define RTHASHSIZE_SYMBOL "rthashsize"
+#define RTHOST_SYMBOL "rthost"
+#define RTNET_SYMBOL "rtnet"
+
+/*
+ * udp_inpcb list symbol 
+ */
+#define INP_NEXT_SYMBOL inp_next
+#define INP_PREV_SYMBOL inp_prev
diff -Naur tomato/release/src/router/snmp/include/net-snmp/system/hpux.h tomato121/release/src/router/snmp/include/net-snmp/system/hpux.h
--- tomato/release/src/router/snmp/include/net-snmp/system/hpux.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/include/net-snmp/system/hpux.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,65 @@
+#include "sysv.h"
+
+#ifdef hpux11
+#define DONT_USE_NLIST 1
+#endif
+
+#undef TCP_TTL_SYMBOL
+#ifndef hpux11
+#define TCP_TTL_SYMBOL "ipDefaultTTL"
+#endif
+
+#ifndef hpux11
+/*
+ * hpux specific 
+ */
+#define MIB_IPCOUNTER_SYMBOL "MIB_ipcounter"
+#define MIB_TCPCOUNTER_SYMBOL "MIB_tcpcounter"
+#define MIB_UDPCOUNTER_SYMBOL "MIB_udpcounter"
+#endif
+
+#undef ARPTAB_SYMBOL
+#ifndef hpux11
+#define ARPTAB_SYMBOL "arphd"
+#endif
+#undef ARPTAB_SIZE_SYMBOL
+#ifndef hpux11
+#define ARPTAB_SIZE_SYMBOL "arptab_nb"
+#endif
+
+#if defined(hpux10) || defined(hpux11)
+#undef SWDEVT_SYMBOL
+#undef FSWDEVT_SYMBOL
+#undef NSWAPFS_SYMBOL
+#undef NSWAPDEV_SYMBOL
+#undef LOADAVE_SYMBOL
+#undef PROC_SYMBOL
+#undef NPROC_SYMBOL
+#undef TOTAL_MEMORY_SYMBOL
+#undef MBSTAT_SYMBOL
+#endif
+
+#ifdef hpux11
+#undef IPSTAT_SYMBOL
+#undef TCP_SYMBOL
+#undef TCPSTAT_SYMBOL
+#undef UDB_SYMBOL
+#undef UDPSTAT_SYMBOL
+#undef ICMPSTAT_SYMBOL
+#undef IP_FORWARDING_SYMBOL
+#undef RTTABLES_SYMBOL
+#undef RTHASHSIZE_SYMBOL
+#undef RTHOST_SYMBOL
+#undef RTNET_SYMBOL
+
+#undef PHYSMEM_SYMBOL
+#endif
+
+/*
+ * ARP_Scan_Next needs a 4th ifIndex argument 
+ */
+#define ARP_SCAN_FOUR_ARGUMENTS
+
+#define rt_pad1 rt_refcnt
+
+#define hpux 1
diff -Naur tomato/release/src/router/snmp/include/net-snmp/system/irix.h tomato121/release/src/router/snmp/include/net-snmp/system/irix.h
--- tomato/release/src/router/snmp/include/net-snmp/system/irix.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/include/net-snmp/system/irix.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,45 @@
+/*
+ * irix.h
+ * 
+ * Date Created: Mon Feb 16 22:19:39 1998
+ * Author:       Simon Leinen  <simon@switch.ch>
+ */
+
+#include "generic.h"
+
+#undef TCP_TTL_SYMBOL
+#define TCP_TTL_SYMBOL "tcp_ttl"
+
+#undef IPSTAT_SYMBOL
+#define NO_DOUBLE_ICMPSTAT
+#undef ICMPSTAT_SYMBOL
+#undef TCPSTAT_SYMBOL
+#undef UDPSTAT_SYMBOL
+
+#define _KMEMUSER 1
+
+/*
+ * don't define _KERNEL before including sys/unistd.h 
+ */
+#define IFNET_NEEDS_KERNEL_LATE  1
+
+/*
+ * configure fails to detect these properly because they're broken headers 
+ */
+#define HAVE_NETINET_TCP_H 1
+#define HAVE_NETINET_IP_H 1
+
+/*
+ * don't use this on irix 
+ * it has a prototype of inet_addr() which conflicts
+ * with <netinet/in.h>
+ */
+#undef HAVE_ARPA_INET_H
+
+/*
+ * We need a prototype of inet_ntoa() then.
+ */
+extern const char *inet_ntoa();
+
+#define STREAM_NEEDS_KERNEL_ISLANDS
+
diff -Naur tomato/release/src/router/snmp/include/net-snmp/system/linux.h tomato121/release/src/router/snmp/include/net-snmp/system/linux.h
--- tomato/release/src/router/snmp/include/net-snmp/system/linux.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/include/net-snmp/system/linux.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,16 @@
+#include "sysv.h"
+
+#define DONT_USE_NLIST 1
+
+#undef NPROC_SYMBOL
+
+#undef bsdlike
+
+#define ARP_SCAN_FOUR_ARGUMENTS
+
+/*
+ * red hat >= 5.0 doesn't have this 
+ */
+#ifndef MNTTYPE_PROC
+#define MNTTYPE_PROC "proc"
+#endif
diff -Naur tomato/release/src/router/snmp/include/net-snmp/system/mips.h tomato121/release/src/router/snmp/include/net-snmp/system/mips.h
--- tomato/release/src/router/snmp/include/net-snmp/system/mips.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/include/net-snmp/system/mips.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,4 @@
+
+#define DONT_USE_NLIST 1
+
+#undef bsdlike
diff -Naur tomato/release/src/router/snmp/include/net-snmp/system/netbsd.h tomato121/release/src/router/snmp/include/net-snmp/system/netbsd.h
--- tomato/release/src/router/snmp/include/net-snmp/system/netbsd.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/include/net-snmp/system/netbsd.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,52 @@
+#include "bsd.h"
+
+#define PCB_TABLE 1
+#undef TCP_SYMBOL
+#define TCP_SYMBOL "tcbtable"
+#undef TCP_TTL_SYMBOL
+#define TCP_TTL_SYMBOL "ip_defttl"
+#undef UDB_SYMBOL
+#define UDB_SYMBOL "udbtable"
+#undef NPROC_SYMBOL
+#undef PROC_SYMBOL
+
+#define MBPOOL_SYMBOL	"mbpool"
+#define MCLPOOL_SYMBOL	"mclpool"
+
+/*
+ * inp_next symbol 
+ */
+#undef INP_NEXT_SYMBOL
+#define INP_NEXT_SYMBOL inp_queue.cqe_next
+#undef INP_PREV_SYMBOL
+#define INP_PREV_SYMBOL inp_queue.cqe_prev
+#define HAVE_INPCBTABLE 1
+
+#define UTMP_FILE _PATH_UTMP
+
+#ifndef netbsd1
+# define netbsd1 1
+#endif
+
+/*
+ * fixups for broken AC_CHECK_IFNET_FOR() 
+ */
+/*
+ * Remove when fixed in configure.in 
+ */
+#undef STRUCT_IFNET_HAS_IF_BAUDRATE
+#define STRUCT_IFNET_HAS_IF_BAUDRATE 1
+#undef STRUCT_IFNET_HAS_IF_TYPE
+#define STRUCT_IFNET_HAS_IF_TYPE 1
+#undef STRUCT_IFNET_HAS_IF_IMCASTS
+#define STRUCT_IFNET_HAS_IF_IMCASTS 1
+#undef STRUCT_IFNET_HAS_IF_IQDROPS
+#define STRUCT_IFNET_HAS_IF_IQDROPS 1
+#undef STRUCT_IFNET_HAS_IF_NOPROTO
+#define STRUCT_IFNET_HAS_IF_NOPROTO 1
+#undef STRUCT_IFNET_HAS_IF_OMCASTS
+#define STRUCT_IFNET_HAS_IF_OMCASTS 1
+#undef STRUCT_IFNET_HAS_IF_IBYTES
+#define STRUCT_IFNET_HAS_IF_IBYTES 1
+#undef STRUCT_IFNET_HAS_IF_OBYTES
+#define STRUCT_IFNET_HAS_IF_OBYTES 1
diff -Naur tomato/release/src/router/snmp/include/net-snmp/system/openbsd.h tomato121/release/src/router/snmp/include/net-snmp/system/openbsd.h
--- tomato/release/src/router/snmp/include/net-snmp/system/openbsd.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/include/net-snmp/system/openbsd.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,8 @@
+#include "netbsd.h"
+
+#define netbsd1 1               /* we're really close to this */
+#define UVM
+
+#undef MBPOOL_SYMBOL
+#undef MCLPOOL_SYMBOL
+#undef TOTAL_MEMORY_SYMBOL
diff -Naur tomato/release/src/router/snmp/include/net-snmp/system/solaris2.6.h tomato121/release/src/router/snmp/include/net-snmp/system/solaris2.6.h
--- tomato/release/src/router/snmp/include/net-snmp/system/solaris2.6.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/include/net-snmp/system/solaris2.6.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,2 @@
+#include "solaris.h"
+#define _SLASH_PROC_METHOD_ 1
diff -Naur tomato/release/src/router/snmp/include/net-snmp/system/solaris2.7.h tomato121/release/src/router/snmp/include/net-snmp/system/solaris2.7.h
--- tomato/release/src/router/snmp/include/net-snmp/system/solaris2.7.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/include/net-snmp/system/solaris2.7.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,3 @@
+#include "solaris.h"
+#define _SLASH_PROC_METHOD_ 1
+#define DONT_USE_NLIST 1
diff -Naur tomato/release/src/router/snmp/include/net-snmp/system/solaris2.8.h tomato121/release/src/router/snmp/include/net-snmp/system/solaris2.8.h
--- tomato/release/src/router/snmp/include/net-snmp/system/solaris2.8.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/include/net-snmp/system/solaris2.8.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,3 @@
+#include "solaris.h"
+#define _SLASH_PROC_METHOD_ 1
+#define DONT_USE_NLIST 1
diff -Naur tomato/release/src/router/snmp/include/net-snmp/system/solaris2.9.h tomato121/release/src/router/snmp/include/net-snmp/system/solaris2.9.h
--- tomato/release/src/router/snmp/include/net-snmp/system/solaris2.9.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/include/net-snmp/system/solaris2.9.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,3 @@
+#include "solaris.h"
+#define _SLASH_PROC_METHOD_ 1
+#define DONT_USE_NLIST 1
diff -Naur tomato/release/src/router/snmp/include/net-snmp/system/solaris.h tomato121/release/src/router/snmp/include/net-snmp/system/solaris.h
--- tomato/release/src/router/snmp/include/net-snmp/system/solaris.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/include/net-snmp/system/solaris.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,22 @@
+#include "sysv.h"
+
+#undef bsdlike
+#undef IP_FORWARDING_SYMBOL
+#undef ARPTAB_SYMBOL
+#define ARPTAB_SYMBOL "arptab_nb"
+#undef ARPTAB_SIZE_SYMBOL
+#define ARPTAB_SIZE_SYMBOL "arphd"
+#undef ICMPSTAT_SYMBOL
+#undef TCPSTAT_SYMBOL
+#undef TCP_SYMBOL
+#undef UDPSTAT_SYMBOL
+#undef UDB_SYMBOL
+#undef RTTABLES_SYMBOL
+#undef RTHASHSIZE_SYMBOL
+#undef RTHOST_SYMBOL
+#undef RTNET_SYMBOL
+#undef IPSTAT_SYMBOL
+#undef TCP_TTL_SYMBOL
+#undef PROC_SYMBOL
+#undef TOTAL_MEMORY_SYMBOL
+#undef MBSTAT_SYMBOL
diff -Naur tomato/release/src/router/snmp/include/net-snmp/system/sunos.h tomato121/release/src/router/snmp/include/net-snmp/system/sunos.h
--- tomato/release/src/router/snmp/include/net-snmp/system/sunos.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/include/net-snmp/system/sunos.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,12 @@
+#include "generic.h"
+
+typedef int     ssize_t;
+
+#undef IP_FORWARDING_SYMBOL
+#define IP_FORWARDING_SYMBOL "ip_forwarding"
+
+#undef TCP_TTL_SYMBOL
+#define TCP_TTL_SYMBOL "tcp_ttl"
+
+#define UTMP_HAS_NO_TYPE 1
+#define UTMP_FILE "/etc/utmp"
diff -Naur tomato/release/src/router/snmp/include/net-snmp/system/svr5.h tomato121/release/src/router/snmp/include/net-snmp/system/svr5.h
--- tomato/release/src/router/snmp/include/net-snmp/system/svr5.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/include/net-snmp/system/svr5.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,26 @@
+/*
+ * used to minimally build SCO UnixWare 7.1.0 using CCS 3.2 compiler - YMMV 
+ */
+
+#include "generic.h"
+
+/*
+ * using CCS "cc", "configure" does not find this item 
+ */
+#define HAVE_MEMCPY 1
+/*
+ * so, undo the damage done earlier in config.h 
+ */
+#undef memcpy
+#undef memmove
+#define HAVE_GETHOSTBYNAME 1
+
+/*
+ * lie about this next define to avoid sa_len and sa_family MACROS !! 
+ */
+#define STRUCT_SOCKADDR_HAS_SA_UNION_SA_GENERIC_SA_FAMILY2 1
+
+/*
+ * this header requires queue_t, not easily done without kernel headers 
+ */
+#undef HAVE_NETINET_IN_PCB_H
diff -Naur tomato/release/src/router/snmp/include/net-snmp/system/sysv.h tomato121/release/src/router/snmp/include/net-snmp/system/sysv.h
--- tomato/release/src/router/snmp/include/net-snmp/system/sysv.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/include/net-snmp/system/sysv.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,2 @@
+#include "generic.h"
+#define SYSV 1
diff -Naur tomato/release/src/router/snmp/include/net-snmp/system/ultrix4.h tomato121/release/src/router/snmp/include/net-snmp/system/ultrix4.h
--- tomato/release/src/router/snmp/include/net-snmp/system/ultrix4.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/include/net-snmp/system/ultrix4.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,9 @@
+#include "generic.h"
+#include <sys/types.h>
+
+typedef int     ssize_t;
+
+#undef TCP_TTL_SYMBOL
+#define TCP_TTL_SYMBOL "tcp_ttl"
+
+#undef RTTABLES_SYMBOL
diff -Naur tomato/release/src/router/snmp/include/net-snmp/types.h tomato121/release/src/router/snmp/include/net-snmp/types.h
--- tomato/release/src/router/snmp/include/net-snmp/types.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/include/net-snmp/types.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,96 @@
+#ifndef NET_SNMP_TYPES_H
+#define NET_SNMP_TYPES_H
+
+    /**
+     *  Definitions of data structures, used within the library API.
+     */
+
+#include <stdio.h>
+
+#ifndef NET_SNMP_CONFIG_H
+#error "Please include <net-snmp/net-snmp-config.h> before this file"
+#endif
+
+                        /*
+                         * For 'timeval' 
+                         */
+#if TIME_WITH_SYS_TIME
+# ifdef WIN32
+#  include <sys/timeb.h>
+# else
+#  include <sys/time.h>
+# endif
+# include <time.h>
+#else
+# if HAVE_SYS_TIME_H
+#  include <sys/time.h>
+# else
+#  include <time.h>
+# endif
+#endif
+
+#include <sys/types.h>
+#ifdef HAVE_WINSOCK_H
+#include <winsock.h>
+#endif
+
+#if HAVE_NETINET_IN_H
+#include <netinet/in.h>		/* For definition of in_addr_t */
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef MAX_SUBID               /* temporary - duplicate definition protection */
+#ifndef EIGHTBIT_SUBIDS
+typedef u_long  oid;
+#define MAX_SUBID   0xFFFFFFFF
+#else
+typedef u_char  oid;
+#define MAX_SUBID   0xFF
+#endif
+#endif
+
+#ifndef HAVE_SOCKLEN_T
+typedef u_int socklen_t;
+#endif
+
+#ifndef HAVE_IN_ADDR_T
+typedef u_int in_addr_t;
+#endif
+
+
+    /*
+     *  For the initial release, this will just refer to the
+     *  relevant UCD header files.
+     *    In due course, the types and structures relevant to the
+     *  Net-SNMP API will be identified, and defined here directly.
+     *
+     *  But for the time being, this header file is primarily a placeholder,
+     *  to allow application writers to adopt the new header file names.
+     */
+
+
+#include <net-snmp/definitions.h>
+#include <net-snmp/library/snmp_api.h>
+/*
+ * #include <net-snmp/library/libsnmp.h> 
+ */
+
+    typedef struct netsnmp_index_s {
+       int          len;
+       oid         *oids;
+    } netsnmp_index;
+
+
+    typedef struct netsnmp_void_array_s {
+       size_t  size;
+       void * *array;
+    } netsnmp_void_array;
+
+#ifdef __cplusplus
+};
+#endif
+
+#endif                          /* NET_SNMP_TYPES_H */
diff -Naur tomato/release/src/router/snmp/include/net-snmp/utilities.h tomato121/release/src/router/snmp/include/net-snmp/utilities.h
--- tomato/release/src/router/snmp/include/net-snmp/utilities.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/include/net-snmp/utilities.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,49 @@
+#ifndef NET_SNMP_UTILITIES_H
+#define NET_SNMP_UTILITIES_H
+
+    /**
+     *  Library API routines not specifically concerned with SNMP directly,
+     *    but used more generally within the library, agent and other applications.
+     *
+     *  This also includes "standard" system routines, which are missing on
+     *    particular O/S distributiones.
+     */
+
+#include <net-snmp/types.h>
+
+    /*
+     *  For the initial release, this will just refer to the
+     *  relevant UCD header files.
+     *    In due course, the routines relevant to this area of the
+     *  API will be identified, and listed here directly.
+     *
+     *  But for the time being, this header file is a placeholder,
+     *  to allow application writers to adopt the new header file names.
+     */
+
+#include <net-snmp/library/snmp_api.h>
+#include <net-snmp/library/snmp_client.h>
+#include <net-snmp/library/getopt.h>
+
+#ifdef HAVE_NETINET_IN_H
+#include <netinet/in.h>         /* for in_addr_t */
+#endif
+#include <net-snmp/library/system.h>
+#include <net-snmp/library/tools.h>
+#include <net-snmp/library/asn1.h>      /* for counter64 */
+#include <net-snmp/library/int64.h>
+
+#include <net-snmp/library/mt_support.h>
+/*  #include <net-snmp/library/snmp_locking.h>  */
+#include <net-snmp/library/snmp_alarm.h>
+#include <net-snmp/library/data_list.h>
+#include <net-snmp/library/callback.h>
+#include <net-snmp/library/oid_stash.h>
+#include <net-snmp/library/snmp.h>
+#include <net-snmp/library/snmp_impl.h>
+#include <net-snmp/library/snmp-tc.h>
+#include <net-snmp/library/check_varbind.h>
+
+#include <net-snmp/version.h>
+
+#endif                          /* NET_SNMP_UTILITIES_H */
diff -Naur tomato/release/src/router/snmp/include/net-snmp/varbind_api.h tomato121/release/src/router/snmp/include/net-snmp/varbind_api.h
--- tomato/release/src/router/snmp/include/net-snmp/varbind_api.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/include/net-snmp/varbind_api.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,24 @@
+#ifndef NET_SNMP_VARBIND_API_H
+#define NET_SNMP_VARBIND_API_H
+
+    /**
+     *  Library API routines concerned with variable bindings and values.
+     */
+
+#include <net-snmp/types.h>
+
+    /*
+     *  For the initial release, this will just refer to the
+     *  relevant UCD header files.
+     *    In due course, the routines relevant to this area of the
+     *  API will be identified, and listed here directly.
+     *
+     *  But for the time being, this header file is a placeholder,
+     *  to allow application writers to adopt the new header file names.
+     */
+
+#include <net-snmp/library/snmp_api.h>
+#include <net-snmp/library/snmp_client.h>
+#include <net-snmp/library/mib.h>
+
+#endif                          /* NET_SNMP_VARBIND_API_H */
diff -Naur tomato/release/src/router/snmp/include/net-snmp/version.h tomato121/release/src/router/snmp/include/net-snmp/version.h
--- tomato/release/src/router/snmp/include/net-snmp/version.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/include/net-snmp/version.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,14 @@
+#ifndef NET_SNMP_VERSION_H
+#define NET_SNMP_VERSION_H
+
+#ifdef __cplusplus
+extern          "C" {
+#endif
+
+    extern const char *NetSnmpVersionInfo;
+    const char     *netsnmp_get_version(void);
+
+#ifdef __cplusplus
+}
+#endif
+#endif                          /* NET_SNMP_VERSION_H */
diff -Naur tomato/release/src/router/snmp/include/ucd-snmp/agent_index.h tomato121/release/src/router/snmp/include/ucd-snmp/agent_index.h
--- tomato/release/src/router/snmp/include/ucd-snmp/agent_index.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/include/ucd-snmp/agent_index.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,9 @@
+#ifdef UCD_COMPATIBLE
+
+#include <net-snmp/agent/agent_index.h>
+
+#else
+
+#error "Please update your headers or configure using --enable-ucd-snmp-compatibility"
+
+#endif
diff -Naur tomato/release/src/router/snmp/include/ucd-snmp/agent_read_config.h tomato121/release/src/router/snmp/include/ucd-snmp/agent_read_config.h
--- tomato/release/src/router/snmp/include/ucd-snmp/agent_read_config.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/include/ucd-snmp/agent_read_config.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,9 @@
+#ifdef UCD_COMPATIBLE
+
+#include <net-snmp/agent/agent_read_config.h>
+
+#else
+
+#error "Please update your headers or configure using --enable-ucd-snmp-compatibility"
+
+#endif
diff -Naur tomato/release/src/router/snmp/include/ucd-snmp/agent_registry.h tomato121/release/src/router/snmp/include/ucd-snmp/agent_registry.h
--- tomato/release/src/router/snmp/include/ucd-snmp/agent_registry.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/include/ucd-snmp/agent_registry.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,9 @@
+#ifdef UCD_COMPATIBLE
+
+#include <net-snmp/agent/agent_registry.h>
+
+#else
+
+#error "Please update your headers or configure using --enable-ucd-snmp-compatibility"
+
+#endif
diff -Naur tomato/release/src/router/snmp/include/ucd-snmp/agent_trap.h tomato121/release/src/router/snmp/include/ucd-snmp/agent_trap.h
--- tomato/release/src/router/snmp/include/ucd-snmp/agent_trap.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/include/ucd-snmp/agent_trap.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,9 @@
+#ifdef UCD_COMPATIBLE
+
+#include <net-snmp/agent/agent_trap.h>
+
+#else
+
+#error "Please update your headers or configure using --enable-ucd-snmp-compatibility"
+
+#endif
diff -Naur tomato/release/src/router/snmp/include/ucd-snmp/asn1.h tomato121/release/src/router/snmp/include/ucd-snmp/asn1.h
--- tomato/release/src/router/snmp/include/ucd-snmp/asn1.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/include/ucd-snmp/asn1.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,9 @@
+#ifdef UCD_COMPATIBLE
+
+#include <net-snmp/library/asn1.h>
+
+#else
+
+#error "Please update your headers or configure using --enable-ucd-snmp-compatibility"
+
+#endif
diff -Naur tomato/release/src/router/snmp/include/ucd-snmp/auto_nlist.h tomato121/release/src/router/snmp/include/ucd-snmp/auto_nlist.h
--- tomato/release/src/router/snmp/include/ucd-snmp/auto_nlist.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/include/ucd-snmp/auto_nlist.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,9 @@
+#ifdef UCD_COMPATIBLE
+
+#include <net-snmp/agent/auto_nlist.h>
+
+#else
+
+#error "Please update your headers or configure using --enable-ucd-snmp-compatibility"
+
+#endif
diff -Naur tomato/release/src/router/snmp/include/ucd-snmp/callback.h tomato121/release/src/router/snmp/include/ucd-snmp/callback.h
--- tomato/release/src/router/snmp/include/ucd-snmp/callback.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/include/ucd-snmp/callback.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,9 @@
+#ifdef UCD_COMPATIBLE
+
+#include <net-snmp/library/callback.h>
+
+#else
+
+#error "Please update your headers or configure using --enable-ucd-snmp-compatibility"
+
+#endif
diff -Naur tomato/release/src/router/snmp/include/ucd-snmp/.cvsignore tomato121/release/src/router/snmp/include/ucd-snmp/.cvsignore
--- tomato/release/src/router/snmp/include/ucd-snmp/.cvsignore	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/include/ucd-snmp/.cvsignore	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1 @@
+ucd-snmp-config.h
diff -Naur tomato/release/src/router/snmp/include/ucd-snmp/default_store.h tomato121/release/src/router/snmp/include/ucd-snmp/default_store.h
--- tomato/release/src/router/snmp/include/ucd-snmp/default_store.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/include/ucd-snmp/default_store.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,88 @@
+#ifdef UCD_COMPATIBLE
+
+#include <net-snmp/library/default_store.h>
+
+/*  Compatibility definitions -- see above header for meaningful comments.  */
+
+#define DS_MAX_IDS			NETSNMP_DS_MAX_IDS
+#define DS_MAX_SUBIDS			NETSNMP_DS_MAX_SUBIDS
+
+#define DS_LIBRARY_ID			NETSNMP_DS_LIBRARY_ID
+#define DS_APPLICATION_ID		NETSNMP_DS_APPLICATION_ID
+#define DS_TOKEN_ID			NETSNMP_DS_TOKEN_ID
+
+#define DS_LIB_MIB_ERRORS		NETSNMP_DS_LIB_MIB_ERRORS
+#define DS_LIB_SAVE_MIB_DESCRS		NETSNMP_DS_LIB_SAVE_MIB_DESCRS
+#define DS_LIB_MIB_COMMENT_TERM		NETSNMP_DS_LIB_MIB_COMMENT_TERM
+#define DS_LIB_MIB_PARSE_LABEL		NETSNMP_DS_LIB_MIB_PARSE_LABEL
+#define DS_LIB_DUMP_PACKET		NETSNMP_DS_LIB_DUMP_PACKET
+#define DS_LIB_LOG_TIMESTAMP		NETSNMP_DS_LIB_LOG_TIMESTAMP
+#define DS_LIB_DONT_READ_CONFIGS	NETSNMP_DS_LIB_DONT_READ_CONFIGS
+#define DS_LIB_MIB_REPLACE		NETSNMP_DS_LIB_MIB_REPLACE
+#define DS_LIB_PRINT_NUMERIC_ENUM	NETSNMP_DS_LIB_PRINT_NUMERIC_ENUM
+#define DS_LIB_PRINT_NUMERIC_OIDS	NETSNMP_DS_LIB_PRINT_NUMERIC_OIDS
+#define DS_LIB_DONT_BREAKDOWN_OIDS	NETSNMP_DS_LIB_DONT_BREAKDOWN_OIDS
+#define DS_LIB_ALARM_DONT_USE_SIG 	NETSNMP_DS_LIB_ALARM_DONT_USE_SIG
+#define DS_LIB_PRINT_FULL_OID 		NETSNMP_DS_LIB_PRINT_FULL_OID
+#define DS_LIB_QUICK_PRINT 		NETSNMP_DS_LIB_QUICK_PRINT
+#define DS_LIB_RANDOM_ACCESS 		NETSNMP_DS_LIB_RANDOM_ACCESS
+#define DS_LIB_REGEX_ACCESS 		NETSNMP_DS_LIB_REGEX_ACCESS
+#define DS_LIB_DONT_CHECK_RANGE 	NETSNMP_DS_LIB_DONT_CHECK_RANGE
+#define DS_LIB_NO_TOKEN_WARNINGS 	NETSNMP_DS_LIB_NO_TOKEN_WARNINGS
+#define DS_LIB_NUMERIC_TIMETICKS 	NETSNMP_DS_LIB_NUMERIC_TIMETICKS
+#define DS_LIB_ESCAPE_QUOTES 		NETSNMP_DS_LIB_ESCAPE_QUOTES
+#define DS_LIB_REVERSE_ENCODE 		NETSNMP_DS_LIB_REVERSE_ENCODE
+#define DS_LIB_PRINT_BARE_VALUE 	NETSNMP_DS_LIB_PRINT_BARE_VALUE
+#define DS_LIB_EXTENDED_INDEX 		NETSNMP_DS_LIB_EXTENDED_INDEX
+#define DS_LIB_PRINT_HEX_TEXT 		NETSNMP_DS_LIB_PRINT_HEX_TEXT
+
+#define DS_LIB_MIB_WARNINGS		NETSNMP_DS_LIB_MIB_WARNINGS
+#define DS_LIB_SECLEVEL			NETSNMP_DS_LIB_SECLEVEL
+#define DS_LIB_SNMPVERSION		NETSNMP_DS_LIB_SNMPVERSION
+#define DS_LIB_DEFAULT_PORT		NETSNMP_DS_LIB_DEFAULT_PORT
+#define DS_LIB_PRINT_SUFFIX_ONLY	NETSNMP_DS_LIB_PRINT_SUFFIX_ONLY
+
+#define DS_LIB_SECNAME			NETSNMP_DS_LIB_SECNAME
+#define DS_LIB_CONTEXT			NETSNMP_DS_LIB_CONTEXT
+#define DS_LIB_PASSPHRASE		NETSNMP_DS_LIB_PASSPHRASE
+#define DS_LIB_AUTHPASSPHRASE		NETSNMP_DS_LIB_AUTHPASSPHRASE
+#define DS_LIB_PRIVPASSPHRASE		NETSNMP_DS_LIB_PRIVPASSPHRASE
+#define DS_LIB_OPTIONALCONFIG		NETSNMP_DS_LIB_OPTIONALCONFIG
+#define DS_LIB_APPTYPE			NETSNMP_DS_LIB_APPTYPE
+#define DS_LIB_COMMUNITY		NETSNMP_DS_LIB_COMMUNITY
+#define DS_LIB_PERSISTENT_DIR		NETSNMP_DS_LIB_PERSISTENT_DIR
+#define DS_LIB_CONFIGURATION_DIR	NETSNMP_DS_LIB_CONFIGURATION_DIR
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+int	ds_set_boolean		(int storeid, int which, int value);
+int	ds_get_boolean		(int storeid, int which);
+int	ds_toggle_boolean	(int storeid, int which);
+
+int	ds_set_int		(int storeid, int which, int value);
+int	ds_get_int		(int storeid, int which);
+
+int	ds_set_string		(int storeid, int which, const char *value);
+char   *ds_get_string		(int storeid, int which);
+
+int 	ds_set_void		(int storeid, int which, void *value);
+void   *ds_get_void		(int storeid, int which);
+
+int	ds_register_config	(u_char type, const char *ftype,
+				 const char *token, int storeid, int which);
+int	ds_register_premib	(u_char type, const char *ftype,
+				 const char *token, int storeid, int which);
+
+void	ds_shutdown		(void);
+
+#ifdef __cplusplus
+}
+#endif
+
+#else /* UCD_COMPATIBLE */
+
+#error "Please update your headers or configure using --enable-ucd-snmp-compatibility"
+
+#endif
diff -Naur tomato/release/src/router/snmp/include/ucd-snmp/ds_agent.h tomato121/release/src/router/snmp/include/ucd-snmp/ds_agent.h
--- tomato/release/src/router/snmp/include/ucd-snmp/ds_agent.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/include/ucd-snmp/ds_agent.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,9 @@
+#ifdef UCD_COMPATIBLE
+
+#include <net-snmp/agent/ds_agent.h>
+
+#else
+
+#error "Please update your headers or configure using --enable-ucd-snmp-compatibility"
+
+#endif
diff -Naur tomato/release/src/router/snmp/include/ucd-snmp/header_complex.h tomato121/release/src/router/snmp/include/ucd-snmp/header_complex.h
--- tomato/release/src/router/snmp/include/ucd-snmp/header_complex.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/include/ucd-snmp/header_complex.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,9 @@
+#ifdef UCD_COMPATIBLE
+
+#include <net-snmp/agent/header_complex.h>
+
+#else
+
+#error "Please update your headers or configure using --enable-ucd-snmp-compatibility"
+
+#endif
diff -Naur tomato/release/src/router/snmp/include/ucd-snmp/int64.h tomato121/release/src/router/snmp/include/ucd-snmp/int64.h
--- tomato/release/src/router/snmp/include/ucd-snmp/int64.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/include/ucd-snmp/int64.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,9 @@
+#ifdef UCD_COMPATIBLE
+
+#include <net-snmp/library/int64.h>
+
+#else
+
+#error "Please update your headers or configure using --enable-ucd-snmp-compatibility"
+
+#endif
diff -Naur tomato/release/src/router/snmp/include/ucd-snmp/keytools.h tomato121/release/src/router/snmp/include/ucd-snmp/keytools.h
--- tomato/release/src/router/snmp/include/ucd-snmp/keytools.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/include/ucd-snmp/keytools.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,9 @@
+#ifdef UCD_COMPATIBLE
+
+#include <net-snmp/library/keytools.h>
+
+#else
+
+#error "Please update your headers or configure using --enable-ucd-snmp-compatibility"
+
+#endif
diff -Naur tomato/release/src/router/snmp/include/ucd-snmp/mib.h tomato121/release/src/router/snmp/include/ucd-snmp/mib.h
--- tomato/release/src/router/snmp/include/ucd-snmp/mib.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/include/ucd-snmp/mib.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,9 @@
+#ifdef UCD_COMPATIBLE
+
+#include <net-snmp/library/mib.h>
+
+#else
+
+#error "Please update your headers or configure using --enable-ucd-snmp-compatibility"
+
+#endif
diff -Naur tomato/release/src/router/snmp/include/ucd-snmp/mibincl.h tomato121/release/src/router/snmp/include/ucd-snmp/mibincl.h
--- tomato/release/src/router/snmp/include/ucd-snmp/mibincl.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/include/ucd-snmp/mibincl.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,9 @@
+#ifdef UCD_COMPATIBLE
+
+#include <net-snmp/library/mibincl.h>
+
+#else
+
+#error "Please update your headers or configure using --enable-ucd-snmp-compatibility"
+
+#endif
diff -Naur tomato/release/src/router/snmp/include/ucd-snmp/mib_module_config.h tomato121/release/src/router/snmp/include/ucd-snmp/mib_module_config.h
--- tomato/release/src/router/snmp/include/ucd-snmp/mib_module_config.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/include/ucd-snmp/mib_module_config.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,9 @@
+#ifdef UCD_COMPATIBLE
+
+#include <net-snmp/agent/mib_module_config.h>
+
+#else
+
+#error "Please update your headers or configure using --enable-ucd-snmp-compatibility"
+
+#endif
diff -Naur tomato/release/src/router/snmp/include/ucd-snmp/parse.h tomato121/release/src/router/snmp/include/ucd-snmp/parse.h
--- tomato/release/src/router/snmp/include/ucd-snmp/parse.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/include/ucd-snmp/parse.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,9 @@
+#ifdef UCD_COMPATIBLE
+
+#include <net-snmp/library/parse.h>
+
+#else
+
+#error "Please update your headers or configure using --enable-ucd-snmp-compatibility"
+
+#endif
diff -Naur tomato/release/src/router/snmp/include/ucd-snmp/read_config.h tomato121/release/src/router/snmp/include/ucd-snmp/read_config.h
--- tomato/release/src/router/snmp/include/ucd-snmp/read_config.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/include/ucd-snmp/read_config.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,9 @@
+#ifdef UCD_COMPATIBLE
+
+#include <net-snmp/library/read_config.h>
+
+#else
+
+#error "Please update your headers or configure using --enable-ucd-snmp-compatibility"
+
+#endif
diff -Naur tomato/release/src/router/snmp/include/ucd-snmp/README tomato121/release/src/router/snmp/include/ucd-snmp/README
--- tomato/release/src/router/snmp/include/ucd-snmp/README	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/include/ucd-snmp/README	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,3 @@
+This directory contains compatibility include files to make the newer
+work of the net-snmp code still work with code written for the
+ucd-snmp package.
diff -Naur tomato/release/src/router/snmp/include/ucd-snmp/scapi.h tomato121/release/src/router/snmp/include/ucd-snmp/scapi.h
--- tomato/release/src/router/snmp/include/ucd-snmp/scapi.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/include/ucd-snmp/scapi.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,9 @@
+#ifdef UCD_COMPATIBLE
+
+#include <net-snmp/library/scapi.h>
+
+#else
+
+#error "Please update your headers or configure using --enable-ucd-snmp-compatibility"
+
+#endif
diff -Naur tomato/release/src/router/snmp/include/ucd-snmp/snmp_agent.h tomato121/release/src/router/snmp/include/ucd-snmp/snmp_agent.h
--- tomato/release/src/router/snmp/include/ucd-snmp/snmp_agent.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/include/ucd-snmp/snmp_agent.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,9 @@
+#ifdef UCD_COMPATIBLE
+
+#include <net-snmp/agent/snmp_agent.h>
+
+#else
+
+#error "Please update your headers or configure using --enable-ucd-snmp-compatibility"
+
+#endif
diff -Naur tomato/release/src/router/snmp/include/ucd-snmp/snmp_alarm.h tomato121/release/src/router/snmp/include/ucd-snmp/snmp_alarm.h
--- tomato/release/src/router/snmp/include/ucd-snmp/snmp_alarm.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/include/ucd-snmp/snmp_alarm.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,9 @@
+#ifdef UCD_COMPATIBLE
+
+#include <net-snmp/library/snmp_alarm.h>
+
+#else
+
+#error "Please update your headers or configure using --enable-ucd-snmp-compatibility"
+
+#endif
diff -Naur tomato/release/src/router/snmp/include/ucd-snmp/snmp_api.h tomato121/release/src/router/snmp/include/ucd-snmp/snmp_api.h
--- tomato/release/src/router/snmp/include/ucd-snmp/snmp_api.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/include/ucd-snmp/snmp_api.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,9 @@
+#ifdef UCD_COMPATIBLE
+
+#include <net-snmp/library/snmp_api.h>
+
+#else
+
+#error "Please update your headers or configure using --enable-ucd-snmp-compatibility"
+
+#endif
diff -Naur tomato/release/src/router/snmp/include/ucd-snmp/snmp_client.h tomato121/release/src/router/snmp/include/ucd-snmp/snmp_client.h
--- tomato/release/src/router/snmp/include/ucd-snmp/snmp_client.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/include/ucd-snmp/snmp_client.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,9 @@
+#ifdef UCD_COMPATIBLE
+
+#include <net-snmp/library/snmp_client.h>
+
+#else
+
+#error "Please update your headers or configure using --enable-ucd-snmp-compatibility"
+
+#endif
diff -Naur tomato/release/src/router/snmp/include/ucd-snmp/snmp_debug.h tomato121/release/src/router/snmp/include/ucd-snmp/snmp_debug.h
--- tomato/release/src/router/snmp/include/ucd-snmp/snmp_debug.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/include/ucd-snmp/snmp_debug.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,9 @@
+#ifdef UCD_COMPATIBLE
+
+#include <net-snmp/library/snmp_debug.h>
+
+#else
+
+#error "Please update your headers or configure using --enable-ucd-snmp-compatibility"
+
+#endif
diff -Naur tomato/release/src/router/snmp/include/ucd-snmp/snmp.h tomato121/release/src/router/snmp/include/ucd-snmp/snmp.h
--- tomato/release/src/router/snmp/include/ucd-snmp/snmp.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/include/ucd-snmp/snmp.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,9 @@
+#ifdef UCD_COMPATIBLE
+
+#include <net-snmp/library/snmp.h>
+
+#else
+
+#error "Please update your headers or configure using --enable-ucd-snmp-compatibility"
+
+#endif
diff -Naur tomato/release/src/router/snmp/include/ucd-snmp/snmp_impl.h tomato121/release/src/router/snmp/include/ucd-snmp/snmp_impl.h
--- tomato/release/src/router/snmp/include/ucd-snmp/snmp_impl.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/include/ucd-snmp/snmp_impl.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,11 @@
+#ifdef UCD_COMPATIBLE
+
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/types.h>
+#include <net-snmp/library/snmp_impl.h>
+
+#else
+
+#error "Please update your headers or configure using --enable-ucd-snmp-compatibility"
+
+#endif
diff -Naur tomato/release/src/router/snmp/include/ucd-snmp/snmp_impl.h.compat tomato121/release/src/router/snmp/include/ucd-snmp/snmp_impl.h.compat
--- tomato/release/src/router/snmp/include/ucd-snmp/snmp_impl.h.compat	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/include/ucd-snmp/snmp_impl.h.compat	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,9 @@
+#ifdef UCD_COMPATIBLE
+
+#include <net-snmp/library/snmp_impl.h>
+
+#else
+
+#error "Please update your headers or configure using --enable-ucd-snmp-compatibility"
+
+#endif
diff -Naur tomato/release/src/router/snmp/include/ucd-snmp/snmp_logging.h tomato121/release/src/router/snmp/include/ucd-snmp/snmp_logging.h
--- tomato/release/src/router/snmp/include/ucd-snmp/snmp_logging.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/include/ucd-snmp/snmp_logging.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,9 @@
+#ifdef UCD_COMPATIBLE
+
+#include <net-snmp/library/snmp_logging.h>
+
+#else
+
+#error "Please update your headers or configure using --enable-ucd-snmp-compatibility"
+
+#endif
diff -Naur tomato/release/src/router/snmp/include/ucd-snmp/snmp_parse_args.h tomato121/release/src/router/snmp/include/ucd-snmp/snmp_parse_args.h
--- tomato/release/src/router/snmp/include/ucd-snmp/snmp_parse_args.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/include/ucd-snmp/snmp_parse_args.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,9 @@
+#ifdef UCD_COMPATIBLE
+
+#include <net-snmp/library/snmp_parse_args.h>
+
+#else
+
+#error "Please update your headers or configure using --enable-ucd-snmp-compatibility"
+
+#endif
diff -Naur tomato/release/src/router/snmp/include/ucd-snmp/snmp-tc.h tomato121/release/src/router/snmp/include/ucd-snmp/snmp-tc.h
--- tomato/release/src/router/snmp/include/ucd-snmp/snmp-tc.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/include/ucd-snmp/snmp-tc.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,9 @@
+#ifdef UCD_COMPATIBLE
+
+#include <net-snmp/library/snmp-tc.h>
+
+#else
+
+#error "Please update your headers or configure using --enable-ucd-snmp-compatibility"
+
+#endif
diff -Naur tomato/release/src/router/snmp/include/ucd-snmp/snmpusm.h tomato121/release/src/router/snmp/include/ucd-snmp/snmpusm.h
--- tomato/release/src/router/snmp/include/ucd-snmp/snmpusm.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/include/ucd-snmp/snmpusm.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,9 @@
+#ifdef UCD_COMPATIBLE
+
+#include <net-snmp/library/snmpusm.h>
+
+#else
+
+#error "Please update your headers or configure using --enable-ucd-snmp-compatibility"
+
+#endif
diff -Naur tomato/release/src/router/snmp/include/ucd-snmp/snmpv3.h tomato121/release/src/router/snmp/include/ucd-snmp/snmpv3.h
--- tomato/release/src/router/snmp/include/ucd-snmp/snmpv3.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/include/ucd-snmp/snmpv3.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,9 @@
+#ifdef UCD_COMPATIBLE
+
+#include <net-snmp/library/snmpv3.h>
+
+#else
+
+#error "Please update your headers or configure using --enable-ucd-snmp-compatibility"
+
+#endif
diff -Naur tomato/release/src/router/snmp/include/ucd-snmp/snmp_vars.h tomato121/release/src/router/snmp/include/ucd-snmp/snmp_vars.h
--- tomato/release/src/router/snmp/include/ucd-snmp/snmp_vars.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/include/ucd-snmp/snmp_vars.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,9 @@
+#ifdef UCD_COMPATIBLE
+
+#include <net-snmp/library/snmp_vars.h>
+
+#else
+
+#error "Please update your headers or configure using --enable-ucd-snmp-compatibility"
+
+#endif
diff -Naur tomato/release/src/router/snmp/include/ucd-snmp/struct.h tomato121/release/src/router/snmp/include/ucd-snmp/struct.h
--- tomato/release/src/router/snmp/include/ucd-snmp/struct.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/include/ucd-snmp/struct.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,9 @@
+#ifdef UCD_COMPATIBLE
+
+#include <net-snmp/agent/struct.h>
+
+#else
+
+#error "Please update your headers or configure using --enable-ucd-snmp-compatibility"
+
+#endif
diff -Naur tomato/release/src/router/snmp/include/ucd-snmp/system.h tomato121/release/src/router/snmp/include/ucd-snmp/system.h
--- tomato/release/src/router/snmp/include/ucd-snmp/system.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/include/ucd-snmp/system.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,9 @@
+#ifdef UCD_COMPATIBLE
+
+#include <net-snmp/library/system.h>
+
+#else
+
+#error "Please update your headers or configure using --enable-ucd-snmp-compatibility"
+
+#endif
diff -Naur tomato/release/src/router/snmp/include/ucd-snmp/tools.h tomato121/release/src/router/snmp/include/ucd-snmp/tools.h
--- tomato/release/src/router/snmp/include/ucd-snmp/tools.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/include/ucd-snmp/tools.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,9 @@
+#ifdef UCD_COMPATIBLE
+
+#include <net-snmp/library/tools.h>
+
+#else
+
+#error "Please update your headers or configure using --enable-ucd-snmp-compatibility"
+
+#endif
diff -Naur tomato/release/src/router/snmp/include/ucd-snmp/transform_oids.h tomato121/release/src/router/snmp/include/ucd-snmp/transform_oids.h
--- tomato/release/src/router/snmp/include/ucd-snmp/transform_oids.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/include/ucd-snmp/transform_oids.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,9 @@
+#ifdef UCD_COMPATIBLE
+
+#include <net-snmp/library/transform_oids.h>
+
+#else
+
+#error "Please update your headers or configure using --enable-ucd-snmp-compatibility"
+
+#endif
diff -Naur tomato/release/src/router/snmp/include/ucd-snmp/ucd-snmp-agent-includes.h tomato121/release/src/router/snmp/include/ucd-snmp/ucd-snmp-agent-includes.h
--- tomato/release/src/router/snmp/include/ucd-snmp/ucd-snmp-agent-includes.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/include/ucd-snmp/ucd-snmp-agent-includes.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,9 @@
+#ifdef UCD_COMPATIBLE
+
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+#else
+
+#error "Please update your headers or configure using --enable-ucd-snmp-compatibility"
+
+#endif
diff -Naur tomato/release/src/router/snmp/include/ucd-snmp/ucd-snmp-config.h tomato121/release/src/router/snmp/include/ucd-snmp/ucd-snmp-config.h
--- tomato/release/src/router/snmp/include/ucd-snmp/ucd-snmp-config.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/include/ucd-snmp/ucd-snmp-config.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,2 @@
+#define UCD_COMPATIBLE
+#include <net-snmp/net-snmp-config.h>
diff -Naur tomato/release/src/router/snmp/include/ucd-snmp/ucd-snmp-includes.h tomato121/release/src/router/snmp/include/ucd-snmp/ucd-snmp-includes.h
--- tomato/release/src/router/snmp/include/ucd-snmp/ucd-snmp-includes.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/include/ucd-snmp/ucd-snmp-includes.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,9 @@
+#ifdef UCD_COMPATIBLE
+
+#include <net-snmp/net-snmp-includes.h>
+
+#else
+
+#error "Please update your headers or configure using --enable-ucd-snmp-compatibility"
+
+#endif
diff -Naur tomato/release/src/router/snmp/include/ucd-snmp/util_funcs.h tomato121/release/src/router/snmp/include/ucd-snmp/util_funcs.h
--- tomato/release/src/router/snmp/include/ucd-snmp/util_funcs.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/include/ucd-snmp/util_funcs.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,9 @@
+#ifdef UCD_COMPATIBLE
+
+#include <net-snmp/util_funcs.h>
+
+#else
+
+#error "Please update your headers or configure using --enable-ucd-snmp-compatibility"
+
+#endif
diff -Naur tomato/release/src/router/snmp/include/ucd-snmp/var_struct.h tomato121/release/src/router/snmp/include/ucd-snmp/var_struct.h
--- tomato/release/src/router/snmp/include/ucd-snmp/var_struct.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/include/ucd-snmp/var_struct.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,9 @@
+#ifdef UCD_COMPATIBLE
+
+#include <net-snmp/agent/var_struct.h>
+
+#else
+
+#error "Please update your headers or configure using --enable-ucd-snmp-compatibility"
+
+#endif
diff -Naur tomato/release/src/router/snmp/include/ucd-snmp/version.h tomato121/release/src/router/snmp/include/ucd-snmp/version.h
--- tomato/release/src/router/snmp/include/ucd-snmp/version.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/include/ucd-snmp/version.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,11 @@
+#ifdef UCD_COMPATIBLE
+
+#include <net-snmp/version.h>
+
+#define VersionInfo NetSnmpVersionInfo
+
+#else
+
+#error "Please update your headers or configure using --enable-ucd-snmp-compatibility"
+
+#endif
diff -Naur tomato/release/src/router/snmp/include/ucd-snmp/version.h.initializer tomato121/release/src/router/snmp/include/ucd-snmp/version.h.initializer
--- tomato/release/src/router/snmp/include/ucd-snmp/version.h.initializer	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/include/ucd-snmp/version.h.initializer	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,11 @@
+#ifdef UCD_COMPATIBLE
+
+#include <net-snmp/version.h>
+
+static const char *VersionInfo = NetSnmpVersionInfo;
+
+#else
+
+#error "Please update your headers or configure using --enable-ucd-snmp-compatibility"
+
+#endif
diff -Naur tomato/release/src/router/snmp/INSTALL tomato121/release/src/router/snmp/INSTALL
--- tomato/release/src/router/snmp/INSTALL	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/INSTALL	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,246 @@
+TABLE OF CONTENTS
+=================
+
+  Table Of Contents
+  Quick Instructions
+* Ucd-Snmp Specific Information
+  Long (but you should read these) Instructions
+  Installing the Perl/SNMP Module
+* Compilers and Options
+  Compiling For Multiple Architectures
+  Installation Names
+  Optional Features
+  Sharing Defaults
+  Operation Controls
+
+  * = required reading
+
+QUICK INSTRUCTIONS
+==================
+
+  1) Run ./configure
+     (type "./configure --help" for a quick usage summary.)
+     (--prefix=PATH will change the default /usr/local installation path.)
+     (see "Compilers and Options" on changing the complier to use)
+
+  2) Optionally edit include/net-snmp/net-snmp-config.h
+     (due to prompting done by the configure script, this is very rarely
+      necessary.)
+
+  3) make
+
+  4) Run the next two commands as root:
+  5) umask 022   # <-- zero-two-two
+  6) make install
+
+Note: By default, everything will be installed in /usr/local.
+      (see below for more instructions)
+
+UCD-SNMP Specific Information
+=============================
+
+As of V3.3.1 the configuration files are now looked for in
+$(prefix)/share/snmp, where ($prefix) is defined as the value passed
+to the --prefix argument of the configure script, or /usr/local if
+undefined.  In version 3.0.3 till 3.3, the files were kept in
+$(prefix)/lib/snmp
+
+Optional features to pass to configure for ucd-snmp can be obtained by
+running configure --help.
+
+LONG (but you should read these) INSTRUCTIONS
+=============================================
+
+   The `configure' shell script attempts to guess correct values for
+various system-dependent variables used during compilation.  It uses
+those values to create a `Makefile' in each directory of the package.
+It may also create one or more `.h' files containing system-dependent
+definitions.  Finally, it creates a shell script `config.status' that
+you can run in the future to recreate the current configuration, a file
+`config.cache' that saves the results of its tests to speed up
+reconfiguring, and a file `config.log' containing compiler output
+(useful mainly for debugging `configure').
+
+   If you need to do unusual things to compile the package, please try
+to figure out how `configure' could check whether to do them, and mail
+diffs or instructions to the address given in the `README' so they can
+be considered for the next release.  If at some point `config.cache'
+contains results you don't want to keep, you may remove or edit it.
+
+   The file `configure.in' is used to create `configure' by a program
+called `autoconf'.  You only need `configure.in' if you want to change
+it or regenerate `configure' using a newer version of `autoconf'.
+
+The simplest way to compile this package is:
+
+  1. `cd' to the directory containing the package's source code and type
+     `./configure' to configure the package for your system.  If you're
+     using `csh' on an old version of System V, you might need to type
+     `sh ./configure' instead to prevent `csh' from trying to execute
+     `configure' itself.
+
+     Running `configure' takes awhile.  While running, it prints some
+     messages telling which features it is checking for.
+
+  2. Edit config.h.  IMPORTANT information is in here.  Like the
+     location of the log file and the location of the configuration
+     files.  Again, you should really edit config.h.in instead and
+     then run config.status, which will generate config.h from config.h.in.
+
+  3. Type `make' to compile the package.
+
+  4. Type `make install' to install the programs and any data files and
+     documentation.
+
+  5. You can remove the program binaries and object files from the
+     source code directory by typing `make clean'.  To also remove the
+     files that `configure' created (so you can compile the package for
+     a different kind of computer), type `make distclean'.
+
+
+Installing the Perl/SNMP Module
+===============================
+   The Perl/SNMP Module is now bundled with the ucd-snmp package and is
+located in the ucd-snmp/perl/SNMP directory. This module is an interface
+to the ucd-snmp SNMP client side management API. The Perl package
+provides a high level abstract interface to these functions for rapid
+application development. Following are the steps required to build and
+install this perl module.
+
+   1.) Be sure to read the ucd-snmp/perl/SNMP/README
+
+   2.) Be sure that ucd-snmp has been sucessfully tested and installed -
+       the headers and libraries will be required to build, the
+       applications and mibs will be required to test the perl module
+
+   3.) cd to ucd-snmp/perl/SNMP and run
+            perl Makefile.PL
+            make
+            make test
+            make install (as root)
+
+
+
+Compilers and Options
+=====================
+
+   Some systems require unusual options for compilation or linking that
+the `configure' script does not know about.  You can give `configure'
+initial values for variables by setting them in the environment.  Using
+a Bourne-compatible shell, you can do that on the command line like
+this:
+     CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure
+
+Or on systems that have the `env' program, you can do it like this:
+     env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure
+
+Compiling For Multiple Architectures
+====================================
+
+   You can compile the package for more than one kind of computer at the
+same time, by placing the object files for each architecture in their
+own directory.  To do this, you must use a version of `make' that
+supports the `VPATH' variable, such as GNU `make'.  `cd' to the
+directory where you want the object files and executables to go and run
+the `configure' script.  `configure' automatically checks for the
+source code in the directory that `configure' is in and in `..'.
+
+   If you have to use a `make' that does not supports the `VPATH'
+variable, there is a `maketarget' script that will generate a symlink'ed
+shadow-directory for the object files. Do a `sh maketarget', then `cd' into
+targets/`config.guess` and do the configuration and installation.
+
+Installation Names
+==================
+
+   By default, `make install' will install the package's files in
+`/usr/local/bin', `/usr/local/man', etc.  You can specify an
+installation prefix other than `/usr/local' by giving `configure' the
+option `--prefix=PATH'.
+
+   You can specify separate installation prefixes for
+architecture-specific files and architecture-independent files.  If you
+give `configure' the option `--exec-prefix=PATH', the package will use
+PATH as the prefix for installing programs and libraries.
+Documentation and other data files will still use the regular prefix.
+
+   If the package supports it, you can cause programs to be installed
+with an extra prefix or suffix on their names by giving `configure' the
+option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
+
+Optional Features
+=================
+
+   Some packages pay attention to `--enable-FEATURE' options to
+`configure', where FEATURE indicates an optional part of the package.
+They may also pay attention to `--with-PACKAGE' options, where PACKAGE
+is something like `gnu-as' or `x' (for the X Window System).  The
+`README' should mention any `--enable-' and `--with-' options that the
+package recognizes.
+
+   For packages that use the X Window System, `configure' can usually
+find the X include and library files automatically, but if it doesn't,
+you can use the `configure' options `--x-includes=DIR' and
+`--x-libraries=DIR' to specify their locations.
+
+Specifying the System Type
+==========================
+
+   There may be some features `configure' can not figure out
+automatically, but needs to determine by the type of host the package
+will run on.  Usually `configure' can figure that out, but if it prints
+a message saying it can not guess the host type, give it the
+`--host=TYPE' option.  TYPE can either be a short name for the system
+type, such as `sun4', or a canonical name with three fields:
+     CPU-COMPANY-SYSTEM
+
+See the file `config.sub' for the possible values of each field.  If
+`config.sub' isn't included in this package, then this package doesn't
+need to know the host type.
+
+   If you are building compiler tools for cross-compiling, you can also
+use the `--target=TYPE' option to select the type of system they will
+produce code for and the `--build=TYPE' option to select the type of
+system on which you are compiling the package.
+
+Sharing Defaults
+================
+
+   If you want to set default values for `configure' scripts to share,
+you can create a site shell script called `config.site' that gives
+default values for variables like `CC', `cache_file', and `prefix'.
+`configure' looks for `PREFIX/share/config.site' if it exists, then
+`PREFIX/etc/config.site' if it exists.  Or, you can set the
+`CONFIG_SITE' environment variable to the location of the site script.
+A warning: not all `configure' scripts look for a site script.
+
+Operation Controls
+==================
+
+   `configure' recognizes the following options to control how it
+operates.
+
+`--cache-file=FILE'
+     Use and save the results of the tests in FILE instead of
+     `./config.cache'.  Set FILE to `/dev/null' to disable caching, for
+     debugging `configure'.
+
+`--help'
+     Print a summary of the options to `configure', and exit.
+
+`--quiet'
+`--silent'
+`-q'
+     Do not print messages saying which checks are being made.
+
+`--srcdir=DIR'
+     Look for the package's source code in directory DIR.  Usually
+     `configure' can determine that directory automatically.
+
+`--version'
+     Print the version of Autoconf used to generate the `configure'
+     script, and exit.
+
+`configure' also accepts some other, not widely useful, options.
+
+
diff -Naur tomato/release/src/router/snmp/install-sh tomato121/release/src/router/snmp/install-sh
--- tomato/release/src/router/snmp/install-sh	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/install-sh	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,250 @@
+#! /bin/sh
+#
+# install - install a program, script, or datafile
+# This comes from X11R5 (mit/util/scripts/install.sh).
+#
+# Copyright 1991 by the Massachusetts Institute of Technology
+#
+# Permission to use, copy, modify, distribute, and sell this software and its
+# documentation for any purpose is hereby granted without fee, provided that
+# the above copyright notice appear in all copies and that both that
+# copyright notice and this permission notice appear in supporting
+# documentation, and that the name of M.I.T. not be used in advertising or
+# publicity pertaining to distribution of the software without specific,
+# written prior permission.  M.I.T. makes no representations about the
+# suitability of this software for any purpose.  It is provided "as is"
+# without express or implied warranty.
+#
+# Calling this script install-sh is preferred over install.sh, to prevent
+# `make' implicit rules from creating a file called install from it
+# when there is no Makefile.
+#
+# This script is compatible with the BSD install script, but was written
+# from scratch.
+#
+
+
+# set DOITPROG to echo to test this script
+
+# Don't use :- since 4.3BSD and earlier shells don't like it.
+doit="${DOITPROG-}"
+
+
+# put in absolute paths if you don't have them in your path; or use env. vars.
+
+mvprog="${MVPROG-mv}"
+cpprog="${CPPROG-cp}"
+chmodprog="${CHMODPROG-chmod}"
+chownprog="${CHOWNPROG-chown}"
+chgrpprog="${CHGRPPROG-chgrp}"
+stripprog="${STRIPPROG-strip}"
+rmprog="${RMPROG-rm}"
+mkdirprog="${MKDIRPROG-mkdir}"
+
+transformbasename=""
+transform_arg=""
+instcmd="$mvprog"
+chmodcmd="$chmodprog 0755"
+chowncmd=""
+chgrpcmd=""
+stripcmd=""
+rmcmd="$rmprog -f"
+mvcmd="$mvprog"
+src=""
+dst=""
+dir_arg=""
+
+while [ x"$1" != x ]; do
+    case $1 in
+	-c) instcmd="$cpprog"
+	    shift
+	    continue;;
+
+	-d) dir_arg=true
+	    shift
+	    continue;;
+
+	-m) chmodcmd="$chmodprog $2"
+	    shift
+	    shift
+	    continue;;
+
+	-o) chowncmd="$chownprog $2"
+	    shift
+	    shift
+	    continue;;
+
+	-g) chgrpcmd="$chgrpprog $2"
+	    shift
+	    shift
+	    continue;;
+
+	-s) stripcmd="$stripprog"
+	    shift
+	    continue;;
+
+	-t=*) transformarg=`echo $1 | sed 's/-t=//'`
+	    shift
+	    continue;;
+
+	-b=*) transformbasename=`echo $1 | sed 's/-b=//'`
+	    shift
+	    continue;;
+
+	*)  if [ x"$src" = x ]
+	    then
+		src=$1
+	    else
+		# this colon is to work around a 386BSD /bin/sh bug
+		:
+		dst=$1
+	    fi
+	    shift
+	    continue;;
+    esac
+done
+
+if [ x"$src" = x ]
+then
+	echo "install:	no input file specified"
+	exit 1
+else
+	true
+fi
+
+if [ x"$dir_arg" != x ]; then
+	dst=$src
+	src=""
+	
+	if [ -d $dst ]; then
+		instcmd=:
+	else
+		instcmd=mkdir
+	fi
+else
+
+# Waiting for this to be detected by the "$instcmd $src $dsttmp" command
+# might cause directories to be created, which would be especially bad 
+# if $src (and thus $dsttmp) contains '*'.
+
+	if [ -f $src -o -d $src ]
+	then
+		true
+	else
+		echo "install:  $src does not exist"
+		exit 1
+	fi
+	
+	if [ x"$dst" = x ]
+	then
+		echo "install:	no destination specified"
+		exit 1
+	else
+		true
+	fi
+
+# If destination is a directory, append the input filename; if your system
+# does not like double slashes in filenames, you may need to add some logic
+
+	if [ -d $dst ]
+	then
+		dst="$dst"/`basename $src`
+	else
+		true
+	fi
+fi
+
+## this sed command emulates the dirname command
+dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
+
+# Make sure that the destination directory exists.
+#  this part is taken from Noah Friedman's mkinstalldirs script
+
+# Skip lots of stat calls in the usual case.
+if [ ! -d "$dstdir" ]; then
+defaultIFS='	
+'
+IFS="${IFS-${defaultIFS}}"
+
+oIFS="${IFS}"
+# Some sh's can't handle IFS=/ for some reason.
+IFS='%'
+set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'`
+IFS="${oIFS}"
+
+pathcomp=''
+
+while [ $# -ne 0 ] ; do
+	pathcomp="${pathcomp}${1}"
+	shift
+
+	if [ ! -d "${pathcomp}" ] ;
+        then
+		$mkdirprog "${pathcomp}"
+	else
+		true
+	fi
+
+	pathcomp="${pathcomp}/"
+done
+fi
+
+if [ x"$dir_arg" != x ]
+then
+	$doit $instcmd $dst &&
+
+	if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi &&
+	if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi &&
+	if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi &&
+	if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi
+else
+
+# If we're going to rename the final executable, determine the name now.
+
+	if [ x"$transformarg" = x ] 
+	then
+		dstfile=`basename $dst`
+	else
+		dstfile=`basename $dst $transformbasename | 
+			sed $transformarg`$transformbasename
+	fi
+
+# don't allow the sed command to completely eliminate the filename
+
+	if [ x"$dstfile" = x ] 
+	then
+		dstfile=`basename $dst`
+	else
+		true
+	fi
+
+# Make a temp file name in the proper directory.
+
+	dsttmp=$dstdir/#inst.$$#
+
+# Move or copy the file name to the temp name
+
+	$doit $instcmd $src $dsttmp &&
+
+	trap "rm -f ${dsttmp}" 0 &&
+
+# and set any options; do chmod last to preserve setuid bits
+
+# If any of these fail, we abort the whole thing.  If we want to
+# ignore errors from any of these, just make sure not to ignore
+# errors from the above "$doit $instcmd $src $dsttmp" command.
+
+	if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi &&
+	if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi &&
+	if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi &&
+	if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi &&
+
+# Now rename the file to the real destination.
+
+	$doit $rmcmd -f $dstdir/$dstfile &&
+	$doit $mvcmd $dsttmp $dstdir/$dstfile 
+
+fi &&
+
+
+exit 0
diff -Naur tomato/release/src/router/snmp/local/convertcode tomato121/release/src/router/snmp/local/convertcode
--- tomato/release/src/router/snmp/local/convertcode	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/local/convertcode	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,132 @@
+#!/usr/bin/perl -p -i.snmpbak
+
+# this script should convert header files included based on the
+# ucd-snmp header file names and convert them to their new net-snmp
+# names, assuming the code was originally intended to be compiled
+# within the ucd-snmp source tree.
+
+s/include "config.h"/include <net-snmp\/net-snmp-config.h>/;
+s/include "asn1.h"/include <net-snmp\/asn1.h>/;
+s/include "callback.h"/include <net-snmp\/callback.h>/;
+s/include "data_list.h"/include <net-snmp\/data_list.h>/;
+s/include "default_store.h"/include <net-snmp\/default_store.h>/;
+s/include "getopt.h"/include <net-snmp\/getopt.h>/;
+s/include "int64.h"/include <net-snmp\/int64.h>/;
+s/include "keytools.h"/include <net-snmp\/keytools.h>/;
+s/include "lcd_time.h"/include <net-snmp\/lcd_time.h>/;
+s/include "libsnmp.h"/include <net-snmp\/libsnmp.h>/;
+s/include "md5.h"/include <net-snmp\/md5.h>/;
+s/include "mib.h"/include <net-snmp\/mib.h>/;
+s/include "mt_support.h"/include <net-snmp\/mt_support.h>/;
+s/include "net-snmp-config.h"/include <net-snmp\/net-snmp-config.h>/;
+s/include "net-snmp-includes.h"/include <net-snmp\/net-snmp-includes.h>/;
+s/include "oid_array.h"/include <net-snmp\/oid_array.h>/;
+s/include "oid_stash.h"/include <net-snmp\/oid_stash.h>/;
+s/include "parse.h"/include <net-snmp\/parse.h>/;
+s/include "read_config.h"/include <net-snmp\/read_config.h>/;
+s/include "scapi.h"/include <net-snmp\/scapi.h>/;
+s/include "snmpAAL5PVCDomain.h"/include <net-snmp\/snmpAAL5PVCDomain.h>/;
+s/include "snmp_alarm.h"/include <net-snmp\/snmp_alarm.h>/;
+s/include "snmp_api.h"/include <net-snmp\/snmp_api.h>/;
+s/include "snmpCallbackDomain.h"/include <net-snmp\/snmpCallbackDomain.h>/;
+s/include "snmp_client.h"/include <net-snmp\/snmp_client.h>/;
+s/include "snmp_debug.h"/include <net-snmp\/snmp_debug.h>/;
+s/include "snmp_enum.h"/include <net-snmp\/snmp_enum.h>/;
+s/include "snmp.h"/include <net-snmp\/snmp.h>/;
+s/include "snmp_impl.h"/include <net-snmp\/snmp_impl.h>/;
+s/include "snmpIPXDomain.h"/include <net-snmp\/snmpIPXDomain.h>/;
+s/include "snmpksm.h"/include <net-snmp\/snmpksm.h>/;
+s/include "snmp_locking.h"/include <net-snmp\/snmp_locking.h>/;
+s/include "snmp_logging.h"/include <net-snmp\/snmp_logging.h>/;
+s/include "snmp_parse_args.h"/include <net-snmp\/snmp_parse_args.h>/;
+s/include "snmp_secmod.h"/include <net-snmp\/snmp_secmod.h>/;
+s/include "snmp-tc.h"/include <net-snmp\/snmp-tc.h>/;
+s/include "snmpTCPDomain.h"/include <net-snmp\/snmpTCPDomain.h>/;
+s/include "snmpTCPIPv6Domain.h"/include <net-snmp\/snmpTCPIPv6Domain.h>/;
+s/include "snmp_transport.h"/include <net-snmp\/snmp_transport.h>/;
+s/include "snmpUDPDomain.h"/include <net-snmp\/snmpUDPDomain.h>/;
+s/include "snmpUDPIPv6Domain.h"/include <net-snmp\/snmpUDPIPv6Domain.h>/;
+s/include "snmpUnixDomain.h"/include <net-snmp\/snmpUnixDomain.h>/;
+s/include "snmpusm.h"/include <net-snmp\/snmpusm.h>/;
+s/include "snmpusm_init.h"/include <net-snmp\/snmpusm_init.h>/;
+s/include "snmpv3.h"/include <net-snmp\/snmpv3.h>/;
+s/include "system.h"/include <net-snmp\/system.h>/;
+s/include "tools.h"/include <net-snmp\/tools.h>/;
+s/include "transform_oids.h"/include <net-snmp\/transform_oids.h>/;
+s/include "vacm.h"/include <net-snmp\/vacm.h>/;
+s/include <asn1.h>/include <net-snmp\/asn1.h>/;
+s/include <callback.h>/include <net-snmp\/callback.h>/;
+s/include <data_list.h>/include <net-snmp\/data_list.h>/;
+s/include <default_store.h>/include <net-snmp\/default_store.h>/;
+s/include <getopt.h>/include <net-snmp\/getopt.h>/;
+s/include <int64.h>/include <net-snmp\/int64.h>/;
+s/include <keytools.h>/include <net-snmp\/keytools.h>/;
+s/include <lcd_time.h>/include <net-snmp\/lcd_time.h>/;
+s/include <libsnmp.h>/include <net-snmp\/libsnmp.h>/;
+s/include <md5.h>/include <net-snmp\/md5.h>/;
+s/include <mib.h>/include <net-snmp\/mib.h>/;
+s/include <mt_support.h>/include <net-snmp\/mt_support.h>/;
+s/include <net-snmp-config.h>/include <net-snmp\/net-snmp-config.h>/;
+s/include <net-snmp-includes.h>/include <net-snmp\/net-snmp-includes.h>/;
+s/include <oid_array.h>/include <net-snmp\/oid_array.h>/;
+s/include <oid_stash.h>/include <net-snmp\/oid_stash.h>/;
+s/include <parse.h>/include <net-snmp\/parse.h>/;
+s/include <read_config.h>/include <net-snmp\/read_config.h>/;
+s/include <scapi.h>/include <net-snmp\/scapi.h>/;
+s/include <snmpAAL5PVCDomain.h>/include <net-snmp\/snmpAAL5PVCDomain.h>/;
+s/include <snmp_alarm.h>/include <net-snmp\/snmp_alarm.h>/;
+s/include <snmp_api.h>/include <net-snmp\/snmp_api.h>/;
+s/include <snmpCallbackDomain.h>/include <net-snmp\/snmpCallbackDomain.h>/;
+s/include <snmp_client.h>/include <net-snmp\/snmp_client.h>/;
+s/include <snmp_debug.h>/include <net-snmp\/snmp_debug.h>/;
+s/include <snmp_enum.h>/include <net-snmp\/snmp_enum.h>/;
+s/include <snmp.h>/include <net-snmp\/snmp.h>/;
+s/include <snmp_impl.h>/include <net-snmp\/snmp_impl.h>/;
+s/include <snmpIPXDomain.h>/include <net-snmp\/snmpIPXDomain.h>/;
+s/include <snmpksm.h>/include <net-snmp\/snmpksm.h>/;
+s/include <snmp_locking.h>/include <net-snmp\/snmp_locking.h>/;
+s/include <snmp_logging.h>/include <net-snmp\/snmp_logging.h>/;
+s/include <snmp_parse_args.h>/include <net-snmp\/snmp_parse_args.h>/;
+s/include <snmp_secmod.h>/include <net-snmp\/snmp_secmod.h>/;
+s/include <snmp-tc.h>/include <net-snmp\/snmp-tc.h>/;
+s/include <snmpTCPDomain.h>/include <net-snmp\/snmpTCPDomain.h>/;
+s/include <snmpTCPIPv6Domain.h>/include <net-snmp\/snmpTCPIPv6Domain.h>/;
+s/include <snmp_transport.h>/include <net-snmp\/snmp_transport.h>/;
+s/include <snmpUDPDomain.h>/include <net-snmp\/snmpUDPDomain.h>/;
+s/include <snmpUDPIPv6Domain.h>/include <net-snmp\/snmpUDPIPv6Domain.h>/;
+s/include <snmpUnixDomain.h>/include <net-snmp\/snmpUnixDomain.h>/;
+s/include <snmpusm.h>/include <net-snmp\/snmpusm.h>/;
+s/include <snmpusm_init.h>/include <net-snmp\/snmpusm_init.h>/;
+s/include <snmpv3.h>/include <net-snmp\/snmpv3.h>/;
+s/include <system.h>/include <net-snmp\/system.h>/;
+s/include <tools.h>/include <net-snmp\/tools.h>/;
+s/include <transform_oids.h>/include <net-snmp\/transform_oids.h>/;
+s/include <vacm.h>/include <net-snmp\/vacm.h>/;
+s/\"agent_read_config.h\"/<net-snmp\/agent\/agent_read_config.h>/;
+s/\"agent_registry.h\"/<net-snmp\/agent\/agent_registry.h>/;
+s/\"agent_index.h\"/<net-snmp\/agent\/agent_index.h>/;
+s/\"agent_trap.h\"/<net-snmp\/agent\/agent_trap.h>/;
+s/\"auto_nlist.h\"/<net-snmp\/agent\/auto_nlist.h>/;
+s/\"ds_agent.h\"/<net-snmp\/agent\/ds_agent.h>/;
+s/\"snmp_agent.h\"/<net-snmp\/agent\/snmp_agent.h>/;
+s/\"snmp_vars.h\"/<net-snmp\/agent\/snmp_vars.h>/;
+s/\"var_struct.h\"/<net-snmp\/agent\/var_struct.h>/;
+s/\"agent_handler.h\"/<net-snmp\/agent\/agent_handler.h>/;
+s/\"ucd-snmp-agent-includes.h\"/<net-snmp\/agent\/net-snmp-agent-includes.h>/;
+s/\"agent_handler.h\"/<net-snmp\/agent\/agent_handler.h>/;
+s/\"agent_callbacks.h\"/<net-snmp\/agent\/agent_callbacks.h>/;
+s/\"mib_modules.h\"/<net-snmp\/agent\/mib_modules.h>/;
+s/<agent_read_config.h>/<net-snmp\/agent\/agent_read_config.h>/;
+s/<agent_registry.h>/<net-snmp\/agent\/agent_registry.h>/;
+s/<agent_index.h>/<net-snmp\/agent\/agent_index.h>/;
+s/<agent_trap.h>/<net-snmp\/agent\/agent_trap.h>/;
+s/<auto_nlist.h>/<net-snmp\/agent\/auto_nlist.h>/;
+s/<ds_agent.h>/<net-snmp\/agent\/ds_agent.h>/;
+s/<snmp_agent.h>/<net-snmp\/agent\/snmp_agent.h>/;
+s/<snmp_vars.h>/<net-snmp\/agent\/snmp_vars.h>/;
+s/<var_struct.h>/<net-snmp\/agent\/var_struct.h>/;
+s/<agent_handler.h>/<net-snmp\/agent\/agent_handler.h>/;
+s/<ucd-snmp-agent-includes.h>/<net-snmp\/agent\/net-snmp-agent-includes.h>/;
+s/<agent_handler.h>/<net-snmp\/agent\/agent_handler.h>/;
+s/<agent_callbacks.h>/<net-snmp\/agent\/agent_callbacks.h>/;
+s/<mib_modules.h>/<net-snmp\/agent\/mib_modules.h>/;
diff -Naur tomato/release/src/router/snmp/local/.cvsignore tomato121/release/src/router/snmp/local/.cvsignore
--- tomato/release/src/router/snmp/local/.cvsignore	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/local/.cvsignore	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,3 @@
+Makefile
+snmpcheck
+*.made
diff -Naur tomato/release/src/router/snmp/local/FAQ2HTML tomato121/release/src/router/snmp/local/FAQ2HTML
--- tomato/release/src/router/snmp/local/FAQ2HTML	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/local/FAQ2HTML	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,53 @@
+#!/usr/bin/perl -w
+
+$TOCHEADER=" TABLE OF CONTENTS";
+
+open(O, ">FAQ.html");
+print O "<body bgcolor=\"#ffffff\" background=\"ucd-snmp-bg3.gif\">
+<title>NET-SNMP FAQ</title>
+<div align=center>
+<h1>Frequently Asked Questions (FAQ) for the Net-SNMP package</h1>
+FAQ Maintainer: Dave Shield<br>
+Email: <a href=\"mailto:net-snmp-coders\@lists.sourceforge.net\">net-snmp-coders\@list.sourceforge.net</a><br>
+</div>
+<hr>
+<h2>Table of Contents</h2>\n";
+
+while(<>) {
+    last if (/$TOCHEADER/);
+}
+
+while(<>) {
+    last if (/^\s*$/);
+    chomp();
+    if (/^     */) {
+	# continuation of the question.
+	print O "<a href=\"#$x\">$_</a>\n";
+	next;
+    }
+    $_ =~ s/^ *//;
+    $x = $_;
+    $x =~ s/^ *//g;
+    $x =~ s/[^a-zA-Z]/_/g;
+    $xlate{$_} = $x;
+    if (/^[ A-Z]+$/) {
+	print O "</ul><li><b>$_</b><ul>\n";
+    } else {
+	print O "<li> <a href=\"#$x\">$_</a>\n";
+    }
+}
+
+print O "</ul><hr><pre>\n";
+
+while(<>) {
+    $y = $_;
+    chomp($y);
+    if (defined($xlate{$y})) {
+	print O "<a name=\"$xlate{$y}\">\n";
+    }
+    print O $_;
+}
+
+$dt = localtime(time());
+print O "</pre><hr>
+Last modified: $dt\n";
diff -Naur tomato/release/src/router/snmp/local/fixproc tomato121/release/src/router/snmp/local/fixproc
--- tomato/release/src/router/snmp/local/fixproc	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/local/fixproc	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,694 @@
+#!/usr/bin/perl
+# 
+# fixproc [-min n] [-max n] [-check | -kill | -restart | -exist | -fix] proc ...
+# 
+# fixproc exit code:
+# 	0	ok
+# 	1	check failed
+# 	2	cannot restart
+# 	3	cannot kill
+# 	4	fix failed	if fix is defined as kill or restart, then
+# 				cannot kill or cannot restart is return instead
+# 	10	fixproc error
+# 
+#
+# Fixes a process named "proc" by performing the specified action.  The
+# actions can be check, kill, restart, exist, or fix.  The action is specified
+# on the command line or is read from a default database, which describes
+# the default action to take for each process.  The database format and
+# the meaning of each action are described below.
+# 
+# database format
+# ---------------
+# 
+# name	foo			required
+# cmd	/a/b/name args		required
+# min	number			optional, defaults to 1
+# max	number			optional, defaults to 1
+# 
+# check	{null, exist, shell}	optional, defaults to exist if not defined
+# [shell command		shell commands needed only if check=shell
+#  ...
+#  shell command
+#  end_shell]			keyword end_shell marks end of shell commands
+# fix	{kill, restart, shell}	required
+# [shell command			shell commands needed only if fix=shell
+#  ...
+#  shell command
+#  end_shell]			keyword end_shell marks end of shell commands
+# 
+# Blank lines and lines beginning with "#" are ignored.
+# 
+#
+# Example:
+# 
+# name	test1
+# cmd	nice /home/kong/z/test1 > /dev/null &
+# max	2
+# fix	shell
+# 	xterm&
+# 	nice /home/kong/z/test1 > /dev/null &
+# 	end_shell
+# 
+# 
+# actions
+# -------
+# There are 5 possible actions:  kill, restart, fix, exist, check.  Fix is
+# defined to be the kill action, the restart action, or a series of shell
+# commands.  Check is optionally defined in the database.  If check is not
+# defined, it defaults to exist.
+# 
+# If the action is specified on the cmd line, it is executed regardless of
+# check.  The commands executed for each action type is as follow:
+# 
+#   switch action:
+# 	kill:
+# 	  kill process, wait 5 seconds, kill -9 if still exist
+# 	  if still exist
+# 	    return "cannot kill"
+# 	  else
+# 	    return "ok"
+# 
+# 	restart:	
+# 	  execute kill
+# 	  if kill returned "cannot kill"
+# 	    return "cannot kill"
+# 	  restart by issuing cmd to shell
+# 	  if check defined
+# 	    execute check
+# 	    if check succeeds
+# 	      return "ok"
+# 	    else
+# 	      return "cannot restart"
+# 
+# 	fix:
+# 	  if fix=kill
+# 	    execute kill
+# 	  else if fix=restart
+# 	    execute restart
+# 	  else
+# 	    execute shell commands
+# 	    execute check
+# 
+# 	check:
+# 	  if check defined as null
+# 	    return "fixproc error"
+# 	  else
+# 	    execute check
+# 	    if check succeeds
+# 	      return (execute exist)
+# 	    return "check failed"
+# 
+# 	exist:
+# 	  if proc exists in ps && (min <= num. of processes <= max)
+# 	    return "ok"
+# 	  else
+# 	    return "check failed"
+# 
+# 
+# If the action is not specified on the cmd line, the default action is the
+# fix action defined in the database.  Fix is only executed if check fails:
+# 
+# 	if fix defined
+# 	  if check is not defined as null
+# 	    execute check
+# 	    if check succeeds
+# 	      return "ok"
+# 	  execute action defined for fix  
+# 	else
+# 	  return "fixproc error"
+# 
+# 
+# If proc is not specified on the command line, return "fixproc error." 
+# Multiple proc's can be defined on the cmd line.   When an error occurs
+# when multiple proc's are specified, the first error encountered halts the
+# script.
+# 
+# For check shell scripts, any non-zero exit code means the check has failed.
+#
+#
+# Timothy Kong		3/1995
+
+$database_file = '/local/etc/fixproc.conf';
+
+$debug = 0;			# specify debug level using -dN
+				# currently defined: -d1
+
+$no_error = 0;
+$check_failed_error = 1;
+$cannot_restart_error = 2;
+$cannot_kill_error = 3;
+$cannot_fix_error = 4;
+$fixproc_error = 10;
+
+$min = 1;
+$max = 1;
+$cmd_line_action = '';
+%min = ();
+%max = ();
+%cmd = ();
+%check = ();
+%fix = ();
+$shell_lines = ();
+@proc_list = ();
+
+$shell_header = "#!/bin/sh\n";
+$shell_end_marker = 'shell_end_marker';
+
+&read_args();
+&read_database();
+# &dump_database();		# debug only
+
+# change the default min. and max. number of processes allowed
+if ($min != 1)
+  {
+    for $name ( keys (%min) )
+      {
+	$min{$name} = $min;
+      }
+  }
+if ($max != 1)
+  {
+    for $name ( keys (%max) )
+      {
+	$max{$name} = $max;
+      }
+  }
+    
+# work on one process at a time
+for $proc ( @proc_list )
+  {
+    $error_code = &work_on_proc ($proc);
+
+############# uncomment next line when fully working ############
+#    exit $error_code if ($error_code);
+
+    die "error_code = $error_code\n" if ($error_code);
+  }
+
+
+# create an executable shell script file
+sub create_sh_script
+{
+  local ($file) = pop (@_);
+  local ($i) = pop (@_);
+
+  printf (stderr "create_sh_script\n") if ($debug > 0);
+
+  $! = $fixproc_error;
+  open (file, ">"."$file") || die "$0: cannot open $file\n";
+  while ( $shell_lines[$i] ne $shell_end_marker )
+    {
+      printf (file "%s", $shell_lines[$i]);
+      $i++;
+    }
+  close (file);
+  system "chmod +x $file";
+  return file;
+}
+
+
+sub do_fix
+{
+  local ($proc) = pop(@_);
+
+  printf (stderr "do_fix\n") if ($debug > 0);
+
+  if ($fix{$proc} eq '')
+    {
+      $! = $fixproc_error;
+      die "$0: internal error 4\n";
+    }
+  if ($fix{$proc} eq 'kill')
+    {
+      return &do_kill ($proc);
+    }
+  elsif ($fix{$proc} eq 'restart')
+    {
+      return &do_restart ($proc);
+    }
+  else
+    {
+      # it must be "shell", so execute the shell script defined in database
+
+      local ($tmpfile) = "/tmp/fix_$$";
+
+      &create_sh_script ($fix{$proc}, $tmpfile);
+
+      	# return code is number divided by 256
+      $error_code = (system "$tmpfile") / 256;
+      system "rm $tmpfile";
+      return ($fix_failed_error) if ($error_code != 0);
+        # sleep needed here?
+      return &do_exist ($proc);
+    }
+}
+
+
+sub do_check
+{
+  local ($proc) = pop(@_);
+
+  printf (stderr "do_check\n") if ($debug > 0);
+
+  if ($check{$proc} eq '')
+    {
+      $! = $fixproc_error;
+      die "$0: internal error 2\n";
+    }
+
+  if ($check{$proc} ne 'exist')
+    {
+      # if not "exist", then it must be "shell", so execute the shell script
+      # defined in database
+
+      local ($tmpfile) = "/tmp/check_$$";
+
+      &create_sh_script ($check{$proc}, $tmpfile);
+
+      	# return code is number divided by 256
+      $error_code = (system "$tmpfile") / 256;
+      system "rm $tmpfile";
+      return ($check_failed_error) if ($error_code != 0);
+
+      # check passed, continue
+    }
+  return &do_exist ($proc);
+}
+
+
+sub do_exist
+{
+  local ($proc) = pop(@_);
+
+  printf (stderr "do_exist\n") if ($debug > 0);
+
+  # do ps, check to see if min <= no. of processes <= max
+  $! = $fixproc_error;
+  open (command, "/bin/ps -e | /bin/grep $proc | /bin/wc -l |")
+    || die "$0: can't run ps-grep-wc command\n";
+  $proc_count = <command>;
+  if (($proc_count < $min{$proc}) || ($proc_count > $max{$proc}))
+    {
+      return $check_failed_error;
+    }
+  return $no_error;
+}
+
+
+sub do_kill
+{
+  local ($proc) = pop(@_);
+  local ($second_kill_needed);
+
+  printf (stderr "do_kill\n") if ($debug > 0);
+
+  # first try kill
+  $! = $fixproc_error;
+  open (command, "/bin/ps -e | /bin/grep $proc |")
+    || die "$0: can't run ps-grep-awk command\n";
+  while (<command>)
+    {
+      # match the first field of ps -e
+      $! = $fixproc_error;
+      /^\s*(\d+)\s/ || die "$0: can't match ps -e output\n";
+      system "kill $1";
+    }
+
+  # if process still exist, try kill -9
+  sleep 2;
+  $! = $fixproc_error;
+  open (command, "/bin/ps -e | /bin/grep $proc |")
+    || die "$0: can't run ps-grep-awk command\n";
+  $second_kill_needed = 0;
+  while (<command>)
+    {
+      # match the first field of ps -e
+      $! = $fixproc_error;
+      /^\s*(\d+)\s/ || die "$0: can't match ps -e output\n";
+      system "kill -9 $1";
+      $second_kill_needed = 1;
+    }
+  return ($no_error) if ($second_kill_needed == 0);
+
+  # see if kill -9 worked
+  sleep 2;
+  $! = $fixproc_error;
+  open (command, "/bin/ps -e | /bin/grep $proc |")
+    || die "$0: can't run ps-grep-awk command\n";
+  while (<command>)
+    {				# a process still exist, return error
+      return $cannot_kill_error;
+    }
+  return $no_error;		# good, all dead
+}
+
+
+sub do_restart
+{
+  local ($proc) = pop(@_);
+  local ($error_code);
+
+  printf (stderr "do_restart\n") if ($debug > 0);
+
+  $error_code = &do_kill ($proc);
+  return $error_code if ($error_code != $no_error);
+  die "$0: internal error 3\n" if ($cmd{$proc} eq '');
+  system "$cmd{$proc}";
+  # sleep needed here?
+  if ($check{$proc} ne 'null')
+    {
+      return $no_error if (&do_check($proc) == $no_error);
+      return $cannot_restart_error;
+    }
+}
+
+
+sub work_on_proc
+{
+  local ($proc) = pop(@_);
+  local ($error_code);
+
+  printf (stderr "work_on_proc\n") if ($debug > 0);
+
+  if ($cmd_line_action eq '')
+    {
+      # perform action from database
+
+      if ($check{$proc} ne 'null')
+	{
+	  $error_code = &do_check ($proc);
+	  if ($error_code != $check_failed_error)
+	    {
+	      return $error_code;
+	    }
+	}
+      return &do_fix ($proc);
+    }
+  else
+    {
+      # perform action from command line
+
+      $error_code = $no_error;
+      if ($cmd_line_action eq 'kill')
+	{
+	  $error_code = &do_kill ($proc);
+	}
+      elsif ($cmd_line_action eq 'restart')
+	{
+	  $error_code = &do_restart ($proc);
+	}
+      elsif ($cmd_line_action eq 'fix')
+	{
+	  $error_code = &do_fix ($proc);
+	}
+      elsif ($cmd_line_action eq 'check')
+	{
+	  if ( $check{$proc} eq 'null' )
+	    {
+	      exit $fixproc_error;
+	    }
+	  $error_code = &do_check ($proc);
+	}
+      elsif ($cmd_line_action eq 'exist')
+	{
+	  $error_code = &do_exist ($proc);
+	}
+      else
+	{
+	  $! = $fixproc_error;
+	  die "$0: internal error 1\n";
+	}
+    }
+}
+
+
+sub dump_database
+{
+  local ($name);
+
+  for $name (keys(%cmd))
+    {
+      printf ("name\t%s\n", $name);
+      printf ("cmd\t%s\n", $cmd{$name});
+      printf ("min\t%s\n", $min{$name});
+      printf ("max\t%s\n", $max{$name});
+      if ( $check{$name} =~ /[0-9]+/ )
+	{
+	  printf ("check\tshell\n");
+	  $i = $check{$name};
+	  while ( $shell_lines[$i] ne $shell_end_marker )
+	    {
+	      printf ("%s", $shell_lines[$i]);
+	      $i++;
+	    }
+	}
+      else
+	{
+	  printf ("check\t%s\n", $check{$name});
+	}
+      if ( $fix{$name} =~ /[0-9]+/ )
+	{
+	  printf ("fix\tshell\n");
+	  $i = $fix{$name};
+	  while ( $shell_lines[$i] ne $shell_end_marker )
+	    {
+	      printf ("%s", $shell_lines[$i]);
+	      $i++;
+	    }
+	}
+      else
+	{
+	  printf ("fix\t%s\n", $fix{$name});
+	}
+      printf ("\n");
+    }
+}
+
+
+sub read_database
+{
+  local ($in_check_shell_lines) = 0;
+  local ($in_fix_shell_lines) = 0;
+  local ($name) = '';
+  local ($str1);
+  local ($str2);
+
+  $! = $fixproc_error;
+  open (db, $database_file) || die 'cannot open database file $database_file\n';
+  while (<db>)
+    {
+      if ((! /\S/) || (/^[ \t]*#.*$/))
+	{
+		# ignore blank lines or lines beginning with "#"
+	}
+      elsif ($in_check_shell_lines)
+	{
+	  if ( /^\s*end_shell\s*$/ )
+	    {
+	      $in_check_shell_lines = 0;
+	      push (@shell_lines, $shell_end_marker);
+	    }
+	  else
+	    {
+	      push (@shell_lines, $_);
+	    }
+	}
+      elsif ($in_fix_shell_lines)
+	{
+	  if ( /^\s*end_shell\s*$/ )
+	    {
+	      $in_fix_shell_lines = 0;
+	      push (@shell_lines, $shell_end_marker);
+	    }
+	  else
+	    {
+	      push (@shell_lines, $_);
+	    }
+	}
+      else
+	{
+	  if ( ! /^\s*(\S+)\s+(\S.*)\s*$/ )
+	    {
+	      $! = $fixproc_error;
+	      die "$0: syntax error in database\n$_";
+	    }
+	  $str1 = $1;
+	  $str2 = $2;
+	  if ($str1 eq 'name')
+	    {
+	      &finish_db_entry($name);
+	      $name = $str2;
+	    }
+	  elsif ($str1 eq 'cmd')
+	    {
+	      $! = $fixproc_error;
+	      die "$0: cmd specified before name in database\n$_\n"
+	        if ($name eq '');
+	      die "$0: cmd specified multiple times for $name in database\n"
+		if ($cmd{$name} ne '');
+	      $cmd{$name} = $str2;
+	    }
+	  elsif ($str1 eq 'min')
+	    {
+	      $! = $fixproc_error;
+	      die "$0: min specified before name in database\n$_\n"
+	        if ($name eq '');
+	      die "$0: min specified multiple times in database\n$_\n"
+		if ($min{$name} ne '');
+	      die "$0: non-numeric min value in database\n$_\n"
+		if ( ! ($str2 =~ /[0-9]+/ ));
+	      $min{$name} = $str2;
+	    }
+	  elsif ($str1 eq 'max')
+	    {
+	      $! = $fixproc_error;
+	      die "$0: max specified before name in database\n$_\n"
+	        if ($name eq '');
+	      die "$0: max specified multiple times in database\n$_\n"
+		if ($max{$name} ne '');
+	      die "$0: non-numeric max value in database\n$_\n"
+		if ( ! ($str2 =~ /[0-9]+/ ));
+	      $max{$name} = $str2;
+	    }
+	  elsif ($str1 eq 'check')
+	    {
+	      $! = $fixproc_error;
+	      die "$0: check specified before name in database\n$_\n"
+	        if ($name eq '');
+	      die "$0: check specified multiple times in database\n$_\n"
+		if ($check{$name} ne '');
+	      if ( $str2 eq 'shell' )
+		{
+		  # if $check{$name} is a number, it is a pointer into
+		  # $shell_lines[] where the shell commands are kept
+		  $shell_lines[$#shell_lines+1] = $shell_header;
+		  $check{$name} = $#shell_lines;
+		  $in_check_shell_lines = 1;
+		}
+	      else
+		{
+		  $check{$name} = $str2;
+		}
+	    }
+	  elsif ($str1 eq 'fix')
+	    {
+	      $! = $fixproc_error;
+	      die "$0: fix specified before name in database\n$_\n"
+	        if ($name eq '');
+	      die "$0: fix specified multiple times in database\n$_\n"
+		if ($fix{$name} ne '');
+	      if ( $str2 eq 'shell' )
+		{
+		  # if $fix{$name} is a number, it is a pointer into
+		  # $shell_lines[] where the shell commands are kept
+		  $shell_lines[$#shell_lines+1] = $shell_header;
+		  $fix{$name} = $#shell_lines;
+		  $in_fix_shell_lines = 1;
+		}
+	      else
+		{
+		  $fix{$name} = $str2;
+		}
+	    }
+	}
+    }
+  &finish_db_entry($name);
+}
+
+
+sub finish_db_entry
+{
+  local ($name) = pop(@_);
+
+  if ($name ne '')
+    {
+      $! = $fixproc_error;
+      die "$0: fix not defined for $name in database\n"
+	if ($fix{$name} eq '');
+      die "$0: cmd not defined for $name in database\n"
+	if ($cmd{$name} eq '');
+      $check{$name} = 'exist' if ($check{$name} eq '');
+      $max{$name} = 1 if ($max{$name} eq '');
+      $min{$name} = 1 if ($min{$name} eq '');
+    }
+}
+
+
+sub read_args
+{
+  local ($i) = 0;
+  local ($arg);
+  local ($action_arg_count) = 0;
+
+  while ( $i <= $#ARGV )
+    {
+      $arg = $ARGV[$i];
+      if (($arg eq '-min') || ($arg eq '-max'))
+	{
+	  if (($i == $#ARGV - 1) || ($ARGV[$i+1] =~ /\D/))  # \D is non-numeric
+	    {
+	      $! = $fixproc_error;
+	      die "$0: numeric arg missing after -min or -max\n";
+	    }
+	  if ($arg eq '-min')
+	    {
+	      $min = $ARGV[$i+1];
+	    }
+	  else
+	    {
+	      $max = $ARGV[$i+1];
+	    }
+	  $i += 2;
+	}
+      elsif ($arg eq '-kill')
+	{
+	  $cmd_line_action = 'kill';
+	  $action_arg_count++;
+	  $i++;
+	}
+      elsif ($arg eq '-check')
+	{
+	  $cmd_line_action = 'check';
+	  $action_arg_count++;
+	  $i++;
+	}
+      elsif ($arg eq '-restart')
+	{
+	  $cmd_line_action = 'restart';
+	  $action_arg_count++;
+	  $i++;
+	}
+      elsif ($arg eq '-exist')
+	{
+	  $cmd_line_action = 'exist';
+	  $action_arg_count++;
+	  $i++;
+	}
+      elsif ($arg eq '-fix')
+	{
+	  $cmd_line_action = 'fix';
+	  $action_arg_count++;
+	  $i++;
+	}
+      elsif ($arg =~ /-d(\d)$/)
+	{
+	  $debug = $1;
+	  $i++;
+	}
+      elsif ($arg =~ /^-/)
+	{
+	  $! = $fixproc_error;
+	  die "$0: unknown switch $arg\n";
+	}
+      else
+	{
+	  push (@proc_list, $arg);
+	  $i++;
+	}
+    }
+    $! = $fixproc_error;
+    die "$0: no process specified\n" if ($#proc_list == -1);
+    die "$0: more than one action specified\n" if ($action_arg_count > 1);
+  }
+
diff -Naur tomato/release/src/router/snmp/local/ipf-mod.pl tomato121/release/src/router/snmp/local/ipf-mod.pl
--- tomato/release/src/router/snmp/local/ipf-mod.pl	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/local/ipf-mod.pl	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,227 @@
+#!/usr/bin/perl -s
+##
+## IP Filter UCD-SNMP pass module
+##
+## Allows read IP Filter's tables (In, Out, AccIn, AccOut),
+## fetching rules, hits and bytes (for accounting tables only).
+##
+## Author: Yaroslav Terletsky <ts@polynet.lviv.ua>
+## Date: $ Tue Dec  1 10:24:08 EET 1998 $
+## Version: 1.1a
+
+# Put this file in /usr/local/bin/ipf-mod.pl and then add the following 
+# line to your snmpd.conf file (without the # at the front):
+#
+#   pass .1.3.6.1.4.1.2021.13.2 /usr/local/bin/ipf-mod.pl
+
+# enterprises.ucdavis.ucdExperimental.ipFilter	= .1.3.6.1.4.1.2021.13.2
+# ipfInTable.ipfInEntry.ipfInIndex		integer	= 1.1.1
+# ipfInTable.ipfInEntry.ipfInRule		string	= 1.1.2
+# ipfInTable.ipfInEntry.ipfInHits		counter	= 1.1.3
+# ipfOutTable.ipfOutEntry.ipfOutIndex		integer	= 1.2.1
+# ipfOutTable.ipfOutEntry.ipfOutRule		string	= 1.2.2
+# ipfOutTable.ipfOutEntry.ipfOutHits		counter	= 1.2.3
+# ipfAccInTable.ipfAccInEntry.ipfAccInIndex	integer	= 1.3.1
+# ipfAccInTable.ipfAccInEntry.ipfAccInRule	string	= 1.3.2
+# ipfAccInTable.ipfAccInEntry.ipfAccInHits	counter	= 1.3.3
+# ipfAccInTable.ipfAccInEntry.ipfAccInBytes	counter	= 1.3.4
+# ipfAccOutTable.ipfAccOutEntry.ipfAccOutIndex	integer	= 1.4.1
+# ipfAccOutTable.ipfAccOutEntry.ipfAccOutRule	string	= 1.4.2
+# ipfAccOutTable.ipfAccOutEntry.ipfAccOutHits	counter	= 1.4.3
+# ipfAccOutTable.ipfAccOutEntry.ipfAccOutBytes	counter	= 1.4.4
+
+# variables types
+%type = ('1.1.1', 'integer', '1.1.2', 'string', '1.1.3', 'counter',
+	 '2.1.1', 'integer', '2.1.2', 'string', '2.1.3', 'counter',
+	 '3.1.1', 'integer', '3.1.2', 'string', '3.1.3', 'counter',
+	 '3.1.4', 'counter',
+	 '4.1.1', 'integer', '4.1.2', 'string', '4.1.3', 'counter',
+	 '4.1.4', 'counter');
+
+# getnext sequence
+%next = ('1.1.1', '1.1.2', '1.1.2', '1.1.3', '1.1.3', '2.1.1',
+	 '2.1.1', '2.1.2', '2.1.2', '2.1.3', '2.1.3', '3.1.1',
+	 '3.1.1', '3.1.2', '3.1.2', '3.1.3', '3.1.3', '3.1.4',
+	 '3.1.4', '4.1.1',
+	 '4.1.1', '4.1.2', '4.1.2', '4.1.3', '4.1.3', '4.1.4');
+
+# ipfilter's commands to fetch needed information
+$ipfstat_comm="/sbin/ipfstat";
+$ipf_in="$ipfstat_comm -ih 2>/dev/null";
+$ipf_out="$ipfstat_comm -oh 2>/dev/null";
+$ipf_acc_in="$ipfstat_comm -aih 2>/dev/null";
+$ipf_acc_out="$ipfstat_comm -aoh 2>/dev/null";
+
+$OID=$ARGV[0];
+$IPF_OID='.1.3.6.1.4.1.2021.13.2';
+$IPF_OID_NO_DOTS='\.1\.3\.6\.1\.4\.1\.2021\.13\.2';
+
+# exit if OID is not one of IPF-MIB's
+exit if $OID !~ /^$IPF_OID_NO_DOTS(\D|$)/;
+
+# get table, entry, column and row numbers
+$tecr = $OID;
+$tecr =~ s/^$IPF_OID_NO_DOTS(\D|$)//;
+($table, $entry, $col, $row, $rest) = split(/\./, $tecr);
+
+# parse 'get' request
+if($g) {
+	# exit if OID is wrong specified
+	if(!defined $table or !defined $entry or !defined $col or !defined $row or defined $rest) {
+		print "[1] NO-SUCH NAME\n" if $d;
+		exit;
+	}
+
+	# get the OID's value
+	$value = &get_value($table, $entry, $col, $row);
+	print "value=$value\n" if $d;
+
+	# exit if OID does not exist
+	print "[2] NO-SUCH NAME\n" if $d and !defined $value;
+	exit if !defined $value;
+
+	# set ObjectID and reply with response
+	$tec = "$table.$entry.$col";
+	$ObjectID = "${IPF_OID}.${tec}.${row}";
+	&response;
+}
+
+# parse 'get-next' request
+if($n) {
+	# set values if 0 or unspecified
+	$table = 1, $a = 1 if !$table or !defined $table;
+	$entry = 1, $a = 1 if !$entry or !defined $entry;
+	$col = 1, $a = 1 if !$col or !defined $col;
+	$row = 1, $a = 1 if !$row or !defined $row;
+
+	if($a) {
+		# get the OID's value
+		$value = &get_value($table, $entry, $col, $row);
+		print "value=$value\n" if $d;
+
+		# set ObjectID and reply with response
+		$tec = "$table.$entry.$col";
+		$ObjectID = "${IPF_OID}.${tec}.${row}";
+		&response;
+	}
+
+	# get next OID's value
+	$row++;
+	$value = &get_value($table, $entry, $col, $row);
+
+	# choose new table/column if rows exceeded
+	if(!defined $value) {
+		$tec = "$table.$entry.$col";
+		$tec = $next{$tec} if !$a;
+		$table = $tec;
+		$entry = $tec;
+		$col = $tec;
+		$table =~ s/\.\d\.\d$//;
+		$entry =~ s/^\d\.(\d)\.\d$/$1/;
+		$col =~ s/^\d\.\d\.//;
+		$row = 1;
+
+		# get the OID's value
+		$value = &get_value($table, $entry, $col, $row);
+		print "value=$value\n" if $d;
+	}
+
+	# set ObjectID and reply with response
+	$tec = "$table.$entry.$col";
+	$ObjectID = "${IPF_OID}.${tec}.${row}";
+	&response;
+}
+
+##############################################################################
+
+# fetch values from 'ipfInTable' and 'ipfOutTable' tables
+sub fetch_hits_n_rules {
+	local($row, $col, $ipf_output) = @_;
+	local($asdf, $i, @ipf_lines, $length);
+
+	# create an entry if no rule exists
+	$ipf_output = "0 empty list for ipfilter" if !$ipf_output;
+
+	@ipf_lines = split("\n", $ipf_output);
+	$length = $#ipf_lines + 1;
+
+	for($i = 1; $i < $length + 1; $i++) {
+		$hits{$i} = $ipf_lines[$i-1];
+		$hits{$i} =~ s/^(\d+).*$/$1/;
+		$rule{$i} = $ipf_lines[$i-1];
+		$rule{$i} =~ s/^\d+ //;
+		if($i == $row) {
+			return $i if $col == 1;
+			return $rule{$i} if $col == 2;
+			return $hits{$i} if $col == 3;
+		}
+	}
+	# return undefined value
+	undef $asdf;
+	return $asdf;
+}
+
+# fetch values from 'ipfAccInTable' and 'ipfAccOutTable' tables
+sub fetch_hits_bytes_n_rules {
+	local($row, $col, $ipf_output) = @_;
+	local($asdf, $i, @ipf_lines, $length);
+
+	# create an entry if no rule exists
+	$ipf_output = "0 0 empty list for ipacct" if !$ipf_output;
+
+	@ipf_lines = split("\n", $ipf_output);
+	$length = $#ipf_lines + 1;
+
+	for($i = 1; $i < $length + 1; $i++) {
+		$hits{$i} = $ipf_lines[$i-1];
+		$hits{$i} =~ s/^(\d+) .*$/$1/;
+		$bytes{$i} = $ipf_lines[$i-1];
+		$bytes{$i} =~ s/^\d+ (\d+) .*/$1/;
+		$rule{$i} = $ipf_lines[$i-1];
+		$rule{$i} =~ s/^\d+ \d+ //;
+		if($i == $row) {
+			return $i if $col == 1;
+			return $rule{$i} if $col == 2;
+			return $hits{$i} if $col == 3;
+			return $bytes{$i} if $col == 4;
+		}
+	}
+	# return undefined value
+	undef $asdf;
+	return $asdf;
+}
+
+# get the values from ipfilter's tables
+sub get_value {
+	local($table, $entry, $col, $row) = @_;
+
+	if($table == 1) {
+		# fetch ipfInTable data
+		$ipf_output = `$ipf_in`;
+		$value = &fetch_hits_n_rules($row, $col, $ipf_output);
+	} elsif($table == 2) {
+		# fetch ipfOutTable data
+		$ipf_output = `$ipf_out`;
+		$value = &fetch_hits_n_rules($row, $col, $ipf_output);
+	} elsif($table == 3) {
+		# fetch ipfAccInTable data
+		$ipf_output = `$ipf_acc_in`;
+		$value = &fetch_hits_bytes_n_rules($row, $col, $ipf_output);
+	} elsif($table == 4) {
+		# fetch ipfAccOutTable data
+		$ipf_output = `$ipf_acc_out`;
+		$value = &fetch_hits_bytes_n_rules($row, $col, $ipf_output);
+	}
+	return $value;
+}
+
+# generate response to 'get' or 'get-next' request
+sub response {
+	# print ObjectID, its type and the value
+	if(defined $ObjectID and defined $type{$tec} and defined $value) {
+		print "$ObjectID\n";
+		print "$type{$tec}\n";
+		print "$value\n";
+	}
+	exit;
+}
diff -Naur tomato/release/src/router/snmp/local/Makefile.in tomato121/release/src/router/snmp/local/Makefile.in
--- tomato/release/src/router/snmp/local/Makefile.in	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/local/Makefile.in	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,98 @@
+#
+# local (scripts) directory Makefile
+#
+top_builddir=..
+
+#
+# stuff to install
+#
+OTHERINSTALL=localinstall
+
+#
+# local info
+#
+SNMPCONFPATH=@SNMPCONFPATH@
+PERLSCRIPTS=snmpcheck tkmib mib2c fixproc ipf-mod.pl snmpconf traptoemail
+SCRIPTSMADEFORPERL=snmpcheck.made tkmib.made mib2c.made fixproc.made \
+	ipf-mod.pl.made snmpconf.made traptoemail.made
+PERLPROG=@PERLPROG@
+DATASRCS=mib2c.conf mib2c.iterate.conf mib2c.create-dataset.conf \
+	mib2c.array-user.conf mib2c.column_enums.conf \
+	mib2c.column_defines.conf mib2c.old-api.conf mib2c.scalar.conf \
+	mib2c.int_watch.conf
+CONFINSTALLDIR=$(snmplibdir)/snmpconf-data
+CONFDATASRC=snmpconf.dir
+CONFDIRS=snmp-data snmpd-data snmptrapd-data
+CONFFILES=snmpd-data/system snmpd-data/acl snmpd-data/trapsinks \
+	snmpd-data/monitor snmpd-data/extending snmpd-data/operation \
+	snmpd-data/basic_setup snmpd-data/snmpconf-config \
+	snmp-data/authopts snmp-data/debugging snmp-data/output snmp-data/mibs \
+	snmp-data/snmpconf-config \
+	snmptrapd-data/formatting snmptrapd-data/traphandle \
+	snmptrapd-data/snmpconf-config
+
+OTHERCLEANTARGETS=snmpcheck $(SCRIPTSMADEFORPERL)
+
+all: $(SCRIPTSMADEFORPERL) standardall
+
+snmpcheck: $(srcdir)/snmpcheck.def ../sedscript
+	$(SED) -f ../sedscript $(srcdir)/snmpcheck.def > snmpcheck
+
+snmpcheck.made: snmpcheck
+	if test "x$(PERLPROG)" != "x" ; then \
+	  $(PERLPROG) -p -e 's%^#!.*/perl.*%#!$(PERLPROG)%' snmpcheck > snmpcheck.made ; \
+	else \
+	  touch snmpcheck.made ; \
+        fi
+
+tkmib.made: $(srcdir)/tkmib
+	if test "x$(PERLPROG)" != "x" ; then \
+	  $(PERLPROG) -p -e 's%^#!.*/perl.*%#!$(PERLPROG)%' ${srcdir}/tkmib > tkmib.made; \
+	else \
+	  touch tkmib.made; \
+        fi
+
+mib2c.made: $(srcdir)/mib2c
+	if test "x$(PERLPROG)" != "x" ; then \
+	  $(PERLPROG) -p -e 's%^#!.*/perl.*%#!$(PERLPROG)%;s#/usr/local/share/snmp#$(snmplibdir)#;' ${srcdir}/mib2c > mib2c.made; \
+	else \
+	  touch mib2c.made; \
+        fi
+
+
+ipf-mod.pl.made: $(srcdir)/ipf-mod.pl
+	if test "x$(PERLPROG)" != "x" ; then \
+	  $(PERLPROG) -p -e 's%^#!.*/perl.*%#!$(PERLPROG)%' ${srcdir}/ipf-mod.pl > ipf-mod.pl.made; \
+	else \
+	  touch ipf-mod.pl.made; \
+        fi
+
+fixproc.made: $(srcdir)/fixproc
+	if test "x$(PERLPROG)" != "x" ; then \
+	  $(PERLPROG) -p -e 's%^#!.*/perl.*%#!$(PERLPROG)%' ${srcdir}/fixproc > fixproc.made; \
+	else \
+	  touch fixproc.made; \
+        fi
+
+snmpconf.made: $(srcdir)/snmpconf
+	if test "x$(PERLPROG)" != "x" ; then \
+	  $(PERLPROG) -p -e 's%^#!.*/perl.*%#!$(PERLPROG)%; s#/usr/local/share#$(datadir)#g; s#/usr/local/etc/snmp#$(SNMPCONFPATH)#g' ${srcdir}/snmpconf > snmpconf.made; \
+	else \
+	  touch snmpconf.made; \
+        fi
+
+traptoemail.made: $(srcdir)/traptoemail
+	if test "x$(PERLPROG)" != "x" ; then \
+	  $(PERLPROG) -p -e 's%^#!.*/perl.*%#!$(PERLPROG)%; s#/usr/local/share#$(datadir)#g; s#/usr/local/etc/snmp#$(TRAPTOEMAILPATH)#g' ${srcdir}/traptoemail > traptoemail.made; \
+	else \
+	  touch traptoemail.made; \
+        fi
+
+localinstall:
+	@if test "x$(PERLPROG)" != "x" ; then \
+	  for i in $(PERLSCRIPTS) ; do $(INSTALL) $$i.made $(bindir)/$$i ; echo "install:  installed $$i in $(bindir)" ; done ; \
+	  $(SHELL) $(srcdir)/../mkinstalldirs $(snmplibdir) ; \
+	  for i in $(DATASRCS) ; do $(INSTALL) $(srcdir)/$$i $(snmplibdir)/$$i ; echo "install:  installed $$i in $(snmplibdir)" ; done ; \
+	  for i in $(CONFDIRS); do $(SHELL) $(srcdir)/../mkinstalldirs $(CONFINSTALLDIR)/$$i ; done ; \
+	  for i in $(CONFFILES); do $(INSTALL) $(srcdir)/$(CONFDATASRC)/$$i $(CONFINSTALLDIR)/$$i; echo "install:  installed $$i in $(CONFINSTALLDIR)"; done \
+	fi
diff -Naur tomato/release/src/router/snmp/local/mib2c tomato121/release/src/router/snmp/local/mib2c
--- tomato/release/src/router/snmp/local/mib2c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/local/mib2c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,405 @@
+#!/usr/bin/perl
+#!/usr/bin/perl -w
+
+#
+# Description: 
+#
+# This program, given an OID reference as an argument, creates some
+# template mib module files to be used with the net-snmp agent.  It is
+# far from perfect and will not generate working modules, but it
+# significantly shortens development time by outlining the basic
+# structure.
+#
+# Its up to you to verify what it does and change the default values
+# it returns.
+#
+
+# SNMP
+my $havesnmp = eval {require SNMP;};
+
+if (!$havesnmp) {
+    print "
+ERROR: You don't have the SNMP perl module installed.  Please obtain
+this by getting the latest source release of the net-snmp toolkit from
+http://www.net-snmp.org/download/ .  Once you download the source and
+unpack it, the perl module is contained in the perl/SNMP directory.
+See the README file there for instructions.
+
+";
+    exit;
+}
+
+if ($havesnmp) {
+    eval { import SNMP; }
+}
+use FileHandle;
+
+#use strict 'vars';
+$SNMP::save_descriptions=1;
+$SNMP::use_long_names=1;
+$SNMP::use_enums=1;
+SNMP::initMib();
+
+$configfile="mib2c.conf";
+$debug=0;
+$quiet=0;
+$nostats = 0;
+$noindent = 0;
+
+sub usage {
+    print "$0 [-h] [-c configfile] [-f prefix] mibNode\n\n";
+    print "  -h\t\tThis message.\n\n";
+    print "  -c configfile\tSpecifies the configuration file to use\n\t\tthat dictates what the output of mib2c will look like.\n\n";
+    print "  -f prefix\tSpecifies the output prefix to use.  All code\n\t\twill be put into prefix.c and prefix.h\n\n";
+    print "  mibNode\tThe name of the top level mib node you want to\n\t\tgenerate code for.  By default, the code will be stored in\n\t\tmibNode.c and mibNode.h (use the -f flag to change this)\n\n";
+    print "  -d\t\tdebugging output (dont do it.  trust me.)\n\n";
+    print "  -s\t\tDon't display statistics at the end\n\n";
+    print "  -S VAR=VAL\tSet $VAR variable to $VAL\n";
+    print "  -i Don't run indent on the resulting code\n";
+    1;
+}	
+
+while($#ARGV >= 0) {
+    $_ = shift;
+    $configfile = shift if (/^-c/);
+    $debug = 1 if (/^-d/);
+    if (/-S/) {
+	my $expr = shift;
+	my ($var, $val) = ($expr =~ /([^=]*)=(.*)/);
+	die "no variable specified for -S flag." if (!$var);
+	$vars{$var} = $val;
+    }
+    $quiet = 1 if (/^-q/);
+    $nostats = 1 if (/^-s/);
+    $noindent = 1 if (/^-i/);
+    usage && exit(1) if (/^-h/);
+    $outputName = shift if (/^-f/);
+    $oid = $_ if (/^[^-]/);
+}
+ 
+#
+# internal conversion tables
+#
+
+%accessToIsWritable = qw(ReadOnly 0 ReadWrite 1 
+			 WriteOnly 1 Create 1);
+%perltoctypes = qw(OCTETSTR   ASN_OCTET_STR
+		   INTEGER    ASN_INTEGER
+		   INTEGER32  ASN_INTEGER
+		   UNSIGNED32 ASN_UNSIGNED
+		   OBJECTID   ASN_OBJECT_ID
+		   COUNTER64  ASN_COUNTER64
+		   COUNTER    ASN_COUNTER
+		   NETADDR    ASN_COUNTER
+		   UINTEGER   ASN_UINTEGER
+		   IPADDR     ASN_IPADDRESS
+		   BITS       ASN_OCTET_STR
+		   TICKS      ASN_TIMETICKS
+		   GAUGE      ASN_GAUGE
+		   OPAQUE     ASN_OPAQUE);
+%perltodecl = ("OCTETSTR",  "char",
+	       "INTEGER",  "long",
+	       "INTEGER32",  "long",
+	       "UNSIGNED32", "u_long",
+	       "UINTEGER", "u_long",
+	       "OBJECTID", "oid",
+	       "COUNTER64", "counter64",
+	       "COUNTER", "u_long",
+	       "IPADDR", "u_long",
+	       "BITS", "char",
+	       "TICKS", "u_long",
+	       "GAUGE", "u_long",
+	       "OPAQUE", "char");
+
+my $mibnode = $SNMP::MIB{$oid};
+die "you didn't give me a valid OID to start with" if (!$mibnode);
+
+# setup
+$outputName = $mibnode->{'label'} if (!defined($outputName));
+$vars{'name'} = $outputName;
+$vars{'oid'} = $oid;
+
+# loop through mib nodes, remembering stuff.
+setup_data($mibnode);
+
+# process .conf file
+$fh = new IO::File;
+if (-f "$configfile") {
+    $fh->open("$configfile");
+} elsif(-f "/usr/local/share/snmp/$configfile") {
+    $fh->open("/usr/local/share/snmp/$configfile");
+} else {
+    print STDERR "Can't find a configuration file called $configfile\n";
+    print STDERR "I looked in . and /usr/local/share/snmp\n";
+exit;
+}
+process();
+$fh->close;
+
+if (!$noindent) {
+  foreach $i (keys(%written)) {
+    next if ($i eq "-");
+    print STDERR "running indent on $i\n" if (!$quiet);
+    system("indent -orig -nbc -bap -nut -nfca -T netsnmp_mib_handler -T netsnmp_handler_registration -T netsnmp_delegated_cache -T netsnmp_mib_handler_methods -T netsnmp_old_api_info -T netsnmp_old_api_cache -T netsnmp_set_info -T netsnmp_request_info -T netsnmp_set_info -T netsnmp_tree_cache -T netsnmp_agent_request_info -T netsnmp_cachemap -T netsnmp_agent_session -T netsnmp_array_group_item -T netsnmp_array_group -T netsnmp_table_array_callbacks -T netsnmp_table_row -T netsnmp_table_data -T netsnmp_table_data_set_storage -T netsnmp_table_data_set -T netsnmp_column_info -T netsnmp_table_registration_info -T netsnmp_table_request_info -T netsnmp_iterator_info -T netsnmp_data_list -T netsnmp_oid_array_header -T netsnmp_oid_array_header_wrapper -T netsnmp_oid_stash_node -T netsnmp_pdu -T netsnmp_request_list -T netsnmp_callback_pass -T netsnmp_callback_info -T netsnmp_transport -T netsnmp_transport_list -T netsnmp_tdomain $i");
+  }
+}
+
+sub tocommas {
+    my $oid = $_[0];
+    $oid =~ s/\./,/g;
+    $oid =~ s/^\s*,//;
+    return $oid;
+}
+
+sub oidlength {
+    return scalar ($_[0] =~ /\./);
+}
+
+# replaces $VAR type expressions and $VAR.subcomponent expressions
+# with data from the mib tree and loop variables.
+# possible uses:
+#
+#   $var               -- as defined by loops, etc.
+#   ${var}otherstuff   -- appending text to variable contents
+#   $var.uc            -- all upper case version of $var
+#
+# Mib components, $var must first expand to a mib node name:
+#
+#   $var.objectID      -- dotted full OID
+#   $var.commaoid      -- comma separated OID for array init
+#   $var.subid         -- last number component of oid
+#   $var.oidlength     -- length of the oid
+#   $var.type          -- node's ASN_XXX type
+#   $var.settable      -- 1 if it's writable, 0 if not
+#   $var.noaccess      -- 1 if not-accessible, 0 if not
+#   $var.access        -- node's access type
+#   $var.status        -- node's status
+#   $var.syntax        -- node's syntax
+#   $var.decl          -- C data type
+sub process_vars {
+    my $it = shift;
+
+    # mib substitutions ($var.type -> $mibnode->{'type'})
+    $it =~ s/\$(\w+)\.(uc)/uc($vars{$1})/eg; # make something uppercase
+    $it =~ s/\$(\w+)\.(commaoid)/tocommas($SNMP::MIB{$vars{$1}}{objectID})/eg;
+    $it =~ s/\$(\w+)\.(oidlength)/oidlength($SNMP::MIB{$vars{$1}}{objectID})/eg;
+    $it =~ s/\$(\w+)\.(perltype)/$SNMP::MIB{$vars{$1}}{type}/g;
+    $it =~ s/\$(\w+)\.(type)/$perltoctypes{$SNMP::MIB{$vars{$1}}{$2}}/g;
+    $it =~ s/\$(\w+)\.(subid)/$SNMP::MIB{$vars{$1}}{subID}/g;
+    $it =~ s/\$(\w+)\.(settable)/(($SNMP::MIB{$vars{$1}}{access} =~ \/(ReadWrite|Create|Writeonly)\/)?1:0)/eg;
+    $it =~ s/\$(\w+)\.(noaccess)/(($SNMP::MIB{$vars{$1}}{access} =~ \/(NoAccess)\/)?1:0)/eg;
+    $it =~ s/\$(\w+)\.(objectID|label|subID|access|status|syntax)/$SNMP::MIB{$vars{$1}}{$2}/g;
+    $it =~ s/\$(\w+)\.(decl)/$perltodecl{$SNMP::MIB{$vars{$1}}{type}}/g;
+    # normal variable substitions
+    $it =~ s/\$\{(\w+)\}/$vars{$1}/g;
+    $it =~ s/\$(\w+)/$vars{$1}/g;
+    return $it;
+}
+
+# process various types of statements
+#
+# which include:
+#   @open FILE@
+#     writes generated output to FILE
+#   @foreach $VAR scalar@
+#     repeat iterate over code until @end@ setting $VAR to all known scalars
+#   @foreach $VAR table@
+#     repeat iterate over code until @end@ setting $VAR to all known tables
+#   @foreach $VAR column@
+#     repeat iterate over code until @end@ setting $VAR to all known
+#     columns within a given table.  Obviously this must be called
+#     within a foreach-table clause.
+#   @foreach $VAR index@
+#     repeat iterate over code until @end@ setting $VAR to all known
+#     indexes within a given table.  Obviously this must be called
+#     within a foreach-table clause.
+#   @eval $VAR = expression@
+#     evaluates expression and assigns the results to $VAR
+#   @perleval STUFF@
+#     evaluates STUFF directly in perl.  Note that all mib2c variables
+#     interpereted within .conf files are in $vars{NAME}.
+#   @skip@
+#     skips everything till the appropriately matched @end@
+#   @if expression@
+#      evaluates expression, and if expression is true processes
+#      contained part until appropriate @end@ is reached.
+sub skippart {
+    my $endcount = 1;
+    while(<$fh>) {
+	if (/\@end\@/) {
+	    return if ($endcount == 1);
+	    $endcount--;
+	}
+	if (/\@else\@/) {
+	    return if ($endcount == 1);
+	}
+	if (/\@(foreach|if)/) {
+	    $endcount++;
+	}
+    }
+}
+
+
+sub process {
+    while(<$fh>) {
+	if (/^\#\#/) {
+	    # noop, it's a comment
+	} elsif (/\@open\s+([^\@]+)\@/) {
+	    my $spec = process_vars($1);
+	    $out->close() if ($out);
+	    $out = new IO::File;
+	    $out->open(">$spec") || die "failed to open $spec";
+	    print STDERR "writing to $spec\n" if (!$quiet);
+	    $written{$spec} = '1';
+	} elsif (/\@end\@/) {
+	    return;
+	} elsif (/\@if\s+([^@]*)\@/) {
+	    if (eval(process_vars($1))) {
+		process();
+	    } else {
+		skippart();
+	    }
+	} elsif (/\@eval\s+\$(\w+)\s*=\s*([^\@]*)/) {
+	    my ($v, $e) = ($1, $2);
+	    my $e = process_vars($e);
+	    $vars{$v} = eval($e);
+	} elsif (/\@perleval\s*(.*)\@/) {
+	    eval($1);
+	} elsif (/\@skip\@/) {
+	    skippart();
+	} elsif (/\@\s*foreach\s+\$([^\@]+)\s+scalars*\s*\@/) {
+	    my $var = $1;
+	    my $startpos = $fh->tell();
+	    my $scalar;
+	    my @thekeys = keys(%scalars);
+	    if ($#thekeys == -1) {
+	      skippart();
+	    } else {
+	      foreach $scalar (@thekeys) {
+		$fh->seek($startpos, 0); # go to top of section.
+		my $oldvar = $vars{$var};
+		$vars{$var} = $scalar;
+		my $oldscalar = $currentscalar;
+		$currentscalar = $scalar;
+		process();
+		$vars{$var} = $oldvar;
+		$currentscalar = $oldscalar;
+	      }
+	    }
+	  } elsif (/\@\s*foreach\s+\$([^\@]+)\s+tables*\s*\@/) {
+	    my $var = $1;
+	    my $startpos = $fh->tell();
+	    my $table;
+	    my @thekeys = keys(%tables);
+	    if ($#thekeys == -1) {
+	      skippart();
+	    } else {
+	      foreach $table (@thekeys) {
+		$fh->seek($startpos, 0); # go to top of section.
+		my $oldvar = $vars{$var};
+		$vars{$var} = $table;
+		my $oldtable = $currenttable;
+		$currenttable = $table;
+		process();
+		$vars{$var} = $oldvar;
+		$currenttable = $oldtable;
+	      }
+	    }
+	  } elsif (/\@\s*foreach\s+\$([^\@]+)\s+(column|index)\s*\@/) {
+	    my ($var, $type) = ($1, $2);
+	    my $startpos = $fh->tell();
+	    my $column;
+	    if ($#{$tables{$currenttable}{$type}} == -1) {
+	      skippart();
+	    } else {
+	      foreach $column (@{$tables{$currenttable}{$type}}) {
+		#		print "looping on $var for $type -> $column\n";
+		$fh->seek($startpos, 0); # go to top of section.
+		my $oldvar = $vars{$var};
+		$vars{$var} = $column;
+		my $oldcolumn = $currentcolumn;
+		$currentcolumn = $column;
+		process();
+		$vars{$var} = $oldvar;
+		$currentcolumn = $oldcolumn;
+	      }
+	    }
+	  } elsif (/\@\s*foreach\s+\$([^\@]+)\s+\$([^\@]+)\s+(enums*)\s*\@/) {
+	    my ($varvar, $varval, $type) = ($1, $2, $3);
+	    my $startpos = $fh->tell();
+	    my $enum;
+	    my @keys = sort { $SNMP::MIB{$currentcolumn}{'enums'}{$a} <=>
+				  $SNMP::MIB{$currentcolumn}{'enums'}{$b} } (keys(%{$SNMP::MIB{$currentcolumn}{'enums'}}));
+	    if ($#keys > -1) {
+		foreach $enum (@keys) {
+		    $fh->seek($startpos, 0); # go to top of section.
+		    my $oldvarvar = $vars{$varvar};
+		    my $oldvarval = $vars{$varval};
+		    $vars{$varvar} = $enum;
+		    $vars{$varval} = $SNMP::MIB{$currentcolumn}{'enums'}{$enum};
+		    process();
+		    $vars{$varvar} = $oldvarvar;
+		    $vars{$varval} = $oldvarval;
+		}
+	    } else {
+		skippart();
+	    }
+	} else {
+	    die "no output file specified" if (!$out);
+	    print $out process_vars($_);
+	}
+    }
+}
+
+sub setup_data {
+    my $mib = shift;
+    if ($mib->{label} =~ /Table$/) {
+	my $tablename = $mib->{label};
+	my $entry = $mib->{children};
+	my $columns = $entry->[0]{children};
+	foreach my $col (sort { $a->{'subID'} <=> $b->{'subID'} } @$columns) {
+	    # store by numeric key so we can sort them later
+	    push @{$tables{$tablename}{'column'}}, $col->{'label'};
+	}
+        my $augments = $entry->[0]{'augments'};
+        if ($augments) {
+           my $mib = $SNMP::MIB{$augments} || 
+		die "can't find info about augmented table $augments in table $tablename\n";
+           $mib = $mib->{parent} || 
+		die "can't find info about augmented table $augments in table $tablename\n";
+	   my $entry = $mib->{children};
+	   foreach my $index (@{$entry->[0]{'indexes'}}) {
+	       my $node = $SNMP::MIB{$index} || 
+		   die "can't find info about index $index in table $tablename\n";
+	       push @{$tables{$tablename}{'index'}}, $index;
+	   }
+           my $columns = $entry->[0]{children};
+        }
+	foreach my $index (@{$entry->[0]{'indexes'}}) {
+	    my $node = $SNMP::MIB{$index} || 
+		die "can't find info about index $index in table $tablename\n";
+	    push @{$tables{$tablename}{'index'}}, $index;
+	}
+    } else {
+	my $children = $mib->{children};
+	if ($#children == -1 && $mib->{type}) {
+	    # scalar
+	    $scalars{$mib->{label}} = 1;
+	} else {
+	    my $i;
+	    for($i = 0; $i <= $#$children; $i++) {
+		setup_data($children->[$i]);
+	    }
+	}
+    }
+}
+
+sub min {
+    return $_[0] if ($_[0] < $_[1]);
+    return $_[1];
+}
+
+sub max {
+    return $_[0] if ($_[0] > $_[1]);
+    return $_[1];
+}
diff -Naur tomato/release/src/router/snmp/local/mib2c.array-user.conf tomato121/release/src/router/snmp/local/mib2c.array-user.conf
--- tomato/release/src/router/snmp/local/mib2c.array-user.conf	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/local/mib2c.array-user.conf	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,1278 @@
+## -*- c -*-
+##
+## For documentation on the code generated by this configuration file,
+## see the file agent/helpers/table_array.c.
+##
+######################################################################
+## Do the .h file
+## @perleval $vars{shortname} =~ s/([A-Z])[a-z]+/$1/g@
+######################################################################
+@foreach $i table@
+@open ${i}.h@
+@eval $hack = "Id"
+/*
+ * Note: this file originally auto-generated by mib2c using
+ *        $Id: mib2c.array-user.conf,v 1.1.2.1 2004/06/20 21:54:45 nikki Exp $
+ *
+ * $$hack:$
+ *
+ * Yes, there is lots of code here that you might not use. But it is much
+ * easier to remove code than to add it!
+ */
+#ifndef $i.uc_H
+#define $i.uc_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+    
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/library/container.h>
+#include <net-snmp/agent/table_array.h>
+
+    @eval $ext_index = 0@
+    @foreach $idx index@
+        @if "$idx" ne ""@
+        @eval $found = "external"@
+        @foreach $c column@
+            @if "$idx" eq "$c"@
+               @eval $found = "internal"@
+            @end@
+        @end@
+        /** Index $idx is $found */
+        @if "$found" eq "external"@
+           @eval $ext_index = 1@
+        @end@
+        @end@
+    @end@
+
+typedef struct ${i}_context_s {
+    netsnmp_index index; /** THIS MUST BE FIRST!!! */
+
+    /*************************************************************
+     * You can store data internally in this structure.
+     *
+     * TODO: You will probably have to fix a few types here...
+     */
+    @if $ext_index != 0@
+    /** TODO: add storage for external index(s)! */
+    @end@
+    @foreach $c column@
+        /** $c.syntax = $c.type */
+        @eval $have_type = 0@
+        @if "$c.type" eq "ASN_OCTET_STR"@
+            @eval $have_type = 1@
+            @eval $o_len = "65535"@
+            @if "$c.syntax" eq "DisplayString"@
+                @eval $o_len = "255"@
+            @end@
+            @if "$c.syntax" eq "SnmpAdminString"@
+                @eval $o_len = "255"@
+            @end@
+            unsigned char $c[$o_len];
+            long ${c}_len;
+        @end@
+        @if "$c.type" eq "ASN_OBJECT_ID"@
+            @eval $have_type = 1@
+            oid $c[MAX_OID_LEN];
+            long ${c}_len;
+        @end@
+        @if "$c.type" eq "ASN_UNSIGNED"@
+            @eval $have_type = 1@
+            unsigned long $c;
+        @end@
+        @if "$c.type" eq "ASN_TIMETICKS"@
+            @eval $have_type = 1@
+            unsigned long $c;
+        @end@
+        @if "$c.type" eq "ASN_IPADDRESS"@
+            @eval $have_type = 1@
+            unsigned long $c;
+        @end@
+        @if "$c.type" eq "ASN_UINTEGER"@
+            @eval $have_type = 1@
+            unsigned long $c;
+        @end@
+        @if "$c.type" eq "ASN_INTEGER"@
+            @eval $have_type = 1@
+            long $c;
+        @end@
+        @if "$c.type" eq "ASN_COUNTER"@
+            @eval $have_type = 1@
+            unsigned long $c;
+        @end@
+        @if $have_type == 0@
+    /** TODO: Is this type correct? */
+            long $c;
+        @end@
+
+    @end@
+
+    /*
+     * OR
+     *
+     * Keep a pointer to your data
+     */
+    void * data;
+
+    /*
+     *add anything else you want here
+     */
+
+} ${i}_context;
+
+/*************************************************************
+ * function declarations
+ */
+void init_$i(void);
+void initialize_table_$i(void);
+const ${i}_context * ${i}_get_by_idx(netsnmp_index *);
+const ${i}_context * ${i}_get_by_idx_rs(netsnmp_index *,
+                                        int row_status);
+int ${i}_get_value(netsnmp_request_info *, netsnmp_index *, netsnmp_table_request_info *);
+
+
+/*************************************************************
+ * oid declarations
+ */
+extern oid ${i}_oid[];
+extern size_t ${i}_oid_len;
+
+#define ${i}_TABLE_OID $i.commaoid
+    
+/*************************************************************
+ * column number definitions for table $i
+ */
+@eval $minv = 0xffffffff@
+@eval $maxv = 0@
+@foreach $c column@
+#define COLUMN_$c.uc $c.subid
+@if ! $c.noaccess@
+@eval $minv = min($minv, $c.subid)@
+@eval $maxv = max($maxv, $c.subid)@
+@end@
+@if "$c.syntax" eq "RowStatus"@
+   @eval $rs_name = "$c"@
+@end@
+@if "$c.syntax" eq "StorageType"@
+   @eval $st_name = "$c"@
+@end@
+@end@
+#define ${i}_COL_MIN $minv
+#define ${i}_COL_MAX $maxv
+
+/* comment out the following line if you don't handle SET-REQUEST for $i */
+#define ${i}_SET_HANDLING
+
+/* comment out the following line if you can't create new rows */
+#define ${i}_ROW_CREATION
+
+/* comment out the following line if you don't want the secondary index */
+#define ${i}_IDX2
+
+@if "$rs_name" ne ""@
+/* uncommend the following line if you allow modifications to an
+ * active row */
+/** define ${i}_CAN_MODIFY_ACTIVE_ROW */
+
+@end@
+#ifdef ${i}_SET_HANDLING
+
+int ${i}_extract_index( ${i}_context * ctx, netsnmp_index * hdr );
+
+void ${i}_set_reserve1( netsnmp_request_group * );
+void ${i}_set_reserve2( netsnmp_request_group * );
+void ${i}_set_action( netsnmp_request_group * );
+void ${i}_set_commit( netsnmp_request_group * );
+void ${i}_set_free( netsnmp_request_group * );
+void ${i}_set_undo( netsnmp_request_group * );
+
+${i}_context * ${i}_duplicate_row( ${i}_context* );
+netsnmp_index * ${i}_delete_row( ${i}_context* );
+
+@if "$rs_name" ne ""@
+int ${i}_can_activate(${i}_context *undo_ctx,
+                      ${i}_context *row_ctx,
+                      netsnmp_request_group * rg);
+int ${i}_can_deactivate(${i}_context *undo_ctx,
+                        ${i}_context *row_ctx,
+                        netsnmp_request_group * rg);
+@end@
+int ${i}_can_delete(${i}_context *undo_ctx,
+                    ${i}_context *row_ctx,
+                    netsnmp_request_group * rg);
+    
+    
+#ifdef ${i}_ROW_CREATION
+${i}_context * ${i}_create_row( netsnmp_index* );
+#endif
+#endif
+
+#ifdef ${i}_IDX2
+${i}_context * ${i}_get( const char *name, int len );
+#endif
+
+#ifdef __cplusplus
+};
+#endif
+
+#endif /** $i.uc_H */
+@end@
+######################################################################
+## Do the .c file
+######################################################################
+@foreach $i table@
+@open ${i}.c@
+@eval $hack = "Id"@
+/*
+ * Note: this file originally auto-generated by mib2c using
+ *       $Id: mib2c.array-user.conf,v 1.1.2.1 2004/06/20 21:54:45 nikki Exp $
+ *
+ * $$hack:$
+ *
+ *
+ * For help understanding NET-SNMP in general, please check the 
+ *     documentation and FAQ at:
+ *
+ *     http://www.net-snmp.org/
+ *
+ *
+ * For help understanding this code, the agent and how it processes
+ *     requests, please check the following references.
+ *
+ *     http://www.net-snmp.org/tutorial/
+ *
+ *
+ * You can also join the #net-snmp channel on irc.openprojects.net
+ *     and ask for help there.
+ *
+ *
+ * And if all else fails, send a detailed message to the developers
+ *     describing the problem you are having to:
+ *
+ *    net-snmp-coders@lists.sourceforge.net
+ *
+ *
+ * Yes, there is lots of code here that you might not use. But it is much
+ * easier to remove code than to add it!
+ */
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+#include <net-snmp/library/snmp_assert.h>
+
+#include "${i}.h"
+
+static     netsnmp_handler_registration *my_handler = NULL;
+static     netsnmp_table_array_callbacks cb;
+
+oid ${i}_oid[] = { ${i}_TABLE_OID };
+size_t ${i}_oid_len = OID_LENGTH(${i}_oid);
+
+
+#ifdef ${i}_IDX2
+/************************************************************
+ * keep binary tree to find context by name
+ */
+static int ${i}_cmp( const void *lhs, const void *rhs );
+
+/************************************************************
+ * compare two context pointers here. Return -1 if lhs < rhs,
+ * 0 if lhs == rhs, and 1 if lhs > rhs.
+ */
+static int
+${i}_cmp( const void *lhs, const void *rhs )
+{
+    ${i}_context *context_l =
+        (${i}_context *)lhs;
+    ${i}_context *context_r =
+        (${i}_context *)rhs;
+
+    /*
+     * check primary key, then secondary. Add your own code if
+     * there are more than 2 indexes
+     */
+    int rc;
+
+    /*
+     * TODO: implement compare. Remove this ifdef code and
+     * add your own code here.
+     */
+#ifdef TABLE_CONTAINER_TODO
+    snmp_log(LOG_ERR,
+             "${i}_compare not implemented! Container order undefined\n" );
+    return 0;
+#endif
+    
+    /*
+     * EXAMPLE:
+     *   
+     * rc = strcmp( context_l->xxName, context_r->xxName);
+     *
+     * if(rc)
+     *   return rc;
+     *
+     * TODO: fix secondary keys (or delete if there are none)
+     *
+     * if(context_l->yy < context_r->yy) 
+     *   return -1;
+     *
+     * return (context_l->yy == context_r->yy) ? 0 : 1;
+     */
+}
+
+/************************************************************
+ * search tree
+ */
+/** TODO: set additional indexes as parameters */
+${i}_context *
+${i}_get( const char *name, int len )
+{
+    ${i}_context tmp;
+
+    /** we should have a secondary index */
+    netsnmp_assert(cb.container->next != NULL);
+    
+    /*
+     * TODO: implement compare. Remove this ifdef code and
+     * add your own code here.
+     */
+#ifdef TABLE_CONTAINER_TODO
+    snmp_log(LOG_ERR, "${i}_get not implemented!\n" );
+    return NULL;
+#endif
+
+    /*
+     * EXAMPLE:
+     *
+     * if(len > sizeof(tmp.xxName))
+     *   return NULL;
+     *
+     * strncpy( tmp.xxName, name, sizeof(tmp.xxName) );
+     * tmp.xxName_len = len;
+     *
+     * return CONTAINER_FIND(cb.container->next, &tmp);
+     */
+}
+#endif
+
+
+/************************************************************
+ * Initializes the $i module
+ */
+void
+init_$i(void)
+{
+    initialize_table_$i();
+
+    /*
+     * TODO: perform any startup stuff here
+     */
+}
+
+/************************************************************
+ * the *_row_copy routine
+ */
+static int ${i}_row_copy(${i}_context * dst,
+                         ${i}_context * src)
+{
+    if(!dst||!src)
+        return 1;
+        
+    /*
+     * copy index, if provided
+     */
+    if(dst->index.oids)
+        free(dst->index.oids);
+    if(snmp_clone_mem( (void*)&dst->index.oids, src->index.oids,
+                           src->index.len * sizeof(oid) )) {
+        dst->index.oids = NULL;
+        return 1;
+    }
+    dst->index.len = src->index.len;
+    
+
+    /*
+     * copy components into the context structure
+     */
+    @if $ext_index != 0@
+    /** TODO: add code for external index(s)! */
+    @end@
+    @foreach $c column@
+    @eval $have_type = 0@
+    @if "$c.type" eq "ASN_OCTET_STR"@
+    @eval $have_type = 1@
+    memcpy( dst->$c, src->$c, src->${c}_len );
+    dst->${c}_len = src->${c}_len;
+    @end@
+    @if "$c.type" eq "ASN_OBJECT_ID"@
+    @eval $have_type = 1@
+    memcpy( src->$c, dst->$c, src->${c}_len );
+    dst->${c}_len = src->${c}_len;
+    @end@
+    @if $have_type == 0@
+    dst->$c = src->$c;
+    @end@
+
+    @end@
+    return 0;
+}
+
+#ifdef ${i}_SET_HANDLING
+
+/*
+ * the *_extract_index routine
+ */
+int
+${i}_extract_index( ${i}_context * ctx, netsnmp_index * hdr )
+{
+    /*
+     * temporary local storage for extracting oid index
+     */
+    @if $ext_index != 0@
+    /** TODO: add storage for external index(s)! */
+    @end@
+    @eval $first_idx = ""@
+    @foreach $idx index@
+        @if "$first_idx" eq ""@
+        @eval $first_idx = $idx@
+        @end@
+    netsnmp_variable_list var_$idx;
+    @end@
+    int err;
+
+    /*
+     * copy index, if provided
+     */
+    if(hdr) {
+        netsnmp_assert(ctx->index.oids == NULL);
+        if(snmp_clone_mem( (void*)&ctx->index.oids, hdr->oids,
+                           hdr->len * sizeof(oid) )) {
+            return -1;
+        }
+        ctx->index.len = hdr->len;
+    }
+
+    /**
+     * Create variable to hold each component of the index
+     */
+    @if $ext_index != 0@
+       /** TODO: add code for external index(s)! */
+    @end@
+    @foreach $idx index@
+       memset( &var_$idx, 0x00, sizeof(var_$idx) );
+       var_${idx}.type = $idx.type;
+       /** TODO: link this index to the next, or NULL for the last one */
+#ifdef TABLE_CONTAINER_TODO
+    snmp_log(LOG_ERR, "${i}_extract_index index list not implemented!\n" );
+    return 0;
+#else
+       var_$idx.next_variable = &var_XX;
+#endif
+
+    @end@
+
+    /*
+     * parse the oid into the individual components
+     */
+    err = parse_oid_indexes( hdr->oids, hdr->len, &var_$first_idx );
+    if (err == SNMP_ERR_NOERROR) {
+       /*
+        * copy components into the context structure
+        */
+       @foreach $idx index@
+          @eval $found = "external"@
+          @foreach $c column@
+              @if "$idx" eq "$c"@
+                 @eval $found = "internal"@
+              @end@
+          @end@
+          @if "$found" eq "external"@
+              /** skipping external index $idx */
+          @end@
+          @if "$found" eq "internal"@
+             @eval $have_type = 0@
+             @if "$idx.type" eq "ASN_OCTET_STR"@
+             @eval $have_type = 1@
+                if(var_$idx.val_len > sizeof(ctx->$idx))
+                   err = -1;
+                else
+                    memcpy( ctx->$idx, var_$idx.val.string, var_$idx.val_len );
+                ctx->${idx}_len = var_$idx.val_len;
+             @end@
+             @if "$idx.type" eq "ASN_OBJECT_ID"@
+             @eval $have_type = 1@
+                memcpy( ctx->$idx, var_$idx.val.string, var_$idx.val_len );
+                ctx->$idx_len = var_$idx.val_len;
+             @end@
+             @if $have_type == 0@
+                ctx->$idx = *var_$idx.val.integer;
+             @end@
+          @end@
+   
+       @end@
+   
+       @foreach $c index@
+           /*
+            * TODO: check index for valid values. For EXAMPLE:
+            *
+          @eval $have_check = 0@
+          @if "$c.type" eq "ASN_IPADDRESS"@
+              @eval $have_check = 1@
+              * if ( XXX_check_ip( *var_$c.val.integer ) ) {
+          @end@
+          @if "$c.type" eq "ASN_OBJECT_ID"@
+              @eval $have_check = 1@
+              * if ( XXX_check_oid( var_$c.val.objid, var_$c.val_len /
+                                    sizeof(oid) ) ) {
+          @end@
+          @if "$c.type" eq "ASN_OCTET_STR"@
+              @eval $have_check = 1@
+              * if ( XXX_check_value( var_$c.val.string, XXX ) ) {
+          @end@
+          @if $have_check != 1@
+              * if ( *var_$c.val.integer != XXX ) {
+          @end@
+          *    err = -1;
+          * }
+          */
+       @end@
+    }
+
+    /*
+     * parsing may have allocated memory. free it.
+     */
+    snmp_reset_var_buffers( &var_$first_idx );
+
+    return err;
+}
+
+@if "$rs_name" ne ""@
+/************************************************************
+ * the *_can_activate routine is called
+ * when a row is changed to determine if all the values
+ * set are consistent with the row's rules for a row status
+ * of ACTIVE.
+ *
+ * return 1 if the row could be ACTIVE
+ * return 0 if the row is not ready for the ACTIVE state
+ */
+int ${i}_can_activate(${i}_context *undo_ctx,
+                      ${i}_context *row_ctx,
+                      netsnmp_request_group * rg)
+{
+    /*
+     * TODO: check for activation requirements here
+     */
+    return 1;
+}
+
+/************************************************************
+ * the *_can_deactivate routine is called when a row that is
+ * currently ACTIVE is set to a state other than ACTIVE. If
+ * there are conditions in which a row should not be allowed
+ * to transition out of the ACTIVE state (such as the row being
+ * referred to by another row or table), check for them here.
+ *
+ * return 1 if the row can be set to a non-ACTIVE state
+ * return 0 if the row must remain in the ACTIVE state
+ */
+int ${i}_can_deactivate(${i}_context *undo_ctx,
+                        ${i}_context *row_ctx,
+                        netsnmp_request_group * rg)
+{
+    /*
+     * TODO: check for deactivation requirements here
+     */
+    return 1;
+}
+
+@end@
+/************************************************************
+ * the *_can_delete routine is called to determine if a row
+ * can be deleted.
+ *
+ * return 1 if the row can be deleted
+ * return 0 if the row cannot be deleted
+ */
+int ${i}_can_delete(${i}_context *undo_ctx,
+                    ${i}_context *row_ctx,
+                    netsnmp_request_group * rg)
+{
+@if "$rs_name" ne ""@
+    /*
+     * probably shouldn't delete a row that we can't
+     * deactivate.
+     */
+    if(${i}_can_deactivate(undo_ctx,row_ctx,rg) != 1)
+        return 0;
+@end@
+    
+    /*
+     * TODO: check for other deletion requirements here
+     */
+    return 1;
+}
+
+#ifdef ${i}_ROW_CREATION
+/************************************************************
+ * the *_create_row routine is called by the table handler
+ * to create a new row for a given index. If you need more
+ * information (such as column values) to make a decision
+ * on creating rows, you must create an initial row here
+ * (to hold the column values), and you can examine the
+ * situation in more detail in the *_set_reserve1 or later
+ * states of set processing. Simple check for a NULL undo_ctx
+ * in those states and do detailed creation checking there.
+ *
+ * returns a newly allocated ${i}_context
+ *   structure if the specified indexes are not illegal
+ * returns NULL for errors or illegal index values.
+ */
+${i}_context *
+${i}_create_row( netsnmp_index* hdr)
+{
+    ${i}_context * ctx =
+        SNMP_MALLOC_TYPEDEF(${i}_context);
+    if(!ctx)
+        return NULL;
+        
+    /*
+     * TODO: check indexes, if necessary.
+     */
+    if(${i}_extract_index( ctx, hdr )) {
+        free(ctx->index.oids);
+        free(ctx);
+        return NULL;
+    }
+
+    /* netsnmp_mutex_init(ctx->lock);
+       netsnmp_mutex_lock(ctx->lock); */
+
+    /*
+     * TODO: initialize any default values here. This is also
+     * first place you really should allocate any memory for
+     * yourself to use.  If you allocated memory earlier,
+     * make sure you free it for earlier error cases!
+     */
+    /**
+     @foreach $c column@
+     @if $c.settable@
+     ctx->$c = 0;
+     @end@
+     @end@
+    */
+
+    return ctx;
+}
+#endif
+
+/************************************************************
+ * the *_duplicate row routine
+ */
+${i}_context *
+${i}_duplicate_row( ${i}_context * row_ctx)
+{
+    ${i}_context * dup;
+
+    if(!row_ctx)
+        return NULL;
+
+    dup = SNMP_MALLOC_TYPEDEF(${i}_context);
+    if(!dup)
+        return NULL;
+        
+    if(${i}_row_copy(dup,row_ctx)) {
+        free(dup);
+        dup = NULL;
+    }
+
+    return dup;
+}
+
+/************************************************************
+ * the *_delete_row method is called to delete a row.
+ */
+netsnmp_index * ${i}_delete_row( ${i}_context * ctx )
+{
+  /* netsnmp_mutex_destroy(ctx->lock); */
+
+    if(ctx->index.oids)
+        free(ctx->index.oids);
+
+    /*
+     * TODO: release any memory you allocated here...
+     */
+
+    /*
+     * release header
+     */
+    free( ctx );
+
+    return NULL;
+}
+
+
+/************************************************************
+ * RESERVE is used to check the syntax of all the variables
+ * provided, that the values being set are sensible and consistent,
+ * and to allocate any resources required for performing the SET.
+ * After this stage, the expectation is that the set ought to
+ * succeed, though this is not guaranteed. (In fact, with the UCD
+ * agent, this is done in two passes - RESERVE1, and
+ * RESERVE2, to allow for dependancies between variables).
+ *
+ * BEFORE calling this routine, the agent will call duplicate_row
+ * to create a copy of the row (unless this is a new row; i.e.
+ * row_created == 1).
+ *
+ * next state -> SET_RESERVE2 || SET_FREE
+ */
+void ${i}_set_reserve1( netsnmp_request_group *rg )
+{
+    ${i}_context *row_ctx =
+            (${i}_context *)rg->existing_row;
+    ${i}_context *undo_ctx =
+            (${i}_context *)rg->undo_info;
+    netsnmp_variable_list *var;
+    netsnmp_request_group_item *current;
+    int rc;
+
+    @if "$st_name" ne ""@
+        /*
+         * Block all attempts to modify a readOnly row
+         */
+    if( row_ctx && (row_ctx->$st_name == SNMP_STORAGE_READONLY) ) {
+        netsnmp_set_mode_request_error(MODE_SET_BEGIN, rg->list->ri,
+                                       SNMP_ERR_NOTWRITABLE);
+        return;
+    }
+    @end@
+
+    /*
+     * TODO: loop through columns, check syntax and lengths. For
+     * columns which have no dependencies, you could also move
+     * the value/range checking here to attempt to catch error
+     * cases as early as possible.
+     */
+    for( current = rg->list; current; current = current->next ) {
+
+        var = current->ri->requestvb;
+        rc = SNMP_ERR_NOERROR;
+
+        switch(current->tri->colnum) {
+
+        @foreach $c column@
+        @if $c.settable@
+        case COLUMN_$c.uc:
+            /** $c.syntax = $c.type */
+            rc = netsnmp_check_vb_type_and_size(var, $c.type,
+                                                sizeof(row_ctx->$c));
+        break;
+
+        @end@
+        @end@
+        default: /** We shouldn't get here */
+            rc = SNMP_ERR_GENERR;
+            snmp_log(LOG_ERR, "unknown column in "
+                     "${i}_set_reserve1\n");
+        }
+
+        if (rc)
+           netsnmp_set_mode_request_error(MODE_SET_BEGIN, current->ri, rc );
+        rg->status = SNMP_MAX( rg->status, current->ri->status );
+    }
+
+    /*
+     * done with all the columns. Could check row related
+     * requirements here.
+     */
+}
+
+void ${i}_set_reserve2( netsnmp_request_group *rg )
+{
+    ${i}_context *row_ctx = (${i}_context *)rg->existing_row;
+    ${i}_context *undo_ctx = (${i}_context *)rg->undo_info;
+    netsnmp_request_group_item *current;
+    netsnmp_variable_list *var;
+    int rc;
+
+    rg->rg_void = rg->list->ri;
+
+    /*
+     * TODO: loop through columns, check for valid
+     * values and any range constraints.
+     */
+    for( current = rg->list; current; current = current->next ) {
+
+        var = current->ri->requestvb;
+        rc = SNMP_ERR_NOERROR;
+
+        switch(current->tri->colnum) {
+
+        @foreach $c column@
+        @if $c.settable@
+        case COLUMN_$c.uc:
+            /** $c.syntax = $c.type */
+            @eval $have_check = 0@
+            @if "$c" eq "$st_name"@
+                @eval $have_check = 1@
+                rc = netsnmp_check_vb_storagetype(current->ri->requestvb,
+                                                  undo_ctx ?
+                                                  undo_ctx->$c:0);
+            @end@
+            @if "$c" eq "$rs_name"@
+                @eval $have_check = 1@
+                rc = netsnmp_check_vb_rowstatus(current->ri->requestvb,
+                                                undo_ctx ?
+                                                undo_ctx->$c:0);
+                rg->rg_void = current->ri;
+            @end@
+            @if "$c.syntax" eq "TruthValue"@
+                @eval $have_check = 1@
+                rc = netsnmp_check_vb_truthvalue(current->ri->requestvb);
+            @end@
+            @if $have_check == 0@
+                    /*
+                     * TODO: routine to check valid values
+                     *
+                     * EXAMPLE:
+                     *
+                @if "$c.type" eq "ASN_IPADDRESS"@
+                    @eval $have_check = 1@
+                    * if ( XXX_check_ip( *var->val.integer ) ) {
+                @end@
+                @if "$c.type" eq "ASN_OBJECT_ID"@
+                    @eval $have_check = 1@
+                    * if ( XXX_check_oid( var ) ) {
+                @end@
+                @if "$c.type" eq "ASN_OCTET_STR"@
+                    @eval $have_check = 1@
+                    * if ( XXX_check_value( var->val.string, XXX ) ) {
+                @end@
+                @if $have_check != 1@
+                    * if ( *var->val.integer != XXX ) {
+                @end@
+                *    rc = SNMP_ERR_INCONSISTENTVALUE;
+                *    rc = SNMP_ERR_BADVALUE;
+                * }
+                */
+            @end@
+        break;
+
+        @end@
+        @end@
+        default: /** We shouldn't get here */
+            netsnmp_assert(0); /** why wasn't this caught in reserve1? */
+        }
+
+        if (rc)
+           netsnmp_set_mode_request_error(MODE_SET_BEGIN, current->ri, rc);
+    }
+
+    /*
+     * done with all the columns. Could check row related
+     * requirements here.
+     */
+}
+
+/************************************************************
+ * Assuming that the RESERVE phases were successful, the next
+ * stage is indicated by the action value ACTION. This is used
+ * to actually implement the set operation. However, this must
+ * either be done into temporary (persistent) storage, or the
+ * previous value stored similarly, in case any of the subsequent
+ * ACTION calls fail.
+ *
+ * In your case, changes should be made to row_ctx. A copy of
+ * the original row is in undo_ctx.
+ */
+void ${i}_set_action( netsnmp_request_group *rg )
+{
+    netsnmp_variable_list *var;
+    ${i}_context *row_ctx = (${i}_context *)rg->existing_row;
+    ${i}_context *undo_ctx = (${i}_context *)rg->undo_info;
+    netsnmp_request_group_item *current;
+
+    @if "$rs_name" ne ""@
+    int            row_err = 0;
+    @end@
+
+    /*
+     * TODO: loop through columns, copy varbind values
+     * to context structure for the row.
+     */
+    for( current = rg->list; current; current = current->next ) {
+
+        var = current->ri->requestvb;
+
+        switch(current->tri->colnum) {
+
+        @foreach $c column@
+        @if $c.settable@
+        case COLUMN_$c.uc:
+            /** $c.syntax = $c.type */
+            @eval $have_type = 0@
+            @if "$c.type" eq "ASN_OCTET_STR"@
+            @eval $have_type = 1@
+            memcpy(row_ctx->$c,var->val.string,var->val_len);
+            row_ctx->${c}_len = var->val_len;
+            @end@
+            @if "$c.type" eq "ASN_OBJECT_ID"@
+            @eval $have_type = 1@
+            memcpy(row_ctx->$c,var->val.objid,var->val_len);
+            row_ctx->${c}_len = var->val_len;
+            @end@
+            @if $have_type == 0@
+            row_ctx->$c = *var->val.integer;
+            @end@
+        break;
+
+        @end@
+        @end@
+        default: /** We shouldn't get here */
+            netsnmp_assert(0); /** why wasn't this caught in reserve1? */
+        }
+    }
+
+    /*
+     * done with all the columns. Could check row related
+     * requirements here.
+     */
+    @if "$rs_name" ne ""@
+#ifndef ${i}_CAN_MODIFY_ACTIVE_ROW
+    if( undo_ctx && RS_IS_ACTIVE(undo_ctx->$rs_name) &&
+        row_ctx && RS_IS_ACTIVE(row_ctx->$rs_name) ) {
+            row_err = 1;
+    }
+#endif
+
+    /*
+     * check activation/deactivation
+     */
+    row_err = netsnmp_table_array_check_row_status(&cb, rg,
+                                  row_ctx ? &row_ctx->$rs_name : NULL,
+                                  undo_ctx ? &undo_ctx->$rs_name : NULL);
+    if(row_err) {
+        netsnmp_set_mode_request_error(MODE_SET_BEGIN,
+                                       (netsnmp_request_info*)rg->rg_void,
+                                       row_err);
+        return;
+    }
+
+    @end@
+    /*
+     * TODO: if you have dependencies on other tables, this would be
+     * a good place to check those, too.
+     */
+}
+
+/************************************************************
+ * Only once the ACTION phase has completed successfully, can
+ * the final COMMIT phase be run. This is used to complete any
+ * writes that were done into temporary storage, and then release
+ * any allocated resources. Note that all the code in this phase
+ * should be "safe" code that cannot possibly fail (cue
+ * hysterical laughter). The whole intent of the ACTION/COMMIT
+ * division is that all of the fallible code should be done in
+ * the ACTION phase, so that it can be backed out if necessary.
+ *
+ * BEFORE calling this routine, the agent will update the
+ * container (inserting a row if row_created == 1, or removing
+ * the row if row_deleted == 1).
+ *
+ * AFTER calling this routine, the agent will delete the
+ * undo_info.
+ */
+void ${i}_set_commit( netsnmp_request_group *rg )
+{
+    netsnmp_variable_list *var;
+    ${i}_context *row_ctx = (${i}_context *)rg->existing_row;
+    ${i}_context *undo_ctx = (${i}_context *)rg->undo_info;
+    netsnmp_request_group_item *current;
+
+    /*
+     * loop through columns
+     */
+    for( current = rg->list; current; current = current->next ) {
+
+        var = current->ri->requestvb;
+
+        switch(current->tri->colnum) {
+
+        @foreach $c column@
+        @if $c.settable@
+        case COLUMN_$c.uc:
+            /** $c.syntax = $c.type */
+        break;
+
+        @end@
+        @end@
+        default: /** We shouldn't get here */
+            netsnmp_assert(0); /** why wasn't this caught in reserve1? */
+        }
+    }
+
+    /*
+     * done with all the columns. Could check row related
+     * requirements here.
+     */
+}
+
+/************************************************************
+ * If either of the RESERVE calls fail, the write routines
+ * are called again with the FREE action, to release any resources
+ * that have been allocated. The agent will then return a failure
+ * response to the requesting application.
+ *
+ * AFTER calling this routine, the agent will delete undo_info.
+ */
+void ${i}_set_free( netsnmp_request_group *rg )
+{
+    netsnmp_variable_list *var;
+    ${i}_context *row_ctx = (${i}_context *)rg->existing_row;
+    ${i}_context *undo_ctx = (${i}_context *)rg->undo_info;
+    netsnmp_request_group_item *current;
+
+    /*
+     * loop through columns
+     */
+    for( current = rg->list; current; current = current->next ) {
+
+        var = current->ri->requestvb;
+
+        switch(current->tri->colnum) {
+
+        @foreach $c column@
+        @if $c.settable@
+        case COLUMN_$c.uc:
+            /** $c.syntax = $c.type */
+        break;
+
+        @end@
+        @end@
+        default: /** We shouldn't get here */
+            /** should have been logged in reserve1 */
+        }
+    }
+
+    /*
+     * done with all the columns. Could check row related
+     * requirements here.
+     */
+}
+
+/************************************************************
+ * If the ACTION phase does fail (for example due to an apparently
+ * valid, but unacceptable value, or an unforeseen problem), then
+ * the list of write routines are called again, with the UNDO
+ * action. This requires the routine to reset the value that was
+ * changed to its previous value (assuming it was actually changed),
+ * and then to release any resources that had been allocated. As
+ * with the FREE phase, the agent will then return an indication
+ * of the error to the requesting application.
+ *
+ * BEFORE calling this routine, the agent will update the container
+ * (remove any newly inserted row, re-insert any removed row).
+ *
+ * AFTER calling this routing, the agent will call row_copy
+ * to restore the data in existing_row from the date in undo_info.
+ * Then undo_info will be deleted (or existing row, if row_created
+ * == 1).
+ */
+void ${i}_set_undo( netsnmp_request_group *rg )
+{
+    netsnmp_variable_list *var;
+    ${i}_context *row_ctx = (${i}_context *)rg->existing_row;
+    ${i}_context *undo_ctx = (${i}_context *)rg->undo_info;
+    netsnmp_request_group_item *current;
+
+    /*
+     * loop through columns
+     */
+    for( current = rg->list; current; current = current->next ) {
+
+        var = current->ri->requestvb;
+
+        switch(current->tri->colnum) {
+
+        @foreach $c column@
+        @if $c.settable@
+        case COLUMN_$c.uc:
+            /** $c.syntax = $c.type */
+        break;
+
+        @end@
+        @end@
+        default: /** We shouldn't get here */
+            netsnmp_assert(0); /** why wasn't this caught in reserve1? */
+        }
+    }
+
+    /*
+     * done with all the columns. Could check row related
+     * requirements here.
+     */
+}
+
+#endif /** ${i}_SET_HANDLING */
+
+
+/************************************************************
+ *
+ * Initialize the $i table by defining its contents and how it's structured
+ */
+void
+initialize_table_$i(void)
+{
+    netsnmp_table_registration_info *table_info;
+
+    if(my_handler) {
+        snmp_log(LOG_ERR, "initialize_table_${i}_handler called again\n");
+        return;
+    }
+
+    memset(&cb, 0x00, sizeof(cb));
+
+    /** create the table structure itself */
+    table_info = SNMP_MALLOC_TYPEDEF(netsnmp_table_registration_info);
+
+    /* if your table is read only, it's easiest to change the
+       HANDLER_CAN_RWRITE definition below to HANDLER_CAN_RONLY */
+    my_handler = netsnmp_create_handler_registration("$i",
+                                             netsnmp_table_array_helper_handler,
+                                             ${i}_oid,
+                                             ${i}_oid_len,
+                                             HANDLER_CAN_RWRITE);
+            
+    if (!my_handler || !table_info) {
+        snmp_log(LOG_ERR, "malloc failed in "
+                 "initialize_table_${i}_handler\n");
+        return; /** mallocs failed */
+    }
+
+    /***************************************************
+     * Setting up the table's definition
+     */
+    /*
+     * TODO: add any external indexes here.
+     */
+    @if $ext_index != 0@
+        /** TODO: add code for external index(s)! */
+    @end@
+
+    /*
+     * internal indexes
+     */
+    @foreach $idx index@
+        /** index: $idx */
+        netsnmp_table_helper_add_index(table_info, $idx.type);
+    @end@
+
+    table_info->min_column = ${i}_COL_MIN;
+    table_info->max_column = ${i}_COL_MAX;
+
+    /***************************************************
+     * registering the table with the master agent
+     */
+    cb.get_value = ${i}_get_value;
+    cb.container = netsnmp_container_find("${i}_primary:"
+                                          "${i}:"
+                                          "table_container");
+#ifdef ${i}_IDX2
+    netsnmp_container_add_index(cb.container,
+                                netsnmp_container_find("${i}_secondary:"
+                                                       "${i}:"
+                                                       "table_container"));
+    cb.container->next->compare = ${i}_cmp;
+#endif
+#ifdef ${i}_SET_HANDLING
+    cb.can_set = 1;
+#ifdef ${i}_ROW_CREATION
+    cb.create_row = (UserRowMethod*)${i}_create_row;
+#endif
+    cb.duplicate_row = (UserRowMethod*)${i}_duplicate_row;
+    cb.delete_row = (UserRowMethod*)${i}_delete_row;
+    cb.row_copy = (Netsnmp_User_Row_Operation *)${i}_row_copy;
+
+@if "$rs_name" ne ""@
+    cb.can_activate = (Netsnmp_User_Row_Action *)${i}_can_activate;
+    cb.can_deactivate = (Netsnmp_User_Row_Action *)${i}_can_deactivate;
+@end@
+    cb.can_delete = (Netsnmp_User_Row_Action *)${i}_can_delete;
+
+    cb.set_reserve1 = ${i}_set_reserve1;
+    cb.set_reserve2 = ${i}_set_reserve2;
+    cb.set_action = ${i}_set_action;
+    cb.set_commit = ${i}_set_commit;
+    cb.set_free = ${i}_set_free;
+    cb.set_undo = ${i}_set_undo;
+#endif
+    DEBUGMSGTL(("initialize_table_$i",
+                "Registering table $i "
+                "as a table array\n"));
+    netsnmp_table_container_register(my_handler, table_info, &cb,
+                                     cb.container, 1);
+}
+
+/************************************************************
+ * ${i}_get_value
+ */
+int ${i}_get_value(
+            netsnmp_request_info *request,
+            netsnmp_index *item,
+            netsnmp_table_request_info *table_info )
+{
+    netsnmp_variable_list *var = request->requestvb;
+    ${i}_context *context = (${i}_context *)item;
+
+    switch(table_info->colnum) {
+
+        @foreach $c column@
+            @eval $have_type = 0@
+        case COLUMN_$c.uc:
+            /** $c.syntax = $c.type */
+            @if "$c.type" eq "ASN_OBJECT_ID"@
+                @eval $have_type = 1@
+            snmp_set_var_typed_value(var, $c.type,
+                         (char*)&context->$c,
+                         context->${c}_len );
+            @end@
+            @if "$c.type" eq "ASN_OCTET_STR"@
+                @eval $have_type = 1@
+            snmp_set_var_typed_value(var, $c.type,
+                         (char*)&context->$c,
+                         context->${c}_len );
+            @end@
+            @if $have_type == 0@
+            snmp_set_var_typed_value(var, $c.type,
+                         (char*)&context->$c,
+                         sizeof(context->$c) );
+            @end@
+        break;
+    
+        @end@
+    default: /** We shouldn't get here */
+        snmp_log(LOG_ERR, "unknown column in "
+                 "${i}_get_value\n");
+        return SNMP_ERR_GENERR;
+    }
+    return SNMP_ERR_NOERROR;
+}
+
+/************************************************************
+ * ${i}_get_by_idx
+ */
+const ${i}_context *
+${i}_get_by_idx(netsnmp_index * hdr)
+{
+    return (const ${i}_context *)
+        CONTAINER_FIND(cb.container, hdr );
+}
+
+
+@end@
+@end@
+@end@
diff -Naur tomato/release/src/router/snmp/local/mib2c.column_defines.conf tomato121/release/src/router/snmp/local/mib2c.column_defines.conf
--- tomato/release/src/router/snmp/local/mib2c.column_defines.conf	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/local/mib2c.column_defines.conf	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,15 @@
+@open ${name}_columns.h@
+/*
+ * Note: this file originally auto-generated by mib2c using
+ *  $Id: mib2c.column_defines.conf,v 1.1.2.1 2004/06/20 21:54:45 nikki Exp $
+ */
+#ifndef $name.uc_COLUMNS_H
+#define $name.uc_COLUMNS_H
+@foreach $i table@
+
+/* column number definitions for table $i */
+    @foreach $c column@
+       #define COLUMN_$c.uc		$c.subid
+    @end@
+@end@
+#endif /* $name.uc_COLUMNS_H */
diff -Naur tomato/release/src/router/snmp/local/mib2c.column_enums.conf tomato121/release/src/router/snmp/local/mib2c.column_enums.conf
--- tomato/release/src/router/snmp/local/mib2c.column_enums.conf	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/local/mib2c.column_enums.conf	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,22 @@
+@open ${name}_enums.h@
+/*
+ * Note: this file originally auto-generated by mib2c using
+ *  $Id: mib2c.column_enums.conf,v 1.1.2.1 2004/06/20 21:54:45 nikki Exp $
+ */
+#ifndef $name.uc_ENUMS_H
+#define $name.uc_ENUMS_H
+@foreach $i table@
+    @foreach $c column@
+       @eval $x = 0@
+       @foreach $e $v enum@
+           @if $x == 0@
+
+               /* enums for column $c */
+	       @eval $x = 1@
+	   @end@
+           #define $c.uc_$e.uc		$v
+       @end@
+    @end@
+@end@
+
+#endif /* $name.uc_ENUMS_H */
diff -Naur tomato/release/src/router/snmp/local/mib2c.conf tomato121/release/src/router/snmp/local/mib2c.conf
--- tomato/release/src/router/snmp/local/mib2c.conf	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/local/mib2c.conf	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,56 @@
+@open -@
+mib2c has multiple configuration files depending on the type of
+code you need to write.  You must pick one depending on your need:
+
+
+  GENERATING CODE FOR SCALAR OBJECTS:
+
+    If you're writing code for some scalars, run:
+
+      mib2c -c mib2c.scalar.conf ${name}
+
+    If you want to magically "tie" integer variables to integer scalars,
+    use:
+
+      mib2c -c mib2c.int_watch.conf ${name}
+
+
+  GENERATING CODE FOR TABLES:
+
+    If your table data is kept somewhere else (e.g. it's in the
+    kernel and not in the memory of the agent itself) and you need to
+    "iterate" over it to find the right data for the SNMP row being
+    accessed.  See the agent/mibgroup/mibII/vacm_context.c file for an
+    example:
+
+      mib2c -c mib2c.iterate.conf ${name}
+
+    If your table data is kept in the agent (i.e. it's not located in
+    an external source) and is purely data driven (i.e. you do not need
+    to perform any work when a set occurs).  See the
+    agent/mibgroup/examples/data_set.c file for an example of such a table:
+
+      mib2c -c mib2c.create-dataset.conf ${name}
+
+    If your table data is kept in the agent (i.e. it's not located in
+    an external source), and you can keep your data sorted by the table
+    index but you do need to perform work when a set occurs:
+
+      mib2c -c mib2c.array-user.conf ${name}
+
+
+  GENERATING HEADER FILE DEFINITIONS
+
+    To generate just a header with a define for each column number in
+    your table:
+
+      mib2c -c mib2c.column_defines.conf ${name}
+
+    To generate just a header with a define for each enum for any
+    column containing enums:
+
+      mib2c -c mib2c.column_enums.conf ${name}
+
+  GENERATING CODE FOR THE 4.X LINE OF CODE (THE OLDER API)
+
+      mib2c -c mib2c.old-api.conf ${name}
diff -Naur tomato/release/src/router/snmp/local/mib2c.create-dataset.conf tomato121/release/src/router/snmp/local/mib2c.create-dataset.conf
--- tomato/release/src/router/snmp/local/mib2c.create-dataset.conf	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/local/mib2c.create-dataset.conf	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,111 @@
+## -*- c -*-
+######################################################################
+## Do the .h file
+######################################################################
+@open ${name}.h@
+/*
+ * Note: this file originally auto-generated by mib2c using
+ *  $Id: mib2c.create-dataset.conf,v 1.1.2.1 2004/06/20 21:54:45 nikki Exp $
+ */
+#ifndef $name.uc_H
+#define $name.uc_H
+
+/* function declarations */
+void init_$name(void);
+@foreach $i table@
+void initialize_table_$i(void);
+Netsnmp_Node_Handler ${i}_handler;
+@end@
+@foreach $i table@
+
+/* column number definitions for table $i */
+    @foreach $c column@
+       #define COLUMN_$c.uc		$c.subid
+    @end@
+@end@
+#endif /* $name.uc_H */
+######################################################################
+## Do the .c file
+######################################################################
+@open ${name}.c@
+/*
+ * Note: this file originally auto-generated by mib2c using
+ *        $Id: mib2c.create-dataset.conf,v 1.1.2.1 2004/06/20 21:54:45 nikki Exp $
+ */
+
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include "${name}.h"
+
+@foreach $i table@
+/** Initialize the $i table by defining its contents and how it's structured */
+void
+initialize_table_$i(void)
+{
+    static oid ${i}_oid[] = {$i.commaoid};
+    size_t ${i}_oid_len = OID_LENGTH(${i}_oid);
+    netsnmp_table_data_set *table_set;
+
+    /* create the table structure itself */
+    table_set = netsnmp_create_table_data_set("$i");
+
+    /* comment this out or delete if you don't support creation of new rows */
+    table_set->allow_creation = 1;
+
+    /***************************************************
+     * Adding indexes
+     */
+    DEBUGMSGTL(("initialize_table_$i",
+                "adding indexes to table $i\n"));
+    netsnmp_table_set_add_indexes(table_set,
+    @foreach $idx index@
+                           $idx.type,  /* index: $idx */
+    @end@
+                           0);
+
+    DEBUGMSGTL(("initialize_table_$i",
+                "adding column types to table $i\n"));		 
+    netsnmp_table_set_multi_add_default_row(table_set,
+    @foreach $c column@
+                                            COLUMN_$c.uc, $c.type, $c.settable,
+                                            NULL, 0,
+    @end@
+                              0);
+    
+    /* registering the table with the master agent */
+    /* note: if you don't need a subhandler to deal with any aspects
+       of the request, change ${i}_handler to "NULL" */
+    netsnmp_register_table_data_set(netsnmp_create_handler_registration("$i", ${i}_handler,
+                                                        ${i}_oid,
+                                                        ${i}_oid_len,
+                                                        HANDLER_CAN_RWRITE),
+                            table_set, NULL);
+}
+@end@
+
+/** Initializes the $name module */
+void
+init_$name(void)
+{
+
+  /* here we initialize all the tables we're planning on supporting */
+  @foreach $i table@
+    initialize_table_$i();
+  @end@
+}
+@foreach $i table@
+
+/** handles requests for the $i table, if anything else needs to be done */
+int
+${i}_handler(
+    netsnmp_mib_handler               *handler,
+    netsnmp_handler_registration      *reginfo,
+    netsnmp_agent_request_info        *reqinfo,
+    netsnmp_request_info              *requests) {
+    /* perform anything here that you need to do.  The requests have
+       already been processed by the master table_dataset handler, but
+       this gives you chance to act on the request in some other way
+       if need be. */
+    return SNMP_ERR_NOERROR;
+}
diff -Naur tomato/release/src/router/snmp/local/mib2c.int_watch.conf tomato121/release/src/router/snmp/local/mib2c.int_watch.conf
--- tomato/release/src/router/snmp/local/mib2c.int_watch.conf	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/local/mib2c.int_watch.conf	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,97 @@
+## -*- c -*-
+######################################################################
+## Do the .h file
+######################################################################
+@open -@
+*** Warning: only generating code for nodes of MIB type INTEGER
+@open ${name}.h@
+/*
+ * Note: this file originally auto-generated by mib2c using
+ *        $Id: mib2c.int_watch.conf,v 1.1.2.1 2004/06/20 21:54:45 nikki Exp $
+ */
+#ifndef $name.uc_H
+#define $name.uc_H
+
+/* function declarations */
+void init_$name(void);
+
+#endif /* $name.uc_H */
+######################################################################
+## Do the .c file
+######################################################################
+@open ${name}.c@
+/*
+ * Note: this file originally auto-generated by mib2c using
+ *        $Id: mib2c.int_watch.conf,v 1.1.2.1 2004/06/20 21:54:45 nikki Exp $
+ */
+
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include "${name}.h"
+
+/* the variable we want to tie an OID to.  The agent will handle all
+ * GET and SET requests to this variable changing its value as needed.
+ */
+
+@foreach $i scalar@
+    @if $i.type eq "ASN_INTEGER"@
+static int      $i = 0;  /* XXX: set default value */
+    @end@
+@end@
+
+/*
+ * our initialization routine, automatically called by the agent 
+ * (to get called, the function name must match init_FILENAME()) 
+ */
+void
+init_${name}(void)
+{
+  @foreach $i scalar@
+    @if $i.type eq "ASN_INTEGER"@
+    static oid ${i}_oid[] = { $i.commaoid, 0 };
+    @end@
+  @end@
+
+  /*
+   * a debugging statement.  Run the agent with -D$name to see
+   * the output of this debugging statement. 
+   */
+  DEBUGMSGTL(("$name", "Initializing the $name module\n"));
+
+
+    /*
+     * the line below registers our variables defined above as
+     * accessible and makes them writable.  A read only version of any
+     * of these registrations would merely call
+     * register_read_only_int_instance() instead.  The functions
+     * called below should be consistent with your MIB, however.
+     * 
+     * If you wanted a callback when the value was retrieved or set
+     * (even though the details of doing this are handled for you),
+     * you could change the NULL pointer below to a valid handler
+     * function. 
+     */
+  @foreach $i scalar@
+    @if $i.type eq "ASN_INTEGER"@
+    DEBUGMSGTL(("$name",
+                "Initializing $i scalar integer.  Default value = %d\n",
+                $i));
+    @if $i.settable@
+      netsnmp_register_int_instance("$i",
+                                    ${i}_oid,
+                                    OID_LENGTH(${i}_oid),
+                                    &$i, NULL);
+    @end@
+    @if !$i.settable@
+      netsnmp_register_read_only_int_instance("$i",
+                                              ${i}_oid,
+                                              OID_LENGTH(${i}_oid),
+                                              &$i, NULL);
+    @end@
+    @end@
+  @end@
+
+  DEBUGMSGTL(("$name",
+              "Done initalizing $name module\n"));
+}
diff -Naur tomato/release/src/router/snmp/local/mib2c.iterate.conf tomato121/release/src/router/snmp/local/mib2c.iterate.conf
--- tomato/release/src/router/snmp/local/mib2c.iterate.conf	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/local/mib2c.iterate.conf	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,257 @@
+## -*- c -*-
+######################################################################
+## Do the .h file
+######################################################################
+@open ${name}.h@
+/*
+ * Note: this file originally auto-generated by mib2c using
+ *        $Id: mib2c.iterate.conf,v 1.1.2.1 2004/06/20 21:54:45 nikki Exp $
+ */
+#ifndef $name.uc_H
+#define $name.uc_H
+
+/* function declarations */
+void init_$name(void);
+@foreach $i table@
+void initialize_table_$i(void);
+Netsnmp_Node_Handler ${i}_handler;
+
+Netsnmp_First_Data_Point  ${i}_get_first_data_point;
+Netsnmp_Next_Data_Point   ${i}_get_next_data_point;
+@end@
+@foreach $i table@
+
+/* column number definitions for table $i */
+    @foreach $c column@
+       #define COLUMN_$c.uc		$c.subid
+    @end@
+@end@
+#endif /* $name.uc_H */
+######################################################################
+## Do the .c file
+######################################################################
+@open ${name}.c@
+/*
+ * Note: this file originally auto-generated by mib2c using
+ *        $Id: mib2c.iterate.conf,v 1.1.2.1 2004/06/20 21:54:45 nikki Exp $
+ */
+
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include "${name}.h"
+
+@foreach $i table@
+/** Initialize the $i table by defining its contents and how it's structured */
+void
+initialize_table_$i(void)
+{
+    static oid ${i}_oid[] = {$i.commaoid};
+    netsnmp_table_registration_info *table_info;
+    netsnmp_handler_registration *my_handler;
+    netsnmp_iterator_info *iinfo;
+
+    /* create the table structure itself */
+    table_info = SNMP_MALLOC_TYPEDEF(netsnmp_table_registration_info);
+    iinfo = SNMP_MALLOC_TYPEDEF(netsnmp_iterator_info);
+
+    /* if your table is read only, it's easiest to change the
+       HANDLER_CAN_RWRITE definition below to HANDLER_CAN_RONLY */
+    my_handler = netsnmp_create_handler_registration("$i",
+                                             ${i}_handler,
+                                             ${i}_oid,
+                                             OID_LENGTH(${i}_oid),
+                                             HANDLER_CAN_RWRITE);
+            
+    if (!my_handler || !table_info || !iinfo)
+        return; /* mallocs failed */
+
+    /***************************************************
+     * Setting up the table's definition
+     */
+    netsnmp_table_helper_add_indexes(table_info,
+    @foreach $idx index@
+                                  $idx.type, /* index: $idx */
+    @end@
+                             0);
+
+    @eval $minv = 0xffffffff@
+    @eval $maxv = 0@
+    @foreach $c column@
+        @if $c.access =~ /(Read|Create)/@
+          @eval $minv = min($minv, $c.subid)@
+          @eval $maxv = max($maxv, $c.subid)@
+        @end@
+    @end@
+    table_info->min_column = $minv;
+    table_info->max_column = $maxv;
+
+    /* iterator access routines */
+    iinfo->get_first_data_point = ${i}_get_first_data_point;
+    iinfo->get_next_data_point = ${i}_get_next_data_point;
+
+    iinfo->table_reginfo = table_info;
+
+    /***************************************************
+     * registering the table with the master agent
+     */
+    DEBUGMSGTL(("initialize_table_$i",
+                "Registering table $i as a table iterator\n"));		 
+    netsnmp_register_table_iterator(my_handler, iinfo);
+}
+@end@
+
+/** Initializes the $name module */
+void
+init_$name(void)
+{
+
+  /* here we initialize all the tables we're planning on supporting */
+  @foreach $i table@
+    initialize_table_$i();
+  @end@
+}
+@foreach $i table@
+
+/** returns the first data point within the $i table data.
+
+    Set the my_loop_context variable to the first data point structure
+    of your choice (from which you can find the next one).  This could
+    be anything from the first node in a linked list, to an integer
+    pointer containing the beginning of an array variable.
+
+    Set the my_data_context variable to something to be returned to
+    you later (in your main ${i}_handler routine) that will provide
+    you with the data to return in a given row.  This could be the
+    same pointer as what my_loop_context is set to, or something
+    different.
+
+    The put_index_data variable contains a list of snmp variable
+    bindings, one for each index in your table.  Set the values of
+    each appropriately according to the data matching the first row
+    and return the put_index_data variable at the end of the function.
+*/
+netsnmp_variable_list *
+${i}_get_first_data_point(void **my_loop_context, void **my_data_context,
+                          netsnmp_variable_list *put_index_data,
+                          netsnmp_iterator_info *mydata)
+{
+
+    netsnmp_variable_list *vptr;
+
+    *my_loop_context = /* XXX */;
+    *my_data_context = /* XXX */;
+
+    vptr = put_index_data;
+    
+    @foreach $idx index@
+    snmp_set_var_value(vptr, (u_char *) /* XXX: $idx data */, /* XXX: length of $idx data */);
+    vptr = vptr->next_variable;
+    @end@
+
+    return put_index_data;
+}
+
+/** functionally the same as ${i}_get_first_data_point, but
+   my_loop_context has already been set to a previous value and should
+   be updated to the next in the list.  For example, if it was a
+   linked list, you might want to cast it and the return
+   my_loop_context->next.  The my_data_context pointer should be set
+   to something you need later and the indexes in put_index_data
+   updated again. */
+
+netsnmp_variable_list *
+${i}_get_next_data_point(void **my_loop_context, void **my_data_context,
+                         netsnmp_variable_list *put_index_data,
+                         netsnmp_iterator_info *mydata)
+{
+
+    netsnmp_variable_list *vptr;
+
+    *my_loop_context = /* XXX */;
+    *my_data_context = /* XXX */;
+
+    vptr = put_index_data;
+    
+    @foreach $idx index@
+    snmp_set_var_value(vptr, (u_char *) /* XXX: $idx data */, /* XXX: length of $idx data */);
+    vptr = vptr->next_variable;
+    @end@
+
+    return put_index_data;
+}
+
+/** handles requests for the $i table, if anything else needs to be done */
+int
+${i}_handler(
+    netsnmp_mib_handler               *handler,
+    netsnmp_handler_registration      *reginfo,
+    netsnmp_agent_request_info        *reqinfo,
+    netsnmp_request_info              *requests) {
+
+    netsnmp_request_info *request;
+    netsnmp_table_request_info *table_info;
+    netsnmp_variable_list *var;
+    
+    for(request = requests; request; request = request->next) {
+        var = request->requestvb;
+        if (request->processed != 0)
+            continue;
+
+        /* perform anything here that you need to do before each
+           request is processed. */
+
+        /* the following extracts the my_data_context pointer set in
+           the loop functions above.  You can then use the results to
+           help return data for the columns of the $i table in question */
+        /* XXX */ = (/* XXX */ *) netsnmp_extract_iterator_context(request);
+        if (/* XXX */ == NULL) {
+            if (reqinfo->mode == MODE_GET) {
+                netsnmp_set_request_error(reqinfo, request, SNMP_NOSUCHINSTANCE);
+                continue;
+            }
+            /* XXX: no row existed, if you support creation and this is a
+               set, start dealing with it here, else continue */
+        }
+
+        /* extracts the information about the table from the request */
+        table_info = netsnmp_extract_table_info(request);
+        /* table_info->colnum contains the column number requested */
+        /* table_info->indexes contains a linked list of snmp variable
+           bindings for the indexes of the table.  Values in the list
+           have been set corresponding to the indexes of the
+           request */
+        if (table_info==NULL) {
+            continue;
+        }
+
+        switch(reqinfo->mode) {
+            /* the table_iterator helper should change all GETNEXTs
+               into GETs for you automatically, so you don't have to
+               worry about the GETNEXT case.  Only GETs and SETs need
+               to be dealt with here */
+            case MODE_GET:
+                switch(table_info->colnum) {
+                    @foreach $c column@
+                        @if $c.access =~ /(Read|Create)/@
+                    case COLUMN_$c.uc:
+                        snmp_set_var_typed_value(var, $c.type, (u_char *) /* XXX: column data */, /* XXX: column data length */);
+                        break;
+
+                        @end@
+                    @end@
+                    default:
+                        /* We shouldn't get here */
+                        snmp_log(LOG_ERR, "problem encountered in ${i}_handler: unknown column\n");
+                }
+                break;
+
+            case MODE_SET_RESERVE1:
+                /* set handling... */
+
+            default:
+                snmp_log(LOG_ERR, "problem encountered in ${i}_handler: unsupported mode\n");
+        }
+    }
+    return SNMP_ERR_NOERROR;
+}
diff -Naur tomato/release/src/router/snmp/local/mib2c.old-api.conf tomato121/release/src/router/snmp/local/mib2c.old-api.conf
--- tomato/release/src/router/snmp/local/mib2c.old-api.conf	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/local/mib2c.old-api.conf	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,332 @@
+## -*- c -*-
+######################################################################
+## Do the .h file
+######################################################################
+@open ${name}.h@
+/*
+ * Note: this file originally auto-generated by mib2c using
+ *        $Id: mib2c.old-api.conf,v 1.1.2.1 2004/06/20 21:54:45 nikki Exp $
+ */
+#ifndef $name.uc_H
+#define $name.uc_H
+
+/* function declarations */
+void init_$name(void);
+FindVarMethod var_$name;
+@foreach $i table@
+FindVarMethod var_${i};
+@end@
+@foreach $i scalar@
+    @if $i.settable@
+    WriteMethod write_${i};
+    @end@
+@end@
+@foreach $i table@
+ @foreach $c column@
+    @if $c.settable@
+    WriteMethod write_${c};
+    @end@
+ @end@
+@end@
+
+#endif /* $name.uc_H */
+######################################################################
+## Do the .c file
+######################################################################
+@open ${name}.c@
+/*
+ * Note: this file originally auto-generated by mib2c using
+ *        $Id: mib2c.old-api.conf,v 1.1.2.1 2004/06/20 21:54:45 nikki Exp $
+ */
+
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include "${name}.h"
+
+/* 
+ * ${name}_variables_oid:
+ *   this is the top level oid that we want to register under.  This
+ *   is essentially a prefix, with the suffix appearing in the
+ *   variable below.
+ */
+
+oid ${name}_variables_oid[] = { $name.commaoid };
+
+/* 
+ * variable4 ${name}_variables:
+ *   this variable defines function callbacks and type return information 
+ *   for the $outputName mib section 
+ */
+
+struct variable4 ${name}_variables[] = {
+/*  magic number        , variable type , ro/rw , callback fn  , L, oidsuffix */
+@eval $magic = 0@
+@foreach $i scalar@
+    @eval $magic = $magic + 1@
+#define $i.uc		$magic
+    @if $i.settable@
+{$i.uc,  $i.type,  RWRITE,  var_${name}, 1,  { $i.subid }},
+    @end@
+    @if !$i.settable@
+{$i.uc,  $i.type,  RONLY ,  var_${name}, 1,  { $i.subid }},
+    @end@
+@end@
+
+@foreach $i table@
+ @foreach $c column@
+    @eval $magic = $magic + 1@
+#define $c.uc		$magic
+    @if $c.settable@
+{$c.uc,  $c.type,  RWRITE,  var_${i}, 3,  { $i.subid, 1, $c.subid }},
+    @end@
+    @if !$c.settable@
+{$c.uc,  $c.type,  RONLY,   var_${i}, 3,  { $i.subid, 1, $c.subid }},
+    @end@
+ @end@
+@end@
+};
+/*    (L = length of the oidsuffix) */
+
+
+/** Initializes the $name module */
+void
+init_$name(void)
+{
+
+    DEBUGMSGTL(("$name", "Initializing\n"));
+
+    /* register ourselves with the agent to handle our mib tree */
+    REGISTER_MIB("$name", ${name}_variables, variable4,
+               ${name}_variables_oid);
+
+    /* place any other initialization junk you need here */
+}
+
+/*
+ * var_$name():
+ *   This function is called every time the agent gets a request for
+ *   a scalar variable that might be found within your mib section
+ *   registered above.  It is up to you to do the right thing and
+ *   return the correct value.
+ *     You should also correct the value of "var_len" if necessary.
+ *
+ *   Please see the documentation for more information about writing
+ *   module extensions, and check out the examples in the examples
+ *   and mibII directories.
+ */
+unsigned char *
+var_$name(struct variable *vp, 
+                oid     *name, 
+                size_t  *length, 
+                int     exact, 
+                size_t  *var_len, 
+                WriteMethod **write_method)
+{
+    /* variables we may use later */
+    static long long_ret;
+    static u_long ulong_ret;
+    static unsigned char string[SPRINT_MAX_LEN];
+    static oid objid[MAX_OID_LEN];
+    static struct counter64 c64;
+
+    if (header_generic(vp,name,length,exact,var_len,write_method)
+                                  == MATCH_FAILED )
+    return NULL;
+
+    /* 
+   * this is where we do the value assignments for the mib results.
+   */
+    switch(vp->magic) {
+@foreach $i scalar@
+    $i.uc:
+    @if $i.settable@
+        *write_method = write_${i};
+    @end@
+        VAR = VALUE;	/* XXX */
+        return (u_char*) &VAR;
+@end@
+    default:
+      ERROR_MSG("");
+    }
+    return NULL;
+}
+
+
+@foreach $i table@
+/*
+ * var_$i():
+ *   Handle this table separately from the scalar value case.
+ *   The workings of this are basically the same as for var_$outputName above.
+ */
+unsigned char *
+var_$i(struct variable *vp,
+    	    oid     *name,
+    	    size_t  *length,
+    	    int     exact,
+    	    size_t  *var_len,
+    	    WriteMethod **write_method)
+{
+    /* variables we may use later */
+    static long long_ret;
+    static u_long ulong_ret;
+    static unsigned char string[SPRINT_MAX_LEN];
+    static oid objid[MAX_OID_LEN];
+    static struct counter64 c64;
+
+    /* 
+   * This assumes that the table is a 'simple' table.
+   *	See the implementation documentation for the meaning of this.
+   *	You will need to provide the correct value for the TABLE_SIZE parameter
+   *
+   * If this table does not meet the requirements for a simple table,
+   *	you will need to provide the replacement code yourself.
+   *	Mib2c is not smart enough to write this for you.
+   *    Again, see the implementation documentation for what is required.
+   */
+    if (header_simple_table(vp,name,length,exact,var_len,write_method, TABLE_SIZE)
+                                                == MATCH_FAILED )
+    return NULL;
+
+    /* 
+   * this is where we do the value assignments for the mib results.
+   */
+    switch(vp->magic) {
+@foreach $c column@
+    $c.uc:
+    @if $c.settable@
+        *write_method = write_${c};
+    @end@
+        VAR = VALUE;	/* XXX */
+        return (u_char*) &VAR;
+@end@
+    default:
+      ERROR_MSG("");
+    }
+    return NULL;
+}
+@end@
+
+@foreach $i scalar@
+@if $i.settable@
+
+
+int
+write_$i(int      action,
+            u_char   *var_val,
+            u_char   var_val_type,
+            size_t   var_val_len,
+            u_char   *statP,
+            oid      *name,
+            size_t   name_len)
+{
+    $i.decl value;
+    int size;
+
+    switch ( action ) {
+        case RESERVE1:
+          if (var_val_type != $i.type) {
+              fprintf(stderr, "write to $name not $i.type\n");
+              return SNMP_ERR_WRONGTYPE;
+          }
+          if (var_val_len > sizeof($i.decl)) {
+              fprintf(stderr,"write to $name: bad length\n");
+              return SNMP_ERR_WRONGLENGTH;
+          }
+          break;
+
+        case RESERVE2:
+          size  = var_val_len;
+          value = * ($i.decl *) var_val;
+
+          break;
+
+        case FREE:
+             /* Release any resources that have been allocated */
+          break;
+
+        case ACTION:
+             /*
+              * The variable has been stored in 'value' for you to use,
+              * and you have just been asked to do something with it.
+              * Note that anything done here must be reversable in the UNDO case
+              */
+          break;
+
+        case UNDO:
+             /* Back out any changes made in the ACTION case */
+          break;
+
+        case COMMIT:
+             /*
+              * Things are working well, so it's now safe to make the change
+              * permanently.  Make sure that anything done here can't fail!
+              */
+          break;
+    }
+    return SNMP_ERR_NOERROR;
+}
+@end@
+@end@
+
+@foreach $i table@
+@foreach $c column@
+@if $c.settable@
+int
+write_$c(int      action,
+            u_char   *var_val,
+            u_char   var_val_type,
+            size_t   var_val_len,
+            u_char   *statP,
+            oid      *name,
+            size_t   name_len)
+{
+    $c.decl value;
+    int size;
+
+    switch ( action ) {
+        case RESERVE1:
+          if (var_val_type != $c.type) {
+              fprintf(stderr, "write to $name not $c.type\n");
+              return SNMP_ERR_WRONGTYPE;
+          }
+          if (var_val_len > sizeof($c.decl)) {
+              fprintf(stderr,"write to $name: bad length\n");
+              return SNMP_ERR_WRONGLENGTH;
+          }
+          break;
+
+        case RESERVE2:
+          size  = var_val_len;
+          value = * ($c.decl *) var_val;
+
+          break;
+
+        case FREE:
+             /* Release any resources that have been allocated */
+          break;
+
+        case ACTION:
+             /*
+              * The variable has been stored in 'value' for you to use,
+              * and you have just been asked to do something with it.
+              * Note that anything done here must be reversable in the UNDO case
+              */
+          break;
+
+        case UNDO:
+             /* Back out any changes made in the ACTION case */
+          break;
+
+        case COMMIT:
+             /*
+              * Things are working well, so it's now safe to make the change
+              * permanently.  Make sure that anything done here can't fail!
+              */
+          break;
+    }
+    return SNMP_ERR_NOERROR;
+}
+@end@
+@end@
+@end@
diff -Naur tomato/release/src/router/snmp/local/mib2c.scalar.conf tomato121/release/src/router/snmp/local/mib2c.scalar.conf
--- tomato/release/src/router/snmp/local/mib2c.scalar.conf	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/local/mib2c.scalar.conf	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,150 @@
+## -*- c -*-
+######################################################################
+## Do the .h file
+######################################################################
+@open ${name}.h@
+/*
+ * Note: this file originally auto-generated by mib2c using
+ *        $Id: mib2c.scalar.conf,v 1.1.2.1 2004/06/20 21:54:45 nikki Exp $
+ */
+#ifndef $name.uc_H
+#define $name.uc_H
+
+/* function declarations */
+void init_$name(void);
+@foreach $i scalar@
+@if $i.settable@
+Netsnmp_Node_Handler do_${i};
+@end@
+@if !$i.settable@
+Netsnmp_Node_Handler get_${i};
+@end@
+@end@
+
+#endif /* $name.uc_H */
+######################################################################
+## Do the .c file
+######################################################################
+@open ${name}.c@
+/*
+ * Note: this file originally auto-generated by mib2c using
+ *        $Id: mib2c.scalar.conf,v 1.1.2.1 2004/06/20 21:54:45 nikki Exp $
+ */
+
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include "${name}.h"
+
+/** Initializes the $name module */
+void
+init_$name(void)
+{
+  @foreach $i scalar@
+    static oid ${i}_oid[] = { $i.commaoid, 0 };
+  @end@
+
+  DEBUGMSGTL(("$name", "Initializing\n"));
+
+  @foreach $i scalar@
+    @if !$i.settable@
+    netsnmp_register_read_only_instance(netsnmp_create_handler_registration
+                                        ("$i",
+                                         get_$i,
+                                         ${i}_oid,
+                                         OID_LENGTH(${i}_oid),
+                                         HANDLER_CAN_RONLY));
+    @end@
+    @if $i.settable@
+    netsnmp_register_instance(netsnmp_create_handler_registration
+                              ("$i",
+                               do_$i,
+                               ${i}_oid,
+                               OID_LENGTH(${i}_oid),
+                               HANDLER_CAN_RWRITE));
+    @end@
+  @end@
+}
+
+@foreach $i scalar@
+int
+@if !$i.settable@
+get_$i(netsnmp_mib_handler *handler,
+@end@
+@if $i.settable@
+do_$i(netsnmp_mib_handler *handler,
+@end@
+                          netsnmp_handler_registration *reginfo,
+                          netsnmp_agent_request_info *reqinfo,
+                          netsnmp_request_info *requests)
+{
+    /* We are never called for a GETNEXT if it's registered as a
+       "instance", as it's "magically" handled for us.  */
+
+    /* a instance handler also only hands us one request at a time, so
+       we don't need to loop over a list of requests; we'll only get one. */
+    
+    switch(reqinfo->mode) {
+
+        case MODE_GET:
+            snmp_set_var_typed_value(requests->requestvb, $i.type, (u_char *) /* XXX: a pointer to the scalar's data */, /* XXX: the length of the data in bytes */);
+            break;
+
+        @if $i.settable@
+        /*
+         * SET REQUEST
+         *
+         * multiple states in the transaction.  See:
+         * http://www.net-snmp.org/tutorial-5/toolkit/mib_module/set-actions.jpg
+         */
+        case MODE_SET_RESERVE1:
+            if (/* XXX: check incoming data in requests->requestvb->val.XXX for failures, like an incorrect type or an illegal value or ... */) {
+                netsnmp_set_request_error(reqinfo, requests, /* XXX: set error code depending on problem (like SNMP_ERR_WRONGTYPE or SNMP_ERR_WRONGVALUE or ... */);
+            }
+            break;
+
+        case MODE_SET_RESERVE2:
+            /* XXX malloc "undo" storage buffer */
+            if (/* XXX if malloc, or whatever, failed: */) {
+                netsnmp_set_request_error(reqinfo, requests, SNMP_ERR_RESOURCESUNAVAILABLE);
+            }
+            break;
+
+        case MODE_SET_FREE:
+            /* XXX: free resources allocated in RESERVE1 and/or
+               RESERVE2.  Something failed somewhere, and the states
+               below won't be called. */
+            break;
+
+        case MODE_SET_ACTION:
+            /* XXX: perform the value change here */
+            if (/* XXX: error? */) {
+                netsnmp_set_request_error(reqinfo, requests, /* some error */);
+            }
+            break;
+
+        case MODE_SET_COMMIT:
+            /* XXX: delete temporary storage */
+            if (/* XXX: error? */) {
+                /* try _really_really_ hard to never get to this point */
+                netsnmp_set_request_error(reqinfo, requests, SNMP_ERR_COMMITFAILED);
+            }
+            break;
+
+        case MODE_SET_UNDO:
+            /* XXX: UNDO and return to previous value for the object */
+            if (/* XXX: error? */) {
+                /* try _really_really_ hard to never get to this point */
+                netsnmp_set_request_error(reqinfo, requests, SNMP_ERR_UNDOFAILED);
+            }
+            break;
+        @end@
+
+        default:
+            /* we should never get here, so this is a really bad error */
+            return SNMP_ERR_GENERR;
+    }
+
+    return SNMP_ERR_NOERROR;
+}
+@end@
diff -Naur tomato/release/src/router/snmp/local/mib2c.vartypes.conf tomato121/release/src/router/snmp/local/mib2c.vartypes.conf
--- tomato/release/src/router/snmp/local/mib2c.vartypes.conf	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/local/mib2c.vartypes.conf	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,104 @@
+# 
+# Define types of data by mib type, and translate into needed C code.
+# 
+#  type:      	 the label in question extracted from the mib.
+#  asnType:   	 the internal type #define we should use for this type.
+#  variable:  	 the name of the variable we're going to use.
+#  variablePtr:  How to get a pointer to the variable above (may be
+#                the same, if variable is also a pointer)
+#  cast:         how to cast from a void * or a char * to a pointer of 
+#                your type.
+#  writeInit:    variable declaration
+#  case:  initialization of the variable to a bogus value.
+#
+#  copy:         copies the previous definition into the current one,
+#                if most of it (or all of it) is the same.
+############################################################################
+type:		OCTETSTR
+asnType:	ASN_OCTET_STR
+variable:	string
+variablePtr:	string
+cast:		char *
+writeInit:	static unsigned char string[SPRINT_MAX_LEN];
+case:	        *string = 0;
+case:	        *var_len = strlen(string);
+case:	        return (unsigned char *) string;
+############################################################################
+type:		INTEGER
+asnType:	ASN_INTEGER
+variable:	long_ret
+variablePtr:	&long_ret
+cast:		long *
+writeInit:	static long *long_ret;
+case:	        long_ret = 0;
+case:	        return (unsigned char *) &long_ret;
+############################################################################
+type:		INTEGER32
+copy:		INTEGER
+############################################################################
+type:		UNSIGNED32
+asnType:	ASN_UNSIGNED
+variable:	ulong_ret
+variablePtr:	&ulong_ret
+cast:		unsigned long *
+writeInit:	static unsigned long *ulong_ret;
+case:	        ulong_ret = 0;
+case:	        return (unsigned char *) &ulong_ret;
+############################################################################
+type:		OBJECTID
+asnType:	ASN_OBJECT_ID
+variable:	objid
+variablePtr:	objid
+cast:		oid *
+writeInit:	static oid *objid;
+case:	        objid[0] = 0;
+case:	        objid[1] = 0;
+case:	        *var_len = 2*sizeof(oid);
+case:	        return (unsigned char *) objid;
+############################################################################
+type:		COUNTER64
+asnType:	ASN_COUNTER64
+variable:	c64
+variablePtr:	&c64
+cast:		struct counter64 *
+writeInit:	struct counter64 *c64;
+case:	        c64.high = 0;
+case:	        c64.low = 0;
+case:	        *var_len = sizeof(c64);
+case:	        return (unsigned char *) &c64;
+############################################################################
+type:		COUNTER
+copy:		INTEGER
+delete:		asnType
+asnType:	ASN_COUNTER
+############################################################################
+type:		NETADDR
+copy:		ASN_OBJECT_ID
+############################################################################
+type:		UINTEGER
+copy:		INTEGER
+delete:		asnType
+asnType:	ASN_UINTEGER
+############################################################################
+type:		IPADDR
+copy:		OCTETSTR
+delete:		asnType
+asnType:	ASN_IPADDRESS
+############################################################################
+type:		BITS
+copy:		OCTETSTR
+############################################################################
+type:		GAUGE
+copy:		INTEGER
+delete:		asnType
+asnType:	ASN_GAUGE
+############################################################################
+type:		OPAQUE
+copy:		OCTETSTR
+delete:		asnType
+asnType:	ASN_OPAQUE
+############################################################################
+type:		TICKS
+copy:		INTEGER
+delete:		asnType
+asnType:	ASN_TIMETICKS
diff -Naur tomato/release/src/router/snmp/local/pass_persisttest tomato121/release/src/router/snmp/local/pass_persisttest
--- tomato/release/src/router/snmp/local/pass_persisttest	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/local/pass_persisttest	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,77 @@
+#!/usr/bin/perl
+
+# Persistant perl script to respond to pass-through smnp requests
+
+# put the following in your snmpd.conf file to call this script:
+#
+# pass_persist .1.3.6.1.4.1.2021.255 /path/to/pass_persisttest
+
+# Forces a buffer flush after every print
+$|=1;
+
+use strict;
+
+my $counter = 0;
+my $place = ".1.3.6.1.4.1.2021.255";
+
+while (<>){
+  if (m!^PING!){
+    print "PONG\n";
+    next;
+  }
+
+  my $cmd = $_;
+  my $req = <>;
+  my $ret;
+  chomp($cmd);
+  chomp($req);
+
+  if ( $cmd eq "getnext" ) {
+    if ($req eq $place) {
+      $ret = "$place.1";
+    } elsif ($req eq "$place.1") {
+      $ret = "$place.2.1";
+    } elsif ($req eq "$place.2.1") {
+      $ret = "$place.2.2";
+    } elsif ($req eq "$place.2.2") {
+      $ret = "$place.3";
+    } elsif ($req eq "$place.3") {
+      $ret = "$place.4";
+    } elsif ($req eq "$place.4") {
+      $ret = "$place.5";
+    } elsif ($req eq "$place.5") {
+      $ret = "$place.6";
+    } else {
+      print "NONE\n";
+      next;
+    }
+  } else {
+    if ($req eq $place) {
+      print "NONE\n";
+      next;
+    } else {
+      $ret = $req;
+    }
+  }
+
+  print "$ret\n";
+
+  if ($ret eq "$place.1") {
+    print "string\nlife the universe and everything\n";
+  } elsif ($ret eq "$place.2.1") {
+    print "integer\n423\n";
+  } elsif ($ret eq "$place.2.2") {
+    print "objectid\n.1.3.6.1.4.42.42.42\n";
+  } elsif ($ret eq "$place.3") {
+    print "timeticks\n363136200\n";
+  } elsif ($ret eq "$place.4") {
+    print "ipaddress\n127.0.0.1\n";
+  } elsif ($ret eq "$place.5") {
+    $counter++;
+    print "counter\n$counter\n";
+  } elsif ($ret eq "$place.6") {
+    print "gauge\n42\n";
+  } else {
+    print  "string\nack... $ret $req\n";
+  }
+}
diff -Naur tomato/release/src/router/snmp/local/passtest tomato121/release/src/router/snmp/local/passtest
--- tomato/release/src/router/snmp/local/passtest	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/local/passtest	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,41 @@
+#!/bin/sh -f
+
+PATH=$path:/bin:/usr/bin:/usr/ucb
+
+PLACE=".1.3.6.1.4.1.2021.255"
+REQ="$2"
+
+if [ "$1" = "-s" ]; then
+  echo $* >> /tmp/passtest.log
+  exit 0
+fi
+
+if [ "$1" = "-n" ]; then
+  case "$REQ" in
+    $PLACE)      RET=$PLACE.1 ;;
+    $PLACE.1)    RET=$PLACE.2.1 ;;
+    $PLACE.2.1)  RET=$PLACE.2.2 ;;
+    $PLACE.2.2)	 RET=$PLACE.3 ;;
+    $PLACE.3)    RET=$PLACE.4 ;;
+    $PLACE.4)    RET=$PLACE.5 ;;
+    $PLACE.5)    RET=$PLACE.6 ;;
+    *)         	 exit 0 ;;
+  esac
+else
+  case "$REQ" in
+    $PLACE)    exit 0 ;;
+    *)         RET=$REQ ;;
+  esac
+fi
+
+echo "$RET"
+case "$RET" in
+  $PLACE.1) echo "string"; echo "life the universe and everything"; exit 0 ;;
+  $PLACE.2.1) echo "integer"; echo "42"; exit 0 ;;
+  $PLACE.2.2) echo "objectid"; echo ".1.3.6.1.4.42.42.42"; exit 0 ;;
+  $PLACE.3) echo "timeticks"; echo "363136200"; exit 0 ;;
+  $PLACE.4) echo "ipaddress"; echo "127.0.0.1" ;;
+  $PLACE.5) echo "counter"; echo "42"; exit 0 ;;
+  $PLACE.6) echo "gauge"; echo "42"; exit 0 ;;
+  *) echo "string"; echo "ack... $RET $REQ"; exit 0 ;;
+esac
diff -Naur tomato/release/src/router/snmp/local/README.mib2c tomato121/release/src/router/snmp/local/README.mib2c
--- tomato/release/src/router/snmp/local/README.mib2c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/local/README.mib2c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,224 @@
+This README describes the ./local/mib2c script.
+
+Author:  Derek Simkowiak
+         dereks@kd-dev.com
+         http://www.kd-dev.com
+         (please mail questions to net-snmp-coders@lists.sourceforge.net,
+         not to the author directly.  Thanks!)
+
+Date:    Wed Jan 20 02:51:06 PST 1999
+-----------------------------------------------------------------------
+mib2c
+
+OVERVIEW
+
+	mib2c is a Perl script that takes a MIB (such as those files found
+in ./mibs/ ) and converts it into C code.  That C code can then be used as a
+"template" to implement your MIB.  Then, when you are done editing the C
+code and recompiling, the UCD-SNMP agent (snmpd) will support your MIB.
+mib2c takes the place of "MIB Compilers" that come with commercial SNMP
+agents.
+
+
+REQUIREMENTS/INSTALLATION
+
+	mib2c requires the SNMP.pm Perl module.  As of this writing the
+latest version of the SNMP.pm module is 1.8.
+
+	The SNMP.pm module can be downloaded from CPAN at 
+
+http://www.cpan.org/modules/by-module/SNMP/
+
+	...the file that you want is probably SNMP-1.8b5.tar.gz .
+If you didn't know that already, most every Perl module can be downloaded
+from CPAN (www.cpan.org).  Follow the installation instructions for the
+module.
+
+	NOTE: If you are running Redhat Linux 5.2 (and perhaps other
+versions), you might get the following errors during the "make test" phase
+of the installation of the SNMP.pm module:
+
+[root@olly SNMP-1.8b5]# make test             # This is the command...
+PERL_DL_NONLAZY=1 /usr/bin/perl -I./blib/arch -I./blib/lib
+-I/usr/lib/perl5/i386-linux/5.00404 -I/usr/lib/perl5 -e 'use Test::Harness
+qw(&runtests $verbose); $verbose=0; runtests @ARGV;' t/*.t
+t/mib...............ok
+t/session...........FAILED tests 7-8
+        Failed 2/14 tests, 85.71% okay
+t/translate.........ok
+Failed Test  Status Wstat Total Fail  Failed  List of failed
+-------------------------------------------------------------------------------
+t/session.t                  14    2  14.29%  7-8
+Failed 1/3 test scripts, 66.67% okay. 2/24 subtests failed, 91.67% okay.
+make: *** [test_dynamic] Error 9
+
+
+	If the "make" went okay, then you can ignore these test failures.
+These indicate you don't have write access to the portions of the mib
+tree that the test script is trying to use.  Please don't email the
+UCD-SNMP list with other errors regarding the SNMP.pm module.
+comp.lang.perl.modules is probably the most appropriate spot to
+discuss problems with the SNMP.pm perl module itself. Interelated
+problems between net-snmp and SNMP could be discussed on the net-snmp
+mailing lists though.
+
+
+USAGE
+
+	mib2c takes one argument: an OID.  It then traces down that OID
+and generates the template C code.  Here is the documentation, from the
+top of the script:
+
+# This program, given an OID reference as an argument, creates some
+# template mib module files to be used with the net-snmp agent.  It is
+# far from perfect and will not generate working modules, but it
+# significantly shortens development time by outlining the basic
+# structure.
+#
+# Its up to you to verify what it does and change the default values
+# it returns.
+#
+# You *must* correct the beginning of the var_XXX() function to
+# correctly determine mib ownership of the incoming request.
+
+
+FINDING YOUR MIB
+
+	Before you can specify the OID for your enterprise/MIB on the
+command line, the script needs to be able to find your MIB so that it can
+read it in and generate template code.  Joe Marzot (gmarzot@nortelnetworks.com)
+tells us:
+--------------------------------------
+you should read (man mib_api). The default behaviour for mib loading
+from within the perl interface uses the environment variables described
+there. You can also override these and explicitly define mibdirs and
+load modules through the perl/SNMP api.
+
+the easiest thing to do is toss the mibs in /usr/local/share/snmp/mibs
+and set the env. var., MIBS, to 'ALL'.
+--------------------------------------
+
+	I recommend following the last two lines of advice.  I simply did
+
+# cp /home/dereks/MY-MIB-FILE.txt /usr/local/share/snmp/mibs/
+# export MIBS=ALL
+
+	...on my Redhat system (with a BASH shell) and it was able to find
+my MIB just fine.
+
+
+EXAMPLES
+
+	Here are some examples from Wes Hardaker (wjhardaker@ucdavis.edu).
+He's using a C shell.  Wes writes:
+--------------------------------------
+Ok, in order to run the thing, you actually need to do something like
+this:
+
+setenv MIBS MY-ITEM-MIB          # assumes csh
+mib2c itemNode
+
+Where, "itemNode" should be a node in the mib tree that you want to
+generate C code for.  Note, pick small pieces not large ones.  Yes, it 
+will generate code for the entire mibII tree if you ask it to, in one
+very large mib file.
+
+Examples:
+
+% mib2c interfaces
+outputing to interfaces.c and interfaces.h ...
+  depth: 3
+  Number of Lines Created:
+178 interfaces.c
+84 interfaces.h
+262 total
+Done.
+
+% mib2c mib-2                             # Don't ever do this.
+outputing to mib-2.c and mib-2.h ...
+  depth: 5
+  Number of Lines Created:
+2783 mib-2.c
+617 mib-2.h
+3400 total
+Done.
+
+It may have some sorting problems with multiple level mib tree
+branches being generated into one piece of code (reorder the .h file
+structure to be in OID lexical order if needed).
+--------------------------------------
+
+WHAT TO DO WITH THE CODE THAT GETS GENERATED
+
+	You will need to edit your generated code to work with your
+hardware.  For instance, if your MIB is for a refrigerator, you will need
+to write the code that talks to the refridgerator (through the serial
+port, maybe?) in Fridge Protocol.
+
+	See the files in ./agent/mibgroup/examples/ and
+./agent/mibgroup/dummy/ for heavily-commented example code.  Don't ask me
+questions about this stuff--I'm just now figuring it out myself...
+
+	[NOTE: If anyone out there has tips about necessary options to
+./configure, or re-compiling snmpd with custom MIB support, please add
+them here...]
+
+WARNING
+
+	As of this writing, the mib2c compiler is a bit outdated and needs
+some work.  Wes writes:
+--------------------------------------
+It already needs changing, because the architecture has changed in the 
+3.6 line (though its backwards compatible, I'd prefer to generate
+code from newer models than older ones).
+--------------------------------------
+	When I asked him to elaborate on the new 3.6 archictecture, all I
+got was:
+--------------------------------------
+It hopefully will be in the new documentation about mib module api
+that Dave Shield is putting together (which is also currently wrong,
+for that matter)...
+--------------------------------------
+	...so I don't know what the hell he's talking about.
+
+
+SOME ERRORS AND THEIR MEANING
+
+	If you get a large number of errors that look like:
+
+[...]
+unknown type:  INTEGER for prIndex
+unknown type:  OCTETSTR for prNames
+unknown type:  INTEGER for prMin
+[...]
+
+	...then you are trying to use an old version of the mib2c script
+that does not support the SNMP.pm module version 1.8.  Get the latest
+version of the script.
+
+	If you get the error 
+
+Couldn't find mib reference: myEnterpriseOID
+
+	...when you know that it should be finding your MIB file(s), then
+you forgot to put the word "END" at the very end of your MIB.  (Uh...I'm
+not speaking from experience here.  Really.)
+
+ACKNOWLEGMENTS
+
+	Many thanks to the people on the UCD-SNMP mailing list
+(net-snmp-users@lists.sourceforge.net).  In particular, many thanks to
+
+Wes Hardaker <wjhardaker@ucdavis.edu>
+Ken McNamara <conmara@tcon.net>
+Joe Marzot <gmarzot@nortelnetworks.com>
+
+	...since about half this document is just cut'n'pasted from emails
+they sent me.
+
+	Good luck with your project.
+
+Derek Simkowiak
+dereks@kd-dev.com
+http://www.kd-dev.com
+
diff -Naur tomato/release/src/router/snmp/local/snmpcheck.def tomato121/release/src/router/snmp/local/snmpcheck.def
--- tomato/release/src/router/snmp/local/snmpcheck.def	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/local/snmpcheck.def	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,1224 @@
+#!/usr/local/bin/perl -w
+
+use strict 'refs';
+require Net::Ping;
+require Term::ReadKey;
+
+#defaults
+$mibident=".ERRORNAME";
+$miberrflag=".ERRORFLAG";
+$miberrmsg=".ERRORMSG";
+$mibfix=".ERRORFIX";
+$mibheadall=".EXTENSIBLEDOTMIB";
+$mibclearcache="$mibheadall.VERSIONMIBNUM.VERCLEARCACHE";
+$mibrestartagent="$mibheadall.VERSIONMIBNUM.VERRESTARTAGENT";
+$mibupdateconfig="$mibheadall.VERSIONMIBNUM.VERUPDATECONFIG";
+%miblist=(    '.PROCMIBNUM.1' => 'processes',
+	      '.SHELLMIBNUM.1' => 'scripts',
+	      '.MEMMIBNUM' => 'swap space',
+	      '.DISKMIBNUM.1' => 'disks',
+	      '.LOADAVEMIBNUM.1' => 'load-average',
+	      '.ERRORMIBNUM' => 'snmp-agent-errors');
+@fixitlist=('.PROCMIBNUM.1','.SHELLMIBNUM.1');
+%mibchecklist = ('.PROCMIBNUM.1' => 1,
+		 '.SHELLMIBNUM.1' => 1,
+		 '.MEMMIBNUM' => 1,
+		 '.DISKMIBNUM.1' => 1,
+		 '.LOADAVEMIBNUM.1' => 1,
+		 '.ERRORMIBNUM' => 1);
+$errlog="/net/tyfon/1/OV/log/ece-log";
+$default_get_args = "-v 1 %s private";
+$default_set_args = "-v 1 %s private";
+$andlog=0;
+$snmppath="BINDIR";
+$eraseline="                                                                           \r";
+$fixit=0;  # this should be 0 not -1, but is necissary till getc(STDIN) works
+$rescanWhen = 300;
+$display = $ENV{'DISPLAY'};
+$hidden = 0;
+$pinghost = 0;
+$loglevel = 1;
+$logwindowatstart = 0;
+$numloglevels = 5;
+$dontstart = 0;
+$raiseonnew = 1;
+
+#
+#  Mib Package:  Each mib has a mib number attached and can check/fix itself;
+#
+
+package Mib;
+
+# @ISA = qw( Host );
+
+sub new {
+    my $tmp = shift;
+    my $self = {};
+    $self->{'HostId'} = shift;
+    $self->{'Host'} = $self->{'HostId'}->{'Name'};
+    $_ = shift;
+    $self->{'Mib'} = $_;
+    print "test: $_\n";
+    ($self->{'MibSuffix'}) = /(\.[0-9]+)$/;
+    if (!defined($mibchecklist{$self->{'MibSuffix'}})) {
+	($self->{'MibSuffix'}) = /(\.[0-9]+\.1)$/;
+    }
+    print "suff: $self->{'MibSuffix'}\n";
+    $self->{'MibDesc'} = shift;
+    $self->{'Frame'} = shift;
+    bless $self;
+}
+
+sub getmibnum {
+    my $self = shift;
+    return ($self->{'Mib'});
+}
+
+sub snmp_walk {
+    my $self = shift;
+    $self->{'Frame'}->toplevel->Busy() if ($::display);
+    my $mib = shift;
+    my $cmd = "$::snmppath/snmpwalk " . sprintf($::default_get_args, $self->{'Host'}) . " $mib|";
+    ::addToLog("running:  $cmd",5);
+    open(OUT,"$cmd");
+    my $outcount = 0;
+    my @result = [];
+    while (<OUT>) {
+	$result[$outcount] = $_;
+	chop;
+	::addToLog("snmpwalk:  $_",5);
+	if ($::display) {
+	    $self->{'Frame'}->toplevel->update;
+	}
+	$outcount++;
+    }
+    close(OUT);
+    for($i=0; $i <= $#result; $i++) {
+	$result[$i] =~ s/ Hex:.*$//g;
+	$result[$i] =~ s/\"//g;
+    }
+    $self->{'Frame'}->toplevel->Unbusy() if ($::display);
+    if ($result[0] =~ /No Response/) {
+	$self->{'HostId'}->hostdown;
+	splice(@result,0);
+    }
+    return @result;
+}
+
+sub check {
+    my $self = shift;
+    my $tmp = [];
+    if ($::mibchecklist{$self->{'MibSuffix'}} != 1) {
+	return @{$tmp};
+    }
+    if (! $::display) {
+	printf "%sChecking %s: %s\r", $::eraseline,$self->{'Host'},
+	$self->{'MibDesc'};
+    }
+    my @walkout = $self->snmp_walk("$self->{'Mib'}$::miberrflag");
+    while ($#walkout > -1) {
+	$_ = shift @walkout;
+	($result) = /= ([0-9]+)/;
+	if (defined($result) && $result > 0)
+	{
+	    ($mibloc) = /\.([0-9]+) /;
+	    push(@{$tmp},FixProblem::new("",$self->{'HostId'}, $self->{'Mib'},
+					 $self->{'MibDesc'},
+					 $mibloc,$self->{'Frame'}));
+	    if (! $::display) {
+		printf("%s%-8.8s  %-12.12s  %2d -- %-37.37s",$::eraseline,
+		       $self->{'Host'},$tmp->[0]->{'ErrName'},
+		       $result,$tmp->[0]->{'ErrMsg'});
+		if ($tmp->[0]->canfix() && $::fixit == 0) {
+		    printf(" / Fix? ");
+		    $ans = Term::ReadKey::ReadKey(0);
+		    if ("$ans" eq "y" || "$ans" eq "Y") {
+			printf("\b\b\b\b\b\b\b\b");
+			$tmp->[0]->fix($mibloc);     # fix now if curses
+		    } else {
+			print $ans;
+			printf("\nChecking %s: %s\r",$self->{'Host'}, 
+			       $self->{'MibDesc'});
+		    }
+		} elsif ($::fixit > 0) {
+		    $tmp->[0]->fix($mibloc);     # fix now if curses
+		}
+		shift @{$tmp};
+	    }
+	}
+    }
+    return(@{$tmp});
+}
+
+#
+#  Problem Package: A problem comes into existence when found.  It may
+#  or may not know how to fix itself (Problem/FixProblem).
+#
+
+package Problem;
+
+@ISA = qw( Mib );
+
+sub snmp_get {
+    my $self = shift;
+    $self->{'Frame'}->toplevel->Busy() if ($::display);
+    my $mib = shift;
+    my $args = sprintf($::default_get_args, $self->{'Host'});
+    $_ = `$::snmppath/snmpget $args $mib`;
+    my ($result) = /= (.*)$/;
+    if (!defined($result) || $result =~ /No Response/) {
+	$self->{'HostId'}->hostdown;
+	$result = "";
+    }
+    $result =~ s/\"//g;
+    $result =~ s/ Hex:.*$//g;
+    ::addToLog("snmpget:  $_",5);
+    $self->{'Frame'}->toplevel->Unbusy() if ($::display);
+    return $result;
+}
+
+sub snmp_set {
+    my $self = shift;
+    $self->{'Frame'}->toplevel->Busy() if ($::display);
+    my $mib = shift;
+    my $args = sprint($::default_set_args, $self->{'Host'});
+    $_ = `$::snmppath/snmpset $args $mib`;
+    my ($result) = /= (.*)$/;
+    $result = "" if (!defined($result));
+    $result =~ s/\"//g;
+    ::addToLog("snmpset:  $_",5);
+    $self->{'Frame'}->toplevel->Unbusy() if ($::display);
+    return $result;
+}
+
+sub new{
+    my $tmp = shift;
+    my $hostId = shift;
+    my $mib = shift;
+    my $mibname = shift;
+    my $self = new Mib ($hostId,$mib,$mibname);
+    $self->{'MibLocation'} = shift;
+    $tmp = shift;
+    if ($::display) {
+	$self->{'Frame'} = $tmp->Frame();
+    }
+    bless $self;
+    $self->{'ErrName'} = 
+	$self->snmp_get("$self->{'Mib'}$::mibident.$self->{'MibLocation'}");
+    $self->{'ErrMsg'} = 
+	$self->snmp_get("$self->{'Mib'}$::miberrmsg.$self->{'MibLocation'}");
+    if (exists $self->{'HostId'}->{'Down'}) {
+	return $self;
+    }
+    if ($::display) {
+	$self->{'Frame'}->pack();
+	$self->{'Desc'} = 
+	    $self->{'Frame'}->Button(-text => sprintf("%-12.12s %-42.42s",
+						     $self->{'ErrName'},
+						     $self->{'ErrMsg'}),
+				     -font => "6x13",
+				     -highlightcolor => "#ffffff",
+				     -borderwidth => 0,
+				     -relief => "flat",
+				     -bd => 0, -padx => 0, -pady => 0,
+				     -activeforeground => 'red',
+				     -activebackground => '#C9C9C9',
+				     -background => '#E0C9C9',
+				     -command => [\&selectme,$self]);
+	$self->{'Desc'}->pack(-fill => "x",-expand => 1,-side=>"left"); # 
+	if ($::raiseonnew) {
+	    $tmp->toplevel->deiconify();
+	    $tmp->toplevel->raise();
+	}
+	::addToLog("problem found:  $self->{'Host'}\t$self->{'ErrName'}\t$self->{'ErrMsg'}",2);
+    }
+    bless $self;
+    return $self;
+}
+
+sub haveseen {
+    my $self = shift;
+    $self->{'Desc'}->configure(-background => '#C9C9C9');
+}
+
+sub selectme {
+    my $self = shift;
+    if ($main::hidden) {
+      main::makeappear();
+	return;
+    }
+    if (exists $self->{'Selected'}) {
+      main::deselectitem($self);
+	delete $self->{'Selected'};
+    } else {
+      main::selectitem($self);
+	$self->{'Desc'}->configure(-foreground => "red");
+	$self->{'Selected'} = 1;
+    }
+    $self->haveseen();
+}
+
+sub deselectme {
+    my $self = shift;
+    $self->{'Desc'}->configure(-foreground => "black");
+    delete $self->{'Selected'};
+}
+
+sub check {
+    my $self = shift;
+    if ($::display) {
+      main::setstatus("Checking $self->{'Host'} -- $self->{'ErrName'}");
+    }
+    else {
+	printf("Checking \b\b\b\b\b\b\b\b\b");
+    }
+    $result = $self->snmp_get("$self->{'Mib'}$::miberrflag.$self->{'MibLocation'}");
+    if (exists $self->{'HostId'}->{'Down'}) {
+	return 0;
+    }
+    if ($result == 0) {
+	$self->deleteme();
+    }
+  main::setstatus("idle");
+    return $result;
+}
+
+sub fix {
+# Don't fix and/or unable to
+    my $self = shift;
+  main::setmsg("Don't know how to fix $self->{'ErrName'}");
+}
+
+sub rsh {
+    my $self = shift;
+    if ($::display) {
+	system "xterm -e rsh $self->{'HostId'}->{'Name'} -l root &";
+    }
+}
+
+sub deleteme {
+    my $self = shift;
+    my $host = $self->{'HostId'};
+    $host->deleteProb($self);
+}
+
+sub deleteself {
+    my $self = shift;
+    if ($::display) {
+	if ($self->{'Selected'}) {
+	  main::deselectitem($self);
+	}
+	$self->{'Desc'}->destroy();
+	$self->{'Frame'}->destroy();
+    }
+}
+
+sub canfix {
+    return 0;
+}
+
+package FixProblem;
+
+@ISA = qw( Problem );
+
+sub new {
+    my $tmp = shift;
+    my $hostId = shift;
+    my $mib = shift;
+    my $mibdesc = shift;
+    my $mibloc = shift;
+    my $frame = shift;
+    my $self = new Problem ($hostId,$mib,$mibdesc,$mibloc,$frame);
+    $_ = $mib;
+    ($mymib) = /(\.[0-9]+)$/;
+    if (grep(/$mymib/,@::fixitlist) && ($::fixit >= 0)) {
+	bless $self;		# Make it a FixProblem if fixable
+    }
+    return $self;               # else just return a Problem
+}
+
+sub canfix {
+    return 1;
+}
+
+sub fix {
+    my $self = shift;
+    my $mibloc = shift;
+    if ($::display) {
+      main::setstatus(sprintf("Fixing %s:  %s",
+			      $self->{'Host'}, $self->{'ErrName'}));
+    } 
+    else {
+	printf(" / Fixing...\b\b\b\b\b\b\b\b\b");
+    }
+    $self->snmp_set("$self->{'Mib'}$::mibfix.$self->{'MibLocation'} integer 1");
+    $self->snmp_set("$::mibclearcache integer 1");
+    if (exists $self->{'HostId'}->{'Down'}) {
+	return;
+    }
+    if ($::display) {
+	main::setstatus("Sleeping");
+    }
+    else {
+	printf("Sleeping \b\b\b\b\b\b\b\b\b");
+    }
+    sleep(2);
+    if ($::display) {
+	main::setstatus("Checking");
+    }
+    else {
+	printf("Checking\b\b\b\b\b\b\b\b");
+    }
+    if ($self->check() != 0) {
+	if (! $::display) {
+	    printf("*failed*  \n");
+	} else {
+	    main::setmsg("Failed to fix $self->{'ErrName'} on $self->{'Host'}");
+	}
+    }
+    else {
+	if ($::display) {
+#	    $self->{'HostId'}->deleteProb($self);
+	    main::setmsg("Fixed $self->{'ErrName'} on $self->{'Host'}");
+	} 
+	else {
+	    printf("Fixed     \n");
+	}
+    }
+  main::setstatus("Idle");
+}
+
+#
+#  Host Package:  Each object is a host which can check itself and display
+#                 the results
+#
+package Host;
+
+sub mibsort {
+    $_ = $a;
+    ($av) = /\.([0-9]+)/;
+    $_ = $b;
+    ($bv) = /\.([0-9]+)/;
+    return $av <=> $bv;
+}
+
+sub new {
+    my $self = {};
+    my $tmp = shift;
+    $self->{'Name'} = shift;
+    $self->{'Host'} = $self->{'Name'};
+    $self->{'Mibs'} = [];
+    $self->{'Problems'} = [];
+    bless $self;
+    if ($::display) {
+	$self->{'MainFrame'} = $::HostFrame->Frame();
+	if (!$::hidden) {
+	    $self->{'MainFrame'}->configure(-relief =>"sunken",-borderwidth=>2);
+	}
+	$self->{'ProbFrame'} = $self->{'MainFrame'}->Frame();
+	$self->{'hostlabel'} = 
+	    $self->{'MainFrame'}->Button(-text => sprintf("%-9.9s",
+							    $self->{'Name'}),
+					 -bd => 0, -padx => 0, -pady => 0,
+					 -command =>[\&selectme,$self],
+					 -activeforeground => 'red',
+					 -activebackground => '#C9C9C9',
+					 -width => 9,
+					 -anchor => "w",
+					 -relief => "flat");
+	$self->{'hostlabel'}->pack(-side=>"left",-ipadx=>1,
+				   -padx=> 1,-pady =>1);
+	$self->{'ProbFrame'}->pack(-side=>"left",-ipadx=>1,
+				   -padx=> 1,-pady =>1);
+	$self->{'MainFrame'}->pack( #-padx => 2,-pady =>2, 
+				   -fill => "x", -expand => 1);
+    } 
+    foreach $mibx ( sort mibsort keys(%::miblist) ) {
+	push(@{$self->{'Mibs'}},
+	     new Mib ($self,"$::mibheadall$mibx",$::miblist{$mibx},
+		      $self->{'ProbFrame'}));
+    }
+    return $self;
+}
+
+sub rsh {
+    my $self = shift;
+    if ($::display) {
+	system "xterm -e rsh $self->{'Name'} -l root &";
+    }
+}
+
+sub selectme {
+    my $self = shift;
+    if ($main::hidden) {
+      main::makeappear();
+	return;
+    }
+    if (exists $self->{'Selected'}) {
+      main::deselectitem($self);
+	delete $self->{'Selected'};
+    } else {
+      main::selectitem($self);
+	$self->{'hostlabel'}->configure(-foreground => "red");
+	$self->{'Selected'} = 1;
+    }
+}
+
+sub deselectme {
+    my $self = shift;
+    $self->{'hostlabel'}->configure(-foreground => "black");
+    delete $self->{'Selected'};
+}
+
+sub fix {
+    my $self = shift;
+    if (! exists $self->{'Down'}) {
+	foreach $i (@{$self->{'Problems'}}) {
+	    if ($i->canfix() && ref($i) ne Host) {
+		$i->fix();
+	    }
+	}
+    }
+}
+
+sub seenall {
+    my $self = shift;
+    foreach $i (@{$self->{'Problems'}}) {
+	if (ref($i) ne Host) {
+	    $i->haveseen();
+	}
+    }
+}
+
+sub canfix {
+    return 1;
+}
+
+sub hostdown {
+    my $self = shift;
+    $self->deleteProbs();
+    push(@{$self->{'Problems'}},$self);
+    $self->{'Down'} = 1;
+    if ($::display) {
+	if (!exists $self->{'hostlabel'}) {
+	    $self->{'hostlabel'} = 
+		$self->{'MainFrame'}->Button(-text => sprintf("%-9.9s",
+							      $self->{'Name'}),
+					     -bd => 0, -padx => 0, -pady => 0,
+					     -command =>[\&selectme,$self],
+					     -activeforeground => 'red',
+					     -activebackground => '#C9C9C9',
+					     -width => 9,
+					     -anchor => "w",
+					     -relief => "flat");
+	}
+	::addToLog("$self->{'Name'} is down",2);
+	$self->{'hostlabel'}->configure(-text => 
+					sprintf("%-9.9s down",$self->{'Name'}),
+					-width => 14);
+    }
+}
+
+sub check {
+    my $self = shift;
+    $self->{'noDelete'} = 1;
+    $self->deleteProbs();
+    delete $self->{'noDelete'};
+    if ($::display) {
+	$self->{'hostlabel'}->configure(-text => $self->{'Name'},-width=>9);
+    }
+    delete $self->{'Down'};
+  main::setstatus("pinging $self->{'Name'}");
+    if (!($::pinghost) || Net::Ping::pingecho($self->{'Name'},2)) {
+	foreach $i (@{$self->{'Mibs'}}) {
+	    if (ref($i) ne Mib) {
+		print "$i is a ref($i) not a Mib\n";
+	    } else {
+	      main::setstatus("Checking $self->{'Name'}:  " . $i->{'MibDesc'});
+		push(@{$self->{'Problems'}},$i->check());
+	    }
+	    if (exists $self->{'Down'}) {
+		last;
+	    }
+	}
+    } else {
+	$self->hostdown();
+    }
+  main::setstatus("Idle");
+    if ($#{$self->{'Problems'}} == -1) {
+	$self->deleteme();
+    }
+}
+
+sub deleteme {
+    my $self = shift;
+    if ($self->{'Selected'}) {
+      main::deselectitem($self);
+    }
+    $self->deleteProbs();
+    if ($::display) {
+	$self->{'hostlabel'}->destroy();
+	$self->{'ProbFrame'}->destroy();
+	my $top = $self->{'MainFrame'}->toplevel;
+	$self->{'MainFrame'}->destroy();
+	$top->update;
+    }
+  main::deletehost($self->{'Name'});
+}
+
+sub deleteProbs {
+    my $self = shift;
+    foreach $i (@{$self->{'Problems'}}) {
+	if (ref($i) eq Host) {
+	    delete $self->{'Problems'};
+	    return;
+	}
+	if (ref($i) ne Problem && ref($i) ne FixProblem) {
+	    print "i:  $i is a ", ref($i), "\n";
+	    next;
+	}
+	$self->deleteProb($i);
+    }
+}
+
+sub deleteProb {
+    my $self = shift;
+    my $child = shift;
+    for ($k = 0; $k <= $#{$self->{'Problems'}}; $k++) {
+	if (ref($self->{'Problems'}->[$k]) eq Problem ||
+	    ref($self->{'Problems'}->[$k]) eq FixProblem ) {
+	    if ($self->{'Problems'}->[$k]->{'Mib'} eq $child->{'Mib'} && 
+	    $self->{'Problems'}->[$k]->{'MibLocation'} eq
+	    $child->{'MibLocation'}) {
+		splice(@{$self->{'Problems'}},$k,1);
+		$child->deleteself();
+		if ($#{$self->{'Problems'}} == -1 && 
+		    !exists $self->{'noDelete'}) {
+		    $self->deleteme();
+		}
+		last;
+	    }
+	} else {
+	    print "    not: ",$self->{'Problems'}->[$k],"/",
+	    ref($self->{'Problems'}->[$k]),"\n";
+	}
+    }
+}
+
+package main;
+
+#
+# Read arguments
+#
+
+if ($#ARGV != -1) {
+    while ($#ARGV >= 0 && $ARGV[0] =~ /^-/) {
+	$_ = shift;
+	$andlog = 1 if (/^-a/);
+	$dontstart = 1 if (/^-d/);
+	$fixit = -1 if (/^-n/);
+	$fixit = 1 if (/^-y/);
+	$display = 0 if (/^-x/);
+	$pinghost = 1 if (/^-p/);
+	$hidden = 1 if (/^-H/);
+	$loglevel = shift if (/^-V/);
+	$logwindowatstart = 1 if (/^-L/);
+	&display_help() if (/^-h/);
+	&setmibchecklist(@fixitlist) if (/^-f/);
+    }
+}
+
+#
+# If necessary check the ece-log file for problems
+#
+
+if (($andlog || $#ARGV == -1) && !$dontstart) {
+    open(LOG,$errlog);
+    while (<LOG>) {
+	@fields = split;
+	@tmp = grep(/$fields[0]/,@ARGV);
+	if ($#tmp == -1) { #  && $fields[1] ne "down") {
+	    $ARGV[$#ARGV + 1] = $fields[0];
+	}
+    }
+    close(LOG);
+}
+
+#
+# Check all the found hosts 
+#
+
+if ($display) {
+    use Tk;
+#    $tk_strictMotif = 1;
+    $top = MainWindow->new();
+    $top->bind('all',"<Control-q>",[\&quit]);
+    $top->bind('all',"<Control-h>",[\&makehidden]);
+    $top->bind('all',"<Control-s>",[\&seenall]);
+    $top->bind('all',"<Control-f>",[\&fixall]);
+     $top->option('add','*highlightThickness','0');        #wish this worked
+#     $top->option('add','*highlightbackground','#C9C9C9');
+     $top->option('add','*background','#C9C9C9');
+     $top->option('add','*font','6x13');
+    $HostFrame = $top->Frame();
+    $MenuFrame = $top->Frame(-relief => "raised",-borderwidth => 2);
+    $MenuFrame->pack(-fill => "x",-expand => 1);
+    $statusBar = $top->Frame(-relief => "raised",-borderwidth => 2);
+    $status = $statusBar->Label(-text => "initializing",-anchor =>"e");
+    $statusl = $statusBar->Label(-text => "Status:  ", -anchor => "w");
+    $msgBar = $top->Frame(-relief => "raised",-borderwidth => 2);
+    $msg = $msgBar->Label(-text => "",-anchor =>"e");
+    $msgl = $msgBar->Label(-text => "Note:  ", -anchor => "w");
+    
+    $botFrame = $top->Frame();
+    $butFrame = $top->Frame();
+    $entryhost = "";
+    $NewHost = $botFrame->Entry(-textvariable => \$entryhost,-width=>20,
+				-relief => "sunken");
+    $NewHost->bind("<Return>",sub {newHost("$entryhost");
+			       $NewHost->delete(0,length($entryhost));});
+    $BotLabel = $botFrame->Label(-text => "Check New Host:  ",
+			    -anchor => "w");
+    $CmdsMenuBut = $MenuFrame->Menubutton(-text => "Cmds");
+    $CmdsMenu = $CmdsMenuBut->Menu(-tearoff => 1);
+    $CmdsMenuBut->configure(-menu => $CmdsMenu);
+    $CmdsMenuBut->pack(-side => "left");
+    $CmdsMenuBut->command(-label => "Check Hosts", -command => [\&rescanhosts]);
+    $CmdsMenuBut->command(-label => "Check Log", -command => [\&scanlog]);
+    $CmdsMenuBut->command(-label => "Fix All", -command => [\&fixall],
+			  -accelerator => "Ctrl-f");
+    $CmdsMenuBut->command(-label => "Seen All", -command => [\&seenall],
+			  -accelerator => "Ctrl-s");
+    $CmdsMenuBut->separator();
+    $CmdsMenuBut->command(-label => "Hide", -command => [\&makehidden],
+			  -accelerator => "Ctrl-h");
+    $CmdsMenuBut->command(-label => "Quit", -command => [\&quit],
+			  -accelerator => "Ctrl-q");
+    $PrefsMenuBut = $MenuFrame->Menubutton(-text => "Prefs");
+    $PrefsMenu = $PrefsMenuBut->Menu(-tearoff => 1);
+    $PrefsMenuBut->configure(-menu => $PrefsMenu);
+    $PrefsMenuBut->pack(-side => "left");
+    $PrefsMenuBut->cascade(-label => "Rescan");
+    $RescanPrefsBut = $PrefsMenu->Menu();
+    $PrefsMenuBut->entryconfigure("Rescan",-menu => $RescanPrefsBut);
+    $AutoRescan = 1;
+    if ($AutoRescan) {
+      $afterId = Tk::after($rescanWhen*1000,[\&autorescan]);
+    }
+    $RescanPrefsBut->checkbutton(-label =>"Auto Rescan",
+			       -variable =>\$AutoRescan,
+			       -command => sub {if ($AutoRescan) {
+				   $afterId = 
+				     Tk::after($rescanWhen*1000,[\&autorescan])
+				   } else {
+				     Tk::after("cancel",$afterId);
+				   }});
+    $AutoCheckLog = 1;
+    $RescanPrefsBut->checkbutton(-label =>"Checks Log",
+			       -variable =>\$AutoCheckLog);
+    $AutoCheckHosts = 0;
+    $RescanPrefsBut->checkbutton(-label =>"Checks Hosts",
+			       -variable =>\$AutoCheckHosts);
+    $RescanWhenHidden = 1;
+    $RescanPrefsBut->checkbutton(-label =>"Only When Hidden",
+			       -variable =>\$RescanWhenHidden);
+
+    $RescanPrefsBut->checkbutton(-label =>"Pop forward with new",
+			       -variable =>\$raiseonnew);
+
+    $PrefsMenuBut->cascade(-label => "Log Verbosity");
+    $LogVerbBut = $PrefsMenu->Menu();
+    $PrefsMenuBut->entryconfigure("Log Verbosity",
+				  -menu => $LogVerbBut);
+    for ($i=1; $i <= $numloglevels; $i++) {
+	$LogVerbBut->radiobutton(-label => "$i", -variable => \$loglevel, 
+				 -value => $i);
+    }
+
+    $PrefsMenuBut->cascade(-label => "Check For");
+    $CheckForBut = $PrefsMenu->Menu();
+    $PrefsMenuBut->entryconfigure("Check For",
+				  -menu => $CheckForBut);
+    $CheckForBut->command(-label => "Fixable Problems", 
+			  -command => [\&setmibchecklist,@fixitlist]);
+    $CheckForBut->command(-label => "Everything", 
+			  -command => [\&setmibchecklist,keys(%miblist)]);
+    $CheckForBut->separator();
+    foreach $i ( sort mibsort keys(%::mibchecklist) ) {
+	$CheckForBut->checkbutton(-label => $miblist{$i}, 
+				  -variable => \$mibchecklist{$i});
+    }
+
+    $PrefsMenuBut->checkbutton(-label => "Ping Host First", 
+			       -variable => \$pinghost);
+
+    # Agent control
+
+    $agentMenuBut = $MenuFrame->Menubutton(-text => "Agent-Control");
+    $agentMenu = $agentMenuBut->Menu(-tearoff => 1);
+    $agentMenuBut->configure(-menu => $agentMenu);
+    $agentMenuBut->pack(-side => "left");
+    $agentMenuBut->command(-label => "Re-read Configuration", 
+			   -command => [sub {if ($selected) { $top->Busy(); 
+							      my $args = sprint($::default_get_args, $selected->{'Host'});
+$_ = `$::snmppath/snmpset $args $mibupdateconfig i 1`; $top->Unbusy();}}]);
+    $agentMenuBut->command(-label => "Clear Exec Cache", 
+			   -command => [sub {if ($selected) { $top->Busy();
+							      my $args = sprint($::default_get_args, $selected->{'Host'});
+$_ = `$::snmppath/snmpset $args $mibclearcache i 1`; $top->Unbusy();}}]);
+    $agentMenuBut->separator();
+    $agentMenuBut->command(-label => "Re-start Agent", 
+			   -command => [sub {if ($selected) { $top->Busy(); 
+							      my $args = sprint($::default_get_args, $selected->{'Host'});
+$_ = `$::snmppath/snmpset $args $mibrestartagent i 1`; $top->Unbusy();} }]);
+
+    # set up remote commands
+
+    $remoteMenuBut = $MenuFrame->Menubutton(-text => "Remote-Info");
+    $remoteMenu = $remoteMenuBut->Menu(-tearoff => 1);
+    $remoteMenuBut->configure(-menu => $remoteMenu);
+    $remoteMenuBut->pack(-side => "left");
+    $remoteMenuBut->command(-label => "Load-Av", -command => [\&remote_load]);
+    $remoteMenuBut->separator();
+    $remoteMenuBut->command(-label => "top", -command => [\&remote_cmd,"top"]);
+    $remoteMenuBut->command(-label => "mailq", -command => [\&remote_cmd,"mailq"]);
+    $remoteMenuBut->command(-label => "ps", -command => [\&remote_cmd,"ps"]);
+    $remoteMenuBut->command(-label => "conf", -command => [\&remote_cmd,"conf"]);
+
+    # set up log file menu
+    $logFileMenuBut = $MenuFrame->Menubutton(-text => "Log");
+    $logFileMenu = $logFileMenuBut->Menu(-tearoff => 1);
+    $logFileMenuBut->configure(-menu => $logFileMenu);
+    $logFileMenuBut->pack(-side => "left");
+    $logFileMenuBut->command(-label => "show log", -command => [\&displayLog]);
+    $logFileMenuBut->command(-label => "clear log", -command => [\&clearLog]);
+    $logFileMenuBut->separator();
+    $logFileMenuBut->command(-label => "show Tyfon's log", -command => [\&displayTyfon]);
+
+
+    # set up status bar
+
+    $statusl->pack(-fill => "x", -expand => 1, -side =>"left");
+    $status->pack(-fill => "x", -expand => 1, -side =>"left");
+    $msgl->pack(-fill => "x", -expand => 1, -side => "left");
+    $msg->pack(-fill => "x", -expand => 1, -side => "left");
+    $statusBar->pack(-fill => "x", -expand => 1);
+    $msgBar->pack(-fill => "x", -expand => 1);
+    $HostFrame->pack(-fill => "x",-expand => 1);
+    $butFrame->pack(-fill => "x",-expand => 1);
+    $botFrame->pack(-fill => "x",-expand => 1);
+    $FixBut = $butFrame->Button(-text => "Fix",-command=>[sub{print "hi\n"}],
+				-state => "disabled");
+    $FixBut->pack(-side => "left",-padx => 4,-pady => 2,-ipadx => 2,
+		   -ipady => 2);
+    $RshBut = $butFrame->Button(-text => "Rsh",-command=>[sub{print "hi\n"}],
+				-state => "disabled");
+    $RshBut->pack(-side => "left",-padx => 4,-pady => 2,-ipadx => 2,
+		   -ipady => 2);
+    $DelBut = $butFrame->Button(-text => "Del",
+				 -state => "disabled");
+    $DelBut->pack(-side => "left",-padx => 4,-pady => 2,-ipadx => 2,
+		   -ipady => 2);
+    $ChkBut = $butFrame->Button(-text => "Chk",
+				 -state => "disabled");
+    $ChkBut->pack(-side => "left",-padx => 4,-pady => 2,-ipadx => 2,
+		   -ipady => 2);
+    $BotLabel->pack(-fill => "x",-expand => 1,-side=>"left");
+    $NewHost->pack(-side=>"left");
+    &makehidden() if ($hidden);
+    $top->update();
+
+    # generate log window, but tell it not to create display 
+    $logwindow = MainWindow->new;
+    $logwindow->option('add','*highlightThickness','0');        #wish this worked
+#     $logwindow->option('add','*highlightbackground','#C9C9C9');
+    $logwindow->option('add','*background','#C9C9C9');
+    $logwindow->option('add','*font','6x13');
+
+    $logbuttons = $logwindow->Frame;
+    $logbuttons->pack(-side => 'bottom', -expand => 1, -fill => 'x');
+    $logclose = $logbuttons->Button(-text => 'Close', 
+				 -command => ['withdraw',$logwindow]);
+    $logclose->pack(-side => 'left', -expand => 1);
+
+    $logtext = $logwindow->Text(-height => 40, -setgrid => 1);
+    $logtext->pack(-side => 'left', -fill => 'both', -expand => 1);
+    $logscroll = $logwindow->Scrollbar(-command => ['yview',$logtext]);
+    $logscroll->pack(-side => 'right', -fill => 'y');
+    $logtext->configure(-yscrollcommand => ['set', $logscroll]);
+    $logwindow->title("snmpcheck Action Log file");
+    $logwindow->iconname("snmpcheck-log");
+    $logtext->delete('1.0','end');
+    $logclear = $logbuttons->Button(-text => 'Clear Log', 
+				 -command => [\&deleteLog]);
+    $logclear->pack(-side => 'right', -expand => 1);
+    if (! $logwindowatstart) {
+	$logwindow->withdraw;
+    }
+
+    $status->configure(-text => "Idle");
+    $selected = 0;
+    # fill table with hosts
+    if (!$dontstart) {
+	loadAllHosts(@ARGV);
+    }
+    MainLoop;
+}
+else {
+    select(STDOUT);
+    $| = 1;
+    if ($::fixit == 0) {
+	Term::ReadKey::ReadMode(3);
+    }
+    loadAllHosts(@ARGV);
+    printf("$eraseline");
+}
+
+sub loadAllHosts {
+    my @hostlist = @_;
+    foreach $host ( @hostlist ) {
+	newHost($host);
+    }
+}    
+
+sub newHost {
+    my $name = shift;
+    if (!exists $chost{"$name"}) {
+	$chost{"$name"} = new Host ($name);
+	if ($::display) { $top->update(); }
+	$chost{"$name"}->check;
+    } else {
+	setmsg("$name all ready exists");
+    }
+}
+
+sub deletehost {
+    my $name = shift;
+    delete $chost{"$name"};
+}
+
+sub setstatus {
+    my $arg = shift;
+    if ($display) {
+	$status->configure(-text => $arg);
+	$top->update();
+	addToLog($arg,4);
+    }
+}
+
+sub setmsg {
+    my $arg = shift;
+    if ($display) {
+	$msg->configure(-text => $arg);
+	$top->update();
+	addToLog($arg);
+    }
+}
+
+sub addToLog {
+    if ($display) {
+	my $logmsg = shift;
+	my $logaddlevel = shift;
+	if (! defined($logaddlevel)) {
+	    $logaddlevel = 1;
+	}
+	if ($logaddlevel <= $loglevel) {
+	    $logtext->insert('end'," " x ($logaddlevel-1) . "$logmsg\n");
+	}
+    }
+}
+
+sub displayTyfon {
+    remote_cmd_generic("cat /net/tyfon/1/OV/log/ece-log","Tyfon -- ece-log"); 
+}
+
+sub displayLog {
+    $logwindow->deiconify;
+    $logwindow->raise;
+}
+
+sub deleteLog {
+    $logtext->delete('1.0','end');
+}
+
+sub deselectitem {
+    $obj = shift;
+    $obj->deselectme();
+    $FixBut->configure(-state => "disabled");
+    $RshBut->configure(-state => "disabled");
+    $DelBut->configure(-state => "disabled");
+    $ChkBut->configure(-state => "disabled");
+    $selected = 0;
+}
+
+sub selectitem {
+    if ($selected) {
+	$selected->deselectme();
+    }
+    $selected = shift;
+    if (ref($selected) ne Host || !(exists $selected->{'Down'})) {
+	$RshBut->configure(-state => "normal", -command => ['rsh',$selected]);
+    } else {
+	$RshBut->configure(-state => "disabled");
+    }
+    $DelBut->configure(-state => "normal", -command => ['deleteme',$selected]);
+    $ChkBut->configure(-state => "normal", -command => ['check',$selected]);
+    if ($selected->canfix() && !(exists $selected->{'Down'})) {
+	$FixBut->configure(-state => "normal", 
+			   -command => ['fix',$selected]);
+    } else {
+	$FixBut->configure(-state => "disabled");
+    }
+    if ($hidden == 1) {
+	makeappear();
+    }
+}
+
+sub makehidden {
+    $MenuFrame->pack("forget");
+    $statusBar->pack("forget");
+    $msgBar->pack("forget");
+    $butFrame->pack("forget");
+    $botFrame->pack("forget");
+    flatten();
+    $hidden=1;
+}
+
+sub makeappear {
+    $HostFrame->pack("forget");
+    $MenuFrame->pack(-expand => 1, -fill => "x");
+    $statusBar->pack(-expand => 1, -fill => "x");
+    $msgBar->pack(-expand => 1, -fill => "x");
+    $HostFrame->pack(-expand => 1, -fill => "x");
+    $butFrame->pack(-expand => 1, -fill => "x"); 
+    $botFrame->pack(-expand => 1, -fill => "x");
+    reliefen();
+    $hidden=0;
+}
+
+sub quit {
+    $top->destroy();
+    exit();
+}
+
+sub scanlog {
+    my (@fields, @tmp);
+    open(LOG,$::errlog);
+    while (<LOG>) {
+	@fields = split;
+	@tmp = grep(/$fields[0]/,@ARGV);
+	if ($#tmp == -1 && !exists $::chost->{$fields[0]}) {
+	    newHost($fields[0]);
+	}
+    }
+    close(LOG);
+}
+
+sub rescanhosts {
+    foreach $i (keys(%chost)) {
+	$chost{$i}->check();
+    }
+}
+
+sub autorescan {
+    $afterId = Tk::after($rescanWhen*1000,[\&autorescan]);
+    if ($RescanWhenHidden && !$hidden) {return;}
+    if ($AutoCheckHosts) {
+	rescanhosts();
+    }
+    if ($AutoCheckLog) {
+	scanlog();
+    }
+}
+
+sub flatten {
+    foreach $i (keys(%chost)) {
+	$chost{$i}->{'MainFrame'}->configure(-relief => "flat",-borderwidth=>0);
+    }
+}
+
+sub reliefen {
+    foreach $i (keys(%chost)) {
+	$chost{$i}->{'MainFrame'}->configure(-relief =>"sunken",-borderwidth=>2);
+    }
+}
+
+sub fixall {
+    foreach $i (keys(%chost)) {
+	$chost{$i}->fix();
+    }
+}
+
+sub seenall {
+    foreach $i (keys(%chost)) {
+	$chost{$i}->seenall();
+    }
+}
+
+sub remote_cmd {
+    my $type = shift;
+    if ($selected) {
+	remote_cmd_generic("$::snmppath/rsnmp -p $type $selected->{'Host'}",
+			   "$selected->{'Host'} -- $type",1);
+    } else {
+	setmsg("Error:  Nothing selected");
+    }
+}
+
+sub remote_load {
+    if ($selected) {
+	remote_cmd_generic("$::snmppath/snmpwalk " . sprintf($::default_get_args,$selected->{'Host'}) . " .EXTENSIBLEDOTMIB.LOADAVEMIBNUM.LOADAVE",
+			   "$selected->{'Host'} -- LoadAve");
+    } else {
+	setmsg("Error:  Nothing selected");
+    }
+}
+
+sub remote_cmd_generic {
+    my $cmd = shift;
+    my $title = shift;
+    my $insert = shift;
+    addToLog("running:  $cmd ... ");
+    my $newwin = MainWindow->new;
+    $newwin->Busy();
+
+    $newwin->option('add','*highlightThickness','0');        #wish this worked
+#     $newwin->option('add','*highlightbackground','#C9C9C9');
+    $newwin->option('add','*background','#C9C9C9');
+    $newwin->option('add','*font','6x13');
+
+    my $buttons = $newwin->Frame;
+    $buttons->pack(-side => 'bottom', -expand => 1, -fill => 'x');
+    my $entries = $newwin->Frame;
+    $entries->pack(-side => 'bottom', -expand => 1, -fill => 'x');
+
+    my $text = $newwin->Text(-height => 40, -setgrid => 1);
+    $text->pack(-side => 'left', -fill => 'both', -expand => 1);
+    my $scroll = $newwin->Scrollbar(-command => ['yview',$text]);
+    $scroll->pack(-side => 'left', -fill => 'y');
+    $text->configure(-yscrollcommand => ['set', $scroll]);
+
+    my $close = $buttons->Button(-text => 'Close', 
+				 -command => ['destroy',$newwin]);
+    $close->pack(-side => 'left', -expand => 1);
+    my $rerun = $buttons->Button(-text => 'Re-Run', 
+				 -command=>[\&fill_text,'',$text,
+					    \$cmd,$insert]);
+    $rerun->pack(-side => 'left', -expand => 1);
+
+    my $cmdlabel = $entries->Label(-text => "Command:  ");
+    my $cmdtexte = $entries->Entry(-textvariable => \$cmd, 
+				      -relief => "sunken");
+    $cmdtexte->bind('<Return>' => [\&fill_text,$text, \$cmd,$insert]);
+    $cmdlabel->pack(-side => 'left');
+    $cmdtexte->pack(-side => 'left');
+    
+    my $searchtext = '';
+    my $searchlabel = $entries->Label(-text => "Search for:  ");
+    my $searchtexte = $entries->Entry(-textvariable => \$searchtext, 
+				      -relief => "sunken");
+
+    $searchtexte->pack(-side => 'right');
+    $searchlabel->pack(-side => 'right');
+    $searchtexte->bind('<Return>' => [sub { $text->tag('remove','search','0.0','end');
+					    my($current, $length) = ('1.0', 0);
+					    while (1) {
+						$current = $text->search(-count => \$length, $searchtext, $current, 'end');
+						last if not $current;
+						$text->tag('add', 'search', $current, "$current + $length char");
+						$current = $text->index("$current + $length char");
+						$text->tag('configure','search',
+							   -background => 
+							   'lightBlue');}}]);
+
+    if (defined($title)) {
+	$newwin->title($title);
+	$newwin->iconname($title);
+    }
+    fill_text('',$text,\$cmd,$insert);
+}
+
+sub fill_text {
+    my $dump = shift;
+    my $textw = shift;
+    my $cmd = shift;
+    my $insert = shift;
+    $textw->delete('1.0','end');
+    if (defined($insert) && $insert) {
+	$textw->insert('end',"running:  $$cmd\n\n");
+    }
+    $textw->toplevel->update();
+    $textw->toplevel->Busy();
+    open(OUT,"$$cmd|");
+    while (<OUT>) {
+	$textw->insert('end',$_);
+	$textw->toplevel->update();
+	$textw->toplevel->Busy();
+    }
+    close(OUT);
+    if (defined ($insert) && $insert) {
+	$textw->insert('end',"\ndone.\n");
+    }
+    $textw->toplevel->Unbusy();
+    $textw->Unbusy();
+    addToLog("done:  $$cmd");
+}
+
+sub display_help {
+    print "
+Usage:  snmpcheck [-x] [-n|y] [-h] [-H] [-V NUM] [-L] [-f] [[-a] HOSTS] 
+
+  -h\tDisplay this message.
+  -a\tcheck error log file AND hosts specified on command line.
+  -p\tDon't try and ping-echo the host first
+  -f\tOnly check for things I can fix
+  HOSTS\tcheck these hosts for problems.
+
+X Options:
+  -x\tforces ascii base if \$DISPLAY set (instead of tk).
+  -H\tstart in hidden mode.  (hides user interface)
+  -V NUM\tsets the initial verbosity level of the command log (def: 1)
+  -L\tShow the log window at startup
+  -d\tDon't start by checking anything.  Just bring up the interface.
+
+Ascii Options:
+  -n\tDon't ever try and fix the problems found.  Just list.
+  -y\tAlways fix problems found.
+
+";
+    exit(0);
+
+}
+
+sub option_get {
+    my $resource = shift;
+    return $top->option('get',$resource);
+}
+
+sub option_set {
+    my $resource = shift;
+    my $value = shift;
+    $top->option('add',"*$resource",$value);
+}
+
+sub option_save {
+
+}
+
+sub mibsort {
+    $_ = $a;
+    ($av) = /\.([0-9]+)/;
+    $_ = $b;
+    ($bv) = /\.([0-9]+)/;
+    return $av <=> $bv;
+}
+
+sub setmibchecklist {
+    my $i;
+    foreach $i (keys(%mibchecklist)) {
+	$mibchecklist{$i} = 0;
+    }
+    foreach $i (@_) {
+	$mibchecklist{$i} = 1;
+    }
+}
diff -Naur tomato/release/src/router/snmp/local/snmpconf tomato121/release/src/router/snmp/local/snmpconf
--- tomato/release/src/router/snmp/local/snmpconf	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/local/snmpconf	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,705 @@
+#!/usr/bin/perl -w
+
+#
+# A simple configuration file builder based on questions listed in
+# it's own configuration file.  It would certainly be easy to use this
+# for other (non-snmp) programs as well.
+#
+
+use Getopt::Std;
+use Term::ReadLine;
+use IO::File;
+use Data::Dumper;
+
+# globals
+%tokenitems=qw(line 1 info 1 comment 1);
+%arrayitems=qw(question 1 validanswer 1);
+
+#defaults
+$opts{'c'} = "/usr/local/share/snmp/snmpconf-data";
+
+# read the argument string
+getopts("qadhfc:piI:r:R:g:G", \%opts);
+
+# display help
+if ($opts{'h'}) {
+    print "$0 [options] [FILETOCREATE...]\n";
+    print "options:\n";
+    print "  -f           overwrite existing files without prompting\n";
+    print "  -i           install created files into /usr/local/share/snmp.\n";
+    print "  -p           install created files into $ENV{HOME}/.snmp.\n";
+    print "  -I DIR       install created files into DIR.\n";
+    print "  -a           Don't ask any questions, just read in current\n";
+    print "                   current .conf files and comment them\n";
+    print "  -r all|none  Read in all or none of the .conf files found.\n";
+    print "  -R file,...  Read in a particular list of .conf files.\n";
+    print "  -g GROUP     Ask a series of GROUPed questions.\n";
+    print "  -G           List known GROUPs.\n";
+    print "  -c conf_dir  use alternate configuration directory.\n";
+    print "  -q           run more quietly with less advice.\n";
+    print "  -d           turn on debugging output.\n";
+    print "  -D           turn on debugging dumper output.\n";
+    exit;
+}
+
+# setup terminal interface.
+$ENV{'PERL_RL'}='o=0' if (!exists($ENV{'PERL_RL'}));
+$term = new Term::ReadLine 'snmpconf';
+
+# read in configuration file set
+read_config_files($opts{'c'}, \%filetypes);
+debug(my_Dumper(\%filetypes));
+
+if ($opts{'G'}) {
+    Print("\nKnown GROUPs of tokens:\n\n");
+    foreach my $group (keys(%groups)) {
+	print "  $group\n";
+    }
+    Print("\n");
+    exit;
+}
+
+#
+# Find existing files to possibly read in.
+#
+my @searchpath = (qw(/usr/local/share/snmp /usr/local/etc/snmp .), "$ENV{HOME}/.snmp");
+push @searchpath, $opts{I} if ($opts{I});
+foreach my $i (@searchpath) {
+    debug("searching $i\n");
+    foreach my $ft (keys(%filetypes)) {
+	debug("searching for $i/$ft\n");
+	$knownfiles{"$i/$ft"} = $ft if (-f "$i/$ft");
+	my $localft = $ft;
+	$localft =~ s/.conf/.local.conf/;
+	$knownfiles{"$i/$localft"} = $ft if (-f "$i/$localft");
+    }
+}
+
+#
+# Ask the user if they want them to be read in and read them
+#
+if (keys(%knownfiles)) {
+    my @files;
+    if (defined($opts{'r'})) {
+	if ($opts{'r'} eq "all" || $opts{'r'} eq "a") {
+	    @files = keys(%knownfiles);
+	} elsif ($opts{'r'} ne "none" && $opts{'r'} ne "n") {
+	    print "unknown argument to -r: $opts{'r'}\n";
+	    exit(1);
+	}
+    } elsif(defined($opts{'R'})) {
+	@files = split(/\s*,\s*/,$opts{'R'});
+	foreach my $i (@files) {
+	    my $x = $i;
+	    $x =~ s/.*\/([^\/]+)$/$1/;
+	    $knownfiles{$i} = $x;
+	}
+	Print("reading: ", join(",",@files),"\n");
+    } else {
+	@files = display_menu(-head => "The following installed configuration files were found:\n",
+			      -tail => "Would you like me to read them in?  Their content will be merged with the\noutput files created by this session.\n\nValid answer examples: \"all\", \"none\",\"3\",\"1,2,5\"\n",
+			      -multiple => 1,
+			      -question => 'Read in which',
+			      -defaultvalue => 'all',
+			      sort keys(%knownfiles));
+    }
+    foreach my $i (@files) {
+	debug("reading $i\n");
+	read_config($i, $knownfiles{$i});
+    }
+}
+
+if ($opts{'g'}) {
+    my @groups = split(/,:\s/,$opts{'g'});
+    foreach my $group (@groups) {
+	do_group($group);
+    }
+} elsif ($#ARGV >= 0) {
+    #
+    # loop through requested files.
+    #
+    foreach my $i (@ARGV) {
+	if (!defined($filetypes{$i})) {
+	    warn "invalid file: $i\n";
+	} else {
+	    if ($opts{'a'}) {
+		$didfile{$i} = 1;
+	    } else {
+		build_file($term, $i, $filetypes{$i});
+	    }
+	}
+    }
+} else {
+    #
+    # ask user to select file type to operate on.
+    #
+    while(1) {
+	my $line = display_menu(-head => "I can create the following types of configuration files for you.\nSelect the file type you wish to create:\n(you can create more than one as you run this program)\n",
+				-question => 'Select File',
+				-otheranswers => ['quit'],
+				-mapanswers => { 'q' => 'quit' },
+				keys(%filetypes));
+	last if ($line eq "quit");
+	debug("file selected: $line\n");
+	build_file($term, $line, $filetypes{$line});
+    }
+}
+
+#
+# Write out the results to the output files.
+#
+output_files(\%filetypes, $term);
+
+
+#
+# Display the files that have been created for the user.
+#
+Print("\n\nThe following files were created:\n\n");
+@didfiles = keys(%didfile);
+foreach my $i (@didfiles) {
+    if ($didfile{$i} ne "1") {
+	if ($opts{'i'} || $opts{'I'}) {
+	    $opts{'I'} = "/usr/local/share/snmp" if (!$opts{'I'});
+	    system("mv $opts{'I'}/$i $opts{'I'}/$i.bak") if (-f "$opts{'I'}/$i");
+	    system("mv $didfile{$i} $opts{'I'}");
+	    Print("  $didfile{$i} installed in $opts{'I'}\n");
+	} elsif ($opts{'p'}) {
+	    system("mv $ENV{HOME}/.snmp/$i $ENV{HOME}/.snmp/$i.bak");
+	    system("mv $i $ENV{HOME}/.snmp");
+	    Print("  $didfile{$i} installed in $ENV{HOME}/.snmp\n");
+	} else {
+	    Print("  $didfile{$i} ",
+	    ($i ne $didfile{$i})?"[ from $i specifications]":" ","\n");
+	    if ($opts{'d'}) {
+		open(I,$didfile{$i});
+		debug("    " . join("    ",<I>) . "\n");
+		close(I);
+	    }
+	}
+    }
+}
+
+if (!$opts{'p'} && !$opts{'i'} && !$opts{'I'}) {
+    Print("\nThese files should be moved to /usr/local/share/snmp/ if you
+want them used by everyone on the system.  In the future, if you add 
+the -i option to the command line I'll copy them there automatically for you.
+
+Or, if you want them for your personal use only, copy them to
+$ENV{HOME}/.snmp .  In the future, if you add the -p option to the
+command line I'll copy them there automatically for you.
+
+");
+}
+
+###########################################################################
+# Functions
+###########################################################################
+
+sub Print {
+    print @_ if (!$opts{'q'});
+}
+#
+# handle a group of questions
+#
+sub get_yn_maybe {
+    my $question = shift;
+    my $ans = "y";
+    if ($question ne "") {
+	$ans = get_answer($term, $question,
+			  valid_answers(qw(yes y no n)), 'y');
+    }
+    return ($ans =~ /^y/)?1:0;
+}
+
+sub do_group {
+    my $group = shift;
+    die "no such group $group\n" if (!$groups{$group});
+    foreach my $token (@{$groups{$group}}) {
+	if ($token->[0] eq "message") {
+	    Print ("$token->[1] $token->[2]\n");
+	} elsif ($token->[0] eq "subgroup") {
+	    do_group($token->[1]) if (get_yn_maybe($token->[2]));
+	} elsif (defined($tokenmap{$token->[1]})) {
+	    if (get_yn_maybe($token->[2])) {
+		do {
+		    do_line($token->[1], $tokenmap{$token->[1]});
+		} until ($token->[0] ne "multiple" ||
+			 get_answer($term, "Do another $token->[1] line?",
+				    valid_answers(qw(yes y no n)), 'y')
+			 =~ /n/);
+	    }
+	} elsif (defined($filetypes{$token->[1]})) {
+	    $didfile{$token->[1]} = 1;
+	} else {
+	    die "invalid member $token->[1] of group $group\n";
+	}
+    }
+}
+
+#
+# build a particular type of file by operating on sections
+#
+sub build_file {
+    my ($term, $filename, $fileconf) = @_;
+    $didfile{$filename} = 1;
+    my (@lines);
+    while(1) {
+	my $line = display_menu(-head => "The configuration information which can be put into $filename is divided\ninto sections.  Select a configuration section for $filename\nthat you wish to create:\n",
+				-otheranswers => ['finished'],
+				-mapanswers => { 'f' => 'finished' },
+				-question => "Select section",
+				-numeric => 1,
+				map { $_->{'title'}[0] } @$fileconf);
+
+	return @lines if ($line eq "finished");
+	do_section($fileconf->[$line-1]);
+    }
+}
+
+#
+# configure a particular section by operating on token types
+#
+sub do_section {
+    my $confsect = shift;
+    my @lines;
+    while(1) {
+	Print ("\nSection: $confsect->{'title'}[0]\n");
+	Print ("Description:\n");
+	Print ("  ", join("\n  ",@{$confsect->{'description'}}),"\n");
+	my $line =
+	    display_menu(-head => "Select from:\n",
+			 -otheranswers => ['finished','list'],
+			 -mapanswers => { 'f' => 'finished',
+					  'l' => 'list' },
+			 -question => 'Select section',
+			 -descriptions => [map { $confsect->{$_}{info}[0] } 
+					   @{$confsect->{'thetokens'}}],
+			 @{$confsect->{'thetokens'}});
+	return @lines if ($line eq "finished");
+	if ($line eq "list") {
+	    print "Lines defined for section \"$confsect->{title}[0]\" so far:\n";
+	    foreach my $i (@{$confsect->{'thetokens'}}) {
+		if ($#{$confsect->{$i}{'results'}} >= 0) {
+		    print "  ",join("\n  ",@{$confsect->{$i}{'results'}}),"\n";
+		}
+	    }
+	    next;
+	}
+	do_line($line, $confsect->{$line});
+    }
+    return;
+}
+
+#
+# Ask all the questions related to a particular line type
+#
+sub do_line {
+    my $token = shift;
+    my $confline = shift;
+    my (@answers, $counter, $i);
+#    debug(my_Dumper($confline));
+    Print ("\nConfiguring: $token\n");
+    Print ("Description:\n  ",join("\n    ",@{$confline->{'info'}}),"\n\n");
+    for($i=0; $i <= $#{$confline->{'question'}}; $i++) {
+	if (defined($confline->{'question'}[$i]) &&
+	    $confline->{'question'}[$i] ne "") {
+	    my $q = $confline->{'question'}[$i];
+	    $q =~ s/\$(\d+)/$answers[$1]/g;
+	    debug("after: $term, $q, ",$confline->{'validanswer'}[$i],"\n");
+	    $answers[$i] = get_answer($term, $q,
+				      $confline->{'validanswer'}[$i]);
+	    $answers[$i] =~ s/\"/\\\"/g;
+	    $answers[$i] = '"' . $answers[$i] . '"' if ($answers[$i] =~ /\s/);
+	}
+    }
+    if ($#{$confline->{'line'}} == -1) {
+	my ($i,$line);
+	for($i=0; $i <= $#{$confline->{'question'}}; $i++) {
+	    next if (!defined($confline->{'question'}[$i]) ||
+		     $confline->{'question'}[$i] eq "");
+	    $line .= " \$" . $i;
+	}
+	push @{$confline->{'line'}}, $line;
+    }
+
+    foreach my $line (@{$confline->{'line'}}) {
+	my $finished = $line;
+	debug("preline: $finished\n");
+	debug("answers: ",my_Dumper(\@answers));
+	$finished =~ s/\$(\d+)/$answers[$1]/g;
+	if ($line =~ s/^eval\s+//) {
+	    debug("eval: $finished\n");
+	    $finished = eval $finished;
+	    debug("eval results: $finished\n");
+	}
+	$finished = $token . " " . $finished;
+	Print ("\nFinished Output: $finished\n");
+	push @{$confline->{'results'}},$finished;
+    }
+}
+
+#
+# read all sets of config files in the various subdirectories.
+#
+sub read_config_files {
+    my $readdir = shift;
+    my $filetypes = shift;
+    opendir(DH, $readdir) || die "no such directory $readdir, did you run make install?\n";
+    my $dir;
+    my $configfilename="snmpconf-config";
+
+    while(defined($dir = readdir(DH))) {
+	next if ($dir =~ /^\./);
+	next if ($dir =~ /CVS/);
+	debug("dir entry: $dir\n");
+	if (-d "$readdir/$dir" && -f "$readdir/$dir/$configfilename") {
+
+	    my $conffile;
+
+	    # read the top level configuration inforamation about the direcotry.
+	    open(I, "$readdir/$dir/$configfilename");
+	    while(<I>) {
+		$conffile = $1 if (/forconffile: (.*)/);
+	    }
+	    close(I);
+
+	    # no README informatino.
+	    if ($conffile eq "") {
+		print STDERR "Warning: No 'forconffile' information in $readdir/$dir/$configfilename\n";
+		next;
+	    }
+
+	    # read all the daat in the directory
+	    $filetypes->{$conffile} = read_config_items("$readdir/$dir", $conffile);
+	} else {
+	    # no README informatino.
+	    print STDERR "Warning: No $configfilename file found in $readdir/$dir\n";
+	}
+    }
+    closedir DH;
+}
+
+#
+# read each configuration file in a directory
+#
+sub read_config_items {
+    my $itemdir = shift;
+    my $type = shift;
+    opendir(ITEMS, $itemdir);
+    my $file;
+    my @results;
+    while(defined($file = readdir(ITEMS))) {
+	next if ($file =~ /~$/);
+	next if ($file =~ /^snmpconf-config$/);
+	if (-f "$itemdir/$file") {
+	    my $res = read_config_item("$itemdir/$file", $type);
+	    if (scalar(keys(%$res)) > 0) {
+		push @results, $res;
+	    }
+	}
+    }
+    closedir(ITEMS);
+    return \@results;
+}
+
+#
+# mark a list of tokens as a special "group"
+#
+sub read_config_group {
+    my ($fh, $group, $type) = @_;
+    my $line;
+    debug("handling group $group\n");
+    push (@{$groups{$group}},['filetype', $type]);
+    while($line = <$fh>) {
+	chomp($line);
+	next if ($line =~ /^\s*$/);
+	next if ($line =~ /^\#/);
+	return $line if ($line !~ /^(single|multiple|message|filetype|subgroup)/);
+	my ($type, $token, $rest) = ($line =~ /^(\w+)\s+([^\s]+)\s*(.*)/);
+	debug ("reading group $group : $type -> $token -> $rest\n");
+	push (@{$groups{$group}}, [$type, $token, $rest]);
+    }
+    return;
+}
+	
+
+#
+# Parse one file
+#
+sub read_config_item {
+    my $itemfile = shift;
+    my $itemcount;
+    my $type = shift;
+    my $fh = new IO::File($itemfile);
+    return if (!defined($fh));
+    my (%results, $curtoken);
+    debug("tokenitems:  ", my_Dumper(\%tokenitems));
+  topwhile:
+    while($line = <$fh>) {
+	next if ($line =~ /^\s*\#/);
+	my ($token, $rest) = ($line =~ /^(\w+)\s+(.*)/);
+	next if (!defined($token) || !defined($rest));
+	while ($token eq 'group') {
+	    # handle special group list
+	    my $next = read_config_group($fh, $rest,$type);
+	    if ($next) {
+		($token, $rest) = ($next =~ /^(\w+)\s+(.*)/);
+	    } else {
+		next topwhile;
+	    }
+	}
+	debug("token: $token => $rest\n");
+	if ($token eq 'steal') {
+	    foreach my $stealfrom (keys(%{$results{$rest}})) {
+		if (!defined($results{$curtoken}{$stealfrom})) {
+		    @{$results{$curtoken}{$stealfrom}} = 
+			@{$results{$rest}{$stealfrom}};
+		}
+	    }
+	} elsif (defined($tokenitems{$token})) {
+	    if (!defined($curtoken)) {
+		die "error in configuration file $itemfile, no token set\n";
+	    }
+	    $rest =~ s/^\#//;
+	    push @{$results{$curtoken}{$token}},$rest;
+	} elsif (defined($arrayitems{$token})) {
+	    if (!defined($curtoken)) {
+		die "error in configuration file $itemfile, no token set\n";
+	    }
+	    my ($num, $newrest) = ($rest =~ /^(\d+)\s+(.*)/);
+	    if (!defined($num) || !defined($newrest)) {
+		warn "invalid config line: $line\n";
+	    } else {
+		$results{$curtoken}{$token}[$num] = $newrest;
+	    }
+	} elsif ($token =~ /^token\s*$/) {
+	    $rest = lc($rest);
+	    $curtoken = $rest;
+	    if (! exists $results{$curtoken}{'defined'}) {
+		push @{$results{'thetokens'}}, $curtoken;
+		$results{$curtoken}{'defined'} = 1;
+	    }
+	    $tokenmap{$curtoken} = $results{$curtoken};
+	    debug("current token set to $token\n");
+	} else {
+	    push @{$results{$token}},$rest;
+	}
+    }
+    return \%results;
+}
+
+sub debug {
+    print @_ if ($opts{'d'});
+}
+
+sub output_files {
+    my $filetypes = shift;
+    my $term = shift;
+    foreach my $ft (keys(%$filetypes)) {
+	next if (!$didfile{$ft});
+	my $outputf = $ft;
+	if (-f $outputf && !$opts{'f'}) {
+	    print "\nError: An $outputf file already exists in this directory.\n\n";
+	    my $ans = get_answer($term,"'overwrite', 'skip', 'rename' or 'append'? ",valid_answers(qw(o overwrite r rename s skip a append)));
+	    next if ($ans =~ /^(s|skip)$/i);
+	    if ($ans =~ /^(a|append)/) {
+		$outputf = ">$outputf";
+	    } elsif ($ans =~ /^(r|rename)$/i) {
+		# default to rename for error conditions
+		$outputf = $term->readline("Save to what new file name instead (or 'skip')? ");
+	    }
+	}
+	$didfile{$ft} = $outputf;
+	open(O,">$outputf") || warn "couldn't write to $outputf\n";
+	print O "#" x 75,"\n";
+	print O "#\n# $ft\n";
+	print O "#\n#   - created by the snmpconf configuration program\n#\n";
+	foreach my $sect (@{$filetypes->{$ft}}) {
+	    my $secthelp = 0;
+	    foreach my $token (@{$sect->{'thetokens'}}) {
+		if ($#{$sect->{$token}{'results'}} >= 0) {
+		    if ($secthelp++ == 0) {
+			print O "#" x 75,"\n# SECTION: ",
+			join("\n#          ", @{$sect->{title}}), "\n#\n";
+			print O "#   ", join("\n#   ",@{$sect->{description}}),
+			"\n";
+		    }
+		    print O "\n# $token: ",
+		    join("\n#   ",@{$sect->{$token}{info}}), "\n\n";
+		    foreach my $result (@{$sect->{$token}{'results'}}) {
+			print O "$result\n";
+		    }
+		}
+	    }
+	    print O "\n\n\n";
+	}
+	if ($#{$unknown{$ft}} > -1) {
+	    print O "#\n# Unknown directives read in from other files by snmpconf\n#\n";
+	    foreach my $unknown (@{$unknown{$ft}}) {
+		print O $unknown,"\n";
+	    }
+	}
+	close(O);
+    }
+}
+
+sub get_answer {
+    my ($term, $question, $regexp, $defaultval) = @_;
+    $question .= " (default = $defaultval)" if (defined($defaultval) && $defaultval ne "");
+    $question .= ": ";
+    my $ans = $term->readline($question);
+    return $defaultval if ($ans eq "" && defined($defaultval) && 
+			   $defaultval ne "");
+    while (!(!defined($regexp) ||
+	     $regexp eq "" ||
+	     $ans =~ /$regexp/)) {
+	print "invalid answer!  It must match this regular expression: $regexp\n";
+	$ans = $term->readline($question);
+    }
+    return $defaultval if ($ans eq "" && defined($defaultval) && 
+			   $defaultval ne "");
+    return $ans;
+}
+    
+sub valid_answers {
+    my @list;
+    foreach $i (@_) {
+	push @list, $i if ($i);
+    }
+    return "^(" . join("|",@list) . ")\$";
+}
+
+sub read_config {
+    my $file = shift;
+    my $filetype = shift;
+    return if (!defined($filetypes{$filetype}));
+    if (! -f $file) {
+	warn "$file does not exist\n";
+	return;
+    }
+    open(I,$file);
+    while(<I>) {
+	next if (/^\s*\#/);
+	next if (/^\s*$/);
+	chomp;
+	my ($token, $rest) = /^\s*(\w+)\s+(.*)/;
+	$token = lc($token);
+	next if (defined($alllines{$_})); # drop duplicate lines
+	if (defined($tokenmap{$token})) {
+	    push @{$tokenmap{$token}{'results'}},$_;
+	} else {
+	    push @{$unknown{$filetype}},$_;
+	}
+	$alllines{$_}++;
+    }
+}
+
+sub display_menu {
+    my %config;
+
+    while ($#_ > -1 && $_[0] =~ /^-/) {
+	my $key = shift;
+	$config{$key} = shift;
+    }
+
+    my $count=1;
+    print "\n" if (!defined($config{'-dense'}));
+    if ($config{'-head'}) {
+	print $config{'-head'};
+	print "\n" if (!defined($config{'-dense'}));
+    }
+    my @answers = @_;
+    my @list;
+    if (defined($config{'-descriptions'}) && 
+	ref($config{'-descriptions'}) eq "ARRAY") {
+	@list = @{$config{'-descriptions'}}
+    } else {
+	@list = @_;
+    }
+    foreach my $i (@list) {
+	printf "  %2d:  $i\n", $count++ if ($i);
+    }
+    print "\n" if (!defined($config{'-dense'}));
+    if (defined($config{'-otheranswers'})) {
+	if (ref($config{'-otheranswers'}) eq 'ARRAY') {
+	    print "Other options: ", join(", ",
+					  @{$config{'-otheranswers'}}), "\n";
+	    push @answers, @{$config{'-otheranswers'}};
+	    push @answers, keys(%{$config{'-mapanswers'}});
+	} else {
+	    my $maxlen = 0;
+	    push @answers,keys(%{$config{'-otheranswers'}});
+	    foreach my $i (keys(%{$config{'-otheranswers'}})) {
+		$maxlen = length($i) if (length($i) > $maxlen);
+	    }
+	    foreach my $i (keys(%{$config{'-otheranswers'}})) {
+		printf("  %-" . $maxlen . "s: %s\n", $i, 
+		       $config{'-otheranswers'}{$i});
+	    }
+	}
+	print "\n" if (!defined($config{'-dense'}));
+    }
+    if ($config{'-tail'}) {
+	print $config{'-tail'};
+	print "\n" if (!defined($config{'-dense'}));
+    }
+
+    if (defined($config{'-question'})) {
+	while(1) {
+	    my $numexpr;
+	    if ($config{'-multiple'}) {
+		$numexpr = '[\d\s,]+|all|a|none|n';
+	    } else {
+		$numexpr = '\d+';
+	    }
+	    push @answers,"" if ($config{'-defaultvalue'});
+	    $ans = get_answer($term, $config{'-question'},
+			      valid_answers($numexpr,@answers),
+			      $config{'-defaultvalue'});
+	    if ($config{'-mapanswers'}{$ans}) {
+		$ans = $config{'-mapanswers'}{$ans};
+	    }
+
+	    if ($ans =~ /^$numexpr$/) {
+		if ($config{'-multiple'}) {
+		    my @list = split(/\s*,\s*/,$ans);
+		    my @ret;
+		    $count = 0;
+		    foreach my $i (@_) {
+			$count++;
+			if ($ans eq "all" || $ans eq "a" 
+			    || grep(/^$count$/,@list)) {
+			    push @ret, $i;
+			}
+		    }
+		    return @ret;
+		} else {
+		    if ($ans <= 0 || $ans > $#_+1) {
+			warn "invalid selection: $ans [must be 1-" .
+			    ($#_+1) . "]\n";
+		    } else {
+			return $ans if ($config{'-numeric'});
+			$count = 0;
+			foreach my $i (@_) {
+			    $count++;
+			    if ($ans eq $count) {
+				return $i;
+			    }
+			}
+		    }
+		}
+	    } else {
+		return $ans;
+	    }
+	}
+    }
+}
+
+sub my_Dumper {
+    if ($opts{'D'}) {
+	return Dumper(@_);
+    } else {
+	return "\n";
+    }
+}
+
diff -Naur tomato/release/src/router/snmp/local/snmpconf.dir/snmp-data/authopts tomato121/release/src/router/snmp/local/snmpconf.dir/snmp-data/authopts
--- tomato/release/src/router/snmp/local/snmpconf.dir/snmp-data/authopts	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/local/snmpconf.dir/snmp-data/authopts	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,77 @@
+title Default Authentication Options
+description This section defines the default authentication
+description information.  Setting these up properly in your
+description ~/.snmp/snmp.conf file will greatly reduce the amount of
+description command line arguments you need to type (especially for snmpv3).
+
+token defaultPort
+info  The default port number to use
+info  This token specifies the default port number you want packets to 
+info  be sent to and received from.
+info  override: with -p on the command line.
+info  arguments: portnum
+question 1 Enter the default port number to use
+
+token defVersion
+info  The default snmp version number to use.
+info  override: with -v on the command line.
+info  arguments: 1|2c|3
+question 1 Enter the default snmp version number to use (1|2c|3)
+validanswer 1 ^(1|2c|3)$
+
+token defCommunity
+info  The default snmpv1 and snmpv2c community name to use when needed.
+info  If this is specified, you don't need to include the community
+info  name as an argument to the snmp applications.  
+info  override: with -c on the command line.
+info  arguments: communityname
+question 1 Enter the default community name to use
+
+token defSecurityName
+info  The default snmpv3 security name to use when using snmpv3
+info  override: with -u on the command line.
+info  arguments: securityname
+question 1 Enter the default security name to use
+
+token defContext
+info  The default snmpv3 context name to use
+info  override: with -n on the command line.
+info  arguments: contextname
+question 1 Enter the default context name to use
+
+token defSecurityLevel
+info  The default snmpv3 security level to use
+info  override: with -l on the command line.
+info  arguments: noAuthNoPriv|authNoPriv|authPriv
+question 1 Enter the default privacy pass phrase to use
+validanswer 1 ^(noAuthNoPriv|authNoPriv|authPriv|nanp|anp|ap)$
+
+token defAuthType
+info  The default snmpv3 authentication type name to use
+info  override: with -a on the command line.
+info  arguments: authtype
+question 1 Enter the default authentication type to use (MD5|SHA)
+validanswer 1 ^(MD5|SHA)$
+
+token defAuthPassphrase
+info  The default snmpv3 authentication pass phrase to use
+info  Note: It must be at least 8 characters long.
+info  override: with -A on the command line.
+info  arguments: passphrase
+question 1 Enter the default authentication pass phrase to use
+
+token defPrivType
+info  The default snmpv3 privacy (encryption) type name to use
+info  override: with -x on the command line.
+info  arguments: privtype
+question 1 Enter the default privacy type to use (DES)
+validanswer 1 ^(DES)$
+
+token defPrivPassphrase
+info  The default snmpv3 privacy pass phrase to use
+info  Note: It must be at least 8 characters long.
+info  override: with -X on the command line.
+info  arguments: passphrase
+question 1 Enter the default privacy pass phrase to use
+
+
diff -Naur tomato/release/src/router/snmp/local/snmpconf.dir/snmp-data/debugging tomato121/release/src/router/snmp/local/snmpconf.dir/snmp-data/debugging
--- tomato/release/src/router/snmp/local/snmpconf.dir/snmp-data/debugging	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/local/snmpconf.dir/snmp-data/debugging	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,39 @@
+title Debugging output options
+description This section allows debugging output of various kinds to
+description be turned on or off.
+
+token doDebugging
+info  Turns debugging output on or off (0|1)
+info  arguments: (0|1)
+question 1 Turn debugging on (0|1)
+validanswer 1 ^(0|1)$
+
+token debugTokens
+info  Debugging tokens specify which lines of debugging
+info  output you'd actually like to see.  Each section of code is most
+info  likely instrumented with a particular "tag".  So, to see that tag you
+info  would specify it here.  Specifying a tag will match against all
+info  tags that begin with that prefix, so the tag "test" will match
+info  "test_function" and "test_something" and...
+info  There are a few special tokens as well:
+info    - ALL:   turns on all the tokens (which generates lots of output)
+info    - trace: prints 'trace' lines showing source code files and
+info    -        line numbers as they're traversed.
+info    - dump:  Nicely breaks down packets as they're parsed or sent out.
+info  command line equivelent: -Dtoken[,token...]
+info  arguments: token[,token...]
+question 1 Enter the tokens (comma seperated) you wish to see output for
+
+token dumpPacket
+info  Print packets as they are received or sent
+info  arguments: (1|yes|true|0|no|false)
+info  command line equivelent: -d
+validanswer 1 ^(1|yes|true|0|no|false)$
+question 1 Print packets as they are received or sent
+
+
+token noTokenWarnings
+info Silence warnings about unknown tokens in configuration files
+question 1 Silence warnings about unknown tokens in configuration files
+info  arguments: (1|yes|true|0|no|false)
+validanswer 1 ^(1|yes|true|0|no|false)$
diff -Naur tomato/release/src/router/snmp/local/snmpconf.dir/snmp-data/mibs tomato121/release/src/router/snmp/local/snmpconf.dir/snmp-data/mibs
--- tomato/release/src/router/snmp/local/snmpconf.dir/snmp-data/mibs	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/local/snmpconf.dir/snmp-data/mibs	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,56 @@
+title Textual mib parsing
+description This section controls the textual mib parser.  Textual
+description mibs are parsed in order to convert OIDs, enumerated
+description lists, and ... to and from textual representations
+description and numerical representations.
+
+token mibdirs
+info  Specifies directories to be searched for mibs.
+info  Adding a '+' sign to the front of the argument appends the new
+info  directory to the list of directories already being searched.
+info  arguments: [+]directory[:directory...]
+question 1 Enter the list of directories to search through for mibs
+
+token mibs
+info  Specifies a list of mibs to be searched for and loaded.
+info  Adding a '+' sign to the front of the argument appends the new
+info  mib name to the list of mibs already being searched for.
+info  arguments: [+]mibname[:mibname...]
+question 1 Enter the list of mibs to read
+
+token mibfile
+info  Loads a particular mib file from a particualar path
+info  arguments: /path/to/mibfile
+question 1 Enter the mib file name to read
+
+token showMibErrors
+info  Should errors in mibs be displayed when the mibs are loaded
+question 1  Should errors in mibs be displayed when the mibs are loaded
+info  arguments: (1|yes|true|0|no|false)
+validanswer 1 ^(1|yes|true|0|no|false)$
+
+token mibWarningLevel
+info  Should warnings about mibs be displayed when the mibs are loaded
+question 1  Should warnings about mibs be displayed when the mibs are loaded
+info  arguments: 1|2
+validanswer 1 ^(1|2)$
+
+token strictCommentTerm
+info  Be strict about about mib comment termination.
+info  Strictly follow comment rules about parsing mibs.
+info  arguments: (1|yes|true|0|no|false)
+validanswer 1 ^(1|yes|true|0|no|false)$
+question 1 Be strict about about mib comment termination
+
+token mibAllowUnderline
+info  Should underlines be allowed in mib symbols (illegal)
+info  arguments: (1|yes|true|0|no|false)
+validanswer 1 ^(1|yes|true|0|no|false)$
+question 1 Should underlines be allowed in mib symbols
+
+token mibReplaceWithLatest
+info  Force replacement of older mibs with known updated ones
+question 1  Force replacement of older mibs with known updated ones
+info  arguments: (1|yes|true|0|no|false)
+validanswer 1 ^(1|yes|true|0|no|false)$
+
diff -Naur tomato/release/src/router/snmp/local/snmpconf.dir/snmp-data/output tomato121/release/src/router/snmp/local/snmpconf.dir/snmp-data/output
--- tomato/release/src/router/snmp/local/snmpconf.dir/snmp-data/output	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/local/snmpconf.dir/snmp-data/output	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,79 @@
+title Output style options
+description This section allows you to control how the output of the
+description various commands will be formated
+
+token logTimestamp
+info  Should timestamps be shown on the output
+info  arguments: (1|yes|true|0|no|false)
+question 1  Should timestamps be shown on the output
+validanswer 1 ^(1|yes|true|0|no|false)$
+
+token printNumericEnums
+info  Print enums numericly or textually
+info  command line equivelent: -Oe
+question 1 Print enums numericly
+info  arguments: (1|yes|true|0|no|false)
+validanswer 1 ^(1|yes|true|0|no|false)$
+
+token printNumericOids
+info  Print OIDs numericly or textually
+info  command line equivelent: -On
+question 1 Print enums numericly
+info  arguments: (1|yes|true|0|no|false)
+validanswer 1 ^(1|yes|true|0|no|false)$
+
+token dontBreakdownOids
+info When OIDs contain a index to a table, they are broken
+info into the displayable pieces and shown to you.
+info For example the oid vacmSecurityModel.0.3.119.101.115
+info is nicely broken down by
+info default and the string hidden in the oid is shown
+info to you as vacmSecurityModel.0."wes". This token and the -Ob
+info option diables this feature and displays it as
+info vacmSecurityModel.0.3.119.101.115 again.
+info  command line equivelent: -Ob
+info  arguments: (1|yes|true|0|no|false)
+validanswer 1 ^(1|yes|true|0|no|false)$
+question 1 Disable the breaking-down of OIDs?
+
+token escapeQuotes
+info  Should the quotation marks in broken down oids be escaped
+info  If you want to cut and paste oids that have been broken down
+info  into indexes and strings, this will put a backslash in front of them
+info  so your shell will pass them rather than interpret them.
+info  arguments: (1|yes|true|0|no|false)
+question 1  Should the quotation marks in broken down oids be escaped
+validanswer 1 ^(1|yes|true|0|no|false)$
+
+token quickPrinting
+info  Make the output simple for quick parsing
+info  This option removes the equal sign and value identifies leaving
+info  just the oid and the value on the output for easier parsing in scripts
+info  command line equivelent: -Oq
+info  arguments: (1|yes|true|0|no|false)
+validanswer 1 ^(1|yes|true|0|no|false)$
+question 1  Make the output simple for quick parsing
+
+token numericTimeticks
+info  Print timeticks as a number and not a time-string
+info  command line equivelent:
+info  arguments: (1|yes|true|0|no|false)
+question 1 Print timeticks as a number and not a time-string
+validanswer 1 ^(1|yes|true|0|no|false)$
+
+token suffixPrinting
+info Shorten OIDs printed to the screen
+info possible values:
+info -  0:  UCD-style.  OIDs are displayed like:
+info -        system.sysUpTime.0
+info -  1:  deletes all by the last symbolic part of the OID:
+info -        system.sysUpTime.0 becomes sysUpTime.0
+info -  2:  is  a  variant  of this, adding the name of the MIB
+info -      that defined this object:
+info -        system.sysUpTime.0 becomes SNMPv2-MIB::sysUpTime.0
+info -      (This is the default with net-snmp v5)
+info  command line equivelent: 0 = -Ou,  1 = -Os, 2 = -OS
+info  arguments: (1|2)
+question 1 Shorten OIDs (0|1|2)
+validanswer 1 ^(0|1|2)$
+
diff -Naur tomato/release/src/router/snmp/local/snmpconf.dir/snmp-data/snmpconf-config tomato121/release/src/router/snmp/local/snmpconf.dir/snmp-data/snmpconf-config
--- tomato/release/src/router/snmp/local/snmpconf.dir/snmp-data/snmpconf-config	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/local/snmpconf.dir/snmp-data/snmpconf-config	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1 @@
+forconffile: snmp.conf
diff -Naur tomato/release/src/router/snmp/local/snmpconf.dir/snmpd-data/acl tomato121/release/src/router/snmp/local/snmpconf.dir/snmpd-data/acl
--- tomato/release/src/router/snmp/local/snmpconf.dir/snmpd-data/acl	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/local/snmpconf.dir/snmpd-data/acl	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,36 @@
+title   Access Control Setup
+description	This section defines who is allowed to talk to your running
+description	snmp agent.
+
+token	rwuser
+info	a SNMPv3 read-write user
+info	arguments:  user [noauth|auth|priv] [restriction_oid]
+question 1 The SNMPv3 user that should have read-write access
+question 2 The minimum security level required for that user [noauth|auth|priv, default = auth]
+validanswer 2 (noauth|auth|priv|)
+question 3 The OID that this community should be restricted to [if appropriate]
+
+token	rouser
+info	a SNMPv3 read-only user
+info	arguments:  user [noauth|auth|priv] [restriction_oid]
+steal	rwuser
+question 1 Enter the SNMPv3 user that should have read-only access to the system
+
+token	rocommunity
+info	a SNMPv1/SNMPv2c read-only access community name
+info	arguments:  community [default|hostname|network/bits] [oid]
+question 1 The community name to add read-only access for
+question 2 The hostname or network address to accept this community name from [RETURN for all]
+question 3 The OID that this community should be restricted to [RETURN for no-restriction]
+
+token	rwcommunity
+info	a SNMPv1/SNMPv2c read-write access community name
+info	arguments:  community [default|hostname|network/bits] [oid]
+steal rocommunity
+question 1 Enter the community name to add read-write access for
+
+group access_control
+multiple rwuser Do you want to allow SNMPv3 read-write user based access
+multiple rouser Do you want to allow SNMPv3 read-only user based access
+multiple rwcommunity Do you want to allow SNMPv1/v2c read-write community access
+multiple rocommunity Do you want to allow SNMPv1/v2c read-only community access
diff -Naur tomato/release/src/router/snmp/local/snmpconf.dir/snmpd-data/basic_setup tomato121/release/src/router/snmp/local/snmpconf.dir/snmpd-data/basic_setup
--- tomato/release/src/router/snmp/local/snmpconf.dir/snmpd-data/basic_setup	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/local/snmpconf.dir/snmpd-data/basic_setup	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,17 @@
+group basic_setup
+message ************************************************
+message *** Beginning basic system information setup ***
+message ************************************************
+subgroup system_setup Do you want to configure the information returned in the system MIB group (contact info, etc)?
+message **************************************
+message *** BEGINNING ACCESS CONTROL SETUP ***
+message **************************************
+subgroup access_control Do you want to configure the agent's access control?
+message ****************************************
+message *** Beginning trap destination setup ***
+message ****************************************
+subgroup trapsinks Do you want to configure where and if the agent will send traps?
+message ****************************************
+message *** Beginning monitoring setup ***
+message ****************************************
+subgroup monitoring_services Do you want to configure the agent's ability to monitor various aspects of your system?
diff -Naur tomato/release/src/router/snmp/local/snmpconf.dir/snmpd-data/extending tomato121/release/src/router/snmp/local/snmpconf.dir/snmpd-data/extending
--- tomato/release/src/router/snmp/local/snmpconf.dir/snmpd-data/extending	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/local/snmpconf.dir/snmpd-data/extending	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,68 @@
+title   Extending the Agent
+description	You can extend the snmp agent to have it return information
+description	that you yourself define.
+
+token	exec
+info	run a simple command using exec()
+info	arguments:  [oid] name /path/to/executable arguments
+question 1 The OID where the results table should be display [default=extTable]
+question 2 The "name" to associate with this command when displaying the results.
+question 3 The path to the program to be run.
+question 4 The arguments to pass to $3
+
+token	 pass
+info	 Run a command that intepretes the request for an entire tree.
+info	 The pass program defined here will get called for all
+info	 requests below a certain point in the mib tree.  It is then
+info	 responsible for returning the right data beyond that point.
+info	 #
+info	 arguments: miboid program
+info	 #
+info	 example: pass .1.3.6.1.4.1.2021.255 /path/to/local/passtest
+info	 #
+info	 See the snmpd.conf manual page for further information.
+info	 #
+info	 Consider using "pass_persist" for a performance increase.
+question 1 The OID where the script should take control of
+question 2 The path to the program that should be called 
+
+token pass_persist
+info	 Run a persistant process that intepretes the request for an entire tree.
+info	 The pass program defined here will get called for all
+info	 requests below a certain point in the mib tree.  It is then
+info	 responsible for returning the right data beyond that point.
+info	 The pass_persist scripts must be able to stay running and accept input
+info	 from stdin.
+info	 #
+info	 arguments: miboid program
+info	 #
+info	 example: pass_persist .1.3.6.1.4.1.2021.255 /path/to/local/pass_persisttest
+info	 #
+info	 See the snmpd.conf manual page for further information.
+steal pass
+
+token proxy
+info  Proxy requests to an external agent running somewhere else
+info  This passes all requests for a certain point of the mib tree to
+info  an external agent using snmp requests and then returning the
+info  results to the caller that spoke to our agent.
+info  arguments: [snmpcmd args] host oid [remoteoid]
+question 1 Enter the "snmpcmd" arguments that specify how to talk to the remote host
+question 2 The host you want to pass the requests to
+qusetion 3 The oid that we should pass beyond
+question 4 The oid of the remote site that we should talk to if different from $3 
+
+token	sh
+info	run a simple command using system()
+info	arguments:  [oid] name command arguments
+info	similar to exec, but implemented using system() instead of exec()
+info	#
+info	For security reasons, exec should be preferred.
+steal exec
+
+token dlmod
+info dynamically extend the agent using a shared-object
+info	arguments:  module-name module-path
+question 1 Enter the name of the module
+question 2 Enter the path to the $1 module
+
diff -Naur tomato/release/src/router/snmp/local/snmpconf.dir/snmpd-data/monitor tomato121/release/src/router/snmp/local/snmpconf.dir/snmpd-data/monitor
--- tomato/release/src/router/snmp/local/snmpconf.dir/snmpd-data/monitor	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/local/snmpconf.dir/snmpd-data/monitor	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,72 @@
+title Monitor Various Aspects of the Running Host
+description The following check up on various aspects of a host.
+
+token proc
+info Check for processes that should be running.
+info #  proc NAME [MAX=0] [MIN=0]
+info #
+info #  NAME:  the name of the process to check for.  It must match
+info #         exactly (ie, http will not find httpd processes).
+info #  MAX:   the maximum number allowed to be running.  Defaults to 0.
+info #  MIN:   the minimum number to be running.  Defaults to 0.
+info #
+info The results are reported in the prTable section of the UCD-SNMP-MIB tree
+info Special Case:  When the min and max numbers are both 0, it assumes
+info you want a max of infinity and a min of 1.
+question 1 Name of the process you want to check on
+question 2 Maximum number of processes named '$1' that should be running [default = 0]
+question 3 Minimum number of processes named '$1' that should be running [default = 0]
+
+token disk
+info Check for disk space usage of a partition.
+info The agent can check the amount of available disk space, and make
+info sure it is above a set limit.  
+info
+info # disk PATH [MIN=100000]
+info #
+info # PATH:  mount path to the disk in question.
+info # MIN:   Disks with space below this value will have the Mib's errorFlag set.
+info #        Can be a raw byte value or a percentage followed by the %
+info #        symbol.  Default value = 100000.
+info #
+info The results are reported in the dskTable section of the UCD-SNMP-MIB tree
+question 1 Enter the mount point for the disk partion to be checked on
+question 2 Enter the minimum amount of space that should be available on $1
+
+token load
+info Check for unreasonable load average values.
+info Watch the load average levels on the machine.
+info
+info # load [1MAX=12.0] [5MAX=12.0] [15MAX=12.0]
+info #
+info # 1MAX:   If the 1 minute load average is above this limit at query
+info #         time, the errorFlag will be set.
+info # 5MAX:   Similar, but for 5 min average.
+info # 15MAX:  Similar, but for 15 min average.
+info #
+info The results are reported in the laTable section of the UCD-SNMP-MIB tree
+question 1 Enter the maximum allowable value for the 1 minute load average
+question 2 Enter the maximum allowable value for the 5 minute load average
+question 3 Enter the maximum allowable value for the 15 minute load average
+validanswer 1 ^[\d\.]+$
+validanswer 2 ^([\d\.]+|)$
+validanswer 3 ^([\d\.]+|)$
+
+token file
+info Check on the size of a file.
+info Display a files size statistics.
+info If it grows to be too large, report an error about it.
+info
+info # file /path/to/file [maxsize_in_bytes]
+info #
+info #   if maxsize is not specified, assume only size reporting is needed.
+info #
+info The results are reported in the fileTable section of the UCD-SNMP-MIB tree
+question 1 Enter the path to the file you wish to monitor
+question 2 Enter the maximum size (in bytes) allowable for $1
+
+group monitoring_services
+multiple proc Do you want to configure the agents ability to monitor processes?
+multiple disk Do you want to configure the agents ability to monitor disk space?
+multiple load Do you want to configure the agents ability to monitor load average?
+multiple file Do you want to configure the agents ability to monitor file sizes?
diff -Naur tomato/release/src/router/snmp/local/snmpconf.dir/snmpd-data/operation tomato121/release/src/router/snmp/local/snmpconf.dir/snmpd-data/operation
--- tomato/release/src/router/snmp/local/snmpconf.dir/snmpd-data/operation	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/local/snmpconf.dir/snmpd-data/operation	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,32 @@
+title Agent Operating Mode
+description  This section defines how the agent will operate when it
+description  is running.
+
+token master
+info  Should the agent operate as a master agent or not.
+info  Currently, the only supported master agent type for this token
+info  is "agentx".
+info  #
+info  arguments: (on|yes|agentx|all|off|no)
+question 1 Should the agent run as a AgentX master agent?
+validanswer 1 ^(on|yes|agentx|all|off|no)$
+
+token agentuser
+info  The system user that the agent runs as.
+info  arguments: name|#uid
+question 1 Enter the name of the user that you want the agent to run as
+
+token agentgroup
+info  The system group that the agent runs as.
+info  arguments: group|#GID
+question 1 Enter the name of the group that you want the agent to run as
+
+token agentaddress
+info  The IP address and port number that the agent will listen on.
+info  By default the agent listens to any and all traffic from any
+info  interface on the default SNMP port (161).  This allows you to
+info  specify which address, interface, transport type and port(s) that you
+info  want the agent to listen on.  Multiple definitions of this token
+info  are concatenated together (using ':'s).
+info  arguments: [transport:]port[@interface/address],...
+question 1 Enter the port numbers, etc that you want the agent to listen to
diff -Naur tomato/release/src/router/snmp/local/snmpconf.dir/snmpd-data/snmpconf-config tomato121/release/src/router/snmp/local/snmpconf.dir/snmpd-data/snmpconf-config
--- tomato/release/src/router/snmp/local/snmpconf.dir/snmpd-data/snmpconf-config	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/local/snmpconf.dir/snmpd-data/snmpconf-config	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1 @@
+forconffile: snmpd.conf
diff -Naur tomato/release/src/router/snmp/local/snmpconf.dir/snmpd-data/system tomato121/release/src/router/snmp/local/snmpconf.dir/snmpd-data/system
--- tomato/release/src/router/snmp/local/snmpconf.dir/snmpd-data/system	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/local/snmpconf.dir/snmpd-data/system	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,43 @@
+title System Information Setup
+description  This section defines some of the information reported in
+description  the "system" mib group in the mibII tree.
+
+token syslocation
+info  The [typically physical] location of the system.
+info  Note that setting this value here means that when trying to
+info  perform an snmp SET operation to the sysLocation.0 variable will make
+info  the agent return the "notWritable" error code.  IE, including
+info  this token in the snmpd.conf file will disable write access to
+info  the variable.
+info  arguments:  location_string
+question 1 The location of the system
+
+token syscontact
+info  The contact information for the administrator
+info  Note that setting this value here means that when trying to
+info  perform an snmp SET operation to the sysContact.0 variable will make
+info  the agent return the "notWritable" error code.  IE, including
+info  this token in the snmpd.conf file will disable write access to
+info  the variable.
+info  arguments:  contact_string
+question 1 The contact information
+
+token sysservices
+info  The proper value for the sysServices object.
+info  arguments:  sysservices_number
+question 1 does this host offer physical services (eg, like a repeater) [answer 0 or 1]
+question 2 does this host offer datalink/subnetwork services (eg, like a bridge)
+question 3 does this host offer internet services (eg, supports IP)
+question 4 does this host offer end-to-end services (eg, supports TCP)
+question 7 does this host offer application services (eg, supports SMTP)
+validanswer 1 ^(0|1)$
+validanswer 2 ^(0|1)$
+validanswer 3 ^(0|1)$
+validanswer 4 ^(0|1)$
+validanswer 7 ^(0|1)$
+line eval $1*1 + $2*2 + $3*4 + $4*8 + $7*64
+
+group system_setup
+single syslocation
+single syscontact
+single sysservices Do you want to properly set the value of the sysServices.0 OID (if you don't know, just say no)?
diff -Naur tomato/release/src/router/snmp/local/snmpconf.dir/snmpd-data/trapsinks tomato121/release/src/router/snmp/local/snmpconf.dir/snmpd-data/trapsinks
--- tomato/release/src/router/snmp/local/snmpconf.dir/snmpd-data/trapsinks	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/local/snmpconf.dir/snmpd-data/trapsinks	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,46 @@
+title		Trap Destinations
+description	Here we define who the agent will send traps to.
+
+token	    trapsink
+info	    A SNMPv1 trap receiver
+info	    arguments: host [community] [portnum]
+question 1  A host name that should receive the trap
+question 2  The community to be used in the trap sent [optional]
+question 3  The port number the trap should be sent to [optional]
+validanswer 3 ^(\d+|)$
+
+token	    trap2sink
+info	    A SNMPv2c trap receiver
+info	    arguments: host [community] [portnum]
+steal	    trapsink
+
+token	    informsink
+info	    A SNMPv2c inform (acknowledged trap) receiver
+info	    arguments: host [community] [portnum]
+steal	    trapsink
+
+token	    trapsess
+info	    A generic trap receiver defined using snmpcmd style arguments.
+info	    Read the snmpcmd manual page for further information.
+info	    arguments: [snmpcmdargs] host
+question 1  Specify the command line snmpcmd style options for this host
+question 2  Specify the host name
+
+token	    trapcommunity
+info	    Default trap sink community to use
+info	    arguments: community-string
+question 1  The default community name to use when sending traps
+
+
+token	    authtrapenable
+info	    Should we send traps when authentication failures occur
+info	    arguments: 1 | 2   (1 = yes, 2 = no)
+question 1  Should traps be sent when authentication failures occur? (1=yes, 2=no)
+validanswer 1 ^(1|2)$
+
+group trapsinks
+single authtrapenable Do you want the agent to send snmp traps on snmp authentication failures?
+single trapcommunity
+multiple informsink Do you want the agent to send snmpv2c informs to a trap receiver
+multiple trap2sink Do you want the agent to send snmpv2c traps to a trap receiver
+multiple trapsink Do you want the agent to send snmpv1 traps to a trap receiver
diff -Naur tomato/release/src/router/snmp/local/snmpconf.dir/snmptrapd-data/formatting tomato121/release/src/router/snmp/local/snmpconf.dir/snmptrapd-data/formatting
--- tomato/release/src/router/snmp/local/snmpconf.dir/snmptrapd-data/formatting	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/local/snmpconf.dir/snmptrapd-data/formatting	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,15 @@
+title		Output formatting for traps received.
+description	Output from snmptrapd is formatted according to the
+description	rules defined by the formatting configuration directives.
+
+token	    format1
+info	    How SNMPv1 traps are formatted.
+info	    See the snmptrapd.conf manual page for format string details.
+info	    arguments: formatstring
+question 1  The format specification string for SNMPv1 traps
+
+token	    format2
+info	    How SNMPv2 and SNMPv3 traps are formatted.
+info	    See the snmptrapd.conf manual page for format string details.
+info	    arguments: formatstring
+question 1  The format specification string for SNMPv2 and SNMPv3 traps.
diff -Naur tomato/release/src/router/snmp/local/snmpconf.dir/snmptrapd-data/snmpconf-config tomato121/release/src/router/snmp/local/snmpconf.dir/snmptrapd-data/snmpconf-config
--- tomato/release/src/router/snmp/local/snmpconf.dir/snmptrapd-data/snmpconf-config	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/local/snmpconf.dir/snmptrapd-data/snmpconf-config	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1 @@
+forconffile: snmptrapd.conf
diff -Naur tomato/release/src/router/snmp/local/snmpconf.dir/snmptrapd-data/traphandle tomato121/release/src/router/snmp/local/snmpconf.dir/snmptrapd-data/traphandle
--- tomato/release/src/router/snmp/local/snmpconf.dir/snmptrapd-data/traphandle	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/local/snmpconf.dir/snmptrapd-data/traphandle	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,17 @@
+title		Trap Handlers
+description	Here we define what programs are run when a trap is
+description	received by the trap receiver.
+
+token	    traphandle
+info	    When traps are received, a program can be run.
+info	    When traps are received, the list of configured trap
+info	    handles is consulted and any configured program is run.
+info	    If no handler is found, any handler with "default" as the
+info	    traphandle type is run instead.  The information contained
+info	    in trap is passed to the program via standard input (see
+info	    the snmptrapd.conf manual page for details).
+info	    #
+info	    arguments: oid|"default" program args
+question 1  The oid of the trap you want to handle.
+question 2  The program you want to run  If the program is a script, specify the script program first (ie /bin/sh /path/to/script).
+question 3  Arguments that you want passed to the program
diff -Naur tomato/release/src/router/snmp/local/snmp-ucd.sh tomato121/release/src/router/snmp/local/snmp-ucd.sh
--- tomato/release/src/router/snmp/local/snmp-ucd.sh	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/local/snmp-ucd.sh	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,187 @@
+#!/bin/sh
+#
+# snmpd-ucd.sh
+#
+# Start UCD SNMP daemon and trap catcher.  Backup the log file *first*
+# since currently the daemon truncates and overwrites any pre-existing file.
+#
+# killproc() and pidofproc() lifted from Linux's /etc/init.d/functions.
+#
+# NOTE: Solaris users must uncomment the proper PSARGS definition below.  XXX
+#
+
+USAGE="Usage: `basename $0` start|stop|restart"
+
+
+
+#------------------------------------ -o- 
+# Globals.
+#
+DAEMONLOG=/var/log/snmpd.log
+  TRAPLOG=/var/log/snmptrapd.log
+   LOGDIR=/var/log/SNMPDLOGS
+
+D=".`date '+%h%d_%H%M' | sed 's/\([a-z]\)0/\1/' | tr 'A-Z' 'a-z'`"
+
+PSARGS=auwwx
+#PSARGS=-ef		# Solaris.
+
+DEBUGFLAG=		# -D	# Toggles use of debugging
+
+
+
+
+#------------------------------------ -o- 
+# Function definitions.
+#
+killproc() {	# <program> [signal]
+	base= 
+	killlevel="-9" 
+	notset=1 
+	pid=
+
+
+	#
+	# Parse.
+	#
+	[ $# = 0 ] && {
+		echo "`basename $0`: Wrong arguments to killproc()." 1>&2
+		return 1
+	}
+	base="`basename $1`"
+	[ -n "$2" ] && {
+		killlevel=$2
+		notset=0
+	}
+
+
+	#
+	# Kill process.
+	#
+        pid=`pidofproc $base 2>/dev/null`
+	[ -z "$pid" ] && {
+		pid=`ps $PSARGS | egrep $base | egrep -v egrep | egrep -v $0 | awk '{ print $2 }'`;
+	}
+	[ -z "$pid" ] && {
+		echo "`basename $0`: killproc: Could not find process ID."
+	}
+
+        [ -n "$pid" ] && {
+                echo -n "$base "
+
+		#
+		# Kill with -TERM then -KILL by default.  Use given
+		# instead if one was passed in.
+		#
+		[ "$notset" = 1 ] && {
+			kill -TERM $pid
+			sleep 1
+
+			[ -n "`ps $PSARGS |
+					awk '{print $2}' | grep $pid`" ] && {
+				sleep 3
+				kill -KILL $pid
+			}
+
+			true
+		} || {
+	                kill $killlevel $pid
+		}
+	}
+
+        rm -f /var/run/$base.pid
+
+}  # end killproc()
+
+
+pidofproc() {	# <program>
+	pid=
+
+	[ $# = 0 ] && {
+		echo "`basename $0`: Wrong argument to pidofproc()."  1>&2
+		return 1
+	}
+
+	#
+	# Try looking for a /var/run file.
+	#
+	[ -f /var/run/$1.pid ] && {
+	        pid=`head -1 /var/run/$1.pid`
+
+	        [ -n "$pid" ] && {
+	                echo $pid
+	                return 0
+		}
+	}
+
+	#
+	# Try pidof.  (Linux offering.)
+	#
+	pid=`pidof $1`
+	[ -n "$pid" ] && {
+	        echo $pid
+	        return 0
+	}
+
+	#
+	# Try ps.
+	#
+	ps $PSARGS | awk '	BEGIN	{ prog=ARGV[1]; ARGC=1 } 
+			{	if ((prog == $11) ||
+					(("(" prog ")") == $11) ||
+						((prog ":") == $11))
+				{
+					print $2
+				}
+			}' $1
+}  # end pidofproc()
+
+
+
+#------------------------------------ -o- 
+# Action.
+#
+case "$1" in
+  start)
+	echo "Starting SNMP. "
+
+	cp $DAEMONLOG ${DAEMONLOG}$D
+	cp $TRAPLOG ${TRAPLOG}$D
+	cat /dev/null >$TRAPLOG
+
+	[ ! -e $LOGDIR ] && mkdir $LOGDIR
+	mv ${DAEMONLOG}$D ${TRAPLOG}$D $LOGDIR
+	gzip -r $LOGDIR	2>/dev/null &
+
+	snmpd -a -d -V $DEBUGFLAG
+	snmptrapd -P >>$TRAPLOG &
+
+	echo
+	;;
+
+  stop)
+	echo -n "Shutting down SNMP: "
+
+	killproc snmpd
+	killproc snmptrapd
+
+	echo
+	;;
+
+  restart)
+        $0 stop
+        $0 start
+        ;;
+
+  *)
+	echo $USAGE	1>&2
+	exit 1
+esac
+
+
+
+#------------------------------------ -o- 
+#
+exit 0
+
+
diff -Naur tomato/release/src/router/snmp/local/tkmib tomato121/release/src/router/snmp/local/tkmib
--- tomato/release/src/router/snmp/local/tkmib	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/local/tkmib	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,996 @@
+#!/usr/bin/perl
+#!/usr/bin/perl -w
+
+require 5;
+
+# attempt to determine if they have the proper modules installed.
+
+# SNMP
+my $havesnmp = eval {require SNMP;};
+
+# the Tk packages
+
+my $havetk = eval {require Tk;
+		   require Tk::Table;
+		   require Tk::HList;
+		   require Tk::FileSelect;
+		   require Tk::Dialog;};
+if (!$havesnmp) {
+    print "
+ERROR:  You don't have the SNMP perl module installed.  Please obtain this by
+getting the latest source release of the net-snmp toolkit from
+http://www.net-snmp.org/download/ .  The perl module is contained in
+the perl/SNMP directory.  See the INSTALL file there for
+instructions.
+";
+}
+
+if (!$havetk) {
+    print "
+ERROR:  You don't have the Tk module installed.  You should be able to
+install this by running (as root):
+
+    perl -MCPAN -e 'install Tk'
+";
+}
+
+if (!$havetk || !$havesnmp) {
+    print "\n";
+    exit;
+}
+
+if ($havetk) {
+  # Tk doesn't seem to like require so we force use here.
+    eval {import Tk;
+	  import Tk::Table;
+	  import Tk::HList;
+	  import Tk::FileSelect;
+	  import Tk::Dialog;
+          import SNMP;};
+}
+
+use Getopt::Std;
+use Data::Dumper;
+
+$host = 'localhost';
+$OID = '.1.3.6.1';
+$opts{'C'}=$ENV{'HOME'} . "/.snmp/tkmibrc";
+
+# default session options
+if (test_version(1,5,0,0)) {
+    print "setting opts\n";
+    %opts = (
+	     'c'          => "public",
+	     'p'   => 161,
+	     't'      => 5000000,
+	     'r'      => 5,
+	     'v'      => 1,
+	     'a'    => 'MD5',
+	     'x'    => 'DES',
+	     'A'     => '',
+	     'X'     => '',
+	     'n'      => '',
+	     'u'      => 'initial',
+	     'l'     => 'authNoPriv',
+	     );
+}
+
+getopts("hp:v:a:A:x:X:n:u:l:r:t:o:c:C", \%opts);
+
+sub usage {
+    print "
+tkmib [-C] [-o OID] [SNMPCMD arguments] [host]
+  -C CONFIG_FILE  load CONFIG_FILE after starting up. (default: ~/.snmp/tkmibrc)
+                  (use -C /dev/null to not read one).
+
+  See the snmpcmd manual page for related SNMPCMD arguments.  (Not all
+  options are currently supported.)
+";
+    exit();
+}
+
+usage() if ($opts{'h'});
+
+# initialize defaults, may be overridden by config file below
+@displayInfo=qw(type access status units hint moduleID enums indexes);
+@saveoptions = ('displayoidas', 'writecolor', 'graphtime', 'graphdelta');
+$displayoidas='full';
+$writecolor = "blue";
+$graphtime=5;
+$graphdelta=1;
+foreach $i (@displayInfo) {
+    $displayInfoStates{$i} = 1;
+}
+
+
+# source config file
+do $opts{'C'} if ($opts{'C'} && -f $opts{'C'});
+
+$session_opts{'UseLongNames'} => 1;
+$session_opts{'RemotePort'} = $opts{'p'} if ($opts{'p'});
+$session_opts{'Community'} = $opts{'c'} if ($opts{'c'});
+$session_opts{'Version'} = $opts{'v'} if ($opts{'v'});
+$session_opts{'AuthProto'} = $opts{'a'} if ($opts{'a'});
+$session_opts{'AuthPass'} = $opts{'A'} if ($opts{'A'});
+$session_opts{'PrivProto'} = $opts{'x'} if ($opts{'x'});
+$session_opts{'PrivPass'} = $opts{'X'} if ($opts{'X'});
+$session_opts{'Context'} = $opts{'n'} if ($opts{'n'});
+$session_opts{'SecName'} = $opts{'u'} if ($opts{'u'});
+$session_opts{'SecLevel'} = $opts{'l'} if ($opts{'l'});
+$session_opts{'Retries'} = $opts{'r'} if ($opts{'r'});
+$session_opts{'Timeout'} = $opts{'t'} if ($opts{'t'});
+
+$host = shift if ($#ARGV > -1);
+$session_opts{'Community'} = shift if ($#ARGV > -1);
+
+@graphcolors=qw(blue red green yellow purple);
+
+# initialize SNMP module
+$SNMP::save_descriptions=1;
+$SNMP::use_long_names=1;
+$SNMP::use_enums=1;
+$SNMP::verbose = 1;
+my $tmpbd = 1;
+
+$top = MainWindow->new();
+$top->title("tkmib");
+
+#Menus
+$MenuFrame = $top->Frame(-relief => "raised",-borderwidth => 2);
+$MenuFrame->pack(-fill => "x",-expand => 1);
+$FileMenuBut = $MenuFrame->Menubutton(-pady => $tmpbd, -padx => $tmpbd, -text => "File",
+				      -menuitems =>
+      [
+#       [Button => "Save Output", -command => [\&saveOutput]],
+       [Button => "Quit",        -command => [\&exit]]
+       ]);
+$FileMenuBut->pack(-side => 'left');
+
+$MibMenuBut = $MenuFrame->Menubutton(-pady => $tmpbd, -padx => $tmpbd, -text => "Mib",
+				      -menuitems =>
+      [[Button => "Find a mib node", 
+	-command => sub { my $var;
+			  entryBox("Find a Mib Node", 
+				   "Enter a mib node name to search for:",
+				   \$var, \&findANode );}],
+       [Button => "Load a New Mib File", -command => [\&loadNewMibFile]],
+       [Button => "Load a New Mib Module", 
+	-command => sub { my $var;
+			  entryBox("Load a Module", 
+				   "Enter a SNMP MIB module name to load:",
+				   \$var, \&loadIt);}]
+       ]);
+$MibMenuBut->pack(-side => 'left');
+
+$OptMenuBut = $MenuFrame->Menubutton(-pady => $tmpbd, -padx => $tmpbd, -text => "Options",
+				     -menuitems =>
+      [[Cascade => "~Display", -menuitems =>
+	[
+	 [Cascade => "~MIB Information"],
+	 [Cascade => "~OID Display", -menuitems =>
+	  [
+	   [Radiobutton => 'full', -variable => \$displayoidas],
+	   [Radiobutton => 'numeric', -variable => \$displayoidas],
+	   [Radiobutton => 'short', -variable => \$displayoidas],
+	   [Radiobutton => 'module', -variable => \$displayoidas]
+	   ]
+	  ],
+	 [Button => "Writable Color", 
+	  -command => [\&entryBox,"Writable Color",
+		       "Color for writable objects:",
+		       \$writecolor]]
+	 ]],
+       [Cascade => "Use SNMP Version", -menuitems =>
+	[
+	 [Radiobutton => '1', -variable => \$session_opts{'Version'}],
+	 [Radiobutton => '2c', -variable => \$session_opts{'Version'}],
+	 [Radiobutton => '3', -variable => \$session_opts{'Version'}]
+	]
+       ], # ends version number specification
+       [Cascade => "SNMPv1/2c options", -menuitems =>
+	[
+	 [Button => "Community Name", 
+	  -command => [\&entryBox,"Community Name", "Community name to use:", 
+		       \$session_opts{'Community'}]]
+	]
+       ],
+       [Cascade => "SNMP3 options", -menuitems =>
+	[
+	 [Button => "Security Name", 
+	  -command => [\&entryBox,"Security Name", "Security Name to use:", 
+		       \$session_opts{'SecName'}]],
+         [Cascade => "Security Level", -menuitems =>
+          [
+	   [Radiobutton => 'noAuthNoPriv',
+	    -variable => \$session_opts{'SecLevel'}],
+           [Radiobutton => 'authNoPriv', 
+	    -variable => \$session_opts{'SecLevel'}],
+	   [Radiobutton => 'authPriv', 
+            -variable => \$session_opts{'SecLevel'}]
+          ]
+         ],
+	 [Button => "Authentication Passphrase", 
+	  -command => [\&entryBox,"Authentication Passphrase", 
+		       "Authentication Passphrase to use:", 
+		       \$session_opts{'AuthPass'}]],
+         [Cascade => "Authentication Type", -menuitems =>
+          [
+	   [Radiobutton => 'MD5',
+	    -variable => \$session_opts{'AuthProto'}],
+	   [Radiobutton => 'SHA',
+	    -variable => \$session_opts{'AuthProto'}],
+          ]
+         ],
+	 [Button => "Privacy Passphrase", 
+	  -command => [\&entryBox,"Privacy Passphrase", 
+		       "Privacy Passphrase to use:", 
+		       \$session_opts{'PrivPass'}]],
+         [Cascade => "Privacy Type", -menuitems =>
+          [
+	   [Radiobutton => 'DES',
+	    -variable => \$session_opts{'PrivProto'}],
+          ]
+         ],
+	]
+       ],
+       [Button => "Time between graph polls", 
+	-command => sub { entryBox("graph polls", "Time between graph polls:", 
+				    \$graphtime);}],
+       [Button => "Port number", 
+	-command => sub { entryBox("Port Number", "SNMP Port number to use:", 
+				    \$session_opts{'RemotePort'});}],
+       [Button => "TimeOut", 
+	-command => sub { entryBox("Time Out", "Timeout for SNMP requests:", 
+				    \$session_opts{'Timeout'});}],
+       [Button => "Retries", 
+	-command => sub { entryBox("Retries", 
+				   "Number of Times to Retransmit Requests:", 
+				    \$session_opts{'Retries'});}],
+       [Button => "Save Options",
+	-command => \&save_options]
+       ])->pack(-side => 'left');
+        
+$tmp = $OptMenuBut->cget(-menu);
+$OptMenuWidgets = $tmp->entrycget("Display", -menu);
+$OptMenuWidgets = $OptMenuWidgets->entrycget("MIB Information", -menu);
+
+$hlist=$top->Scrolled(qw(HList -itemtype imagetext -browsecmd main::showInfo
+			 -command main::showChildren -width 80 -height 15));
+$hlist->pack(-side => 'top', -expand => 1, -fill => 'both');
+my $sFrame = $top->Frame(-relief => 'raised', -borderwidth => $tmpbd);
+$sFrame->pack(-side => 'top', -fill => 'x');
+$sFrame->Label(-pady => $tmpbd, -padx => $tmpbd, -text => 'OID: ', -relief => 'raised', -borderwidth => $tmpbd)
+    ->pack(-side => 'left');
+$mibOID = $sFrame->Entry(-textvariable => \$OID, -relief => 'flat', -width => 40);
+$mibOID->pack(-side => 'left');
+$mibTextOID = $sFrame->Label(-pady => $tmpbd, -padx => $tmpbd, -text => '');
+$mibTextOID->pack(-side => 'right');
+
+$dispFrame=$top->Frame(-relief => 'raised', -borderwidth => $tmpbd);
+$dispFrame->pack(-side => 'top', -fill =>'x');
+for($i=0;$i<= $#displayInfo;$i++) {
+    createRow($i) if ($displayInfoStates{$displayInfo[$i]});
+    optionalWidget($i,$OptMenuWidgets, \$displayInfoStates{$displayInfo[$i]});
+}
+    
+$descrFrame=$top->Frame(-relief => 'raised', -borderwidth => $tmpbd);
+$descrFrame->pack(-side => 'top', -fill =>'x');
+$descrFrame->Label(-pady => $tmpbd, -padx => $tmpbd, -text => 'Description:', -anchor => 'w')->pack(-side => 'top',
+								-fill => 'x');
+$descr = $descrFrame->Scrolled(qw(Text -width 80 -height 4));
+$descr->pack(-side => 'top', -fill => 'x');
+
+$bFrame = $top->Frame(-relief => 'raised', -borderwidth => $tmpbd);
+$bFrame->pack(-side => 'top', -fill => 'x');
+$hostEntry = $bFrame->Entry(-textvariable => \$host, -width => 12);
+$hostEntry->pack(-side => 'left');
+$bFrame->Button(-pady => $tmpbd, -padx => $tmpbd, -text => 'graph', -command => \&snmpgraph)->pack(-side => 'right');
+$tablebutton = $bFrame->Button(-pady => $tmpbd, -padx => $tmpbd, -text => 'table', -command => \&snmptable);
+$tablebutton->pack(-side => 'right');
+$bFrame->Button(-pady => $tmpbd, -padx => $tmpbd, -text => 'walk', -command => \&snmpwalk)->pack(-side => 'right');
+$bFrame->Button(-pady => $tmpbd, -padx => $tmpbd, -text => 'getnext', -command => \&snmpgetnext)->pack(-side => 'right');
+$bFrame->Button(-pady => $tmpbd, -padx => $tmpbd, -text => 'get', -command => \&snmpget)->pack(-side => 'right');
+$bFrame->Button(-pady => $tmpbd, -padx => $tmpbd, -text => 'set', -command => [\&snmpsetbegin, 'OID'])->pack(-side => 'right');
+$stopBut = $bFrame->Button(-pady => $tmpbd, -padx => $tmpbd, -text => 'stop', -command => sub { stop(1) },
+			   -state => 'disabled');
+$stopBut->pack(-side => 'right');
+$oFrame = $top->Frame(-borderwidth => $tmpbd, -relief => 'raised');
+$oFrame->pack(-side => 'top', -fill => 'both');
+$output = $oFrame->Scrolled(qw(Text -width 80 -height 14));
+$output->pack(-side => 'top', -fill => 'both', -expand => 1);
+
+$tmpFrame = $top->Frame(-relief => 'raised', -borderwidth => $tmpbd);
+$tmpFrame->pack(-side => 'top', -fill => 'x');
+$tmpFrame->Label(-pady => $tmpbd, -padx => $tmpbd, -text => "Status:  ", -anchor => 'w')
+#		 -relief => 'raised', -borderwidth => $tmpbd)
+    ->pack(-side => 'left');
+$status = $tmpFrame->Label(-pady => $tmpbd, -padx => $tmpbd, -anchor => 'w');
+$status->pack(-side => 'left', -fill => 'x');
+
+# initialize the browser
+foreach $i (qw(.1 .1.3 .1.3.6 .1.3.6.1)) {
+    addMibOID($i);
+}
+showChildren("$OID");
+if (defined($opts{'o'})) {
+    findANode($opts{'o'});
+}
+
+MainLoop();
+
+sub insertresult {
+    my $oid = shift;
+    my $val = shift;
+    $oid = $OID if ($oid eq "OID");
+    $output->insert('end', $oid, "oid:$oid");
+    $output->tagBind("oid:$oid", '<1>', [sub{shift; 
+					     my $oid = shift;
+					     findANode($oid);
+					     my $tag = SNMP::translateObj($oid);
+					     showInfo($tag);},$oid]);
+    $output->insert('end', " = ");
+    my $mib = $SNMP::MIB{format_oid("$oid",'numeric')};
+    $output->insert('end', $val, "value:$oid");
+    if ($mib->{'access'} =~ /(Write|Create)/) {
+	$output->tagConfigure("value:$oid", -foreground => $writecolor);
+	$output->tagBind("value:$oid", '<1>', [sub{shift; 
+						   my $oid = shift;
+						   my $value = shift;
+						   snmpsetmaybebegin($oid, $value);
+						   findANode($oid);
+						   my $tag = SNMP::translateObj($oid);
+						   showInfo($tag);},format_oid($oid,'full'), $val]);
+    }
+    $output->insert('end', "\n");
+}
+
+sub insertvar {
+    my $var = shift;
+    my $name = get_oid($var);
+
+    insertresult($name,"$var->[$SNMP::Varbind::val_f]");
+}
+
+sub snmpsetup {
+    my $oid = $OID;
+    my $tag = SNMP::translateObj($oid);
+    my $sess = new SNMP::Session(DestHost => $host, %session_opts);
+    my $var = new SNMP::Varbind([$oid]);
+    if (!defined($var)) {
+	print "ack:  $@ $SNMP::ErrorStr $!\n";
+    }
+    stop(0);
+    initText();
+    $oid = "." . $oid if ($oid !~ /^\./);
+    return ($oid, $sess, $var);
+}
+
+sub initText {
+    if (ref($output) eq "Tk::Frame" && defined($$output{'_#text'})) {
+	$output->delete('0.0','end');
+    } else {
+	$output->destroy();
+	$output = $oFrame->Scrolled(qw(Text -width 80 -height 14));
+	$output->pack(-side => 'top', -fill => 'both', -expand => 1);
+    }
+}
+
+sub initTable {
+    $output->destroy();
+    $oFrame->packPropagate(0);
+    $output = $oFrame->Table(-columns => shift, -width => 80, -height => 14,
+			     -fixedrows => 2, -fixedcolumns => 1);
+    $output->pack(-side => 'top', -fill => 'both', -expand => 1);
+}
+
+sub initCanvas {
+    $output->destroy();
+    $oFrame->packPropagate(0);
+    $output = $oFrame->Scrolled(qw(Canvas -width 80c -height 14c));
+    $output->pack(-side => 'top', -fill => 'both', -expand => 1);
+}
+
+sub snmpget {
+    (my $oid, my $sess, my $var) = snmpsetup();
+    $status->configure(-text => "getting:  $host $community $oid");
+    $top->update();
+    my $val = $sess->get($var);
+    if ($sess->{ErrorStr}) {
+	$status->configure(-text => $sess->{ErrorStr});
+    } else {
+	insertvar($var);
+	$status->configure(-text => "");
+    }
+}
+
+sub snmpsetbegin {
+    my $startoid = shift;
+    my $startval = shift;
+    my $setwin = MainWindow->new();
+    $setwin->title("SNMP set");
+    my $varswin = $setwin->Frame(-relief => "raised",-borderwidth => $tmpbd);
+    my $vars = new SNMP::VarList;
+    $varswin->pack(-side => 'top');
+    my $buttons = $setwin->Frame(-relief => "raised")->pack(-side => 'top', -fill => "x",-expand => 1);
+    $buttons->Button(-pady => $tmpbd, -padx => $tmpbd, -text => 'Add a varbind', -command => [\&snmpsetbegin_addvar, $vars, $varswin, 'OID'])->pack(-side => 'left', -fill => "x",-expand => 1);
+    $buttons->Button(-pady => $tmpbd, -padx => $tmpbd, -text => 'perform set', -command => [\&snmpsetbegin_ok, $vars, $setwin, $varswin])->pack(-side => 'left');
+    $buttons->Button(-pady => $tmpbd, -padx => $tmpbd, -text => 'Cancel', -command => [sub { my $widget = shift; $varswin = shift; if ($setmain == $varswin) { $setmain = undef; } $widget->destroy();}, $setwin, $varswin])->pack(-side => 'right');
+    if ($startoid ne "") {
+	snmpsetbegin_addvar($vars, $varswin, $startoid, $startval);
+    }
+    if (!$setmain) {
+	$setmain = $varswin;
+	$setvars = $vars;
+    }
+}
+
+sub make_enum_button {
+    my $win = shift;
+    my $var = shift;
+    my @objs;
+    foreach my $i (@_) {
+	push @objs,[Radiobutton => $i, -variable => $var];
+    }
+    return $win->Menubutton(-pady => $tmpbd, -padx => $tmpbd, -textvariable => $var,
+			    -relief => raised,
+			    -menuitems => \@objs);
+}
+
+sub snmpsetmaybebegin {
+    my ($oid, $val) = @_;
+    if ($setmain) {
+	snmpsetbegin_addvar($setvars, $setmain, $oid, $val);
+    } else {
+	snmpsetbegin($oid, $val);
+    }
+}
+
+
+sub snmpsetbegin_addvar {
+    my ($vars, $place, $oid, $val) = @_;
+    $oid = $OID if ($oid eq "OID");
+    my $mib = $SNMP::MIB{format_oid("$oid",'numeric')};
+    my $var = new SNMP::Varbind([$oid, '', $val, $mib->{'type'} || 'INTEGER']);
+    push @$vars,$var;
+    my $frame = $place->Frame();
+    $frame->Entry(-textvariable => \$var->[0], -width => 20)->pack(-side => 'left');
+    make_enum_button($frame, \$var->[3], qw(OBJECTID OCTETSTR INTEGER NETADDR IPADDR COUNTER COUNTER64 GAUGE UINTEGER TICKS OPAQUE NULL))->pack(-side => 'left');
+    if (ref($mib->{'enums'}) eq HASH && scalar(keys(%{$mib->{'enums'}})) > 0) {
+	make_enum_button($frame, \$var->[2], keys(%{$mib->{'enums'}}))->pack(-side => 'left');
+    } else {
+	$frame->Entry(-textvariable => \$var->[2])->pack(-side => 'left');
+    }
+    $frame->pack(-expand => 1, -fill => 'x');
+}
+
+sub snmpsetbegin_ok {
+    my ($vars, $win, $frame) = @_;
+    snmpset($vars);
+    $setmain = undef if ($setmain == $frame);
+    $win->destroy();
+}
+
+sub snmpset {
+    my $vars = shift;
+    (my $oid, my $sess, my $var) = snmpsetup();
+    $status->configure(-text => "setting:  $host -> " . Dumper($vars) . "\n");
+    $top->update();
+    my $val = $sess->set($vars);
+    if ($sess->{ErrorStr}) {
+	$output->insert('end', "Set failed.\nReason:  $sess->{ErrorStr}");
+	$status->configure(-text => $sess->{ErrorStr});
+    } else {
+	foreach my $i (@$vars) {
+	    insertvar($i);
+	}
+	$status->configure(-text => "");
+    }
+}
+
+sub snmpgetnext {
+    (my $oid, my $sess, my $var) = snmpsetup();
+    $status->configure(-text => "get next:  $host $community $oid");
+    $top->update();
+    my $val = $sess->getnext($var);
+    if ($sess->{ErrorStr}) {
+	$status->configure(-text => $sess->{ErrorStr});
+    } else {
+	insertvar($var);
+	$status->configure(-text => "");
+    }
+}
+
+sub snmpwalk {
+    (my $oid, my $sess, my $var) = snmpsetup();
+    $status->configure(-text => "walking:  $host $community $oid");
+    $top->update();
+    while (!$sess->{ErrorStr} && !$stopit) {
+	my $val = $sess->getnext($var);
+	last if (!defined($var->tag) ||
+		 $sess->{ErrorStr} ||
+		 $val eq "ENDOFMIBVIEW" ||
+	         !is_in_subtree($oid, $var->tag . "." . $var->iid));
+	insertvar($var);
+	$top->update();
+    }
+    if ($sess->{ErrorStr}) {
+	$status->configure(-text => $sess->{ErrorStr});
+	$output->insert('end',"$sess->{ErrorStr} ($sess->{ErrorNum})\n");
+    } else {
+	$status->configure(-text => "");
+    }
+    stop(1);
+}
+
+sub snmptable {
+    (my $oid, my $sess, my $var) = snmpsetup();
+    $status->configure(-text => "collecting data:  $host $community $oid");
+    $top->update();
+    my (%tb, @tags, @index, %tboids);
+    while (!$sess->{ErrorStr} && !$stopit) {
+	my $val = $sess->getnext($var);
+	last if (!defined($var->tag) ||
+		 $sess->{ErrorStr} ||
+		 $val eq "ENDOFMIBVIEW" ||
+	         !is_in_subtree($oid, $var->tag . "." . $var->iid));
+	$newoid = "$var->[$SNMP::Varbind::tag_f].$var->[$SNMP::Varbind::iid_f]";
+	insertvar($var);
+	$top->update();
+	$newoid =~ /([^\.]+)\.([0-9\.]+)$/;
+	if (!grep(/$1/,@tags)) {
+	    push @tags,$1;
+	}
+	if (!grep(/$2/,@index)) {
+	    push @index,$2;
+	}
+	$tb{$2}{$1} = $var->val;
+#	$tboids{$2}{$1} = $var->tag;
+	$tboids{$2}{$1} = $newoid;
+    }
+    initTable($#tags+1);
+    for(my $k=0;$k <= $#tags;$k++) {
+	$output->put(1,$k+2,$tags[$k]);
+    }
+    $output->put(1,1,"Index");
+    for(my $i=0;$i <= $#index;$i++) {
+	$output->put($i+2,1,$index[$i]);
+    }
+    for(my $i=0;$i <= $#index; $i++) {
+	for(my $k=0;$k <= $#tags;$k++) {
+	    my $mib = $SNMP::MIB{format_oid("$tboids{$index[$i]}{$tags[$k]}",'numeric')};
+	    if ($mib->{'access'} =~ /(Write|Create)/) {
+		$output->put($i+2,$k+2,$output->Button(-fg => $writecolor, -pady => $tmpbd, -padx => $tmpbd, -text => $tb{$index[$i]}{$tags[$k]}, -command => [\&snmpsetmaybebegin, $tboids{$index[$i]}{$tags[$k]}, $tb{$index[$i]}{$tags[$k]}], -padx => 0, -pady => 0));
+	    } else {
+		$output->put($i+2,$k+2,$tb{$index[$i]}{$tags[$k]});
+	    }
+	}
+    }
+    $status->configure(-text => "");
+    stop(1);
+}
+
+sub snmpgraph {
+    ($graphoid, $graphsess, my $graphvar) = snmpsetup();
+    $top->update();
+    %graphtb = ();
+    @graphvars = ();
+    initCanvas();
+    $gcount=0;
+    $max=-1;
+    $min=2**32-1;
+    updateGraph();
+    $output->repeat($graphtime*1000, \&updateGraph);
+}
+
+sub updateGraph() {
+    $status->configure(-text => "collecting data:  $host $community $graphoid");
+    my $oid = $graphoid;
+    my $tag = SNMP::translateObj($graphoid,0);
+    my $var = new SNMP::Varbind([$oid]);
+    $graphsess->{ErrorStr} = "";    
+    while (!$graphsess->{ErrorStr} && !$stopit) {
+	my $val = $graphsess->getnext($var);
+	if ($#graphvars == -1 && SNMP::translateObj($var->tag) !~ /^$oid/) {
+	    # if an exact oid, do a get instead.
+	    $var = new SNMP::Varbind([$oid]);
+	    $val = $graphsess->get($var);
+	}
+	if ($graphsess->{ErrorStr} ||
+	    !defined($var->tag) ||
+	    SNMP::translateObj($var->tag) !~ /^$oid/) {
+	    last;
+	}
+	my $newoid = SNMP::translateObj("$var->[$SNMP::Varbind::tag_f].$var->[$SNMP::Varbind::iid_f]");
+	$top->update();
+	$newoid =~ /$oid\.([0-9\.]+)$/;
+	if (defined($1)) {
+	    if (!grep(/$1/,@graphvars)) {
+		push @graphvars,$1;
+	    }
+	    if ($graphdelta) {
+		if ($gcount > 0) {
+		    $graphtb{$1}[$gcount-1] = $var->val - $prev{$1};
+		}
+		$prev{$1} = $var->val;
+	    } else {
+		$graphtb{$1}[$gcount] = $var->val;
+	    }
+	    $max = $graphtb{$1}[$#{$graphtb{$1}}] 
+		if ($#{$graphtb{$1}} >= 0 &&
+		    $graphtb{$1}[$#{$graphtb{$1}}] > $max);
+	    $min = $graphtb{$1}[$#{$graphtb{$1}}] 
+		if ($#{$graphtb{$1}} >= 0 &&
+		    $graphtb{$1}[$#{$graphtb{$1}}] < $min);
+	}
+    }
+    if ($gcount > 1) {
+	$output->delete('all');
+	my $canvas = $$output{'SubWidget'}{'canvas'};
+	my $h=$canvas->cget(-height);
+	foreach $i (@graphvars) {
+	    my @a = ();
+	    for(my $j=0; $j <= $#{$graphtb{$i}}; $j++) {
+		$a[$j*2] = $j;
+		$a[$j*2+1] = $h-(($h-3)*($graphtb{$i}[$j]-$min))/($max-$min)-3;
+	    }
+	    $output->createLine(@a, -fill => $graphcolors[$i%$#graphcolors]);
+	}
+	$output->create('text',5, $h-3, -text => "$max");
+	$output->create('text',5, 3, -text => "$min");
+    }
+    $gcount++;
+    $status->configure(-text => "sleeping for $graphtime seconds");
+}
+
+sub addMibOID {
+    my $i = shift;
+    $i = ".$i" if ($i !~ /^\./);
+    my $name = SNMP::translateObj($i,1);
+    if (defined($name)) {
+	$name =~ s/.*\.([^.]+)$/$1/;
+    } else {
+	return;
+    }
+    $i =~ s/^\.//;
+    $hlist->add($i, -text => $name);
+}
+
+sub showInfo {
+    my $full = shift;
+    $full = ".$full" if ($full !~ /^\./);
+    my $oid = $full;
+    my $tag = $oid;
+
+    if ($tag =~ /^[.0-9]+$/) {
+	# strip off index in case there is one
+	$tag = SNMP::translateObj("$oid");
+	$tag = ".iso.org.dod.internet.private.$tag" if $tag =~ /^enterprises/;
+    } else {
+	$full = SNMP::translateObj("$oid");
+    }
+
+    $tag =~ s/[.0-9]+$//;
+    $oid = SNMP::translateObj($tag);
+	
+    if (!defined($last) || "$last" ne $oid) {
+	updateInfo($oid);
+    }
+    $OID = $full;
+    $mibOID->configure(-textvariable => \$OID);
+    $mibOID->update();
+    $last = $oid;
+}
+	
+sub showAllChildren {
+    my $id = shift;
+    $id =~ s/^\.//;
+    my @pieces = split(/\./,$id);
+    my ($i, $lastvalid);
+    for($i = 0; $i <= $#pieces; $i++) {
+	my $a = join(".", @pieces[0..$i]);
+	if ($hlist->infoExists($a) && !($hlist->infoChildren($a))) {
+	    showChildren(join(".", $a));
+	}
+	if ($hlist->infoExists($a)) {
+	    $lastvalid = $a;
+	} else {
+	    last;
+	}
+    }
+    $hlist->see($lastvalid);
+    $hlist->selectionClear($hlist->selectionGet);
+    $hlist->selectionSet($lastvalid);
+}
+
+sub showChildren {
+    $OID = shift;
+    $OID =~ s/^\.//;
+    my $oid = $OID;
+    $mibOID->configure(-textvariable => \$OID);
+    if ($hlist->infoChildren($oid)) {
+	my @a = $hlist->infoChildren($oid);
+	my $i;
+	foreach $i (@a) {
+	    $hlist->deleteEntry($i);
+	}
+    } else {
+	$oid = ".$oid";
+	my $mib = $SNMP::MIB{format_oid($oid,'full')};
+	if (defined($mib)) {
+	    my $children = $$mib{'children'}; 
+	    if (ref($children) eq "ARRAY") {
+		foreach $i (sort {$$a{'subID'} <=> $$b{'subID'}} @{$children}) {
+		    addMibOID($$i{'objectID'});
+		}
+	    } else {
+		$status->configure(-text => SNMP::translateObj($oid,1) . 
+				   " has no children");
+		return;
+	    }
+	}
+    }
+    $status->configure(-text => "");
+}
+
+sub updateInfo {
+    $OID = shift;
+    my $oid = $OID;
+    my $mib = $SNMP::MIB{format_oid("$oid",'numeric')};
+    if (!defined($mib->{'description'}) || $mib->{'description'} eq "") {
+	$oid =~ s/[.0-9]+$//;
+	$mib = $SNMP::MIB{format_oid("$oid",'numeric')};
+    }
+    if (defined($mib)) {
+	if ($mib->{'label'} =~ /Table$/) {
+	    $tablebutton->configure(-state => 'normal');
+	} else {
+	    $tablebutton->configure(-state => 'disabled');
+	}
+	$mibOID->configure(-text => $mib->{'objectID'});
+	$mibTextOID->configure(-text => 
+			     SNMP::translateObj($mib->{'objectID'},1));
+	$descr->delete('0.0','end');
+	if (defined($mib->{'description'}) && 
+	    $mib->{'description'} ne "") {
+	    my $desc = $mib->{'description'};
+	    $desc =~ s/\n[ \t]+/\n/g;
+ 	    $desc =~ s/^\n//;
+	    $descr->insert('end',$desc);
+	}
+	for($i=0; $i<= $#displayInfo;$i++) {
+	    $dpyInfo[$i] = $mib->{$displayInfo[$i]};
+	    if (ref($dpyInfo[$i]) eq HASH) {
+		my %hash = %{$dpyInfo[$i]};
+		$dpyInfo[$i] = "";
+		foreach $j (sort { $hash{$a} <=> $hash{$b} } keys(%hash)) {
+		    $dpyInfo[$i] .= "$j = $hash{$j},";
+		}
+	    } elsif (ref($dpyInfo[$i]) eq ARRAY) {
+		$dpyInfo[$i] = join(", ", @{$dpyInfo[$i]});
+	    }
+	}
+    }
+}
+
+sub optionalWidget {
+    my $num = shift;
+    my $menu = shift;
+    my $var = shift;
+    $menu->checkbutton(-label => $displayInfo[$num], 
+		       -variable => $var,
+		       -command => [\&toggleWidgetShown, $num, $var]);
+}
+
+sub createRow {
+    my $i = shift;
+    if (!$displayLabels[$i]) {
+	$displayLabels[$i] = $dispFrame->Label(-pady => $tmpbd, -padx => $tmpbd,
+					       -text => $displayInfo[$i], 
+					       -anchor => 'w',
+					       -borderwidth => $tmpbd);
+    }
+    if (!$displayEntries[$i]) {
+	$displayEntries[$i] = $dispFrame->Entry(-textvariable => \$dpyInfo[$i],
+						-width => 40, -relief => 'flat',
+						-borderwidth => $tmpbd);
+    }
+    $displayLabels[$i]->grid(-ipady => $tmpbd, -ipadx => $tmpbd,
+			     -column => ($i%2)*2, -row => int($i/2),
+			     -sticky => 'w');
+    $dpyInfo[$i] = "" if (!defined($dpyInfo[$i]));
+    $displayEntries[$i]->grid(-ipady => $tmpbd, -ipadx => $tmpbd, -column => ($i%2)*2 + 1, -row => int($i/2), -sticky => 'w');
+}
+
+sub toggleWidgetShown {
+    my ($num, $var) = @_;
+    if ($$var) {
+	createRow($num);
+    } else {
+	$displayLabels[$num]->gridForget();
+	$displayEntries[$num]->gridForget()
+    }
+#    my @widgets = $dispFrame->gridSlaves(-row => $num);
+}
+
+sub loadNewMibFile {
+    my $sel = $top->FileSelect();
+    my $file = $sel->Show();
+    if (defined($file)) {
+      SNMP::addMibFiles($file);
+	showChildren("1.3.6.1");
+	showChildren("1.3.6.1");
+    }
+}
+
+sub loadNewMibModule {
+    my $tmptop = MainWindow->new();
+    my $var = "";
+    $tmptop->Label(-pady => $tmpbd, -padx => $tmpbd, -text => "Enter a SNMP MIB module name")
+	->pack(-side => 'top');
+    my $e = $tmptop->Entry(-textvariable => \$var);
+    $e->pack(-side => 'top');
+    $e->bind('<Return>',[\&loadIt,\$var,$tmptop]);
+    my $f = $tmptop->Frame();
+    $f->pack(-side => 'top');
+    $f->Button(-pady => $tmpbd, -padx => $tmpbd, -text => 'Ok', -command => [\&loadIt,"",\$var,$tmptop])
+	->pack(-side => 'left');
+    $f->Button(-pady => $tmpbd, -padx => $tmpbd, -text => 'Cancel', -command => [sub { my $wid = shift;
+						     $wid->destroy(); },
+					       $tmptop])
+	->pack(-side => 'left');
+}
+
+sub loadIt {
+    my $var = shift;
+    if ($var ne "") {
+        my $ret = SNMP::loadModules($var);
+	if ($ret) {
+	    showChildren("1.3.6.1");
+	    showChildren("1.3.6.1");
+	    return 1;
+	} else {
+	    $status->configure(-text => "Failed reading module $var");
+	    return 0;
+	}
+    }
+    return 0;
+}
+
+sub stop {
+    $stopit = shift;
+    if ($stopit) {
+	$stopBut->configure(-state => 'disabled');
+    } else {
+	$stopBut->configure(-state => 'normal');
+    }
+}
+
+sub entryBox {
+    my $title = shift;
+    my $text = shift;
+    my $var = shift;
+    my $callback = shift;
+    my $top = MainWindow->new();
+    my $newvar = $$var if defined($var);
+    $top->title($title);
+    my $f = $top->Frame();
+    $f->pack(-side => 'top');
+    $f->Label(-pady => $tmpbd, -padx => $tmpbd,
+	      -text => $text)->pack(-side => 'left');
+    my $e = $f->Entry(-textvariable => \$newvar);
+    $e->pack(-side => 'left');
+    $f = $top->Frame();
+    $f->pack(-side => 'bottom');
+    my $b = $f->Button(-pady => $tmpbd, -padx => $tmpbd, -text => 'Ok', 
+		       -command => [sub { my $w = shift;
+					  my $v1 = shift;
+					  my $v2 = shift;
+					  my $call = shift;
+					  my $ret = 1;
+					  $$v1 = $$v2 if defined($v1);
+					  $ret = $call->($$v2) 
+					      if defined($call);
+					  $w->destroy() if ($ret);}, $top, $var,
+				    \$newvar, $callback]);
+    $b->pack(-side => 'left');
+    $e->bind('<Return>',[$b,'invoke']);
+    $b = $f->Button(-pady => $tmpbd, -padx => $tmpbd, 
+		    -text => 'Cancel', -command => [sub { my $w = shift;
+							  $w->destroy();}, $top
+						    ]);
+    $b->pack(-side => 'right');
+    $e->bind('<Escape>',[$b,'invoke']);
+    
+}
+
+sub findANode {     
+    my $val = shift;
+    my $tag = SNMP::translateObj($val);
+    if ($tag) {
+	showAllChildren($tag);
+	return 1;
+    } else {
+	$top->Dialog(-text => "$val not found")->Show();
+	return 0;
+    }
+}
+
+sub test_version {
+    my ($gt, $major, $minor, $sub) = @_;
+    $SNMP::VERSION =~ /(\d)\.(\d).(\d)/;
+    if ($gt) {
+	if ($1 > $major || ($1 == $major && $2 > $minor) || 
+	    ($1 == $major && $2 == $minor && $3 >= $sub)) {
+	    return 1;
+	}
+    } else {
+	if ($1 < $major || ($1 == $major && $2 < $minor) || ($1 == $major && $2 == $minor && $3 < $sub)) {
+	    return 1;
+	}
+    }
+    return 0;
+}
+
+sub save_options {
+    my $umask = umask();
+    umask 0077; # make sure its not readable by the world by default.
+    if (!open(O,">$opts{C}")) {
+	warn "can't save to $opts{C}\n";
+	umask $umask;
+	return;
+    }
+    umask $umask;
+    print O Data::Dumper->Dump([\%session_opts], [qw(*session_opts)]);
+    print O Data::Dumper->Dump([\%displayInfoStates], [qw(*displayInfoStates)]);
+    foreach my $var (@saveoptions) {
+	print O Data::Dumper->Dump([$$var], [$var]);
+    }
+    close(O);
+    $status->configure(-text => "saved options to $opts{C}");
+}
+
+# returns 1 if $oid2 is below $oid1 in the hierarchy
+sub is_in_subtree {
+    my ($oid1, $oid2) = @_;
+    # get pure numeric
+    $oid1 = SNMP::translateObj($oid1) if ($oid1 !~ /^[\d\.]*$/);
+    $oid2 = SNMP::translateObj($oid2) if ($oid2 !~ /^[\d\.]*$/);
+
+    # has more on it or is exactly the same
+    return 1 if ($oid2 =~ /^$oid1\./ || $oid2 =~ /^$oid1$/);
+    return 0;
+}
+
+sub format_oid {
+    my ($oid, $type) = @_;
+    $oid =~ s/\.$//;
+    $type = $displayoidas if ($type eq "");
+
+    if ($type eq 'numeric') {
+	return SNMP::translateObj($oid) if ($oid !~ /^[\d\.]*$/);
+	return $oid;
+    } elsif ($type eq 'full') {
+	return SNMP::translateObj($oid, 1) if ($oid =~ /^[\d\.]*$/);
+	return SNMP::translateObj(SNMP::translateObj($oid), 1) if ($oid !~ /^\./);
+	return $oid;
+    } elsif ($type eq 'short' || $type eq 'module') {
+	$oid = SNMP::translateObj($oid) if ($oid =~ /^[\d\.]*$/);
+	$oid =~ s/.*\.([a-zA-Z]\w+)\.(.*)/$1.$2/;
+	if ($type eq 'module') {
+	    $oid = $SNMP::MIB{format_oid($oid,'numeric')}->{'moduleID'} . "::" . $oid;
+	}
+	return $oid;
+    } elsif ($type eq 'module') {
+	$oid = SNMP::translateObj($oid) if ($oid =~ /^[\d\.]*$/);
+	$oid =~ s/.*\.([a-zA-Z]\w+)\.(.*)/$1.$2/;
+	return $oid;
+    } else {
+	warn 'unknown oid translation type: $type';
+	return $oid;
+    }
+}
+
+sub get_oid {
+    my ($var, $type) = @_;
+    return format_oid($var->tag . "." . $var->iid, $type);
+}
diff -Naur tomato/release/src/router/snmp/local/traptoemail tomato121/release/src/router/snmp/local/traptoemail
--- tomato/release/src/router/snmp/local/traptoemail	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/local/traptoemail	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,72 @@
+#!/usr/bin/perl
+
+# This is a snmptrapd handler script to convert snmp traps into email
+# messages.
+
+# Usage:
+# Put a line like the following in your snmptrapd.conf file:
+#  traphandle TRAPOID|default /usr/local/bin/traptoemail [-f FROM] [-s SMTPSERVER]b ADDRESSES
+#     FROM defaults to "root"
+#     SMTPSERVER defaults to "localhost"
+
+use Net::SMTP;
+use Getopt::Std;
+
+$opts{'s'} = "localhost";
+$opts{'f'} = 'root@' . `hostname`;
+chomp($opts{'f'});
+getopts("hs:f:", \%opts);
+
+if ($opts{'h'}) {
+    print "
+traptoemail [-s smtpserver] [-f fromaddress] toaddress [...]
+
+  traptoemail shouldn't be called interatively by a user.  It is
+  designed to be called as an snmptrapd extension via a \"traphandle\"
+  directive in the snmptrapd.conf file.  See the snmptrapd.conf file for
+  details.
+
+  Options:
+    -s smtpserver      Sets the smtpserver for where to send the mail through.
+    -f fromaddress     Sets the email address to be used on the From: line.
+    toaddress          Where you want the email sent to.
+
+";
+    exit;
+}
+
+die "no recepients to send mail to" if ($#ARGV < 0);
+
+# process the trap:
+$hostname = <STDIN>;
+chomp($hostname);
+$ipaddress = <STDIN>;
+chomp($ipaddress);
+
+$maxlen = 0;
+while(<STDIN>) {
+    ($oid, $value) = /([^\s]+)\s+(.*)/;
+    push @oids, $oid;
+    push @values, $value;
+    $maxlen = (length($oid) > $maxlen) ? length($oid) : $maxlen;
+}
+$maxlen = 60 if ($maxlen > 60);
+$formatstr = "%" . $maxlen . "s  %s\n";
+
+die "illegal trap" if ($#oids < 1);
+
+# send the message
+$message = Net::SMTP->new($opts{'s'}) || die "can't talk to server $opts{'s'}\n";
+$message->mail($opts{'f'});
+$message->to(@ARGV) || die "failed to send to the recepients ",join(",",@ARGV),": $!";
+$message->data();
+$message->datasend("To: " . join(", ",@ARGV) . "\n");
+$message->datasend("From: $opts{f}\n");
+$message->datasend("Subject: trap received from $hostname: $varbinds[1]\n");
+$message->datasend("\n");
+$message->datasend("Host: $hostname ($ipaddress)\n");
+for($i = 0; $i <= $#oids; $i++) {
+    $message->datasend(sprintf($formatstr, $oids[$i], $values[$i]));
+}
+$message->dataend();
+$message->quit;
diff -Naur tomato/release/src/router/snmp/ltmain.sh tomato121/release/src/router/snmp/ltmain.sh
--- tomato/release/src/router/snmp/ltmain.sh	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/ltmain.sh	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,5062 @@
+# ltmain.sh - Provide generalized library-building support services.
+# NOTE: Changing this file will not affect anything until you rerun configure.
+#
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001
+# Free Software Foundation, Inc.
+# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# Check that we have a working $echo.
+if test "X$1" = X--no-reexec; then
+  # Discard the --no-reexec flag, and continue.
+  shift
+elif test "X$1" = X--fallback-echo; then
+  # Avoid inline document here, it may be left over
+  :
+elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then
+  # Yippee, $echo works!
+  :
+else
+  # Restart under the correct shell, and then maybe $echo will work.
+  exec $SHELL "$0" --no-reexec ${1+"$@"}
+fi
+
+if test "X$1" = X--fallback-echo; then
+  # used as fallback echo
+  shift
+  cat <<EOF
+$*
+EOF
+  exit 0
+fi
+
+# The name of this program.
+progname=`$echo "$0" | ${SED} 's%^.*/%%'`
+modename="$progname"
+
+# Constants.
+PROGRAM=ltmain.sh
+PACKAGE=libtool
+VERSION=1.4.3
+TIMESTAMP=" (1.922.2.110 2002/10/23 01:39:54)"
+
+default_mode=
+help="Try \`$progname --help' for more information."
+magic="%%%MAGIC variable%%%"
+mkdir="mkdir"
+mv="mv -f"
+rm="rm -f"
+
+# Sed substitution that helps us do robust quoting.  It backslashifies
+# metacharacters that are still active within double-quoted strings.
+Xsed="${SED}"' -e 1s/^X//'
+sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'
+# test EBCDIC or ASCII                                                         
+case `echo A|od -x` in                                                         
+ *[Cc]1*) # EBCDIC based system                                                
+  SP2NL="tr '\100' '\n'"                                                       
+  NL2SP="tr '\r\n' '\100\100'"                                                 
+  ;;                                                                           
+ *) # Assume ASCII based system                                                
+  SP2NL="tr '\040' '\012'"                                                     
+  NL2SP="tr '\015\012' '\040\040'"                                             
+  ;;                                                                           
+esac                                                                           
+
+# NLS nuisances.
+# Only set LANG and LC_ALL to C if already set.
+# These must not be set unconditionally because not all systems understand
+# e.g. LANG=C (notably SCO).
+# We save the old values to restore during execute mode.
+if test "${LC_ALL+set}" = set; then
+  save_LC_ALL="$LC_ALL"; LC_ALL=C; export LC_ALL
+fi
+if test "${LANG+set}" = set; then
+  save_LANG="$LANG"; LANG=C; export LANG
+fi
+
+# Make sure IFS has a sensible default
+: ${IFS=" 	"}
+
+if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
+  echo "$modename: not configured to build any kind of library" 1>&2
+  echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
+  exit 1
+fi
+
+# Global variables.
+mode=$default_mode
+nonopt=
+prev=
+prevopt=
+run=
+show="$echo"
+show_help=
+execute_dlfiles=
+lo2o="s/\\.lo\$/.${objext}/"
+o2lo="s/\\.${objext}\$/.lo/"
+
+# Parse our command line options once, thoroughly.
+while test $# -gt 0
+do
+  arg="$1"
+  shift
+
+  case $arg in
+  -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;;
+  *) optarg= ;;
+  esac
+
+  # If the previous option needs an argument, assign it.
+  if test -n "$prev"; then
+    case $prev in
+    execute_dlfiles)
+      execute_dlfiles="$execute_dlfiles $arg"
+      ;;
+    *)
+      eval "$prev=\$arg"
+      ;;
+    esac
+
+    prev=
+    prevopt=
+    continue
+  fi
+
+  # Have we seen a non-optional argument yet?
+  case $arg in
+  --help)
+    show_help=yes
+    ;;
+
+  --version)
+    echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP"
+    exit 0
+    ;;
+
+  --config)
+    ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $0
+    exit 0
+    ;;
+
+  --debug)
+    echo "$progname: enabling shell trace mode"
+    set -x
+    ;;
+
+  --dry-run | -n)
+    run=:
+    ;;
+
+  --features)
+    echo "host: $host"
+    if test "$build_libtool_libs" = yes; then
+      echo "enable shared libraries"
+    else
+      echo "disable shared libraries"
+    fi
+    if test "$build_old_libs" = yes; then
+      echo "enable static libraries"
+    else
+      echo "disable static libraries"
+    fi
+    exit 0
+    ;;
+
+  --finish) mode="finish" ;;
+
+  --mode) prevopt="--mode" prev=mode ;;
+  --mode=*) mode="$optarg" ;;
+
+  --preserve-dup-deps) duplicate_deps="yes" ;;
+
+  --quiet | --silent)
+    show=:
+    ;;
+
+  -dlopen)
+    prevopt="-dlopen"
+    prev=execute_dlfiles
+    ;;
+
+  -*)
+    $echo "$modename: unrecognized option \`$arg'" 1>&2
+    $echo "$help" 1>&2
+    exit 1
+    ;;
+
+  *)
+    nonopt="$arg"
+    break
+    ;;
+  esac
+done
+
+if test -n "$prevopt"; then
+  $echo "$modename: option \`$prevopt' requires an argument" 1>&2
+  $echo "$help" 1>&2
+  exit 1
+fi
+
+# If this variable is set in any of the actions, the command in it
+# will be execed at the end.  This prevents here-documents from being
+# left over by shells.
+exec_cmd=
+
+if test -z "$show_help"; then
+
+  # Infer the operation mode.
+  if test -z "$mode"; then
+    case $nonopt in
+    *cc | *++ | gcc* | *-gcc* | xlc*)
+      mode=link
+      for arg
+      do
+	case $arg in
+	-c)
+	   mode=compile
+	   break
+	   ;;
+	esac
+      done
+      ;;
+    *db | *dbx | *strace | *truss)
+      mode=execute
+      ;;
+    *install*|cp|mv)
+      mode=install
+      ;;
+    *rm)
+      mode=uninstall
+      ;;
+    *)
+      # If we have no mode, but dlfiles were specified, then do execute mode.
+      test -n "$execute_dlfiles" && mode=execute
+
+      # Just use the default operation mode.
+      if test -z "$mode"; then
+	if test -n "$nonopt"; then
+	  $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2
+	else
+	  $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2
+	fi
+      fi
+      ;;
+    esac
+  fi
+
+  # Only execute mode is allowed to have -dlopen flags.
+  if test -n "$execute_dlfiles" && test "$mode" != execute; then
+    $echo "$modename: unrecognized option \`-dlopen'" 1>&2
+    $echo "$help" 1>&2
+    exit 1
+  fi
+
+  # Change the help message to a mode-specific one.
+  generic_help="$help"
+  help="Try \`$modename --help --mode=$mode' for more information."
+
+  # These modes are in order of execution frequency so that they run quickly.
+  case $mode in
+  # libtool compile mode
+  compile)
+    modename="$modename: compile"
+    # Get the compilation command and the source file.
+    base_compile=
+    prev=
+    lastarg=
+    srcfile="$nonopt"
+    suppress_output=
+
+    user_target=no
+    for arg
+    do
+      case $prev in
+      "") ;;
+      xcompiler)
+	# Aesthetically quote the previous argument.
+	prev=
+	lastarg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
+
+	case $arg in
+	# Double-quote args containing other shell metacharacters.
+	# Many Bourne shells cannot handle close brackets correctly
+	# in scan sets, so we specify it separately.
+	*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
+	  arg="\"$arg\""
+	  ;;
+	esac
+
+	# Add the previous argument to base_compile.
+	if test -z "$base_compile"; then
+	  base_compile="$lastarg"
+	else
+	  base_compile="$base_compile $lastarg"
+	fi
+	continue
+	;;
+      esac
+
+      # Accept any command-line options.
+      case $arg in
+      -o)
+	if test "$user_target" != "no"; then
+	  $echo "$modename: you cannot specify \`-o' more than once" 1>&2
+	  exit 1
+	fi
+	user_target=next
+	;;
+
+      -static)
+	build_old_libs=yes
+	continue
+	;;
+
+      -prefer-pic)
+	pic_mode=yes
+	continue
+	;;
+
+      -prefer-non-pic)
+	pic_mode=no
+	continue
+	;;
+
+      -Xcompiler)
+	prev=xcompiler
+	continue
+	;;
+
+      -Wc,*)
+	args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"`
+	lastarg=
+	save_ifs="$IFS"; IFS=','
+	for arg in $args; do
+	  IFS="$save_ifs"
+
+	  # Double-quote args containing other shell metacharacters.
+	  # Many Bourne shells cannot handle close brackets correctly
+	  # in scan sets, so we specify it separately.
+	  case $arg in
+	    *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
+	    arg="\"$arg\""
+	    ;;
+	  esac
+	  lastarg="$lastarg $arg"
+	done
+	IFS="$save_ifs"
+	lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"`
+
+	# Add the arguments to base_compile.
+	if test -z "$base_compile"; then
+	  base_compile="$lastarg"
+	else
+	  base_compile="$base_compile $lastarg"
+	fi
+	continue
+	;;
+      esac
+
+      case $user_target in
+      next)
+	# The next one is the -o target name
+	user_target=yes
+	continue
+	;;
+      yes)
+	# We got the output file
+	user_target=set
+	libobj="$arg"
+	continue
+	;;
+      esac
+
+      # Accept the current argument as the source file.
+      lastarg="$srcfile"
+      srcfile="$arg"
+
+      # Aesthetically quote the previous argument.
+
+      # Backslashify any backslashes, double quotes, and dollar signs.
+      # These are the only characters that are still specially
+      # interpreted inside of double-quoted scrings.
+      lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"`
+
+      # Double-quote args containing other shell metacharacters.
+      # Many Bourne shells cannot handle close brackets correctly
+      # in scan sets, so we specify it separately.
+      case $lastarg in
+      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
+	lastarg="\"$lastarg\""
+	;;
+      esac
+
+      # Add the previous argument to base_compile.
+      if test -z "$base_compile"; then
+	base_compile="$lastarg"
+      else
+	base_compile="$base_compile $lastarg"
+      fi
+    done
+
+    case $user_target in
+    set)
+      ;;
+    no)
+      # Get the name of the library object.
+      libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'`
+      ;;
+    *)
+      $echo "$modename: you must specify a target with \`-o'" 1>&2
+      exit 1
+      ;;
+    esac
+
+    # Recognize several different file suffixes.
+    # If the user specifies -o file.o, it is replaced with file.lo
+    xform='[cCFSfmso]'
+    case $libobj in
+    *.ada) xform=ada ;;
+    *.adb) xform=adb ;;
+    *.ads) xform=ads ;;
+    *.asm) xform=asm ;;
+    *.c++) xform=c++ ;;
+    *.cc) xform=cc ;;
+    *.cpp) xform=cpp ;;
+    *.cxx) xform=cxx ;;
+    *.f90) xform=f90 ;;
+    *.for) xform=for ;;
+    esac
+
+    libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"`
+
+    case $libobj in
+    *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;;
+    *)
+      $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2
+      exit 1
+      ;;
+    esac
+
+    if test -z "$base_compile"; then
+      $echo "$modename: you must specify a compilation command" 1>&2
+      $echo "$help" 1>&2
+      exit 1
+    fi
+
+    # Delete any leftover library objects.
+    if test "$build_old_libs" = yes; then
+      removelist="$obj $libobj"
+    else
+      removelist="$libobj"
+    fi
+
+    $run $rm $removelist
+    trap "$run $rm $removelist; exit 1" 1 2 15
+
+    # On Cygwin there's no "real" PIC flag so we must build both object types
+    case $host_os in
+    cygwin* | mingw* | pw32* | os2*)
+      pic_mode=default
+      ;;
+    esac
+    if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then
+      # non-PIC code in shared libraries is not supported
+      pic_mode=default
+    fi
+
+    # Calculate the filename of the output object if compiler does
+    # not support -o with -c
+    if test "$compiler_c_o" = no; then
+      output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext}
+      lockfile="$output_obj.lock"
+      removelist="$removelist $output_obj $lockfile"
+      trap "$run $rm $removelist; exit 1" 1 2 15
+    else
+      need_locks=no
+      lockfile=
+    fi
+
+    # Lock this critical section if it is needed
+    # We use this script file to make the link, it avoids creating a new file
+    if test "$need_locks" = yes; then
+      until $run ln "$0" "$lockfile" 2>/dev/null; do
+	$show "Waiting for $lockfile to be removed"
+	sleep 2
+      done
+    elif test "$need_locks" = warn; then
+      if test -f "$lockfile"; then
+	echo "\
+*** ERROR, $lockfile exists and contains:
+`cat $lockfile 2>/dev/null`
+
+This indicates that another process is trying to use the same
+temporary object file, and libtool could not work around it because
+your compiler does not support \`-c' and \`-o' together.  If you
+repeat this compilation, it may succeed, by chance, but you had better
+avoid parallel builds (make -j) in this platform, or get a better
+compiler."
+
+	$run $rm $removelist
+	exit 1
+      fi
+      echo $srcfile > "$lockfile"
+    fi
+
+    if test -n "$fix_srcfile_path"; then
+      eval srcfile=\"$fix_srcfile_path\"
+    fi
+
+    # Only build a PIC object if we are building libtool libraries.
+    if test "$build_libtool_libs" = yes; then
+      # Without this assignment, base_compile gets emptied.
+      fbsd_hideous_sh_bug=$base_compile
+
+      if test "$pic_mode" != no; then
+	# All platforms use -DPIC, to notify preprocessed assembler code.
+	command="$base_compile $srcfile $pic_flag -DPIC"
+      else
+	# Don't build PIC code
+	command="$base_compile $srcfile"
+      fi
+      if test "$build_old_libs" = yes; then
+	lo_libobj="$libobj"
+	dir=`$echo "X$libobj" | $Xsed -e 's%/[^/]*$%%'`
+	if test "X$dir" = "X$libobj"; then
+	  dir="$objdir"
+	else
+	  dir="$dir/$objdir"
+	fi
+	libobj="$dir/"`$echo "X$libobj" | $Xsed -e 's%^.*/%%'`
+
+	if test -d "$dir"; then
+	  $show "$rm $libobj"
+	  $run $rm $libobj
+	else
+	  $show "$mkdir $dir"
+	  $run $mkdir $dir
+	  status=$?
+	  if test $status -ne 0 && test ! -d $dir; then
+	    exit $status
+	  fi
+	fi
+      fi
+      if test "$compiler_o_lo" = yes; then
+	output_obj="$libobj"
+	command="$command -o $output_obj"
+      elif test "$compiler_c_o" = yes; then
+	output_obj="$obj"
+	command="$command -o $output_obj"
+      fi
+
+      $run $rm "$output_obj"
+      $show "$command"
+      if $run eval "$command"; then :
+      else
+	test -n "$output_obj" && $run $rm $removelist
+	exit 1
+      fi
+
+      if test "$need_locks" = warn &&
+	 test x"`cat $lockfile 2>/dev/null`" != x"$srcfile"; then
+	echo "\
+*** ERROR, $lockfile contains:
+`cat $lockfile 2>/dev/null`
+
+but it should contain:
+$srcfile
+
+This indicates that another process is trying to use the same
+temporary object file, and libtool could not work around it because
+your compiler does not support \`-c' and \`-o' together.  If you
+repeat this compilation, it may succeed, by chance, but you had better
+avoid parallel builds (make -j) in this platform, or get a better
+compiler."
+
+	$run $rm $removelist
+	exit 1
+      fi
+
+      # Just move the object if needed, then go on to compile the next one
+      if test x"$output_obj" != x"$libobj"; then
+	$show "$mv $output_obj $libobj"
+	if $run $mv $output_obj $libobj; then :
+	else
+	  error=$?
+	  $run $rm $removelist
+	  exit $error
+	fi
+      fi
+
+      # If we have no pic_flag, then copy the object into place and finish.
+      if (test -z "$pic_flag" || test "$pic_mode" != default) &&
+	 test "$build_old_libs" = yes; then
+	# Rename the .lo from within objdir to obj
+	if test -f $obj; then
+	  $show $rm $obj
+	  $run $rm $obj
+	fi
+
+	$show "$mv $libobj $obj"
+	if $run $mv $libobj $obj; then :
+	else
+	  error=$?
+	  $run $rm $removelist
+	  exit $error
+	fi
+
+	xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
+	if test "X$xdir" = "X$obj"; then
+	  xdir="."
+	else
+	  xdir="$xdir"
+	fi
+	baseobj=`$echo "X$obj" | $Xsed -e "s%.*/%%"`
+	libobj=`$echo "X$baseobj" | $Xsed -e "$o2lo"`
+	# Now arrange that obj and lo_libobj become the same file
+	$show "(cd $xdir && $LN_S $baseobj $libobj)"
+	if $run eval '(cd $xdir && $LN_S $baseobj $libobj)'; then
+	  # Unlock the critical section if it was locked
+	  if test "$need_locks" != no; then
+	    $run $rm "$lockfile"
+	  fi
+	  exit 0
+	else
+	  error=$?
+	  $run $rm $removelist
+	  exit $error
+	fi
+      fi
+
+      # Allow error messages only from the first compilation.
+      suppress_output=' >/dev/null 2>&1'
+    fi
+
+    # Only build a position-dependent object if we build old libraries.
+    if test "$build_old_libs" = yes; then
+      if test "$pic_mode" != yes; then
+	# Don't build PIC code
+	command="$base_compile $srcfile"
+      else
+	# All platforms use -DPIC, to notify preprocessed assembler code.
+	command="$base_compile $srcfile $pic_flag -DPIC"
+      fi
+      if test "$compiler_c_o" = yes; then
+	command="$command -o $obj"
+	output_obj="$obj"
+      fi
+
+      # Suppress compiler output if we already did a PIC compilation.
+      command="$command$suppress_output"
+      $run $rm "$output_obj"
+      $show "$command"
+      if $run eval "$command"; then :
+      else
+	$run $rm $removelist
+	exit 1
+      fi
+
+      if test "$need_locks" = warn &&
+	 test x"`cat $lockfile 2>/dev/null`" != x"$srcfile"; then
+	echo "\
+*** ERROR, $lockfile contains:
+`cat $lockfile 2>/dev/null`
+
+but it should contain:
+$srcfile
+
+This indicates that another process is trying to use the same
+temporary object file, and libtool could not work around it because
+your compiler does not support \`-c' and \`-o' together.  If you
+repeat this compilation, it may succeed, by chance, but you had better
+avoid parallel builds (make -j) in this platform, or get a better
+compiler."
+
+	$run $rm $removelist
+	exit 1
+      fi
+
+      # Just move the object if needed
+      if test x"$output_obj" != x"$obj"; then
+	$show "$mv $output_obj $obj"
+	if $run $mv $output_obj $obj; then :
+	else
+	  error=$?
+	  $run $rm $removelist
+	  exit $error
+	fi
+      fi
+
+      # Create an invalid libtool object if no PIC, so that we do not
+      # accidentally link it into a program.
+      if test "$build_libtool_libs" != yes; then
+	$show "echo timestamp > $libobj"
+	$run eval "echo timestamp > \$libobj" || exit $?
+      else
+	# Move the .lo from within objdir
+	$show "$mv $libobj $lo_libobj"
+	if $run $mv $libobj $lo_libobj; then :
+	else
+	  error=$?
+	  $run $rm $removelist
+	  exit $error
+	fi
+      fi
+    fi
+
+    # Unlock the critical section if it was locked
+    if test "$need_locks" != no; then
+      $run $rm "$lockfile"
+    fi
+
+    exit 0
+    ;;
+
+  # libtool link mode
+  link | relink)
+    modename="$modename: link"
+    case $host in
+    *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
+      # It is impossible to link a dll without this setting, and
+      # we shouldn't force the makefile maintainer to figure out
+      # which system we are compiling for in order to pass an extra
+      # flag for every libtool invokation.
+      # allow_undefined=no
+
+      # FIXME: Unfortunately, there are problems with the above when trying
+      # to make a dll which has undefined symbols, in which case not
+      # even a static library is built.  For now, we need to specify
+      # -no-undefined on the libtool link line when we can be certain
+      # that all symbols are satisfied, otherwise we get a static library.
+      allow_undefined=yes
+      ;;
+    *)
+      allow_undefined=yes
+      ;;
+    esac
+    libtool_args="$nonopt"
+    compile_command="$nonopt"
+    finalize_command="$nonopt"
+
+    compile_rpath=
+    finalize_rpath=
+    compile_shlibpath=
+    finalize_shlibpath=
+    convenience=
+    old_convenience=
+    deplibs=
+    old_deplibs=
+    compiler_flags=
+    linker_flags=
+    dllsearchpath=
+    lib_search_path=`pwd`
+
+    avoid_version=no
+    dlfiles=
+    dlprefiles=
+    dlself=no
+    export_dynamic=no
+    export_symbols=
+    export_symbols_regex=
+    generated=
+    libobjs=
+    ltlibs=
+    module=no
+    no_install=no
+    objs=
+    prefer_static_libs=no
+    preload=no
+    prev=
+    prevarg=
+    release=
+    rpath=
+    xrpath=
+    perm_rpath=
+    temp_rpath=
+    thread_safe=no
+    vinfo=
+
+    # We need to know -static, to get the right output filenames.
+    for arg
+    do
+      case $arg in
+      -all-static | -static)
+	if test "X$arg" = "X-all-static"; then
+	  if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
+	    $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2
+	  fi
+	  if test -n "$link_static_flag"; then
+	    dlopen_self=$dlopen_self_static
+	  fi
+	else
+	  if test -z "$pic_flag" && test -n "$link_static_flag"; then
+	    dlopen_self=$dlopen_self_static
+	  fi
+	fi
+	build_libtool_libs=no
+	build_old_libs=yes
+	prefer_static_libs=yes
+	break
+	;;
+      esac
+    done
+
+    # See if our shared archives depend on static archives.
+    test -n "$old_archive_from_new_cmds" && build_old_libs=yes
+
+    # Go through the arguments, transforming them on the way.
+    while test $# -gt 0; do
+      arg="$1"
+      shift
+      case $arg in
+      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
+	qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test
+	;;
+      *) qarg=$arg ;;
+      esac
+      libtool_args="$libtool_args $qarg"
+
+      # If the previous option needs an argument, assign it.
+      if test -n "$prev"; then
+	case $prev in
+	output)
+	  compile_command="$compile_command @OUTPUT@"
+	  finalize_command="$finalize_command @OUTPUT@"
+	  ;;
+	esac
+
+	case $prev in
+	dlfiles|dlprefiles)
+	  if test "$preload" = no; then
+	    # Add the symbol object into the linking commands.
+	    compile_command="$compile_command @SYMFILE@"
+	    finalize_command="$finalize_command @SYMFILE@"
+	    preload=yes
+	  fi
+	  case $arg in
+	  *.la | *.lo) ;;  # We handle these cases below.
+	  force)
+	    if test "$dlself" = no; then
+	      dlself=needless
+	      export_dynamic=yes
+	    fi
+	    prev=
+	    continue
+	    ;;
+	  self)
+	    if test "$prev" = dlprefiles; then
+	      dlself=yes
+	    elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
+	      dlself=yes
+	    else
+	      dlself=needless
+	      export_dynamic=yes
+	    fi
+	    prev=
+	    continue
+	    ;;
+	  *)
+	    if test "$prev" = dlfiles; then
+	      dlfiles="$dlfiles $arg"
+	    else
+	      dlprefiles="$dlprefiles $arg"
+	    fi
+	    prev=
+	    continue
+	    ;;
+	  esac
+	  ;;
+	expsyms)
+	  export_symbols="$arg"
+	  if test ! -f "$arg"; then
+	    $echo "$modename: symbol file \`$arg' does not exist"
+	    exit 1
+	  fi
+	  prev=
+	  continue
+	  ;;
+	expsyms_regex)
+	  export_symbols_regex="$arg"
+	  prev=
+	  continue
+	  ;;
+	release)
+	  release="-$arg"
+	  prev=
+	  continue
+	  ;;
+	rpath | xrpath)
+	  # We need an absolute path.
+	  case $arg in
+	  [\\/]* | [A-Za-z]:[\\/]*) ;;
+	  *)
+	    $echo "$modename: only absolute run-paths are allowed" 1>&2
+	    exit 1
+	    ;;
+	  esac
+	  if test "$prev" = rpath; then
+	    case "$rpath " in
+	    *" $arg "*) ;;
+	    *) rpath="$rpath $arg" ;;
+	    esac
+	  else
+	    case "$xrpath " in
+	    *" $arg "*) ;;
+	    *) xrpath="$xrpath $arg" ;;
+	    esac
+	  fi
+	  prev=
+	  continue
+	  ;;
+	xcompiler)
+	  compiler_flags="$compiler_flags $qarg"
+	  prev=
+	  compile_command="$compile_command $qarg"
+	  finalize_command="$finalize_command $qarg"
+	  continue
+	  ;;
+	xlinker)
+	  linker_flags="$linker_flags $qarg"
+	  compiler_flags="$compiler_flags $wl$qarg"
+	  prev=
+	  compile_command="$compile_command $wl$qarg"
+	  finalize_command="$finalize_command $wl$qarg"
+	  continue
+	  ;;
+	*)
+	  eval "$prev=\"\$arg\""
+	  prev=
+	  continue
+	  ;;
+	esac
+      fi # test -n $prev
+
+      prevarg="$arg"
+
+      case $arg in
+      -all-static)
+	if test -n "$link_static_flag"; then
+	  compile_command="$compile_command $link_static_flag"
+	  finalize_command="$finalize_command $link_static_flag"
+	fi
+	continue
+	;;
+
+      -allow-undefined)
+	# FIXME: remove this flag sometime in the future.
+	$echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2
+	continue
+	;;
+
+      -avoid-version)
+	avoid_version=yes
+	continue
+	;;
+
+      -dlopen)
+	prev=dlfiles
+	continue
+	;;
+
+      -dlpreopen)
+	prev=dlprefiles
+	continue
+	;;
+
+      -export-dynamic)
+	export_dynamic=yes
+	continue
+	;;
+
+      -export-symbols | -export-symbols-regex)
+	if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
+	  $echo "$modename: more than one -exported-symbols argument is not allowed"
+	  exit 1
+	fi
+	if test "X$arg" = "X-export-symbols"; then
+	  prev=expsyms
+	else
+	  prev=expsyms_regex
+	fi
+	continue
+	;;
+
+      # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
+      # so, if we see these flags be careful not to treat them like -L
+      -L[A-Z][A-Z]*:*)
+	case $with_gcc/$host in
+	no/*-*-irix* | no/*-*-nonstopux*)
+	  compile_command="$compile_command $arg"
+	  finalize_command="$finalize_command $arg"
+	  ;;
+	esac
+	continue
+	;;
+
+      -L*)
+	dir=`$echo "X$arg" | $Xsed -e 's/^-L//'`
+	# We need an absolute path.
+	case $dir in
+	[\\/]* | [A-Za-z]:[\\/]*) ;;
+	*)
+	  absdir=`cd "$dir" && pwd`
+	  if test -z "$absdir"; then
+	    $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2
+	    exit 1
+	  fi
+	  dir="$absdir"
+	  ;;
+	esac
+	case "$deplibs " in
+	*" -L$dir "*) ;;
+	*)
+	  deplibs="$deplibs -L$dir"
+	  lib_search_path="$lib_search_path $dir"
+	  ;;
+	esac
+	case $host in
+	*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
+	  case :$dllsearchpath: in
+	  *":$dir:"*) ;;
+	  *) dllsearchpath="$dllsearchpath:$dir";;
+	  esac
+	  ;;
+	esac
+	continue
+	;;
+
+      -l*)
+	if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
+	  case $host in
+	  *-*-cygwin* | *-*-pw32* | *-*-beos*)
+	    # These systems don't actually have a C or math library (as such)
+	    continue
+	    ;;
+	  *-*-mingw* | *-*-os2*)
+	    # These systems don't actually have a C library (as such)
+	    test "X$arg" = "X-lc" && continue
+	    ;;
+	  *-*-openbsd* | *-*-freebsd*)
+	    # Do not include libc due to us having libc/libc_r.
+	    test "X$arg" = "X-lc" && continue
+	    ;;
+	  esac
+	 elif test "X$arg" = "X-lc_r"; then
+	  case $host in
+	 *-*-openbsd* | *-*-freebsd*)
+	    # Do not include libc_r directly, use -pthread flag.
+	    continue
+	    ;;
+	  esac
+	fi
+	deplibs="$deplibs $arg"
+	continue
+	;;
+
+      -module)
+	module=yes
+	continue
+	;;
+
+      -no-fast-install)
+	fast_install=no
+	continue
+	;;
+
+      -no-install)
+	case $host in
+	*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
+	  # The PATH hackery in wrapper scripts is required on Windows
+	  # in order for the loader to find any dlls it needs.
+	  $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2
+	  $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2
+	  fast_install=no
+	  ;;
+	*) no_install=yes ;;
+	esac
+	continue
+	;;
+
+      -no-undefined)
+	allow_undefined=no
+	continue
+	;;
+
+      -o) prev=output ;;
+
+      -release)
+	prev=release
+	continue
+	;;
+
+      -rpath)
+	prev=rpath
+	continue
+	;;
+
+      -R)
+	prev=xrpath
+	continue
+	;;
+
+      -R*)
+	dir=`$echo "X$arg" | $Xsed -e 's/^-R//'`
+	# We need an absolute path.
+	case $dir in
+	[\\/]* | [A-Za-z]:[\\/]*) ;;
+	*)
+	  $echo "$modename: only absolute run-paths are allowed" 1>&2
+	  exit 1
+	  ;;
+	esac
+	case "$xrpath " in
+	*" $dir "*) ;;
+	*) xrpath="$xrpath $dir" ;;
+	esac
+	continue
+	;;
+
+      -static)
+	# The effects of -static are defined in a previous loop.
+	# We used to do the same as -all-static on platforms that
+	# didn't have a PIC flag, but the assumption that the effects
+	# would be equivalent was wrong.  It would break on at least
+	# Digital Unix and AIX.
+	continue
+	;;
+
+      -thread-safe)
+	thread_safe=yes
+	continue
+	;;
+
+      -version-info)
+	prev=vinfo
+	continue
+	;;
+
+      -Wc,*)
+	args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'`
+	arg=
+	save_ifs="$IFS"; IFS=','
+	for flag in $args; do
+	  IFS="$save_ifs"
+	  case $flag in
+	    *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
+	    flag="\"$flag\""
+	    ;;
+	  esac
+	  arg="$arg $wl$flag"
+	  compiler_flags="$compiler_flags $flag"
+	done
+	IFS="$save_ifs"
+	arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
+	;;
+
+      -Wl,*)
+	args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'`
+	arg=
+	save_ifs="$IFS"; IFS=','
+	for flag in $args; do
+	  IFS="$save_ifs"
+	  case $flag in
+	    *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
+	    flag="\"$flag\""
+	    ;;
+	  esac
+	  arg="$arg $wl$flag"
+	  compiler_flags="$compiler_flags $wl$flag"
+	  linker_flags="$linker_flags $flag"
+	done
+	IFS="$save_ifs"
+	arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
+	;;
+
+      -Xcompiler)
+	prev=xcompiler
+	continue
+	;;
+
+      -Xlinker)
+	prev=xlinker
+	continue
+	;;
+
+      # Some other compiler flag.
+      -* | +*)
+	# Unknown arguments in both finalize_command and compile_command need
+	# to be aesthetically quoted because they are evaled later.
+	arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
+	case $arg in
+	*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
+	  arg="\"$arg\""
+	  ;;
+	esac
+	;;
+
+      *.lo | *.$objext)
+	# A library or standard object.
+	if test "$prev" = dlfiles; then
+	  # This file was specified with -dlopen.
+	  if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
+	    dlfiles="$dlfiles $arg"
+	    prev=
+	    continue
+	  else
+	    # If libtool objects are unsupported, then we need to preload.
+	    prev=dlprefiles
+	  fi
+	fi
+
+	if test "$prev" = dlprefiles; then
+	  # Preload the old-style object.
+	  dlprefiles="$dlprefiles "`$echo "X$arg" | $Xsed -e "$lo2o"`
+	  prev=
+	else
+	  case $arg in
+	  *.lo) libobjs="$libobjs $arg" ;;
+	  *) objs="$objs $arg" ;;
+	  esac
+	fi
+	;;
+
+      *.$libext)
+	# An archive.
+	deplibs="$deplibs $arg"
+	old_deplibs="$old_deplibs $arg"
+	continue
+	;;
+
+      *.la)
+	# A libtool-controlled library.
+
+	if test "$prev" = dlfiles; then
+	  # This library was specified with -dlopen.
+	  dlfiles="$dlfiles $arg"
+	  prev=
+	elif test "$prev" = dlprefiles; then
+	  # The library was specified with -dlpreopen.
+	  dlprefiles="$dlprefiles $arg"
+	  prev=
+	else
+	  deplibs="$deplibs $arg"
+	fi
+	continue
+	;;
+
+      # Some other compiler argument.
+      *)
+	# Unknown arguments in both finalize_command and compile_command need
+	# to be aesthetically quoted because they are evaled later.
+	arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
+	case $arg in
+	*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
+	  arg="\"$arg\""
+	  ;;
+	esac
+	;;
+      esac # arg
+
+      # Now actually substitute the argument into the commands.
+      if test -n "$arg"; then
+	compile_command="$compile_command $arg"
+	finalize_command="$finalize_command $arg"
+      fi
+    done # argument parsing loop
+
+    if test -n "$prev"; then
+      $echo "$modename: the \`$prevarg' option requires an argument" 1>&2
+      $echo "$help" 1>&2
+      exit 1
+    fi
+
+    if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
+      eval arg=\"$export_dynamic_flag_spec\"
+      compile_command="$compile_command $arg"
+      finalize_command="$finalize_command $arg"
+    fi
+
+    # calculate the name of the file, without its directory
+    outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'`
+    libobjs_save="$libobjs"
+
+    if test -n "$shlibpath_var"; then
+      # get the directories listed in $shlibpath_var
+      eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\`
+    else
+      shlib_search_path=
+    fi
+    eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
+    eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
+
+    output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'`
+    if test "X$output_objdir" = "X$output"; then
+      output_objdir="$objdir"
+    else
+      output_objdir="$output_objdir/$objdir"
+    fi
+    # Create the object directory.
+    if test ! -d $output_objdir; then
+      $show "$mkdir $output_objdir"
+      $run $mkdir $output_objdir
+      status=$?
+      if test $status -ne 0 && test ! -d $output_objdir; then
+	exit $status
+      fi
+    fi
+
+    # Determine the type of output
+    case $output in
+    "")
+      $echo "$modename: you must specify an output file" 1>&2
+      $echo "$help" 1>&2
+      exit 1
+      ;;
+    *.$libext) linkmode=oldlib ;;
+    *.lo | *.$objext) linkmode=obj ;;
+    *.la) linkmode=lib ;;
+    *) linkmode=prog ;; # Anything else should be a program.
+    esac
+
+    specialdeplibs=
+    libs=
+    # Find all interdependent deplibs by searching for libraries
+    # that are linked more than once (e.g. -la -lb -la)
+    for deplib in $deplibs; do
+      if test "X$duplicate_deps" = "Xyes" ; then
+	case "$libs " in
+	*" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
+	esac
+      fi
+      libs="$libs $deplib"
+    done
+    deplibs=
+    newdependency_libs=
+    newlib_search_path=
+    need_relink=no # whether we're linking any uninstalled libtool libraries
+    notinst_deplibs= # not-installed libtool libraries
+    notinst_path= # paths that contain not-installed libtool libraries
+    case $linkmode in
+    lib)
+	passes="conv link"
+	for file in $dlfiles $dlprefiles; do
+	  case $file in
+	  *.la) ;;
+	  *)
+	    $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2
+	    exit 1
+	    ;;
+	  esac
+	done
+	;;
+    prog)
+	compile_deplibs=
+	finalize_deplibs=
+	alldeplibs=no
+	newdlfiles=
+	newdlprefiles=
+	passes="conv scan dlopen dlpreopen link"
+	;;
+    *)  passes="conv"
+	;;
+    esac
+    for pass in $passes; do
+      if test $linkmode = prog; then
+	# Determine which files to process
+	case $pass in
+	dlopen)
+	  libs="$dlfiles"
+	  save_deplibs="$deplibs" # Collect dlpreopened libraries
+	  deplibs=
+	  ;;
+	dlpreopen) libs="$dlprefiles" ;;
+	link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
+	esac
+      fi
+      for deplib in $libs; do
+	lib=
+	found=no
+	case $deplib in
+	-l*)
+	  if test $linkmode = oldlib && test $linkmode = obj; then
+	    $echo "$modename: warning: \`-l' is ignored for archives/objects: $deplib" 1>&2
+	    continue
+	  fi
+	  if test $pass = conv; then
+	    deplibs="$deplib $deplibs"
+	    continue
+	  fi
+	  name=`$echo "X$deplib" | $Xsed -e 's/^-l//'`
+	  for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do
+	    # Search the libtool library
+	    lib="$searchdir/lib${name}.la"
+	    if test -f "$lib"; then
+	      found=yes
+	      break
+	    fi
+	  done
+	  if test "$found" != yes; then
+	    # deplib doesn't seem to be a libtool library
+	    if test "$linkmode,$pass" = "prog,link"; then
+	      compile_deplibs="$deplib $compile_deplibs"
+	      finalize_deplibs="$deplib $finalize_deplibs"
+	    else
+	      deplibs="$deplib $deplibs"
+	      test $linkmode = lib && newdependency_libs="$deplib $newdependency_libs"
+	    fi
+	    continue
+	  fi
+	  ;; # -l
+	-L*)
+	  case $linkmode in
+	  lib)
+	    deplibs="$deplib $deplibs"
+	    test $pass = conv && continue
+	    newdependency_libs="$deplib $newdependency_libs"
+	    newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
+	    ;;
+	  prog)
+	    if test $pass = conv; then
+	      deplibs="$deplib $deplibs"
+	      continue
+	    fi
+	    if test $pass = scan; then
+	      deplibs="$deplib $deplibs"
+	      newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
+	    else
+	      compile_deplibs="$deplib $compile_deplibs"
+	      finalize_deplibs="$deplib $finalize_deplibs"
+	    fi
+	    ;;
+	  *)
+	    $echo "$modename: warning: \`-L' is ignored for archives/objects: $deplib" 1>&2
+	    ;;
+	  esac # linkmode
+	  continue
+	  ;; # -L
+	-R*)
+	  if test $pass = link; then
+	    dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'`
+	    # Make sure the xrpath contains only unique directories.
+	    case "$xrpath " in
+	    *" $dir "*) ;;
+	    *) xrpath="$xrpath $dir" ;;
+	    esac
+	  fi
+	  deplibs="$deplib $deplibs"
+	  continue
+	  ;;
+	*.la) lib="$deplib" ;;
+	*.$libext)
+	  if test $pass = conv; then
+	    deplibs="$deplib $deplibs"
+	    continue
+	  fi
+	  case $linkmode in
+	  lib)
+	    if test "$deplibs_check_method" != pass_all; then
+	      echo
+	      echo "*** Warning: Trying to link with static lib archive $deplib."
+	      echo "*** I have the capability to make that library automatically link in when"
+	      echo "*** you link to this library.  But I can only do this if you have a"
+	      echo "*** shared version of the library, which you do not appear to have"
+	      echo "*** because the file extensions .$libext of this argument makes me believe"
+	      echo "*** that it is just a static archive that I should not used here."
+	    else
+	      echo
+	      echo "*** Warning: Linking the shared library $output against the"
+	      echo "*** static library $deplib is not portable!"
+	      deplibs="$deplib $deplibs"
+	    fi
+	    continue
+	    ;;
+	  prog)
+	    if test $pass != link; then
+	      deplibs="$deplib $deplibs"
+	    else
+	      compile_deplibs="$deplib $compile_deplibs"
+	      finalize_deplibs="$deplib $finalize_deplibs"
+	    fi
+	    continue
+	    ;;
+	  esac # linkmode
+	  ;; # *.$libext
+	*.lo | *.$objext)
+	  if test $pass = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
+	    # If there is no dlopen support or we're linking statically,
+	    # we need to preload.
+	    newdlprefiles="$newdlprefiles $deplib"
+	    compile_deplibs="$deplib $compile_deplibs"
+	    finalize_deplibs="$deplib $finalize_deplibs"
+	  else
+	    newdlfiles="$newdlfiles $deplib"
+	  fi
+	  continue
+	  ;;
+	%DEPLIBS%)
+	  alldeplibs=yes
+	  continue
+	  ;;
+	esac # case $deplib
+	if test $found = yes || test -f "$lib"; then :
+	else
+	  $echo "$modename: cannot find the library \`$lib'" 1>&2
+	  exit 1
+	fi
+
+	# Check to see that this really is a libtool archive.
+	if (${SED} -e '2q' $lib | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
+	else
+	  $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
+	  exit 1
+	fi
+
+	ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
+	test "X$ladir" = "X$lib" && ladir="."
+
+	dlname=
+	dlopen=
+	dlpreopen=
+	libdir=
+	library_names=
+	old_library=
+	# If the library was installed with an old release of libtool,
+	# it will not redefine variable installed.
+	installed=yes
+
+	# Read the .la file
+	case $lib in
+	*/* | *\\*) . $lib ;;
+	*) . ./$lib ;;
+	esac
+
+	if test "$linkmode,$pass" = "lib,link" ||
+	   test "$linkmode,$pass" = "prog,scan" ||
+	   { test $linkmode = oldlib && test $linkmode = obj; }; then
+	   # Add dl[pre]opened files of deplib
+	  test -n "$dlopen" && dlfiles="$dlfiles $dlopen"
+	  test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen"
+	fi
+
+	if test $pass = conv; then
+	  # Only check for convenience libraries
+	  deplibs="$lib $deplibs"
+	  if test -z "$libdir"; then
+	    if test -z "$old_library"; then
+	      $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
+	      exit 1
+	    fi
+	    # It is a libtool convenience library, so add in its objects.
+	    convenience="$convenience $ladir/$objdir/$old_library"
+	    old_convenience="$old_convenience $ladir/$objdir/$old_library"
+	    tmp_libs=
+	    for deplib in $dependency_libs; do
+	      deplibs="$deplib $deplibs"
+              if test "X$duplicate_deps" = "Xyes" ; then
+	        case "$tmp_libs " in
+	        *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
+	        esac
+              fi
+	      tmp_libs="$tmp_libs $deplib"
+	    done
+	  elif test $linkmode != prog && test $linkmode != lib; then
+	    $echo "$modename: \`$lib' is not a convenience library" 1>&2
+	    exit 1
+	  fi
+	  continue
+	fi # $pass = conv
+
+	# Get the name of the library we link against.
+	linklib=
+	for l in $old_library $library_names; do
+	  linklib="$l"
+	done
+	if test -z "$linklib"; then
+	  $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
+	  exit 1
+	fi
+
+	# This library was specified with -dlopen.
+	if test $pass = dlopen; then
+	  if test -z "$libdir"; then
+	    $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2
+	    exit 1
+	  fi
+	  if test -z "$dlname" || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
+	    # If there is no dlname, no dlopen support or we're linking
+	    # statically, we need to preload.
+	    dlprefiles="$dlprefiles $lib"
+	  else
+	    newdlfiles="$newdlfiles $lib"
+	  fi
+	  continue
+	fi # $pass = dlopen
+
+	# We need an absolute path.
+	case $ladir in
+	[\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;;
+	*)
+	  abs_ladir=`cd "$ladir" && pwd`
+	  if test -z "$abs_ladir"; then
+	    $echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2
+	    $echo "$modename: passing it literally to the linker, although it might fail" 1>&2
+	    abs_ladir="$ladir"
+	  fi
+	  ;;
+	esac
+	laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
+
+	# Find the relevant object directory and library name.
+	if test "X$installed" = Xyes; then
+	  if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
+	    $echo "$modename: warning: library \`$lib' was moved." 1>&2
+	    dir="$ladir"
+	    absdir="$abs_ladir"
+	    libdir="$abs_ladir"
+	  else
+	    dir="$libdir"
+	    absdir="$libdir"
+	  fi
+	else
+	  dir="$ladir/$objdir"
+	  absdir="$abs_ladir/$objdir"
+	  # Remove this search path later
+	  notinst_path="$notinst_path $abs_ladir"
+	fi # $installed = yes
+	name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
+
+	# This library was specified with -dlpreopen.
+	if test $pass = dlpreopen; then
+	  if test -z "$libdir"; then
+	    $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2
+	    exit 1
+	  fi
+	  # Prefer using a static library (so that no silly _DYNAMIC symbols
+	  # are required to link).
+	  if test -n "$old_library"; then
+	    newdlprefiles="$newdlprefiles $dir/$old_library"
+	  # Otherwise, use the dlname, so that lt_dlopen finds it.
+	  elif test -n "$dlname"; then
+	    newdlprefiles="$newdlprefiles $dir/$dlname"
+	  else
+	    newdlprefiles="$newdlprefiles $dir/$linklib"
+	  fi
+	fi # $pass = dlpreopen
+
+	if test -z "$libdir"; then
+	  # Link the convenience library
+	  if test $linkmode = lib; then
+	    deplibs="$dir/$old_library $deplibs"
+	  elif test "$linkmode,$pass" = "prog,link"; then
+	    compile_deplibs="$dir/$old_library $compile_deplibs"
+	    finalize_deplibs="$dir/$old_library $finalize_deplibs"
+	  else
+	    deplibs="$lib $deplibs"
+	  fi
+	  continue
+	fi
+
+	if test $linkmode = prog && test $pass != link; then
+	  newlib_search_path="$newlib_search_path $ladir"
+	  deplibs="$lib $deplibs"
+
+	  linkalldeplibs=no
+	  if test "$link_all_deplibs" != no || test -z "$library_names" ||
+	     test "$build_libtool_libs" = no; then
+	    linkalldeplibs=yes
+	  fi
+
+	  tmp_libs=
+	  for deplib in $dependency_libs; do
+	    case $deplib in
+	    -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test
+	    esac
+	    # Need to link against all dependency_libs?
+	    if test $linkalldeplibs = yes; then
+	      deplibs="$deplib $deplibs"
+	    else
+	      # Need to hardcode shared library paths
+	      # or/and link against static libraries
+	      newdependency_libs="$deplib $newdependency_libs"
+	    fi
+	    if test "X$duplicate_deps" = "Xyes" ; then
+	      case "$tmp_libs " in
+	      *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
+	      esac
+	    fi
+	    tmp_libs="$tmp_libs $deplib"
+	  done # for deplib
+	  continue
+	fi # $linkmode = prog...
+
+	link_static=no # Whether the deplib will be linked statically
+	if test -n "$library_names" &&
+	   { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
+	  # Link against this shared library
+
+	  if test "$linkmode,$pass" = "prog,link" ||
+	   { test $linkmode = lib && test $hardcode_into_libs = yes; }; then
+	    # Hardcode the library path.
+	    # Skip directories that are in the system default run-time
+	    # search path.
+	    case " $sys_lib_dlsearch_path " in
+	    *" $absdir "*) ;;
+	    *)
+	      case "$compile_rpath " in
+	      *" $absdir "*) ;;
+	      *) compile_rpath="$compile_rpath $absdir"
+	      esac
+	      ;;
+	    esac
+	    case " $sys_lib_dlsearch_path " in
+	    *" $libdir "*) ;;
+	    *)
+	      case "$finalize_rpath " in
+	      *" $libdir "*) ;;
+	      *) finalize_rpath="$finalize_rpath $libdir"
+	      esac
+	      ;;
+	    esac
+	    if test $linkmode = prog; then
+	      # We need to hardcode the library path
+	      if test -n "$shlibpath_var"; then
+		# Make sure the rpath contains only unique directories.
+		case "$temp_rpath " in
+		*" $dir "*) ;;
+		*" $absdir "*) ;;
+		*) temp_rpath="$temp_rpath $dir" ;;
+		esac
+	      fi
+	    fi
+	  fi # $linkmode,$pass = prog,link...
+
+	  if test "$alldeplibs" = yes &&
+	     { test "$deplibs_check_method" = pass_all ||
+	       { test "$build_libtool_libs" = yes &&
+		 test -n "$library_names"; }; }; then
+	    # We only need to search for static libraries
+	    continue
+	  fi
+
+	  if test "$installed" = no; then
+	    notinst_deplibs="$notinst_deplibs $lib"
+	    need_relink=yes
+	  fi
+
+	  if test -n "$old_archive_from_expsyms_cmds"; then
+	    # figure out the soname
+	    set dummy $library_names
+	    realname="$2"
+	    shift; shift
+	    libname=`eval \\$echo \"$libname_spec\"`
+	    # use dlname if we got it. it's perfectly good, no?
+	    if test -n "$dlname"; then
+	      soname="$dlname"
+	    elif test -n "$soname_spec"; then
+	      # bleh windows
+	      case $host in
+	      *cygwin*)
+		major=`expr $current - $age`
+		versuffix="-$major"
+		;;
+	      esac
+	      eval soname=\"$soname_spec\"
+	    else
+	      soname="$realname"
+	    fi
+
+	    # Make a new name for the extract_expsyms_cmds to use
+	    soroot="$soname"
+	    soname=`echo $soroot | ${SED} -e 's/^.*\///'`
+	    newlib="libimp-`echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a"
+
+	    # If the library has no export list, then create one now
+	    if test -f "$output_objdir/$soname-def"; then :
+	    else
+	      $show "extracting exported symbol list from \`$soname'"
+	      save_ifs="$IFS"; IFS='~'
+	      eval cmds=\"$extract_expsyms_cmds\"
+	      for cmd in $cmds; do
+		IFS="$save_ifs"
+		$show "$cmd"
+		$run eval "$cmd" || exit $?
+	      done
+	      IFS="$save_ifs"
+	    fi
+
+	    # Create $newlib
+	    if test -f "$output_objdir/$newlib"; then :; else
+	      $show "generating import library for \`$soname'"
+	      save_ifs="$IFS"; IFS='~'
+	      eval cmds=\"$old_archive_from_expsyms_cmds\"
+	      for cmd in $cmds; do
+		IFS="$save_ifs"
+		$show "$cmd"
+		$run eval "$cmd" || exit $?
+	      done
+	      IFS="$save_ifs"
+	    fi
+	    # make sure the library variables are pointing to the new library
+	    dir=$output_objdir
+	    linklib=$newlib
+	  fi # test -n $old_archive_from_expsyms_cmds
+
+	  if test $linkmode = prog || test "$mode" != relink; then
+	    add_shlibpath=
+	    add_dir=
+	    add=
+	    lib_linked=yes
+	    case $hardcode_action in
+	    immediate | unsupported)
+	      if test "$hardcode_direct" = no; then
+		add="$dir/$linklib"
+	      elif test "$hardcode_minus_L" = no; then
+		case $host in
+		*-*-sunos*) add_shlibpath="$dir" ;;
+		esac
+		add_dir="-L$dir"
+		add="-l$name"
+	      elif test "$hardcode_shlibpath_var" = no; then
+		add_shlibpath="$dir"
+		add="-l$name"
+	      else
+		lib_linked=no
+	      fi
+	      ;;
+	    relink)
+	      if test "$hardcode_direct" = yes; then
+		add="$dir/$linklib"
+	      elif test "$hardcode_minus_L" = yes; then
+		add_dir="-L$dir"
+		add="-l$name"
+	      elif test "$hardcode_shlibpath_var" = yes; then
+		add_shlibpath="$dir"
+		add="-l$name"
+	      else
+		lib_linked=no
+	      fi
+	      ;;
+	    *) lib_linked=no ;;
+	    esac
+
+	    if test "$lib_linked" != yes; then
+	      $echo "$modename: configuration error: unsupported hardcode properties"
+	      exit 1
+	    fi
+
+	    if test -n "$add_shlibpath"; then
+	      case :$compile_shlibpath: in
+	      *":$add_shlibpath:"*) ;;
+	      *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;;
+	      esac
+	    fi
+	    if test $linkmode = prog; then
+	      test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
+	      test -n "$add" && compile_deplibs="$add $compile_deplibs"
+	    else
+	      test -n "$add_dir" && deplibs="$add_dir $deplibs"
+	      test -n "$add" && deplibs="$add $deplibs"
+	      if test "$hardcode_direct" != yes && \
+		 test "$hardcode_minus_L" != yes && \
+		 test "$hardcode_shlibpath_var" = yes; then
+		case :$finalize_shlibpath: in
+		*":$libdir:"*) ;;
+		*) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
+		esac
+	      fi
+	    fi
+	  fi
+
+	  if test $linkmode = prog || test "$mode" = relink; then
+	    add_shlibpath=
+	    add_dir=
+	    add=
+	    # Finalize command for both is simple: just hardcode it.
+	    if test "$hardcode_direct" = yes; then
+	      add="$libdir/$linklib"
+	    elif test "$hardcode_minus_L" = yes; then
+	      add_dir="-L$libdir"
+	      add="-l$name"
+	    elif test "$hardcode_shlibpath_var" = yes; then
+	      case :$finalize_shlibpath: in
+	      *":$libdir:"*) ;;
+	      *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
+	      esac
+	      add="-l$name"
+	    else
+	      # We cannot seem to hardcode it, guess we'll fake it.
+	      add_dir="-L$libdir"
+	      add="-l$name"
+	    fi
+
+	    if test $linkmode = prog; then
+	      test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
+	      test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
+	    else
+	      test -n "$add_dir" && deplibs="$add_dir $deplibs"
+	      test -n "$add" && deplibs="$add $deplibs"
+	    fi
+	  fi
+	elif test $linkmode = prog; then
+	  if test "$alldeplibs" = yes &&
+	     { test "$deplibs_check_method" = pass_all ||
+	       { test "$build_libtool_libs" = yes &&
+		 test -n "$library_names"; }; }; then
+	    # We only need to search for static libraries
+	    continue
+	  fi
+
+	  # Try to link the static library
+	  # Here we assume that one of hardcode_direct or hardcode_minus_L
+	  # is not unsupported.  This is valid on all known static and
+	  # shared platforms.
+	  if test "$hardcode_direct" != unsupported; then
+	    test -n "$old_library" && linklib="$old_library"
+	    compile_deplibs="$dir/$linklib $compile_deplibs"
+	    finalize_deplibs="$dir/$linklib $finalize_deplibs"
+	  else
+	    compile_deplibs="-l$name -L$dir $compile_deplibs"
+	    finalize_deplibs="-l$name -L$dir $finalize_deplibs"
+	  fi
+	elif test "$build_libtool_libs" = yes; then
+	  # Not a shared library
+	  if test "$deplibs_check_method" != pass_all; then
+	    # We're trying link a shared library against a static one
+	    # but the system doesn't support it.
+
+	    # Just print a warning and add the library to dependency_libs so
+	    # that the program can be linked against the static library.
+	    echo
+	    echo "*** Warning: This system can not link to static lib archive $lib."
+	    echo "*** I have the capability to make that library automatically link in when"
+	    echo "*** you link to this library.  But I can only do this if you have a"
+	    echo "*** shared version of the library, which you do not appear to have."
+	    if test "$module" = yes; then
+	      echo "*** But as you try to build a module library, libtool will still create "
+	      echo "*** a static module, that should work as long as the dlopening application"
+	      echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
+	      if test -z "$global_symbol_pipe"; then
+		echo
+		echo "*** However, this would only work if libtool was able to extract symbol"
+		echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
+		echo "*** not find such a program.  So, this module is probably useless."
+		echo "*** \`nm' from GNU binutils and a full rebuild may help."
+	      fi
+	      if test "$build_old_libs" = no; then
+		build_libtool_libs=module
+		build_old_libs=yes
+	      else
+		build_libtool_libs=no
+	      fi
+	    fi
+	  else
+	    convenience="$convenience $dir/$old_library"
+	    old_convenience="$old_convenience $dir/$old_library"
+	    deplibs="$dir/$old_library $deplibs"
+	    link_static=yes
+	  fi
+	fi # link shared/static library?
+
+	if test $linkmode = lib; then
+	  if test -n "$dependency_libs" &&
+	     { test $hardcode_into_libs != yes || test $build_old_libs = yes ||
+	       test $link_static = yes; }; then
+	    # Extract -R from dependency_libs
+	    temp_deplibs=
+	    for libdir in $dependency_libs; do
+	      case $libdir in
+	      -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'`
+		   case " $xrpath " in
+		   *" $temp_xrpath "*) ;;
+		   *) xrpath="$xrpath $temp_xrpath";;
+		   esac;;
+	      *) temp_deplibs="$temp_deplibs $libdir";;
+	      esac
+	    done
+	    dependency_libs="$temp_deplibs"
+	  fi
+
+	  newlib_search_path="$newlib_search_path $absdir"
+	  # Link against this library
+	  test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
+	  # ... and its dependency_libs
+	  tmp_libs=
+	  for deplib in $dependency_libs; do
+	    newdependency_libs="$deplib $newdependency_libs"
+	    if test "X$duplicate_deps" = "Xyes" ; then
+	      case "$tmp_libs " in
+	      *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
+	      esac
+	    fi
+	    tmp_libs="$tmp_libs $deplib"
+	  done
+
+	  if test $link_all_deplibs != no; then
+	    # Add the search paths of all dependency libraries
+	    for deplib in $dependency_libs; do
+	      case $deplib in
+	      -L*) path="$deplib" ;;
+	      *.la)
+		dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'`
+		test "X$dir" = "X$deplib" && dir="."
+		# We need an absolute path.
+		case $dir in
+		[\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
+		*)
+		  absdir=`cd "$dir" && pwd`
+		  if test -z "$absdir"; then
+		    $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2
+		    absdir="$dir"
+		  fi
+		  ;;
+		esac
+		if grep "^installed=no" $deplib > /dev/null; then
+		  path="-L$absdir/$objdir"
+		else
+		  eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
+		  if test -z "$libdir"; then
+		    $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
+		    exit 1
+		  fi
+		  if test "$absdir" != "$libdir"; then
+		    $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2
+		  fi
+		  path="-L$absdir"
+		fi
+		;;
+	      *) continue ;;
+	      esac
+	      case " $deplibs " in
+	      *" $path "*) ;;
+	      *) deplibs="$deplibs $path" ;;
+	      esac
+	    done
+	  fi # link_all_deplibs != no
+	fi # linkmode = lib
+      done # for deplib in $libs
+      if test $pass = dlpreopen; then
+	# Link the dlpreopened libraries before other libraries
+	for deplib in $save_deplibs; do
+	  deplibs="$deplib $deplibs"
+	done
+      fi
+      if test $pass != dlopen; then
+	test $pass != scan && dependency_libs="$newdependency_libs"
+	if test $pass != conv; then
+	  # Make sure lib_search_path contains only unique directories.
+	  lib_search_path=
+	  for dir in $newlib_search_path; do
+	    case "$lib_search_path " in
+	    *" $dir "*) ;;
+	    *) lib_search_path="$lib_search_path $dir" ;;
+	    esac
+	  done
+	  newlib_search_path=
+	fi
+
+	if test "$linkmode,$pass" != "prog,link"; then
+	  vars="deplibs"
+	else
+	  vars="compile_deplibs finalize_deplibs"
+	fi
+	for var in $vars dependency_libs; do
+	  # Add libraries to $var in reverse order
+	  eval tmp_libs=\"\$$var\"
+	  new_libs=
+	  for deplib in $tmp_libs; do
+	    case $deplib in
+	    -L*) new_libs="$deplib $new_libs" ;;
+	    *)
+	      case " $specialdeplibs " in
+	      *" $deplib "*) new_libs="$deplib $new_libs" ;;
+	      *)
+		case " $new_libs " in
+		*" $deplib "*) ;;
+		*) new_libs="$deplib $new_libs" ;;
+		esac
+		;;
+	      esac
+	      ;;
+	    esac
+	  done
+	  tmp_libs=
+	  for deplib in $new_libs; do
+	    case $deplib in
+	    -L*)
+	      case " $tmp_libs " in
+	      *" $deplib "*) ;;
+	      *) tmp_libs="$tmp_libs $deplib" ;;
+	      esac
+	      ;;
+	    *) tmp_libs="$tmp_libs $deplib" ;;
+	    esac
+	  done
+	  eval $var=\"$tmp_libs\"
+	done # for var
+      fi
+      if test "$pass" = "conv" &&
+       { test "$linkmode" = "lib" || test "$linkmode" = "prog"; }; then
+	libs="$deplibs" # reset libs
+	deplibs=
+      fi
+    done # for pass
+    if test $linkmode = prog; then
+      dlfiles="$newdlfiles"
+      dlprefiles="$newdlprefiles"
+    fi
+
+    case $linkmode in
+    oldlib)
+      if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
+	$echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2
+      fi
+
+      if test -n "$rpath"; then
+	$echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2
+      fi
+
+      if test -n "$xrpath"; then
+	$echo "$modename: warning: \`-R' is ignored for archives" 1>&2
+      fi
+
+      if test -n "$vinfo"; then
+	$echo "$modename: warning: \`-version-info' is ignored for archives" 1>&2
+      fi
+
+      if test -n "$release"; then
+	$echo "$modename: warning: \`-release' is ignored for archives" 1>&2
+      fi
+
+      if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
+	$echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2
+      fi
+
+      # Now set the variables for building old libraries.
+      build_libtool_libs=no
+      oldlibs="$output"
+      objs="$objs$old_deplibs"
+      ;;
+
+    lib)
+      # Make sure we only generate libraries of the form `libNAME.la'.
+      case $outputname in
+      lib*)
+	name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
+	eval libname=\"$libname_spec\"
+	;;
+      *)
+	if test "$module" = no; then
+	  $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2
+	  $echo "$help" 1>&2
+	  exit 1
+	fi
+	if test "$need_lib_prefix" != no; then
+	  # Add the "lib" prefix for modules if required
+	  name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
+	  eval libname=\"$libname_spec\"
+	else
+	  libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
+	fi
+	;;
+      esac
+
+      if test -n "$objs"; then
+	if test "$deplibs_check_method" != pass_all; then
+	  $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1
+	  exit 1
+	else
+	  echo
+	  echo "*** Warning: Linking the shared library $output against the non-libtool"
+	  echo "*** objects $objs is not portable!"
+	  libobjs="$libobjs $objs"
+	fi
+      fi
+
+      if test "$dlself" != no; then
+	$echo "$modename: warning: \`-dlopen self' is ignored for libtool libraries" 1>&2
+      fi
+
+      set dummy $rpath
+      if test $# -gt 2; then
+	$echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2
+      fi
+      install_libdir="$2"
+
+      oldlibs=
+      if test -z "$rpath"; then
+	if test "$build_libtool_libs" = yes; then
+	  # Building a libtool convenience library.
+	  libext=al
+	  oldlibs="$output_objdir/$libname.$libext $oldlibs"
+	  build_libtool_libs=convenience
+	  build_old_libs=yes
+	fi
+
+	if test -n "$vinfo"; then
+	  $echo "$modename: warning: \`-version-info' is ignored for convenience libraries" 1>&2
+	fi
+
+	if test -n "$release"; then
+	  $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2
+	fi
+      else
+
+	# Parse the version information argument.
+	save_ifs="$IFS"; IFS=':'
+	set dummy $vinfo 0 0 0
+	IFS="$save_ifs"
+
+	if test -n "$8"; then
+	  $echo "$modename: too many parameters to \`-version-info'" 1>&2
+	  $echo "$help" 1>&2
+	  exit 1
+	fi
+
+	current="$2"
+	revision="$3"
+	age="$4"
+
+	# Check that each of the things are valid numbers.
+	case $current in
+	0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;;
+	*)
+	  $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2
+	  $echo "$modename: \`$vinfo' is not valid version information" 1>&2
+	  exit 1
+	  ;;
+	esac
+
+	case $revision in
+	0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;;
+	*)
+	  $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2
+	  $echo "$modename: \`$vinfo' is not valid version information" 1>&2
+	  exit 1
+	  ;;
+	esac
+
+	case $age in
+	0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;;
+	*)
+	  $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2
+	  $echo "$modename: \`$vinfo' is not valid version information" 1>&2
+	  exit 1
+	  ;;
+	esac
+
+	if test $age -gt $current; then
+	  $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2
+	  $echo "$modename: \`$vinfo' is not valid version information" 1>&2
+	  exit 1
+	fi
+
+	# Calculate the version variables.
+	major=
+	versuffix=
+	verstring=
+	case $version_type in
+	none) ;;
+
+	darwin)
+	  # Like Linux, but with the current version available in
+	  # verstring for coding it into the library header
+	  major=.`expr $current - $age`
+	  versuffix="$major.$age.$revision"
+	  # Darwin ld doesn't like 0 for these options...
+	  minor_current=`expr $current + 1`
+	  verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
+	  ;;
+
+	freebsd-aout)
+	  major=".$current"
+	  versuffix=".$current.$revision";
+	  ;;
+
+	freebsd-elf)
+	  major=".$current"
+	  versuffix=".$current";
+	  ;;
+
+	irix | nonstopux)
+	  major=`expr $current - $age + 1`
+
+	  case $version_type in
+	    nonstopux) verstring_prefix=nonstopux ;;
+	    *)         verstring_prefix=sgi ;;
+	  esac
+	  verstring="$verstring_prefix$major.$revision"
+
+	  # Add in all the interfaces that we are compatible with.
+	  loop=$revision
+	  while test $loop != 0; do
+	    iface=`expr $revision - $loop`
+	    loop=`expr $loop - 1`
+	    verstring="$verstring_prefix$major.$iface:$verstring"
+	  done
+
+	  # Before this point, $major must not contain `.'.
+	  major=.$major
+	  versuffix="$major.$revision"
+	  ;;
+
+	linux)
+	  major=.`expr $current - $age`
+	  versuffix="$major.$age.$revision"
+	  ;;
+
+	osf)
+	  major=.`expr $current - $age`
+	  versuffix=".$current.$age.$revision"
+	  verstring="$current.$age.$revision"
+
+	  # Add in all the interfaces that we are compatible with.
+	  loop=$age
+	  while test $loop != 0; do
+	    iface=`expr $current - $loop`
+	    loop=`expr $loop - 1`
+	    verstring="$verstring:${iface}.0"
+	  done
+
+	  # Make executables depend on our current version.
+	  verstring="$verstring:${current}.0"
+	  ;;
+
+	sunos)
+	  major=".$current"
+	  versuffix=".$current.$revision"
+	  ;;
+
+	windows)
+	  # Use '-' rather than '.', since we only want one
+	  # extension on DOS 8.3 filesystems.
+	  major=`expr $current - $age`
+	  versuffix="-$major"
+	  ;;
+
+	*)
+	  $echo "$modename: unknown library version type \`$version_type'" 1>&2
+	  echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
+	  exit 1
+	  ;;
+	esac
+
+	# Clear the version info if we defaulted, and they specified a release.
+	if test -z "$vinfo" && test -n "$release"; then
+	  major=
+	  verstring="0.0"
+	  case $version_type in
+	  darwin)
+	    # we can't check for "0.0" in archive_cmds due to quoting
+	    # problems, so we reset it completely
+	    verstring=""
+	    ;;
+	  *)
+	    verstring="0.0"
+	    ;;
+	  esac
+	  if test "$need_version" = no; then
+	    versuffix=
+	  else
+	    versuffix=".0.0"
+	  fi
+	fi
+
+	# Remove version info from name if versioning should be avoided
+	if test "$avoid_version" = yes && test "$need_version" = no; then
+	  major=
+	  versuffix=
+	  verstring=""
+	fi
+
+	# Check to see if the archive will have undefined symbols.
+	if test "$allow_undefined" = yes; then
+	  if test "$allow_undefined_flag" = unsupported; then
+	    $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2
+	    build_libtool_libs=no
+	    build_old_libs=yes
+	  fi
+	else
+	  # Don't allow undefined symbols.
+	  allow_undefined_flag="$no_undefined_flag"
+	fi
+      fi
+
+      if test "$mode" != relink; then
+	# Remove our outputs.
+	$show "${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.*"
+	$run ${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.*
+      fi
+
+      # Now set the variables for building old libraries.
+      if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
+	oldlibs="$oldlibs $output_objdir/$libname.$libext"
+
+	# Transform .lo files to .o files.
+	oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP`
+      fi
+
+      # Eliminate all temporary directories.
+      for path in $notinst_path; do
+	lib_search_path=`echo "$lib_search_path " | ${SED} -e 's% $path % %g'`
+	deplibs=`echo "$deplibs " | ${SED} -e 's% -L$path % %g'`
+	dependency_libs=`echo "$dependency_libs " | ${SED} -e 's% -L$path % %g'`
+      done
+
+      if test -n "$xrpath"; then
+	# If the user specified any rpath flags, then add them.
+	temp_xrpath=
+	for libdir in $xrpath; do
+	  temp_xrpath="$temp_xrpath -R$libdir"
+	  case "$finalize_rpath " in
+	  *" $libdir "*) ;;
+	  *) finalize_rpath="$finalize_rpath $libdir" ;;
+	  esac
+	done
+	if test $hardcode_into_libs != yes || test $build_old_libs = yes; then
+	  dependency_libs="$temp_xrpath $dependency_libs"
+	fi
+      fi
+
+      # Make sure dlfiles contains only unique files that won't be dlpreopened
+      old_dlfiles="$dlfiles"
+      dlfiles=
+      for lib in $old_dlfiles; do
+	case " $dlprefiles $dlfiles " in
+	*" $lib "*) ;;
+	*) dlfiles="$dlfiles $lib" ;;
+	esac
+      done
+
+      # Make sure dlprefiles contains only unique files
+      old_dlprefiles="$dlprefiles"
+      dlprefiles=
+      for lib in $old_dlprefiles; do
+	case "$dlprefiles " in
+	*" $lib "*) ;;
+	*) dlprefiles="$dlprefiles $lib" ;;
+	esac
+      done
+
+      if test "$build_libtool_libs" = yes; then
+	if test -n "$rpath"; then
+	  case $host in
+	  *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*)
+	    # these systems don't actually have a c library (as such)!
+	    ;;
+	  *-*-rhapsody* | *-*-darwin1.[012])
+	    # Rhapsody C library is in the System framework
+	    deplibs="$deplibs -framework System"
+	    ;;
+	  *-*-netbsd*)
+	    # Don't link with libc until the a.out ld.so is fixed.
+	    ;;
+	  *-*-openbsd* | *-*-freebsd*)
+	    # Do not include libc due to us having libc/libc_r.
+	    ;;
+	  *)
+	    # Add libc to deplibs on all other systems if necessary.
+	    if test $build_libtool_need_lc = "yes"; then
+	      deplibs="$deplibs -lc"
+	    fi
+	    ;;
+	  esac
+	fi
+
+	# Transform deplibs into only deplibs that can be linked in shared.
+	name_save=$name
+	libname_save=$libname
+	release_save=$release
+	versuffix_save=$versuffix
+	major_save=$major
+	# I'm not sure if I'm treating the release correctly.  I think
+	# release should show up in the -l (ie -lgmp5) so we don't want to
+	# add it in twice.  Is that correct?
+	release=""
+	versuffix=""
+	major=""
+	newdeplibs=
+	droppeddeps=no
+	case $deplibs_check_method in
+	pass_all)
+	  # Don't check for shared/static.  Everything works.
+	  # This might be a little naive.  We might want to check
+	  # whether the library exists or not.  But this is on
+	  # osf3 & osf4 and I'm not really sure... Just
+	  # implementing what was already the behaviour.
+	  newdeplibs=$deplibs
+	  ;;
+	test_compile)
+	  # This code stresses the "libraries are programs" paradigm to its
+	  # limits. Maybe even breaks it.  We compile a program, linking it
+	  # against the deplibs as a proxy for the library.  Then we can check
+	  # whether they linked in statically or dynamically with ldd.
+	  $rm conftest.c
+	  cat > conftest.c <<EOF
+	  int main() { return 0; }
+EOF
+	  $rm conftest
+	  $CC -o conftest conftest.c $deplibs
+	  if test $? -eq 0 ; then
+	    ldd_output=`ldd conftest`
+	    for i in $deplibs; do
+	      name="`expr $i : '-l\(.*\)'`"
+	      # If $name is empty we are operating on a -L argument.
+	      if test -n "$name" && test "$name" != "0"; then
+		libname=`eval \\$echo \"$libname_spec\"`
+		deplib_matches=`eval \\$echo \"$library_names_spec\"`
+		set dummy $deplib_matches
+		deplib_match=$2
+		if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
+		  newdeplibs="$newdeplibs $i"
+		else
+		  droppeddeps=yes
+		  echo
+		  echo "*** Warning: dynamic linker does not accept needed library $i."
+		  echo "*** I have the capability to make that library automatically link in when"
+		  echo "*** you link to this library.  But I can only do this if you have a"
+		  echo "*** shared version of the library, which I believe you do not have"
+		  echo "*** because a test_compile did reveal that the linker did not use it for"
+		  echo "*** its dynamic dependency list that programs get resolved with at runtime."
+		fi
+	      else
+		newdeplibs="$newdeplibs $i"
+	      fi
+	    done
+	  else
+	    # Error occured in the first compile.  Let's try to salvage
+	    # the situation: Compile a separate program for each library.
+	    for i in $deplibs; do
+	      name="`expr $i : '-l\(.*\)'`"
+	     # If $name is empty we are operating on a -L argument.
+	      if test -n "$name" && test "$name" != "0"; then
+		$rm conftest
+		$CC -o conftest conftest.c $i
+		# Did it work?
+		if test $? -eq 0 ; then
+		  ldd_output=`ldd conftest`
+		  libname=`eval \\$echo \"$libname_spec\"`
+		  deplib_matches=`eval \\$echo \"$library_names_spec\"`
+		  set dummy $deplib_matches
+		  deplib_match=$2
+		  if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
+		    newdeplibs="$newdeplibs $i"
+		  else
+		    droppeddeps=yes
+		    echo
+		    echo "*** Warning: dynamic linker does not accept needed library $i."
+		    echo "*** I have the capability to make that library automatically link in when"
+		    echo "*** you link to this library.  But I can only do this if you have a"
+		    echo "*** shared version of the library, which you do not appear to have"
+		    echo "*** because a test_compile did reveal that the linker did not use this one"
+		    echo "*** as a dynamic dependency that programs can get resolved with at runtime."
+		  fi
+		else
+		  droppeddeps=yes
+		  echo
+		  echo "*** Warning!  Library $i is needed by this library but I was not able to"
+		  echo "***  make it link in!  You will probably need to install it or some"
+		  echo "*** library that it depends on before this library will be fully"
+		  echo "*** functional.  Installing it before continuing would be even better."
+		fi
+	      else
+		newdeplibs="$newdeplibs $i"
+	      fi
+	    done
+	  fi
+	  ;;
+	file_magic*)
+	  set dummy $deplibs_check_method
+	  file_magic_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
+	  for a_deplib in $deplibs; do
+	    name="`expr $a_deplib : '-l\(.*\)'`"
+	    # If $name is empty we are operating on a -L argument.
+	    if test -n "$name" && test "$name" != "0"; then
+	      libname=`eval \\$echo \"$libname_spec\"`
+	      for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
+		    potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
+		    for potent_lib in $potential_libs; do
+		      # Follow soft links.
+		      if ls -lLd "$potent_lib" 2>/dev/null \
+			 | grep " -> " >/dev/null; then
+			continue
+		      fi
+		      # The statement above tries to avoid entering an
+		      # endless loop below, in case of cyclic links.
+		      # We might still enter an endless loop, since a link
+		      # loop can be closed while we follow links,
+		      # but so what?
+		      potlib="$potent_lib"
+		      while test -h "$potlib" 2>/dev/null; do
+			potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'`
+			case $potliblink in
+			[\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
+			*) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";;
+			esac
+		      done
+		      if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \
+			 | ${SED} 10q \
+			 | egrep "$file_magic_regex" > /dev/null; then
+			newdeplibs="$newdeplibs $a_deplib"
+			a_deplib=""
+			break 2
+		      fi
+		    done
+	      done
+	      if test -n "$a_deplib" ; then
+		droppeddeps=yes
+		echo
+		echo "*** Warning: linker path does not have real file for library $a_deplib."
+		echo "*** I have the capability to make that library automatically link in when"
+		echo "*** you link to this library.  But I can only do this if you have a"
+		echo "*** shared version of the library, which you do not appear to have"
+		echo "*** because I did check the linker path looking for a file starting"
+		if test -z "$potlib" ; then
+		  echo "*** with $libname but no candidates were found. (...for file magic test)"
+		else
+		  echo "*** with $libname and none of the candidates passed a file format test"
+		  echo "*** using a file magic. Last file checked: $potlib"
+		fi
+	      fi
+	    else
+	      # Add a -L argument.
+	      newdeplibs="$newdeplibs $a_deplib"
+	    fi
+	  done # Gone through all deplibs.
+	  ;;
+	match_pattern*)
+	  set dummy $deplibs_check_method
+	  match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
+	  for a_deplib in $deplibs; do
+	    name="`expr $a_deplib : '-l\(.*\)'`"
+	    # If $name is empty we are operating on a -L argument.
+	    if test -n "$name" && test "$name" != "0"; then
+	      libname=`eval \\$echo \"$libname_spec\"`
+	      for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
+		potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
+		for potent_lib in $potential_libs; do
+		  potlib="$potent_lib" # see symlink-check below in file_magic test
+		  if eval echo \"$potent_lib\" 2>/dev/null \
+		      | ${SED} 10q \
+		      | egrep "$match_pattern_regex" > /dev/null; then
+		    newdeplibs="$newdeplibs $a_deplib"
+		    a_deplib=""
+		    break 2
+		  fi
+		done
+	      done
+	      if test -n "$a_deplib" ; then
+		droppeddeps=yes
+		echo
+		echo "*** Warning: linker path does not have real file for library $a_deplib."
+		echo "*** I have the capability to make that library automatically link in when"
+		echo "*** you link to this library.  But I can only do this if you have a"
+		echo "*** shared version of the library, which you do not appear to have"
+		echo "*** because I did check the linker path looking for a file starting"
+		if test -z "$potlib" ; then
+		  echo "*** with $libname but no candidates were found. (...for regex pattern test)"
+		else
+		  echo "*** with $libname and none of the candidates passed a file format test"
+		  echo "*** using a regex pattern. Last file checked: $potlib"
+		fi
+	      fi
+	    else
+	      # Add a -L argument.
+	      newdeplibs="$newdeplibs $a_deplib"
+	    fi
+	  done # Gone through all deplibs.
+	  ;;
+	none | unknown | *)
+	  newdeplibs=""
+	  if $echo "X $deplibs" | $Xsed -e 's/ -lc$//' \
+	       -e 's/ -[LR][^ ]*//g' -e 's/[ 	]//g' |
+	     grep . >/dev/null; then
+	    echo
+	    if test "X$deplibs_check_method" = "Xnone"; then
+	      echo "*** Warning: inter-library dependencies are not supported in this platform."
+	    else
+	      echo "*** Warning: inter-library dependencies are not known to be supported."
+	    fi
+	    echo "*** All declared inter-library dependencies are being dropped."
+	    droppeddeps=yes
+	  fi
+	  ;;
+	esac
+	versuffix=$versuffix_save
+	major=$major_save
+	release=$release_save
+	libname=$libname_save
+	name=$name_save
+
+	case $host in
+	*-*-rhapsody* | *-*-darwin1.[012])
+	  # On Rhapsody replace the C library is the System framework
+	  newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / -framework System /'`
+	  ;;
+	esac
+
+	if test "$droppeddeps" = yes; then
+	  if test "$module" = yes; then
+	    echo
+	    echo "*** Warning: libtool could not satisfy all declared inter-library"
+	    echo "*** dependencies of module $libname.  Therefore, libtool will create"
+	    echo "*** a static module, that should work as long as the dlopening"
+	    echo "*** application is linked with the -dlopen flag."
+	    if test -z "$global_symbol_pipe"; then
+	      echo
+	      echo "*** However, this would only work if libtool was able to extract symbol"
+	      echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
+	      echo "*** not find such a program.  So, this module is probably useless."
+	      echo "*** \`nm' from GNU binutils and a full rebuild may help."
+	    fi
+	    if test "$build_old_libs" = no; then
+	      oldlibs="$output_objdir/$libname.$libext"
+	      build_libtool_libs=module
+	      build_old_libs=yes
+	    else
+	      build_libtool_libs=no
+	    fi
+	  else
+	    echo "*** The inter-library dependencies that have been dropped here will be"
+	    echo "*** automatically added whenever a program is linked with this library"
+	    echo "*** or is declared to -dlopen it."
+
+	    if test $allow_undefined = no; then
+	      echo
+	      echo "*** Since this library must not contain undefined symbols,"
+	      echo "*** because either the platform does not support them or"
+	      echo "*** it was explicitly requested with -no-undefined,"
+	      echo "*** libtool will only create a static version of it."
+	      if test "$build_old_libs" = no; then
+		oldlibs="$output_objdir/$libname.$libext"
+		build_libtool_libs=module
+		build_old_libs=yes
+	      else
+		build_libtool_libs=no
+	      fi
+	    fi
+	  fi
+	fi
+	# Done checking deplibs!
+	deplibs=$newdeplibs
+      fi
+
+      # All the library-specific variables (install_libdir is set above).
+      library_names=
+      old_library=
+      dlname=
+
+      # Test again, we may have decided not to build it any more
+      if test "$build_libtool_libs" = yes; then
+	if test $hardcode_into_libs = yes; then
+	  # Hardcode the library paths
+	  hardcode_libdirs=
+	  dep_rpath=
+	  rpath="$finalize_rpath"
+	  test "$mode" != relink && rpath="$compile_rpath$rpath"
+	  for libdir in $rpath; do
+	    if test -n "$hardcode_libdir_flag_spec"; then
+	      if test -n "$hardcode_libdir_separator"; then
+		if test -z "$hardcode_libdirs"; then
+		  hardcode_libdirs="$libdir"
+		else
+		  # Just accumulate the unique libdirs.
+		  case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
+		  *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
+		    ;;
+		  *)
+		    hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
+		    ;;
+		  esac
+		fi
+	      else
+		eval flag=\"$hardcode_libdir_flag_spec\"
+		dep_rpath="$dep_rpath $flag"
+	      fi
+	    elif test -n "$runpath_var"; then
+	      case "$perm_rpath " in
+	      *" $libdir "*) ;;
+	      *) perm_rpath="$perm_rpath $libdir" ;;
+	      esac
+	    fi
+	  done
+	  # Substitute the hardcoded libdirs into the rpath.
+	  if test -n "$hardcode_libdir_separator" &&
+	     test -n "$hardcode_libdirs"; then
+	    libdir="$hardcode_libdirs"
+	    eval dep_rpath=\"$hardcode_libdir_flag_spec\"
+	  fi
+	  if test -n "$runpath_var" && test -n "$perm_rpath"; then
+	    # We should set the runpath_var.
+	    rpath=
+	    for dir in $perm_rpath; do
+	      rpath="$rpath$dir:"
+	    done
+	    eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
+	  fi
+	  test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
+	fi
+
+	shlibpath="$finalize_shlibpath"
+	test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
+	if test -n "$shlibpath"; then
+	  eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
+	fi
+
+	# Get the real and link names of the library.
+	eval library_names=\"$library_names_spec\"
+	set dummy $library_names
+	realname="$2"
+	shift; shift
+
+	if test -n "$soname_spec"; then
+	  eval soname=\"$soname_spec\"
+	else
+	  soname="$realname"
+	fi
+	test -z "$dlname" && dlname=$soname
+
+	lib="$output_objdir/$realname"
+	for link
+	do
+	  linknames="$linknames $link"
+	done
+
+	# Ensure that we have .o objects for linkers which dislike .lo
+	# (e.g. aix) in case we are running --disable-static
+	for obj in $libobjs; do
+	  xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
+	  if test "X$xdir" = "X$obj"; then
+	    xdir="."
+	  else
+	    xdir="$xdir"
+	  fi
+	  baseobj=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
+	  oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"`
+	  if test ! -f $xdir/$oldobj; then
+	    $show "(cd $xdir && ${LN_S} $baseobj $oldobj)"
+	    $run eval '(cd $xdir && ${LN_S} $baseobj $oldobj)' || exit $?
+	  fi
+	done
+
+	# Use standard objects if they are pic
+	test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
+
+	# Prepare the list of exported symbols
+	if test -z "$export_symbols"; then
+	  if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
+	    $show "generating symbol list for \`$libname.la'"
+	    export_symbols="$output_objdir/$libname.exp"
+	    $run $rm $export_symbols
+	    eval cmds=\"$export_symbols_cmds\"
+	    save_ifs="$IFS"; IFS='~'
+	    for cmd in $cmds; do
+	      IFS="$save_ifs"
+	      $show "$cmd"
+	      $run eval "$cmd" || exit $?
+	    done
+	    IFS="$save_ifs"
+	    if test -n "$export_symbols_regex"; then
+	      $show "egrep -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\""
+	      $run eval 'egrep -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
+	      $show "$mv \"${export_symbols}T\" \"$export_symbols\""
+	      $run eval '$mv "${export_symbols}T" "$export_symbols"'
+	    fi
+	  fi
+	fi
+
+	if test -n "$export_symbols" && test -n "$include_expsyms"; then
+	  $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"'
+	fi
+
+	if test -n "$convenience"; then
+	  if test -n "$whole_archive_flag_spec"; then
+	    eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
+	  else
+	    gentop="$output_objdir/${outputname}x"
+	    $show "${rm}r $gentop"
+	    $run ${rm}r "$gentop"
+	    $show "mkdir $gentop"
+	    $run mkdir "$gentop"
+	    status=$?
+	    if test $status -ne 0 && test ! -d "$gentop"; then
+	      exit $status
+	    fi
+	    generated="$generated $gentop"
+
+	    for xlib in $convenience; do
+	      # Extract the objects.
+	      case $xlib in
+	      [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
+	      *) xabs=`pwd`"/$xlib" ;;
+	      esac
+	      xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
+	      xdir="$gentop/$xlib"
+
+	      $show "${rm}r $xdir"
+	      $run ${rm}r "$xdir"
+	      $show "mkdir $xdir"
+	      $run mkdir "$xdir"
+	      status=$?
+	      if test $status -ne 0 && test ! -d "$xdir"; then
+		exit $status
+	      fi
+	      $show "(cd $xdir && $AR x $xabs)"
+	      $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
+
+	      libobjs="$libobjs "`find $xdir -name \*.o -print -o -name \*.lo -print | $NL2SP`
+	    done
+	  fi
+	fi
+
+	if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
+	  eval flag=\"$thread_safe_flag_spec\"
+	  linker_flags="$linker_flags $flag"
+	fi
+
+	# Make a backup of the uninstalled library when relinking
+	if test "$mode" = relink; then
+	  $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $?
+	fi
+
+	# Do each of the archive commands.
+	if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
+	  eval cmds=\"$archive_expsym_cmds\"
+	else
+	  save_deplibs="$deplibs"
+	  for conv in $convenience; do
+	    tmp_deplibs=
+	    for test_deplib in $deplibs; do
+	      if test "$test_deplib" != "$conv"; then
+		tmp_deplibs="$tmp_deplibs $test_deplib"
+	      fi
+	    done
+	    deplibs="$tmp_deplibs"
+	  done
+	  eval cmds=\"$archive_cmds\"
+	  deplibs="$save_deplibs"
+	fi
+	save_ifs="$IFS"; IFS='~'
+	for cmd in $cmds; do
+	  IFS="$save_ifs"
+	  $show "$cmd"
+	  $run eval "$cmd" || exit $?
+	done
+	IFS="$save_ifs"
+
+	# Restore the uninstalled library and exit
+	if test "$mode" = relink; then
+	  $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $?
+	  exit 0
+	fi
+
+	# Create links to the real library.
+	for linkname in $linknames; do
+	  if test "$realname" != "$linkname"; then
+	    $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)"
+	    $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $?
+	  fi
+	done
+
+	# If -module or -export-dynamic was specified, set the dlname.
+	if test "$module" = yes || test "$export_dynamic" = yes; then
+	  # On all known operating systems, these are identical.
+	  dlname="$soname"
+	fi
+      fi
+      ;;
+
+    obj)
+      if test -n "$deplibs"; then
+	$echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2
+      fi
+
+      if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
+	$echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2
+      fi
+
+      if test -n "$rpath"; then
+	$echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2
+      fi
+
+      if test -n "$xrpath"; then
+	$echo "$modename: warning: \`-R' is ignored for objects" 1>&2
+      fi
+
+      if test -n "$vinfo"; then
+	$echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2
+      fi
+
+      if test -n "$release"; then
+	$echo "$modename: warning: \`-release' is ignored for objects" 1>&2
+      fi
+
+      case $output in
+      *.lo)
+	if test -n "$objs$old_deplibs"; then
+	  $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2
+	  exit 1
+	fi
+	libobj="$output"
+	obj=`$echo "X$output" | $Xsed -e "$lo2o"`
+	;;
+      *)
+	libobj=
+	obj="$output"
+	;;
+      esac
+
+      # Delete the old objects.
+      $run $rm $obj $libobj
+
+      # Objects from convenience libraries.  This assumes
+      # single-version convenience libraries.  Whenever we create
+      # different ones for PIC/non-PIC, this we'll have to duplicate
+      # the extraction.
+      reload_conv_objs=
+      gentop=
+      # reload_cmds runs $LD directly, so let us get rid of
+      # -Wl from whole_archive_flag_spec
+      wl=
+
+      if test -n "$convenience"; then
+	if test -n "$whole_archive_flag_spec"; then
+	  eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\"
+	else
+	  gentop="$output_objdir/${obj}x"
+	  $show "${rm}r $gentop"
+	  $run ${rm}r "$gentop"
+	  $show "mkdir $gentop"
+	  $run mkdir "$gentop"
+	  status=$?
+	  if test $status -ne 0 && test ! -d "$gentop"; then
+	    exit $status
+	  fi
+	  generated="$generated $gentop"
+
+	  for xlib in $convenience; do
+	    # Extract the objects.
+	    case $xlib in
+	    [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
+	    *) xabs=`pwd`"/$xlib" ;;
+	    esac
+	    xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
+	    xdir="$gentop/$xlib"
+
+	    $show "${rm}r $xdir"
+	    $run ${rm}r "$xdir"
+	    $show "mkdir $xdir"
+	    $run mkdir "$xdir"
+	    status=$?
+	    if test $status -ne 0 && test ! -d "$xdir"; then
+	      exit $status
+	    fi
+	    $show "(cd $xdir && $AR x $xabs)"
+	    $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
+
+	    reload_conv_objs="$reload_objs "`find $xdir -name \*.o -print -o -name \*.lo -print | $NL2SP`
+	  done
+	fi
+      fi
+
+      # Create the old-style object.
+      reload_objs="$objs$old_deplibs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test
+
+      output="$obj"
+      eval cmds=\"$reload_cmds\"
+      save_ifs="$IFS"; IFS='~'
+      for cmd in $cmds; do
+	IFS="$save_ifs"
+	$show "$cmd"
+	$run eval "$cmd" || exit $?
+      done
+      IFS="$save_ifs"
+
+      # Exit if we aren't doing a library object file.
+      if test -z "$libobj"; then
+	if test -n "$gentop"; then
+	  $show "${rm}r $gentop"
+	  $run ${rm}r $gentop
+	fi
+
+	exit 0
+      fi
+
+      if test "$build_libtool_libs" != yes; then
+	if test -n "$gentop"; then
+	  $show "${rm}r $gentop"
+	  $run ${rm}r $gentop
+	fi
+
+	# Create an invalid libtool object if no PIC, so that we don't
+	# accidentally link it into a program.
+	$show "echo timestamp > $libobj"
+	$run eval "echo timestamp > $libobj" || exit $?
+	exit 0
+      fi
+
+      if test -n "$pic_flag" || test "$pic_mode" != default; then
+	# Only do commands if we really have different PIC objects.
+	reload_objs="$libobjs $reload_conv_objs"
+	output="$libobj"
+	eval cmds=\"$reload_cmds\"
+	save_ifs="$IFS"; IFS='~'
+	for cmd in $cmds; do
+	  IFS="$save_ifs"
+	  $show "$cmd"
+	  $run eval "$cmd" || exit $?
+	done
+	IFS="$save_ifs"
+      else
+	# Just create a symlink.
+	$show $rm $libobj
+	$run $rm $libobj
+	xdir=`$echo "X$libobj" | $Xsed -e 's%/[^/]*$%%'`
+	if test "X$xdir" = "X$libobj"; then
+	  xdir="."
+	else
+	  xdir="$xdir"
+	fi
+	baseobj=`$echo "X$libobj" | $Xsed -e 's%^.*/%%'`
+	oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"`
+	$show "(cd $xdir && $LN_S $oldobj $baseobj)"
+	$run eval '(cd $xdir && $LN_S $oldobj $baseobj)' || exit $?
+      fi
+
+      if test -n "$gentop"; then
+	$show "${rm}r $gentop"
+	$run ${rm}r $gentop
+      fi
+
+      exit 0
+      ;;
+
+    prog)
+      case $host in
+	*cygwin*) output=`echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,'` ;;
+      esac
+      if test -n "$vinfo"; then
+	$echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2
+      fi
+
+      if test -n "$release"; then
+	$echo "$modename: warning: \`-release' is ignored for programs" 1>&2
+      fi
+
+      if test "$preload" = yes; then
+	if test "$dlopen_support" = unknown && test "$dlopen_self" = unknown &&
+	   test "$dlopen_self_static" = unknown; then
+	  $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support."
+	fi
+      fi
+
+      case $host in
+      *-*-rhapsody* | *-*-darwin1.[012])
+	# On Rhapsody replace the C library is the System framework
+	compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
+	finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
+	case $host in
+	*darwin*)
+	  # Don't allow lazy linking, it breaks C++ global constructors
+	  compile_command="$compile_command ${wl}-bind_at_load"
+	  finalize_command="$finalize_command ${wl}-bind_at_load"
+	  ;;
+	esac
+	;;
+      esac
+
+      compile_command="$compile_command $compile_deplibs"
+      finalize_command="$finalize_command $finalize_deplibs"
+
+      if test -n "$rpath$xrpath"; then
+	# If the user specified any rpath flags, then add them.
+	for libdir in $rpath $xrpath; do
+	  # This is the magic to use -rpath.
+	  case "$finalize_rpath " in
+	  *" $libdir "*) ;;
+	  *) finalize_rpath="$finalize_rpath $libdir" ;;
+	  esac
+	done
+      fi
+
+      # Now hardcode the library paths
+      rpath=
+      hardcode_libdirs=
+      for libdir in $compile_rpath $finalize_rpath; do
+	if test -n "$hardcode_libdir_flag_spec"; then
+	  if test -n "$hardcode_libdir_separator"; then
+	    if test -z "$hardcode_libdirs"; then
+	      hardcode_libdirs="$libdir"
+	    else
+	      # Just accumulate the unique libdirs.
+	      case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
+	      *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
+		;;
+	      *)
+		hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
+		;;
+	      esac
+	    fi
+	  else
+	    eval flag=\"$hardcode_libdir_flag_spec\"
+	    rpath="$rpath $flag"
+	  fi
+	elif test -n "$runpath_var"; then
+	  case "$perm_rpath " in
+	  *" $libdir "*) ;;
+	  *) perm_rpath="$perm_rpath $libdir" ;;
+	  esac
+	fi
+	case $host in
+	*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
+	  case :$dllsearchpath: in
+	  *":$libdir:"*) ;;
+	  *) dllsearchpath="$dllsearchpath:$libdir";;
+	  esac
+	  ;;
+	esac
+      done
+      # Substitute the hardcoded libdirs into the rpath.
+      if test -n "$hardcode_libdir_separator" &&
+	 test -n "$hardcode_libdirs"; then
+	libdir="$hardcode_libdirs"
+	eval rpath=\" $hardcode_libdir_flag_spec\"
+      fi
+      compile_rpath="$rpath"
+
+      rpath=
+      hardcode_libdirs=
+      for libdir in $finalize_rpath; do
+	if test -n "$hardcode_libdir_flag_spec"; then
+	  if test -n "$hardcode_libdir_separator"; then
+	    if test -z "$hardcode_libdirs"; then
+	      hardcode_libdirs="$libdir"
+	    else
+	      # Just accumulate the unique libdirs.
+	      case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
+	      *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
+		;;
+	      *)
+		hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
+		;;
+	      esac
+	    fi
+	  else
+	    eval flag=\"$hardcode_libdir_flag_spec\"
+	    rpath="$rpath $flag"
+	  fi
+	elif test -n "$runpath_var"; then
+	  case "$finalize_perm_rpath " in
+	  *" $libdir "*) ;;
+	  *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;;
+	  esac
+	fi
+      done
+      # Substitute the hardcoded libdirs into the rpath.
+      if test -n "$hardcode_libdir_separator" &&
+	 test -n "$hardcode_libdirs"; then
+	libdir="$hardcode_libdirs"
+	eval rpath=\" $hardcode_libdir_flag_spec\"
+      fi
+      finalize_rpath="$rpath"
+
+      if test -n "$libobjs" && test "$build_old_libs" = yes; then
+	# Transform all the library objects into standard objects.
+	compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
+	finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
+      fi
+
+      dlsyms=
+      if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
+	if test -n "$NM" && test -n "$global_symbol_pipe"; then
+	  dlsyms="${outputname}S.c"
+	else
+	  $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2
+	fi
+      fi
+
+      if test -n "$dlsyms"; then
+	case $dlsyms in
+	"") ;;
+	*.c)
+	  # Discover the nlist of each of the dlfiles.
+	  nlist="$output_objdir/${outputname}.nm"
+
+	  $show "$rm $nlist ${nlist}S ${nlist}T"
+	  $run $rm "$nlist" "${nlist}S" "${nlist}T"
+
+	  # Parse the name list into a source file.
+	  $show "creating $output_objdir/$dlsyms"
+
+	  test -z "$run" && $echo > "$output_objdir/$dlsyms" "\
+/* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */
+/* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */
+
+#ifdef __cplusplus
+extern \"C\" {
+#endif
+
+/* Prevent the only kind of declaration conflicts we can make. */
+#define lt_preloaded_symbols some_other_symbol
+
+/* External symbol declarations for the compiler. */\
+"
+
+	  if test "$dlself" = yes; then
+	    $show "generating symbol list for \`$output'"
+
+	    test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist"
+
+	    # Add our own program objects to the symbol list.
+	    progfiles=`$echo "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
+	    for arg in $progfiles; do
+	      $show "extracting global C symbols from \`$arg'"
+	      $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
+	    done
+
+	    if test -n "$exclude_expsyms"; then
+	      $run eval 'egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
+	      $run eval '$mv "$nlist"T "$nlist"'
+	    fi
+
+	    if test -n "$export_symbols_regex"; then
+	      $run eval 'egrep -e "$export_symbols_regex" "$nlist" > "$nlist"T'
+	      $run eval '$mv "$nlist"T "$nlist"'
+	    fi
+
+	    # Prepare the list of exported symbols
+	    if test -z "$export_symbols"; then
+	      export_symbols="$output_objdir/$output.exp"
+	      $run $rm $export_symbols
+	      $run eval "${SED} -n -e '/^: @PROGRAM@$/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
+	    else
+	      $run eval "${SED} -e 's/\([][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$output.exp"'
+	      $run eval 'grep -f "$output_objdir/$output.exp" < "$nlist" > "$nlist"T'
+	      $run eval 'mv "$nlist"T "$nlist"'
+	    fi
+	  fi
+
+	  for arg in $dlprefiles; do
+	    $show "extracting global C symbols from \`$arg'"
+	    name=`echo "$arg" | ${SED} -e 's%^.*/%%'`
+	    $run eval 'echo ": $name " >> "$nlist"'
+	    $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
+	  done
+
+	  if test -z "$run"; then
+	    # Make sure we have at least an empty file.
+	    test -f "$nlist" || : > "$nlist"
+
+	    if test -n "$exclude_expsyms"; then
+	      egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
+	      $mv "$nlist"T "$nlist"
+	    fi
+
+	    # Try sorting and uniquifying the output.
+	    if grep -v "^: " < "$nlist" |
+		if sort -k 3 </dev/null >/dev/null 2>&1; then
+		  sort -k 3
+		else
+		  sort +2
+		fi |
+		uniq > "$nlist"S; then
+	      :
+	    else
+	      grep -v "^: " < "$nlist" > "$nlist"S
+	    fi
+
+	    if test -f "$nlist"S; then
+	      eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"'
+	    else
+	      echo '/* NONE */' >> "$output_objdir/$dlsyms"
+	    fi
+
+	    $echo >> "$output_objdir/$dlsyms" "\
+
+#undef lt_preloaded_symbols
+
+#if defined (__STDC__) && __STDC__
+# define lt_ptr void *
+#else
+# define lt_ptr char *
+# define const
+#endif
+
+/* The mapping between symbol names and symbols. */
+const struct {
+  const char *name;
+  lt_ptr address;
+}
+lt_preloaded_symbols[] =
+{\
+"
+
+	    eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$dlsyms"
+
+	    $echo >> "$output_objdir/$dlsyms" "\
+  {0, (lt_ptr) 0}
+};
+
+/* This works around a problem in FreeBSD linker */
+#ifdef FREEBSD_WORKAROUND
+static const void *lt_preloaded_setup() {
+  return lt_preloaded_symbols;
+}
+#endif
+
+#ifdef __cplusplus
+}
+#endif\
+"
+	  fi
+
+	  pic_flag_for_symtable=
+	  case $host in
+	  # compiling the symbol table file with pic_flag works around
+	  # a FreeBSD bug that causes programs to crash when -lm is
+	  # linked before any other PIC object.  But we must not use
+	  # pic_flag when linking with -static.  The problem exists in
+	  # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
+	  *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
+	    case "$compile_command " in
+	    *" -static "*) ;;
+	    *) pic_flag_for_symtable=" $pic_flag -DPIC -DFREEBSD_WORKAROUND";;
+	    esac;;
+	  *-*-hpux*)
+	    case "$compile_command " in
+	    *" -static "*) ;;
+	    *) pic_flag_for_symtable=" $pic_flag -DPIC";;
+	    esac
+	  esac
+
+	  # Now compile the dynamic symbol file.
+	  $show "(cd $output_objdir && $CC -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")"
+	  $run eval '(cd $output_objdir && $CC -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $?
+
+	  # Clean up the generated files.
+	  $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T"
+	  $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T"
+
+	  # Transform the symbol file into the correct name.
+	  compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
+	  finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
+	  ;;
+	*)
+	  $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2
+	  exit 1
+	  ;;
+	esac
+      else
+	# We keep going just in case the user didn't refer to
+	# lt_preloaded_symbols.  The linker will fail if global_symbol_pipe
+	# really was required.
+
+	# Nullify the symbol file.
+	compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"`
+	finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"`
+      fi
+
+      if test $need_relink = no || test "$build_libtool_libs" != yes; then
+	# Replace the output file specification.
+	compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
+	link_command="$compile_command$compile_rpath"
+
+	# We have no uninstalled library dependencies, so finalize right now.
+	$show "$link_command"
+	$run eval "$link_command"
+	status=$?
+
+	# Delete the generated files.
+	if test -n "$dlsyms"; then
+	  $show "$rm $output_objdir/${outputname}S.${objext}"
+	  $run $rm "$output_objdir/${outputname}S.${objext}"
+	fi
+
+	exit $status
+      fi
+
+      if test -n "$shlibpath_var"; then
+	# We should set the shlibpath_var
+	rpath=
+	for dir in $temp_rpath; do
+	  case $dir in
+	  [\\/]* | [A-Za-z]:[\\/]*)
+	    # Absolute path.
+	    rpath="$rpath$dir:"
+	    ;;
+	  *)
+	    # Relative path: add a thisdir entry.
+	    rpath="$rpath\$thisdir/$dir:"
+	    ;;
+	  esac
+	done
+	temp_rpath="$rpath"
+      fi
+
+      if test -n "$compile_shlibpath$finalize_shlibpath"; then
+	compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
+      fi
+      if test -n "$finalize_shlibpath"; then
+	finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
+      fi
+
+      compile_var=
+      finalize_var=
+      if test -n "$runpath_var"; then
+	if test -n "$perm_rpath"; then
+	  # We should set the runpath_var.
+	  rpath=
+	  for dir in $perm_rpath; do
+	    rpath="$rpath$dir:"
+	  done
+	  compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
+	fi
+	if test -n "$finalize_perm_rpath"; then
+	  # We should set the runpath_var.
+	  rpath=
+	  for dir in $finalize_perm_rpath; do
+	    rpath="$rpath$dir:"
+	  done
+	  finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
+	fi
+      fi
+
+      if test "$no_install" = yes; then
+	# We don't need to create a wrapper script.
+	link_command="$compile_var$compile_command$compile_rpath"
+	# Replace the output file specification.
+	link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
+	# Delete the old output file.
+	$run $rm $output
+	# Link the executable and exit
+	$show "$link_command"
+	$run eval "$link_command" || exit $?
+	exit 0
+      fi
+
+      if test "$hardcode_action" = relink; then
+	# Fast installation is not supported
+	link_command="$compile_var$compile_command$compile_rpath"
+	relink_command="$finalize_var$finalize_command$finalize_rpath"
+
+	$echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2
+	$echo "$modename: \`$output' will be relinked during installation" 1>&2
+      else
+	if test "$fast_install" != no; then
+	  link_command="$finalize_var$compile_command$finalize_rpath"
+	  if test "$fast_install" = yes; then
+	    relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'`
+	  else
+	    # fast_install is set to needless
+	    relink_command=
+	  fi
+	else
+	  link_command="$compile_var$compile_command$compile_rpath"
+	  relink_command="$finalize_var$finalize_command$finalize_rpath"
+	fi
+      fi
+
+      # Replace the output file specification.
+      link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
+
+      # Delete the old output files.
+      $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname
+
+      $show "$link_command"
+      $run eval "$link_command" || exit $?
+
+      # Now create the wrapper script.
+      $show "creating $output"
+
+      # Quote the relink command for shipping.
+      if test -n "$relink_command"; then
+	# Preserve any variables that may affect compiler behavior
+	for var in $variables_saved_for_relink; do
+	  if eval test -z \"\${$var+set}\"; then
+	    relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
+	  elif eval var_value=\$$var; test -z "$var_value"; then
+	    relink_command="$var=; export $var; $relink_command"
+	  else
+	    var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
+	    relink_command="$var=\"$var_value\"; export $var; $relink_command"
+	  fi
+	done
+	relink_command="(cd `pwd`; $relink_command)"
+	relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
+      fi
+
+      # Quote $echo for shipping.
+      if test "X$echo" = "X$SHELL $0 --fallback-echo"; then
+	case $0 in
+	[\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $0 --fallback-echo";;
+	*) qecho="$SHELL `pwd`/$0 --fallback-echo";;
+	esac
+	qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"`
+      else
+	qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"`
+      fi
+
+      # Only actually do things if our run command is non-null.
+      if test -z "$run"; then
+	# win32 will think the script is a binary if it has
+	# a .exe suffix, so we strip it off here.
+	case $output in
+	  *.exe) output=`echo $output|${SED} 's,.exe$,,'` ;;
+	esac
+	# test for cygwin because mv fails w/o .exe extensions
+	case $host in
+	  *cygwin*) exeext=.exe ;;
+	  *) exeext= ;;
+	esac
+	$rm $output
+	trap "$rm $output; exit 1" 1 2 15
+
+	$echo > $output "\
+#! $SHELL
+
+# $output - temporary wrapper script for $objdir/$outputname
+# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
+#
+# The $output program cannot be directly executed until all the libtool
+# libraries that it depends on are installed.
+#
+# This wrapper script should never be moved out of the build directory.
+# If it is, it will not operate correctly.
+
+# Sed substitution that helps us do robust quoting.  It backslashifies
+# metacharacters that are still active within double-quoted strings.
+Xsed="${SED}"' -e 1s/^X//'
+sed_quote_subst='$sed_quote_subst'
+
+# The HP-UX ksh and POSIX shell print the target directory to stdout
+# if CDPATH is set.
+if test \"\${CDPATH+set}\" = set; then CDPATH=:; export CDPATH; fi
+
+relink_command=\"$relink_command\"
+
+# This environment variable determines our operation mode.
+if test \"\$libtool_install_magic\" = \"$magic\"; then
+  # install mode needs the following variable:
+  notinst_deplibs='$notinst_deplibs'
+else
+  # When we are sourced in execute mode, \$file and \$echo are already set.
+  if test \"\$libtool_execute_magic\" != \"$magic\"; then
+    echo=\"$qecho\"
+    file=\"\$0\"
+    # Make sure echo works.
+    if test \"X\$1\" = X--no-reexec; then
+      # Discard the --no-reexec flag, and continue.
+      shift
+    elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then
+      # Yippee, \$echo works!
+      :
+    else
+      # Restart under the correct shell, and then maybe \$echo will work.
+      exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"}
+    fi
+  fi\
+"
+	$echo >> $output "\
+
+  # Find the directory that this script lives in.
+  thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\`
+  test \"x\$thisdir\" = \"x\$file\" && thisdir=.
+
+  # Follow symbolic links until we get to the real thisdir.
+  file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\`
+  while test -n \"\$file\"; do
+    destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\`
+
+    # If there was a directory component, then change thisdir.
+    if test \"x\$destdir\" != \"x\$file\"; then
+      case \"\$destdir\" in
+      [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
+      *) thisdir=\"\$thisdir/\$destdir\" ;;
+      esac
+    fi
+
+    file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\`
+    file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\`
+  done
+
+  # Try to get the absolute directory name.
+  absdir=\`cd \"\$thisdir\" && pwd\`
+  test -n \"\$absdir\" && thisdir=\"\$absdir\"
+"
+
+	if test "$fast_install" = yes; then
+	  echo >> $output "\
+  program=lt-'$outputname'$exeext
+  progdir=\"\$thisdir/$objdir\"
+
+  if test ! -f \"\$progdir/\$program\" || \\
+     { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\
+       test \"X\$file\" != \"X\$progdir/\$program\"; }; then
+
+    file=\"\$\$-\$program\"
+
+    if test ! -d \"\$progdir\"; then
+      $mkdir \"\$progdir\"
+    else
+      $rm \"\$progdir/\$file\"
+    fi"
+
+	  echo >> $output "\
+
+    # relink executable if necessary
+    if test -n \"\$relink_command\"; then
+      if relink_command_output=\`eval \$relink_command 2>&1\`; then :
+      else
+	$echo \"\$relink_command_output\" >&2
+	$rm \"\$progdir/\$file\"
+	exit 1
+      fi
+    fi
+
+    $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
+    { $rm \"\$progdir/\$program\";
+      $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; }
+    $rm \"\$progdir/\$file\"
+  fi"
+	else
+	  echo >> $output "\
+  program='$outputname'
+  progdir=\"\$thisdir/$objdir\"
+"
+	fi
+
+	echo >> $output "\
+
+  if test -f \"\$progdir/\$program\"; then"
+
+	# Export our shlibpath_var if we have one.
+	if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
+	  $echo >> $output "\
+    # Add our own library path to $shlibpath_var
+    $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
+
+    # Some systems cannot cope with colon-terminated $shlibpath_var
+    # The second colon is a workaround for a bug in BeOS R4 ${SED}
+    $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\`
+
+    export $shlibpath_var
+"
+	fi
+
+	# fixup the dll searchpath if we need to.
+	if test -n "$dllsearchpath"; then
+	  $echo >> $output "\
+    # Add the dll search path components to the executable PATH
+    PATH=$dllsearchpath:\$PATH
+"
+	fi
+
+	$echo >> $output "\
+    if test \"\$libtool_execute_magic\" != \"$magic\"; then
+      # Run the actual program with our arguments.
+"
+	case $host in
+	# win32 systems need to use the prog path for dll
+	# lookup to work
+	*-*-cygwin* | *-*-pw32*)
+	  $echo >> $output "\
+      exec \$progdir/\$program \${1+\"\$@\"}
+"
+	  ;;
+
+	# Backslashes separate directories on plain windows
+	*-*-mingw | *-*-os2*)
+	  $echo >> $output "\
+      exec \$progdir\\\\\$program \${1+\"\$@\"}
+"
+	  ;;
+
+	*)
+	  $echo >> $output "\
+      # Export the path to the program.
+      PATH=\"\$progdir:\$PATH\"
+      export PATH
+
+      exec \$program \${1+\"\$@\"}
+"
+	  ;;
+	esac
+	$echo >> $output "\
+      \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\"
+      exit 1
+    fi
+  else
+    # The program doesn't exist.
+    \$echo \"\$0: error: \$progdir/\$program does not exist\" 1>&2
+    \$echo \"This script is just a wrapper for \$program.\" 1>&2
+    echo \"See the $PACKAGE documentation for more information.\" 1>&2
+    exit 1
+  fi
+fi\
+"
+	chmod +x $output
+      fi
+      exit 0
+      ;;
+    esac
+
+    # See if we need to build an old-fashioned archive.
+    for oldlib in $oldlibs; do
+
+      if test "$build_libtool_libs" = convenience; then
+	oldobjs="$libobjs_save"
+	addlibs="$convenience"
+	build_libtool_libs=no
+      else
+	if test "$build_libtool_libs" = module; then
+	  oldobjs="$libobjs_save"
+	  build_libtool_libs=no
+	else
+	  oldobjs="$objs$old_deplibs "`$echo "X$libobjs_save" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`
+	fi
+	addlibs="$old_convenience"
+      fi
+
+      if test -n "$addlibs"; then
+	gentop="$output_objdir/${outputname}x"
+	$show "${rm}r $gentop"
+	$run ${rm}r "$gentop"
+	$show "mkdir $gentop"
+	$run mkdir "$gentop"
+	status=$?
+	if test $status -ne 0 && test ! -d "$gentop"; then
+	  exit $status
+	fi
+	generated="$generated $gentop"
+
+	# Add in members from convenience archives.
+	for xlib in $addlibs; do
+	  # Extract the objects.
+	  case $xlib in
+	  [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
+	  *) xabs=`pwd`"/$xlib" ;;
+	  esac
+	  xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
+	  xdir="$gentop/$xlib"
+
+	  $show "${rm}r $xdir"
+	  $run ${rm}r "$xdir"
+	  $show "mkdir $xdir"
+	  $run mkdir "$xdir"
+	  status=$?
+	  if test $status -ne 0 && test ! -d "$xdir"; then
+	    exit $status
+	  fi
+	  $show "(cd $xdir && $AR x $xabs)"
+	  $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
+
+	  oldobjs="$oldobjs "`find $xdir -name \*.${objext} -print -o -name \*.lo -print | $NL2SP`
+	done
+      fi
+
+      # Do each command in the archive commands.
+      if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
+	eval cmds=\"$old_archive_from_new_cmds\"
+      else
+	# Ensure that we have .o objects in place in case we decided
+	# not to build a shared library, and have fallen back to building
+	# static libs even though --disable-static was passed!
+	for oldobj in $oldobjs; do
+	  if test ! -f $oldobj; then
+	    xdir=`$echo "X$oldobj" | $Xsed -e 's%/[^/]*$%%'`
+	    if test "X$xdir" = "X$oldobj"; then
+	      xdir="."
+	    else
+	      xdir="$xdir"
+	    fi
+	    baseobj=`$echo "X$oldobj" | $Xsed -e 's%^.*/%%'`
+	    obj=`$echo "X$baseobj" | $Xsed -e "$o2lo"`
+	    $show "(cd $xdir && ${LN_S} $obj $baseobj)"
+	    $run eval '(cd $xdir && ${LN_S} $obj $baseobj)' || exit $?
+	  fi
+	done
+
+	eval cmds=\"$old_archive_cmds\"
+      fi
+      save_ifs="$IFS"; IFS='~'
+      for cmd in $cmds; do
+	IFS="$save_ifs"
+	$show "$cmd"
+	$run eval "$cmd" || exit $?
+      done
+      IFS="$save_ifs"
+    done
+
+    if test -n "$generated"; then
+      $show "${rm}r$generated"
+      $run ${rm}r$generated
+    fi
+
+    # Now create the libtool archive.
+    case $output in
+    *.la)
+      old_library=
+      test "$build_old_libs" = yes && old_library="$libname.$libext"
+      $show "creating $output"
+
+      # Preserve any variables that may affect compiler behavior
+      for var in $variables_saved_for_relink; do
+	if eval test -z \"\${$var+set}\"; then
+	  relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
+	elif eval var_value=\$$var; test -z "$var_value"; then
+	  relink_command="$var=; export $var; $relink_command"
+	else
+	  var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
+	  relink_command="$var=\"$var_value\"; export $var; $relink_command"
+	fi
+      done
+      # Quote the link command for shipping.
+      relink_command="(cd `pwd`; $SHELL $0 --mode=relink $libtool_args)"
+      relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
+
+      # Only create the output if not a dry run.
+      if test -z "$run"; then
+	for installed in no yes; do
+	  if test "$installed" = yes; then
+	    if test -z "$install_libdir"; then
+	      break
+	    fi
+	    output="$output_objdir/$outputname"i
+	    # Replace all uninstalled libtool libraries with the installed ones
+	    newdependency_libs=
+	    for deplib in $dependency_libs; do
+	      case $deplib in
+	      *.la)
+		name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'`
+		eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
+		if test -z "$libdir"; then
+		  $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
+		  exit 1
+		fi
+		newdependency_libs="$newdependency_libs $libdir/$name"
+		;;
+	      *) newdependency_libs="$newdependency_libs $deplib" ;;
+	      esac
+	    done
+	    dependency_libs="$newdependency_libs"
+	    newdlfiles=
+	    for lib in $dlfiles; do
+	      name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
+	      eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
+	      if test -z "$libdir"; then
+		$echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
+		exit 1
+	      fi
+	      newdlfiles="$newdlfiles $libdir/$name"
+	    done
+	    dlfiles="$newdlfiles"
+	    newdlprefiles=
+	    for lib in $dlprefiles; do
+	      name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
+	      eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
+	      if test -z "$libdir"; then
+		$echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
+		exit 1
+	      fi
+	      newdlprefiles="$newdlprefiles $libdir/$name"
+	    done
+	    dlprefiles="$newdlprefiles"
+	  fi
+	  $rm $output
+	  # place dlname in correct position for cygwin
+	  tdlname=$dlname
+	  case $host,$output,$installed,$module,$dlname in
+	    *cygwin*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;;
+	  esac
+	  $echo > $output "\
+# $outputname - a libtool library file
+# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
+#
+# Please DO NOT delete this file!
+# It is necessary for linking the library.
+
+# The name that we can dlopen(3).
+dlname='$tdlname'
+
+# Names of this library.
+library_names='$library_names'
+
+# The name of the static archive.
+old_library='$old_library'
+
+# Libraries that this one depends upon.
+dependency_libs='$dependency_libs'
+
+# Version information for $libname.
+current=$current
+age=$age
+revision=$revision
+
+# Is this an already installed library?
+installed=$installed
+
+# Files to dlopen/dlpreopen
+dlopen='$dlfiles'
+dlpreopen='$dlprefiles'
+
+# Directory that this library needs to be installed in:
+libdir='/usr/lib'"
+	  if test "$installed" = no && test $need_relink = yes; then
+	    $echo >> $output "\
+relink_command=\"$relink_command\""
+	  fi
+	done
+      fi
+
+      # Do a symbolic link so that the libtool archive can be found in
+      # LD_LIBRARY_PATH before the program is installed.
+      $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)"
+      $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $?
+      ;;
+    esac
+    exit 0
+    ;;
+
+  # libtool install mode
+  install)
+    modename="$modename: install"
+
+    # There may be an optional sh(1) argument at the beginning of
+    # install_prog (especially on Windows NT).
+    if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
+       # Allow the use of GNU shtool's install command.
+       $echo "X$nonopt" | $Xsed | grep shtool > /dev/null; then
+      # Aesthetically quote it.
+      arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"`
+      case $arg in
+      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*)
+	arg="\"$arg\""
+	;;
+      esac
+      install_prog="$arg "
+      arg="$1"
+      shift
+    else
+      install_prog=
+      arg="$nonopt"
+    fi
+
+    # The real first argument should be the name of the installation program.
+    # Aesthetically quote it.
+    arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
+    case $arg in
+    *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*)
+      arg="\"$arg\""
+      ;;
+    esac
+    install_prog="$install_prog$arg"
+
+    # We need to accept at least all the BSD install flags.
+    dest=
+    files=
+    opts=
+    prev=
+    install_type=
+    isdir=no
+    stripme=
+    for arg
+    do
+      if test -n "$dest"; then
+	files="$files $dest"
+	dest="$arg"
+	continue
+      fi
+
+      case $arg in
+      -d) isdir=yes ;;
+      -f) prev="-f" ;;
+      -g) prev="-g" ;;
+      -m) prev="-m" ;;
+      -o) prev="-o" ;;
+      -s)
+	stripme=" -s"
+	continue
+	;;
+      -*) ;;
+
+      *)
+	# If the previous option needed an argument, then skip it.
+	if test -n "$prev"; then
+	  prev=
+	else
+	  dest="$arg"
+	  continue
+	fi
+	;;
+      esac
+
+      # Aesthetically quote the argument.
+      arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
+      case $arg in
+      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*)
+	arg="\"$arg\""
+	;;
+      esac
+      install_prog="$install_prog $arg"
+    done
+
+    if test -z "$install_prog"; then
+      $echo "$modename: you must specify an install program" 1>&2
+      $echo "$help" 1>&2
+      exit 1
+    fi
+
+    if test -n "$prev"; then
+      $echo "$modename: the \`$prev' option requires an argument" 1>&2
+      $echo "$help" 1>&2
+      exit 1
+    fi
+
+    if test -z "$files"; then
+      if test -z "$dest"; then
+	$echo "$modename: no file or destination specified" 1>&2
+      else
+	$echo "$modename: you must specify a destination" 1>&2
+      fi
+      $echo "$help" 1>&2
+      exit 1
+    fi
+
+    # Strip any trailing slash from the destination.
+    dest=`$echo "X$dest" | $Xsed -e 's%/$%%'`
+
+    # Check to see that the destination is a directory.
+    test -d "$dest" && isdir=yes
+    if test "$isdir" = yes; then
+      destdir="$dest"
+      destname=
+    else
+      destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'`
+      test "X$destdir" = "X$dest" && destdir=.
+      destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'`
+
+      # Not a directory, so check to see that there is only one file specified.
+      set dummy $files
+      if test $# -gt 2; then
+	$echo "$modename: \`$dest' is not a directory" 1>&2
+	$echo "$help" 1>&2
+	exit 1
+      fi
+    fi
+    case $destdir in
+    [\\/]* | [A-Za-z]:[\\/]*) ;;
+    *)
+      for file in $files; do
+	case $file in
+	*.lo) ;;
+	*)
+	  $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2
+	  $echo "$help" 1>&2
+	  exit 1
+	  ;;
+	esac
+      done
+      ;;
+    esac
+
+    # This variable tells wrapper scripts just to set variables rather
+    # than running their programs.
+    libtool_install_magic="$magic"
+
+    staticlibs=
+    future_libdirs=
+    current_libdirs=
+    for file in $files; do
+
+      # Do each installation.
+      case $file in
+      *.$libext)
+	# Do the static libraries later.
+	staticlibs="$staticlibs $file"
+	;;
+
+      *.la)
+	# Check to see that this really is a libtool archive.
+	if (${SED} -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
+	else
+	  $echo "$modename: \`$file' is not a valid libtool archive" 1>&2
+	  $echo "$help" 1>&2
+	  exit 1
+	fi
+
+	library_names=
+	old_library=
+	relink_command=
+	# If there is no directory component, then add one.
+	case $file in
+	*/* | *\\*) . $file ;;
+	*) . ./$file ;;
+	esac
+
+	# Add the libdir to current_libdirs if it is the destination.
+	if test "X$destdir" = "X$libdir"; then
+	  case "$current_libdirs " in
+	  *" $libdir "*) ;;
+	  *) current_libdirs="$current_libdirs $libdir" ;;
+	  esac
+	else
+	  # Note the libdir as a future libdir.
+	  case "$future_libdirs " in
+	  *" $libdir "*) ;;
+	  *) future_libdirs="$future_libdirs $libdir" ;;
+	  esac
+	fi
+
+	dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/
+	test "X$dir" = "X$file/" && dir=
+	dir="$dir$objdir"
+
+	if test -n "$relink_command"; then
+	  $echo "$modename: warning: relinking \`$file'" 1>&2
+	  $show "$relink_command"
+	  if $run eval "$relink_command"; then :
+	  else
+	    $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
+	    continue
+	  fi
+	fi
+
+	# See the names of the shared library.
+	set dummy $library_names
+	if test -n "$2"; then
+	  realname="$2"
+	  shift
+	  shift
+
+	  srcname="$realname"
+	  test -n "$relink_command" && srcname="$realname"T
+
+	  # Install the shared library and build the symlinks.
+	  $show "$install_prog $dir/$srcname $destdir/$realname"
+	  $run eval "$install_prog $dir/$srcname $destdir/$realname" || exit $?
+	  if test -n "$stripme" && test -n "$striplib"; then
+	    $show "$striplib $destdir/$realname"
+	    $run eval "$striplib $destdir/$realname" || exit $?
+	  fi
+
+	  if test $# -gt 0; then
+	    # Delete the old symlinks, and create new ones.
+	    for linkname
+	    do
+	      if test "$linkname" != "$realname"; then
+		$show "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)"
+		$run eval "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)"
+	      fi
+	    done
+	  fi
+
+	  # Do each command in the postinstall commands.
+	  lib="$destdir/$realname"
+	  eval cmds=\"$postinstall_cmds\"
+	  save_ifs="$IFS"; IFS='~'
+	  for cmd in $cmds; do
+	    IFS="$save_ifs"
+	    $show "$cmd"
+	    $run eval "$cmd" || exit $?
+	  done
+	  IFS="$save_ifs"
+	fi
+
+	# Install the pseudo-library for information purposes.
+	name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
+	instname="$dir/$name"i
+	$show "$install_prog $instname $destdir/$name"
+	$run eval "$install_prog $instname $destdir/$name" || exit $?
+
+	# Maybe install the static library, too.
+	test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
+	;;
+
+      *.lo)
+	# Install (i.e. copy) a libtool object.
+
+	# Figure out destination file name, if it wasn't already specified.
+	if test -n "$destname"; then
+	  destfile="$destdir/$destname"
+	else
+	  destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
+	  destfile="$destdir/$destfile"
+	fi
+
+	# Deduce the name of the destination old-style object file.
+	case $destfile in
+	*.lo)
+	  staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"`
+	  ;;
+	*.$objext)
+	  staticdest="$destfile"
+	  destfile=
+	  ;;
+	*)
+	  $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2
+	  $echo "$help" 1>&2
+	  exit 1
+	  ;;
+	esac
+
+	# Install the libtool object if requested.
+	if test -n "$destfile"; then
+	  $show "$install_prog $file $destfile"
+	  $run eval "$install_prog $file $destfile" || exit $?
+	fi
+
+	# Install the old object if enabled.
+	if test "$build_old_libs" = yes; then
+	  # Deduce the name of the old-style object file.
+	  staticobj=`$echo "X$file" | $Xsed -e "$lo2o"`
+
+	  $show "$install_prog $staticobj $staticdest"
+	  $run eval "$install_prog \$staticobj \$staticdest" || exit $?
+	fi
+	exit 0
+	;;
+
+      *)
+	# Figure out destination file name, if it wasn't already specified.
+	if test -n "$destname"; then
+	  destfile="$destdir/$destname"
+	else
+	  destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
+	  destfile="$destdir/$destfile"
+	fi
+
+	# Do a test to see if this is really a libtool program.
+	case $host in
+	*cygwin*|*mingw*)
+	    wrapper=`echo $file | ${SED} -e 's,.exe$,,'`
+	    ;;
+	*)
+	    wrapper=$file
+	    ;;
+	esac
+	if (${SED} -e '4q' $wrapper | egrep "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then
+	  notinst_deplibs=
+	  relink_command=
+
+	  # If there is no directory component, then add one.
+	  case $file in
+	  */* | *\\*) . $wrapper ;;
+	  *) . ./$wrapper ;;
+	  esac
+
+	  # Check the variables that should have been set.
+	  if test -z "$notinst_deplibs"; then
+	    $echo "$modename: invalid libtool wrapper script \`$wrapper'" 1>&2
+	    exit 1
+	  fi
+
+	  finalize=yes
+	  for lib in $notinst_deplibs; do
+	    # Check to see that each library is installed.
+	    libdir=
+	    if test -f "$lib"; then
+	      # If there is no directory component, then add one.
+	      case $lib in
+	      */* | *\\*) . $lib ;;
+	      *) . ./$lib ;;
+	      esac
+	    fi
+	    libfile="$libdir/"`$echo "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test
+	    if test -n "$libdir" && test ! -f "$libfile"; then
+	      $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2
+	      finalize=no
+	    fi
+	  done
+
+	  relink_command=
+	  # If there is no directory component, then add one.
+	  case $file in
+	  */* | *\\*) . $wrapper ;;
+	  *) . ./$wrapper ;;
+	  esac
+
+	  outputname=
+	  if test "$fast_install" = no && test -n "$relink_command"; then
+	    if test "$finalize" = yes && test -z "$run"; then
+	      tmpdir="/tmp"
+	      test -n "$TMPDIR" && tmpdir="$TMPDIR"
+	      tmpdir="$tmpdir/libtool-$$"
+	      if $mkdir -p "$tmpdir" && chmod 700 "$tmpdir"; then :
+	      else
+		$echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2
+		continue
+	      fi
+	      file=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
+	      outputname="$tmpdir/$file"
+	      # Replace the output file specification.
+	      relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'`
+
+	      $show "$relink_command"
+	      if $run eval "$relink_command"; then :
+	      else
+		$echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
+		${rm}r "$tmpdir"
+		continue
+	      fi
+	      file="$outputname"
+	    else
+	      $echo "$modename: warning: cannot relink \`$file'" 1>&2
+	    fi
+	  else
+	    # Install the binary that we compiled earlier.
+	    file=`$echo "X$file" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
+	  fi
+	fi
+
+	# remove .exe since cygwin /usr/bin/install will append another
+	# one anyways
+	case $install_prog,$host in
+	/usr/bin/install*,*cygwin*)
+	  case $file:$destfile in
+	  *.exe:*.exe)
+	    # this is ok
+	    ;;
+	  *.exe:*)
+	    destfile=$destfile.exe
+	    ;;
+	  *:*.exe)
+	    destfile=`echo $destfile | ${SED} -e 's,.exe$,,'`
+	    ;;
+	  esac
+	  ;;
+	esac
+	$show "$install_prog$stripme $file $destfile"
+	$run eval "$install_prog\$stripme \$file \$destfile" || exit $?
+	test -n "$outputname" && ${rm}r "$tmpdir"
+	;;
+      esac
+    done
+
+    for file in $staticlibs; do
+      name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
+
+      # Set up the ranlib parameters.
+      oldlib="$destdir/$name"
+
+      $show "$install_prog $file $oldlib"
+      $run eval "$install_prog \$file \$oldlib" || exit $?
+
+      if test -n "$stripme" && test -n "$striplib"; then
+	$show "$old_striplib $oldlib"
+	$run eval "$old_striplib $oldlib" || exit $?
+      fi
+
+      # Do each command in the postinstall commands.
+      eval cmds=\"$old_postinstall_cmds\"
+      save_ifs="$IFS"; IFS='~'
+      for cmd in $cmds; do
+	IFS="$save_ifs"
+	$show "$cmd"
+	$run eval "$cmd" || exit $?
+      done
+      IFS="$save_ifs"
+    done
+
+    if test -n "$future_libdirs"; then
+      $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2
+    fi
+
+    if test -n "$current_libdirs"; then
+      # Maybe just do a dry run.
+      test -n "$run" && current_libdirs=" -n$current_libdirs"
+      exec_cmd='$SHELL $0 --finish$current_libdirs'
+    else
+      exit 0
+    fi
+    ;;
+
+  # libtool finish mode
+  finish)
+    modename="$modename: finish"
+    libdirs="$nonopt"
+    admincmds=
+
+    if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
+      for dir
+      do
+	libdirs="$libdirs $dir"
+      done
+
+      for libdir in $libdirs; do
+	if test -n "$finish_cmds"; then
+	  # Do each command in the finish commands.
+	  eval cmds=\"$finish_cmds\"
+	  save_ifs="$IFS"; IFS='~'
+	  for cmd in $cmds; do
+	    IFS="$save_ifs"
+	    $show "$cmd"
+	    $run eval "$cmd" || admincmds="$admincmds
+       $cmd"
+	  done
+	  IFS="$save_ifs"
+	fi
+	if test -n "$finish_eval"; then
+	  # Do the single finish_eval.
+	  eval cmds=\"$finish_eval\"
+	  $run eval "$cmds" || admincmds="$admincmds
+       $cmds"
+	fi
+      done
+    fi
+
+    # Exit here if they wanted silent mode.
+    test "$show" = ":" && exit 0
+
+    echo "----------------------------------------------------------------------"
+    echo "Libraries have been installed in:"
+    for libdir in $libdirs; do
+      echo "   $libdir"
+    done
+    echo
+    echo "If you ever happen to want to link against installed libraries"
+    echo "in a given directory, LIBDIR, you must either use libtool, and"
+    echo "specify the full pathname of the library, or use the \`-LLIBDIR'"
+    echo "flag during linking and do at least one of the following:"
+    if test -n "$shlibpath_var"; then
+      echo "   - add LIBDIR to the \`$shlibpath_var' environment variable"
+      echo "     during execution"
+    fi
+    if test -n "$runpath_var"; then
+      echo "   - add LIBDIR to the \`$runpath_var' environment variable"
+      echo "     during linking"
+    fi
+    if test -n "$hardcode_libdir_flag_spec"; then
+      libdir=LIBDIR
+      eval flag=\"$hardcode_libdir_flag_spec\"
+
+      echo "   - use the \`$flag' linker flag"
+    fi
+    if test -n "$admincmds"; then
+      echo "   - have your system administrator run these commands:$admincmds"
+    fi
+    if test -f /etc/ld.so.conf; then
+      echo "   - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
+    fi
+    echo
+    echo "See any operating system documentation about shared libraries for"
+    echo "more information, such as the ld(1) and ld.so(8) manual pages."
+    echo "----------------------------------------------------------------------"
+    exit 0
+    ;;
+
+  # libtool execute mode
+  execute)
+    modename="$modename: execute"
+
+    # The first argument is the command name.
+    cmd="$nonopt"
+    if test -z "$cmd"; then
+      $echo "$modename: you must specify a COMMAND" 1>&2
+      $echo "$help"
+      exit 1
+    fi
+
+    # Handle -dlopen flags immediately.
+    for file in $execute_dlfiles; do
+      if test ! -f "$file"; then
+	$echo "$modename: \`$file' is not a file" 1>&2
+	$echo "$help" 1>&2
+	exit 1
+      fi
+
+      dir=
+      case $file in
+      *.la)
+	# Check to see that this really is a libtool archive.
+	if (${SED} -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
+	else
+	  $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
+	  $echo "$help" 1>&2
+	  exit 1
+	fi
+
+	# Read the libtool library.
+	dlname=
+	library_names=
+
+	# If there is no directory component, then add one.
+	case $file in
+	*/* | *\\*) . $file ;;
+	*) . ./$file ;;
+	esac
+
+	# Skip this library if it cannot be dlopened.
+	if test -z "$dlname"; then
+	  # Warn if it was a shared library.
+	  test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'"
+	  continue
+	fi
+
+	dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
+	test "X$dir" = "X$file" && dir=.
+
+	if test -f "$dir/$objdir/$dlname"; then
+	  dir="$dir/$objdir"
+	else
+	  $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2
+	  exit 1
+	fi
+	;;
+
+      *.lo)
+	# Just add the directory containing the .lo file.
+	dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
+	test "X$dir" = "X$file" && dir=.
+	;;
+
+      *)
+	$echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2
+	continue
+	;;
+      esac
+
+      # Get the absolute pathname.
+      absdir=`cd "$dir" && pwd`
+      test -n "$absdir" && dir="$absdir"
+
+      # Now add the directory to shlibpath_var.
+      if eval "test -z \"\$$shlibpath_var\""; then
+	eval "$shlibpath_var=\"\$dir\""
+      else
+	eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
+      fi
+    done
+
+    # This variable tells wrapper scripts just to set shlibpath_var
+    # rather than running their programs.
+    libtool_execute_magic="$magic"
+
+    # Check if any of the arguments is a wrapper script.
+    args=
+    for file
+    do
+      case $file in
+      -*) ;;
+      *)
+	# Do a test to see if this is really a libtool program.
+	if (${SED} -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
+	  # If there is no directory component, then add one.
+	  case $file in
+	  */* | *\\*) . $file ;;
+	  *) . ./$file ;;
+	  esac
+
+	  # Transform arg to wrapped name.
+	  file="$progdir/$program"
+	fi
+	;;
+      esac
+      # Quote arguments (to preserve shell metacharacters).
+      file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"`
+      args="$args \"$file\""
+    done
+
+    if test -z "$run"; then
+      if test -n "$shlibpath_var"; then
+	# Export the shlibpath_var.
+	eval "export $shlibpath_var"
+      fi
+
+      # Restore saved enviroment variables
+      if test "${save_LC_ALL+set}" = set; then
+	LC_ALL="$save_LC_ALL"; export LC_ALL
+      fi
+      if test "${save_LANG+set}" = set; then
+	LANG="$save_LANG"; export LANG
+      fi
+
+      # Now prepare to actually exec the command.
+      exec_cmd="\$cmd$args"
+    else
+      # Display what would be done.
+      if test -n "$shlibpath_var"; then
+	eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\""
+	$echo "export $shlibpath_var"
+      fi
+      $echo "$cmd$args"
+      exit 0
+    fi
+    ;;
+
+  # libtool clean and uninstall mode
+  clean | uninstall)
+    modename="$modename: $mode"
+    rm="$nonopt"
+    files=
+    rmforce=
+    exit_status=0
+
+    # This variable tells wrapper scripts just to set variables rather
+    # than running their programs.
+    libtool_install_magic="$magic"
+
+    for arg
+    do
+      case $arg in
+      -f) rm="$rm $arg"; rmforce=yes ;;
+      -*) rm="$rm $arg" ;;
+      *) files="$files $arg" ;;
+      esac
+    done
+
+    if test -z "$rm"; then
+      $echo "$modename: you must specify an RM program" 1>&2
+      $echo "$help" 1>&2
+      exit 1
+    fi
+
+    rmdirs=
+
+    for file in $files; do
+      dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
+      if test "X$dir" = "X$file"; then
+	dir=.
+	objdir="$objdir"
+      else
+	objdir="$dir/$objdir"
+      fi
+      name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
+      test $mode = uninstall && objdir="$dir"
+
+      # Remember objdir for removal later, being careful to avoid duplicates
+      if test $mode = clean; then
+	case " $rmdirs " in
+	  *" $objdir "*) ;;
+	  *) rmdirs="$rmdirs $objdir" ;;
+	esac
+      fi
+
+      # Don't error if the file doesn't exist and rm -f was used.
+      if (test -L "$file") >/dev/null 2>&1 \
+	|| (test -h "$file") >/dev/null 2>&1 \
+	|| test -f "$file"; then
+	:
+      elif test -d "$file"; then
+	exit_status=1
+	continue
+      elif test "$rmforce" = yes; then
+	continue
+      fi
+
+      rmfiles="$file"
+
+      case $name in
+      *.la)
+	# Possibly a libtool archive, so verify it.
+	if (${SED} -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
+	  . $dir/$name
+
+	  # Delete the libtool libraries and symlinks.
+	  for n in $library_names; do
+	    rmfiles="$rmfiles $objdir/$n"
+	  done
+	  test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library"
+	  test $mode = clean && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
+
+	  if test $mode = uninstall; then
+	    if test -n "$library_names"; then
+	      # Do each command in the postuninstall commands.
+	      eval cmds=\"$postuninstall_cmds\"
+	      save_ifs="$IFS"; IFS='~'
+	      for cmd in $cmds; do
+		IFS="$save_ifs"
+		$show "$cmd"
+		$run eval "$cmd"
+		if test $? != 0 && test "$rmforce" != yes; then
+		  exit_status=1
+		fi
+	      done
+	      IFS="$save_ifs"
+	    fi
+
+	    if test -n "$old_library"; then
+	      # Do each command in the old_postuninstall commands.
+	      eval cmds=\"$old_postuninstall_cmds\"
+	      save_ifs="$IFS"; IFS='~'
+	      for cmd in $cmds; do
+		IFS="$save_ifs"
+		$show "$cmd"
+		$run eval "$cmd"
+		if test $? != 0 && test "$rmforce" != yes; then
+		  exit_status=1
+		fi
+	      done
+	      IFS="$save_ifs"
+	    fi
+	    # FIXME: should reinstall the best remaining shared library.
+	  fi
+	fi
+	;;
+
+      *.lo)
+	if test "$build_old_libs" = yes; then
+	  oldobj=`$echo "X$name" | $Xsed -e "$lo2o"`
+	  rmfiles="$rmfiles $dir/$oldobj"
+	fi
+	;;
+
+      *)
+	# Do a test to see if this is a libtool program.
+	if test $mode = clean &&
+	   (${SED} -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
+	  relink_command=
+	  . $dir/$file
+
+	  rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}"
+	  if test "$fast_install" = yes && test -n "$relink_command"; then
+	    rmfiles="$rmfiles $objdir/lt-$name"
+	  fi
+	fi
+	;;
+      esac
+      $show "$rm $rmfiles"
+      $run $rm $rmfiles || exit_status=1
+    done
+
+    # Try to remove the ${objdir}s in the directories where we deleted files
+    for dir in $rmdirs; do
+      if test -d "$dir"; then
+	$show "rmdir $dir"
+	$run rmdir $dir >/dev/null 2>&1
+      fi
+    done
+
+    exit $exit_status
+    ;;
+
+  "")
+    $echo "$modename: you must specify a MODE" 1>&2
+    $echo "$generic_help" 1>&2
+    exit 1
+    ;;
+  esac
+
+  if test -z "$exec_cmd"; then
+    $echo "$modename: invalid operation mode \`$mode'" 1>&2
+    $echo "$generic_help" 1>&2
+    exit 1
+  fi
+fi # test -z "$show_help"
+
+if test -n "$exec_cmd"; then
+  eval exec $exec_cmd
+  exit 1
+fi
+
+# We need to display help for each of the modes.
+case $mode in
+"") $echo \
+"Usage: $modename [OPTION]... [MODE-ARG]...
+
+Provide generalized library-building support services.
+
+    --config          show all configuration variables
+    --debug           enable verbose shell tracing
+-n, --dry-run         display commands without modifying any files
+    --features        display basic configuration information and exit
+    --finish          same as \`--mode=finish'
+    --help            display this help message and exit
+    --mode=MODE       use operation mode MODE [default=inferred from MODE-ARGS]
+    --quiet           same as \`--silent'
+    --silent          don't print informational messages
+    --version         print version information
+
+MODE must be one of the following:
+
+      clean           remove files from the build directory
+      compile         compile a source file into a libtool object
+      execute         automatically set library path, then run a program
+      finish          complete the installation of libtool libraries
+      install         install libraries or executables
+      link            create a library or an executable
+      uninstall       remove libraries from an installed directory
+
+MODE-ARGS vary depending on the MODE.  Try \`$modename --help --mode=MODE' for
+a more detailed description of MODE."
+  exit 0
+  ;;
+
+clean)
+  $echo \
+"Usage: $modename [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
+
+Remove files from the build directory.
+
+RM is the name of the program to use to delete files associated with each FILE
+(typically \`/bin/rm').  RM-OPTIONS are options (such as \`-f') to be passed
+to RM.
+
+If FILE is a libtool library, object or program, all the files associated
+with it are deleted. Otherwise, only FILE itself is deleted using RM."
+  ;;
+
+compile)
+  $echo \
+"Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
+
+Compile a source file into a libtool library object.
+
+This mode accepts the following additional options:
+
+  -o OUTPUT-FILE    set the output file name to OUTPUT-FILE
+  -prefer-pic       try to building PIC objects only
+  -prefer-non-pic   try to building non-PIC objects only
+  -static           always build a \`.o' file suitable for static linking
+
+COMPILE-COMMAND is a command to be used in creating a \`standard' object file
+from the given SOURCEFILE.
+
+The output file name is determined by removing the directory component from
+SOURCEFILE, then substituting the C source code suffix \`.c' with the
+library object suffix, \`.lo'."
+  ;;
+
+execute)
+  $echo \
+"Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]...
+
+Automatically set library path, then run a program.
+
+This mode accepts the following additional options:
+
+  -dlopen FILE      add the directory containing FILE to the library path
+
+This mode sets the library path environment variable according to \`-dlopen'
+flags.
+
+If any of the ARGS are libtool executable wrappers, then they are translated
+into their corresponding uninstalled binary, and any of their required library
+directories are added to the library path.
+
+Then, COMMAND is executed, with ARGS as arguments."
+  ;;
+
+finish)
+  $echo \
+"Usage: $modename [OPTION]... --mode=finish [LIBDIR]...
+
+Complete the installation of libtool libraries.
+
+Each LIBDIR is a directory that contains libtool libraries.
+
+The commands that this mode executes may require superuser privileges.  Use
+the \`--dry-run' option if you just want to see what would be executed."
+  ;;
+
+install)
+  $echo \
+"Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND...
+
+Install executables or libraries.
+
+INSTALL-COMMAND is the installation command.  The first component should be
+either the \`install' or \`cp' program.
+
+The rest of the components are interpreted as arguments to that command (only
+BSD-compatible install options are recognized)."
+  ;;
+
+link)
+  $echo \
+"Usage: $modename [OPTION]... --mode=link LINK-COMMAND...
+
+Link object files or libraries together to form another library, or to
+create an executable program.
+
+LINK-COMMAND is a command using the C compiler that you would use to create
+a program from several object files.
+
+The following components of LINK-COMMAND are treated specially:
+
+  -all-static       do not do any dynamic linking at all
+  -avoid-version    do not add a version suffix if possible
+  -dlopen FILE      \`-dlpreopen' FILE if it cannot be dlopened at runtime
+  -dlpreopen FILE   link in FILE and add its symbols to lt_preloaded_symbols
+  -export-dynamic   allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
+  -export-symbols SYMFILE
+		    try to export only the symbols listed in SYMFILE
+  -export-symbols-regex REGEX
+		    try to export only the symbols matching REGEX
+  -LLIBDIR          search LIBDIR for required installed libraries
+  -lNAME            OUTPUT-FILE requires the installed library libNAME
+  -module           build a library that can dlopened
+  -no-fast-install  disable the fast-install mode
+  -no-install       link a not-installable executable
+  -no-undefined     declare that a library does not refer to external symbols
+  -o OUTPUT-FILE    create OUTPUT-FILE from the specified objects
+  -release RELEASE  specify package release information
+  -rpath LIBDIR     the created library will eventually be installed in LIBDIR
+  -R[ ]LIBDIR       add LIBDIR to the runtime path of programs and libraries
+  -static           do not do any dynamic linking of libtool libraries
+  -version-info CURRENT[:REVISION[:AGE]]
+		    specify library version info [each variable defaults to 0]
+
+All other options (arguments beginning with \`-') are ignored.
+
+Every other argument is treated as a filename.  Files ending in \`.la' are
+treated as uninstalled libtool libraries, other files are standard or library
+object files.
+
+If the OUTPUT-FILE ends in \`.la', then a libtool library is created,
+only library objects (\`.lo' files) may be specified, and \`-rpath' is
+required, except when creating a convenience library.
+
+If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
+using \`ar' and \`ranlib', or on Windows using \`lib'.
+
+If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
+is created, otherwise an executable program is created."
+  ;;
+
+uninstall)
+  $echo \
+"Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
+
+Remove libraries from an installation directory.
+
+RM is the name of the program to use to delete files associated with each FILE
+(typically \`/bin/rm').  RM-OPTIONS are options (such as \`-f') to be passed
+to RM.
+
+If FILE is a libtool library, all the files associated with it are deleted.
+Otherwise, only FILE itself is deleted using RM."
+  ;;
+
+*)
+  $echo "$modename: invalid operation mode \`$mode'" 1>&2
+  $echo "$help" 1>&2
+  exit 1
+  ;;
+esac
+
+echo
+$echo "Try \`$modename --help' for more information about other modes."
+
+exit 0
+
+# Local Variables:
+# mode:shell-script
+# sh-indentation:2
+# End:
diff -Naur tomato/release/src/router/snmp/Makefile.in tomato121/release/src/router/snmp/Makefile.in
--- tomato/release/src/router/snmp/Makefile.in	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/Makefile.in	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,264 @@
+#
+# Makefile.in (at the root of net-snmp)
+#
+
+top_builddir	= .
+
+SUBDIRS		= snmplib agent apps local man mibs
+TESTDIRS	= testing
+
+CPP		= @CPP@ 					        \
+		-Iinclude -I$(srcdir)/include -I$(srcdir)/agent/mibgroup -I. -I$(srcdir)	\
+		-DDONT_INC_STRUCTS -DBINDIR=$(bindir) 		        \
+		$(EXTRACPPFLAGS)
+
+INSTALLHEADERS=version.h
+INCLUDESUBDIR=system
+INCLUDESUBDIRHEADERS= aix.h bsd.h bsdi3.h bsdi4.h bsdi.h cygwin.h darwin.h \
+	dynix.h freebsd2.h freebsd3.h freebsd4.h freebsd.h generic.h hpux.h \
+	irix.h linux.h mips.h netbsd.h openbsd.h solaris2.6.h solaris2.7.h \
+	solaris2.8.h solaris2.9.h solaris.h sunos.h svr5.h sysv.h ultrix4.h
+INCLUDESUBDIR2=machine
+INCLUDESUBDIRHEADERS2=generic.h
+INSTALLBUILTHEADERS=include/net-snmp/net-snmp-config.h
+INSTALLBINSCRIPTS=net-snmp-config
+INSTALLUCDHEADERS=ucd-snmp-config.h version.h mib_module_config.h
+
+#
+# other install rules.
+#
+OTHERINSTALL=copypersistentfiles @PERLINSTALLTARGS@
+COPY_PERSISTENT_FILES=@COPY_PERSISTENT_FILES@
+PERSISTENT_DIRECTORY=@PERSISTENT_DIRECTORY@
+UCDPERSISTENT_DIRECTORY=@UCDPERSISTENT_DIRECTORY@
+
+#
+# perl specific
+#
+# yes, order matters here.  default_store must occur before anything else
+PERLMODULES=default_store SNMP ASN OID agent
+PERLARGS=@PERLARGS@
+
+#
+# targets
+#
+all:    sedscript EXAMPLE.conf standardall @PERLTARGS@ 
+
+start-flag:
+	@touch build-in-progress-flag
+
+end-flag:
+	@rm -f build-in-progress-flag > /dev/null 2>&1 
+
+#
+# local build rules
+#
+sedscript: sedscript.in include/net-snmp/net-snmp-config.h $(srcdir)/agent/mibgroup/mibdefs.h
+	$(CPP) $(srcdir)/sedscript.in | egrep '^s[/#]' | sed 's/REMOVEME//g;s# */#/#g;s/ *#/#/g;s#/ *#/#g;s/# g/#g/;' > sedscript
+	echo 's#DATADIR#$(datadir)#g' >> sedscript
+	echo 's#LIBDIR#$(libdir)#g' >> sedscript
+	echo 's#BINDIR#$(bindir)#g' >> sedscript
+	echo 's#PERSISTENT_DIRECTORY#$(PERSISTENT_DIRECTORY)#g' >> sedscript
+	echo 's#SYSCONFDIR#$(sysconfdir)#g' >> sedscript
+
+EXAMPLE.conf: sedscript EXAMPLE.conf.def
+	$(SED) -f sedscript $(srcdir)/EXAMPLE.conf.def > EXAMPLE.conf
+
+docs: docsdir mancp
+
+docsdir: docsdox docsmunge
+
+docsdox: doxygen.conf
+	srcdir=$(srcdir) doxygen $(srcdir)/doxygen.conf
+
+docsmunge:
+	find docs/html -name \*.html -exec perl -p -i -e 's/Generated on/<!--#include virtual=\"\/sfbutton.html\" --><br>Generated on\n/; s/<body/<body bgcolor=white/' {} \;
+
+
+mancp:
+	@for i in docs/man/man3/* ; do \
+	     cp $$i man/netsnmp_`basename $$i` ; \
+	done
+
+#
+# extra install rules
+#
+
+copypersistentfiles:
+	@if test "$(COPY_PERSISTENT_FILES)" = "yes" -a -d $(UCDPERSISTENT_DIRECTORY) -a ! -d $(PERSISTENT_DIRECTORY) ; then \
+		cp -pr $(UCDPERSISTENT_DIRECTORY) $(PERSISTENT_DIRECTORY) ; \
+		echo "copying $(UCDPERSISTENT_DIRECTORY) to $(PERSISTENT_DIRECTORY)" ; \
+	fi
+#
+# test targets
+#
+test: all testdirs
+	( cd testing; $(MAKE) test )
+
+testdirs:
+	for i in $(TESTDIRS) ; do	\
+           ( cd $$i ; $(MAKE) ) ;		\
+           if test $$? != 0 ; then \
+              exit 1 ; \
+           fi  \
+	done
+
+distall: ${srcdir}/configure ${srcdir}/include/net-snmp/net-snmp-config.h 
+
+OTHERCLEANTARGETS=EXAMPLE.conf sedscript
+OTHERCLEANTODOS=perlclean
+
+#
+# perl specific build rules
+#
+perlmodules: perlmakefiles
+	@(cd perl ; $(MAKE)) ; \
+        if test $$? != 0 ; then \
+           exit 1 ; \
+        fi
+
+perlmakefiles:
+	@if test ! -f perl/Makefile; then \
+	  (dir=`pwd`; \
+	   cd perl ; \
+	   perl Makefile.PL -NET-SNMP-IN-SOURCE=true -NET-SNMP-CONFIG="sh $$dir/net-snmp-config") $(PERLARGS) ; \
+        fi
+
+perlinstall:
+	@(cd perl ; $(MAKE) install) ; \
+        if test $$? != 0 ; then \
+           exit 1 ; \
+        fi
+
+perltest:
+	@(cd perl ; $(MAKE) test) ; \
+	if test $$? != 0 ; then \
+	   exit 1 ; \
+	fi
+
+perlclean:
+	@if test -f perl/Makefile; then \
+	   ( cd perl ; $(MAKE) clean ) ; \
+	fi
+
+#
+# make distclean completely removes all traces of building including
+# any files generated by configure itself.
+#
+distclean: clean configclean tarclean
+
+makefileclean:
+	rm -f Makefile snmplib/Makefile				\
+		agent/Makefile agent/mibgroup/Makefile		\
+		agent/helpers/Makefile				\
+		apps/Makefile  apps/snmpnetstat/Makefile	\
+		man/Makefile mibs/Makefile ov/Makefile		\
+		local/Makefile testing/Makefile
+
+configclean: makefileclean
+	rm -f config.cache config.status config.log \
+		libtool include/net-snmp/net-snmp-config.h \
+		net-snmp-config configure-summary
+	rm -f mibs/.index
+	rm -f include/net-snmp/agent/mib_module_config.h		\
+		snmplib/snmpsm_init.h                   \
+		agent/mibgroup/mib_module_includes.h 	\
+		agent/mibgroup/mib_module_inits.h 	\
+		agent/mibgroup/mib_module_shutdown.h 	\
+		agent/mibgroup/mib_module_dot_conf.h
+	rm -f *.core
+
+#
+# Configure script related targets
+#
+touchit:
+	touch configure include/net-snmp/net-snmp-config.h.in
+	touch config.status
+	touch stamp-h stamp-h.in
+
+Makefile: Makefile.in config.status Makefile.rules Makefile.top
+	@if test "x$(NOAUTODEPS)" = "x"; then \
+	    ./config.status; \
+	else \
+	    echo "WARNING: not running config.status"; \
+	fi
+
+$(srcdir)/include/net-snmp/net-snmp-config.h.in: stamp-h.in
+$(srcdir)/stamp-h.in: configure.in acconfig.h
+	@if test "x$(NOAUTODEPS)" = "x" -a "x$(AUTOHEADER)" != "x:"; then \
+	    cd ${srcdir} && LC_COLLATE=C $(AUTOHEADER); \
+	    echo timestamp > ${srcdir}/stamp-h.in; \
+	else \
+	    echo "WARNING: not running autoheader"; \
+	fi
+
+include/net-snmp/net-snmp-config.h: stamp-h
+stamp-h: include/net-snmp/net-snmp-config.h.in config.status
+	@if test "x$(NOAUTODEPS)" = "x"; then \
+	    ./config.status; \
+	    echo timestamp > stamp-h; \
+	else \
+	    echo "WARNING: not running config.status"; \
+	fi
+
+$(srcdir)/configure: configure.in aclocal.m4
+	@if test "x$(NOAUTODEPS)" = "x" -a "x$(AUTOCONF)" != "x:"; then \
+	    cd ${srcdir} && $(AUTOCONF); \
+	    echo "Please run configure now."; \
+	    sh -c exit 2; \
+	else \
+	    echo "WARNING: not running autoconf"; \
+	fi
+
+config.status: configure
+	@if test "x$(NOAUTODEPS)" = "x"; then \
+	    ./config.status --recheck; \
+	else \
+	    echo "WARNING: not running config.status --recheck"; \
+	fi
+
+#
+# Emacs TAGS file
+#
+TAGS:
+	find $(srcdir) -name '*.[ch]' -print | etags -
+
+#
+# Internal distribution packaging, etc.
+#
+version:
+	@if test "x$(VERSION)" = "x"; then \
+	  echo "you need to supply a VERSION string."; \
+	  exit 2; \
+	fi
+	${srcdir}/agent/mibgroup/versiontag $(VERSION) reverse
+
+tag:
+	@if test "x$(VERSION)" = "x"; then \
+	  echo "you need to supply a VERSION string."; \
+	  exit 2; \
+	fi
+	${srcdir}/agent/mibgroup/versiontag $(VERSION) tag
+
+tar:
+	@if test "x$(VERSION)" = "x"; then \
+	  echo "you need to supply a VERSION string."; \
+	  exit 2; \
+	fi
+	${srcdir}/agent/mibgroup/versiontag $(VERSION) tar
+
+tarclean:
+	@if test -x ${srcdir}/agent/mibgroup/versiontag ; then \
+	  ${srcdir}/agent/mibgroup/versiontag Ext clean ; \
+	fi
+
+commentcheck:
+	grep -n // `find $(srcdir)/ -name \*.\[ch\]` | egrep -v "(ftp|http|/win32/)"
+
+dist: version tag tar
+
+FAQ.html:
+	local/FAQ2HTML FAQ
+
+.PHONY: docs docsdir mancp testdirs test TAGS
+# note: tags and docs are phony to force rebulding
diff -Naur tomato/release/src/router/snmp/Makefile.rules tomato121/release/src/router/snmp/Makefile.rules
--- tomato/release/src/router/snmp/Makefile.rules	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/Makefile.rules	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,314 @@
+
+#
+# standard target definitions.  Set appropriate variables to make use of them.
+#
+# note: the strange use of the "it" variable is for shell parsing when
+# there is no targets to install for that rule.
+#
+
+# the standard items to build: libraries, bins, and sbins
+STANDARDTARGETS     =$(INSTALLLIBS) $(INSTALLBINPROGS) $(INSTALLSBINPROGS)
+STANDARDCLEANTARGETS=$(INSTALLLIBS) $(INSTALLBINPROGS) $(INSTALLSBINPROGS) $(INSTALLUCDLIBS)
+
+standardall: subdirs $(STANDARDTARGETS)
+
+subdirs:
+	@if test "$(SUBDIRS)" != ""; then \
+		it="$(SUBDIRS)" ; \
+		for i in $$it ; do       \
+			echo "making all in `pwd`/$$i"; \
+	                ( cd $$i ; $(MAKE) ) ; \
+                        if test $$? != 0 ; then \
+				exit 1 ; \
+			fi  \
+	        done \
+	fi
+
+install: installlocalheaders @installucdheaders@ \
+         installlocallibs    @installucdlibs@    \
+         installlocalbin      installlocalsbin   \
+         installsubdirs      $(OTHERINSTALL)
+
+installprogs: installbin installsbin
+
+#
+# headers
+#
+# set INSTALLHEADERS to a list of things to install in each makefile.
+# set INSTALLBUILTHEADERS to a list of things to install from builddir
+# set INSTALLSUBDIRHEADERS and INSTALLSUBDIR to subdirectory headers
+# set INSTALLSUBDIRHEADERS2 and INSTALLSUBDIR2 to more subdirectory headers
+# set INSTALLBUILTSUBDIRHEADERS and INSTALLBUILTSUBDIR to a list from builddir
+#
+installheaders: installlocalheaders @installucdheaders@ installsubdirheaders
+
+installlocalheaders:
+	@if test "$(INSTALLHEADERS)" != "" ; then \
+		echo creating directory $(includedir) ; \
+		it="$(INSTALLHEADERS)" ; \
+		$(SHELL) $(top_srcdir)/mkinstalldirs $(includedir) ; \
+	        for i in $$it ; do \
+			$(INSTALL) $(top_srcdir)/include/net-snmp/$$i $(includedir) ; \
+	                echo "installing $$i in $(includedir)" ; \
+	        done \
+	fi
+	@if test "$(INSTALLBUILTHEADERS)" != "" ; then \
+		echo creating directory $(includedir) ; \
+		it="$(INSTALLBUILTHEADERS)" ; \
+		$(SHELL) $(top_srcdir)/mkinstalldirs $(includedir) ; \
+	        for i in $$it ; do \
+			$(INSTALL) $$i $(includedir) ; \
+	                echo "installing $$i in $(includedir)" ; \
+	        done \
+	fi
+	@if test "$(INCLUDESUBDIRHEADERS)" != "" ; then \
+		echo creating directory $(includedir)/$(INCLUDESUBDIR) ; \
+		it="$(INCLUDESUBDIRHEADERS)" ; \
+		$(SHELL) $(top_srcdir)/mkinstalldirs $(includedir)/$(INCLUDESUBDIR) ; \
+	        for i in $$it ; do \
+			$(INSTALL) $(top_srcdir)/include/net-snmp/$(INCLUDESUBDIR)/$$i $(includedir)/$(INCLUDESUBDIR) ; \
+	                echo "installing $$i in $(includedir)/$(INCLUDESUBDIR)" ; \
+	        done \
+	fi
+	@if test "$(INCLUDESUBDIRHEADERS2)" != "" ; then \
+		echo creating directory $(includedir)/$(INCLUDESUBDIR2) ; \
+		it="$(INCLUDESUBDIRHEADERS2)" ; \
+		$(SHELL) $(top_srcdir)/mkinstalldirs $(includedir)/$(INCLUDESUBDIR2) ; \
+	        for i in $$it ; do \
+			$(INSTALL) $(top_srcdir)/include/net-snmp/$(INCLUDESUBDIR2)/$$i $(includedir)/$(INCLUDESUBDIR2) ; \
+	                echo "installing $$i in $(includedir)/$(INCLUDESUBDIR2)" ; \
+	        done \
+	fi
+	@if test "$(INSTALLBUILTSUBDIRHEADERS)" != "" ; then \
+		echo creating directory $(includedir)/$(INSTALLBUILTSUBDIR) ; \
+		it="$(INSTALLBUILTSUBDIRHEADERS)" ; \
+		$(SHELL) $(top_srcdir)/mkinstalldirs $(includedir)/$(INSTALLBUILTSUBDIR) ; \
+	        for i in $$it ; do \
+			$(INSTALL) $$i $(includedir)/$(INSTALLBUILTSUBDIR) ; \
+	                echo "installing $$i in $(includedir)/$(INSTALLBUILTSUBDIR)" ; \
+	        done \
+	fi
+
+installsubdirheaders:
+	@if test "$(SUBDIRS)" != ""; then \
+		it="$(SUBDIRS)" ; \
+		for i in $$it ; do       \
+			echo "making installheaders in `pwd`/$$i"; \
+	                ( cd $$i ; $(MAKE) installheaders) ;   \
+                        if test $$? != 0 ; then \
+				exit 1 ; \
+			fi  \
+	        done \
+	fi
+
+installucdheaders:
+	@if test "$(INSTALLUCDHEADERS)" != "" ; then \
+		echo creating directory $(ucdincludedir) ; \
+		it="$(INSTALLUCDHEADERS)" ; \
+		$(SHELL) $(top_srcdir)/mkinstalldirs $(ucdincludedir) ; \
+	        for i in $$it ; do \
+			$(INSTALL) $(top_srcdir)/include/ucd-snmp/$$i $(ucdincludedir) ; \
+	                echo "installing $$i in $(ucdincludedir)" ; \
+	        done \
+	fi
+
+#
+# libraries
+#
+# set INSTALLLIBS to a list of things to install in each makefile.
+#
+installlibs: installlocallibs @installucdlibs@ installsubdirlibs
+
+installlocallibs: $(INSTALLLIBS)
+	@if test "$(INSTALLLIBS)" != ""; then \
+		it="$(INSTALLLIBS)" ; \
+		$(SHELL) $(top_srcdir)/mkinstalldirs $(libdir) ; \
+                $(INSTALL) $(INSTALLLIBS) $(libdir) ;              \
+	        for i in $$it ; do    \
+	                echo "installing $$i in $(libdir)"; \
+	                $(RANLIB) $(libdir)/$$i ; \
+	        done ; \
+		$(LIB_LDCONFIG_CMD) ; \
+	fi
+
+installucdlibs: $(INSTALLUCDLIBS)
+	@if test "$(INSTALLUCDLIBS)" != ""; then \
+		it="$(INSTALLUCDLIBS)" ; \
+		$(SHELL) $(top_srcdir)/mkinstalldirs $(libdir) ; \
+                $(INSTALL) $(INSTALLUCDLIBS) $(libdir) ;              \
+	        for i in $$it ; do    \
+	                echo "installing $$i in $(libdir)"; \
+	                $(RANLIB) $(libdir)/$$i ; \
+	        done ; \
+		$(LIB_LDCONFIG_CMD) ; \
+	fi
+
+installsubdirlibs:
+	@if test "$(SUBDIRS)" != ""; then \
+		it="$(SUBDIRS)" ; \
+		for i in $$it ; do       \
+			echo "making installlibs in `pwd`/$$i"; \
+	                ( cd $$i ; $(MAKE) installlibs) ;   \
+                        if test $$? != 0 ; then \
+				exit 1 ; \
+			fi  \
+	        done \
+	fi
+
+#
+# normal bin binaries
+#
+# set INSTALLBINPROGS to a list of things to install in each makefile.
+#
+installbin: installlocalbin installsubdirbin
+
+installlocalbin: $(INSTALLBINPROGS)
+	@if test "$(INSTALLBINPROGS) $(INSTALLBINSCRIPTS)" != " "; then \
+		$(SHELL) $(top_srcdir)/mkinstalldirs $(bindir) ; \
+		it="$(INSTALLBINPROGS) $(INSTALLBINSCRIPTS)" ; \
+	        $(INSTALL) $(INSTALLBINPROGS) $(INSTALLBINSCRIPTS) $(bindir) ;              \
+	        for i in $$it ; do   \
+	                echo "installing $$i in $(bindir)"; \
+	        done \
+	fi
+
+installsubdirbin:
+	@if test "$(SUBDIRS)" != ""; then \
+		it="$(SUBDIRS)" ; \
+		for i in $$it ; do       \
+			echo "making installbin in `pwd`/$$i"; \
+	                ( cd $$i ; $(MAKE) installbin) ;   \
+                        if test $$? != 0 ; then \
+				exit 1 ; \
+			fi  \
+	        done \
+	fi
+
+#
+# sbin binaries
+#
+# set INSTALLSBINPROGS to a list of things to install in each makefile.
+#
+installsbin: installlocalsbin installsubdirsbin
+
+installlocalsbin: $(INSTALLSBINPROGS)
+	@if test "$(INSTALLSBINPROGS)" != ""; then \
+		it="$(INSTALLSBINPROGS)" ; \
+		$(SHELL) $(top_srcdir)/mkinstalldirs $(sbindir) ; \
+	        $(INSTALL) $(INSTALLSBINPROGS) $(sbindir) ;              \
+	        for i in $$it ; do   \
+	                echo "installing $$i in $(sbindir)"; \
+	        done \
+	fi
+
+installsubdirsbin:
+	@if test "$(SUBDIRS)" != ""; then \
+		it="$(SUBDIRS)" ; \
+		for i in $$it ; do       \
+			echo "making installsbin in `pwd`/$$i"; \
+	                ( cd $$i ; $(MAKE) installsbin) ;   \
+                        if test $$? != 0 ; then \
+				exit 1 ; \
+			fi  \
+	        done \
+	fi
+
+#
+# general make install target for subdirs
+#
+installsubdirs:
+	@if test "$(SUBDIRS)" != ""; then \
+		it="$(SUBDIRS)" ; \
+		for i in $$it ; do       \
+			echo "making install in `pwd`/$$i"; \
+	                ( cd $$i ; $(MAKE) install) ;   \
+                        if test $$? != 0 ; then \
+				exit 1 ; \
+			fi  \
+	        done \
+	fi
+
+#
+# cleaning targets
+#
+clean: cleansubdirs $(OTHERCLEANTODOS)
+	rm -f core ${OBJS} ${LOBJS} $(STANDARDCLEANTARGETS) $(OTHERCLEANTARGETS)
+	rm -rf .libs
+
+cleansubdirs:
+	@if test "$(SUBDIRS)" != ""; then \
+		it="$(SUBDIRS)" ; \
+		for i in $$it ; do       \
+			echo "making clean in `pwd`/$$i"; \
+	                ( cd $$i ; $(MAKE) clean) ;   \
+                        if test $$? != 0 ; then \
+				exit 1 ; \
+			fi  \
+	        done \
+	fi
+
+lint:
+	lint -nhx $(CSRCS)
+
+#
+# wacky dependency building.
+#
+depend: dependdirs
+	@if test -f Makefile.depend ; then \
+		makedepend `echo $(CPPFLAGS) | sed 's/-f[-a-z]*//g'` -o .lo $(srcdir)/*.c $(srcdir)/*/*.c ; \
+	fi
+
+
+nosysdepend: nosysdependdirs
+	@if test -f Makefile.depend ; then \
+		makedepend `echo $(CPPFLAGS) | sed 's/-f[-a-z]*//g'` -o .lo $(srcdir)/*.c $(srcdir)/*/*.c ; \
+		perl -n -i.bak $(top_srcdir)/makenosysdepend.pl Makefile ; \
+	fi
+
+distdepend: nosysdepend distdependdirs
+	@if test -f Makefile.depend ; then \
+		perl $(top_srcdir)/makefileindepend.pl ; \
+	fi
+
+dependdirs:
+	@if test "$(SUBDIRS)" != ""; then \
+		it="$(SUBDIRS)" ; \
+		for i in $$it ; do       \
+			echo "making depend in `pwd`/$$i"; \
+	                ( cd $$i ; $(MAKE) depend) ;   \
+                        if test $$? != 0 ; then \
+				exit 1 ; \
+			fi  \
+	        done \
+	fi
+
+nosysdependdirs:
+	@if test "$(SUBDIRS)" != ""; then \
+		it="$(SUBDIRS)" ; \
+		for i in $$it ; do       \
+			echo "making nosysdepend in `pwd`/$$i"; \
+	                ( cd $$i ; $(MAKE) nosysdepend) ;   \
+                        if test $$? != 0 ; then \
+				exit 1 ; \
+			fi  \
+	        done \
+	fi
+
+distdependdirs:
+	@if test "$(SUBDIRS)" != ""; then \
+		it="$(SUBDIRS)" ; \
+		for i in $$it ; do       \
+			echo "making distdepend in `pwd`/$$i"; \
+	                ( cd $$i ; $(MAKE) distdepend) ;   \
+                        if test $$? != 0 ; then \
+				exit 1 ; \
+			fi  \
+	        done \
+	fi
+
+# These aren't real targets, let gnu's make know that.
+.PHONY: clean cleansubdirs lint \
+	install installprogs installheaders installlibs \
+	installbin installsbin installsubdirs \
+	all subdirs standardall \
+	depend nosysdepend distdepend dependdirs nosysdependdirs distdependdirs
diff -Naur tomato/release/src/router/snmp/Makefile.top tomato121/release/src/router/snmp/Makefile.top
--- tomato/release/src/router/snmp/Makefile.top	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/Makefile.top	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,73 @@
+#
+# Minimum environment and virtual path setup
+#
+SHELL		= /bin/sh
+srcdir		= @srcdir@
+top_srcdir	= @top_srcdir@
+VPATH		= @srcdir@
+VERSION		= @VERSION@
+@SET_MAKE@
+
+#
+# Paths
+#
+prefix		= @prefix@
+exec_prefix	= @exec_prefix@
+bindir		= @bindir@
+sbindir		= @sbindir@
+libdir		= @libdir@
+datadir		= @datadir@
+includedir	= @includedir@/net-snmp
+ucdincludedir	= @includedir@/ucd-snmp
+mandir		= @mandir@
+man1dir		= $(mandir)/man1
+man3dir		= $(mandir)/man3
+man5dir		= $(mandir)/man5
+man8dir		= $(mandir)/man8
+snmplibdir	= $(datadir)/snmp
+mibdir		= $(snmplibdir)/mibs
+persistentdir	= @PERSISTENT_DIRECTORY@
+
+
+#
+# Programs
+#
+INSTALL		= $(LIBTOOL) --mode=install @INSTALL@
+INSTALL_DATA    = @INSTALL_DATA@
+SED		= @SED@
+LN_S		= @LN_S@
+AUTOCONF	= @AUTOCONF@
+AUTOHEADER	= @AUTOHEADER@
+
+#
+# Compiler arguments
+#
+CFLAGS		= @CFLAGS@ @DEVFLAGS@
+EXTRACPPFLAGS	= @EXTRACPPFLAGS@
+LDFLAGS		= @LDFLAGS@ 
+LIBTOOL		= @LIBTOOL@ @LIBTOOLFLAGS@
+EXEEXT		= @EXEEXT@
+
+# Misc Compiling Stuff
+CC	        = @CC@
+# version number is prefixed by a 0 for a better shared library version number
+#
+# ok, use libtool proper versioning:
+LIBCURRENT  = 5
+LIBREVISION = 9
+LIBAGE      = 0
+# generally, LIBCURRENT should stay the same unless major changes occur.
+# Increment REVISION every release.  
+# Increment AGE if new stuff is available.
+LIB_LD_CMD      = $(LIBTOOL) --mode=link $(CC) $(CFLAGS) -rpath $(libdir) -version-info $(LIBCURRENT):$(LIBREVISION):$(LIBAGE) -o
+LIB_EXTENSION   = la
+LIB_VERSION     =
+LIB_LDCONFIG_CMD = $(LIBTOOL) --mode=finish $(libdir)
+LINK		= $(LIBTOOL) --mode=link $(CC)
+# RANLIB 	= @RANLIB@
+RANLIB		= :
+
+# libtool definitions
+.SUFFIXES: .c .o .lo
+.c.lo:
+	$(LIBTOOL) --mode=compile $(CC) $(CPPFLAGS) $(CFLAGS) -c -o $@ $<
diff -Naur tomato/release/src/router/snmp/maketarget tomato121/release/src/router/snmp/maketarget
--- tomato/release/src/router/snmp/maketarget	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/maketarget	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,63 @@
+: maketarget
+
+DIRS=`find . -name targets -prune -o -type d ! -name . -print | grep -v CVS | sed s/..//`
+TARGET=${1-`./config.guess`}
+
+rebuild=0
+
+echo Target directory: $TARGET
+echo Sub directories: $DIRS
+
+[ -d targets ] || mkdir targets
+cd targets
+if [ -d $TARGET ]
+then
+  /bin/echo Target already exists. Do you want to rebuild it\? '[y]' \\c
+  read ans
+  case $ans in
+  "" | y* | Y* )
+    rebuild=1
+    ;;
+  n* | N* )
+    exit 0
+    ;;
+  *)
+    echo Bummer.....
+    exit 1
+    ;;
+  esac
+fi
+
+echo Creating target directory: $TARGET
+[ -d $TARGET ] || mkdir $TARGET
+
+cd $TARGET
+for f in . $DIRS
+do
+  echo building $f ...
+  [ -d $f ] || mkdir $f
+  case $f in
+  */*/*/*)
+    echo Too deep nesting...
+    exit 1
+    ;;
+  */*/*)
+    cd $f
+    for f in ../../../../../$f/* ; do [ -d $f ] || ln -sf $f . ; done
+    cd ../../..
+    ;;
+  */*)
+    cd $f
+    for f in ../../../../$f/* ; do [ -d $f ] || ln -sf $f . ; done
+    cd ../..
+    ;;
+  .)
+    for f in ../../$f/* ; do [ -d $f ] || ln -sf $f . ; done
+    ;;
+  *)
+    cd $f
+    for f in ../../../$f/* ; do [ -d $f ] || ln -sf $f . ; done
+    cd ..
+    ;;
+  esac
+done
diff -Naur tomato/release/src/router/snmp/man/add_mibdir.3 tomato121/release/src/router/snmp/man/add_mibdir.3
--- tomato/release/src/router/snmp/man/add_mibdir.3	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/man/add_mibdir.3	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1 @@
+.so man3/mib_api.3
diff -Naur tomato/release/src/router/snmp/man/add_module_replacement.3 tomato121/release/src/router/snmp/man/add_module_replacement.3
--- tomato/release/src/router/snmp/man/add_module_replacement.3	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/man/add_module_replacement.3	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1 @@
+.so man3/mib_api.3
diff -Naur tomato/release/src/router/snmp/man/.cvsignore tomato121/release/src/router/snmp/man/.cvsignore
--- tomato/release/src/router/snmp/man/.cvsignore	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/man/.cvsignore	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,34 @@
+*.html
+Makefile
+default_store.3
+default_store.3.h
+mib2c.1
+mib_api.3
+read_config.3
+snmp.conf.5
+snmp_agent_api.3
+snmp_alarm.3
+snmp_api.3
+snmp_config.5
+snmp_sess_api.3
+snmp_trap_api.3
+snmpbulkget.1
+snmpbulkwalk.1
+snmpcmd.1
+snmpconf.1
+snmpd.1
+snmpd.8
+snmpd.conf.5
+snmpget.1
+snmpgetnext.1
+snmpset.1
+snmpstatus.1
+snmptable.1
+snmptest.1
+snmptranslate.1
+snmptrap.1
+snmptrapd.8
+snmptrapd.conf.5
+snmpusm.1
+snmpwalk.1
+variables.5
diff -Naur tomato/release/src/router/snmp/man/default_store.3.bot tomato121/release/src/router/snmp/man/default_store.3.bot
--- tomato/release/src/router/snmp/man/default_store.3.bot	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/man/default_store.3.bot	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,120 @@
+.fi
+.SH FUNCTIONS
+.TP
+.BI "int netsnmp_ds_set_boolean(int " store ", int " which ", int " val ");"
+Stores
+.I TRUE
+if 
+.I val
+!= 0 or else
+.I FALSE
+into the bool_storage[store][which] slot.  Returns
+.B SNMPERR_GENERR
+if the
+.IR store " and " which
+parameters do not correspond to a valid slot, or
+.B SNMPERR_SUCCESS
+otherwise.
+.TP
+.BI "int netsnmp_ds_get_boolean(int " store ", int " which ");"
+Returns 1 if bool_storage[store][which] is 
+.IR TRUE
+or 0 if not.  May also return
+.B SNMPERR_GENERR
+if the 
+.IR store " and " which
+parameters do not correspond to a valid slot.
+.TP
+.BI "int netsnmp_ds_set_string(int " store ", int " which ", const char *" val ");"
+Stores
+.I val
+into the string_storage[store][which] slot.  Returns
+.B SNMPERR_SUCCESS
+normally, or 
+.B SNMPERR_GENERR
+if the 
+.IR store " and " which
+parameters do not correspond to a valid slot.
+.TP
+.BI "char *netsnmp_ds_get_string(int " store ", int " which ");"
+Returns the string which has been stored in the
+string_storage[store][which] slot, or
+.B NULL
+if the
+.IR store " and " which
+parameters do not correspond to a valid slot.
+.TP 
+.BI "netsnmp_ds_set_int(int " store ", int " which ", int " val ");"
+Stores
+.I val
+into the int_storage[store][which] slot.  Returns
+.B SNMPERR_GENERR
+if the
+.IR store " and " which
+parameters do not correspond to a valid slot, or
+.B SNMPERR_SUCCESS
+otherwise.
+.TP
+.BI "int netsnmp_ds_get_int(int " store ", int " which ");"
+Returns the integer which has been stored in the
+int_storage[store][which] slot, or
+.B SNMPERR_GENERR
+if the
+.IR store " and " which
+parameters do not correspond to a valid slot.
+.TP
+.BI "void netsnmp_ds_shutdown(void);"
+Reclaims memory used to hold information gathered by
+.BR netsnmp_ds_register_config " and " netsnmp_ds_register_premib .
+.TP
+.BI "int netsnmp_ds_register_config(u_char " type ", const char *" ftype ", const char *" token ", int " store ", int " which ");"
+Registers a configuration file directive 
+.I token
+and attaches it to 
+a default storage type and slot.  Specifically,
+.I store
+and
+.I which
+indicate the storage slot in the data type indicated by
+.I type,
+where
+.I type
+is one of the following constants:
+.BR ASN_BOOLEAN ", " ASN_INTEGER ", or " ASN_OCTET_STR .
+The
+.I ftype
+variable indicates the file name base string searched for the
+.I token
+keyword.  For example, the following call:
+.RS
+.IP
+netsnmp_ds_register_config(ASN_INTEGER, "snmp", "testtoken", DS_APPLICATION_ID, 5)
+.RE
+.IP
+would indicate that when the snmp.conf file(s) were found and parsed,
+that any line beginning with the word "testtoken" should be read and
+the value after "testtoken" should be stored into the
+int_storage[DS_APPLICATION_ID][5] slot.  For example the following
+line in the configuration file:
+.RS
+.IP
+testtoken 502
+.RE
+.IP
+would set int_storage[DS_APPLICATION_ID][5] = 502.  This function returns
+.B SNMPERR_SUCCESS
+if the registration was made successfully, or 
+.B SNMPERR_GENERR
+if the registration was not made (perhaps because the
+.IR store " and " which
+parameters do not correspond to a valid slot, or because of a memory
+allocation failure).
+.TP
+.BI "int netsnmp_ds_register_premib(u_char " type ", const char *" ftype ", const char *" token ", int " store ", int " which ");"
+Analogous to the preceeding function, but the
+.I token
+is processed before MIBs are read (this is therefore useful for controlling
+MIB processing options).
+.SH "SEE ALSO"
+.BR snmp_config "(5), " read_config "(3)"
+
diff -Naur tomato/release/src/router/snmp/man/default_store.3.top tomato121/release/src/router/snmp/man/default_store.3.top
--- tomato/release/src/router/snmp/man/default_store.3.top	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/man/default_store.3.top	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,84 @@
+.TH DEFAULT_STORE 3 "25 Jun 2002" VVERSIONINFO "Net-SNMP"
+.UC 5
+.SH NAME
+default_store \- generic storage of global data.
+.SH SYNOPSIS
+.B #include <net-snmp/net-snmp-config.h>
+.br
+.B #include <net-snmp/config_api.h>
+
+.BI "int netsnmp_ds_set_boolean(int " store ", int " which ", int " val ");"
+.br
+.BI "int netsnmp_ds_get_boolean(int " store ", int " which ");"
+.br
+.BI "int netsnmp_ds_set_int(int " store ", int " which ", int " val ");"
+.br
+.BI "int netsnmp_ds_get_int(int " store ", int " which ");"
+.br
+.BI "int netsnmp_ds_set_string(int " store ", int " which ", "
+.br
+.BI "                          const char *" val ");"
+.br
+.BI "char *netsnmp_ds_get_string(int " store ", int " which ");"
+.br
+.BI "int netsnmp_ds_register_config(u_char " type ", "
+.br
+.BI "                               const char *" ftype ","
+.br
+.BI "                               const char *" token ","
+.br
+.BI "                               int " store ", int " which ");"
+.br
+.BI "int netsnmp_ds_register_premib(u_char " type ", "
+.br
+.BI "                               const char *" ftype ","
+.br
+.BI "                               const char *" token ","
+.br
+.BI "                               int " store ", int " which ");"
+.br
+.BI "void netsnmp_ds_shutdown(void);"
+.fi
+.SH DESCRIPTION
+The purpose of the default storage is three-fold:
+.IP 1)
+To create a global storage space without creating a whole bunch of
+globally accessible variables or a whole bunch of access functions to
+work with more privately restricted variables.
+.IP 2)
+To provide a single location where the thread locking needs to be
+implemented. At the time of this writing, however, thread locking is not
+yet in place.
+.IP 3)
+To reduce the number of cross dependencies between code pieces that
+may or may not be linked together in the long run. This provides for a
+single location in which configuration data, for example, can be
+stored for a separate section of code that may not be linked in to
+the application in question.
+.PP
+The functions defined here implement these goals.
+.PP
+Currently, three data types are supported: booleans, integers, and
+strings. Each of these data types have separate storage
+spaces. In addition, the storage space for each data type is divided
+further by the application level.   Currently, there are two storage
+spaces. The first is reserved for the SNMP library itself. The second 
+is intended for use in applications and is not modified or checked by
+the library, and, therefore, this is the space usable by you.
+.PP
+You can think of these storage spaces as being 3 arrays, something
+like bool_storage[storeid][which], int_storage[storeid][which], and
+string_storage[storeid][which].  The data is then accessed through the 
+functions defined below.  For data you wish to store, you should use a 
+.I store
+parameter of
+.BR NETSNMP_DS_APPLICATION_ID .
+.PP
+The storage space used by the library (for which the 
+.I store
+parameter is
+.BR NETSNMP_DS_LIBRARY_ID )
+is defined in the default_store.h file, which currently contains the 
+following defines: 
+.PP
+.nf
diff -Naur tomato/release/src/router/snmp/man/get_module_node.3 tomato121/release/src/router/snmp/man/get_module_node.3
--- tomato/release/src/router/snmp/man/get_module_node.3	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/man/get_module_node.3	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1 @@
+.so man3/mib_api.3
diff -Naur tomato/release/src/router/snmp/man/init_mib.3 tomato121/release/src/router/snmp/man/init_mib.3
--- tomato/release/src/router/snmp/man/init_mib.3	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/man/init_mib.3	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1 @@
+.so man3/mib_api.3
diff -Naur tomato/release/src/router/snmp/man/init_mib_internals.3 tomato121/release/src/router/snmp/man/init_mib_internals.3
--- tomato/release/src/router/snmp/man/init_mib_internals.3	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/man/init_mib_internals.3	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1 @@
+.so man3/mib_api.3
diff -Naur tomato/release/src/router/snmp/man/Makefile.in tomato121/release/src/router/snmp/man/Makefile.in
--- tomato/release/src/router/snmp/man/Makefile.in	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/man/Makefile.in	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,165 @@
+#
+# Makefile for the man page directory
+#
+top_builddir=..
+
+#
+# install stuff
+#
+
+OTHERINSTALL=maninstall
+#
+# local stuff
+#
+
+MAN1  = snmpnetstat.1 snmpdelta.1 snmpinform.1 snmpdf.1
+MAN1G = snmpbulkget.1 snmpcmd.1 snmpget.1 snmpset.1 snmpwalk.1 \
+	snmpbulkwalk.1 snmpgetnext.1 snmptest.1 snmptranslate.1 snmptrap.1 \
+	snmpusm.1 snmptable.1 snmpstatus.1 snmpconf.1 mib2c.1
+MAN3  = snmp_close.3 snmp_free_pdu.3 snmp_open.3 snmp_read.3 \
+	snmp_select_info.3 snmp_send.3 snmp_timeout.3 \
+	snmp_sess_async_send.3 snmp_sess_close.3 snmp_sess_error.3 \
+	snmp_sess_init.3 snmp_sess_open.3 snmp_sess_read.3 \
+	snmp_sess_select_info.3 snmp_sess_send.3 snmp_sess_timeout.3 \
+	snmp_sess_session.3 snmp_perror.3 snmp_sess_perror.3 snmp_error.3 \
+	snmp_api_errstring.3 init_mib.3 add_mibdir.3 init_mib_internals.3 \
+	snmp_set_mib_warnings.3 read_module.3 read_all_mibs.3 read_mib.3 \
+	read_module_node.3 read_objid.3 add_module_replacement.3 \
+	shutdown_mib.3 print_mib.3 print_variable.3 print_value.3 \
+	print_objid.3 print_description.3 snmp_set_save_descriptions.3 \
+	get_module_node.3 \
+	netsnmp_agent.3 netsnmp_bulk_to_next.3 netsnmp_debug.3 \
+	netsnmp_example_scalar_int.3 netsnmp_handler.3 netsnmp_instance.3 \
+	netsnmp_mib_handler_methods.3 netsnmp_multiplexer.3 netsnmp_old_api.3 \
+	netsnmp_read_only.3 netsnmp_serialize.3 netsnmp_table.3 \
+	netsnmp_table_array.3 netsnmp_table_data.3 netsnmp_table_dataset.3 \
+	netsnmp_table_iterator.3 netsnmp_todo.3 netsnmp_scalar.3 \
+	netsnmp_watcher.3 netsnmp_mode_end_call.3 netsnmp_library.3 \
+	netsnmp_mib_utilities.3
+MAN3G = default_store.3 mib_api.3 read_config.3 snmp_agent_api.3 snmp_alarm.3 \
+	snmp_api.3 snmp_sess_api.3 snmp_trap_api.3
+MAN5G = snmpd.conf.5 snmptrapd.conf.5 snmp.conf.5 snmp_config.5 variables.5
+MAN8G = snmptrapd.8 snmpd.8
+
+MANALL = $(MAN1) $(MAN1G) $(MAN3) $(MAN3G) $(MAN5G) $(MAN8G)
+
+TARGETS = $(MAN5G) $(MAN1G) $(MAN3G) $(MAN8G)
+OTHERCLEANTARGETS=$(TARGETS) default_store.3.h
+
+all: $(TARGETS) standardall
+
+snmpbulkget.1: snmpbulkget.1.def ../sedscript
+	$(SED) -f ../sedscript < $(srcdir)/snmpbulkget.1.def > snmpbulkget.1
+
+snmpbulkwalk.1: snmpbulkwalk.1.def ../sedscript
+	$(SED) -f ../sedscript < $(srcdir)/snmpbulkwalk.1.def > snmpbulkwalk.1
+
+snmpcmd.1: snmpcmd.1.def ../sedscript
+	$(SED) -f ../sedscript < $(srcdir)/snmpcmd.1.def > snmpcmd.1
+
+snmpconf.1: snmpconf.1.def ../sedscript
+	$(SED) -f ../sedscript < $(srcdir)/snmpconf.1.def > snmpconf.1
+
+snmpd.8: snmpd.8.def ../sedscript
+	$(SED) -f ../sedscript < $(srcdir)/snmpd.8.def > snmpd.8
+
+snmpget.1: snmpget.1.def ../sedscript
+	$(SED) -f ../sedscript < $(srcdir)/snmpget.1.def > snmpget.1
+
+snmpgetnext.1: snmpgetnext.1.def ../sedscript
+	$(SED) -f ../sedscript < $(srcdir)/snmpgetnext.1.def > snmpgetnext.1
+
+snmpset.1: snmpset.1.def ../sedscript
+	$(SED) -f ../sedscript < $(srcdir)/snmpset.1.def > snmpset.1
+
+snmpstatus.1: snmpstatus.1.def ../sedscript
+	$(SED) -f ../sedscript < $(srcdir)/snmpstatus.1.def > snmpstatus.1
+
+snmptable.1: snmptable.1.def ../sedscript
+	$(SED) -f ../sedscript < $(srcdir)/snmptable.1.def > snmptable.1
+
+snmptest.1: snmptest.1.def ../sedscript
+	$(SED) -f ../sedscript < $(srcdir)/snmptest.1.def > snmptest.1
+
+snmptranslate.1: snmptranslate.1.def ../sedscript
+	$(SED) -f ../sedscript < $(srcdir)/snmptranslate.1.def > snmptranslate.1
+
+snmptrap.1: snmptrap.1.def ../sedscript
+	$(SED) -f ../sedscript < $(srcdir)/snmptrap.1.def > snmptrap.1
+
+snmpusm.1: snmpusm.1.def ../sedscript
+	$(SED) -f ../sedscript < $(srcdir)/snmpusm.1.def > snmpusm.1
+
+mib2c.1: mib2c.1.def ../sedscript
+	$(SED) -f ../sedscript < $(srcdir)/mib2c.1.def > mib2c.1
+
+snmpwalk.1: snmpwalk.1.def ../sedscript
+	$(SED) -f ../sedscript < $(srcdir)/snmpwalk.1.def > snmpwalk.1
+
+mib_api.3: mib_api.3.def ../sedscript
+	$(SED) -f ../sedscript < $(srcdir)/mib_api.3.def > mib_api.3
+
+read_config.3: read_config.3.def ../sedscript
+	$(SED) -f ../sedscript < $(srcdir)/read_config.3.def > read_config.3
+
+snmp_agent_api.3: snmp_agent_api.3.def ../sedscript
+	$(SED) -f ../sedscript < $(srcdir)/snmp_agent_api.3.def > snmp_agent_api.3
+
+snmp_alarm.3: snmp_alarm.3.def ../sedscript
+	$(SED) -f ../sedscript < $(srcdir)/snmp_alarm.3.def > snmp_alarm.3
+
+snmp_api.3: snmp_api.3.def ../sedscript
+	$(SED) -f ../sedscript < $(srcdir)/snmp_api.3.def > snmp_api.3
+
+snmp_sess_api.3: snmp_sess_api.3.def ../sedscript
+	$(SED) -f ../sedscript < $(srcdir)/snmp_sess_api.3.def > snmp_sess_api.3
+
+snmp_trap_api.3: snmp_trap_api.3.def ../sedscript
+	$(SED) -f ../sedscript < $(srcdir)/snmp_trap_api.3.def > snmp_trap_api.3
+
+snmp.conf.5: snmp.conf.5.def ../sedscript
+	$(SED) -f ../sedscript < $(srcdir)/snmp.conf.5.def > snmp.conf.5
+
+snmp_config.5: snmp_config.5.def ../sedscript
+	$(SED) -f ../sedscript < $(srcdir)/snmp_config.5.def > snmp_config.5
+
+snmpd.conf.5: snmpd.conf.5.def ../sedscript
+	$(SED) -f ../sedscript < $(srcdir)/snmpd.conf.5.def > snmpd.conf.5
+
+snmptrapd.conf.5: snmptrapd.conf.5.def ../sedscript
+	$(SED) -f ../sedscript < $(srcdir)/snmptrapd.conf.5.def > snmptrapd.conf.5
+
+variables.5: variables.5.def ../sedscript
+	$(SED) -f ../sedscript < $(srcdir)/variables.5.def > variables.5
+
+snmptrapd.8: snmptrapd.8.def ../sedscript
+	$(SED) -f ../sedscript < $(srcdir)/snmptrapd.8.def > snmptrapd.8
+
+default_store.3.h: $(srcdir)/../include/net-snmp/library/default_store.h
+	awk '{ if ($$0 == "     * begin storage definitions ") { p = 1 } else if ($$0 == "     * end storage definitions ") { p = 0 } else if (p) { print $$0}}' < $(srcdir)/../include/net-snmp/library/default_store.h > default_store.3.h
+
+default_store.3: $(srcdir)/default_store.3.top default_store.3.h $(srcdir)/default_store.3.bot
+	$(SED) -f ../sedscript < $(srcdir)/default_store.3.top > default_store.3
+	cat default_store.3.h $(srcdir)/default_store.3.bot >> default_store.3
+
+maninstall:  maninstalldirs $(MAN1) $(MAN1G) $(MAN3) $(MAN5G) $(MAN8)
+	@for i in $(MAN1) ; do $(INSTALL) $(srcdir)/$$i $(man1dir) ; echo "install:  installed $$i in $(man1dir)" ; done
+	@$(INSTALL_DATA) $(MAN1G) $(man1dir)
+	@for i in $(MAN1G) ; do echo "install:  installed $$i in $(man1dir)" ; done
+	@for i in $(MAN3) ; do $(INSTALL) $(srcdir)/$$i $(man3dir) ; echo "install:  installed $$i in $(man3dir)" ; done
+	@$(INSTALL_DATA) $(MAN3G) $(man3dir)
+	@for i in $(MAN3G) ; do echo "install:  installed $$i in $(man3dir)" ; done
+	@$(INSTALL_DATA) $(MAN5G) $(man5dir)
+	@for i in $(MAN5G) ; do echo "install:  installed $$i in $(man5dir)" ; done
+	@$(INSTALL_DATA) $(MAN8G) $(man8dir)
+	@for i in $(MAN8G) ; do echo "install:  installed $$i in $(man8dir)" ; done
+
+maninstalldirs:
+	@$(SHELL) $(srcdir)/../mkinstalldirs $(man1dir) $(man3dir) $(man5dir) $(man8dir)
+
+
+#
+# internal administrative
+#
+html: $(MANALL)
+	for i in $(MANALL); do base=`echo $$i | sed 's/.[0-9]$$//;'` ; echo "<HTML><BODY bgcolor=\"#ffffff\" background=\"../ucd-snmp-bg3.gif\"><PRE>" > $$base.html; nroff -man $$i | man2html -bare -title "$$base manual page" >> $$base.html; done
diff -Naur tomato/release/src/router/snmp/man/mib2c.1.def tomato121/release/src/router/snmp/man/mib2c.1.def
--- tomato/release/src/router/snmp/man/mib2c.1.def	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/man/mib2c.1.def	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,209 @@
+.\" Portions of this file are subject to the following copyright.  See
+.\" the Net-SNMP's COPYING file for more details and other copyrights
+.\" that may apply:
+.\" /***********************************************************
+.\" Portions of this file are copyrighted by:
+.\" Copyright Copyright 2003 Sun Microsystems, Inc. All rights reserved.
+.\" Use is subject to license terms specified in the COPYING file
+.\" distributed with the Net-SNMP package.
+.\" ******************************************************************/
+.TH MIB2C 1 "25 Jul 2003" VVERSIONINFO "Net-SNMP"
+.UC 4
+.SH NAME
+mib2c -- produces template code from mib definitions
+.SH SYNOPSIS
+.B mib2c
+[-h] -c CONFIGFILE [-f OUTNAME] [-i][q][-S VAR=VAL] MIBNODE
+.SH DESCRIPTION
+The mib2c tool is designed to take a portion of the MIB tree (as defined
+by a MIB file) and generate the template C code necessary to implement
+the corresponding MIB module.
+.PP
+In order to implement a new MIB module, three files are necessary:
+.PP
+.br
+- MIB definition file
+.br
+- C header file
+.br
+- C implementation file.
+.PP
+The mib2c tool uses the MIB definition file to produce the two C
+code files. Thus, mib2c generates a template that you can edit
+to add logic necessary to obtain information from the
+operating system or application to complete the module.
+.PP
+MIBNODE is the top level mib node you want to generate code for.
+You must give mib2c a mib node (e.g., ifTable), not a mib file 
+on the command line.  (this is the most common mistake).
+.PP
+The mib2c tool accepts both SMIv1 and SMIv2 MIBs.
+.PP
+mib2c needs to be able to find and load a MIB file in order to generate
+C code for the MIB. To enable mib2c to find the MIB file, set the
+MIBS environment variable to include the MIB file you are using.
+An example of setting this environment variable is:
+.PP
+   MIBS=+NET-SNMP-TUTORIAL-MIB
+.PP
+   or
+.PP
+   MIBS=ALL
+.PP
+The first example ensures that mib2c finds the NET-SNMP-TUTORIAL-MIB
+mib, in addition to the default MIB modules. The default list of MIB
+modules is set when the suite is first configured and built and
+basically corresponds to the list of modules that the agent supports.
+The second example ensures that mib2c finds all MIBs in the search
+location for MIB files. The default search location for MIB files is
+DATADIR/snmp/mibs. This search location can be modified
+by the MIBDIRS environment variable.
+.PP
+Both the MIB files to be loaded and the MIB file search location can
+also be configured in the snmp.conf file. Please see snmp.conf(5) for
+more information.
+.PP
+The generated *.c and *.h files will be created in the current working
+directory.
+.SH "OPTIONS"
+.TP
+.BI -h
+Display a help message.
+.TP
+.BI -c " CONFIGFILE"
+Use CONFIGFILE when generating code.  These files will be searched for
+first in the current directory and then in the DATADIR directory
+(which is where the default mib2c configuration files can be found).
+Running mib2c without the -c CONFIGFILE option will display
+a description of the valid values for CONFIGFILE, that is,
+the available config files, including new ones that you might
+author.
+.IP 
+For example,
+.IP 
+% mib2c ifTable
+.IP 
+will display a description of the currently available values
+for CONFIGFILE.
+.IP 
+The following values are supported for CONFIGFILE:
+.IP 
+mib2c.scalar.conf
+.br
+mib2c.int_watch.conf
+.br
+mib2c.iterate.conf
+.br
+mib2c.create-dataset.conf
+.br
+mib2c.array-user.conf
+.br
+mib2c.column_defines.conf
+.br
+mib2c.column_enums.conf
+.IP 
+GENERATING CODE FOR SCALAR OBJECTS:
+.IP 
+If you're writing code for some scalars, run:
+
+	mib2c -c mib2c.scalar.conf MIBNODE
+.IP 
+If you want to magically "tie" integer variables to integer
+scalars, use:
+
+	mib2c -c mib2c.int_watch.conf MIBNODE
+.IP 
+GENERATING CODE FOR TABLES:
+
+If your table data is kept somewhere else (e.g. it's in the
+kernel and not in the memory of the agent itself) and you need to
+"iterate" over it to find the right data for the SNMP row being
+accessed.  See the agent/mibgroup/mibII/vacm_context.c file for an
+example:
+
+	mib2c -c mib2c.iterate.conf MIBNODE
+
+If your table data is kept in the agent (i.e. it's not located in
+an external source) and is purely data driven (i.e. you do not need
+to perform any work when a set occurs).  See the
+agent/mibgroup/examples/data_set.c file for an example of such a
+table:
+
+	mib2c -c mib2c.create-dataset.conf MIBNODE
+
+If your table data is kept in the agent (i.e. it's not located in
+an external source), and you can keep your data sorted by the table
+index but you do need to perform work when a set occurs:
+
+	mib2c -c mib2c.array-user.conf MIBNODE
+
+GENERATING HEADER FILE DEFINITIONS
+
+To generate just a header with a define for each column number in
+your table:
+
+	mib2c -c mib2c.column_defines.conf MIBNODE
+
+To generate just a header with a define for each enum for any
+column containing enums:
+
+	mib2c -c mib2c.column_enums.conf MIBNODE
+
+	GENERATING CODE FOR THE 4.X LINE OF CODE (THE OLDER API)
+
+	mib2c -c mib2c.old-api.conf MIBNODE
+.TP
+.BI -f " OUTNAME"
+Places the output code into OUTNAME.c and OUTNAME.h. Normally, mib2c
+will place the output code into files which correspond to the table
+names it is generating code for, which is probably what you want anyway.
+.TP
+.BI -i
+Do not run indent on the resulting code.
+.TP
+.BI -q
+Run in "quiet" mode, which minimizes the status messages
+mib2c generates.
+.TP
+.BI -S VAR=VAL
+Preset a variable VAR, in the mib2c.*.conf file, to the value
+VAL. None of the existing mib2c configuration files
+(mib2c.*.conf) currently makes use of this feature, however,
+so this option should be considered available only for future use.
+.SH EXAMPLES
+.PP
+The following generates C template code for the header and implementation
+files to implement UCD-DEMO-MIB::ucdDemoPublic.
+.IP
+% mib2c -c mib2c.scalar.conf ucdDemoPublic
+.br
+writing to ucdDemoPublic.h
+.br
+writing to ucdDemoPublic.c
+.br
+running indent on ucdDemoPublic.h
+.br
+running indent on ucdDemoPublic.c
+.PP
+The resulting ucdDemoPublic.c and ucdDemoPublic.h files are
+generated the current working directory.
+.PP
+The following generates C template code for the header and implementation
+files  for the module to implement TCP-MIB::tcpConnTable.
+.IP
+% mib2c -c mib2c.iterate.conf tcpConnTable
+.br
+writing to tcpConnTable.h
+.br
+writing to tcpConnTable.c
+.br
+running indent on tcpConnTable.h
+.br
+running indent on tcpConnTable.c
+.PP
+The resulting tcpConnTable.c and tcpConnTable.h files are generated
+in the current working directory.
+.PP
+.SH SEE ALSO
+.PP
+snmpcmd(1), snmp.conf(5)
diff -Naur tomato/release/src/router/snmp/man/mib_api.3.def tomato121/release/src/router/snmp/man/mib_api.3.def
--- tomato/release/src/router/snmp/man/mib_api.3.def	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/man/mib_api.3.def	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,321 @@
+.TH MIB_API 3 "06 Mar 2002" VVERSIONINFO "Net-SNMP"
+.UC 5
+.SH NAME
+init_mib, add_mibdir, init_mib_internals,
+add_module_replacement,
+read_module, read_mib, read_all_mibs,
+read_objid, read_module_node,
+get_module_node, read_objid
+snmp_set_mib_warnings, snmp_set_save_descriptions,
+shutdown_mib,
+print_mib,
+print_variable, fprint_variable, snprint_variable, sprint_realloc_variable,
+print_value, fprint_value, snprint_value, sprint_realloc_value,
+print_objid, fprint_objid, snprint_objid, sprint_realloc_objid,
+print_description, fprint_description - mib_api functions
+.SH SYNOPSIS
+.B #include <net-snmp/mib_api.h>
+.PP
+.B "void init_mib(void);
+.br
+.BI "int add_mibdir(char *" "dirname" );
+.br
+.BI "int add_module_replacement(char *" "old_module" ", char *" "new_module" ", char *" "tag" ", int " "len" );
+.br
+.B "void init_mib_internals(void);
+.br
+.BI "struct tree *read_module(char *" "name" );
+.br
+.BI "struct tree *read_mib(char *" "filename" );
+.br
+.B "struct tree *read_all_mibs(void);
+.PP
+.B "void shutdown_mib(void);
+.PP
+.BI "void print_mib(FILE *" "fp" );
+.PP
+.BI "int read_objid(char *" "input" ", oid *" "output" ", int *" "out_len" );
+.br
+.BI "int get_module_node(char *" "name" ", char *" "module" ", oid *" "objid" ", int *" "objidlen" );
+.PP
+.BI "void print_variable(const oid *" "objid" ", size_t " "objidlen" ", struct variable_list *" "variable" );
+.br
+.BI "void fprint_variable(FILE *" fp ", const oid *" objid ", size_t " objidlen ", struct variable_list *" variable );
+.br
+.BI "int snprint_variable(char *" "buf" ", size_t " "len" ", const oid *" "objid" ", size_t " "objidlen" ", struct variable_list *" "variable" );
+.br
+.BI "int sprint_realloc_variable(u_char **" buf ", size_t *" buf_len ", size_t *" out_len ", int " allow_realloc ", const oid *" objid ", size_t " objidlen ", struct variable_list *" variable );
+.PP
+.BI "void print_value(oid *objid, size_t objidlen, struct variable_list *variable)
+.br
+.BI "void fprint_value(FILE *" fp ", const oid *" objid ", size_t " objidlen ", struct variable_list *" variable );
+.br
+.BI "int snprint_value(char *" buf ", size_t " "len" ", const oid *" objid ", size_t " objidlen ", struct variable_list *" variable );
+.br
+.BI "int sprint_realloc_value(u_char **" buf ", size_t *" buf_len ", size_t *" out_len ", int " allow_realloc ", const oid *" objid ", size_t " objidlen ", struct variable_list *" variable );
+.PP
+.BI "void print_objid(const oid *" objid ", size_t " objidlen );
+.br
+.BI "void fprint_objid(FILE *" fp ", const oid *" objid ", size_t " objidlen );
+.br
+.BI "int snprint_objid(char *" buf ", size_t " "len" ", const oid *" objid ", size_t " objidlen );
+.br
+.BI "int sprint_realloc_objid(u_char **" buf ", size_t *" buf_len ", size_t *" out_len ", int "allow_realloc ", const oid *" objid ", size_t " objidlen );
+.PP
+.BI "void print_description(const oid *" objid ", size_t " objidlen );
+.br
+.BI "void fprint_description(FILE *" fp ", const oid *" objid ", size_t " objidlen );
+.PP
+.BI "void snmp_set_mib_warnings(int " level );
+.br
+.BI "void snmp_set_save_descriptions(int " save ");"
+.PP
+.SH DESCRIPTION
+The functions dealing with MIB modules fall into four groups.  Those
+dealing with initialisation and shutdown, those that read in and
+parse MIB files, those that search the MIB tree, and various output
+routines.
+.SS Initialisation and Shutdown
+.B init_mib
+is a convenience function that handles all calls to
+.BR add_mibdir ", " read_module " and " read_mib
+for standard applications.  It should be called before any other
+routine that manipulates or accesses the MIB tree.  This routine sets
+up various internal structures, as well as reading in the default MIB
+modules, as detailed below.
+.PP
+.B add_mibdir
+is used to define the range of directory locations which are searched
+for files containing MIB modules (one module per file).  By default,
+this will be set to the directory
+.I DATADIR/mibs
+but this can be overridden by setting the environment variable
+.I MIBDIRS
+to a (colon-separated) list of directories to search.
+Note that this does not actually load the MIB modules located
+in that directory, but is an initialisation step to make them available.
+This function returns a count of files found in the directory, or a -1
+if there is an error.  
+.PP
+.B init_mib_internals
+sets up the internal structures, preparatory to reading in MIB
+modules.  It should be called after all calls to
+.BR add_mibdir ,
+and before and calls to
+.BR read_module .
+This is called automatically if
+.B init_mib
+is used.
+.PP
+.B shutdown_mib
+will clear the information that was gathered by 
+.BR read_module ", " add_mibdir " and " add_module_replacement .
+It is strongly recommended that one does not invoke
+.BR shutdown_mib
+while there are SNMP sessions being actively managed.
+.SS Reading and Parsing MIBs
+.B add_module_replacement
+can be used to allow new MIB modules to obsolete older ones, without
+needing to amend the imports clauses of other modules.  It takes the
+names of the old and new modules, together with an indication of which
+portions of the old module are affected.
+.RS
+.TS
+tab(+);
+lb lb lb
+l  l  l.
+tag + len + load the new module when:
+NULL + 0 + always (the old module is a strict subset of the new)
+name + 0 + for the given tag only
+name + non-0 + for any identifier with this prefix
+.TE
+.RE
+It can also be used to handle errors in the module identifiers used
+in MIB import clauses (such as referring to
+.I RFC1213
+instead of
+.IR RFC1213-MIB ).
+.PP
+.B read_module
+locates and parses the module specified, together with any modules
+that it imports from, and adds the contents of these modules to the
+active MIB tree.  Note that
+.B add_mibdir
+must first be called to add the directory containing the file with the
+module definition, if this is not in the standard path.
+.br
+By default, the following MIB modules will be loaded:  IP-MIB, IF-MIB,
+TCP-MIB, UDP-MIB, SNMPv2-MIB, RFC1213-MIB, UCD-SNMP-MIB.
+This can be overridden by setting the environment variable
+.I MIBS
+to a (colon-separated) list of modules to load.
+If this variable starts with a plus character, then the specified modules
+are added to the default list.  Otherwise only those modules listed are
+loaded (together with any others they import from).
+If
+.I MIBS
+is set to
+.IR ALL ,
+.B read_all_mibs
+is called to load all the MIB files found in all the specified
+.IR MIBDIRS .
+.PP
+.B read_mib
+parses the file specified, together with any modules that it imports
+from, and adds the contents to the active MIB tree.  Such a file can
+contain more then one module, though care must be taken that any
+imports occur earlier in the file, if they are not to be read from the
+installed modules.  Note that the file specified does not need to be
+in any of the directories initialised by
+.B add_mibdir
+(or the default setup), though any imported modules do.
+.br
+The environment variable
+.I MIBFILES
+can be set to a (colon-separated) list of files containing MIBs to load.
+.PP
+.B read_objid
+takes a string containing a textual version of an object identifier
+(in either numeric or descriptor form), and transforms this into the
+corresponding list of sub-identifiers.  This is returned in the
+.I output
+parameter, with the number of sub-identifiers returned via
+.IR out_len .
+When called, 
+.I out_len
+must hold the maximum length of the
+.I output
+array.
+This function returns a value of 1 if it succeeds in parsing the string
+and 0 otherwise.
+.SS Searching the MIB Tree
+.B get_module_node
+takes a descriptor and the name of a module, and returns the corresponding
+oid list, in the same way as
+.B read_objid
+above.
+.br
+If the module name is specified as "ANY", then this routine will
+assume that the descriptor given is unique within the tree, and will
+return the matching entry.  If this assumption is invalid, then the
+behaviour as to which variable is returned is implementation
+dependent.
+.SS Output
+.B print_mib
+will print out a representation of the currently active MIB tree to
+the specified FILE pointer.
+.PP
+.B print_variable
+will take an object identifier (as returned by
+.B read_objid
+or
+.BR get_module_node )
+and an instance of such a variable, and prints to the standard output
+the textual form of the object identifier together with the value
+of the variable.
+.B fprint_variable
+does the same, but prints to the FILE pointer specified by the initial
+parameter.
+.br
+.B snprint_variable
+prints the same information into the buffer pointed to by
+.I buf
+which is of length
+.IR len 
+and returns either the number of characters printed, or -1 if the
+buffer was not large enough.  In the latter case,
+.I buf
+will typically contained a truncated version of the information (but
+this behaviour is not guaranteed).  This function replaces the
+obsolete function
+.BR sprint_variable .
+.br
+.B sprint_realloc_variable
+is the low-level function used to implement all these functions.  It
+prints to a specified offset in a string buffer.  The
+.I buf
+parameter points to a pointer to that buffer;
+.I buf_len
+points to a variable holding the current size of that buffer, and
+.I out_len
+points to a variable holding the offset to which to print.
+.I out_len
+will be updated to hold the offset of the character following the last
+one added to the buffer.  If
+.I allow_realloc
+is 1, the buffer will be dynamically expanded, as necessary, to hold
+the output; the variables pointed to by
+.I buf
+and
+.I buf_len
+will be updated.  If
+.I allow_realloc
+is 0, the buffer will not be dynamically expanded.
+.B sprint_realloc_variable
+returns 0 if
+.I allow_realloc
+is 1 and an attempt to allocate memory to expand the buffer fails, or
+if
+.I allow_realloc
+is 0 and the output wouldn't fit in the buffer.  Otherwise it returns
+1.  When using this function you should be careful to call
+.BR free (3)
+on
+.I *buf
+when you have finished with it.
+.PP
+.BR print_value ,
+.BR fprint_value ,
+.BR snprint_value
+and
+.B sprint_realloc_value
+do the same as the equivalent
+.B print_variable
+routines, but only displaying the value of the variable, without the
+corresponding object identifier.
+.PP
+.BR print_objid ,
+.BR fprint_objid ,
+.BR snprint_objid ,
+and
+.B sprint_realloc_objid
+.br
+take an object identifier (without an accompanying variable instance)
+and print out the textual representation.
+.PP
+.B print_description
+and
+.B fprint_description
+take an object identifier (as for
+.B print_objid
+above) and print out the associated DESCRIPTION clause.
+.b
+Note that there are no corresponding routines
+.B snprint_description
+or
+.BR sprint_realloc_description .
+By default the parser does not save descriptions since they may be
+huge.  In order to be able to print them, you must call
+.BR snmp_set_save_descriptions(1) .
+
+In general the parser is silent about what strangenesses it sees in
+the MIB files. To get warnings reported, call
+.B snmp_set_mib_warnings
+with a
+.I level
+of 1 (or 2 for even more warnings).
+.SH "ENVIRONMENT VARIABLES"
+.TP 10
+MIBDIRS
+A colon separated list of directories to search for MIB modules.
+Default: LIBDIR/snmp/mibs
+.TP 10
+MIBFILES
+A colon separated list of files to load.
+Default: (none)
+.TP 10
+MIBS
+A colon separated list of MIB modules to load.
+Default: IP-MIB:IF-MIB:TCP-MIB:UDP-MIB:SNMPv2-MIB:RFC1213-MIB:UCD-SNMP-MIB.
+.SH "SEE ALSO"
+.BR snmp_api "(3)"
diff -Naur tomato/release/src/router/snmp/man/netsnmp_agent.3 tomato121/release/src/router/snmp/man/netsnmp_agent.3
--- tomato/release/src/router/snmp/man/netsnmp_agent.3	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/man/netsnmp_agent.3	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,21 @@
+.TH "The Net-SNMP agent" 3 "5 Sep 2003" "net-snmp" \" -*- nroff -*-
+.ad l
+.nh
+.SH NAME
+The Net-SNMP agent \- The snmp agent responds to SNMP queries from management stations. 
+More...
+.SS "Modules"
+
+.in +1c
+.ti -1c
+.RI "\fBNet-SNMP Agent handler and extensibility API\fP"
+.br
+.RI "\fIThe basic theory goes something like this: In the past, with the original mib module api (which derived from the original CMU SNMP code) the underlying mib modules were passed very little information (only the truly most basic information about a request).\fP"
+.PP
+
+.in -1c
+.SH "DETAILED DESCRIPTION"
+.PP 
+The snmp agent responds to SNMP queries from management stations.
+.PP
+
diff -Naur tomato/release/src/router/snmp/man/netsnmp_bulk_to_next.3 tomato121/release/src/router/snmp/man/netsnmp_bulk_to_next.3
--- tomato/release/src/router/snmp/man/netsnmp_bulk_to_next.3	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/man/netsnmp_bulk_to_next.3	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,56 @@
+.TH "bulk_to_next: convert GETBULK requests into GETNEXT requests for the handler." 3 "5 Sep 2003" "net-snmp" \" -*- nroff -*-
+.ad l
+.nh
+.SH NAME
+bulk_to_next: convert GETBULK requests into GETNEXT requests for the handler. \- The only purpose of this handler is to convert a GETBULK request to a GETNEXT request. 
+More...
+.SS "handler"
+
+.in +1c
+.ti -1c
+.RI "void \fBnetsnmp_init_bulk_to_next_helper\fP (void)"
+.br
+.RI "\fIinitializes the bulk_to_next helper which then registers a bulk_to_next handler as a run-time injectable handler for configuration file use.\fP"
+.in -1c
+.SS "Functions"
+
+.in +1c
+.ti -1c
+.RI "netsnmp_mib_handler * \fBnetsnmp_get_bulk_to_next_handler\fP (void)"
+.br
+.RI "\fIreturns a bulk_to_next handler that can be injected into a given handler chain.\fP"
+.ti -1c
+.RI "void \fBnetsnmp_bulk_to_next_fix_requests\fP (netsnmp_request_info *requests)"
+.br
+.RI "\fItakes answered requests and decrements the repeat count and updates the requests to the next to-do varbind in the list\fP"
+.in -1c
+.SH "DETAILED DESCRIPTION"
+.PP 
+The only purpose of this handler is to convert a GETBULK request to a GETNEXT request.
+.PP
+It is inserted into handler chains where the handler has not set the HANDLER_CAN_GETBULK flag. 
+.SH "FUNCTION DOCUMENTATION"
+.PP 
+.SS "void netsnmp_bulk_to_next_fix_requests (netsnmp_request_info * requests)"
+.PP
+takes answered requests and decrements the repeat count and updates the requests to the next to-do varbind in the list
+.PP
+Definition at line 39 of file bulk_to_next.c.
+.SS "netsnmp_mib_handler* netsnmp_get_bulk_to_next_handler (void)"
+.PP
+returns a bulk_to_next handler that can be injected into a given handler chain.
+.PP
+Definition at line 30 of file bulk_to_next.c.
+.PP
+References netsnmp_create_handler().
+.PP
+Referenced by netsnmp_init_bulk_to_next_helper(), and netsnmp_register_handler().
+.SS "void netsnmp_init_bulk_to_next_helper (void)"
+.PP
+initializes the bulk_to_next helper which then registers a bulk_to_next handler as a run-time injectable handler for configuration file use.
+.PP
+Definition at line 95 of file bulk_to_next.c.
+.PP
+References netsnmp_get_bulk_to_next_handler(), and netsnmp_register_handler_by_name().
+.PP
+Referenced by netsnmp_init_helpers().
diff -Naur tomato/release/src/router/snmp/man/netsnmp_debug.3 tomato121/release/src/router/snmp/man/netsnmp_debug.3
--- tomato/release/src/router/snmp/man/netsnmp_debug.3	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/man/netsnmp_debug.3	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,105 @@
+.TH "debug: print out debugging information about the handler chain being called." 3 "5 Sep 2003" "net-snmp" \" -*- nroff -*-
+.ad l
+.nh
+.SH NAME
+debug: print out debugging information about the handler chain being called. \- This is a useful module for run-time debugging of requests as the pass this handler in a calling chain. 
+More...
+.SS "handler"
+
+.in +1c
+.ti -1c
+.RI "void \fBnetsnmp_init_debug_helper\fP (void)"
+.br
+.RI "\fIinitializes the debug helper which then registers a debug handler as a run-time injectable handler for configuration file use.\fP"
+.ti -1c
+.RI "void \fBnetsnmp_init_serialize\fP (void)"
+.br
+.RI "\fIinitializes the serialize helper which then registers a serialize handler as a run-time injectable handler for configuration file use.\fP"
+.ti -1c
+.RI "void \fBnetsnmp_init_read_only_helper\fP (void)"
+.br
+.RI "\fIinitializes the read_only helper which then registers a read_only handler as a run-time injectable handler for configuration file use.\fP"
+.ti -1c
+.RI "void \fBnetsnmp_init_bulk_to_next_helper\fP (void)"
+.br
+.RI "\fIinitializes the bulk_to_next helper which then registers a bulk_to_next handler as a run-time injectable handler for configuration file use.\fP"
+.ti -1c
+.RI "void \fBnetsnmp_init_helpers\fP (void)"
+.br
+.RI "\fIcall the initialization sequence for all handlers with init_ routines.\fP"
+.in -1c
+.SS "Functions"
+
+.in +1c
+.ti -1c
+.RI "netsnmp_mib_handler * \fBnetsnmp_get_debug_handler\fP (void)"
+.br
+.RI "\fIreturns a debug handler that can be injected into a given handler chain.\fP"
+.in -1c
+.SH "DETAILED DESCRIPTION"
+.PP 
+This is a useful module for run-time debugging of requests as the pass this handler in a calling chain.
+.PP
+All debugging output is done via the standard debugging routines with a token name of 'helper:debug', so use the -Dhelper:debug command line flag to see the output when running the snmpd demon. It's not recommended you compile this into a handler chain during compile time, but instead use the 'injectHandler' token in the snmpd.conf file (or similar) to add it to the chain later:
+.PP
+injectHandler debug my_module_name
+.PP
+to see an example output, try:
+.PP
+injectHandler debug mibII/system
+.PP
+and then run snmpwalk on the 'system' group. 
+.SH "FUNCTION DOCUMENTATION"
+.PP 
+.SS "netsnmp_mib_handler* netsnmp_get_debug_handler (void)"
+.PP
+returns a debug handler that can be injected into a given handler chain.
+.PP
+Definition at line 44 of file debug_handler.c.
+.PP
+References netsnmp_create_handler().
+.PP
+Referenced by netsnmp_init_debug_helper().
+.SS "void netsnmp_init_bulk_to_next_helper (void)"
+.PP
+initializes the bulk_to_next helper which then registers a bulk_to_next handler as a run-time injectable handler for configuration file use.
+.PP
+Definition at line 95 of file bulk_to_next.c.
+.PP
+References netsnmp_get_bulk_to_next_handler(), and netsnmp_register_handler_by_name().
+.PP
+Referenced by netsnmp_init_helpers().
+.SS "void netsnmp_init_debug_helper (void)"
+.PP
+initializes the debug helper which then registers a debug handler as a run-time injectable handler for configuration file use.
+.PP
+Definition at line 147 of file debug_handler.c.
+.PP
+References netsnmp_get_debug_handler(), and netsnmp_register_handler_by_name().
+.PP
+Referenced by netsnmp_init_helpers().
+.SS "void netsnmp_init_helpers (void)"
+.PP
+call the initialization sequence for all handlers with init_ routines.
+.PP
+Definition at line 31 of file all_helpers.c.
+.PP
+References netsnmp_init_bulk_to_next_helper(), netsnmp_init_debug_helper(), netsnmp_init_read_only_helper(), and netsnmp_init_serialize().
+.SS "void netsnmp_init_read_only_helper (void)"
+.PP
+initializes the read_only helper which then registers a read_only handler as a run-time injectable handler for configuration file use.
+.PP
+Definition at line 71 of file read_only.c.
+.PP
+References netsnmp_get_read_only_handler(), and netsnmp_register_handler_by_name().
+.PP
+Referenced by netsnmp_init_helpers().
+.SS "void netsnmp_init_serialize (void)"
+.PP
+initializes the serialize helper which then registers a serialize handler as a run-time injectable handler for configuration file use.
+.PP
+Definition at line 96 of file serialize.c.
+.PP
+References netsnmp_get_serialize_handler(), and netsnmp_register_handler_by_name().
+.PP
+Referenced by netsnmp_init_helpers().
diff -Naur tomato/release/src/router/snmp/man/netsnmp_example_scalar_int.3 tomato121/release/src/router/snmp/man/netsnmp_example_scalar_int.3
--- tomato/release/src/router/snmp/man/netsnmp_example_scalar_int.3	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/man/netsnmp_example_scalar_int.3	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,26 @@
+.TH "example_scalar_int: instantiates a few example scalars." 3 "6 Mar 2002" "net-snmp" \" -*- nroff -*-
+.ad l
+.nh
+.SH NAME
+example_scalar_int: instantiates a few example scalars. \- This example merely creates some scalar registrations that allows some simple variables to be accessed via SNMP. 
+More...
+.SS "Functions"
+
+.in +1c
+.ti -1c
+.RI "void \fBinit_scalar_int\fP (void)"
+.br
+.in -1c
+.SH "DETAILED DESCRIPTION"
+.PP 
+This example merely creates some scalar registrations that allows some simple variables to be accessed via SNMP.
+.PP
+In a more realistic example, it is likely that these variables would also be manipulated in other ways outside of SNMP gets/sets.
+.PP
+If this module is compiled into an agent, you should be able to issue snmp commands that look something like (authentication information not shown in these commands):
+.PP
+snmpget localhost netSnmpExampleInteger.0 netSnmpExampleScalars = 42
+.PP
+snmpset localhost netSnmpExampleInteger.0 = 1234 netSnmpExampleScalars = 1234
+.PP
+snmpget localhost netSnmpExampleInteger.0 netSnmpExampleScalars = 1234 
\ No newline at end of file
diff -Naur tomato/release/src/router/snmp/man/netsnmp_handler.3 tomato121/release/src/router/snmp/man/netsnmp_handler.3
--- tomato/release/src/router/snmp/man/netsnmp_handler.3	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/man/netsnmp_handler.3	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,405 @@
+.TH "Net-SNMP Agent handler and extensibility API" 3 "5 Sep 2003" "net-snmp" \" -*- nroff -*-
+.ad l
+.nh
+.SH NAME
+Net-SNMP Agent handler and extensibility API \- The basic theory goes something like this: In the past, with the original mib module api (which derived from the original CMU SNMP code) the underlying mib modules were passed very little information (only the truly most basic information about a request). 
+More...
+.SS "Modules"
+
+.in +1c
+.ti -1c
+.RI "\fBbulk_to_next: convert GETBULK requests into GETNEXT requests for the handler.\fP"
+.br
+.RI "\fIThe only purpose of this handler is to convert a GETBULK request to a GETNEXT request.\fP"
+.PP
+.in +1c
+
+.ti -1c
+.RI "\fBdebug: print out debugging information about the handler chain being called.\fP"
+.br
+.RI "\fIThis is a useful module for run-time debugging of requests as the pass this handler in a calling chain.\fP"
+.PP
+.in +1c
+
+.ti -1c
+.RI "\fBinstance: process scalars and other instances easily.\fP"
+.br
+.ti -1c
+.RI "\fBmode_end_call: at the end of a series of requests, call another handler hook.\fP"
+.br
+.RI "\fIHandlers that want to loop through a series of requests and then receive a callback at the end of a particular MODE can use this helper to make this possible.\fP"
+.PP
+.in +1c
+
+.ti -1c
+.RI "\fBmultiplexer: splits mode requests into calls to different handlers.\fP"
+.br
+.RI "\fIThe multiplexer helper lets you split the calling chain depending on the calling mode (get vs getnext vs set).\fP"
+.PP
+.in +1c
+
+.ti -1c
+.RI "\fBold_api: Calls mib module code written in the old style of code.\fP"
+.br
+.RI "\fIThis is a backwards compatilibity module that allows code written in the old API to be run under the new handler based architecture.\fP"
+.PP
+.in +1c
+
+.ti -1c
+.RI "\fBread_only: make your handler read_only automatically\fP"
+.br
+.RI "\fIThe only purpose of this handler is to return an appropriate error for any requests passed to it in a SET mode.\fP"
+.PP
+.in +1c
+
+.ti -1c
+.RI "\fBscalar: process scalars easily.\fP"
+.br
+.ti -1c
+.RI "\fBserialize: Calls sub handlers one request at a time.\fP"
+.br
+.RI "\fIThis functionally passes in one request at a time into lower handlers rather than a whole bunch of requests at once.\fP"
+.PP
+.in +1c
+
+.ti -1c
+.RI "\fBtable: Helps you implement a table.\fP"
+.br
+.RI "\fIThis handler helps you implement a table by doing some of the processing for you.\fP"
+.PP
+.in +1c
+
+.ti -1c
+.RI "\fBwatcher: watch a specified variable and process\fP"
+.br
+.RI "\fIit as an instance or scalar object\fP"
+.PP
+
+.in -1c
+.SS "Functions"
+
+.in +1c
+.ti -1c
+.RI "netsnmp_mib_handler * \fBnetsnmp_create_handler\fP (const char *name, Netsnmp_Node_Handler *handler_access_method)"
+.br
+.RI "\fIcreates a netsnmp_mib_handler structure given a name and a access method.\fP"
+.ti -1c
+.RI "netsnmp_handler_registration * \fBnetsnmp_create_handler_registration\fP (const char *name, Netsnmp_Node_Handler *handler_access_method, oid *reg_oid, size_t reg_oid_len, int modes)"
+.br
+.RI "\fIcreates a handler registration structure given a name, a access_method function, a registration location oid and the modes the handler supports.\fP"
+.ti -1c
+.RI "int \fBnetsnmp_register_handler\fP (netsnmp_handler_registration *reginfo)"
+.br
+.RI "\fIregister a handler, as defined by the netsnmp_handler_registration pointer.\fP"
+.ti -1c
+.RI "int \fBnetsnmp_register_handler_nocallback\fP (netsnmp_handler_registration *reginfo)"
+.br
+.RI "\fIregister a handler, as defined by the netsnmp_handler_registration pointer.\fP"
+.ti -1c
+.RI "int \fBnetsnmp_inject_handler\fP (netsnmp_handler_registration *reginfo, netsnmp_mib_handler *handler)"
+.br
+.RI "\fIinject a new handler into the calling chain of the handlers definedy by the netsnmp_handler_registration pointer.\fP"
+.ti -1c
+.RI "NETSNMP_INLINE int \fBnetsnmp_call_handler\fP (netsnmp_mib_handler *next_handler, netsnmp_handler_registration *reginfo, netsnmp_agent_request_info *reqinfo, netsnmp_request_info *requests)"
+.br
+.RI "\fIcalls a handler with with appropriate NULL checking of arguments, etc.\fP"
+.ti -1c
+.RI "NETSNMP_INLINE int \fBnetsnmp_call_next_handler\fP (netsnmp_mib_handler *current, netsnmp_handler_registration *reginfo, netsnmp_agent_request_info *reqinfo, netsnmp_request_info *requests)"
+.br
+.RI "\fIcalls the next handler in the chain after the current one with with appropriate NULL checking, etc.\fP"
+.ti -1c
+.RI "NETSNMP_INLINE int \fBnetsnmp_call_next_handler_one_request\fP (netsnmp_mib_handler *current, netsnmp_handler_registration *reginfo, netsnmp_agent_request_info *reqinfo, netsnmp_request_info *requests)"
+.br
+.RI "\fIcalls the next handler in the chain after the current one with with appropriate NULL checking, etc.\fP"
+.ti -1c
+.RI "void \fBnetsnmp_handler_free\fP (netsnmp_mib_handler *handler)"
+.br
+.RI "\fIfree's the resourceses associated with a given handler\fP"
+.ti -1c
+.RI "netsnmp_mib_handler * \fBnetsnmp_handler_dup\fP (netsnmp_mib_handler *handler)"
+.br
+.RI "\fIdulpicates a handler\fP"
+.ti -1c
+.RI "void \fBnetsnmp_handler_registration_free\fP (netsnmp_handler_registration *reginfo)"
+.br
+.RI "\fIfree the resources associated with a handler registration object\fP"
+.ti -1c
+.RI "netsnmp_handler_registration * \fBnetsnmp_handler_registration_dup\fP (netsnmp_handler_registration *reginfo)"
+.br
+.RI "\fIduplicates the handler registration object\fP"
+.ti -1c
+.RI "NETSNMP_INLINE netsnmp_delegated_cache * \fBnetsnmp_create_delegated_cache\fP (netsnmp_mib_handler *handler, netsnmp_handler_registration *reginfo, netsnmp_agent_request_info *reqinfo, netsnmp_request_info *requests, void *localinfo)"
+.br
+.RI "\fIcreates a cache of information which can be saved for future reference.\fP"
+.ti -1c
+.RI "NETSNMP_INLINE netsnmp_delegated_cache * \fBnetsnmp_handler_check_cache\fP (netsnmp_delegated_cache *dcache)"
+.br
+.RI "\fIcheck's a given cache and returns it if it is still valid (ie, the agent still considers it to be an outstanding request.\fP"
+.ti -1c
+.RI "NETSNMP_INLINE void \fBnetsnmp_free_delegated_cache\fP (netsnmp_delegated_cache *dcache)"
+.br
+.RI "\fIfrees a cache once you're finished using it\fP"
+.ti -1c
+.RI "void \fBnetsnmp_handler_mark_requests_as_delegated\fP (netsnmp_request_info *requests, int isdelegated)"
+.br
+.RI "\fImarks a list of requests as delegated (or not if isdelegaded = 0)\fP"
+.ti -1c
+.RI "NETSNMP_INLINE void \fBnetsnmp_request_add_list_data\fP (netsnmp_request_info *request, netsnmp_data_list *node)"
+.br
+.RI "\fIadd data to a request that can be extracted later by submodules\fP"
+.ti -1c
+.RI "NETSNMP_INLINE void * \fBnetsnmp_request_get_list_data\fP (netsnmp_request_info *request, const char *name)"
+.br
+.RI "\fIextract data from a request that was added previously by a parent module\fP"
+.ti -1c
+.RI "NETSNMP_INLINE void \fBnetsnmp_free_request_data_set\fP (netsnmp_request_info *request)"
+.br
+.RI "\fIFree the extra data stored in a request.\fP"
+.ti -1c
+.RI "NETSNMP_INLINE void \fBnetsnmp_free_request_data_sets\fP (netsnmp_request_info *request)"
+.br
+.RI "\fIFree the extra data stored in a bunch of requests (all data in the chain).\fP"
+.ti -1c
+.RI "netsnmp_mib_handler * \fBnetsnmp_find_handler_by_name\fP (netsnmp_handler_registration *reginfo, const char *name)"
+.br
+.RI "\fIReturns a handler from a chain based on the name.\fP"
+.ti -1c
+.RI "void * \fBnetsnmp_find_handler_data_by_name\fP (netsnmp_handler_registration *reginfo, const char *name)"
+.br
+.RI "\fIReturns a handler's void * pointer from a chain based on the name.\fP"
+.ti -1c
+.RI "netsnmp_mib_handler * \fBclone_handler\fP (netsnmp_mib_handler *it)"
+.br
+.RI "\fIclones a mib handler (it's name and access methods onlys; not myvoid)\fP"
+.ti -1c
+.RI "void \fBnetsnmp_register_handler_by_name\fP (const char *name, netsnmp_mib_handler *handler)"
+.br
+.RI "\fIregisters a given handler by name so that it can be found easily later.\fP"
+.in -1c
+.SH "DETAILED DESCRIPTION"
+.PP 
+The basic theory goes something like this: In the past, with the original mib module api (which derived from the original CMU SNMP code) the underlying mib modules were passed very little information (only the truly most basic information about a request).
+.PP
+This worked well at the time but in todays world of subagents, device instrumentation, low resource consumption, etc, it just isn't flexible enough. 'handlers' are here to fix all that.
+.PP
+With the rewrite of the agent internals for the net-snmp 5.0 release, we introduce a modular calling scheme that allows agent modules to be written in a very flexible manner, and more importantly allows reuse of code in a decent way (and without the memory and speed overheads of OO languages like C++).
+.PP
+Functionally, the notion of what a handler does is the same as the older api: A handler is \fBcreated\fP and then \fBregistered\fP with the main agent at a given OID in the OID tree and gets called any time a request is made that it should respond to. You probably should use one of the convenience helpers instead of doing anything else yourself though:
+.PP
+Most importantly, though, is that the handlers are built on the notion of modularity and reuse. Specifically, rather than do all the really hard work (like parsing table indexes out of an incoming oid request) in each module, the API is designed to make it easy to write 'helper' handlers that merely process some aspect of the request before passing it along to the final handler that returns the real answer. Most people will want to make use of the \fBinstance\fP, \fBtable\fP, \fBtable_iterator\fP, \fBtable_data\fP, or \fBtable_dataset\fP helpers to make their life easier. These 'helpers' interpert important aspects of the request and pass them on to you.
+.PP
+For instance, the \fBtable\fP helper is designed to hand you a list of extracted index values from an incoming request. THe \fBtable_iterator\fP helper is built on top of the table helper, and is designed to help you iterate through data stored elsewhere (like in a kernel) that is not in OID lexographical order (ie, don't write your own index/oid sorting routine, use this helper instead). The beauty of the 
+.SH "FUNCTION DOCUMENTATION"
+.PP 
+.SS "netsnmp_mib_handler* clone_handler (netsnmp_mib_handler * it)"
+.PP
+clones a mib handler (it's name and access methods onlys; not myvoid)
+.PP
+Definition at line 643 of file agent_handler.c.
+.PP
+References netsnmp_create_handler().
+.SS "NETSNMP_INLINE int netsnmp_call_handler (netsnmp_mib_handler * next_handler, netsnmp_handler_registration * reginfo, netsnmp_agent_request_info * reqinfo, netsnmp_request_info * requests)"
+.PP
+calls a handler with with appropriate NULL checking of arguments, etc.
+.PP
+Definition at line 305 of file agent_handler.c.
+.PP
+Referenced by netsnmp_call_next_handler(), netsnmp_call_next_handler_one_request(), and netsnmp_multiplexer_helper_handler().
+.SS "NETSNMP_INLINE int netsnmp_call_next_handler (netsnmp_mib_handler * current, netsnmp_handler_registration * reginfo, netsnmp_agent_request_info * reqinfo, netsnmp_request_info * requests)"
+.PP
+calls the next handler in the chain after the current one with with appropriate NULL checking, etc.
+.PP
+Definition at line 340 of file agent_handler.c.
+.PP
+References netsnmp_call_handler().
+.PP
+Referenced by netsnmp_serialize_helper_handler(), netsnmp_table_data_helper_handler(), netsnmp_table_data_set_helper_handler(), and table_helper_handler().
+.SS "NETSNMP_INLINE int netsnmp_call_next_handler_one_request (netsnmp_mib_handler * current, netsnmp_handler_registration * reginfo, netsnmp_agent_request_info * reqinfo, netsnmp_request_info * requests)"
+.PP
+calls the next handler in the chain after the current one with with appropriate NULL checking, etc.
+.PP
+Definition at line 358 of file agent_handler.c.
+.PP
+References netsnmp_call_handler().
+.SS "NETSNMP_INLINE netsnmp_delegated_cache* netsnmp_create_delegated_cache (netsnmp_mib_handler * handler, netsnmp_handler_registration * reginfo, netsnmp_agent_request_info * reqinfo, netsnmp_request_info * requests, void * localinfo)"
+.PP
+creates a cache of information which can be saved for future reference.
+.PP
+Use \fBnetsnmp_handler_check_cache()\fP later to make sure it's still valid before referencing it in the future. 
+.PP
+\fBExamples: \fP
+.in +1c
+\fBdelayed_instance.c\fP.
+.PP
+Definition at line 510 of file agent_handler.c.
+.SS "netsnmp_mib_handler* netsnmp_create_handler (const char * name, Netsnmp_Node_Handler * handler_access_method)"
+.PP
+creates a netsnmp_mib_handler structure given a name and a access method.
+.PP
+The returned handler should then be \fBregistered.\fP 
+.PP
+\fBSee also: \fP
+.in +1c
+\fBnetsnmp_create_handler_registration()\fP , \fBnetsnmp_register_handler()\fP 
+.PP
+Definition at line 80 of file agent_handler.c.
+.PP
+Referenced by clone_handler(), get_old_api_handler(), netsnmp_create_handler_registration(), netsnmp_get_bulk_to_next_handler(), netsnmp_get_debug_handler(), netsnmp_get_mode_end_call_handler(), netsnmp_get_multiplexer_handler(), netsnmp_get_read_only_handler(), netsnmp_get_serialize_handler(), netsnmp_get_table_data_handler(), netsnmp_get_table_data_set_handler(), and netsnmp_get_table_handler().
+.SS "netsnmp_handler_registration* netsnmp_create_handler_registration (const char * name, Netsnmp_Node_Handler * handler_access_method, oid * reg_oid, size_t reg_oid_len, int modes)"
+.PP
+creates a handler registration structure given a name, a access_method function, a registration location oid and the modes the handler supports.
+.PP
+If modes == 0, then modes will automatically be set to the default value of only HANDLER_CAN_DEFAULT, which is by default read-only GET and GETNEXT requests. 
+.PP
+\fBNote: \fP
+.in +1c
+This ends up calling netsnmp_create_handler(name, handler_access_method) 
+.PP
+\fBSee also: \fP
+.in +1c
+\fBnetsnmp_create_handler()\fP , \fBnetsnmp_register_handler()\fP 
+.PP
+\fBExamples: \fP
+.in +1c
+\fBdelayed_instance.c\fP.
+.PP
+Definition at line 99 of file agent_handler.c.
+.PP
+References netsnmp_create_handler().
+.SS "netsnmp_mib_handler* netsnmp_find_handler_by_name (netsnmp_handler_registration * reginfo, const char * name)"
+.PP
+Returns a handler from a chain based on the name.
+.PP
+Definition at line 614 of file agent_handler.c.
+.PP
+Referenced by netsnmp_find_handler_data_by_name().
+.SS "void* netsnmp_find_handler_data_by_name (netsnmp_handler_registration * reginfo, const char * name)"
+.PP
+Returns a handler's void * pointer from a chain based on the name.
+.PP
+This probably shouldn't be used by the general public as the void * data may change as a handler evolves. Handlers should really advertise some function for you to use instead. 
+.PP
+Definition at line 631 of file agent_handler.c.
+.PP
+References netsnmp_find_handler_by_name().
+.PP
+Referenced by netsnmp_find_table_registration_info().
+.SS "NETSNMP_INLINE void netsnmp_free_delegated_cache (netsnmp_delegated_cache * dcache)"
+.PP
+frees a cache once you're finished using it
+.PP
+\fBExamples: \fP
+.in +1c
+\fBdelayed_instance.c\fP.
+.PP
+Definition at line 548 of file agent_handler.c.
+.SS "NETSNMP_INLINE void netsnmp_free_request_data_set (netsnmp_request_info * request)"
+.PP
+Free the extra data stored in a request.
+.PP
+Definition at line 596 of file agent_handler.c.
+.SS "NETSNMP_INLINE void netsnmp_free_request_data_sets (netsnmp_request_info * request)"
+.PP
+Free the extra data stored in a bunch of requests (all data in the chain).
+.PP
+Definition at line 604 of file agent_handler.c.
+.SS "NETSNMP_INLINE netsnmp_delegated_cache* netsnmp_handler_check_cache (netsnmp_delegated_cache * dcache)"
+.PP
+check's a given cache and returns it if it is still valid (ie, the agent still considers it to be an outstanding request.
+.PP
+Returns NULL if it's no longer valid. 
+.PP
+\fBExamples: \fP
+.in +1c
+\fBdelayed_instance.c\fP.
+.PP
+Definition at line 534 of file agent_handler.c.
+.SS "netsnmp_mib_handler* netsnmp_handler_dup (netsnmp_mib_handler * handler)"
+.PP
+dulpicates a handler
+.PP
+Definition at line 394 of file agent_handler.c.
+.PP
+Referenced by netsnmp_handler_registration_dup().
+.SS "void netsnmp_handler_free (netsnmp_mib_handler * handler)"
+.PP
+free's the resourceses associated with a given handler
+.PP
+Definition at line 380 of file agent_handler.c.
+.PP
+Referenced by netsnmp_handler_registration_free().
+.SS "void netsnmp_handler_mark_requests_as_delegated (netsnmp_request_info * requests, int isdelegated)"
+.PP
+marks a list of requests as delegated (or not if isdelegaded = 0)
+.PP
+Definition at line 562 of file agent_handler.c.
+.SS "netsnmp_handler_registration* netsnmp_handler_registration_dup (netsnmp_handler_registration * reginfo)"
+.PP
+duplicates the handler registration object
+.PP
+Definition at line 448 of file agent_handler.c.
+.PP
+References netsnmp_handler_dup(), and netsnmp_handler_registration_free().
+.SS "void netsnmp_handler_registration_free (netsnmp_handler_registration * reginfo)"
+.PP
+free the resources associated with a handler registration object
+.PP
+Definition at line 435 of file agent_handler.c.
+.PP
+References netsnmp_handler_free().
+.PP
+Referenced by netsnmp_handler_registration_dup(), netsnmp_register_mib_table_row(), and netsnmp_register_old_api().
+.SS "int netsnmp_inject_handler (netsnmp_handler_registration * reginfo, netsnmp_mib_handler * handler)"
+.PP
+inject a new handler into the calling chain of the handlers definedy by the netsnmp_handler_registration pointer.
+.PP
+The new handler is injected at the top of the list and hence will be the new handler to be called first. 
+.PP
+Definition at line 221 of file agent_handler.c.
+.PP
+Referenced by netsnmp_register_handler(), netsnmp_register_read_only_table_data(), netsnmp_register_serialize(), netsnmp_register_table(), netsnmp_register_table_data(), and netsnmp_register_table_data_set().
+.SS "int netsnmp_register_handler (netsnmp_handler_registration * reginfo)"
+.PP
+register a handler, as defined by the netsnmp_handler_registration pointer.
+.PP
+Definition at line 125 of file agent_handler.c.
+.PP
+References netsnmp_get_bulk_to_next_handler(), and netsnmp_inject_handler().
+.PP
+Referenced by netsnmp_register_old_api(), netsnmp_register_serialize(), and netsnmp_register_table().
+.SS "void netsnmp_register_handler_by_name (const char * name, netsnmp_mib_handler * handler)"
+.PP
+registers a given handler by name so that it can be found easily later.
+.PP
+Definition at line 653 of file agent_handler.c.
+.PP
+Referenced by netsnmp_init_bulk_to_next_helper(), netsnmp_init_debug_helper(), netsnmp_init_read_only_helper(), and netsnmp_init_serialize().
+.SS "int netsnmp_register_handler_nocallback (netsnmp_handler_registration * reginfo)"
+.PP
+register a handler, as defined by the netsnmp_handler_registration pointer.
+.PP
+Definition at line 175 of file agent_handler.c.
+.PP
+Referenced by netsnmp_register_mib_table_row().
+.SS "NETSNMP_INLINE void netsnmp_request_add_list_data (netsnmp_request_info * request, netsnmp_data_list * node)"
+.PP
+add data to a request that can be extracted later by submodules
+.PP
+\fBExamples: \fP
+.in +1c
+\fBdelayed_instance.c\fP.
+.PP
+Definition at line 573 of file agent_handler.c.
+.PP
+Referenced by netsnmp_old_api_helper(), netsnmp_table_data_helper_handler(), netsnmp_table_data_set_helper_handler(), and table_helper_handler().
+.SS "NETSNMP_INLINE void* netsnmp_request_get_list_data (netsnmp_request_info * request, const char * name)"
+.PP
+extract data from a request that was added previously by a parent module
+.PP
+\fBExamples: \fP
+.in +1c
+\fBdelayed_instance.c\fP.
+.PP
+Definition at line 586 of file agent_handler.c.
+.PP
+Referenced by netsnmp_extract_array_context(), netsnmp_extract_table_data_set(), netsnmp_extract_table_info(), netsnmp_extract_table_row(), and netsnmp_old_api_helper().
diff -Naur tomato/release/src/router/snmp/man/netsnmp_instance.3 tomato121/release/src/router/snmp/man/netsnmp_instance.3
--- tomato/release/src/router/snmp/man/netsnmp_instance.3	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/man/netsnmp_instance.3	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,5 @@
+.TH "instance: process scalars and other instances easily." 3 "5 Sep 2003" "net-snmp" \" -*- nroff -*-
+.ad l
+.nh
+.SH NAME
+instance: process scalars and other instances easily. \- 
diff -Naur tomato/release/src/router/snmp/man/netsnmp_library.3 tomato121/release/src/router/snmp/man/netsnmp_library.3
--- tomato/release/src/router/snmp/man/netsnmp_library.3	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/man/netsnmp_library.3	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,217 @@
+.TH "The Net-SNMP library" 3 "5 Sep 2003" "net-snmp" \" -*- nroff -*-
+.ad l
+.nh
+.SH NAME
+The Net-SNMP library \- 
+.SS "Modules"
+
+.in +1c
+.ti -1c
+.RI "\fBmib parsing and datatype manipulation routines.\fP"
+.br
+.in -1c
+.SS "Data Structures"
+
+.in +1c
+.ti -1c
+.RI "struct \fBsession_list\fP"
+.br
+.ti -1c
+.RI "struct \fBsnmp_internal_session\fP"
+.br
+.in -1c
+.SS "Functions"
+
+.in +1c
+.ti -1c
+.RI "int \fBsnmp_oid_compare\fP (const oid *in_name1, size_t len1, const oid *in_name2, size_t len2)"
+.br
+.RI "\fIlexicographical compare two object identifiers.\fP"
+.ti -1c
+.RI "int \fBsnmp_oidtree_compare\fP (const oid *in_name1, size_t len1, const oid *in_name2, size_t len2)"
+.br
+.RI "\fICompares 2 OIDs to determine if they are equal up until the shortest length.\fP"
+.ti -1c
+.RI "int \fBnetsnmp_oid_equals\fP (const oid *in_name1, size_t len1, const oid *in_name2, size_t len2)"
+.br
+.RI "\fICompares 2 OIDs to determine if they are exactly equal.\fP"
+.ti -1c
+.RI "int \fBnetsnmp_oid_is_subtree\fP (const oid *in_name1, size_t len1, const oid *in_name2, size_t len2)"
+.br
+.RI "\fIIdentical to netsnmp_oid_equals, except only the length up to len1 is compared.\fP"
+.ti -1c
+.RI "int \fBnetsnmp_oid_find_prefix\fP (const oid *in_name1, size_t len1, const oid *in_name2, size_t len2)"
+.br
+.RI "\fIGiven two OIDs, determine the common prefix to them both.\fP"
+.in -1c
+.SH "DEFINE DOCUMENTATION"
+.PP 
+.SS "#define DEBUGPRINTPDUTYPE(token, type)"
+.PP
+\fBValue:\fP
+.PP
+.nf
+switch(type) { \
+      case SNMP_MSG_GET: \
+        DEBUGDUMPSECTION(token, 'PDU-GET'); \
+        break; \
+      case SNMP_MSG_GETNEXT: \
+        DEBUGDUMPSECTION(token, 'PDU-GETNEXT'); \
+        break; \
+      case SNMP_MSG_RESPONSE: \
+        DEBUGDUMPSECTION(token, 'PDU-RESPONSE'); \
+        break; \
+      case SNMP_MSG_SET: \
+        DEBUGDUMPSECTION(token, 'PDU-SET'); \
+        break; \
+      case SNMP_MSG_GETBULK: \
+        DEBUGDUMPSECTION(token, 'PDU-GETBULK'); \
+        break; \
+      case SNMP_MSG_INFORM: \
+        DEBUGDUMPSECTION(token, 'PDU-INFORM'); \
+        break; \
+      case SNMP_MSG_TRAP2: \
+        DEBUGDUMPSECTION(token, 'PDU-TRAP2'); \
+        break; \
+      case SNMP_MSG_REPORT: \
+        DEBUGDUMPSECTION(token, 'PDU-REPORT'); \
+        break; \
+      default: \
+        DEBUGDUMPSECTION(token, 'PDU-UNKNOWN'); \
+        break; \
+    }
+.fi
+.PP
+Definition at line 364 of file snmp_api.c.
+.SS "#define timercmp(tvp, uvp, cmp)"
+.PP
+\fBValue:\fP
+.PP
+.nf
+\
+        ((tvp)->tv_sec cmp (uvp)->tv_sec || \
+        ((tvp)->tv_sec == (uvp)->tv_sec && \
+          \
+        (tvp)->tv_usec cmp (uvp)->tv_usec))
+.fi
+.PP
+Definition at line 135 of file snmp_api.c.
+.SH "FUNCTION DOCUMENTATION"
+.PP 
+.SS "int netsnmp_oid_equals (const oid * in_name1, size_t len1, const oid * in_name2, size_t len2)"
+.PP
+Compares 2 OIDs to determine if they are exactly equal.
+.PP
+This should be faster than doing a snmp_oid_compare for different length OIDs, since the length is checked first and if != returns immediately. Might be very slighly faster if lengths are ==. 
+.PP
+\fBParameters: \fP
+.in +1c
+.TP
+\fB\fIin_name1\fP\fP
+A pointer to the first oid. 
+.TP
+\fB\fIlen1\fP\fP
+length of the first OID (in segments, not bytes) 
+.TP
+\fB\fIin_name2\fP\fP
+A pointer to the second oid. 
+.TP
+\fB\fIlen2\fP\fP
+length of the second OID (in segments, not bytes) 
+.PP
+\fBReturns: \fP
+.in +1c
+0 if they are equal, 1 if they are not. 
+.PP
+Definition at line 6044 of file snmp_api.c.
+.PP
+Referenced by netsnmp_old_api_helper().
+.SS "int netsnmp_oid_find_prefix (const oid * in_name1, size_t len1, const oid * in_name2, size_t len2)"
+.PP
+Given two OIDs, determine the common prefix to them both.
+.PP
+\fBParameters: \fP
+.in +1c
+.TP
+\fB\fIin_name1\fP\fP
+A pointer to the first oid. 
+.TP
+\fB\fIlen1\fP\fP
+Length of the first oid. 
+.TP
+\fB\fIin_name2\fP\fP
+A pointer to the second oid. 
+.TP
+\fB\fIlen2\fP\fP
+Length of the second oid. 
+.PP
+\fBReturns: \fP
+.in +1c
+length of largest common index of commonality. 1 = first, 0 if none * or -1 on error. 
+.PP
+Definition at line 6100 of file snmp_api.c.
+.SS "int netsnmp_oid_is_subtree (const oid * in_name1, size_t len1, const oid * in_name2, size_t len2)"
+.PP
+Identical to netsnmp_oid_equals, except only the length up to len1 is compared.
+.PP
+Functionally, this determines if in_name2 is equal or a subtree of in_name1 
+.PP
+\fBParameters: \fP
+.in +1c
+.TP
+\fB\fIin_name1\fP\fP
+A pointer to the first oid. 
+.TP
+\fB\fIlen1\fP\fP
+length of the first OID (in segments, not bytes) 
+.TP
+\fB\fIin_name2\fP\fP
+A pointer to the second oid. 
+.TP
+\fB\fIlen2\fP\fP
+length of the second OID (in segments, not bytes) 
+.PP
+\fBReturns: \fP
+.in +1c
+0 if one is a common prefix of the other. 
+.PP
+Definition at line 6080 of file snmp_api.c.
+.SS "int snmp_oid_compare (const oid * in_name1, size_t len1, const oid * in_name2, size_t len2)"
+.PP
+lexicographical compare two object identifiers.
+.PP
+Caution: this method is called often by command responder applications (ie, agent).
+.PP
+\fBReturns: \fP
+.in +1c
+-1 if name1 < name2, 0 if name1 = name2, 1 if name1 > name2 
+.PP
+Definition at line 5976 of file snmp_api.c.
+.PP
+Referenced by netsnmp_check_getnext_reply(), netsnmp_table_data_add_row(), netsnmp_table_data_get_from_oid(), netsnmp_table_data_helper_handler(), snmp_oidtree_compare(), and table_helper_handler().
+.SS "int snmp_oidtree_compare (const oid * in_name1, size_t len1, const oid * in_name2, size_t len2)"
+.PP
+Compares 2 OIDs to determine if they are equal up until the shortest length.
+.PP
+\fBParameters: \fP
+.in +1c
+.TP
+\fB\fIin_name1\fP\fP
+A pointer to the first oid. 
+.TP
+\fB\fIlen1\fP\fP
+length of the first OID (in segments, not bytes) 
+.TP
+\fB\fIin_name2\fP\fP
+A pointer to the second oid. 
+.TP
+\fB\fIlen2\fP\fP
+length of the second OID (in segments, not bytes) 
+.PP
+\fBReturns: \fP
+.in +1c
+0 if they are equal, 1 if in_name1 is > in_name2, or -1 if <. 
+.PP
+Definition at line 6025 of file snmp_api.c.
+.PP
+References snmp_oid_compare().
diff -Naur tomato/release/src/router/snmp/man/netsnmp_mib_handler_methods.3 tomato121/release/src/router/snmp/man/netsnmp_mib_handler_methods.3
--- tomato/release/src/router/snmp/man/netsnmp_mib_handler_methods.3	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/man/netsnmp_mib_handler_methods.3	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,19 @@
+.TH "mib_handler_methods" 3 "23 Dec 2001" "net-snmp" \" -*- nroff -*-
+.ad l
+.nh
+.SH NAME
+mib_handler_methods \- Defines the subhandlers to be called by the multiplexer helper. 
+.SH SYNOPSIS
+.br
+.PP
+\fC#include <multiplexer.h>\fP
+.PP
+.SH "DETAILED DESCRIPTION"
+.PP 
+Defines the subhandlers to be called by the multiplexer helper.
+.PP
+
+
+.SH "AUTHOR"
+.PP 
+Generated automatically by Doxygen for net-snmp from the source code.
\ No newline at end of file
diff -Naur tomato/release/src/router/snmp/man/netsnmp_mib_utilities.3 tomato121/release/src/router/snmp/man/netsnmp_mib_utilities.3
--- tomato/release/src/router/snmp/man/netsnmp_mib_utilities.3	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/man/netsnmp_mib_utilities.3	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,1288 @@
+.TH "mib parsing and datatype manipulation routines." 3 "5 Sep 2003" "net-snmp" \" -*- nroff -*-
+.ad l
+.nh
+.SH NAME
+mib parsing and datatype manipulation routines. \- 
+.SS "Data Structures"
+
+.in +1c
+.ti -1c
+.RI "struct \fB_PrefixList\fP"
+.br
+.ti -1c
+.RI "struct \fBparse_hints\fP"
+.br
+.in -1c
+.SS "Functions"
+
+.in +1c
+.ti -1c
+.RI "int \fBsprint_realloc_hexstring\fP (u_char **buf, size_t *buf_len, size_t *out_len, int allow_realloc, const u_char *cp, size_t len)"
+.br
+.RI "\fIPrints a hexadecimal string into a buffer.\fP"
+.ti -1c
+.RI "int \fBsprint_realloc_asciistring\fP (u_char **buf, size_t *buf_len, size_t *out_len, int allow_realloc, const u_char *cp, size_t len)"
+.br
+.RI "\fIPrints an ascii string into a buffer.\fP"
+.ti -1c
+.RI "int \fBsprint_realloc_octet_string\fP (u_char **buf, size_t *buf_len, size_t *out_len, int allow_realloc, const netsnmp_variable_list *var, const struct enum_list *enums, const char *hint, const char *units)"
+.br
+.RI "\fIPrints an octet string into a buffer.\fP"
+.ti -1c
+.RI "int \fBsprint_realloc_counter64\fP (u_char **buf, size_t *buf_len, size_t *out_len, int allow_realloc, const netsnmp_variable_list *var, const struct enum_list *enums, const char *hint, const char *units)"
+.br
+.RI "\fIPrints a counter into a buffer.\fP"
+.ti -1c
+.RI "int \fBsprint_realloc_opaque\fP (u_char **buf, size_t *buf_len, size_t *out_len, int allow_realloc, const netsnmp_variable_list *var, const struct enum_list *enums, const char *hint, const char *units)"
+.br
+.RI "\fIPrints an object identifier into a buffer.\fP"
+.ti -1c
+.RI "int \fBsprint_realloc_object_identifier\fP (u_char **buf, size_t *buf_len, size_t *out_len, int allow_realloc, const netsnmp_variable_list *var, const struct enum_list *enums, const char *hint, const char *units)"
+.br
+.RI "\fIPrints an object identifier into a buffer.\fP"
+.ti -1c
+.RI "int \fBsprint_realloc_timeticks\fP (u_char **buf, size_t *buf_len, size_t *out_len, int allow_realloc, const netsnmp_variable_list *var, const struct enum_list *enums, const char *hint, const char *units)"
+.br
+.RI "\fIPrints a timetick variable into a buffer.\fP"
+.ti -1c
+.RI "int \fBsprint_realloc_hinted_integer\fP (u_char **buf, size_t *buf_len, size_t *out_len, int allow_realloc, long val, const char decimaltype, const char *hint, const char *units)"
+.br
+.RI "\fIPrints an integer according to the hint into a buffer.\fP"
+.ti -1c
+.RI "int \fBsprint_realloc_integer\fP (u_char **buf, size_t *buf_len, size_t *out_len, int allow_realloc, const netsnmp_variable_list *var, const struct enum_list *enums, const char *hint, const char *units)"
+.br
+.RI "\fIPrints an integer into a buffer.\fP"
+.ti -1c
+.RI "int \fBsprint_realloc_uinteger\fP (u_char **buf, size_t *buf_len, size_t *out_len, int allow_realloc, const netsnmp_variable_list *var, const struct enum_list *enums, const char *hint, const char *units)"
+.br
+.RI "\fIPrints an unsigned integer into a buffer.\fP"
+.ti -1c
+.RI "int \fBsprint_realloc_gauge\fP (u_char **buf, size_t *buf_len, size_t *out_len, int allow_realloc, const netsnmp_variable_list *var, const struct enum_list *enums, const char *hint, const char *units)"
+.br
+.RI "\fIPrints a gauge value into a buffer.\fP"
+.ti -1c
+.RI "int \fBsprint_realloc_counter\fP (u_char **buf, size_t *buf_len, size_t *out_len, int allow_realloc, const netsnmp_variable_list *var, const struct enum_list *enums, const char *hint, const char *units)"
+.br
+.RI "\fIPrints a counter value into a buffer.\fP"
+.ti -1c
+.RI "int \fBsprint_realloc_networkaddress\fP (u_char **buf, size_t *buf_len, size_t *out_len, int allow_realloc, const netsnmp_variable_list *var, const struct enum_list *enums, const char *hint, const char *units)"
+.br
+.RI "\fIPrints a network address into a buffer.\fP"
+.ti -1c
+.RI "int \fBsprint_realloc_ipaddress\fP (u_char **buf, size_t *buf_len, size_t *out_len, int allow_realloc, const netsnmp_variable_list *var, const struct enum_list *enums, const char *hint, const char *units)"
+.br
+.RI "\fIPrints an ip-address into a buffer.\fP"
+.ti -1c
+.RI "int \fBsprint_realloc_null\fP (u_char **buf, size_t *buf_len, size_t *out_len, int allow_realloc, const netsnmp_variable_list *var, const struct enum_list *enums, const char *hint, const char *units)"
+.br
+.RI "\fIPrints a null value into a buffer.\fP"
+.ti -1c
+.RI "int \fBsprint_realloc_bitstring\fP (u_char **buf, size_t *buf_len, size_t *out_len, int allow_realloc, const netsnmp_variable_list *var, const struct enum_list *enums, const char *hint, const char *units)"
+.br
+.RI "\fIPrints a bit string into a buffer.\fP"
+.ti -1c
+.RI "int \fBsprint_realloc_badtype\fP (u_char **buf, size_t *buf_len, size_t *out_len, int allow_realloc, const netsnmp_variable_list *var, const struct enum_list *enums, const char *hint, const char *units)"
+.br
+.RI "\fIFallback routine for a bad type, prints 'Variable has bad type' into a buffer.\fP"
+.ti -1c
+.RI "int \fBsprint_realloc_by_type\fP (u_char **buf, size_t *buf_len, size_t *out_len, int allow_realloc, const netsnmp_variable_list *var, const struct enum_list *enums, const char *hint, const char *units)"
+.br
+.RI "\fIUniversal print routine, prints a variable into a buffer according to the variable type.\fP"
+.ti -1c
+.RI "tree * \fBget_tree_head\fP (void)"
+.br
+.RI "\fIRetrieves the tree head.\fP"
+.ti -1c
+.RI "void \fBsnmp_in_toggle_options_usage\fP (const char *lead, FILE *outf)"
+.br
+.RI "\fIPrints out a help usage for the in* toggle options.\fP"
+.ti -1c
+.RI "char * \fBnetsnmp_get_mib_directory\fP (void)"
+.br
+.RI "\fIset_string calls strdup, so if we allocated memory, free it\fP"
+.ti -1c
+.RI "void \fBnetsnmp_fixup_mib_directory\fP (void)"
+.br
+.RI "\fINot set use hard coded path.\fP"
+.ti -1c
+.RI "void \fBinit_mib\fP (void)"
+.br
+.RI "\fIInitialises the mib reader.\fP"
+.ti -1c
+.RI "void \fBshutdown_mib\fP (void)"
+.br
+.RI "\fIUnloads all mibs.\fP"
+.ti -1c
+.RI "void \fBprint_mib\fP (FILE *fp)"
+.br
+.RI "\fIPrints the MIBs to the file fp.\fP"
+.ti -1c
+.RI "void \fBset_function\fP (struct tree *subtree)"
+.br
+.RI "\fISet's the printing function printomat in a subtree according it's type.\fP"
+.ti -1c
+.RI "int \fBread_objid\fP (const char *input, oid *output, size_t *out_len)"
+.br
+.RI "\fIReads an object identifier from an input string into internal OID form.\fP"
+.ti -1c
+.RI "void \fBprint_objid\fP (const oid *objid, size_t objidlen)"
+.br
+.RI "\fIPrints an oid to stdout.\fP"
+.ti -1c
+.RI "void \fBfprint_objid\fP (FILE *f, const oid *objid, size_t objidlen)"
+.br
+.RI "\fIPrints an oid to a file descriptor.\fP"
+.ti -1c
+.RI "void \fBprint_variable\fP (const oid *objid, size_t objidlen, const netsnmp_variable_list *variable)"
+.br
+.RI "\fIPrints a variable to stdout.\fP"
+.ti -1c
+.RI "void \fBfprint_variable\fP (FILE *f, const oid *objid, size_t objidlen, const netsnmp_variable_list *variable)"
+.br
+.RI "\fIPrints a variable to a file descriptor.\fP"
+.ti -1c
+.RI "int \fBbuild_oid_segment\fP (netsnmp_variable_list *var)"
+.br
+.RI "\fITakes the value in VAR and turns it into an OID segment in var->name.\fP"
+.ti -1c
+.RI "tree * \fBget_tree\fP (const oid *objid, size_t objidlen, struct tree *subtree)"
+.br
+.RI "\fIClone of get_symbol that doesn't take a buffer argument.\fP"
+.ti -1c
+.RI "void \fBprint_description\fP (oid *objid, size_t objidlen, int width)"
+.br
+.RI "\fIPrints on oid description on stdout.\fP"
+.ti -1c
+.RI "void \fBfprint_description\fP (FILE *f, oid *objid, size_t objidlen, int width)"
+.br
+.RI "\fIPrints on oid description into a file descriptor.\fP"
+.ti -1c
+.RI "int \fBget_wild_node\fP (const char *name, oid *objid, size_t *objidlen)"
+.br
+.ti -1c
+.RI "char * \fBuptime_string\fP (u_long timeticks, char *buf)"
+.br
+.RI "\fIConverts timeticks to hours, minutes, seconds string.\fP"
+.ti -1c
+.RI "int \fBnetsnmp_str2oid\fP (const char *S, oid *O, int L)"
+.br
+.RI "\fIConverts a string to its OID form.\fP"
+.ti -1c
+.RI "int \fBnetsnmp_oid2chars\fP (char *C, int L, const oid *O)"
+.br
+.RI "\fIConverts an OID to its character form.\fP"
+.ti -1c
+.RI "int \fBnetsnmp_oid2str\fP (char *S, int L, oid *O)"
+.br
+.RI "\fIConverts an OID to its string form.\fP"
+.in -1c
+.SH "FUNCTION DOCUMENTATION"
+.PP 
+.SS "int build_oid_segment (netsnmp_variable_list * var)"
+.PP
+Takes the value in VAR and turns it into an OID segment in var->name.
+.PP
+\fBParameters: \fP
+.in +1c
+.TP
+\fB\fIvar\fP\fP
+The variable.
+.PP
+\fBReturns: \fP
+.in +1c
+SNMPERR_SUCCESS or SNMPERR_GENERR 
+.PP
+Definition at line 3234 of file mib.c.
+.SS "void fprint_description (FILE * f, oid * objid, size_t objidlen, int width)"
+.PP
+Prints on oid description into a file descriptor.
+.PP
+\fBParameters: \fP
+.in +1c
+.TP
+\fB\fIf\fP\fP
+The file descriptor to print to. 
+.TP
+\fB\fIobjid\fP\fP
+The object identifier. 
+.TP
+\fB\fIobjidlen\fP\fP
+The object id length. 
+.TP
+\fB\fIwidth\fP\fP
+Number of subidentifiers. 
+.PP
+Definition at line 4087 of file mib.c.
+.PP
+References get_tree().
+.PP
+Referenced by print_description().
+.SS "void fprint_objid (FILE * f, const oid * objid, size_t objidlen)"
+.PP
+Prints an oid to a file descriptor.
+.PP
+\fBParameters: \fP
+.in +1c
+.TP
+\fB\fIf\fP\fP
+The file descriptor to print to. 
+.TP
+\fB\fIobjid\fP\fP
+The oid to print 
+.TP
+\fB\fIobjidlen\fP\fP
+The length of oidid. 
+.PP
+Definition at line 2975 of file mib.c.
+.PP
+Referenced by print_objid().
+.SS "void fprint_variable (FILE * f, const oid * objid, size_t objidlen, const netsnmp_variable_list * variable)"
+.PP
+Prints a variable to a file descriptor.
+.PP
+\fBParameters: \fP
+.in +1c
+.TP
+\fB\fIf\fP\fP
+The file descriptor to print to. 
+.TP
+\fB\fIobjid\fP\fP
+The object id. 
+.TP
+\fB\fIobjidlen\fP\fP
+The length of teh object id. 
+.TP
+\fB\fIvariable\fP\fP
+The variable to print. 
+.PP
+Definition at line 3117 of file mib.c.
+.PP
+Referenced by print_variable().
+.SS "struct tree* get_tree (const oid * objid, size_t objidlen, struct tree * subtree)"
+.PP
+Clone of get_symbol that doesn't take a buffer argument.
+.PP
+\fBSee also: \fP
+.in +1c
+get_symbol 
+.PP
+Definition at line 4042 of file mib.c.
+.PP
+Referenced by fprint_description().
+.SS "struct tree* get_tree_head (void)"
+.PP
+Retrieves the tree head.
+.PP
+\fBReturns: \fP
+.in +1c
+the tree head. 
+.PP
+Definition at line 2029 of file mib.c.
+.PP
+References get_tree_head().
+.PP
+Referenced by get_tree_head().
+.SS "int get_wild_node (const char * name, oid * objid, size_t * objidlen)"
+.PP
+\fBSee also: \fP
+.in +1c
+comments on find_best_tree_node for usage after first time. 
+.PP
+Definition at line 4951 of file mib.c.
+.SS "void init_mib (void)"
+.PP
+Initialises the mib reader.
+.PP
+Reads in all settings from the environment. 
+.PP
+Definition at line 2464 of file mib.c.
+.PP
+References netsnmp_fixup_mib_directory(), and netsnmp_get_mib_directory().
+.SS "void netsnmp_fixup_mib_directory (void)"
+.PP
+Not set use hard coded path.
+.PP
+Definition at line 2418 of file mib.c.
+.PP
+References netsnmp_get_mib_directory().
+.PP
+Referenced by init_mib().
+.SS "char* netsnmp_get_mib_directory (void)"
+.PP
+set_string calls strdup, so if we allocated memory, free it
+.PP
+Definition at line 2371 of file mib.c.
+.PP
+Referenced by init_mib(), and netsnmp_fixup_mib_directory().
+.SS "int netsnmp_oid2chars (char * C, int L, const oid * O)"
+.PP
+Converts an OID to its character form.
+.PP
+in example 5 . 1 . 2 . 3 . 4 . 5 = 12345
+.PP
+\fBParameters: \fP
+.in +1c
+.TP
+\fB\fIC\fP\fP
+The character buffer. 
+.TP
+\fB\fIL\fP\fP
+The length of the buffer. 
+.TP
+\fB\fIO\fP\fP
+The oid.
+.PP
+\fBReturns: \fP
+.in +1c
+0 on Sucess, 1 on failure. 
+.PP
+Definition at line 5645 of file mib.c.
+.PP
+Referenced by netsnmp_oid2str().
+.SS "int netsnmp_oid2str (char * S, int L, oid * O)"
+.PP
+Converts an OID to its string form.
+.PP
+in example 5 . 'h' . 'e' . 'l' . 'l' . 'o' = 'hello\\0' (null terminated)
+.PP
+\fBParameters: \fP
+.in +1c
+.TP
+\fB\fIS\fP\fP
+The character string buffer. 
+.TP
+\fB\fIL\fP\fP
+The length of the string buffer. 
+.TP
+\fB\fIO\fP\fP
+The oid.
+.PP
+\fBReturns: \fP
+.in +1c
+0 on Sucess, 1 on failure. 
+.PP
+Definition at line 5673 of file mib.c.
+.PP
+References netsnmp_oid2chars().
+.SS "int netsnmp_str2oid (const char * S, oid * O, int L)"
+.PP
+Converts a string to its OID form.
+.PP
+in example 'hello' = 5 . 'h' . 'e' . 'l' . 'l' . 'o'
+.PP
+\fBParameters: \fP
+.in +1c
+.TP
+\fB\fIS\fP\fP
+The string. 
+.TP
+\fB\fIO\fP\fP
+The oid. 
+.TP
+\fB\fIL\fP\fP
+The length of the oid.
+.PP
+\fBReturns: \fP
+.in +1c
+0 on Sucess, 1 on failure. 
+.PP
+Definition at line 5610 of file mib.c.
+.SS "void print_description (oid * objid, size_t objidlen, int width)"
+.PP
+Prints on oid description on stdout.
+.PP
+\fBSee also: \fP
+.in +1c
+\fBfprint_description\fP 
+.PP
+Definition at line 4071 of file mib.c.
+.PP
+References fprint_description().
+.SS "void print_mib (FILE * fp)"
+.PP
+Prints the MIBs to the file fp.
+.PP
+\fBParameters: \fP
+.in +1c
+.TP
+\fB\fIfp\fP\fP
+The file descriptor to print to. 
+.PP
+Definition at line 2644 of file mib.c.
+.SS "void print_objid (const oid * objid, size_t objidlen)"
+.PP
+Prints an oid to stdout.
+.PP
+\fBParameters: \fP
+.in +1c
+.TP
+\fB\fIobjid\fP\fP
+The oid to print 
+.TP
+\fB\fIobjidlen\fP\fP
+The length of oidid. 
+.PP
+Definition at line 2961 of file mib.c.
+.PP
+References fprint_objid().
+.SS "void print_variable (const oid * objid, size_t objidlen, const netsnmp_variable_list * variable)"
+.PP
+Prints a variable to stdout.
+.PP
+\fBParameters: \fP
+.in +1c
+.TP
+\fB\fIobjid\fP\fP
+The object id. 
+.TP
+\fB\fIobjidlen\fP\fP
+The length of teh object id. 
+.TP
+\fB\fIvariable\fP\fP
+The variable to print. 
+.PP
+Definition at line 3101 of file mib.c.
+.PP
+References fprint_variable().
+.SS "int read_objid (const char * input, oid * output, size_t * out_len)"
+.PP
+Reads an object identifier from an input string into internal OID form.
+.PP
+When called, out_len must hold the maximum length of the output array.
+.PP
+\fBParameters: \fP
+.in +1c
+.TP
+\fB\fIinput\fP\fP
+the input string. 
+.TP
+\fB\fIoutput\fP\fP
+the oid wirte. 
+.TP
+\fB\fIout_len\fP\fP
+number of subid's in output.
+.PP
+\fBReturns: \fP
+.in +1c
+1 if successful.If an error occurs, this function returns 0 and MAY set snmp_errno. snmp_errno is NOT set if SET_SNMP_ERROR evaluates to nothing. This can make multi-threaded use a tiny bit more robust. 
+.PP
+Definition at line 2740 of file mib.c.
+.SS "void set_function (struct tree * subtree)"
+.PP
+Set's the printing function printomat in a subtree according it's type.
+.PP
+\fBParameters: \fP
+.in +1c
+.TP
+\fB\fIsubtree\fP\fP
+The subtree to set. 
+.PP
+Definition at line 2665 of file mib.c.
+.PP
+References sprint_realloc_bitstring(), sprint_realloc_by_type(), sprint_realloc_counter(), sprint_realloc_counter64(), sprint_realloc_gauge(), sprint_realloc_integer(), sprint_realloc_ipaddress(), sprint_realloc_networkaddress(), sprint_realloc_null(), sprint_realloc_object_identifier(), sprint_realloc_octet_string(), sprint_realloc_opaque(), sprint_realloc_timeticks(), and sprint_realloc_uinteger().
+.SS "void shutdown_mib (void)"
+.PP
+Unloads all mibs.
+.PP
+Definition at line 2621 of file mib.c.
+.SS "void snmp_in_toggle_options_usage (const char * lead, FILE * outf)"
+.PP
+Prints out a help usage for the in* toggle options.
+.PP
+\fBParameters: \fP
+.in +1c
+.TP
+\fB\fIlead\fP\fP
+The lead to print for every line. 
+.TP
+\fB\fIoutf\fP\fP
+The file descriptor to write to. 
+.PP
+Definition at line 2237 of file mib.c.
+.SS "int sprint_realloc_asciistring (u_char ** buf, size_t * buf_len, size_t * out_len, int allow_realloc, const u_char * cp, size_t len)"
+.PP
+Prints an ascii string into a buffer.
+.PP
+The characters pointed by *cp are encoded as an ascii string.
+.PP
+If allow_realloc is true the buffer will be (re)allocated to fit in the  needed size. (Note: *buf may change due to this.)
+.PP
+\fBParameters: \fP
+.in +1c
+.TP
+\fB\fIbuf\fP\fP
+address of the buffer to print to. 
+.TP
+\fB\fIbuf_len\fP\fP
+address to an integer containing the size of buf. 
+.TP
+\fB\fIout_len\fP\fP
+incremented by the number of characters printed. 
+.TP
+\fB\fIallow_realloc\fP\fP
+if not zero reallocate the buffer to fit the  needed size. 
+.TP
+\fB\fIcp\fP\fP
+the array of characters to encode. 
+.TP
+\fB\fIlen\fP\fP
+the array length of cp.
+.PP
+\fBReturns: \fP
+.in +1c
+1 on success, or 0 on failure (out of memory, or buffer to small when not allowed to realloc.) 
+.PP
+Definition at line 351 of file mib.c.
+.PP
+Referenced by sprint_realloc_octet_string().
+.SS "int sprint_realloc_badtype (u_char ** buf, size_t * buf_len, size_t * out_len, int allow_realloc, const netsnmp_variable_list * var, const struct enum_list * enums, const char * hint, const char * units)"
+.PP
+Fallback routine for a bad type, prints 'Variable has bad type' into a buffer.
+.PP
+If allow_realloc is true the buffer will be (re)allocated to fit in the  needed size. (Note: *buf may change due to this.)
+.PP
+\fBParameters: \fP
+.in +1c
+.TP
+\fB\fIbuf\fP\fP
+Address of the buffer to print to. 
+.TP
+\fB\fIbuf_len\fP\fP
+Address to an integer containing the size of buf. 
+.TP
+\fB\fIout_len\fP\fP
+Incremented by the number of characters printed. 
+.TP
+\fB\fIallow_realloc\fP\fP
+if not zero reallocate the buffer to fit the  needed size. 
+.TP
+\fB\fIvar\fP\fP
+The variable to encode. 
+.TP
+\fB\fIenums\fP\fP
+The enumeration ff this variable is enumerated. may be NULL. 
+.TP
+\fB\fIhint\fP\fP
+Contents of the DISPLAY-HINT clause of the MIB. See RFC 1903 Section 3.1 for details. may be NULL. 
+.TP
+\fB\fIunits\fP\fP
+Contents of the UNITS clause of the MIB. may be NULL.
+.PP
+\fBReturns: \fP
+.in +1c
+1 on success, or 0 on failure (out of memory, or buffer to small when not allowed to realloc.) 
+.PP
+Definition at line 1915 of file mib.c.
+.PP
+Referenced by sprint_realloc_by_type().
+.SS "int sprint_realloc_bitstring (u_char ** buf, size_t * buf_len, size_t * out_len, int allow_realloc, const netsnmp_variable_list * var, const struct enum_list * enums, const char * hint, const char * units)"
+.PP
+Prints a bit string into a buffer.
+.PP
+If allow_realloc is true the buffer will be (re)allocated to fit in the  needed size. (Note: *buf may change due to this.)
+.PP
+\fBParameters: \fP
+.in +1c
+.TP
+\fB\fIbuf\fP\fP
+Address of the buffer to print to. 
+.TP
+\fB\fIbuf_len\fP\fP
+Address to an integer containing the size of buf. 
+.TP
+\fB\fIout_len\fP\fP
+Incremented by the number of characters printed. 
+.TP
+\fB\fIallow_realloc\fP\fP
+if not zero reallocate the buffer to fit the  needed size. 
+.TP
+\fB\fIvar\fP\fP
+The variable to encode. 
+.TP
+\fB\fIenums\fP\fP
+The enumeration ff this variable is enumerated. may be NULL. 
+.TP
+\fB\fIhint\fP\fP
+Contents of the DISPLAY-HINT clause of the MIB. See RFC 1903 Section 3.1 for details. may be NULL. 
+.TP
+\fB\fIunits\fP\fP
+Contents of the UNITS clause of the MIB. may be NULL.
+.PP
+\fBReturns: \fP
+.in +1c
+1 on success, or 0 on failure (out of memory, or buffer to small when not allowed to realloc.) 
+.PP
+Definition at line 1776 of file mib.c.
+.PP
+References sprint_realloc_by_type(), and sprint_realloc_hexstring().
+.PP
+Referenced by set_function(), and sprint_realloc_by_type().
+.SS "int sprint_realloc_by_type (u_char ** buf, size_t * buf_len, size_t * out_len, int allow_realloc, const netsnmp_variable_list * var, const struct enum_list * enums, const char * hint, const char * units)"
+.PP
+Universal print routine, prints a variable into a buffer according to the variable type.
+.PP
+If allow_realloc is true the buffer will be (re)allocated to fit in the  needed size. (Note: *buf may change due to this.)
+.PP
+\fBParameters: \fP
+.in +1c
+.TP
+\fB\fIbuf\fP\fP
+Address of the buffer to print to. 
+.TP
+\fB\fIbuf_len\fP\fP
+Address to an integer containing the size of buf. 
+.TP
+\fB\fIout_len\fP\fP
+Incremented by the number of characters printed. 
+.TP
+\fB\fIallow_realloc\fP\fP
+if not zero reallocate the buffer to fit the  needed size. 
+.TP
+\fB\fIvar\fP\fP
+The variable to encode. 
+.TP
+\fB\fIenums\fP\fP
+The enumeration ff this variable is enumerated. may be NULL. 
+.TP
+\fB\fIhint\fP\fP
+Contents of the DISPLAY-HINT clause of the MIB. See RFC 1903 Section 3.1 for details. may be NULL. 
+.TP
+\fB\fIunits\fP\fP
+Contents of the UNITS clause of the MIB. may be NULL.
+.PP
+\fBReturns: \fP
+.in +1c
+1 on success, or 0 on failure (out of memory, or buffer to small when not allowed to realloc.) 
+.PP
+Definition at line 1950 of file mib.c.
+.PP
+References sprint_realloc_badtype(), sprint_realloc_bitstring(), sprint_realloc_counter(), sprint_realloc_counter64(), sprint_realloc_gauge(), sprint_realloc_integer(), sprint_realloc_ipaddress(), sprint_realloc_null(), sprint_realloc_object_identifier(), sprint_realloc_octet_string(), sprint_realloc_opaque(), sprint_realloc_timeticks(), and sprint_realloc_uinteger().
+.PP
+Referenced by set_function(), sprint_realloc_bitstring(), sprint_realloc_counter(), sprint_realloc_counter64(), sprint_realloc_gauge(), sprint_realloc_integer(), sprint_realloc_ipaddress(), sprint_realloc_networkaddress(), sprint_realloc_null(), sprint_realloc_object_identifier(), sprint_realloc_octet_string(), sprint_realloc_opaque(), sprint_realloc_timeticks(), sprint_realloc_uinteger(), and table_helper_handler().
+.SS "int sprint_realloc_counter (u_char ** buf, size_t * buf_len, size_t * out_len, int allow_realloc, const netsnmp_variable_list * var, const struct enum_list * enums, const char * hint, const char * units)"
+.PP
+Prints a counter value into a buffer.
+.PP
+If allow_realloc is true the buffer will be (re)allocated to fit in the  needed size. (Note: *buf may change due to this.)
+.PP
+\fBParameters: \fP
+.in +1c
+.TP
+\fB\fIbuf\fP\fP
+Address of the buffer to print to. 
+.TP
+\fB\fIbuf_len\fP\fP
+Address to an integer containing the size of buf. 
+.TP
+\fB\fIout_len\fP\fP
+Incremented by the number of characters printed. 
+.TP
+\fB\fIallow_realloc\fP\fP
+if not zero reallocate the buffer to fit the  needed size. 
+.TP
+\fB\fIvar\fP\fP
+The variable to encode. 
+.TP
+\fB\fIenums\fP\fP
+The enumeration ff this variable is enumerated. may be NULL. 
+.TP
+\fB\fIhint\fP\fP
+Contents of the DISPLAY-HINT clause of the MIB. See RFC 1903 Section 3.1 for details. may be NULL. 
+.TP
+\fB\fIunits\fP\fP
+Contents of the UNITS clause of the MIB. may be NULL.
+.PP
+\fBReturns: \fP
+.in +1c
+1 on success, or 0 on failure (out of memory, or buffer to small when not allowed to realloc.) 
+.PP
+Definition at line 1544 of file mib.c.
+.PP
+References sprint_realloc_by_type().
+.PP
+Referenced by set_function(), and sprint_realloc_by_type().
+.SS "int sprint_realloc_counter64 (u_char ** buf, size_t * buf_len, size_t * out_len, int allow_realloc, const netsnmp_variable_list * var, const struct enum_list * enums, const char * hint, const char * units)"
+.PP
+Prints a counter into a buffer.
+.PP
+The variable var is encoded as a counter value.
+.PP
+If allow_realloc is true the buffer will be (re)allocated to fit in the  needed size. (Note: *buf may change due to this.)
+.PP
+\fBParameters: \fP
+.in +1c
+.TP
+\fB\fIbuf\fP\fP
+Address of the buffer to print to. 
+.TP
+\fB\fIbuf_len\fP\fP
+Address to an integer containing the size of buf. 
+.TP
+\fB\fIout_len\fP\fP
+Incremented by the number of characters printed. 
+.TP
+\fB\fIallow_realloc\fP\fP
+if not zero reallocate the buffer to fit the  needed size. 
+.TP
+\fB\fIvar\fP\fP
+The variable to encode. 
+.TP
+\fB\fIenums\fP\fP
+The enumeration ff this variable is enumerated. may be NULL. 
+.TP
+\fB\fIhint\fP\fP
+Contents of the DISPLAY-HINT clause of the MIB. See RFC 1903 Section 3.1 for details. may be NULL. 
+.TP
+\fB\fIunits\fP\fP
+Contents of the UNITS clause of the MIB. may be NULL.
+.PP
+\fBReturns: \fP
+.in +1c
+1 on success, or 0 on failure (out of memory, or buffer to small when not allowed to realloc.) 
+.PP
+Definition at line 849 of file mib.c.
+.PP
+References sprint_realloc_by_type().
+.PP
+Referenced by set_function(), sprint_realloc_by_type(), and sprint_realloc_opaque().
+.SS "int sprint_realloc_gauge (u_char ** buf, size_t * buf_len, size_t * out_len, int allow_realloc, const netsnmp_variable_list * var, const struct enum_list * enums, const char * hint, const char * units)"
+.PP
+Prints a gauge value into a buffer.
+.PP
+If allow_realloc is true the buffer will be (re)allocated to fit in the  needed size. (Note: *buf may change due to this.)
+.PP
+\fBParameters: \fP
+.in +1c
+.TP
+\fB\fIbuf\fP\fP
+Address of the buffer to print to. 
+.TP
+\fB\fIbuf_len\fP\fP
+Address to an integer containing the size of buf. 
+.TP
+\fB\fIout_len\fP\fP
+Incremented by the number of characters printed. 
+.TP
+\fB\fIallow_realloc\fP\fP
+if not zero reallocate the buffer to fit the  needed size. 
+.TP
+\fB\fIvar\fP\fP
+The variable to encode. 
+.TP
+\fB\fIenums\fP\fP
+The enumeration ff this variable is enumerated. may be NULL. 
+.TP
+\fB\fIhint\fP\fP
+Contents of the DISPLAY-HINT clause of the MIB. See RFC 1903 Section 3.1 for details. may be NULL. 
+.TP
+\fB\fIunits\fP\fP
+Contents of the UNITS clause of the MIB. may be NULL.
+.PP
+\fBReturns: \fP
+.in +1c
+1 on success, or 0 on failure (out of memory, or buffer to small when not allowed to realloc.) 
+.PP
+Definition at line 1471 of file mib.c.
+.PP
+References sprint_realloc_by_type(), and sprint_realloc_hinted_integer().
+.PP
+Referenced by set_function(), and sprint_realloc_by_type().
+.SS "int sprint_realloc_hexstring (u_char ** buf, size_t * buf_len, size_t * out_len, int allow_realloc, const u_char * cp, size_t len)"
+.PP
+Prints a hexadecimal string into a buffer.
+.PP
+The characters pointed by *cp are encoded as hexadecimal string.
+.PP
+If allow_realloc is true the buffer will be (re)allocated to fit in the  needed size. (Note: *buf may change due to this.)
+.PP
+\fBParameters: \fP
+.in +1c
+.TP
+\fB\fIbuf\fP\fP
+address of the buffer to print to. 
+.TP
+\fB\fIbuf_len\fP\fP
+address to an integer containing the size of buf. 
+.TP
+\fB\fIout_len\fP\fP
+incremented by the number of characters printed. 
+.TP
+\fB\fIallow_realloc\fP\fP
+if not zero reallocate the buffer to fit the  needed size. 
+.TP
+\fB\fIcp\fP\fP
+the array of characters to encode. 
+.TP
+\fB\fIlen\fP\fP
+the array length of cp.
+.PP
+\fBReturns: \fP
+.in +1c
+1 on success, or 0 on failure (out of memory, or buffer to small when not allowed to realloc.) 
+.PP
+Definition at line 249 of file mib.c.
+.PP
+Referenced by sprint_realloc_bitstring(), sprint_realloc_octet_string(), and sprint_realloc_opaque().
+.SS "int sprint_realloc_hinted_integer (u_char ** buf, size_t * buf_len, size_t * out_len, int allow_realloc, long val, const char decimaltype, const char * hint, const char * units)"
+.PP
+Prints an integer according to the hint into a buffer.
+.PP
+If allow_realloc is true the buffer will be (re)allocated to fit in the  needed size. (Note: *buf may change due to this.)
+.PP
+\fBParameters: \fP
+.in +1c
+.TP
+\fB\fIbuf\fP\fP
+Address of the buffer to print to. 
+.TP
+\fB\fIbuf_len\fP\fP
+Address to an integer containing the size of buf. 
+.TP
+\fB\fIout_len\fP\fP
+Incremented by the number of characters printed. 
+.TP
+\fB\fIallow_realloc\fP\fP
+if not zero reallocate the buffer to fit the  needed size. 
+.TP
+\fB\fIvar\fP\fP
+The variable to encode. 
+.TP
+\fB\fIenums\fP\fP
+The enumeration ff this variable is enumerated. may be NULL. 
+.TP
+\fB\fIhint\fP\fP
+Contents of the DISPLAY-HINT clause of the MIB. See RFC 1903 Section 3.1 for details. may _NOT_ be NULL. 
+.TP
+\fB\fIunits\fP\fP
+Contents of the UNITS clause of the MIB. may be NULL.
+.PP
+\fBReturns: \fP
+.in +1c
+1 on success, or 0 on failure (out of memory, or buffer to small when not allowed to realloc.) 
+.PP
+Definition at line 1197 of file mib.c.
+.PP
+Referenced by sprint_realloc_gauge(), sprint_realloc_integer(), and sprint_realloc_uinteger().
+.SS "int sprint_realloc_integer (u_char ** buf, size_t * buf_len, size_t * out_len, int allow_realloc, const netsnmp_variable_list * var, const struct enum_list * enums, const char * hint, const char * units)"
+.PP
+Prints an integer into a buffer.
+.PP
+If allow_realloc is true the buffer will be (re)allocated to fit in the  needed size. (Note: *buf may change due to this.)
+.PP
+\fBParameters: \fP
+.in +1c
+.TP
+\fB\fIbuf\fP\fP
+Address of the buffer to print to. 
+.TP
+\fB\fIbuf_len\fP\fP
+Address to an integer containing the size of buf. 
+.TP
+\fB\fIout_len\fP\fP
+Incremented by the number of characters printed. 
+.TP
+\fB\fIallow_realloc\fP\fP
+if not zero reallocate the buffer to fit the  needed size. 
+.TP
+\fB\fIvar\fP\fP
+The variable to encode. 
+.TP
+\fB\fIenums\fP\fP
+The enumeration ff this variable is enumerated. may be NULL. 
+.TP
+\fB\fIhint\fP\fP
+Contents of the DISPLAY-HINT clause of the MIB. See RFC 1903 Section 3.1 for details. may be NULL. 
+.TP
+\fB\fIunits\fP\fP
+Contents of the UNITS clause of the MIB. may be NULL.
+.PP
+\fBReturns: \fP
+.in +1c
+1 on success, or 0 on failure (out of memory, or buffer to small when not allowed to realloc.) 
+.PP
+Definition at line 1271 of file mib.c.
+.PP
+References sprint_realloc_by_type(), and sprint_realloc_hinted_integer().
+.PP
+Referenced by set_function(), and sprint_realloc_by_type().
+.SS "int sprint_realloc_ipaddress (u_char ** buf, size_t * buf_len, size_t * out_len, int allow_realloc, const netsnmp_variable_list * var, const struct enum_list * enums, const char * hint, const char * units)"
+.PP
+Prints an ip-address into a buffer.
+.PP
+If allow_realloc is true the buffer will be (re)allocated to fit in the  needed size. (Note: *buf may change due to this.)
+.PP
+\fBParameters: \fP
+.in +1c
+.TP
+\fB\fIbuf\fP\fP
+Address of the buffer to print to. 
+.TP
+\fB\fIbuf_len\fP\fP
+Address to an integer containing the size of buf. 
+.TP
+\fB\fIout_len\fP\fP
+Incremented by the number of characters printed. 
+.TP
+\fB\fIallow_realloc\fP\fP
+if not zero reallocate the buffer to fit the  needed size. 
+.TP
+\fB\fIvar\fP\fP
+The variable to encode. 
+.TP
+\fB\fIenums\fP\fP
+The enumeration ff this variable is enumerated. may be NULL. 
+.TP
+\fB\fIhint\fP\fP
+Contents of the DISPLAY-HINT clause of the MIB. See RFC 1903 Section 3.1 for details. may be NULL. 
+.TP
+\fB\fIunits\fP\fP
+Contents of the UNITS clause of the MIB. may be NULL.
+.PP
+\fBReturns: \fP
+.in +1c
+1 on success, or 0 on failure (out of memory, or buffer to small when not allowed to realloc.) 
+.PP
+Definition at line 1673 of file mib.c.
+.PP
+References sprint_realloc_by_type().
+.PP
+Referenced by set_function(), and sprint_realloc_by_type().
+.SS "int sprint_realloc_networkaddress (u_char ** buf, size_t * buf_len, size_t * out_len, int allow_realloc, const netsnmp_variable_list * var, const struct enum_list * enums, const char * hint, const char * units)"
+.PP
+Prints a network address into a buffer.
+.PP
+If allow_realloc is true the buffer will be (re)allocated to fit in the  needed size. (Note: *buf may change due to this.)
+.PP
+\fBParameters: \fP
+.in +1c
+.TP
+\fB\fIbuf\fP\fP
+Address of the buffer to print to. 
+.TP
+\fB\fIbuf_len\fP\fP
+Address to an integer containing the size of buf. 
+.TP
+\fB\fIout_len\fP\fP
+Incremented by the number of characters printed. 
+.TP
+\fB\fIallow_realloc\fP\fP
+if not zero reallocate the buffer to fit the  needed size. 
+.TP
+\fB\fIvar\fP\fP
+The variable to encode. 
+.TP
+\fB\fIenums\fP\fP
+The enumeration ff this variable is enumerated. may be NULL. 
+.TP
+\fB\fIhint\fP\fP
+Contents of the DISPLAY-HINT clause of the MIB. See RFC 1903 Section 3.1 for details. may be NULL. 
+.TP
+\fB\fIunits\fP\fP
+Contents of the UNITS clause of the MIB. may be NULL.
+.PP
+\fBReturns: \fP
+.in +1c
+1 on success, or 0 on failure (out of memory, or buffer to small when not allowed to realloc.) 
+.PP
+Definition at line 1607 of file mib.c.
+.PP
+References sprint_realloc_by_type().
+.PP
+Referenced by set_function().
+.SS "int sprint_realloc_null (u_char ** buf, size_t * buf_len, size_t * out_len, int allow_realloc, const netsnmp_variable_list * var, const struct enum_list * enums, const char * hint, const char * units)"
+.PP
+Prints a null value into a buffer.
+.PP
+If allow_realloc is true the buffer will be (re)allocated to fit in the  needed size. (Note: *buf may change due to this.)
+.PP
+\fBParameters: \fP
+.in +1c
+.TP
+\fB\fIbuf\fP\fP
+Address of the buffer to print to. 
+.TP
+\fB\fIbuf_len\fP\fP
+Address to an integer containing the size of buf. 
+.TP
+\fB\fIout_len\fP\fP
+Incremented by the number of characters printed. 
+.TP
+\fB\fIallow_realloc\fP\fP
+if not zero reallocate the buffer to fit the  needed size. 
+.TP
+\fB\fIvar\fP\fP
+The variable to encode. 
+.TP
+\fB\fIenums\fP\fP
+The enumeration ff this variable is enumerated. may be NULL. 
+.TP
+\fB\fIhint\fP\fP
+Contents of the DISPLAY-HINT clause of the MIB. See RFC 1903 Section 3.1 for details. may be NULL. 
+.TP
+\fB\fIunits\fP\fP
+Contents of the UNITS clause of the MIB. may be NULL.
+.PP
+\fBReturns: \fP
+.in +1c
+1 on success, or 0 on failure (out of memory, or buffer to small when not allowed to realloc.) 
+.PP
+Definition at line 1732 of file mib.c.
+.PP
+References sprint_realloc_by_type().
+.PP
+Referenced by set_function(), and sprint_realloc_by_type().
+.SS "int sprint_realloc_object_identifier (u_char ** buf, size_t * buf_len, size_t * out_len, int allow_realloc, const netsnmp_variable_list * var, const struct enum_list * enums, const char * hint, const char * units)"
+.PP
+Prints an object identifier into a buffer.
+.PP
+If allow_realloc is true the buffer will be (re)allocated to fit in the  needed size. (Note: *buf may change due to this.)
+.PP
+\fBParameters: \fP
+.in +1c
+.TP
+\fB\fIbuf\fP\fP
+Address of the buffer to print to. 
+.TP
+\fB\fIbuf_len\fP\fP
+Address to an integer containing the size of buf. 
+.TP
+\fB\fIout_len\fP\fP
+Incremented by the number of characters printed. 
+.TP
+\fB\fIallow_realloc\fP\fP
+if not zero reallocate the buffer to fit the  needed size. 
+.TP
+\fB\fIvar\fP\fP
+The variable to encode. 
+.TP
+\fB\fIenums\fP\fP
+The enumeration ff this variable is enumerated. may be NULL. 
+.TP
+\fB\fIhint\fP\fP
+Contents of the DISPLAY-HINT clause of the MIB. See RFC 1903 Section 3.1 for details. may be NULL. 
+.TP
+\fB\fIunits\fP\fP
+Contents of the UNITS clause of the MIB. may be NULL.
+.PP
+\fBReturns: \fP
+.in +1c
+1 on success, or 0 on failure (out of memory, or buffer to small when not allowed to realloc.) 
+.PP
+Definition at line 1053 of file mib.c.
+.PP
+References sprint_realloc_by_type().
+.PP
+Referenced by set_function(), and sprint_realloc_by_type().
+.SS "int sprint_realloc_octet_string (u_char ** buf, size_t * buf_len, size_t * out_len, int allow_realloc, const netsnmp_variable_list * var, const struct enum_list * enums, const char * hint, const char * units)"
+.PP
+Prints an octet string into a buffer.
+.PP
+The variable var is encoded as octet string.
+.PP
+If allow_realloc is true the buffer will be (re)allocated to fit in the  needed size. (Note: *buf may change due to this.)
+.PP
+\fBParameters: \fP
+.in +1c
+.TP
+\fB\fIbuf\fP\fP
+Address of the buffer to print to. 
+.TP
+\fB\fIbuf_len\fP\fP
+Address to an integer containing the size of buf. 
+.TP
+\fB\fIout_len\fP\fP
+Incremented by the number of characters printed. 
+.TP
+\fB\fIallow_realloc\fP\fP
+if not zero reallocate the buffer to fit the  needed size. 
+.TP
+\fB\fIvar\fP\fP
+The variable to encode. 
+.TP
+\fB\fIenums\fP\fP
+The enumeration ff this variable is enumerated. may be NULL. 
+.TP
+\fB\fIhint\fP\fP
+Contents of the DISPLAY-HINT clause of the MIB. See RFC 1903 Section 3.1 for details. may be NULL. 
+.TP
+\fB\fIunits\fP\fP
+Contents of the UNITS clause of the MIB. may be NULL.
+.PP
+\fBReturns: \fP
+.in +1c
+1 on success, or 0 on failure (out of memory, or buffer to small when not allowed to realloc.) 
+.PP
+Definition at line 411 of file mib.c.
+.PP
+References sprint_realloc_asciistring(), sprint_realloc_by_type(), and sprint_realloc_hexstring().
+.PP
+Referenced by set_function(), and sprint_realloc_by_type().
+.SS "int sprint_realloc_opaque (u_char ** buf, size_t * buf_len, size_t * out_len, int allow_realloc, const netsnmp_variable_list * var, const struct enum_list * enums, const char * hint, const char * units)"
+.PP
+Prints an object identifier into a buffer.
+.PP
+If allow_realloc is true the buffer will be (re)allocated to fit in the  needed size. (Note: *buf may change due to this.)
+.PP
+\fBParameters: \fP
+.in +1c
+.TP
+\fB\fIbuf\fP\fP
+Address of the buffer to print to. 
+.TP
+\fB\fIbuf_len\fP\fP
+Address to an integer containing the size of buf. 
+.TP
+\fB\fIout_len\fP\fP
+Incremented by the number of characters printed. 
+.TP
+\fB\fIallow_realloc\fP\fP
+if not zero reallocate the buffer to fit the  needed size. 
+.TP
+\fB\fIvar\fP\fP
+The variable to encode. 
+.TP
+\fB\fIenums\fP\fP
+The enumeration ff this variable is enumerated. may be NULL. 
+.TP
+\fB\fIhint\fP\fP
+Contents of the DISPLAY-HINT clause of the MIB. See RFC 1903 Section 3.1 for details. may be NULL. 
+.TP
+\fB\fIunits\fP\fP
+Contents of the UNITS clause of the MIB. may be NULL.
+.PP
+\fBReturns: \fP
+.in +1c
+1 on success, or 0 on failure (out of memory, or buffer to small when not allowed to realloc.) 
+.PP
+Definition at line 963 of file mib.c.
+.PP
+References sprint_realloc_by_type(), sprint_realloc_counter64(), and sprint_realloc_hexstring().
+.PP
+Referenced by set_function(), and sprint_realloc_by_type().
+.SS "int sprint_realloc_timeticks (u_char ** buf, size_t * buf_len, size_t * out_len, int allow_realloc, const netsnmp_variable_list * var, const struct enum_list * enums, const char * hint, const char * units)"
+.PP
+Prints a timetick variable into a buffer.
+.PP
+If allow_realloc is true the buffer will be (re)allocated to fit in the  needed size. (Note: *buf may change due to this.)
+.PP
+\fBParameters: \fP
+.in +1c
+.TP
+\fB\fIbuf\fP\fP
+Address of the buffer to print to. 
+.TP
+\fB\fIbuf_len\fP\fP
+Address to an integer containing the size of buf. 
+.TP
+\fB\fIout_len\fP\fP
+Incremented by the number of characters printed. 
+.TP
+\fB\fIallow_realloc\fP\fP
+if not zero reallocate the buffer to fit the  needed size. 
+.TP
+\fB\fIvar\fP\fP
+The variable to encode. 
+.TP
+\fB\fIenums\fP\fP
+The enumeration ff this variable is enumerated. may be NULL. 
+.TP
+\fB\fIhint\fP\fP
+Contents of the DISPLAY-HINT clause of the MIB. See RFC 1903 Section 3.1 for details. may be NULL. 
+.TP
+\fB\fIunits\fP\fP
+Contents of the UNITS clause of the MIB. may be NULL.
+.PP
+\fBReturns: \fP
+.in +1c
+1 on success, or 0 on failure (out of memory, or buffer to small when not allowed to realloc.) 
+.PP
+Definition at line 1123 of file mib.c.
+.PP
+References sprint_realloc_by_type().
+.PP
+Referenced by set_function(), and sprint_realloc_by_type().
+.SS "int sprint_realloc_uinteger (u_char ** buf, size_t * buf_len, size_t * out_len, int allow_realloc, const netsnmp_variable_list * var, const struct enum_list * enums, const char * hint, const char * units)"
+.PP
+Prints an unsigned integer into a buffer.
+.PP
+If allow_realloc is true the buffer will be (re)allocated to fit in the  needed size. (Note: *buf may change due to this.)
+.PP
+\fBParameters: \fP
+.in +1c
+.TP
+\fB\fIbuf\fP\fP
+Address of the buffer to print to. 
+.TP
+\fB\fIbuf_len\fP\fP
+Address to an integer containing the size of buf. 
+.TP
+\fB\fIout_len\fP\fP
+Incremented by the number of characters printed. 
+.TP
+\fB\fIallow_realloc\fP\fP
+if not zero reallocate the buffer to fit the  needed size. 
+.TP
+\fB\fIvar\fP\fP
+The variable to encode. 
+.TP
+\fB\fIenums\fP\fP
+The enumeration ff this variable is enumerated. may be NULL. 
+.TP
+\fB\fIhint\fP\fP
+Contents of the DISPLAY-HINT clause of the MIB. See RFC 1903 Section 3.1 for details. may be NULL. 
+.TP
+\fB\fIunits\fP\fP
+Contents of the UNITS clause of the MIB. may be NULL.
+.PP
+\fBReturns: \fP
+.in +1c
+1 on success, or 0 on failure (out of memory, or buffer to small when not allowed to realloc.) 
+.PP
+Definition at line 1374 of file mib.c.
+.PP
+References sprint_realloc_by_type(), and sprint_realloc_hinted_integer().
+.PP
+Referenced by set_function(), and sprint_realloc_by_type().
+.SS "char* uptime_string (u_long timeticks, char * buf)"
+.PP
+Converts timeticks to hours, minutes, seconds string.
+.PP
+CMU compatible does not show centiseconds.
+.PP
+\fBParameters: \fP
+.in +1c
+.TP
+\fB\fItimeticks\fP\fP
+The timeticks to convert. 
+.TP
+\fB\fIbuf\fP\fP
+Buffer to write to, has to be at  least 64 Bytes large.
+.PP
+\fBReturns: \fP
+.in +1c
+The buffer
+.PP
+\fBSee also: \fP
+.in +1c
+uptimeString 
+.PP
+Definition at line 5233 of file mib.c.
+.SH "VARIABLE DOCUMENTATION"
+.PP 
+.SS "PrefixList mib_prefixes[]"
+.PP
+\fBInitial value:\fP
+.PP
+.nf
+ {
+    {&Standard_Prefix[0]},      
+    {'.iso.org.dod.internet.mgmt.mib-2'},
+    {'.iso.org.dod.internet.experimental'},
+    {'.iso.org.dod.internet.private'},
+    {'.iso.org.dod.internet.snmpParties'},
+    {'.iso.org.dod.internet.snmpSecrets'},
+    {NULL, 0}                   
+}
+.fi
+.PP
+Definition at line 146 of file mib.c.
diff -Naur tomato/release/src/router/snmp/man/netsnmp_mode_end_call.3 tomato121/release/src/router/snmp/man/netsnmp_mode_end_call.3
--- tomato/release/src/router/snmp/man/netsnmp_mode_end_call.3	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/man/netsnmp_mode_end_call.3	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,65 @@
+.TH "mode_end_call: at the end of a series of requests, call another handler hook." 3 "5 Sep 2003" "net-snmp" \" -*- nroff -*-
+.ad l
+.nh
+.SH NAME
+mode_end_call: at the end of a series of requests, call another handler hook. \- Handlers that want to loop through a series of requests and then receive a callback at the end of a particular MODE can use this helper to make this possible. 
+More...
+.SS "Functions"
+
+.in +1c
+.ti -1c
+.RI "netsnmp_mib_handler * \fBnetsnmp_get_mode_end_call_handler\fP (netsnmp_mode_handler_list *endlist)"
+.br
+.RI "\fIreturns a mode_end_call handler that can be injected into a given handler chain.\fP"
+.ti -1c
+.RI "netsnmp_mode_handler_list * \fBnetsnmp_mode_end_call_add_mode_callback\fP (netsnmp_mode_handler_list *endlist, int mode, netsnmp_mib_handler *callbackh)"
+.br
+.RI "\fIadds a mode specific callback to the callback list.\fP"
+.in -1c
+.SH "DETAILED DESCRIPTION"
+.PP 
+Handlers that want to loop through a series of requests and then receive a callback at the end of a particular MODE can use this helper to make this possible.
+.PP
+For most modules, this is not needed as the handler itself could perform a for() loop around the request list and then perform its actions afterwards. However, if something like the serialize helper is in use this isn't possible because not all the requests for a given handler are being passed downward in a single group. Thus, this helper *must* be added above other helpers like the serialize helper to be useful.
+.PP
+Multiple mode specific handlers can be registered and will be called in the order they were regestered in. Callbacks regesterd with a mode of NETSNMP_MODE_END_ALL_MODES will be called for all modes. 
+.SH "FUNCTION DOCUMENTATION"
+.PP 
+.SS "netsnmp_mib_handler* netsnmp_get_mode_end_call_handler (netsnmp_mode_handler_list * endlist)"
+.PP
+returns a mode_end_call handler that can be injected into a given handler chain.
+.PP
+\fBParameters: \fP
+.in +1c
+.TP
+\fB\fIendlist\fP\fP
+The callback list for the handler to make use of. 
+.PP
+\fBReturns: \fP
+.in +1c
+An injectable Net-SNMP handler. 
+.PP
+Definition at line 38 of file mode_end_call.c.
+.PP
+References netsnmp_create_handler().
+.SS "netsnmp_mode_handler_list* netsnmp_mode_end_call_add_mode_callback (netsnmp_mode_handler_list * endlist, int mode, netsnmp_mib_handler * callbackh)"
+.PP
+adds a mode specific callback to the callback list.
+.PP
+\fBParameters: \fP
+.in +1c
+.TP
+\fB\fIendinfo\fP\fP
+the information structure for the mode_end_call helper. Can be NULL to create a new list. 
+.TP
+\fB\fImode\fP\fP
+the mode to be called upon. A mode of NETSNMP_MODE_END_ALL_MODES = all modes. 
+.TP
+\fB\fIcallbackh\fP\fP
+the netsnmp_mib_handler callback to call. 
+.PP
+\fBReturns: \fP
+.in +1c
+the new registration information list upon success. 
+.PP
+Definition at line 58 of file mode_end_call.c.
diff -Naur tomato/release/src/router/snmp/man/netsnmp_multiplexer.3 tomato121/release/src/router/snmp/man/netsnmp_multiplexer.3
--- tomato/release/src/router/snmp/man/netsnmp_multiplexer.3	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/man/netsnmp_multiplexer.3	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,53 @@
+.TH "multiplexer: splits mode requests into calls to different handlers." 3 "5 Sep 2003" "net-snmp" \" -*- nroff -*-
+.ad l
+.nh
+.SH NAME
+multiplexer: splits mode requests into calls to different handlers. \- The multiplexer helper lets you split the calling chain depending on the calling mode (get vs getnext vs set). 
+More...
+.SS "Functions"
+
+.in +1c
+.ti -1c
+.RI "netsnmp_mib_handler * \fBnetsnmp_get_multiplexer_handler\fP (netsnmp_mib_handler_methods *req)"
+.br
+.RI "\fIreturns a multiplixer handler given a netsnmp_mib_handler_methods structure of subhandlers.\fP"
+.ti -1c
+.RI "int \fBnetsnmp_multiplexer_helper_handler\fP (netsnmp_mib_handler *handler, netsnmp_handler_registration *reginfo, netsnmp_agent_request_info *reqinfo, netsnmp_request_info *requests)"
+.br
+.RI "\fIimplements the multiplexer helper\fP"
+.in -1c
+.SH "DETAILED DESCRIPTION"
+.PP 
+The multiplexer helper lets you split the calling chain depending on the calling mode (get vs getnext vs set).
+.PP
+Useful if you want different routines to handle different aspects of SNMP requests, which is very common for GET vs SET type actions.
+.PP
+Functionally:
+.PP
+.TP
+GET requests call the get_method
+.TP
+GETNEXT requests call the getnext_method, or if not present, the get_method.
+.TP
+GETBULK requests call the getbulk_method, or if not present, the getnext_method, or if even that isn't present the get_method.
+.TP
+SET requests call the set_method, or if not present return a SNMP_ERR_NOTWRITABLE error. 
+.PP
+.SH "FUNCTION DOCUMENTATION"
+.PP 
+.SS "netsnmp_mib_handler* netsnmp_get_multiplexer_handler (netsnmp_mib_handler_methods * req)"
+.PP
+returns a multiplixer handler given a netsnmp_mib_handler_methods structure of subhandlers.
+.PP
+Definition at line 36 of file multiplexer.c.
+.PP
+References netsnmp_create_handler(), and netsnmp_multiplexer_helper_handler().
+.SS "int netsnmp_multiplexer_helper_handler (netsnmp_mib_handler * handler, netsnmp_handler_registration * reginfo, netsnmp_agent_request_info * reqinfo, netsnmp_request_info * requests)"
+.PP
+implements the multiplexer helper
+.PP
+Definition at line 57 of file multiplexer.c.
+.PP
+References netsnmp_call_handler().
+.PP
+Referenced by netsnmp_get_multiplexer_handler().
diff -Naur tomato/release/src/router/snmp/man/netsnmp_old_api.3 tomato121/release/src/router/snmp/man/netsnmp_old_api.3
--- tomato/release/src/router/snmp/man/netsnmp_old_api.3	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/man/netsnmp_old_api.3	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,69 @@
+.TH "old_api: Calls mib module code written in the old style of code." 3 "5 Sep 2003" "net-snmp" \" -*- nroff -*-
+.ad l
+.nh
+.SH NAME
+old_api: Calls mib module code written in the old style of code. \- This is a backwards compatilibity module that allows code written in the old API to be run under the new handler based architecture. 
+More...
+.SS "Functions"
+
+.in +1c
+.ti -1c
+.RI "netsnmp_mib_handler * \fBget_old_api_handler\fP (void)"
+.br
+.RI "\fIreturns a old_api handler that should be the final calling handler.\fP"
+.ti -1c
+.RI "int \fBnetsnmp_register_old_api\fP (const char *moduleName, struct variable *var, size_t varsize, size_t numvars, oid *mibloc, size_t mibloclen, int priority, int range_subid, oid range_ubound, netsnmp_session *ss, const char *context, int timeout, int flags)"
+.br
+.RI "\fIRegisters an old API set into the mib tree.\fP"
+.ti -1c
+.RI "int \fBnetsnmp_register_mib_table_row\fP (const char *moduleName, struct variable *var, size_t varsize, size_t numvars, oid *mibloc, size_t mibloclen, int priority, int var_subid, netsnmp_session *ss, const char *context, int timeout, int flags)"
+.br
+.RI "\fIregisters a row within a mib table\fP"
+.ti -1c
+.RI "int \fBnetsnmp_old_api_helper\fP (netsnmp_mib_handler *handler, netsnmp_handler_registration *reginfo, netsnmp_agent_request_info *reqinfo, netsnmp_request_info *requests)"
+.br
+.RI "\fIimplements the old_api handler\fP"
+.in -1c
+.SH "DETAILED DESCRIPTION"
+.PP 
+This is a backwards compatilibity module that allows code written in the old API to be run under the new handler based architecture.
+.PP
+Use it by calling \fBnetsnmp_register_old_api()\fP. 
+.SH "FUNCTION DOCUMENTATION"
+.PP 
+.SS "netsnmp_mib_handler* get_old_api_handler (void)"
+.PP
+returns a old_api handler that should be the final calling handler.
+.PP
+Don't use this function. Use the \fBnetsnmp_register_old_api()\fP function instead. 
+.PP
+Definition at line 40 of file old_api.c.
+.PP
+References netsnmp_create_handler(), and netsnmp_old_api_helper().
+.PP
+Referenced by netsnmp_register_mib_table_row(), and netsnmp_register_old_api().
+.SS "int netsnmp_old_api_helper (netsnmp_mib_handler * handler, netsnmp_handler_registration * reginfo, netsnmp_agent_request_info * reqinfo, netsnmp_request_info * requests)"
+.PP
+implements the old_api handler
+.PP
+Definition at line 224 of file old_api.c.
+.PP
+References netsnmp_oid_equals(), netsnmp_request_add_list_data(), and netsnmp_request_get_list_data().
+.PP
+Referenced by get_old_api_handler().
+.SS "int netsnmp_register_mib_table_row (const char * moduleName, struct variable * var, size_t varsize, size_t numvars, oid * mibloc, size_t mibloclen, int priority, int var_subid, netsnmp_session * ss, const char * context, int timeout, int flags)"
+.PP
+registers a row within a mib table
+.PP
+Definition at line 110 of file old_api.c.
+.PP
+References get_old_api_handler(), netsnmp_handler_registration_free(), and netsnmp_register_handler_nocallback().
+.SS "int netsnmp_register_old_api (const char * moduleName, struct variable * var, size_t varsize, size_t numvars, oid * mibloc, size_t mibloclen, int priority, int range_subid, oid range_ubound, netsnmp_session * ss, const char * context, int timeout, int flags)"
+.PP
+Registers an old API set into the mib tree.
+.PP
+Functionally this mimics the old \fBregister_mib_context()\fP function (and in fact the new \fBregister_mib_context()\fP function merely calls this new old_api one). 
+.PP
+Definition at line 51 of file old_api.c.
+.PP
+References get_old_api_handler(), netsnmp_handler_registration_free(), and netsnmp_register_handler().
diff -Naur tomato/release/src/router/snmp/man/netsnmp_read_only.3 tomato121/release/src/router/snmp/man/netsnmp_read_only.3
--- tomato/release/src/router/snmp/man/netsnmp_read_only.3	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/man/netsnmp_read_only.3	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,47 @@
+.TH "read_only: make your handler read_only automatically" 3 "5 Sep 2003" "net-snmp" \" -*- nroff -*-
+.ad l
+.nh
+.SH NAME
+read_only: make your handler read_only automatically \- The only purpose of this handler is to return an appropriate error for any requests passed to it in a SET mode. 
+More...
+.SS "handler"
+
+.in +1c
+.ti -1c
+.RI "void \fBnetsnmp_init_read_only_helper\fP (void)"
+.br
+.RI "\fIinitializes the read_only helper which then registers a read_only handler as a run-time injectable handler for configuration file use.\fP"
+.in -1c
+.SS "Functions"
+
+.in +1c
+.ti -1c
+.RI "netsnmp_mib_handler * \fBnetsnmp_get_read_only_handler\fP (void)"
+.br
+.RI "\fIreturns a read_only handler that can be injected into a given handler chain.\fP"
+.in -1c
+.SH "DETAILED DESCRIPTION"
+.PP 
+The only purpose of this handler is to return an appropriate error for any requests passed to it in a SET mode.
+.PP
+Inserting it into your handler chain will ensure you're never asked to perform a SET request so you can ignore those error conditions. 
+.SH "FUNCTION DOCUMENTATION"
+.PP 
+.SS "netsnmp_mib_handler* netsnmp_get_read_only_handler (void)"
+.PP
+returns a read_only handler that can be injected into a given handler chain.
+.PP
+Definition at line 32 of file read_only.c.
+.PP
+References netsnmp_create_handler().
+.PP
+Referenced by netsnmp_init_read_only_helper(), and netsnmp_register_read_only_table_data().
+.SS "void netsnmp_init_read_only_helper (void)"
+.PP
+initializes the read_only helper which then registers a read_only handler as a run-time injectable handler for configuration file use.
+.PP
+Definition at line 71 of file read_only.c.
+.PP
+References netsnmp_get_read_only_handler(), and netsnmp_register_handler_by_name().
+.PP
+Referenced by netsnmp_init_helpers().
diff -Naur tomato/release/src/router/snmp/man/netsnmp_scalar.3 tomato121/release/src/router/snmp/man/netsnmp_scalar.3
--- tomato/release/src/router/snmp/man/netsnmp_scalar.3	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/man/netsnmp_scalar.3	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,5 @@
+.TH "scalar: process scalars easily." 3 "5 Sep 2003" "net-snmp" \" -*- nroff -*-
+.ad l
+.nh
+.SH NAME
+scalar: process scalars easily. \- 
diff -Naur tomato/release/src/router/snmp/man/netsnmp_serialize.3 tomato121/release/src/router/snmp/man/netsnmp_serialize.3
--- tomato/release/src/router/snmp/man/netsnmp_serialize.3	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/man/netsnmp_serialize.3	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,71 @@
+.TH "serialize: Calls sub handlers one request at a time." 3 "5 Sep 2003" "net-snmp" \" -*- nroff -*-
+.ad l
+.nh
+.SH NAME
+serialize: Calls sub handlers one request at a time. \- This functionally passes in one request at a time into lower handlers rather than a whole bunch of requests at once. 
+More...
+.SS "handler"
+
+.in +1c
+.ti -1c
+.RI "void \fBnetsnmp_init_serialize\fP (void)"
+.br
+.RI "\fIinitializes the serialize helper which then registers a serialize handler as a run-time injectable handler for configuration file use.\fP"
+.in -1c
+.SS "Functions"
+
+.in +1c
+.ti -1c
+.RI "netsnmp_mib_handler * \fBnetsnmp_get_serialize_handler\fP (void)"
+.br
+.RI "\fIreturns a serialize handler that can be injected into a given handler chain.\fP"
+.ti -1c
+.RI "int \fBnetsnmp_register_serialize\fP (netsnmp_handler_registration *reginfo)"
+.br
+.RI "\fIfunctionally the same as calling \fBnetsnmp_register_handler()\fP but also injects a serialize handler at the same time for you.\fP"
+.ti -1c
+.RI "int \fBnetsnmp_serialize_helper_handler\fP (netsnmp_mib_handler *handler, netsnmp_handler_registration *reginfo, netsnmp_agent_request_info *reqinfo, netsnmp_request_info *requests)"
+.br
+.RI "\fIImplements the serial handler.\fP"
+.in -1c
+.SH "DETAILED DESCRIPTION"
+.PP 
+This functionally passes in one request at a time into lower handlers rather than a whole bunch of requests at once.
+.PP
+This is useful for handlers that don't want to iterate through the request lists themselves. Generally, this is probably less efficient so use with caution. The serialize handler might be useable to dynamically fix handlers with broken looping code, however. 
+.SH "FUNCTION DOCUMENTATION"
+.PP 
+.SS "netsnmp_mib_handler* netsnmp_get_serialize_handler (void)"
+.PP
+returns a serialize handler that can be injected into a given handler chain.
+.PP
+Definition at line 34 of file serialize.c.
+.PP
+References netsnmp_create_handler(), and netsnmp_serialize_helper_handler().
+.PP
+Referenced by netsnmp_init_serialize(), and netsnmp_register_serialize().
+.SS "void netsnmp_init_serialize (void)"
+.PP
+initializes the serialize helper which then registers a serialize handler as a run-time injectable handler for configuration file use.
+.PP
+Definition at line 96 of file serialize.c.
+.PP
+References netsnmp_get_serialize_handler(), and netsnmp_register_handler_by_name().
+.PP
+Referenced by netsnmp_init_helpers().
+.SS "int netsnmp_register_serialize (netsnmp_handler_registration * reginfo)"
+.PP
+functionally the same as calling \fBnetsnmp_register_handler()\fP but also injects a serialize handler at the same time for you.
+.PP
+Definition at line 43 of file serialize.c.
+.PP
+References netsnmp_get_serialize_handler(), netsnmp_inject_handler(), and netsnmp_register_handler().
+.SS "int netsnmp_serialize_helper_handler (netsnmp_mib_handler * handler, netsnmp_handler_registration * reginfo, netsnmp_agent_request_info * reqinfo, netsnmp_request_info * requests)"
+.PP
+Implements the serial handler.
+.PP
+Definition at line 51 of file serialize.c.
+.PP
+References netsnmp_call_next_handler().
+.PP
+Referenced by netsnmp_get_serialize_handler().
diff -Naur tomato/release/src/router/snmp/man/netsnmp_table.3 tomato121/release/src/router/snmp/man/netsnmp_table.3
--- tomato/release/src/router/snmp/man/netsnmp_table.3	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/man/netsnmp_table.3	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,176 @@
+.TH "table: Helps you implement a table." 3 "5 Sep 2003" "net-snmp" \" -*- nroff -*-
+.ad l
+.nh
+.SH NAME
+table: Helps you implement a table. \- This handler helps you implement a table by doing some of the processing for you. 
+More...
+.SS "Modules"
+
+.in +1c
+.ti -1c
+.RI "\fBtable_array: Helps you implement a table when data can be stored locally. The data is stored in a sorted array, using a binary search for lookups.\fP"
+.br
+.RI "\fIThe table_array handler is used (automatically) in conjuntion with the \fBtable\fP handler.\fP"
+.PP
+.in +1c
+
+.ti -1c
+.RI "\fBtable_data: Helps you implement a table with datamatted storage.\fP"
+.br
+.RI "\fIThis helper helps you implement a table where all the indexes are expected to be stored within the agent itself and not in some external storage location.\fP"
+.PP
+.in +1c
+
+.ti -1c
+.RI "\fBtable_iterator: The table iterator helper is designed to simplify the task of writing a table handler for the net-snmp agent when the data being accessed is not in an oid sorted form and must be accessed externally.\fP"
+.br
+.RI "\fIFunctionally, it is a specialized version of the more generic table helper but easies the burden of GETNEXT processing by manually looping through all the data indexes retrieved through function calls which should be supplied by the module that wishes help.\fP"
+.PP
+
+.in -1c
+.SS "Functions"
+
+.in +1c
+.ti -1c
+.RI "netsnmp_mib_handler * \fBnetsnmp_get_table_handler\fP (netsnmp_table_registration_info *tabreq)"
+.br
+.RI "\fIGiven a netsnmp_table_registration_info object, creates a table handler.\fP"
+.ti -1c
+.RI "int \fBnetsnmp_register_table\fP (netsnmp_handler_registration *reginfo, netsnmp_table_registration_info *tabreq)"
+.br
+.RI "\fIcreates a table handler given the netsnmp_table_registration_info object, inserts it into the request chain and then calls \fBnetsnmp_register_handler()\fP to register the table into the agent.\fP"
+.ti -1c
+.RI "NETSNMP_INLINE netsnmp_table_request_info * \fBnetsnmp_extract_table_info\fP (netsnmp_request_info *request)"
+.br
+.RI "\fIextracts the processed table information from a given request.\fP"
+.ti -1c
+.RI "netsnmp_table_registration_info * \fBnetsnmp_find_table_registration_info\fP (netsnmp_handler_registration *reginfo)"
+.br
+.RI "\fIextracts the registered netsnmp_table_registration_info object from a netsnmp_handler_registration object\fP"
+.ti -1c
+.RI "int \fBtable_helper_handler\fP (netsnmp_mib_handler *handler, netsnmp_handler_registration *reginfo, netsnmp_agent_request_info *reqinfo, netsnmp_request_info *requests)"
+.br
+.RI "\fIimplements the table helper handler\fP"
+.ti -1c
+.RI "int \fBnetsnmp_table_build_result\fP (netsnmp_handler_registration *reginfo, netsnmp_request_info *reqinfo, netsnmp_table_request_info *table_info, u_char type, u_char *result, size_t result_len)"
+.br
+.RI "\fIBuilds the result to be returned to the agent given the table information.\fP"
+.ti -1c
+.RI "int \fBnetsnmp_table_build_oid\fP (netsnmp_handler_registration *reginfo, netsnmp_request_info *reqinfo, netsnmp_table_request_info *table_info)"
+.br
+.RI "\fIgiven a registration info object, a request object and the table info object it builds the request->requestvb->name oid from the index values and column information found in the table_info object.\fP"
+.ti -1c
+.RI "int \fBnetsnmp_table_build_oid_from_index\fP (netsnmp_handler_registration *reginfo, netsnmp_request_info *reqinfo, netsnmp_table_request_info *table_info)"
+.br
+.RI "\fIBuilds an oid from index information.\fP"
+.ti -1c
+.RI "int \fBnetsnmp_update_variable_list_from_index\fP (netsnmp_table_request_info *tri)"
+.br
+.RI "\fIparses an OID into table indexses\fP"
+.ti -1c
+.RI "int \fBnetsnmp_update_indexes_from_variable_list\fP (netsnmp_table_request_info *tri)"
+.br
+.RI "\fIbuilds an oid given a set of indexes.\fP"
+.ti -1c
+.RI "int \fBnetsnmp_check_getnext_reply\fP (netsnmp_request_info *request, oid *prefix, size_t prefix_len, netsnmp_variable_list *newvar, netsnmp_variable_list **outvar)"
+.br
+.RI "\fIchecks the original request against the current data being passed in if its greater than the request oid but less than the current valid return, set the current valid return to the new value.\fP"
+.in -1c
+.SH "DETAILED DESCRIPTION"
+.PP 
+This handler helps you implement a table by doing some of the processing for you.
+.PP
+This handler truly shows the power of the new handler mechanism. By creating a table handler and injecting it into your calling chain, or by using the \fBnetsnmp_register_table()\fP function to register your table, you get access to some pre-parsed information. Specifically, the table handler pulls out the column number and indexes from the request oid so that you don't have to do the complex work to do that parsing within your own code.
+.PP
+To do this, the table handler needs to know up front how your table is structured. To inform it about this, you fill in a table_registeration_info structure that is passed to the table handler. It contains the asn index types for the table as well as the minimum and maximum column that should be used. 
+.SH "FUNCTION DOCUMENTATION"
+.PP 
+.SS "int netsnmp_check_getnext_reply (netsnmp_request_info * request, oid * prefix, size_t prefix_len, netsnmp_variable_list * newvar, netsnmp_variable_list ** outvar)"
+.PP
+checks the original request against the current data being passed in if its greater than the request oid but less than the current valid return, set the current valid return to the new value.
+.PP
+returns 1 if outvar was replaced with the oid from newvar (success). returns 0 if not. 
+.PP
+Definition at line 666 of file table.c.
+.PP
+References snmp_oid_compare().
+.SS "NETSNMP_INLINE netsnmp_table_request_info* netsnmp_extract_table_info (netsnmp_request_info * request)"
+.PP
+extracts the processed table information from a given request.
+.PP
+call this from subhandlers on a request to extract the processed netsnmp_request_info information. The resulting information includes the index values and the column number. 
+.PP
+Definition at line 105 of file table.c.
+.PP
+References netsnmp_request_get_list_data().
+.PP
+Referenced by netsnmp_table_data_helper_handler(), and netsnmp_table_data_set_helper_handler().
+.SS "netsnmp_table_registration_info* netsnmp_find_table_registration_info (netsnmp_handler_registration * reginfo)"
+.PP
+extracts the registered netsnmp_table_registration_info object from a netsnmp_handler_registration object
+.PP
+Definition at line 114 of file table.c.
+.PP
+References netsnmp_find_handler_data_by_name().
+.PP
+Referenced by netsnmp_table_data_helper_handler().
+.SS "netsnmp_mib_handler* netsnmp_get_table_handler (netsnmp_table_registration_info * tabreq)"
+.PP
+Given a netsnmp_table_registration_info object, creates a table handler.
+.PP
+You can use this table handler by injecting it into a calling chain. When the handler gets called, it'll do processing and store it's information into the request->parent_data structure. 
+.PP
+Definition at line 69 of file table.c.
+.PP
+References netsnmp_create_handler(), and table_helper_handler().
+.PP
+Referenced by netsnmp_register_table().
+.SS "int netsnmp_register_table (netsnmp_handler_registration * reginfo, netsnmp_table_registration_info * tabreq)"
+.PP
+creates a table handler given the netsnmp_table_registration_info object, inserts it into the request chain and then calls \fBnetsnmp_register_handler()\fP to register the table into the agent.
+.PP
+Definition at line 92 of file table.c.
+.PP
+References netsnmp_get_table_handler(), netsnmp_inject_handler(), and netsnmp_register_handler().
+.PP
+Referenced by netsnmp_register_table_data(), and netsnmp_table_container_register().
+.SS "int netsnmp_table_build_oid (netsnmp_handler_registration * reginfo, netsnmp_request_info * reqinfo, netsnmp_table_request_info * table_info)"
+.PP
+given a registration info object, a request object and the table info object it builds the request->requestvb->name oid from the index values and column information found in the table_info object.
+.PP
+Definition at line 584 of file table.c.
+.PP
+Referenced by netsnmp_table_build_result().
+.SS "int netsnmp_table_build_oid_from_index (netsnmp_handler_registration * reginfo, netsnmp_request_info * reqinfo, netsnmp_table_request_info * table_info)"
+.PP
+Builds an oid from index information.
+.PP
+Definition at line 610 of file table.c.
+.SS "int netsnmp_table_build_result (netsnmp_handler_registration * reginfo, netsnmp_request_info * reqinfo, netsnmp_table_request_info * table_info, u_char type, u_char * result, size_t result_len)"
+.PP
+Builds the result to be returned to the agent given the table information.
+.PP
+Use this function to return results from lowel level handlers to the agent. It takes care of building the proper resulting oid (containing proper indexing) and inserts the result value into the returning varbind. 
+.PP
+Definition at line 551 of file table.c.
+.PP
+References netsnmp_table_build_oid().
+.SS "int netsnmp_update_indexes_from_variable_list (netsnmp_table_request_info * tri)"
+.PP
+builds an oid given a set of indexes.
+.PP
+Definition at line 648 of file table.c.
+.SS "int netsnmp_update_variable_list_from_index (netsnmp_table_request_info * tri)"
+.PP
+parses an OID into table indexses
+.PP
+Definition at line 637 of file table.c.
+.SS "int table_helper_handler (netsnmp_mib_handler * handler, netsnmp_handler_registration * reginfo, netsnmp_agent_request_info * reqinfo, netsnmp_request_info * requests)"
+.PP
+implements the table helper handler
+.PP
+Definition at line 122 of file table.c.
+.PP
+References netsnmp_call_next_handler(), netsnmp_request_add_list_data(), snmp_oid_compare(), and sprint_realloc_by_type().
+.PP
+Referenced by netsnmp_get_table_handler().
diff -Naur tomato/release/src/router/snmp/man/netsnmp_table_array.3 tomato121/release/src/router/snmp/man/netsnmp_table_array.3
--- tomato/release/src/router/snmp/man/netsnmp_table_array.3	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/man/netsnmp_table_array.3	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,81 @@
+.TH "table_array: Helps you implement a table when data can be stored locally. The data is stored in a sorted array, using a binary search for lookups." 3 "5 Sep 2003" "net-snmp" \" -*- nroff -*-
+.ad l
+.nh
+.SH NAME
+table_array: Helps you implement a table when data can be stored locally. The data is stored in a sorted array, using a binary search for lookups. \- The table_array handler is used (automatically) in conjuntion with the \fBtable\fP handler. 
+More...
+.SS "Functions"
+
+.in +1c
+.ti -1c
+.RI "int \fBnetsnmp_table_container_register\fP (netsnmp_handler_registration *reginfo, netsnmp_table_registration_info *tabreg, netsnmp_table_array_callbacks *cb, netsnmp_container *container, int group_rows)"
+.br
+.RI "\fIregister specified callbacks for the specified table/oid.\fP"
+.ti -1c
+.RI "netsnmp_mib_handler * \fBnetsnmp_find_table_array_handler\fP (netsnmp_handler_registration *reginfo)"
+.br
+.RI "\fIfind the handler for the table_array helper.\fP"
+.ti -1c
+.RI "netsnmp_container * \fBnetsnmp_extract_array_context\fP (netsnmp_request_info *request)"
+.br
+.RI "\fIfind the context data used by the table_array helper\fP"
+.ti -1c
+.RI "int \fBnetsnmp_table_array_check_row_status\fP (netsnmp_table_array_callbacks *cb, netsnmp_request_group *ag, long *rs_new, long *rs_old)"
+.br
+.RI "\fIthis function is called to validate RowStatus transitions.\fP"
+.in -1c
+.SH "DETAILED DESCRIPTION"
+.PP 
+The table_array handler is used (automatically) in conjuntion with the \fBtable\fP handler.
+.PP
+It is primarily intended to be used with the mib2c configuration file mib2c.array-user.conf.
+.PP
+The code generated by mib2c is useful when you have control of the data for each row. If you cannot control when rows are added and deleted (or at least be notified of changes to row data), then this handler is probably not for you.
+.PP
+This handler makes use of callbacks (function pointers) to handle various tasks. Code is generated for each callback, but will need to be reviewed and flushed out by the user.
+.PP
+NOTE NOTE NOTE: Once place where mib2c is somewhat lacking is with regards to tables with external indices. If your table makes use of one or more external indices, please review the generated code very carefully for comments regarding external indices.
+.PP
+NOTE NOTE NOTE: This helper, the API and callbacks are still being tested and may change.
+.PP
+The generated code will define a structure for storage of table related data. This structure must be used, as it contains the index OID for the row, which is used for keeping the array sorted. You can add addition fields or data to the structure for your own use.
+.PP
+The generated code will also have code to handle SNMP-SET processing. If your table does not support any SET operations, simply comment out the define <PREFIX>_SET_HANDLING (where <PREFIX> is your table name) in the header file.
+.PP
+SET processing modifies the row in-place. The duplicate_row callback will be called to save a copy of the original row. In the event of a failure before the commite phase, the row_copy callback will be called to restore the original row from the copy.
+.PP
+Code will be generated to handle row creation. This code may be disabled by commenting out the define <PREFIX>_ROW_CREATION in the header file.
+.PP
+If your table contains a RowStatus object, by default the code will not allow object in an active row to be modified. To allow active rows to be modified, remove the comment block around the define <PREFIX>_CAN_MODIFY_ACTIVE_ROW in the header file.
+.PP
+Code will be generated to maintain a secondary index for all rows, stored in a binary tree. This is very useful for finding rows by a key other than the OID index. By default, the functions for maintaining this tree will be based on a character string. NOTE: this will likely be made into a more generic mechanism, using new callback methods, in the near future.
+.PP
+The generated code contains many TODO comments. Make sure you check each one to see if it applies to your code. Examples include checking indices for syntax (ranges, etc), initializing default values in newly created rows, checking for row activation and deactivation requirements, etc. 
+.SH "FUNCTION DOCUMENTATION"
+.PP 
+.SS "netsnmp_container* netsnmp_extract_array_context (netsnmp_request_info * request)"
+.PP
+find the context data used by the table_array helper
+.PP
+Definition at line 218 of file table_array.c.
+.PP
+References netsnmp_request_get_list_data().
+.SS "netsnmp_mib_handler* netsnmp_find_table_array_handler (netsnmp_handler_registration * reginfo)"
+.PP
+find the handler for the table_array helper.
+.PP
+Definition at line 201 of file table_array.c.
+.SS "int netsnmp_table_array_check_row_status (netsnmp_table_array_callbacks * cb, netsnmp_request_group * ag, long * rs_new, long * rs_old)"
+.PP
+this function is called to validate RowStatus transitions.
+.PP
+Definition at line 225 of file table_array.c.
+.SS "int netsnmp_table_container_register (netsnmp_handler_registration * reginfo, netsnmp_table_registration_info * tabreg, netsnmp_table_array_callbacks * cb, netsnmp_container * container, int group_rows)"
+.PP
+register specified callbacks for the specified table/oid.
+.PP
+If the group_rows parameter is set, the row related callbacks will be called once for each unique row index. Otherwise, each callback will be called only once, for all objects. 
+.PP
+Definition at line 152 of file table_array.c.
+.PP
+References netsnmp_register_table().
diff -Naur tomato/release/src/router/snmp/man/netsnmp_table_data.3 tomato121/release/src/router/snmp/man/netsnmp_table_data.3
--- tomato/release/src/router/snmp/man/netsnmp_table_data.3	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/man/netsnmp_table_data.3	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,263 @@
+.TH "table_data: Helps you implement a table with datamatted storage." 3 "5 Sep 2003" "net-snmp" \" -*- nroff -*-
+.ad l
+.nh
+.SH NAME
+table_data: Helps you implement a table with datamatted storage. \- This helper helps you implement a table where all the indexes are expected to be stored within the agent itself and not in some external storage location. 
+More...
+.SS "Modules"
+
+.in +1c
+.ti -1c
+.RI "\fBtable_dataset: Helps you implement a table with automatted storage.\fP"
+.br
+.RI "\fIThis handler helps you implement a table where all the data is expected to be stored within the agent itself and not in some external storage location.\fP"
+.PP
+
+.in -1c
+.SS "Functions"
+
+.in +1c
+.ti -1c
+.RI "void \fBnetsnmp_table_data_generate_index_oid\fP (netsnmp_table_row *row)"
+.br
+.RI "\fIgenerates the index portion of an table oid from a varlist.\fP"
+.ti -1c
+.RI "int \fBnetsnmp_table_data_add_row\fP (netsnmp_table_data *table, netsnmp_table_row *row)"
+.br
+.RI "\fIAdds a row of data to a given table (stored in proper lexographical order).\fP"
+.ti -1c
+.RI "netsnmp_table_row * \fBnetsnmp_table_data_remove_row\fP (netsnmp_table_data *table, netsnmp_table_row *row)"
+.br
+.RI "\fIremoves a row of data to a given table and returns it (no free's called)\fP"
+.ti -1c
+.RI "void * \fBnetsnmp_table_data_delete_row\fP (netsnmp_table_row *row)"
+.br
+.RI "\fIdeletes a row's memory.\fP"
+.ti -1c
+.RI "void * \fBnetsnmp_table_data_remove_and_delete_row\fP (netsnmp_table_data *table, netsnmp_table_row *row)"
+.br
+.RI "\fIremoves and frees a row of data to a given table and returns the void *\fP"
+.ti -1c
+.RI "NETSNMP_INLINE void \fBnetsnmp_table_data_replace_row\fP (netsnmp_table_data *table, netsnmp_table_row *origrow, netsnmp_table_row *newrow)"
+.br
+.RI "\fIswaps out origrow with newrow.\fP"
+.ti -1c
+.RI "netsnmp_table_row * \fBnetsnmp_table_data_get\fP (netsnmp_table_data *table, netsnmp_variable_list *indexes)"
+.br
+.RI "\fIfinds the data in 'datalist' stored at 'indexes'\fP"
+.ti -1c
+.RI "netsnmp_table_row * \fBnetsnmp_table_data_get_from_oid\fP (netsnmp_table_data *table, oid *searchfor, size_t searchfor_len)"
+.br
+.RI "\fIfinds the data in 'datalist' stored at the searchfor oid\fP"
+.ti -1c
+.RI "netsnmp_mib_handler * \fBnetsnmp_get_table_data_handler\fP (netsnmp_table_data *table)"
+.br
+.RI "\fICreates a table_data handler and returns it.\fP"
+.ti -1c
+.RI "int \fBnetsnmp_register_table_data\fP (netsnmp_handler_registration *reginfo, netsnmp_table_data *table, netsnmp_table_registration_info *table_info)"
+.br
+.RI "\fIregisters a handler as a data table.\fP"
+.ti -1c
+.RI "int \fBnetsnmp_register_read_only_table_data\fP (netsnmp_handler_registration *reginfo, netsnmp_table_data *table, netsnmp_table_registration_info *table_info)"
+.br
+.RI "\fIregisters a handler as a read-only data table If table_info != NULL, it registers it as a normal table too.\fP"
+.ti -1c
+.RI "int \fBnetsnmp_table_data_helper_handler\fP (netsnmp_mib_handler *handler, netsnmp_handler_registration *reginfo, netsnmp_agent_request_info *reqinfo, netsnmp_request_info *requests)"
+.br
+.RI "\fIThe helper handler that takes care of passing a specific row of data down to the lower handler(s).\fP"
+.ti -1c
+.RI "netsnmp_table_data * \fBnetsnmp_create_table_data\fP (const char *name)"
+.br
+.RI "\fIcreates and returns a pointer to table data set\fP"
+.ti -1c
+.RI "netsnmp_table_row * \fBnetsnmp_create_table_data_row\fP (void)"
+.br
+.RI "\fIcreates and returns a pointer to table data set\fP"
+.ti -1c
+.RI "netsnmp_table_row * \fBnetsnmp_extract_table_row\fP (netsnmp_request_info *request)"
+.br
+.RI "\fIextracts the row being accessed passed from the table_data helper\fP"
+.ti -1c
+.RI "void * \fBnetsnmp_extract_table_row_data\fP (netsnmp_request_info *request)"
+.br
+.RI "\fIextracts the data from the row being accessed passed from the table_data helper\fP"
+.ti -1c
+.RI "int \fBnetsnmp_table_data_build_result\fP (netsnmp_handler_registration *reginfo, netsnmp_agent_request_info *reqinfo, netsnmp_request_info *request, netsnmp_table_row *row, int column, u_char type, u_char *result_data, size_t result_data_len)"
+.br
+.RI "\fIbuilds a result given a row, a varbind to set and the data\fP"
+.ti -1c
+.RI "netsnmp_table_row * \fBnetsnmp_table_data_clone_row\fP (netsnmp_table_row *row)"
+.br
+.RI "\fIclones a data row.\fP"
+.in -1c
+.SH "DETAILED DESCRIPTION"
+.PP 
+This helper helps you implement a table where all the indexes are expected to be stored within the agent itself and not in some external storage location.
+.PP
+It can be used to store a list of rows, where a row consists of the indexes to the table and a generic data pointer. You can then implement a subhandler which is passed the exact row definition and data it must return data for or accept data for. Complex GETNEXT handling is greatly simplified in this case. 
+.SH "FUNCTION DOCUMENTATION"
+.PP 
+.SS "netsnmp_table_data* netsnmp_create_table_data (const char * name)"
+.PP
+creates and returns a pointer to table data set
+.PP
+Definition at line 525 of file table_data.c.
+.PP
+Referenced by netsnmp_create_table_data_set().
+.SS "netsnmp_table_row* netsnmp_create_table_data_row (void)"
+.PP
+creates and returns a pointer to table data set
+.PP
+\fBExamples: \fP
+.in +1c
+\fBdata_set.c\fP.
+.PP
+Definition at line 535 of file table_data.c.
+.PP
+Referenced by netsnmp_table_data_set_create_row_from_defaults().
+.SS "netsnmp_table_row* netsnmp_extract_table_row (netsnmp_request_info * request)"
+.PP
+extracts the row being accessed passed from the table_data helper
+.PP
+Definition at line 543 of file table_data.c.
+.PP
+References netsnmp_request_get_list_data().
+.PP
+Referenced by netsnmp_extract_table_row_data(), and netsnmp_table_data_set_helper_handler().
+.SS "void* netsnmp_extract_table_row_data (netsnmp_request_info * request)"
+.PP
+extracts the data from the row being accessed passed from the table_data helper
+.PP
+Definition at line 552 of file table_data.c.
+.PP
+References netsnmp_extract_table_row().
+.PP
+Referenced by netsnmp_extract_table_data_set_column().
+.SS "netsnmp_mib_handler* netsnmp_get_table_data_handler (netsnmp_table_data * table)"
+.PP
+Creates a table_data handler and returns it.
+.PP
+Definition at line 236 of file table_data.c.
+.PP
+References netsnmp_create_handler(), and netsnmp_table_data_helper_handler().
+.PP
+Referenced by netsnmp_register_table_data().
+.SS "int netsnmp_register_read_only_table_data (netsnmp_handler_registration * reginfo, netsnmp_table_data * table, netsnmp_table_registration_info * table_info)"
+.PP
+registers a handler as a read-only data table If table_info != NULL, it registers it as a normal table too.
+.PP
+Definition at line 269 of file table_data.c.
+.PP
+References netsnmp_get_read_only_handler(), netsnmp_inject_handler(), and netsnmp_register_table_data().
+.SS "int netsnmp_register_table_data (netsnmp_handler_registration * reginfo, netsnmp_table_data * table, netsnmp_table_registration_info * table_info)"
+.PP
+registers a handler as a data table.
+.PP
+If table_info != NULL, it registers it as a normal table too. 
+.PP
+Definition at line 258 of file table_data.c.
+.PP
+References netsnmp_get_table_data_handler(), netsnmp_inject_handler(), and netsnmp_register_table().
+.PP
+Referenced by netsnmp_register_read_only_table_data(), and netsnmp_register_table_data_set().
+.SS "int netsnmp_table_data_add_row (netsnmp_table_data * table, netsnmp_table_row * row)"
+.PP
+Adds a row of data to a given table (stored in proper lexographical order).
+.PP
+returns SNMPERR_SUCCESS on successful addition. or SNMPERR_GENERR on failure (E.G., indexes already existed) 
+.PP
+Definition at line 51 of file table_data.c.
+.PP
+References netsnmp_table_data_generate_index_oid(), and snmp_oid_compare().
+.PP
+Referenced by netsnmp_table_data_replace_row(), and netsnmp_table_dataset_add_row().
+.SS "int netsnmp_table_data_build_result (netsnmp_handler_registration * reginfo, netsnmp_agent_request_info * reqinfo, netsnmp_request_info * request, netsnmp_table_row * row, int column, u_char type, u_char * result_data, size_t result_data_len)"
+.PP
+builds a result given a row, a varbind to set and the data
+.PP
+Definition at line 564 of file table_data.c.
+.PP
+Referenced by netsnmp_table_data_helper_handler(), and netsnmp_table_data_set_helper_handler().
+.SS "netsnmp_table_row* netsnmp_table_data_clone_row (netsnmp_table_row * row)"
+.PP
+clones a data row.
+.PP
+DOES NOT CLONE THE CONTAINED DATA. 
+.PP
+Definition at line 598 of file table_data.c.
+.PP
+Referenced by netsnmp_table_data_set_clone_row().
+.SS "void* netsnmp_table_data_delete_row (netsnmp_table_row * row)"
+.PP
+deletes a row's memory.
+.PP
+returns the void data that it doesn't know how to delete. 
+.PP
+Definition at line 150 of file table_data.c.
+.PP
+Referenced by netsnmp_table_data_remove_and_delete_row(), and netsnmp_table_dataset_delete_row().
+.SS "void netsnmp_table_data_generate_index_oid (netsnmp_table_row * row)"
+.PP
+generates the index portion of an table oid from a varlist.
+.PP
+Definition at line 39 of file table_data.c.
+.PP
+Referenced by netsnmp_table_data_add_row().
+.SS "netsnmp_table_row* netsnmp_table_data_get (netsnmp_table_data * table, netsnmp_variable_list * indexes)"
+.PP
+finds the data in 'datalist' stored at 'indexes'
+.PP
+Definition at line 204 of file table_data.c.
+.PP
+References netsnmp_table_data_get_from_oid().
+.SS "netsnmp_table_row* netsnmp_table_data_get_from_oid (netsnmp_table_data * table, oid * searchfor, size_t searchfor_len)"
+.PP
+finds the data in 'datalist' stored at the searchfor oid
+.PP
+Definition at line 218 of file table_data.c.
+.PP
+References snmp_oid_compare().
+.PP
+Referenced by netsnmp_table_data_get(), and netsnmp_table_data_helper_handler().
+.SS "int netsnmp_table_data_helper_handler (netsnmp_mib_handler * handler, netsnmp_handler_registration * reginfo, netsnmp_agent_request_info * reqinfo, netsnmp_request_info * requests)"
+.PP
+The helper handler that takes care of passing a specific row of data down to the lower handler(s).
+.PP
+It sets request->processed if the request should not be handled. 
+.PP
+Definition at line 285 of file table_data.c.
+.PP
+References netsnmp_call_next_handler(), netsnmp_extract_table_info(), netsnmp_find_table_registration_info(), netsnmp_request_add_list_data(), netsnmp_table_data_build_result(), netsnmp_table_data_get_from_oid(), and snmp_oid_compare().
+.PP
+Referenced by netsnmp_get_table_data_handler().
+.SS "void* netsnmp_table_data_remove_and_delete_row (netsnmp_table_data * table, netsnmp_table_row * row)"
+.PP
+removes and frees a row of data to a given table and returns the void *
+.PP
+returns the void * data on successful deletion. or NULL on failure (bad arguments) 
+.PP
+Definition at line 179 of file table_data.c.
+.PP
+References netsnmp_table_data_delete_row(), and netsnmp_table_data_remove_row().
+.PP
+Referenced by netsnmp_table_dataset_remove_and_delete_row(), and netsnmp_table_dataset_remove_row().
+.SS "netsnmp_table_row* netsnmp_table_data_remove_row (netsnmp_table_data * table, netsnmp_table_row * row)"
+.PP
+removes a row of data to a given table and returns it (no free's called)
+.PP
+returns the row pointer itself on successful removing. or NULL on failure (bad arguments) 
+.PP
+Definition at line 130 of file table_data.c.
+.PP
+Referenced by netsnmp_table_data_remove_and_delete_row(), and netsnmp_table_data_replace_row().
+.SS "NETSNMP_INLINE void netsnmp_table_data_replace_row (netsnmp_table_data * table, netsnmp_table_row * origrow, netsnmp_table_row * newrow)"
+.PP
+swaps out origrow with newrow.
+.PP
+This does *not* delete/free anything! 
+.PP
+Definition at line 194 of file table_data.c.
+.PP
+References netsnmp_table_data_add_row(), and netsnmp_table_data_remove_row().
+.PP
+Referenced by netsnmp_table_dataset_replace_row().
diff -Naur tomato/release/src/router/snmp/man/netsnmp_table_dataset.3 tomato121/release/src/router/snmp/man/netsnmp_table_dataset.3
--- tomato/release/src/router/snmp/man/netsnmp_table_dataset.3	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/man/netsnmp_table_dataset.3	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,348 @@
+.TH "table_dataset: Helps you implement a table with automatted storage." 3 "5 Sep 2003" "net-snmp" \" -*- nroff -*-
+.ad l
+.nh
+.SH NAME
+table_dataset: Helps you implement a table with automatted storage. \- This handler helps you implement a table where all the data is expected to be stored within the agent itself and not in some external storage location. 
+More...
+.SS "Functions"
+
+.in +1c
+.ti -1c
+.RI "netsnmp_table_data_set * \fBnetsnmp_create_table_data_set\fP (const char *table_name)"
+.br
+.RI "\fICreate a netsnmp_table_data_set structure given a table_data definition.\fP"
+.ti -1c
+.RI "netsnmp_mib_handler * \fBnetsnmp_get_table_data_set_handler\fP (netsnmp_table_data_set *data_set)"
+.br
+.RI "\fIGiven a netsnmp_table_data_set definition, create a handler for it.\fP"
+.ti -1c
+.RI "int \fBnetsnmp_register_table_data_set\fP (netsnmp_handler_registration *reginfo, netsnmp_table_data_set *data_set, netsnmp_table_registration_info *table_info)"
+.br
+.RI "\fIregister a given data_set at a given oid (specified in the netsnmp_handler_registration pointer).\fP"
+.ti -1c
+.RI "netsnmp_table_data_set_storage * \fBnetsnmp_table_data_set_find_column\fP (netsnmp_table_data_set_storage *start, unsigned int column)"
+.br
+.RI "\fIFinds a column within a given storage set, given the pointer to the start of the storage set list.\fP"
+.ti -1c
+.RI "netsnmp_table_data_set_storage * \fBnetsnmp_extract_table_data_set_column\fP (netsnmp_request_info *request, unsigned int column)"
+.br
+.RI "\fIextracts a netsnmp_table_data_set pointer from a given request\fP"
+.ti -1c
+.RI "NETSNMP_INLINE netsnmp_table_data_set * \fBnetsnmp_extract_table_data_set\fP (netsnmp_request_info *request)"
+.br
+.RI "\fIextracts a netsnmp_table_data_set pointer from a given request\fP"
+.ti -1c
+.RI "int \fBnetsnmp_mark_row_column_writable\fP (netsnmp_table_row *row, int column, int writable)"
+.br
+.RI "\fImarks a given column in a row as writable or not.\fP"
+.ti -1c
+.RI "int \fBnetsnmp_set_row_column\fP (netsnmp_table_row *row, unsigned int column, int type, const char *value, size_t value_len)"
+.br
+.RI "\fIsets a given column in a row with data given a type, value, and length.\fP"
+.ti -1c
+.RI "int \fBnetsnmp_table_set_add_default_row\fP (netsnmp_table_data_set *table_set, unsigned int column, int type, int writable, void *default_value, size_t default_value_len)"
+.br
+.RI "\fIadds a new default row to a table_set.\fP"
+.ti -1c
+.RI "netsnmp_table_row * \fBnetsnmp_table_data_set_clone_row\fP (netsnmp_table_row *row)"
+.br
+.RI "\fIclones a dataset row, including all data.\fP"
+.ti -1c
+.RI "netsnmp_table_row * \fBnetsnmp_table_data_set_create_row_from_defaults\fP (netsnmp_table_data_set_storage *defrow)"
+.br
+.RI "\fIcreates a new row from an existing defined default set\fP"
+.ti -1c
+.RI "int \fBnetsnmp_table_data_set_helper_handler\fP (netsnmp_mib_handler *handler, netsnmp_handler_registration *reginfo, netsnmp_agent_request_info *reqinfo, netsnmp_request_info *requests)"
+.br
+.RI "\fIimplements the table data helper.\fP"
+.ti -1c
+.RI "void \fBnetsnmp_register_auto_data_table\fP (netsnmp_table_data_set *table_set, char *registration_name)"
+.br
+.RI "\fIregisters a table_dataset so that the 'add_row' snmpd.conf token can be used to add data to this table.\fP"
+.ti -1c
+.RI "NETSNMP_INLINE void \fBnetsnmp_table_dataset_add_index\fP (netsnmp_table_data_set *table, u_char type)"
+.br
+.RI "\fIadds an index to the table.\fP"
+.ti -1c
+.RI "NETSNMP_INLINE void \fBnetsnmp_table_dataset_add_row\fP (netsnmp_table_data_set *table, netsnmp_table_row *row)"
+.br
+.RI "\fIadds a new row to a dataset table\fP"
+.ti -1c
+.RI "NETSNMP_INLINE void \fBnetsnmp_table_dataset_replace_row\fP (netsnmp_table_data_set *table, netsnmp_table_row *origrow, netsnmp_table_row *newrow)"
+.br
+.RI "\fIadds a new row to a dataset table\fP"
+.ti -1c
+.RI "NETSNMP_INLINE netsnmp_table_data_set_storage * \fBnetsnmp_table_dataset_delete_data\fP (netsnmp_table_data_set_storage *data)"
+.br
+.RI "\fIdeletes a single dataset table data.\fP"
+.ti -1c
+.RI "NETSNMP_INLINE void \fBnetsnmp_table_dataset_delete_all_data\fP (netsnmp_table_data_set_storage *data)"
+.br
+.RI "\fIdeletes all the data from this node and beyond in the linked list\fP"
+.ti -1c
+.RI "NETSNMP_INLINE void \fBnetsnmp_table_dataset_delete_row\fP (netsnmp_table_row *row)"
+.br
+.RI "\fIdeletes all the data from this node and beyond in the linked list\fP"
+.ti -1c
+.RI "NETSNMP_INLINE void \fBnetsnmp_table_dataset_remove_row\fP (netsnmp_table_data_set *table, netsnmp_table_row *row)"
+.br
+.RI "\fIremoves a row from the table, but doesn't delete/free anything\fP"
+.ti -1c
+.RI "NETSNMP_INLINE void \fBnetsnmp_table_dataset_remove_and_delete_row\fP (netsnmp_table_data_set *table, netsnmp_table_row *row)"
+.br
+.RI "\fIremoves a row from the table and then deletes it (and all it's data)\fP"
+.ti -1c
+.RI "void \fBnetsnmp_table_set_multi_add_default_row\fP (va_dcl) va_dcl"
+.br
+.RI "\fIadds multiple data column definitions to each row.\fP"
+.ti -1c
+.RI "void \fBnetsnmp_table_set_add_indexes\fP (va_alist) va_dcl"
+.br
+.RI "\fIadds multiple indexes to a table_dataset helper object.\fP"
+.in -1c
+.SH "DETAILED DESCRIPTION"
+.PP 
+This handler helps you implement a table where all the data is expected to be stored within the agent itself and not in some external storage location.
+.PP
+It handles all MIB requests including GETs, GETNEXTs and SETs. It's possible to simply create a table without actually ever defining a handler to be called when SNMP requests come in. To use the data, you can either attach a sub-handler that merely uses/manipulates the data further when requests come in, or you can loop through it externally when it's actually needed. This handler is most useful in cases where a table is holding configuration data for something which gets triggered via another event.
+.PP
+NOTE NOTE NOTE: This helper isn't complete and is likely to change somewhat over time. Specifically, the way it stores data internally may change drastically. 
+.SH "FUNCTION DOCUMENTATION"
+.PP 
+.SS "netsnmp_table_data_set* netsnmp_create_table_data_set (const char * table_name)"
+.PP
+Create a netsnmp_table_data_set structure given a table_data definition.
+.PP
+\fBExamples: \fP
+.in +1c
+\fBdata_set.c\fP.
+.PP
+Definition at line 63 of file table_dataset.c.
+.PP
+References netsnmp_create_table_data().
+.SS "NETSNMP_INLINE netsnmp_table_data_set* netsnmp_extract_table_data_set (netsnmp_request_info * request)"
+.PP
+extracts a netsnmp_table_data_set pointer from a given request
+.PP
+Definition at line 175 of file table_dataset.c.
+.PP
+References netsnmp_request_get_list_data().
+.SS "netsnmp_table_data_set_storage* netsnmp_extract_table_data_set_column (netsnmp_request_info * request, unsigned int column)"
+.PP
+extracts a netsnmp_table_data_set pointer from a given request
+.PP
+Definition at line 161 of file table_dataset.c.
+.PP
+References netsnmp_extract_table_row_data(), and netsnmp_table_data_set_find_column().
+.SS "netsnmp_mib_handler* netsnmp_get_table_data_set_handler (netsnmp_table_data_set * data_set)"
+.PP
+Given a netsnmp_table_data_set definition, create a handler for it.
+.PP
+Definition at line 75 of file table_dataset.c.
+.PP
+References netsnmp_create_handler(), and netsnmp_table_data_set_helper_handler().
+.PP
+Referenced by netsnmp_register_table_data_set().
+.SS "int netsnmp_mark_row_column_writable (netsnmp_table_row * row, int column, int writable)"
+.PP
+marks a given column in a row as writable or not.
+.PP
+\fBExamples: \fP
+.in +1c
+\fBdata_set.c\fP.
+.PP
+Definition at line 185 of file table_dataset.c.
+.PP
+References netsnmp_table_data_set_find_column().
+.PP
+Referenced by netsnmp_table_data_set_create_row_from_defaults().
+.SS "void netsnmp_register_auto_data_table (netsnmp_table_data_set * table_set, char * registration_name)"
+.PP
+registers a table_dataset so that the 'add_row' snmpd.conf token can be used to add data to this table.
+.PP
+If registration_name is NULL then the name used when the table was created will be used instead.
+.PP
+\fBTodo: \fP
+.in +1c
+ create a properly free'ing registeration pointer for the datalist, and get the datalist freed at shutdown.  
+.PP
+\fBExamples: \fP
+.in +1c
+\fBdata_set.c\fP.
+.PP
+Definition at line 727 of file table_dataset.c.
+.SS "int netsnmp_register_table_data_set (netsnmp_handler_registration * reginfo, netsnmp_table_data_set * data_set, netsnmp_table_registration_info * table_info)"
+.PP
+register a given data_set at a given oid (specified in the netsnmp_handler_registration pointer).
+.PP
+The reginfo->handler->access_method *may* be null if the call doesn't ever want to be called for SNMP operations. 
+.PP
+\fBExamples: \fP
+.in +1c
+\fBdata_set.c\fP.
+.PP
+Definition at line 101 of file table_dataset.c.
+.PP
+References netsnmp_get_table_data_set_handler(), netsnmp_inject_handler(), and netsnmp_register_table_data().
+.SS "int netsnmp_set_row_column (netsnmp_table_row * row, unsigned int column, int type, const char * value, size_t value_len)"
+.PP
+sets a given column in a row with data given a type, value, and length.
+.PP
+Data is memdup'ed by the function. 
+.PP
+\fBExamples: \fP
+.in +1c
+\fBdata_set.c\fP.
+.PP
+Definition at line 221 of file table_dataset.c.
+.PP
+References netsnmp_table_data_set_find_column().
+.PP
+Referenced by netsnmp_table_data_set_create_row_from_defaults().
+.SS "netsnmp_table_row* netsnmp_table_data_set_clone_row (netsnmp_table_row * row)"
+.PP
+clones a dataset row, including all data.
+.PP
+Definition at line 321 of file table_dataset.c.
+.PP
+References netsnmp_table_data_clone_row().
+.PP
+Referenced by netsnmp_table_data_set_helper_handler().
+.SS "netsnmp_table_row* netsnmp_table_data_set_create_row_from_defaults (netsnmp_table_data_set_storage * defrow)"
+.PP
+creates a new row from an existing defined default set
+.PP
+Definition at line 355 of file table_dataset.c.
+.PP
+References netsnmp_create_table_data_row(), netsnmp_mark_row_column_writable(), and netsnmp_set_row_column().
+.SS "netsnmp_table_data_set_storage* netsnmp_table_data_set_find_column (netsnmp_table_data_set_storage * start, unsigned int column)"
+.PP
+Finds a column within a given storage set, given the pointer to the start of the storage set list.
+.PP
+Definition at line 149 of file table_dataset.c.
+.PP
+Referenced by netsnmp_extract_table_data_set_column(), netsnmp_mark_row_column_writable(), netsnmp_set_row_column(), netsnmp_table_data_set_helper_handler(), and netsnmp_table_set_add_default_row().
+.SS "int netsnmp_table_data_set_helper_handler (netsnmp_mib_handler * handler, netsnmp_handler_registration * reginfo, netsnmp_agent_request_info * reqinfo, netsnmp_request_info * requests)"
+.PP
+implements the table data helper.
+.PP
+This is the routine that takes care of all SNMP requests coming into the table. 
+.PP
+Definition at line 393 of file table_dataset.c.
+.PP
+References netsnmp_call_next_handler(), netsnmp_extract_table_info(), netsnmp_extract_table_row(), netsnmp_request_add_list_data(), netsnmp_table_data_build_result(), netsnmp_table_data_set_clone_row(), netsnmp_table_data_set_find_column(), netsnmp_table_dataset_add_row(), netsnmp_table_dataset_delete_row(), netsnmp_table_dataset_remove_and_delete_row(), and netsnmp_table_dataset_replace_row().
+.PP
+Referenced by netsnmp_get_table_data_set_handler().
+.SS "NETSNMP_INLINE void netsnmp_table_dataset_add_index (netsnmp_table_data_set * table, u_char type)"
+.PP
+adds an index to the table.
+.PP
+Call this repeatly for each index. 
+.PP
+\fBExamples: \fP
+.in +1c
+\fBdata_set.c\fP.
+.PP
+Definition at line 911 of file table_dataset.c.
+.PP
+Referenced by netsnmp_table_set_add_indexes().
+.SS "NETSNMP_INLINE void netsnmp_table_dataset_add_row (netsnmp_table_data_set * table, netsnmp_table_row * row)"
+.PP
+adds a new row to a dataset table
+.PP
+\fBExamples: \fP
+.in +1c
+\fBdata_set.c\fP.
+.PP
+Definition at line 920 of file table_dataset.c.
+.PP
+References netsnmp_table_data_add_row().
+.PP
+Referenced by netsnmp_table_data_set_helper_handler().
+.SS "NETSNMP_INLINE void netsnmp_table_dataset_delete_all_data (netsnmp_table_data_set_storage * data)"
+.PP
+deletes all the data from this node and beyond in the linked list
+.PP
+Definition at line 956 of file table_dataset.c.
+.PP
+References netsnmp_table_dataset_delete_data().
+.PP
+Referenced by netsnmp_table_dataset_delete_row(), and netsnmp_table_dataset_remove_and_delete_row().
+.SS "NETSNMP_INLINE netsnmp_table_data_set_storage* netsnmp_table_dataset_delete_data (netsnmp_table_data_set_storage * data)"
+.PP
+deletes a single dataset table data.
+.PP
+returns the (possibly still good) next pointer of the deleted data object. 
+.PP
+Definition at line 943 of file table_dataset.c.
+.PP
+Referenced by netsnmp_table_dataset_delete_all_data().
+.SS "NETSNMP_INLINE void netsnmp_table_dataset_delete_row (netsnmp_table_row * row)"
+.PP
+deletes all the data from this node and beyond in the linked list
+.PP
+Definition at line 966 of file table_dataset.c.
+.PP
+References netsnmp_table_data_delete_row(), and netsnmp_table_dataset_delete_all_data().
+.PP
+Referenced by netsnmp_table_data_set_helper_handler().
+.SS "NETSNMP_INLINE void netsnmp_table_dataset_remove_and_delete_row (netsnmp_table_data_set * table, netsnmp_table_row * row)"
+.PP
+removes a row from the table and then deletes it (and all it's data)
+.PP
+Definition at line 990 of file table_dataset.c.
+.PP
+References netsnmp_table_data_remove_and_delete_row(), and netsnmp_table_dataset_delete_all_data().
+.PP
+Referenced by netsnmp_table_data_set_helper_handler().
+.SS "NETSNMP_INLINE void netsnmp_table_dataset_remove_row (netsnmp_table_data_set * table, netsnmp_table_row * row)"
+.PP
+removes a row from the table, but doesn't delete/free anything
+.PP
+Definition at line 979 of file table_dataset.c.
+.PP
+References netsnmp_table_data_remove_and_delete_row().
+.SS "NETSNMP_INLINE void netsnmp_table_dataset_replace_row (netsnmp_table_data_set * table, netsnmp_table_row * origrow, netsnmp_table_row * newrow)"
+.PP
+adds a new row to a dataset table
+.PP
+Definition at line 930 of file table_dataset.c.
+.PP
+References netsnmp_table_data_replace_row().
+.PP
+Referenced by netsnmp_table_data_set_helper_handler().
+.SS "int netsnmp_table_set_add_default_row (netsnmp_table_data_set * table_set, unsigned int column, int type, int writable, void * default_value, size_t default_value_len)"
+.PP
+adds a new default row to a table_set.
+.PP
+Arguments should be the table_set, column number, variable type and finally a 1 if it is allowed to be writable, or a 0 if not. If the default_value field is not NULL, it will be used to populate new valuse in that column fro newly created rows. It is copied into the storage template (free your calling argument).
+.PP
+returns SNMPERR_SUCCESS or SNMPERR_FAILURE 
+.PP
+Definition at line 277 of file table_dataset.c.
+.PP
+References netsnmp_table_data_set_find_column().
+.PP
+Referenced by netsnmp_table_set_multi_add_default_row().
+.SS "void netsnmp_table_set_add_indexes (va_alist)"
+.PP
+adds multiple indexes to a table_dataset helper object.
+.PP
+To end the list, use a 0 after the list of ASN index types. 
+.PP
+Definition at line 1051 of file table_dataset.c.
+.PP
+References netsnmp_table_dataset_add_index().
+.SS "void netsnmp_table_set_multi_add_default_row (va_dcl)"
+.PP
+adds multiple data column definitions to each row.
+.PP
+Functionally, this is a wrapper around calling netsnmp_table_set_add_default_row repeatedly for you. 
+.PP
+\fBExamples: \fP
+.in +1c
+\fBdata_set.c\fP.
+.PP
+Definition at line 1012 of file table_dataset.c.
+.PP
+References netsnmp_table_set_add_default_row().
diff -Naur tomato/release/src/router/snmp/man/netsnmp_table_iterator.3 tomato121/release/src/router/snmp/man/netsnmp_table_iterator.3
--- tomato/release/src/router/snmp/man/netsnmp_table_iterator.3	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/man/netsnmp_table_iterator.3	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,6 @@
+.TH "table_iterator: The table iterator helper is designed to simplify the task of writing a table handler for the net-snmp agent when the data being accessed is not in an oid sorted form and must be accessed externally." 3 "5 Sep 2003" "net-snmp" \" -*- nroff -*-
+.ad l
+.nh
+.SH NAME
+table_iterator: The table iterator helper is designed to simplify the task of writing a table handler for the net-snmp agent when the data being accessed is not in an oid sorted form and must be accessed externally. \- Functionally, it is a specialized version of the more generic table helper but easies the burden of GETNEXT processing by manually looping through all the data indexes retrieved through function calls which should be supplied by the module that wishes help. 
+More...The module the table_iterator helps should, afterwards, never be called for the case of 'MODE_GETNEXT' and only for the GET and SET related modes instead. 
diff -Naur tomato/release/src/router/snmp/man/netsnmp_todo.3 tomato121/release/src/router/snmp/man/netsnmp_todo.3
--- tomato/release/src/router/snmp/man/netsnmp_todo.3	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/man/netsnmp_todo.3	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,13 @@
+.TH "todo" 3 "5 Sep 2003" "net-snmp" \" -*- nroff -*-
+.ad l
+.nh
+.SH NAME
+todo \- Todo List
+.IP "Global \fBcheck_acm\fP(netsnmp_agent_session *asp, u_char type) " 1c
+ make this be more intelligent about ranges. Right now we merely take the highest level commonality of a registration range and use that. At times we might be able to be smarter about checking the range itself as opposed to the node above where the range exists, but I doubt this will come up all that frequently.
+.PP
+.IP "Global \fBnetsnmp_table_get_or_create_row_stash\fP(netsnmp_agent_request_info *reqinfo, const u_char *storage_name) " 1c
+ This function will likely change to add free pointer functions.
+.PP
+.IP "Global \fBnetsnmp_register_auto_data_table\fP(netsnmp_table_data_set *table_set, char *registration_name) " 1c
+ create a properly free'ing registeration pointer for the datalist, and get the datalist freed at shutdown.  
diff -Naur tomato/release/src/router/snmp/man/netsnmp_watcher.3 tomato121/release/src/router/snmp/man/netsnmp_watcher.3
--- tomato/release/src/router/snmp/man/netsnmp_watcher.3	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/man/netsnmp_watcher.3	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,11 @@
+.TH "watcher: watch a specified variable and process" 3 "5 Sep 2003" "net-snmp" \" -*- nroff -*-
+.ad l
+.nh
+.SH NAME
+watcher: watch a specified variable and process \- it as an instance or scalar object 
+More...
+.SH "DETAILED DESCRIPTION"
+.PP 
+it as an instance or scalar object
+.PP
+
diff -Naur tomato/release/src/router/snmp/man/print_description.3 tomato121/release/src/router/snmp/man/print_description.3
--- tomato/release/src/router/snmp/man/print_description.3	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/man/print_description.3	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1 @@
+.so man3/mib_api.3
diff -Naur tomato/release/src/router/snmp/man/print_mib.3 tomato121/release/src/router/snmp/man/print_mib.3
--- tomato/release/src/router/snmp/man/print_mib.3	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/man/print_mib.3	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1 @@
+.so man3/mib_api.3
diff -Naur tomato/release/src/router/snmp/man/print_objid.3 tomato121/release/src/router/snmp/man/print_objid.3
--- tomato/release/src/router/snmp/man/print_objid.3	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/man/print_objid.3	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1 @@
+.so man3/mib_api.3
diff -Naur tomato/release/src/router/snmp/man/print_value.3 tomato121/release/src/router/snmp/man/print_value.3
--- tomato/release/src/router/snmp/man/print_value.3	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/man/print_value.3	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1 @@
+.so man3/mib_api.3
diff -Naur tomato/release/src/router/snmp/man/print_variable.3 tomato121/release/src/router/snmp/man/print_variable.3
--- tomato/release/src/router/snmp/man/print_variable.3	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/man/print_variable.3	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1 @@
+.so man3/mib_api.3
diff -Naur tomato/release/src/router/snmp/man/read_all_mibs.3 tomato121/release/src/router/snmp/man/read_all_mibs.3
--- tomato/release/src/router/snmp/man/read_all_mibs.3	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/man/read_all_mibs.3	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1 @@
+.so man3/mib_api.3
diff -Naur tomato/release/src/router/snmp/man/read_config.3.def tomato121/release/src/router/snmp/man/read_config.3.def
--- tomato/release/src/router/snmp/man/read_config.3.def	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/man/read_config.3.def	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,292 @@
+.TH READ_CONFIG 3 "07 Mar 2002" "" "Net-SNMP"
+.UC 5
+.SH NAME
+register_config_handler, register_premib_handler
+unregister_config_handler, register_mib_handlers, read_configs,
+read_premib_configs, config_perror, config_pwarn - read_config functions
+.SH SYNOPSIS
+.B #include <net-snmp/config_api.h>
+.PP
+.B struct config_line *
+.br
+.BI "  register_config_handler(const char *" filePrefix ",
+.br
+.BI "                     const char *" token ,
+.br
+.BI "                     void (*" parser ")(const char *, char *),"
+.br
+.BI "                     void (*" releaser ")(void),"
+.br
+.BI "                     const char *"usageLine ");"
+.PP
+.B struct config_line *
+.br
+.BI "  register_premib_handler(const char *" filePrefix ", 
+.br
+.BI "                     const char *" token ,
+.br
+.BI "                     void (*" parser ")(const char *, char *),"
+.br
+.BI "                     void (*" releaser ")(void),"
+.br
+.BI "                     const char *" usageLine ");"
+.PP
+.BI "void unregister_config_handler(const char *" filePrefix ","
+.br
+.BI "                     const char *" token ");"
+.PP
+.B struct config_line *
+.br
+.BI "  register_app_config_handler(const char *" token ,
+.br
+.BI "                     void (*" parser ")(const char *, char *),"
+.br
+.BI "                     void (*" releaser ")(void),"
+.br
+.BI "                     const char *"usageLine ");"
+.PP
+.B struct config_line *
+.br
+.BI "  register_app_premib_handler(const char *" token ,
+.br
+.BI "                     void (*" parser ")(const char *, char *),"
+.br
+.BI "                     void (*" releaser ")(void),"
+.br
+.BI "                     const char *" usageLine ");"
+.PP
+.BI "void unregister_app_config_handler(const char *" token ");"
+.PP
+.BI "void read_config_print_usage(char *" lead ");"
+.PP
+.B "void read_configs(void);"
+.PP
+.B "void read_premib_configs(void);"
+.PP
+.BI "void config_pwarn(const char *" string ");"
+.br
+.BI "void config_perror(const char *" string ");"
+
+.SH DESCRIPTION
+The functions are a fairly extensible system of parsing various
+configuration files at the run time of an application.  The
+configuration file flow is broken into the following phases:
+.RS 4
+.TP 4
+1.
+Registration of handlers.
+.TP
+2.
+Reading of the configuration files for pre-MIB parsing requirements.
+.TP
+3.
+Reading and parsing of the textual MIB files.
+.TP
+4.
+Reading of the configuration files for configuration directives.
+.TP
+5.
+Optionally re-reading the configuration files at a future date.
+.RE
+.PP
+The idea is that the calling application is able to register
+.I handlers
+for certain
+.I tokens
+specified in certain types of
+.I files.
+The 
+.B read_configs()
+function can then be called to look for all the files that it has
+registrations for, find the first word on each line, and pass the
+remainder to the appropriately registered handler.
+.SH TOKEN HANDLERS
+.PP
+Handler functions should have the following signature:
+.PP
+.RS
+.BI "void handler(const char *" token ", char *" line ");"
+.RE
+.PP
+The function will be called with two arguments, the first being the
+token that triggered the call to this function (which would be one of
+the tokens that the function had been registered for), and the second
+being the remainder of the configuration file line beyond the white
+space following the token.
+.SH RESOURCE FREEING HANDLERS
+.PP
+If the parameter
+.I releaser
+passed to
+.B register_config_handler
+is non-NULL, then the function specified is called if and when the
+configuration files are re-read.  This function should free any
+resources allocated by the token handler function and reset its notion
+of the configuration to its default.  The token handler function will
+then be called again.  No arguments are passed to the resource freeing
+handler.
+.SH REGISTERING A HANDLER
+.TP
+.B register_config_handler()
+The
+.B handler()
+function above could be registered for the configuration file
+.I snmp.conf,
+with the token
+.I genericToken
+and the help string (discussed later)
+.I """ARG1 [ARG2]"""
+using the following call to the 
+.B register_config_handler()
+function:
+.PP
+.RS
+.RS
+register_config_handler("snmp", "genericToken", handler, NULL, "ARG1 [ARG2]");
+.RE
+.RE
+.IP
+This would register the
+.B handler()
+function so that it will get called every time the first word of a
+line in the 
+.I snmp.conf
+configuration file(s) matches "genericToken" (see 
+.B read_configs() 
+below).
+.B register_premib_handler()
+The 
+.B register_premib_handler()
+function works identically to the 
+.B register_config_handler()
+function but is intended for config file tokens that need to be read
+in before the textual MIBs are read in, probably because they will be
+used to configure the MIB parser.  It is rarely the case that anything 
+but the SNMP library itself should need to use this function.
+.TP
+.B unregister_config_handler()
+Removes the registered configuration handler for the
+.I filePrefix
+and
+.IR token .
+
+.TP
+.B register_app_config_handler()
+.TP
+.B register_app_premib_handler()
+.TP
+.B unregister_app_config_handler()
+These functions are analagous to 
+.BR register_config_handler() ", " register_premib_handler() " and "
+.B unregister_config_handler()
+but don't require the file type argument (which is filled in by the
+application).  It is intended that MIB modules written for the agent
+use these functions to allow the agent to have more control over which
+configuration files are read (typically the
+.I snmpd.conf
+files).
+.SH HELP STRINGS
+.PP
+The
+.I usageLine
+parameter passed to
+.B register_config_handler()
+and similar calls, is used to display help information when the
+.B read_config_print_usage()
+function is called.  This function is used by all of the applications
+when the 
+.B -H
+flag is passed on the command line.  It prints a summary of all of the
+configuration file lines, and the associated files, that the
+configuration system understands.  The
+.I usageLine
+parameter should be a list of arguments expected after the token, and
+not a lengthy description (which should go into a manual page
+instead).  The
+.I lead
+prefix will be prepended to each line that the function prints to
+stderr, where it displays its output.
+.PP
+The
+.B init_snmp()
+function should be called before the
+.B read_config_print_usage()
+function is called, so that the library can register its configuration 
+file directives as well for the 
+.B read_config_print_usage()
+function to display.
+.SH READING CONFIGURATION FILES
+.TP
+.B init_snmp()
+Once the relevant configuration token parsers have been registered,
+.B init_snmp()
+should be called.  It will parse the configuration file tokens
+registered with
+.B register_premib_handler(),
+read in the textual MIB files using
+.B init_mib(),
+and finally parse the configuration file tokens registered with 
+.BR register_config_handler() .
+.PP
+If the 
+.B init_snmp()
+function is used, none of the following functions need to be called by 
+the application:
+.TP
+.B register_mib_handlers()
+The SNMP library's routine to register its configuration file
+handlers.
+.TP
+.B read_premib_configs()
+The routine that parses the configuration files for tokens registered
+to be dealt with before the textual MIBs are read in.  See 
+.B read_configs()
+below.
+.TP
+.B read_configs()
+Reads all the configuration files it can find in the 
+.I SNMPCONFPATH
+environment variable (or its default value) for tokens and
+appropriately calls the handlers registered to it, or prints a
+"Unknown token" warning message.  It looks for any file that it has
+previously received a registration request for.
+.SH CONFIGURATION FILES READ
+.PP
+The configuration files read are found by using the colon separated
+.I SNMPCONFPATH
+environment variable (or its default value, which will be
+SYSCONFDIR/snmp, followed by
+DATADIR/snmp, followed by LIBDIR/snmp, followed by $HOME/.snmp) and
+reading in the files found that match both the prefix registered and
+the two suffixes
+.I .conf
+and
+.I .local.conf.
+The idea behind the two different suffixes is that the first file can
+be shared (via rdist or an NFS mount) across a large number of
+machines and the second file can be used to configure local settings
+for one particular machine.  They do not need to be present, and will
+only be read if found.
+.SH ERROR HANDLING FUNCTIONS
+.PP
+The two functions
+.B config_pwarn()
+and
+.B config_perror()
+both take an error string as an argument and print it to stderr along
+with the file and line number that caused the error.  A call to the
+second function will also force 
+.B read_configs() 
+to eventually return with an error code indicating to it's calling
+function that it should abort the operation of the application.
+.SH "ENVIRONMENT VARIABLES"
+.TP 10
+SNMPCONFPATH
+A colon separated list of directories to search for configuration
+files in.
+Default: SYSCONFDIR/snmp:DATADIR/snmp:LIBDIR/snmp:$HOME/.snmp
+.SH "SEE ALSO"
+.BR mib_api "(3), " snmp_api (3)
+.\" Local Variables:
+.\"  mode: nroff
+.\" End:
diff -Naur tomato/release/src/router/snmp/man/read_mib.3 tomato121/release/src/router/snmp/man/read_mib.3
--- tomato/release/src/router/snmp/man/read_mib.3	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/man/read_mib.3	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1 @@
+.so man3/mib_api.3
diff -Naur tomato/release/src/router/snmp/man/read_module.3 tomato121/release/src/router/snmp/man/read_module.3
--- tomato/release/src/router/snmp/man/read_module.3	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/man/read_module.3	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1 @@
+.so man3/mib_api.3
diff -Naur tomato/release/src/router/snmp/man/read_module_node.3 tomato121/release/src/router/snmp/man/read_module_node.3
--- tomato/release/src/router/snmp/man/read_module_node.3	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/man/read_module_node.3	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1 @@
+.so man3/mib_api.3
diff -Naur tomato/release/src/router/snmp/man/read_objid.3 tomato121/release/src/router/snmp/man/read_objid.3
--- tomato/release/src/router/snmp/man/read_objid.3	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/man/read_objid.3	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1 @@
+.so man3/mib_api.3
diff -Naur tomato/release/src/router/snmp/man/shutdown_mib.3 tomato121/release/src/router/snmp/man/shutdown_mib.3
--- tomato/release/src/router/snmp/man/shutdown_mib.3	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/man/shutdown_mib.3	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1 @@
+.so man3/mib_api.3
diff -Naur tomato/release/src/router/snmp/man/snmp_agent_api.3.def tomato121/release/src/router/snmp/man/snmp_agent_api.3.def
--- tomato/release/src/router/snmp/man/snmp_agent_api.3.def	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/man/snmp_agent_api.3.def	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,133 @@
+.TH SNMP_AGENT_API 3 "02 Apr 2001" VVERSIONINFO "Net-SNMP"
+.UC 5
+.SH NAME
+snmp_agent_api \- embedding an agent into a external application
+.SH SYNOPSIS
+.nf
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+int
+main (int argc, char *argv[])
+{
+  int agentx_subagent = 1;  /* Change this if you're a master agent.  */
+
+  snmp_enable_stderrlog();
+
+  /*  If we're an AgentX subagent...  */
+  if (agentx_subagent) {
+      /* ...make us an AgentX client.  */
+      netsnmp_ds_set_boolean(NETSNMP_DS_APPLICATION_ID,
+                             NETSNMP_DS_AGENT_ROLE, 1);
+  }
+
+  init_agent("yourappname");
+
+  /*  Initialize your MIB code here.  */
+  init_my_mib_code();
+
+  /*  `yourappname' will be used to read yourappname.conf files.  */
+  init_snmp("yourappname");
+
+  /*  If we're going to be a SNMP master agent...  */
+  if (!agentx_subagent)
+      init_master_agent();  /*  Listen on default port (161).  */
+
+  /*  Your main loop here...  */
+  while (whatever) {
+      /* if you use select(), see snmp_api(3) */
+      /*     --- OR ---  */
+      agent_check_and_process(0); /* 0 == don't block */
+  }
+
+  /*  At shutdown time:  */
+  snmp_shutdown("yourappname");
+}
+
+Then:
+$(CC) ... `net-snmp-config --agent-libs`
+
+.fi
+.SH DESCRIPTION
+.PP
+Our goal is to create a easy to use interface to the Net-SNMP package
+such that you can take code that you have written that has been
+designed to be a Net-SNMP MIB module and embed it into an external
+application where you can either chose to be a SNMP master agent or an
+AgentX sub-agent using the same MIB module code.  Our suggestion is
+that you use our (or another) SNMP agent as the AgentX master agent
+and chose to become an AgentX subagent which then attaches to the
+master.
+.PP
+The Net-SNMP package provides a pair of libraries that enables easy
+embedding of an SNMP or AgentX agent into an external software
+package. AgentX is an extensible protocol designed to allow multiple
+SNMP sub-agents all run on one machine under a single SNMP master
+agent.  It is defined in RFC 2741.
+.PP
+You will need to perform a few tasks in order to accomplish
+this. First off, you will need to initialize both the SNMP library and
+the SNMP agent library. As indicated above, this is done slightly
+differently depending on whether or not you are going to perform as a
+master agent or an AgentX sub-agent.
+.SH CONFIGURATION
+.PP
+If you intend to operate as an AgentX sub-agent, you will have to
+configured the Net-SNMP package with agentx support (which is turned
+on by default, so just don't turn it off)
+.PP
+Additionally, you will need to link against the net-snmp libraries
+(use the output of "net-snmp-config --agent-libs" to get a library
+list) and call subagent_pre_init() as indicated above.
+.SH COMPILING
+.PP
+In order to make use of any of the above API, you will need to link
+against at least the four libraries listed above.
+.SH FUNCTIONS
+.PP This is a brief description of the functions called above and
+where to find out more information on them.  It is certainly not a
+complete list of what is available within all the net-snmp libraries. 
+.IP "snmp_enable_stderrlog()"
+Logs error output from the SNMP agent to the standard error stream.
+.IP "netsnmp_ds_set_boolean()"
+Please see the
+.IR default_store(3)
+manual page for more information
+about this API.
+.IP "init_agent(char *name)"
+Initializes the embedded agent.  This should be called before the
+.BR "init_snmp()"
+call.  
+.I name
+is used to dictate what .conf file to read when
+.BR "init_snmp()"
+is called later.
+.IP "init_snmp(char *name)"
+Initializes the SNMP library.  Note that one of the things this will
+do will be to read configuration files in an effort to configure your
+application. It will attempt to read the configuration files named by
+the
+.I name
+string that you passed in.  It can be used to configure access
+control, for instance.   Please see the
+.IR read_config(3) ", " snmp_config(5) ", and " snmpd.conf(5)
+manual pages for further details on this subject.
+.IP "init_master_agent(void)"
+Initializes the master agent and causes it to listen for SNMP requests 
+on its default UDP port of 161.
+.IP "agent_check_and_process(int block)"
+This checks for packets arriving on the SNMP port and processes them
+if some are found.  If 
+.I block
+is non-zero, the function call will block until a packet arrives or an 
+alarm must be run (see
+.IR snmp_alarm(3) ).
+The return value from this function is a positive integer if packets
+were processed, zero if an alarm occurred and -1 if an error occured.
+.IP "snmp_shutdown(char *name);"
+This shuts down the agent, saving any needed persistent storage, etc.
+.SH "SEE ALSO"
+http://www.net-snmp.org/tutorial-5/toolkit/, select(2), snmp_api(3),
+default_store(3), snmp_alarm(3), read_config(3), snmp_config(5),
+snmpd.conf(5)
diff -Naur tomato/release/src/router/snmp/man/snmp_alarm.3.def tomato121/release/src/router/snmp/man/snmp_alarm.3.def
--- tomato/release/src/router/snmp/man/snmp_alarm.3.def	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/man/snmp_alarm.3.def	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,169 @@
+.TH SNMP_ALARM 3 "07 Mar 2002" VVERSIONINFO "Net-SNMP"
+.UC 5
+.SH NAME
+snmp_alarm_register, snmp_alarm_register_hr, snmp_alarm_unregister - alarm functions
+.SH SYNOPSIS
+.B #include <net-snmp/utilities.h>
+.PP
+.B "unsigned int"
+.br
+.BI "snmp_alarm_register(unsigned int " seconds ","
+.br
+.BI "                    unsigned int " flags ","
+.br
+.BI "                    SNMPAlarmCallback *" f_callback ","
+.br
+.BI "                    void *" clientarg ");"
+.PP
+.B "unsigned int"
+.br
+.BI "snmp_alarm_register_hr(struct timeval " t ","
+.br
+.BI "                       unsigned int " flags ","
+.br
+.BI "                       SNMPAlarmCallback *" f_callback ","
+.br
+.BI "                       void *" clientarg ");"
+.PP
+.B "void
+.br
+.BI "snmp_alarm_unregister(unsigned int " reg ");"
+.SH DESCRIPTION
+.PP
+These functions implement support for a generic timer handling
+mechanism for multiple parts of an application to register function
+callbacks to happen at a particular time in the future.
+.SH USAGE
+.PP
+The usage is fairly simple and straight-forward:  Simply create a
+function you want called back at some point in the future.  The
+function definition should be similar to:
+.RS 4
+.PP
+.BI "void my_callback(unsigned int " reg ", void *" clientarg ");"
+.RE
+.PP
+Then, call
+.B snmp_alarm_register()
+to register your callback to be called
+.I seconds
+from now.  The
+.I flags
+field should either be 
+.I SA_REPEAT
+or
+.I NULL.
+If flags is set with
+.I SA_REPEAT,
+then the registered callback function will be called every
+.I seconds.
+If
+.I flags
+is
+.I NULL
+then the function will only be called once and then removed from the
+alarm system registration.
+.PP
+The
+.I clientarg
+parameter in the registration function is used only by
+the client function and is stored and passed back directly to them on
+every call to the system.
+.PP
+The 
+.B snmp_alarm_register()
+function returns a unique
+.I "unsigned int"
+(which is also passed as the first argument of each callback), which
+can then be used to remove the callback from the queue at a later
+point in the future using the
+.B snmp_alarm_unregister()
+function. If the
+.B snmp_alarm_register()
+call fails it returns zero.  In particular, note that it is entirely
+permissible for an alarm function to unregister itself.
+.PP
+The
+.B snmp_alarm_register_hr()
+function is identical in operation to the
+.B snmp_alarm_register()
+function, but takes a
+.I "struct timeval"
+as a first parameter, and schedules the callback after the period
+represented by
+.I t
+(the letters
+.B hr
+stand for "high resolution").  The operation of this function is
+dependent on the provision of the
+.BR setitimer (2)
+system call by the operating system.  If this system call is not
+available, the alarm will be scheduled as if
+.B snmp_alarm_register()
+had been called with a first argument equal to the value of the
+.I tv_sec
+member of
+.IR "t".
+See, however, the notes below.
+.SH INITIALIZATION
+The
+.B init_snmp()
+function initialises the snmp_alarm subsystem by calling 
+.B init_snmp_alarm()
+and then 
+.B init_alarm_post_config()
+to set up the first timer to initialise the callback function.  These
+two functions should not be used directly by applications.
+.SH "NOTES"
+The default behaviour of the snmp_alarm subsystem is to request
+.I SIGALRM
+signals from the operating system via the
+.BR alarm (2)
+or
+.BR setitimer (2)
+system calls.  This has the disadvantage, however, that no other part
+of the application can use the
+.I SIGLARM
+functionality (or, if some other part of the application
+.I does
+use the
+.I SIGALRM
+functionality, the snmp_alarm subsystem will not work correctly).
+.PP
+If your application runs a 
+.BR select (2)-based
+event loop, however, there is no need to use
+.I SIGALRM
+for the snmp_alarm subsystem, leaving it available for other parts of
+the application.  This is done by making the following call:
+.PP
+.nf
+netsnmp_ds_set_boolean(NETSNMP_DS_LIBRARY_ID, 
+                       NETSNMP_DS_LIB_ALARM_DONT_USE_SIG, 1);
+.fi
+.PP
+before calling
+.BR "init_snmp()".
+Then, 
+.BR snmp_select_info()
+takes alarms into account when calculating the timeout value to be
+used for
+.BR select (2).
+All you need to do is call
+.BR run_alarms()
+when
+.BR select (2)
+times out (return value of zero).  This is the approach taken in the
+agent; see
+.IR "snmpd.c".
+Furthermore, when using this method, high resolution alarms do not
+depend on the presence of the
+.BR setitimer (2)
+system call, although overall precision is of course still determined
+by the underlying operating system.  Recommended.
+.SH "SEE ALSO"
+.BR snmp_api "(3), " default_store "(3), " snmp_select_info "(3), "
+.BR alarm "(2), " setitimer "(2), " select "(2)"
+.\" Local Variables:
+.\"  mode: nroff
+.\" End:
diff -Naur tomato/release/src/router/snmp/man/snmp_api.3.def tomato121/release/src/router/snmp/man/snmp_api.3.def
--- tomato/release/src/router/snmp/man/snmp_api.3.def	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/man/snmp_api.3.def	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,238 @@
+.\" /***********************************************************
+.\" 	Copyright 1989 by Carnegie Mellon University
+.\" 
+.\"                       All Rights Reserved
+.\" 
+.\" Permission to use, copy, modify, and distribute this software and its 
+.\" documentation for any purpose and without fee is hereby granted, 
+.\" provided that the above copyright notice appear in all copies and that
+.\" both that copyright notice and this permission notice appear in 
+.\" supporting documentation, and that the name of CMU not be
+.\" used in advertising or publicity pertaining to distribution of the
+.\" software without specific, written prior permission.  
+.\" 
+.\" CMU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+.\" ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+.\" CMU BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+.\" ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+.\" WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+.\" ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+.\" SOFTWARE.
+.\" ******************************************************************/
+.TH SNMP_API 3 "21 Oct 1999" VVERSIONINFO "Net-SNMP"
+.UC 5
+.SH NAME
+snmp_sess_init, snmp_open, snmp_send, snmp_free_pdu, snmp_select_info, snmp_read, snmp_timeout, snmp_close, snmp_perror, snmp_sess_perror, snmp_error, snmp_api_errstring \- send and receive SNMP messages
+.SH SYNOPSIS
+#include <net-snmp/session_api.h>
+.PP
+void snmp_sess_init ( struct snmp_session * );
+.PP
+struct snmp_session * snmp_open ( struct snmp_session *);
+.RS
+.B /* Input parameter not used in active sessions */
+.RE
+.PP
+int snmp_send ( struct snmp_session *session,
+.RS
+struct snmp_pdu *pdu );
+.RE
+.PP
+int snmp_select_info ( int *numfds, fd_set *fdset,
+.RS
+struct timeval *timeout, int *block );
+.RE
+.PP
+void snmp_read ( fd_set *fdset );
+.PP
+void snmp_timeout ( void );
+.PP
+int snmp_close ( struct snmp_session *session );
+.PP
+void snmp_free_pdu (
+struct snmp_pdu *pdu );
+.PP
+void snmp_error (
+struct snmp_session *session,
+.RS
+int *pcliberr,
+int *psnmperr,
+char **pperrstring );
+.RE
+.PP
+char *snmp_api_errstring ( int snmperr );
+.PP
+void snmp_perror ( char * msg );
+.RS
+.B /* for parsing errors only */
+.RE
+.PP
+void snmp_sess_perror (char * msg, struct snmp_session *);
+.RS
+.B /* all other SNMP library errors */
+.RE
+.PP
+.SH DESCRIPTION
+.I Snmp_sess_init
+prepares a struct snmp_session that sources transport characteristics
+and common information that will be used for a set of SNMP transactions.
+After this structure is passed to
+.I snmp_open
+to create an SNMP session, the structure is not used.
+.PP
+.I Snmp_open
+returns a pointer to a newly-formed
+.I struct snmp_session
+object, which the application must use to reference the
+active SNMP session.
+.PP
+.I Snmp_send
+and
+.I snmp_free_pdu
+each take as input a pointer to a
+.I struct snmp_pdu
+object.
+This structure contains information that describes a transaction
+that will be performed over an open session.
+.PP
+Consult snmp_api.h for the definitions of these structures.
+.PP
+.I Snmp_read, snmp_select_info,
+and
+.I snmp_timeout
+provide an interface for the use of the
+.IR select(2)
+system call so that SNMP transactions can occur asynchronously.
+.PP
+.I Snmp_select_info
+is given the information that would have been passed to
+.I select
+in the absence of SNMP.  For example, this might include window update information.
+This information is modified so that SNMP will get the service it requires from the
+call to
+.I select.
+In this case,
+.I numfds, fdset,
+and
+.I timeout
+correspond to the
+.I nfds, readfds,
+and
+.I timeout
+arguments to
+.I select,
+respectively.  The only exception is that timeout must always point to an allocated (but perhaps uninitialized)
+.I struct timeval.
+If
+.I timeout
+would have been passed as NULL,
+.I block
+is set to true, and
+.I timeout
+is treated as undefined.  This same rule applies upon return from
+.I snmp_select_info.
+.PP
+After calling
+.I snmp_select_info, select
+is called with the returned data.  When select returns,
+.I snmp_read
+should be called with the
+.I fd_set
+returned from
+.I select
+to read each SNMP socket that has input.
+If
+.I select
+times out,
+.I snmp_timeout
+should be called to see if the timeout was intended for SNMP.
+.SH DIAGNOSTICS
+.PP
+Previous versions of the library used
+.IR snmp_get_errno
+to read the global variable
+.I snmp_errno
+which may have held the error status within the SNMP library.
+The existing method
+.I snmp_perror
+should be used to log ASN.1 coding errors only.
+.PP
+The new method
+.I snmp_sess_perror
+is provided to capture errors that occur during the processing
+of a particular SNMP session.
+.I Snmp_sess_perror
+calls
+.IR snmp_error
+function to obtain the "C" library error
+.I errno
+, the SNMP library error
+.I snmperr
+, and the SNMP library detailed error message
+that is associated with an error that occurred during a given session.
+.PP
+Note that in all cases except one,
+.IR snmp_sess_perror
+should be handed the
+.I struct snmp_session *
+pointer returned from
+.IR snmp_open.
+If
+.IR snmp_open
+returns a null pointer, pass the INPUT
+.I struct snmp_session *
+pointer used to call
+.IR snmp_open.
+.PP
+Error return status from 
+.I snmp_close
+and
+.I snmp_send
+is indicated by return of 0.  A successful status will return a 1 for
+.I snmp_close
+and then request id of the packet for
+.I snmp_send.
+Upon successful return from
+.I snmp_send
+the pdu will be freed by the library.
+.PP
+Consult snmp_api.h for the complete set of SNMP library
+error values.
+The SNMP library error value
+.IR snmperr
+can be one of the following values:
+.RS 2n
+.IP SNMPERR_GENERR \w'SNMPERR_BAD_REPETITIONS'u+2n
+A generic error occurred.
+.IP SNMPERR_BAD_LOCPORT \w'SNMPERR_BAD_REPETITIONS'u+2n
+The local port was bad because it had already been
+allocated or permission was denied.
+.IP SNMPERR_BAD_ADDRESS \w'SNMPERR_BAD_REPETITIONS'u+2n
+The host name or address given was not useable.
+.IP SNMPERR_BAD_SESSION \w'SNMPERR_BAD_REPETITIONS'u+2n
+The specified session was not open.
+.IP SNMPERR_TOO_LONG \w'SNMPERR_BAD_REPETITIONS'u+2n
+.IP SNMPERR_NO_SOCKET \w'SNMPERR_BAD_REPETITIONS'u+2n
+.IP SNMPERR_V2_IN_V1 \w'SNMPERR_BAD_REPETITIONS'u+2n
+.IP SNMPERR_V1_IN_V2 \w'SNMPERR_BAD_REPETITIONS'u+2n
+.IP SNMPERR_BAD_REPEATERS \w'SNMPERR_BAD_REPETITIONS'u+2n
+.IP SNMPERR_BAD_REPETITIONS \w'SNMPERR_BAD_REPETITIONS'u+2n
+.IP SNMPERR_BAD_ASN1_BUILD \w'SNMPERR_BAD_REPETITIONS'u+2n
+.IP SNMPERR_BAD_SENDTO \w'SNMPERR_BAD_REPETITIONS'u+2n
+.IP SNMPERR_BAD_PARSE \w'SNMPERR_BAD_REPETITIONS'u+2n
+.IP SNMPERR_BAD_VERSION \w'SNMPERR_BAD_REPETITIONS'u+2n
+.IP SNMPERR_NOAUTH_DESPRIV \w'SNMPERR_BAD_REPETITIONS'u+2n
+.IP SNMPERR_ABORT \w'SNMPERR_BAD_REPETITIONS'u+2n
+.IP SNMPERR_UNKNOWN_PDU \w'SNMPERR_BAD_REPETITIONS'u+2n
+.IP SNMPERR_TIMEOUT \w'SNMPERR_BAD_REPETITIONS'u+2n
+.RE
+.PP
+A string representation of the error code can be obtained with
+.IR snmp_api_errstring ,
+and a standard error message may be printed using
+.I snmp_perror
+that functions like the
+.I perror
+standard routine.
+.SH "SEE ALSO"
+select(2), snmp_api.h
diff -Naur tomato/release/src/router/snmp/man/snmp_api_errstring.3 tomato121/release/src/router/snmp/man/snmp_api_errstring.3
--- tomato/release/src/router/snmp/man/snmp_api_errstring.3	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/man/snmp_api_errstring.3	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1 @@
+.so man3/snmp_api.3
diff -Naur tomato/release/src/router/snmp/man/snmpbulkget.1.def tomato121/release/src/router/snmp/man/snmpbulkget.1.def
--- tomato/release/src/router/snmp/man/snmpbulkget.1.def	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/man/snmpbulkget.1.def	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,82 @@
+.\" /***********************************************************
+.\" 	Copyright 1988, 1989 by Carnegie Mellon University
+.\" 
+.\"                       All Rights Reserved
+.\" 
+.\" Permission to use, copy, modify, and distribute this software and its 
+.\" documentation for any purpose and without fee is hereby granted, 
+.\" provided that the above copyright notice appear in all copies and that
+.\" both that copyright notice and this permission notice appear in 
+.\" supporting documentation, and that the name of CMU not be
+.\" used in advertising or publicity pertaining to distribution of the
+.\" software without specific, written prior permission.  
+.\" 
+.\" CMU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+.\" ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+.\" CMU BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+.\" ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+.\" WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+.\" ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+.\" SOFTWARE.
+.\" ******************************************************************/
+.TH SNMPBULKGET 1 "08 Feb 2002" VVERSIONINFO "Net-SNMP"
+.UC 4
+.SH NAME
+snmpbulkget - communicates with a network entity using SNMP GETBULK Requests.
+.SH SYNOPSIS
+.B snmpbulkget
+[APPLICATION OPTIONS] [COMMON OPTIONS] OID [OID]...
+.SH DESCRIPTION
+.B snmpbulkget
+is an SNMP application that uses the SNMP GETBULK request to query a
+network entity efficiently for information.  One or more object
+identifiers (OIDs) may be given as arguments on the command line.
+Each variable name is given in the format specified in
+.IR variables(5) .
+.PP
+If the network entity has an error processing the request packet, an
+error packet will be returned and a message will be shown, helping to
+pinpoint why the request was malformed.
+.SH OPTIONS
+.TP 8
+.BI -Cn <NUM>
+Set the
+.I non-repeaters
+field in the GETBULK PDU.  This specifies the number of supplied
+variables that should not be iterated over.  The default is 0.
+.TP
+.BI -Cr <NUM>
+Set the
+.I max-repetitions
+field in the GETBULK PDU.  This specifies the maximum number of
+iterations over the repeating variables.  The default is 10.
+.PP
+In addition to these options,
+.B snmpbulkget
+takes the common options described in the 
+.I snmpcmd(1)
+manual page.
+.SH EXAMPLE
+The command:
+.PP
+snmpbulkget -v2c -Cn1 -Cr5 -Os -c public zeus system ifTable
+.PP
+will retrieve the variable system.sysDescr.0 (which is the
+lexicographically next object to system) and the first 5 objects in
+the ifTable:
+.PP
+sysDescr.0 = STRING: "SunOS zeus.net.cmu.edu 4.1.3_U1 1 sun4m"
+.br
+ifIndex.1 = INTEGER: 1
+.br
+ifIndex.2 = INTEGER: 2
+.br
+ifDescr.1 = STRING: "lo0"
+.br
+et cetera.
+.SH NOTE
+As the name implies,
+.B snmpbulkget
+utilizes the SNMP GETBULK message, which is not available in SNMPv1.
+.SH "SEE ALSO"
+snmpcmd(1), variables(5), RFC 1905.
diff -Naur tomato/release/src/router/snmp/man/snmpbulkwalk.1.def tomato121/release/src/router/snmp/man/snmpbulkwalk.1.def
--- tomato/release/src/router/snmp/man/snmpbulkwalk.1.def	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/man/snmpbulkwalk.1.def	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,127 @@
+.\" /***********************************************************
+.\" 	Copyright 1988, 1989 by Carnegie Mellon University
+.\" 
+.\"                       All Rights Reserved
+.\" 
+.\" Permission to use, copy, modify, and distribute this software and its 
+.\" documentation for any purpose and without fee is hereby granted, 
+.\" provided that the above copyright notice appear in all copies and that
+.\" both that copyright notice and this permission notice appear in 
+.\" supporting documentation, and that the name of CMU not be
+.\" used in advertising or publicity pertaining to distribution of the
+.\" software without specific, written prior permission.  
+.\" 
+.\" CMU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+.\" ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+.\" CMU BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+.\" ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+.\" WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+.\" ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+.\" SOFTWARE.
+.\" ******************************************************************/
+.TH SNMPBULKWALK 1 "17 Jun 1998" "" "Net-SNMP"
+.UC 4
+.SH NAME
+snmpbulkwalk - communicates with a network entity using SNMP BULK Requests.
+.SH SYNOPSIS
+.B snmpbulkwalk
+[APPLICATION OPTIONS] [COMMON OPTIONS] [OID]
+.SH DESCRIPTION
+.B snmpbulkwalk
+is an SNMP application that uses SNMP GETBULK requests to query a
+network entity efficiently for a tree of information.
+.PP
+An object identifier (OID) may be given on the command line.  This OID
+specifies which portion of the object identifier space will be
+searched using GETBULK requests.  All variables in the subtree below
+the given OID are queried and their values presented to the user.
+Each variable name is given in the format specified in
+.IR variables(5) .
+If no OID argument is present,
+.B snmpbulkwalk
+will search MIB-2.
+.PP
+If the network entity has an error processing the request packet, an
+error packet will be returned and a message will be shown, helping to
+pinpoint why the request was malformed.
+.PP
+If the tree search causes attempts to search beyond the end of the
+MIB, the message "End of MIB" will be displayed.
+.SH OPTIONS
+.TP 8
+.B -Cc
+Do not check whether the returned OIDs are increasing.  Some agents
+(LaserJets are an example) return OIDs out of order, but can
+complete the walk anyway.  Other agents return OIDs that are out of
+order and can cause
+.B snmpbulkwalk
+to loop indefinitely.  By default,
+.B snmpbulkwalk
+tries to detect this behavior and warns you when it hits an agent
+acting illegally.  Use
+.B -Cc
+to turn off this behaviour.
+.TP
+.B -Ci
+Include the given OID in the search range.  Normally
+.B snmpbulkwalk
+uses GETBULK requests starting with the OID you specified and returns
+all results in the MIB tree after that OID.  Sometimes, you may wish
+to include the OID specified on the command line in the printed
+results if it is a valid OID in the tree itself.  This option lets you
+do this.
+.TP
+.BI -Cn <NUM>
+Set the
+.I non-repeaters
+field in the GETBULK PDUs.  This specifies the number of supplied
+variables that should not be iterated over.  The default is 0.
+.TP
+.B -Cp
+Upon completion of the walk, print the number of variables found.
+.TP
+.BI -Cr <NUM>
+Set the
+.I max-repetitions
+field in the GETBULK PDUs.  This specifies the maximum number of
+iterations over the repeating variables.  The default is 10.
+.PP
+In addition to these options,
+.B snmpbulkwalk
+takes the common options described in the 
+.I snmpcmd(1)
+manual page.
+.SH EXAMPLE
+The command:
+.PP
+snmpbulkwalk -v2c -Os -c public zeus system
+.PP
+will retrieve all of the variables under system:
+.PP
+sysDescr.0 = STRING: "SunOS zeus.net.cmu.edu 4.1.3_U1 1 sun4m"
+.br
+sysObjectID.0 = OID: enterprises.hp.nm.hpsystem.10.1.1
+.br
+sysUpTime.0 = Timeticks: (155274552) 17 days, 23:19:05
+.br
+sysContact.0 = STRING: ""
+.br
+sysName.0 = STRING: "zeus.net.cmu.edu"
+.br
+sysLocation.0 = STRING: ""
+.br
+sysServices.0 = INTEGER: 72
+.PP
+In contrast to
+.BR snmpwalk ,
+this information will typically be gathered in a single transaction
+with the agent, rather than one transaction per variable found.
+.B snmpbulkwalk
+is thus more efficient in terms of network utilisation, which may be
+especially important when retrieving large tables.
+.SH NOTE
+As the name implies,
+.B snmpbulkwalk
+utilizes the SNMP GETBULK message, which is not available in SNMP v1.
+.SH "SEE ALSO"
+snmpcmd(1), variables(5).
diff -Naur tomato/release/src/router/snmp/man/snmp_close.3 tomato121/release/src/router/snmp/man/snmp_close.3
--- tomato/release/src/router/snmp/man/snmp_close.3	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/man/snmp_close.3	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1 @@
+.so man3/snmp_api.3
diff -Naur tomato/release/src/router/snmp/man/snmpcmd.1.def tomato121/release/src/router/snmp/man/snmpcmd.1.def
--- tomato/release/src/router/snmp/man/snmpcmd.1.def	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/man/snmpcmd.1.def	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,668 @@
+.\" Portions of this file are subject to the following copyright.  See
+.\" the Net-SNMP's COPYING file for more details and other copyrights
+.\" that may apply:
+.\"/***********************************************************
+.\" 	Copyright 1988, 1989 by Carnegie Mellon University
+.\" 
+.\"                       All Rights Reserved
+.\" 
+.\" Permission to use, copy, modify, and distribute this software and its 
+.\" documentation for any purpose and without fee is hereby granted, 
+.\" provided that the above copyright notice appear in all copies and that
+.\" both that copyright notice and this permission notice appear in 
+.\" supporting documentation, and that the name of CMU not be
+.\" used in advertising or publicity pertaining to distribution of the
+.\" software without specific, written prior permission.  
+.\" 
+.\" CMU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+.\" ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+.\" CMU BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+.\" ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+.\" WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+.\" ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+.\" SOFTWARE.
+.\" ******************************************************************/
+.\" Portions of this file are copyrighted by:
+.\" Copyright Copyright 2003 Sun Microsystems, Inc. All rights reserved.
+.\" Use is subject to license terms specified in the COPYING file
+.\" distributed with the Net-SNMP package.
+.\" ******************************************************************/
+.TH SNMPCMD 1 "25 Jul 2003" VVERSIONINFO "Net-SNMP"
+.UC 4
+.SH NAME
+snmpcmd - commands to communicate with a network entity using SNMP Requests.
+.SH SYNOPSIS
+.B snmpcmd
+[OPTIONS] AGENT [PARAMETERS]
+.SH DESCRIPTION
+This manual page describes the common options for the SNMP commands:
+.BR snmpbulkget ", " snmpbulkwalk ", "  snmpdelta ", " snmpget ", "
+.BR snmpgetnext ", " snmpnetstat ", " snmpset ", " snmpstatus ", "
+.BR snmptable ", " snmptest ", " snmptrap ", 
+.BR " snmpdf", " snmpusm ", " snmpwalk ".  "
+The command line applications use the SNMP protocol to communicate
+with an SNMP capable network entity, an agent.  Individual
+applications typically (but not necessarily) take additional
+parameters that are given after the agent specification.  These
+parameters are documented in the manual pages for each application.
+
+.SH OPTIONS
+.TP
+.BI -a " authProtocol"
+Set the authentication protocol (MD5|SHA) used for authenticated SNMPv3
+messages. Overrides the defAuthType token in the
+.I  snmp.conf
+file.
+.TP
+.BI -A " authPassword"
+Set the authentication pass phrase used for authenticated SNMPv3
+messages.  Overrides the defAuthPassphrase token in the
+.I snmp.conf
+file. Insecure to specify pass word phrases on the command line,
+see
+.I snmp.conf(5).
+.TP
+.BI -c " community"
+Set the community string for SNMPv1/v2c transactions.
+Overrides the defcommunity token in the
+.I snmp.conf
+file.
+.TP
+.B -d
+Dump (in hexadecimal) the sent and received SNMP packets.
+.TP
+.B -D \fITOKEN[,...]
+Turn on debugging output for the given
+.IR "TOKEN" "(s)."
+Try
+.IR ALL
+for extremely verbose output.
+.TP
+.BI -e " engineID"
+Set the authoritative (security) engineID used for SNMPv3 REQUEST
+messages.  This is the engineID of the agent or proxy (e.g.,
+800000020109840301). (will be discovered if not supplied)
+.TP
+.BI -E " engineID"
+Set the context engineID used for SNMPv3 REQUEST messages scopedPdu.
+This is the engineID of the agent (e.g., 800000020109840301). (will be
+authoritative engineID if not specified)
+.TP
+.B -h, --help
+Display a brief usage message and then exit.
+.TP
+.B -H
+Display a list of configuration file directives understood by the
+command and then exit.
+.TP
+.BI -I " brRhu"
+Specifies input parsing options. See 
+.B INPUT OPTIONS 
+below.
+.TP
+.BI -l " secLevel"
+Set the securityLevel used for SNMPv3 messages
+(noAuthNoPriv|authNoPriv|authPriv).  Appropriate pass phrase(s) must
+provided when using any level higher than noAuthNoPriv.
+Overrides the defSecurityLevel token in the
+.I snmp.conf
+file.
+.TP
+.BI -m " MIBLIST"
+Specifies a colon separated list of MIB modules to load for this
+application.  This overrides the environment variable MIBS.
+.IP
+The special keyword
+.I ALL
+is used to specify all modules in all directories when searching for MIB
+files.  Every file whose name does not begin with "." will be parsed as
+if it were a MIB file.
+.IP
+If the
+.I MIBLIST
+has a leading '+', then the listed MIB modules are loaded in 
+addition to MIB modules specified in the environment variable MIBS.
+.IP
+If a
+.I mibfile
+token is specified in the
+.I snmp.conf file,
+the 
+.I -m MIB
+option overrides the 
+.I mibfile
+token.
+.TP
+.BI -M " DIRLIST"
+Specifies a colon separated list of directories to search for MIBs.
+This overrides the environment variable MIBDIRS.
+.IP
+If 
+.I DIRLIST
+has a leading '+', then the given directories are added to the list
+of MIB directories.  Without the leading '+', the
+given directory list overrides the list specified with the
+environment variable MIBDIRS. Note that the directories listed at the
+end of the list have precedence over directories at the beginning
+of the list. 
+.IP
+If no value is specified for the environment variable MIBDIRS,
+then the command will still search a default mib directory,
+after it searches the MIB directories specified on the -M
+option.  The default directory is DATADIR/snmp/mibs.
+To avoid having a default mib directory searched, set the
+MIBDIRS environment variable to "".  Even if the default
+MIB directory is searched, the directories specified in the
+-M option have precedence in the search order over the
+default directory.
+.IP
+If the -M option is specified and either a mibfile or mibdirs token
+is also specified in the
+.I snmp.conf
+file, the directories in the
+-M option have precedence in the MIB search order, over the
+directories set with both the mibdirs token and the mibfile token.
+.TP
+.BI -n " contextName"
+Set the destination contextName used for SNMPv3 messages.  The default
+contextName is the empty string "".  Overrides the defContext token
+in the
+.I snmp.conf
+file. 
+.TP
+.BI -O " anEebqQfsSvXTuxUt"
+Specifies output printing options. See 
+.B OUTPUT OPTIONS
+below.
+.TP
+.BI -P " cdeRuwW"
+Specifies MIB parsing options.  See
+.B MIB PARSING OPTIONS
+below.
+.TP
+.BI -r " retries"
+Specifies the number of retries to be used in the requests. The default
+is 5.
+.TP
+.BI -t " timeout"
+Specifies the timeout in seconds between retries. The default is 1.
+.TP
+.BI -u " secName"
+Set the securityName used for authenticated SNMPv3 messages.
+Overrides the defSecurityName token in the
+.I snmp.conf
+file.
+.TP
+.B -v \fI1\fR | \fI2c\fR | \fI3
+Specifies the protocol version to use: 1 (RFCs 1155-1157), 2c (RFCs 1901-1908),
+or 3 (RFCs 2571-2574).  The default is version 1. This option overrides
+the defVersion token in the
+.I snmp.conf
+file.
+.TP
+.B -V, --version
+Display version information for the application and then exit.
+.TP
+.BI -x " privProtocol"
+Set the privacy protocol (DES) used for encrypted SNMPv3 messages.
+.TP
+.BI -X " privPassword"
+Set the privacy pass phrase used for encrypted SNMPv3 messages.
+Overrides the defPrivPassphrase token in the
+.I snmp.conf
+file.
+Insecure to specify pass word phrases on the command line, see
+.I snmp.conf(5).
+.TP
+.BI -Z " boots,time"
+Set the engineBoots and engineTime used for authenticated SNMPv3
+messages.  This will initialize the local notion of the agents
+boots/time with an authenticated value stored in the LCD. (will be
+discovered if not supplied)
+.PP
+The string
+.I AGENT
+specifies the remote SNMP entity with which to communicate.  The format
+of this parameter is defined in the
+.B AGENT SPECIFICATION
+section below.
+.SH AGENT SPECIFICATION
+The
+.I AGENT
+specification takes the form:
+.IP
+[<transport-specifier>:]<transport-address>
+.PP
+At its simplest, the
+.I AGENT
+specification may consist of a hostname, or an IPv4 address in the
+standard "dotted quad" notation.  In this case, communication will be
+attempted using UDP/IPv4 to port 161 of the given host.  Otherwise,
+the <transport-address> part of the specification is parsed according
+to the following table:
+.RS 4
+.TP 28
+.BR "<transport-specifier>"
+.BR "<transport-address> format"
+.IP "udp" 28
+hostname[:port]
+.I or
+IPv4-address[:port]
+.IP "tcp" 28
+hostname[:port]
+.I or
+IPv4-address[:port]
+.IP "unix" 28
+pathname
+.IP "ipx" 28
+[network]:node[/port]
+.TP 28 
+.IR "" "aal5pvc " or " pvc"
+[interface.][VPI.]VCI
+.IP "udp6 or udpv6 or udpipv6" 28
+hostname[:port]
+.I or
+IPv6-address:port
+.I or
+ '['IPv6-address']'[:port]
+.IP "tcp6 or tcpv6 or tcpipv6"
+hostname[:port]
+.I or
+IPv6-address:port
+.I or
+ '['IPv6-address']'[:port]
+.RE
+.PP
+Note that <transport-specifier> strings are case-insensitive so that,
+for example, "tcp" and "TCP" are equivalent.  Here are some examples,
+along with their interpretation:
+.TP 24
+.IR "hostname:161"
+perform query using UDP/IPv4 datagrams to
+.I hostname
+on port
+.IR 161 .
+The ":161" is redundant here since that is the default SNMP port in
+any case.
+.TP 24
+.IR "udp:hostname"
+identical to the previous specification.  The "udp:" is redundant here
+since UDP/IPv4 is the default transport.
+.TP 24
+.IR "TCP:hostname:1161"
+connect to
+.I hostname
+on port
+.I 1161
+using TCP/IPv4 and perform query over that connection.
+.TP 24
+.IR "ipx::00D0B7AAE308"
+perform query using IPX datagrams to node number 
+.I 00D0B7AAE308
+on the default network, and using the default IPX port of 36879 (900F
+hexadecimal), as suggested in RFC 1906.
+.TP 24
+.IR "ipx:0AE43409:00D0B721C6C0/1161"
+perform query using IPX datagrams to port
+.I 1161
+on node number
+.I 00D0B721C6C0
+on network number
+.IR 0AE43409 .
+.TP 24
+.IR "unix:/tmp/local-agent"
+connect to the Unix domain socket 
+.IR /tmp/local-agent ,
+and perform the query over that connection.
+.TP 24
+.IR "/tmp/local-agent"
+identical to the previous specification, since the Unix domain is the
+default transport iff the first character of the <transport-address>
+is a '/'.
+.TP 24
+.IR "AAL5PVC:100"
+perform the query using AAL5 PDUs sent on the permanent virtual
+circuit with VPI=0 and VCI=100 (decimal) on the first ATM adapter in the
+machine.
+.TP 24
+.IR "PVC:1.10.32"
+perform the query using AAL5 PDUs sent on the permanent virtual
+circuit with VPI=10 (decimal) and VCI=32 (decimal) on the second ATM
+adapter in the machine.  Note that "PVC" is a synonym for "AAL5PVC".
+.TP 24
+.IR "udp6:hostname:10161"
+perform the query using UDP/IPv6 datagrams to port
+.I 10161
+on
+.I hostname
+(which will be looked up as an AAAA record).
+.TP 24
+.IR "UDP6:[fe80::2d0:b7ff:fe21:c6c0]"
+perform the query using UDP/IPv6 datagrams to port 161 at address
+.IR fe80::2d0:b7ff:fe21:c6c0 .
+.TP 24
+.IR "tcpipv6:[::1]:1611"
+connect to port 1611 on the local host
+.IR "" ( ::1 
+in IPv6 parlance) using TCP/IPv6 and perform query over that connection.
+.PP
+Note that not all the transport domains listed above will always be
+available; for instance, hosts with no IPv6 support will not be able
+to use udp6 transport addresses, and attempts to do so will result in
+the error "Unknown host".  Likewise, since AAL5 PVC support is only
+currently available on Linux, it will fail with the same error on
+other platforms.
+.SH "MIB PARSING OPTIONS"
+The Net-SNMP MIB parser mostly adheres to the Structure of Management
+Information (SMI).  As that specification has changed through time, and
+in recognition of the (ahem) diversity in compliance expressed in MIB
+files, additional options provide more flexibility in reading MIB files.
+.TP
+.B "-Pw"
+Show some warning messages in resolving the MIB files.
+Can be also set with the configuration token "mibWarningLevel".
+.TP
+.B "-PW"
+Show additional warning messages.
+Can be also set with the configuration token "mibWarningLevel".
+.TP
+.B "-Pe"
+Show MIB errors.
+Can be also set with the configuration token "showMibErrors".
+An example of an error that would be shown is if an imported
+module is not found during MIB parsing.
+.TP
+.B "-Pc"
+Allow ASN.1 comment to extend to the end of the MIB source line
+(i.e. disallow the use of "--" to terminate comments).
+This overcomes some problems with manually maintained MIB files.
+Can be also set with the configuration token "strictCommentTerm".
+.TP
+.B "-Pd"
+Toggles the default of whether or not to save the DESCRIPTIONs
+of the MIB objects when parsing.  Since the default is to save
+the DESCRIPTIONS, specifying -Pd will cause the DESCRIPTIONs not
+to be saved during MIB parsing.  For example:
+
+snmptranslate -Td -OS -IR system.sysDescr.0
+
+will show a description, while
+
+snmptranslate -Td -OS -IR -Pd system.sysDescr.0
+
+will not show a description.  Collecting the
+DESCRIPTION information into the parsed hierarchy
+increases the memory used by the size of each DESCRIPTION clause.
+.TP
+.B "-Pu"
+Allow underline characters in symbols.
+Can be also set with the configuration token "mibAllowUnderline".
+.TP
+.B "-PR"
+Replace MIB objects using the last read MIB file.
+The parser will replace MIB objects in its hierarchy whenever
+it sees a sub-identifier and name match.  
+.B WARNING:
+Setting this option may result in an incorrect hierarchy.
+Can be also set with the configuration token "mibReplaceWithLatest".
+.PP
+.SH "OUTPUT OPTIONS"
+Output display can be controlled by passing various parameters to the
+.B -O
+flag.  The following examples should demonstrate this.
+.PP
+The default output looks as follows:
+.br
+snmpget -c public -v 1 localhost system.sysUpTime.0
+.br
+SNMPv2-MIB::sysUpTime.0 = Timeticks: (14096763) 1 day, 15:09:27.63        
+.TP
+.B -Oq
+Removes the equal sign and type information:
+.br
+system.sysUpTime.0 1:15:09:27.63
+.TP
+.B -OQ
+Removes the type information:
+.br
+system.sysUpTime.0 = 1:15:09:27.63
+.TP
+.B -Of
+Gives you the complete OID:
+.br
+ .iso.org.dod.internet.mgmt.mib-2.system.sysUpTime.0 = Timeticks: (14096763) 1 day, 15:09:27.63
+.TP
+.B -Os
+Deletes all but the last symbolic part of the OID:
+.br
+sysUpTime.0 = Timeticks: (14096763) 1 day, 15:09:27.63
+.TP
+.B -OS
+A variation on
+.B -Os
+that adds the name of the MIB that defined the object:
+.br
+SNMPv2-MIB::sysUpTime.0 = Timeticks: (14096763) 1 day, 15:09:27.63
+.br
+(from release 5.0, this is now the default output format)
+.TP
+.B -Ou
+Prints the OID in the UCD-style (inherited from the original CMU code),
+That means removing a series of "standard" prefixes, if relevant,
+and breaking down the OID into the displayable pieces.  For example,
+the OID vacmSecruityModel.0.3.119.101.115 is broken down by default
+and the string hidden in the OID is shown.  The result would
+look like: vacmSecurityModel.0."test".  The -Ob option disables this
+feature.
+.br
+system.sysUpTime.0 = Timeticks: (14096763) 1 day, 15:09:27.63
+.TP
+.B -On
+Prints the OID numerically:
+.br
+ .1.3.6.1.2.1.1.3.0 = Timeticks: (14096763) 1 day, 15:09:27.63
+.TP
+.B -Oe
+Removes the symbolic labels from enumerations:
+.br
+snmpget -c public -v 1 localhost ip.ipForwarding.0
+.br
+ip.ipForwarding.0 = INTEGER: forwarding(1)
+.br
+snmpget -c public -v 1 -Oe localhost ip.ipForwarding.0
+.br
+ip.ipForwarding.0 = INTEGER: 1
+.TP
+.B -Ob
+When OIDs contain a index to a table,
+they are broken into the displayable pieces and shown to you.  For
+example the OID vacmSecurityModel.0.3.119.101.115 is nicely broken
+down by default and the string hidden in the OID is shown to you as
+vacmSecurityModel.0."wes".
+The
+.B -Ob
+option disables this feature and displays it as
+vacmSecurityModel.0.3.119.101.115 again.
+.TP
+.B -OE
+This modifies the index strings to include a \\ to escape the quotes,
+to allow them to be reused in shell commands, such as
+vacmSecurityModel.0.\\"wes\\"
+.TP
+.B -OX
+This modifies the output of index OIDs, to look more "program like".
+Square brackets are placed around each index, and the DISPLAY-HINT
+information and string conversions are used to format each index.
+If you take an entry from the IPV6-MIB::ipv6RouteTable, it is indexed with
+an IPv6 address and two integers, and if you are used to IPv6 addresses
+you will know that decimal OIDs are not the preferred notation. Compare:
+.br
+snmpgetnext -OS host IPV6-MIB:ipv6RouteTable
+.br
+IPV6-MIB::ipv6RouteIfIndex.63.254.1.0.255.0.0.0.0.0.0.0.0.0.0.0.64.1 = INTEGER: 2
+.br
+snmpgetnext -OSX host IPV6-MIB:ipv6RouteTable
+.br
+IPV6-MIB::ipv6RouteIfIndex[3ffe:100:ff00:0:0:0:0:0][64][1] = INTEGER: 2
+.TP
+.B -Oa
+If a string-valued object definition does not include a Display Hint,
+then the library attempts to determine whether it is an ascii or
+binary string, and displays the value accordingly.
+This flag bypasses this check, and displays all strings as ASCII.
+Note that this does not affect objects that do have a Display Hint.
+.TP
+.B -Ox
+This works similarly to '-Oa', but displays strings as Hex.
+.TP
+.B -OT
+If hexadecimal code is printed, this will also print any printable
+characters after the hexadecimal codes.
+.TP
+.B -Ov
+Output only the variable value, not the OID:
+.br
+snmpget -c public -v 1 -Ov localhost ip.ipForwarding.0
+.br
+INTEGER: forwarding(1)
+.TP
+.B -OU
+Don't print the UNITS suffix at the end of the value.
+.TP
+.B -Ot
+Output timeticks values as raw numbers:
+.br
+system.sysUpTime.0 = 14096763
+.PP
+Note that most of these options can be turned on or off by default by
+tuning the
+.I snmp.conf file.
+See the
+.I snmp.conf(5)
+manual page for details.
+.SH "INPUT OPTIONS"
+The
+.B -I
+flag specifies various options that control how your input to
+the program is parsed.  By default, all input parsing methods are
+used: First the OID is parsed regularly, then
+.B -IR
+is used, then
+.B -Ib
+is used, unless one of the following flags is specified which will
+force it to only use one method.
+.TP
+.B -IR
+The
+.B -IR
+flag specifies random access lookup, so that if the entire OID path is
+not specified, it will search for a node in the MIB tree with the given
+name.  Normally, you'd have to specify the vacmSecurityModel OID above
+as .iso.org.dod.internet.snmpV2.snmpModules.snmpVacmMIB.vacmMIBObjects.vacmSecurityToGroupTable.vacmSecurityToGroupEntry.vacmSecurityModel.0."wes",
+but the use of the
+.B -IR
+flag allows you to shorten that to just vacmSecurityModel.0."wes".
+(Though this OID really needs to be quoted - 'vacmSecurityModel.0."wes"' - to
+prevent the shell from swallowing the double quotes).
+.IP
+Additionally, see the
+.B RANDOM ACCESS MIBS
+section below.
+.TP
+.B -Ib
+The
+.B -Ib
+flag indicates that the expression you gave it is actually a regular
+expression that should be used to search for the best match possible in
+the MIB tree.  This would allow you to specify the node
+vacmSecurityModel MIB node as something as generic as vacmsecuritymodel
+(since case insensitive searches are done) or vacm.*model.  Note that
+multiple matches are obviously possible (.* matches everything), and the
+best result is currently calculated as the one that matches the closest
+to the beginning of the node name and the highest in the tree.  A
+current side effect of this option is that you can't specify indexes or
+multiple nodes, since the '.' is treated as part of the regular
+expression.
+.TP
+.B -Iu
+Use the traditional UCD-style input approach of assuming that OIDs
+are rooted at the 'mib-2' point in the tree (unless they start with
+an explicit '.')   If random access lookup is in effect (which is
+the default for most commands), then this will only affect OIDs
+specified with a leading numberic subidentifier (and no initial '.')
+Thus an input of "snmpcmd ... 1" would refer to 'iso' (from v5.0
+onwards) while "snmpcmd -Iu ... 1" would refer to 'system'.
+.TP
+.B -Ir
+By default, indices into tables and values to be assigned to objects
+are checked against range and type specified in the MIB.  The
+.B -Ir
+flag disables this check.  This flag is mostly useful when you are
+testing an agent.  For normal operation it is useful to get your
+requests checked before they are sent to the remote agent (the
+diagnostic that the library can provide is also much more precise).
+.TP
+.B -Ih
+By default, the library will use DISPLAY-HINT information when assigning values.
+This flag disables this behavior. The result is that instead of
+.br
+snmpset localhost HOST-RESOURCES-MIB::hrSystemDate.0 = 2002-12-10,2:4:6.8
+.br
+you will have to write
+.br
+snmpset localhost HOST-RESOURCES-MIB::hrSystemData.0 x "07 D2 0C 0A 02 04 06 08"
+.SH "RANDOM ACCESS MIBS"
+In previous releases of the UCD-SNMP package (and if using the
+.B -Iu
+option), an object identifier such as system.sysDescr.0 will be
+lookup in a single "well known" place, built into the SNMP library (or
+specified by the P@REFIX environment variable).  The standard place
+is: .iso.org.dod.internet.mgmt.mib-2.  The identifier may alternatively be
+a complete object identifier, this is designated by a leading "dot"
+if using UCD-input style, and is the first thing tried otherwise.
+To simplify the specification of object identifiers the library
+supports random access to the identifiers in the MIBs. This is
+requested by the
+.B -IR
+option to the SNMP applications.  Additionally,
+.B -Os
+prints OIDs in this manner.  Using this, system.sysDescr.0 may
+also be entered as sysDescr.0.  To search only a single MIB for the
+identifier (if it appears in more than one), specify it as
+SNMPv2-MIB::sysDescr.0. (use
+.B -OS
+to print output OIDs in this manner, though this is the default as
+from v5.0). This notation will also ensure
+that the specified MIB is loaded, i.e. it need not be mentioned in the
+.B -m
+option (or MIBS environment variable).
+.SH "ENVIRONMENT VARIABLES"
+.IP P@REFIX
+The standard prefix for object identifiers (if using UCD-style output).
+Defaults to .iso.org.dod.internet.mgmt.mib-2
+.IP MIBS
+The list of MIBs to load. Defaults to
+SNMPv2-TC:SNMPv2-MIB:IF-MIB:IP-MIB:TCP-MIB:UDP-MIB:SNMP-VACM-MIB.
+Overridden by the
+.B -m
+option.
+.IP MIBDIRS
+The list of directories to search for MIBs. Defaults to DATADIR/snmp/mibs.
+Overridden by the
+.B -M
+option.
+.SH FILES
+.IP SYSCONFDIR/snmp/snmpd.conf
+Agent configuration file. See
+.IR snmpd.conf(5) .
+.IP SYSCONFDIR/snmp/snmp.conf
+.IP ~/.snmp/snmp.conf
+Application configuration files. See 
+.IR snmp.conf(5) .
+.SH "SEE ALSO"
+snmpget(1), snmpgetnext(1), snmpset(1),
+snmpbulkget(1), snmpbulkwalk(1), snmpwalk(1),
+snmptable(1), snmpnetstat(1), snmpdelta(1), snmptrap(1), snmpinform(1),
+snmpusm(1), snmpstatus(1), snmptest(1),
+snmp.conf(5).
+
diff -Naur tomato/release/src/router/snmp/man/snmpconf.1.def tomato121/release/src/router/snmp/man/snmpconf.1.def
--- tomato/release/src/router/snmp/man/snmpconf.1.def	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/man/snmpconf.1.def	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,131 @@
+.TH SNMPCONF 1 "08 Feb 2002" VVERSIONINFO "Net-SNMP"
+.UC 4
+.SH NAME
+snmpconf - creates and modifies SNMP configuration files
+.SH SYNOPSIS
+.B snmpconf
+[OPTIONS] [fileToCreate]
+.IP "Start with:"
+.B snmpconf
+-g basic_setup
+.IP "Or even just:"
+.B snmpconf
+.SH DESCRIPTION
+.B snmpconf
+is a simple Perl script that walks you through setting up a
+configuration file step by step.  It should be fairly straight forward
+to use.  Merely run it and answer its questions.
+.PP
+In its default mode of operation, it prompts the user with menus
+showing sections of the various configuration files it knows about.
+When the user selects a section, a sub-menu is shown listing of the
+descriptions of the tokens that can be created in that section.  When
+a description is selected, the user is prompted with questions that
+construct the configuration line in question.
+.PP
+Finally, when the user quits the program any configuration files that
+have been edited by the user are saved to the local directory, fully
+commented.
+.PP
+A particularly useful option is the
+.B -g
+switch, which walks a user through a specific set of configuration
+questions.  Run:
+.RS
+.PP
+snmpconf -g basic_setup
+.RE
+.PP
+for an example.
+.SH "OPTIONS"
+.TP 8
+.B -f
+Force overwriting existing files in the current directory without
+prompting the user if this is a desired thing to do.
+.TP 
+.B -i
+When finished, install the files into the location where the global
+system commands expect to find them.
+.TP
+.B -p
+When finished, install the files into the users home directory's .snmp
+subdirectory (where the applications will also search for
+configuration files).
+.TP
+.BI -I " DIRECTORY"
+When finished, install the files into the directory 
+.IR DIRECTORY .
+.TP
+.B -a
+Don't ask any questions.  Simply read in the various known
+configuration files and write them back out again.  This has the
+effect of "auto-commenting" the configuration files for you.  See
+the
+.B NEAT TRICKS
+section below.
+.TP
+.BI -r all|none
+Read in either all or none of the found configuration files.  Normally
+.B snmpconf
+prompts you for which files you wish to read in.  Reading in
+these configuration files will merge these files with the results of
+the questions that it asks of you.
+.TP
+.BI -R " FILE,..."
+Read in a specific list of configuration files.
+.TP
+.BI -g " GROUPNAME"
+Groups of configuration entries can be created that can be used to
+walk a user through a series of questions to create an initial
+configuration file.  There are no menus to navigate, just a list of
+questions.  Run:
+.RS
+.RS
+.PP
+snmpconf -g basic_setup
+.RE
+.PP
+for a good example.
+.RE
+.TP
+.B -G
+List all the known groups.
+.TP
+.BI -c " CONFIGDIR"
+.B snmpconf
+uses a directory of configuration information to learn about
+the files and questions that it should be asking.  This option tells
+.B snmpconf
+to use a different location for configuring itself.
+.TP
+.B -q
+Run slightly more quietly.  Since this is an interactive program, I
+don't recommend this option since it only removes information from the
+output that is designed to help you.
+.TP
+.B -d
+Turn on 
+.B lots
+of debugging output.
+.TP
+.B -D
+Add 
+.B even more
+debugging output in the form of Perl variable dumps.
+.IP
+.SH "NEAT TRICKS"
+.IP "snmpconf -g basic_setup"
+Have I mentioned this command enough yet?  It's designed to walk
+someone through an initial setup for the
+.I snmpd(8)
+daemon.  Really, you should try it.
+.IP "snmpconf -R /usr/local/snmp/snmpd.conf -a -f snmpd.conf"
+Automatically reads in an snmpd.conf file (for example) and adds
+comments to them describing what each token does.  Try it.  It's cool.
+.SH "NOTES"
+.B snmpconf
+is actually a very generic utility that could be easily
+configured to help construct just about any kind of configuration
+file.  Its default configuration set of files are SNMP based.
+.SH SEE ALSO
+snmpd(8), snmp_config(5), snmp.conf(5), snmpd.conf(5)
diff -Naur tomato/release/src/router/snmp/man/snmp.conf.5.def tomato121/release/src/router/snmp/man/snmp.conf.5.def
--- tomato/release/src/router/snmp/man/snmp.conf.5.def	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/man/snmp.conf.5.def	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,142 @@
+.TH SNMP.CONF 5 "11 Dec 2002" VVERSIONINFO "Net-SNMP"
+.UC 4
+.SH NAME
+SYSCONFDIR/snmp/snmp.conf - configuration file for the Net-SNMP applications.
+.br
+~/.snmp/snmp.conf - personal configuration file.
+.SH DESCRIPTION
+.B snmp.conf
+is the configuration file which define how the Net-SNMP applications
+operate.  Tokens that can be put in them are described in the
+.B DIRECTIVES
+section below.
+.SH PLEASE READ FIRST
+Make sure you make these files readable only by the user if you are
+storing sensitive information in them like passphrases!
+.PP
+First, make sure you have read the
+.I snmp_config(5)
+manual page that describes how the Net-SNMP configuration files
+operate, where they are located and how they all work together.
+.SH DIRECTIVES
+.IP "mibdirs (mib-dirs|+mib-dirs)"
+Look for textual MIBs to parse in the list of ':' separated
+directories.  If the directive value starts with a '+' it prepends
+this list to the front of the default directory list compiled into the
+application.  Note that this value can be overridden by the
+.B MIBDIRS
+environment variable.
+.IP "mibs (mib-tokens|+mib-tokens)"
+Specifies a ':' separated list of MIB tokens that represent textual
+MIB files that should be found and parsed.  If the directive value
+starts with a '+' it prepends this list to the front of the default
+MIB token list compiled into the application.  The special keyword of
+"ALL" forces all MIBs files found to be read. Note that the value
+specified here can be overridden by the
+.B MIBS
+environment variable.
+.IP "mibfile file"
+Specifies a textual MIB file to read and parse, in addition to the
+list read from the MIBs token.  Note that the value specified here can
+be overridden by the
+.B MIBFILES
+environment variable.
+.IP "persistentDir directory"
+The directory where snmpd and snmptrapd stores their persistent data
+files.
+.IP "defaultPort port"
+The default port number that all SNMP applications and daemons should use.
+.IP "defVersion (1|2c|3)"
+The default SNMP version to use.
+.IP "defCommunity string"
+The default SNMPv1 and SNMPv2c community string to use.
+.IP "defSecurityName string"
+The default SNMPv3 USM security name you want to use for SNMPv3 requests.
+.IP "defContext string"
+The default SNMPv3 context name you want to use.
+.IP "defPassphrase string"
+.IP "defAuthPassphrase string"
+.IP "defPrivPassphrase string"
+The default SNMPv3 USM passphrase(s) to use.  
+.B defPassphrase
+will be used for both authentication and privacy pass phrases if it is 
+specified.
+.IP "defAuthType MD5|SHA"
+The SNMPv3 USM authentication type to use.
+.IP "defPrivType DES"
+The SNMPv3 USM privacy type to use.  Currently, DES is the only
+possible value.
+.IP "defSecurityLevel noAuthNoPriv|authNoPriv|authPriv"
+The SNMPv3 default security level to use.
+.IP "showMibErrors (1|yes|true|0|no|false)"
+Whether or not to display textual MIB parsing errors when commands are
+run.
+.IP "strictCommentTerm (1|yes|true|0|no|false)"
+Whether or not MIBs that are parsed should be strict about comment
+termination.  "--" terminates a comment if this is true.  Many
+MIBs have broken comments in them, hence this option.
+.IP "mibAllowUnderline (1|yes|true|0|no|false)"
+Allow underline characters in MIBs (illegal).
+.IP "mibWarningLevel integerValue"
+The minimum warning level of the warnings printed by the MIB parser.
+.IP "logTimestamp (1|yes|true|0|no|false)"
+Whether the commands should log timestamps with their error/message
+logging or not.  Note that output will not look as pretty with
+timestamps if the source code that is doing the logging does
+incremental logging of messages that are not line buffered before
+being passed to the logging routines.
+.IP "printNumericEnums (1|yes|true|0|no|false)"
+Equivalent to
+.BR -Oe .
+.IP "printNumericOids (1|yes|true|0|no|false)"
+Equivalent to
+.BR -On .
+.IP "dontBreakdownOids (1|yes|true|0|no|false)"
+Equivalent to
+.BR -Ob .
+.IP "escapeQuotes (1|yes|true|0|no|false)"
+Equivalent to
+.BR -OE .
+.IP "quickPrinting (1|yes|true|0|no|false)"
+Equivalent to
+.BR -Oq .
+.IP "dontPrintUnits (1|yes|true|0|no|false)"
+Equivalent to
+.BR -OU .
+.IP "printHexText (1|yes|true|0|no|false)"
+Equivalent to
+.BR -OT .
+.IP "suffixPrinting (0|1|2)"
+If the value is 1, its equivalent to
+.B -Os
+and if the value is 2 it's equivalent to
+.BR -OS .
+.IP "oidOutputFormat (1|2|3|4|5|6)
+Maps -O options as follow: -Os=1, -OS=2, -Of=3, -On=4, -Ou=5.
+The value 6 has no matching -O option. It suppresses output.
+.IP "extendedIndex (1|yes|true|0|no|false)"
+Equivalent to
+.BR -OX .
+.IP "noRangeCheck (1|yes|true|0|no|false)"
+Disables the validation of values that is done by
+.B snmpset
+before issuing the request to the agent.
+Equivalent to
+.BR -Ir .
+.IP "noDisplayHint (1|yes|true|0|no|false)"
+Disables the use of DISPLAY-HINT information when parsing indices and
+values to set. Equivalent to
+.BR -Ih .
+.IP "dumpPacket (1|yes|true|0|no|false)"
+Whether the commands should dump packets by default.
+.IP "doDebugging (1|0)"
+Turns on debugging for all applications run if set to 1.
+.IP "debugTokens TOKEN[,TOKEN...]"
+The debugging tokens that should be printed.  See the
+.I snmpcmd(1)
+manual page for debugging usage details.
+.SH "SEE ALSO"
+snmp_config(5), read_config(3), snmpcmd(1).
+.\" Local Variables:
+.\"  mode: nroff
+.\" End:
diff -Naur tomato/release/src/router/snmp/man/snmp_config.5.def tomato121/release/src/router/snmp/man/snmp_config.5.def
--- tomato/release/src/router/snmp/man/snmp_config.5.def	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/man/snmp_config.5.def	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,102 @@
+.TH SNMP.CONF 5 "28 Aug 2001" VVERSIONINFO "Net-SNMP"
+.UC 4
+.SH NAME
+snmp_config - describes how to configure the Net-SNMP applications.
+.SH DESCRIPTION
+The Net-SNMP package uses various configuration files to configure its 
+applications.  This manual page merely describes the overall nature of 
+them, so that the other manual pages don't have to.
+.SH "DIRECTORIES SEARCHED"
+First off, there are numerous places that configuration files can be
+found and read from.  By default, the applications look for
+configuration files in the following 4 directories, in order:
+SYSCONFDIR/snmp,
+DATADIR/snmp, LIBDIR/snmp, and $HOME/.snmp.  In each of these
+directories, it looks for files with the extension of both
+.IR .conf " and " .local.conf
+(reading the second ones last).  In this manner, there are
+8 default places a configuration file can exist for any given
+configuration file type.
+.PP
+Additionally, the above default search path can be overridden by
+setting the environment variable SNMPCONFPATH to a colon-separated
+list of directories to search for.
+.PP
+Finally, applications that store persistent data will also look in the 
+PERSISTENT_DIRECTORY directory for configuration files there.
+.SH "CONFIGURATION FILE TYPES"
+Each application may use multiple configuration files, which will
+configure various different aspects of the application.  For instance, 
+the SNMP agent
+.RB ( snmpd )
+knows how to understand configuration
+directives in both the snmpd.conf and the snmp.conf files.  In fact,
+most applications understand how to read the contents of the snmp.conf 
+files.  Note, however, that configuration directives understood in one 
+file may not be understood in another file.  For further information,
+read the associated manual page with each configuration file type.
+Also, most of the applications support a 
+.B -H
+switch on the command line that will list the configuration files it
+will look for and the directives in each one that it understands.
+.PP
+The snmp.conf configuration file is intended to be a application suite 
+wide configuration file that supports directives that are useful for
+controlling the fundamental nature of all of the SNMP applications,
+such as how they all manipulate and parse the textual SNMP MIB files.
+.SH "SWITCHING CONFIGURATION TYPES IN MID-FILE"
+It's possible to switch in mid-file the configuration type that the
+parser is supposed to be reading.  Since that sentence doesn't make
+much sense, lets give you an example: say that you wanted to turn on
+packet dumping output for the agent by default, but you didn't want to
+do that for the rest of the applications (ie, snmpget, snmpwalk, ...).
+Normally to enable packet dumping in the configuration file
+you'd need to put a line like:
+.PP
+.RS
+dumpPacket true
+.RE
+.PP
+into the snmp.conf file.  But, this would turn it on for all of the
+applications.  So, instead, you can put the same line in the
+snmpd.conf file so that it only applies to the snmpd daemon.  However,
+you need to tell the parser to expect this line.  You do this by
+putting a special type specification token inside a [] set.  In other
+words, inside your snmpd.conf file you could put the above snmp.conf
+directive by adding a line like so:
+.PP
+.RS
+[snmp] dumpPacket true
+.RE
+.PP
+This tells the parser to parse the above line as if it were inside a
+snmp.conf file instead of an snmpd.conf file.  If you want to parse a
+bunch of lines rather than just one then you can make the context
+switch apply to the remainder of the file or until the next context
+switch directive by putting the special token on a line by itself:
+.PP
+.RS
+.nf
+# make this file handle snmp.conf tokens:
+[snmp]
+dumpPacket true
+logTimestamp true
+# return to our original snmpd.conf tokens:
+[snmpd]
+rocommunity mypublic
+.RE
+.SH COMMENTS
+.PP
+Any lines beginning with the character '#' in the configuration files
+are treated as a comment and are not parsed.
+.SH "API INTERFACE"
+.PP
+Information about writing C code that makes use of this system in
+either the agent's MIB modules or in applications can be found in the
+.I read_config(3)
+manual page.
+.SH "SEE ALSO"
+read_config(3).
+.\" Local Variables:
+.\"  mode: nroff
+.\" End:
diff -Naur tomato/release/src/router/snmp/man/snmpd.8.def tomato121/release/src/router/snmp/man/snmpd.8.def
--- tomato/release/src/router/snmp/man/snmpd.8.def	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/man/snmpd.8.def	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,254 @@
+.TH SNMPD 8 "7 Feb 2002" VVERSIONINFO "Net-SNMP"
+.UC 4
+.SH NAME
+snmpd - daemon to respond to SNMP request packets.
+.SH SYNOPSIS
+.B snmpd
+[OPTIONS] [LISTENING ADDRESSES]
+.SH DESCRIPTION
+.B snmpd
+is an SNMP agent which binds to a port and awaits requests from
+SNMP management software.  Upon receiving a request, it processes the
+request(s), collects the requested information and/or performs the
+requested operation(s) and returns the information to the sender.
+.SH OPTIONS
+.TP 8
+.B -a
+Log the source addresses of incoming requests.
+.TP
+.B -A
+Append to the log file rather than truncating it.
+.TP
+.B "-c" \fIFILE
+Read 
+.I FILE
+as a configuration file.
+.TP
+.B -C
+Do not read any configuration files except the one optionally specified by the 
+.B -c 
+option.
+.TP
+.B -d
+Dump (in hexadecimal) the sent and received SNMP packets.
+.TP
+.B -D\fI[TOKEN[,...]]
+Turn on debugging output for the given
+.IR "TOKEN" "(s)."
+Without any tokens specified, it defaults to printing all the tokens
+(which is equivalent to the keyword "ALL").
+You might want to try
+.IR ALL
+for extremely verbose output.  Note: You can not put a space between
+the -D flag and the listed TOKENs.
+.TP
+.B -f
+Do not fork() from the calling shell.
+.TP
+.B -g \fIGID
+Change to the numerical group ID
+.I GID
+after opening listening sockets.
+.TP
+.B -h, --help
+Display a brief usage message and then exit.
+.TP
+.B -H
+Display a list of configuration file directives understood by the
+agent and then exit.
+.TP
+.B -I \fI[-]INITLIST
+This option specifies which modules you do (or do not) want to be
+initialized when the agent starts up.  If the comma-separated
+.I INITLIST
+is preceded
+with a '-', it is the list of modules that you do
+.I not
+want to be started.  Otherwise,
+.I INITLIST
+is the list of modules to be started.
+
+To get a list of compiled modules, run the agent with the arguments
+.I "-Dmib_init -H"
+(assumes you have debugging support compiled in).
+.TP
+.BR -l "" " " "[\fIFILE" "" "]"
+Log all output from the agent (including stdout and stderr) to 
+.IR FILE .
+If no filename is given, log to a default file set at compile time
+(normally /var/log/snmpd.log).
+.TP
+.B -L
+Do not open a log file; print all messages to stderr instead.
+.TP
+.B -P \fIFILE
+Save the process ID of the daemon in
+.IR FILE "."
+.TP 
+.B -q
+Print simpler output for easier automated parsing.
+.TP
+.B -r
+Do not require root access to run the daemon.  Specifically, do not exit
+if files only accessible to root (such as /dev/kmem etc.) cannot be
+opened.
+.TP
+.B -s
+Use syslog for logging.
+.TP
+.BR -S " d|0-7"
+Specifies the syslog facility to use when logging to syslog.  'd' means
+.B LOG_DAEMON
+and 0 through 7 mean 
+.BR LOG_LOCAL0 " through " LOG_LOCAL7 ".  " LOG_DAEMON " is the default."
+.TP
+.B -u \fIUID
+Change to the user ID
+.I UID
+(which can be given in numerical or textual form) after opening
+listening sockets.
+.TP
+.B -v, --version
+Print version information for the agent and then exit.
+.TP
+.B -V
+Symbolically dump SNMP transactions.
+.TP
+.B -x \fIADDRESS
+Listens for AgentX connections on the specified address
+rather than the default '/var/agentx/master'.
+The address can either be a Unix domain socket path,
+or the address of a network interface.  The format is the same as the
+format of listening addresses described below.
+.TP
+.B -X
+Run as an AgentX subagent rather than as an SNMP master agent.
+
+.SH LISTENING ADDRESSES
+By default,
+.B snmpd
+listens for incoming SNMP requests only on UDP port 161.  However, it
+is possible to modify this behaviour by specifying one or more
+listening addresses as arguments to
+.BR snmpd .
+A listening address takes the form:
+.IP
+[<transport-specifier>:]<transport-address>
+.PP
+At its simplest, a listening address may consist only of a port
+number, in which case
+.B snmpd
+listens on that UDP port on all IPv4 interfaces.  Otherwise, the
+<transport-address> part of the specification is parsed according to
+the following table:
+.RS 4
+.TP 28
+.BR "<transport-specifier>"
+.BR "<transport-address> format"
+.IP "udp" 28
+hostname[:port]
+.I or
+IPv4-address[:port]
+.IP "tcp" 28
+hostname[:port]
+.I or
+IPv4-address[:port]
+.IP "unix" 28
+pathname
+.IP "ipx" 28
+[network]:node[/port]
+.TP 28 
+.IR "" "aal5pvc " or " pvc"
+[interface.][VPI.]VCI
+.TP 28
+.IR "" "udp6 " or " udpv6 " or " udpipv6"
+hostname[:port]
+.I or
+IPv6-address[:port]
+.TP 28
+.IR "" "tcp6 " or " tcpv6 " or " tcpipv6"
+hostname[:port]
+.I or
+IPv6-address[:port]
+.RE
+.PP
+Note that <transport-specifier> strings are case-insensitive so that,
+for example, "tcp" and "TCP" are equivalent.  Here are some examples,
+along with their interpretation:
+.TP 24
+.IR "127.0.0.1:161"
+listen on UDP port 161, but only on the loopback interface.  This
+prevents
+.B snmpd
+being queried remotely (which is a bit pointless).  The ":161" is
+redundant here since that is the default SNMP port in any case.
+.TP 24
+.IR "TCP:1161"
+listen on TCP port 1161 on all IPv4 interfaces.
+.TP 24
+.IR "ipx:/40000"
+listen on IPX port 40000 on all IPX interfaces.
+.TP 24
+.IR "unix:/tmp/local-agent"
+listen on the Unix domain socket 
+.IR /tmp/local-agent .
+.TP 24
+.IR "/tmp/local-agent"
+identical to the previous specification, since the Unix domain is the
+default transport iff the first character of the <transport-address>
+is a '/'.
+.TP 24
+.IR "PVC:161"
+listen on the AAL5 permanent virtual circuit with VPI=0 and VCI=161
+(decimal) on the first ATM adapter in the machine.
+.TP 24
+.IR "udp6:10161"
+listen on port 10161 on all IPv6 interfaces.
+.PP
+Note that not all the transport domains listed above will always be
+available; for instance, hosts with no IPv6 support will not be able
+to use udp6 transport addresses, and attempts to do so will result in
+the error "Error opening specified endpoint".  Likewise, since AAL5
+PVC support is only currently available on Linux, it will fail with
+the same error on other platforms.
+
+.RE
+.SH CONFIGURATION FILES
+.PP
+.B snmpd
+checks for the existence of and parses the following files:
+.TP 6
+.B SYSCONFDIR/snmp/snmp.conf
+Common configuration for the agent and applications. See
+.I snmp.conf(5)
+for details.
+.TP
+.B SYSCONFDIR/snmp/snmpd.conf
+.TP
+.B SYSCONFDIR/snmp/snmpd.local.conf
+Agent-specific configuration.  See
+.I snmpd.conf(5)
+for details.  These files are optional and may be used to configure
+access control, trap generation, subagent protocols and much else
+besides.
+.IP
+In addition to these two configuration files in SYSCONFDIR/snmp, the
+agent will read any files with the names
+.I snmpd.conf
+and
+.I snmpd.local.conf
+in a colon separated path specified in the
+SNMPCONFPATH environment variable.
+.TP
+.B DATADIR/snmp/mibs/
+The agent will also load all files in this directory as MIBs.  It will
+not, however, load any file that begins with a '.' or descend into
+subdirectories.
+.SH SEE ALSO
+(in recommended reading order)
+.PP
+snmp.conf(5),
+snmpd.conf(5)
+.\" Local Variables:
+.\"  mode: nroff
+.\" End:
diff -Naur tomato/release/src/router/snmp/man/snmpd.conf.5.def tomato121/release/src/router/snmp/man/snmpd.conf.5.def
--- tomato/release/src/router/snmp/man/snmpd.conf.5.def	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/man/snmpd.conf.5.def	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,858 @@
+.TH SNMPD.CONF 5 "28 Feb 2003" VVERSIONINFO "Net-SNMP"
+.UC 4
+.SH NAME
+SYSCONFDIR/snmp/snmpd.conf - configuration file for the Net-SNMP SNMP agent.
+.SH DESCRIPTION
+.B snmpd.conf
+is the configuration file which defines how the Net-SNMP SNMP agent
+operates.  These files may contain any of the directives found in the
+.B DIRECTIVES
+section below.  This file is not required for the agent to
+operate and respond to requests.
+.SH PLEASE READ FIRST
+First, make sure you have read the
+.I snmp_config(5) 
+manual page that describes how the Net-SNMP configuration files
+operate, where they are located and how they all work together.
+.PP
+Also, you might consider looking into the
+.B snmpconf
+application (perl script) which can help you build an snmpd.conf file
+by prompting you for information.  You should try it.  Really.  Go
+ahead.  Right now.  Run:
+.RS
+.IP "snmpconf -g basic_setup"
+.RE
+.PP
+to get you started. See the
+.I snmpconf(1)
+manual page for more information.
+.SH EXTENSIBLE-MIB
+.PP
+The Net-SNMP SNMP agent reports much of its information through
+queries to the EXTENSIBLEDOTMIB section of the MIB tree.  Every MIB in
+this section has the following table entries in it.
+.IP ".MIBINDEX -- index"
+This is the table's index numbers for each of the DIRECTIVES listed below.
+.IP ".ERRORNAME -- name"
+The name of the given table entry.  This should be unique, but is not
+required to be.
+.IP ".ERRORFLAG -- errorFlag"
+This is a flag returning either the integer value 1 or 0 if an error
+is detected for this table entry.
+.IP ".ERRORMSG -- errorMsg"
+This is a DISPLAY-STRING describing any error triggering the errorFlag above.
+.IP ".ERRORFIX -- errorFix"
+If this entry is set to the integer value of 1 AND the errorFlag
+defined above is indeed a 1, a program or script will get executed
+with the table entry name from above as the argument.  The program to
+be executed is configured in the config.h file at compile time.
+.SS Directives
+.IP "proc NAME"
+.IP "proc NAME MAX"
+.IP "proc NAME MAX MIN"
+.IP
+Checks to see if processes called NAME are running on the agent
+machine.  An error flag (1) and a description message are then passed
+to the EXTENSIBLEDOTMIB.PROCMIBNUM.1.ERRORFLAG and
+EXTENSIBLEDOTMIB.PROCMIBNUM.1.ERRORMSG MIB columns (respectively) if
+the NAME'd program is not found in the process table as reported by
+PSCMD.
+.IP
+If MAX and MIN are not specified, MAX is assumed to be 
+.B infinity
+and MIN is assumed to be 1.
+.IP
+If MAX is specified but MIN is not specified, MIN is assumed to be 0.
+.IP "procfix NAME PROG ARGS"
+This registers a command that knows how to fix errors with the given
+process NAME.  When EXTENSIBLEDOTMIB.PROCMIBNUM.1.ERRORFIX for a given
+NAMEd program is set to the integer value of 1, this command will be
+called.  It defaults to a compiled value set using the PROCFIXCMD
+definition in the config.h file.
+.IP "exec NAME PROG ARGS"
+.IP "exec MIBNUM NAME PROG ARGS"
+.IP
+If MIBNUM is not specified, the agent executes the named PROG with
+arguments of ARGS and returns the exit status and the first line of
+the STDOUT output of the PROG program to queries of the
+EXTENSIBLEDOTMIB.SHELLMIBNUM.1.ERRORFLAG and
+EXTENSIBLEDOTMIB.SHELLMIBNUM.1.ERRORMSG mib columns (respectively).  All
+STDOUT output beyond the first line is silently truncated.
+.IP
+If MIBNUM is specified, it acts as above but returns the exit status
+to MIBNUM.ERRORFLAG.0 and the entire STDOUT output to the table
+MIBNUM.ERRORMSG in a MIB table.  In this case, the MIBNUM.ERRORMSG mib
+contains the entire STDOUT output, one MIB table entry per line of
+output (ie, the first line is output as MIBNUM.ERRORMSG.1, the second
+at MIBNUM.ERRORMSG.2, etc...).
+.RS
+.IP Note:
+The MIBNUM must be specified in dotted-integer notation and can
+not be specified as ".iso.org.dod.internet..." (should instead
+be .1.3.6.1...).
+.IP Note: 
+The agent caches the exit status and STDOUT of the executed program
+for 30 seconds after the initial query.  This is to increase speed and
+maintain consistency of information for consecutive table queries.
+The cache can be flushed by a snmp-set request of integer(1) to
+EXTENSIBLEDOTMIB.VERSIONMIBNUM.VERCLEARCACHE.
+.RE
+.IP "execfix NAME PROG ARGS"
+This registers a command that knows how to fix errors with the given
+exec or sh NAME.  When EXTENSIBLEDOTMIB.SHELLMIBNUM.1.ERRORFIX for a
+given NAMEd entry is set to the integer value of 1, this command will
+be called.  It defaults to a compiled value set using the EXECFIXCMD
+definition in the config.h file.
+.IP "disk PATH"
+.IP "disk PATH [ MINSPACE | MINPERCENT% ]"
+.IP
+Checks the named disks mounted at PATH for available disk space.  If
+the disk space is less than MINSPACE (kB) if specified or less than
+MINPERCENT (%) if a % sign is specified, or DEFDISKMINIMUMSPACE (kB)
+if not specified, the associated entry in the
+EXTENSIBLEDOTMIB.DISKMIBNUM.1.ERRORFLAG MIB table will be set to (1) and
+a descriptive error message will be returned to queries of
+EXTENSIBLEDOTMIB.DISKMIBNUM.1.ERRORMSG.
+.IP "load MAX1"
+.IP "load MAX1 MAX5"
+.IP "load MAX1 MAX5 MAX15"
+.IP
+Checks the load average of the machine and returns an error flag (1),
+and an text-string error message
+to queries of EXTENSIBLEDOTMIB.LOADAVEMIBNUM.1.ERRORFLAG and
+EXTENSIBLEDOTMIB.LOADAVEMIBNUM.1.ERRORMSG (respectively) when the
+1-minute, 5-minute, or 15-minute averages exceed the associated
+maximum values.  If any of the MAX1, MAX5, or MAX15 values are
+unspecified, they default to a value of DEFMAXLOADAVE.
+.IP "file FILE [MAXSIZE]"
+Monitors file sizes and makes sure they don't grow beyond a certain
+size (in kilobytes).  MAXSIZE defaults to infinite if not specified,
+and only monitors the size without reporting errors about it.
+A maximum of 20 files can be monitored.
+.SS "Errors"
+.PP
+Any errors in obtaining the above information are reported via the
+EXTENSIBLEDOTMIB.ERRORMIBNUM.1.ERRORFLAG flag and the
+EXTENSIBLEDOTMIB.ERRORMIBNUM.1.ERRORMSG text-string description.
+.SH AGENTX SUB-AGENTS
+To enable AgentX support in the SNMP master agent, put the following
+line in your snmpd.conf file:
+.IP "master agentx"
+See README.agentx for further details.
+.IP "AgentXSocket addr"
+This defines the address the master agent listens at.
+The default is /var/agentx/master. Another possibility is localhost:705
+.IP "AgentXTimeout addr"
+Defines the timeout period for an AgentX request.
+Default is 1 second.
+.IP "AgentXRetries addr"
+Defines the number of retries for an AgentX request.
+Default is 5 retries.
+.P
+You can also put the following in your subagent.conf file (where
+"subagent" is the name you used in your init_snmp("subagent") api call:
+.IP "agentPingInterval NUM"
+This makes the subagent try and reconnect every NUM seconds to the
+master if it ever becomes (or starts) disconnected.
+>>>>>>> 5.4.2.3
+.SH SMUX SUB-AGENTS
+To enable and SMUX based sub-agent, such as
+.IR gated ,
+use the
+.I smuxpeer
+configuration entry
+.IP "smuxpeer OID PASS"
+For 
+.I gated
+a sensible entry might be
+.I smuxpeer .1.3.6.1.4.1.4.1.3 secret
+.SH DYNAMICALLY LOADABLE MODULES
+If the agent is built with support for the UCD-DLMOD-MIB it is capable
+of loading agent MIB modules dynamically at startup through
+the \fIdlmod\fR directive and during runtime through use of the UCD-DLMOD-MIB.
+The following directive loads the shared object module file PATH which
+uses the module name prefix NAME.
+.IP "dlmod NAME PATH"
+.IP
+.SH ACCESS CONTROL
+.B snmpd
+supports the View-Based Access Control Model (VACM) as defined in RFC
+2575.  To this end, it recognizes the following keywords in the
+configuration file: \fIcom2sec\fR, \fIgroup\fR, \fIaccess\fR, and
+\fIview\fR as well as some easier-to-use wrapper directives:
+\fIrocommunity\fR, \fIrwcommunity\fR, \fIrouser\fR, \fIrwuser\fR.  If
+IPv6 support has been enabled, the \fIrocommunity6\fR and
+\fIrwcommunity6\fR tokens will also be available.  This section
+defines how to configure the snmpd program to accept various types and
+levels of access.
+.IP "rouser USER [noauth|auth|priv] [OID]"
+.IP "rwuser USER [noauth|auth|priv] [OID]"
+Creates a SNMPv3 USM user in the VACM access configuration tables.  It
+is more efficient (and powerful) to use the combined \fIgroup\fR,
+\fIaccess\fR, and \fIview\fR directives instead, but these wrapper
+directives are much simpler.
+.IP
+The minimum level of authentication and privacy the user must use is
+specified by the first token (which defaults to "auth").  The OID
+parameter restricts access for that user to everything below the given
+OID.
+.IP "rocommunity COMMUNITY [SOURCE] [OID]"
+.IP "rwcommunity COMMUNITY [SOURCE] [OID]"
+These create read-only and read-write communities that can be used to
+access the agent.  They are a quick wrapper around the more complex
+and powerful \fIcom2sec\fR, \fIgroup\fR, \fIaccess\fR, and \fIview\fR
+directive lines.  They are not as efficient either, as groups aren't
+created so the tables are possibly larger.  In other words: don't use
+these if you have complex situations to set up.  If your setup is
+simple or you don't mind a small performance hit, use these
+directives.
+.IP
+The format of the SOURCE is token is described in the \fIcom2sec\fR
+directive section below.  The OID token restricts access for that
+community to everything below that given OID.
+.IP "rocommunity6 COMMUNITY [SOURCE] [OID]"
+.IP "rwcommunity6 COMMUNITY [SOURCE] [OID]"
+They are the alternative directives to the \fIrocommunity\fR,
+\fIrwcommunity\fR for the transport domain UDPIPv6. They are only
+valid in specifing \fIUDPIPv6\fR as transport domain.
+.IP
+The format of the SOURCE is token is described in the \fIcom2sec6\fR
+directive section below.  The OID token restricts access for that
+community to everything below that given OID.
+.IP "com2sec NAME SOURCE COMMUNITY"
+This directive specifies the mapping from a source/community pair to
+a security name. SOURCE can be a hostname, a subnet, or the word
+\fI"default"\fR.
+A subnet can be specified as IP/MASK or IP/BITS.
+The first source/community combination that matches the incoming packet
+is selected.
+.IP "com2sec6 NAME SOURCE COMMUNITY"
+This directive is the IPv6 version of \fIcom2sec\fR.
+A subnet can be specified as IPv6/IPv6MASK or IPv6/BITS.
+It is only valid in specifing \fIUDPIPv6\fR as transport domain.
+.IP "group NAME MODEL SECURITY"
+This directive defines the mapping from securitymodel/securityname to group.
+MODEL is one of \fIv1\fR, \fIv2c\fR, or \fIusm\fR.
+.IP "access NAME CONTEXT MODEL LEVEL PREFX READ WRITE NOTIFY"
+The access directive maps from group/security model/security level to
+a view. 
+MODEL is one of \fIany\fR, \fIv1\fR, \fIv2c\fR, or \fIusm\fR.
+LEVEL is one of \fInoauth\fR, \fIauth\fR, or \fIpriv\fR.
+PREFX specifies how CONTEXT should be matched against the context of
+the incoming pdu, either \fIexact\fR or \fIprefix\fR.
+READ, WRITE and NOTIFY specifies the view to be used for the corresponding 
+access.
+For v1 or v2c access, LEVEL will be noauth, and CONTEXT will be empty.
+.IP "view NAME TYPE SUBTREE [MASK]"
+This defines the named view. TYPE is either \fIincluded\fR or \fIexcluded\fR.
+MASK is a list of hex octets, separated by '.' or ':'.  The MASK
+defaults to "ff" if not specified.
+.IP
+The reason for the mask is, that it allows you to control access to
+one row in a table, in a relatively simple way. As an example, as an ISP
+you might consider giving each customer access to his or her own interface:
+.IP
+.nf
+view cust1 included interfaces.ifTable.ifEntry.ifIndex.1 ff.a0
+view cust2 included interfaces.ifTable.ifEntry.ifIndex.2 ff.a0
+.IP
+(interfaces.ifTable.ifEntry.ifIndex.1 == .1.3.6.1.2.1.2.2.1.1.1,
+ff.a0 == 11111111.10100000. which nicely covers up and including
+the row index, but lets the user vary the field of the row)
+.IP "VACM Examples:"
+.nf
+#        sec.name  source          community
+com2sec  local     localhost       private
+com2sec  mynet     10.10.10.0/24   public
+com2sec  public    default         public
+com2sec6 mynet     fec0::/64       public
+
+#             sec.model  sec.name
+group mygroup v1         mynet
+group mygroup v2c        mynet
+group mygroup usm        mynet
+group local   v1         local
+group local   v2c        local
+group local   usm        local
+group public  v1         public
+group public  v2c        public
+group public  usm        public
+
+#           incl/excl subtree                          mask
+view all    included  .1                               80
+view system included  system                           fe
+view mib2   included  .iso.org.dod.internet.mgmt.mib-2 fc
+
+#              context sec.model sec.level prefix read   write notify
+access mygroup ""      any       noauth    exact  mib2   none  none
+access public  ""      any       noauth    exact  system none  none
+access local   ""      any       noauth    exact  all    all   all
+.IP "Default VACM model"
+The default configuration of the agent, as shipped, is functionally
+equivalent to the following entries:
+.nf
+com2sec	public	default	public
+group	public	v1	public
+group	public	v2c	public
+group	public	usm	public
+view 	all	included	.1
+access	public	""	any	noauth	exact	all	none	none
+.SH SNMPv3 CONFIGURATION
+.PP
+.IP "engineID STRING"
+The snmpd agent needs to be configured with an engineID to be able to
+respond to SNMPv3 messages.  With this configuration file line, the
+engineID will be configured from STRING.  The default value of the
+engineID is configured with the first IP address found for the
+hostname of the machine.
+.IP "createUser username (MD5|SHA) authpassphrase [DES] [privpassphrase]"
+.IP
+MD5 and SHA are the authentication types to use, but you must have
+built the package with openssl installed in order to use SHA.  The
+only privacy protocol currently supported is DES.  If the privacy
+passphrase is not specified, it is assumed to be the same as the
+authentication passphrase.  Note that the users created will be
+useless unless they are also added to the VACM access control tables
+described above.
+.IP
+Warning: the minimum pass phrase length is 8 characters.
+.IP
+SNMPv3 users can be created at runtime using the
+.I snmpusm(1)
+command.
+.IP
+Instead of figuring out how to use this directive and where to put it
+(see below), just run "net-snmp-config --create-snmpv3-user" instead,
+which will add one of these lines to the right place.
+.IP
+This directive should be placed into the
+PERSISTENT_DIRECTORY/snmpd.conf file instead of the other normal
+locations.  The reason is that the information is read from the file
+and then the line is removed (eliminating the storage of the master
+password for that user) and replaced with the key that is derived from
+it.  This key is a localized key, so that if it is stolen it can not
+be used to access other agents.  If the password is stolen, however,
+it can be.
+.IP
+.SH SETTING SYSTEM INFORMATION
+.IP "syslocation STRING"
+.IP "syscontact STRING"
+.IP "sysname STRING"
+Sets the system location, system contact or system name for the agent.
+This information is reported in the 'system' group the mibII tree.
+Ordinarily these objects (sysLocation.0, sysContact.0 and sysName.0)
+are read-write.  However, specifying the value for one of these
+objects by giving the appropriate token makes the corresponding object
+read-only, and attempts to set the value of the object will result in
+a notWritable error response.
+.IP "sysservices NUMBER"
+Sets the value of the system.sysServices.0 object.
+For a host, a good value is 72.
+.IP "sysdescr STRING"
+.IP "sysobjectid OID"
+Sets the system description or object ID for the agent.
+Although these values are not SNMP-writable, it is conceivable
+that a network administrator may wish to configure them to something
+other than the default values.
+.IP "agentaddress [<transport-specifier>:]<transport-address>[,...]"
+Makes the agent list on the specified comma-separated list of
+listening addresses instead of the default behaviour, which is to
+listen on UDP port 161 on all IPv4 interfaces.  See the section 
+.B LISTENING ADDRESSES
+in the
+.I snmpd(8)
+manual page for more information about the format of listening
+addresses.  For example, specifying
+.I "agentaddress 161,tcp:161,localhost:9161"
+will make the agent listen on UDP port 161 on all IPv4 interfaces, TCP
+port 161 on all IPv4 interfaces and UDP port 9161 only on the interface
+associated with the localhost address.
+.IP "agentgroup groupid"
+Change to this gid after opening port. The groupid may refer to a group
+by name or a number if the group number starts with '#'. For example,
+specifying
+.I agentgroup snmp
+will cause the agent to run as the snmp group or
+.I agentgroup #10
+will cause the agent to run as the group with groupid 10.
+.IP "agentuser uid"
+Change to this uid after opening port. The userid may refer to a user
+by name or a number if the user number starts with '#'. For example,
+specifying
+.I agentuser snmp
+will cause the agent to run as the snmp user or
+.I agentuser #10
+will cause the agent to run as the user with userid 10.
+.IP "interface NAME TYPE SPEED"
+For interfaces where the agent fails to guess correctly on the type and
+speed, this directive can supply additional information.
+TYPE is a type value as given in the IANAifType-MIB.
+.IP "ignoredisk STRING"
+When scanning for available disk devices the agent might block in trying
+to open all possible disk devices. This might lead to a timeout when
+walking the device tree. Sometimes the next walk will run without timeout,
+sometimes it will timeout every time you try it.
+.IP
+If you experience such behaviour you might add this directive and give all
+device names not to be checked (i.e. opened). You might have more than one
+such directive in your configuration file stating all devices not to be
+opened. You might also specify those devices using wildcards similar to
+the syntax you can use in a bourne shell (see examples below).
+.IP
+.B Note:
+For a list of devices scanned for every system please consult the sources
+(host/hr_disk.c) and check for the Add_HR_Disk_entry() calls relevant for
+your type of OS.
+.IP
+Examples:
+.IP
+ignoredisk /dev/rdsk/c0t2d0
+.IP
+This directive prevents the device /dev/rdsk/c0t2d0 from being scanned.
+.IP
+ignoredisk /dev/rdsk/c0t[!6]d0
+.IP
+This directive prevents all devices /dev/rdsk/c0tXd0 except .../c0t6d0
+from being scanned. For most systems similar is the following directive:
+.IP
+ignoredisk /dev/rdsk/c0t[0-57-9a-f]d0
+.IP
+ignoredisk /dev/rdsk/c1*
+.IP
+This directive prevents all devices whose device names start with /dev/rdsk/c1
+from being scanned.
+.IP
+ignoredisk /dev/rdsk/c?t0d0
+.IP
+This directive prevents all devices /dev/rdsk/cXt0d0 ('X' might be any char)
+from being scanned.
+.IP
+You might use more than one such wildcard expression in any such directive.
+.IP "storageUseNFS NUMBER"
+Setting storageUseNFS to 1 causes all NFS and NFS-like file systems to be
+marked as 'Network Disks' in the hrStorageTable. This is according to RFC 2790.
+Not setting storageUseNFS or setting it to 2 causes NFS and NFS-like file
+systems to be marked as 'Fixed Disks' as it has been in previous versions of
+the ucd-snmp SNMP agent.
+.IP "authtrapenable NUMBER"
+Setting authtrapenable to 1 enables generation of authentication failure
+traps.  The default value is disabled(2).  Ordinarily the corresponding
+object (snmpEnableAuthenTraps.0) is read-write, but setting its value
+via this token makes the object read-only, and attempts to set the
+value of the object will result in a notWritable error response.
+.IP "override OID TYPE VALUE"
+This directive allows you to override a particular OID with a
+different value (and possibly a different type of value).
+.\" The -rw flag will allow snmp SETs to modify it's value as well.
+An example:
+.IP
+override sysDescr.0 octet_str "my own sysDescr"
+.IP
+That line will set the sysDescr.0 value to "my own sysDescr" as well
+as make it modifiable with SNMP SETs as well (which is actually
+illegal according to the MIB specifications).
+.IP
+Note that care must be taken when using this.  For example, if you try
+to override a property of the 3rd interface in the ifTable with a new
+value and later the numbering within the ifTable changes it's index
+ordering you'll end up with problems and your modified value won't
+appear in the right place in the table.
+.IP
+Valid TYPEs are: integer, uinteger, octet_str, bit_str, object_id,
+counter, gauge, null.  Note that setting an object to "null"
+effectively delete's it as being accessible.  No VALUE needs to be
+given if the object type is null.
+.IP
+More types should be available in the future, as well as writable
+object support.
+.SH "SETTING UP TRAP AND/OR INFORM DESTINATIONS"
+.IP "trapcommunity STRING"
+This defines the default community string to be used when sending traps.
+Note that this command must be used prior to any of the following three
+commands that are intended use this community string.
+.IP "trapsink HOST [COMMUNITY [PORT]]"
+.IP "trap2sink HOST [COMMUNITY [PORT]]"
+.IP "informsink HOST [COMMUNITY [PORT]]"
+These commands define
+the hosts to receive traps (and/or inform notifications). The
+daemon sends a Cold Start trap when it starts up. If enabled, it also sends
+traps on authentication failures.  Multiple \fItrapsink\fR, \fItrap2sink\fR
+and \fIinformsink\fR lines may be specified to specify multiple destinations.
+Use \fItrap2sink\fR to send SNMPv2 traps and \fIinformsink\fR to send
+inform notifications.
+If COMMUNITY is not specified, the string from a preceding \fItrapcommunity\fR
+directive will be used. If PORT is not specified, the well known SNMP trap
+port (162) will be used.
+.IP "trapsess [SNMPCMD_ARGS] HOST"
+This is a more generic trap configuration token that allows any type
+of trap destination to be specified with any version of SNMP.  See the 
+.I snmpcmd(1)
+manual page for further details on the arguments that can be passed as
+.I "SNMPCMD ARGS".
+In addition to the arguments listed there, the special argument
+\fI-Ci\fR specifies that you want inform notifications to be used
+instead of unacknowledged traps (this requires that you also specify a 
+version number of v2c or v3 as well).
+.SH "PROXY SUPPORT"
+.IP "proxy [-Cn CONTEXTNAME] [SNMPCMD ARGS] HOST OID [REMOTEOID]"
+.IP
+This token specifies that any incoming requests under OID should be
+proxied on to another HOST instead.  If a CONTEXTNAME is specified, it
+assigns the proxied tree to a particular context name within the local
+agent.  This is the proper way to query multiple agents through a
+single proxy.  Assign each remote agent to a different context name.
+Then you can use "snmpwalk -n contextname1" to walk one remote proxied
+agent and "snmpwalk -n contextname2" to walk another, assuming you are
+using SNMPv3 to talk to the proxy (snmpv1 and snmpv2c context mappings
+aren't currently supported but might be in the future).  Optionally,
+relocate the local OID tree to the new location at the REMOTEOID.  To
+authenticate to HOST you should use the appropriate set of
+.I "SNMPCMD ARGS."
+See the
+.I snmpcmd(1)
+manual page for details.
+.IP
+Examples:
+.RS
+.IP
+.nf
+# assigns the entire mib tree on remotehost1 to the context of the
+# same name:
+proxy -Cn remotehost1 -v 1 -c public remotehost1 .1.3
+# ditto, but for remotehost 2
+proxy -Cn remotehost2 -v 1 -c public remotehost2 .1.3
+# proxies only the ucdavis enterprises tree to the remote host using snmpv1
+proxy -v 1 -c public remotehost .1.3.6.1.4.1.2021
+# uses v3 to access remotehost and converts the remote .1.3.6.1.2.1.1
+# oid to local .1.3.6.1.3.10 oid (another way to access mulitple hosts
+# without using contexts)
+proxy -v 3 -l noAuthNoPriv -u user remotehost .1.3.6.1.3.10 .1.3.6.1.2.1.1
+.SH "PASS-THROUGH CONTROL"
+.IP "pass MIBOID EXEC"
+(If you're writing perl scripts, please see the embedded perl support
+information later in this manual page).  Passes entire control of
+MIBOID to the EXEC program.  The EXEC program is called in one of the
+following three ways:
+.RS
+.IP "EXEC -g MIBOID"
+.IP "EXEC -n MIBOID"
+.IP
+These call lines match to SNMP get and getnext requests.  It is
+expected that the EXEC program will take the arguments passed to it
+and return the appropriate response through it's stdout.  
+.IP
+The first line of stdout should be the MIB OID of the returning value.
+The second line should be the TYPE of value returned, where TYPE is
+one of the text strings:
+.B string, integer, unsigned, objectid, timeticks, ipaddress, counter, 
+or
+.B gauge.
+The third line of stdout should be the VALUE corresponding with the
+returned TYPE.
+.IP
+For instance, if a script was to return the value integer value "42"
+when a request for .1.3.6.1.4.100 was requested, the script should
+return the following 3 lines:
+.br
+.RS
+  .1.3.6.1.4.100
+.br
+  integer
+.br
+  42
+.RE
+.IP
+To indicate that the script is unable to comply with the request due
+to an end-of-mib condition or an invalid request, simple exit and
+return no output to stdout at all.  An SNMP error will be generated
+corresponding to the SNMP noSuchName response.
+.IP "EXEC -s MIBOID TYPE VALUE"
+.IP 
+For SNMP set requests, the above call method is used.  The TYPE passed
+to the EXEC program is one of the text strings:
+.B integer, counter, gauge, timeticks, ipaddress, objid,
+or 
+.B string,
+indicating the type of value passed in the next argument.
+.IP
+Return nothing to stdout, and the set will assumed to have been
+successful.  Otherwise, return one of the following error strings to
+signal an error:
+.B not-writable, 
+or 
+.B wrong-type
+and the appropriate error response will be generated instead.
+.RS
+.IP Note:
+By default, the only community allowed to write (ie snmpset) to your
+script will be the "private" community,or community #2 if defined
+differently by the "community" token discussed above.  Which
+communities are allowed write access are controlled by the RWRITE
+definition in the snmplib/snmp_impl.h source file.
+.RE
+.RE
+.IP
+Example (in snmpd.conf):
+.IP
+pass .1.3.6.1.4.1.2021.255 /path/to/local/passtest
+.RE
+.IP "pass_persist MIBOID EXEC"
+Passes entire control of MIBOID to the EXEC program.  
+Similar to pass, but the EXEC program continues to run after the initial
+request is answered.
+.IP
+Upon initialization, EXEC is passed the string "PING\\n" in stdin,
+and it should respond by printing "PONG\\n" to stdout.
+.IP
+For get and getnext requests, EXEC program is passed two lines,
+the command (get or getnext) and the MIB OID.  It should return
+three lines, the MIB OID, the TYPE of value returned,
+the VALUE corresponding with the returned TYPE.
+.IP
+For example, if the value for .1.3.6.1.4.100 was requested, the following
+2 lines would be passed in to stdin:
+.br
+.RS
+  get
+.br
+  .1.3.6.1.4.100  
+.RE
+.IP
+To return the value, say, 42, the script would write to stdout:
+.br
+.RS
+  .1.3.6.1.4.100
+.br
+  integer
+.br
+  42
+.RE
+.IP
+To indicate that the script is unable to comply with the request due
+to an end-of-mib condition or an invalid request, print "NONE\\n" to
+stdout.
+.IP
+Example (in snmpd.conf):
+.IP
+pass_persist .1.3.6.1.4.1.2021.255 /path/to/local/pass_persisttest
+.RE
+.SH "EMBEDDED PERL SUPPORT"
+.PP
+Warning: though embedded perl is working, not much functionality has
+been implemented yet and thus writing mib module pieces for the agent
+within perl is not trivial at this point.  It should get better in
+future releases.
+.PP
+The net-snmp package has ability to call perl scripts directly inside
+the agent through embedded perl technology (similar to mod_perl for
+the apache web server).  This must be turned on at compile time by
+passing --enable-embedded-perl to the configure script when the
+package is built.  To see if your package was built with embedded
+perl, run "net-snmp-config --configure-options" and see if that flag
+was used.
+.PP
+If compiled in, it defines the following snmpd.conf configuration
+directives:
+.IP "disablePerl true"
+This will turn off perl support entirely.  If the embedded perl
+support stops working due to a change in perl, etc, this will stop any
+calls to the perl core.
+
+.IP "perlInitFile FILE"
+Use FILE as the initialization file.  This file is normally
+DATADIR/snmp/snmp_perl.pl but this token can override that default.
+This file performs any in-perl initialization that is needed before
+the rest of the perl directives (below) are called.  It is sourced
+once just before the first perl directive is parsed.  See the default
+file for an example of the initialization it performs.
+.IP "perl EXPRESSION"
+Calls perl to evaluate an expression.  Normally you'd want to do
+something like register a function to call when an OID is requested,
+but you can really do anything perl related you want.  For example:
+.IP
+.RS
+perl print "hello world\\n";
+.RE
+.IP
+is the most basic hello world example.
+.IP
+The init script by default initializes a $agent variable which
+is a pointer to a NetSnmp::agent object through which you can register
+callbacks when a section of the OID tree is hit:
+.IP
+.RS
+.nf
+perl use Data::Dumper;
+perl sub myroutine  { print "got called: ",Dumper(@_),"\\n"; }
+perl $agent->register('mylink', '.1.3.6.1.8765', \\&myroutine);
+.fi
+.RE
+.IP
+Sourcing an external file:
+.IP
+.RS
+.nf
+perl 'do /path/to/file.pl';
+.fi
+.RE
+.IP
+No better examples exist at the moment, unfortunately.  Look for
+improved support in future releases.  Comments on how this looks as an
+architecture are certainly appreciated now.
+.SH "DISMAN-EVENT-MIB SUPPORT (READ: SENDING TRAPS ON ERRORS)"
+.PP
+Warning: this implementation has not been extensively tested and is
+additionally not known to be entirely complete.  The concepts defined
+here should function appropriately, however, but no promises are made
+at this time.
+.PP
+If your agent was compiled with support for the DISMAN-EVENT-MIB (you
+can enable this by running the net-snmp configure script with the
+--with-mib-modules=disman/event-mib argument) you have support for
+having the agent check its own data at regular intervals and to send
+out traps when certain conditions occur.  Traps are sent when
+expressions are first noticed, not once per evaluation.  Once a test
+expression fires a trap, the test will have to fail again before a new
+trap is sent.  See the DISMAN-EVENT-MIB documentation for more
+details. This can be configured either using the MIB tables themselves
+or by using these special key words:
+.IP "agentSecName NAME"
+The DISMAN-EVENT-MIB support requires a valid user name for which to
+scan your agent with.  This can either be specified using the
+agentSecName token or by explicitly list one on the "monitor" lines
+described below using the -u switch.  Either way, a "rouser" line (or
+equivalent access control settings) must also be specified with the
+same security name name.  If you need an example, just do something
+like this:
+.RS
+.IP
+.nf
+agentSecName internal
+rouser internal
+.fi
+.RE
+.IP
+And everything below should work just fine.
+.IP "monitor [OPTIONS] NAME EXPRESSION"
+This token tells the agent to monitor itself for problems based on
+EXPRESSION.  Expression is a simple expression based on an oid, a
+comparison operator (!=, ==, <, <=, >, >=) and an integer value (see
+the examples below).  NAME is merely an arbitrary name of your
+choosing for administrative purposes only.  OPTIONS include the
+following possibilities:
+.RS
+.IP "-r FREQUENCY"
+Monitors the given expression every FREQUENCY seconds.  The default is
+600 (10 minutes). 
+.IP "-u SECNAME"
+Use the SECNAME security name for scanning the local host.
+Specifically, this SECNAME must then be given access control rights
+via something like the "rouser" snmpd.conf token for this expression
+to be valid at all.  If not specified, it uses the default security
+name specified by the agentsecname snmpd.conf token.  Either the -u
+flag or a valid agentsecname token must be specified (and that name
+must be given proper access control rights via a "rouser" token).
+.IP "-o OID"
+Specifies additional object values to be delivered with in the
+resulting trap in addition to the normal trap objects.  This is useful
+for obtaining other columns in the table for the row that triggered
+the expression.  See the examples below for more details.
+.RE
+.IP
+The following example configuration checks the hrSWRunPerfTable table
+(listing running processes) for any process which is consuming > 10Mb
+of memory.  It performs this check every 600 seconds (the default).
+For every process it finds exceeding the limit, it will end out
+exactly one notification.  In addition to the normal hrSWRunPerfMem
+oid and value sent in the trap, the hrSWRunName object will also be
+sent.  Note that the hrSWRunName object actually occurs in a different
+table, but since the indexes to the two tables are the same this works
+out alright.
+.RS
+.IP
+.nf
+rouser me
+monitor -u me -o sysUpTime.0 -o hrSWRunName "high process memory" hrSWRunPerfMem > 10000
+.RE
+.fi
+.IP
+The above line would produce a trap which, when formated by snmptrapd, would
+look like:
+.RS
+.IP
+.nf
+2002-04-05 13:33:53 localhost.localdomain [udp:127.0.0.1:32931]:
+        sysUpTimeInstance = Timeticks: (1629) 0:00:16.29        snmpTrapOID.0 = OID: mteTriggerFired    mteHotTrigger = high process memory     mteHotTargetName =      mteHotContextName =     mteHotOID = OID: hrSWRunPerfMem.1968    mteHotValue = 28564     hrSWRunName.1968 = "xemacs"
+.RE
+.fi
+.IP
+This shows my xemacs process using 28Mb of resident memory.  Which,
+considering it's xemacs, is not that surprising.
+.IP "defaultMonitors yes"
+By default, the agent and the DISMAN-EVENT-MIB support do nothing
+until configured.  Typically people wish to watch a bunch of tables
+within the UCD-SNMP-MIB which are designed specifically for reporting
+problems.  If the "defaultMonitors yes" line is put into the
+snmpd.conf file (which must be accompanied by an appropriate
+agentSecName line and a rouser line), the following monitoring
+conditions will be installed:
+.RS
+.IP
+.nf
+monitor	-o prNames -o prErrMessage "process table" prErrorFlag != 0
+monitor	-o memErrorName -o memSwapErrorMsg "memory" memSwapError != 0
+monitor	-o extNames -o extOutput "extTable" extResult != 0
+monitor	-o dskPath -o dskErrorMsg "dskTable" dskErrorFlag != 0
+monitor	-o laNames -o laErrMessage  "laTable" laErrorFlag != 0
+monitor	-o fileName -o fileErrorMsg  "fileTable" fileErrorFlag != 0
+.fi
+.RE
+.SH "DEBUGGING AND OTHER EXTENSIBILITY NOTES"
+If you're trying to figure out aspects of the various mib modules
+(possibly some that you've added yourself), the following may help you
+spit out some useful debugging information.  First off, please read
+the snmpd manual page on the -D flag.  Then the following
+configuration snmpd.conf token, combined with the -D flag, can produce
+useful output:
+.IP "injectHandler HANDLER modulename"
+This will insert new handlers into the section of the mib tree
+referenced by "modulename".  The types of handlers available for
+insertion are:
+.RS
+.nf
+debug        - Prints out lots of debugging information when -Dhelper:debug
+               is passed to the snmpd application.
+read_only    - Forces turning off write support for the given module.
+serialize    - If a module is failing to handle multiple requests
+               properly (using the new 5.0 module API), this will force
+               the module to only receive one request at a time.
+bulk_to_next - If a module registers to handle getbulk support, but
+               for some reason is failing to implement it properly,
+               this module will convert all getbulk requests to
+               getnext requests before the final module receives it.
+.fi
+.RE
+.IP "Figuring out module names"
+To figure out which modules you can inject things into, snmpwalk the
+nsModuleTable which will give you a list of all named modules
+registered within the agent.
+.SH "EXAMPLE CONFIGURATION FILE"
+See the EXAMPLE.CONF file in the top level source directory for a more
+detailed example of how the above information is used in real
+examples.
+.SH "RE-READING snmpd.conf AND snmpd.local.conf"
+The Net-SNMP agent can be forced to re-read its configuration files.
+It can be told to do so by one of two ways:
+.IP 1.
+An snmpset of integer(1) to UCD-SNMP-MIB::versionUpdateConfig.0
+(.1.3.6.1.4.1.2021.100.11.0)
+.IP 2.
+A "kill -HUP" signal sent to the snmpd agent process.
+.SH "FILES"
+SYSCONFDIR/snmp/snmpd.conf
+.SH "SEE ALSO"
+snmpconf(1), snmpusm(1), snmp.conf(5), snmp_config(5), snmpd(8), EXAMPLE.conf, read_config(3).
+.\" Local Variables:
+.\"  mode: nroff
+.\" End:
diff -Naur tomato/release/src/router/snmp/man/snmpdelta.1 tomato121/release/src/router/snmp/man/snmpdelta.1
--- tomato/release/src/router/snmp/man/snmpdelta.1	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/man/snmpdelta.1	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,153 @@
+.\" Portions of this file are subject to the following copyright.  See
+.\" the Net-SNMP's COPYING file for more details and other copyrights
+.\" that may apply:
+.\" /***********************************************************
+.\" Portions of this file are copyrighted by:
+.\" Copyright Copyright 2003 Sun Microsystems, Inc. All rights reserved.
+.\" Use is subject to license terms specified in the COPYING file
+.\" distributed with the Net-SNMP package.
+.\" ******************************************************************/
+.TH SNMPDELTA 1 "25 Jul 2003" "" "Net-SNMP"
+.UC 4
+.SH NAME
+snmpdelta \- Monitor deltas of integer valued SNMP variables
+.SH SYNOPSIS
+snmpdelta [ common options ] [-Cf] [ -Ct ] [ -Cs ] [ -CS ] [ -Cm ] [ -CF configfile ] [ -Cl ] [ -Cp period ] [ -CP Peaks ] [ -Ck ] [ -CT ] AGENT OID [ OID ... ]
+.SH "DESCRIPTION"
+.B snmpdelta
+will monitor the specified integer valued OIDs, and report changes
+over time.
+.PP
+AGENT identifies a target SNMP agent, which is instrumented
+to monitor the gievn objects.  At its simplest, the AGENT
+specification will consist of a hostname or an IPv4
+address.  In this situation, the command will attempt
+communication with the agent, using UDP/IPv4 to port 161
+of the given target host. See snmpcmd(1) for a full list of
+the possible formats for AGENT.
+.PP
+OID is an object identifier which uniquely
+identifies the object type within a MIB. Multiple
+OIDs can be specified on a single snmpdelta command.
+.PP
+.SH OPTIONS
+.TP 8
+.B COMMON OPTIONS
+Please see
+.I snmpcmd(1)
+for a list of possible values for COMMON OPTIONS
+as well as their descriptions.
+.TP
+.B -Cf
+Don't fix errors and retry the request.
+Without this option, if multiple oids have been specified for
+a single request and if the request for one or more of the
+oids fails, snmpdelta will retry the request so that data for
+oids apart from the ones that failed will still be returned. 
+Specifying -Cf tells
+.I  snmpdelta
+not to retry a request, even
+if there are multiple oids specified.
+.TP
+.B -Ct
+Flag will determine time interval from the monitored entity.
+.TP
+.B -Cs
+Flag will display a timestamp.
+.TP
+.B -CS
+Generates a "sum count" in addition to the individual instance
+counts.  The "sum count" is the total of all the individual
+deltas for each time period.
+.TP
+.B -Cm
+Prints the max value ever attained.
+.TP
+.B -CF configfile
+Tells
+.B snmpdelta
+to read it's configuration from the specified file.
+This options allows the input to be set up in advance rather
+than having to be specified on the command line.
+.TP
+.B -Cl
+Tells
+.B snmpdelta
+to write it's configuration to files whose names correspond to the MIB
+instances monitored.  For example, snmpdelta -Cl localhost ifInOctets.1
+will create a file "localhost-ifInOctets.1".
+.TP
+.B -Cp
+Specifies the number of seconds between polling periods.
+Polling constitutes sending a request to the agent. The
+default polling period is one second.
+.TP
+.B -CP peaks
+Specifies the reporting period in number of polling periods.
+If this option is specified, snmpdelta polls the agent
+.I peaks
+number of times before reporting the results.
+The result reported includes the average value over
+the reporting period. In addition, the highest polled
+value within the reporting period is shown.
+.TP
+.B -Ck
+When the polling period (-Cp) is an increment of 60 seconds
+and the timestamp is displayed in the output (-Cs), then
+the default display shows the timestamp in the format
+hh:mm mm/dd. This option causes the timestamp format
+to be hh:mm:ss mm/dd.
+.TP
+.B -CT
+Makes 
+.B snmpdelta
+print its output in tabular form.
+.TP
+.B -Cv vars/pkt
+Specifies the maximum number of oids allowed to be packaged
+in a single PDU. Multiple PDUs can be created in a single
+request. The default value of variables per packet is 60.
+This option is useful if a request response results in an
+error becaues the packet is too big.
+.SH EXAMPLES
+.nf
+$ snmpdelta -c public -v 1 -Cs localhost IF-MIB::ifInUcastPkts.3 IF-MIB::ifOutUcastPkts.3
+[20:15:43 6/14] ifInUcastPkts.3 /1 sec: 158
+[20:15:43 6/14] ifOutUcastPkts.3 /1 sec: 158
+[20:15:44 6/14] ifInUcastPkts.3 /1 sec: 184
+[20:15:44 6/14] ifOutUcastPkts.3 /1 sec: 184
+[20:15:45 6/14] ifInUcastPkts.3 /1 sec: 184
+[20:15:45 6/14] ifOutUcastPkts.3 /1 sec: 184
+[20:15:46 6/14] ifInUcastPkts.3 /1 sec: 158
+[20:15:46 6/14] ifOutUcastPkts.3 /1 sec: 158
+[20:15:47 6/14] ifInUcastPkts.3 /1 sec: 184
+[20:15:47 6/14] ifOutUcastPkts.3 /1 sec: 184
+[20:15:48 6/14] ifInUcastPkts.3 /1 sec: 184
+[20:15:48 6/14] ifOutUcastPkts.3 /1 sec: 184
+[20:15:49 6/14] ifInUcastPkts.3 /1 sec: 158
+[20:15:49 6/14] ifOutUcastPkts.3 /1 sec: 158
+^C
+$ snmpdelta -c public -v 1 -Cs -CT localhost IF-MIB:ifInUcastPkts.3 IF-MIB:ifOutcastPkts.3
+localhost	ifInUcastPkts.3	ifOutUcastPkts.3
+[20:15:59 6/14]	184.00	184.00
+[20:16:00 6/14]	158.00	158.00
+[20:16:01 6/14]	184.00	184.00
+[20:16:02 6/14]	184.00	184.00
+[20:16:03 6/14]	158.00	158.00
+[20:16:04 6/14]	184.00	184.00
+[20:16:05 6/14]	184.00	184.00
+[20:16:06 6/14]	158.00	158.00
+^C
+.fi
+.PP
+The following example uses a number of options. Since the 
+.I Cl 
+option is specified, the output is sent to a file and not to the
+screen.
+.PP
+.nf
+$ snmpdelta -c public -v 1 -Ct -Cs -CS -Cm -Cl -Cp 60 -CP 60
+  interlink.sw.net.cmu.edu .1.3.6.1.2.1.2.2.1.16.3 .1.3.6.1.2.1.2.2.1.16.4
+fi
+.SH "SEE ALSO"
+snmpcmd(1), variables(5).
diff -Naur tomato/release/src/router/snmp/man/snmpdf.1 tomato121/release/src/router/snmp/man/snmpdf.1
--- tomato/release/src/router/snmp/man/snmpdf.1	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/man/snmpdf.1	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,70 @@
+.\" Portions of this file are subject to the following copyright.  See
+.\" the Net-SNMP's COPYING file for more details and other copyrights
+.\" that may apply:
+.\" /***********************************************************
+.\" Portions of this file are copyrighted by:
+.\" Copyright Copyright 2003 Sun Microsystems, Inc. All rights reserved.
+.\" Use is subject to license terms specified in the COPYING file
+.\" distributed with the Net-SNMP package.
+.\" ******************************************************************/
+.TH SNMPDF 1 "25 Jul 2003" "" "Net-SNMP"
+.UC 4
+.SH NAME
+snmpdf - gets a listing of disk space usage on a remote machine via SNMP
+.SH SYNOPSIS
+snmpdf [COMMON OPTIONS] [-Cu] AGENT
+.SH DESCRIPTION
+snmpdf is simply a networked verison of the typical df command.  It
+checks the disk space on the remote machine by examining the
+HOST-RESOURCES-MIB's hrStorageTable or the UCD-SNMP-MIB's dskTable.
+By default, the hrStorageTable is preferred as it typically contains
+more information.  However, the -Cu argument can be passed to snmpdf
+to force the usage of the dskTable.
+.PP
+AGENT identifies a target SNMP agent, which is instrumented
+to monitor the gievn objects.  At its simplest, the AGENT
+specification will consist of a hostname or an IPv4
+address.  In this situation, the command will attempt
+communication with the agent, using UDP/IPv4 to port 161
+of the given target host. See the
+.I snmpcmd(1)
+manual page for a full list of the possible formats for AGENT.
+.PP
+See the
+.I snmpd.conf(5)
+manual page on setting up the dskTable using the 
+.I disk
+directive in the snmpd.conf file.
+.SH "OPTIONS"
+.TP 8
+.B COMMON OPTIONS
+Please see
+.I snmpcmd(1)
+for a list of possible values for COMMON OPTIONS
+as well as their descriptions.
+.TP
+.B -Cu
+Forces the command to use dskTable in mib
+UCD-SNMP-MIB instead of the default to determine
+the storage information. Generally, the default
+use of hrStorageTable in mib HOST-RESOURCES-MIB
+is preferred because it typically contains
+more information.
+.SH "EXAMPLES"
+.PP
+% snmpdf -v 2c -c public localhost
+.PP
+.nf
+Description       size (kB)         Used    Available Used%
+/                   7524587      2186910      5337677   29%
+/proc                     0            0            0    0%
+/etc/mnttab               0            0            0    0%
+/var/run            1223088           32      1223056    0%
+/tmp                1289904        66848      1223056    5%
+/cache               124330         2416       121914    1%
+/vol                      0            0            0    0%
+Real Memory          524288       447456        76832   85%
+Swap Space          1420296       195192      1225104   13%
+.fi
+.SH "SEE ALSO"
+snmpd.conf(5), snmp.conf(5)
diff -Naur tomato/release/src/router/snmp/man/snmp_error.3 tomato121/release/src/router/snmp/man/snmp_error.3
--- tomato/release/src/router/snmp/man/snmp_error.3	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/man/snmp_error.3	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1 @@
+.so man3/snmp_api.3
diff -Naur tomato/release/src/router/snmp/man/snmp_free_pdu.3 tomato121/release/src/router/snmp/man/snmp_free_pdu.3
--- tomato/release/src/router/snmp/man/snmp_free_pdu.3	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/man/snmp_free_pdu.3	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1 @@
+.so man3/snmp_api.3
diff -Naur tomato/release/src/router/snmp/man/snmpget.1.def tomato121/release/src/router/snmp/man/snmpget.1.def
--- tomato/release/src/router/snmp/man/snmpget.1.def	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/man/snmpget.1.def	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,92 @@
+.\" /***********************************************************
+.\" 	Copyright 1988, 1989 by Carnegie Mellon University
+.\" 
+.\"                       All Rights Reserved
+.\" 
+.\" Permission to use, copy, modify, and distribute this software and its 
+.\" documentation for any purpose and without fee is hereby granted, 
+.\" provided that the above copyright notice appear in all copies and that
+.\" both that copyright notice and this permission notice appear in 
+.\" supporting documentation, and that the name of CMU not be
+.\" used in advertising or publicity pertaining to distribution of the
+.\" software without specific, written prior permission.  
+.\" 
+.\" CMU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+.\" ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+.\" CMU BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+.\" ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+.\" WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+.\" ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+.\" SOFTWARE.
+.\" ******************************************************************/
+.TH SNMPGET 1 "08 Feb 2002" VVERSIONINFO "Net-SNMP"
+.UC 4
+.SH NAME
+snmpget - communicates with a network entity using SNMP GET Requests.
+.SH SYNOPSIS
+.B snmpget
+[COMMON OPTIONS] [-Cf] OID [OID]...
+.SH DESCRIPTION
+.B snmpget
+is an SNMP application that uses the SNMP GET request to query for
+information on a network entity.  One or more object identifiers
+(OIDs) may be given as arguments on the command line.  Each variable
+name is given in the format specified in
+.IR variables(5) .
+.PP
+For example:
+.PP
+snmpget -c public zeus system.sysDescr.0
+.PP
+will retrieve the variable system.sysDescr.0:
+.PP
+system.sysDescr.0 = "SunOS zeus.net.cmu.edu 4.1.3_U1 1 sun4m"
+.PP
+If the network entity has an error processing the request packet, an
+error packet will be returned and a message will be shown, helping to
+pinpoint in what way the request was malformed.  If there were other
+variables in the request, the request will be resent without the bad
+variable.
+.SH "OPTIONS"
+.TP 8
+.B -Cf
+If
+.B -Cf
+is
+.I not
+specified, some applications
+.RB ( snmpdelta ", " snmpget ", " snmpgetnext " and " snmpstatus )
+will try to fix errors returned by the agent that you were talking to
+and resend the request.  The only time this is really useful is if you
+specified a OID that didn't exist in your request and you're using
+SNMPv1 which requires "all or nothing" kinds of requests. Here is an
+example (note that system.sysUpTime is an incomplete OID as it needs
+the .0 index appended to it):
+.PP
+.nf
+snmpget -v1 -Cf -c public localhost system.sysUpTime system.sysContact.0
+.BR
+Error in packet
+Reason: (noSuchName) There is no such variable name in this MIB.
+This name doesn't exist: system.sysUpTime
+
+snmpget -v1 -c public localhost system.sysUpTime system.sysContact.0
+Error in packet
+Reason: (noSuchName) There is no such variable name in this MIB.
+This name doesn't exist: system.sysUpTime
+
+system.sysContact.0 = STRING: root@localhost
+.fi
+.IP "" 8
+With the
+.B
+-Cf
+specified the application will not try to fix the PDU for you.
+.PP
+In addition to this option,
+.B snmpget
+takes the common options described in the 
+.I snmpcmd(1)
+manual page.
+.SH "SEE ALSO"
+snmpcmd(1), variables(5).
diff -Naur tomato/release/src/router/snmp/man/snmpgetnext.1.def tomato121/release/src/router/snmp/man/snmpgetnext.1.def
--- tomato/release/src/router/snmp/man/snmpgetnext.1.def	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/man/snmpgetnext.1.def	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,60 @@
+.\" /***********************************************************
+.\" 	Copyright 1988, 1989 by Carnegie Mellon University
+.\" 
+.\"                       All Rights Reserved
+.\" 
+.\" Permission to use, copy, modify, and distribute this software and its 
+.\" documentation for any purpose and without fee is hereby granted, 
+.\" provided that the above copyright notice appear in all copies and that
+.\" both that copyright notice and this permission notice appear in 
+.\" supporting documentation, and that the name of CMU not be
+.\" used in advertising or publicity pertaining to distribution of the
+.\" software without specific, written prior permission.  
+.\" 
+.\" CMU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+.\" ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+.\" CMU BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+.\" ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+.\" WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+.\" ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+.\" SOFTWARE.
+.\" ******************************************************************/
+.TH SNMPGETNEXT 1 "08 Feb 2002" VVERSIONINFO "Net-SNMP"
+.UC 4
+.SH NAME
+snmpgetnext - communicates with a network entity using SNMP GET NEXT Requests.
+.SH SYNOPSIS
+.B snmpgetnext
+[COMMON OPTIONS] [-Cf] OID [OID]...
+.SH DESCRIPTION
+.B snmpget
+is an SNMP application that uses the SNMP GETNEXT request to query for
+information on a network entity.  One or more object identifiers
+(OIDs) may be given as arguments on the command line.  Each variable
+name is given in the format specified in
+.IR variables(5) .
+For each one, the variable that is lexicographically "next" in the
+remote entity's MIB will be returned.
+.PP
+For example:
+.PP
+snmpgetnext -c public zeus interfaces.ifTable.ifEntry.ifType.1
+.PP
+will retrieve the variable interfaces.ifTable.ifEntry.ifType.2:
+.PP
+interfaces.ifTable.ifEntry.ifType.2 = softwareLoopback(24)
+.PP
+If the network entity has an error processing the request packet, an
+error message will be shown, helping to pinpoint in what way the
+request was malformed.
+.SH OPTIONS
+.B snmpgetnext
+takes the common options described in the
+.I snmpcmd(1)
+manual page and also the
+.B -Cf
+option described in the
+.I snmpget(1)
+manual page.
+.SH "SEE ALSO"
+snmpcmd(1), snmpget(1), variables(5).
diff -Naur tomato/release/src/router/snmp/man/snmpinform.1 tomato121/release/src/router/snmp/man/snmpinform.1
--- tomato/release/src/router/snmp/man/snmpinform.1	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/man/snmpinform.1	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1 @@
+.so man1/snmptrap.1
diff -Naur tomato/release/src/router/snmp/man/snmpnetstat.1 tomato121/release/src/router/snmp/man/snmpnetstat.1
--- tomato/release/src/router/snmp/man/snmpnetstat.1	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/man/snmpnetstat.1	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,290 @@
+.\" Portions of this file are subject to the following copyright.  See
+.\" the Net-SNMP's COPYING file for more details and other copyrights
+.\" that may apply:
+.\" /***********************************************************
+.\" 	Copyright 1989 by Carnegie Mellon University
+.\" 
+.\"                       All Rights Reserved
+.\" 
+.\" Permission to use, copy, modify, and distribute this software and its 
+.\" documentation for any purpose and without fee is hereby granted, 
+.\" provided that the above copyright notice appear in all copies and that
+.\" both that copyright notice and this permission notice appear in 
+.\" supporting documentation, and that the name of CMU not be
+.\" used in advertising or publicity pertaining to distribution of the
+.\" software without specific, written prior permission.  
+.\" 
+.\" CMU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+.\" ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+.\" CMU BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+.\" ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+.\" WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+.\" ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+.\" SOFTWARE.
+.\" ******************************************************************/
+.\" Copyright (c) 1983 The Regents of the University of California.
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms are permitted
+.\" provided that the above copyright notice and this paragraph are
+.\" duplicated in all such forms and that any documentation,
+.\" advertising materials, and other materials related to such
+.\" distribution and use acknowledge that the software was developed
+.\" by the University of California, Berkeley.  The name of the
+.\" University may not be used to endorse or promote products derived
+.\" from this software without specific prior written permission.
+.\" THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
+.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+.\"
+.\"	@(#)netstat.1	6.8 (Berkeley) 9/20/88
+.\"
+.\" /***********************************************************
+.\" Portions of this file are copyrighted by:
+.\" Copyright Copyright 2003 Sun Microsystems, Inc. All rights reserved.
+.\" Use is subject to license terms specified in the COPYING file
+.\" distributed with the Net-SNMP package.
+.\" ******************************************************************/
+.TH SNMPNETSTAT 1 "25 Jul 2003" "" "Net-SNMP"
+.UC 5
+.SH NAME
+snmpnetstat \- show network status using SNMP
+.SH SYNOPSIS
+snmpnetstat [common options] [-a] [-n] AGENT
+.br
+snmpnetstat [common options] [-iorns] AGENT
+.br
+snmpnetstat [common options] [-in] [-I interface] AGENT [interval]
+.br
+snmpnetstat [common options] [-an] [-s] [-P protocol] AGENT
+.SH DESCRIPTION
+The
+.I snmpnetstat 
+command symbolically displays the values of various network-related
+information retrieved from a remote system using the SNMP protocol.
+There are a number of output formats,
+depending on the options for the information presented.
+The first form of the command displays a list of active sockets.
+The second form presents the values of other network-related
+information according to the option selected.
+Using the third form, with an 
+.I interval
+specified,
+.I snmpnetstat
+will continuously display the information regarding packet
+traffic on the configured network interfaces.
+The fourth form displays statistics about the named protocol.
+.PP
+AGENT identifies a target SNMP agent, which is
+instrumented to monitor the given objects.
+At its simplest, the AGENT specification will
+consist of a hostname or an IPv4 address. In this
+situation, the command will attempt communication
+with the agent, using UDP/IPv4 to port 161 of the
+given target host. See snmpcmd(1) for a full list of
+the possible formats for AGENT.
+
+.PP
+The version 1 and version 2c
+.I community
+specifies the community name for the transaction with the remote system.
+.PP
+.SH OPTIONS
+The options have the following meaning:
+.PP
+.B common options
+ Please see
+.I snmpcmd(1)
+for a list of possible values for common options
+as well as their descriptions.
+.PP
+.B \-a
+With the default display,
+show the state of all sockets; normally sockets used by
+server processes are not shown.
+.PP
+.B \-i
+Show the state of all of the network interfaces.
+The  interface  display  provides  a  table  of cumulative
+statistics regarding packets transferred, errors, and collisions.
+The  network addresses of the interface and the maximum transmission 
+unit (``mtu'') are also displayed.
+.PP
+.B \-o
+Show an abbreviated interface status, giving octets in place of packets.
+This is useful when enquiring virtual interfaces (such as Frame-Relay circuits)
+on a router.
+.PP
+.BI \-I " interface"
+Show information only about this interface;
+used with an
+.I interval
+as described below.
+.PP
+.B \-n
+Show network addresses as numbers (normally 
+.I snmpnetstat
+interprets addresses and attempts to display them
+symbolically).
+This option may be used with any of the display formats.
+.PP
+.BI \-P " protocol"
+Show statistics about 
+.IR protocol,
+which is either a well-known name for a protocol or an alias for it.  Some
+protocol names and aliases are listed in the file 
+.IR /etc/protocols .
+A null response typically means that there are no interesting numbers to 
+report.
+The program will complain if
+.I protocol
+is unknown or if there is no statistics routine for it.
+.PP
+.B \-s
+Show per-protocol statistics.  When used with the
+.B \-r
+option, show routing statistics instead.
+.PP
+.B \-r
+Show the routing tables.
+When
+.B \-s
+is also present, show per-protocol routing statistics instead of 
+the routing tables.
+.PP
+.B \interval
+When  snmpnetstat is invoked with an interval argument, it
+displays a running count of statistics related to  network
+interfaces. _interval_ is the number of seconds between
+reporting of statistics.
+.PP
+.I The Active Sockets Display (default)
+.PP
+The default display, for active sockets, shows the local
+and remote addresses, protocol, and the internal state  of
+the   protocol.    Address   formats   are   of  the  form
+``host.port'' or ``network.port'' if  a  socket's  address
+specifies  a  network  but no specific host address.  When
+known, the host and network addresses are displayed symbolically
+according   to  the  data  bases 
+.I /etc/hosts  and
+.IR /etc/networks,
+respectively.  If a symbolic  name  for  an
+address  is unknown, or if the
+.B \-n option is specified, the
+address is printed numerically, according to  the  address
+family.  For more information regarding the Internet ``dot
+format,'' refer  to
+.IR inet(3N).
+Unspecified,  or  ``wildcard'', addresses and ports appear as ``*''.
+.PP
+.I The Interface Display
+.PP
+The  interface  display  provides  a  table  of cumulative
+statistics regarding packets transferred, errors, and col-
+lisions.   The  network addresses of the interface and the
+maximum transmission unit (``mtu'') are also displayed.
+.PP
+.I The Routing Table Display
+.PP
+The routing table display indicates the  available  routes
+and  their  status.   Each route consists of a destination
+host or network and a gateway to use in  forwarding  pack-
+ets.   The flags field shows the state of the route (``U''
+if ``up''), whether the route is  to  a  gateway  (``G''),
+whether  the  route  was created dynamically by a redirect
+(``D''), and whether the route  has  been  modified  by  a
+redirect  (``M'').   Direct  routes  are  created for each
+interface attached to the local host;  the  gateway  field
+for  such entries shows the address of the outgoing inter-
+face.  The interface entry indicates the network interface
+utilized for the route.
+.PP
+.I The Interface Display with an Interval
+.PP
+When
+.I snmpnetstat
+is invoked with an
+.I interval
+argument, it
+displays a running count of statistics related to  network
+interfaces.   This  display  consists  of a column for the
+primary interface and a column summarizing information for
+all  interfaces.   The  primary  interface may be replaced
+with another interface with the
+.I\ -I
+option.  The first line
+of each screen of information contains a summary since the
+system was last rebooted.  Subsequent lines of output show
+values accumulated over the preceding interval.
+.PP
+.I The Active Sockets Display for a 
+.I Single Protocol
+.PP
+When a protocol is specified with the
+.I\ -P
+option, the
+information displayed is similar to that in the
+default display for active sockets, except the
+display is limited to the given protocol.
+.SH EXAMPLES
+Example of using snmpnetstat to displaly active sockets (default):
+.PP
+% snmpnetstat -v 2c -c public -a testhost
+.PP
+.nf
+Active Internet (tcp) Connections (including servers)
+Proto Local Address                Foreign Address                 (state)
+tcp   *.echo                        *.*                            LISTEN
+tcp   *.discard                     *.*                            LISTEN
+tcp   *.daytime                     *.*                            LISTEN
+tcp   *.chargen                     *.*                            LISTEN
+tcp   *.ftp                         *.*                            LISTEN
+tcp   *.telnet                      *.*                            LISTEN
+tcp   *.smtp                        *.*                            LISTEN
+...
+
+Active Internet (udp) Connections
+Proto Local Address
+udp    *.echo
+udp    *.discard
+udp    *.daytime
+udp    *.chargen
+udp    *.time
+...
+.fi
+.PP
+% snmpnetstat -v 2c -c public -i testhost
+.PP
+.nf
+Name     Mtu Network    Address          Ipkts   Ierrs    Opkts Oerrs Queue
+eri0    1500 10.6.9/24  testhost     170548881  245601   687976     0    0
+lo0     8232 127        localhost      7530982       0  7530982     0    0
+.fi
+.PP
+Example of using snmpnetstat to show statistics about a specific protocol:
+.PP
+.nf
+% snmpnetstat -v 2c -c public -P tcp testhost
+
+Active Internet (tcp) Connections
+Proto Local Address                Foreign Address                 (state)
+tcp   *.echo                        *.*                            LISTEN
+tcp   *.discard                     *.*                            LISTEN
+tcp   *.daytime                     *.*                            LISTEN
+tcp   *.chargen                     *.*                            LISTEN
+tcp   *.ftp                         *.*                            LISTEN
+tcp   *.telnet                      *.*                            LISTEN
+tcp   *.smtp                        *.*                            LISTEN
+...
+.fi
+.SH SEE ALSO
+snmpcmd(1),
+iostat(1),
+vmstat(1),
+hosts(5),
+networks(5),
+protocols(5),
+services(5).
+.SH BUGS
+The notion of errors is ill-defined.
diff -Naur tomato/release/src/router/snmp/man/snmp_open.3 tomato121/release/src/router/snmp/man/snmp_open.3
--- tomato/release/src/router/snmp/man/snmp_open.3	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/man/snmp_open.3	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1 @@
+.so man3/snmp_api.3
diff -Naur tomato/release/src/router/snmp/man/snmp_perror.3 tomato121/release/src/router/snmp/man/snmp_perror.3
--- tomato/release/src/router/snmp/man/snmp_perror.3	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/man/snmp_perror.3	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1 @@
+.so man3/snmp_api.3
diff -Naur tomato/release/src/router/snmp/man/snmp_read.3 tomato121/release/src/router/snmp/man/snmp_read.3
--- tomato/release/src/router/snmp/man/snmp_read.3	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/man/snmp_read.3	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1 @@
+.so man3/snmp_api.3
diff -Naur tomato/release/src/router/snmp/man/snmp_select_info.3 tomato121/release/src/router/snmp/man/snmp_select_info.3
--- tomato/release/src/router/snmp/man/snmp_select_info.3	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/man/snmp_select_info.3	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1 @@
+.so man3/snmp_api.3
diff -Naur tomato/release/src/router/snmp/man/snmp_send.3 tomato121/release/src/router/snmp/man/snmp_send.3
--- tomato/release/src/router/snmp/man/snmp_send.3	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/man/snmp_send.3	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1 @@
+.so man3/snmp_api.3
diff -Naur tomato/release/src/router/snmp/man/snmp_sess_api.3.def tomato121/release/src/router/snmp/man/snmp_sess_api.3.def
--- tomato/release/src/router/snmp/man/snmp_sess_api.3.def	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/man/snmp_sess_api.3.def	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,230 @@
+.\" /***********************************************************
+.\" 	Copyright 1989 by Carnegie Mellon University
+.\" 
+.\"                       All Rights Reserved
+.\" 
+.\" Permission to use, copy, modify, and distribute this software and its 
+.\" documentation for any purpose and without fee is hereby granted, 
+.\" provided that the above copyright notice appear in all copies and that
+.\" both that copyright notice and this permission notice appear in 
+.\" supporting documentation, and that the name of CMU not be
+.\" used in advertising or publicity pertaining to distribution of the
+.\" software without specific, written prior permission.  
+.\" 
+.\" CMU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+.\" ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+.\" CMU BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+.\" ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+.\" WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+.\" ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+.\" SOFTWARE.
+.\" ******************************************************************/
+.TH SNMP_SESS_API 3 "07 Mar 2002" VVERSIONINFO "Net-SNMP"
+.UC 5
+.SH NAME
+snmp_sess_init, snmp_sess_open, snmp_sess_session,
+snmp_sess_send, snmp_sess_async_send,
+snmp_sess_select_info, snmp_sess_read,
+snmp_sess_timeout, snmp_sess_close, snmp_sess_error - session functions
+.SH SYNOPSIS
+.B #include <net-snmp/session_api.h>
+.PP
+.BI "void snmp_sess_init(struct snmp_session *" session ");"
+.PP
+.BI "void *snmp_sess_open(struct snmp_session *" session ");"
+.PP
+.BI "struct snmp_session *snmp_sess_session(void *" handle ");"
+.PP
+.BI "int snmp_sess_send(void *" handle ", struct snmp_pdu *" pdu ");"
+.PP
+.BI "int snmp_sess_async_send(void *" handle ","
+.br
+.BI "                         struct snmp_pdu *" pdu ", "
+.br
+.BI "                         snmp_callback " callback ", "
+.br
+.BI "                         void *" callbackData ");"
+.PP
+.BI "int snmp_sess_select_info(void *" handle ","
+.br
+.BI "                          int *" numfds ", fd_set *" fdset ", "
+.br
+.BI "                          struct timeval *" timeout ", "
+.br
+.BI "                          int *" block ");"
+.PP
+.BI "void snmp_sess_read(void *" handle ", fd_set *" fdset ");"
+.PP
+.BI "void snmp_sess_timeout(void *" handle ");"
+.PP
+.BI "int snmp_sess_close(void *" handle ");"
+.PP
+.BI "void snmp_sess_error(void *" handle ", int *" pcliberr ", "
+.br
+.BI "                    int *" psnmperr ", char **" pperrstring ");"
+.SH DESCRIPTION
+These functions define a subset of the API that can be used
+to manage single SNMP sessions in a multi-threaded application.
+Except for
+.BR snmp_sess_session() ,
+these functions are single session versions of the traditional
+SNMP library API.
+.PP
+Note that these functions use an opaque pointer
+.RI ( handle
+in the above prototypes) to identify a single session in lieu of a
+.I session
+pointer (as in the traditional API).
+.PP
+.B snmp_sess_init()
+prepares a struct snmp_session that sources transport characteristics
+and common information that will be used for a set of SNMP transactions.
+After this structure is passed to
+.B snmp_sess_open()
+to create an SNMP session, the structure is no longer used.  Instead
+the opaque pointer returned by
+.B snmp_sess_open()
+is used to refer to that session henceforth.
+.PP
+SNMP sessions that are created with
+.B snmp_sess_open()
+are not affected by, and SHOULD NOT BE USED WITH,
+.BR snmp_select_info() ", " snmp_read() ", " snmp_timeout() " nor"
+.BR snmp_close() .
+Rather the equivalent single session functions described here should
+be used.
+.PP
+.B snmp_sess_init()
+and
+.B snmp_sess_open()
+each take as input a pointer to a struct snmp_session object.
+This structure contains information for a set of transactions that
+will share similar transport characteristics.
+.B snmp_sess_session()
+takes the opaque session handle and returns a pointer to
+its associated struct snmp_session.
+.PP
+.B snmp_sess_send()
+and
+.B snmp_sess_async_send()
+each take a
+.I pdu
+parameter, which points to a struct snmp_pdu object containing
+information that describes a transaction that will be performed over
+an open session.
+.PP
+Consult snmp_api.h for the definitions of these structures.
+.PP
+.BR snmp_sess_select_info() ", " snmp_sess_read() " and " snmp_sess_timeout()
+provide an interface for the use of the
+.BR select (2)
+system call so that SNMP transactions for a single session can occur
+asynchronously.
+.PP
+.B snmp_sess_select_info()
+is passed the information that would have been passed to
+.BR select (2)
+in the absence of SNMP.  For example, this might include file
+descriptors associated with the main loop of a graphical
+application. This information is modified so that SNMP will get the
+service it requires from the call to
+.BR select (2).
+In this case,
+.IR numfds ", " fdset " and " timeout
+correspond to the
+.IR nfds ", " readfds " and " timeout
+arguments to
+.BR select (2)
+respectively.  The only exception is that timeout must ALWAYS point to
+an allocated (but perhaps uninitialized)
+.I struct timeval
+(it cannot be NULL as for
+.BR select (2)).
+If
+.I timeout
+would have been passed as NULL,
+.I block
+is instead set to true, and
+.I timeout
+is treated as undefined.  This same rule applies upon return from
+.BR snmp_select_info() .
+.PP
+After calling
+.B snmp_sess_select_info() ,
+.BR select (2)
+should be called with the returned data.  When it returns,
+.B snmp_sess_read()
+should then be called with the
+.I fd_set
+returned from
+.BR select (2).
+This will read any input from this session's SNMP socket.  If
+.BR select (2)
+times out (that is, it returns zero),
+.B snmp_sess_timeout()
+should be called to see if a timeout has occurred on the SNMP
+session.
+.SH DIAGNOSTICS
+.PP
+Error return status from 
+.B snmp_sess_open()
+is indicated by return of a NULL pointer.
+Error return status from 
+.B snmp_sess_close()
+and
+.B snmp_sess_send()
+is indicated by a return value of 0.  A successful status will return
+1.
+.PP
+Further information can be obtained by using
+.B snmp_sess_error()
+to see what type of error has occurred.  This function returns the
+SNMP
+.I snmp_errno
+variable, the value of the system
+.I errno
+variable, and a string interpretation of both variables.  The string
+must be freed after use by the caller.
+.PP
+For errors returned by
+.BR snmp_sess_open() ,
+use the corresponding function
+.B snmp_error()
+instead of
+.BR snmp_sess_error() .
+.PP
+Consult snmp_api.h for the complete set of SNMP library
+error values.
+The SNMP library error value
+.IR snmperr
+can be one of the following values:
+.RS 2n
+.IP SNMPERR_GENERR \w'SNMPERR_BAD_REPETITIONS'u+2n
+A generic error occurred.
+.IP SNMPERR_BAD_LOCPORT \w'SNMPERR_BAD_REPETITIONS'u+2n
+The local port was bad because it had already been
+allocated or permission was denied.
+.IP SNMPERR_BAD_ADDRESS \w'SNMPERR_BAD_REPETITIONS'u+2n
+The host name or address given was not useable.
+.IP SNMPERR_BAD_SESSION \w'SNMPERR_BAD_REPETITIONS'u+2n
+The specified session was not open.
+.IP SNMPERR_TOO_LONG \w'SNMPERR_BAD_REPETITIONS'u+2n
+.IP SNMPERR_NO_SOCKET \w'SNMPERR_BAD_REPETITIONS'u+2n
+.IP SNMPERR_V2_IN_V1 \w'SNMPERR_BAD_REPETITIONS'u+2n
+.IP SNMPERR_V1_IN_V2 \w'SNMPERR_BAD_REPETITIONS'u+2n
+.IP SNMPERR_BAD_REPEATERS \w'SNMPERR_BAD_REPETITIONS'u+2n
+.IP SNMPERR_BAD_REPETITIONS \w'SNMPERR_BAD_REPETITIONS'u+2n
+.IP SNMPERR_BAD_ASN1_BUILD \w'SNMPERR_BAD_REPETITIONS'u+2n
+.IP SNMPERR_BAD_SENDTO \w'SNMPERR_BAD_REPETITIONS'u+2n
+.IP SNMPERR_BAD_RCVFROM \w'SNMPERR_BAD_REPETITIONS'u+2n
+.IP SNMPERR_BAD_PARSE \w'SNMPERR_BAD_REPETITIONS'u+2n
+.IP SNMPERR_BAD_VERSION \w'SNMPERR_BAD_REPETITIONS'u+2n
+.IP SNMPERR_BAD_COMMUNITY \w'SNMPERR_BAD_REPETITIONS'u+2n
+.IP SNMPERR_NOAUTH_DESPRIV \w'SNMPERR_BAD_REPETITIONS'u+2n
+.IP SNMPERR_ABORT \w'SNMPERR_BAD_REPETITIONS'u+2n
+.IP SNMPERR_UNKNOWN_PDU \w'SNMPERR_BAD_REPETITIONS'u+2n
+.IP SNMPERR_TIMEOUT \w'SNMPERR_BAD_REPETITIONS'u+2n
+.RE
+.PP
+.SH "SEE ALSO"
+.BR select "(2), " snmp_api "(3), " snmp_api.h
diff -Naur tomato/release/src/router/snmp/man/snmp_sess_async_send.3 tomato121/release/src/router/snmp/man/snmp_sess_async_send.3
--- tomato/release/src/router/snmp/man/snmp_sess_async_send.3	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/man/snmp_sess_async_send.3	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1 @@
+.so man3/snmp_sess_api.3
diff -Naur tomato/release/src/router/snmp/man/snmp_sess_close.3 tomato121/release/src/router/snmp/man/snmp_sess_close.3
--- tomato/release/src/router/snmp/man/snmp_sess_close.3	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/man/snmp_sess_close.3	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1 @@
+.so man3/snmp_sess_api.3
diff -Naur tomato/release/src/router/snmp/man/snmp_sess_error.3 tomato121/release/src/router/snmp/man/snmp_sess_error.3
--- tomato/release/src/router/snmp/man/snmp_sess_error.3	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/man/snmp_sess_error.3	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1 @@
+.so man3/snmp_sess_api.3
diff -Naur tomato/release/src/router/snmp/man/snmp_sess_init.3 tomato121/release/src/router/snmp/man/snmp_sess_init.3
--- tomato/release/src/router/snmp/man/snmp_sess_init.3	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/man/snmp_sess_init.3	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1 @@
+.so man3/snmp_sess_api.3
diff -Naur tomato/release/src/router/snmp/man/snmp_sess_open.3 tomato121/release/src/router/snmp/man/snmp_sess_open.3
--- tomato/release/src/router/snmp/man/snmp_sess_open.3	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/man/snmp_sess_open.3	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1 @@
+.so man3/snmp_sess_api.3
diff -Naur tomato/release/src/router/snmp/man/snmp_sess_perror.3 tomato121/release/src/router/snmp/man/snmp_sess_perror.3
--- tomato/release/src/router/snmp/man/snmp_sess_perror.3	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/man/snmp_sess_perror.3	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1 @@
+.so man3/snmp_api.3
diff -Naur tomato/release/src/router/snmp/man/snmp_sess_read.3 tomato121/release/src/router/snmp/man/snmp_sess_read.3
--- tomato/release/src/router/snmp/man/snmp_sess_read.3	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/man/snmp_sess_read.3	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1 @@
+.so man3/snmp_sess_api.3
diff -Naur tomato/release/src/router/snmp/man/snmp_sess_select_info.3 tomato121/release/src/router/snmp/man/snmp_sess_select_info.3
--- tomato/release/src/router/snmp/man/snmp_sess_select_info.3	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/man/snmp_sess_select_info.3	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1 @@
+.so man3/snmp_sess_api.3
diff -Naur tomato/release/src/router/snmp/man/snmp_sess_send.3 tomato121/release/src/router/snmp/man/snmp_sess_send.3
--- tomato/release/src/router/snmp/man/snmp_sess_send.3	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/man/snmp_sess_send.3	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1 @@
+.so man3/snmp_sess_api.3
diff -Naur tomato/release/src/router/snmp/man/snmp_sess_session.3 tomato121/release/src/router/snmp/man/snmp_sess_session.3
--- tomato/release/src/router/snmp/man/snmp_sess_session.3	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/man/snmp_sess_session.3	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1 @@
+.so man3/snmp_sess_api.3
diff -Naur tomato/release/src/router/snmp/man/snmp_sess_timeout.3 tomato121/release/src/router/snmp/man/snmp_sess_timeout.3
--- tomato/release/src/router/snmp/man/snmp_sess_timeout.3	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/man/snmp_sess_timeout.3	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1 @@
+.so man3/snmp_sess_api.3
diff -Naur tomato/release/src/router/snmp/man/snmpset.1.def tomato121/release/src/router/snmp/man/snmpset.1.def
--- tomato/release/src/router/snmp/man/snmpset.1.def	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/man/snmpset.1.def	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,99 @@
+.\" /***********************************************************
+.\" 	Copyright 1988, 1989 by Carnegie Mellon University
+.\" 
+.\"                       All Rights Reserved
+.\" 
+.\" Permission to use, copy, modify, and distribute this software and its 
+.\" documentation for any purpose and without fee is hereby granted, 
+.\" provided that the above copyright notice appear in all copies and that
+.\" both that copyright notice and this permission notice appear in 
+.\" supporting documentation, and that the name of CMU not be
+.\" used in advertising or publicity pertaining to distribution of the
+.\" software without specific, written prior permission.  
+.\" 
+.\" CMU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+.\" ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+.\" CMU BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+.\" ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+.\" WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+.\" ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+.\" SOFTWARE.
+.\" ******************************************************************/
+.TH SNMPSET 1 "08 Feb 2002" VVERSIONINFO "Net-SNMP"
+.UC 4
+.SH NAME
+snmpset - communicates with a network entity using SNMP SET Requests.
+.SH SYNOPSIS
+.B snmpset
+[COMMON OPTIONS] OID TYPE VALUE [OID TYPE VALUE]...
+.SH DESCRIPTION
+.B snmpset
+is an SNMP application that uses the SNMP SET request to set
+information on a network entity.  One or more object identifiers
+(OIDs) must be given as arguments on the command line.  A type and a
+value to be set must accompany each object identifier.  Each variable
+name is given in the format specified in
+.IR variables(5) .
+.PP
+The
+.I TYPE
+is a single character, one of:
+.RS
+.PD 0
+.TP 3
+.B i
+INTEGER
+.TP 3
+.B u
+UNSIGNED
+.TP 3
+.B s
+STRING
+.TP 3
+.B x
+HEX STRING
+.TP 3
+.B d
+DECIMAL STRING
+.TP 3
+.B n
+NULLOBJ
+.TP 3
+.B o
+OBJID
+.TP 3
+.B t
+TIMETICKS
+.TP 3
+.B a
+IPADDRESS
+.TP 3
+.B b
+BITS
+.PD
+.RE
+If you have the proper MIB file loaded, you can, in most cases, replace the
+type with an '=' sign. For an object of type OCTET STRING this will assume
+a string like the 's' type notation. For other types it will do "The
+Right Thing".
+.PP
+For example:
+.PP
+snmpset -c private -v 1 test-hub system.sysContact.0 s dpz@noc.rutgers.edu ip.ipforwarding.0 = 2
+.PP
+will set the variables sysContact.0 and ipForwarding.0:
+.PP
+system.sysContact.0 = STRING: "dpz@noc.rutgers.edu"
+.br
+ip.ipForwarding.0 = INTEGER: not-forwarding(2)
+.PP
+If the network entity has an error processing the request packet, an
+error packet will be returned and a message will be shown, helping to
+pinpoint in what way the request was malformed.
+.SH OPTIONS
+.B snmpset
+takes the common options described in the
+.I snmpcmd(1)
+manual page.
+.SH "SEE ALSO"
+snmpcmd(1), variables(5).
diff -Naur tomato/release/src/router/snmp/man/snmp_set_mib_warnings.3 tomato121/release/src/router/snmp/man/snmp_set_mib_warnings.3
--- tomato/release/src/router/snmp/man/snmp_set_mib_warnings.3	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/man/snmp_set_mib_warnings.3	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1 @@
+.so man3/mib_api.3
diff -Naur tomato/release/src/router/snmp/man/snmp_set_save_descriptions.3 tomato121/release/src/router/snmp/man/snmp_set_save_descriptions.3
--- tomato/release/src/router/snmp/man/snmp_set_save_descriptions.3	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/man/snmp_set_save_descriptions.3	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1 @@
+.so man3/mib_api.3
diff -Naur tomato/release/src/router/snmp/man/snmpstatus.1.def tomato121/release/src/router/snmp/man/snmpstatus.1.def
--- tomato/release/src/router/snmp/man/snmpstatus.1.def	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/man/snmpstatus.1.def	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,113 @@
+.\" Portions of this file are subject to the following copyright.  See
+.\" the Net-SNMP's COPYING file for more details and other copyrights
+.\" that may apply:
+.\" /***********************************************************
+.\" 	Copyright 1988, 1989 by Carnegie Mellon University
+.\" 
+.\"                       All Rights Reserved
+.\" 
+.\" Permission to use, copy, modify, and distribute this software and its 
+.\" documentation for any purpose and without fee is hereby granted, 
+.\" provided that the above copyright notice appear in all copies and that
+.\" both that copyright notice and this permission notice appear in 
+.\" supporting documentation, and that the name of CMU not be
+.\" used in advertising or publicity pertaining to distribution of the
+.\" software without specific, written prior permission.  
+.\" 
+.\" CMU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+.\" ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+.\" CMU BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+.\" ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+.\" WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+.\" ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+.\" SOFTWARE.
+.\" ******************************************************************/
+.\" Portions of this file are copyrighted by:
+.\" Copyright Copyright 2003 Sun Microsystems, Inc. All rights reserved.
+.\" Use is subject to license terms specified in the COPYING file
+.\" distributed with the Net-SNMP package.
+.\" ******************************************************************/
+.TH SNMPSTATUS 1 "25 Jul 2003" VVERSIONINFO "Net-SNMP"
+.UC 4
+.SH NAME
+snmpstatus - Retrieves important information from a network entity.
+.SH SYNOPSIS
+.B snmpstatus
+[COMMON OPTIONS] [-Cf] AGENT
+.SH DESCRIPTION
+.B snmpstatus
+is an SNMP application that retrieves several important statistics
+from a network entity.
+.PP
+AGENT identifies a target SNMP agent, which is instrumented
+to monitor the given objects.  At its simplest, the AGENT
+specification will consist of a hostname or an IPv4 address.
+n this situation, the command will attempt communication with
+the agent, using UDP/IPv4 to port 161 of the given target host.
+.PP
+See the 
+.I snmpcmd(1)
+manual page for a full list of the possible formats for AGENT.
+.PP
+The information returned is:
+.IP
+The IP address of the entity.
+.br
+A textual description of the entity (sysDescr.0)
+.br
+The uptime of the entity's SNMP agent (sysUpTime.0)
+.br
+The sum of received packets on all interfaces
+(ifInUCastPkts.* + ifInNUCastPkts.*)
+.br
+The sum of transmitted packets on all interfaces
+(ifOutUCastPkts.* + ifOutNUCastPkts.*)
+.br
+The number of IP input packets (ipInReceives.0)
+.br
+The number of IP output packets (ipOutRequests.0)
+.PP
+For example:
+.PP
+snmpstatus -c public -v 1 netdev-kbox.cc.cmu.edu
+.PP
+will produce output similar to the following:
+.PP
+[128.2.56.220]=>[Kinetics FastPath2] Up: 1 day, 4:43:31
+.br
+Interfaces: 1,  Recv/Trans packets: 262874/39867 |
+IP: 31603/15805
+.PP
+.B snmpstatus
+also checks the operational status of all interfaces (ifOperStatus.*),
+and if it finds any that are not running, it will report in a manner
+similar to this:
+.PP
+2 interfaces are down!
+.PP
+If the network entity has an error processing the request packet, an
+error packet will be returned and a message will be shown, helping to
+pinpoint in what way the request was malformed.
+.B snmpstatus
+will attempt to reform its request to eliminate the malformed
+variable (unless the
+.B -Cf
+option is given, see below), but this variable will then be missing
+from the displayed data.
+.PP
+.SH OPTIONS
+.TP
+.B COMMON OPTIONS
+Please see
+.I snmpcmd(1)
+for a list of possible values for COMMON OPTIONS
+as well as their descriptions.
+.TP
+.B -Cf
+By default, snmpstatus will try to fix errors returned
+by the agent and retry a request. In this situation,
+the command will display the data that it can. If the -Cf option
+is specified, then snmpstatus will not try to fix
+errors, and the error will cause the command to terminate.
+.SH "SEE ALSO"
+snmpcmd(1), snmpget(1)
diff -Naur tomato/release/src/router/snmp/man/snmptable.1.def tomato121/release/src/router/snmp/man/snmptable.1.def
--- tomato/release/src/router/snmp/man/snmptable.1.def	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/man/snmptable.1.def	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,119 @@
+.\" /************************************************************
+.\" 	Copyright 1997 Niels Baggesen
+.\" 
+.\"                       All Rights Reserved
+.\" 
+.\" Permission to use, copy, modify, and distribute this software and its 
+.\" documentation for any purpose and without fee is hereby granted, 
+.\" provided that the above copyright notice appear in all copies.
+.\" 
+.\" I DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+.\" ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+.\" I BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+.\" ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+.\" WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+.\" ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+.\" SOFTWARE.
+.\" ******************************************************************/
+.\" Portions of this file are copyrighted by:
+.\" Copyright Copyright 2003 Sun Microsystems, Inc. All rights reserved.
+.\" Use is subject to license terms specified in the COPYING file
+.\" distributed with the Net-SNMP package.
+.\" ******************************************************************/
+.TH SNMPTABLE 1 "25 Jul 2003" VVERSIONINFO "Net-SNMP"
+.UC 4
+.SH NAME
+snmptable - obtain and print an SNMP table
+.SH SYNOPSIS
+.B snmptable
+[COMMON OPTIONS] [-Cb] [-CB] [-Ch] [-CH] [-Ci] [-Cf STRING] [-Cw WIDTH]
+AGENT TABLE-OID
+.SH DESCRIPTION
+.B snmptable
+is an SNMP application that repeatedly uses the SNMP GETNEXT or
+GETBULK requests to query for information on a network entity.  The
+parameter
+.I TABLE-OID
+must specify an SNMP table.
+.PP
+snmptable is an SNMP application that repeatedly uses the
+SNMP GETNEXT or GETBULK requests to query for  information
+on a network entity.  The parameter TABLE-OID must specify
+an SNMP table.
+
+AGENT identifies a target SNMP agent, which is instrumented
+to monitor the gievn objects.  At its simplest, the AGENT
+specification will consist of a hostname or an IPv4
+address.  In this situation, the command will attempt
+communication with the agent, using UDP/IPv4 to port 161
+of the given target host. See
+.I  snmpcmd(1)
+for a full list of
+the possible formats for AGENT.
+.SH OPTIONS
+.TP 8
+.B COMMON OPTIONS
+Please see
+.I snmpcmd(1)
+for a list of possible values for COMMON OPTIONS
+as well as their descriptions.
+.TP
+.B -Cb
+Display only a brief heading. Any common prefix of the table field
+names will be deleted.
+.TP 
+.B -CB
+Do not use GETBULK requests to retrieve data, only GETNEXT.
+.TP
+.BI -Cf " STRING"
+The string
+.I STRING
+is used to separate table columns.  With this option, each table entry
+will be printed in compact form, just with the string given to
+separate the columns (useful if you want to import it into a
+database).  Otherwise it is printed in nicely aligned columns.
+.TP
+.B -Ch
+Display
+.I only
+the column headings.
+.TP
+.B -CH
+Do not display the column headings.
+.TP
+.B -Ci
+This option prepends the index of the entry to all printed lines.
+.TP 
+.BI -Cw " WIDTH"
+Specifies the width of the lines when the table is printed.
+If the lines will be longer, the table will be printed in sections of
+at most 
+.I WIDTH 
+characters.  If
+.I WIDTH
+is less than the length of the contents of
+a single column, then that single column will still be printed.
+.PP
+.SH EXAMPLES
+$ snmptable -v 2c -c public localhost at.atTable
+
+SNMP table: at.atTable RFC1213-MIB::atTable
+
+atIfIndex   atPhysAddress   atNetAddress
+        1  8:0:20:20:0:ab 130.225.243.33
+.PP
+$ snmptable -v 2c -c public -Cf + localhost at.atTable
+
+SNMP table: at.atTable
+
+atIfIndex+atPhysAddress+atNetAddress
+1+8:0:20:20:0:ab+130.225.243.33
+.PP
+.SH "BUGS"
+The test for
+.I TABLE-OID
+actually specifying a table is rather heuristic.  Note also that the
+test requires the defining MIB file to be loaded.
+.PP
+.SH "SEE ALSO"
+snmpcmd(1), variables(5).
diff -Naur tomato/release/src/router/snmp/man/snmptest.1.def tomato121/release/src/router/snmp/man/snmptest.1.def
--- tomato/release/src/router/snmp/man/snmptest.1.def	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/man/snmptest.1.def	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,279 @@
+.\" Portions of this file are subject to the following copyright.  See
+.\" the Net-SNMP's COPYING file for more details and other copyrights
+.\" that may apply:
+.\" /***********************************************************
+.\" 	Copyright 1988, 1989 by Carnegie Mellon University
+.\" 
+.\"                       All Rights Reserved
+.\" 
+.\" Permission to use, copy, modify, and distribute this software and its 
+.\" documentation for any purpose and without fee is hereby granted, 
+.\" provided that the above copyright notice appear in all copies and that
+.\" both that copyright notice and this permission notice appear in 
+.\" supporting documentation, and that the name of CMU not be
+.\" used in advertising or publicity pertaining to distribution of the
+.\" software without specific, written prior permission.  
+.\" 
+.\" CMU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+.\" ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+.\" CMU BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+.\" ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+.\" WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+.\" ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+.\" SOFTWARE.
+.\" ******************************************************************/
+.\" Portions of this file are copyrighted by:
+.\" Copyright Copyright 2003 Sun Microsystems, Inc. All rights reserved.
+.\" Use is subject to license terms specified in the COPYING file
+.\" distributed with the Net-SNMP package.
+.\" ******************************************************************/
+.TH SNMPTEST 1 "25 Jul 2003" VVERSIONINFO "Net-SNMP"
+.UC 4
+.SH NAME
+snmptest - communicates with a network entity using SNMP requests
+.SH SYNOPSIS
+.B snmptest
+[COMMON OPTIONS] AGENT
+.SH DESCRIPTION
+.B snmptest
+is a flexible SNMP application that can monitor and manage information
+on a network entity.
+.PP
+After invoking the program, a command line interpreter proceeds to
+accept commands.  This intepreter enables the user to send different
+types of SNMP requests to target agents.
+.PP
+AGENT identifies a target SNMP agent, which is instrumented
+to monitor the gievn objects.  At its simplest, the AGENT
+specification will consist of a hostname or an IPv4
+address.  In this situation, the command will attempt
+communication with the agent, using UDP/IPv4 to port 161
+of the given target host. See snmpcmd(1) for a full list of
+the possible formats for AGENT.
+.PP
+Once snmptest is invoked, the command line intepreter will prompt with:
+.PP
+.B Variable:
+.PP
+At this point you can enter one or more variable names, one per line.
+A blank line ends the parameter input and will send the request
+(variables entered) in a single packet, to the remote entity.
+Each variable name is given
+in the format specified in 
+.IR variables(5) .
+For example:
+.PP
+snmptest -c public -v 1 zeus
+.br
+.BR Variable: " system.sysDescr.0"
+.br
+.BR Variable: 
+.PP
+will return some information about the request and reply packets, as
+well as the information:
+.PP
+requestid 0x5992478A errstat 0x0 errindex 0x0
+.br
+system.sysDescr.0 = STRING: "Unix 4.3BSD"
+.PP
+The errstatus value shows the error status code for the call.
+The possible values for errstat are in the header file snmp.h.
+The errindex value identifies the variable that has the given error.
+Index values are assigned to all the variables entered at the "Variable":
+prompt. The first value is assigned an index of 1.
+.PP
+Upon startup, the program defaults to sending a GET request packet.
+The type of request can be changed by typing one of the following
+commands at the "Variable:" prompt:
+.PP
+.nf
+$G - send a GET request
+$N - send a GETNEXT request
+$S - send a SET request
+$B - send a GETBULK request
+     Note: GETBULK is not available in SNMPv1
+$I - send an Inform request
+$T - send an SNMPv2 Trap request
+.fi
+.PP
+Other values that can be entered at the "Variable:" prompt are:
+.PP
+.nf
+$D - toggle the dumping of each sent and received packet
+$QP - toggle a quicker, less verbose output form
+$Q - Quit the program
+.fi
+.PP
+Request Types:
+.PP
+GET Request:
+.PP
+When in "GET request" mode ($G or default), the user can enter
+an OID at the "Variable:" prompt. The user can enter multiple
+OIDs, one per prompt. The user enters a blank line to send
+the GET request.
+.PP
+GETNEXT Request:
+.PP
+The "GETNEXT request" mode ($N) is simlar to the "Get request"
+mode, described above.
+.PP
+SET Request:
+.PP
+When in the "SET request" mode ($S), more information is requested by the
+prompt for each variable.  The prompt:
+.PP
+.nf
+Type [i|s|x|d|n|o|t|a]:
+.fi
+requests the type of the variable be entered.  Depending on the type
+of value you want to set, you can type one of the following:
+.PP
+.nf
+i - integer
+u - unsigned integer
+s - octet string in ASCII
+x - octet string in hex bytes, separated by whitespace
+d - octet string as decimal bytes, separated by whitespace
+a - ip address in dotted IP notation
+o - object identifier
+n - null
+t - timeticks
+.fi
+At this point a value will be prompted for:
+.PP
+Value:
+.PP
+If this is an integer value, just type the integer (in decimal).  If
+it is a decimal string, type in white-space separated decimal numbers,
+one per byte of the string.  Again type a blank line at the prompt for
+the variable name to send the packet.
+.PP
+GETBULK Request:
+.PP
+The "GETBULK request" mode ($B) is similar to the "Set request" mode.
+GETBULK, however, is not available in SNMPv1.
+.PP
+Inform Request:
+.PP
+The "Inform request" mode ($I) is similar to the "Set request" mode.
+This type of request, however, is not available in SNMPv1. Also,
+the _agent_ specified on the snmptest command should correspond
+to the target snmptrapd agent.
+.PP
+SNMPv2 Trap Request:
+.PP
+The "SNMPv2 Trap Request" mode ($T) is similar to the "Set request" mode.
+This type of request, however, is not available in SNMPv1. Also,
+the _agent_ specified on the snmptest command should correspond
+to the target snmptrapd agent.
+.SH OPTIONS
+.B snmptest
+takes the common options described in the 
+.I snmpcmd(1)
+manual page.
+.SH EXAMPLES
+.PP
+The following is an example of sending a GET request for two OIDs:
+.PP
+% snmptest -v 2c -c public testhost:9999
+.PP
+.nf
+Variable: system.sysDescr.0
+Variable: system.sysContact.0
+Variable:
+Received Get Response from 128.2.56.220
+requestid 0x7D9FCD63 errstat 0x0 errindex 0x0
+SNMPv2-MIB::sysDescr.0 = STRING: SunOS testhost 5.9 Generic_112233-02 sun4u
+SNMPv2-MIB::sysContact.0 = STRING: x1111
+.fi
+.PP
+The following is an example of sending a GETNEXT request:
+.PP
+.nf
+Variable: SNMPv2-MIB::sysORUpTime
+Variable:
+Received Get Response from 128.2.56.220
+requestid 0x7D9FCD64 errstat 0x0 errindex 0x0
+SNMPv2-MIB::sysORUpTime.1 = Timeticks: (6) 0:00:00.06
+Variable:
+.fi
+.PP
+The following is an example of sending a SET request:
+.PP
+.nf
+Variable: $S
+Request type is Set Request
+Variable: system.sysLocation.0
+Type [i|u|s|x|d|n|o|t|a]: s
+Value: building 17
+Variable:
+Received Get Response from 128.2.56.220
+requestid 0x7D9FCD65 errstat 0x0 errindex 0x0
+SNMPv2-MIB::sysLocation.0 = STRING: building A
+Variable:
+.fi
+.PP
+The following is an example of sending a GETBULK request:
+.PP
+.nf
+Variable: $B
+Request type is Bulk Request
+Enter a blank line to terminate the list of non-repeaters
+and to begin the repeating variables
+Variable:
+Now input the repeating variables
+Variable: system.sysContact.0
+Variable: system.sysLocation.0
+Variable:
+What repeat count? 2
+Received Get Response from 128.2.56.220
+requestid 0x2EA7942A errstat 0x0 errindex 0x0
+SNMPv2-MIB::sysName.0 = STRING: testhost
+SNMPv2-MIB::sysORLastChange.0 = Timeticks: (58) 0:00:00.58
+SNMPv2-MIB::sysLocation.0 = STRING: bldg A
+SNMPv2-MIB::sysORID.1 = OID: IF-MIB::ifMIB
+Variable:
+.fi
+.PP
+The following is an example of sending an Inform request:
+.PP
+.nf
+snmptest -v 2c -c public snmptrapd_host
+Variable: $I
+Request type is Inform Request
+(Are you sending to the right port?)
+Variable: system.sysContact.0
+Type [i|u|sIx|d|n|o|t|a]: s
+Value: x12345
+Variable:
+Inform Acknowledged
+Variable:
+.fi
+.PP
+The snmptrapd_host will show:
+.PP
+snmptrapd_host [<ip address>]: Trap SNMPv2-MIB::sysContact.0 = STRING:
+x12345
+.PP
+The following is an example of sending an SNMPv2 Trap request:
+.PP
+.nf
+snmptest -v 2c -c public snmptrapd_host
+Variable: $T
+Request type is SNMPv2 Trap Request
+(Are you sending to the right port?)
+Variable: system.sysLocation.0
+Type [i|u|s|x|d|n|o|t|a]: s
+Value: building a
+Variable:
+.fi
+.PP
+The snmptrapd_host will show:
+.PP
+.nf
+snmptrapd_host [<ip address>]: Trap SNMPv2-MIB::sys.0 = STRING:
+building a
+.fi
+.SH "SEE ALSO"
+snmpcmd(1), snmpget(1), snmpset(1), variables(5)
diff -Naur tomato/release/src/router/snmp/man/snmp_timeout.3 tomato121/release/src/router/snmp/man/snmp_timeout.3
--- tomato/release/src/router/snmp/man/snmp_timeout.3	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/man/snmp_timeout.3	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1 @@
+.so man3/snmp_api.3
diff -Naur tomato/release/src/router/snmp/man/snmptranslate.1.def tomato121/release/src/router/snmp/man/snmptranslate.1.def
--- tomato/release/src/router/snmp/man/snmptranslate.1.def	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/man/snmptranslate.1.def	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,286 @@
+.\" Portions of this file are subject to the following copyright.  See
+.\" the Net-SNMP's COPYING file for more details and other copyrights
+.\" that may apply:
+.\" /***********************************************************
+.\" 	Copyright 1988, 1989 by Carnegie Mellon University
+.\" 
+.\"                       All Rights Reserved
+.\" 
+.\" Permission to use, copy, modify, and distribute this software and its 
+.\" documentation for any purpose and without fee is hereby granted, 
+.\" provided that the above copyright notice appear in all copies and that
+.\" both that copyright notice and this permission notice appear in 
+.\" supporting documentation, and that the name of CMU not be
+.\" used in advertising or publicity pertaining to distribution of the
+.\" software without specific, written prior permission.  
+.\" 
+.\" CMU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+.\" ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+.\" CMU BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+.\" ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+.\" WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+.\" ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+.\" SOFTWARE.
+.\" ******************************************************************/
+.\" Portions of this file are copyrighted by:
+.\" Copyright Copyright 2003 Sun Microsystems, Inc. All rights reserved.
+.\" Use is subject to license terms specified in the COPYING file
+.\" distributed with the Net-SNMP package.
+.\" ******************************************************************/
+.TH SNMPTRANSLATE 1 "25 Jul 2003" VVERSIONINFO "Net-SNMP"
+.UC 4
+.SH NAME
+snmptranslate - translate SNMP OID values into more useful information
+.SH SYNOPSIS
+.B snmptranslate
+[OPTIONS] OID [OID]...
+.SH DESCRIPTION
+.B snmptranslate
+is an application that translates one or more SNMP object identifier
+values from their symbolic (textual) forms into their numerical forms
+(or vice versa).  
+.PP
+OID is either a numeric or textual object identifier.
+.SH OPTIONS
+.TP 8
+.B -D \fITOKEN[,...]
+Turn on debugging output for the given
+.IR "TOKEN" "(s)."
+Try
+.IR ALL
+for extremely verbose output.
+.TP
+.B -h
+Display a brief usage message and then exit.
+.TP
+.BI -m " MIBLIST"
+Specifies a colon separated list of MIB modules to load for this
+application.  This overrides the environment variable MIBS.
+.IP
+The special keyword
+.I ALL
+is used to specify all modules in all directories when searching for MIB
+files.  Every file whose name does not begin with "." will be parsed as
+if it were a MIB file.
+.TP
+.BI -M " DIRLIST"
+Specifies a colon separated list of directories to search for MIBs.
+This overrides the environment variable MIBDIRS.
+.TP
+.BI -T " TRANSOPTS"
+Provides control over the translation of the OID values.  The
+following
+.I TRANSOPTS
+are available:
+.RS
+.TP 6
+.B \-Td
+Print full details of the specified OID.
+.TP
+.B \-Tp
+Print a graphical tree, rooted at the specified OID.
+.TP
+.B \-Ta
+Dump the loaded MIB in a trivial form.
+.TP
+.B \-Tl
+Dump a labeled form of all objects.
+.TP
+.B \-To
+Dump a numeric form of all objects.
+.TP
+.B \-Ts
+Dump a symbolic form of all objects.
+.TP
+.B \-Tt
+Dump a tree form of the loaded MIBs (mostly useful for debugging).
+.RE
+.TP
+.B -V
+Display version information for the application and then exit.
+.TP
+.BI -w " WIDTH"
+Specifies the width of
+.B -Tp
+and
+.B -Td
+output. The default is very large.
+.PP
+In addition to the above options, 
+.B snmptranslate
+takes the OID input 
+.RB ( -I ),
+MIB parsing
+.RB ( -M )
+and OID output
+.RB ( -O )
+options described in the 
+.BR "INPUT OPTIONS" ", " "MIB PARSING OPTIONS" " and " "OUTPUT OPTIONS"
+sections of the
+.I snmpcmd(1) 
+manual page.
+.SH EXAMPLES
+.IP \(bu 4
+snmptranslate -On -IR sysDescr
+.br
+will translate "sysDescr" to a more qualified form:
+.IP
+system.sysDescr
+.IP \(bu 4
+snmptranslate -Onf -IR sysDescr
+.br
+will translate "sysDecr" to:
+.IP
+.RI .iso.org.dod.internet.mgmt.mib-2.system.sysDescr
+.IP \(bu 4 
+snmptranslate -Td -OS system.sysDescr
+.br
+will translate "sysDecr" into:
+.IP
+.nf
+SNMPv2-MIB::sysDescr
+sysDescr OBJECT-TYPE
+  -- FROM SNMPv2-MIB
+  -- TEXTUAL CONVENTION DisplayString
+  SYNTAX OCTET STRING (0..255)
+  DISPLAY-HINT "255a"
+  MAX-ACCESS read-only
+  STATUS current
+  DESCRIPTION "A textual description of the entity. This
+               value should include the full name and
+               version identification of the system's
+               hardware type, software operating-system,
+               and networking software."
+::= { iso(1) org(3) dod(6) internet(1) mgmt(2) mib-2(1) system(1) 1 }
+.fi
+.IP \(bu 4 
+snmptranslate -Tp -OS system
+.br
+will print the following tree:
+.IP
+.nf
++--system(1)
+   |
+   +-- -R-- String    sysDescr(1)
+   |        Textual Convention: DisplayString
+   |        Size: 0..255
+   +-- -R-- ObjID     sysObjectID(2)
+   +-- -R-- TimeTicks sysUpTime(3)
+   +-- -RW- String    sysContact(4)
+   |        Textual Convention: DisplayString
+   |        Size: 0..255
+   +-- -RW- String    sysName(5)
+   |        Textual Convention: DisplayString
+   |        Size: 0..255
+   +-- -RW- String    sysLocation(6)
+   |        Textual Convention: DisplayString
+   |        Size: 0..255
+   +-- -R-- Integer   sysServices(7)
+   +-- -R-- TimeTicks sysORLastChange(8)
+   |        Textual Convention: TimeStamp
+   |
+   +--sysORTable(9)
+      |
+      +--sysOREntry(1)
+         |
+         +-- ---- Integer   sysORIndex(1)
+         +-- -R-- ObjID     sysORID(2)
+         +-- -R-- String    sysORDescr(3)
+         |        Textual Convention: DisplayString
+         |        Size: 0..255
+         +-- -R-- TimeTicks sysORUpTime(4)
+                  Textual Convention: TimeStamp
+
+.fi
+.PP
+.IP \(bu 4
+snmptranslate -Ta | head
+.br
+will produce the following dump:
+.IP
+.nf
+dump DEFINITIONS ::= BEGIN
+org ::= { iso 3 }
+dod ::= { org 6 }
+internet ::= { dod 1 }
+directory ::= { internet 1 }
+mgmt ::= { internet 2 }
+experimental ::= { internet 3 }
+private ::= { internet 4 }
+security ::= { internet 5 }
+snmpV2 ::= { internet 6 }
+.fi
+.PP
+.IP \(bu 4
+snmptranslate -Tl | head
+.br
+will produce the following dump:
+.IP
+.nf
+.RI .iso(1).org(3)
+.RI .iso(1).org(3).dod(6)
+.RI .iso(1).org(3).dod(6).internet(1)
+.RI .iso(1).org(3).dod(6).internet(1).directory(1)
+.RI .iso(1).org(3).dod(6).internet(1).mgmt(2)
+.RI .iso(1).org(3).dod(6).internet(1).mgmt(2).mib-2(1)
+.RI .iso(1).org(3).dod(6).internet(1).mgmt(2).mib-2(1).system(1)
+.RI .iso(1).org(3).dod(6).internet(1).mgmt(2).mib-2(1).system(1).sysDescr(1)
+.RI .iso(1).org(3).dod(6).internet(1).mgmt(2).mib-2(1).system(1).sysObjectID(2)
+.RI .iso(1).org(3).dod(6).internet(1).mgmt(2).mib-2(1).system(1).sysUpTime(3)
+.fi
+.PP
+.IP \(bu 4
+snmptranslate -To | head
+.br
+will produce the following dump
+.IP
+.nf
+.RI .1.3
+.RI .1.3.6
+.RI .1.3.6.1
+.RI .1.3.6.1.1
+.RI .1.3.6.1.2
+.RI .1.3.6.1.2.1
+.RI .1.3.6.1.2.1.1
+.RI .1.3.6.1.2.1.1.1
+.RI .1.3.6.1.2.1.1.2
+.RI .1.3.6.1.2.1.1.3
+.fi
+.PP
+.IP \(bu 4
+snmptranslate -Ts | head
+.br
+will produce the following dump
+.IP
+.nf
+.RI .iso.org
+.RI .iso.org.dod
+.RI .iso.org.dod.internet
+.RI .iso.org.dod.internet.directory
+.RI .iso.org.dod.internet.mgmt
+.RI .iso.org.dod.internet.mgmt.mib-2
+.RI .iso.org.dod.internet.mgmt.mib-2.system
+.RI .iso.org.dod.internet.mgmt.mib-2.system.sysDescr
+.RI .iso.org.dod.internet.mgmt.mib-2.system.sysObjectID
+.RI .iso.org.dod.internet.mgmt.mib-2.system.sysUpTime
+.fi
+.PP
+.IP \(bu 4
+snmptranslate -Tt | head
+.br
+will produce the following dump
+.IP
+.nf
+  org(3) type=0
+    dod(6) type=0
+      internet(1) type=0
+        directory(1) type=0
+        mgmt(2) type=0
+          mib-2(1) type=0
+            system(1) type=0
+              sysDescr(1) type=2 tc=4 hint=255a
+              sysObjectID(2) type=1
+              sysUpTime(3) type=8
+.fi
+.SH "SEE ALSO"
+snmpcmd(1), variables(5), RFC 2578-2580.
diff -Naur tomato/release/src/router/snmp/man/snmptrap.1.def tomato121/release/src/router/snmp/man/snmptrap.1.def
--- tomato/release/src/router/snmp/man/snmptrap.1.def	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/man/snmptrap.1.def	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,120 @@
+.\" /***********************************************************
+.\" 	Copyright 1988, 1989 by Carnegie Mellon University
+.\" 
+.\"                       All Rights Reserved
+.\" 
+.\" Permission to use, copy, modify, and distribute this software and its 
+.\" documentation for any purpose and without fee is hereby granted, 
+.\" provided that the above copyright notice appear in all copies and that
+.\" both that copyright notice and this permission notice appear in 
+.\" supporting documentation, and that the name of CMU not be
+.\" used in advertising or publicity pertaining to distribution of the
+.\" software without specific, written prior permission.  
+.\" 
+.\" CMU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+.\" ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+.\" CMU BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+.\" ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+.\" WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+.\" ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+.\" SOFTWARE.
+.\" ******************************************************************/
+.TH SNMPTRAP 1 "08 Feb 2002" VVERSIONINFO "Net-SNMP"
+.UC 4
+.SH NAME
+snmptrap, snmpinform - sends an SNMP trap to a manager
+.SH SYNOPSIS
+.B snmptrap -v 1
+[COMMON OPTIONS] [-Ci] enterprise-oid agent generic-trap specific-trap uptime [OID TYPE VALUE]...
+.PP
+.B snmptrap -v [2c|3]
+[COMMON OPTIONS] [-Ci] uptime trap-oid [OID TYPE VALUE]...
+.PP
+.B snmpinform -v [2c|3]
+[COMMON OPTIONS] uptime trap-oid [OID TYPE VALUE]...
+.SH DESCRIPTION
+.B snmptrap
+is an SNMP application that uses the SNMP TRAP operation to send
+information to a network manager.  One or more object identifiers
+(OIDs) can be given as arguments on the command line.  A type and a
+value must accompany each object identifier.  Each variable name is
+given in the format specified in 
+.IR variables(5) .
+.PP
+When invoked as
+.B snmpinform,
+or when
+.B -Ci
+is added to the command line flags of snmptrap, it sends an
+INFORM-PDU, expecting a response from the trap receiver,
+retransmitting if required.  Otherwise it sends an TRAP-PDU or
+TRAP2-PDU.
+.PP
+If any of the required version 1 parameters, 
+.IR enterprise-oid ,
+.IR agent ,
+and
+.I uptime
+are specified as empty, it defaults to
+.IR "1.3.6.1.4.1.3.1.1 (enterprises.cmu.1.1)" ,
+.IR hostname ,
+and
+.I host-uptime
+respectively.
+.PP
+The
+.I TYPE
+is a single character, one of:
+.RS
+.PD 0
+.TP 3
+.B i
+INTEGER
+.TP 3
+.B u
+UNSIGNED
+.TP 3
+.B c
+COUNTER32
+.TP 3
+.B s
+STRING
+.TP 3
+.B x
+HEX STRING
+.TP 3
+.B d
+DECIMAL STRING
+.TP 3
+.B n
+NULLOBJ
+.TP 3
+.B o
+OBJID
+.TP 3
+.B t
+TIMETICKS
+.TP 3
+.B a
+IPADDRESS
+.TP 3
+.B b
+BITS
+.PD
+.RE
+.PP
+For example:
+.PP
+snmptrap -v 1 -c public manager enterprises.spider test-hub 3 0 '' interfaces.iftable.ifentry.ifindex.1 i 1
+.PP
+will send a generic linkUp trap to manager, for interface 1.
+.SH OPTIONS
+.B snmptrap
+takes the common options described in the
+.I snmpcmd(1) 
+manual page in
+addition to the 
+.B -Ci
+option described above.
+.SH SEE ALSO
+snmpcmd(1), variables(5).
diff -Naur tomato/release/src/router/snmp/man/snmp_trap_api.3.def tomato121/release/src/router/snmp/man/snmp_trap_api.3.def
--- tomato/release/src/router/snmp/man/snmp_trap_api.3.def	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/man/snmp_trap_api.3.def	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,36 @@
+.TH SNMP_TRAP_API 3 "7 Mar 2002" VVERSIONINFO "Net-SNMP"
+.UC 5
+.SH NAME
+send_easy_trap, send_trap_vars, send_v2trap - send TRAPs or INFORMs
+from a Net-SNMP MIB module
+.SH SYNOPSIS
+.B #include <net-snmp/agent/agent_trap.h>
+.PP
+.BI "void send_easy_trap(int " trap ", int " specific ");"
+.PP
+.BI "void send_trap_vars(int " trap ", int " specific ", struct variable_list *" vars ");"
+.PP
+.BI "void send_v2trap(struct variable_list *" vars ");"
+.SH DESCRIPTION
+These three routines may be used to send traps from a MIB module
+within the Net-SNMP agent (including an AgentX subagent).
+.PP
+.B send_easy_trap()
+sends an SNMPv1 trap (or the SNMPv2 equivalent) to the list of
+configured trap destinations (or "sinks"), using the provided values
+for the generic trap type, and specific trap value.
+.PP
+.B send_trap_vars()
+is similar, but appends the supplied list of variable bindings to the
+traps that are sent.
+.PP
+.B send_v2trap()
+uses the supplied list of variable bindings to form an SNMPv2 trap,
+which is sent to SNMPv2-capable sinks on the configured list.  An
+equivalent INFORM is sent to the configuredq list of inform sinks.
+Sinks that can only handle SNMPv1 traps are skipped.
+.SH WARNINGS
+These routines are used to send the traps immediately they are called.
+Invoking them at the appropriate time is left to the MIB module programmer.
+.SH "SEE ALSO"
+.BR snmpd.conf "(5), " snmptrapd "(8)"
diff -Naur tomato/release/src/router/snmp/man/snmptrapd.8.def tomato121/release/src/router/snmp/man/snmptrapd.8.def
--- tomato/release/src/router/snmp/man/snmptrapd.8.def	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/man/snmptrapd.8.def	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,293 @@
+.\" /***********************************************************
+.\" 	Copyright 1989 by Carnegie Mellon University
+.\" 
+.\"                       All Rights Reserved
+.\" 
+.\" Permission to use, copy, modify, and distribute this software and its 
+.\" documentation for any purpose and without fee is hereby granted, 
+.\" provided that the above copyright notice appear in all copies and that
+.\" both that copyright notice and this permission notice appear in 
+.\" supporting documentation, and that the name of CMU not be
+.\" used in advertising or publicity pertaining to distribution of the
+.\" software without specific, written prior permission.  
+.\" 
+.\" CMU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+.\" ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+.\" CMU BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+.\" ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+.\" WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+.\" ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+.\" SOFTWARE.
+.\" ******************************************************************/
+.TH SNMPTRAPD 8 "07 Feb 2002" VVERSIONINFO "Net-SNMP"
+.UC 4
+.SH NAME
+snmptrapd - Receive and log SNMP trap messages.
+.SH SYNOPSIS
+.BR snmptrapd " [OPTIONS] [LISTENING ADDRESSES]"
+.SH DESCRIPTION
+.B snmptrapd
+is an SNMP application that receives and logs SNMP TRAP and INFORM
+messages.
+.PP
+Note: the default is to listen on UDP port 162 on all IPv4 interfaces.
+Since 162 is a privileged port,
+.B snmptrapd
+must be typically be run as root.
+.SH OPTIONS
+.TP 8
+.B -a
+Ignore authenticationFailure traps.
+.TP
+.BI "-c" " FILE"
+Read 
+.I FILE
+as a configuration file.
+.TP
+.B -C
+Do not read any configuration files except the one optionally specified by the 
+.B -c 
+option.
+.TP
+.B -d
+Dump (in hexadecimal) the sent and received SNMP packets.
+.TP
+.BI -D " TOKEN[,...]"
+Turn on debugging output for the given
+.IR "TOKEN" "(s)."
+Try
+.IR ALL
+for extremely verbose output.
+.TP
+.B -e
+Print event numbers (rising/falling alarm etc.).
+.TP
+.B -f
+Do not fork() from the calling shell.
+.TP
+.BI -F " FORMAT"
+When logging to standard output, use the format in the string
+.IR FORMAT .
+See the section
+.B FORMAT SPECIFICATIONS
+below for more details.
+.TP
+.B -h, --help
+Display a brief usage message and then exit.
+.TP
+.B -H
+Display a list of configuration file directives understood by the
+trap daemon and then exit.
+.TP
+.BR -l " d|0-7"
+Specifies the syslog facility to use when logging to syslog.  'd' means
+.B LOG_DAEMON
+and 0 through 7 mean 
+.BR LOG_LOCAL0 " through " LOG_LOCAL7 ".  " LOG_LOCAL0 " is the default."
+.TP
+.BR -m " \fIMIBLIST"
+Specifies a colon separated list of MIB modules to load for this
+application.  This overrides the environment variable MIBS.
+.TP
+.BR -M " \fIDIRLIST"
+Specifies a colon separated list of directories to search for MIBs.
+This overrides the environment variable MIBDIRS.
+.TP
+.BR -n
+Do not attempt to translate source addresses of incoming packets into
+hostnames.
+.TP
+.BI -o " FILE"
+Log formatted incoming traps to 
+.IR FILE .
+Upon receipt of a SIGHUP, the daemon will close and re-open
+the log file.  This feature is useful when rotating the log file with
+other utilities such as logrotate.
+.TP
+.B -P
+Print formatted incoming traps to stderr.
+.TP
+.B -s
+Log formatted incoming traps to syslog.  These syslog messages are
+sent with a level of 
+.B LOG_WARNING
+and facility as determined by the
+.BR -l " flag (" LOG_LOCAL0 
+by default).  This is the default unless the
+.BR -o " or " -P
+flag is used.
+.TP
+.BI -u " FILE"
+Save the process ID of the trap daemon in
+.IR FILE "."
+.TP
+.B -v, --version
+Print version information for the trap daemon and then exit.
+.PP
+In addition,
+.B snmptrapd
+takes the same output formatting 
+.BR "" ( -O ) 
+options as the other Net-SNMP commands.  See the section
+.B OUTPUT OPTIONS
+in the
+.I snmpcmd(1)
+manual page.
+.SH FORMAT SPECIFICATIONS
+.PP
+.B snmptrapd
+interprets format strings similarly to
+.IR printf(3) .
+It understands the following formatting sequences:
+.RS 4
+.TP 4
+.B %%
+a literal %
+.TP
+.B %t
+decimal number of seconds since the operating system's epoch (as
+returned by
+.IR time(2) )
+.TP
+.B %y
+current year on the local system
+.TP
+.B %m
+current (numeric) month on the local system
+.TP
+.B %l
+current day of month on the local system
+.TP
+.B %h
+current hour on the local system
+.TP
+.B %j
+current minute on the local system
+.TP
+.B %k
+current second on the local system
+.TP
+.B %T
+the value of the sysUpTime.0 varbind in seconds
+.TP
+.B %Y
+the year field from the sysUpTime.0 varbind
+.TP
+.B %M
+the numeric month field from the sysUpTime.0 varbind
+.TP
+.B %L
+the day of month field from the sysUpTime.0 varbind
+.TP
+.B %H
+the hour field from the sysUpTime.0 varbind
+.TP
+.B %J
+the minute field from the sysUpTime.0 varbind
+.TP
+.B %K
+the seconds field from the sysUpTime.0 varbind
+.TP
+.B %a
+the contents of the agent-addr field of the PDU (v1 TRAPs only)
+.TP
+.B %A
+the hostname corresponding to the contents of the agent-addr field of
+the PDU, if available, otherwise the contents of the agent-addr field
+of the PDU (v1 TRAPs only).
+.TP
+.B %b
+PDU source address (Note: this is not necessarily an IPv4
+address)
+.TP
+.B %B
+PDU source hostname if available, otherwise PDU source address (see
+note above) 
+.TP
+.B %N
+enterprise string
+.TP
+.B %w
+trap type (numeric, in decimal)
+.TP
+.B %W
+trap description
+.TP
+.B %q
+trap sub-type (numeric, in decimal)
+.TP
+.B %P
+security information from the PDU (community name for v1/v2c,
+user and context for v3)
+.TP
+.B %v
+list of trap's variable-bindings
+.RE
+.PP
+In addition to these values, you may also specify an optional field
+width and precision, just as in 
+.IR printf(3) ,
+and a flag value. The following flags are legal:
+.RS 4 
+.TP 4
+.B -
+left justify
+.TP
+.B 0
+use leading zeros
+.TP
+.B #
+use alternate form
+.RE
+.PP
+The "use alternate form" flag changes the behavior of some format
+flags. Normally, the fields that display time information base it on
+the local timezone, but this flag tells them to use GMT instead.
+Also, the variable-binding list is normally a tab-separated list, but
+this flag changes it to a comma-separated one. The alternate form for
+the uptime is similar to "3 days, 0:14:34.65"
+.SS Examples:
+.PP
+To get a message like "14:03 TRAP3.1 from humpty.ucd.edu" you 
+could use something like this:
+.PP
+.RS
+.nf
+snmptrapd -P -F "%02.2h:%02.2j TRAP%w.%q from %A\en"
+.fi
+.RE
+.PP
+If you want the same thing but in GMT rather than local time, use
+.PP
+.RS
+.nf
+snmptrapd -P -F "%#02.2h:%#02.2j TRAP%w.%q from %A\en"
+.fi
+.RE
+.SH LISTENING ADDRESSES
+By default,
+.B snmptrapd
+listens for incoming SNMP TRAP and INFORM packets on UDP port 162 on
+all IPv4 interfaces.  However, it is possible to modify this behaviour
+by specifying one or more listening addresses as arguments to
+.BR snmptrapd .
+See the
+.I snmpd(8)
+manual page for more information about the format of listening
+addresses.
+.SH NOTIFICATION-LOG-MIB SUPPORT
+As of net-snmp 5.0, the snmptrapd application supports the
+NOTIFICATION-LOG-MIB.  It does this by opening an AgentX subagent
+connection to the master snmpd agent and registering the notification
+log tables.  As long as the snmpd application is started first, it
+will attach itself to it and thus you should be able to view the last
+recorded notifications via the nlmLogTable and nlmLogVariableTable.
+See the snmptrapd.conf file and the "dontRetainLogs" token for turning
+off this support.  See the NOTIFICATION-LOG-MIB for more details about
+the MIB itself.
+.SH EXTENSIBILITY AND CONFIGURATION
+See the
+.I snmptrapd.conf(5)
+manual page.
+.SH "SEE ALSO"
+snmpcmd(1), snmpd(8), printf(3), snmptrapd.conf(5), syslog(8), variables(5)
diff -Naur tomato/release/src/router/snmp/man/snmptrapd.conf.5.def tomato121/release/src/router/snmp/man/snmptrapd.conf.5.def
--- tomato/release/src/router/snmp/man/snmptrapd.conf.5.def	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/man/snmptrapd.conf.5.def	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,89 @@
+.TH SNMPTRAPD.CONF 5 "28 Aug 2001" VVERSIONINFO "Net-SNMP"
+.UC 4
+.SH NAME
+SYSCONFDIR/snmp/snmptrapd.conf - configuration file for the Net-SNMP trap daemon.
+.SH DESCRIPTION
+.B snmptrapd.conf
+is the configuration file(s) which define how the Net-SNMP SNMP trap
+receiving daemon operates when it receives a trap.  These files may
+contain any of the directives found in the
+.B DIRECTIVES
+section below.  This file is not required for the daemon to operate,
+receive, or report traps.  It is used solely as a method of providing
+extensibility to the trap daemon.
+.SH PLEASE READ FIRST
+First, make sure you have read the
+.I snmp_config(5)
+manual page that
+describes how the Net-SNMP configuration files operate, where they
+are located and how they all work together.
+.SH DIRECTIVES
+.IP "traphandle OID|default PROGRAM [ARGS ...]"
+The
+.I traphandle
+configuration directive configures the snmptrapd program to launch an
+external program any time it receives a trap matching the OID token.
+If the OID token is the word
+.I default
+then any trap not matching any other trap handler will call this
+default one instead.
+The program is fed details about the trap to its standard input, in the
+following format, one entry per line:
+.RS
+.IP HOSTNAME
+The name of the host in question that sent the trap, as determined by
+.IR gethostbyaddr(3) .
+.br
+.IP IPADDRESS
+The IP address of the host that sent the trap.
+.IP VARBINDS
+A list of variable bindings that describe the trap and the variables
+enclosed in it.  The first token on the line, up until the space, in
+the OID and the remainder of the line is its value.  The first OID
+should be the system.sysUpTime.0 OID, and the second should be
+the ...snmpTrap.snmpTrapOID.0 OID.  The remainder of the OIDs, with the
+possible exception of the last one, are the variable bindings
+contained within the trap.  For SNMPv1 traps, the very last OID will
+be the ...snmpTrap.snmpTrapEnterprise OID and its value.  Essentially, 
+SNMPv1 traps have been converted to the SNMPv2 trap PDU type by the
+method described in the SNMPv1/SNMPv2/SNMPv3 coexistence document (RFC2576).
+.br
+.IP Example:
+A traptoemail script has been included in the Net-SNMP package that
+can be used as a trap handle directive:
+.br
+.RS
+.P
+traphandle /usr/bin/perl BINDIR/traptoemail -s mysmtp.somewhere.com -f admin@somewhere.com me@somewhere.com
+.RE
+.RE
+.IP "dontRetainLogs true"
+Turns off the support for the NOTIFICATION-LOG-MIB and thus doesn't
+retain logged traps.  Normally the snmptrapd program keeps a certain
+number of traps around in memory so they can be retrieved via querying
+the nlmLogTable and nlmLogvariableTable tables.  
+See the snmptrapd manual page and the
+NOTIFICATION-LOG-MIB for details.
+.IP "createUser username (MD5|SHA) authpassphrase [DES]"
+See the 
+.I snmpd.conf(5)
+manual page for a description of how to create SNMPv3 users.  It's
+roughly the same, but the file name changes to snmptrapd.conf from
+snmpd.conf.
+.RE
+.IP "format1 format"
+The format used to print a SNMPv1 TRAP message. See
+.IR snmptrapd(8)
+for the layout characters available.
+.RE
+.IP "format2 format"
+The format used to print a SNMPv2 TRAP2 or INFORM message (note that
+the SNMPv3 protocol uses SNMPv2 style TRAPs and INFORMs).
+.SH NOTES
+.IP o
+The daemon blocks on the executing traphandle commands.  (This should
+be fixed in the future with an appropriate signal catch and wait()
+combination).
+.SH "SEE ALSO"
+snmp_config(5), snmptrapd(8), syslog(8), variables(5), snmpd.conf(5), read_config(3).
+
diff -Naur tomato/release/src/router/snmp/man/snmpusm.1.def tomato121/release/src/router/snmp/man/snmpusm.1.def
--- tomato/release/src/router/snmp/man/snmpusm.1.def	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/man/snmpusm.1.def	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,117 @@
+.TH SNMPUSM 1 "08 Feb 2002" VVERSIONINFO "Net-SNMP"
+.UC 4
+.SH NAME
+snmpusm - creates and maintains SNMPv3 users on a remote entity.
+.SH SYNOPSIS
+.B snmpusm
+[COMMON OPTIONS] 
+.B create
+USER [CLONEFROM-USER]
+.br
+.B snmpusm
+[COMMON OPTIONS] 
+.B delete
+USER
+.br
+.B snmpusm
+[COMMON OPTIONS]
+.B cloneFrom
+USER CLONEFROM-USER
+.br
+.B snmpusm
+[COMMON OPTIONS] [-Co] [-Ca] [-Cx]
+.B passwd
+OLD-PASSPHRASE NEW-PASSPHRASE
+
+.SH DESCRIPTION
+.B snmpusm
+is an SNMP application that can be used to do simple maintenance on a
+SNMP agent's User-based Security Module (USM) table.  You can create,
+delete, clone, and change the passphrase of users configured on a
+running SNMP agent.
+.PP
+The SNMPv3 USM specifications (see RFC2574) dictate that users are
+created and maintained by adding and modifying rows to the
+usmUserTable MIB table.  To create a new user you simply create the
+row using
+.BR snmpset .
+User's profiles contain private keys that are never
+transmitted over the wire in clear text (regardless of whether the
+administration requests are encrypted or not).  
+.PP
+The secret key for a user is initially set by cloning another user in
+the table, so that a new user inherits the cloned user's secret key.
+A user can only be cloned once, however, after which they must be
+deleted and re-created to be re-cloned.  The authentication and
+privacy security types are also inherited during this cloning (e.g.,
+MD5 vs. SHA1).  To change the secret key for a user, you must know the
+user's old passphrase as well as the new one.  The
+.B passwd
+sub-command of the 
+.B snmpusm
+command, therefore, requires both the new and the old
+pass-phrases to be supplied.  After cloning from the appropriate
+template, you should immediately change the new users passphrase.
+.PP
+The Net-SNMP agent must first be initialized so that at least one user
+is setup in it before you can use this command to clone new ones.  See the
+.I snmpd.conf(5)
+manual page on the
+.B createUser
+configuration parameter.
+.SH EXAMPLES
+.PP
+Let's assume for our examples that the following VACM and USM
+configurations lines were in the snmpd.conf file for a Net-SNMP agent.
+These lines set up a default user called "initial" with the
+authentication passphrase "setup_passphrase" so that we can perform
+the initial setup of an agent:
+.PP
+.RS
+.nf
+# VACM configuration entries
+rwuser initial
+# lets add the new user we'll create too:
+rwuser wes
+# USM configuration entries
+createUser initial MD5 setup_passphrase DES
+.fi
+.RE
+.PP
+Note: the "initial" user's setup should be removed after creating a
+real user that you grant administrative privileges to (like the user
+"wes" we'll be creating in this example.
+.PP
+Note: passphrases must be 8 characters
+.I minimum
+in length.
+.SS Create a new user
+.PP
+snmpusm -v3 -u initial -n "" -l authNoPriv -a MD5 -A setup_passphrase
+localhost create wes initial
+.IP
+Creates a new user, here named "wes" using the user "initial" to do
+it.  "wes" is cloned from "initial" in the process, so he inherits
+that user's passphrase ("setup_passphrase").
+.SS Change the user's passphrase
+.PP
+snmpusm -v 3 -u wes -n "" -l authNoPriv -a MD5 -A setup_passphrase
+localhost passwd setup_passphrase new_passphrase
+.IP
+After creating the user "wes" with the same passphrase as the
+"initial" user, we need to change his passphrase for him.  The above
+command changes it from "setup_passphrase", which was inherited from
+the initial user, to "new_passphrase".
+.SS Test the new user
+.PP
+snmpget -v 3 -u wes -n "" -l authNoPriv -a MD5 -A new_passphrase
+localhost sysUpTime.0
+.IP
+If the above commands were successful, this command should have
+properly performed an authenticated SNMPv3 GET request to the agent.
+.PP
+Now, go remove the vacm "group" snmpd.conf entry for the "initial"
+user and you have a valid user 'wes' that you can use for future
+transactions instead of initial.
+.SH "SEE ALSO"
+snmpd.conf(5), snmp.conf(5), RFC 2574
diff -Naur tomato/release/src/router/snmp/man/snmpwalk.1.def tomato121/release/src/router/snmp/man/snmpwalk.1.def
--- tomato/release/src/router/snmp/man/snmpwalk.1.def	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/man/snmpwalk.1.def	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,103 @@
+.\" /***********************************************************
+.\" 	Copyright 1988, 1989 by Carnegie Mellon University
+.\" 
+.\"                       All Rights Reserved
+.\" 
+.\" Permission to use, copy, modify, and distribute this software and its 
+.\" documentation for any purpose and without fee is hereby granted, 
+.\" provided that the above copyright notice appear in all copies and that
+.\" both that copyright notice and this permission notice appear in 
+.\" supporting documentation, and that the name of CMU not be
+.\" used in advertising or publicity pertaining to distribution of the
+.\" software without specific, written prior permission.  
+.\" 
+.\" CMU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+.\" ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+.\" CMU BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+.\" ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+.\" WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+.\" ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+.\" SOFTWARE.
+.\" ******************************************************************/
+.TH SNMPWALK 1 "08 Feb 2002" VVERSIONINFO "Net-SNMP"
+.UC 4
+.SH NAME
+snmpwalk - communicates with a network entity using SNMP GETNEXT requests.
+.SH SYNOPSIS
+.B snmpwalk
+[APPLICATION OPTIONS] [COMMON OPTIONS] [OID]
+.SH DESCRIPTION
+.B snmpwalk
+is an SNMP application that uses SNMP GETNEXT requests to query a
+network entity for a tree of information.
+.PP
+An object identifier (OID) may be given on the command line.  This OID
+specifies which portion of the object identifier space will be
+searched using GETNEXT requests.  All variables in the subtree
+below the given OID are queried and their values presented to the user.
+Each variable name is given in the format specified in
+.IR variables(5) .
+.PP
+If no OID argument is present,
+.B snmpwalk
+will search MIB-2.
+If the network entity has an error processing the request packet, an
+error packet will be returned and a message will be shown, helping to
+pinpoint why the request was malformed.
+.PP
+If the tree search causes attempts to search beyond the end of the
+MIB, the message "End of MIB" will be displayed.
+.SH OPTIONS
+.TP 8
+.B -Cc
+Do not check whether the returned OIDs are increasing.  Some agents
+(LaserJets are an example) return OIDs out of order, but can
+complete the walk anyway.  Other agents return OIDs that are out of
+order and can cause
+.B snmpwalk
+to loop indefinitely.  By default,
+.B snmpwalk
+tries to detect this behavior and warns you when it hits an agent
+acting illegally.  Use
+.B -Cc
+to turn off this behaviour.
+.TP
+.B -Ci
+Include the given OID in the search range.  Normally
+.B snmpwalk
+uses GETNEXT requests starting with the OID you specified and returns
+all results in the MIB tree after that OID.  Sometimes, you may wish
+to include the OID specified on the command line in the printed
+results if it is a valid OID in the tree itself.  This option lets you
+do this.
+.TP
+.B -Cp
+Upon completion of the walk, print the number of variables found.
+.PP
+In addition to these options,
+.B snmpwalk
+takes the common options described in the 
+.I snmpcmd(1)
+manual page.
+.SH EXAMPLE
+The command:
+.PP
+snmpwalk -Os -c public -v 1 zeus system
+.PP
+will retrieve all of the variables under system:
+.PP
+sysDescr.0 = STRING: "SunOS zeus.net.cmu.edu 4.1.3_U1 1 sun4m"
+.br
+sysObjectID.0 = OID: enterprises.hp.nm.hpsystem.10.1.1
+.br
+sysUpTime.0 = Timeticks: (155274552) 17 days, 23:19:05
+.br
+sysContact.0 = STRING: ""
+.br
+sysName.0 = STRING: "zeus.net.cmu.edu"
+.br
+sysLocation.0 = STRING: ""
+.br
+sysServices.0 = INTEGER: 72
+.SH "SEE ALSO"
+snmpcmd(1), snmpbulkwalk(1), variables(5).
diff -Naur tomato/release/src/router/snmp/man/variables.5.def tomato121/release/src/router/snmp/man/variables.5.def
--- tomato/release/src/router/snmp/man/variables.5.def	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/man/variables.5.def	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,58 @@
+.\" /***********************************************************
+.\" 	Copyright 1988, 1989 by Carnegie Mellon University
+.\" 
+.\"                       All Rights Reserved
+.\" 
+.\" Permission to use, copy, modify, and distribute this software and its 
+.\" documentation for any purpose and without fee is hereby granted, 
+.\" provided that the above copyright notice appear in all copies and that
+.\" both that copyright notice and this permission notice appear in 
+.\" supporting documentation, and that the name of CMU not be
+.\" used in advertising or publicity pertaining to distribution of the
+.\" software without specific, written prior permission.  
+.\" 
+.\" CMU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+.\" ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+.\" CMU BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+.\" ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+.\" WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+.\" ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+.\" SOFTWARE.
+.\" ******************************************************************/
+.TH VARIABLES 5 "02 Mar 1999" VVERSIONINFO "Net-SNMP"
+.UC 4
+.SH NAME
+    variables - Format of specifying variable names to SNMP tools.
+.SH SYNOPSIS
+    system.sysdescr.0
+.SH DESCRIPTION
+Variable names are in the format of Object Identifiers (ASN.1).  There are
+several methods of representation. Each variable name is given in the format of A.B.C.D...,
+where A, B, C, and D are subidentifiers in one of two forms of notation.
+Each subidentifier may be encoded as a decimal integer, or a symbol as found in
+the RFC1066 MIB.  The case of the symbols is not significant.
+.br
+If there is no leading "." in the variable name, the name will be formed
+as if having been preceded with "iso.org.dod.internet.mgmt.mib.".  A "." must
+be placed before the first variable if the user is to fully specify the name.
+For example:
+.PP
+.I 1.1.0  system.sysDescr.0 and 1.sysDescr.0
+.PP
+all refer to the same variable name.  Likewise:
+.PP
+.I .1.3.6.1.2.1.1.1.0 .iso.org.dod.internet.mgmt.mib.system.sysdescr.0 .1.3.6.1.2.1.1.sysdescr.0
+.PP
+All refer to the same variable name.
+.PP
+The description of the variables in the MIB is given in the set of MIB
+files defined by the MIBS environment variable (or the default list
+defined at compilation time) and the MIB files in the
+DATADIR/snmp/mibs directory (or the MIBDIRS environment variable).
+.SH "SEE ALSO"
+RFC 1065, RFC 1066, RFC 1067, ISO IS 8824(ASN.1)
+.SH BUGS
+The parser of the MIB files file is not expected to handle bizarre
+(although correct) interpretations of the ASN.1 notation.
+
+
diff -Naur tomato/release/src/router/snmp/mibs/AGENTX-MIB.txt tomato121/release/src/router/snmp/mibs/AGENTX-MIB.txt
--- tomato/release/src/router/snmp/mibs/AGENTX-MIB.txt	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/mibs/AGENTX-MIB.txt	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,527 @@
+AGENTX-MIB DEFINITIONS ::= BEGIN
+
+IMPORTS
+ MODULE-IDENTITY, OBJECT-TYPE, Unsigned32, mib-2
+    FROM SNMPv2-SMI
+ SnmpAdminString
+    FROM SNMP-FRAMEWORK-MIB
+ MODULE-COMPLIANCE, OBJECT-GROUP
+    FROM SNMPv2-CONF
+ TEXTUAL-CONVENTION, TimeStamp, TruthValue, TDomain
+    FROM SNMPv2-TC;
+agentxMIB MODULE-IDENTITY
+ LAST-UPDATED "200001100000Z" -- Midnight 10 January 2000
+ ORGANIZATION "AgentX Working Group"
+ CONTACT-INFO "WG-email:   agentx@dorothy.bmc.com
+               Subscribe:  agentx-request@dorothy.bmc.com
+               WG-email Archive:  ftp://ftp.peer.com/pub/agentx/archives
+               FTP repository:  ftp://ftp.peer.com/pub/agentx
+               http://www.ietf.org/html.charters/agentx-charter.html
+
+               Chair:      Bob Natale
+                           ACE*COMM Corporation
+               Email:      bnatale@acecomm.com
+
+               WG editor:  Mark Ellison
+                           Ellison Software Consulting, Inc.
+               Email:      ellison@world.std.com
+
+               Co-author:  Lauren Heintz
+                           Cisco Systems,
+               EMail:      lheintz@cisco.com
+
+               Co-author:  Smitha Gudur
+                           Independent Consultant
+               Email:      sgudur@hotmail.com
+              "
+ DESCRIPTION    "This is the MIB module for the SNMP Agent Extensibility
+     Protocol (AgentX).  This MIB module will be implemented by
+     the master agent.
+    "
+
+  REVISION     "200001100000Z" -- Midnight 10 January 2000
+ DESCRIPTION
+    "Initial version published as RFC 2742."
+  ::= { mib-2  74 }
+
+ -- Textual Conventions
+
+ AgentxTAddress ::= TEXTUAL-CONVENTION
+   STATUS       current
+   DESCRIPTION
+     "Denotes a transport service address.  This is identical to
+      the TAddress textual convention (SNMPv2-SMI) except that
+      zero-length values are permitted.
+     "
+   SYNTAX       OCTET STRING (SIZE (0..255))
+
+ -- Administrative assignments
+
+ agentxObjects OBJECT IDENTIFIER      ::= { agentxMIB 1 }
+ agentxGeneral OBJECT IDENTIFIER      ::= { agentxObjects 1 }
+ agentxConnection OBJECT IDENTIFIER   ::= { agentxObjects 2 }
+ agentxSession OBJECT IDENTIFIER      ::= { agentxObjects 3 }
+ agentxRegistration OBJECT IDENTIFIER ::= { agentxObjects 4 }
+
+ agentxDefaultTimeout OBJECT-TYPE
+  SYNTAX      INTEGER (0..255)
+  UNITS       "seconds"
+  MAX-ACCESS  read-only
+  STATUS      current
+  DESCRIPTION
+     "The default length of time, in seconds, that the master
+      agent should allow to elapse after dispatching a message
+      to a session before it regards the subagent as not
+      responding.  This is a system-wide value that may
+      override the timeout value associated with a particular
+      session (agentxSessionTimeout) or a particular registered
+      MIB region (agentxRegTimeout).  If the associated value of
+      agentxSessionTimeout and agentxRegTimeout are zero, or
+      impractical in accordance with implementation-specific
+      procedure of the master agent, the value represented by
+      this object will be the effective timeout value for the
+
+      master agent to await a response to a dispatch from a
+      given subagent.
+     "
+  DEFVAL      { 5 }
+  ::= { agentxGeneral 1 }
+
+ agentxMasterAgentXVer OBJECT-TYPE
+  SYNTAX      INTEGER (1..255)
+  MAX-ACCESS  read-only
+  STATUS      current
+  DESCRIPTION
+     "The AgentX protocol version supported by this master agent.
+      The current protocol version is 1.  Note that the master agent
+      must also allow interaction with earlier version subagents.
+     "
+  ::= { agentxGeneral 2 }
+
+ --      The AgentX Subagent Connection Group
+
+ agentxConnTableLastChange OBJECT-TYPE
+  SYNTAX      TimeStamp
+  MAX-ACCESS  read-only
+  STATUS      current
+  DESCRIPTION
+     "The value of sysUpTime when the last row creation or deletion
+      occurred in the agentxConnectionTable.
+     "
+  ::= { agentxConnection 1 }
+
+ agentxConnectionTable OBJECT-TYPE
+   SYNTAX      SEQUENCE OF AgentxConnectionEntry
+   MAX-ACCESS  not-accessible
+   STATUS      current
+   DESCRIPTION
+     "The agentxConnectionTable tracks all current AgentX transport
+      connections.  There may be zero, one, or more AgentX sessions
+      carried on a given AgentX connection.
+     "
+   ::= { agentxConnection 2 }
+
+ agentxConnectionEntry OBJECT-TYPE
+   SYNTAX      AgentxConnectionEntry
+   MAX-ACCESS  not-accessible
+   STATUS      current
+   DESCRIPTION
+     "An agentxConnectionEntry contains information describing a
+      single AgentX transport connection.  A connection may be
+
+      used to support zero or more AgentX sessions.  An entry is
+      created when a new transport connection is established,
+      and is destroyed when the transport connection is terminated.
+     "
+   INDEX { agentxConnIndex }
+   ::= { agentxConnectionTable 1 }
+
+ AgentxConnectionEntry ::= SEQUENCE {
+          agentxConnIndex            Unsigned32,
+          agentxConnOpenTime         TimeStamp,
+          agentxConnTransportDomain  TDomain,
+          agentxConnTransportAddress AgentxTAddress }
+
+ agentxConnIndex OBJECT-TYPE
+   SYNTAX       Unsigned32 (1..4294967295)
+   MAX-ACCESS   not-accessible
+   STATUS       current
+   DESCRIPTION
+     "agentxConnIndex contains the value that uniquely identifies
+      an open transport connection used by this master agent
+      to provide AgentX service.  Values of this index should
+      not be re-used.  The value assigned to a given transport
+      connection is constant for the lifetime of that connection.
+     "
+   ::= { agentxConnectionEntry 1 }
+
+ agentxConnOpenTime OBJECT-TYPE
+   SYNTAX       TimeStamp
+   MAX-ACCESS   read-only
+   STATUS       current
+   DESCRIPTION
+     "The value of sysUpTime when this connection was established
+      and, therefore, its value when this entry was added to the table.
+     "
+   ::= { agentxConnectionEntry 2 }
+
+ agentxConnTransportDomain OBJECT-TYPE
+   SYNTAX       TDomain
+   MAX-ACCESS   read-only
+   STATUS       current
+   DESCRIPTION
+     "The transport protocol in use for this connection to the
+      subagent.
+     "
+   ::= { agentxConnectionEntry 3 }
+
+ agentxConnTransportAddress OBJECT-TYPE
+   SYNTAX       AgentxTAddress
+   MAX-ACCESS   read-only
+   STATUS       current
+   DESCRIPTION
+     "The transport address of the remote (subagent) end of this
+      connection to the master agent.  This object may be zero-length
+      for unix-domain sockets (and possibly other types of transport
+      addresses) since the subagent need not bind a filename to its
+      local socket.
+     "
+   ::= { agentxConnectionEntry 4 }
+
+ -- The AgentX Subagent Session Group
+
+ agentxSessionTableLastChange OBJECT-TYPE
+  SYNTAX      TimeStamp
+  MAX-ACCESS  read-only
+  STATUS      current
+  DESCRIPTION
+     "The value of sysUpTime when the last row creation or deletion
+      occurred in the agentxSessionTable.
+     "
+  ::= { agentxSession 1 }
+
+ agentxSessionTable OBJECT-TYPE
+  SYNTAX      SEQUENCE OF AgentxSessionEntry
+  MAX-ACCESS  not-accessible
+  STATUS      current
+  DESCRIPTION
+     "A table of AgentX subagent sessions currently in effect.
+     "
+  ::= { agentxSession 2 }
+
+ agentxSessionEntry OBJECT-TYPE
+  SYNTAX      AgentxSessionEntry
+  MAX-ACCESS  not-accessible
+  STATUS      current
+  DESCRIPTION
+     "Information about a single open session between the AgentX
+      master agent and a subagent is contained in this entry.  An
+      entry is created when a new session is successfully established
+      and is destroyed either when the subagent transport connection
+      has terminated or when the subagent session is closed.
+     "
+  INDEX       { agentxConnIndex, agentxSessionIndex }
+  ::= { agentxSessionTable 1 }
+
+ AgentxSessionEntry ::= SEQUENCE {
+  agentxSessionIndex         Unsigned32,
+  agentxSessionObjectID      OBJECT IDENTIFIER,
+  agentxSessionDescr         SnmpAdminString,
+  agentxSessionAdminStatus   INTEGER,
+  agentxSessionOpenTime      TimeStamp,
+  agentxSessionAgentXVer     INTEGER,
+  agentxSessionTimeout       INTEGER
+ }
+
+ agentxSessionIndex OBJECT-TYPE
+  SYNTAX      Unsigned32 (0..4294967295)
+  MAX-ACCESS  not-accessible
+  STATUS      current
+  DESCRIPTION
+     "A unique index for the subagent session.  It is the same as
+      h.sessionID defined in the agentx header.  Note that if
+      a subagent's session with the master agent is closed for
+      any reason its index should not be re-used.
+      A value of zero(0) is specifically allowed in order
+      to be compatible with the definition of h.sessionId.
+     "
+  ::= { agentxSessionEntry 1 }
+
+ agentxSessionObjectID OBJECT-TYPE
+  SYNTAX      OBJECT IDENTIFIER
+  MAX-ACCESS  read-only
+  STATUS      current
+  DESCRIPTION
+     "This is taken from the o.id field of the agentx-Open-PDU.
+      This attribute will report a value of '0.0' for subagents
+      not supporting the notion of an AgentX session object
+      identifier.
+     "
+  ::= { agentxSessionEntry 2 }
+
+ agentxSessionDescr OBJECT-TYPE
+  SYNTAX      SnmpAdminString
+  MAX-ACCESS  read-only
+  STATUS      current
+  DESCRIPTION
+     "A textual description of the session.  This is analogous to
+      sysDescr defined in the SNMPv2-MIB in RFC 1907 [19] and is
+      taken from the o.descr field of the agentx-Open-PDU.
+      This attribute will report a zero-length string value for
+      subagents not supporting the notion of a session description.
+     "
+  ::= { agentxSessionEntry 3 }
+
+ agentxSessionAdminStatus OBJECT-TYPE
+  SYNTAX      INTEGER {
+                 up(1),
+                 down(2)
+              }
+  MAX-ACCESS  read-write
+  STATUS      current
+  DESCRIPTION
+     "The administrative (desired) status of the session.  Setting
+      the value to 'down(2)' closes the subagent session (with c.reason
+      set to 'reasonByManager').
+     "
+  ::= { agentxSessionEntry 4 }
+
+ agentxSessionOpenTime OBJECT-TYPE
+  SYNTAX      TimeStamp
+  MAX-ACCESS  read-only
+  STATUS      current
+  DESCRIPTION
+     "The value of sysUpTime when this session was opened and,
+      therefore, its value when this entry was added to the table.
+     "
+  ::= { agentxSessionEntry 5 }
+
+ agentxSessionAgentXVer OBJECT-TYPE
+  SYNTAX      INTEGER (1..255)
+  MAX-ACCESS  read-only
+  STATUS      current
+  DESCRIPTION
+     "The version of the AgentX protocol supported by the
+      session.  This must be less than or equal to the value of
+      agentxMasterAgentXVer.
+     "
+  ::= { agentxSessionEntry 6 }
+
+ agentxSessionTimeout OBJECT-TYPE
+  SYNTAX     INTEGER (0..255)
+  UNITS      "seconds"
+  MAX-ACCESS read-only
+  STATUS     current
+  DESCRIPTION
+     "The length of time, in seconds, that a master agent should
+      allow to elapse after dispatching a message to this session
+      before it regards the subagent as not responding.  This value
+      is taken from the o.timeout field of the agentx-Open-PDU.
+      This is a session-specific value that may be overridden by
+      values associated with the specific registered MIB regions
+      (see agentxRegTimeout). A value of zero(0) indicates that
+      the master agent's default timeout value should be used
+
+      (see agentxDefaultTimeout).
+     "
+  ::= { agentxSessionEntry 7 }
+
+ -- The AgentX Registration Group
+
+ agentxRegistrationTableLastChange OBJECT-TYPE
+  SYNTAX      TimeStamp
+  MAX-ACCESS  read-only
+  STATUS      current
+  DESCRIPTION
+     "The value of sysUpTime when the last row creation or deletion
+      occurred in the agentxRegistrationTable.
+     "
+  ::= { agentxRegistration 1 }
+
+ agentxRegistrationTable OBJECT-TYPE
+  SYNTAX      SEQUENCE OF AgentxRegistrationEntry
+  MAX-ACCESS  not-accessible
+  STATUS      current
+  DESCRIPTION
+     "A table of registered regions.
+     "
+  ::= { agentxRegistration 2 }
+
+ agentxRegistrationEntry OBJECT-TYPE
+  SYNTAX      AgentxRegistrationEntry
+  MAX-ACCESS  not-accessible
+  STATUS      current
+  DESCRIPTION
+     "Contains information for a single registered region.  An
+      entry is created when a session  successfully registers a
+      region and is destroyed for any of three reasons: this region
+      is unregistered by the session, the session is closed,
+      or the subagent connection is closed.
+     "
+  INDEX       { agentxConnIndex, agentxSessionIndex, agentxRegIndex }
+  ::= { agentxRegistrationTable 1 }
+
+ AgentxRegistrationEntry ::= SEQUENCE {
+  agentxRegIndex           Unsigned32,
+  agentxRegContext         OCTET STRING,
+  agentxRegStart           OBJECT IDENTIFIER,
+  agentxRegRangeSubId      Unsigned32,
+  agentxRegUpperBound      Unsigned32,
+  agentxRegPriority        Unsigned32,
+  agentxRegTimeout         INTEGER,
+  agentxRegInstance        TruthValue }
+
+ agentxRegIndex OBJECT-TYPE
+  SYNTAX      Unsigned32 (1..4294967295)
+  MAX-ACCESS  not-accessible
+  STATUS      current
+  DESCRIPTION
+     "agentxRegIndex uniquely identifies a registration entry.
+      This value is constant for the lifetime of an entry.
+     "
+  ::= { agentxRegistrationEntry 1 }
+
+ agentxRegContext OBJECT-TYPE
+  SYNTAX      OCTET STRING
+  MAX-ACCESS  read-only
+  STATUS      current
+  DESCRIPTION
+     "The context in which the session supports the objects in this
+      region.  A zero-length context indicates the default context.
+     "
+  ::= { agentxRegistrationEntry 2 }
+
+ agentxRegStart OBJECT-TYPE
+  SYNTAX      OBJECT IDENTIFIER
+  MAX-ACCESS  read-only
+  STATUS      current
+  DESCRIPTION
+     "The starting OBJECT IDENTIFIER of this registration entry.  The
+      session identified by agentxSessionIndex implements objects
+      starting at this value (inclusive).  Note that this value could
+      identify an object type, an object instance, or a partial object
+      instance.
+     "
+  ::= { agentxRegistrationEntry 3 }
+
+ agentxRegRangeSubId OBJECT-TYPE
+  SYNTAX      Unsigned32
+  MAX-ACCESS  read-only
+  STATUS      current
+  DESCRIPTION
+     "agentxRegRangeSubId is used to specify the range.  This is
+      taken from r.region_subid in the registration PDU.  If the value
+      of this object is zero, no range is specified.  If it is non-zero,
+      it identifies the `nth' sub-identifier in r.region for which
+      this entry's agentxRegUpperBound value is substituted in the
+      OID for purposes of defining the region's upper bound.
+     "
+  ::= { agentxRegistrationEntry 4 }
+
+ agentxRegUpperBound OBJECT-TYPE
+  SYNTAX      Unsigned32
+  MAX-ACCESS  read-only
+  STATUS      current
+  DESCRIPTION
+    "agentxRegUpperBound represents the upper-bound sub-identifier in
+     a registration.  This is taken from the r.upper_bound in the
+     registration PDU.  If agentxRegRangeSubid (r.region_subid) is
+     zero, this value is also zero and is not used to define an upper
+     bound for this registration.
+    "
+  ::= { agentxRegistrationEntry 5 }
+
+ agentxRegPriority OBJECT-TYPE
+  SYNTAX      Unsigned32
+  MAX-ACCESS  read-only
+  STATUS      current
+  DESCRIPTION
+     "The registration priority.  Lower values have higher priority.
+      This value is taken from r.priority in the register PDU.
+      Sessions should use the value of 127 for r.priority if a
+      default value is desired.
+     "
+  ::= { agentxRegistrationEntry 6 }
+
+ agentxRegTimeout OBJECT-TYPE
+  SYNTAX      INTEGER (0..255)
+  UNITS       "seconds"
+  MAX-ACCESS  read-only
+  STATUS      current
+  DESCRIPTION
+     "The timeout value, in seconds, for responses to
+      requests associated with this registered MIB region.
+      A value of zero(0) indicates the default value (indicated
+      by by agentxSessionTimeout or agentxDefaultTimeout) is to
+      be used.  This value is taken from the r.timeout field of
+      the agentx-Register-PDU.
+     "
+  ::= { agentxRegistrationEntry 7 }
+
+ agentxRegInstance OBJECT-TYPE
+  SYNTAX      TruthValue
+  MAX-ACCESS  read-only
+  STATUS      current
+  DESCRIPTION
+     "The value of agentxRegInstance is `true' for
+      registrations for which the INSTANCE_REGISTRATION
+      was set, and is `false' for all other registrations.
+     "
+  ::= { agentxRegistrationEntry 8 }
+
+ -- Conformance Statements for AgentX
+
+ agentxConformance     OBJECT IDENTIFIER ::= { agentxMIB 2 }
+ agentxMIBGroups       OBJECT IDENTIFIER ::= { agentxConformance 1 }
+ agentxMIBCompliances  OBJECT IDENTIFIER ::= { agentxConformance 2 }
+
+ -- Compliance Statements for AgentX
+
+ agentxMIBCompliance MODULE-COMPLIANCE
+  STATUS      current
+  DESCRIPTION
+     "The compliance statement for SNMP entities that implement the
+      AgentX protocol.  Note that a compliant agent can implement all
+      objects in this MIB module as read-only.
+     "
+  MODULE -- this module
+     MANDATORY-GROUPS  { agentxMIBGroup }
+
+     OBJECT agentxSessionAdminStatus
+        MIN-ACCESS read-only
+        DESCRIPTION
+           "Write access is not required.
+           "
+  ::= { agentxMIBCompliances 1 }
+
+ agentxMIBGroup OBJECT-GROUP
+  OBJECTS {
+     agentxDefaultTimeout,
+     agentxMasterAgentXVer,
+     agentxConnTableLastChange,
+     agentxConnOpenTime,
+     agentxConnTransportDomain,
+     agentxConnTransportAddress,
+     agentxSessionTableLastChange,
+     agentxSessionTimeout,
+     agentxSessionObjectID,
+     agentxSessionDescr,
+     agentxSessionAdminStatus,
+     agentxSessionOpenTime,
+     agentxSessionAgentXVer,
+     agentxRegistrationTableLastChange,
+     agentxRegContext,
+     agentxRegStart,
+     agentxRegRangeSubId,
+     agentxRegUpperBound,
+     agentxRegPriority,
+     agentxRegTimeout,
+     agentxRegInstance
+    }
+  STATUS      current
+  DESCRIPTION
+     "All accessible objects in the AgentX MIB.
+     "
+  ::= { agentxMIBGroups 1 }
+
+ END
diff -Naur tomato/release/src/router/snmp/mibs/.cvsignore tomato121/release/src/router/snmp/mibs/.cvsignore
--- tomato/release/src/router/snmp/mibs/.cvsignore	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/mibs/.cvsignore	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,2 @@
+.index
+Makefile
diff -Naur tomato/release/src/router/snmp/mibs/DISMAN-EVENT-MIB.txt tomato121/release/src/router/snmp/mibs/DISMAN-EVENT-MIB.txt
--- tomato/release/src/router/snmp/mibs/DISMAN-EVENT-MIB.txt	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/mibs/DISMAN-EVENT-MIB.txt	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,1955 @@
+DISMAN-EVENT-MIB DEFINITIONS ::= BEGIN
+
+IMPORTS
+    MODULE-IDENTITY, OBJECT-TYPE,
+    Integer32, Unsigned32,
+    NOTIFICATION-TYPE, Counter32,
+    Gauge32, mib-2, zeroDotZero         FROM SNMPv2-SMI
+    TEXTUAL-CONVENTION, RowStatus,
+    TruthValue                FROM SNMPv2-TC
+
+
+    MODULE-COMPLIANCE, OBJECT-GROUP,
+    NOTIFICATION-GROUP             FROM SNMPv2-CONF
+    sysUpTime                 FROM SNMPv2-MIB
+    SnmpTagValue              FROM SNMP-TARGET-MIB
+    SnmpAdminString           FROM SNMP-FRAMEWORK-MIB;
+
+dismanEventMIB MODULE-IDENTITY
+    LAST-UPDATED "200010160000Z"            -- 16 October 2000
+    ORGANIZATION "IETF Distributed Management Working Group"
+    CONTACT-INFO "Ramanathan Kavasseri
+                  Cisco Systems, Inc.
+                  170 West Tasman Drive,
+                  San Jose CA 95134-1706.
+                  Phone: +1 408 526 4527
+                  Email: ramk@cisco.com"
+    DESCRIPTION
+     "The MIB module for defining event triggers and actions
+     for network management purposes."
+-- Revision History
+
+       REVISION     "200010160000Z"            -- 16 October 2000
+       DESCRIPTION  "This is the initial version of this MIB.
+                    Published as RFC 2981"
+    ::= { mib-2 88 }
+
+dismanEventMIBObjects OBJECT IDENTIFIER ::= { dismanEventMIB 1 }
+
+-- Management Triggered Event (MTE) objects
+
+mteResource           OBJECT IDENTIFIER ::= { dismanEventMIBObjects 1 }
+mteTrigger            OBJECT IDENTIFIER ::= { dismanEventMIBObjects 2 }
+mteObjects            OBJECT IDENTIFIER ::= { dismanEventMIBObjects 3 }
+mteEvent              OBJECT IDENTIFIER ::= { dismanEventMIBObjects 4 }
+
+--
+-- Textual Conventions
+--
+
+FailureReason ::= TEXTUAL-CONVENTION
+    STATUS      current
+    DESCRIPTION
+        "Reasons for failures in an attempt to perform a management
+        request.
+
+        The first group of errors, numbered less than 0, are related
+        to problems in sending the request.  The existence of a
+        particular error code here does not imply that all
+        implementations are capable of sensing that error and
+
+
+        returning that code.
+
+        The second group, numbered greater than 0, are copied
+        directly from SNMP protocol operations and are intended to
+        carry exactly the meanings defined for the protocol as returned
+        in an SNMP response.
+
+        localResourceLack       some local resource such as memory
+                                lacking or
+                                mteResourceSampleInstanceMaximum
+                                exceeded
+        badDestination          unrecognized domain name or otherwise
+                                invalid destination address
+        destinationUnreachable  can't get to destination address
+        noResponse              no response to SNMP request
+        badType                 the data syntax of a retrieved object
+                                as not as expected
+        sampleOverrun           another sample attempt occurred before
+                                the previous one completed"
+
+    SYNTAX      INTEGER { localResourceLack(-1),
+                          badDestination(-2),
+                          destinationUnreachable(-3),
+                          noResponse(-4),
+                          badType(-5),
+                          sampleOverrun(-6),
+
+                          noError(0),
+
+                          tooBig(1),
+                          noSuchName(2),
+                          badValue(3),
+                          readOnly(4),
+                          genErr(5),
+                          noAccess(6),
+                          wrongType(7),
+                          wrongLength(8),
+                          wrongEncoding(9),
+                          wrongValue(10),
+                          noCreation(11),
+                          inconsistentValue(12),
+                          resourceUnavailable(13),
+                          commitFailed(14),
+                          undoFailed(15),
+                          authorizationError(16),
+                          notWritable(17),
+                          inconsistentName(18) }
+--
+
+
+-- Resource Control Section
+--
+
+mteResourceSampleMinimum OBJECT-TYPE
+    SYNTAX      Integer32 (1..2147483647)
+    UNITS       "seconds"
+    MAX-ACCESS  read-write
+    STATUS      current
+    DESCRIPTION
+        "The minimum mteTriggerFrequency this system will
+        accept.  A system may use the larger values of this minimum to
+        lessen the impact of constant sampling.  For larger
+        sampling intervals the system samples less often and
+        suffers less overhead.  This object provides a way to enforce
+        such lower overhead for all triggers created after it is
+        set.
+
+        Unless explicitly resource limited, a system's value for
+        this object SHOULD be 1, allowing as small as a 1 second
+        interval for ongoing trigger sampling.
+
+        Changing this value will not invalidate an existing setting
+        of mteTriggerFrequency."
+    ::= { mteResource 1 }
+
+mteResourceSampleInstanceMaximum OBJECT-TYPE
+    SYNTAX      Unsigned32
+    UNITS       "instances"
+    MAX-ACCESS  read-write
+    STATUS      current
+    DESCRIPTION
+        "The maximum number of instance entries this system will
+        support for sampling.
+
+        These are the entries that maintain state, one for each
+        instance of each sampled object as selected by
+        mteTriggerValueID.  Note that wildcarded objects result
+        in multiple instances of this state.
+
+        A value of 0 indicates no preset limit, that is, the limit
+        is dynamic based on system operation and resources.
+
+        Unless explicitly resource limited, a system's value for
+        this object SHOULD be 0.
+
+        Changing this value will not eliminate or inhibit existing
+        sample state but could prevent allocation of additional state
+        information."
+
+
+    ::= { mteResource 2 }
+
+mteResourceSampleInstances OBJECT-TYPE
+    SYNTAX      Gauge32
+    UNITS       "instances"
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+        "The number of currently active instance entries as
+        defined for mteResourceSampleInstanceMaximum."
+    ::= { mteResource 3 }
+
+mteResourceSampleInstancesHigh OBJECT-TYPE
+    SYNTAX      Gauge32
+    UNITS       "instances"
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+        "The highest value of mteResourceSampleInstances that has
+        occurred since initialization of the management system."
+    ::= { mteResource 4 }
+
+mteResourceSampleInstanceLacks OBJECT-TYPE
+    SYNTAX      Counter32
+    UNITS       "instances"
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+        "The number of times this system could not take a new sample
+        because that allocation would have exceeded the limit set by
+        mteResourceSampleInstanceMaximum."
+    ::= { mteResource 5 }
+
+--
+-- Trigger Section
+--
+
+-- Counters
+
+mteTriggerFailures OBJECT-TYPE
+    SYNTAX      Counter32
+    UNITS       "failures"
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+        "The number of times an attempt to check for a trigger
+        condition has failed.  This counts individually for each
+        attempt in a group of targets or each attempt for a
+
+
+        wildcarded object."
+    ::= { mteTrigger 1 }
+
+--
+-- Trigger Table
+--
+
+mteTriggerTable OBJECT-TYPE
+    SYNTAX      SEQUENCE OF MteTriggerEntry
+    MAX-ACCESS  not-accessible
+    STATUS      current
+    DESCRIPTION
+        "A table of management event trigger information."
+    ::= { mteTrigger 2 }
+
+mteTriggerEntry OBJECT-TYPE
+    SYNTAX      MteTriggerEntry
+    MAX-ACCESS  not-accessible
+    STATUS      current
+    DESCRIPTION
+        "Information about a single trigger.  Applications create and
+        delete entries using mteTriggerEntryStatus."
+    INDEX       { mteOwner, IMPLIED mteTriggerName }
+    ::= { mteTriggerTable 1 }
+
+MteTriggerEntry ::= SEQUENCE {
+    mteOwner                            SnmpAdminString,
+    mteTriggerName                      SnmpAdminString,
+    mteTriggerComment                   SnmpAdminString,
+    mteTriggerTest                      BITS,
+    mteTriggerSampleType                INTEGER,
+    mteTriggerValueID                   OBJECT IDENTIFIER,
+    mteTriggerValueIDWildcard           TruthValue,
+    mteTriggerTargetTag                 SnmpTagValue,
+    mteTriggerContextName               SnmpAdminString,
+    mteTriggerContextNameWildcard       TruthValue,
+    mteTriggerFrequency                 Unsigned32,
+    mteTriggerObjectsOwner              SnmpAdminString,
+    mteTriggerObjects                   SnmpAdminString,
+    mteTriggerEnabled                   TruthValue,
+    mteTriggerEntryStatus               RowStatus
+}
+
+mteOwner OBJECT-TYPE
+   SYNTAX      SnmpAdminString (SIZE(0..32))
+   MAX-ACCESS  not-accessible
+   STATUS      current
+   DESCRIPTION
+
+
+        "The owner of this entry. The exact semantics of this
+        string are subject to the security policy defined by the
+        security administrator."
+    ::= { mteTriggerEntry 1 }
+
+mteTriggerName OBJECT-TYPE
+    SYNTAX      SnmpAdminString (SIZE (1..32))
+    MAX-ACCESS  not-accessible
+    STATUS      current
+    DESCRIPTION
+        "A locally-unique, administratively assigned name for the
+        trigger within the scope of mteOwner."
+    ::= { mteTriggerEntry 2 }
+
+mteTriggerComment OBJECT-TYPE
+    SYNTAX      SnmpAdminString
+    MAX-ACCESS  read-create
+    STATUS      current
+    DESCRIPTION
+        "A description of the trigger's function and use."
+    DEFVAL { ''H }
+    ::= { mteTriggerEntry 3 }
+
+mteTriggerTest OBJECT-TYPE
+    SYNTAX      BITS { existence(0), boolean(1), threshold(2) }
+    MAX-ACCESS  read-create
+    STATUS      current
+    DESCRIPTION
+        "The type of trigger test to perform.  For 'boolean' and
+        'threshold'  tests, the object at mteTriggerValueID MUST
+        evaluate to an integer, that is, anything that ends up encoded
+        for transmission (that is, in BER, not ASN.1) as an integer.
+
+        For 'existence', the specific test is as selected by
+        mteTriggerExistenceTest.  When an object appears, vanishes
+        or changes value, the trigger fires. If the object's
+        appearance caused the trigger firing, the object MUST
+        vanish before the trigger can be fired again for it, and
+        vice versa. If the trigger fired due to a change in the
+        object's value, it will be fired again on every successive
+        value change for that object.
+
+        For 'boolean', the specific test is as selected by
+        mteTriggerBooleanTest.  If the test result is true the trigger
+        fires.  The trigger will not fire again until the value has
+        become false and come back to true.
+
+        For 'threshold' the test works as described below for
+
+
+        mteTriggerThresholdStartup, mteTriggerThresholdRising, and
+        mteTriggerThresholdFalling.
+
+        Note that combining 'boolean' and 'threshold' tests on the
+        same object may be somewhat redundant."
+    DEFVAL { { boolean } }
+    ::= { mteTriggerEntry 4 }
+
+mteTriggerSampleType OBJECT-TYPE
+    SYNTAX      INTEGER { absoluteValue(1), deltaValue(2) }
+    MAX-ACCESS  read-create
+    STATUS      current
+    DESCRIPTION
+        "The type of sampling to perform.
+
+        An 'absoluteValue' sample requires only a single sample to be
+        meaningful, and is exactly the value of the object at
+        mteTriggerValueID at the sample time.
+
+        A 'deltaValue' requires two samples to be meaningful and is
+        thus not available for testing until the second and subsequent
+        samples after the object at mteTriggerValueID is first found
+        to exist.  It is the difference between the two samples.  For
+        unsigned values it is always positive, based on unsigned
+        arithmetic.  For signed values it can be positive or negative.
+
+        For SNMP counters to be meaningful they should be sampled as a
+        'deltaValue'.
+
+        For 'deltaValue' mteTriggerDeltaTable contains further
+        parameters.
+
+        If only 'existence' is set in mteTriggerTest this object has
+        no meaning."
+    DEFVAL { absoluteValue }
+    ::= { mteTriggerEntry 5 }
+
+mteTriggerValueID OBJECT-TYPE
+    SYNTAX      OBJECT IDENTIFIER
+    MAX-ACCESS  read-create
+    STATUS      current
+    DESCRIPTION
+        "The object identifier of the MIB object to sample to see
+        if the trigger should fire.
+
+        This may be wildcarded by truncating all or part of the
+        instance portion, in which case the value is obtained
+        as if with a GetNext function, checking multiple values
+
+
+        if they exist.  If such wildcarding is applied,
+        mteTriggerValueIDWildcard must be 'true' and if not it must
+        be 'false'.
+
+        Bad object identifiers or a mismatch between truncating the
+        identifier and the value of mteTriggerValueIDWildcard result
+        in operation as one would expect when providing the wrong
+        identifier to a Get or GetNext operation.  The Get will fail
+        or get the wrong object.  The GetNext will indeed get whatever
+        is next, proceeding until it runs past the initial part of the
+        identifier and perhaps many unintended objects for confusing
+        results.  If the value syntax of those objects is not usable,
+        that results in a 'badType' error that terminates the scan.
+
+        Each instance that fills the wildcard is independent of any
+        additional instances, that is, wildcarded objects operate
+        as if there were a separate table entry for each instance
+        that fills the wildcard without having to actually predict
+        all possible instances ahead of time."
+    DEFVAL { zeroDotZero }
+    ::= { mteTriggerEntry 6 }
+
+mteTriggerValueIDWildcard OBJECT-TYPE
+    SYNTAX      TruthValue
+    MAX-ACCESS  read-create
+    STATUS      current
+    DESCRIPTION
+        "Control for whether mteTriggerValueID is to be treated as
+        fully-specified or wildcarded, with 'true' indicating wildcard."
+    DEFVAL { false }
+    ::= { mteTriggerEntry 7 }
+
+mteTriggerTargetTag OBJECT-TYPE
+    SYNTAX      SnmpTagValue
+    MAX-ACCESS  read-create
+    STATUS      current
+    DESCRIPTION
+        "The tag for the target(s) from which to obtain the condition
+        for a trigger check.
+
+        A length of 0 indicates the local system.  In this case,
+        access to the objects indicated by mteTriggerValueID is under
+        the security credentials of the requester that set
+        mteTriggerEntryStatus to 'active'.  Those credentials are the
+        input parameters for isAccessAllowed from the Architecture for
+        Describing SNMP Management Frameworks.
+
+        Otherwise access rights are checked according to the security
+
+
+        parameters resulting from the tag."
+    DEFVAL { ''H }
+    ::= { mteTriggerEntry 8 }
+
+mteTriggerContextName OBJECT-TYPE
+    SYNTAX      SnmpAdminString
+    MAX-ACCESS  read-create
+    STATUS      current
+    DESCRIPTION
+        "The management context from which to obtain mteTriggerValueID.
+
+        This may be wildcarded by leaving characters off the end.  For
+        example use 'Repeater' to wildcard to 'Repeater1',
+        'Repeater2', 'Repeater-999.87b', and so on.  To indicate such
+        wildcarding is intended, mteTriggerContextNameWildcard must
+        be 'true'.
+
+        Each instance that fills the wildcard is independent of any
+        additional instances, that is, wildcarded objects operate
+        as if there were a separate table entry for each instance
+        that fills the wildcard without having to actually predict
+        all possible instances ahead of time.
+
+        Operation of this feature assumes that the local system has a
+        list of available contexts against which to apply the
+        wildcard.  If the objects are being read from the local
+        system, this is clearly the system's own list of contexts.
+        For a remote system a local version of such a list is not
+        defined by any current standard and may not be available, so
+        this function MAY not be supported."
+    DEFVAL { ''H }
+    ::= { mteTriggerEntry 9 }
+
+mteTriggerContextNameWildcard OBJECT-TYPE
+    SYNTAX      TruthValue
+    MAX-ACCESS  read-create
+    STATUS      current
+    DESCRIPTION
+        "Control for whether mteTriggerContextName is to be treated as
+        fully-specified or wildcarded, with 'true' indicating wildcard."
+    DEFVAL { false }
+    ::= { mteTriggerEntry 10 }
+
+mteTriggerFrequency OBJECT-TYPE
+    SYNTAX      Unsigned32
+    UNITS       "seconds"
+    MAX-ACCESS  read-create
+    STATUS      current
+
+
+    DESCRIPTION
+        "The number of seconds to wait between trigger samples.  To
+        encourage consistency in sampling, the interval is measured
+        from the beginning of one check to the beginning of the next
+        and the timer is restarted immediately when it expires, not
+        when the check completes.
+
+        If the next sample begins before the previous one completed the
+        system may either attempt to make the check or treat this as an
+        error condition with the error 'sampleOverrun'.
+
+        A frequency of 0 indicates instantaneous recognition of the
+        condition.  This is not possible in many cases, but may
+        be supported in cases where it makes sense and the system is
+        able to do so.  This feature allows the MIB to be used in
+        implementations where such interrupt-driven behavior is
+        possible and is not likely to be supported for all MIB objects
+        even then since such sampling generally has to be tightly
+        integrated into low-level code.
+
+        Systems that can support this SHOULD document those cases
+        where it can be used.  In cases where it can not, setting this
+        object to 0 should be disallowed."
+    DEFVAL { 600 }
+    ::= { mteTriggerEntry 11 }
+
+mteTriggerObjectsOwner OBJECT-TYPE
+    SYNTAX      SnmpAdminString (SIZE (0..32))
+    MAX-ACCESS  read-create
+    STATUS      current
+    DESCRIPTION
+        "To go with mteTriggerObjects, the mteOwner of a group of
+        objects from mteObjectsTable."
+    DEFVAL { ''H }
+    ::= { mteTriggerEntry 12 }
+
+mteTriggerObjects OBJECT-TYPE
+    SYNTAX      SnmpAdminString (SIZE (0..32))
+    MAX-ACCESS  read-create
+    STATUS      current
+    DESCRIPTION
+        "The mteObjectsName of a group of objects from
+        mteObjectsTable.  These objects are to be added to any
+        Notification resulting from the firing of this trigger.
+
+        A list of objects may also be added based on the event or on
+        the value of mteTriggerTest.
+
+
+
+        A length of 0 indicates no additional objects."
+    DEFVAL { ''H }
+    ::= { mteTriggerEntry 13 }
+
+mteTriggerEnabled OBJECT-TYPE
+    SYNTAX      TruthValue
+    MAX-ACCESS  read-create
+    STATUS      current
+    DESCRIPTION
+        "A control to allow a trigger to be configured but not used.
+        When the value is 'false' the trigger is not sampled."
+    DEFVAL { false }
+    ::= { mteTriggerEntry 14 }
+
+mteTriggerEntryStatus OBJECT-TYPE
+    SYNTAX      RowStatus
+    MAX-ACCESS  read-create
+    STATUS      current
+    DESCRIPTION
+        "The control that allows creation and deletion of entries.
+        Once made active an entry may not be modified except to
+        delete it."
+    ::= { mteTriggerEntry 15 }
+
+--
+-- Trigger Delta Table
+--
+
+mteTriggerDeltaTable OBJECT-TYPE
+    SYNTAX      SEQUENCE OF MteTriggerDeltaEntry
+    MAX-ACCESS  not-accessible
+    STATUS      current
+    DESCRIPTION
+        "A table of management event trigger information for delta
+        sampling."
+    ::= { mteTrigger 3 }
+
+mteTriggerDeltaEntry OBJECT-TYPE
+    SYNTAX      MteTriggerDeltaEntry
+    MAX-ACCESS  not-accessible
+    STATUS      current
+    DESCRIPTION
+        "Information about a single trigger's delta sampling.  Entries
+        automatically exist in this this table for each mteTriggerEntry
+        that has mteTriggerSampleType set to 'deltaValue'."
+    INDEX       { mteOwner, IMPLIED mteTriggerName }
+    ::= { mteTriggerDeltaTable 1 }
+
+
+
+MteTriggerDeltaEntry ::= SEQUENCE {
+    mteTriggerDeltaDiscontinuityID                OBJECT IDENTIFIER,
+    mteTriggerDeltaDiscontinuityIDWildcard        TruthValue,
+    mteTriggerDeltaDiscontinuityIDType            INTEGER
+}
+
+sysUpTimeInstance OBJECT IDENTIFIER ::= { sysUpTime 0 }
+
+mteTriggerDeltaDiscontinuityID OBJECT-TYPE
+    SYNTAX      OBJECT IDENTIFIER
+    MAX-ACCESS  read-write
+    STATUS      current
+    DESCRIPTION
+        "The OBJECT IDENTIFIER (OID) of a TimeTicks, TimeStamp, or
+        DateAndTime object that indicates a discontinuity in the value
+        at mteTriggerValueID.
+
+        The OID may be for a leaf object (e.g. sysUpTime.0) or may
+        be wildcarded to match mteTriggerValueID.
+
+        This object supports normal checking for a discontinuity in a
+        counter.  Note that if this object does not point to sysUpTime
+        discontinuity checking MUST still check sysUpTime for an overall
+        discontinuity.
+
+        If the object identified is not accessible the sample attempt
+        is in error, with the error code as from an SNMP request.
+
+        Bad object identifiers or a mismatch between truncating the
+        identifier and the value of mteDeltaDiscontinuityIDWildcard
+        result in operation as one would expect when providing the
+        wrong identifier to a Get operation.  The Get will fail or get
+        the wrong object.  If the value syntax of those objects is not
+        usable, that results in an error that terminates the sample
+        with a 'badType' error code."
+    DEFVAL { sysUpTimeInstance }
+    ::= { mteTriggerDeltaEntry 1 }
+
+mteTriggerDeltaDiscontinuityIDWildcard OBJECT-TYPE
+     SYNTAX      TruthValue
+     MAX-ACCESS  read-write
+     STATUS      current
+     DESCRIPTION
+        "Control for whether mteTriggerDeltaDiscontinuityID is to be
+        treated as fully-specified or wildcarded, with 'true'
+        indicating wildcard. Note that the value of this object will
+        be the same as that of the corresponding instance of
+        mteTriggerValueIDWildcard when the corresponding
+
+
+        mteTriggerSampleType is 'deltaValue'."
+    DEFVAL { false }
+    ::= { mteTriggerDeltaEntry 2 }
+
+mteTriggerDeltaDiscontinuityIDType OBJECT-TYPE
+    SYNTAX      INTEGER { timeTicks(1), timeStamp(2), dateAndTime(3) }
+    MAX-ACCESS  read-write
+    STATUS      current
+    DESCRIPTION
+        "The value 'timeTicks' indicates the
+        mteTriggerDeltaDiscontinuityID of this row is of syntax
+        TimeTicks.  The value 'timeStamp' indicates syntax TimeStamp.
+        The value 'dateAndTime' indicates syntax DateAndTime."
+    DEFVAL { timeTicks }
+    ::= { mteTriggerDeltaEntry 3 }
+
+--
+-- Trigger Existence Table
+--
+
+mteTriggerExistenceTable OBJECT-TYPE
+    SYNTAX      SEQUENCE OF MteTriggerExistenceEntry
+    MAX-ACCESS  not-accessible
+    STATUS      current
+    DESCRIPTION
+        "A table of management event trigger information for existence
+        triggers."
+    ::= { mteTrigger 4 }
+
+mteTriggerExistenceEntry OBJECT-TYPE
+    SYNTAX      MteTriggerExistenceEntry
+    MAX-ACCESS  not-accessible
+    STATUS      current
+    DESCRIPTION
+        "Information about a single existence trigger.  Entries
+        automatically exist in this this table for each mteTriggerEntry
+        that has 'existence' set in mteTriggerTest."
+    INDEX       { mteOwner, IMPLIED mteTriggerName }
+    ::= { mteTriggerExistenceTable 1 }
+
+MteTriggerExistenceEntry ::= SEQUENCE {
+    mteTriggerExistenceTest              BITS,
+    mteTriggerExistenceStartup           BITS,
+    mteTriggerExistenceObjectsOwner      SnmpAdminString,
+    mteTriggerExistenceObjects           SnmpAdminString,
+    mteTriggerExistenceEventOwner        SnmpAdminString,
+    mteTriggerExistenceEvent             SnmpAdminString
+}
+
+
+mteTriggerExistenceTest OBJECT-TYPE
+    SYNTAX      BITS { present(0), absent(1), changed(2) }
+    MAX-ACCESS  read-write
+    STATUS      current
+    DESCRIPTION
+        "The type of existence test to perform.  The trigger fires
+        when the object at mteTriggerValueID is seen to go from
+        present to absent, from absent to present, or to have it's
+        value changed, depending on which tests are selected:
+
+        present(0) - when this test is selected, the trigger fires
+        when the mteTriggerValueID object goes from absent to present.
+
+        absent(1)  - when this test is selected, the trigger fires
+        when the mteTriggerValueID object goes from present to absent.
+        changed(2) - when this test is selected, the trigger fires
+        the mteTriggerValueID object value changes.
+
+        Once the trigger has fired for either presence or absence it
+        will not fire again for that state until the object has been
+        to the other state. "
+    DEFVAL { { present, absent } }
+    ::= { mteTriggerExistenceEntry 1 }
+
+mteTriggerExistenceStartup OBJECT-TYPE
+    SYNTAX      BITS { present(0), absent(1) }
+    MAX-ACCESS  read-write
+    STATUS      current
+    DESCRIPTION
+        "Control for whether an event may be triggered when this entry
+        is first set to 'active' and the test specified by
+        mteTriggerExistenceTest is true.  Setting an option causes
+        that trigger to fire when its test is true."
+    DEFVAL { { present, absent } }
+    ::= { mteTriggerExistenceEntry 2 }
+
+mteTriggerExistenceObjectsOwner OBJECT-TYPE
+    SYNTAX      SnmpAdminString (SIZE (0..32))
+    MAX-ACCESS  read-write
+    STATUS      current
+    DESCRIPTION
+        "To go with mteTriggerExistenceObjects, the mteOwner of a
+        group of objects from mteObjectsTable."
+    DEFVAL { ''H }
+    ::= { mteTriggerExistenceEntry 3 }
+
+mteTriggerExistenceObjects OBJECT-TYPE
+    SYNTAX      SnmpAdminString (SIZE (0..32))
+
+
+    MAX-ACCESS  read-write
+    STATUS      current
+    DESCRIPTION
+        "The mteObjectsName of a group of objects from
+        mteObjectsTable.  These objects are to be added to any
+        Notification resulting from the firing of this trigger for
+        this test.
+
+        A list of objects may also be added based on the overall
+        trigger, the event or other settings in mteTriggerTest.
+
+        A length of 0 indicates no additional objects."
+    DEFVAL { ''H }
+    ::= { mteTriggerExistenceEntry 4 }
+
+mteTriggerExistenceEventOwner OBJECT-TYPE
+    SYNTAX      SnmpAdminString (SIZE (0..32))
+    MAX-ACCESS  read-write
+    STATUS      current
+    DESCRIPTION
+        "To go with mteTriggerExistenceEvent, the mteOwner of an event
+        entry from the mteEventTable."
+    DEFVAL { ''H }
+    ::= { mteTriggerExistenceEntry 5 }
+
+mteTriggerExistenceEvent OBJECT-TYPE
+    SYNTAX      SnmpAdminString (SIZE (0..32))
+    MAX-ACCESS  read-write
+    STATUS      current
+    DESCRIPTION
+        "The mteEventName of the event to invoke when mteTriggerType is
+        'existence' and this trigger fires.  A length of 0 indicates no
+        event."
+    DEFVAL { ''H }
+    ::= { mteTriggerExistenceEntry 6 }
+
+--
+-- Trigger Boolean Table
+--
+
+mteTriggerBooleanTable OBJECT-TYPE
+    SYNTAX      SEQUENCE OF MteTriggerBooleanEntry
+    MAX-ACCESS  not-accessible
+    STATUS      current
+    DESCRIPTION
+        "A table of management event trigger information for boolean
+        triggers."
+    ::= { mteTrigger 5 }
+
+
+mteTriggerBooleanEntry OBJECT-TYPE
+    SYNTAX      MteTriggerBooleanEntry
+    MAX-ACCESS  not-accessible
+    STATUS      current
+    DESCRIPTION
+        "Information about a single boolean trigger.  Entries
+        automatically exist in this this table for each mteTriggerEntry
+        that has 'boolean' set in mteTriggerTest."
+    INDEX       { mteOwner, IMPLIED mteTriggerName }
+    ::= { mteTriggerBooleanTable 1 }
+
+MteTriggerBooleanEntry ::= SEQUENCE {
+    mteTriggerBooleanComparison          INTEGER,
+    mteTriggerBooleanValue               Integer32,
+    mteTriggerBooleanStartup             TruthValue,
+    mteTriggerBooleanObjectsOwner        SnmpAdminString,
+    mteTriggerBooleanObjects             SnmpAdminString,
+    mteTriggerBooleanEventOwner          SnmpAdminString,
+    mteTriggerBooleanEvent               SnmpAdminString
+}
+
+mteTriggerBooleanComparison OBJECT-TYPE
+    SYNTAX      INTEGER { unequal(1), equal(2),
+                 less(3), lessOrEqual(4),
+                 greater(5), greaterOrEqual(6) }
+    MAX-ACCESS  read-write
+    STATUS      current
+    DESCRIPTION
+        "The type of boolean comparison to perform.
+
+        The value at mteTriggerValueID is compared to
+        mteTriggerBooleanValue, so for example if
+        mteTriggerBooleanComparison is 'less' the result would be true
+        if the value at mteTriggerValueID is less than the value of
+        mteTriggerBooleanValue."
+    DEFVAL { unequal }
+    ::= { mteTriggerBooleanEntry 1 }
+
+mteTriggerBooleanValue OBJECT-TYPE
+    SYNTAX      Integer32
+    MAX-ACCESS  read-write
+    STATUS      current
+    DESCRIPTION
+        "The value to use for the test specified by
+        mteTriggerBooleanTest."
+    DEFVAL { 0 }
+    ::= { mteTriggerBooleanEntry 2 }
+
+
+
+mteTriggerBooleanStartup OBJECT-TYPE
+    SYNTAX      TruthValue
+    MAX-ACCESS  read-write
+    STATUS      current
+    DESCRIPTION
+        "Control for whether an event may be triggered when this entry
+        is first set to 'active' or a new instance of the object at
+        mteTriggerValueID is found and the test specified by
+        mteTriggerBooleanComparison is true.  In that case an event is
+        triggered if mteTriggerBooleanStartup is 'true'."
+    DEFVAL { true }
+    ::= { mteTriggerBooleanEntry 3 }
+
+mteTriggerBooleanObjectsOwner OBJECT-TYPE
+    SYNTAX      SnmpAdminString (SIZE (0..32))
+    MAX-ACCESS  read-write
+    STATUS      current
+    DESCRIPTION
+        "To go with mteTriggerBooleanObjects, the mteOwner of a group
+        of objects from mteObjectsTable."
+    DEFVAL { ''H }
+    ::= { mteTriggerBooleanEntry 4 }
+
+mteTriggerBooleanObjects OBJECT-TYPE
+    SYNTAX      SnmpAdminString (SIZE (0..32))
+    MAX-ACCESS  read-write
+    STATUS      current
+    DESCRIPTION
+        "The mteObjectsName of a group of objects from
+        mteObjectsTable.  These objects are to be added to any
+        Notification resulting from the firing of this trigger for
+        this test.
+
+        A list of objects may also be added based on the overall
+        trigger, the event or other settings in mteTriggerTest.
+
+        A length of 0 indicates no additional objects."
+    DEFVAL { ''H }
+    ::= { mteTriggerBooleanEntry 5 }
+
+mteTriggerBooleanEventOwner OBJECT-TYPE
+    SYNTAX      SnmpAdminString (SIZE (0..32))
+    MAX-ACCESS  read-write
+    STATUS      current
+    DESCRIPTION
+        "To go with mteTriggerBooleanEvent, the mteOwner of an event
+        entry from mteEventTable."
+    DEFVAL { ''H }
+
+
+    ::= { mteTriggerBooleanEntry 6 }
+
+mteTriggerBooleanEvent OBJECT-TYPE
+    SYNTAX      SnmpAdminString (SIZE (0..32))
+    MAX-ACCESS  read-write
+    STATUS      current
+    DESCRIPTION
+        "The mteEventName of the event to invoke when mteTriggerType is
+        'boolean' and this trigger fires.  A length of 0 indicates no
+        event."
+    DEFVAL { ''H }
+    ::= { mteTriggerBooleanEntry 7 }
+
+--
+-- Trigger Threshold Table
+--
+
+mteTriggerThresholdTable OBJECT-TYPE
+    SYNTAX      SEQUENCE OF MteTriggerThresholdEntry
+    MAX-ACCESS  not-accessible
+    STATUS      current
+    DESCRIPTION
+        "A table of management event trigger information for threshold
+        triggers."
+    ::= { mteTrigger 6 }
+
+mteTriggerThresholdEntry OBJECT-TYPE
+    SYNTAX      MteTriggerThresholdEntry
+    MAX-ACCESS  not-accessible
+    STATUS      current
+    DESCRIPTION
+        "Information about a single threshold trigger.  Entries
+        automatically exist in this table for each mteTriggerEntry
+        that has 'threshold' set in mteTriggerTest."
+    INDEX       { mteOwner, IMPLIED mteTriggerName }
+    ::= { mteTriggerThresholdTable 1 }
+
+MteTriggerThresholdEntry ::= SEQUENCE {
+    mteTriggerThresholdStartup                  INTEGER,
+    mteTriggerThresholdRising                   Integer32,
+    mteTriggerThresholdFalling                  Integer32,
+    mteTriggerThresholdDeltaRising              Integer32,
+    mteTriggerThresholdDeltaFalling             Integer32,
+    mteTriggerThresholdObjectsOwner             SnmpAdminString,
+    mteTriggerThresholdObjects                  SnmpAdminString,
+    mteTriggerThresholdRisingEventOwner         SnmpAdminString,
+    mteTriggerThresholdRisingEvent              SnmpAdminString,
+    mteTriggerThresholdFallingEventOwner        SnmpAdminString,
+
+
+    mteTriggerThresholdFallingEvent             SnmpAdminString,
+    mteTriggerThresholdDeltaRisingEventOwner    SnmpAdminString,
+    mteTriggerThresholdDeltaRisingEvent         SnmpAdminString,
+    mteTriggerThresholdDeltaFallingEventOwner   SnmpAdminString,
+    mteTriggerThresholdDeltaFallingEvent        SnmpAdminString
+}
+
+mteTriggerThresholdStartup OBJECT-TYPE
+    SYNTAX      INTEGER { rising(1), falling(2), risingOrFalling(3) }
+    MAX-ACCESS  read-write
+    STATUS      current
+    DESCRIPTION
+        "The event that may be triggered when this entry is first
+        set to 'active' and a new instance of the object at
+        mteTriggerValueID is found.  If the first sample after this
+        instance becomes active is greater than or equal to
+        mteTriggerThresholdRising and mteTriggerThresholdStartup is
+        equal to 'rising' or 'risingOrFalling', then one
+        mteTriggerThresholdRisingEvent is triggered for that instance.
+        If the first sample after this entry becomes active is less
+        than or equal to mteTriggerThresholdFalling and
+        mteTriggerThresholdStartup is equal to 'falling' or
+        'risingOrFalling', then one mteTriggerThresholdRisingEvent is
+        triggered for that instance."
+    DEFVAL { risingOrFalling }
+    ::= { mteTriggerThresholdEntry 1 }
+
+mteTriggerThresholdRising OBJECT-TYPE
+    SYNTAX      Integer32
+    MAX-ACCESS  read-write
+    STATUS      current
+    DESCRIPTION
+        "A threshold value to check against if mteTriggerType is
+        'threshold'.
+
+        When the current sampled value is greater than or equal to
+        this threshold, and the value at the last sampling interval
+        was less than this threshold, one
+        mteTriggerThresholdRisingEvent is triggered.  That event is
+        also triggered if the first sample after this entry becomes
+        active is greater than or equal to this threshold and
+        mteTriggerThresholdStartup is equal to 'rising' or
+        'risingOrFalling'.
+
+        After a rising event is generated, another such event is not
+        triggered until the sampled value falls below this threshold
+        and reaches mteTriggerThresholdFalling."
+    DEFVAL { 0 }
+
+
+    ::= { mteTriggerThresholdEntry 2 }
+
+mteTriggerThresholdFalling OBJECT-TYPE
+    SYNTAX      Integer32
+    MAX-ACCESS  read-write
+    STATUS      current
+    DESCRIPTION
+        "A threshold value to check against if mteTriggerType is
+        'threshold'.
+
+        When the current sampled value is less than or equal to this
+        threshold, and the value at the last sampling interval was
+        greater than this threshold, one
+        mteTriggerThresholdFallingEvent is triggered.  That event is
+        also triggered if the first sample after this entry becomes
+        active is less than or equal to this threshold and
+        mteTriggerThresholdStartup is equal to 'falling' or
+        'risingOrFalling'.
+
+        After a falling event is generated, another such event is not
+        triggered until the sampled value rises above this threshold
+        and reaches mteTriggerThresholdRising."
+    DEFVAL { 0 }
+    ::= { mteTriggerThresholdEntry 3 }
+
+mteTriggerThresholdDeltaRising OBJECT-TYPE
+    SYNTAX      Integer32
+    MAX-ACCESS  read-write
+    STATUS      current
+    DESCRIPTION
+        "A threshold value to check against if mteTriggerType is
+        'threshold'.
+
+        When the delta value (difference) between the current sampled
+        value (value(n)) and the previous sampled value (value(n-1))
+        is greater than or equal to this threshold,
+        and the delta value calculated at the last sampling interval
+        (i.e. value(n-1) - value(n-2)) was less than this threshold,
+        one mteTriggerThresholdDeltaRisingEvent is triggered. That event
+        is also triggered if the first delta value calculated after this
+        entry becomes active, i.e. value(2) - value(1), where value(1)
+        is the first sample taken of that instance, is greater than or
+        equal to this threshold.
+
+        After a rising event is generated, another such event is not
+        triggered until the delta value falls below this threshold and
+        reaches mteTriggerThresholdDeltaFalling."
+    DEFVAL { 0 }
+
+
+    ::= { mteTriggerThresholdEntry 4 }
+
+mteTriggerThresholdDeltaFalling OBJECT-TYPE
+    SYNTAX      Integer32
+    MAX-ACCESS  read-write
+    STATUS      current
+    DESCRIPTION
+        "A threshold value to check against if mteTriggerType is
+        'threshold'.
+
+        When the delta value (difference) between the current sampled
+        value (value(n)) and the previous sampled value (value(n-1))
+        is less than or equal to this threshold,
+        and the delta value calculated at the last sampling interval
+        (i.e. value(n-1) - value(n-2)) was greater than this threshold,
+        one mteTriggerThresholdDeltaFallingEvent is triggered. That event
+        is also triggered if the first delta value calculated after this
+        entry becomes active, i.e. value(2) - value(1), where value(1)
+        is the first sample taken of that instance, is less than or
+        equal to this threshold.
+
+        After a falling event is generated, another such event is not
+        triggered until the delta value falls below this threshold and
+        reaches mteTriggerThresholdDeltaRising."
+    DEFVAL { 0 }
+    ::= { mteTriggerThresholdEntry 5 }
+
+mteTriggerThresholdObjectsOwner OBJECT-TYPE
+    SYNTAX      SnmpAdminString (SIZE (0..32))
+    MAX-ACCESS  read-write
+    STATUS      current
+    DESCRIPTION
+        "To go with mteTriggerThresholdObjects, the mteOwner of a group
+        of objects from mteObjectsTable."
+    DEFVAL { ''H }
+    ::= { mteTriggerThresholdEntry 6 }
+
+mteTriggerThresholdObjects OBJECT-TYPE
+    SYNTAX      SnmpAdminString (SIZE (0..32))
+    MAX-ACCESS  read-write
+    STATUS      current
+    DESCRIPTION
+        "The mteObjectsName of a group of objects from
+        mteObjectsTable.  These objects are to be added to any
+        Notification resulting from the firing of this trigger for
+        this test.
+
+        A list of objects may also be added based on the overall
+
+
+        trigger, the event or other settings in mteTriggerTest.
+
+        A length of 0 indicates no additional objects."
+    DEFVAL { ''H }
+    ::= { mteTriggerThresholdEntry 7 }
+
+mteTriggerThresholdRisingEventOwner OBJECT-TYPE
+    SYNTAX      SnmpAdminString (SIZE (0..32))
+    MAX-ACCESS  read-write
+    STATUS      current
+    DESCRIPTION
+        "To go with mteTriggerThresholdRisingEvent, the mteOwner of an
+        event entry from mteEventTable."
+    DEFVAL { ''H }
+    ::= { mteTriggerThresholdEntry 8 }
+
+mteTriggerThresholdRisingEvent OBJECT-TYPE
+    SYNTAX      SnmpAdminString (SIZE (0..32))
+    MAX-ACCESS  read-write
+    STATUS      current
+    DESCRIPTION
+        "The mteEventName of the event to invoke when mteTriggerType is
+        'threshold' and this trigger fires based on
+        mteTriggerThresholdRising.  A length of 0 indicates no event."
+    DEFVAL { ''H }
+    ::= { mteTriggerThresholdEntry 9 }
+
+mteTriggerThresholdFallingEventOwner OBJECT-TYPE
+    SYNTAX      SnmpAdminString (SIZE (0..32))
+    MAX-ACCESS  read-write
+    STATUS      current
+    DESCRIPTION
+        "To go with mteTriggerThresholdFallingEvent, the mteOwner of an
+        event entry from mteEventTable."
+    DEFVAL { ''H }
+    ::= { mteTriggerThresholdEntry 10 }
+
+mteTriggerThresholdFallingEvent OBJECT-TYPE
+    SYNTAX      SnmpAdminString (SIZE (0..32))
+    MAX-ACCESS  read-write
+    STATUS      current
+    DESCRIPTION
+        "The mteEventName of the event to invoke when mteTriggerType is
+        'threshold' and this trigger fires based on
+        mteTriggerThresholdFalling.  A length of 0 indicates no event."
+    DEFVAL { ''H }
+    ::= { mteTriggerThresholdEntry 11 }
+
+
+
+mteTriggerThresholdDeltaRisingEventOwner OBJECT-TYPE
+    SYNTAX      SnmpAdminString (SIZE (0..32))
+    MAX-ACCESS  read-write
+    STATUS      current
+    DESCRIPTION
+        "To go with mteTriggerThresholdDeltaRisingEvent, the mteOwner
+        of an event entry from mteEventTable."
+    DEFVAL { ''H }
+    ::= { mteTriggerThresholdEntry 12 }
+
+mteTriggerThresholdDeltaRisingEvent OBJECT-TYPE
+    SYNTAX      SnmpAdminString (SIZE (0..32))
+    MAX-ACCESS  read-write
+    STATUS      current
+    DESCRIPTION
+        "The mteEventName of the event to invoke when mteTriggerType is
+        'threshold' and this trigger fires based on
+        mteTriggerThresholdDeltaRising. A length of 0 indicates
+        no event."
+    DEFVAL { ''H }
+    ::= { mteTriggerThresholdEntry 13 }
+
+mteTriggerThresholdDeltaFallingEventOwner OBJECT-TYPE
+    SYNTAX      SnmpAdminString (SIZE (0..32))
+    MAX-ACCESS  read-write
+    STATUS      current
+    DESCRIPTION
+        "To go with mteTriggerThresholdDeltaFallingEvent, the mteOwner
+        of an event entry from mteEventTable."
+    DEFVAL { ''H }
+    ::= { mteTriggerThresholdEntry 14 }
+
+mteTriggerThresholdDeltaFallingEvent OBJECT-TYPE
+    SYNTAX      SnmpAdminString (SIZE (0..32))
+    MAX-ACCESS  read-write
+    STATUS      current
+    DESCRIPTION
+        "The mteEventName of the event to invoke when mteTriggerType is
+        'threshold' and this trigger fires based on
+        mteTriggerThresholdDeltaFalling.  A length of 0 indicates
+        no event."
+    DEFVAL { ''H }
+    ::= { mteTriggerThresholdEntry 15 }
+
+--
+-- Objects Table
+--
+
+
+
+mteObjectsTable OBJECT-TYPE
+    SYNTAX      SEQUENCE OF MteObjectsEntry
+    MAX-ACCESS  not-accessible
+    STATUS      current
+    DESCRIPTION
+        "A table of objects that can be added to notifications based
+        on the trigger, trigger test, or event, as pointed to by
+        entries in those tables."
+    ::= { mteObjects 1 }
+
+mteObjectsEntry OBJECT-TYPE
+    SYNTAX      MteObjectsEntry
+    MAX-ACCESS  not-accessible
+    STATUS      current
+    DESCRIPTION
+        "A group of objects.  Applications create and delete entries
+        using mteObjectsEntryStatus.
+
+        When adding objects to a notification they are added in the
+        lexical order of their index in this table.  Those associated
+        with a trigger come first, then trigger test, then event."
+    INDEX       { mteOwner, mteObjectsName, mteObjectsIndex }
+    ::= { mteObjectsTable 1 }
+
+MteObjectsEntry ::= SEQUENCE {
+    mteObjectsName                      SnmpAdminString,
+    mteObjectsIndex                     Unsigned32,
+    mteObjectsID                        OBJECT IDENTIFIER,
+    mteObjectsIDWildcard                TruthValue,
+    mteObjectsEntryStatus               RowStatus
+    }
+
+mteObjectsName OBJECT-TYPE
+    SYNTAX      SnmpAdminString (SIZE (1..32))
+    MAX-ACCESS  not-accessible
+    STATUS      current
+    DESCRIPTION
+        "A locally-unique, administratively assigned name for a group
+        of objects."
+    ::= { mteObjectsEntry 1 }
+
+mteObjectsIndex OBJECT-TYPE
+    SYNTAX      Unsigned32 (1..4294967295)
+    MAX-ACCESS  not-accessible
+    STATUS      current
+    DESCRIPTION
+        "An arbitrary integer for the purpose of identifying
+        individual objects within a mteObjectsName group.
+
+
+        Objects within a group are placed in the notification in the
+        numerical order of this index.
+
+        Groups are placed in the notification in the order of the
+        selections for overall trigger, trigger test, and event.
+        Within trigger test they are in the same order as the
+        numerical values of the bits defined for mteTriggerTest.
+
+        Bad object identifiers or a mismatch between truncating the
+        identifier and the value of mteDeltaDiscontinuityIDWildcard
+        result in operation as one would expect when providing the
+        wrong identifier to a Get operation.  The Get will fail or get
+        the wrong object.  If the object is not available it is omitted
+        from the notification."
+    ::= { mteObjectsEntry 2 }
+
+mteObjectsID OBJECT-TYPE
+    SYNTAX      OBJECT IDENTIFIER
+    MAX-ACCESS  read-create
+    STATUS      current
+    DESCRIPTION
+        "The object identifier of a MIB object to add to a
+        Notification that results from the firing of a trigger.
+
+        This may be wildcarded by truncating all or part of the
+        instance portion, in which case the instance portion of the
+        OID for obtaining this object will be the same as that used
+        in obtaining the mteTriggerValueID that fired.  If such
+        wildcarding is applied, mteObjectsIDWildcard must be
+        'true' and if not it must be 'false'.
+
+        Each instance that fills the wildcard is independent of any
+        additional instances, that is, wildcarded objects operate
+        as if there were a separate table entry for each instance
+        that fills the wildcard without having to actually predict
+        all possible instances ahead of time."
+    DEFVAL { zeroDotZero }
+    ::= { mteObjectsEntry 3 }
+
+mteObjectsIDWildcard OBJECT-TYPE
+    SYNTAX      TruthValue
+    MAX-ACCESS  read-create
+    STATUS      current
+    DESCRIPTION
+        "Control for whether mteObjectsID is to be treated as
+        fully-specified or wildcarded, with 'true' indicating wildcard."
+    DEFVAL { false }
+    ::= { mteObjectsEntry 4 }
+
+
+mteObjectsEntryStatus OBJECT-TYPE
+    SYNTAX      RowStatus
+    MAX-ACCESS  read-create
+    STATUS      current
+    DESCRIPTION
+        "The control that allows creation and deletion of entries.
+        Once made active an entry MAY not be modified except to
+        delete it."
+    ::= { mteObjectsEntry 5 }
+
+--
+-- Event Section
+--
+
+-- Counters
+
+mteEventFailures OBJECT-TYPE
+    SYNTAX      Counter32
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+        "The number of times an attempt to invoke an event
+        has failed.  This counts individually for each
+        attempt in a group of targets or each attempt for a
+        wildcarded trigger object."
+    ::= { mteEvent 1 }
+
+--
+-- Event Table
+--
+
+mteEventTable OBJECT-TYPE
+    SYNTAX      SEQUENCE OF MteEventEntry
+    MAX-ACCESS  not-accessible
+    STATUS      current
+    DESCRIPTION
+        "A table of management event action information."
+    ::= { mteEvent 2 }
+
+mteEventEntry OBJECT-TYPE
+    SYNTAX      MteEventEntry
+    MAX-ACCESS  not-accessible
+    STATUS      current
+    DESCRIPTION
+        "Information about a single event.  Applications create and
+        delete entries using mteEventEntryStatus."
+    INDEX       { mteOwner, IMPLIED mteEventName }
+    ::= { mteEventTable 1 }
+
+
+MteEventEntry ::= SEQUENCE {
+    mteEventName                        SnmpAdminString,
+    mteEventComment                     SnmpAdminString,
+    mteEventActions                     BITS,
+    mteEventEnabled                     TruthValue,
+    mteEventEntryStatus                 RowStatus
+    }
+
+mteEventName OBJECT-TYPE
+    SYNTAX      SnmpAdminString (SIZE (1..32))
+    MAX-ACCESS  not-accessible
+    STATUS      current
+    DESCRIPTION
+        "A locally-unique, administratively assigned name for the
+        event."
+    ::= { mteEventEntry 1 }
+
+mteEventComment OBJECT-TYPE
+    SYNTAX      SnmpAdminString
+    MAX-ACCESS  read-create
+    STATUS      current
+    DESCRIPTION
+        "A description of the event's function and use."
+    DEFVAL { ''H }
+    ::= { mteEventEntry 2 }
+
+mteEventActions OBJECT-TYPE
+    SYNTAX      BITS { notification(0), set(1) }
+    MAX-ACCESS  read-create
+    STATUS      current
+    DESCRIPTION
+        "The actions to perform when this event occurs.
+
+        For 'notification', Traps and/or Informs are sent according
+        to the configuration in the SNMP Notification MIB.
+
+        For 'set', an SNMP Set operation is performed according to
+        control values in this entry."
+    DEFVAL { {} }  -- No bits set.
+    ::= { mteEventEntry 3 }
+
+mteEventEnabled OBJECT-TYPE
+    SYNTAX      TruthValue
+    MAX-ACCESS  read-create
+    STATUS      current
+    DESCRIPTION
+        "A control to allow an event to be configured but not used.
+        When the value is 'false' the event does not execute even if
+
+
+        triggered."
+    DEFVAL { false }
+    ::= { mteEventEntry 4 }
+
+mteEventEntryStatus OBJECT-TYPE
+    SYNTAX      RowStatus
+    MAX-ACCESS  read-create
+    STATUS      current
+    DESCRIPTION
+        "The control that allows creation and deletion of entries.
+        Once made active an entry MAY not be modified except to
+        delete it."
+    ::= { mteEventEntry 5 }
+
+--
+-- Event Notification Table
+--
+
+mteEventNotificationTable OBJECT-TYPE
+    SYNTAX      SEQUENCE OF MteEventNotificationEntry
+    MAX-ACCESS  not-accessible
+    STATUS      current
+    DESCRIPTION
+        "A table of information about notifications to be sent as a
+        consequence of management events."
+    ::= { mteEvent 3 }
+
+mteEventNotificationEntry OBJECT-TYPE
+    SYNTAX      MteEventNotificationEntry
+    MAX-ACCESS  not-accessible
+    STATUS      current
+    DESCRIPTION
+        "Information about a single event's notification.  Entries
+        automatically exist in this this table for each mteEventEntry
+        that has 'notification' set in mteEventActions."
+    INDEX       { mteOwner, IMPLIED mteEventName }
+    ::= { mteEventNotificationTable 1 }
+
+MteEventNotificationEntry ::= SEQUENCE {
+    mteEventNotification                OBJECT IDENTIFIER,
+    mteEventNotificationObjectsOwner    SnmpAdminString,
+    mteEventNotificationObjects         SnmpAdminString
+    }
+
+mteEventNotification OBJECT-TYPE
+    SYNTAX      OBJECT IDENTIFIER
+    MAX-ACCESS  read-write
+    STATUS      current
+
+
+    DESCRIPTION
+        "The object identifier from the NOTIFICATION-TYPE for the
+        notification to use if metEventActions has 'notification' set."
+    DEFVAL { zeroDotZero }
+    ::= { mteEventNotificationEntry 1 }
+
+mteEventNotificationObjectsOwner OBJECT-TYPE
+    SYNTAX      SnmpAdminString (SIZE (0..32))
+    MAX-ACCESS  read-write
+    STATUS      current
+    DESCRIPTION
+        "To go with mteEventNotificationObjects, the mteOwner of a
+        group of objects from mteObjectsTable."
+    DEFVAL { ''H }
+    ::= { mteEventNotificationEntry 2 }
+
+mteEventNotificationObjects OBJECT-TYPE
+    SYNTAX      SnmpAdminString (SIZE (0..32))
+    MAX-ACCESS  read-write
+    STATUS      current
+    DESCRIPTION
+        "The mteObjectsName of a group of objects from
+        mteObjectsTable if mteEventActions has 'notification' set.
+        These objects are to be added to any Notification generated by
+        this event.
+
+        Objects may also be added based on the trigger that stimulated
+        the event.
+
+        A length of 0 indicates no additional objects."
+    DEFVAL { ''H }
+    ::= { mteEventNotificationEntry 3 }
+
+--
+-- Event Set Table
+--
+
+mteEventSetTable OBJECT-TYPE
+    SYNTAX      SEQUENCE OF MteEventSetEntry
+    MAX-ACCESS  not-accessible
+    STATUS      current
+    DESCRIPTION
+        "A table of management event action information."
+    ::= { mteEvent 4 }
+
+mteEventSetEntry OBJECT-TYPE
+    SYNTAX      MteEventSetEntry
+    MAX-ACCESS  not-accessible
+
+
+    STATUS      current
+    DESCRIPTION
+        "Information about a single event's set option.  Entries
+        automatically exist in this this table for each mteEventEntry
+        that has 'set' set in mteEventActions."
+    INDEX       { mteOwner, IMPLIED mteEventName }
+    ::= { mteEventSetTable 1 }
+
+MteEventSetEntry ::= SEQUENCE {
+    mteEventSetObject                   OBJECT IDENTIFIER,
+    mteEventSetObjectWildcard           TruthValue,
+    mteEventSetValue                    Integer32,
+    mteEventSetTargetTag                SnmpTagValue,
+    mteEventSetContextName              SnmpAdminString,
+    mteEventSetContextNameWildcard      TruthValue
+    }
+
+mteEventSetObject OBJECT-TYPE
+    SYNTAX      OBJECT IDENTIFIER
+    MAX-ACCESS  read-write
+    STATUS      current
+    DESCRIPTION
+        "The object identifier from the MIB object to set if
+        mteEventActions has 'set' set.
+
+        This object identifier may be wildcarded by leaving
+        sub-identifiers off the end, in which case
+        nteEventSetObjectWildCard must be 'true'.
+
+        If mteEventSetObject is wildcarded the instance used to set the
+        object to which it points is the same as the instance from the
+        value of mteTriggerValueID that triggered the event.
+
+        Each instance that fills the wildcard is independent of any
+        additional instances, that is, wildcarded objects operate
+        as if there were a separate table entry for each instance
+        that fills the wildcard without having to actually predict
+        all possible instances ahead of time.
+
+        Bad object identifiers or a mismatch between truncating the
+        identifier and the value of mteSetObjectWildcard
+        result in operation as one would expect when providing the
+        wrong identifier to a Set operation.  The Set will fail or set
+        the wrong object.  If the value syntax of the destination
+        object is not correct, the Set fails with the normal SNMP
+        error code."
+    DEFVAL { zeroDotZero }
+    ::= { mteEventSetEntry 1 }
+
+
+mteEventSetObjectWildcard OBJECT-TYPE
+    SYNTAX      TruthValue
+    MAX-ACCESS  read-write
+    STATUS      current
+    DESCRIPTION
+        "Control over whether mteEventSetObject is to be treated as
+        fully-specified or wildcarded, with 'true' indicating wildcard
+        if mteEventActions has 'set' set."
+    DEFVAL { false }
+    ::= { mteEventSetEntry 2 }
+
+mteEventSetValue OBJECT-TYPE
+    SYNTAX      Integer32
+    MAX-ACCESS  read-write
+    STATUS      current
+    DESCRIPTION
+        "The value to which to set the object at mteEventSetObject
+        if mteEventActions has 'set' set."
+    DEFVAL { 0 }
+    ::= { mteEventSetEntry 3 }
+
+mteEventSetTargetTag OBJECT-TYPE
+    SYNTAX      SnmpTagValue
+    MAX-ACCESS  read-write
+    STATUS      current
+    DESCRIPTION
+        "The tag for the target(s) at which to set the object at
+        mteEventSetObject to mteEventSetValue if mteEventActions
+        has 'set' set.
+
+        Systems limited to self management MAY reject a non-zero
+        length for the value of this object.
+
+        A length of 0 indicates the local system.  In this case,
+        access to the objects indicated by mteEventSetObject is under
+        the security credentials of the requester that set
+        mteTriggerEntryStatus to 'active'.  Those credentials are the
+        input parameters for isAccessAllowed from the Architecture for
+        Describing SNMP Management Frameworks.
+
+        Otherwise access rights are checked according to the security
+        parameters resulting from the tag."
+    DEFVAL { ''H }
+    ::= { mteEventSetEntry 4 }
+
+mteEventSetContextName OBJECT-TYPE
+    SYNTAX      SnmpAdminString
+    MAX-ACCESS  read-write
+
+
+    STATUS      current
+    DESCRIPTION
+        "The management context in which to set mteEventObjectID.
+        if mteEventActions has 'set' set.
+
+        This may be wildcarded by leaving characters off the end.  To
+        indicate such wildcarding mteEventSetContextNameWildcard must
+        be 'true'.
+
+        If this context name is wildcarded the value used to complete
+        the wildcarding of mteTriggerContextName will be appended."
+    DEFVAL { ''H }
+    ::= { mteEventSetEntry 5 }
+
+mteEventSetContextNameWildcard OBJECT-TYPE
+    SYNTAX      TruthValue
+    MAX-ACCESS  read-write
+    STATUS      current
+    DESCRIPTION
+        "Control for whether mteEventSetContextName is to be treated as
+        fully-specified or wildcarded, with 'true' indicating wildcard
+        if mteEventActions has 'set' set."
+    DEFVAL { false }
+    ::= { mteEventSetEntry 6 }
+
+--
+-- Notifications
+--
+
+dismanEventMIBNotificationPrefix OBJECT IDENTIFIER ::=
+    { dismanEventMIB 2 }
+dismanEventMIBNotifications OBJECT IDENTIFIER ::=
+    { dismanEventMIBNotificationPrefix 0 }
+dismanEventMIBNotificationObjects OBJECT IDENTIFIER
+   ::= { dismanEventMIBNotificationPrefix 1 }
+
+--
+-- Notification Objects
+--
+
+mteHotTrigger OBJECT-TYPE
+    SYNTAX      SnmpAdminString
+    MAX-ACCESS  accessible-for-notify
+    STATUS      current
+    DESCRIPTION
+        "The name of the trigger causing the notification."
+    ::= { dismanEventMIBNotificationObjects 1 }
+
+
+
+mteHotTargetName OBJECT-TYPE
+    SYNTAX      SnmpAdminString
+    MAX-ACCESS  accessible-for-notify
+    STATUS      current
+    DESCRIPTION
+        "The SNMP Target MIB's snmpTargetAddrName related to the
+        notification."
+    ::= { dismanEventMIBNotificationObjects 2 }
+
+mteHotContextName OBJECT-TYPE
+    SYNTAX      SnmpAdminString
+    MAX-ACCESS  accessible-for-notify
+    STATUS      current
+    DESCRIPTION
+        "The context name related to the notification.  This MUST be as
+        fully-qualified as possible, including filling in wildcard
+        information determined in processing."
+    ::= { dismanEventMIBNotificationObjects 3 }
+
+mteHotOID OBJECT-TYPE
+    SYNTAX      OBJECT IDENTIFIER
+    MAX-ACCESS  accessible-for-notify
+    STATUS      current
+    DESCRIPTION
+        "The object identifier of the destination object related to the
+        notification.  This MUST be as fully-qualified as possible,
+        including filling in wildcard information determined in
+        processing.
+
+        For a trigger-related notification this is from
+        mteTriggerValueID.
+
+        For a set failure this is from mteEventSetObject."
+    ::= { dismanEventMIBNotificationObjects 4 }
+
+mteHotValue OBJECT-TYPE
+    SYNTAX      Integer32
+    MAX-ACCESS  accessible-for-notify
+    STATUS      current
+    DESCRIPTION
+        "The value of the object at mteTriggerValueID when a
+        trigger fired."
+    ::= { dismanEventMIBNotificationObjects 5 }
+
+mteFailedReason OBJECT-TYPE
+    SYNTAX      FailureReason
+    MAX-ACCESS  accessible-for-notify
+    STATUS      current
+
+
+    DESCRIPTION
+        "The reason for the failure of an attempt to check for a
+        trigger condition or set an object in response to an event."
+    ::= { dismanEventMIBNotificationObjects 6 }
+
+--
+-- Notifications
+--
+
+mteTriggerFired NOTIFICATION-TYPE
+    OBJECTS { mteHotTrigger,
+              mteHotTargetName,
+              mteHotContextName,
+              mteHotOID,
+              mteHotValue }
+    STATUS  current
+    DESCRIPTION
+        "Notification that the trigger indicated by the object
+        instances has fired, for triggers with mteTriggerType
+        'boolean' or 'existence'."
+    ::= { dismanEventMIBNotifications 1 }
+
+mteTriggerRising NOTIFICATION-TYPE
+    OBJECTS { mteHotTrigger,
+              mteHotTargetName,
+              mteHotContextName,
+              mteHotOID,
+              mteHotValue }
+    STATUS  current
+    DESCRIPTION
+        "Notification that the rising threshold was met for triggers
+        with mteTriggerType 'threshold'."
+    ::= { dismanEventMIBNotifications 2 }
+
+mteTriggerFalling NOTIFICATION-TYPE
+    OBJECTS { mteHotTrigger,
+              mteHotTargetName,
+              mteHotContextName,
+              mteHotOID,
+              mteHotValue }
+    STATUS  current
+    DESCRIPTION
+        "Notification that the falling threshold was met for triggers
+        with mteTriggerType 'threshold'."
+    ::= { dismanEventMIBNotifications 3 }
+
+mteTriggerFailure NOTIFICATION-TYPE
+    OBJECTS { mteHotTrigger,
+
+
+              mteHotTargetName,
+              mteHotContextName,
+              mteHotOID,
+              mteFailedReason }
+    STATUS  current
+    DESCRIPTION
+        "Notification that an attempt to check a trigger has failed.
+
+        The network manager must enable this notification only with
+        a certain fear and trembling, as it can easily crowd out more
+        important information.  It should be used only to help diagnose
+        a problem that has appeared in the error counters and can not
+        be found otherwise."
+    ::= { dismanEventMIBNotifications 4 }
+
+mteEventSetFailure NOTIFICATION-TYPE
+    OBJECTS { mteHotTrigger,
+              mteHotTargetName,
+              mteHotContextName,
+              mteHotOID,
+              mteFailedReason }
+    STATUS  current
+    DESCRIPTION
+        "Notification that an attempt to do a set in response to an
+        event has failed.
+
+        The network manager must enable this notification only with
+        a certain fear and trembling, as it can easily crowd out more
+        important information.  It should be used only to help diagnose
+        a problem that has appeared in the error counters and can not
+        be found otherwise."
+    ::= { dismanEventMIBNotifications 5 }
+
+--
+-- Conformance
+--
+
+dismanEventMIBConformance OBJECT IDENTIFIER ::= { dismanEventMIB 3 }
+dismanEventMIBCompliances OBJECT IDENTIFIER ::=
+    { dismanEventMIBConformance 1 }
+dismanEventMIBGroups      OBJECT IDENTIFIER ::=
+    { dismanEventMIBConformance 2 }
+
+-- Compliance
+
+dismanEventMIBCompliance MODULE-COMPLIANCE
+        STATUS current
+        DESCRIPTION
+
+
+                "The compliance statement for entities which implement
+                the Event MIB."
+        MODULE  -- this module
+                MANDATORY-GROUPS {
+                        dismanEventResourceGroup,
+                        dismanEventTriggerGroup,
+                        dismanEventObjectsGroup,
+                        dismanEventEventGroup,
+                        dismanEventNotificationObjectGroup,
+                        dismanEventNotificationGroup
+                }
+
+                OBJECT mteTriggerTargetTag
+                MIN-ACCESS  read-only
+                DESCRIPTION
+                        "Write access is not required, thus limiting
+                        monitoring to the local system or pre-configured
+                        remote systems."
+
+                OBJECT mteEventSetTargetTag
+                MIN-ACCESS  read-only
+                DESCRIPTION
+                        "Write access is not required, thus limiting
+                        setting to the local system or pre-configured
+                        remote systems."
+
+                OBJECT mteTriggerValueIDWildcard
+                MIN-ACCESS  read-only
+                DESCRIPTION
+                        "Write access is not required, thus allowing
+                        the system not to implement wildcarding."
+
+                OBJECT mteTriggerContextNameWildcard
+                MIN-ACCESS  read-only
+                DESCRIPTION
+                        "Write access is not required, thus allowing
+                        the system not to implement wildcarding."
+
+
+                OBJECT mteObjectsIDWildcard
+                MIN-ACCESS  read-only
+                DESCRIPTION
+                        "Write access is not required, thus allowing
+                        the system not to implement wildcarding."
+
+                OBJECT mteEventSetContextNameWildcard
+                MIN-ACCESS  read-only
+                DESCRIPTION
+
+
+                        "Write access is not required, thus allowing
+                        the system not to implement wildcarding."
+
+        ::= { dismanEventMIBCompliances 1 }
+
+-- Units of Conformance
+
+dismanEventResourceGroup OBJECT-GROUP
+        OBJECTS {
+                mteResourceSampleMinimum,
+                mteResourceSampleInstanceMaximum,
+                mteResourceSampleInstances,
+                mteResourceSampleInstancesHigh,
+                mteResourceSampleInstanceLacks
+        }
+        STATUS current
+        DESCRIPTION
+                "Event resource status and control objects."
+        ::= { dismanEventMIBGroups 1 }
+
+dismanEventTriggerGroup OBJECT-GROUP
+        OBJECTS {
+                mteTriggerFailures,
+
+                mteTriggerComment,
+                mteTriggerTest,
+                mteTriggerSampleType,
+                mteTriggerValueID,
+                mteTriggerValueIDWildcard,
+                mteTriggerTargetTag,
+                mteTriggerContextName,
+                mteTriggerContextNameWildcard,
+                mteTriggerFrequency,
+                mteTriggerObjectsOwner,
+                mteTriggerObjects,
+                mteTriggerEnabled,
+                mteTriggerEntryStatus,
+
+                mteTriggerDeltaDiscontinuityID,
+                mteTriggerDeltaDiscontinuityIDWildcard,
+                mteTriggerDeltaDiscontinuityIDType,
+                mteTriggerExistenceTest,
+                mteTriggerExistenceStartup,
+                mteTriggerExistenceObjectsOwner,
+                mteTriggerExistenceObjects,
+                mteTriggerExistenceEventOwner,
+                mteTriggerExistenceEvent,
+
+
+
+                mteTriggerBooleanComparison,
+                mteTriggerBooleanValue,
+                mteTriggerBooleanStartup,
+                mteTriggerBooleanObjectsOwner,
+                mteTriggerBooleanObjects,
+                mteTriggerBooleanEventOwner,
+                mteTriggerBooleanEvent,
+
+                mteTriggerThresholdStartup,
+                mteTriggerThresholdObjectsOwner,
+                mteTriggerThresholdObjects,
+                mteTriggerThresholdRising,
+                mteTriggerThresholdFalling,
+                mteTriggerThresholdDeltaRising,
+                mteTriggerThresholdDeltaFalling,
+                mteTriggerThresholdRisingEventOwner,
+                mteTriggerThresholdRisingEvent,
+                mteTriggerThresholdFallingEventOwner,
+                mteTriggerThresholdFallingEvent,
+                mteTriggerThresholdDeltaRisingEventOwner,
+                mteTriggerThresholdDeltaRisingEvent,
+                mteTriggerThresholdDeltaFallingEventOwner,
+                mteTriggerThresholdDeltaFallingEvent
+        }
+        STATUS current
+        DESCRIPTION
+                "Event triggers."
+        ::= { dismanEventMIBGroups 2 }
+
+dismanEventObjectsGroup OBJECT-GROUP
+        OBJECTS {
+                mteObjectsID,
+                mteObjectsIDWildcard,
+                mteObjectsEntryStatus
+        }
+        STATUS current
+        DESCRIPTION
+                "Supplemental objects."
+        ::= { dismanEventMIBGroups 3 }
+
+dismanEventEventGroup OBJECT-GROUP
+        OBJECTS {
+                mteEventFailures,
+
+                mteEventComment,
+                mteEventActions,
+                mteEventEnabled,
+                mteEventEntryStatus,
+
+
+                mteEventNotification,
+                mteEventNotificationObjectsOwner,
+                mteEventNotificationObjects,
+
+                mteEventSetObject,
+                mteEventSetObjectWildcard,
+                mteEventSetValue,
+                mteEventSetTargetTag,
+                mteEventSetContextName,
+                mteEventSetContextNameWildcard
+        }
+        STATUS current
+        DESCRIPTION
+                "Events."
+        ::= { dismanEventMIBGroups 4 }
+
+dismanEventNotificationObjectGroup OBJECT-GROUP
+        OBJECTS {
+                mteHotTrigger,
+                mteHotTargetName,
+                mteHotContextName,
+                mteHotOID,
+                mteHotValue,
+                mteFailedReason
+        }
+        STATUS current
+        DESCRIPTION
+                "Notification objects."
+        ::= { dismanEventMIBGroups 5 }
+
+dismanEventNotificationGroup NOTIFICATION-GROUP
+        NOTIFICATIONS {
+                mteTriggerFired,
+                mteTriggerRising,
+                mteTriggerFalling,
+                mteTriggerFailure,
+                mteEventSetFailure
+        }
+        STATUS current
+        DESCRIPTION
+                "Notifications."
+        ::= { dismanEventMIBGroups 6 }
+
+END
diff -Naur tomato/release/src/router/snmp/mibs/DISMAN-SCHEDULE-MIB.txt tomato121/release/src/router/snmp/mibs/DISMAN-SCHEDULE-MIB.txt
--- tomato/release/src/router/snmp/mibs/DISMAN-SCHEDULE-MIB.txt	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/mibs/DISMAN-SCHEDULE-MIB.txt	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,699 @@
+DISMAN-SCHEDULE-MIB DEFINITIONS ::= BEGIN
+
+IMPORTS
+    MODULE-IDENTITY, OBJECT-TYPE, NOTIFICATION-TYPE,
+    Integer32, Unsigned32, Counter32, mib-2, zeroDotZero
+        FROM SNMPv2-SMI
+
+    TEXTUAL-CONVENTION,
+    DateAndTime, RowStatus, StorageType, VariablePointer
+        FROM SNMPv2-TC
+
+    MODULE-COMPLIANCE, OBJECT-GROUP, NOTIFICATION-GROUP
+        FROM SNMPv2-CONF
+
+    SnmpAdminString
+        FROM SNMP-FRAMEWORK-MIB;
+
+schedMIB MODULE-IDENTITY
+    LAST-UPDATED "200201070000Z"
+    ORGANIZATION "IETF Distributed Management Working Group"
+    CONTACT-INFO
+        "WG EMail:  disman@dorothy.bmc.com
+         Subscribe: disman-request@dorothy.bmc.com
+
+         Chair:     Randy Presuhn
+                    BMC Software, Inc.
+         Postal:    Office 1-3141
+                    2141 North First Street
+                    San Jose,  California 95131
+                    USA
+         EMail:     rpresuhn@bmc.com
+         Phone:     +1 408 546-1006
+
+         Editor:    David B. Levi
+                    Nortel Networks
+         Postal:    4401 Great America Parkway
+                    Santa Clara, CA 95052-8185
+                    USA
+         EMail:     dlevi@nortelnetworks.com
+         Phone:     +1 865 686 0432
+
+         Editor:    Juergen Schoenwaelder
+                    TU Braunschweig
+         Postal:    Bueltenweg 74/75
+                    38106 Braunschweig
+                    Germany
+         EMail:     schoenw@ibr.cs.tu-bs.de
+         Phone:     +49 531 391-3283"
+    DESCRIPTION
+        "This MIB module defines a MIB which provides mechanisms to
+         schedule SNMP set operations periodically or at specific
+         points in time."
+    REVISION    "200201070000Z"
+    DESCRIPTION
+        "Revised version, published as RFC 3231.
+
+         This revision introduces a new object type called
+         schedTriggers.  Created new conformance and compliance
+         statements that take care of the new schedTriggers object.
+
+         Several clarifications have been added to remove ambiguities
+         that were discovered and reported by implementors."
+    REVISION    "199811171800Z"
+    DESCRIPTION
+        "Initial version, published as RFC 2591."
+    ::= { mib-2 63 }
+
+--
+-- The various groups defined within this MIB definition:
+--
+
+schedObjects       OBJECT IDENTIFIER ::= { schedMIB 1 }
+schedNotifications OBJECT IDENTIFIER ::= { schedMIB 2 }
+schedConformance   OBJECT IDENTIFIER ::= { schedMIB 3 }
+
+--
+-- Textual Conventions:
+--
+
+SnmpPduErrorStatus ::= TEXTUAL-CONVENTION
+    STATUS       current
+    DESCRIPTION
+        "This TC enumerates the SNMPv1 and SNMPv2 PDU error status
+         codes as defined in RFC 1157 and RFC 1905.  It also adds a
+         pseudo error status code `noResponse' which indicates a
+         timeout condition."
+    SYNTAX      INTEGER {
+                    noResponse(-1),
+                    noError(0),
+                    tooBig(1),
+                    noSuchName(2),
+                    badValue(3),
+                    readOnly(4),
+                    genErr(5),
+                    noAccess(6),
+                    wrongType(7),
+                    wrongLength(8),
+                    wrongEncoding(9),
+                    wrongValue(10),
+                    noCreation(11),
+                    inconsistentValue(12),
+                    resourceUnavailable(13),
+                    commitFailed(14),
+                    undoFailed(15),
+                    authorizationError(16),
+                    notWritable(17),
+                    inconsistentName(18)
+                }
+
+--
+-- Some scalars which provide information about the local time zone.
+--
+
+schedLocalTime OBJECT-TYPE
+    SYNTAX      DateAndTime (SIZE (11))
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+        "The local time used by the scheduler.  Schedules which
+         refer to calendar time will use the local time indicated
+         by this object.  An implementation MUST return all 11 bytes
+         of the DateAndTime textual-convention so that a manager
+         may retrieve the offset from GMT time."
+    ::= { schedObjects 1 }
+
+--
+-- The schedule table which controls the scheduler.
+--
+
+schedTable OBJECT-TYPE
+    SYNTAX      SEQUENCE OF SchedEntry
+    MAX-ACCESS  not-accessible
+    STATUS      current
+    DESCRIPTION
+        "This table defines scheduled actions triggered by
+         SNMP set operations."
+    ::= { schedObjects 2 }
+
+schedEntry OBJECT-TYPE
+    SYNTAX      SchedEntry
+    MAX-ACCESS  not-accessible
+    STATUS      current
+    DESCRIPTION
+        "An entry describing a particular scheduled action.
+
+         Unless noted otherwise, writable objects of this row
+         can be modified independent of the current value of
+         schedRowStatus, schedAdminStatus and schedOperStatus.
+         In particular, it is legal to modify schedInterval
+         and the objects in the schedCalendarGroup when
+         schedRowStatus is active and schedAdminStatus and
+         schedOperStatus are both enabled."
+    INDEX { schedOwner, schedName }
+    ::= { schedTable 1 }
+
+SchedEntry ::= SEQUENCE {
+    schedOwner          SnmpAdminString,
+    schedName           SnmpAdminString,
+    schedDescr          SnmpAdminString,
+    schedInterval       Unsigned32,
+    schedWeekDay        BITS,
+    schedMonth          BITS,
+    schedDay            BITS,
+    schedHour           BITS,
+    schedMinute         BITS,
+    schedContextName    SnmpAdminString,
+    schedVariable       VariablePointer,
+    schedValue          Integer32,
+    schedType           INTEGER,
+    schedAdminStatus    INTEGER,
+    schedOperStatus     INTEGER,
+    schedFailures       Counter32,
+    schedLastFailure    SnmpPduErrorStatus,
+    schedLastFailed     DateAndTime,
+    schedStorageType    StorageType,
+    schedRowStatus      RowStatus,
+    schedTriggers       Counter32
+}
+
+schedOwner OBJECT-TYPE
+    SYNTAX      SnmpAdminString (SIZE(0..32))
+    MAX-ACCESS  not-accessible
+    STATUS      current
+    DESCRIPTION
+        "The owner of this scheduling entry.  The exact semantics of
+         this string are subject to the security policy defined by
+
+         the security administrator."
+    ::= { schedEntry 1 }
+
+schedName OBJECT-TYPE
+    SYNTAX      SnmpAdminString (SIZE(1..32))
+    MAX-ACCESS  not-accessible
+    STATUS      current
+    DESCRIPTION
+        "The locally-unique, administratively assigned name for this
+         scheduling entry.  This object allows a schedOwner to have
+         multiple entries in the schedTable."
+    ::= { schedEntry 2 }
+
+schedDescr OBJECT-TYPE
+    SYNTAX      SnmpAdminString
+    MAX-ACCESS  read-create
+    STATUS      current
+    DESCRIPTION
+        "The human readable description of the purpose of this
+         scheduling entry."
+    DEFVAL      { "" }
+    ::= { schedEntry 3 }
+
+schedInterval OBJECT-TYPE
+    SYNTAX      Unsigned32
+    UNITS       "seconds"
+    MAX-ACCESS  read-create
+    STATUS      current
+    DESCRIPTION
+        "The number of seconds between two action invocations of
+         a periodic scheduler.  Implementations must guarantee
+         that action invocations will not occur before at least
+         schedInterval seconds have passed.
+
+         The scheduler must ignore all periodic schedules that
+         have a schedInterval value of 0.  A periodic schedule
+         with a scheduling interval of 0 seconds will therefore
+         never invoke an action.
+
+         Implementations may be forced to delay invocations in the
+         face of local constraints.  A scheduled management function
+         should therefore not rely on the accuracy provided by the
+         scheduler implementation.
+
+         Note that implementations which maintain a list of pending
+         activations must re-calculate them when this object is
+         changed."
+    DEFVAL      { 0 }
+    ::= { schedEntry 4 }
+
+schedWeekDay OBJECT-TYPE
+    SYNTAX      BITS {
+                    sunday(0),
+                    monday(1),
+                    tuesday(2),
+                    wednesday(3),
+                    thursday(4),
+                    friday(5),
+                    saturday(6)
+                }
+    MAX-ACCESS  read-create
+    STATUS      current
+    DESCRIPTION
+        "The set of weekdays on which the scheduled action should
+         take place.  Setting multiple bits will include several
+         weekdays in the set of possible weekdays for this schedule.
+         Setting all bits will cause the scheduler to ignore the
+         weekday.
+
+         Note that implementations which maintain a list of pending
+         activations must re-calculate them when this object is
+         changed."
+    DEFVAL      { {} }
+    ::= { schedEntry 5 }
+
+schedMonth OBJECT-TYPE
+    SYNTAX      BITS {
+                    january(0),
+                    february(1),
+                    march(2),
+                    april(3),
+                    may(4),
+                    june(5),
+                    july(6),
+                    august(7),
+                    september(8),
+                    october(9),
+                    november(10),
+                    december(11)
+                }
+    MAX-ACCESS  read-create
+    STATUS      current
+    DESCRIPTION
+        "The set of months during which the scheduled action should
+         take place.  Setting multiple bits will include several
+         months in the set of possible months for this schedule.
+
+         Setting all bits will cause the scheduler to ignore the
+         month.
+
+         Note that implementations which maintain a list of pending
+         activations must re-calculate them when this object is
+         changed."
+    DEFVAL      { {} }
+    ::= { schedEntry 6 }
+
+schedDay OBJECT-TYPE
+    SYNTAX      BITS {
+                    d1(0),   d2(1),   d3(2),   d4(3),   d5(4),
+                    d6(5),   d7(6),   d8(7),   d9(8),   d10(9),
+                    d11(10), d12(11), d13(12), d14(13), d15(14),
+                    d16(15), d17(16), d18(17), d19(18), d20(19),
+                    d21(20), d22(21), d23(22), d24(23), d25(24),
+                    d26(25), d27(26), d28(27), d29(28), d30(29),
+                    d31(30),
+                    r1(31),  r2(32),  r3(33),  r4(34),  r5(35),
+                    r6(36),  r7(37),  r8(38),  r9(39),  r10(40),
+                    r11(41), r12(42), r13(43), r14(44), r15(45),
+                    r16(46), r17(47), r18(48), r19(49), r20(50),
+                    r21(51), r22(52), r23(53), r24(54), r25(55),
+                    r26(56), r27(57), r28(58), r29(59), r30(60),
+                    r31(61)
+                }
+    MAX-ACCESS  read-create
+    STATUS      current
+    DESCRIPTION
+        "The set of days in a month on which a scheduled action
+         should take place.  There are two sets of bits one can
+         use to define the day within a month:
+
+         Enumerations starting with the letter 'd' indicate a
+         day in a month relative to the first day of a month.
+         The first day of the month can therefore be specified
+         by setting the bit d1(0) and d31(30) means the last
+         day of a month with 31 days.
+
+         Enumerations starting with the letter 'r' indicate a
+         day in a month in reverse order, relative to the last
+         day of a month.  The last day in the month can therefore
+         be specified by setting the bit r1(31) and r31(61) means
+         the first day of a month with 31 days.
+
+         Setting multiple bits will include several days in the set
+         of possible days for this schedule.  Setting all bits will
+         cause the scheduler to ignore the day within a month.
+
+         Setting all bits starting with the letter 'd' or the
+         letter 'r' will also cause the scheduler to ignore the
+         day within a month.
+
+         Note that implementations which maintain a list of pending
+         activations must re-calculate them when this object is
+         changed."
+    DEFVAL      { {} }
+    ::= { schedEntry 7 }
+
+schedHour OBJECT-TYPE
+    SYNTAX      BITS {
+                    h0(0),   h1(1),   h2(2),   h3(3),   h4(4),
+                    h5(5),   h6(6),   h7(7),   h8(8),   h9(9),
+                    h10(10), h11(11), h12(12), h13(13), h14(14),
+                    h15(15), h16(16), h17(17), h18(18), h19(19),
+                    h20(20), h21(21), h22(22), h23(23)
+                }
+    MAX-ACCESS  read-create
+    STATUS      current
+    DESCRIPTION
+        "The set of hours within a day during which the scheduled
+         action should take place.
+
+         Note that implementations which maintain a list of pending
+         activations must re-calculate them when this object is
+         changed."
+    DEFVAL      { {} }
+    ::= { schedEntry 8 }
+
+schedMinute OBJECT-TYPE
+    SYNTAX      BITS {
+                    m0(0),   m1(1),   m2(2),   m3(3),   m4(4),
+                    m5(5),   m6(6),   m7(7),   m8(8),   m9(9),
+                    m10(10), m11(11), m12(12), m13(13), m14(14),
+                    m15(15), m16(16), m17(17), m18(18), m19(19),
+                    m20(20), m21(21), m22(22), m23(23), m24(24),
+                    m25(25), m26(26), m27(27), m28(28), m29(29),
+                    m30(30), m31(31), m32(32), m33(33), m34(34),
+                    m35(35), m36(36), m37(37), m38(38), m39(39),
+                    m40(40), m41(41), m42(42), m43(43), m44(44),
+                    m45(45), m46(46), m47(47), m48(48), m49(49),
+                    m50(50), m51(51), m52(52), m53(53), m54(54),
+                    m55(55), m56(56), m57(57), m58(58), m59(59)
+                }
+    MAX-ACCESS  read-create
+    STATUS      current
+    DESCRIPTION
+        "The set of minutes within an hour when the scheduled action
+         should take place.
+
+         Note that implementations which maintain a list of pending
+         activations must re-calculate them when this object is
+         changed."
+    DEFVAL      { {} }
+    ::= { schedEntry 9 }
+
+schedContextName OBJECT-TYPE
+    SYNTAX      SnmpAdminString (SIZE(0..32))
+    MAX-ACCESS  read-create
+    STATUS      current
+    DESCRIPTION
+        "The context which contains the local MIB variable pointed
+         to by schedVariable."
+    DEFVAL      { "" }
+    ::= { schedEntry 10 }
+
+schedVariable OBJECT-TYPE
+    SYNTAX      VariablePointer
+    MAX-ACCESS  read-create
+    STATUS      current
+    DESCRIPTION
+        "An object identifier pointing to a local MIB variable
+         which resolves to an ASN.1 primitive type of INTEGER."
+    DEFVAL      { zeroDotZero }
+    ::= { schedEntry 11 }
+
+schedValue OBJECT-TYPE
+    SYNTAX      Integer32
+    MAX-ACCESS  read-create
+    STATUS      current
+    DESCRIPTION
+        "The value which is written to the MIB object pointed to by
+         schedVariable when the scheduler invokes an action.  The
+         implementation shall enforce the use of access control
+         rules when performing the set operation on schedVariable.
+         This is accomplished by calling the isAccessAllowed abstract
+         service interface as defined in RFC 2571.
+
+         Note that an implementation may choose to issue an SNMP Set
+         message to the SNMP engine and leave the access control
+         decision to the normal message processing procedure."
+    DEFVAL      { 0 }
+    ::= { schedEntry 12 }
+
+schedType OBJECT-TYPE
+    SYNTAX      INTEGER {
+                    periodic(1),
+                    calendar(2),
+                    oneshot(3)
+                }
+    MAX-ACCESS  read-create
+    STATUS      current
+    DESCRIPTION
+        "The type of this schedule.  The value periodic(1) indicates
+         that this entry specifies a periodic schedule.  A periodic
+         schedule is defined by the value of schedInterval.  The
+         values of schedWeekDay, schedMonth, schedDay, schedHour
+         and schedMinute are ignored.
+
+         The value calendar(2) indicates that this entry describes a
+         calendar schedule.  A calendar schedule is defined by the
+         values of schedWeekDay, schedMonth, schedDay, schedHour and
+         schedMinute.  The value of schedInterval is ignored.  A
+         calendar schedule will trigger on all local times that
+         satisfy the bits set in schedWeekDay, schedMonth, schedDay,
+         schedHour and schedMinute.
+
+         The value oneshot(3) indicates that this entry describes a
+         one-shot schedule.  A one-shot schedule is similar to a
+         calendar schedule with the additional feature that it
+         disables itself by changing in the `finished'
+         schedOperStatus once the schedule triggers an action.
+
+         Note that implementations which maintain a list of pending
+         activations must re-calculate them when this object is
+         changed."
+    DEFVAL      { periodic }
+    ::= { schedEntry 13 }
+
+schedAdminStatus OBJECT-TYPE
+    SYNTAX      INTEGER {
+                    enabled(1),
+                    disabled(2)
+                }
+    MAX-ACCESS  read-create
+    STATUS      current
+    DESCRIPTION
+        "The desired state of the schedule."
+    DEFVAL      { disabled }
+    ::= { schedEntry 14 }
+
+schedOperStatus OBJECT-TYPE
+    SYNTAX      INTEGER {
+
+                    enabled(1),
+                    disabled(2),
+                    finished(3)
+                }
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+        "The current operational state of this schedule.  The state
+         enabled(1) indicates this entry is active and that the
+         scheduler will invoke actions at appropriate times.  The
+         disabled(2) state indicates that this entry is currently
+         inactive and ignored by the scheduler.  The finished(3)
+         state indicates that the schedule has ended.  Schedules
+         in the finished(3) state are ignored by the scheduler.
+         A one-shot schedule enters the finished(3) state when it
+         deactivates itself.
+
+         Note that the operational state must not be enabled(1)
+         when the schedRowStatus is not active."
+    ::= { schedEntry 15 }
+
+schedFailures OBJECT-TYPE
+    SYNTAX      Counter32
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+        "This variable counts the number of failures while invoking
+         the scheduled action.  This counter at most increments once
+         for a triggered action."
+    ::= { schedEntry 16 }
+
+schedLastFailure OBJECT-TYPE
+    SYNTAX      SnmpPduErrorStatus
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+        "The most recent error that occurred during the invocation of
+         a scheduled action.  The value noError(0) is returned
+         if no errors have occurred yet."
+    DEFVAL      { noError }
+    ::= { schedEntry 17 }
+
+schedLastFailed OBJECT-TYPE
+    SYNTAX      DateAndTime
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+        "The date and time when the most recent failure occurred.
+
+         The value '0000000000000000'H is returned if no failure
+         occurred since the last re-initialization of the scheduler."
+    DEFVAL      { '0000000000000000'H }
+    ::= { schedEntry 18 }
+
+schedStorageType OBJECT-TYPE
+    SYNTAX      StorageType
+    MAX-ACCESS  read-create
+    STATUS      current
+    DESCRIPTION
+        "This object defines whether this scheduled action is kept
+         in volatile storage and lost upon reboot or if this row is
+         backed up by non-volatile or permanent storage.
+
+         Conceptual rows having the value `permanent' must allow
+         write access to the columnar objects schedDescr,
+         schedInterval, schedContextName, schedVariable, schedValue,
+         and schedAdminStatus.  If an implementation supports the
+         schedCalendarGroup, write access must be also allowed to
+         the columnar objects schedWeekDay, schedMonth, schedDay,
+         schedHour, schedMinute."
+    DEFVAL      { volatile }
+    ::= { schedEntry 19 }
+
+schedRowStatus OBJECT-TYPE
+    SYNTAX      RowStatus
+    MAX-ACCESS  read-create
+    STATUS      current
+    DESCRIPTION
+        "The status of this scheduled action.  A control that allows
+         entries to be added and removed from this table.
+
+         Note that the operational state must change to enabled
+         when the administrative state is enabled and the row
+         status changes to active(1).
+
+         Attempts to destroy(6) a row or to set a row
+         notInService(2) while the operational state is enabled
+         result in inconsistentValue errors.
+
+         The value of this object has no effect on whether other
+         objects in this conceptual row can be modified."
+    ::= { schedEntry 20 }
+
+schedTriggers OBJECT-TYPE
+    SYNTAX      Counter32
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+        "This variable counts the number of attempts (either
+         successful or failed) to invoke the scheduled action."
+    ::= { schedEntry 21 }
+
+--
+-- Notifications that are emitted to indicate failures.  The
+-- definition of schedTraps makes notification registrations
+-- reversible (see STD 58, RFC 2578).
+--
+
+schedTraps OBJECT IDENTIFIER ::= { schedNotifications 0 }
+
+schedActionFailure NOTIFICATION-TYPE
+    OBJECTS     { schedLastFailure, schedLastFailed }
+    STATUS      current
+    DESCRIPTION
+        "This notification is generated whenever the invocation of a
+         scheduled action fails."
+    ::= { schedTraps 1 }
+
+-- conformance information
+
+schedCompliances OBJECT IDENTIFIER ::= { schedConformance 1 }
+schedGroups      OBJECT IDENTIFIER ::= { schedConformance 2 }
+
+-- compliance statements
+
+schedCompliance2 MODULE-COMPLIANCE
+    STATUS      current
+    DESCRIPTION
+        "The compliance statement for SNMP entities which implement
+         the scheduling MIB."
+    MODULE      -- this module
+    MANDATORY-GROUPS {
+           schedGroup2, schedNotificationsGroup
+    }
+    GROUP  schedCalendarGroup
+    DESCRIPTION
+        "The schedCalendarGroup is mandatory only for those
+         implementations that support calendar based schedules."
+    OBJECT schedType
+    DESCRIPTION
+        "The values calendar(2) or oneshot(3) are not valid for
+         implementations that do not implement the
+         schedCalendarGroup.  Such an implementation must return
+         inconsistentValue error responses for attempts to set
+         schedAdminStatus to calendar(2) or oneshot(3)."
+    ::= { schedCompliances 2 }
+
+schedGroup2 OBJECT-GROUP
+    OBJECTS {
+        schedDescr, schedInterval, schedContextName,
+        schedVariable, schedValue, schedType,
+        schedAdminStatus, schedOperStatus, schedFailures,
+        schedLastFailure, schedLastFailed, schedStorageType,
+        schedRowStatus, schedTriggers
+    }
+    STATUS      current
+    DESCRIPTION
+        "A collection of objects providing scheduling capabilities."
+    ::= { schedGroups 4 }
+
+schedCalendarGroup OBJECT-GROUP
+    OBJECTS {
+        schedLocalTime, schedWeekDay, schedMonth,
+        schedDay, schedHour, schedMinute
+    }
+    STATUS      current
+    DESCRIPTION
+        "A collection of objects providing calendar based schedules."
+    ::= { schedGroups 2 }
+
+schedNotificationsGroup NOTIFICATION-GROUP
+    NOTIFICATIONS {
+        schedActionFailure
+    }
+    STATUS      current
+    DESCRIPTION
+        "The notifications emitted by the scheduler."
+    ::= { schedGroups 3 }
+
+--
+-- Deprecated compliance and conformance group definitions
+-- from RFC 2591.
+--
+
+schedCompliance MODULE-COMPLIANCE
+    STATUS      deprecated
+    DESCRIPTION
+        "The compliance statement for SNMP entities which implement
+         the scheduling MIB."
+    MODULE      -- this module
+    MANDATORY-GROUPS {
+           schedGroup, schedNotificationsGroup
+    }
+
+    GROUP  schedCalendarGroup
+    DESCRIPTION
+        "The schedCalendarGroup is mandatory only for those
+         implementations that support calendar based schedules."
+    OBJECT schedType
+    DESCRIPTION
+        "The values calendar(2) or oneshot(3) are not valid for
+         implementations that do not implement the
+         schedCalendarGroup.  Such an implementation must return
+         inconsistentValue error responses for attempts to set
+         schedAdminStatus to calendar(2) or oneshot(3)."
+    ::= { schedCompliances 1 }
+
+schedGroup OBJECT-GROUP
+    OBJECTS {
+        schedDescr, schedInterval, schedContextName,
+        schedVariable, schedValue, schedType,
+        schedAdminStatus, schedOperStatus, schedFailures,
+        schedLastFailure, schedLastFailed, schedStorageType,
+        schedRowStatus
+    }
+    STATUS      deprecated
+    DESCRIPTION
+        "A collection of objects providing scheduling capabilities."
+    ::= { schedGroups 1 }
+
+END
diff -Naur tomato/release/src/router/snmp/mibs/DISMAN-SCRIPT-MIB.txt tomato121/release/src/router/snmp/mibs/DISMAN-SCRIPT-MIB.txt
--- tomato/release/src/router/snmp/mibs/DISMAN-SCRIPT-MIB.txt	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/mibs/DISMAN-SCRIPT-MIB.txt	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,1764 @@
+DISMAN-SCRIPT-MIB DEFINITIONS ::= BEGIN
+
+IMPORTS
+    MODULE-IDENTITY, OBJECT-TYPE, NOTIFICATION-TYPE,
+    Integer32, Unsigned32, mib-2
+        FROM SNMPv2-SMI
+
+    RowStatus, TimeInterval, DateAndTime, StorageType, DisplayString
+        FROM SNMPv2-TC
+
+    MODULE-COMPLIANCE, OBJECT-GROUP, NOTIFICATION-GROUP
+        FROM SNMPv2-CONF
+
+    SnmpAdminString
+        FROM SNMP-FRAMEWORK-MIB;
+
+scriptMIB MODULE-IDENTITY
+    LAST-UPDATED "200108210000Z"
+    ORGANIZATION "IETF Distributed Management Working Group"
+    CONTACT-INFO
+        "WG EMail:  disman@dorothy.bmc.com
+         Subscribe: disman-request@dorothy.bmc.com
+
+         Chair:     Randy Presuhn
+                    BMC Software, Inc.
+
+         Postal:    Office 1-3141
+                    2141 North First Street
+                    San Jose,  California 95131
+                    USA
+         EMail:     rpresuhn@bmc.com
+         Phone:     +1 408 546-1006
+
+         Editor:    David B. Levi
+                    Nortel Networks
+         Postal:    4401 Great America Parkway
+                    Santa Clara, CA 95052-8185
+                    USA
+         EMail:     dlevi@nortelnetworks.com
+         Phone:     +1 423 686 0432
+
+         Editor:    Juergen Schoenwaelder
+                    TU Braunschweig
+         Postal:    Bueltenweg 74/75
+                    38106 Braunschweig
+                    Germany
+         EMail:     schoenw@ibr.cs.tu-bs.de
+         Phone:     +49 531 391-3283"
+    DESCRIPTION
+        "This MIB module defines a set of objects that allow to
+         delegate management scripts to distributed managers."
+    REVISION    "200108210000Z"
+    DESCRIPTION
+        "Revised version, published as RFC 3165.
+
+         This revision introduces several new objects: smScriptError,
+         smScriptLastChange, smLaunchError, smLaunchLastChange,
+         smLaunchRowExpireTime, smRunResultTime, and smRunErrorTime.
+
+         The following existing objects were updated: the maximum
+         value of smRunLifeTime now disables the timer, an
+         autostart value was added to the smLaunchAdminStatus
+         object, and a new expired state was added to the
+         smLaunchOperStatus object.
+
+         A new smScriptException notification has been added to
+         support runtime error notifications.
+
+         Created new conformance and compliance statements that
+         take care of the new objects and notifications.
+
+         Clarifications have been added in several places to remove
+         ambiguities or contradictions that were discovered and
+         reported by implementors."
+
+    REVISION    "199902221800Z"
+    DESCRIPTION
+        "Initial version, published as RFC 2592."
+    ::= { mib-2 64 }
+
+--
+-- The groups defined within this MIB module:
+--
+
+smObjects       OBJECT IDENTIFIER ::= { scriptMIB 1 }
+smNotifications OBJECT IDENTIFIER ::= { scriptMIB 2 }
+smConformance   OBJECT IDENTIFIER ::= { scriptMIB 3 }
+
+--
+-- Script language and language extensions.
+--
+-- This group defines tables which list the languages and the
+-- language extensions supported by a Script MIB implementation.
+-- Languages are uniquely identified by object identifier values.
+--
+
+smLangTable OBJECT-TYPE
+    SYNTAX      SEQUENCE OF SmLangEntry
+    MAX-ACCESS  not-accessible
+    STATUS      current
+    DESCRIPTION
+        "This table lists supported script languages."
+    ::= { smObjects 1 }
+
+smLangEntry OBJECT-TYPE
+    SYNTAX      SmLangEntry
+    MAX-ACCESS  not-accessible
+    STATUS      current
+    DESCRIPTION
+        "An entry describing a particular language."
+    INDEX { smLangIndex }
+    ::= { smLangTable 1 }
+
+SmLangEntry ::= SEQUENCE {
+    smLangIndex         Integer32,
+    smLangLanguage      OBJECT IDENTIFIER,
+    smLangVersion       SnmpAdminString,
+    smLangVendor        OBJECT IDENTIFIER,
+    smLangRevision      SnmpAdminString,
+    smLangDescr         SnmpAdminString
+}
+
+smLangIndex OBJECT-TYPE
+    SYNTAX      Integer32 (1..2147483647)
+    MAX-ACCESS  not-accessible
+    STATUS      current
+    DESCRIPTION
+        "The locally arbitrary, but unique identifier associated
+         with this language entry.
+
+         The value is expected to remain constant at least from one
+         re-initialization of the entity's network management system
+         to the next re-initialization.
+
+         Note that the data type and the range of this object must
+         be consistent with the definition of smScriptLanguage."
+    ::= { smLangEntry 1 }
+
+smLangLanguage OBJECT-TYPE
+    SYNTAX      OBJECT IDENTIFIER
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+        "The globally unique identification of the language."
+    ::= { smLangEntry 2 }
+
+smLangVersion OBJECT-TYPE
+    SYNTAX      SnmpAdminString (SIZE (0..32))
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+        "The version number of the language. The zero-length string
+         shall be used if the language does not have a version
+         number.
+
+         It is suggested that the version number consist of one or
+         more decimal numbers separated by dots, where the first
+         number is called the major version number."
+    ::= { smLangEntry 3 }
+
+smLangVendor OBJECT-TYPE
+    SYNTAX      OBJECT IDENTIFIER
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+        "An object identifier which identifies the vendor who
+         provides the implementation of the language. This object
+         identifier SHALL point to the object identifier directly
+         below the enterprise object identifier {1 3 6 1 4 1}
+         allocated for the vendor. The value must be the object
+         identifier {0 0} if the vendor is not known."
+    ::= { smLangEntry 4 }
+
+smLangRevision OBJECT-TYPE
+    SYNTAX      SnmpAdminString (SIZE (0..32))
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+        "The version number of the language implementation.
+         The value of this object must be an empty string if
+         version number of the implementation is unknown.
+
+         It is suggested that the value consist of one or more
+         decimal numbers separated by dots, where the first
+         number is called the major version number."
+    ::= { smLangEntry 5 }
+
+smLangDescr OBJECT-TYPE
+    SYNTAX      SnmpAdminString
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+        "A textual description of the language."
+    ::= { smLangEntry 6 }
+
+smExtsnTable OBJECT-TYPE
+    SYNTAX      SEQUENCE OF SmExtsnEntry
+    MAX-ACCESS  not-accessible
+    STATUS      current
+    DESCRIPTION
+        "This table lists supported language extensions."
+    ::= { smObjects 2 }
+
+smExtsnEntry OBJECT-TYPE
+    SYNTAX      SmExtsnEntry
+    MAX-ACCESS  not-accessible
+    STATUS      current
+    DESCRIPTION
+        "An entry describing a particular language extension."
+    INDEX { smLangIndex, smExtsnIndex }
+    ::= { smExtsnTable 1 }
+
+SmExtsnEntry ::= SEQUENCE {
+    smExtsnIndex        Integer32,
+    smExtsnExtension    OBJECT IDENTIFIER,
+    smExtsnVersion      SnmpAdminString,
+    smExtsnVendor       OBJECT IDENTIFIER,
+    smExtsnRevision     SnmpAdminString,
+    smExtsnDescr        SnmpAdminString
+}
+
+smExtsnIndex OBJECT-TYPE
+    SYNTAX      Integer32 (1..2147483647)
+    MAX-ACCESS  not-accessible
+    STATUS      current
+    DESCRIPTION
+        "The locally arbitrary, but unique identifier associated
+         with this language extension entry.
+
+         The value is expected to remain constant at least from one
+         re-initialization of the entity's network management system
+         to the next re-initialization."
+    ::= { smExtsnEntry 1}
+
+smExtsnExtension OBJECT-TYPE
+    SYNTAX      OBJECT IDENTIFIER
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+        "The globally unique identification of the language
+         extension."
+    ::= { smExtsnEntry 2 }
+
+smExtsnVersion OBJECT-TYPE
+    SYNTAX      SnmpAdminString (SIZE (0..32))
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+        "The version number of the language extension.
+         It is suggested that the version number consist of one or
+         more decimal numbers separated by dots, where the first
+         number is called the major version number."
+    ::= { smExtsnEntry 3 }
+
+smExtsnVendor OBJECT-TYPE
+    SYNTAX      OBJECT IDENTIFIER
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+        "An object identifier which identifies the vendor who
+         provides the implementation of the extension. The
+         object identifier value should point to the OID node
+         directly below the enterprise OID {1 3 6 1 4 1}
+         allocated for the vendor. The value must by the object
+         identifier {0 0} if the vendor is not known."
+    ::= { smExtsnEntry 4 }
+
+smExtsnRevision OBJECT-TYPE
+    SYNTAX      SnmpAdminString (SIZE (0..32))
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+        "The version number of the extension implementation.
+         The value of this object must be an empty string if
+         version number of the implementation is unknown.
+
+         It is suggested that the value consist of one or more
+         decimal numbers separated by dots, where the first
+         number is called the major version number."
+    ::= { smExtsnEntry 5 }
+
+smExtsnDescr OBJECT-TYPE
+    SYNTAX      SnmpAdminString
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+        "A textual description of the language extension."
+    ::= { smExtsnEntry 6 }
+
+--
+-- Scripts known by the Script MIB implementation.
+--
+-- This group defines a table which lists all known scripts.
+-- Scripts can be added and removed through manipulation of the
+-- smScriptTable.
+--
+
+smScriptObjects OBJECT IDENTIFIER ::= { smObjects 3 }
+
+smScriptTable OBJECT-TYPE
+    SYNTAX      SEQUENCE OF SmScriptEntry
+    MAX-ACCESS  not-accessible
+    STATUS      current
+    DESCRIPTION
+        "This table lists and describes locally known scripts."
+    ::= { smScriptObjects 1 }
+
+smScriptEntry OBJECT-TYPE
+    SYNTAX      SmScriptEntry
+    MAX-ACCESS  not-accessible
+    STATUS      current
+    DESCRIPTION
+        "An entry describing a particular script. Every script that
+         is stored in non-volatile memory is required to appear in
+         this script table."
+    INDEX { smScriptOwner, smScriptName }
+    ::= { smScriptTable 1 }
+
+SmScriptEntry ::= SEQUENCE {
+    smScriptOwner       SnmpAdminString,
+    smScriptName        SnmpAdminString,
+    smScriptDescr       SnmpAdminString,
+    smScriptLanguage    Integer32,
+    smScriptSource      DisplayString,
+    smScriptAdminStatus INTEGER,
+    smScriptOperStatus  INTEGER,
+    smScriptStorageType StorageType,
+    smScriptRowStatus   RowStatus,
+    smScriptError       SnmpAdminString,
+    smScriptLastChange  DateAndTime
+}
+
+smScriptOwner OBJECT-TYPE
+    SYNTAX      SnmpAdminString (SIZE (0..32))
+    MAX-ACCESS  not-accessible
+    STATUS      current
+    DESCRIPTION
+        "The manager who owns this row in the smScriptTable."
+    ::= { smScriptEntry 1 }
+
+smScriptName OBJECT-TYPE
+    SYNTAX      SnmpAdminString (SIZE (1..32))
+    MAX-ACCESS  not-accessible
+    STATUS      current
+    DESCRIPTION
+        "The locally-unique, administratively assigned name for this
+         script. This object allows an smScriptOwner to have multiple
+         entries in the smScriptTable.
+
+         This value of this object may be used to derive the name
+         (e.g. a file name) which is used by the Script MIB
+         implementation to access the script in non-volatile
+         storage. The details of this mapping are implementation
+         specific. However, the mapping needs to ensure that scripts
+         created by different owners with the same script name do not
+         map to the same name in non-volatile storage."
+    ::= { smScriptEntry 2 }
+
+smScriptDescr OBJECT-TYPE
+    SYNTAX      SnmpAdminString
+    MAX-ACCESS  read-create
+    STATUS      current
+    DESCRIPTION
+        "A description of the purpose of the script."
+    ::= { smScriptEntry 3 }
+
+smScriptLanguage OBJECT-TYPE
+    SYNTAX      Integer32 (0..2147483647)
+    MAX-ACCESS  read-create
+    STATUS      current
+    DESCRIPTION
+        "The value of this object type identifies an entry in the
+         smLangTable which is used to execute this script.
+         The special value 0 may be used by hard-wired scripts
+         that can not be modified and that are executed by
+         internal functions.
+
+         Set requests to change this object are invalid if the
+         value of smScriptOperStatus is `enabled' or `compiling'
+         and will result in an inconsistentValue error.
+
+         Note that the data type and the range of this object must
+         be consistent with the definition of smLangIndex."
+    ::= { smScriptEntry 4 }
+
+smScriptSource OBJECT-TYPE
+    SYNTAX      DisplayString
+    MAX-ACCESS  read-create
+    STATUS      current
+    DESCRIPTION
+        "This object either contains a reference to the script
+         source or an empty string. A reference must be given
+         in the form of a Uniform Resource Locator (URL) as
+         defined in RFC 2396. The allowed character sets and the
+         encoding rules defined in RFC 2396 section 2 apply.
+
+         When the smScriptAdminStatus object is set to `enabled',
+         the Script MIB implementation will `pull' the script
+         source from the URL contained in this object if the URL
+         is not empty.
+
+         An empty URL indicates that the script source is loaded
+         from local storage. The script is read from the smCodeTable
+         if the value of smScriptStorageType is volatile. Otherwise,
+         the script is read from non-volatile storage.
+
+         Note: This document does not mandate implementation of any
+         specific URL scheme. An attempt to load a script from a
+         nonsupported URL scheme will cause the smScriptOperStatus
+         to report an `unknownProtocol' error.
+
+         Set requests to change this object are invalid if the
+         value of smScriptOperStatus is `enabled', `editing',
+         `retrieving' or `compiling' and will result in an
+         inconsistentValue error."
+    DEFVAL { ''H }
+    ::= { smScriptEntry 5 }
+
+smScriptAdminStatus OBJECT-TYPE
+    SYNTAX      INTEGER {
+                    enabled(1),
+                    disabled(2),
+                    editing(3)
+                }
+    MAX-ACCESS  read-create
+    STATUS      current
+    DESCRIPTION
+        "The value of this object indicates the desired status of
+         the script. See the definition of smScriptOperStatus for
+         a description of the values.
+
+         When the smScriptAdminStatus object is set to `enabled' and
+         the smScriptOperStatus is `disabled' or one of the error
+         states, the Script MIB implementation will `pull' the script
+         source from the URL contained in the smScriptSource object
+         if the URL is not empty."
+    DEFVAL { disabled }
+    ::= { smScriptEntry 6 }
+
+smScriptOperStatus OBJECT-TYPE
+    SYNTAX      INTEGER {
+                    enabled(1),
+                    disabled(2),
+                    editing(3),
+                    retrieving(4),
+                    compiling(5),
+                    noSuchScript(6),
+                    accessDenied(7),
+                    wrongLanguage(8),
+                    wrongVersion(9),
+                    compilationFailed(10),
+                    noResourcesLeft(11),
+                    unknownProtocol(12),
+                    protocolFailure(13),
+                    genericError(14)
+                }
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+        "The actual status of the script in the runtime system. The
+         value of this object is only meaningful when the value of
+         the smScriptRowStatus object is `active'.
+
+         The smScriptOperStatus object may have the following values:
+
+         - `enabled' indicates that the script is available and can
+            be started by a launch table entry.
+
+         - `disabled' indicates that the script can not be used.
+
+         - `editing' indicates that the script can be modified in the
+           smCodeTable.
+
+         - `retrieving' indicates that the script is currently being
+           loaded from non-volatile storage or a remote system.
+
+         - `compiling' indicates that the script is currently being
+           compiled by the runtime system.
+
+         - `noSuchScript' indicates that the script does not exist
+           at the smScriptSource.
+
+         - `accessDenied' indicates that the script can not be loaded
+           from the smScriptSource due to a lack of permissions.
+
+         - `wrongLanguage' indicates that the script can not be
+            loaded from the smScriptSource because of a language
+            mismatch.
+
+         - `wrongVersion' indicates that the script can not be loaded
+           from the smScriptSource because of a language version
+           mismatch.
+
+         - `compilationFailed' indicates that the compilation failed.
+
+         - `noResourcesLeft' indicates that the runtime system does
+           not have enough resources to load the script.
+
+         - `unknownProtocol' indicates that the script could not be
+           loaded from the smScriptSource because the requested
+           protocol is not supported.
+
+         - `protocolFailure' indicates that the script could not be
+           loaded from the smScriptSource because of a protocol
+           failure.
+
+         - `genericError' indicates that the script could not be
+
+           loaded due to an error condition not listed above.
+
+         The `retrieving' and `compiling' states are transient states
+         which will either lead to one of the error states or the
+         `enabled' state. The `disabled' and `editing' states are
+         administrative states which are only reached by explicit
+         management operations.
+
+         All launch table entries that refer to this script table
+         entry shall have an smLaunchOperStatus value of `disabled'
+         when the value of this object is not `enabled'."
+    DEFVAL { disabled }
+    ::= { smScriptEntry 7 }
+
+smScriptStorageType OBJECT-TYPE
+    SYNTAX      StorageType
+    MAX-ACCESS  read-create
+    STATUS      current
+    DESCRIPTION
+        "This object defines whether this row and the script
+         controlled by this row are kept in volatile storage and
+         lost upon reboot or if this row is backed up by
+         non-volatile or permanent storage.
+
+         The storage type of this row always complies with the value
+         of this entry if the value of the corresponding RowStatus
+         object is `active'.
+
+         However, the storage type of the script controlled by this
+         row may be different, if the value of this entry is
+         `non-volatile'. The script controlled by this row is written
+         into local non-volatile storage if the following condition
+         becomes true:
+
+         (a) the URL contained in the smScriptSource object is empty
+             and
+         (b) the smScriptStorageType is `nonVolatile'
+             and
+         (c) the smScriptOperStatus is `enabled'
+
+         Setting this object to `volatile' removes a script from
+         non-volatile storage if the script controlled by this row
+         has been in non-volatile storage before. Attempts to set
+         this object to permanent will always fail with an
+         inconsistentValue error.
+
+         The value of smScriptStorageType is only meaningful if the
+         value of the corresponding RowStatus object is `active'.
+
+         If smScriptStorageType has the value permanent(4), then all
+         objects whose MAX-ACCESS value is read-create must be
+         writable, with the exception of the smScriptStorageType and
+         smScriptRowStatus objects, which shall be read-only."
+    DEFVAL { volatile }
+    ::= { smScriptEntry 8 }
+
+smScriptRowStatus OBJECT-TYPE
+    SYNTAX      RowStatus
+    MAX-ACCESS  read-create
+    STATUS      current
+    DESCRIPTION
+        "A control that allows entries to be added and removed from
+         this table.
+
+         Changing the smScriptRowStatus from `active' to
+         `notInService' will remove the associated script from the
+         runtime system.
+
+         Deleting conceptual rows from this table may affect the
+         deletion of other resources associated with this row. For
+         example, a script stored in non-volatile storage may be
+         removed from non-volatile storage.
+
+         An entry may not exist in the `active' state unless all
+         required objects in the entry have appropriate values. Rows
+         that are not complete or not in service are not known by the
+         script runtime system.
+
+         Attempts to `destroy' a row or to set a row `notInService'
+         while the smScriptOperStatus is `enabled' will result in an
+         inconsistentValue error.
+
+         Attempts to `destroy' a row or to set a row `notInService'
+         where the value of the smScriptStorageType object is
+         `permanent' or `readOnly' will result in an
+         inconsistentValue error.
+
+         The value of this object has no effect on whether other
+         objects in this conceptual row can be modified."
+    ::= { smScriptEntry 9 }
+
+smScriptError OBJECT-TYPE
+    SYNTAX      SnmpAdminString
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+        "This object contains a descriptive error message if the
+
+         transition into the operational status `enabled' failed.
+         Implementations must reset the error message to a
+         zero-length string when a new attempt to change the
+         script status to `enabled' is started."
+    DEFVAL { ''H }
+    ::= { smScriptEntry 10 }
+
+smScriptLastChange OBJECT-TYPE
+    SYNTAX      DateAndTime
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+        "The date and time when this script table entry was last
+         modified. The value '0000000000000000'H is returned if
+         the script table entry has not yet been modified.
+
+         Note that the resetting of smScriptError is not considered
+         a change of the script table entry."
+    DEFVAL { '0000000000000000'H }
+    ::= { smScriptEntry 11 }
+
+--
+-- Access to script code via SNMP
+--
+-- The smCodeTable allows script code to be read and modified
+-- via SNMP.
+--
+
+smCodeTable OBJECT-TYPE
+    SYNTAX      SEQUENCE OF SmCodeEntry
+    MAX-ACCESS  not-accessible
+    STATUS      current
+    DESCRIPTION
+        "This table contains the script code for scripts that are
+         written via SNMP write operations."
+    ::= { smScriptObjects 2 }
+
+smCodeEntry OBJECT-TYPE
+    SYNTAX      SmCodeEntry
+    MAX-ACCESS  not-accessible
+    STATUS      current
+    DESCRIPTION
+        "An entry describing a particular fragment of a script."
+    INDEX { smScriptOwner, smScriptName, smCodeIndex }
+    ::= { smCodeTable 1 }
+
+SmCodeEntry ::= SEQUENCE {
+    smCodeIndex         Unsigned32,
+    smCodeText          OCTET STRING,
+    smCodeRowStatus     RowStatus
+}
+
+smCodeIndex OBJECT-TYPE
+    SYNTAX      Unsigned32 (1..4294967295)
+    MAX-ACCESS  not-accessible
+    STATUS      current
+    DESCRIPTION
+        "The index value identifying this code fragment."
+    ::= { smCodeEntry 1 }
+
+smCodeText OBJECT-TYPE
+    SYNTAX      OCTET STRING (SIZE (1..1024))
+    MAX-ACCESS  read-create
+    STATUS      current
+    DESCRIPTION
+        "The code that makes up a fragment of a script. The format
+         of this code fragment depends on the script language which
+         is identified by the associated smScriptLanguage object."
+    ::= { smCodeEntry 2 }
+
+smCodeRowStatus OBJECT-TYPE
+    SYNTAX      RowStatus
+    MAX-ACCESS  read-create
+    STATUS      current
+    DESCRIPTION
+        "A control that allows entries to be added and removed from
+         this table.
+
+         The value of this object has no effect on whether other
+         objects in this conceptual row can be modified."
+    ::= { smCodeEntry 3 }
+
+--
+-- Script execution.
+--
+-- This group defines tables which allow script execution to be
+-- initiated, suspended, resumed, and terminated.  It also provides
+-- a mechanism for keeping a history of recent script executions
+-- and their results.
+--
+
+smRunObjects OBJECT IDENTIFIER ::= { smObjects 4 }
+
+smLaunchTable OBJECT-TYPE
+    SYNTAX      SEQUENCE OF SmLaunchEntry
+    MAX-ACCESS  not-accessible
+    STATUS      current
+    DESCRIPTION
+        "This table lists and describes scripts that are ready
+         to be executed together with their parameters."
+    ::= { smRunObjects 1 }
+
+smLaunchEntry OBJECT-TYPE
+    SYNTAX      SmLaunchEntry
+    MAX-ACCESS  not-accessible
+    STATUS      current
+    DESCRIPTION
+        "An entry describing a particular executable script."
+    INDEX { smLaunchOwner, smLaunchName }
+    ::= { smLaunchTable 1 }
+
+SmLaunchEntry ::= SEQUENCE {
+    smLaunchOwner               SnmpAdminString,
+    smLaunchName                SnmpAdminString,
+    smLaunchScriptOwner         SnmpAdminString,
+    smLaunchScriptName          SnmpAdminString,
+    smLaunchArgument            OCTET STRING,
+    smLaunchMaxRunning          Unsigned32,
+    smLaunchMaxCompleted        Unsigned32,
+    smLaunchLifeTime            TimeInterval,
+    smLaunchExpireTime          TimeInterval,
+    smLaunchStart               Integer32,
+    smLaunchControl             INTEGER,
+    smLaunchAdminStatus         INTEGER,
+    smLaunchOperStatus          INTEGER,
+    smLaunchRunIndexNext        Integer32,
+    smLaunchStorageType         StorageType,
+    smLaunchRowStatus           RowStatus,
+    smLaunchError               SnmpAdminString,
+    smLaunchLastChange          DateAndTime,
+    smLaunchRowExpireTime       TimeInterval
+}
+
+smLaunchOwner OBJECT-TYPE
+    SYNTAX      SnmpAdminString (SIZE (0..32))
+    MAX-ACCESS  not-accessible
+    STATUS      current
+    DESCRIPTION
+        "The manager who owns this row in the smLaunchTable. Every
+         instance of a running script started from a particular entry
+         in the smLaunchTable (i.e. entries in the smRunTable) will
+         be owned by the same smLaunchOwner used to index the entry
+         in the smLaunchTable. This owner is not necessarily the same
+         as the owner of the script itself (smLaunchScriptOwner)."
+    ::= { smLaunchEntry 1 }
+
+smLaunchName OBJECT-TYPE
+    SYNTAX      SnmpAdminString (SIZE (1..32))
+    MAX-ACCESS  not-accessible
+    STATUS      current
+    DESCRIPTION
+        "The locally-unique, administratively assigned name for this
+         launch table entry. This object allows an smLaunchOwner to
+         have multiple entries in the smLaunchTable. The smLaunchName
+         is an arbitrary name that must be different from any other
+         smLaunchTable entries with the same smLaunchOwner but can be
+         the same as other entries in the smLaunchTable with
+         different smLaunchOwner values. Note that the value of
+         smLaunchName is not related in any way to the name of the
+         script being launched."
+    ::= { smLaunchEntry 2 }
+
+smLaunchScriptOwner OBJECT-TYPE
+    SYNTAX      SnmpAdminString (SIZE (0..32))
+    MAX-ACCESS  read-create
+    STATUS      current
+    DESCRIPTION
+        "The value of this object in combination with the value of
+         smLaunchScriptName identifies the script that can be
+         launched from this smLaunchTable entry. Attempts to write
+         this object will fail with an inconsistentValue error if
+         the value of smLaunchOperStatus is `enabled'."
+    ::= { smLaunchEntry 3 }
+
+smLaunchScriptName OBJECT-TYPE
+    SYNTAX      SnmpAdminString (SIZE (0..32))
+    MAX-ACCESS  read-create
+    STATUS      current
+    DESCRIPTION
+        "The value of this object in combination with the value of
+         the smLaunchScriptOwner identifies the script that can be
+         launched from this smLaunchTable entry. The zero-length
+         string may be used to point to a non-existing script.
+
+         Attempts to write this object will fail with an
+         inconsistentValue error if the value of smLaunchOperStatus
+         is `enabled'."
+    DEFVAL { ''H }
+    ::= { smLaunchEntry 4 }
+
+smLaunchArgument OBJECT-TYPE
+    SYNTAX      OCTET STRING
+    MAX-ACCESS  read-create
+    STATUS      current
+    DESCRIPTION
+        "The argument supplied to the script. When a script is
+         invoked, the value of this object is used to initialize
+         the smRunArgument object."
+    DEFVAL { ''H }
+    ::= { smLaunchEntry 5 }
+
+smLaunchMaxRunning OBJECT-TYPE
+    SYNTAX      Unsigned32 (1..4294967295)
+    MAX-ACCESS  read-create
+    STATUS      current
+    DESCRIPTION
+        "The maximum number of concurrently running scripts that may
+         be invoked from this entry in the smLaunchTable. Lowering
+         the current value of this object does not affect any scripts
+         that are already executing."
+    DEFVAL { 1 }
+    ::= { smLaunchEntry 6 }
+
+smLaunchMaxCompleted OBJECT-TYPE
+    SYNTAX      Unsigned32 (1..4294967295)
+    MAX-ACCESS  read-create
+    STATUS      current
+    DESCRIPTION
+        "The maximum number of finished scripts invoked from this
+         entry in the smLaunchTable allowed to be retained in the
+         smRunTable. Whenever the value of this object is changed
+         and whenever a script terminates, entries in the smRunTable
+         are deleted if necessary until the number of completed
+         scripts is smaller than the value of this object. Scripts
+         whose smRunEndTime value indicates the oldest completion
+         time are deleted first."
+    DEFVAL { 1 }
+    ::= { smLaunchEntry 7 }
+
+smLaunchLifeTime OBJECT-TYPE
+    SYNTAX      TimeInterval
+    UNITS       "centi-seconds"
+    MAX-ACCESS  read-create
+    STATUS      current
+    DESCRIPTION
+        "The default maximum amount of time a script launched
+         from this entry may run. The value of this object is used
+         to initialize the smRunLifeTime object when a script is
+         launched. Changing the value of an smLaunchLifeTime
+         instance does not affect scripts previously launched from
+
+         this entry."
+    DEFVAL { 360000 }
+    ::= { smLaunchEntry 8 }
+
+smLaunchExpireTime OBJECT-TYPE
+    SYNTAX      TimeInterval
+    UNITS       "centi-seconds"
+    MAX-ACCESS  read-create
+    STATUS      current
+    DESCRIPTION
+        "The default maximum amount of time information about a
+         script launched from this entry is kept in the smRunTable
+         after the script has completed execution.  The value of
+         this object is used to initialize the smRunExpireTime
+         object when a script is launched. Changing the value of an
+         smLaunchExpireTime instance does not affect scripts
+         previously launched from this entry."
+    DEFVAL { 360000 }
+    ::= { smLaunchEntry 9 }
+
+smLaunchStart OBJECT-TYPE
+    SYNTAX      Integer32 (0..2147483647)
+    MAX-ACCESS  read-create
+    STATUS      current
+    DESCRIPTION
+        "This object is used to start the execution of scripts.
+         When retrieved, the value will be the value of smRunIndex
+         for the last script that started execution by manipulating
+         this object. The value will be zero if no script started
+         execution yet.
+
+         A script is started by setting this object to an unused
+         smRunIndex value. A new row in the smRunTable will be
+         created which is indexed by the value supplied by the
+         set-request in addition to the value of smLaunchOwner and
+         smLaunchName. An unused value can be obtained by reading
+         the smLaunchRunIndexNext object.
+
+         Setting this object to the special value 0 will start
+         the script with a self-generated smRunIndex value. The
+         consequence is that the script invoker has no reliable
+         way to determine the smRunIndex value for this script
+         invocation and that the invoker has therefore no way
+         to obtain the results from this script invocation. The
+         special value 0 is however useful for scheduled script
+         invocations.
+
+         If this object is set, the following checks must be
+
+         performed:
+
+         1) The value of the smLaunchOperStatus object in this
+            entry of the smLaunchTable must be `enabled'.
+         2) The values of smLaunchScriptOwner and
+            smLaunchScriptName of this row must identify an
+            existing entry in the smScriptTable.
+         3) The value of smScriptOperStatus of this entry must
+            be `enabled'.
+         4) The principal performing the set operation must have
+            read access to the script. This must be checked by
+            calling the isAccessAllowed abstract service interface
+            defined in RFC 2271 on the row in the smScriptTable
+            identified by smLaunchScriptOwner and smLaunchScriptName.
+            The isAccessAllowed abstract service interface must be
+            called on all columnar objects in the smScriptTable with
+            a MAX-ACCESS value different than `not-accessible'. The
+            test fails as soon as a call indicates that access is
+            not allowed.
+         5) If the value provided by the set operation is not 0,
+            a check must be made that the value is currently not
+            in use. Otherwise, if the value provided by the set
+            operation is 0, a suitable unused value must be
+            generated.
+         6) The number of currently executing scripts invoked
+            from this smLaunchTable entry must be less than
+            smLaunchMaxRunning.
+
+         Attempts to start a script will fail with an
+         inconsistentValue error if one of the checks described
+         above fails.
+
+         Otherwise, if all checks have been passed, a new entry
+         in the smRunTable will be created indexed by smLaunchOwner,
+         smLaunchName and the new value for smRunIndex. The value
+         of smLaunchArgument will be copied into smRunArgument,
+         the value of smLaunchLifeTime will be copied to
+         smRunLifeTime, and the value of smLaunchExpireTime
+         will be copied to smRunExpireTime.
+
+         The smRunStartTime will be set to the current time and
+         the smRunState will be set to `initializing' before the
+         script execution is initiated in the appropriate runtime
+         system.
+
+         Note that the data type and the range of this object must
+         be consistent with the smRunIndex object. Since this
+         object might be written from the scheduling MIB, the
+
+         data type Integer32 rather than Unsigned32 is used."
+    DEFVAL { 0 }
+    ::= { smLaunchEntry 10 }
+
+smLaunchControl OBJECT-TYPE
+    SYNTAX      INTEGER {
+                    abort(1),
+                    suspend(2),
+                    resume(3),
+                    nop(4)
+                }
+    MAX-ACCESS  read-create
+    STATUS      current
+    DESCRIPTION
+        "This object is used to request a state change for all
+         running scripts in the smRunTable that were started from
+         this row in the smLaunchTable.
+
+         Setting this object to abort(1), suspend(2) or resume(3)
+         will set the smRunControl object of all applicable rows
+         in the smRunTable to abort(1), suspend(2) or resume(3)
+         respectively. The phrase `applicable rows' means the set of
+         rows which were created from this entry in the smLaunchTable
+         and whose value of smRunState allows the corresponding
+         state change as described in the definition of the
+         smRunControl object. Setting this object to nop(4) has no
+         effect.
+
+         Attempts to set this object lead to an inconsistentValue
+         error only if all implicated sets on all the applicable
+         rows lead to inconsistentValue errors. It is not allowed
+         to return an inconsistentValue error if at least one state
+         change on one of the applicable rows was successful."
+    DEFVAL { nop }
+    ::= { smLaunchEntry 11 }
+
+smLaunchAdminStatus OBJECT-TYPE
+    SYNTAX      INTEGER {
+                    enabled(1),
+                    disabled(2),
+                    autostart(3)
+                }
+    MAX-ACCESS  read-create
+    STATUS      current
+    DESCRIPTION
+        "The value of this object indicates the desired status of
+         this launch table entry. The values enabled(1) and
+         autostart(3) both indicate that the launch table entry
+
+         should transition into the operational enabled(1) state as
+         soon as the associated script table entry is enabled(1).
+
+         The value autostart(3) further indicates that the script
+         is started automatically by conceptually writing the
+         value 0 into the associated smLaunchStart object during
+         the transition from the `disabled' into the `enabled'
+         operational state. This is useful for scripts that are
+         to be launched on system start-up."
+    DEFVAL { disabled }
+    ::= { smLaunchEntry 12 }
+
+smLaunchOperStatus OBJECT-TYPE
+    SYNTAX      INTEGER {
+                    enabled(1),
+                    disabled(2),
+                    expired(3)
+                }
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+        "The value of this object indicates the actual status of
+         this launch table entry.  The smLaunchOperStatus object
+         may have the following values:
+
+         - `enabled' indicates that the launch table entry is
+           available and can be used to start scripts.
+
+         - `disabled' indicates that the launch table entry can
+           not be used to start scripts.
+
+         - `expired' indicates that the launch table entry can
+           not be used to start scripts and will disappear as
+           soon as all smRunTable entries associated with this
+           launch table entry have disappeared.
+
+         The value `enabled' requires that the smLaunchRowStatus
+         object is active. The value `disabled' requires that there
+         are no entries in the smRunTable associated with this
+         smLaunchTable entry."
+    DEFVAL { disabled }
+    ::= { smLaunchEntry 13 }
+
+smLaunchRunIndexNext OBJECT-TYPE
+    SYNTAX      Integer32 (1..2147483647)
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+        "This variable is used for creating rows in the smRunTable.
+         The value of this variable is a currently unused value
+         for smRunIndex, which can be written into the smLaunchStart
+         object associated with this row to launch a script.
+
+         The value returned when reading this variable must be unique
+         for the smLaunchOwner and smLaunchName associated with this
+         row. Subsequent attempts to read this variable must return
+         different values.
+
+         This variable will return the special value 0 if no new rows
+         can be created.
+
+         Note that the data type and the range of this object must be
+         consistent with the definition of smRunIndex."
+    ::= { smLaunchEntry 14 }
+
+smLaunchStorageType OBJECT-TYPE
+    SYNTAX      StorageType
+    MAX-ACCESS  read-create
+    STATUS      current
+    DESCRIPTION
+        "This object defines if this row is kept in volatile storage
+         and lost upon reboot or if this row is backed up by stable
+         storage.
+
+         The value of smLaunchStorageType is only meaningful if the
+         value of the corresponding RowStatus object is active.
+
+         If smLaunchStorageType has the value permanent(4), then all
+         objects whose MAX-ACCESS value is read-create must be
+         writable, with the exception of the smLaunchStorageType and
+         smLaunchRowStatus objects, which shall be read-only."
+    DEFVAL { volatile }
+    ::= { smLaunchEntry 15 }
+
+smLaunchRowStatus OBJECT-TYPE
+    SYNTAX      RowStatus
+    MAX-ACCESS  read-create
+    STATUS      current
+    DESCRIPTION
+        "A control that allows entries to be added and removed from
+         this table.
+
+         Attempts to `destroy' a row or to set a row `notInService'
+         while the smLaunchOperStatus is `enabled' will result in
+         an inconsistentValue error.
+
+         Attempts to `destroy' a row or to set a row `notInService'
+         where the value of the smLaunchStorageType object is
+         `permanent' or `readOnly' will result in an
+         inconsistentValue error.
+
+         The value of this object has no effect on whether other
+         objects in this conceptual row can be modified."
+    ::= { smLaunchEntry 16 }
+
+smLaunchError OBJECT-TYPE
+    SYNTAX      SnmpAdminString
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+        "This object contains a descriptive error message if an
+         attempt to launch a script fails. Implementations must reset
+         the error message to a zero-length string when a new attempt
+         to launch a script is started."
+    DEFVAL { ''H }
+    ::= { smLaunchEntry 17 }
+
+smLaunchLastChange OBJECT-TYPE
+    SYNTAX      DateAndTime
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+        "The date and time when this launch table entry was last
+         modified. The value '0000000000000000'H is returned if
+         the launch table entry has not yet been modified.
+
+         Note that a change of smLaunchStart, smLaunchControl,
+         smLaunchRunIndexNext, smLaunchRowExpireTime, or the
+         resetting of smLaunchError is not considered a change
+         of this launch table entry."
+    DEFVAL { '0000000000000000'H }
+    ::= { smLaunchEntry 18 }
+
+smLaunchRowExpireTime OBJECT-TYPE
+    SYNTAX      TimeInterval
+    UNITS       "centi-seconds"
+    MAX-ACCESS  read-create
+    STATUS      current
+    DESCRIPTION
+        "The value of this object specifies how long this row remains
+         in the `enabled' or `disabled' operational state. The value
+         reported by this object ticks backwards. When the value
+         reaches 0, it stops ticking backward and the row is
+         deleted if there are no smRunTable entries associated with
+
+         this smLaunchTable entry. Otherwise, the smLaunchOperStatus
+         changes to `expired' and the row deletion is deferred
+         until there are no smRunTable entries associated with this
+         smLaunchTable entry.
+
+         The smLaunchRowExpireTime will not tick backwards if it is
+         set to its maximum value (2147483647). In other words,
+         setting this object to its maximum value turns the timer
+         off.
+
+         The value of this object may be set in order to increase
+         or reduce the remaining time that the launch table entry
+         may be used. Setting the value to 0 will cause an immediate
+         row deletion or transition into the `expired' operational
+         state.
+
+         It is not possible to set this object while the operational
+         status is `expired'. Attempts to modify this object while
+         the operational status is `expired' leads to an
+         inconsistentValue error.
+
+         Note that the timer ticks backwards independent of the
+         operational state of the launch table entry."
+    DEFVAL { 2147483647 }
+    ::= { smLaunchEntry 19 }
+
+smRunTable OBJECT-TYPE
+    SYNTAX      SEQUENCE OF SmRunEntry
+    MAX-ACCESS  not-accessible
+    STATUS      current
+    DESCRIPTION
+        "This table lists and describes scripts that are currently
+         running or have been running in the past."
+    ::= { smRunObjects 2 }
+
+smRunEntry OBJECT-TYPE
+    SYNTAX      SmRunEntry
+    MAX-ACCESS  not-accessible
+    STATUS      current
+    DESCRIPTION
+        "An entry describing a particular running or finished
+         script."
+    INDEX { smLaunchOwner, smLaunchName, smRunIndex }
+    ::= { smRunTable 1 }
+
+SmRunEntry ::= SEQUENCE {
+    smRunIndex          Integer32,
+    smRunArgument       OCTET STRING,
+    smRunStartTime      DateAndTime,
+    smRunEndTime        DateAndTime,
+    smRunLifeTime       TimeInterval,
+    smRunExpireTime     TimeInterval,
+    smRunExitCode       INTEGER,
+    smRunResult         OCTET STRING,
+    smRunControl        INTEGER,
+    smRunState          INTEGER,
+    smRunError          SnmpAdminString,
+    smRunResultTime     DateAndTime,
+    smRunErrorTime      DateAndTime
+}
+
+smRunIndex OBJECT-TYPE
+    SYNTAX      Integer32 (1..2147483647)
+    MAX-ACCESS  not-accessible
+    STATUS      current
+    DESCRIPTION
+        "The locally arbitrary, but unique identifier associated
+         with this running or finished script. This value must be
+         unique for all rows in the smRunTable with the same
+         smLaunchOwner and smLaunchName.
+
+         Note that the data type and the range of this object must
+         be consistent with the definition of smLaunchRunIndexNext
+         and smLaunchStart."
+    ::= { smRunEntry 1 }
+
+smRunArgument OBJECT-TYPE
+    SYNTAX      OCTET STRING
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+        "The argument supplied to the script when it started."
+    DEFVAL { ''H }
+    ::= { smRunEntry 2 }
+
+smRunStartTime OBJECT-TYPE
+    SYNTAX      DateAndTime
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+        "The date and time when the execution started. The value
+         '0000000000000000'H is returned if the script has not
+         started yet."
+    DEFVAL { '0000000000000000'H }
+    ::= { smRunEntry 3 }
+
+smRunEndTime OBJECT-TYPE
+    SYNTAX      DateAndTime
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+        "The date and time when the execution terminated. The value
+         '0000000000000000'H is returned if the script has not
+         terminated yet."
+    DEFVAL { '0000000000000000'H }
+    ::= { smRunEntry 4 }
+
+smRunLifeTime OBJECT-TYPE
+    SYNTAX      TimeInterval
+    UNITS       "centi-seconds"
+    MAX-ACCESS  read-write
+    STATUS      current
+    DESCRIPTION
+        "This object specifies how long the script can execute.
+         This object returns the remaining time that the script
+         may run. The object is initialized with the value of the
+         associated smLaunchLifeTime object and ticks backwards.
+         The script is aborted immediately when the value reaches 0.
+
+         The value of this object may be set in order to increase or
+         reduce the remaining time that the script may run. Setting
+         this value to 0 will abort script execution immediately,
+         and, if the value of smRunExpireTime is also 0, will remove
+         this entry from the smRunTable once it has terminated.
+
+         If smRunLifeTime is set to its maximum value (2147483647),
+         either by a set operation or by its initialization from the
+         smLaunchLifeTime object, then it will not tick backwards.
+         A running script with a maximum smRunLifeTime value will
+         thus never be terminated with a `lifeTimeExceeded' exit
+         code.
+
+         The value of smRunLifeTime reflects the real-time execution
+         time as seen by the outside world. The value of this object
+         will always be 0 for a script that finished execution, that
+         is smRunState has the value `terminated'.
+
+         The value of smRunLifeTime does not change while a script
+         is suspended, that is smRunState has the value `suspended'.
+         Note that this does not affect set operations. It is legal
+         to modify smRunLifeTime via set operations while a script
+         is suspended."
+    ::= { smRunEntry 5 }
+
+smRunExpireTime OBJECT-TYPE
+    SYNTAX      TimeInterval
+    UNITS       "centi-seconds"
+    MAX-ACCESS  read-write
+    STATUS      current
+    DESCRIPTION
+        "The value of this object specifies how long this row can
+         exist in the smRunTable after the script has terminated.
+         This object returns the remaining time that the row may
+         exist before it is aged out. The object is initialized with
+         the value of the associated smLaunchExpireTime object and
+         ticks backwards. The entry in the smRunTable is destroyed
+         when the value reaches 0 and the smRunState has the value
+         `terminated'.
+
+         The value of this object may be set in order to increase or
+         reduce the remaining time that the row may exist.  Setting
+         the value to 0 will destroy this entry as soon as the
+         smRunState has the value `terminated'."
+    ::= { smRunEntry 6 }
+
+smRunExitCode OBJECT-TYPE
+    SYNTAX      INTEGER {
+                    noError(1),
+                    halted(2),
+                    lifeTimeExceeded(3),
+                    noResourcesLeft(4),
+                    languageError(5),
+                    runtimeError(6),
+                    invalidArgument(7),
+                    securityViolation(8),
+                    genericError(9)
+                }
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+        "The value of this object indicates the reason why a
+         script finished execution. The smRunExitCode code may have
+         one of the following values:
+
+         - `noError', which indicates that the script completed
+            successfully without errors;
+
+         - `halted', which indicates that the script was halted
+            by a request from an authorized manager;
+
+         - `lifeTimeExceeded', which indicates that the script
+            exited because a time limit was exceeded;
+
+         - `noResourcesLeft', which indicates that the script
+            exited because it ran out of resources (e.g. memory);
+
+         - `languageError', which indicates that the script exited
+            because of a language error (e.g. a syntax error in an
+            interpreted language);
+
+         - `runtimeError', which indicates that the script exited
+            due to a runtime error (e.g. a division by zero);
+
+         - `invalidArgument', which indicates that the script could
+            not be run because of invalid script arguments;
+
+         - `securityViolation', which indicates that the script
+            exited due to a security violation;
+
+         - `genericError', which indicates that the script exited
+            for an unspecified reason.
+
+         If the script has not yet begun running, or is currently
+         running, the value will be `noError'."
+    DEFVAL { noError }
+    ::= { smRunEntry 7 }
+
+smRunResult OBJECT-TYPE
+    SYNTAX      OCTET STRING
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+        "The result value produced by the running script. Note that
+         the result may change while the script is executing."
+    DEFVAL { ''H }
+    ::= { smRunEntry 8 }
+
+smRunControl OBJECT-TYPE
+    SYNTAX      INTEGER {
+                    abort(1),
+                    suspend(2),
+                    resume(3),
+                    nop(4)
+                }
+    MAX-ACCESS  read-write
+    STATUS      current
+    DESCRIPTION
+        "The value of this object indicates the desired status of the
+         script execution defined by this row.
+
+         Setting this object to `abort' will abort execution if the
+
+         value of smRunState is `initializing', `executing',
+         `suspending', `suspended' or `resuming'. Setting this object
+         to `abort' when the value of smRunState is `aborting' or
+         `terminated', or if the implementation can determine that
+         the attempt to abort the execution would fail, will result
+         in an inconsistentValue error.
+
+         Setting this object to `suspend' will suspend execution
+         if the value of smRunState is `executing'. Setting this
+         object to `suspend' will cause an inconsistentValue error
+         if the value of smRunState is not `executing' or if the
+         implementation can determine that the attempt to suspend
+         the execution would fail.
+
+         Setting this object to `resume' will resume execution
+         if the value of smRunState is `suspending' or
+         `suspended'. Setting this object to `resume' will cause an
+         inconsistentValue error if the value of smRunState is
+         not `suspended' or if the implementation can determine
+         that the attempt to resume the execution would fail.
+
+         Setting this object to nop(4) has no effect."
+    DEFVAL { nop }
+    ::= { smRunEntry 9 }
+
+smRunState OBJECT-TYPE
+    SYNTAX      INTEGER {
+                    initializing(1),
+                    executing(2),
+                    suspending(3),
+                    suspended(4),
+                    resuming(5),
+                    aborting(6),
+                    terminated(7)
+                }
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+        "The value of this object indicates the script's execution
+         state. If the script has been invoked but has not yet
+         begun execution, the value will be `initializing'. If the
+         script is running, the value will be `executing'.
+
+         A running script which received a request to suspend
+         execution first transitions into a temporary `suspending'
+         state.  The temporary `suspending' state changes to
+         `suspended' when the script has actually been suspended. The
+         temporary `suspending' state changes back to `executing' if
+
+         the attempt to suspend the running script fails.
+
+         A suspended script which received a request to resume
+         execution first transitions into a temporary `resuming'
+         state. The temporary `resuming' state changes to `running'
+         when the script has actually been resumed. The temporary
+         `resuming' state changes back to `suspended' if the attempt
+         to resume the suspended script fails.
+
+         A script which received a request to abort execution but
+         which is still running first transitions into a temporary
+         `aborting' state.
+
+         A script which has finished its execution is `terminated'."
+    ::= { smRunEntry 10 }
+
+smRunError OBJECT-TYPE
+    SYNTAX      SnmpAdminString
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+        "This object contains a descriptive error message if the
+         script startup or execution raised an abnormal condition.
+         An implementation must store a descriptive error message
+         in this object if the script exits with the smRunExitCode
+         `genericError'."
+    DEFVAL { ''H }
+    ::= { smRunEntry 11 }
+
+smRunResultTime OBJECT-TYPE
+    SYNTAX      DateAndTime
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+        "The date and time when the smRunResult was last updated.
+         The value '0000000000000000'H is returned if smRunResult
+         has not yet been updated after the creation of this
+         smRunTable entry."
+    DEFVAL { '0000000000000000'H }
+    ::= { smRunEntry 12 }
+
+smRunErrorTime OBJECT-TYPE
+    SYNTAX      DateAndTime
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+        "The date and time when the smRunError was last updated.
+         The value '0000000000000000'H is returned if smRunError
+
+         has not yet been updated after the creation of this
+         smRunTable entry."
+    DEFVAL { '0000000000000000'H }
+    ::= { smRunEntry 13 }
+
+--
+-- Notifications. The definition of smTraps makes notification
+-- registrations reversible (see STD 58, RFC 2578).
+--
+
+smTraps OBJECT IDENTIFIER ::= { smNotifications 0 }
+
+smScriptAbort NOTIFICATION-TYPE
+    OBJECTS     { smRunExitCode, smRunEndTime, smRunError }
+    STATUS      current
+    DESCRIPTION
+        "This notification is generated whenever a running script
+         terminates with an smRunExitCode unequal to `noError'."
+    ::= { smTraps 1 }
+
+smScriptResult NOTIFICATION-TYPE
+    OBJECTS     { smRunResult }
+    STATUS      current
+    DESCRIPTION
+        "This notification can be used by scripts to notify other
+         management applications about results produced by the
+         script.
+
+         This notification is not automatically generated by the
+         Script MIB implementation. It is the responsibility of
+         the executing script to emit this notification where it
+         is appropriate to do so."
+    ::= { smTraps 2 }
+
+smScriptException NOTIFICATION-TYPE
+    OBJECTS     { smRunError }
+    STATUS      current
+    DESCRIPTION
+        "This notification can be used by scripts to notify other
+         management applications about script errors.
+
+         This notification is not automatically generated by the
+         Script MIB implementation. It is the responsibility of
+         the executing script or the runtime system to emit this
+         notification where it is appropriate to do so."
+    ::= { smTraps 3 }
+
+-- conformance information
+
+smCompliances OBJECT IDENTIFIER ::= { smConformance 1 }
+smGroups      OBJECT IDENTIFIER ::= { smConformance 2 }
+
+-- compliance statements
+
+smCompliance2 MODULE-COMPLIANCE
+    STATUS      current
+    DESCRIPTION
+        "The compliance statement for SNMP entities which implement
+         the Script MIB."
+    MODULE      -- this module
+    MANDATORY-GROUPS {
+            smLanguageGroup, smScriptGroup2, smLaunchGroup2,
+            smRunGroup2, smNotificationsGroup2
+    }
+    GROUP   smCodeGroup
+    DESCRIPTION
+        "The smCodeGroup is mandatory only for those implementations
+         that support the downloading of scripts via SNMP."
+    OBJECT  smScriptSource
+    MIN-ACCESS  read-only
+    DESCRIPTION
+        "The smScriptSource object is read-only for implementations
+         that are not able to download script code from a URL."
+    OBJECT smCodeText
+    DESCRIPTION
+        "A compliant implementation need only support write access to
+         the smCodeText object only during row creation."
+    OBJECT smLaunchArgument
+    DESCRIPTION
+        "A compliant implementation has to support a minimum size
+         for smLaunchArgument of 255 octets."
+    OBJECT smRunArgument
+    DESCRIPTION
+        "A compliant implementation has to support a minimum size
+         for smRunArgument of 255 octets."
+    OBJECT smRunResult
+    DESCRIPTION
+        "A compliant implementation has to support a minimum size
+         for smRunResult of 255 octets."
+    OBJECT smRunState
+    DESCRIPTION
+        "A compliant implementation does not have to support script
+         suspension and the smRunState `suspended'. Such an
+         implementation will change into the `suspending' state
+         when the smRunControl is set to `suspend' and remain in this
+         state until smRunControl is set to `resume' or the script
+         terminates."
+    ::= { smCompliances 2 }
+
+smLanguageGroup OBJECT-GROUP
+    OBJECTS {
+        smLangLanguage, smLangVersion,
+        smLangVendor, smLangRevision,
+        smLangDescr, smExtsnExtension,
+        smExtsnVersion, smExtsnVendor,
+        smExtsnRevision, smExtsnDescr
+    }
+    STATUS      current
+    DESCRIPTION
+        "A collection of objects providing information about the
+         capabilities of the scripting engine."
+    ::= { smGroups 1 }
+
+smScriptGroup2 OBJECT-GROUP
+    OBJECTS {
+        smScriptDescr, smScriptLanguage,
+        smScriptSource, smScriptAdminStatus,
+        smScriptOperStatus, smScriptStorageType,
+        smScriptRowStatus, smScriptError,
+        smScriptLastChange
+    }
+    STATUS      current
+    DESCRIPTION
+        "A collection of objects providing information about
+         installed scripts."
+    ::= { smGroups 7 }
+
+smCodeGroup OBJECT-GROUP
+    OBJECTS {
+        smCodeText, smCodeRowStatus
+    }
+    STATUS      current
+    DESCRIPTION
+        "A collection of objects used to download or modify scripts
+         by using SNMP set requests."
+    ::= { smGroups 3 }
+
+smLaunchGroup2 OBJECT-GROUP
+    OBJECTS {
+        smLaunchScriptOwner, smLaunchScriptName,
+        smLaunchArgument, smLaunchMaxRunning,
+        smLaunchMaxCompleted, smLaunchLifeTime,
+        smLaunchExpireTime, smLaunchStart,
+        smLaunchControl, smLaunchAdminStatus,
+        smLaunchOperStatus, smLaunchRunIndexNext,
+        smLaunchStorageType, smLaunchRowStatus,
+        smLaunchError, smLaunchLastChange,
+        smLaunchRowExpireTime
+    }
+    STATUS      current
+    DESCRIPTION
+        "A collection of objects providing information about scripts
+         that can be launched."
+    ::= { smGroups 8 }
+
+smRunGroup2 OBJECT-GROUP
+    OBJECTS {
+        smRunArgument, smRunStartTime,
+        smRunEndTime, smRunLifeTime,
+        smRunExpireTime, smRunExitCode,
+        smRunResult, smRunState,
+        smRunControl, smRunError,
+        smRunResultTime, smRunErrorTime
+    }
+    STATUS      current
+    DESCRIPTION
+        "A collection of objects providing information about running
+         scripts."
+    ::= { smGroups 9 }
+
+smNotificationsGroup2 NOTIFICATION-GROUP
+    NOTIFICATIONS {
+        smScriptAbort,
+        smScriptResult,
+        smScriptException
+    }
+    STATUS      current
+    DESCRIPTION
+        "The notifications emitted by the Script MIB."
+    ::= { smGroups 10 }
+
+--
+-- Deprecated compliance and conformance group definitions
+-- from RFC 2592.
+--
+
+smCompliance MODULE-COMPLIANCE
+    STATUS      deprecated
+    DESCRIPTION
+        "The compliance statement for SNMP entities which implement
+         the Script MIB."
+    MODULE      -- this module
+    MANDATORY-GROUPS {
+
+            smLanguageGroup, smScriptGroup, smLaunchGroup, smRunGroup
+    }
+    GROUP   smCodeGroup
+    DESCRIPTION
+        "The smCodeGroup is mandatory only for those implementations
+         that support the downloading of scripts via SNMP."
+    OBJECT  smScriptSource
+    MIN-ACCESS  read-only
+    DESCRIPTION
+        "The smScriptSource object is read-only for implementations
+         that are not able to download script code from a URL."
+    OBJECT smCodeText
+    DESCRIPTION
+        "A compliant implementation need only support write access
+         to the smCodeText object during row creation."
+    OBJECT smLaunchArgument
+    DESCRIPTION
+        "A compliant implementation has to support a minimum size
+         for smLaunchArgument of 255 octets."
+    OBJECT smRunArgument
+    DESCRIPTION
+        "A compliant implementation has to support a minimum size
+         for smRunArgument of 255 octets."
+    OBJECT smRunResult
+    DESCRIPTION
+        "A compliant implementation has to support a minimum size
+         for smRunResult of 255 octets."
+    OBJECT smRunState
+    DESCRIPTION
+        "A compliant implementation does not have to support script
+         suspension and the smRunState `suspended'. Such an
+         implementation will change into the `suspending' state
+         when the smRunControl is set to `suspend' and remain in this
+         state until smRunControl is set to `resume' or the script
+         terminates."
+    ::= { smCompliances 1 }
+
+smScriptGroup OBJECT-GROUP
+    OBJECTS {
+        smScriptDescr, smScriptLanguage,
+        smScriptSource, smScriptAdminStatus,
+        smScriptOperStatus, smScriptStorageType,
+        smScriptRowStatus
+    }
+    STATUS      deprecated
+    DESCRIPTION
+        "A collection of objects providing information about
+         installed scripts."
+    ::= { smGroups 2 }
+
+smLaunchGroup OBJECT-GROUP
+    OBJECTS {
+        smLaunchScriptOwner, smLaunchScriptName,
+        smLaunchArgument, smLaunchMaxRunning,
+        smLaunchMaxCompleted, smLaunchLifeTime,
+        smLaunchExpireTime, smLaunchStart,
+        smLaunchControl, smLaunchAdminStatus,
+        smLaunchOperStatus, smLaunchRunIndexNext,
+        smLaunchStorageType, smLaunchRowStatus
+    }
+    STATUS      deprecated
+    DESCRIPTION
+        "A collection of objects providing information about scripts
+         that can be launched."
+    ::= { smGroups 4 }
+
+smRunGroup OBJECT-GROUP
+    OBJECTS {
+        smRunArgument, smRunStartTime,
+        smRunEndTime, smRunLifeTime,
+        smRunExpireTime, smRunExitCode,
+        smRunResult, smRunState,
+        smRunControl, smRunError
+    }
+    STATUS      deprecated
+    DESCRIPTION
+        "A collection of objects providing information about running
+         scripts."
+    ::= { smGroups 5 }
+
+smNotificationsGroup NOTIFICATION-GROUP
+    NOTIFICATIONS {
+        smScriptAbort,
+        smScriptResult
+    }
+    STATUS      deprecated
+    DESCRIPTION
+        "The notifications emitted by the Script MIB."
+    ::= { smGroups 6 }
+
+END
diff -Naur tomato/release/src/router/snmp/mibs/EtherLike-MIB.txt tomato121/release/src/router/snmp/mibs/EtherLike-MIB.txt
--- tomato/release/src/router/snmp/mibs/EtherLike-MIB.txt	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/mibs/EtherLike-MIB.txt	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,1137 @@
+EtherLike-MIB DEFINITIONS ::= BEGIN
+
+    IMPORTS
+        MODULE-IDENTITY, OBJECT-TYPE, OBJECT-IDENTITY,
+        Counter32, mib-2, transmission
+            FROM SNMPv2-SMI
+        MODULE-COMPLIANCE, OBJECT-GROUP
+            FROM SNMPv2-CONF
+        ifIndex, InterfaceIndex
+            FROM IF-MIB;
+
+    etherMIB MODULE-IDENTITY
+        LAST-UPDATED "9908240400Z"  -- August 24, 1999
+        ORGANIZATION "IETF Ethernet Interfaces and Hub MIB
+                     Working Group"
+        CONTACT-INFO
+            "WG E-mail: hubmib@hprnd.rose.hp.com
+          To subscribe: hubmib-request@hprnd.rose.hp.com
+
+                 Chair: Dan Romascanu
+                Postal: Lucent Technologies
+                        Atidum Technology Park, Bldg. 3
+                        Tel Aviv 61131
+                        Israel
+                   Tel: +972 3 645 8414
+                E-mail: dromasca@lucent.com
+
+               Editor: John Flick
+               Postal: Hewlett-Packard Company
+                       8000 Foothills Blvd. M/S 5557
+                       Roseville, CA 95747-5557
+                       USA
+                  Tel: +1 916 785 4018
+                  Fax: +1 916 785 1199
+               E-mail: johnf@rose.hp.com
+
+               Editor: Jeffrey Johnson
+               Postal: RedBack Networks
+                       2570 North First Street, Suite 410
+                       San Jose, CA, 95131
+                       USA
+                  Tel: +1 408 571 2699
+                  Fax: +1 408 571 2698
+               E-Mail: jeff@redbacknetworks.com"
+        DESCRIPTION "The MIB module to describe generic objects for
+
+                    Ethernet-like network interfaces.
+
+                    The following reference is used throughout this
+                    MIB module:
+
+                    [IEEE 802.3 Std] refers to:
+                       IEEE Std 802.3, 1998 Edition: 'Information
+                       technology - Telecommunications and
+                       information exchange between systems -
+                       Local and metropolitan area networks -
+                       Specific requirements - Part 3: Carrier
+                       sense multiple access with collision
+                       detection (CSMA/CD) access method and
+                       physical layer specifications',
+                       September 1998.
+
+                    Of particular interest is Clause 30, '10Mb/s,
+                    100Mb/s and 1000Mb/s Management'."
+
+        REVISION    "9908240400Z"  -- August 24, 1999
+        DESCRIPTION "Updated to include support for 1000 Mb/sec
+                     interfaces and full-duplex interfaces.
+                     This version published as RFC 2665."
+
+        REVISION    "9806032150Z"
+        DESCRIPTION "Updated to include support for 100 Mb/sec
+                     interfaces.
+                     This version published as RFC 2358."
+
+        REVISION    "9402030400Z"
+        DESCRIPTION "Initial version, published as RFC 1650."
+        ::= { mib-2 35 }
+
+    etherMIBObjects OBJECT IDENTIFIER ::= { etherMIB 1 }
+
+    dot3    OBJECT IDENTIFIER ::= { transmission 7 }
+
+    -- the Ethernet-like Statistics group
+
+    dot3StatsTable OBJECT-TYPE
+        SYNTAX     SEQUENCE OF Dot3StatsEntry
+        MAX-ACCESS not-accessible
+        STATUS     current
+        DESCRIPTION "Statistics for a collection of ethernet-like
+                    interfaces attached to a particular system.
+                    There will be one row in this table for each
+
+                    ethernet-like interface in the system."
+        ::= { dot3 2 }
+
+    dot3StatsEntry OBJECT-TYPE
+        SYNTAX     Dot3StatsEntry
+        MAX-ACCESS not-accessible
+        STATUS     current
+        DESCRIPTION "Statistics for a particular interface to an
+                    ethernet-like medium."
+        INDEX       { dot3StatsIndex }
+        ::= { dot3StatsTable 1 }
+
+    Dot3StatsEntry ::=
+        SEQUENCE {
+            dot3StatsIndex                      InterfaceIndex,
+            dot3StatsAlignmentErrors            Counter32,
+            dot3StatsFCSErrors                  Counter32,
+            dot3StatsSingleCollisionFrames      Counter32,
+            dot3StatsMultipleCollisionFrames    Counter32,
+            dot3StatsSQETestErrors              Counter32,
+            dot3StatsDeferredTransmissions      Counter32,
+            dot3StatsLateCollisions             Counter32,
+            dot3StatsExcessiveCollisions        Counter32,
+            dot3StatsInternalMacTransmitErrors  Counter32,
+            dot3StatsCarrierSenseErrors         Counter32,
+            dot3StatsFrameTooLongs              Counter32,
+            dot3StatsInternalMacReceiveErrors   Counter32,
+            dot3StatsEtherChipSet               OBJECT IDENTIFIER,
+            dot3StatsSymbolErrors               Counter32,
+            dot3StatsDuplexStatus               INTEGER
+        }
+
+    dot3StatsIndex OBJECT-TYPE
+        SYNTAX      InterfaceIndex
+        MAX-ACCESS  read-only
+        STATUS      current
+        DESCRIPTION "An index value that uniquely identifies an
+                    interface to an ethernet-like medium.  The
+                    interface identified by a particular value of
+                    this index is the same interface as identified
+                    by the same value of ifIndex."
+        REFERENCE   "RFC 2233, ifIndex"
+        ::= { dot3StatsEntry 1 }
+
+    dot3StatsAlignmentErrors OBJECT-TYPE
+        SYNTAX      Counter32
+        MAX-ACCESS  read-only
+        STATUS      current
+        DESCRIPTION "A count of frames received on a particular
+                    interface that are not an integral number of
+                    octets in length and do not pass the FCS check.
+
+                    The count represented by an instance of this
+                    object is incremented when the alignmentError
+                    status is returned by the MAC service to the
+                    LLC (or other MAC user). Received frames for
+                    which multiple error conditions obtain are,
+                    according to the conventions of IEEE 802.3
+                    Layer Management, counted exclusively according
+                    to the error status presented to the LLC.
+
+                    This counter does not increment for 8-bit wide
+                    group encoding schemes.
+
+                    Discontinuities in the value of this counter can
+                    occur at re-initialization of the management
+                    system, and at other times as indicated by the
+                    value of ifCounterDiscontinuityTime."
+        REFERENCE   "[IEEE 802.3 Std.], 30.3.1.1.7,
+                    aAlignmentErrors"
+        ::= { dot3StatsEntry 2 }
+
+    dot3StatsFCSErrors OBJECT-TYPE
+        SYNTAX      Counter32
+        MAX-ACCESS  read-only
+        STATUS      current
+        DESCRIPTION "A count of frames received on a particular
+                    interface that are an integral number of octets
+                    in length but do not pass the FCS check.  This
+                    count does not include frames received with
+                    frame-too-long or frame-too-short error.
+
+                    The count represented by an instance of this
+                    object is incremented when the frameCheckError
+                    status is returned by the MAC service to the
+                    LLC (or other MAC user). Received frames for
+                    which multiple error conditions obtain are,
+                    according to the conventions of IEEE 802.3
+                    Layer Management, counted exclusively according
+                    to the error status presented to the LLC.
+
+                    Note:  Coding errors detected by the physical
+                    layer for speeds above 10 Mb/s will cause the
+                    frame to fail the FCS check.
+                    Discontinuities in the value of this counter can
+                    occur at re-initialization of the management
+
+                    system, and at other times as indicated by the
+                    value of ifCounterDiscontinuityTime."
+        REFERENCE   "[IEEE 802.3 Std.], 30.3.1.1.6,
+                    aFrameCheckSequenceErrors."
+        ::= { dot3StatsEntry 3 }
+
+    dot3StatsSingleCollisionFrames OBJECT-TYPE
+        SYNTAX      Counter32
+        MAX-ACCESS  read-only
+        STATUS      current
+        DESCRIPTION "A count of successfully transmitted frames on
+                    a particular interface for which transmission
+                    is inhibited by exactly one collision.
+
+                    A frame that is counted by an instance of this
+                    object is also counted by the corresponding
+                    instance of either the ifOutUcastPkts,
+                    ifOutMulticastPkts, or ifOutBroadcastPkts,
+                    and is not counted by the corresponding
+                    instance of the dot3StatsMultipleCollisionFrames
+                    object.
+
+                    This counter does not increment when the
+                    interface is operating in full-duplex mode.
+
+                    Discontinuities in the value of this counter can
+                    occur at re-initialization of the management
+                    system, and at other times as indicated by the
+                    value of ifCounterDiscontinuityTime."
+        REFERENCE   "[IEEE 802.3 Std.], 30.3.1.1.3,
+                    aSingleCollisionFrames."
+        ::= { dot3StatsEntry 4 }
+
+    dot3StatsMultipleCollisionFrames OBJECT-TYPE
+        SYNTAX      Counter32
+        MAX-ACCESS  read-only
+        STATUS      current
+        DESCRIPTION "A count of successfully transmitted frames on
+                    a particular interface for which transmission
+                    is inhibited by more than one collision.
+
+                    A frame that is counted by an instance of this
+                    object is also counted by the corresponding
+                    instance of either the ifOutUcastPkts,
+                    ifOutMulticastPkts, or ifOutBroadcastPkts,
+                    and is not counted by the corresponding
+                    instance of the dot3StatsSingleCollisionFrames
+                    object.
+
+                    This counter does not increment when the
+                    interface is operating in full-duplex mode.
+
+                    Discontinuities in the value of this counter can
+                    occur at re-initialization of the management
+                    system, and at other times as indicated by the
+                    value of ifCounterDiscontinuityTime."
+        REFERENCE   "[IEEE 802.3 Std.], 30.3.1.1.4,
+                    aMultipleCollisionFrames."
+        ::= { dot3StatsEntry 5 }
+
+    dot3StatsSQETestErrors OBJECT-TYPE
+        SYNTAX      Counter32
+        MAX-ACCESS  read-only
+        STATUS      current
+        DESCRIPTION "A count of times that the SQE TEST ERROR
+                    message is generated by the PLS sublayer for a
+                    particular interface. The SQE TEST ERROR
+                    is set in accordance with the rules for
+                    verification of the SQE detection mechanism in
+                    the PLS Carrier Sense Function as described in
+                    IEEE Std. 802.3, 1998 Edition, section 7.2.4.6.
+
+                    This counter does not increment on interfaces
+                    operating at speeds greater than 10 Mb/s, or on
+                    interfaces operating in full-duplex mode.
+
+                    Discontinuities in the value of this counter can
+                    occur at re-initialization of the management
+                    system, and at other times as indicated by the
+                    value of ifCounterDiscontinuityTime."
+        REFERENCE   "[IEEE 802.3 Std.], 7.2.4.6, also 30.3.2.1.4,
+                    aSQETestErrors."
+        ::= { dot3StatsEntry 6 }
+
+    dot3StatsDeferredTransmissions OBJECT-TYPE
+        SYNTAX      Counter32
+        MAX-ACCESS  read-only
+        STATUS      current
+        DESCRIPTION "A count of frames for which the first
+                    transmission attempt on a particular interface
+                    is delayed because the medium is busy.
+                    The count represented by an instance of this
+                    object does not include frames involved in
+                    collisions.
+
+                    This counter does not increment when the
+                    interface is operating in full-duplex mode.
+
+                    Discontinuities in the value of this counter can
+                    occur at re-initialization of the management
+                    system, and at other times as indicated by the
+                    value of ifCounterDiscontinuityTime."
+        REFERENCE   "[IEEE 802.3 Std.], 30.3.1.1.9,
+                    aFramesWithDeferredXmissions."
+        ::= { dot3StatsEntry 7 }
+
+    dot3StatsLateCollisions OBJECT-TYPE
+        SYNTAX      Counter32
+        MAX-ACCESS  read-only
+        STATUS      current
+        DESCRIPTION "The number of times that a collision is
+                    detected on a particular interface later than
+                    one slotTime into the transmission of a packet.
+
+                    A (late) collision included in a count
+                    represented by an instance of this object is
+                    also considered as a (generic) collision for
+                    purposes of other collision-related
+                    statistics.
+
+                    This counter does not increment when the
+                    interface is operating in full-duplex mode.
+
+                    Discontinuities in the value of this counter can
+                    occur at re-initialization of the management
+                    system, and at other times as indicated by the
+                    value of ifCounterDiscontinuityTime."
+        REFERENCE   "[IEEE 802.3 Std.], 30.3.1.1.10,
+                    aLateCollisions."
+        ::= { dot3StatsEntry 8 }
+
+    dot3StatsExcessiveCollisions OBJECT-TYPE
+        SYNTAX      Counter32
+        MAX-ACCESS  read-only
+        STATUS      current
+        DESCRIPTION "A count of frames for which transmission on a
+                    particular interface fails due to excessive
+                    collisions.
+                    This counter does not increment when the
+                    interface is operating in full-duplex mode.
+
+                    Discontinuities in the value of this counter can
+                    occur at re-initialization of the management
+                    system, and at other times as indicated by the
+                    value of ifCounterDiscontinuityTime."
+        REFERENCE   "[IEEE 802.3 Std.], 30.3.1.1.11,
+                    aFramesAbortedDueToXSColls."
+        ::= { dot3StatsEntry 9 }
+
+    dot3StatsInternalMacTransmitErrors OBJECT-TYPE
+        SYNTAX      Counter32
+        MAX-ACCESS  read-only
+        STATUS      current
+        DESCRIPTION "A count of frames for which transmission on a
+                    particular interface fails due to an internal
+                    MAC sublayer transmit error. A frame is only
+                    counted by an instance of this object if it is
+                    not counted by the corresponding instance of
+                    either the dot3StatsLateCollisions object, the
+                    dot3StatsExcessiveCollisions object, or the
+                    dot3StatsCarrierSenseErrors object.
+
+                    The precise meaning of the count represented by
+                    an instance of this object is implementation-
+                    specific.  In particular, an instance of this
+                    object may represent a count of transmission
+                    errors on a particular interface that are not
+                    otherwise counted.
+
+                    Discontinuities in the value of this counter can
+                    occur at re-initialization of the management
+                    system, and at other times as indicated by the
+                    value of ifCounterDiscontinuityTime."
+        REFERENCE   "[IEEE 802.3 Std.], 30.3.1.1.12,
+                    aFramesLostDueToIntMACXmitError."
+        ::= { dot3StatsEntry 10 }
+
+    dot3StatsCarrierSenseErrors OBJECT-TYPE
+        SYNTAX      Counter32
+        MAX-ACCESS  read-only
+        STATUS      current
+        DESCRIPTION "The number of times that the carrier sense
+                    condition was lost or never asserted when
+                    attempting to transmit a frame on a particular
+                    interface.
+
+                    The count represented by an instance of this
+                    object is incremented at most once per
+                    transmission attempt, even if the carrier sense
+                    condition fluctuates during a transmission
+                    attempt.
+
+                    This counter does not increment when the
+                    interface is operating in full-duplex mode.
+
+                    Discontinuities in the value of this counter can
+                    occur at re-initialization of the management
+                    system, and at other times as indicated by the
+                    value of ifCounterDiscontinuityTime."
+        REFERENCE   "[IEEE 802.3 Std.], 30.3.1.1.13,
+                    aCarrierSenseErrors."
+        ::= { dot3StatsEntry 11 }
+
+    -- { dot3StatsEntry 12 } is not assigned
+
+    dot3StatsFrameTooLongs OBJECT-TYPE
+        SYNTAX      Counter32
+        MAX-ACCESS  read-only
+        STATUS      current
+        DESCRIPTION "A count of frames received on a particular
+                    interface that exceed the maximum permitted
+                    frame size.
+
+                    The count represented by an instance of this
+                    object is incremented when the frameTooLong
+                    status is returned by the MAC service to the
+                    LLC (or other MAC user). Received frames for
+                    which multiple error conditions obtain are,
+                    according to the conventions of IEEE 802.3
+                    Layer Management, counted exclusively according
+                    to the error status presented to the LLC.
+
+                    Discontinuities in the value of this counter can
+                    occur at re-initialization of the management
+                    system, and at other times as indicated by the
+                    value of ifCounterDiscontinuityTime."
+        REFERENCE   "[IEEE 802.3 Std.], 30.3.1.1.25,
+                    aFrameTooLongErrors."
+        ::= { dot3StatsEntry 13 }
+
+    -- { dot3StatsEntry 14 } is not assigned
+
+    -- { dot3StatsEntry 15 } is not assigned
+
+    dot3StatsInternalMacReceiveErrors OBJECT-TYPE
+        SYNTAX      Counter32
+        MAX-ACCESS  read-only
+        STATUS      current
+        DESCRIPTION "A count of frames for which reception on a
+                    particular interface fails due to an internal
+                    MAC sublayer receive error. A frame is only
+                    counted by an instance of this object if it is
+                    not counted by the corresponding instance of
+
+                    either the dot3StatsFrameTooLongs object, the
+                    dot3StatsAlignmentErrors object, or the
+                    dot3StatsFCSErrors object.
+
+                    The precise meaning of the count represented by
+                    an instance of this object is implementation-
+                    specific.  In particular, an instance of this
+                    object may represent a count of receive errors
+                    on a particular interface that are not
+                    otherwise counted.
+
+                    Discontinuities in the value of this counter can
+                    occur at re-initialization of the management
+                    system, and at other times as indicated by the
+                    value of ifCounterDiscontinuityTime."
+        REFERENCE   "[IEEE 802.3 Std.], 30.3.1.1.15,
+                    aFramesLostDueToIntMACRcvError."
+        ::= { dot3StatsEntry 16 }
+
+    dot3StatsEtherChipSet OBJECT-TYPE
+        SYNTAX      OBJECT IDENTIFIER
+        MAX-ACCESS  read-only
+        STATUS      deprecated
+        DESCRIPTION "******** THIS OBJECT IS DEPRECATED ********
+
+                    This object contains an OBJECT IDENTIFIER
+                    which identifies the chipset used to
+                    realize the interface. Ethernet-like
+                    interfaces are typically built out of
+                    several different chips. The MIB implementor
+                    is presented with a decision of which chip
+                    to identify via this object. The implementor
+                    should identify the chip which is usually
+                    called the Medium Access Control chip.
+                    If no such chip is easily identifiable,
+                    the implementor should identify the chip
+                    which actually gathers the transmit
+                    and receive statistics and error
+                    indications. This would allow a
+                    manager station to correlate the
+                    statistics and the chip generating
+                    them, giving it the ability to take
+                    into account any known anomalies
+                    in the chip."
+        ::= { dot3StatsEntry 17 }
+
+    dot3StatsSymbolErrors OBJECT-TYPE
+        SYNTAX      Counter32
+        MAX-ACCESS  read-only
+        STATUS      current
+        DESCRIPTION "For an interface operating at 100 Mb/s, the
+                    number of times there was an invalid data symbol
+                    when a valid carrier was present.
+
+                    For an interface operating in half-duplex mode
+                    at 1000 Mb/s, the number of times the receiving
+                    media is non-idle (a carrier event) for a period
+                    of time equal to or greater than slotTime, and
+                    during which there was at least one occurrence
+                    of an event that causes the PHY to indicate
+                    'Data reception error' or 'carrier extend error'
+                    on the GMII.
+
+                    For an interface operating in full-duplex mode
+                    at 1000 Mb/s, the number of times the receiving
+                    media is non-idle a carrier event) for a period
+                    of time equal to or greater than minFrameSize,
+                    and during which there was at least one
+                    occurrence of an event that causes the PHY to
+                    indicate 'Data reception error' on the GMII.
+
+                    The count represented by an instance of this
+                    object is incremented at most once per carrier
+                    event, even if multiple symbol errors occur
+                    during the carrier event.  This count does
+                    not increment if a collision is present.
+
+                    Discontinuities in the value of this counter can
+                    occur at re-initialization of the management
+                    system, and at other times as indicated by the
+                    value of ifCounterDiscontinuityTime."
+        REFERENCE   "[IEEE 802.3 Std.], 30.3.2.1.5,
+                    aSymbolErrorDuringCarrier."
+        ::= { dot3StatsEntry 18 }
+
+    dot3StatsDuplexStatus OBJECT-TYPE
+        SYNTAX      INTEGER {
+                        unknown(1),
+                        halfDuplex(2),
+                        fullDuplex(3)
+                    }
+        MAX-ACCESS  read-only
+        STATUS      current
+        DESCRIPTION "The current mode of operation of the MAC
+                    entity.  'unknown' indicates that the current
+                    duplex mode could not be determined.
+
+                    Management control of the duplex mode is
+                    accomplished through the MAU MIB.  When
+                    an interface does not support autonegotiation,
+                    or when autonegotiation is not enabled, the
+                    duplex mode is controlled using
+                    ifMauDefaultType.  When autonegotiation is
+                    supported and enabled, duplex mode is controlled
+                    using ifMauAutoNegAdvertisedBits.  In either
+                    case, the currently operating duplex mode is
+                    reflected both in this object and in ifMauType.
+
+                    Note that this object provides redundant
+                    information with ifMauType.  Normally, redundant
+                    objects are discouraged.  However, in this
+                    instance, it allows a management application to
+                    determine the duplex status of an interface
+                    without having to know every possible value of
+                    ifMauType.  This was felt to be sufficiently
+                    valuable to justify the redundancy."
+        REFERENCE   "[IEEE 802.3 Std.], 30.3.1.1.32,
+                    aDuplexStatus."
+        ::= { dot3StatsEntry 19 }
+
+    -- the Ethernet-like Collision Statistics group
+
+    -- Implementation of this group is optional; it is appropriate
+    -- for all systems which have the necessary metering
+
+    dot3CollTable OBJECT-TYPE
+        SYNTAX      SEQUENCE OF Dot3CollEntry
+        MAX-ACCESS  not-accessible
+        STATUS      current
+        DESCRIPTION "A collection of collision histograms for a
+                    particular set of interfaces."
+        REFERENCE   "[IEEE 802.3 Std.], 30.3.1.1.30,
+                    aCollisionFrames."
+        ::= { dot3 5 }
+
+    dot3CollEntry OBJECT-TYPE
+        SYNTAX      Dot3CollEntry
+        MAX-ACCESS  not-accessible
+        STATUS      current
+        DESCRIPTION "A cell in the histogram of per-frame
+                    collisions for a particular interface.  An
+                    instance of this object represents the
+                    frequency of individual MAC frames for which
+                    the transmission (successful or otherwise) on a
+                    particular interface is accompanied by a
+
+                    particular number of media collisions."
+        INDEX       { ifIndex, dot3CollCount }
+        ::= { dot3CollTable 1 }
+
+    Dot3CollEntry ::=
+        SEQUENCE {
+            dot3CollCount        INTEGER,
+            dot3CollFrequencies  Counter32
+        }
+
+    -- { dot3CollEntry 1 } is no longer in use
+
+    dot3CollCount OBJECT-TYPE
+        SYNTAX      INTEGER (1..16)
+        MAX-ACCESS  not-accessible
+        STATUS      current
+        DESCRIPTION "The number of per-frame media collisions for
+                    which a particular collision histogram cell
+                    represents the frequency on a particular
+                    interface."
+        ::= { dot3CollEntry 2 }
+
+    dot3CollFrequencies OBJECT-TYPE
+        SYNTAX      Counter32
+        MAX-ACCESS  read-only
+        STATUS      current
+        DESCRIPTION "A count of individual MAC frames for which the
+                    transmission (successful or otherwise) on a
+                    particular interface occurs after the
+                    frame has experienced exactly the number
+                    of collisions in the associated
+                    dot3CollCount object.
+
+                    For example, a frame which is transmitted
+                    on interface 77 after experiencing
+                    exactly 4 collisions would be indicated
+                    by incrementing only dot3CollFrequencies.77.4.
+                    No other instance of dot3CollFrequencies would
+                    be incremented in this example.
+
+                    This counter does not increment when the
+                    interface is operating in full-duplex mode.
+
+                    Discontinuities in the value of this counter can
+                    occur at re-initialization of the management
+                    system, and at other times as indicated by the
+                    value of ifCounterDiscontinuityTime."
+        ::= { dot3CollEntry 3 }
+
+    dot3ControlTable OBJECT-TYPE
+        SYNTAX      SEQUENCE OF Dot3ControlEntry
+        MAX-ACCESS  not-accessible
+        STATUS      current
+        DESCRIPTION "A table of descriptive and status information
+                    about the MAC Control sublayer on the
+                    ethernet-like interfaces attached to a
+                    particular system.  There will be one row in
+                    this table for each ethernet-like interface in
+                    the system which implements the MAC Control
+                    sublayer.  If some, but not all, of the
+                    ethernet-like interfaces in the system implement
+                    the MAC Control sublayer, there will be fewer
+                    rows in this table than in the dot3StatsTable."
+        ::= { dot3 9 }
+
+    dot3ControlEntry OBJECT-TYPE
+        SYNTAX      Dot3ControlEntry
+        MAX-ACCESS  not-accessible
+        STATUS      current
+        DESCRIPTION "An entry in the table, containing information
+                    about the MAC Control sublayer on a single
+                    ethernet-like interface."
+        INDEX       { dot3StatsIndex }
+        ::= { dot3ControlTable 1 }
+
+    Dot3ControlEntry ::=
+        SEQUENCE {
+            dot3ControlFunctionsSupported       BITS,
+            dot3ControlInUnknownOpcodes         Counter32
+        }
+
+    dot3ControlFunctionsSupported OBJECT-TYPE
+        SYNTAX      BITS {
+                        pause(0)   -- 802.3x flow control
+                    }
+        MAX-ACCESS  read-only
+        STATUS      current
+        DESCRIPTION "A list of the possible MAC Control functions
+                    implemented for this interface."
+        REFERENCE   "[IEEE 802.3 Std.], 30.3.3.2,
+                    aMACControlFunctionsSupported."
+        ::= { dot3ControlEntry 1 }
+
+    dot3ControlInUnknownOpcodes OBJECT-TYPE
+        SYNTAX      Counter32
+        MAX-ACCESS  read-only
+        STATUS      current
+        DESCRIPTION "A count of MAC Control frames received on this
+                    interface that contain an opcode that is not
+                    supported by this device.
+
+                    Discontinuities in the value of this counter can
+                    occur at re-initialization of the management
+                    system, and at other times as indicated by the
+                    value of ifCounterDiscontinuityTime."
+        REFERENCE   "[IEEE 802.3 Std.], 30.3.3.5,
+                    aUnsupportedOpcodesReceived"
+        ::= { dot3ControlEntry 2 }
+
+    dot3PauseTable OBJECT-TYPE
+        SYNTAX      SEQUENCE OF Dot3PauseEntry
+        MAX-ACCESS  not-accessible
+        STATUS      current
+        DESCRIPTION "A table of descriptive and status information
+                    about the MAC Control PAUSE function on the
+                    ethernet-like interfaces attached to a
+                    particular system. There will be one row in
+                    this table for each ethernet-like interface in
+                    the system which supports the MAC Control PAUSE
+                    function (i.e., the 'pause' bit in the
+                    corresponding instance of
+                    dot3ControlFunctionsSupported is set).  If some,
+                    but not all, of the ethernet-like interfaces in
+                    the system implement the MAC Control PAUSE
+                    function (for example, if some interfaces only
+                    support half-duplex), there will be fewer rows
+                    in this table than in the dot3StatsTable."
+        ::= { dot3 10 }
+
+    dot3PauseEntry OBJECT-TYPE
+        SYNTAX      Dot3PauseEntry
+        MAX-ACCESS  not-accessible
+        STATUS      current
+        DESCRIPTION "An entry in the table, containing information
+                    about the MAC Control PAUSE function on a single
+                    ethernet-like interface."
+        INDEX       { dot3StatsIndex }
+        ::= { dot3PauseTable 1 }
+
+    Dot3PauseEntry ::=
+        SEQUENCE {
+            dot3PauseAdminMode                  INTEGER,
+            dot3PauseOperMode                   INTEGER,
+            dot3InPauseFrames                   Counter32,
+            dot3OutPauseFrames                  Counter32
+
+        }
+
+    dot3PauseAdminMode OBJECT-TYPE
+        SYNTAX      INTEGER {
+                        disabled(1),
+                        enabledXmit(2),
+                        enabledRcv(3),
+                        enabledXmitAndRcv(4)
+                    }
+        MAX-ACCESS  read-write
+        STATUS      current
+        DESCRIPTION "This object is used to configure the default
+                    administrative PAUSE mode for this interface.
+
+                    This object represents the
+                    administratively-configured PAUSE mode for this
+                    interface.  If auto-negotiation is not enabled
+                    or is not implemented for the active MAU
+                    attached to this interface, the value of this
+                    object determines the operational PAUSE mode
+                    of the interface whenever it is operating in
+                    full-duplex mode.  In this case, a set to this
+                    object will force the interface into the
+                    specified mode.
+
+                    If auto-negotiation is implemented and enabled
+                    for the MAU attached to this interface, the
+                    PAUSE mode for this interface is determined by
+                    auto-negotiation, and the value of this object
+                    denotes the mode to which the interface will
+                    automatically revert if/when auto-negotiation is
+                    later disabled.  Note that when auto-negotiation
+                    is running, administrative control of the PAUSE
+                    mode may be accomplished using the
+                    ifMauAutoNegCapAdvertisedBits object in the
+                    MAU-MIB.
+
+                    Note that the value of this object is ignored
+                    when the interface is not operating in
+                    full-duplex mode.
+
+                    An attempt to set this object to
+                    'enabledXmit(2)' or 'enabledRcv(3)' will fail
+                    on interfaces that do not support operation
+                    at greater than 100 Mb/s."
+        ::= { dot3PauseEntry 1 }
+
+    dot3PauseOperMode OBJECT-TYPE
+        SYNTAX      INTEGER {
+                        disabled(1),
+                        enabledXmit(2),
+                        enabledRcv(3),
+                        enabledXmitAndRcv(4)
+                    }
+        MAX-ACCESS  read-only
+        STATUS      current
+        DESCRIPTION "This object reflects the PAUSE mode currently
+                    in use on this interface, as determined by
+                    either (1) the result of the auto-negotiation
+                    function or (2) if auto-negotiation is not
+                    enabled or is not implemented for the active MAU
+                    attached to this interface, by the value of
+                    dot3PauseAdminMode.  Interfaces operating at
+                    100 Mb/s or less will never return
+                    'enabledXmit(2)' or 'enabledRcv(3)'.  Interfaces
+                    operating in half-duplex mode will always return
+                    'disabled(1)'.  Interfaces on which
+                    auto-negotiation is enabled but not yet
+                    completed should return the value
+                    'disabled(1)'."
+        ::= { dot3PauseEntry 2 }
+
+    dot3InPauseFrames OBJECT-TYPE
+        SYNTAX      Counter32
+        MAX-ACCESS  read-only
+        STATUS      current
+        DESCRIPTION "A count of MAC Control frames received on this
+                    interface with an opcode indicating the PAUSE
+                    operation.
+
+                    This counter does not increment when the
+                    interface is operating in half-duplex mode.
+                    Discontinuities in the value of this counter can
+                    occur at re-initialization of the management
+                    system, and at other times as indicated by the
+                    value of ifCounterDiscontinuityTime."
+        REFERENCE   "[IEEE 802.3 Std.], 30.3.4.3,
+                    aPAUSEMACCtrlFramesReceived."
+        ::= { dot3PauseEntry 3 }
+
+    dot3OutPauseFrames OBJECT-TYPE
+        SYNTAX      Counter32
+        MAX-ACCESS  read-only
+        STATUS      current
+        DESCRIPTION "A count of MAC Control frames transmitted on
+                    this interface with an opcode indicating the
+
+                    PAUSE operation.
+
+                    This counter does not increment when the
+                    interface is operating in half-duplex mode.
+
+                    Discontinuities in the value of this counter can
+                    occur at re-initialization of the management
+                    system, and at other times as indicated by the
+                    value of ifCounterDiscontinuityTime."
+        REFERENCE   "[IEEE 802.3 Std.], 30.3.4.2,
+                    aPAUSEMACCtrlFramesTransmitted."
+        ::= { dot3PauseEntry 4 }
+
+    --  802.3 Tests
+
+    dot3Tests   OBJECT IDENTIFIER ::= { dot3 6 }
+
+    dot3Errors  OBJECT IDENTIFIER ::= { dot3 7 }
+
+    --  TDR Test
+
+    dot3TestTdr OBJECT-IDENTITY
+        STATUS      current
+        DESCRIPTION "The Time-Domain Reflectometry (TDR) test is
+                    specific to ethernet-like interfaces of type
+                    10Base5 and 10Base2.  The TDR value may be
+                    useful in determining the approximate distance
+                    to a cable fault.  It is advisable to repeat
+                    this test to check for a consistent resulting
+                    TDR value, to verify that there is a fault.
+
+                    A TDR test returns as its result the time
+                    interval, measured in 10 MHz ticks or 100 nsec
+                    units, between the start of TDR test
+                    transmission and the subsequent detection of a
+                    collision or deassertion of carrier.  On
+                    successful completion of a TDR test, the result
+                    is stored as the value of an appropriate
+                    instance of an appropriate vendor specific MIB
+                    object, and the OBJECT IDENTIFIER of that
+                    instance is stored in the appropriate instance
+                    of the appropriate test result code object
+                    (thereby indicating where the result has been
+                    stored)."
+        ::= { dot3Tests 1 }
+
+    -- Loopback Test
+
+    dot3TestLoopBack OBJECT-IDENTITY
+        STATUS      current
+        DESCRIPTION "This test configures the MAC chip and executes
+                    an internal loopback test of memory, data paths,
+                    and the MAC chip logic.  This loopback test can
+                    only be executed if the interface is offline.
+                    Once the test has completed, the MAC chip should
+                    be reinitialized for network operation, but it
+                    should remain offline.
+
+                    If an error occurs during a test, the
+                    appropriate test result object will be set
+                    to indicate a failure.  The two OBJECT
+                    IDENTIFIER values dot3ErrorInitError and
+                    dot3ErrorLoopbackError may be used to provided
+                    more information as values for an appropriate
+                    test result code object."
+        ::= { dot3Tests 2 }
+
+    dot3ErrorInitError OBJECT-IDENTITY
+        STATUS      current
+        DESCRIPTION "Couldn't initialize MAC chip for test."
+        ::= { dot3Errors 1 }
+
+    dot3ErrorLoopbackError OBJECT-IDENTITY
+        STATUS      current
+        DESCRIPTION "Expected data not received (or not received
+                    correctly) in loopback test."
+        ::= { dot3Errors 2 }
+
+    -- { dot3 8 }, the dot3ChipSets tree, is defined in [28]
+
+    -- conformance information
+
+    etherConformance OBJECT IDENTIFIER ::= { etherMIB 2 }
+
+    etherGroups      OBJECT IDENTIFIER ::= { etherConformance 1 }
+    etherCompliances OBJECT IDENTIFIER ::= { etherConformance 2 }
+
+    -- compliance statements
+
+    etherCompliance MODULE-COMPLIANCE
+        STATUS      deprecated
+        DESCRIPTION "******** THIS COMPLIANCE IS DEPRECATED ********
+
+                    The compliance statement for managed network
+                    entities which have ethernet-like network
+                    interfaces.
+
+                    This compliance is deprecated and replaced by
+                    dot3Compliance."
+
+        MODULE  -- this module
+            MANDATORY-GROUPS { etherStatsGroup }
+
+            GROUP       etherCollisionTableGroup
+            DESCRIPTION "This group is optional. It is appropriate
+                        for all systems which have the necessary
+                        metering. Implementation in such systems is
+                        highly recommended."
+        ::= { etherCompliances 1 }
+
+    ether100MbsCompliance MODULE-COMPLIANCE
+        STATUS      deprecated
+        DESCRIPTION "******** THIS COMPLIANCE IS DEPRECATED ********
+
+                    The compliance statement for managed network
+                    entities which have 100 Mb/sec ethernet-like
+                    network interfaces.
+
+                    This compliance is deprecated and replaced by
+                    dot3Compliance."
+
+        MODULE  -- this module
+            MANDATORY-GROUPS { etherStats100MbsGroup }
+
+            GROUP       etherCollisionTableGroup
+            DESCRIPTION "This group is optional. It is appropriate
+                        for all systems which have the necessary
+                        metering. Implementation in such systems is
+                        highly recommended."
+        ::= { etherCompliances 2 }
+
+    dot3Compliance MODULE-COMPLIANCE
+        STATUS      current
+        DESCRIPTION "The compliance statement for managed network
+                    entities which have ethernet-like network
+                    interfaces."
+
+        MODULE  -- this module
+            MANDATORY-GROUPS { etherStatsBaseGroup }
+
+            GROUP       etherDuplexGroup
+            DESCRIPTION "This group is mandatory for all
+                        ethernet-like network interfaces which are
+                        capable of operating in full-duplex mode.
+                        It is highly recommended for all
+
+                        ethernet-like network interfaces."
+
+            GROUP       etherStatsLowSpeedGroup
+            DESCRIPTION "This group is mandatory for all
+                        ethernet-like network interfaces which are
+                        capable of operating at 10 Mb/s or slower in
+                        half-duplex mode."
+
+            GROUP       etherStatsHighSpeedGroup
+            DESCRIPTION "This group is mandatory for all
+                        ethernet-like network interfaces which are
+                        capable of operating at 100 Mb/s or faster."
+
+            GROUP       etherControlGroup
+            DESCRIPTION "This group is mandatory for all
+                        ethernet-like network interfaces that
+                        support the MAC Control sublayer."
+
+            GROUP       etherControlPauseGroup
+            DESCRIPTION "This group is mandatory for all
+                        ethernet-like network interfaces that
+                        support the MAC Control PAUSE function."
+
+            GROUP       etherCollisionTableGroup
+            DESCRIPTION "This group is optional. It is appropriate
+                        for all ethernet-like network interfaces
+                        which are capable of operating in
+                        half-duplex mode and have the necessary
+                        metering. Implementation in systems with
+                        such interfaces is highly recommended."
+        ::= { etherCompliances 3 }
+
+    -- units of conformance
+
+    etherStatsGroup OBJECT-GROUP
+        OBJECTS     { dot3StatsIndex,
+                      dot3StatsAlignmentErrors,
+                      dot3StatsFCSErrors,
+                      dot3StatsSingleCollisionFrames,
+                      dot3StatsMultipleCollisionFrames,
+                      dot3StatsSQETestErrors,
+                      dot3StatsDeferredTransmissions,
+                      dot3StatsLateCollisions,
+                      dot3StatsExcessiveCollisions,
+                      dot3StatsInternalMacTransmitErrors,
+                      dot3StatsCarrierSenseErrors,
+                      dot3StatsFrameTooLongs,
+                      dot3StatsInternalMacReceiveErrors,
+                      dot3StatsEtherChipSet
+                    }
+        STATUS      deprecated
+        DESCRIPTION "********* THIS GROUP IS DEPRECATED **********
+
+                    A collection of objects providing information
+                    applicable to all ethernet-like network
+                    interfaces.
+
+                    This object group has been deprecated and
+                    replaced by etherStatsBaseGroup and
+                    etherStatsLowSpeedGroup."
+        ::= { etherGroups 1 }
+
+    etherCollisionTableGroup OBJECT-GROUP
+        OBJECTS     { dot3CollFrequencies
+                    }
+        STATUS      current
+        DESCRIPTION "A collection of objects providing a histogram
+                    of packets successfully transmitted after
+                    experiencing exactly N collisions."
+        ::= { etherGroups 2 }
+
+    etherStats100MbsGroup OBJECT-GROUP
+        OBJECTS     { dot3StatsIndex,
+                      dot3StatsAlignmentErrors,
+                      dot3StatsFCSErrors,
+                      dot3StatsSingleCollisionFrames,
+                      dot3StatsMultipleCollisionFrames,
+                      dot3StatsDeferredTransmissions,
+                      dot3StatsLateCollisions,
+                      dot3StatsExcessiveCollisions,
+                      dot3StatsInternalMacTransmitErrors,
+                      dot3StatsCarrierSenseErrors,
+                      dot3StatsFrameTooLongs,
+                      dot3StatsInternalMacReceiveErrors,
+                      dot3StatsEtherChipSet,
+                      dot3StatsSymbolErrors
+                    }
+        STATUS      deprecated
+        DESCRIPTION "********* THIS GROUP IS DEPRECATED **********
+
+                    A collection of objects providing information
+                    applicable to 100 Mb/sec ethernet-like network
+                    interfaces.
+
+                    This object group has been deprecated and
+
+                    replaced by etherStatsBaseGroup and
+                    etherStatsHighSpeedGroup."
+        ::= { etherGroups 3 }
+
+    etherStatsBaseGroup OBJECT-GROUP
+        OBJECTS     { dot3StatsIndex,
+                      dot3StatsAlignmentErrors,
+                      dot3StatsFCSErrors,
+                      dot3StatsSingleCollisionFrames,
+                      dot3StatsMultipleCollisionFrames,
+                      dot3StatsDeferredTransmissions,
+                      dot3StatsLateCollisions,
+                      dot3StatsExcessiveCollisions,
+                      dot3StatsInternalMacTransmitErrors,
+                      dot3StatsCarrierSenseErrors,
+                      dot3StatsFrameTooLongs,
+                      dot3StatsInternalMacReceiveErrors
+                    }
+        STATUS      current
+        DESCRIPTION "A collection of objects providing information
+                    applicable to all ethernet-like network
+                    interfaces."
+        ::= { etherGroups 4 }
+
+    etherStatsLowSpeedGroup OBJECT-GROUP
+        OBJECTS     { dot3StatsSQETestErrors }
+        STATUS      current
+        DESCRIPTION "A collection of objects providing information
+                    applicable to ethernet-like network interfaces
+                    capable of operating at 10 Mb/s or slower in
+                    half-duplex mode."
+        ::= { etherGroups 5 }
+
+    etherStatsHighSpeedGroup OBJECT-GROUP
+        OBJECTS     { dot3StatsSymbolErrors }
+        STATUS      current
+        DESCRIPTION "A collection of objects providing information
+                    applicable to ethernet-like network interfaces
+                    capable of operating at 100 Mb/s or faster."
+        ::= { etherGroups 6 }
+
+    etherDuplexGroup OBJECT-GROUP
+        OBJECTS     { dot3StatsDuplexStatus }
+        STATUS      current
+        DESCRIPTION "A collection of objects providing information
+                    about the duplex mode of an ethernet-like
+                    network interface."
+        ::= { etherGroups 7 }
+
+    etherControlGroup OBJECT-GROUP
+        OBJECTS     { dot3ControlFunctionsSupported,
+                      dot3ControlInUnknownOpcodes
+                    }
+        STATUS      current
+        DESCRIPTION "A collection of objects providing information
+                    about the MAC Control sublayer on ethernet-like
+                    network interfaces."
+        ::= { etherGroups 8 }
+
+    etherControlPauseGroup OBJECT-GROUP
+        OBJECTS     { dot3PauseAdminMode,
+                      dot3PauseOperMode,
+                      dot3InPauseFrames,
+                      dot3OutPauseFrames
+                    }
+        STATUS      current
+        DESCRIPTION "A collection of objects providing information
+                    about and control of the MAC Control PAUSE
+                    function on ethernet-like network interfaces."
+        ::= { etherGroups 9 }
+
+END
diff -Naur tomato/release/src/router/snmp/mibs/HCNUM-TC.txt tomato121/release/src/router/snmp/mibs/HCNUM-TC.txt
--- tomato/release/src/router/snmp/mibs/HCNUM-TC.txt	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/mibs/HCNUM-TC.txt	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,118 @@
+HCNUM-TC DEFINITIONS ::= BEGIN
+
+IMPORTS
+  MODULE-IDENTITY, mib-2, Counter64
+      FROM SNMPv2-SMI
+  TEXTUAL-CONVENTION
+      FROM SNMPv2-TC;
+
+hcnumTC MODULE-IDENTITY
+  LAST-UPDATED "200006080000Z"
+
+  ORGANIZATION "IETF OPS Area"
+  CONTACT-INFO
+        "        E-mail: mibs@ops.ietf.org
+                 Subscribe: majordomo@psg.com
+                   with msg body: subscribe mibs
+
+                 Andy Bierman
+                 Cisco Systems Inc.
+                 170 West Tasman Drive
+                 San Jose, CA 95134 USA
+                 +1 408-527-3711
+                 abierman@cisco.com
+
+                 Keith McCloghrie
+                 Cisco Systems Inc.
+                 170 West Tasman Drive
+                 San Jose, CA 95134 USA
+                 +1 408-526-5260
+                 kzm@cisco.com
+
+                 Randy Presuhn
+                 BMC Software, Inc.
+                 Office 1-3141
+                 2141 North First Street
+                 San Jose,  California 95131 USA
+                 +1 408 546-1006
+                 rpresuhn@bmc.com"
+  DESCRIPTION
+        "A MIB module containing textual conventions
+         for high capacity data types. This module
+         addresses an immediate need for data types not directly
+         supported in the SMIv2. This short-term solution
+         is meant to be deprecated as a long-term solution
+         is deployed."
+  REVISION        "200006080000Z"
+  DESCRIPTION
+        "Initial Version of the High Capacity Numbers
+         MIB module, published as RFC 2856."
+  ::= { mib-2 78 }
+
+CounterBasedGauge64 ::= TEXTUAL-CONVENTION
+  STATUS       current
+  DESCRIPTION
+        "The CounterBasedGauge64 type represents a non-negative
+        integer, which may increase or decrease, but shall never
+        exceed a maximum value, nor fall below a minimum value. The
+        maximum value can not be greater than 2^64-1
+        (18446744073709551615 decimal), and the minimum value can
+
+        not be smaller than 0.  The value of a CounterBasedGauge64
+        has its maximum value whenever the information being modeled
+        is greater than or equal to its maximum value, and has its
+        minimum value whenever the information being modeled is
+        smaller than or equal to its minimum value.  If the
+        information being modeled subsequently decreases below
+        (increases above) the maximum (minimum) value, the
+        CounterBasedGauge64 also decreases (increases).
+
+        Note that this TC is not strictly supported in SMIv2,
+        because the 'always increasing' and 'counter wrap' semantics
+        associated with the Counter64 base type are not preserved.
+        It is possible that management applications which rely
+        solely upon the (Counter64) ASN.1 tag to determine object
+        semantics will mistakenly operate upon objects of this type
+        as they would for Counter64 objects.
+
+        This textual convention represents a limited and short-term
+        solution, and may be deprecated as a long term solution is
+        defined and deployed to replace it."
+  SYNTAX Counter64
+
+ZeroBasedCounter64 ::= TEXTUAL-CONVENTION
+  STATUS current
+  DESCRIPTION
+        "This TC describes an object which counts events with the
+        following semantics: objects of this type will be set to
+        zero(0) on creation and will thereafter count appropriate
+        events, wrapping back to zero(0) when the value 2^64 is
+        reached.
+
+        Provided that an application discovers the new object within
+        the minimum time to wrap it can use the initial value as a
+        delta since it last polled the table of which this object is
+        part.  It is important for a management station to be aware
+        of this minimum time and the actual time between polls, and
+        to discard data if the actual time is too long or there is
+        no defined minimum time.
+
+        Typically this TC is used in tables where the INDEX space is
+        constantly changing and/or the TimeFilter mechanism is in
+        use.
+
+        Note that this textual convention does not retain all the
+        semantics of the Counter64 base type. Specifically, a
+        Counter64 has an arbitrary initial value, but objects
+        defined with this TC are required to start at the value
+
+        zero.  This behavior is not likely to have any adverse
+        effects on management applications which are expecting
+        Counter64 semantics.
+
+        This textual convention represents a limited and short-term
+        solution, and may be deprecated as a long term solution is
+        defined and deployed to replace it."
+  SYNTAX Counter64
+
+END
diff -Naur tomato/release/src/router/snmp/mibs/HOST-RESOURCES-MIB.txt tomato121/release/src/router/snmp/mibs/HOST-RESOURCES-MIB.txt
--- tomato/release/src/router/snmp/mibs/HOST-RESOURCES-MIB.txt	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/mibs/HOST-RESOURCES-MIB.txt	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,1540 @@
+HOST-RESOURCES-MIB DEFINITIONS ::= BEGIN
+
+IMPORTS
+MODULE-IDENTITY, OBJECT-TYPE, mib-2,
+Integer32, Counter32, Gauge32, TimeTicks  FROM SNMPv2-SMI
+
+TEXTUAL-CONVENTION, DisplayString,
+TruthValue, DateAndTime, AutonomousType   FROM SNMPv2-TC
+
+MODULE-COMPLIANCE, OBJECT-GROUP           FROM SNMPv2-CONF
+
+InterfaceIndexOrZero                      FROM IF-MIB;
+
+hostResourcesMibModule MODULE-IDENTITY
+   LAST-UPDATED "200003060000Z"    -- 6 March 2000
+   ORGANIZATION "IETF Host Resources MIB Working Group"
+   CONTACT-INFO
+       "Steve Waldbusser
+       Postal: Lucent Technologies, Inc.
+               1213 Innsbruck Dr.
+               Sunnyvale, CA 94089
+               USA
+       Phone:  650-318-1251
+       Fax:    650-318-1633
+       Email:  waldbusser@lucent.com
+
+       In addition, the Host Resources MIB mailing list is
+       dedicated to discussion of this MIB. To join the
+       mailing list, send a request message to
+       hostmib-request@andrew.cmu.edu. The mailing list
+       address is hostmib@andrew.cmu.edu."
+   DESCRIPTION
+       "This MIB is for use in managing host systems. The term
+       `host' is construed to mean any computer that communicates
+       with other similar computers attached to the internet and
+       that is directly used by one or more human beings. Although
+       this MIB does not necessarily apply to devices whose primary
+       function is communications services (e.g., terminal servers,
+       routers, bridges, monitoring equipment), such relevance is
+       not explicitly precluded.  This MIB instruments attributes
+       common to all internet hosts including, for example, both
+       personal computers and systems that run variants of Unix."
+
+   REVISION "200003060000Z"        -- 6 March 2000
+   DESCRIPTION
+       "Clarifications and bug fixes based on implementation
+       experience.  This revision was also reformatted in the SMIv2
+       format. The revisions made were:
+
+       New RFC document standards:
+          Added Copyright notice, updated introduction to SNMP
+          Framework, updated references section, added reference to
+          RFC 2119, and added a meaningful Security Considerations
+          section.
+
+       New IANA considerations section for registration of new types
+
+       Conversion to new SMIv2 syntax for the following types and
+       macros:
+           Counter32, Integer32, Gauge32, MODULE-IDENTITY,
+           OBJECT-TYPE, TEXTUAL-CONVENTION, OBJECT-IDENTITY,
+           MODULE-COMPLIANCE, OBJECT-GROUP
+
+       Used new Textual Conventions:
+           TruthValue, DateAndTime, AutonomousType,
+           InterfaceIndexOrZero
+
+       Fixed typo in hrPrinterStatus.
+
+       Added missing error bits to hrPrinterDetectedErrorState and
+       clarified confusion resulting from suggested mappings to
+       hrPrinterStatus.
+
+       Clarified that size of objects of type
+       InternationalDisplayString is number of octets, not number
+       of encoded symbols.
+
+       Clarified the use of the following objects based on
+       implementation experience:
+           hrSystemInitialLoadDevice, hrSystemInitialLoadParameters,
+           hrMemorySize, hrStorageSize, hrStorageAllocationFailures,
+           hrDeviceErrors, hrProcessorLoad, hrNetworkIfIndex,
+           hrDiskStorageCapacity, hrSWRunStatus, hrSWRunPerfCPU,
+           and hrSWInstalledDate.
+
+       Clarified implementation technique for hrSWInstalledTable.
+
+       Used new AUGMENTS clause for hrSWRunPerfTable.
+
+       Added Internationalization Considerations section.
+
+This revision published as RFC2790."
+
+   REVISION "9910202200Z"    -- 20 October, 1999
+   DESCRIPTION
+       "The original version of this MIB, published as
+       RFC1514."
+   ::= { hrMIBAdminInfo 1 }
+
+host     OBJECT IDENTIFIER ::= { mib-2 25 }
+
+hrSystem        OBJECT IDENTIFIER ::= { host 1 }
+hrStorage       OBJECT IDENTIFIER ::= { host 2 }
+hrDevice        OBJECT IDENTIFIER ::= { host 3 }
+hrSWRun         OBJECT IDENTIFIER ::= { host 4 }
+hrSWRunPerf     OBJECT IDENTIFIER ::= { host 5 }
+hrSWInstalled   OBJECT IDENTIFIER ::= { host 6 }
+hrMIBAdminInfo  OBJECT IDENTIFIER ::= { host 7 }
+
+-- textual conventions
+
+KBytes ::= TEXTUAL-CONVENTION
+    STATUS current
+    DESCRIPTION
+        "Storage size, expressed in units of 1024 bytes."
+    SYNTAX Integer32 (0..2147483647)
+
+ProductID ::= TEXTUAL-CONVENTION
+    STATUS current
+    DESCRIPTION
+        "This textual convention is intended to identify the
+
+        manufacturer, model, and version of a specific
+        hardware or software product.  It is suggested that
+        these OBJECT IDENTIFIERs are allocated such that all
+        products from a particular manufacturer are registered
+        under a subtree distinct to that manufacturer.  In
+        addition, all versions of a product should be
+        registered under a subtree distinct to that product.
+        With this strategy, a management station may uniquely
+        determine the manufacturer and/or model of a product
+        whose productID is unknown to the management station.
+        Objects of this type may be useful for inventory
+        purposes or for automatically detecting
+        incompatibilities or version mismatches between
+        various hardware and software components on a system.
+
+        For example, the product ID for the ACME 4860 66MHz
+        clock doubled processor might be:
+        enterprises.acme.acmeProcessors.a4860DX2.MHz66
+
+        A software product might be registered as:
+        enterprises.acme.acmeOperatingSystems.acmeDOS.six(6).one(1)
+        "
+    SYNTAX OBJECT IDENTIFIER
+
+-- unknownProduct will be used for any unknown ProductID
+-- unknownProduct OBJECT IDENTIFIER ::= { 0 0 }
+
+InternationalDisplayString ::= TEXTUAL-CONVENTION
+    STATUS current
+    DESCRIPTION
+        "This data type is used to model textual information
+        in some character set.  A network management station
+        should use a local algorithm to determine which
+        character set is in use and how it should be
+        displayed.  Note that this character set may be
+        encoded with more than one octet per symbol, but will
+        most often be NVT ASCII. When a size clause is
+        specified for an object of this type, the size refers
+        to the length in octets, not the number of symbols."
+    SYNTAX OCTET STRING
+
+-- The Host Resources System Group
+
+hrSystemUptime OBJECT-TYPE
+    SYNTAX     TimeTicks
+    MAX-ACCESS read-only
+    STATUS     current
+    DESCRIPTION
+        "The amount of time since this host was last
+        initialized.  Note that this is different from
+        sysUpTime in the SNMPv2-MIB [RFC1907] because
+        sysUpTime is the uptime of the network management
+        portion of the system."
+    ::= { hrSystem 1 }
+
+hrSystemDate OBJECT-TYPE
+    SYNTAX     DateAndTime
+    MAX-ACCESS read-write
+    STATUS     current
+    DESCRIPTION
+        "The host's notion of the local date and time of day."
+    ::= { hrSystem 2 }
+
+hrSystemInitialLoadDevice OBJECT-TYPE
+    SYNTAX     Integer32 (1..2147483647)
+    MAX-ACCESS read-write
+    STATUS     current
+    DESCRIPTION
+        "The index of the hrDeviceEntry for the device from
+        which this host is configured to load its initial
+        operating system configuration (i.e., which operating
+        system code and/or boot parameters).
+
+        Note that writing to this object just changes the
+        configuration that will be used the next time the
+        operating system is loaded and does not actually cause
+        the reload to occur."
+    ::= { hrSystem 3 }
+
+hrSystemInitialLoadParameters OBJECT-TYPE
+    SYNTAX     InternationalDisplayString (SIZE (0..128))
+    MAX-ACCESS read-write
+    STATUS     current
+    DESCRIPTION
+        "This object contains the parameters (e.g. a pathname
+        and parameter) supplied to the load device when
+        requesting the initial operating system configuration
+        from that device.
+
+     Note that writing to this object just changes the
+     configuration that will be used the next time the
+     operating system is loaded and does not actually cause
+     the reload to occur."
+    ::= { hrSystem 4 }
+
+hrSystemNumUsers OBJECT-TYPE
+    SYNTAX     Gauge32
+    MAX-ACCESS read-only
+    STATUS     current
+    DESCRIPTION
+        "The number of user sessions for which this host is
+        storing state information.  A session is a collection
+        of processes requiring a single act of user
+        authentication and possibly subject to collective job
+        control."
+    ::= { hrSystem 5 }
+
+hrSystemProcesses OBJECT-TYPE
+    SYNTAX     Gauge32
+    MAX-ACCESS read-only
+    STATUS     current
+    DESCRIPTION
+        "The number of process contexts currently loaded or
+        running on this system."
+    ::= { hrSystem 6 }
+
+hrSystemMaxProcesses OBJECT-TYPE
+    SYNTAX     Integer32 (0..2147483647)
+    MAX-ACCESS read-only
+    STATUS     current
+    DESCRIPTION
+        "The maximum number of process contexts this system
+        can support.  If there is no fixed maximum, the value
+        should be zero.  On systems that have a fixed maximum,
+        this object can help diagnose failures that occur when
+        this maximum is reached."
+    ::= { hrSystem 7 }
+
+-- The Host Resources Storage Group
+
+-- Registration point for storage types, for use with hrStorageType.
+-- These are defined in the HOST-RESOURCES-TYPES module.
+hrStorageTypes          OBJECT IDENTIFIER ::= { hrStorage 1 }
+
+hrMemorySize OBJECT-TYPE
+    SYNTAX     KBytes
+    UNITS      "KBytes"
+    MAX-ACCESS read-only
+    STATUS     current
+    DESCRIPTION
+        "The amount of physical read-write main memory,
+        typically RAM, contained by the host."
+    ::= { hrStorage 2 }
+
+hrStorageTable OBJECT-TYPE
+    SYNTAX     SEQUENCE OF HrStorageEntry
+    MAX-ACCESS not-accessible
+    STATUS     current
+    DESCRIPTION
+        "The (conceptual) table of logical storage areas on
+        the host.
+
+        An entry shall be placed in the storage table for each
+        logical area of storage that is allocated and has
+        fixed resource limits.  The amount of storage
+        represented in an entity is the amount actually usable
+        by the requesting entity, and excludes loss due to
+        formatting or file system reference information.
+
+        These entries are associated with logical storage
+        areas, as might be seen by an application, rather than
+        physical storage entities which are typically seen by
+        an operating system.  Storage such as tapes and
+        floppies without file systems on them are typically
+        not allocated in chunks by the operating system to
+        requesting applications, and therefore shouldn't
+        appear in this table.  Examples of valid storage for
+        this table include disk partitions, file systems, ram
+        (for some architectures this is further segmented into
+        regular memory, extended memory, and so on), backing
+        store for virtual memory (`swap space').
+
+        This table is intended to be a useful diagnostic for
+        `out of memory' and `out of buffers' types of
+        failures.  In addition, it can be a useful performance
+        monitoring tool for tracking memory, disk, or buffer
+        usage."
+    ::= { hrStorage 3 }
+
+hrStorageEntry OBJECT-TYPE
+    SYNTAX     HrStorageEntry
+    MAX-ACCESS not-accessible
+    STATUS     current
+    DESCRIPTION
+        "A (conceptual) entry for one logical storage area on
+        the host.  As an example, an instance of the
+        hrStorageType object might be named hrStorageType.3"
+    INDEX { hrStorageIndex }
+    ::= { hrStorageTable 1 }
+
+HrStorageEntry ::= SEQUENCE {
+        hrStorageIndex               Integer32,
+        hrStorageType                AutonomousType,
+        hrStorageDescr               DisplayString,
+        hrStorageAllocationUnits     Integer32,
+        hrStorageSize                Integer32,
+        hrStorageUsed                Integer32,
+        hrStorageAllocationFailures  Counter32
+    }
+
+hrStorageIndex OBJECT-TYPE
+    SYNTAX     Integer32 (1..2147483647)
+    MAX-ACCESS read-only
+    STATUS     current
+    DESCRIPTION
+        "A unique value for each logical storage area
+        contained by the host."
+    ::= { hrStorageEntry 1 }
+
+hrStorageType OBJECT-TYPE
+    SYNTAX     AutonomousType
+    MAX-ACCESS read-only
+    STATUS     current
+    DESCRIPTION
+        "The type of storage represented by this entry."
+    ::= { hrStorageEntry 2 }
+
+hrStorageDescr OBJECT-TYPE
+    SYNTAX     DisplayString
+    MAX-ACCESS read-only
+    STATUS     current
+    DESCRIPTION
+        "A description of the type and instance of the storage
+        described by this entry."
+    ::= { hrStorageEntry 3 }
+
+hrStorageAllocationUnits OBJECT-TYPE
+    SYNTAX     Integer32 (1..2147483647)
+    UNITS      "Bytes"
+    MAX-ACCESS read-only
+    STATUS     current
+    DESCRIPTION
+        "The size, in bytes, of the data objects allocated
+        from this pool.  If this entry is monitoring sectors,
+        blocks, buffers, or packets, for example, this number
+        will commonly be greater than one.  Otherwise this
+        number will typically be one."
+    ::= { hrStorageEntry 4 }
+
+hrStorageSize OBJECT-TYPE
+    SYNTAX     Integer32 (0..2147483647)
+    MAX-ACCESS read-write
+    STATUS     current
+    DESCRIPTION
+        "The size of the storage represented by this entry, in
+        units of hrStorageAllocationUnits. This object is
+        writable to allow remote configuration of the size of
+        the storage area in those cases where such an
+        operation makes sense and is possible on the
+        underlying system. For example, the amount of main
+        memory allocated to a buffer pool might be modified or
+        the amount of disk space allocated to virtual memory
+        might be modified."
+    ::= { hrStorageEntry 5 }
+
+hrStorageUsed OBJECT-TYPE
+    SYNTAX     Integer32 (0..2147483647)
+    MAX-ACCESS read-only
+    STATUS     current
+    DESCRIPTION
+        "The amount of the storage represented by this entry
+        that is allocated, in units of
+        hrStorageAllocationUnits."
+    ::= { hrStorageEntry 6 }
+
+hrStorageAllocationFailures OBJECT-TYPE
+    SYNTAX     Counter32
+    MAX-ACCESS read-only
+    STATUS     current
+    DESCRIPTION
+        "The number of requests for storage represented by
+        this entry that could not be honored due to not enough
+        storage.  It should be noted that as this object has a
+        SYNTAX of Counter32, that it does not have a defined
+        initial value.  However, it is recommended that this
+        object be initialized to zero, even though management
+        stations must not depend on such an initialization."
+    ::= { hrStorageEntry 7 }
+
+-- The Host Resources Device Group
+--
+-- The device group is useful for identifying and diagnosing the
+-- devices on a system.  The hrDeviceTable contains common
+-- information for any type of device.  In addition, some devices
+-- have device-specific tables for more detailed information.  More
+-- such tables may be defined in the future for other device types.
+
+-- Registration point for device types, for use with hrDeviceType.
+
+-- These are defined in the HOST-RESOURCES-TYPES module.
+hrDeviceTypes             OBJECT IDENTIFIER ::= { hrDevice 1 }
+
+hrDeviceTable OBJECT-TYPE
+    SYNTAX     SEQUENCE OF HrDeviceEntry
+    MAX-ACCESS not-accessible
+    STATUS     current
+    DESCRIPTION
+        "The (conceptual) table of devices contained by the
+        host."
+    ::= { hrDevice 2 }
+
+hrDeviceEntry OBJECT-TYPE
+    SYNTAX     HrDeviceEntry
+    MAX-ACCESS not-accessible
+    STATUS     current
+    DESCRIPTION
+        "A (conceptual) entry for one device contained by the
+        host.  As an example, an instance of the hrDeviceType
+        object might be named hrDeviceType.3"
+    INDEX { hrDeviceIndex }
+    ::= { hrDeviceTable 1 }
+
+HrDeviceEntry ::= SEQUENCE {
+        hrDeviceIndex           Integer32,
+        hrDeviceType            AutonomousType,
+        hrDeviceDescr           DisplayString,
+        hrDeviceID              ProductID,
+        hrDeviceStatus          INTEGER,
+        hrDeviceErrors          Counter32
+    }
+
+hrDeviceIndex OBJECT-TYPE
+    SYNTAX     Integer32 (1..2147483647)
+    MAX-ACCESS read-only
+    STATUS     current
+    DESCRIPTION
+        "A unique value for each device contained by the host.
+        The value for each device must remain constant at
+        least from one re-initialization of the agent to the
+        next re-initialization."
+    ::= { hrDeviceEntry 1 }
+
+hrDeviceType OBJECT-TYPE
+    SYNTAX     AutonomousType
+    MAX-ACCESS read-only
+    STATUS     current
+    DESCRIPTION
+        "An indication of the type of device.
+
+        If this value is
+        `hrDeviceProcessor { hrDeviceTypes 3 }' then an entry
+        exists in the hrProcessorTable which corresponds to
+        this device.
+
+        If this value is
+        `hrDeviceNetwork { hrDeviceTypes 4 }', then an entry
+        exists in the hrNetworkTable which corresponds to this
+        device.
+
+        If this value is
+        `hrDevicePrinter { hrDeviceTypes 5 }', then an entry
+        exists in the hrPrinterTable which corresponds to this
+        device.
+
+        If this value is
+        `hrDeviceDiskStorage { hrDeviceTypes 6 }', then an
+        entry exists in the hrDiskStorageTable which
+        corresponds to this device."
+    ::= { hrDeviceEntry 2 }
+
+hrDeviceDescr OBJECT-TYPE
+    SYNTAX     DisplayString (SIZE (0..64))
+    MAX-ACCESS read-only
+    STATUS     current
+    DESCRIPTION
+        "A textual description of this device, including the
+        device's manufacturer and revision, and optionally,
+        its serial number."
+    ::= { hrDeviceEntry 3 }
+
+hrDeviceID OBJECT-TYPE
+    SYNTAX     ProductID
+    MAX-ACCESS read-only
+    STATUS     current
+    DESCRIPTION
+        "The product ID for this device."
+    ::= { hrDeviceEntry 4 }
+
+hrDeviceStatus OBJECT-TYPE
+    SYNTAX     INTEGER {
+                   unknown(1),
+                   running(2),
+                   warning(3),
+                   testing(4),
+                   down(5)
+
+               }
+    MAX-ACCESS read-only
+    STATUS     current
+    DESCRIPTION
+        "The current operational state of the device described
+        by this row of the table.  A value unknown(1)
+        indicates that the current state of the device is
+        unknown.  running(2) indicates that the device is up
+        and running and that no unusual error conditions are
+        known.  The warning(3) state indicates that agent has
+        been informed of an unusual error condition by the
+        operational software (e.g., a disk device driver) but
+        that the device is still 'operational'.  An example
+        would be a high number of soft errors on a disk.  A
+        value of testing(4), indicates that the device is not
+        available for use because it is in the testing state.
+        The state of down(5) is used only when the agent has
+        been informed that the device is not available for any
+        use."
+    ::= { hrDeviceEntry 5 }
+
+hrDeviceErrors OBJECT-TYPE
+    SYNTAX     Counter32
+    MAX-ACCESS read-only
+    STATUS     current
+    DESCRIPTION
+        "The number of errors detected on this device.  It
+        should be noted that as this object has a SYNTAX of
+        Counter32, that it does not have a defined initial
+        value.  However, it is recommended that this object be
+        initialized to zero, even though management stations
+        must not depend on such an initialization."
+    ::= { hrDeviceEntry 6 }
+
+hrProcessorTable OBJECT-TYPE
+    SYNTAX     SEQUENCE OF HrProcessorEntry
+    MAX-ACCESS not-accessible
+    STATUS     current
+    DESCRIPTION
+        "The (conceptual) table of processors contained by the
+        host.
+
+        Note that this table is potentially sparse: a
+        (conceptual) entry exists only if the correspondent
+        value of the hrDeviceType object is
+        `hrDeviceProcessor'."
+    ::= { hrDevice 3 }
+
+hrProcessorEntry OBJECT-TYPE
+    SYNTAX     HrProcessorEntry
+    MAX-ACCESS not-accessible
+    STATUS     current
+    DESCRIPTION
+        "A (conceptual) entry for one processor contained by
+        the host.  The hrDeviceIndex in the index represents
+        the entry in the hrDeviceTable that corresponds to the
+        hrProcessorEntry.
+
+        As an example of how objects in this table are named,
+        an instance of the hrProcessorFrwID object might be
+        named hrProcessorFrwID.3"
+    INDEX { hrDeviceIndex }
+    ::= { hrProcessorTable 1 }
+
+HrProcessorEntry ::= SEQUENCE {
+        hrProcessorFrwID            ProductID,
+        hrProcessorLoad             Integer32
+    }
+
+hrProcessorFrwID OBJECT-TYPE
+    SYNTAX     ProductID
+    MAX-ACCESS read-only
+    STATUS     current
+    DESCRIPTION
+        "The product ID of the firmware associated with the
+        processor."
+    ::= { hrProcessorEntry 1 }
+
+hrProcessorLoad OBJECT-TYPE
+    SYNTAX     Integer32 (0..100)
+    MAX-ACCESS read-only
+    STATUS     current
+    DESCRIPTION
+        "The average, over the last minute, of the percentage
+        of time that this processor was not idle.
+        Implementations may approximate this one minute
+        smoothing period if necessary."
+    ::= { hrProcessorEntry 2 }
+
+hrNetworkTable OBJECT-TYPE
+    SYNTAX     SEQUENCE OF HrNetworkEntry
+    MAX-ACCESS not-accessible
+    STATUS     current
+    DESCRIPTION
+        "The (conceptual) table of network devices contained
+        by the host.
+
+        Note that this table is potentially sparse: a
+        (conceptual) entry exists only if the correspondent
+        value of the hrDeviceType object is
+        `hrDeviceNetwork'."
+    ::= { hrDevice 4 }
+
+hrNetworkEntry OBJECT-TYPE
+    SYNTAX     HrNetworkEntry
+    MAX-ACCESS not-accessible
+    STATUS     current
+    DESCRIPTION
+        "A (conceptual) entry for one network device contained
+        by the host.  The hrDeviceIndex in the index
+        represents the entry in the hrDeviceTable that
+        corresponds to the hrNetworkEntry.
+
+        As an example of how objects in this table are named,
+        an instance of the hrNetworkIfIndex object might be
+        named hrNetworkIfIndex.3"
+    INDEX { hrDeviceIndex }
+    ::= { hrNetworkTable 1 }
+
+HrNetworkEntry ::= SEQUENCE {
+        hrNetworkIfIndex    InterfaceIndexOrZero
+    }
+
+hrNetworkIfIndex OBJECT-TYPE
+    SYNTAX     InterfaceIndexOrZero
+    MAX-ACCESS read-only
+    STATUS     current
+    DESCRIPTION
+        "The value of ifIndex which corresponds to this
+        network device. If this device is not represented in
+        the ifTable, then this value shall be zero."
+    ::= { hrNetworkEntry 1 }
+
+hrPrinterTable OBJECT-TYPE
+    SYNTAX     SEQUENCE OF HrPrinterEntry
+    MAX-ACCESS not-accessible
+    STATUS     current
+    DESCRIPTION
+        "The (conceptual) table of printers local to the host.
+
+        Note that this table is potentially sparse: a
+        (conceptual) entry exists only if the correspondent
+        value of the hrDeviceType object is
+        `hrDevicePrinter'."
+    ::= { hrDevice 5 }
+
+hrPrinterEntry OBJECT-TYPE
+    SYNTAX     HrPrinterEntry
+    MAX-ACCESS not-accessible
+    STATUS     current
+    DESCRIPTION
+        "A (conceptual) entry for one printer local to the
+        host.  The hrDeviceIndex in the index represents the
+        entry in the hrDeviceTable that corresponds to the
+        hrPrinterEntry.
+
+        As an example of how objects in this table are named,
+        an instance of the hrPrinterStatus object might be
+        named hrPrinterStatus.3"
+    INDEX { hrDeviceIndex }
+    ::= { hrPrinterTable 1 }
+
+HrPrinterEntry ::= SEQUENCE {
+        hrPrinterStatus             INTEGER,
+        hrPrinterDetectedErrorState OCTET STRING
+    }
+
+hrPrinterStatus OBJECT-TYPE
+    SYNTAX     INTEGER {
+                   other(1),
+                   unknown(2),
+                   idle(3),
+                   printing(4),
+                   warmup(5)
+               }
+    MAX-ACCESS read-only
+    STATUS     current
+    DESCRIPTION
+        "The current status of this printer device."
+    ::= { hrPrinterEntry 1 }
+
+hrPrinterDetectedErrorState OBJECT-TYPE
+    SYNTAX     OCTET STRING
+    MAX-ACCESS read-only
+    STATUS     current
+    DESCRIPTION
+        "This object represents any error conditions detected
+        by the printer.  The error conditions are encoded as
+        bits in an octet string, with the following
+        definitions:
+
+             Condition         Bit #
+
+             lowPaper              0
+
+             noPaper               1
+             lowToner              2
+             noToner               3
+             doorOpen              4
+             jammed                5
+             offline               6
+             serviceRequested      7
+             inputTrayMissing      8
+             outputTrayMissing     9
+             markerSupplyMissing  10
+             outputNearFull       11
+             outputFull           12
+             inputTrayEmpty       13
+             overduePreventMaint  14
+
+        Bits are numbered starting with the most significant
+        bit of the first byte being bit 0, the least
+        significant bit of the first byte being bit 7, the
+        most significant bit of the second byte being bit 8,
+        and so on.  A one bit encodes that the condition was
+        detected, while a zero bit encodes that the condition
+        was not detected.
+
+        This object is useful for alerting an operator to
+        specific warning or error conditions that may occur,
+        especially those requiring human intervention."
+    ::= { hrPrinterEntry 2 }
+
+hrDiskStorageTable OBJECT-TYPE
+    SYNTAX     SEQUENCE OF HrDiskStorageEntry
+    MAX-ACCESS not-accessible
+    STATUS     current
+    DESCRIPTION
+        "The (conceptual) table of long-term storage devices
+        contained by the host.  In particular, disk devices
+        accessed remotely over a network are not included
+        here.
+
+        Note that this table is potentially sparse: a
+        (conceptual) entry exists only if the correspondent
+        value of the hrDeviceType object is
+        `hrDeviceDiskStorage'."
+    ::= { hrDevice 6 }
+
+hrDiskStorageEntry OBJECT-TYPE
+    SYNTAX     HrDiskStorageEntry
+    MAX-ACCESS not-accessible
+    STATUS     current
+    DESCRIPTION
+        "A (conceptual) entry for one long-term storage device
+        contained by the host.  The hrDeviceIndex in the index
+        represents the entry in the hrDeviceTable that
+        corresponds to the hrDiskStorageEntry. As an example,
+        an instance of the hrDiskStorageCapacity object might
+        be named hrDiskStorageCapacity.3"
+    INDEX { hrDeviceIndex }
+    ::= { hrDiskStorageTable 1 }
+
+HrDiskStorageEntry ::= SEQUENCE {
+        hrDiskStorageAccess         INTEGER,
+        hrDiskStorageMedia          INTEGER,
+        hrDiskStorageRemoveble      TruthValue,
+        hrDiskStorageCapacity       KBytes
+    }
+
+hrDiskStorageAccess OBJECT-TYPE
+    SYNTAX     INTEGER {
+                   readWrite(1),
+                   readOnly(2)
+               }
+    MAX-ACCESS read-only
+    STATUS     current
+    DESCRIPTION
+        "An indication if this long-term storage device is
+        readable and writable or only readable.  This should
+        reflect the media type, any write-protect mechanism,
+        and any device configuration that affects the entire
+        device."
+    ::= { hrDiskStorageEntry 1 }
+
+hrDiskStorageMedia OBJECT-TYPE
+    SYNTAX     INTEGER {
+                   other(1),
+                   unknown(2),
+                   hardDisk(3),
+                   floppyDisk(4),
+                   opticalDiskROM(5),
+                   opticalDiskWORM(6),     -- Write Once Read Many
+                   opticalDiskRW(7),
+                   ramDisk(8)
+               }
+    MAX-ACCESS read-only
+    STATUS     current
+    DESCRIPTION
+        "An indication of the type of media used in this long-
+        term storage device."
+    ::= { hrDiskStorageEntry 2 }
+
+hrDiskStorageRemoveble OBJECT-TYPE
+    SYNTAX     TruthValue
+    MAX-ACCESS read-only
+    STATUS     current
+    DESCRIPTION
+        "Denotes whether or not the disk media may be removed
+        from the drive."
+    ::= { hrDiskStorageEntry 3 }
+
+hrDiskStorageCapacity OBJECT-TYPE
+    SYNTAX     KBytes
+    UNITS      "KBytes"
+    MAX-ACCESS read-only
+    STATUS     current
+    DESCRIPTION
+        "The total size for this long-term storage device. If
+        the media is removable and is currently removed, this
+        value should be zero."
+    ::= { hrDiskStorageEntry 4 }
+
+hrPartitionTable OBJECT-TYPE
+    SYNTAX     SEQUENCE OF HrPartitionEntry
+    MAX-ACCESS not-accessible
+    STATUS     current
+    DESCRIPTION
+        "The (conceptual) table of partitions for long-term
+        storage devices contained by the host.  In particular,
+        partitions accessed remotely over a network are not
+        included here."
+    ::= { hrDevice 7 }
+
+hrPartitionEntry OBJECT-TYPE
+    SYNTAX     HrPartitionEntry
+    MAX-ACCESS not-accessible
+    STATUS     current
+    DESCRIPTION
+        "A (conceptual) entry for one partition.  The
+        hrDeviceIndex in the index represents the entry in the
+        hrDeviceTable that corresponds to the
+        hrPartitionEntry.
+
+        As an example of how objects in this table are named,
+        an instance of the hrPartitionSize object might be
+        named hrPartitionSize.3.1"
+    INDEX { hrDeviceIndex, hrPartitionIndex }
+    ::= { hrPartitionTable 1 }
+
+HrPartitionEntry ::= SEQUENCE {
+        hrPartitionIndex                Integer32,
+        hrPartitionLabel                InternationalDisplayString,
+        hrPartitionID                   OCTET STRING,
+        hrPartitionSize                 KBytes,
+        hrPartitionFSIndex              Integer32
+    }
+
+hrPartitionIndex OBJECT-TYPE
+    SYNTAX     Integer32 (1..2147483647)
+    MAX-ACCESS read-only
+    STATUS     current
+    DESCRIPTION
+        "A unique value for each partition on this long-term
+        storage device.  The value for each long-term storage
+        device must remain constant at least from one re-
+        initialization of the agent to the next re-
+        initialization."
+    ::= { hrPartitionEntry 1 }
+
+hrPartitionLabel OBJECT-TYPE
+    SYNTAX     InternationalDisplayString (SIZE (0..128))
+    MAX-ACCESS read-only
+    STATUS     current
+    DESCRIPTION
+        "A textual description of this partition."
+    ::= { hrPartitionEntry 2 }
+
+hrPartitionID OBJECT-TYPE
+    SYNTAX     OCTET STRING
+    MAX-ACCESS read-only
+    STATUS     current
+    DESCRIPTION
+        "A descriptor which uniquely represents this partition
+        to the responsible operating system.  On some systems,
+        this might take on a binary representation."
+    ::= { hrPartitionEntry 3 }
+
+hrPartitionSize OBJECT-TYPE
+    SYNTAX     KBytes
+    UNITS      "KBytes"
+    MAX-ACCESS read-only
+    STATUS     current
+    DESCRIPTION
+        "The size of this partition."
+    ::= { hrPartitionEntry 4 }
+
+hrPartitionFSIndex OBJECT-TYPE
+    SYNTAX     Integer32 (0..2147483647)
+    MAX-ACCESS read-only
+    STATUS     current
+    DESCRIPTION
+        "The index of the file system mounted on this
+        partition.  If no file system is mounted on this
+        partition, then this value shall be zero.  Note that
+        multiple partitions may point to one file system,
+        denoting that that file system resides on those
+        partitions.  Multiple file systems may not reside on
+        one partition."
+    ::= { hrPartitionEntry 5 }
+
+-- The File System Table
+
+-- Registration point for popular File System types,
+-- for use with hrFSType. These are defined in the
+-- HOST-RESOURCES-TYPES module.
+hrFSTypes               OBJECT IDENTIFIER ::= { hrDevice 9 }
+
+hrFSTable OBJECT-TYPE
+    SYNTAX     SEQUENCE OF HrFSEntry
+    MAX-ACCESS not-accessible
+    STATUS     current
+    DESCRIPTION
+        "The (conceptual) table of file systems local to this
+        host or remotely mounted from a file server.  File
+        systems that are in only one user's environment on a
+        multi-user system will not be included in this table."
+    ::= { hrDevice 8 }
+
+hrFSEntry OBJECT-TYPE
+    SYNTAX     HrFSEntry
+    MAX-ACCESS not-accessible
+    STATUS     current
+    DESCRIPTION
+        "A (conceptual) entry for one file system local to
+        this host or remotely mounted from a file server.
+        File systems that are in only one user's environment
+        on a multi-user system will not be included in this
+        table.
+
+        As an example of how objects in this table are named,
+        an instance of the hrFSMountPoint object might be
+        named hrFSMountPoint.3"
+    INDEX { hrFSIndex }
+    ::= { hrFSTable 1 }
+
+HrFSEntry ::= SEQUENCE {
+        hrFSIndex                   Integer32,
+        hrFSMountPoint              InternationalDisplayString,
+        hrFSRemoteMountPoint        InternationalDisplayString,
+        hrFSType                    AutonomousType,
+        hrFSAccess                  INTEGER,
+        hrFSBootable                TruthValue,
+        hrFSStorageIndex            Integer32,
+        hrFSLastFullBackupDate      DateAndTime,
+        hrFSLastPartialBackupDate   DateAndTime
+    }
+
+hrFSIndex OBJECT-TYPE
+    SYNTAX     Integer32 (1..2147483647)
+    MAX-ACCESS read-only
+    STATUS     current
+    DESCRIPTION
+        "A unique value for each file system local to this
+        host.  The value for each file system must remain
+        constant at least from one re-initialization of the
+        agent to the next re-initialization."
+    ::= { hrFSEntry 1 }
+
+hrFSMountPoint OBJECT-TYPE
+    SYNTAX     InternationalDisplayString (SIZE(0..128))
+    MAX-ACCESS read-only
+    STATUS     current
+    DESCRIPTION
+        "The path name of the root of this file system."
+    ::= { hrFSEntry 2 }
+
+hrFSRemoteMountPoint OBJECT-TYPE
+    SYNTAX     InternationalDisplayString (SIZE(0..128))
+    MAX-ACCESS read-only
+    STATUS     current
+    DESCRIPTION
+        "A description of the name and/or address of the
+        server that this file system is mounted from.  This
+        may also include parameters such as the mount point on
+        the remote file system.  If this is not a remote file
+        system, this string should have a length of zero."
+    ::= { hrFSEntry 3 }
+
+hrFSType OBJECT-TYPE
+    SYNTAX     AutonomousType
+    MAX-ACCESS read-only
+    STATUS     current
+    DESCRIPTION
+        "The value of this object identifies the type of this
+        file system."
+    ::= { hrFSEntry 4 }
+
+hrFSAccess OBJECT-TYPE
+    SYNTAX     INTEGER {
+                   readWrite(1),
+                   readOnly(2)
+               }
+    MAX-ACCESS read-only
+    STATUS     current
+    DESCRIPTION
+        "An indication if this file system is logically
+        configured by the operating system to be readable and
+        writable or only readable.  This does not represent
+        any local access-control policy, except one that is
+        applied to the file system as a whole."
+    ::= { hrFSEntry 5 }
+
+hrFSBootable OBJECT-TYPE
+    SYNTAX     TruthValue
+    MAX-ACCESS read-only
+    STATUS     current
+    DESCRIPTION
+        "A flag indicating whether this file system is
+        bootable."
+    ::= { hrFSEntry 6 }
+
+hrFSStorageIndex OBJECT-TYPE
+    SYNTAX     Integer32 (0..2147483647)
+    MAX-ACCESS read-only
+    STATUS     current
+    DESCRIPTION
+        "The index of the hrStorageEntry that represents
+        information about this file system.  If there is no
+        such information available, then this value shall be
+        zero.  The relevant storage entry will be useful in
+        tracking the percent usage of this file system and
+        diagnosing errors that may occur when it runs out of
+        space."
+    ::= { hrFSEntry 7 }
+
+hrFSLastFullBackupDate OBJECT-TYPE
+    SYNTAX     DateAndTime
+    MAX-ACCESS read-write
+    STATUS     current
+    DESCRIPTION
+        "The last date at which this complete file system was
+
+        copied to another storage device for backup.  This
+        information is useful for ensuring that backups are
+        being performed regularly.
+
+        If this information is not known, then this variable
+        shall have the value corresponding to January 1, year
+        0000, 00:00:00.0, which is encoded as
+        (hex)'00 00 01 01 00 00 00 00'."
+    ::= { hrFSEntry 8 }
+
+hrFSLastPartialBackupDate OBJECT-TYPE
+    SYNTAX     DateAndTime
+    MAX-ACCESS read-write
+    STATUS     current
+    DESCRIPTION
+        "The last date at which a portion of this file system
+        was copied to another storage device for backup.  This
+        information is useful for ensuring that backups are
+        being performed regularly.
+
+        If this information is not known, then this variable
+        shall have the value corresponding to January 1, year
+        0000, 00:00:00.0, which is encoded as
+        (hex)'00 00 01 01 00 00 00 00'."
+    ::= { hrFSEntry 9 }
+
+-- The Host Resources Running Software Group
+--
+-- The hrSWRunTable contains an entry for each distinct piece of
+-- software that is running or loaded into physical or virtual
+-- memory in preparation for running.  This includes the host's
+-- operating system, device drivers, and applications.
+
+hrSWOSIndex OBJECT-TYPE
+    SYNTAX     Integer32 (1..2147483647)
+    MAX-ACCESS read-only
+    STATUS     current
+    DESCRIPTION
+        "The value of the hrSWRunIndex for the hrSWRunEntry
+        that represents the primary operating system running
+        on this host.  This object is useful for quickly and
+        uniquely identifying that primary operating system."
+    ::= { hrSWRun 1 }
+
+hrSWRunTable OBJECT-TYPE
+    SYNTAX     SEQUENCE OF HrSWRunEntry
+    MAX-ACCESS not-accessible
+    STATUS     current
+    DESCRIPTION
+        "The (conceptual) table of software running on the
+        host."
+    ::= { hrSWRun 2 }
+
+hrSWRunEntry OBJECT-TYPE
+    SYNTAX     HrSWRunEntry
+    MAX-ACCESS not-accessible
+    STATUS     current
+    DESCRIPTION
+        "A (conceptual) entry for one piece of software
+        running on the host Note that because the installed
+        software table only contains information for software
+        stored locally on this host, not every piece of
+        running software will be found in the installed
+        software table.  This is true of software that was
+        loaded and run from a non-local source, such as a
+        network-mounted file system.
+
+        As an example of how objects in this table are named,
+        an instance of the hrSWRunName object might be named
+        hrSWRunName.1287"
+    INDEX { hrSWRunIndex }
+    ::= { hrSWRunTable 1 }
+
+HrSWRunEntry ::= SEQUENCE {
+        hrSWRunIndex       Integer32,
+        hrSWRunName        InternationalDisplayString,
+        hrSWRunID          ProductID,
+        hrSWRunPath        InternationalDisplayString,
+        hrSWRunParameters  InternationalDisplayString,
+        hrSWRunType        INTEGER,
+        hrSWRunStatus      INTEGER
+    }
+
+hrSWRunIndex OBJECT-TYPE
+    SYNTAX     Integer32 (1..2147483647)
+    MAX-ACCESS read-only
+    STATUS     current
+    DESCRIPTION
+        "A unique value for each piece of software running on
+        the host.  Wherever possible, this should be the
+        system's native, unique identification number."
+    ::= { hrSWRunEntry 1 }
+
+hrSWRunName OBJECT-TYPE
+    SYNTAX     InternationalDisplayString (SIZE (0..64))
+    MAX-ACCESS read-only
+    STATUS     current
+    DESCRIPTION
+        "A textual description of this running piece of
+        software, including the manufacturer, revision,  and
+        the name by which it is commonly known.  If this
+        software was installed locally, this should be the
+        same string as used in the corresponding
+        hrSWInstalledName."
+    ::= { hrSWRunEntry 2 }
+
+hrSWRunID OBJECT-TYPE
+    SYNTAX     ProductID
+    MAX-ACCESS read-only
+    STATUS     current
+    DESCRIPTION
+        "The product ID of this running piece of software."
+    ::= { hrSWRunEntry 3 }
+
+hrSWRunPath OBJECT-TYPE
+    SYNTAX     InternationalDisplayString (SIZE(0..128))
+    MAX-ACCESS read-only
+    STATUS     current
+    DESCRIPTION
+        "A description of the location on long-term storage
+        (e.g. a disk drive) from which this software was
+        loaded."
+    ::= { hrSWRunEntry 4 }
+
+hrSWRunParameters OBJECT-TYPE
+    SYNTAX     InternationalDisplayString (SIZE(0..128))
+    MAX-ACCESS read-only
+    STATUS     current
+    DESCRIPTION
+        "A description of the parameters supplied to this
+        software when it was initially loaded."
+    ::= { hrSWRunEntry 5 }
+
+hrSWRunType OBJECT-TYPE
+    SYNTAX     INTEGER {
+                   unknown(1),
+                   operatingSystem(2),
+                   deviceDriver(3),
+                   application(4)
+               }
+    MAX-ACCESS read-only
+    STATUS     current
+    DESCRIPTION
+        "The type of this software."
+    ::= { hrSWRunEntry 6 }
+
+hrSWRunStatus OBJECT-TYPE
+    SYNTAX     INTEGER {
+                   running(1),
+                   runnable(2),    -- waiting for resource
+                                   -- (i.e., CPU, memory, IO)
+                   notRunnable(3), -- loaded but waiting for event
+                   invalid(4)      -- not loaded
+               }
+    MAX-ACCESS read-write
+    STATUS     current
+    DESCRIPTION
+        "The status of this running piece of software.
+        Setting this value to invalid(4) shall cause this
+        software to stop running and to be unloaded. Sets to
+        other values are not valid."
+    ::= { hrSWRunEntry 7 }
+
+-- The Host Resources Running Software Performance Group
+--
+-- The hrSWRunPerfTable contains an entry corresponding to
+-- each entry in the hrSWRunTable.
+
+hrSWRunPerfTable OBJECT-TYPE
+    SYNTAX     SEQUENCE OF HrSWRunPerfEntry
+    MAX-ACCESS not-accessible
+    STATUS     current
+    DESCRIPTION
+        "The (conceptual) table of running software
+        performance metrics."
+    ::= { hrSWRunPerf 1 }
+
+hrSWRunPerfEntry OBJECT-TYPE
+    SYNTAX     HrSWRunPerfEntry
+    MAX-ACCESS not-accessible
+    STATUS     current
+    DESCRIPTION
+        "A (conceptual) entry containing software performance
+        metrics.  As an example, an instance of the
+        hrSWRunPerfCPU object might be named
+        hrSWRunPerfCPU.1287"
+    AUGMENTS { hrSWRunEntry }  -- This table augments information in
+                               -- the hrSWRunTable.
+    ::= { hrSWRunPerfTable 1 }
+
+HrSWRunPerfEntry ::= SEQUENCE {
+        hrSWRunPerfCPU          Integer32,
+        hrSWRunPerfMem          KBytes
+}
+
+hrSWRunPerfCPU OBJECT-TYPE
+    SYNTAX     Integer32 (0..2147483647)
+    MAX-ACCESS read-only
+    STATUS     current
+    DESCRIPTION
+        "The number of centi-seconds of the total system's CPU
+        resources consumed by this process.  Note that on a
+        multi-processor system, this value may increment by
+        more than one centi-second in one centi-second of real
+        (wall clock) time."
+    ::= { hrSWRunPerfEntry 1 }
+
+hrSWRunPerfMem OBJECT-TYPE
+    SYNTAX     KBytes
+    UNITS      "KBytes"
+    MAX-ACCESS read-only
+    STATUS     current
+    DESCRIPTION
+        "The total amount of real system memory allocated to
+        this process."
+    ::= { hrSWRunPerfEntry 2 }
+
+-- The Host Resources Installed Software Group
+--
+-- The hrSWInstalledTable contains an entry for each piece
+-- of software installed in long-term storage (e.g. a disk
+-- drive) locally on this host.  Note that this does not
+-- include software loadable remotely from a network
+-- server.
+--
+-- Different implementations may track software in varying
+-- ways. For example, while some implementations may track
+-- executable files as distinct pieces of software, other
+-- implementations may use other strategies such as keeping
+-- track of software "packages" (e.g., related groups of files)
+-- or keeping track of system or application "patches".
+--
+-- This table is useful for identifying and inventorying
+-- software on a host and for diagnosing incompatibility
+-- and version mismatch problems between various pieces
+-- of hardware and software.
+
+hrSWInstalledLastChange OBJECT-TYPE
+    SYNTAX     TimeTicks
+    MAX-ACCESS read-only
+    STATUS     current
+    DESCRIPTION
+        "The value of sysUpTime when an entry in the
+        hrSWInstalledTable was last added, renamed, or
+        deleted.  Because this table is likely to contain many
+        entries, polling of this object allows a management
+        station to determine when re-downloading of the table
+        might be useful."
+    ::= { hrSWInstalled 1 }
+
+hrSWInstalledLastUpdateTime OBJECT-TYPE
+    SYNTAX     TimeTicks
+    MAX-ACCESS read-only
+    STATUS     current
+    DESCRIPTION
+        "The value of sysUpTime when the hrSWInstalledTable
+        was last completely updated.  Because caching of this
+        data will be a popular implementation strategy,
+        retrieval of this object allows a management station
+        to obtain a guarantee that no data in this table is
+        older than the indicated time."
+    ::= { hrSWInstalled 2 }
+
+hrSWInstalledTable OBJECT-TYPE
+    SYNTAX     SEQUENCE OF HrSWInstalledEntry
+    MAX-ACCESS not-accessible
+    STATUS     current
+    DESCRIPTION
+        "The (conceptual) table of software installed on this
+        host."
+    ::= { hrSWInstalled 3 }
+
+hrSWInstalledEntry OBJECT-TYPE
+    SYNTAX     HrSWInstalledEntry
+    MAX-ACCESS not-accessible
+    STATUS     current
+    DESCRIPTION
+        "A (conceptual) entry for a piece of software
+        installed on this host.
+
+        As an example of how objects in this table are named,
+        an instance of the hrSWInstalledName object might be
+        named hrSWInstalledName.96"
+    INDEX { hrSWInstalledIndex }
+    ::= { hrSWInstalledTable 1 }
+
+HrSWInstalledEntry ::= SEQUENCE {
+        hrSWInstalledIndex       Integer32,
+        hrSWInstalledName        InternationalDisplayString,
+        hrSWInstalledID          ProductID,
+        hrSWInstalledType        INTEGER,
+        hrSWInstalledDate        DateAndTime
+}
+
+hrSWInstalledIndex OBJECT-TYPE
+    SYNTAX     Integer32 (1..2147483647)
+    MAX-ACCESS read-only
+    STATUS     current
+    DESCRIPTION
+        "A unique value for each piece of software installed
+        on the host.  This value shall be in the range from 1
+        to the number of pieces of software installed on the
+        host."
+    ::= { hrSWInstalledEntry 1 }
+
+hrSWInstalledName OBJECT-TYPE
+    SYNTAX     InternationalDisplayString (SIZE (0..64))
+    MAX-ACCESS read-only
+    STATUS     current
+    DESCRIPTION
+        "A textual description of this installed piece of
+        software, including the manufacturer, revision, the
+        name by which it is commonly known, and optionally,
+        its serial number."
+    ::= { hrSWInstalledEntry 2 }
+
+hrSWInstalledID OBJECT-TYPE
+    SYNTAX     ProductID
+    MAX-ACCESS read-only
+    STATUS     current
+    DESCRIPTION
+        "The product ID of this installed piece of software."
+    ::= { hrSWInstalledEntry 3 }
+
+hrSWInstalledType OBJECT-TYPE
+    SYNTAX     INTEGER {
+                   unknown(1),
+                   operatingSystem(2),
+                   deviceDriver(3),
+                   application(4)
+               }
+    MAX-ACCESS read-only
+    STATUS     current
+    DESCRIPTION
+        "The type of this software."
+    ::= { hrSWInstalledEntry 4 }
+
+hrSWInstalledDate OBJECT-TYPE
+    SYNTAX     DateAndTime
+    MAX-ACCESS read-only
+    STATUS     current
+    DESCRIPTION
+        "The last-modification date of this application as it
+        would appear in a directory listing.
+
+        If this information is not known, then this variable
+        shall have the value corresponding to January 1, year
+        0000, 00:00:00.0, which is encoded as
+        (hex)'00 00 01 01 00 00 00 00'."
+    ::= { hrSWInstalledEntry 5 }
+
+-- Conformance information
+
+hrMIBCompliances OBJECT IDENTIFIER ::= { hrMIBAdminInfo 2 }
+hrMIBGroups      OBJECT IDENTIFIER ::= { hrMIBAdminInfo 3 }
+
+-- Compliance Statements
+hrMIBCompliance MODULE-COMPLIANCE
+    STATUS current
+    DESCRIPTION
+        "The requirements for conformance to the Host Resources MIB."
+    MODULE -- this module
+      MANDATORY-GROUPS { hrSystemGroup, hrStorageGroup,
+                         hrDeviceGroup }
+
+      OBJECT hrSystemDate
+          MIN-ACCESS read-only
+          DESCRIPTION
+              "Write access is not required."
+
+      OBJECT hrSystemInitialLoadDevice
+          MIN-ACCESS read-only
+          DESCRIPTION
+              "Write access is not required."
+
+      OBJECT hrSystemInitialLoadParameters
+          MIN-ACCESS read-only
+          DESCRIPTION
+              "Write access is not required."
+
+      OBJECT hrStorageSize
+          MIN-ACCESS read-only
+          DESCRIPTION
+              "Write access is not required."
+
+      OBJECT hrFSLastFullBackupDate
+          MIN-ACCESS read-only
+          DESCRIPTION
+              "Write access is not required."
+
+      OBJECT hrFSLastPartialBackupDate
+          MIN-ACCESS read-only
+          DESCRIPTION
+              "Write access is not required."
+
+      GROUP hrSWRunGroup
+          DESCRIPTION
+              "The Running Software Group. Implementation
+              of this group is mandatory only when the
+              hrSWRunPerfGroup is implemented."
+
+      OBJECT hrSWRunStatus
+          MIN-ACCESS read-only
+          DESCRIPTION
+              "Write access is not required."
+
+      GROUP hrSWRunPerfGroup
+          DESCRIPTION
+              "The Running Software Performance Group.
+              Implementation of this group is at the discretion
+              of the implementor."
+
+      GROUP hrSWInstalledGroup
+          DESCRIPTION
+              "The Installed Software Group.
+              Implementation of this group is at the discretion
+              of the implementor."
+    ::= { hrMIBCompliances 1 }
+
+    hrSystemGroup OBJECT-GROUP
+        OBJECTS {
+            hrSystemUptime, hrSystemDate,
+            hrSystemInitialLoadDevice,
+            hrSystemInitialLoadParameters,
+            hrSystemNumUsers, hrSystemProcesses,
+            hrSystemMaxProcesses
+        }
+        STATUS current
+        DESCRIPTION
+            "The Host Resources System Group."
+        ::= { hrMIBGroups 1 }
+
+    hrStorageGroup OBJECT-GROUP
+        OBJECTS {
+            hrMemorySize, hrStorageIndex, hrStorageType,
+            hrStorageDescr, hrStorageAllocationUnits,
+            hrStorageSize, hrStorageUsed,
+            hrStorageAllocationFailures
+        }
+        STATUS current
+        DESCRIPTION
+            "The Host Resources Storage Group."
+        ::= { hrMIBGroups 2 }
+
+    hrDeviceGroup OBJECT-GROUP
+        OBJECTS {
+            hrDeviceIndex, hrDeviceType, hrDeviceDescr,
+            hrDeviceID, hrDeviceStatus, hrDeviceErrors,
+            hrProcessorFrwID, hrProcessorLoad,
+            hrNetworkIfIndex, hrPrinterStatus,
+            hrPrinterDetectedErrorState,
+            hrDiskStorageAccess, hrDiskStorageMedia,
+            hrDiskStorageRemoveble, hrDiskStorageCapacity,
+            hrPartitionIndex, hrPartitionLabel,
+            hrPartitionID, hrPartitionSize,
+            hrPartitionFSIndex, hrFSIndex, hrFSMountPoint,
+            hrFSRemoteMountPoint, hrFSType, hrFSAccess,
+            hrFSBootable, hrFSStorageIndex,
+            hrFSLastFullBackupDate,
+            hrFSLastPartialBackupDate
+        }
+        STATUS current
+        DESCRIPTION
+            "The Host Resources Device Group."
+        ::= { hrMIBGroups 3 }
+
+    hrSWRunGroup OBJECT-GROUP
+        OBJECTS {
+            hrSWOSIndex, hrSWRunIndex, hrSWRunName,
+            hrSWRunID, hrSWRunPath, hrSWRunParameters,
+            hrSWRunType, hrSWRunStatus
+        }
+        STATUS current
+        DESCRIPTION
+            "The Host Resources Running Software Group."
+        ::= { hrMIBGroups 4 }
+
+    hrSWRunPerfGroup OBJECT-GROUP
+        OBJECTS { hrSWRunPerfCPU, hrSWRunPerfMem }
+        STATUS current
+        DESCRIPTION
+            "The Host Resources Running Software
+            Performance Group."
+        ::= { hrMIBGroups 5 }
+
+    hrSWInstalledGroup OBJECT-GROUP
+        OBJECTS {
+            hrSWInstalledLastChange,
+            hrSWInstalledLastUpdateTime,
+            hrSWInstalledIndex, hrSWInstalledName,
+            hrSWInstalledID, hrSWInstalledType,
+            hrSWInstalledDate
+        }
+        STATUS current
+        DESCRIPTION
+            "The Host Resources Installed Software Group."
+        ::= { hrMIBGroups 6 }
+
+END
diff -Naur tomato/release/src/router/snmp/mibs/HOST-RESOURCES-TYPES.txt tomato121/release/src/router/snmp/mibs/HOST-RESOURCES-TYPES.txt
--- tomato/release/src/router/snmp/mibs/HOST-RESOURCES-TYPES.txt	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/mibs/HOST-RESOURCES-TYPES.txt	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,389 @@
+HOST-RESOURCES-TYPES DEFINITIONS ::= BEGIN
+
+IMPORTS
+  MODULE-IDENTITY, OBJECT-IDENTITY        FROM SNMPv2-SMI
+  hrMIBAdminInfo, hrStorage, hrDevice     FROM HOST-RESOURCES-MIB;
+
+hostResourcesTypesModule MODULE-IDENTITY
+  LAST-UPDATED "200003060000Z"    -- 6 March, 2000
+  ORGANIZATION "IETF Host Resources MIB Working Group"
+  CONTACT-INFO
+      "Steve Waldbusser
+      Postal: Lucent Technologies, Inc.
+              1213 Innsbruck Dr.
+              Sunnyvale, CA 94089
+              USA
+      Phone: 650-318-1251
+      Fax:   650-318-1633
+      Email: waldbusser@ins.com
+
+      In addition, the Host Resources MIB mailing list is dedicated
+      to discussion of this MIB. To join the mailing list, send a
+      request message to hostmib-request@andrew.cmu.edu. The mailing
+      list address is hostmib@andrew.cmu.edu."
+  DESCRIPTION
+      "This MIB module registers type definitions for
+      storage types, device types, and file system types.
+
+      After the initial revision, this module will be
+      maintained by IANA."
+  REVISION "200003060000Z"    -- 6 March 2000
+  DESCRIPTION
+      "The original version of this module, published as RFC
+      2790."
+  ::= { hrMIBAdminInfo 4 }
+
+-- Registrations for some storage types, for use with hrStorageType
+hrStorageTypes          OBJECT IDENTIFIER ::= { hrStorage 1 }
+
+hrStorageOther OBJECT-IDENTITY
+    STATUS current
+    DESCRIPTION
+        "The storage type identifier used when no other defined
+        type is appropriate."
+    ::= { hrStorageTypes 1 }
+
+hrStorageRam OBJECT-IDENTITY
+    STATUS current
+    DESCRIPTION
+        "The storage type identifier used for RAM."
+    ::= { hrStorageTypes 2 }
+
+hrStorageVirtualMemory OBJECT-IDENTITY
+    STATUS current
+    DESCRIPTION
+        "The storage type identifier used for virtual memory,
+        temporary storage of swapped or paged memory."
+    ::= { hrStorageTypes 3 }
+
+hrStorageFixedDisk OBJECT-IDENTITY
+    STATUS current
+    DESCRIPTION
+        "The storage type identifier used for non-removable
+        rigid rotating magnetic storage devices."
+    ::= { hrStorageTypes 4 }
+
+hrStorageRemovableDisk OBJECT-IDENTITY
+    STATUS current
+    DESCRIPTION
+        "The storage type identifier used for removable rigid
+        rotating magnetic storage devices."
+    ::= { hrStorageTypes 5 }
+
+hrStorageFloppyDisk OBJECT-IDENTITY
+    STATUS current
+    DESCRIPTION
+        "The storage type identifier used for non-rigid rotating
+        magnetic storage devices."
+    ::= { hrStorageTypes 6 }
+
+hrStorageCompactDisc OBJECT-IDENTITY
+    STATUS current
+    DESCRIPTION
+        "The storage type identifier used for read-only rotating
+        optical storage devices."
+    ::= { hrStorageTypes 7 }
+
+hrStorageRamDisk OBJECT-IDENTITY
+    STATUS current
+    DESCRIPTION
+        "The storage type identifier used for a file system that
+        is stored in RAM."
+    ::= { hrStorageTypes 8 }
+
+hrStorageFlashMemory OBJECT-IDENTITY
+    STATUS current
+    DESCRIPTION
+        "The storage type identifier used for flash memory."
+    ::= { hrStorageTypes 9 }
+
+hrStorageNetworkDisk OBJECT-IDENTITY
+    STATUS current
+    DESCRIPTION
+        "The storage type identifier used for a
+        networked file system."
+    ::= { hrStorageTypes 10 }
+
+-- Registrations for some device types, for use with hrDeviceType
+hrDeviceTypes             OBJECT IDENTIFIER ::= { hrDevice 1 }
+
+hrDeviceOther OBJECT-IDENTITY
+    STATUS current
+    DESCRIPTION
+        "The device type identifier used when no other defined
+        type is appropriate."
+    ::= { hrDeviceTypes 1 }
+
+hrDeviceUnknown OBJECT-IDENTITY
+    STATUS current
+    DESCRIPTION
+        "The device type identifier used when the device type is
+        unknown."
+    ::= { hrDeviceTypes 2 }
+
+hrDeviceProcessor OBJECT-IDENTITY
+    STATUS current
+    DESCRIPTION
+        "The device type identifier used for a CPU."
+    ::= { hrDeviceTypes 3 }
+
+hrDeviceNetwork OBJECT-IDENTITY
+    STATUS current
+    DESCRIPTION
+        "The device type identifier used for a network interface."
+    ::= { hrDeviceTypes 4 }
+
+hrDevicePrinter OBJECT-IDENTITY
+    STATUS current
+    DESCRIPTION
+        "The device type identifier used for a printer."
+    ::= { hrDeviceTypes 5 }
+
+hrDeviceDiskStorage OBJECT-IDENTITY
+    STATUS current
+    DESCRIPTION
+        "The device type identifier used for a disk drive."
+    ::= { hrDeviceTypes 6 }
+
+hrDeviceVideo OBJECT-IDENTITY
+    STATUS current
+    DESCRIPTION
+        "The device type identifier used for a video device."
+    ::= { hrDeviceTypes 10 }
+
+hrDeviceAudio OBJECT-IDENTITY
+    STATUS current
+    DESCRIPTION
+        "The device type identifier used for an audio device."
+    ::= { hrDeviceTypes 11 }
+
+hrDeviceCoprocessor OBJECT-IDENTITY
+    STATUS current
+    DESCRIPTION
+        "The device type identifier used for a co-processor."
+    ::= { hrDeviceTypes 12 }
+
+hrDeviceKeyboard OBJECT-IDENTITY
+    STATUS current
+    DESCRIPTION
+        "The device type identifier used for a keyboard device."
+    ::= { hrDeviceTypes 13 }
+
+hrDeviceModem OBJECT-IDENTITY
+    STATUS current
+    DESCRIPTION
+        "The device type identifier used for a modem."
+    ::= { hrDeviceTypes 14 }
+
+hrDeviceParallelPort OBJECT-IDENTITY
+    STATUS current
+    DESCRIPTION
+        "The device type identifier used for a parallel port."
+    ::= { hrDeviceTypes 15 }
+
+hrDevicePointing OBJECT-IDENTITY
+    STATUS current
+    DESCRIPTION
+        "The device type identifier used for a pointing device
+        (e.g., a mouse)."
+    ::= { hrDeviceTypes 16 }
+
+hrDeviceSerialPort OBJECT-IDENTITY
+    STATUS current
+    DESCRIPTION
+        "The device type identifier used for a serial port."
+    ::= { hrDeviceTypes 17 }
+
+hrDeviceTape OBJECT-IDENTITY
+    STATUS current
+    DESCRIPTION
+        "The device type identifier used for a tape storage device."
+    ::= { hrDeviceTypes 18 }
+
+hrDeviceClock OBJECT-IDENTITY
+    STATUS current
+    DESCRIPTION
+        "The device type identifier used for a clock device."
+    ::= { hrDeviceTypes 19 }
+
+hrDeviceVolatileMemory OBJECT-IDENTITY
+    STATUS current
+    DESCRIPTION
+        "The device type identifier used for a volatile memory
+        storage device."
+    ::= { hrDeviceTypes 20 }
+
+hrDeviceNonVolatileMemory OBJECT-IDENTITY
+    STATUS current
+    DESCRIPTION
+        "The device type identifier used for a non-volatile memory
+
+        storage device."
+    ::= { hrDeviceTypes 21 }
+
+-- Registrations for some popular File System types,
+-- for use with hrFSType.
+hrFSTypes               OBJECT IDENTIFIER ::= { hrDevice 9 }
+
+hrFSOther OBJECT-IDENTITY
+    STATUS  current
+    DESCRIPTION
+        "The file system type identifier used when no other
+        defined type is appropriate."
+    ::= { hrFSTypes 1 }
+
+hrFSUnknown OBJECT-IDENTITY
+    STATUS  current
+    DESCRIPTION
+        "The file system type identifier used when the type of
+        file system is unknown."
+    ::= { hrFSTypes 2 }
+
+hrFSBerkeleyFFS OBJECT-IDENTITY
+    STATUS  current
+    DESCRIPTION
+        "The file system type identifier used for the
+        Berkeley Fast File System."
+    ::= { hrFSTypes 3 }
+
+hrFSSys5FS OBJECT-IDENTITY
+    STATUS  current
+    DESCRIPTION
+        "The file system type identifier used for the
+        System V File System."
+    ::= { hrFSTypes 4 }
+
+hrFSFat OBJECT-IDENTITY
+    STATUS  current
+    DESCRIPTION
+        "The file system type identifier used for
+        DOS's FAT file system."
+    ::= { hrFSTypes 5 }
+
+hrFSHPFS OBJECT-IDENTITY
+    STATUS  current
+    DESCRIPTION
+        "The file system type identifier used for OS/2's
+        High Performance File System."
+    ::= { hrFSTypes 6 }
+
+hrFSHFS OBJECT-IDENTITY
+    STATUS  current
+    DESCRIPTION
+        "The file system type identifier used for the
+        Macintosh Hierarchical File System."
+    ::= { hrFSTypes 7 }
+
+hrFSMFS OBJECT-IDENTITY
+    STATUS  current
+    DESCRIPTION
+        "The file system type identifier used for the
+        Macintosh File System."
+    ::= { hrFSTypes 8 }
+
+hrFSNTFS OBJECT-IDENTITY
+    STATUS  current
+    DESCRIPTION
+        "The file system type identifier used for the
+        Windows NT File System."
+    ::= { hrFSTypes 9 }
+
+hrFSVNode OBJECT-IDENTITY
+    STATUS  current
+    DESCRIPTION
+        "The file system type identifier used for the
+        VNode File System."
+    ::= { hrFSTypes 10 }
+
+hrFSJournaled OBJECT-IDENTITY
+    STATUS  current
+    DESCRIPTION
+        "The file system type identifier used for the
+        Journaled File System."
+    ::= { hrFSTypes 11 }
+
+hrFSiso9660 OBJECT-IDENTITY
+    STATUS  current
+    DESCRIPTION
+        "The file system type identifier used for the
+        ISO 9660 File System for CD's."
+    ::= { hrFSTypes 12 }
+
+hrFSRockRidge OBJECT-IDENTITY
+    STATUS  current
+    DESCRIPTION
+        "The file system type identifier used for the
+        RockRidge File System for CD's."
+    ::= { hrFSTypes 13 }
+
+hrFSNFS OBJECT-IDENTITY
+    STATUS  current
+    DESCRIPTION
+        "The file system type identifier used for the
+        NFS File System."
+    ::= { hrFSTypes 14 }
+
+hrFSNetware OBJECT-IDENTITY
+    STATUS  current
+    DESCRIPTION
+        "The file system type identifier used for the
+        Netware File System."
+    ::= { hrFSTypes 15 }
+
+hrFSAFS OBJECT-IDENTITY
+    STATUS  current
+    DESCRIPTION
+        "The file system type identifier used for the
+        Andrew File System."
+    ::= { hrFSTypes 16 }
+
+hrFSDFS OBJECT-IDENTITY
+    STATUS  current
+    DESCRIPTION
+        "The file system type identifier used for the
+        OSF DCE Distributed File System."
+    ::= { hrFSTypes 17 }
+
+hrFSAppleshare OBJECT-IDENTITY
+    STATUS  current
+    DESCRIPTION
+        "The file system type identifier used for the
+        AppleShare File System."
+    ::= { hrFSTypes 18 }
+
+hrFSRFS OBJECT-IDENTITY
+    STATUS  current
+    DESCRIPTION
+        "The file system type identifier used for the
+        RFS File System."
+    ::= { hrFSTypes 19 }
+
+hrFSDGCFS OBJECT-IDENTITY
+    STATUS  current
+    DESCRIPTION
+        "The file system type identifier used for the
+        Data General DGCFS."
+    ::= { hrFSTypes 20 }
+
+hrFSBFS OBJECT-IDENTITY
+    STATUS  current
+    DESCRIPTION
+        "The file system type identifier used for the
+        SVR4 Boot File System."
+    ::= { hrFSTypes 21 }
+
+hrFSFAT32 OBJECT-IDENTITY
+    STATUS  current
+    DESCRIPTION
+        "The file system type identifier used for the
+        Windows FAT32 File System."
+    ::= { hrFSTypes 22 }
+
+hrFSLinuxExt2 OBJECT-IDENTITY
+    STATUS  current
+    DESCRIPTION
+        "The file system type identifier used for the
+        Linux EXT2 File System."
+    ::= { hrFSTypes 23 }
+
+END
diff -Naur tomato/release/src/router/snmp/mibs/IANA-ADDRESS-FAMILY-NUMBERS-MIB.txt tomato121/release/src/router/snmp/mibs/IANA-ADDRESS-FAMILY-NUMBERS-MIB.txt
--- tomato/release/src/router/snmp/mibs/IANA-ADDRESS-FAMILY-NUMBERS-MIB.txt	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/mibs/IANA-ADDRESS-FAMILY-NUMBERS-MIB.txt	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,121 @@
+  IANA-ADDRESS-FAMILY-NUMBERS-MIB DEFINITIONS ::= BEGIN
+
+  IMPORTS
+      MODULE-IDENTITY,
+      mib-2                               FROM SNMPv2-SMI
+      TEXTUAL-CONVENTION                  FROM SNMPv2-TC;
+
+  ianaAddressFamilyNumbers MODULE-IDENTITY
+      LAST-UPDATED "200203140000Z"  -- March 14, 2002
+      ORGANIZATION "IANA"
+      CONTACT-INFO
+          "Postal:    Internet Assigned Numbers Authority
+                      Internet Corporation for Assigned Names
+		      and Numbers
+                      4676 Admiralty Way, Suite 330
+                      Marina del Rey, CA 90292-6601
+                      USA
+
+          Tel:    +1  310-823-9358
+          E-Mail: iana@iana.org"
+      DESCRIPTION
+          "The MIB module defines the AddressFamilyNumbers
+          textual convention."
+
+      -- revision history
+
+      REVISION     "200203140000Z"  -- March 14, 2002
+      DESCRIPTION  "AddressFamilyNumbers assignment 22 to 
+                   fibreChannelWWPN. AddressFamilyNumbers 
+                   assignment 23 to fibreChannelWWNN.
+                   AddressFamilyNumers assignment 24 to gwid."
+
+      REVISION     "200009080000Z"  -- September 8, 2000
+      DESCRIPTION  "AddressFamilyNumbers assignment 19 to xtpOverIpv4.  
+                   AddressFamilyNumbers assignment 20 to xtpOverIpv6.  
+                   AddressFamilyNumbers assignment 21 to xtpNativeModeXTP."
+
+      REVISION     "200003010000Z"  -- March 1, 2000
+      DESCRIPTION  "AddressFamilyNumbers assignment 17 to distinguishedName. 
+                   AddressFamilyNumbers assignment 18 to asNumber."
+
+      REVISION     "200002040000Z"  -- February 4, 2000
+      DESCRIPTION  "AddressFamilyNumbers assignment 16 to dns."
+
+      REVISION     "9908260000Z"  -- August 26, 1999
+      DESCRIPTION  "Initial version, published as RFC 2677."
+      ::= { mib-2 72 }
+
+  AddressFamilyNumbers ::= TEXTUAL-CONVENTION
+      STATUS       current
+      DESCRIPTION
+          "The definition of this textual convention with the
+          addition of newly assigned values is published
+          periodically by the IANA, in either the Assigned
+          Numbers RFC, or some derivative of it specific to
+          Internet Network Management number assignments.
+          (The latest arrangements can be obtained by
+          contacting the IANA.)
+
+          The enumerations are described as:
+
+          other(0),    -- none of the following
+          ipV4(1),     -- IP Version 4
+          ipV6(2),     -- IP Version 6
+          nsap(3),     -- NSAP
+          hdlc(4),     -- (8-bit multidrop)
+          bbn1822(5),
+          all802(6),   -- (includes all 802 media
+                       --   plus Ethernet 'canonical format')
+          e163(7),
+          e164(8),     -- (SMDS, Frame Relay, ATM)
+          f69(9),      -- (Telex)
+          x121(10),    -- (X.25, Frame Relay)
+          ipx(11),     -- IPX (Internet Protocol Exchange)
+          appleTalk(12),  -- Apple Talk
+          decnetIV(13),   -- DEC Net Phase IV
+          banyanVines(14),  -- Banyan Vines
+          e164withNsap(15),
+                       -- (E.164 with NSAP format subaddress)
+          dns(16),     -- (Domain Name System)
+          distinguishedName(17), -- (Distinguished Name, per X.500)
+          asNumber(18), -- (16-bit quantity, per the AS number space)
+          xtpOverIpv4(19),  -- XTP over IP version 4
+          xtpOverIpv6(20),  -- XTP over IP version 6
+          xtpNativeModeXTP(21),  -- XTP native mode XTP
+          fibreChannelWWPN(22),  -- Fibre Channel World-Wide Port Name 
+          fibreChannelWWNN(23),  -- Fibre Channel World-Wide Node Name
+          gwid(24),    -- Gateway Identifier 
+          reserved(65535)
+
+          Requests for new values should be made to IANA via
+          email (iana@iana.org)."
+      SYNTAX  INTEGER {
+                  other(0),
+                  ipV4(1),
+                  ipV6(2),
+                  nsap(3),
+                  hdlc(4),
+                  bbn1822(5),
+                  all802(6),
+                  e163(7),
+                  e164(8),
+                  f69(9),
+                  x121(10),
+                  ipx(11),
+                  appleTalk(12),
+                  decnetIV(13),
+                  banyanVines(14),
+                  e164withNsap(15),
+                  dns(16),
+                  distinguishedName(17), -- (Distinguished Name, per X.500)
+                  asNumber(18), -- (16-bit quantity, per the AS number space)
+                  xtpOverIpv4(19),
+                  xtpOverIpv6(20),
+                  xtpNativeModeXTP(21),
+                  fibreChannelWWPN(22),
+                  fibreChannelWWNN(23),
+                  gwid(24),
+                  reserved(65535)
+              }
+      END
diff -Naur tomato/release/src/router/snmp/mibs/IANAifType-MIB.txt tomato121/release/src/router/snmp/mibs/IANAifType-MIB.txt
--- tomato/release/src/router/snmp/mibs/IANAifType-MIB.txt	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/mibs/IANAifType-MIB.txt	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,380 @@
+   IANAifType-MIB DEFINITIONS ::= BEGIN
+
+   IMPORTS
+       MODULE-IDENTITY, mib-2      FROM SNMPv2-SMI
+       TEXTUAL-CONVENTION          FROM SNMPv2-TC;
+
+   ianaifType MODULE-IDENTITY
+       LAST-UPDATED "200210170000Z"  -- Oct 17, 2002
+       ORGANIZATION "IANA"
+       CONTACT-INFO "        Internet Assigned Numbers Authority
+
+                     Postal: ICANN
+                             4676 Admiralty Way, Suite 330
+                             Marina del Rey, CA 90292
+
+                     Tel:    +1 310 823 9358
+                     E-Mail: iana@iana.org"
+       DESCRIPTION  "This MIB module defines the IANAifType Textual
+                     Convention, and thus the enumerated values of
+                     the ifType object defined in MIB-II's ifTable."
+
+       REVISION     "200210170000Z"  -- Oct 17, 2002
+       DESCRIPTION  "Registration of new IANAifType
+                    219."
+
+	   REVISION     "200207160000Z"  -- Jul 16, 2002
+       DESCRIPTION  "Registration of new IANAifTypes
+                    217 and 218."
+
+       REVISION     "200207100000Z"  -- Jul 10, 2002
+       DESCRIPTION  "Registration of new IANAifTypes
+                    215 and 216."
+
+       REVISION     "200206190000Z"  -- Jun 19, 2002
+       DESCRIPTION  "Registration of new IANAifType
+                    214."
+
+       REVISION     "200201040000Z"  -- Jan 4, 2002
+       DESCRIPTION  "Registration of new IANAifTypes
+                    211, 212 and 213."
+
+       REVISION     "200112200000Z"  -- Dec 20, 2001
+       DESCRIPTION  "Registration of new IANAifTypes
+                    209 and 210."
+
+       REVISION     "200111150000Z"  -- Nov 15, 2001
+       DESCRIPTION  "Registration of new IANAifTypes
+                    207 and 208."
+
+       REVISION     "200111060000Z"  -- Nov 6, 2001
+       DESCRIPTION  "Registration of new IANAifType
+                    206."
+
+       REVISION     "200111020000Z"  -- Nov 2, 2001
+       DESCRIPTION  "Registration of new IANAifType
+                    205."
+
+       REVISION     "200110160000Z"  -- Oct 16, 2001
+       DESCRIPTION  "Registration of new IANAifTypes
+                    199, 200, 201, 202, 203, and 204."
+
+       REVISION     "200109190000Z"  -- Sept 19, 2001
+       DESCRIPTION  "Registration of new IANAifType
+                    198."
+
+       REVISION     "200105110000Z"  -- May 11, 2001
+       DESCRIPTION  "Registration of new IANAifType
+                    197."
+
+       REVISION     "200101120000Z"  -- Jan 12, 2001
+       DESCRIPTION  "Registration of new IANAifTypes
+                    195 and 196."
+
+       REVISION     "200012190000Z"  -- Dec 19, 2000
+       DESCRIPTION  "Registration of new IANAifTypes
+                    193 and 194."
+
+       REVISION     "200012070000Z"  -- Dec 07, 2000
+       DESCRIPTION  "Registration of new IANAifTypes
+                    191 and 192."
+
+       REVISION     "200012040000Z"  -- Dec 04, 2000
+       DESCRIPTION  "Registration of new IANAifType
+                    190."
+
+       REVISION     "200010170000Z"  -- Oct 17, 2000
+       DESCRIPTION  "Registration of new IANAifTypes
+                    188 and 189."  
+
+       REVISION     "200010020000Z"  -- Oct 02, 2000
+       DESCRIPTION  "Registration of new IANAifType 187." 
+
+       REVISION     "200009010000Z"  -- Sept 01, 2000
+       DESCRIPTION  "Registration of new IANAifTypes
+                     184, 185, and 186."			
+
+       REVISION     "200008240000Z"  -- Aug 24, 2000
+       DESCRIPTION  "Registration of new IANAifType 183." 
+
+       REVISION     "200008230000Z"  -- Aug 23, 2000
+       DESCRIPTION  "Registration of new IANAifTypes
+                     174-182."
+
+       REVISION     "200008220000Z"  -- Aug 22, 2000
+       DESCRIPTION  "Registration of new IANAifTypes 170,
+                     171, 172 and 173."
+
+       REVISION     "200004250000Z"  -- Apr 25, 2000
+       DESCRIPTION  "Registration of new IANAifTypes 168 and 169."       
+
+       REVISION     "200003060000Z"  -- Mar 6, 2000
+       DESCRIPTION  "Fixed a missing semi-colon in the IMPORT.
+                     Also cleaned up the REVISION log a bit.
+                     It is not complete, but from now on it will
+                     be maintained and kept up to date with each
+                     change to this MIB module."
+
+       REVISION     "199910081430Z"  -- Oct 08, 1999
+       DESCRIPTION  "Include new name assignments up to cnr(85).
+                     This is the first version available via the WWW
+                     at: ftp://ftp.isi.edu/mib/ianaiftype.mib"
+
+       REVISION     "199401310000Z"  -- Jan 31, 1994
+       DESCRIPTION  "Initial version of this MIB as published in
+                     RFC 1573."
+       ::= { mib-2 30 }
+
+   IANAifType ::= TEXTUAL-CONVENTION
+       STATUS       current
+       DESCRIPTION
+               "This data type is used as the syntax of the ifType
+               object in the (updated) definition of MIB-II's
+               ifTable.
+
+               The definition of this textual convention with the
+               addition of newly assigned values is published
+               periodically by the IANA, in either the Assigned
+               Numbers RFC, or some derivative of it specific to
+               Internet Network Management number assignments.  (The
+               latest arrangements can be obtained by contacting the
+               IANA.)
+
+               Requests for new values should be made to IANA via
+               email (iana@iana.org).
+
+               The relationship between the assignment of ifType
+               values and of OIDs to particular media-specific MIBs
+               is solely the purview of IANA and is subject to change
+               without notice.  Quite often, a media-specific MIB's
+               OID-subtree assignment within MIB-II's 'transmission'
+               subtree will be the same as its ifType value.
+               However, in some circumstances this will not be the
+               case, and implementors must not pre-assume any
+               specific relationship between ifType values and
+               transmission subtree OIDs."
+       SYNTAX  INTEGER {
+                   other(1),          -- none of the following
+                   regular1822(2),
+                   hdh1822(3),
+                   ddnX25(4),
+                   rfc877x25(5),
+                   ethernetCsmacd(6),
+                   iso88023Csmacd(7),
+                   iso88024TokenBus(8),
+                   iso88025TokenRing(9),
+                   iso88026Man(10),
+                   starLan(11),
+                   proteon10Mbit(12),
+                   proteon80Mbit(13),
+                   hyperchannel(14),
+                   fddi(15),
+                   lapb(16),
+                   sdlc(17),
+                   ds1(18),            -- DS1-MIB
+                   e1(19),             -- Obsolete see DS1-MIB
+                   basicISDN(20),
+                   primaryISDN(21),
+                   propPointToPointSerial(22), -- proprietary serial
+                   ppp(23),
+                   softwareLoopback(24),
+                   eon(25),            -- CLNP over IP 
+                   ethernet3Mbit(26),
+                   nsip(27),           -- XNS over IP
+                   slip(28),           -- generic SLIP
+                   ultra(29),          -- ULTRA technologies
+                   ds3(30),            -- DS3-MIB
+                   sip(31),            -- SMDS, coffee
+                   frameRelay(32),     -- DTE only. 
+                   rs232(33),
+                   para(34),           -- parallel-port
+                   arcnet(35),         -- arcnet
+                   arcnetPlus(36),     -- arcnet plus
+                   atm(37),            -- ATM cells
+                   miox25(38),
+                   sonet(39),          -- SONET or SDH 
+                   x25ple(40),
+                   iso88022llc(41),
+                   localTalk(42),
+                   smdsDxi(43),
+                   frameRelayService(44),  -- FRNETSERV-MIB
+                   v35(45),
+                   hssi(46),
+                   hippi(47),
+                   modem(48),          -- Generic modem
+                   aal5(49),           -- AAL5 over ATM
+                   sonetPath(50),
+                   sonetVT(51),
+                   smdsIcip(52),       -- SMDS InterCarrier Interface
+                   propVirtual(53),    -- proprietary virtual/internal
+                   propMultiplexor(54),-- proprietary multiplexing
+                   ieee80212(55),      -- 100BaseVG
+                   fibreChannel(56),   -- Fibre Channel
+                   hippiInterface(57), -- HIPPI interfaces     
+                   frameRelayInterconnect(58), -- Obsolete use either
+                                       -- frameRelay(32) or 
+                                       -- frameRelayService(44).
+                   aflane8023(59),     -- ATM Emulated LAN for 802.3
+                   aflane8025(60),     -- ATM Emulated LAN for 802.5
+                   cctEmul(61),        -- ATM Emulated circuit          
+                   fastEther(62),      -- Fast Ethernet (100BaseT)
+                   isdn(63),           -- ISDN and X.25           
+                   v11(64),            -- CCITT V.11/X.21             
+                   v36(65),            -- CCITT V.36                  
+                   g703at64k(66),      -- CCITT G703 at 64Kbps
+                   g703at2mb(67),      -- Obsolete see DS1-MIB
+                   qllc(68),           -- SNA QLLC                    
+                   fastEtherFX(69),    -- Fast Ethernet (100BaseFX)   
+                   channel(70),        -- channel                     
+                   ieee80211(71),      -- radio spread spectrum       
+	           ibm370parChan(72),  -- IBM System 360/370 OEMI Channel
+                   escon(73),          -- IBM Enterprise Systems Connection
+                   dlsw(74),           -- Data Link Switching
+                   isdns(75),          -- ISDN S/T interface
+                   isdnu(76),          -- ISDN U interface
+                   lapd(77),           -- Link Access Protocol D
+                   ipSwitch(78),       -- IP Switching Objects
+                   rsrb(79),           -- Remote Source Route Bridging
+                   atmLogical(80),     -- ATM Logical Port
+                   ds0(81),            -- Digital Signal Level 0
+                   ds0Bundle(82),      -- group of ds0s on the same ds1
+                   bsc(83),            -- Bisynchronous Protocol
+                   async(84),          -- Asynchronous Protocol
+                   cnr(85),            -- Combat Net Radio
+                   iso88025Dtr(86),    -- ISO 802.5r DTR
+                   eplrs(87),          -- Ext Pos Loc Report Sys
+                   arap(88),           -- Appletalk Remote Access Protocol
+                   propCnls(89),       -- Proprietary Connectionless Protocol
+                   hostPad(90),        -- CCITT-ITU X.29 PAD Protocol
+                   termPad(91),        -- CCITT-ITU X.3 PAD Facility
+                   frameRelayMPI(92),  -- Multiproto Interconnect over FR
+                   x213(93),           -- CCITT-ITU X213
+                   adsl(94),           -- Asymmetric Digital Subscriber Loop
+                   radsl(95),          -- Rate-Adapt. Digital Subscriber Loop
+                   sdsl(96),           -- Symmetric Digital Subscriber Loop
+                   vdsl(97),           -- Very H-Speed Digital Subscrib. Loop
+                   iso88025CRFPInt(98), -- ISO 802.5 CRFP
+                   myrinet(99),        -- Myricom Myrinet
+                   voiceEM(100),       -- voice recEive and transMit
+                   voiceFXO(101),      -- voice Foreign Exchange Office
+                   voiceFXS(102),      -- voice Foreign Exchange Station
+                   voiceEncap(103),    -- voice encapsulation
+                   voiceOverIp(104),   -- voice over IP encapsulation
+                   atmDxi(105),        -- ATM DXI
+                   atmFuni(106),       -- ATM FUNI
+		   atmIma (107),       -- ATM IMA		   
+                   pppMultilinkBundle(108), -- PPP Multilink Bundle
+                   ipOverCdlc (109),   -- IBM ipOverCdlc
+		   ipOverClaw (110),   -- IBM Common Link Access to Workstn
+                   stackToStack (111), -- IBM stackToStack
+                   virtualIpAddress (112), -- IBM VIPA
+		   mpc (113),          -- IBM multi-protocol channel support
+		   ipOverAtm (114),    -- IBM ipOverAtm
+		   iso88025Fiber (115), -- ISO 802.5j Fiber Token Ring
+		   tdlc (116),	       -- IBM twinaxial data link control
+		   gigabitEthernet (117), -- Gigabit Ethernet
+		   hdlc (118),         -- HDLC
+		   lapf (119),	       -- LAP F
+		   v37 (120),	       -- V.37
+		   x25mlp (121),       -- Multi-Link Protocol
+		   x25huntGroup (122), -- X25 Hunt Group
+		   trasnpHdlc (123),   -- Transp HDLC
+		   interleave (124),   -- Interleave channel
+		   fast (125),         -- Fast channel
+		   ip (126),	       -- IP (for APPN HPR in IP networks)
+		   docsCableMaclayer (127),  -- CATV Mac Layer
+		   docsCableDownstream (128), -- CATV Downstream interface
+		   docsCableUpstream (129),  -- CATV Upstream interface
+		   a12MppSwitch (130), -- Avalon Parallel Processor
+		   tunnel (131),       -- Encapsulation interface
+		   coffee (132),       -- coffee pot
+		   ces (133),          -- Circuit Emulation Service
+		   atmSubInterface (134), -- ATM Sub Interface
+		   l2vlan (135),       -- Layer 2 Virtual LAN using 802.1Q
+		   l3ipvlan (136),     -- Layer 3 Virtual LAN using IP
+		   l3ipxvlan (137),    -- Layer 3 Virtual LAN using IPX
+		   digitalPowerline (138), -- IP over Power Lines	
+		   mediaMailOverIp (139), -- Multimedia Mail over IP
+		   dtm (140),        -- Dynamic syncronous Transfer Mode
+		   dcn (141),    -- Data Communications Network
+		   ipForward (142),    -- IP Forwarding Interface
+		   msdsl (143),       -- Multi-rate Symmetric DSL
+		   ieee1394 (144), -- IEEE1394 High Performance Serial Bus
+		   if-gsn (145),       --   HIPPI-6400 
+		   dvbRccMacLayer (146), -- DVB-RCC MAC Layer
+		   dvbRccDownstream (147),  -- DVB-RCC Downstream Channel
+		   dvbRccUpstream (148),  -- DVB-RCC Upstream Channel
+		   atmVirtual (149),   -- ATM Virtual Interface
+		   mplsTunnel (150),   -- MPLS Tunnel Virtual Interface
+		   srp (151),	-- Spatial Reuse Protocol	
+		   voiceOverAtm (152),  -- Voice Over ATM
+		   voiceOverFrameRelay (153),   -- Voice Over Frame Relay 
+		   idsl (154),		-- Digital Subscriber Loop over ISDN
+		   compositeLink (155),  -- Avici Composite Link Interface
+		   ss7SigLink (156),     -- SS7 Signaling Link 
+		   propWirelessP2P (157),  --  Prop. P2P wireless interface
+		   frForward (158),    -- Frame Forward Interface
+		   rfc1483 (159),	-- Multiprotocol over ATM AAL5
+		   usb (160),		-- USB Interface
+		   ieee8023adLag (161),  -- IEEE 802.3ad Link Aggregate
+                   bgppolicyaccounting (162), -- BGP Policy Accounting
+                   frf16MfrBundle (163), -- FRF .16 Multilink Frame Relay 
+                   h323Gatekeeper (164), -- H323 Gatekeeper
+                   h323Proxy (165), -- H323 Voice and Video Proxy
+                   mpls (166), -- MPLS                   
+                   mfSigLink (167), -- Multi-frequency signaling link
+                   hdsl2 (168), -- High Bit-Rate DSL - 2nd generation
+                   shdsl (169), -- Multirate HDSL2
+                   ds1FDL (170), -- Facility Data Link 4Kbps on a DS1
+                   pos (171), -- Packet over SONET/SDH Interface
+                   dvbAsiIn (172), -- DVB-ASI Input
+                   dvbAsiOut (173), -- DVB-ASI Output 
+                   plc (174), -- Power Line Communtications
+                   nfas (175), -- Non Facility Associated Signaling
+                   tr008 (176), -- TR008
+                   gr303RDT (177), -- Remote Digital Terminal
+                   gr303IDT (178), -- Integrated Digital Terminal
+                   isup (179), -- ISUP
+                   propDocsWirelessMaclayer (180), -- prop/Maclayer
+                   propDocsWirelessDownstream (181), -- prop/Downstream
+                   propDocsWirelessUpstream (182), -- prop/Upstream
+                   hiperlan2 (183), -- HIPERLAN Type 2 Radio Interface
+                   propBWAp2Mp (184), -- PropBroadbandWirelessAccesspt2multipt
+                   sonetOverheadChannel (185), -- SONET Overhead Channel
+                   digitalWrapperOverheadChannel (186), -- Digital Wrapper
+                   aal2 (187), -- ATM adaptation layer 2
+                   radioMAC (188), -- MAC layer over radio links
+                   atmRadio (189), -- ATM over radio links   
+                   imt (190), -- Inter Machine Trunks
+                   mvl (191), -- Multiple Virtual Lines DSL
+                   reachDSL (192), -- Long Reach DSL
+                   frDlciEndPt (193), -- Frame Relay DLCI End Point
+                   atmVciEndPt (194), -- ATM VCI End Point
+                   opticalChannel (195), -- Optical Channel
+                   opticalTransport (196), -- Optical Transport
+                   propAtm (197), --  Proprietary ATM       
+                   voiceOverCable (198), -- Voice Over Cable Interface
+                   infiniband (199), -- Infiniband
+                   teLink (200), -- TE Link
+                   q2931 (201), -- Q.2931
+                   virtualTg (202), -- Virtual Trunk Group
+                   sipTg (203), -- SIP Trunk Group
+                   sipSig (204), -- SIP Signaling   
+                   docsCableUpstreamChannel (205), -- CATV Upstream Channel
+                   econet (206), -- Acorn Econet
+                   pon155 (207), -- FSAN 155Mb Symetrical PON interface
+                   pon622 (208), -- FSAN622Mb Symetrical PON interface
+                   bridge (209), -- Transparent bridge interface
+                   linegroup (210), -- Interface common to multiple lines		   
+                   voiceEMFGD (211), -- voice E&M Feature Group D
+                   voiceFGDEANA (212), -- voice FGD Exchange Access North American
+                   voiceDID (213), -- voice Direct Inward Dialing
+                   mpegTransport (214), -- MPEG transport interface
+                   sixToFour (215), -- 6to4 interface
+                   gtp (216), -- GTP (GPRS Tunneling Protocol)
+                   pdnEtherLoop1 (217), -- Paradyne EtherLoop 1
+                   pdnEtherLoop2 (218), -- Paradyne EtherLoop 2
+                   opticalChannelGroup (219) -- Optical Channel Group
+    			   }
+
+   END
diff -Naur tomato/release/src/router/snmp/mibs/IANA-LANGUAGE-MIB.txt tomato121/release/src/router/snmp/mibs/IANA-LANGUAGE-MIB.txt
--- tomato/release/src/router/snmp/mibs/IANA-LANGUAGE-MIB.txt	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/mibs/IANA-LANGUAGE-MIB.txt	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,123 @@
+IANA-LANGUAGE-MIB DEFINITIONS ::= BEGIN
+
+IMPORTS
+    MODULE-IDENTITY, OBJECT-IDENTITY, mib-2
+        FROM SNMPv2-SMI;
+
+ianaLanguages MODULE-IDENTITY
+    LAST-UPDATED "200005100000Z"  -- May 10, 2000
+    ORGANIZATION "IANA"
+    CONTACT-INFO
+        "Internet Assigned Numbers Authority (IANA)
+
+         Postal: ICANN
+                 4676 Admiralty Way, Suite 330
+                 Marina del Rey, CA 90292
+
+         Tel:    +1 310 823 9358 x20
+         E-Mail: iana@iana.org"
+    DESCRIPTION
+        "The MIB module registers object identifier values for
+         well-known programming and scripting languages. Every
+         language registration MUST describe the format used
+         when transferring scripts written in this language.
+
+         Any additions or changes to the contents of this MIB
+         module require Designated Expert Review as defined in
+         the Guidelines for Writing IANA Considerations Section
+         document. The Designated Expert will be selected by
+         the IESG Area Director of the OPS Area.
+
+         Note, this module does not have to register all possible
+         languages since languages are identified by object
+         identifier values. It is therefore possible to registered 
+         languages in private OID trees. The references given below are not
+         normative with regard to the language version. Other
+         references might be better suited to describe some newer 
+         versions of this language. The references are only
+         provided as `a pointer into the right direction'."
+
+ -- Revision log, in reverse chronological order
+
+    REVISION    "200005100000Z" -- May 10, 2000
+    DESCRIPTION "Import mib-2 instead of experimental, so that
+                 this module compiles"
+
+    REVISION    "199909090900Z" -- September 9, 1999
+    DESCRIPTION "Initial version as published at time of
+                 publication of RFC 2591."
+    ::= { mib-2 73 }
+
+ianaLangJavaByteCode OBJECT-IDENTITY
+    STATUS  current
+    DESCRIPTION
+        "Java byte code to be processed by a Java virtual machine.
+         A script written in Java byte code is transferred by using
+         the Java archive file format (JAR)."
+    REFERENCE
+        "The Java Virtual Machine Specification.
+         ISBN 0-201-63452-X"
+    ::= { ianaLanguages 1 }
+
+ianaLangTcl OBJECT-IDENTITY
+    STATUS  current
+    DESCRIPTION
+        "The Tool Command Language (Tcl). A script written in the
+         Tcl language is transferred in Tcl source code format."
+    REFERENCE
+        "Tcl and the Tk Toolkit.
+         ISBN 0-201-63337-X"
+    ::= { ianaLanguages 2 }
+
+ianaLangPerl OBJECT-IDENTITY
+    STATUS  current
+    DESCRIPTION
+        "The Perl language. A script written in the Perl language
+         is transferred in Perl source code format."
+    REFERENCE
+        "Programming Perl.
+         ISBN 1-56592-149-6"
+    ::= { ianaLanguages 3 }
+
+ianaLangScheme OBJECT-IDENTITY
+    STATUS  current
+    DESCRIPTION
+        "The Scheme language. A script written in the Scheme
+         language is transferred in Scheme source code format."
+    REFERENCE
+        "The Revised^4 Report on the Algorithmic Language Scheme.
+         MIT Press"
+    ::= { ianaLanguages 4 }
+
+ianaLangSRSL OBJECT-IDENTITY
+    STATUS  current
+    DESCRIPTION
+        "The SNMP Script Language defined by SNMP Research. A
+         script written in the SNMP Script Language is transferred
+         in the SNMP Script Language source code format."
+    ::= { ianaLanguages 5 }
+
+ianaLangPSL OBJECT-IDENTITY
+    STATUS  current
+    DESCRIPTION
+        "The Patrol Script Language defined by BMC Software. A script
+         written in the Patrol Script Language is transferred in the
+         Patrol Script Language source code format."
+    REFERENCE
+        "PATROL Script Language Reference Manual, Version 3.0,
+         November 30, 1995. BMC Software, Inc. 2101 City West Blvd.,
+         Houston, Texas 77042."
+    ::= { ianaLanguages 6 }
+
+ianaLangSMSL OBJECT-IDENTITY
+    STATUS  current
+    DESCRIPTION
+        "The Systems Management Scripting Language. A script written
+         in the SMSL language is transferred in the SMSL source code
+         format."
+    REFERENCE
+        "ISO/ITU Command Sequencer.
+         ISO 10164-21 or ITU X.753"
+    ::= { ianaLanguages 7 }
+
+END
diff -Naur tomato/release/src/router/snmp/mibs/ianalist tomato121/release/src/router/snmp/mibs/ianalist
--- tomato/release/src/router/snmp/mibs/ianalist	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/mibs/ianalist	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,6 @@
+# updated 2002-06-15
+ianaiftype-mib			IANAifType-MIB
+ianalanguage-mib		IANA-LANGUAGE-MIB
+ianaaddressfamilynumbers-mib	IANA-ADDRESS-FAMILY-NUMBERS-MIB
+ianaiprouteprotocol-mib		IANA-RTPROTO-MIB
+ianatn3270etc-mib		IANATn3270eTC-MIB
diff -Naur tomato/release/src/router/snmp/mibs/IF-INVERTED-STACK-MIB.txt tomato121/release/src/router/snmp/mibs/IF-INVERTED-STACK-MIB.txt
--- tomato/release/src/router/snmp/mibs/IF-INVERTED-STACK-MIB.txt	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/mibs/IF-INVERTED-STACK-MIB.txt	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,149 @@
+IF-INVERTED-STACK-MIB DEFINITIONS ::= BEGIN
+
+IMPORTS
+  MODULE-IDENTITY, OBJECT-TYPE, mib-2      FROM SNMPv2-SMI
+  RowStatus                                FROM SNMPv2-TC
+  MODULE-COMPLIANCE, OBJECT-GROUP          FROM SNMPv2-CONF
+  ifStackGroup2,
+  ifStackHigherLayer, ifStackLowerLayer    FROM IF-MIB;
+
+ifInvertedStackMIB MODULE-IDENTITY
+  LAST-UPDATED "200006140000Z"
+  ORGANIZATION "IETF Interfaces MIB Working Group"
+  CONTACT-INFO
+          "   Keith McCloghrie
+              Cisco Systems, Inc.
+              170 West Tasman Drive
+              San Jose, CA  95134-1706
+              US
+
+              408-526-5260
+              kzm@cisco.com"
+  DESCRIPTION
+          "The MIB module which provides the Inverted Stack Table for
+          interface sub-layers."
+  REVISION      "200006140000Z"
+  DESCRIPTION
+          "Initial revision, published as RFC 2864"
+  ::= { mib-2 77 }
+
+ifInvMIBObjects OBJECT IDENTIFIER ::= { ifInvertedStackMIB 1 }
+
+--
+--           The Inverted Interface Stack Group
+--
+
+ifInvStackTable  OBJECT-TYPE
+   SYNTAX        SEQUENCE OF IfInvStackEntry
+   MAX-ACCESS    not-accessible
+   STATUS        current
+   DESCRIPTION
+          "A table containing information on the relationships between
+
+          the multiple sub-layers of network interfaces.  In
+          particular, it contains information on which sub-layers run
+          'underneath' which other sub-layers, where each sub-layer
+          corresponds to a conceptual row in the ifTable.  For
+          example, when the sub-layer with ifIndex value x runs
+          underneath the sub-layer with ifIndex value y, then this
+          table contains:
+
+            ifInvStackStatus.x.y=active
+
+          For each ifIndex value, z, which identifies an active
+          interface, there are always at least two instantiated rows
+          in this table associated with z.  For one of these rows, z
+          is the value of ifStackHigherLayer; for the other, z is the
+          value of ifStackLowerLayer.  (If z is not involved in
+          multiplexing, then these are the only two rows associated
+          with z.)
+
+          For example, two rows exist even for an interface which has
+          no others stacked on top or below it:
+
+            ifInvStackStatus.z.0=active
+            ifInvStackStatus.0.z=active
+
+          This table contains exactly the same number of rows as the
+          ifStackTable, but the rows appear in a different order."
+   REFERENCE
+          "ifStackTable of RFC 2863"
+   ::= { ifInvMIBObjects 1 }
+
+ifInvStackEntry  OBJECT-TYPE
+   SYNTAX        IfInvStackEntry
+   MAX-ACCESS    not-accessible
+   STATUS        current
+   DESCRIPTION
+          "Information on a particular relationship between two sub-
+          layers, specifying that one sub-layer runs underneath the
+          other sub-layer.  Each sub-layer corresponds to a conceptual
+          row in the ifTable."
+   INDEX { ifStackLowerLayer, ifStackHigherLayer }
+   ::= { ifInvStackTable 1 }
+
+IfInvStackEntry ::=
+  SEQUENCE {
+      ifInvStackStatus       RowStatus
+   }
+
+ifInvStackStatus  OBJECT-TYPE
+  SYNTAX         RowStatus
+  MAX-ACCESS     read-only
+  STATUS         current
+  DESCRIPTION
+          "The status of the relationship between two sub-layers.
+
+          An instance of this object exists for each instance of the
+          ifStackStatus object, and vice versa.  For example, if the
+          variable ifStackStatus.H.L exists, then the variable
+          ifInvStackStatus.L.H must also exist, and vice versa.  In
+          addition, the two variables always have the same value.
+
+          However, unlike ifStackStatus, the ifInvStackStatus object
+          is NOT write-able.  A network management application wishing
+          to change a relationship between sub-layers H and L cannot
+          do so by modifying the value of ifInvStackStatus.L.H, but
+          must instead modify the value of ifStackStatus.H.L.  After
+          the ifStackTable is modified, the change will be reflected
+          in this table."
+  ::= { ifInvStackEntry 1 }
+
+-- conformance information
+
+ifInvConformance OBJECT IDENTIFIER ::= { ifInvMIBObjects 2 }
+
+ifInvGroups      OBJECT IDENTIFIER ::= { ifInvConformance 1 }
+ifInvCompliances OBJECT IDENTIFIER ::= { ifInvConformance 2 }
+
+-- compliance statements
+
+ifInvCompliance MODULE-COMPLIANCE
+  STATUS  current
+  DESCRIPTION
+          "The compliance statement for SNMP entities which provide
+          inverted information on the layering of network interfaces."
+
+  MODULE  -- this module
+      MANDATORY-GROUPS { ifInvStackGroup }
+
+      OBJECT       ifInvStackStatus
+      SYNTAX       INTEGER { active(1) }
+      DESCRIPTION
+          "Support is only required for 'active'."
+
+  MODULE  IF-MIB
+      MANDATORY-GROUPS { ifStackGroup2 }
+  ::= { ifInvCompliances 1 }
+
+-- units of conformance
+
+ifInvStackGroup    OBJECT-GROUP
+  OBJECTS { ifInvStackStatus }
+  STATUS  current
+  DESCRIPTION
+          "A collection of objects providing inverted information on
+          the layering of MIB-II interfaces."
+  ::= { ifInvGroups 1 }
+
+END
diff -Naur tomato/release/src/router/snmp/mibs/IF-MIB.txt tomato121/release/src/router/snmp/mibs/IF-MIB.txt
--- tomato/release/src/router/snmp/mibs/IF-MIB.txt	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/mibs/IF-MIB.txt	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,1814 @@
+IF-MIB DEFINITIONS ::= BEGIN
+
+IMPORTS
+    MODULE-IDENTITY, OBJECT-TYPE, Counter32, Gauge32, Counter64,
+    Integer32, TimeTicks, mib-2,
+    NOTIFICATION-TYPE                        FROM SNMPv2-SMI
+    TEXTUAL-CONVENTION, DisplayString,
+    PhysAddress, TruthValue, RowStatus,
+    TimeStamp, AutonomousType, TestAndIncr   FROM SNMPv2-TC
+    MODULE-COMPLIANCE, OBJECT-GROUP,
+    NOTIFICATION-GROUP                       FROM SNMPv2-CONF
+    snmpTraps                                FROM SNMPv2-MIB
+    IANAifType                               FROM IANAifType-MIB;
+
+ifMIB MODULE-IDENTITY
+    LAST-UPDATED "200006140000Z"
+    ORGANIZATION "IETF Interfaces MIB Working Group"
+    CONTACT-INFO
+            "   Keith McCloghrie
+                Cisco Systems, Inc.
+                170 West Tasman Drive
+                San Jose, CA  95134-1706
+                US
+
+                408-526-5260
+                kzm@cisco.com"
+    DESCRIPTION
+            "The MIB module to describe generic objects for network
+            interface sub-layers.  This MIB is an updated version of
+            MIB-II's ifTable, and incorporates the extensions defined in
+            RFC 1229."
+
+    REVISION      "200006140000Z"
+    DESCRIPTION
+            "Clarifications agreed upon by the Interfaces MIB WG, and
+            published as RFC 2863."
+    REVISION      "199602282155Z"
+    DESCRIPTION
+            "Revisions made by the Interfaces MIB WG, and published in
+            RFC 2233."
+    REVISION      "199311082155Z"
+    DESCRIPTION
+            "Initial revision, published as part of RFC 1573."
+    ::= { mib-2 31 }
+
+ifMIBObjects OBJECT IDENTIFIER ::= { ifMIB 1 }
+
+interfaces   OBJECT IDENTIFIER ::= { mib-2 2 }
+
+--
+-- Textual Conventions
+--
+
+-- OwnerString has the same semantics as used in RFC 1271
+
+OwnerString ::= TEXTUAL-CONVENTION
+    DISPLAY-HINT "255a"
+    STATUS       deprecated
+    DESCRIPTION
+            "This data type is used to model an administratively
+            assigned name of the owner of a resource.  This information
+            is taken from the NVT ASCII character set.  It is suggested
+            that this name contain one or more of the following: ASCII
+            form of the manager station's transport address, management
+            station name (e.g., domain name), network management
+            personnel's name, location, or phone number.  In some cases
+            the agent itself will be the owner of an entry.  In these
+            cases, this string shall be set to a string starting with
+            'agent'."
+    SYNTAX       OCTET STRING (SIZE(0..255))
+
+-- InterfaceIndex contains the semantics of ifIndex and should be used
+-- for any objects defined in other MIB modules that need these semantics.
+
+InterfaceIndex ::= TEXTUAL-CONVENTION
+    DISPLAY-HINT "d"
+    STATUS       current
+    DESCRIPTION
+            "A unique value, greater than zero, for each interface or
+            interface sub-layer in the managed system.  It is
+            recommended that values are assigned contiguously starting
+            from 1.  The value for each interface sub-layer must remain
+            constant at least from one re-initialization of the entity's
+            network management system to the next re-initialization."
+    SYNTAX       Integer32 (1..2147483647)
+
+InterfaceIndexOrZero ::= TEXTUAL-CONVENTION
+    DISPLAY-HINT "d"
+    STATUS       current
+    DESCRIPTION
+            "This textual convention is an extension of the
+            InterfaceIndex convention.  The latter defines a greater
+            than zero value used to identify an interface or interface
+            sub-layer in the managed system.  This extension permits the
+            additional value of zero.  the value zero is object-specific
+            and must therefore be defined as part of the description of
+            any object which uses this syntax.  Examples of the usage of
+            zero might include situations where interface was unknown,
+            or when none or all interfaces need to be referenced."
+    SYNTAX       Integer32 (0..2147483647)
+
+ifNumber  OBJECT-TYPE
+    SYNTAX      Integer32
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+            "The number of network interfaces (regardless of their
+            current state) present on this system."
+    ::= { interfaces 1 }
+
+ifTableLastChange  OBJECT-TYPE
+    SYNTAX      TimeTicks
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+            "The value of sysUpTime at the time of the last creation or
+            deletion of an entry in the ifTable.  If the number of
+            entries has been unchanged since the last re-initialization
+            of the local network management subsystem, then this object
+            contains a zero value."
+    ::= { ifMIBObjects 5 }
+
+-- the Interfaces table
+
+-- The Interfaces table contains information on the entity's
+
+-- interfaces.  Each sub-layer below the internetwork-layer
+-- of a network interface is considered to be an interface.
+
+ifTable OBJECT-TYPE
+    SYNTAX      SEQUENCE OF IfEntry
+    MAX-ACCESS  not-accessible
+    STATUS      current
+    DESCRIPTION
+            "A list of interface entries.  The number of entries is
+            given by the value of ifNumber."
+    ::= { interfaces 2 }
+
+ifEntry OBJECT-TYPE
+    SYNTAX      IfEntry
+    MAX-ACCESS  not-accessible
+    STATUS      current
+    DESCRIPTION
+            "An entry containing management information applicable to a
+            particular interface."
+    INDEX   { ifIndex }
+    ::= { ifTable 1 }
+
+IfEntry ::=
+    SEQUENCE {
+        ifIndex                 InterfaceIndex,
+        ifDescr                 DisplayString,
+        ifType                  IANAifType,
+        ifMtu                   Integer32,
+        ifSpeed                 Gauge32,
+        ifPhysAddress           PhysAddress,
+        ifAdminStatus           INTEGER,
+        ifOperStatus            INTEGER,
+        ifLastChange            TimeTicks,
+        ifInOctets              Counter32,
+        ifInUcastPkts           Counter32,
+        ifInNUcastPkts          Counter32,  -- deprecated
+        ifInDiscards            Counter32,
+        ifInErrors              Counter32,
+        ifInUnknownProtos       Counter32,
+        ifOutOctets             Counter32,
+        ifOutUcastPkts          Counter32,
+        ifOutNUcastPkts         Counter32,  -- deprecated
+        ifOutDiscards           Counter32,
+        ifOutErrors             Counter32,
+        ifOutQLen               Gauge32,    -- deprecated
+        ifSpecific              OBJECT IDENTIFIER -- deprecated
+    }
+
+ifIndex OBJECT-TYPE
+    SYNTAX      InterfaceIndex
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+            "A unique value, greater than zero, for each interface.  It
+            is recommended that values are assigned contiguously
+            starting from 1.  The value for each interface sub-layer
+            must remain constant at least from one re-initialization of
+            the entity's network management system to the next re-
+            initialization."
+    ::= { ifEntry 1 }
+
+ifDescr OBJECT-TYPE
+    SYNTAX      DisplayString (SIZE (0..255))
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+            "A textual string containing information about the
+            interface.  This string should include the name of the
+            manufacturer, the product name and the version of the
+            interface hardware/software."
+    ::= { ifEntry 2 }
+
+ifType OBJECT-TYPE
+    SYNTAX      IANAifType
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+            "The type of interface.  Additional values for ifType are
+            assigned by the Internet Assigned Numbers Authority (IANA),
+            through updating the syntax of the IANAifType textual
+            convention."
+    ::= { ifEntry 3 }
+
+ifMtu OBJECT-TYPE
+    SYNTAX      Integer32
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+            "The size of the largest packet which can be sent/received
+            on the interface, specified in octets.  For interfaces that
+            are used for transmitting network datagrams, this is the
+            size of the largest network datagram that can be sent on the
+            interface."
+    ::= { ifEntry 4 }
+
+ifSpeed OBJECT-TYPE
+    SYNTAX      Gauge32
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+            "An estimate of the interface's current bandwidth in bits
+            per second.  For interfaces which do not vary in bandwidth
+            or for those where no accurate estimation can be made, this
+            object should contain the nominal bandwidth.  If the
+            bandwidth of the interface is greater than the maximum value
+            reportable by this object then this object should report its
+            maximum value (4,294,967,295) and ifHighSpeed must be used
+            to report the interace's speed.  For a sub-layer which has
+            no concept of bandwidth, this object should be zero."
+    ::= { ifEntry 5 }
+
+ifPhysAddress OBJECT-TYPE
+    SYNTAX      PhysAddress
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+            "The interface's address at its protocol sub-layer.  For
+            example, for an 802.x interface, this object normally
+            contains a MAC address.  The interface's media-specific MIB
+            must define the bit and byte ordering and the format of the
+            value of this object.  For interfaces which do not have such
+            an address (e.g., a serial line), this object should contain
+            an octet string of zero length."
+    ::= { ifEntry 6 }
+
+ifAdminStatus OBJECT-TYPE
+    SYNTAX  INTEGER {
+                up(1),       -- ready to pass packets
+                down(2),
+                testing(3)   -- in some test mode
+            }
+    MAX-ACCESS  read-write
+    STATUS      current
+    DESCRIPTION
+            "The desired state of the interface.  The testing(3) state
+            indicates that no operational packets can be passed.  When a
+            managed system initializes, all interfaces start with
+            ifAdminStatus in the down(2) state.  As a result of either
+            explicit management action or per configuration information
+            retained by the managed system, ifAdminStatus is then
+            changed to either the up(1) or testing(3) states (or remains
+            in the down(2) state)."
+    ::= { ifEntry 7 }
+
+ifOperStatus OBJECT-TYPE
+    SYNTAX  INTEGER {
+                up(1),        -- ready to pass packets
+                down(2),
+                testing(3),   -- in some test mode
+                unknown(4),   -- status can not be determined
+                              -- for some reason.
+                dormant(5),
+                notPresent(6),    -- some component is missing
+                lowerLayerDown(7) -- down due to state of
+                                  -- lower-layer interface(s)
+            }
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+            "The current operational state of the interface.  The
+            testing(3) state indicates that no operational packets can
+            be passed.  If ifAdminStatus is down(2) then ifOperStatus
+            should be down(2).  If ifAdminStatus is changed to up(1)
+            then ifOperStatus should change to up(1) if the interface is
+            ready to transmit and receive network traffic; it should
+            change to dormant(5) if the interface is waiting for
+            external actions (such as a serial line waiting for an
+            incoming connection); it should remain in the down(2) state
+            if and only if there is a fault that prevents it from going
+            to the up(1) state; it should remain in the notPresent(6)
+            state if the interface has missing (typically, hardware)
+            components."
+    ::= { ifEntry 8 }
+
+ifLastChange OBJECT-TYPE
+    SYNTAX      TimeTicks
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+            "The value of sysUpTime at the time the interface entered
+            its current operational state.  If the current state was
+            entered prior to the last re-initialization of the local
+            network management subsystem, then this object contains a
+            zero value."
+    ::= { ifEntry 9 }
+
+ifInOctets OBJECT-TYPE
+    SYNTAX      Counter32
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+            "The total number of octets received on the interface,
+            including framing characters.
+
+            Discontinuities in the value of this counter can occur at
+            re-initialization of the management system, and at other
+            times as indicated by the value of
+            ifCounterDiscontinuityTime."
+    ::= { ifEntry 10 }
+
+ifInUcastPkts OBJECT-TYPE
+    SYNTAX      Counter32
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+            "The number of packets, delivered by this sub-layer to a
+            higher (sub-)layer, which were not addressed to a multicast
+            or broadcast address at this sub-layer.
+
+            Discontinuities in the value of this counter can occur at
+            re-initialization of the management system, and at other
+            times as indicated by the value of
+            ifCounterDiscontinuityTime."
+    ::= { ifEntry 11 }
+
+ifInNUcastPkts OBJECT-TYPE
+    SYNTAX  Counter32
+    MAX-ACCESS  read-only
+    STATUS      deprecated
+    DESCRIPTION
+            "The number of packets, delivered by this sub-layer to a
+            higher (sub-)layer, which were addressed to a multicast or
+            broadcast address at this sub-layer.
+
+            Discontinuities in the value of this counter can occur at
+            re-initialization of the management system, and at other
+            times as indicated by the value of
+            ifCounterDiscontinuityTime.
+
+            This object is deprecated in favour of ifInMulticastPkts and
+            ifInBroadcastPkts."
+    ::= { ifEntry 12 }
+
+ifInDiscards OBJECT-TYPE
+    SYNTAX      Counter32
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+            "The number of inbound packets which were chosen to be
+            discarded even though no errors had been detected to prevent
+
+            their being deliverable to a higher-layer protocol.  One
+            possible reason for discarding such a packet could be to
+            free up buffer space.
+
+            Discontinuities in the value of this counter can occur at
+            re-initialization of the management system, and at other
+            times as indicated by the value of
+            ifCounterDiscontinuityTime."
+    ::= { ifEntry 13 }
+
+ifInErrors OBJECT-TYPE
+    SYNTAX      Counter32
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+            "For packet-oriented interfaces, the number of inbound
+            packets that contained errors preventing them from being
+            deliverable to a higher-layer protocol.  For character-
+            oriented or fixed-length interfaces, the number of inbound
+            transmission units that contained errors preventing them
+            from being deliverable to a higher-layer protocol.
+
+            Discontinuities in the value of this counter can occur at
+            re-initialization of the management system, and at other
+            times as indicated by the value of
+            ifCounterDiscontinuityTime."
+    ::= { ifEntry 14 }
+
+ifInUnknownProtos OBJECT-TYPE
+    SYNTAX      Counter32
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+            "For packet-oriented interfaces, the number of packets
+            received via the interface which were discarded because of
+            an unknown or unsupported protocol.  For character-oriented
+            or fixed-length interfaces that support protocol
+            multiplexing the number of transmission units received via
+            the interface which were discarded because of an unknown or
+            unsupported protocol.  For any interface that does not
+            support protocol multiplexing, this counter will always be
+            0.
+
+            Discontinuities in the value of this counter can occur at
+            re-initialization of the management system, and at other
+            times as indicated by the value of
+            ifCounterDiscontinuityTime."
+    ::= { ifEntry 15 }
+
+ifOutOctets OBJECT-TYPE
+    SYNTAX      Counter32
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+            "The total number of octets transmitted out of the
+            interface, including framing characters.
+
+            Discontinuities in the value of this counter can occur at
+            re-initialization of the management system, and at other
+            times as indicated by the value of
+            ifCounterDiscontinuityTime."
+    ::= { ifEntry 16 }
+
+ifOutUcastPkts OBJECT-TYPE
+    SYNTAX      Counter32
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+            "The total number of packets that higher-level protocols
+            requested be transmitted, and which were not addressed to a
+            multicast or broadcast address at this sub-layer, including
+            those that were discarded or not sent.
+
+            Discontinuities in the value of this counter can occur at
+            re-initialization of the management system, and at other
+            times as indicated by the value of
+            ifCounterDiscontinuityTime."
+    ::= { ifEntry 17 }
+
+ifOutNUcastPkts OBJECT-TYPE
+    SYNTAX      Counter32
+    MAX-ACCESS  read-only
+    STATUS      deprecated
+    DESCRIPTION
+            "The total number of packets that higher-level protocols
+            requested be transmitted, and which were addressed to a
+            multicast or broadcast address at this sub-layer, including
+            those that were discarded or not sent.
+
+            Discontinuities in the value of this counter can occur at
+            re-initialization of the management system, and at other
+            times as indicated by the value of
+            ifCounterDiscontinuityTime.
+
+            This object is deprecated in favour of ifOutMulticastPkts
+            and ifOutBroadcastPkts."
+    ::= { ifEntry 18 }
+
+ifOutDiscards OBJECT-TYPE
+    SYNTAX      Counter32
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+            "The number of outbound packets which were chosen to be
+            discarded even though no errors had been detected to prevent
+            their being transmitted.  One possible reason for discarding
+            such a packet could be to free up buffer space.
+
+            Discontinuities in the value of this counter can occur at
+            re-initialization of the management system, and at other
+            times as indicated by the value of
+            ifCounterDiscontinuityTime."
+    ::= { ifEntry 19 }
+
+ifOutErrors OBJECT-TYPE
+    SYNTAX      Counter32
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+            "For packet-oriented interfaces, the number of outbound
+            packets that could not be transmitted because of errors.
+            For character-oriented or fixed-length interfaces, the
+            number of outbound transmission units that could not be
+            transmitted because of errors.
+
+            Discontinuities in the value of this counter can occur at
+            re-initialization of the management system, and at other
+            times as indicated by the value of
+            ifCounterDiscontinuityTime."
+    ::= { ifEntry 20 }
+
+ifOutQLen OBJECT-TYPE
+    SYNTAX      Gauge32
+    MAX-ACCESS  read-only
+    STATUS      deprecated
+    DESCRIPTION
+            "The length of the output packet queue (in packets)."
+    ::= { ifEntry 21 }
+
+ifSpecific OBJECT-TYPE
+    SYNTAX      OBJECT IDENTIFIER
+    MAX-ACCESS  read-only
+    STATUS      deprecated
+    DESCRIPTION
+            "A reference to MIB definitions specific to the particular
+            media being used to realize the interface.  It is
+
+            recommended that this value point to an instance of a MIB
+            object in the media-specific MIB, i.e., that this object
+            have the semantics associated with the InstancePointer
+            textual convention defined in RFC 2579.  In fact, it is
+            recommended that the media-specific MIB specify what value
+            ifSpecific should/can take for values of ifType.  If no MIB
+            definitions specific to the particular media are available,
+            the value should be set to the OBJECT IDENTIFIER { 0 0 }."
+    ::= { ifEntry 22 }
+
+--
+--   Extension to the interface table
+--
+-- This table replaces the ifExtnsTable table.
+--
+
+ifXTable        OBJECT-TYPE
+    SYNTAX      SEQUENCE OF IfXEntry
+    MAX-ACCESS  not-accessible
+    STATUS      current
+    DESCRIPTION
+            "A list of interface entries.  The number of entries is
+            given by the value of ifNumber.  This table contains
+            additional objects for the interface table."
+    ::= { ifMIBObjects 1 }
+
+ifXEntry        OBJECT-TYPE
+    SYNTAX      IfXEntry
+    MAX-ACCESS  not-accessible
+    STATUS      current
+    DESCRIPTION
+            "An entry containing additional management information
+            applicable to a particular interface."
+    AUGMENTS    { ifEntry }
+    ::= { ifXTable 1 }
+
+IfXEntry ::=
+    SEQUENCE {
+        ifName                  DisplayString,
+        ifInMulticastPkts       Counter32,
+        ifInBroadcastPkts       Counter32,
+        ifOutMulticastPkts      Counter32,
+        ifOutBroadcastPkts      Counter32,
+        ifHCInOctets            Counter64,
+        ifHCInUcastPkts         Counter64,
+        ifHCInMulticastPkts     Counter64,
+        ifHCInBroadcastPkts     Counter64,
+        ifHCOutOctets           Counter64,
+        ifHCOutUcastPkts        Counter64,
+        ifHCOutMulticastPkts    Counter64,
+        ifHCOutBroadcastPkts    Counter64,
+        ifLinkUpDownTrapEnable  INTEGER,
+        ifHighSpeed             Gauge32,
+        ifPromiscuousMode       TruthValue,
+        ifConnectorPresent      TruthValue,
+        ifAlias                 DisplayString,
+        ifCounterDiscontinuityTime TimeStamp
+    }
+
+ifName OBJECT-TYPE
+    SYNTAX      DisplayString
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+            "The textual name of the interface.  The value of this
+            object should be the name of the interface as assigned by
+            the local device and should be suitable for use in commands
+            entered at the device's `console'.  This might be a text
+            name, such as `le0' or a simple port number, such as `1',
+            depending on the interface naming syntax of the device.  If
+            several entries in the ifTable together represent a single
+            interface as named by the device, then each will have the
+            same value of ifName.  Note that for an agent which responds
+            to SNMP queries concerning an interface on some other
+            (proxied) device, then the value of ifName for such an
+            interface is the proxied device's local name for it.
+
+            If there is no local name, or this object is otherwise not
+            applicable, then this object contains a zero-length string."
+    ::= { ifXEntry 1 }
+
+ifInMulticastPkts OBJECT-TYPE
+    SYNTAX      Counter32
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+            "The number of packets, delivered by this sub-layer to a
+            higher (sub-)layer, which were addressed to a multicast
+            address at this sub-layer.  For a MAC layer protocol, this
+            includes both Group and Functional addresses.
+
+            Discontinuities in the value of this counter can occur at
+            re-initialization of the management system, and at other
+
+            times as indicated by the value of
+            ifCounterDiscontinuityTime."
+    ::= { ifXEntry 2 }
+
+ifInBroadcastPkts OBJECT-TYPE
+    SYNTAX      Counter32
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+            "The number of packets, delivered by this sub-layer to a
+            higher (sub-)layer, which were addressed to a broadcast
+            address at this sub-layer.
+
+            Discontinuities in the value of this counter can occur at
+            re-initialization of the management system, and at other
+            times as indicated by the value of
+            ifCounterDiscontinuityTime."
+    ::= { ifXEntry 3 }
+
+ifOutMulticastPkts OBJECT-TYPE
+    SYNTAX      Counter32
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+            "The total number of packets that higher-level protocols
+            requested be transmitted, and which were addressed to a
+            multicast address at this sub-layer, including those that
+            were discarded or not sent.  For a MAC layer protocol, this
+            includes both Group and Functional addresses.
+
+            Discontinuities in the value of this counter can occur at
+            re-initialization of the management system, and at other
+            times as indicated by the value of
+            ifCounterDiscontinuityTime."
+    ::= { ifXEntry 4 }
+
+ifOutBroadcastPkts OBJECT-TYPE
+    SYNTAX      Counter32
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+            "The total number of packets that higher-level protocols
+            requested be transmitted, and which were addressed to a
+            broadcast address at this sub-layer, including those that
+            were discarded or not sent.
+
+            Discontinuities in the value of this counter can occur at
+            re-initialization of the management system, and at other
+
+            times as indicated by the value of
+            ifCounterDiscontinuityTime."
+    ::= { ifXEntry 5 }
+
+--
+-- High Capacity Counter objects.  These objects are all
+-- 64 bit versions of the "basic" ifTable counters.  These
+-- objects all have the same basic semantics as their 32-bit
+-- counterparts, however, their syntax has been extended
+-- to 64 bits.
+--
+
+ifHCInOctets OBJECT-TYPE
+    SYNTAX      Counter64
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+            "The total number of octets received on the interface,
+            including framing characters.  This object is a 64-bit
+            version of ifInOctets.
+
+            Discontinuities in the value of this counter can occur at
+            re-initialization of the management system, and at other
+            times as indicated by the value of
+            ifCounterDiscontinuityTime."
+    ::= { ifXEntry 6 }
+
+ifHCInUcastPkts OBJECT-TYPE
+    SYNTAX      Counter64
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+            "The number of packets, delivered by this sub-layer to a
+            higher (sub-)layer, which were not addressed to a multicast
+            or broadcast address at this sub-layer.  This object is a
+            64-bit version of ifInUcastPkts.
+
+            Discontinuities in the value of this counter can occur at
+            re-initialization of the management system, and at other
+            times as indicated by the value of
+            ifCounterDiscontinuityTime."
+    ::= { ifXEntry 7 }
+
+ifHCInMulticastPkts OBJECT-TYPE
+    SYNTAX      Counter64
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+            "The number of packets, delivered by this sub-layer to a
+            higher (sub-)layer, which were addressed to a multicast
+            address at this sub-layer.  For a MAC layer protocol, this
+            includes both Group and Functional addresses.  This object
+            is a 64-bit version of ifInMulticastPkts.
+
+            Discontinuities in the value of this counter can occur at
+            re-initialization of the management system, and at other
+            times as indicated by the value of
+            ifCounterDiscontinuityTime."
+    ::= { ifXEntry 8 }
+
+ifHCInBroadcastPkts OBJECT-TYPE
+    SYNTAX      Counter64
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+            "The number of packets, delivered by this sub-layer to a
+            higher (sub-)layer, which were addressed to a broadcast
+            address at this sub-layer.  This object is a 64-bit version
+            of ifInBroadcastPkts.
+
+            Discontinuities in the value of this counter can occur at
+            re-initialization of the management system, and at other
+            times as indicated by the value of
+            ifCounterDiscontinuityTime."
+    ::= { ifXEntry 9 }
+
+ifHCOutOctets OBJECT-TYPE
+    SYNTAX      Counter64
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+            "The total number of octets transmitted out of the
+            interface, including framing characters.  This object is a
+            64-bit version of ifOutOctets.
+
+            Discontinuities in the value of this counter can occur at
+            re-initialization of the management system, and at other
+            times as indicated by the value of
+            ifCounterDiscontinuityTime."
+    ::= { ifXEntry 10 }
+
+ifHCOutUcastPkts OBJECT-TYPE
+    SYNTAX      Counter64
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+            "The total number of packets that higher-level protocols
+            requested be transmitted, and which were not addressed to a
+            multicast or broadcast address at this sub-layer, including
+            those that were discarded or not sent.  This object is a
+            64-bit version of ifOutUcastPkts.
+
+            Discontinuities in the value of this counter can occur at
+            re-initialization of the management system, and at other
+            times as indicated by the value of
+            ifCounterDiscontinuityTime."
+    ::= { ifXEntry 11 }
+
+ifHCOutMulticastPkts OBJECT-TYPE
+    SYNTAX      Counter64
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+            "The total number of packets that higher-level protocols
+            requested be transmitted, and which were addressed to a
+            multicast address at this sub-layer, including those that
+            were discarded or not sent.  For a MAC layer protocol, this
+            includes both Group and Functional addresses.  This object
+            is a 64-bit version of ifOutMulticastPkts.
+
+            Discontinuities in the value of this counter can occur at
+            re-initialization of the management system, and at other
+            times as indicated by the value of
+            ifCounterDiscontinuityTime."
+    ::= { ifXEntry 12 }
+
+ifHCOutBroadcastPkts OBJECT-TYPE
+    SYNTAX      Counter64
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+            "The total number of packets that higher-level protocols
+            requested be transmitted, and which were addressed to a
+            broadcast address at this sub-layer, including those that
+            were discarded or not sent.  This object is a 64-bit version
+            of ifOutBroadcastPkts.
+
+            Discontinuities in the value of this counter can occur at
+            re-initialization of the management system, and at other
+            times as indicated by the value of
+            ifCounterDiscontinuityTime."
+    ::= { ifXEntry 13 }
+
+ifLinkUpDownTrapEnable  OBJECT-TYPE
+    SYNTAX      INTEGER { enabled(1), disabled(2) }
+    MAX-ACCESS  read-write
+    STATUS      current
+    DESCRIPTION
+            "Indicates whether linkUp/linkDown traps should be generated
+            for this interface.
+
+            By default, this object should have the value enabled(1) for
+            interfaces which do not operate on 'top' of any other
+            interface (as defined in the ifStackTable), and disabled(2)
+            otherwise."
+    ::= { ifXEntry 14 }
+
+ifHighSpeed OBJECT-TYPE
+    SYNTAX      Gauge32
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+            "An estimate of the interface's current bandwidth in units
+            of 1,000,000 bits per second.  If this object reports a
+            value of `n' then the speed of the interface is somewhere in
+            the range of `n-500,000' to `n+499,999'.  For interfaces
+            which do not vary in bandwidth or for those where no
+            accurate estimation can be made, this object should contain
+            the nominal bandwidth.  For a sub-layer which has no concept
+            of bandwidth, this object should be zero."
+    ::= { ifXEntry 15 }
+
+ifPromiscuousMode  OBJECT-TYPE
+    SYNTAX      TruthValue
+    MAX-ACCESS  read-write
+    STATUS      current
+    DESCRIPTION
+            "This object has a value of false(2) if this interface only
+            accepts packets/frames that are addressed to this station.
+            This object has a value of true(1) when the station accepts
+            all packets/frames transmitted on the media.  The value
+            true(1) is only legal on certain types of media.  If legal,
+            setting this object to a value of true(1) may require the
+            interface to be reset before becoming effective.
+
+            The value of ifPromiscuousMode does not affect the reception
+            of broadcast and multicast packets/frames by the interface."
+    ::= { ifXEntry 16 }
+
+ifConnectorPresent   OBJECT-TYPE
+    SYNTAX      TruthValue
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+            "This object has the value 'true(1)' if the interface
+            sublayer has a physical connector and the value 'false(2)'
+            otherwise."
+    ::= { ifXEntry 17 }
+
+ifAlias   OBJECT-TYPE
+    SYNTAX      DisplayString (SIZE(0..64))
+    MAX-ACCESS  read-write
+    STATUS      current
+    DESCRIPTION
+            "This object is an 'alias' name for the interface as
+            specified by a network manager, and provides a non-volatile
+            'handle' for the interface.
+
+            On the first instantiation of an interface, the value of
+            ifAlias associated with that interface is the zero-length
+            string.  As and when a value is written into an instance of
+            ifAlias through a network management set operation, then the
+            agent must retain the supplied value in the ifAlias instance
+            associated with the same interface for as long as that
+            interface remains instantiated, including across all re-
+            initializations/reboots of the network management system,
+            including those which result in a change of the interface's
+            ifIndex value.
+
+            An example of the value which a network manager might store
+            in this object for a WAN interface is the (Telco's) circuit
+            number/identifier of the interface.
+
+            Some agents may support write-access only for interfaces
+            having particular values of ifType.  An agent which supports
+            write access to this object is required to keep the value in
+            non-volatile storage, but it may limit the length of new
+            values depending on how much storage is already occupied by
+            the current values for other interfaces."
+    ::= { ifXEntry 18 }
+
+ifCounterDiscontinuityTime OBJECT-TYPE
+    SYNTAX      TimeStamp
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+            "The value of sysUpTime on the most recent occasion at which
+            any one or more of this interface's counters suffered a
+            discontinuity.  The relevant counters are the specific
+            instances associated with this interface of any Counter32 or
+
+            Counter64 object contained in the ifTable or ifXTable.  If
+            no such discontinuities have occurred since the last re-
+            initialization of the local management subsystem, then this
+            object contains a zero value."
+    ::= { ifXEntry 19 }
+
+--           The Interface Stack Group
+--
+-- Implementation of this group is optional, but strongly recommended
+-- for all systems
+--
+
+ifStackTable  OBJECT-TYPE
+     SYNTAX        SEQUENCE OF IfStackEntry
+     MAX-ACCESS    not-accessible
+     STATUS        current
+     DESCRIPTION
+            "The table containing information on the relationships
+            between the multiple sub-layers of network interfaces.  In
+            particular, it contains information on which sub-layers run
+            'on top of' which other sub-layers, where each sub-layer
+            corresponds to a conceptual row in the ifTable.  For
+            example, when the sub-layer with ifIndex value x runs over
+            the sub-layer with ifIndex value y, then this table
+            contains:
+
+              ifStackStatus.x.y=active
+
+            For each ifIndex value, I, which identifies an active
+            interface, there are always at least two instantiated rows
+            in this table associated with I.  For one of these rows, I
+            is the value of ifStackHigherLayer; for the other, I is the
+            value of ifStackLowerLayer.  (If I is not involved in
+            multiplexing, then these are the only two rows associated
+            with I.)
+
+            For example, two rows exist even for an interface which has
+            no others stacked on top or below it:
+
+              ifStackStatus.0.x=active
+              ifStackStatus.x.0=active "
+     ::= { ifMIBObjects 2 }
+
+ifStackEntry  OBJECT-TYPE
+     SYNTAX        IfStackEntry
+     MAX-ACCESS    not-accessible
+     STATUS        current
+     DESCRIPTION
+            "Information on a particular relationship between two sub-
+            layers, specifying that one sub-layer runs on 'top' of the
+            other sub-layer.  Each sub-layer corresponds to a conceptual
+            row in the ifTable."
+     INDEX { ifStackHigherLayer, ifStackLowerLayer }
+     ::= { ifStackTable 1 }
+
+IfStackEntry ::=
+    SEQUENCE {
+        ifStackHigherLayer  InterfaceIndexOrZero,
+        ifStackLowerLayer   InterfaceIndexOrZero,
+        ifStackStatus       RowStatus
+     }
+
+ifStackHigherLayer  OBJECT-TYPE
+     SYNTAX        InterfaceIndexOrZero
+     MAX-ACCESS    not-accessible
+     STATUS        current
+     DESCRIPTION
+            "The value of ifIndex corresponding to the higher sub-layer
+            of the relationship, i.e., the sub-layer which runs on 'top'
+            of the sub-layer identified by the corresponding instance of
+            ifStackLowerLayer.  If there is no higher sub-layer (below
+            the internetwork layer), then this object has the value 0."
+     ::= { ifStackEntry 1 }
+
+ifStackLowerLayer  OBJECT-TYPE
+     SYNTAX        InterfaceIndexOrZero
+     MAX-ACCESS    not-accessible
+     STATUS        current
+     DESCRIPTION
+            "The value of ifIndex corresponding to the lower sub-layer
+            of the relationship, i.e., the sub-layer which runs 'below'
+            the sub-layer identified by the corresponding instance of
+            ifStackHigherLayer.  If there is no lower sub-layer, then
+            this object has the value 0."
+     ::= { ifStackEntry 2 }
+
+ifStackStatus  OBJECT-TYPE
+    SYNTAX         RowStatus
+    MAX-ACCESS     read-create
+    STATUS         current
+    DESCRIPTION
+            "The status of the relationship between two sub-layers.
+
+            Changing the value of this object from 'active' to
+            'notInService' or 'destroy' will likely have consequences up
+            and down the interface stack.  Thus, write access to this
+            object is likely to be inappropriate for some types of
+            interfaces, and many implementations will choose not to
+            support write-access for any type of interface."
+    ::= { ifStackEntry 3 }
+
+ifStackLastChange OBJECT-TYPE
+    SYNTAX         TimeTicks
+    MAX-ACCESS     read-only
+    STATUS         current
+    DESCRIPTION
+            "The value of sysUpTime at the time of the last change of
+            the (whole) interface stack.  A change of the interface
+            stack is defined to be any creation, deletion, or change in
+            value of any instance of ifStackStatus.  If the interface
+            stack has been unchanged since the last re-initialization of
+            the local network management subsystem, then this object
+            contains a zero value."
+    ::= { ifMIBObjects 6 }
+
+--   Generic Receive Address Table
+--
+-- This group of objects is mandatory for all types of
+-- interfaces which can receive packets/frames addressed to
+-- more than one address.
+--
+-- This table replaces the ifExtnsRcvAddr table.  The main
+-- difference is that this table makes use of the RowStatus
+-- textual convention, while ifExtnsRcvAddr did not.
+
+ifRcvAddressTable  OBJECT-TYPE
+    SYNTAX      SEQUENCE OF IfRcvAddressEntry
+    MAX-ACCESS  not-accessible
+    STATUS      current
+    DESCRIPTION
+            "This table contains an entry for each address (broadcast,
+            multicast, or uni-cast) for which the system will receive
+            packets/frames on a particular interface, except as follows:
+
+            - for an interface operating in promiscuous mode, entries
+            are only required for those addresses for which the system
+            would receive frames were it not operating in promiscuous
+            mode.
+
+            - for 802.5 functional addresses, only one entry is
+            required, for the address which has the functional address
+            bit ANDed with the bit mask of all functional addresses for
+            which the interface will accept frames.
+
+            A system is normally able to use any unicast address which
+            corresponds to an entry in this table as a source address."
+    ::= { ifMIBObjects 4 }
+
+ifRcvAddressEntry  OBJECT-TYPE
+    SYNTAX      IfRcvAddressEntry
+    MAX-ACCESS  not-accessible
+    STATUS      current
+    DESCRIPTION
+            "A list of objects identifying an address for which the
+            system will accept packets/frames on the particular
+            interface identified by the index value ifIndex."
+    INDEX  { ifIndex, ifRcvAddressAddress }
+    ::= { ifRcvAddressTable 1 }
+
+IfRcvAddressEntry ::=
+    SEQUENCE {
+        ifRcvAddressAddress   PhysAddress,
+        ifRcvAddressStatus    RowStatus,
+        ifRcvAddressType      INTEGER
+    }
+
+ifRcvAddressAddress OBJECT-TYPE
+    SYNTAX      PhysAddress
+    MAX-ACCESS  not-accessible
+    STATUS      current
+    DESCRIPTION
+            "An address for which the system will accept packets/frames
+            on this entry's interface."
+    ::= { ifRcvAddressEntry 1 }
+
+ifRcvAddressStatus OBJECT-TYPE
+    SYNTAX      RowStatus
+    MAX-ACCESS  read-create
+    STATUS      current
+    DESCRIPTION
+            "This object is used to create and delete rows in the
+            ifRcvAddressTable."
+    ::= { ifRcvAddressEntry 2 }
+
+ifRcvAddressType OBJECT-TYPE
+    SYNTAX      INTEGER {
+
+                    other(1),
+                    volatile(2),
+                    nonVolatile(3)
+                }
+    MAX-ACCESS  read-create
+    STATUS      current
+    DESCRIPTION
+            "This object has the value nonVolatile(3) for those entries
+            in the table which are valid and will not be deleted by the
+            next restart of the managed system.  Entries having the
+            value volatile(2) are valid and exist, but have not been
+            saved, so that will not exist after the next restart of the
+            managed system.  Entries having the value other(1) are valid
+            and exist but are not classified as to whether they will
+            continue to exist after the next restart."
+    DEFVAL  { volatile }
+    ::= { ifRcvAddressEntry 3 }
+
+-- definition of interface-related traps.
+
+linkDown NOTIFICATION-TYPE
+    OBJECTS { ifIndex, ifAdminStatus, ifOperStatus }
+    STATUS  current
+    DESCRIPTION
+            "A linkDown trap signifies that the SNMP entity, acting in
+            an agent role, has detected that the ifOperStatus object for
+            one of its communication links is about to enter the down
+            state from some other state (but not from the notPresent
+            state).  This other state is indicated by the included value
+            of ifOperStatus."
+    ::= { snmpTraps 3 }
+
+linkUp NOTIFICATION-TYPE
+    OBJECTS { ifIndex, ifAdminStatus, ifOperStatus }
+    STATUS  current
+    DESCRIPTION
+            "A linkUp trap signifies that the SNMP entity, acting in an
+            agent role, has detected that the ifOperStatus object for
+            one of its communication links left the down state and
+            transitioned into some other state (but not into the
+            notPresent state).  This other state is indicated by the
+            included value of ifOperStatus."
+    ::= { snmpTraps 4 }
+
+-- conformance information
+
+ifConformance OBJECT IDENTIFIER ::= { ifMIB 2 }
+
+ifGroups      OBJECT IDENTIFIER ::= { ifConformance 1 }
+ifCompliances OBJECT IDENTIFIER ::= { ifConformance 2 }
+
+-- compliance statements
+
+ifCompliance3 MODULE-COMPLIANCE
+    STATUS  current
+    DESCRIPTION
+            "The compliance statement for SNMP entities which have
+            network interfaces."
+
+    MODULE  -- this module
+        MANDATORY-GROUPS { ifGeneralInformationGroup,
+                           linkUpDownNotificationsGroup }
+
+-- The groups:
+--        ifFixedLengthGroup
+--        ifHCFixedLengthGroup
+--        ifPacketGroup
+--        ifHCPacketGroup
+--        ifVHCPacketGroup
+-- are mutually exclusive; at most one of these groups is implemented
+-- for a particular interface.  When any of these groups is implemented
+-- for a particular interface, then ifCounterDiscontinuityGroup must
+-- also be implemented for that interface.
+
+        GROUP       ifFixedLengthGroup
+        DESCRIPTION
+            "This group is mandatory for those network interfaces which
+            are character-oriented or transmit data in fixed-length
+            transmission units, and for which the value of the
+            corresponding instance of ifSpeed is less than or equal to
+            20,000,000 bits/second."
+
+        GROUP       ifHCFixedLengthGroup
+        DESCRIPTION
+            "This group is mandatory for those network interfaces which
+            are character-oriented or transmit data in fixed-length
+            transmission units, and for which the value of the
+            corresponding instance of ifSpeed is greater than 20,000,000
+            bits/second."
+
+        GROUP       ifPacketGroup
+        DESCRIPTION
+            "This group is mandatory for those network interfaces which
+            are packet-oriented, and for which the value of the
+            corresponding instance of ifSpeed is less than or equal to
+            20,000,000 bits/second."
+
+        GROUP       ifHCPacketGroup
+        DESCRIPTION
+            "This group is mandatory only for those network interfaces
+            which are packet-oriented and for which the value of the
+            corresponding instance of ifSpeed is greater than 20,000,000
+            bits/second but less than or equal to 650,000,000
+            bits/second."
+
+        GROUP       ifVHCPacketGroup
+        DESCRIPTION
+            "This group is mandatory only for those network interfaces
+            which are packet-oriented and for which the value of the
+            corresponding instance of ifSpeed is greater than
+            650,000,000 bits/second."
+
+        GROUP       ifCounterDiscontinuityGroup
+        DESCRIPTION
+            "This group is mandatory for those network interfaces that
+            are required to maintain counters (i.e., those for which one
+            of the ifFixedLengthGroup, ifHCFixedLengthGroup,
+            ifPacketGroup, ifHCPacketGroup, or ifVHCPacketGroup is
+            mandatory)."
+
+        GROUP       ifRcvAddressGroup
+        DESCRIPTION
+            "The applicability of this group MUST be defined by the
+            media-specific MIBs.  Media-specific MIBs must define the
+            exact meaning, use, and semantics of the addresses in this
+            group."
+
+        OBJECT      ifLinkUpDownTrapEnable
+        MIN-ACCESS  read-only
+        DESCRIPTION
+            "Write access is not required."
+
+        OBJECT      ifPromiscuousMode
+        MIN-ACCESS  read-only
+        DESCRIPTION
+            "Write access is not required."
+
+        OBJECT       ifAdminStatus
+        SYNTAX       INTEGER { up(1), down(2) }
+        MIN-ACCESS   read-only
+        DESCRIPTION
+            "Write access is not required, nor is support for the value
+            testing(3)."
+
+        OBJECT       ifAlias
+        MIN-ACCESS   read-only
+        DESCRIPTION
+            "Write access is not required."
+    ::= { ifCompliances 3 }
+
+-- units of conformance
+
+ifGeneralInformationGroup    OBJECT-GROUP
+    OBJECTS { ifIndex, ifDescr, ifType, ifSpeed, ifPhysAddress,
+              ifAdminStatus, ifOperStatus, ifLastChange,
+              ifLinkUpDownTrapEnable, ifConnectorPresent,
+              ifHighSpeed, ifName, ifNumber, ifAlias,
+              ifTableLastChange }
+    STATUS  current
+    DESCRIPTION
+            "A collection of objects providing information applicable to
+            all network interfaces."
+    ::= { ifGroups 10 }
+
+-- the following five groups are mutually exclusive; at most
+-- one of these groups is implemented for any interface
+
+ifFixedLengthGroup    OBJECT-GROUP
+    OBJECTS { ifInOctets, ifOutOctets, ifInUnknownProtos,
+              ifInErrors, ifOutErrors }
+    STATUS  current
+    DESCRIPTION
+            "A collection of objects providing information specific to
+            non-high speed (non-high speed interfaces transmit and
+            receive at speeds less than or equal to 20,000,000
+            bits/second) character-oriented or fixed-length-transmission
+            network interfaces."
+    ::= { ifGroups 2 }
+
+ifHCFixedLengthGroup    OBJECT-GROUP
+    OBJECTS { ifHCInOctets, ifHCOutOctets,
+              ifInOctets, ifOutOctets, ifInUnknownProtos,
+              ifInErrors, ifOutErrors }
+    STATUS  current
+    DESCRIPTION
+            "A collection of objects providing information specific to
+            high speed (greater than 20,000,000 bits/second) character-
+            oriented or fixed-length-transmission network interfaces."
+    ::= { ifGroups 3 }
+
+ifPacketGroup    OBJECT-GROUP
+    OBJECTS { ifInOctets, ifOutOctets, ifInUnknownProtos,
+              ifInErrors, ifOutErrors,
+              ifMtu, ifInUcastPkts, ifInMulticastPkts,
+              ifInBroadcastPkts, ifInDiscards,
+              ifOutUcastPkts, ifOutMulticastPkts,
+              ifOutBroadcastPkts, ifOutDiscards,
+              ifPromiscuousMode }
+    STATUS  current
+    DESCRIPTION
+            "A collection of objects providing information specific to
+            non-high speed (non-high speed interfaces transmit and
+            receive at speeds less than or equal to 20,000,000
+            bits/second) packet-oriented network interfaces."
+    ::= { ifGroups 4 }
+
+ifHCPacketGroup    OBJECT-GROUP
+    OBJECTS { ifHCInOctets, ifHCOutOctets,
+              ifInOctets, ifOutOctets, ifInUnknownProtos,
+              ifInErrors, ifOutErrors,
+              ifMtu, ifInUcastPkts, ifInMulticastPkts,
+              ifInBroadcastPkts, ifInDiscards,
+              ifOutUcastPkts, ifOutMulticastPkts,
+              ifOutBroadcastPkts, ifOutDiscards,
+              ifPromiscuousMode }
+    STATUS  current
+    DESCRIPTION
+            "A collection of objects providing information specific to
+            high speed (greater than 20,000,000 bits/second but less
+            than or equal to 650,000,000 bits/second) packet-oriented
+            network interfaces."
+    ::= { ifGroups 5 }
+
+ifVHCPacketGroup    OBJECT-GROUP
+    OBJECTS { ifHCInUcastPkts, ifHCInMulticastPkts,
+              ifHCInBroadcastPkts, ifHCOutUcastPkts,
+              ifHCOutMulticastPkts, ifHCOutBroadcastPkts,
+              ifHCInOctets, ifHCOutOctets,
+              ifInOctets, ifOutOctets, ifInUnknownProtos,
+              ifInErrors, ifOutErrors,
+              ifMtu, ifInUcastPkts, ifInMulticastPkts,
+              ifInBroadcastPkts, ifInDiscards,
+              ifOutUcastPkts, ifOutMulticastPkts,
+              ifOutBroadcastPkts, ifOutDiscards,
+              ifPromiscuousMode }
+    STATUS  current
+    DESCRIPTION
+            "A collection of objects providing information specific to
+            higher speed (greater than 650,000,000 bits/second) packet-
+            oriented network interfaces."
+    ::= { ifGroups 6 }
+
+ifRcvAddressGroup    OBJECT-GROUP
+    OBJECTS { ifRcvAddressStatus, ifRcvAddressType }
+    STATUS  current
+    DESCRIPTION
+            "A collection of objects providing information on the
+            multiple addresses which an interface receives."
+    ::= { ifGroups 7 }
+
+ifStackGroup2    OBJECT-GROUP
+    OBJECTS { ifStackStatus, ifStackLastChange }
+    STATUS  current
+    DESCRIPTION
+            "A collection of objects providing information on the
+            layering of MIB-II interfaces."
+    ::= { ifGroups 11 }
+
+ifCounterDiscontinuityGroup  OBJECT-GROUP
+    OBJECTS { ifCounterDiscontinuityTime }
+    STATUS  current
+    DESCRIPTION
+            "A collection of objects providing information specific to
+            interface counter discontinuities."
+    ::= { ifGroups 13 }
+
+linkUpDownNotificationsGroup  NOTIFICATION-GROUP
+    NOTIFICATIONS { linkUp, linkDown }
+    STATUS  current
+    DESCRIPTION
+            "The notifications which indicate specific changes in the
+            value of ifOperStatus."
+    ::= { ifGroups 14 }
+
+-- Deprecated Definitions - Objects
+
+--
+--    The Interface Test Table
+--
+-- This group of objects is optional.  However, a media-specific
+
+-- MIB may make implementation of this group mandatory.
+--
+-- This table replaces the ifExtnsTestTable
+--
+
+ifTestTable   OBJECT-TYPE
+    SYNTAX      SEQUENCE OF IfTestEntry
+    MAX-ACCESS  not-accessible
+    STATUS      deprecated
+    DESCRIPTION
+            "This table contains one entry per interface.  It defines
+            objects which allow a network manager to instruct an agent
+            to test an interface for various faults.  Tests for an
+            interface are defined in the media-specific MIB for that
+            interface.  After invoking a test, the object ifTestResult
+            can be read to determine the outcome.  If an agent can not
+            perform the test, ifTestResult is set to so indicate.  The
+            object ifTestCode can be used to provide further test-
+            specific or interface-specific (or even enterprise-specific)
+            information concerning the outcome of the test.  Only one
+            test can be in progress on each interface at any one time.
+            If one test is in progress when another test is invoked, the
+            second test is rejected.  Some agents may reject a test when
+            a prior test is active on another interface.
+
+            Before starting a test, a manager-station must first obtain
+            'ownership' of the entry in the ifTestTable for the
+            interface to be tested.  This is accomplished with the
+            ifTestId and ifTestStatus objects as follows:
+
+          try_again:
+              get (ifTestId, ifTestStatus)
+              while (ifTestStatus != notInUse)
+                  /*
+                   * Loop while a test is running or some other
+                   * manager is configuring a test.
+                   */
+                  short delay
+                  get (ifTestId, ifTestStatus)
+              }
+
+              /*
+               * Is not being used right now -- let's compete
+               * to see who gets it.
+               */
+              lock_value = ifTestId
+
+              if ( set(ifTestId = lock_value, ifTestStatus = inUse,
+                       ifTestOwner = 'my-IP-address') == FAILURE)
+                  /*
+                   * Another manager got the ifTestEntry -- go
+                   * try again
+                   */
+                  goto try_again;
+
+              /*
+               * I have the lock
+               */
+              set up any test parameters.
+
+              /*
+               * This starts the test
+               */
+              set(ifTestType = test_to_run);
+
+              wait for test completion by polling ifTestResult
+
+              when test completes, agent sets ifTestResult
+                   agent also sets ifTestStatus = 'notInUse'
+
+              retrieve any additional test results, and ifTestId
+
+              if (ifTestId == lock_value+1) results are valid
+
+            A manager station first retrieves the value of the
+            appropriate ifTestId and ifTestStatus objects, periodically
+            repeating the retrieval if necessary, until the value of
+            ifTestStatus is 'notInUse'.  The manager station then tries
+            to set the same ifTestId object to the value it just
+            retrieved, the same ifTestStatus object to 'inUse', and the
+            corresponding ifTestOwner object to a value indicating
+            itself.  If the set operation succeeds then the manager has
+            obtained ownership of the ifTestEntry, and the value of the
+            ifTestId object is incremented by the agent (per the
+            semantics of TestAndIncr).  Failure of the set operation
+            indicates that some other manager has obtained ownership of
+            the ifTestEntry.
+
+            Once ownership is obtained, any test parameters can be
+            setup, and then the test is initiated by setting ifTestType.
+            On completion of the test, the agent sets ifTestStatus to
+            'notInUse'.  Once this occurs, the manager can retrieve the
+            results.  In the (rare) event that the invocation of tests
+            by two network managers were to overlap, then there would be
+            a possibility that the first test's results might be
+            overwritten by the second test's results prior to the first
+
+            results being read.  This unlikely circumstance can be
+            detected by a network manager retrieving ifTestId at the
+            same time as retrieving the test results, and ensuring that
+            the results are for the desired request.
+
+            If ifTestType is not set within an abnormally long period of
+            time after ownership is obtained, the agent should time-out
+            the manager, and reset the value of the ifTestStatus object
+            back to 'notInUse'.  It is suggested that this time-out
+            period be 5 minutes.
+
+            In general, a management station must not retransmit a
+            request to invoke a test for which it does not receive a
+            response; instead, it properly inspects an agent's MIB to
+            determine if the invocation was successful.  Only if the
+            invocation was unsuccessful, is the invocation request
+            retransmitted.
+
+            Some tests may require the interface to be taken off-line in
+            order to execute them, or may even require the agent to
+            reboot after completion of the test.  In these
+            circumstances, communication with the management station
+            invoking the test may be lost until after completion of the
+            test.  An agent is not required to support such tests.
+            However, if such tests are supported, then the agent should
+            make every effort to transmit a response to the request
+            which invoked the test prior to losing communication.  When
+            the agent is restored to normal service, the results of the
+            test are properly made available in the appropriate objects.
+            Note that this requires that the ifIndex value assigned to
+            an interface must be unchanged even if the test causes a
+            reboot.  An agent must reject any test for which it cannot,
+            perhaps due to resource constraints, make available at least
+            the minimum amount of information after that test
+            completes."
+    ::= { ifMIBObjects 3 }
+
+ifTestEntry OBJECT-TYPE
+    SYNTAX       IfTestEntry
+    MAX-ACCESS   not-accessible
+    STATUS       deprecated
+    DESCRIPTION
+            "An entry containing objects for invoking tests on an
+            interface."
+    AUGMENTS  { ifEntry }
+    ::= { ifTestTable 1 }
+
+IfTestEntry ::=
+
+    SEQUENCE {
+        ifTestId           TestAndIncr,
+        ifTestStatus       INTEGER,
+        ifTestType         AutonomousType,
+        ifTestResult       INTEGER,
+        ifTestCode         OBJECT IDENTIFIER,
+        ifTestOwner        OwnerString
+    }
+
+ifTestId         OBJECT-TYPE
+    SYNTAX       TestAndIncr
+    MAX-ACCESS   read-write
+    STATUS       deprecated
+    DESCRIPTION
+            "This object identifies the current invocation of the
+            interface's test."
+    ::= { ifTestEntry 1 }
+
+ifTestStatus     OBJECT-TYPE
+    SYNTAX       INTEGER { notInUse(1), inUse(2) }
+    MAX-ACCESS   read-write
+    STATUS       deprecated
+    DESCRIPTION
+            "This object indicates whether or not some manager currently
+            has the necessary 'ownership' required to invoke a test on
+            this interface.  A write to this object is only successful
+            when it changes its value from 'notInUse(1)' to 'inUse(2)'.
+            After completion of a test, the agent resets the value back
+            to 'notInUse(1)'."
+    ::= { ifTestEntry 2 }
+
+ifTestType       OBJECT-TYPE
+    SYNTAX       AutonomousType
+    MAX-ACCESS   read-write
+    STATUS       deprecated
+    DESCRIPTION
+            "A control variable used to start and stop operator-
+            initiated interface tests.  Most OBJECT IDENTIFIER values
+            assigned to tests are defined elsewhere, in association with
+            specific types of interface.  However, this document assigns
+            a value for a full-duplex loopback test, and defines the
+            special meanings of the subject identifier:
+
+                noTest  OBJECT IDENTIFIER ::= { 0 0 }
+
+            When the value noTest is written to this object, no action
+            is taken unless a test is in progress, in which case the
+            test is aborted.  Writing any other value to this object is
+
+            only valid when no test is currently in progress, in which
+            case the indicated test is initiated.
+
+            When read, this object always returns the most recent value
+            that ifTestType was set to.  If it has not been set since
+            the last initialization of the network management subsystem
+            on the agent, a value of noTest is returned."
+    ::= { ifTestEntry 3 }
+
+ifTestResult  OBJECT-TYPE
+    SYNTAX       INTEGER {
+                     none(1),          -- no test yet requested
+                     success(2),
+                     inProgress(3),
+                     notSupported(4),
+                     unAbleToRun(5),   -- due to state of system
+                     aborted(6),
+                     failed(7)
+                 }
+    MAX-ACCESS   read-only
+    STATUS       deprecated
+    DESCRIPTION
+            "This object contains the result of the most recently
+            requested test, or the value none(1) if no tests have been
+            requested since the last reset.  Note that this facility
+            provides no provision for saving the results of one test
+            when starting another, as could be required if used by
+            multiple managers concurrently."
+    ::= { ifTestEntry 4 }
+
+ifTestCode  OBJECT-TYPE
+    SYNTAX       OBJECT IDENTIFIER
+    MAX-ACCESS   read-only
+    STATUS       deprecated
+    DESCRIPTION
+            "This object contains a code which contains more specific
+            information on the test result, for example an error-code
+            after a failed test.  Error codes and other values this
+            object may take are specific to the type of interface and/or
+            test.  The value may have the semantics of either the
+            AutonomousType or InstancePointer textual conventions as
+            defined in RFC 2579.  The identifier:
+
+                testCodeUnknown  OBJECT IDENTIFIER ::= { 0 0 }
+
+            is defined for use if no additional result code is
+            available."
+    ::= { ifTestEntry 5 }
+
+ifTestOwner      OBJECT-TYPE
+    SYNTAX       OwnerString
+    MAX-ACCESS   read-write
+    STATUS       deprecated
+    DESCRIPTION
+            "The entity which currently has the 'ownership' required to
+            invoke a test on this interface."
+    ::= { ifTestEntry 6 }
+
+-- Deprecated Definitions - Groups
+
+ifGeneralGroup    OBJECT-GROUP
+    OBJECTS { ifDescr, ifType, ifSpeed, ifPhysAddress,
+              ifAdminStatus, ifOperStatus, ifLastChange,
+              ifLinkUpDownTrapEnable, ifConnectorPresent,
+              ifHighSpeed, ifName }
+    STATUS  deprecated
+    DESCRIPTION
+            "A collection of objects deprecated in favour of
+            ifGeneralInformationGroup."
+    ::= { ifGroups 1 }
+
+ifTestGroup    OBJECT-GROUP
+    OBJECTS { ifTestId, ifTestStatus, ifTestType,
+              ifTestResult, ifTestCode, ifTestOwner }
+    STATUS  deprecated
+    DESCRIPTION
+            "A collection of objects providing the ability to invoke
+            tests on an interface."
+    ::= { ifGroups 8 }
+
+ifStackGroup    OBJECT-GROUP
+    OBJECTS { ifStackStatus }
+    STATUS  deprecated
+    DESCRIPTION
+            "The previous collection of objects providing information on
+            the layering of MIB-II interfaces."
+    ::= { ifGroups 9 }
+
+ifOldObjectsGroup    OBJECT-GROUP
+    OBJECTS { ifInNUcastPkts, ifOutNUcastPkts,
+              ifOutQLen, ifSpecific }
+    STATUS  deprecated
+    DESCRIPTION
+            "The collection of objects deprecated from the original MIB-
+            II interfaces group."
+    ::= { ifGroups 12 }
+
+-- Deprecated Definitions - Compliance
+
+ifCompliance MODULE-COMPLIANCE
+    STATUS  deprecated
+    DESCRIPTION
+            "A compliance statement defined in a previous version of
+            this MIB module, for SNMP entities which have network
+            interfaces."
+
+    MODULE  -- this module
+        MANDATORY-GROUPS { ifGeneralGroup, ifStackGroup }
+
+        GROUP       ifFixedLengthGroup
+        DESCRIPTION
+            "This group is mandatory for all network interfaces which
+            are character-oriented or transmit data in fixed-length
+            transmission units."
+
+        GROUP       ifHCFixedLengthGroup
+        DESCRIPTION
+            "This group is mandatory only for those network interfaces
+            which are character-oriented or transmit data in fixed-
+            length transmission units, and for which the value of the
+            corresponding instance of ifSpeed is greater than 20,000,000
+            bits/second."
+
+        GROUP       ifPacketGroup
+        DESCRIPTION
+            "This group is mandatory for all network interfaces which
+            are packet-oriented."
+
+        GROUP       ifHCPacketGroup
+        DESCRIPTION
+            "This group is mandatory only for those network interfaces
+            which are packet-oriented and for which the value of the
+            corresponding instance of ifSpeed is greater than
+            650,000,000 bits/second."
+
+        GROUP       ifTestGroup
+        DESCRIPTION
+            "This group is optional.  Media-specific MIBs which require
+            interface tests are strongly encouraged to use this group
+            for invoking tests and reporting results.  A medium specific
+            MIB which has mandatory tests may make implementation of
+
+            this group mandatory."
+
+        GROUP       ifRcvAddressGroup
+        DESCRIPTION
+            "The applicability of this group MUST be defined by the
+            media-specific MIBs.  Media-specific MIBs must define the
+            exact meaning, use, and semantics of the addresses in this
+            group."
+
+        OBJECT      ifLinkUpDownTrapEnable
+        MIN-ACCESS  read-only
+        DESCRIPTION
+            "Write access is not required."
+
+        OBJECT      ifPromiscuousMode
+        MIN-ACCESS  read-only
+        DESCRIPTION
+            "Write access is not required."
+
+        OBJECT      ifStackStatus
+        SYNTAX      INTEGER { active(1) } -- subset of RowStatus
+        MIN-ACCESS  read-only
+        DESCRIPTION
+            "Write access is not required, and only one of the six
+            enumerated values for the RowStatus textual convention need
+            be supported, specifically: active(1)."
+
+        OBJECT       ifAdminStatus
+        SYNTAX       INTEGER { up(1), down(2) }
+        MIN-ACCESS   read-only
+        DESCRIPTION
+            "Write access is not required, nor is support for the value
+            testing(3)."
+    ::= { ifCompliances 1 }
+
+ifCompliance2 MODULE-COMPLIANCE
+    STATUS      deprecated
+    DESCRIPTION
+            "A compliance statement defined in a previous version of
+            this MIB module, for SNMP entities which have network
+            interfaces."
+
+    MODULE  -- this module
+        MANDATORY-GROUPS { ifGeneralInformationGroup, ifStackGroup2,
+                           ifCounterDiscontinuityGroup }
+
+        GROUP       ifFixedLengthGroup
+        DESCRIPTION
+            "This group is mandatory for all network interfaces which
+            are character-oriented or transmit data in fixed-length
+            transmission units."
+
+        GROUP       ifHCFixedLengthGroup
+        DESCRIPTION
+            "This group is mandatory only for those network interfaces
+            which are character-oriented or transmit data in fixed-
+            length transmission units, and for which the value of the
+            corresponding instance of ifSpeed is greater than 20,000,000
+            bits/second."
+
+        GROUP       ifPacketGroup
+        DESCRIPTION
+            "This group is mandatory for all network interfaces which
+            are packet-oriented."
+
+        GROUP       ifHCPacketGroup
+        DESCRIPTION
+            "This group is mandatory only for those network interfaces
+            which are packet-oriented and for which the value of the
+            corresponding instance of ifSpeed is greater than
+            650,000,000 bits/second."
+
+        GROUP       ifRcvAddressGroup
+        DESCRIPTION
+            "The applicability of this group MUST be defined by the
+            media-specific MIBs.  Media-specific MIBs must define the
+            exact meaning, use, and semantics of the addresses in this
+            group."
+
+        OBJECT      ifLinkUpDownTrapEnable
+        MIN-ACCESS  read-only
+        DESCRIPTION
+            "Write access is not required."
+
+        OBJECT      ifPromiscuousMode
+        MIN-ACCESS  read-only
+        DESCRIPTION
+            "Write access is not required."
+
+        OBJECT      ifStackStatus
+        SYNTAX      INTEGER { active(1) } -- subset of RowStatus
+        MIN-ACCESS  read-only
+        DESCRIPTION
+            "Write access is not required, and only one of the six
+            enumerated values for the RowStatus textual convention need
+            be supported, specifically: active(1)."
+
+        OBJECT       ifAdminStatus
+        SYNTAX       INTEGER { up(1), down(2) }
+        MIN-ACCESS   read-only
+        DESCRIPTION
+            "Write access is not required, nor is support for the value
+            testing(3)."
+
+        OBJECT       ifAlias
+        MIN-ACCESS   read-only
+        DESCRIPTION
+            "Write access is not required."
+    ::= { ifCompliances 2 }
+
+END
diff -Naur tomato/release/src/router/snmp/mibs/INET-ADDRESS-MIB.txt tomato121/release/src/router/snmp/mibs/INET-ADDRESS-MIB.txt
--- tomato/release/src/router/snmp/mibs/INET-ADDRESS-MIB.txt	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/mibs/INET-ADDRESS-MIB.txt	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,298 @@
+INET-ADDRESS-MIB DEFINITIONS ::= BEGIN
+
+IMPORTS
+    MODULE-IDENTITY, mib-2, Unsigned32 FROM SNMPv2-SMI
+    TEXTUAL-CONVENTION                 FROM SNMPv2-TC;
+
+inetAddressMIB MODULE-IDENTITY
+    LAST-UPDATED "200205090000Z"
+    ORGANIZATION
+        "IETF Operations and Management Area"
+    CONTACT-INFO
+        "Juergen Schoenwaelder (Editor)
+         TU Braunschweig
+         Bueltenweg 74/75
+         38106 Braunschweig, Germany
+
+         Phone: +49 531 391-3289
+         EMail: schoenw@ibr.cs.tu-bs.de
+
+         Send comments to <mibs@ops.ietf.org>."
+    DESCRIPTION
+        "This MIB module defines textual conventions for
+         representing Internet addresses. An Internet
+         address can be an IPv4 address, an IPv6 address
+         or a DNS domain name. This module also defines
+         textual conventions for Internet port numbers,
+         autonomous system numbers and the length of an
+         Internet address prefix."
+    REVISION     "200205090000Z"
+    DESCRIPTION
+        "Second version, published as RFC 3291. This
+         revisions contains several clarifications and it
+
+         introduces several new textual conventions:
+         InetAddressPrefixLength, InetPortNumber,
+         InetAutonomousSystemNumber, InetAddressIPv4z,
+         and InetAddressIPv6z."
+    REVISION     "200006080000Z"
+    DESCRIPTION
+        "Initial version, published as RFC 2851."
+    ::= { mib-2 76 }
+
+InetAddressType ::= TEXTUAL-CONVENTION
+    STATUS      current
+    DESCRIPTION
+        "A value that represents a type of Internet address.
+         unknown(0)  An unknown address type. This value MUST
+                     be used if the value of the corresponding
+                     InetAddress object is a zero-length string.
+                     It may also be used to indicate an IP address
+                     which is not in one of the formats defined
+                     below.
+
+         ipv4(1)     An IPv4 address as defined by the
+                     InetAddressIPv4 textual convention.
+
+         ipv6(2)     A global IPv6 address as defined by the
+                     InetAddressIPv6 textual convention.
+
+         ipv4z(3)    A non-global IPv4 address including a zone
+                     index as defined by the InetAddressIPv4z
+                     textual convention.
+
+         ipv6z(4)    A non-global IPv6 address including a zone
+                     index as defined by the InetAddressIPv6z
+                     textual convention.
+
+         dns(16)     A DNS domain name as defined by the
+                     InetAddressDNS textual convention.
+
+         Each definition of a concrete InetAddressType value must be
+         accompanied by a definition of a textual convention for use
+         with that InetAddressType.
+
+         To support future extensions, the InetAddressType textual
+         convention SHOULD NOT be sub-typed in object type definitions.
+         It MAY be sub-typed in compliance statements in order to
+         require only a subset of these address types for a compliant
+         implementation.
+
+         Implementations must ensure that InetAddressType objects
+
+         and any dependent objects (e.g. InetAddress objects) are
+         consistent.  An inconsistentValue error must be generated
+         if an attempt to change an InetAddressType object would,
+         for example, lead to an undefined InetAddress value.  In
+         particular, InetAddressType/InetAddress pairs must be
+         changed together if the address type changes (e.g. from
+         ipv6(2) to ipv4(1))."
+    SYNTAX      INTEGER {
+                    unknown(0),
+                    ipv4(1),
+                    ipv6(2),
+                    ipv4z(3),
+                    ipv6z(4),
+                    dns(16)
+                }
+
+InetAddress ::= TEXTUAL-CONVENTION
+    STATUS      current
+    DESCRIPTION
+        "Denotes a generic Internet address.
+
+         An InetAddress value is always interpreted within the context
+         of an InetAddressType value. Every usage of the InetAddress
+         textual convention is required to specify the InetAddressType
+         object which provides the context.  It is suggested that the
+         InetAddressType object is logically registered before the
+         object(s) which use the InetAddress textual convention if
+         they appear in the same logical row.
+
+         The value of an InetAddress object must always be
+         consistent with the value of the associated InetAddressType
+         object. Attempts to set an InetAddress object to a value
+         which is inconsistent with the associated InetAddressType
+         must fail with an inconsistentValue error.
+
+         When this textual convention is used as the syntax of an
+         index object, there may be issues with the limit of 128
+         sub-identifiers specified in SMIv2, STD 58. In this case,
+         the object definition MUST include a 'SIZE' clause to
+         limit the number of potential instance sub-identifiers."
+    SYNTAX      OCTET STRING (SIZE (0..255))
+
+InetAddressIPv4 ::= TEXTUAL-CONVENTION
+    DISPLAY-HINT "1d.1d.1d.1d"
+    STATUS       current
+    DESCRIPTION
+        "Represents an IPv4 network address:
+
+           octets   contents         encoding
+            1-4     IPv4 address     network-byte order
+
+         The corresponding InetAddressType value is ipv4(1).
+
+         This textual convention SHOULD NOT be used directly in object
+         definitions since it restricts addresses to a specific format.
+         However, if it is used, it MAY be used either on its own or in
+         conjunction with InetAddressType as a pair."
+    SYNTAX       OCTET STRING (SIZE (4))
+
+InetAddressIPv6 ::= TEXTUAL-CONVENTION
+    DISPLAY-HINT "2x:2x:2x:2x:2x:2x:2x:2x"
+    STATUS       current
+    DESCRIPTION
+        "Represents an IPv6 network address:
+
+           octets   contents         encoding
+            1-16    IPv6 address     network-byte order
+
+         The corresponding InetAddressType value is ipv6(2).
+
+         This textual convention SHOULD NOT be used directly in object
+         definitions since it restricts addresses to a specific format.
+         However, if it is used, it MAY be used either on its own or in
+         conjunction with InetAddressType as a pair."
+    SYNTAX       OCTET STRING (SIZE (16))
+
+InetAddressIPv4z ::= TEXTUAL-CONVENTION
+    DISPLAY-HINT "1d.1d.1d.1d%4d"
+    STATUS       current
+    DESCRIPTION
+        "Represents a non-global IPv4 network address together
+         with its zone index:
+
+           octets   contents         encoding
+            1-4     IPv4 address     network-byte order
+            5-8     zone index       network-byte order
+
+         The corresponding InetAddressType value is ipv4z(3).
+
+         The zone index (bytes 5-8) is used to disambiguate identical
+         address values on nodes which have interfaces attached to
+         different zones of the same scope. The zone index may contain
+         the special value 0 which refers to the default zone for each
+         scope.
+
+         This textual convention SHOULD NOT be used directly in object
+
+         definitions since it restricts addresses to a specific format.
+         However, if it is used, it MAY be used either on its own or in
+         conjunction with InetAddressType as a pair."
+    SYNTAX OCTET STRING (SIZE (8))
+
+InetAddressIPv6z ::= TEXTUAL-CONVENTION
+    DISPLAY-HINT "2x:2x:2x:2x:2x:2x:2x:2x%4d"
+    STATUS       current
+    DESCRIPTION
+        "Represents a non-global IPv6 network address together
+         with its zone index:
+
+           octets   contents         encoding
+            1-16    IPv6 address     network-byte order
+           17-20    zone index       network-byte order
+
+         The corresponding InetAddressType value is ipv6z(4).
+
+         The zone index (bytes 17-20) is used to disambiguate
+         identical address values on nodes which have interfaces
+         attached to different zones of the same scope. The zone index
+         may contain the special value 0 which refers to the default
+         zone for each scope.
+
+         This textual convention SHOULD NOT be used directly in object
+         definitions since it restricts addresses to a specific format.
+         However, if it is used, it MAY be used either on its own or in
+         conjunction with InetAddressType as a pair."
+    SYNTAX OCTET STRING (SIZE (20))
+
+InetAddressDNS ::= TEXTUAL-CONVENTION
+    DISPLAY-HINT "255a"
+    STATUS       current
+    DESCRIPTION
+        "Represents a DNS domain name. The name SHOULD be fully
+         qualified whenever possible.
+
+         The corresponding InetAddressType is dns(16).
+
+         The DESCRIPTION clause of InetAddress objects that may have
+         InetAddressDNS values must fully describe how (and when) such
+         names are to be resolved to IP addresses.
+
+         This textual convention SHOULD NOT be used directly in object
+         definitions since it restricts addresses to a specific format.
+         However, if it is used, it MAY be used either on its own or in
+         conjunction with InetAddressType as a pair."
+    SYNTAX       OCTET STRING (SIZE (1..255))
+
+InetAddressPrefixLength ::= TEXTUAL-CONVENTION
+    STATUS      current
+    DESCRIPTION
+        "Denotes the length of a generic Internet network address
+         prefix. A value of n corresponds to an IP address mask
+         which has n contiguous 1-bits from the most significant
+         bit (MSB) and all other bits set to 0.
+
+         An InetAddressPrefixLength value is always interpreted within
+         the context of an InetAddressType value. Every usage of the
+         InetAddressPrefixLength textual convention is required to
+         specify the InetAddressType object which provides the
+         context.  It is suggested that the InetAddressType object is
+         logically registered before the object(s) which use the
+         InetAddressPrefixLength textual convention if they appear in
+         the same logical row.
+
+         InetAddressPrefixLength values that are larger than
+         the maximum length of an IP address for a specific
+         InetAddressType are treated as the maximum significant
+         value applicable for the InetAddressType. The maximum
+         significant value is 32 for the InetAddressType
+         'ipv4(1)' and 'ipv4z(3)' and 128 for the InetAddressType
+         'ipv6(2)' and 'ipv6z(4)'. The maximum significant value
+         for the InetAddressType 'dns(16)' is 0.
+
+         The value zero is object-specific and must be defined as
+         part of the description of any object which uses this
+         syntax. Examples of the usage of zero might include
+         situations where the Internet network address prefix
+         is unknown or does not apply."
+    SYNTAX      Unsigned32
+
+InetPortNumber ::= TEXTUAL-CONVENTION
+    STATUS      current
+    DESCRIPTION
+        "Represents a 16 bit port number of an Internet transport
+         layer protocol. Port numbers are assigned by IANA. A
+         current list of all assignments is available from
+         <http://www.iana.org/>.
+
+         The value zero is object-specific and must be defined as
+         part of the description of any object which uses this
+         syntax. Examples of the usage of zero might include
+         situations where a port number is unknown, or when the
+         value zero is used as a wildcard in a filter."
+    REFERENCE  "STD 6 (RFC 768), STD 7 (RFC 793) and RFC 2960"
+    SYNTAX      Unsigned32 (0..65535)
+
+InetAutonomousSystemNumber ::= TEXTUAL-CONVENTION
+    STATUS      current
+    DESCRIPTION
+        "Represents an autonomous system number which identifies an
+         Autonomous System (AS). An AS is a set of routers under a
+         single technical administration, using an interior gateway
+         protocol and common metrics to route packets within the AS,
+         and using an exterior gateway protocol to route packets to
+         other ASs'. IANA maintains the AS number space and has
+         delegated large parts to the regional registries.
+
+         Autonomous system numbers are currently limited to 16 bits
+         (0..65535). There is however work in progress to enlarge the
+         autonomous system number space to 32 bits. This textual
+         convention therefore uses an Unsigned32 value without a
+         range restriction in order to support a larger autonomous
+         system number space."
+    REFERENCE  "RFC 1771, RFC 1930"
+    SYNTAX      Unsigned32
+
+END
diff -Naur tomato/release/src/router/snmp/mibs/IP-FORWARD-MIB.txt tomato121/release/src/router/snmp/mibs/IP-FORWARD-MIB.txt
--- tomato/release/src/router/snmp/mibs/IP-FORWARD-MIB.txt	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/mibs/IP-FORWARD-MIB.txt	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,809 @@
+IP-FORWARD-MIB DEFINITIONS ::= BEGIN
+
+IMPORTS
+    MODULE-IDENTITY, OBJECT-TYPE, IpAddress, Integer32, Gauge32
+        FROM SNMPv2-SMI
+    RowStatus
+        FROM SNMPv2-TC
+    ip
+        FROM RFC1213-MIB
+    MODULE-COMPLIANCE, OBJECT-GROUP
+        FROM SNMPv2-CONF;
+
+ipForward MODULE-IDENTITY
+    LAST-UPDATED "9609190000Z"     -- Thu Sep 26 16:34:47 PDT 1996
+    ORGANIZATION "IETF OSPF Working Group"
+    CONTACT-INFO
+     "        Fred Baker
+      Postal: Cisco Systems
+              519 Lado Drive
+              Santa Barbara, California 93111
+
+      Phone:  +1 805 681 0115
+      Email:  fred@cisco.com
+      "
+    DESCRIPTION
+            "The MIB module for the display of CIDR multipath IP Routes."
+    REVISION      "9609190000Z"
+    DESCRIPTION
+            "Revisions made by the OSPF WG."
+    ::= { ip 24 }
+
+ipCidrRouteNumber OBJECT-TYPE
+    SYNTAX   Gauge32
+    MAX-ACCESS read-only
+    STATUS   current
+    DESCRIPTION
+       "The number of current ipCidrRouteTable entries
+       that are not invalid."
+    ::= { ipForward 3 }
+
+--  IP CIDR Route Table
+
+--  The IP CIDR Route Table obsoletes and replaces the ipRoute
+--  Table current in MIB-I and MIB-II and the IP Forwarding Table.
+--  It adds knowledge of the autonomous system of the next hop,
+--  multiple next hops, and policy routing, and Classless
+
+--  Inter-Domain Routing.
+
+ipCidrRouteTable OBJECT-TYPE
+    SYNTAX   SEQUENCE OF IpCidrRouteEntry
+    MAX-ACCESS not-accessible
+    STATUS   current
+    DESCRIPTION
+       "This entity's IP Routing table."
+    REFERENCE
+       "RFC 1213 Section 6.6, The IP Group"
+    ::= { ipForward 4 }
+
+ipCidrRouteEntry OBJECT-TYPE
+    SYNTAX   IpCidrRouteEntry
+    MAX-ACCESS not-accessible
+    STATUS   current
+    DESCRIPTION
+       "A particular route to  a  particular  destina-
+       tion, under a particular policy."
+    INDEX {
+        ipCidrRouteDest,
+        ipCidrRouteMask,
+        ipCidrRouteTos,
+        ipCidrRouteNextHop
+        }
+    ::= { ipCidrRouteTable 1 }
+
+IpCidrRouteEntry ::=
+    SEQUENCE {
+        ipCidrRouteDest
+            IpAddress,
+        ipCidrRouteMask
+            IpAddress,
+        ipCidrRouteTos
+             Integer32,
+        ipCidrRouteNextHop
+            IpAddress,
+        ipCidrRouteIfIndex
+            Integer32,
+        ipCidrRouteType
+            INTEGER,
+        ipCidrRouteProto
+            INTEGER,
+        ipCidrRouteAge
+            Integer32,
+        ipCidrRouteInfo
+            OBJECT IDENTIFIER,
+        ipCidrRouteNextHopAS
+
+            Integer32,
+        ipCidrRouteMetric1
+            Integer32,
+        ipCidrRouteMetric2
+            Integer32,
+        ipCidrRouteMetric3
+            Integer32,
+        ipCidrRouteMetric4
+            Integer32,
+        ipCidrRouteMetric5
+            Integer32,
+        ipCidrRouteStatus
+            RowStatus
+    }
+
+ipCidrRouteDest OBJECT-TYPE
+    SYNTAX   IpAddress
+    MAX-ACCESS read-only
+    STATUS   current
+    DESCRIPTION
+       "The destination IP address of this route.
+
+       This object may not take a Multicast (Class  D)
+       address value.
+
+       Any assignment (implicit or  otherwise)  of  an
+       instance  of  this  object to a value x must be
+       rejected if the bitwise logical-AND of  x  with
+       the  value of the corresponding instance of the
+       ipCidrRouteMask object is not equal to x."
+    ::= { ipCidrRouteEntry 1 }
+
+ipCidrRouteMask OBJECT-TYPE
+    SYNTAX   IpAddress
+    MAX-ACCESS read-only
+    STATUS   current
+    DESCRIPTION
+       "Indicate the mask to be logical-ANDed with the
+       destination  address  before  being compared to
+       the value  in  the  ipCidrRouteDest  field.   For
+       those  systems  that  do  not support arbitrary
+       subnet masks, an agent constructs the value  of
+       the  ipCidrRouteMask  by  reference to the IP Ad-
+       dress Class.
+
+       Any assignment (implicit or  otherwise)  of  an
+       instance  of  this  object to a value x must be
+       rejected if the bitwise logical-AND of  x  with
+
+       the  value of the corresponding instance of the
+       ipCidrRouteDest object is not equal to ipCidrRoute-
+       Dest."
+    ::= { ipCidrRouteEntry 2 }
+
+-- The following convention is included for specification
+-- of TOS Field contents.  At this time, the Host Requirements
+-- and the Router Requirements documents disagree on the width
+-- of the TOS field.  This mapping describes the Router
+-- Requirements mapping, and leaves room to widen the TOS field
+-- without impact to fielded systems.
+
+ipCidrRouteTos OBJECT-TYPE
+    SYNTAX   Integer32
+    MAX-ACCESS read-only
+    STATUS   current
+    DESCRIPTION
+       "The policy specifier is the IP TOS Field.  The encoding
+       of IP TOS is as specified  by  the  following convention.
+       Zero indicates the default path if no more  specific
+       policy applies.
+
+       +-----+-----+-----+-----+-----+-----+-----+-----+
+       |                 |                       |     |
+       |   PRECEDENCE    |    TYPE OF SERVICE    |  0  |
+       |                 |                       |     |
+       +-----+-----+-----+-----+-----+-----+-----+-----+
+
+                IP TOS                IP TOS
+           Field     Policy      Field     Policy
+           Contents    Code      Contents    Code
+           0 0 0 0  ==>   0      0 0 0 1  ==>   2
+           0 0 1 0  ==>   4      0 0 1 1  ==>   6
+           0 1 0 0  ==>   8      0 1 0 1  ==>  10
+           0 1 1 0  ==>  12      0 1 1 1  ==>  14
+           1 0 0 0  ==>  16      1 0 0 1  ==>  18
+           1 0 1 0  ==>  20      1 0 1 1  ==>  22
+           1 1 0 0  ==>  24      1 1 0 1  ==>  26
+           1 1 1 0  ==>  28      1 1 1 1  ==>  30"
+    ::= { ipCidrRouteEntry 3 }
+
+ipCidrRouteNextHop OBJECT-TYPE
+    SYNTAX   IpAddress
+    MAX-ACCESS read-only
+    STATUS   current
+    DESCRIPTION
+       "On remote routes, the address of the next sys-
+       tem en route; Otherwise, 0.0.0.0."
+    ::= { ipCidrRouteEntry 4 }
+
+ipCidrRouteIfIndex OBJECT-TYPE
+    SYNTAX   Integer32
+    MAX-ACCESS read-create
+    STATUS   current
+    DESCRIPTION
+       "The ifIndex value which identifies  the  local
+       interface  through  which  the next hop of this
+       route should be reached."
+    DEFVAL { 0 }
+    ::= { ipCidrRouteEntry 5 }
+
+ipCidrRouteType OBJECT-TYPE
+    SYNTAX   INTEGER {
+                other    (1), -- not specified by this MIB
+                reject   (2), -- route which discards traffic
+                local    (3), -- local interface
+                remote   (4)  -- remote destination
+             }
+    MAX-ACCESS read-create
+    STATUS   current
+    DESCRIPTION
+       "The type of route.  Note that local(3)  refers
+       to  a route for which the next hop is the final
+       destination; remote(4) refers to  a  route  for
+       which  the  next  hop is not the final destina-
+       tion.
+
+       Routes which do not result in traffic forwarding or
+       rejection should not be displayed even if the
+       implementation keeps them stored internally.
+
+       reject (2) refers to a route which, if matched, discards
+       the message as unreachable. This is used in some
+       protocols as a means of correctly aggregating routes."
+    ::= { ipCidrRouteEntry 6 }
+
+ipCidrRouteProto OBJECT-TYPE
+    SYNTAX   INTEGER {
+                other     (1),  -- not specified
+                local     (2),  -- local interface
+                netmgmt   (3),  -- static route
+                icmp      (4),  -- result of ICMP Redirect
+
+                        -- the following are all dynamic
+                        -- routing protocols
+
+                egp        (5),  -- Exterior Gateway Protocol
+                ggp        (6),  -- Gateway-Gateway Protocol
+                hello      (7),  -- FuzzBall HelloSpeak
+                rip        (8),  -- Berkeley RIP or RIP-II
+                isIs       (9),  -- Dual IS-IS
+                esIs       (10), -- ISO 9542
+                ciscoIgrp  (11), -- Cisco IGRP
+                bbnSpfIgp  (12), -- BBN SPF IGP
+                ospf       (13), -- Open Shortest Path First
+                bgp        (14), -- Border Gateway Protocol
+                idpr       (15), -- InterDomain Policy Routing
+                ciscoEigrp (16)  -- Cisco EIGRP
+             }
+    MAX-ACCESS read-only
+    STATUS   current
+    DESCRIPTION
+       "The routing mechanism via which this route was
+       learned.  Inclusion of values for gateway rout-
+       ing protocols is not  intended  to  imply  that
+       hosts should support those protocols."
+    ::= { ipCidrRouteEntry 7 }
+
+ipCidrRouteAge OBJECT-TYPE
+    SYNTAX   Integer32
+    MAX-ACCESS read-only
+    STATUS   current
+    DESCRIPTION
+       "The number of seconds  since  this  route  was
+       last  updated  or  otherwise  determined  to be
+       correct.  Note that no semantics of  `too  old'
+       can  be implied except through knowledge of the
+       routing  protocol  by  which  the   route   was
+       learned."
+    DEFVAL  { 0 }
+    ::= { ipCidrRouteEntry 8 }
+
+ipCidrRouteInfo OBJECT-TYPE
+    SYNTAX   OBJECT IDENTIFIER
+    MAX-ACCESS read-create
+    STATUS   current
+    DESCRIPTION
+       "A reference to MIB definitions specific to the
+       particular  routing protocol which is responsi-
+       ble for this route, as determined by the  value
+       specified  in the route's ipCidrRouteProto value.
+       If this information is not present,  its  value
+       should be set to the OBJECT IDENTIFIER { 0 0 },
+       which is a syntactically valid object  identif-
+
+       ier, and any implementation conforming to ASN.1
+       and the Basic Encoding Rules must  be  able  to
+       generate and recognize this value."
+    ::= { ipCidrRouteEntry 9 }
+
+ipCidrRouteNextHopAS OBJECT-TYPE
+    SYNTAX   Integer32
+    MAX-ACCESS read-create
+    STATUS   current
+    DESCRIPTION
+       "The Autonomous System Number of the Next  Hop.
+       The  semantics of this object are determined by
+       the routing-protocol specified in  the  route's
+       ipCidrRouteProto  value. When  this object is
+       unknown or not relevant its value should be set
+       to zero."
+    DEFVAL { 0 }
+    ::= { ipCidrRouteEntry 10 }
+
+ipCidrRouteMetric1 OBJECT-TYPE
+    SYNTAX   Integer32
+    MAX-ACCESS read-create
+    STATUS   current
+    DESCRIPTION
+       "The primary routing  metric  for  this  route.
+       The  semantics of this metric are determined by
+       the routing-protocol specified in  the  route's
+       ipCidrRouteProto  value.   If  this metric is not
+       used, its value should be set to -1."
+    DEFVAL { -1 }
+    ::= { ipCidrRouteEntry 11 }
+
+ipCidrRouteMetric2 OBJECT-TYPE
+    SYNTAX   Integer32
+    MAX-ACCESS read-create
+    STATUS   current
+    DESCRIPTION
+       "An alternate routing metric  for  this  route.
+       The  semantics of this metric are determined by
+       the routing-protocol specified in  the  route's
+       ipCidrRouteProto  value.   If  this metric is not
+       used, its value should be set to -1."
+    DEFVAL { -1 }
+    ::= { ipCidrRouteEntry 12 }
+
+ipCidrRouteMetric3 OBJECT-TYPE
+    SYNTAX   Integer32
+    MAX-ACCESS read-create
+    STATUS   current
+    DESCRIPTION
+       "An alternate routing metric  for  this  route.
+       The  semantics of this metric are determined by
+       the routing-protocol specified in  the  route's
+       ipCidrRouteProto  value.   If  this metric is not
+       used, its value should be set to -1."
+    DEFVAL { -1 }
+    ::= { ipCidrRouteEntry 13 }
+
+ipCidrRouteMetric4 OBJECT-TYPE
+    SYNTAX   Integer32
+    MAX-ACCESS read-create
+    STATUS   current
+    DESCRIPTION
+       "An alternate routing metric  for  this  route.
+       The  semantics of this metric are determined by
+       the routing-protocol specified in  the  route's
+       ipCidrRouteProto  value.   If  this metric is not
+       used, its value should be set to -1."
+    DEFVAL { -1 }
+    ::= { ipCidrRouteEntry 14 }
+
+ipCidrRouteMetric5 OBJECT-TYPE
+    SYNTAX   Integer32
+    MAX-ACCESS read-create
+    STATUS   current
+    DESCRIPTION
+       "An alternate routing metric  for  this  route.
+       The  semantics of this metric are determined by
+       the routing-protocol specified in  the  route's
+       ipCidrRouteProto  value.   If  this metric is not
+       used, its value should be set to -1."
+    DEFVAL { -1 }
+    ::= { ipCidrRouteEntry 15 }
+
+ipCidrRouteStatus OBJECT-TYPE
+    SYNTAX   RowStatus
+    MAX-ACCESS read-create
+    STATUS   current
+    DESCRIPTION
+       "The row status variable, used according to
+       row installation and removal conventions."
+    ::= { ipCidrRouteEntry 16 }
+
+-- conformance information
+
+ipForwardConformance OBJECT IDENTIFIER ::= { ipForward 5 }
+
+ipForwardGroups      OBJECT IDENTIFIER ::= { ipForwardConformance 1 }
+ipForwardCompliances OBJECT IDENTIFIER ::= { ipForwardConformance 2 }
+
+-- compliance statements
+
+ipForwardCompliance MODULE-COMPLIANCE
+   STATUS  current
+   DESCRIPTION
+       "The compliance statement for SNMPv2 entities
+       which implement the ipForward MIB."
+
+   MODULE  -- this module
+   MANDATORY-GROUPS { ipForwardCidrRouteGroup }
+   ::= { ipForwardCompliances 1 }
+
+-- units of conformance
+
+ipForwardCidrRouteGroup OBJECT-GROUP
+    OBJECTS { ipCidrRouteNumber,
+              ipCidrRouteDest, ipCidrRouteMask, ipCidrRouteTos,
+              ipCidrRouteNextHop, ipCidrRouteIfIndex, ipCidrRouteType,
+              ipCidrRouteProto, ipCidrRouteAge, ipCidrRouteInfo,
+              ipCidrRouteNextHopAS, ipCidrRouteMetric1,
+              ipCidrRouteMetric2, ipCidrRouteMetric3,
+              ipCidrRouteMetric4, ipCidrRouteMetric5, ipCidrRouteStatus
+        }
+    STATUS  current
+    DESCRIPTION
+       "The CIDR Route Table."
+    ::= { ipForwardGroups 3 }
+
+-- Obsoleted Definitions - Objects
+
+ipForwardNumber OBJECT-TYPE
+    SYNTAX   Gauge32
+    MAX-ACCESS read-only
+    STATUS   obsolete
+    DESCRIPTION
+       "The number of current  ipForwardTable  entries
+       that are not invalid."
+    ::= { ipForward 1 }
+
+--  IP Forwarding Table
+
+--  The IP Forwarding Table obsoletes and replaces the ipRoute
+--  Table current in MIB-I and MIB-II.  It adds knowledge of
+--  the autonomous system of the next hop, multiple next hop
+
+--  support, and policy routing support.
+
+ipForwardTable OBJECT-TYPE
+    SYNTAX   SEQUENCE OF IpForwardEntry
+    MAX-ACCESS not-accessible
+    STATUS   obsolete
+    DESCRIPTION
+       "This entity's IP Routing table."
+    REFERENCE
+       "RFC 1213 Section 6.6, The IP Group"
+    ::= { ipForward 2 }
+
+ipForwardEntry OBJECT-TYPE
+    SYNTAX   IpForwardEntry
+    MAX-ACCESS not-accessible
+    STATUS   obsolete
+    DESCRIPTION
+       "A particular route to  a  particular  destina-
+       tion, under a particular policy."
+    INDEX {
+        ipForwardDest,
+        ipForwardProto,
+        ipForwardPolicy,
+        ipForwardNextHop
+        }
+    ::= { ipForwardTable 1 }
+
+IpForwardEntry ::=
+    SEQUENCE {
+        ipForwardDest
+            IpAddress,
+        ipForwardMask
+            IpAddress,
+        ipForwardPolicy
+             Integer32,
+        ipForwardNextHop
+            IpAddress,
+        ipForwardIfIndex
+            Integer32,
+        ipForwardType
+            INTEGER,
+        ipForwardProto
+            INTEGER,
+        ipForwardAge
+            Integer32,
+        ipForwardInfo
+            OBJECT IDENTIFIER,
+        ipForwardNextHopAS
+
+            Integer32,
+        ipForwardMetric1
+            Integer32,
+        ipForwardMetric2
+            Integer32,
+        ipForwardMetric3
+            Integer32,
+        ipForwardMetric4
+            Integer32,
+        ipForwardMetric5
+            Integer32
+    }
+
+ipForwardDest OBJECT-TYPE
+    SYNTAX   IpAddress
+    MAX-ACCESS read-only
+    STATUS   obsolete
+    DESCRIPTION
+       "The destination IP address of this route.   An
+       entry  with  a value of 0.0.0.0 is considered a
+       default route.
+
+       This object may not take a Multicast (Class  D)
+       address value.
+
+       Any assignment (implicit or  otherwise)  of  an
+       instance  of  this  object to a value x must be
+       rejected if the bitwise logical-AND of  x  with
+       the  value of the corresponding instance of the
+       ipForwardMask object is not equal to x."
+    ::= { ipForwardEntry 1 }
+
+ipForwardMask OBJECT-TYPE
+    SYNTAX   IpAddress
+    MAX-ACCESS read-create
+    STATUS   obsolete
+    DESCRIPTION
+       "Indicate the mask to be logical-ANDed with the
+       destination  address  before  being compared to
+       the value  in  the  ipForwardDest  field.   For
+       those  systems  that  do  not support arbitrary
+       subnet masks, an agent constructs the value  of
+       the  ipForwardMask  by  reference to the IP Ad-
+       dress Class.
+
+       Any assignment (implicit or  otherwise)  of  an
+       instance  of  this  object to a value x must be
+       rejected if the bitwise logical-AND of  x  with
+
+       the  value of the corresponding instance of the
+       ipForwardDest object is not equal to ipForward-
+       Dest."
+    DEFVAL { '00000000'h }      -- 0.0.0.0
+    ::= { ipForwardEntry 2 }
+
+-- The following convention is included for specification
+-- of TOS Field contents.  At this time, the Host Requirements
+-- and the Router Requirements documents disagree on the width
+-- of the TOS field.  This mapping describes the Router
+-- Requirements mapping, and leaves room to widen the TOS field
+-- without impact to fielded systems.
+
+ipForwardPolicy OBJECT-TYPE
+    SYNTAX   Integer32
+    MAX-ACCESS read-only
+    STATUS   obsolete
+    DESCRIPTION
+       "The general set of conditions that would cause
+       the  selection  of  one multipath route (set of
+       next hops for a given destination) is  referred
+       to as 'policy'.
+
+       Unless the mechanism indicated by ipForwardPro-
+       to specifies otherwise, the policy specifier is
+       the IP TOS Field.  The encoding of IP TOS is as
+        specified  by  the  following convention.  Zero
+       indicates the default path if no more  specific
+       policy applies.
+
+       +-----+-----+-----+-----+-----+-----+-----+-----+
+       |                 |                       |     |
+       |   PRECEDENCE    |    TYPE OF SERVICE    |  0  |
+       |                 |                       |     |
+       +-----+-----+-----+-----+-----+-----+-----+-----+
+
+                IP TOS                IP TOS
+           Field     Policy      Field     Policy
+           Contents    Code      Contents    Code
+           0 0 0 0  ==>   0      0 0 0 1  ==>   2
+           0 0 1 0  ==>   4      0 0 1 1  ==>   6
+           0 1 0 0  ==>   8      0 1 0 1  ==>  10
+           0 1 1 0  ==>  12      0 1 1 1  ==>  14
+           1 0 0 0  ==>  16      1 0 0 1  ==>  18
+           1 0 1 0  ==>  20      1 0 1 1  ==>  22
+           1 1 0 0  ==>  24      1 1 0 1  ==>  26
+           1 1 1 0  ==>  28      1 1 1 1  ==>  30
+
+       Protocols defining 'policy' otherwise must  ei-
+       ther define a set of values which are valid for
+       this  object  or  must  implement  an  integer-
+       instanced  policy table for which this object's
+       value acts as an index."
+    ::= { ipForwardEntry 3 }
+
+ipForwardNextHop OBJECT-TYPE
+    SYNTAX   IpAddress
+    MAX-ACCESS read-only
+    STATUS   obsolete
+    DESCRIPTION
+       "On remote routes, the address of the next sys-
+       tem en route; Otherwise, 0.0.0.0."
+    ::= { ipForwardEntry 4 }
+
+ipForwardIfIndex OBJECT-TYPE
+    SYNTAX   Integer32
+    MAX-ACCESS read-create
+    STATUS   obsolete
+    DESCRIPTION
+       "The ifIndex value which identifies  the  local
+       interface  through  which  the next hop of this
+       route should be reached."
+    DEFVAL { 0 }
+    ::= { ipForwardEntry 5 }
+
+ipForwardType OBJECT-TYPE
+    SYNTAX   INTEGER {
+                other    (1), -- not specified by this MIB
+                invalid  (2), -- logically deleted
+                local    (3), -- local interface
+                remote   (4)  -- remote destination
+             }
+    MAX-ACCESS read-create
+    STATUS   obsolete
+    DESCRIPTION
+       "The type of route.  Note that local(3)  refers
+       to  a route for which the next hop is the final
+       destination; remote(4) refers to  a  route  for
+       which  the  next  hop is not the final destina-
+       tion.
+
+       Setting this object to the value invalid(2) has
+       the  effect  of  invalidating the corresponding
+       entry in the ipForwardTable object.   That  is,
+       it  effectively  disassociates  the destination
+       identified with said entry from the route iden-
+
+       tified    with    said   entry.    It   is   an
+       implementation-specific matter  as  to  whether
+       the agent removes an invalidated entry from the
+       table.  Accordingly, management  stations  must
+       be prepared to receive tabular information from
+       agents that corresponds to entries not current-
+       ly  in  use.  Proper interpretation of such en-
+       tries requires examination of the relevant  ip-
+       ForwardType object."
+    DEFVAL { invalid }
+    ::= { ipForwardEntry 6 }
+
+ipForwardProto OBJECT-TYPE
+    SYNTAX   INTEGER {
+                other     (1),  -- not specified
+                local     (2),  -- local interface
+                netmgmt   (3),  -- static route
+                icmp      (4),  -- result of ICMP Redirect
+
+                        -- the following are all dynamic
+                        -- routing protocols
+                egp       (5),  -- Exterior Gateway Protocol
+                ggp       (6),  -- Gateway-Gateway Protocol
+                hello     (7),  -- FuzzBall HelloSpeak
+                rip       (8),  -- Berkeley RIP or RIP-II
+                is-is     (9),  -- Dual IS-IS
+                es-is     (10), -- ISO 9542
+                ciscoIgrp (11), -- Cisco IGRP
+                bbnSpfIgp (12), -- BBN SPF IGP
+                ospf      (13), -- Open Shortest Path First
+                bgp       (14), -- Border Gateway Protocol
+                idpr      (15)  -- InterDomain Policy Routing
+             }
+    MAX-ACCESS read-only
+    STATUS   obsolete
+    DESCRIPTION
+       "The routing mechanism via which this route was
+       learned.  Inclusion of values for gateway rout-
+       ing protocols is not  intended  to  imply  that
+       hosts should support those protocols."
+    ::= { ipForwardEntry 7 }
+
+ipForwardAge OBJECT-TYPE
+    SYNTAX   Integer32
+    MAX-ACCESS read-only
+    STATUS   obsolete
+    DESCRIPTION
+       "The number of seconds  since  this  route  was
+
+       last  updated  or  otherwise  determined  to be
+       correct.  Note that no semantics of  `too  old'
+       can  be implied except through knowledge of the
+       routing  protocol  by  which  the   route   was
+       learned."
+    DEFVAL  { 0 }
+    ::= { ipForwardEntry 8 }
+
+ipForwardInfo OBJECT-TYPE
+    SYNTAX   OBJECT IDENTIFIER
+    MAX-ACCESS read-create
+    STATUS   obsolete
+    DESCRIPTION
+       "A reference to MIB definitions specific to the
+       particular  routing protocol which is responsi-
+       ble for this route, as determined by the  value
+       specified  in the route's ipForwardProto value.
+       If this information is not present,  its  value
+       should be set to the OBJECT IDENTIFIER { 0 0 },
+       which is a syntactically valid object  identif-
+       ier, and any implementation conforming to ASN.1
+       and the Basic Encoding Rules must  be  able  to
+       generate and recognize this value."
+    ::= { ipForwardEntry 9 }
+
+ipForwardNextHopAS OBJECT-TYPE
+    SYNTAX   Integer32
+    MAX-ACCESS read-create
+    STATUS   obsolete
+    DESCRIPTION
+       "The Autonomous System Number of the Next  Hop.
+       When  this  is  unknown  or not relevant to the
+       protocol indicated by ipForwardProto, zero."
+    DEFVAL { 0 }
+    ::= { ipForwardEntry 10 }
+
+ipForwardMetric1 OBJECT-TYPE
+    SYNTAX   Integer32
+    MAX-ACCESS read-create
+    STATUS   obsolete
+    DESCRIPTION
+       "The primary routing  metric  for  this  route.
+       The  semantics of this metric are determined by
+       the routing-protocol specified in  the  route's
+       ipForwardProto  value.   If  this metric is not
+       used, its value should be set to -1."
+    DEFVAL { -1 }
+    ::= { ipForwardEntry 11 }
+
+ipForwardMetric2 OBJECT-TYPE
+    SYNTAX   Integer32
+    MAX-ACCESS read-create
+    STATUS   obsolete
+    DESCRIPTION
+       "An alternate routing metric  for  this  route.
+       The  semantics of this metric are determined by
+       the routing-protocol specified in  the  route's
+       ipForwardProto  value.   If  this metric is not
+       used, its value should be set to -1."
+    DEFVAL { -1 }
+    ::= { ipForwardEntry 12 }
+
+ipForwardMetric3 OBJECT-TYPE
+    SYNTAX   Integer32
+    MAX-ACCESS read-create
+    STATUS   obsolete
+    DESCRIPTION
+       "An alternate routing metric  for  this  route.
+       The  semantics of this metric are determined by
+       the routing-protocol specified in  the  route's
+       ipForwardProto  value.   If  this metric is not
+       used, its value should be set to -1."
+    DEFVAL { -1 }
+    ::= { ipForwardEntry 13 }
+
+ipForwardMetric4 OBJECT-TYPE
+    SYNTAX   Integer32
+    MAX-ACCESS read-create
+    STATUS   obsolete
+    DESCRIPTION
+       "An alternate routing metric  for  this  route.
+       The  semantics of this metric are determined by
+       the routing-protocol specified in  the  route's
+       ipForwardProto  value.   If  this metric is not
+       used, its value should be set to -1."
+    DEFVAL { -1 }
+    ::= { ipForwardEntry 14 }
+
+ipForwardMetric5 OBJECT-TYPE
+    SYNTAX   Integer32
+    MAX-ACCESS read-create
+    STATUS   obsolete
+    DESCRIPTION
+       "An alternate routing metric  for  this  route.
+       The  semantics of this metric are determined by
+       the routing-protocol specified in  the  route's
+
+       ipForwardProto  value.   If  this metric is not
+       used, its value should be set to -1."
+    DEFVAL { -1 }
+    ::= { ipForwardEntry 15 }
+
+-- Obsoleted Definitions - Groups
+-- compliance statements
+
+ipForwardOldCompliance MODULE-COMPLIANCE
+   STATUS  obsolete
+   DESCRIPTION
+       "The compliance statement for SNMP entities
+       which implement the ipForward MIB."
+
+   MODULE  -- this module
+   MANDATORY-GROUPS { ipForwardMultiPathGroup }
+   ::= { ipForwardCompliances 2 }
+
+ipForwardMultiPathGroup OBJECT-GROUP
+    OBJECTS { ipForwardNumber,
+              ipForwardDest, ipForwardMask, ipForwardPolicy,
+              ipForwardNextHop, ipForwardIfIndex, ipForwardType,
+              ipForwardProto, ipForwardAge, ipForwardInfo,
+              ipForwardNextHopAS,
+              ipForwardMetric1, ipForwardMetric2, ipForwardMetric3,
+              ipForwardMetric4, ipForwardMetric5
+        }
+    STATUS  obsolete
+    DESCRIPTION
+       "IP Multipath Route Table."
+    ::= { ipForwardGroups 2 }
+
+END
diff -Naur tomato/release/src/router/snmp/mibs/IP-MIB.txt tomato121/release/src/router/snmp/mibs/IP-MIB.txt
--- tomato/release/src/router/snmp/mibs/IP-MIB.txt	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/mibs/IP-MIB.txt	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,720 @@
+IP-MIB DEFINITIONS ::= BEGIN
+
+IMPORTS
+    MODULE-IDENTITY, OBJECT-TYPE, Integer32,
+    Counter32, IpAddress, mib-2        FROM SNMPv2-SMI
+    PhysAddress                        FROM SNMPv2-TC
+    MODULE-COMPLIANCE, OBJECT-GROUP    FROM SNMPv2-CONF;
+
+ipMIB MODULE-IDENTITY
+    LAST-UPDATED "9411010000Z"
+    ORGANIZATION "IETF SNMPv2 Working Group"
+    CONTACT-INFO
+            "        Keith McCloghrie
+
+             Postal: Cisco Systems, Inc.
+                     170 West Tasman Drive
+                     San Jose, CA  95134-1706
+                     US
+
+             Phone:  +1 408 526 5260
+             Email:  kzm@cisco.com"
+    DESCRIPTION
+            "The MIB module for managing IP and ICMP implementations,
+            but excluding their management of IP routes."
+    REVISION      "9103310000Z"
+    DESCRIPTION
+            "The initial revision of this MIB module was part of MIB-
+            II."
+    ::= { mib-2 48}
+
+-- the IP group
+
+ip       OBJECT IDENTIFIER ::= { mib-2 4 }
+
+ipForwarding OBJECT-TYPE
+    SYNTAX      INTEGER {
+                    forwarding(1),    -- acting as a router
+                    notForwarding(2)  -- NOT acting as a router
+                }
+    MAX-ACCESS  read-write
+    STATUS      current
+    DESCRIPTION
+            "The indication of whether this entity is acting as an IP
+            router in respect to the forwarding of datagrams received
+            by, but not addressed to, this entity.  IP routers forward
+            datagrams.  IP hosts do not (except those source-routed via
+            the host)."
+    ::= { ip 1 }
+
+ipDefaultTTL OBJECT-TYPE
+    SYNTAX      INTEGER (1..255)
+    MAX-ACCESS  read-write
+    STATUS      current
+    DESCRIPTION
+            "The default value inserted into the Time-To-Live field of
+            the IP header of datagrams originated at this entity,
+            whenever a TTL value is not supplied by the transport layer
+            protocol."
+    ::= { ip 2 }
+
+ipInReceives OBJECT-TYPE
+    SYNTAX      Counter32
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+            "The total number of input datagrams received from
+            interfaces, including those received in error."
+    ::= { ip 3 }
+
+ipInHdrErrors OBJECT-TYPE
+    SYNTAX      Counter32
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+            "The number of input datagrams discarded due to errors in
+            their IP headers, including bad checksums, version number
+            mismatch, other format errors, time-to-live exceeded, errors
+            discovered in processing their IP options, etc."
+    ::= { ip 4 }
+
+ipInAddrErrors OBJECT-TYPE
+    SYNTAX      Counter32
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+            "The number of input datagrams discarded because the IP
+            address in their IP header's destination field was not a
+            valid address to be received at this entity.  This count
+            includes invalid addresses (e.g., 0.0.0.0) and addresses of
+            unsupported Classes (e.g., Class E).  For entities which are
+            not IP routers and therefore do not forward datagrams, this
+            counter includes datagrams discarded because the destination
+            address was not a local address."
+    ::= { ip 5 }
+
+ipForwDatagrams OBJECT-TYPE
+    SYNTAX      Counter32
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+            "The number of input datagrams for which this entity was not
+            their final IP destination, as a result of which an attempt
+            was made to find a route to forward them to that final
+            destination.  In entities which do not act as IP routers,
+            this counter will include only those packets which were
+            Source-Routed via this entity, and the Source-Route option
+            processing was successful."
+    ::= { ip 6 }
+
+ipInUnknownProtos OBJECT-TYPE
+    SYNTAX      Counter32
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+            "The number of locally-addressed datagrams received
+            successfully but discarded because of an unknown or
+            unsupported protocol."
+    ::= { ip 7 }
+
+ipInDiscards OBJECT-TYPE
+    SYNTAX      Counter32
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+            "The number of input IP datagrams for which no problems were
+            encountered to prevent their continued processing, but which
+            were discarded (e.g., for lack of buffer space).  Note that
+            this counter does not include any datagrams discarded while
+            awaiting re-assembly."
+    ::= { ip 8 }
+
+ipInDelivers OBJECT-TYPE
+    SYNTAX      Counter32
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+            "The total number of input datagrams successfully delivered
+            to IP user-protocols (including ICMP)."
+    ::= { ip 9 }
+
+ipOutRequests OBJECT-TYPE
+    SYNTAX      Counter32
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+            "The total number of IP datagrams which local IP user-
+            protocols (including ICMP) supplied to IP in requests for
+            transmission.  Note that this counter does not include any
+            datagrams counted in ipForwDatagrams."
+    ::= { ip 10 }
+
+ipOutDiscards OBJECT-TYPE
+    SYNTAX      Counter32
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+            "The number of output IP datagrams for which no problem was
+            encountered to prevent their transmission to their
+            destination, but which were discarded (e.g., for lack of
+            buffer space).  Note that this counter would include
+            datagrams counted in ipForwDatagrams if any such packets met
+            this (discretionary) discard criterion."
+    ::= { ip 11 }
+
+ipOutNoRoutes OBJECT-TYPE
+    SYNTAX      Counter32
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+            "The number of IP datagrams discarded because no route could
+            be found to transmit them to their destination.  Note that
+            this counter includes any packets counted in ipForwDatagrams
+            which meet this `no-route' criterion.  Note that this
+            includes any datagrams which a host cannot route because all
+            of its default routers are down."
+    ::= { ip 12 }
+
+ipReasmTimeout OBJECT-TYPE
+    SYNTAX      Integer32
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+            "The maximum number of seconds which received fragments are
+            held while they are awaiting reassembly at this entity."
+    ::= { ip 13 }
+
+ipReasmReqds OBJECT-TYPE
+    SYNTAX      Counter32
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+            "The number of IP fragments received which needed to be
+            reassembled at this entity."
+    ::= { ip 14 }
+
+ipReasmOKs OBJECT-TYPE
+    SYNTAX      Counter32
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+            "The number of IP datagrams successfully re-assembled."
+    ::= { ip 15 }
+
+ipReasmFails OBJECT-TYPE
+    SYNTAX      Counter32
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+            "The number of failures detected by the IP re-assembly
+            algorithm (for whatever reason: timed out, errors, etc).
+            Note that this is not necessarily a count of discarded IP
+            fragments since some algorithms (notably the algorithm in
+            RFC 815) can lose track of the number of fragments by
+
+            combining them as they are received."
+    ::= { ip 16 }
+
+ipFragOKs OBJECT-TYPE
+    SYNTAX      Counter32
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+            "The number of IP datagrams that have been successfully
+            fragmented at this entity."
+    ::= { ip 17 }
+
+ipFragFails OBJECT-TYPE
+    SYNTAX      Counter32
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+            "The number of IP datagrams that have been discarded because
+            they needed to be fragmented at this entity but could not
+            be, e.g., because their Don't Fragment flag was set."
+    ::= { ip 18 }
+
+ipFragCreates OBJECT-TYPE
+    SYNTAX      Counter32
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+            "The number of IP datagram fragments that have been
+            generated as a result of fragmentation at this entity."
+    ::= { ip 19 }
+
+-- the IP address table
+
+ipAddrTable OBJECT-TYPE
+    SYNTAX      SEQUENCE OF IpAddrEntry
+    MAX-ACCESS  not-accessible
+    STATUS      current
+    DESCRIPTION
+            "The table of addressing information relevant to this
+            entity's IP addresses."
+    ::= { ip 20 }
+
+ipAddrEntry OBJECT-TYPE
+    SYNTAX      IpAddrEntry
+    MAX-ACCESS  not-accessible
+    STATUS      current
+    DESCRIPTION
+            "The addressing information for one of this entity's IP
+
+            addresses."
+    INDEX      { ipAdEntAddr }
+    ::= { ipAddrTable 1 }
+
+IpAddrEntry ::= SEQUENCE {
+        ipAdEntAddr          IpAddress,
+        ipAdEntIfIndex       INTEGER,
+        ipAdEntNetMask       IpAddress,
+        ipAdEntBcastAddr     INTEGER,
+        ipAdEntReasmMaxSize  INTEGER
+    }
+
+ipAdEntAddr OBJECT-TYPE
+    SYNTAX      IpAddress
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+            "The IP address to which this entry's addressing information
+            pertains."
+    ::= { ipAddrEntry 1 }
+
+ipAdEntIfIndex OBJECT-TYPE
+    SYNTAX      INTEGER (1..2147483647)
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+            "The index value which uniquely identifies the interface to
+            which this entry is applicable.  The interface identified by
+            a particular value of this index is the same interface as
+            identified by the same value of RFC 1573's ifIndex."
+    ::= { ipAddrEntry 2 }
+
+ipAdEntNetMask OBJECT-TYPE
+    SYNTAX      IpAddress
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+            "The subnet mask associated with the IP address of this
+            entry.  The value of the mask is an IP address with all the
+            network bits set to 1 and all the hosts bits set to 0."
+    ::= { ipAddrEntry 3 }
+
+ipAdEntBcastAddr OBJECT-TYPE
+    SYNTAX      INTEGER (0..1)
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+            "The value of the least-significant bit in the IP broadcast
+
+            address used for sending datagrams on the (logical)
+            interface associated with the IP address of this entry.  For
+            example, when the Internet standard all-ones broadcast
+            address is used, the value will be 1.  This value applies to
+            both the subnet and network broadcasts addresses used by the
+            entity on this (logical) interface."
+    ::= { ipAddrEntry 4 }
+
+ipAdEntReasmMaxSize OBJECT-TYPE
+    SYNTAX      INTEGER (0..65535)
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+            "The size of the largest IP datagram which this entity can
+            re-assemble from incoming IP fragmented datagrams received
+            on this interface."
+    ::= { ipAddrEntry 5 }
+
+-- ipRouteTable  ::=   { ip 21 }        obsolete
+
+-- the IP Address Translation table
+
+-- The Address Translation tables contain the IpAddress to
+-- "physical" address equivalences.  Some interfaces do not
+-- use translation tables for determining address
+-- equivalences (e.g., DDN-X.25 has an algorithmic method);
+-- if all interfaces are of this type, then the Address
+-- Translation table is empty, i.e., has zero entries.
+
+ipNetToMediaTable OBJECT-TYPE
+    SYNTAX      SEQUENCE OF IpNetToMediaEntry
+    MAX-ACCESS  not-accessible
+    STATUS      current
+    DESCRIPTION
+            "The IP Address Translation table used for mapping from IP
+            addresses to physical addresses."
+    ::= { ip 22 }
+
+ipNetToMediaEntry OBJECT-TYPE
+    SYNTAX      IpNetToMediaEntry
+    MAX-ACCESS  not-accessible
+    STATUS      current
+    DESCRIPTION
+            "Each entry contains one IpAddress to `physical' address
+            equivalence."
+    INDEX       { ipNetToMediaIfIndex,
+                  ipNetToMediaNetAddress }
+    ::= { ipNetToMediaTable 1 }
+
+IpNetToMediaEntry ::= SEQUENCE {
+        ipNetToMediaIfIndex      INTEGER,
+        ipNetToMediaPhysAddress  PhysAddress,
+        ipNetToMediaNetAddress   IpAddress,
+        ipNetToMediaType         INTEGER
+    }
+
+ipNetToMediaIfIndex OBJECT-TYPE
+    SYNTAX      INTEGER (1..2147483647)
+    MAX-ACCESS  read-create
+    STATUS      current
+    DESCRIPTION
+            "The interface on which this entry's equivalence is
+            effective.  The interface identified by a particular value
+            of this index is the same interface as identified by the
+            same value of RFC 1573's ifIndex."
+    ::= { ipNetToMediaEntry 1 }
+
+ipNetToMediaPhysAddress OBJECT-TYPE
+    SYNTAX      PhysAddress
+    MAX-ACCESS  read-create
+    STATUS      current
+    DESCRIPTION
+            "The media-dependent `physical' address."
+    ::= { ipNetToMediaEntry 2 }
+
+ipNetToMediaNetAddress OBJECT-TYPE
+    SYNTAX      IpAddress
+    MAX-ACCESS  read-create
+    STATUS      current
+    DESCRIPTION
+            "The IpAddress corresponding to the media-dependent
+            `physical' address."
+    ::= { ipNetToMediaEntry 3 }
+
+ipNetToMediaType OBJECT-TYPE
+    SYNTAX      INTEGER {
+                other(1),        -- none of the following
+                invalid(2),      -- an invalidated mapping
+                dynamic(3),
+                static(4)
+            }
+    MAX-ACCESS  read-create
+    STATUS      current
+    DESCRIPTION
+            "The type of mapping.
+
+            Setting this object to the value invalid(2) has the effect
+            of invalidating the corresponding entry in the
+            ipNetToMediaTable.  That is, it effectively disassociates
+            the interface identified with said entry from the mapping
+            identified with said entry.  It is an implementation-
+            specific matter as to whether the agent removes an
+            invalidated entry from the table.  Accordingly, management
+            stations must be prepared to receive tabular information
+            from agents that corresponds to entries not currently in
+            use.  Proper interpretation of such entries requires
+            examination of the relevant ipNetToMediaType object."
+    ::= { ipNetToMediaEntry 4 }
+
+ipRoutingDiscards OBJECT-TYPE
+    SYNTAX      Counter32
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+            "The number of routing entries which were chosen to be
+            discarded even though they are valid.  One possible reason
+            for discarding such an entry could be to free-up buffer
+            space for other routing entries."
+    ::= { ip 23 }
+
+-- the ICMP group
+
+icmp     OBJECT IDENTIFIER ::= { mib-2 5 }
+
+icmpInMsgs OBJECT-TYPE
+    SYNTAX      Counter32
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+            "The total number of ICMP messages which the entity
+            received.  Note that this counter includes all those counted
+            by icmpInErrors."
+    ::= { icmp 1 }
+
+icmpInErrors OBJECT-TYPE
+    SYNTAX      Counter32
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+            "The number of ICMP messages which the entity received but
+            determined as having ICMP-specific errors (bad ICMP
+            checksums, bad length, etc.)."
+    ::= { icmp 2 }
+
+icmpInDestUnreachs OBJECT-TYPE
+    SYNTAX      Counter32
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+            "The number of ICMP Destination Unreachable messages
+            received."
+    ::= { icmp 3 }
+
+icmpInTimeExcds OBJECT-TYPE
+    SYNTAX      Counter32
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+            "The number of ICMP Time Exceeded messages received."
+    ::= { icmp 4 }
+
+icmpInParmProbs OBJECT-TYPE
+    SYNTAX      Counter32
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+            "The number of ICMP Parameter Problem messages received."
+    ::= { icmp 5 }
+
+icmpInSrcQuenchs OBJECT-TYPE
+    SYNTAX      Counter32
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+            "The number of ICMP Source Quench messages received."
+    ::= { icmp 6 }
+
+icmpInRedirects OBJECT-TYPE
+    SYNTAX      Counter32
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+            "The number of ICMP Redirect messages received."
+    ::= { icmp 7 }
+
+icmpInEchos OBJECT-TYPE
+    SYNTAX      Counter32
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+            "The number of ICMP Echo (request) messages received."
+    ::= { icmp 8 }
+
+icmpInEchoReps OBJECT-TYPE
+    SYNTAX      Counter32
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+            "The number of ICMP Echo Reply messages received."
+    ::= { icmp 9 }
+
+icmpInTimestamps OBJECT-TYPE
+    SYNTAX      Counter32
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+            "The number of ICMP Timestamp (request) messages received."
+    ::= { icmp 10 }
+
+icmpInTimestampReps OBJECT-TYPE
+    SYNTAX      Counter32
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+            "The number of ICMP Timestamp Reply messages received."
+    ::= { icmp 11 }
+
+icmpInAddrMasks OBJECT-TYPE
+    SYNTAX      Counter32
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+            "The number of ICMP Address Mask Request messages received."
+    ::= { icmp 12 }
+
+icmpInAddrMaskReps OBJECT-TYPE
+    SYNTAX      Counter32
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+            "The number of ICMP Address Mask Reply messages received."
+    ::= { icmp 13 }
+
+icmpOutMsgs OBJECT-TYPE
+    SYNTAX      Counter32
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+            "The total number of ICMP messages which this entity
+            attempted to send.  Note that this counter includes all
+            those counted by icmpOutErrors."
+    ::= { icmp 14 }
+
+icmpOutErrors OBJECT-TYPE
+    SYNTAX      Counter32
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+            "The number of ICMP messages which this entity did not send
+            due to problems discovered within ICMP such as a lack of
+            buffers.  This value should not include errors discovered
+            outside the ICMP layer such as the inability of IP to route
+            the resultant datagram.  In some implementations there may
+            be no types of error which contribute to this counter's
+            value."
+    ::= { icmp 15 }
+
+icmpOutDestUnreachs OBJECT-TYPE
+    SYNTAX      Counter32
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+            "The number of ICMP Destination Unreachable messages sent."
+    ::= { icmp 16 }
+
+icmpOutTimeExcds OBJECT-TYPE
+    SYNTAX      Counter32
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+            "The number of ICMP Time Exceeded messages sent."
+    ::= { icmp 17 }
+
+icmpOutParmProbs OBJECT-TYPE
+    SYNTAX      Counter32
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+            "The number of ICMP Parameter Problem messages sent."
+    ::= { icmp 18 }
+
+icmpOutSrcQuenchs OBJECT-TYPE
+    SYNTAX      Counter32
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+            "The number of ICMP Source Quench messages sent."
+    ::= { icmp 19 }
+
+icmpOutRedirects OBJECT-TYPE
+    SYNTAX      Counter32
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+            "The number of ICMP Redirect messages sent.  For a host,
+            this object will always be zero, since hosts do not send
+            redirects."
+    ::= { icmp 20 }
+
+icmpOutEchos OBJECT-TYPE
+    SYNTAX      Counter32
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+            "The number of ICMP Echo (request) messages sent."
+    ::= { icmp 21 }
+
+icmpOutEchoReps OBJECT-TYPE
+    SYNTAX      Counter32
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+            "The number of ICMP Echo Reply messages sent."
+    ::= { icmp 22 }
+
+icmpOutTimestamps OBJECT-TYPE
+    SYNTAX      Counter32
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+            "The number of ICMP Timestamp (request) messages sent."
+    ::= { icmp 23 }
+
+icmpOutTimestampReps OBJECT-TYPE
+    SYNTAX      Counter32
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+            "The number of ICMP Timestamp Reply messages sent."
+    ::= { icmp 24 }
+
+icmpOutAddrMasks OBJECT-TYPE
+    SYNTAX      Counter32
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+            "The number of ICMP Address Mask Request messages sent."
+    ::= { icmp 25 }
+
+icmpOutAddrMaskReps OBJECT-TYPE
+    SYNTAX      Counter32
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+            "The number of ICMP Address Mask Reply messages sent."
+    ::= { icmp 26 }
+
+-- conformance information
+
+ipMIBConformance OBJECT IDENTIFIER ::= { ipMIB 2 }
+
+ipMIBCompliances OBJECT IDENTIFIER ::= { ipMIBConformance 1 }
+ipMIBGroups      OBJECT IDENTIFIER ::= { ipMIBConformance 2 }
+
+-- compliance statements
+
+ipMIBCompliance MODULE-COMPLIANCE
+    STATUS  current
+    DESCRIPTION
+            "The compliance statement for SNMPv2 entities which
+            implement IP."
+    MODULE  -- this module
+        MANDATORY-GROUPS { ipGroup,
+                           icmpGroup }
+    ::= { ipMIBCompliances 1 }
+
+-- units of conformance
+
+ipGroup OBJECT-GROUP
+    OBJECTS   { ipForwarding, ipDefaultTTL, ipInReceives,
+                ipInHdrErrors, ipInAddrErrors,
+                ipForwDatagrams, ipInUnknownProtos,
+                ipInDiscards, ipInDelivers, ipOutRequests,
+                ipOutDiscards, ipOutNoRoutes,
+                ipReasmTimeout, ipReasmReqds, ipReasmOKs,
+                ipReasmFails, ipFragOKs,
+                ipFragFails, ipFragCreates,
+                ipAdEntAddr, ipAdEntIfIndex, ipAdEntNetMask,
+                ipAdEntBcastAddr, ipAdEntReasmMaxSize,
+                ipNetToMediaIfIndex, ipNetToMediaPhysAddress,
+                ipNetToMediaNetAddress, ipNetToMediaType,
+                ipRoutingDiscards }
+    STATUS    current
+    DESCRIPTION
+            "The ip group of objects providing for basic management of
+            IP entities, exclusive of the management of IP routes."
+    ::= { ipMIBGroups 1 }
+
+icmpGroup OBJECT-GROUP
+    OBJECTS   { icmpInMsgs, icmpInErrors,
+                icmpInDestUnreachs, icmpInTimeExcds,
+                icmpInParmProbs, icmpInSrcQuenchs,
+                icmpInRedirects, icmpInEchos,
+                icmpInEchoReps, icmpInTimestamps,
+                icmpInTimestampReps, icmpInAddrMasks,
+                icmpInAddrMaskReps, icmpOutMsgs,
+                icmpOutErrors, icmpOutDestUnreachs,
+                icmpOutTimeExcds, icmpOutParmProbs,
+                icmpOutSrcQuenchs, icmpOutRedirects,
+                icmpOutEchos, icmpOutEchoReps,
+                icmpOutTimestamps, icmpOutTimestampReps,
+                icmpOutAddrMasks, icmpOutAddrMaskReps }
+    STATUS    current
+    DESCRIPTION
+            "The icmp group of objects providing ICMP statistics."
+    ::= { ipMIBGroups 2 }
+
+END
diff -Naur tomato/release/src/router/snmp/mibs/IPV6-ICMP-MIB.txt tomato121/release/src/router/snmp/mibs/IPV6-ICMP-MIB.txt
--- tomato/release/src/router/snmp/mibs/IPV6-ICMP-MIB.txt	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/mibs/IPV6-ICMP-MIB.txt	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,529 @@
+ IPV6-ICMP-MIB DEFINITIONS ::= BEGIN
+
+ IMPORTS
+     MODULE-IDENTITY, OBJECT-TYPE,
+     Counter32, mib-2                 FROM SNMPv2-SMI
+     MODULE-COMPLIANCE, OBJECT-GROUP  FROM SNMPv2-CONF
+     ipv6IfEntry                      FROM IPV6-MIB;
+
+ ipv6IcmpMIB MODULE-IDENTITY
+     LAST-UPDATED "9801082155Z"
+     ORGANIZATION "IETF IPv6 Working Group"
+     CONTACT-INFO
+       "           Dimitry Haskin
+
+           Postal: Bay Networks, Inc.
+                   660 Techology Park Drive.
+                   Billerica, MA  01821
+                   US
+
+              Tel: +1-978-916-8124
+           E-mail: dhaskin@baynetworks.com
+
+                   Steve Onishi
+
+           Postal: Bay Networks, Inc.
+                   3 Federal Street
+                   Billerica, MA 01821
+                   US
+
+              Tel: +1-978-916-3816
+           E-mail: sonishi@baynetworks.com"
+     DESCRIPTION
+       "The MIB module for entities implementing
+        the ICMPv6."
+     ::= { mib-2 56 }
+
+ -- the ICMPv6 group
+
+ ipv6IcmpMIBObjects OBJECT IDENTIFIER ::= { ipv6IcmpMIB  1 }
+
+ -- Per-interface ICMPv6 statistics table
+
+ ipv6IfIcmpTable OBJECT-TYPE
+     SYNTAX     SEQUENCE OF Ipv6IfIcmpEntry
+     MAX-ACCESS not-accessible
+     STATUS     current
+     DESCRIPTION
+      "IPv6 ICMP statistics. This table contains statistics
+      of ICMPv6 messages that are received and sourced by
+      the entity."
+     ::= { ipv6IcmpMIBObjects 1 }
+
+ ipv6IfIcmpEntry OBJECT-TYPE
+     SYNTAX     Ipv6IfIcmpEntry
+     MAX-ACCESS not-accessible
+     STATUS     current
+     DESCRIPTION
+      "An ICMPv6 statistics entry containing
+      objects at a particular IPv6 interface.
+
+      Note that a receiving interface is
+      the interface to which a given ICMPv6 message
+      is addressed which may not be necessarily
+      the input interface for the message.
+
+      Similarly,  the sending interface is
+      the interface that sources a given
+      ICMP message which is usually but not
+      necessarily the output interface for the message."
+     AUGMENTS { ipv6IfEntry }
+     ::= { ipv6IfIcmpTable 1 }
+
+ Ipv6IfIcmpEntry ::= SEQUENCE {
+         ipv6IfIcmpInMsgs
+               Counter32      ,
+         ipv6IfIcmpInErrors
+               Counter32      ,
+         ipv6IfIcmpInDestUnreachs
+               Counter32      ,
+         ipv6IfIcmpInAdminProhibs
+               Counter32      ,
+         ipv6IfIcmpInTimeExcds
+               Counter32      ,
+         ipv6IfIcmpInParmProblems
+               Counter32      ,
+         ipv6IfIcmpInPktTooBigs
+               Counter32      ,
+         ipv6IfIcmpInEchos
+               Counter32      ,
+         ipv6IfIcmpInEchoReplies
+               Counter32      ,
+         ipv6IfIcmpInRouterSolicits
+               Counter32      ,
+         ipv6IfIcmpInRouterAdvertisements
+               Counter32      ,
+         ipv6IfIcmpInNeighborSolicits
+               Counter32      ,
+         ipv6IfIcmpInNeighborAdvertisements
+               Counter32      ,
+         ipv6IfIcmpInRedirects
+               Counter32      ,
+         ipv6IfIcmpInGroupMembQueries
+               Counter32      ,
+         ipv6IfIcmpInGroupMembResponses
+               Counter32      ,
+         ipv6IfIcmpInGroupMembReductions
+               Counter32      ,
+         ipv6IfIcmpOutMsgs
+               Counter32      ,
+         ipv6IfIcmpOutErrors
+               Counter32      ,
+         ipv6IfIcmpOutDestUnreachs
+               Counter32      ,
+         ipv6IfIcmpOutAdminProhibs
+               Counter32      ,
+         ipv6IfIcmpOutTimeExcds
+               Counter32      ,
+         ipv6IfIcmpOutParmProblems
+               Counter32      ,
+         ipv6IfIcmpOutPktTooBigs
+               Counter32      ,
+         ipv6IfIcmpOutEchos
+               Counter32      ,
+         ipv6IfIcmpOutEchoReplies
+               Counter32      ,
+         ipv6IfIcmpOutRouterSolicits
+               Counter32      ,
+         ipv6IfIcmpOutRouterAdvertisements
+               Counter32      ,
+         ipv6IfIcmpOutNeighborSolicits
+               Counter32      ,
+         ipv6IfIcmpOutNeighborAdvertisements
+               Counter32      ,
+         ipv6IfIcmpOutRedirects
+               Counter32      ,
+         ipv6IfIcmpOutGroupMembQueries
+               Counter32      ,
+         ipv6IfIcmpOutGroupMembResponses
+               Counter32      ,
+         ipv6IfIcmpOutGroupMembReductions
+               Counter32
+
+     }
+
+ ipv6IfIcmpInMsgs OBJECT-TYPE
+     SYNTAX     Counter32
+     MAX-ACCESS read-only
+     STATUS     current
+     DESCRIPTION
+      "The total number of ICMP messages received
+      by the interface which includes all those
+      counted by ipv6IfIcmpInErrors. Note that this
+      interface is the interface to which the
+      ICMP messages were addressed which may not be
+      necessarily the input interface for the messages."
+     ::= { ipv6IfIcmpEntry 1 }
+
+ ipv6IfIcmpInErrors OBJECT-TYPE
+     SYNTAX     Counter32
+     MAX-ACCESS read-only
+     STATUS     current
+     DESCRIPTION
+      "The number of ICMP messages which the interface
+      received but determined as having ICMP-specific
+      errors (bad ICMP checksums, bad length, etc.)."
+     ::= { ipv6IfIcmpEntry 2 }
+
+ ipv6IfIcmpInDestUnreachs OBJECT-TYPE
+     SYNTAX     Counter32
+     MAX-ACCESS read-only
+     STATUS     current
+     DESCRIPTION
+      "The number of ICMP Destination Unreachable
+      messages received by the interface."
+     ::= { ipv6IfIcmpEntry 3 }
+
+ ipv6IfIcmpInAdminProhibs OBJECT-TYPE
+     SYNTAX     Counter32
+     MAX-ACCESS read-only
+     STATUS     current
+     DESCRIPTION
+      "The number of ICMP destination
+      unreachable/communication administratively
+      prohibited messages received by the interface."
+     ::= { ipv6IfIcmpEntry 4 }
+
+ ipv6IfIcmpInTimeExcds OBJECT-TYPE
+     SYNTAX     Counter32
+     MAX-ACCESS read-only
+     STATUS     current
+     DESCRIPTION
+      "The number of ICMP Time Exceeded messages
+       received by the interface."
+     ::= { ipv6IfIcmpEntry 5 }
+
+ ipv6IfIcmpInParmProblems OBJECT-TYPE
+     SYNTAX     Counter32
+     MAX-ACCESS read-only
+     STATUS     current
+     DESCRIPTION
+      "The number of ICMP Parameter Problem messages
+       received by the interface."
+     ::= { ipv6IfIcmpEntry 6 }
+
+ ipv6IfIcmpInPktTooBigs OBJECT-TYPE
+     SYNTAX     Counter32
+     MAX-ACCESS read-only
+     STATUS     current
+     DESCRIPTION
+      "The number of ICMP Packet Too Big messages
+      received by the interface."
+     ::= { ipv6IfIcmpEntry 7 }
+
+ ipv6IfIcmpInEchos OBJECT-TYPE
+     SYNTAX     Counter32
+     MAX-ACCESS read-only
+     STATUS     current
+     DESCRIPTION
+      "The number of ICMP Echo (request) messages
+       received by the interface."
+     ::= { ipv6IfIcmpEntry 8 }
+
+ ipv6IfIcmpInEchoReplies OBJECT-TYPE
+     SYNTAX     Counter32
+     MAX-ACCESS read-only
+     STATUS     current
+     DESCRIPTION
+      "The number of ICMP Echo Reply messages received
+      by the interface."
+     ::= { ipv6IfIcmpEntry 9 }
+
+ ipv6IfIcmpInRouterSolicits OBJECT-TYPE
+     SYNTAX     Counter32
+     MAX-ACCESS read-only
+     STATUS     current
+     DESCRIPTION
+      "The number of ICMP Router Solicit messages
+       received by the interface."
+     ::= { ipv6IfIcmpEntry 10 }
+
+ ipv6IfIcmpInRouterAdvertisements OBJECT-TYPE
+     SYNTAX     Counter32
+     MAX-ACCESS read-only
+     STATUS     current
+     DESCRIPTION
+      "The number of ICMP Router Advertisement messages
+      received by the interface."
+     ::= { ipv6IfIcmpEntry 11 }
+
+ ipv6IfIcmpInNeighborSolicits OBJECT-TYPE
+     SYNTAX     Counter32
+     MAX-ACCESS read-only
+     STATUS     current
+     DESCRIPTION
+      "The number of ICMP Neighbor Solicit messages
+       received by the interface."
+     ::= { ipv6IfIcmpEntry 12 }
+
+ ipv6IfIcmpInNeighborAdvertisements OBJECT-TYPE
+     SYNTAX     Counter32
+     MAX-ACCESS read-only
+     STATUS     current
+     DESCRIPTION
+      "The number of ICMP Neighbor Advertisement
+      messages received by the interface."
+     ::= { ipv6IfIcmpEntry 13 }
+
+ ipv6IfIcmpInRedirects OBJECT-TYPE
+     SYNTAX     Counter32
+     MAX-ACCESS read-only
+     STATUS     current
+     DESCRIPTION
+      "The number of Redirect messages received
+      by the interface."
+     ::= { ipv6IfIcmpEntry 14 }
+
+ ipv6IfIcmpInGroupMembQueries OBJECT-TYPE
+     SYNTAX     Counter32
+     MAX-ACCESS read-only
+     STATUS     current
+     DESCRIPTION
+      "The number of ICMPv6 Group Membership Query
+      messages received by the interface."
+     ::= { ipv6IfIcmpEntry 15}
+
+ ipv6IfIcmpInGroupMembResponses OBJECT-TYPE
+     SYNTAX     Counter32
+     MAX-ACCESS read-only
+     STATUS     current
+     DESCRIPTION
+      "The number of ICMPv6 Group Membership Response messages
+      received by the interface."
+     ::= { ipv6IfIcmpEntry 16}
+
+  ipv6IfIcmpInGroupMembReductions OBJECT-TYPE
+     SYNTAX     Counter32
+     MAX-ACCESS read-only
+     STATUS     current
+     DESCRIPTION
+      "The number of ICMPv6 Group Membership Reduction messages
+      received by the interface."
+     ::= { ipv6IfIcmpEntry 17}
+
+ ipv6IfIcmpOutMsgs OBJECT-TYPE
+     SYNTAX     Counter32
+     MAX-ACCESS read-only
+     STATUS     current
+     DESCRIPTION
+      "The total number of ICMP messages which this
+      interface attempted to send.  Note that this counter
+      includes all those counted by icmpOutErrors."
+     ::= { ipv6IfIcmpEntry 18 }
+
+ ipv6IfIcmpOutErrors OBJECT-TYPE
+     SYNTAX     Counter32
+     MAX-ACCESS read-only
+     STATUS     current
+     DESCRIPTION
+      "The number of ICMP messages which this interface did
+      not send due to problems discovered within ICMP
+      such as a lack of buffers.  This value should not
+      include errors discovered outside the ICMP layer
+      such as the inability of IPv6 to route the resultant
+      datagram.  In some implementations there may be no
+      types of error which contribute to this counter's
+      value."
+     ::= { ipv6IfIcmpEntry 19 }
+
+ ipv6IfIcmpOutDestUnreachs OBJECT-TYPE
+     SYNTAX     Counter32
+     MAX-ACCESS read-only
+     STATUS     current
+     DESCRIPTION
+      "The number of ICMP Destination Unreachable
+
+      messages sent by the interface."
+     ::= { ipv6IfIcmpEntry 20 }
+
+ ipv6IfIcmpOutAdminProhibs OBJECT-TYPE
+     SYNTAX     Counter32
+     MAX-ACCESS read-only
+     STATUS     current
+     DESCRIPTION
+       "Number of ICMP dest unreachable/communication
+       administratively prohibited messages sent."
+     ::= { ipv6IfIcmpEntry 21 }
+
+ ipv6IfIcmpOutTimeExcds OBJECT-TYPE
+     SYNTAX     Counter32
+     MAX-ACCESS read-only
+     STATUS     current
+     DESCRIPTION
+      "The number of ICMP Time Exceeded messages sent
+      by the interface."
+     ::= { ipv6IfIcmpEntry 22 }
+
+ ipv6IfIcmpOutParmProblems OBJECT-TYPE
+     SYNTAX     Counter32
+     MAX-ACCESS read-only
+     STATUS     current
+     DESCRIPTION
+      "The number of ICMP Parameter Problem messages
+      sent by the interface."
+     ::= { ipv6IfIcmpEntry 23 }
+
+ ipv6IfIcmpOutPktTooBigs OBJECT-TYPE
+     SYNTAX     Counter32
+     MAX-ACCESS read-only
+     STATUS     current
+     DESCRIPTION
+      "The number of ICMP Packet Too Big messages sent
+      by the interface."
+     ::= { ipv6IfIcmpEntry 24 }
+
+ ipv6IfIcmpOutEchos OBJECT-TYPE
+     SYNTAX     Counter32
+     MAX-ACCESS read-only
+     STATUS     current
+     DESCRIPTION
+      "The number of ICMP Echo (request) messages sent
+      by the interface."
+     ::= { ipv6IfIcmpEntry 25 }
+
+ ipv6IfIcmpOutEchoReplies OBJECT-TYPE
+     SYNTAX     Counter32
+     MAX-ACCESS read-only
+     STATUS     current
+     DESCRIPTION
+      "The number of ICMP Echo Reply messages sent
+      by the interface."
+     ::= { ipv6IfIcmpEntry 26 }
+
+ ipv6IfIcmpOutRouterSolicits OBJECT-TYPE
+     SYNTAX     Counter32
+     MAX-ACCESS read-only
+     STATUS     current
+     DESCRIPTION
+      "The number of ICMP Router Solicitation messages
+       sent by the interface."
+     ::= { ipv6IfIcmpEntry 27 }
+
+ ipv6IfIcmpOutRouterAdvertisements OBJECT-TYPE
+     SYNTAX     Counter32
+     MAX-ACCESS read-only
+     STATUS     current
+     DESCRIPTION
+      "The number of ICMP Router Advertisement messages
+      sent by the interface."
+     ::= { ipv6IfIcmpEntry 28 }
+
+ ipv6IfIcmpOutNeighborSolicits OBJECT-TYPE
+     SYNTAX     Counter32
+     MAX-ACCESS read-only
+     STATUS     current
+     DESCRIPTION
+      "The number of ICMP Neighbor Solicitation
+       messages sent by the interface."
+     ::= { ipv6IfIcmpEntry 29 }
+
+ ipv6IfIcmpOutNeighborAdvertisements OBJECT-TYPE
+     SYNTAX     Counter32
+     MAX-ACCESS read-only
+     STATUS     current
+     DESCRIPTION
+      "The number of ICMP Neighbor Advertisement
+      messages sent by the interface."
+     ::= { ipv6IfIcmpEntry 30 }
+
+ ipv6IfIcmpOutRedirects OBJECT-TYPE
+     SYNTAX     Counter32
+     MAX-ACCESS read-only
+     STATUS     current
+     DESCRIPTION
+      "The number of Redirect messages sent. For
+      a host, this object will always be zero,
+      since hosts do not send redirects."
+     ::= { ipv6IfIcmpEntry 31 }
+
+ ipv6IfIcmpOutGroupMembQueries OBJECT-TYPE
+     SYNTAX     Counter32
+     MAX-ACCESS read-only
+     STATUS     current
+     DESCRIPTION
+      "The number of ICMPv6 Group Membership Query
+      messages sent."
+     ::= { ipv6IfIcmpEntry 32}
+
+ ipv6IfIcmpOutGroupMembResponses OBJECT-TYPE
+     SYNTAX     Counter32
+     MAX-ACCESS read-only
+     STATUS     current
+     DESCRIPTION
+      "The number of ICMPv6 Group Membership Response
+      messages sent."
+     ::= { ipv6IfIcmpEntry 33}
+
+ ipv6IfIcmpOutGroupMembReductions OBJECT-TYPE
+     SYNTAX     Counter32
+     MAX-ACCESS read-only
+     STATUS     current
+     DESCRIPTION
+      "The number of ICMPv6 Group Membership Reduction
+      messages sent."
+     ::= { ipv6IfIcmpEntry 34}
+
+-- conformance information
+
+ipv6IcmpConformance OBJECT IDENTIFIER ::= { ipv6IcmpMIB 2 }
+
+ipv6IcmpCompliances
+        OBJECT IDENTIFIER ::= { ipv6IcmpConformance 1 }
+ipv6IcmpGroups
+        OBJECT IDENTIFIER ::= { ipv6IcmpConformance 2 }
+
+-- compliance statements
+
+ipv6IcmpCompliance MODULE-COMPLIANCE
+    STATUS  current
+    DESCRIPTION
+      "The compliance statement for SNMPv2 entities which
+      implement ICMPv6."
+    MODULE  -- this module
+        MANDATORY-GROUPS { ipv6IcmpGroup }
+    ::= { ipv6IcmpCompliances 1 }
+
+ipv6IcmpGroup OBJECT-GROUP
+    OBJECTS   {
+                ipv6IfIcmpInMsgs,
+                ipv6IfIcmpInErrors,
+                ipv6IfIcmpInDestUnreachs,
+                ipv6IfIcmpInAdminProhibs,
+                ipv6IfIcmpInTimeExcds,
+                ipv6IfIcmpInParmProblems,
+                ipv6IfIcmpInPktTooBigs,
+                ipv6IfIcmpInEchos,
+                ipv6IfIcmpInEchoReplies,
+                ipv6IfIcmpInRouterSolicits,
+                ipv6IfIcmpInRouterAdvertisements,
+                ipv6IfIcmpInNeighborSolicits,
+                ipv6IfIcmpInNeighborAdvertisements,
+                ipv6IfIcmpInRedirects,
+                ipv6IfIcmpInGroupMembQueries,
+                ipv6IfIcmpInGroupMembResponses,
+                ipv6IfIcmpInGroupMembReductions,
+                ipv6IfIcmpOutMsgs,
+                ipv6IfIcmpOutErrors,
+                ipv6IfIcmpOutDestUnreachs,
+                ipv6IfIcmpOutAdminProhibs,
+                ipv6IfIcmpOutTimeExcds,
+                ipv6IfIcmpOutParmProblems,
+                ipv6IfIcmpOutPktTooBigs,
+                ipv6IfIcmpOutEchos,
+                ipv6IfIcmpOutEchoReplies,
+                ipv6IfIcmpOutRouterSolicits,
+                ipv6IfIcmpOutRouterAdvertisements,
+                ipv6IfIcmpOutNeighborSolicits,
+                ipv6IfIcmpOutNeighborAdvertisements,
+                ipv6IfIcmpOutRedirects,
+                ipv6IfIcmpOutGroupMembQueries,
+                ipv6IfIcmpOutGroupMembResponses,
+                ipv6IfIcmpOutGroupMembReductions
+              }
+    STATUS    current
+    DESCRIPTION
+         "The ICMPv6 group of objects providing information
+          specific to ICMPv6."
+    ::= { ipv6IcmpGroups 1 }
+
+ END
diff -Naur tomato/release/src/router/snmp/mibs/IPV6-MIB.txt tomato121/release/src/router/snmp/mibs/IPV6-MIB.txt
--- tomato/release/src/router/snmp/mibs/IPV6-MIB.txt	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/mibs/IPV6-MIB.txt	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,1443 @@
+ IPV6-MIB DEFINITIONS ::= BEGIN
+
+ IMPORTS
+     MODULE-IDENTITY, OBJECT-TYPE, NOTIFICATION-TYPE,
+     mib-2, Counter32, Unsigned32, Integer32,
+     Gauge32                               FROM SNMPv2-SMI
+     DisplayString, PhysAddress, TruthValue, TimeStamp,
+     VariablePointer, RowPointer           FROM SNMPv2-TC
+     MODULE-COMPLIANCE, OBJECT-GROUP,
+     NOTIFICATION-GROUP                    FROM SNMPv2-CONF
+     Ipv6IfIndex, Ipv6Address, Ipv6AddressPrefix,
+     Ipv6AddressIfIdentifier,
+     Ipv6IfIndexOrZero                     FROM IPV6-TC;
+
+ ipv6MIB MODULE-IDENTITY
+     LAST-UPDATED "9802052155Z"
+     ORGANIZATION "IETF IPv6 Working Group"
+     CONTACT-INFO
+       "           Dimitry Haskin
+
+           Postal: Bay Networks, Inc.
+                   660 Techology Park Drive.
+                   Billerica, MA  01821
+
+                   US
+
+              Tel: +1-978-916-8124
+           E-mail: dhaskin@baynetworks.com
+
+                   Steve Onishi
+
+           Postal: Bay Networks, Inc.
+                   3 Federal Street
+                   Billerica, MA 01821
+                   US
+
+              Tel: +1-978-916-3816
+           E-mail: sonishi@baynetworks.com"
+     DESCRIPTION
+       "The MIB module for entities implementing the IPv6
+        protocol."
+     ::= { mib-2 55 }
+
+ -- the IPv6 general group
+
+ ipv6MIBObjects OBJECT IDENTIFIER   ::= { ipv6MIB 1 }
+
+ ipv6Forwarding OBJECT-TYPE
+     SYNTAX      INTEGER {
+                  forwarding(1),    -- acting as a router
+
+                                    -- NOT acting as
+                  notForwarding(2)  -- a router
+                 }
+      MAX-ACCESS read-write
+      STATUS     current
+      DESCRIPTION
+        "The indication of whether this entity is acting
+        as an IPv6 router in respect to the forwarding of
+        datagrams received by, but not addressed to, this
+        entity.  IPv6 routers forward datagrams.  IPv6
+        hosts do not (except those source-routed via the
+        host).
+
+        Note that for some managed nodes, this object may
+        take on only a subset of the values possible.
+        Accordingly, it is appropriate for an agent to
+        return a `wrongValue' response if a management
+        station attempts to change this object to an
+        inappropriate value."
+      ::= { ipv6MIBObjects 1 }
+
+ ipv6DefaultHopLimit OBJECT-TYPE
+     SYNTAX      INTEGER(0..255)
+     MAX-ACCESS  read-write
+      STATUS     current
+     DESCRIPTION
+        "The default value inserted into the Hop Limit
+        field of the IPv6 header of datagrams originated
+        at this entity, whenever a Hop Limit value is not
+        supplied by the transport layer protocol."
+     DEFVAL  { 64 }
+     ::= { ipv6MIBObjects 2 }
+
+ipv6Interfaces OBJECT-TYPE
+     SYNTAX      Unsigned32
+     MAX-ACCESS  read-only
+     STATUS      current
+     DESCRIPTION
+       "The number of IPv6 interfaces (regardless of
+        their current state) present on this system."
+     ::= { ipv6MIBObjects 3 }
+
+ipv6IfTableLastChange OBJECT-TYPE
+     SYNTAX      TimeStamp
+     MAX-ACCESS  read-only
+     STATUS      current
+     DESCRIPTION
+       "The value of sysUpTime at the time of the last
+       insertion or removal of an entry in the
+       ipv6IfTable. If the number of entries has been
+       unchanged since the last re-initialization of
+       the local network management subsystem, then this
+       object contains a zero value."
+     ::= { ipv6MIBObjects 4 }
+
+-- the IPv6 Interfaces table
+
+ipv6IfTable OBJECT-TYPE
+     SYNTAX     SEQUENCE OF Ipv6IfEntry
+     MAX-ACCESS not-accessible
+     STATUS     current
+     DESCRIPTION
+       "The IPv6 Interfaces table contains information
+       on the entity's internetwork-layer interfaces.
+       An IPv6 interface constitutes a logical network
+       layer attachment to the layer immediately below
+
+       IPv6 including internet layer 'tunnels', such as
+       tunnels over IPv4 or IPv6 itself."
+     ::= { ipv6MIBObjects 5 }
+
+ ipv6IfEntry OBJECT-TYPE
+     SYNTAX     Ipv6IfEntry
+     MAX-ACCESS not-accessible
+     STATUS     current
+     DESCRIPTION
+       "An interface entry containing objects
+        about a particular IPv6 interface."
+     INDEX   { ipv6IfIndex }
+     ::= { ipv6IfTable 1 }
+
+ Ipv6IfEntry ::= SEQUENCE {
+         ipv6IfIndex              Ipv6IfIndex,
+         ipv6IfDescr              DisplayString,
+         ipv6IfLowerLayer         VariablePointer,
+         ipv6IfEffectiveMtu       Unsigned32,
+         ipv6IfReasmMaxSize       Unsigned32,
+         ipv6IfIdentifier         Ipv6AddressIfIdentifier,
+         ipv6IfIdentifierLength   INTEGER,
+         ipv6IfPhysicalAddress    PhysAddress,
+         ipv6IfAdminStatus        INTEGER,
+         ipv6IfOperStatus         INTEGER,
+         ipv6IfLastChange         TimeStamp
+     }
+
+ ipv6IfIndex OBJECT-TYPE
+     SYNTAX     Ipv6IfIndex
+     MAX-ACCESS not-accessible
+     STATUS     current
+     DESCRIPTION
+       "A unique non-zero value identifying
+        the particular IPv6 interface."
+     ::= { ipv6IfEntry 1 }
+
+ ipv6IfDescr OBJECT-TYPE
+     SYNTAX     DisplayString
+     MAX-ACCESS read-write
+     STATUS     current
+     DESCRIPTION
+       "A textual string containing information about the
+       interface.  This string may be set by the network
+       management system."
+     ::= { ipv6IfEntry 2 }
+
+ ipv6IfLowerLayer OBJECT-TYPE
+    SYNTAX      VariablePointer
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+      "This object identifies the protocol layer over
+       which this network interface operates.  If this
+       network interface operates over the data-link
+       layer, then the value of this object refers to an
+       instance of ifIndex [6]. If this network interface
+       operates over an IPv4 interface, the value of this
+       object refers to an instance of ipAdEntAddr [3].
+
+       If this network interface operates over another
+       IPv6 interface, the value of this object refers to
+       an instance of ipv6IfIndex.  If this network
+       interface is not currently operating over an active
+       protocol layer, then the value of this object
+       should be set to the OBJECT ID { 0 0 }."
+    ::= { ipv6IfEntry 3 }
+
+ ipv6IfEffectiveMtu OBJECT-TYPE
+    SYNTAX      Unsigned32
+    UNITS       "octets"
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+      "The size of the largest IPv6 packet which can be
+      sent/received on the interface, specified in
+      octets."
+ ::= { ipv6IfEntry 4 }
+
+ ipv6IfReasmMaxSize OBJECT-TYPE
+    SYNTAX      Unsigned32 (0..65535)
+    UNITS       "octets"
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+      "The size of the largest IPv6 datagram which this
+      entity can re-assemble from incoming IPv6 fragmented
+      datagrams received on this interface."
+ ::= { ipv6IfEntry 5 }
+
+ ipv6IfIdentifier OBJECT-TYPE
+     SYNTAX      Ipv6AddressIfIdentifier
+     MAX-ACCESS  read-write
+     STATUS      current
+     DESCRIPTION
+        "The Interface Identifier for this interface that
+
+        is (at least) unique on the link this interface is
+        attached to. The Interface Identifier is combined
+        with an address prefix to form an interface address.
+
+        By default, the Interface Identifier is autoconfigured
+        according to the rules of the link type this
+        interface is attached to."
+     ::= { ipv6IfEntry 6 }
+
+ ipv6IfIdentifierLength OBJECT-TYPE
+     SYNTAX      INTEGER (0..64)
+     UNITS       "bits"
+     MAX-ACCESS  read-write
+     STATUS      current
+     DESCRIPTION
+       "The length of the Interface Identifier in bits."
+     ::= { ipv6IfEntry 7 }
+
+ ipv6IfPhysicalAddress OBJECT-TYPE
+     SYNTAX      PhysAddress
+     MAX-ACCESS  read-only
+     STATUS      current
+     DESCRIPTION
+       "The interface's physical address. For example, for
+       an IPv6 interface attached to an 802.x link, this
+       object normally contains a MAC address. Note that
+       in some cases this address may differ from the
+       address of the interface's protocol sub-layer.  The
+       interface's media-specific MIB must define the bit
+       and byte ordering and the format of the value of
+       this object. For interfaces which do not have such
+       an address (e.g., a serial line), this object should
+       contain an octet string of zero length."
+     ::= { ipv6IfEntry 8 }
+
+ipv6IfAdminStatus OBJECT-TYPE
+    SYNTAX  INTEGER {
+             up(1),       -- ready to pass packets
+             down(2)
+            }
+    MAX-ACCESS  read-write
+    STATUS      current
+    DESCRIPTION
+      "The desired state of the interface.  When a managed
+      system initializes,  all IPv6 interfaces start with
+      ipv6IfAdminStatus in the down(2) state.  As a result
+      of either explicit management action or per
+      configuration information retained by the managed
+
+      system,  ipv6IfAdminStatus is then changed to
+      the up(1) state (or remains in the down(2) state)."
+    ::= { ipv6IfEntry 9 }
+
+ipv6IfOperStatus OBJECT-TYPE
+    SYNTAX  INTEGER {
+             up(1),             -- ready to pass packets
+
+             down(2),
+             noIfIdentifier(3), -- no interface identifier
+
+                                -- status can not be
+                                -- determined for some
+             unknown(4),        -- reason
+
+                                -- some component is
+             notPresent(5)      -- missing
+            }
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+      "The current operational state of the interface.
+      The noIfIdentifier(3) state indicates that no valid
+      Interface Identifier is assigned to the interface.
+      This state usually indicates that the link-local
+      interface address failed Duplicate Address Detection.
+      If ipv6IfAdminStatus is down(2) then ipv6IfOperStatus
+      should be down(2).  If ipv6IfAdminStatus is changed
+      to up(1) then ipv6IfOperStatus should change to up(1)
+      if the interface is ready to transmit and receive
+      network traffic; it should remain in the down(2) or
+      noIfIdentifier(3) state if and only if there is a
+      fault that prevents it from going to the up(1) state;
+      it should remain in the notPresent(5) state if
+      the interface has missing (typically, lower layer)
+      components."
+    ::= { ipv6IfEntry 10 }
+
+ipv6IfLastChange OBJECT-TYPE
+    SYNTAX      TimeStamp
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+        "The value of sysUpTime at the time the interface
+        entered its current operational state.  If the
+        current state was entered prior to the last
+        re-initialization of the local network management
+
+        subsystem, then this object contains a zero
+        value."
+    ::= { ipv6IfEntry 11 }
+
+ --  IPv6 Interface Statistics table
+
+ ipv6IfStatsTable OBJECT-TYPE
+     SYNTAX     SEQUENCE OF Ipv6IfStatsEntry
+     MAX-ACCESS not-accessible
+     STATUS     current
+     DESCRIPTION
+         "IPv6 interface traffic statistics."
+     ::= { ipv6MIBObjects 6 }
+
+ ipv6IfStatsEntry OBJECT-TYPE
+     SYNTAX     Ipv6IfStatsEntry
+     MAX-ACCESS not-accessible
+     STATUS     current
+     DESCRIPTION
+         "An interface statistics entry containing objects
+         at a particular IPv6 interface."
+     AUGMENTS { ipv6IfEntry }
+     ::= { ipv6IfStatsTable 1 }
+
+ Ipv6IfStatsEntry ::= SEQUENCE {
+         ipv6IfStatsInReceives
+             Counter32,
+         ipv6IfStatsInHdrErrors
+             Counter32,
+         ipv6IfStatsInTooBigErrors
+             Counter32,
+         ipv6IfStatsInNoRoutes
+             Counter32,
+         ipv6IfStatsInAddrErrors
+             Counter32,
+         ipv6IfStatsInUnknownProtos
+             Counter32,
+         ipv6IfStatsInTruncatedPkts
+             Counter32,
+         ipv6IfStatsInDiscards
+             Counter32,
+         ipv6IfStatsInDelivers
+             Counter32,
+         ipv6IfStatsOutForwDatagrams
+             Counter32,
+         ipv6IfStatsOutRequests
+             Counter32,
+         ipv6IfStatsOutDiscards
+
+             Counter32,
+         ipv6IfStatsOutFragOKs
+             Counter32,
+         ipv6IfStatsOutFragFails
+             Counter32,
+         ipv6IfStatsOutFragCreates
+             Counter32,
+         ipv6IfStatsReasmReqds
+             Counter32,
+         ipv6IfStatsReasmOKs
+             Counter32,
+         ipv6IfStatsReasmFails
+             Counter32,
+         ipv6IfStatsInMcastPkts
+             Counter32,
+         ipv6IfStatsOutMcastPkts
+             Counter32
+     }
+
+ ipv6IfStatsInReceives OBJECT-TYPE
+     SYNTAX      Counter32
+     MAX-ACCESS  read-only
+     STATUS      current
+     DESCRIPTION
+        "The total number of input datagrams received by
+        the interface, including those received in error."
+     ::= { ipv6IfStatsEntry 1 }
+
+ ipv6IfStatsInHdrErrors OBJECT-TYPE
+     SYNTAX     Counter32
+     MAX-ACCESS read-only
+     STATUS     current
+     DESCRIPTION
+        "The number of input datagrams discarded due to
+        errors in their IPv6 headers, including version
+        number mismatch, other format errors, hop count
+        exceeded, errors discovered in processing their
+        IPv6 options, etc."
+     ::= { ipv6IfStatsEntry 2 }
+
+ ipv6IfStatsInTooBigErrors OBJECT-TYPE
+     SYNTAX      Counter32
+     MAX-ACCESS  read-only
+     STATUS      current
+     DESCRIPTION
+       "The number of input datagrams that could not be
+       forwarded because their size exceeded the link MTU
+       of outgoing interface."
+     ::= { ipv6IfStatsEntry 3 }
+
+ ipv6IfStatsInNoRoutes OBJECT-TYPE
+     SYNTAX      Counter32
+     MAX-ACCESS  read-only
+     STATUS      current
+     DESCRIPTION
+        "The number of input datagrams discarded because no
+         route could be found to transmit them to their
+         destination."
+     ::= { ipv6IfStatsEntry 4 }
+
+ ipv6IfStatsInAddrErrors OBJECT-TYPE
+     SYNTAX      Counter32
+     MAX-ACCESS  read-only
+     STATUS      current
+     DESCRIPTION
+        "The number of input datagrams discarded because
+        the IPv6 address in their IPv6 header's destination
+        field was not a valid address to be received at
+        this entity.  This count includes invalid
+        addresses (e.g., ::0) and unsupported addresses
+        (e.g., addresses with unallocated prefixes).  For
+        entities which are not IPv6 routers and therefore
+        do not forward datagrams, this counter includes
+        datagrams discarded because the destination address
+        was not a local address."
+     ::= { ipv6IfStatsEntry 5 }
+
+ ipv6IfStatsInUnknownProtos OBJECT-TYPE
+     SYNTAX      Counter32
+     MAX-ACCESS  read-only
+     STATUS      current
+     DESCRIPTION
+        "The number of locally-addressed datagrams
+        received successfully but discarded because of an
+        unknown or unsupported protocol. This counter is
+        incremented at the interface to which these
+        datagrams were addressed which might not be
+        necessarily the input interface for some of
+        the datagrams."
+     ::= { ipv6IfStatsEntry 6 }
+
+ ipv6IfStatsInTruncatedPkts OBJECT-TYPE
+     SYNTAX      Counter32
+     MAX-ACCESS  read-only
+     STATUS      current
+     DESCRIPTION
+        "The number of input datagrams discarded because
+         datagram frame didn't carry enough data."
+     ::= { ipv6IfStatsEntry 7 }
+
+ ipv6IfStatsInDiscards OBJECT-TYPE
+     SYNTAX      Counter32
+     MAX-ACCESS  read-only
+     STATUS      current
+     DESCRIPTION
+        "The number of input IPv6 datagrams for which no
+        problems were encountered to prevent their
+        continued processing, but which were discarded
+        (e.g., for lack of buffer space).  Note that this
+        counter does not include any datagrams discarded
+        while awaiting re-assembly."
+     ::= { ipv6IfStatsEntry 8 }
+
+ ipv6IfStatsInDelivers OBJECT-TYPE
+     SYNTAX      Counter32
+     MAX-ACCESS  read-only
+     STATUS      current
+     DESCRIPTION
+      "The total number of datagrams successfully
+      delivered to IPv6 user-protocols (including ICMP).
+      This counter is incremented at the interface to
+      which these datagrams were addressed which might
+      not be necessarily the input interface for some of
+      the datagrams."
+     ::= { ipv6IfStatsEntry 9 }
+
+ ipv6IfStatsOutForwDatagrams OBJECT-TYPE
+     SYNTAX      Counter32
+     MAX-ACCESS  read-only
+     STATUS      current
+     DESCRIPTION
+        "The number of output datagrams which this
+        entity received and forwarded to their final
+        destinations.  In entities which do not act
+        as IPv6 routers, this counter will include
+        only those packets which were Source-Routed
+        via this entity, and the Source-Route
+        processing was successful.  Note that for
+        a successfully forwarded datagram the counter
+        of the outgoing interface is incremented."
+     ::= { ipv6IfStatsEntry 10 }
+
+ ipv6IfStatsOutRequests OBJECT-TYPE
+     SYNTAX      Counter32
+     MAX-ACCESS  read-only
+     STATUS      current
+     DESCRIPTION
+      "The total number of IPv6 datagrams which local IPv6
+      user-protocols (including ICMP) supplied to IPv6 in
+      requests for transmission.  Note that this counter
+      does not include any datagrams counted in
+      ipv6IfStatsOutForwDatagrams."
+     ::= { ipv6IfStatsEntry 11 }
+
+ ipv6IfStatsOutDiscards OBJECT-TYPE
+     SYNTAX      Counter32
+     MAX-ACCESS  read-only
+     STATUS      current
+     DESCRIPTION
+         "The number of output IPv6 datagrams for which no
+         problem was encountered to prevent their
+         transmission to their destination, but which were
+         discarded (e.g., for lack of buffer space).  Note
+         that this counter would include datagrams counted
+         in ipv6IfStatsOutForwDatagrams if any such packets
+         met this (discretionary) discard criterion."
+     ::= { ipv6IfStatsEntry 12 }
+
+ ipv6IfStatsOutFragOKs OBJECT-TYPE
+     SYNTAX      Counter32
+     MAX-ACCESS  read-only
+     STATUS      current
+     DESCRIPTION
+        "The number of IPv6 datagrams that have been
+         successfully fragmented at this output interface."
+     ::= { ipv6IfStatsEntry 13 }
+
+ ipv6IfStatsOutFragFails OBJECT-TYPE
+     SYNTAX      Counter32
+     MAX-ACCESS  read-only
+     STATUS      current
+     DESCRIPTION
+        "The number of IPv6 datagrams that have been
+         discarded because they needed to be fragmented
+         at this output interface but could not be."
+     ::= { ipv6IfStatsEntry 14 }
+
+ ipv6IfStatsOutFragCreates OBJECT-TYPE
+     SYNTAX      Counter32
+     MAX-ACCESS  read-only
+     STATUS      current
+     DESCRIPTION
+        "The number of output datagram fragments that have
+         been generated as a result of fragmentation at
+         this output interface."
+     ::= { ipv6IfStatsEntry 15 }
+
+ ipv6IfStatsReasmReqds OBJECT-TYPE
+     SYNTAX      Counter32
+     MAX-ACCESS  read-only
+     STATUS      current
+     DESCRIPTION
+        "The number of IPv6 fragments received which needed
+         to be reassembled at this interface.  Note that this
+         counter is incremented at the interface to which
+         these fragments were addressed which might not
+         be necessarily the input interface for some of
+         the fragments."
+     ::= { ipv6IfStatsEntry 16 }
+
+ ipv6IfStatsReasmOKs OBJECT-TYPE
+     SYNTAX      Counter32
+     MAX-ACCESS  read-only
+     STATUS      current
+     DESCRIPTION
+       "The number of IPv6 datagrams successfully
+       reassembled.  Note that this counter is incremented
+       at the interface to which these datagrams were
+       addressed which might not be necessarily the input
+       interface for some of the fragments."
+     ::= { ipv6IfStatsEntry 17 }
+
+ ipv6IfStatsReasmFails OBJECT-TYPE
+     SYNTAX      Counter32
+     MAX-ACCESS  read-only
+     STATUS      current
+     DESCRIPTION
+        "The number of failures detected by the IPv6 re-
+        assembly algorithm (for whatever reason: timed
+        out, errors, etc.).  Note that this is not
+        necessarily a count of discarded IPv6 fragments
+        since some algorithms (notably the algorithm in
+        RFC 815) can lose track of the number of fragments
+        by combining them as they are received.
+        This counter is incremented at the interface to which
+        these fragments were addressed which might not be
+        necessarily the input interface for some of the
+        fragments."
+     ::= { ipv6IfStatsEntry 18 }
+
+ ipv6IfStatsInMcastPkts OBJECT-TYPE
+     SYNTAX      Counter32
+     MAX-ACCESS  read-only
+     STATUS     current
+     DESCRIPTION
+        "The number of multicast packets received
+         by the interface"
+     ::= { ipv6IfStatsEntry 19 }
+
+ ipv6IfStatsOutMcastPkts OBJECT-TYPE
+     SYNTAX      Counter32
+     MAX-ACCESS  read-only
+     STATUS      current
+     DESCRIPTION
+        "The number of multicast packets transmitted
+         by the interface"
+     ::= { ipv6IfStatsEntry 20 }
+
+ -- Address Prefix table
+
+ -- The IPv6 Address Prefix table contains information on
+ -- the entity's IPv6 Address Prefixes that are associated
+ -- with IPv6 interfaces.
+
+ ipv6AddrPrefixTable OBJECT-TYPE
+     SYNTAX  SEQUENCE OF Ipv6AddrPrefixEntry
+     MAX-ACCESS  not-accessible
+     STATUS      current
+     DESCRIPTION
+         "The list of IPv6 address prefixes of
+         IPv6 interfaces."
+     ::= { ipv6MIBObjects 7 }
+
+ ipv6AddrPrefixEntry OBJECT-TYPE
+     SYNTAX  Ipv6AddrPrefixEntry
+     MAX-ACCESS  not-accessible
+     STATUS      current
+     DESCRIPTION
+         "An interface entry containing objects of
+         a particular IPv6 address prefix."
+     INDEX   { ipv6IfIndex,
+               ipv6AddrPrefix,
+               ipv6AddrPrefixLength }
+     ::= { ipv6AddrPrefixTable 1 }
+
+ Ipv6AddrPrefixEntry ::= SEQUENCE {
+
+      ipv6AddrPrefix                     Ipv6AddressPrefix,
+      ipv6AddrPrefixLength               INTEGER (0..128),
+      ipv6AddrPrefixOnLinkFlag           TruthValue,
+      ipv6AddrPrefixAutonomousFlag       TruthValue,
+      ipv6AddrPrefixAdvPreferredLifetime Unsigned32,
+      ipv6AddrPrefixAdvValidLifetime     Unsigned32
+     }
+
+ ipv6AddrPrefix OBJECT-TYPE
+     SYNTAX      Ipv6AddressPrefix
+     MAX-ACCESS  not-accessible
+     STATUS      current
+     DESCRIPTION
+       "The prefix associated with the this interface."
+     ::= { ipv6AddrPrefixEntry 1 }
+
+ ipv6AddrPrefixLength OBJECT-TYPE
+     SYNTAX      INTEGER (0..128)
+     UNITS       "bits"
+     MAX-ACCESS  not-accessible
+     STATUS      current
+     DESCRIPTION
+       "The length of the prefix (in bits)."
+     ::= { ipv6AddrPrefixEntry 2 }
+
+ ipv6AddrPrefixOnLinkFlag OBJECT-TYPE
+     SYNTAX      TruthValue
+     MAX-ACCESS  read-only
+     STATUS      current
+     DESCRIPTION
+       "This object has the value 'true(1)', if this
+       prefix can be used  for on-link determination
+       and the value 'false(2)' otherwise."
+     ::= { ipv6AddrPrefixEntry 3 }
+
+ ipv6AddrPrefixAutonomousFlag OBJECT-TYPE
+     SYNTAX      TruthValue
+     MAX-ACCESS  read-only
+     STATUS      current
+     DESCRIPTION
+       "Autonomous address configuration flag. When
+       true(1), indicates that this prefix can be used
+       for autonomous address configuration (i.e. can
+       be used to form a local interface address).
+       If false(2), it is not used to autoconfigure
+       a local interface address."
+     ::= { ipv6AddrPrefixEntry 4 }
+
+ ipv6AddrPrefixAdvPreferredLifetime OBJECT-TYPE
+     SYNTAX      Unsigned32
+     UNITS       "seconds"
+     MAX-ACCESS  read-only
+     STATUS      current
+     DESCRIPTION
+        "It is the length of time in seconds that this
+        prefix will remain preferred, i.e. time until
+        deprecation.  A value of 4,294,967,295 represents
+        infinity.
+
+        The address generated from a deprecated prefix
+        should no longer be used as a source address in
+        new communications, but packets received on such
+        an interface are processed as expected."
+     ::= { ipv6AddrPrefixEntry 5 }
+
+ ipv6AddrPrefixAdvValidLifetime OBJECT-TYPE
+     SYNTAX      Unsigned32
+     UNITS       "seconds"
+     MAX-ACCESS  read-only
+     STATUS      current
+     DESCRIPTION
+       "It is the length of time in seconds that this
+       prefix will remain valid, i.e. time until
+       invalidation.  A value of 4,294,967,295 represents
+       infinity.
+
+       The address generated from an invalidated prefix
+       should not appear as the destination or source
+       address of a packet."
+     ::= { ipv6AddrPrefixEntry 6 }
+
+ -- the IPv6 Address table
+
+ -- The IPv6 address table contains this node's IPv6
+ -- addressing information.
+
+ ipv6AddrTable OBJECT-TYPE
+    SYNTAX      SEQUENCE OF Ipv6AddrEntry
+    MAX-ACCESS  not-accessible
+    STATUS      current
+    DESCRIPTION
+      "The table of addressing information relevant to
+      this node's interface addresses."
+    ::= { ipv6MIBObjects 8 }
+
+ ipv6AddrEntry OBJECT-TYPE
+    SYNTAX      Ipv6AddrEntry
+    MAX-ACCESS  not-accessible
+    STATUS      current
+    DESCRIPTION
+        "The addressing information for one of this
+        node's interface addresses."
+    INDEX   { ipv6IfIndex, ipv6AddrAddress }
+    ::= { ipv6AddrTable 1 }
+
+ Ipv6AddrEntry ::=
+    SEQUENCE {
+         ipv6AddrAddress        Ipv6Address,
+         ipv6AddrPfxLength      INTEGER,
+         ipv6AddrType           INTEGER,
+         ipv6AddrAnycastFlag    TruthValue,
+         ipv6AddrStatus         INTEGER
+        }
+
+ ipv6AddrAddress OBJECT-TYPE
+    SYNTAX      Ipv6Address
+    MAX-ACCESS  not-accessible
+    STATUS      current
+    DESCRIPTION
+      "The IPv6 address to which this entry's addressing
+      information pertains."
+    ::= { ipv6AddrEntry 1 }
+
+ ipv6AddrPfxLength OBJECT-TYPE
+    SYNTAX      INTEGER(0..128)
+    UNITS       "bits"
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+      "The length of the prefix (in bits) associated with
+      the IPv6 address of this entry."
+    ::= { ipv6AddrEntry 2 }
+
+ ipv6AddrType OBJECT-TYPE
+    SYNTAX      INTEGER {
+                        -- address has been formed
+                        -- using stateless
+         stateless(1),  -- autoconfiguration
+
+                        -- address has been acquired
+                        -- by stateful means
+                        -- (e.g. DHCPv6, manual
+         stateful(2),   -- configuration)
+
+                        -- type can not be determined
+         unknown(3)     -- for some reason.
+       }
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+       "The type of address. Note that 'stateless(1)'
+       refers to an address that was statelessly
+       autoconfigured; 'stateful(2)' refers to a address
+       which was acquired by via a stateful protocol
+       (e.g. DHCPv6, manual configuration)."
+    ::= { ipv6AddrEntry 3 }
+
+ ipv6AddrAnycastFlag OBJECT-TYPE
+     SYNTAX      TruthValue
+     MAX-ACCESS  read-only
+     STATUS      current
+     DESCRIPTION
+       "This object has the value 'true(1)', if this
+       address is an anycast address and the value
+       'false(2)' otherwise."
+     ::= { ipv6AddrEntry 4 }
+
+ ipv6AddrStatus OBJECT-TYPE
+    SYNTAX      INTEGER {
+             preferred(1),
+             deprecated(2),
+             invalid(3),
+             inaccessible(4),
+             unknown(5)   -- status can not be determined
+                          -- for some reason.
+            }
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+      "Address status.  The preferred(1) state indicates
+      that this is a valid address that can appear as
+      the destination or source address of a packet.
+      The deprecated(2) state indicates that this is
+      a valid but deprecated address that should no longer
+      be used as a source address in new communications,
+      but packets addressed to such an address are
+      processed as expected. The invalid(3) state indicates
+      that this is not valid address which should not
+
+      appear as the destination or source address of
+      a packet. The inaccessible(4) state indicates that
+      the address is not accessible because the interface
+      to which this address is assigned is not operational."
+    ::= { ipv6AddrEntry 5 }
+
+ -- IPv6 Routing objects
+
+ ipv6RouteNumber OBJECT-TYPE
+     SYNTAX      Gauge32
+     MAX-ACCESS  read-only
+     STATUS      current
+     DESCRIPTION
+       "The number of current ipv6RouteTable entries.
+       This is primarily to avoid having to read
+       the table in order to determine this number."
+     ::= { ipv6MIBObjects 9 }
+
+ ipv6DiscardedRoutes OBJECT-TYPE
+     SYNTAX      Counter32
+     MAX-ACCESS  read-only
+     STATUS      current
+     DESCRIPTION
+       "The number of routing entries which were chosen
+        to be discarded even though they are valid.  One
+        possible reason for discarding such an entry could
+        be to free-up buffer space for other routing
+        entries."
+     ::= { ipv6MIBObjects 10 }
+
+ -- IPv6 Routing table
+
+ ipv6RouteTable OBJECT-TYPE
+     SYNTAX     SEQUENCE OF Ipv6RouteEntry
+     MAX-ACCESS not-accessible
+     STATUS     current
+     DESCRIPTION
+       "IPv6 Routing table. This table contains
+       an entry for each valid IPv6 unicast route
+       that can be used for packet forwarding
+       determination."
+     ::= { ipv6MIBObjects 11 }
+
+ ipv6RouteEntry OBJECT-TYPE
+     SYNTAX     Ipv6RouteEntry
+     MAX-ACCESS not-accessible
+     STATUS     current
+     DESCRIPTION
+             "A routing entry."
+     INDEX   { ipv6RouteDest,
+               ipv6RoutePfxLength,
+               ipv6RouteIndex }
+     ::= { ipv6RouteTable 1 }
+
+ Ipv6RouteEntry ::= SEQUENCE {
+         ipv6RouteDest           Ipv6Address,
+         ipv6RoutePfxLength      INTEGER,
+         ipv6RouteIndex          Unsigned32,
+         ipv6RouteIfIndex        Ipv6IfIndexOrZero,
+         ipv6RouteNextHop        Ipv6Address,
+         ipv6RouteType           INTEGER,
+         ipv6RouteProtocol       INTEGER,
+         ipv6RoutePolicy         Integer32,
+         ipv6RouteAge            Unsigned32,
+         ipv6RouteNextHopRDI     Unsigned32,
+         ipv6RouteMetric         Unsigned32,
+         ipv6RouteWeight         Unsigned32,
+         ipv6RouteInfo           RowPointer,
+         ipv6RouteValid          TruthValue
+     }
+
+ ipv6RouteDest OBJECT-TYPE
+     SYNTAX     Ipv6Address
+     MAX-ACCESS not-accessible
+     STATUS     current
+     DESCRIPTION
+       "The destination IPv6 address of this route.
+       This object may not take a Multicast address
+       value."
+     ::= { ipv6RouteEntry 1 }
+
+ ipv6RoutePfxLength OBJECT-TYPE
+     SYNTAX     INTEGER(0..128)
+     UNITS      "bits"
+     MAX-ACCESS not-accessible
+     STATUS     current
+     DESCRIPTION
+       "Indicates the prefix length of the destination
+       address."
+     ::= { ipv6RouteEntry 2 }
+
+ ipv6RouteIndex OBJECT-TYPE
+     SYNTAX     Unsigned32
+     MAX-ACCESS not-accessible
+     STATUS     current
+     DESCRIPTION
+       "The value which uniquely identifies the route
+       among the routes to the same network layer
+       destination.  The way this value is chosen is
+       implementation specific but it must be unique for
+       ipv6RouteDest/ipv6RoutePfxLength pair and remain
+       constant for the life of the route."
+     ::= { ipv6RouteEntry 3 }
+
+ ipv6RouteIfIndex OBJECT-TYPE
+     SYNTAX     Ipv6IfIndexOrZero
+     MAX-ACCESS read-only
+     STATUS     current
+     DESCRIPTION
+       "The index value which uniquely identifies the local
+       interface through which the next hop of this
+       route should be reached.  The interface identified
+       by a particular value of this index is the same
+       interface as identified by the same value of
+       ipv6IfIndex.  For routes of the discard type this
+       value can be zero."
+     ::= { ipv6RouteEntry 4 }
+
+ ipv6RouteNextHop OBJECT-TYPE
+     SYNTAX     Ipv6Address
+     MAX-ACCESS read-only
+     STATUS     current
+     DESCRIPTION
+       "On remote routes, the address of the next
+       system en route;  otherwise, ::0
+       ('00000000000000000000000000000000'H in ASN.1
+       string representation)."
+     ::= { ipv6RouteEntry 5 }
+
+ ipv6RouteType OBJECT-TYPE
+     SYNTAX     INTEGER {
+        other(1),     -- none of the following
+
+                      -- an route indicating that
+                      -- packets to destinations
+                      -- matching this route are
+        discard(2),   -- to be discarded
+
+                      -- route to directly
+        local(3),     -- connected (sub-)network
+
+                      -- route to a remote
+
+        remote(4)     -- destination
+
+     }
+     MAX-ACCESS read-only
+     STATUS     current
+     DESCRIPTION
+        "The type of route. Note that 'local(3)' refers
+        to a route for which the next hop is the final
+        destination; 'remote(4)' refers to a route for
+        which  the  next  hop is not the final
+        destination; 'discard(2)' refers to a route
+        indicating that packets to destinations matching
+        this route are to be discarded (sometimes called
+        black-hole route)."
+     ::= { ipv6RouteEntry 6 }
+
+ ipv6RouteProtocol OBJECT-TYPE
+     SYNTAX     INTEGER {
+       other(1),   -- none of the following
+
+                   -- non-protocol information,
+                   -- e.g., manually configured
+       local(2),   -- entries
+
+       netmgmt(3), -- static route
+
+                   -- obtained via Neighbor
+                   -- Discovery protocol,
+       ndisc(4),   -- e.g., result of Redirect
+
+                   -- the following are all
+                   -- dynamic routing protocols
+       rip(5),     -- RIPng
+       ospf(6),    -- Open Shortest Path First
+       bgp(7),     -- Border Gateway Protocol
+       idrp(8),    -- InterDomain Routing Protocol
+       igrp(9)     -- InterGateway Routing Protocol
+     }
+     MAX-ACCESS read-only
+     STATUS     current
+     DESCRIPTION
+       "The routing mechanism via which this route was
+       learned."
+     ::= { ipv6RouteEntry 7 }
+
+ ipv6RoutePolicy OBJECT-TYPE
+     SYNTAX     Integer32
+     MAX-ACCESS read-only
+     STATUS     current
+     DESCRIPTION
+      "The general set of conditions that would cause the
+      selection of one multipath route (set of next hops
+      for a given destination) is referred to as 'policy'.
+      Unless the mechanism indicated by ipv6RouteProtocol
+      specified otherwise, the policy specifier is the
+      8-bit Traffic Class field of the IPv6 packet header
+      that is zero extended at the left to a 32-bit value.
+
+      Protocols defining 'policy' otherwise must either
+      define a set of values which are valid for
+      this object or must implement an integer-
+      instanced  policy table for which this object's
+      value acts as an index."
+     ::= { ipv6RouteEntry 8 }
+
+ ipv6RouteAge OBJECT-TYPE
+     SYNTAX     Unsigned32
+     UNITS      "seconds"
+     MAX-ACCESS read-only
+     STATUS     current
+     DESCRIPTION
+        "The number of seconds since this route was last
+        updated or otherwise determined to be correct.
+        Note that no semantics of `too old' can be implied
+        except through knowledge of the routing protocol
+        by which the route was learned."
+     ::= { ipv6RouteEntry 9 }
+
+ ipv6RouteNextHopRDI OBJECT-TYPE
+     SYNTAX     Unsigned32
+     MAX-ACCESS read-only
+     STATUS     current
+     DESCRIPTION
+        "The Routing Domain ID of the Next Hop.
+        The  semantics of this object are determined by
+        the routing-protocol specified in  the  route's
+        ipv6RouteProtocol value.   When  this object is
+        unknown or not relevant its value should be set
+        to zero."
+     ::= { ipv6RouteEntry 10 }
+
+ ipv6RouteMetric OBJECT-TYPE
+     SYNTAX     Unsigned32
+     MAX-ACCESS read-only
+     STATUS     current
+     DESCRIPTION
+        "The routing metric for this route. The
+        semantics of this metric are determined by the
+        routing protocol specified in the route's
+        ipv6RouteProtocol value.  When this is unknown
+        or not relevant to the protocol indicated by
+        ipv6RouteProtocol, the object value should be
+        set to its maximum value (4,294,967,295)."
+     ::= { ipv6RouteEntry 11 }
+
+ ipv6RouteWeight OBJECT-TYPE
+     SYNTAX     Unsigned32
+     MAX-ACCESS read-only
+     STATUS     current
+     DESCRIPTION
+        "The system internal weight value for this route.
+        The semantics of this value are determined by
+        the implementation specific rules. Generally,
+        within routes with the same ipv6RoutePolicy value,
+        the lower the weight value the more preferred is
+        the route."
+     ::= { ipv6RouteEntry 12 }
+
+ ipv6RouteInfo OBJECT-TYPE
+     SYNTAX     RowPointer
+     MAX-ACCESS read-only
+     STATUS     current
+     DESCRIPTION
+        "A reference to MIB definitions specific to the
+        particular routing protocol which is responsible
+        for this route, as determined by the  value
+        specified  in the route's ipv6RouteProto value.
+        If this information is not present,  its  value
+        should be set to the OBJECT ID { 0 0 },
+        which is a syntactically valid object  identifier,
+        and any implementation conforming to ASN.1
+        and the Basic Encoding Rules must  be  able  to
+        generate and recognize this value."
+     ::= { ipv6RouteEntry 13 }
+
+ ipv6RouteValid OBJECT-TYPE
+     SYNTAX     TruthValue
+     MAX-ACCESS read-write
+     STATUS     current
+     DESCRIPTION
+        "Setting this object to the value 'false(2)' has
+        the effect of invalidating the corresponding entry
+        in the ipv6RouteTable object.  That is, it
+        effectively disassociates the destination
+
+        identified with said entry from the route
+        identified with said entry.  It is an
+        implementation-specific matter as to whether the
+        agent removes an invalidated entry from the table.
+        Accordingly, management stations must be prepared
+        to receive tabular information from agents that
+        corresponds to entries not currently in use.
+        Proper interpretation of such entries requires
+        examination of the relevant ipv6RouteValid
+        object."
+     DEFVAL  { true }
+     ::= { ipv6RouteEntry 14 }
+
+ -- IPv6 Address Translation table
+
+ ipv6NetToMediaTable OBJECT-TYPE
+     SYNTAX      SEQUENCE OF Ipv6NetToMediaEntry
+     MAX-ACCESS  not-accessible
+     STATUS      current
+     DESCRIPTION
+       "The IPv6 Address Translation table used for
+       mapping from IPv6 addresses to physical addresses.
+
+       The IPv6 address translation table contain the
+       Ipv6Address to `physical' address equivalencies.
+       Some interfaces do not use translation tables
+       for determining address equivalencies; if all
+       interfaces are of this type, then the Address
+       Translation table is empty, i.e., has zero
+       entries."
+     ::= { ipv6MIBObjects 12 }
+
+ ipv6NetToMediaEntry OBJECT-TYPE
+     SYNTAX     Ipv6NetToMediaEntry
+     MAX-ACCESS not-accessible
+     STATUS     current
+     DESCRIPTION
+       "Each entry contains one IPv6 address to `physical'
+       address equivalence."
+     INDEX   { ipv6IfIndex,
+               ipv6NetToMediaNetAddress }
+     ::= { ipv6NetToMediaTable 1 }
+
+ Ipv6NetToMediaEntry ::= SEQUENCE {
+         ipv6NetToMediaNetAddress
+             Ipv6Address,
+         ipv6NetToMediaPhysAddress
+
+             PhysAddress,
+         ipv6NetToMediaType
+             INTEGER,
+         ipv6IfNetToMediaState
+             INTEGER,
+         ipv6IfNetToMediaLastUpdated
+             TimeStamp,
+         ipv6NetToMediaValid
+             TruthValue
+     }
+
+ ipv6NetToMediaNetAddress OBJECT-TYPE
+     SYNTAX     Ipv6Address
+     MAX-ACCESS not-accessible
+     STATUS     current
+     DESCRIPTION
+        "The IPv6 Address corresponding to
+        the media-dependent `physical' address."
+     ::= { ipv6NetToMediaEntry 1 }
+
+ ipv6NetToMediaPhysAddress OBJECT-TYPE
+     SYNTAX     PhysAddress
+     MAX-ACCESS read-only
+     STATUS     current
+     DESCRIPTION
+       "The media-dependent `physical' address."
+     ::= { ipv6NetToMediaEntry 2 }
+
+ ipv6NetToMediaType OBJECT-TYPE
+     SYNTAX     INTEGER {
+                 other(1),    -- none of the following
+                 dynamic(2),  -- dynamically resolved
+                 static(3),   -- statically configured
+                 local(4)     -- local interface
+                }
+     MAX-ACCESS read-only
+     STATUS     current
+     DESCRIPTION
+             "The type of the mapping. The 'dynamic(2)' type
+             indicates that the IPv6 address to physical
+             addresses mapping has been dynamically
+             resolved using the IPv6 Neighbor Discovery
+             protocol. The static(3)' types indicates that
+             the mapping has been statically configured.
+             The local(4) indicates that the mapping is
+             provided for an entity's own interface address."
+     ::= { ipv6NetToMediaEntry 3 }
+
+ipv6IfNetToMediaState OBJECT-TYPE
+    SYNTAX      INTEGER {
+             reachable(1), -- confirmed reachability
+
+             stale(2),     -- unconfirmed reachability
+
+             delay(3),     -- waiting for reachability
+                           -- confirmation before entering
+                           -- the probe state
+
+             probe(4),     -- actively probing
+
+             invalid(5),   -- an invalidated mapping
+
+             unknown(6)    -- state can not be determined
+                           -- for some reason.
+            }
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+        "The Neighbor Unreachability Detection [8] state
+        for the interface when the address mapping in
+        this entry is used."
+    ::= { ipv6NetToMediaEntry 4 }
+
+ipv6IfNetToMediaLastUpdated OBJECT-TYPE
+    SYNTAX      TimeStamp
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+        "The value of sysUpTime at the time this entry
+        was last updated.  If this entry was updated prior
+        to the last re-initialization of the local network
+        management subsystem, then this object contains
+        a zero value."
+    ::= { ipv6NetToMediaEntry 5 }
+
+ ipv6NetToMediaValid OBJECT-TYPE
+     SYNTAX     TruthValue
+     MAX-ACCESS read-write
+     STATUS     current
+     DESCRIPTION
+      "Setting this object to the value 'false(2)' has
+      the effect of invalidating the corresponding entry
+      in the ipv6NetToMediaTable.  That is, it effectively
+      disassociates the interface identified with said
+      entry from the mapping identified with said entry.
+      It is an implementation-specific matter as to
+
+      whether the agent removes an invalidated entry
+      from the table.  Accordingly, management stations
+      must be prepared to receive tabular information
+      from agents that corresponds to entries not
+      currently in use.  Proper interpretation of such
+      entries requires examination of the relevant
+      ipv6NetToMediaValid object."
+     DEFVAL  { true }
+     ::= { ipv6NetToMediaEntry 6 }
+
+-- definition of IPv6-related notifications.
+-- Note that we need ipv6NotificationPrefix with the 0
+-- sub-identifier to make this MIB to translate to
+-- an SNMPv1 format in a reversible way. For example
+-- it is needed for proxies that convert SNMPv1 traps
+-- to SNMPv2 notifications without MIB knowledge.
+
+ipv6Notifications      OBJECT IDENTIFIER
+     ::= { ipv6MIB 2 }
+ipv6NotificationPrefix OBJECT IDENTIFIER
+     ::= { ipv6Notifications 0 }
+
+ipv6IfStateChange NOTIFICATION-TYPE
+     OBJECTS {
+              ipv6IfDescr,
+              ipv6IfOperStatus -- the new state of the If.
+             }
+     STATUS             current
+     DESCRIPTION
+        "An ipv6IfStateChange notification signifies
+        that there has been a change in the state of
+        an ipv6 interface.  This notification should
+        be generated when the interface's operational
+        status transitions to or from the up(1) state."
+     ::= { ipv6NotificationPrefix 1 }
+
+-- conformance information
+
+ipv6Conformance OBJECT IDENTIFIER ::= { ipv6MIB 3 }
+
+ipv6Compliances OBJECT IDENTIFIER ::= { ipv6Conformance 1 }
+ipv6Groups      OBJECT IDENTIFIER ::= { ipv6Conformance 2 }
+
+-- compliance statements
+
+ipv6Compliance MODULE-COMPLIANCE
+    STATUS  current
+    DESCRIPTION
+      "The compliance statement for SNMPv2 entities which
+      implement ipv6 MIB."
+    MODULE  -- this module
+        MANDATORY-GROUPS { ipv6GeneralGroup,
+                           ipv6NotificationGroup }
+          OBJECT    ipv6Forwarding
+            MIN-ACCESS  read-only
+            DESCRIPTION
+               "An agent is not required to provide write
+                access to this object"
+          OBJECT    ipv6DefaultHopLimit
+            MIN-ACCESS  read-only
+            DESCRIPTION
+               "An agent is not required to provide write
+                access to this object"
+          OBJECT    ipv6IfDescr
+            MIN-ACCESS  read-only
+            DESCRIPTION
+               "An agent is not required to provide write
+                access to this object"
+          OBJECT    ipv6IfIdentifier
+            MIN-ACCESS  read-only
+            DESCRIPTION
+               "An agent is not required to provide write
+                access to this object"
+          OBJECT    ipv6IfIdentifierLength
+            MIN-ACCESS  read-only
+            DESCRIPTION
+               "An agent is not required to provide write
+                access to this object"
+
+          OBJECT    ipv6IfAdminStatus
+            MIN-ACCESS  read-only
+            DESCRIPTION
+               "An agent is not required to provide write
+                access to this object"
+          OBJECT    ipv6RouteValid
+            MIN-ACCESS  read-only
+            DESCRIPTION
+               "An agent is not required to provide write
+                access to this object"
+          OBJECT    ipv6NetToMediaValid
+            MIN-ACCESS  read-only
+            DESCRIPTION
+               "An agent is not required to provide write
+
+                access to this object"
+    ::= { ipv6Compliances 1 }
+
+ipv6GeneralGroup OBJECT-GROUP
+    OBJECTS { ipv6Forwarding,
+              ipv6DefaultHopLimit,
+              ipv6Interfaces,
+              ipv6IfTableLastChange,
+              ipv6IfDescr,
+              ipv6IfLowerLayer,
+              ipv6IfEffectiveMtu,
+              ipv6IfReasmMaxSize,
+              ipv6IfIdentifier,
+              ipv6IfIdentifierLength,
+              ipv6IfPhysicalAddress,
+              ipv6IfAdminStatus,
+              ipv6IfOperStatus,
+              ipv6IfLastChange,
+              ipv6IfStatsInReceives,
+              ipv6IfStatsInHdrErrors,
+              ipv6IfStatsInTooBigErrors,
+              ipv6IfStatsInNoRoutes,
+              ipv6IfStatsInAddrErrors,
+              ipv6IfStatsInUnknownProtos,
+              ipv6IfStatsInTruncatedPkts,
+              ipv6IfStatsInDiscards,
+              ipv6IfStatsInDelivers,
+              ipv6IfStatsOutForwDatagrams,
+              ipv6IfStatsOutRequests,
+              ipv6IfStatsOutDiscards,
+              ipv6IfStatsOutFragOKs,
+              ipv6IfStatsOutFragFails,
+              ipv6IfStatsOutFragCreates,
+              ipv6IfStatsReasmReqds,
+              ipv6IfStatsReasmOKs,
+              ipv6IfStatsReasmFails,
+              ipv6IfStatsInMcastPkts,
+              ipv6IfStatsOutMcastPkts,
+              ipv6AddrPrefixOnLinkFlag,
+              ipv6AddrPrefixAutonomousFlag,
+              ipv6AddrPrefixAdvPreferredLifetime,
+              ipv6AddrPrefixAdvValidLifetime,
+              ipv6AddrPfxLength,
+              ipv6AddrType,
+              ipv6AddrAnycastFlag,
+              ipv6AddrStatus,
+              ipv6RouteNumber,
+              ipv6DiscardedRoutes,
+              ipv6RouteIfIndex,
+              ipv6RouteNextHop,
+              ipv6RouteType,
+              ipv6RouteProtocol,
+              ipv6RoutePolicy,
+              ipv6RouteAge,
+              ipv6RouteNextHopRDI,
+              ipv6RouteMetric,
+              ipv6RouteWeight,
+              ipv6RouteInfo,
+              ipv6RouteValid,
+              ipv6NetToMediaPhysAddress,
+              ipv6NetToMediaType,
+              ipv6IfNetToMediaState,
+              ipv6IfNetToMediaLastUpdated,
+              ipv6NetToMediaValid }
+    STATUS    current
+    DESCRIPTION
+         "The IPv6 group of objects providing for basic
+          management of IPv6 entities."
+    ::= { ipv6Groups 1 }
+
+ipv6NotificationGroup NOTIFICATION-GROUP
+    NOTIFICATIONS { ipv6IfStateChange }
+    STATUS    current
+    DESCRIPTION
+         "The notification that an IPv6 entity is required
+          to implement."
+    ::= { ipv6Groups 2 }
+
+ END
diff -Naur tomato/release/src/router/snmp/mibs/IPV6-TCP-MIB.txt tomato121/release/src/router/snmp/mibs/IPV6-TCP-MIB.txt
--- tomato/release/src/router/snmp/mibs/IPV6-TCP-MIB.txt	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/mibs/IPV6-TCP-MIB.txt	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,211 @@
+IPV6-TCP-MIB DEFINITIONS ::= BEGIN
+
+IMPORTS
+   MODULE-COMPLIANCE, OBJECT-GROUP      FROM SNMPv2-CONF
+   MODULE-IDENTITY, OBJECT-TYPE,
+   mib-2, experimental                  FROM SNMPv2-SMI
+   Ipv6Address, Ipv6IfIndexOrZero       FROM IPV6-TC;
+
+ipv6TcpMIB MODULE-IDENTITY
+   LAST-UPDATED "9801290000Z"
+   ORGANIZATION "IETF IPv6 MIB Working Group"
+   CONTACT-INFO
+        "       Mike Daniele
+
+                Postal: Compaq Computer Corporation
+                        110 Spitbrook Rd
+                        Nashua, NH 03062.
+                        US
+
+                Phone:  +1 603 884 1423
+                Email:  daniele@zk3.dec.com"
+   DESCRIPTION
+        "The MIB module for entities implementing TCP over IPv6."
+   ::= { experimental 86 }
+
+-- objects specific to TCP for IPv6
+
+tcp      OBJECT IDENTIFIER ::= { mib-2 6 }
+
+-- the TCP over IPv6 Connection table
+
+-- This connection table contains information about this
+-- entity's existing TCP connections between IPv6 endpoints.
+-- Only connections between IPv6 addresses are contained in
+-- this table.  This entity's connections between IPv4
+-- endpoints are contained in tcpConnTable.
+
+ipv6TcpConnTable OBJECT-TYPE
+   SYNTAX      SEQUENCE OF Ipv6TcpConnEntry
+   MAX-ACCESS  not-accessible
+   STATUS      current
+   DESCRIPTION
+        "A table containing TCP connection-specific information,
+         for only those connections whose endpoints are IPv6 addresses."
+   ::= { tcp 16 }
+
+ipv6TcpConnEntry OBJECT-TYPE
+   SYNTAX      Ipv6TcpConnEntry
+   MAX-ACCESS  not-accessible
+   STATUS      current
+   DESCRIPTION
+        "A conceptual row of the ipv6TcpConnTable containing
+         information about a particular current TCP connection.
+         Each row of this table is transient, in that it ceases to
+         exist when (or soon after) the connection makes the transition
+         to the CLOSED state.
+
+         Note that conceptual rows in this table require an additional
+         index object compared to tcpConnTable, since IPv6 addresses
+         are not guaranteed to be unique on the managed node."
+   INDEX   { ipv6TcpConnLocalAddress,
+             ipv6TcpConnLocalPort,
+             ipv6TcpConnRemAddress,
+             ipv6TcpConnRemPort,
+             ipv6TcpConnIfIndex }
+   ::= { ipv6TcpConnTable 1 }
+
+Ipv6TcpConnEntry ::=
+   SEQUENCE { ipv6TcpConnLocalAddress    Ipv6Address,
+              ipv6TcpConnLocalPort       INTEGER (0..65535),
+              ipv6TcpConnRemAddress      Ipv6Address,
+              ipv6TcpConnRemPort         INTEGER (0..65535),
+              ipv6TcpConnIfIndex         Ipv6IfIndexOrZero,
+              ipv6TcpConnState           INTEGER }
+
+ipv6TcpConnLocalAddress OBJECT-TYPE
+   SYNTAX     Ipv6Address
+   MAX-ACCESS not-accessible
+   STATUS     current
+   DESCRIPTION
+        "The local IPv6 address for this TCP connection. In
+         the case of a connection in the listen state which
+         is willing to accept connections for any IPv6
+         address associated with the managed node, the value
+         ::0 is used."
+   ::= { ipv6TcpConnEntry 1 }
+
+ipv6TcpConnLocalPort OBJECT-TYPE
+   SYNTAX     INTEGER (0..65535)
+   MAX-ACCESS not-accessible
+   STATUS     current
+   DESCRIPTION
+        "The local port number for this TCP connection."
+   ::= { ipv6TcpConnEntry 2 }
+
+ipv6TcpConnRemAddress OBJECT-TYPE
+   SYNTAX     Ipv6Address
+   MAX-ACCESS not-accessible
+   STATUS     current
+   DESCRIPTION
+        "The remote IPv6 address for this TCP connection."
+   ::= { ipv6TcpConnEntry 3 }
+
+ipv6TcpConnRemPort OBJECT-TYPE
+   SYNTAX     INTEGER (0..65535)
+   MAX-ACCESS not-accessible
+   STATUS     current
+   DESCRIPTION
+        "The remote port number for this TCP connection."
+   ::= { ipv6TcpConnEntry 4 }
+
+ipv6TcpConnIfIndex OBJECT-TYPE
+   SYNTAX     Ipv6IfIndexOrZero
+   MAX-ACCESS not-accessible
+   STATUS     current
+   DESCRIPTION
+        "An index object used to disambiguate conceptual rows in
+         the table, since the connection 4-tuple may not be unique.
+
+         If the connection's remote address (ipv6TcpConnRemAddress)
+         is a link-local address and the connection's local address
+
+         (ipv6TcpConnLocalAddress) is not a link-local address, this
+         object identifies a local interface on the same link as
+         the connection's remote link-local address.
+
+         Otherwise, this object identifies the local interface that
+         is associated with the ipv6TcpConnLocalAddress for this
+         TCP connection.  If such a local interface cannot be determined,
+         this object should take on the value 0.  (A possible example
+         of this would be if the value of ipv6TcpConnLocalAddress is ::0.)
+
+         The interface identified by a particular non-0 value of this
+         index is the same interface as identified by the same value
+         of ipv6IfIndex.
+
+         The value of this object must remain constant during the life
+         of the TCP connection."
+   ::= { ipv6TcpConnEntry 5 }
+
+ipv6TcpConnState OBJECT-TYPE
+   SYNTAX     INTEGER {
+        closed(1),
+        listen(2),
+        synSent(3),
+        synReceived(4),
+        established(5),
+        finWait1(6),
+        finWait2(7),
+        closeWait(8),
+        lastAck(9),
+        closing(10),
+        timeWait(11),
+        deleteTCB(12) }
+   MAX-ACCESS read-write
+   STATUS     current
+   DESCRIPTION
+        "The state of this TCP connection.
+
+         The only value which may be set by a management station is
+         deleteTCB(12).  Accordingly, it is appropriate for an agent
+         to return an error response (`badValue' for SNMPv1, 'wrongValue'
+         for SNMPv2) if a management station attempts to set this
+         object to any other value.
+
+         If a management station sets this object to the value
+         deleteTCB(12), then this has the effect of deleting the TCB
+         (as defined in RFC 793) of the corresponding connection on
+         the managed node, resulting in immediate termination of the
+         connection.
+
+         As an implementation-specific option, a RST segment may be
+         sent from the managed node to the other TCP endpoint (note
+         however that RST segments are not sent reliably)."
+   ::= { ipv6TcpConnEntry 6 }
+
+--
+-- conformance information
+--
+
+ipv6TcpConformance OBJECT IDENTIFIER ::= { ipv6TcpMIB 2 }
+
+ipv6TcpCompliances OBJECT IDENTIFIER ::= { ipv6TcpConformance 1 }
+ipv6TcpGroups      OBJECT IDENTIFIER ::= { ipv6TcpConformance 2 }
+
+-- compliance statements
+
+ipv6TcpCompliance MODULE-COMPLIANCE
+   STATUS  current
+   DESCRIPTION
+        "The compliance statement for SNMPv2 entities which
+         implement TCP over IPv6."
+   MODULE  -- this module
+   MANDATORY-GROUPS { ipv6TcpGroup }
+   ::= { ipv6TcpCompliances 1 }
+
+ipv6TcpGroup OBJECT-GROUP
+   OBJECTS   { -- these are defined in this module
+               -- ipv6TcpConnLocalAddress (not-accessible)
+               -- ipv6TcpConnLocalPort (not-accessible)
+               -- ipv6TcpConnRemAddress (not-accessible)
+               -- ipv6TcpConnRemPort (not-accessible)
+               -- ipv6TcpConnIfIndex (not-accessible)
+               ipv6TcpConnState }
+   STATUS    current
+   DESCRIPTION
+        "The group of objects providing management of
+         TCP over IPv6."
+   ::= { ipv6TcpGroups 1 }
+
+END
diff -Naur tomato/release/src/router/snmp/mibs/IPV6-TC.txt tomato121/release/src/router/snmp/mibs/IPV6-TC.txt
--- tomato/release/src/router/snmp/mibs/IPV6-TC.txt	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/mibs/IPV6-TC.txt	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,67 @@
+IPV6-TC DEFINITIONS ::= BEGIN
+
+IMPORTS
+     Integer32                FROM SNMPv2-SMI
+     TEXTUAL-CONVENTION       FROM SNMPv2-TC;
+
+-- definition of textual conventions
+Ipv6Address ::= TEXTUAL-CONVENTION
+     DISPLAY-HINT "2x:"
+     STATUS       current
+     DESCRIPTION
+       "This data type is used to model IPv6 addresses.
+        This is a binary string of 16 octets in network
+        byte-order."
+     SYNTAX       OCTET STRING (SIZE (16))
+
+Ipv6AddressPrefix ::= TEXTUAL-CONVENTION
+     DISPLAY-HINT "2x:"
+     STATUS       current
+     DESCRIPTION
+       "This data type is used to model IPv6 address
+       prefixes. This is a binary string of up to 16
+       octets in network byte-order."
+     SYNTAX       OCTET STRING (SIZE (0..16))
+
+Ipv6AddressIfIdentifier ::= TEXTUAL-CONVENTION
+     DISPLAY-HINT "2x:"
+     STATUS       current
+     DESCRIPTION
+       "This data type is used to model IPv6 address
+       interface identifiers. This is a binary string
+        of up to 8 octets in network byte-order."
+     SYNTAX      OCTET STRING (SIZE (0..8))
+
+Ipv6IfIndex ::= TEXTUAL-CONVENTION
+     DISPLAY-HINT "d"
+     STATUS       current
+     DESCRIPTION
+       "A unique value, greater than zero for each
+       internetwork-layer interface in the managed
+       system. It is recommended that values are assigned
+       contiguously starting from 1. The value for each
+       internetwork-layer interface must remain constant
+       at least from one re-initialization of the entity's
+       network management system to the next
+
+       re-initialization."
+     SYNTAX       Integer32 (1..2147483647)
+
+Ipv6IfIndexOrZero ::= TEXTUAL-CONVENTION
+     DISPLAY-HINT "d"
+     STATUS       current
+     DESCRIPTION
+         "This textual convention is an extension of the
+         Ipv6IfIndex convention.  The latter defines
+         a greater than zero value used to identify an IPv6
+         interface in the managed system.  This extension
+         permits the additional value of zero.  The value
+         zero is object-specific and must therefore be
+         defined as part of the description of any object
+         which uses this syntax.  Examples of the usage of
+         zero might include situations where interface was
+         unknown, or when none or all interfaces need to be
+         referenced."
+     SYNTAX       Integer32 (0..2147483647)
+
+END
diff -Naur tomato/release/src/router/snmp/mibs/IPV6-UDP-MIB.txt tomato121/release/src/router/snmp/mibs/IPV6-UDP-MIB.txt
--- tomato/release/src/router/snmp/mibs/IPV6-UDP-MIB.txt	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/mibs/IPV6-UDP-MIB.txt	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,141 @@
+IPV6-UDP-MIB DEFINITIONS ::= BEGIN
+
+IMPORTS
+   MODULE-COMPLIANCE, OBJECT-GROUP      FROM SNMPv2-CONF
+   MODULE-IDENTITY, OBJECT-TYPE,
+   mib-2, experimental                  FROM SNMPv2-SMI
+   Ipv6Address, Ipv6IfIndexOrZero       FROM IPV6-TC;
+
+ipv6UdpMIB MODULE-IDENTITY
+   LAST-UPDATED "9801290000Z"
+   ORGANIZATION "IETF IPv6 MIB Working Group"
+   CONTACT-INFO
+        "               Mike Daniele
+
+                Postal: Compaq Computer Corporation
+                        110 Spitbrook Rd
+                        Nashua, NH 03062.
+                        US
+
+                Phone:  +1 603 884 1423
+                Email:  daniele@zk3.dec.com"
+   DESCRIPTION
+        "The MIB module for entities implementing UDP over IPv6."
+   ::= { experimental 87 }
+
+-- objects specific to UDP for IPv6
+
+udp      OBJECT IDENTIFIER ::= { mib-2 7 }
+
+-- the UDP over IPv6 Listener table
+
+-- This table contains information about this entity's
+-- UDP/IPv6 endpoints.  Only endpoints utilizing IPv6 addresses
+-- are contained in this table.  This entity's UDP/IPv4 endpoints
+-- are contained in udpTable.
+
+ipv6UdpTable OBJECT-TYPE
+   SYNTAX      SEQUENCE OF Ipv6UdpEntry
+   MAX-ACCESS  not-accessible
+   STATUS      current
+   DESCRIPTION
+        "A table containing UDP listener information for
+         UDP/IPv6 endpoints."
+   ::= { udp 6 }
+
+ipv6UdpEntry OBJECT-TYPE
+   SYNTAX      Ipv6UdpEntry
+   MAX-ACCESS  not-accessible
+   STATUS      current
+   DESCRIPTION
+        "Information about a particular current UDP listener.
+
+         Note that conceptual rows in this table require an
+         additional index object compared to udpTable, since
+         IPv6 addresses are not guaranteed to be unique on the
+         managed node."
+   INDEX   { ipv6UdpLocalAddress,
+             ipv6UdpLocalPort,
+             ipv6UdpIfIndex }
+   ::= { ipv6UdpTable 1 }
+
+Ipv6UdpEntry ::= SEQUENCE {
+   ipv6UdpLocalAddress    Ipv6Address,
+   ipv6UdpLocalPort       INTEGER (0..65535),
+   ipv6UdpIfIndex         Ipv6IfIndexOrZero }
+
+ipv6UdpLocalAddress OBJECT-TYPE
+   SYNTAX       Ipv6Address
+   MAX-ACCESS   not-accessible
+   STATUS       current
+   DESCRIPTION
+        "The local IPv6 address for this UDP listener.
+         In the case of a UDP listener which is willing
+         to accept datagrams for any IPv6 address
+         associated with the managed node, the value ::0
+         is used."
+   ::= { ipv6UdpEntry 1 }
+
+ipv6UdpLocalPort OBJECT-TYPE
+    SYNTAX     INTEGER (0..65535)
+    MAX-ACCESS not-accessible
+    STATUS     current
+    DESCRIPTION
+        "The local port number for this UDP listener."
+    ::= { ipv6UdpEntry 2 }
+
+ipv6UdpIfIndex OBJECT-TYPE
+   SYNTAX     Ipv6IfIndexOrZero
+   MAX-ACCESS   read-only
+   STATUS     current
+   DESCRIPTION
+        "An index object used to disambiguate conceptual rows in
+         the table, since the ipv6UdpLocalAddress/ipv6UdpLocalPort
+         pair may not be unique.
+
+         This object identifies the local interface that is
+         associated with ipv6UdpLocalAddress for this UDP listener.
+         If such a local interface cannot be determined, this object
+         should take on the value 0.  (A possible example of this
+         would be if the value of ipv6UdpLocalAddress is ::0.)
+
+         The interface identified by a particular non-0 value of
+         this index is the same interface as identified by the same
+         value of ipv6IfIndex.
+
+         The value of this object must remain constant during
+         the life of this UDP endpoint."
+   ::= { ipv6UdpEntry 3 }
+
+--
+-- conformance information
+--
+
+ipv6UdpConformance OBJECT IDENTIFIER ::= { ipv6UdpMIB 2 }
+
+ipv6UdpCompliances OBJECT IDENTIFIER ::= { ipv6UdpConformance 1 }
+ipv6UdpGroups      OBJECT IDENTIFIER ::= { ipv6UdpConformance 2 }
+
+-- compliance statements
+
+ipv6UdpCompliance MODULE-COMPLIANCE
+   STATUS  current
+   DESCRIPTION
+        "The compliance statement for SNMPv2 entities which
+         implement UDP over IPv6."
+   MODULE  -- this module
+   MANDATORY-GROUPS { ipv6UdpGroup }
+   ::= { ipv6UdpCompliances 1 }
+
+ipv6UdpGroup OBJECT-GROUP
+   OBJECTS   { -- these are defined in this module
+               -- ipv6UdpLocalAddress (not-accessible)
+               -- ipv6UdpLocalPort (not-accessible)
+               ipv6UdpIfIndex }
+   STATUS    current
+   DESCRIPTION
+        "The group of objects providing management of
+         UDP over IPv6."
+   ::= { ipv6UdpGroups 1 }
+
+END
diff -Naur tomato/release/src/router/snmp/mibs/LM-SENSORS-MIB.txt tomato121/release/src/router/snmp/mibs/LM-SENSORS-MIB.txt
--- tomato/release/src/router/snmp/mibs/LM-SENSORS-MIB.txt	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/mibs/LM-SENSORS-MIB.txt	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,230 @@
+LM-SENSORS-MIB DEFINITIONS ::= BEGIN
+
+--
+-- Derived from the original VEST-INTERNETT-MIB. Open issues:
+--
+-- (a) where to register this MIB?
+-- (b) use not-accessible for diskIOIndex?
+--
+
+
+IMPORTS
+    MODULE-IDENTITY, OBJECT-TYPE, Integer32, Gauge32
+        FROM SNMPv2-SMI
+    DisplayString
+        FROM SNMPv2-TC
+    ucdExperimental
+        FROM UCD-SNMP-MIB;
+
+lmSensorsMIB MODULE-IDENTITY
+    LAST-UPDATED "200011050000Z"
+    ORGANIZATION "AdamsNames Ltd"
+    CONTACT-INFO    
+        "Primary Contact: M J Oldfield
+         email:     m@mail.tc"
+    DESCRIPTION
+        "This MIB module defines objects for lm_sensor derived data."
+    REVISION     "200011050000Z"
+    DESCRIPTION
+        "Derived from DISKIO-MIB ex UCD."
+    ::= { lmSensors 1 }
+
+lmSensors      OBJECT IDENTIFIER ::= { ucdExperimental 16 }
+
+--
+
+lmTempSensorsTable OBJECT-TYPE
+    SYNTAX      SEQUENCE OF LMTempSensorsEntry
+    MAX-ACCESS  not-accessible
+    STATUS      current
+    DESCRIPTION
+        "Table of temperature sensors and their values."
+    ::= { lmSensors 2 }
+
+lmTempSensorsEntry OBJECT-TYPE
+    SYNTAX      LMTempSensorsEntry
+    MAX-ACCESS  not-accessible
+    STATUS      current
+    DESCRIPTION
+        "An entry containing a device and its statistics."
+    INDEX       { lmTempSensorsIndex }
+    ::= { lmTempSensorsTable 1 }
+
+LMTempSensorsEntry ::= SEQUENCE {
+    lmTempSensorsIndex    Integer32,
+    lmTempSensorsDevice   DisplayString,
+    lmTempSensorsValue    Gauge32
+}
+
+lmTempSensorsIndex OBJECT-TYPE
+    SYNTAX      Integer32 (0..65535)
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+        "Reference index for each observed device."
+    ::= { lmTempSensorsEntry 1 }
+
+lmTempSensorsDevice OBJECT-TYPE
+    SYNTAX      DisplayString
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+        "The name of the temperature sensor we are reading."
+    ::= { lmTempSensorsEntry 2 }
+
+lmTempSensorsValue OBJECT-TYPE
+    SYNTAX      Gauge32
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+        "The temperature of this sensor in mC."
+    ::= { lmTempSensorsEntry 3 }
+--
+
+lmFanSensorsTable OBJECT-TYPE
+    SYNTAX      SEQUENCE OF LMFanSensorsEntry
+    MAX-ACCESS  not-accessible
+    STATUS      current
+    DESCRIPTION
+        "Table of fan sensors and their values."
+    ::= { lmSensors 3 }
+
+lmFanSensorsEntry OBJECT-TYPE
+    SYNTAX      LMFanSensorsEntry
+    MAX-ACCESS  not-accessible
+    STATUS      current
+    DESCRIPTION
+        "An entry containing a device and its statistics."
+    INDEX       { lmFanSensorsIndex }
+    ::= { lmFanSensorsTable 1 }
+
+LMFanSensorsEntry ::= SEQUENCE {
+    lmFanSensorsIndex    Integer32,
+    lmFanSensorsDevice   DisplayString,
+    lmFanSensorsValue    Gauge32
+}
+
+lmFanSensorsIndex OBJECT-TYPE
+    SYNTAX      Integer32 (0..65535)
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+        "Reference index for each observed device."
+    ::= { lmFanSensorsEntry 1 }
+
+lmFanSensorsDevice OBJECT-TYPE
+    SYNTAX      DisplayString
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+        "The name of the fan sensor we are reading."
+    ::= { lmFanSensorsEntry 2 }
+
+lmFanSensorsValue OBJECT-TYPE
+    SYNTAX      Gauge32
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+        "The rotation speed of the fan in RPM."
+    ::= { lmFanSensorsEntry 3 }
+
+--
+
+lmVoltSensorsTable OBJECT-TYPE
+    SYNTAX      SEQUENCE OF LMVoltSensorsEntry
+    MAX-ACCESS  not-accessible
+    STATUS      current
+    DESCRIPTION
+        "Table of voltage sensors and their values."
+    ::= { lmSensors 4 }
+
+lmVoltSensorsEntry OBJECT-TYPE
+    SYNTAX      LMVoltSensorsEntry
+    MAX-ACCESS  not-accessible
+    STATUS      current
+    DESCRIPTION
+        "An entry containing a device and its statistics."
+    INDEX       { lmVoltSensorsIndex }
+    ::= { lmVoltSensorsTable 1 }
+
+LMVoltSensorsEntry ::= SEQUENCE {
+    lmVoltSensorsIndex    Integer32,
+    lmVoltSensorsDevice   DisplayString,
+    lmVoltSensorsValue    Gauge32
+}
+
+lmVoltSensorsIndex OBJECT-TYPE
+    SYNTAX      Integer32 (0..65535)
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+        "Reference index for each observed device."
+    ::= { lmVoltSensorsEntry 1 }
+
+lmVoltSensorsDevice OBJECT-TYPE
+    SYNTAX      DisplayString
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+        "The name of the device we are reading."
+    ::= { lmVoltSensorsEntry 2 }
+
+lmVoltSensorsValue OBJECT-TYPE
+    SYNTAX      Gauge32
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+        "The voltage in mV."
+    ::= { lmVoltSensorsEntry 3 }
+
+--
+
+lmMiscSensorsTable OBJECT-TYPE
+    SYNTAX      SEQUENCE OF LMMiscSensorsEntry
+    MAX-ACCESS  not-accessible
+    STATUS      current
+    DESCRIPTION
+        "Table of miscellaneous sensor devices and their values."
+    ::= { lmSensors 5 }
+
+lmMiscSensorsEntry OBJECT-TYPE
+    SYNTAX      LMMiscSensorsEntry
+    MAX-ACCESS  not-accessible
+    STATUS      current
+    DESCRIPTION
+        "An entry containing a device and its statistics."
+    INDEX       { lmMiscSensorsIndex }
+    ::= { lmMiscSensorsTable 1 }
+
+LMMiscSensorsEntry ::= SEQUENCE {
+    lmMiscSensorsIndex    Integer32,
+    lmMiscSensorsDevice   DisplayString,
+    lmMiscSensorsValue    Gauge32
+}
+
+lmMiscSensorsIndex OBJECT-TYPE
+    SYNTAX      Integer32 (0..65535)
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+        "Reference index for each observed device."
+    ::= { lmMiscSensorsEntry 1 }
+
+lmMiscSensorsDevice OBJECT-TYPE
+    SYNTAX      DisplayString
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+        "The name of the device we are reading."
+    ::= { lmMiscSensorsEntry 2 }
+
+lmMiscSensorsValue OBJECT-TYPE
+    SYNTAX      Gauge32
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+        "The value of this sensor."
+    ::= { lmMiscSensorsEntry 3 }
+
+
+END
diff -Naur tomato/release/src/router/snmp/mibs/Makefile.in tomato121/release/src/router/snmp/mibs/Makefile.in
--- tomato/release/src/router/snmp/mibs/Makefile.in	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/mibs/Makefile.in	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,60 @@
+#
+# Makefile to install mib files.
+#
+
+top_builddir=..
+
+#
+# Stuff here
+#
+OTHERINSTALL=mibsinstall
+
+
+V1MIBS	= RFC1155-SMI.txt RFC1213-MIB.txt RFC-1215.txt
+
+V2MIBS = SNMPv2-CONF.txt SNMPv2-SMI.txt SNMPv2-TC.txt SNMPv2-TM.txt \
+	SNMPv2-MIB.txt
+
+V3MIBS	= SNMP-FRAMEWORK-MIB.txt SNMP-MPD-MIB.txt SNMP-TARGET-MIB.txt \
+	SNMP-NOTIFICATION-MIB.txt SNMP-PROXY-MIB.txt \
+	SNMP-USER-BASED-SM-MIB.txt SNMP-VIEW-BASED-ACM-MIB.txt \
+	SNMP-COMMUNITY-MIB.txt
+
+AGENTMIBS = AGENTX-MIB.txt SMUX-MIB.txt
+
+IANAMIBS = IANAifType-MIB.txt IANA-LANGUAGE-MIB.txt \
+	IANA-ADDRESS-FAMILY-NUMBERS-MIB.txt
+
+RFCMIBS	= IF-MIB.txt IF-INVERTED-STACK-MIB.txt \
+	EtherLike-MIB.txt \
+	IP-MIB.txt IP-FORWARD-MIB.txt TCP-MIB.txt UDP-MIB.txt \
+	INET-ADDRESS-MIB.txt HCNUM-TC.txt \
+	HOST-RESOURCES-MIB.txt HOST-RESOURCES-TYPES.txt \
+	RMON-MIB.txt \
+	IPV6-TC.txt IPV6-MIB.txt IPV6-ICMP-MIB.txt IPV6-TCP-MIB.txt \
+	IPV6-UDP-MIB.txt \
+	DISMAN-SCRIPT-MIB.txt DISMAN-SCHEDULE-MIB.txt \
+	NOTIFICATION-LOG-MIB.txt
+
+NETSNMPMIBS = NET-SNMP-TC.txt NET-SNMP-MIB.txt NET-SNMP-AGENT-MIB.txt \
+	NET-SNMP-EXAMPLES-MIB.txt
+
+UCDMIBS = UCD-SNMP-MIB.txt UCD-DEMO-MIB.txt UCD-IPFWACC-MIB.txt \
+	UCD-DLMOD-MIB.txt UCD-DISKIO-MIB.txt
+
+DEFAULTMIBS = @default_mibs_install@
+
+MIBS	= $(V1MIBS) $(V2MIBS) $(V3MIBS) $(RFCMIBS) \
+	$(AGENTMIBS) $(IANAMIBS) \
+	$(NETSNMPMIBS) $(UCDMIBS) $(DEFAULTMIBS)
+
+all: standardall
+
+mibsinstall: installdirs
+	@for i in $(MIBS) ; do \
+		$(INSTALL_DATA) $(srcdir)/$$i $(mibdir) ; \
+		echo "install: installed $$i in $(mibdir)" ; \
+	done
+
+installdirs:
+	@$(SHELL) $(srcdir)/../mkinstalldirs $(mibdir)
diff -Naur tomato/release/src/router/snmp/mibs/Makefile.mib tomato121/release/src/router/snmp/mibs/Makefile.mib
--- tomato/release/src/router/snmp/mibs/Makefile.mib	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/mibs/Makefile.mib	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,165 @@
+RFCHOST =	ftp://ftp.nordu.net	# ftp.ietf.org
+RFCDIR =	rfc
+
+IANAHOST =	http://www.iana.org
+IANADIR =	assignments
+
+ALLDIR =	/usr/local/share/snmp/rfc.orig
+
+MIBS =	SNMPv2-TC.txt SNMPv2-TM.txt SNMPv2-SMI.txt SNMPv2-MIB.txt \
+	SNMPv2-CONF.txt HCNUM-TC.txt INET-ADDRESS-MIB.txt \
+	SNMP-FRAMEWORK-MIB.txt SNMP-MPD-MIB.txt SNMP-USER-BASED-SM-MIB.txt \
+	SNMP-VIEW-BASED-ACM-MIB.txt SNMP-COMMUNITY-MIB.txt \
+	SNMP-TARGET-MIB.txt SNMP-NOTIFICATION-MIB.txt SNMP-PROXY-MIB.txt \
+	AGENTX-MIB.txt SMUX-MIB.txt \
+	DISMAN-SCRIPT-MIB.txt  DISMAN-SCHEDULE-MIB.txt \
+	IANA-LANGUAGE-MIB.txt IANA-ADDRESS-FAMILY-NUMBERS-MIB.txt \
+	IF-MIB.txt IF-INVERTED-STACK-MIB.txt \
+	IP-MIB.txt IP-FORWARD-MIB.txt TCP-MIB.txt UDP-MIB.txt \
+	IANAifType-MIB.txt EtherLike-MIB.txt \
+	IPV6-TC.txt IPV6-MIB.txt IPV6-ICMP-MIB.txt \
+	IPV6-TCP-MIB.txt IPV6-UDP-MIB.txt \
+	HOST-RESOURCES-MIB.txt HOST-RESOURCES-TYPES.txt \
+	NETWORK-SERVICES-MIB.txt MTA-MIB.txt \
+	RMON-MIB.txt \
+	RFC1155-SMI.txt RFC1213-MIB.txt
+
+MIBDEPS = Makefile.mib mibfetch smistrip
+
+all:	$(MIBS)
+
+allmibs:	ianamibs rfcmibs
+
+clean:
+	rm $(MIBS)
+
+SNMP-FRAMEWORK-MIB.txt:	$(MIBDEPS)
+	./mibfetch $(RFCHOST) $(RFCDIR) 3411
+
+SNMP-MPD-MIB.txt:	$(MIBDEPS)
+	./mibfetch $(RFCHOST) $(RFCDIR) 3412 SNMP-MPD-MIB
+
+SNMP-TARGET-MIB.txt SNMP-NOTIFICATION-MIB.txt SNMP-PROXY-MIB.txt:	$(MIBDEPS)
+	./mibfetch $(RFCHOST) $(RFCDIR) 3413
+
+SNMP-USER-BASED-SM-MIB.txt:	$(MIBDEPS)
+	./mibfetch $(RFCHOST) $(RFCDIR) 3414 SNMP-USER-BASED-SM-MIB
+
+SNMP-VIEW-BASED-ACM-MIB.txt:	$(MIBDEPS)
+	./mibfetch $(RFCHOST) $(RFCDIR) 3415
+
+SNMP-COMMUNITY-MIB.txt:	$(MIBDEPS)
+	./mibfetch $(RFCHOST) $(RFCDIR) 2576
+
+SNMPv2-SMI.txt:	$(MIBDEPS)
+	./mibfetch $(RFCHOST) $(RFCDIR) 2578 SNMPv2-SMI
+
+SNMPv2-TC.txt:	$(MIBDEPS)
+	./mibfetch $(RFCHOST) $(RFCDIR) 2579
+
+SNMPv2-CONF.txt:	$(MIBDEPS)
+	./mibfetch $(RFCHOST) $(RFCDIR) 2580
+
+SNMPv2-TM.txt:	$(MIBDEPS)
+	./mibfetch $(RFCHOST) $(RFCDIR) 3417
+
+SNMPv2-MIB.txt:	$(MIBDEPS)
+	./mibfetch $(RFCHOST) $(RFCDIR) 3418
+
+AGENTX-MIB.txt:	$(MIBDEPS)
+	./mibfetch $(RFCHOST) $(RFCDIR) 2742
+
+SMUX-MIB.txt:	$(MIBDEPS)
+	./mibfetch $(RFCHOST) $(RFCDIR) 1227 SMUX-MIB
+
+DISMAN-SCHEDULE-MIB.txt:	$(MIBDEPS)
+	./mibfetch $(RFCHOST) $(RFCDIR) 3231
+
+DISMAN-SCRIPT-MIB.txt:	$(MIBDEPS)
+	./mibfetch $(RFCHOST) $(RFCDIR) 3165
+
+IF-MIB.txt:	$(MIBDEPS)
+	./mibfetch $(RFCHOST) $(RFCDIR) 2863
+
+IF-INVERTED-STACK-MIB.txt:	$(MIBDEPS)
+	./mibfetch $(RFCHOST) $(RFCDIR) 2864
+
+HCNUM-TC.txt:	$(MIBDEPS)
+	./mibfetch $(RFCHOST) $(RFCDIR) 2856
+
+INET-ADDRESS-MIB.txt:	$(MIBDEPS)
+	./mibfetch $(RFCHOST) $(RFCDIR) 3291
+
+EtherLike-MIB.txt:	$(MIBDEPS)
+	./mibfetch $(RFCHOST) $(RFCDIR) 2665
+
+IANAifType-MIB.txt:	$(MIBDEPS)
+	./mibfetch -x $(IANAHOST) $(IANADIR) ianaiftype-mib
+
+IANA-LANGUAGE-MIB.txt:	$(MIBDEPS)
+	./mibfetch -x $(IANAHOST) $(IANADIR) ianalanguage-mib
+
+IANA-ADDRESS-FAMILY-NUMBERS-MIB.txt:	$(MIBDEPS)
+	./mibfetch -x $(IANAHOST) $(IANADIR) ianaaddressfamilynumbers-mib
+
+IP-MIB.txt:	$(MIBDEPS)
+	./mibfetch $(RFCHOST) $(RFCDIR) 2011
+
+IP-FORWARD-MIB.txt:	$(MIBDEPS)
+	./mibfetch $(RFCHOST) $(RFCDIR) 2096
+
+TCP-MIB.txt:	$(MIBDEPS)
+	./mibfetch $(RFCHOST) $(RFCDIR) 2012
+
+UDP-MIB.txt:	$(MIBDEPS)
+	./mibfetch $(RFCHOST) $(RFCDIR) 2013
+
+IPV6-TC.txt IPV6-MIB.txt:	$(MIBDEPS)
+	./mibfetch $(RFCHOST) $(RFCDIR) 2465
+
+IPV6-ICMP-MIB.txt:	$(MIBDEPS)
+	./mibfetch $(RFCHOST) $(RFCDIR) 2466
+
+IPV6-TCP-MIB.txt:	$(MIBDEPS)
+	./mibfetch $(RFCHOST) $(RFCDIR) 2452
+
+IPV6-UDP-MIB.txt:	$(MIBDEPS)
+	./mibfetch $(RFCHOST) $(RFCDIR) 2454
+
+HOST-RESOURCES-MIB.txt HOST-RESOURCES-TYPES.txt:	$(MIBDEPS)
+	./mibfetch $(RFCHOST) $(RFCDIR) 2790
+
+RMON-MIB.txt:	$(MIBDEPS)
+	./mibfetch $(RFCHOST) $(RFCDIR) 2819
+
+NETWORK-SERVICES-MIB.txt:	$(MIBDEPS)
+	./mibfetch $(RFCHOST) $(RFCDIR) 2788
+
+MTA-MIB.txt:	$(MIBDEPS)
+	./mibfetch $(RFCHOST) $(RFCDIR) 2789
+
+RFC1155-SMI.txt:	$(MIBDEPS)
+	./mibfetch $(RFCHOST) $(RFCDIR) 1155
+
+RFC1213-MIB.txt:	$(MIBDEPS)
+	./mibfetch $(RFCHOST) $(RFCDIR) 1213
+
+ianamibs:	ianalist
+	[ -d $(ALLDIR) ] || mkdir $(ALLDIR)
+	cat ianalist | while read file mibs; \
+		do \
+		  if [ "$$file" != "#" ]; \
+		  then \
+		    ./mibfetch -d $(ALLDIR) -x $(IANAHOST) $(IANADIR) $$file $$mibs; \
+		  fi; \
+		done
+
+rfcmibs:	rfclist
+	[ -d $(ALLDIR) ] || mkdir $(ALLDIR)
+	cat rfclist | while read rfc mibs; \
+		do \
+		  if [ "$$rfc" != "#" ]; \
+		  then \
+		    ./mibfetch -d $(ALLDIR) $(RFCHOST) $(RFCDIR) $$rfc $$mibs; \
+		  fi; \
+		done
diff -Naur tomato/release/src/router/snmp/mibs/mibfetch tomato121/release/src/router/snmp/mibs/mibfetch
--- tomato/release/src/router/snmp/mibs/mibfetch	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/mibs/mibfetch	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,46 @@
+#!/bin/sh
+
+# Usage: mibfetch [ -d outdir ] host directory rfc [mibs]
+#
+# If "rfc" contains a "." it is expected to be a complete file name,
+# otherwise it is assumed to be just the rfc number.
+# If "mibs" is specified, it is a ":" separated list of mibs to extract,
+# otherwise all mibs are extracted.
+#
+# The script fetches the file from the givn directory on the given
+# host, and then runs the file through smistrip to extract the mibs.
+
+set -e
+
+if [ "$1" = "-d" ]; then
+  mdir="-d $2"; shift 2
+else
+  mdir=
+fi
+
+if [ "$1" = "-x" ]; then
+    exact=1; shift
+else
+    exact=0
+fi
+
+host=$1
+dir=$2
+rfc=$3
+
+if [ $exact = 0 -a `echo $rfc | sed 's/\.//'` = $rfc ]; then
+  file=rfc$rfc.txt
+else
+  file=$rfc
+fi
+
+if [ -n "$4" ]; then
+  mibs="-m $4"
+fi
+
+# ncftpget -FV ftp://$host/$dir/$file
+wget -O - -nv $host/$dir/$file | tr -d \\r > $file
+
+./smistrip -x .txt $mdir $mibs $file
+
+rm $file
diff -Naur tomato/release/src/router/snmp/mibs/MTA-MIB.txt tomato121/release/src/router/snmp/mibs/MTA-MIB.txt
--- tomato/release/src/router/snmp/mibs/MTA-MIB.txt	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/mibs/MTA-MIB.txt	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,1226 @@
+MTA-MIB DEFINITIONS ::= BEGIN
+
+IMPORTS
+   OBJECT-TYPE, Counter32, Gauge32, MODULE-IDENTITY, mib-2
+     FROM SNMPv2-SMI
+   TimeInterval
+     FROM SNMPv2-TC
+   MODULE-COMPLIANCE, OBJECT-GROUP
+     FROM SNMPv2-CONF
+   SnmpAdminString
+       FROM SNMP-FRAMEWORK-MIB
+   applIndex, URLString
+     FROM NETWORK-SERVICES-MIB;
+
+mta MODULE-IDENTITY
+   LAST-UPDATED "200003030000Z"
+   ORGANIZATION "IETF Mail and Directory Management Working Group"
+   CONTACT-INFO
+     "        Ned Freed
+
+      Postal: Innosoft International, Inc.
+              1050 Lakes Drive
+              West Covina, CA 91790
+              US
+
+      Tel: +1 626 919 3600
+      Fax: +1 626 919 3614
+
+      E-Mail: ned.freed@innosoft.com"
+   DESCRIPTION
+     "The MIB module describing Message Transfer Agents (MTAs)"
+   REVISION "200003030000Z"
+   DESCRIPTION
+     "This revision, published in RFC 2789, changes a number of
+      DisplayStrings to SnmpAdminStrings. Note that this change
+
+      is not strictly supported by SMIv2.  However, the alternative
+      of deprecating the old objects and defining new objects
+      would have a more adverse impact on backward compatibility
+      and interoperability, given the particular semantics of
+      these objects.  The defining reference for distinguished
+      names has also been updated from RFC 1779 to RFC 2253."
+   REVISION "199905120000Z"
+   DESCRIPTION
+     "This revision fixes a number of technical problems found in
+      previous versions: The conformance groups for different
+      versions of this MIB have been corrected, the recommendation
+      that an empty string be returned if the last operation was
+      successful has been removed from
+      mtaGroupInboundRejectionReason and
+      mtaGroupOutboundConnectFailureReason as it conflicts
+      with the stated purpose of these variables, and the
+      required mtaStatusCode entry has been added to
+      MtaGroupErrorEntry.  It should be noted that this last
+      change in no way affects the bits on the wire."
+   REVISION "199708170000Z"
+   DESCRIPTION
+     "This revision, published in RFC 2249, adds the
+      mtaGroupDescription and mtaGroupURL fields, conversion
+      operation counters, a group hierarchy description mechanism,
+      counters for specific errors, oldest message IDs, per-MTA
+      and per-group loop counters, and a new table for tracking
+      any errors an MTA encounters."
+   REVISION "199311280000Z"
+   DESCRIPTION
+     "The original version of this MIB was published in RFC 1566"
+   ::= {mib-2 28}
+
+mtaTable OBJECT-TYPE
+   SYNTAX SEQUENCE OF MtaEntry
+   MAX-ACCESS not-accessible
+   STATUS current
+   DESCRIPTION
+     "The table holding information specific to an MTA."
+   ::= {mta 1}
+
+mtaEntry OBJECT-TYPE
+   SYNTAX MtaEntry
+   MAX-ACCESS not-accessible
+   STATUS current
+   DESCRIPTION
+     "The entry associated with each MTA."
+   INDEX {applIndex}
+   ::= {mtaTable 1}
+
+MtaEntry ::= SEQUENCE {
+   mtaReceivedMessages
+     Counter32,
+   mtaStoredMessages
+     Gauge32,
+   mtaTransmittedMessages
+     Counter32,
+   mtaReceivedVolume
+     Counter32,
+   mtaStoredVolume
+     Gauge32,
+   mtaTransmittedVolume
+     Counter32,
+   mtaReceivedRecipients
+     Counter32,
+   mtaStoredRecipients
+     Gauge32,
+   mtaTransmittedRecipients
+     Counter32,
+   mtaSuccessfulConvertedMessages
+     Counter32,
+   mtaFailedConvertedMessages
+     Counter32,
+   mtaLoopsDetected
+     Counter32
+}
+
+mtaReceivedMessages OBJECT-TYPE
+   SYNTAX Counter32
+   MAX-ACCESS read-only
+   STATUS current
+   DESCRIPTION
+     "The number of messages received since MTA initialization.
+      This includes messages transmitted to this MTA from other
+      MTAs as well as messages that have been submitted to the
+      MTA directly by end-users or applications."
+   ::= {mtaEntry 1}
+
+mtaStoredMessages OBJECT-TYPE
+   SYNTAX Gauge32
+   MAX-ACCESS read-only
+   STATUS current
+   DESCRIPTION
+     "The total number of messages currently stored in the MTA.
+      This includes messages that are awaiting transmission to
+      some other MTA or are waiting for delivery to an end-user
+      or application."
+   ::= {mtaEntry 2}
+
+mtaTransmittedMessages OBJECT-TYPE
+   SYNTAX Counter32
+   MAX-ACCESS read-only
+   STATUS current
+   DESCRIPTION
+     "The number of messages transmitted since MTA initialization.
+      This includes messages that were transmitted to some other
+      MTA or are waiting for delivery to an end-user or
+      application."
+   ::= {mtaEntry 3}
+
+mtaReceivedVolume OBJECT-TYPE
+   SYNTAX Counter32
+   UNITS "K-octets"
+   MAX-ACCESS read-only
+   STATUS current
+   DESCRIPTION
+     "The total volume of messages received since MTA
+      initialization, measured in kilo-octets.  This volume should
+      include all transferred data that is logically above the mail
+      transport protocol level.  For example, an SMTP-based MTA
+      should use the number of kilo-octets in the message header
+      and body, while an X.400-based MTA should use the number of
+      kilo-octets of P2 data.  This includes messages transmitted
+      to this MTA from other MTAs as well as messages that have
+      been submitted to the MTA directly by end-users or
+      applications."
+   ::= {mtaEntry 4}
+
+mtaStoredVolume OBJECT-TYPE
+   SYNTAX Gauge32
+   UNITS "K-octets"
+   MAX-ACCESS read-only
+   STATUS current
+   DESCRIPTION
+     "The total volume of messages currently stored in the MTA,
+      measured in kilo-octets.  This volume should include all
+      stored data that is logically above the mail transport
+      protocol level.  For example, an SMTP-based MTA should
+      use the number of kilo-octets in the message header and
+      body, while an X.400-based MTA would use the number of
+      kilo-octets of P2 data.  This includes messages that are
+      awaiting transmission to some other MTA or are waiting
+      for delivery to an end-user or application."
+   ::= {mtaEntry 5}
+
+mtaTransmittedVolume OBJECT-TYPE
+   SYNTAX Counter32
+   UNITS "K-octets"
+   MAX-ACCESS read-only
+   STATUS current
+   DESCRIPTION
+     "The total volume of messages transmitted since MTA
+      initialization, measured in kilo-octets.  This volume should
+      include all transferred data that is logically above the mail
+      transport protocol level.  For example, an SMTP-based MTA
+      should use the number of kilo-octets in the message header
+      and body, while an X.400-based MTA should use the number of
+      kilo-octets of P2 data.  This includes messages that were
+      transmitted to some other MTA or are waiting for delivery
+      to an end-user or application."
+   ::= {mtaEntry 6}
+
+mtaReceivedRecipients OBJECT-TYPE
+   SYNTAX Counter32
+   MAX-ACCESS read-only
+   STATUS current
+   DESCRIPTION
+     "The total number of recipients specified in all messages
+      received since MTA initialization.  Recipients this MTA
+      has no responsibility for, i.e. inactive envelope
+      recipients or ones referred to in message headers,
+      should not be counted even if information about such
+      recipients is available.  This includes messages
+      transmitted to this MTA from other MTAs as well as
+      messages that have been submitted to the MTA directly
+      by end-users or applications."
+   ::= {mtaEntry 7}
+
+mtaStoredRecipients OBJECT-TYPE
+   SYNTAX Gauge32
+   MAX-ACCESS read-only
+   STATUS current
+   DESCRIPTION
+     "The total number of recipients specified in all messages
+      currently stored in the MTA.  Recipients this MTA has no
+      responsibility for, i.e. inactive envelope recipients or
+      ones referred to in message headers, should not be
+      counted.  This includes messages that are awaiting
+      transmission to some other MTA or are waiting for
+      delivery to an end-user or application."
+   ::= {mtaEntry 8}
+
+mtaTransmittedRecipients OBJECT-TYPE
+   SYNTAX Counter32
+   MAX-ACCESS read-only
+   STATUS current
+   DESCRIPTION
+     "The total number of recipients specified in all messages
+      transmitted since MTA initialization.  Recipients this
+      MTA had no responsibility for, i.e. inactive envelope
+      recipients or ones referred to in message headers,
+      should not be counted.  This includes messages that were
+      transmitted to some other MTA or are waiting for
+      delivery to an end-user or application."
+   ::= {mtaEntry 9}
+
+mtaSuccessfulConvertedMessages OBJECT-TYPE
+   SYNTAX Counter32
+   MAX-ACCESS read-only
+   STATUS current
+   DESCRIPTION
+     "The number of messages that have been successfully
+      converted from one form to another since MTA
+      initialization."
+   ::= {mtaEntry 10}
+
+mtaFailedConvertedMessages OBJECT-TYPE
+   SYNTAX Counter32
+   MAX-ACCESS read-only
+   STATUS current
+   DESCRIPTION
+     "The number of messages for which an unsuccessful
+      attempt was made to convert them from one form to
+      another since MTA initialization."
+   ::= {mtaEntry 11}
+
+mtaLoopsDetected OBJECT-TYPE
+   SYNTAX Counter32
+   MAX-ACCESS read-only
+   STATUS current
+   DESCRIPTION
+     "A message loop is defined as a situation where the MTA
+      decides that a given message will never be delivered to
+      one or more recipients and instead will continue to
+      loop endlessly through one or more MTAs.  This variable
+      counts the number of times the MTA has detected such a
+      situation since MTA initialization. Note that the
+      mechanism MTAs use to detect loops (e.g., trace field
+      counting, count of references to this MTA in a trace
+      field, examination of DNS or other directory information,
+      etc.), the level at which loops are detected (e.g., per
+      message, per recipient, per directory entry, etc.), and
+      the handling of a loop once it is detected (e.g., looping
+
+      messages are held, looping messages are bounced or sent
+      to the postmaster, messages that the MTA knows will loop
+      won't be accepted, etc.) vary widely from one MTA to the
+      next and cannot be inferred from this variable."
+   ::= {mtaEntry 12}
+
+-- MTAs typically group inbound reception, queue storage, and
+-- outbound transmission in some way, rather than accounting for
+-- such operations only across the MTA as a whole. In the most
+-- extreme case separate information will be maintained for each
+-- different entity that receives messages and for each entity
+-- the MTA stores messages for and delivers messages to.  Other
+-- MTAs may elect to treat all reception equally, all queue
+-- storage equally, all deliveries equally, or some combination
+-- of this. Overlapped groupings are also possible, where an MTA
+-- decomposes its traffic in different ways for different
+-- purposes.
+
+-- In any case, a grouping abstraction is an extremely useful for
+-- breaking down the activities of an MTA. For purposes of
+-- labelling this will be called a "group" in this MIB.
+
+-- Each group contains all the variables needed to monitor all
+-- aspects of an MTA's operation.  However, the fact that all
+-- groups contain all possible variables does not imply that all
+-- groups must use all possible variables. For example, a single
+-- group might be used to monitor only one kind of event (inbound
+-- processing, outbound processing, or storage). In this sort of
+-- configuration any counters that are unused as a result of a
+-- given MTA's use of the group construct must be inaccessible;
+-- e.g., returning either a noSuchName error (for an SNMPv1 get),
+-- or a noSuchInstance exception (for an SNMPv2 get).
+
+-- Groups can be created at any time after MTA initialization. Once
+-- a group is created it should not be deleted or its mtaGroupIndex
+-- changed unless the MTA is reinitialized.
+
+-- Groups are not necessarily mutually exclusive. A given event may
+-- be recorded by more than one group, a message may be seen as
+-- stored by more than one group, and so on.  Groups should be all
+-- inclusive, however: if groups are implemented all aspects of an
+-- MTA's operation should be registered in at least one group.
+-- This freedom lets implementors use different sets of groups to
+-- provide different "views" of an MTA.
+
+-- The possibility of overlap between groups means that summing
+-- variables across groups may not produce values equal to those in
+-- the mtaTable. mtaTable should always provide accurate information
+
+-- about the MTA as a whole.
+
+-- The term "channel" is often used in MTA implementations; channels
+-- are usually, but not always, equivalent to a group. However,
+-- this MIB does not use the term "channel" because there is no
+-- requirement that an MTA supporting this MIB has to map its
+-- "channel" abstraction one-to-one onto the MIB's group abstraction.
+
+-- An MTA may create a group or group of groups at any time. Once
+-- created, however, an MTA cannot delete an entry for a group from
+-- the group table.  Deletion is only allowed when the MTA is
+-- reinitialized, and is not required even then.  This restriction
+-- is imposed so that monitoring agents can rely on group
+-- assignments being consistent across multiple query operations.
+
+-- Groups may be laid out so as to form a hierarchical arrangement,
+-- with some groups acting as subgroups for other groups.
+-- Alternately, disjoint groups of groups may be used to provide
+-- different sorts of "snapshots" of MTA operation.  The
+-- mtaGroupHierarchy variable provides an indication of how each
+-- group fits into the overall arrangement being used.
+
+-- Note that SNMP also defines and uses term "group". MTA groups are
+-- NOT the same as SNMP groups.
+
+mtaGroupTable OBJECT-TYPE
+    SYNTAX SEQUENCE OF MtaGroupEntry
+    MAX-ACCESS not-accessible
+    STATUS current
+    DESCRIPTION
+      "The table holding information specific to each MTA group."
+    ::= {mta 2}
+
+mtaGroupEntry OBJECT-TYPE
+    SYNTAX MtaGroupEntry
+    MAX-ACCESS not-accessible
+    STATUS current
+    DESCRIPTION
+      "The entry associated with each MTA group."
+    INDEX {applIndex, mtaGroupIndex}
+    ::= {mtaGroupTable 1}
+
+MtaGroupEntry ::= SEQUENCE {
+   mtaGroupIndex
+       INTEGER,
+   mtaGroupReceivedMessages
+       Counter32,
+   mtaGroupRejectedMessages
+
+       Counter32,
+   mtaGroupStoredMessages
+       Gauge32,
+   mtaGroupTransmittedMessages
+       Counter32,
+   mtaGroupReceivedVolume
+       Counter32,
+   mtaGroupStoredVolume
+       Gauge32,
+   mtaGroupTransmittedVolume
+       Counter32,
+   mtaGroupReceivedRecipients
+       Counter32,
+   mtaGroupStoredRecipients
+       Gauge32,
+   mtaGroupTransmittedRecipients
+       Counter32,
+   mtaGroupOldestMessageStored
+       TimeInterval,
+   mtaGroupInboundAssociations
+       Gauge32,
+   mtaGroupOutboundAssociations
+       Gauge32,
+   mtaGroupAccumulatedInboundAssociations
+       Counter32,
+   mtaGroupAccumulatedOutboundAssociations
+       Counter32,
+   mtaGroupLastInboundActivity
+       TimeInterval,
+   mtaGroupLastOutboundActivity
+       TimeInterval,
+   mtaGroupLastOutboundAssociationAttempt
+       TimeInterval,
+   mtaGroupRejectedInboundAssociations
+       Counter32,
+   mtaGroupFailedOutboundAssociations
+       Counter32,
+   mtaGroupInboundRejectionReason
+       SnmpAdminString,
+   mtaGroupOutboundConnectFailureReason
+       SnmpAdminString,
+   mtaGroupScheduledRetry
+       TimeInterval,
+   mtaGroupMailProtocol
+       OBJECT IDENTIFIER,
+   mtaGroupName
+       SnmpAdminString,
+   mtaGroupSuccessfulConvertedMessages
+
+       Counter32,
+   mtaGroupFailedConvertedMessages
+       Counter32,
+   mtaGroupDescription
+       SnmpAdminString,
+   mtaGroupURL
+       URLString,
+   mtaGroupCreationTime
+       TimeInterval,
+   mtaGroupHierarchy
+       INTEGER,
+   mtaGroupOldestMessageId
+       SnmpAdminString,
+   mtaGroupLoopsDetected
+       Counter32
+}
+
+mtaGroupIndex OBJECT-TYPE
+   SYNTAX INTEGER (1..2147483647)
+   MAX-ACCESS not-accessible
+   STATUS current
+   DESCRIPTION
+     "The index associated with a group for a given MTA."
+   ::= {mtaGroupEntry 1}
+
+mtaGroupReceivedMessages OBJECT-TYPE
+   SYNTAX Counter32
+   MAX-ACCESS read-only
+   STATUS current
+   DESCRIPTION
+     "The number of messages received to this group since
+      group creation."
+   ::= {mtaGroupEntry 2}
+
+mtaGroupRejectedMessages OBJECT-TYPE
+   SYNTAX Counter32
+   MAX-ACCESS read-only
+   STATUS current
+   DESCRIPTION
+     "The number of messages rejected by this group since
+      group creation."
+   ::= {mtaGroupEntry 3}
+
+mtaGroupStoredMessages OBJECT-TYPE
+   SYNTAX Gauge32
+   MAX-ACCESS read-only
+   STATUS current
+   DESCRIPTION
+     "The total number of messages currently stored in this
+      group's queue."
+   ::= {mtaGroupEntry 4}
+
+mtaGroupTransmittedMessages OBJECT-TYPE
+   SYNTAX Counter32
+   MAX-ACCESS read-only
+   STATUS current
+   DESCRIPTION
+     "The number of messages transmitted by this group since
+      group creation."
+   ::= {mtaGroupEntry 5}
+
+mtaGroupReceivedVolume OBJECT-TYPE
+   SYNTAX Counter32
+   UNITS "K-octets"
+   MAX-ACCESS read-only
+   STATUS current
+   DESCRIPTION
+     "The total volume of messages received to this group since
+      group creation, measured in kilo-octets.  This volume
+      should include all transferred data that is logically above
+      the mail transport protocol level.  For example, an
+      SMTP-based MTA should use the number of kilo-octets in the
+      message header and body, while an X.400-based MTA should use
+      the number of kilo-octets of P2 data."
+   ::= {mtaGroupEntry 6}
+
+mtaGroupStoredVolume OBJECT-TYPE
+   SYNTAX Gauge32
+   UNITS "K-octets"
+   MAX-ACCESS read-only
+   STATUS current
+   DESCRIPTION
+     "The total volume of messages currently stored in this
+      group's queue, measured in kilo-octets.  This volume should
+      include all stored data that is logically above the mail
+      transport protocol level.  For example, an SMTP-based
+      MTA should use the number of kilo-octets in the message
+      header and body, while an X.400-based MTA would use the
+      number of kilo-octets of P2 data."
+   ::= {mtaGroupEntry 7}
+
+mtaGroupTransmittedVolume OBJECT-TYPE
+   SYNTAX Counter32
+   UNITS "K-octets"
+   MAX-ACCESS read-only
+   STATUS current
+   DESCRIPTION
+     "The total volume of messages transmitted by this group
+      since group creation, measured in kilo-octets.  This
+      volume should include all transferred data that is logically
+      above the mail transport protocol level.  For example, an
+      SMTP-based MTA should use the number of kilo-octets in the
+      message header and body, while an X.400-based MTA should use
+      the number of kilo-octets of P2 data."
+   ::= {mtaGroupEntry 8}
+
+mtaGroupReceivedRecipients OBJECT-TYPE
+   SYNTAX Counter32
+   MAX-ACCESS read-only
+   STATUS current
+   DESCRIPTION
+     "The total number of recipients specified in all messages
+      received to this group since group creation.
+      Recipients this MTA has no responsibility for should not
+      be counted."
+   ::= {mtaGroupEntry 9}
+
+mtaGroupStoredRecipients OBJECT-TYPE
+   SYNTAX Gauge32
+   MAX-ACCESS read-only
+   STATUS current
+   DESCRIPTION
+     "The total number of recipients specified in all messages
+      currently stored in this group's queue.  Recipients this
+      MTA has no responsibility for should not be counted."
+   ::= {mtaGroupEntry 10}
+
+mtaGroupTransmittedRecipients OBJECT-TYPE
+   SYNTAX Counter32
+   MAX-ACCESS read-only
+   STATUS current
+   DESCRIPTION
+     "The total number of recipients specified in all messages
+      transmitted by this group since group creation.
+      Recipients this MTA had no responsibility for should not
+      be counted."
+   ::= {mtaGroupEntry 11}
+
+mtaGroupOldestMessageStored OBJECT-TYPE
+   SYNTAX TimeInterval
+   MAX-ACCESS read-only
+   STATUS current
+   DESCRIPTION
+     "Time since the oldest message in this group's queue was
+
+      placed in the queue."
+   ::= {mtaGroupEntry 12}
+
+mtaGroupInboundAssociations OBJECT-TYPE
+   SYNTAX Gauge32
+   MAX-ACCESS read-only
+   STATUS current
+   DESCRIPTION
+     "The number of current associations to the group, where the
+      group is the responder."
+   ::= {mtaGroupEntry 13}
+
+mtaGroupOutboundAssociations OBJECT-TYPE
+   SYNTAX Gauge32
+   MAX-ACCESS read-only
+   STATUS current
+   DESCRIPTION
+     "The number of current associations to the group, where the
+     group is the initiator."
+   ::= {mtaGroupEntry 14}
+
+mtaGroupAccumulatedInboundAssociations OBJECT-TYPE
+   SYNTAX Counter32
+   MAX-ACCESS read-only
+   STATUS current
+   DESCRIPTION
+     "The total number of associations to the group since
+     group creation, where the MTA was the responder."
+   ::= {mtaGroupEntry 15}
+
+mtaGroupAccumulatedOutboundAssociations OBJECT-TYPE
+   SYNTAX Counter32
+   MAX-ACCESS read-only
+   STATUS current
+   DESCRIPTION
+     "The total number of associations from the group since
+      group creation, where the MTA was the initiator."
+   ::= {mtaGroupEntry 16}
+
+mtaGroupLastInboundActivity OBJECT-TYPE
+   SYNTAX TimeInterval
+   MAX-ACCESS read-only
+   STATUS current
+   DESCRIPTION
+     "Time since the last time that this group had an active
+     inbound association for purposes of message reception."
+   ::= {mtaGroupEntry 17}
+
+mtaGroupLastOutboundActivity OBJECT-TYPE
+   SYNTAX TimeInterval
+   MAX-ACCESS read-only
+   STATUS current
+   DESCRIPTION
+     "Time since the last time that this group had a
+      successful outbound association for purposes of
+      message delivery."
+   ::= {mtaGroupEntry 18}
+
+mtaGroupLastOutboundAssociationAttempt OBJECT-TYPE
+   SYNTAX TimeInterval
+   MAX-ACCESS read-only
+   STATUS current
+   DESCRIPTION
+     "Time since the last time that this group attempted
+      to make an outbound association for purposes of
+      message delivery."
+   ::= {mtaGroupEntry 34}
+
+mtaGroupRejectedInboundAssociations OBJECT-TYPE
+   SYNTAX Counter32
+   MAX-ACCESS read-only
+   STATUS current
+   DESCRIPTION
+     "The total number of inbound associations the group has
+     rejected, since group creation.  Rejected associations
+     are not counted in the accumulated association totals."
+   ::= {mtaGroupEntry 19}
+
+mtaGroupFailedOutboundAssociations OBJECT-TYPE
+   SYNTAX Counter32
+   MAX-ACCESS read-only
+   STATUS current
+   DESCRIPTION
+     "The total number associations where the group was the
+     initiator and association establishment has failed,
+     since group creation.  Failed associations are
+     not counted in the accumulated association totals."
+   ::= {mtaGroupEntry 20}
+
+mtaGroupInboundRejectionReason OBJECT-TYPE
+   SYNTAX SnmpAdminString
+   MAX-ACCESS read-only
+   STATUS current
+   DESCRIPTION
+     "The failure reason, if any, for the last association this
+     group refused to respond to. If no association attempt
+
+     has been made since the MTA was initialized the value
+     should be 'never'."
+   ::= {mtaGroupEntry 21}
+
+mtaGroupOutboundConnectFailureReason OBJECT-TYPE
+   SYNTAX SnmpAdminString
+   MAX-ACCESS read-only
+   STATUS current
+   DESCRIPTION
+     "The failure reason, if any, for the last association attempt
+     this group initiated. If no association attempt has been
+     made since the MTA was initialized the value should be
+     'never'."
+   ::= {mtaGroupEntry 22}
+
+mtaGroupScheduledRetry OBJECT-TYPE
+   SYNTAX TimeInterval
+   MAX-ACCESS read-only
+   STATUS current
+   DESCRIPTION
+     "The amount of time until this group is next scheduled to
+      attempt to make an association."
+   ::= {mtaGroupEntry 23}
+
+mtaGroupMailProtocol OBJECT-TYPE
+   SYNTAX OBJECT IDENTIFIER
+   MAX-ACCESS read-only
+   STATUS current
+   DESCRIPTION
+     "An identification of the protocol being used by this group.
+      For an group employing OSI protocols, this will be the
+      Application Context.    For Internet applications, OID
+      values of the form {applTCPProtoID port} or {applUDPProtoID
+      port} are used for TCP-based and UDP-based protocols,
+      respectively. In either case 'port' corresponds to the
+      primary port number being used by the protocol. The
+      usual IANA procedures may be used to register ports for
+      new protocols. applTCPProtoID and applUDPProtoID are
+      defined in the NETWORK-SERVICES-MIB, RFC 2788."
+   ::= {mtaGroupEntry 24}
+
+mtaGroupName OBJECT-TYPE
+   SYNTAX SnmpAdminString
+   MAX-ACCESS read-only
+   STATUS current
+   DESCRIPTION
+     "A descriptive name for the group. If this group connects to
+      a single remote MTA this should be the name of that MTA. If
+
+      this in turn is an Internet MTA this should be the domain
+      name.  For an OSI MTA it should be the string encoded
+      distinguished name of the managed object using the format
+      defined in RFC 2253.  For X.400(1984) MTAs which do not
+      have a Distinguished Name, the RFC 2156 syntax
+      'mta in globalid' used in X400-Received: fields can be
+      used."
+   ::= {mtaGroupEntry 25}
+
+mtaGroupSuccessfulConvertedMessages OBJECT-TYPE
+   SYNTAX Counter32
+   MAX-ACCESS read-only
+   STATUS current
+   DESCRIPTION
+     "The number of messages that have been successfully
+      converted from one form to another in this group
+      since group creation."
+   ::= {mtaGroupEntry 26}
+
+mtaGroupFailedConvertedMessages OBJECT-TYPE
+   SYNTAX Counter32
+   MAX-ACCESS read-only
+   STATUS current
+   DESCRIPTION
+     "The number of messages for which an unsuccessful
+      attempt was made to convert them from one form to
+      another in this group since group creation."
+   ::= {mtaGroupEntry 27}
+
+mtaGroupDescription OBJECT-TYPE
+   SYNTAX SnmpAdminString
+   MAX-ACCESS read-only
+   STATUS current
+   DESCRIPTION
+     "A description of the group's purpose.  This information is
+      intended to identify the group in a status display."
+   ::= {mtaGroupEntry 28}
+
+mtaGroupURL OBJECT-TYPE
+   SYNTAX URLString
+   MAX-ACCESS read-only
+   STATUS current
+   DESCRIPTION
+     "A URL pointing to a description of the group.  This
+      information is intended to identify and briefly describe
+      the group in a status display."
+   ::= {mtaGroupEntry 29}
+
+mtaGroupCreationTime OBJECT-TYPE
+   SYNTAX TimeInterval
+   MAX-ACCESS read-only
+   STATUS current
+   DESCRIPTION
+     "Time since this group was first created."
+   ::= {mtaGroupEntry 30}
+
+mtaGroupHierarchy OBJECT-TYPE
+   SYNTAX INTEGER (-2147483648..2147483647)
+   MAX-ACCESS read-only
+   STATUS current
+   DESCRIPTION
+     "Describes how this group fits into the hierarchy. A
+      positive value is interpreted as an mtaGroupIndex
+      value for some other group whose variables include
+      those of this group (and usually others). A negative
+      value is interpreted as a group collection code: Groups
+      with common negative hierarchy values comprise one
+      particular breakdown of MTA activity as a whole. A
+      zero value means that this MIB implementation doesn't
+      implement hierarchy indicators and thus the overall
+      group hierarchy cannot be determined."
+   ::= {mtaGroupEntry 31}
+
+mtaGroupOldestMessageId OBJECT-TYPE
+   SYNTAX SnmpAdminString
+   MAX-ACCESS read-only
+   STATUS current
+   DESCRIPTION
+     "Message ID of the oldest message in the group's queue.
+      Whenever possible this should be in the form of an
+      RFC 822 msg-id; X.400 may convert X.400 message
+      identifiers to this form by following the rules laid
+      out in RFC2156."
+   ::= {mtaGroupEntry 32}
+
+mtaGroupLoopsDetected OBJECT-TYPE
+   SYNTAX Counter32
+   MAX-ACCESS read-only
+   STATUS current
+   DESCRIPTION
+     "A message loop is defined as a situation where the MTA
+      decides that a given message will never be delivered to
+      one or more recipients and instead will continue to
+      loop endlessly through one or more MTAs.  This variable
+      counts the number of times the MTA has detected such a
+      situation in conjunction with something associated with
+
+      this group since group creation.  Note that the
+      mechanism MTAs use to detect loops (e.g., trace field
+      counting, count of references to this MTA in a trace
+      field, examination of DNS or other directory information,
+      etc.), the level at which loops are detected (e.g., per
+      message, per recipient, per directory entry, etc.), and
+      the handling of a loop once it is detected (e.g., looping
+      messages are held, looping messages are bounced or sent
+      to the postmaster, messages that the MTA knows will loop
+      won't be accepted, etc.) vary widely from one MTA to the
+      next and cannot be inferred from this variable."
+   ::= {mtaGroupEntry 33}
+
+-- The mtaGroupAssociationTable provides a means of correlating
+-- entries in the network services association table with the
+-- MTA group responsible for the association.
+
+mtaGroupAssociationTable OBJECT-TYPE
+   SYNTAX SEQUENCE OF MtaGroupAssociationEntry
+   MAX-ACCESS not-accessible
+   STATUS current
+   DESCRIPTION
+     "The table holding information regarding the associations
+      for each MTA group."
+   ::= {mta 3}
+
+mtaGroupAssociationEntry OBJECT-TYPE
+   SYNTAX MtaGroupAssociationEntry
+   MAX-ACCESS not-accessible
+   STATUS current
+   DESCRIPTION
+     "The entry holding information regarding the associations
+      for each MTA group."
+   INDEX {applIndex, mtaGroupIndex, mtaGroupAssociationIndex}
+   ::= {mtaGroupAssociationTable 1}
+
+MtaGroupAssociationEntry ::= SEQUENCE {
+   mtaGroupAssociationIndex
+       INTEGER
+}
+
+mtaGroupAssociationIndex OBJECT-TYPE
+   SYNTAX INTEGER (1..2147483647)
+   MAX-ACCESS read-only
+   STATUS current
+   DESCRIPTION
+     "Reference into association table to allow correlation of
+      this group's active associations with the association table."
+   ::= {mtaGroupAssociationEntry 1}
+
+-- The mtaGroupErrorTable gives each group a way of tallying
+-- the specific errors it has encountered.  The mechanism
+-- defined here uses RFC 1893 status codes to identify
+-- various specific errors.  There are also classes for generic
+-- errors of various sorts, and the entire mechanism is also
+-- extensible, in that new error codes can be defined at any
+-- time.
+
+mtaGroupErrorTable OBJECT-TYPE
+   SYNTAX SEQUENCE OF MtaGroupErrorEntry
+   MAX-ACCESS not-accessible
+   STATUS current
+   DESCRIPTION
+     "The table holding information regarding accumulated errors
+      for each MTA group."
+   ::= {mta 5}
+
+mtaGroupErrorEntry OBJECT-TYPE
+   SYNTAX MtaGroupErrorEntry
+   MAX-ACCESS not-accessible
+   STATUS current
+   DESCRIPTION
+     "The entry holding information regarding accumulated
+      errors for each MTA group."
+   INDEX {applIndex, mtaGroupIndex, mtaStatusCode}
+   ::= {mtaGroupErrorTable 1}
+
+MtaGroupErrorEntry ::= SEQUENCE {
+   mtaStatusCode
+       INTEGER (4000000..5999999),
+   mtaGroupInboundErrorCount
+       Counter32,
+   mtaGroupInternalErrorCount
+       Counter32,
+   mtaGroupOutboundErrorCount
+       Counter32
+}
+
+mtaGroupInboundErrorCount OBJECT-TYPE
+   SYNTAX Counter32
+   MAX-ACCESS read-only
+   STATUS current
+   DESCRIPTION
+     "Count of the number of errors of a given type that have
+      been accumulated in association with a particular group
+      while processing incoming messages. In the case of SMTP
+
+      these will typically be errors reporting by an SMTP
+      server to the remote client; in the case of X.400
+      these will typically be errors encountered while
+      processing an incoming message."
+   ::= {mtaGroupErrorEntry 1}
+
+mtaGroupInternalErrorCount OBJECT-TYPE
+   SYNTAX Counter32
+   MAX-ACCESS read-only
+   STATUS current
+   DESCRIPTION
+     "Count of the number of errors of a given type that have
+      been accumulated in association with a particular group
+      during internal MTA processing."
+   ::= {mtaGroupErrorEntry 2}
+
+mtaGroupOutboundErrorCount OBJECT-TYPE
+   SYNTAX Counter32
+   MAX-ACCESS read-only
+   STATUS current
+   DESCRIPTION
+     "Count of the number of errors of a given type that have
+      been accumulated in association with a particular group's
+      outbound connection activities. In the case of an SMTP
+      client these will typically be errors reported while
+      attempting to contact or while communicating with the
+      remote SMTP server. In the case of X.400 these will
+      typically be errors encountered while constructing
+      or attempting to deliver an outgoing message."
+   ::= {mtaGroupErrorEntry 3}
+
+mtaStatusCode OBJECT-TYPE
+   SYNTAX INTEGER (4000000..5999999)
+   MAX-ACCESS not-accessible
+   STATUS current
+   DESCRIPTION
+     "An index capable of representing an Enhanced Mail System
+      Status Code.  Enhanced Mail System Status Codes are
+      defined in RFC 1893.  These codes have the form
+
+          class.subject.detail
+
+      Here 'class' is either 2, 4, or 5 and both 'subject' and
+      'detail'  are integers in the range 0..999. Given a status
+      code the corresponding index value is defined to be
+      ((class * 1000) + subject) * 1000 + detail.  Both SMTP
+      error response codes and X.400 reason and diagnostic codes
+      can be mapped into these codes, resulting in a namespace
+
+      capable of describing most error conditions a mail system
+      encounters in a generic yet detailed way."
+   ::= {mtaGroupErrorEntry 4}
+
+-- Conformance information
+
+mtaConformance OBJECT IDENTIFIER ::= {mta 4}
+
+mtaGroups      OBJECT IDENTIFIER ::= {mtaConformance 1}
+mtaCompliances OBJECT IDENTIFIER ::= {mtaConformance 2}
+
+-- Compliance statements
+
+mtaCompliance MODULE-COMPLIANCE
+   STATUS current
+   DESCRIPTION
+     "The compliance statement for RFC 1566 implementations
+      which support the Mail Monitoring MIB for basic
+      monitoring of MTAs."
+   MODULE  -- this module
+     MANDATORY-GROUPS {mtaRFC1566Group}
+   ::= {mtaCompliances 1}
+
+mtaAssocCompliance MODULE-COMPLIANCE
+   STATUS current
+   DESCRIPTION
+     "The compliance statement for RFC 1566 implementations
+      which support the Mail Monitoring MIB for monitoring
+      of MTAs and their associations."
+   MODULE  -- this module
+     MANDATORY-GROUPS {mtaRFC1566Group, mtaRFC1566AssocGroup}
+   ::= {mtaCompliances 2}
+
+mtaRFC2249Compliance MODULE-COMPLIANCE
+   STATUS current
+   DESCRIPTION
+     "The compliance statement for RFC 2249 implementations
+      which support the Mail Monitoring MIB for basic
+      monitoring of MTAs."
+   MODULE  -- this module
+     MANDATORY-GROUPS {mtaRFC2249Group}
+   ::= {mtaCompliances 5}
+
+mtaRFC2249AssocCompliance MODULE-COMPLIANCE
+   STATUS current
+   DESCRIPTION
+     "The compliance statement for RFC 2249 implementations
+
+      which support the Mail Monitoring MIB for monitoring of
+      MTAs and their associations."
+   MODULE  -- this module
+     MANDATORY-GROUPS {mtaRFC2249Group, mtaRFC2249AssocGroup}
+   ::= {mtaCompliances 6}
+
+mtaRFC2249ErrorCompliance MODULE-COMPLIANCE
+   STATUS current
+   DESCRIPTION
+     "The compliance statement for RFC 2249 implementations
+      which support the Mail Monitoring MIB for monitoring of
+      MTAs and detailed errors."
+   MODULE  -- this module
+     MANDATORY-GROUPS {mtaRFC2249Group, mtaRFC2249ErrorGroup}
+   ::= {mtaCompliances 7}
+
+mtaRFC2249FullCompliance MODULE-COMPLIANCE
+   STATUS current
+   DESCRIPTION
+     "The compliance statement for RFC 2249 implementations
+      which support the full Mail Monitoring MIB for
+      monitoring of MTAs, associations, and detailed errors."
+   MODULE  -- this module
+     MANDATORY-GROUPS {mtaRFC2249Group, mtaRFC2249AssocGroup,
+                       mtaRFC2249ErrorGroup}
+   ::= {mtaCompliances 8}
+
+mtaRFC2789Compliance MODULE-COMPLIANCE
+   STATUS current
+   DESCRIPTION
+     "The compliance statement for RFC 2789 implementations
+      which support the Mail Monitoring MIB for basic
+      monitoring of MTAs."
+   MODULE  -- this module
+     MANDATORY-GROUPS {mtaRFC2789Group}
+   ::= {mtaCompliances 9}
+
+mtaRFC2789AssocCompliance MODULE-COMPLIANCE
+   STATUS current
+   DESCRIPTION
+     "The compliance statement for RFC 2789 implementations
+      which support the Mail Monitoring MIB for monitoring of
+      MTAs and their associations."
+   MODULE  -- this module
+     MANDATORY-GROUPS {mtaRFC2789Group, mtaRFC2789AssocGroup}
+   ::= {mtaCompliances 10}
+
+mtaRFC2789ErrorCompliance MODULE-COMPLIANCE
+   STATUS current
+   DESCRIPTION
+     "The compliance statement for RFC 2789 implementations
+      which support the Mail Monitoring MIB for monitoring of
+      MTAs and detailed errors."
+   MODULE  -- this module
+     MANDATORY-GROUPS {mtaRFC2789Group, mtaRFC2789ErrorGroup}
+   ::= {mtaCompliances 11}
+
+mtaRFC2789FullCompliance MODULE-COMPLIANCE
+   STATUS current
+   DESCRIPTION
+     "The compliance statement for RFC 2789 implementations
+      which support the full Mail Monitoring MIB for
+      monitoring of MTAs, associations, and detailed errors."
+   MODULE  -- this module
+     MANDATORY-GROUPS {mtaRFC2789Group, mtaRFC2789AssocGroup,
+                       mtaRFC2789ErrorGroup}
+   ::= {mtaCompliances 12}
+
+-- Units of conformance
+
+mtaRFC1566Group OBJECT-GROUP
+   OBJECTS {
+     mtaReceivedMessages, mtaStoredMessages,
+     mtaTransmittedMessages, mtaReceivedVolume, mtaStoredVolume,
+     mtaTransmittedVolume, mtaReceivedRecipients,
+     mtaStoredRecipients, mtaTransmittedRecipients,
+     mtaGroupReceivedMessages, mtaGroupRejectedMessages,
+     mtaGroupStoredMessages, mtaGroupTransmittedMessages,
+     mtaGroupReceivedVolume, mtaGroupStoredVolume,
+     mtaGroupTransmittedVolume, mtaGroupReceivedRecipients,
+     mtaGroupStoredRecipients, mtaGroupTransmittedRecipients,
+     mtaGroupOldestMessageStored, mtaGroupInboundAssociations,
+     mtaGroupOutboundAssociations,
+     mtaGroupAccumulatedInboundAssociations,
+     mtaGroupAccumulatedOutboundAssociations,
+     mtaGroupLastInboundActivity, mtaGroupLastOutboundActivity,
+     mtaGroupRejectedInboundAssociations,
+     mtaGroupFailedOutboundAssociations,
+     mtaGroupInboundRejectionReason,
+     mtaGroupOutboundConnectFailureReason,
+     mtaGroupScheduledRetry, mtaGroupMailProtocol, mtaGroupName}
+   STATUS current
+   DESCRIPTION
+     "A collection of objects providing basic monitoring of MTAs.
+      This is the original set of such objects defined in RFC
+      1566."
+   ::= {mtaGroups 10}
+
+mtaRFC1566AssocGroup OBJECT-GROUP
+   OBJECTS {
+     mtaGroupAssociationIndex}
+   STATUS current
+   DESCRIPTION
+     "A collection of objects providing monitoring of MTA
+      associations.  This is the original set of such objects
+      defined in RFC 1566."
+   ::= {mtaGroups 11}
+
+mtaRFC2249Group OBJECT-GROUP
+   OBJECTS {
+     mtaReceivedMessages, mtaStoredMessages,
+     mtaTransmittedMessages, mtaReceivedVolume, mtaStoredVolume,
+     mtaTransmittedVolume, mtaReceivedRecipients,
+     mtaStoredRecipients, mtaTransmittedRecipients,
+     mtaSuccessfulConvertedMessages, mtaFailedConvertedMessages,
+     mtaGroupReceivedMessages, mtaGroupRejectedMessages,
+     mtaGroupStoredMessages, mtaGroupTransmittedMessages,
+     mtaGroupReceivedVolume, mtaGroupStoredVolume,
+     mtaGroupTransmittedVolume, mtaGroupReceivedRecipients,
+     mtaGroupStoredRecipients, mtaGroupTransmittedRecipients,
+     mtaGroupOldestMessageStored, mtaGroupInboundAssociations,
+     mtaGroupOutboundAssociations, mtaLoopsDetected,
+     mtaGroupAccumulatedInboundAssociations,
+     mtaGroupAccumulatedOutboundAssociations,
+     mtaGroupLastInboundActivity, mtaGroupLastOutboundActivity,
+     mtaGroupLastOutboundAssociationAttempt,
+     mtaGroupRejectedInboundAssociations,
+     mtaGroupFailedOutboundAssociations,
+     mtaGroupInboundRejectionReason,
+     mtaGroupOutboundConnectFailureReason,
+     mtaGroupScheduledRetry, mtaGroupMailProtocol, mtaGroupName,
+     mtaGroupSuccessfulConvertedMessages,
+     mtaGroupFailedConvertedMessages, mtaGroupDescription,
+     mtaGroupURL, mtaGroupCreationTime, mtaGroupHierarchy,
+     mtaGroupOldestMessageId, mtaGroupLoopsDetected}
+   STATUS current
+   DESCRIPTION
+     "A collection of objects providing basic monitoring of MTAs.
+      This group was originally defined in RFC 2249."
+   ::= {mtaGroups 4}
+
+mtaRFC2249AssocGroup OBJECT-GROUP
+   OBJECTS {
+     mtaGroupAssociationIndex}
+   STATUS current
+   DESCRIPTION
+     "A collection of objects providing monitoring of MTA
+      associations.  This group was originally defined in RFC
+      2249."
+   ::= {mtaGroups 5}
+
+mtaRFC2249ErrorGroup OBJECT-GROUP
+   OBJECTS {
+     mtaGroupInboundErrorCount, mtaGroupInternalErrorCount,
+     mtaGroupOutboundErrorCount}
+   STATUS current
+   DESCRIPTION
+     "A collection of objects providing monitoring of
+      detailed MTA errors.  This group was originally defined
+      in RFC 2249."
+   ::= {mtaGroups 6}
+
+mtaRFC2789Group OBJECT-GROUP
+   OBJECTS {
+     mtaReceivedMessages, mtaStoredMessages,
+     mtaTransmittedMessages, mtaReceivedVolume, mtaStoredVolume,
+     mtaTransmittedVolume, mtaReceivedRecipients,
+     mtaStoredRecipients, mtaTransmittedRecipients,
+     mtaSuccessfulConvertedMessages, mtaFailedConvertedMessages,
+     mtaGroupReceivedMessages, mtaGroupRejectedMessages,
+     mtaGroupStoredMessages, mtaGroupTransmittedMessages,
+     mtaGroupReceivedVolume, mtaGroupStoredVolume,
+     mtaGroupTransmittedVolume, mtaGroupReceivedRecipients,
+     mtaGroupStoredRecipients, mtaGroupTransmittedRecipients,
+     mtaGroupOldestMessageStored, mtaGroupInboundAssociations,
+     mtaGroupOutboundAssociations, mtaLoopsDetected,
+     mtaGroupAccumulatedInboundAssociations,
+     mtaGroupAccumulatedOutboundAssociations,
+     mtaGroupLastInboundActivity, mtaGroupLastOutboundActivity,
+     mtaGroupLastOutboundAssociationAttempt,
+     mtaGroupRejectedInboundAssociations,
+     mtaGroupFailedOutboundAssociations,
+     mtaGroupInboundRejectionReason,
+     mtaGroupOutboundConnectFailureReason,
+     mtaGroupScheduledRetry, mtaGroupMailProtocol, mtaGroupName,
+     mtaGroupSuccessfulConvertedMessages,
+     mtaGroupFailedConvertedMessages, mtaGroupDescription,
+     mtaGroupURL, mtaGroupCreationTime, mtaGroupHierarchy,
+     mtaGroupOldestMessageId, mtaGroupLoopsDetected}
+   STATUS current
+   DESCRIPTION
+     "A collection of objects providing basic monitoring of MTAs.
+
+      This is the appropriate group for RFC 2789."
+   ::= {mtaGroups 7}
+
+mtaRFC2789AssocGroup OBJECT-GROUP
+   OBJECTS {
+     mtaGroupAssociationIndex}
+   STATUS current
+   DESCRIPTION
+     "A collection of objects providing monitoring of MTA
+      associations.  This is the appropriate group for RFC
+      2789 association monitoring."
+   ::= {mtaGroups 8}
+
+mtaRFC2789ErrorGroup OBJECT-GROUP
+   OBJECTS {
+     mtaGroupInboundErrorCount, mtaGroupInternalErrorCount,
+     mtaGroupOutboundErrorCount}
+   STATUS current
+   DESCRIPTION
+     "A collection of objects providing monitoring of
+      detailed MTA errors.  This is the appropriate group
+      for RFC 2789 error monitoring."
+   ::= {mtaGroups 9}
+
+END
diff -Naur tomato/release/src/router/snmp/mibs/NET-SNMP-AGENT-MIB.txt tomato121/release/src/router/snmp/mibs/NET-SNMP-AGENT-MIB.txt
--- tomato/release/src/router/snmp/mibs/NET-SNMP-AGENT-MIB.txt	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/mibs/NET-SNMP-AGENT-MIB.txt	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,235 @@
+NET-SNMP-AGENT-MIB DEFINITIONS ::= BEGIN
+
+--
+-- Defines control and monitoring structures for the Net-SNMP agent.
+--
+
+IMPORTS
+    netSnmpObjects, netSnmpModuleIDs, netSnmpNotifications, netSnmpGroups
+	FROM NET-SNMP-MIB
+
+    OBJECT-TYPE, NOTIFICATION-TYPE, MODULE-IDENTITY, Integer32
+        FROM SNMPv2-SMI
+
+    OBJECT-GROUP, NOTIFICATION-GROUP
+	FROM SNMPv2-CONF
+
+    DisplayString FROM SNMPv2-TC;
+
+
+netSnmpAgentMIB MODULE-IDENTITY
+    LAST-UPDATED "200202090000Z"
+    ORGANIZATION "www.net-snmp.org"
+    CONTACT-INFO    
+	 "postal:   Wes Hardaker
+                    P.O. Box 382
+                    Davis CA  95617
+
+          email:    net-snmp-coders@lists.sourceforge.net"
+    DESCRIPTION
+	 "Defines control and monitoring structures for the Net-SNMP agent."
+    REVISION     "200202090000Z"
+    DESCRIPTION
+	"First revision."
+    ::= { netSnmpModuleIDs 2 }
+
+
+nsVersion              OBJECT IDENTIFIER ::= {netSnmpObjects 1}
+nsMibRegistry          OBJECT IDENTIFIER ::= {netSnmpObjects 2}
+nsExtensions           OBJECT IDENTIFIER ::= {netSnmpObjects 3}
+nsDLMod                OBJECT IDENTIFIER ::= {netSnmpObjects 4}
+nsCache                OBJECT IDENTIFIER ::= {netSnmpObjects 5}
+nsErrorHistory         OBJECT IDENTIFIER ::= {netSnmpObjects 6}
+nsConfiguration        OBJECT IDENTIFIER ::= {netSnmpObjects 7}
+nsTransactions         OBJECT IDENTIFIER ::= {netSnmpObjects 8}
+
+--
+--  Monitoring outstanding "transactions"
+--    (i.e. requests sent to AgentX subagents, or proxied agents)
+--
+
+nsTransactionTable OBJECT-TYPE
+    SYNTAX      SEQUENCE OF NsTransactionEntry
+    MAX-ACCESS  not-accessible
+    STATUS      current
+    DESCRIPTION
+	"Lists currently outstanding transactions in the net-snmp agent.
+	 This includes requests to AgentX subagents, or proxied SNMP agents."
+    ::= { nsTransactions 1 }
+
+nsTransactionEntry OBJECT-TYPE
+    SYNTAX      NsTransactionEntry
+    MAX-ACCESS  not-accessible
+    STATUS      current
+    DESCRIPTION
+	"A row describing a given transaction."
+    INDEX   { nsTransactionID }
+    ::= {nsTransactionTable 1 }
+
+NsTransactionEntry ::= SEQUENCE {
+    nsTransactionID   INTEGER,
+    nsTransactionMode Integer32
+}
+
+nsTransactionID OBJECT-TYPE
+    SYNTAX      INTEGER (0..4294967295)
+    MAX-ACCESS  not-accessible
+    STATUS      current
+    DESCRIPTION
+	"The internal identifier for a given transaction."
+    ::= { nsTransactionEntry 1 }
+
+nsTransactionMode OBJECT-TYPE
+    SYNTAX      Integer32
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+	"The mode number for the current operation being performed."
+    ::= { nsTransactionEntry 2 }
+
+
+--
+--  Monitoring the MIB modules currently registered in the agent
+--    (an updated version of UCD-SNMP-MIB::mrTable)
+--
+
+nsModuleTable OBJECT-TYPE
+    SYNTAX	SEQUENCE OF NsModuleEntry
+    MAX-ACCESS	not-accessible
+    STATUS	current
+    DESCRIPTION
+	"A table displaying all the oid's registered by mib modules in
+	 the agent.  Since the agent is modular in nature, this lists
+	 each module's OID it is responsible for and the name of the module"
+    ::= { nsMibRegistry 1 }
+
+nsModuleEntry OBJECT-TYPE
+    SYNTAX	NsModuleEntry
+    MAX-ACCESS	not-accessible
+    STATUS	current
+    DESCRIPTION
+        "An entry containing a registered mib oid."
+    INDEX       { nsmContextName, nsmRegistrationPoint, 
+                  nsmRegistrationPriority }
+    ::= { nsModuleTable 1 }
+
+NsModuleEntry ::= SEQUENCE {
+    nsmContextName          OCTET STRING,
+    nsmRegistrationPoint    OBJECT IDENTIFIER,
+    nsmRegistrationPriority INTEGER,
+    nsModuleName	    DisplayString,
+    nsModuleModes           BITS,
+    nsModuleTimeout         Integer32
+}
+
+nsmContextName OBJECT-TYPE
+    SYNTAX      OCTET STRING
+    MAX-ACCESS  not-accessible
+    STATUS      current
+    DESCRIPTION
+	"The context name the module is registered under."
+    ::= { nsModuleEntry 1 }
+
+nsmRegistrationPoint OBJECT-TYPE
+    SYNTAX	OBJECT IDENTIFIER
+    MAX-ACCESS	not-accessible
+    STATUS	current
+    DESCRIPTION
+	"The registry OID of a mib module."
+    ::= { nsModuleEntry  2 }
+
+nsmRegistrationPriority OBJECT-TYPE
+    SYNTAX	INTEGER
+    MAX-ACCESS	not-accessible
+    STATUS	current
+    DESCRIPTION
+	"The priority of the registered mib module."
+    ::= { nsModuleEntry  3 }
+
+nsModuleName OBJECT-TYPE
+    SYNTAX	DisplayString
+    MAX-ACCESS	read-only
+    STATUS	current
+    DESCRIPTION
+	"The module name that registered this OID."
+    ::= { nsModuleEntry  4 }
+
+nsModuleModes OBJECT-TYPE
+    SYNTAX	BITS { getAndGetNext(0), set(1), getBulk(2) }
+    MAX-ACCESS	read-only
+    STATUS	current
+    DESCRIPTION
+	"The modes that the particular lower level handler can cope
+  	 with directly."
+    ::= { nsModuleEntry  5 }
+
+nsModuleTimeout OBJECT-TYPE
+    SYNTAX	Integer32
+    MAX-ACCESS	read-only
+    STATUS	current
+    DESCRIPTION
+	"The registered timeout.  This is only meaningful for handlers
+	 that expect to return results at a later date (subagents,
+	 etc)"
+    ::= { nsModuleEntry  6 }
+
+
+--
+--  Notifications relating to the basic operation of the agent
+--
+
+nsNotifyStart        NOTIFICATION-TYPE
+    STATUS	current
+    DESCRIPTION
+	"An indication that the agent has started running."
+    ::= { netSnmpNotifications 1 }
+    
+nsNotifyShutdown     NOTIFICATION-TYPE
+    STATUS current
+    DESCRIPTION
+	"An indication that the agent is in the process of being shut down."
+    ::= { netSnmpNotifications 2 }
+
+nsNotifyRestart      NOTIFICATION-TYPE
+    STATUS	current
+    DESCRIPTION
+	"An indication that the agent has been restarted.
+	 This does not imply anything about whether the configuration has
+	 changed or not (unlike the standard coldStart or warmStart traps)"
+    ::= { netSnmpNotifications 3 }
+    
+
+--
+-- Conformance-related definitions
+--
+
+nsModuleGroup  OBJECT-GROUP
+    OBJECTS {
+        nsmContextName, nsmRegistrationPoint, nsmRegistrationPriority,
+        nsModuleName, nsModuleModes, nsModuleTimeout
+    }
+    STATUS	current
+    DESCRIPTION
+	"The objects relating to the list of MIB modules registered
+	 with the Net-SNMP agent."
+    ::= { netSnmpGroups 2 }
+
+nsTransctionGroup  OBJECT-GROUP
+    OBJECTS {
+        nsTransactionID, nsTransactionMode
+    }
+    STATUS	current
+    DESCRIPTION
+	"The objects relating to transaction monitoring in the Net-SNMP agent."
+    ::= { netSnmpGroups 8 }
+
+nsAgentNotifyGroup NOTIFICATION-GROUP
+    NOTIFICATIONS { nsNotifyStart, nsNotifyShutdown, nsNotifyRestart }
+    STATUS	current
+    DESCRIPTION
+	"The notifications relating to the basic operation of the Net-SNMP agent."
+    ::= { netSnmpGroups 9 }
+
+    
+
+END
diff -Naur tomato/release/src/router/snmp/mibs/NET-SNMP-EXAMPLES-MIB.txt tomato121/release/src/router/snmp/mibs/NET-SNMP-EXAMPLES-MIB.txt
--- tomato/release/src/router/snmp/mibs/NET-SNMP-EXAMPLES-MIB.txt	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/mibs/NET-SNMP-EXAMPLES-MIB.txt	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,152 @@
+NET-SNMP-EXAMPLES-MIB DEFINITIONS ::= BEGIN
+
+--
+-- Example MIB objects for agent module example implementations
+--
+
+IMPORTS
+    MODULE-IDENTITY, OBJECT-TYPE, Integer32 FROM SNMPv2-SMI
+    netSnmp                                 FROM NET-SNMP-MIB;
+
+netSnmpExamples MODULE-IDENTITY
+    LAST-UPDATED "200202060000Z"
+    ORGANIZATION "www.net-snmp.org"
+    CONTACT-INFO    
+	 "postal:   Wes Hardaker
+                    P.O. Box 382
+                    Davis CA  95617
+
+          email:    net-snmp-coders@lists.sourceforge.net"
+    DESCRIPTION
+	"Example MIB objects for agent module example implementations"
+    REVISION     "200202060000Z"
+    DESCRIPTION
+	"First draft"
+    ::= { netSnmp 2 }
+
+--
+-- top level structure
+--
+netSnmpExampleScalars       OBJECT IDENTIFIER ::= { netSnmpExamples 1 }
+netSnmpExampleTables        OBJECT IDENTIFIER ::= { netSnmpExamples 2 }
+netSnmpExampleNotifications OBJECT IDENTIFIER ::= { netSnmpExamples 3 }
+-- netSnmpTutorial          OBJECT IDENTIFIER ::= { netSnmpExamples 4 }
+
+--
+-- Example scalars
+--
+
+netSnmpExampleInteger OBJECT-TYPE
+    SYNTAX      Integer32
+    MAX-ACCESS  read-write
+    STATUS      current
+    DESCRIPTION
+	"This is a simple object which merely houses a writable
+	 integer.  It's only purposes is to hold the value of a single
+	 integer.  Writing to it will simply change the value for
+	 subsequent GET/GETNEXT/GETBULK retrievals.
+
+	 This example object is implemented in the
+	 agent/mibgroup/examples/scalar_int.c file."
+    DEFVAL { 42 }
+    ::= { netSnmpExampleScalars 1 }
+
+netSnmpExampleSleeper OBJECT-TYPE
+    SYNTAX      Integer32
+    MAX-ACCESS  read-write
+    STATUS      current
+    DESCRIPTION
+	"This is a simple object which is a basic integer.  It's value
+	 indicates the number of seconds that the agent will take in
+	 responding to requests of this object.  This is implemented
+	 in a way which will allow the agent to keep responding to
+	 other requests while access to this object is blocked.  It is
+	 writable, and changing it's value will change the amount of
+	 time the agent will effectively wait for before returning a
+	 response when this object is manipulated.  Note that SET
+	 requests through this object will take longer, since the
+	 delay is applied to each internal transaction phase, which
+	 could result in delays of up to 4 times the value of this
+	 object.
+
+	 This example object is implemented in the
+	 agent/mibgroup/examples/delayed_instance.c file."
+    DEFVAL { 1 }
+    ::= { netSnmpExampleScalars 2 }
+
+
+--
+--  Example Tables
+--
+
+netSnmpIETFWGTable OBJECT-TYPE
+    SYNTAX      SEQUENCE OF NetSnmpIETFWGEntry
+    MAX-ACCESS  not-accessible
+    STATUS      current
+    DESCRIPTION
+	"This table merely contains a set of data which is otherwise
+	 useless for true network management.  It is a table which
+	 describes properies about a IETF Working Group, such as the
+	 names of the two working group chairs.
+
+	 This example table is implemented in the
+	 agent/mibgroup/examples/data_set.c file."
+    ::= { netSnmpExampleTables 1 }
+
+netSnmpIETFWGEntry OBJECT-TYPE
+    SYNTAX      NetSnmpIETFWGEntry
+    MAX-ACCESS  not-accessible
+    STATUS      current
+    DESCRIPTION
+	"A rowm describing a given working group"
+    INDEX   { nsIETFWGName }
+    ::= {netSnmpIETFWGTable 1 }
+
+NetSnmpIETFWGEntry ::= SEQUENCE {
+	nsIETFWGName	OCTET STRING,
+	nsIETFWGChair1	OCTET STRING,
+	nsIETFWGChair2	OCTET STRING
+}
+
+nsIETFWGName OBJECT-TYPE
+    SYNTAX      OCTET STRING (SIZE(1..32))
+    MAX-ACCESS  not-accessible
+    STATUS      current
+    DESCRIPTION
+	"The name of the IETF Working Group this table describes."
+    ::= { netSnmpIETFWGEntry 1 }
+
+nsIETFWGChair1 OBJECT-TYPE
+    SYNTAX      OCTET STRING
+    MAX-ACCESS  read-create
+    STATUS      current
+    DESCRIPTION
+	"One of the names of the chairs for the IETF working group."
+    ::= { netSnmpIETFWGEntry 2 }
+
+nsIETFWGChair2 OBJECT-TYPE
+    SYNTAX      OCTET STRING
+    MAX-ACCESS  read-create
+    STATUS      current
+    DESCRIPTION
+	"The other name, if one exists, of the chairs for the IETF
+	working group."
+    ::= { netSnmpIETFWGEntry 3 }
+
+--
+--  Example Notifications
+--
+
+netSnmpExampleNotification OBJECT-TYPE
+    SYNTAX      SnmpAdminString
+    MAX-ACCESS  accessible-for-notify
+    STATUS      current
+    DESCRIPTION
+        "This is a boring example that is used in the
+         agent/mibgroup/examples/notification.c to send out a
+         notification every 30 seconds.  The actual notification means
+         nothing other than 30 seconds has elapsed since the last time
+         one was sent."
+::= { netSnmpExampleNotifications 1 }
+
+END
diff -Naur tomato/release/src/router/snmp/mibs/NET-SNMP-MIB.txt tomato121/release/src/router/snmp/mibs/NET-SNMP-MIB.txt
--- tomato/release/src/router/snmp/mibs/NET-SNMP-MIB.txt	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/mibs/NET-SNMP-MIB.txt	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,58 @@
+NET-SNMP-MIB DEFINITIONS ::= BEGIN
+
+--
+-- Top-level infrastructure of the Net-SNMP project enterprise MIB tree
+--
+
+IMPORTS
+    MODULE-IDENTITY, enterprises FROM SNMPv2-SMI;
+
+netSnmp MODULE-IDENTITY
+    LAST-UPDATED "200201300000Z"
+    ORGANIZATION "www.net-snmp.org"
+    CONTACT-INFO    
+	 "postal:   Wes Hardaker
+                    P.O. Box 382
+                    Davis CA  95617
+
+          email:    net-snmp-coders@lists.sourceforge.net"
+    DESCRIPTION
+	"Top-level infrastructure of the Net-SNMP project enterprise MIB tree"
+    REVISION     "200201300000Z"
+    DESCRIPTION
+	"First draft"
+    ::= { enterprises 8072}
+
+
+--
+--  Net-SNMP enterprise-specific management objects
+--
+
+netSnmpObjects              OBJECT IDENTIFIER ::= {netSnmp 1}
+-- netSnmpExamples             OBJECT IDENTIFIER ::= {netSnmp 2}
+netSnmpEnumerations         OBJECT IDENTIFIER ::= {netSnmp 3}
+netSnmpModuleIDs            OBJECT IDENTIFIER ::= {netSnmpEnumerations 1}
+netSnmpAgentOIDs            OBJECT IDENTIFIER ::= {netSnmpEnumerations 2}
+netSnmpDomains              OBJECT IDENTIFIER ::= {netSnmpEnumerations 3}
+netSnmpExperimental         OBJECT IDENTIFIER ::= {netSnmp 9999}
+
+
+--
+--  Notifications
+--
+
+netSnmpNotificationPrefix   OBJECT IDENTIFIER ::= {netSnmp 4}
+netSnmpNotifications        OBJECT IDENTIFIER ::= {netSnmpNotificationPrefix 0}
+netSnmpNotificationObjects  OBJECT IDENTIFIER ::= {netSnmpNotificationPrefix 1}
+
+
+--
+--  Conformance
+--     (No laughing at the back!)
+--
+
+netSnmpConformance          OBJECT IDENTIFIER ::= {netSnmp 5}
+netSnmpCompliances          OBJECT IDENTIFIER ::= {netSnmpConformance 1}
+netSnmpGroups               OBJECT IDENTIFIER ::= {netSnmpConformance 2}
+
+END
diff -Naur tomato/release/src/router/snmp/mibs/NET-SNMP-MONITOR-MIB.txt tomato121/release/src/router/snmp/mibs/NET-SNMP-MONITOR-MIB.txt
--- tomato/release/src/router/snmp/mibs/NET-SNMP-MONITOR-MIB.txt	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/mibs/NET-SNMP-MONITOR-MIB.txt	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,59 @@
+NET-SNMP-MONITOR-MIB DEFINITIONS ::= BEGIN
+
+--
+-- Configured elements of the system to monitor	(XXX - ugh! - need a better description!)
+--
+
+IMPORTS
+    netSnmpObjects, netSnmpModuleIDs FROM NET-SNMP-MIB
+
+    OBJECT-TYPE, NOTIFICATION-TYPE, MODULE-IDENTITY, Integer32
+        FROM SNMPv2-SMI
+
+    DisplayString FROM SNMPv2-TC;
+
+
+netSnmpMonitorMIB MODULE-IDENTITY
+    LAST-UPDATED "200202090000Z"
+    ORGANIZATION "www.net-snmp.org"
+    CONTACT-INFO    
+	 "postal:   Wes Hardaker
+                    P.O. Box 382
+                    Davis CA  95617
+
+          email:    net-snmp-coders@lists.sourceforge.net"
+    DESCRIPTION
+	"Configured elements of the system to monitor
+	 (XXX - ugh! - need a better description!)"
+    REVISION     "200202090000Z"
+    DESCRIPTION
+	"First revision."
+    ::= { netSnmpModuleIDs 3}
+
+
+nsProcess                   OBJECT IDENTIFIER ::= {netSnmpObjects 21}
+nsDisk                      OBJECT IDENTIFIER ::= {netSnmpObjects 22}
+nsFile                      OBJECT IDENTIFIER ::= {netSnmpObjects 23}
+nsLog                       OBJECT IDENTIFIER ::= {netSnmpObjects 24}
+
+--
+--  Process Monitoring
+--
+
+
+--
+--  Disk Monitoring
+--
+
+
+--
+--  File Monitoring
+--
+
+
+--
+--  Log Monitoring
+--
+
+
+END
diff -Naur tomato/release/src/router/snmp/mibs/NET-SNMP-SYSTEM-MIB.txt tomato121/release/src/router/snmp/mibs/NET-SNMP-SYSTEM-MIB.txt
--- tomato/release/src/router/snmp/mibs/NET-SNMP-SYSTEM-MIB.txt	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/mibs/NET-SNMP-SYSTEM-MIB.txt	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,63 @@
+NET-SNMP-SYSTEM-MIB DEFINITIONS ::= BEGIN
+
+--
+-- Characteristics of the current running system
+--
+
+IMPORTS
+    netSnmpObjects, netSnmpModuleIDs FROM NET-SNMP-MIB
+
+    Float FROM NET-SNMP-TC
+
+    OBJECT-TYPE, NOTIFICATION-TYPE, MODULE-IDENTITY, Integer32, Counter32
+        FROM SNMPv2-SMI
+
+    DisplayString FROM SNMPv2-TC;
+
+
+netSnmpSystemMIB MODULE-IDENTITY
+    LAST-UPDATED "200202090000Z"
+    ORGANIZATION "www.net-snmp.org"
+    CONTACT-INFO    
+	 "postal:   Wes Hardaker
+                    P.O. Box 382
+                    Davis CA  95617
+
+          email:    net-snmp-coders@lists.sourceforge.net"
+    DESCRIPTION
+	"Characteristics of the current running system"
+    REVISION     "200202090000Z"
+    DESCRIPTION
+	"First draft."
+    ::= { netSnmpModuleIDs 4}
+
+
+nsMemory                    OBJECT IDENTIFIER ::= {netSnmpObjects 31}
+nsSwap                      OBJECT IDENTIFIER ::= {netSnmpObjects 32}
+nsCPU                       OBJECT IDENTIFIER ::= {netSnmpObjects 33}
+nsLoad                      OBJECT IDENTIFIER ::= {netSnmpObjects 34}
+nsDiskIO                    OBJECT IDENTIFIER ::= {netSnmpObjects 35}
+
+
+--
+--  Memory
+--
+
+--
+--  Swap
+--
+
+--
+--  CPU Statistics
+--
+
+--
+--  Load Average
+--
+
+--
+--  Disk IO
+--
+
+
+END
diff -Naur tomato/release/src/router/snmp/mibs/NET-SNMP-TC.txt tomato121/release/src/router/snmp/mibs/NET-SNMP-TC.txt
--- tomato/release/src/router/snmp/mibs/NET-SNMP-TC.txt	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/mibs/NET-SNMP-TC.txt	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,121 @@
+NET-SNMP-TC DEFINITIONS ::= BEGIN
+
+--
+-- Textual conventions and enumerations for the Net-SNMP project
+--
+
+IMPORTS
+    netSnmpModuleIDs, netSnmpAgentOIDs, netSnmpDomains FROM NET-SNMP-MIB
+
+    MODULE-IDENTITY, Opaque FROM SNMPv2-SMI
+
+    TEXTUAL-CONVENTION FROM SNMPv2-TC;
+
+netSnmpTCs MODULE-IDENTITY
+    LAST-UPDATED "200202090000Z"
+    ORGANIZATION "www.net-snmp.org"
+    CONTACT-INFO    
+	 "postal:   Wes Hardaker
+                    P.O. Box 382
+                    Davis CA  95617
+
+          email:    net-snmp-coders@lists.sourceforge.net"
+    DESCRIPTION
+	"Textual conventions and enumerations for the Net-SNMP project"
+    REVISION     "200202120000Z"
+    DESCRIPTION
+	"First draft"
+    ::= { netSnmpModuleIDs 1}
+
+
+-- =====================
+--
+--  Textual Conventions
+--
+-- =====================
+
+--
+-- Define the Float Textual Convention
+--   This definition was written by David Perkins.
+--
+
+Float ::= TEXTUAL-CONVENTION
+    STATUS      current
+    DESCRIPTION
+        "A single precision floating-point number.  The semantics
+         and encoding are identical for type 'single' defined in
+         IEEE Standard for Binary Floating-Point,
+         ANSI/IEEE Std 754-1985.
+         The value is restricted to the BER serialization of
+         the following ASN.1 type:
+             FLOATTYPE ::= [120] IMPLICIT FloatType
+         (note: the value 120 is the sum of '30'h and '48'h)
+         The BER serialization of the length for values of
+         this type must use the definite length, short
+         encoding form.
+
+         For example, the BER serialization of value 123
+         of type FLOATTYPE is '9f780442f60000'h.  (The tag
+         is '9f78'h; the length is '04'h; and the value is
+         '42f60000'h.) The BER serialization of value
+         '9f780442f60000'h of data type Opaque is
+         '44079f780442f60000'h. (The tag is '44'h; the length
+         is '07'h; and the value is '9f780442f60000'h."
+    SYNTAX Opaque (SIZE (7))
+
+
+-- =====================
+--
+--  Enumerations
+--
+-- =====================
+
+--
+-- System Object ID values
+--
+--	XXX - do we want to distinguish between O/S versions ?
+--	(as is currently done with HP-UX)
+--
+
+hpux9             OBJECT IDENTIFIER ::= { netSnmpAgentOIDs 1 }
+sunos4            OBJECT IDENTIFIER ::= { netSnmpAgentOIDs 2 }
+solaris           OBJECT IDENTIFIER ::= { netSnmpAgentOIDs 3 }
+osf               OBJECT IDENTIFIER ::= { netSnmpAgentOIDs 4 }
+ultrix            OBJECT IDENTIFIER ::= { netSnmpAgentOIDs 5 }
+hpux10            OBJECT IDENTIFIER ::= { netSnmpAgentOIDs 6 }
+netbsd1           OBJECT IDENTIFIER ::= { netSnmpAgentOIDs 7 }
+freebsd           OBJECT IDENTIFIER ::= { netSnmpAgentOIDs 8 }
+irix              OBJECT IDENTIFIER ::= { netSnmpAgentOIDs 9 }
+linux             OBJECT IDENTIFIER ::= { netSnmpAgentOIDs 10 }
+bsdi              OBJECT IDENTIFIER ::= { netSnmpAgentOIDs 11 }
+openbsd           OBJECT IDENTIFIER ::= { netSnmpAgentOIDs 12 }
+win32		  OBJECT IDENTIFIER ::= { netSnmpAgentOIDs 13 } -- unlucky
+hpux11            OBJECT IDENTIFIER ::= { netSnmpAgentOIDs 14 }
+unknown           OBJECT IDENTIFIER ::= { netSnmpAgentOIDs 255 }
+
+
+
+--
+--  Transport Domains
+--
+-- Object identifiers for the non-standard transports that UCD/Net-SNMP
+-- supports.  Note that snmpTCPDomain is the subject of Internet Draft
+-- draft-irtf-nmrg-snmp-tcp-06.txt, which defines the OID
+-- .iso.org.dod.internet.experimental.nmrg.nmrgSnmpDomains.snmpTCPDomain
+-- (.1.3.6.1.3.91.1.1) for the SNMP over TCP over IPv4 transport domain.
+-- This draft (or its successor) is available from the Network Management
+-- Research Group web page at http://www.ibr.cs.tu-bs.de/projects/nmrg/
+--
+-- The NMRG OID for snmpTCPDomain is currently used by the code, but in case
+-- this is thought to be a Bad Idea, we define a private transport domain here
+-- that we could use instead.  The Unix domain, AAL5 PVC domain and
+-- the IPv6 domains are also defined privately here (for now).
+
+netSnmpTCPDomain	OBJECT IDENTIFIER ::= { netSnmpDomains 1 }
+netSnmpUnixDomain	OBJECT IDENTIFIER ::= { netSnmpDomains 2 }
+netSnmpAAL5PVCDomain	OBJECT IDENTIFIER ::= { netSnmpDomains 3 }
+netSnmpUDPIPv6Domain	OBJECT IDENTIFIER ::= { netSnmpDomains 4 }
+netSnmpTCPIPv6Domain	OBJECT IDENTIFIER ::= { netSnmpDomains 5 }
+netSnmpCallbackDomain	OBJECT IDENTIFIER ::= { netSnmpDomains 6 }
+
+END
diff -Naur tomato/release/src/router/snmp/mibs/NETWORK-SERVICES-MIB.txt tomato121/release/src/router/snmp/mibs/NETWORK-SERVICES-MIB.txt
--- tomato/release/src/router/snmp/mibs/NETWORK-SERVICES-MIB.txt	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/mibs/NETWORK-SERVICES-MIB.txt	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,626 @@
+NETWORK-SERVICES-MIB DEFINITIONS ::= BEGIN
+
+IMPORTS
+    OBJECT-TYPE, Counter32, Gauge32, MODULE-IDENTITY, mib-2
+      FROM SNMPv2-SMI
+    TimeStamp, TEXTUAL-CONVENTION
+      FROM SNMPv2-TC
+    MODULE-COMPLIANCE, OBJECT-GROUP
+      FROM SNMPv2-CONF
+    SnmpAdminString
+        FROM SNMP-FRAMEWORK-MIB;
+
+application MODULE-IDENTITY
+    LAST-UPDATED "200003030000Z"
+    ORGANIZATION "IETF Mail and Directory Management Working Group"
+
+    CONTACT-INFO
+      "        Ned Freed
+
+       Postal: Innosoft International, Inc.
+               1050 Lakes Drive
+               West Covina, CA 91790
+               US
+
+          Tel: +1 626 919 3600
+          Fax: +1 626 919 3614
+
+       E-Mail: ned.freed@innosoft.com"
+    DESCRIPTION
+      "The MIB module describing network service applications"
+    REVISION "200003030000Z"
+    DESCRIPTION
+      "This revision, published in RFC 2788, changes a number of
+       DisplayStrings to SnmpAdminStrings. Note that this change
+       is not strictly supported by SMIv2.  However, the alternative
+       of deprecating the old objects and defining new objects
+       would have a more adverse impact on backward compatibility
+       and interoperability, given the particular semantics of
+       these objects. The defining reference for distinguished
+       names has also been updated from RFC 1779 to RFC 2253."
+    REVISION "199905120000Z"
+    DESCRIPTION
+      "This revision fixes a few small technical problems found
+       in previous versions, mostly in regards to the conformance
+       groups for different versions of this MIB.  No changes have
+       been made to the objects this MIB defines since RFC 2248."
+    REVISION "199708170000Z"
+    DESCRIPTION
+      "This revision, published in RFC 2248, adds the
+       applDescription and applURL objects, adds the quiescing
+       state to the applOperStatus object and renames the MIB
+       from the APPLICATION-MIB to the NETWORK-SERVICE-MIB."
+    REVISION "199311280000Z"
+    DESCRIPTION
+      "The original version of this MIB was published in RFC 1565"
+    ::= {mib-2 27}
+
+-- Textual conventions
+
+-- DistinguishedName is used to refer to objects in the
+-- directory.
+
+DistinguishedName ::= TEXTUAL-CONVENTION
+    DISPLAY-HINT "255a"
+    STATUS current
+    DESCRIPTION
+        "A Distinguished Name represented in accordance with
+         RFC 2253, presented in the UTF-8 charset defined in
+         RFC 2279."
+    SYNTAX OCTET STRING (SIZE (0..255))
+
+-- Uniform Resource Locators are stored in URLStrings.
+
+URLString ::= TEXTUAL-CONVENTION
+    DISPLAY-HINT "255a"
+    STATUS current
+    DESCRIPTION
+        "A Uniform Resource Locator represented in accordance
+         with RFCs 1738 and 2368, presented in the NVT ASCII
+         charset defined in RFC 854."
+    SYNTAX OCTET STRING (SIZE (0..255))
+
+-- The basic applTable contains a list of the application
+-- entities.
+
+applTable OBJECT-TYPE
+    SYNTAX SEQUENCE OF ApplEntry
+    MAX-ACCESS not-accessible
+    STATUS current
+    DESCRIPTION
+        "The table holding objects which apply to all different
+         kinds of applications providing network services.
+         Each network service application capable of being
+         monitored should have a single entry in this table."
+    ::= {application 1}
+
+applEntry OBJECT-TYPE
+    SYNTAX ApplEntry
+    MAX-ACCESS not-accessible
+    STATUS current
+    DESCRIPTION
+      "An entry associated with a single network service
+       application."
+    INDEX {applIndex}
+    ::= {applTable 1}
+
+ApplEntry ::= SEQUENCE {
+    applIndex
+        INTEGER,
+    applName
+        SnmpAdminString,
+    applDirectoryName
+
+        DistinguishedName,
+    applVersion
+        SnmpAdminString,
+    applUptime
+        TimeStamp,
+    applOperStatus
+        INTEGER,
+    applLastChange
+        TimeStamp,
+    applInboundAssociations
+        Gauge32,
+    applOutboundAssociations
+        Gauge32,
+    applAccumulatedInboundAssociations
+        Counter32,
+    applAccumulatedOutboundAssociations
+        Counter32,
+    applLastInboundActivity
+        TimeStamp,
+    applLastOutboundActivity
+        TimeStamp,
+    applRejectedInboundAssociations
+        Counter32,
+    applFailedOutboundAssociations
+        Counter32,
+    applDescription
+        SnmpAdminString,
+    applURL
+        URLString
+}
+
+applIndex OBJECT-TYPE
+    SYNTAX INTEGER (1..2147483647)
+    MAX-ACCESS not-accessible
+    STATUS current
+    DESCRIPTION
+      "An index to uniquely identify the network service
+       application. This attribute is the index used for
+       lexicographic ordering of the table."
+    ::= {applEntry 1}
+
+applName OBJECT-TYPE
+    SYNTAX SnmpAdminString
+    MAX-ACCESS read-only
+    STATUS current
+    DESCRIPTION
+      "The name the network service application chooses to be
+       known by."
+    ::= {applEntry 2}
+
+applDirectoryName OBJECT-TYPE
+    SYNTAX DistinguishedName
+    MAX-ACCESS read-only
+    STATUS current
+    DESCRIPTION
+      "The Distinguished Name of the directory entry where
+       static information about this application is stored.
+       An empty string indicates that no information about
+       the application is available in the directory."
+    ::= {applEntry 3}
+
+applVersion OBJECT-TYPE
+    SYNTAX SnmpAdminString
+    MAX-ACCESS read-only
+    STATUS current
+    DESCRIPTION
+      "The version of network service application software.
+       This field is usually defined by the vendor of the
+       network service application software."
+    ::= {applEntry 4}
+applUptime OBJECT-TYPE
+    SYNTAX TimeStamp
+    MAX-ACCESS read-only
+    STATUS current
+    DESCRIPTION
+      "The value of sysUpTime at the time the network service
+       application was last initialized.  If the application was
+       last initialized prior to the last initialization of the
+       network management subsystem, then this object contains
+       a zero value."
+    ::= {applEntry 5}
+
+applOperStatus OBJECT-TYPE
+    SYNTAX INTEGER {
+      up(1),
+      down(2),
+      halted(3),
+      congested(4),
+      restarting(5),
+      quiescing(6)
+    }
+    MAX-ACCESS read-only
+    STATUS current
+    DESCRIPTION
+      "Indicates the operational status of the network service
+       application. 'down' indicates that the network service is
+
+       not available. 'up' indicates that the network service
+       is operational and available.  'halted' indicates that the
+       service is operational but not available.  'congested'
+       indicates that the service is operational but no additional
+       inbound associations can be accommodated.  'restarting'
+       indicates that the service is currently unavailable but is
+       in the process of restarting and will be available soon.
+       'quiescing' indicates that service is currently operational
+       but is in the process of shutting down. Additional inbound
+       associations may be rejected by applications in the
+       'quiescing' state."
+    ::= {applEntry 6}
+
+applLastChange OBJECT-TYPE
+    SYNTAX TimeStamp
+    MAX-ACCESS read-only
+    STATUS current
+    DESCRIPTION
+      "The value of sysUpTime at the time the network service
+       application entered its current operational state.  If
+       the current state was entered prior to the last
+       initialization of the local network management subsystem,
+       then this object contains a zero value."
+    ::= {applEntry 7}
+
+applInboundAssociations OBJECT-TYPE
+    SYNTAX Gauge32
+    MAX-ACCESS read-only
+    STATUS current
+    DESCRIPTION
+      "The number of current associations to the network service
+       application, where it is the responder.  An inbound
+       association occurs when another application successfully
+       connects to this one."
+    ::= {applEntry 8}
+
+applOutboundAssociations OBJECT-TYPE
+    SYNTAX Gauge32
+    MAX-ACCESS read-only
+    STATUS current
+    DESCRIPTION
+      "The number of current associations to the network service
+       application, where it is the initiator.  An outbound
+       association occurs when this application successfully
+       connects to another one."
+    ::= {applEntry 9}
+
+applAccumulatedInboundAssociations OBJECT-TYPE
+    SYNTAX Counter32
+    MAX-ACCESS read-only
+    STATUS current
+    DESCRIPTION
+      "The total number of associations to the application entity
+       since application initialization, where it was the responder."
+    ::= {applEntry 10}
+
+applAccumulatedOutboundAssociations OBJECT-TYPE
+    SYNTAX Counter32
+    MAX-ACCESS read-only
+    STATUS current
+    DESCRIPTION
+      "The total number of associations to the application entity
+       since application initialization, where it was the initiator."
+    ::= {applEntry 11}
+
+applLastInboundActivity OBJECT-TYPE
+    SYNTAX TimeStamp
+    MAX-ACCESS read-only
+    STATUS current
+    DESCRIPTION
+      "The value of sysUpTime at the time this application last
+       had an inbound association.  If the last association
+       occurred prior to the last initialization of the network
+       subsystem, then this object contains a zero value."
+    ::= {applEntry 12}
+
+applLastOutboundActivity OBJECT-TYPE
+    SYNTAX TimeStamp
+    MAX-ACCESS read-only
+    STATUS current
+    DESCRIPTION
+      "The value of sysUpTime at the time this application last
+       had an outbound association.  If the last association
+       occurred prior to the last initialization of the network
+       subsystem, then this object contains a zero value."
+    ::= {applEntry 13}
+
+applRejectedInboundAssociations OBJECT-TYPE
+    SYNTAX Counter32
+    MAX-ACCESS read-only
+    STATUS current
+    DESCRIPTION
+      "The total number of inbound associations the application
+       entity has rejected, since application initialization.
+       Rejected associations are not counted in the accumulated
+       association totals.  Note that this only counts
+
+       associations the application entity has rejected itself;
+       it does not count rejections that occur at lower layers
+       of the network.  Thus, this counter may not reflect the
+       true number of failed inbound associations."
+    ::= {applEntry 14}
+
+applFailedOutboundAssociations OBJECT-TYPE
+    SYNTAX Counter32
+    MAX-ACCESS read-only
+    STATUS current
+    DESCRIPTION
+      "The total number associations where the application entity
+       is initiator and association establishment has failed,
+       since application initialization.  Failed associations are
+       not counted in the accumulated association totals."
+    ::= {applEntry 15}
+
+applDescription OBJECT-TYPE
+    SYNTAX SnmpAdminString
+    MAX-ACCESS read-only
+    STATUS current
+    DESCRIPTION
+      "A text description of the application.  This information
+       is intended to identify and briefly describe the
+       application in a status display."
+    ::= {applEntry 16}
+
+applURL OBJECT-TYPE
+    SYNTAX URLString
+    MAX-ACCESS read-only
+    STATUS current
+    DESCRIPTION
+      "A URL pointing to a description of the application.
+       This information is intended to identify and describe
+       the application in a status display."
+    ::= {applEntry 17}
+
+-- The assocTable augments the information in the applTable
+-- with information about associations.  Note that two levels
+-- of compliance are specified below, depending on whether
+-- association monitoring is mandated.
+
+assocTable OBJECT-TYPE
+    SYNTAX SEQUENCE OF AssocEntry
+    MAX-ACCESS not-accessible
+    STATUS current
+    DESCRIPTION
+        "The table holding a set of all active application
+
+         associations."
+    ::= {application 2}
+
+assocEntry OBJECT-TYPE
+    SYNTAX AssocEntry
+    MAX-ACCESS not-accessible
+    STATUS current
+    DESCRIPTION
+      "An entry associated with an association for a network
+       service application."
+    INDEX {applIndex, assocIndex}
+    ::= {assocTable 1}
+
+AssocEntry ::= SEQUENCE {
+    assocIndex
+        INTEGER,
+    assocRemoteApplication
+        SnmpAdminString,
+    assocApplicationProtocol
+        OBJECT IDENTIFIER,
+    assocApplicationType
+        INTEGER,
+    assocDuration
+        TimeStamp
+}
+
+assocIndex OBJECT-TYPE
+    SYNTAX INTEGER (1..2147483647)
+    MAX-ACCESS not-accessible
+    STATUS current
+    DESCRIPTION
+      "An index to uniquely identify each association for a network
+       service application.  This attribute is the index that is
+       used for lexicographic ordering of the table.  Note that the
+       table is also indexed by the applIndex."
+    ::= {assocEntry 1}
+
+assocRemoteApplication OBJECT-TYPE
+    SYNTAX SnmpAdminString
+    MAX-ACCESS read-only
+    STATUS current
+    DESCRIPTION
+      "The name of the system running remote network service
+       application.  For an IP-based application this should be
+       either a domain name or IP address.  For an OSI application
+       it should be the string encoded distinguished name of the
+       managed object.  For X.400(1984) MTAs which do not have a
+       Distinguished Name, the RFC 2156 syntax 'mta in
+
+       globalid' used in X400-Received: fields can be used. Note,
+       however, that not all connections an MTA makes are
+       necessarily to another MTA."
+    ::= {assocEntry 2}
+
+assocApplicationProtocol OBJECT-TYPE
+    SYNTAX OBJECT IDENTIFIER
+    MAX-ACCESS read-only
+    STATUS current
+    DESCRIPTION
+      "An identification of the protocol being used for the
+       application.  For an OSI Application, this will be the
+       Application Context.  For Internet applications, OID
+       values of the form {applTCPProtoID port} or {applUDPProtoID
+       port} are used for TCP-based and UDP-based protocols,
+       respectively. In either case 'port' corresponds to the
+       primary port number being used by the protocol. The
+       usual IANA procedures may be used to register ports for
+       new protocols."
+    ::= {assocEntry 3}
+
+assocApplicationType OBJECT-TYPE
+    SYNTAX INTEGER {
+        uainitiator(1),
+        uaresponder(2),
+        peerinitiator(3),
+        peerresponder(4)}
+    MAX-ACCESS read-only
+    STATUS current
+    DESCRIPTION
+      "This indicates whether the remote application is some type of
+       client making use of this network service (e.g., a Mail User
+       Agent) or a server acting as a peer. Also indicated is whether
+       the remote end initiated an incoming connection to the network
+       service or responded to an outgoing connection made by the
+       local application.  MTAs and messaging gateways are
+       considered to be peers for the purposes of this variable."
+    ::= {assocEntry 4}
+
+assocDuration OBJECT-TYPE
+    SYNTAX TimeStamp
+    MAX-ACCESS read-only
+    STATUS current
+    DESCRIPTION
+      "The value of sysUpTime at the time this association was
+       started.  If this association started prior to the last
+       initialization of the network subsystem, then this
+       object contains a zero value."
+    ::= {assocEntry 5}
+
+-- Conformance information
+
+applConformance OBJECT IDENTIFIER ::= {application 3}
+
+applGroups      OBJECT IDENTIFIER ::= {applConformance 1}
+applCompliances OBJECT IDENTIFIER ::= {applConformance 2}
+
+-- Compliance statements
+
+applCompliance MODULE-COMPLIANCE
+    STATUS obsolete
+    DESCRIPTION
+      "The compliance statement for RFC 1565 implementations
+       which support the Network Services Monitoring MIB
+       for basic monitoring of network service applications.
+       This is the basic compliance statement for RFC 1565."
+    MODULE
+      MANDATORY-GROUPS {applRFC1565Group}
+    ::= {applCompliances 1}
+
+assocCompliance MODULE-COMPLIANCE
+    STATUS obsolete
+    DESCRIPTION
+      "The compliance statement for RFC 1565 implementations
+       which support the Network Services Monitoring MIB
+       for basic monitoring of network service applications
+       and their associations."
+    MODULE
+      MANDATORY-GROUPS {applRFC1565Group, assocRFC1565Group}
+    ::= {applCompliances 2}
+
+applRFC2248Compliance MODULE-COMPLIANCE
+    STATUS deprecated
+    DESCRIPTION
+      "The compliance statement for RFC 2248 implementations
+       which support the Network Services Monitoring MIB
+       for basic monitoring of network service applications."
+    MODULE
+      MANDATORY-GROUPS {applRFC2248Group}
+    ::= {applCompliances 3}
+
+assocRFC2248Compliance MODULE-COMPLIANCE
+    STATUS deprecated
+    DESCRIPTION
+      "The compliance statement for RFC 2248 implementations
+
+       which support the Network Services Monitoring MIB for
+       basic monitoring of network service applications and
+       their associations."
+    MODULE
+      MANDATORY-GROUPS {applRFC2248Group, assocRFC2248Group}
+    ::= {applCompliances 4}
+
+applRFC2788Compliance MODULE-COMPLIANCE
+    STATUS current
+    DESCRIPTION
+      "The compliance statement for RFC 2788 implementations
+       which support the Network Services Monitoring MIB
+       for basic monitoring of network service applications."
+    MODULE
+      MANDATORY-GROUPS {applRFC2788Group}
+    ::= {applCompliances 5}
+
+assocRFC2788Compliance MODULE-COMPLIANCE
+    STATUS current
+    DESCRIPTION
+      "The compliance statement for RFC 2788 implementations
+       which support the Network Services Monitoring MIB for
+       basic monitoring of network service applications and
+       their associations."
+    MODULE
+      MANDATORY-GROUPS {applRFC2788Group, assocRFC2788Group}
+    ::= {applCompliances 6}
+
+-- Units of conformance
+
+applRFC1565Group OBJECT-GROUP
+    OBJECTS {
+      applName, applVersion, applUptime, applOperStatus,
+      applLastChange, applInboundAssociations,
+      applOutboundAssociations, applAccumulatedInboundAssociations,
+      applAccumulatedOutboundAssociations, applLastInboundActivity,
+      applLastOutboundActivity, applRejectedInboundAssociations,
+      applFailedOutboundAssociations}
+    STATUS obsolete
+    DESCRIPTION
+      "A collection of objects providing basic monitoring of
+       network service applications.  This is the original set
+       of such objects defined in RFC 1565."
+    ::= {applGroups 7}
+
+assocRFC1565Group OBJECT-GROUP
+    OBJECTS {
+
+      assocRemoteApplication, assocApplicationProtocol,
+      assocApplicationType, assocDuration}
+    STATUS obsolete
+    DESCRIPTION
+      "A collection of objects providing basic monitoring of
+       network service applications' associations.  This is the
+       original set of such objects defined in RFC 1565."
+    ::= {applGroups 2}
+
+applRFC2248Group OBJECT-GROUP
+    OBJECTS {
+      applName, applVersion, applUptime, applOperStatus,
+      applLastChange, applInboundAssociations,
+      applOutboundAssociations, applAccumulatedInboundAssociations,
+      applAccumulatedOutboundAssociations, applLastInboundActivity,
+      applLastOutboundActivity, applRejectedInboundAssociations,
+      applFailedOutboundAssociations, applDescription, applURL}
+    STATUS deprecated
+    DESCRIPTION
+      "A collection of objects providing basic monitoring of
+       network service applications.  This group was originally
+       defined in RFC 2248; note that applDirectoryName is
+       missing."
+    ::= {applGroups 3}
+
+assocRFC2248Group OBJECT-GROUP
+    OBJECTS {
+      assocRemoteApplication, assocApplicationProtocol,
+      assocApplicationType, assocDuration}
+    STATUS deprecated
+    DESCRIPTION
+      "A collection of objects providing basic monitoring of
+       network service applications' associations.  This group
+       was originally defined by RFC 2248."
+    ::= {applGroups 4}
+
+applRFC2788Group OBJECT-GROUP
+    OBJECTS {
+      applName, applDirectoryName, applVersion, applUptime,
+      applOperStatus, applLastChange, applInboundAssociations,
+      applOutboundAssociations, applAccumulatedInboundAssociations,
+      applAccumulatedOutboundAssociations, applLastInboundActivity,
+      applLastOutboundActivity, applRejectedInboundAssociations,
+      applFailedOutboundAssociations, applDescription, applURL}
+    STATUS current
+    DESCRIPTION
+      "A collection of objects providing basic monitoring of
+       network service applications.  This is the appropriate
+
+       group for RFC 2788 -- it adds the applDirectoryName object
+       missing in RFC 2248."
+    ::= {applGroups 5}
+
+assocRFC2788Group OBJECT-GROUP
+    OBJECTS {
+      assocRemoteApplication, assocApplicationProtocol,
+      assocApplicationType, assocDuration}
+    STATUS current
+    DESCRIPTION
+      "A collection of objects providing basic monitoring of
+       network service applications' associations.  This is
+       the appropriate group for RFC 2788."
+    ::= {applGroups 6}
+
+-- OIDs of the form {applTCPProtoID port} are intended to be used
+-- for TCP-based protocols that don't have OIDs assigned by other
+-- means. {applUDPProtoID port} serves the same purpose for
+-- UDP-based protocols. In either case 'port' corresponds to
+-- the primary port number being used by the protocol. For example,
+-- assuming no other OID is assigned for SMTP, an OID of
+-- {applTCPProtoID 25} could be used, since SMTP is a TCP-based
+-- protocol that uses port 25 as its primary port.
+
+applTCPProtoID OBJECT IDENTIFIER ::= {application 4}
+applUDPProtoID OBJECT IDENTIFIER ::= {application 5}
+
+END
diff -Naur tomato/release/src/router/snmp/mibs/NOTIFICATION-LOG-MIB.txt tomato121/release/src/router/snmp/mibs/NOTIFICATION-LOG-MIB.txt
--- tomato/release/src/router/snmp/mibs/NOTIFICATION-LOG-MIB.txt	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/mibs/NOTIFICATION-LOG-MIB.txt	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,782 @@
+NOTIFICATION-LOG-MIB DEFINITIONS ::= BEGIN
+
+IMPORTS
+    MODULE-IDENTITY, OBJECT-TYPE,
+    Integer32, Unsigned32,
+    TimeTicks, Counter32, Counter64,
+    IpAddress, Opaque, mib-2       FROM SNMPv2-SMI
+    TimeStamp, DateAndTime,
+    StorageType, RowStatus,
+    TAddress, TDomain              FROM SNMPv2-TC
+    SnmpAdminString, SnmpEngineID  FROM SNMP-FRAMEWORK-MIB
+    MODULE-COMPLIANCE, OBJECT-GROUP     FROM SNMPv2-CONF;
+
+notificationLogMIB MODULE-IDENTITY
+    LAST-UPDATED "200011270000Z"            -- 27 November 2000
+    ORGANIZATION "IETF Distributed Management Working Group"
+    CONTACT-INFO "Ramanathan Kavasseri
+                  Cisco Systems, Inc.
+                  170 West Tasman Drive,
+                  San Jose CA 95134-1706.
+                  Phone: +1 408 527 2446
+                  Email: ramk@cisco.com"
+    DESCRIPTION
+     "The MIB module for logging SNMP Notifications, that is, Traps
+
+
+     and Informs."
+-- Revision History
+
+       REVISION     "200011270000Z"            -- 27 November 2000
+       DESCRIPTION  "This is the initial version of this MIB.
+               Published as RFC 3014"
+    ::= { mib-2 92 }
+
+
+notificationLogMIBObjects OBJECT IDENTIFIER ::= { notificationLogMIB 1 }
+
+nlmConfig OBJECT IDENTIFIER ::= { notificationLogMIBObjects 1 }
+nlmStats  OBJECT IDENTIFIER ::= { notificationLogMIBObjects 2 }
+nlmLog         OBJECT IDENTIFIER ::= { notificationLogMIBObjects 3 }
+
+--
+-- Configuration Section
+--
+
+nlmConfigGlobalEntryLimit OBJECT-TYPE
+    SYNTAX      Unsigned32
+    MAX-ACCESS  read-write
+    STATUS      current
+    DESCRIPTION
+     "The maximum number of notification entries that may be held
+     in nlmLogTable for all nlmLogNames added together.  A particular
+     setting does not guarantee that much data can be held.
+
+     If an application changes the limit while there are
+     Notifications in the log, the oldest Notifications MUST be
+     discarded to bring the log down to the new limit - thus the
+     value of nlmConfigGlobalEntryLimit MUST take precedence over
+     the values of nlmConfigGlobalAgeOut and nlmConfigLogEntryLimit,
+     even if the Notification being discarded has been present for
+     fewer minutes than the value of nlmConfigGlobalAgeOut, or if
+     the named log has fewer entries than that specified in
+     nlmConfigLogEntryLimit.
+
+     A value of 0 means no limit.
+
+     Please be aware that contention between multiple managers
+     trying to set this object to different values MAY affect the
+     reliability and completeness of data seen by each manager."
+    DEFVAL { 0 }
+    ::= { nlmConfig 1 }
+
+nlmConfigGlobalAgeOut OBJECT-TYPE
+    SYNTAX      Unsigned32
+
+
+    UNITS       "minutes"
+    MAX-ACCESS  read-write
+    STATUS      current
+    DESCRIPTION
+     "The number of minutes a Notification SHOULD be kept in a log
+     before it is automatically removed.
+
+     If an application changes the value of nlmConfigGlobalAgeOut,
+     Notifications older than the new time MAY be discarded to meet the
+     new time.
+
+     A value of 0 means no age out.
+
+     Please be aware that contention between multiple managers
+     trying to set this object to different values MAY affect the
+     reliability and completeness of data seen by each manager."
+    DEFVAL { 1440 }  -- 24 hours
+    ::= { nlmConfig 2 }
+
+
+--
+-- Basic Log Configuration Table
+--
+
+nlmConfigLogTable OBJECT-TYPE
+    SYNTAX      SEQUENCE OF NlmConfigLogEntry
+    MAX-ACCESS  not-accessible
+    STATUS      current
+    DESCRIPTION
+     "A table of logging control entries."
+    ::= { nlmConfig 3 }
+
+nlmConfigLogEntry OBJECT-TYPE
+    SYNTAX      NlmConfigLogEntry
+    MAX-ACCESS  not-accessible
+    STATUS      current
+    DESCRIPTION
+     "A logging control entry.  Depending on the entry's storage type
+     entries may be supplied by the system or created and deleted by
+     applications using nlmConfigLogEntryStatus."
+    INDEX      { nlmLogName }
+    ::= { nlmConfigLogTable 1 }
+
+NlmConfigLogEntry ::= SEQUENCE {
+    nlmLogName           SnmpAdminString,
+    nlmConfigLogFilterName    SnmpAdminString,
+    nlmConfigLogEntryLimit    Unsigned32,
+    nlmConfigLogAdminStatus   INTEGER,
+
+
+    nlmConfigLogOperStatus    INTEGER,
+    nlmConfigLogStorageType   StorageType,
+    nlmConfigLogEntryStatus   RowStatus
+    }
+
+nlmLogName OBJECT-TYPE
+    SYNTAX     SnmpAdminString (SIZE(0..32))
+    MAX-ACCESS not-accessible
+    STATUS     current
+    DESCRIPTION
+     "The name of the log.
+
+     An implementation may allow multiple named logs, up to some
+     implementation-specific limit (which may be none).  A
+     zero-length log name is reserved for creation and deletion by
+     the managed system, and MUST be used as the default log name by
+     systems that do not support named logs."
+    ::= { nlmConfigLogEntry 1 }
+
+nlmConfigLogFilterName OBJECT-TYPE
+    SYNTAX     SnmpAdminString (SIZE(0..32))
+    MAX-ACCESS read-create
+    STATUS     current
+    DESCRIPTION
+     "A value of snmpNotifyFilterProfileName as used as an index
+     into the snmpNotifyFilterTable in the SNMP Notification MIB,
+     specifying the locally or remotely originated Notifications
+     to be filtered out and not logged in this log.
+
+     A zero-length value or a name that does not identify an
+     existing entry in snmpNotifyFilterTable indicate no
+     Notifications are to be logged in this log."
+    DEFVAL { ''H }
+    ::= { nlmConfigLogEntry 2 }
+
+nlmConfigLogEntryLimit OBJECT-TYPE
+    SYNTAX     Unsigned32
+    MAX-ACCESS read-create
+    STATUS     current
+    DESCRIPTION
+     "The maximum number of notification entries that can be held in
+     nlmLogTable for this named log.  A particular setting does not
+     guarantee that that much data can be held.
+
+     If an application changes the limit while there are
+     Notifications in the log, the oldest Notifications are discarded
+     to bring the log down to the new limit.
+
+
+
+     A value of 0 indicates no limit.
+
+     Please be aware that contention between multiple managers
+     trying to set this object to different values MAY affect the
+     reliability and completeness of data seen by each manager."
+    DEFVAL { 0 }
+    ::= { nlmConfigLogEntry 3 }
+
+nlmConfigLogAdminStatus OBJECT-TYPE
+    SYNTAX     INTEGER { enabled(1), disabled(2) }
+    MAX-ACCESS read-create
+    STATUS     current
+    DESCRIPTION
+     "Control to enable or disable the log without otherwise
+     disturbing the log's entry.
+
+     Please be aware that contention between multiple managers
+     trying to set this object to different values MAY affect the
+     reliability and completeness of data seen by each manager."
+    DEFVAL { enabled }
+    ::= { nlmConfigLogEntry 4 }
+
+nlmConfigLogOperStatus OBJECT-TYPE
+    SYNTAX     INTEGER { disabled(1), operational(2), noFilter(3) }
+    MAX-ACCESS read-only
+    STATUS     current
+    DESCRIPTION
+     "The operational status of this log:
+
+          disabled  administratively disabled
+
+          operational    administratively enabled and working
+
+          noFilter  administratively enabled but either
+                    nlmConfigLogFilterName is zero length
+                    or does not name an existing entry in
+                    snmpNotifyFilterTable"
+    ::= { nlmConfigLogEntry 5 }
+
+nlmConfigLogStorageType OBJECT-TYPE
+    SYNTAX     StorageType
+    MAX-ACCESS read-create
+    STATUS     current
+    DESCRIPTION
+     "The storage type of this conceptual row."
+    ::= { nlmConfigLogEntry 6 }
+
+nlmConfigLogEntryStatus OBJECT-TYPE
+
+
+    SYNTAX     RowStatus
+    MAX-ACCESS read-create
+    STATUS     current
+    DESCRIPTION
+     "Control for creating and deleting entries.  Entries may be
+     modified while active.
+
+     For non-null-named logs, the managed system records the security
+     credentials from the request that sets nlmConfigLogStatus
+     to 'active' and uses that identity to apply access control to
+     the objects in the Notification to decide if that Notification
+     may be logged."
+    ::= { nlmConfigLogEntry 7 }
+
+--
+-- Statistics Section
+--
+
+nlmStatsGlobalNotificationsLogged OBJECT-TYPE
+    SYNTAX      Counter32
+    UNITS       "notifications"
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+     "The number of Notifications put into the nlmLogTable.  This
+     counts a Notification once for each log entry, so a Notification
+      put into multiple logs is counted multiple times."
+    ::= { nlmStats 1 }
+
+nlmStatsGlobalNotificationsBumped OBJECT-TYPE
+    SYNTAX      Counter32
+    UNITS       "notifications"
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+     "The number of log entries discarded to make room for a new entry
+     due to lack of resources or the value of nlmConfigGlobalEntryLimit
+     or nlmConfigLogEntryLimit.  This does not include entries discarded
+     due to the value of nlmConfigGlobalAgeOut."
+    ::= { nlmStats 2 }
+
+--
+-- Log Statistics Table
+--
+
+nlmStatsLogTable OBJECT-TYPE
+    SYNTAX      SEQUENCE OF NlmStatsLogEntry
+    MAX-ACCESS  not-accessible
+
+
+    STATUS      current
+    DESCRIPTION
+     "A table of Notification log statistics entries."
+    ::= { nlmStats 3 }
+
+nlmStatsLogEntry OBJECT-TYPE
+    SYNTAX      NlmStatsLogEntry
+    MAX-ACCESS  not-accessible
+    STATUS      current
+    DESCRIPTION
+     "A Notification log statistics entry."
+    AUGMENTS { nlmConfigLogEntry }
+    ::= { nlmStatsLogTable 1 }
+
+NlmStatsLogEntry ::= SEQUENCE {
+    nlmStatsLogNotificationsLogged Counter32,
+    nlmStatsLogNotificationsBumped Counter32
+}
+
+nlmStatsLogNotificationsLogged OBJECT-TYPE
+    SYNTAX      Counter32
+    UNITS       "notifications"
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+     "The number of Notifications put in this named log."
+    ::= { nlmStatsLogEntry 1 }
+
+nlmStatsLogNotificationsBumped OBJECT-TYPE
+    SYNTAX      Counter32
+    UNITS       "notifications"
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+     "The number of log entries discarded from this named log to make
+     room for a new entry due to lack of resources or the value of
+     nlmConfigGlobalEntryLimit or nlmConfigLogEntryLimit.  This does not
+     include entries discarded due to the value of
+     nlmConfigGlobalAgeOut."
+    ::= { nlmStatsLogEntry 2 }
+
+
+--
+-- Log Section
+--
+
+--
+-- Log Table
+--
+
+nlmLogTable OBJECT-TYPE
+    SYNTAX      SEQUENCE OF NlmLogEntry
+    MAX-ACCESS  not-accessible
+    STATUS      current
+    DESCRIPTION
+     "A table of Notification log entries.
+
+     It is an implementation-specific matter whether entries in this
+     table are preserved across initializations of the management
+     system.  In general one would expect that they are not.
+
+     Note that keeping entries across initializations of the
+     management system leads to some confusion with counters and
+     TimeStamps, since both of those are based on sysUpTime, which
+     resets on management initialization.  In this situation,
+     counters apply only after the reset and nlmLogTime for entries
+     made before the reset MUST be set to 0."
+    ::= { nlmLog 1 }
+
+nlmLogEntry OBJECT-TYPE
+    SYNTAX      NlmLogEntry
+    MAX-ACCESS  not-accessible
+    STATUS      current
+    DESCRIPTION
+     "A Notification log entry.
+
+     Entries appear in this table when Notifications occur and pass
+     filtering by nlmConfigLogFilterName and access control.  They are
+     removed to make way for new entries due to lack of resources or
+     the values of nlmConfigGlobalEntryLimit, nlmConfigGlobalAgeOut, or
+     nlmConfigLogEntryLimit.
+
+     If adding an entry would exceed nlmConfigGlobalEntryLimit or system
+     resources in general, the oldest entry in any log SHOULD be removed
+     to make room for the new one.
+
+     If adding an entry would exceed nlmConfigLogEntryLimit the oldest
+     entry in that log SHOULD be removed to make room for the new one.
+
+     Before the managed system puts a locally-generated Notification
+     into a non-null-named log it assures that the creator of the log
+     has access to the information in the Notification.  If not it
+     does not log that Notification in that log."
+    INDEX       { nlmLogName, nlmLogIndex }
+    ::= { nlmLogTable 1 }
+
+
+
+NlmLogEntry ::= SEQUENCE {
+    nlmLogIndex                Unsigned32,
+    nlmLogTime                 TimeStamp,
+    nlmLogDateAndTime          DateAndTime,
+    nlmLogEngineID             SnmpEngineID,
+    nlmLogEngineTAddress       TAddress,
+    nlmLogEngineTDomain        TDomain,
+    nlmLogContextEngineID      SnmpEngineID,
+    nlmLogContextName          SnmpAdminString,
+    nlmLogNotificationID       OBJECT IDENTIFIER
+}
+
+nlmLogIndex OBJECT-TYPE
+    SYNTAX     Unsigned32 (1..4294967295)
+    MAX-ACCESS not-accessible
+    STATUS     current
+    DESCRIPTION
+     "A monotonically increasing integer for the sole purpose of
+     indexing entries within the named log.  When it reaches the
+     maximum value, an extremely unlikely event, the agent wraps the
+     value back to 1."
+    ::= { nlmLogEntry 1 }
+
+nlmLogTime OBJECT-TYPE
+    SYNTAX      TimeStamp
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+     "The value of sysUpTime when the entry was placed in the log. If
+     the entry occurred before the most recent management system
+     initialization this object value MUST be set to zero."
+    ::= { nlmLogEntry 2 }
+
+nlmLogDateAndTime OBJECT-TYPE
+    SYNTAX      DateAndTime
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+     "The local date and time when the entry was logged, instantiated
+     only by systems that have date and time capability."
+    ::= { nlmLogEntry 3 }
+
+nlmLogEngineID OBJECT-TYPE
+    SYNTAX      SnmpEngineID
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+     "The identification of the SNMP engine at which the Notification
+
+
+     originated.
+
+     If the log can contain Notifications from only one engine
+     or the Trap is in SNMPv1 format, this object is a zero-length
+     string."
+    ::= { nlmLogEntry 4 }
+
+nlmLogEngineTAddress OBJECT-TYPE
+    SYNTAX      TAddress
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+     "The transport service address of the SNMP engine from which the
+     Notification was received, formatted according to the corresponding
+     value of nlmLogEngineTDomain. This is used to identify the source
+     of an SNMPv1 trap, since an nlmLogEngineId cannot be extracted
+     from the SNMPv1 trap pdu.
+
+     This object MUST always be instantiated, even if the log
+     can contain Notifications from only one engine.
+
+     Please be aware that the nlmLogEngineTAddress may not uniquely
+     identify the SNMP engine from which the Notification was received.
+     For example, if an SNMP engine uses DHCP or NAT to obtain
+     ip addresses, the address it uses may be shared with other
+     network devices, and hence will not uniquely identify the
+     SNMP engine."
+    ::= { nlmLogEntry 5 }
+
+nlmLogEngineTDomain OBJECT-TYPE
+    SYNTAX      TDomain
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+     "Indicates the kind of transport service by which a Notification
+     was received from an SNMP engine. nlmLogEngineTAddress contains
+     the transport service address of the SNMP engine from which
+     this Notification was received.
+
+     Possible values for this object are presently found in the
+     Transport Mappings for SNMPv2 document (RFC 1906 [8])."
+    ::= { nlmLogEntry 6 }
+
+nlmLogContextEngineID OBJECT-TYPE
+    SYNTAX      SnmpEngineID
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+
+
+     "If the Notification was received in a protocol which has a
+      contextEngineID element like SNMPv3, this object has that value.
+      Otherwise its value is a zero-length string."
+     ::= { nlmLogEntry 7 }
+
+nlmLogContextName OBJECT-TYPE
+    SYNTAX      SnmpAdminString
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+     "The name of the SNMP MIB context from which the Notification came.
+     For SNMPv1 Traps this is the community string from the Trap."
+    ::= { nlmLogEntry 8 }
+
+nlmLogNotificationID OBJECT-TYPE
+    SYNTAX      OBJECT IDENTIFIER
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+     "The NOTIFICATION-TYPE object identifier of the Notification that
+     occurred."
+    ::= { nlmLogEntry 9 }
+
+--
+-- Log Variable Table
+--
+
+nlmLogVariableTable OBJECT-TYPE
+    SYNTAX      SEQUENCE OF NlmLogVariableEntry
+    MAX-ACCESS  not-accessible
+    STATUS      current
+    DESCRIPTION
+     "A table of variables to go with Notification log entries."
+    ::= { nlmLog 2 }
+
+nlmLogVariableEntry OBJECT-TYPE
+    SYNTAX      NlmLogVariableEntry
+    MAX-ACCESS  not-accessible
+    STATUS      current
+    DESCRIPTION
+     "A Notification log entry variable.
+
+     Entries appear in this table when there are variables in
+     the varbind list of a Notification in nlmLogTable."
+    INDEX       { nlmLogName, nlmLogIndex, nlmLogVariableIndex }
+    ::= { nlmLogVariableTable 1 }
+
+NlmLogVariableEntry ::= SEQUENCE {
+
+
+    nlmLogVariableIndex              Unsigned32,
+    nlmLogVariableID                 OBJECT IDENTIFIER,
+    nlmLogVariableValueType          INTEGER,
+    nlmLogVariableCounter32Val       Counter32,
+    nlmLogVariableUnsigned32Val      Unsigned32,
+    nlmLogVariableTimeTicksVal       TimeTicks,
+    nlmLogVariableInteger32Val       Integer32,
+    nlmLogVariableOctetStringVal     OCTET STRING,
+    nlmLogVariableIpAddressVal       IpAddress,
+    nlmLogVariableOidVal             OBJECT IDENTIFIER,
+    nlmLogVariableCounter64Val       Counter64,
+    nlmLogVariableOpaqueVal          Opaque
+}
+
+nlmLogVariableIndex OBJECT-TYPE
+    SYNTAX     Unsigned32 (1..4294967295)
+    MAX-ACCESS not-accessible
+    STATUS     current
+    DESCRIPTION
+     "A monotonically increasing integer, starting at 1 for a given
+     nlmLogIndex, for indexing variables within the logged
+     Notification."
+    ::= { nlmLogVariableEntry 1 }
+
+nlmLogVariableID OBJECT-TYPE
+    SYNTAX     OBJECT IDENTIFIER
+    MAX-ACCESS read-only
+    STATUS     current
+    DESCRIPTION
+     "The variable's object identifier."
+    ::= { nlmLogVariableEntry 2 }
+
+nlmLogVariableValueType OBJECT-TYPE
+    SYNTAX      INTEGER { counter32(1), unsigned32(2), timeTicks(3),
+                 integer32(4), ipAddress(5), octetString(6),
+                 objectId(7), counter64(8), opaque(9) }
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+     "The type of the value.  One and only one of the value
+     objects that follow must be instantiated, based on this type."
+    ::= { nlmLogVariableEntry 3 }
+
+nlmLogVariableCounter32Val OBJECT-TYPE
+    SYNTAX      Counter32
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+
+
+     "The value when nlmLogVariableType is 'counter32'."
+    ::= { nlmLogVariableEntry 4 }
+
+nlmLogVariableUnsigned32Val OBJECT-TYPE
+    SYNTAX      Unsigned32
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+     "The value when nlmLogVariableType is 'unsigned32'."
+    ::= { nlmLogVariableEntry 5 }
+
+nlmLogVariableTimeTicksVal OBJECT-TYPE
+    SYNTAX      TimeTicks
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+     "The value when nlmLogVariableType is 'timeTicks'."
+    ::= { nlmLogVariableEntry 6 }
+
+nlmLogVariableInteger32Val OBJECT-TYPE
+    SYNTAX      Integer32
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+     "The value when nlmLogVariableType is 'integer32'."
+    ::= { nlmLogVariableEntry 7 }
+
+nlmLogVariableOctetStringVal OBJECT-TYPE
+    SYNTAX      OCTET STRING
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+     "The value when nlmLogVariableType is 'octetString'."
+    ::= { nlmLogVariableEntry 8 }
+
+nlmLogVariableIpAddressVal OBJECT-TYPE
+    SYNTAX      IpAddress
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+     "The value when nlmLogVariableType is 'ipAddress'.
+     Although this seems to be unfriendly for IPv6, we
+     have to recognize that there are a number of older
+     MIBs that do contain an IPv4 format address, known
+     as IpAddress.
+
+     IPv6 addresses are represented using TAddress or
+     InetAddress, and so the underlying datatype is
+
+
+     OCTET STRING, and their value would be stored in
+     the nlmLogVariableOctetStringVal column."
+    ::= { nlmLogVariableEntry 9 }
+
+nlmLogVariableOidVal OBJECT-TYPE
+    SYNTAX      OBJECT IDENTIFIER
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+     "The value when nlmLogVariableType is 'objectId'."
+    ::= { nlmLogVariableEntry 10 }
+
+nlmLogVariableCounter64Val OBJECT-TYPE
+    SYNTAX      Counter64
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+     "The value when nlmLogVariableType is 'counter64'."
+    ::= { nlmLogVariableEntry 11 }
+
+nlmLogVariableOpaqueVal OBJECT-TYPE
+    SYNTAX      Opaque
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+     "The value when nlmLogVariableType is 'opaque'."
+    ::= { nlmLogVariableEntry 12 }
+
+
+--
+-- Conformance
+--
+
+notificationLogMIBConformance OBJECT IDENTIFIER ::=
+    { notificationLogMIB 3 }
+notificationLogMIBCompliances OBJECT IDENTIFIER ::=
+    { notificationLogMIBConformance 1 }
+notificationLogMIBGroups      OBJECT IDENTIFIER ::=
+    { notificationLogMIBConformance 2 }
+
+-- Compliance
+
+notificationLogMIBCompliance MODULE-COMPLIANCE
+     STATUS current
+     DESCRIPTION
+          "The compliance statement for entities which implement
+          the Notification Log MIB."
+     MODULE    -- this module
+
+
+          MANDATORY-GROUPS {
+               notificationLogConfigGroup,
+               notificationLogStatsGroup,
+               notificationLogLogGroup
+          }
+
+     OBJECT nlmConfigGlobalEntryLimit
+         SYNTAX Unsigned32 (0..4294967295)
+         MIN-ACCESS read-only
+         DESCRIPTION
+          "Implementations may choose a limit and not allow it to be
+          changed or may enforce an upper or lower bound on the
+          limit."
+
+     OBJECT nlmConfigLogEntryLimit
+         SYNTAX Unsigned32 (0..4294967295)
+         MIN-ACCESS read-only
+         DESCRIPTION
+          "Implementations may choose a limit and not allow it to be
+          changed or may enforce an upper or lower bound on the
+          limit."
+
+     OBJECT nlmConfigLogEntryStatus
+         MIN-ACCESS read-only
+         DESCRIPTION
+          "Implementations may disallow the creation of named logs."
+
+     GROUP notificationLogDateGroup
+         DESCRIPTION
+          "This group is mandatory on systems that keep wall clock
+          date and time and should not be implemented on systems that
+          do not have a wall clock date."
+
+     ::= { notificationLogMIBCompliances 1 }
+
+-- Units of Conformance
+
+notificationLogConfigGroup OBJECT-GROUP
+     OBJECTS {
+          nlmConfigGlobalEntryLimit,
+          nlmConfigGlobalAgeOut,
+          nlmConfigLogFilterName,
+          nlmConfigLogEntryLimit,
+          nlmConfigLogAdminStatus,
+          nlmConfigLogOperStatus,
+          nlmConfigLogStorageType,
+          nlmConfigLogEntryStatus
+     }
+
+
+     STATUS current
+     DESCRIPTION
+          "Notification log configuration management."
+     ::= { notificationLogMIBGroups 1 }
+
+notificationLogStatsGroup OBJECT-GROUP
+     OBJECTS {
+          nlmStatsGlobalNotificationsLogged,
+          nlmStatsGlobalNotificationsBumped,
+          nlmStatsLogNotificationsLogged,
+          nlmStatsLogNotificationsBumped
+     }
+     STATUS current
+     DESCRIPTION
+          "Notification log statistics."
+     ::= { notificationLogMIBGroups 2 }
+
+notificationLogLogGroup OBJECT-GROUP
+     OBJECTS {
+          nlmLogTime,
+          nlmLogEngineID,
+          nlmLogEngineTAddress,
+          nlmLogEngineTDomain,
+          nlmLogContextEngineID,
+          nlmLogContextName,
+          nlmLogNotificationID,
+          nlmLogVariableID,
+          nlmLogVariableValueType,
+          nlmLogVariableCounter32Val,
+          nlmLogVariableUnsigned32Val,
+          nlmLogVariableTimeTicksVal,
+          nlmLogVariableInteger32Val,
+          nlmLogVariableOctetStringVal,
+          nlmLogVariableIpAddressVal,
+          nlmLogVariableOidVal,
+          nlmLogVariableCounter64Val,
+          nlmLogVariableOpaqueVal
+     }
+     STATUS current
+     DESCRIPTION
+          "Notification log data."
+     ::= { notificationLogMIBGroups 3 }
+
+notificationLogDateGroup OBJECT-GROUP
+     OBJECTS {
+          nlmLogDateAndTime
+     }
+     STATUS current
+
+
+     DESCRIPTION
+          "Conditionally mandatory notification log data.
+          This group is mandatory on systems that keep wall
+          clock date and time and should not be implemented
+          on systems that do not have a wall clock date."
+     ::= { notificationLogMIBGroups 4 }
+
+END
diff -Naur tomato/release/src/router/snmp/mibs/QOS.TXT tomato121/release/src/router/snmp/mibs/QOS.TXT
--- tomato/release/src/router/snmp/mibs/QOS.TXT	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/mibs/QOS.TXT	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,371 @@
+LINUX-KERNEL-QOS DEFINITIONS ::= BEGIN
+
+IMPORTS
+    MODULE-IDENTITY, OBJECT-TYPE, enterprises,
+    Integer32, Counter32, mib-2, Unsigned32
+        FROM SNMPv2-SMI
+    DisplayString
+        FROM SNMPv2-TC
+    MODULE-COMPLIANCE, OBJECT-GROUP
+        FROM SNMPv2-CONF;
+    
+qos MODULE-IDENTITY
+    LAST-UPDATED	"200402080000Z"
+    ORGANIZATION	"www.prokon.cz"
+    CONTACT-INFO
+	"postal:	Michal Charvat
+			Zemesska 309
+			Citoliby 439 02
+			Czech Republic
+			
+	 email:		michal@ns1.prokon.cz"
+    DESCRIPTION 
+	"QoS statistics from Linux kernel"
+    REVISION	"200402080000Z"
+    DESCRIPTION
+	"qos mib to get values from Linux kernel"
+    ::= { enterprises 18756 }	-- IANA gave me this number to use
+    
+-- top level structure
+
+qosObjectTable OBJECT-TYPE
+    SYNTAX	SEQUENCE OF QosObject
+    MAX-ACCESS	not-accessible
+    STATUS	current
+    DESCRIPTION
+	"table, where are all values stored"
+    ::= { qos 1 }
+
+qosObject OBJECT-TYPE
+    SYNTAX	QosObject
+    MAX-ACCESS	not-accessible
+    STATUS	current
+    DESCRIPTION
+	"object specifies one qdisc or class"
+    INDEX	{ qosDeviceIndex, qosMajorHandle, qosMinorHandle }
+    ::= { qosObjectTable 1 }
+    
+
+QosObject ::= SEQUENCE {
+    qosDeviceType	Counter32
+    qosDeviceIndex	INTEGER,
+    qosMajorHandle	Unsigned32,
+    qosMinorHandle	Unsigned32,
+    qosTextHandle	DisplayString,
+    qosTextLeaf		DisplayString,
+    qosParent		Unsigned32,
+    qosTextParent	DisplayString,
+    qosDeviceName	DisplayString,
+    qosType		DisplayString,
+    qosBytes		Counter32,
+    qosPackets		Counter32,
+    qosDropped		Counter32,
+    qosOverlimit	Counter32,
+    qosBps		Unsigned32,
+    qosPps		Unsigned32,
+    qosQlen		Unsigned32,
+    qosBacklog		Unsigned32,
+    qosRedEarly		Counter32,
+    qosRedDrop		Counter32,
+    qosRedOther		Counter32,
+    qosRedMarked	Counter32,
+    qosHtbLends		Counter32,
+    qosHtbBorrows	Counter32,
+    qosHtbGiants	Counter32,
+    qosHtbTokens	INTEGER,
+    qosHtbCTokens	INTEGER,
+    qosHtbRate		Unsigned32,
+    qosHtbCeil		Unsigned32,
+    qosHtbPrio		Unsigned32,
+    qosCbqBorrows	Counter32,
+    qosCbqOveractions	Counter32,
+    qosCbqAvgidle	INTEGER,
+    qosCbqUndertime	INTEGER,
+    qosInfo		DisplayString
+    }
+
+qosDeviceIndex OBJECT-TYPE
+    SYNTAX	INTEGER
+    MAX-ACCESS	read-only
+    STATUS	current
+    DESCRIPTION
+	"system device number"
+    ::= { qosObject 1 }
+
+qosDeviceIndex OBJECT-TYPE
+    SYNTAX	Integer32 (0..2147483647)
+    MAX-ACCESS	read-only
+    STATUS	current
+    DESCRIPTION
+	"system device number"
+    ::= { qosObject 2 }
+
+qosMajorHandle OBJECT-TYPE
+    SYNTAX	Unsigned32
+    MAX-ACCESS	read-only
+    STATUS	current
+    DESCRIPTION	
+	"major part of system handle, per device unique"
+    ::= { qosObject 3 }	
+
+qosMinorHandle OBJECT-TYPE
+    SYNTAX	Unsigned32
+    MAX-ACCESS	read-only
+    STATUS	current
+    DESCRIPTION	
+	"minor part of system handle, per device unique"
+    ::= { qosObject 4 }	
+
+qosTextHandle OBJECT-TYPE 
+    SYNTAX	DisplayString
+    MAX-ACCESS	read-only
+    STATUS	current
+    DESCRIPTION	
+	"literal handle - for better orientation"
+    ::= { qosObject 5 }
+
+qosTextLeaf OBJECT-TYPE 
+    SYNTAX	DisplayString
+    MAX-ACCESS	read-only
+    STATUS	current
+    DESCRIPTION	
+	"literal leaf - for better orientation"
+    ::= { qosObject 6 }
+
+qosParent OBJECT-TYPE
+    SYNTAX	Unsigned32
+    MAX-ACCESS	read-only
+    STATUS	current
+    DESCRIPTION	
+	"parent"
+    ::= { qosObject 7 }	
+
+qosTextParent OBJECT-TYPE 
+    SYNTAX	DisplayString
+    MAX-ACCESS	read-only
+    STATUS	current
+    DESCRIPTION	
+	"literal parent - for better orientation"
+    ::= { qosObject 8 }
+
+
+qosDeviceName OBJECT-TYPE 
+    SYNTAX	DisplayString
+    MAX-ACCESS	read-only
+    STATUS	current
+    DESCRIPTION	
+	"literal device name - for better orientation"
+    ::= { qosObject 9 }
+
+qosType OBJECT-TYPE
+    SYNTAX	DisplayString
+    MAX-ACCESS	read-only
+    STATUS	current
+    DESCRIPTION
+	"literal qos type, once again, better orientation"
+    ::= { qosObject 10 }
+
+qosBytes OBJECT-TYPE
+    SYNTAX	Counter64
+    MAX-ACCESS	read-only
+    STATUS	current
+    DESCRIPTION	
+	"counts transfered bytes on object"
+    ::= { qosObject 11 }
+
+qosPackets OBJECT-TYPE
+    SYNTAX	Counter32
+    MAX-ACCESS	read-only
+    STATUS	current
+    DESCRIPTION	
+	"counts packtes"
+    ::= { qosObject 12 }
+
+qosDropped OBJECT-TYPE
+    SYNTAX	Counter32
+    MAX-ACCESS	read-only
+    STATUS	current
+    DESCRIPTION	
+	"counts dropped packets (perhaps too long a queue)"
+    ::= { qosObject 13 }
+    
+qosOverlimit OBJECT-TYPE
+    SYNTAX	Counter32
+    MAX-ACCESS	read-only
+    STATUS	current
+    DESCRIPTION	
+	"counts discarded packets - rate exceeded"
+    ::= { qosObject 14 }
+
+qosBps OBJECT-TYPE
+    SYNTAX	Unsigned32
+    MAX-ACCESS	read-only
+    STATUS	current
+    DESCRIPTION	
+	"counts bytes per second"
+    ::= { qosObject 15 }
+
+qosPps OBJECT-TYPE
+    SYNTAX	Unsigned32
+    MAX-ACCESS	read-only
+    STATUS	current
+    DESCRIPTION	
+	"counts packets per second"
+    ::= { qosObject 16 }
+
+qosQlen OBJECT-TYPE
+    SYNTAX	Unsigned32
+    MAX-ACCESS	read-only
+    STATUS	current
+    DESCRIPTION	
+	"queue length"
+    ::= { qosObject 17 }
+
+qosBacklog OBJECT-TYPE
+    SYNTAX	Unsigned32
+    MAX-ACCESS	read-only
+    STATUS	current
+    DESCRIPTION	
+	"backlog"
+    ::= { qosObject 18 }
+
+qosRedEarly OBJECT-TYPE
+    SYNTAX	Counter32
+    MAX-ACCESS	read-only
+    STATUS	current
+    DESCRIPTION	
+	"early red packets"
+    ::= { qosObject 19 }
+
+qosRedpdrop OBJECT-TYPE
+    SYNTAX	Counter32
+    MAX-ACCESS	read-only
+    STATUS	current
+    DESCRIPTION	
+	"probability dropped packets"
+    ::= { qosObject 20 }
+
+qosRedOther OBJECT-TYPE
+    SYNTAX	Counter32
+    MAX-ACCESS	read-only
+    STATUS	current
+    DESCRIPTION	
+	"other packets"
+    ::= { qosObject 21 }
+
+qosRedMarked OBJECT-TYPE
+    SYNTAX	Counter32
+    MAX-ACCESS	read-only
+    STATUS	current
+    DESCRIPTION	
+	"counts discarded packets - rate exceeded"
+    ::= { qosObject 22 }
+
+qosHtbLends OBJECT-TYPE
+    SYNTAX	Counter32
+    MAX-ACCESS	read-only
+    STATUS	current
+    DESCRIPTION	
+	"HTB lended bytes"
+    ::= { qosObject 23 }
+
+qosHtbBorrows OBJECT-TYPE
+    SYNTAX	Counter32
+    MAX-ACCESS	read-only
+    STATUS	current
+    DESCRIPTION	
+	"HTB borrowed packets"
+    ::= { qosObject 24 }
+
+qosHtbGiants OBJECT-TYPE
+    SYNTAX	Counter32
+    MAX-ACCESS	read-only
+    STATUS	current
+    DESCRIPTION	
+	"HTB giants packets"
+    ::= { qosObject 25 }
+
+qosHtbTokens OBJECT-TYPE
+    SYNTAX	INTEGER
+    MAX-ACCESS	read-only
+    STATUS	current
+    DESCRIPTION	
+	"HTB tokens in reservoir"
+    ::= { qosObject 26 }
+
+qosHtbCTokens OBJECT-TYPE
+    SYNTAX 	INTEGER
+    MAX-ACCESS	read-only
+    STATUS	current
+    DESCRIPTION	
+	"HTB ceil tokens in reservoir"
+    ::= { qosObject 27 }
+
+qosHtbRate OBJECT-TYPE
+    SYNTAX	Unsigned32
+    MAX-ACCESS	read-only
+    STATUS	current
+    DESCRIPTION	
+	"HTB class rate"
+    ::= { qosObject 28 }
+
+qosHtbCeil OBJECT-TYPE
+    SYNTAX	Unsigned32
+    MAX-ACCESS	read-only
+    STATUS	current
+    DESCRIPTION	
+	"HTB ceil rate"
+    ::= { qosObject 29 }
+
+qosHtbPrio OBJECT-TYPE
+    SYNTAX	Unsigned32
+    MAX-ACCESS	read-only
+    STATUS	current
+    DESCRIPTION	
+	"HTB class prio"
+    ::= { qosObject 30 }
+
+qosCbqBorrows OBJECT-TYPE
+    SYNTAX	Counter32
+    MAX-ACCESS	read-only
+    STATUS	current
+    DESCRIPTION	
+	"CBQ borrowed bytes"
+    ::= { qosObject 31 }
+
+qosCbqOveractions OBJECT-TYPE
+    SYNTAX	Counter32
+    MAX-ACCESS	read-only
+    STATUS	current
+    DESCRIPTION	
+	"CBQ Overactions"
+    ::= { qosObject 32 }
+
+qosCbqAvgidle OBJECT-TYPE
+    SYNTAX	INTEGER
+    MAX-ACCESS	read-only
+    STATUS	current
+    DESCRIPTION	
+	"CBQ avgidle"
+    ::= { qosObject 33 }
+
+qosCbqUndertime OBJECT-TYPE
+    SYNTAX	INTEGER
+    MAX-ACCESS	read-only
+    STATUS	current
+    DESCRIPTION	
+	"CBQ undertime"
+    ::= { qosObject 34 }
+
+qosInfo OBJECT-TYPE 
+    SYNTAX	DisplayString
+    MAX-ACCESS	read-only
+    STATUS	current
+    DESCRIPTION	
+	"literal parameters - for better orientation"
+    ::= { qosObject 35 }
+
+
+
+
+END
diff -Naur tomato/release/src/router/snmp/mibs/README.mibs tomato121/release/src/router/snmp/mibs/README.mibs
--- tomato/release/src/router/snmp/mibs/README.mibs	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/mibs/README.mibs	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,41 @@
+About the MIBS distributed with Net-SNMP.
+
+This directory contains a very basic set of MIB files, ready for use.
+In addition, there are some scripts and table files to help you get a
+fuller collection of MIB files.
+
+smistrip - a script that can extract a MIB file from an RFC (or I-D)
+mibfetch - a script that will fetch an RFC file from a mirror, and extract
+	the hosted MIB from it. It assumes that you have wget installed.
+rfclist - a list of RFC numbers and corresponding MIB name(s)
+ianalist - a list of files at the IANA server that holds IANA maintained
+	MIBs
+Makefile.mib - rules for extracting current MIB files from RFC and IANA
+	files.
+rfcmibs.diff - a set of required patches for MIB files extracted from RFCs
+
+The file Makefile.mib holds rules that fetch and extract MIB files from
+their hosting RFCs. Make will use wget to retrieve the RFC files, and,
+as I am located in Denmark, use the RFC mirror at NORDUnet. You may change
+that at the top of Makefile.mib.
+
+Makefile.mib also holds rules that will collect all the current IETF MIB
+definitions, using the lists in rfclist and ianalist. To get them all,
+use
+	make -f Makefile.mib allmibs
+
+Note, that there are a few fatal syntactic errors in some of the RFC
+definitions. To make them all parse successfully with the Net-SNMP parser,
+you should apply the patches in the file rfcmibs.diff. These patches are
+typical for the problems that are commonly seen with MIB files from various
+sources:
+
+- forgetting to import enterprises/mib-2/transmission from SNMPv2-SMI
+- thinking that a -- comment ends at end-of-line, not at the next --
+- using _ in identifiers. A - may be used in its place
+- various misspellings
+
+DISCLAIMER: The patches provided here for the IETF standard MIB files
+are not endorsed by anyone, and I don't guarantee that they bring them
+accordance with what the authors intended. All I will promise, is that
+the MIB files can be parsed.
diff -Naur tomato/release/src/router/snmp/mibs/RFC1155-SMI.txt tomato121/release/src/router/snmp/mibs/RFC1155-SMI.txt
--- tomato/release/src/router/snmp/mibs/RFC1155-SMI.txt	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/mibs/RFC1155-SMI.txt	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,119 @@
+RFC1155-SMI DEFINITIONS ::= BEGIN
+
+EXPORTS -- EVERYTHING
+        internet, directory, mgmt,
+        experimental, private, enterprises,
+        OBJECT-TYPE, ObjectName, ObjectSyntax, SimpleSyntax,
+        ApplicationSyntax, NetworkAddress, IpAddress,
+        Counter, Gauge, TimeTicks, Opaque;
+
+ -- the path to the root
+
+ internet      OBJECT IDENTIFIER ::= { iso org(3) dod(6) 1 }
+
+ directory     OBJECT IDENTIFIER ::= { internet 1 }
+
+ mgmt          OBJECT IDENTIFIER ::= { internet 2 }
+
+ experimental  OBJECT IDENTIFIER ::= { internet 3 }
+
+ private       OBJECT IDENTIFIER ::= { internet 4 }
+ enterprises   OBJECT IDENTIFIER ::= { private 1 }
+
+ -- definition of object types
+
+ OBJECT-TYPE MACRO ::=
+ BEGIN
+     TYPE NOTATION ::= "SYNTAX" type (TYPE ObjectSyntax)
+                       "ACCESS" Access
+                       "STATUS" Status
+     VALUE NOTATION ::= value (VALUE ObjectName)
+
+     Access ::= "read-only"
+                     | "read-write"
+                     | "write-only"
+                     | "not-accessible"
+     Status ::= "mandatory"
+                     | "optional"
+                     | "obsolete"
+ END
+
+    -- names of objects in the MIB
+
+    ObjectName ::=
+        OBJECT IDENTIFIER
+
+    -- syntax of objects in the MIB
+
+    ObjectSyntax ::=
+        CHOICE {
+            simple
+                SimpleSyntax,
+    -- note that simple SEQUENCEs are not directly
+    -- mentioned here to keep things simple (i.e.,
+    -- prevent mis-use).  However, application-wide
+    -- types which are IMPLICITly encoded simple
+    -- SEQUENCEs may appear in the following CHOICE
+
+            application-wide
+                ApplicationSyntax
+        }
+
+       SimpleSyntax ::=
+           CHOICE {
+               number
+                   INTEGER,
+               string
+                   OCTET STRING,
+               object
+                   OBJECT IDENTIFIER,
+               empty
+                   NULL
+           }
+
+       ApplicationSyntax ::=
+           CHOICE {
+               address
+                   NetworkAddress,
+               counter
+                   Counter,
+               gauge
+                   Gauge,
+               ticks
+                   TimeTicks,
+               arbitrary
+                   Opaque
+
+       -- other application-wide types, as they are
+       -- defined, will be added here
+           }
+
+       -- application-wide types
+
+       NetworkAddress ::=
+           CHOICE {
+               internet
+                   IpAddress
+           }
+
+       IpAddress ::=
+           [APPLICATION 0]          -- in network-byte order
+               IMPLICIT OCTET STRING (SIZE (4))
+
+       Counter ::=
+           [APPLICATION 1]
+               IMPLICIT INTEGER (0..4294967295)
+
+       Gauge ::=
+           [APPLICATION 2]
+               IMPLICIT INTEGER (0..4294967295)
+
+       TimeTicks ::=
+           [APPLICATION 3]
+               IMPLICIT INTEGER (0..4294967295)
+
+       Opaque ::=
+           [APPLICATION 4]          -- arbitrary ASN.1 value,
+               IMPLICIT OCTET STRING   --   "double-wrapped"
+
+       END
diff -Naur tomato/release/src/router/snmp/mibs/RFC1213-MIB.txt tomato121/release/src/router/snmp/mibs/RFC1213-MIB.txt
--- tomato/release/src/router/snmp/mibs/RFC1213-MIB.txt	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/mibs/RFC1213-MIB.txt	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,2613 @@
+RFC1213-MIB DEFINITIONS ::= BEGIN
+
+IMPORTS
+        mgmt, NetworkAddress, IpAddress, Counter, Gauge,
+                TimeTicks
+            FROM RFC1155-SMI
+        OBJECT-TYPE
+                FROM RFC-1212;
+
+--  This MIB module uses the extended OBJECT-TYPE macro as
+--  defined in [14];
+
+--  MIB-II (same prefix as MIB-I)
+
+mib-2      OBJECT IDENTIFIER ::= { mgmt 1 }
+
+-- textual conventions
+
+DisplayString ::=
+    OCTET STRING
+-- This data type is used to model textual information taken
+-- from the NVT ASCII character set.  By convention, objects
+-- with this syntax are declared as having
+
+--
+--      SIZE (0..255)
+
+PhysAddress ::=
+    OCTET STRING
+-- This data type is used to model media addresses.  For many
+-- types of media, this will be in a binary representation.
+-- For example, an ethernet address would be represented as
+-- a string of 6 octets.
+
+-- groups in MIB-II
+
+system       OBJECT IDENTIFIER ::= { mib-2 1 }
+
+interfaces   OBJECT IDENTIFIER ::= { mib-2 2 }
+
+at           OBJECT IDENTIFIER ::= { mib-2 3 }
+
+ip           OBJECT IDENTIFIER ::= { mib-2 4 }
+
+icmp         OBJECT IDENTIFIER ::= { mib-2 5 }
+
+tcp          OBJECT IDENTIFIER ::= { mib-2 6 }
+
+udp          OBJECT IDENTIFIER ::= { mib-2 7 }
+
+egp          OBJECT IDENTIFIER ::= { mib-2 8 }
+
+-- historical (some say hysterical)
+-- cmot      OBJECT IDENTIFIER ::= { mib-2 9 }
+
+transmission OBJECT IDENTIFIER ::= { mib-2 10 }
+
+snmp         OBJECT IDENTIFIER ::= { mib-2 11 }
+
+-- the System group
+
+-- Implementation of the System group is mandatory for all
+-- systems.  If an agent is not configured to have a value
+-- for any of these variables, a string of length 0 is
+-- returned.
+
+sysDescr OBJECT-TYPE
+    SYNTAX  DisplayString (SIZE (0..255))
+    ACCESS  read-only
+    STATUS  mandatory
+    DESCRIPTION
+            "A textual description of the entity.  This value
+            should include the full name and version
+            identification of the system's hardware type,
+            software operating-system, and networking
+            software.  It is mandatory that this only contain
+            printable ASCII characters."
+    ::= { system 1 }
+
+sysObjectID OBJECT-TYPE
+    SYNTAX  OBJECT IDENTIFIER
+    ACCESS  read-only
+    STATUS  mandatory
+    DESCRIPTION
+            "The vendor's authoritative identification of the
+            network management subsystem contained in the
+            entity.  This value is allocated within the SMI
+            enterprises subtree (1.3.6.1.4.1) and provides an
+            easy and unambiguous means for determining `what
+            kind of box' is being managed.  For example, if
+            vendor `Flintstones, Inc.' was assigned the
+            subtree 1.3.6.1.4.1.4242, it could assign the
+            identifier 1.3.6.1.4.1.4242.1.1 to its `Fred
+            Router'."
+    ::= { system 2 }
+
+sysUpTime OBJECT-TYPE
+    SYNTAX  TimeTicks
+    ACCESS  read-only
+    STATUS  mandatory
+    DESCRIPTION
+            "The time (in hundredths of a second) since the
+            network management portion of the system was last
+            re-initialized."
+    ::= { system 3 }
+
+sysContact OBJECT-TYPE
+    SYNTAX  DisplayString (SIZE (0..255))
+    ACCESS  read-write
+    STATUS  mandatory
+    DESCRIPTION
+            "The textual identification of the contact person
+            for this managed node, together with information
+            on how to contact this person."
+    ::= { system 4 }
+
+sysName OBJECT-TYPE
+    SYNTAX  DisplayString (SIZE (0..255))
+    ACCESS  read-write
+    STATUS  mandatory
+    DESCRIPTION
+            "An administratively-assigned name for this
+            managed node.  By convention, this is the node's
+            fully-qualified domain name."
+    ::= { system 5 }
+
+sysLocation OBJECT-TYPE
+    SYNTAX  DisplayString (SIZE (0..255))
+    ACCESS  read-write
+    STATUS  mandatory
+    DESCRIPTION
+            "The physical location of this node (e.g.,
+            `telephone closet, 3rd floor')."
+    ::= { system 6 }
+
+sysServices OBJECT-TYPE
+    SYNTAX  INTEGER (0..127)
+    ACCESS  read-only
+    STATUS  mandatory
+    DESCRIPTION
+            "A value which indicates the set of services that
+            this entity primarily offers.
+
+            The value is a sum.  This sum initially takes the
+            value zero, Then, for each layer, L, in the range
+            1 through 7, that this node performs transactions
+            for, 2 raised to (L - 1) is added to the sum.  For
+            example, a node which performs primarily routing
+            functions would have a value of 4 (2^(3-1)).  In
+            contrast, a node which is a host offering
+            application services would have a value of 72
+            (2^(4-1) + 2^(7-1)).  Note that in the context of
+            the Internet suite of protocols, values should be
+            calculated accordingly:
+
+                 layer  functionality
+                     1  physical (e.g., repeaters)
+                     2  datalink/subnetwork (e.g., bridges)
+                     3  internet (e.g., IP gateways)
+                     4  end-to-end  (e.g., IP hosts)
+                     7  applications (e.g., mail relays)
+
+            For systems including OSI protocols, layers 5 and
+            6 may also be counted."
+    ::= { system 7 }
+
+-- the Interfaces group
+
+-- Implementation of the Interfaces group is mandatory for
+-- all systems.
+
+ifNumber OBJECT-TYPE
+    SYNTAX  INTEGER
+    ACCESS  read-only
+    STATUS  mandatory
+    DESCRIPTION
+            "The number of network interfaces (regardless of
+            their current state) present on this system."
+    ::= { interfaces 1 }
+
+-- the Interfaces table
+
+-- The Interfaces table contains information on the entity's
+-- interfaces.  Each interface is thought of as being
+-- attached to a `subnetwork'.  Note that this term should
+-- not be confused with `subnet' which refers to an
+-- addressing partitioning scheme used in the Internet suite
+-- of protocols.
+
+ifTable OBJECT-TYPE
+    SYNTAX  SEQUENCE OF IfEntry
+    ACCESS  not-accessible
+    STATUS  mandatory
+    DESCRIPTION
+            "A list of interface entries.  The number of
+            entries is given by the value of ifNumber."
+    ::= { interfaces 2 }
+
+ifEntry OBJECT-TYPE
+    SYNTAX  IfEntry
+    ACCESS  not-accessible
+    STATUS  mandatory
+    DESCRIPTION
+            "An interface entry containing objects at the
+            subnetwork layer and below for a particular
+            interface."
+    INDEX   { ifIndex }
+    ::= { ifTable 1 }
+
+IfEntry ::=
+    SEQUENCE {
+        ifIndex
+            INTEGER,
+        ifDescr
+            DisplayString,
+        ifType
+            INTEGER,
+        ifMtu
+            INTEGER,
+        ifSpeed
+            Gauge,
+        ifPhysAddress
+            PhysAddress,
+        ifAdminStatus
+            INTEGER,
+        ifOperStatus
+            INTEGER,
+        ifLastChange
+            TimeTicks,
+        ifInOctets
+            Counter,
+        ifInUcastPkts
+            Counter,
+        ifInNUcastPkts
+            Counter,
+        ifInDiscards
+            Counter,
+        ifInErrors
+            Counter,
+        ifInUnknownProtos
+            Counter,
+        ifOutOctets
+            Counter,
+        ifOutUcastPkts
+            Counter,
+        ifOutNUcastPkts
+            Counter,
+        ifOutDiscards
+            Counter,
+        ifOutErrors
+            Counter,
+        ifOutQLen
+            Gauge,
+        ifSpecific
+            OBJECT IDENTIFIER
+    }
+
+ifIndex OBJECT-TYPE
+    SYNTAX  INTEGER
+    ACCESS  read-only
+    STATUS  mandatory
+    DESCRIPTION
+            "A unique value for each interface.  Its value
+            ranges between 1 and the value of ifNumber.  The
+            value for each interface must remain constant at
+            least from one re-initialization of the entity's
+            network management system to the next re-
+            initialization."
+    ::= { ifEntry 1 }
+
+ifDescr OBJECT-TYPE
+    SYNTAX  DisplayString (SIZE (0..255))
+    ACCESS  read-only
+    STATUS  mandatory
+    DESCRIPTION
+            "A textual string containing information about the
+            interface.  This string should include the name of
+            the manufacturer, the product name and the version
+            of the hardware interface."
+    ::= { ifEntry 2 }
+
+ifType OBJECT-TYPE
+    SYNTAX  INTEGER {
+                other(1),          -- none of the following
+                regular1822(2),
+                hdh1822(3),
+                ddn-x25(4),
+                rfc877-x25(5),
+                ethernet-csmacd(6),
+                iso88023-csmacd(7),
+                iso88024-tokenBus(8),
+                iso88025-tokenRing(9),
+                iso88026-man(10),
+                starLan(11),
+                proteon-10Mbit(12),
+                proteon-80Mbit(13),
+                hyperchannel(14),
+                fddi(15),
+                lapb(16),
+                sdlc(17),
+                ds1(18),           -- T-1
+                e1(19),            -- european equiv. of T-1
+                basicISDN(20),
+                primaryISDN(21),   -- proprietary serial
+                propPointToPointSerial(22),
+                ppp(23),
+                softwareLoopback(24),
+                eon(25),            -- CLNP over IP [11]
+                ethernet-3Mbit(26),
+                nsip(27),           -- XNS over IP
+                slip(28),           -- generic SLIP
+                ultra(29),          -- ULTRA technologies
+                ds3(30),            -- T-3
+                sip(31),            -- SMDS
+                frame-relay(32)
+            }
+    ACCESS  read-only
+    STATUS  mandatory
+    DESCRIPTION
+            "The type of interface, distinguished according to
+            the physical/link protocol(s) immediately `below'
+            the network layer in the protocol stack."
+    ::= { ifEntry 3 }
+
+ifMtu OBJECT-TYPE
+    SYNTAX  INTEGER
+    ACCESS  read-only
+    STATUS  mandatory
+    DESCRIPTION
+            "The size of the largest datagram which can be
+            sent/received on the interface, specified in
+            octets.  For interfaces that are used for
+            transmitting network datagrams, this is the size
+            of the largest network datagram that can be sent
+            on the interface."
+    ::= { ifEntry 4 }
+
+ifSpeed OBJECT-TYPE
+    SYNTAX  Gauge
+    ACCESS  read-only
+    STATUS  mandatory
+    DESCRIPTION
+            "An estimate of the interface's current bandwidth
+            in bits per second.  For interfaces which do not
+            vary in bandwidth or for those where no accurate
+            estimation can be made, this object should contain
+            the nominal bandwidth."
+    ::= { ifEntry 5 }
+
+ifPhysAddress OBJECT-TYPE
+    SYNTAX  PhysAddress
+    ACCESS  read-only
+    STATUS  mandatory
+    DESCRIPTION
+            "The interface's address at the protocol layer
+            immediately `below' the network layer in the
+            protocol stack.  For interfaces which do not have
+
+            such an address (e.g., a serial line), this object
+            should contain an octet string of zero length."
+    ::= { ifEntry 6 }
+
+ifAdminStatus OBJECT-TYPE
+    SYNTAX  INTEGER {
+                up(1),       -- ready to pass packets
+                down(2),
+                testing(3)   -- in some test mode
+            }
+    ACCESS  read-write
+    STATUS  mandatory
+    DESCRIPTION
+            "The desired state of the interface.  The
+            testing(3) state indicates that no operational
+            packets can be passed."
+    ::= { ifEntry 7 }
+
+ifOperStatus OBJECT-TYPE
+    SYNTAX  INTEGER {
+                up(1),       -- ready to pass packets
+                down(2),
+                testing(3)   -- in some test mode
+            }
+    ACCESS  read-only
+    STATUS  mandatory
+    DESCRIPTION
+            "The current operational state of the interface.
+            The testing(3) state indicates that no operational
+            packets can be passed."
+    ::= { ifEntry 8 }
+
+ifLastChange OBJECT-TYPE
+    SYNTAX  TimeTicks
+    ACCESS  read-only
+    STATUS  mandatory
+    DESCRIPTION
+            "The value of sysUpTime at the time the interface
+            entered its current operational state.  If the
+            current state was entered prior to the last re-
+            initialization of the local network management
+            subsystem, then this object contains a zero
+            value."
+    ::= { ifEntry 9 }
+
+ifInOctets OBJECT-TYPE
+    SYNTAX  Counter
+    ACCESS  read-only
+    STATUS  mandatory
+    DESCRIPTION
+            "The total number of octets received on the
+            interface, including framing characters."
+    ::= { ifEntry 10 }
+
+ifInUcastPkts OBJECT-TYPE
+    SYNTAX  Counter
+    ACCESS  read-only
+    STATUS  mandatory
+    DESCRIPTION
+            "The number of subnetwork-unicast packets
+            delivered to a higher-layer protocol."
+    ::= { ifEntry 11 }
+
+ifInNUcastPkts OBJECT-TYPE
+    SYNTAX  Counter
+    ACCESS  read-only
+    STATUS  mandatory
+    DESCRIPTION
+            "The number of non-unicast (i.e., subnetwork-
+            broadcast or subnetwork-multicast) packets
+            delivered to a higher-layer protocol."
+    ::= { ifEntry 12 }
+
+ifInDiscards OBJECT-TYPE
+    SYNTAX  Counter
+    ACCESS  read-only
+    STATUS  mandatory
+    DESCRIPTION
+            "The number of inbound packets which were chosen
+            to be discarded even though no errors had been
+            detected to prevent their being deliverable to a
+            higher-layer protocol.  One possible reason for
+            discarding such a packet could be to free up
+            buffer space."
+    ::= { ifEntry 13 }
+
+ifInErrors OBJECT-TYPE
+    SYNTAX  Counter
+    ACCESS  read-only
+    STATUS  mandatory
+    DESCRIPTION
+            "The number of inbound packets that contained
+            errors preventing them from being deliverable to a
+            higher-layer protocol."
+    ::= { ifEntry 14 }
+
+ifInUnknownProtos OBJECT-TYPE
+    SYNTAX  Counter
+    ACCESS  read-only
+    STATUS  mandatory
+    DESCRIPTION
+            "The number of packets received via the interface
+            which were discarded because of an unknown or
+            unsupported protocol."
+    ::= { ifEntry 15 }
+
+ifOutOctets OBJECT-TYPE
+    SYNTAX  Counter
+    ACCESS  read-only
+    STATUS  mandatory
+    DESCRIPTION
+            "The total number of octets transmitted out of the
+            interface, including framing characters."
+    ::= { ifEntry 16 }
+
+ifOutUcastPkts OBJECT-TYPE
+    SYNTAX  Counter
+    ACCESS  read-only
+    STATUS  mandatory
+    DESCRIPTION
+            "The total number of packets that higher-level
+            protocols requested be transmitted to a
+            subnetwork-unicast address, including those that
+            were discarded or not sent."
+    ::= { ifEntry 17 }
+
+ifOutNUcastPkts OBJECT-TYPE
+    SYNTAX  Counter
+    ACCESS  read-only
+    STATUS  mandatory
+    DESCRIPTION
+            "The total number of packets that higher-level
+            protocols requested be transmitted to a non-
+            unicast (i.e., a subnetwork-broadcast or
+            subnetwork-multicast) address, including those
+            that were discarded or not sent."
+    ::= { ifEntry 18 }
+
+ifOutDiscards OBJECT-TYPE
+    SYNTAX  Counter
+    ACCESS  read-only
+    STATUS  mandatory
+    DESCRIPTION
+            "The number of outbound packets which were chosen
+
+            to be discarded even though no errors had been
+            detected to prevent their being transmitted.  One
+            possible reason for discarding such a packet could
+            be to free up buffer space."
+    ::= { ifEntry 19 }
+
+ifOutErrors OBJECT-TYPE
+    SYNTAX  Counter
+    ACCESS  read-only
+    STATUS  mandatory
+    DESCRIPTION
+            "The number of outbound packets that could not be
+            transmitted because of errors."
+    ::= { ifEntry 20 }
+
+ifOutQLen OBJECT-TYPE
+    SYNTAX  Gauge
+    ACCESS  read-only
+    STATUS  mandatory
+    DESCRIPTION
+            "The length of the output packet queue (in
+            packets)."
+    ::= { ifEntry 21 }
+
+ifSpecific OBJECT-TYPE
+    SYNTAX  OBJECT IDENTIFIER
+    ACCESS  read-only
+    STATUS  mandatory
+    DESCRIPTION
+            "A reference to MIB definitions specific to the
+            particular media being used to realize the
+            interface.  For example, if the interface is
+            realized by an ethernet, then the value of this
+            object refers to a document defining objects
+            specific to ethernet.  If this information is not
+            present, its value should be set to the OBJECT
+            IDENTIFIER { 0 0 }, which is a syntatically valid
+            object identifier, and any conformant
+            implementation of ASN.1 and BER must be able to
+            generate and recognize this value."
+    ::= { ifEntry 22 }
+
+-- the Address Translation group
+
+-- Implementation of the Address Translation group is
+-- mandatory for all systems.  Note however that this group
+-- is deprecated by MIB-II. That is, it is being included
+
+-- solely for compatibility with MIB-I nodes, and will most
+-- likely be excluded from MIB-III nodes.  From MIB-II and
+-- onwards, each network protocol group contains its own
+-- address translation tables.
+
+-- The Address Translation group contains one table which is
+-- the union across all interfaces of the translation tables
+-- for converting a NetworkAddress (e.g., an IP address) into
+-- a subnetwork-specific address.  For lack of a better term,
+-- this document refers to such a subnetwork-specific address
+-- as a `physical' address.
+
+-- Examples of such translation tables are: for broadcast
+-- media where ARP is in use, the translation table is
+-- equivalent to the ARP cache; or, on an X.25 network where
+-- non-algorithmic translation to X.121 addresses is
+-- required, the translation table contains the
+-- NetworkAddress to X.121 address equivalences.
+
+atTable OBJECT-TYPE
+    SYNTAX  SEQUENCE OF AtEntry
+    ACCESS  not-accessible
+    STATUS  deprecated
+    DESCRIPTION
+            "The Address Translation tables contain the
+            NetworkAddress to `physical' address equivalences.
+            Some interfaces do not use translation tables for
+            determining address equivalences (e.g., DDN-X.25
+            has an algorithmic method); if all interfaces are
+            of this type, then the Address Translation table
+            is empty, i.e., has zero entries."
+    ::= { at 1 }
+
+atEntry OBJECT-TYPE
+    SYNTAX  AtEntry
+    ACCESS  not-accessible
+    STATUS  deprecated
+    DESCRIPTION
+            "Each entry contains one NetworkAddress to
+            `physical' address equivalence."
+    INDEX   { atIfIndex,
+              atNetAddress }
+    ::= { atTable 1 }
+
+AtEntry ::=
+    SEQUENCE {
+        atIfIndex
+            INTEGER,
+        atPhysAddress
+            PhysAddress,
+        atNetAddress
+            NetworkAddress
+    }
+
+atIfIndex OBJECT-TYPE
+    SYNTAX  INTEGER
+    ACCESS  read-write
+    STATUS  deprecated
+    DESCRIPTION
+            "The interface on which this entry's equivalence
+            is effective.  The interface identified by a
+            particular value of this index is the same
+            interface as identified by the same value of
+            ifIndex."
+    ::= { atEntry 1 }
+
+atPhysAddress OBJECT-TYPE
+    SYNTAX  PhysAddress
+    ACCESS  read-write
+    STATUS  deprecated
+    DESCRIPTION
+            "The media-dependent `physical' address.
+
+            Setting this object to a null string (one of zero
+            length) has the effect of invaliding the
+            corresponding entry in the atTable object.  That
+            is, it effectively dissasociates the interface
+            identified with said entry from the mapping
+            identified with said entry.  It is an
+            implementation-specific matter as to whether the
+            agent removes an invalidated entry from the table.
+            Accordingly, management stations must be prepared
+            to receive tabular information from agents that
+            corresponds to entries not currently in use.
+            Proper interpretation of such entries requires
+            examination of the relevant atPhysAddress object."
+    ::= { atEntry 2 }
+
+atNetAddress OBJECT-TYPE
+    SYNTAX  NetworkAddress
+    ACCESS  read-write
+    STATUS  deprecated
+    DESCRIPTION
+            "The NetworkAddress (e.g., the IP address)
+            corresponding to the media-dependent `physical'
+            address."
+    ::= { atEntry 3 }
+
+-- the IP group
+
+-- Implementation of the IP group is mandatory for all
+-- systems.
+
+ipForwarding OBJECT-TYPE
+    SYNTAX  INTEGER {
+                forwarding(1),    -- acting as a gateway
+                not-forwarding(2) -- NOT acting as a gateway
+            }
+    ACCESS  read-write
+    STATUS  mandatory
+    DESCRIPTION
+            "The indication of whether this entity is acting
+            as an IP gateway in respect to the forwarding of
+            datagrams received by, but not addressed to, this
+            entity.  IP gateways forward datagrams.  IP hosts
+            do not (except those source-routed via the host).
+
+            Note that for some managed nodes, this object may
+            take on only a subset of the values possible.
+            Accordingly, it is appropriate for an agent to
+            return a `badValue' response if a management
+            station attempts to change this object to an
+            inappropriate value."
+    ::= { ip 1 }
+
+ipDefaultTTL OBJECT-TYPE
+    SYNTAX  INTEGER
+    ACCESS  read-write
+    STATUS  mandatory
+    DESCRIPTION
+            "The default value inserted into the Time-To-Live
+            field of the IP header of datagrams originated at
+            this entity, whenever a TTL value is not supplied
+            by the transport layer protocol."
+    ::= { ip 2 }
+
+ipInReceives OBJECT-TYPE
+    SYNTAX  Counter
+    ACCESS  read-only
+    STATUS  mandatory
+    DESCRIPTION
+            "The total number of input datagrams received from
+            interfaces, including those received in error."
+    ::= { ip 3 }
+
+ipInHdrErrors OBJECT-TYPE
+    SYNTAX  Counter
+    ACCESS  read-only
+    STATUS  mandatory
+    DESCRIPTION
+            "The number of input datagrams discarded due to
+            errors in their IP headers, including bad
+            checksums, version number mismatch, other format
+            errors, time-to-live exceeded, errors discovered
+            in processing their IP options, etc."
+    ::= { ip 4 }
+
+ipInAddrErrors OBJECT-TYPE
+    SYNTAX  Counter
+    ACCESS  read-only
+    STATUS  mandatory
+    DESCRIPTION
+            "The number of input datagrams discarded because
+            the IP address in their IP header's destination
+            field was not a valid address to be received at
+            this entity.  This count includes invalid
+            addresses (e.g., 0.0.0.0) and addresses of
+            unsupported Classes (e.g., Class E).  For entities
+            which are not IP Gateways and therefore do not
+            forward datagrams, this counter includes datagrams
+            discarded because the destination address was not
+            a local address."
+    ::= { ip 5 }
+
+ipForwDatagrams OBJECT-TYPE
+    SYNTAX  Counter
+    ACCESS  read-only
+    STATUS  mandatory
+    DESCRIPTION
+            "The number of input datagrams for which this
+            entity was not their final IP destination, as a
+            result of which an attempt was made to find a
+            route to forward them to that final destination.
+            In entities which do not act as IP Gateways, this
+            counter will include only those packets which were
+            Source-Routed via this entity, and the Source-
+            Route option processing was successful."
+    ::= { ip 6 }
+
+ipInUnknownProtos OBJECT-TYPE
+    SYNTAX  Counter
+    ACCESS  read-only
+    STATUS  mandatory
+    DESCRIPTION
+            "The number of locally-addressed datagrams
+            received successfully but discarded because of an
+            unknown or unsupported protocol."
+    ::= { ip 7 }
+
+ipInDiscards OBJECT-TYPE
+    SYNTAX  Counter
+    ACCESS  read-only
+    STATUS  mandatory
+    DESCRIPTION
+            "The number of input IP datagrams for which no
+            problems were encountered to prevent their
+            continued processing, but which were discarded
+            (e.g., for lack of buffer space).  Note that this
+            counter does not include any datagrams discarded
+            while awaiting re-assembly."
+    ::= { ip 8 }
+
+ipInDelivers OBJECT-TYPE
+    SYNTAX  Counter
+    ACCESS  read-only
+    STATUS  mandatory
+    DESCRIPTION
+            "The total number of input datagrams successfully
+            delivered to IP user-protocols (including ICMP)."
+    ::= { ip 9 }
+
+ipOutRequests OBJECT-TYPE
+    SYNTAX  Counter
+    ACCESS  read-only
+    STATUS  mandatory
+    DESCRIPTION
+            "The total number of IP datagrams which local IP
+            user-protocols (including ICMP) supplied to IP in
+            requests for transmission.  Note that this counter
+            does not include any datagrams counted in
+            ipForwDatagrams."
+    ::= { ip 10 }
+
+ipOutDiscards OBJECT-TYPE
+    SYNTAX  Counter
+    ACCESS  read-only
+    STATUS  mandatory
+    DESCRIPTION
+            "The number of output IP datagrams for which no
+
+            problem was encountered to prevent their
+            transmission to their destination, but which were
+            discarded (e.g., for lack of buffer space).  Note
+            that this counter would include datagrams counted
+            in ipForwDatagrams if any such packets met this
+            (discretionary) discard criterion."
+    ::= { ip 11 }
+
+ipOutNoRoutes OBJECT-TYPE
+    SYNTAX  Counter
+    ACCESS  read-only
+    STATUS  mandatory
+    DESCRIPTION
+            "The number of IP datagrams discarded because no
+            route could be found to transmit them to their
+            destination.  Note that this counter includes any
+            packets counted in ipForwDatagrams which meet this
+            `no-route' criterion.  Note that this includes any
+            datagarms which a host cannot route because all of
+            its default gateways are down."
+    ::= { ip 12 }
+
+ipReasmTimeout OBJECT-TYPE
+    SYNTAX  INTEGER
+    ACCESS  read-only
+    STATUS  mandatory
+    DESCRIPTION
+            "The maximum number of seconds which received
+            fragments are held while they are awaiting
+            reassembly at this entity."
+    ::= { ip 13 }
+
+ipReasmReqds OBJECT-TYPE
+    SYNTAX  Counter
+    ACCESS  read-only
+    STATUS  mandatory
+    DESCRIPTION
+            "The number of IP fragments received which needed
+            to be reassembled at this entity."
+    ::= { ip 14 }
+
+ipReasmOKs OBJECT-TYPE
+    SYNTAX  Counter
+    ACCESS  read-only
+    STATUS  mandatory
+    DESCRIPTION
+            "The number of IP datagrams successfully re-
+            assembled."
+    ::= { ip 15 }
+
+ipReasmFails OBJECT-TYPE
+    SYNTAX  Counter
+    ACCESS  read-only
+    STATUS  mandatory
+    DESCRIPTION
+            "The number of failures detected by the IP re-
+            assembly algorithm (for whatever reason: timed
+            out, errors, etc).  Note that this is not
+            necessarily a count of discarded IP fragments
+            since some algorithms (notably the algorithm in
+            RFC 815) can lose track of the number of fragments
+            by combining them as they are received."
+    ::= { ip 16 }
+
+ipFragOKs OBJECT-TYPE
+    SYNTAX  Counter
+    ACCESS  read-only
+    STATUS  mandatory
+    DESCRIPTION
+            "The number of IP datagrams that have been
+            successfully fragmented at this entity."
+    ::= { ip 17 }
+
+ipFragFails OBJECT-TYPE
+    SYNTAX  Counter
+    ACCESS  read-only
+    STATUS  mandatory
+    DESCRIPTION
+            "The number of IP datagrams that have been
+            discarded because they needed to be fragmented at
+            this entity but could not be, e.g., because their
+            Don't Fragment flag was set."
+    ::= { ip 18 }
+
+ipFragCreates OBJECT-TYPE
+    SYNTAX  Counter
+    ACCESS  read-only
+    STATUS  mandatory
+    DESCRIPTION
+            "The number of IP datagram fragments that have
+            been generated as a result of fragmentation at
+            this entity."
+    ::= { ip 19 }
+
+-- the IP address table
+
+-- The IP address table contains this entity's IP addressing
+-- information.
+
+ipAddrTable OBJECT-TYPE
+    SYNTAX  SEQUENCE OF IpAddrEntry
+    ACCESS  not-accessible
+    STATUS  mandatory
+    DESCRIPTION
+            "The table of addressing information relevant to
+            this entity's IP addresses."
+    ::= { ip 20 }
+
+ipAddrEntry OBJECT-TYPE
+    SYNTAX  IpAddrEntry
+    ACCESS  not-accessible
+    STATUS  mandatory
+    DESCRIPTION
+            "The addressing information for one of this
+            entity's IP addresses."
+    INDEX   { ipAdEntAddr }
+    ::= { ipAddrTable 1 }
+
+IpAddrEntry ::=
+    SEQUENCE {
+        ipAdEntAddr
+            IpAddress,
+        ipAdEntIfIndex
+            INTEGER,
+        ipAdEntNetMask
+            IpAddress,
+        ipAdEntBcastAddr
+            INTEGER,
+        ipAdEntReasmMaxSize
+            INTEGER (0..65535)
+    }
+
+ipAdEntAddr OBJECT-TYPE
+    SYNTAX  IpAddress
+    ACCESS  read-only
+    STATUS  mandatory
+    DESCRIPTION
+            "The IP address to which this entry's addressing
+            information pertains."
+    ::= { ipAddrEntry 1 }
+
+ipAdEntIfIndex OBJECT-TYPE
+    SYNTAX  INTEGER
+    ACCESS  read-only
+    STATUS  mandatory
+    DESCRIPTION
+            "The index value which uniquely identifies the
+            interface to which this entry is applicable.  The
+            interface identified by a particular value of this
+            index is the same interface as identified by the
+            same value of ifIndex."
+    ::= { ipAddrEntry 2 }
+
+ipAdEntNetMask OBJECT-TYPE
+    SYNTAX  IpAddress
+    ACCESS  read-only
+    STATUS  mandatory
+    DESCRIPTION
+            "The subnet mask associated with the IP address of
+            this entry.  The value of the mask is an IP
+            address with all the network bits set to 1 and all
+            the hosts bits set to 0."
+    ::= { ipAddrEntry 3 }
+
+ipAdEntBcastAddr OBJECT-TYPE
+    SYNTAX  INTEGER
+    ACCESS  read-only
+    STATUS  mandatory
+    DESCRIPTION
+            "The value of the least-significant bit in the IP
+            broadcast address used for sending datagrams on
+            the (logical) interface associated with the IP
+            address of this entry.  For example, when the
+            Internet standard all-ones broadcast address is
+            used, the value will be 1.  This value applies to
+            both the subnet and network broadcasts addresses
+            used by the entity on this (logical) interface."
+    ::= { ipAddrEntry 4 }
+
+ipAdEntReasmMaxSize OBJECT-TYPE
+    SYNTAX  INTEGER (0..65535)
+    ACCESS  read-only
+    STATUS  mandatory
+    DESCRIPTION
+            "The size of the largest IP datagram which this
+            entity can re-assemble from incoming IP fragmented
+            datagrams received on this interface."
+    ::= { ipAddrEntry 5 }
+
+-- the IP routing table
+
+-- The IP routing table contains an entry for each route
+-- presently known to this entity.
+
+ipRouteTable OBJECT-TYPE
+    SYNTAX  SEQUENCE OF IpRouteEntry
+    ACCESS  not-accessible
+    STATUS  mandatory
+    DESCRIPTION
+            "This entity's IP Routing table."
+    ::= { ip 21 }
+
+ipRouteEntry OBJECT-TYPE
+    SYNTAX  IpRouteEntry
+    ACCESS  not-accessible
+    STATUS  mandatory
+    DESCRIPTION
+            "A route to a particular destination."
+    INDEX   { ipRouteDest }
+    ::= { ipRouteTable 1 }
+
+IpRouteEntry ::=
+    SEQUENCE {
+        ipRouteDest
+            IpAddress,
+        ipRouteIfIndex
+            INTEGER,
+        ipRouteMetric1
+            INTEGER,
+        ipRouteMetric2
+            INTEGER,
+        ipRouteMetric3
+            INTEGER,
+        ipRouteMetric4
+            INTEGER,
+        ipRouteNextHop
+            IpAddress,
+        ipRouteType
+            INTEGER,
+        ipRouteProto
+            INTEGER,
+        ipRouteAge
+            INTEGER,
+        ipRouteMask
+            IpAddress,
+        ipRouteMetric5
+            INTEGER,
+        ipRouteInfo
+            OBJECT IDENTIFIER
+    }
+
+ipRouteDest OBJECT-TYPE
+    SYNTAX  IpAddress
+    ACCESS  read-write
+    STATUS  mandatory
+    DESCRIPTION
+            "The destination IP address of this route.  An
+            entry with a value of 0.0.0.0 is considered a
+            default route.  Multiple routes to a single
+            destination can appear in the table, but access to
+            such multiple entries is dependent on the table-
+            access mechanisms defined by the network
+            management protocol in use."
+    ::= { ipRouteEntry 1 }
+
+ipRouteIfIndex OBJECT-TYPE
+    SYNTAX  INTEGER
+    ACCESS  read-write
+    STATUS  mandatory
+    DESCRIPTION
+            "The index value which uniquely identifies the
+            local interface through which the next hop of this
+            route should be reached.  The interface identified
+            by a particular value of this index is the same
+            interface as identified by the same value of
+            ifIndex."
+    ::= { ipRouteEntry 2 }
+
+ipRouteMetric1 OBJECT-TYPE
+    SYNTAX  INTEGER
+    ACCESS  read-write
+    STATUS  mandatory
+    DESCRIPTION
+            "The primary routing metric for this route.  The
+            semantics of this metric are determined by the
+            routing-protocol specified in the route's
+            ipRouteProto value.  If this metric is not used,
+            its value should be set to -1."
+    ::= { ipRouteEntry 3 }
+
+ipRouteMetric2 OBJECT-TYPE
+    SYNTAX  INTEGER
+    ACCESS  read-write
+    STATUS  mandatory
+    DESCRIPTION
+            "An alternate routing metric for this route.  The
+            semantics of this metric are determined by the
+            routing-protocol specified in the route's
+            ipRouteProto value.  If this metric is not used,
+            its value should be set to -1."
+    ::= { ipRouteEntry 4 }
+
+ipRouteMetric3 OBJECT-TYPE
+    SYNTAX  INTEGER
+    ACCESS  read-write
+    STATUS  mandatory
+    DESCRIPTION
+            "An alternate routing metric for this route.  The
+            semantics of this metric are determined by the
+            routing-protocol specified in the route's
+            ipRouteProto value.  If this metric is not used,
+            its value should be set to -1."
+    ::= { ipRouteEntry 5 }
+
+ipRouteMetric4 OBJECT-TYPE
+    SYNTAX  INTEGER
+    ACCESS  read-write
+    STATUS  mandatory
+    DESCRIPTION
+            "An alternate routing metric for this route.  The
+            semantics of this metric are determined by the
+            routing-protocol specified in the route's
+            ipRouteProto value.  If this metric is not used,
+            its value should be set to -1."
+    ::= { ipRouteEntry 6 }
+
+ipRouteNextHop OBJECT-TYPE
+    SYNTAX  IpAddress
+    ACCESS  read-write
+    STATUS  mandatory
+    DESCRIPTION
+            "The IP address of the next hop of this route.
+            (In the case of a route bound to an interface
+            which is realized via a broadcast media, the value
+            of this field is the agent's IP address on that
+            interface.)"
+    ::= { ipRouteEntry 7 }
+
+ipRouteType OBJECT-TYPE
+    SYNTAX  INTEGER {
+                other(1),        -- none of the following
+
+                invalid(2),      -- an invalidated route
+
+                                 -- route to directly
+                direct(3),       -- connected (sub-)network
+
+                                 -- route to a non-local
+                indirect(4)      -- host/network/sub-network
+            }
+    ACCESS  read-write
+    STATUS  mandatory
+    DESCRIPTION
+            "The type of route.  Note that the values
+            direct(3) and indirect(4) refer to the notion of
+            direct and indirect routing in the IP
+            architecture.
+
+            Setting this object to the value invalid(2) has
+            the effect of invalidating the corresponding entry
+            in the ipRouteTable object.  That is, it
+            effectively dissasociates the destination
+            identified with said entry from the route
+            identified with said entry.  It is an
+            implementation-specific matter as to whether the
+            agent removes an invalidated entry from the table.
+            Accordingly, management stations must be prepared
+            to receive tabular information from agents that
+            corresponds to entries not currently in use.
+            Proper interpretation of such entries requires
+            examination of the relevant ipRouteType object."
+    ::= { ipRouteEntry 8 }
+
+ipRouteProto OBJECT-TYPE
+    SYNTAX  INTEGER {
+                other(1),       -- none of the following
+
+                                -- non-protocol information,
+                                -- e.g., manually configured
+                local(2),       -- entries
+
+                                -- set via a network
+                netmgmt(3),     -- management protocol
+
+                                -- obtained via ICMP,
+                icmp(4),        -- e.g., Redirect
+
+                                -- the remaining values are
+                                -- all gateway routing
+                                -- protocols
+                egp(5),
+                ggp(6),
+                hello(7),
+                rip(8),
+                is-is(9),
+                es-is(10),
+                ciscoIgrp(11),
+                bbnSpfIgp(12),
+                ospf(13),
+                bgp(14)
+            }
+    ACCESS  read-only
+    STATUS  mandatory
+    DESCRIPTION
+            "The routing mechanism via which this route was
+            learned.  Inclusion of values for gateway routing
+            protocols is not intended to imply that hosts
+            should support those protocols."
+    ::= { ipRouteEntry 9 }
+
+ipRouteAge OBJECT-TYPE
+    SYNTAX  INTEGER
+    ACCESS  read-write
+    STATUS  mandatory
+    DESCRIPTION
+            "The number of seconds since this route was last
+            updated or otherwise determined to be correct.
+            Note that no semantics of `too old' can be implied
+            except through knowledge of the routing protocol
+            by which the route was learned."
+    ::= { ipRouteEntry 10 }
+
+ipRouteMask OBJECT-TYPE
+    SYNTAX  IpAddress
+    ACCESS  read-write
+    STATUS  mandatory
+    DESCRIPTION
+            "Indicate the mask to be logical-ANDed with the
+            destination address before being compared to the
+            value in the ipRouteDest field.  For those systems
+            that do not support arbitrary subnet masks, an
+            agent constructs the value of the ipRouteMask by
+            determining whether the value of the correspondent
+            ipRouteDest field belong to a class-A, B, or C
+            network, and then using one of:
+
+                 mask           network
+                 255.0.0.0      class-A
+                 255.255.0.0    class-B
+                 255.255.255.0  class-C
+
+            If the value of the ipRouteDest is 0.0.0.0 (a
+            default route), then the mask value is also
+            0.0.0.0.  It should be noted that all IP routing
+            subsystems implicitly use this mechanism."
+    ::= { ipRouteEntry 11 }
+
+ipRouteMetric5 OBJECT-TYPE
+    SYNTAX  INTEGER
+    ACCESS  read-write
+    STATUS  mandatory
+    DESCRIPTION
+            "An alternate routing metric for this route.  The
+            semantics of this metric are determined by the
+            routing-protocol specified in the route's
+            ipRouteProto value.  If this metric is not used,
+            its value should be set to -1."
+    ::= { ipRouteEntry 12 }
+
+ipRouteInfo OBJECT-TYPE
+    SYNTAX  OBJECT IDENTIFIER
+    ACCESS  read-only
+    STATUS  mandatory
+    DESCRIPTION
+            "A reference to MIB definitions specific to the
+            particular routing protocol which is responsible
+            for this route, as determined by the value
+            specified in the route's ipRouteProto value.  If
+            this information is not present, its value should
+            be set to the OBJECT IDENTIFIER { 0 0 }, which is
+            a syntatically valid object identifier, and any
+            conformant implementation of ASN.1 and BER must be
+            able to generate and recognize this value."
+    ::= { ipRouteEntry 13 }
+
+-- the IP Address Translation table
+
+-- The IP address translation table contain the IpAddress to
+-- `physical' address equivalences.  Some interfaces do not
+-- use translation tables for determining address
+-- equivalences (e.g., DDN-X.25 has an algorithmic method);
+-- if all interfaces are of this type, then the Address
+-- Translation table is empty, i.e., has zero entries.
+
+ipNetToMediaTable OBJECT-TYPE
+    SYNTAX  SEQUENCE OF IpNetToMediaEntry
+    ACCESS  not-accessible
+    STATUS  mandatory
+    DESCRIPTION
+            "The IP Address Translation table used for mapping
+            from IP addresses to physical addresses."
+    ::= { ip 22 }
+
+ipNetToMediaEntry OBJECT-TYPE
+    SYNTAX  IpNetToMediaEntry
+    ACCESS  not-accessible
+    STATUS  mandatory
+    DESCRIPTION
+            "Each entry contains one IpAddress to `physical'
+            address equivalence."
+    INDEX   { ipNetToMediaIfIndex,
+              ipNetToMediaNetAddress }
+    ::= { ipNetToMediaTable 1 }
+
+IpNetToMediaEntry ::=
+    SEQUENCE {
+        ipNetToMediaIfIndex
+            INTEGER,
+        ipNetToMediaPhysAddress
+            PhysAddress,
+        ipNetToMediaNetAddress
+            IpAddress,
+        ipNetToMediaType
+            INTEGER
+    }
+
+ipNetToMediaIfIndex OBJECT-TYPE
+    SYNTAX  INTEGER
+    ACCESS  read-write
+    STATUS  mandatory
+    DESCRIPTION
+            "The interface on which this entry's equivalence
+            is effective.  The interface identified by a
+            particular value of this index is the same
+            interface as identified by the same value of
+            ifIndex."
+    ::= { ipNetToMediaEntry 1 }
+
+ipNetToMediaPhysAddress OBJECT-TYPE
+    SYNTAX  PhysAddress
+    ACCESS  read-write
+    STATUS  mandatory
+    DESCRIPTION
+            "The media-dependent `physical' address."
+    ::= { ipNetToMediaEntry 2 }
+
+ipNetToMediaNetAddress OBJECT-TYPE
+    SYNTAX  IpAddress
+    ACCESS  read-write
+    STATUS  mandatory
+    DESCRIPTION
+            "The IpAddress corresponding to the media-
+            dependent `physical' address."
+    ::= { ipNetToMediaEntry 3 }
+
+ipNetToMediaType OBJECT-TYPE
+    SYNTAX  INTEGER {
+                other(1),        -- none of the following
+                invalid(2),      -- an invalidated mapping
+                dynamic(3),
+                static(4)
+            }
+    ACCESS  read-write
+    STATUS  mandatory
+    DESCRIPTION
+            "The type of mapping.
+
+            Setting this object to the value invalid(2) has
+            the effect of invalidating the corresponding entry
+            in the ipNetToMediaTable.  That is, it effectively
+            dissasociates the interface identified with said
+            entry from the mapping identified with said entry.
+            It is an implementation-specific matter as to
+            whether the agent removes an invalidated entry
+            from the table.  Accordingly, management stations
+            must be prepared to receive tabular information
+            from agents that corresponds to entries not
+            currently in use.  Proper interpretation of such
+            entries requires examination of the relevant
+            ipNetToMediaType object."
+    ::= { ipNetToMediaEntry 4 }
+
+-- additional IP objects
+
+ipRoutingDiscards OBJECT-TYPE
+    SYNTAX  Counter
+    ACCESS  read-only
+    STATUS  mandatory
+    DESCRIPTION
+            "The number of routing entries which were chosen
+            to be discarded even though they are valid.  One
+            possible reason for discarding such an entry could
+            be to free-up buffer space for other routing
+
+            entries."
+    ::= { ip 23 }
+
+-- the ICMP group
+
+-- Implementation of the ICMP group is mandatory for all
+-- systems.
+
+icmpInMsgs OBJECT-TYPE
+    SYNTAX  Counter
+    ACCESS  read-only
+    STATUS  mandatory
+    DESCRIPTION
+            "The total number of ICMP messages which the
+            entity received.  Note that this counter includes
+            all those counted by icmpInErrors."
+    ::= { icmp 1 }
+
+icmpInErrors OBJECT-TYPE
+    SYNTAX  Counter
+    ACCESS  read-only
+    STATUS  mandatory
+    DESCRIPTION
+            "The number of ICMP messages which the entity
+            received but determined as having ICMP-specific
+            errors (bad ICMP checksums, bad length, etc.)."
+    ::= { icmp 2 }
+
+icmpInDestUnreachs OBJECT-TYPE
+    SYNTAX  Counter
+    ACCESS  read-only
+    STATUS  mandatory
+    DESCRIPTION
+            "The number of ICMP Destination Unreachable
+            messages received."
+    ::= { icmp 3 }
+
+icmpInTimeExcds OBJECT-TYPE
+    SYNTAX  Counter
+    ACCESS  read-only
+    STATUS  mandatory
+    DESCRIPTION
+            "The number of ICMP Time Exceeded messages
+            received."
+    ::= { icmp 4 }
+
+icmpInParmProbs OBJECT-TYPE
+    SYNTAX  Counter
+    ACCESS  read-only
+    STATUS  mandatory
+    DESCRIPTION
+            "The number of ICMP Parameter Problem messages
+            received."
+    ::= { icmp 5 }
+
+icmpInSrcQuenchs OBJECT-TYPE
+    SYNTAX  Counter
+    ACCESS  read-only
+    STATUS  mandatory
+    DESCRIPTION
+            "The number of ICMP Source Quench messages
+            received."
+    ::= { icmp 6 }
+
+icmpInRedirects OBJECT-TYPE
+    SYNTAX  Counter
+    ACCESS  read-only
+    STATUS  mandatory
+    DESCRIPTION
+            "The number of ICMP Redirect messages received."
+    ::= { icmp 7 }
+
+icmpInEchos OBJECT-TYPE
+    SYNTAX  Counter
+    ACCESS  read-only
+    STATUS  mandatory
+    DESCRIPTION
+            "The number of ICMP Echo (request) messages
+            received."
+    ::= { icmp 8 }
+
+icmpInEchoReps OBJECT-TYPE
+    SYNTAX  Counter
+    ACCESS  read-only
+    STATUS  mandatory
+    DESCRIPTION
+            "The number of ICMP Echo Reply messages received."
+    ::= { icmp 9 }
+
+icmpInTimestamps OBJECT-TYPE
+    SYNTAX  Counter
+    ACCESS  read-only
+    STATUS  mandatory
+    DESCRIPTION
+            "The number of ICMP Timestamp (request) messages
+            received."
+    ::= { icmp 10 }
+
+icmpInTimestampReps OBJECT-TYPE
+    SYNTAX  Counter
+    ACCESS  read-only
+    STATUS  mandatory
+    DESCRIPTION
+            "The number of ICMP Timestamp Reply messages
+            received."
+    ::= { icmp 11 }
+
+icmpInAddrMasks OBJECT-TYPE
+    SYNTAX  Counter
+    ACCESS  read-only
+    STATUS  mandatory
+    DESCRIPTION
+            "The number of ICMP Address Mask Request messages
+            received."
+    ::= { icmp 12 }
+
+icmpInAddrMaskReps OBJECT-TYPE
+    SYNTAX  Counter
+    ACCESS  read-only
+    STATUS  mandatory
+    DESCRIPTION
+            "The number of ICMP Address Mask Reply messages
+            received."
+    ::= { icmp 13 }
+
+icmpOutMsgs OBJECT-TYPE
+    SYNTAX  Counter
+    ACCESS  read-only
+    STATUS  mandatory
+    DESCRIPTION
+            "The total number of ICMP messages which this
+            entity attempted to send.  Note that this counter
+            includes all those counted by icmpOutErrors."
+    ::= { icmp 14 }
+
+icmpOutErrors OBJECT-TYPE
+    SYNTAX  Counter
+    ACCESS  read-only
+    STATUS  mandatory
+    DESCRIPTION
+            "The number of ICMP messages which this entity did
+            not send due to problems discovered within ICMP
+
+            such as a lack of buffers.  This value should not
+            include errors discovered outside the ICMP layer
+            such as the inability of IP to route the resultant
+            datagram.  In some implementations there may be no
+            types of error which contribute to this counter's
+            value."
+    ::= { icmp 15 }
+
+icmpOutDestUnreachs OBJECT-TYPE
+    SYNTAX  Counter
+    ACCESS  read-only
+    STATUS  mandatory
+    DESCRIPTION
+            "The number of ICMP Destination Unreachable
+            messages sent."
+    ::= { icmp 16 }
+
+icmpOutTimeExcds OBJECT-TYPE
+    SYNTAX  Counter
+    ACCESS  read-only
+    STATUS  mandatory
+    DESCRIPTION
+            "The number of ICMP Time Exceeded messages sent."
+    ::= { icmp 17 }
+
+icmpOutParmProbs OBJECT-TYPE
+    SYNTAX  Counter
+    ACCESS  read-only
+    STATUS  mandatory
+    DESCRIPTION
+            "The number of ICMP Parameter Problem messages
+            sent."
+    ::= { icmp 18 }
+
+icmpOutSrcQuenchs OBJECT-TYPE
+    SYNTAX  Counter
+    ACCESS  read-only
+    STATUS  mandatory
+    DESCRIPTION
+            "The number of ICMP Source Quench messages sent."
+    ::= { icmp 19 }
+
+icmpOutRedirects OBJECT-TYPE
+    SYNTAX  Counter
+    ACCESS  read-only
+    STATUS  mandatory
+    DESCRIPTION
+            "The number of ICMP Redirect messages sent.  For a
+
+            host, this object will always be zero, since hosts
+            do not send redirects."
+    ::= { icmp 20 }
+
+icmpOutEchos OBJECT-TYPE
+    SYNTAX  Counter
+    ACCESS  read-only
+    STATUS  mandatory
+    DESCRIPTION
+            "The number of ICMP Echo (request) messages sent."
+    ::= { icmp 21 }
+
+icmpOutEchoReps OBJECT-TYPE
+    SYNTAX  Counter
+    ACCESS  read-only
+    STATUS  mandatory
+    DESCRIPTION
+            "The number of ICMP Echo Reply messages sent."
+    ::= { icmp 22 }
+
+icmpOutTimestamps OBJECT-TYPE
+    SYNTAX  Counter
+    ACCESS  read-only
+    STATUS  mandatory
+    DESCRIPTION
+            "The number of ICMP Timestamp (request) messages
+            sent."
+    ::= { icmp 23 }
+
+icmpOutTimestampReps OBJECT-TYPE
+    SYNTAX  Counter
+    ACCESS  read-only
+    STATUS  mandatory
+    DESCRIPTION
+            "The number of ICMP Timestamp Reply messages
+            sent."
+    ::= { icmp 24 }
+
+icmpOutAddrMasks OBJECT-TYPE
+    SYNTAX  Counter
+    ACCESS  read-only
+    STATUS  mandatory
+    DESCRIPTION
+            "The number of ICMP Address Mask Request messages
+            sent."
+    ::= { icmp 25 }
+
+icmpOutAddrMaskReps OBJECT-TYPE
+    SYNTAX  Counter
+    ACCESS  read-only
+    STATUS  mandatory
+    DESCRIPTION
+            "The number of ICMP Address Mask Reply messages
+            sent."
+    ::= { icmp 26 }
+
+-- the TCP group
+
+-- Implementation of the TCP group is mandatory for all
+-- systems that implement the TCP.
+
+-- Note that instances of object types that represent
+-- information about a particular TCP connection are
+-- transient; they persist only as long as the connection
+-- in question.
+
+tcpRtoAlgorithm OBJECT-TYPE
+    SYNTAX  INTEGER {
+                other(1),    -- none of the following
+
+                constant(2), -- a constant rto
+                rsre(3),     -- MIL-STD-1778, Appendix B
+                vanj(4)      -- Van Jacobson's algorithm [10]
+            }
+    ACCESS  read-only
+    STATUS  mandatory
+    DESCRIPTION
+            "The algorithm used to determine the timeout value
+            used for retransmitting unacknowledged octets."
+    ::= { tcp 1 }
+
+tcpRtoMin OBJECT-TYPE
+    SYNTAX  INTEGER
+    ACCESS  read-only
+    STATUS  mandatory
+    DESCRIPTION
+            "The minimum value permitted by a TCP
+            implementation for the retransmission timeout,
+            measured in milliseconds.  More refined semantics
+            for objects of this type depend upon the algorithm
+            used to determine the retransmission timeout.  In
+            particular, when the timeout algorithm is rsre(3),
+            an object of this type has the semantics of the
+            LBOUND quantity described in RFC 793."
+    ::= { tcp 2 }
+
+tcpRtoMax OBJECT-TYPE
+    SYNTAX  INTEGER
+    ACCESS  read-only
+    STATUS  mandatory
+    DESCRIPTION
+            "The maximum value permitted by a TCP
+            implementation for the retransmission timeout,
+            measured in milliseconds.  More refined semantics
+            for objects of this type depend upon the algorithm
+            used to determine the retransmission timeout.  In
+            particular, when the timeout algorithm is rsre(3),
+            an object of this type has the semantics of the
+            UBOUND quantity described in RFC 793."
+    ::= { tcp 3 }
+
+tcpMaxConn OBJECT-TYPE
+    SYNTAX  INTEGER
+    ACCESS  read-only
+    STATUS  mandatory
+    DESCRIPTION
+            "The limit on the total number of TCP connections
+            the entity can support.  In entities where the
+            maximum number of connections is dynamic, this
+            object should contain the value -1."
+    ::= { tcp 4 }
+
+tcpActiveOpens OBJECT-TYPE
+    SYNTAX  Counter
+    ACCESS  read-only
+    STATUS  mandatory
+    DESCRIPTION
+            "The number of times TCP connections have made a
+            direct transition to the SYN-SENT state from the
+            CLOSED state."
+    ::= { tcp 5 }
+
+tcpPassiveOpens OBJECT-TYPE
+    SYNTAX  Counter
+    ACCESS  read-only
+    STATUS  mandatory
+    DESCRIPTION
+            "The number of times TCP connections have made a
+            direct transition to the SYN-RCVD state from the
+            LISTEN state."
+    ::= { tcp 6 }
+
+tcpAttemptFails OBJECT-TYPE
+    SYNTAX  Counter
+    ACCESS  read-only
+    STATUS  mandatory
+    DESCRIPTION
+            "The number of times TCP connections have made a
+            direct transition to the CLOSED state from either
+            the SYN-SENT state or the SYN-RCVD state, plus the
+            number of times TCP connections have made a direct
+            transition to the LISTEN state from the SYN-RCVD
+            state."
+    ::= { tcp 7 }
+
+tcpEstabResets OBJECT-TYPE
+    SYNTAX  Counter
+    ACCESS  read-only
+    STATUS  mandatory
+    DESCRIPTION
+            "The number of times TCP connections have made a
+            direct transition to the CLOSED state from either
+            the ESTABLISHED state or the CLOSE-WAIT state."
+    ::= { tcp 8 }
+
+tcpCurrEstab OBJECT-TYPE
+    SYNTAX  Gauge
+    ACCESS  read-only
+    STATUS  mandatory
+    DESCRIPTION
+            "The number of TCP connections for which the
+            current state is either ESTABLISHED or CLOSE-
+            WAIT."
+    ::= { tcp 9 }
+
+tcpInSegs OBJECT-TYPE
+    SYNTAX  Counter
+    ACCESS  read-only
+    STATUS  mandatory
+    DESCRIPTION
+            "The total number of segments received, including
+            those received in error.  This count includes
+            segments received on currently established
+            connections."
+    ::= { tcp 10 }
+
+tcpOutSegs OBJECT-TYPE
+    SYNTAX  Counter
+    ACCESS  read-only
+    STATUS  mandatory
+    DESCRIPTION
+            "The total number of segments sent, including
+            those on current connections but excluding those
+            containing only retransmitted octets."
+    ::= { tcp 11 }
+
+tcpRetransSegs OBJECT-TYPE
+    SYNTAX  Counter
+    ACCESS  read-only
+    STATUS  mandatory
+    DESCRIPTION
+            "The total number of segments retransmitted - that
+            is, the number of TCP segments transmitted
+            containing one or more previously transmitted
+            octets."
+    ::= { tcp 12 }
+
+-- the TCP Connection table
+
+-- The TCP connection table contains information about this
+-- entity's existing TCP connections.
+
+tcpConnTable OBJECT-TYPE
+    SYNTAX  SEQUENCE OF TcpConnEntry
+    ACCESS  not-accessible
+    STATUS  mandatory
+    DESCRIPTION
+            "A table containing TCP connection-specific
+            information."
+    ::= { tcp 13 }
+
+tcpConnEntry OBJECT-TYPE
+    SYNTAX  TcpConnEntry
+    ACCESS  not-accessible
+    STATUS  mandatory
+    DESCRIPTION
+            "Information about a particular current TCP
+            connection.  An object of this type is transient,
+            in that it ceases to exist when (or soon after)
+            the connection makes the transition to the CLOSED
+            state."
+    INDEX   { tcpConnLocalAddress,
+              tcpConnLocalPort,
+              tcpConnRemAddress,
+              tcpConnRemPort }
+    ::= { tcpConnTable 1 }
+
+TcpConnEntry ::=
+    SEQUENCE {
+        tcpConnState
+            INTEGER,
+        tcpConnLocalAddress
+            IpAddress,
+        tcpConnLocalPort
+            INTEGER (0..65535),
+        tcpConnRemAddress
+            IpAddress,
+        tcpConnRemPort
+            INTEGER (0..65535)
+    }
+
+tcpConnState OBJECT-TYPE
+    SYNTAX  INTEGER {
+                closed(1),
+                listen(2),
+                synSent(3),
+                synReceived(4),
+                established(5),
+                finWait1(6),
+                finWait2(7),
+                closeWait(8),
+                lastAck(9),
+                closing(10),
+                timeWait(11),
+                deleteTCB(12)
+            }
+    ACCESS  read-write
+    STATUS  mandatory
+    DESCRIPTION
+            "The state of this TCP connection.
+
+            The only value which may be set by a management
+            station is deleteTCB(12).  Accordingly, it is
+            appropriate for an agent to return a `badValue'
+            response if a management station attempts to set
+            this object to any other value.
+
+            If a management station sets this object to the
+            value deleteTCB(12), then this has the effect of
+            deleting the TCB (as defined in RFC 793) of the
+            corresponding connection on the managed node,
+            resulting in immediate termination of the
+            connection.
+
+            As an implementation-specific option, a RST
+
+            segment may be sent from the managed node to the
+            other TCP endpoint (note however that RST segments
+            are not sent reliably)."
+    ::= { tcpConnEntry 1 }
+
+tcpConnLocalAddress OBJECT-TYPE
+    SYNTAX  IpAddress
+    ACCESS  read-only
+    STATUS  mandatory
+    DESCRIPTION
+            "The local IP address for this TCP connection.  In
+            the case of a connection in the listen state which
+            is willing to accept connections for any IP
+            interface associated with the node, the value
+            0.0.0.0 is used."
+    ::= { tcpConnEntry 2 }
+
+tcpConnLocalPort OBJECT-TYPE
+    SYNTAX  INTEGER (0..65535)
+    ACCESS  read-only
+    STATUS  mandatory
+    DESCRIPTION
+            "The local port number for this TCP connection."
+    ::= { tcpConnEntry 3 }
+
+tcpConnRemAddress OBJECT-TYPE
+    SYNTAX  IpAddress
+    ACCESS  read-only
+    STATUS  mandatory
+    DESCRIPTION
+            "The remote IP address for this TCP connection."
+    ::= { tcpConnEntry 4 }
+
+tcpConnRemPort OBJECT-TYPE
+    SYNTAX  INTEGER (0..65535)
+    ACCESS  read-only
+    STATUS  mandatory
+    DESCRIPTION
+            "The remote port number for this TCP connection."
+    ::= { tcpConnEntry 5 }
+
+-- additional TCP objects
+
+tcpInErrs OBJECT-TYPE
+    SYNTAX  Counter
+    ACCESS  read-only
+    STATUS  mandatory
+    DESCRIPTION
+            "The total number of segments received in error
+            (e.g., bad TCP checksums)."
+    ::= { tcp 14 }
+
+tcpOutRsts OBJECT-TYPE
+    SYNTAX  Counter
+    ACCESS  read-only
+    STATUS  mandatory
+    DESCRIPTION
+            "The number of TCP segments sent containing the
+            RST flag."
+    ::= { tcp 15 }
+
+-- the UDP group
+
+-- Implementation of the UDP group is mandatory for all
+-- systems which implement the UDP.
+
+udpInDatagrams OBJECT-TYPE
+    SYNTAX  Counter
+    ACCESS  read-only
+    STATUS  mandatory
+    DESCRIPTION
+            "The total number of UDP datagrams delivered to
+            UDP users."
+    ::= { udp 1 }
+
+udpNoPorts OBJECT-TYPE
+    SYNTAX  Counter
+    ACCESS  read-only
+    STATUS  mandatory
+    DESCRIPTION
+            "The total number of received UDP datagrams for
+            which there was no application at the destination
+            port."
+    ::= { udp 2 }
+
+udpInErrors OBJECT-TYPE
+    SYNTAX  Counter
+    ACCESS  read-only
+    STATUS  mandatory
+    DESCRIPTION
+            "The number of received UDP datagrams that could
+            not be delivered for reasons other than the lack
+            of an application at the destination port."
+    ::= { udp 3 }
+
+udpOutDatagrams OBJECT-TYPE
+    SYNTAX  Counter
+    ACCESS  read-only
+    STATUS  mandatory
+    DESCRIPTION
+            "The total number of UDP datagrams sent from this
+            entity."
+    ::= { udp 4 }
+
+-- the UDP Listener table
+
+-- The UDP listener table contains information about this
+-- entity's UDP end-points on which a local application is
+-- currently accepting datagrams.
+
+udpTable OBJECT-TYPE
+    SYNTAX  SEQUENCE OF UdpEntry
+    ACCESS  not-accessible
+    STATUS  mandatory
+    DESCRIPTION
+            "A table containing UDP listener information."
+    ::= { udp 5 }
+
+udpEntry OBJECT-TYPE
+    SYNTAX  UdpEntry
+    ACCESS  not-accessible
+    STATUS  mandatory
+    DESCRIPTION
+            "Information about a particular current UDP
+            listener."
+    INDEX   { udpLocalAddress, udpLocalPort }
+    ::= { udpTable 1 }
+
+UdpEntry ::=
+    SEQUENCE {
+        udpLocalAddress
+            IpAddress,
+        udpLocalPort
+            INTEGER (0..65535)
+    }
+
+udpLocalAddress OBJECT-TYPE
+    SYNTAX  IpAddress
+    ACCESS  read-only
+    STATUS  mandatory
+    DESCRIPTION
+            "The local IP address for this UDP listener.  In
+
+            the case of a UDP listener which is willing to
+            accept datagrams for any IP interface associated
+            with the node, the value 0.0.0.0 is used."
+    ::= { udpEntry 1 }
+
+udpLocalPort OBJECT-TYPE
+    SYNTAX  INTEGER (0..65535)
+    ACCESS  read-only
+    STATUS  mandatory
+    DESCRIPTION
+            "The local port number for this UDP listener."
+    ::= { udpEntry 2 }
+
+-- the EGP group
+
+-- Implementation of the EGP group is mandatory for all
+-- systems which implement the EGP.
+
+egpInMsgs OBJECT-TYPE
+    SYNTAX  Counter
+    ACCESS  read-only
+    STATUS  mandatory
+    DESCRIPTION
+            "The number of EGP messages received without
+            error."
+    ::= { egp 1 }
+
+egpInErrors OBJECT-TYPE
+    SYNTAX  Counter
+    ACCESS  read-only
+    STATUS  mandatory
+    DESCRIPTION
+            "The number of EGP messages received that proved
+            to be in error."
+    ::= { egp 2 }
+
+egpOutMsgs OBJECT-TYPE
+    SYNTAX  Counter
+    ACCESS  read-only
+    STATUS  mandatory
+    DESCRIPTION
+            "The total number of locally generated EGP
+            messages."
+    ::= { egp 3 }
+
+egpOutErrors OBJECT-TYPE
+    SYNTAX  Counter
+    ACCESS  read-only
+    STATUS  mandatory
+    DESCRIPTION
+            "The number of locally generated EGP messages not
+            sent due to resource limitations within an EGP
+            entity."
+    ::= { egp 4 }
+
+-- the EGP Neighbor table
+
+-- The EGP neighbor table contains information about this
+-- entity's EGP neighbors.
+
+egpNeighTable OBJECT-TYPE
+    SYNTAX  SEQUENCE OF EgpNeighEntry
+    ACCESS  not-accessible
+    STATUS  mandatory
+    DESCRIPTION
+            "The EGP neighbor table."
+    ::= { egp 5 }
+
+egpNeighEntry OBJECT-TYPE
+    SYNTAX  EgpNeighEntry
+    ACCESS  not-accessible
+    STATUS  mandatory
+    DESCRIPTION
+            "Information about this entity's relationship with
+            a particular EGP neighbor."
+    INDEX   { egpNeighAddr }
+    ::= { egpNeighTable 1 }
+
+EgpNeighEntry ::=
+    SEQUENCE {
+        egpNeighState
+            INTEGER,
+        egpNeighAddr
+            IpAddress,
+        egpNeighAs
+            INTEGER,
+        egpNeighInMsgs
+            Counter,
+        egpNeighInErrs
+            Counter,
+        egpNeighOutMsgs
+            Counter,
+        egpNeighOutErrs
+            Counter,
+        egpNeighInErrMsgs
+            Counter,
+        egpNeighOutErrMsgs
+            Counter,
+        egpNeighStateUps
+            Counter,
+        egpNeighStateDowns
+            Counter,
+        egpNeighIntervalHello
+            INTEGER,
+        egpNeighIntervalPoll
+            INTEGER,
+        egpNeighMode
+            INTEGER,
+        egpNeighEventTrigger
+            INTEGER
+    }
+
+egpNeighState OBJECT-TYPE
+    SYNTAX  INTEGER {
+                idle(1),
+                acquisition(2),
+                down(3),
+                up(4),
+                cease(5)
+            }
+    ACCESS  read-only
+    STATUS  mandatory
+    DESCRIPTION
+            "The EGP state of the local system with respect to
+            this entry's EGP neighbor.  Each EGP state is
+            represented by a value that is one greater than
+            the numerical value associated with said state in
+            RFC 904."
+    ::= { egpNeighEntry 1 }
+
+egpNeighAddr OBJECT-TYPE
+    SYNTAX  IpAddress
+    ACCESS  read-only
+    STATUS  mandatory
+    DESCRIPTION
+            "The IP address of this entry's EGP neighbor."
+    ::= { egpNeighEntry 2 }
+
+egpNeighAs OBJECT-TYPE
+    SYNTAX  INTEGER
+    ACCESS  read-only
+    STATUS  mandatory
+    DESCRIPTION
+            "The autonomous system of this EGP peer.  Zero
+            should be specified if the autonomous system
+            number of the neighbor is not yet known."
+    ::= { egpNeighEntry 3 }
+
+egpNeighInMsgs OBJECT-TYPE
+    SYNTAX  Counter
+    ACCESS  read-only
+    STATUS  mandatory
+    DESCRIPTION
+            "The number of EGP messages received without error
+            from this EGP peer."
+    ::= { egpNeighEntry 4 }
+
+egpNeighInErrs OBJECT-TYPE
+    SYNTAX  Counter
+    ACCESS  read-only
+    STATUS  mandatory
+    DESCRIPTION
+            "The number of EGP messages received from this EGP
+            peer that proved to be in error (e.g., bad EGP
+            checksum)."
+    ::= { egpNeighEntry 5 }
+
+egpNeighOutMsgs OBJECT-TYPE
+    SYNTAX  Counter
+    ACCESS  read-only
+    STATUS  mandatory
+    DESCRIPTION
+            "The number of locally generated EGP messages to
+            this EGP peer."
+    ::= { egpNeighEntry 6 }
+
+egpNeighOutErrs OBJECT-TYPE
+    SYNTAX  Counter
+    ACCESS  read-only
+    STATUS  mandatory
+    DESCRIPTION
+            "The number of locally generated EGP messages not
+            sent to this EGP peer due to resource limitations
+            within an EGP entity."
+    ::= { egpNeighEntry 7 }
+
+egpNeighInErrMsgs OBJECT-TYPE
+    SYNTAX  Counter
+    ACCESS  read-only
+    STATUS  mandatory
+    DESCRIPTION
+            "The number of EGP-defined error messages received
+            from this EGP peer."
+    ::= { egpNeighEntry 8 }
+
+egpNeighOutErrMsgs OBJECT-TYPE
+    SYNTAX  Counter
+    ACCESS  read-only
+    STATUS  mandatory
+    DESCRIPTION
+            "The number of EGP-defined error messages sent to
+            this EGP peer."
+    ::= { egpNeighEntry 9 }
+
+egpNeighStateUps OBJECT-TYPE
+    SYNTAX  Counter
+    ACCESS  read-only
+    STATUS  mandatory
+    DESCRIPTION
+            "The number of EGP state transitions to the UP
+            state with this EGP peer."
+    ::= { egpNeighEntry 10 }
+
+egpNeighStateDowns OBJECT-TYPE
+    SYNTAX  Counter
+    ACCESS  read-only
+    STATUS  mandatory
+    DESCRIPTION
+            "The number of EGP state transitions from the UP
+            state to any other state with this EGP peer."
+    ::= { egpNeighEntry 11 }
+
+egpNeighIntervalHello OBJECT-TYPE
+    SYNTAX  INTEGER
+    ACCESS  read-only
+    STATUS  mandatory
+    DESCRIPTION
+            "The interval between EGP Hello command
+            retransmissions (in hundredths of a second).  This
+            represents the t1 timer as defined in RFC 904."
+    ::= { egpNeighEntry 12 }
+
+egpNeighIntervalPoll OBJECT-TYPE
+    SYNTAX  INTEGER
+    ACCESS  read-only
+    STATUS  mandatory
+    DESCRIPTION
+            "The interval between EGP poll command
+
+            retransmissions (in hundredths of a second).  This
+            represents the t3 timer as defined in RFC 904."
+    ::= { egpNeighEntry 13 }
+
+egpNeighMode OBJECT-TYPE
+    SYNTAX  INTEGER { active(1), passive(2) }
+    ACCESS  read-only
+    STATUS  mandatory
+    DESCRIPTION
+            "The polling mode of this EGP entity, either
+            passive or active."
+    ::= { egpNeighEntry 14 }
+
+egpNeighEventTrigger OBJECT-TYPE
+    SYNTAX  INTEGER { start(1), stop(2) }
+    ACCESS  read-write
+    STATUS  mandatory
+    DESCRIPTION
+            "A control variable used to trigger operator-
+            initiated Start and Stop events.  When read, this
+            variable always returns the most recent value that
+            egpNeighEventTrigger was set to.  If it has not
+            been set since the last initialization of the
+            network management subsystem on the node, it
+            returns a value of `stop'.
+
+            When set, this variable causes a Start or Stop
+            event on the specified neighbor, as specified on
+            pages 8-10 of RFC 904.  Briefly, a Start event
+            causes an Idle peer to begin neighbor acquisition
+            and a non-Idle peer to reinitiate neighbor
+            acquisition.  A stop event causes a non-Idle peer
+            to return to the Idle state until a Start event
+            occurs, either via egpNeighEventTrigger or
+            otherwise."
+    ::= { egpNeighEntry 15 }
+
+-- additional EGP objects
+
+egpAs OBJECT-TYPE
+    SYNTAX  INTEGER
+    ACCESS  read-only
+    STATUS  mandatory
+    DESCRIPTION
+            "The autonomous system number of this EGP entity."
+    ::= { egp 6 }
+
+-- the Transmission group
+
+-- Based on the transmission media underlying each interface
+-- on a system, the corresponding portion of the Transmission
+-- group is mandatory for that system.
+
+-- When Internet-standard definitions for managing
+-- transmission media are defined, the transmission group is
+-- used to provide a prefix for the names of those objects.
+
+-- Typically, such definitions reside in the experimental
+-- portion of the MIB until they are "proven", then as a
+-- part of the Internet standardization process, the
+-- definitions are accordingly elevated and a new object
+-- identifier, under the transmission group is defined. By
+-- convention, the name assigned is:
+--
+--     type OBJECT IDENTIFIER    ::= { transmission number }
+--
+-- where "type" is the symbolic value used for the media in
+-- the ifType column of the ifTable object, and "number" is
+-- the actual integer value corresponding to the symbol.
+
+-- the SNMP group
+
+-- Implementation of the SNMP group is mandatory for all
+-- systems which support an SNMP protocol entity.  Some of
+-- the objects defined below will be zero-valued in those
+-- SNMP implementations that are optimized to support only
+-- those functions specific to either a management agent or
+-- a management station.  In particular, it should be
+-- observed that the objects below refer to an SNMP entity,
+-- and there may be several SNMP entities residing on a
+-- managed node (e.g., if the node is hosting acting as
+-- a management station).
+
+snmpInPkts OBJECT-TYPE
+    SYNTAX  Counter
+    ACCESS  read-only
+    STATUS  mandatory
+    DESCRIPTION
+            "The total number of Messages delivered to the
+            SNMP entity from the transport service."
+    ::= { snmp 1 }
+
+snmpOutPkts OBJECT-TYPE
+    SYNTAX  Counter
+    ACCESS  read-only
+    STATUS  mandatory
+    DESCRIPTION
+            "The total number of SNMP Messages which were
+            passed from the SNMP protocol entity to the
+            transport service."
+    ::= { snmp 2 }
+
+snmpInBadVersions OBJECT-TYPE
+    SYNTAX  Counter
+    ACCESS  read-only
+    STATUS  mandatory
+    DESCRIPTION
+            "The total number of SNMP Messages which were
+            delivered to the SNMP protocol entity and were for
+            an unsupported SNMP version."
+    ::= { snmp 3 }
+
+snmpInBadCommunityNames OBJECT-TYPE
+    SYNTAX  Counter
+    ACCESS  read-only
+    STATUS  mandatory
+    DESCRIPTION
+            "The total number of SNMP Messages delivered to
+            the SNMP protocol entity which used a SNMP
+            community name not known to said entity."
+    ::= { snmp 4 }
+
+snmpInBadCommunityUses OBJECT-TYPE
+    SYNTAX  Counter
+    ACCESS  read-only
+    STATUS  mandatory
+    DESCRIPTION
+            "The total number of SNMP Messages delivered to
+            the SNMP protocol entity which represented an SNMP
+            operation which was not allowed by the SNMP
+            community named in the Message."
+    ::= { snmp 5 }
+
+snmpInASNParseErrs OBJECT-TYPE
+    SYNTAX  Counter
+    ACCESS  read-only
+    STATUS  mandatory
+    DESCRIPTION
+            "The total number of ASN.1 or BER errors
+            encountered by the SNMP protocol entity when
+            decoding received SNMP Messages."
+    ::= { snmp 6 }
+
+-- { snmp 7 } is not used
+
+snmpInTooBigs OBJECT-TYPE
+    SYNTAX  Counter
+    ACCESS  read-only
+    STATUS  mandatory
+    DESCRIPTION
+            "The total number of SNMP PDUs which were
+            delivered to the SNMP protocol entity and for
+            which the value of the error-status field is
+            `tooBig'."
+    ::= { snmp 8 }
+
+snmpInNoSuchNames OBJECT-TYPE
+    SYNTAX  Counter
+    ACCESS  read-only
+    STATUS  mandatory
+    DESCRIPTION
+            "The total number of SNMP PDUs which were
+            delivered to the SNMP protocol entity and for
+            which the value of the error-status field is
+            `noSuchName'."
+    ::= { snmp 9 }
+
+snmpInBadValues OBJECT-TYPE
+    SYNTAX  Counter
+    ACCESS  read-only
+    STATUS  mandatory
+    DESCRIPTION
+            "The total number of SNMP PDUs which were
+            delivered to the SNMP protocol entity and for
+            which the value of the error-status field is
+            `badValue'."
+    ::= { snmp 10 }
+
+snmpInReadOnlys OBJECT-TYPE
+    SYNTAX  Counter
+    ACCESS  read-only
+    STATUS  mandatory
+    DESCRIPTION
+            "The total number valid SNMP PDUs which were
+            delivered to the SNMP protocol entity and for
+            which the value of the error-status field is
+            `readOnly'.  It should be noted that it is a
+            protocol error to generate an SNMP PDU which
+            contains the value `readOnly' in the error-status
+            field, as such this object is provided as a means
+            of detecting incorrect implementations of the
+
+            SNMP."
+    ::= { snmp 11 }
+
+snmpInGenErrs OBJECT-TYPE
+    SYNTAX  Counter
+    ACCESS  read-only
+    STATUS  mandatory
+    DESCRIPTION
+            "The total number of SNMP PDUs which were
+            delivered to the SNMP protocol entity and for
+            which the value of the error-status field is
+            `genErr'."
+    ::= { snmp 12 }
+
+snmpInTotalReqVars OBJECT-TYPE
+    SYNTAX  Counter
+    ACCESS  read-only
+    STATUS  mandatory
+    DESCRIPTION
+            "The total number of MIB objects which have been
+            retrieved successfully by the SNMP protocol entity
+            as the result of receiving valid SNMP Get-Request
+            and Get-Next PDUs."
+    ::= { snmp 13 }
+
+snmpInTotalSetVars OBJECT-TYPE
+    SYNTAX  Counter
+    ACCESS  read-only
+    STATUS  mandatory
+    DESCRIPTION
+            "The total number of MIB objects which have been
+            altered successfully by the SNMP protocol entity
+            as the result of receiving valid SNMP Set-Request
+            PDUs."
+    ::= { snmp 14 }
+
+snmpInGetRequests OBJECT-TYPE
+    SYNTAX  Counter
+    ACCESS  read-only
+    STATUS  mandatory
+    DESCRIPTION
+            "The total number of SNMP Get-Request PDUs which
+            have been accepted and processed by the SNMP
+            protocol entity."
+    ::= { snmp 15 }
+
+snmpInGetNexts OBJECT-TYPE
+    SYNTAX  Counter
+    ACCESS  read-only
+    STATUS  mandatory
+    DESCRIPTION
+            "The total number of SNMP Get-Next PDUs which have
+            been accepted and processed by the SNMP protocol
+            entity."
+    ::= { snmp 16 }
+
+snmpInSetRequests OBJECT-TYPE
+    SYNTAX  Counter
+    ACCESS  read-only
+    STATUS  mandatory
+    DESCRIPTION
+            "The total number of SNMP Set-Request PDUs which
+            have been accepted and processed by the SNMP
+            protocol entity."
+    ::= { snmp 17 }
+
+snmpInGetResponses OBJECT-TYPE
+    SYNTAX  Counter
+    ACCESS  read-only
+    STATUS  mandatory
+    DESCRIPTION
+            "The total number of SNMP Get-Response PDUs which
+            have been accepted and processed by the SNMP
+            protocol entity."
+    ::= { snmp 18 }
+
+snmpInTraps OBJECT-TYPE
+    SYNTAX  Counter
+    ACCESS  read-only
+    STATUS  mandatory
+    DESCRIPTION
+            "The total number of SNMP Trap PDUs which have
+            been accepted and processed by the SNMP protocol
+            entity."
+    ::= { snmp 19 }
+
+snmpOutTooBigs OBJECT-TYPE
+    SYNTAX  Counter
+    ACCESS  read-only
+    STATUS  mandatory
+    DESCRIPTION
+            "The total number of SNMP PDUs which were
+            generated by the SNMP protocol entity and for
+            which the value of the error-status field is
+            `tooBig.'"
+    ::= { snmp 20 }
+
+snmpOutNoSuchNames OBJECT-TYPE
+    SYNTAX  Counter
+    ACCESS  read-only
+    STATUS  mandatory
+    DESCRIPTION
+            "The total number of SNMP PDUs which were
+            generated by the SNMP protocol entity and for
+            which the value of the error-status is
+            `noSuchName'."
+    ::= { snmp 21 }
+
+snmpOutBadValues OBJECT-TYPE
+    SYNTAX  Counter
+    ACCESS  read-only
+    STATUS  mandatory
+    DESCRIPTION
+            "The total number of SNMP PDUs which were
+            generated by the SNMP protocol entity and for
+            which the value of the error-status field is
+            `badValue'."
+    ::= { snmp 22 }
+
+-- { snmp 23 } is not used
+
+snmpOutGenErrs OBJECT-TYPE
+    SYNTAX  Counter
+    ACCESS  read-only
+    STATUS  mandatory
+    DESCRIPTION
+            "The total number of SNMP PDUs which were
+            generated by the SNMP protocol entity and for
+            which the value of the error-status field is
+            `genErr'."
+    ::= { snmp 24 }
+
+snmpOutGetRequests OBJECT-TYPE
+    SYNTAX  Counter
+    ACCESS  read-only
+    STATUS  mandatory
+    DESCRIPTION
+            "The total number of SNMP Get-Request PDUs which
+            have been generated by the SNMP protocol entity."
+    ::= { snmp 25 }
+
+snmpOutGetNexts OBJECT-TYPE
+    SYNTAX  Counter
+    ACCESS  read-only
+    STATUS  mandatory
+    DESCRIPTION
+            "The total number of SNMP Get-Next PDUs which have
+            been generated by the SNMP protocol entity."
+    ::= { snmp 26 }
+
+snmpOutSetRequests OBJECT-TYPE
+    SYNTAX  Counter
+    ACCESS  read-only
+    STATUS  mandatory
+    DESCRIPTION
+            "The total number of SNMP Set-Request PDUs which
+            have been generated by the SNMP protocol entity."
+    ::= { snmp 27 }
+
+snmpOutGetResponses OBJECT-TYPE
+    SYNTAX  Counter
+    ACCESS  read-only
+    STATUS  mandatory
+    DESCRIPTION
+            "The total number of SNMP Get-Response PDUs which
+            have been generated by the SNMP protocol entity."
+    ::= { snmp 28 }
+
+snmpOutTraps OBJECT-TYPE
+    SYNTAX  Counter
+    ACCESS  read-only
+    STATUS  mandatory
+    DESCRIPTION
+            "The total number of SNMP Trap PDUs which have
+            been generated by the SNMP protocol entity."
+    ::= { snmp 29 }
+
+snmpEnableAuthenTraps OBJECT-TYPE
+    SYNTAX  INTEGER { enabled(1), disabled(2) }
+    ACCESS  read-write
+    STATUS  mandatory
+    DESCRIPTION
+            "Indicates whether the SNMP agent process is
+            permitted to generate authentication-failure
+            traps.  The value of this object overrides any
+            configuration information; as such, it provides a
+            means whereby all authentication-failure traps may
+            be disabled.
+
+            Note that it is strongly recommended that this
+            object be stored in non-volatile memory so that it
+            remains constant between re-initializations of the
+            network management system."
+    ::= { snmp 30 }
+
+END
diff -Naur tomato/release/src/router/snmp/mibs/RFC-1215.txt tomato121/release/src/router/snmp/mibs/RFC-1215.txt
--- tomato/release/src/router/snmp/mibs/RFC-1215.txt	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/mibs/RFC-1215.txt	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,38 @@
+
+RFC-1215 DEFINITIONS ::= BEGIN
+
+-- This  module is a empty module.  It has been created solely for the 
+-- purpose of allowing other modules to correctly import the TRAP-TYPE 
+-- clause from RFC-1215 where it should be imported from.  It's a
+-- built in type in the UCD-SNMP code, and in fact RFC-1215 doesn't
+-- actually define a mib at all; it only defines macros.  However,
+-- importing the TRAP-TYPE is conventionally done from an import
+-- clause pointing to RFC-1215.
+--
+--   Wes 7/17/98
+
+TRAP-TYPE MACRO ::=
+BEGIN
+    TYPE NOTATION ::= "ENTERPRISE" value
+                      (enterprise OBJECT IDENTIFIER)
+                      VarPart
+                      DescrPart
+                      ReferPart
+    VALUE NOTATION ::= value (VALUE INTEGER)
+    VarPart ::=
+               "VARIABLES" "{" VarTypes "}"
+               | empty
+    VarTypes ::=
+               VarType | VarTypes "," VarType
+    VarType ::=
+               value (vartype ObjectName)
+    DescrPart ::=
+               "DESCRIPTION" value (description DisplayString)
+               | empty
+    ReferPart ::=
+               "REFERENCE" value (reference DisplayString)
+               | empty
+END
+ 
+
+END
diff -Naur tomato/release/src/router/snmp/mibs/rfclist tomato121/release/src/router/snmp/mibs/rfclist
--- tomato/release/src/router/snmp/mibs/rfclist	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/mibs/rfclist	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,154 @@
+# updated 2002-06-15
+1155	RFC1155-SMI
+1213	RFC1213-MIB
+1227	SMUX-MIB
+1238	CLNS-MIB
+1381	RFC1381-MIB
+1382	RFC1382-MIB
+1414	RFC1414-MIB
+1461	MIOX25-MIB
+1471	PPP-LCP-MIB
+1472	PPP-SEC-MIB
+1473	PPP-IP-NCP-MIB
+1474	PPP-BRIDGE-NCP-MIB
+1493	BRIDGE-MIB
+1512	FDDI-SMT73-MIB
+1513	TOKEN-RING-RMON-MIB
+1525	SOURCE-ROUTING-MIB
+1559	DECNET-PHIV-MIB
+1567	DSA-MIB
+1604	FRNETSERV-MIB
+1611	DNS-SERVER-MIB
+1612	DNS-RESOLVER-MIB
+1628	UPS-MIB
+1657	BGP4-MIB
+1658	CHARACTER-MIB
+1659	RS-232-MIB
+1660	PARALLEL-MIB
+1666	SNA-NAU-MIB
+1694	SIP-MIB
+1696	Modem-MIB
+1697	RDBMS-MIB
+1724	RIPv2-MIB
+1742	APPLETALK-MIB
+1747	SNA-SDLC-MIB
+1748	TOKENRING-MIB
+1749	TOKENRING-STATION-SR-MIB
+1759	Printer-MIB
+1792	TCPIPX-MIB
+1850	OSPF-MIB:OSPF-TRAP-MIB
+2006	MIP-MIB
+2011	IP-MIB
+2012	TCP-MIB
+2013	UDP-MIB
+2020	DOT12-IF-MIB
+2021	RMON2-MIB
+2024	DLSW-MIB
+2051	APPC-MIB
+2096	IP-FORWARD-MIB
+2108	SNMP-REPEATER-MIB
+2115	FRAME-RELAY-DTE-MIB
+2127	ISDN-MIB
+2128	DIAL-CONTROL-MIB
+2206	RSVP-MIB
+2213	INTEGRATED-SERVICES-MIB
+2214	INTEGRATED-SERVICES-GUARANTEED-MIB
+2232	APPN-DLUR-MIB
+2238	HPR-MIB
+2266	DOT12-RPTR-MIB
+2287	SYSAPPL-MIB
+2320	IPOA-MIB
+2366	IPATM-IPMC-MIB
+2452	IPV6-TCP-MIB
+2454	IPV6-UDP-MIB
+2455	APPN-MIB
+2456	APPN-TRAP-MIB
+2457	EBN-MIB
+2465	IPV6-TC:IPV6-MIB
+2466	IPV6-ICMP-MIB
+2493	PerfHist-TC-MIB
+2494	DS0-MIB:DS0BUNDLE-MIB
+2495	DS1-MIB
+2496	DS3-MIB
+2512	ATM-ACCOUNTING-INFORMATION-MIB
+2513	ACCOUNTING-CONTROL-MIB
+2514	ATM-TC-MIB
+2515	ATM-MIB
+2558	SONET-MIB
+2561	TN3270E-MIB
+2562	TN3270E-RT-MIB
+2564	APPLICATION-MIB
+2576	SNMP-COMMUNITY-MIB
+2578	SNMPv2-SMI
+2579	SNMPv2-TC
+2580	SNMPv2-CONF
+2584	HPR-IP-MIB
+2594	WWW-MIB
+2605	DIRECTORY-SERVER-MIB
+2613	SMON-MIB
+2618	RADIUS-AUTH-CLIENT-MIB
+2619	RADIUS-AUTH-SERVER-MIB
+2620	RADIUS-ACC-CLIENT-MIB
+2621	RADIUS-ACC-SERVER-MIB
+2662	ADSL-TC-MIB:ADSL-LINE-MIB
+2665	EtherLike-MIB
+2666	ETHER-CHIPSET-MIB
+2667	TUNNEL-MIB
+2668	MAU-MIB
+2669	DOCS-CABLE-DEVICE-MIB
+2670	DOCS-IF-MIB
+2674	P-BRIDGE-MIB:Q-BRIDGE-MIB
+2677	NHRP-MIB
+2707	Job-Monitoring-MIB
+2720	FLOW-METER-MIB
+2737	ENTITY-MIB
+2742	AGENTX-MIB
+2758	SLAPM-MIB
+2786	SNMP-USM-DH-OBJECTS-MIB
+2787	VRRP-MIB
+2788	NETWORK-SERVICES-MIB
+2789	MTA-MIB
+2790	HOST-RESOURCES-MIB:HOST-RESOURCES-TYPES
+2819	RMON-MIB
+2837	FIBRE-CHANNEL-FE-MIB
+2856	HCNUM-TC
+2863	IF-MIB
+2864	IF-INVERTED-STACK-MIB
+2922	PTOPO-MIB
+2925	DISMAN-PING-MIB:DISMAN-TRACEROUTE-MIB:DISMAN-NSLOOKUP-MIB
+2932	IPMROUTE-STD-MIB
+2933	IGMP-STD-MIB
+2934	PIM-MIB
+2940	COPS-CLIENT-MIB
+2954	FRNETSERV-MIB
+2955	FR-ATM-PVC-SERVICE-IWF-MIB
+2959	RTP-MIB
+2981	DISMAN-EVENT-MIB
+2982	DISMAN-EXPRESSION-MIB
+3014	NOTIFICATION-LOG-MIB
+3019	IPV6-MLD-MIB
+3020	FR-MFR-MIB
+3055	PINT-MIB
+3083	DOCS-BPI-MIB
+3144	INTERFACETOPN-MIB
+3165	DISMAN-SCRIPT-MIB
+3201	CIRCUIT-IF-MIB
+3202	FRSLD-MIB
+3231	DISMAN-SCHEDULE-MIB
+3273	HC-RMON-MIB
+3276	HDSL2-SHDSL-LINE-MIB
+3289	DIFFSERV-DSCP-TC:DIFFSERV-MIB
+3291	INET-ADDRESS-MIB
+3295	GSMP-MIB
+3371    L2TP-MIB
+3411	SNMP-FRAMEWORK-MIB
+3412	SNMP-MPD-MIB
+3413	SNMP-TARGET-MIB:SNMP-NOTIFICATION-MIB:SNMP-PROXY-MIB
+3414	SNMP-USER-BASED-SM-MIB
+3415	SNMP-VIEW-BASED-ACM-MIB
+3417	SNMPv2-TM
+3418	SNMPv2-MIB
+3419	TRANSPORT-ADDRESS-MIB
+3433	ENTITY-SENSOR-MIB
+3434	HC-ALARM-MIB
+3440	ADSL-LINE-EXT-MIB
diff -Naur tomato/release/src/router/snmp/mibs/rfcmibs.diff tomato121/release/src/router/snmp/mibs/rfcmibs.diff
--- tomato/release/src/router/snmp/mibs/rfcmibs.diff	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/mibs/rfcmibs.diff	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,490 @@
+Only in /usr/local/share/snmp/rfc: .index
+diff -ru /usr/local/share/snmp/rfc.orig/ADSL-LINE-MIB.txt /usr/local/share/snmp/rfc/ADSL-LINE-MIB.txt
+--- /usr/local/share/snmp/rfc.orig/ADSL-LINE-MIB.txt	Sat Mar  3 17:27:00 2001
++++ /usr/local/share/snmp/rfc/ADSL-LINE-MIB.txt	Tue Jan 23 00:42:41 2001
+@@ -3379,7 +3379,6 @@
+                static profiles are implemented."
+ 
+           OBJECT      adslAtucConfMinSnrMgn
+-          MIN-ACCESS  read-wr
+           MIN-ACCESS  read-write
+           DESCRIPTION
+               "Read-write access is applicable when
+diff -ru /usr/local/share/snmp/rfc.orig/DLSW-MIB.txt /usr/local/share/snmp/rfc/DLSW-MIB.txt
+--- /usr/local/share/snmp/rfc.orig/DLSW-MIB.txt	Sat Mar  3 17:18:28 2001
++++ /usr/local/share/snmp/rfc/DLSW-MIB.txt	Tue Jan 23 00:13:40 2001
+@@ -7,7 +7,7 @@
+ 
+         Counter32, Gauge32, TimeTicks,
+         OBJECT-TYPE, MODULE-IDENTITY,
+-        NOTIFICATION-TYPE                 FROM SNMPv2-SMI
++        NOTIFICATION-TYPE, mib-2          FROM SNMPv2-SMI
+         MODULE-COMPLIANCE, OBJECT-GROUP,
+         NOTIFICATION-GROUP                FROM SNMPv2-CONF
+         ifIndex                           FROM IF-MIB
+@@ -150,12 +150,12 @@
+ 
+ -- The DLSw MIB module contains an object part and a conformance part.
+ -- Object part is organized in the following groups:
+--- (1) dlswNode      -- information about this DLSw
+--- (2) dlswTConn     -- about adjacent DLSw partners
+--- (3) dlswInterface -- about which interfaces DLSw is active on
+--- (4) dlswDirectory -- about any directory of local/remote resources
+--- (5) dlswCircuit   -- about established circuits.
+--- (6) dlswSdlc      -- about SDLC data link switched devices
++-- (1) dlswNode      - information about this DLSw
++-- (2) dlswTConn     - about adjacent DLSw partners
++-- (3) dlswInterface - about which interfaces DLSw is active on
++-- (4) dlswDirectory - about any directory of local/remote resources
++-- (5) dlswCircuit   - about established circuits.
++-- (6) dlswSdlc      - about SDLC data link switched devices
+ 
+ dlswNode        OBJECT IDENTIFIER ::= { dlswMIB 1 }
+ dlswTConn       OBJECT IDENTIFIER ::= { dlswMIB 2 }
+@@ -168,9 +168,9 @@
+ -- THE NODE GROUP
+ -- *******************************************************************
+ 
+--- -------------------------------------------------------------------
++-- ===================================================================
+ -- DLSw Node Identity
+--- -------------------------------------------------------------------
++-- ===================================================================
+ dlswNodeVersion  OBJECT-TYPE
+     SYNTAX     OCTET STRING (SIZE (2))
+     MAX-ACCESS read-only
+@@ -211,9 +211,9 @@
+        "DLSW: Switch-to-Switch Protocol RFC 1795"
+     ::= { dlswNode 3 }
+ 
+--- -------------------------------------------------------------------
++-- ===================================================================
+ -- DLSw Code Capability
+--- -------------------------------------------------------------------
++-- ===================================================================
+ dlswNodeStdPacingSupport  OBJECT-TYPE
+     SYNTAX     INTEGER  {
+        none              (1),  -- does not support DLSw
+@@ -238,9 +238,9 @@
+         scheme but never varies its receive window size."
+     ::= { dlswNode 4 }
+ 
+--- -------------------------------------------------------------------
++-- ===================================================================
+ -- DLSw Node Operational Objects
+--- -------------------------------------------------------------------
++--====================================================================
+ dlswNodeStatus  OBJECT-TYPE
+     SYNTAX     INTEGER  {
+         active        (1),
+@@ -339,10 +339,10 @@
+ -- TRANSPORT CONNECTION (aka: PARTNER DLSW)
+ -- *******************************************************************
+ 
+--- -------------------------------------------------------------------
++-- ===================================================================
+ 
+ -- Transport Connection Statistics Objects
+--- -------------------------------------------------------------------
++-- ===================================================================
+ dlswTConnStat    OBJECT IDENTIFIER ::= { dlswTConn 1 }
+ 
+ dlswTConnStatActiveConnections  OBJECT-TYPE
+@@ -375,9 +375,9 @@
+         this means the transport connection failed unexpectedly."
+     ::= { dlswTConnStat 3 }
+ 
+--- -------------------------------------------------------------------
++-- ===================================================================
+ -- Transport Connection Configuration Table
+--- -------------------------------------------------------------------
++-- ===================================================================
+ dlswTConnConfigTable  OBJECT-TYPE
+     SYNTAX     SEQUENCE OF DlswTConnConfigEntry
+     MAX-ACCESS not-accessible
+@@ -651,15 +651,15 @@
+         row definition out of use."
+     ::= { dlswTConnConfigEntry 13 }
+ 
+--- -------------------------------------------------------------------
++-- ===================================================================
+ -- Transport Connection Operation Table
+--- -------------------------------------------------------------------
++-- ===================================================================
+ -- (1) At most one transport connection can be connected between
+ --     this DLSw and one of its DLSw partners at a given time.
+ -- (2) Multiple transport types are supported.
+ -- (3) Since the entries may be reused, dlswTConnOperEntryTime
+ --     needs to be consulted for the possibility of counter reset.
+--- -------------------------------------------------------------------
++-- ===================================================================
+ 
+ dlswTConnOperTable  OBJECT-TYPE
+     SYNTAX     SEQUENCE OF DlswTConnOperEntry
+@@ -1254,14 +1254,14 @@
+         connection, where `active' means not in `disconnected' state."
+     ::= { dlswTConnOperEntry 36 }
+ 
+--- -------------------------------------------------------------------
++-- ===================================================================
+ -- Transport Connection Specific
+--- -------------------------------------------------------------------
++-- ===================================================================
+ dlswTConnSpecific OBJECT IDENTIFIER ::= { dlswTConn 4 }
+ dlswTConnTcp      OBJECT IDENTIFIER ::= { dlswTConnSpecific 1 }
+ 
+ -- ...................................................................
+--- TCP Transport Connection Specific -- Configuration
++-- TCP Transport Connection Specific - Configuration
+ -- ...................................................................
+ dlswTConnTcpConfigTable  OBJECT-TYPE
+     SYNTAX     SEQUENCE OF DlswTConnTcpConfigEntry
+@@ -1328,7 +1328,7 @@
+     ::= { dlswTConnTcpConfigEntry 3 }
+ 
+ -- ...................................................................
+--- TCP Transport Connection Specific -- Operation
++-- TCP Transport Connection Specific - Operation
+ -- ...................................................................
+ dlswTConnTcpOperTable  OBJECT-TYPE
+     SYNTAX     SEQUENCE OF DlswTConnTcpOperEntry
+@@ -1472,9 +1472,9 @@
+ -- transport address of the DLSw partner is cached.
+ -- *******************************************************************
+ 
+--- -------------------------------------------------------------------
++-- ===================================================================
+ -- Directory Related Statistical Objects
+--- -------------------------------------------------------------------
++-- ===================================================================
+ dlswDirStat     OBJECT IDENTIFIER ::= { dlswDirectory 1 }
+ 
+ dlswDirMacEntries  OBJECT-TYPE
+@@ -1556,9 +1556,9 @@
+         create new rows."
+     ::= { dlswDirStat 8 }
+ 
+--- -------------------------------------------------------------------
++-- ===================================================================
+ -- Directory Cache
+--- -------------------------------------------------------------------
++-- ===================================================================
+ dlswDirCache     OBJECT IDENTIFIER ::= { dlswDirectory 2 }
+ 
+ -- ...................................................................
+@@ -1566,7 +1566,7 @@
+ -- All Possible combinations of values of these objects.
+ --
+ --     EntryType   LocationType       Location        Status
+---  -------------- ------------ ------------------ --------------
++--  ============== ============ ================== ==============
+ --  userConfigured    local     ifEntry or 0.0     reachable, or
+ --                                                 notReachable, or
+ --                                                 unknown
+@@ -1743,7 +1743,7 @@
+ -- All Possible combinations of values of these objects.
+ --
+ --     EntryType   LocationType       Location        Status
+---  -------------- ------------ ------------------ --------------
++--  ============== ============ ================== ==============
+ --  userConfigured    local     ifEntry or 0.0     reachable, or
+ --                                                 notReachable, or
+ --                                                 unknown
+@@ -1918,9 +1918,9 @@
+         following the RowStatus textual convention."
+     ::= { dlswDirNBEntry 9 }
+ 
+--- -------------------------------------------------------------------
++-- ===================================================================
+ -- Resource Locations
+--- -------------------------------------------------------------------
++-- ===================================================================
+ 
+ dlswDirLocate       OBJECT IDENTIFIER ::= { dlswDirectory 3 }
+ 
+@@ -2056,9 +2056,9 @@
+ -- station that receives the initiation.
+ -- *******************************************************************
+ 
+--- -------------------------------------------------------------------
++-- ===================================================================
+ -- Statistics Related to Circuits
+--- -------------------------------------------------------------------
++-- ===================================================================
+ dlswCircuitStat      OBJECT IDENTIFIER ::= { dlswCircuit 1 }
+ 
+ dlswCircuitStatActives  OBJECT-TYPE
+@@ -2079,7 +2079,7 @@
+         or reactivated upon exiting `disconnected' state."
+     ::= { dlswCircuitStat 2 }
+ 
+--- -------------------------------------------------------------------
++-- ===================================================================
+ -- Circuit Table
+ --
+ -- This table is the DLSw entity's view of circuits.  There will be
+@@ -2090,9 +2090,9 @@
+ -- this Circuit Table:
+ --
+ --           number of       |    Origin End Station Location
+---         entries in the    |--------------------------------------
++--         entries in the    |======================================
+ --         Circuit Table     |  internal     local       remote
+---    -----------------------|--------------------------------------
++--    =======================|======================================
+ --     Target    |  internal |     NA          2           1
+ --     End       |  local    |     2           2           1
+ --     Station   |  remote   |     1           1           NA
+@@ -2106,7 +2106,7 @@
+ --
+ -- Most of statistics related to circuits can be collected
+ -- from LLC-2 Link Station Table.
+--- -------------------------------------------------------------------
++-- ===================================================================
+ dlswCircuitTable  OBJECT-TYPE
+     SYNTAX     SEQUENCE OF DlswCircuitEntry
+     MAX-ACCESS not-accessible
+@@ -2814,7 +2814,7 @@
+ -- *******************************************************************
+ dlswTraps              OBJECT IDENTIFIER ::= { dlswMIB 0 }
+ 
+--- -------------------------------------------------------------------
++-- ===================================================================
+ -- This section defines the well-known notifications sent by
+ -- DLSW agents.
+ -- Care must be taken to insure that no particular notification
+@@ -2827,7 +2827,7 @@
+ -- (3) Transport connection up/down
+ 
+ -- (4) Circuit up/down
+--- -------------------------------------------------------------------
++-- ===================================================================
+ --
+ 
+ dlswTrapTConnPartnerReject NOTIFICATION-TYPE
+@@ -2902,9 +2902,9 @@
+ dlswCompliances        OBJECT IDENTIFIER ::= { dlswConformance 1 }
+ dlswGroups             OBJECT IDENTIFIER ::= { dlswConformance 2 }
+ 
+--- -------------------------------------------------------------------
++-- ===================================================================
+ -- COMPLIANCE STATEMENTS
+--- -------------------------------------------------------------------
++-- ===================================================================
+ 
+ -- ...................................................................
+ -- Core compliance for all DLSw entities
+@@ -3245,9 +3245,9 @@
+                "Write access is not required."
+     ::= { dlswCompliances 5 }
+ 
+--- -------------------------------------------------------------------
++-- ===================================================================
+ -- CONFORMANCE GROUPS
+--- -------------------------------------------------------------------
++-- ===================================================================
+ 
+ -- ...................................................................
+ -- Node Conformance Group
+diff -ru /usr/local/share/snmp/rfc.orig/DSA-MIB.txt /usr/local/share/snmp/rfc/DSA-MIB.txt
+--- /usr/local/share/snmp/rfc.orig/DSA-MIB.txt	Sat Mar  3 17:15:36 2001
++++ /usr/local/share/snmp/rfc/DSA-MIB.txt	Thu Feb 22 00:33:45 2001
+@@ -10,7 +10,7 @@
+           mib-2
+                      FROM RFC1213-MIB
+           applIndex, DistinguishedName
+-                     FROM APPLICATION-MIB;
++                     FROM NETWORK-SERVICES-MIB;
+ 
+         dsaMIB MODULE-IDENTITY
+            LAST-UPDATED "9311250000Z"
+diff -ru /usr/local/share/snmp/rfc.orig/FDDI-SMT73-MIB.txt /usr/local/share/snmp/rfc/FDDI-SMT73-MIB.txt
+--- /usr/local/share/snmp/rfc.orig/FDDI-SMT73-MIB.txt	Sat Mar  3 17:15:09 2001
++++ /usr/local/share/snmp/rfc/FDDI-SMT73-MIB.txt	Tue Jan 23 00:11:46 2001
+@@ -3,6 +3,8 @@
+ IMPORTS
+         Counter
+             FROM RFC1155-SMI
++	transmission
++	    FROM RFC1213-MIB
+         OBJECT-TYPE
+             FROM RFC-1212;
+ 
+diff -ru /usr/local/share/snmp/rfc.orig/HPR-MIB.txt /usr/local/share/snmp/rfc/HPR-MIB.txt
+--- /usr/local/share/snmp/rfc.orig/HPR-MIB.txt	Sat Mar  3 17:19:54 2001
++++ /usr/local/share/snmp/rfc/HPR-MIB.txt	Tue Jan 23 00:25:54 2001
+@@ -18,7 +18,7 @@
+                 FROM APPN-MIB;
+ 
+ hprMIB MODULE-IDENTITY
+-        LAST-UPDATED  "970514000000Z"
++        LAST-UPDATED  "9705140000Z"
+         ORGANIZATION  "AIW APPN / HPR MIB SIG"
+         CONTACT-INFO
+                 "
+diff -ru /usr/local/share/snmp/rfc.orig/MIP-MIB.txt /usr/local/share/snmp/rfc/MIP-MIB.txt
+--- /usr/local/share/snmp/rfc.orig/MIP-MIB.txt	Sat Mar  3 17:17:42 2001
++++ /usr/local/share/snmp/rfc/MIP-MIB.txt	Tue Jan 23 00:25:27 2001
+@@ -1,7 +1,7 @@
+     MIP-MIB DEFINITIONS ::= BEGIN
+ 
+     IMPORTS
+-        Counter32, Gauge32, Integer32, IpAddress, experimental,
++        Counter32, Gauge32, Integer32, IpAddress, mib-2,
+         MODULE-IDENTITY, OBJECT-TYPE, NOTIFICATION-TYPE
+                                         FROM SNMPv2-SMI
+         RowStatus, TruthValue, TimeStamp,
+@@ -2117,7 +2117,7 @@
+                 function within a home agent."
+         ::= { mipGroups 12 }
+ 
+-    mipSecNotifcationsGroup NOTIFICATION-GROUP
++    mipSecNotificationsGroup NOTIFICATION-GROUP
+         NOTIFICATIONS { mipAuthFailure }
+         STATUS      current
+         DESCRIPTION
+diff -ru /usr/local/share/snmp/rfc.orig/Modem-MIB.txt /usr/local/share/snmp/rfc/Modem-MIB.txt
+--- /usr/local/share/snmp/rfc.orig/Modem-MIB.txt	Sat Mar  3 17:16:35 2001
++++ /usr/local/share/snmp/rfc/Modem-MIB.txt	Mon Jan 22 23:53:08 2001
+@@ -23,7 +23,7 @@
+              E-mail: waldbusser@cmu.edu"
+     DESCRIPTION
+             "The MIB module for management of dial-up modems."
+-    ::= { mdmMIB 1 }
++    ::= { mdmMib 1 }
+ 
+ mdmMib OBJECT IDENTIFIER ::= { mib-2 38 }
+ 
+diff -ru /usr/local/share/snmp/rfc.orig/PPP-LCP-MIB.txt /usr/local/share/snmp/rfc/PPP-LCP-MIB.txt
+--- /usr/local/share/snmp/rfc.orig/PPP-LCP-MIB.txt	Sat Mar  3 17:14:46 2001
++++ /usr/local/share/snmp/rfc/PPP-LCP-MIB.txt	Sat Mar  3 23:13:27 2001
+@@ -182,7 +182,7 @@
+      ::= { pppLinkStatusEntry 5 }
+ 
+ pppLinkStatusLocalMRU   OBJECT-TYPE
+-     SYNTAX    INTEGER(1..2147483648)
++     SYNTAX    INTEGER(1..2147483647)
+      ACCESS    read-only
+      STATUS    mandatory
+      DESCRIPTION
+@@ -195,7 +195,7 @@
+      ::= { pppLinkStatusEntry 6 }
+ 
+ pppLinkStatusRemoteMRU   OBJECT-TYPE
+-     SYNTAX    INTEGER(1..2147483648)
++     SYNTAX    INTEGER(1..2147483647)
+      ACCESS    read-only
+      STATUS    mandatory
+      DESCRIPTION
+@@ -535,7 +535,7 @@
+      ::= { pppLqrEntry 2 }
+ 
+ pppLqrLocalPeriod   OBJECT-TYPE
+-     SYNTAX    INTEGER(1..2147483648)
++     SYNTAX    INTEGER(1..2147483647)
+      ACCESS    read-only
+      STATUS    mandatory
+      DESCRIPTION
+@@ -548,7 +548,7 @@
+      ::= { pppLqrEntry 3 }
+ 
+ pppLqrRemotePeriod   OBJECT-TYPE
+-     SYNTAX    INTEGER(1..2147483648)
++     SYNTAX    INTEGER(1..2147483647)
+      ACCESS    read-only
+      STATUS    mandatory
+      DESCRIPTION
+diff -ru /usr/local/share/snmp/rfc.orig/RDBMS-MIB.txt /usr/local/share/snmp/rfc/RDBMS-MIB.txt
+--- /usr/local/share/snmp/rfc.orig/RDBMS-MIB.txt	Sat Mar  3 17:16:41 2001
++++ /usr/local/share/snmp/rfc/RDBMS-MIB.txt	Tue Jan 23 00:24:04 2001
+@@ -6,8 +6,8 @@
+         FROM SNMPv2-SMI
+     DisplayString, DateAndTime, AutonomousType
+         FROM SNMPv2-TC
+-    applIndex, applGroup
+-        FROM APPLICATION-MIB
++    applIndex, applGroups
++        FROM NETWORK-SERVICES-MIB
+     mib-2
+         FROM RFC1213-MIB;
+ 
+@@ -1263,8 +1263,8 @@
+          implement the RDBMS MIB"
+     MODULE HOST-RESOURCES-MIB
+         MANDATORY-GROUPS    { hrSystem }
+-    MODULE APPLICATION-MIB
+-        MANDATORY-GROUPS { applGroup }
++    MODULE NETWORK-SERVICES-MIB
++        MANDATORY-GROUPS { applGroups }
+     MODULE RDBMS-MIB
+         MANDATORY-GROUPS { rdbmsGroup }
+ 
+Only in /usr/local/share/snmp/rfc: RFC-1215.txt
+diff -ru /usr/local/share/snmp/rfc.orig/RFC1414-MIB.txt /usr/local/share/snmp/rfc/RFC1414-MIB.txt
+--- /usr/local/share/snmp/rfc.orig/RFC1414-MIB.txt	Sat Mar  3 17:14:37 2001
++++ /usr/local/share/snmp/rfc/RFC1414-MIB.txt	Tue Feb 20 00:25:21 2001
+@@ -3,6 +3,7 @@
+ IMPORTS
+     OBJECT-TYPE
+         FROM RFC-1212
++    mib-2,
+     tcpConnLocalAddress, tcpConnLocalPort,
+     tcpConnRemAddress, tcpConnRemPort
+             FROM RFC1213-MIB;
+diff -ru /usr/local/share/snmp/rfc.orig/SNA-NAU-MIB.txt /usr/local/share/snmp/rfc/SNA-NAU-MIB.txt
+--- /usr/local/share/snmp/rfc.orig/SNA-NAU-MIB.txt	Sat Mar  3 17:16:24 2001
++++ /usr/local/share/snmp/rfc/SNA-NAU-MIB.txt	Mon Jan 22 23:57:44 2001
+@@ -17,7 +17,7 @@
+         DisplayString, RowStatus, TimeStamp, InstancePointer
+                 FROM SNMPv2-TC
+ 
+-        Counter32, Gauge32, Integer32,
++        Counter32, Gauge32, Integer32, mib-2,
+         OBJECT-TYPE, MODULE-IDENTITY, NOTIFICATION-TYPE
+                 FROM SNMPv2-SMI
+ 
+diff -ru /usr/local/share/snmp/rfc.orig/TCPIPX-MIB.txt /usr/local/share/snmp/rfc/TCPIPX-MIB.txt
+--- /usr/local/share/snmp/rfc.orig/TCPIPX-MIB.txt	Sat Mar  3 17:17:17 2001
++++ /usr/local/share/snmp/rfc/TCPIPX-MIB.txt	Sat Mar  3 16:51:11 2001
+@@ -1,6 +1,8 @@
+    TCPIPX-MIB DEFINITIONS ::= BEGIN
+ 
+    IMPORTS
++	   enterprises
++		   FROM RFC1155-SMI
+            OBJECT-TYPE
+                    FROM RFC-1212;
+ 
+@@ -10,7 +12,7 @@
+ 
+ -- as hex digits, as in:  nnnnnnnn:mmmmmmmmmmmm
+ 
+-IpxAddress ::= OCTET STRING (size (10))
++IpxAddress ::= OCTET STRING (SIZE (10))
+ 
+    -- TCP/IPX MIB object idenfifiers
+ 
+diff -ru /usr/local/share/snmp/rfc.orig/UPS-MIB.txt /usr/local/share/snmp/rfc/UPS-MIB.txt
+--- /usr/local/share/snmp/rfc.orig/UPS-MIB.txt	Sat Mar  3 17:16:01 2001
++++ /usr/local/share/snmp/rfc/UPS-MIB.txt	Mon Jan 22 23:55:45 2001
+@@ -2,7 +2,7 @@
+ 
+ IMPORTS
+     MODULE-IDENTITY, OBJECT-TYPE, NOTIFICATION-TYPE,
+-    OBJECT-IDENTITY, Counter32, Gauge32, Integer32
++    OBJECT-IDENTITY, Counter32, Gauge32, Integer32, mib-2
+         FROM SNMPv2-SMI
+     DisplayString, TimeStamp, TimeInterval, TestAndIncr,
+       AutonomousType
+diff -ru /usr/local/share/snmp/rfc.orig/Printer-MIB.txt /usr/local/share/snmp/rfc/Printer-MIB.txt
+--- /usr/local/share/snmp/rfc.orig/Printer-MIB.txt     Wed Mar 28 09:03:28 2001
++++ /usr/local/share/snmp/rfc/Printer-MIB.txt   Wed Mar 28 09:07:08 2001
+@@ -1,7 +1,7 @@
+ Printer-MIB DEFINITIONS ::= BEGIN
+ 
+ IMPORTS
+-    MODULE-IDENTITY, OBJECT-TYPE, experimental, Counter32, Integer32,
++    MODULE-IDENTITY, OBJECT-TYPE, mib-2, Counter32, Integer32,
+         TimeTicks, NOTIFICATION-TYPE, OBJECT-IDENTITY FROM SNMPv2-SMI
+     TEXTUAL-CONVENTION FROM SNMPv2-TC
+     MODULE-COMPLIANCE, OBJECT-GROUP FROM SNMPv2-CONF
diff -Naur tomato/release/src/router/snmp/mibs/RMON-MIB.txt tomato121/release/src/router/snmp/mibs/RMON-MIB.txt
--- tomato/release/src/router/snmp/mibs/RMON-MIB.txt	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/mibs/RMON-MIB.txt	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,3980 @@
+RMON-MIB DEFINITIONS ::= BEGIN
+
+    IMPORTS
+        MODULE-IDENTITY, OBJECT-TYPE, OBJECT-IDENTITY,
+        NOTIFICATION-TYPE, mib-2, Counter32,
+        Integer32, TimeTicks                   FROM SNMPv2-SMI
+
+        TEXTUAL-CONVENTION, DisplayString      FROM SNMPv2-TC
+
+        MODULE-COMPLIANCE, OBJECT-GROUP,
+        NOTIFICATION-GROUP                     FROM SNMPv2-CONF;
+
+--  Remote Network Monitoring MIB
+
+rmonMibModule MODULE-IDENTITY
+    LAST-UPDATED "200005110000Z"  -- 11 May, 2000
+    ORGANIZATION "IETF RMON MIB Working Group"
+    CONTACT-INFO
+        "Steve Waldbusser
+        Phone: +1-650-948-6500
+        Fax:   +1-650-745-0671
+        Email: waldbusser@nextbeacon.com"
+    DESCRIPTION
+        "Remote network monitoring devices, often called
+        monitors or probes, are instruments that exist for
+        the purpose of managing a network. This MIB defines
+        objects for managing remote network monitoring devices."
+
+    REVISION "200005110000Z"    -- 11 May, 2000
+    DESCRIPTION
+        "Reformatted into SMIv2 format.
+
+        This version published as RFC 2819."
+
+    REVISION "199502010000Z" -- 1 Feb, 1995
+    DESCRIPTION
+        "Bug fixes, clarifications and minor changes based on
+        implementation experience, published as RFC1757 [18].
+
+        Two changes were made to object definitions:
+
+        1) A new status bit has been defined for the
+        captureBufferPacketStatus object, indicating that the
+        packet order within the capture buffer may not be identical to
+        the packet order as received off the wire.  This bit may only
+
+        be used for packets transmitted by the probe.  Older NMS
+        applications can safely ignore this status bit, which might be
+        used by newer agents.
+
+        2) The packetMatch trap has been removed.  This trap was never
+        actually 'approved' and was not added to this document along
+        with the risingAlarm and fallingAlarm traps. The packetMatch
+        trap could not be throttled, which could cause disruption of
+        normal network traffic under some circumstances. An NMS should
+        configure a risingAlarm threshold on the appropriate
+        channelMatches instance if a trap is desired for a packetMatch
+        event. Note that logging of packetMatch events is still
+        supported--only trap generation for such events has been
+        removed.
+
+        In addition, several clarifications to individual object
+        definitions have been added to assist agent and NMS
+        implementors:
+
+        - global definition of 'good packets' and 'bad packets'
+
+        - more detailed text governing conceptual row creation and
+          modification
+
+        - instructions for probes relating to interface changes and
+          disruptions
+
+        - clarification of some ethernet counter definitions
+
+        - recommended formula for calculating network utilization
+
+        - clarification of channel and captureBuffer behavior for some
+          unusual conditions
+
+        - examples of proper instance naming for each table"
+
+    REVISION "199111010000Z"    -- 1 Nov, 1991
+    DESCRIPTION
+        "The original version of this MIB, published as RFC1271."
+    ::= { rmonConformance 8 }
+
+    rmon    OBJECT IDENTIFIER ::= { mib-2 16 }
+
+    -- textual conventions
+
+OwnerString ::= TEXTUAL-CONVENTION
+    STATUS current
+    DESCRIPTION
+        "This data type is used to model an administratively
+        assigned name of the owner of a resource. Implementations
+        must accept values composed of well-formed NVT ASCII
+        sequences. In addition, implementations should accept
+        values composed of well-formed UTF-8 sequences.
+
+        It is suggested that this name contain one or more of
+        the following: IP address, management station name,
+        network manager's name, location, or phone number.
+        In some cases the agent itself will be the owner of
+        an entry.  In these cases, this string shall be set
+        to a string starting with 'monitor'.
+
+        SNMP access control is articulated entirely in terms
+        of the contents of MIB views; access to a particular
+        SNMP object instance depends only upon its presence
+        or absence in a particular MIB view and never upon
+        its value or the value of related object instances.
+        Thus, objects of this type afford resolution of
+        resource contention only among cooperating
+        managers; they realize no access control function
+        with respect to uncooperative parties."
+    SYNTAX OCTET STRING (SIZE (0..127))
+
+EntryStatus ::= TEXTUAL-CONVENTION
+    STATUS current
+    DESCRIPTION
+        "The status of a table entry.
+
+        Setting this object to the value invalid(4) has the
+        effect of invalidating the corresponding entry.
+        That is, it effectively disassociates the mapping
+        identified with said entry.
+        It is an implementation-specific matter as to whether
+        the agent removes an invalidated entry from the table.
+        Accordingly, management stations must be prepared to
+        receive tabular information from agents that corresponds
+        to entries currently not in use.  Proper
+        interpretation of such entries requires examination
+        of the relevant EntryStatus object.
+
+        An existing instance of this object cannot be set to
+        createRequest(2).  This object may only be set to
+        createRequest(2) when this instance is created.  When
+        this object is created, the agent may wish to create
+        supplemental object instances with default values
+        to complete a conceptual row in this table.  Because the
+
+        creation of these default objects is entirely at the option
+        of the agent, the manager must not assume that any will be
+        created, but may make use of any that are created.
+        Immediately after completing the create operation, the agent
+        must set this object to underCreation(3).
+
+        When in the underCreation(3) state, an entry is allowed to
+        exist in a possibly incomplete, possibly inconsistent state,
+        usually to allow it to be modified in multiple PDUs.  When in
+        this state, an entry is not fully active.
+        Entries shall exist in the underCreation(3) state until
+        the management station is finished configuring the entry
+        and sets this object to valid(1) or aborts, setting this
+        object to invalid(4).  If the agent determines that an
+        entry has been in the underCreation(3) state for an
+        abnormally long time, it may decide that the management
+        station has crashed.  If the agent makes this decision,
+        it may set this object to invalid(4) to reclaim the
+        entry.  A prudent agent will understand that the
+        management station may need to wait for human input
+        and will allow for that possibility in its
+        determination of this abnormally long period.
+
+        An entry in the valid(1) state is fully configured and
+        consistent and fully represents the configuration or
+        operation such a row is intended to represent.  For
+        example, it could be a statistical function that is
+        configured and active, or a filter that is available
+        in the list of filters processed by the packet capture
+        process.
+
+        A manager is restricted to changing the state of an entry in
+        the following ways:
+
+             To:       valid  createRequest  underCreation  invalid
+        From:
+        valid             OK             NO             OK       OK
+        createRequest    N/A            N/A            N/A      N/A
+        underCreation     OK             NO             OK       OK
+        invalid           NO             NO             NO       OK
+        nonExistent       NO             OK             NO       OK
+
+        In the table above, it is not applicable to move the state
+        from the createRequest state to any other state because the
+        manager will never find the variable in that state.  The
+        nonExistent state is not a value of the enumeration, rather
+        it means that the entryStatus variable does not exist at all.
+
+        An agent may allow an entryStatus variable to change state in
+        additional ways, so long as the semantics of the states are
+        followed.  This allowance is made to ease the implementation of
+        the agent and is made despite the fact that managers should
+        never exercise these additional state transitions."
+    SYNTAX INTEGER {
+               valid(1),
+               createRequest(2),
+               underCreation(3),
+               invalid(4)
+           }
+
+    statistics        OBJECT IDENTIFIER ::= { rmon 1 }
+    history           OBJECT IDENTIFIER ::= { rmon 2 }
+    alarm             OBJECT IDENTIFIER ::= { rmon 3 }
+    hosts             OBJECT IDENTIFIER ::= { rmon 4 }
+    hostTopN          OBJECT IDENTIFIER ::= { rmon 5 }
+    matrix            OBJECT IDENTIFIER ::= { rmon 6 }
+    filter            OBJECT IDENTIFIER ::= { rmon 7 }
+    capture           OBJECT IDENTIFIER ::= { rmon 8 }
+    event             OBJECT IDENTIFIER ::= { rmon 9 }
+    rmonConformance   OBJECT IDENTIFIER ::= { rmon 20 }
+
+-- The Ethernet Statistics Group
+--
+-- Implementation of the Ethernet Statistics group is optional.
+-- Consult the MODULE-COMPLIANCE macro for the authoritative
+-- conformance information for this MIB.
+--
+-- The ethernet statistics group contains statistics measured by the
+-- probe for each monitored interface on this device.  These
+-- statistics take the form of free running counters that start from
+-- zero when a valid entry is created.
+--
+-- This group currently has statistics defined only for
+-- Ethernet interfaces.  Each etherStatsEntry contains statistics
+-- for one Ethernet interface.  The probe must create one
+-- etherStats entry for each monitored Ethernet interface
+-- on the device.
+
+etherStatsTable OBJECT-TYPE
+    SYNTAX     SEQUENCE OF EtherStatsEntry
+    MAX-ACCESS not-accessible
+    STATUS     current
+    DESCRIPTION
+        "A list of Ethernet statistics entries."
+    ::= { statistics 1 }
+
+etherStatsEntry OBJECT-TYPE
+    SYNTAX     EtherStatsEntry
+    MAX-ACCESS not-accessible
+    STATUS     current
+    DESCRIPTION
+        "A collection of statistics kept for a particular
+        Ethernet interface.  As an example, an instance of the
+        etherStatsPkts object might be named etherStatsPkts.1"
+    INDEX { etherStatsIndex }
+    ::= { etherStatsTable 1 }
+
+EtherStatsEntry ::= SEQUENCE {
+    etherStatsIndex                    Integer32,
+    etherStatsDataSource               OBJECT IDENTIFIER,
+    etherStatsDropEvents               Counter32,
+    etherStatsOctets                   Counter32,
+    etherStatsPkts                     Counter32,
+    etherStatsBroadcastPkts            Counter32,
+    etherStatsMulticastPkts            Counter32,
+    etherStatsCRCAlignErrors           Counter32,
+    etherStatsUndersizePkts            Counter32,
+    etherStatsOversizePkts             Counter32,
+    etherStatsFragments                Counter32,
+    etherStatsJabbers                  Counter32,
+    etherStatsCollisions               Counter32,
+    etherStatsPkts64Octets             Counter32,
+    etherStatsPkts65to127Octets        Counter32,
+    etherStatsPkts128to255Octets       Counter32,
+    etherStatsPkts256to511Octets       Counter32,
+    etherStatsPkts512to1023Octets      Counter32,
+    etherStatsPkts1024to1518Octets     Counter32,
+    etherStatsOwner                    OwnerString,
+    etherStatsStatus                   EntryStatus
+}
+
+etherStatsIndex OBJECT-TYPE
+    SYNTAX     Integer32 (1..65535)
+    MAX-ACCESS read-only
+    STATUS     current
+    DESCRIPTION
+        "The value of this object uniquely identifies this
+        etherStats entry."
+    ::= { etherStatsEntry 1 }
+
+etherStatsDataSource OBJECT-TYPE
+    SYNTAX     OBJECT IDENTIFIER
+    MAX-ACCESS read-create
+    STATUS     current
+    DESCRIPTION
+        "This object identifies the source of the data that
+        this etherStats entry is configured to analyze.  This
+        source can be any ethernet interface on this device.
+        In order to identify a particular interface, this object
+        shall identify the instance of the ifIndex object,
+        defined in RFC 2233 [17], for the desired interface.
+        For example, if an entry were to receive data from
+        interface #1, this object would be set to ifIndex.1.
+
+        The statistics in this group reflect all packets
+        on the local network segment attached to the identified
+        interface.
+
+        An agent may or may not be able to tell if fundamental
+        changes to the media of the interface have occurred and
+        necessitate an invalidation of this entry.  For example, a
+        hot-pluggable ethernet card could be pulled out and replaced
+        by a token-ring card.  In such a case, if the agent has such
+        knowledge of the change, it is recommended that it
+        invalidate this entry.
+
+        This object may not be modified if the associated
+        etherStatsStatus object is equal to valid(1)."
+    ::= { etherStatsEntry 2 }
+
+etherStatsDropEvents OBJECT-TYPE
+    SYNTAX     Counter32
+    MAX-ACCESS read-only
+    STATUS     current
+    DESCRIPTION
+        "The total number of events in which packets
+        were dropped by the probe due to lack of resources.
+        Note that this number is not necessarily the number of
+        packets dropped; it is just the number of times this
+        condition has been detected."
+    ::= { etherStatsEntry 3 }
+
+etherStatsOctets OBJECT-TYPE
+    SYNTAX     Counter32
+    UNITS      "Octets"
+    MAX-ACCESS read-only
+    STATUS     current
+    DESCRIPTION
+        "The total number of octets of data (including
+        those in bad packets) received on the
+        network (excluding framing bits but including
+        FCS octets).
+
+        This object can be used as a reasonable estimate of
+        10-Megabit ethernet utilization.  If greater precision is
+        desired, the etherStatsPkts and etherStatsOctets objects
+        should be sampled before and after a common interval.  The
+        differences in the sampled values are Pkts and Octets,
+        respectively, and the number of seconds in the interval is
+        Interval.  These values are used to calculate the Utilization
+        as follows:
+
+                         Pkts * (9.6 + 6.4) + (Octets * .8)
+         Utilization = -------------------------------------
+                                 Interval * 10,000
+
+        The result of this equation is the value Utilization which
+        is the percent utilization of the ethernet segment on a
+        scale of 0 to 100 percent."
+    ::= { etherStatsEntry 4 }
+
+etherStatsPkts OBJECT-TYPE
+    SYNTAX     Counter32
+    UNITS      "Packets"
+    MAX-ACCESS read-only
+    STATUS     current
+    DESCRIPTION
+        "The total number of packets (including bad packets,
+        broadcast packets, and multicast packets) received."
+    ::= { etherStatsEntry 5 }
+
+etherStatsBroadcastPkts OBJECT-TYPE
+    SYNTAX     Counter32
+    UNITS      "Packets"
+    MAX-ACCESS read-only
+    STATUS     current
+    DESCRIPTION
+        "The total number of good packets received that were
+        directed to the broadcast address.  Note that this
+        does not include multicast packets."
+    ::= { etherStatsEntry 6 }
+
+etherStatsMulticastPkts OBJECT-TYPE
+    SYNTAX     Counter32
+    UNITS      "Packets"
+    MAX-ACCESS read-only
+    STATUS     current
+    DESCRIPTION
+        "The total number of good packets received that were
+        directed to a multicast address.  Note that this number
+        does not include packets directed to the broadcast
+
+        address."
+    ::= { etherStatsEntry 7 }
+
+etherStatsCRCAlignErrors OBJECT-TYPE
+    SYNTAX     Counter32
+    UNITS      "Packets"
+    MAX-ACCESS read-only
+    STATUS     current
+    DESCRIPTION
+        "The total number of packets received that
+        had a length (excluding framing bits, but
+        including FCS octets) of between 64 and 1518
+        octets, inclusive, but had either a bad
+        Frame Check Sequence (FCS) with an integral
+        number of octets (FCS Error) or a bad FCS with
+        a non-integral number of octets (Alignment Error)."
+    ::= { etherStatsEntry 8 }
+
+etherStatsUndersizePkts OBJECT-TYPE
+    SYNTAX     Counter32
+    UNITS      "Packets"
+    MAX-ACCESS read-only
+    STATUS     current
+    DESCRIPTION
+        "The total number of packets received that were
+        less than 64 octets long (excluding framing bits,
+        but including FCS octets) and were otherwise well
+        formed."
+    ::= { etherStatsEntry 9 }
+
+etherStatsOversizePkts OBJECT-TYPE
+    SYNTAX     Counter32
+    UNITS      "Packets"
+    MAX-ACCESS read-only
+    STATUS     current
+    DESCRIPTION
+        "The total number of packets received that were
+        longer than 1518 octets (excluding framing bits,
+        but including FCS octets) and were otherwise
+        well formed."
+    ::= { etherStatsEntry 10 }
+
+etherStatsFragments OBJECT-TYPE
+    SYNTAX     Counter32
+    UNITS      "Packets"
+    MAX-ACCESS read-only
+    STATUS     current
+    DESCRIPTION
+        "The total number of packets received that were less than
+        64 octets in length (excluding framing bits but including
+        FCS octets) and had either a bad Frame Check Sequence
+        (FCS) with an integral number of octets (FCS Error) or a
+        bad FCS with a non-integral number of octets (Alignment
+        Error).
+
+        Note that it is entirely normal for etherStatsFragments to
+        increment.  This is because it counts both runts (which are
+        normal occurrences due to collisions) and noise hits."
+    ::= { etherStatsEntry 11 }
+
+etherStatsJabbers OBJECT-TYPE
+    SYNTAX     Counter32
+    UNITS      "Packets"
+    MAX-ACCESS read-only
+    STATUS     current
+    DESCRIPTION
+        "The total number of packets received that were
+        longer than 1518 octets (excluding framing bits,
+        but including FCS octets), and had either a bad
+        Frame Check Sequence (FCS) with an integral number
+        of octets (FCS Error) or a bad FCS with a non-integral
+        number of octets (Alignment Error).
+
+        Note that this definition of jabber is different
+        than the definition in IEEE-802.3 section 8.2.1.5
+        (10BASE5) and section 10.3.1.4 (10BASE2).  These
+        documents define jabber as the condition where any
+        packet exceeds 20 ms.  The allowed range to detect
+        jabber is between 20 ms and 150 ms."
+    ::= { etherStatsEntry 12 }
+
+etherStatsCollisions OBJECT-TYPE
+    SYNTAX     Counter32
+    UNITS      "Collisions"
+    MAX-ACCESS read-only
+    STATUS     current
+    DESCRIPTION
+        "The best estimate of the total number of collisions
+        on this Ethernet segment.
+
+        The value returned will depend on the location of the
+        RMON probe. Section 8.2.1.3 (10BASE-5) and section
+        10.3.1.3 (10BASE-2) of IEEE standard 802.3 states that a
+        station must detect a collision, in the receive mode, if
+        three or more stations are transmitting simultaneously.  A
+        repeater port must detect a collision when two or more
+
+        stations are transmitting simultaneously.  Thus a probe
+        placed on a repeater port could record more collisions
+        than a probe connected to a station on the same segment
+        would.
+
+        Probe location plays a much smaller role when considering
+        10BASE-T.  14.2.1.4 (10BASE-T) of IEEE standard 802.3
+        defines a collision as the simultaneous presence of signals
+        on the DO and RD circuits (transmitting and receiving
+        at the same time).  A 10BASE-T station can only detect
+        collisions when it is transmitting.  Thus probes placed on
+        a station and a repeater, should report the same number of
+        collisions.
+
+        Note also that an RMON probe inside a repeater should
+        ideally report collisions between the repeater and one or
+        more other hosts (transmit collisions as defined by IEEE
+        802.3k) plus receiver collisions observed on any coax
+        segments to which the repeater is connected."
+    ::= { etherStatsEntry 13 }
+
+etherStatsPkts64Octets OBJECT-TYPE
+    SYNTAX     Counter32
+    UNITS      "Packets"
+    MAX-ACCESS read-only
+    STATUS     current
+    DESCRIPTION
+        "The total number of packets (including bad
+        packets) received that were 64 octets in length
+        (excluding framing bits but including FCS octets)."
+    ::= { etherStatsEntry 14 }
+
+etherStatsPkts65to127Octets OBJECT-TYPE
+    SYNTAX     Counter32
+    UNITS      "Packets"
+    MAX-ACCESS read-only
+    STATUS     current
+    DESCRIPTION
+        "The total number of packets (including bad
+        packets) received that were between
+        65 and 127 octets in length inclusive
+        (excluding framing bits but including FCS octets)."
+    ::= { etherStatsEntry 15 }
+
+etherStatsPkts128to255Octets OBJECT-TYPE
+    SYNTAX     Counter32
+    UNITS      "Packets"
+    MAX-ACCESS read-only
+    STATUS     current
+    DESCRIPTION
+        "The total number of packets (including bad
+        packets) received that were between
+        128 and 255 octets in length inclusive
+        (excluding framing bits but including FCS octets)."
+    ::= { etherStatsEntry 16 }
+
+etherStatsPkts256to511Octets OBJECT-TYPE
+    SYNTAX     Counter32
+    UNITS      "Packets"
+    MAX-ACCESS read-only
+    STATUS     current
+    DESCRIPTION
+        "The total number of packets (including bad
+        packets) received that were between
+        256 and 511 octets in length inclusive
+        (excluding framing bits but including FCS octets)."
+    ::= { etherStatsEntry 17 }
+
+etherStatsPkts512to1023Octets OBJECT-TYPE
+    SYNTAX     Counter32
+    UNITS      "Packets"
+    MAX-ACCESS read-only
+    STATUS     current
+    DESCRIPTION
+        "The total number of packets (including bad
+        packets) received that were between
+        512 and 1023 octets in length inclusive
+        (excluding framing bits but including FCS octets)."
+    ::= { etherStatsEntry 18 }
+
+etherStatsPkts1024to1518Octets OBJECT-TYPE
+    SYNTAX     Counter32
+    UNITS      "Packets"
+    MAX-ACCESS read-only
+    STATUS     current
+    DESCRIPTION
+        "The total number of packets (including bad
+        packets) received that were between
+        1024 and 1518 octets in length inclusive
+        (excluding framing bits but including FCS octets)."
+    ::= { etherStatsEntry 19 }
+
+etherStatsOwner OBJECT-TYPE
+    SYNTAX     OwnerString
+    MAX-ACCESS read-create
+    STATUS     current
+    DESCRIPTION
+        "The entity that configured this entry and is therefore
+        using the resources assigned to it."
+    ::= { etherStatsEntry 20 }
+
+etherStatsStatus OBJECT-TYPE
+    SYNTAX     EntryStatus
+    MAX-ACCESS read-create
+    STATUS     current
+    DESCRIPTION
+        "The status of this etherStats entry."
+    ::= { etherStatsEntry 21 }
+
+-- The History Control Group
+
+-- Implementation of the History Control group is optional.
+-- Consult the MODULE-COMPLIANCE macro for the authoritative
+-- conformance information for this MIB.
+--
+-- The history control group controls the periodic statistical
+-- sampling of data from various types of networks.  The
+-- historyControlTable stores configuration entries that each
+-- define an interface, polling period, and other parameters.
+-- Once samples are taken, their data is stored in an entry
+-- in a media-specific table.  Each such entry defines one
+-- sample, and is associated with the historyControlEntry that
+-- caused the sample to be taken.  Each counter in the
+-- etherHistoryEntry counts the same event as its similarly-named
+-- counterpart in the etherStatsEntry, except that each value here
+-- is a cumulative sum during a sampling period.
+--
+-- If the probe keeps track of the time of day, it should start
+-- the first sample of the history at a time such that
+-- when the next hour of the day begins, a sample is
+-- started at that instant.  This tends to make more
+-- user-friendly reports, and enables comparison of reports
+-- from different probes that have relatively accurate time
+-- of day.
+--
+-- The probe is encouraged to add two history control entries
+-- per monitored interface upon initialization that describe a short
+-- term and a long term polling period.  Suggested parameters are 30
+-- seconds for the short term polling period and 30 minutes for
+-- the long term period.
+
+historyControlTable OBJECT-TYPE
+    SYNTAX     SEQUENCE OF HistoryControlEntry
+    MAX-ACCESS not-accessible
+    STATUS     current
+    DESCRIPTION
+        "A list of history control entries."
+    ::= { history 1 }
+
+historyControlEntry OBJECT-TYPE
+    SYNTAX     HistoryControlEntry
+    MAX-ACCESS not-accessible
+    STATUS     current
+    DESCRIPTION
+        "A list of parameters that set up a periodic sampling of
+        statistics.  As an example, an instance of the
+        historyControlInterval object might be named
+        historyControlInterval.2"
+    INDEX { historyControlIndex }
+    ::= { historyControlTable 1 }
+
+HistoryControlEntry ::= SEQUENCE {
+    historyControlIndex             Integer32,
+    historyControlDataSource        OBJECT IDENTIFIER,
+    historyControlBucketsRequested  Integer32,
+    historyControlBucketsGranted    Integer32,
+    historyControlInterval          Integer32,
+    historyControlOwner             OwnerString,
+    historyControlStatus            EntryStatus
+}
+
+historyControlIndex OBJECT-TYPE
+    SYNTAX     Integer32 (1..65535)
+    MAX-ACCESS read-only
+    STATUS     current
+    DESCRIPTION
+        "An index that uniquely identifies an entry in the
+        historyControl table.  Each such entry defines a
+        set of samples at a particular interval for an
+        interface on the device."
+    ::= { historyControlEntry 1 }
+
+historyControlDataSource OBJECT-TYPE
+    SYNTAX     OBJECT IDENTIFIER
+    MAX-ACCESS read-create
+    STATUS     current
+    DESCRIPTION
+        "This object identifies the source of the data for
+        which historical data was collected and
+        placed in a media-specific table on behalf of this
+        historyControlEntry.  This source can be any
+        interface on this device.  In order to identify
+
+        a particular interface, this object shall identify
+        the instance of the ifIndex object, defined
+        in  RFC 2233 [17], for the desired interface.
+        For example, if an entry were to receive data from
+        interface #1, this object would be set to ifIndex.1.
+
+        The statistics in this group reflect all packets
+        on the local network segment attached to the identified
+        interface.
+
+        An agent may or may not be able to tell if fundamental
+        changes to the media of the interface have occurred and
+        necessitate an invalidation of this entry.  For example, a
+        hot-pluggable ethernet card could be pulled out and replaced
+        by a token-ring card.  In such a case, if the agent has such
+        knowledge of the change, it is recommended that it
+        invalidate this entry.
+
+        This object may not be modified if the associated
+        historyControlStatus object is equal to valid(1)."
+    ::= { historyControlEntry 2 }
+
+historyControlBucketsRequested OBJECT-TYPE
+    SYNTAX     Integer32 (1..65535)
+    MAX-ACCESS read-create
+    STATUS     current
+    DESCRIPTION
+        "The requested number of discrete time intervals
+        over which data is to be saved in the part of the
+        media-specific table associated with this
+        historyControlEntry.
+
+        When this object is created or modified, the probe
+        should set historyControlBucketsGranted as closely to
+        this object as is possible for the particular probe
+        implementation and available resources."
+    DEFVAL { 50 }
+    ::= { historyControlEntry 3 }
+
+historyControlBucketsGranted OBJECT-TYPE
+    SYNTAX     Integer32 (1..65535)
+    MAX-ACCESS read-only
+    STATUS     current
+    DESCRIPTION
+        "The number of discrete sampling intervals
+        over which data shall be saved in the part of
+        the media-specific table associated with this
+        historyControlEntry.
+
+        When the associated historyControlBucketsRequested
+        object is created or modified, the probe
+        should set this object as closely to the requested
+        value as is possible for the particular
+        probe implementation and available resources.  The
+        probe must not lower this value except as a result
+        of a modification to the associated
+        historyControlBucketsRequested object.
+
+        There will be times when the actual number of
+        buckets associated with this entry is less than
+        the value of this object.  In this case, at the
+        end of each sampling interval, a new bucket will
+        be added to the media-specific table.
+
+        When the number of buckets reaches the value of
+        this object and a new bucket is to be added to the
+        media-specific table, the oldest bucket associated
+        with this historyControlEntry shall be deleted by
+        the agent so that the new bucket can be added.
+
+        When the value of this object changes to a value less
+        than the current value, entries are deleted
+        from the media-specific table associated with this
+        historyControlEntry.  Enough of the oldest of these
+        entries shall be deleted by the agent so that their
+        number remains less than or equal to the new value of
+        this object.
+
+        When the value of this object changes to a value greater
+        than the current value, the number of associated media-
+        specific entries may be allowed to grow."
+    ::= { historyControlEntry 4 }
+
+historyControlInterval OBJECT-TYPE
+    SYNTAX     Integer32 (1..3600)
+    UNITS      "Seconds"
+    MAX-ACCESS read-create
+    STATUS     current
+    DESCRIPTION
+        "The interval in seconds over which the data is
+        sampled for each bucket in the part of the
+        media-specific table associated with this
+        historyControlEntry.  This interval can
+        be set to any number of seconds between 1 and
+        3600 (1 hour).
+
+        Because the counters in a bucket may overflow at their
+
+        maximum value with no indication, a prudent manager will
+        take into account the possibility of overflow in any of
+        the associated counters.  It is important to consider the
+        minimum time in which any counter could overflow on a
+        particular media type and set the historyControlInterval
+        object to a value less than this interval.  This is
+        typically most important for the 'octets' counter in any
+        media-specific table.  For example, on an Ethernet
+        network, the etherHistoryOctets counter could overflow
+        in about one hour at the Ethernet's maximum
+        utilization.
+
+        This object may not be modified if the associated
+        historyControlStatus object is equal to valid(1)."
+    DEFVAL { 1800 }
+    ::= { historyControlEntry 5 }
+
+historyControlOwner OBJECT-TYPE
+    SYNTAX     OwnerString
+    MAX-ACCESS read-create
+    STATUS     current
+    DESCRIPTION
+        "The entity that configured this entry and is therefore
+        using the resources assigned to it."
+    ::= { historyControlEntry 6 }
+
+historyControlStatus OBJECT-TYPE
+    SYNTAX     EntryStatus
+    MAX-ACCESS read-create
+    STATUS     current
+    DESCRIPTION
+        "The status of this historyControl entry.
+
+        Each instance of the media-specific table associated
+        with this historyControlEntry will be deleted by the agent
+        if this historyControlEntry is not equal to valid(1)."
+    ::= { historyControlEntry 7 }
+
+-- The Ethernet History Group
+
+-- Implementation of the Ethernet History group is optional.
+-- Consult the MODULE-COMPLIANCE macro for the authoritative
+-- conformance information for this MIB.
+--
+-- The Ethernet History group records periodic statistical samples
+-- from a network and stores them for later retrieval.
+-- Once samples are taken, their data is stored in an entry
+-- in a media-specific table.  Each such entry defines one
+
+-- sample, and is associated with the historyControlEntry that
+-- caused the sample to be taken.  This group defines the
+-- etherHistoryTable, for Ethernet networks.
+--
+
+etherHistoryTable OBJECT-TYPE
+    SYNTAX     SEQUENCE OF EtherHistoryEntry
+    MAX-ACCESS not-accessible
+    STATUS     current
+    DESCRIPTION
+        "A list of Ethernet history entries."
+    ::= { history 2 }
+
+etherHistoryEntry OBJECT-TYPE
+    SYNTAX     EtherHistoryEntry
+    MAX-ACCESS not-accessible
+    STATUS     current
+    DESCRIPTION
+        "An historical sample of Ethernet statistics on a particular
+        Ethernet interface.  This sample is associated with the
+        historyControlEntry which set up the parameters for
+        a regular collection of these samples.  As an example, an
+        instance of the etherHistoryPkts object might be named
+        etherHistoryPkts.2.89"
+    INDEX { etherHistoryIndex , etherHistorySampleIndex }
+    ::= { etherHistoryTable 1 }
+
+EtherHistoryEntry ::= SEQUENCE {
+    etherHistoryIndex                 Integer32,
+    etherHistorySampleIndex           Integer32,
+    etherHistoryIntervalStart         TimeTicks,
+    etherHistoryDropEvents            Counter32,
+    etherHistoryOctets                Counter32,
+    etherHistoryPkts                  Counter32,
+    etherHistoryBroadcastPkts         Counter32,
+    etherHistoryMulticastPkts         Counter32,
+    etherHistoryCRCAlignErrors        Counter32,
+    etherHistoryUndersizePkts         Counter32,
+    etherHistoryOversizePkts          Counter32,
+    etherHistoryFragments             Counter32,
+    etherHistoryJabbers               Counter32,
+    etherHistoryCollisions            Counter32,
+    etherHistoryUtilization           Integer32
+}
+
+etherHistoryIndex OBJECT-TYPE
+    SYNTAX     Integer32 (1..65535)
+    MAX-ACCESS read-only
+    STATUS     current
+    DESCRIPTION
+        "The history of which this entry is a part.  The
+        history identified by a particular value of this
+        index is the same history as identified
+        by the same value of historyControlIndex."
+    ::= { etherHistoryEntry 1 }
+
+etherHistorySampleIndex OBJECT-TYPE
+    SYNTAX     Integer32 (1..2147483647)
+    MAX-ACCESS read-only
+    STATUS     current
+    DESCRIPTION
+        "An index that uniquely identifies the particular
+        sample this entry represents among all samples
+        associated with the same historyControlEntry.
+        This index starts at 1 and increases by one
+        as each new sample is taken."
+    ::= { etherHistoryEntry 2 }
+
+etherHistoryIntervalStart OBJECT-TYPE
+    SYNTAX     TimeTicks
+    MAX-ACCESS read-only
+    STATUS     current
+    DESCRIPTION
+        "The value of sysUpTime at the start of the interval
+        over which this sample was measured.  If the probe
+        keeps track of the time of day, it should start
+        the first sample of the history at a time such that
+        when the next hour of the day begins, a sample is
+        started at that instant.  Note that following this
+        rule may require the probe to delay collecting the
+        first sample of the history, as each sample must be
+        of the same interval.  Also note that the sample which
+        is currently being collected is not accessible in this
+        table until the end of its interval."
+    ::= { etherHistoryEntry 3 }
+
+etherHistoryDropEvents OBJECT-TYPE
+    SYNTAX     Counter32
+    MAX-ACCESS read-only
+    STATUS     current
+    DESCRIPTION
+        "The total number of events in which packets
+        were dropped by the probe due to lack of resources
+        during this sampling interval.  Note that this number
+        is not necessarily the number of packets dropped, it
+        is just the number of times this condition has been
+
+        detected."
+    ::= { etherHistoryEntry 4 }
+
+etherHistoryOctets OBJECT-TYPE
+    SYNTAX     Counter32
+    UNITS      "Octets"
+    MAX-ACCESS read-only
+    STATUS     current
+    DESCRIPTION
+        "The total number of octets of data (including
+        those in bad packets) received on the
+        network (excluding framing bits but including
+        FCS octets)."
+    ::= { etherHistoryEntry 5 }
+
+etherHistoryPkts OBJECT-TYPE
+    SYNTAX     Counter32
+    UNITS      "Packets"
+    MAX-ACCESS read-only
+    STATUS     current
+    DESCRIPTION
+        "The number of packets (including bad packets)
+        received during this sampling interval."
+    ::= { etherHistoryEntry 6 }
+
+etherHistoryBroadcastPkts OBJECT-TYPE
+    SYNTAX     Counter32
+    UNITS      "Packets"
+    MAX-ACCESS read-only
+    STATUS     current
+    DESCRIPTION
+        "The number of good packets received during this
+        sampling interval that were directed to the
+        broadcast address."
+    ::= { etherHistoryEntry 7 }
+
+etherHistoryMulticastPkts OBJECT-TYPE
+    SYNTAX     Counter32
+    UNITS      "Packets"
+    MAX-ACCESS read-only
+    STATUS     current
+    DESCRIPTION
+        "The number of good packets received during this
+        sampling interval that were directed to a
+        multicast address.  Note that this number does not
+        include packets addressed to the broadcast address."
+    ::= { etherHistoryEntry 8 }
+
+etherHistoryCRCAlignErrors OBJECT-TYPE
+    SYNTAX     Counter32
+    UNITS      "Packets"
+    MAX-ACCESS read-only
+    STATUS     current
+    DESCRIPTION
+        "The number of packets received during this
+        sampling interval that had a length (excluding
+        framing bits but including FCS octets) between
+        64 and 1518 octets, inclusive, but had either a bad Frame
+        Check Sequence (FCS) with an integral number of octets
+        (FCS Error) or a bad FCS with a non-integral number
+        of octets (Alignment Error)."
+    ::= { etherHistoryEntry 9 }
+
+etherHistoryUndersizePkts OBJECT-TYPE
+    SYNTAX     Counter32
+    UNITS      "Packets"
+    MAX-ACCESS read-only
+    STATUS     current
+    DESCRIPTION
+        "The number of packets received during this
+        sampling interval that were less than 64 octets
+        long (excluding framing bits but including FCS
+        octets) and were otherwise well formed."
+    ::= { etherHistoryEntry 10 }
+
+etherHistoryOversizePkts OBJECT-TYPE
+    SYNTAX     Counter32
+    UNITS      "Packets"
+    MAX-ACCESS read-only
+    STATUS     current
+    DESCRIPTION
+        "The number of packets received during this
+        sampling interval that were longer than 1518
+        octets (excluding framing bits but including
+        FCS octets) but were otherwise well formed."
+    ::= { etherHistoryEntry 11 }
+
+etherHistoryFragments OBJECT-TYPE
+    SYNTAX     Counter32
+    UNITS      "Packets"
+    MAX-ACCESS read-only
+    STATUS     current
+    DESCRIPTION
+        "The total number of packets received during this
+        sampling interval that were less than 64 octets in
+        length (excluding framing bits but including FCS
+
+        octets) had either a bad Frame Check Sequence (FCS)
+        with an integral number of octets (FCS Error) or a bad
+        FCS with a non-integral number of octets (Alignment
+        Error).
+
+        Note that it is entirely normal for etherHistoryFragments to
+        increment.  This is because it counts both runts (which are
+        normal occurrences due to collisions) and noise hits."
+    ::= { etherHistoryEntry 12 }
+
+etherHistoryJabbers OBJECT-TYPE
+    SYNTAX     Counter32
+    UNITS      "Packets"
+    MAX-ACCESS read-only
+    STATUS     current
+    DESCRIPTION
+        "The number of packets received during this
+        sampling interval that were longer than 1518 octets
+        (excluding framing bits but including FCS octets),
+        and  had either a bad Frame Check Sequence (FCS)
+        with an integral number of octets (FCS Error) or
+        a bad FCS with a non-integral number of octets
+        (Alignment Error).
+
+        Note that this definition of jabber is different
+        than the definition in IEEE-802.3 section 8.2.1.5
+        (10BASE5) and section 10.3.1.4 (10BASE2).  These
+        documents define jabber as the condition where any
+        packet exceeds 20 ms.  The allowed range to detect
+        jabber is between 20 ms and 150 ms."
+    ::= { etherHistoryEntry 13 }
+
+etherHistoryCollisions OBJECT-TYPE
+    SYNTAX     Counter32
+    UNITS      "Collisions"
+    MAX-ACCESS read-only
+    STATUS     current
+    DESCRIPTION
+        "The best estimate of the total number of collisions
+        on this Ethernet segment during this sampling
+        interval.
+
+        The value returned will depend on the location of the
+        RMON probe. Section 8.2.1.3 (10BASE-5) and section
+        10.3.1.3 (10BASE-2) of IEEE standard 802.3 states that a
+        station must detect a collision, in the receive mode, if
+        three or more stations are transmitting simultaneously.  A
+        repeater port must detect a collision when two or more
+
+        stations are transmitting simultaneously.  Thus a probe
+        placed on a repeater port could record more collisions
+        than a probe connected to a station on the same segment
+        would.
+
+        Probe location plays a much smaller role when considering
+        10BASE-T.  14.2.1.4 (10BASE-T) of IEEE standard 802.3
+        defines a collision as the simultaneous presence of signals
+        on the DO and RD circuits (transmitting and receiving
+        at the same time).  A 10BASE-T station can only detect
+        collisions when it is transmitting.  Thus probes placed on
+        a station and a repeater, should report the same number of
+        collisions.
+
+        Note also that an RMON probe inside a repeater should
+        ideally report collisions between the repeater and one or
+        more other hosts (transmit collisions as defined by IEEE
+        802.3k) plus receiver collisions observed on any coax
+        segments to which the repeater is connected."
+    ::= { etherHistoryEntry 14 }
+
+etherHistoryUtilization OBJECT-TYPE
+    SYNTAX     Integer32 (0..10000)
+    MAX-ACCESS read-only
+    STATUS     current
+    DESCRIPTION
+        "The best estimate of the mean physical layer
+        network utilization on this interface during this
+        sampling interval, in hundredths of a percent."
+    ::= { etherHistoryEntry 15 }
+
+-- The Alarm Group
+
+-- Implementation of the Alarm group is optional. The Alarm Group
+-- requires the implementation of the Event group.
+-- Consult the MODULE-COMPLIANCE macro for the authoritative
+-- conformance information for this MIB.
+--
+-- The Alarm group periodically takes statistical samples from
+-- variables in the probe and compares them to thresholds that have
+-- been configured.  The alarm table stores configuration
+-- entries that each define a variable, polling period, and
+-- threshold parameters.  If a sample is found to cross the
+-- threshold values, an event is generated.  Only variables that
+-- resolve to an ASN.1 primitive type of INTEGER (INTEGER, Integer32,
+-- Counter32, Counter64, Gauge32, or TimeTicks) may be monitored in
+-- this way.
+--
+
+-- This function has a hysteresis mechanism to limit the generation
+-- of events.  This mechanism generates one event as a threshold
+-- is crossed in the appropriate direction.  No more events are
+-- generated for that threshold until the opposite threshold is
+-- crossed.
+--
+-- In the case of a sampling a deltaValue, a probe may implement
+-- this mechanism with more precision if it takes a delta sample
+-- twice per period, each time comparing the sum of the latest two
+-- samples to the threshold.  This allows the detection of threshold
+-- crossings that span the sampling boundary.  Note that this does
+-- not require any special configuration of the threshold value.
+-- It is suggested that probes implement this more precise algorithm.
+
+alarmTable OBJECT-TYPE
+    SYNTAX     SEQUENCE OF AlarmEntry
+    MAX-ACCESS not-accessible
+    STATUS     current
+    DESCRIPTION
+        "A list of alarm entries."
+    ::= { alarm 1 }
+
+alarmEntry OBJECT-TYPE
+    SYNTAX     AlarmEntry
+    MAX-ACCESS not-accessible
+    STATUS     current
+    DESCRIPTION
+        "A list of parameters that set up a periodic checking
+        for alarm conditions.  For example, an instance of the
+        alarmValue object might be named alarmValue.8"
+    INDEX { alarmIndex }
+    ::= { alarmTable 1 }
+
+AlarmEntry ::= SEQUENCE {
+    alarmIndex                    Integer32,
+    alarmInterval                 Integer32,
+    alarmVariable                 OBJECT IDENTIFIER,
+    alarmSampleType               INTEGER,
+    alarmValue                    Integer32,
+    alarmStartupAlarm             INTEGER,
+    alarmRisingThreshold          Integer32,
+    alarmFallingThreshold         Integer32,
+    alarmRisingEventIndex         Integer32,
+    alarmFallingEventIndex        Integer32,
+    alarmOwner                    OwnerString,
+    alarmStatus                   EntryStatus
+}
+
+alarmIndex OBJECT-TYPE
+    SYNTAX     Integer32 (1..65535)
+    MAX-ACCESS read-only
+    STATUS     current
+    DESCRIPTION
+        "An index that uniquely identifies an entry in the
+        alarm table.  Each such entry defines a
+        diagnostic sample at a particular interval
+        for an object on the device."
+    ::= { alarmEntry 1 }
+
+alarmInterval OBJECT-TYPE
+    SYNTAX     Integer32
+    UNITS      "Seconds"
+    MAX-ACCESS read-create
+    STATUS     current
+    DESCRIPTION
+        "The interval in seconds over which the data is
+        sampled and compared with the rising and falling
+        thresholds.  When setting this variable, care
+        should be taken in the case of deltaValue
+        sampling - the interval should be set short enough
+        that the sampled variable is very unlikely to
+        increase or decrease by more than 2^31 - 1 during
+        a single sampling interval.
+
+        This object may not be modified if the associated
+        alarmStatus object is equal to valid(1)."
+    ::= { alarmEntry 2 }
+
+alarmVariable OBJECT-TYPE
+    SYNTAX     OBJECT IDENTIFIER
+    MAX-ACCESS read-create
+    STATUS     current
+    DESCRIPTION
+        "The object identifier of the particular variable to be
+        sampled.  Only variables that resolve to an ASN.1 primitive
+        type of INTEGER (INTEGER, Integer32, Counter32, Counter64,
+        Gauge, or TimeTicks) may be sampled.
+
+        Because SNMP access control is articulated entirely
+        in terms of the contents of MIB views, no access
+        control mechanism exists that can restrict the value of
+        this object to identify only those objects that exist
+        in a particular MIB view.  Because there is thus no
+        acceptable means of restricting the read access that
+        could be obtained through the alarm mechanism, the
+        probe must only grant write access to this object in
+
+        those views that have read access to all objects on
+        the probe.
+
+        During a set operation, if the supplied variable name is
+        not available in the selected MIB view, a badValue error
+        must be returned.  If at any time the variable name of
+        an established alarmEntry is no longer available in the
+        selected MIB view, the probe must change the status of
+        this alarmEntry to invalid(4).
+
+        This object may not be modified if the associated
+        alarmStatus object is equal to valid(1)."
+    ::= { alarmEntry 3 }
+
+alarmSampleType OBJECT-TYPE
+    SYNTAX     INTEGER {
+                 absoluteValue(1),
+                 deltaValue(2)
+               }
+    MAX-ACCESS read-create
+    STATUS     current
+    DESCRIPTION
+        "The method of sampling the selected variable and
+        calculating the value to be compared against the
+        thresholds.  If the value of this object is
+        absoluteValue(1), the value of the selected variable
+        will be compared directly with the thresholds at the
+        end of the sampling interval.  If the value of this
+        object is deltaValue(2), the value of the selected
+        variable at the last sample will be subtracted from
+        the current value, and the difference compared with
+        the thresholds.
+
+        This object may not be modified if the associated
+        alarmStatus object is equal to valid(1)."
+    ::= { alarmEntry 4 }
+
+alarmValue OBJECT-TYPE
+    SYNTAX     Integer32
+    MAX-ACCESS read-only
+    STATUS     current
+    DESCRIPTION
+        "The value of the statistic during the last sampling
+        period.  For example, if the sample type is deltaValue,
+        this value will be the difference between the samples
+        at the beginning and end of the period.  If the sample
+        type is absoluteValue, this value will be the sampled
+        value at the end of the period.
+
+        This is the value that is compared with the rising and
+        falling thresholds.
+
+        The value during the current sampling period is not
+        made available until the period is completed and will
+        remain available until the next period completes."
+    ::= { alarmEntry 5 }
+
+alarmStartupAlarm OBJECT-TYPE
+    SYNTAX     INTEGER {
+                 risingAlarm(1),
+                 fallingAlarm(2),
+                 risingOrFallingAlarm(3)
+               }
+    MAX-ACCESS read-create
+    STATUS     current
+    DESCRIPTION
+        "The alarm that may be sent when this entry is first
+        set to valid.  If the first sample after this entry
+        becomes valid is greater than or equal to the
+        risingThreshold and alarmStartupAlarm is equal to
+        risingAlarm(1) or risingOrFallingAlarm(3), then a single
+        rising alarm will be generated.  If the first sample
+        after this entry becomes valid is less than or equal
+        to the fallingThreshold and alarmStartupAlarm is equal
+        to fallingAlarm(2) or risingOrFallingAlarm(3), then a
+        single falling alarm will be generated.
+
+        This object may not be modified if the associated
+        alarmStatus object is equal to valid(1)."
+    ::= { alarmEntry 6 }
+
+alarmRisingThreshold OBJECT-TYPE
+    SYNTAX     Integer32
+    MAX-ACCESS read-create
+    STATUS     current
+    DESCRIPTION
+        "A threshold for the sampled statistic.  When the current
+        sampled value is greater than or equal to this threshold,
+        and the value at the last sampling interval was less than
+        this threshold, a single event will be generated.
+        A single event will also be generated if the first
+        sample after this entry becomes valid is greater than or
+        equal to this threshold and the associated
+        alarmStartupAlarm is equal to risingAlarm(1) or
+        risingOrFallingAlarm(3).
+
+        After a rising event is generated, another such event
+
+        will not be generated until the sampled value
+        falls below this threshold and reaches the
+        alarmFallingThreshold.
+
+        This object may not be modified if the associated
+        alarmStatus object is equal to valid(1)."
+    ::= { alarmEntry 7 }
+
+alarmFallingThreshold OBJECT-TYPE
+    SYNTAX     Integer32
+    MAX-ACCESS read-create
+    STATUS     current
+    DESCRIPTION
+        "A threshold for the sampled statistic.  When the current
+        sampled value is less than or equal to this threshold,
+        and the value at the last sampling interval was greater than
+        this threshold, a single event will be generated.
+        A single event will also be generated if the first
+        sample after this entry becomes valid is less than or
+        equal to this threshold and the associated
+        alarmStartupAlarm is equal to fallingAlarm(2) or
+        risingOrFallingAlarm(3).
+
+        After a falling event is generated, another such event
+        will not be generated until the sampled value
+        rises above this threshold and reaches the
+        alarmRisingThreshold.
+
+        This object may not be modified if the associated
+        alarmStatus object is equal to valid(1)."
+    ::= { alarmEntry 8 }
+
+alarmRisingEventIndex OBJECT-TYPE
+    SYNTAX     Integer32 (0..65535)
+    MAX-ACCESS read-create
+    STATUS     current
+    DESCRIPTION
+        "The index of the eventEntry that is
+        used when a rising threshold is crossed.  The
+        eventEntry identified by a particular value of
+        this index is the same as identified by the same value
+        of the eventIndex object.  If there is no
+        corresponding entry in the eventTable, then
+        no association exists.  In particular, if this value
+        is zero, no associated event will be generated, as
+        zero is not a valid event index.
+
+        This object may not be modified if the associated
+
+        alarmStatus object is equal to valid(1)."
+    ::= { alarmEntry 9 }
+
+alarmFallingEventIndex OBJECT-TYPE
+    SYNTAX     Integer32 (0..65535)
+    MAX-ACCESS read-create
+    STATUS     current
+    DESCRIPTION
+        "The index of the eventEntry that is
+        used when a falling threshold is crossed.  The
+        eventEntry identified by a particular value of
+        this index is the same as identified by the same value
+        of the eventIndex object.  If there is no
+        corresponding entry in the eventTable, then
+        no association exists.  In particular, if this value
+        is zero, no associated event will be generated, as
+        zero is not a valid event index.
+
+        This object may not be modified if the associated
+        alarmStatus object is equal to valid(1)."
+    ::= { alarmEntry 10 }
+
+alarmOwner OBJECT-TYPE
+    SYNTAX     OwnerString
+    MAX-ACCESS read-create
+    STATUS     current
+    DESCRIPTION
+        "The entity that configured this entry and is therefore
+        using the resources assigned to it."
+    ::= { alarmEntry 11 }
+
+alarmStatus OBJECT-TYPE
+    SYNTAX     EntryStatus
+    MAX-ACCESS read-create
+    STATUS     current
+    DESCRIPTION
+        "The status of this alarm entry."
+    ::= { alarmEntry 12 }
+
+-- The Host Group
+
+-- Implementation of the Host group is optional.
+-- Consult the MODULE-COMPLIANCE macro for the authoritative
+-- conformance information for this MIB.
+--
+-- The host group discovers new hosts on the network by
+-- keeping a list of source and destination MAC Addresses seen
+-- in good packets.  For each of these addresses, the host group
+
+-- keeps a set of statistics.  The hostControlTable controls
+-- which interfaces this function is performed on, and contains
+-- some information about the process.  On behalf of each
+-- hostControlEntry, data is collected on an interface and placed
+-- in both the hostTable and the hostTimeTable.  If the
+-- monitoring device finds itself short of resources, it may
+-- delete entries as needed.  It is suggested that the device
+-- delete the least recently used entries first.
+
+-- The hostTable contains entries for each address discovered on
+-- a particular interface.  Each entry contains statistical
+-- data about that host.  This table is indexed by the
+-- MAC address of the host, through which a random access
+-- may be achieved.
+
+-- The hostTimeTable contains data in the same format as the
+-- hostTable, and must contain the same set of hosts, but is
+-- indexed using hostTimeCreationOrder rather than hostAddress.
+-- The hostTimeCreationOrder is an integer which reflects
+-- the relative order in which a particular entry was discovered
+-- and thus inserted into the table.  As this order, and thus
+-- the index, is among those entries currently in the table,
+-- the index for a particular entry may change if an
+-- (earlier) entry is deleted.  Thus the association between
+-- hostTimeCreationOrder and hostTimeEntry may be broken at
+-- any time.
+
+-- The hostTimeTable has two important uses.  The first is the
+-- fast download of this potentially large table.  Because the
+-- index of this table runs from 1 to the size of the table,
+-- inclusive, its values are predictable.  This allows very
+-- efficient packing of variables into SNMP PDU's and allows
+-- a table transfer to have multiple packets outstanding.
+-- These benefits increase transfer rates tremendously.
+
+-- The second use of the hostTimeTable is the efficient discovery
+-- by the management station of new entries added to the table.
+-- After the management station has downloaded the entire table,
+-- it knows that new entries will be added immediately after the
+-- end of the current table.  It can thus detect new entries there
+-- and retrieve them easily.
+
+-- Because the association between hostTimeCreationOrder and
+-- hostTimeEntry may be broken at any time, the management
+-- station must monitor the related hostControlLastDeleteTime
+-- object.  When the management station thus detects a deletion,
+-- it must assume that any such associations have been broken,
+-- and invalidate any it has stored locally.  This includes
+
+-- restarting any download of the hostTimeTable that may have been
+-- in progress, as well as rediscovering the end of the
+-- hostTimeTable so that it may detect new entries.  If the
+-- management station does not detect the broken association,
+-- it may continue to refer to a particular host by its
+-- creationOrder while unwittingly retrieving the data associated
+-- with another host entirely.  If this happens while downloading
+-- the host table, the management station may fail to download
+-- all of the entries in the table.
+
+hostControlTable OBJECT-TYPE
+    SYNTAX     SEQUENCE OF HostControlEntry
+    MAX-ACCESS not-accessible
+    STATUS     current
+    DESCRIPTION
+        "A list of host table control entries."
+    ::= { hosts 1 }
+
+hostControlEntry OBJECT-TYPE
+    SYNTAX     HostControlEntry
+    MAX-ACCESS not-accessible
+    STATUS     current
+    DESCRIPTION
+        "A list of parameters that set up the discovery of hosts
+        on a particular interface and the collection of statistics
+        about these hosts.  For example, an instance of the
+        hostControlTableSize object might be named
+        hostControlTableSize.1"
+    INDEX { hostControlIndex }
+    ::= { hostControlTable 1 }
+
+HostControlEntry ::= SEQUENCE {
+
+    hostControlIndex            Integer32,
+    hostControlDataSource       OBJECT IDENTIFIER,
+    hostControlTableSize        Integer32,
+    hostControlLastDeleteTime   TimeTicks,
+    hostControlOwner            OwnerString,
+    hostControlStatus           EntryStatus
+}
+
+hostControlIndex OBJECT-TYPE
+    SYNTAX     Integer32 (1..65535)
+    MAX-ACCESS read-only
+    STATUS     current
+    DESCRIPTION
+        "An index that uniquely identifies an entry in the
+
+        hostControl table.  Each such entry defines
+        a function that discovers hosts on a particular interface
+        and places statistics about them in the hostTable and
+        the hostTimeTable on behalf of this hostControlEntry."
+    ::= { hostControlEntry 1 }
+
+hostControlDataSource OBJECT-TYPE
+    SYNTAX     OBJECT IDENTIFIER
+    MAX-ACCESS read-create
+    STATUS     current
+    DESCRIPTION
+        "This object identifies the source of the data for
+        this instance of the host function.  This source
+        can be any interface on this device.  In order
+        to identify a particular interface, this object shall
+        identify the instance of the ifIndex object, defined
+        in RFC 2233 [17], for the desired interface.
+        For example, if an entry were to receive data from
+        interface #1, this object would be set to ifIndex.1.
+
+        The statistics in this group reflect all packets
+        on the local network segment attached to the identified
+        interface.
+
+        An agent may or may not be able to tell if fundamental
+        changes to the media of the interface have occurred and
+        necessitate an invalidation of this entry.  For example, a
+        hot-pluggable ethernet card could be pulled out and replaced
+        by a token-ring card.  In such a case, if the agent has such
+        knowledge of the change, it is recommended that it
+        invalidate this entry.
+
+        This object may not be modified if the associated
+        hostControlStatus object is equal to valid(1)."
+    ::= { hostControlEntry 2 }
+
+hostControlTableSize OBJECT-TYPE
+    SYNTAX     Integer32
+    MAX-ACCESS read-only
+    STATUS     current
+    DESCRIPTION
+        "The number of hostEntries in the hostTable and the
+        hostTimeTable associated with this hostControlEntry."
+    ::= { hostControlEntry 3 }
+
+hostControlLastDeleteTime OBJECT-TYPE
+    SYNTAX     TimeTicks
+    MAX-ACCESS read-only
+    STATUS     current
+    DESCRIPTION
+        "The value of sysUpTime when the last entry
+        was deleted from the portion of the hostTable
+        associated with this hostControlEntry.  If no
+        deletions have occurred, this value shall be zero."
+    ::= { hostControlEntry 4 }
+
+hostControlOwner OBJECT-TYPE
+    SYNTAX     OwnerString
+    MAX-ACCESS read-create
+    STATUS     current
+    DESCRIPTION
+        "The entity that configured this entry and is therefore
+        using the resources assigned to it."
+    ::= { hostControlEntry 5 }
+
+hostControlStatus OBJECT-TYPE
+    SYNTAX     EntryStatus
+    MAX-ACCESS read-create
+    STATUS     current
+    DESCRIPTION
+        "The status of this hostControl entry.
+
+        If this object is not equal to valid(1), all associated
+        entries in the hostTable, hostTimeTable, and the
+        hostTopNTable shall be deleted by the agent."
+    ::= { hostControlEntry 6 }
+
+hostTable OBJECT-TYPE
+    SYNTAX     SEQUENCE OF HostEntry
+    MAX-ACCESS not-accessible
+    STATUS     current
+    DESCRIPTION
+        "A list of host entries."
+    ::= { hosts 2 }
+
+hostEntry OBJECT-TYPE
+    SYNTAX     HostEntry
+    MAX-ACCESS not-accessible
+    STATUS     current
+    DESCRIPTION
+        "A collection of statistics for a particular host that has
+        been discovered on an interface of this device.  For example,
+        an instance of the hostOutBroadcastPkts object might be
+        named hostOutBroadcastPkts.1.6.8.0.32.27.3.176"
+    INDEX { hostIndex, hostAddress }
+    ::= { hostTable 1 }
+
+HostEntry ::= SEQUENCE {
+    hostAddress             OCTET STRING,
+    hostCreationOrder       Integer32,
+    hostIndex               Integer32,
+    hostInPkts              Counter32,
+    hostOutPkts             Counter32,
+    hostInOctets            Counter32,
+    hostOutOctets           Counter32,
+    hostOutErrors           Counter32,
+    hostOutBroadcastPkts    Counter32,
+    hostOutMulticastPkts    Counter32
+}
+
+hostAddress OBJECT-TYPE
+    SYNTAX     OCTET STRING
+    MAX-ACCESS read-only
+    STATUS     current
+    DESCRIPTION
+        "The physical address of this host."
+    ::= { hostEntry 1 }
+
+hostCreationOrder OBJECT-TYPE
+    SYNTAX     Integer32 (1..65535)
+    MAX-ACCESS read-only
+    STATUS     current
+    DESCRIPTION
+        "An index that defines the relative ordering of
+        the creation time of hosts captured for a
+        particular hostControlEntry.  This index shall
+        be between 1 and N, where N is the value of
+        the associated hostControlTableSize.  The ordering
+        of the indexes is based on the order of each entry's
+        insertion into the table, in which entries added earlier
+        have a lower index value than entries added later.
+
+        It is important to note that the order for a
+        particular entry may change as an (earlier) entry
+        is deleted from the table.  Because this order may
+        change, management stations should make use of the
+        hostControlLastDeleteTime variable in the
+        hostControlEntry associated with the relevant
+        portion of the hostTable.  By observing
+        this variable, the management station may detect
+        the circumstances where a previous association
+        between a value of hostCreationOrder
+        and a hostEntry may no longer hold."
+    ::= { hostEntry 2 }
+
+hostIndex OBJECT-TYPE
+    SYNTAX     Integer32 (1..65535)
+    MAX-ACCESS read-only
+    STATUS     current
+    DESCRIPTION
+        "The set of collected host statistics of which
+        this entry is a part.  The set of hosts
+        identified by a particular value of this
+        index is associated with the hostControlEntry
+        as identified by the same value of hostControlIndex."
+    ::= { hostEntry 3 }
+
+hostInPkts OBJECT-TYPE
+    SYNTAX     Counter32
+    UNITS      "Packets"
+    MAX-ACCESS read-only
+    STATUS     current
+    DESCRIPTION
+        "The number of good packets transmitted to this
+        address since it was added to the hostTable."
+    ::= { hostEntry 4 }
+
+hostOutPkts OBJECT-TYPE
+    SYNTAX     Counter32
+    UNITS      "Packets"
+    MAX-ACCESS read-only
+    STATUS     current
+    DESCRIPTION
+        "The number of packets, including bad packets, transmitted
+        by this address since it was added to the hostTable."
+    ::= { hostEntry 5 }
+
+hostInOctets OBJECT-TYPE
+    SYNTAX     Counter32
+    UNITS      "Octets"
+    MAX-ACCESS read-only
+    STATUS     current
+    DESCRIPTION
+        "The number of octets transmitted to this address since
+        it was added to the hostTable (excluding framing
+        bits but including FCS octets), except for those
+        octets in bad packets."
+    ::= { hostEntry 6 }
+
+hostOutOctets OBJECT-TYPE
+    SYNTAX     Counter32
+    UNITS      "Octets"
+    MAX-ACCESS read-only
+    STATUS     current
+    DESCRIPTION
+        "The number of octets transmitted by this address since
+        it was added to the hostTable (excluding framing
+        bits but including FCS octets), including those
+        octets in bad packets."
+    ::= { hostEntry 7 }
+
+hostOutErrors OBJECT-TYPE
+    SYNTAX     Counter32
+    UNITS      "Packets"
+    MAX-ACCESS read-only
+    STATUS     current
+    DESCRIPTION
+        "The number of bad packets transmitted by this address
+        since this host was added to the hostTable."
+    ::= { hostEntry 8 }
+
+hostOutBroadcastPkts OBJECT-TYPE
+    SYNTAX     Counter32
+    UNITS      "Packets"
+    MAX-ACCESS read-only
+    STATUS     current
+    DESCRIPTION
+        "The number of good packets transmitted by this
+        address that were directed to the broadcast address
+        since this host was added to the hostTable."
+    ::= { hostEntry 9 }
+
+hostOutMulticastPkts OBJECT-TYPE
+    SYNTAX     Counter32
+    UNITS      "Packets"
+    MAX-ACCESS read-only
+    STATUS     current
+    DESCRIPTION
+        "The number of good packets transmitted by this
+        address that were directed to a multicast address
+        since this host was added to the hostTable.
+        Note that this number does not include packets
+        directed to the broadcast address."
+    ::= { hostEntry 10 }
+
+-- host Time Table
+
+hostTimeTable OBJECT-TYPE
+    SYNTAX     SEQUENCE OF HostTimeEntry
+    MAX-ACCESS not-accessible
+    STATUS     current
+    DESCRIPTION
+        "A list of time-ordered host table entries."
+    ::= { hosts 3 }
+
+hostTimeEntry OBJECT-TYPE
+    SYNTAX     HostTimeEntry
+    MAX-ACCESS not-accessible
+    STATUS     current
+    DESCRIPTION
+        "A collection of statistics for a particular host that has
+        been discovered on an interface of this device.  This
+        collection includes the relative ordering of the creation
+        time of this object.  For example, an instance of the
+        hostTimeOutBroadcastPkts object might be named
+        hostTimeOutBroadcastPkts.1.687"
+    INDEX { hostTimeIndex, hostTimeCreationOrder }
+    ::= { hostTimeTable 1 }
+
+HostTimeEntry ::= SEQUENCE {
+    hostTimeAddress              OCTET STRING,
+    hostTimeCreationOrder        Integer32,
+    hostTimeIndex                Integer32,
+    hostTimeInPkts               Counter32,
+    hostTimeOutPkts              Counter32,
+    hostTimeInOctets             Counter32,
+    hostTimeOutOctets            Counter32,
+    hostTimeOutErrors            Counter32,
+    hostTimeOutBroadcastPkts     Counter32,
+    hostTimeOutMulticastPkts     Counter32
+}
+
+hostTimeAddress OBJECT-TYPE
+    SYNTAX     OCTET STRING
+    MAX-ACCESS read-only
+    STATUS     current
+    DESCRIPTION
+        "The physical address of this host."
+    ::= { hostTimeEntry 1 }
+
+hostTimeCreationOrder OBJECT-TYPE
+    SYNTAX     Integer32 (1..65535)
+    MAX-ACCESS read-only
+    STATUS     current
+    DESCRIPTION
+        "An index that uniquely identifies an entry in
+        the hostTime table among those entries associated
+        with the same hostControlEntry.  This index shall
+        be between 1 and N, where N is the value of
+
+        the associated hostControlTableSize.  The ordering
+        of the indexes is based on the order of each entry's
+        insertion into the table, in which entries added earlier
+        have a lower index value than entries added later.
+        Thus the management station has the ability to
+        learn of new entries added to this table without
+        downloading the entire table.
+
+        It is important to note that the index for a
+        particular entry may change as an (earlier) entry
+        is deleted from the table.  Because this order may
+        change, management stations should make use of the
+        hostControlLastDeleteTime variable in the
+        hostControlEntry associated with the relevant
+        portion of the hostTimeTable.  By observing
+        this variable, the management station may detect
+        the circumstances where a download of the table
+        may have missed entries, and where a previous
+        association between a value of hostTimeCreationOrder
+        and a hostTimeEntry may no longer hold."
+    ::= { hostTimeEntry 2 }
+
+hostTimeIndex OBJECT-TYPE
+    SYNTAX     Integer32 (1..65535)
+    MAX-ACCESS read-only
+    STATUS     current
+    DESCRIPTION
+        "The set of collected host statistics of which
+        this entry is a part.  The set of hosts
+        identified by a particular value of this
+        index is associated with the hostControlEntry
+        as identified by the same value of hostControlIndex."
+    ::= { hostTimeEntry 3 }
+
+hostTimeInPkts OBJECT-TYPE
+    SYNTAX     Counter32
+    UNITS      "Packets"
+    MAX-ACCESS read-only
+    STATUS     current
+    DESCRIPTION
+        "The number of good packets transmitted to this
+        address since it was added to the hostTimeTable."
+    ::= { hostTimeEntry 4 }
+
+hostTimeOutPkts OBJECT-TYPE
+    SYNTAX     Counter32
+    UNITS      "Packets"
+    MAX-ACCESS read-only
+    STATUS     current
+    DESCRIPTION
+        "The number of packets, including bad packets, transmitted
+        by this address since it was added to the hostTimeTable."
+    ::= { hostTimeEntry 5 }
+
+hostTimeInOctets OBJECT-TYPE
+    SYNTAX     Counter32
+    UNITS      "Octets"
+    MAX-ACCESS read-only
+    STATUS     current
+    DESCRIPTION
+        "The number of octets transmitted to this address since
+        it was added to the hostTimeTable (excluding framing
+        bits but including FCS octets), except for those
+        octets in bad packets."
+    ::= { hostTimeEntry 6 }
+
+hostTimeOutOctets OBJECT-TYPE
+    SYNTAX     Counter32
+    UNITS      "Octets"
+    MAX-ACCESS read-only
+    STATUS     current
+    DESCRIPTION
+        "The number of octets transmitted by this address since
+        it was added to the hostTimeTable (excluding framing
+        bits but including FCS octets), including those
+        octets in bad packets."
+    ::= { hostTimeEntry 7 }
+
+hostTimeOutErrors OBJECT-TYPE
+    SYNTAX     Counter32
+    UNITS      "Packets"
+    MAX-ACCESS read-only
+    STATUS     current
+    DESCRIPTION
+        "The number of bad packets transmitted by this address
+        since this host was added to the hostTimeTable."
+    ::= { hostTimeEntry 8 }
+
+hostTimeOutBroadcastPkts OBJECT-TYPE
+    SYNTAX     Counter32
+    UNITS      "Packets"
+    MAX-ACCESS read-only
+    STATUS     current
+    DESCRIPTION
+        "The number of good packets transmitted by this
+        address that were directed to the broadcast address
+
+        since this host was added to the hostTimeTable."
+    ::= { hostTimeEntry 9 }
+
+hostTimeOutMulticastPkts OBJECT-TYPE
+    SYNTAX     Counter32
+    UNITS      "Packets"
+    MAX-ACCESS read-only
+    STATUS     current
+    DESCRIPTION
+        "The number of good packets transmitted by this
+        address that were directed to a multicast address
+        since this host was added to the hostTimeTable.
+        Note that this number does not include packets directed
+        to the broadcast address."
+    ::= { hostTimeEntry 10 }
+
+-- The Host Top "N" Group
+
+-- Implementation of the Host Top N group is optional. The Host Top N
+-- group requires the implementation of the host group.
+-- Consult the MODULE-COMPLIANCE macro for the authoritative
+-- conformance information for this MIB.
+--
+-- The Host Top N group is used to prepare reports that describe
+-- the hosts that top a list ordered by one of their statistics.
+-- The available statistics are samples of one of their
+-- base statistics, over an interval specified by the management
+-- station.  Thus, these statistics are rate based.  The management
+-- station also selects how many such hosts are reported.
+
+-- The hostTopNControlTable is used to initiate the generation of
+-- such a report.  The management station may select the parameters
+-- of such a report, such as which interface, which statistic,
+-- how many hosts, and the start and stop times of the sampling.
+-- When the report is prepared, entries are created in the
+-- hostTopNTable associated with the relevant hostTopNControlEntry.
+-- These entries are static for each report after it has been
+-- prepared.
+
+hostTopNControlTable OBJECT-TYPE
+    SYNTAX     SEQUENCE OF HostTopNControlEntry
+    MAX-ACCESS not-accessible
+    STATUS     current
+    DESCRIPTION
+        "A list of top N host control entries."
+    ::= { hostTopN 1 }
+
+hostTopNControlEntry OBJECT-TYPE
+    SYNTAX     HostTopNControlEntry
+    MAX-ACCESS not-accessible
+    STATUS     current
+    DESCRIPTION
+        "A set of parameters that control the creation of a report
+        of the top N hosts according to several metrics.  For
+        example, an instance of the hostTopNDuration object might
+        be named hostTopNDuration.3"
+    INDEX { hostTopNControlIndex }
+    ::= { hostTopNControlTable 1 }
+
+HostTopNControlEntry ::= SEQUENCE {
+    hostTopNControlIndex    Integer32,
+    hostTopNHostIndex       Integer32,
+    hostTopNRateBase        INTEGER,
+    hostTopNTimeRemaining   Integer32,
+    hostTopNDuration        Integer32,
+    hostTopNRequestedSize   Integer32,
+    hostTopNGrantedSize     Integer32,
+    hostTopNStartTime       TimeTicks,
+    hostTopNOwner           OwnerString,
+    hostTopNStatus          EntryStatus
+}
+
+hostTopNControlIndex OBJECT-TYPE
+    SYNTAX     Integer32 (1..65535)
+    MAX-ACCESS read-only
+    STATUS     current
+    DESCRIPTION
+        "An index that uniquely identifies an entry
+        in the hostTopNControl table.  Each such
+        entry defines one top N report prepared for
+        one interface."
+    ::= { hostTopNControlEntry 1 }
+
+hostTopNHostIndex OBJECT-TYPE
+    SYNTAX     Integer32 (1..65535)
+    MAX-ACCESS read-create
+    STATUS     current
+    DESCRIPTION
+        "The host table for which a top N report will be prepared
+        on behalf of this entry.  The host table identified by a
+        particular value of this index is associated with the same
+        host table as identified by the same value of
+        hostIndex.
+
+        This object may not be modified if the associated
+        hostTopNStatus object is equal to valid(1)."
+    ::= { hostTopNControlEntry 2 }
+
+hostTopNRateBase OBJECT-TYPE
+    SYNTAX     INTEGER {
+                 hostTopNInPkts(1),
+                 hostTopNOutPkts(2),
+                 hostTopNInOctets(3),
+                 hostTopNOutOctets(4),
+                 hostTopNOutErrors(5),
+                 hostTopNOutBroadcastPkts(6),
+                 hostTopNOutMulticastPkts(7)
+               }
+    MAX-ACCESS read-create
+    STATUS     current
+    DESCRIPTION
+        "The variable for each host that the hostTopNRate
+        variable is based upon.
+
+        This object may not be modified if the associated
+        hostTopNStatus object is equal to valid(1)."
+    ::= { hostTopNControlEntry 3 }
+
+hostTopNTimeRemaining OBJECT-TYPE
+    SYNTAX     Integer32
+    UNITS      "Seconds"
+    MAX-ACCESS read-create
+    STATUS     current
+    DESCRIPTION
+        "The number of seconds left in the report currently being
+        collected.  When this object is modified by the management
+        station, a new collection is started, possibly aborting
+        a currently running report.  The new value is used
+        as the requested duration of this report, which is
+        loaded into the associated hostTopNDuration object.
+
+        When this object is set to a non-zero value, any
+        associated hostTopNEntries shall be made
+        inaccessible by the monitor.  While the value of this
+        object is non-zero, it decrements by one per second until
+        it reaches zero.  During this time, all associated
+        hostTopNEntries shall remain inaccessible.  At the time
+        that this object decrements to zero, the report is made
+        accessible in the hostTopNTable.  Thus, the hostTopN
+        table needs to be created only at the end of the collection
+        interval."
+    DEFVAL { 0 }
+    ::= { hostTopNControlEntry 4 }
+
+hostTopNDuration OBJECT-TYPE
+    SYNTAX     Integer32
+    UNITS      "Seconds"
+    MAX-ACCESS read-only
+    STATUS     current
+    DESCRIPTION
+        "The number of seconds that this report has collected
+        during the last sampling interval, or if this
+        report is currently being collected, the number
+        of seconds that this report is being collected
+        during this sampling interval.
+
+        When the associated hostTopNTimeRemaining object is set,
+        this object shall be set by the probe to the same value
+        and shall not be modified until the next time
+        the hostTopNTimeRemaining is set.
+
+        This value shall be zero if no reports have been
+        requested for this hostTopNControlEntry."
+    DEFVAL { 0 }
+    ::= { hostTopNControlEntry 5 }
+
+hostTopNRequestedSize OBJECT-TYPE
+    SYNTAX     Integer32
+    MAX-ACCESS read-create
+    STATUS     current
+    DESCRIPTION
+        "The maximum number of hosts requested for the top N
+        table.
+
+        When this object is created or modified, the probe
+        should set hostTopNGrantedSize as closely to this
+        object as is possible for the particular probe
+        implementation and available resources."
+    DEFVAL { 10 }
+    ::= { hostTopNControlEntry 6 }
+
+hostTopNGrantedSize OBJECT-TYPE
+    SYNTAX     Integer32
+    MAX-ACCESS read-only
+    STATUS     current
+    DESCRIPTION
+        "The maximum number of hosts in the top N table.
+
+        When the associated hostTopNRequestedSize object is
+        created or modified, the probe should set this
+        object as closely to the requested value as is possible
+        for the particular implementation and available
+
+        resources. The probe must not lower this value except
+        as a result of a set to the associated
+        hostTopNRequestedSize object.
+
+        Hosts with the highest value of hostTopNRate shall be
+        placed in this table in decreasing order of this rate
+        until there is no more room or until there are no more
+        hosts."
+    ::= { hostTopNControlEntry 7 }
+
+hostTopNStartTime OBJECT-TYPE
+    SYNTAX     TimeTicks
+    MAX-ACCESS read-only
+    STATUS     current
+    DESCRIPTION
+        "The value of sysUpTime when this top N report was
+        last started.  In other words, this is the time that
+        the associated hostTopNTimeRemaining object was
+        modified to start the requested report."
+    ::= { hostTopNControlEntry 8 }
+
+hostTopNOwner OBJECT-TYPE
+    SYNTAX     OwnerString
+    MAX-ACCESS read-create
+    STATUS     current
+    DESCRIPTION
+        "The entity that configured this entry and is therefore
+        using the resources assigned to it."
+    ::= { hostTopNControlEntry 9 }
+
+hostTopNStatus OBJECT-TYPE
+    SYNTAX     EntryStatus
+    MAX-ACCESS read-create
+    STATUS     current
+    DESCRIPTION
+        "The status of this hostTopNControl entry.
+
+        If this object is not equal to valid(1), all associated
+        hostTopNEntries shall be deleted by the agent."
+    ::= { hostTopNControlEntry 10 }
+
+hostTopNTable OBJECT-TYPE
+    SYNTAX     SEQUENCE OF HostTopNEntry
+    MAX-ACCESS not-accessible
+    STATUS     current
+    DESCRIPTION
+        "A list of top N host entries."
+    ::= { hostTopN 2 }
+
+hostTopNEntry OBJECT-TYPE
+    SYNTAX     HostTopNEntry
+    MAX-ACCESS not-accessible
+    STATUS     current
+    DESCRIPTION
+        "A set of statistics for a host that is part of a top N
+        report.  For example, an instance of the hostTopNRate
+        object might be named hostTopNRate.3.10"
+    INDEX { hostTopNReport, hostTopNIndex }
+    ::= { hostTopNTable 1 }
+
+HostTopNEntry ::= SEQUENCE {
+    hostTopNReport                Integer32,
+    hostTopNIndex                 Integer32,
+    hostTopNAddress               OCTET STRING,
+    hostTopNRate                  Integer32
+}
+
+hostTopNReport OBJECT-TYPE
+    SYNTAX     Integer32 (1..65535)
+    MAX-ACCESS read-only
+    STATUS     current
+    DESCRIPTION
+        "This object identifies the top N report of which
+        this entry is a part.  The set of hosts
+        identified by a particular value of this
+        object is part of the same report as identified
+        by the same value of the hostTopNControlIndex object."
+    ::= { hostTopNEntry 1 }
+
+hostTopNIndex OBJECT-TYPE
+    SYNTAX     Integer32 (1..65535)
+    MAX-ACCESS read-only
+    STATUS     current
+    DESCRIPTION
+        "An index that uniquely identifies an entry in
+        the hostTopN table among those in the same report.
+        This index is between 1 and N, where N is the
+        number of entries in this table.  Increasing values
+        of hostTopNIndex shall be assigned to entries with
+        decreasing values of hostTopNRate until index N
+        is assigned to the entry with the lowest value of
+        hostTopNRate or there are no more hostTopNEntries."
+    ::= { hostTopNEntry 2 }
+
+hostTopNAddress OBJECT-TYPE
+    SYNTAX     OCTET STRING
+    MAX-ACCESS read-only
+    STATUS     current
+    DESCRIPTION
+        "The physical address of this host."
+    ::= { hostTopNEntry 3 }
+
+hostTopNRate OBJECT-TYPE
+    SYNTAX     Integer32
+    MAX-ACCESS read-only
+    STATUS     current
+    DESCRIPTION
+        "The amount of change in the selected variable
+        during this sampling interval.  The selected
+        variable is this host's instance of the object
+        selected by hostTopNRateBase."
+    ::= { hostTopNEntry 4 }
+
+-- The Matrix Group
+
+-- Implementation of the Matrix group is optional.
+-- Consult the MODULE-COMPLIANCE macro for the authoritative
+-- conformance information for this MIB.
+--
+-- The Matrix group consists of the matrixControlTable, matrixSDTable
+-- and the matrixDSTable.  These tables store statistics for a
+-- particular conversation between two addresses.  As the device
+-- detects a new conversation, including those to a non-unicast
+-- address, it creates a new entry in both of the matrix tables.
+-- It must only create new entries based on information
+-- received in good packets.  If the monitoring device finds
+-- itself short of resources, it may delete entries as needed.
+-- It is suggested that the device delete the least recently used
+-- entries first.
+
+matrixControlTable OBJECT-TYPE
+    SYNTAX     SEQUENCE OF MatrixControlEntry
+    MAX-ACCESS not-accessible
+    STATUS     current
+    DESCRIPTION
+        "A list of information entries for the
+        traffic matrix on each interface."
+    ::= { matrix 1 }
+
+matrixControlEntry OBJECT-TYPE
+    SYNTAX     MatrixControlEntry
+    MAX-ACCESS not-accessible
+    STATUS     current
+    DESCRIPTION
+        "Information about a traffic matrix on a particular
+
+        interface.  For example, an instance of the
+        matrixControlLastDeleteTime object might be named
+        matrixControlLastDeleteTime.1"
+    INDEX { matrixControlIndex }
+    ::= { matrixControlTable 1 }
+
+MatrixControlEntry ::= SEQUENCE {
+    matrixControlIndex           Integer32,
+    matrixControlDataSource      OBJECT IDENTIFIER,
+    matrixControlTableSize       Integer32,
+    matrixControlLastDeleteTime  TimeTicks,
+    matrixControlOwner           OwnerString,
+    matrixControlStatus          EntryStatus
+}
+
+matrixControlIndex OBJECT-TYPE
+    SYNTAX     Integer32 (1..65535)
+    MAX-ACCESS read-only
+    STATUS     current
+    DESCRIPTION
+        "An index that uniquely identifies an entry in the
+        matrixControl table.  Each such entry defines
+        a function that discovers conversations on a particular
+        interface and places statistics about them in the
+        matrixSDTable and the matrixDSTable on behalf of this
+        matrixControlEntry."
+    ::= { matrixControlEntry 1 }
+
+matrixControlDataSource OBJECT-TYPE
+    SYNTAX     OBJECT IDENTIFIER
+    MAX-ACCESS read-create
+    STATUS     current
+    DESCRIPTION
+        "This object identifies the source of
+        the data from which this entry creates a traffic matrix.
+        This source can be any interface on this device.  In
+        order to identify a particular interface, this object
+        shall identify the instance of the ifIndex object,
+        defined in RFC 2233 [17], for the desired
+        interface.  For example, if an entry were to receive data
+        from interface #1, this object would be set to ifIndex.1.
+
+        The statistics in this group reflect all packets
+        on the local network segment attached to the identified
+        interface.
+
+        An agent may or may not be able to tell if fundamental
+        changes to the media of the interface have occurred and
+
+        necessitate an invalidation of this entry.  For example, a
+        hot-pluggable ethernet card could be pulled out and replaced
+        by a token-ring card.  In such a case, if the agent has such
+        knowledge of the change, it is recommended that it
+        invalidate this entry.
+
+        This object may not be modified if the associated
+        matrixControlStatus object is equal to valid(1)."
+    ::= { matrixControlEntry 2 }
+
+matrixControlTableSize OBJECT-TYPE
+    SYNTAX     Integer32
+    MAX-ACCESS read-only
+    STATUS     current
+    DESCRIPTION
+        "The number of matrixSDEntries in the matrixSDTable
+        for this interface.  This must also be the value of
+        the number of entries in the matrixDSTable for this
+        interface."
+    ::= { matrixControlEntry 3 }
+
+matrixControlLastDeleteTime OBJECT-TYPE
+    SYNTAX     TimeTicks
+    MAX-ACCESS read-only
+    STATUS     current
+    DESCRIPTION
+        "The value of sysUpTime when the last entry
+        was deleted from the portion of the matrixSDTable
+        or matrixDSTable associated with this matrixControlEntry.
+        If no deletions have occurred, this value shall be
+        zero."
+    ::= { matrixControlEntry 4 }
+
+matrixControlOwner OBJECT-TYPE
+    SYNTAX     OwnerString
+    MAX-ACCESS read-create
+    STATUS     current
+    DESCRIPTION
+        "The entity that configured this entry and is therefore
+        using the resources assigned to it."
+    ::= { matrixControlEntry 5 }
+
+matrixControlStatus OBJECT-TYPE
+    SYNTAX     EntryStatus
+    MAX-ACCESS read-create
+    STATUS     current
+    DESCRIPTION
+        "The status of this matrixControl entry.
+
+        If this object is not equal to valid(1), all associated
+        entries in the matrixSDTable and the matrixDSTable
+        shall be deleted by the agent."
+    ::= { matrixControlEntry 6 }
+
+matrixSDTable OBJECT-TYPE
+    SYNTAX     SEQUENCE OF MatrixSDEntry
+    MAX-ACCESS not-accessible
+    STATUS     current
+    DESCRIPTION
+        "A list of traffic matrix entries indexed by
+        source and destination MAC address."
+    ::= { matrix 2 }
+
+matrixSDEntry OBJECT-TYPE
+    SYNTAX     MatrixSDEntry
+    MAX-ACCESS not-accessible
+    STATUS     current
+    DESCRIPTION
+        "A collection of statistics for communications between
+        two addresses on a particular interface.  For example,
+        an instance of the matrixSDPkts object might be named
+        matrixSDPkts.1.6.8.0.32.27.3.176.6.8.0.32.10.8.113"
+    INDEX { matrixSDIndex,
+            matrixSDSourceAddress, matrixSDDestAddress }
+    ::= { matrixSDTable 1 }
+
+MatrixSDEntry ::= SEQUENCE {
+    matrixSDSourceAddress       OCTET STRING,
+    matrixSDDestAddress         OCTET STRING,
+    matrixSDIndex               Integer32,
+    matrixSDPkts                Counter32,
+    matrixSDOctets              Counter32,
+    matrixSDErrors              Counter32
+}
+
+matrixSDSourceAddress OBJECT-TYPE
+    SYNTAX     OCTET STRING
+    MAX-ACCESS read-only
+    STATUS     current
+    DESCRIPTION
+        "The source physical address."
+    ::= { matrixSDEntry 1 }
+
+matrixSDDestAddress OBJECT-TYPE
+    SYNTAX     OCTET STRING
+    MAX-ACCESS read-only
+    STATUS     current
+    DESCRIPTION
+        "The destination physical address."
+    ::= { matrixSDEntry 2 }
+
+matrixSDIndex OBJECT-TYPE
+    SYNTAX     Integer32 (1..65535)
+    MAX-ACCESS read-only
+    STATUS     current
+    DESCRIPTION
+        "The set of collected matrix statistics of which
+        this entry is a part.  The set of matrix statistics
+        identified by a particular value of this index
+        is associated with the same matrixControlEntry
+        as identified by the same value of matrixControlIndex."
+    ::= { matrixSDEntry 3 }
+
+matrixSDPkts OBJECT-TYPE
+    SYNTAX     Counter32
+    UNITS      "Packets"
+    MAX-ACCESS read-only
+    STATUS     current
+    DESCRIPTION
+        "The number of packets transmitted from the source
+        address to the destination address (this number includes
+        bad packets)."
+    ::= { matrixSDEntry 4 }
+
+matrixSDOctets OBJECT-TYPE
+    SYNTAX     Counter32
+    UNITS      "Octets"
+    MAX-ACCESS read-only
+    STATUS     current
+    DESCRIPTION
+        "The number of octets (excluding framing bits but
+        including FCS octets) contained in all packets
+        transmitted from the source address to the
+        destination address."
+    ::= { matrixSDEntry 5 }
+
+matrixSDErrors OBJECT-TYPE
+    SYNTAX     Counter32
+    UNITS      "Packets"
+    MAX-ACCESS read-only
+    STATUS     current
+    DESCRIPTION
+        "The number of bad packets transmitted from
+        the source address to the destination address."
+    ::= { matrixSDEntry 6 }
+
+-- Traffic matrix tables from destination to source
+
+matrixDSTable OBJECT-TYPE
+    SYNTAX     SEQUENCE OF MatrixDSEntry
+    MAX-ACCESS not-accessible
+    STATUS     current
+    DESCRIPTION
+        "A list of traffic matrix entries indexed by
+        destination and source MAC address."
+    ::= { matrix 3 }
+
+matrixDSEntry OBJECT-TYPE
+    SYNTAX     MatrixDSEntry
+    MAX-ACCESS not-accessible
+    STATUS     current
+    DESCRIPTION
+        "A collection of statistics for communications between
+        two addresses on a particular interface.  For example,
+        an instance of the matrixSDPkts object might be named
+        matrixSDPkts.1.6.8.0.32.10.8.113.6.8.0.32.27.3.176"
+    INDEX { matrixDSIndex,
+            matrixDSDestAddress, matrixDSSourceAddress }
+    ::= { matrixDSTable 1 }
+
+MatrixDSEntry ::= SEQUENCE {
+    matrixDSSourceAddress       OCTET STRING,
+    matrixDSDestAddress         OCTET STRING,
+    matrixDSIndex               Integer32,
+    matrixDSPkts                Counter32,
+    matrixDSOctets              Counter32,
+    matrixDSErrors              Counter32
+}
+
+matrixDSSourceAddress OBJECT-TYPE
+    SYNTAX     OCTET STRING
+    MAX-ACCESS read-only
+    STATUS     current
+    DESCRIPTION
+        "The source physical address."
+    ::= { matrixDSEntry 1 }
+
+matrixDSDestAddress OBJECT-TYPE
+    SYNTAX     OCTET STRING
+    MAX-ACCESS read-only
+    STATUS     current
+    DESCRIPTION
+        "The destination physical address."
+    ::= { matrixDSEntry 2 }
+
+matrixDSIndex OBJECT-TYPE
+    SYNTAX     Integer32 (1..65535)
+    MAX-ACCESS read-only
+    STATUS     current
+    DESCRIPTION
+        "The set of collected matrix statistics of which
+        this entry is a part.  The set of matrix statistics
+        identified by a particular value of this index
+        is associated with the same matrixControlEntry
+        as identified by the same value of matrixControlIndex."
+    ::= { matrixDSEntry 3 }
+
+matrixDSPkts OBJECT-TYPE
+    SYNTAX     Counter32
+    UNITS      "Packets"
+    MAX-ACCESS read-only
+    STATUS     current
+    DESCRIPTION
+        "The number of packets transmitted from the source
+        address to the destination address (this number includes
+        bad packets)."
+    ::= { matrixDSEntry 4 }
+
+matrixDSOctets OBJECT-TYPE
+    SYNTAX     Counter32
+    UNITS      "Octets"
+    MAX-ACCESS read-only
+    STATUS     current
+    DESCRIPTION
+        "The number of octets (excluding framing bits
+        but including FCS octets) contained in all packets
+        transmitted from the source address to the
+        destination address."
+    ::= { matrixDSEntry 5 }
+
+matrixDSErrors OBJECT-TYPE
+    SYNTAX     Counter32
+    UNITS      "Packets"
+    MAX-ACCESS read-only
+    STATUS     current
+    DESCRIPTION
+        "The number of bad packets transmitted from
+        the source address to the destination address."
+    ::= { matrixDSEntry 6 }
+
+-- The Filter Group
+
+-- Implementation of the Filter group is optional.
+
+-- Consult the MODULE-COMPLIANCE macro for the authoritative
+-- conformance information for this MIB.
+--
+-- The Filter group allows packets to be captured with an
+-- arbitrary filter expression.  A logical data and
+-- event stream or "channel" is formed by the packets
+-- that match the filter expression.
+--
+-- This filter mechanism allows the creation of an arbitrary
+-- logical expression with which to filter packets.  Each
+-- filter associated with a channel is OR'ed with the others.
+-- Within a filter, any bits checked in the data and status are
+-- AND'ed with respect to other bits in the same filter.  The
+-- NotMask also allows for checking for inequality.  Finally,
+-- the channelAcceptType object allows for inversion of the
+-- whole equation.
+--
+-- If a management station wishes to receive a trap to alert it
+-- that new packets have been captured and are available for
+-- download, it is recommended that it set up an alarm entry that
+-- monitors the value of the relevant channelMatches instance.
+--
+-- The channel can be turned on or off, and can also
+-- generate events when packets pass through it.
+
+filterTable OBJECT-TYPE
+    SYNTAX     SEQUENCE OF FilterEntry
+    MAX-ACCESS not-accessible
+    STATUS     current
+    DESCRIPTION
+        "A list of packet filter entries."
+    ::= { filter 1 }
+
+filterEntry OBJECT-TYPE
+    SYNTAX     FilterEntry
+    MAX-ACCESS not-accessible
+    STATUS     current
+    DESCRIPTION
+        "A set of parameters for a packet filter applied on a
+        particular interface.  As an example, an instance of the
+        filterPktData object might be named filterPktData.12"
+    INDEX { filterIndex }
+    ::= { filterTable 1 }
+
+FilterEntry ::= SEQUENCE {
+    filterIndex                 Integer32,
+    filterChannelIndex          Integer32,
+    filterPktDataOffset         Integer32,
+    filterPktData               OCTET STRING,
+    filterPktDataMask           OCTET STRING,
+    filterPktDataNotMask        OCTET STRING,
+    filterPktStatus             Integer32,
+    filterPktStatusMask         Integer32,
+    filterPktStatusNotMask      Integer32,
+    filterOwner                 OwnerString,
+    filterStatus                EntryStatus
+}
+
+filterIndex OBJECT-TYPE
+    SYNTAX     Integer32 (1..65535)
+    MAX-ACCESS read-only
+    STATUS     current
+    DESCRIPTION
+        "An index that uniquely identifies an entry
+        in the filter table.  Each such entry defines
+        one filter that is to be applied to every packet
+        received on an interface."
+    ::= { filterEntry 1 }
+
+filterChannelIndex OBJECT-TYPE
+    SYNTAX     Integer32 (1..65535)
+    MAX-ACCESS read-create
+    STATUS     current
+    DESCRIPTION
+        "This object identifies the channel of which this filter
+        is a part.  The filters identified by a particular value
+        of this object are associated with the same channel as
+        identified by the same value of the channelIndex object."
+    ::= { filterEntry 2 }
+
+filterPktDataOffset OBJECT-TYPE
+    SYNTAX     Integer32
+    UNITS      "Octets"
+    MAX-ACCESS read-create
+    STATUS     current
+    DESCRIPTION
+        "The offset from the beginning of each packet where
+        a match of packet data will be attempted.  This offset
+        is measured from the point in the physical layer
+        packet after the framing bits, if any.  For example,
+        in an Ethernet frame, this point is at the beginning of
+        the destination MAC address.
+
+        This object may not be modified if the associated
+        filterStatus object is equal to valid(1)."
+    DEFVAL { 0 }
+    ::= { filterEntry 3 }
+
+filterPktData OBJECT-TYPE
+    SYNTAX     OCTET STRING
+    MAX-ACCESS read-create
+    STATUS     current
+    DESCRIPTION
+        "The data that is to be matched with the input packet.
+        For each packet received, this filter and the accompanying
+        filterPktDataMask and filterPktDataNotMask will be
+        adjusted for the offset.  The only bits relevant to this
+        match algorithm are those that have the corresponding
+        filterPktDataMask bit equal to one.  The following three
+        rules are then applied to every packet:
+
+        (1) If the packet is too short and does not have data
+            corresponding to part of the filterPktData, the packet
+            will fail this data match.
+
+        (2) For each relevant bit from the packet with the
+            corresponding filterPktDataNotMask bit set to zero, if
+            the bit from the packet is not equal to the corresponding
+            bit from the filterPktData, then the packet will fail
+            this data match.
+
+        (3) If for every relevant bit from the packet with the
+            corresponding filterPktDataNotMask bit set to one, the
+            bit from the packet is equal to the corresponding bit
+            from the filterPktData, then the packet will fail this
+            data match.
+
+        Any packets that have not failed any of the three matches
+        above have passed this data match.  In particular, a zero
+        length filter will match any packet.
+
+        This object may not be modified if the associated
+        filterStatus object is equal to valid(1)."
+    ::= { filterEntry 4 }
+
+filterPktDataMask OBJECT-TYPE
+    SYNTAX     OCTET STRING
+    MAX-ACCESS read-create
+    STATUS     current
+    DESCRIPTION
+        "The mask that is applied to the match process.
+        After adjusting this mask for the offset, only those
+        bits in the received packet that correspond to bits set
+        in this mask are relevant for further processing by the
+
+        match algorithm.  The offset is applied to filterPktDataMask
+        in the same way it is applied to the filter.  For the
+        purposes of the matching algorithm, if the associated
+        filterPktData object is longer than this mask, this mask is
+        conceptually extended with '1' bits until it reaches the
+        length of the filterPktData object.
+
+        This object may not be modified if the associated
+        filterStatus object is equal to valid(1)."
+    ::= { filterEntry 5 }
+
+filterPktDataNotMask OBJECT-TYPE
+    SYNTAX     OCTET STRING
+    MAX-ACCESS read-create
+    STATUS     current
+    DESCRIPTION
+        "The inversion mask that is applied to the match
+        process.  After adjusting this mask for the offset,
+        those relevant bits in the received packet that correspond
+        to bits cleared in this mask must all be equal to their
+        corresponding bits in the filterPktData object for the packet
+        to be accepted.  In addition, at least one of those relevant
+        bits in the received packet that correspond to bits set in
+        this mask must be different to its corresponding bit in the
+        filterPktData object.
+
+        For the purposes of the matching algorithm, if the associated
+        filterPktData object is longer than this mask, this mask is
+        conceptually extended with '0' bits until it reaches the
+        length of the filterPktData object.
+
+        This object may not be modified if the associated
+        filterStatus object is equal to valid(1)."
+    ::= { filterEntry 6 }
+
+filterPktStatus OBJECT-TYPE
+    SYNTAX     Integer32
+    MAX-ACCESS read-create
+    STATUS     current
+    DESCRIPTION
+        "The status that is to be matched with the input packet.
+        The only bits relevant to this match algorithm are those that
+        have the corresponding filterPktStatusMask bit equal to one.
+        The following two rules are then applied to every packet:
+
+        (1) For each relevant bit from the packet status with the
+            corresponding filterPktStatusNotMask bit set to zero, if
+            the bit from the packet status is not equal to the
+
+            corresponding bit from the filterPktStatus, then the
+            packet will fail this status match.
+
+        (2) If for every relevant bit from the packet status with the
+            corresponding filterPktStatusNotMask bit set to one, the
+            bit from the packet status is equal to the corresponding
+            bit from the filterPktStatus, then the packet will fail
+            this status match.
+
+        Any packets that have not failed either of the two matches
+        above have passed this status match.  In particular, a zero
+        length status filter will match any packet's status.
+
+        The value of the packet status is a sum.  This sum
+        initially takes the value zero.  Then, for each
+        error, E, that has been discovered in this packet,
+        2 raised to a value representing E is added to the sum.
+        The errors and the bits that represent them are dependent
+        on the media type of the interface that this channel
+        is receiving packets from.
+
+        The errors defined for a packet captured off of an
+        Ethernet interface are as follows:
+
+            bit #    Error
+                0    Packet is longer than 1518 octets
+                1    Packet is shorter than 64 octets
+                2    Packet experienced a CRC or Alignment error
+
+        For example, an Ethernet fragment would have a
+        value of 6 (2^1 + 2^2).
+
+        As this MIB is expanded to new media types, this object
+        will have other media-specific errors defined.
+
+        For the purposes of this status matching algorithm, if the
+        packet status is longer than this filterPktStatus object,
+        this object is conceptually extended with '0' bits until it
+        reaches the size of the packet status.
+
+        This object may not be modified if the associated
+        filterStatus object is equal to valid(1)."
+    ::= { filterEntry 7 }
+
+filterPktStatusMask OBJECT-TYPE
+    SYNTAX     Integer32
+    MAX-ACCESS read-create
+    STATUS     current
+    DESCRIPTION
+        "The mask that is applied to the status match process.
+        Only those bits in the received packet that correspond to
+        bits set in this mask are relevant for further processing
+        by the status match algorithm.  For the purposes
+        of the matching algorithm, if the associated filterPktStatus
+        object is longer than this mask, this mask is conceptually
+        extended with '1' bits until it reaches the size of the
+        filterPktStatus.  In addition, if a packet status is longer
+        than this mask, this mask is conceptually extended with '0'
+        bits until it reaches the size of the packet status.
+
+        This object may not be modified if the associated
+        filterStatus object is equal to valid(1)."
+    ::= { filterEntry 8 }
+
+filterPktStatusNotMask OBJECT-TYPE
+    SYNTAX     Integer32
+    MAX-ACCESS read-create
+    STATUS     current
+    DESCRIPTION
+        "The inversion mask that is applied to the status match
+        process.  Those relevant bits in the received packet status
+        that correspond to bits cleared in this mask must all be
+        equal to their corresponding bits in the filterPktStatus
+        object for the packet to be accepted.  In addition, at least
+        one of those relevant bits in the received packet status
+        that correspond to bits set in this mask must be different
+        to its corresponding bit in the filterPktStatus object for
+        the packet to be accepted.
+
+        For the purposes of the matching algorithm, if the associated
+        filterPktStatus object or a packet status is longer than this
+        mask, this mask is conceptually extended with '0' bits until
+        it reaches the longer of the lengths of the filterPktStatus
+        object and the packet status.
+
+        This object may not be modified if the associated
+        filterStatus object is equal to valid(1)."
+    ::= { filterEntry 9 }
+
+filterOwner OBJECT-TYPE
+    SYNTAX     OwnerString
+    MAX-ACCESS read-create
+    STATUS     current
+    DESCRIPTION
+        "The entity that configured this entry and is therefore
+        using the resources assigned to it."
+    ::= { filterEntry 10 }
+
+filterStatus OBJECT-TYPE
+    SYNTAX     EntryStatus
+    MAX-ACCESS read-create
+    STATUS     current
+    DESCRIPTION
+        "The status of this filter entry."
+    ::= { filterEntry 11 }
+
+channelTable OBJECT-TYPE
+    SYNTAX     SEQUENCE OF ChannelEntry
+    MAX-ACCESS not-accessible
+    STATUS     current
+    DESCRIPTION
+        "A list of packet channel entries."
+    ::= { filter 2 }
+
+channelEntry OBJECT-TYPE
+    SYNTAX     ChannelEntry
+    MAX-ACCESS not-accessible
+    STATUS     current
+    DESCRIPTION
+        "A set of parameters for a packet channel applied on a
+        particular interface.  As an example, an instance of the
+        channelMatches object might be named channelMatches.3"
+    INDEX { channelIndex }
+    ::= { channelTable 1 }
+
+ChannelEntry ::= SEQUENCE {
+    channelIndex                 Integer32,
+    channelIfIndex               Integer32,
+    channelAcceptType            INTEGER,
+    channelDataControl           INTEGER,
+    channelTurnOnEventIndex      Integer32,
+    channelTurnOffEventIndex     Integer32,
+    channelEventIndex            Integer32,
+    channelEventStatus           INTEGER,
+    channelMatches               Counter32,
+    channelDescription           DisplayString,
+    channelOwner                 OwnerString,
+    channelStatus                EntryStatus
+}
+
+channelIndex OBJECT-TYPE
+    SYNTAX     Integer32 (1..65535)
+    MAX-ACCESS read-only
+    STATUS     current
+    DESCRIPTION
+        "An index that uniquely identifies an entry in the channel
+        table.  Each such entry defines one channel, a logical
+        data and event stream.
+
+        It is suggested that before creating a channel, an
+        application should scan all instances of the
+        filterChannelIndex object to make sure that there are no
+        pre-existing filters that would be inadvertently be linked
+        to the channel."
+    ::= { channelEntry 1 }
+
+channelIfIndex OBJECT-TYPE
+    SYNTAX     Integer32 (1..65535)
+    MAX-ACCESS read-create
+    STATUS     current
+    DESCRIPTION
+        "The value of this object uniquely identifies the
+        interface on this remote network monitoring device to which
+        the associated filters are applied to allow data into this
+        channel.  The interface identified by a particular value
+        of this object is the same interface as identified by the
+        same value of the ifIndex object, defined in RFC 2233 [17].
+
+        The filters in this group are applied to all packets on
+        the local network segment attached to the identified
+        interface.
+
+        An agent may or may not be able to tell if fundamental
+        changes to the media of the interface have occurred and
+        necessitate an invalidation of this entry.  For example, a
+        hot-pluggable ethernet card could be pulled out and replaced
+        by a token-ring card.  In such a case, if the agent has such
+        knowledge of the change, it is recommended that it
+        invalidate this entry.
+
+        This object may not be modified if the associated
+        channelStatus object is equal to valid(1)."
+    ::= { channelEntry 2 }
+
+channelAcceptType OBJECT-TYPE
+    SYNTAX     INTEGER {
+                 acceptMatched(1),
+                 acceptFailed(2)
+               }
+    MAX-ACCESS read-create
+    STATUS     current
+    DESCRIPTION
+        "This object controls the action of the filters
+        associated with this channel.  If this object is equal
+        to acceptMatched(1), packets will be accepted to this
+        channel if they are accepted by both the packet data and
+        packet status matches of an associated filter.  If
+        this object is equal to acceptFailed(2), packets will
+        be accepted to this channel only if they fail either
+        the packet data match or the packet status match of
+        each of the associated filters.
+
+        In particular, a channel with no associated filters will
+        match no packets if set to acceptMatched(1) case and will
+        match all packets in the acceptFailed(2) case.
+
+        This object may not be modified if the associated
+        channelStatus object is equal to valid(1)."
+    ::= { channelEntry 3 }
+
+channelDataControl OBJECT-TYPE
+    SYNTAX     INTEGER {
+                 on(1),
+                 off(2)
+               }
+    MAX-ACCESS read-create
+    STATUS     current
+    DESCRIPTION
+        "This object controls the flow of data through this channel.
+        If this object is on(1), data, status and events flow
+        through this channel.  If this object is off(2), data,
+        status and events will not flow through this channel."
+    DEFVAL { off }
+    ::= { channelEntry 4 }
+
+channelTurnOnEventIndex OBJECT-TYPE
+    SYNTAX     Integer32 (0..65535)
+    MAX-ACCESS read-create
+    STATUS     current
+    DESCRIPTION
+        "The value of this object identifies the event
+        that is configured to turn the associated
+        channelDataControl from off to on when the event is
+        generated.  The event identified by a particular value
+        of this object is the same event as identified by the
+        same value of the eventIndex object.  If there is no
+        corresponding entry in the eventTable, then no
+        association exists.  In fact, if no event is intended
+        for this channel, channelTurnOnEventIndex must be
+        set to zero, a non-existent event index.
+
+        This object may not be modified if the associated
+        channelStatus object is equal to valid(1)."
+    ::= { channelEntry 5 }
+
+channelTurnOffEventIndex OBJECT-TYPE
+    SYNTAX     Integer32 (0..65535)
+    MAX-ACCESS read-create
+    STATUS     current
+    DESCRIPTION
+        "The value of this object identifies the event
+        that is configured to turn the associated
+        channelDataControl from on to off when the event is
+        generated.  The event identified by a particular value
+        of this object is the same event as identified by the
+        same value of the eventIndex object.  If there is no
+        corresponding entry in the eventTable, then no
+        association exists.  In fact, if no event is intended
+        for this channel, channelTurnOffEventIndex must be
+        set to zero, a non-existent event index.
+
+        This object may not be modified if the associated
+        channelStatus object is equal to valid(1)."
+    ::= { channelEntry 6 }
+
+channelEventIndex OBJECT-TYPE
+    SYNTAX     Integer32 (0..65535)
+    MAX-ACCESS read-create
+    STATUS     current
+    DESCRIPTION
+        "The value of this object identifies the event
+        that is configured to be generated when the
+        associated channelDataControl is on and a packet
+        is matched.  The event identified by a particular value
+        of this object is the same event as identified by the
+        same value of the eventIndex object.  If there is no
+        corresponding entry in the eventTable, then no
+        association exists.  In fact, if no event is intended
+        for this channel, channelEventIndex must be
+        set to zero, a non-existent event index.
+
+        This object may not be modified if the associated
+        channelStatus object is equal to valid(1)."
+    ::= { channelEntry 7 }
+
+channelEventStatus OBJECT-TYPE
+    SYNTAX     INTEGER {
+                 eventReady(1),
+                 eventFired(2),
+                 eventAlwaysReady(3)
+               }
+    MAX-ACCESS read-create
+    STATUS     current
+    DESCRIPTION
+        "The event status of this channel.
+
+        If this channel is configured to generate events
+        when packets are matched, a means of controlling
+        the flow of those events is often needed.  When
+        this object is equal to eventReady(1), a single
+        event may be generated, after which this object
+        will be set by the probe to eventFired(2).  While
+        in the eventFired(2) state, no events will be
+        generated until the object is modified to
+        eventReady(1) (or eventAlwaysReady(3)).  The
+        management station can thus easily respond to a
+        notification of an event by re-enabling this object.
+
+        If the management station wishes to disable this
+        flow control and allow events to be generated
+        at will, this object may be set to
+        eventAlwaysReady(3).  Disabling the flow control
+        is discouraged as it can result in high network
+        traffic or other performance problems."
+    DEFVAL { eventReady }
+    ::= { channelEntry 8 }
+
+channelMatches OBJECT-TYPE
+    SYNTAX     Counter32
+    UNITS      "Packets"
+    MAX-ACCESS read-only
+    STATUS     current
+    DESCRIPTION
+        "The number of times this channel has matched a packet.
+        Note that this object is updated even when
+        channelDataControl is set to off."
+    ::= { channelEntry 9 }
+
+channelDescription OBJECT-TYPE
+    SYNTAX     DisplayString (SIZE (0..127))
+    MAX-ACCESS read-create
+    STATUS     current
+    DESCRIPTION
+        "A comment describing this channel."
+    ::= { channelEntry 10 }
+
+channelOwner OBJECT-TYPE
+    SYNTAX     OwnerString
+    MAX-ACCESS read-create
+    STATUS     current
+    DESCRIPTION
+        "The entity that configured this entry and is therefore
+        using the resources assigned to it."
+    ::= { channelEntry 11 }
+
+channelStatus OBJECT-TYPE
+    SYNTAX     EntryStatus
+    MAX-ACCESS read-create
+    STATUS     current
+    DESCRIPTION
+        "The status of this channel entry."
+    ::= { channelEntry 12 }
+
+-- The Packet Capture Group
+
+-- Implementation of the Packet Capture group is optional. The Packet
+-- Capture Group requires implementation of the Filter Group.
+-- Consult the MODULE-COMPLIANCE macro for the authoritative
+-- conformance information for this MIB.
+--
+-- The Packet Capture group allows packets to be captured
+-- upon a filter match.  The bufferControlTable controls
+-- the captured packets output from a channel that is
+-- associated with it.  The captured packets are placed
+-- in entries in the captureBufferTable.  These entries are
+-- associated with the bufferControlEntry on whose behalf they
+-- were stored.
+
+bufferControlTable OBJECT-TYPE
+    SYNTAX     SEQUENCE OF BufferControlEntry
+    MAX-ACCESS not-accessible
+    STATUS     current
+    DESCRIPTION
+        "A list of buffers control entries."
+    ::= { capture 1 }
+
+bufferControlEntry OBJECT-TYPE
+    SYNTAX     BufferControlEntry
+    MAX-ACCESS not-accessible
+    STATUS     current
+    DESCRIPTION
+        "A set of parameters that control the collection of a stream
+        of packets that have matched filters.  As an example, an
+        instance of the bufferControlCaptureSliceSize object might
+        be named bufferControlCaptureSliceSize.3"
+    INDEX { bufferControlIndex }
+    ::= { bufferControlTable 1 }
+
+BufferControlEntry ::= SEQUENCE {
+    bufferControlIndex                Integer32,
+    bufferControlChannelIndex         Integer32,
+    bufferControlFullStatus           INTEGER,
+    bufferControlFullAction           INTEGER,
+    bufferControlCaptureSliceSize     Integer32,
+    bufferControlDownloadSliceSize    Integer32,
+    bufferControlDownloadOffset       Integer32,
+    bufferControlMaxOctetsRequested   Integer32,
+    bufferControlMaxOctetsGranted     Integer32,
+    bufferControlCapturedPackets      Integer32,
+    bufferControlTurnOnTime           TimeTicks,
+    bufferControlOwner                OwnerString,
+    bufferControlStatus               EntryStatus
+}
+
+bufferControlIndex OBJECT-TYPE
+    SYNTAX     Integer32 (1..65535)
+    MAX-ACCESS read-only
+    STATUS     current
+    DESCRIPTION
+        "An index that uniquely identifies an entry
+        in the bufferControl table.  The value of this
+        index shall never be zero.  Each such
+        entry defines one set of packets that is
+        captured and controlled by one or more filters."
+    ::= { bufferControlEntry 1 }
+
+bufferControlChannelIndex OBJECT-TYPE
+    SYNTAX     Integer32 (1..65535)
+    MAX-ACCESS read-create
+    STATUS     current
+    DESCRIPTION
+        "An index that identifies the channel that is the
+        source of packets for this bufferControl table.
+        The channel identified by a particular value of this
+        index is the same as identified by the same value of
+        the channelIndex object.
+
+        This object may not be modified if the associated
+        bufferControlStatus object is equal to valid(1)."
+    ::= { bufferControlEntry 2 }
+
+bufferControlFullStatus OBJECT-TYPE
+    SYNTAX     INTEGER {
+
+                 spaceAvailable(1),
+                 full(2)
+               }
+    MAX-ACCESS read-only
+    STATUS     current
+    DESCRIPTION
+        "This object shows whether the buffer has room to
+        accept new packets or if it is full.
+
+        If the status is spaceAvailable(1), the buffer is
+        accepting new packets normally.  If the status is
+        full(2) and the associated bufferControlFullAction
+        object is wrapWhenFull, the buffer is accepting new
+        packets by deleting enough of the oldest packets
+        to make room for new ones as they arrive.  Otherwise,
+        if the status is full(2) and the
+        bufferControlFullAction object is lockWhenFull,
+        then the buffer has stopped collecting packets.
+
+        When this object is set to full(2) the probe must
+        not later set it to spaceAvailable(1) except in the
+        case of a significant gain in resources such as
+        an increase of bufferControlOctetsGranted.  In
+        particular, the wrap-mode action of deleting old
+        packets to make room for newly arrived packets
+        must not affect the value of this object."
+    ::= { bufferControlEntry 3 }
+
+bufferControlFullAction OBJECT-TYPE
+    SYNTAX     INTEGER {
+                 lockWhenFull(1),
+                 wrapWhenFull(2)    -- FIFO
+               }
+    MAX-ACCESS read-create
+    STATUS     current
+    DESCRIPTION
+        "Controls the action of the buffer when it
+        reaches the full status.  When in the lockWhenFull(1)
+        state and a packet is added to the buffer that
+        fills the buffer, the bufferControlFullStatus will
+        be set to full(2) and this buffer will stop capturing
+        packets."
+    ::= { bufferControlEntry 4 }
+
+bufferControlCaptureSliceSize OBJECT-TYPE
+    SYNTAX     Integer32
+    UNITS      "Octets"
+    MAX-ACCESS read-create
+    STATUS     current
+    DESCRIPTION
+        "The maximum number of octets of each packet
+        that will be saved in this capture buffer.
+        For example, if a 1500 octet packet is received by
+        the probe and this object is set to 500, then only
+        500 octets of the packet will be stored in the
+        associated capture buffer.  If this variable is set
+        to 0, the capture buffer will save as many octets
+        as is possible.
+
+        This object may not be modified if the associated
+        bufferControlStatus object is equal to valid(1)."
+    DEFVAL { 100 }
+    ::= { bufferControlEntry 5 }
+
+bufferControlDownloadSliceSize OBJECT-TYPE
+    SYNTAX     Integer32
+    UNITS      "Octets"
+    MAX-ACCESS read-create
+    STATUS     current
+    DESCRIPTION
+        "The maximum number of octets of each packet
+        in this capture buffer that will be returned in
+        an SNMP retrieval of that packet.  For example,
+        if 500 octets of a packet have been stored in the
+        associated capture buffer, the associated
+        bufferControlDownloadOffset is 0, and this
+        object is set to 100, then the captureBufferPacket
+        object that contains the packet will contain only
+        the first 100 octets of the packet.
+
+        A prudent manager will take into account possible
+        interoperability or fragmentation problems that may
+        occur if the download slice size is set too large.
+        In particular, conformant SNMP implementations are not
+        required to accept messages whose length exceeds 484
+        octets, although they are encouraged to support larger
+        datagrams whenever feasible."
+    DEFVAL { 100 }
+    ::= { bufferControlEntry 6 }
+
+bufferControlDownloadOffset OBJECT-TYPE
+    SYNTAX     Integer32
+    UNITS      "Octets"
+    MAX-ACCESS read-create
+    STATUS     current
+    DESCRIPTION
+        "The offset of the first octet of each packet
+        in this capture buffer that will be returned in
+        an SNMP retrieval of that packet.  For example,
+        if 500 octets of a packet have been stored in the
+        associated capture buffer and this object is set to
+        100, then the captureBufferPacket object that
+        contains the packet will contain bytes starting
+        100 octets into the packet."
+    DEFVAL { 0 }
+    ::= { bufferControlEntry 7 }
+
+bufferControlMaxOctetsRequested OBJECT-TYPE
+    SYNTAX     Integer32
+    UNITS      "Octets"
+    MAX-ACCESS read-create
+    STATUS     current
+    DESCRIPTION
+        "The requested maximum number of octets to be
+        saved in this captureBuffer, including any
+        implementation-specific overhead. If this variable
+        is set to -1, the capture buffer will save as many
+        octets as is possible.
+
+        When this object is created or modified, the probe
+        should set bufferControlMaxOctetsGranted as closely
+        to this object as is possible for the particular probe
+        implementation and available resources.  However, if
+        the object has the special value of -1, the probe
+        must set bufferControlMaxOctetsGranted to -1."
+    DEFVAL { -1 }
+    ::= { bufferControlEntry 8 }
+
+bufferControlMaxOctetsGranted OBJECT-TYPE
+    SYNTAX     Integer32
+    UNITS      "Octets"
+    MAX-ACCESS read-only
+    STATUS     current
+    DESCRIPTION
+        "The maximum number of octets that can be
+        saved in this captureBuffer, including overhead.
+        If this variable is -1, the capture buffer will save
+        as many octets as possible.
+
+        When the bufferControlMaxOctetsRequested object is
+        created or modified, the probe should set this object
+        as closely to the requested value as is possible for the
+        particular probe implementation and available resources.
+        However, if the request object has the special value
+
+        of -1, the probe must set this object to -1.
+
+        The probe must not lower this value except as a result of
+        a modification to the associated
+        bufferControlMaxOctetsRequested object.
+
+        When this maximum number of octets is reached
+        and a new packet is to be added to this
+        capture buffer and the corresponding
+        bufferControlFullAction is set to wrapWhenFull(2),
+        enough of the oldest packets associated with this
+        capture buffer shall be deleted by the agent so
+        that the new packet can be added.  If the corresponding
+        bufferControlFullAction is set to lockWhenFull(1),
+        the new packet shall be discarded.  In either case,
+        the probe must set bufferControlFullStatus to
+        full(2).
+
+        When the value of this object changes to a value less
+        than the current value, entries are deleted from
+        the captureBufferTable associated with this
+        bufferControlEntry.  Enough of the
+        oldest of these captureBufferEntries shall be
+        deleted by the agent so that the number of octets
+        used remains less than or equal to the new value of
+        this object.
+
+        When the value of this object changes to a value greater
+        than the current value, the number of associated
+        captureBufferEntries may be allowed to grow."
+    ::= { bufferControlEntry 9 }
+
+bufferControlCapturedPackets OBJECT-TYPE
+    SYNTAX     Integer32
+    UNITS      "Packets"
+    MAX-ACCESS read-only
+    STATUS     current
+    DESCRIPTION
+        "The number of packets currently in this captureBuffer."
+    ::= { bufferControlEntry 10 }
+
+bufferControlTurnOnTime OBJECT-TYPE
+    SYNTAX     TimeTicks
+    MAX-ACCESS read-only
+    STATUS     current
+    DESCRIPTION
+        "The value of sysUpTime when this capture buffer was
+        first turned on."
+    ::= { bufferControlEntry 11 }
+
+bufferControlOwner OBJECT-TYPE
+    SYNTAX     OwnerString
+    MAX-ACCESS read-create
+    STATUS     current
+    DESCRIPTION
+        "The entity that configured this entry and is therefore
+        using the resources assigned to it."
+    ::= { bufferControlEntry 12 }
+
+bufferControlStatus OBJECT-TYPE
+    SYNTAX     EntryStatus
+    MAX-ACCESS read-create
+    STATUS     current
+    DESCRIPTION
+        "The status of this buffer Control Entry."
+    ::= { bufferControlEntry 13 }
+
+captureBufferTable OBJECT-TYPE
+    SYNTAX     SEQUENCE OF CaptureBufferEntry
+    MAX-ACCESS not-accessible
+    STATUS     current
+    DESCRIPTION
+        "A list of packets captured off of a channel."
+    ::= { capture 2 }
+
+captureBufferEntry OBJECT-TYPE
+    SYNTAX     CaptureBufferEntry
+    MAX-ACCESS not-accessible
+    STATUS     current
+    DESCRIPTION
+        "A packet captured off of an attached network.  As an
+        example, an instance of the captureBufferPacketData
+        object might be named captureBufferPacketData.3.1783"
+    INDEX { captureBufferControlIndex, captureBufferIndex }
+    ::= { captureBufferTable 1 }
+
+CaptureBufferEntry ::= SEQUENCE {
+    captureBufferControlIndex   Integer32,
+    captureBufferIndex          Integer32,
+    captureBufferPacketID       Integer32,
+    captureBufferPacketData     OCTET STRING,
+    captureBufferPacketLength   Integer32,
+    captureBufferPacketTime     Integer32,
+    captureBufferPacketStatus   Integer32
+}
+
+captureBufferControlIndex OBJECT-TYPE
+    SYNTAX     Integer32 (1..65535)
+    MAX-ACCESS read-only
+    STATUS     current
+    DESCRIPTION
+        "The index of the bufferControlEntry with which
+        this packet is associated."
+    ::= { captureBufferEntry 1 }
+
+captureBufferIndex OBJECT-TYPE
+    SYNTAX     Integer32 (1..2147483647)
+    MAX-ACCESS read-only
+    STATUS     current
+    DESCRIPTION
+        "An index that uniquely identifies an entry
+        in the captureBuffer table associated with a
+        particular bufferControlEntry.  This index will
+        start at 1 and increase by one for each new packet
+        added with the same captureBufferControlIndex.
+
+        Should this value reach 2147483647, the next packet
+        added with the same captureBufferControlIndex shall
+        cause this value to wrap around to 1."
+    ::= { captureBufferEntry 2 }
+
+captureBufferPacketID OBJECT-TYPE
+    SYNTAX     Integer32
+    MAX-ACCESS read-only
+    STATUS     current
+    DESCRIPTION
+        "An index that describes the order of packets
+        that are received on a particular interface.
+        The packetID of a packet captured on an
+        interface is defined to be greater than the
+        packetID's of all packets captured previously on
+        the same interface.  As the captureBufferPacketID
+        object has a maximum positive value of 2^31 - 1,
+        any captureBufferPacketID object shall have the
+        value of the associated packet's packetID mod 2^31."
+    ::= { captureBufferEntry 3 }
+
+captureBufferPacketData OBJECT-TYPE
+    SYNTAX     OCTET STRING
+    MAX-ACCESS read-only
+    STATUS     current
+    DESCRIPTION
+        "The data inside the packet, starting at the beginning
+        of the packet plus any offset specified in the
+
+        associated bufferControlDownloadOffset, including any
+        link level headers.  The length of the data in this object
+        is the minimum of the length of the captured packet minus
+        the offset, the length of the associated
+        bufferControlCaptureSliceSize minus the offset, and the
+        associated bufferControlDownloadSliceSize.  If this minimum
+        is less than zero, this object shall have a length of zero."
+    ::= { captureBufferEntry 4 }
+
+captureBufferPacketLength OBJECT-TYPE
+    SYNTAX     Integer32
+    UNITS      "Octets"
+    MAX-ACCESS read-only
+    STATUS     current
+    DESCRIPTION
+        "The actual length (off the wire) of the packet stored
+        in this entry, including FCS octets."
+    ::= { captureBufferEntry 5 }
+
+captureBufferPacketTime OBJECT-TYPE
+    SYNTAX     Integer32
+    UNITS      "Milliseconds"
+    MAX-ACCESS read-only
+    STATUS     current
+    DESCRIPTION
+        "The number of milliseconds that had passed since
+        this capture buffer was first turned on when this
+        packet was captured."
+    ::= { captureBufferEntry 6 }
+
+captureBufferPacketStatus OBJECT-TYPE
+    SYNTAX     Integer32
+    MAX-ACCESS read-only
+    STATUS     current
+    DESCRIPTION
+        "A value which indicates the error status of this packet.
+
+        The value of this object is defined in the same way as
+        filterPktStatus.  The value is a sum.  This sum
+        initially takes the value zero.  Then, for each
+        error, E, that has been discovered in this packet,
+        2 raised to a value representing E is added to the sum.
+
+        The errors defined for a packet captured off of an
+        Ethernet interface are as follows:
+
+            bit #    Error
+                0    Packet is longer than 1518 octets
+
+                1    Packet is shorter than 64 octets
+                2    Packet experienced a CRC or Alignment error
+                3    First packet in this capture buffer after
+                     it was detected that some packets were
+                     not processed correctly.
+                4    Packet's order in buffer is only approximate
+                     (May only be set for packets sent from
+                     the probe)
+
+        For example, an Ethernet fragment would have a
+        value of 6 (2^1 + 2^2).
+
+        As this MIB is expanded to new media types, this object
+        will have other media-specific errors defined."
+    ::= { captureBufferEntry 7 }
+
+-- The Event Group
+
+-- Implementation of the Event group is optional.
+-- Consult the MODULE-COMPLIANCE macro for the authoritative
+-- conformance information for this MIB.
+--
+-- The Event group controls the generation and notification
+-- of events from this device.  Each entry in the eventTable
+-- describes the parameters of the event that can be triggered.
+-- Each event entry is fired by an associated condition located
+-- elsewhere in the MIB.  An event entry may also be associated
+-- with a function elsewhere in the MIB that will be executed
+-- when the event is generated.  For example, a channel may
+-- be turned on or off by the firing of an event.
+--
+-- Each eventEntry may optionally specify that a log entry
+-- be created on its behalf whenever the event occurs.
+-- Each entry may also specify that notification should
+-- occur by way of SNMP trap messages.  In this case, the
+-- community for the trap message is given in the associated
+-- eventCommunity object.  The enterprise and specific trap
+-- fields of the trap are determined by the condition that
+-- triggered the event.  Two traps are defined: risingAlarm and
+-- fallingAlarm.  If the eventTable is triggered by a condition
+-- specified elsewhere, the enterprise and specific trap fields
+-- must be specified for traps generated for that condition.
+
+eventTable OBJECT-TYPE
+    SYNTAX     SEQUENCE OF EventEntry
+    MAX-ACCESS not-accessible
+    STATUS     current
+    DESCRIPTION
+        "A list of events to be generated."
+    ::= { event 1 }
+
+eventEntry OBJECT-TYPE
+    SYNTAX     EventEntry
+    MAX-ACCESS not-accessible
+    STATUS     current
+    DESCRIPTION
+        "A set of parameters that describe an event to be generated
+        when certain conditions are met.  As an example, an instance
+        of the eventLastTimeSent object might be named
+        eventLastTimeSent.6"
+    INDEX { eventIndex }
+    ::= { eventTable 1 }
+
+EventEntry ::= SEQUENCE {
+    eventIndex          Integer32,
+    eventDescription    DisplayString,
+    eventType           INTEGER,
+    eventCommunity      OCTET STRING,
+    eventLastTimeSent   TimeTicks,
+    eventOwner          OwnerString,
+    eventStatus         EntryStatus
+}
+
+eventIndex OBJECT-TYPE
+    SYNTAX     Integer32 (1..65535)
+    MAX-ACCESS read-only
+    STATUS     current
+    DESCRIPTION
+        "An index that uniquely identifies an entry in the
+        event table.  Each such entry defines one event that
+        is to be generated when the appropriate conditions
+        occur."
+    ::= { eventEntry 1 }
+
+eventDescription OBJECT-TYPE
+    SYNTAX     DisplayString (SIZE (0..127))
+    MAX-ACCESS read-create
+    STATUS     current
+    DESCRIPTION
+        "A comment describing this event entry."
+    ::= { eventEntry 2 }
+
+eventType OBJECT-TYPE
+    SYNTAX     INTEGER {
+                 none(1),
+                 log(2),
+                 snmptrap(3),    -- send an SNMP trap
+                 logandtrap(4)
+               }
+    MAX-ACCESS read-create
+    STATUS     current
+    DESCRIPTION
+        "The type of notification that the probe will make
+        about this event.  In the case of log, an entry is
+        made in the log table for each event.  In the case of
+        snmp-trap, an SNMP trap is sent to one or more
+        management stations."
+    ::= { eventEntry 3 }
+
+eventCommunity OBJECT-TYPE
+    SYNTAX     OCTET STRING (SIZE (0..127))
+    MAX-ACCESS read-create
+    STATUS     current
+    DESCRIPTION
+        "If an SNMP trap is to be sent, it will be sent to
+        the SNMP community specified by this octet string."
+    ::= { eventEntry 4 }
+
+eventLastTimeSent OBJECT-TYPE
+    SYNTAX     TimeTicks
+    MAX-ACCESS read-only
+    STATUS     current
+    DESCRIPTION
+        "The value of sysUpTime at the time this event
+        entry last generated an event.  If this entry has
+        not generated any events, this value will be
+        zero."
+    ::= { eventEntry 5 }
+
+eventOwner OBJECT-TYPE
+    SYNTAX     OwnerString
+    MAX-ACCESS read-create
+    STATUS     current
+    DESCRIPTION
+        "The entity that configured this entry and is therefore
+        using the resources assigned to it.
+
+        If this object contains a string starting with 'monitor'
+        and has associated entries in the log table, all connected
+        management stations should retrieve those log entries,
+        as they may have significance to all management stations
+        connected to this device"
+    ::= { eventEntry 6 }
+
+eventStatus OBJECT-TYPE
+    SYNTAX     EntryStatus
+    MAX-ACCESS read-create
+    STATUS     current
+    DESCRIPTION
+        "The status of this event entry.
+
+        If this object is not equal to valid(1), all associated
+        log entries shall be deleted by the agent."
+    ::= { eventEntry 7 }
+
+--
+logTable OBJECT-TYPE
+    SYNTAX     SEQUENCE OF LogEntry
+    MAX-ACCESS not-accessible
+    STATUS     current
+    DESCRIPTION
+        "A list of events that have been logged."
+    ::= { event 2 }
+
+logEntry OBJECT-TYPE
+    SYNTAX     LogEntry
+    MAX-ACCESS not-accessible
+    STATUS     current
+    DESCRIPTION
+        "A set of data describing an event that has been
+        logged.  For example, an instance of the logDescription
+        object might be named logDescription.6.47"
+    INDEX { logEventIndex, logIndex }
+    ::= { logTable 1 }
+
+LogEntry ::= SEQUENCE {
+    logEventIndex           Integer32,
+    logIndex                Integer32,
+    logTime                 TimeTicks,
+    logDescription          DisplayString
+}
+
+logEventIndex OBJECT-TYPE
+    SYNTAX     Integer32 (1..65535)
+    MAX-ACCESS read-only
+    STATUS     current
+    DESCRIPTION
+        "The event entry that generated this log
+        entry.  The log identified by a particular
+        value of this index is associated with the same
+        eventEntry as identified by the same value
+        of eventIndex."
+    ::= { logEntry 1 }
+
+logIndex OBJECT-TYPE
+    SYNTAX     Integer32 (1..2147483647)
+    MAX-ACCESS read-only
+    STATUS     current
+    DESCRIPTION
+        "An index that uniquely identifies an entry
+        in the log table amongst those generated by the
+        same eventEntries.  These indexes are
+        assigned beginning with 1 and increase by one
+        with each new log entry.  The association
+        between values of logIndex and logEntries
+        is fixed for the lifetime of each logEntry.
+        The agent may choose to delete the oldest
+        instances of logEntry as required because of
+        lack of memory.  It is an implementation-specific
+        matter as to when this deletion may occur."
+    ::= { logEntry 2 }
+
+logTime OBJECT-TYPE
+    SYNTAX     TimeTicks
+    MAX-ACCESS read-only
+    STATUS     current
+    DESCRIPTION
+        "The value of sysUpTime when this log entry was created."
+    ::= { logEntry 3 }
+
+logDescription OBJECT-TYPE
+    SYNTAX     DisplayString (SIZE (0..255))
+    MAX-ACCESS read-only
+    STATUS     current
+    DESCRIPTION
+        "An implementation dependent description of the
+        event that activated this log entry."
+    ::= { logEntry 4 }
+
+--  Remote Network Monitoring Traps
+
+rmonEventsV2 OBJECT-IDENTITY
+    STATUS      current
+    DESCRIPTION "Definition point for RMON notifications."
+    ::= { rmon 0 }
+
+risingAlarm NOTIFICATION-TYPE
+    OBJECTS  { alarmIndex, alarmVariable, alarmSampleType,
+               alarmValue, alarmRisingThreshold }
+    STATUS   current
+    DESCRIPTION
+        "The SNMP trap that is generated when an alarm
+        entry crosses its rising threshold and generates
+        an event that is configured for sending SNMP
+        traps."
+    ::= { rmonEventsV2 1 }
+
+fallingAlarm NOTIFICATION-TYPE
+    OBJECTS { alarmIndex, alarmVariable, alarmSampleType,
+              alarmValue, alarmFallingThreshold }
+    STATUS    current
+    DESCRIPTION
+        "The SNMP trap that is generated when an alarm
+        entry crosses its falling threshold and generates
+        an event that is configured for sending SNMP
+        traps."
+    ::= { rmonEventsV2 2 }
+
+-- Conformance information
+
+rmonCompliances OBJECT IDENTIFIER ::= { rmonConformance 9 }
+rmonGroups      OBJECT IDENTIFIER ::= { rmonConformance 10 }
+
+-- Compliance Statements
+rmonCompliance MODULE-COMPLIANCE
+    STATUS current
+    DESCRIPTION
+        "The requirements for conformance to the RMON MIB. At least
+        one of the groups in this module must be implemented to
+        conform to the RMON MIB. Implementations of this MIB
+        must also implement the system group of MIB-II [16] and the
+        IF-MIB [17]."
+    MODULE -- this module
+
+      GROUP rmonEtherStatsGroup
+          DESCRIPTION
+              "The RMON Ethernet Statistics Group is optional."
+
+      GROUP rmonHistoryControlGroup
+          DESCRIPTION
+              "The RMON History Control Group is optional."
+
+      GROUP rmonEthernetHistoryGroup
+          DESCRIPTION
+              "The RMON Ethernet History Group is optional."
+
+      GROUP rmonAlarmGroup
+          DESCRIPTION
+              "The RMON Alarm Group is optional."
+
+      GROUP rmonHostGroup
+          DESCRIPTION
+              "The RMON Host Group is mandatory when the
+              rmonHostTopNGroup is implemented."
+
+      GROUP rmonHostTopNGroup
+          DESCRIPTION
+              "The RMON Host Top N Group is optional."
+
+      GROUP rmonMatrixGroup
+          DESCRIPTION
+              "The RMON Matrix Group is optional."
+
+      GROUP rmonFilterGroup
+          DESCRIPTION
+              "The RMON Filter Group is mandatory when the
+              rmonPacketCaptureGroup is implemented."
+
+      GROUP rmonPacketCaptureGroup
+          DESCRIPTION
+              "The RMON Packet Capture Group is optional."
+
+      GROUP rmonEventGroup
+          DESCRIPTION
+              "The RMON Event Group is mandatory when the
+              rmonAlarmGroup is implemented."
+    ::= { rmonCompliances 1 }
+
+    rmonEtherStatsGroup OBJECT-GROUP
+        OBJECTS {
+            etherStatsIndex, etherStatsDataSource,
+            etherStatsDropEvents, etherStatsOctets, etherStatsPkts,
+            etherStatsBroadcastPkts, etherStatsMulticastPkts,
+            etherStatsCRCAlignErrors, etherStatsUndersizePkts,
+            etherStatsOversizePkts, etherStatsFragments,
+            etherStatsJabbers, etherStatsCollisions,
+            etherStatsPkts64Octets, etherStatsPkts65to127Octets,
+            etherStatsPkts128to255Octets,
+            etherStatsPkts256to511Octets,
+            etherStatsPkts512to1023Octets,
+            etherStatsPkts1024to1518Octets,
+            etherStatsOwner, etherStatsStatus
+        }
+        STATUS current
+        DESCRIPTION
+            "The RMON Ethernet Statistics Group."
+        ::= { rmonGroups 1 }
+
+    rmonHistoryControlGroup OBJECT-GROUP
+        OBJECTS {
+            historyControlIndex, historyControlDataSource,
+            historyControlBucketsRequested,
+            historyControlBucketsGranted, historyControlInterval,
+            historyControlOwner, historyControlStatus
+        }
+        STATUS current
+        DESCRIPTION
+            "The RMON History Control Group."
+        ::= { rmonGroups 2 }
+
+    rmonEthernetHistoryGroup OBJECT-GROUP
+        OBJECTS {
+            etherHistoryIndex, etherHistorySampleIndex,
+            etherHistoryIntervalStart, etherHistoryDropEvents,
+            etherHistoryOctets, etherHistoryPkts,
+            etherHistoryBroadcastPkts, etherHistoryMulticastPkts,
+            etherHistoryCRCAlignErrors, etherHistoryUndersizePkts,
+            etherHistoryOversizePkts, etherHistoryFragments,
+            etherHistoryJabbers, etherHistoryCollisions,
+            etherHistoryUtilization
+        }
+        STATUS current
+        DESCRIPTION
+            "The RMON Ethernet History Group."
+        ::= { rmonGroups 3 }
+
+    rmonAlarmGroup OBJECT-GROUP
+        OBJECTS {
+            alarmIndex, alarmInterval, alarmVariable,
+            alarmSampleType, alarmValue, alarmStartupAlarm,
+            alarmRisingThreshold, alarmFallingThreshold,
+            alarmRisingEventIndex, alarmFallingEventIndex,
+            alarmOwner, alarmStatus
+        }
+        STATUS current
+        DESCRIPTION
+            "The RMON Alarm Group."
+        ::= { rmonGroups 4 }
+
+    rmonHostGroup OBJECT-GROUP
+        OBJECTS {
+            hostControlIndex, hostControlDataSource,
+            hostControlTableSize, hostControlLastDeleteTime,
+            hostControlOwner, hostControlStatus,
+            hostAddress, hostCreationOrder, hostIndex,
+            hostInPkts, hostOutPkts, hostInOctets,
+            hostOutOctets, hostOutErrors, hostOutBroadcastPkts,
+            hostOutMulticastPkts, hostTimeAddress,
+            hostTimeCreationOrder, hostTimeIndex,
+            hostTimeInPkts, hostTimeOutPkts, hostTimeInOctets,
+            hostTimeOutOctets, hostTimeOutErrors,
+            hostTimeOutBroadcastPkts, hostTimeOutMulticastPkts
+        }
+        STATUS current
+        DESCRIPTION
+            "The RMON Host Group."
+        ::= { rmonGroups 5 }
+
+    rmonHostTopNGroup OBJECT-GROUP
+        OBJECTS {
+            hostTopNControlIndex, hostTopNHostIndex,
+            hostTopNRateBase, hostTopNTimeRemaining,
+            hostTopNDuration, hostTopNRequestedSize,
+            hostTopNGrantedSize, hostTopNStartTime,
+            hostTopNOwner, hostTopNStatus,
+            hostTopNReport, hostTopNIndex,
+            hostTopNAddress, hostTopNRate
+        }
+        STATUS current
+        DESCRIPTION
+            "The RMON Host Top 'N' Group."
+        ::= { rmonGroups 6 }
+
+    rmonMatrixGroup OBJECT-GROUP
+        OBJECTS {
+            matrixControlIndex, matrixControlDataSource,
+            matrixControlTableSize, matrixControlLastDeleteTime,
+            matrixControlOwner, matrixControlStatus,
+            matrixSDSourceAddress, matrixSDDestAddress,
+            matrixSDIndex, matrixSDPkts,
+            matrixSDOctets, matrixSDErrors,
+            matrixDSSourceAddress, matrixDSDestAddress,
+            matrixDSIndex, matrixDSPkts,
+            matrixDSOctets, matrixDSErrors
+        }
+        STATUS current
+        DESCRIPTION
+            "The RMON Matrix Group."
+        ::= { rmonGroups 7 }
+
+    rmonFilterGroup OBJECT-GROUP
+        OBJECTS {
+
+            filterIndex, filterChannelIndex, filterPktDataOffset,
+            filterPktData, filterPktDataMask,
+            filterPktDataNotMask, filterPktStatus,
+            filterPktStatusMask, filterPktStatusNotMask,
+            filterOwner, filterStatus,
+            channelIndex, channelIfIndex, channelAcceptType,
+            channelDataControl, channelTurnOnEventIndex,
+            channelTurnOffEventIndex, channelEventIndex,
+            channelEventStatus, channelMatches,
+            channelDescription, channelOwner, channelStatus
+        }
+        STATUS current
+        DESCRIPTION
+            "The RMON Filter Group."
+        ::= { rmonGroups 8 }
+
+    rmonPacketCaptureGroup OBJECT-GROUP
+        OBJECTS {
+            bufferControlIndex, bufferControlChannelIndex,
+            bufferControlFullStatus, bufferControlFullAction,
+            bufferControlCaptureSliceSize,
+            bufferControlDownloadSliceSize,
+            bufferControlDownloadOffset,
+            bufferControlMaxOctetsRequested,
+            bufferControlMaxOctetsGranted,
+            bufferControlCapturedPackets,
+            bufferControlTurnOnTime,
+            bufferControlOwner, bufferControlStatus,
+            captureBufferControlIndex, captureBufferIndex,
+            captureBufferPacketID, captureBufferPacketData,
+            captureBufferPacketLength, captureBufferPacketTime,
+            captureBufferPacketStatus
+        }
+        STATUS current
+        DESCRIPTION
+            "The RMON Packet Capture Group."
+        ::= { rmonGroups 9 }
+
+    rmonEventGroup OBJECT-GROUP
+        OBJECTS {
+            eventIndex, eventDescription, eventType,
+            eventCommunity, eventLastTimeSent,
+            eventOwner, eventStatus,
+            logEventIndex, logIndex, logTime,
+            logDescription
+        }
+        STATUS current
+        DESCRIPTION
+            "The RMON Event Group."
+        ::= { rmonGroups 10 }
+
+    rmonNotificationGroup NOTIFICATION-GROUP
+        NOTIFICATIONS { risingAlarm, fallingAlarm }
+        STATUS        current
+        DESCRIPTION
+            "The RMON Notification Group."
+        ::= { rmonGroups 11 }
+END
diff -Naur tomato/release/src/router/snmp/mibs/smistrip tomato121/release/src/router/snmp/mibs/smistrip
--- tomato/release/src/router/snmp/mibs/smistrip	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/mibs/smistrip	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,157 @@
+#!/bin/sh
+#
+# smistrip --
+#
+#	Extract MIB modules from text files, like RFCs or I-Ds.
+#
+# This is variant of smistrip from libsmi-0.2, modified to be somewhat
+# more aggressive in suppressing blank lines, and support the -x option.
+#
+# Copyright (c) 1999 Frank Strauss, Technical University of Braunschweig.
+# Modified by Niels Baggesen
+#
+# See the file "COPYING" for information on usage and redistribution
+# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+#
+# $Id: smistrip,v 1.1.2.1 2004/06/20 21:54:53 nikki Exp $
+#
+# NOTE, that this script relies on awk (tested with GNU awk) and getopts
+# (shell builtin like in bash or standalone).
+#
+
+AWK=awk
+GETOPTS=getopts
+VERSION=0.2-cvs
+
+
+do_version () {
+    echo "smistrip $VERSION"
+}
+
+
+
+do_usage () {
+    echo "Usage: smistrip [-Vhn] [-d dir] [-s suffix] [-m modules] file ..."
+    echo "-V         show version and license information"
+    echo "-h         show usage information"
+    echo "-n         do not write module files"
+    echo "-d dir     write module to directory dir"
+    echo "-x suffix  append suffix to the module file name"
+    echo "-m modules strip only the specified modules. For a list of modules"
+    echo "           use : as a separator"
+    echo "file ...   input files to parse (RFCs, I-Ds, ...)"
+}
+
+
+
+do_strip () {
+    cat $1 | $AWK -vtest="$test" -vdir="$dir" -vsingle="$single" -vsuffix="$suffix" '
+
+    # start of module
+    /^[ \t]*[A-Za-z0-9-]* *DEFINITIONS */ {
+	module = $1
+	collect = 1
+	macro = 0
+	n = 0
+    }
+
+    # page footer - start skipping
+    /\[Page [iv0-9]*\] */ {
+        collect = 0
+	next
+    }
+
+    /^[ \t]*(::=|DESCRIPTION|SYNTAX|(MAX-|MIN-|)ACCESS|STATUS|REFERENCE|INDEX|AUGMENTS|DEFVAL|UNITS|DISPLAY|")/ {
+	if (collect)
+	    if (line[n-1] == "") n--
+    }
+
+    # a blank line - suppress multiple
+    /^[ \t\r]*$/ {
+        if (collect)
+	    if (line[n-1] != "" && line[n-1] !~ /,[ \t\r]*$/) line[n++] = ""    
+	next
+    }
+
+    # collect non-blank line when inside mib module
+    /[^ \f\t]/ {
+	if (length(module) > 0) {
+	    if (!collect)
+		collect = 1	# page header, stop skipping
+	    else
+		line[n++] = $0
+	}
+    }
+
+    # remember when we enter a macro definition
+    / *MACRO *::=/ {
+	macro = 1
+    }
+
+    # end of module
+    /^[ \t]*END[ \t\r]*$/ {
+	if (macro)
+	    macro = 0
+	else if (length(single) == 0 || match(":"single":", ":"module":")) {
+	    strip = 99
+	    for (i = 0 ; i < n ; i++) {
+		# find the minimum column that contains non-blank characters
+		# in order to cut a blank prefix off.
+		p = match(line[i], "[^ ]")
+		if (p < strip && length(line[i]) > p) strip = p
+	    }
+
+	    if (test != "1") {
+		if (dir)
+		    f = dir "/" module suffix
+		else
+		    f = module suffix
+		for (i = 0 ; i < n ; i++)
+		    print substr(line[i], strip) >f
+	    }
+
+	    print module ": " n " lines."
+	    module = ""
+	    collect = 0
+	}
+	else
+	    print module ": ignored."
+    }
+    '
+}
+
+
+while $GETOPTS Vhnm:d:x: c ; do
+    case $c in
+	n)	test=1
+		;;
+	m)	single=$OPTARG
+		;;
+	d)	dir=$OPTARG
+		;;
+	x)	suffix=$OPTARG
+		;;
+	h)	do_usage
+		exit 0
+		;;
+	V)	do_version
+		exit 0
+		;;
+	*)	do_usage
+		exit 1
+		;;
+    esac
+done
+
+shift `expr $OPTIND - 1`
+
+
+if [ $# -eq 0 ] ; then
+    do_strip -
+else 
+    for f in $@ ; do
+	do_strip $f
+    done
+fi
+
+exit 0
diff -Naur tomato/release/src/router/snmp/mibs/SMUX-MIB.txt tomato121/release/src/router/snmp/mibs/SMUX-MIB.txt
--- tomato/release/src/router/snmp/mibs/SMUX-MIB.txt	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/mibs/SMUX-MIB.txt	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,160 @@
+SMUX-MIB DEFINITIONS ::= BEGIN
+
+IMPORTS
+        enterprises
+                FROM RFC1155-SMI
+	DisplayString
+		FROM RFC1213-MIB
+        OBJECT-TYPE
+                FROM RFC1212;
+
+unix    OBJECT IDENTIFIER ::= { enterprises 4 }
+
+smux    OBJECT IDENTIFIER ::= { unix 4 }
+
+smuxPeerTable   OBJECT-TYPE
+        SYNTAX  SEQUENCE OF SmuxPeerEntry
+        ACCESS  not-accessible
+        STATUS  mandatory
+        DESCRIPTION
+            "The SMUX peer table."
+        ::= { smux 1 }
+
+smuxPeerEntry   OBJECT-TYPE
+        SYNTAX  SmuxPeerEntry
+        ACCESS  not-accessible
+        STATUS  mandatory
+        DESCRIPTION
+            "An entry in the SMUX peer table."
+        INDEX   { smuxPindex }
+        ::= { smuxPeerTable 1}
+
+SmuxPeerEntry ::=
+    SEQUENCE {
+        smuxPindex
+            INTEGER,
+        smuxPidentity
+            OBJECT IDENTIFIER,
+        smuxPdescription
+            DisplayString,
+        smuxPstatus
+            INTEGER
+    }
+
+smuxPindex      OBJECT-TYPE
+        SYNTAX  INTEGER
+        ACCESS  read-only
+        STATUS  mandatory
+        DESCRIPTION
+            "An index which uniquely identifies a SMUX peer."
+        ::= { smuxPeerEntry 1 }
+
+smuxPidentity   OBJECT-TYPE
+        SYNTAX  OBJECT IDENTIFIER
+        ACCESS  read-only
+        STATUS  mandatory
+        DESCRIPTION
+            "The authoritative designation for a SMUX peer."
+        ::= { smuxPeerEntry 2 }
+
+smuxPdescription OBJECT-TYPE
+        SYNTAX  DisplayString (SIZE (0..255))
+        ACCESS  read-only
+        STATUS  mandatory
+        DESCRIPTION
+            "A human-readable description of a SMUX peer."
+        ::= { smuxPeerEntry 3 }
+
+smuxPstatus     OBJECT-TYPE
+        SYNTAX  INTEGER { valid(1), invalid(2), connecting(3) }
+        ACCESS  read-write
+        STATUS  mandatory
+        DESCRIPTION
+            "The type of SMUX peer.
+
+            Setting this object to the value invalid(2) has
+            the effect of invaliding the corresponding entry
+            in the smuxPeerTable.  It is an implementation-
+            specific matter as to whether the agent removes an
+            invalidated entry from the table.  Accordingly,
+            management stations must be prepared to receive
+            tabular information from agents that correspond to
+            entries not currently in use.  Proper
+            interpretation of such entries requires
+            examination of the relative smuxPstatus object."
+        ::= { smuxPeerEntry 4 }
+
+smuxTreeTable   OBJECT-TYPE
+        SYNTAX  SEQUENCE OF SmuxTreeEntry
+        ACCESS  not-accessible
+        STATUS  mandatory
+        DESCRIPTION
+            "The SMUX tree table."
+        ::= { smux 2 }
+
+smuxTreeEntry   OBJECT-TYPE
+        SYNTAX  SmuxTreeEntry
+        ACCESS  not-accessible
+        STATUS  mandatory
+        DESCRIPTION
+            "An entry in the SMUX tree table."
+        INDEX   { smuxTsubtree, smuxTpriority }
+        ::= { smuxTreeTable 1}
+
+SmuxTreeEntry ::=
+    SEQUENCE {
+        smuxTsubtree
+            OBJECT IDENTIFIER,
+        smuxTpriority
+            INTEGER,
+        smuxTindex
+            INTEGER,
+        smuxTstatus
+            INTEGER
+    }
+
+smuxTsubtree    OBJECT-TYPE
+        SYNTAX  OBJECT IDENTIFIER
+        ACCESS  read-only
+        STATUS  mandatory
+        DESCRIPTION
+            "The MIB subtree being exported by a SMUX peer."
+        ::= { smuxTreeEntry 1 }
+
+smuxTpriority OBJECT-TYPE
+        SYNTAX  INTEGER (0..'7fffffff'h)
+        ACCESS  read-only
+        STATUS  mandatory
+        DESCRIPTION
+            "The SMUX peer's priority when exporting the MIB
+            subtree."
+        ::= { smuxTreeEntry 2 }
+
+smuxTindex OBJECT-TYPE
+        SYNTAX  INTEGER
+        ACCESS  read-only
+        STATUS  mandatory
+        DESCRIPTION
+            "The SMUX peer's identity."
+        ::= { smuxTreeEntry 3 }
+
+smuxTstatus     OBJECT-TYPE
+        SYNTAX  INTEGER { valid(1), invalid(2) }
+        ACCESS  read-write
+        STATUS  mandatory
+        DESCRIPTION
+            "The type of SMUX tree.
+
+            Setting this object to the value invalid(2) has
+            the effect of invaliding the corresponding entry
+            in the smuxTreeTable.  It is an implementation-
+            specific matter as to whether the agent removes an
+            invalidated entry from the table.  Accordingly,
+            management stations must be prepared to receive
+            tabular information from agents that correspond to
+            entries not currently in use.  Proper
+            interpretation of such entries requires
+            examination of the relative smuxTstatus object."
+        ::= { smuxTreeEntry 4 }
+
+END
diff -Naur tomato/release/src/router/snmp/mibs/SNMP-COMMUNITY-MIB.txt tomato121/release/src/router/snmp/mibs/SNMP-COMMUNITY-MIB.txt
--- tomato/release/src/router/snmp/mibs/SNMP-COMMUNITY-MIB.txt	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/mibs/SNMP-COMMUNITY-MIB.txt	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,429 @@
+SNMP-COMMUNITY-MIB DEFINITIONS ::= BEGIN
+
+IMPORTS
+    IpAddress,
+    MODULE-IDENTITY,
+    OBJECT-TYPE,
+    Integer32,
+    snmpModules
+        FROM SNMPv2-SMI
+    RowStatus,
+    StorageType
+        FROM SNMPv2-TC
+    SnmpAdminString,
+    SnmpEngineID
+        FROM SNMP-FRAMEWORK-MIB
+    SnmpTagValue,
+    snmpTargetAddrEntry
+        FROM SNMP-TARGET-MIB
+    MODULE-COMPLIANCE,
+    OBJECT-GROUP
+        FROM SNMPv2-CONF;
+
+snmpCommunityMIB MODULE-IDENTITY
+    LAST-UPDATED "200003060000Z"          -- 6 Mar 2000, midnight
+    ORGANIZATION "SNMPv3 Working Group"
+    CONTACT-INFO "WG-email:   snmpv3@lists.tislabs.com
+                  Subscribe:  majordomo@lists.tislabs.com
+                              In msg body:  subscribe snmpv3
+
+                  Chair:      Russ Mundy
+                              TIS Labs at Network Associates
+                  Postal:     3060 Washington Rd
+                              Glenwood MD 21738
+                              USA
+                  Email:      mundy@tislabs.com
+                  Phone:      +1-301-854-6889
+
+                  Co-editor:  Rob Frye
+                              CoSine Communications
+                  Postal:     1200 Bridge Parkway
+                              Redwood City, CA 94065
+                              USA
+                  E-mail:     rfrye@cosinecom.com
+                  Phone:      +1 703 725 1130
+
+                  Co-editor:  David B. Levi
+                              Nortel Networks
+                  Postal:     3505 Kesterwood Drive
+                              Knoxville, TN 37918
+                  E-mail:     dlevi@nortelnetworks.com
+                  Phone:      +1 423 686 0432
+
+                  Co-editor:  Shawn A. Routhier
+                              Integrated Systems Inc.
+                  Postal:     333 North Ave 4th Floor
+                              Wakefield, MA 01880
+                  E-mail:     sar@epilogue.com
+                  Phone:      +1 781 245 0804
+
+                  Co-editor:  Bert Wijnen
+                              Lucent Technologies
+                  Postal:     Schagen 33
+                              3461 GL Linschoten
+                              Netherlands
+                  Email:      bwijnen@lucent.com
+                  Phone:      +31-348-407-775
+                 "
+        DESCRIPTION
+            "This MIB module defines objects to help support coexistence
+             between SNMPv1, SNMPv2c, and SNMPv3."
+        REVISION "200003060000Z" -- 6 Mar 2000
+        DESCRIPTION "This version published as RFC 2576."
+        REVISION "199905130000Z" -- 13 May 1999
+        DESCRIPTION "The Initial Revision"
+    ::= { snmpModules 18 }
+
+-- Administrative assignments ****************************************
+
+snmpCommunityMIBObjects     OBJECT IDENTIFIER ::= { snmpCommunityMIB 1 }
+snmpCommunityMIBConformance OBJECT IDENTIFIER ::= { snmpCommunityMIB 2 }
+
+--
+-- The snmpCommunityTable contains a database of community strings.
+-- This table provides mappings between community strings, and the
+
+-- parameters required for View-based Access Control.
+--
+
+snmpCommunityTable OBJECT-TYPE
+    SYNTAX       SEQUENCE OF SnmpCommunityEntry
+    MAX-ACCESS   not-accessible
+    STATUS       current
+    DESCRIPTION
+        "The table of community strings configured in the SNMP
+         engine's Local Configuration Datastore (LCD)."
+    ::= { snmpCommunityMIBObjects 1 }
+
+snmpCommunityEntry OBJECT-TYPE
+    SYNTAX       SnmpCommunityEntry
+    MAX-ACCESS   not-accessible
+    STATUS       current
+    DESCRIPTION
+        "Information about a particular community string."
+    INDEX       { IMPLIED snmpCommunityIndex }
+    ::= { snmpCommunityTable 1 }
+
+SnmpCommunityEntry ::= SEQUENCE {
+    snmpCommunityIndex               SnmpAdminString,
+    snmpCommunityName                OCTET STRING,
+    snmpCommunitySecurityName        SnmpAdminString,
+    snmpCommunityContextEngineID     SnmpEngineID,
+    snmpCommunityContextName         SnmpAdminString,
+    snmpCommunityTransportTag        SnmpTagValue,
+    snmpCommunityStorageType         StorageType,
+    snmpCommunityStatus              RowStatus
+}
+
+snmpCommunityIndex OBJECT-TYPE
+    SYNTAX      SnmpAdminString (SIZE(1..32))
+    MAX-ACCESS  not-accessible
+    STATUS      current
+    DESCRIPTION
+        "The unique index value of a row in this table."
+    ::= { snmpCommunityEntry 1 }
+
+snmpCommunityName OBJECT-TYPE
+    SYNTAX       OCTET STRING
+    MAX-ACCESS   read-create
+    STATUS       current
+    DESCRIPTION
+        "The community string for which a row in this table
+         represents a configuration."
+    ::= { snmpCommunityEntry 2 }
+
+snmpCommunitySecurityName OBJECT-TYPE
+    SYNTAX       SnmpAdminString (SIZE(1..32))
+    MAX-ACCESS   read-create
+    STATUS       current
+    DESCRIPTION
+        "A human readable string representing the corresponding
+         value of snmpCommunityName in a Security Model
+         independent format."
+    ::= { snmpCommunityEntry 3 }
+
+snmpCommunityContextEngineID OBJECT-TYPE
+    SYNTAX       SnmpEngineID
+    MAX-ACCESS   read-create
+    STATUS       current
+    DESCRIPTION
+        "The contextEngineID indicating the location of the
+         context in which management information is accessed
+         when using the community string specified by the
+         corresponding instance of snmpCommunityName.
+
+         The default value is the snmpEngineID of the entity in
+         which this object is instantiated."
+    ::= { snmpCommunityEntry 4 }
+
+snmpCommunityContextName OBJECT-TYPE
+    SYNTAX       SnmpAdminString (SIZE(0..32))
+    MAX-ACCESS   read-create
+    STATUS       current
+    DESCRIPTION
+        "The context in which management information is accessed
+         when using the community string specified by the corresponding
+         instance of snmpCommunityName."
+    DEFVAL      { ''H }   -- the empty string
+    ::= { snmpCommunityEntry 5 }
+
+snmpCommunityTransportTag OBJECT-TYPE
+    SYNTAX       SnmpTagValue
+    MAX-ACCESS   read-create
+    STATUS       current
+    DESCRIPTION
+        "This object specifies a set of transport endpoints
+         from which a command responder application will accept
+         management requests.  If a management request containing
+         this community is received on a transport endpoint other
+         than the transport endpoints identified by this object,
+         the request is deemed unauthentic.
+
+         The transports identified by this object are specified
+
+         in the snmpTargetAddrTable.  Entries in that table
+         whose snmpTargetAddrTagList contains this tag value
+         are identified.
+
+         If the value of this object has zero-length, transport
+         endpoints are not checked when authenticating messages
+         containing this community string."
+    DEFVAL      { ''H }   -- the empty string
+    ::= { snmpCommunityEntry 6 }
+
+snmpCommunityStorageType OBJECT-TYPE
+    SYNTAX       StorageType
+    MAX-ACCESS   read-create
+    STATUS       current
+    DESCRIPTION
+        "The storage type for this conceptual row in the
+         snmpCommunityTable.  Conceptual rows having the value
+         'permanent' need not allow write-access to any
+         columnar object in the row."
+    ::= { snmpCommunityEntry 7 }
+
+snmpCommunityStatus OBJECT-TYPE
+    SYNTAX       RowStatus
+    MAX-ACCESS   read-create
+    STATUS       current
+    DESCRIPTION
+        "The status of this conceptual row in the snmpCommunityTable.
+
+         An entry in this table is not qualified for activation
+         until instances of all corresponding columns have been
+         initialized, either through default values, or through
+         Set operations.  The snmpCommunityName and
+         snmpCommunitySecurityName objects must be explicitly set.
+
+         There is no restriction on setting columns in this table
+         when the value of snmpCommunityStatus is active(1)."
+    ::= { snmpCommunityEntry 8 }
+
+--
+-- The snmpTargetAddrExtTable
+--
+
+snmpTargetAddrExtTable OBJECT-TYPE
+    SYNTAX       SEQUENCE OF SnmpTargetAddrExtEntry
+    MAX-ACCESS   not-accessible
+    STATUS       current
+    DESCRIPTION
+        "The table of mask and mms values associated with the
+
+         snmpTargetAddrTable.
+
+         The snmpTargetAddrExtTable augments the
+         snmpTargetAddrTable with a transport address mask value
+         and a maximum message size value.  The transport address
+         mask allows entries in the snmpTargetAddrTable to define
+         a set of addresses instead of just a single address.
+         The maximum message size value allows the maximum
+         message size of another SNMP entity to be configured for
+         use in SNMPv1 (and SNMPv2c) transactions, where the
+         message format does not specify a maximum message size."
+    ::= { snmpCommunityMIBObjects 2 }
+
+snmpTargetAddrExtEntry OBJECT-TYPE
+    SYNTAX       SnmpTargetAddrExtEntry
+    MAX-ACCESS   not-accessible
+    STATUS       current
+    DESCRIPTION
+        "Information about a particular mask and mms value."
+    AUGMENTS       { snmpTargetAddrEntry }
+    ::= { snmpTargetAddrExtTable 1 }
+
+SnmpTargetAddrExtEntry ::= SEQUENCE {
+    snmpTargetAddrTMask              OCTET STRING,
+    snmpTargetAddrMMS                Integer32
+}
+
+snmpTargetAddrTMask OBJECT-TYPE
+    SYNTAX      OCTET STRING (SIZE (0..255))
+    MAX-ACCESS  read-create
+    STATUS      current
+    DESCRIPTION
+        "The mask value associated with an entry in the
+         snmpTargetAddrTable.  The value of this object must
+         have the same length as the corresponding instance of
+         snmpTargetAddrTAddress, or must have length 0.  An
+         attempt to set it to any other value will result in
+         an inconsistentValue error.
+
+         The value of this object allows an entry in the
+         snmpTargetAddrTable to specify multiple addresses.
+         The mask value is used to select which bits of
+         a transport address must match bits of the corresponding
+         instance of snmpTargetAddrTAddress, in order for the
+         transport address to match a particular entry in the
+         snmpTargetAddrTable.  Bits which are 1 in the mask
+         value indicate bits in the transport address which
+         must match bits in the snmpTargetAddrTAddress value.
+
+         Bits which are 0 in the mask indicate bits in the
+         transport address which need not match.  If the
+         length of the mask is 0, the mask should be treated
+         as if all its bits were 1 and its length were equal
+         to the length of the corresponding value of
+         snmpTargetAddrTable.
+
+         This object may not be modified while the value of the
+         corresponding instance of snmpTargetAddrRowStatus is
+         active(1).  An attempt to set this object in this case
+         will result in an inconsistentValue error."
+    DEFVAL { ''H }
+    ::= { snmpTargetAddrExtEntry 1 }
+
+snmpTargetAddrMMS OBJECT-TYPE
+    SYNTAX      Integer32 (0|484..2147483647)
+    MAX-ACCESS  read-create
+    STATUS      current
+    DESCRIPTION
+        "The maximum message size value associated with an entry
+         in the snmpTargetAddrTable."
+    DEFVAL { 484 }
+    ::= { snmpTargetAddrExtEntry 2 }
+
+--
+-- The snmpTrapAddress and snmpTrapCommunity objects are included
+-- in notifications that are forwarded by a proxy, which were
+-- originally received as SNMPv1 Trap messages.
+--
+
+snmpTrapAddress OBJECT-TYPE
+    SYNTAX      IpAddress
+    MAX-ACCESS  accessible-for-notify
+    STATUS      current
+    DESCRIPTION
+        "The value of the agent-addr field of a Trap PDU which
+         is forwarded by a proxy forwarder application using
+         an SNMP version other than SNMPv1.  The value of this
+         object SHOULD contain the value of the agent-addr field
+         from the original Trap PDU as generated by an SNMPv1
+         agent."
+    ::= { snmpCommunityMIBObjects 3 }
+
+snmpTrapCommunity OBJECT-TYPE
+    SYNTAX      OCTET STRING
+    MAX-ACCESS  accessible-for-notify
+    STATUS      current
+    DESCRIPTION
+        "The value of the community string field of an SNMPv1
+         message containing a Trap PDU which is forwarded by a
+         a proxy forwarder application using an SNMP version
+         other than SNMPv1.  The value of this object SHOULD
+         contain the value of the community string field from
+         the original SNMPv1 message containing a Trap PDU as
+         generated by an SNMPv1 agent."
+    ::= { snmpCommunityMIBObjects 4 }
+
+-- Conformance Information *******************************************
+
+snmpCommunityMIBCompliances OBJECT IDENTIFIER
+                            ::= { snmpCommunityMIBConformance 1 }
+snmpCommunityMIBGroups      OBJECT IDENTIFIER
+                            ::= { snmpCommunityMIBConformance 2 }
+
+-- Compliance statements
+
+snmpCommunityMIBCompliance MODULE-COMPLIANCE
+    STATUS       current
+    DESCRIPTION
+        "The compliance statement for SNMP engines which
+         implement the SNMP-COMMUNITY-MIB."
+
+    MODULE       -- this module
+        MANDATORY-GROUPS { snmpCommunityGroup }
+
+        OBJECT           snmpCommunityName
+        MIN-ACCESS       read-only
+        DESCRIPTION     "Write access is not required."
+
+        OBJECT           snmpCommunitySecurityName
+        MIN-ACCESS       read-only
+        DESCRIPTION     "Write access is not required."
+
+        OBJECT           snmpCommunityContextEngineID
+        MIN-ACCESS       read-only
+        DESCRIPTION     "Write access is not required."
+
+        OBJECT           snmpCommunityContextName
+        MIN-ACCESS       read-only
+        DESCRIPTION     "Write access is not required."
+
+        OBJECT           snmpCommunityTransportTag
+        MIN-ACCESS       read-only
+        DESCRIPTION     "Write access is not required."
+
+        OBJECT           snmpCommunityStorageType
+        MIN-ACCESS       read-only
+        DESCRIPTION     "Write access is not required."
+
+        OBJECT           snmpCommunityStatus
+        MIN-ACCESS       read-only
+        DESCRIPTION     "Write access is not required."
+    ::= { snmpCommunityMIBCompliances 1 }
+
+snmpProxyTrapForwardCompliance MODULE-COMPLIANCE
+    STATUS       current
+    DESCRIPTION
+        "The compliance statement for SNMP engines which
+         contain a proxy forwarding application which is
+         capable of forwarding SNMPv1 traps using SNMPv2c
+         or SNMPv3."
+    MODULE       -- this module
+        MANDATORY-GROUPS { snmpProxyTrapForwardGroup }
+    ::= { snmpCommunityMIBCompliances 2 }
+
+snmpCommunityGroup OBJECT-GROUP
+    OBJECTS {
+        snmpCommunityName,
+        snmpCommunitySecurityName,
+        snmpCommunityContextEngineID,
+        snmpCommunityContextName,
+        snmpCommunityTransportTag,
+        snmpCommunityStorageType,
+        snmpCommunityStatus,
+        snmpTargetAddrTMask,
+        snmpTargetAddrMMS
+    }
+    STATUS       current
+    DESCRIPTION
+        "A collection of objects providing for configuration
+         of community strings for SNMPv1 (and SNMPv2c) usage."
+    ::= { snmpCommunityMIBGroups 1 }
+
+snmpProxyTrapForwardGroup OBJECT-GROUP
+    OBJECTS {
+        snmpTrapAddress,
+        snmpTrapCommunity
+    }
+    STATUS       current
+    DESCRIPTION
+        "Objects which are used by proxy forwarding applications
+         when translating traps between SNMP versions.  These are
+         used to preserve SNMPv1-specific information when
+
+         translating to SNMPv2c or SNMPv3."
+    ::= { snmpCommunityMIBGroups 3 }
+
+END
diff -Naur tomato/release/src/router/snmp/mibs/SNMP-FRAMEWORK-MIB.txt tomato121/release/src/router/snmp/mibs/SNMP-FRAMEWORK-MIB.txt
--- tomato/release/src/router/snmp/mibs/SNMP-FRAMEWORK-MIB.txt	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/mibs/SNMP-FRAMEWORK-MIB.txt	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,526 @@
+SNMP-FRAMEWORK-MIB DEFINITIONS ::= BEGIN
+
+IMPORTS
+    MODULE-IDENTITY, OBJECT-TYPE,
+    OBJECT-IDENTITY,
+    snmpModules                           FROM SNMPv2-SMI
+    TEXTUAL-CONVENTION                    FROM SNMPv2-TC
+    MODULE-COMPLIANCE, OBJECT-GROUP       FROM SNMPv2-CONF;
+
+snmpFrameworkMIB MODULE-IDENTITY
+    LAST-UPDATED "200210140000Z"
+    ORGANIZATION "SNMPv3 Working Group"
+    CONTACT-INFO "WG-EMail:   snmpv3@lists.tislabs.com
+                  Subscribe:  snmpv3-request@lists.tislabs.com
+
+                  Co-Chair:   Russ Mundy
+                              Network Associates Laboratories
+                  postal:     15204 Omega Drive, Suite 300
+                              Rockville, MD 20850-4601
+                              USA
+                  EMail:      mundy@tislabs.com
+                  phone:      +1 301-947-7107
+
+                  Co-Chair &
+                  Co-editor:  David Harrington
+                              Enterasys Networks
+                  postal:     35 Industrial Way
+                              P. O. Box 5005
+                              Rochester, New Hampshire 03866-5005
+                              USA
+                  EMail:      dbh@enterasys.com
+                  phone:      +1 603-337-2614
+
+                  Co-editor:  Randy Presuhn
+                              BMC Software, Inc.
+                  postal:     2141 North First Street
+                              San Jose, California 95131
+                              USA
+                  EMail:      randy_presuhn@bmc.com
+                  phone:      +1 408-546-1006
+
+                  Co-editor:  Bert Wijnen
+                              Lucent Technologies
+                  postal:     Schagen 33
+                              3461 GL Linschoten
+                              Netherlands
+
+                  EMail:      bwijnen@lucent.com
+                  phone:      +31 348-680-485
+                    "
+       DESCRIPTION  "The SNMP Management Architecture MIB
+
+                     Copyright (C) The Internet Society (2002). This
+                     version of this MIB module is part of RFC 3411;
+                     see the RFC itself for full legal notices.
+                    "
+
+       REVISION     "200210140000Z"         -- 14 October 2002
+       DESCRIPTION  "Changes in this revision:
+                     - Updated various administrative information.
+                     - Corrected some typos.
+                     - Corrected typo in description of SnmpEngineID
+                       that led to range overlap for 127.
+                     - Changed '255a' to '255t' in definition of
+                       SnmpAdminString to align with current SMI.
+                     - Reworded 'reserved' for value zero in
+                       DESCRIPTION of SnmpSecurityModel.
+                     - The algorithm for allocating security models
+                       should give 256 per enterprise block, rather
+                       than 255.
+                     - The example engine ID of 'abcd' is not
+                       legal. Replaced with '800002b804616263'H based
+                       on example enterprise 696, string 'abc'.
+                     - Added clarification that engineID should
+                       persist across re-initializations.
+                     This revision published as RFC 3411.
+                    "
+       REVISION     "199901190000Z"         -- 19 January 1999
+       DESCRIPTION  "Updated editors' addresses, fixed typos.
+                     Published as RFC 2571.
+                    "
+       REVISION     "199711200000Z"         -- 20 November 1997
+       DESCRIPTION  "The initial version, published in RFC 2271.
+                    "
+       ::= { snmpModules 10 }
+
+   -- Textual Conventions used in the SNMP Management Architecture ***
+
+SnmpEngineID ::= TEXTUAL-CONVENTION
+    STATUS       current
+    DESCRIPTION "An SNMP engine's administratively-unique identifier.
+                 Objects of this type are for identification, not for
+                 addressing, even though it is possible that an
+                 address may have been used in the generation of
+                 a specific value.
+
+                 The value for this object may not be all zeros or
+                 all 'ff'H or the empty (zero length) string.
+
+                 The initial value for this object may be configured
+                 via an operator console entry or via an algorithmic
+                 function.  In the latter case, the following
+                 example algorithm is recommended.
+
+                 In cases where there are multiple engines on the
+                 same system, the use of this algorithm is NOT
+                 appropriate, as it would result in all of those
+                 engines ending up with the same ID value.
+
+                 1) The very first bit is used to indicate how the
+                    rest of the data is composed.
+
+                    0 - as defined by enterprise using former methods
+                        that existed before SNMPv3. See item 2 below.
+
+                    1 - as defined by this architecture, see item 3
+                        below.
+
+                    Note that this allows existing uses of the
+                    engineID (also known as AgentID [RFC1910]) to
+                    co-exist with any new uses.
+
+                 2) The snmpEngineID has a length of 12 octets.
+
+                    The first four octets are set to the binary
+                    equivalent of the agent's SNMP management
+                    private enterprise number as assigned by the
+                    Internet Assigned Numbers Authority (IANA).
+                    For example, if Acme Networks has been assigned
+                    { enterprises 696 }, the first four octets would
+                    be assigned '000002b8'H.
+
+                    The remaining eight octets are determined via
+                    one or more enterprise-specific methods. Such
+                    methods must be designed so as to maximize the
+                    possibility that the value of this object will
+                    be unique in the agent's administrative domain.
+                    For example, it may be the IP address of the SNMP
+                    entity, or the MAC address of one of the
+                    interfaces, with each address suitably padded
+                    with random octets.  If multiple methods are
+                    defined, then it is recommended that the first
+                    octet indicate the method being used and the
+                    remaining octets be a function of the method.
+
+                 3) The length of the octet string varies.
+
+                    The first four octets are set to the binary
+                    equivalent of the agent's SNMP management
+                    private enterprise number as assigned by the
+                    Internet Assigned Numbers Authority (IANA).
+                    For example, if Acme Networks has been assigned
+                    { enterprises 696 }, the first four octets would
+                    be assigned '000002b8'H.
+
+                    The very first bit is set to 1. For example, the
+                    above value for Acme Networks now changes to be
+                    '800002b8'H.
+
+                    The fifth octet indicates how the rest (6th and
+                    following octets) are formatted. The values for
+                    the fifth octet are:
+
+                      0     - reserved, unused.
+
+                      1     - IPv4 address (4 octets)
+                              lowest non-special IP address
+
+                      2     - IPv6 address (16 octets)
+                              lowest non-special IP address
+
+                      3     - MAC address (6 octets)
+                              lowest IEEE MAC address, canonical
+                              order
+
+                      4     - Text, administratively assigned
+                              Maximum remaining length 27
+
+                      5     - Octets, administratively assigned
+                              Maximum remaining length 27
+
+                      6-127 - reserved, unused
+
+                    128-255 - as defined by the enterprise
+                              Maximum remaining length 27
+                "
+    SYNTAX       OCTET STRING (SIZE(5..32))
+
+SnmpSecurityModel ::= TEXTUAL-CONVENTION
+    STATUS       current
+    DESCRIPTION "An identifier that uniquely identifies a
+                 Security Model of the Security Subsystem within
+                 this SNMP Management Architecture.
+
+                 The values for securityModel are allocated as
+                 follows:
+
+                 - The zero value does not identify any particular
+                   security model.
+
+                 - Values between 1 and 255, inclusive, are reserved
+                   for standards-track Security Models and are
+                   managed by the Internet Assigned Numbers Authority
+                   (IANA).
+                 - Values greater than 255 are allocated to
+                   enterprise-specific Security Models.  An
+                   enterprise-specific securityModel value is defined
+                   to be:
+
+                   enterpriseID * 256 + security model within
+                   enterprise
+
+                   For example, the fourth Security Model defined by
+                   the enterprise whose enterpriseID is 1 would be
+                   259.
+
+                 This scheme for allocation of securityModel
+                 values allows for a maximum of 255 standards-
+                 based Security Models, and for a maximum of
+                 256 Security Models per enterprise.
+
+                 It is believed that the assignment of new
+                 securityModel values will be rare in practice
+                 because the larger the number of simultaneously
+                 utilized Security Models, the larger the
+                 chance that interoperability will suffer.
+                 Consequently, it is believed that such a range
+                 will be sufficient.  In the unlikely event that
+                 the standards committee finds this number to be
+                 insufficient over time, an enterprise number
+                 can be allocated to obtain an additional 256
+                 possible values.
+
+                 Note that the most significant bit must be zero;
+                 hence, there are 23 bits allocated for various
+                 organizations to design and define non-standard
+
+                 securityModels.  This limits the ability to
+                 define new proprietary implementations of Security
+                 Models to the first 8,388,608 enterprises.
+
+                 It is worthwhile to note that, in its encoded
+                 form, the securityModel value will normally
+                 require only a single byte since, in practice,
+                 the leftmost bits will be zero for most messages
+                 and sign extension is suppressed by the encoding
+                 rules.
+
+                 As of this writing, there are several values
+                 of securityModel defined for use with SNMP or
+                 reserved for use with supporting MIB objects.
+                 They are as follows:
+
+                     0  reserved for 'any'
+                     1  reserved for SNMPv1
+                     2  reserved for SNMPv2c
+                     3  User-Based Security Model (USM)
+                "
+    SYNTAX       INTEGER(0 .. 2147483647)
+
+SnmpMessageProcessingModel ::= TEXTUAL-CONVENTION
+    STATUS       current
+    DESCRIPTION "An identifier that uniquely identifies a Message
+                 Processing Model of the Message Processing
+                 Subsystem within this SNMP Management Architecture.
+
+                 The values for messageProcessingModel are
+                 allocated as follows:
+
+                 - Values between 0 and 255, inclusive, are
+                   reserved for standards-track Message Processing
+                   Models and are managed by the Internet Assigned
+                   Numbers Authority (IANA).
+
+                 - Values greater than 255 are allocated to
+                   enterprise-specific Message Processing Models.
+                   An enterprise messageProcessingModel value is
+                   defined to be:
+
+                   enterpriseID * 256 +
+                        messageProcessingModel within enterprise
+
+                   For example, the fourth Message Processing Model
+                   defined by the enterprise whose enterpriseID
+
+                   is 1 would be 259.
+
+                 This scheme for allocating messageProcessingModel
+                 values allows for a maximum of 255 standards-
+                 based Message Processing Models, and for a
+                 maximum of 256 Message Processing Models per
+                 enterprise.
+
+                 It is believed that the assignment of new
+                 messageProcessingModel values will be rare
+                 in practice because the larger the number of
+                 simultaneously utilized Message Processing Models,
+                 the larger the chance that interoperability
+                 will suffer. It is believed that such a range
+                 will be sufficient.  In the unlikely event that
+                 the standards committee finds this number to be
+                 insufficient over time, an enterprise number
+                 can be allocated to obtain an additional 256
+                 possible values.
+
+                 Note that the most significant bit must be zero;
+                 hence, there are 23 bits allocated for various
+                 organizations to design and define non-standard
+                 messageProcessingModels.  This limits the ability
+                 to define new proprietary implementations of
+                 Message Processing Models to the first 8,388,608
+                 enterprises.
+
+                 It is worthwhile to note that, in its encoded
+                 form, the messageProcessingModel value will
+                 normally require only a single byte since, in
+                 practice, the leftmost bits will be zero for
+                 most messages and sign extension is suppressed
+                 by the encoding rules.
+
+                 As of this writing, there are several values of
+                 messageProcessingModel defined for use with SNMP.
+                 They are as follows:
+
+                     0  reserved for SNMPv1
+                     1  reserved for SNMPv2c
+                     2  reserved for SNMPv2u and SNMPv2*
+                     3  reserved for SNMPv3
+                "
+    SYNTAX       INTEGER(0 .. 2147483647)
+
+SnmpSecurityLevel ::= TEXTUAL-CONVENTION
+    STATUS       current
+    DESCRIPTION "A Level of Security at which SNMP messages can be
+                 sent or with which operations are being processed;
+                 in particular, one of:
+
+                   noAuthNoPriv - without authentication and
+                                  without privacy,
+                   authNoPriv   - with authentication but
+                                  without privacy,
+                   authPriv     - with authentication and
+                                  with privacy.
+
+                 These three values are ordered such that
+                 noAuthNoPriv is less than authNoPriv and
+                 authNoPriv is less than authPriv.
+                "
+    SYNTAX       INTEGER { noAuthNoPriv(1),
+                           authNoPriv(2),
+                           authPriv(3)
+                         }
+
+SnmpAdminString ::= TEXTUAL-CONVENTION
+    DISPLAY-HINT "255t"
+    STATUS       current
+    DESCRIPTION "An octet string containing administrative
+                 information, preferably in human-readable form.
+
+                 To facilitate internationalization, this
+                 information is represented using the ISO/IEC
+                 IS 10646-1 character set, encoded as an octet
+                 string using the UTF-8 transformation format
+                 described in [RFC2279].
+
+                 Since additional code points are added by
+                 amendments to the 10646 standard from time
+                 to time, implementations must be prepared to
+                 encounter any code point from 0x00000000 to
+                 0x7fffffff.  Byte sequences that do not
+                 correspond to the valid UTF-8 encoding of a
+                 code point or are outside this range are
+                 prohibited.
+
+                 The use of control codes should be avoided.
+
+                 When it is necessary to represent a newline,
+                 the control code sequence CR LF should be used.
+
+                 The use of leading or trailing white space should
+                 be avoided.
+
+                 For code points not directly supported by user
+                 interface hardware or software, an alternative
+                 means of entry and display, such as hexadecimal,
+                 may be provided.
+
+                 For information encoded in 7-bit US-ASCII,
+                 the UTF-8 encoding is identical to the
+                 US-ASCII encoding.
+
+                 UTF-8 may require multiple bytes to represent a
+                 single character / code point; thus the length
+                 of this object in octets may be different from
+                 the number of characters encoded.  Similarly,
+                 size constraints refer to the number of encoded
+                 octets, not the number of characters represented
+                 by an encoding.
+
+                 Note that when this TC is used for an object that
+                 is used or envisioned to be used as an index, then
+                 a SIZE restriction MUST be specified so that the
+                 number of sub-identifiers for any object instance
+                 does not exceed the limit of 128, as defined by
+                 [RFC3416].
+
+                 Note that the size of an SnmpAdminString object is
+                 measured in octets, not characters.
+                "
+    SYNTAX       OCTET STRING (SIZE (0..255))
+
+-- Administrative assignments ***************************************
+
+snmpFrameworkAdmin
+    OBJECT IDENTIFIER ::= { snmpFrameworkMIB 1 }
+snmpFrameworkMIBObjects
+    OBJECT IDENTIFIER ::= { snmpFrameworkMIB 2 }
+snmpFrameworkMIBConformance
+    OBJECT IDENTIFIER ::= { snmpFrameworkMIB 3 }
+
+-- the snmpEngine Group ********************************************
+
+snmpEngine OBJECT IDENTIFIER ::= { snmpFrameworkMIBObjects 1 }
+
+snmpEngineID     OBJECT-TYPE
+    SYNTAX       SnmpEngineID
+    MAX-ACCESS   read-only
+    STATUS       current
+    DESCRIPTION "An SNMP engine's administratively-unique identifier.
+
+                 This information SHOULD be stored in non-volatile
+                 storage so that it remains constant across
+                 re-initializations of the SNMP engine.
+                "
+    ::= { snmpEngine 1 }
+
+snmpEngineBoots  OBJECT-TYPE
+    SYNTAX       INTEGER (1..2147483647)
+    MAX-ACCESS   read-only
+    STATUS       current
+    DESCRIPTION "The number of times that the SNMP engine has
+                 (re-)initialized itself since snmpEngineID
+                 was last configured.
+                "
+    ::= { snmpEngine 2 }
+
+snmpEngineTime   OBJECT-TYPE
+    SYNTAX       INTEGER (0..2147483647)
+    UNITS        "seconds"
+    MAX-ACCESS   read-only
+    STATUS       current
+    DESCRIPTION "The number of seconds since the value of
+                 the snmpEngineBoots object last changed.
+                 When incrementing this object's value would
+                 cause it to exceed its maximum,
+                 snmpEngineBoots is incremented as if a
+                 re-initialization had occurred, and this
+                 object's value consequently reverts to zero.
+                "
+    ::= { snmpEngine 3 }
+
+snmpEngineMaxMessageSize OBJECT-TYPE
+    SYNTAX       INTEGER (484..2147483647)
+    MAX-ACCESS   read-only
+    STATUS       current
+    DESCRIPTION "The maximum length in octets of an SNMP message
+                 which this SNMP engine can send or receive and
+                 process, determined as the minimum of the maximum
+                 message size values supported among all of the
+                 transports available to and supported by the engine.
+                "
+    ::= { snmpEngine 4 }
+
+-- Registration Points for Authentication and Privacy Protocols **
+
+snmpAuthProtocols OBJECT-IDENTITY
+    STATUS        current
+    DESCRIPTION  "Registration point for standards-track
+                  authentication protocols used in SNMP Management
+                  Frameworks.
+                 "
+    ::= { snmpFrameworkAdmin 1 }
+
+snmpPrivProtocols OBJECT-IDENTITY
+    STATUS        current
+    DESCRIPTION  "Registration point for standards-track privacy
+                  protocols used in SNMP Management Frameworks.
+                 "
+    ::= { snmpFrameworkAdmin 2 }
+
+-- Conformance information ******************************************
+
+snmpFrameworkMIBCompliances
+               OBJECT IDENTIFIER ::= {snmpFrameworkMIBConformance 1}
+snmpFrameworkMIBGroups
+               OBJECT IDENTIFIER ::= {snmpFrameworkMIBConformance 2}
+
+-- compliance statements
+
+snmpFrameworkMIBCompliance MODULE-COMPLIANCE
+    STATUS       current
+    DESCRIPTION "The compliance statement for SNMP engines which
+                 implement the SNMP Management Framework MIB.
+                "
+    MODULE    -- this module
+        MANDATORY-GROUPS { snmpEngineGroup }
+    ::= { snmpFrameworkMIBCompliances 1 }
+
+-- units of conformance
+
+snmpEngineGroup OBJECT-GROUP
+    OBJECTS {
+              snmpEngineID,
+              snmpEngineBoots,
+              snmpEngineTime,
+              snmpEngineMaxMessageSize
+            }
+    STATUS       current
+    DESCRIPTION "A collection of objects for identifying and
+                 determining the configuration and current timeliness
+
+                 values of an SNMP engine.
+                "
+    ::= { snmpFrameworkMIBGroups 1 }
+
+END
diff -Naur tomato/release/src/router/snmp/mibs/SNMP-MPD-MIB.txt tomato121/release/src/router/snmp/mibs/SNMP-MPD-MIB.txt
--- tomato/release/src/router/snmp/mibs/SNMP-MPD-MIB.txt	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/mibs/SNMP-MPD-MIB.txt	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,145 @@
+SNMP-MPD-MIB DEFINITIONS ::= BEGIN
+
+IMPORTS
+    MODULE-COMPLIANCE, OBJECT-GROUP         FROM SNMPv2-CONF
+    MODULE-IDENTITY, OBJECT-TYPE,
+    snmpModules, Counter32                  FROM SNMPv2-SMI;
+
+snmpMPDMIB MODULE-IDENTITY
+    LAST-UPDATED "200210140000Z"
+    ORGANIZATION "SNMPv3 Working Group"
+    CONTACT-INFO "WG-EMail:   snmpv3@lists.tislabs.com
+                  Subscribe:  snmpv3-request@lists.tislabs.com
+
+                  Co-Chair:   Russ Mundy
+                              Network Associates Laboratories
+                  postal:     15204 Omega Drive, Suite 300
+                              Rockville, MD 20850-4601
+                              USA
+
+                  EMail:      mundy@tislabs.com
+                  phone:      +1 301-947-7107
+
+                  Co-Chair &
+                  Co-editor:  David Harrington
+                              Enterasys Networks
+                  postal:     35 Industrial Way
+                              P. O. Box 5005
+                              Rochester NH 03866-5005
+                              USA
+                  EMail:      dbh@enterasys.com
+                  phone:      +1 603-337-2614
+
+                  Co-editor:  Jeffrey Case
+                              SNMP Research, Inc.
+                  postal:     3001 Kimberlin Heights Road
+                              Knoxville, TN 37920-9716
+                              USA
+                  EMail:      case@snmp.com
+                  phone:      +1 423-573-1434
+
+                  Co-editor:  Randy Presuhn
+                              BMC Software, Inc.
+                  postal:     2141 North First Street
+                              San Jose, CA 95131
+                              USA
+                  EMail:      randy_presuhn@bmc.com
+                  phone:      +1 408-546-1006
+
+                  Co-editor:  Bert Wijnen
+                              Lucent Technologies
+                  postal:     Schagen 33
+                              3461 GL Linschoten
+                              Netherlands
+                  EMail:      bwijnen@lucent.com
+                  phone:      +31 348-680-485
+                 "
+    DESCRIPTION  "The MIB for Message Processing and Dispatching
+
+                  Copyright (C) The Internet Society (2002). This
+                  version of this MIB module is part of RFC 3412;
+                  see the RFC itself for full legal notices.
+                 "
+    REVISION     "200210140000Z"            -- 14 October 2002
+    DESCRIPTION  "Updated addresses, published as RFC 3412."
+    REVISION     "199905041636Z"            -- 4 May 1999
+    DESCRIPTION  "Updated addresses, published as RFC 2572."
+
+    REVISION     "199709300000Z"            -- 30 September 1997
+    DESCRIPTION  "Original version, published as RFC 2272."
+    ::= { snmpModules 11 }
+
+-- Administrative assignments ***************************************
+
+snmpMPDAdmin           OBJECT IDENTIFIER ::= { snmpMPDMIB 1 }
+snmpMPDMIBObjects      OBJECT IDENTIFIER ::= { snmpMPDMIB 2 }
+snmpMPDMIBConformance  OBJECT IDENTIFIER ::= { snmpMPDMIB 3 }
+
+-- Statistics for SNMP Messages *************************************
+
+snmpMPDStats           OBJECT IDENTIFIER ::= { snmpMPDMIBObjects 1 }
+
+snmpUnknownSecurityModels OBJECT-TYPE
+    SYNTAX       Counter32
+    MAX-ACCESS   read-only
+    STATUS       current
+    DESCRIPTION "The total number of packets received by the SNMP
+                 engine which were dropped because they referenced a
+                 securityModel that was not known to or supported by
+                 the SNMP engine.
+                "
+    ::= { snmpMPDStats 1 }
+
+snmpInvalidMsgs OBJECT-TYPE
+    SYNTAX       Counter32
+    MAX-ACCESS   read-only
+    STATUS       current
+    DESCRIPTION "The total number of packets received by the SNMP
+                 engine which were dropped because there were invalid
+                 or inconsistent components in the SNMP message.
+                "
+    ::= { snmpMPDStats 2 }
+
+snmpUnknownPDUHandlers OBJECT-TYPE
+    SYNTAX       Counter32
+    MAX-ACCESS   read-only
+    STATUS       current
+    DESCRIPTION "The total number of packets received by the SNMP
+                 engine which were dropped because the PDU contained
+                 in the packet could not be passed to an application
+                 responsible for handling the pduType, e.g. no SNMP
+                 application had registered for the proper
+                 combination of the contextEngineID and the pduType.
+                "
+    ::= { snmpMPDStats 3 }
+
+-- Conformance information ******************************************
+
+snmpMPDMIBCompliances OBJECT IDENTIFIER ::= {snmpMPDMIBConformance 1}
+snmpMPDMIBGroups      OBJECT IDENTIFIER ::= {snmpMPDMIBConformance 2}
+
+-- Compliance statements
+
+snmpMPDCompliance MODULE-COMPLIANCE
+    STATUS       current
+    DESCRIPTION "The compliance statement for SNMP entities which
+                 implement the SNMP-MPD-MIB.
+                "
+    MODULE    -- this module
+        MANDATORY-GROUPS { snmpMPDGroup }
+    ::= { snmpMPDMIBCompliances 1 }
+
+snmpMPDGroup OBJECT-GROUP
+    OBJECTS {
+              snmpUnknownSecurityModels,
+              snmpInvalidMsgs,
+              snmpUnknownPDUHandlers
+            }
+    STATUS       current
+    DESCRIPTION "A collection of objects providing for remote
+                 monitoring of the SNMP Message Processing and
+                 Dispatching process.
+                "
+    ::= { snmpMPDMIBGroups 1 }
+
+END
diff -Naur tomato/release/src/router/snmp/mibs/SNMP-NOTIFICATION-MIB.txt tomato121/release/src/router/snmp/mibs/SNMP-NOTIFICATION-MIB.txt
--- tomato/release/src/router/snmp/mibs/SNMP-NOTIFICATION-MIB.txt	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/mibs/SNMP-NOTIFICATION-MIB.txt	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,589 @@
+SNMP-NOTIFICATION-MIB DEFINITIONS ::= BEGIN
+
+IMPORTS
+    MODULE-IDENTITY,
+    OBJECT-TYPE,
+    snmpModules
+        FROM SNMPv2-SMI
+
+    RowStatus,
+    StorageType
+        FROM SNMPv2-TC
+
+    SnmpAdminString
+        FROM SNMP-FRAMEWORK-MIB
+
+    SnmpTagValue,
+    snmpTargetParamsName
+        FROM SNMP-TARGET-MIB
+
+    MODULE-COMPLIANCE,
+    OBJECT-GROUP
+        FROM SNMPv2-CONF;
+
+snmpNotificationMIB MODULE-IDENTITY
+    LAST-UPDATED "200210140000Z"
+    ORGANIZATION "IETF SNMPv3 Working Group"
+    CONTACT-INFO
+        "WG-email:   snmpv3@lists.tislabs.com
+         Subscribe:  majordomo@lists.tislabs.com
+                     In message body:  subscribe snmpv3
+
+         Co-Chair:   Russ Mundy
+                     Network Associates Laboratories
+         Postal:     15204 Omega Drive, Suite 300
+                     Rockville, MD 20850-4601
+                     USA
+         EMail:      mundy@tislabs.com
+         Phone:      +1 301-947-7107
+
+         Co-Chair:   David Harrington
+                     Enterasys Networks
+         Postal:     35 Industrial Way
+                     P. O. Box 5004
+                     Rochester, New Hampshire 03866-5005
+                     USA
+         EMail:      dbh@enterasys.com
+         Phone:      +1 603-337-2614
+
+         Co-editor:  David B. Levi
+                     Nortel Networks
+         Postal:     3505 Kesterwood Drive
+                     Knoxville, Tennessee 37918
+         EMail:      dlevi@nortelnetworks.com
+         Phone:      +1 865 686 0432
+
+         Co-editor:  Paul Meyer
+                     Secure Computing Corporation
+         Postal:     2675 Long Lake Road
+                     Roseville, Minnesota 55113
+         EMail:      paul_meyer@securecomputing.com
+         Phone:      +1 651 628 1592
+
+         Co-editor:  Bob Stewart
+                     Retired"
+    DESCRIPTION
+        "This MIB module defines MIB objects which provide
+         mechanisms to remotely configure the parameters
+         used by an SNMP entity for the generation of
+         notifications.
+
+         Copyright (C) The Internet Society (2002). This
+         version of this MIB module is part of RFC 3413;
+         see the RFC itself for full legal notices.
+        "
+    REVISION    "200210140000Z"             -- 14 October 2002
+    DESCRIPTION "Clarifications, published as
+                 RFC 3413."
+    REVISION    "199808040000Z"             -- 4 August 1998
+    DESCRIPTION "Clarifications, published as
+                 RFC 2573."
+    REVISION    "199707140000Z"             -- 14 July 1997
+    DESCRIPTION "The initial revision, published as RFC2273."
+    ::= { snmpModules 13 }
+
+snmpNotifyObjects       OBJECT IDENTIFIER ::=
+                                          { snmpNotificationMIB 1 }
+snmpNotifyConformance   OBJECT IDENTIFIER ::=
+                                          { snmpNotificationMIB 3 }
+
+--
+--
+-- The snmpNotifyObjects group
+--
+--
+
+snmpNotifyTable OBJECT-TYPE
+    SYNTAX      SEQUENCE OF SnmpNotifyEntry
+    MAX-ACCESS  not-accessible
+    STATUS      current
+    DESCRIPTION
+        "This table is used to select management targets which should
+         receive notifications, as well as the type of notification
+         which should be sent to each selected management target."
+    ::= { snmpNotifyObjects 1 }
+
+snmpNotifyEntry OBJECT-TYPE
+    SYNTAX      SnmpNotifyEntry
+    MAX-ACCESS  not-accessible
+    STATUS      current
+    DESCRIPTION
+        "An entry in this table selects a set of management targets
+         which should receive notifications, as well as the type of
+
+         notification which should be sent to each selected
+         management target.
+
+         Entries in the snmpNotifyTable are created and
+         deleted using the snmpNotifyRowStatus object."
+    INDEX { IMPLIED snmpNotifyName }
+    ::= { snmpNotifyTable 1 }
+
+SnmpNotifyEntry ::= SEQUENCE {
+    snmpNotifyName         SnmpAdminString,
+    snmpNotifyTag          SnmpTagValue,
+    snmpNotifyType         INTEGER,
+    snmpNotifyStorageType  StorageType,
+    snmpNotifyRowStatus    RowStatus
+}
+
+snmpNotifyName OBJECT-TYPE
+    SYNTAX      SnmpAdminString (SIZE(1..32))
+    MAX-ACCESS  not-accessible
+    STATUS      current
+    DESCRIPTION
+        "The locally arbitrary, but unique identifier associated
+         with this snmpNotifyEntry."
+    ::= { snmpNotifyEntry 1 }
+
+snmpNotifyTag OBJECT-TYPE
+    SYNTAX      SnmpTagValue
+    MAX-ACCESS  read-create
+    STATUS      current
+    DESCRIPTION
+        "This object contains a single tag value which is used
+         to select entries in the snmpTargetAddrTable.  Any entry
+         in the snmpTargetAddrTable which contains a tag value
+         which is equal to the value of an instance of this
+         object is selected.  If this object contains a value
+         of zero length, no entries are selected."
+    DEFVAL { "" }
+    ::= { snmpNotifyEntry 2 }
+
+snmpNotifyType OBJECT-TYPE
+    SYNTAX      INTEGER {
+                    trap(1),
+                    inform(2)
+                }
+    MAX-ACCESS  read-create
+    STATUS      current
+    DESCRIPTION
+        "This object determines the type of notification to
+
+         be generated for entries in the snmpTargetAddrTable
+         selected by the corresponding instance of
+         snmpNotifyTag.  This value is only used when
+         generating notifications, and is ignored when
+         using the snmpTargetAddrTable for other purposes.
+
+         If the value of this object is trap(1), then any
+         messages generated for selected rows will contain
+         Unconfirmed-Class PDUs.
+
+         If the value of this object is inform(2), then any
+         messages generated for selected rows will contain
+         Confirmed-Class PDUs.
+
+         Note that if an SNMP entity only supports
+         generation of Unconfirmed-Class PDUs (and not
+         Confirmed-Class PDUs), then this object may be
+         read-only."
+    DEFVAL { trap }
+    ::= { snmpNotifyEntry 3 }
+
+snmpNotifyStorageType OBJECT-TYPE
+    SYNTAX      StorageType
+    MAX-ACCESS  read-create
+    STATUS      current
+    DESCRIPTION
+        "The storage type for this conceptual row.
+         Conceptual rows having the value 'permanent' need not
+         allow write-access to any columnar objects in the row."
+    DEFVAL { nonVolatile }
+    ::= { snmpNotifyEntry 4 }
+
+snmpNotifyRowStatus OBJECT-TYPE
+    SYNTAX      RowStatus
+    MAX-ACCESS  read-create
+    STATUS      current
+    DESCRIPTION
+        "The status of this conceptual row.
+
+         To create a row in this table, a manager must
+         set this object to either createAndGo(4) or
+         createAndWait(5)."
+    ::= { snmpNotifyEntry 5 }
+
+snmpNotifyFilterProfileTable OBJECT-TYPE
+    SYNTAX      SEQUENCE OF SnmpNotifyFilterProfileEntry
+    MAX-ACCESS  not-accessible
+    STATUS      current
+    DESCRIPTION
+        "This table is used to associate a notification filter
+         profile with a particular set of target parameters."
+    ::= { snmpNotifyObjects 2 }
+
+snmpNotifyFilterProfileEntry OBJECT-TYPE
+    SYNTAX      SnmpNotifyFilterProfileEntry
+    MAX-ACCESS  not-accessible
+    STATUS      current
+    DESCRIPTION
+        "An entry in this table indicates the name of the filter
+         profile to be used when generating notifications using
+         the corresponding entry in the snmpTargetParamsTable.
+
+         Entries in the snmpNotifyFilterProfileTable are created
+         and deleted using the snmpNotifyFilterProfileRowStatus
+         object."
+    INDEX { IMPLIED snmpTargetParamsName }
+    ::= { snmpNotifyFilterProfileTable 1 }
+
+SnmpNotifyFilterProfileEntry ::= SEQUENCE {
+    snmpNotifyFilterProfileName         SnmpAdminString,
+    snmpNotifyFilterProfileStorType     StorageType,
+    snmpNotifyFilterProfileRowStatus    RowStatus
+}
+
+snmpNotifyFilterProfileName OBJECT-TYPE
+    SYNTAX      SnmpAdminString (SIZE(1..32))
+    MAX-ACCESS  read-create
+    STATUS      current
+    DESCRIPTION
+        "The name of the filter profile to be used when generating
+         notifications using the corresponding entry in the
+         snmpTargetAddrTable."
+    ::= { snmpNotifyFilterProfileEntry 1 }
+
+snmpNotifyFilterProfileStorType OBJECT-TYPE
+    SYNTAX      StorageType
+    MAX-ACCESS  read-create
+    STATUS      current
+    DESCRIPTION
+        "The storage type for this conceptual row.
+         Conceptual rows having the value 'permanent' need not
+         allow write-access to any columnar objects in the row."
+    DEFVAL { nonVolatile }
+    ::= { snmpNotifyFilterProfileEntry 2 }
+
+snmpNotifyFilterProfileRowStatus OBJECT-TYPE
+    SYNTAX      RowStatus
+    MAX-ACCESS  read-create
+    STATUS      current
+    DESCRIPTION
+        "The status of this conceptual row.
+
+         To create a row in this table, a manager must
+         set this object to either createAndGo(4) or
+         createAndWait(5).
+
+         Until instances of all corresponding columns are
+         appropriately configured, the value of the
+         corresponding instance of the
+         snmpNotifyFilterProfileRowStatus column is 'notReady'.
+
+         In particular, a newly created row cannot be made
+         active until the corresponding instance of
+         snmpNotifyFilterProfileName has been set."
+    ::= { snmpNotifyFilterProfileEntry 3 }
+
+snmpNotifyFilterTable OBJECT-TYPE
+    SYNTAX      SEQUENCE OF SnmpNotifyFilterEntry
+    MAX-ACCESS  not-accessible
+    STATUS      current
+    DESCRIPTION
+        "The table of filter profiles.  Filter profiles are used
+         to determine whether particular management targets should
+         receive particular notifications.
+
+         When a notification is generated, it must be compared
+         with the filters associated with each management target
+         which is configured to receive notifications, in order to
+         determine whether it may be sent to each such management
+         target.
+
+         A more complete discussion of notification filtering
+         can be found in section 6. of [SNMP-APPL]."
+    ::= { snmpNotifyObjects 3 }
+
+snmpNotifyFilterEntry OBJECT-TYPE
+    SYNTAX      SnmpNotifyFilterEntry
+    MAX-ACCESS  not-accessible
+    STATUS      current
+    DESCRIPTION
+        "An element of a filter profile.
+
+         Entries in the snmpNotifyFilterTable are created and
+         deleted using the snmpNotifyFilterRowStatus object."
+    INDEX {         snmpNotifyFilterProfileName,
+            IMPLIED snmpNotifyFilterSubtree }
+    ::= { snmpNotifyFilterTable 1 }
+
+SnmpNotifyFilterEntry ::= SEQUENCE {
+    snmpNotifyFilterSubtree           OBJECT IDENTIFIER,
+    snmpNotifyFilterMask              OCTET STRING,
+    snmpNotifyFilterType              INTEGER,
+    snmpNotifyFilterStorageType       StorageType,
+    snmpNotifyFilterRowStatus         RowStatus
+}
+
+snmpNotifyFilterSubtree OBJECT-TYPE
+    SYNTAX      OBJECT IDENTIFIER
+    MAX-ACCESS  not-accessible
+    STATUS      current
+    DESCRIPTION
+        "The MIB subtree which, when combined with the corresponding
+         instance of snmpNotifyFilterMask, defines a family of
+         subtrees which are included in or excluded from the
+         filter profile."
+    ::= { snmpNotifyFilterEntry 1 }
+
+snmpNotifyFilterMask OBJECT-TYPE
+    SYNTAX      OCTET STRING (SIZE(0..16))
+    MAX-ACCESS  read-create
+    STATUS      current
+    DESCRIPTION
+        "The bit mask which, in combination with the corresponding
+         instance of snmpNotifyFilterSubtree, defines a family of
+         subtrees which are included in or excluded from the
+         filter profile.
+
+         Each bit of this bit mask corresponds to a
+         sub-identifier of snmpNotifyFilterSubtree, with the
+         most significant bit of the i-th octet of this octet
+         string value (extended if necessary, see below)
+         corresponding to the (8*i - 7)-th sub-identifier, and
+         the least significant bit of the i-th octet of this
+         octet string corresponding to the (8*i)-th
+         sub-identifier, where i is in the range 1 through 16.
+
+         Each bit of this bit mask specifies whether or not
+         the corresponding sub-identifiers must match when
+         determining if an OBJECT IDENTIFIER matches this
+         family of filter subtrees; a '1' indicates that an
+         exact match must occur; a '0' indicates 'wild card',
+         i.e., any sub-identifier value matches.
+
+         Thus, the OBJECT IDENTIFIER X of an object instance
+         is contained in a family of filter subtrees if, for
+         each sub-identifier of the value of
+         snmpNotifyFilterSubtree, either:
+
+           the i-th bit of snmpNotifyFilterMask is 0, or
+
+           the i-th sub-identifier of X is equal to the i-th
+           sub-identifier of the value of
+           snmpNotifyFilterSubtree.
+
+         If the value of this bit mask is M bits long and
+         there are more than M sub-identifiers in the
+         corresponding instance of snmpNotifyFilterSubtree,
+         then the bit mask is extended with 1's to be the
+         required length.
+
+         Note that when the value of this object is the
+         zero-length string, this extension rule results in
+         a mask of all-1's being used (i.e., no 'wild card'),
+         and the family of filter subtrees is the one
+         subtree uniquely identified by the corresponding
+         instance of snmpNotifyFilterSubtree."
+    DEFVAL { ''H }
+    ::= { snmpNotifyFilterEntry 2 }
+
+snmpNotifyFilterType OBJECT-TYPE
+    SYNTAX      INTEGER {
+                    included(1),
+                    excluded(2)
+                }
+    MAX-ACCESS  read-create
+    STATUS      current
+    DESCRIPTION
+        "This object indicates whether the family of filter subtrees
+         defined by this entry are included in or excluded from a
+         filter.  A more detailed discussion of the use of this
+         object can be found in section 6. of [SNMP-APPL]."
+    DEFVAL { included }
+    ::= { snmpNotifyFilterEntry 3 }
+
+snmpNotifyFilterStorageType OBJECT-TYPE
+    SYNTAX      StorageType
+    MAX-ACCESS  read-create
+    STATUS      current
+    DESCRIPTION
+        "The storage type for this conceptual row.
+         Conceptual rows having the value 'permanent' need not
+
+         allow write-access to any columnar objects in the row."
+    DEFVAL { nonVolatile }
+    ::= { snmpNotifyFilterEntry 4 }
+
+snmpNotifyFilterRowStatus OBJECT-TYPE
+    SYNTAX      RowStatus
+    MAX-ACCESS  read-create
+    STATUS      current
+    DESCRIPTION
+        "The status of this conceptual row.
+
+         To create a row in this table, a manager must
+         set this object to either createAndGo(4) or
+         createAndWait(5)."
+    ::= { snmpNotifyFilterEntry 5 }
+
+--
+--
+-- Conformance information
+--
+--
+
+snmpNotifyCompliances OBJECT IDENTIFIER ::=
+                                        { snmpNotifyConformance 1 }
+snmpNotifyGroups      OBJECT IDENTIFIER ::=
+                                        { snmpNotifyConformance 2 }
+
+--
+--
+-- Compliance statements
+--
+--
+
+snmpNotifyBasicCompliance MODULE-COMPLIANCE
+    STATUS      current
+    DESCRIPTION
+        "The compliance statement for minimal SNMP entities which
+         implement only SNMP Unconfirmed-Class notifications and
+         read-create operations on only the snmpTargetAddrTable."
+    MODULE SNMP-TARGET-MIB
+        MANDATORY-GROUPS { snmpTargetBasicGroup }
+
+        OBJECT snmpTargetParamsMPModel
+        MIN-ACCESS    read-only
+        DESCRIPTION
+            "Create/delete/modify access is not required."
+
+        OBJECT snmpTargetParamsSecurityModel
+        MIN-ACCESS    read-only
+        DESCRIPTION
+            "Create/delete/modify access is not required."
+
+        OBJECT snmpTargetParamsSecurityName
+        MIN-ACCESS    read-only
+        DESCRIPTION
+            "Create/delete/modify access is not required."
+
+        OBJECT snmpTargetParamsSecurityLevel
+        MIN-ACCESS    read-only
+        DESCRIPTION
+            "Create/delete/modify access is not required."
+
+        OBJECT snmpTargetParamsStorageType
+        SYNTAX INTEGER {
+            readOnly(5)
+        }
+        MIN-ACCESS    read-only
+        DESCRIPTION
+            "Create/delete/modify access is not required.
+             Support of the values other(1), volatile(2),
+             nonVolatile(3), and permanent(4) is not required."
+
+        OBJECT snmpTargetParamsRowStatus
+        SYNTAX INTEGER {
+            active(1)
+        }
+        MIN-ACCESS    read-only
+        DESCRIPTION
+            "Create/delete/modify access to the
+             snmpTargetParamsTable is not required.
+             Support of the values notInService(2), notReady(3),
+             createAndGo(4), createAndWait(5), and destroy(6) is
+             not required."
+
+    MODULE -- This Module
+        MANDATORY-GROUPS { snmpNotifyGroup }
+
+        OBJECT snmpNotifyTag
+        MIN-ACCESS    read-only
+        DESCRIPTION
+            "Create/delete/modify access is not required."
+
+        OBJECT snmpNotifyType
+        SYNTAX INTEGER {
+            trap(1)
+        }
+        MIN-ACCESS    read-only
+        DESCRIPTION
+            "Create/delete/modify access is not required.
+             Support of the value notify(2) is not required."
+
+        OBJECT snmpNotifyStorageType
+        SYNTAX INTEGER {
+            readOnly(5)
+        }
+        MIN-ACCESS    read-only
+        DESCRIPTION
+            "Create/delete/modify access is not required.
+             Support of the values other(1), volatile(2),
+             nonVolatile(3), and permanent(4) is not required."
+
+        OBJECT snmpNotifyRowStatus
+        SYNTAX INTEGER {
+            active(1)
+        }
+        MIN-ACCESS    read-only
+        DESCRIPTION
+            "Create/delete/modify access to the
+             snmpNotifyTable is not required.
+             Support of the values notInService(2), notReady(3),
+             createAndGo(4), createAndWait(5), and destroy(6) is
+             not required."
+    ::= { snmpNotifyCompliances 1 }
+
+snmpNotifyBasicFiltersCompliance MODULE-COMPLIANCE
+    STATUS      current
+    DESCRIPTION
+        "The compliance statement for SNMP entities which implement
+         SNMP Unconfirmed-Class notifications with filtering, and
+         read-create operations on all related tables."
+    MODULE SNMP-TARGET-MIB
+        MANDATORY-GROUPS { snmpTargetBasicGroup }
+    MODULE -- This Module
+        MANDATORY-GROUPS { snmpNotifyGroup,
+                           snmpNotifyFilterGroup }
+    ::= { snmpNotifyCompliances 2 }
+
+snmpNotifyFullCompliance MODULE-COMPLIANCE
+    STATUS      current
+    DESCRIPTION
+        "The compliance statement for SNMP entities which either
+         implement only SNMP Confirmed-Class notifications, or both
+         SNMP Unconfirmed-Class and Confirmed-Class notifications,
+         plus filtering and read-create operations on all related
+         tables."
+    MODULE SNMP-TARGET-MIB
+        MANDATORY-GROUPS { snmpTargetBasicGroup,
+                           snmpTargetResponseGroup }
+    MODULE -- This Module
+        MANDATORY-GROUPS { snmpNotifyGroup,
+                           snmpNotifyFilterGroup }
+    ::= { snmpNotifyCompliances 3 }
+
+snmpNotifyGroup OBJECT-GROUP
+    OBJECTS {
+        snmpNotifyTag,
+        snmpNotifyType,
+        snmpNotifyStorageType,
+        snmpNotifyRowStatus
+    }
+    STATUS      current
+    DESCRIPTION
+        "A collection of objects for selecting which management
+         targets are used for generating notifications, and the
+         type of notification to be generated for each selected
+         management target."
+    ::= { snmpNotifyGroups 1 }
+
+snmpNotifyFilterGroup OBJECT-GROUP
+    OBJECTS {
+        snmpNotifyFilterProfileName,
+        snmpNotifyFilterProfileStorType,
+        snmpNotifyFilterProfileRowStatus,
+        snmpNotifyFilterMask,
+        snmpNotifyFilterType,
+        snmpNotifyFilterStorageType,
+        snmpNotifyFilterRowStatus
+    }
+    STATUS      current
+    DESCRIPTION
+        "A collection of objects providing remote configuration
+         of notification filters."
+    ::= { snmpNotifyGroups 2 }
+
+END
diff -Naur tomato/release/src/router/snmp/mibs/SNMP-PROXY-MIB.txt tomato121/release/src/router/snmp/mibs/SNMP-PROXY-MIB.txt
--- tomato/release/src/router/snmp/mibs/SNMP-PROXY-MIB.txt	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/mibs/SNMP-PROXY-MIB.txt	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,294 @@
+SNMP-PROXY-MIB DEFINITIONS ::= BEGIN
+
+IMPORTS
+    MODULE-IDENTITY,
+    OBJECT-TYPE,
+    snmpModules
+        FROM SNMPv2-SMI
+
+    RowStatus,
+    StorageType
+        FROM SNMPv2-TC
+
+    SnmpEngineID,
+    SnmpAdminString
+        FROM SNMP-FRAMEWORK-MIB
+
+    SnmpTagValue
+        FROM SNMP-TARGET-MIB
+
+    MODULE-COMPLIANCE,
+    OBJECT-GROUP
+        FROM SNMPv2-CONF;
+
+snmpProxyMIB MODULE-IDENTITY
+    LAST-UPDATED "200210140000Z"
+    ORGANIZATION "IETF SNMPv3 Working Group"
+    CONTACT-INFO
+        "WG-email:   snmpv3@lists.tislabs.com
+         Subscribe:  majordomo@lists.tislabs.com
+                     In message body:  subscribe snmpv3
+
+         Co-Chair:   Russ Mundy
+                     Network Associates Laboratories
+         Postal:     15204 Omega Drive, Suite 300
+                     Rockville, MD 20850-4601
+                     USA
+         EMail:      mundy@tislabs.com
+         Phone:      +1 301-947-7107
+
+         Co-Chair:   David Harrington
+                     Enterasys Networks
+         Postal:     35 Industrial Way
+                     P. O. Box 5004
+                     Rochester, New Hampshire 03866-5005
+                     USA
+         EMail:      dbh@enterasys.com
+         Phone:      +1 603-337-2614
+
+         Co-editor:  David B. Levi
+                     Nortel Networks
+         Postal:     3505 Kesterwood Drive
+                     Knoxville, Tennessee 37918
+         EMail:      dlevi@nortelnetworks.com
+         Phone:      +1 865 686 0432
+
+         Co-editor:  Paul Meyer
+                     Secure Computing Corporation
+         Postal:     2675 Long Lake Road
+                     Roseville, Minnesota 55113
+         EMail:      paul_meyer@securecomputing.com
+         Phone:      +1 651 628 1592
+
+         Co-editor:  Bob Stewart
+                     Retired"
+    DESCRIPTION
+        "This MIB module defines MIB objects which provide
+         mechanisms to remotely configure the parameters
+         used by a proxy forwarding application.
+
+         Copyright (C) The Internet Society (2002). This
+         version of this MIB module is part of RFC 3413;
+         see the RFC itself for full legal notices.
+        "
+    REVISION    "200210140000Z"             -- 14 October 2002
+    DESCRIPTION "Clarifications, published as
+                 RFC 3413."
+    REVISION    "199808040000Z"             -- 4 August 1998
+    DESCRIPTION "Clarifications, published as
+                 RFC 2573."
+    REVISION    "199707140000Z"             -- 14 July 1997
+    DESCRIPTION "The initial revision, published as RFC2273."
+    ::= { snmpModules 14 }
+
+snmpProxyObjects        OBJECT IDENTIFIER ::= { snmpProxyMIB 1 }
+snmpProxyConformance    OBJECT IDENTIFIER ::= { snmpProxyMIB 3 }
+
+--
+
+--
+-- The snmpProxyObjects group
+--
+--
+
+snmpProxyTable OBJECT-TYPE
+    SYNTAX      SEQUENCE OF SnmpProxyEntry
+    MAX-ACCESS  not-accessible
+    STATUS      current
+    DESCRIPTION
+        "The table of translation parameters used by proxy forwarder
+         applications for forwarding SNMP messages."
+    ::= { snmpProxyObjects 2 }
+
+snmpProxyEntry OBJECT-TYPE
+    SYNTAX      SnmpProxyEntry
+    MAX-ACCESS  not-accessible
+    STATUS      current
+    DESCRIPTION
+        "A set of translation parameters used by a proxy forwarder
+         application for forwarding SNMP messages.
+
+         Entries in the snmpProxyTable are created and deleted
+         using the snmpProxyRowStatus object."
+    INDEX { IMPLIED snmpProxyName }
+    ::= { snmpProxyTable 1 }
+
+SnmpProxyEntry ::= SEQUENCE {
+    snmpProxyName               SnmpAdminString,
+    snmpProxyType               INTEGER,
+    snmpProxyContextEngineID    SnmpEngineID,
+    snmpProxyContextName        SnmpAdminString,
+    snmpProxyTargetParamsIn     SnmpAdminString,
+    snmpProxySingleTargetOut    SnmpAdminString,
+    snmpProxyMultipleTargetOut  SnmpTagValue,
+    snmpProxyStorageType        StorageType,
+    snmpProxyRowStatus          RowStatus
+}
+
+snmpProxyName OBJECT-TYPE
+    SYNTAX      SnmpAdminString (SIZE(1..32))
+    MAX-ACCESS  not-accessible
+    STATUS      current
+    DESCRIPTION
+        "The locally arbitrary, but unique identifier associated
+         with this snmpProxyEntry."
+    ::= { snmpProxyEntry 1 }
+
+snmpProxyType OBJECT-TYPE
+    SYNTAX      INTEGER {
+                    read(1),
+                    write(2),
+                    trap(3),
+                    inform(4)
+                }
+    MAX-ACCESS  read-create
+    STATUS      current
+    DESCRIPTION
+        "The type of message that may be forwarded using
+         the translation parameters defined by this entry."
+    ::= { snmpProxyEntry 2 }
+
+snmpProxyContextEngineID OBJECT-TYPE
+    SYNTAX      SnmpEngineID
+    MAX-ACCESS  read-create
+    STATUS      current
+    DESCRIPTION
+        "The contextEngineID contained in messages that
+         may be forwarded using the translation parameters
+         defined by this entry."
+    ::= { snmpProxyEntry 3 }
+
+snmpProxyContextName OBJECT-TYPE
+    SYNTAX      SnmpAdminString
+    MAX-ACCESS  read-create
+    STATUS      current
+    DESCRIPTION
+        "The contextName contained in messages that may be
+         forwarded using the translation parameters defined
+         by this entry.
+
+         This object is optional, and if not supported, the
+         contextName contained in a message is ignored when
+         selecting an entry in the snmpProxyTable."
+    ::= { snmpProxyEntry 4 }
+
+snmpProxyTargetParamsIn OBJECT-TYPE
+    SYNTAX      SnmpAdminString
+    MAX-ACCESS  read-create
+    STATUS      current
+    DESCRIPTION
+        "This object selects an entry in the snmpTargetParamsTable.
+         The selected entry is used to determine which row of the
+         snmpProxyTable to use for forwarding received messages."
+    ::= { snmpProxyEntry 5 }
+
+snmpProxySingleTargetOut OBJECT-TYPE
+    SYNTAX      SnmpAdminString
+    MAX-ACCESS  read-create
+    STATUS      current
+    DESCRIPTION
+        "This object selects a management target defined in the
+         snmpTargetAddrTable (in the SNMP-TARGET-MIB).  The
+         selected target is defined by an entry in the
+         snmpTargetAddrTable whose index value (snmpTargetAddrName)
+         is equal to this object.
+
+         This object is only used when selection of a single
+         target is required (i.e. when forwarding an incoming
+         read or write request)."
+    ::= { snmpProxyEntry 6 }
+
+snmpProxyMultipleTargetOut OBJECT-TYPE
+    SYNTAX      SnmpTagValue
+    MAX-ACCESS  read-create
+    STATUS      current
+    DESCRIPTION
+        "This object selects a set of management targets defined
+         in the snmpTargetAddrTable (in the SNMP-TARGET-MIB).
+
+         This object is only used when selection of multiple
+         targets is required (i.e. when forwarding an incoming
+         notification)."
+    ::= { snmpProxyEntry 7 }
+
+snmpProxyStorageType OBJECT-TYPE
+    SYNTAX      StorageType
+    MAX-ACCESS  read-create
+    STATUS      current
+    DESCRIPTION
+        "The storage type of this conceptual row.
+         Conceptual rows having the value 'permanent' need not
+         allow write-access to any columnar objects in the row."
+    DEFVAL { nonVolatile }
+    ::= { snmpProxyEntry 8 }
+
+snmpProxyRowStatus OBJECT-TYPE
+    SYNTAX      RowStatus
+    MAX-ACCESS  read-create
+    STATUS      current
+    DESCRIPTION
+        "The status of this conceptual row.
+
+         To create a row in this table, a manager must
+
+         set this object to either createAndGo(4) or
+         createAndWait(5).
+
+         The following objects may not be modified while the
+         value of this object is active(1):
+             - snmpProxyType
+             - snmpProxyContextEngineID
+             - snmpProxyContextName
+             - snmpProxyTargetParamsIn
+             - snmpProxySingleTargetOut
+             - snmpProxyMultipleTargetOut"
+    ::= { snmpProxyEntry 9 }
+
+--
+--
+-- Conformance information
+--
+--
+
+snmpProxyCompliances OBJECT IDENTIFIER ::=
+                                         { snmpProxyConformance 1 }
+snmpProxyGroups      OBJECT IDENTIFIER ::=
+                                         { snmpProxyConformance 2 }
+
+--
+--
+-- Compliance statements
+--
+--
+
+snmpProxyCompliance MODULE-COMPLIANCE
+    STATUS      current
+    DESCRIPTION
+        "The compliance statement for SNMP entities which include
+         a proxy forwarding application."
+    MODULE SNMP-TARGET-MIB
+        MANDATORY-GROUPS { snmpTargetBasicGroup,
+                           snmpTargetResponseGroup }
+    MODULE -- This Module
+        MANDATORY-GROUPS { snmpProxyGroup }
+    ::= { snmpProxyCompliances 1 }
+
+snmpProxyGroup OBJECT-GROUP
+    OBJECTS {
+        snmpProxyType,
+        snmpProxyContextEngineID,
+        snmpProxyContextName,
+        snmpProxyTargetParamsIn,
+        snmpProxySingleTargetOut,
+        snmpProxyMultipleTargetOut,
+        snmpProxyStorageType,
+        snmpProxyRowStatus
+    }
+    STATUS      current
+    DESCRIPTION
+        "A collection of objects providing remote configuration of
+         management target translation parameters for use by
+         proxy forwarder applications."
+    ::= { snmpProxyGroups 3 }
+
+END
diff -Naur tomato/release/src/router/snmp/mibs/SNMP-TARGET-MIB.txt tomato121/release/src/router/snmp/mibs/SNMP-TARGET-MIB.txt
--- tomato/release/src/router/snmp/mibs/SNMP-TARGET-MIB.txt	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/mibs/SNMP-TARGET-MIB.txt	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,660 @@
+SNMP-TARGET-MIB DEFINITIONS ::= BEGIN
+
+IMPORTS
+    MODULE-IDENTITY,
+    OBJECT-TYPE,
+    snmpModules,
+    Counter32,
+    Integer32
+        FROM SNMPv2-SMI
+
+    TEXTUAL-CONVENTION,
+    TDomain,
+    TAddress,
+    TimeInterval,
+    RowStatus,
+    StorageType,
+    TestAndIncr
+        FROM SNMPv2-TC
+
+    SnmpSecurityModel,
+    SnmpMessageProcessingModel,
+    SnmpSecurityLevel,
+    SnmpAdminString
+        FROM SNMP-FRAMEWORK-MIB
+
+    MODULE-COMPLIANCE,
+    OBJECT-GROUP
+        FROM SNMPv2-CONF;
+
+snmpTargetMIB MODULE-IDENTITY
+    LAST-UPDATED "200210140000Z"
+    ORGANIZATION "IETF SNMPv3 Working Group"
+    CONTACT-INFO
+        "WG-email:   snmpv3@lists.tislabs.com
+         Subscribe:  majordomo@lists.tislabs.com
+                     In message body:  subscribe snmpv3
+
+         Co-Chair:   Russ Mundy
+                     Network Associates Laboratories
+         Postal:     15204 Omega Drive, Suite 300
+                     Rockville, MD 20850-4601
+                     USA
+         EMail:      mundy@tislabs.com
+         Phone:      +1 301-947-7107
+
+         Co-Chair:   David Harrington
+                     Enterasys Networks
+         Postal:     35 Industrial Way
+                     P. O. Box 5004
+                     Rochester, New Hampshire 03866-5005
+                     USA
+         EMail:      dbh@enterasys.com
+         Phone:      +1 603-337-2614
+
+         Co-editor:  David B. Levi
+                     Nortel Networks
+         Postal:     3505 Kesterwood Drive
+                     Knoxville, Tennessee 37918
+         EMail:      dlevi@nortelnetworks.com
+         Phone:      +1 865 686 0432
+
+         Co-editor:  Paul Meyer
+                     Secure Computing Corporation
+         Postal:     2675 Long Lake Road
+
+                     Roseville, Minnesota 55113
+         EMail:      paul_meyer@securecomputing.com
+         Phone:      +1 651 628 1592
+
+         Co-editor:  Bob Stewart
+                     Retired"
+    DESCRIPTION
+        "This MIB module defines MIB objects which provide
+         mechanisms to remotely configure the parameters used
+         by an SNMP entity for the generation of SNMP messages.
+
+         Copyright (C) The Internet Society (2002). This
+         version of this MIB module is part of RFC 3413;
+         see the RFC itself for full legal notices.
+        "
+    REVISION    "200210140000Z"             -- 14 October 2002
+    DESCRIPTION "Fixed DISPLAY-HINTS for UTF-8 strings, fixed hex
+                 value of LF characters, clarified meaning of zero
+                 length tag values, improved tag list examples.
+                 Published as RFC 3413."
+    REVISION    "199808040000Z"             -- 4 August 1998
+    DESCRIPTION "Clarifications, published as
+                 RFC 2573."
+    REVISION    "199707140000Z"             -- 14 July 1997
+    DESCRIPTION "The initial revision, published as RFC2273."
+    ::= { snmpModules 12 }
+
+snmpTargetObjects       OBJECT IDENTIFIER ::= { snmpTargetMIB 1 }
+snmpTargetConformance   OBJECT IDENTIFIER ::= { snmpTargetMIB 3 }
+
+SnmpTagValue ::= TEXTUAL-CONVENTION
+    DISPLAY-HINT "255t"
+    STATUS       current
+    DESCRIPTION
+        "An octet string containing a tag value.
+         Tag values are preferably in human-readable form.
+
+         To facilitate internationalization, this information
+         is represented using the ISO/IEC IS 10646-1 character
+         set, encoded as an octet string using the UTF-8
+         character encoding scheme described in RFC 2279.
+
+         Since additional code points are added by amendments
+         to the 10646 standard from time to time,
+         implementations must be prepared to encounter any code
+         point from 0x00000000 to 0x7fffffff.
+
+         The use of control codes should be avoided, and certain
+
+         control codes are not allowed as described below.
+
+         For code points not directly supported by user
+         interface hardware or software, an alternative means
+         of entry and display, such as hexadecimal, may be
+         provided.
+
+         For information encoded in 7-bit US-ASCII, the UTF-8
+         representation is identical to the US-ASCII encoding.
+
+         Note that when this TC is used for an object that
+         is used or envisioned to be used as an index, then a
+         SIZE restriction must be specified so that the number
+         of sub-identifiers for any object instance does not
+         exceed the limit of 128, as defined by [RFC1905].
+
+         An object of this type contains a single tag value
+         which is used to select a set of entries in a table.
+
+         A tag value is an arbitrary string of octets, but
+         may not contain a delimiter character.  Delimiter
+         characters are defined to be one of the following:
+
+             -  An ASCII space character (0x20).
+
+             -  An ASCII TAB character (0x09).
+
+             -  An ASCII carriage return (CR) character (0x0D).
+
+             -  An ASCII line feed (LF) character (0x0A).
+
+         Delimiter characters are used to separate tag values
+         in a tag list.  An object of this type may only
+         contain a single tag value, and so delimiter
+         characters are not allowed in a value of this type.
+
+         Note that a tag value of 0 length means that no tag is
+         defined.  In other words, a tag value of 0 length would
+         never match anything in a tag list, and would never
+         select any table entries.
+
+         Some examples of valid tag values are:
+
+             - 'acme'
+
+             - 'router'
+
+             - 'host'
+
+         The use of a tag value to select table entries is
+         application and MIB specific."
+    SYNTAX       OCTET STRING (SIZE (0..255))
+
+SnmpTagList ::= TEXTUAL-CONVENTION
+    DISPLAY-HINT "255t"
+    STATUS       current
+    DESCRIPTION
+        "An octet string containing a list of tag values.
+         Tag values are preferably in human-readable form.
+
+         To facilitate internationalization, this information
+         is represented using the ISO/IEC IS 10646-1 character
+         set, encoded as an octet string using the UTF-8
+         character encoding scheme described in RFC 2279.
+
+         Since additional code points are added by amendments
+         to the 10646 standard from time to time,
+         implementations must be prepared to encounter any code
+         point from 0x00000000 to 0x7fffffff.
+
+         The use of control codes should be avoided, except as
+         described below.
+
+         For code points not directly supported by user
+         interface hardware or software, an alternative means
+         of entry and display, such as hexadecimal, may be
+         provided.
+
+         For information encoded in 7-bit US-ASCII, the UTF-8
+         representation is identical to the US-ASCII encoding.
+
+         An object of this type contains a list of tag values
+         which are used to select a set of entries in a table.
+
+         A tag value is an arbitrary string of octets, but
+         may not contain a delimiter character.  Delimiter
+         characters are defined to be one of the following:
+
+             -  An ASCII space character (0x20).
+
+             -  An ASCII TAB character (0x09).
+
+             -  An ASCII carriage return (CR) character (0x0D).
+
+             -  An ASCII line feed (LF) character (0x0A).
+
+         Delimiter characters are used to separate tag values
+
+         in a tag list.  Only a single delimiter character may
+         occur between two tag values.  A tag value may not
+         have a zero length.  These constraints imply certain
+         restrictions on the contents of this object:
+
+             - There cannot be a leading or trailing delimiter
+               character.
+
+             - There cannot be multiple adjacent delimiter
+               characters.
+
+         Some examples of valid tag lists are:
+
+             - ''                        -- an empty list
+
+             - 'acme'                    -- list of one tag
+
+             - 'host router bridge'      -- list of several tags
+
+         Note that although a tag value may not have a length of
+         zero, an empty string is still valid.  This indicates
+         an empty list (i.e. there are no tag values in the list).
+
+         The use of the tag list to select table entries is
+         application and MIB specific.  Typically, an application
+         will provide one or more tag values, and any entry
+         which contains some combination of these tag values
+         will be selected."
+    SYNTAX       OCTET STRING (SIZE (0..255))
+
+--
+--
+-- The snmpTargetObjects group
+--
+--
+
+snmpTargetSpinLock OBJECT-TYPE
+    SYNTAX      TestAndIncr
+    MAX-ACCESS  read-write
+    STATUS      current
+    DESCRIPTION
+        "This object is used to facilitate modification of table
+         entries in the SNMP-TARGET-MIB module by multiple
+         managers.  In particular, it is useful when modifying
+         the value of the snmpTargetAddrTagList object.
+
+         The procedure for modifying the snmpTargetAddrTagList
+         object is as follows:
+
+             1.  Retrieve the value of snmpTargetSpinLock and
+                 of snmpTargetAddrTagList.
+
+             2.  Generate a new value for snmpTargetAddrTagList.
+
+             3.  Set the value of snmpTargetSpinLock to the
+                 retrieved value, and the value of
+                 snmpTargetAddrTagList to the new value.  If
+                 the set fails for the snmpTargetSpinLock
+                 object, go back to step 1."
+    ::= { snmpTargetObjects 1 }
+
+snmpTargetAddrTable OBJECT-TYPE
+    SYNTAX      SEQUENCE OF SnmpTargetAddrEntry
+    MAX-ACCESS  not-accessible
+    STATUS      current
+    DESCRIPTION
+        "A table of transport addresses to be used in the generation
+         of SNMP messages."
+    ::= { snmpTargetObjects 2 }
+
+snmpTargetAddrEntry OBJECT-TYPE
+    SYNTAX      SnmpTargetAddrEntry
+    MAX-ACCESS  not-accessible
+    STATUS      current
+    DESCRIPTION
+        "A transport address to be used in the generation
+         of SNMP operations.
+
+         Entries in the snmpTargetAddrTable are created and
+         deleted using the snmpTargetAddrRowStatus object."
+    INDEX { IMPLIED snmpTargetAddrName }
+    ::= { snmpTargetAddrTable 1 }
+
+SnmpTargetAddrEntry ::= SEQUENCE {
+    snmpTargetAddrName         SnmpAdminString,
+    snmpTargetAddrTDomain      TDomain,
+    snmpTargetAddrTAddress     TAddress,
+    snmpTargetAddrTimeout      TimeInterval,
+    snmpTargetAddrRetryCount   Integer32,
+    snmpTargetAddrTagList      SnmpTagList,
+    snmpTargetAddrParams       SnmpAdminString,
+    snmpTargetAddrStorageType  StorageType,
+    snmpTargetAddrRowStatus    RowStatus
+}
+
+snmpTargetAddrName OBJECT-TYPE
+    SYNTAX      SnmpAdminString (SIZE(1..32))
+    MAX-ACCESS  not-accessible
+    STATUS      current
+    DESCRIPTION
+        "The locally arbitrary, but unique identifier associated
+         with this snmpTargetAddrEntry."
+    ::= { snmpTargetAddrEntry 1 }
+
+snmpTargetAddrTDomain OBJECT-TYPE
+    SYNTAX      TDomain
+    MAX-ACCESS  read-create
+    STATUS      current
+    DESCRIPTION
+        "This object indicates the transport type of the address
+         contained in the snmpTargetAddrTAddress object."
+    ::= { snmpTargetAddrEntry 2 }
+
+snmpTargetAddrTAddress OBJECT-TYPE
+    SYNTAX      TAddress
+    MAX-ACCESS  read-create
+    STATUS      current
+    DESCRIPTION
+        "This object contains a transport address.  The format of
+         this address depends on the value of the
+         snmpTargetAddrTDomain object."
+    ::= { snmpTargetAddrEntry 3 }
+
+snmpTargetAddrTimeout OBJECT-TYPE
+    SYNTAX      TimeInterval
+    MAX-ACCESS  read-create
+    STATUS      current
+    DESCRIPTION
+        "This object should reflect the expected maximum round
+         trip time for communicating with the transport address
+         defined by this row.  When a message is sent to this
+         address, and a response (if one is expected) is not
+         received within this time period, an implementation
+         may assume that the response will not be delivered.
+
+         Note that the time interval that an application waits
+         for a response may actually be derived from the value
+         of this object.  The method for deriving the actual time
+         interval is implementation dependent.  One such method
+         is to derive the expected round trip time based on a
+         particular retransmission algorithm and on the number
+         of timeouts which have occurred.  The type of message may
+         also be considered when deriving expected round trip
+         times for retransmissions.  For example, if a message is
+         being sent with a securityLevel that indicates both
+
+         authentication and privacy, the derived value may be
+         increased to compensate for extra processing time spent
+         during authentication and encryption processing."
+    DEFVAL { 1500 }
+    ::= { snmpTargetAddrEntry 4 }
+
+snmpTargetAddrRetryCount OBJECT-TYPE
+    SYNTAX      Integer32 (0..255)
+    MAX-ACCESS  read-create
+    STATUS      current
+    DESCRIPTION
+        "This object specifies a default number of retries to be
+         attempted when a response is not received for a generated
+         message.  An application may provide its own retry count,
+         in which case the value of this object is ignored."
+    DEFVAL { 3 }
+    ::= { snmpTargetAddrEntry 5 }
+
+snmpTargetAddrTagList OBJECT-TYPE
+    SYNTAX      SnmpTagList
+    MAX-ACCESS  read-create
+    STATUS      current
+    DESCRIPTION
+        "This object contains a list of tag values which are
+         used to select target addresses for a particular
+         operation."
+    DEFVAL { "" }
+    ::= { snmpTargetAddrEntry 6 }
+
+snmpTargetAddrParams OBJECT-TYPE
+    SYNTAX      SnmpAdminString (SIZE(1..32))
+    MAX-ACCESS  read-create
+    STATUS      current
+    DESCRIPTION
+        "The value of this object identifies an entry in the
+         snmpTargetParamsTable.  The identified entry
+         contains SNMP parameters to be used when generating
+         messages to be sent to this transport address."
+    ::= { snmpTargetAddrEntry 7 }
+
+snmpTargetAddrStorageType OBJECT-TYPE
+    SYNTAX      StorageType
+    MAX-ACCESS  read-create
+    STATUS      current
+    DESCRIPTION
+        "The storage type for this conceptual row.
+         Conceptual rows having the value 'permanent' need not
+         allow write-access to any columnar objects in the row."
+    DEFVAL { nonVolatile }
+    ::= { snmpTargetAddrEntry 8 }
+
+snmpTargetAddrRowStatus OBJECT-TYPE
+    SYNTAX      RowStatus
+    MAX-ACCESS  read-create
+    STATUS      current
+    DESCRIPTION
+        "The status of this conceptual row.
+
+         To create a row in this table, a manager must
+         set this object to either createAndGo(4) or
+         createAndWait(5).
+
+         Until instances of all corresponding columns are
+         appropriately configured, the value of the
+         corresponding instance of the snmpTargetAddrRowStatus
+         column is 'notReady'.
+
+         In particular, a newly created row cannot be made
+         active until the corresponding instances of
+         snmpTargetAddrTDomain, snmpTargetAddrTAddress, and
+         snmpTargetAddrParams have all been set.
+
+         The following objects may not be modified while the
+         value of this object is active(1):
+             - snmpTargetAddrTDomain
+             - snmpTargetAddrTAddress
+         An attempt to set these objects while the value of
+         snmpTargetAddrRowStatus is active(1) will result in
+         an inconsistentValue error."
+    ::= { snmpTargetAddrEntry 9 }
+
+snmpTargetParamsTable OBJECT-TYPE
+    SYNTAX      SEQUENCE OF SnmpTargetParamsEntry
+    MAX-ACCESS  not-accessible
+    STATUS      current
+    DESCRIPTION
+        "A table of SNMP target information to be used
+         in the generation of SNMP messages."
+    ::= { snmpTargetObjects 3 }
+
+snmpTargetParamsEntry OBJECT-TYPE
+    SYNTAX      SnmpTargetParamsEntry
+    MAX-ACCESS  not-accessible
+    STATUS      current
+    DESCRIPTION
+        "A set of SNMP target information.
+
+         Entries in the snmpTargetParamsTable are created and
+         deleted using the snmpTargetParamsRowStatus object."
+    INDEX { IMPLIED snmpTargetParamsName }
+    ::= { snmpTargetParamsTable 1 }
+
+SnmpTargetParamsEntry ::= SEQUENCE {
+    snmpTargetParamsName           SnmpAdminString,
+    snmpTargetParamsMPModel        SnmpMessageProcessingModel,
+    snmpTargetParamsSecurityModel  SnmpSecurityModel,
+    snmpTargetParamsSecurityName   SnmpAdminString,
+    snmpTargetParamsSecurityLevel  SnmpSecurityLevel,
+    snmpTargetParamsStorageType    StorageType,
+    snmpTargetParamsRowStatus      RowStatus
+}
+
+snmpTargetParamsName OBJECT-TYPE
+    SYNTAX      SnmpAdminString (SIZE(1..32))
+    MAX-ACCESS  not-accessible
+    STATUS      current
+    DESCRIPTION
+        "The locally arbitrary, but unique identifier associated
+         with this snmpTargetParamsEntry."
+    ::= { snmpTargetParamsEntry 1 }
+
+snmpTargetParamsMPModel OBJECT-TYPE
+    SYNTAX      SnmpMessageProcessingModel
+    MAX-ACCESS  read-create
+    STATUS      current
+    DESCRIPTION
+        "The Message Processing Model to be used when generating
+         SNMP messages using this entry."
+    ::= { snmpTargetParamsEntry 2 }
+
+snmpTargetParamsSecurityModel OBJECT-TYPE
+    SYNTAX      SnmpSecurityModel (1..2147483647)
+    MAX-ACCESS  read-create
+    STATUS      current
+    DESCRIPTION
+        "The Security Model to be used when generating SNMP
+          messages using this entry.  An implementation may
+          choose to return an inconsistentValue error if an
+          attempt is made to set this variable to a value
+          for a security model which the implementation does
+          not support."
+    ::= { snmpTargetParamsEntry 3 }
+
+snmpTargetParamsSecurityName OBJECT-TYPE
+    SYNTAX      SnmpAdminString
+    MAX-ACCESS  read-create
+    STATUS      current
+    DESCRIPTION
+        "The securityName which identifies the Principal on
+         whose behalf SNMP messages will be generated using
+         this entry."
+    ::= { snmpTargetParamsEntry 4 }
+
+snmpTargetParamsSecurityLevel OBJECT-TYPE
+    SYNTAX      SnmpSecurityLevel
+    MAX-ACCESS  read-create
+    STATUS      current
+    DESCRIPTION
+        "The Level of Security to be used when generating
+         SNMP messages using this entry."
+    ::= { snmpTargetParamsEntry 5 }
+
+snmpTargetParamsStorageType OBJECT-TYPE
+    SYNTAX      StorageType
+    MAX-ACCESS  read-create
+    STATUS      current
+    DESCRIPTION
+        "The storage type for this conceptual row.
+         Conceptual rows having the value 'permanent' need not
+         allow write-access to any columnar objects in the row."
+    DEFVAL { nonVolatile }
+    ::= { snmpTargetParamsEntry 6 }
+
+snmpTargetParamsRowStatus OBJECT-TYPE
+    SYNTAX      RowStatus
+    MAX-ACCESS  read-create
+    STATUS      current
+    DESCRIPTION
+        "The status of this conceptual row.
+
+         To create a row in this table, a manager must
+         set this object to either createAndGo(4) or
+         createAndWait(5).
+
+         Until instances of all corresponding columns are
+         appropriately configured, the value of the
+         corresponding instance of the snmpTargetParamsRowStatus
+         column is 'notReady'.
+
+         In particular, a newly created row cannot be made
+         active until the corresponding
+         snmpTargetParamsMPModel,
+         snmpTargetParamsSecurityModel,
+         snmpTargetParamsSecurityName,
+         and snmpTargetParamsSecurityLevel have all been set.
+
+         The following objects may not be modified while the
+         value of this object is active(1):
+             - snmpTargetParamsMPModel
+             - snmpTargetParamsSecurityModel
+             - snmpTargetParamsSecurityName
+             - snmpTargetParamsSecurityLevel
+         An attempt to set these objects while the value of
+         snmpTargetParamsRowStatus is active(1) will result in
+         an inconsistentValue error."
+    ::= { snmpTargetParamsEntry 7 }
+
+snmpUnavailableContexts OBJECT-TYPE
+    SYNTAX       Counter32
+    MAX-ACCESS   read-only
+    STATUS       current
+    DESCRIPTION
+        "The total number of packets received by the SNMP
+         engine which were dropped because the context
+         contained in the message was unavailable."
+    ::= { snmpTargetObjects 4 }
+
+snmpUnknownContexts OBJECT-TYPE
+    SYNTAX       Counter32
+    MAX-ACCESS   read-only
+    STATUS       current
+    DESCRIPTION
+        "The total number of packets received by the SNMP
+         engine which were dropped because the context
+         contained in the message was unknown."
+    ::= { snmpTargetObjects 5 }
+
+--
+--
+-- Conformance information
+--
+--
+
+snmpTargetCompliances OBJECT IDENTIFIER ::=
+                                        { snmpTargetConformance 1 }
+snmpTargetGroups      OBJECT IDENTIFIER ::=
+                                        { snmpTargetConformance 2 }
+
+--
+--
+-- Compliance statements
+
+--
+--
+
+snmpTargetCommandResponderCompliance MODULE-COMPLIANCE
+    STATUS      current
+    DESCRIPTION
+        "The compliance statement for SNMP entities which include
+         a command responder application."
+    MODULE -- This Module
+        MANDATORY-GROUPS { snmpTargetCommandResponderGroup }
+    ::= { snmpTargetCompliances 1 }
+
+snmpTargetBasicGroup OBJECT-GROUP
+    OBJECTS {
+        snmpTargetSpinLock,
+        snmpTargetAddrTDomain,
+        snmpTargetAddrTAddress,
+        snmpTargetAddrTagList,
+        snmpTargetAddrParams,
+        snmpTargetAddrStorageType,
+        snmpTargetAddrRowStatus,
+        snmpTargetParamsMPModel,
+        snmpTargetParamsSecurityModel,
+        snmpTargetParamsSecurityName,
+        snmpTargetParamsSecurityLevel,
+        snmpTargetParamsStorageType,
+        snmpTargetParamsRowStatus
+    }
+    STATUS      current
+    DESCRIPTION
+        "A collection of objects providing basic remote
+         configuration of management targets."
+    ::= { snmpTargetGroups 1 }
+
+snmpTargetResponseGroup OBJECT-GROUP
+    OBJECTS {
+        snmpTargetAddrTimeout,
+        snmpTargetAddrRetryCount
+    }
+    STATUS      current
+    DESCRIPTION
+        "A collection of objects providing remote configuration
+         of management targets for applications which generate
+         SNMP messages for which a response message would be
+         expected."
+    ::= { snmpTargetGroups 2 }
+
+snmpTargetCommandResponderGroup OBJECT-GROUP
+
+    OBJECTS {
+        snmpUnavailableContexts,
+        snmpUnknownContexts
+    }
+    STATUS      current
+    DESCRIPTION
+        "A collection of objects required for command responder
+         applications, used for counting error conditions."
+    ::= { snmpTargetGroups 3 }
+
+END
diff -Naur tomato/release/src/router/snmp/mibs/SNMP-USER-BASED-SM-MIB.txt tomato121/release/src/router/snmp/mibs/SNMP-USER-BASED-SM-MIB.txt
--- tomato/release/src/router/snmp/mibs/SNMP-USER-BASED-SM-MIB.txt	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/mibs/SNMP-USER-BASED-SM-MIB.txt	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,912 @@
+SNMP-USER-BASED-SM-MIB DEFINITIONS ::= BEGIN
+
+IMPORTS
+    MODULE-IDENTITY, OBJECT-TYPE,
+    OBJECT-IDENTITY,
+    snmpModules, Counter32                FROM SNMPv2-SMI
+    TEXTUAL-CONVENTION, TestAndIncr,
+    RowStatus, RowPointer,
+    StorageType, AutonomousType           FROM SNMPv2-TC
+    MODULE-COMPLIANCE, OBJECT-GROUP       FROM SNMPv2-CONF
+    SnmpAdminString, SnmpEngineID,
+    snmpAuthProtocols, snmpPrivProtocols  FROM SNMP-FRAMEWORK-MIB;
+
+snmpUsmMIB MODULE-IDENTITY
+    LAST-UPDATED "200210160000Z"            -- 16 Oct 2002, midnight
+    ORGANIZATION "SNMPv3 Working Group"
+    CONTACT-INFO "WG-email:   snmpv3@lists.tislabs.com
+                  Subscribe:  majordomo@lists.tislabs.com
+                              In msg body:  subscribe snmpv3
+
+                  Chair:      Russ Mundy
+                              Network Associates Laboratories
+                  postal:     15204 Omega Drive, Suite 300
+                              Rockville, MD 20850-4601
+                              USA
+                  email:      mundy@tislabs.com
+
+                  phone:      +1 301-947-7107
+
+                  Co-Chair:   David Harrington
+                              Enterasys Networks
+                  Postal:     35 Industrial Way
+                              P. O. Box 5004
+                              Rochester, New Hampshire 03866-5005
+                              USA
+                  EMail:      dbh@enterasys.com
+                  Phone:      +1 603-337-2614
+
+                  Co-editor   Uri Blumenthal
+                              Lucent Technologies
+                  postal:     67 Whippany Rd.
+                              Whippany, NJ 07981
+                              USA
+                  email:      uri@lucent.com
+                  phone:      +1-973-386-2163
+
+                  Co-editor:  Bert Wijnen
+                              Lucent Technologies
+                  postal:     Schagen 33
+                              3461 GL Linschoten
+                              Netherlands
+                  email:      bwijnen@lucent.com
+                  phone:      +31-348-480-685
+                 "
+    DESCRIPTION  "The management information definitions for the
+                  SNMP User-based Security Model.
+
+                  Copyright (C) The Internet Society (2002). This
+                  version of this MIB module is part of RFC 3414;
+                  see the RFC itself for full legal notices.
+                 "
+--  Revision history
+
+    REVISION     "200210160000Z"          -- 16 Oct 2002, midnight
+    DESCRIPTION  "Changes in this revision:
+                  - Updated references and contact info.
+                  - Clarification to usmUserCloneFrom DESCRIPTION
+                    clause
+                  - Fixed 'command responder' into 'command generator'
+                    in last para of DESCRIPTION clause of
+                    usmUserTable.
+                  This revision published as RFC3414.
+                 "
+    REVISION     "199901200000Z"          -- 20 Jan 1999, midnight
+    DESCRIPTION  "Clarifications, published as RFC2574"
+
+    REVISION     "199711200000Z"          -- 20 Nov 1997, midnight
+    DESCRIPTION  "Initial version, published as RFC2274"
+    ::= { snmpModules 15 }
+
+-- Administrative assignments ****************************************
+
+usmMIBObjects     OBJECT IDENTIFIER ::= { snmpUsmMIB 1 }
+usmMIBConformance OBJECT IDENTIFIER ::= { snmpUsmMIB 2 }
+
+-- Identification of Authentication and Privacy Protocols ************
+
+usmNoAuthProtocol OBJECT-IDENTITY
+    STATUS        current
+    DESCRIPTION  "No Authentication Protocol."
+    ::= { snmpAuthProtocols 1 }
+
+usmHMACMD5AuthProtocol OBJECT-IDENTITY
+    STATUS        current
+    DESCRIPTION  "The HMAC-MD5-96 Digest Authentication Protocol."
+    REFERENCE    "- H. Krawczyk, M. Bellare, R. Canetti HMAC:
+                    Keyed-Hashing for Message Authentication,
+                    RFC2104, Feb 1997.
+                  - Rivest, R., Message Digest Algorithm MD5, RFC1321.
+                 "
+    ::= { snmpAuthProtocols 2 }
+
+usmHMACSHAAuthProtocol OBJECT-IDENTITY
+    STATUS        current
+    DESCRIPTION  "The HMAC-SHA-96 Digest Authentication Protocol."
+    REFERENCE    "- H. Krawczyk, M. Bellare, R. Canetti, HMAC:
+                    Keyed-Hashing for Message Authentication,
+                    RFC2104, Feb 1997.
+                  - Secure Hash Algorithm. NIST FIPS 180-1.
+                 "
+    ::= { snmpAuthProtocols 3 }
+
+usmNoPrivProtocol OBJECT-IDENTITY
+    STATUS        current
+    DESCRIPTION  "No Privacy Protocol."
+    ::= { snmpPrivProtocols 1 }
+
+usmDESPrivProtocol OBJECT-IDENTITY
+    STATUS        current
+    DESCRIPTION  "The CBC-DES Symmetric Encryption Protocol."
+    REFERENCE    "- Data Encryption Standard, National Institute of
+                    Standards and Technology.  Federal Information
+                    Processing Standard (FIPS) Publication 46-1.
+
+                    Supersedes FIPS Publication 46,
+                    (January, 1977; reaffirmed January, 1988).
+
+                  - Data Encryption Algorithm, American National
+                    Standards Institute.  ANSI X3.92-1981,
+                    (December, 1980).
+
+                  - DES Modes of Operation, National Institute of
+                    Standards and Technology.  Federal Information
+                    Processing Standard (FIPS) Publication 81,
+                    (December, 1980).
+
+                  - Data Encryption Algorithm - Modes of Operation,
+                    American National Standards Institute.
+                    ANSI X3.106-1983, (May 1983).
+                 "
+    ::= { snmpPrivProtocols 2 }
+
+-- Textual Conventions ***********************************************
+
+KeyChange ::=     TEXTUAL-CONVENTION
+   STATUS         current
+   DESCRIPTION
+         "Every definition of an object with this syntax must identify
+          a protocol P, a secret key K, and a hash algorithm H
+          that produces output of L octets.
+
+          The object's value is a manager-generated, partially-random
+          value which, when modified, causes the value of the secret
+          key K, to be modified via a one-way function.
+
+          The value of an instance of this object is the concatenation
+          of two components: first a 'random' component and then a
+          'delta' component.
+
+          The lengths of the random and delta components
+          are given by the corresponding value of the protocol P;
+          if P requires K to be a fixed length, the length of both the
+          random and delta components is that fixed length; if P
+          allows the length of K to be variable up to a particular
+          maximum length, the length of the random component is that
+          maximum length and the length of the delta component is any
+          length less than or equal to that maximum length.
+          For example, usmHMACMD5AuthProtocol requires K to be a fixed
+          length of 16 octets and L - of 16 octets.
+          usmHMACSHAAuthProtocol requires K to be a fixed length of
+          20 octets and L - of 20 octets. Other protocols may define
+          other sizes, as deemed appropriate.
+
+          When a requester wants to change the old key K to a new
+          key keyNew on a remote entity, the 'random' component is
+          obtained from either a true random generator, or from a
+          pseudorandom generator, and the 'delta' component is
+          computed as follows:
+
+           - a temporary variable is initialized to the existing value
+             of K;
+           - if the length of the keyNew is greater than L octets,
+             then:
+              - the random component is appended to the value of the
+                temporary variable, and the result is input to the
+                the hash algorithm H to produce a digest value, and
+                the temporary variable is set to this digest value;
+              - the value of the temporary variable is XOR-ed with
+                the first (next) L-octets (16 octets in case of MD5)
+                of the keyNew to produce the first (next) L-octets
+                (16 octets in case of MD5) of the 'delta' component.
+              - the above two steps are repeated until the unused
+                portion of the keyNew component is L octets or less,
+           - the random component is appended to the value of the
+             temporary variable, and the result is input to the
+             hash algorithm H to produce a digest value;
+           - this digest value, truncated if necessary to be the same
+             length as the unused portion of the keyNew, is XOR-ed
+             with the unused portion of the keyNew to produce the
+             (final portion of the) 'delta' component.
+
+           For example, using MD5 as the hash algorithm H:
+
+              iterations = (lenOfDelta - 1)/16; /* integer division */
+              temp = keyOld;
+              for (i = 0; i < iterations; i++) {
+                  temp = MD5 (temp || random);
+                  delta[i*16 .. (i*16)+15] =
+                         temp XOR keyNew[i*16 .. (i*16)+15];
+              }
+              temp = MD5 (temp || random);
+              delta[i*16 .. lenOfDelta-1] =
+                     temp XOR keyNew[i*16 .. lenOfDelta-1];
+
+          The 'random' and 'delta' components are then concatenated as
+          described above, and the resulting octet string is sent to
+          the recipient as the new value of an instance of this object.
+
+          At the receiver side, when an instance of this object is set
+          to a new value, then a new value of K is computed as follows:
+
+           - a temporary variable is initialized to the existing value
+             of K;
+           - if the length of the delta component is greater than L
+             octets, then:
+              - the random component is appended to the value of the
+                temporary variable, and the result is input to the
+                hash algorithm H to produce a digest value, and the
+                temporary variable is set to this digest value;
+              - the value of the temporary variable is XOR-ed with
+                the first (next) L-octets (16 octets in case of MD5)
+                of the delta component to produce the first (next)
+                L-octets (16 octets in case of MD5) of the new value
+                of K.
+              - the above two steps are repeated until the unused
+                portion of the delta component is L octets or less,
+           - the random component is appended to the value of the
+             temporary variable, and the result is input to the
+             hash algorithm H to produce a digest value;
+           - this digest value, truncated if necessary to be the same
+             length as the unused portion of the delta component, is
+             XOR-ed with the unused portion of the delta component to
+             produce the (final portion of the) new value of K.
+
+           For example, using MD5 as the hash algorithm H:
+
+              iterations = (lenOfDelta - 1)/16; /* integer division */
+              temp = keyOld;
+              for (i = 0; i < iterations; i++) {
+                  temp = MD5 (temp || random);
+                  keyNew[i*16 .. (i*16)+15] =
+                         temp XOR delta[i*16 .. (i*16)+15];
+              }
+              temp = MD5 (temp || random);
+              keyNew[i*16 .. lenOfDelta-1] =
+                     temp XOR delta[i*16 .. lenOfDelta-1];
+
+          The value of an object with this syntax, whenever it is
+          retrieved by the management protocol, is always the zero
+          length string.
+
+          Note that the keyOld and keyNew are the localized keys.
+
+          Note that it is probably wise that when an SNMP entity sends
+          a SetRequest to change a key, that it keeps a copy of the old
+          key until it has confirmed that the key change actually
+          succeeded.
+         "
+    SYNTAX       OCTET STRING
+
+-- Statistics for the User-based Security Model **********************
+
+usmStats         OBJECT IDENTIFIER ::= { usmMIBObjects 1 }
+
+usmStatsUnsupportedSecLevels OBJECT-TYPE
+    SYNTAX       Counter32
+    MAX-ACCESS   read-only
+    STATUS       current
+    DESCRIPTION "The total number of packets received by the SNMP
+                 engine which were dropped because they requested a
+                 securityLevel that was unknown to the SNMP engine
+                 or otherwise unavailable.
+                "
+    ::= { usmStats 1 }
+
+usmStatsNotInTimeWindows OBJECT-TYPE
+    SYNTAX       Counter32
+    MAX-ACCESS   read-only
+    STATUS       current
+    DESCRIPTION "The total number of packets received by the SNMP
+                 engine which were dropped because they appeared
+                 outside of the authoritative SNMP engine's window.
+                "
+    ::= { usmStats 2 }
+
+usmStatsUnknownUserNames OBJECT-TYPE
+    SYNTAX       Counter32
+    MAX-ACCESS   read-only
+    STATUS       current
+    DESCRIPTION "The total number of packets received by the SNMP
+                 engine which were dropped because they referenced a
+                 user that was not known to the SNMP engine.
+                "
+    ::= { usmStats 3 }
+
+usmStatsUnknownEngineIDs OBJECT-TYPE
+    SYNTAX       Counter32
+    MAX-ACCESS   read-only
+    STATUS       current
+    DESCRIPTION "The total number of packets received by the SNMP
+                 engine which were dropped because they referenced an
+                 snmpEngineID that was not known to the SNMP engine.
+                "
+    ::= { usmStats 4 }
+
+usmStatsWrongDigests OBJECT-TYPE
+    SYNTAX       Counter32
+    MAX-ACCESS   read-only
+    STATUS       current
+    DESCRIPTION "The total number of packets received by the SNMP
+                 engine which were dropped because they didn't
+                 contain the expected digest value.
+                "
+    ::= { usmStats 5 }
+
+usmStatsDecryptionErrors OBJECT-TYPE
+    SYNTAX       Counter32
+    MAX-ACCESS   read-only
+    STATUS       current
+    DESCRIPTION "The total number of packets received by the SNMP
+                 engine which were dropped because they could not be
+                 decrypted.
+                "
+    ::= { usmStats 6 }
+
+-- The usmUser Group ************************************************
+
+usmUser          OBJECT IDENTIFIER ::= { usmMIBObjects 2 }
+
+usmUserSpinLock  OBJECT-TYPE
+    SYNTAX       TestAndIncr
+    MAX-ACCESS   read-write
+    STATUS       current
+    DESCRIPTION "An advisory lock used to allow several cooperating
+                 Command Generator Applications to coordinate their
+                 use of facilities to alter secrets in the
+                 usmUserTable.
+                "
+    ::= { usmUser 1 }
+
+-- The table of valid users for the User-based Security Model ********
+
+usmUserTable     OBJECT-TYPE
+    SYNTAX       SEQUENCE OF UsmUserEntry
+    MAX-ACCESS   not-accessible
+    STATUS       current
+    DESCRIPTION "The table of users configured in the SNMP engine's
+                 Local Configuration Datastore (LCD).
+
+                 To create a new user (i.e., to instantiate a new
+                 conceptual row in this table), it is recommended to
+                 follow this procedure:
+
+                   1)  GET(usmUserSpinLock.0) and save in sValue.
+
+                   2)  SET(usmUserSpinLock.0=sValue,
+                           usmUserCloneFrom=templateUser,
+                           usmUserStatus=createAndWait)
+                       You should use a template user to clone from
+                       which has the proper auth/priv protocol defined.
+
+                 If the new user is to use privacy:
+
+                   3)  generate the keyChange value based on the secret
+                       privKey of the clone-from user and the secret key
+                       to be used for the new user. Let us call this
+                       pkcValue.
+                   4)  GET(usmUserSpinLock.0) and save in sValue.
+                   5)  SET(usmUserSpinLock.0=sValue,
+                           usmUserPrivKeyChange=pkcValue
+                           usmUserPublic=randomValue1)
+                   6)  GET(usmUserPulic) and check it has randomValue1.
+                       If not, repeat steps 4-6.
+
+                 If the new user will never use privacy:
+
+                   7)  SET(usmUserPrivProtocol=usmNoPrivProtocol)
+
+                 If the new user is to use authentication:
+
+                   8)  generate the keyChange value based on the secret
+                       authKey of the clone-from user and the secret key
+                       to be used for the new user. Let us call this
+                       akcValue.
+                   9)  GET(usmUserSpinLock.0) and save in sValue.
+                   10) SET(usmUserSpinLock.0=sValue,
+                           usmUserAuthKeyChange=akcValue
+                           usmUserPublic=randomValue2)
+                   11) GET(usmUserPulic) and check it has randomValue2.
+                       If not, repeat steps 9-11.
+
+                 If the new user will never use authentication:
+
+                   12) SET(usmUserAuthProtocol=usmNoAuthProtocol)
+
+                 Finally, activate the new user:
+
+                   13) SET(usmUserStatus=active)
+
+                 The new user should now be available and ready to be
+                 used for SNMPv3 communication. Note however that access
+                 to MIB data must be provided via configuration of the
+                 SNMP-VIEW-BASED-ACM-MIB.
+
+                 The use of usmUserSpinlock is to avoid conflicts with
+                 another SNMP command generator application which may
+                 also be acting on the usmUserTable.
+                "
+    ::= { usmUser 2 }
+
+usmUserEntry     OBJECT-TYPE
+    SYNTAX       UsmUserEntry
+    MAX-ACCESS   not-accessible
+    STATUS       current
+    DESCRIPTION "A user configured in the SNMP engine's Local
+                 Configuration Datastore (LCD) for the User-based
+                 Security Model.
+                "
+    INDEX       { usmUserEngineID,
+                  usmUserName
+                }
+    ::= { usmUserTable 1 }
+
+UsmUserEntry ::= SEQUENCE
+    {
+        usmUserEngineID         SnmpEngineID,
+        usmUserName             SnmpAdminString,
+        usmUserSecurityName     SnmpAdminString,
+        usmUserCloneFrom        RowPointer,
+        usmUserAuthProtocol     AutonomousType,
+        usmUserAuthKeyChange    KeyChange,
+        usmUserOwnAuthKeyChange KeyChange,
+        usmUserPrivProtocol     AutonomousType,
+        usmUserPrivKeyChange    KeyChange,
+        usmUserOwnPrivKeyChange KeyChange,
+        usmUserPublic           OCTET STRING,
+        usmUserStorageType      StorageType,
+        usmUserStatus           RowStatus
+    }
+
+usmUserEngineID  OBJECT-TYPE
+    SYNTAX       SnmpEngineID
+    MAX-ACCESS   not-accessible
+    STATUS       current
+    DESCRIPTION "An SNMP engine's administratively-unique identifier.
+
+                 In a simple agent, this value is always that agent's
+                 own snmpEngineID value.
+
+                 The value can also take the value of the snmpEngineID
+                 of a remote SNMP engine with which this user can
+                 communicate.
+                "
+    ::= { usmUserEntry 1 }
+
+usmUserName      OBJECT-TYPE
+    SYNTAX       SnmpAdminString (SIZE(1..32))
+    MAX-ACCESS   not-accessible
+    STATUS       current
+    DESCRIPTION "A human readable string representing the name of
+                 the user.
+
+                 This is the (User-based Security) Model dependent
+                 security ID.
+                "
+    ::= { usmUserEntry 2 }
+
+usmUserSecurityName OBJECT-TYPE
+    SYNTAX       SnmpAdminString
+    MAX-ACCESS   read-only
+    STATUS       current
+    DESCRIPTION "A human readable string representing the user in
+                 Security Model independent format.
+
+                 The default transformation of the User-based Security
+                 Model dependent security ID to the securityName and
+                 vice versa is the identity function so that the
+                 securityName is the same as the userName.
+                "
+    ::= { usmUserEntry 3 }
+
+usmUserCloneFrom OBJECT-TYPE
+    SYNTAX       RowPointer
+    MAX-ACCESS   read-create
+    STATUS       current
+    DESCRIPTION "A pointer to another conceptual row in this
+                 usmUserTable.  The user in this other conceptual
+                 row is called the clone-from user.
+
+                 When a new user is created (i.e., a new conceptual
+                 row is instantiated in this table), the privacy and
+                 authentication parameters of the new user must be
+                 cloned from its clone-from user. These parameters are:
+                   - authentication protocol (usmUserAuthProtocol)
+                   - privacy protocol (usmUserPrivProtocol)
+                 They will be copied regardless of what the current
+                 value is.
+
+                 Cloning also causes the initial values of the secret
+                 authentication key (authKey) and the secret encryption
+
+                 key (privKey) of the new user to be set to the same
+                 values as the corresponding secrets of the clone-from
+                 user to allow the KeyChange process to occur as
+                 required during user creation.
+
+                 The first time an instance of this object is set by
+                 a management operation (either at or after its
+                 instantiation), the cloning process is invoked.
+                 Subsequent writes are successful but invoke no
+                 action to be taken by the receiver.
+                 The cloning process fails with an 'inconsistentName'
+                 error if the conceptual row representing the
+                 clone-from user does not exist or is not in an active
+                 state when the cloning process is invoked.
+
+                 When this object is read, the ZeroDotZero OID
+                 is returned.
+                "
+    ::= { usmUserEntry 4 }
+
+usmUserAuthProtocol OBJECT-TYPE
+    SYNTAX       AutonomousType
+    MAX-ACCESS   read-create
+    STATUS       current
+    DESCRIPTION "An indication of whether messages sent on behalf of
+                 this user to/from the SNMP engine identified by
+                 usmUserEngineID, can be authenticated, and if so,
+                 the type of authentication protocol which is used.
+
+                 An instance of this object is created concurrently
+                 with the creation of any other object instance for
+                 the same user (i.e., as part of the processing of
+                 the set operation which creates the first object
+                 instance in the same conceptual row).
+
+                 If an initial set operation (i.e. at row creation time)
+                 tries to set a value for an unknown or unsupported
+                 protocol, then a 'wrongValue' error must be returned.
+
+                 The value will be overwritten/set when a set operation
+                 is performed on the corresponding instance of
+                 usmUserCloneFrom.
+
+                 Once instantiated, the value of such an instance of
+                 this object can only be changed via a set operation to
+                 the value of the usmNoAuthProtocol.
+
+                 If a set operation tries to change the value of an
+
+                 existing instance of this object to any value other
+                 than usmNoAuthProtocol, then an 'inconsistentValue'
+                 error must be returned.
+
+                 If a set operation tries to set the value to the
+                 usmNoAuthProtocol while the usmUserPrivProtocol value
+                 in the same row is not equal to usmNoPrivProtocol,
+                 then an 'inconsistentValue' error must be returned.
+                 That means that an SNMP command generator application
+                 must first ensure that the usmUserPrivProtocol is set
+                 to the usmNoPrivProtocol value before it can set
+                 the usmUserAuthProtocol value to usmNoAuthProtocol.
+                "
+    DEFVAL      { usmNoAuthProtocol }
+    ::= { usmUserEntry 5 }
+
+usmUserAuthKeyChange OBJECT-TYPE
+    SYNTAX       KeyChange   -- typically (SIZE (0 | 32)) for HMACMD5
+                             -- typically (SIZE (0 | 40)) for HMACSHA
+    MAX-ACCESS   read-create
+    STATUS       current
+    DESCRIPTION "An object, which when modified, causes the secret
+                 authentication key used for messages sent on behalf
+                 of this user to/from the SNMP engine identified by
+                 usmUserEngineID, to be modified via a one-way
+                 function.
+
+                 The associated protocol is the usmUserAuthProtocol.
+                 The associated secret key is the user's secret
+                 authentication key (authKey). The associated hash
+                 algorithm is the algorithm used by the user's
+                 usmUserAuthProtocol.
+
+                 When creating a new user, it is an 'inconsistentName'
+                 error for a set operation to refer to this object
+                 unless it is previously or concurrently initialized
+                 through a set operation on the corresponding instance
+                 of usmUserCloneFrom.
+
+                 When the value of the corresponding usmUserAuthProtocol
+                 is usmNoAuthProtocol, then a set is successful, but
+                 effectively is a no-op.
+
+                 When this object is read, the zero-length (empty)
+                 string is returned.
+
+                 The recommended way to do a key change is as follows:
+
+                   1) GET(usmUserSpinLock.0) and save in sValue.
+                   2) generate the keyChange value based on the old
+                      (existing) secret key and the new secret key,
+                      let us call this kcValue.
+
+                 If you do the key change on behalf of another user:
+
+                   3) SET(usmUserSpinLock.0=sValue,
+                          usmUserAuthKeyChange=kcValue
+                          usmUserPublic=randomValue)
+
+                 If you do the key change for yourself:
+
+                   4) SET(usmUserSpinLock.0=sValue,
+                          usmUserOwnAuthKeyChange=kcValue
+                          usmUserPublic=randomValue)
+
+                 If you get a response with error-status of noError,
+                 then the SET succeeded and the new key is active.
+                 If you do not get a response, then you can issue a
+                 GET(usmUserPublic) and check if the value is equal
+                 to the randomValue you did send in the SET. If so, then
+                 the key change succeeded and the new key is active
+                 (probably the response got lost). If not, then the SET
+                 request probably never reached the target and so you
+                 can start over with the procedure above.
+                "
+    DEFVAL      { ''H }    -- the empty string
+    ::= { usmUserEntry 6 }
+
+usmUserOwnAuthKeyChange OBJECT-TYPE
+    SYNTAX       KeyChange   -- typically (SIZE (0 | 32)) for HMACMD5
+                             -- typically (SIZE (0 | 40)) for HMACSHA
+    MAX-ACCESS   read-create
+    STATUS       current
+    DESCRIPTION "Behaves exactly as usmUserAuthKeyChange, with one
+                 notable difference: in order for the set operation
+                 to succeed, the usmUserName of the operation
+                 requester must match the usmUserName that
+                 indexes the row which is targeted by this
+                 operation.
+                 In addition, the USM security model must be
+                 used for this operation.
+
+                 The idea here is that access to this column can be
+                 public, since it will only allow a user to change
+                 his own secret authentication key (authKey).
+                 Note that this can only be done once the row is active.
+
+                 When a set is received and the usmUserName of the
+                 requester is not the same as the umsUserName that
+                 indexes the row which is targeted by this operation,
+                 then a 'noAccess' error must be returned.
+
+                 When a set is received and the security model in use
+                 is not USM, then a 'noAccess' error must be returned.
+                "
+    DEFVAL      { ''H }    -- the empty string
+    ::= { usmUserEntry 7 }
+
+usmUserPrivProtocol OBJECT-TYPE
+    SYNTAX       AutonomousType
+    MAX-ACCESS   read-create
+    STATUS       current
+    DESCRIPTION "An indication of whether messages sent on behalf of
+                 this user to/from the SNMP engine identified by
+                 usmUserEngineID, can be protected from disclosure,
+                 and if so, the type of privacy protocol which is used.
+
+                 An instance of this object is created concurrently
+                 with the creation of any other object instance for
+                 the same user (i.e., as part of the processing of
+                 the set operation which creates the first object
+                 instance in the same conceptual row).
+
+                 If an initial set operation (i.e. at row creation time)
+                 tries to set a value for an unknown or unsupported
+                 protocol, then a 'wrongValue' error must be returned.
+
+                 The value will be overwritten/set when a set operation
+                 is performed on the corresponding instance of
+                 usmUserCloneFrom.
+
+                 Once instantiated, the value of such an instance of
+                 this object can only be changed via a set operation to
+                 the value of the usmNoPrivProtocol.
+
+                 If a set operation tries to change the value of an
+                 existing instance of this object to any value other
+                 than usmNoPrivProtocol, then an 'inconsistentValue'
+                 error must be returned.
+
+                 Note that if any privacy protocol is used, then you
+                 must also use an authentication protocol. In other
+                 words, if usmUserPrivProtocol is set to anything else
+                 than usmNoPrivProtocol, then the corresponding instance
+                 of usmUserAuthProtocol cannot have a value of
+
+                 usmNoAuthProtocol. If it does, then an
+                 'inconsistentValue' error must be returned.
+                "
+    DEFVAL      { usmNoPrivProtocol }
+    ::= { usmUserEntry 8 }
+
+usmUserPrivKeyChange OBJECT-TYPE
+    SYNTAX       KeyChange  -- typically (SIZE (0 | 32)) for DES
+    MAX-ACCESS   read-create
+    STATUS       current
+    DESCRIPTION "An object, which when modified, causes the secret
+                 encryption key used for messages sent on behalf
+                 of this user to/from the SNMP engine identified by
+                 usmUserEngineID, to be modified via a one-way
+                 function.
+
+                 The associated protocol is the usmUserPrivProtocol.
+                 The associated secret key is the user's secret
+                 privacy key (privKey). The associated hash
+                 algorithm is the algorithm used by the user's
+                 usmUserAuthProtocol.
+
+                 When creating a new user, it is an 'inconsistentName'
+                 error for a set operation to refer to this object
+                 unless it is previously or concurrently initialized
+                 through a set operation on the corresponding instance
+                 of usmUserCloneFrom.
+
+                 When the value of the corresponding usmUserPrivProtocol
+                 is usmNoPrivProtocol, then a set is successful, but
+                 effectively is a no-op.
+
+                 When this object is read, the zero-length (empty)
+                 string is returned.
+                 See the description clause of usmUserAuthKeyChange for
+                 a recommended procedure to do a key change.
+                "
+    DEFVAL      { ''H }    -- the empty string
+    ::= { usmUserEntry 9 }
+
+usmUserOwnPrivKeyChange OBJECT-TYPE
+    SYNTAX       KeyChange  -- typically (SIZE (0 | 32)) for DES
+    MAX-ACCESS   read-create
+    STATUS       current
+    DESCRIPTION "Behaves exactly as usmUserPrivKeyChange, with one
+                 notable difference: in order for the Set operation
+                 to succeed, the usmUserName of the operation
+                 requester must match the usmUserName that indexes
+
+                 the row which is targeted by this operation.
+                 In addition, the USM security model must be
+                 used for this operation.
+
+                 The idea here is that access to this column can be
+                 public, since it will only allow a user to change
+                 his own secret privacy key (privKey).
+                 Note that this can only be done once the row is active.
+
+                 When a set is received and the usmUserName of the
+                 requester is not the same as the umsUserName that
+                 indexes the row which is targeted by this operation,
+                 then a 'noAccess' error must be returned.
+
+                 When a set is received and the security model in use
+                 is not USM, then a 'noAccess' error must be returned.
+                "
+    DEFVAL      { ''H }    -- the empty string
+    ::= { usmUserEntry 10 }
+
+usmUserPublic    OBJECT-TYPE
+    SYNTAX       OCTET STRING (SIZE(0..32))
+    MAX-ACCESS   read-create
+    STATUS       current
+    DESCRIPTION "A publicly-readable value which can be written as part
+                 of the procedure for changing a user's secret
+                 authentication and/or privacy key, and later read to
+                 determine whether the change of the secret was
+                 effected.
+                "
+    DEFVAL      { ''H }  -- the empty string
+    ::= { usmUserEntry 11 }
+
+usmUserStorageType OBJECT-TYPE
+    SYNTAX       StorageType
+    MAX-ACCESS   read-create
+    STATUS       current
+    DESCRIPTION "The storage type for this conceptual row.
+
+                 Conceptual rows having the value 'permanent' must
+                 allow write-access at a minimum to:
+
+                 - usmUserAuthKeyChange, usmUserOwnAuthKeyChange
+                   and usmUserPublic for a user who employs
+                   authentication, and
+                 - usmUserPrivKeyChange, usmUserOwnPrivKeyChange
+                   and usmUserPublic for a user who employs
+                   privacy.
+
+                 Note that any user who employs authentication or
+                 privacy must allow its secret(s) to be updated and
+                 thus cannot be 'readOnly'.
+
+                 If an initial set operation tries to set the value to
+                 'readOnly' for a user who employs authentication or
+                 privacy, then an 'inconsistentValue' error must be
+                 returned.  Note that if the value has been previously
+                 set (implicit or explicit) to any value, then the rules
+                 as defined in the StorageType Textual Convention apply.
+
+                 It is an implementation issue to decide if a SET for
+                 a readOnly or permanent row is accepted at all. In some
+                 contexts this may make sense, in others it may not. If
+                 a SET for a readOnly or permanent row is not accepted
+                 at all, then a 'wrongValue' error must be returned.
+                "
+    DEFVAL      { nonVolatile }
+    ::= { usmUserEntry 12 }
+
+usmUserStatus    OBJECT-TYPE
+    SYNTAX       RowStatus
+    MAX-ACCESS   read-create
+    STATUS       current
+    DESCRIPTION "The status of this conceptual row.
+
+                 Until instances of all corresponding columns are
+                 appropriately configured, the value of the
+                 corresponding instance of the usmUserStatus column
+                 is 'notReady'.
+
+                 In particular, a newly created row for a user who
+                 employs authentication, cannot be made active until the
+                 corresponding usmUserCloneFrom and usmUserAuthKeyChange
+                 have been set.
+
+                 Further, a newly created row for a user who also
+                 employs privacy, cannot be made active until the
+                 usmUserPrivKeyChange has been set.
+
+                 The RowStatus TC [RFC2579] requires that this
+                 DESCRIPTION clause states under which circumstances
+                 other objects in this row can be modified:
+
+                 The value of this object has no effect on whether
+                 other objects in this conceptual row can be modified,
+                 except for usmUserOwnAuthKeyChange and
+                 usmUserOwnPrivKeyChange. For these 2 objects, the
+
+                 value of usmUserStatus MUST be active.
+                "
+    ::= { usmUserEntry 13 }
+
+-- Conformance Information *******************************************
+
+usmMIBCompliances OBJECT IDENTIFIER ::= { usmMIBConformance 1 }
+usmMIBGroups      OBJECT IDENTIFIER ::= { usmMIBConformance 2 }
+
+-- Compliance statements
+
+usmMIBCompliance MODULE-COMPLIANCE
+    STATUS       current
+    DESCRIPTION "The compliance statement for SNMP engines which
+                 implement the SNMP-USER-BASED-SM-MIB.
+                "
+
+    MODULE       -- this module
+        MANDATORY-GROUPS { usmMIBBasicGroup }
+
+        OBJECT           usmUserAuthProtocol
+        MIN-ACCESS       read-only
+        DESCRIPTION     "Write access is not required."
+
+        OBJECT           usmUserPrivProtocol
+        MIN-ACCESS       read-only
+        DESCRIPTION     "Write access is not required."
+    ::= { usmMIBCompliances 1 }
+
+-- Units of compliance
+usmMIBBasicGroup OBJECT-GROUP
+    OBJECTS     {
+                  usmStatsUnsupportedSecLevels,
+                  usmStatsNotInTimeWindows,
+                  usmStatsUnknownUserNames,
+                  usmStatsUnknownEngineIDs,
+                  usmStatsWrongDigests,
+                  usmStatsDecryptionErrors,
+                  usmUserSpinLock,
+                  usmUserSecurityName,
+                  usmUserCloneFrom,
+                  usmUserAuthProtocol,
+                  usmUserAuthKeyChange,
+                  usmUserOwnAuthKeyChange,
+                  usmUserPrivProtocol,
+                  usmUserPrivKeyChange,
+                  usmUserOwnPrivKeyChange,
+                  usmUserPublic,
+                  usmUserStorageType,
+                  usmUserStatus
+                }
+    STATUS       current
+    DESCRIPTION "A collection of objects providing for configuration
+                 of an SNMP engine which implements the SNMP
+                 User-based Security Model.
+                "
+    ::= { usmMIBGroups 1 }
+
+END
diff -Naur tomato/release/src/router/snmp/mibs/SNMPv2-CONF.txt tomato121/release/src/router/snmp/mibs/SNMPv2-CONF.txt
--- tomato/release/src/router/snmp/mibs/SNMPv2-CONF.txt	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/mibs/SNMPv2-CONF.txt	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,322 @@
+SNMPv2-CONF DEFINITIONS ::= BEGIN
+
+IMPORTS ObjectName, NotificationName, ObjectSyntax
+                                               FROM SNMPv2-SMI;
+
+-- definitions for conformance groups
+
+OBJECT-GROUP MACRO ::=
+BEGIN
+    TYPE NOTATION ::=
+                  ObjectsPart
+                  "STATUS" Status
+                  "DESCRIPTION" Text
+                  ReferPart
+
+    VALUE NOTATION ::=
+                  value(VALUE OBJECT IDENTIFIER)
+
+    ObjectsPart ::=
+                  "OBJECTS" "{" Objects "}"
+    Objects ::=
+                  Object
+                | Objects "," Object
+    Object ::=
+
+                  value(ObjectName)
+
+    Status ::=
+                  "current"
+                | "deprecated"
+                | "obsolete"
+
+    ReferPart ::=
+                  "REFERENCE" Text
+                | empty
+
+    -- a character string as defined in [2]
+    Text ::= value(IA5String)
+END
+
+-- more definitions for conformance groups
+
+NOTIFICATION-GROUP MACRO ::=
+BEGIN
+    TYPE NOTATION ::=
+                  NotificationsPart
+                  "STATUS" Status
+                  "DESCRIPTION" Text
+                  ReferPart
+
+    VALUE NOTATION ::=
+                  value(VALUE OBJECT IDENTIFIER)
+
+    NotificationsPart ::=
+                  "NOTIFICATIONS" "{" Notifications "}"
+    Notifications ::=
+                  Notification
+                | Notifications "," Notification
+    Notification ::=
+                  value(NotificationName)
+
+    Status ::=
+                  "current"
+                | "deprecated"
+                | "obsolete"
+
+    ReferPart ::=
+                  "REFERENCE" Text
+                | empty
+
+    -- a character string as defined in [2]
+    Text ::= value(IA5String)
+END
+
+-- definitions for compliance statements
+
+MODULE-COMPLIANCE MACRO ::=
+BEGIN
+    TYPE NOTATION ::=
+                  "STATUS" Status
+                  "DESCRIPTION" Text
+                  ReferPart
+                  ModulePart
+
+    VALUE NOTATION ::=
+                  value(VALUE OBJECT IDENTIFIER)
+
+    Status ::=
+                  "current"
+                | "deprecated"
+                | "obsolete"
+
+    ReferPart ::=
+                  "REFERENCE" Text
+                | empty
+
+    ModulePart ::=
+                  Modules
+    Modules ::=
+                  Module
+                | Modules Module
+    Module ::=
+                  -- name of module --
+                  "MODULE" ModuleName
+                  MandatoryPart
+                  CompliancePart
+
+    ModuleName ::=
+                  -- identifier must start with uppercase letter
+                  identifier ModuleIdentifier
+                  -- must not be empty unless contained
+                  -- in MIB Module
+                | empty
+    ModuleIdentifier ::=
+                  value(OBJECT IDENTIFIER)
+                | empty
+
+    MandatoryPart ::=
+                  "MANDATORY-GROUPS" "{" Groups "}"
+                | empty
+
+    Groups ::=
+
+                  Group
+                | Groups "," Group
+    Group ::=
+                  value(OBJECT IDENTIFIER)
+
+    CompliancePart ::=
+                  Compliances
+                | empty
+
+    Compliances ::=
+                  Compliance
+                | Compliances Compliance
+    Compliance ::=
+                  ComplianceGroup
+                | Object
+
+    ComplianceGroup ::=
+                  "GROUP" value(OBJECT IDENTIFIER)
+                  "DESCRIPTION" Text
+
+    Object ::=
+                  "OBJECT" value(ObjectName)
+                  SyntaxPart
+                  WriteSyntaxPart
+                  AccessPart
+                  "DESCRIPTION" Text
+
+    -- must be a refinement for object's SYNTAX clause
+    SyntaxPart ::= "SYNTAX" Syntax
+                | empty
+
+    -- must be a refinement for object's SYNTAX clause
+    WriteSyntaxPart ::= "WRITE-SYNTAX" Syntax
+                | empty
+
+    Syntax ::=    -- Must be one of the following:
+                       -- a base type (or its refinement),
+                       -- a textual convention (or its refinement), or
+                       -- a BITS pseudo-type
+                  type
+                | "BITS" "{" NamedBits "}"
+
+    NamedBits ::= NamedBit
+                | NamedBits "," NamedBit
+
+    NamedBit ::= identifier "(" number ")" -- number is nonnegative
+
+    AccessPart ::=
+                  "MIN-ACCESS" Access
+                | empty
+    Access ::=
+                  "not-accessible"
+                | "accessible-for-notify"
+                | "read-only"
+                | "read-write"
+                | "read-create"
+
+    -- a character string as defined in [2]
+    Text ::= value(IA5String)
+END
+
+-- definitions for capabilities statements
+
+AGENT-CAPABILITIES MACRO ::=
+BEGIN
+    TYPE NOTATION ::=
+                  "PRODUCT-RELEASE" Text
+                  "STATUS" Status
+                  "DESCRIPTION" Text
+                  ReferPart
+                  ModulePart
+
+    VALUE NOTATION ::=
+                  value(VALUE OBJECT IDENTIFIER)
+
+    Status ::=
+                  "current"
+                | "obsolete"
+
+    ReferPart ::=
+                  "REFERENCE" Text
+                | empty
+
+    ModulePart ::=
+                  Modules
+                | empty
+    Modules ::=
+                  Module
+                | Modules Module
+    Module ::=
+                  -- name of module --
+                  "SUPPORTS" ModuleName
+                  "INCLUDES" "{" Groups "}"
+                  VariationPart
+
+    ModuleName ::=
+
+                  -- identifier must start with uppercase letter
+                  identifier ModuleIdentifier
+    ModuleIdentifier ::=
+                  value(OBJECT IDENTIFIER)
+                | empty
+
+    Groups ::=
+                  Group
+                | Groups "," Group
+    Group ::=
+                  value(OBJECT IDENTIFIER)
+
+    VariationPart ::=
+                  Variations
+                | empty
+    Variations ::=
+                  Variation
+                | Variations Variation
+
+    Variation ::=
+                  ObjectVariation
+                | NotificationVariation
+
+    NotificationVariation ::=
+                  "VARIATION" value(NotificationName)
+                  AccessPart
+                  "DESCRIPTION" Text
+
+    ObjectVariation ::=
+                  "VARIATION" value(ObjectName)
+                  SyntaxPart
+                  WriteSyntaxPart
+                  AccessPart
+                  CreationPart
+                  DefValPart
+                  "DESCRIPTION" Text
+
+    -- must be a refinement for object's SYNTAX clause
+    SyntaxPart ::= "SYNTAX" Syntax
+                | empty
+
+    WriteSyntaxPart ::= "WRITE-SYNTAX" Syntax
+                | empty
+
+    Syntax ::=    -- Must be one of the following:
+                       -- a base type (or its refinement),
+                       -- a textual convention (or its refinement), or
+                       -- a BITS pseudo-type
+
+                  type
+                | "BITS" "{" NamedBits "}"
+
+    NamedBits ::= NamedBit
+                | NamedBits "," NamedBit
+
+    NamedBit ::= identifier "(" number ")" -- number is nonnegative
+
+    AccessPart ::=
+                  "ACCESS" Access
+                | empty
+
+    Access ::=
+                  "not-implemented"
+                -- only "not-implemented" for notifications
+                | "accessible-for-notify"
+                | "read-only"
+                | "read-write"
+                | "read-create"
+                -- following is for backward-compatibility only
+                | "write-only"
+
+    CreationPart ::=
+                  "CREATION-REQUIRES" "{" Cells "}"
+                | empty
+    Cells ::=
+                  Cell
+                | Cells "," Cell
+    Cell ::=
+                  value(ObjectName)
+
+    DefValPart ::= "DEFVAL" "{" Defvalue "}"
+                | empty
+
+    Defvalue ::=  -- must be valid for the object's syntax
+                  -- in this macro's SYNTAX clause, if present,
+                  -- or if not, in object's OBJECT-TYPE macro
+                  value(ObjectSyntax)
+                | "{" BitsValue "}"
+
+    BitsValue ::= BitNames
+                | empty
+
+    BitNames ::=  BitName
+                | BitNames "," BitName
+
+    BitName ::= identifier
+
+    -- a character string as defined in [2]
+    Text ::= value(IA5String)
+END
+
+END
diff -Naur tomato/release/src/router/snmp/mibs/SNMPv2-MIB.txt tomato121/release/src/router/snmp/mibs/SNMPv2-MIB.txt
--- tomato/release/src/router/snmp/mibs/SNMPv2-MIB.txt	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/mibs/SNMPv2-MIB.txt	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,854 @@
+SNMPv2-MIB DEFINITIONS ::= BEGIN
+
+IMPORTS
+    MODULE-IDENTITY, OBJECT-TYPE, NOTIFICATION-TYPE,
+    TimeTicks, Counter32, snmpModules, mib-2
+        FROM SNMPv2-SMI
+    DisplayString, TestAndIncr, TimeStamp
+
+        FROM SNMPv2-TC
+    MODULE-COMPLIANCE, OBJECT-GROUP, NOTIFICATION-GROUP
+        FROM SNMPv2-CONF;
+
+snmpMIB MODULE-IDENTITY
+    LAST-UPDATED "200210160000Z"
+    ORGANIZATION "IETF SNMPv3 Working Group"
+    CONTACT-INFO
+            "WG-EMail:   snmpv3@lists.tislabs.com
+             Subscribe:  snmpv3-request@lists.tislabs.com
+
+             Co-Chair:   Russ Mundy
+                         Network Associates Laboratories
+             postal:     15204 Omega Drive, Suite 300
+                         Rockville, MD 20850-4601
+                         USA
+             EMail:      mundy@tislabs.com
+             phone:      +1 301 947-7107
+
+             Co-Chair:   David Harrington
+                         Enterasys Networks
+             postal:     35 Industrial Way
+                         P. O. Box 5005
+                         Rochester, NH 03866-5005
+                         USA
+             EMail:      dbh@enterasys.com
+             phone:      +1 603 337-2614
+
+             Editor:     Randy Presuhn
+                         BMC Software, Inc.
+             postal:     2141 North First Street
+                         San Jose, CA 95131
+                         USA
+             EMail:      randy_presuhn@bmc.com
+             phone:      +1 408 546-1006"
+    DESCRIPTION
+            "The MIB module for SNMP entities.
+
+             Copyright (C) The Internet Society (2002). This
+             version of this MIB module is part of RFC 3418;
+             see the RFC itself for full legal notices.
+            "
+    REVISION      "200210160000Z"
+    DESCRIPTION
+            "This revision of this MIB module was published as
+             RFC 3418."
+    REVISION      "199511090000Z"
+    DESCRIPTION
+            "This revision of this MIB module was published as
+             RFC 1907."
+    REVISION      "199304010000Z"
+    DESCRIPTION
+            "The initial revision of this MIB module was published
+            as RFC 1450."
+    ::= { snmpModules 1 }
+
+snmpMIBObjects OBJECT IDENTIFIER ::= { snmpMIB 1 }
+
+--  ::= { snmpMIBObjects 1 }        this OID is obsolete
+--  ::= { snmpMIBObjects 2 }        this OID is obsolete
+--  ::= { snmpMIBObjects 3 }        this OID is obsolete
+
+-- the System group
+--
+-- a collection of objects common to all managed systems.
+
+system   OBJECT IDENTIFIER ::= { mib-2 1 }
+
+sysDescr OBJECT-TYPE
+    SYNTAX      DisplayString (SIZE (0..255))
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+            "A textual description of the entity.  This value should
+            include the full name and version identification of
+            the system's hardware type, software operating-system,
+            and networking software."
+    ::= { system 1 }
+
+sysObjectID OBJECT-TYPE
+    SYNTAX      OBJECT IDENTIFIER
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+            "The vendor's authoritative identification of the
+            network management subsystem contained in the entity.
+            This value is allocated within the SMI enterprises
+            subtree (1.3.6.1.4.1) and provides an easy and
+            unambiguous means for determining `what kind of box' is
+            being managed.  For example, if vendor `Flintstones,
+            Inc.' was assigned the subtree 1.3.6.1.4.1.424242,
+            it could assign the identifier 1.3.6.1.4.1.424242.1.1
+            to its `Fred Router'."
+    ::= { system 2 }
+
+sysUpTime OBJECT-TYPE
+    SYNTAX      TimeTicks
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+            "The time (in hundredths of a second) since the
+            network management portion of the system was last
+            re-initialized."
+    ::= { system 3 }
+
+sysContact OBJECT-TYPE
+    SYNTAX      DisplayString (SIZE (0..255))
+    MAX-ACCESS  read-write
+    STATUS      current
+    DESCRIPTION
+            "The textual identification of the contact person for
+            this managed node, together with information on how
+            to contact this person.  If no contact information is
+            known, the value is the zero-length string."
+    ::= { system 4 }
+
+sysName OBJECT-TYPE
+    SYNTAX      DisplayString (SIZE (0..255))
+    MAX-ACCESS  read-write
+    STATUS      current
+    DESCRIPTION
+            "An administratively-assigned name for this managed
+            node.  By convention, this is the node's fully-qualified
+            domain name.  If the name is unknown, the value is
+            the zero-length string."
+    ::= { system 5 }
+
+sysLocation OBJECT-TYPE
+    SYNTAX      DisplayString (SIZE (0..255))
+    MAX-ACCESS  read-write
+    STATUS      current
+    DESCRIPTION
+            "The physical location of this node (e.g., 'telephone
+            closet, 3rd floor').  If the location is unknown, the
+            value is the zero-length string."
+    ::= { system 6 }
+
+sysServices OBJECT-TYPE
+    SYNTAX      INTEGER (0..127)
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+            "A value which indicates the set of services that this
+            entity may potentially offer.  The value is a sum.
+
+            This sum initially takes the value zero. Then, for
+            each layer, L, in the range 1 through 7, that this node
+            performs transactions for, 2 raised to (L - 1) is added
+            to the sum.  For example, a node which performs only
+            routing functions would have a value of 4 (2^(3-1)).
+            In contrast, a node which is a host offering application
+            services would have a value of 72 (2^(4-1) + 2^(7-1)).
+            Note that in the context of the Internet suite of
+            protocols, values should be calculated accordingly:
+
+                 layer      functionality
+                   1        physical (e.g., repeaters)
+                   2        datalink/subnetwork (e.g., bridges)
+                   3        internet (e.g., supports the IP)
+                   4        end-to-end  (e.g., supports the TCP)
+                   7        applications (e.g., supports the SMTP)
+
+            For systems including OSI protocols, layers 5 and 6
+            may also be counted."
+    ::= { system 7 }
+
+-- object resource information
+--
+-- a collection of objects which describe the SNMP entity's
+-- (statically and dynamically configurable) support of
+-- various MIB modules.
+
+sysORLastChange OBJECT-TYPE
+    SYNTAX     TimeStamp
+    MAX-ACCESS read-only
+    STATUS     current
+    DESCRIPTION
+            "The value of sysUpTime at the time of the most recent
+            change in state or value of any instance of sysORID."
+    ::= { system 8 }
+
+sysORTable OBJECT-TYPE
+    SYNTAX     SEQUENCE OF SysOREntry
+    MAX-ACCESS not-accessible
+    STATUS     current
+    DESCRIPTION
+            "The (conceptual) table listing the capabilities of
+            the local SNMP application acting as a command
+            responder with respect to various MIB modules.
+            SNMP entities having dynamically-configurable support
+            of MIB modules will have a dynamically-varying number
+            of conceptual rows."
+    ::= { system 9 }
+
+sysOREntry OBJECT-TYPE
+    SYNTAX     SysOREntry
+    MAX-ACCESS not-accessible
+    STATUS     current
+    DESCRIPTION
+            "An entry (conceptual row) in the sysORTable."
+    INDEX      { sysORIndex }
+    ::= { sysORTable 1 }
+
+SysOREntry ::= SEQUENCE {
+    sysORIndex     INTEGER,
+    sysORID        OBJECT IDENTIFIER,
+    sysORDescr     DisplayString,
+    sysORUpTime    TimeStamp
+}
+
+sysORIndex OBJECT-TYPE
+    SYNTAX     INTEGER (1..2147483647)
+    MAX-ACCESS not-accessible
+    STATUS     current
+    DESCRIPTION
+            "The auxiliary variable used for identifying instances
+            of the columnar objects in the sysORTable."
+    ::= { sysOREntry 1 }
+
+sysORID OBJECT-TYPE
+    SYNTAX     OBJECT IDENTIFIER
+    MAX-ACCESS read-only
+    STATUS     current
+    DESCRIPTION
+            "An authoritative identification of a capabilities
+            statement with respect to various MIB modules supported
+            by the local SNMP application acting as a command
+            responder."
+    ::= { sysOREntry 2 }
+
+sysORDescr OBJECT-TYPE
+    SYNTAX     DisplayString
+    MAX-ACCESS read-only
+    STATUS     current
+    DESCRIPTION
+            "A textual description of the capabilities identified
+            by the corresponding instance of sysORID."
+    ::= { sysOREntry 3 }
+
+sysORUpTime OBJECT-TYPE
+    SYNTAX     TimeStamp
+    MAX-ACCESS read-only
+    STATUS     current
+    DESCRIPTION
+            "The value of sysUpTime at the time this conceptual
+            row was last instantiated."
+    ::= { sysOREntry 4 }
+
+-- the SNMP group
+--
+-- a collection of objects providing basic instrumentation and
+-- control of an SNMP entity.
+
+snmp     OBJECT IDENTIFIER ::= { mib-2 11 }
+
+snmpInPkts OBJECT-TYPE
+    SYNTAX     Counter32
+    MAX-ACCESS read-only
+    STATUS     current
+    DESCRIPTION
+            "The total number of messages delivered to the SNMP
+            entity from the transport service."
+    ::= { snmp 1 }
+
+snmpInBadVersions OBJECT-TYPE
+    SYNTAX     Counter32
+    MAX-ACCESS read-only
+    STATUS     current
+    DESCRIPTION
+            "The total number of SNMP messages which were delivered
+            to the SNMP entity and were for an unsupported SNMP
+            version."
+    ::= { snmp 3 }
+
+snmpInBadCommunityNames OBJECT-TYPE
+    SYNTAX     Counter32
+    MAX-ACCESS read-only
+    STATUS     current
+    DESCRIPTION
+           "The total number of community-based SNMP messages (for
+           example,  SNMPv1) delivered to the SNMP entity which
+           used an SNMP community name not known to said entity.
+           Also, implementations which authenticate community-based
+           SNMP messages using check(s) in addition to matching
+           the community name (for example, by also checking
+           whether the message originated from a transport address
+           allowed to use a specified community name) MAY include
+           in this value the number of messages which failed the
+           additional check(s).  It is strongly RECOMMENDED that
+
+           the documentation for any security model which is used
+           to authenticate community-based SNMP messages specify
+           the precise conditions that contribute to this value."
+    ::= { snmp 4 }
+
+snmpInBadCommunityUses OBJECT-TYPE
+    SYNTAX     Counter32
+    MAX-ACCESS read-only
+    STATUS     current
+    DESCRIPTION
+           "The total number of community-based SNMP messages (for
+           example, SNMPv1) delivered to the SNMP entity which
+           represented an SNMP operation that was not allowed for
+           the SNMP community named in the message.  The precise
+           conditions under which this counter is incremented
+           (if at all) depend on how the SNMP entity implements
+           its access control mechanism and how its applications
+           interact with that access control mechanism.  It is
+           strongly RECOMMENDED that the documentation for any
+           access control mechanism which is used to control access
+           to and visibility of MIB instrumentation specify the
+           precise conditions that contribute to this value."
+    ::= { snmp 5 }
+
+snmpInASNParseErrs OBJECT-TYPE
+    SYNTAX     Counter32
+    MAX-ACCESS read-only
+    STATUS     current
+    DESCRIPTION
+            "The total number of ASN.1 or BER errors encountered by
+            the SNMP entity when decoding received SNMP messages."
+    ::= { snmp 6 }
+
+snmpEnableAuthenTraps OBJECT-TYPE
+    SYNTAX      INTEGER { enabled(1), disabled(2) }
+    MAX-ACCESS  read-write
+    STATUS      current
+    DESCRIPTION
+            "Indicates whether the SNMP entity is permitted to
+            generate authenticationFailure traps.  The value of this
+            object overrides any configuration information; as such,
+            it provides a means whereby all authenticationFailure
+            traps may be disabled.
+
+            Note that it is strongly recommended that this object
+            be stored in non-volatile memory so that it remains
+            constant across re-initializations of the network
+            management system."
+    ::= { snmp 30 }
+
+snmpSilentDrops OBJECT-TYPE
+    SYNTAX     Counter32
+    MAX-ACCESS read-only
+    STATUS     current
+    DESCRIPTION
+           "The total number of Confirmed Class PDUs (such as
+           GetRequest-PDUs, GetNextRequest-PDUs,
+           GetBulkRequest-PDUs, SetRequest-PDUs, and
+           InformRequest-PDUs) delivered to the SNMP entity which
+           were silently dropped because the size of a reply
+           containing an alternate Response Class PDU (such as a
+           Response-PDU) with an empty variable-bindings field
+           was greater than either a local constraint or the
+           maximum message size associated with the originator of
+           the request."
+    ::= { snmp 31 }
+
+snmpProxyDrops OBJECT-TYPE
+    SYNTAX     Counter32
+    MAX-ACCESS read-only
+    STATUS     current
+    DESCRIPTION
+            "The total number of Confirmed Class PDUs
+            (such as GetRequest-PDUs, GetNextRequest-PDUs,
+            GetBulkRequest-PDUs, SetRequest-PDUs, and
+            InformRequest-PDUs) delivered to the SNMP entity which
+            were silently dropped because the transmission of
+            the (possibly translated) message to a proxy target
+            failed in a manner (other than a time-out) such that
+            no Response Class PDU (such as a Response-PDU) could
+            be returned."
+    ::= { snmp 32 }
+
+-- information for notifications
+--
+-- a collection of objects which allow the SNMP entity, when
+-- supporting a notification originator application,
+-- to be configured to generate SNMPv2-Trap-PDUs.
+
+snmpTrap       OBJECT IDENTIFIER ::= { snmpMIBObjects 4 }
+
+snmpTrapOID OBJECT-TYPE
+    SYNTAX     OBJECT IDENTIFIER
+    MAX-ACCESS accessible-for-notify
+    STATUS     current
+    DESCRIPTION
+            "The authoritative identification of the notification
+            currently being sent.  This variable occurs as
+            the second varbind in every SNMPv2-Trap-PDU and
+            InformRequest-PDU."
+    ::= { snmpTrap 1 }
+
+--  ::= { snmpTrap 2 }   this OID is obsolete
+
+snmpTrapEnterprise OBJECT-TYPE
+    SYNTAX     OBJECT IDENTIFIER
+    MAX-ACCESS accessible-for-notify
+    STATUS     current
+    DESCRIPTION
+            "The authoritative identification of the enterprise
+            associated with the trap currently being sent.  When an
+            SNMP proxy agent is mapping an RFC1157 Trap-PDU
+            into a SNMPv2-Trap-PDU, this variable occurs as the
+            last varbind."
+    ::= { snmpTrap 3 }
+
+--  ::= { snmpTrap 4 }   this OID is obsolete
+
+-- well-known traps
+
+snmpTraps      OBJECT IDENTIFIER ::= { snmpMIBObjects 5 }
+
+coldStart NOTIFICATION-TYPE
+    STATUS  current
+    DESCRIPTION
+            "A coldStart trap signifies that the SNMP entity,
+            supporting a notification originator application, is
+            reinitializing itself and that its configuration may
+            have been altered."
+    ::= { snmpTraps 1 }
+
+warmStart NOTIFICATION-TYPE
+    STATUS  current
+    DESCRIPTION
+            "A warmStart trap signifies that the SNMP entity,
+            supporting a notification originator application,
+            is reinitializing itself such that its configuration
+            is unaltered."
+    ::= { snmpTraps 2 }
+
+-- Note the linkDown NOTIFICATION-TYPE ::= { snmpTraps 3 }
+-- and the linkUp NOTIFICATION-TYPE ::= { snmpTraps 4 }
+-- are defined in RFC 2863 [RFC2863]
+
+authenticationFailure NOTIFICATION-TYPE
+    STATUS  current
+    DESCRIPTION
+            "An authenticationFailure trap signifies that the SNMP
+             entity has received a protocol message that is not
+             properly authenticated.  While all implementations
+             of SNMP entities MAY be capable of generating this
+             trap, the snmpEnableAuthenTraps object indicates
+             whether this trap will be generated."
+    ::= { snmpTraps 5 }
+
+-- Note the egpNeighborLoss notification is defined
+-- as { snmpTraps 6 } in RFC 1213
+
+-- the set group
+--
+-- a collection of objects which allow several cooperating
+-- command generator applications to coordinate their use of the
+-- set operation.
+
+snmpSet        OBJECT IDENTIFIER ::= { snmpMIBObjects 6 }
+
+snmpSetSerialNo OBJECT-TYPE
+    SYNTAX     TestAndIncr
+    MAX-ACCESS read-write
+    STATUS     current
+    DESCRIPTION
+            "An advisory lock used to allow several cooperating
+            command generator applications to coordinate their
+            use of the SNMP set operation.
+
+            This object is used for coarse-grain coordination.
+            To achieve fine-grain coordination, one or more similar
+            objects might be defined within each MIB group, as
+            appropriate."
+    ::= { snmpSet 1 }
+
+-- conformance information
+
+snmpMIBConformance
+               OBJECT IDENTIFIER ::= { snmpMIB 2 }
+
+snmpMIBCompliances
+               OBJECT IDENTIFIER ::= { snmpMIBConformance 1 }
+snmpMIBGroups  OBJECT IDENTIFIER ::= { snmpMIBConformance 2 }
+
+-- compliance statements
+
+--    ::= { snmpMIBCompliances 1 }      this OID is obsolete
+snmpBasicCompliance MODULE-COMPLIANCE
+    STATUS  deprecated
+    DESCRIPTION
+            "The compliance statement for SNMPv2 entities which
+            implement the SNMPv2 MIB.
+
+            This compliance statement is replaced by
+            snmpBasicComplianceRev2."
+    MODULE  -- this module
+        MANDATORY-GROUPS { snmpGroup, snmpSetGroup, systemGroup,
+                           snmpBasicNotificationsGroup }
+
+        GROUP   snmpCommunityGroup
+        DESCRIPTION
+            "This group is mandatory for SNMPv2 entities which
+            support community-based authentication."
+    ::= { snmpMIBCompliances 2 }
+
+snmpBasicComplianceRev2 MODULE-COMPLIANCE
+    STATUS  current
+    DESCRIPTION
+            "The compliance statement for SNMP entities which
+            implement this MIB module."
+    MODULE  -- this module
+        MANDATORY-GROUPS { snmpGroup, snmpSetGroup, systemGroup,
+                           snmpBasicNotificationsGroup }
+
+        GROUP   snmpCommunityGroup
+        DESCRIPTION
+            "This group is mandatory for SNMP entities which
+            support community-based authentication."
+
+        GROUP   snmpWarmStartNotificationGroup
+        DESCRIPTION
+            "This group is mandatory for an SNMP entity which
+            supports command responder applications, and is
+            able to reinitialize itself such that its
+            configuration is unaltered."
+    ::= { snmpMIBCompliances 3 }
+
+-- units of conformance
+
+--  ::= { snmpMIBGroups 1 }           this OID is obsolete
+--  ::= { snmpMIBGroups 2 }           this OID is obsolete
+--  ::= { snmpMIBGroups 3 }           this OID is obsolete
+
+--  ::= { snmpMIBGroups 4 }           this OID is obsolete
+
+snmpGroup OBJECT-GROUP
+    OBJECTS { snmpInPkts,
+              snmpInBadVersions,
+              snmpInASNParseErrs,
+              snmpSilentDrops,
+              snmpProxyDrops,
+              snmpEnableAuthenTraps }
+    STATUS  current
+    DESCRIPTION
+            "A collection of objects providing basic instrumentation
+            and control of an SNMP entity."
+    ::= { snmpMIBGroups 8 }
+
+snmpCommunityGroup OBJECT-GROUP
+    OBJECTS { snmpInBadCommunityNames,
+              snmpInBadCommunityUses }
+    STATUS  current
+    DESCRIPTION
+            "A collection of objects providing basic instrumentation
+            of a SNMP entity which supports community-based
+            authentication."
+    ::= { snmpMIBGroups 9 }
+
+snmpSetGroup OBJECT-GROUP
+    OBJECTS { snmpSetSerialNo }
+    STATUS  current
+    DESCRIPTION
+            "A collection of objects which allow several cooperating
+            command generator applications to coordinate their
+            use of the set operation."
+    ::= { snmpMIBGroups 5 }
+
+systemGroup OBJECT-GROUP
+    OBJECTS { sysDescr, sysObjectID, sysUpTime,
+              sysContact, sysName, sysLocation,
+              sysServices,
+              sysORLastChange, sysORID,
+              sysORUpTime, sysORDescr }
+    STATUS  current
+    DESCRIPTION
+            "The system group defines objects which are common to all
+            managed systems."
+    ::= { snmpMIBGroups 6 }
+
+snmpBasicNotificationsGroup NOTIFICATION-GROUP
+    NOTIFICATIONS { coldStart, authenticationFailure }
+    STATUS        current
+    DESCRIPTION
+       "The basic notifications implemented by an SNMP entity
+        supporting command responder applications."
+    ::= { snmpMIBGroups 7 }
+
+snmpWarmStartNotificationGroup NOTIFICATION-GROUP
+   NOTIFICATIONS { warmStart }
+   STATUS        current
+   DESCRIPTION
+     "An additional notification for an SNMP entity supporting
+     command responder applications, if it is able to reinitialize
+     itself such that its configuration is unaltered."
+  ::= { snmpMIBGroups 11 }
+
+snmpNotificationGroup OBJECT-GROUP
+    OBJECTS { snmpTrapOID, snmpTrapEnterprise }
+    STATUS  current
+    DESCRIPTION
+            "These objects are required for entities
+            which support notification originator applications."
+    ::= { snmpMIBGroups 12 }
+
+-- definitions in RFC 1213 made obsolete by the inclusion of a
+-- subset of the snmp group in this MIB
+
+snmpOutPkts OBJECT-TYPE
+    SYNTAX      Counter32
+    MAX-ACCESS  read-only
+    STATUS      obsolete
+    DESCRIPTION
+            "The total number of SNMP Messages which were
+            passed from the SNMP protocol entity to the
+            transport service."
+    ::= { snmp 2 }
+
+-- { snmp 7 } is not used
+
+snmpInTooBigs OBJECT-TYPE
+    SYNTAX      Counter32
+    MAX-ACCESS  read-only
+    STATUS      obsolete
+    DESCRIPTION
+            "The total number of SNMP PDUs which were
+            delivered to the SNMP protocol entity and for
+            which the value of the error-status field was
+            `tooBig'."
+    ::= { snmp 8 }
+
+snmpInNoSuchNames OBJECT-TYPE
+    SYNTAX      Counter32
+    MAX-ACCESS  read-only
+    STATUS      obsolete
+    DESCRIPTION
+            "The total number of SNMP PDUs which were
+            delivered to the SNMP protocol entity and for
+            which the value of the error-status field was
+            `noSuchName'."
+    ::= { snmp 9 }
+
+snmpInBadValues OBJECT-TYPE
+    SYNTAX      Counter32
+    MAX-ACCESS  read-only
+    STATUS      obsolete
+    DESCRIPTION
+            "The total number of SNMP PDUs which were
+            delivered to the SNMP protocol entity and for
+            which the value of the error-status field was
+            `badValue'."
+    ::= { snmp 10 }
+
+snmpInReadOnlys OBJECT-TYPE
+    SYNTAX      Counter32
+    MAX-ACCESS  read-only
+    STATUS      obsolete
+    DESCRIPTION
+            "The total number valid SNMP PDUs which were delivered
+            to the SNMP protocol entity and for which the value
+            of the error-status field was `readOnly'.  It should
+            be noted that it is a protocol error to generate an
+            SNMP PDU which contains the value `readOnly' in the
+            error-status field, as such this object is provided
+            as a means of detecting incorrect implementations of
+            the SNMP."
+    ::= { snmp 11 }
+
+snmpInGenErrs OBJECT-TYPE
+    SYNTAX      Counter32
+    MAX-ACCESS  read-only
+    STATUS      obsolete
+    DESCRIPTION
+            "The total number of SNMP PDUs which were delivered
+            to the SNMP protocol entity and for which the value
+            of the error-status field was `genErr'."
+    ::= { snmp 12 }
+
+snmpInTotalReqVars OBJECT-TYPE
+    SYNTAX      Counter32
+    MAX-ACCESS  read-only
+    STATUS      obsolete
+    DESCRIPTION
+            "The total number of MIB objects which have been
+            retrieved successfully by the SNMP protocol entity
+            as the result of receiving valid SNMP Get-Request
+            and Get-Next PDUs."
+    ::= { snmp 13 }
+
+snmpInTotalSetVars OBJECT-TYPE
+    SYNTAX      Counter32
+    MAX-ACCESS  read-only
+    STATUS      obsolete
+    DESCRIPTION
+            "The total number of MIB objects which have been
+            altered successfully by the SNMP protocol entity as
+            the result of receiving valid SNMP Set-Request PDUs."
+    ::= { snmp 14 }
+
+snmpInGetRequests OBJECT-TYPE
+    SYNTAX      Counter32
+    MAX-ACCESS  read-only
+    STATUS      obsolete
+    DESCRIPTION
+            "The total number of SNMP Get-Request PDUs which
+            have been accepted and processed by the SNMP
+            protocol entity."
+    ::= { snmp 15 }
+
+snmpInGetNexts OBJECT-TYPE
+    SYNTAX      Counter32
+    MAX-ACCESS  read-only
+    STATUS      obsolete
+    DESCRIPTION
+            "The total number of SNMP Get-Next PDUs which have been
+            accepted and processed by the SNMP protocol entity."
+    ::= { snmp 16 }
+
+snmpInSetRequests OBJECT-TYPE
+    SYNTAX      Counter32
+    MAX-ACCESS  read-only
+    STATUS      obsolete
+    DESCRIPTION
+            "The total number of SNMP Set-Request PDUs which
+            have been accepted and processed by the SNMP protocol
+            entity."
+    ::= { snmp 17 }
+
+snmpInGetResponses OBJECT-TYPE
+    SYNTAX      Counter32
+    MAX-ACCESS  read-only
+    STATUS      obsolete
+    DESCRIPTION
+            "The total number of SNMP Get-Response PDUs which
+            have been accepted and processed by the SNMP protocol
+            entity."
+    ::= { snmp 18 }
+
+snmpInTraps OBJECT-TYPE
+    SYNTAX      Counter32
+    MAX-ACCESS  read-only
+    STATUS      obsolete
+    DESCRIPTION
+            "The total number of SNMP Trap PDUs which have been
+            accepted and processed by the SNMP protocol entity."
+    ::= { snmp 19 }
+
+snmpOutTooBigs OBJECT-TYPE
+    SYNTAX      Counter32
+    MAX-ACCESS  read-only
+    STATUS      obsolete
+    DESCRIPTION
+            "The total number of SNMP PDUs which were generated
+            by the SNMP protocol entity and for which the value
+            of the error-status field was `tooBig.'"
+    ::= { snmp 20 }
+
+snmpOutNoSuchNames OBJECT-TYPE
+    SYNTAX      Counter32
+    MAX-ACCESS  read-only
+    STATUS      obsolete
+    DESCRIPTION
+            "The total number of SNMP PDUs which were generated
+            by the SNMP protocol entity and for which the value
+            of the error-status was `noSuchName'."
+    ::= { snmp 21 }
+
+snmpOutBadValues OBJECT-TYPE
+    SYNTAX      Counter32
+    MAX-ACCESS  read-only
+    STATUS      obsolete
+    DESCRIPTION
+            "The total number of SNMP PDUs which were generated
+            by the SNMP protocol entity and for which the value
+            of the error-status field was `badValue'."
+    ::= { snmp 22 }
+
+-- { snmp 23 } is not used
+
+snmpOutGenErrs OBJECT-TYPE
+    SYNTAX      Counter32
+    MAX-ACCESS  read-only
+    STATUS      obsolete
+    DESCRIPTION
+            "The total number of SNMP PDUs which were generated
+            by the SNMP protocol entity and for which the value
+            of the error-status field was `genErr'."
+    ::= { snmp 24 }
+
+snmpOutGetRequests OBJECT-TYPE
+    SYNTAX      Counter32
+    MAX-ACCESS  read-only
+    STATUS      obsolete
+    DESCRIPTION
+            "The total number of SNMP Get-Request PDUs which
+            have been generated by the SNMP protocol entity."
+    ::= { snmp 25 }
+
+snmpOutGetNexts OBJECT-TYPE
+    SYNTAX      Counter32
+    MAX-ACCESS  read-only
+    STATUS      obsolete
+    DESCRIPTION
+            "The total number of SNMP Get-Next PDUs which have
+            been generated by the SNMP protocol entity."
+    ::= { snmp 26 }
+
+snmpOutSetRequests OBJECT-TYPE
+    SYNTAX      Counter32
+    MAX-ACCESS  read-only
+    STATUS      obsolete
+    DESCRIPTION
+            "The total number of SNMP Set-Request PDUs which
+            have been generated by the SNMP protocol entity."
+    ::= { snmp 27 }
+
+snmpOutGetResponses OBJECT-TYPE
+    SYNTAX      Counter32
+    MAX-ACCESS  read-only
+    STATUS      obsolete
+    DESCRIPTION
+            "The total number of SNMP Get-Response PDUs which
+            have been generated by the SNMP protocol entity."
+    ::= { snmp 28 }
+
+snmpOutTraps OBJECT-TYPE
+    SYNTAX      Counter32
+    MAX-ACCESS  read-only
+    STATUS      obsolete
+    DESCRIPTION
+            "The total number of SNMP Trap PDUs which have
+            been generated by the SNMP protocol entity."
+    ::= { snmp 29 }
+
+snmpObsoleteGroup OBJECT-GROUP
+    OBJECTS { snmpOutPkts, snmpInTooBigs, snmpInNoSuchNames,
+              snmpInBadValues, snmpInReadOnlys, snmpInGenErrs,
+              snmpInTotalReqVars, snmpInTotalSetVars,
+              snmpInGetRequests, snmpInGetNexts, snmpInSetRequests,
+              snmpInGetResponses, snmpInTraps, snmpOutTooBigs,
+              snmpOutNoSuchNames, snmpOutBadValues,
+              snmpOutGenErrs, snmpOutGetRequests, snmpOutGetNexts,
+              snmpOutSetRequests, snmpOutGetResponses, snmpOutTraps
+              }
+    STATUS  obsolete
+    DESCRIPTION
+            "A collection of objects from RFC 1213 made obsolete
+            by this MIB module."
+    ::= { snmpMIBGroups 10 }
+
+END
diff -Naur tomato/release/src/router/snmp/mibs/SNMPv2-SMI.txt tomato121/release/src/router/snmp/mibs/SNMPv2-SMI.txt
--- tomato/release/src/router/snmp/mibs/SNMPv2-SMI.txt	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/mibs/SNMPv2-SMI.txt	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,344 @@
+SNMPv2-SMI DEFINITIONS ::= BEGIN
+
+-- the path to the root
+
+org            OBJECT IDENTIFIER ::= { iso 3 }  --  "iso" = 1
+dod            OBJECT IDENTIFIER ::= { org 6 }
+internet       OBJECT IDENTIFIER ::= { dod 1 }
+
+directory      OBJECT IDENTIFIER ::= { internet 1 }
+
+mgmt           OBJECT IDENTIFIER ::= { internet 2 }
+mib-2          OBJECT IDENTIFIER ::= { mgmt 1 }
+transmission   OBJECT IDENTIFIER ::= { mib-2 10 }
+
+experimental   OBJECT IDENTIFIER ::= { internet 3 }
+
+private        OBJECT IDENTIFIER ::= { internet 4 }
+enterprises    OBJECT IDENTIFIER ::= { private 1 }
+
+security       OBJECT IDENTIFIER ::= { internet 5 }
+
+snmpV2         OBJECT IDENTIFIER ::= { internet 6 }
+
+-- transport domains
+snmpDomains    OBJECT IDENTIFIER ::= { snmpV2 1 }
+
+-- transport proxies
+snmpProxys     OBJECT IDENTIFIER ::= { snmpV2 2 }
+
+-- module identities
+snmpModules    OBJECT IDENTIFIER ::= { snmpV2 3 }
+
+-- Extended UTCTime, to allow dates with four-digit years
+-- (Note that this definition of ExtUTCTime is not to be IMPORTed
+--  by MIB modules.)
+ExtUTCTime ::= OCTET STRING(SIZE(11 | 13))
+    -- format is YYMMDDHHMMZ or YYYYMMDDHHMMZ
+
+    --   where: YY   - last two digits of year (only years
+    --                 between 1900-1999)
+    --          YYYY - last four digits of the year (any year)
+    --          MM   - month (01 through 12)
+    --          DD   - day of month (01 through 31)
+    --          HH   - hours (00 through 23)
+    --          MM   - minutes (00 through 59)
+    --          Z    - denotes GMT (the ASCII character Z)
+    --
+    -- For example, "9502192015Z" and "199502192015Z" represent
+    -- 8:15pm GMT on 19 February 1995. Years after 1999 must use
+    -- the four digit year format. Years 1900-1999 may use the
+    -- two or four digit format.
+
+-- definitions for information modules
+
+MODULE-IDENTITY MACRO ::=
+BEGIN
+    TYPE NOTATION ::=
+                  "LAST-UPDATED" value(Update ExtUTCTime)
+                  "ORGANIZATION" Text
+                  "CONTACT-INFO" Text
+                  "DESCRIPTION" Text
+                  RevisionPart
+
+    VALUE NOTATION ::=
+                  value(VALUE OBJECT IDENTIFIER)
+
+    RevisionPart ::=
+                  Revisions
+                | empty
+    Revisions ::=
+                  Revision
+                | Revisions Revision
+    Revision ::=
+                  "REVISION" value(Update ExtUTCTime)
+                  "DESCRIPTION" Text
+
+    -- a character string as defined in section 3.1.1
+    Text ::= value(IA5String)
+END
+
+OBJECT-IDENTITY MACRO ::=
+BEGIN
+    TYPE NOTATION ::=
+                  "STATUS" Status
+                  "DESCRIPTION" Text
+
+                  ReferPart
+
+    VALUE NOTATION ::=
+                  value(VALUE OBJECT IDENTIFIER)
+
+    Status ::=
+                  "current"
+                | "deprecated"
+                | "obsolete"
+
+    ReferPart ::=
+                  "REFERENCE" Text
+                | empty
+
+    -- a character string as defined in section 3.1.1
+    Text ::= value(IA5String)
+END
+
+-- names of objects
+-- (Note that these definitions of ObjectName and NotificationName
+--  are not to be IMPORTed by MIB modules.)
+
+ObjectName ::=
+    OBJECT IDENTIFIER
+
+NotificationName ::=
+    OBJECT IDENTIFIER
+
+-- syntax of objects
+
+-- the "base types" defined here are:
+--   3 built-in ASN.1 types: INTEGER, OCTET STRING, OBJECT IDENTIFIER
+--   8 application-defined types: Integer32, IpAddress, Counter32,
+--              Gauge32, Unsigned32, TimeTicks, Opaque, and Counter64
+
+ObjectSyntax ::=
+    CHOICE {
+        simple
+            SimpleSyntax,
+          -- note that SEQUENCEs for conceptual tables and
+          -- rows are not mentioned here...
+
+        application-wide
+            ApplicationSyntax
+    }
+
+-- built-in ASN.1 types
+
+SimpleSyntax ::=
+    CHOICE {
+        -- INTEGERs with a more restrictive range
+        -- may also be used
+        integer-value               -- includes Integer32
+            INTEGER (-2147483648..2147483647),
+        -- OCTET STRINGs with a more restrictive size
+        -- may also be used
+        string-value
+            OCTET STRING (SIZE (0..65535)),
+        objectID-value
+            OBJECT IDENTIFIER
+    }
+
+-- indistinguishable from INTEGER, but never needs more than
+-- 32-bits for a two's complement representation
+Integer32 ::=
+        INTEGER (-2147483648..2147483647)
+
+-- application-wide types
+
+ApplicationSyntax ::=
+    CHOICE {
+        ipAddress-value
+            IpAddress,
+        counter-value
+            Counter32,
+        timeticks-value
+            TimeTicks,
+        arbitrary-value
+            Opaque,
+        big-counter-value
+            Counter64,
+        unsigned-integer-value  -- includes Gauge32
+            Unsigned32
+    }
+
+-- in network-byte order
+
+-- (this is a tagged type for historical reasons)
+IpAddress ::=
+    [APPLICATION 0]
+        IMPLICIT OCTET STRING (SIZE (4))
+
+-- this wraps
+Counter32 ::=
+    [APPLICATION 1]
+        IMPLICIT INTEGER (0..4294967295)
+
+-- this doesn't wrap
+Gauge32 ::=
+    [APPLICATION 2]
+        IMPLICIT INTEGER (0..4294967295)
+
+-- an unsigned 32-bit quantity
+-- indistinguishable from Gauge32
+Unsigned32 ::=
+    [APPLICATION 2]
+        IMPLICIT INTEGER (0..4294967295)
+
+-- hundredths of seconds since an epoch
+TimeTicks ::=
+    [APPLICATION 3]
+        IMPLICIT INTEGER (0..4294967295)
+
+-- for backward-compatibility only
+Opaque ::=
+    [APPLICATION 4]
+        IMPLICIT OCTET STRING
+
+-- for counters that wrap in less than one hour with only 32 bits
+Counter64 ::=
+    [APPLICATION 6]
+        IMPLICIT INTEGER (0..18446744073709551615)
+
+-- definition for objects
+
+OBJECT-TYPE MACRO ::=
+BEGIN
+    TYPE NOTATION ::=
+                  "SYNTAX" Syntax
+                  UnitsPart
+                  "MAX-ACCESS" Access
+                  "STATUS" Status
+                  "DESCRIPTION" Text
+                  ReferPart
+
+                  IndexPart
+                  DefValPart
+
+    VALUE NOTATION ::=
+                  value(VALUE ObjectName)
+
+    Syntax ::=   -- Must be one of the following:
+                       -- a base type (or its refinement),
+                       -- a textual convention (or its refinement), or
+                       -- a BITS pseudo-type
+                   type
+                | "BITS" "{" NamedBits "}"
+
+    NamedBits ::= NamedBit
+                | NamedBits "," NamedBit
+
+    NamedBit ::=  identifier "(" number ")" -- number is nonnegative
+
+    UnitsPart ::=
+                  "UNITS" Text
+                | empty
+
+    Access ::=
+                  "not-accessible"
+                | "accessible-for-notify"
+                | "read-only"
+                | "read-write"
+                | "read-create"
+
+    Status ::=
+                  "current"
+                | "deprecated"
+                | "obsolete"
+
+    ReferPart ::=
+                  "REFERENCE" Text
+                | empty
+
+    IndexPart ::=
+                  "INDEX"    "{" IndexTypes "}"
+                | "AUGMENTS" "{" Entry      "}"
+                | empty
+    IndexTypes ::=
+                  IndexType
+                | IndexTypes "," IndexType
+    IndexType ::=
+                  "IMPLIED" Index
+                | Index
+
+    Index ::=
+                    -- use the SYNTAX value of the
+                    -- correspondent OBJECT-TYPE invocation
+                  value(ObjectName)
+    Entry ::=
+                    -- use the INDEX value of the
+                    -- correspondent OBJECT-TYPE invocation
+                  value(ObjectName)
+
+    DefValPart ::= "DEFVAL" "{" Defvalue "}"
+                | empty
+
+    Defvalue ::=  -- must be valid for the type specified in
+                  -- SYNTAX clause of same OBJECT-TYPE macro
+                  value(ObjectSyntax)
+                | "{" BitsValue "}"
+
+    BitsValue ::= BitNames
+                | empty
+
+    BitNames ::=  BitName
+                | BitNames "," BitName
+
+    BitName ::= identifier
+
+    -- a character string as defined in section 3.1.1
+    Text ::= value(IA5String)
+END
+
+-- definitions for notifications
+
+NOTIFICATION-TYPE MACRO ::=
+BEGIN
+    TYPE NOTATION ::=
+                  ObjectsPart
+                  "STATUS" Status
+                  "DESCRIPTION" Text
+                  ReferPart
+
+    VALUE NOTATION ::=
+                  value(VALUE NotificationName)
+
+    ObjectsPart ::=
+                  "OBJECTS" "{" Objects "}"
+                | empty
+    Objects ::=
+                  Object
+
+                | Objects "," Object
+    Object ::=
+                  value(ObjectName)
+
+    Status ::=
+                  "current"
+                | "deprecated"
+                | "obsolete"
+
+    ReferPart ::=
+                  "REFERENCE" Text
+                | empty
+
+    -- a character string as defined in section 3.1.1
+    Text ::= value(IA5String)
+END
+
+-- definitions of administrative identifiers
+
+zeroDotZero    OBJECT-IDENTITY
+    STATUS     current
+    DESCRIPTION
+            "A value used for null identifiers."
+    ::= { 0 0 }
+
+END
diff -Naur tomato/release/src/router/snmp/mibs/SNMPv2-TC.txt tomato121/release/src/router/snmp/mibs/SNMPv2-TC.txt
--- tomato/release/src/router/snmp/mibs/SNMPv2-TC.txt	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/mibs/SNMPv2-TC.txt	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,772 @@
+SNMPv2-TC DEFINITIONS ::= BEGIN
+
+IMPORTS
+    TimeTicks         FROM SNMPv2-SMI;
+
+-- definition of textual conventions
+
+TEXTUAL-CONVENTION MACRO ::=
+
+BEGIN
+    TYPE NOTATION ::=
+                  DisplayPart
+                  "STATUS" Status
+                  "DESCRIPTION" Text
+                  ReferPart
+                  "SYNTAX" Syntax
+
+    VALUE NOTATION ::=
+                   value(VALUE Syntax)      -- adapted ASN.1
+
+    DisplayPart ::=
+                  "DISPLAY-HINT" Text
+                | empty
+
+    Status ::=
+                  "current"
+                | "deprecated"
+                | "obsolete"
+
+    ReferPart ::=
+                  "REFERENCE" Text
+                | empty
+
+    -- a character string as defined in [2]
+    Text ::= value(IA5String)
+
+    Syntax ::=   -- Must be one of the following:
+                       -- a base type (or its refinement), or
+                       -- a BITS pseudo-type
+                  type
+                | "BITS" "{" NamedBits "}"
+
+    NamedBits ::= NamedBit
+                | NamedBits "," NamedBit
+
+    NamedBit ::=  identifier "(" number ")" -- number is nonnegative
+
+END
+
+DisplayString ::= TEXTUAL-CONVENTION
+    DISPLAY-HINT "255a"
+    STATUS       current
+    DESCRIPTION
+            "Represents textual information taken from the NVT ASCII
+
+            character set, as defined in pages 4, 10-11 of RFC 854.
+
+            To summarize RFC 854, the NVT ASCII repertoire specifies:
+
+              - the use of character codes 0-127 (decimal)
+
+              - the graphics characters (32-126) are interpreted as
+                US ASCII
+
+              - NUL, LF, CR, BEL, BS, HT, VT and FF have the special
+                meanings specified in RFC 854
+
+              - the other 25 codes have no standard interpretation
+
+              - the sequence 'CR LF' means newline
+
+              - the sequence 'CR NUL' means carriage-return
+
+              - an 'LF' not preceded by a 'CR' means moving to the
+                same column on the next line.
+
+              - the sequence 'CR x' for any x other than LF or NUL is
+                illegal.  (Note that this also means that a string may
+                end with either 'CR LF' or 'CR NUL', but not with CR.)
+
+            Any object defined using this syntax may not exceed 255
+            characters in length."
+    SYNTAX       OCTET STRING (SIZE (0..255))
+
+PhysAddress ::= TEXTUAL-CONVENTION
+    DISPLAY-HINT "1x:"
+    STATUS       current
+    DESCRIPTION
+            "Represents media- or physical-level addresses."
+    SYNTAX       OCTET STRING
+
+MacAddress ::= TEXTUAL-CONVENTION
+    DISPLAY-HINT "1x:"
+    STATUS       current
+    DESCRIPTION
+            "Represents an 802 MAC address represented in the
+            `canonical' order defined by IEEE 802.1a, i.e., as if it
+            were transmitted least significant bit first, even though
+            802.5 (in contrast to other 802.x protocols) requires MAC
+            addresses to be transmitted most significant bit first."
+    SYNTAX       OCTET STRING (SIZE (6))
+
+TruthValue ::= TEXTUAL-CONVENTION
+    STATUS       current
+    DESCRIPTION
+            "Represents a boolean value."
+    SYNTAX       INTEGER { true(1), false(2) }
+
+TestAndIncr ::= TEXTUAL-CONVENTION
+    STATUS       current
+    DESCRIPTION
+            "Represents integer-valued information used for atomic
+            operations.  When the management protocol is used to specify
+            that an object instance having this syntax is to be
+            modified, the new value supplied via the management protocol
+            must precisely match the value presently held by the
+            instance.  If not, the management protocol set operation
+            fails with an error of `inconsistentValue'.  Otherwise, if
+            the current value is the maximum value of 2^31-1 (2147483647
+            decimal), then the value held by the instance is wrapped to
+            zero; otherwise, the value held by the instance is
+            incremented by one.  (Note that regardless of whether the
+            management protocol set operation succeeds, the variable-
+            binding in the request and response PDUs are identical.)
+
+            The value of the ACCESS clause for objects having this
+            syntax is either `read-write' or `read-create'.  When an
+            instance of a columnar object having this syntax is created,
+            any value may be supplied via the management protocol.
+
+            When the network management portion of the system is re-
+            initialized, the value of every object instance having this
+            syntax must either be incremented from its value prior to
+            the re-initialization, or (if the value prior to the re-
+            initialization is unknown) be set to a pseudo-randomly
+            generated value."
+    SYNTAX       INTEGER (0..2147483647)
+
+AutonomousType ::= TEXTUAL-CONVENTION
+    STATUS       current
+    DESCRIPTION
+            "Represents an independently extensible type identification
+            value.  It may, for example, indicate a particular sub-tree
+            with further MIB definitions, or define a particular type of
+            protocol or hardware."
+    SYNTAX       OBJECT IDENTIFIER
+
+InstancePointer ::= TEXTUAL-CONVENTION
+    STATUS       obsolete
+    DESCRIPTION
+            "A pointer to either a specific instance of a MIB object or
+            a conceptual row of a MIB table in the managed device.  In
+            the latter case, by convention, it is the name of the
+            particular instance of the first accessible columnar object
+            in the conceptual row.
+
+            The two uses of this textual convention are replaced by
+            VariablePointer and RowPointer, respectively."
+    SYNTAX       OBJECT IDENTIFIER
+
+VariablePointer ::= TEXTUAL-CONVENTION
+    STATUS       current
+    DESCRIPTION
+            "A pointer to a specific object instance.  For example,
+            sysContact.0 or ifInOctets.3."
+    SYNTAX       OBJECT IDENTIFIER
+
+RowPointer ::= TEXTUAL-CONVENTION
+    STATUS       current
+    DESCRIPTION
+            "Represents a pointer to a conceptual row.  The value is the
+            name of the instance of the first accessible columnar object
+            in the conceptual row.
+
+            For example, ifIndex.3 would point to the 3rd row in the
+            ifTable (note that if ifIndex were not-accessible, then
+            ifDescr.3 would be used instead)."
+    SYNTAX       OBJECT IDENTIFIER
+
+RowStatus ::= TEXTUAL-CONVENTION
+    STATUS       current
+    DESCRIPTION
+            "The RowStatus textual convention is used to manage the
+            creation and deletion of conceptual rows, and is used as the
+            value of the SYNTAX clause for the status column of a
+            conceptual row (as described in Section 7.7.1 of [2].)
+
+            The status column has six defined values:
+
+                 - `active', which indicates that the conceptual row is
+                 available for use by the managed device;
+
+                 - `notInService', which indicates that the conceptual
+                 row exists in the agent, but is unavailable for use by
+                 the managed device (see NOTE below); 'notInService' has
+                 no implication regarding the internal consistency of
+                 the row, availability of resources, or consistency with
+                 the current state of the managed device;
+
+                 - `notReady', which indicates that the conceptual row
+                 exists in the agent, but is missing information
+                 necessary in order to be available for use by the
+                 managed device (i.e., one or more required columns in
+                 the conceptual row have not been instanciated);
+
+                 - `createAndGo', which is supplied by a management
+                 station wishing to create a new instance of a
+                 conceptual row and to have its status automatically set
+                 to active, making it available for use by the managed
+                 device;
+
+                 - `createAndWait', which is supplied by a management
+                 station wishing to create a new instance of a
+                 conceptual row (but not make it available for use by
+                 the managed device); and,
+                 - `destroy', which is supplied by a management station
+                 wishing to delete all of the instances associated with
+                 an existing conceptual row.
+
+            Whereas five of the six values (all except `notReady') may
+            be specified in a management protocol set operation, only
+            three values will be returned in response to a management
+            protocol retrieval operation:  `notReady', `notInService' or
+            `active'.  That is, when queried, an existing conceptual row
+            has only three states:  it is either available for use by
+            the managed device (the status column has value `active');
+            it is not available for use by the managed device, though
+            the agent has sufficient information to attempt to make it
+            so (the status column has value `notInService'); or, it is
+            not available for use by the managed device, and an attempt
+            to make it so would fail because the agent has insufficient
+            information (the state column has value `notReady').
+
+                                     NOTE WELL
+
+                 This textual convention may be used for a MIB table,
+                 irrespective of whether the values of that table's
+                 conceptual rows are able to be modified while it is
+                 active, or whether its conceptual rows must be taken
+                 out of service in order to be modified.  That is, it is
+                 the responsibility of the DESCRIPTION clause of the
+                 status column to specify whether the status column must
+                 not be `active' in order for the value of some other
+                 column of the same conceptual row to be modified.  If
+                 such a specification is made, affected columns may be
+                 changed by an SNMP set PDU if the RowStatus would not
+                 be equal to `active' either immediately before or after
+                 processing the PDU.  In other words, if the PDU also
+                 contained a varbind that would change the RowStatus
+                 value, the column in question may be changed if the
+                 RowStatus was not equal to `active' as the PDU was
+                 received, or if the varbind sets the status to a value
+                 other than 'active'.
+
+            Also note that whenever any elements of a row exist, the
+            RowStatus column must also exist.
+
+            To summarize the effect of having a conceptual row with a
+            status column having a SYNTAX clause value of RowStatus,
+            consider the following state diagram:
+
+                                         STATE
+              +--------------+-----------+-------------+-------------
+              |      A       |     B     |      C      |      D
+              |              |status col.|status column|
+              |status column |    is     |      is     |status column
+    ACTION    |does not exist|  notReady | notInService|  is active
+--------------+--------------+-----------+-------------+-------------
+set status    |noError    ->D|inconsist- |inconsistent-|inconsistent-
+column to     |       or     |   entValue|        Value|        Value
+createAndGo   |inconsistent- |           |             |
+              |         Value|           |             |
+--------------+--------------+-----------+-------------+-------------
+set status    |noError  see 1|inconsist- |inconsistent-|inconsistent-
+column to     |       or     |   entValue|        Value|        Value
+createAndWait |wrongValue    |           |             |
+--------------+--------------+-----------+-------------+-------------
+set status    |inconsistent- |inconsist- |noError      |noError
+column to     |         Value|   entValue|             |
+active        |              |           |             |
+              |              |     or    |             |
+              |              |           |             |
+              |              |see 2   ->D|see 8     ->D|          ->D
+--------------+--------------+-----------+-------------+-------------
+set status    |inconsistent- |inconsist- |noError      |noError   ->C
+column to     |         Value|   entValue|             |
+notInService  |              |           |             |
+              |              |     or    |             |      or
+              |              |           |             |
+              |              |see 3   ->C|          ->C|see 6
+--------------+--------------+-----------+-------------+-------------
+set status    |noError       |noError    |noError      |noError   ->A
+column to     |              |           |             |      or
+destroy       |           ->A|        ->A|          ->A|see 7
+--------------+--------------+-----------+-------------+-------------
+set any other |see 4         |noError    |noError      |see 5
+column to some|              |           |             |
+value         |              |      see 1|          ->C|          ->D
+--------------+--------------+-----------+-------------+-------------
+
+            (1) goto B or C, depending on information available to the
+            agent.
+
+            (2) if other variable bindings included in the same PDU,
+            provide values for all columns which are missing but
+            required, and all columns have acceptable values, then
+            return noError and goto D.
+
+            (3) if other variable bindings included in the same PDU,
+            provide legal values for all columns which are missing but
+            required, then return noError and goto C.
+
+            (4) at the discretion of the agent, the return value may be
+            either:
+
+                 inconsistentName:  because the agent does not choose to
+                 create such an instance when the corresponding
+                 RowStatus instance does not exist, or
+
+                 inconsistentValue:  if the supplied value is
+                 inconsistent with the state of some other MIB object's
+                 value, or
+
+                 noError: because the agent chooses to create the
+                 instance.
+
+            If noError is returned, then the instance of the status
+            column must also be created, and the new state is B or C,
+            depending on the information available to the agent.  If
+            inconsistentName or inconsistentValue is returned, the row
+            remains in state A.
+
+            (5) depending on the MIB definition for the column/table,
+            either noError or inconsistentValue may be returned.
+
+            (6) the return value can indicate one of the following
+            errors:
+
+                 wrongValue: because the agent does not support
+                 notInService (e.g., an agent which does not support
+                 createAndWait), or
+
+                 inconsistentValue: because the agent is unable to take
+                 the row out of service at this time, perhaps because it
+                 is in use and cannot be de-activated.
+
+            (7) the return value can indicate the following error:
+
+                 inconsistentValue: because the agent is unable to
+                 remove the row at this time, perhaps because it is in
+                 use and cannot be de-activated.
+
+            (8) the transition to D can fail, e.g., if the values of the
+            conceptual row are inconsistent, then the error code would
+            be inconsistentValue.
+
+            NOTE: Other processing of (this and other varbinds of) the
+            set request may result in a response other than noError
+            being returned, e.g., wrongValue, noCreation, etc.
+
+                              Conceptual Row Creation
+
+            There are four potential interactions when creating a
+            conceptual row:  selecting an instance-identifier which is
+            not in use; creating the conceptual row; initializing any
+            objects for which the agent does not supply a default; and,
+            making the conceptual row available for use by the managed
+            device.
+
+            Interaction 1: Selecting an Instance-Identifier
+
+            The algorithm used to select an instance-identifier varies
+            for each conceptual row.  In some cases, the instance-
+            identifier is semantically significant, e.g., the
+            destination address of a route, and a management station
+            selects the instance-identifier according to the semantics.
+
+            In other cases, the instance-identifier is used solely to
+            distinguish conceptual rows, and a management station
+            without specific knowledge of the conceptual row might
+            examine the instances present in order to determine an
+            unused instance-identifier.  (This approach may be used, but
+            it is often highly sub-optimal; however, it is also a
+            questionable practice for a naive management station to
+            attempt conceptual row creation.)
+
+            Alternately, the MIB module which defines the conceptual row
+            might provide one or more objects which provide assistance
+            in determining an unused instance-identifier.  For example,
+            if the conceptual row is indexed by an integer-value, then
+            an object having an integer-valued SYNTAX clause might be
+            defined for such a purpose, allowing a management station to
+            issue a management protocol retrieval operation.  In order
+            to avoid unnecessary collisions between competing management
+            stations, `adjacent' retrievals of this object should be
+            different.
+
+            Finally, the management station could select a pseudo-random
+            number to use as the index.  In the event that this index
+
+            was already in use and an inconsistentValue was returned in
+            response to the management protocol set operation, the
+            management station should simply select a new pseudo-random
+            number and retry the operation.
+
+            A MIB designer should choose between the two latter
+            algorithms based on the size of the table (and therefore the
+            efficiency of each algorithm).  For tables in which a large
+            number of entries are expected, it is recommended that a MIB
+            object be defined that returns an acceptable index for
+            creation.  For tables with small numbers of entries, it is
+            recommended that the latter pseudo-random index mechanism be
+            used.
+
+            Interaction 2: Creating the Conceptual Row
+
+            Once an unused instance-identifier has been selected, the
+            management station determines if it wishes to create and
+            activate the conceptual row in one transaction or in a
+            negotiated set of interactions.
+
+            Interaction 2a: Creating and Activating the Conceptual Row
+
+            The management station must first determine the column
+            requirements, i.e., it must determine those columns for
+            which it must or must not provide values.  Depending on the
+            complexity of the table and the management station's
+            knowledge of the agent's capabilities, this determination
+            can be made locally by the management station.  Alternately,
+            the management station issues a management protocol get
+            operation to examine all columns in the conceptual row that
+            it wishes to create.  In response, for each column, there
+            are three possible outcomes:
+
+                 - a value is returned, indicating that some other
+                 management station has already created this conceptual
+                 row.  We return to interaction 1.
+
+                 - the exception `noSuchInstance' is returned,
+                 indicating that the agent implements the object-type
+                 associated with this column, and that this column in at
+                 least one conceptual row would be accessible in the MIB
+                 view used by the retrieval were it to exist. For those
+                 columns to which the agent provides read-create access,
+                 the `noSuchInstance' exception tells the management
+                 station that it should supply a value for this column
+                 when the conceptual row is to be created.
+
+                 - the exception `noSuchObject' is returned, indicating
+                 that the agent does not implement the object-type
+                 associated with this column or that there is no
+                 conceptual row for which this column would be
+                 accessible in the MIB view used by the retrieval.  As
+                 such, the management station can not issue any
+                 management protocol set operations to create an
+                 instance of this column.
+
+            Once the column requirements have been determined, a
+            management protocol set operation is accordingly issued.
+            This operation also sets the new instance of the status
+            column to `createAndGo'.
+
+            When the agent processes the set operation, it verifies that
+            it has sufficient information to make the conceptual row
+            available for use by the managed device.  The information
+            available to the agent is provided by two sources:  the
+            management protocol set operation which creates the
+            conceptual row, and, implementation-specific defaults
+            supplied by the agent (note that an agent must provide
+            implementation-specific defaults for at least those objects
+            which it implements as read-only).  If there is sufficient
+            information available, then the conceptual row is created, a
+            `noError' response is returned, the status column is set to
+            `active', and no further interactions are necessary (i.e.,
+            interactions 3 and 4 are skipped).  If there is insufficient
+            information, then the conceptual row is not created, and the
+            set operation fails with an error of `inconsistentValue'.
+            On this error, the management station can issue a management
+            protocol retrieval operation to determine if this was
+            because it failed to specify a value for a required column,
+            or, because the selected instance of the status column
+            already existed.  In the latter case, we return to
+            interaction 1.  In the former case, the management station
+            can re-issue the set operation with the additional
+            information, or begin interaction 2 again using
+            `createAndWait' in order to negotiate creation of the
+            conceptual row.
+
+                                     NOTE WELL
+
+                 Regardless of the method used to determine the column
+                 requirements, it is possible that the management
+                 station might deem a column necessary when, in fact,
+                 the agent will not allow that particular columnar
+                 instance to be created or written.  In this case, the
+                 management protocol set operation will fail with an
+                 error such as `noCreation' or `notWritable'.  In this
+                 case, the management station decides whether it needs
+                 to be able to set a value for that particular columnar
+                 instance.  If not, the management station re-issues the
+                 management protocol set operation, but without setting
+                 a value for that particular columnar instance;
+                 otherwise, the management station aborts the row
+                 creation algorithm.
+
+            Interaction 2b: Negotiating the Creation of the Conceptual
+            Row
+
+            The management station issues a management protocol set
+            operation which sets the desired instance of the status
+            column to `createAndWait'.  If the agent is unwilling to
+            process a request of this sort, the set operation fails with
+            an error of `wrongValue'.  (As a consequence, such an agent
+            must be prepared to accept a single management protocol set
+            operation, i.e., interaction 2a above, containing all of the
+            columns indicated by its column requirements.)  Otherwise,
+            the conceptual row is created, a `noError' response is
+            returned, and the status column is immediately set to either
+            `notInService' or `notReady', depending on whether it has
+            sufficient information to (attempt to) make the conceptual
+            row available for use by the managed device.  If there is
+            sufficient information available, then the status column is
+            set to `notInService'; otherwise, if there is insufficient
+            information, then the status column is set to `notReady'.
+            Regardless, we proceed to interaction 3.
+
+            Interaction 3: Initializing non-defaulted Objects
+
+            The management station must now determine the column
+            requirements.  It issues a management protocol get operation
+            to examine all columns in the created conceptual row.  In
+            the response, for each column, there are three possible
+            outcomes:
+
+                 - a value is returned, indicating that the agent
+                 implements the object-type associated with this column
+                 and had sufficient information to provide a value.  For
+                 those columns to which the agent provides read-create
+                 access (and for which the agent allows their values to
+                 be changed after their creation), a value return tells
+                 the management station that it may issue additional
+                 management protocol set operations, if it desires, in
+                 order to change the value associated with this column.
+
+                 - the exception `noSuchInstance' is returned,
+                 indicating that the agent implements the object-type
+                 associated with this column, and that this column in at
+                 least one conceptual row would be accessible in the MIB
+                 view used by the retrieval were it to exist. However,
+                 the agent does not have sufficient information to
+                 provide a value, and until a value is provided, the
+                 conceptual row may not be made available for use by the
+                 managed device.  For those columns to which the agent
+                 provides read-create access, the `noSuchInstance'
+                 exception tells the management station that it must
+                 issue additional management protocol set operations, in
+                 order to provide a value associated with this column.
+
+                 - the exception `noSuchObject' is returned, indicating
+                 that the agent does not implement the object-type
+                 associated with this column or that there is no
+                 conceptual row for which this column would be
+                 accessible in the MIB view used by the retrieval.  As
+                 such, the management station can not issue any
+                 management protocol set operations to create an
+                 instance of this column.
+
+            If the value associated with the status column is
+            `notReady', then the management station must first deal with
+            all `noSuchInstance' columns, if any.  Having done so, the
+            value of the status column becomes `notInService', and we
+            proceed to interaction 4.
+
+            Interaction 4: Making the Conceptual Row Available
+
+            Once the management station is satisfied with the values
+            associated with the columns of the conceptual row, it issues
+            a management protocol set operation to set the status column
+            to `active'.  If the agent has sufficient information to
+            make the conceptual row available for use by the managed
+            device, the management protocol set operation succeeds (a
+            `noError' response is returned).  Otherwise, the management
+            protocol set operation fails with an error of
+            `inconsistentValue'.
+
+                                     NOTE WELL
+
+                 A conceptual row having a status column with value
+                 `notInService' or `notReady' is unavailable to the
+                 managed device.  As such, it is possible for the
+                 managed device to create its own instances during the
+                 time between the management protocol set operation
+                 which sets the status column to `createAndWait' and the
+                 management protocol set operation which sets the status
+                 column to `active'.  In this case, when the management
+                 protocol set operation is issued to set the status
+                 column to `active', the values held in the agent
+                 supersede those used by the managed device.
+
+            If the management station is prevented from setting the
+            status column to `active' (e.g., due to management station
+            or network failure) the conceptual row will be left in the
+            `notInService' or `notReady' state, consuming resources
+            indefinitely.  The agent must detect conceptual rows that
+            have been in either state for an abnormally long period of
+            time and remove them.  It is the responsibility of the
+            DESCRIPTION clause of the status column to indicate what an
+            abnormally long period of time would be.  This period of
+            time should be long enough to allow for human response time
+            (including `think time') between the creation of the
+            conceptual row and the setting of the status to `active'.
+            In the absence of such information in the DESCRIPTION
+            clause, it is suggested that this period be approximately 5
+            minutes in length.  This removal action applies not only to
+            newly-created rows, but also to previously active rows which
+            are set to, and left in, the notInService state for a
+            prolonged period exceeding that which is considered normal
+            for such a conceptual row.
+
+                             Conceptual Row Suspension
+
+            When a conceptual row is `active', the management station
+            may issue a management protocol set operation which sets the
+            instance of the status column to `notInService'.  If the
+            agent is unwilling to do so, the set operation fails with an
+            error of `wrongValue' or `inconsistentValue'.  Otherwise,
+            the conceptual row is taken out of service, and a `noError'
+            response is returned.  It is the responsibility of the
+            DESCRIPTION clause of the status column to indicate under
+            what circumstances the status column should be taken out of
+            service (e.g., in order for the value of some other column
+            of the same conceptual row to be modified).
+
+                              Conceptual Row Deletion
+
+            For deletion of conceptual rows, a management protocol set
+            operation is issued which sets the instance of the status
+            column to `destroy'.  This request may be made regardless of
+            the current value of the status column (e.g., it is possible
+            to delete conceptual rows which are either `notReady',
+            `notInService' or `active'.)  If the operation succeeds,
+            then all instances associated with the conceptual row are
+            immediately removed."
+    SYNTAX       INTEGER {
+                     -- the following two values are states:
+                     -- these values may be read or written
+                     active(1),
+                     notInService(2),
+                     -- the following value is a state:
+                     -- this value may be read, but not written
+                     notReady(3),
+                     -- the following three values are
+                     -- actions: these values may be written,
+                     --   but are never read
+                     createAndGo(4),
+                     createAndWait(5),
+                     destroy(6)
+                 }
+
+TimeStamp ::= TEXTUAL-CONVENTION
+    STATUS       current
+    DESCRIPTION
+            "The value of the sysUpTime object at which a specific
+            occurrence happened.  The specific occurrence must be
+
+            defined in the description of any object defined using this
+            type.
+
+            If sysUpTime is reset to zero as a result of a re-
+            initialization of the network management (sub)system, then
+            the values of all TimeStamp objects are also reset.
+            However, after approximately 497 days without a re-
+            initialization, the sysUpTime object will reach 2^^32-1 and
+            then increment around to zero; in this case, existing values
+            of TimeStamp objects do not change.  This can lead to
+            ambiguities in the value of TimeStamp objects."
+    SYNTAX       TimeTicks
+
+TimeInterval ::= TEXTUAL-CONVENTION
+    STATUS       current
+    DESCRIPTION
+            "A period of time, measured in units of 0.01 seconds."
+    SYNTAX       INTEGER (0..2147483647)
+
+DateAndTime ::= TEXTUAL-CONVENTION
+    DISPLAY-HINT "2d-1d-1d,1d:1d:1d.1d,1a1d:1d"
+    STATUS       current
+    DESCRIPTION
+            "A date-time specification.
+
+            field  octets  contents                  range
+            -----  ------  --------                  -----
+              1      1-2   year*                     0..65536
+              2       3    month                     1..12
+              3       4    day                       1..31
+              4       5    hour                      0..23
+              5       6    minutes                   0..59
+              6       7    seconds                   0..60
+                           (use 60 for leap-second)
+              7       8    deci-seconds              0..9
+              8       9    direction from UTC        '+' / '-'
+              9      10    hours from UTC*           0..13
+             10      11    minutes from UTC          0..59
+
+            * Notes:
+            - the value of year is in network-byte order
+            - daylight saving time in New Zealand is +13
+
+            For example, Tuesday May 26, 1992 at 1:30:15 PM EDT would be
+            displayed as:
+
+                             1992-5-26,13:30:15.0,-4:0
+
+            Note that if only local time is known, then timezone
+            information (fields 8-10) is not present."
+    SYNTAX       OCTET STRING (SIZE (8 | 11))
+
+StorageType ::= TEXTUAL-CONVENTION
+    STATUS       current
+    DESCRIPTION
+            "Describes the memory realization of a conceptual row.  A
+            row which is volatile(2) is lost upon reboot.  A row which
+            is either nonVolatile(3), permanent(4) or readOnly(5), is
+            backed up by stable storage.  A row which is permanent(4)
+            can be changed but not deleted.  A row which is readOnly(5)
+            cannot be changed nor deleted.
+
+            If the value of an object with this syntax is either
+            permanent(4) or readOnly(5), it cannot be written.
+            Conversely, if the value is either other(1), volatile(2) or
+            nonVolatile(3), it cannot be modified to be permanent(4) or
+            readOnly(5).  (All illegal modifications result in a
+            'wrongValue' error.)
+
+            Every usage of this textual convention is required to
+            specify the columnar objects which a permanent(4) row must
+            at a minimum allow to be writable."
+    SYNTAX       INTEGER {
+                     other(1),       -- eh?
+                     volatile(2),    -- e.g., in RAM
+                     nonVolatile(3), -- e.g., in NVRAM
+                     permanent(4),   -- e.g., partially in ROM
+                     readOnly(5)     -- e.g., completely in ROM
+                 }
+
+TDomain ::= TEXTUAL-CONVENTION
+    STATUS       current
+    DESCRIPTION
+          "Denotes a kind of transport service.
+
+          Some possible values, such as snmpUDPDomain, are defined in
+          the SNMPv2-TM MIB module.  Other possible values are defined
+          in other MIB modules."
+    REFERENCE    "The SNMPv2-TM MIB module is defined in RFC 1906."
+    SYNTAX       OBJECT IDENTIFIER
+
+TAddress ::= TEXTUAL-CONVENTION
+    STATUS       current
+    DESCRIPTION
+          "Denotes a transport service address.
+
+          A TAddress value is always interpreted within the context of a
+          TDomain value.  Thus, each definition of a TDomain value must
+          be accompanied by a definition of a textual convention for use
+          with that TDomain.  Some possible textual conventions, such as
+          SnmpUDPAddress for snmpUDPDomain, are defined in the SNMPv2-TM
+          MIB module.  Other possible textual conventions are defined in
+          other MIB modules."
+    REFERENCE    "The SNMPv2-TM MIB module is defined in RFC 1906."
+    SYNTAX       OCTET STRING (SIZE (1..255))
+
+END
diff -Naur tomato/release/src/router/snmp/mibs/SNMPv2-TM.txt tomato121/release/src/router/snmp/mibs/SNMPv2-TM.txt
--- tomato/release/src/router/snmp/mibs/SNMPv2-TM.txt	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/mibs/SNMPv2-TM.txt	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,176 @@
+SNMPv2-TM DEFINITIONS ::= BEGIN
+
+IMPORTS
+    MODULE-IDENTITY, OBJECT-IDENTITY,
+    snmpModules, snmpDomains, snmpProxys
+        FROM SNMPv2-SMI
+    TEXTUAL-CONVENTION
+        FROM SNMPv2-TC;
+
+snmpv2tm MODULE-IDENTITY
+    LAST-UPDATED "200210160000Z"
+    ORGANIZATION "IETF SNMPv3 Working Group"
+    CONTACT-INFO
+            "WG-EMail:   snmpv3@lists.tislabs.com
+             Subscribe:  snmpv3-request@lists.tislabs.com
+
+             Co-Chair:   Russ Mundy
+                         Network Associates Laboratories
+             postal:     15204 Omega Drive, Suite 300
+                         Rockville, MD 20850-4601
+                         USA
+             EMail:      mundy@tislabs.com
+             phone:      +1 301 947-7107
+
+             Co-Chair:   David Harrington
+                         Enterasys Networks
+             postal:     35 Industrial Way
+                         P. O. Box 5005
+                         Rochester, NH 03866-5005
+                         USA
+             EMail:      dbh@enterasys.com
+             phone:      +1 603 337-2614
+
+             Editor:     Randy Presuhn
+                         BMC Software, Inc.
+             postal:     2141 North First Street
+                         San Jose, CA 95131
+                         USA
+             EMail:      randy_presuhn@bmc.com
+             phone:      +1 408 546-1006"
+    DESCRIPTION
+            "The MIB module for SNMP transport mappings.
+
+             Copyright (C) The Internet Society (2002). This
+             version of this MIB module is part of RFC 3417;
+             see the RFC itself for full legal notices.
+            "
+    REVISION     "200210160000Z"
+    DESCRIPTION
+            "Clarifications, published as RFC 3417."
+    REVISION    "199601010000Z"
+    DESCRIPTION
+            "Clarifications, published as RFC 1906."
+    REVISION    "199304010000Z"
+    DESCRIPTION
+            "The initial version, published as RFC 1449."
+    ::= { snmpModules 19 }
+
+-- SNMP over UDP over IPv4
+
+snmpUDPDomain  OBJECT-IDENTITY
+    STATUS     current
+    DESCRIPTION
+            "The SNMP over UDP over IPv4 transport domain.
+            The corresponding transport address is of type
+            SnmpUDPAddress."
+    ::= { snmpDomains 1 }
+
+SnmpUDPAddress ::= TEXTUAL-CONVENTION
+    DISPLAY-HINT "1d.1d.1d.1d/2d"
+    STATUS       current
+    DESCRIPTION
+            "Represents a UDP over IPv4 address:
+
+               octets   contents        encoding
+                1-4     IP-address      network-byte order
+                5-6     UDP-port        network-byte order
+            "
+    SYNTAX       OCTET STRING (SIZE (6))
+
+-- SNMP over OSI
+
+snmpCLNSDomain OBJECT-IDENTITY
+    STATUS     current
+    DESCRIPTION
+            "The SNMP over CLNS transport domain.
+            The corresponding transport address is of type
+            SnmpOSIAddress."
+    ::= { snmpDomains 2 }
+
+snmpCONSDomain OBJECT-IDENTITY
+    STATUS     current
+    DESCRIPTION
+            "The SNMP over CONS transport domain.
+            The corresponding transport address is of type
+            SnmpOSIAddress."
+    ::= { snmpDomains 3 }
+
+SnmpOSIAddress ::= TEXTUAL-CONVENTION
+    DISPLAY-HINT "*1x:/1x:"
+    STATUS       current
+    DESCRIPTION
+            "Represents an OSI transport-address:
+
+          octets   contents           encoding
+             1     length of NSAP     'n' as an unsigned-integer
+                                         (either 0 or from 3 to 20)
+          2..(n+1) NSAP                concrete binary representation
+          (n+2)..m TSEL                string of (up to 64) octets
+            "
+    SYNTAX       OCTET STRING (SIZE (1 | 4..85))
+
+-- SNMP over DDP
+
+snmpDDPDomain  OBJECT-IDENTITY
+    STATUS     current
+    DESCRIPTION
+            "The SNMP over DDP transport domain.  The corresponding
+            transport address is of type SnmpNBPAddress."
+    ::= { snmpDomains 4 }
+
+SnmpNBPAddress ::= TEXTUAL-CONVENTION
+    STATUS       current
+    DESCRIPTION
+            "Represents an NBP name:
+
+         octets        contents          encoding
+            1          length of object  'n' as an unsigned integer
+          2..(n+1)     object            string of (up to 32) octets
+           n+2         length of type    'p' as an unsigned integer
+      (n+3)..(n+2+p)   type              string of (up to 32) octets
+          n+3+p        length of zone    'q' as an unsigned integer
+    (n+4+p)..(n+3+p+q) zone              string of (up to 32) octets
+
+            For comparison purposes, strings are
+            case-insensitive. All strings may contain any octet
+            other than 255 (hex ff)."
+    SYNTAX       OCTET STRING (SIZE (3..99))
+
+-- SNMP over IPX
+
+snmpIPXDomain  OBJECT-IDENTITY
+    STATUS     current
+    DESCRIPTION
+            "The SNMP over IPX transport domain.  The corresponding
+            transport address is of type SnmpIPXAddress."
+    ::= { snmpDomains 5 }
+
+SnmpIPXAddress ::= TEXTUAL-CONVENTION
+    DISPLAY-HINT "4x.1x:1x:1x:1x:1x:1x.2d"
+    STATUS       current
+    DESCRIPTION
+            "Represents an IPX address:
+
+               octets   contents            encoding
+                1-4     network-number      network-byte order
+                5-10    physical-address    network-byte order
+               11-12    socket-number       network-byte order
+            "
+    SYNTAX       OCTET STRING (SIZE (12))
+
+-- for proxy to SNMPv1 (RFC 1157)
+
+rfc1157Proxy   OBJECT IDENTIFIER ::= { snmpProxys 1 }
+
+rfc1157Domain  OBJECT-IDENTITY
+    STATUS     deprecated
+    DESCRIPTION
+            "The transport domain for SNMPv1 over UDP over IPv4.
+            The corresponding transport address is of type
+            SnmpUDPAddress."
+    ::= { rfc1157Proxy 1 }
+
+--  ::= { rfc1157Proxy 2 }            this OID is obsolete
+
+END
diff -Naur tomato/release/src/router/snmp/mibs/SNMP-VIEW-BASED-ACM-MIB.txt tomato121/release/src/router/snmp/mibs/SNMP-VIEW-BASED-ACM-MIB.txt
--- tomato/release/src/router/snmp/mibs/SNMP-VIEW-BASED-ACM-MIB.txt	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/mibs/SNMP-VIEW-BASED-ACM-MIB.txt	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,830 @@
+SNMP-VIEW-BASED-ACM-MIB DEFINITIONS ::= BEGIN
+
+IMPORTS
+    MODULE-COMPLIANCE, OBJECT-GROUP       FROM SNMPv2-CONF
+    MODULE-IDENTITY, OBJECT-TYPE,
+    snmpModules                           FROM SNMPv2-SMI
+    TestAndIncr,
+    RowStatus, StorageType                FROM SNMPv2-TC
+    SnmpAdminString,
+    SnmpSecurityLevel,
+    SnmpSecurityModel                     FROM SNMP-FRAMEWORK-MIB;
+
+snmpVacmMIB       MODULE-IDENTITY
+    LAST-UPDATED "200210160000Z"          -- 16 Oct 2002, midnight
+    ORGANIZATION "SNMPv3 Working Group"
+    CONTACT-INFO "WG-email:   snmpv3@lists.tislabs.com
+                  Subscribe:  majordomo@lists.tislabs.com
+                              In message body:  subscribe snmpv3
+
+                  Co-Chair:   Russ Mundy
+                              Network Associates Laboratories
+                  postal:     15204 Omega Drive, Suite 300
+                              Rockville, MD 20850-4601
+                              USA
+                  email:      mundy@tislabs.com
+                  phone:      +1 301-947-7107
+
+                  Co-Chair:   David Harrington
+                              Enterasys Networks
+                  Postal:     35 Industrial Way
+                              P. O. Box 5004
+                              Rochester, New Hampshire 03866-5005
+                              USA
+                  EMail:      dbh@enterasys.com
+                  Phone:      +1 603-337-2614
+
+                  Co-editor:  Bert Wijnen
+                              Lucent Technologies
+                  postal:     Schagen 33
+                              3461 GL Linschoten
+                              Netherlands
+                  email:      bwijnen@lucent.com
+                  phone:      +31-348-480-685
+
+                  Co-editor:  Randy Presuhn
+                              BMC Software, Inc.
+
+                  postal:     2141 North First Street
+                              San Jose, CA 95131
+                              USA
+                  email:      randy_presuhn@bmc.com
+                  phone:      +1 408-546-1006
+
+                  Co-editor:  Keith McCloghrie
+                              Cisco Systems, Inc.
+                  postal:     170 West Tasman Drive
+                              San Jose, CA  95134-1706
+                              USA
+                  email:      kzm@cisco.com
+                  phone:      +1-408-526-5260
+                 "
+    DESCRIPTION  "The management information definitions for the
+                  View-based Access Control Model for SNMP.
+
+                  Copyright (C) The Internet Society (2002). This
+                  version of this MIB module is part of RFC 3415;
+                  see the RFC itself for full legal notices.
+                 "
+--  Revision history
+
+    REVISION     "200210160000Z"          -- 16 Oct 2002, midnight
+    DESCRIPTION  "Clarifications, published as RFC3415"
+
+    REVISION     "199901200000Z"          -- 20 Jan 1999, midnight
+    DESCRIPTION  "Clarifications, published as RFC2575"
+
+    REVISION     "199711200000Z"          -- 20 Nov 1997, midnight
+    DESCRIPTION  "Initial version, published as RFC2275"
+    ::= { snmpModules 16 }
+
+-- Administrative assignments ****************************************
+
+vacmMIBObjects      OBJECT IDENTIFIER ::= { snmpVacmMIB 1 }
+vacmMIBConformance  OBJECT IDENTIFIER ::= { snmpVacmMIB 2 }
+
+-- Information about Local Contexts **********************************
+
+vacmContextTable OBJECT-TYPE
+    SYNTAX       SEQUENCE OF VacmContextEntry
+    MAX-ACCESS   not-accessible
+    STATUS       current
+    DESCRIPTION "The table of locally available contexts.
+
+                 This table provides information to SNMP Command
+
+                 Generator applications so that they can properly
+                 configure the vacmAccessTable to control access to
+                 all contexts at the SNMP entity.
+
+                 This table may change dynamically if the SNMP entity
+                 allows that contexts are added/deleted dynamically
+                 (for instance when its configuration changes).  Such
+                 changes would happen only if the management
+                 instrumentation at that SNMP entity recognizes more
+                 (or fewer) contexts.
+
+                 The presence of entries in this table and of entries
+                 in the vacmAccessTable are independent.  That is, a
+                 context identified by an entry in this table is not
+                 necessarily referenced by any entries in the
+                 vacmAccessTable; and the context(s) referenced by an
+                 entry in the vacmAccessTable does not necessarily
+                 currently exist and thus need not be identified by an
+                 entry in this table.
+
+                 This table must be made accessible via the default
+                 context so that Command Responder applications have
+                 a standard way of retrieving the information.
+
+                 This table is read-only.  It cannot be configured via
+                 SNMP.
+                "
+    ::= { vacmMIBObjects 1 }
+
+vacmContextEntry OBJECT-TYPE
+    SYNTAX       VacmContextEntry
+    MAX-ACCESS   not-accessible
+    STATUS       current
+    DESCRIPTION "Information about a particular context."
+    INDEX       {
+                  vacmContextName
+                }
+    ::= { vacmContextTable 1 }
+
+VacmContextEntry ::= SEQUENCE
+    {
+        vacmContextName SnmpAdminString
+    }
+
+vacmContextName  OBJECT-TYPE
+    SYNTAX       SnmpAdminString (SIZE(0..32))
+    MAX-ACCESS   read-only
+    STATUS       current
+    DESCRIPTION "A human readable name identifying a particular
+                 context at a particular SNMP entity.
+
+                 The empty contextName (zero length) represents the
+                 default context.
+                "
+    ::= { vacmContextEntry 1 }
+
+-- Information about Groups ******************************************
+
+vacmSecurityToGroupTable OBJECT-TYPE
+    SYNTAX       SEQUENCE OF VacmSecurityToGroupEntry
+    MAX-ACCESS   not-accessible
+    STATUS       current
+    DESCRIPTION "This table maps a combination of securityModel and
+                 securityName into a groupName which is used to define
+                 an access control policy for a group of principals.
+                "
+    ::= { vacmMIBObjects 2 }
+
+vacmSecurityToGroupEntry OBJECT-TYPE
+    SYNTAX       VacmSecurityToGroupEntry
+    MAX-ACCESS   not-accessible
+    STATUS       current
+    DESCRIPTION "An entry in this table maps the combination of a
+                 securityModel and securityName into a groupName.
+                "
+    INDEX       {
+                  vacmSecurityModel,
+                  vacmSecurityName
+                }
+    ::= { vacmSecurityToGroupTable 1 }
+
+VacmSecurityToGroupEntry ::= SEQUENCE
+    {
+        vacmSecurityModel               SnmpSecurityModel,
+        vacmSecurityName                SnmpAdminString,
+        vacmGroupName                   SnmpAdminString,
+        vacmSecurityToGroupStorageType  StorageType,
+        vacmSecurityToGroupStatus       RowStatus
+    }
+
+vacmSecurityModel OBJECT-TYPE
+    SYNTAX       SnmpSecurityModel(1..2147483647)
+    MAX-ACCESS   not-accessible
+    STATUS       current
+    DESCRIPTION "The Security Model, by which the vacmSecurityName
+                 referenced by this entry is provided.
+
+                 Note, this object may not take the 'any' (0) value.
+                "
+    ::= { vacmSecurityToGroupEntry 1 }
+
+vacmSecurityName OBJECT-TYPE
+    SYNTAX       SnmpAdminString (SIZE(1..32))
+    MAX-ACCESS   not-accessible
+    STATUS       current
+    DESCRIPTION "The securityName for the principal, represented in a
+                 Security Model independent format, which is mapped by
+                 this entry to a groupName.
+                "
+    ::= { vacmSecurityToGroupEntry 2 }
+
+vacmGroupName    OBJECT-TYPE
+    SYNTAX       SnmpAdminString (SIZE(1..32))
+    MAX-ACCESS   read-create
+    STATUS       current
+    DESCRIPTION "The name of the group to which this entry (e.g., the
+                 combination of securityModel and securityName)
+                 belongs.
+
+                 This groupName is used as index into the
+                 vacmAccessTable to select an access control policy.
+                 However, a value in this table does not imply that an
+                 instance with the value exists in table vacmAccesTable.
+                "
+    ::= { vacmSecurityToGroupEntry 3 }
+
+vacmSecurityToGroupStorageType OBJECT-TYPE
+    SYNTAX       StorageType
+    MAX-ACCESS   read-create
+    STATUS       current
+    DESCRIPTION "The storage type for this conceptual row.
+                 Conceptual rows having the value 'permanent' need not
+                 allow write-access to any columnar objects in the row.
+                "
+    DEFVAL      { nonVolatile }
+    ::= { vacmSecurityToGroupEntry 4 }
+
+vacmSecurityToGroupStatus OBJECT-TYPE
+    SYNTAX       RowStatus
+    MAX-ACCESS   read-create
+    STATUS       current
+    DESCRIPTION "The status of this conceptual row.
+
+                 Until instances of all corresponding columns are
+                 appropriately configured, the value of the
+
+                 corresponding instance of the vacmSecurityToGroupStatus
+                 column is 'notReady'.
+
+                 In particular, a newly created row cannot be made
+                 active until a value has been set for vacmGroupName.
+
+                 The  RowStatus TC [RFC2579] requires that this
+                 DESCRIPTION clause states under which circumstances
+                 other objects in this row can be modified:
+
+                 The value of this object has no effect on whether
+                 other objects in this conceptual row can be modified.
+                "
+    ::= { vacmSecurityToGroupEntry 5 }
+
+-- Information about Access Rights ***********************************
+
+vacmAccessTable  OBJECT-TYPE
+    SYNTAX       SEQUENCE OF VacmAccessEntry
+    MAX-ACCESS   not-accessible
+    STATUS       current
+    DESCRIPTION "The table of access rights for groups.
+
+                 Each entry is indexed by a groupName, a contextPrefix,
+                 a securityModel and a securityLevel.  To determine
+                 whether access is allowed, one entry from this table
+                 needs to be selected and the proper viewName from that
+                 entry must be used for access control checking.
+
+                 To select the proper entry, follow these steps:
+
+                 1) the set of possible matches is formed by the
+                    intersection of the following sets of entries:
+
+                      the set of entries with identical vacmGroupName
+                      the union of these two sets:
+                       - the set with identical vacmAccessContextPrefix
+                       - the set of entries with vacmAccessContextMatch
+                         value of 'prefix' and matching
+                         vacmAccessContextPrefix
+                      intersected with the union of these two sets:
+                       - the set of entries with identical
+                         vacmSecurityModel
+                       - the set of entries with vacmSecurityModel
+                         value of 'any'
+                      intersected with the set of entries with
+                      vacmAccessSecurityLevel value less than or equal
+                      to the requested securityLevel
+
+                 2) if this set has only one member, we're done
+                    otherwise, it comes down to deciding how to weight
+                    the preferences between ContextPrefixes,
+                    SecurityModels, and SecurityLevels as follows:
+                    a) if the subset of entries with securityModel
+                       matching the securityModel in the message is
+                       not empty, then discard the rest.
+                    b) if the subset of entries with
+                       vacmAccessContextPrefix matching the contextName
+                       in the message is not empty,
+                       then discard the rest
+                    c) discard all entries with ContextPrefixes shorter
+                       than the longest one remaining in the set
+                    d) select the entry with the highest securityLevel
+
+                 Please note that for securityLevel noAuthNoPriv, all
+                 groups are really equivalent since the assumption that
+                 the securityName has been authenticated does not hold.
+                "
+    ::= { vacmMIBObjects 4 }
+
+vacmAccessEntry  OBJECT-TYPE
+    SYNTAX       VacmAccessEntry
+    MAX-ACCESS   not-accessible
+    STATUS       current
+    DESCRIPTION "An access right configured in the Local Configuration
+                 Datastore (LCD) authorizing access to an SNMP context.
+
+                 Entries in this table can use an instance value for
+                 object vacmGroupName even if no entry in table
+                 vacmAccessSecurityToGroupTable has a corresponding
+                 value for object vacmGroupName.
+                "
+    INDEX       { vacmGroupName,
+                  vacmAccessContextPrefix,
+                  vacmAccessSecurityModel,
+                  vacmAccessSecurityLevel
+                }
+    ::= { vacmAccessTable 1 }
+
+VacmAccessEntry ::= SEQUENCE
+    {
+        vacmAccessContextPrefix    SnmpAdminString,
+        vacmAccessSecurityModel    SnmpSecurityModel,
+        vacmAccessSecurityLevel    SnmpSecurityLevel,
+        vacmAccessContextMatch     INTEGER,
+        vacmAccessReadViewName     SnmpAdminString,
+        vacmAccessWriteViewName    SnmpAdminString,
+        vacmAccessNotifyViewName   SnmpAdminString,
+        vacmAccessStorageType      StorageType,
+        vacmAccessStatus           RowStatus
+    }
+
+vacmAccessContextPrefix OBJECT-TYPE
+    SYNTAX       SnmpAdminString (SIZE(0..32))
+    MAX-ACCESS   not-accessible
+    STATUS       current
+    DESCRIPTION "In order to gain the access rights allowed by this
+                 conceptual row, a contextName must match exactly
+                 (if the value of vacmAccessContextMatch is 'exact')
+                 or partially (if the value of vacmAccessContextMatch
+                 is 'prefix') to the value of the instance of this
+                 object.
+                "
+    ::= { vacmAccessEntry 1 }
+
+vacmAccessSecurityModel OBJECT-TYPE
+    SYNTAX       SnmpSecurityModel
+    MAX-ACCESS   not-accessible
+    STATUS       current
+    DESCRIPTION "In order to gain the access rights allowed by this
+                 conceptual row, this securityModel must be in use.
+                "
+    ::= { vacmAccessEntry 2 }
+
+vacmAccessSecurityLevel OBJECT-TYPE
+    SYNTAX       SnmpSecurityLevel
+    MAX-ACCESS   not-accessible
+    STATUS       current
+    DESCRIPTION "The minimum level of security required in order to
+                 gain the access rights allowed by this conceptual
+                 row.  A securityLevel of noAuthNoPriv is less than
+                 authNoPriv which in turn is less than authPriv.
+
+                 If multiple entries are equally indexed except for
+                 this vacmAccessSecurityLevel index, then the entry
+                 which has the highest value for
+                 vacmAccessSecurityLevel is selected.
+                "
+    ::= { vacmAccessEntry 3 }
+
+vacmAccessContextMatch OBJECT-TYPE
+    SYNTAX       INTEGER
+                { exact (1), -- exact match of prefix and contextName
+                  prefix (2) -- Only match to the prefix
+                }
+    MAX-ACCESS   read-create
+    STATUS       current
+    DESCRIPTION "If the value of this object is exact(1), then all
+                 rows where the contextName exactly matches
+                 vacmAccessContextPrefix are selected.
+
+                 If the value of this object is prefix(2), then all
+                 rows where the contextName whose starting octets
+                 exactly match vacmAccessContextPrefix are selected.
+                 This allows for a simple form of wildcarding.
+                "
+    DEFVAL      { exact }
+    ::= { vacmAccessEntry 4 }
+
+vacmAccessReadViewName OBJECT-TYPE
+    SYNTAX       SnmpAdminString (SIZE(0..32))
+    MAX-ACCESS   read-create
+    STATUS       current
+    DESCRIPTION "The value of an instance of this object identifies
+                 the MIB view of the SNMP context to which this
+                 conceptual row authorizes read access.
+
+                 The identified MIB view is that one for which the
+                 vacmViewTreeFamilyViewName has the same value as the
+                 instance of this object; if the value is the empty
+                 string or if there is no active MIB view having this
+                 value of vacmViewTreeFamilyViewName, then no access
+                 is granted.
+                "
+    DEFVAL      { ''H }   -- the empty string
+    ::= { vacmAccessEntry 5 }
+
+vacmAccessWriteViewName OBJECT-TYPE
+    SYNTAX       SnmpAdminString (SIZE(0..32))
+    MAX-ACCESS   read-create
+    STATUS       current
+    DESCRIPTION "The value of an instance of this object identifies
+                 the MIB view of the SNMP context to which this
+                 conceptual row authorizes write access.
+
+                 The identified MIB view is that one for which the
+                 vacmViewTreeFamilyViewName has the same value as the
+                 instance of this object; if the value is the empty
+                 string or if there is no active MIB view having this
+                 value of vacmViewTreeFamilyViewName, then no access
+                 is granted.
+                "
+    DEFVAL      { ''H }   -- the empty string
+    ::= { vacmAccessEntry 6 }
+
+vacmAccessNotifyViewName OBJECT-TYPE
+    SYNTAX       SnmpAdminString (SIZE(0..32))
+    MAX-ACCESS   read-create
+    STATUS       current
+    DESCRIPTION "The value of an instance of this object identifies
+                 the MIB view of the SNMP context to which this
+                 conceptual row authorizes access for notifications.
+
+                 The identified MIB view is that one for which the
+                 vacmViewTreeFamilyViewName has the same value as the
+                 instance of this object; if the value is the empty
+                 string or if there is no active MIB view having this
+                 value of vacmViewTreeFamilyViewName, then no access
+                 is granted.
+                "
+    DEFVAL      { ''H }   -- the empty string
+    ::= { vacmAccessEntry 7 }
+
+vacmAccessStorageType OBJECT-TYPE
+    SYNTAX       StorageType
+    MAX-ACCESS   read-create
+    STATUS       current
+    DESCRIPTION "The storage type for this conceptual row.
+
+                 Conceptual rows having the value 'permanent' need not
+                 allow write-access to any columnar objects in the row.
+                "
+    DEFVAL      { nonVolatile }
+    ::= { vacmAccessEntry 8 }
+
+vacmAccessStatus OBJECT-TYPE
+    SYNTAX       RowStatus
+    MAX-ACCESS   read-create
+    STATUS       current
+    DESCRIPTION "The status of this conceptual row.
+
+                 The  RowStatus TC [RFC2579] requires that this
+                 DESCRIPTION clause states under which circumstances
+                 other objects in this row can be modified:
+
+                 The value of this object has no effect on whether
+                 other objects in this conceptual row can be modified.
+                "
+    ::= { vacmAccessEntry 9 }
+
+-- Information about MIB views ***************************************
+
+-- Support for instance-level granularity is optional.
+--
+-- In some implementations, instance-level access control
+-- granularity may come at a high performance cost.  Managers
+-- should avoid requesting such configurations unnecessarily.
+
+vacmMIBViews     OBJECT IDENTIFIER ::= { vacmMIBObjects 5 }
+
+vacmViewSpinLock OBJECT-TYPE
+    SYNTAX       TestAndIncr
+    MAX-ACCESS   read-write
+    STATUS       current
+    DESCRIPTION "An advisory lock used to allow cooperating SNMP
+                 Command Generator applications to coordinate their
+                 use of the Set operation in creating or modifying
+                 views.
+
+                 When creating a new view or altering an existing
+                 view, it is important to understand the potential
+                 interactions with other uses of the view.  The
+                 vacmViewSpinLock should be retrieved.  The name of
+                 the view to be created should be determined to be
+                 unique by the SNMP Command Generator application by
+                 consulting the vacmViewTreeFamilyTable.  Finally,
+                 the named view may be created (Set), including the
+                 advisory lock.
+                 If another SNMP Command Generator application has
+                 altered the views in the meantime, then the spin
+                 lock's value will have changed, and so this creation
+                 will fail because it will specify the wrong value for
+                 the spin lock.
+
+                 Since this is an advisory lock, the use of this lock
+                 is not enforced.
+                "
+    ::= { vacmMIBViews 1 }
+
+vacmViewTreeFamilyTable OBJECT-TYPE
+    SYNTAX       SEQUENCE OF VacmViewTreeFamilyEntry
+    MAX-ACCESS   not-accessible
+    STATUS       current
+    DESCRIPTION "Locally held information about families of subtrees
+                 within MIB views.
+
+                 Each MIB view is defined by two sets of view subtrees:
+                   - the included view subtrees, and
+                   - the excluded view subtrees.
+                 Every such view subtree, both the included and the
+
+                 excluded ones, is defined in this table.
+
+                 To determine if a particular object instance is in
+                 a particular MIB view, compare the object instance's
+                 OBJECT IDENTIFIER with each of the MIB view's active
+                 entries in this table.  If none match, then the
+                 object instance is not in the MIB view.  If one or
+                 more match, then the object instance is included in,
+                 or excluded from, the MIB view according to the
+                 value of vacmViewTreeFamilyType in the entry whose
+                 value of vacmViewTreeFamilySubtree has the most
+                 sub-identifiers.  If multiple entries match and have
+                 the same number of sub-identifiers (when wildcarding
+                 is specified with the value of vacmViewTreeFamilyMask),
+                 then the lexicographically greatest instance of
+                 vacmViewTreeFamilyType determines the inclusion or
+                 exclusion.
+
+                 An object instance's OBJECT IDENTIFIER X matches an
+                 active entry in this table when the number of
+                 sub-identifiers in X is at least as many as in the
+                 value of vacmViewTreeFamilySubtree for the entry,
+                 and each sub-identifier in the value of
+                 vacmViewTreeFamilySubtree matches its corresponding
+                 sub-identifier in X.  Two sub-identifiers match
+                 either if the corresponding bit of the value of
+                 vacmViewTreeFamilyMask for the entry is zero (the
+                 'wild card' value), or if they are equal.
+
+                 A 'family' of subtrees is the set of subtrees defined
+                 by a particular combination of values of
+                 vacmViewTreeFamilySubtree and vacmViewTreeFamilyMask.
+
+                 In the case where no 'wild card' is defined in the
+                 vacmViewTreeFamilyMask, the family of subtrees reduces
+                 to a single subtree.
+
+                 When creating or changing MIB views, an SNMP Command
+                 Generator application should utilize the
+                 vacmViewSpinLock to try to avoid collisions.  See
+                 DESCRIPTION clause of vacmViewSpinLock.
+
+                 When creating MIB views, it is strongly advised that
+                 first the 'excluded' vacmViewTreeFamilyEntries are
+                 created and then the 'included' entries.
+
+                 When deleting MIB views, it is strongly advised that
+                 first the 'included' vacmViewTreeFamilyEntries are
+
+                 deleted and then the 'excluded' entries.
+
+                 If a create for an entry for instance-level access
+                 control is received and the implementation does not
+                 support instance-level granularity, then an
+                 inconsistentName error must be returned.
+                "
+    ::= { vacmMIBViews 2 }
+
+vacmViewTreeFamilyEntry OBJECT-TYPE
+    SYNTAX       VacmViewTreeFamilyEntry
+    MAX-ACCESS   not-accessible
+    STATUS       current
+    DESCRIPTION "Information on a particular family of view subtrees
+                 included in or excluded from a particular SNMP
+                 context's MIB view.
+
+                 Implementations must not restrict the number of
+                 families of view subtrees for a given MIB view,
+                 except as dictated by resource constraints on the
+                 overall number of entries in the
+                 vacmViewTreeFamilyTable.
+
+                 If no conceptual rows exist in this table for a given
+                 MIB view (viewName), that view may be thought of as
+                 consisting of the empty set of view subtrees.
+                "
+    INDEX       { vacmViewTreeFamilyViewName,
+                  vacmViewTreeFamilySubtree
+                }
+    ::= { vacmViewTreeFamilyTable 1 }
+
+VacmViewTreeFamilyEntry ::= SEQUENCE
+    {
+        vacmViewTreeFamilyViewName     SnmpAdminString,
+        vacmViewTreeFamilySubtree      OBJECT IDENTIFIER,
+        vacmViewTreeFamilyMask         OCTET STRING,
+        vacmViewTreeFamilyType         INTEGER,
+        vacmViewTreeFamilyStorageType  StorageType,
+        vacmViewTreeFamilyStatus       RowStatus
+    }
+
+vacmViewTreeFamilyViewName OBJECT-TYPE
+    SYNTAX       SnmpAdminString (SIZE(1..32))
+    MAX-ACCESS   not-accessible
+    STATUS       current
+    DESCRIPTION "The human readable name for a family of view subtrees.
+                "
+    ::= { vacmViewTreeFamilyEntry 1 }
+
+vacmViewTreeFamilySubtree OBJECT-TYPE
+    SYNTAX       OBJECT IDENTIFIER
+    MAX-ACCESS   not-accessible
+    STATUS       current
+    DESCRIPTION "The MIB subtree which when combined with the
+                 corresponding instance of vacmViewTreeFamilyMask
+                 defines a family of view subtrees.
+                "
+    ::= { vacmViewTreeFamilyEntry 2 }
+
+vacmViewTreeFamilyMask OBJECT-TYPE
+    SYNTAX       OCTET STRING (SIZE (0..16))
+    MAX-ACCESS   read-create
+    STATUS       current
+    DESCRIPTION "The bit mask which, in combination with the
+                 corresponding instance of vacmViewTreeFamilySubtree,
+                 defines a family of view subtrees.
+
+                 Each bit of this bit mask corresponds to a
+                 sub-identifier of vacmViewTreeFamilySubtree, with the
+                 most significant bit of the i-th octet of this octet
+                 string value (extended if necessary, see below)
+                 corresponding to the (8*i - 7)-th sub-identifier, and
+                 the least significant bit of the i-th octet of this
+                 octet string corresponding to the (8*i)-th
+                 sub-identifier, where i is in the range 1 through 16.
+
+                 Each bit of this bit mask specifies whether or not
+                 the corresponding sub-identifiers must match when
+                 determining if an OBJECT IDENTIFIER is in this
+                 family of view subtrees; a '1' indicates that an
+                 exact match must occur; a '0' indicates 'wild card',
+                 i.e., any sub-identifier value matches.
+
+                 Thus, the OBJECT IDENTIFIER X of an object instance
+                 is contained in a family of view subtrees if, for
+                 each sub-identifier of the value of
+                 vacmViewTreeFamilySubtree, either:
+
+                   the i-th bit of vacmViewTreeFamilyMask is 0, or
+
+                   the i-th sub-identifier of X is equal to the i-th
+                   sub-identifier of the value of
+                   vacmViewTreeFamilySubtree.
+
+                 If the value of this bit mask is M bits long and
+
+                 there are more than M sub-identifiers in the
+                 corresponding instance of vacmViewTreeFamilySubtree,
+                 then the bit mask is extended with 1's to be the
+                 required length.
+
+                 Note that when the value of this object is the
+                 zero-length string, this extension rule results in
+                 a mask of all-1's being used (i.e., no 'wild card'),
+                 and the family of view subtrees is the one view
+                 subtree uniquely identified by the corresponding
+                 instance of vacmViewTreeFamilySubtree.
+
+                 Note that masks of length greater than zero length
+                 do not need to be supported.  In this case this
+                 object is made read-only.
+                "
+    DEFVAL      { ''H }
+    ::= { vacmViewTreeFamilyEntry 3 }
+
+vacmViewTreeFamilyType OBJECT-TYPE
+    SYNTAX       INTEGER  { included(1), excluded(2) }
+    MAX-ACCESS   read-create
+    STATUS       current
+    DESCRIPTION "Indicates whether the corresponding instances of
+                 vacmViewTreeFamilySubtree and vacmViewTreeFamilyMask
+                 define a family of view subtrees which is included in
+                 or excluded from the MIB view.
+                "
+    DEFVAL      { included }
+    ::= { vacmViewTreeFamilyEntry 4 }
+
+vacmViewTreeFamilyStorageType OBJECT-TYPE
+    SYNTAX       StorageType
+    MAX-ACCESS   read-create
+    STATUS       current
+    DESCRIPTION "The storage type for this conceptual row.
+
+                 Conceptual rows having the value 'permanent' need not
+                 allow write-access to any columnar objects in the row.
+                "
+    DEFVAL      { nonVolatile }
+    ::= { vacmViewTreeFamilyEntry 5 }
+
+vacmViewTreeFamilyStatus OBJECT-TYPE
+    SYNTAX       RowStatus
+    MAX-ACCESS   read-create
+    STATUS       current
+    DESCRIPTION "The status of this conceptual row.
+
+                 The  RowStatus TC [RFC2579] requires that this
+                 DESCRIPTION clause states under which circumstances
+                 other objects in this row can be modified:
+
+                 The value of this object has no effect on whether
+                 other objects in this conceptual row can be modified.
+                "
+    ::= { vacmViewTreeFamilyEntry 6 }
+
+-- Conformance information *******************************************
+
+vacmMIBCompliances  OBJECT IDENTIFIER ::= { vacmMIBConformance 1 }
+vacmMIBGroups       OBJECT IDENTIFIER ::= { vacmMIBConformance 2 }
+
+-- Compliance statements *********************************************
+
+vacmMIBCompliance MODULE-COMPLIANCE
+    STATUS       current
+    DESCRIPTION "The compliance statement for SNMP engines which
+                 implement the SNMP View-based Access Control Model
+                 configuration MIB.
+                "
+    MODULE -- this module
+        MANDATORY-GROUPS { vacmBasicGroup }
+
+        OBJECT        vacmAccessContextMatch
+        MIN-ACCESS    read-only
+        DESCRIPTION  "Write access is not required."
+
+        OBJECT        vacmAccessReadViewName
+        MIN-ACCESS    read-only
+        DESCRIPTION  "Write access is not required."
+
+        OBJECT        vacmAccessWriteViewName
+        MIN-ACCESS    read-only
+        DESCRIPTION  "Write access is not required."
+
+        OBJECT        vacmAccessNotifyViewName
+        MIN-ACCESS    read-only
+        DESCRIPTION  "Write access is not required."
+
+        OBJECT        vacmAccessStorageType
+        MIN-ACCESS    read-only
+        DESCRIPTION  "Write access is not required."
+
+        OBJECT        vacmAccessStatus
+        MIN-ACCESS    read-only
+        DESCRIPTION  "Create/delete/modify access to the
+
+                      vacmAccessTable is not required.
+                     "
+
+        OBJECT        vacmViewTreeFamilyMask
+        WRITE-SYNTAX  OCTET STRING (SIZE (0))
+        MIN-ACCESS    read-only
+        DESCRIPTION  "Support for configuration via SNMP of subtree
+                      families using wild-cards is not required.
+                     "
+
+        OBJECT        vacmViewTreeFamilyType
+        MIN-ACCESS    read-only
+        DESCRIPTION  "Write access is not required."
+
+        OBJECT        vacmViewTreeFamilyStorageType
+        MIN-ACCESS    read-only
+        DESCRIPTION  "Write access is not required."
+
+        OBJECT        vacmViewTreeFamilyStatus
+        MIN-ACCESS    read-only
+        DESCRIPTION  "Create/delete/modify access to the
+                      vacmViewTreeFamilyTable is not required.
+                     "
+    ::= { vacmMIBCompliances 1 }
+
+-- Units of conformance **********************************************
+
+vacmBasicGroup OBJECT-GROUP
+    OBJECTS {
+              vacmContextName,
+              vacmGroupName,
+              vacmSecurityToGroupStorageType,
+              vacmSecurityToGroupStatus,
+              vacmAccessContextMatch,
+              vacmAccessReadViewName,
+              vacmAccessWriteViewName,
+              vacmAccessNotifyViewName,
+              vacmAccessStorageType,
+              vacmAccessStatus,
+              vacmViewSpinLock,
+              vacmViewTreeFamilyMask,
+              vacmViewTreeFamilyType,
+              vacmViewTreeFamilyStorageType,
+              vacmViewTreeFamilyStatus
+            }
+    STATUS       current
+    DESCRIPTION "A collection of objects providing for remote
+                 configuration of an SNMP engine which implements
+
+                 the SNMP View-based Access Control Model.
+                "
+    ::= { vacmMIBGroups 1 }
+
+END
diff -Naur tomato/release/src/router/snmp/mibs/TCP-MIB.txt tomato121/release/src/router/snmp/mibs/TCP-MIB.txt
--- tomato/release/src/router/snmp/mibs/TCP-MIB.txt	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/mibs/TCP-MIB.txt	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,330 @@
+TCP-MIB DEFINITIONS ::= BEGIN
+
+IMPORTS
+    MODULE-IDENTITY, OBJECT-TYPE, Integer32, Gauge32,
+    Counter32, IpAddress, mib-2        FROM SNMPv2-SMI
+    MODULE-COMPLIANCE, OBJECT-GROUP    FROM SNMPv2-CONF;
+
+tcpMIB MODULE-IDENTITY
+    LAST-UPDATED "9411010000Z"
+    ORGANIZATION "IETF SNMPv2 Working Group"
+    CONTACT-INFO
+            "        Keith McCloghrie
+
+             Postal: Cisco Systems, Inc.
+                     170 West Tasman Drive
+                     San Jose, CA  95134-1706
+                     US
+
+             Phone:  +1 408 526 5260
+             Email:  kzm@cisco.com"
+    DESCRIPTION
+            "The MIB module for managing TCP implementations."
+    REVISION      "9103310000Z"
+    DESCRIPTION
+            "The initial revision of this MIB module was part of MIB-
+            II."
+    ::= { mib-2 49 }
+
+-- the TCP group
+
+tcp      OBJECT IDENTIFIER ::= { mib-2 6 }
+
+tcpRtoAlgorithm OBJECT-TYPE
+    SYNTAX      INTEGER {
+                    other(1),    -- none of the following
+                    constant(2), -- a constant rto
+                    rsre(3),     -- MIL-STD-1778, Appendix B
+                    vanj(4)      -- Van Jacobson's algorithm [5]
+                }
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+            "The algorithm used to determine the timeout value used for
+            retransmitting unacknowledged octets."
+    ::= { tcp 1 }
+
+tcpRtoMin OBJECT-TYPE
+    SYNTAX      Integer32
+    UNITS       "milliseconds"
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+            "The minimum value permitted by a TCP implementation for the
+            retransmission timeout, measured in milliseconds.  More
+            refined semantics for objects of this type depend upon the
+            algorithm used to determine the retransmission timeout.  In
+            particular, when the timeout algorithm is rsre(3), an object
+            of this type has the semantics of the LBOUND quantity
+            described in RFC 793."
+    ::= { tcp 2 }
+
+tcpRtoMax OBJECT-TYPE
+    SYNTAX      Integer32
+    UNITS       "milliseconds"
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+            "The maximum value permitted by a TCP implementation for the
+
+            retransmission timeout, measured in milliseconds.  More
+            refined semantics for objects of this type depend upon the
+            algorithm used to determine the retransmission timeout.  In
+            particular, when the timeout algorithm is rsre(3), an object
+            of this type has the semantics of the UBOUND quantity
+            described in RFC 793."
+    ::= { tcp 3 }
+
+tcpMaxConn OBJECT-TYPE
+    SYNTAX      Integer32
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+            "The limit on the total number of TCP connections the entity
+            can support.  In entities where the maximum number of
+            connections is dynamic, this object should contain the value
+            -1."
+    ::= { tcp 4 }
+
+tcpActiveOpens OBJECT-TYPE
+    SYNTAX      Counter32
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+            "The number of times TCP connections have made a direct
+            transition to the SYN-SENT state from the CLOSED state."
+    ::= { tcp 5 }
+
+tcpPassiveOpens OBJECT-TYPE
+    SYNTAX      Counter32
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+            "The number of times TCP connections have made a direct
+            transition to the SYN-RCVD state from the LISTEN state."
+    ::= { tcp 6 }
+
+tcpAttemptFails OBJECT-TYPE
+    SYNTAX      Counter32
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+            "The number of times TCP connections have made a direct
+            transition to the CLOSED state from either the SYN-SENT
+            state or the SYN-RCVD state, plus the number of times TCP
+            connections have made a direct transition to the LISTEN
+            state from the SYN-RCVD state."
+    ::= { tcp 7 }
+
+tcpEstabResets OBJECT-TYPE
+    SYNTAX      Counter32
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+            "The number of times TCP connections have made a direct
+            transition to the CLOSED state from either the ESTABLISHED
+            state or the CLOSE-WAIT state."
+    ::= { tcp 8 }
+
+tcpCurrEstab OBJECT-TYPE
+    SYNTAX      Gauge32
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+            "The number of TCP connections for which the current state
+            is either ESTABLISHED or CLOSE- WAIT."
+    ::= { tcp 9 }
+
+tcpInSegs OBJECT-TYPE
+    SYNTAX      Counter32
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+            "The total number of segments received, including those
+            received in error.  This count includes segments received on
+            currently established connections."
+    ::= { tcp 10 }
+
+tcpOutSegs OBJECT-TYPE
+    SYNTAX      Counter32
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+            "The total number of segments sent, including those on
+            current connections but excluding those containing only
+            retransmitted octets."
+    ::= { tcp 11 }
+
+tcpRetransSegs OBJECT-TYPE
+    SYNTAX      Counter32
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+            "The total number of segments retransmitted - that is, the
+            number of TCP segments transmitted containing one or more
+            previously transmitted octets."
+    ::= { tcp 12 }
+
+-- the TCP Connection table
+
+-- The TCP connection table contains information about this
+-- entity's existing TCP connections.
+
+tcpConnTable OBJECT-TYPE
+    SYNTAX      SEQUENCE OF TcpConnEntry
+    MAX-ACCESS  not-accessible
+    STATUS      current
+    DESCRIPTION
+            "A table containing TCP connection-specific information."
+    ::= { tcp 13 }
+
+tcpConnEntry OBJECT-TYPE
+    SYNTAX      TcpConnEntry
+    MAX-ACCESS  not-accessible
+    STATUS      current
+    DESCRIPTION
+            "A conceptual row of the tcpConnTable containing information
+            about a particular current TCP connection.  Each row of this
+            table is transient, in that it ceases to exist when (or soon
+            after) the connection makes the transition to the CLOSED
+            state."
+    INDEX   { tcpConnLocalAddress,
+              tcpConnLocalPort,
+              tcpConnRemAddress,
+              tcpConnRemPort }
+    ::= { tcpConnTable 1 }
+
+TcpConnEntry ::= SEQUENCE {
+        tcpConnState          INTEGER,
+        tcpConnLocalAddress   IpAddress,
+        tcpConnLocalPort      INTEGER,
+        tcpConnRemAddress     IpAddress,
+        tcpConnRemPort        INTEGER
+    }
+
+tcpConnState OBJECT-TYPE
+    SYNTAX      INTEGER {
+                    closed(1),
+                    listen(2),
+                    synSent(3),
+                    synReceived(4),
+                    established(5),
+                    finWait1(6),
+                    finWait2(7),
+                    closeWait(8),
+                    lastAck(9),
+                    closing(10),
+                    timeWait(11),
+                    deleteTCB(12)
+                }
+    MAX-ACCESS  read-write
+    STATUS      current
+    DESCRIPTION
+            "The state of this TCP connection.
+
+            The only value which may be set by a management station is
+            deleteTCB(12).  Accordingly, it is appropriate for an agent
+            to return a `badValue' response if a management station
+            attempts to set this object to any other value.
+
+            If a management station sets this object to the value
+            deleteTCB(12), then this has the effect of deleting the TCB
+            (as defined in RFC 793) of the corresponding connection on
+            the managed node, resulting in immediate termination of the
+            connection.
+
+            As an implementation-specific option, a RST segment may be
+            sent from the managed node to the other TCP endpoint (note
+            however that RST segments are not sent reliably)."
+    ::= { tcpConnEntry 1 }
+
+tcpConnLocalAddress OBJECT-TYPE
+    SYNTAX      IpAddress
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+            "The local IP address for this TCP connection.  In the case
+            of a connection in the listen state which is willing to
+            accept connections for any IP interface associated with the
+            node, the value 0.0.0.0 is used."
+    ::= { tcpConnEntry 2 }
+
+tcpConnLocalPort OBJECT-TYPE
+    SYNTAX      INTEGER (0..65535)
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+            "The local port number for this TCP connection."
+    ::= { tcpConnEntry 3 }
+
+tcpConnRemAddress OBJECT-TYPE
+    SYNTAX      IpAddress
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+            "The remote IP address for this TCP connection."
+    ::= { tcpConnEntry 4 }
+
+tcpConnRemPort OBJECT-TYPE
+    SYNTAX      INTEGER (0..65535)
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+            "The remote port number for this TCP connection."
+    ::= { tcpConnEntry 5 }
+
+tcpInErrs OBJECT-TYPE
+    SYNTAX      Counter32
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+            "The total number of segments received in error (e.g., bad
+            TCP checksums)."
+    ::= { tcp 14 }
+
+tcpOutRsts OBJECT-TYPE
+    SYNTAX      Counter32
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+            "The number of TCP segments sent containing the RST flag."
+    ::= { tcp 15 }
+
+-- conformance information
+
+tcpMIBConformance OBJECT IDENTIFIER ::= { tcpMIB 2 }
+
+tcpMIBCompliances OBJECT IDENTIFIER ::= { tcpMIBConformance 1 }
+tcpMIBGroups      OBJECT IDENTIFIER ::= { tcpMIBConformance 2 }
+
+-- compliance statements
+
+tcpMIBCompliance MODULE-COMPLIANCE
+    STATUS  current
+    DESCRIPTION
+            "The compliance statement for SNMPv2 entities which
+            implement TCP."
+    MODULE  -- this module
+
+        MANDATORY-GROUPS { tcpGroup
+                           }
+    ::= { tcpMIBCompliances 1 }
+
+-- units of conformance
+
+tcpGroup OBJECT-GROUP
+    OBJECTS   { tcpRtoAlgorithm, tcpRtoMin, tcpRtoMax,
+                tcpMaxConn, tcpActiveOpens,
+                tcpPassiveOpens, tcpAttemptFails,
+                tcpEstabResets, tcpCurrEstab, tcpInSegs,
+                tcpOutSegs, tcpRetransSegs, tcpConnState,
+                tcpConnLocalAddress, tcpConnLocalPort,
+                tcpConnRemAddress, tcpConnRemPort,
+                tcpInErrs, tcpOutRsts }
+    STATUS    current
+    DESCRIPTION
+            "The tcp group of objects providing for management of TCP
+            entities."
+    ::= { tcpMIBGroups 1 }
+
+END
diff -Naur tomato/release/src/router/snmp/mibs/TUNNEL-MIB.txt tomato121/release/src/router/snmp/mibs/TUNNEL-MIB.txt
--- tomato/release/src/router/snmp/mibs/TUNNEL-MIB.txt	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/mibs/TUNNEL-MIB.txt	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,337 @@
+TUNNEL-MIB DEFINITIONS ::= BEGIN
+
+IMPORTS
+    MODULE-IDENTITY, OBJECT-TYPE, transmission,
+    Integer32, IpAddress             FROM SNMPv2-SMI
+    RowStatus                        FROM SNMPv2-TC
+    MODULE-COMPLIANCE, OBJECT-GROUP  FROM SNMPv2-CONF
+    ifIndex, InterfaceIndexOrZero    FROM IF-MIB;
+
+tunnelMIB MODULE-IDENTITY
+    LAST-UPDATED "9908241200Z" -- August 24, 1999
+    ORGANIZATION "IETF Interfaces MIB Working Group"
+    CONTACT-INFO
+            " Dave Thaler
+              Microsoft Corporation
+              One Microsoft Way
+              Redmond, WA  98052-6399
+              EMail: dthaler@dthaler.microsoft.com"
+    DESCRIPTION
+            "The MIB module for management of IP Tunnels, independent of
+            the specific encapsulation scheme in use."
+    REVISION     "9908241200Z" -- August 24, 1999
+    DESCRIPTION
+            "Initial version, published as RFC 2667."
+    ::= { transmission 131 }
+
+tunnelMIBObjects OBJECT IDENTIFIER ::= { tunnelMIB 1 }
+
+tunnel      OBJECT IDENTIFIER ::= { tunnelMIBObjects 1 }
+
+-- the IP Tunnel MIB-Group
+--
+-- a collection of objects providing information about
+-- IP Tunnels
+
+tunnelIfTable OBJECT-TYPE
+    SYNTAX     SEQUENCE OF TunnelIfEntry
+    MAX-ACCESS not-accessible
+    STATUS     current
+    DESCRIPTION
+            "The (conceptual) table containing information on configured
+            tunnels."
+    ::= { tunnel 1 }
+
+tunnelIfEntry OBJECT-TYPE
+    SYNTAX     TunnelIfEntry
+    MAX-ACCESS not-accessible
+    STATUS     current
+    DESCRIPTION
+            "An entry (conceptual row) containing the information on a
+            particular configured tunnel."
+    INDEX      { ifIndex }
+    ::= { tunnelIfTable 1 }
+
+TunnelIfEntry ::= SEQUENCE {
+    tunnelIfLocalAddress            IpAddress,
+    tunnelIfRemoteAddress           IpAddress,
+    tunnelIfEncapsMethod            INTEGER,
+    tunnelIfHopLimit                Integer32,
+    tunnelIfSecurity                INTEGER,
+    tunnelIfTOS                     Integer32
+}
+
+tunnelIfLocalAddress OBJECT-TYPE
+    SYNTAX     IpAddress
+    MAX-ACCESS read-only
+    STATUS     current
+    DESCRIPTION
+            "The address of the local endpoint of the tunnel (i.e., the
+            source address used in the outer IP header), or 0.0.0.0 if
+            unknown."
+    ::= { tunnelIfEntry 1 }
+
+tunnelIfRemoteAddress OBJECT-TYPE
+    SYNTAX     IpAddress
+    MAX-ACCESS read-only
+    STATUS     current
+    DESCRIPTION
+            "The address of the remote endpoint of the tunnel (i.e., the
+            destination address used in the outer IP header), or 0.0.0.0
+            if unknown."
+    ::= { tunnelIfEntry 2 }
+
+tunnelIfEncapsMethod OBJECT-TYPE
+    SYNTAX     INTEGER {
+                   other(1),   -- none of the following
+                   direct(2),  -- no intermediate header
+                   gre(3),     -- GRE encapsulation
+                   minimal(4), -- Minimal encapsulation
+                   l2tp(5),    -- L2TP encapsulation
+                   pptp(6),    -- PPTP encapsulation
+                   l2f(7),     -- L2F encapsulation
+                   udp(8),     -- UDP encapsulation
+                   atmp(9)     -- ATMP encapsulation
+
+               }
+    MAX-ACCESS read-only
+    STATUS     current
+    DESCRIPTION
+            "The encapsulation method used by the tunnel. The value
+            direct indicates that the packet is encapsulated directly
+            within a normal IPv4 header, with no intermediate header,
+            and unicast to the remote tunnel endpoint (e.g., an RFC 2003
+            IP-in-IP tunnel, or an RFC 1933 IPv6-in-IPv4 tunnel). The
+            value minimal indicates that a Minimal Forwarding Header
+            (RFC 2004) is inserted between the outer header and the
+            payload packet. The value UDP indicates that the payload
+            packet is encapsulated within a normal UDP packet (e.g., RFC
+            1234).  The remaining protocol-specific values indicate that
+            a header of the protocol of that name is inserted between
+            the outer header and the payload header."
+    ::= { tunnelIfEntry 3 }
+
+tunnelIfHopLimit OBJECT-TYPE
+    SYNTAX     Integer32 (0..255)
+    MAX-ACCESS read-write
+    STATUS     current
+    DESCRIPTION
+            "The TTL to use in the outer IP header. A value of 0
+            indicates that the value is copied from the payload's
+            header."
+    ::= { tunnelIfEntry 4 }
+
+tunnelIfSecurity OBJECT-TYPE
+    SYNTAX     INTEGER {
+                   none(1),   -- no security
+                   ipsec(2),  -- IPSEC security
+                   other(3)
+               }
+    MAX-ACCESS read-only
+    STATUS     current
+    DESCRIPTION
+            "The method used by the tunnel to secure the outer IP
+            header.  The value ipsec indicates that IPsec is used
+            between the tunnel endpoints for authentication or
+            encryption or both.  More specific security-related
+            information may be available in a MIB for the security
+            protocol in use."
+    ::= { tunnelIfEntry 5 }
+
+tunnelIfTOS OBJECT-TYPE
+    SYNTAX     Integer32 (-2..63)
+    MAX-ACCESS read-write
+    STATUS     current
+    DESCRIPTION
+            "The method used to set the high 6 bits of the TOS in the
+            outer IP header.  A value of -1 indicates that the bits are
+            copied from the payload's header. A value of -2 indicates
+            that a traffic conditioner is invoked and more information
+            may be available in a traffic conditioner MIB.  A value
+            between 0 and 63 inclusive indicates that the bit field is
+            set to the indicated value."
+    ::= { tunnelIfEntry 6 }
+
+tunnelConfigTable OBJECT-TYPE
+    SYNTAX     SEQUENCE OF TunnelConfigEntry
+    MAX-ACCESS not-accessible
+    STATUS     current
+    DESCRIPTION
+            "The (conceptual) table containing information on configured
+            tunnels.  This table can be used to map a set of tunnel
+            endpoints to the associated ifIndex value.  It can also be
+            used for row creation.  Note that every row in the
+            tunnelIfTable with a fixed destination address should have a
+            corresponding row in the tunnelConfigTable, regardless of
+            whether it was created via SNMP."
+    ::= { tunnel 2 }
+
+tunnelConfigEntry OBJECT-TYPE
+    SYNTAX     TunnelConfigEntry
+    MAX-ACCESS not-accessible
+    STATUS     current
+    DESCRIPTION
+            "An entry (conceptual row) containing the information on a
+            particular configured tunnel."
+    INDEX      { tunnelConfigLocalAddress,
+                 tunnelConfigRemoteAddress,
+                 tunnelConfigEncapsMethod,
+                 tunnelConfigID }
+    ::= { tunnelConfigTable 1 }
+
+TunnelConfigEntry ::= SEQUENCE {
+    tunnelConfigLocalAddress            IpAddress,
+    tunnelConfigRemoteAddress           IpAddress,
+    tunnelConfigEncapsMethod            INTEGER,
+    tunnelConfigID                      Integer32,
+    tunnelConfigIfIndex                 InterfaceIndexOrZero,
+    tunnelConfigStatus                  RowStatus
+}
+
+tunnelConfigLocalAddress OBJECT-TYPE
+    SYNTAX     IpAddress
+    MAX-ACCESS not-accessible
+    STATUS     current
+    DESCRIPTION
+            "The address of the local endpoint of the tunnel, or 0.0.0.0
+            if the device is free to choose any of its addresses at
+            tunnel establishment time."
+    ::= { tunnelConfigEntry 1 }
+
+tunnelConfigRemoteAddress OBJECT-TYPE
+    SYNTAX     IpAddress
+    MAX-ACCESS not-accessible
+    STATUS     current
+    DESCRIPTION
+            "The address of the remote endpoint of the tunnel."
+    ::= { tunnelConfigEntry 2 }
+
+tunnelConfigEncapsMethod OBJECT-TYPE
+    SYNTAX     INTEGER {
+                   other(1),   -- none of the following
+                   direct(2),  -- no intermediate header
+                   gre(3),     -- GRE encapsulation
+                   minimal(4), -- Minimal encapsulation
+                   l2tp(5),    -- L2TP encapsulation
+                   pptp(6),    -- PPTP encapsulation
+                   l2f(7),     -- L2F encapsulation
+                   udp(8),     -- UDP encapsulation
+                   atmp(9)
+               }
+    MAX-ACCESS not-accessible
+    STATUS     current
+    DESCRIPTION
+            "The encapsulation method used by the tunnel."
+    ::= { tunnelConfigEntry 3 }
+
+tunnelConfigID OBJECT-TYPE
+    SYNTAX     Integer32 (1..2147483647)
+    MAX-ACCESS not-accessible
+    STATUS     current
+    DESCRIPTION
+            "An identifier used to distinguish between multiple tunnels
+            of the same encapsulation method, with the same endpoints.
+            If the encapsulation protocol only allows one tunnel per set
+            of endpoint addresses (such as for GRE or IP-in-IP), the
+            value of this object is 1.  For encapsulation methods (such
+            as L2F) which allow multiple parallel tunnels, the manager
+            is responsible for choosing any ID which does not conflict
+            with an existing row, such as choosing a random number."
+    ::= { tunnelConfigEntry 4 }
+
+tunnelConfigIfIndex OBJECT-TYPE
+    SYNTAX     InterfaceIndexOrZero
+    MAX-ACCESS read-only
+    STATUS     current
+    DESCRIPTION
+            "If the value of tunnelConfigStatus for this row is active,
+            then this object contains the value of ifIndex corresponding
+            to the tunnel interface.  A value of 0 is not legal in the
+            active state, and means that the interface index has not yet
+            been assigned."
+    ::= { tunnelConfigEntry 5 }
+
+tunnelConfigStatus OBJECT-TYPE
+    SYNTAX     RowStatus
+    MAX-ACCESS read-create
+    STATUS     current
+    DESCRIPTION
+            "The status of this row, by which new entries may be
+            created, or old entries deleted from this table. The agent
+            need not support setting this object to createAndWait or
+            notInService since there are no other writable objects in
+            this table, and writable objects in rows of corresponding
+            tables such as the tunnelIfTable may be modified while this
+            row is active.
+
+            To create a row in this table for an encapsulation method
+            which does not support multiple parallel tunnels with the
+            same endpoints, the management station should simply use a
+            tunnelConfigID of 1, and set tunnelConfigStatus to
+            createAndGo.  For encapsulation methods such as L2F which
+            allow multiple parallel tunnels, the management station may
+            select a pseudo-random number to use as the tunnelConfigID
+            and set tunnelConfigStatus to createAndGo.  In the event
+            that this ID is already in use and an inconsistentValue is
+            returned in response to the set operation, the management
+            station should simply select a new pseudo-random number and
+            retry the operation.
+
+            Creating a row in this table will cause an interface index
+            to be assigned by the agent in an implementation-dependent
+            manner, and corresponding rows will be instantiated in the
+            ifTable and the tunnelIfTable.  The status of this row will
+            become active as soon as the agent assigns the interface
+            index, regardless of whether the interface is operationally
+            up.
+
+            Deleting a row in this table will likewise delete the
+            corresponding row in the ifTable and in the tunnelIfTable."
+    ::= { tunnelConfigEntry 6 }
+
+-- conformance information
+
+tunnelMIBConformance
+                  OBJECT IDENTIFIER ::= { tunnelMIB 2 }
+tunnelMIBCompliances
+                  OBJECT IDENTIFIER ::= { tunnelMIBConformance 1 }
+tunnelMIBGroups  OBJECT IDENTIFIER ::= { tunnelMIBConformance 2 }
+
+-- compliance statements
+
+tunnelMIBCompliance MODULE-COMPLIANCE
+    STATUS  current
+    DESCRIPTION
+            "The compliance statement for the IP Tunnel MIB."
+    MODULE  -- this module
+    MANDATORY-GROUPS { tunnelMIBBasicGroup }
+
+        OBJECT      tunnelIfHopLimit
+        MIN-ACCESS  read-only
+        DESCRIPTION
+            "Write access is not required."
+
+        OBJECT      tunnelIfTOS
+        MIN-ACCESS  read-only
+        DESCRIPTION
+            "Write access is not required."
+
+        OBJECT      tunnelConfigStatus
+        MIN-ACCESS  read-only
+        DESCRIPTION
+            "Write access is not required."
+   ::= { tunnelMIBCompliances 1 }
+
+-- units of conformance
+
+tunnelMIBBasicGroup OBJECT-GROUP
+    OBJECTS { tunnelIfLocalAddress, tunnelIfRemoteAddress,
+       tunnelIfEncapsMethod, tunnelIfHopLimit, tunnelIfTOS,
+       tunnelIfSecurity, tunnelConfigIfIndex, tunnelConfigStatus }
+    STATUS  current
+    DESCRIPTION
+            "A collection of objects to support basic management of IP
+            Tunnels."
+    ::= { tunnelMIBGroups 1 }
+
+END
diff -Naur tomato/release/src/router/snmp/mibs/UCD-DEMO-MIB.inc tomato121/release/src/router/snmp/mibs/UCD-DEMO-MIB.inc
--- tomato/release/src/router/snmp/mibs/UCD-DEMO-MIB.inc	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/mibs/UCD-DEMO-MIB.inc	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,11 @@
+-- input include file for smicng.
+
+#condInclude "SNMPv2-SMI.inc"  -- SNMPv2-SMI (SNMPv2 SMI)
+#condInclude "SNMPv2-TC.inc"   -- SNMPv2-TC (SNMPv2 TC macro and base TCs)
+#condInclude "UCD-SNMP-MIB.inc"
+
+#pushOpt
+#addOpt "CM"
+#condInclude "UCD-DEMO-MIB.txt"
+#popOpt
+
diff -Naur tomato/release/src/router/snmp/mibs/UCD-DEMO-MIB.txt tomato121/release/src/router/snmp/mibs/UCD-DEMO-MIB.txt
--- tomato/release/src/router/snmp/mibs/UCD-DEMO-MIB.txt	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/mibs/UCD-DEMO-MIB.txt	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,74 @@
+UCD-DEMO-MIB DEFINITIONS ::= BEGIN
+
+IMPORTS
+    MODULE-IDENTITY, OBJECT-TYPE, Integer32	FROM SNMPv2-SMI
+    ucdavis					FROM UCD-SNMP-MIB;
+
+ucdDemoMIB MODULE-IDENTITY
+    LAST-UPDATED "9912090000Z"
+    ORGANIZATION "University of California, Davis"
+    CONTACT-INFO
+	"This mib is no longer being maintained by the University of
+	 California and is now in life-support-mode and being
+	 maintained by the net-snmp project.  The best place to write
+	 for public questions about the net-snmp-coders mailing list
+	 at net-snmp-coders@lists.sourceforge.net.
+
+         postal:   Wes Hardaker
+                   P.O. Box 382
+                   Davis CA  95617
+
+         email:    net-snmp-coders@lists.sourceforge.net
+        "
+    DESCRIPTION
+	"The UCD-SNMP Demonstration MIB."
+    REVISION	 "9912090000Z"
+    DESCRIPTION
+	"SMIv2 version converted from older MIB definitions."
+    ::= { ucdavis 14 }
+
+ucdDemoMIBObjects OBJECT IDENTIFIER ::= { ucdDemoMIB 1 }
+
+ucdDemoPublic OBJECT IDENTIFIER ::= { ucdDemoMIBObjects 1 }
+
+ucdDemoResetKeys OBJECT-TYPE
+    SYNTAX	Integer32 (0..2147483647)
+    MAX-ACCESS	read-write
+    STATUS	current
+    DESCRIPTION
+	"A set of value 1 to this object resets the
+	 demonstration user's auth and priv keys to the
+	 keys based on the P->Ku->Kul transformation of the
+	 value of the ucdDemoPasspharse object.
+
+	 Values other than 1 are ignored."
+    ::= { ucdDemoPublic 1 }
+
+ucdDemoPublicString OBJECT-TYPE
+    SYNTAX	OCTET STRING (SIZE(0..1024))
+    MAX-ACCESS	read-write
+    STATUS	current
+    DESCRIPTION
+	"A publicly settable string that can be set for testing 
+	 snmpsets.  This value has no real usage other than
+	 testing purposes."
+    ::= { ucdDemoPublic 2 }
+
+ucdDemoUserList OBJECT-TYPE
+    SYNTAX	OCTET STRING
+    MAX-ACCESS	read-only
+    STATUS	current
+    DESCRIPTION
+	"The list of users affected by the ucdDemoResetKeys object."
+    ::= { ucdDemoPublic 3 }
+
+ucdDemoPassphrase  OBJECT-TYPE
+    SYNTAX	OCTET STRING
+    MAX-ACCESS	read-only
+    STATUS	current
+    DESCRIPTION
+	"The demo passphrase that ucdDemoResetKeys changes each 
+	 users localized key to based on the P->Ku->Kul transformation."
+    ::= { ucdDemoPublic 4 }
+
+END
diff -Naur tomato/release/src/router/snmp/mibs/UCD-DISKIO-MIB.inc tomato121/release/src/router/snmp/mibs/UCD-DISKIO-MIB.inc
--- tomato/release/src/router/snmp/mibs/UCD-DISKIO-MIB.inc	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/mibs/UCD-DISKIO-MIB.inc	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,11 @@
+-- input include file for smicng.
+
+#condInclude "SNMPv2-SMI.inc"  -- SNMPv2-SMI (SNMPv2 SMI)
+#condInclude "SNMPv2-TC.inc"   -- SNMPv2-TC (SNMPv2 TC macro and base TCs)
+#condInclude "UCD-SNMP-MIB.inc"
+
+#pushOpt
+#addOpt "CM"
+#condInclude "UCD-DISKIO-MIB.txt"
+#popOpt
+
diff -Naur tomato/release/src/router/snmp/mibs/UCD-DISKIO-MIB.txt tomato121/release/src/router/snmp/mibs/UCD-DISKIO-MIB.txt
--- tomato/release/src/router/snmp/mibs/UCD-DISKIO-MIB.txt	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/mibs/UCD-DISKIO-MIB.txt	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,117 @@
+UCD-DISKIO-MIB DEFINITIONS ::= BEGIN
+
+--
+-- Derived from the original VEST-INTERNETT-MIB. Open issues:
+--
+-- (a) where to register this MIB?
+-- (b) use not-accessible for diskIOIndex?
+--
+
+
+IMPORTS
+    MODULE-IDENTITY, OBJECT-TYPE, Integer32, Counter32
+        FROM SNMPv2-SMI
+    DisplayString
+        FROM SNMPv2-TC
+    ucdExperimental
+        FROM UCD-SNMP-MIB;
+
+ucdDiskIOMIB MODULE-IDENTITY
+    LAST-UPDATED "200001260000Z"
+    ORGANIZATION "University of California, Davis"
+    CONTACT-INFO    
+	"This mib is no longer being maintained by the University of
+	 California and is now in life-support-mode and being
+	 maintained by the net-snmp project.  The best place to write
+	 for public questions about the net-snmp-coders mailing list
+	 at net-snmp-coders@lists.sourceforge.net.
+
+         postal:   Wes Hardaker
+                   P.O. Box 382
+                   Davis CA  95617
+
+         email:    net-snmp-coders@lists.sourceforge.net
+        "
+    DESCRIPTION
+        "This MIB module defines objects for disk IO statistics."
+    REVISION     "200001260000Z"
+    DESCRIPTION
+        "SMIv2 version derived from older definitions contained
+         in the VEST-INTERNETT-MIB module."
+    ::= { ucdExperimental 15 }
+
+diskIOTable OBJECT-TYPE
+    SYNTAX      SEQUENCE OF DiskIOEntry
+    MAX-ACCESS  not-accessible
+    STATUS      current
+    DESCRIPTION
+        "Table of IO devices and how much data they have read/written."
+    ::= { ucdDiskIOMIB 1 }
+
+diskIOEntry OBJECT-TYPE
+    SYNTAX      DiskIOEntry
+    MAX-ACCESS  not-accessible
+    STATUS      current
+    DESCRIPTION
+        "An entry containing a device and its statistics."
+    INDEX       { diskIOIndex }
+    ::= { diskIOTable 1 }
+
+DiskIOEntry ::= SEQUENCE {
+    diskIOIndex         Integer32,
+    diskIODevice        DisplayString,
+    diskIONRead         Counter32,
+    diskIONWritten      Counter32,
+    diskIOReads         Counter32,
+    diskIOWrites        Counter32
+}
+
+diskIOIndex OBJECT-TYPE
+    SYNTAX      Integer32 (0..65535)
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+        "Reference index for each observed device."
+    ::= { diskIOEntry 1 }
+
+diskIODevice OBJECT-TYPE
+    SYNTAX      DisplayString
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+        "The name of the device we are counting/checking."
+    ::= { diskIOEntry 2 }
+
+diskIONRead OBJECT-TYPE
+    SYNTAX      Counter32
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+        "The number of bytes read from this device since boot."
+    ::= { diskIOEntry 3 }
+
+diskIONWritten OBJECT-TYPE
+    SYNTAX      Counter32
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+        "The number of bytes written to this device since boot."
+    ::= { diskIOEntry 4 }
+
+diskIOReads OBJECT-TYPE
+    SYNTAX      Counter32
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+        "The number of read accesses from this device since boot."
+    ::= { diskIOEntry 5 }
+
+diskIOWrites OBJECT-TYPE
+    SYNTAX      Counter32
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+        "The number of write accesses to this device since boot."
+    ::= { diskIOEntry 6 }
+
+END
diff -Naur tomato/release/src/router/snmp/mibs/UCD-DLMOD-MIB.inc tomato121/release/src/router/snmp/mibs/UCD-DLMOD-MIB.inc
--- tomato/release/src/router/snmp/mibs/UCD-DLMOD-MIB.inc	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/mibs/UCD-DLMOD-MIB.inc	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,8 @@
+#condInclude "SNMPv2-SMI.inc"  -- SNMPv2-SMI (SNMPv2 SMI)
+#condInclude "SNMPv2-TC.inc"   -- SNMPv2-TC (SNMPv2 TC macro and base TCs)
+#condInclude "UCD-SNMP-MIB.inc"
+
+#pushOpt
+#addOpt "CM"
+#condInclude "UCD-DLMOD-MIB.txt"
+#popOpt
diff -Naur tomato/release/src/router/snmp/mibs/UCD-DLMOD-MIB.txt tomato121/release/src/router/snmp/mibs/UCD-DLMOD-MIB.txt
--- tomato/release/src/router/snmp/mibs/UCD-DLMOD-MIB.txt	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/mibs/UCD-DLMOD-MIB.txt	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,119 @@
+UCD-DLMOD-MIB DEFINITIONS ::= BEGIN
+
+-- Why do we have dlmodNextIndex if the dlmodTable is read-write?
+-- What exactly is the dlmodName and dlmodPath?
+-- Should there not be a timestamp associated with dlmodError?
+-- What exactly do the dlmodStatus enumerations mean?
+
+IMPORTS
+    OBJECT-TYPE, MODULE-IDENTITY, Integer32	FROM SNMPv2-SMI
+    DisplayString				FROM SNMPv2-TC
+    ucdExperimental				FROM UCD-SNMP-MIB;
+
+ucdDlmodMIB MODULE-IDENTITY
+    LAST-UPDATED "9912100000Z"
+    ORGANIZATION "University of California, Davis"
+    CONTACT-INFO    
+	"This mib is no longer being maintained by the University of
+	 California and is now in life-support-mode and being
+	 maintained by the net-snmp project.  The best place to write
+	 for public questions about the net-snmp-coders mailing list
+	 at net-snmp-coders@lists.sourceforge.net.
+
+         postal:   Wes Hardaker
+                   P.O. Box 382
+                   Davis CA  95617
+
+         email:    net-snmp-coders@lists.sourceforge.net
+        "
+    DESCRIPTION
+	"This file defines the MIB objects for dynamic 
+	 loadable MIB modules."
+    REVISION	 "9912100000Z"
+    DESCRIPTION
+	"SMIv2 version converted from older MIB definitions."
+    ::= { ucdExperimental 14 }
+
+dlmodNextIndex OBJECT-TYPE 
+    SYNTAX	Integer32
+    MAX-ACCESS	read-only
+    STATUS	current
+    DESCRIPTION
+	"The index number of next appropiate unassigned entry
+	 in the dlmodTable."
+    ::= { ucdDlmodMIB 1 }
+
+dlmodTable OBJECT-TYPE 
+    SYNTAX	SEQUENCE OF DlmodEntry
+    MAX-ACCESS	not-accessible
+    STATUS	current
+    DESCRIPTION
+	"A table of dlmodEntry."
+    ::= { ucdDlmodMIB 2 }
+
+dlmodEntry OBJECT-TYPE
+    SYNTAX	DlmodEntry
+    MAX-ACCESS	not-accessible
+    STATUS	current
+    DESCRIPTION
+	"The parameters of dynamically loaded MIB module."
+    INDEX	{ dlmodIndex }
+    ::= { dlmodTable 1 }
+
+DlmodEntry ::= SEQUENCE {
+    dlmodIndex	Integer32,
+    dlmodName	DisplayString,
+    dlmodPath	DisplayString,
+    dlmodError	DisplayString,
+    dlmodStatus	INTEGER
+}
+
+dlmodIndex OBJECT-TYPE
+    SYNTAX	Integer32 (1..65535)
+    MAX-ACCESS	not-accessible
+    STATUS	current
+    DESCRIPTION
+	"An index that uniqely identifies an entry in the dlmodTable."
+    ::= { dlmodEntry 1 }
+
+dlmodName OBJECT-TYPE
+    SYNTAX	DisplayString
+    MAX-ACCESS	read-write
+    STATUS	current
+    DESCRIPTION
+	"The module name."
+    ::= { dlmodEntry 2 }
+
+dlmodPath OBJECT-TYPE
+    SYNTAX	DisplayString
+    MAX-ACCESS	read-write
+    STATUS	current
+    DESCRIPTION
+	"The path of the module executable file."
+    ::= { dlmodEntry 3 } 
+
+dlmodError OBJECT-TYPE
+    SYNTAX	DisplayString
+    MAX-ACCESS	read-only
+    STATUS	current
+    DESCRIPTION
+	"The last error from dlmod_load_module."
+    ::= { dlmodEntry 4 }
+
+dlmodStatus OBJECT-TYPE
+    SYNTAX	INTEGER {
+		    loaded(1),
+		    unloaded(2),
+		    error(3),
+		    load(4),
+		    unload(5),
+		    create(6),
+		    delete(7)
+		}
+    MAX-ACCESS	read-write
+    STATUS	current
+    DESCRIPTION
+	"The current status of the loaded module."
+    ::= { dlmodEntry 5 }
+
+END
diff -Naur tomato/release/src/router/snmp/mibs/UCD-IPFILTER-MIB.inc tomato121/release/src/router/snmp/mibs/UCD-IPFILTER-MIB.inc
--- tomato/release/src/router/snmp/mibs/UCD-IPFILTER-MIB.inc	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/mibs/UCD-IPFILTER-MIB.inc	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,8 @@
+#condInclude "SNMPv2-SMI.inc"  -- SNMPv2-SMI (SNMPv2 SMI)
+#condInclude "SNMPv2-TC.inc"   -- SNMPv2-TC (SNMPv2 TC macro and base TCs)
+#condInclude "UCD-SNMP-MIB.inc"
+
+#pushOpt
+#addOpt "CM"
+#condInclude "UCD-IPFILTER-MIB.txt"
+#popOpt
diff -Naur tomato/release/src/router/snmp/mibs/UCD-IPFILTER-MIB.txt tomato121/release/src/router/snmp/mibs/UCD-IPFILTER-MIB.txt
--- tomato/release/src/router/snmp/mibs/UCD-IPFILTER-MIB.txt	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/mibs/UCD-IPFILTER-MIB.txt	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,256 @@
+UCD-IPFILTER-MIB DEFINITIONS ::= BEGIN
+
+IMPORTS
+    OBJECT-TYPE, MODULE-IDENTITY, Counter32, Integer32
+	FROM SNMPv2-SMI
+    ucdExperimental
+	FROM UCD-SNMP-MIB;
+
+ucdIpFilter MODULE-IDENTITY
+    LAST-UPDATED "9912150000Z"
+    ORGANIZATION "University of California, Davis"
+    CONTACT-INFO    
+	"This mib is no longer being maintained by the University of
+	 California and is now in life-support-mode and being
+	 maintained by the net-snmp project.  The best place to write
+	 for public questions about the net-snmp-coders mailing list
+	 at net-snmp-coders@lists.sourceforge.net.
+
+         postal:   Wes Hardaker
+                   P.O. Box 382
+                   Davis CA  95617
+
+         email:    net-snmp-coders@lists.sourceforge.net
+        "
+    DESCRIPTION
+	"This module defines MIB components for reading information 
+	 from the IP Filter. This would let you only read its rules 
+	 and counters.
+
+         IP Filter by Darren Reed <darrenr@pobox.com>
+         IP Filter web page URL http://coombs.anu.edu.au/~avalon/
+         ipf-mod.pl module by Yaroslav Terletsky <ts@polynet.lviv.ua>
+         IP Filter UCD-SNMP module URL
+         ftp://ftp.polynet.lviv.ua/pub/UNIX/security/ipf/ucd-snmp-ipf-mod.tgz
+         Yaroslav Terletsky <ts@polynet.lviv.ua>"
+    REVISION	 "9912150000Z"
+    DESCRIPTION
+	"SMIv2 version converted from an older MIB definition."
+    ::= { ucdExperimental 2 }
+
+ipfInTable OBJECT-TYPE
+    SYNTAX	SEQUENCE OF IpfInEntry
+    MAX-ACCESS	not-accessible
+    STATUS	current
+    DESCRIPTION
+	"A table with IP Filter incoming rules and statistics."
+    ::= { ucdIpFilter 1 }
+
+ipfInEntry OBJECT-TYPE
+    SYNTAX	IpfInEntry
+    MAX-ACCESS	not-accessible
+    STATUS	current
+    DESCRIPTION
+	"IP Filter incoming rules table entry."
+    INDEX	{ ipfInIndex }
+    ::= { ipfInTable 1 }
+
+IpfInEntry ::= SEQUENCE {
+    ipfInIndex	Integer32,
+    ipfInRule	OCTET STRING,
+    ipfInHits	Counter32
+}
+
+ipfInIndex OBJECT-TYPE
+    SYNTAX	Integer32 (0..2147483647)
+    MAX-ACCESS	read-only
+    STATUS	current
+    DESCRIPTION
+	"Reference index for each incoming IP Filter rule."
+    ::= { ipfInEntry 1 }
+
+ipfInRule OBJECT-TYPE
+    SYNTAX	OCTET STRING
+    MAX-ACCESS	read-only
+    STATUS	current
+    DESCRIPTION
+	"Textual representation of the incoming IP Filter rule."
+    ::= { ipfInEntry 2 }
+
+ipfInHits OBJECT-TYPE
+    SYNTAX	Counter32
+    MAX-ACCESS	read-only
+    STATUS	current
+    DESCRIPTION
+	"Hits of the incoming IP Filter rule."
+    ::= { ipfInEntry 3 }
+
+ipfOutTable OBJECT-TYPE
+    SYNTAX	SEQUENCE OF IpfOutEntry
+    MAX-ACCESS	not-accessible
+    STATUS	current
+    DESCRIPTION
+	"A table with IP Filter outgoing rules and statistic."
+    ::= { ucdIpFilter 2 }
+
+ipfOutEntry OBJECT-TYPE  
+    SYNTAX	IpfOutEntry
+    MAX-ACCESS	not-accessible 
+    STATUS	current
+    DESCRIPTION
+	"IP Filter outgoing rules table entry."
+    INDEX	{ ipfOutIndex }
+    ::= { ipfOutTable 1 }
+
+IpfOutEntry ::= SEQUENCE {
+    ipfOutIndex	Integer32,
+    ipfOutRule	OCTET STRING,
+    ipfOutHits	Counter32
+}
+
+ipfOutIndex OBJECT-TYPE
+    SYNTAX	Integer32 (1..2147483647)
+    MAX-ACCESS	read-only
+    STATUS	current
+    DESCRIPTION
+	"Reference index for each outgoing IP Filter rule."
+    ::= { ipfOutEntry 1 }
+
+ipfOutRule OBJECT-TYPE
+    SYNTAX	OCTET STRING
+    MAX-ACCESS	read-only
+    STATUS	current
+    DESCRIPTION
+	"Textual representation of the outgoing IP Filter rule."
+    ::= { ipfOutEntry 2 }
+
+ipfOutHits OBJECT-TYPE
+    SYNTAX	Counter32
+    MAX-ACCESS	read-only
+    STATUS	current
+    DESCRIPTION
+	"Hits of the outgoing IP Filter rule."
+    ::= { ipfOutEntry 3 }
+
+ipfAccInTable OBJECT-TYPE
+    SYNTAX	SEQUENCE OF IpfAccInEntry
+    MAX-ACCESS	not-accessible
+    STATUS	current
+    DESCRIPTION
+	"A table with IP Filter incoming accounting rules
+	 and statistics."
+    ::= { ucdIpFilter 3 }
+
+ipfAccInEntry OBJECT-TYPE
+    SYNTAX	IpfAccInEntry
+    MAX-ACCESS	not-accessible
+    STATUS	current
+    DESCRIPTION
+	"IP FIlter incoming accounting rules table entry."
+    INDEX	{ ipfAccInIndex }
+    ::= { ipfAccInTable 1 }
+
+IpfAccInEntry ::= SEQUENCE {
+    ipfAccInIndex	Integer32,
+    ipfAccInRule	OCTET STRING,
+    ipfAccInHits	Counter32,
+    ipfAccInBytes	Counter32
+}
+
+ipfAccInIndex OBJECT-TYPE
+    SYNTAX	Integer32 (1..2147483647)
+    MAX-ACCESS	read-only
+    STATUS	current
+    DESCRIPTION
+	"Reference index for each incoming accounting
+	 IP Filter rule."
+    ::= { ipfAccInEntry 1 }
+
+ipfAccInRule OBJECT-TYPE
+    SYNTAX	OCTET STRING
+    MAX-ACCESS	read-only
+    STATUS	current
+    DESCRIPTION
+	"Textual representation of the incoming accounting
+	 IP Filter rule."
+    ::= { ipfAccInEntry 2 }
+
+ipfAccInHits OBJECT-TYPE
+    SYNTAX	Counter32
+    MAX-ACCESS	read-only
+    STATUS	current
+    DESCRIPTION
+	"Hits of the incoming accounting IP Filter rule."
+    ::= { ipfAccInEntry 3 }
+
+ipfAccInBytes OBJECT-TYPE
+    SYNTAX	Counter32
+    MAX-ACCESS	read-only
+    STATUS	current
+    DESCRIPTION
+	"Bytes passed thru the incoming accounting
+	 IP Filter rule."
+    ::= { ipfAccInEntry 4 }
+
+ipfAccOutTable OBJECT-TYPE
+    SYNTAX	SEQUENCE OF IpfAccOutEntry
+    MAX-ACCESS	not-accessible
+    STATUS	current
+    DESCRIPTION
+	"A table with IP Filter outgoing accounting rules
+	 and statistic."
+    ::= { ucdIpFilter 4 }
+
+ipfAccOutEntry OBJECT-TYPE
+    SYNTAX	IpfAccOutEntry
+    MAX-ACCESS	not-accessible
+    STATUS	current
+    DESCRIPTION
+	"IP Filter outgoing accounting rules table entry."
+    INDEX	{ ipfAccOutIndex }
+    ::= { ipfAccOutTable 1 }
+
+IpfAccOutEntry ::= SEQUENCE {
+    ipfAccOutIndex	Integer32,
+    ipfAccOutRule	OCTET STRING,
+    ipfAccOutHits	Counter32,
+    ipfAccOutBytes	Counter32
+}
+
+ipfAccOutIndex OBJECT-TYPE
+    SYNTAX	Integer32 (1..2147483647)
+    MAX-ACCESS	read-only
+    STATUS	current
+    DESCRIPTION
+	"Reference index for each outgoing accounting
+	 IP Filter rule."
+    ::= { ipfAccOutEntry 1 }
+
+ipfAccOutRule OBJECT-TYPE
+    SYNTAX	OCTET STRING
+    MAX-ACCESS	read-only
+    STATUS	current
+    DESCRIPTION
+	"Textual representation of the outgoing accounting
+	 IP Filter rule."
+    ::= { ipfAccOutEntry 2 }
+
+ipfAccOutHits OBJECT-TYPE
+    SYNTAX	Counter32
+    MAX-ACCESS	read-only
+    STATUS	current
+    DESCRIPTION
+	"Hits of the outgoing accounting IP Filter rule."
+    ::= { ipfAccOutEntry 3 }
+
+ipfAccOutBytes OBJECT-TYPE
+    SYNTAX	Counter32
+    MAX-ACCESS	read-only
+    STATUS	current
+    DESCRIPTION
+	"Bytes passed thru the outgoing accounting
+	 IP Filter rule."
+    ::= { ipfAccOutEntry 4 }
+
+END
+
diff -Naur tomato/release/src/router/snmp/mibs/UCD-IPFWACC-MIB.inc tomato121/release/src/router/snmp/mibs/UCD-IPFWACC-MIB.inc
--- tomato/release/src/router/snmp/mibs/UCD-IPFWACC-MIB.inc	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/mibs/UCD-IPFWACC-MIB.inc	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,11 @@
+-- input include file for smicng.
+
+#condInclude "SNMPv2-SMI.inc"  -- SNMPv2-SMI (SNMPv2 SMI)
+#condInclude "SNMPv2-TC.inc"   -- SNMPv2-TC (SNMPv2 TC macro and base TCs)
+#condInclude "UCD-SNMP-MIB.inc"
+
+#pushOpt
+#addOpt "CM"
+#condInclude "UCD-IPFWACC-MIB.txt"
+#popOpt
+
diff -Naur tomato/release/src/router/snmp/mibs/UCD-IPFWACC-MIB.txt tomato121/release/src/router/snmp/mibs/UCD-IPFWACC-MIB.txt
--- tomato/release/src/router/snmp/mibs/UCD-IPFWACC-MIB.txt	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/mibs/UCD-IPFWACC-MIB.txt	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,327 @@
+UCD-IPFWACC-MIB DEFINITIONS ::= BEGIN
+
+IMPORTS
+    OBJECT-TYPE, MODULE-IDENTITY, IpAddress, Integer32, Counter32
+	FROM SNMPv2-SMI
+    DisplayString
+	FROM SNMPv2-TC
+    ucdExperimental
+	FROM UCD-SNMP-MIB;
+
+ucdIpFwAccMIB MODULE-IDENTITY
+    LAST-UPDATED "9912160000Z"
+    ORGANIZATION "University of California, Davis"
+    CONTACT-INFO    
+	"This mib is no longer being maintained by the University of
+	 California and is now in life-support-mode and being
+	 maintained by the net-snmp project.  The best place to write
+	 for public questions about the net-snmp-coders mailing list
+	 at net-snmp-coders@lists.sourceforge.net.
+
+         postal:   Wes Hardaker
+                   P.O. Box 382
+                   Davis CA  95617
+
+         email:    net-snmp-coders@lists.sourceforge.net
+        "
+    DESCRIPTION
+	"This module defines MIB components for reading information
+         from the accounting rules IP Firewall. This would typically
+         let you read the rules and the counters. I did not include
+         some flags and fields that I considered irrelevant for the
+         accounting rules. Resetting the counters of the rules by SNMP
+         would be simple, but I don't consider it so useful. I gave no
+         consideration to implementing write access for allowing
+         modification of the accounting rules.
+
+         Cristian.Estan@net.utcluj.ro "
+    REVISION	 "9912160000Z"
+    DESCRIPTION
+	"SMIv2 version converted from an older MIB definition."
+    ::= { ucdExperimental 1 }
+
+ipFwAccTable OBJECT-TYPE
+    SYNTAX	SEQUENCE OF IpFwAccEntry
+    MAX-ACCESS	not-accessible
+    STATUS	current
+    DESCRIPTION
+	"A table with the accounting rules of the IP firewall"
+    ::= { ucdIpFwAccMIB 1 }
+
+ipFwAccEntry OBJECT-TYPE
+    SYNTAX	IpFwAccEntry
+    MAX-ACCESS	not-accessible
+    STATUS	current
+    DESCRIPTION
+	"An accounting rule of the IP firewall"
+    INDEX	{ ipFwAccIndex }
+    ::= { ipFwAccTable 1 }
+
+IpFwAccEntry ::= SEQUENCE {
+    ipFwAccIndex	Integer32,
+    ipFwAccSrcAddr	IpAddress,
+    ipFwAccSrcNetMask	IpAddress,
+    ipFwAccDstAddr	IpAddress,
+    ipFwAccDstNetMask	IpAddress,
+    ipFwAccViaName	DisplayString,
+    ipFwAccViaAddr	IpAddress,
+    ipFwAccProto	INTEGER,
+    ipFwAccBidir	INTEGER,
+    ipFwAccDir		INTEGER,
+    ipFwAccBytes	Counter32,
+    ipFwAccPackets	Counter32,
+    ipFwAccNrSrcPorts	Integer32,
+    ipFwAccNrDstPorts	Integer32,
+    ipFwAccSrcIsRange	INTEGER,
+    ipFwAccDstIsRange	INTEGER,
+    ipFwAccPort1	Integer32,
+    ipFwAccPort2	Integer32,
+    ipFwAccPort3	Integer32,
+    ipFwAccPort4	Integer32,
+    ipFwAccPort5	Integer32,
+    ipFwAccPort6	Integer32,
+    ipFwAccPort7	Integer32,
+    ipFwAccPort8	Integer32,
+    ipFwAccPort9	Integer32,
+    ipFwAccPort10	Integer32
+}
+
+ipFwAccIndex OBJECT-TYPE
+    SYNTAX	Integer32 (0..2147483647)
+    MAX-ACCESS	read-only
+    STATUS	current
+    DESCRIPTION
+	"Reference index for each firewall rule."
+    ::= { ipFwAccEntry 1 }
+
+ipFwAccSrcAddr OBJECT-TYPE
+    SYNTAX	IpAddress
+    MAX-ACCESS	read-only
+    STATUS	current
+    DESCRIPTION
+	"The source address in the firewall rule."
+    ::= { ipFwAccEntry 2 }
+
+ipFwAccSrcNetMask OBJECT-TYPE
+    SYNTAX	IpAddress
+    MAX-ACCESS	read-only
+    STATUS	current
+    DESCRIPTION
+	"The netmask of the source address in the firewall rule."
+    ::= { ipFwAccEntry 3 }
+
+ipFwAccDstAddr OBJECT-TYPE
+    SYNTAX	IpAddress
+    MAX-ACCESS	read-only
+    STATUS	current
+    DESCRIPTION
+	"The destination address in the firewall rule."
+    ::= { ipFwAccEntry 4 }
+
+ipFwAccDstNetMask OBJECT-TYPE
+    SYNTAX	IpAddress
+    MAX-ACCESS	read-only
+    STATUS	current
+    DESCRIPTION
+	"The netmask of the destination address in the firewall rule."
+    ::= { ipFwAccEntry 5 }
+
+ipFwAccViaName OBJECT-TYPE
+    SYNTAX	DisplayString (SIZE(1..64))
+    MAX-ACCESS	read-only
+    STATUS	current
+    DESCRIPTION
+	"The name of the interface to which the rule applies. If no
+	 interface is associated with the present rule, this should
+	 contain a dash (-)."
+    ::= { ipFwAccEntry 6 }
+
+ipFwAccViaAddr OBJECT-TYPE
+    SYNTAX	IpAddress
+    MAX-ACCESS	read-only
+    STATUS	current
+    DESCRIPTION
+	"The address of the interface to which the rule applies.
+	 Using this parameter makes sense when multiple addresses are
+	 associated to the same physical interface. If not defined
+	 for the current rule this should be set to 0."
+    ::= { ipFwAccEntry 7 }
+
+ipFwAccProto OBJECT-TYPE
+    SYNTAX	INTEGER {
+		    other(1),
+		    all(2),
+		    tcp(3),
+		    udp(4),
+		    icmp(5)
+		}
+    MAX-ACCESS	read-only
+    STATUS	current
+    DESCRIPTION
+	"The protocol(s) to which the rule applies."
+    ::= { ipFwAccEntry 8 }
+
+ipFwAccBidir OBJECT-TYPE
+    SYNTAX	INTEGER {
+		    unidirectional(1),
+		    bidirectional(2)
+		}
+    MAX-ACCESS	read-only
+    STATUS	current
+    DESCRIPTION
+	"Whether the rule works in both directions (i.e. with the
+	 source and destination parts swapped) or not."
+    ::= { ipFwAccEntry 9 }
+
+ipFwAccDir OBJECT-TYPE
+    SYNTAX	INTEGER {
+		    both(1),
+		    in(2),
+		    out(3)
+		}
+    MAX-ACCESS	read-only
+    STATUS	current
+    DESCRIPTION
+	"Whether the rule applies to packets entering or exiting the
+	 kernel."
+    ::= { ipFwAccEntry 10 }
+
+ipFwAccBytes OBJECT-TYPE
+    SYNTAX	Counter32
+    MAX-ACCESS	read-only
+    STATUS	current
+    DESCRIPTION
+	"The number of bytes that matched this rule since the last
+	 reset of the counters."
+    ::= { ipFwAccEntry 11 }
+
+ipFwAccPackets OBJECT-TYPE
+    SYNTAX	Counter32
+    MAX-ACCESS	read-only
+    STATUS	current
+    DESCRIPTION
+	"The number of packets that matched this rule since the last
+	 reset of the counters."
+    ::= { ipFwAccEntry 12 }
+
+ipFwAccNrSrcPorts OBJECT-TYPE
+    SYNTAX	Integer32
+    MAX-ACCESS	read-only
+    STATUS	current
+    DESCRIPTION
+	"The number of ports that refer to the source address."
+    ::= { ipFwAccEntry 13 }
+
+ipFwAccNrDstPorts OBJECT-TYPE
+    SYNTAX	Integer32 
+    MAX-ACCESS	read-only
+    STATUS	current
+    DESCRIPTION
+	"The number of ports that refer to the destination address."
+    ::= { ipFwAccEntry 14 }
+
+ipFwAccSrcIsRange OBJECT-TYPE
+    SYNTAX	INTEGER {
+		    srchasrange(1),
+		    srchasnorange(2)
+		}
+    MAX-ACCESS	read-only
+    STATUS	current
+    DESCRIPTION
+	"Interpret the first two ports of the source part as
+	 the upper and lower limit of an interval or not."
+    ::= { ipFwAccEntry 15 }
+
+ipFwAccDstIsRange OBJECT-TYPE
+    SYNTAX	INTEGER {
+		    dsthasrange(1),
+		    dsthasnorange(2)
+		}
+    MAX-ACCESS	read-only
+    STATUS	current
+    DESCRIPTION
+	"Interpret the first two ports of the destination part as
+	 the upper and lower limit of an interval or not."
+    ::= { ipFwAccEntry 16 }
+
+ipFwAccPort1 OBJECT-TYPE
+    SYNTAX	Integer32
+    MAX-ACCESS	read-only
+    STATUS	current
+    DESCRIPTION
+	"Port number 1."
+    ::= { ipFwAccEntry 17 }
+
+ipFwAccPort2 OBJECT-TYPE
+    SYNTAX	Integer32
+    MAX-ACCESS	read-only
+    STATUS	current
+    DESCRIPTION
+	"Port number 2."
+    ::= { ipFwAccEntry 18 }
+
+ipFwAccPort3 OBJECT-TYPE
+    SYNTAX	Integer32
+    MAX-ACCESS	read-only
+    STATUS	current
+    DESCRIPTION
+	"Port number 3."
+    ::= { ipFwAccEntry 19 }
+
+ipFwAccPort4 OBJECT-TYPE
+    SYNTAX	Integer32
+    MAX-ACCESS	read-only
+    STATUS	current
+    DESCRIPTION
+	"Port number 4."
+    ::= { ipFwAccEntry 20 }
+
+ipFwAccPort5 OBJECT-TYPE
+    SYNTAX	Integer32
+    MAX-ACCESS	read-only
+    STATUS	current
+    DESCRIPTION
+	"Port number 5."
+    ::= { ipFwAccEntry 21 }
+
+ipFwAccPort6 OBJECT-TYPE
+    SYNTAX	Integer32 
+    MAX-ACCESS	read-only
+    STATUS	current
+    DESCRIPTION
+	"Port number 6."
+    ::= { ipFwAccEntry 22 }
+
+ipFwAccPort7 OBJECT-TYPE
+    SYNTAX	Integer32
+    MAX-ACCESS	read-only
+    STATUS	current
+    DESCRIPTION
+	"Port number 7."
+    ::= { ipFwAccEntry 23 }
+
+ipFwAccPort8 OBJECT-TYPE
+    SYNTAX	Integer32
+    MAX-ACCESS	read-only
+    STATUS	current
+    DESCRIPTION
+	"Port number 8."
+    ::= { ipFwAccEntry 24 }
+
+ipFwAccPort9 OBJECT-TYPE
+     SYNTAX	Integer32
+    MAX-ACCESS	read-only
+    STATUS	current
+    DESCRIPTION
+	"Port number 9."
+    ::= { ipFwAccEntry 25 }
+
+ipFwAccPort10 OBJECT-TYPE
+    SYNTAX	Integer32
+    MAX-ACCESS	read-only
+    STATUS	current
+    DESCRIPTION
+	"Port number 10."
+    ::= { ipFwAccEntry 26 }
+
+END
diff -Naur tomato/release/src/router/snmp/mibs/UCD-SNMP-MIB.inc tomato121/release/src/router/snmp/mibs/UCD-SNMP-MIB.inc
--- tomato/release/src/router/snmp/mibs/UCD-SNMP-MIB.inc	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/mibs/UCD-SNMP-MIB.inc	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,9 @@
+-- input include file for smicng.
+
+#condInclude "SNMPv2-SMI.inc"  -- SNMPv2-SMI (SNMPv2 SMI)
+#condInclude "SNMPv2-TC.inc"   -- SNMPv2-TC (SNMPv2 TC macro and base TCs)
+
+#pushOpt
+#addOpt "CM"
+#condInclude "UCD-SNMP-MIB.txt"
+#popOpt
diff -Naur tomato/release/src/router/snmp/mibs/UCD-SNMP-MIB-OLD.txt tomato121/release/src/router/snmp/mibs/UCD-SNMP-MIB-OLD.txt
--- tomato/release/src/router/snmp/mibs/UCD-SNMP-MIB-OLD.txt	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/mibs/UCD-SNMP-MIB-OLD.txt	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,744 @@
+UCD-SNMP-MIB-OLD DEFINITIONS ::= BEGIN
+
+--
+--  This mib is a badly created mib which has been replaced by a more
+--  properly created UCD-SNMP-MIB.  Use that mib instead.  This file
+--  exists for historical purposes only and for use by people that
+--  need to support both agent versions.
+--
+
+IMPORTS
+	ucdavis
+	    FROM UCD-SNMP-MIB
+        OBJECT-TYPE 				
+	    FROM SNMPv2-SMI
+	DisplayString 				
+	    FROM SNMPv2-TC
+	Integer32
+            FROM SNMPv2-SMI;
+
+-- private	  OBJECT IDENTIFIER ::= { internet 4 }
+-- enterprises    OBJECT IDENTIFIER ::= { private 1 }
+-- ucdavis          OBJECT IDENTIFIER ::= { enterprises 2021 }
+-- processes      OBJECT IDENTIFIER ::= { ucdavis 1 }
+-- exec           OBJECT IDENTIFIER ::= { ucdavis 3 }
+-- memory         OBJECT IDENTIFIER ::= { ucdavis 4 }
+-- lockd          OBJECT IDENTIFIER ::= { ucdavis 5 }
+-- disk           OBJECT IDENTIFIER ::= { ucdavis 6 }
+-- load           OBJECT IDENTIFIER ::= { ucdavis 7 }
+-- version        OBJECT IDENTIFIER ::= { ucdavis 100 }
+-- snmperrs       OBJECT IDENTIFIER ::= { ucdavis 101 }
+-- mibRegistryTable    OBJECT IDENTIFIER ::= { ucdavis 102 }
+
+-- These are the returned values of the agent type.
+-- returned to:  .iso.org.dod.internet.mgmt.mib-2.system.sysObjectID.0 
+
+-- The following section is commented out since it is defined in the
+-- current UCD-SNMP-MIB
+
+-- ucdSnmpAgent      OBJECT IDENTIFIER ::= { ucdavis 250 }
+-- hpux9             OBJECT IDENTIFIER ::= { ucdSnmpAgent 1 }
+-- hpux10            OBJECT IDENTIFIER ::= { ucdSnmpAgent 6 }
+-- sunos4            OBJECT IDENTIFIER ::= { ucdSnmpAgent 2 }
+-- solaris           OBJECT IDENTIFIER ::= { ucdSnmpAgent 3 }
+-- osf               OBJECT IDENTIFIER ::= { ucdSnmpAgent 4 }
+-- ultrix            OBJECT IDENTIFIER ::= { ucdSnmpAgent 5 }
+-- netbsd1           OBJECT IDENTIFIER ::= { ucdSnmpAgent 7 }
+-- freebsd           OBJECT IDENTIFIER ::= { ucdSnmpAgent 8 }
+-- irix              OBJECT IDENTIFIER ::= { ucdSnmpAgent 9 }
+-- linux             OBJECT IDENTIFIER ::= { ucdSnmpAgent 10 }
+-- bsdi              OBJECT IDENTIFIER ::= { ucdSnmpAgent 11 }
+-- unknown           OBJECT IDENTIFIER ::= { ucdSnmpAgent 255 }
+
+
+
+Processes ::= SEQUENCE {
+   processIndex  INTEGER,
+   processNames  DisplayString,
+   processMin    INTEGER,
+   processMax    INTEGER,
+   processCount  INTEGER,
+   processErrorFlag  INTEGER,
+   processErrMessage  DisplayString,
+   processErrFix  INTEGER
+}
+
+processes OBJECT-TYPE
+	SYNTAX SEQUENCE OF Processes
+	ACCESS not-accessible
+	STATUS mandatory
+	DESCRIPTION
+		"A set of information on running programs/daemons."
+	INDEX { processIndex }
+	::= { ucdavis 1 }
+
+processIndex OBJECT-TYPE
+	SYNTAX INTEGER
+	ACCESS read-only
+	STATUS mandatory
+	DESCRIPTION
+		"Reference Index for each observed process."
+	::= { processes 1 }
+
+processNames OBJECT-TYPE
+	SYNTAX DisplayString  (SIZE (0..255))
+	ACCESS read-only
+	STATUS mandatory
+	DESCRIPTION
+		"The table of process names we're Counting."
+	::= { processes 2 }
+
+processMin OBJECT-TYPE
+	SYNTAX INTEGER
+	ACCESS read-only
+	STATUS mandatory
+	DESCRIPTION
+		"The minimum number of processes that should be
+		running.  An error flag is generated if the number of
+		running processes is < the minimum."
+	::= { processes 3 }
+
+processMax OBJECT-TYPE
+	SYNTAX INTEGER
+	ACCESS read-only
+	STATUS mandatory
+	DESCRIPTION
+		"The maximum number of processes that should be
+		running.  An error flag is generated if the number of
+		running processes is > the maximum."
+	::= { processes 4 }
+
+processCount OBJECT-TYPE
+	SYNTAX INTEGER
+	ACCESS read-only
+	STATUS mandatory
+	DESCRIPTION
+		"The number of current processes running with the name
+		in question."
+	::= { processes 5 }
+
+processErrorFlag OBJECT-TYPE
+	SYNTAX INTEGER
+	ACCESS read-only
+	STATUS mandatory
+	DESCRIPTION
+		"A Error flag to indicate trouble with a process.  It
+		goes to 1 if there is an error, 0 if no error."
+	::= { processes 100 }
+
+processErrMessage OBJECT-TYPE
+	SYNTAX DisplayString  (SIZE (0..255))
+	ACCESS read-only
+	STATUS mandatory
+	DESCRIPTION
+		"An error message describing the problem (if one exists)."
+	::= { processes 101 }
+
+processErrFix OBJECT-TYPE
+	SYNTAX INTEGER
+	ACCESS read-write
+	STATUS mandatory
+	DESCRIPTION
+		"Setting this to one will try to fix the problem if possible."
+	::= { processes 102 }
+
+extensible OBJECT-TYPE
+	SYNTAX SEQUENCE OF Extensible
+	ACCESS not-accessible
+	STATUS mandatory
+	DESCRIPTION
+		"Extensible commands returning output and result codes."
+	INDEX { extensibleIndex }
+	::= { ucdavis 3 }
+
+Extensible ::= SEQUENCE {
+   extensibleIndex   INTEGER,
+   extensibleNames   DisplayString,
+   extensibleCommand DisplayString,
+   extensibleResult  INTEGER,
+   extensibleOutput  DisplayString,
+   extensibleErrFix  INTEGER
+}
+
+extensibleIndex OBJECT-TYPE
+	SYNTAX INTEGER
+	ACCESS read-only
+	STATUS mandatory
+	DESCRIPTION
+		"Reference Index for extensible calls."
+	::= { extensible 1 }
+
+extensibleNames OBJECT-TYPE
+	SYNTAX DisplayString  (SIZE (0..255))
+	ACCESS read-only
+	STATUS mandatory
+	DESCRIPTION
+		"Short, one name descriptions of the extensible commands."
+	::= { extensible 2 }
+
+extensibleCommand OBJECT-TYPE
+	SYNTAX DisplayString  (SIZE (0..255))
+	ACCESS read-only
+	STATUS mandatory
+	DESCRIPTION
+		"The command line to be executed."
+	::= { extensible 3 }
+
+extensibleResult OBJECT-TYPE
+	SYNTAX INTEGER
+	ACCESS read-only
+	STATUS mandatory
+	DESCRIPTION
+		"The result code from the executed command."
+	::= { extensible 100 }
+
+extensibleOutput OBJECT-TYPE
+	SYNTAX DisplayString (SIZE (0..255))
+	ACCESS read-only
+	STATUS mandatory
+	DESCRIPTION
+		"The output of the extensible command (top line only)."
+	::= { extensible 101 }
+
+extensibleErrFix OBJECT-TYPE
+	SYNTAX INTEGER
+	ACCESS read-write
+	STATUS mandatory
+	DESCRIPTION
+		"Set to 1 to fix the problem, if possible."
+	::= { extensible 102 }
+	
+-- the following section is commented out because it is already
+-- defined in the current UCD-SNMP-MIB
+   
+-- memory OBJECT-TYPE
+-- 	SYNTAX Memory
+-- 	ACCESS not-accessible
+-- 	STATUS mandatory
+-- 	DESCRIPTION
+-- 		"Miscellanous stuff - memory related."
+-- 	::= { ucdavis 4 }
+-- 
+-- Memory ::= SEQUENCE {
+--    memIndex        INTEGER,
+--    memErrorName    DisplayString,
+--    memTotalSwap     INTEGER,
+--    memAvailSwap     INTEGER,
+--    memTotalReal     INTEGER,
+--    memAvailReal     INTEGER,
+--    memTotalSwapTXT     INTEGER,
+--    memAvailSwapTXT     INTEGER,
+--    memTotalRealTXT     INTEGER,
+--    memAvailRealTXT     INTEGER,
+--    memTotalFree       INTEGER,
+--    memMinimumSwap       INTEGER,
+--    memSwapError       DisplayString,
+--    memShared          INTEGER,
+--    memBuffer          INTEGER,
+--    memCached          INTEGER
+-- }
+-- memIndex OBJECT-TYPE
+--      SYNTAX  INTEGER
+--      ACCESS  read-only
+--      STATUS  mandatory
+--      DESCRIPTION  
+--           "Generic Index."
+--      ::= { memory 1 } 
+-- 
+-- memErrorName OBJECT-TYPE
+--      SYNTAX  DisplayString
+--      ACCESS  read-only
+--      STATUS  mandatory
+--      DESCRIPTION  
+--           "Bogus Name (swap) for consistancy with the rest of the mibs."
+--      ::= { memory 2 } 
+-- 
+-- memTotalSwap OBJECT-TYPE
+-- 	SYNTAX INTEGER
+-- 	ACCESS read-only
+-- 	STATUS mandatory
+-- 	DESCRIPTION
+-- 		"Total Swap Size."
+-- 	::= { memory 3 }
+-- 
+-- memAvailSwap OBJECT-TYPE
+-- 	SYNTAX INTEGER
+-- 	ACCESS read-only
+-- 	STATUS mandatory
+-- 	DESCRIPTION
+-- 		"Available Swap Space."
+-- 	::= { memory 4 }
+-- 
+-- memTotalReal OBJECT-TYPE
+-- 	SYNTAX INTEGER
+-- 	ACCESS read-only
+-- 	STATUS mandatory
+-- 	DESCRIPTION
+-- 		"Total Real/Physical Memory Size."
+-- 	::= { memory 5 }
+-- 
+-- memAvailReal OBJECT-TYPE
+-- 	SYNTAX INTEGER
+-- 	ACCESS read-only
+-- 	STATUS mandatory
+-- 	DESCRIPTION
+-- 		"Available Real/Physical Memory Space."
+-- 	::= { memory 6 }
+-- 
+-- memTotalSwapTXT OBJECT-TYPE
+-- 	SYNTAX INTEGER
+-- 	ACCESS read-only
+-- 	STATUS mandatory
+-- 	DESCRIPTION
+-- 		"Total VM used by text."
+-- 	::= { memory 7 }
+-- 
+-- memAvailSwapTXT OBJECT-TYPE
+-- 	SYNTAX INTEGER
+-- 	ACCESS read-only
+-- 	STATUS mandatory
+-- 	DESCRIPTION
+-- 		"Active VM used by text."
+-- 	::= { memory 8 }
+-- 
+-- memTotalRealTXT OBJECT-TYPE
+-- 	SYNTAX INTEGER
+-- 	ACCESS read-only
+-- 	STATUS mandatory
+-- 	DESCRIPTION
+-- 		"Total Real/Physical Memory Size used by txt."
+-- 	::= { memory 9 }
+-- 
+-- memAvailRealTXT OBJECT-TYPE
+-- 	SYNTAX INTEGER
+-- 	ACCESS read-only
+-- 	STATUS mandatory
+-- 	DESCRIPTION
+-- 		"Active Real/Physical Memory Space used by txt."
+-- 	::= { memory 10 }
+-- 
+-- memTotalFree OBJECT-TYPE
+-- 	SYNTAX INTEGER
+-- 	ACCESS read-only
+-- 	STATUS mandatory
+-- 	DESCRIPTION
+-- 		"Total Available Memory"
+-- 	::= { memory 11 }
+-- 
+-- memMinimumSwap OBJECT-TYPE
+-- 	SYNTAX INTEGER
+-- 	ACCESS read-only
+-- 	STATUS mandatory
+-- 	DESCRIPTION
+-- 		"Minimum amount of free swap.  Otherwise memErrorSwap
+-- 		is set to 1 "
+-- 	::= { memory 12 }
+-- 
+-- memShared OBJECT-TYPE
+-- 	SYNTAX INTEGER
+-- 	ACCESS read-only
+-- 	STATUS mandatory
+-- 	DESCRIPTION
+-- 		"Total Shared Memory"
+-- 	::= { memory 13 }
+-- 
+-- memBuffer OBJECT-TYPE
+-- 	SYNTAX INTEGER
+-- 	ACCESS read-only
+-- 	STATUS mandatory
+-- 	DESCRIPTION
+-- 		"Total Buffered Memory"
+-- 	::= { memory 14 }
+-- 
+-- memCached OBJECT-TYPE
+-- 	SYNTAX INTEGER
+-- 	ACCESS read-only
+-- 	STATUS mandatory
+-- 	DESCRIPTION
+-- 		"Total Cached Memory"
+-- 	::= { memory 15 }
+-- 
+-- memSwapError OBJECT-TYPE
+-- 	SYNTAX INTEGER
+-- 	ACCESS read-only
+-- 	STATUS mandatory
+-- 	DESCRIPTION
+-- 		"Error flag.  1 indicates very little swap space left"
+-- 	::= { memory 100 }
+-- 	
+-- memSwapErrorMsg OBJECT-TYPE
+--      SYNTAX  DisplayString
+--      ACCESS  read-only
+--      STATUS  mandatory
+--      DESCRIPTION  
+--           "Error message describing the errorflag condition"
+--      ::= { memory 101 } 
+-- 
+-- lockd OBJECT-TYPE
+-- 	SYNTAX Lockd
+-- 	ACCESS not-accessible
+-- 	STATUS mandatory
+-- 	DESCRIPTION
+-- 		"Tests the functionality of the rpc.lockd/rpc.statd pair."
+-- 	INDEX { lockdIndex }
+-- 	::= { ucdavis 5 }
+
+-- Lockd ::= SEQUENCE {
+--    lockdIndex   INTEGER,
+--    lockdError  INTEGER,
+--    lockdErrorMsg  DisplayString
+-- }
+-- 
+-- lockdIndex OBJECT-TYPE
+-- 	SYNTAX INTEGER
+-- 	ACCESS read-only
+-- 	STATUS mandatory
+-- 	DESCRIPTION
+-- 		"Reference Index for lockd calls."
+-- 	::= { lockd 1 }
+-- 
+-- lockdError OBJECT-TYPE
+-- 	SYNTAX INTEGER
+-- 	ACCESS read-only
+-- 	STATUS mandatory
+-- 	DESCRIPTION
+-- 		"Error Flag.  > 0 indicates error"
+-- 	::= { lockd 100 }
+-- 
+-- lockdErrorMsg OBJECT-TYPE
+-- 	SYNTAX DisplayString (SIZE (0..255))
+-- 	ACCESS read-only
+-- 	STATUS mandatory
+-- 	DESCRIPTION
+-- 		"Error message if something is wrong"
+-- 	::= { lockd 101 }
+
+disk 	OBJECT-TYPE
+	SYNTAX SEQUENCE OF Disk
+	ACCESS not-accessible
+	STATUS mandatory
+	DESCRIPTION
+		"Disk watching information."
+	INDEX { diskIndex }
+	::= { ucdavis 6 }
+
+Disk ::= SEQUENCE {
+   diskIndex   INTEGER,
+   diskPath  DisplayString,
+   diskDevice  DisplayString,
+   diskMinimum  INTEGER,
+   diskMinPercent  INTEGER,
+   diskTotal  INTEGER,
+   diskAvail  INTEGER,
+   diskUsed  INTEGER,
+   diskPercent  INTEGER,
+   diskErrorFlag  INTEGER,
+   diskErrorMsg  DisplayString
+}
+
+diskIndex OBJECT-TYPE
+	SYNTAX INTEGER
+	ACCESS read-only
+	STATUS mandatory
+	DESCRIPTION
+		"Reference number for the Disk Mib."
+	::= { disk 1 }
+	
+diskPath OBJECT-TYPE
+     SYNTAX  DisplayString
+     ACCESS  read-only
+     STATUS  mandatory
+     DESCRIPTION  
+          "Path where disk is mounted."
+     ::= { disk 2 } 
+
+diskDevice OBJECT-TYPE
+     SYNTAX  DisplayString
+     ACCESS  read-only
+     STATUS  mandatory
+     DESCRIPTION  
+          "Device path"
+     ::= { disk 3 } 
+
+diskMinimum OBJECT-TYPE
+     SYNTAX  INTEGER
+     ACCESS  read-only
+     STATUS  mandatory
+     DESCRIPTION  
+          "Minimum space required on the disk."
+     ::= { disk 4 } 
+
+diskMinPercent OBJECT-TYPE
+     SYNTAX  INTEGER
+     ACCESS  read-only
+     STATUS  mandatory
+     DESCRIPTION  
+          "Minimum percentage of space required on the disk."
+     ::= { disk 5 } 
+
+diskTotal OBJECT-TYPE
+     SYNTAX  INTEGER
+     ACCESS  read-only
+     STATUS  mandatory
+     DESCRIPTION  
+          "Total Disk Size (kbytes)"
+     ::= { disk 6 } 
+
+diskAvail OBJECT-TYPE
+     SYNTAX  INTEGER
+     ACCESS  read-only
+     STATUS  mandatory
+     DESCRIPTION  
+          "Available disk Space"
+     ::= { disk 7 } 
+
+diskUsed OBJECT-TYPE
+     SYNTAX  INTEGER
+     ACCESS  read-only
+     STATUS  mandatory
+     DESCRIPTION  
+          "Used Space on Disk"
+     ::= { disk 8 } 
+
+diskPercent OBJECT-TYPE
+     SYNTAX  INTEGER
+     ACCESS  read-only
+     STATUS  mandatory
+     DESCRIPTION  
+          "Percentage of space used on disk"
+     ::= { disk 9 } 
+
+diskErrorFlag OBJECT-TYPE
+     SYNTAX  INTEGER
+     ACCESS  read-only
+     STATUS  mandatory
+     DESCRIPTION  
+          "Error flag signaling disk is over minimum required space"
+     ::= { disk 100 } 
+     
+diskErrorMsg OBJECT-TYPE
+     SYNTAX  DisplayString
+     ACCESS  read-only
+     STATUS  mandatory
+     DESCRIPTION  
+          "A text description of what caused the error flag to be set."
+     ::= { disk 101 } 
+     
+loadaves OBJECT-TYPE
+	SYNTAX SEQUENCE OF Loadaves
+	ACCESS not-accessible
+	STATUS mandatory
+	DESCRIPTION
+		"Load average information."
+	INDEX { loadaveIndex }
+	::= { ucdavis 7 }
+
+
+Loadaves ::= SEQUENCE {
+   loadaveIndex  INTEGER,
+   loadaveNames  DisplayString,
+   loadaveLoad   DisplayString,
+   loadaveConfig DisplayString,
+   loadaveErrorFlag  INTEGER,
+   loadaveErrMessage  DisplayString
+}
+
+loadaveIndex OBJECT-TYPE
+	SYNTAX INTEGER
+	ACCESS read-only
+	STATUS mandatory
+	DESCRIPTION
+		"Reference Index for each observed loadave."
+	::= { loadaves 1 }
+
+loadaveNames OBJECT-TYPE
+	SYNTAX DisplayString (SIZE (0..255))
+	ACCESS read-only
+	STATUS mandatory
+	DESCRIPTION
+		"The list of loadave names we're Counting."
+	::= { loadaves 2 }
+
+loadaveLoad OBJECT-TYPE
+	SYNTAX DisplayString
+	ACCESS read-only
+	STATUS mandatory
+	DESCRIPTION
+		"The 1,5 and 10 minute load averages."
+	::= { loadaves 3 }
+
+loadaveConfig OBJECT-TYPE
+	SYNTAX DisplayString
+	ACCESS read-only
+	STATUS mandatory
+	DESCRIPTION
+		"The watch point for loadaverages to signal an error."
+	::= { loadaves 4 }
+
+loadaveErrorFlag OBJECT-TYPE
+	SYNTAX INTEGER
+	ACCESS read-only
+	STATUS mandatory
+	DESCRIPTION
+		"A Error flag to indicate trouble with a loadave.  It
+		goes to 1 if there is an error, 0 if no error."
+	::= { loadaves 100 }
+
+loadaveErrMessage OBJECT-TYPE
+	SYNTAX DisplayString (SIZE (0..255))
+	ACCESS read-only
+	STATUS mandatory
+	DESCRIPTION
+		"An error message describing the problem (if one exists)."
+	::= { loadaves 101 }
+
+-- the following section is commented out because it is already
+-- defined in the current UCD-SNMP-MIB
+
+-- version	OBJECT-TYPE
+-- 	SYNTAX Version
+-- 	ACCESS not-accessible
+-- 	STATUS mandatory
+-- 	DESCRIPTION
+-- 		"ece-snmpd version info."
+-- 	INDEX { versionIndex }
+-- 	::= { ucdavis 100 }
+-- 
+-- Version ::= SEQUENCE {
+--    versionIndex   INTEGER,
+--    versionTag  DisplayString,
+--    versionDate  DisplayString,
+--    versionCDate  DisplayString,
+--    versionIdent  DisplayString,
+--    versionClearCache  INTEGER,
+--    versionUpdateConfig  INTEGER,
+--    versionDoDebugging  INTEGER
+-- }
+--    
+-- versionIndex OBJECT-TYPE
+--      SYNTAX  INTEGER
+--      ACCESS  read-only
+--      STATUS  mandatory
+--      DESCRIPTION  
+--           "Index to mib (always 1)"
+--      ::= { version 1 } 
+-- 
+-- versionTag OBJECT-TYPE
+--      SYNTAX  DisplayString
+--      ACCESS  read-only
+--      STATUS  mandatory
+--      DESCRIPTION  
+--           "CVS tag keyword"
+--      ::= { version 2 } 
+--      
+-- versionDate OBJECT-TYPE
+--      SYNTAX  DisplayString
+--      ACCESS  read-only
+--      STATUS  mandatory
+--      DESCRIPTION  
+--           "Date string from RCS keyword"
+--      ::= { version 3 } 
+-- 
+-- versionCDate OBJECT-TYPE
+--      SYNTAX  DisplayString
+--      ACCESS  read-only
+--      STATUS  mandatory
+--      DESCRIPTION  
+--           "Date string from ctime() "
+--      ::= { version 4 } 
+-- 
+-- versionIdent OBJECT-TYPE
+--      SYNTAX  DisplayString
+--      ACCESS  read-only
+--      STATUS  mandatory
+--      DESCRIPTION  
+--           "Id string from RCS keyword"
+--      ::= { version 5 } 
+-- 
+-- versionClearCache OBJECT-TYPE
+--      SYNTAX  INTEGER
+--      ACCESS  read-write
+--      STATUS  mandatory
+--      DESCRIPTION  
+--           "Set to 1 to clear the exec cache, if enabled"
+--      ::= { version 10 } 
+-- 
+-- versionUpdateConfig OBJECT-TYPE
+--      SYNTAX  INTEGER
+--      ACCESS  read-write
+--      STATUS  mandatory
+--      DESCRIPTION  
+--           "Set to 1 to read-read the config file(s)."
+--      ::= { version 11 } 
+-- 
+-- versionRestartAgent OBJECT-TYPE
+--      SYNTAX  INTEGER
+--      ACCESS  read-write
+--      STATUS  mandatory
+--      DESCRIPTION  
+--           "Set to 1 to restart the agent."
+--      ::= { version 12 } 
+-- 
+-- versionDoDebugging OBJECT-TYPE
+--      SYNTAX  INTEGER
+--      ACCESS  read-write
+--      STATUS  mandatory
+--      DESCRIPTION  
+--           "Set to 1 to turn debugging statements on in the agent."
+--      ::= { version 20 } 
+-- 
+
+-- the following section is commented out because it is already
+-- defined in the current UCD-SNMP-MIB
+
+-- snmperrs OBJECT-TYPE
+-- 	SYNTAX Snmperrs
+-- 	ACCESS not-accessible
+-- 	STATUS mandatory
+-- 	DESCRIPTION
+-- 		"A place for the agent to report problems."
+-- 	INDEX { snmperrIndex }
+-- 	::= { ucdavis 101 }
+-- 
+-- 
+-- Snmperrs ::= SEQUENCE {
+--    snmperrIndex  INTEGER,
+--    snmperrNames  DisplayString,
+--    snmperrErrorFlag  INTEGER,
+--    snmperrErrMessage  DisplayString
+-- }
+-- 
+-- snmperrIndex OBJECT-TYPE
+-- 	SYNTAX INTEGER
+-- 	ACCESS read-only
+-- 	STATUS mandatory
+-- 	DESCRIPTION
+-- 		"Reference Index for each observed snmperr."
+-- 	::= { snmperrs 1 }
+-- 
+-- snmperrNames OBJECT-TYPE
+-- 	SYNTAX DisplayString (SIZE (0..255))
+-- 	ACCESS read-only
+-- 	STATUS mandatory
+-- 	DESCRIPTION
+-- 		"snmp"
+-- 	::= { snmperrs 2 }
+-- 
+-- snmperrErrorFlag OBJECT-TYPE
+-- 	SYNTAX INTEGER
+-- 	ACCESS read-only
+-- 	STATUS mandatory
+-- 	DESCRIPTION
+-- 		"A Error flag to indicate trouble with the agent.  It
+-- 		goes to 1 if there is an error, 0 if no error."
+-- 	::= { snmperrs 100 }
+-- 
+-- snmperrErrMessage OBJECT-TYPE
+-- 	SYNTAX DisplayString (SIZE (0..255))
+-- 	ACCESS read-only
+-- 	STATUS mandatory
+-- 	DESCRIPTION
+-- 		"An error message describing the problem (if one exists)."
+-- 	::= { snmperrs 101 }
+-- 
+END
diff -Naur tomato/release/src/router/snmp/mibs/UCD-SNMP-MIB.txt tomato121/release/src/router/snmp/mibs/UCD-SNMP-MIB.txt
--- tomato/release/src/router/snmp/mibs/UCD-SNMP-MIB.txt	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/mibs/UCD-SNMP-MIB.txt	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,1382 @@
+UCD-SNMP-MIB DEFINITIONS ::= BEGIN
+
+-- Design notes:
+--
+-- The design of this mib may seem unusual in parts, as it was
+-- designed for ease of numerical management routines.
+-- 
+-- In that light, most sub-sections of this mib have four common
+-- numerical oid consistencies:
+--
+-- 2021.ID.1   : an integer index value.  In scalers, this is always
+--               of value 1.  In tables it is a row index.
+-- 2021.ID.2   : a name of the script, process, etc. that this row represents.
+-- 2021.ID.100 : An error flag indicating if an error is present on
+--               that row (a threshold value was crossed, etc).
+-- 2021.ID.101 : An error string describing why the error flag is non-0.
+--
+-- These conventions enable managers to easy examine portions of the
+-- mib by setting the ID to the sub-section they are interested in
+-- monitoring, and then scanning the .100 value to check for an
+-- error(s), and get a more specific error message from .101 for the
+-- named check found in .2.
+--
+-- Row numbers between 2 and 100 are sub-section specific.
+--
+-- Mib sections utilizing the above conventions:
+--   Tables:  	procTable, execTable, diskTable, loadTable
+--   Scalers: 	memory, snmperrs
+
+
+IMPORTS
+    OBJECT-TYPE, NOTIFICATION-TYPE, MODULE-IDENTITY,
+    Integer32, Opaque, enterprises, Counter32
+        FROM SNMPv2-SMI
+
+    TEXTUAL-CONVENTION, DisplayString, TruthValue
+	FROM SNMPv2-TC;
+
+ucdavis MODULE-IDENTITY
+    LAST-UPDATED "200209050000Z"
+    ORGANIZATION "University of California, Davis"
+    CONTACT-INFO    
+	"This mib is no longer being maintained by the University of
+	 California and is now in life-support-mode and being
+	 maintained by the net-snmp project.  The best place to write
+	 for public questions about the net-snmp-coders mailing list
+	 at net-snmp-coders@lists.sourceforge.net.
+
+         postal:   Wes Hardaker
+                   P.O. Box 382
+                   Davis CA  95617
+
+         email:    net-snmp-coders@lists.sourceforge.net
+        "
+    DESCRIPTION
+	"Deprecate the non-raw objects."
+    REVISION	 "200209050000Z"
+    DESCRIPTION
+	"This file defines the private UCD SNMP MIB extensions."
+    REVISION	 "200101170000Z"
+    DESCRIPTION
+	"Added raw CPU and IO counters."
+    REVISION	 "9912090000Z"
+    DESCRIPTION
+	"SMIv2 version converted from older MIB definitions."
+    ::= { enterprises 2021 }
+
+-- Current UCD core mib table entries:
+--   prTable          OBJECT IDENTIFIER ::= { ucdavis   2 }
+--   memory           OBJECT IDENTIFIER ::= { ucdavis   4 }
+--   extTable         OBJECT IDENTIFIER ::= { ucdavis   8 }
+--   diskTable        OBJECT IDENTIFIER ::= { ucdavis   9 }
+--   loadTable        OBJECT IDENTIFIER ::= { ucdavis  10 }
+--   systemStats      OBJECT IDENTIFIER ::= { ucdavis  11 }
+--   ucdDemoMIB       OBJECT IDENTIFIER ::= { ucdavis  14 } - UCD-DEMO-MIB
+--   fileTable        OBJECT IDENTIFIER ::= { ucdavis  15 }
+--   logmatch         OBJECT IDENTIFIER ::= { ucdavis  15 }
+--   version          OBJECT IDENTIFIER ::= { ucdavis 100 }
+--   snmperrs         OBJECT IDENTIFIER ::= { ucdavis 101 }
+--   mibRegistryTable OBJECT IDENTIFIER ::= { ucdavis 102 }
+
+-- Older mib table entries that were changed to new locations above:
+--   processes        OBJECT IDENTIFIER ::= { ucdavis   1 }
+--   exec             OBJECT IDENTIFIER ::= { ucdavis   3 }
+--   disk             OBJECT IDENTIFIER ::= { ucdavis   6 }
+--   load             OBJECT IDENTIFIER ::= { ucdavis   7 }
+
+-- Never implemented and removed from the mib:
+--   lockd            OBJECT IDENTIFIER ::= { ucdavis   5 }
+
+-- Branches for registering other UCD MIB modules:
+ucdInternal           OBJECT IDENTIFIER ::= { ucdavis 12 }
+ucdExperimental       OBJECT IDENTIFIER ::= { ucdavis 13 }
+
+-- OID values assigned in the ucdExperimental branch:
+--   ucdIpFwAccMIB    OBJECT IDENTIFIER ::= { ucdExperimental  1 } - UCD-IPFWACC-MIB
+--   ucdIpFilter      OBJECT IDENTIFIER ::= { ucdExperimental  2 } - UCD-IPFILTER-MIB
+--   wavelan          OBJECT IDENTIFIER ::= { ucdExperimental  3 } - WL-MIB
+--   ucdDlmodMIB      OBJECT IDENTIFIER ::= { ucdExperimental 14 } - UCD-DLMOD-MIB
+--   ucdDiskIOMIB     OBJECT IDENTIFIER ::= { ucdExperimental 15 } - UCD-DISKIO-MIB
+--   lmSensors        OBJECT IDENTIFIER ::= { ucdExperimental 16 } - LM-SENSORS-MIB
+
+
+-- These are the returned values of the agent type.
+-- returned to:  .iso.org.dod.internet.mgmt.mib-2.system.sysObjectID.0 
+
+ucdSnmpAgent      OBJECT IDENTIFIER ::= { ucdavis 250 }
+hpux9             OBJECT IDENTIFIER ::= { ucdSnmpAgent 1 }
+sunos4            OBJECT IDENTIFIER ::= { ucdSnmpAgent 2 }
+solaris           OBJECT IDENTIFIER ::= { ucdSnmpAgent 3 }
+osf               OBJECT IDENTIFIER ::= { ucdSnmpAgent 4 }
+ultrix            OBJECT IDENTIFIER ::= { ucdSnmpAgent 5 }
+hpux10            OBJECT IDENTIFIER ::= { ucdSnmpAgent 6 }
+netbsd1           OBJECT IDENTIFIER ::= { ucdSnmpAgent 7 }
+freebsd           OBJECT IDENTIFIER ::= { ucdSnmpAgent 8 }
+irix              OBJECT IDENTIFIER ::= { ucdSnmpAgent 9 }
+linux             OBJECT IDENTIFIER ::= { ucdSnmpAgent 10 }
+bsdi              OBJECT IDENTIFIER ::= { ucdSnmpAgent 11 }
+openbsd           OBJECT IDENTIFIER ::= { ucdSnmpAgent 12 }
+win32		  OBJECT IDENTIFIER ::= { ucdSnmpAgent 13 } -- unlucky
+hpux11            OBJECT IDENTIFIER ::= { ucdSnmpAgent 14 }
+unknown           OBJECT IDENTIFIER ::= { ucdSnmpAgent 255 }
+
+
+--
+-- Define the Float Textual Convention
+--   This definition was written by David Perkins.
+--
+
+Float ::= TEXTUAL-CONVENTION
+    STATUS      current
+    DESCRIPTION
+        "A single precision floating-point number.  The semantics
+         and encoding are identical for type 'single' defined in
+         IEEE Standard for Binary Floating-Point,
+         ANSI/IEEE Std 754-1985.
+         The value is restricted to the BER serialization of
+         the following ASN.1 type:
+             FLOATTYPE ::= [120] IMPLICIT FloatType
+         (note: the value 120 is the sum of '30'h and '48'h)
+         The BER serialization of the length for values of
+         this type must use the definite length, short
+         encoding form.
+
+         For example, the BER serialization of value 123
+         of type FLOATTYPE is '9f780442f60000'h.  (The tag
+         is '9f78'h; the length is '04'h; and the value is
+         '42f60000'h.) The BER serialization of value
+         '9f780442f60000'h of data type Opaque is
+         '44079f780442f60000'h. (The tag is '44'h; the length
+         is '07'h; and the value is '9f780442f60000'h."
+    SYNTAX Opaque (SIZE (7))
+
+--
+-- Process table checks
+--
+
+prTable OBJECT-TYPE
+    SYNTAX	SEQUENCE OF PrEntry
+    MAX-ACCESS	not-accessible
+    STATUS	current
+    DESCRIPTION
+	"A table containing information on running
+	 programs/daemons configured for monitoring in the
+	 snmpd.conf file of the agent.  Processes violating the
+	 number of running processes required by the agent's
+	 configuration file are flagged with numerical and
+	 textual errors."
+    ::= { ucdavis 2 }
+
+prEntry OBJECT-TYPE
+    SYNTAX	PrEntry
+    MAX-ACCESS	not-accessible
+    STATUS	current
+    DESCRIPTION
+        "An entry containing a process and its statistics."
+    INDEX	{ prIndex }
+    ::= { prTable  1 }
+
+PrEntry ::= SEQUENCE {
+    prIndex		Integer32,
+    prNames		DisplayString,
+    prMin		Integer32,
+    prMax		Integer32,
+    prCount		Integer32,
+    prErrorFlag		Integer32,
+    prErrMessage	DisplayString,
+    prErrFix		Integer32,
+    prErrFixCmd		DisplayString
+}
+
+prIndex OBJECT-TYPE
+    SYNTAX	Integer32 (0..65535)
+    MAX-ACCESS	read-only
+    STATUS	current
+    DESCRIPTION
+	"Reference Index for each observed process."
+    ::= { prEntry 1 }
+
+prNames OBJECT-TYPE
+    SYNTAX	DisplayString
+    MAX-ACCESS	read-only
+    STATUS	current
+    DESCRIPTION
+	"The process name we're counting/checking on."
+    ::= { prEntry 2 }
+
+prMin OBJECT-TYPE
+    SYNTAX	Integer32
+    MAX-ACCESS	read-only
+    STATUS	current
+    DESCRIPTION
+	"The minimum number of processes that should be
+	 running.  An error flag is generated if the number of
+	 running processes is < the minimum."
+    ::= { prEntry 3 }
+
+prMax OBJECT-TYPE
+    SYNTAX	Integer32
+    MAX-ACCESS	read-only
+    STATUS	current
+    DESCRIPTION
+	"The maximum number of processes that should be
+	 running.  An error flag is generated if the number of
+	 running processes is > the maximum."
+    ::= { prEntry 4 }
+
+prCount OBJECT-TYPE
+    SYNTAX	Integer32
+    MAX-ACCESS	read-only
+    STATUS	current
+    DESCRIPTION
+	"The number of current processes running with the name
+	 in question."
+    ::= { prEntry 5 }
+
+prErrorFlag OBJECT-TYPE
+    SYNTAX	Integer32
+    MAX-ACCESS	read-only
+    STATUS	current
+    DESCRIPTION
+	"A Error flag to indicate trouble with a process.  It
+	 goes to 1 if there is an error, 0 if no error."
+    ::= { prEntry 100 }
+
+prErrMessage OBJECT-TYPE
+    SYNTAX	DisplayString
+    MAX-ACCESS	read-only
+    STATUS	current
+    DESCRIPTION
+	"An error message describing the problem (if one exists)."
+    ::= { prEntry 101 }
+
+prErrFix OBJECT-TYPE
+    SYNTAX	Integer32
+    MAX-ACCESS	read-write
+    STATUS	current
+    DESCRIPTION
+	"Setting this to one will try to fix the problem if
+	 the agent has been configured with a script to call
+	 to attempt to fix problems automatically using remote
+	 snmp operations."
+    ::= { prEntry 102 }
+
+prErrFixCmd OBJECT-TYPE
+    SYNTAX	DisplayString
+    MAX-ACCESS	read-only
+    STATUS	current
+    DESCRIPTION
+	"The command that gets run when the prErrFix column is 
+	 set to 1."
+    ::= { prEntry 103 }
+
+
+
+extTable OBJECT-TYPE
+    SYNTAX	SEQUENCE OF ExtEntry
+    MAX-ACCESS	not-accessible
+    STATUS	current
+    DESCRIPTION
+	"A table of extensible commands returning output and
+	 result codes.  These commands are configured via the
+	 agent's snmpd.conf file."
+    ::= { ucdavis 8 }
+
+extEntry OBJECT-TYPE
+    SYNTAX     ExtEntry
+    MAX-ACCESS not-accessible
+    STATUS     current
+    DESCRIPTION
+        "An entry containing an extensible script/program and its output."
+    INDEX      { extIndex }
+    ::= { extTable  1 }
+
+ExtEntry ::= SEQUENCE {
+    extIndex		Integer32,
+    extNames		DisplayString,
+    extCommand		DisplayString,
+    extResult		Integer32,
+    extOutput		DisplayString,
+    extErrFix		Integer32,
+    extErrFixCmd	DisplayString
+}
+
+extIndex OBJECT-TYPE
+    SYNTAX	Integer32 (0..65535)
+    MAX-ACCESS	read-only
+    STATUS	current
+    DESCRIPTION
+	"Reference Index for extensible scripts.  Simply an
+	 integer row number."
+    ::= { extEntry 1 }
+
+extNames OBJECT-TYPE
+    SYNTAX	DisplayString
+    MAX-ACCESS	read-only
+    STATUS	current
+    DESCRIPTION
+	"A Short, one name description of the extensible command."
+    ::= { extEntry 2 }
+
+extCommand OBJECT-TYPE
+    SYNTAX	DisplayString
+    MAX-ACCESS	read-only
+    STATUS	current
+    DESCRIPTION
+	"The command line to be executed."
+    ::= { extEntry 3 }
+
+extResult OBJECT-TYPE
+    SYNTAX	Integer32
+    MAX-ACCESS	read-only
+    STATUS	current
+    DESCRIPTION
+	"The result code (exit status) from the executed command."
+    ::= { extEntry 100 }
+
+extOutput OBJECT-TYPE
+    SYNTAX	DisplayString
+    MAX-ACCESS	read-only
+    STATUS	current
+    DESCRIPTION
+	"The first line of output of the executed command."
+    ::= { extEntry 101 }
+
+extErrFix OBJECT-TYPE
+    SYNTAX	Integer32
+    MAX-ACCESS	read-write
+    STATUS	current
+    DESCRIPTION
+	"Setting this to one will try to fix the problem if
+	 the agent has been configured with a script to call
+	 to attempt to fix problems automatically using remote
+	 snmp operations."
+    ::= { extEntry 102 }
+	
+extErrFixCmd OBJECT-TYPE
+    SYNTAX	DisplayString
+    MAX-ACCESS	read-only
+    STATUS	current
+    DESCRIPTION
+	"The command that gets run when the extErrFix column is 
+	 set to 1."
+    ::= { extEntry 103 }
+
+--
+-- Memory usage/watch reporting.
+-- Not supported on all systems!
+-- See agent/mibgroup/ucd_snmp.h to see if its loaded for your architecture.
+--
+memory OBJECT IDENTIFIER ::= { ucdavis 4 }
+
+memIndex OBJECT-TYPE
+    SYNTAX	Integer32
+    MAX-ACCESS	read-only
+    STATUS	current
+    DESCRIPTION  
+	"Bogus Index.  This should always return the integer 0."
+    ::= { memory 1 } 
+
+memErrorName OBJECT-TYPE
+    SYNTAX	DisplayString
+    MAX-ACCESS	read-only
+    STATUS	current
+    DESCRIPTION  
+	"Bogus Name. This should always return the string 'swap'."
+    ::= { memory 2 } 
+
+memTotalSwap OBJECT-TYPE
+    SYNTAX	Integer32
+    MAX-ACCESS	read-only
+    STATUS	current
+    DESCRIPTION
+	"Total Swap Size configured for the host."
+    ::= { memory 3 }
+
+memAvailSwap OBJECT-TYPE
+    SYNTAX	Integer32
+    MAX-ACCESS	read-only
+    STATUS	current
+    DESCRIPTION
+	"Available Swap Space on the host."
+    ::= { memory 4 }
+
+memTotalReal OBJECT-TYPE
+    SYNTAX	Integer32
+    MAX-ACCESS	read-only
+    STATUS	current
+    DESCRIPTION
+	"Total Real/Physical Memory Size on the host."
+    ::= { memory 5 }
+
+memAvailReal OBJECT-TYPE
+    SYNTAX	Integer32
+    MAX-ACCESS	read-only
+    STATUS	current
+    DESCRIPTION
+	"Available Real/Physical Memory Space on the host."
+    ::= { memory 6 }
+
+memTotalSwapTXT OBJECT-TYPE
+    SYNTAX	Integer32
+    MAX-ACCESS	read-only
+    STATUS	current
+    DESCRIPTION
+	"Total virtual memory used by text."
+    ::= { memory 7 }
+
+memAvailSwapTXT OBJECT-TYPE
+    SYNTAX	Integer32
+    MAX-ACCESS	read-only
+    STATUS	current
+    DESCRIPTION	
+	"Active virtual memory used by text."
+    ::= { memory 8 }
+
+memTotalRealTXT OBJECT-TYPE
+    SYNTAX	Integer32
+    MAX-ACCESS	read-only
+    STATUS	current
+    DESCRIPTION
+	"Total Real/Physical Memory Size used by text."
+    ::= { memory 9 }
+
+memAvailRealTXT OBJECT-TYPE
+    SYNTAX	Integer32
+    MAX-ACCESS	read-only
+    STATUS	current
+    DESCRIPTION
+	"Active Real/Physical Memory Space used by text."
+    ::= { memory 10 }
+
+memTotalFree OBJECT-TYPE
+    SYNTAX	Integer32
+    MAX-ACCESS	read-only
+    STATUS	current
+    DESCRIPTION
+	"Total Available Memory on the host"
+    ::= { memory 11 }
+
+memMinimumSwap OBJECT-TYPE
+    SYNTAX	Integer32
+    MAX-ACCESS	read-only
+    STATUS	current
+    DESCRIPTION
+	"Minimum amount of free swap required to be free
+	 or else memErrorSwap is set to 1 and an error string is
+	 returned memSwapErrorMsg."
+    ::= { memory 12 }
+
+memShared OBJECT-TYPE
+    SYNTAX	Integer32
+    MAX-ACCESS	read-only
+    STATUS	current
+    DESCRIPTION
+	"Total Shared Memory"
+    ::= { memory 13 }
+
+memBuffer OBJECT-TYPE
+    SYNTAX	Integer32
+    MAX-ACCESS	read-only
+    STATUS	current
+    DESCRIPTION
+	"Total Buffered Memory"
+    ::= { memory 14 }
+
+memCached OBJECT-TYPE
+    SYNTAX	Integer32
+    MAX-ACCESS	read-only
+    STATUS	current
+    DESCRIPTION
+	"Total Cached Memory"
+    ::= { memory 15 }
+
+memSwapError OBJECT-TYPE
+    SYNTAX	Integer32
+    MAX-ACCESS	read-only
+    STATUS	current
+    DESCRIPTION
+	"Error flag.  1 indicates very little swap space left"
+    ::= { memory 100 }
+	
+memSwapErrorMsg OBJECT-TYPE
+    SYNTAX	DisplayString
+    MAX-ACCESS	read-only
+    STATUS	current
+    DESCRIPTION
+	"Error message describing the Error Flag condition"
+    ::= { memory 101 } 
+
+
+dskTable OBJECT-TYPE
+    SYNTAX	SEQUENCE OF DskEntry
+    MAX-ACCESS	not-accessible
+    STATUS	current
+    DESCRIPTION
+	"Disk watching information.  Partions to be watched
+	 are configured by the snmpd.conf file of the agent."
+    ::= { ucdavis 9 }
+
+dskEntry OBJECT-TYPE
+    SYNTAX     DskEntry
+    MAX-ACCESS not-accessible
+    STATUS     current
+    DESCRIPTION
+        "An entry containing a disk and its statistics."
+    INDEX      { dskIndex }
+    ::= { dskTable  1 }
+
+DskEntry ::= SEQUENCE {
+    dskIndex		Integer32,
+    dskPath		DisplayString,
+    dskDevice		DisplayString,
+    dskMinimum		Integer32,
+    dskMinPercent	Integer32,
+    dskTotal		Integer32,
+    dskAvail		Integer32,
+    dskUsed		Integer32,
+    dskPercent		Integer32,
+    dskPercentNode	Integer32,
+    dskErrorFlag	Integer32,
+    dskErrorMsg		DisplayString
+}
+
+dskIndex OBJECT-TYPE
+    SYNTAX	Integer32 (0..65535)
+    MAX-ACCESS	read-only
+    STATUS	current
+    DESCRIPTION
+	"Integer reference number (row number) for the disk mib."
+    ::= { dskEntry 1 }
+	
+dskPath OBJECT-TYPE
+    SYNTAX	DisplayString
+    MAX-ACCESS	read-only
+    STATUS	current
+    DESCRIPTION  
+	"Path where the disk is mounted."
+    ::= { dskEntry 2 } 
+
+dskDevice OBJECT-TYPE
+    SYNTAX	DisplayString
+    MAX-ACCESS	read-only
+    STATUS	current
+    DESCRIPTION  
+	"Path of the device for the partition"
+    ::= { dskEntry 3 } 
+
+dskMinimum OBJECT-TYPE
+    SYNTAX	Integer32
+    MAX-ACCESS	read-only
+    STATUS	current
+    DESCRIPTION  
+	"Minimum space required on the disk (in kBytes) before the
+         errors are triggered.  Either this or dskMinPercent is
+         configured via the agent's snmpd.conf file."
+    ::= { dskEntry 4 } 
+
+dskMinPercent OBJECT-TYPE
+    SYNTAX	Integer32
+    MAX-ACCESS	read-only
+    STATUS	current
+    DESCRIPTION  
+	"Percentage of minimum space required on the disk before the
+         errors are triggered.  Either this or dskMinimum is
+         configured via the agent's snmpd.conf file."
+    ::= { dskEntry 5 } 
+
+dskTotal OBJECT-TYPE
+    SYNTAX	Integer32
+    MAX-ACCESS	read-only
+    STATUS	current
+    DESCRIPTION  
+	"Total size of the disk/partion (kBytes)"
+    ::= { dskEntry 6 } 
+
+dskAvail OBJECT-TYPE
+    SYNTAX	Integer32
+    MAX-ACCESS	read-only
+    STATUS	current
+    DESCRIPTION  
+	"Available space on the disk"
+    ::= { dskEntry 7 } 
+
+dskUsed OBJECT-TYPE
+    SYNTAX	Integer32
+    MAX-ACCESS	read-only
+    STATUS	current
+    DESCRIPTION  
+	"Used space on the disk"
+    ::= { dskEntry 8 } 
+
+dskPercent OBJECT-TYPE
+    SYNTAX	Integer32
+    MAX-ACCESS	read-only
+    STATUS	current
+    DESCRIPTION  
+	"Percentage of space used on disk"
+    ::= { dskEntry 9 } 
+
+dskPercentNode OBJECT-TYPE
+    SYNTAX	Integer32
+    MAX-ACCESS	read-only
+    STATUS	current
+    DESCRIPTION  
+	"Percentage of inodes used on disk"
+    ::= { dskEntry 10 } 
+
+dskErrorFlag OBJECT-TYPE
+    SYNTAX	Integer32
+    MAX-ACCESS	read-only
+    STATUS	current
+    DESCRIPTION  
+	"Error flag signaling that the disk or partition is under
+	 the minimum required space configured for it."
+    ::= { dskEntry 100 } 
+     
+dskErrorMsg OBJECT-TYPE
+    SYNTAX	DisplayString
+    MAX-ACCESS	read-only
+    STATUS	current
+    DESCRIPTION  
+	"A text description providing a warning and the space left
+	 on the disk."
+    ::= { dskEntry 101 } 
+     
+laTable OBJECT-TYPE
+    SYNTAX	SEQUENCE OF LaEntry
+    MAX-ACCESS	not-accessible
+    STATUS	current
+    DESCRIPTION
+	"Load average information."
+    ::= { ucdavis 10 }
+
+laEntry OBJECT-TYPE
+    SYNTAX	LaEntry
+    MAX-ACCESS	not-accessible
+    STATUS	current
+    DESCRIPTION
+	"An entry containing a load average and its values."
+    INDEX	{ laIndex }
+    ::= { laTable  1 }
+
+LaEntry ::= SEQUENCE {
+    laIndex		Integer32,
+    laNames		DisplayString,
+    laLoad		DisplayString,
+    laConfig		DisplayString,
+    laLoadInt		Integer32,
+    laLoadFloat		Float,
+    laErrorFlag		Integer32,
+    laErrMessage	DisplayString
+}
+
+laIndex OBJECT-TYPE
+    SYNTAX	Integer32 (0..3)
+    MAX-ACCESS	read-only
+    STATUS	current
+    DESCRIPTION
+	"reference index/row number for each observed loadave."
+    ::= { laEntry 1 }
+
+laNames OBJECT-TYPE
+    SYNTAX	DisplayString
+    MAX-ACCESS	read-only
+    STATUS	current
+    DESCRIPTION
+	"The list of loadave names we're watching."
+    ::= { laEntry 2 }
+
+laLoad OBJECT-TYPE
+    SYNTAX	DisplayString
+    MAX-ACCESS	read-only
+    STATUS	current
+    DESCRIPTION
+	"The 1,5 and 10 minute load averages (one per row)."
+    ::= { laEntry 3 }
+
+laConfig OBJECT-TYPE
+    SYNTAX	DisplayString
+    MAX-ACCESS	read-only
+    STATUS	current
+    DESCRIPTION
+	"The watch point for load-averages to signal an
+	 error.  If the load averages rises above this value,
+	 the laErrorFlag below is set."
+    ::= { laEntry 4 }
+
+laLoadInt OBJECT-TYPE
+    SYNTAX	Integer32
+    MAX-ACCESS	read-only
+    STATUS	current
+    DESCRIPTION
+	"The 1,5 and 10 minute load averages as an integer.
+	 This is computed by taking the floating point
+	 loadaverage value and multiplying by 100, then
+	 converting the value to an integer."
+    ::= { laEntry 5 }
+
+laLoadFloat OBJECT-TYPE
+    SYNTAX	Float
+    MAX-ACCESS	read-only
+    STATUS	current
+    DESCRIPTION
+	"The 1,5 and 10 minute load averages as an opaquely
+	 wrapped floating point number."
+    ::= { laEntry 6 }
+
+laErrorFlag OBJECT-TYPE
+    SYNTAX	Integer32
+    MAX-ACCESS	read-only
+    STATUS	current
+    DESCRIPTION
+	"A Error flag to indicate the load-average has crossed
+	 its threshold value defined in the snmpd.conf file.
+	 It is set to 1 if the threshold is crossed, 0 otherwise."
+    ::= { laEntry 100 }
+
+laErrMessage OBJECT-TYPE
+    SYNTAX	DisplayString
+    MAX-ACCESS	read-only
+    STATUS	current
+    DESCRIPTION
+	"An error message describing the load-average and its
+	 surpased watch-point value."
+    ::= { laEntry 101 }
+
+
+version	OBJECT IDENTIFIER ::= { ucdavis 100 }
+
+versionIndex OBJECT-TYPE
+    SYNTAX	Integer32
+    MAX-ACCESS	read-only
+    STATUS	current
+    DESCRIPTION  
+	"Index to mib (always 0)"
+    ::= { version 1 } 
+
+versionTag OBJECT-TYPE
+    SYNTAX	DisplayString
+    MAX-ACCESS	read-only
+    STATUS	current
+    DESCRIPTION  
+	"CVS tag keyword"
+    ::= { version 2 } 
+     
+versionDate OBJECT-TYPE
+    SYNTAX	DisplayString
+    MAX-ACCESS	read-only
+    STATUS	current
+    DESCRIPTION  
+	"Date string from RCS keyword"
+    ::= { version 3 } 
+
+versionCDate OBJECT-TYPE
+    SYNTAX	DisplayString
+    MAX-ACCESS	read-only
+    STATUS	current
+    DESCRIPTION  
+	"Date string from ctime() "
+    ::= { version 4 } 
+
+versionIdent OBJECT-TYPE
+    SYNTAX	DisplayString
+    MAX-ACCESS	read-only
+    STATUS	current
+    DESCRIPTION  
+	"Id string from RCS keyword"
+    ::= { version 5 } 
+
+versionConfigureOptions OBJECT-TYPE
+    SYNTAX	DisplayString
+    MAX-ACCESS	read-only
+    STATUS	current
+    DESCRIPTION  
+	"Options passed to the configure script when this agent was built."
+    ::= { version 6 } 
+
+versionClearCache OBJECT-TYPE
+    SYNTAX	Integer32
+    MAX-ACCESS	read-write
+    STATUS	current
+    DESCRIPTION  
+	"Set to 1 to clear the exec cache, if enabled"
+    ::= { version 10 } 
+
+versionUpdateConfig OBJECT-TYPE
+    SYNTAX	Integer32
+    MAX-ACCESS	read-write
+    STATUS	current
+    DESCRIPTION  
+	"Set to 1 to read-read the config file(s)."
+    ::= { version 11 } 
+
+versionRestartAgent OBJECT-TYPE
+    SYNTAX	Integer32
+    MAX-ACCESS	read-write
+    STATUS	current
+    DESCRIPTION  
+	"Set to 1 to restart the agent."
+    ::= { version 12 } 
+
+versionSavePersistentData OBJECT-TYPE
+    SYNTAX	Integer32
+    MAX-ACCESS	read-write
+    STATUS	current
+    DESCRIPTION  
+	"Set to 1 to force the agent to save it's persistent data immediately."
+    ::= { version 13 } 
+
+versionDoDebugging OBJECT-TYPE
+    SYNTAX	Integer32
+    MAX-ACCESS	read-write
+    STATUS	current
+    DESCRIPTION  
+	"Set to 1 to turn debugging statements on in the agent or 0
+	 to turn it off."
+    ::= { version 20 } 
+
+
+snmperrs OBJECT IDENTIFIER ::= { ucdavis 101 }
+
+snmperrIndex OBJECT-TYPE
+    SYNTAX	Integer32
+    MAX-ACCESS	read-only
+    STATUS	current
+    DESCRIPTION
+	"Bogus Index for snmperrs (always 0)."
+    ::= { snmperrs 1 }
+
+snmperrNames OBJECT-TYPE
+    SYNTAX	DisplayString
+    MAX-ACCESS	read-only
+    STATUS	current
+    DESCRIPTION
+	"snmp"
+    ::= { snmperrs 2 }
+
+snmperrErrorFlag OBJECT-TYPE
+    SYNTAX	Integer32
+    MAX-ACCESS	read-only
+    STATUS	current
+    DESCRIPTION
+	"A Error flag to indicate trouble with the agent.  It
+	 goes to 1 if there is an error, 0 if no error."
+    ::= { snmperrs 100 }
+
+snmperrErrMessage OBJECT-TYPE
+    SYNTAX	DisplayString
+    MAX-ACCESS	read-only
+    STATUS	current
+    DESCRIPTION
+	"An error message describing the problem (if one exists)."
+    ::= { snmperrs 101 }
+
+
+mrTable OBJECT-TYPE
+    SYNTAX	SEQUENCE OF MrEntry
+    MAX-ACCESS	not-accessible
+    STATUS	current
+    DESCRIPTION
+	"A table displaying all the oid's registered by mib modules in
+	 the agent.  Since the agent is modular in nature, this lists
+	 each module's OID it is responsible for and the name of the module"
+    ::= { ucdavis 102 }
+
+mrEntry OBJECT-TYPE
+    SYNTAX	MrEntry
+    MAX-ACCESS	not-accessible
+    STATUS	current
+    DESCRIPTION
+	"An entry containing a registered mib oid."
+    INDEX	{ IMPLIED mrIndex }
+    ::= { mrTable 1 }
+
+MrEntry ::= SEQUENCE {
+    mrIndex		OBJECT IDENTIFIER,
+    mrModuleName	DisplayString
+}
+
+mrIndex OBJECT-TYPE
+    SYNTAX	OBJECT IDENTIFIER
+    MAX-ACCESS	read-only
+    STATUS	current
+    DESCRIPTION
+	"The registry slot of a mibmodule."
+    ::= { mrEntry  1 }
+
+mrModuleName OBJECT-TYPE
+    SYNTAX	DisplayString
+    MAX-ACCESS	read-only
+    STATUS	current
+    DESCRIPTION
+	"The module name that registered this OID."
+    ::= { mrEntry  2 }
+
+systemStats OBJECT IDENTIFIER ::= { ucdavis 11 }
+
+ssIndex OBJECT-TYPE
+    SYNTAX	Integer32
+    MAX-ACCESS	read-only
+    STATUS	current
+    DESCRIPTION
+	"Reference Index for each observed systemStat (1)."
+    ::= { systemStats 1 }
+
+ssErrorName OBJECT-TYPE
+    SYNTAX	DisplayString
+    MAX-ACCESS	read-only
+    STATUS	current
+    DESCRIPTION
+	"The list of systemStats names (vmstat) we're Counting."
+    ::= { systemStats 2 }
+
+ssSwapIn OBJECT-TYPE
+    SYNTAX	Integer32
+    MAX-ACCESS	read-only
+    STATUS	current
+    DESCRIPTION
+	"Amount of memory swapped in from disk (kB/s)."
+    ::= { systemStats 3 }
+
+ssSwapOut OBJECT-TYPE
+    SYNTAX	Integer32
+    MAX-ACCESS	read-only
+    STATUS	current
+    DESCRIPTION
+	"Amount of memory swapped to disk (kB/s)."
+    ::= { systemStats 4 }
+
+ssIOSent OBJECT-TYPE
+    SYNTAX	Integer32
+    MAX-ACCESS	read-only
+    STATUS	deprecated
+    DESCRIPTION
+	"Blocks sent to a block device (blocks/s). Deprecated, replaced by
+	the ssIORawSent object"
+    ::= { systemStats 5 }
+
+ssIOReceive OBJECT-TYPE
+    SYNTAX	Integer32
+    MAX-ACCESS	read-only
+    STATUS	deprecated
+    DESCRIPTION
+	"Blocks received from a block device (blocks/s). Deprecated, replaced by
+	the ssIORawReceived object"
+    ::= { systemStats 6 }
+
+ssSysInterrupts OBJECT-TYPE
+    SYNTAX	Integer32
+    MAX-ACCESS	read-only
+    STATUS	deprecated
+    DESCRIPTION
+	"The number of interrupts per second, including the clock.
+	Deprecated, replaced by ssRawInterrupts"
+    ::= { systemStats 7 }
+
+ssSysContext OBJECT-TYPE
+    SYNTAX	Integer32
+    MAX-ACCESS	read-only
+    STATUS	deprecated
+    DESCRIPTION
+	"The number of context switches per second.
+	Deprecated, replaced by ssRawContext"
+    ::= { systemStats 8 }
+
+ssCpuUser OBJECT-TYPE
+    SYNTAX	Integer32
+    MAX-ACCESS	read-only
+    STATUS	deprecated
+    DESCRIPTION
+	"percentages of user CPU time. Deprecated, replaced by the ssCpuRawUser
+	object"
+    ::= { systemStats 9 }
+
+ssCpuSystem OBJECT-TYPE
+    SYNTAX	Integer32
+    MAX-ACCESS	read-only
+    STATUS	deprecated
+    DESCRIPTION
+	"percentages of system CPU time. Deprecated, replaced by of the
+	ssCpuRawSystem object"
+    ::= { systemStats 10 }
+
+ssCpuIdle OBJECT-TYPE
+    SYNTAX	Integer32
+    MAX-ACCESS	read-only
+    STATUS	deprecated
+    DESCRIPTION
+	"percentages of idle CPU time. Deprecated, replaced by of the
+	ssCpuRawIdle object"
+    ::= { systemStats 11 }
+
+-- The agent only implements those of the following counters that the
+-- kernel supports! Don't expect all to be present.
+
+ssCpuRawUser OBJECT-TYPE
+    SYNTAX      Counter32
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+        "user CPU time."
+    ::= { systemStats 50 }
+
+ssCpuRawNice OBJECT-TYPE
+    SYNTAX      Counter32
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+        "nice CPU time."
+    ::= { systemStats 51 }
+
+ssCpuRawSystem OBJECT-TYPE
+    SYNTAX      Counter32
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+        "system CPU time."
+    ::= { systemStats 52 }
+
+ssCpuRawIdle OBJECT-TYPE
+    SYNTAX      Counter32
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+        "idle CPU time."
+    ::= { systemStats 53 }
+
+ssCpuRawWait OBJECT-TYPE
+    SYNTAX      Counter32
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+        "iowait CPU time. This is primarily a SysV thingie"
+    ::= { systemStats 54 }
+
+ssCpuRawKernel OBJECT-TYPE
+    SYNTAX      Counter32
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+        "kernel CPU time."
+    ::= { systemStats 55 }
+
+ssCpuRawInterrupt OBJECT-TYPE
+    SYNTAX      Counter32
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+        "interruptlevel CPU time. This is primarily a BSD thingie"
+    ::= { systemStats 56 }
+
+ssIORawSent OBJECT-TYPE
+    SYNTAX      Counter32
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+        "Number of requests sent to a block device"
+    ::= { systemStats 57 }
+
+ssIORawReceived OBJECT-TYPE
+    SYNTAX      Counter32
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+        "Number of requests received from a block device"
+    ::= { systemStats 58 }
+
+ssRawInterrupts OBJECT-TYPE
+    SYNTAX      Counter32
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+        "Number of interrupts processed"
+    ::= { systemStats 59 }
+
+ssRawContexts OBJECT-TYPE
+    SYNTAX      Counter32
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+        "Number of context switches"
+    ::= { systemStats 60 }
+
+-- possibly used in the future:
+--
+-- ssErrorFlag OBJECT-TYPE
+--     SYNTAX	   Integer32
+--     MAX-ACCESS  read-only
+--     STATUS      current
+--     DESCRIPTION
+--         "Error flag."
+--     ::= { systemStats 100 }
+-- 
+-- ssErrMessage OBJECT-TYPE
+--     SYNTAX      DisplayString
+--     MAX-ACCESS  read-only
+--     STATUS      current
+--     DESCRIPTION  
+--         "Error message describing the errorflag condition."
+--     ::= { systemStats 101 } 
+
+
+ucdTraps OBJECT IDENTIFIER ::= { ucdavis 251 }
+
+ucdStart NOTIFICATION-TYPE
+    STATUS	current
+    DESCRIPTION
+	""
+    ::= { ucdTraps 1 }
+    
+ucdShutdown	NOTIFICATION-TYPE
+    STATUS current
+    DESCRIPTION
+	"This trap is sent when the agent terminates"
+    ::= { ucdTraps 2 }
+
+--
+-- File Table:  monitor a list of files to check for a maximum size.
+-- 
+
+fileTable OBJECT-TYPE
+    SYNTAX	SEQUENCE OF FileEntry
+    MAX-ACCESS	not-accessible
+    STATUS	current
+    DESCRIPTION
+	"Table of monitored files."
+    ::= { ucdavis 15 }
+    
+fileEntry OBJECT-TYPE
+    SYNTAX	FileEntry
+    MAX-ACCESS	not-accessible
+    STATUS	current
+    DESCRIPTION
+	"Entry of file"
+    INDEX	{ fileIndex }
+    ::= { fileTable 1 }
+
+FileEntry ::= SEQUENCE {
+    fileIndex		Integer32,
+    fileName		DisplayString,
+    fileSize		Integer32,
+    fileMax		Integer32,
+    fileErrorFlag	TruthValue,
+    fileErrorMsg	DisplayString
+}
+
+fileIndex OBJECT-TYPE
+    SYNTAX	Integer32 (0..2147483647)
+    MAX-ACCESS	read-only
+    STATUS	current
+    DESCRIPTION
+	"Index of file"
+    ::= { fileEntry 1 }
+
+fileName OBJECT-TYPE
+    SYNTAX	DisplayString
+    MAX-ACCESS	read-only
+    STATUS	current
+    DESCRIPTION
+	"Filename"
+    ::= { fileEntry 2 }
+
+fileSize OBJECT-TYPE
+    SYNTAX	Integer32
+    UNITS       "kB"
+    MAX-ACCESS	read-only
+    STATUS	current
+    DESCRIPTION
+	"Size of file (kB)"
+    ::= { fileEntry 3 }
+
+fileMax	OBJECT-TYPE
+    SYNTAX	Integer32
+    UNITS       "kB"
+    MAX-ACCESS	read-only
+    STATUS	current
+    DESCRIPTION
+	"Limit of filesize (kB)"
+    ::= { fileEntry 4 }
+
+fileErrorFlag OBJECT-TYPE
+    SYNTAX	TruthValue
+    MAX-ACCESS	read-only
+    STATUS	current
+    DESCRIPTION
+	"Limit exceeded flag"
+    ::= { fileEntry 100 }
+
+fileErrorMsg OBJECT-TYPE
+    SYNTAX	DisplayString
+    MAX-ACCESS	read-only
+    STATUS	current
+    DESCRIPTION
+	"Filesize error message"
+    ::= { fileEntry 101 }
+
+logMatch OBJECT IDENTIFIER ::= { ucdavis 16 }
+
+logMatchMaxEntries OBJECT-TYPE
+	SYNTAX Integer32
+	MAX-ACCESS read-only
+	STATUS current
+	DESCRIPTION
+		"The maximum number of logmatch entries
+		this snmpd daemon can support."
+	::= { logMatch 1 }
+
+logMatchTable OBJECT-TYPE
+	SYNTAX SEQUENCE OF LogMatchEntry
+	MAX-ACCESS not-accessible
+	STATUS current
+	DESCRIPTION
+		"Table of monitored files."
+	::= { logMatch 2 }
+
+logMatchEntry OBJECT-TYPE
+	SYNTAX LogMatchEntry
+	MAX-ACCESS not-accessible
+	STATUS current
+	DESCRIPTION
+		"Entry of file"
+	INDEX { logMatchIndex }
+	::= { logMatchTable 1 }
+
+LogMatchEntry ::=
+	SEQUENCE { 
+		logMatchIndex
+			Integer32,
+		logMatchName
+			DisplayString,
+		logMatchFilename
+			DisplayString,
+		logMatchRegEx
+			DisplayString,
+		logMatchGlobalCounter
+			Counter32,
+		logMatchGlobalCount
+			Integer32,
+		logMatchCurrentCounter
+			Counter32,
+		logMatchCurrentCount
+			Integer32,
+		logMatchCounter
+			Counter32,
+		logMatchCount
+			Integer32,
+		logMatchCycle
+			Integer32,
+		logMatchErrorFlag
+			TruthValue,
+		logMatchRegExCompilation
+			DisplayString
+	 }
+
+logMatchIndex OBJECT-TYPE
+	SYNTAX Integer32 (1..2147483647)
+	MAX-ACCESS read-only
+	STATUS current
+	DESCRIPTION
+		"Index of logmatch"
+	::= { logMatchEntry 1 }
+
+logMatchName OBJECT-TYPE
+	SYNTAX DisplayString
+	MAX-ACCESS read-only
+	STATUS current
+	DESCRIPTION
+		"logmatch instance name"
+	::= { logMatchEntry 2 }
+
+logMatchFilename OBJECT-TYPE
+	SYNTAX DisplayString
+	MAX-ACCESS read-only
+	STATUS current
+	DESCRIPTION
+		"filename to be logmatched"
+	::= { logMatchEntry 3 }
+
+logMatchRegEx OBJECT-TYPE
+	SYNTAX DisplayString
+	MAX-ACCESS read-only
+	STATUS current
+	DESCRIPTION
+		"regular expression"
+	::= { logMatchEntry 4 }
+
+logMatchGlobalCounter OBJECT-TYPE
+	SYNTAX Counter32
+	MAX-ACCESS read-only
+	STATUS current
+	DESCRIPTION
+		"global count of matches"
+	::= { logMatchEntry 5 }
+
+logMatchGlobalCount OBJECT-TYPE
+	SYNTAX Integer32
+	MAX-ACCESS read-only
+	STATUS current
+	DESCRIPTION
+		"Description."
+	::= { logMatchEntry 6 }
+
+logMatchCurrentCounter OBJECT-TYPE
+	SYNTAX Counter32
+	MAX-ACCESS read-only
+	STATUS current
+	DESCRIPTION
+		"Regex match counter. This counter will
+		be reset with each logfile rotation."
+	::= { logMatchEntry 7 }
+
+logMatchCurrentCount OBJECT-TYPE
+	SYNTAX Integer32
+	MAX-ACCESS read-only
+	STATUS current
+	DESCRIPTION
+		"Description."
+	::= { logMatchEntry 8 }
+
+logMatchCounter OBJECT-TYPE
+	SYNTAX Counter32
+	MAX-ACCESS read-only
+	STATUS current
+	DESCRIPTION
+		"Regex match counter. This counter will
+		be reset with each read"
+	::= { logMatchEntry 9 }
+
+logMatchCount OBJECT-TYPE
+	SYNTAX Integer32
+	MAX-ACCESS read-only
+	STATUS current
+	DESCRIPTION
+		"Description."
+	::= { logMatchEntry 10 }
+
+logMatchCycle OBJECT-TYPE
+	SYNTAX Integer32
+	MAX-ACCESS read-only
+	STATUS current
+	DESCRIPTION
+		"time between updates (if not queried) in seconds"
+	::= { logMatchEntry 11 }
+
+logMatchErrorFlag OBJECT-TYPE
+	SYNTAX TruthValue
+	MAX-ACCESS read-only
+	STATUS current
+	DESCRIPTION
+		"errorflag: is this line configured correctly?"
+	::= { logMatchEntry 100 }
+
+logMatchRegExCompilation OBJECT-TYPE
+	SYNTAX DisplayString
+	MAX-ACCESS read-only
+	STATUS current
+	DESCRIPTION
+		"message of regex precompilation"
+	::= { logMatchEntry 101 }
+
+END
diff -Naur tomato/release/src/router/snmp/mibs/UDP-MIB.txt tomato121/release/src/router/snmp/mibs/UDP-MIB.txt
--- tomato/release/src/router/snmp/mibs/UDP-MIB.txt	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/mibs/UDP-MIB.txt	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,146 @@
+UDP-MIB DEFINITIONS ::= BEGIN
+
+IMPORTS
+    MODULE-IDENTITY, OBJECT-TYPE, Counter32,
+    IpAddress, mib-2                   FROM SNMPv2-SMI
+    MODULE-COMPLIANCE, OBJECT-GROUP    FROM SNMPv2-CONF;
+
+udpMIB MODULE-IDENTITY
+    LAST-UPDATED "9411010000Z"
+    ORGANIZATION "IETF SNMPv2 Working Group"
+    CONTACT-INFO
+            "        Keith McCloghrie
+
+             Postal: Cisco Systems, Inc.
+                     170 West Tasman Drive
+                     San Jose, CA  95134-1706
+                     US
+
+             Phone:  +1 408 526 5260
+             Email:  kzm@cisco.com"
+    DESCRIPTION
+            "The MIB module for managing UDP implementations."
+    REVISION      "9103310000Z"
+    DESCRIPTION
+            "The initial revision of this MIB module was part of MIB-
+            II."
+    ::= { mib-2 50 }
+
+-- the UDP group
+
+udp      OBJECT IDENTIFIER ::= { mib-2 7 }
+
+udpInDatagrams OBJECT-TYPE
+    SYNTAX      Counter32
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+            "The total number of UDP datagrams delivered to UDP users."
+    ::= { udp 1 }
+
+udpNoPorts OBJECT-TYPE
+    SYNTAX      Counter32
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+            "The total number of received UDP datagrams for which there
+            was no application at the destination port."
+    ::= { udp 2 }
+
+udpInErrors OBJECT-TYPE
+    SYNTAX      Counter32
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+            "The number of received UDP datagrams that could not be
+            delivered for reasons other than the lack of an application
+            at the destination port."
+    ::= { udp 3 }
+
+udpOutDatagrams OBJECT-TYPE
+    SYNTAX      Counter32
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+            "The total number of UDP datagrams sent from this entity."
+    ::= { udp 4 }
+
+-- the UDP Listener table
+
+-- The UDP listener table contains information about this
+-- entity's UDP end-points on which a local application is
+-- currently accepting datagrams.
+
+udpTable OBJECT-TYPE
+    SYNTAX      SEQUENCE OF UdpEntry
+    MAX-ACCESS  not-accessible
+    STATUS      current
+    DESCRIPTION
+            "A table containing UDP listener information."
+    ::= { udp 5 }
+
+udpEntry OBJECT-TYPE
+    SYNTAX      UdpEntry
+    MAX-ACCESS  not-accessible
+    STATUS      current
+    DESCRIPTION
+            "Information about a particular current UDP listener."
+    INDEX   { udpLocalAddress, udpLocalPort }
+    ::= { udpTable 1 }
+
+UdpEntry ::= SEQUENCE {
+        udpLocalAddress  IpAddress,
+        udpLocalPort     INTEGER
+    }
+
+udpLocalAddress OBJECT-TYPE
+    SYNTAX      IpAddress
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+            "The local IP address for this UDP listener.  In the case of
+            a UDP listener which is willing to accept datagrams for any
+            IP interface associated with the node, the value 0.0.0.0 is
+            used."
+    ::= { udpEntry 1 }
+
+udpLocalPort OBJECT-TYPE
+    SYNTAX      INTEGER (0..65535)
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+            "The local port number for this UDP listener."
+    ::= { udpEntry 2 }
+
+-- conformance information
+
+udpMIBConformance OBJECT IDENTIFIER ::= { udpMIB 2 }
+
+udpMIBCompliances OBJECT IDENTIFIER ::= { udpMIBConformance 1 }
+udpMIBGroups      OBJECT IDENTIFIER ::= { udpMIBConformance 2 }
+
+-- compliance statements
+
+udpMIBCompliance MODULE-COMPLIANCE
+    STATUS  current
+    DESCRIPTION
+            "The compliance statement for SNMPv2 entities which
+            implement UDP."
+    MODULE  -- this module
+        MANDATORY-GROUPS { udpGroup
+                           }
+    ::= { udpMIBCompliances 1 }
+
+-- units of conformance
+
+udpGroup OBJECT-GROUP
+    OBJECTS   { udpInDatagrams, udpNoPorts,
+                udpInErrors, udpOutDatagrams,
+                udpLocalAddress, udpLocalPort }
+    STATUS    current
+    DESCRIPTION
+            "The udp group of objects providing for management of UDP
+            entities."
+    ::= { udpMIBGroups 1 }
+
+END
diff -Naur tomato/release/src/router/snmp/mkinstalldirs tomato121/release/src/router/snmp/mkinstalldirs
--- tomato/release/src/router/snmp/mkinstalldirs	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/mkinstalldirs	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,40 @@
+#! /bin/sh
+# mkinstalldirs --- make directory hierarchy
+# Author: Noah Friedman <friedman@prep.ai.mit.edu>
+# Created: 1993-05-16
+# Public domain
+
+# $Id: mkinstalldirs,v 1.1.2.1 2004/06/20 21:54:07 nikki Exp $
+
+errstatus=0
+
+for file
+do
+   set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'`
+   shift
+
+   pathcomp=
+   for d
+   do
+     pathcomp="$pathcomp$d"
+     case "$pathcomp" in
+       -* ) pathcomp=./$pathcomp ;;
+     esac
+
+     if test ! -d "$pathcomp"; then
+        echo "mkdir $pathcomp"
+
+        mkdir "$pathcomp" || lasterr=$?
+
+        if test ! -d "$pathcomp"; then
+  	  errstatus=$lasterr
+        fi
+     fi
+
+     pathcomp="$pathcomp/"
+   done
+done
+
+exit $errstatus
+
+# mkinstalldirs ends here
diff -Naur tomato/release/src/router/snmp/net-snmp-config.in tomato121/release/src/router/snmp/net-snmp-config.in
--- tomato/release/src/router/snmp/net-snmp-config.in	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/net-snmp-config.in	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,337 @@
+#!/bin/sh
+
+# this shell script is designed to merely dump the configuration
+# information about how the net-snmp package was compiled.  The
+# information is particularily useful for applications that need to
+# link against the net-snmp libraries and hence must know about any
+# other libraries that must be linked in as well.
+
+NSC_BASE_AGENT_LIBS="-lnetsnmpagent -lnetsnmpmibs -lnetsnmphelpers -lnetsnmp"
+
+if test "x$1" = "x"; then
+  usage="yes"
+else
+  exec_prefix=@exec_prefix@
+  prefix=@exec_prefix@
+  case $1 in
+    --debug-tokens)
+      echo "find NET-SNMP-SOURCE-DIR -name \"*.c\" -print | xargs grep DEBUGMSGT | grep \\\" | cut -f 2 -d\\\" | sort -u"
+      ;;
+    --indent-options)
+      echo "indent -orig -nbc -bap -nut -nfca `(cd NET-SNMP-INCLUDE-DIR; perl -n -e 'print "-T $1 " if (/}\s*(netsnmp_\w+)\s*;/);' */*.h)`"
+      ;;
+    --configure-options)
+      echo @CONFIGURE_OPTIONS@
+      ;;
+    --snmpd-module-list)
+      echo @MODULE_LIST@
+      ;;
+    --base-cflags)
+      echo @CFLAGS@ @CPPFLAGS@ -I@includedir@
+      ;;
+    --cflags)
+      echo @CFLAGS@ @DEVFLAGS@ @CPPFLAGS@ -I. -I@includedir@
+      ;;
+    --agent-libs)
+      # use this one == --netsnmp-agent-libs + --external-libs
+      echo @LDFLAGS@ -L@libdir@ $NSC_BASE_AGENT_LIBS @AGENTLIBS@ @WRAPLIBS@
+      ;;
+    --libs)
+      # use this one == --netsnmp-libs + --external-libs
+      echo @LDFLAGS@ -L@libdir@ -lnetsnmp @LIBS@
+      ;;
+    --external-libs)
+      echo @LDFLAGS@ @LIBS@
+      ;;
+    --external-agent-libs)
+      echo @LDFLAGS@ @AGENTLIBS@ @WRAPLIBS@
+      ;;
+    --netsnmp-libs)
+      echo -L@libdir@ -lnetsnmp
+      ;;
+    --netsnmp-agent-libs)
+      echo -L@libdir@ $NSC_BASE_AGENT_LIBS
+      ;;
+    --version)
+      echo @VERSION@
+      ;;
+    --help)
+      usage="yes"
+      ;;
+    --prefix)
+      echo @prefix@
+      ;;
+    --exec-prefix)
+      echo @exec_prefix@
+      ;;
+    --create-snmpv3-user)
+      if @PSCMD@ | egrep ' snmpd *$' > /dev/null 2>&1 ; then
+         echo "Apparently at least one snmpd demon is already running."
+         echo "You must stop them in order to use this command."
+         exit 1
+      fi
+
+      Aalgorithm="MD5"
+      Xalgorithm="DES"
+      token=rwuser
+      shift
+      arg=$1
+      shift
+      while test "x$done" = "x" -a "x$arg" != "x" ; do
+	case $arg in
+	    -A)
+		Aalgorithm=$1
+		shift
+		;;
+	    -X)
+		Xalgorithm=$1
+		shift
+		;;
+	    -a)
+		apassphrase=$1
+		shift
+		;;
+	    -x)
+		xpassphrase=$1
+		shift
+		;;
+	    -ro)
+	        token="rouser"
+		;;
+ 	    -*)
+		echo "unknown suboption to --create-snmpv3-user: $arg"
+		exit 1
+		;;
+	    *)
+	        done=1
+		;;
+	esac
+	if test "x$done" = "x" ; then
+          arg=$1
+          shift
+	fi
+      done
+      
+      user=$arg
+      if test "x$user" = "x" ; then
+          prompt=yes
+	  echo "Enter a SNMPv3 user name to create: "
+	  read user
+      fi
+      if test "x$user" = "x" ; then
+          echo "You must specify a user name"
+	  exit 1
+      fi
+
+      if test "x$apassphrase" = "x" ; then
+          prompt=yes
+	  echo "Enter authentication pass-phrase: "
+	  read apassphrase
+      else
+	  shift
+      fi
+      if test "x$apassphrase" = "x" ; then
+          echo "You must specify an authentication pass-phrase"
+	  exit 1
+      fi
+
+      if test "x$prompt" = "xyes" -a "x$xpassphrase" = "x" ; then
+	  echo "Enter encryption pass-phrase: "
+	  echo "  [press return to reuse the authentication pass-phrase]"
+	  read xpassphrase
+      fi
+
+      outfile="@PERSISTENT_DIRECTORY@/snmpd.conf"
+      line="createUser $user $Aalgorithm \"$apassphrase\" $Xalgorithm $xpassphrase"
+      echo "adding the following line to $outfile:"
+      echo "  " $line
+      echo $line >> $outfile
+
+      outfile="@datadir@/snmp/snmpd.conf"
+      line="$token $user"
+      echo "adding the following line to $outfile:"
+      echo "  " $line
+      echo $line >> $outfile
+      ;;
+
+    --compile-subagent)
+      shift
+      outname=$1
+      shift
+      if test $1 = "--norm" ; then
+        norm=1
+	shift
+      fi
+      if test $1 = "--cflags" ; then
+        shift
+	cflags=$1
+	echo "setting extra cflags: $cflags"
+	shift
+      fi
+      if test $1 = "--ldflags" ; then
+        shift
+	ldflags=$1
+	echo "setting extra ldflags: $ldflags"
+	shift
+      fi
+      tmpfile=netsnmptmp.$$.c
+      if test -f $tmpfile; then
+	echo "Ack.  Can't create $tmpfile: already exists"
+	exit 1
+      fi
+      echo "generating the tmporary code file: $tmpfile"
+      rm -f $tmp
+      cat > $tmpfile <<EOF
+/* generated from net-snmp-config */
+#include <net-snmp/net-snmp-config.h>
+#ifdef HAVE_SIGNAL_H
+#include <signal.h>
+#endif /* HAVE_SIGNAL_H */
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+EOF
+
+    # add include files
+    while test "$1" != ""; do
+      cfiles="$cfiles $1"
+      name=`basename $1 | sed 's/\.[co]$/.h/'`
+      if test -f $name.h; then
+        if grep "init_$name" $name; then
+          echo "  #include\"$name\"" >> $tmpfile
+        fi
+      fi
+      shift
+    done
+
+      cat >> $tmpfile <<EOF
+static int keep_running;
+
+RETSIGTYPE
+stop_server(int a) {
+    keep_running = 0;
+}
+
+int
+main (int argc, char **argv) {
+  /* print log errors to stderr */
+  snmp_enable_stderrlog();
+ /* we are a subagent */
+  netsnmp_ds_set_boolean(NETSNMP_DS_APPLICATION_ID, NETSNMP_DS_AGENT_ROLE, 1);
+
+  /* initialize the agent library */
+  init_agent("$outname");
+
+  /* initialize your mib code here */
+EOF
+
+    # add init routines
+    for i in $cfiles ; do
+      name=`basename $i | sed 's/\.[co]$//'`
+      echo checking for init_$name in $i
+      if grep "init_$name" $i ; then
+        echo "  init_${name}();" >> $tmpfile
+      fi
+      shift
+    done
+
+    # finish file
+    cat >> $tmpfile <<EOF
+
+  /* ustMain will be used to read ustMain.conf files. */
+  init_snmp("$outname");
+
+  /* In case we recevie a request to stop (kill -TERM or kill -INT) */
+  keep_running = 1;
+#ifdef SIGTERM
+  signal(SIGTERM, stop_server);
+#endif
+#ifdef SIGINT
+  signal(SIGINT, stop_server);
+#endif
+
+  /* main loop here... */
+  while(keep_running) {
+    agent_check_and_process(1);
+  }
+
+  /* at shutdown time */
+  snmp_shutdown("$outname");
+  exit(0);
+}
+
+EOF
+      if test "$?" != 0 -o ! -f "$tmpfile" ; then
+        echo "Ack.  Can't create $tmpfile."
+	exit 1
+      fi
+      prefix=@prefix@
+      cmd="@CC@ $cflags @CFLAGS@ @DEVFLAGS@ -I. -I@includedir@ -o $outname $tmpfile $cfiles @LDFLAGS@ -L@exec_prefix@/lib -lnetsnmpagent -lnetsnmphelpers -lnetsnmpmibs -lnetsnmp @AGENTLIBS@ $ldflags"
+      echo "running: $cmd"
+      `$cmd`
+      if test "x$norm" != "x1" ; then
+        echo "removing the tmporary code file: $tmpfile"
+        rm -f $tmpfile
+      else
+        echo "leaving the tmporary code file: $tmpfile"
+      fi
+      if test -f $outname ; then
+        echo "subagent program $outname created"
+      fi
+      ;;
+
+    *)
+      echo "unknown option $1"
+      usage="yes"
+      ;;
+  esac
+fi
+
+if test "x$usage" = "xyes"; then
+  echo ""
+  echo "Usage:"
+  echo "  net-snmp-config [--cflags] [--agent-libs] [--libs] [--version]"
+  echo "                  ... [see below for complete flag list]"
+  echo ""
+  echo "    --version         displays the net-snmp version number"
+  echo "    --indent-options  displays the indent options from the Coding Style"
+  echo "    --debug-tokens    displays a example command line to search to source"
+  echo "                      code for a list of available debug tokens"
+  echo ""
+  echo "  SNMP Setup commands:"
+  echo ""
+  echo "    --create-snmpv3-user [-ro] [-a authpass] [-x privpass] [-X DES]"
+  echo "                         [-A MD5|SHA] [username]"
+  echo ""
+  echo "  These options produce the various compilation flags needed when"
+  echo "  building external SNMP applications:"
+  echo ""
+  echo "    --base-cflags     lists additional compilation flags needed"
+  echo "                      for external applications (excludes -I. and"
+  echo "                      extra developer warning flags, if any)"
+  echo "    --cflags          lists additional compilation flags needed"
+  echo "    --libs            lists libraries needed for building applications"
+  echo "    --agent-libs      lists libraries needed for building subagents"
+  echo ""
+  echo "    --netsnmp-libs        lists netsnmp specific libraries"
+  echo "    --external-libs       lists libraries needed by netsnmp libs"
+  echo "    --netsnmp-agent-libs  lists netsnmp specific agent libraries"
+  echo "    --external-agent-libs lists libraries needed by netsnmp libs"
+  echo ""
+  echo "  Automatted subagent building (produces an OUTPUTNAME binary file):"
+  echo "  [this feature has not been tested very well yet.  use at your risk.]"
+  echo ""
+  echo "    --compile-subagent OUTPUTNAME [--norm] [--cflags flags]"
+  echo "                                  [--ldflags flags] mibmodule1.c [...]]"
+  echo ""
+  echo "         --norm           leave the generated .c file around to read."
+  echo "         --cflags flags   extra cflags to use (e.g. -I...)."
+  echo "         --ldflags flags  extra ld flags to use (e.g. -L... -l...)."
+  echo ""
+  echo "  Details on how the net-nsmp package was compiled:"
+  echo ""
+  echo "    --configure-options   Display original configure arguments"
+  echo "    --snmpd-module-list   Display the modules compiled into the agent"
+  echo "    --prefix              Display the installation prefix"
+  echo ""
+  exit
+fi  
diff -Naur tomato/release/src/router/snmp/NEWS tomato121/release/src/router/snmp/NEWS
--- tomato/release/src/router/snmp/NEWS	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/NEWS	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,906 @@
+This file contains major changes in released revisions.  Please read
+the ChangeLog file for a more detailed listing of changes/bug fixes.
+
+*5.0.9*
+
+ SECURITY:
+    - An existing user/community could get access to data in MIB
+      objects that were explicitly excluded from their view.
+
+ Fixes:
+    - Perl build environment should better under Windows
+    - Misc kerberos support fixes.
+    - Improvements on various manual pages.
+    - A annoying bug with SETs being passed to pass scripts was fixed.
+    - The often talked about VACM optimization improvement was fixed again.
+    - mib2c handles augmentation tables better now.
+    - Various 64 bit issues have been addressed.
+
+*5.0.8*
+ New:
+    - No new features will be added to the 5.0.x line.
+
+ Ports:
+    - Update libtool to version 1.4.3, for the benefit of Darwin
+    - diskio support for Darwin
+    - Updates for OpenBSD 3. 
+    - Updates to solaris README
+
+ Fixes:
+    - find libwrap w/nsl on RedHat
+    - fix for openssl 0.9.7
+    - Fix some AgentX memory leaks
+    - use macro for inline function prototypes
+    - Attempt to find unused port before running tests
+    - Use SNMP_SLEEP environment variable when running tests
+    - calculate a proper ifSpeed under linux when possible
+    - better daemonization of snmpd
+    - close and reopen snmptrapd log files on HUP
+    - support for 16 bit reuqest ids
+    - Recognize new 't' code in display hints
+    - misc other fixes
+
+*5.0.7*
+ New:
+    - VACM (access control) optimizations which will greatly benefit
+      people who wish to exclude large portions of the MIB tree from
+      some people.  Previously this was a large resource drain.
+    - Add command line option to snmpd to set syslog facility
+    - Reverse DISPLAY-HINT processing, i.e. it allows you to input data
+      formatted like a DISPLAY-HINT prescribes
+    - Support setting of sysDescr and sysObjectID via snmpd.conf
+      configuration directives
+    - New output option to force display of strings as hex
+    - Persistent directory can be specified at runtime
+    - Add support for Linux virtual interfaces in the ipAddressTable.
+    - implemented the mteEventTable and the mteEventNotificationTable
+      form the DISMAN-EVENT-MIB.
+
+ Fixes:
+    - AgentX no longer flagged as experimental
+    - A few memory leak fixes for the table_iterator agent API.
+    - Processed flag cleared before each pass of a set request
+    - Remove snmpd pid file on exit
+    - Restore default behaviour of building shared libraries
+    - misc other fixes
+
+*5.0.6*
+
+ Fixes:
+    - prevent denial of service attack from authenticated users
+      (really this time).
+    - misc other fixes
+
+*5.0.5*
+
+ New:
+    - Support for OpenSSL 0.9.7
+    - Beginning of support for AES encryption.
+      ( Currently only usable with Net-SNMP and OpenSNMP software. )
+
+ Ports:
+    - win32 new project files win32sdk.dsw for those with the win32
+      platform sdk.
+    - win32 builds should work properly again, minus callbacks and thus
+      AgentX.
+
+ Fixes:
+    - Several AgentX (the subagent protocol) specific bugs have been fixed
+    - prevent denial of service attack from authenticated users
+    - many many misc fixes
+    - The perl agent module plugin should now work.
+    - Many other perl module related fixes.
+    - net-snmp-config --ldflags properly supplies -L flags
+    - misc make test fixes and improvements.
+
+*5.0.4*
+
+   During the testing for release 5.0.4, a release candidate was uploaded
+   to Sourceforge and marked as hidden. For variouse reasons, the release
+   was delayed and further changes and fixes were made.  However, the 
+   release candidate files still appeared on the public FTP server and our
+   mirrors. To avoid the confusion that could occur to users who may have
+   downloaded this release candidate, we are bumping the revision number
+   to 5.0.5.  If you downloaded net-snmp-5.0.4.tar.gz, please upgrade
+   to net-snmp-5.0.5.tar.gz.
+
+*5.0.3*
+
+ New:
+    - the "dist" directory contains the beginnings of some init
+      scripts and packaging utilities.
+
+ Ports:
+    - win32 builds should work properly again.
+
+ Fixes:
+    - the 5.0.2 package had a few broken packaging problems.  Opps.
+    - a few misc fixes.
+
+ Perl:
+    - the perl modules should work with older versions of perl again.
+
+*5.0.2*
+
+ New:
+    - mib2c support for the old-4.X style api and for scalars.
+    - many improvements to the netsh shell environment.
+
+ Fixes:
+    - tcpwrappers support should work significantly better.
+    - NFS file systems are better supported in the hrStorageTable
+    - the memory reporting no longer accidentally reports -1 integers
+    - a few memory leaks fixed in the table_iterator API
+    - fixes for Sun's "make"
+    - ds_ prefix name-space protection (-> netsnmp_ds_)
+      (run configure with --enable-ucd-compatibility for old API)
+    - v1/v2c access control fixes for ipv6 addresses
+    - many many misc fixes
+
+ Perl:
+    - The perl modules have a number of fixes, and the build process
+      was fixed (again).
+    - all make test suites should pass for people now.
+      (there are still some known minor limitations, but we removed the tests)
+
+*5.0.1*
+
+ New:
+    - A new flag: -OQ which does quick printing (-Oq), but with an '=' sign.
+    - All output should now have type tags in front of them.
+      (STRING: and INTEGER: were added)
+    - the snmplib/mib.c file has been instrumented with doxygen comments.
+    - two new mib2c configuration files for generating column and enum defines.
+    - a agent coding example: agent/mibgroup/examples/notification.c
+
+ Perl:
+    - the SNMP perl module properly uses snmp.conf values as defaults.
+    - --with-perl should work this time.
+    - more embedded perl support, but it still isn't complete yet.
+      (the NetSNMP::OID module has received many new features)
+
+ Ports:
+    - added vmstat and memory support for hpux11
+    - other misc improvements for hpux11
+
+ Fixes:
+    - the agent should properly handle requests in the right order.
+      (e.g., restrict the agent to processing only one SET at a time)
+    - net-snmp-config --compile-subagent has been greatly improved.
+    - the tools should report the right version number.
+    - large /proc/stat files on linux shouldn't crash the agent.
+    - the smux module should handle multiple registrations better.
+    - various documentation clean ups.
+    - 64 bit address clean ups.
+    - misc other bug fixes.
+
+*5.0*
+
+ New:
+
+    - Much of the agent internals were completely rewritten and sports
+      a new module API to make your life easier.  See the
+      agent/mibgroup/examples directory for example code that makes
+      use of some of the new functionality.
+      (Also see http://www.net-snmp.org/tutorial-5/agent/ which has
+      some incomplete documentation)
+    - The agent sports embedded perl, see the perl details further below.
+    - The agent supports multiple SNMPv3 contexts and mib modules can
+      now register themselves under different contexts.  (see the -n
+      option in the snmpcmd manual page for details on specifying
+      context strings in requests)
+    - The proxy code has been completely rewritten and now supports
+      the use of SNMPv3 contexts to help select which proxied host you
+      wish to talk to.  See the snmpd.conf manual page.
+    - All the tools take --configToken=value options now.  (see -H
+      output from any command for what configTokens it accepts)
+    - All the tools can speak over many different transport layers
+      now, including UDP/TCP (ipv4 and ipv6), AAL5pvc, and IPX.  See
+      ./configure --help for details on enabling them.
+      Note: the -p and -T flags to all the applications have been
+      removed.  Use hostname strings like "tcp:localhost:9999"
+      instead.  See the snmpcmd manual page for details.
+    - snmptrapd now acts as an agentx subagent and implements portions
+      of the NOTIFICATION-LOG-MIB to allow captured traps and informs
+      to be queried.
+    - A "net-snmp-config" script will get installed which can report
+      how the various tools were built (which libraries they were
+      linked against, etc).  It will also help you do other things as
+      well, like setting up snmpv3.  Run net-snmp-config --help for details.
+    - kerberos authenticated and encrypted SNMPv3 is now possible.
+      See ./configure --help for details on enabling the ksm security module.
+    - The AgentX subagent protocol implementation has many new
+      features and fixes.
+    - mib2c was completely rewritten and has a much improved
+      configuration file specification.
+    - Much of the code is getting documented with "doxygen" style
+      documentation.  Run "make docs" if you have doxygen installed.
+    - some RMON support is available.
+      (See agent/mibgroup/Rmon/README for details.)
+    - The source tree has been reorganized and all the exported header
+      files are now in the include subdirectory.  You can now point to
+      the includes easily without having to run "make install" first.
+    - the agent now requires a configuration file to access any information.
+    - The entire code base has had indent run on it to effect a
+      consistent coding style.  See the CodingStyle file for details.
+
+ Perl:
+    
+    - The SNMP perl module now calls init_snmp() like real net-snmp
+      applications, which means it will read snmp.conf configuration
+      files, etc.
+    - new perl specific configure options --with-perl-modules &
+      --enable-embedded-perl.  See ./configure --help for details.
+    - The beginnings of some new Perl modules (alpha level quality)
+      are in the perl directory, including:
+      - NetSNMP::agent which allows perl scripts to become net-snmp
+        master or subagents
+      - AnyData::SNMP is available that implements a perl DBI
+        interface to map SQL commands to SNMP.  Included is a "netsh"
+        shell where SQL commands can be typed, aliases created, etc.
+        See the perl/AnyData_SNMP/INSTALL file for details.
+    - Beginning (alpha level quality) support for embedding perl
+      subroutines directly within the net-snmp agent.
+
+UCD-SNMP NEWS:
+
+*4.2.6*
+ Big fixes:
+    - Fixes to the Tunnel mib.
+    - Deprecated the non-raw objects in the system stats MIB portion.
+    - Testing harness fixes.
+    - Network file system improvements fro the hrStorageTable. 
+    - fixed snmptable.
+    - fixed the memory table (again) locking to 2^31 in value.
+    - Misc documentation fixes and clean-ups.
+    - Many other misc fixes.
+
+*4.2.5*
+ Bug fixes:
+    - The perl module actually works.  Sorry about that.
+    - don't overwrite the PID of an already-running snmpd with the PID
+      of an abortive snmpd.
+    - a 64 bit architecture socket fix
+    - smux authentication fixed for multiple connected sessions.
+    - dynamic module support testing in the configure
+    - memory values > 32bits are now reported as a maxed out 32bit number
+
+*4.2.4*
+ New:
+    - badCommunityNames and badCommunityUses Counters supported.
+    - tcp_wrappers support for snmptrapd.
+
+ Bug fixes:
+    - A security issue involving the snmpnetstat command accepting
+      illegal data from a faked snmp server.
+    - RPM library support fixes.
+    - shared libraries built by default.
+    - many bug fixes for conformance of target, notification, and vacm tables
+    - many other fixes.
+
+ Ports:
+    - HPUX 11
+    - Dynix/PTX 4.4
+    - The snmpd demon can properly run as a windows service
+
+*4.2.3*
+ New:
+    - sysLocation, sysContact, sysName and snmpEnableAuthenTraps are
+      persistent after being set remotely.
+    - New "ignoredisk" directive to ignore disks in the host resources mib.
+
+ Bug Fixes:
+    - The ifTable on Linux no longer reports duplicate interfaces.
+    - perl scripts print better error messages if needed modules
+      aren't available.
+    - trap sinks aren't duplicated after a SIGHUP. 
+    - misc other fixes.
+
+ Ports:
+    - improved irix support.
+    - more mibII support for windows.
+
+*4.2.2*
+ Security Bug Fixes:
+    - A few security bugs have been found and fixed. No known exploits
+      have been released to date. However, users are encouraged to
+      upgrade to the 4.2.2 release as soon as possible.
+ 
+ Bug fixes:
+    - many misc bug fixes.
+    - misc documentation corrections.
+    - updated libtool to 1.4.  This fixes a couple of platforms (eg, NetBSD).
+
+ Ports:
+    - mibII support for win32
+    - It should compile and work on MacOS X (Darwin)
+    - udpTable supported on solaris.
+    - win32 borland compiler supported (see win32/config.h.borland)
+
+ New:
+    - tkmib supports SETs and saving of configuration data.
+    - snmpwalk detects out of order OIDs being returned from an agent.
+    - snmpset accepts the '=' sign for a datatype if the mib is
+      available to extract the datatype from instead.
+
+*4.2.1*
+ Administrative:
+    - The http://www.net-snmp.org/ web site and domain name is now active.
+    - Copyright statement for changes beyond 4.2 is now a true BSD license.
+      (see the COPYING file for details)
+
+ Major Bug fixes:
+    - AgentX master agent no longer crashes when a subagent disconnects.
+    - counter64 encoding fixed.
+    - oids with large numbers embedded in them should work properly (again).
+    - Fixed behavior of agent_check_and_process() and alarms.
+    - mib2c handles more variable types.
+    - traps/informs are sent properly from agentx subagents.
+    - many many more bug fixes have gone into this release.
+
+ New:
+    - The snmpconf configuration file editor can create snmptrapd.conf files.
+    - AgentX support is compiled in by default, but must be configured now.
+      (Add "master on" to your snmpd.conf file to enable agentx support)
+
+*4.2*
+
+ Administrative:
+    - project services moved to http://www.net-snmp.org/project/
+
+ Features:
+    - Packets sequences are now shorter when possible, reducing packet sizes.
+    - A new configuration file creation tool: snmpconf.
+      (try snmpconf -g basic_setup)
+    - A new command to remotely list disk space: snmpdf.
+    - the agent VACM tables are now writable.
+    - a new snmpvacm tool can be used to change the running vacm configuration.
+    - dynamicly loadable mib module support for the agent.
+      (see snmpd.conf on the dlmod directive)
+    - minimal proxy support for snmpd
+      (see snmpd.conf on the proxy directive)
+    - libtool is now used to compile the package (better shared-library support)
+    - the agent now supports the SNMP-NOTIFICATION-MIB.
+      (enabled by default).
+    - the agent can set trapsink using snmpcmd command line style parameters
+      (see the trapsess section of the snmpd.conf manual page)
+    - index matching in oids has been improved
+      (see the snmpcmd manual page on -Ox, -OE, and -Ob).
+    - snmptrapd has new formating directives.
+      (see the snmptrapd manual page on format1 and format2).
+    - the agent can listen to multiple ports.
+    - the agent can be restricted to listening on only certain interfaces.
+    - the agent can be told at run time which mib modules (not) to initialize.
+      (see the -I option in the snmpd.conf manual page)
+    - the agent can run as a particular user.
+    - snmptable takes a -Ci argument to show table indices.
+    - snmptable uses GETBULK requests when it can (unless -CB is specified).
+    - The "make test" suite contains a lot of new tests.
+    - cross-compiling support.
+    - snmpset checks types and range values for legality.
+    - Significant improvements to the AgentX support.
+      (Code is still beta, but probably safe for use on non-critical systems).
+
+ Perl:
+    - bulkwalk functionality for the SNMP perl module.
+    - entirely numeric OID support.
+    - support for best guess mode for OIDs.
+    - range and default value access added.
+    - build can now be targeted against a non-standard net-snmp install path.
+
+ Fixes:
+    - v3 traps/informs handled properly now.
+    - Many more misc bug fixes.
+    - snmpv3 engineIDs not IP address specific.
+
+*4.1.2*
+ Fixes:
+    - Host resources fixes for FreeBSD and NetBSD
+    - ucd-snmp memory/vmstat fixes for FreeBSD-3
+    - configure --enable-ipv6 fixes
+    - AIX fix (use knlist)
+    - fix init_master_agent calling exit
+    - bad free in subagent.c
+    - dont let a agentx subagent be a smux master
+    - ucd-snmp/loadave fix for AIX
+    - fix doing a set on a pass variable
+    - snmptable fixes
+    - snmpnetstat fixes for v2c exceptions
+    - man page fixes
+
+ Features:
+    - Some UnixWare 5 configuration support
+    - configure --enable-mini-agent --without-openssl
+    - snmptrapd -n
+    - snmp_log callbacks
+    - noTokenWarnings and noRangeCheck in snmp.conf
+    - using a counter type in snmpset/snmptrap
+
+*4.1.1*
+ Fixes:
+    - Better agent handling of unauthorized requests.
+    - Better "make test" support.
+    - Misc bug fixes.
+
+*4.1*
+ New:
+    - Many new command line flags have been added for input/output flexibility.
+      (see the snmpcmd(1) manual page on the -O flag and -I flag)
+    - The tools support regex matching of oids on the command line.
+      (see the snmpcmd(1) manual page on the -Ib option)
+    - A ucd-snmp usage tutorial has been placed on the main web page.
+      (see http://www.net-snmp.org/tutorial/)
+    - snmptable is much smarter and handles sparse tables better.
+    - tkmib supports snmpv3.
+    - New agent libraries to embed SNMP and AgentX agents into other programs.
+      (see the snmp_agent_api(3) manual page and the tutorial)
+    - SNMP over TCP is supported.
+      (-T TCP on the command lines)
+    - OpenSSL has replaced KMT for SHA authentication and DES encryption.
+      (Get OpenSSL from http://www.openssl.org/).
+    - Some easier-to-use access-control snmpd.conf directives for simple setups.
+      (see the snmpd.conf(5) manual page)
+    - Easier setup of SNMPv3 support for the agent.
+      (see the README.snmpv3 file).
+    - Command line argument parsing has been reworked for getopt() use.
+      (currently backwards compatible; see the snmpcmd(1) manual page)
+    - Table rows with embedded strings are dealt with for both input and output.
+      (see the snmpcmd(1) manual on the -Ob flag)
+    - Many more snmp.conf directives supported.
+      (see the snmp.conf(5) manual page)
+    - Many AgentX improvements.
+    - All of our distributed mibs have been updated to be SMIv2 compliant.
+    - Trap support in the agent has been cleaned up and an API created.
+
+ Perl:
+    - Joe Marzot's perl module is now included with the ucd-snmp source.
+      (this should help people trying to synchronize the two packages)
+
+ Fixes:
+    - SMUX support has been reintegrated into the agent in a better way.
+    - Many many others.
+
+*4.0.1*
+ New:
+    - defVersion in snmp.conf supported.
+ Fixes:
+    - An option was accidentally turned on by default that shouldn't have been.
+    - misc minor fixes.
+
+*4.0*
+ New:
+    - SNMPv3 protocol support!!!
+      (See the README.snmpv3, snmpusm(1), snmp.conf(5), snmpd.conf(5))
+    - historic v2party support removed.
+    - complete re-write of the agent.
+    - The extensible AgentX protocol is in alpha-test mode.
+      (to use, compile with the mib-module "agentx" or
+      "agentx/master" or "agentx/client").
+    - syslog support for the agent (and everything else for that matter).
+    - Per-process/per-exec-script based fix scripts implemented.
+      (see snmpd.conf(5) for details)
+    - many more config file options supported.
+      (run any command with -H and see appropriate .conf manual pages)
+    - The start of a "make test" suite.
+    - many other things we've forgotten.
+    - code is ANSI C now, and requires a ANSI C compiler.
+
+ API Changes:
+    - A small change to the write functions in mib modules.
+      (data passed in has already be BER-decoded and is a pointer to a 
+      variable of the correct type).
+    - The config_load_mib mib-module .h file directive is now
+      obsolete.  Use REGISTER_MIB inside your init function instead.
+
+*3.6.2*
+ Fixes:
+    - An important multi-session bug fix, especially needed for the
+      SNMP perl module.
+    - Many minor bug fixes.
+
+*3.6.1*
+ Fixes:
+    - Minor last second fixes mostly.
+
+*3.6*
+ New:
+    - All of the services for ucd-snmp have moved from the sites in
+      ece.ucdavis.edu to ucd-snmp.ucdavis.edu, including http, ftp,
+      and the mailing lists.
+    - The configure --help output has been greatly improved for better
+      readability and has been broken into sections.
+    - The agent's SMUX support has been greatly improved and should
+      function with applications other than gated now.
+    - The snmptrapd has been make extensible so you can call other
+      programs and scripts when a trap has been received.
+      (see snmptrapd.conf(5))
+    - More configuration files have been created and can be used to
+      specify defaults and configuration information to the various
+      applications.  Run each command with -H to see what it understands.
+      (see snmp_config(5), snmpd.conf(5), snmp.conf(5), snmptrapd.conf(5))
+    - The configuration file parser looks in ~/.snmp by default as
+      well, allowing each user to have his/her own setup files for the
+      various applications.
+    - The mib parser supports a variety of options dictating how
+      strictly it parses mib files.
+      (see snmpcmd.1 on "-P")
+    - Debugging output with the -D flag now accepts a list of
+      debugging information types to print.
+      (see snmpcmd.1 on "-D")
+    - Minimal multi-thread support using a modified version of the
+      session API.
+      (see snmp_sess_api(3))
+    - persistent storage of information is possible from the agent's
+      mib modules now.
+      (see read_config(3))
+    - The target mib has been implemented as an optional module.
+    - More documentation has been written.
+    - The recommended mib module API has changed slightly, but is
+      backwards compatible as well.  See the AGENT.txt file for new
+      documentation on how to write mib modules for the agent.
+    
+  Fixes:
+    - many misc bug fixes, as always.
+
+  Ports:
+    - snmpnetstat has been ported to the win32 enviornment.
+
+*3.5.3*
+    - Bug fixes, including row creation sets to mib modules should work again.
+
+*3.5.2*
+    - very small last minute bug fixes for win32 and freebsd mostly.
+
+*3.5.1*
+
+ Fixes:
+    - Many bug fixes submitted by users and the ucd-snmp-coders.
+    - v2party support in the agent has been fixed.
+    - The UCD-SNMP-MIB is SMICng compliant and should work under HP OV better.
+    - Most sections of the mibII tree are 64bit clean.
+
+ Copyright:
+    - Simplification.
+
+*3.5*
+
+ New:
+    - agent/mibgroup directory reorganized hierarchically.
+      - this may break the agent compilation with some compilers.
+    - floats, doubles, counter64s, int64s, uint64s support via opaque types.
+    - new modules: misc/ipfwacc.
+    - use of dynamicly loadable modules now possible, but not fully supported.
+    - New application command line flags:  -s, -S, -m MIBS, -M MIBDIRS.
+    - new configure options: --with-cc=CC and --with-cflags=CFLAGS
+
+ Fixes:
+    - Solaris core dumps.
+    - Fixes for NetBSD 1.3.
+    - The apps work again on 64bit machines.
+    - misc other bug fixes.
+
+ Ports:
+    - host resources module should work on more platforms: NetBSD,
+      FreeBSD, SunOS (almost).
+
+*3.4*
+
+ Important:
+    - the UCD-SNMP specific mib structure changed.
+      - many of the table oids have changed location and have been renamed.
+    - the View Based Access Control module was implemented in the agent.
+      Therefore, the "community" snmpd.conf parameter no longer
+      exists.  See the snmpd.conf file for how to control access via
+      community names now.
+    - The header file #defines have changed.  You may have to compile
+      third party applications with -DCMU_COMPATIBLE (like perl-SNMP <= V1.7).
+    - The parser is more strict about unlinked OIDs and end-of-comment
+      conditions.  You may see problems in a few broken mibs that used
+      to parse ok with the older parser.
+
+ New:
+    - dynamic library support:  configure with --enable-shared.
+    - the beginnings of a Perl/Tk/SNMP mib browser: tkmib
+    - all applications support -R for random oid-name lookups.
+    - default mib list changes when you add or remove agent mib-groups.
+    - debugging in the agent can be turned on and off using snmpsets.
+    - a new mib module displays a list of all loaded mib modules.
+    - the internal structure of the agent's mib modules is now hierarchical.
+    - the agent looks for .conf files in both the lib/ and share/ directories.
+    - more improvements/options to snmptable.
+    - new vmstat module to report vmstat related information under linux.
+    - a perl based mib2c translator to convert mib sections to C code templates.
+
+ Fixes:
+    - The code was run through purify for memory leaks and a few were found.
+    - snmptrap sends to the correct default port of 162 again.
+
+ Ports:
+    - irix 6.2 support improved.
+    - openbsd.
+    - the host resources mib compiles on Solaris.
+
+*3.3.1*
+
+ New:
+    - "make install" installs the library and header files.
+
+ Fixes:
+    - compilation on many architectures (sunos for example).
+    - snmptrapd doesn't exit if v2party files don't exist.
+    - host resources works a bit better (ie, it compiles) under solaris.
+    
+
+*3.3*
+
+  Path changes:
+    - the default paths to the installed mibs and snmpd.conf file have
+      changed to /usr/local/share/snmp (set differently using --datadir).
+    - the default path of the snmpd and snmptrapd have changed to
+      /usr/local/sbin (set differently using --sbindir).
+
+  New:
+    - basic SNMPV2c support.  
+      - Not fully tested (feedback please!), and not RFC compliant.
+      - all apps require '-v 2c' for v2c and '-v 2p' for the older party code.
+    - basic host-resources mib support for linux, and hpux.
+    - All environment variables can be set with a preceding '+' for
+        indicating additions to the default values.
+    - mib modules cleaned up more and can be added and removed more easily.
+    - mib modules have a new macro for callbacks when reading a .conf file.
+    - apps command line interfaces have merged together for standardization.
+    - the libsnmp library no longer forces printing of errors.
+    - 2 new applications: snmpdelta and snmptable.
+    - the mib parser caches mib directory scans for speed improvements.
+    - snmptrapd is snmp-version multi-lingual.
+
+  Ported:
+    - irix should be more complete.
+    - aix 4.1.5.
+    - fixes for hpux 10.20.
+    - linux 2.1.x support.
+    - library and apps supported under 32bit windows systems.
+
+  Fixes:
+    - too numerous to mention.
+
+*3.2*
+
+  New:
+    - Top level of the mib parser has been restructured
+      - no longer reads 'mib.txt'
+      - no longer reads everything (MIBS/MIBDIRS)
+      - reads import clauses to load other required modules
+      - new man page: mib_api.3
+    - The agent has been completely restructured (modularized) to
+      allow for easier extension via C code and requires no
+      modification of the ucd-snmp distributed source code to add in
+      new C coded mib modules.  See the README file in the
+      agent/mibgroup subdirectory for details.  Modules are added and/or
+      removed via configure options.
+    - agent can send traps to multiple trap destinations.
+    - configure can be run outside the default source directory.
+    - Optional modules:  SMUX support to talk with a running gated.
+    - All configure prompted questions can be set on the command line instead.
+
+  Fixes:
+    - Memory leaks.
+    - code is now prototyped and many related bugs have been found.
+      (an ANSI compiler is still optional.)
+    - Many others.
+
+  Ported:
+    - linux-2.*
+    - mips-sgi-irix6.3  (agent needs 2 mib-modules removed still)
+
+*3.1.3*
+
+  New:
+    - FAQ file!
+    - bug-report script!
+    - Agent can read .conf files from more places:
+      - SNMPCONFPATH enviornment variable.
+      - command line options:  -c FILE and -C.
+    - Agent can send coldstart and authentication traps.
+    - All requests/patches/questions should go to 
+        ucd-snmp-coders@ece.ucdavis.edu
+    - snmp variables mib implemented.
+    - more udp, ip, ipNetToMedia tables implemented.
+
+  Fixes:
+    - Memory leaks.
+    - Many other system specific fixes.
+
+  Misc:
+    - configure script updated to autoconf 2.12.
+
+  Removed:
+    - Very ancient tk/tcl code.
+
+*3.1.2*
+
+  New:
+    - extensible mib moved to ucdavis enterprise mib:  .1.3.6.1.4.1.2021.
+    - PORTING file added.
+    - new configure switch:  --without-root-access.
+
+  Ports:
+    - BSDi, and possibly irix, and linux is not too far off.
+    - massive improvements for netbsd, freebsd, hpux.
+
+  Fixes:
+    - Massive parser improvements.  (Niels Baggesen <recnba@mediator.uni-c.dk>)
+    - configure script upgraded to autoconf 2.11.
+
+*3.1.1*
+
+  New:
+    - init_mib() now reads all files in PREFIX/lib/snmp/mibs as mibs.
+    - sysContact and sysLocation settable in snmpd.conf.
+    - TC information retained (from Joe Marzot).
+
+  Fixes:
+    - snmpset on a pass script works now.
+    - pass scripts more throughly tested and debugged.
+    - community 5 can be set now.
+    - Many others.
+
+*3.1.0.1*
+
+  Ported:
+    - FreeBSD 2.?
+
+  Fixes:
+    - snmptrap greatly improved!  (Niels Baggesen <recnba@mediator.uni-c.dk>)
+    - other small stuff.
+    - default logfile location moved to /var/log if exists, else /usr/adm.
+
+  New:
+    - snmptrap man page.  (Niels Baggesen <recnba@mediator.uni-c.dk>)
+
+*3.1*
+
+  Features:
+    - Pass thru extensibility added!
+    - snmpnetstat greatly improved (Niels Baggesen <recnba@mediator.uni-c.dk>)
+    - improved solaris info caching (Dan A. Dickey <ddickey@transition.com>)
+
+  Bug fixes:
+    - many fixes for solaris (Niels Baggesen <recnba@mediator.uni-c.dk>
+      and "Dan A. Dickey" <ddickey@transition.com>)
+    - greatly reduced memory usage by mib parser (Niels Baggesen)
+    - disk checks fixed for solaris and osf.
+    - improved Mib parsing from Mike Perik <mikep@crt.com>
+      - TRAP-TYPE/NOTIFICATION-TYPE now handled.
+      - IMPORTS definition no longer required.
+      - SIZE syntax fixed.
+    - sedscript compiles correctly with Solaris's spro compiler.
+    - many more small ones.
+
+  Misc:
+    - Upgraded to autoconf-2.10
+
+*3.0.7.2*
+
+  Major solaris patches from Niels Baggesen <recnba@mediator.uni-c.dk>. Thanks!
+  Other misc patches
+
+*3.0.7.1*
+
+  Bug fixes.
+
+*3.0.7*
+
+  Features:
+    - Two new operating systems supported: hppa1.1-hp-hpux10.01, *-netbsd1.1
+    - Two new ./configure options:
+      --enable-debugging:  includes nlist and other warnings in log-file output.
+      --with-defaults:     Assumes you want the defaults for all user prompts.
+    
+  Bug fixes:
+    - make clean in man/ works.
+    - Fixed the mib.txt capitalization problem.
+    - Fixed a gcc cpp problem (added -x c to the command line options).
+    - Added NULL to the second gettimeofday argument.
+
+  Misc:
+    - Upgraded to autoconf-2.9
+    - snmpcheck upgraded to perl5.002 and Tk-b10
+    - totally re-did the routing tables (required by hpux10.01).
+
+*3.0.6*
+
+  Features:
+    - snmpV1 community names can be set in the configuration files now!
+    - new app:  apps/snmptrap, as requested by many, many people.
+    - New man page (rough still):  snmpd.conf.5.
+    - Returns new values for system.sysObjectID for each supported OS.
+    - Better OpenView support for changing the icons & etc.  See ov/README.
+
+  Bug fixes.
+    - -p PORT -l LOGFILE now work as advertised.
+    - printed values of timeticks are no longer negative.
+    - Correctly finds the Solaris 2.5 kernel.
+    - the restart-agent mib entry now sets an 1 second alarm to
+      restart so it can return a proper snmp response first.
+    - Truncates existing logfiles.
+    - nlist warnings removed.
+    - more...  (see the ChangeLog)
+
+*3.0.5*
+
+  Bug fixes:
+    - 'make' should not call 'autoconf' and associates anymore.
+    - Fixed sun4 exit codes.  Really.
+    - Changed config.h a bit to fix the mib.txt file's errors when
+      some mibs were not defined for usage.
+
+  Misc:
+    - Updated configure to autoconf 2.7
+
+*3.0.4*
+
+  Mainly a bug fix release:
+    - fixed another 32/64 bit problem:  returned exit codes on alphas
+      were incorrect.
+    - many system errors (e.g., no mem) were causing the agent to
+      return error flags when it really was clueless.  
+    - found a memory leak in the CMU routing table implementation.
+    - More configure cleanups, mostly for Solaris.
+    - snmp_open calls getservbyname only once now, at the request of Gary
+      Hayward <gah@dirac.bellcore.com>.  Mainly for Perl users.
+
+  New example file:  EXAMPLE.conf file (created at build time).
+
+  local/snmpcheck has drastically improved, and now requires Tk-b8.
+
+  You can now mung with all sorts of numbers in config.h and the
+  mib.txt file will be mostly built from it if you change my defaults.
+
+*3.0.3*
+
+  *** default location for .conf and mib.txt files moved to
+      .configure's --prefix location
+
+  Now using GNU's auto-conf for better portability
+    - prompts for important config.h information as well
+
+  Port to Sun4/Solaris 2.4
+
+  -h/--help and -v/--version flags added to snmpd
+
+*3.0.2.1*
+
+  Compilation bug fix
+
+*3.0.2*
+
+  Port to dec-alpha/OSF 3.1
+    - quite a few more CMU bugs found during port.
+
+  (docs/snmpd.1) Beginnings of documentation/man pages.
+
+  (local/snmpcheck) Many changes/improvements.  Still very (usable) Beta.
+
+  (NEWS) Added this file!
+
+*3.0.1*
+
+  (agent/snmpd) 
+    2 Command line options added:
+    -l LOGFILE       Outputs stderr/out to LOGFILE (overrides config.h def)
+    -L               Do NOT write to a log file (overrides config.h)
+
+  (agent/snmpd)
+  New built in mib functions:
+    MIB.VERSIONMIBNUM.VERUPDATECONFIG (default: .1.3.6.1.4.10.100.11)
+       -- set to 'integer:1' to tell the agent to re-read the config file(s).
+
+    MIB.VERSIONMIBNUM.VERRESTARTAGENT (default: .1.3.6.1.4.10.100.12)
+       -- set to 'integer:1' to tell the agent to restart (exec and quits)
+
+  Bug fixes/more CMU clean up
+
+*3.0*
+
+	Initial (public) Release
diff -Naur tomato/release/src/router/snmp/ov/bitmaps/UCD.20.m tomato121/release/src/router/snmp/ov/bitmaps/UCD.20.m
--- tomato/release/src/router/snmp/ov/bitmaps/UCD.20.m	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/ov/bitmaps/UCD.20.m	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,8 @@
+#define UCD_width 20
+#define UCD_height 20
+static char UCD_bits[] = {
+   0x00, 0x00, 0x00, 0xf0, 0xff, 0x00, 0xf0, 0xff, 0x01, 0xf0, 0xff, 0x01,
+   0xf0, 0xff, 0x01, 0xf0, 0xff, 0x01, 0xf0, 0xff, 0x01, 0xf0, 0xff, 0x01,
+   0xf0, 0xff, 0x01, 0xf0, 0xff, 0x01, 0xf0, 0xff, 0x01, 0xf0, 0xff, 0x01,
+   0xe0, 0xff, 0x01, 0xe0, 0xff, 0x00, 0xf0, 0xff, 0x01, 0xf8, 0xff, 0x03,
+   0xf8, 0xff, 0x03, 0xf0, 0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
diff -Naur tomato/release/src/router/snmp/ov/bitmaps/UCD.20.p tomato121/release/src/router/snmp/ov/bitmaps/UCD.20.p
--- tomato/release/src/router/snmp/ov/bitmaps/UCD.20.p	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/ov/bitmaps/UCD.20.p	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,8 @@
+#define UCD_width 20
+#define UCD_height 20
+static char UCD_bits[] = {
+   0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0xe0, 0xbf, 0x01, 0x60, 0xb0, 0x01,
+   0x20, 0xa0, 0x01, 0xa0, 0xb5, 0x01, 0xa0, 0xb5, 0x01, 0x20, 0xa0, 0x01,
+   0x20, 0xa0, 0x01, 0xe0, 0xbf, 0x01, 0x00, 0x80, 0x01, 0xf0, 0xff, 0x01,
+   0xe0, 0xff, 0x01, 0xa0, 0xda, 0x00, 0x50, 0xa5, 0x01, 0xa0, 0x4a, 0x03,
+   0xf8, 0xff, 0x03, 0xf0, 0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
diff -Naur tomato/release/src/router/snmp/ov/bitmaps/UCD.26.m tomato121/release/src/router/snmp/ov/bitmaps/UCD.26.m
--- tomato/release/src/router/snmp/ov/bitmaps/UCD.26.m	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/ov/bitmaps/UCD.26.m	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,12 @@
+#define UCD_width 26
+#define UCD_height 26
+static char UCD_bits[] = {
+   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0xff, 0x1f, 0x00,
+   0xe0, 0xff, 0x1f, 0x00, 0xe0, 0xff, 0x3f, 0x00, 0xe0, 0xff, 0x3f, 0x00,
+   0xe0, 0xff, 0x3f, 0x00, 0xe0, 0xff, 0x3f, 0x00, 0xe0, 0xff, 0x3f, 0x00,
+   0xe0, 0xff, 0x3f, 0x00, 0xe0, 0xff, 0x3f, 0x00, 0xe0, 0xff, 0x3f, 0x00,
+   0xe0, 0xff, 0x3f, 0x00, 0xe0, 0xff, 0x3f, 0x00, 0xe0, 0xff, 0x3f, 0x00,
+   0xe0, 0xff, 0x3f, 0x00, 0x80, 0xff, 0x3f, 0x00, 0xc0, 0xff, 0x0f, 0x00,
+   0xe0, 0xff, 0x1f, 0x00, 0xf0, 0xff, 0x3f, 0x00, 0xf0, 0xff, 0x7f, 0x00,
+   0xf8, 0xff, 0xff, 0x00, 0xf8, 0xff, 0xff, 0x01, 0xf0, 0xff, 0xff, 0x01,
+   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
diff -Naur tomato/release/src/router/snmp/ov/bitmaps/UCD.26.p tomato121/release/src/router/snmp/ov/bitmaps/UCD.26.p
--- tomato/release/src/router/snmp/ov/bitmaps/UCD.26.p	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/ov/bitmaps/UCD.26.p	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,12 @@
+#define UCD_width 26
+#define UCD_height 26
+static char UCD_bits[] = {
+   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00,
+   0xc0, 0xff, 0x17, 0x00, 0xc0, 0x57, 0x37, 0x00, 0xc0, 0x00, 0x36, 0x00,
+   0xc0, 0x00, 0x34, 0x00, 0x40, 0xb5, 0x35, 0x00, 0x40, 0x95, 0x36, 0x00,
+   0x40, 0x95, 0x36, 0x00, 0x40, 0xb7, 0x35, 0x00, 0x40, 0x00, 0x34, 0x00,
+   0xc0, 0x00, 0x36, 0x00, 0xc0, 0xff, 0x37, 0x00, 0x00, 0x00, 0x30, 0x00,
+   0xe0, 0xff, 0x3f, 0x00, 0x80, 0xff, 0x3f, 0x00, 0x00, 0x00, 0x08, 0x00,
+   0x00, 0x55, 0x1a, 0x00, 0x80, 0xaa, 0x34, 0x00, 0x40, 0x55, 0x6a, 0x00,
+   0xa0, 0xa8, 0xd4, 0x00, 0xf8, 0xff, 0xff, 0x01, 0xf0, 0xff, 0xff, 0x01,
+   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
diff -Naur tomato/release/src/router/snmp/ov/bitmaps/UCD.32.m tomato121/release/src/router/snmp/ov/bitmaps/UCD.32.m
--- tomato/release/src/router/snmp/ov/bitmaps/UCD.32.m	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/ov/bitmaps/UCD.32.m	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,14 @@
+#define UCD_width 32
+#define UCD_height 32
+static char UCD_bits[] = {
+   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0xff, 0xff, 0x03,
+   0xe0, 0xff, 0xff, 0x03, 0xe0, 0xff, 0xff, 0x07, 0xe0, 0xff, 0xff, 0x07,
+   0xe0, 0xff, 0xff, 0x07, 0xe0, 0xff, 0xff, 0x07, 0xe0, 0xff, 0xff, 0x07,
+   0xe0, 0xff, 0xff, 0x07, 0xe0, 0xff, 0xff, 0x07, 0xe0, 0xff, 0xff, 0x07,
+   0xe0, 0xff, 0xff, 0x07, 0xe0, 0xff, 0xff, 0x07, 0xe0, 0xff, 0xff, 0x07,
+   0xe0, 0xff, 0xff, 0x07, 0xe0, 0xff, 0xff, 0x07, 0xe0, 0xff, 0xff, 0x07,
+   0xe0, 0xff, 0xff, 0x07, 0xe0, 0xff, 0xff, 0x07, 0x80, 0xff, 0xff, 0x07,
+   0x00, 0xff, 0x7f, 0x00, 0x80, 0xff, 0xff, 0x00, 0xc0, 0xff, 0xff, 0x01,
+   0xc0, 0xff, 0xff, 0x01, 0xe0, 0xff, 0xff, 0x03, 0xe0, 0xff, 0xff, 0x07,
+   0xf0, 0xff, 0xff, 0x0f, 0xf0, 0xff, 0xff, 0x1f, 0xe0, 0xff, 0xff, 0x1f,
+   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
diff -Naur tomato/release/src/router/snmp/ov/bitmaps/UCD.32.p tomato121/release/src/router/snmp/ov/bitmaps/UCD.32.p
--- tomato/release/src/router/snmp/ov/bitmaps/UCD.32.p	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/ov/bitmaps/UCD.32.p	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,14 @@
+#define UCD_width 32
+#define UCD_height 32
+static char UCD_bits[] = {
+   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
+   0xc0, 0xff, 0xff, 0x02, 0xc0, 0xaf, 0xf4, 0x06, 0xc0, 0x01, 0xc0, 0x06,
+   0xc0, 0x00, 0xc0, 0x06, 0xc0, 0x00, 0x80, 0x06, 0xc0, 0xd2, 0x9d, 0x06,
+   0x40, 0x52, 0xa4, 0x06, 0x40, 0x52, 0xa4, 0x06, 0xc0, 0x52, 0xa4, 0x06,
+   0x40, 0x52, 0xa4, 0x06, 0xc0, 0xde, 0x9d, 0x06, 0x40, 0x00, 0x80, 0x06,
+   0xc0, 0x00, 0xc0, 0x06, 0xc0, 0x01, 0xe0, 0x06, 0xc0, 0xff, 0xff, 0x06,
+   0x00, 0x00, 0x00, 0x06, 0xe0, 0xff, 0xff, 0x07, 0x80, 0xff, 0xff, 0x07,
+   0x00, 0x00, 0x40, 0x00, 0x80, 0xaa, 0xaa, 0x00, 0x00, 0x00, 0x00, 0x01,
+   0x80, 0xaa, 0xaa, 0x01, 0x00, 0x55, 0x51, 0x02, 0x80, 0x8a, 0xaa, 0x06,
+   0x00, 0x00, 0x00, 0x0c, 0xf0, 0xff, 0xff, 0x1f, 0xe0, 0xff, 0xff, 0x1f,
+   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
diff -Naur tomato/release/src/router/snmp/ov/bitmaps/UCD.38.m tomato121/release/src/router/snmp/ov/bitmaps/UCD.38.m
--- tomato/release/src/router/snmp/ov/bitmaps/UCD.38.m	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/ov/bitmaps/UCD.38.m	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,19 @@
+#define UCD_width 38
+#define UCD_height 38
+static char UCD_bits[] = {
+   0x00, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xc0, 0xff,
+   0xff, 0x7f, 0xc0, 0xc0, 0xff, 0xff, 0x7f, 0xc0, 0xc0, 0xff, 0xff, 0xff,
+   0xc0, 0xc0, 0xff, 0xff, 0xff, 0xc0, 0xc0, 0xff, 0xff, 0xff, 0xc0, 0xc0,
+   0xff, 0xff, 0xff, 0xc0, 0xc0, 0xff, 0xff, 0xff, 0xc0, 0xc0, 0xff, 0xff,
+   0xff, 0xc0, 0xc0, 0xff, 0xff, 0xff, 0xc0, 0xc0, 0xff, 0xff, 0xff, 0xc0,
+   0xc0, 0xff, 0xff, 0xff, 0xc0, 0xc0, 0xff, 0xff, 0xff, 0xc0, 0xc0, 0xff,
+   0xff, 0xff, 0xc0, 0xc0, 0xff, 0xff, 0xff, 0xc0, 0xc0, 0xff, 0xff, 0xff,
+   0xc0, 0xc0, 0xff, 0xff, 0xff, 0xc0, 0xc0, 0xff, 0xff, 0xff, 0xc0, 0xc0,
+   0xff, 0xff, 0xff, 0xc0, 0xc0, 0xff, 0xff, 0xff, 0xc0, 0xc0, 0xff, 0xff,
+   0xff, 0xc0, 0xc0, 0xff, 0xff, 0xff, 0xc0, 0xc0, 0xff, 0xff, 0xff, 0xc0,
+   0xc0, 0xff, 0xff, 0xff, 0xc0, 0x00, 0xff, 0xff, 0xff, 0xc0, 0x00, 0xfe,
+   0xff, 0x0f, 0xc0, 0x00, 0xff, 0xff, 0x1f, 0xc0, 0x00, 0xff, 0xff, 0x1f,
+   0xc0, 0x80, 0xff, 0xff, 0x3f, 0xc0, 0x80, 0xff, 0xff, 0x3f, 0xc0, 0xc0,
+   0xff, 0xff, 0x7f, 0xc0, 0xc0, 0xff, 0xff, 0xff, 0xc0, 0xe0, 0xff, 0xff,
+   0xff, 0xc1, 0xe0, 0xff, 0xff, 0xff, 0xc3, 0xc0, 0xff, 0xff, 0xff, 0xc3,
+   0x00, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, 0x00, 0xc0};
diff -Naur tomato/release/src/router/snmp/ov/bitmaps/UCD.38.p tomato121/release/src/router/snmp/ov/bitmaps/UCD.38.p
--- tomato/release/src/router/snmp/ov/bitmaps/UCD.38.p	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/ov/bitmaps/UCD.38.p	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,19 @@
+#define UCD_width 38
+#define UCD_height 38
+static char UCD_bits[] = {
+   0x00, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00,
+   0x00, 0x40, 0xc0, 0x00, 0x00, 0x00, 0x40, 0xc0, 0x00, 0xff, 0xff, 0xcf,
+   0xc0, 0x00, 0xbf, 0x4b, 0xcf, 0xc0, 0x00, 0x07, 0x00, 0xcc, 0xc0, 0x00,
+   0x03, 0x00, 0xcc, 0xc0, 0x00, 0x03, 0x00, 0xcc, 0xc0, 0x00, 0x03, 0x00,
+   0xc8, 0xc0, 0x00, 0x01, 0x00, 0xc8, 0xc0, 0x00, 0x93, 0xde, 0xc9, 0xc0,
+   0x00, 0x91, 0x42, 0xca, 0xc0, 0x00, 0x91, 0x42, 0xca, 0xc0, 0x00, 0x93,
+   0x42, 0xca, 0xc0, 0x00, 0xf1, 0xde, 0xc9, 0xc0, 0x00, 0x01, 0x00, 0xc8,
+   0xc0, 0x00, 0x01, 0x00, 0xc8, 0xc0, 0x00, 0x01, 0x00, 0xc8, 0xc0, 0x00,
+   0x03, 0x00, 0xcc, 0xc0, 0x00, 0x0f, 0x00, 0xcf, 0xc0, 0x00, 0xff, 0xff,
+   0xcf, 0xc0, 0x00, 0x00, 0x00, 0xc0, 0xc0, 0x00, 0x00, 0x00, 0xc0, 0xc0,
+   0xc0, 0xff, 0xff, 0xff, 0xc0, 0x00, 0xff, 0xff, 0xff, 0xc0, 0x00, 0x00,
+   0x00, 0x08, 0xc0, 0x00, 0x54, 0x95, 0x12, 0xc0, 0x00, 0xaa, 0x2a, 0x15,
+   0xc0, 0x00, 0x00, 0x00, 0x20, 0xc0, 0x80, 0xaa, 0x2a, 0x35, 0xc0, 0x00,
+   0x55, 0x55, 0x4a, 0xc0, 0x80, 0xaa, 0xaa, 0xd4, 0xc0, 0x00, 0x00, 0x00,
+   0x80, 0xc1, 0xe0, 0xff, 0xff, 0xff, 0xc3, 0xc0, 0xff, 0xff, 0xff, 0xc3,
+   0x00, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, 0x00, 0xc0};
diff -Naur tomato/release/src/router/snmp/ov/bitmaps/UCD.44.m tomato121/release/src/router/snmp/ov/bitmaps/UCD.44.m
--- tomato/release/src/router/snmp/ov/bitmaps/UCD.44.m	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/ov/bitmaps/UCD.44.m	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,25 @@
+#define UCD_width 44
+#define UCD_height 44
+static char UCD_bits[] = {
+   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+   0x00, 0xff, 0xff, 0xff, 0x0f, 0x00, 0x00, 0xff, 0xff, 0xff, 0x0f, 0x00,
+   0x00, 0xff, 0xff, 0xff, 0x1f, 0x00, 0x00, 0xff, 0xff, 0xff, 0x1f, 0x00,
+   0x00, 0xff, 0xff, 0xff, 0x1f, 0x00, 0x00, 0xff, 0xff, 0xff, 0x1f, 0x00,
+   0x00, 0xff, 0xff, 0xff, 0x1f, 0x00, 0x00, 0xff, 0xff, 0xff, 0x1f, 0x00,
+   0x00, 0xff, 0xff, 0xff, 0x1f, 0x00, 0x00, 0xff, 0xff, 0xff, 0x1f, 0x00,
+   0x00, 0xff, 0xff, 0xff, 0x1f, 0x00, 0x00, 0xff, 0xff, 0xff, 0x1f, 0x00,
+   0x00, 0xff, 0xff, 0xff, 0x1f, 0x00, 0x00, 0xff, 0xff, 0xff, 0x1f, 0x00,
+   0x00, 0xff, 0xff, 0xff, 0x1f, 0x00, 0x00, 0xff, 0xff, 0xff, 0x1f, 0x00,
+   0x00, 0xff, 0xff, 0xff, 0x1f, 0x00, 0x00, 0xff, 0xff, 0xff, 0x1f, 0x00,
+   0x00, 0xff, 0xff, 0xff, 0x1f, 0x00, 0x00, 0xff, 0xff, 0xff, 0x1f, 0x00,
+   0x00, 0xff, 0xff, 0xff, 0x1f, 0x00, 0x00, 0xff, 0xff, 0xff, 0x1f, 0x00,
+   0x00, 0xff, 0xff, 0xff, 0x1f, 0x00, 0x00, 0xff, 0xff, 0xff, 0x1f, 0x00,
+   0x00, 0xff, 0xff, 0xff, 0x1f, 0x00, 0x00, 0xff, 0xff, 0xff, 0x1f, 0x00,
+   0x00, 0xfe, 0xff, 0xff, 0x1f, 0x00, 0x00, 0xfe, 0xff, 0xff, 0x07, 0x00,
+   0x00, 0xfe, 0xff, 0xff, 0x07, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x03, 0x00,
+   0x00, 0xfe, 0xff, 0xff, 0x07, 0x00, 0x00, 0xff, 0xff, 0xff, 0x0f, 0x00,
+   0x80, 0xff, 0xff, 0xff, 0x1f, 0x00, 0xc0, 0xff, 0xff, 0xff, 0x3f, 0x00,
+   0xe0, 0xff, 0xff, 0xff, 0x7f, 0x00, 0xf0, 0xff, 0xff, 0xff, 0xff, 0x00,
+   0xf0, 0xff, 0xff, 0xff, 0xff, 0x01, 0xf0, 0xff, 0xff, 0xff, 0xff, 0x01,
+   0xe0, 0xff, 0xff, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
diff -Naur tomato/release/src/router/snmp/ov/bitmaps/UCD.44.p tomato121/release/src/router/snmp/ov/bitmaps/UCD.44.p
--- tomato/release/src/router/snmp/ov/bitmaps/UCD.44.p	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/ov/bitmaps/UCD.44.p	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,25 @@
+#define UCD_width 44
+#define UCD_height 44
+static char UCD_bits[] = {
+   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+   0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00,
+   0x00, 0xfc, 0xff, 0xff, 0x19, 0x00, 0x00, 0xfc, 0xdf, 0xf5, 0x19, 0x00,
+   0x00, 0x3c, 0x00, 0xc0, 0x19, 0x00, 0x00, 0x1c, 0x00, 0x80, 0x19, 0x00,
+   0x00, 0x0c, 0x00, 0x00, 0x19, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x19, 0x00,
+   0x00, 0x0c, 0x00, 0x00, 0x19, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x19, 0x00,
+   0x00, 0x04, 0x00, 0x00, 0x19, 0x00, 0x00, 0x44, 0xf2, 0x1c, 0x19, 0x00,
+   0x00, 0x4c, 0x12, 0x24, 0x19, 0x00, 0x00, 0x44, 0x12, 0x24, 0x19, 0x00,
+   0x00, 0x44, 0x12, 0x24, 0x19, 0x00, 0x00, 0xcc, 0xf3, 0x1c, 0x19, 0x00,
+   0x00, 0x04, 0x00, 0x00, 0x19, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x19, 0x00,
+   0x00, 0x04, 0x00, 0x80, 0x19, 0x00, 0x00, 0x0c, 0x00, 0x80, 0x19, 0x00,
+   0x00, 0x0c, 0x00, 0x80, 0x19, 0x00, 0x00, 0x3c, 0x00, 0xf0, 0x19, 0x00,
+   0x00, 0xfc, 0xff, 0xff, 0x19, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00,
+   0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0xff, 0xff, 0xff, 0x1f, 0x00,
+   0x00, 0xfe, 0xff, 0xff, 0x1f, 0x00, 0x00, 0x0e, 0x00, 0x80, 0x07, 0x00,
+   0x00, 0xa6, 0xaa, 0x4a, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00,
+   0x00, 0xa8, 0xaa, 0x4a, 0x05, 0x00, 0x00, 0x54, 0x55, 0x85, 0x0a, 0x00,
+   0x00, 0xaa, 0xaa, 0x4a, 0x15, 0x00, 0x00, 0x55, 0x55, 0x85, 0x2a, 0x00,
+   0x80, 0x1a, 0xc0, 0x4a, 0x55, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00,
+   0x00, 0x00, 0x00, 0x00, 0x80, 0x01, 0xf0, 0xff, 0xff, 0xff, 0xff, 0x01,
+   0xe0, 0xff, 0xff, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
diff -Naur tomato/release/src/router/snmp/ov/bitmaps/UCD.50.m tomato121/release/src/router/snmp/ov/bitmaps/UCD.50.m
--- tomato/release/src/router/snmp/ov/bitmaps/UCD.50.m	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/ov/bitmaps/UCD.50.m	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,33 @@
+#define UCD_width 50
+#define UCD_height 50
+static char UCD_bits[] = {
+   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xff,
+   0xff, 0xff, 0x00, 0x00, 0x00, 0xfe, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00,
+   0xfe, 0xff, 0xff, 0xff, 0x01, 0x00, 0x00, 0xfe, 0xff, 0xff, 0xff, 0x01,
+   0x00, 0x00, 0xfe, 0xff, 0xff, 0xff, 0x01, 0x00, 0x00, 0xfe, 0xff, 0xff,
+   0xff, 0x01, 0x00, 0x00, 0xfe, 0xff, 0xff, 0xff, 0x01, 0x00, 0x00, 0xfe,
+   0xff, 0xff, 0xff, 0x01, 0x00, 0x00, 0xfe, 0xff, 0xff, 0xff, 0x01, 0x00,
+   0x00, 0xfe, 0xff, 0xff, 0xff, 0x01, 0x00, 0x00, 0xfe, 0xff, 0xff, 0xff,
+   0x01, 0x00, 0x00, 0xfe, 0xff, 0xff, 0xff, 0x01, 0x00, 0x00, 0xfe, 0xff,
+   0xff, 0xff, 0x01, 0x00, 0x00, 0xfe, 0xff, 0xff, 0xff, 0x01, 0x00, 0x00,
+   0xfe, 0xff, 0xff, 0xff, 0x01, 0x00, 0x00, 0xfe, 0xff, 0xff, 0xff, 0x01,
+   0x00, 0x00, 0xfe, 0xff, 0xff, 0xff, 0x01, 0x00, 0x00, 0xfe, 0xff, 0xff,
+   0xff, 0x01, 0x00, 0x00, 0xfe, 0xff, 0xff, 0xff, 0x01, 0x00, 0x00, 0xfe,
+   0xff, 0xff, 0xff, 0x01, 0x00, 0x00, 0xfe, 0xff, 0xff, 0xff, 0x01, 0x00,
+   0x00, 0xfe, 0xff, 0xff, 0xff, 0x01, 0x00, 0x00, 0xfe, 0xff, 0xff, 0xff,
+   0x01, 0x00, 0x00, 0xfe, 0xff, 0xff, 0xff, 0x01, 0x00, 0x00, 0xfe, 0xff,
+   0xff, 0xff, 0x01, 0x00, 0x00, 0xfe, 0xff, 0xff, 0xff, 0x01, 0x00, 0x00,
+   0xfe, 0xff, 0xff, 0xff, 0x01, 0x00, 0x00, 0xfe, 0xff, 0xff, 0xff, 0x01,
+   0x00, 0x00, 0xfe, 0xff, 0xff, 0xff, 0x01, 0x00, 0x00, 0xfe, 0xff, 0xff,
+   0xff, 0x01, 0x00, 0x00, 0xf8, 0xff, 0xff, 0xff, 0x01, 0x00, 0x00, 0xf8,
+   0xff, 0xff, 0x3f, 0x00, 0x00, 0x00, 0xf8, 0xff, 0xff, 0x3f, 0x00, 0x00,
+   0x00, 0xf0, 0xff, 0xff, 0x1f, 0x00, 0x00, 0x00, 0xf8, 0xff, 0xff, 0x3f,
+   0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x7f, 0x00, 0x00, 0x00, 0xfe, 0xff,
+   0xff, 0xff, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x01, 0x00, 0x80,
+   0xff, 0xff, 0xff, 0xff, 0x03, 0x00, 0xc0, 0xff, 0xff, 0xff, 0xff, 0x07,
+   0x00, 0xe0, 0xff, 0xff, 0xff, 0xff, 0x0f, 0x00, 0xe0, 0xff, 0xff, 0xff,
+   0xff, 0x1f, 0x00, 0xe0, 0xff, 0xff, 0xff, 0xff, 0x1f, 0x00, 0xc0, 0xff,
+   0xff, 0xff, 0xff, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+   0x00, 0x00};
diff -Naur tomato/release/src/router/snmp/ov/bitmaps/UCD.50.p tomato121/release/src/router/snmp/ov/bitmaps/UCD.50.p
--- tomato/release/src/router/snmp/ov/bitmaps/UCD.50.p	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/ov/bitmaps/UCD.50.p	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,33 @@
+#define UCD_width 50
+#define UCD_height 50
+static char UCD_bits[] = {
+   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+   0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00,
+   0xf8, 0xff, 0xff, 0x9f, 0x01, 0x00, 0x00, 0xf8, 0xff, 0x9c, 0x9f, 0x01,
+   0x00, 0x00, 0x78, 0x00, 0x00, 0x9c, 0x01, 0x00, 0x00, 0x38, 0x00, 0x00,
+   0x98, 0x01, 0x00, 0x00, 0x18, 0x00, 0x00, 0x98, 0x01, 0x00, 0x00, 0x18,
+   0x00, 0x00, 0x90, 0x01, 0x00, 0x00, 0x18, 0x00, 0x00, 0x90, 0x01, 0x00,
+   0x00, 0x18, 0x00, 0x00, 0x90, 0x01, 0x00, 0x00, 0x18, 0x00, 0x00, 0x90,
+   0x01, 0x00, 0x00, 0x18, 0x00, 0x00, 0x90, 0x01, 0x00, 0x00, 0x18, 0xc9,
+   0x73, 0x90, 0x01, 0x00, 0x00, 0x08, 0x49, 0x90, 0x90, 0x01, 0x00, 0x00,
+   0x08, 0x49, 0x90, 0x90, 0x01, 0x00, 0x00, 0x08, 0x49, 0x90, 0x90, 0x01,
+   0x00, 0x00, 0x08, 0x49, 0x90, 0x90, 0x01, 0x00, 0x00, 0x18, 0xcf, 0x73,
+   0x90, 0x01, 0x00, 0x00, 0x18, 0x00, 0x00, 0x90, 0x01, 0x00, 0x00, 0x08,
+   0x00, 0x00, 0x90, 0x01, 0x00, 0x00, 0x08, 0x00, 0x00, 0x90, 0x01, 0x00,
+   0x00, 0x08, 0x00, 0x00, 0x90, 0x01, 0x00, 0x00, 0x18, 0x00, 0x00, 0x98,
+   0x01, 0x00, 0x00, 0x18, 0x00, 0x00, 0x98, 0x01, 0x00, 0x00, 0x38, 0x00,
+   0x00, 0x9c, 0x01, 0x00, 0x00, 0xf8, 0x01, 0x80, 0x9f, 0x01, 0x00, 0x00,
+   0xf8, 0xff, 0xff, 0x9f, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x01,
+   0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0xfe, 0xff, 0xff,
+   0xff, 0x01, 0x00, 0x00, 0xf8, 0xff, 0xff, 0xff, 0x01, 0x00, 0x00, 0x38,
+   0x00, 0x00, 0x3c, 0x00, 0x00, 0x00, 0x98, 0xaa, 0xaa, 0x3a, 0x00, 0x00,
+   0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0xa0, 0xaa, 0x2a, 0x2a,
+   0x00, 0x00, 0x00, 0x50, 0x55, 0x55, 0x55, 0x00, 0x00, 0x00, 0xa8, 0xaa,
+   0x2a, 0xaa, 0x00, 0x00, 0x00, 0x54, 0x55, 0x55, 0x54, 0x01, 0x00, 0x00,
+   0xaa, 0xaa, 0x2a, 0xaa, 0x02, 0x00, 0x00, 0x55, 0x00, 0x55, 0x54, 0x05,
+   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00,
+   0x00, 0x18, 0x00, 0xe0, 0xff, 0xff, 0xff, 0xff, 0x1f, 0x00, 0xc0, 0xff,
+   0xff, 0xff, 0xff, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+   0x00, 0x00};
diff -Naur tomato/release/src/router/snmp/ov/bitmaps/UCD.fields tomato121/release/src/router/snmp/ov/bitmaps/UCD.fields
--- tomato/release/src/router/snmp/ov/bitmaps/UCD.fields	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/ov/bitmaps/UCD.fields	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,21 @@
+Field "SNMPAgent" {
+	Type Enumeration;
+	Flags	capability, general, locate;
+	Enumeration 
+		"Unset",
+		"UCD HP-UX 9",
+		"UCD HP-UX 10",
+		"UCD SunOS4",
+		"UCD Solaris",
+		"UCD OSF/3",
+		"UCD Ultrix",
+		"UCD Unknown",
+		"UCDavis Agent";
+}
+
+Field "vendor" {
+	Type Enumeration;
+	Flags	capability, general, locate;
+	Enumeration "Unset",
+		"UCDavis";
+}
diff -Naur tomato/release/src/router/snmp/ov/.cvsignore tomato121/release/src/router/snmp/ov/.cvsignore
--- tomato/release/src/router/snmp/ov/.cvsignore	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/ov/.cvsignore	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,3 @@
+Makefile
+oid_to_sym
+oid_to_type
diff -Naur tomato/release/src/router/snmp/ov/Makefile.in tomato121/release/src/router/snmp/ov/Makefile.in
--- tomato/release/src/router/snmp/ov/Makefile.in	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/ov/Makefile.in	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,15 @@
+TARG = oid_to_type oid_to_sym
+
+all: $(TARG)
+
+oid_to_type: oid_to_type.in ../sedscript
+	$(SED) -f ../sedscript $(srcdir)/oid_to_type.in > oid_to_type
+
+oid_to_sym: oid_to_sym.in ../sedscript
+	$(SED) -f ../sedscript $(srcdir)/oid_to_sym.in > oid_to_sym
+
+clean:
+	rm -f $(TARG)
+
+install:
+
diff -Naur tomato/release/src/router/snmp/ov/oid_to_sym.in tomato121/release/src/router/snmp/ov/oid_to_sym.in
--- tomato/release/src/router/snmp/ov/oid_to_sym.in	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/ov/oid_to_sym.in	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,12 @@
+EXTENSIBLEDOTMIB.AGENTID.HPUX9ID:Computer:UCD # UCD HP-UX 9
+EXTENSIBLEDOTMIB.AGENTID.HPUX10ID:Computer:UCD # UCD HP-UX 10
+EXTENSIBLEDOTMIB.AGENTID.SUNOS4ID:Computer:UCD # UCD SunOS4
+EXTENSIBLEDOTMIB.AGENTID.SOLARISID:Computer:UCD # UCD Solaris
+EXTENSIBLEDOTMIB.AGENTID.OSFID:Computer:UCD # UCD OSF
+EXTENSIBLEDOTMIB.AGENTID.ULTRIXID:Computer:UCD # UCD Ultrix
+EXTENSIBLEDOTMIB.AGENTID.NETBSD1ID:Computer:UCD # UCD NetBSD
+EXTENSIBLEDOTMIB.AGENTID.FREEBSDID:Computer:UCD # UCD FreeBSD
+EXTENSIBLEDOTMIB.AGENTID.IRIXID:Computer:UCD # UCD IRIX
+EXTENSIBLEDOTMIB.AGENTID.LINUXID:Computer:UCD # UCD LINUX
+EXTENSIBLEDOTMIB.AGENTID.BSDIID:Computer:UCD # UCD BSD/OS
+EXTENSIBLEDOTMIB.AGENTID.UNKNOWNID:Computer:UCD # UCD Unknown
diff -Naur tomato/release/src/router/snmp/ov/oid_to_type.in tomato121/release/src/router/snmp/ov/oid_to_type.in
--- tomato/release/src/router/snmp/ov/oid_to_type.in	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/ov/oid_to_type.in	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,12 @@
+EXTENSIBLEDOTMIB.AGENTID.HPUX9ID:Hewlett-Packard:UCD HP-UX 9
+EXTENSIBLEDOTMIB.AGENTID.HPUX10ID:Hewlett-Packard:UCD HP-UX 10
+EXTENSIBLEDOTMIB.AGENTID.SUNOS4ID:Sun:UCD SunOS4
+EXTENSIBLEDOTMIB.AGENTID.SOLARISID:Sun:UCD Solaris
+EXTENSIBLEDOTMIB.AGENTID.OSFID:DEC:UCD OSF
+EXTENSIBLEDOTMIB.AGENTID.ULTRIXID:DEC:UCD Ultrix
+EXTENSIBLEDOTMIB.AGENTID.NETBSD1ID:NetBSD:UCD NetBSD
+EXTENSIBLEDOTMIB.AGENTID.FREEBSDID:FreeBSD:UCD FreeBSD
+EXTENSIBLEDOTMIB.AGENTID.IRIXID:SGI:UCD IRIX
+EXTENSIBLEDOTMIB.AGENTID.LINUXID:Linux:UCD Linux
+EXTENSIBLEDOTMIB.AGENTID.BSDIID:BSDI:UCD BSD/OS
+EXTENSIBLEDOTMIB.AGENTID.UNKNOWNID:Unset:UCD Unknown
diff -Naur tomato/release/src/router/snmp/ov/README tomato121/release/src/router/snmp/ov/README
--- tomato/release/src/router/snmp/ov/README	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/ov/README	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,31 @@
+This directory contains support files for HP-OpenView.  Some of the
+files need to be built and depend on the config.h and sedscript files
+in the top level source directory.  You should, therefore, run 'make'
+before installing these files.  Installation is by hand, since I don't
+want to be responsible for messing up your OpenView configuration.
+
+If you install all these files properly, then do a 'ovstop', an
+'ovstart', an 'ovw -fields', and an 'ovw -verify' you should start
+seeing new icons appear for all ucd-snmp controlled packages.  If they
+don't appear immediately, its probably because OV's netmon process
+hasn't changed the symbol ID for it yet.  You can test a specific host
+by selecting it and then doing a 
+'Diagnose/Network Connectivity/Demand Poll' on it from ovw.
+
+oid_to_sym:      Translates sysObjectID results to OV icon types.
+  -  Append this to /etc/opt/OV/share/conf/C/oid_to_sym
+  -  Optionally replace Computer:UCD with Computer:Workstation if you
+     don't want to install the bitmaps.
+
+oid_to_type:      Translates sysObjectID results to OV description strings
+  -  Append this to /etc/opt/OV/share/conf/oid_to_type
+
+UCD-fields:      Adds the UCD agent types to the "SNMPAgent" OpenView field.
+  -  Copy to /etc/opt/OV/share/fields/C/
+
+UCD-Computer:         OV Computer Class additions
+  -  Copy to /etc/opt/OV/share/symbols/C/
+
+bitmaps/*:        Bitmaps/Icons for ovw
+  -  Copy the contents of the directory to /etc/opt/OV/share/bitmaps/C/computer/
+
diff -Naur tomato/release/src/router/snmp/ov/UCD-Computer tomato121/release/src/router/snmp/ov/UCD-Computer
--- tomato/release/src/router/snmp/ov/UCD-Computer	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/ov/UCD-Computer	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,9 @@
+SymbolType "Computer" : "UCD"
+{
+        Filebase "UCD";
+        CursorSize 38;
+
+        Capabilities {
+                isWorkstation = 1;
+        }
+}
diff -Naur tomato/release/src/router/snmp/ov/UCD-fields tomato121/release/src/router/snmp/ov/UCD-fields
--- tomato/release/src/router/snmp/ov/UCD-fields	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/ov/UCD-fields	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,26 @@
+Field "SNMPAgent" {
+	Type Enumeration;
+	Flags	capability, general, locate;
+	Enumeration 
+		"Unset",
+		"UCD HP-UX 9",
+		"UCD HP-UX 10",
+		"UCD SunOS4",
+		"UCD Solaris",
+		"UCD OSF",
+		"UCD Ultrix",
+		"UCD NetBSD",
+		"UCD FreeBSD",
+		"UCD IRIX",
+		"UCD Linux",
+		"UCD BSD/OS",
+		"UCD Unknown",
+		"UCDavis Agent";
+}
+
+Field "vendor" {
+	Type Enumeration;
+	Flags	capability, general, locate;
+	Enumeration "Unset",
+		"UCDavis";
+}
diff -Naur tomato/release/src/router/snmp/perl/agent/agent.pm tomato121/release/src/router/snmp/perl/agent/agent.pm
--- tomato/release/src/router/snmp/perl/agent/agent.pm	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/perl/agent/agent.pm	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,206 @@
+package NetSNMP::agent;
+
+use strict;
+use Carp;
+
+require Exporter;
+require DynaLoader;
+use AutoLoader;
+
+use NetSNMP::default_store (':all');
+use NetSNMP::agent::default_store (':all');
+use NetSNMP::OID (':all');
+use NetSNMP::agent::netsnmp_request_infoPtr;
+
+use vars qw(@ISA %EXPORT_TAGS @EXPORT_OK @EXPORT $VERSION $AUTOLOAD);
+
+@ISA = qw(Exporter AutoLoader DynaLoader);
+
+# Items to export into callers namespace by default. Note: do not export
+# names by default without a very good reason. Use EXPORT_OK instead.
+# Do not simply export all your public functions/methods/constants.
+
+# This allows declaration	use NetSNMP::agent ':all';
+# If you do not need this, moving things directly into @EXPORT or @EXPORT_OK
+# will save memory.
+%EXPORT_TAGS = ( 'all' => [ qw(
+	MODE_GET
+	MODE_GETBULK
+	MODE_GETNEXT
+	MODE_SET_ACTION
+	MODE_SET_BEGIN
+	MODE_SET_COMMIT
+	MODE_SET_FREE
+	MODE_SET_RESERVE1
+	MODE_SET_RESERVE2
+	MODE_SET_UNDO
+) ] );
+
+@EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } );
+
+@EXPORT = qw(
+	MODE_GET
+	MODE_GETBULK
+	MODE_GETNEXT
+	MODE_SET_ACTION
+	MODE_SET_BEGIN
+	MODE_SET_COMMIT
+	MODE_SET_FREE
+	MODE_SET_RESERVE1
+	MODE_SET_RESERVE2
+	MODE_SET_UNDO
+);
+$VERSION = '0.01';
+
+sub AUTOLOAD {
+    # This AUTOLOAD is used to 'autoload' constants from the constant()
+    # XS function.  If a constant is not found then control is passed
+    # to the AUTOLOAD in AutoLoader.
+
+    my $constname;
+    ($constname = $AUTOLOAD) =~ s/.*:://;
+    croak "& not defined" if $constname eq 'constant';
+    my $val = constant($constname, @_ ? $_[0] : 0);
+    if ($! != 0) {
+	if ($! =~ /Invalid/ || $!{EINVAL}) {
+	    $AutoLoader::AUTOLOAD = $AUTOLOAD;
+	    goto &AutoLoader::AUTOLOAD;
+	}
+	else {
+	    croak "Your vendor has not defined NetSNMP::agent macro $constname";
+	}
+    }
+    {
+	no strict 'refs';
+	# Fixed between 5.005_53 and 5.005_61
+#	if ($] >= 5.00561) {
+#	    *$AUTOLOAD = sub () { $val };
+#	}
+#	else {
+	    *$AUTOLOAD = sub { $val };
+#	}
+    }
+    goto &$AUTOLOAD;
+}
+
+{
+    my $haveinit = 0;
+
+    sub mark_init_agent_done {
+	$haveinit = 1;
+    }
+
+    sub maybe_init_agent {
+	return if ($haveinit);
+	$haveinit = 1;
+
+	snmp_enable_stderrlog();
+	my $flags = $_[0];
+	if ($flags->{'AgentX'}) {
+	    netsnmp_ds_set_boolean(NETSNMP_DS_APPLICATION_ID, NETSNMP_DS_AGENT_ROLE, 1);
+	}
+	init_agent($flags->{'Name'} || "perl");
+	if ($flags->{'Ports'}) {
+	    netsnmp_ds_set_string(NETSNMP_DS_APPLICATION_ID, NETSNMP_DS_AGENT_PORTS, $flags->{'Ports'});
+	}
+	init_mib();
+    }
+}
+
+{
+    my $haveinit = 0;
+
+    sub mark_init_lib_done {
+	$haveinit = 1;
+    }
+
+    sub maybe_init_lib {
+	return if ($haveinit);
+	$haveinit = 1;
+
+	my $flags = $_[0];
+	init_snmp($flags->{'Name'} || "perl");
+	if (netsnmp_ds_get_boolean(NETSNMP_DS_APPLICATION_ID, NETSNMP_DS_AGENT_ROLE) != 1) {
+	    init_master_agent();
+	}
+    }
+}
+
+sub new {
+    my $type = shift;
+    my ($self);
+    %$self = @_;
+    bless($self, $type);
+    if ($self->{'dont_init_agent'}) {
+	$self->mark_init_agent_done();
+    } else {
+	$self->maybe_init_agent();
+    }
+    if ($self->{'dont_init_lib'}) {
+	$self->mark_init_lib_done();
+    }
+    return $self;
+}
+
+sub register($$$$) {
+    my ($self, $name, $oid, $sub) = @_;
+    my $reg = NetSNMP::agent::netsnmp_handler_registration::new($name, $oid, $sub);
+    $reg->register() if ($reg);
+    return $reg;
+}
+
+sub main_loop {
+    my $self = shift;
+    while(1) {
+	$self->agent_check_and_process(1);
+    }
+}
+
+sub agent_check_and_process {
+    my ($self, $blocking) = @_;
+    $self->maybe_init_lib();
+    __agent_check_and_process($blocking || 0);
+}
+
+bootstrap NetSNMP::agent $VERSION;
+
+# Preloaded methods go here.
+
+# Autoload methods go after =cut, and are processed by the autosplit program.
+
+1;
+__END__
+# Below is stub documentation for your module. You better edit it!
+
+=head1 NAME
+
+NetSNMP::agent - Perl extension for the net-snmp agent.
+
+=head1 SYNOPSIS
+
+  use NetSNMP::agent;
+  my $agent = new NetSNMP::agent('Name' -> 'my_agent_name');
+  $agent->register("a_name", ".1.3.6.1.2.1", \&myhandler);
+  $agent->main_loop();
+
+    --- or, within the net-snmp snmpd.conf file: ---
+
+  perl $agent->register("a_name", ".1.3.6.1.2.1", \&myhandler);
+
+=head1 DESCRIPTION
+
+This module implements a snmp agent and/or can be embedded within the
+net-snmp agent.
+
+=head1 AUTHOR
+
+Please mail the net-snmp-users@lists.sourceforge.net mailing list for
+help, questions or comments about this module.
+
+Wes Hardaker, hardaker@users.sourceforge.net
+
+=head1 SEE ALSO
+
+perl(1).
+
+=cut
diff -Naur tomato/release/src/router/snmp/perl/agent/agent.xs tomato121/release/src/router/snmp/perl/agent/agent.xs
--- tomato/release/src/router/snmp/perl/agent/agent.xs	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/perl/agent/agent.xs	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,788 @@
+/* -*- C -*- */
+#include "EXTERN.h"
+#include "perl.h"
+#include "XSUB.h"
+#include <netdb.h>
+#include <sys/socket.h>
+
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+#ifndef sv_undef
+#define sv_undef PL_sv_undef
+#endif
+
+typedef struct handler_cb_data_s {
+   SV *perl_cb;
+} handler_cb_data;
+
+#define NETSNMP_NAMEBUF_LEN 128
+typedef struct netsnmp_oid_s {
+    unsigned int        *name;
+    unsigned int         len;
+    unsigned int         namebuf[ NETSNMP_NAMEBUF_LEN ];
+} netsnmp_oid;
+
+static int have_done_agent = 0;
+static int have_done_lib = 0;
+
+static int
+not_here(char *s)
+{
+    croak("%s not implemented on this architecture", s);
+    return -1;
+}
+
+static double
+constant_MODE_G(char *name, int len, int arg)
+{
+    if (6 + 2 > len ) {
+	errno = EINVAL;
+	return 0;
+    }
+    switch (name[6 + 2]) {
+    case '\0':
+	if (strEQ(name + 6, "ET")) {	/* MODE_G removed */
+#ifdef MODE_GET
+	    return MODE_GET;
+#else
+	    goto not_there;
+#endif
+	}
+    case 'B':
+	if (strEQ(name + 6, "ETBULK")) {	/* MODE_G removed */
+#ifdef MODE_GETBULK
+	    return MODE_GETBULK;
+#else
+	    goto not_there;
+#endif
+	}
+    case 'N':
+	if (strEQ(name + 6, "ETNEXT")) {	/* MODE_G removed */
+#ifdef MODE_GETNEXT
+	    return MODE_GETNEXT;
+#else
+	    goto not_there;
+#endif
+	}
+    }
+    errno = EINVAL;
+    return 0;
+
+not_there:
+    errno = ENOENT;
+    return 0;
+}
+
+static double
+constant_MODE_SET_R(char *name, int len, int arg)
+{
+    if (10 + 6 >= len ) {
+	errno = EINVAL;
+	return 0;
+    }
+    switch (name[10 + 6]) {
+    case '1':
+	if (strEQ(name + 10, "ESERVE1")) {	/* MODE_SET_R removed */
+#ifdef MODE_SET_RESERVE1
+	    return MODE_SET_RESERVE1;
+#else
+	    goto not_there;
+#endif
+	}
+    case '2':
+	if (strEQ(name + 10, "ESERVE2")) {	/* MODE_SET_R removed */
+#ifdef MODE_SET_RESERVE2
+	    return MODE_SET_RESERVE2;
+#else
+	    goto not_there;
+#endif
+	}
+    }
+    errno = EINVAL;
+    return 0;
+
+not_there:
+    errno = ENOENT;
+    return 0;
+}
+
+static double
+constant_MODE_S(char *name, int len, int arg)
+{
+    if (6 + 3 >= len ) {
+	errno = EINVAL;
+	return 0;
+    }
+    switch (name[6 + 3]) {
+    case 'A':
+	if (strEQ(name + 6, "ET_ACTION")) {	/* MODE_S removed */
+#ifdef MODE_SET_ACTION
+	    return MODE_SET_ACTION;
+#else
+	    goto not_there;
+#endif
+	}
+    case 'B':
+	if (strEQ(name + 6, "ET_BEGIN")) {	/* MODE_S removed */
+#ifdef MODE_SET_BEGIN
+	    return MODE_SET_BEGIN;
+#else
+	    goto not_there;
+#endif
+	}
+    case 'C':
+	if (strEQ(name + 6, "ET_COMMIT")) {	/* MODE_S removed */
+#ifdef MODE_SET_COMMIT
+	    return MODE_SET_COMMIT;
+#else
+	    goto not_there;
+#endif
+	}
+    case 'F':
+	if (strEQ(name + 6, "ET_FREE")) {	/* MODE_S removed */
+#ifdef MODE_SET_FREE
+	    return MODE_SET_FREE;
+#else
+	    goto not_there;
+#endif
+	}
+    case 'R':
+	if (!strnEQ(name + 6,"ET_", 3))
+	    break;
+	return constant_MODE_SET_R(name, len, arg);
+    case 'U':
+	if (strEQ(name + 6, "ET_UNDO")) {	/* MODE_S removed */
+#ifdef MODE_SET_UNDO
+	    return MODE_SET_UNDO;
+#else
+	    goto not_there;
+#endif
+	}
+    }
+    errno = EINVAL;
+    return 0;
+
+not_there:
+    errno = ENOENT;
+    return 0;
+}
+
+static double
+constant(char *name, int len, int arg)
+{
+    errno = 0;
+    if (0 + 5 >= len ) {
+	errno = EINVAL;
+	return 0;
+    }
+    switch (name[0 + 5]) {
+    case 'G':
+	if (!strnEQ(name + 0,"MODE_", 5))
+	    break;
+	return constant_MODE_G(name, len, arg);
+    case 'S':
+	if (!strnEQ(name + 0,"MODE_", 5))
+	    break;
+	return constant_MODE_S(name, len, arg);
+    }
+    errno = EINVAL;
+    return 0;
+
+not_there:
+    errno = ENOENT;
+    return 0;
+}
+
+int
+handler_wrapper(netsnmp_mib_handler          *handler,
+                netsnmp_handler_registration *reginfo,
+                netsnmp_agent_request_info   *reqinfo,
+                netsnmp_request_info         *requests) 
+{
+    u_long intret = 5;
+    handler_cb_data *cb_data = (handler_cb_data *) handler->myvoid;
+    SV *cb;
+
+    if (cb_data && (cb = cb_data->perl_cb)) {
+        SV *arg;
+        SV *rarg;
+        dSP;
+        ENTER;
+        SAVETMPS;
+        PUSHMARK(sp);
+        rarg = newSViv(0);
+        arg = newSVrv(rarg, "NetSNMP::agent::netsnmp_mib_handler");
+        sv_setiv(arg, (int) handler);
+        XPUSHs(rarg);
+        rarg = newSViv(0);
+        arg = newSVrv(rarg, "NetSNMP::agent::reginfo");
+        sv_setiv(arg, (int) reginfo);
+        XPUSHs(rarg);
+        rarg = newSViv(0);
+        arg = newSVrv(rarg, "NetSNMP::agent::netsnmp_agent_request_info");
+        sv_setiv(arg, (int) reqinfo);
+        XPUSHs(rarg);
+        rarg = newSViv(0);
+        arg = newSVrv(rarg, "NetSNMP::agent::netsnmp_request_infoPtr");
+        sv_setiv(arg, (int) requests);
+        XPUSHs(rarg);
+        PUTBACK;
+        if (SvTYPE(cb) == SVt_PVCV) {
+            perl_call_sv(cb, G_DISCARD); /* I have no idea what discard does */
+                                         /* XXX: it discards the results,
+                                            which isn't right */
+        } else if (SvROK(cb) && SvTYPE(SvRV(cb)) == SVt_PVCV) {
+            /* reference to code */
+            perl_call_sv(SvRV(cb), G_DISCARD);
+        }
+        SPAGAIN;
+        PUTBACK;
+        FREETMPS;
+        LEAVE;
+    }
+    return SNMP_ERR_NOERROR;
+}
+
+MODULE = NetSNMP::agent		PACKAGE = NetSNMP::agent		
+
+double
+constant(sv,arg)
+    PREINIT:
+	STRLEN		len;
+    INPUT:
+	SV *		sv
+	char *		s = SvPV(sv, len);
+	int		arg
+    CODE:
+	RETVAL = constant(s,len,arg);
+    OUTPUT:
+	RETVAL
+
+int
+__agent_check_and_process(block = 1)
+	int block;
+    CODE:
+	RETVAL = agent_check_and_process(block);
+    OUTPUT:
+	RETVAL
+
+void
+init_mib()
+
+int
+init_agent(name)
+        const char *name;
+
+void
+init_snmp(name)
+        const char *name;
+
+int
+init_master_agent()
+
+void    
+snmp_enable_stderrlog()    
+
+MODULE = NetSNMP::agent  PACKAGE = NetSNMP::agent PREFIX = na_
+
+void
+na_shutdown(me)
+    SV *me;
+    CODE:
+    {
+        snmp_shutdown("perl");
+    }
+
+MODULE = NetSNMP::agent  PACKAGE = NetSNMP::agent::netsnmp_handler_registration  PREFIX = nsahr_
+
+netsnmp_handler_registration *
+nsahr_new(name, regoid, perlcallback)
+        char *name;
+	char *regoid;
+        SV   *perlcallback;
+    PREINIT:
+	oid myoid[MAX_OID_LEN];
+	size_t myoid_len = MAX_OID_LEN;
+        handler_cb_data *cb_data;
+        int gotit=1;
+    CODE:
+	if (!snmp_parse_oid(regoid, myoid, &myoid_len)) {
+            if (!read_objid(regoid, myoid, &myoid_len)) {
+                fprintf(stderr, "couldn't parse %s (reg name: %s)\n",
+                        regoid, name);
+                RETVAL = NULL;
+                gotit = 0;
+            }
+        }
+        if (gotit) {
+            cb_data = (handler_cb_data *) malloc(sizeof(handler_cb_data));
+            RETVAL = netsnmp_create_handler_registration(name, handler_wrapper,
+                                                 myoid, myoid_len,
+                                                 HANDLER_CAN_RWRITE);
+            cb_data->perl_cb = newSVsv(perlcallback);
+            RETVAL->handler->myvoid = cb_data;
+        }
+    OUTPUT:
+        RETVAL
+
+MODULE = NetSNMP::agent  PACKAGE = netsnmp_handler_registrationPtr  PREFIX = nsahr_
+
+void
+nsahr_DESTROY(reginfo)
+	netsnmp_handler_registration *reginfo
+    CODE:
+	netsnmp_handler_registration_free(reginfo);
+
+int
+nsahr_register(me)
+        SV *me;
+        PREINIT:
+        netsnmp_handler_registration *reginfo;
+        CODE:
+            {
+                reginfo = (netsnmp_handler_registration *) SvIV(SvRV(me));
+                RETVAL = netsnmp_register_handler(reginfo);
+                if (!RETVAL) {
+                    /* the agent now has a "reference" to this reg pointer */
+                    SvREFCNT_inc(me);
+                }
+            }
+    OUTPUT:
+	RETVAL
+
+void
+nsahr_getRootOID(me)
+    SV *me;
+    PREINIT:
+        int i;
+        netsnmp_oid *o;
+        netsnmp_handler_registration *reginfo;
+        SV *optr, *arg, *rarg;
+    PPCODE:
+    {
+        dSP;
+        PUSHMARK(SP);
+        reginfo = (netsnmp_handler_registration *) SvIV(SvRV(me));
+
+        o = SNMP_MALLOC_TYPEDEF(netsnmp_oid);
+        o->name = o->namebuf;
+        o->len = reginfo->rootoid_len;
+        memcpy(o->name, reginfo->rootoid,
+               reginfo->rootoid_len * sizeof(oid));
+
+        rarg = newSViv((int) 0);
+        arg = newSVrv(rarg, "netsnmp_oidPtr");
+        sv_setiv(arg, (int) o);
+
+        XPUSHs(rarg);
+
+        PUTBACK;
+        i = perl_call_pv("NetSNMP::OID::newwithptr", G_SCALAR);
+        SPAGAIN;
+        if (i != 1) {
+            fprintf(stderr, "unhandled OID error.\n");
+            /* ack XXX */
+        }
+        ST(0) = POPs;
+        XSRETURN(1);
+    }
+
+MODULE = NetSNMP::agent  PACKAGE = NetSNMP::agent::netsnmp_request_infoPtr PREFIX = nari_
+
+void
+getOID(me)
+    SV *me;
+    PREINIT:
+        int i;
+        netsnmp_oid *o;
+        netsnmp_request_info *request;
+        SV *optr, *arg, *rarg;
+    PPCODE:
+    {
+        dSP;
+        PUSHMARK(SP);
+        request = (netsnmp_request_info *) SvIV(SvRV(me));
+
+        o = SNMP_MALLOC_TYPEDEF(netsnmp_oid);
+        o->name = o->namebuf;
+        o->len = request->requestvb->name_length;
+        memcpy(o->name, request->requestvb->name,
+               request->requestvb->name_length * sizeof(oid));
+
+        rarg = newSViv((int) 0);
+        arg = newSVrv(rarg, "netsnmp_oidPtr");
+        sv_setiv(arg, (int) o);
+
+        XPUSHs(rarg);
+
+        PUTBACK;
+        i = perl_call_pv("NetSNMP::OID::newwithptr", G_SCALAR);
+        SPAGAIN;
+        if (i != 1) {
+            fprintf(stderr, "unhandled OID error.\n");
+            /* ack XXX */
+        }
+        ST(0) = POPs;
+        XSRETURN(1);
+    }
+        
+netsnmp_oid *
+nari_getOIDptr(me)
+        SV *me;
+        PREINIT:
+        netsnmp_request_info *request;
+        CODE:
+        request = (netsnmp_request_info *) SvIV(SvRV(me));
+        RETVAL = SNMP_MALLOC_TYPEDEF(netsnmp_oid);
+        RETVAL->name = RETVAL->namebuf;
+        RETVAL->len = request->requestvb->name_length;
+        memcpy(RETVAL->name, request->requestvb->name,
+               request->requestvb->name_length * sizeof(oid));
+    OUTPUT:
+        RETVAL
+
+char *
+nari_getValue(me)
+        SV *me;
+    PREINIT:
+        u_char *oidbuf = NULL;
+        size_t ob_len = 0, oo_len = 0;
+        netsnmp_request_info *request;
+    CODE:
+        request = (netsnmp_request_info *) SvIV(SvRV(me));
+	sprint_realloc_by_type(&oidbuf, &ob_len, &oo_len, 1,
+                               request->requestvb, 0, 0, 0);
+        RETVAL = oidbuf; /* mem leak */
+    OUTPUT:
+        RETVAL
+
+int
+nari_getDelegated(me)
+        SV *me;
+    PREINIT:
+        netsnmp_request_info *request;
+    CODE:
+        request = (netsnmp_request_info *) SvIV(SvRV(me));
+        RETVAL = request->delegated;
+    OUTPUT:
+        RETVAL
+
+void
+nari_setDelegated(me, newdelegated)
+        SV *me;
+        int newdelegated;
+    PREINIT:
+        netsnmp_request_info *request;
+    CODE:
+        request = (netsnmp_request_info *) SvIV(SvRV(me));
+        request->delegated = newdelegated;
+
+int
+nari_getProcessed(me)
+        SV *me;
+    PREINIT:
+        netsnmp_request_info *request;
+    CODE:
+        request = (netsnmp_request_info *) SvIV(SvRV(me));
+        RETVAL = request->processed;
+    OUTPUT:
+        RETVAL
+
+void
+nari_setProcessed(me, newprocessed)
+        SV *me;
+        int newprocessed;
+    PREINIT:
+        netsnmp_request_info *request;
+    CODE:
+        request = (netsnmp_request_info *) SvIV(SvRV(me));
+        request->processed = newprocessed;
+
+int
+nari_getStatus(me)
+        SV *me;
+    PREINIT:
+        netsnmp_request_info *request;
+    CODE:
+        request = (netsnmp_request_info *) SvIV(SvRV(me));
+        RETVAL = request->status;
+    OUTPUT:
+        RETVAL
+
+void
+nari_setStatus(me, newstatus)
+        SV *me;
+        int newstatus;
+    PREINIT:
+        netsnmp_request_info *request;
+    CODE:
+        request = (netsnmp_request_info *) SvIV(SvRV(me));
+        request->status = newstatus;
+
+int
+nari_getRepeat(me)
+        SV *me;
+    PREINIT:
+        netsnmp_request_info *request;
+    CODE:
+        request = (netsnmp_request_info *) SvIV(SvRV(me));
+        RETVAL = request->repeat;
+    OUTPUT:
+        RETVAL
+
+void
+nari_setRepeat(me, newrepeat)
+        SV *me;
+        int newrepeat;
+    PREINIT:
+        netsnmp_request_info *request;
+    CODE:
+        request = (netsnmp_request_info *) SvIV(SvRV(me));
+        request->repeat = newrepeat;
+
+int
+nari_setValue(me, type, value)
+        SV *me;
+        int type;
+        SV *value;
+    PREINIT:
+        u_char *oidbuf = NULL;
+        size_t ob_len = 0, oo_len = 0;
+        netsnmp_request_info *request;
+        u_long utmp;
+        long ltmp;
+	oid myoid[MAX_OID_LEN];
+	size_t myoid_len;
+        STRLEN stringlen;
+        char * stringptr;
+    CODE:
+        request = (netsnmp_request_info *) SvIV(SvRV(me));
+        switch(type) {
+          case ASN_INTEGER:
+	      /* We want an integer here */
+	      if ((SvTYPE(value) == SVt_IV) || (SvTYPE(value) == SVt_PVMG)) {
+		  /* Good - got a real one (or a blessed object that we hope will turn out OK) */
+		  ltmp = SvIV(value);
+		  snmp_set_var_typed_value(request->requestvb, type,
+					   (u_char *) &ltmp, sizeof(ltmp));
+		  RETVAL = 1;
+		  break;
+	      }
+	      else if (SvPOKp(value)) {
+	          /* Might be OK - got a string, so try to convert it, allowing base 10, octal, and hex forms */
+	          stringptr = SvPV(value, stringlen);
+		  ltmp = strtol( stringptr, NULL, 0 );
+		  if (errno == EINVAL) {
+		  	fprintf(stderr, "Could not convert string to number in setValue: '%s'", stringptr);
+			RETVAL = 0;
+			break;
+		  }
+
+		  snmp_set_var_typed_value(request->requestvb, type,
+					   (u_char *) &ltmp, sizeof(ltmp));
+		  RETVAL = 1;
+		  break;
+	      }
+	      else {
+		fprintf(stderr, "Non-integer value passed to setValue with ASN_INTEGER: type was %d\n",
+			SvTYPE(value));
+		RETVAL = 0;
+		break;
+	      }
+
+
+          case ASN_UNSIGNED:
+          case ASN_COUNTER:
+          case ASN_COUNTER64:
+          case ASN_TIMETICKS:
+	      /* We want an integer here */
+	      if ((SvTYPE(value) == SVt_IV) || (SvTYPE(value) == SVt_PVMG)) {
+		  /* Good - got a real one (or a blessed scalar which we have to hope will turn out OK) */
+		  utmp = SvIV(value);
+                  snmp_set_var_typed_value(request->requestvb, type,
+                                       (u_char *) &utmp, sizeof(utmp));
+		  RETVAL = 1;
+		  break;
+	      }
+	      else if (SvPOKp(value)) {
+	          /* Might be OK - got a string, so try to convert it, allowing base 10, octal, and hex forms */
+	          stringptr = SvPV(value, stringlen);
+		  utmp = strtoul( stringptr, NULL, 0 );
+		  if (errno == EINVAL) {
+		  	fprintf(stderr, "Could not convert string to number in setValue: '%s'", stringptr);
+			RETVAL = 0;
+			break;
+		  }
+
+                  snmp_set_var_typed_value(request->requestvb, type,
+                                       (u_char *) &utmp, sizeof(utmp));
+		  RETVAL = 1;
+		  break;
+	      }
+	      else {
+		fprintf(stderr, "Non-unsigned-integer value passed to setValue with ASN_UNSIGNED/ASN_COUNTER/ASN_TIMETICKS: type was %d\n",
+			SvTYPE(value));
+		RETVAL = 0;
+		break;
+	      }
+
+          case ASN_OCTET_STR:
+          case ASN_BIT_STR:
+	      /* Check that we have been passed something with a string value (or a blessed scalar) */
+	      if (!SvPOKp(value) && (SvTYPE(value) != SVt_PVMG)) {
+		fprintf(stderr, "Non-string value passed to setValue with ASN_OCTET_STR/ASN_BIT_STR: type was %d\n",
+			SvTYPE(value));
+		RETVAL = 0;
+		break;
+	      }
+
+	      /* Find length of string (strlen will *not* do, as these are binary strings) */
+	      stringptr = SvPV(value, stringlen);
+
+              snmp_set_var_typed_value(request->requestvb, type,
+                                       (u_char *) stringptr,
+                                       stringlen);
+              RETVAL = 1;
+              break;
+
+          case ASN_IPADDRESS:
+	      /* IP addresses are passed as *binary* strings.
+	       * In the case of IPv4 addresses, these are 4 bytes long.
+	       * NOTE: the use of binary strings rather than dotted-quad or FQDNs was
+	       * introduced here by Andrew Findlay's patch of March 17th 2003,
+	       * and is effectively a change to the previous implied API which assumed
+	       * the value was a (valid) hostname.
+	       * Responsibility for decoding and resolving has been passed up to the Perl script.
+	       */
+
+	      /* Check that we have been passed something with a string value (or a blessed scalar) */
+	      if (!SvPOKp(value) && (SvTYPE(value) != SVt_PVMG)) {
+		fprintf(stderr, "Non-string value passed to setValue with ASN_IPADDRESS: type was %d\n",
+			SvTYPE(value));
+		RETVAL = 0;
+		break;
+	      }
+
+	      /* Find length of string (strlen will *not* do, as these are binary strings) */
+	      stringptr = SvPV(value, stringlen);
+
+	      # fprintf(stderr, "IP address returned with length %d: %u.%u.%u.%u\n", stringlen, stringptr[0],
+	      #     stringptr[1], stringptr[2], stringptr[3] );
+
+	      # Sanity check on address length
+	      if ((stringlen != 4) && (stringlen != 16)) {
+	      		fprintf(stderr, "IP address of %d bytes passed to setValue with ASN_IPADDRESS\n", stringlen);
+			RETVAL = 0;
+			break;
+	      }
+
+              snmp_set_var_typed_value(request->requestvb, type,
+                                   stringptr, stringlen);
+              RETVAL = 1;
+              break;
+
+          case ASN_OBJECT_ID:
+	      /* Check that we have been passed something with a string value (or a blessed scalar) */
+	      if (!SvPOKp(value) && (SvTYPE(value) != SVt_PVMG)) {
+		fprintf(stderr, "Non-string value passed to setValue with ASN_OBJECT_ID: type was %d\n",
+			SvTYPE(value));
+		RETVAL = 0;
+		break;
+	      }
+
+	      /* Extract the string */
+	      stringptr = SvPV(value, stringlen);
+
+	      /* fprintf(stderr, "setValue returning OID '%s'\n", stringptr); */
+
+	      myoid_len = MAX_OID_LEN;
+              if (!snmp_parse_oid(stringptr, myoid, &myoid_len)) {
+                  fprintf(stderr, "couldn't parse %s in setValue\n", stringptr);
+		  RETVAL = 0;
+		  break;
+              } else {
+		  /* fprintf(stderr, "setValue returning OID length %d\n", myoid_len); */
+
+                  request = (netsnmp_request_info *) SvIV(SvRV(me));
+                  snmp_set_var_typed_value(request->requestvb, type,
+                                           (u_char *) myoid, (myoid_len * sizeof(myoid[0])) );
+              }
+
+              RETVAL = 1;
+              break;
+              
+            default:
+                fprintf(stderr, "unknown var value type: %d\n",
+                        type);
+                RETVAL = 0;
+                break;
+        }
+
+    OUTPUT:
+        RETVAL
+        
+void
+nari_setOID(me, value)
+        SV *me;
+        char *value;
+    PREINIT:
+	oid myoid[MAX_OID_LEN];
+	size_t myoid_len = MAX_OID_LEN;
+        netsnmp_request_info *request;
+    CODE:
+	myoid_len = MAX_OID_LEN;
+	if (!snmp_parse_oid(value, myoid, &myoid_len)) {
+            fprintf(stderr, "couldn't parse %s in setOID\n", value);
+        } else {
+            request = (netsnmp_request_info *) SvIV(SvRV(me));
+            snmp_set_var_objid(request->requestvb, myoid, myoid_len);
+        }
+
+
+SV *
+nari_next(me)
+        SV *me;
+    PREINIT:
+        netsnmp_request_info *request;
+        SV *arg, *rarg;
+    CODE:
+        {
+            request = (netsnmp_request_info *) SvIV(SvRV(me));
+            if (request && request->next) {
+                request = request->next;
+                rarg = newSViv(0);
+                arg = newSVrv(rarg, "NetSNMP::agent::netsnmp_request_infoPtr");
+                sv_setiv(arg, (int) request);
+                ST(0) = rarg;
+            } else {
+                ST(0) = &sv_undef;
+            }
+        }
+
+MODULE = NetSNMP::agent  PACKAGE = NetSNMP::agent::netsnmp_agent_request_info PREFIX = narqi_
+
+int
+narqi_getMode(me)
+        SV *me;
+    PREINIT:
+        netsnmp_agent_request_info *reqinfo;
+    CODE:
+        reqinfo = (netsnmp_agent_request_info *) SvIV(SvRV(me));
+        RETVAL = reqinfo->mode;
+    OUTPUT:
+        RETVAL
+
+void
+narqi_setMode(me, newvalue)
+        SV *me;
+        int newvalue;
+    PREINIT:
+        netsnmp_agent_request_info *reqinfo;
+    CODE:
+        reqinfo = (netsnmp_agent_request_info *) SvIV(SvRV(me));
+        reqinfo->mode = newvalue;
+        
+
+MODULE = NetSNMP::agent		PACKAGE = NetSNMP::agent		
diff -Naur tomato/release/src/router/snmp/perl/agent/Changes tomato121/release/src/router/snmp/perl/agent/Changes
--- tomato/release/src/router/snmp/perl/agent/Changes	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/perl/agent/Changes	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,6 @@
+Revision history for Perl extension NetSNMP::agent.
+
+0.01  Thu Dec 27 22:24:58 2001
+	- original version; created by h2xs 1.20 with options
+		-x -O -n NetSNMP::agent ./stuff/perl_agent.h
+
diff -Naur tomato/release/src/router/snmp/perl/agent/.cvsignore tomato121/release/src/router/snmp/perl/agent/.cvsignore
--- tomato/release/src/router/snmp/perl/agent/.cvsignore	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/perl/agent/.cvsignore	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,5 @@
+Makefile
+agent.bs
+agent.c
+blib
+pm_to_blib
diff -Naur tomato/release/src/router/snmp/perl/agent/default_store/.cvsignore tomato121/release/src/router/snmp/perl/agent/default_store/.cvsignore
--- tomato/release/src/router/snmp/perl/agent/default_store/.cvsignore	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/perl/agent/default_store/.cvsignore	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,4 @@
+Makefile
+default_store.bs
+default_store.c
+pm_to_blib
diff -Naur tomato/release/src/router/snmp/perl/agent/default_store/default_store.pm tomato121/release/src/router/snmp/perl/agent/default_store/default_store.pm
--- tomato/release/src/router/snmp/perl/agent/default_store/default_store.pm	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/perl/agent/default_store/default_store.pm	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,164 @@
+package NetSNMP::agent::default_store;
+
+use strict;
+use Carp;
+
+require Exporter;
+require DynaLoader;
+use AutoLoader;
+
+use vars qw(@ISA %EXPORT_TAGS @EXPORT_OK @EXPORT $VERSION $AUTOLOAD);
+
+@ISA = qw(Exporter DynaLoader);
+
+# Items to export into callers namespace by default. Note: do not export
+# names by default without a very good reason. Use EXPORT_OK instead.
+# Do not simply export all your public functions/methods/constants.
+
+# This allows declaration	use NetSNMP::agent::default_store ':all';
+# If you do not need this, moving things directly into @EXPORT or @EXPORT_OK
+# will save memory.
+%EXPORT_TAGS = ( 'all' => [ qw(
+				   NETSNMP_DS_AGENT_VERBOSE
+				   NETSNMP_DS_AGENT_ROLE
+				   NETSNMP_DS_AGENT_NO_ROOT_ACCESS
+				   NETSNMP_DS_AGENT_AGENTX_MASTER
+				   NETSNMP_DS_AGENT_QUIT_IMMEDIATELY
+				   NETSNMP_DS_AGENT_DISABLE_PERL
+				   NETSNMP_DS_AGENT_PROGNAME
+				   NETSNMP_DS_AGENT_X_SOCKET
+				   NETSNMP_DS_AGENT_PORTS
+				   NETSNMP_DS_AGENT_INTERNAL_SECNAME
+				   NETSNMP_DS_AGENT_PERL_INIT_FILE
+				   NETSNMP_DS_AGENT_FLAGS
+				   NETSNMP_DS_AGENT_USERID
+				   NETSNMP_DS_AGENT_GROUPID
+				   NETSNMP_DS_AGENT_AGENTX_PING_INTERVAL
+) ] );
+
+@EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } );
+
+@EXPORT = qw(
+				   NETSNMP_DS_AGENT_VERBOSE
+				   NETSNMP_DS_AGENT_ROLE
+				   NETSNMP_DS_AGENT_NO_ROOT_ACCESS
+				   NETSNMP_DS_AGENT_AGENTX_MASTER
+				   NETSNMP_DS_AGENT_QUIT_IMMEDIATELY
+				   NETSNMP_DS_AGENT_DISABLE_PERL
+				   NETSNMP_DS_AGENT_PROGNAME
+				   NETSNMP_DS_AGENT_X_SOCKET
+				   NETSNMP_DS_AGENT_PORTS
+				   NETSNMP_DS_AGENT_INTERNAL_SECNAME
+				   NETSNMP_DS_AGENT_PERL_INIT_FILE
+				   NETSNMP_DS_AGENT_FLAGS
+				   NETSNMP_DS_AGENT_USERID
+				   NETSNMP_DS_AGENT_GROUPID
+				   NETSNMP_DS_AGENT_AGENTX_PING_INTERVAL
+);
+$VERSION = '0.01';
+
+sub AUTOLOAD {
+    # This AUTOLOAD is used to 'autoload' constants from the constant()
+    # XS function.  If a constant is not found then control is passed
+    # to the AUTOLOAD in AutoLoader.
+
+    my $constname;
+    ($constname = $AUTOLOAD) =~ s/.*:://;
+    croak "& not defined" if $constname eq 'constant';
+    my $val = constant($constname, @_ ? $_[0] : 0);
+    if ($! != 0) {
+	if ($! =~ /Invalid/ || $!{EINVAL}) {
+	    $AutoLoader::AUTOLOAD = $AUTOLOAD;
+	    goto &AutoLoader::AUTOLOAD;
+	}
+	else {
+	    croak "Your vendor has not defined NetSNMP::agent::default_store macro $constname";
+	}
+    }
+    {
+	no strict 'refs';
+	# Fixed between 5.005_53 and 5.005_61
+# 	if ($] >= 5.00561) {
+# 	    *$AUTOLOAD = sub () { $val };
+# 	}
+# 	else {
+	    *$AUTOLOAD = sub { $val };
+# 	}
+    }
+    goto &$AUTOLOAD;
+}
+
+bootstrap NetSNMP::agent::default_store $VERSION;
+
+# Preloaded methods go here.
+
+# Autoload methods go after =cut, and are processed by the autosplit program.
+
+1;
+__END__
+# Below is stub documentation for your module. You better edit it!
+
+=head1 NAME
+
+NetSNMP::agent::default_store - Perl extension for blah blah blah
+
+=head1 SYNOPSIS
+
+  use NetSNMP::agent::default_store;
+  blah blah blah
+
+=head1 DESCRIPTION
+
+Stub documentation for NetSNMP::agent::default_store, created by h2xs. It looks like the
+author of the extension was negligent enough to leave the stub
+unedited.
+
+Blah blah blah.
+
+=head2 EXPORT
+
+None by default.
+
+=head2 Exportable constants
+
+				   NETSNMP_DS_AGENT_VERBOSE
+				   NETSNMP_DS_AGENT_ROLE
+				   NETSNMP_DS_AGENT_NO_ROOT_ACCESS
+				   NETSNMP_DS_AGENT_AGENTX_MASTER
+				   NETSNMP_DS_AGENT_QUIT_IMMEDIATELY
+				   NETSNMP_DS_AGENT_DISABLE_PERL
+				   NETSNMP_DS_AGENT_PROGNAME
+				   NETSNMP_DS_AGENT_X_SOCKET
+				   NETSNMP_DS_AGENT_PORTS
+				   NETSNMP_DS_AGENT_INTERNAL_SECNAME
+				   NETSNMP_DS_AGENT_PERL_INIT_FILE
+				   NETSNMP_DS_AGENT_FLAGS
+				   NETSNMP_DS_AGENT_USERID
+				   NETSNMP_DS_AGENT_GROUPID
+				   NETSNMP_DS_AGENT_AGENTX_PING_INTERVAL
+
+
+  DS_AGENT_AGENTX_MASTER
+  DS_AGENT_AGENTX_PING_INTERVAL
+  DS_AGENT_FLAGS
+  DS_AGENT_GROUPID
+  DS_AGENT_H
+  DS_AGENT_INTERNAL_SECNAME
+  DS_AGENT_NO_ROOT_ACCESS
+  DS_AGENT_PORTS
+  DS_AGENT_PROGNAME
+  DS_AGENT_ROLE
+  DS_AGENT_USERID
+  DS_AGENT_VERBOSE
+  DS_AGENT_X_SOCKET
+
+
+=head1 AUTHOR
+
+A. U. Thor, a.u.thor@a.galaxy.far.far.away
+
+=head1 SEE ALSO
+
+perl(1).
+
+=cut
diff -Naur tomato/release/src/router/snmp/perl/agent/default_store/default_store.xs tomato121/release/src/router/snmp/perl/agent/default_store/default_store.xs
--- tomato/release/src/router/snmp/perl/agent/default_store/default_store.xs	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/perl/agent/default_store/default_store.xs	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,214 @@
+#include "EXTERN.h"
+#include "perl.h"
+#include "XSUB.h"
+
+#include <net-snmp/agent/ds_agent.h>
+
+static int
+not_here(char *s)
+{
+    croak("%s not implemented on this architecture", s);
+    return -1;
+}
+
+static double
+constant_NETSNMP_DS_AGENT_P(char *name, int len, int arg)
+{
+    switch (name[18 + 0]) {
+    case 'E':
+	if (strEQ(name + 18, "ERL_INIT_FILE")) {	/* NETSNMP_DS_AGENT_P removed */
+#ifdef NETSNMP_DS_AGENT_PERL_INIT_FILE
+	    return NETSNMP_DS_AGENT_PERL_INIT_FILE;
+#else
+	    goto not_there;
+#endif
+	}
+    case 'O':
+	if (strEQ(name + 18, "ORTS")) {	/* NETSNMP_DS_AGENT_P removed */
+#ifdef NETSNMP_DS_AGENT_PORTS
+	    return NETSNMP_DS_AGENT_PORTS;
+#else
+	    goto not_there;
+#endif
+	}
+    case 'R':
+	if (strEQ(name + 18, "ROGNAME")) {	/* NETSNMP_DS_AGENT_P removed */
+#ifdef NETSNMP_DS_AGENT_PROGNAME
+	    return NETSNMP_DS_AGENT_PROGNAME;
+#else
+	    goto not_there;
+#endif
+	}
+    }
+    errno = EINVAL;
+    return 0;
+
+not_there:
+    errno = ENOENT;
+    return 0;
+}
+
+static double
+constant_NETSNMP_DS_AGENT_A(char *name, int len, int arg)
+{
+    if (18 + 6 >= len ) {
+	errno = EINVAL;
+	return 0;
+    }
+    switch (name[18 + 6]) {
+    case 'M':
+	if (strEQ(name + 18, "GENTX_MASTER")) {	/* NETSNMP_DS_AGENT_A removed */
+#ifdef NETSNMP_DS_AGENT_AGENTX_MASTER
+	    return NETSNMP_DS_AGENT_AGENTX_MASTER;
+#else
+	    goto not_there;
+#endif
+	}
+    case 'P':
+	if (strEQ(name + 18, "GENTX_PING_INTERVAL")) {	/* NETSNMP_DS_AGENT_A removed */
+#ifdef NETSNMP_DS_AGENT_AGENTX_PING_INTERVAL
+	    return NETSNMP_DS_AGENT_AGENTX_PING_INTERVAL;
+#else
+	    goto not_there;
+#endif
+	}
+    }
+    errno = EINVAL;
+    return 0;
+
+not_there:
+    errno = ENOENT;
+    return 0;
+}
+
+static double
+constant(char *name, int len, int arg)
+{
+    errno = 0;
+    if (0 + 17 >= len ) {
+	errno = EINVAL;
+	return 0;
+    }
+    switch (name[0 + 17]) {
+    case 'A':
+	if (!strnEQ(name + 0,"NETSNMP_DS_AGENT_", 17))
+	    break;
+	return constant_NETSNMP_DS_AGENT_A(name, len, arg);
+    case 'D':
+	if (strEQ(name + 0, "NETSNMP_DS_AGENT_DISABLE_PERL")) {	/*  removed */
+#ifdef NETSNMP_DS_AGENT_DISABLE_PERL
+	    return NETSNMP_DS_AGENT_DISABLE_PERL;
+#else
+	    goto not_there;
+#endif
+	}
+    case 'F':
+	if (strEQ(name + 0, "NETSNMP_DS_AGENT_FLAGS")) {	/*  removed */
+#ifdef NETSNMP_DS_AGENT_FLAGS
+	    return NETSNMP_DS_AGENT_FLAGS;
+#else
+	    goto not_there;
+#endif
+	}
+    case 'G':
+	if (strEQ(name + 0, "NETSNMP_DS_AGENT_GROUPID")) {	/*  removed */
+#ifdef NETSNMP_DS_AGENT_GROUPID
+	    return NETSNMP_DS_AGENT_GROUPID;
+#else
+	    goto not_there;
+#endif
+	}
+    case 'H':
+	if (strEQ(name + 0, "NETSNMP_DS_AGENT_H")) {	/*  removed */
+#ifdef NETSNMP_DS_AGENT_H
+	    return NETSNMP_DS_AGENT_H;
+#else
+	    goto not_there;
+#endif
+	}
+    case 'I':
+	if (strEQ(name + 0, "NETSNMP_DS_AGENT_INTERNAL_SECNAME")) {	/*  removed */
+#ifdef NETSNMP_DS_AGENT_INTERNAL_SECNAME
+	    return NETSNMP_DS_AGENT_INTERNAL_SECNAME;
+#else
+	    goto not_there;
+#endif
+	}
+    case 'N':
+	if (strEQ(name + 0, "NETSNMP_DS_AGENT_NO_ROOT_ACCESS")) {	/*  removed */
+#ifdef NETSNMP_DS_AGENT_NO_ROOT_ACCESS
+	    return NETSNMP_DS_AGENT_NO_ROOT_ACCESS;
+#else
+	    goto not_there;
+#endif
+	}
+    case 'P':
+	if (!strnEQ(name + 0,"NETSNMP_DS_AGENT_", 17))
+	    break;
+	return constant_NETSNMP_DS_AGENT_P(name, len, arg);
+    case 'Q':
+	if (strEQ(name + 0, "NETSNMP_DS_AGENT_QUIT_IMMEDIATELY")) {	/*  removed */
+#ifdef NETSNMP_DS_AGENT_QUIT_IMMEDIATELY
+	    return NETSNMP_DS_AGENT_QUIT_IMMEDIATELY;
+#else
+	    goto not_there;
+#endif
+	}
+    case 'R':
+	if (strEQ(name + 0, "NETSNMP_DS_AGENT_ROLE")) {	/*  removed */
+#ifdef NETSNMP_DS_AGENT_ROLE
+	    return NETSNMP_DS_AGENT_ROLE;
+#else
+	    goto not_there;
+#endif
+	}
+    case 'U':
+	if (strEQ(name + 0, "NETSNMP_DS_AGENT_USERID")) {	/*  removed */
+#ifdef NETSNMP_DS_AGENT_USERID
+	    return NETSNMP_DS_AGENT_USERID;
+#else
+	    goto not_there;
+#endif
+	}
+    case 'V':
+	if (strEQ(name + 0, "NETSNMP_DS_AGENT_VERBOSE")) {	/*  removed */
+#ifdef NETSNMP_DS_AGENT_VERBOSE
+	    return NETSNMP_DS_AGENT_VERBOSE;
+#else
+	    goto not_there;
+#endif
+	}
+    case 'X':
+	if (strEQ(name + 0, "NETSNMP_DS_AGENT_X_SOCKET")) {	/*  removed */
+#ifdef NETSNMP_DS_AGENT_X_SOCKET
+	    return NETSNMP_DS_AGENT_X_SOCKET;
+#else
+	    goto not_there;
+#endif
+	}
+    }
+    errno = EINVAL;
+    return 0;
+
+not_there:
+    errno = ENOENT;
+    return 0;
+}
+
+
+MODULE = NetSNMP::agent::default_store		PACKAGE = NetSNMP::agent::default_store		
+
+
+double
+constant(sv,arg)
+    PREINIT:
+	STRLEN		len;
+    INPUT:
+	SV *		sv
+	char *		s = SvPV(sv, len);
+	int		arg
+    CODE:
+	RETVAL = constant(s,len,arg);
+    OUTPUT:
+	RETVAL
+
diff -Naur tomato/release/src/router/snmp/perl/agent/default_store/gen tomato121/release/src/router/snmp/perl/agent/default_store/gen
--- tomato/release/src/router/snmp/perl/agent/default_store/gen	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/perl/agent/default_store/gen	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,116 @@
+#!/usr/bin/perl
+
+system("grep 'define NETSNMP_DS_' ../../../include/net-snmp/agent/ds_agent.h > ds_agent.h");
+system("h2xs -n NetSNMP::agent::default_store -O ds_agent.h");
+
+open(ORIG,"default_store.xs");
+open(NEW,"NetSNMP/agent/default_store/default_store.xs");
+open(OUT,">default_store_new.xs");
+
+# get up to the include from the original file
+while(<ORIG>) {
+    print OUT;
+    last if (/include <net-snmp\/agent\/ds_agent.h/);
+}
+
+# skip up to the include from the original file
+while(<NEW>) {
+    last if (/include <ds_agent.h>/);
+}
+
+# include the entire new file
+print OUT <NEW>;
+
+close(OUT);
+
+#
+# generate test
+#
+open(H,"ds_agent.h");
+open(ORIG,"test.pl");
+open(OUT,">test.pl.new");
+
+while(<ORIG>) {
+    print OUT;
+    last if (/\%tests =/);
+}
+
+while(<H>) {
+    if (/define\s+(\w+)\s+(\d+)/) {
+	printf OUT ("                  %-40s => %d,\n", "\"$1\"", $2);
+	$tokenlist .= "				   $1\n";
+    }
+}
+
+while(<ORIG>) {
+    last if (/\);/);
+}
+print OUT;
+print OUT <ORIG>;
+close(OUT);
+
+#
+# modify the perl module itself
+#
+open(ORIG,"default_store.pm");
+open(OUT,">default_store_new.pm");
+
+# first list
+while(<ORIG>) {
+    print OUT;
+    last if (/\%EXPORT_TAGS =/);
+}
+print OUT $tokenlist;
+while(<ORIG>) {
+    last if (/\) \] \);/);
+}
+print OUT;
+
+# second list
+while(<ORIG>) {
+    print OUT;
+    last if (/\@EXPORT =/);
+}
+print OUT $tokenlist;
+while(<ORIG>) {
+    last if (/\);/);
+}
+print OUT;
+
+# last section
+while(<ORIG>) {
+    print OUT;
+    last if (/head2 Exportable constants/);
+}
+print OUT "\n";
+print OUT $tokenlist;
+while(<ORIG>) {
+    last if (/^\s*$/);
+}
+print OUT;
+
+# tail end
+print OUT <ORIG>;
+close(OUT);
+
+#
+# install new files
+#
+print "updated test.pl\n";
+rename("test.pl","test.pl.bak");
+rename("test.pl.new","test.pl");
+
+print "updated default_store.pm\n";
+rename("default_store.pm", "default_store.pm.bak");
+rename("default_store_new.pm", "default_store.pm");
+
+print "updated default_store.xs\n";
+rename("default_store.xs", "default_store.xs.bak");
+rename("default_store_new.xs", "default_store.xs");
+
+#
+# remove the temp files.
+#
+system("rm -rf NetSNMP");
+unlink("ds_agent.h");
+
diff -Naur tomato/release/src/router/snmp/perl/agent/default_store/Makefile.PL tomato121/release/src/router/snmp/perl/agent/default_store/Makefile.PL
--- tomato/release/src/router/snmp/perl/agent/default_store/Makefile.PL	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/perl/agent/default_store/Makefile.PL	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,137 @@
+use ExtUtils::MakeMaker;
+require 5;
+use Config;
+use Getopt::Long;
+my %MakeParams = ();
+
+%MakeParams = InitMakeParams();
+
+WriteMakefile(%MakeParams);
+
+sub InitMakeParams {
+    my $opts;
+    my %Params = (
+		  'NAME'		=> 'NetSNMP::agent::default_store',
+		  'VERSION_FROM'	=> 'default_store.pm', # finds $VERSION
+		  'XSPROTOARG'          => '-prototypes',
+		  );
+
+    my $snmp_lib, $snmp_llib, $sep;
+    if ($Config{'osname'} eq 'MSWin32') {
+      $opts = NetSNMPGetOpts();	
+      $snmp_lib = 'libsnmp.lib';
+      $snmp_link_lib = 'libsnmp';
+      $sep = '\\';
+
+      $Params{'DEFINE'} = "-DMSVC_PERL";
+      
+      if ($opts->{'insource'}) {
+	$Params{'LIBS'} = "-L$basedir\\win32\\lib\\ -l$snmp_link_lib";
+      }
+      else {
+	my @LibDirs = split (';',$ENV{LIB});
+	if ($opts->{'prefix'}) {
+	  push (@LibDirs,"$ENV{'NET-SNMP-PATH'}${sep}lib");
+	}
+	$noLibDir = 1;
+	while ($noLibDir) {
+	  $LibDir = find_files(["$snmp_lib"],\@LibDirs);
+	  if ($LibDir ne '') {
+	    $noLibDir = 0;
+	  }
+	  else
+	  {
+	    @LibDirs = ();
+	    @LibDirs[0] = prompt("The Net-SNMP library ($snmp_lib) could not be found.\nPlease enter the directory where it is located:");
+	    @LibDirs[0] =~ s/\\$//;
+	  }
+	}
+	$Params{LIBS} = "-L$LibDir -l$snmp_link_lib";
+      }
+
+      $Params{'INC'} = "-I$basedir\\include\\ -I$basedir\\include\\net-snmp\\ -I$basedir\\win32\\ ";
+    }
+    else {
+	$opts = NetSNMPGetOpts("../../");
+	$Params{'LIBS'}    = `$opts->{'nsconfig'} --libs`;
+	chomp($Params{'LIBS'});
+	$Params{'CCFLAGS'} = `$opts->{'nsconfig'} --cflags`;
+	chomp($Params{'CCFLAGS'});
+	$Params{'CCFLAGS'} .= " " . $Config{'ccflags'};
+	if ($opts->{'insource'} eq "true") {
+	    $Params{'LIBS'} = "-L../../../snmplib/.libs -L../../../snmplib/ " . $Params{'LIBS'};
+	    $Params{'CCFLAGS'} = "-I../../../include " . $Params{'CCFLAGS'};
+	}
+	$Params{'CCFLAGS'} =~ s/ -W[-\w]+//g; # ignore developer warnings
+	if ($Params{'LIBS'} eq "" || $Params{'CCFLAGS'} eq "") {
+	    die "You need to install net-snmp first (I can't find net-snmp-config)";
+	}
+    }
+
+    return(%Params);
+}
+
+# common subroutines -- DO NOT EDIT.
+# They are imported from the Makefile.subs.pl file
+sub NetSNMPGetOpts {
+    my %ret;
+    my $rootpath = shift;
+    $rootpath = "../" if (!$rootpath);
+    $rootpath .= '/' if ($rootpath !~ /\/$/);
+    
+    if ($Config{'osname'} eq 'MSWin32') {
+      if ($ENV{'NET-SNMP-IN-SOURCE'})
+      {
+	$ret{'insource'} = $ENV{'NET-SNMP-IN-SOURCE'};
+      }
+      elsif ($ENV{'NET-SNMP-PATH'})
+      {
+	$ret{'prefix'} = $ENV{'NET-SNMP-PATH'};
+      }
+      else
+      {
+	# don't have env vars, pull from command line and put there
+	GetOptions("NET-SNMP-IN-SOURCE=s" => \$ret{'insource'},
+	           "NET-SNMP-PATH=s"      => \$ret{'prefix'});
+
+	$ENV{'NET-SNMP-IN-SOURCE'}    = $ret{'insource'};
+	$ENV{'NET-SNMP-PATH'}         = $ret{'prefix'};
+      }
+
+      $basedir = `%COMSPEC% /c cd`;
+      chomp $basedir;
+      $basedir =~ /(.*?)\\perl.*/;
+      $basedir = $1;
+      print "Net-SNMP base directory: $basedir\n";
+
+    }
+    else
+    {
+      if ($ENV{'NET-SNMP-CONFIG'} && 
+        $ENV{'NET-SNMP-IN-SOURCE'}) {
+	# have env vars, pull from there
+	$ret{'nsconfig'} = $ENV{'NET-SNMP-CONFIG'};
+	$ret{'insource'} = $ENV{'NET-SNMP-IN-SOURCE'};
+      } else {
+	# don't have env vars, pull from command line and put there
+	GetOptions("NET-SNMP-CONFIG=s" => \$ret{'nsconfig'},
+	           "NET-SNMP-IN-SOURCE=s" => \$ret{'insource'});
+
+	if ($ret{'insource'} eq "true" && $ret{'nsconfig'} eq "") {
+	    $ret{'nsconfig'}="sh ROOTPATH../net-snmp-config";
+	} elsif ($ret{'nsconfig'} eq "") {
+	    $ret{'nsconfig'}="net-snmp-config";
+	}
+
+	$ENV{'NET-SNMP-CONFIG'}    = $ret{'nsconfig'};
+	$ENV{'NET-SNMP-IN-SOURCE'} = $ret{'insource'};
+      }
+    }	
+    
+    $ret{'nsconfig'} =~ s/ROOTPATH/$rootpath/;
+
+    $ret{'rootpath'} = $rootpath;
+
+    \%ret;
+}
+
diff -Naur tomato/release/src/router/snmp/perl/agent/default_store/test.pl tomato121/release/src/router/snmp/perl/agent/default_store/test.pl
--- tomato/release/src/router/snmp/perl/agent/default_store/test.pl	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/perl/agent/default_store/test.pl	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,49 @@
+# Before `make install' is performed this script should be runnable with
+# `make test'. After `make install' it should work as `perl test.pl'
+
+######################### We start with some black magic to print on failure.
+
+# Change 1..1 below to 1..last_test_to_print .
+# (It may become useful if the test is moved to ./t subdirectory.)
+
+BEGIN { $| = 1; 
+
+	%tests = ( 
+                  "NETSNMP_DS_AGENT_VERBOSE"               => 0,
+                  "NETSNMP_DS_AGENT_ROLE"                  => 1,
+                  "NETSNMP_DS_AGENT_NO_ROOT_ACCESS"        => 2,
+                  "NETSNMP_DS_AGENT_AGENTX_MASTER"         => 3,
+                  "NETSNMP_DS_AGENT_QUIT_IMMEDIATELY"      => 4,
+                  "NETSNMP_DS_AGENT_DISABLE_PERL"          => 5,
+                  "NETSNMP_DS_AGENT_PROGNAME"              => 0,
+                  "NETSNMP_DS_AGENT_X_SOCKET"              => 1,
+                  "NETSNMP_DS_AGENT_PORTS"                 => 2,
+                  "NETSNMP_DS_AGENT_INTERNAL_SECNAME"      => 3,
+                  "NETSNMP_DS_AGENT_PERL_INIT_FILE"        => 4,
+                  "NETSNMP_DS_AGENT_FLAGS"                 => 0,
+                  "NETSNMP_DS_AGENT_USERID"                => 1,
+                  "NETSNMP_DS_AGENT_GROUPID"               => 2,
+                  "NETSNMP_DS_AGENT_AGENTX_PING_INTERVAL"  => 3,
+		  );
+
+	print "1.." . (scalar(keys(%tests)) + 2) . "\n"; 
+    }
+END {print "not ok 1\n" unless $loaded;}
+use NetSNMP::agent::default_store (':all');
+$loaded = 1;
+print "ok 1\n";
+
+######################### End of black magic.
+
+# Insert your test code below (better if it prints "ok 13"
+# (correspondingly "not ok 13") depending on the success of chunk 13
+# of the test code):
+
+$c = 2;
+foreach my $i (keys(%tests)) {
+    my $str = "NetSNMP::agent::default_store::$i";
+    my $val = eval $str;
+#    print "$i -> $val -> $tests{$i}\n";
+    $c++;
+    print (($val eq $tests{$i})?"ok $c\n" : "not ok $c\n#  error:  name=$i value_expected=$tests{$i}  value_got=$val \n");
+}
diff -Naur tomato/release/src/router/snmp/perl/agent/Makefile.PL tomato121/release/src/router/snmp/perl/agent/Makefile.PL
--- tomato/release/src/router/snmp/perl/agent/Makefile.PL	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/perl/agent/Makefile.PL	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,144 @@
+use ExtUtils::MakeMaker;
+require 5;
+use Config;
+use Getopt::Long;
+my %MakeParams = ();
+
+%MakeParams = InitMakeParams();
+
+WriteMakefile(%MakeParams);
+
+sub InitMakeParams {
+    my $opts;
+    my %Params = (
+		  'NAME'		=> 'NetSNMP::agent',
+		  'VERSION_FROM'	=> 'agent.pm', # finds $VERSION
+		  'XSPROTOARG'          => '-prototypes',
+		  'PM'                => { 
+		      'agent.pm' => '$(INST_LIBDIR)/agent.pm',
+		      'netsnmp_request_infoPtr.pm' =>
+			  '$(INST_LIBDIR)/agent/netsnmp_request_infoPtr.pm'
+		  },
+		  'PREREQ_PM'           => {},
+		  );
+
+    my ($snmp_lib, $snmp_llib, $sep);
+    if ($Config{'osname'} eq 'MSWin32') {
+      $opts = NetSNMPGetOpts();	
+      $snmp_lib = 'libsnmp.lib';
+      $snmp_link_lib = 'libsnmp';
+      $sep = '\\';
+
+      $Params{'DEFINE'} = "-DMSVC_PERL";
+      
+      if ($opts->{'insource'}) {
+	$Params{'LIBS'} = "-L$basedir\\win32\\lib\\ -l$snmp_link_lib -lnetsnmpagent -lnetsnmphelpers -lnetsnmpmibs";
+      }
+      else {
+	my @LibDirs = split (';',$ENV{LIB});
+	if ($opts->{'prefix'}) {
+	  push (@LibDirs,"$ENV{'NET-SNMP-PATH'}${sep}lib");
+	}
+	$noLibDir = 1;
+	while ($noLibDir) {
+	  $LibDir = find_files(["$snmp_lib"],\@LibDirs);
+	  if ($LibDir ne '') {
+	    $noLibDir = 0;
+	  }
+	  else
+	  {
+	    @LibDirs = ();
+	    @LibDirs[0] = prompt("The Net-SNMP library ($snmp_lib) could not be found.\nPlease enter the directory where it is located:");
+	    @LibDirs[0] =~ s/\\$//;
+	  }
+	}
+	$Params{LIBS} = "-L$LibDir -l$snmp_link_lib -lnetsnmpagent -lnetsnmphelpers -lnetsnmpmibs";
+      }
+
+      $Params{'INC'} = "-I$basedir\\include\\ -I$basedir\\include\\net-snmp\\ -I$basedir\\win32\\ ";
+    }
+    else {
+	$opts = NetSNMPGetOpts();
+	$Params{'LIBS'}    = `$opts->{'nsconfig'} --agent-libs`;
+	chomp($Params{'LIBS'});
+	$Params{'CCFLAGS'} = `$opts->{'nsconfig'} --cflags`;
+	chomp($Params{'CCFLAGS'});
+	$Params{'CCFLAGS'} .= " " . $Config{'ccflags'};
+	if ($opts->{'insource'} eq "true") {
+	    $Params{'LIBS'} = "-L../../snmplib/.libs -L../../snmplib/ -L../../agent/.libs -L../../agent/ -L../../agent/helpers/.libs -L../../agent/helpers/ " . $Params{'LIBS'};
+	    $Params{'CCFLAGS'} = "-I../../include " . $Params{'CCFLAGS'};
+#	} else {
+#	    $Params{'PREREQ_PM'} = {'NetSNMP::OID' => '0.1'};
+	}
+	$Params{'CCFLAGS'} =~ s/ -W[-\w]+//g; # ignore developer warnings
+	if ($Params{'LIBS'} eq "" || $Params{'CCFLAGS'} eq "") {
+	    die "You need to install net-snmp first (I can't find net-snmp-config)";
+	}
+    }
+
+    return(%Params);
+}
+# common subroutines -- DO NOT EDIT.
+# They are imported from the Makefile.subs.pl file
+sub NetSNMPGetOpts {
+    my %ret;
+    my $rootpath = shift;
+    $rootpath = "../" if (!$rootpath);
+    $rootpath .= '/' if ($rootpath !~ /\/$/);
+    
+    if ($Config{'osname'} eq 'MSWin32') {
+      if ($ENV{'NET-SNMP-IN-SOURCE'})
+      {
+	$ret{'insource'} = $ENV{'NET-SNMP-IN-SOURCE'};
+      }
+      elsif ($ENV{'NET-SNMP-PATH'})
+      {
+	$ret{'prefix'} = $ENV{'NET-SNMP-PATH'};
+      }
+      else
+      {
+	# don't have env vars, pull from command line and put there
+	GetOptions("NET-SNMP-IN-SOURCE=s" => \$ret{'insource'},
+	           "NET-SNMP-PATH=s"      => \$ret{'prefix'});
+
+	$ENV{'NET-SNMP-IN-SOURCE'}    = $ret{'insource'};
+	$ENV{'NET-SNMP-PATH'}         = $ret{'prefix'};
+      }
+
+      $basedir = `%COMSPEC% /c cd`;
+      chomp $basedir;
+      $basedir =~ /(.*?)\\perl.*/;
+      $basedir = $1;
+      print "Net-SNMP base directory: $basedir\n";
+
+    }
+    else
+    {
+      if ($ENV{'NET-SNMP-CONFIG'} && 
+        $ENV{'NET-SNMP-IN-SOURCE'}) {
+	# have env vars, pull from there
+	$ret{'nsconfig'} = $ENV{'NET-SNMP-CONFIG'};
+	$ret{'insource'} = $ENV{'NET-SNMP-IN-SOURCE'};
+      } else {
+	# don't have env vars, pull from command line and put there
+	GetOptions("NET-SNMP-CONFIG=s" => \$ret{'nsconfig'},
+	           "NET-SNMP-IN-SOURCE=s" => \$ret{'insource'});
+
+	if ($ret{'insource'} eq "true" && $ret{'nsconfig'} eq "") {
+	    $ret{'nsconfig'}="sh ROOTPATH../net-snmp-config";
+	} elsif ($ret{'nsconfig'} eq "") {
+	    $ret{'nsconfig'}="net-snmp-config";
+	}
+
+	$ENV{'NET-SNMP-CONFIG'}    = $ret{'nsconfig'};
+	$ENV{'NET-SNMP-IN-SOURCE'} = $ret{'insource'};
+      }
+    }	
+    
+    $ret{'nsconfig'} =~ s/ROOTPATH/$rootpath/;
+
+    $ret{'rootpath'} = $rootpath;
+
+    \%ret;
+}
+
diff -Naur tomato/release/src/router/snmp/perl/agent/MANIFEST tomato121/release/src/router/snmp/perl/agent/MANIFEST
--- tomato/release/src/router/snmp/perl/agent/MANIFEST	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/perl/agent/MANIFEST	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,7 @@
+Changes
+MANIFEST
+Makefile.PL
+agent.pm
+agent.xs
+test.pl
+typemap
diff -Naur tomato/release/src/router/snmp/perl/agent/netsnmp_request_infoPtr.pm tomato121/release/src/router/snmp/perl/agent/netsnmp_request_infoPtr.pm
--- tomato/release/src/router/snmp/perl/agent/netsnmp_request_infoPtr.pm	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/perl/agent/netsnmp_request_infoPtr.pm	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,22 @@
+package NetSNMP::agent::netsnmp_request_infoPtr;
+
+# bogus file
+
+1;
+__END__
+=head1 NAME
+
+NetSNMP::agent::netsnmp_request_infoPtr - Perl extension for request information
+
+=head1 SYNOPSIS
+
+  see NetSNMP::agent documentation
+
+=head1 AUTHOR
+
+Please mail the net-snmp-users@lists.sourceforge.net mailing list for
+help, questions or comments about this module.
+
+Wes Hardaker, hardaker@users.sourceforge.net
+
+=cut
diff -Naur tomato/release/src/router/snmp/perl/agent/test.pl tomato121/release/src/router/snmp/perl/agent/test.pl
--- tomato/release/src/router/snmp/perl/agent/test.pl	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/perl/agent/test.pl	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,91 @@
+# Before `make install' is performed this script should be runnable with
+# `make test'. After `make install' it should work as `perl test.pl'
+
+######################### We start with some black magic to print on failure.
+
+# Change 1..1 below to 1..last_test_to_print .
+# (It may become useful if the test is moved to ./t subdirectory.)
+
+BEGIN { $| = 1; print "1..5\n"; }
+END {print "not ok 1\n" unless $loaded;}
+use NetSNMP::agent (':all');
+use NetSNMP::default_store (':all');
+use NetSNMP::agent::default_store (':all');
+use NetSNMP::ASN (':all');
+use NetSNMP::OID;
+#use NetSNMP::agent (':all');
+use SNMP;
+$loaded = 1;
+print "ok 1\n";
+
+######################### End of black magic.
+
+sub it {
+    if ($_[0]) {
+	return "ok " . $_[1] . "\n";
+    } else {
+	return "not ok ". $_[1] ."\n";
+    }
+}
+
+# Insert your test code below (better if it prints "ok 13"
+# (correspondingly "not ok 13") depending on the success of chunk 13
+# of the test code):
+
+print it((MODE_GET == 0xa0 &&
+	  MODE_GETNEXT == 0xa1 &&
+	  MODE_GETBULK == 0xa5 &&
+	  MODE_SET_BEGIN == -1 &&
+	  MODE_SET_RESERVE1 == 0 &&
+	  MODE_SET_RESERVE2 == 1 &&
+	  MODE_SET_ACTION == 2 &&
+	  MODE_SET_COMMIT == 3 &&
+	  MODE_SET_FREE == 4 &&
+	  MODE_SET_UNDO == 5), 2);
+
+my $agent = new NetSNMP::agent('Name' => 'test',
+			       'Ports' => '9161');
+print it($agent, 3);
+
+$regitem = $agent->register("test_reg", ".1.3.6.1.8888", \&testsub);
+print it($regitem, 4);
+#print STDERR $regitem,":",ref($regitem),"\n";
+print it(ref($regitem) eq "netsnmp_handler_registrationPtr", 5);
+exit;
+
+while(1) {
+    print netsnmp_ds_get_string(NETSNMP_DS_APPLICATION_ID, 
+				NETSNMP_DS_AGENT_PORTS), "\n";
+    $agent->agent_check_and_process(1);
+    print netsnmp_ds_get_string(NETSNMP_DS_APPLICATION_ID, 
+				NETSNMP_DS_AGENT_PORTS), "\n";
+    print "got something\n";
+}
+exit;
+
+$x = NetSNMP::agent::handler_registration::new("hi",\&testsub,".1.3.6.1.999");
+print ((ref($x) eq "handler_registrationPtr") ? "ok 2\n" : "not ok 2\n");
+
+print (($x->register() == 0) ? "ok 3\n" : "not ok 3\n");
+
+my $y = NetSNMP::agent::register_mib("me",\&testsub,".1.3.6.1.8888");
+while(1) {
+  NetSNMP::agent::agent_check_and_process();
+  print "got something\n";
+}
+
+use Data::Dumper;
+sub testsub {
+    print STDERR "in perl handler sub\n";
+    print STDERR "  args: ", join(", ", @_), "\n";
+    print STDERR "  dumped args: ", Dumper(@_);
+    $oid= $_[3]->getOID();
+    print STDERR "  request oid: ", ref($oid), " -> ", $oid, "\n";
+    print STDERR "  mode: ", $_[2]->getMode(),"\n";
+    $_[3]->setOID(".1.3.6.1.8888.1");
+    $_[3]->setValue(2, 42);
+    $_[3]->setValue(ASN_INTEGER, 42);
+    print STDERR "  oid: ", $_[3]->getOID(),"\n";
+    print STDERR "  ref: ", ref($_[3]),"\n";
+    print STDERR "  val: ", $_[3]->getValue(),"\n";
+}
diff -Naur tomato/release/src/router/snmp/perl/agent/typemap tomato121/release/src/router/snmp/perl/agent/typemap
--- tomato/release/src/router/snmp/perl/agent/typemap	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/perl/agent/typemap	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,5 @@
+TYPEMAP
+netsnmp_handler_registration *				T_PTROBJ
+netsnmp_request_info *					T_PTROBJ
+const char *						T_PV
+netsnmp_oid *						T_PTROBJ
diff -Naur tomato/release/src/router/snmp/perl/AnyData_SNMP/Changes tomato121/release/src/router/snmp/perl/AnyData_SNMP/Changes
--- tomato/release/src/router/snmp/perl/AnyData_SNMP/Changes	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/perl/AnyData_SNMP/Changes	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1 @@
+none.
diff -Naur tomato/release/src/router/snmp/perl/AnyData_SNMP/configs/scli tomato121/release/src/router/snmp/perl/AnyData_SNMP/configs/scli
--- tomato/release/src/router/snmp/perl/AnyData_SNMP/configs/scli	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/perl/AnyData_SNMP/configs/scli	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,27 @@
+# scli equivelents
+alias scli_system_info {
+    printf "Name:              %s\n" sysName.0
+    #XXX fix:
+    printf "Address:           localhost:161\n";
+    printf "Contact:           %s\n" sysContact.0
+    printf "Location:          %s\n" sysLocation.0
+    printf "Vendor:            %s\n" sysObjectID.0
+    #printf "Current Time:      %s\n"  hrSystemDate.0
+    #printf "Agent Boot Time:   %s\n"  sysUpTime.0
+    #printf "System Boot Time:  %s\n"  2002-06-03 21:33:49 -08:00
+    printf "Users:             %s\n"  hrSystemNumUsers.0
+    printf "Processes:         %s\n"  hrSystemProcesses.0
+    printf "Memory:            %s\n"  select hrStorageSize, hrStorageType from hrStorageTable where hrStorageType = '.1.3.6.1.2.1.25.2.1.2'
+    printf "Interfaces:        %s\n"  ifNumber.0
+}
+
+alias scli_system_devices {
+      printf "%5d: %s\n" select hrDeviceIndex, hrDeviceDescr from hrDeviceTable;
+}
+
+alias scli_system_storage {
+      printf "Storage Area          Size [K]   Used [K]   Free [K] Use%\n"
+      # fix size, use%
+      printf "%-22s %8d %8d %8d %3d (%s)\n" select hrStorageDescr, hrStorageSize, hrStorageUsed, hrStorageSize, hrStorageIndex, hrStorageType from hrStorageTable
+}
+
diff -Naur tomato/release/src/router/snmp/perl/AnyData_SNMP/configs/unix tomato121/release/src/router/snmp/perl/AnyData_SNMP/configs/unix
--- tomato/release/src/router/snmp/perl/AnyData_SNMP/configs/unix	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/perl/AnyData_SNMP/configs/unix	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,34 @@
+# example ifconfig command
+alias ifconfig {
+      printf "%-10sinet addr: %-15s  Mask: %-10s\n          %s %s RUNNING:%s  MTU:%d\n          RX packets: %d errors: %d dropped: %d\n          TX packets: %d errors: %d dropped: %d\n          RX bytes:%d  TX bytes: %d\n\n" select ifDescr, ipAdEntAddr, ipAdEntNetMask, ifAdminStatus, ifType, ifOperStatus, ifMtu, ifInUcastPkts, ifInErrors, ifInDiscards, ifOutUcastPkts, ifOutErrors, ifOutDiscards, ifInOctets, ifOutOctets, ifIndex, ipAdEntIfIndex from ifTable, ipAddrTable where ifIndex = ipAdEntIfIndex
+#       select ipAdEntAddr, ifDescr, ifIndex, ipAdEntIfIndex from ifTable, ipAddrTable where ifIndex = ipAdEntIfIndex
+}
+
+# equivelant to netstat -an
+alias netstatan {
+      printf "Active Intenet connections (servers and established)\n"
+      printf "Proto     LocalAddress          Foreign Address      State\n"
+      printf "tcp       %-15s:%-5s %-15s:%-5s%-10s\n" select tcpConnLocalAddress, tcpConnLocalPort, tcpConnRemAddress, tcpConnRemPort, tcpConnState from tcpConnTable;
+      printf "udp       %-15s:%-5s 0.0.0.0:0               %-10s\n" select udpLocalAddress, udpLocalPort from udpTable;
+}
+
+# equivelent to netstat -rn
+alias netstatrn {
+      printf "Kernel IP Routing Table\n"
+      printf "Destination     Gateway         Genmask          Type      Iface\n"
+      printf "%-15s %-15s %-15s  %-8s  %s\n" select ipRouteDest, ipRouteNextHop, ipRouteMask, ipRouteType, ifDescr, ifIndex, ipRouteIfIndex from ifTable, ipRouteTable where ifIndex = ipRouteIfIndex
+}
+
+alias ps {
+      printf "%6d %1d %s %40.40s\n" select hrSWRunIndex, hrSWRunType, hrSWRunName, hrSWRunParameters from hrSWRunTable
+#      printf "%6d %1d %6d %s %40.40s\n" select hrSWRunIndex, hrSWRunType, hrSWRunPerfMem, hrSWRunName, hrSWRunParameters from hrSWRunTable
+}
+
+alias ps_grep {
+      printf "%6d %1d %s %40.40s\n" select hrSWRunIndex, hrSWRunType, hrSWRunName, hrSWRunParameters from hrSWRunTable where hrSWRunName like '%\1%'
+}
+
+alias df {
+      printf "Filesystem               Size     Used\n"
+      printf "%-20s %8d %8d\n" select hrStorageDescr, hrStorageSize, hrStorageUsed from hrStorageTable
+}
diff -Naur tomato/release/src/router/snmp/perl/AnyData_SNMP/.cvsignore tomato121/release/src/router/snmp/perl/AnyData_SNMP/.cvsignore
--- tomato/release/src/router/snmp/perl/AnyData_SNMP/.cvsignore	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/perl/AnyData_SNMP/.cvsignore	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,3 @@
+Makefile
+blib
+pm_to_blib
diff -Naur tomato/release/src/router/snmp/perl/AnyData_SNMP/DBD_AnyData.patch tomato121/release/src/router/snmp/perl/AnyData_SNMP/DBD_AnyData.patch
--- tomato/release/src/router/snmp/perl/AnyData_SNMP/DBD_AnyData.patch	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/perl/AnyData_SNMP/DBD_AnyData.patch	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,48 @@
+--- ../AnyData-0.05/DBD/AnyData.pm	Tue Jul 17 12:31:44 2001
++++ DBD/AnyData.pm	Wed Oct 31 13:08:37 2001
+@@ -63,7 +63,7 @@
+     # PARSE EXTRA STRINGS IN DSN HERE
+     # Process attributes from the DSN; we assume ODBC syntax
+     # here, that is, the DSN looks like var1=val1;...;varN=valN
+-    my $var;
++    my ($var, $defaultselector, %defaultflags);
+     $dbh->STORE('f_dir','./');
+     foreach $var (split(/;/, $dbname)) {
+         #######################################################
+@@ -80,9 +80,13 @@
+         #######################################################
+         # Patch from Wes Hardaker
+         #######################################################
+-	} elsif( $var =~ m/^\s*?default=(\S+)/i ){
+-            # Default catalog selector to use
+-            $dbh->func('__default',$1, 'ad_catalog');
++	} elsif( $var =~ m/^\s*?ad_default=(\S+)/i ){
++           # Default catalog selector to use
++	    $defaultselector = $1;
++	} elsif( $defaultselector && 
++		 $var =~ m/^\s*?ad_${defaultselector}_(\S+)=(\S+)/i ) {
++           # Add to selector flags.
++   	    $defaultflags{$1} = $2;
+         #######################################################
+         } elsif ($var =~ /(.*?)=(.*)/) {
+             my $key = $1;
+@@ -90,6 +94,10 @@
+             $dbh->STORE($key, $val);
+         }
+     }
++    if ($defaultselector) {
++        $dbh->func('__default', $defaultselector, '', \%defaultflags, 
++		   'ad_catalog');
++    }
+     ### $dbh->func('read_catalog_from_disk');
+     $dbh;
+ }
+@@ -520,7 +528,7 @@
+     my($self, $data, $fields) = @_;
+     my $requested_cols=[];
+     my @rc = $data->{f_stmt}->columns();
+-    push @$requested_cols, $_->{column} for @rc;
++    push @$requested_cols, $_->{name} for @rc;
+     unshift @$fields, $requested_cols;
+     $self->{ad}->push_row(@$fields);
+     1;
diff -Naur tomato/release/src/router/snmp/perl/AnyData_SNMP/Format.pm tomato121/release/src/router/snmp/perl/AnyData_SNMP/Format.pm
--- tomato/release/src/router/snmp/perl/AnyData_SNMP/Format.pm	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/perl/AnyData_SNMP/Format.pm	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,108 @@
+package AnyData::Format::SNMP;
+#
+# AnyData interface to SNMP queries
+#
+
+use strict;
+use AnyData::Format::Base;
+use vars qw( @ISA );
+@AnyData::Format::SNMP::ISA = qw( AnyData::Format::Base );
+use Data::Dumper;
+
+sub storage_type {
+#    print "calling storage type\n"; 'SNMP';
+}
+
+sub new {
+#    print "new format: ", Dumper(@_), "\n";
+    my $class = shift;
+    my $self  = shift ||  {};
+    bless $self, $class;
+    $self->{'storage'} = 'SNMP';
+    $self->{'has_update_function'} = 'SNMP';
+#    print Dumper($self), "\n";
+    return $self;
+    2;
+}
+
+sub get_col_names {
+#    print "get_col_names\n";
+    # XXX: get mib column names
+    2;
+}
+
+sub seek_first_record {
+#    print "seek_first\n";
+    my $self = shift;
+    my $var = [$self->{'mibnode'}];
+    $self->{'session'}->getnext($var);
+    2;
+}
+
+sub get_pos {
+#    print "get_pos\n";
+    2;
+}
+
+sub go_pos {
+#    print "go_pos\n";
+    2;
+}
+
+sub delete_record {
+#    print "del_rec\n";
+    2;
+}
+
+sub get_record {
+#    print "get_record\n";
+    2;
+}
+
+sub push_row {
+#    print "push_row\n";
+    2;
+}
+
+sub truncate {
+#    print "truncate\n";
+    2;
+}
+
+sub close_table {
+#    print "close_table\n";
+    2;
+}
+
+sub drop {
+#    print "drop\n";
+    2;
+}
+
+sub seek {
+#    print "seek\n";
+    2;
+}
+
+sub write_fields {
+#    print STDERR "write_fields: ",Dumper(\@_), "\n";
+    my $self   = shift;
+    my @ary = @_;
+    return \@ary;
+}
+sub read_fields {
+#    print STDERR "read_fields: ",Dumper(\@_), "\n";
+    my $self   = shift;
+    my $aryref = shift;
+    return @$aryref;
+}
+
+sub get_data {
+#    print "get_data\n";
+    2;
+}
+
+sub init_parser {
+#    print "init_parser\n";
+    2;
+}
diff -Naur tomato/release/src/router/snmp/perl/AnyData_SNMP/INSTALL tomato121/release/src/router/snmp/perl/AnyData_SNMP/INSTALL
--- tomato/release/src/router/snmp/perl/AnyData_SNMP/INSTALL	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/perl/AnyData_SNMP/INSTALL	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,44 @@
+NOTE NOTE NOTE: this module depends on a modified version of the
+DBD::AnyData module.  Do not get the original version from Jeff
+Zucker.  He and I are working together to resolve the extra features I
+need, but we haven't quite merged yet.  
+
+*** This is currently alpha level code!!! ***
+
+Install steps:
+  0) install the DBI perl module (run: perl -MCPAN -e "install DBI")
+     and the DBD::File perl module (run: perl -MCPAN -e "install DBD::File")
+
+  1) download, and install the modified AnyData perl modules from:
+     http://www.net-snmp.org/AnyData-wes/AnyData-0.05.tar.gz
+     http://www.net-snmp.org/AnyData-wes/DBD-AnyData-0.05.wes.tar.gz
+     http://www.net-snmp.org/AnyData-wes/SQL-Statement-1.004.tar.gz
+
+     Extract each of the above tar balls and in the resulting
+     directories run:
+
+    	perl Makefile.PL
+    	make
+    	make install   (as root)
+
+  2) Then in this directory, run:
+    	perl Makefile.PL
+    	make
+    	make install   (as root)
+
+To use it:
+  SQL like Shell script:
+    netsh [snmpcmd arguments] HOST [SQL COMMAND]
+
+  Example commands to type at the prompt:
+    select * from ifTable
+    select * from ifTable where ifDescr = 'eth0'
+    alias ifconfig select ifDescr, ifAdminStatus where ifDescr = '\1'
+    ifconfig eth0
+
+
+[Jeff Zucker's original (unpatched) AnyData perl modules can be found
+ at http://www.vpservices.com/jeff/programs/AnyData/ .  However, do not
+ use the modules from this site as they won't work with the software in
+ this directory.  (Use the download sites in step 1 below instead.)  It
+ is a good source for documentation about the AnyData modules.]
diff -Naur tomato/release/src/router/snmp/perl/AnyData_SNMP/Makefile.PL tomato121/release/src/router/snmp/perl/AnyData_SNMP/Makefile.PL
--- tomato/release/src/router/snmp/perl/AnyData_SNMP/Makefile.PL	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/perl/AnyData_SNMP/Makefile.PL	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,14 @@
+use ExtUtils::MakeMaker;
+# See lib/ExtUtils/MakeMaker.pm for details of how to influence
+# the contents of the Makefile that is written.
+WriteMakefile(
+    'NAME'		=> 'AnyData::SNMP',
+    'VERSION_FROM'	=> 'Storage.pm', # finds $VERSION
+    'PREREQ_PM'		=> {# SNMP => 5.0,
+			    AnyData => 0}, # e.g., Module::Name => 1.1
+    'PM'                => { 
+	'Format.pm' => '$(INST_LIBDIR)/Format/SNMP.pm',
+	'Storage.pm' => '$(INST_LIBDIR)/Storage/SNMP.pm',
+    },
+    'EXE_FILES'         => [qw(netsh)]
+);
diff -Naur tomato/release/src/router/snmp/perl/AnyData_SNMP/MANIFEST tomato121/release/src/router/snmp/perl/AnyData_SNMP/MANIFEST
--- tomato/release/src/router/snmp/perl/AnyData_SNMP/MANIFEST	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/perl/AnyData_SNMP/MANIFEST	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,7 @@
+INSTALL
+README
+MANIFEST
+Makefile.PL
+Format.pm
+Storage.pm
+DBD_AnyData.patch
diff -Naur tomato/release/src/router/snmp/perl/AnyData_SNMP/netsh tomato121/release/src/router/snmp/perl/AnyData_SNMP/netsh
--- tomato/release/src/router/snmp/perl/AnyData_SNMP/netsh	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/perl/AnyData_SNMP/netsh	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,838 @@
+#!/usr/bin/perl
+
+use Getopt::Std;
+
+use DBI;
+use Term::ReadLine;
+use SNMP;
+use AutoLoader;
+use IO::File;
+
+BEGIN {
+    $opts{'t'} = ! eval { require Text::FormatTable; };
+    $ansicolor = eval { require Term::ANSIColor; };
+}
+
+# override some of the functions to force our colorized semantics.
+# This is really ugly, but if you pass colorized strings directly to
+# Text::FormatTable then it calculates the string lengths incorrectly.
+# Children: don't try this at home.  We're trained professionals.
+if ($colorize) {
+   eval {
+        #
+	# colorized strings.
+	#
+	package color_string;
+
+	require Term::ANSIColor;
+
+	use overload
+	    '""' => \&string_it
+	;
+
+	sub string_it {
+	    if ($_[0][3]) {
+		if ($_[0][3] == 1) {
+		    return color_it();
+		} else {
+		    $_[0][3] -= 1;
+		    return $_[0][1];
+		}
+	    }
+	    return $_[0][1];
+	}
+
+        sub colorize_next {
+	    $_[0][3] = 2;
+	}
+
+	sub color_it {
+	    my $str = $_[1] || $_[0][1];
+	    return $_[0][0] . $str . $_[0][2];
+	}
+
+	sub new {
+	    my $this = [Term::ANSIColor::color($_[2]), $_[1],
+		      Term::ANSIColor::color('reset')];
+	    return bless($this, $_[0]);
+	}
+    }
+}
+
+if ($opts{'t'} == 0 && $colorize) {
+    eval {
+	package Text::FormatTable;
+
+	sub _l_box($$)
+	{
+	    my ($width, $text) = @_;
+	    my $lines = _wrap($width, $text);
+	    map { 
+		if (ref($text) eq "color_string") {
+		    $_ .= $text->color_it($_) . ' 'x($width-length($_));
+		} else {
+		    $_ .= ' 'x($width-length($_));
+		} 
+	    } @$lines;
+	    return $lines;
+	}
+
+	sub _r_box($$)
+	{
+	    my ($width, $text) = @_;
+	    my $lines = _wrap($width, $text);
+	    map { 
+		if (ref($text) eq "color_string") {
+		    $_ = ' 'x($width-length($_)) . $text->color_it($_);
+		} else {
+		    $_ = ' 'x($width-length($_)) . $_;
+		} 
+	    } @$lines;
+	    return $lines;
+	}
+
+    }
+}
+
+if (!$ansicolor) {
+    $begin = $end = "*";
+}
+
+$SNMP::use_enums=1;
+
+
+#defaults
+$opts{'d'} = "\t";
+$opts{'v'} = 1;
+$opts{'l'} = 'authNoPriv';
+$params = "";
+
+getopts('hd:tR:u:l:v:a:A:x:X:p:c:t:r:',\%opts);
+
+usage() if ($#ARGV == -1 || $opts{'h'});
+
+my %parammap = {
+    'v' => 'Version',
+    'u' => 'SecName',
+    'a' => 'AuthProto',
+    'A' => 'AuthPass',
+    'x' => 'PrivProto',
+    'X' => 'PrivPass',
+    'p' => 'RemotePort',
+    't' => 'Timeout',
+    'r' => 'Retries',
+    'c' => 'Community',
+    'l' => 'SecLevel'
+    };
+
+foreach my $x (keys(%opts)) {
+    if ($parammap{$x}) {
+	$params .= ";ad_SNMP_$parammap{$x}=$x";
+    }
+    push @sessparams,$parammap{$x},$x;
+}
+
+my $host = shift @ARGV;
+$params .= ";ad_SNMP_DestHost=" . $host;
+push @sessparms,'DestHost', $host;
+
+# connect to the DBI interface
+$AnyData::Storage::SNMP::debugre = $opts{'R'} if ($opts{'R'});
+($dbh = DBI->connect("dbi:AnyData:ad_default=SNMP$params"))
+    || die "\tConnection problem: $DBI::errstr\n";
+$AnyData::Storage::SNMP::debugre = $opts{'R'} if ($opts{'R'});
+
+$prompt = "netsh> ";
+
+load_rcs();
+
+# setup terminal prompter
+$ENV{'PERL_RL'}='o=0' if (!exists($ENV{'PERL_RL'}));
+# the ornaments are too ugly
+$term = new Term::ReadLine 'netsh';
+
+if ($#ARGV >= 0) {
+    # command line command
+    netsh(join(" ",@ARGV));
+} else {
+    # interactive shell
+    while($cmd = $term->readline($prompt)) {
+	last if ($cmd eq "exit" || $cmd eq "quit" || $cmd eq "q");
+	netsh($cmd, \%conf);
+    }
+}
+
+# load all configuration files we can find.
+sub load_rcs {
+    if (-f "$ENV{'HOME'}/.snmp/netshrc") {
+	source_file("$ENV{'HOME'}/.snmp/netshrc");
+    }
+    if (-d "$ENV{'HOME'}/.snmp/netsh") {
+	foreach my $i (glob("$ENV{'HOME'}/.snmp/netsh/*")) {
+	    if (-f "$i" && "$i" !~ /.*(~|.bak)$/) {
+		source_file("$i");
+	    }
+	}
+    }
+}
+
+# command definition for sourcing a particular file
+sub source_file {
+    my $fh = new IO::File;
+    if ($fh->open("<$_[0]")) {
+	while(<$fh>) {
+	    if (s/<<\s*(\w+)$//) {
+		my $stopat = $1;
+		my $lines = $_;
+		while(<$fh>) {
+		    last if (/$stopat/);
+		    $lines .= $_;
+		}
+		$_ = $lines;
+	    }
+	    netsh($_);
+	}
+    } else {
+	print STDERR "no such file: $_[0]\n";
+    }
+}
+
+# export data into an external file
+sub my_export {
+    shift;
+    if (!$insh) {
+	my $cmd = "create table exporttable (" . join (" varchar(255), ",@{$sth->{NAME}}) . " varchar(255))";
+	$exporth->do($cmd);
+	$cmd = "insert into exporttable values(" . ('?, ' x ($#_)) . "?)";
+	$insh = $exporth->prepare($cmd);
+    }
+    $insh->execute(@_);
+}
+
+# the main processing function.
+sub netsh {
+    my $stmt = shift;
+    chomp($stmt);      # remove trailing white space
+    $stmt =~ s/^\s+//; # remove leading white space
+    $stmt =~ s/;*$//;  # get rid of trailing semicolons
+    return if ($stmt =~ /^\s*$/);
+    return if ($stmt =~ /^\s*\#/);
+    my ($name, $args) = ($stmt =~ /^(\w+)\s*(.*)$/);
+
+    #define alias
+#    print "doing [$multi_alias]: $stmt\n";
+    if ($name eq "alias" || $multi_alias) {
+	if ($multi_alias) {
+	    if ($stmt =~ /^prompt\s+(\d+)\s+[\"\'](.+)[\"\']/) {
+		$aliases{$current_alias}{'prompts'}[$1] = $2;
+		return;
+	    } elsif ($stmt =~ /^prompt\s+(\d+)\s+(.+)/) {
+		my $x = $2;
+		my $spot = $1;
+		$x =~ s/\s+$//;
+		$aliases{$current_alias}{'prompts'}[$spot] = "$x ";
+		return;
+	    } elsif ($stmt =~ /^\s*\}\s*$/) {
+		$prompt = $oprompt;
+		$multi_alias = 0;
+		return;
+	    }
+	    push @{$aliases{$current_alias}{'definition'}},$stmt;
+	    return;
+	}
+	$stmt =~ s/^alias\s+//;
+	if ($args eq "") {
+	    foreach $i (sort keys(%aliases)) {
+		display_alias($i);
+	    }
+	    return;
+	}
+	($name, $args) = ($stmt =~ /^(\w+)\s*(.*)$/);
+	if ($args eq "") {
+	    display_alias($name);
+	    return;
+	}
+#	print "alias: $name $args\n";
+	if ($args eq "{") {
+	    $oprompt = $prompt;
+	    $prompt = "define $name> ";
+	    $current_alias = $name;
+	    $multi_alias = 1;
+	    $aliases{$name}{'definition'} = [];
+	    return;
+	}
+	$aliases{$name}{'definition'} = $args;
+	return;
+    }
+
+    #eval
+    if ($name eq "eval") {
+	eval $args;
+	return;
+    }
+
+    #eval just vars
+    if ($name eq "evalvars") {
+#	print "args1:",$args,"\n";
+	$args =~ s/\$(\w+)/$$1/eg;
+#	print "args2:",$args,"\n";
+	netsh($args);
+	return;
+    }
+
+    #eval aliases
+    while (exists $aliases{$name}) {
+#	print "modified: $stmt -> ";
+	my @ARGS = split(/\s+/,$args);
+	my $statements;
+	if (ref($aliases{$name}{'definition'}) eq "ARRAY") {
+	    $statements = $aliases{$name}{'definition'};
+
+	    # maybe prompt for values
+	    if ($#{$aliases{$name}{'prompts'}} > -1) {
+		my $i;
+		for($i = 1; $i <= $#{$aliases{$name}{'prompts'}}; $i++) {
+		    if (!$ARGS[$i-1] && $term) {
+			$ARGS[$i-1] = 
+			    $term->readline($aliases{$name}{'prompts'}[$i]);
+		    }
+		}
+	    }
+	} else {
+	    $statements = [$aliases{$name}{'definition'}];
+	}
+	foreach my $stmt (@$statements) {
+	    #print "$stmt -> ";
+	    $stmt =~ s/\\(\d+)/$ARGS[$1-1]/g;
+#	    print "running $stmt\n";
+	    ($name, $args) = ($stmt =~ /^(\w+)\s*(.*)$/);
+	    netsh($stmt);
+	}
+	return;
+    }
+
+    if ($stmt =~ /^rehash$/) {
+	load_rcs();
+	return;
+    }
+
+    my $subfn;
+
+    if ($stmt =~ /^eval (.*)/) {
+	eval $1;
+    }
+
+    if ($stmt =~ s/^printf\s+(\".*\")\s*(.*)/$2/) {
+	if ($2 eq "") {
+	    print eval $1;
+	    return;
+	}
+	$subfn = \&my_printf;
+	$stmt = $2;
+	$printfmt = $1;
+    }
+
+    # special show columns statement
+    if ($stmt =~ /^show columns from (\w+)$/) {
+	my $mibnode = $SNMP::MIB{$1};
+	my $entrynode = $mibnode->{children}[0];
+	if (!defined($mibnode) || !defined($entrynode)) {
+	    print STDERR "no such table: $1\n";
+	    return;
+	}
+	if ($opts{'t'}) {
+	    map { print $_->{label},"\n"; } sort { $a->{subID} <=> $b->{subID}} @{$entrynode->{children}};
+	} else {
+	    $table = Text::FormatTable->new('|r|');
+	    $table->rule('-');
+	    $table->head('Column');
+	    $table->rule('-');
+	    map { $table->row($_->{label}); } sort { $a->{subID} <=> $b->{subID}} @{$entrynode->{children}};
+	    $table->rule('-');
+	    print $table->render();
+	}
+	return;
+    }
+
+    if ($stmt =~ /^source\s+(.*)/) {
+	source_file($1);
+	return;
+    }
+
+    if ($stmt =~ s/^export\s+(\S+)\s+(.*)/$2/) {
+	$insh = undef;
+	unlink($1);
+	$exporth = DBI->connect('dbi:AnyData:');
+	$exporth->func('exporttable','CSV',$1,'ad_catalog');
+	$subfn = \&my_export;
+    }
+
+    if ($stmt =~ /^import\s+(\S+)/) {
+	my $exporth = DBI->connect('dbi:AnyData:');
+	$exporth->func('exporttable','CSV',$1,'ad_catalog');
+	my $selh = $exporth->prepare("select * from exporttable");
+	$selh->execute();
+	$old_data = [];
+	while(my $row = $selh->fetchrow_arrayref) {
+	    push @$old_data, @$row;
+	}
+	$selh->finish();
+	$exporth->disconnect();
+	return;
+    }
+    
+    if ($stmt =~ /^diff\s+(.*)/) {
+	$running_watch = 2;
+	netsh($1);
+	$running_watch = 0;
+	return;
+    }
+
+    if ($stmt =~ /^watch\s+(.*)/) {
+	$running_watch = 1;
+	my $cmd = $1;
+	my $delay = 1;
+	my $clear = `clear`;
+	if ($cmd =~ s/^(\d+)\s+(.*)/$2/) {
+	    $delay = $1;
+	    $cmd = $2;
+	}
+	$SIG{'TERM'} = sub { $running_watch = 0; };
+	$SIG{'INT'} = sub { $running_watch = 0; };
+	while($running_watch) {
+	    print $clear;
+	    netsh($cmd);
+	    sleep($delay);
+	}
+	$SIG{'TERM'} = \&exit;
+	$SIG{'INT'} = \&exit;
+	return;
+    }
+
+    # we have an SQL statement.  process it.
+    if ($stmt =~ /^(select|insert|update|delete)/) {
+	$sth = $dbh->prepare($stmt);
+	$sth->execute();
+	if ($stmt =~ /^select/) {
+	    my $table;
+	    my $older_data = $old_data;
+	    if ($running_watch == 1) {
+		$old_data = [];
+	    }
+	    my $oldcount = 0;
+	    while($row = $sth->fetchrow_arrayref) {
+		
+		if ($running_watch) {
+		    $newrow=[];
+		    my $count;
+		    for($count = 0; $count <= $#$row; $count++) {
+			if ($older_data &&
+			    $row->[$count] ne
+			    $older_data->[$oldcount][$count]) {
+			    if ($ansicolor) {
+				push @$newrow, new color_string($row->[$count],'red');
+			    } else {
+				push @$newrow,"$begin$row->[$count]$end";
+			    }
+			} else {
+			    push @$newrow,$row->[$count];
+			}
+			if ($running_watch == 1) {
+			    $old_data->[$oldcount][$count] = $row->[$count];
+			}
+		    }
+		    $oldcount++;
+		    $row = $newrow;
+ 		}
+
+		# self printing;
+		if (ref($subfn) eq "CODE") {
+		    &$subfn($printfmt,@$row);
+		    next;
+		}
+
+		if ($opts{'t'}) {
+		    if ($opts{'d'} eq 'xml') {
+			print "  <row>\n";
+			for(my $xx = 0; $xx < $#{$sth->{NAME}}; $xx++) {
+			    print "    <$sth->{NAME}[$xx]>$row->[$xx]</$sth->{NAME}[$xx]>\n";
+			}
+			print "  </row>\n";
+		    } elsif ($opts{'d'} eq 'xmlshort') {
+			print "  <row ";
+			for(my $xx = 0; $xx < $#{$sth->{NAME}}; $xx++) {
+			    print " $sth->{NAME}[$xx]=\"$row->[$xx]\"";
+			}
+			print "/>\n";
+		    } else {
+			print join($opts{'d'},@$row),"\n";
+		    }
+		} elsif (!$table) {
+		    $table = Text::FormatTable->new('|r' x ($#$row+1) . "|");
+		    $table->rule('-');
+		    $table->head(@{$sth->{NAME}});
+		    $table->rule('-');
+		    $table->row(@$row);
+		} else {
+		    $table->row(@$row);
+		}
+	    }
+	    if ($table) {
+		$table->rule('-');
+		print $table->render();
+	    }
+	}
+	$sth->finish();
+	return;
+    }
+
+    # retrieve just one variable and display it
+    if ($stmt =~ /^(get|)\s*([^\s]+)\s*[^=]/) {
+	my $sess = make_session();
+	if ($sess) {
+	    my @results = split(/[,\s]+/,$stmt);
+	    my $resultsv = new SNMP::VarList();
+	    # expression stolen from the main perl SNMP module
+	    map {  my ($tag, $iid) = 
+		       (/^((?:\.\d+)+|(?:\w+(?:\-*\w+)+))\.?(.*)$/);
+		   push @$resultsv, [$tag, $iid] } @results;
+	    $sess->get($resultsv)  || 
+		print STDERR "Error: $sess->{ErrorNum} $sess->{ErrString}\n";
+  	    @results = ();
+	    map { push @results, $_->[2] } @$resultsv;
+	    if (ref($subfn) eq "CODE") {
+		&$subfn($printfmt,@results);
+	    } else {
+		print join(" ", @results),"\n";
+	    }
+	} else {
+	    print STDERR "could not establish a SNMP session to $host\n";
+	}
+	return;
+    }
+
+    # set something
+    if ($stmt =~ /^(set|)\s*([^\s]+)\s=\s(.*)$/) {
+	my $sess = make_session();
+	if ($sess) {
+	    $sess->set([$2,undef,$1]) || 
+		print STDERR "opps: $sess->{ErrorNum} $sess->{ErrString}\n";
+	} else {
+	    print STDERR "could not establish a SNMP session to $host\n";
+	}
+	return;
+    }
+}
+
+sub auto_snmp {
+    my $node = $SNMP::MIB{$_[0]};
+#    print STDERR "netsh::fetch_snmp $_[0] $node->{label}\n";
+    my $indexes = $node->{parent}{indexes};
+    if ($#$indexes > -1) {
+#	print STDERR "column\n";
+	# table 
+    } else {
+	# scalar
+	if (exists($_[1])) {
+	    my $sess = make_session();
+	    my $val = $sess->set([$_[0],0,$_[1]]) || return;
+#	    print STDERR "scalar set: $val\n";
+	    return $val;
+	} else {
+	    my $sess = make_session();
+	    my $val = $sess->get([$_[0],0]);
+#	    print STDERR "scalar get: $val\n";
+	    return $val;
+	}
+    }
+}
+
+sub AUTOLOAD {
+    my $nodename = $AUTOLOAD;
+    $nodename =~ s/.*:://;
+    print STDERR "netsh::AUTOLOAD $AUTOLOAD $nodename\n";
+    if ($SNMP::MIB{$nodename}) {
+	eval << "END";
+        sub $AUTOLOAD {
+	    auto_snmp($nodename, \@_);
+	}
+END
+	goto &$AUTOLOAD;
+    }
+    print STDERR join(",",@_),"\n";
+}
+
+sub my_printf {
+    # drop quotes
+    my $fmt = shift;
+    $fmt = eval $fmt;
+    map { if (ref($_) eq "color_string") { $_->colorize_next(); } } @_;
+    printf($fmt, @_);
+}
+
+sub display_alias {
+    my $name = shift;
+    if (exists $aliases{$name}{'definition'}) {
+	if (ref($aliases{$name}{'definition'}) eq "ARRAY") {
+	    print "alias $name {\n";
+	    map { print "  $_\n"; } @{$aliases{$name}{'definition'}};
+	    print "}\n";
+	} else {
+	    print "alias $name $aliases{$name}{'definition'}\n";
+	}
+    } else {
+	print "no alias defined for \"$name\"\n";
+    }
+}
+
+sub make_session {
+    if (!$sess) {
+	$sess = new SNMP::Session(@sessparms);
+    }
+    return $sess;
+}
+
+
+sub usage {
+    print STDERR "
+$0 [ARGUMENTS] HOSTNAME [SQL_COMMAND] 
+
+  $0 implements a simple SQL shell which maps onto SNMP.  All
+  statements issued within the shell are converted to SNMP requests and
+  sent to HOSTNAME and the results displayed in a nice table output
+  format if the Text::FormatTable module is available.  If SQL_COMMAND
+  is given on the command line, then it's interpreted and control is
+  returned to the caller.  If not, an interactive prompt is given where
+  multiple commands can be issued.
+
+ARGUMENTS may include:
+
+  -t         delimiter separated output, don't print pretty tables.
+  -d DELIM   use DELIM as the delimiter.  A tab is the default delimiter.
+             'xml' is a special delimiter to produce xml output.
+
+ARGUMENTS also may include the following.  See the net-snmp snmpcmd
+manual page for details on what they mean:
+
+  -v VERSION        (default: 1)
+  -t TIMEOUT
+  -r RETRIES
+  -p PORT
+  -c COMMUNITY
+  -a AUTHPROTOCOL   (default: MD5)
+  -x PRIVPROTOCOL   (default: DES)
+  -A AUTHPASS
+  -X PRIVPASS
+  -l SECURITY_LEVEL (default: authNoPriv)
+  
+";
+    exit;
+}
+
+__END__
+
+=head1 NAME
+
+netsh - A shell environment for interacting with networking devices
+
+=head1 SYNOPSIS
+
+netsh [(subset of) snmpcmd arguments] hostname[,hostname...] [command]
+
+=head1 OPTIONAL PERL MODULES
+
+There are some optional perl modules which make using the shell nicer
+in general.  These modules are:
+
+  Text::FormatTable
+  Term::ReadLine::Gnu or Term::ReadLine::Perl
+  Term::ANSIColor
+
+You can install these by running [as root]:
+
+  perl -MCPAN -e shell
+  cpan> install Text::FormatTable
+  ...
+
+It is B<strongly> recommend you at least install the Text::FormatTable
+module, and if you like command line editing one of the two extra
+Term::ReadLine modules (Gnu being the better of the two).
+
+=head1 DESCRIPTION
+
+The netsh script provides an interactive, console-like environment
+suitable for monitoring and manipulating data within networking
+devices.  The environment is highly extensible through command
+aliases and easy-to-use SQL-like queries.
+
+It is implemented on top of the SNMP protocol using the net-snmp
+package and perl.  See the snmpcmd and snmp.conf manual pages for
+details on configuring net-snmp for authentication information for
+the networking devices you wish to access.
+
+=head1 ABOUT THE EXAMLPES IN THIS DOCUMENT
+
+All the examples in this document are exact cut-n-pastes from the
+inside of the netsh shell.  This includes the "netsh> " prompt and
+possibly other prompts as well.
+
+=head1 COMMANDS
+
+The following is a list of the basic core commands supported by
+netsh.  Many default aliases are also supplied, some of which are
+listed in the next section.  At the command prompt type "alias" for
+a full list of all the aliases and their definitions.
+
+=over
+
+=item show columns from TABLE
+
+=item select ... 
+
+=item update ...
+
+=item insert ...
+
+=item delete ...
+
+netsh supports the standard sql-like language queries of snmp tables.
+These are implemented via the SQL::Statement parser, so any form of
+expression it accepts netsh will accept as well.
+
+Examples:
+
+  netsh> show columns from ifTable
+  +-----------------+
+  |           Column|
+  +-----------------+
+  |          ifIndex|
+  ...
+  netsh> select * from ifTable
+  ... [output not shown]
+  netsh> select tcpConnState, tcpConnRemotelAddress from tcpConnTable where tcpConnState = established
+  ... [output not shown]
+  netsh> update ifTable set ifAdminStatus = up where ifOperStatus = down
+  ... [output not shown]
+
+=item SNMPOBJECT
+
+Simple lists of objects may be given which will directly request or
+operate on those objects.  See printf below for controlling the
+formatting of results
+
+Examples:
+
+  netsh> sysContact.0, sysLocation.0
+  hardaker@somewhere.net my location
+  netsh> sysContact.0 = my new contact information
+
+=item alias my_command some other command
+
+or
+
+=back
+
+alias my_many_commands {
+  command1
+  command2
+  prompt NUMBER question
+
+}
+
+=over
+
+=item
+
+You can create aliases of your frequently used commands by aliasing
+them to an easy to remember name.  \N parameters in the defined
+command will be replaced by the positional argument of options passed
+to the alias name.
+
+For multi-line defined aliases, optional prompts may be given to
+request information from the user when the NUMBERth argument is not
+given to the alias.  If it is not given, the prompt will be printed
+and the user will be asked to input a value for it.  This allows the
+easy definition of interactive commands.  The value will be inserted
+in alias parts containing \N substitution requests.
+
+  netsh> alias interfaces select ifDescr from ifTable
+  netsh> interfaces
+  +-------+
+  |ifDescr|
+  +-------+
+  |     lo|
+  |   eth0|
+  +-------+
+  netsh> alias interface select ifDescr, ifSpeed from ifTable where ifDescr = '\1'
+  netsh> interface eth0
+  +-------+--------+
+  |ifDescr| ifSpeed|
+  +-------+--------+
+  |   eth0|10000000|
+  +-------+--------+
+
+=item printf FORMATSTRING COMMAND
+
+Allows B<careful> formatting of results returned by the commands.
+
+Example:
+
+  netsh> alias interface {
+  define interface> printf "interface %s is running at %d Mb/s\n" select ifDescr, ifSpeed from ifTable where ifDescr = '\1'
+  define interface> prompt 1 Enter the interface to describe:
+  define interface> }
+  netsh> interface
+  Enter the interface to describe: eth0
+  interface eth0 is running at 10000000 Mb/s
+
+To list the definition of an already defined command, simply exclude
+the definition and netsh will report the definition to you:
+
+  netsh> alias interface
+  alias interface {
+    printf "interface %s is running at %d Mb/s\n" select ifDescr, ifSpeed from ifTable where ifDescr = '\1'
+    prompt 1 Enter the interface to describe:
+  }
+
+To list all the aliases defined in the system, just type "alias" by itself.
+
+=item watch [TIME] COMMAND
+
+Continually watches the results of the COMMAND being run, which is run
+every TIME seconds.  For select statements, it will attempt to mark
+the changing values from one screen to the next by surrounding them
+with "*"s or color (assuming you have the Term::ANSIColor perl module
+installed) for easy picking out on the screen.
+
+=item rehash
+
+Re-load the alias definitions files in the common directory, as
+well as those files found in $HOME/.snmp/netsh.
+
+=item source FILE
+
+loads definitons and commands from FILE into the running environment.
+
+=back
+
+=head1 FILES
+
+By default, netsh will source all the definition files it can find.
+It does this by first reading everything in
+/usr/local/share/snmp/netsh/* and then reading everything in
+$HOME/.snmp/netsh/*.  Everything contained in these files are
+commands, but most frequently they entirely consist of aliases
+definitions.
+
+=head1 AUTHOR
+
+bugs, comments, questions to net-snmp-users@lists.sourceforge.net
+
+=head1 Copyright
+
+     Copyright (c) 2002 Networks Associates Technology, Inc. All
+     rights reserved.  This program is free software; you can
+     redistribute it and/or modify it under the same terms as Perl
+     itself.
+
+=cut
diff -Naur tomato/release/src/router/snmp/perl/AnyData_SNMP/README tomato121/release/src/router/snmp/perl/AnyData_SNMP/README
--- tomato/release/src/router/snmp/perl/AnyData_SNMP/README	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/perl/AnyData_SNMP/README	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,21 @@
+The AnyData::SNMP module is really an augmentation to Jeff Zucker's
+excellent perl AnyData and DBD::AnyData modules.  It is designed to
+allow the infamous perl DBI module to translate SQL commands directly
+into network SNMP requests and to manipulate the data in perl
+afterward.  See the perl DBI documentation for further details, as
+well as the AnyData documentation.
+
+The netsh command then implements a standard shell around the sql to
+SNMP mapping, such that commands like the following are possible:
+
+  netsh -c public localhost 'select ifIndex, ifDescr, ifType from ifTable'
+  netsh -c public localhost 'update ifTable set ifAdminStatus = 2 where ifType = 6'
+
+Without a command to run, netsh puts you into an interactive shell
+where the commands can be typed at a command prompt.
+
+See the INSTALL file for the necessary prerequisites.  Note that this
+currently makes use of a patched copy of the DBD::AnyData module.
+This will be fixed in future versions of both this module and the
+DBD::AnyData module as the authors worth toward a common
+infrastructure.
diff -Naur tomato/release/src/router/snmp/perl/AnyData_SNMP/Storage.pm tomato121/release/src/router/snmp/perl/AnyData_SNMP/Storage.pm
--- tomato/release/src/router/snmp/perl/AnyData_SNMP/Storage.pm	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/perl/AnyData_SNMP/Storage.pm	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,427 @@
+#########################################################################
+package AnyData::Storage::SNMP;
+#########################################################################
+
+## XXX: TODO:
+##   scalar sets?
+##   multi-hosts
+
+$AnyData::Storage::VERSION = '0.01';
+use strict;
+
+use vars qw(@basecols);
+
+@AnyData::Storage::SNMP::basecols = qw(hostname iid);
+$AnyData::Storage::SNMP::iidptr = 1; # must match array column of above
+@AnyData::Storage::SNMP::basetypes = qw(OCTETSTR OBJECTID);
+$AnyData::Storage::SNMP::debug = 0;
+$AnyData::Storage::SNMP::debugre = undef;
+
+use Data::Dumper;
+use AnyData::Storage::File;
+use SNMP;
+SNMP::init_snmp("AnyData::SNMP");
+
+sub new {
+#    DEBUG("calling AnyData::Storage::SNMP new\n");
+#    DEBUG("new storage: ",Dumper(\@_),"\n");
+    my $class = shift;
+    my $self  = shift || {};
+    $self->{open_mode} = 'c';
+    return bless $self, $class;
+}
+
+sub open_table {
+    DEBUG("calling AnyData::Storage::SNMP open_table\n");
+    my ($self, $parser, $table, $mode, $tname) = @_;
+    $self->{'process_table'} = $tname;
+    DEBUG("open_table: ",Dumper(\@_),"\n");
+}
+
+sub get_col_names {
+    DEBUG("calling AnyData::Storage::SNMP get_col_names\n");
+    my ($self, $parser, $tname) = @_;
+    DEBUG("get_col_names\n",Dumper(\@_),"\n");
+    $tname = $self->{'process_table'} if (!$tname);
+
+    # get cached previous results
+    return $self->{col_names}{$tname} if (defined($self->{col_names}{$tname}));
+
+    # table name
+    $tname = $self->{'process_table'} if (!$tname);
+
+    # mib node setup
+    my $mib = $SNMP::MIB{$tname} || return warn "no such table $tname";
+    my $entry = $mib->{'children'}[0];
+
+    # base columns and types
+    my @cols = @AnyData::Storage::SNMP::basecols;
+    my @types = @AnyData::Storage::SNMP::basetypes;
+    my %donecol;
+    my $count = $#cols;
+
+    foreach my $index (@{$entry->{'indexes'}}) {
+	push @cols, $index;
+	push @types, $SNMP::MIB{$index}{type};
+	$donecol{$index} = 1;
+	$count++;
+	if ($SNMP::MIB{$index}{parent}{label} eq $entry->{label}) {
+	    # this index is a member of this table
+	    $self->{columnmap}[$count] = $index;
+	    $self->{coloffset} += 1;
+	}
+    }
+
+    # search children list
+    foreach my $child  ( sort { $a->{'subID'} <=> $b->{'subID'} } @{$entry->{'children'}}) {
+	push @{$self->{real_cols}}, $child->{'label'};
+	next if ($donecol{$child->{label}});
+	push @cols, $child->{'label'};
+	push @types, $child->{'type'};
+	$count++;
+	$self->{columnmap}[$count] = $child->{'label'};
+    }
+
+    # save for later.
+    $parser->{col_names} = \@cols;
+    $self->{col_types} = \@types;
+    $self->{col_names} = \@cols;
+    map { $self->{col_uc_map}{uc($_)} = $_ } @cols;
+    return \@cols;
+}
+
+sub set_col_nums {
+    DEBUG("calling AnyData::Storage::SNMP set_col_nums\n");
+    DEBUG("set_col_nums\n",Dumper(\@_),"\n");
+    my ($self, $tname) = @_;
+    return $self->{col_nums} if (defined($self->{col_nums}));
+    my $mib = $SNMP::MIB{$tname};
+    my $entry = $mib->{'children'}[0];
+    my (%cols, %mibnodes);
+    my $cnt = -1;
+
+    foreach my $i (@{$self->{col_names}}) {
+	$cols{$i} = ++$cnt;
+    }
+
+    $self->{col_nums} = \%cols;
+    return \%cols;
+}
+
+# not needed?
+sub get_file_handle {
+    DEBUG("calling AnyData::Storage::SNMP get_file_handle\n");
+    DEBUG("get_file_handle\n",Dumper(\@_),"\n");
+    return shift;
+}
+
+# not needed?
+sub get_file_name {
+    DEBUG("calling AnyData::Storage::SNMP get_file_name\n");
+    DEBUG("get_file_name\n",Dumper(\@_),"\n");
+    my $self = shift;
+    return $self->{process_table} || $self->{table_name};
+}
+
+sub truncate {
+    DEBUG("calling AnyData::Storage::SNMP truncate\n");
+    my ($self) = @_;
+    DEBUG("trunacte, ", Dumper(@_));
+
+    # We must know how to delete rows or else this is all pointless.
+#     return $self->{col_nums}{$tname} if (defined($self->{col_nums}{$tname}));
+    my $tablemib = $SNMP::MIB{$self->{process_table}};
+    my $entrymib = $tablemib->{'children'}[0];
+    my ($delcolumn, $delcolumnname, $delcolumnvalue);
+
+    foreach my $child  (@{$entrymib->{'children'}}) {
+	if ($child->{'textualConvention'} eq 'RowStatus') {
+	    $delcolumn = $child->{subID};
+	    $delcolumnname = $child->{label};
+	    $delcolumnvalue = 6; # destroy
+	    last;
+	}
+    }
+    if (!$delcolumn) {
+	return warn "Can't (or don't know how to) delete from table $self->{process_table}.  Failing.\n";
+    }
+
+    # we should have a session, or else something is really wierd but...
+    $self->{'sess'} = $self->make_session() if (!$self->{'sess'});
+
+    # for each key left in our cache, delete it
+    foreach my $key (keys(%{$self->{'existtest'}})) {
+	# xxx: fullyqualified oid better
+	my $vblist = new SNMP::VarList([$delcolumnname, $key,
+					$delcolumnvalue]);
+	DEBUG("truncate $key: \n", Dumper($vblist));
+	$self->{'sess'}->set($vblist) || warn $self->{'sess'}->{ErrorStr};
+    }
+    return;
+}
+
+sub make_session {
+    DEBUG("calling AnyData::Storage::SNMP make_session\n");
+    my $self = shift;
+    my @args = @_;
+    my @sessions;
+    foreach my $key (qw(SecName Version SecLevel AuthPass Community RemotePort Timeout Retries RetryNoSuch SecEngineId ContextEngineId Context AuthProto PrivProto PrivPass)) {
+	push @args, $key, $self->{$key} if ($self->{$key});
+    }
+    foreach my $host (split(/,\s*/,$self->{DestHost})) {
+	push @sessions, new SNMP::Session(@args, 'DestHost' => $host);
+    }
+    return \@sessions;
+}
+
+sub file2str {
+    DEBUG("calling AnyData::Storage::SNMP file2str\n");
+    my ($self, $parser, $uccols) = @_;
+    my ($cols, @retcols);
+    DEBUG("file2str\n",Dumper(\@_),"\n");
+  restart:
+    if (!$self->{lastnode}) {
+#	my @vbstuff = @{$parser->{'col_names'}};
+#	splice (@vbstuff,0,1+$#AnyData::Storage::SNMP::basecols);
+#	map { $_ = [ $_ ] } @vbstuff;
+#	$self->{lastnode} = new SNMP::VarList(@vbstuff);
+#	splice (@$cols,0,1+$#AnyData::Storage::SNMP::basecols);
+	map { push @$cols,$self->{col_uc_map}{$_} } @$uccols;
+	if ($#$cols == -1) {
+	    $cols = $self->{'col_names'};
+	    # remove base columns
+	    splice (@$cols,0,1+$#AnyData::Storage::SNMP::basecols);
+	    # remove not accessible columns
+	    foreach my $col (@$cols) {
+		my $mib = $SNMP::MIB{$col};
+		push @retcols, $col if ($mib->{'access'} =~ /Read|Create/);
+	    }
+	} else {
+	    @retcols = @$cols;
+	    # remove base columns
+	    foreach my $c (@AnyData::Storage::SNMP::basecols) {
+		@retcols = grep(!/^$c$/, @retcols);
+	    }
+	    # remove non-accessible columns
+	    @retcols = grep {$SNMP::MIB{$_}{'access'} =~ /Read|Create/} @retcols;
+	}
+	map { $_ = [ $_ ] } @retcols;
+	$self->{lastnode} = new SNMP::VarList(@retcols);
+    }
+
+    if (!$self->{'sess'}) {
+	$self->{'sess'} = $self->make_session();
+	if ($#{$self->{'sess'}} == 0 && $self->{'silence_single_host'}) {
+	    $self->{'hostname'} = '';
+	} else {
+	    $self->{'hostname'} = $self->{'sess'}[0]{'DestHost'};
+	}
+    }
+
+    # perform SNMP operation
+    my $lastnode = $self->{'lastnode'}[0][0];
+    my $result;
+    $result = $self->{'sess'}[0]->getnext($self->{lastnode});
+    if (!defined($result)) {
+	warn " getnext of $self->{lastnode}[0][0] returned undef\n";
+    }
+    DEBUG(" result: ",Dumper($self->{lastnode}),"\n");
+
+    # XXX: check for holes!
+
+    # need proper oid compare here for all nodes
+    if ($self->{'lastnode'}[0][0] ne $lastnode) {
+	if ($#{$self->{'sess'}} > 0) {
+	    shift @{$self->{'sess'}};
+	    delete($self->{'lastnode'});
+	    @$cols = ();
+	    $self->{'hostname'} = $self->{'sess'}[0]{'DestHost'} if($self->{'hostname'});
+	    goto restart;
+	}
+	return undef;
+    }
+    
+    # add in basecols information:
+    my @ret = ($self->{'hostname'}, $self->{'lastnode'}[0][1]);
+    DEBUG("Dump row results: ",Dumper($self->{'lastnode'}),"\n");
+
+    # build result array from result varbind contents
+    map { $ret[$self->{'col_nums'}{$_->[0]}] = map_data($_); } @{$self->{'lastnode'}};
+
+    # store instance ID for later use if deletion is needed later.
+    $self->{'existtest'}{$self->{'lastnode'}[0][1]} = 1;
+
+    DEBUG("Dump row results2: ",Dumper(\@ret),"\n");
+    return \@ret;
+}
+
+sub map_data {
+    if ($_->[3] eq "OBJECTID") {
+	$_->[2] = pretty_print_oid(@_);
+    }
+    return $_->[2];
+}
+
+sub pretty_print_oid {
+    use NetSNMP::default_store qw(:all);
+    netsnmp_ds_set_boolean(NETSNMP_DS_LIBRARY_ID, 
+			   NETSNMP_DS_LIB_DONT_BREAKDOWN_OIDS,0);
+    my $new = SNMP::translateObj($_->[2], 0);
+    netsnmp_ds_set_boolean(NETSNMP_DS_LIBRARY_ID, 
+			   NETSNMP_DS_LIB_DONT_BREAKDOWN_OIDS,1);
+    my $new2 = SNMP::translateObj($_->[2], 0);
+    if ($new) {
+	$_->[2] = $new2 . "$new";
+    } else {
+	$_->[2] = $_->[0] . $_->[1];
+    }
+    return $_->[2];
+}
+
+sub push_row {
+    DEBUG("calling AnyData::Storage::SNMP push_row\n");
+    DEBUG("push_row: ",Dumper(\@_),"\n");
+    DEBUG("push_row\n");
+    my ($self, $values, $parser, $cols) = @_;
+    my @callers = caller(3);
+    my $mode = $callers[3];
+    if ($mode =~ /DELETE/) {
+	DEBUG("not deleting $values->[$AnyData::Storage::SNMP::iidptr]\n");
+	delete $self->{'existtest'}{$values->[$AnyData::Storage::SNMP::iidptr]};
+	return;
+    }
+
+    my @origvars;
+    if ($#$cols == -1) {
+	# no column info passed in.  Update everything (mode probably INSERTS).
+#	@origvars = @{$self->{'col_names'}}};
+#	splice (@origvars,0,1+$#AnyData::Storage::SNMP::basecols);
+	
+	map { push @origvars, $_ if $SNMP::MIB{$_}{'access'} =~ /Write|Create/; } @{$self->{'real_cols'}} ;
+
+	DEBUG("set cols: ", Dumper(\@origvars));
+    } else {
+	# only update the columns in question.  (mode probably UPDATE)
+	map { push @origvars, $self->{col_uc_map}{$_} } @$cols;
+    }
+
+    my @vars;
+    foreach my $var (@origvars) {
+	my $access = $SNMP::MIB{$var}{'access'};
+	# not in this table, probably (hopefully) an index from another:
+	next if ($SNMP::MIB{$var}{'parent'}{'parent'}{'label'} ne 
+		 $self->{process_table});
+	DEBUG("$var -> $access\n");
+	if ($access =~ /(Write|Create)/) {
+	    push @vars, $var;
+	} elsif ($mode eq 'insert') {
+	    DEBUG("XXX: error if not index\n");
+	} elsif ($mode eq 'update') {
+	    DEBUG("update to non-writable column attempted (SNMP error coming)\n");	
+	}
+    }
+
+    # generate index OID component if we don't have it.
+    if ($values->[$AnyData::Storage::SNMP::iidptr] eq '') {
+	$values->[$AnyData::Storage::SNMP::iidptr] = 
+	    $self->make_iid($self->{process_table}, $values);
+    }
+
+    # add in values to varbind columns passed in from incoming parameters
+    my @newvars;
+    foreach my $v (@vars) {
+	my $num = $self->{'col_nums'}{$v};
+	DEBUG("types: $v -> $num -> ", $self->{'col_types'}[$num], 
+	      " -> val=", $values->[$num], "\n");
+	next if (!defined($values->[$num]));
+	# build varbind: column-oid, instance-id, value type, value
+	push @newvars, [$v, $values->[1], $values->[$num],
+			$self->{'col_types'}[$num]];
+    };
+
+    # create the varbindlist
+#    print STDERR Dumper(\@newvars);
+    my $vblist = new SNMP::VarList(@newvars);
+
+#    print STDERR Dumper($vblist);
+    DEBUG("set: ", Dumper($vblist));
+    $self->{'sess'} = $self->make_session() if (!$self->{'sess'});
+    if (!$self->{'sess'}[0]) {
+	warn "couldn't create SNMP session";
+    } elsif (!$self->{'sess'}[0]->set($vblist)) {
+	my $err = "$self->{process_table}: " . $self->{'sess'}[0]->{ErrorStr};
+	if ($self->{'sess'}[0]->{ErrorInd}) {
+	    $err = $err . " (at varbind #" 
+		. $self->{'sess'}[0]->{ErrorInd}  . " = " ;
+	    my $dump = Data::Dumper->new([$vblist->[$self->{'sess'}[0]->{ErrorInd} -1]]);
+	    $err .= $dump->Indent(0)->Terse(1)->Dump;
+	}
+	warn $err;
+    }
+}
+
+sub seek {
+    DEBUG("calling AnyData::Storage::SNMP seek\n");
+    my ($self, $parser) = @_;
+    DEBUG("seek\n",Dumper(\@_),"\n");
+}
+
+sub make_iid {
+    DEBUG("calling AnyData::Storage::SNMP make_iid\n");
+    my ($self, $tname, $vals) = @_;
+    
+    # Get indexes
+    my $mib = $SNMP::MIB{$tname};
+    my $entry = $mib->{'children'}[0];
+    my $indexes = $entry->{'indexes'};
+    my $iid;
+
+    # XXX: implied
+
+#    print STDERR "INDEXES: ", Dumper($vals),"\n";
+    foreach my $index (@$indexes) {
+	warn "A null index value was found, which I doubt is correct." if (!defined($vals->[$self->{col_nums}{$index}]));
+	my $val = $vals->[$self->{col_nums}{$index}];
+	my $type = $SNMP::MIB{$index}->{'type'};
+	DEBUG("index type: $index -> $type -> $val -> " . length($val) . "\n");
+	if ($type eq "OCTETSTR") {
+	    $iid .= "." . length($val) . "." . join(".", unpack("c*", $val));
+	} elsif ($type eq "OBJID") {
+	    $iid .= "." . (scalar grep(/\./,$val) + 1) . "." . $val;
+	} else {
+	    # should be only an INTEGER?
+	    $iid .= "." . $val;
+	}
+    }
+    DEBUG("made iid: $iid\n");
+    return $iid;
+}
+
+sub DEBUG {
+    my @info = caller(1);
+    if ($AnyData::Storage::SNMP::debug
+	|| ($AnyData::Storage::SNMP::debugre &&
+	    $_[0] =~ /$AnyData::Storage::SNMP::debugre/)) {
+	DEBUGIT(\@info, @_);
+    }
+}
+
+sub DEBUGIT {
+    my $info;
+    if (ref($_[0]) eq 'ARRAY') {
+	$info = shift @_;
+    } else {
+	my @y;
+	my $c=0;
+	print STDERR "debug chain: ";
+	for(@y = caller($c); $#y > -1; $c++, @y = caller($c)) {
+	    print STDERR "  $c: $y[3]\n";
+	}
+	my @x = caller(1);
+	$info = \@x;
+    }
+    print STDERR "$info->[3]: ";
+    print STDERR @_;
+}
+
+1;
diff -Naur tomato/release/src/router/snmp/perl/ASN/ASN.pm tomato121/release/src/router/snmp/perl/ASN/ASN.pm
--- tomato/release/src/router/snmp/perl/ASN/ASN.pm	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/perl/ASN/ASN.pm	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,164 @@
+package NetSNMP::ASN;
+
+use strict;
+use Carp;
+
+require Exporter;
+require DynaLoader;
+use AutoLoader;
+
+use vars qw(@ISA %EXPORT_TAGS @EXPORT_OK @EXPORT $VERSION $AUTOLOAD);
+
+@ISA = qw(Exporter DynaLoader);
+
+# Items to export into callers namespace by default. Note: do not export
+# names by default without a very good reason. Use EXPORT_OK instead.
+# Do not simply export all your public functions/methods/constants.
+
+# This allows declaration	use NetSNMP::ASN ':all';
+# If you do not need this, moving things directly into @EXPORT or @EXPORT_OK
+# will save memory.
+%EXPORT_TAGS = ( 'all' => [ qw(
+	ASN_APPLICATION
+	ASN_BIT_STR
+	ASN_BOOLEAN
+	ASN_COUNTER
+	ASN_COUNTER64
+	ASN_DOUBLE
+	ASN_FLOAT
+	ASN_GAUGE
+	ASN_INTEGER
+	ASN_INTEGER64
+	ASN_IPADDRESS
+	ASN_NULL
+	ASN_OBJECT_ID
+	ASN_OCTET_STR
+	ASN_OPAQUE
+	ASN_SEQUENCE
+	ASN_SET
+	ASN_TIMETICKS
+	ASN_UNSIGNED
+	ASN_UNSIGNED64
+) ] );
+
+@EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } );
+
+@EXPORT = qw(
+	ASN_APPLICATION
+	ASN_BIT_STR
+	ASN_BOOLEAN
+	ASN_COUNTER
+	ASN_COUNTER64
+	ASN_DOUBLE
+	ASN_FLOAT
+	ASN_GAUGE
+	ASN_INTEGER
+	ASN_INTEGER64
+	ASN_IPADDRESS
+	ASN_NULL
+	ASN_OBJECT_ID
+	ASN_OCTET_STR
+	ASN_OPAQUE
+	ASN_SEQUENCE
+	ASN_SET
+	ASN_TIMETICKS
+	ASN_UNSIGNED
+	ASN_UNSIGNED64
+);
+$VERSION = '0.01';
+
+sub AUTOLOAD {
+    # This AUTOLOAD is used to 'autoload' constants from the constant()
+    # XS function.  If a constant is not found then control is passed
+    # to the AUTOLOAD in AutoLoader.
+
+    my $constname;
+    ($constname = $AUTOLOAD) =~ s/.*:://;
+    croak "& not defined" if $constname eq 'constant';
+    my $val = constant($constname, @_ ? $_[0] : 0);
+    if ($! != 0) {
+	if ($! =~ /Invalid/ || $!{EINVAL}) {
+	    $AutoLoader::AUTOLOAD = $AUTOLOAD;
+	    goto &AutoLoader::AUTOLOAD;
+	}
+	else {
+	    croak "Your vendor has not defined NetSNMP::ASN macro $constname";
+	}
+    }
+    {
+	no strict 'refs';
+	# Fixed between 5.005_53 and 5.005_61
+# 	if ($] >= 5.00561) {
+# 	    *$AUTOLOAD = sub () { $val };
+# 	}
+# 	else {
+	    *$AUTOLOAD = sub { $val };
+# 	}
+    }
+    goto &$AUTOLOAD;
+}
+
+bootstrap NetSNMP::ASN $VERSION;
+
+# Preloaded methods go here.
+
+# Autoload methods go after =cut, and are processed by the autosplit program.
+
+1;
+__END__
+# Below is stub documentation for your module. You better edit it!
+
+=head1 NAME
+
+NetSNMP::ASN - Perl extension for blah blah blah
+
+=head1 SYNOPSIS
+
+  use NetSNMP::ASN;
+  blah blah blah
+
+=head1 DESCRIPTION
+
+Stub documentation for NetSNMP::ASN, created by h2xs. It looks like the
+author of the extension was negligent enough to leave the stub
+unedited.
+
+Blah blah blah.
+
+=head2 EXPORT
+
+None by default.
+
+=head2 Exportable constants
+
+  ASN_APPLICATION
+  ASN_BIT_STR
+  ASN_BOOLEAN
+  ASN_COUNTER
+  ASN_COUNTER64
+  ASN_DOUBLE
+  ASN_FLOAT
+  ASN_GAUGE
+  ASN_INTEGER
+  ASN_INTEGER64
+  ASN_IPADDRESS
+  ASN_NULL
+  ASN_OBJECT_ID
+  ASN_OCTET_STR
+  ASN_OPAQUE
+  ASN_SEQUENCE
+  ASN_SET
+  ASN_TIMETICKS
+  ASN_UNSIGNED
+  ASN_UNSIGNED64
+
+
+=head1 AUTHOR
+
+A. U. Thor, a.u.thor@a.galaxy.far.far.away
+
+=head1 SEE ALSO
+
+perl(1).
+
+=cut
diff -Naur tomato/release/src/router/snmp/perl/ASN/ASN.xs tomato121/release/src/router/snmp/perl/ASN/ASN.xs
--- tomato/release/src/router/snmp/perl/ASN/ASN.xs	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/perl/ASN/ASN.xs	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,344 @@
+/* -*- C -*- */
+#include "EXTERN.h"
+#include "perl.h"
+#include "XSUB.h"
+
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/library/asn1.h>
+#include <net-snmp/library/snmp_impl.h>
+
+static int
+not_here(char *s)
+{
+    croak("%s not implemented on this architecture", s);
+    return -1;
+}
+
+static double
+constant_ASN_O(char *name, int len, int arg)
+{
+    switch (name[5 + 0]) {
+    case 'B':
+	if (strEQ(name + 5, "BJECT_ID")) {	/* ASN_O removed */
+#ifdef ASN_OBJECT_ID
+	    return ASN_OBJECT_ID;
+#else
+	    goto not_there;
+#endif
+	}
+    case 'C':
+	if (strEQ(name + 5, "CTET_STR")) {	/* ASN_O removed */
+#ifdef ASN_OCTET_STR
+	    return ASN_OCTET_STR;
+#else
+	    goto not_there;
+#endif
+	}
+    case 'P':
+	if (strEQ(name + 5, "PAQUE")) {	/* ASN_O removed */
+#ifdef ASN_OPAQUE
+	    return ASN_OPAQUE;
+#else
+	    goto not_there;
+#endif
+	}
+    }
+    errno = EINVAL;
+    return 0;
+
+not_there:
+    errno = ENOENT;
+    return 0;
+}
+
+static double
+constant_ASN_B(char *name, int len, int arg)
+{
+    switch (name[5 + 0]) {
+    case 'I':
+	if (strEQ(name + 5, "IT_STR")) {	/* ASN_B removed */
+#ifdef ASN_BIT_STR
+	    return ASN_BIT_STR;
+#else
+	    goto not_there;
+#endif
+	}
+    case 'O':
+	if (strEQ(name + 5, "OOLEAN")) {	/* ASN_B removed */
+#ifdef ASN_BOOLEAN
+	    return ASN_BOOLEAN;
+#else
+	    goto not_there;
+#endif
+	}
+    }
+    errno = EINVAL;
+    return 0;
+
+not_there:
+    errno = ENOENT;
+    return 0;
+}
+
+static double
+constant_ASN_S(char *name, int len, int arg)
+{
+    if (5 + 1 >= len ) {
+	errno = EINVAL;
+	return 0;
+    }
+    switch (name[5 + 1]) {
+    case 'Q':
+	if (strEQ(name + 5, "EQUENCE")) {	/* ASN_S removed */
+#ifdef ASN_SEQUENCE
+	    return ASN_SEQUENCE;
+#else
+	    goto not_there;
+#endif
+	}
+    case 'T':
+	if (strEQ(name + 5, "ET")) {	/* ASN_S removed */
+#ifdef ASN_SET
+	    return ASN_SET;
+#else
+	    goto not_there;
+#endif
+	}
+    }
+    errno = EINVAL;
+    return 0;
+
+not_there:
+    errno = ENOENT;
+    return 0;
+}
+
+static double
+constant_ASN_C(char *name, int len, int arg)
+{
+    if (5 + 6 > len ) {
+	errno = EINVAL;
+	return 0;
+    }
+    switch (name[5 + 6]) {
+    case '\0':
+	if (strEQ(name + 5, "OUNTER")) {	/* ASN_C removed */
+#ifdef ASN_COUNTER
+	    return ASN_COUNTER;
+#else
+	    goto not_there;
+#endif
+	}
+    case '6':
+	if (strEQ(name + 5, "OUNTER64")) {	/* ASN_C removed */
+#ifdef ASN_COUNTER64
+	    return ASN_COUNTER64;
+#else
+	    goto not_there;
+#endif
+	}
+    }
+    errno = EINVAL;
+    return 0;
+
+not_there:
+    errno = ENOENT;
+    return 0;
+}
+
+static double
+constant_ASN_U(char *name, int len, int arg)
+{
+    if (5 + 7 > len ) {
+	errno = EINVAL;
+	return 0;
+    }
+    switch (name[5 + 7]) {
+    case '\0':
+	if (strEQ(name + 5, "NSIGNED")) {	/* ASN_U removed */
+#ifdef ASN_UNSIGNED
+	    return ASN_UNSIGNED;
+#else
+	    goto not_there;
+#endif
+	}
+    case '6':
+	if (strEQ(name + 5, "NSIGNED64")) {	/* ASN_U removed */
+#ifdef ASN_UNSIGNED64
+	    return ASN_UNSIGNED64;
+#else
+	    goto not_there;
+#endif
+	}
+    }
+    errno = EINVAL;
+    return 0;
+
+not_there:
+    errno = ENOENT;
+    return 0;
+}
+
+static double
+constant_ASN_IN(char *name, int len, int arg)
+{
+    if (6 + 5 > len ) {
+	errno = EINVAL;
+	return 0;
+    }
+    switch (name[6 + 5]) {
+    case '\0':
+	if (strEQ(name + 6, "TEGER")) {	/* ASN_IN removed */
+#ifdef ASN_INTEGER
+	    return ASN_INTEGER;
+#else
+	    goto not_there;
+#endif
+	}
+    case '6':
+	if (strEQ(name + 6, "TEGER64")) {	/* ASN_IN removed */
+#ifdef ASN_INTEGER64
+	    return ASN_INTEGER64;
+#else
+	    goto not_there;
+#endif
+	}
+    }
+    errno = EINVAL;
+    return 0;
+
+not_there:
+    errno = ENOENT;
+    return 0;
+}
+
+static double
+constant_ASN_I(char *name, int len, int arg)
+{
+    switch (name[5 + 0]) {
+    case 'N':
+	return constant_ASN_IN(name, len, arg);
+    case 'P':
+	if (strEQ(name + 5, "PADDRESS")) {	/* ASN_I removed */
+#ifdef ASN_IPADDRESS
+	    return ASN_IPADDRESS;
+#else
+	    goto not_there;
+#endif
+	}
+    }
+    errno = EINVAL;
+    return 0;
+
+not_there:
+    errno = ENOENT;
+    return 0;
+}
+
+static double
+constant(char *name, int len, int arg)
+{
+    errno = 0;
+    if (0 + 4 >= len ) {
+	errno = EINVAL;
+	return 0;
+    }
+    switch (name[0 + 4]) {
+    case 'A':
+	if (strEQ(name + 0, "ASN_APPLICATION")) {	/*  removed */
+#ifdef ASN_APPLICATION
+	    return ASN_APPLICATION;
+#else
+	    goto not_there;
+#endif
+	}
+    case 'B':
+	if (!strnEQ(name + 0,"ASN_", 4))
+	    break;
+	return constant_ASN_B(name, len, arg);
+    case 'C':
+	if (!strnEQ(name + 0,"ASN_", 4))
+	    break;
+	return constant_ASN_C(name, len, arg);
+    case 'D':
+	if (strEQ(name + 0, "ASN_DOUBLE")) {	/*  removed */
+#ifdef ASN_DOUBLE
+	    return ASN_DOUBLE;
+#else
+	    goto not_there;
+#endif
+	}
+    case 'F':
+	if (strEQ(name + 0, "ASN_FLOAT")) {	/*  removed */
+#ifdef ASN_FLOAT
+	    return ASN_FLOAT;
+#else
+	    goto not_there;
+#endif
+	}
+    case 'G':
+	if (strEQ(name + 0, "ASN_GAUGE")) {	/*  removed */
+#ifdef ASN_GAUGE
+	    return ASN_GAUGE;
+#else
+	    goto not_there;
+#endif
+	}
+    case 'I':
+	if (!strnEQ(name + 0,"ASN_", 4))
+	    break;
+	return constant_ASN_I(name, len, arg);
+    case 'N':
+	if (strEQ(name + 0, "ASN_NULL")) {	/*  removed */
+#ifdef ASN_NULL
+	    return ASN_NULL;
+#else
+	    goto not_there;
+#endif
+	}
+    case 'O':
+	if (!strnEQ(name + 0,"ASN_", 4))
+	    break;
+	return constant_ASN_O(name, len, arg);
+    case 'S':
+	if (!strnEQ(name + 0,"ASN_", 4))
+	    break;
+	return constant_ASN_S(name, len, arg);
+    case 'T':
+	if (strEQ(name + 0, "ASN_TIMETICKS")) {	/*  removed */
+#ifdef ASN_TIMETICKS
+	    return ASN_TIMETICKS;
+#else
+	    goto not_there;
+#endif
+	}
+    case 'U':
+	if (!strnEQ(name + 0,"ASN_", 4))
+	    break;
+	return constant_ASN_U(name, len, arg);
+    }
+    errno = EINVAL;
+    return 0;
+
+not_there:
+    errno = ENOENT;
+    return 0;
+}
+
+
+MODULE = NetSNMP::ASN		PACKAGE = NetSNMP::ASN		
+
+
+double
+constant(sv,arg)
+    PREINIT:
+	STRLEN		len;
+    INPUT:
+	SV *		sv
+	char *		s = SvPV(sv, len);
+	int		arg
+    CODE:
+	RETVAL = constant(s,len,arg);
+    OUTPUT:
+	RETVAL
+
diff -Naur tomato/release/src/router/snmp/perl/ASN/Changes tomato121/release/src/router/snmp/perl/ASN/Changes
--- tomato/release/src/router/snmp/perl/ASN/Changes	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/perl/ASN/Changes	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,6 @@
+Revision history for Perl extension NetSNMP::ASN.
+
+0.01  Fri Jan 18 10:33:43 2002
+	- original version; created by h2xs 1.20 with options
+		-n NetSNMP::ASN myconst.h
+
diff -Naur tomato/release/src/router/snmp/perl/ASN/.cvsignore tomato121/release/src/router/snmp/perl/ASN/.cvsignore
--- tomato/release/src/router/snmp/perl/ASN/.cvsignore	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/perl/ASN/.cvsignore	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,5 @@
+ASN.bs
+ASN.c
+Makefile
+blib
+pm_to_blib
diff -Naur tomato/release/src/router/snmp/perl/ASN/Makefile.PL tomato121/release/src/router/snmp/perl/ASN/Makefile.PL
--- tomato/release/src/router/snmp/perl/ASN/Makefile.PL	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/perl/ASN/Makefile.PL	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,140 @@
+use ExtUtils::MakeMaker;
+require 5;
+use Config;
+use Getopt::Long;
+
+# See lib/ExtUtils/MakeMaker.pm for details of how to influence
+# the contents of the Makefile that is written.
+
+%MakeParams = InitMakeParams();
+
+WriteMakefile(%MakeParams);
+
+sub InitMakeParams {
+    my $opts;
+    my %Params = (
+		  'NAME'		=> 'NetSNMP::ASN',
+		  'VERSION_FROM'	=> 'ASN.pm', # finds $VERSION
+		  'XSPROTOARG'          => '-prototypes',
+		  'PREREQ_PM'           => {},
+		  );
+    my ($snmp_lib, $snmp_llib, $sep);
+
+    if ($Config{'osname'} eq 'MSWin32') {
+      $opts = NetSNMPGetOpts();	
+      $snmp_lib = 'libsnmp.lib';
+      $snmp_link_lib = 'libsnmp';
+      $sep = '\\';
+
+      $Params{'DEFINE'} = "-DMSVC_PERL";
+      
+      if ($opts->{'insource'}) {
+	$Params{'LIBS'} = "-L$basedir\\win32\\lib\\ -l$snmp_link_lib";
+      }
+      else {
+	my @LibDirs = split (';',$ENV{LIB});
+	if ($opts->{'prefix'}) {
+	  push (@LibDirs,"$ENV{'NET-SNMP-PATH'}${sep}lib");
+	}
+	$noLibDir = 1;
+	while ($noLibDir) {
+	  $LibDir = find_files(["$snmp_lib"],\@LibDirs);
+	  if ($LibDir ne '') {
+	    $noLibDir = 0;
+	  }
+	  else
+	  {
+	    @LibDirs = ();
+	    @LibDirs[0] = prompt("The Net-SNMP library ($snmp_lib) could not be found.\nPlease enter the directory where it is located:");
+	    @LibDirs[0] =~ s/\\$//;
+	  }
+	}
+	$Params{LIBS} = "-L$LibDir -l$snmp_link_lib";
+      }
+
+      $Params{'INC'} = "-I$basedir\\include\\ -I$basedir\\include\\net-snmp\\ -I$basedir\\win32\\ ";
+    }
+    else
+    {
+      $opts = NetSNMPGetOpts();
+      $Params{'LIBS'}    = `$opts->{'nsconfig'} --libs`;
+      chomp($Params{'LIBS'});
+      $Params{'CCFLAGS'} = `$opts->{'nsconfig'} --cflags`;
+      chomp($Params{'CCFLAGS'});
+      $Params{'CCFLAGS'} .= " " . $Config{'ccflags'};
+      
+      if ($opts->{'insource'} eq "true") {
+	$Params{'LIBS'} = "-L../../snmplib/.libs -L../../snmplib/ " . $Params{'LIBS'};
+	$Params{'CCFLAGS'} = "-I../../include " . $Params{'CCFLAGS'};
+      }
+      $Params{'CCFLAGS'} =~ s/ -W[-\w]+//g; # ignore developer warnings
+      if ($Params{'LIBS'} eq "" || $Params{'CCFLAGS'} eq "") {
+	die "You need to install net-snmp first (I can't find net-snmp-config)";
+      }
+    }
+    return (%Params);
+}
+# common subroutines -- DO NOT EDIT.
+# They are imported from the Makefile.subs.pl file
+sub NetSNMPGetOpts {
+    my %ret;
+    my $rootpath = shift;
+    $rootpath = "../" if (!$rootpath);
+    $rootpath .= '/' if ($rootpath !~ /\/$/);
+    
+    if ($Config{'osname'} eq 'MSWin32') {
+      if ($ENV{'NET-SNMP-IN-SOURCE'})
+      {
+	$ret{'insource'} = $ENV{'NET-SNMP-IN-SOURCE'};
+      }
+      elsif ($ENV{'NET-SNMP-PATH'})
+      {
+	$ret{'prefix'} = $ENV{'NET-SNMP-PATH'};
+      }
+      else
+      {
+	# don't have env vars, pull from command line and put there
+	GetOptions("NET-SNMP-IN-SOURCE=s" => \$ret{'insource'},
+	           "NET-SNMP-PATH=s"      => \$ret{'prefix'});
+
+	$ENV{'NET-SNMP-IN-SOURCE'}    = $ret{'insource'};
+	$ENV{'NET-SNMP-PATH'}         = $ret{'prefix'};
+      }
+
+      $basedir = `%COMSPEC% /c cd`;
+      chomp $basedir;
+      $basedir =~ /(.*?)\\perl.*/;
+      $basedir = $1;
+      print "Net-SNMP base directory: $basedir\n";
+
+    }
+    else
+    {
+      if ($ENV{'NET-SNMP-CONFIG'} && 
+        $ENV{'NET-SNMP-IN-SOURCE'}) {
+	# have env vars, pull from there
+	$ret{'nsconfig'} = $ENV{'NET-SNMP-CONFIG'};
+	$ret{'insource'} = $ENV{'NET-SNMP-IN-SOURCE'};
+      } else {
+	# don't have env vars, pull from command line and put there
+	GetOptions("NET-SNMP-CONFIG=s" => \$ret{'nsconfig'},
+	           "NET-SNMP-IN-SOURCE=s" => \$ret{'insource'});
+
+	if ($ret{'insource'} eq "true" && $ret{'nsconfig'} eq "") {
+	    $ret{'nsconfig'}="sh ROOTPATH../net-snmp-config";
+	} elsif ($ret{'nsconfig'} eq "") {
+	    $ret{'nsconfig'}="net-snmp-config";
+	}
+
+	$ENV{'NET-SNMP-CONFIG'}    = $ret{'nsconfig'};
+	$ENV{'NET-SNMP-IN-SOURCE'} = $ret{'insource'};
+      }
+    }	
+    
+    $ret{'nsconfig'} =~ s/ROOTPATH/$rootpath/;
+
+    $ret{'rootpath'} = $rootpath;
+
+    \%ret;
+}
+
diff -Naur tomato/release/src/router/snmp/perl/ASN/MANIFEST tomato121/release/src/router/snmp/perl/ASN/MANIFEST
--- tomato/release/src/router/snmp/perl/ASN/MANIFEST	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/perl/ASN/MANIFEST	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,6 @@
+ASN.pm
+ASN.xs
+Changes
+MANIFEST
+Makefile.PL
+test.pl
diff -Naur tomato/release/src/router/snmp/perl/ASN/test.pl tomato121/release/src/router/snmp/perl/ASN/test.pl
--- tomato/release/src/router/snmp/perl/ASN/test.pl	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/perl/ASN/test.pl	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,28 @@
+# Before `make install' is performed this script should be runnable with
+# `make test'. After `make install' it should work as `perl test.pl'
+
+######################### We start with some black magic to print on failure.
+
+# Change 1..1 below to 1..last_test_to_print .
+# (It may become useful if the test is moved to ./t subdirectory.)
+
+BEGIN { $| = 1; print "1..9\n"; }
+END {print "not ok 1\n" unless $loaded;}
+use NetSNMP::ASN (':all');
+$loaded = 1;
+print "ok 1\n";
+
+######################### End of black magic.
+
+# Insert your test code below (better if it prints "ok 13"
+# (correspondingly "not ok 13") depending on the success of chunk 13
+# of the test code):
+
+print ((ASN_INTEGER == 2) ? "ok 2\n" : "not ok 2\n");
+print ((ASN_OCTET_STR == 4) ? "ok 3\n" : "not ok 3\bn");
+print ((ASN_COUNTER == 0x41) ? "ok 4\n" : "not ok 4\n");
+print ((ASN_UNSIGNED == 0x42) ? "ok 5\n" : "not ok 5\n");
+print ((ASN_COUNTER64 == 0x46) ? "ok 6\n" : "not ok 6\n");
+print ((ASN_IPADDRESS == 0x40) ? "ok 7\n" : "not ok 7\n");
+print ((ASN_NULL == 5) ? "ok 8\n" : "not ok 8\n");
+print ((ASN_TIMETICKS == 0x43) ? "ok 9\n" : "not ok 9\n");
diff -Naur tomato/release/src/router/snmp/perl/.cvsignore tomato121/release/src/router/snmp/perl/.cvsignore
--- tomato/release/src/router/snmp/perl/.cvsignore	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/perl/.cvsignore	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,3 @@
+Makefile
+blib
+pm_to_blib
diff -Naur tomato/release/src/router/snmp/perl/default_store/Changes tomato121/release/src/router/snmp/perl/default_store/Changes
--- tomato/release/src/router/snmp/perl/default_store/Changes	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/perl/default_store/Changes	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,6 @@
+Revision history for Perl extension NetSNMP::default_store.
+
+0.01  Thu Jan  3 22:35:38 2002
+	- original version; created by h2xs 1.20 with options
+		-F '-Du_char="unsigned char"' -x -O -n NetSNMP::default_store ucd-snmp/default_store.h
+
diff -Naur tomato/release/src/router/snmp/perl/default_store/.cvsignore tomato121/release/src/router/snmp/perl/default_store/.cvsignore
--- tomato/release/src/router/snmp/perl/default_store/.cvsignore	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/perl/default_store/.cvsignore	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,5 @@
+Makefile
+blib
+default_store.bs
+default_store.c
+pm_to_blib
diff -Naur tomato/release/src/router/snmp/perl/default_store/default_store.pm tomato121/release/src/router/snmp/perl/default_store/default_store.pm
--- tomato/release/src/router/snmp/perl/default_store/default_store.pm	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/perl/default_store/default_store.pm	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,293 @@
+package NetSNMP::default_store;
+
+use strict;
+use Carp;
+
+require Exporter;
+require DynaLoader;
+use AutoLoader;
+
+use vars qw(@ISA %EXPORT_TAGS @EXPORT_OK @EXPORT $VERSION $AUTOLOAD);
+
+@ISA = qw(Exporter DynaLoader);
+
+# Items to export into callers namespace by default. Note: do not export
+# names by default without a very good reason. Use EXPORT_OK instead.
+# Do not simply export all your public functions/methods/constants.
+
+# This allows declaration	use NetSNMP::default_store ':all';
+# If you do not need this, moving things directly into @EXPORT or @EXPORT_OK
+# will save memory.
+%EXPORT_TAGS = ( 'all' => [ qw(
+				   NETSNMP_DS_MAX_IDS
+				   NETSNMP_DS_MAX_SUBIDS
+				   NETSNMP_DS_LIBRARY_ID
+				   NETSNMP_DS_APPLICATION_ID
+				   NETSNMP_DS_TOKEN_ID
+				   NETSNMP_DS_LIB_MIB_ERRORS
+				   NETSNMP_DS_LIB_SAVE_MIB_DESCRS
+				   NETSNMP_DS_LIB_MIB_COMMENT_TERM
+				   NETSNMP_DS_LIB_MIB_PARSE_LABEL
+				   NETSNMP_DS_LIB_DUMP_PACKET
+				   NETSNMP_DS_LIB_LOG_TIMESTAMP
+				   NETSNMP_DS_LIB_DONT_READ_CONFIGS
+				   NETSNMP_DS_LIB_MIB_REPLACE
+				   NETSNMP_DS_LIB_PRINT_NUMERIC_ENUM
+				   NETSNMP_DS_LIB_PRINT_NUMERIC_OIDS
+				   NETSNMP_DS_LIB_DONT_BREAKDOWN_OIDS
+				   NETSNMP_DS_LIB_ALARM_DONT_USE_SIG
+				   NETSNMP_DS_LIB_PRINT_FULL_OID
+				   NETSNMP_DS_LIB_QUICK_PRINT
+				   NETSNMP_DS_LIB_RANDOM_ACCESS
+				   NETSNMP_DS_LIB_REGEX_ACCESS
+				   NETSNMP_DS_LIB_DONT_CHECK_RANGE
+				   NETSNMP_DS_LIB_NO_TOKEN_WARNINGS
+				   NETSNMP_DS_LIB_NUMERIC_TIMETICKS
+				   NETSNMP_DS_LIB_ESCAPE_QUOTES
+				   NETSNMP_DS_LIB_REVERSE_ENCODE
+				   NETSNMP_DS_LIB_PRINT_BARE_VALUE
+				   NETSNMP_DS_LIB_EXTENDED_INDEX
+				   NETSNMP_DS_LIB_PRINT_HEX_TEXT
+				   NETSNMP_DS_LIB_PRINT_UCD_STYLE_OID
+				   NETSNMP_DS_LIB_READ_UCD_STYLE_OID
+				   NETSNMP_DS_LIB_HAVE_READ_PREMIB_CONFIG
+				   NETSNMP_DS_LIB_HAVE_READ_CONFIG
+				   NETSNMP_DS_LIB_QUICKE_PRINT
+				   NETSNMP_DS_LIB_MIB_WARNINGS
+				   NETSNMP_DS_LIB_SECLEVEL
+				   NETSNMP_DS_LIB_SNMPVERSION
+				   NETSNMP_DS_LIB_DEFAULT_PORT
+				   NETSNMP_DS_LIB_OID_OUTPUT_FORMAT
+				   NETSNMP_DS_SNMP_VERSION_1
+				   NETSNMP_DS_SNMP_VERSION_2c
+				   NETSNMP_DS_SNMP_VERSION_3
+				   NETSNMP_DS_LIB_SECNAME
+				   NETSNMP_DS_LIB_CONTEXT
+				   NETSNMP_DS_LIB_PASSPHRASE
+				   NETSNMP_DS_LIB_AUTHPASSPHRASE
+				   NETSNMP_DS_LIB_PRIVPASSPHRASE
+				   NETSNMP_DS_LIB_OPTIONALCONFIG
+				   NETSNMP_DS_LIB_APPTYPE
+				   NETSNMP_DS_LIB_COMMUNITY
+				   NETSNMP_DS_LIB_PERSISTENT_DIR
+				   NETSNMP_DS_LIB_CONFIGURATION_DIR
+				   NETSNMP_DS_LIB_SECMODEL
+				   NETSNMP_DS_LIB_MIBDIRS
+	netsnmp_ds_get_boolean
+	netsnmp_ds_get_int
+	netsnmp_ds_get_string
+	netsnmp_ds_get_void
+	netsnmp_ds_register_config
+	netsnmp_ds_register_premib
+	netsnmp_ds_set_boolean
+	netsnmp_ds_set_int
+	netsnmp_ds_set_string
+	netsnmp_ds_set_void
+	netsnmp_ds_shutdown
+	netsnmp_ds_toggle_boolean
+) ] );
+
+@EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } );
+
+@EXPORT = qw(
+				   NETSNMP_DS_MAX_IDS
+				   NETSNMP_DS_MAX_SUBIDS
+				   NETSNMP_DS_LIBRARY_ID
+				   NETSNMP_DS_APPLICATION_ID
+				   NETSNMP_DS_TOKEN_ID
+				   NETSNMP_DS_LIB_MIB_ERRORS
+				   NETSNMP_DS_LIB_SAVE_MIB_DESCRS
+				   NETSNMP_DS_LIB_MIB_COMMENT_TERM
+				   NETSNMP_DS_LIB_MIB_PARSE_LABEL
+				   NETSNMP_DS_LIB_DUMP_PACKET
+				   NETSNMP_DS_LIB_LOG_TIMESTAMP
+				   NETSNMP_DS_LIB_DONT_READ_CONFIGS
+				   NETSNMP_DS_LIB_MIB_REPLACE
+				   NETSNMP_DS_LIB_PRINT_NUMERIC_ENUM
+				   NETSNMP_DS_LIB_PRINT_NUMERIC_OIDS
+				   NETSNMP_DS_LIB_DONT_BREAKDOWN_OIDS
+				   NETSNMP_DS_LIB_ALARM_DONT_USE_SIG
+				   NETSNMP_DS_LIB_PRINT_FULL_OID
+				   NETSNMP_DS_LIB_QUICK_PRINT
+				   NETSNMP_DS_LIB_RANDOM_ACCESS
+				   NETSNMP_DS_LIB_REGEX_ACCESS
+				   NETSNMP_DS_LIB_DONT_CHECK_RANGE
+				   NETSNMP_DS_LIB_NO_TOKEN_WARNINGS
+				   NETSNMP_DS_LIB_NUMERIC_TIMETICKS
+				   NETSNMP_DS_LIB_ESCAPE_QUOTES
+				   NETSNMP_DS_LIB_REVERSE_ENCODE
+				   NETSNMP_DS_LIB_PRINT_BARE_VALUE
+				   NETSNMP_DS_LIB_EXTENDED_INDEX
+				   NETSNMP_DS_LIB_PRINT_HEX_TEXT
+				   NETSNMP_DS_LIB_PRINT_UCD_STYLE_OID
+				   NETSNMP_DS_LIB_READ_UCD_STYLE_OID
+				   NETSNMP_DS_LIB_HAVE_READ_PREMIB_CONFIG
+				   NETSNMP_DS_LIB_HAVE_READ_CONFIG
+				   NETSNMP_DS_LIB_QUICKE_PRINT
+				   NETSNMP_DS_LIB_MIB_WARNINGS
+				   NETSNMP_DS_LIB_SECLEVEL
+				   NETSNMP_DS_LIB_SNMPVERSION
+				   NETSNMP_DS_LIB_DEFAULT_PORT
+				   NETSNMP_DS_LIB_OID_OUTPUT_FORMAT
+				   NETSNMP_DS_SNMP_VERSION_1
+				   NETSNMP_DS_SNMP_VERSION_2c
+				   NETSNMP_DS_SNMP_VERSION_3
+				   NETSNMP_DS_LIB_SECNAME
+				   NETSNMP_DS_LIB_CONTEXT
+				   NETSNMP_DS_LIB_PASSPHRASE
+				   NETSNMP_DS_LIB_AUTHPASSPHRASE
+				   NETSNMP_DS_LIB_PRIVPASSPHRASE
+				   NETSNMP_DS_LIB_OPTIONALCONFIG
+				   NETSNMP_DS_LIB_APPTYPE
+				   NETSNMP_DS_LIB_COMMUNITY
+				   NETSNMP_DS_LIB_PERSISTENT_DIR
+				   NETSNMP_DS_LIB_CONFIGURATION_DIR
+				   NETSNMP_DS_LIB_SECMODEL
+				   NETSNMP_DS_LIB_MIBDIRS
+);
+$VERSION = '0.01';
+
+sub AUTOLOAD {
+    # This AUTOLOAD is used to 'autoload' constants from the constant()
+    # XS function.  If a constant is not found then control is passed
+    # to the AUTOLOAD in AutoLoader.
+
+    my $constname;
+    ($constname = $AUTOLOAD) =~ s/.*:://;
+    croak "& not defined" if $constname eq 'constant';
+    my $val = constant($constname, @_ ? $_[0] : 0);
+    if ($! != 0) {
+	if ($! =~ /Invalid/ || $!{EINVAL}) {
+	    $AutoLoader::AUTOLOAD = $AUTOLOAD;
+	    goto &AutoLoader::AUTOLOAD;
+	}
+	else {
+	    croak "Your vendor has not defined NetSNMP::default_store macro $constname";
+	}
+    }
+    {
+	no strict 'refs';
+	# Fixed between 5.005_53 and 5.005_61
+#	if ($] >= 5.00561) {
+#	    *$AUTOLOAD = sub () { $val };
+#	}
+#	else {
+	    *$AUTOLOAD = sub { $val };
+#	}
+    }
+    goto &$AUTOLOAD;
+}
+
+bootstrap NetSNMP::default_store $VERSION;
+
+# Preloaded methods go here.
+
+# Autoload methods go after =cut, and are processed by the autosplit program.
+
+1;
+__END__
+# Below is stub documentation for your module. You better edit it!
+
+=head1 NAME
+
+NetSNMP::default_store - Perl extension for blah blah blah
+
+=head1 SYNOPSIS
+
+  use NetSNMP::default_store;
+  $port = netsnmp_ds_get_int(NETSNMP_DS_LIBRARY_ID, DS_LIB_DEFAULT_PORT);
+  netsnmp_ds_set_int(NETSNMP_DS_LIBRARY_ID, DS_LIB_DEFAULT_PORT, 161);
+
+=head1 DESCRIPTION
+
+This module is a wrapper around the net-snmp default store routines.
+See the net-snmp default_store manual page for details on what the
+various functions do and the values that can be set/retrieved.
+
+=head2 EXPORT
+
+None by default.
+
+=head2 Exportable constants
+
+				   NETSNMP_DS_MAX_IDS
+				   NETSNMP_DS_MAX_SUBIDS
+				   NETSNMP_DS_LIBRARY_ID
+				   NETSNMP_DS_APPLICATION_ID
+				   NETSNMP_DS_TOKEN_ID
+				   NETSNMP_DS_LIB_MIB_ERRORS
+				   NETSNMP_DS_LIB_SAVE_MIB_DESCRS
+				   NETSNMP_DS_LIB_MIB_COMMENT_TERM
+				   NETSNMP_DS_LIB_MIB_PARSE_LABEL
+				   NETSNMP_DS_LIB_DUMP_PACKET
+				   NETSNMP_DS_LIB_LOG_TIMESTAMP
+				   NETSNMP_DS_LIB_DONT_READ_CONFIGS
+				   NETSNMP_DS_LIB_MIB_REPLACE
+				   NETSNMP_DS_LIB_PRINT_NUMERIC_ENUM
+				   NETSNMP_DS_LIB_PRINT_NUMERIC_OIDS
+				   NETSNMP_DS_LIB_DONT_BREAKDOWN_OIDS
+				   NETSNMP_DS_LIB_ALARM_DONT_USE_SIG
+				   NETSNMP_DS_LIB_PRINT_FULL_OID
+				   NETSNMP_DS_LIB_QUICK_PRINT
+				   NETSNMP_DS_LIB_RANDOM_ACCESS
+				   NETSNMP_DS_LIB_REGEX_ACCESS
+				   NETSNMP_DS_LIB_DONT_CHECK_RANGE
+				   NETSNMP_DS_LIB_NO_TOKEN_WARNINGS
+				   NETSNMP_DS_LIB_NUMERIC_TIMETICKS
+				   NETSNMP_DS_LIB_ESCAPE_QUOTES
+				   NETSNMP_DS_LIB_REVERSE_ENCODE
+				   NETSNMP_DS_LIB_PRINT_BARE_VALUE
+				   NETSNMP_DS_LIB_EXTENDED_INDEX
+				   NETSNMP_DS_LIB_PRINT_HEX_TEXT
+				   NETSNMP_DS_LIB_PRINT_UCD_STYLE_OID
+				   NETSNMP_DS_LIB_READ_UCD_STYLE_OID
+				   NETSNMP_DS_LIB_HAVE_READ_PREMIB_CONFIG
+				   NETSNMP_DS_LIB_HAVE_READ_CONFIG
+				   NETSNMP_DS_LIB_QUICKE_PRINT
+				   NETSNMP_DS_LIB_MIB_WARNINGS
+				   NETSNMP_DS_LIB_SECLEVEL
+				   NETSNMP_DS_LIB_SNMPVERSION
+				   NETSNMP_DS_LIB_DEFAULT_PORT
+				   NETSNMP_DS_LIB_OID_OUTPUT_FORMAT
+				   NETSNMP_DS_SNMP_VERSION_1
+				   NETSNMP_DS_SNMP_VERSION_2c
+				   NETSNMP_DS_SNMP_VERSION_3
+				   NETSNMP_DS_LIB_SECNAME
+				   NETSNMP_DS_LIB_CONTEXT
+				   NETSNMP_DS_LIB_PASSPHRASE
+				   NETSNMP_DS_LIB_AUTHPASSPHRASE
+				   NETSNMP_DS_LIB_PRIVPASSPHRASE
+				   NETSNMP_DS_LIB_OPTIONALCONFIG
+				   NETSNMP_DS_LIB_APPTYPE
+				   NETSNMP_DS_LIB_COMMUNITY
+				   NETSNMP_DS_LIB_PERSISTENT_DIR
+				   NETSNMP_DS_LIB_CONFIGURATION_DIR
+				   NETSNMP_DS_LIB_SECMODEL
+				   NETSNMP_DS_LIB_MIBDIRS
+
+=head2 Exportable functions
+
+  int netsnmp_ds_get_boolean(int storeid, int which)
+  int netsnmp_ds_get_int(int storeid, int which)
+  char *netsnmp_ds_get_string(int storeid, int which)
+  void *netsnmp_ds_get_void(int storeid, int which)
+  int netsnmp_ds_register_config(unsigned char type, const char *ftype, const char *token,
+                       int storeid, int which)
+  int netsnmp_ds_register_premib(unsigned char type, const char *ftype, const char *token,
+                       int storeid, int which)
+  int netsnmp_ds_set_boolean(int storeid, int which, int value)
+  int netsnmp_ds_set_int(int storeid, int which, int value)
+  int netsnmp_ds_set_string(int storeid, int which, const char *value)
+  int netsnmp_ds_set_void(int storeid, int which, void *value)
+  void netsnmp_ds_shutdown(void)
+  int netsnmp_ds_toggle_boolean(int storeid, int which)
+
+=head1 AUTHOR
+
+Wes Hardaker, hardaker@users.sourceforge.net
+
+=head1 SEE ALSO
+
+perl(1), default_store(3).
+
+=cut
diff -Naur tomato/release/src/router/snmp/perl/default_store/default_store.xs tomato121/release/src/router/snmp/perl/default_store/default_store.xs
--- tomato/release/src/router/snmp/perl/default_store/default_store.xs	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/perl/default_store/default_store.xs	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,979 @@
+#include "EXTERN.h"
+#include "perl.h"
+#include "XSUB.h"
+
+#include <net-snmp/library/default_store.h>
+
+static int
+not_here(char *s)
+{
+    croak("%s not implemented on this architecture", s);
+    return -1;
+}
+
+static double
+constant_NETSNMP_DS_S(char *name, int len, int arg)
+{
+    if (12 + 12 >= len ) {
+	errno = EINVAL;
+	return 0;
+    }
+    switch (name[12 + 12]) {
+    case '1':
+	if (strEQ(name + 12, "NMP_VERSION_1")) {	/* NETSNMP_DS_S removed */
+#ifdef NETSNMP_DS_SNMP_VERSION_1
+	    return NETSNMP_DS_SNMP_VERSION_1;
+#else
+	    goto not_there;
+#endif
+	}
+    case '2':
+	if (strEQ(name + 12, "NMP_VERSION_2c")) {	/* NETSNMP_DS_S removed */
+#ifdef NETSNMP_DS_SNMP_VERSION_2c
+	    return NETSNMP_DS_SNMP_VERSION_2c;
+#else
+	    goto not_there;
+#endif
+	}
+    case '3':
+	if (strEQ(name + 12, "NMP_VERSION_3")) {	/* NETSNMP_DS_S removed */
+#ifdef NETSNMP_DS_SNMP_VERSION_3
+	    return NETSNMP_DS_SNMP_VERSION_3;
+#else
+	    goto not_there;
+#endif
+	}
+    }
+    errno = EINVAL;
+    return 0;
+
+not_there:
+    errno = ENOENT;
+    return 0;
+}
+
+static double
+constant_NETSNMP_DS_LIB_N(char *name, int len, int arg)
+{
+    switch (name[16 + 0]) {
+    case 'O':
+	if (strEQ(name + 16, "O_TOKEN_WARNINGS")) {	/* NETSNMP_DS_LIB_N removed */
+#ifdef NETSNMP_DS_LIB_NO_TOKEN_WARNINGS
+	    return NETSNMP_DS_LIB_NO_TOKEN_WARNINGS;
+#else
+	    goto not_there;
+#endif
+	}
+    case 'U':
+	if (strEQ(name + 16, "UMERIC_TIMETICKS")) {	/* NETSNMP_DS_LIB_N removed */
+#ifdef NETSNMP_DS_LIB_NUMERIC_TIMETICKS
+	    return NETSNMP_DS_LIB_NUMERIC_TIMETICKS;
+#else
+	    goto not_there;
+#endif
+	}
+    }
+    errno = EINVAL;
+    return 0;
+
+not_there:
+    errno = ENOENT;
+    return 0;
+}
+
+static double
+constant_NETSNMP_DS_LIB_O(char *name, int len, int arg)
+{
+    switch (name[16 + 0]) {
+    case 'I':
+	if (strEQ(name + 16, "ID_OUTPUT_FORMAT")) {	/* NETSNMP_DS_LIB_O removed */
+#ifdef NETSNMP_DS_LIB_OID_OUTPUT_FORMAT
+	    return NETSNMP_DS_LIB_OID_OUTPUT_FORMAT;
+#else
+	    goto not_there;
+#endif
+	}
+    case 'P':
+	if (strEQ(name + 16, "PTIONALCONFIG")) {	/* NETSNMP_DS_LIB_O removed */
+#ifdef NETSNMP_DS_LIB_OPTIONALCONFIG
+	    return NETSNMP_DS_LIB_OPTIONALCONFIG;
+#else
+	    goto not_there;
+#endif
+	}
+    }
+    errno = EINVAL;
+    return 0;
+
+not_there:
+    errno = ENOENT;
+    return 0;
+}
+
+static double
+constant_NETSNMP_DS_LIB_PRINT_N(char *name, int len, int arg)
+{
+    if (22 + 7 >= len ) {
+	errno = EINVAL;
+	return 0;
+    }
+    switch (name[22 + 7]) {
+    case 'E':
+	if (strEQ(name + 22, "UMERIC_ENUM")) {	/* NETSNMP_DS_LIB_PRINT_N removed */
+#ifdef NETSNMP_DS_LIB_PRINT_NUMERIC_ENUM
+	    return NETSNMP_DS_LIB_PRINT_NUMERIC_ENUM;
+#else
+	    goto not_there;
+#endif
+	}
+    case 'O':
+	if (strEQ(name + 22, "UMERIC_OIDS")) {	/* NETSNMP_DS_LIB_PRINT_N removed */
+#ifdef NETSNMP_DS_LIB_PRINT_NUMERIC_OIDS
+	    return NETSNMP_DS_LIB_PRINT_NUMERIC_OIDS;
+#else
+	    goto not_there;
+#endif
+	}
+    }
+    errno = EINVAL;
+    return 0;
+
+not_there:
+    errno = ENOENT;
+    return 0;
+}
+
+static double
+constant_NETSNMP_DS_LIB_PRIN(char *name, int len, int arg)
+{
+    if (19 + 2 >= len ) {
+	errno = EINVAL;
+	return 0;
+    }
+    switch (name[19 + 2]) {
+    case 'B':
+	if (strEQ(name + 19, "T_BARE_VALUE")) {	/* NETSNMP_DS_LIB_PRIN removed */
+#ifdef NETSNMP_DS_LIB_PRINT_BARE_VALUE
+	    return NETSNMP_DS_LIB_PRINT_BARE_VALUE;
+#else
+	    goto not_there;
+#endif
+	}
+    case 'F':
+	if (strEQ(name + 19, "T_FULL_OID")) {	/* NETSNMP_DS_LIB_PRIN removed */
+#ifdef NETSNMP_DS_LIB_PRINT_FULL_OID
+	    return NETSNMP_DS_LIB_PRINT_FULL_OID;
+#else
+	    goto not_there;
+#endif
+	}
+    case 'H':
+	if (strEQ(name + 19, "T_HEX_TEXT")) {	/* NETSNMP_DS_LIB_PRIN removed */
+#ifdef NETSNMP_DS_LIB_PRINT_HEX_TEXT
+	    return NETSNMP_DS_LIB_PRINT_HEX_TEXT;
+#else
+	    goto not_there;
+#endif
+	}
+    case 'N':
+	if (!strnEQ(name + 19,"T_", 2))
+	    break;
+	return constant_NETSNMP_DS_LIB_PRINT_N(name, len, arg);
+    case 'S':
+	if (strEQ(name + 19, "T_SUFFIX_ONLY")) {	/* NETSNMP_DS_LIB_PRIN removed */
+#ifdef NETSNMP_DS_LIB_PRINT_SUFFIX_ONLY
+	    return NETSNMP_DS_LIB_PRINT_SUFFIX_ONLY;
+#else
+	    goto not_there;
+#endif
+	}
+    case 'U':
+	if (strEQ(name + 19, "T_UCD_STYLE_OID")) {	/* NETSNMP_DS_LIB_PRIN removed */
+#ifdef NETSNMP_DS_LIB_PRINT_UCD_STYLE_OID
+	    return NETSNMP_DS_LIB_PRINT_UCD_STYLE_OID;
+#else
+	    goto not_there;
+#endif
+	}
+    }
+    errno = EINVAL;
+    return 0;
+
+not_there:
+    errno = ENOENT;
+    return 0;
+}
+
+static double
+constant_NETSNMP_DS_LIB_PR(char *name, int len, int arg)
+{
+    if (17 + 1 >= len ) {
+	errno = EINVAL;
+	return 0;
+    }
+    switch (name[17 + 1]) {
+    case 'N':
+	if (!strnEQ(name + 17,"I", 1))
+	    break;
+	return constant_NETSNMP_DS_LIB_PRIN(name, len, arg);
+    case 'V':
+	if (strEQ(name + 17, "IVPASSPHRASE")) {	/* NETSNMP_DS_LIB_PR removed */
+#ifdef NETSNMP_DS_LIB_PRIVPASSPHRASE
+	    return NETSNMP_DS_LIB_PRIVPASSPHRASE;
+#else
+	    goto not_there;
+#endif
+	}
+    }
+    errno = EINVAL;
+    return 0;
+
+not_there:
+    errno = ENOENT;
+    return 0;
+}
+
+static double
+constant_NETSNMP_DS_LIB_P(char *name, int len, int arg)
+{
+    switch (name[16 + 0]) {
+    case 'A':
+	if (strEQ(name + 16, "ASSPHRASE")) {	/* NETSNMP_DS_LIB_P removed */
+#ifdef NETSNMP_DS_LIB_PASSPHRASE
+	    return NETSNMP_DS_LIB_PASSPHRASE;
+#else
+	    goto not_there;
+#endif
+	}
+    case 'E':
+	if (strEQ(name + 16, "ERSISTENT_DIR")) {	/* NETSNMP_DS_LIB_P removed */
+#ifdef NETSNMP_DS_LIB_PERSISTENT_DIR
+	    return NETSNMP_DS_LIB_PERSISTENT_DIR;
+#else
+	    goto not_there;
+#endif
+	}
+    case 'R':
+	return constant_NETSNMP_DS_LIB_PR(name, len, arg);
+    }
+    errno = EINVAL;
+    return 0;
+
+not_there:
+    errno = ENOENT;
+    return 0;
+}
+
+static double
+constant_NETSNMP_DS_LIB_Q(char *name, int len, int arg)
+{
+    if (16 + 4 >= len ) {
+	errno = EINVAL;
+	return 0;
+    }
+    switch (name[16 + 4]) {
+    case 'E':
+	if (strEQ(name + 16, "UICKE_PRINT")) {	/* NETSNMP_DS_LIB_Q removed */
+#ifdef NETSNMP_DS_LIB_QUICKE_PRINT
+	    return NETSNMP_DS_LIB_QUICKE_PRINT;
+#else
+	    goto not_there;
+#endif
+	}
+    case '_':
+	if (strEQ(name + 16, "UICK_PRINT")) {	/* NETSNMP_DS_LIB_Q removed */
+#ifdef NETSNMP_DS_LIB_QUICK_PRINT
+	    return NETSNMP_DS_LIB_QUICK_PRINT;
+#else
+	    goto not_there;
+#endif
+	}
+    }
+    errno = EINVAL;
+    return 0;
+
+not_there:
+    errno = ENOENT;
+    return 0;
+}
+
+static double
+constant_NETSNMP_DS_LIB_A(char *name, int len, int arg)
+{
+    switch (name[16 + 0]) {
+    case 'L':
+	if (strEQ(name + 16, "LARM_DONT_USE_SIG")) {	/* NETSNMP_DS_LIB_A removed */
+#ifdef NETSNMP_DS_LIB_ALARM_DONT_USE_SIG
+	    return NETSNMP_DS_LIB_ALARM_DONT_USE_SIG;
+#else
+	    goto not_there;
+#endif
+	}
+    case 'P':
+	if (strEQ(name + 16, "PPTYPE")) {	/* NETSNMP_DS_LIB_A removed */
+#ifdef NETSNMP_DS_LIB_APPTYPE
+	    return NETSNMP_DS_LIB_APPTYPE;
+#else
+	    goto not_there;
+#endif
+	}
+    case 'U':
+	if (strEQ(name + 16, "UTHPASSPHRASE")) {	/* NETSNMP_DS_LIB_A removed */
+#ifdef NETSNMP_DS_LIB_AUTHPASSPHRASE
+	    return NETSNMP_DS_LIB_AUTHPASSPHRASE;
+#else
+	    goto not_there;
+#endif
+	}
+    }
+    errno = EINVAL;
+    return 0;
+
+not_there:
+    errno = ENOENT;
+    return 0;
+}
+
+static double
+constant_NETSNMP_DS_LIB_RE(char *name, int len, int arg)
+{
+    switch (name[17 + 0]) {
+    case 'A':
+	if (strEQ(name + 17, "AD_UCD_STYLE_OID")) {	/* NETSNMP_DS_LIB_RE removed */
+#ifdef NETSNMP_DS_LIB_READ_UCD_STYLE_OID
+	    return NETSNMP_DS_LIB_READ_UCD_STYLE_OID;
+#else
+	    goto not_there;
+#endif
+	}
+    case 'G':
+	if (strEQ(name + 17, "GEX_ACCESS")) {	/* NETSNMP_DS_LIB_RE removed */
+#ifdef NETSNMP_DS_LIB_REGEX_ACCESS
+	    return NETSNMP_DS_LIB_REGEX_ACCESS;
+#else
+	    goto not_there;
+#endif
+	}
+    case 'V':
+	if (strEQ(name + 17, "VERSE_ENCODE")) {	/* NETSNMP_DS_LIB_RE removed */
+#ifdef NETSNMP_DS_LIB_REVERSE_ENCODE
+	    return NETSNMP_DS_LIB_REVERSE_ENCODE;
+#else
+	    goto not_there;
+#endif
+	}
+    }
+    errno = EINVAL;
+    return 0;
+
+not_there:
+    errno = ENOENT;
+    return 0;
+}
+
+static double
+constant_NETSNMP_DS_LIB_R(char *name, int len, int arg)
+{
+    switch (name[16 + 0]) {
+    case 'A':
+	if (strEQ(name + 16, "ANDOM_ACCESS")) {	/* NETSNMP_DS_LIB_R removed */
+#ifdef NETSNMP_DS_LIB_RANDOM_ACCESS
+	    return NETSNMP_DS_LIB_RANDOM_ACCESS;
+#else
+	    goto not_there;
+#endif
+	}
+    case 'E':
+	return constant_NETSNMP_DS_LIB_RE(name, len, arg);
+    }
+    errno = EINVAL;
+    return 0;
+
+not_there:
+    errno = ENOENT;
+    return 0;
+}
+
+static double
+constant_NETSNMP_DS_LIB_SE(char *name, int len, int arg)
+{
+    if (17 + 1 >= len ) {
+	errno = EINVAL;
+	return 0;
+    }
+    switch (name[17 + 1]) {
+    case 'L':
+	if (strEQ(name + 17, "CLEVEL")) {	/* NETSNMP_DS_LIB_SE removed */
+#ifdef NETSNMP_DS_LIB_SECLEVEL
+	    return NETSNMP_DS_LIB_SECLEVEL;
+#else
+	    goto not_there;
+#endif
+	}
+    case 'M':
+	if (strEQ(name + 17, "CMODEL")) {	/* NETSNMP_DS_LIB_SE removed */
+#ifdef NETSNMP_DS_LIB_SECMODEL
+	    return NETSNMP_DS_LIB_SECMODEL;
+#else
+	    goto not_there;
+#endif
+	}
+    case 'N':
+	if (strEQ(name + 17, "CNAME")) {	/* NETSNMP_DS_LIB_SE removed */
+#ifdef NETSNMP_DS_LIB_SECNAME
+	    return NETSNMP_DS_LIB_SECNAME;
+#else
+	    goto not_there;
+#endif
+	}
+    }
+    errno = EINVAL;
+    return 0;
+
+not_there:
+    errno = ENOENT;
+    return 0;
+}
+
+static double
+constant_NETSNMP_DS_LIB_S(char *name, int len, int arg)
+{
+    switch (name[16 + 0]) {
+    case 'A':
+	if (strEQ(name + 16, "AVE_MIB_DESCRS")) {	/* NETSNMP_DS_LIB_S removed */
+#ifdef NETSNMP_DS_LIB_SAVE_MIB_DESCRS
+	    return NETSNMP_DS_LIB_SAVE_MIB_DESCRS;
+#else
+	    goto not_there;
+#endif
+	}
+    case 'E':
+	return constant_NETSNMP_DS_LIB_SE(name, len, arg);
+    case 'N':
+	if (strEQ(name + 16, "NMPVERSION")) {	/* NETSNMP_DS_LIB_S removed */
+#ifdef NETSNMP_DS_LIB_SNMPVERSION
+	    return NETSNMP_DS_LIB_SNMPVERSION;
+#else
+	    goto not_there;
+#endif
+	}
+    }
+    errno = EINVAL;
+    return 0;
+
+not_there:
+    errno = ENOENT;
+    return 0;
+}
+
+static double
+constant_NETSNMP_DS_LIB_CON(char *name, int len, int arg)
+{
+    switch (name[18 + 0]) {
+    case 'F':
+	if (strEQ(name + 18, "FIGURATION_DIR")) {	/* NETSNMP_DS_LIB_CON removed */
+#ifdef NETSNMP_DS_LIB_CONFIGURATION_DIR
+	    return NETSNMP_DS_LIB_CONFIGURATION_DIR;
+#else
+	    goto not_there;
+#endif
+	}
+    case 'T':
+	if (strEQ(name + 18, "TEXT")) {	/* NETSNMP_DS_LIB_CON removed */
+#ifdef NETSNMP_DS_LIB_CONTEXT
+	    return NETSNMP_DS_LIB_CONTEXT;
+#else
+	    goto not_there;
+#endif
+	}
+    }
+    errno = EINVAL;
+    return 0;
+
+not_there:
+    errno = ENOENT;
+    return 0;
+}
+
+static double
+constant_NETSNMP_DS_LIB_C(char *name, int len, int arg)
+{
+    if (16 + 1 >= len ) {
+	errno = EINVAL;
+	return 0;
+    }
+    switch (name[16 + 1]) {
+    case 'M':
+	if (strEQ(name + 16, "OMMUNITY")) {	/* NETSNMP_DS_LIB_C removed */
+#ifdef NETSNMP_DS_LIB_COMMUNITY
+	    return NETSNMP_DS_LIB_COMMUNITY;
+#else
+	    goto not_there;
+#endif
+	}
+    case 'N':
+	if (!strnEQ(name + 16,"O", 1))
+	    break;
+	return constant_NETSNMP_DS_LIB_CON(name, len, arg);
+    }
+    errno = EINVAL;
+    return 0;
+
+not_there:
+    errno = ENOENT;
+    return 0;
+}
+
+static double
+constant_NETSNMP_DS_LIB_DO(char *name, int len, int arg)
+{
+    if (17 + 3 >= len ) {
+	errno = EINVAL;
+	return 0;
+    }
+    switch (name[17 + 3]) {
+    case 'B':
+	if (strEQ(name + 17, "NT_BREAKDOWN_OIDS")) {	/* NETSNMP_DS_LIB_DO removed */
+#ifdef NETSNMP_DS_LIB_DONT_BREAKDOWN_OIDS
+	    return NETSNMP_DS_LIB_DONT_BREAKDOWN_OIDS;
+#else
+	    goto not_there;
+#endif
+	}
+    case 'C':
+	if (strEQ(name + 17, "NT_CHECK_RANGE")) {	/* NETSNMP_DS_LIB_DO removed */
+#ifdef NETSNMP_DS_LIB_DONT_CHECK_RANGE
+	    return NETSNMP_DS_LIB_DONT_CHECK_RANGE;
+#else
+	    goto not_there;
+#endif
+	}
+    case 'R':
+	if (strEQ(name + 17, "NT_READ_CONFIGS")) {	/* NETSNMP_DS_LIB_DO removed */
+#ifdef NETSNMP_DS_LIB_DONT_READ_CONFIGS
+	    return NETSNMP_DS_LIB_DONT_READ_CONFIGS;
+#else
+	    goto not_there;
+#endif
+	}
+    }
+    errno = EINVAL;
+    return 0;
+
+not_there:
+    errno = ENOENT;
+    return 0;
+}
+
+static double
+constant_NETSNMP_DS_LIB_D(char *name, int len, int arg)
+{
+    switch (name[16 + 0]) {
+    case 'E':
+	if (strEQ(name + 16, "EFAULT_PORT")) {	/* NETSNMP_DS_LIB_D removed */
+#ifdef NETSNMP_DS_LIB_DEFAULT_PORT
+	    return NETSNMP_DS_LIB_DEFAULT_PORT;
+#else
+	    goto not_there;
+#endif
+	}
+    case 'O':
+	return constant_NETSNMP_DS_LIB_DO(name, len, arg);
+    case 'U':
+	if (strEQ(name + 16, "UMP_PACKET")) {	/* NETSNMP_DS_LIB_D removed */
+#ifdef NETSNMP_DS_LIB_DUMP_PACKET
+	    return NETSNMP_DS_LIB_DUMP_PACKET;
+#else
+	    goto not_there;
+#endif
+	}
+    }
+    errno = EINVAL;
+    return 0;
+
+not_there:
+    errno = ENOENT;
+    return 0;
+}
+
+static double
+constant_NETSNMP_DS_LIB_E(char *name, int len, int arg)
+{
+    switch (name[16 + 0]) {
+    case 'S':
+	if (strEQ(name + 16, "SCAPE_QUOTES")) {	/* NETSNMP_DS_LIB_E removed */
+#ifdef NETSNMP_DS_LIB_ESCAPE_QUOTES
+	    return NETSNMP_DS_LIB_ESCAPE_QUOTES;
+#else
+	    goto not_there;
+#endif
+	}
+    case 'X':
+	if (strEQ(name + 16, "XTENDED_INDEX")) {	/* NETSNMP_DS_LIB_E removed */
+#ifdef NETSNMP_DS_LIB_EXTENDED_INDEX
+	    return NETSNMP_DS_LIB_EXTENDED_INDEX;
+#else
+	    goto not_there;
+#endif
+	}
+    }
+    errno = EINVAL;
+    return 0;
+
+not_there:
+    errno = ENOENT;
+    return 0;
+}
+
+static double
+constant_NETSNMP_DS_LIB_H(char *name, int len, int arg)
+{
+    if (16 + 9 >= len ) {
+	errno = EINVAL;
+	return 0;
+    }
+    switch (name[16 + 9]) {
+    case 'C':
+	if (strEQ(name + 16, "AVE_READ_CONFIG")) {	/* NETSNMP_DS_LIB_H removed */
+#ifdef NETSNMP_DS_LIB_HAVE_READ_CONFIG
+	    return NETSNMP_DS_LIB_HAVE_READ_CONFIG;
+#else
+	    goto not_there;
+#endif
+	}
+    case 'P':
+	if (strEQ(name + 16, "AVE_READ_PREMIB_CONFIG")) {	/* NETSNMP_DS_LIB_H removed */
+#ifdef NETSNMP_DS_LIB_HAVE_READ_PREMIB_CONFIG
+	    return NETSNMP_DS_LIB_HAVE_READ_PREMIB_CONFIG;
+#else
+	    goto not_there;
+#endif
+	}
+    }
+    errno = EINVAL;
+    return 0;
+
+not_there:
+    errno = ENOENT;
+    return 0;
+}
+
+static double
+constant_NETSNMP_DS_LIB_MIB_(char *name, int len, int arg)
+{
+    switch (name[19 + 0]) {
+    case 'C':
+	if (strEQ(name + 19, "COMMENT_TERM")) {	/* NETSNMP_DS_LIB_MIB_ removed */
+#ifdef NETSNMP_DS_LIB_MIB_COMMENT_TERM
+	    return NETSNMP_DS_LIB_MIB_COMMENT_TERM;
+#else
+	    goto not_there;
+#endif
+	}
+    case 'E':
+	if (strEQ(name + 19, "ERRORS")) {	/* NETSNMP_DS_LIB_MIB_ removed */
+#ifdef NETSNMP_DS_LIB_MIB_ERRORS
+	    return NETSNMP_DS_LIB_MIB_ERRORS;
+#else
+	    goto not_there;
+#endif
+	}
+    case 'P':
+	if (strEQ(name + 19, "PARSE_LABEL")) {	/* NETSNMP_DS_LIB_MIB_ removed */
+#ifdef NETSNMP_DS_LIB_MIB_PARSE_LABEL
+	    return NETSNMP_DS_LIB_MIB_PARSE_LABEL;
+#else
+	    goto not_there;
+#endif
+	}
+    case 'R':
+	if (strEQ(name + 19, "REPLACE")) {	/* NETSNMP_DS_LIB_MIB_ removed */
+#ifdef NETSNMP_DS_LIB_MIB_REPLACE
+	    return NETSNMP_DS_LIB_MIB_REPLACE;
+#else
+	    goto not_there;
+#endif
+	}
+    case 'W':
+	if (strEQ(name + 19, "WARNINGS")) {	/* NETSNMP_DS_LIB_MIB_ removed */
+#ifdef NETSNMP_DS_LIB_MIB_WARNINGS
+	    return NETSNMP_DS_LIB_MIB_WARNINGS;
+#else
+	    goto not_there;
+#endif
+	}
+    }
+    errno = EINVAL;
+    return 0;
+
+not_there:
+    errno = ENOENT;
+    return 0;
+}
+
+static double
+constant_NETSNMP_DS_LIB_M(char *name, int len, int arg)
+{
+    if (16 + 2 >= len ) {
+	errno = EINVAL;
+	return 0;
+    }
+    switch (name[16 + 2]) {
+    case 'D':
+	if (strEQ(name + 16, "IBDIRS")) {	/* NETSNMP_DS_LIB_M removed */
+#ifdef NETSNMP_DS_LIB_MIBDIRS
+	    return NETSNMP_DS_LIB_MIBDIRS;
+#else
+	    goto not_there;
+#endif
+	}
+    case '_':
+	if (!strnEQ(name + 16,"IB", 2))
+	    break;
+	return constant_NETSNMP_DS_LIB_MIB_(name, len, arg);
+    }
+    errno = EINVAL;
+    return 0;
+
+not_there:
+    errno = ENOENT;
+    return 0;
+}
+
+static double
+constant_NETSNMP_DS_LIB_(char *name, int len, int arg)
+{
+    switch (name[15 + 0]) {
+    case 'A':
+	return constant_NETSNMP_DS_LIB_A(name, len, arg);
+    case 'C':
+	return constant_NETSNMP_DS_LIB_C(name, len, arg);
+    case 'D':
+	return constant_NETSNMP_DS_LIB_D(name, len, arg);
+    case 'E':
+	return constant_NETSNMP_DS_LIB_E(name, len, arg);
+    case 'H':
+	return constant_NETSNMP_DS_LIB_H(name, len, arg);
+    case 'L':
+	if (strEQ(name + 15, "LOG_TIMESTAMP")) {	/* NETSNMP_DS_LIB_ removed */
+#ifdef NETSNMP_DS_LIB_LOG_TIMESTAMP
+	    return NETSNMP_DS_LIB_LOG_TIMESTAMP;
+#else
+	    goto not_there;
+#endif
+	}
+    case 'M':
+	return constant_NETSNMP_DS_LIB_M(name, len, arg);
+    case 'N':
+	return constant_NETSNMP_DS_LIB_N(name, len, arg);
+    case 'O':
+	return constant_NETSNMP_DS_LIB_O(name, len, arg);
+    case 'P':
+	return constant_NETSNMP_DS_LIB_P(name, len, arg);
+    case 'Q':
+	return constant_NETSNMP_DS_LIB_Q(name, len, arg);
+    case 'R':
+	return constant_NETSNMP_DS_LIB_R(name, len, arg);
+    case 'S':
+	return constant_NETSNMP_DS_LIB_S(name, len, arg);
+    }
+    errno = EINVAL;
+    return 0;
+
+not_there:
+    errno = ENOENT;
+    return 0;
+}
+
+static double
+constant_NETSNMP_DS_L(char *name, int len, int arg)
+{
+    if (12 + 2 >= len ) {
+	errno = EINVAL;
+	return 0;
+    }
+    switch (name[12 + 2]) {
+    case 'R':
+	if (strEQ(name + 12, "IBRARY_ID")) {	/* NETSNMP_DS_L removed */
+#ifdef NETSNMP_DS_LIBRARY_ID
+	    return NETSNMP_DS_LIBRARY_ID;
+#else
+	    goto not_there;
+#endif
+	}
+    case '_':
+	if (!strnEQ(name + 12,"IB", 2))
+	    break;
+	return constant_NETSNMP_DS_LIB_(name, len, arg);
+    }
+    errno = EINVAL;
+    return 0;
+
+not_there:
+    errno = ENOENT;
+    return 0;
+}
+
+static double
+constant_NETSNMP_DS_M(char *name, int len, int arg)
+{
+    if (12 + 3 >= len ) {
+	errno = EINVAL;
+	return 0;
+    }
+    switch (name[12 + 3]) {
+    case 'I':
+	if (strEQ(name + 12, "AX_IDS")) {	/* NETSNMP_DS_M removed */
+#ifdef NETSNMP_DS_MAX_IDS
+	    return NETSNMP_DS_MAX_IDS;
+#else
+	    goto not_there;
+#endif
+	}
+    case 'S':
+	if (strEQ(name + 12, "AX_SUBIDS")) {	/* NETSNMP_DS_M removed */
+#ifdef NETSNMP_DS_MAX_SUBIDS
+	    return NETSNMP_DS_MAX_SUBIDS;
+#else
+	    goto not_there;
+#endif
+	}
+    }
+    errno = EINVAL;
+    return 0;
+
+not_there:
+    errno = ENOENT;
+    return 0;
+}
+
+static double
+constant(char *name, int len, int arg)
+{
+    errno = 0;
+    if (0 + 11 >= len ) {
+	errno = EINVAL;
+	return 0;
+    }
+    switch (name[0 + 11]) {
+    case 'A':
+	if (strEQ(name + 0, "NETSNMP_DS_APPLICATION_ID")) {	/*  removed */
+#ifdef NETSNMP_DS_APPLICATION_ID
+	    return NETSNMP_DS_APPLICATION_ID;
+#else
+	    goto not_there;
+#endif
+	}
+    case 'L':
+	if (!strnEQ(name + 0,"NETSNMP_DS_", 11))
+	    break;
+	return constant_NETSNMP_DS_L(name, len, arg);
+    case 'M':
+	if (!strnEQ(name + 0,"NETSNMP_DS_", 11))
+	    break;
+	return constant_NETSNMP_DS_M(name, len, arg);
+    case 'S':
+	if (!strnEQ(name + 0,"NETSNMP_DS_", 11))
+	    break;
+	return constant_NETSNMP_DS_S(name, len, arg);
+    case 'T':
+	if (strEQ(name + 0, "NETSNMP_DS_TOKEN_ID")) {	/*  removed */
+#ifdef NETSNMP_DS_TOKEN_ID
+	    return NETSNMP_DS_TOKEN_ID;
+#else
+	    goto not_there;
+#endif
+	}
+    }
+    errno = EINVAL;
+    return 0;
+
+not_there:
+    errno = ENOENT;
+    return 0;
+}
+
+
+MODULE = NetSNMP::default_store		PACKAGE = NetSNMP::default_store		
+
+
+double
+constant(sv,arg)
+    PREINIT:
+	STRLEN		len;
+    INPUT:
+	SV *		sv
+	char *		s = SvPV(sv, len);
+	int		arg
+    CODE:
+	RETVAL = constant(s,len,arg);
+    OUTPUT:
+	RETVAL
+
+int
+netsnmp_ds_get_boolean(storeid, which)
+	int	storeid
+	int	which
+
+int
+netsnmp_ds_get_int(storeid, which)
+	int	storeid
+	int	which
+
+char *
+netsnmp_ds_get_string(storeid, which)
+	int	storeid
+	int	which
+
+void *
+netsnmp_ds_get_void(storeid, which)
+	int	storeid
+	int	which
+
+int
+netsnmp_ds_register_config(type, ftype, token, storeid, which)
+	unsigned char	type
+	const char *	ftype
+	const char *	token
+	int	storeid
+	int	which
+
+int
+netsnmp_ds_register_premib(type, ftype, token, storeid, which)
+	unsigned char	type
+	const char *	ftype
+	const char *	token
+	int	storeid
+	int	which
+
+int
+netsnmp_ds_set_boolean(storeid, which, value)
+	int	storeid
+	int	which
+	int	value
+
+int
+netsnmp_ds_set_int(storeid, which, value)
+	int	storeid
+	int	which
+	int	value
+
+int
+netsnmp_ds_set_string(storeid, which, value)
+	int	storeid
+	int	which
+	const char *	value
+
+int
+netsnmp_ds_set_void(storeid, which, value)
+	int	storeid
+	int	which
+	void *	value
+
+void
+netsnmp_ds_shutdown()
+
+int
+netsnmp_ds_toggle_boolean(storeid, which)
+	int	storeid
+	int	which
diff -Naur tomato/release/src/router/snmp/perl/default_store/gen tomato121/release/src/router/snmp/perl/default_store/gen
--- tomato/release/src/router/snmp/perl/default_store/gen	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/perl/default_store/gen	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,127 @@
+#!/usr/bin/perl
+
+system("grep 'define NETSNMP_DS_' ../../include/net-snmp/library/default_store.h > default_store.h");
+#gcc -E ../../include/net-snmp/library/default_store.h | grep -v default_store.h >> default_store.h
+system("h2xs -n NetSNMP::default_store -O default_store.h");
+
+open(ORIG,"default_store.xs");
+open(NEW,"NetSNMP/default_store/default_store.xs");
+open(OUT,">default_store_new.xs");
+
+# get up to the include from the original file
+while(<ORIG>) {
+    print OUT;
+    last if (/include <net-snmp\/library\/default_store.h/);
+}
+
+# skip up to the include from the original file
+while(<NEW>) {
+    last if (/include <default_store.h>/);
+}
+
+# include the entire new file
+print OUT <NEW>;
+
+# skip past the constant portion of the old file
+while (<ORIG>) {
+    last if (/netsnmp_ds_get_bool/);
+    $last = $_;
+}
+
+# We need the last two lines
+print OUT $last;
+print OUT $_;
+
+# and the rest
+print OUT <ORIG>;
+
+close(OUT);
+
+#
+# generate test
+#
+open(H,"default_store.h");
+open(ORIG,"test.pl");
+open(OUT,">test.pl.new");
+
+while(<ORIG>) {
+    print OUT;
+    last if (/\%tests =/);
+}
+
+while(<H>) {
+    if (/define\s+(\w+)\s+(\d+)/) {
+	printf OUT ("                  %-40s => %d,\n", "\"$1\"", $2);
+	$tokenlist .= "				   $1\n";
+    }
+}
+
+while(<ORIG>) {
+    last if (/\);/);
+}
+print OUT;
+print OUT <ORIG>;
+close(OUT);
+
+#
+# modify the perl module itself
+#
+open(H,"default_store.h");
+open(ORIG,"default_store.pm");
+open(OUT,">default_store_new.pm");
+
+# first list
+while(<ORIG>) {
+    print OUT;
+    last if (/\%EXPORT_TAGS =/);
+}
+print OUT $tokenlist;
+while(<ORIG>) {
+    last if (/netsnmp_ds_get_boolean/);
+}
+print OUT;
+
+# second list
+while(<ORIG>) {
+    print OUT;
+    last if (/\@EXPORT =/);
+}
+print OUT $tokenlist;
+while(<ORIG>) {
+    last if (/\);/);
+}
+print OUT;
+
+# last section
+while(<ORIG>) {
+    print OUT;
+    last if (/head2 Exportable constants/);
+}
+print OUT "\n";
+print OUT $tokenlist;
+while(<ORIG>) {
+    last if (/head2 Exportable functions/);
+}
+print OUT "\n";
+print OUT;
+
+# tail end
+print OUT <ORIG>;
+close(OUT);
+
+#
+# install new files
+#
+print "updated test.pl\n";
+rename("test.pl.new","test.pl");
+rename("default_store_new.pm", "default_store.pm");
+print "updated default_store.pm\n";
+rename("default_store_new.xs", "default_store.xs");
+print "updated default_store.xs\n";
+
+#
+# remove the temp files.
+#
+system("rm -rf NetSNMP");
+unlink("default_store.h");
+
diff -Naur tomato/release/src/router/snmp/perl/default_store/Makefile.PL tomato121/release/src/router/snmp/perl/default_store/Makefile.PL
--- tomato/release/src/router/snmp/perl/default_store/Makefile.PL	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/perl/default_store/Makefile.PL	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,137 @@
+use ExtUtils::MakeMaker;
+require 5;
+use Config;
+use Getopt::Long;
+my %MakeParams = ();
+
+%MakeParams = InitMakeParams();
+
+WriteMakefile(%MakeParams);
+
+
+sub InitMakeParams {
+    my $opts;
+    my %Params = (
+		  'NAME'		=> 'NetSNMP::default_store',
+		  'VERSION_FROM'	=> 'default_store.pm', # finds $VERSION
+		  'XSPROTOARG'          => '-prototypes',
+		  );
+
+    my ($snmp_lib, $snmp_llib, $sep);
+    if ($Config{'osname'} eq 'MSWin32') {
+      $opts = NetSNMPGetOpts();	
+      $snmp_lib = 'libsnmp.lib';
+      $snmp_link_lib = 'libsnmp';
+      $sep = '\\';
+
+      $Params{'DEFINE'} = "-DMSVC_PERL";
+      
+      if ($opts->{'insource'}) {
+	$Params{'LIBS'} = "-L$basedir\\win32\\lib\\ -l$snmp_link_lib";
+      }
+      else {
+	my @LibDirs = split (';',$ENV{LIB});
+	if ($opts->{'prefix'}) {
+	  push (@LibDirs,"$ENV{'NET-SNMP-PATH'}${sep}lib");
+	}
+	$noLibDir = 1;
+	while ($noLibDir) {
+	  $LibDir = find_files(["$snmp_lib"],\@LibDirs);
+	  if ($LibDir ne '') {
+	    $noLibDir = 0;
+	  }
+	  else
+	  {
+	    @LibDirs = ();
+	    @LibDirs[0] = prompt("The Net-SNMP library ($snmp_lib) could not be found.\nPlease enter the directory where it is located:");
+	    @LibDirs[0] =~ s/\\$//;
+	  }
+	}
+	$Params{LIBS} = "-L$LibDir -l$snmp_link_lib";
+      }
+
+      $Params{'INC'} = "-I$basedir\\include\\ -I$basedir\\include\\net-snmp\\ -I$basedir\\win32\\ ";
+    }
+    else {
+	$opts = NetSNMPGetOpts();
+	$Params{'LIBS'}    = `$opts->{'nsconfig'} --libs`;
+	chomp($Params{'LIBS'});
+	$Params{'CCFLAGS'} = `$opts->{'nsconfig'} --cflags`;
+	chomp($Params{'CCFLAGS'});
+	$Params{'CCFLAGS'} .= " " . $Config{'ccflags'};
+	if ($opts->{'insource'} eq "true") {
+	    $Params{'LIBS'} = "-L../../snmplib/.libs -L../../snmplib/ " . $Params{'LIBS'};
+	    $Params{'CCFLAGS'} = "-I../../include " . $Params{'CCFLAGS'};
+	}
+	$Params{'CCFLAGS'} =~ s/ -W[-\w]+//g; # ignore developer warnings
+	if ($Params{'LIBS'} eq "" || $Params{'CCFLAGS'} eq "") {
+	    die "You need to install net-snmp first (I can't find net-snmp-config)";
+	}
+    }
+
+    return(%Params);
+}
+# common subroutines -- DO NOT EDIT.
+# They are imported from the Makefile.subs.pl file
+sub NetSNMPGetOpts {
+    my %ret;
+    my $rootpath = shift;
+    $rootpath = "../" if (!$rootpath);
+    $rootpath .= '/' if ($rootpath !~ /\/$/);
+    
+    if ($Config{'osname'} eq 'MSWin32') {
+      if ($ENV{'NET-SNMP-IN-SOURCE'})
+      {
+	$ret{'insource'} = $ENV{'NET-SNMP-IN-SOURCE'};
+      }
+      elsif ($ENV{'NET-SNMP-PATH'})
+      {
+	$ret{'prefix'} = $ENV{'NET-SNMP-PATH'};
+      }
+      else
+      {
+	# don't have env vars, pull from command line and put there
+	GetOptions("NET-SNMP-IN-SOURCE=s" => \$ret{'insource'},
+	           "NET-SNMP-PATH=s"      => \$ret{'prefix'});
+
+	$ENV{'NET-SNMP-IN-SOURCE'}    = $ret{'insource'};
+	$ENV{'NET-SNMP-PATH'}         = $ret{'prefix'};
+      }
+
+      $basedir = `%COMSPEC% /c cd`;
+      chomp $basedir;
+      $basedir =~ /(.*?)\\perl.*/;
+      $basedir = $1;
+      print "Net-SNMP base directory: $basedir\n";
+
+    }
+    else
+    {
+      if ($ENV{'NET-SNMP-CONFIG'} && 
+        $ENV{'NET-SNMP-IN-SOURCE'}) {
+	# have env vars, pull from there
+	$ret{'nsconfig'} = $ENV{'NET-SNMP-CONFIG'};
+	$ret{'insource'} = $ENV{'NET-SNMP-IN-SOURCE'};
+      } else {
+	# don't have env vars, pull from command line and put there
+	GetOptions("NET-SNMP-CONFIG=s" => \$ret{'nsconfig'},
+	           "NET-SNMP-IN-SOURCE=s" => \$ret{'insource'});
+
+	if ($ret{'insource'} eq "true" && $ret{'nsconfig'} eq "") {
+	    $ret{'nsconfig'}="sh ROOTPATH../net-snmp-config";
+	} elsif ($ret{'nsconfig'} eq "") {
+	    $ret{'nsconfig'}="net-snmp-config";
+	}
+
+	$ENV{'NET-SNMP-CONFIG'}    = $ret{'nsconfig'};
+	$ENV{'NET-SNMP-IN-SOURCE'} = $ret{'insource'};
+      }
+    }	
+    
+    $ret{'nsconfig'} =~ s/ROOTPATH/$rootpath/;
+
+    $ret{'rootpath'} = $rootpath;
+
+    \%ret;
+}
+
diff -Naur tomato/release/src/router/snmp/perl/default_store/MANIFEST tomato121/release/src/router/snmp/perl/default_store/MANIFEST
--- tomato/release/src/router/snmp/perl/default_store/MANIFEST	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/perl/default_store/MANIFEST	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,8 @@
+Changes
+MANIFEST
+Makefile.PL
+default_store.pm
+default_store.xs
+test.pl
+typemap
+README
diff -Naur tomato/release/src/router/snmp/perl/default_store/README tomato121/release/src/router/snmp/perl/default_store/README
--- tomato/release/src/router/snmp/perl/default_store/README	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/perl/default_store/README	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,14 @@
+This module is a wrapper around the net-snmp default store routines.
+See the net-snmp default_store manual page for details.
+
+To install:
+  perl Makefile.PL
+  make
+  make test
+  make install
+
+To compile in the source tree before the net-snmp itself has been installed:
+  perl Makefile.PL -NET-SNMP-CONFIG="sh ../../net-snmp-config" -NET-SNMP-IN-SOURCE=true
+  make
+  make test
+  make install
diff -Naur tomato/release/src/router/snmp/perl/default_store/test.pl tomato121/release/src/router/snmp/perl/default_store/test.pl
--- tomato/release/src/router/snmp/perl/default_store/test.pl	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/perl/default_store/test.pl	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,98 @@
+# Before `make install' is performed this script should be runnable with
+# `make test'. After `make install' it should work as `perl test.pl'
+
+######################### We start with some black magic to print on failure.
+
+# Change 1..1 below to 1..last_test_to_print .
+# (It may become useful if the test is moved to ./t subdirectory.)
+
+BEGIN { $| = 1; 
+
+	%tests = ( 
+                  "NETSNMP_DS_MAX_IDS"                     => 3,
+                  "NETSNMP_DS_MAX_SUBIDS"                  => 32,
+                  "NETSNMP_DS_LIBRARY_ID"                  => 0,
+                  "NETSNMP_DS_APPLICATION_ID"              => 1,
+                  "NETSNMP_DS_TOKEN_ID"                    => 2,
+                  "NETSNMP_DS_LIB_MIB_ERRORS"              => 0,
+                  "NETSNMP_DS_LIB_SAVE_MIB_DESCRS"         => 1,
+                  "NETSNMP_DS_LIB_MIB_COMMENT_TERM"        => 2,
+                  "NETSNMP_DS_LIB_MIB_PARSE_LABEL"         => 3,
+                  "NETSNMP_DS_LIB_DUMP_PACKET"             => 4,
+                  "NETSNMP_DS_LIB_LOG_TIMESTAMP"           => 5,
+                  "NETSNMP_DS_LIB_DONT_READ_CONFIGS"       => 6,
+                  "NETSNMP_DS_LIB_MIB_REPLACE"             => 7,
+                  "NETSNMP_DS_LIB_PRINT_NUMERIC_ENUM"      => 8,
+                  "NETSNMP_DS_LIB_PRINT_NUMERIC_OIDS"      => 9,
+                  "NETSNMP_DS_LIB_DONT_BREAKDOWN_OIDS"     => 10,
+                  "NETSNMP_DS_LIB_ALARM_DONT_USE_SIG"      => 11,
+                  "NETSNMP_DS_LIB_PRINT_FULL_OID"          => 12,
+                  "NETSNMP_DS_LIB_QUICK_PRINT"             => 13,
+                  "NETSNMP_DS_LIB_RANDOM_ACCESS"           => 14,
+                  "NETSNMP_DS_LIB_REGEX_ACCESS"            => 15,
+                  "NETSNMP_DS_LIB_DONT_CHECK_RANGE"        => 16,
+                  "NETSNMP_DS_LIB_NO_TOKEN_WARNINGS"       => 17,
+                  "NETSNMP_DS_LIB_NUMERIC_TIMETICKS"       => 18,
+                  "NETSNMP_DS_LIB_ESCAPE_QUOTES"           => 19,
+                  "NETSNMP_DS_LIB_REVERSE_ENCODE"          => 20,
+                  "NETSNMP_DS_LIB_PRINT_BARE_VALUE"        => 21,
+                  "NETSNMP_DS_LIB_EXTENDED_INDEX"          => 22,
+                  "NETSNMP_DS_LIB_PRINT_HEX_TEXT"          => 23,
+                  "NETSNMP_DS_LIB_PRINT_UCD_STYLE_OID"     => 24,
+                  "NETSNMP_DS_LIB_READ_UCD_STYLE_OID"      => 25,
+                  "NETSNMP_DS_LIB_HAVE_READ_PREMIB_CONFIG" => 26,
+                  "NETSNMP_DS_LIB_HAVE_READ_CONFIG"        => 27,
+                  "NETSNMP_DS_LIB_QUICKE_PRINT"            => 28,
+                  "NETSNMP_DS_LIB_MIB_WARNINGS"            => 0,
+                  "NETSNMP_DS_LIB_SECLEVEL"                => 1,
+                  "NETSNMP_DS_LIB_SNMPVERSION"             => 2,
+                  "NETSNMP_DS_LIB_DEFAULT_PORT"            => 3,
+                  "NETSNMP_DS_LIB_OID_OUTPUT_FORMAT"       => 4,
+                  "NETSNMP_DS_SNMP_VERSION_1"              => 128,
+                  "NETSNMP_DS_SNMP_VERSION_2c"             => 1,
+                  "NETSNMP_DS_SNMP_VERSION_3"              => 3,
+                  "NETSNMP_DS_LIB_SECNAME"                 => 0,
+                  "NETSNMP_DS_LIB_CONTEXT"                 => 1,
+                  "NETSNMP_DS_LIB_PASSPHRASE"              => 2,
+                  "NETSNMP_DS_LIB_AUTHPASSPHRASE"          => 3,
+                  "NETSNMP_DS_LIB_PRIVPASSPHRASE"          => 4,
+                  "NETSNMP_DS_LIB_OPTIONALCONFIG"          => 5,
+                  "NETSNMP_DS_LIB_APPTYPE"                 => 6,
+                  "NETSNMP_DS_LIB_COMMUNITY"               => 7,
+                  "NETSNMP_DS_LIB_PERSISTENT_DIR"          => 8,
+                  "NETSNMP_DS_LIB_CONFIGURATION_DIR"       => 9,
+                  "NETSNMP_DS_LIB_SECMODEL"                => 10,
+                  "NETSNMP_DS_LIB_MIBDIRS"                 => 11,
+		  );
+
+	print "1.." . (scalar(keys(%tests)) + 10) . "\n"; 
+    }
+END {print "not ok 1\n" unless $loaded;}
+use NetSNMP::default_store (':all');
+$loaded = 1;
+print "ok 1\n";
+
+######################### End of black magic.
+
+# Insert your test code below (better if it prints "ok 13"
+# (correspondingly "not ok 13") depending on the success of chunk 13
+# of the test code):
+
+print ((netsnmp_ds_set_string(1, 1, "hi there") == 0) ? "ok 2\n" : "not ok 2\n"); 
+print ((netsnmp_ds_get_string(1, 1) eq "hi there") ? "ok 3\n" : "not ok 3\n"); 
+print ((netsnmp_ds_set_int(1, 1, 42) == 0) ? "ok 4\n" : "not ok 4\n"); 
+print ((netsnmp_ds_get_int(1, 1) == 42) ? "ok 5\n" : "not ok 5\n"); 
+print ((netsnmp_ds_get_int(1, 2) == 0) ? "ok 6\n" : "not ok 6\n"); 
+print ((NETSNMP_DS_LIB_REGEX_ACCESS == 15) ? "ok 7\n" : "not ok 7\n"); 
+print ((netsnmp_ds_get_int(NETSNMP_DS_APPLICATION_ID, 1) == 42) ? "ok 8\n" : "not ok 8\n"); 
+print ((netsnmp_ds_set_int(NETSNMP_DS_LIBRARY_ID, DS_LIB_DEFAULT_PORT, 9161) == 0) ? "ok 9\n" : "not ok 9\n"); 
+print ((netsnmp_ds_get_int(NETSNMP_DS_LIBRARY_ID, DS_LIB_DEFAULT_PORT) == 9161) ? "ok 10\n" : "not ok 10\n"); 
+
+$c = 10;
+foreach my $i (keys(%tests)) {
+    my $str = "NetSNMP::default_store::$i";
+    my $val = eval $str;
+#    print "$i -> $val -> $tests{$i}\n";
+    $c++;
+    print (($val eq $tests{$i})?"ok $c\n" : "not ok $c\n#  error:  name=$i value_expected=$tests{$i}  value_got=$val \n");
+}
diff -Naur tomato/release/src/router/snmp/perl/default_store/typemap tomato121/release/src/router/snmp/perl/default_store/typemap
--- tomato/release/src/router/snmp/perl/default_store/typemap	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/perl/default_store/typemap	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1 @@
+const char *					T_PV
diff -Naur tomato/release/src/router/snmp/perl/Makefile.makefiles tomato121/release/src/router/snmp/perl/Makefile.makefiles
--- tomato/release/src/router/snmp/perl/Makefile.makefiles	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/perl/Makefile.makefiles	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,10 @@
+GENERATE_LIST=./Makefile.PL \
+	      ./default_store/Makefile.PL \
+	      ./ASN/Makefile.PL \
+	      ./OID/Makefile.PL \
+	      ./agent/Makefile.PL \
+	      ./agent/default_store/Makefile.PL \
+	      ./SNMP/Makefile.PL
+
+all:
+	perl make-perl-makefiles $(GENERATE_LIST)
diff -Naur tomato/release/src/router/snmp/perl/Makefile.PL tomato121/release/src/router/snmp/perl/Makefile.PL
--- tomato/release/src/router/snmp/perl/Makefile.PL	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/perl/Makefile.PL	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,79 @@
+use ExtUtils::MakeMaker;
+use Config;
+use Getopt::Long;
+require 5;
+
+%MakeParams = InitMakeParams();
+
+WriteMakefile(%MakeParams);
+
+sub InitMakeParams {
+    $nsconfig="net-snmp-config"; # in path by default
+    my %Params = (
+		  'NAME' => 'Bundle::NetSNMP',
+		  'DIR' => [qw(default_store ASN OID agent SNMP)]
+		  );
+
+    # bogus, but these options need to be passed to the lower levels
+    $opts = NetSNMPGetOpts("./");
+
+    return(%Params);
+}
+
+# common subroutines -- DO NOT EDIT.
+# They are imported from the Makefile.subs.pl file
+sub NetSNMPGetOpts {
+    my %ret;
+    my $rootpath = shift;
+    $rootpath = "../" if (!$rootpath);
+    $rootpath .= '/' if ($rootpath !~ /\/$/);
+    
+    if ($Config{'osname'} eq 'MSWin32') {
+      if ($ENV{'NET-SNMP-IN-SOURCE'})
+      {
+	$ret{'insource'} = $ENV{'NET-SNMP-IN-SOURCE'};
+      }
+      elsif ($ENV{'NET-SNMP-PATH'})
+      {
+	$ret{'prefix'} = $ENV{'NET-SNMP-PATH'};
+      }
+      else
+      {
+	# don't have env vars, pull from command line and put there
+	GetOptions("NET-SNMP-IN-SOURCE=s" => \$ret{'insource'},
+	           "NET-SNMP-PATH=s"      => \$ret{'prefix'});
+
+	$ENV{'NET-SNMP-IN-SOURCE'}    = $ret{'insource'};
+	$ENV{'NET-SNMP-PATH'}         = $ret{'prefix'};
+      }
+    }
+    else
+    {
+      if ($ENV{'NET-SNMP-CONFIG'} && 
+        $ENV{'NET-SNMP-IN-SOURCE'}) {
+	# have env vars, pull from there
+	$ret{'nsconfig'} = $ENV{'NET-SNMP-CONFIG'};
+	$ret{'insource'} = $ENV{'NET-SNMP-IN-SOURCE'};
+      } else {
+	# don't have env vars, pull from command line and put there
+	GetOptions("NET-SNMP-CONFIG=s" => \$ret{'nsconfig'},
+	           "NET-SNMP-IN-SOURCE=s" => \$ret{'insource'});
+
+	if ($ret{'insource'} eq "true" && $ret{'nsconfig'} eq "") {
+	    $ret{'nsconfig'}="sh ROOTPATH../net-snmp-config";
+	} elsif ($ret{'nsconfig'} eq "") {
+	    $ret{'nsconfig'}="net-snmp-config";
+	}
+
+	$ENV{'NET-SNMP-CONFIG'}    = $ret{'nsconfig'};
+	$ENV{'NET-SNMP-IN-SOURCE'} = $ret{'insource'};
+      }
+    }	
+    
+    $ret{'nsconfig'} =~ s/ROOTPATH/$rootpath/;
+
+    $ret{'rootpath'} = $rootpath;
+
+    \%ret;
+}
+
diff -Naur tomato/release/src/router/snmp/perl/Makefile.subs.pl tomato121/release/src/router/snmp/perl/Makefile.subs.pl
--- tomato/release/src/router/snmp/perl/Makefile.subs.pl	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/perl/Makefile.subs.pl	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,62 @@
+sub NetSNMPGetOpts {
+    my %ret;
+    my $rootpath = shift;
+    $rootpath = "../" if (!$rootpath);
+    $rootpath .= '/' if ($rootpath !~ /\/$/);
+    
+    if ($Config{'osname'} eq 'MSWin32') {
+      if ($ENV{'NET-SNMP-IN-SOURCE'})
+      {
+	$ret{'insource'} = $ENV{'NET-SNMP-IN-SOURCE'};
+      }
+      elsif ($ENV{'NET-SNMP-PATH'})
+      {
+	$ret{'prefix'} = $ENV{'NET-SNMP-PATH'};
+      }
+      else
+      {
+	# don't have env vars, pull from command line and put there
+	GetOptions("NET-SNMP-IN-SOURCE=s" => \$ret{'insource'},
+	           "NET-SNMP-PATH=s"      => \$ret{'prefix'});
+
+	$ENV{'NET-SNMP-IN-SOURCE'}    = $ret{'insource'};
+	$ENV{'NET-SNMP-PATH'}         = $ret{'prefix'};
+      }
+
+      $basedir = `%COMSPEC% /c cd`;
+      chomp $basedir;
+      $basedir =~ /(.*?)\\perl.*/;
+      $basedir = $1;
+      print "Net-SNMP base directory: $basedir\n";
+
+    }
+    else
+    {
+      if ($ENV{'NET-SNMP-CONFIG'} && 
+        $ENV{'NET-SNMP-IN-SOURCE'}) {
+	# have env vars, pull from there
+	$ret{'nsconfig'} = $ENV{'NET-SNMP-CONFIG'};
+	$ret{'insource'} = $ENV{'NET-SNMP-IN-SOURCE'};
+      } else {
+	# don't have env vars, pull from command line and put there
+	GetOptions("NET-SNMP-CONFIG=s" => \$ret{'nsconfig'},
+	           "NET-SNMP-IN-SOURCE=s" => \$ret{'insource'});
+
+	if ($ret{'insource'} eq "true" && $ret{'nsconfig'} eq "") {
+	    $ret{'nsconfig'}="sh ROOTPATH../net-snmp-config";
+	} elsif ($ret{'nsconfig'} eq "") {
+	    $ret{'nsconfig'}="net-snmp-config";
+	}
+
+	$ENV{'NET-SNMP-CONFIG'}    = $ret{'nsconfig'};
+	$ENV{'NET-SNMP-IN-SOURCE'} = $ret{'insource'};
+      }
+    }	
+    
+    $ret{'nsconfig'} =~ s/ROOTPATH/$rootpath/;
+
+    $ret{'rootpath'} = $rootpath;
+
+    \%ret;
+}
+
diff -Naur tomato/release/src/router/snmp/perl/make-perl-makefiles tomato121/release/src/router/snmp/perl/make-perl-makefiles
--- tomato/release/src/router/snmp/perl/make-perl-makefiles	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/perl/make-perl-makefiles	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,22 @@
+#!/usr/bin/perl
+
+open(I, "Makefile.subs.pl");
+@stuff = <I>;
+
+foreach my $i (@ARGV) {
+    print "updating $i\n";
+    open(I, $i);
+    open(O,">$i.new");
+    while(<I>) {
+	# start replacement here
+	last if /common subroutines -- DO NOT EDIT/;
+	print O;
+    }
+    print O "# common subroutines -- DO NOT EDIT.\n";
+    print O "# They are imported from the Makefile.subs.pl file\n";
+    print O @stuff;
+    rename($i,"$i.bak");
+    rename("$i.new", "$i");
+    close(I);
+    close(O);
+}
diff -Naur tomato/release/src/router/snmp/perl/manager/.cvsignore tomato121/release/src/router/snmp/perl/manager/.cvsignore
--- tomato/release/src/router/snmp/perl/manager/.cvsignore	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/perl/manager/.cvsignore	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,3 @@
+Makefile
+blib
+pm_to_blib
diff -Naur tomato/release/src/router/snmp/perl/manager/displaytable.pm tomato121/release/src/router/snmp/perl/manager/displaytable.pm
--- tomato/release/src/router/snmp/perl/manager/displaytable.pm	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/perl/manager/displaytable.pm	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,627 @@
+# displaytable(TABLENAME, CONFIG...):
+#
+#   stolen from sqltohtml in the ucd-snmp package
+#
+
+package NetSNMP::manager::displaytable;
+use POSIX (isprint);
+
+BEGIN {
+    use Exporter ();
+    use vars qw(@ISA @EXPORT_OK $tableparms $headerparms);
+    @ISA = qw(Exporter);
+    @EXPORT=qw(&displaytable &displaygraph);
+
+    require DBI;
+    require CGI;
+
+    use GD::Graph();
+    use GD::Graph::lines();
+    use GD::Graph::bars();
+    use GD::Graph::points();
+    use GD::Graph::linespoints();
+    use GD::Graph::area();
+    use GD::Graph::pie();
+};
+
+$tableparms="border=1 bgcolor=\"#c0c0e0\"";
+$headerparms="border=1 bgcolor=\"#b0e0b0\"";
+
+sub displaygraph {
+    my $dbh = shift;
+    my $tablename = shift;
+    my %config = @_;
+    my $type = $config{'-type'} || "lines";
+    my $x = $config{'-x'} || "640";
+    my $y = $config{'-y'} || "480";
+    my $bgcolor = $config{'-bgcolor'} || "white";
+    my $datecol = $config{'-xcol'} || "updated";
+    my $xtickevery = $config{'-xtickevery'} || 50;
+    my ($thetable);
+
+#    print STDERR join(",",@_),"\n";
+
+    return -1 if (!defined($dbh) || !defined($tablename) || 
+		  !defined ($config{'-columns'}) || 
+		  ref($config{'-columns'}) ne "ARRAY" ||
+		  !defined ($config{'-indexes'}) || 
+		  ref($config{'-indexes'}) ne "ARRAY");
+
+
+    my $cmd = "SELECT " . 
+	join(",",@{$config{'-columns'}},
+	     @{$config{'-indexes'}}, $datecol) .
+		 " FROM $tablename $config{'-clauses'}";
+    ( $thetable = $dbh->prepare($cmd))
+	or return -1;
+    ( $thetable->execute )
+	or return -1;
+
+    my %data;
+    my $count = 0;
+
+    while( $row = $thetable->fetchrow_hashref() ) {
+	# XXX: multiple indexe columns -> unique name
+	# save all the row's data based on the index column(s)
+	foreach my $j (@{$config{'-columns'}}) {
+	    if ($config{'-difference'} || $config{'-rate'}) {
+		if (defined($lastval{$row->{$config{'-indexes'}[0]}}{$j}{'value'})) {
+		    $data{$row->{$config{'-indexes'}[0]}}{$row->{$datecol}}{$j}=
+			$row->{$j} - 
+			    $lastval{$row->{$config{'-indexes'}[0]}}{$j}{'value'};
+		    #
+		    # convert to a rate if desired.
+		    #
+		    if ($config{'-rate'}) {
+			if (($row->{$datecol} - $lastval{$row->{$config{'-indexes'}[0]}}{$j}{'index'})) {
+			    $data{$row->{$config{'-indexes'}[0]}}{$row->{$datecol}}{$j} = $data{$row->{$config{'-indexes'}[0]}}{$row->{$datecol}}{$j}*$config{'-rate'}/($row->{$datecol} - $lastval{$row->{$config{'-indexes'}[0]}}{$j}{'index'});
+			} else {
+			    $data{$row->{$config{'-indexes'}[0]}}{$row->{$datecol}}{$j} = -1;
+			}
+		    }
+
+		}
+		$lastval{$row->{$config{'-indexes'}[0]}}{$j}{'value'} = $row->{$j};
+		$lastval{$row->{$config{'-indexes'}[0]}}{$j}{'index'} = $row->{$datecol};
+	    } else {
+		$data{$row->{$config{'-indexes'}[0]}}{$row->{$datecol}}{$j} = $row->{$j};
+	    }
+
+	    #
+	    # limit the data to a vertical range.
+	    #
+	    if (defined($config{'-max'}) && 
+		$data{$row->{$config{'-indexes'}[0]}}{$row->{$datecol}}{$j} > 
+		$config{'-max'}) {
+		# set to max value
+		$data{$row->{$config{'-indexes'}[0]}}{$row->{$datecol}}{$j} = 
+		    $config{'-max'};
+	    }
+	    
+	    if (defined($config{'-min'}) && 
+		$data{$row->{$config{'-indexes'}[0]}}{$row->{$datecol}}{$j} < 
+		$config{'-min'}) {
+		# set to min value
+		$data{$row->{$config{'-indexes'}[0]}}{$row->{$datecol}}{$j} = 
+		    $config{'-min'};
+	    }
+	}
+	push @xdata,$row->{$datecol};
+    }
+
+    my @pngdata;
+
+    if (defined($config{'-createdata'})) {
+	&{$config{'-createdata'}}(\@pngdata, \@xdata, \%data);
+    } else {
+	push @pngdata, \@xdata;
+
+	my @datakeys = keys(%data);
+
+#    open(O,">/tmp/data");
+	foreach my $i (@datakeys) {
+	    foreach my $j (@{$config{'-columns'}}) {
+		my @newrow;
+		foreach my $k (@xdata) {
+#		print O "i=$i k=$k j=$j :: $data{$i}{$k}{$j}\n";
+		    push @newrow, ($data{$i}{$k}{$j} || 0);
+		}
+		push @pngdata,\@newrow;
+	    }
+	}
+    }
+#    close O;
+
+    if ($#pngdata > 0) {
+    # create the graph itself
+	my $graph = new GD::Graph::lines($x, $y);
+	$graph->set('bgclr' => $bgcolor);
+#	print STDERR "columns: ", join(",",@{$config{'-columns'}}), "\n";
+ 	if (defined($config{'-legend'})) {
+# 	    print STDERR "legend: ", join(",",@{$config{'-legend'}}), "\n";
+ 	    $graph->set_legend(@{$config{'-legend'}});
+ 	} else {
+ 	    my @legend;
+ 	    foreach my $xxx (@{$config{'-columns'}}) {
+ 		push @legend, "$xxx = $config{'-indexes'}[0]";
+ 	    }
+ 	    $graph->set_legend(@legend);
+ 	}
+	foreach my $i (qw(title x_label_skip x_labels_vertical x_tick_number x_number_format y_number_format x_min_value x_max_value y_min_value y_max_value)) {
+#	    print STDERR "setting $i from -$i = " . $config{"-$i"} . "\n";
+	    $graph->set("$i" => $config{"-$i"}) if ($config{"-$i"});
+	}
+	if ($config{'-pngparms'}) {
+	    $graph->set(@{$config{'-pngparms'}});
+	}
+	print $graph->plot(\@pngdata);
+	return $#{$pngdata[0]};
+    }
+    return -1;
+}
+
+sub displaytable {
+    my $dbh = shift;
+    my $tablename = shift;
+    my %config = @_;
+    my $clauses = $config{'-clauses'};
+    my $dolink = $config{'-dolink'};
+    my $datalink = $config{'-datalink'};
+    my $beginhook = $config{'-beginhook'};
+    my $modifiedhook = $config{'-modifiedhook'};
+    my $endhook = $config{'-endhook'};
+    my $selectwhat = $config{'-select'};
+#    my $printonly = $config{'-printonly'};
+    $selectwhat = "*" if (!defined($selectwhat));
+    my $tableparms = $config{'-tableparms'} || $displaytable::tableparms;
+    my $headerparms = $config{'-headerparms'} || $displaytable::headerparms;
+    my ($thetable, $data, $ref, $prefs, $xlattable);
+
+    if ($config{'-dontdisplaycol'}) {
+	($prefs = $dbh->prepare($config{'-dontdisplaycol'}) )
+	    or die "\nnot ok: $DBI::errstr\n";
+    }
+
+    # get a list of data from the table we want to display
+    ( $thetable = $dbh->prepare("SELECT $selectwhat FROM $tablename $clauses"))
+	or return -1;
+    ( $thetable->execute )
+	or return -1;
+
+    # get a list of data from the table we want to display
+    if ($config{'-xlat'}) {
+	( $xlattable = 
+	 $dbh->prepare("SELECT newname FROM $config{'-xlat'} where oldname = ?"))
+	    or die "\nnot ok: $DBI::errstr\n";
+    }
+    
+    # editable/markable setup
+    my $edited = 0;
+    my $editable = 0;
+    my $markable = 0;
+    my (@indexkeys, @valuekeys, $uph, %indexhash, $q);
+    if (defined($config{'-editable'})) {
+	$editable = 1;
+    }
+
+    if (defined($config{'-mark'}) || defined($config{'-onmarked'})) {
+	$markable = 1;
+    }
+
+    if (defined($config{'-CGI'}) && ref($config{'-CGI'}) eq "CGI") {
+	$q = $config{'-CGI'};
+    }
+
+    if (($editable || $markable)) {
+	if (ref($config{'-indexes'}) eq ARRAY && defined($q)) {
+	    @indexkeys = @{$config{'-indexes'}};
+	    foreach my $kk (@indexkeys) {
+		$indexhash{$kk} = 1;
+	    }
+	} else {
+	    $editable = $markable = 0;
+	    print STDERR "displaytable error: no -indexes option specified or -CGI not specified\n";
+	}
+    }
+
+    if (($editable || $markable) && 
+	$q->param('edited_' . toalpha($tablename))) {
+	$edited = 1;
+    }
+	
+    # table header
+    my $doheader = 1;
+    my @keys;
+    my $rowcount = 0;
+    $thetable->execute();
+    if ($editable || $markable) {
+	print "<input type=hidden name=\"edited_" . toalpha($tablename) . "\" value=1>\n";
+    }
+
+    while( $data = $thetable->fetchrow_hashref() ) {
+	$rowcount++;
+	if ($edited && $editable && !defined($uph)) {
+	    foreach my $kk (keys(%$data)) {
+		push (@valuekeys, maybe_from_hex($kk)) if (!defined($indexhash{$kk}));
+	    }
+	    my $cmd = "update $tablename set " . 
+		join(" = ?, ",@valuekeys) . 
+		    " = ? where " . 
+			join(" = ? and ",@indexkeys) .
+			    " = ?";
+	    $uph = $dbh->prepare($cmd);
+#	    print STDERR "setting up: $cmd<br>\n";
+	}
+	if ($doheader) {
+	    if ($config{'-selectorder'} && 
+		     ref($config{'-selectorder'}) eq "ARRAY") {
+		@keys = @{$config{'-selectorder'}};
+	    } elsif ($config{'-selectorder'}) {
+		$_ = $selectwhat;
+		@keys = split(/, */);
+	    } else {
+		@keys = (sort keys(%$data));
+	    }
+	    if (defined($config{'-title'})) {
+		print "<br><b>$config{'-title'}</b>\n";
+	    } elsif (!defined($config{'-notitle'})) {
+		print "<br><b>";
+		print "<a href=\"$ref\">" if (defined($dolink) && 
+					      defined($ref = &$dolink($tablename)));
+		if ($config{'-xlat'}) {
+		    my $toval = $xlattable->execute($tablename);
+		    if ($toval > 0) {
+			print $xlattable->fetchrow_array;
+		    } else {
+			print "$tablename";
+		    }
+		} else {
+		    print "$tablename";
+		}
+		print "</a>" if (defined($ref));
+		print "</b>\n";
+	    }
+	    print "<br>\n";
+	    print "<table $tableparms>\n";
+	    if (!$config{'-noheaders'}) {
+		print "<tr $headerparms>";
+	    }
+	    if (defined($beginhook)) {
+		&$beginhook($dbh, $tablename);
+	    }
+	    if (!$config{'-noheaders'}) {
+		if ($markable) {
+		    my $ukey = to_unique_key($key, $data, @indexkeys);
+		    print "<td>Mark</td>\n";
+		}
+		foreach $l (@keys) {
+		    if (!defined($prefs) || 
+			$prefs->execute($tablename, $l) eq "0E0") {
+			print "<th>";
+			print "<a href=\"$ref\">" if (defined($dolink) && 
+						      defined($ref = &$dolink($l)));
+			if ($config{'-xlat'}) {
+			    my $toval = $xlattable->execute($l);
+			    if ($toval > 0) {
+				print $xlattable->fetchrow_array;
+			    } else {
+				print "$l";
+			    }
+			} else {
+			    print "$l";
+			}
+			print "</a>" if (defined($ref));
+			print "</th>";
+		    }
+		}
+	    }
+	    if (defined($endhook)) {
+		&$endhook($dbh, $tablename);
+	    }
+	    if (!$config{'-noheaders'}) {
+		print "</tr>\n";
+	    }
+	    $doheader = 0;
+	}
+
+	print "<tr>";
+	if (defined($beginhook)) {
+	    &$beginhook($dbh, $tablename, $data);
+	}
+	if ($edited && $editable) {
+	    my @indexvalues = getvalues($data, @indexkeys);
+	    if ($modifiedhook) {
+		foreach my $valkey (@valuekeys) {
+		    my ($value) = getquery($q, $data, \@indexkeys, $valkey);
+		    if ($value ne $data->{$valkey}) {
+			&$modifiedhook($dbh, $tablename, $valkey, 
+				       $data, @indexvalues);
+		    }
+		}
+	    }
+		    
+	    my $ret = $uph->execute(getquery($q, $data, \@indexkeys, @valuekeys), 
+				    @indexvalues);
+	    foreach my $x (@indexkeys) {
+		next if (defined($indexhash{$x}));
+		$data->{$x} = $q->param(to_unique_key($x, $data, @indexkeys));
+	    }
+#	    print "ret: $ret, $DBI::errstr<br>\n";
+	}
+	if ($markable) {
+	    my $ukey = to_unique_key("mark", $data, @indexkeys);
+	    print "<td><input type=checkbox value=Y name=\"$ukey\"" .
+		(($q->param($ukey) eq "Y") ? " checked" : "") . "></td>\n";
+	    if ($q->param($ukey) eq "Y" && $config{'-onmarked'}) {
+		&{$config{'-onmarked'}}($dbh, $tablename, $data);
+	    }
+	}
+	    
+	foreach $key (@keys) {
+	    if (!defined($prefs) || 
+		$prefs->execute($tablename, $key) eq "0E0") {
+		print "<td>";
+		print "<a href=\"$ref\">" if (defined($datalink) && 
+					      defined($ref = &$datalink($key, $data->{$key})));
+		if ($editable && !defined($indexhash{$key})) {
+		    my $ukey = to_unique_key($key, $data, @indexkeys);
+		    my $sz;
+		    if ($config{'-sizehash'}) {
+			$sz = "size=" . $config{'-sizehash'}{$key};
+		    }
+		    if (!$sz && $config{'-inputsize'}) {
+			$sz = "size=" . $config{'-inputsize'};
+		    }
+		    print STDERR "size $key: $sz from $config{'-sizehash'}{$key} / $config{'-inputsize'}\n";
+		    print "<input type=text name=\"$ukey\" value=\"" . 
+			maybe_to_hex($data->{$key}) . "\" $sz>";
+		} else {
+		    if ($config{'-printer'}) {
+			&{$config{'-printer'}}($key, $data->{$key}, $data);
+		    } elsif ($data->{$key} ne "") {
+			print $data->{$key};
+		    } else {
+			print "&nbsp";
+		    }
+		}
+		print "</a>" if (defined($ref));
+		print "</td>";
+	    }
+	}
+
+	if (defined($endhook)) {
+	    &$endhook($dbh, $tablename, $data);
+	}
+	print "</tr>\n";
+	last if (defined($config{'-maxrows'}) && 
+		 $rowcount >= $config{'-maxrows'});
+    }
+    if ($rowcount > 0) {
+	print "</table>\n";
+    }
+    return $rowcount;
+}
+
+sub to_unique_key {
+    my $ret = shift;
+    $ret .= "_";
+    my $data = shift;
+    if (!defined($data)) {
+	$ret .= join("_",@_);
+    } else {
+	foreach my $i (@_) {
+	    $ret .= "_" . $data->{$i};
+	}
+    }
+    return toalpha($ret);
+}
+
+sub toalpha {
+    my $ret = join("",@_);
+    $ret =~ s/([^A-Za-z0-9_])/ord($1)/eg;
+    return $ret;
+}
+
+sub getvalues {
+    my $hash = shift;
+    my @ret;
+    foreach my $i (@_) {
+	push @ret, maybe_from_hex($hash->{$i});
+    }
+    return @ret;
+}
+
+sub getquery {
+    my $q = shift;
+    my $data = shift;
+    my $keys = shift;
+    my @ret;
+    foreach my $i (@_) {
+	push @ret, maybe_from_hex($q->param(to_unique_key($i, $data, @$keys)));
+    }
+    return @ret;
+}
+
+sub maybe_to_hex {
+    my $str = shift;
+    if (!isprint($str)) {
+	$str = "0x" . (unpack("H*", $str))[0];
+    }
+    $str =~ s/\"/&quot;/g;
+    return $str;
+}
+
+sub maybe_from_hex {
+    my $str = shift;
+    if (substr($str,0,2) eq "0x") {
+	($str) = pack("H*", substr($str,2));
+    }
+    return $str;
+}
+
+1;
+__END__
+=head1 NAME
+
+SNMP - The Perl5 'SNMP' Extension Module v3.1.0 for the UCD SNMPv3 Library
+
+=head1 SYNOPSIS
+
+ use DBI;
+ use displaytable;
+
+ $dbh = DBI->connect(...);
+ $numshown = displaytable($dbh, 'tablename', [options]);
+
+=head1 DESCRIPTION
+
+The displaytable and displaygraph functions format the output of a DBI
+database query into an html or graph output.
+
+=head1 DISPLAYTABLE OPTIONS
+
+=over 4
+
+=item -select => VALUE
+
+Selects a set of columns, or functions to be displayed in the resulting table.
+
+Example: -select => 'column1, column2'
+
+Default: *
+
+=item -title => VALUE
+
+Use VALUE as the title of the table.
+
+=item -notitle => 1
+
+Don't print a title for the table.
+
+=item -noheaders => 1
+
+Don't print a header row at the top of the table.
+
+=item -selectorder => 1
+
+=item -selectorder => [qw(column1 column2)]
+
+Defines the order of the columns.  A value of 1 will use the order of
+the -select statement by textually parsing it's comma seperated list.
+If an array is passed containing the column names, that order will be
+used.
+
+Example: 
+
+  -select => distinct(column1) as foo, -selectorder => [qw(foo)]
+
+=item -maxrows => NUM
+
+Limits the number of display lines to NUM.
+
+=item -tableparms => PARAMS
+
+=item -headerparms => PARAMS
+
+The parameters to be used for formating the table contents and the
+header contents.
+
+Defaults:
+
+  -tableparms  => "border=1 bgcolor='#c0c0e0'"
+
+  -headerparms => "border=1 bgcolor='#b0e0b0'"
+
+=item -dolink => \&FUNC
+
+If passed, FUNC(name) will be called on the tablename or header.  The
+function should return a web url that the header/table name should be
+linked to.
+
+=item -datalink => \&FUNC
+
+Identical to -dolink, but called for the data portion of the table.
+Arguments are the column name and the data element for that column.
+
+=item -printer => \&FUNC
+
+Calls FUNC(COLUMNNAME, COLUMNDATA, DATA) to print the data from each
+column.  COLUMNDATA is the data itself, and DATA is a reference to the
+hash for the entire row (IE, COLUMNDATA = $DATA->{$COLUMNNAME}).
+
+=item -beginhook => \&FUNC
+
+=item -endhook => \&FUNC
+
+displaytable will call these functions at the beginning and end of the
+printing of a row.  Useful for inserting new columns at the beginning
+or end of the table.  When the headers to the table are being printed,
+they will be called like FUNC($dbh, TABLENAME).  When the data is
+being printed, they will be called like FUNC($dbh, TABLENAME, DATA),
+which DATA is a reference to the hash containing the row data.
+
+Example: 
+
+  -endhook => sub { 
+      my ($d, $t, $data) = @_; 
+      if (defined($data)) { 
+	  print "<td>",(100 * $data->{'column1'} / $data->{'column2'}),"</td>";
+      } else { 
+	  print "<td>Percentage</td>"; 
+      } 
+  }
+
+=item -clauses => sql_clauses
+
+Adds clauses to the sql expression.
+
+Example: -clauses => "where column1 = 'value' limit 10 order by column2"
+
+=item -xlat => xlattable
+
+Translates column headers and the table name by looking in a table for
+the appropriate translation.  Essentially uses:
+
+  SELECT newname FROM xlattable where oldname = ?
+
+to translate everything.
+
+=item -editable => 1
+
+=item -indexes   => [qw(INDEX_COLUMNS)]
+
+=item -CGI      => CGI_REFERENCE
+
+If both of these are passed as arguments, the table is printed in
+editable format.  The INDEX_COLUMNS should be a list of columns that
+can be used to uniquely identify a row.  They will be the non-editable
+columns shown in the table.  Everything else will be editable.  The
+form and the submit button written by the rest of the script must loop
+back to the same displaytable clause for the edits to be committed to
+the database.  CGI_REFERENCE should be a reference to the CGI object
+used to query web parameters from ($CGI_REFERENCE = new CGI);
+
+=item -mark     => 1
+
+=item -indexes  => [qw(INDEX_COLUMNS)]
+
+=item -CGI      => CGI_REFERENCE
+
+=item -onmarked => \&FUNC
+
+When the first three of these are specified, the left hand most column
+will be a check box that allows users to mark the row for future work.
+
+FUNC($dbh, TABLENAME, DATA) will be called for each marked entry when
+a submission data has been processed.  $DATA is a hash reference to
+the rows dataset.  See -editable above for more information.
+
+-onmarked => \&FUNC implies -mark => 1.
+
+=back
+
+=head1 Author
+
+wjhardaker@ucdavis.edu
+
+=cut
diff -Naur tomato/release/src/router/snmp/perl/manager/getValues.pm tomato121/release/src/router/snmp/perl/manager/getValues.pm
--- tomato/release/src/router/snmp/perl/manager/getValues.pm	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/perl/manager/getValues.pm	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,49 @@
+#
+# getValues($dbh, 
+#           [-varcol => varname,]
+#           [-valcol => varval,]
+#           [-key => keyname,]
+#           tablename => indexname,
+#           ...)
+
+package NetSNMP::manager::getValues;
+require Exporter;
+@ISA = qw(Exporter);
+@EXPORT_OK=(getValues);
+
+my $varcol = "varcol";
+my $valcol = "valcol";
+my $key = "lookup";
+
+sub getValues {
+    my $dbh = shift;
+    my (@vars2, $tmp, $cursor, $row, %results, $i, $cursor);
+    my ($varcol, $valcol, $key) = ($varcol, $valcol, $key);
+    my @vars = @_;
+    while($#vars >= 0) {
+	$i = shift @vars;
+	$tmp = shift @vars;
+	if ($i =~ /^-/) {
+	    $varcol = $tmp if ($i =~ /-varcol/);
+	    $valcol = $tmp if ($i =~ /-valcol/);
+	    $key = $tmp if ($i =~ /-key/);
+	} else {
+	    push(@vars2,$i,$tmp);
+	}
+    }
+    while($#vars2 >= 0) {
+	$i = shift @vars2;
+	$tmp = shift @vars2;
+#	print "select $varcol,$valcol from $i where $key = '$tmp'\n";
+	($cursor =
+	 $dbh->prepare("select $varcol,$valcol from $i where $key = '$tmp'"))
+	    or die "\nnot ok: $DBI::errstr\n";
+	($cursor->execute)
+	    or die "\nnot ok: $DBI::errstr\n";
+	while ( $row = $cursor->fetchrow_hashref ) {
+	    $results{$row->{$varcol}} = $row->{$valcol};
+	}
+    }
+    return %results;
+}
+1;
diff -Naur tomato/release/src/router/snmp/perl/manager/INSTALL tomato121/release/src/router/snmp/perl/manager/INSTALL
--- tomato/release/src/router/snmp/perl/manager/INSTALL	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/perl/manager/INSTALL	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,198 @@
+REQUIREMENTS
+
+  A knowledgeable user.  This system is *not* entirely user friendly
+  yet.   You have been warned.  Use at your own risk.  yada yada yada.
+
+  Get and install:
+  
+    the mysql (http://www.mysql.com) database
+      it may work with other databases, but I haven't tried.
+
+    Apache (http://www.apache.org)
+
+    The following perl modules (http://www.cpan.org):
+      mod_perl
+      SNMP (from the net-snmp source tree: SRCTREE/perl/SNMP)
+      CGI
+      DBI
+      DBD::mSQL
+      GD::Graph
+
+    You may need more modules depending on your perl version, so sorry
+    in advance if I missed some.
+
+  Building and setting up mysql (a summary of what is needed.  See the
+  mysql documentation for further details):
+     ./configure
+     make
+     make install
+     scripts/mysql_install_db
+  
+     start it by running 'safe_mysqld'.
+     To run the sql commands listed in the following text, run
+     'mysql'.
+
+SQL REQUIREMENTS
+
+  The scripts used by this project automatically create, edit, delete, 
+  insert, update, etc everything necessary.  Because of this, you'll
+  need to set up a SQL user with the ability to modify the heck out of 
+  a database called "snmp" on your mysql server.  We'll call this user 
+  SQLUSER below, and its password SQLPASSWORD.  Replace these with
+  your appropriate information anytime you see them listed below.
+
+INSTALLING THE PERL MODULES
+
+  perl Makefile.PL
+  make
+  make install
+
+  Copy the red.gif, and green.gif graphics files to your apache
+  HTML-ROOT/graphics/.
+
+SETTING UP APACHE
+
+  (assumes you have mod_perl installed properly from above)
+
+  Idealy, it should be put behind a user/password database in your web
+  server (something that sets the REMOTE_USER environmental for CGI
+  scripts).  This will greatly enhance its operation so that different
+  users can be users of different groups of hosts, etc...  If this is
+  not done, everyone will use the user name "guest".
+
+  At the bottom of your httpd.conf file or in an apporpriate
+  VirtualHost directive put the following lines, appropriately
+  configuring the sql username, etc.  I strongly recommend turning on
+  SSL support for this as well.:
+
+    PerlModule netsnmp::manager
+    <Location /manage>
+         # put apache protection stuff here, like a password database etc!!!
+         SetHandler perl-script
+         PerlHandler ucdsnmp::manager
+         PerlSetVar hostname SQLHOST
+         PerlSetVar dbname snmp
+         PerlSetVar user SQLUSER
+         PerlSetVar pass SQLPASSWORD
+
+	 # turn on password protection.  see apache htpasswd documentation.
+	 # comment these out for unauthenticated access (generally a bad idea)
+	 AuthType Basic
+         AuthName "SNMP manager access"
+         AuthUserFile /etc/httpd/conf/manager-passwd
+         require valid-user
+
+    </Location>
+
+   Restart apache after you've done the above.
+
+SETTING UP THE MYSQL UCD-SNMP DATABASES
+
+  Use the following perl script to set up the mysql database tables
+  required:
+
+    ./setupdb -u SQLUSER -p SQLPASSWORD -h SQLHOST
+
+  To display what this will do before you run it:
+
+    ./setupdb -v -n
+
+SETTING UP USERS OF THE SYSTEM
+
+  Now you need to add yourself as a user.  You'll want to use a
+  username that you configured for your apache password file (or
+  whatever), or the user "guest" if you didn't configure apache for
+  authenticated access.  The -a in this case grants "administrative"
+  rights to the group of hosts, and thus allows the user to add new
+  hosts to the group, delete hosts, etc.  Non-administrative users are 
+  mostly "read-only" type users.
+
+  The interface groups hosts together in "groups", and you put users
+  in these groups to assign responsiblity for them.  Groups are
+  created when a user gets assigned to one, so just pick a groupname
+  for now and use it below.  Maybe later you can add yourself to a new 
+  group using a similar command, and the web interface will change to
+  reflect that you are now in more than one group.  Use the same group 
+  name for multiple users that all belong to a single "group".
+
+  If you add an email address to the argument list the system will
+  mail that user every time it finds a problem or finds a problem that 
+  has been fixed.
+
+  *** DO NOT PICK A GROUP WITH THE NAME "default" ***
+
+    ./setupuser -u SQLUSER -p SQLPASSWORD -h SQLHOST -a GROUPNAME USERNAME [EMAILADDRESS]
+
+SETTING UP SNMP AUTHORIZATION INFORMATION
+
+  Now, you need to add in your default authorization information for
+  how to make SNMP requests to your host.  The parameter names you can 
+  pick come straight from the SNMP perl module, so see "perldoc SNMP"
+  for all the parameter names you can pick from.
+
+  Examples:
+
+    ./setupauth -u SQLUSER -p SQLPASSWORD -h SQLHOST Version 1 Community public
+    ./setupauth -u SQLUSER -p SQLPASSWORD -h SQLHOST Version 3 SecName 'v3user' AuthPass 'myv3passphrase' SecLevel authNoPriv
+
+  I also recommend adding a large default timeout (30 secs):
+
+    ./setupauth -u SQLUSER -p SQLPASSWORD -h SQLHOST Timeout 30000000
+  
+  If you want different parameters for a group, it'll inherit
+  everything from the default parameters specified above plus any more 
+  that you set or override:
+
+    ./setupauth -u SQLUSER -p SQLPASSWORD -h SQLHOST -g agroup Community private
+
+  Further, hosts can be given specific parameters as well if they're
+  really special:
+
+    ./setupauth -u SQLUSER -p SQLPASSWORD -h SQLHOST -m host Timeout 60000000
+
+COLLECTING THE DATA
+
+  The command you need to run to collect data is snmptosql, which will 
+  use the information defined above to fill your data base with all
+  sorts of useful information that you've asked it to collect.
+  Something like:
+
+    snmptosql -H SQLHOST -u SQLUSER -p SQLPASSWORD
+
+  should be put in cron to update a regular intervals.  I run mine
+  every 10 minutes.  Note that it will *not* scale to a large number
+  of hosts easily at the moment.  Start with no more than 20 or so to
+  begin with.
+
+USING THE SYSTEM
+
+  Most of the things you'll need to do can be done from the web
+  interface that you've just set up as /manager on some system in the 
+  step above.  Go to this web page to see what you can do.
+
+MONITORING HOSTS WITH IT (finally)
+
+  It's *not* entirely intuitive yet.  So, lets give you an example.  In
+  your snmpd.conf file, put a line that says "proc sendmail".  This will 
+  check to see if sendmail is running on your system.  Also put "disk /
+  10%" which will require the disk has at least 10% of free space.
+  Restart the snmpd (or kill -HUP).  See the snmpd.conf manual page
+  for some details.
+
+  Then, go to the above URL and click on the group name you want to
+  add a host to and enter the host name in the dialog box near the
+  bottom of the page (assuming you're logged in as an administrator
+  user setup using the -a flag to setupuser above).  Click on the
+  "setup group XXX" link at the bottom of the group's page and click
+  on all the check buttons (you can turn them all on even if you're
+  not really using them all) and hit the submit button.
+
+  Come back 10 minutes later, reload the group and click on the host
+  name.  You should see pretty red/green lights if there is or isn't a
+  problem.  It'll show you a few tables with the various bits of data
+  it collected (including how many sendmail processes are running, an
+  how much disk space is actually being used), etc.
+
+GRAPHING
+
+  To be written.
diff -Naur tomato/release/src/router/snmp/perl/manager/Makefile.PL tomato121/release/src/router/snmp/perl/manager/Makefile.PL
--- tomato/release/src/router/snmp/perl/manager/Makefile.PL	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/perl/manager/Makefile.PL	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,16 @@
+use ExtUtils::MakeMaker;
+# See lib/ExtUtils/MakeMaker.pm for details of how to influence
+# the contents of the Makefile that is written.
+WriteMakefile(
+    'NAME'		=> 'NetSNMP::manager',
+    'VERSION'	        => '', # finds $VERSION
+    'PREREQ_PM'		=> {# SNMP => 4.0,
+			    DBI => 0,
+			    CGI => 0}, # e.g., Module::Name => 1.1
+    'PM'                => { 
+	'displaytable.pm' => '$(INST_LIBDIR)/../displaytable.pm',
+	'getValues.pm' => '$(INST_LIBDIR)/../getValues.pm',
+	'manager.pm' => '$(INST_LIBDIR)/manager.pm'
+    },
+    'EXE_FILES'         => [qw(snmptosql setupdb setupuser setupauth)]
+);
diff -Naur tomato/release/src/router/snmp/perl/manager/manager.pm tomato121/release/src/router/snmp/perl/manager/manager.pm
--- tomato/release/src/router/snmp/perl/manager/manager.pm	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/perl/manager/manager.pm	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,1052 @@
+#!/usr/local/bin/perl
+
+package NetSNMP::manager;
+
+use strict ();
+use Apache::Constants qw(:common);
+use CGI qw(:standard delete_all);
+use SNMP ();
+use DBI ();
+use NetSNMP::manager::displaytable qw(displaytable displaygraph);
+
+# globals
+$NetSNMP::manager::hostname = 'localhost';          # Host that serves the mSQL Database
+$NetSNMP::manager::dbname = 'snmp';                 # mySQL Database name
+$NetSNMP::manager::user = 'root';
+# $NetSNMP::manager::pass = "password";
+$NetSNMP::manager::imagebase = "/home/hardaker/src/snmp/manager";	# <=== CHANGE ME ====
+$NetSNMP::manager::redimage = "/graphics/red.gif";
+$NetSNMP::manager::greenimage = "/graphics/green.gif";
+#$NetSNMP::manager::verbose = 1;
+$NetSNMP::manager::tableparms  = "border=1 bgcolor=\"#c0c0e0\"";
+$NetSNMP::manager::headerparms = "border=1 bgcolor=\"#b0e0b0\"";
+
+# init the snmp library
+$SNMP::save_descriptions=1;
+#SNMP::init_mib();
+
+%NetSNMP::manager::myorder = qw(id 0 oidindex 1 host 2 updated 3);
+
+sub handler {
+    my $r = shift;
+    Apache->request($r);
+
+    # get info from handler
+    my $hostname = $r->dir_config('hostname') || $NetSNMP::manager::hostname;
+    my $dbname = $r->dir_config('dbname') || $NetSNMP::manager::dbname;
+    my $sqluser = $r->dir_config('user') || $NetSNMP::manager::user;
+    my $pass = $r->dir_config('pass') || $NetSNMP::manager::pass;
+    my $verbose = $r->dir_config('verbose') || $NetSNMP::manager::verbose;
+
+#===========================================================================
+#  Global defines
+#===========================================================================
+
+my ($dbh, $query, $remuser);
+
+$remuser = $ENV{'REMOTE_USER'};
+$remuser = "guest" if (!defined($remuser) || $remuser eq "");
+
+#===========================================================================
+# Connect to the mSQL database with the appropriate driver
+#===========================================================================
+($dbh = DBI->connect("DBI:mysql:database=$dbname;host=$hostname", $sqluser, $pass))
+    or die "\tConnect not ok: $DBI::errstr\n";
+
+#===========================================================================
+# stats Images, for inclusion on another page. (ie, slashdot user box)
+#===========================================================================
+if (my $group = param('groupstat')) {
+    $r->content_type("image/gif");
+    $r->send_http_header();
+    my $cur = getcursor($dbh, "select host from usergroups as ug, hostgroups as hg where ug.groupname = '$group' and hg.groupname = '$group' and user = '$remuser'");
+    while (my $row = $cur->fetchrow_hashref ) {
+	if (checkhost($dbh, $group, $row->{'host'})) {
+	    open(I, "$NetSNMP::manager::imagebase$NetSNMP::manager::redimage");
+	    while(read(I, $_, 4096)) { print; }
+	    close(I);
+	}
+    }
+    open(I, "$NetSNMP::manager::imagebase$NetSNMP::manager::greenimage");
+    while(read(I, $_, 4096)) { print; }
+    close(I);
+    return OK();
+}
+
+
+sub date_format {
+    my $time = shift;
+    my @out = localtime($time);
+    my $ret = $out[4] . "-" . $out[3] . "-" . $out[5] . " " . $out[2] . " " . $out[1];
+#    print STDERR "$time: $ret\n";
+    return $ret;
+}
+
+
+#
+# Graphing of historical data
+#
+if ((param('displaygraph') || param('dograph')) && param('table')) {
+    my $host = param('host');
+    my $group = param('group');
+    if (!isuser($dbh, $remuser, $group)) {
+	$r->content_type("image/png");
+	$r->send_http_header();
+	print "Unauthorized access to that group ($group)\n";
+	return Exit($dbh, $group);
+    }    
+    my $table = param('table');
+    my @columns;
+
+    if (!param('dograph')) {
+	$r->content_type("text/html");
+	$r->send_http_header();
+	print "<body bgcolor=\"#ffffff\">\n";
+	print "<form>\n";
+	print "<table border=1><tr><td>\n";
+
+	print "<table>\n";
+	print "<tr align=top><th></th><th>Select indexes<br>to graph</th></tr>\n";
+
+	my $handle = getcursor($dbh, "SELECT sql_small_result distinct(oidindex) FROM $table where host = '$host'");
+	my @cols;
+	while (  $row = $handle->fetchrow_hashref ) {
+	    print "<tr><td>$row->{oidindex}</td><td><input type=checkbox value=1 name=" . 'graph_' . displaytable::to_unique_key($row->{'oidindex'}) . "></td></tr>\n";
+	}
+	print "</table>\n";
+
+	print "</td><td>\n";
+
+	print "<table>\n";
+	print "<tr align=top><th></th><th>Select Columns<br>to graph</th></tr>\n";
+	my $handle = getcursor($dbh, "SELECT * FROM $table limit 1");
+	my $row = $handle->fetchrow_hashref;
+	map { print "<tr><td>$_</td><td><input type=checkbox value=1 name=column_" . displaytable::to_unique_key($_) . "></td></tr>\n"; } keys(%$row);
+	print "</table>\n";
+
+	print "</td></tr></table>\n";
+
+	print "<br>Graph as a Rate: <input type=checkbox value=1 name=graph_as_rate><br>\n";
+	print "<br>Maximum Y Value: <input type=text value=inf name=max_y><br>\n";
+	print "<br>Minimum Y Value: <input type=text value=-inf name=min_y><br>\n";
+
+	print "<input type=hidden name=table value=\"$table\">\n";
+	print "<input type=hidden name=host value=\"$host\">\n";
+	print "<input type=hidden name=dograph value=1>\n";
+	print "<input type=hidden name=group value=\"$group\">\n";
+	print "<input type=submit name=\"Make Graph\">\n";
+
+	print "</form>\n";
+
+	my $handle = getcursor($dbh, "SELECT distinct(oidindex) FROM $table where host = '$host' order by oidindex");
+	return Exit($dbh, $group);
+    }
+    if (param('graph_all_data')) {
+	$clause = "host = '$host'";
+    } else {
+	my $handle = getcursor($dbh, "SELECT distinct(oidindex) FROM $table where host = '$host'");
+	$clause = "where (";
+	while (  $row = $handle->fetchrow_hashref ) {
+#	    print STDERR "graph test: " . $row->{'oidindex'} . "=" . "graph_" . displaytable::to_unique_key($row->{'oidindex'}) . "=" . param("graph_" . displaytable::to_unique_key($row->{'oidindex'})) . "\n";
+	    if (param("graph_" . displaytable::to_unique_key($row->{'oidindex'}))) {
+		$clause .= " or oidindex = " . $row->{'oidindex'} . "";
+	    }
+	}
+
+	my $handle = getcursor($dbh, "SELECT * FROM $table limit 1");
+	my $row = $handle->fetchrow_hashref;
+	map { push @columns, $_ if (param('column_' . displaytable::to_unique_key($_))) } keys(%$row);
+
+	$clause .= ")";
+	$clause =~ s/\( or /\(/;
+	if ($clause =~ /\(\)/ || $#columns == -1) {
+	    $r->content_type("text/html");
+	    $r->send_http_header();
+	    print "<body bgcolor=\"#ffffff\">\n";
+	    print "<h1>No Data to Graph</h1>\n";
+	    print STDERR "No data to graph: $clause, $#columns\n";
+	    return Exit($dbh, "$group");
+	}
+	$clause .= " and host = '$host'";
+    }
+
+#    print STDERR "graphing clause: $clause\n";
+
+    # all is ok, display the graph
+
+    $r->content_type("image/png");
+    $r->send_http_header();
+
+    print STDERR "graphing clause: $clause, columns: ", join(", ",@columns), "\n";
+    my @args;
+    push (@args, '-rate', '60') if (param('graph_as_rate'));
+    push (@args, '-max', param('max_y')) if (param('max_y') && param('max_y') =~ /^[-.\d]+$/);
+    push (@args, '-min', param('min_y')) if (param('min_y') && param('min_y') =~ /^[-.\d]+$/);
+
+    my $ret = 
+    displaygraph($dbh, $table,
+#		 '-xcol', "date_format(updated,'%m-%d-%y %h:%i')",
+		 '-xcol', "unix_timestamp(updated)",
+		 '-pngparms', [
+		     'x_labels_vertical', '1',
+		     'x_tick_number', 6,
+		     'x_number_format', \&date_format,
+		     'y_label', 'Count/Min',
+		     'title', $table,
+#		     'y_min_value', 0,
+		 ],
+		 '-clauses', "$clause order by updated",
+		 @args,
+		 '-columns', \@columns,
+		 '-indexes', ['oidindex']);
+    print STDERR "$ret rows graphed\n";
+    return OK();
+}
+
+#===========================================================================
+# Start HTML.
+#===========================================================================
+$r->content_type("text/html");
+$r->send_http_header();
+print "<body bgcolor=\"#ffffff\">\n";
+print "<h1>UCD-SNMP Management Console</h1>\n";
+print "<hr>\n";
+
+#===========================================================================
+# Display mib related data information
+#===========================================================================
+if (param('displayinfo')) {
+    makemibtable(param('displayinfo'));
+    return Exit($dbh, "");
+}
+
+#===========================================================================
+# Display a generic sql table of any kind (debugging).
+#===========================================================================
+# if (my $disptable = param('displaytable')) {
+#     if (param('editable') == 1) {
+# 	print "<form submit=dont>\n";
+# 	displaytable($disptable, -editable, 1);
+# 	print "</form>\n";
+#     } else {
+# 	displaytable($disptable);
+#     }
+#     return Exit($dbh,  "");
+# }
+
+#===========================================================================
+# Get host and group from CGI query.
+#===========================================================================
+my $host = param('host');
+my $group = param('group');
+
+#===========================================================================
+# Editable user information
+#===========================================================================
+
+if (param('setuponcall')) {
+    print "<title>oncall schedule for user: $remuser</title>\n";
+    print "<h2>oncall schedule for user: $remuser</h2>\n";
+    print "<p>Please select your oncall schedule and mailing addresses for your groups below:";
+    if (!isexpert($remuser)) {
+	print "<ul>\n";
+        print "<li>Values for the days/hours fields can be comma seperated lists of hours/days/ranges.  EG: hours: 7-18,0-4.\n";
+	print "</ul>\n";
+    }
+    print "<form method=post><input type=hidden name=setuponcall value=1>\n";
+    displaytable($dbh, 'oncall',
+    '-clauses',"where user = '$remuser' order by groupname",
+    '-select','id, user, groupname, email, pager, days, hours',
+    '-selectorder', 1,
+    '-notitle', 1,
+    '-editable', 1,
+    '-indexes', ['id','user','groupname'],
+    '-CGI', $CGI::Q
+    );
+    print "<input type=submit value=\"submit changes\">\n";
+    print "</form>\n";
+    return Exit($dbh, $group);
+}
+
+#===========================================================================
+# show the list of groups a user belongs to.
+#===========================================================================
+if (!defined($group)) {
+    my @groups = getgroupsforuser($dbh, $remuser);
+    print "<title>Net-SNMP Group List</title>\n";
+    print "<h2>Host groupings you may access:</h2>\n";
+    if (!isexpert($remuser)) {
+	print "<ul>\n";
+	print "<li>Click on a group to operate or view the hosts in that group.\n";
+	print "<li>Click on a red status light below to list the problems found.\n";
+	print "</ul>\n";
+    }
+	
+    if ($#groups > 0) {
+	displaytable($dbh, 'usergroups', 
+		     '-clauses', "where (user = '$remuser')",
+		     '-select', 'distinct groupname',
+		     '-notitle', 1,
+		     '-printonly', ['groupname'],
+		     '-datalink', sub { my $q = self_url();
+					my $key = shift;
+					my $h = shift;
+					return if ($key ne "groupname");
+					return addtoken($q,"group=$h");
+				    },
+		     '-beginhook', 
+		     sub { 
+			 my $q = self_url();
+			 my($dbh, $junk, $data) = @_;
+			 if (!defined($data)) {
+			     print "<th>Status</th>";
+			     return;
+			 }
+			 my ($cur, $row);
+			 $cur = getcursor($dbh, "select host from hostgroups where groupname = '$data->{groupname}'");
+			 while (  $row = $cur->fetchrow_hashref ) {
+			     if (checkhost($dbh, $data->{'groupname'}, 
+					   $row->{'host'})) {
+				 print "<td><a href=\"" . addtoken($q,"group=$data->{groupname}&summarizegroup=1") . "\"><img border=0 src=$NetSNMP::manager::redimage></a></td>\n";
+				 return;
+			     }
+			 }
+			 print "<td><img src=$NetSNMP::manager::greenimage></td>\n";
+		     }
+		     );
+	$dbh->disconnect();
+	return Exit($dbh,  $group);
+    } else {
+	if ($#groups == -1) {
+	    print "You are not configured to use the Net-SNMP-manager, please contact your system administrator.";
+	    return Exit($dbh,  $group);
+	}
+	$group = $groups[0];
+    }
+}
+
+#===========================================================================
+# reject un-authorized people accessing a certain group
+#===========================================================================
+if (!isuser($dbh, $remuser, $group)) {
+    print "Unauthorized access to that group ($group)\n";
+    return Exit($dbh, $group);
+}    
+
+#===========================================================================
+# add a new host to a group
+#===========================================================================
+if (defined(my $newhost = param('newhost'))) {
+    if (isadmin($dbh, $remuser, $group)) {
+	if ($dbh->do("select * from hostgroups where host = '$newhost' and groupname = '$group'") eq "0E0") {
+	    $dbh->do("insert into hostgroups(host,groupname) values('$newhost','$group')") ;
+	} else {
+	    print "<b>ERROR: host $newhost already in $group</b>\n";
+	}
+	CGI::delete('newhost');
+    }
+}
+
+#===========================================================================
+# display setup configuration for a group
+#===========================================================================
+if (defined(param('setupgroup'))) {
+    if (isadmin($dbh, $remuser, $group)) {
+	setupgroup($dbh, $group);
+    } else {
+	print "<h2>You're not able to perform setup operations for group $group\n";
+    }
+    return Exit($dbh, $group);
+}
+
+#===========================================================================
+# save configuration information submitted about a group
+#===========================================================================
+if (defined(param('setupgroupsubmit')) && 
+    isadmin($dbh, $remuser, $group)) {
+    setupgroupsubmit($dbh, $group);
+    delete_all();
+    param(-name => 'group', -value => $group);
+    print "<a href=\"" . self_url() . "\">Entries submitted</a>";
+    return Exit($dbh, $group);
+}
+
+#===========================================================================
+# user preferences
+#===========================================================================
+if (defined(param('userprefs'))) {
+    setupuserpreferences($dbh, $remuser, $group);
+    return Exit($dbh, $group);
+}
+
+#===========================================================================
+# save submitted user preferences
+#===========================================================================
+if (defined(param('setupuserprefssubmit')) && 
+    isadmin($dbh, $remuser, $group)) {
+    setupusersubmit($dbh, $remuser, $group);
+    delete_all();
+    param(-name => 'group', -value => $group);
+    print "<a href=\"" . self_url() . "\">Entries submitted</a>";
+    return Exit($dbh, $group);
+}
+
+#===========================================================================
+# summarize problems in a group
+#===========================================================================
+if (defined(param('summarizegroup'))) {
+    print "<title>group problem summary: $group</title>\n";
+    print "<h2>The following is a list of problems in the group \"$group\":</h2>\n";
+    summarizeerrors($dbh, "where groupname = '$group'");
+    return Exit($dbh, $group);
+}
+
+#===========================================================================
+# summarize problems on a host
+#===========================================================================
+if (defined($host) && defined(param('summarizehost'))) {
+    print "<title>host summary: $host</title>\n";
+    print "<h2>The following is a list of problems for the host \"$host\":</h2>\n";
+    summarizeerrors($dbh, "where groupname = '$group' and host = '$host'");
+    return Exit($dbh, $group);
+}
+
+#===========================================================================
+# display a list of hosts in a group
+#===========================================================================
+if (!defined($host)) {
+    print "<title>Net-SNMP Host $host</title>\n";
+    print "<h2>Hosts in the group \"$group\":</h2>\n";
+    if (!isexpert($remuser)) {
+	print "<ul>\n";
+	if (isadmin($dbh, $remuser, $group)) {
+	    my $q = self_url();
+	    $q =~ s/\?.*//;
+            print "<li>Make sure you <a href=\"" . addtoken($q,"group=$group&setupgroup=1") . "\">set up the host</a> for the SNMP tables you want to monitor.\n";
+        }
+	print "<li>Click on a hostname to operate on or view the information tables associated with that group.\n";
+	print "<li>Click on a red status light below to list the problems found in with a particular host.\n";
+	print "</ul>\n";
+    }
+    displaytable($dbh, 'hostgroups', 
+		 '-notitle',0,
+		 '-clauses', "where (groupname = '$group')",
+		 '-select', 'distinct host, sysObjectId, sysDescr, sysUpTime, versionTag',
+		 '-datalink', sub { my $q = self_url();
+				    my $key = shift;
+				    my $h = shift;
+				    return if ($key ne "host");
+				    return addtoken($q,"host=$h");
+				},
+		 '-beginhook', 
+		 sub { 
+		     my $q = self_url();
+		     my($dbh, $junk, $data) = @_;
+		     if (!defined($data)) {
+			 print "<th>Status</th>";
+			 return;
+		     }
+		     if (checkhost($dbh, $group, $data->{'host'})) {
+			 print "<td><a href=\"" . addtoken($q,"group=$group&summarizehost=1&host=$data->{host}") . "\"><img border=0 src=$NetSNMP::manager::redimage></a></td>\n";
+		     } else {
+			 print "<td><img src=$NetSNMP::manager::greenimage></td>\n";
+		     }
+		 }
+		 );
+    if (isadmin($dbh, $remuser, $group)) {
+	addhostentryform($group);
+	my $q = self_url();
+	$q =~ s/\?.*//;
+	print "<a href=\"" . addtoken($q,"group=$group&setupgroup=1") . "\">setup group $group</a>\n";
+    }
+    return Exit($dbh, $group);
+}
+
+#===========================================================================
+# setup the host's history records
+#===========================================================================
+if (param('setuphost')) {
+    print "<title>Net-SNMP history setup for host: $host</title>\n";
+    print "<h2>Net-SNMP history setup for the host: \"$host\"</h2>\n";
+    print "<p>Enter the number of days to keep the data for a given table for the host \"$host\":\n";
+    if (!isexpert($remuser)) {
+	print "<ul>\n";
+        print "<li>Numbers must be greater than or equal to 1 to enable history logging.\n";
+	print "</ul>\n";
+    }
+    print "<form method=post><input type=hidden name=setuphost value=1><input type=hidden name=host value=\"$host\"><input type=hidden name=group value=\"$group\">\n";
+    displaytable($dbh, 'hosttables',
+    '-clauses',"where host = '$host' and groupname = '$group'",
+    '-select','groupname, host, tablename, keephistory',
+    '-selectorder', 1,
+    '-notitle', 1,
+    '-editable', 1,
+    '-indexes', ['groupname','host','tablename'],
+    '-CGI', $CGI::Q
+    );
+    print "<input type=submit value=\"submit changes\">\n";
+    print "</form>\n";
+    return Exit($dbh, $group);
+}
+
+#===========================================================================
+# display a huge table of history about something
+#===========================================================================
+if (param('displayhistory')) {
+    if (!isuser($dbh, $remuser, $group)) {
+        print "Unauthorized access to that group ($group)\n";
+        return Exit($dbh, $group);
+    }
+    displaytable($dbh, param('table'), 
+    '-clauses', "where (host = '$host')",
+    '-dolink', \&linktodisplayinfo,
+    '-dontdisplaycol', "select * from userprefs where user = '$remuser' and groupname = '$group' and tablename = ? and columnname = ? and displayit = 'N'"
+    );
+    return Exit($dbh, $group);
+}
+
+#===========================================================================
+# display inforamation about a host
+#  optionally add new collection tables
+#===========================================================================
+showhost($dbh, $host, $group, $remuser);
+if (isadmin($dbh, $remuser, $group)) {
+    if (param('newtables')) {
+    	my $x = param('newtables');
+    	$x =~ s/,/ /g;
+    	if (/[^\w\s]/) {
+    	    print "<br>Illegal table names in addition list: $x<br>\n" 
+    	} else {
+	    my @x = split(/\s+/,$x);
+	    foreach my $i (@x) {
+		$dbh->do("insert into hosttables(host, groupname, tablename, keephistory) values('$host','$group','$i','0')");
+	    }
+    	    print "<br>adding: ",join(", ",@x),"<br>\n";
+    	}
+    } else {
+        print "<br>Add new MIB Tables or Groups that you want to collect for this host: <form><input type=hidden name=host value=\"$host\"><input type=hidden name=group value=\"$group\"><input name=\"newtables\" type=text><br><input type=submit value=\"add tables\"></form>\n";
+    }
+    my $q = self_url();
+    $q =~ s/\?.*//;
+    print "<a href=\"" . addtoken($q, "setuphost=1&host=$host&group=$group") . "\">setup host $host</a>\n";
+}
+return Exit($dbh, $group);
+
+#===========================================================================
+# END of handler
+#===========================================================================
+
+}
+
+# add a token to a url string.  Use either a ? or an & depending on
+# existence of ?.
+sub addtoken {
+    my $url = shift;
+    my $token = shift;
+    return "$url&$token" if ($url =~ /\?/);
+    return "$url?$token";
+}
+
+#
+# summarizeerrors(DB-HANDLE, CLAUSE):
+#   summarize the list of errors in a given CLAUSE
+#
+sub summarizeerrors {
+    my $dbh = shift;
+    my $clause = shift;
+    $clause = "where" if ($clause eq "");
+    my $clause2 = $clause;
+    $clause2 =~ s/ host / hosterrors.host /;
+
+    # Major errors
+    displaytable($dbh, 'hosterrors, hostgroups',  # , hostgroups
+		 '-select', "hosterrors.host as host, errormsg",
+		 '-notitle', 1,
+		 '-title', "Fatal Errors",
+		 '-clauses', "$clause2 and hosterrors.host = hostgroups.host",
+		 '-beginhook', sub {
+		     if ($#_ < 2) {
+			 #doing header;
+			 print "<td></td>";
+		     } else {
+			 print "<td><img src=\"$NetSNMP::manager::redimage\"></td>\n";
+		     }});
+
+    my $tabletop = "<br><table $NetSNMP::manager::tableparms><tr $NetSNMP::manager::headerparms><th><b>Host</b></th><th><b>Table</b></th><th><b>Description</b></th></tr>\n";
+    my $donetop = 0;
+    my $cursor = 
+	getcursor($dbh, "SELECT * FROM hosttables $clause");
+
+    while (my $row = $cursor->fetchrow_hashref ) {
+
+	my $exprs = getcursor($dbh, "SELECT * FROM errorexpressions where (tablename = '$row->{tablename}')");
+	
+	while (my  $expr = $exprs->fetchrow_hashref ) {
+	    my $errors = getcursor($dbh, "select * from $row->{tablename} where $expr->{expression} and host = '$row->{host}'");
+	    while (my  $error = $errors->fetchrow_hashref ) {
+		print $tabletop if ($donetop++ == 0);
+		print "<tr><td>$row->{host}</td><td>$row->{tablename}</td><td>$expr->{returnfield}: $error->{$expr->{returnfield}}</td></tr>";
+	    }
+	}
+    }
+    print "</table>";
+}
+
+#
+# getcursor(CMD):
+#    genericlly get a cursor for a given sql command, displaying and
+#    printing errors where necessary.
+#
+sub getcursor {
+    my $dbh = shift;
+    my $cmd = shift;
+    my $cursor;
+    ( $cursor = $dbh->prepare( $cmd ))
+	or print "\nnot ok: $DBI::errstr\n";
+    ( $cursor->execute )
+	or print( "\tnot ok: $DBI::errstr\n" );
+    return $cursor;
+}
+
+#
+# mykeysort($a, $b)
+#    sorts $a and $b against the order in the mib or against the hard
+#    coded special list.
+#
+sub mykeysort {
+    my $a = $displaytable::a;
+    my $b = $displaytable::b;
+    my $mb = $SNMP::MIB{SNMP::translateObj($b)};
+    my $ma = $SNMP::MIB{SNMP::translateObj($a)};
+
+    return $NetSNMP::manager::myorder{$a} <=> $NetSNMP::manager::myorder{$b} if ((defined($NetSNMP::manager::myorder{$a}) || !defined($ma->{'subID'})) && (defined($NetSNMP::manager::myorder{$b}) || !defined($mb->{'subID'})));
+    return 1 if (defined($NetSNMP::manager::myorder{$b}) || !defined($mb->{'subID'}));
+    return -1 if (defined($NetSNMP::manager::myorder{$a}) || !defined($ma->{'subID'}));
+
+    $ma->{'subID'} <=> $mb->{'subID'};
+}
+
+#
+# checkhost(GROUP, HOST):
+#    if anything in a host is an error, as defined by the
+#    errorexpressions table, return 1, else 0
+#
+sub checkhost {
+    my $dbh = shift;
+    my $group = shift;
+    my $host = shift;
+    my ($tblh);
+
+    return 2 if ($dbh->do("select * from hosterrors where host = '$host'") ne "0E0");
+
+    # get a list of tables we want to display
+    $tblh = getcursor($dbh, "SELECT * FROM hosttables where (host = '$host' and groupname = '$group')");
+
+    # table data
+    my($exprs, $tablelist);
+    while ( $tablelist = $tblh->fetchrow_hashref ) {
+	$exprs = getcursor($dbh, "SELECT * FROM errorexpressions where (tablename = '$tablelist->{tablename}')");
+	while(my $expr = $exprs->fetchrow_hashref) {
+	    if ($dbh->do("select * from $tablelist->{tablename} where $expr->{expression} and host = '$host'") ne "0E0") {
+		return 1;
+	    }
+	}
+    }
+    return 0;
+}
+
+#
+#  showhost(HOST):
+#
+#    display all the tables monitored for a given host (in a group).
+#
+sub showhost {
+    my $dbh = shift;
+    my $host = shift;
+    my $group = shift;
+    my $remuser = shift;
+    my $q = self_url();
+    $q =~ s/\?.*//;
+    # host header
+    print "<title>Net-SNMP manager report for host: $host</title>\n";
+    print "<h2>Monitored information for the host $host</h2>\n";
+    if (!isexpert($remuser)) {
+	print "<ul>\n";
+	print "<li>Click on a column name for information about the data in that column.\n";
+	print "<li>Click on a column name or table name for information about the data in the table.\n";
+	print "<li>If you are <a href=\"" . addtoken($q, "setuphost=1&host=$host&group=$group") . "\">collecting past history</a> for a data set, links will appear below the table that allow you to view and/or graph the historic data.\n";
+	print "</ul>\n";
+    }
+
+    # does the host have a serious error?
+
+    my $errlist = getcursor($dbh, "SELECT * FROM hosterrors where (host = '$host')");
+    if ( $dbh->do("SELECT * FROM hosterrors where (host = '$host')") ne "0E0") {
+	displaytable($dbh, 'hosterrors', 
+		     '-clauses', "where (host = '$host')",
+		     '-dontdisplaycol', "select * from userprefs where user = '$remuser' and groupname = '$group' and tablename = ? and columnname = ? and displayit = 'N'",
+		     '-beginhook', sub {
+			 if ($#_ < 2) {
+			     #doing header;
+			     print "<td></td>";
+			 } else {
+			     print "<td><img src=\"$NetSNMP::manager::redimage\"></td>\n";
+			 }});
+    }
+
+    # get a list of tables we want to display
+    my $tblh = getcursor($dbh, "SELECT * FROM hosttables where (host = '$host' and groupname = '$group')");
+
+    # table data
+    my($tablelist);
+    while (  $tablelist = $tblh->fetchrow_hashref ) {
+
+	displaytable($dbh, $tablelist->{'tablename'},
+		     '-clauses', "where (host = '$host') order by oidindex",
+		     '-dontdisplaycol', "select * from userprefs where user = '$remuser' and groupname = '$group' and tablename = ? and columnname = ? and displayit = 'N'",
+		     '-sort', \&mykeysort,
+		     '-dolink', \&linktodisplayinfo,
+		     '-beginhook', \&printredgreen);
+	if ($tablelist->{'keephistory'}) {
+	    my $q = self_url();
+	    $q =~ s/\?.*//;
+	    print "history: ";
+	    print "<a href=\"" . addtoken($q, "displayhistory=1&host=$host&group=$group&table=$tablelist->{'tablename'}hist") . "\">[table]</a>\n";
+	    print "<a href=\"" . addtoken($q, "displaygraph=1&host=$host&group=$group&table=$tablelist->{'tablename'}hist") . "\">[graph]</a>\n";
+	    print "<br>\n";
+	}
+    }
+}
+
+#
+#  linktodisplayinfo(STRING):
+#
+#    returns a url to the appropriate displayinfo link if STRING is a
+#    mib node.
+#
+sub linktodisplayinfo {
+    return if (exists($NetSNMP::manager::myorder{shift}));
+    return self_url() . "&displayinfo=" . shift;
+}
+
+# printredgreen(TABLENAME, DATA):
+#
+#   display a red or a green dot in a table dependent on the table's
+#   values and associated expression
+#
+#   DATA is NULL when in a header row (displaying header names).
+#
+sub printredgreen {
+    my $dbh = shift;
+    my $tablename = shift;
+    my $data = shift;
+    my ($exprs, $expr, $img);
+
+    if (!defined($data)) {
+	#doing header;
+	print "<td></td>";
+	return;
+    }
+
+    my $cmd = "SELECT * FROM errorexpressions where (tablename = '$tablename')";
+    print " $cmd\n" if ($NetSNMP::manager::verbose);
+    ( $exprs = $dbh->prepare( $cmd ) )
+	or die "\nnot ok: $DBI::errstr\n";
+    ( $exprs->execute )
+	or print( "\tnot ok: $DBI::errstr\n" );
+
+    $img = $NetSNMP::manager::greenimage;
+    while($expr = $exprs->fetchrow_hashref) {
+	if ($dbh->do("select oidindex from $tablename where host = '$data->{host}' and oidindex = '$data->{oidindex}' and $expr->{expression}") ne "0E0") {
+	    $img = $NetSNMP::manager::redimage;
+	}
+    }
+    print "<td><img src=$img></td>";
+}
+
+#
+# display information about a given mib node as a table.
+#
+sub makemibtable {
+    my $dispinfo = shift;
+    # display information about a data type in a table
+    my $mib = $SNMP::MIB{SNMP::translateObj($dispinfo)};
+    print "<table $NetSNMP::manager::tableparms><tr><td>\n";
+    foreach my $i (qw(label type access status units hint moduleID description enums)) {
+#    foreach my $i (keys(%$mib)) {
+	next if (!defined($$mib{$i}) || $$mib{$i} eq "");
+	next if (ref($$mib{$i}) eq "HASH" && $#{keys(%{$$mib{$i}})} == -1);
+	print "<tr><td>$i</td><td>";
+	if (ref($$mib{$i}) eq "HASH") {
+	    print "<table $NetSNMP::manager::tableparms><tr><td>\n";
+	    foreach my $j (sort { $$mib{$i}{$a} <=> $$mib{$i}{$b} } keys(%{$$mib{$i}})) {
+ 		print "<tr><td>$$mib{$i}{$j}</td><td>$j</td></tr>";
+	    }
+	    print "</table>\n";
+	} else {
+	    print "$$mib{$i}";
+	}
+	print "</td></tr>\n";
+    }
+    print "</table>\n";
+}
+
+# given a user, get all the groups he belongs to.
+sub getgroupsforuser {
+    my (@ret, $cursor, $row);
+    my ($dbh, $remuser) = @_;
+    ( $cursor = $dbh->prepare( "SELECT * FROM usergroups where (user = '$remuser')"))
+	or die "\nnot ok: $DBI::errstr\n";
+    ( $cursor->execute )
+	or print( "\tnot ok: $DBI::errstr\n" );
+
+    while (  $row = $cursor->fetchrow_hashref ) {
+	push(@ret, $row->{'groupname'});
+    }
+    @ret;
+}
+
+# given a host, get all the groups it belongs to.
+sub gethostsforgroup {
+    my (@ret, $cursor, $row);
+    my ($dbh, $group) = @_;
+    ( $cursor = $dbh->prepare( "SELECT * FROM hostgroups where (groupname = '$group')"))
+	or die "\nnot ok: $DBI::errstr\n";
+    ( $cursor->execute )
+	or print( "\tnot ok: $DBI::errstr\n" );
+
+    while (  $row = $cursor->fetchrow_hashref ) {
+	push(@ret, $row->{'host'});
+    }
+    @ret;
+}
+
+# display the host add entry box
+sub addhostentryform {
+    my $group = shift;
+    print "<form method=\"get\" action=\"" . self_url() . "\">\n";
+    print "Add a new host to the group \"$group\": <input type=\"text\" name=\"newhost\"><br>";
+    print "<input type=\"hidden\" name=\"group\" value=\"$group\">";
+    print "<input type=submit value=\"Add Hosts\">\n";
+    print "</form>";
+}
+
+#is an expert user?
+sub isexpert {
+    return 0;
+}
+
+#is remuser a admin?
+sub isadmin {
+    my ($dbh, $remuser, $group) = @_;
+    return 0 if (!defined($remuser) || !defined($group));
+    return 1 if ($dbh->do("select * from usergroups where user = '$remuser' and groupname = '$group' and isadmin = 'Y'") ne "0E0");
+    return 0;
+}
+
+#is user a member of this group?
+sub isuser {
+    my ($dbh, $remuser, $group) = @_;
+    return 0 if (!defined($remuser) || !defined($group));
+    return 1 if ($dbh->do("select * from usergroups where user = '$remuser' and groupname = '$group'") ne "0E0");
+    return 0;
+}
+
+# displayconfigarray(HOSTS, NAMES, CONFIG):
+#
+#   displays an array of generic check buttons to turn on/off certain
+#   variables.
+sub displayconfigarray {
+    my $dbh = shift;
+    my $hosts = shift;
+    my $names = shift;
+    my %config = @_;
+
+    my $cmd;
+    if ($config{'-check'}) {
+	( $cmd = $dbh->prepare( $config{'-check'} ) )
+	    or die "\nnot ok: $DBI::errstr\n";
+    }
+
+    print "<table $NetSNMP::manager::tableparms>\n";
+    print "<tr><td></td>";
+    my ($i, $j);
+    foreach $j (@$names) {
+	my $nj = $j;
+	$nj = $j->[0] if ($config{'-arrayrefs'} || $config{'-arrayref2'});
+	print "<td>$nj</td>";
+    }
+    foreach my $i (@$hosts) {
+	my $ni = $i;
+	$ni = $i->[0] if ($config{'-arrayrefs'} || $config{'-arrayref1'});
+	print "<tr><td>$ni</td>";
+	foreach $j (@$names) {
+	    my $nj = $j;
+	    $nj = $j->[0] if ($config{'-arrayrefs'} || $config{'-arrayref2'});
+	    my $checked = "checked" if (defined($cmd) && $cmd->execute($ni,$nj) ne "0E0");
+	    print "<td><input type=checkbox $checked value=y name=" . $config{prefix} . $ni . $nj . "></td>\n";
+	}
+	print "</tr>\n";
+    }	
+    print "</tr>";
+    print "</table>";
+}
+
+sub adddefaulttables {
+    my ($dbh, $names) = @_;
+    my $row;
+    # add in known expression tables.
+    my $handle = getcursor($dbh, "SELECT * FROM errorexpressions");
+
+    expr: 
+    while($row = $handle->fetchrow_hashref) {
+	foreach $i (@$names) {
+	    if ($i->[0] eq $row->{tablename}) {
+		next expr;
+	    }
+	}
+	push @$names, [$row->{tablename}];
+    }
+}
+
+#
+# display the setup information page for a given group.
+#
+sub setupgroup {
+    my $dbh = shift;
+    my $group = shift;
+    
+    my ($hosts, $names) = gethostandgroups($dbh, $group);
+    adddefaulttables($dbh, $names);
+
+    print "<form method=\"post\" action=\"" . self_url() . "\">\n";
+    print "<input type=hidden text=\"setupgroupsubmit\" value=\"y\">";
+    displayconfigarray($dbh, $hosts, $names, 
+		       -arrayrefs, 1,
+		       -check, "select * from hosttables where (host = ? and tablename = ? and groupname = '$group')");
+    print "<input type=hidden name=group value=\"$group\">\n";
+    print "<input type=submit value=submit name=\"setupgroupsubmit\">\n";
+    print "</form>";
+}
+
+# a wrapper around fetching arrays of everything in a table.
+sub getarrays {
+    my $dbh = shift;
+    my $table = shift;
+    my %config = @_;
+    my $selectwhat = $config{'-select'} || "*";
+    my $handle;
+    
+    $handle = getcursor($dbh, "SELECT $selectwhat FROM $table $config{-clauses}");
+    return $handle->fetchall_arrayref;
+}
+
+#
+# get a list of all tablenames and hostnames for a given group.
+#
+sub gethostandgroups {
+    my $dbh = shift;
+    my $group = shift;
+    my ($tbnms);
+
+    my $names = getarrays($dbh, 'hosttables', 
+			  "-select", 'distinct tablename',
+			  "-clauses", "where groupname = '$group'");
+
+    my $hosts = getarrays($dbh, 'hostgroups', 
+			  "-select", 'distinct host',
+			  "-clauses", "where groupname = '$group'");
+    
+    return ($hosts, $names);
+}
+
+sub setupgroupsubmit {
+    my $dbh = shift;
+    my $group = shift;
+    
+    my ($hosts, $names) = gethostandgroups($dbh, $group);
+    adddefaulttables($dbh, $names);
+
+    foreach my $i (@$hosts) {
+	$dbh->do("delete from hosttables where host = '${$i}[0]' and groupname = '$group'");
+    }
+    my $rep = $dbh->prepare("insert into hosttables(host,tablename,groupname) values(?,?,'$group')");
+
+    foreach my $i (@$hosts) {
+	foreach my $j (@$names) {
+	    if (param("${$i}[0]" . "${$j}[0]")) {
+		print "test: ","${$i}[0] : ${$j}[0]<br>\n";
+		$rep->execute("${$i}[0]", "${$j}[0]") || print "$! $DBI::errstr<br>\n";
+            }
+	}
+    }
+    
+}
+
+#
+# save user pref data submitted by the user
+#
+sub setupusersubmit {
+    my ($dbh, $remuser, $group) = @_;
+    my $tables = getarrays($dbh, 'hosttables', 
+			   "-select", 'distinct tablename',
+			   "-clauses", "where groupname = '$group'");
+    
+    $dbh->do("delete from userprefs where user = '$remuser' and groupname = '$group'");
+    my $rep = $dbh->prepare("insert into userprefs(user, groupname, tablename, columnname, displayit) values('$remuser', '$group', ?, ?, 'N')");
+
+    my ($i, $j);
+    foreach my $i (@$tables) {
+	my $sth = $dbh->prepare("select * from ${$i}[0] where 1 = 0");
+	$sth->execute();
+
+	foreach $j (@{$sth->{NAME}}) {
+	    if (param("${$i}[0]" . "$j")) {
+		$rep->execute("${$i}[0]", "$j");
+	    }
+	}
+    }
+}
+
+sub Exit {
+    my ($dbh, $group) = @_;
+    my $tq = self_url();
+    $tq =~ s/\?.*//;
+    print "<hr>\n";
+    print "<a href=\"$tq\">[TOP]</a>\n";
+    print "<a href=\"$tq?userprefs=1&group=$group\">[display options]</a>\n";
+    print "<a href=\"$tq?setuponcall=1\">[setup oncall schedule]</a>\n";
+    if (defined($group)) {
+	print "<a href=\"$tq?group=$group\">[group: $group]</a>\n";
+	print "<a href=\"$tq?group=$group&summarizegroup=1\">[summarize errors]</a>\n";
+    }
+    $dbh->disconnect() if (defined($dbh));
+    return OK();
+#    exit shift;
+}
+
+#
+# setup user preferences by displaying a configuration array of
+# checkbuttons for each table.
+#
+sub setupuserpreferences {
+    my ($dbh, $remuser, $group) = @_;
+    my $tables = getarrays($dbh, 'hosttables', 
+			   "-select", 'distinct tablename',
+			   "-clauses", "where groupname = '$group'");
+
+    print "<h3>Select the columns from the tables that you want to <b>hide</b> below and click on submit:</h3>\n";
+    print "<form method=\"post\" action=\"" . self_url() . "\">\n";
+
+    my ($i, $j);
+    foreach my $i (@$tables) {
+	my $sth = $dbh->prepare("select * from ${$i}[0] where 1 = 0");
+	$sth->execute();
+	displayconfigarray($dbh, [${$i}[0]], $sth->{NAME},
+			   -check, "select * from userprefs where (tablename = ? and columnname = ? and user = '$remuser' and groupname = '$group' and displayit = 'N')");
+    print "<br>\n";
+    }
+    print "<input type=hidden name=group value=\"$group\">\n";
+    print "<input type=submit value=submit name=\"setupuserprefssubmit\">\n";
+    print "</form>";
+}
diff -Naur tomato/release/src/router/snmp/perl/manager/setupauth tomato121/release/src/router/snmp/perl/manager/setupauth
--- tomato/release/src/router/snmp/perl/manager/setupauth	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/perl/manager/setupauth	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,59 @@
+#!/usr/bin/perl
+
+use DBI;
+$hostname = 'localhost';          # Host that serves the mSQL Database
+$dbname = 'snmp';                 # mySQL Database name
+$doit = 1;
+
+sub usage {
+    print "$0 [-H host] [-u user] [-p password] [-v] [-h] [-n] [-g groupname] [-m machinename] TOKEN VALUE\n";
+    exit 0;
+}
+
+while ($#ARGV > -1 && $ARGV[0] =~ /^-/) {
+    $_ = shift @ARGV;
+    usage if (/-h/);
+    $hostname = shift if (/-H/);
+    $user = shift if (/-u/);
+    $pass = shift if (/-p/);
+    $group = shift if (/-g/);
+    $machine = shift if (/-m/);
+    $verbose = 1 if (/-v/);
+    $doit = 0 if (/-n/);
+}
+
+( $dbh = DBI->connect("DBI:mysql:database=$dbname;host=$hostname", $user, $pass))
+    or die "\tConnect not ok: $DBI::errstr\n";
+
+if (defined($machine)) {
+    $table = "authhost";
+    $group = $machine;
+} else {
+    $table = "authgroup";
+    $group = "default" if (!defined($group));
+}
+
+$token = shift;
+$value = shift;
+while(defined($value)) {
+    if (DO("select * from $table where lookup = '$group' and varcol = '$token'") eq "0E0") {
+	DO("insert into $table(lookup, varcol, valcol) values('$group', '$token', '$value')");
+    } else {
+	DO("update $table set valcol = '$value' where lookup = '$group' and varcol = '$token'");
+    }
+    $token = shift;
+    $value = shift;
+}
+
+$dbh->disconnect();
+
+sub DO {
+    my $cmd = shift;
+    print $cmd,"\n" if ($verbose);
+    my $ret = $dbh->do($cmd) if ($doit);
+    print "  returned: $ret\n" if ($verbose);
+    if ($DBI::errstr) {
+	print "db error ($ret): $DBI::errstr\n";
+    }
+    return $ret;
+}
diff -Naur tomato/release/src/router/snmp/perl/manager/setupdb tomato121/release/src/router/snmp/perl/manager/setupdb
--- tomato/release/src/router/snmp/perl/manager/setupdb	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/perl/manager/setupdb	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,149 @@
+#!/usr/bin/perl
+
+use DBI;
+$hostname = 'localhost';          # Host that serves the mSQL Database
+$dbname = 'snmp';                 # mySQL Database name
+$doit = 1;
+
+sub usage {
+    print "$0 [-H sqlhost] [-u user] [-p password] [-d] [-n]\n";
+    exit 0;
+}
+
+while ($#ARGV > -1 && $ARGV[0] =~ /^-/) {
+    $_ = shift @ARGV;
+    usage if (/-h/);
+    $hostname = shift if (/-H/);
+    $user = shift if (/-u/);
+    $pass = shift if (/-p/);
+    $delete = 1 if (/-d/);
+    $verbose = 1 if (/-v/);
+    $doit = 0 if (/-n/);
+}
+
+( $dbh = DBI->connect("DBI:mysql:database=$dbname;host=$hostname", $user, $pass))
+    or die "\tConnect not ok: $DBI::errstr\n";
+
+# run a whole ton of setup stuff
+
+if ($delete) {
+    DO("drop database if exists $dbname");
+}
+
+# here we go
+
+DO("create database $dbname");
+DO("use $dbname");
+
+# tables dumped with
+#
+# mysqldump -d ... snmp TABLE | perl -n -e 'while(<>) { last if (/CREATE/);} print "DO(\"$_"; while (<>) { last if (/\);/); print; } print ")\");\n";'
+
+DO("CREATE TABLE hosterrors (
+  id int(11) DEFAULT '0' NOT NULL auto_increment,
+  host varchar(64),
+  errormsg varchar(128),
+  PRIMARY KEY (id)
+)");
+
+DO("CREATE TABLE hosttables (
+  id int(11) DEFAULT '0' NOT NULL auto_increment,
+  host varchar(64),
+  tablename varchar(64),
+  groupname varchar(32),
+  keephistory int(2),
+  PRIMARY KEY (id)
+)");
+
+DO("CREATE TABLE usergroups (
+  id int(11) DEFAULT '0' NOT NULL auto_increment,
+  user varchar(16),
+  groupname varchar(32),
+  isadmin enum('N','Y') DEFAULT 'N',
+  PRIMARY KEY (id)
+)");
+
+DO("CREATE TABLE userprefs (
+  id int(11) DEFAULT '0' NOT NULL auto_increment,
+  user varchar(16),
+  groupname varchar(32),
+  tablename varchar(64),
+  columnname varchar(64),
+  displayit enum('N','Y') DEFAULT 'Y',
+  PRIMARY KEY (id)
+)");
+
+DO("CREATE TABLE hostgroups (
+  id int(11) DEFAULT '0' NOT NULL auto_increment,
+  host varchar(64),
+  groupname varchar(32),
+  sysObjectId varchar(255),
+  sysDescr varchar(255),
+  versionTag varchar(32),
+  sysUpTime varchar(64),
+  PRIMARY KEY (id)
+)");
+
+DO("CREATE TABLE oncall (
+  id int(11) DEFAULT '0' NOT NULL auto_increment,
+  user varchar(16),
+  groupname varchar(32),
+  email varchar(64),
+  days varchar(64),
+  hours varchar(64),
+  PRIMARY KEY (id)
+)");
+
+DO("CREATE TABLE errorexpressions (
+  id int(11) DEFAULT '0' NOT NULL auto_increment,
+  tablename varchar(64),
+  expression varchar(255),
+  returnfield varchar(64),
+  PRIMARY KEY (id)
+)");
+
+DO("CREATE TABLE setup (
+  lookup varchar(64),
+  varcol varchar(128),
+  valcol varchar(128)
+)");
+
+DO("CREATE TABLE authgroup (
+  id int(11) DEFAULT '0' NOT NULL auto_increment,
+  lookup varchar(64),
+  varcol varchar(128),
+  valcol varchar(128),
+  PRIMARY KEY (id)
+)");
+
+DO("CREATE TABLE authhost (
+  id int(11) DEFAULT '0' NOT NULL auto_increment,
+  lookup varchar(64),
+  varcol varchar(128),
+  valcol varchar(128),
+  PRIMARY KEY (id)
+)");
+
+# insert the standard ucd-snmp expressions 
+DO("insert into errorexpressions(tablename, expression, returnfield)
+                values('prTable', 'prErrorFlag > 0', 'prErrMessage')");
+DO("insert into errorexpressions(tablename, expression, returnfield)
+                values('extTable', 'extResult > 0', 'extOutput')");
+DO("insert into errorexpressions(tablename, expression, returnfield)
+                values('dskTable', 'dskErrorFlag > 0', 'dskErrMessage')");
+DO("insert into errorexpressions(tablename, expression, returnfield)
+                values('laTable', 'laErrorFlag > 0', 'laErrMessage')");
+DO("insert into errorexpressions(tablename, expression, returnfield)
+                values('fileTable', 'fileErrorFlag > 0', 'fileErrMessage')");
+DO("insert into errorexpressions(tablename, expression, returnfield)
+                values('snmperrs', 'snmperrErrorFlag > 0', 'snmperrErrMessage')");
+DO("insert into errorexpressions(tablename, expression, returnfield)
+                values('memory', 'memSwapError > 0', 'memSwapErrMessage')");
+
+$dbh->disconnect();
+
+sub DO {
+    my $cmd = shift;
+    print $cmd,"\n" if ($verbose);
+    $dbh->do($cmd) if ($doit);
+}
diff -Naur tomato/release/src/router/snmp/perl/manager/setupuser tomato121/release/src/router/snmp/perl/manager/setupuser
--- tomato/release/src/router/snmp/perl/manager/setupuser	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/perl/manager/setupuser	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,45 @@
+#!/usr/bin/perl
+
+use DBI;
+$hostname = 'localhost';          # Host that serves the mSQL Database
+$dbname = 'snmp';                 # mySQL Database name
+$doit = 1;
+
+sub usage {
+    print "$0 [-H host] [-u user] [-p password] [-v] [-h] [-n] [-d] [-a] GROUP USER EMAILADDRESS\n";
+    exit 0;
+}
+
+while ($#ARGV > -1 && $ARGV[0] =~ /^-/) {
+    $_ = shift @ARGV;
+    usage if (/-h/);
+    $hostname = shift if (/-H/);
+    $sqluser = shift if (/-u/);
+    $pass = shift if (/-p/);
+    $admin = 1 if (/-a/);
+    $verbose = 1 if (/-v/);
+    $delete = 1 if (/-d/);
+    $doit = 0 if (/-n/);
+}
+
+($group, $user, $email) = @ARGV;
+
+die "group $group is a reserved group name, you can't use it.  Sorry." if ($group eq "default");
+
+die "no group specified" if (!defined($group));
+
+( $dbh = DBI->connect("DBI:mysql:database=$dbname;host=$hostname", $sqluser, $pass))
+    or die "\tConnect not ok: $DBI::errstr\n";
+
+DO("insert into usergroups(user, groupname, isadmin) values('$user', '$group', " . (($admin) ? "'Y'" : "'N'") . ")");
+if (defined($email)) {
+    DO("insert into oncall(user, groupname, email, days, hours) values('$user', '$group', '$email', '*', '*')");
+}
+
+$dbh->disconnect();
+
+sub DO {
+    my $cmd = shift;
+    print $cmd,"\n" if ($verbose);
+    $dbh->do($cmd) if ($doit);
+}
diff -Naur tomato/release/src/router/snmp/perl/manager/snmptosql tomato121/release/src/router/snmp/perl/manager/snmptosql
--- tomato/release/src/router/snmp/perl/manager/snmptosql	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/perl/manager/snmptosql	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,523 @@
+#!/usr/bin/perl
+
+use NetSNMP::manager::getValues qw(getValues);
+use SNMP;
+use DBI;
+use Net::SMTP;
+
+#===========================================================================
+#  Global defines
+#===========================================================================
+
+$hostname = 'localhost';          # Host that serves the mSQL Database
+$dbname = 'snmp';                 # mySQL Database name
+$smtpserver = 'localhost';
+$smtpfrom   = 'Net-SNMP Manager <wjhardaker@ucdavis.edu>';	# <===  CHANGE ME  ========
+$doit = 1;
+$somehosts = 0;
+
+sub usage {
+    print "$0 [-H host] [-u user] [-p password] [-l hostlist,...] [-v] [-h] [-n] [-d] [-m mib-to-load] <-m mibnode>\n";
+    exit 0;
+}
+
+while ($#ARGV > -1) {
+    $_ = shift @ARGV;
+    usage if (/-h/);
+    $hostname = shift if (/-H/);
+    if (/-l/) {
+	my $arg = shift;
+	my @a = split(/,/,$arg);
+	my $i;
+	$somehosts = 1;
+	foreach $i (@a) {
+	    $dohost{$i} = 1;
+	}
+    }
+    $user = shift if (/-u/);
+    $pass = shift if (/-p/);
+    $verbose = 1 if (/-v/);
+    $delete = 1 if (/-d/);
+    $doit = 0 if (/-n/);
+    $tableexpr = shift if (/-t/);
+    if (/-m/) {
+	# load some mibs
+	# SNMP::loadModules(shift);
+	$ENV{'MIBS'} = shift;
+    }
+    if (/-M/) {
+	# add a mib directory to look in
+	$ENV{'MIBDIRS'} = shift;
+	# SNMP::addMibDirs(shift);
+    }
+}
+
+init_mib;
+
+#===========================================================================
+# Connect to the mSQL database with the appropriate driver
+( $dbh = DBI->connect("DBI:mysql:database=$dbname;host=$hostname", $user, $pass))
+    or die "\tConnect not ok: $DBI::errstr\n";
+
+#
+# delete history rows every so often.
+#
+my %count = getValues($dbh, 'setup', 'deletecount');
+
+if (!defined($count{'max'})) {
+    # default is to delete history rows once an hour.
+    $dbh->do("insert into setup values('deletecount','max','6')");
+    $count{'max'} = 6;
+}
+
+if (!defined($count{'current'})) {
+    $dbh->do("insert into setup values('deletecount','current','0')");
+} else {
+    $count{'current'}++;
+    if ($count{'max'} <= $count{'current'}) {
+	$count{'current'} = 0;
+	$deletehist = 1;
+    }
+    $dbh->do("update setup set valcol = $count{'current'} where lookup = 'deletecount' and varcol = 'current'");
+}
+
+#===========================================================================
+# Get host records from database and process
+
+$cursor = getcursor("SELECT distinct host FROM hosttables");
+nexthost: while (  $hostrow = $cursor->fetchrow_hashref ) {
+
+    my $host = $hostrow->{'host'};
+
+    next if ($somehosts && !defined($dohost{$host}));
+
+    #set up the session
+    print STDERR " starting $host\n" if ($verbose);
+    my $x = $dbh->prepare("select groupname from hostgroups where host = '$host'");
+    my $y = $x->execute();
+    my $group = ${$x->fetchrow_hashref}{'groupname'};
+    my @args = ('authgroup','default');
+    print STDERR "$host...$y\n" if ($verbose);
+    if (defined($y) && "$y" ne "0E0") {
+        push @args,'authgroup',$group;
+    }
+    push @args,'authhost',$host;
+    print STDERR "$host: $group\n" if ($verbose);
+
+    print STDERR "authvals: ", join(", ", @args), "\n" if ($verbose);
+    my %authvals = getValues($dbh, @args);
+    if ($verbose) {
+	print STDERR "parms for $host:";
+	foreach my $i (keys(%authvals)) {
+	    print STDERR "$i => $authvals{$i}, ";
+	}
+	print STDERR "\n";
+    }
+
+    my $sess = new SNMP::Session (  DestHost => $host, 
+				    UseSprintValue => 1,
+				    %authvals );
+    print STDERR "Sess ($host): $sess, ref=" . ref($sess). "\n" if ($verbose);
+    if (ref ($sess) ne "SNMP::Session") {
+#	print STDERR "ack: \$sess not a SNMP::Session for $host ($!)\n";
+	hosterror("$host");
+	next nexthost;
+    }
+
+    # get various bits of system information.
+    my $sysDescr = $sess->get('sysDescr.0');
+    my $sysId = SNMP::translateObj($sess->get('sysObjectID.0'));
+    my $versiontag = $sess->get('versionTag.0');
+    my $sysuptime = $sess->get('sysUpTime.0');
+
+    if ($sysDescr eq "" || $sysId eq "" || $versiontag eq "" || 
+	$sysuptime eq "") {
+	hosterror("$host","Problem collecting basic info");
+	next;
+    }
+
+    $dbh->do("update hostgroups set sysObjectId = '$sysId', sysDescr = '$sysDescr', versionTag = '$versiontag', sysUpTime = '$sysuptime' where host = '$host'");
+
+    # translate the sysUpTime to a real number for future use:
+    {
+	my ($d,$h,$m,$s,$fs) = ($sysuptime =~ /^(\d+):(\d+):(\d+):(\d+)\.(\d+)$/);
+	$sysuptime = $fs + $s*100 + $m*100*60 + $h*100*60*60 + $d*100*60*60*24;
+    }
+
+    # get a list of tables we want to store
+    $cmd = "SELECT * FROM hosttables where (host = '$host')";
+    print STDERR " $cmd\n" if ($verbose);
+    ( $tblh = $dbh->prepare( $cmd ) )
+	or warn "\nnot ok: $DBI::errstr\n";
+    ( $tblh->execute )
+	or print( "\tnot ok: $DBI::errstr\n" );
+
+    while (  $tablelist = $tblh->fetchrow_hashref ) {
+	next if (defined($tableexpr) && $tablelist->{'tablename'} !~ /$tableexpr/);
+	print STDERR "starting table $tablelist->{'tablename'}\n" if ($verbose);
+	my $mib = $SNMP::MIB{SNMP::translateObj($tablelist->{'tablename'})};
+	if (!$mib) {
+	    warn "mib node $tablelist->{'tablename'} doesn't exist";
+	    next;
+	}
+	my $children = get_children($mib);
+
+	# create the table in our database if it doesn't exist.
+	setuptable($dbh, $tablelist->{tablename}, $delete);
+	if ($tablelist->{'keephistory'} > 0) {
+	    setuptable($dbh, $tablelist->{tablename}, $delete, "hist");
+	}
+	
+	$var = 
+	    new SNMP::Varbind([SNMP::translateObj($tablelist->{'tablename'})]);
+	my $void = SNMP::translateObj($tablelist->{'tablename'});
+	my $val = $sess->getnext($var);
+	print STDERR "init err: $sess->{'ErrorStr'}\n" if ($verbose);
+	if ($sess->{'ErrorStr'} =~ /Timeout/) {
+	    print STDERR "$host timed out\n" if ($verbose);
+	    hosterror($host);
+	    next nexthost;
+	}
+	$initlabel = "";
+	print STDERR " starting $tablelist->{tablename}\n" if ($verbose);
+	my %tbl_ids;
+	while (1) {
+	    my $varlabel = $var->[$SNMP::Varbind::tag_f];
+	    print STDERR "last $host " . SNMP::translateObj($varlabel) . ": $void\n" if ($verbose && SNMP::translateObj($varlabel) !~ /^$void/);
+
+	    last if (SNMP::translateObj($varlabel) !~ /^$void/);
+	    $varlabel = SNMP::translateObj($var->[$SNMP::Varbind::tag_f]) if ($varlabel =~ /^[\.0-9]+$/);
+	    $initlabel = $varlabel if ($initlabel eq "");
+
+	    my $val = $sess->getnext($var);
+	    if ($sess->{'ErrorStr'} =~ /Timeout/) {
+		print STDERR "$host timed out\n" if ($verbose);
+		hosterror($host);
+		next nexthost;
+	    }
+	    last if ($sess->{'ErrorStr'});
+	    my $id = $var->[$SNMP::Varbind::iid_f];
+	    print STDERR "$initlabel = $varlabel\n" if ($verbose);
+	    last if ($varlabel ne $initlabel);
+	    my %vals;
+	    $tbl_ids{$id} = 1;
+	    foreach $c (@$children) {
+		my $oid = $$c{'objectID'} . "." . $id;
+		my $newvar = new SNMP::Varbind([$oid]);
+		my $val = $sess->get($newvar);
+		my $label = SNMP::translateObj($$c{'objectID'});
+		$vals{$label} = $val;
+	    }
+	    my $cmd;
+
+	    # check to see if the error previously existed and then
+	    # delete the old entry.
+	    my $olderr =
+		checkrowforerrors($tablelist->{'tablename'}, $host, $id);
+	    $dbh->do("delete from $tablelist->{tablename} where ( host = '$host'  and oidindex = '$id')");
+	    $res = $dbh->do("select * from $tablelist->{'tablename'} where ( host = '$host' and oidindex = '$id')");
+	    print STDERR "  result: $res\n" if ($verbose);
+	    if ($res ne "0E0") {
+		$cmd = "update $tablelist->{'tablename'} set ";
+		foreach $h (keys(%vals)) {
+		    $cmd .= "$h = '$vals{$h}', ";
+		}
+		$cmd .= " updated = NULL where (host = '$host' and oidindex = '$id')";
+		
+	    } else {
+		$cmd = "insert into $tablelist->{'tablename'}(host, oidindex, " . join(", ",keys(%vals)) .
+		    ") values('$host', '$id', '" .
+			join("', '",values(%vals)). "')";
+	    }
+
+	    print STDERR "  $cmd\n" if ($verbose);
+	    $dbh->do("$cmd")
+		or warn "\nnot ok: $cmd => $DBI::errstr\n" if ($doit);
+
+	    if ($tablelist->{'keephistory'} > 0) {
+		$cmd = "insert into $tablelist->{'tablename'}hist (host, oidindex, sysUpTime, " 
+		    . join(", ",keys(%vals))
+		    . ") values('$host', '$id', $sysuptime, '"
+		    . join("', '",values(%vals)). "')";
+		print STDERR "  $cmd\n" if ($verbose);
+		$dbh->do("$cmd")
+		    or warn "\nnot ok: $cmd -> $DBI::errstr\n" if ($doit);
+		
+	    }
+
+	    my $newerr = 
+		checkrowforerrors($tablelist->{'tablename'}, $host, $id);
+	    if ($newerr->{retval} != $olderr->{retval}) {
+		 logerror($host, $newerr->{retval}, $newerr->{errfield}, 
+			  $newerr->{errvalue});
+	     }
+	} # snmp loop
+
+	# delete the data beyond the number of days requested.
+	if ($deletehist && $tablelist->{'keephistory'} > 0) {
+	    $dbh->do("delete from $tablelist->{'tablename'}hist where (unix_timestamp() - unix_timestamp(updated)) > $tablelist->{'keephistory'}*24*60*60 and host = '$host'") or warn "\nnot ok: $DBI::errstr\n" if ($doit);
+	}
+
+	my $curs = getcursor("select oidindex from $tablelist->{tablename} where host = '$host'");
+	my $row;
+	while ($row = $curs->fetchrow_hashref) {
+	    print STDERR "  $row->{oidindex}\n" if ($verbose);
+	    if (!defined($tbl_ids{$row->{oidindex}})) {
+		$dbh->do("delete from $tablelist->{tablename} where oidindex = '$row->{oidindex}'");
+		print STDERR "deleting: $host $tablelist->{tablename} $row->{oidindex}\n" if ($verbose);
+	    }
+	}
+	print STDERR "  done with $tablelist->{tablename}\n" if ($verbose);
+    } # table loop
+
+    if (isbadhost($host)) {
+	# let them out, they're no longer being bad.
+	print STDERR "deleting: delete from hosterrors where host = '$host'\n" if ($verbose);
+	$dbh->do("delete from hosterrors where host = '$host'");
+	mailusers("$host responding again", "$host responding again",
+		  getoncallforhost($host));
+    }
+    print STDERR "  done with $host\n" if ($verbose);
+} # host loop
+
+# disconnect
+$cursor->finish();
+$dbh->disconnect();
+
+#
+# Subroutines
+#
+
+# setup a table in the database based on a MIB table.
+sub setuptable {
+
+    my %conversions = qw(INTEGER integer INTEGER32 integer OCTETSTR varchar(254) COUNTER integer UINTEGER integer IPADDR varchar(254) OBJECTID varchar(254) GAGUE integer OPAQUE varchar(254) TICKS integer GAUGE integer);
+
+    # set up mib info
+    my ($dbh, $mibnode, $delete, $suffix) = @_;
+
+    my $mib = $SNMP::MIB{SNMP::translateObj($mibnode)};
+    my $children = get_children($mib);
+    my ($cmd, $j);
+
+    if ($delete) {
+	$cmd = "drop table if exists $mib->{label}";
+	print STDERR "cmd: $cmd\n" if ($verbose);
+	$dbh->do($cmd)
+	    or warn "\nnot ok: $cmd -> $DBI::errstr\n" if ($doit);
+    } elsif (($ret = $dbh->do("show tables like '$mib->{label}$suffix'")) ne "0E0") {
+	# the table already exists
+	return;
+    }
+
+    print STDERR "show tables like $mib->{label}$suffix: $ret\n" if($verbose);
+    print STDERR " creating table for $mibnode ($mib->{label}$suffix)\n" if ($verbose);
+    
+    $cmd = "create table $mib->{label}$suffix (id integer auto_increment primary key, host varchar(32) not null, oidindex varchar(32) not null";
+    foreach $j (sort { $a->{'subID'} <=> $b->{'subID'} } @$children) {
+	if (!defined($conversions{$j->{type}})) {
+	    print STDERR "no conversion for $j->{label} = ". $j->{type} . "!\n";
+	    return;
+	}
+	$cmd .= ", $j->{label} $conversions{$j->{type}}";
+    }
+    $cmd .= ", updated timestamp";
+    $cmd .= ", sysUpTime integer" if (defined($suffix));
+    $cmd .= ",key oidindex (oidindex), key host (host))";
+
+    print STDERR "cmd: $cmd\n" if ($verbose);
+    $dbh->do("$cmd")
+	or warn "\nnot ok: $cmd -> $DBI::errstr\n" if ($doit);
+
+}
+
+sub getoncall {
+    my @groups = @_;
+    my $cur;
+    my $row;
+    my ($emails, @days, @hours, @two, $i);
+    my %dayscon = qw(Sun 0 Mon 1 Tue 2 Wed 3 Thu 4 Fri 5 Sat 6);
+    my @now = localtime(time());
+    my %people;
+    my $group;
+
+    foreach $group (@groups) {
+	$cur = getcursor("select * from oncall where groupname = '$group'");
+      row: while (  $row = $cur->fetchrow_hashref ) {
+	  @days = split(/,/,$row->{'days'});
+	  foreach $i (@days) {
+	      @two = split(/-/,$i);
+	      if ($row->{'days'} eq "*" ||
+		  (defined($dayscon{$i}) && $dayscon{$i} == $now[6]) ||
+		  (defined($dayscon{$two[0]}) && defined($dayscon{$two[1]}) &&
+		   (($dayscon{$two[0]} <= $now[6] && 
+		     $dayscon{$two[1]} >= $now[6]) ||
+		    (($dayscon{$two[0]} > $dayscon{$two[1]}) &&
+		     ($dayscon{$two[0]} <= $now[6] || 
+		      $dayscon{$two[1]} >= $now[6]))))) {
+		  # we hit a valid day range
+		  print STDERR "    hit it $row->{'email'} $now[6]\t($i)\t$row->{'days'}\n"
+		      if ($verbose);
+		  $people{$row->{'email'}} = $row->{'email'};
+	      } else {
+		  print STDERR "not hit it $row->{'email'} $now[6]\t($i)\t$row->{'days'}\n"
+		      if ($verbose);
+	      }	      
+	  }
+      }
+    }
+    return keys(%people);
+}
+
+sub getoncallforhost {
+    my $host = shift;
+    return getoncall(getgroupsforhost($host));
+}
+
+sub getcursor {
+    my $cmd = shift;
+    my $cursor;
+    print STDERR "cmd: $cmd\n" if ($verbose);
+    ( $cursor = $dbh->prepare( $cmd ))
+	or die "\nnot ok: $DBI::errstr\n";
+    ( $cursor->execute )
+	or print( "\tnot ok: $DBI::errstr\n" );
+    return $cursor;
+}
+
+my %expressions;
+sub getexpr {
+    my $table = shift;
+    print "ref: ",ref($expressions{$table}),"\n" if ($verbose);
+    if (!defined($expressions{$table})) {
+	my $exprs = getcursor("SELECT * FROM errorexpressions where (tablename = '$table')");
+	while (  $expr = $exprs->fetchrow_hashref ) {
+	    push @{$expressions{$table}{'expr'}},$expr->{expression};
+	    push @{$expressions{$table}{'returnfield'}},$expr->{returnfield};
+	}
+    }
+    if (ref($expressions{$table}) ne "HASH") {
+	# no expressions for this table.
+	$expressions{$table}{'expr'} = [];
+	$expressions{$table}{'returnfield'} = [];
+    }
+    return $expressions{$table};
+}
+
+sub checkrowforerrors {
+    my ($table, $host, $id) = @_;
+    my $error;
+
+    my $lastres = 0, $lastfield = '';
+    my $expressions = getexpr($table);
+    my $i;
+    for($i=0; $i <= $#{$expressions->{'expr'}}; $i++) {
+	if (!defined($expressions->{'prepared'}[$i])) {
+	    $expressions->{'prepared'}[$i] = $dbh->prepare("select * from $table where $expressions->{'expr'}[$i] and host = ? and oidindex = ?")
+		or warn "\nnot ok: $DBI::errstr\n";
+	    print STDERR "preparing select * from $table where $expressions->{'expr'}[$i] and host = ? and oidindex = ? ==> ",ref($expressions->{'prepared'}[$i]),"\n" if($verbose);
+	}
+	my $prepared = $expressions->{'prepared'}[$i];
+	print STDERR "x: ",ref($prepared),"\n" if($verbose);
+	$prepared->execute($host, $id) or warn "\nnot ok: $DBI::errstr\n";
+	while (  $error = $prepared->fetchrow_hashref ) {
+	    print STDERR "$host: $expressions->{returnfield}[$i] = $error->{$expressions->{returnfield}[$i]}\n" if ($verbose);
+	    return {'retval', 1,
+		    'errfield', $expressions->{returnfield}[$i],
+		    'errvalue', $error->{$expressions->{returnfield}[$i]}};
+	}
+	$lastres = $error->{$expressions->{returnfield}[$i]};
+	$lastfield = $expressions->{returnfield}[$i];
+    }
+    return {'retval', 0, 
+	    'errfield', $lastfield,
+	    'errvalue', $lastres};
+}
+
+sub logerror {
+    my ($host, $err, $field, $result) = @_;
+    my $groups = getcursor("SELECT distinct groupname FROM hosttables where host = '$host'");
+    my ($group, $person);
+    my $msg = (($err) ? "error" : "normal");
+		    
+    my @people = getoncallforhost($host);
+    $msg = "$msg: $host";
+    $msg .= " $field = $result" if ($field || $result);
+    mailusers("SNMP: $msg: $host $field", "$msg\n", @people);
+}
+
+sub mailusers {
+    my $subject = shift;
+    my $msg = shift;
+    my @people = @_;
+    my $person;
+    my $smtpsock = Net::SMTP->new($smtpserver);
+
+    $smtpsock->mail($smtpfrom);
+    my $error = $smtpsock->recipient(@people);
+    if (!$error) {
+	print STDERR "failed to send mail to ",join(",",@people),"\n";
+    }
+    $smtpsock->data();
+    $subject =~ s/\n//;
+    $smtpsock->datasend("To: " . join(", ",@people) . "\n");
+    $smtpsock->datasend("From: $smtpfrom\n");
+    $smtpsock->datasend("Subject: $subject\n");
+    $smtpsock->datasend("\n");
+    $smtpsock->datasend("$msg\n");
+    $smtpsock->dataend();
+    $smtpsock->quit;
+    print STDERR "mailed ",join(",",@people)," with $msg, $subject ($!)\n" if ($verbose);
+}
+
+sub hosterror {
+    my $host = shift;
+    my $error = shift || "No response";
+    my $groups = getcursor("SELECT distinct groupname FROM hosttables where host = '$host'");
+    my ($group, $person);
+    my %mailed;
+
+    return if (isbadhost($host)); # only send out a message once.
+		    
+    $dbh->do("insert into hosterrors(host, errormsg) values('$host','$error');");
+    my @people = getoncallforhost($host);
+    mailusers("No Response from $host", "$host: $error", @people);
+}
+
+sub isbadhost {
+    my $host = shift;
+    my $hosterr = getcursor("SELECT distinct host FROM hosterrors where host = '$host'");
+    if ($hosterr->fetchrow_hashref) {
+	return 1;
+    }
+    return 0;
+}
+
+sub getgroupsforhost {
+    my $host = shift;
+    my @retgroups;
+    my $groups = getcursor("SELECT distinct groupname FROM hosttables where host = '$host'");
+    while( $group = $groups->fetchrow_hashref ) {
+	push @retgroups,$group->{'groupname'};
+    }
+    @retgroups;
+}
+
+sub get_children {
+    my $mib = shift;
+    my $children = $$mib{'children'};
+    if (ref($children) ne "ARRAY") {
+	warn "$mib has no chlidren";
+	return;
+    }
+
+    if ($#{$children} == 0 && $mib->{'label'} =~ /Table$/) {
+	# is a table, use entry?
+	$children = $children->[0]{'children'};
+	if (ref($children) ne "ARRAY") {
+	    warn "$mib has no chlidren";
+	    return;
+	}
+    }
+    return $children;
+}
diff -Naur tomato/release/src/router/snmp/perl/OID/Changes tomato121/release/src/router/snmp/perl/OID/Changes
--- tomato/release/src/router/snmp/perl/OID/Changes	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/perl/OID/Changes	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,6 @@
+Revision history for Perl extension OID.
+
+0.01  Mon Apr 29 16:58:40 2002
+	- original version; created by h2xs 1.21 with options
+		OID.h
+
diff -Naur tomato/release/src/router/snmp/perl/OID/.cvsignore tomato121/release/src/router/snmp/perl/OID/.cvsignore
--- tomato/release/src/router/snmp/perl/OID/.cvsignore	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/perl/OID/.cvsignore	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,5 @@
+Makefile
+OID.bs
+OID.c
+blib
+pm_to_blib
diff -Naur tomato/release/src/router/snmp/perl/OID/Makefile.PL tomato121/release/src/router/snmp/perl/OID/Makefile.PL
--- tomato/release/src/router/snmp/perl/OID/Makefile.PL	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/perl/OID/Makefile.PL	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,143 @@
+# See lib/ExtUtils/MakeMaker.pm for details of how to influence
+# the contents of the Makefile that is written.
+
+use ExtUtils::MakeMaker;
+require 5;
+use Config;
+use Getopt::Long;
+my %MakeParams = ();
+
+%MakeParams = InitMakeParams();
+
+WriteMakefile(%MakeParams);
+
+sub InitMakeParams {
+    my $opts;
+    my %Params = (
+		  'NAME'		=> 'NetSNMP::OID',
+		  'VERSION_FROM'	=> 'OID.pm', # finds $VERSION
+		  'XSPROTOARG'          => '-prototypes',
+		  'PREREQ_PM'           => {},
+		  );
+
+    my ($snmp_lib, $snmp_llib, $sep);
+    if ($Config{'osname'} eq 'MSWin32') {
+      $opts = NetSNMPGetOpts();	
+      $snmp_lib = 'libsnmp.lib';
+      $snmp_link_lib = 'libsnmp';
+      $sep = '\\';
+
+      $Params{'DEFINE'} = "-DMSVC_PERL";
+      
+      if ($opts->{'insource'}) {
+	$Params{'LIBS'} = "-L$basedir\\win32\\lib\\ -l$snmp_link_lib";
+      }
+      else {
+	my @LibDirs = split (';',$ENV{LIB});
+	if ($opts->{'prefix'}) {
+	  push (@LibDirs,"$ENV{'NET-SNMP-PATH'}${sep}lib");
+	}
+	$noLibDir = 1;
+	while ($noLibDir) {
+	  $LibDir = find_files(["$snmp_lib"],\@LibDirs);
+	  if ($LibDir ne '') {
+	    $noLibDir = 0;
+	  }
+	  else
+	  {
+	    @LibDirs = ();
+	    @LibDirs[0] = prompt("The Net-SNMP library ($snmp_lib) could not be found.\nPlease enter the directory where it is located:");
+	    @LibDirs[0] =~ s/\\$//;
+	  }
+	}
+	$Params{LIBS} = "-L$LibDir -l$snmp_link_lib";
+      }
+
+      $Params{'INC'} = "-I$basedir\\include\\ -I$basedir\\include\\net-snmp\\ -I$basedir\\win32\\ ";
+    }
+
+    else {
+	$opts = NetSNMPGetOpts();
+	$Params{'LIBS'}    = `$opts->{'nsconfig'} --libs`;
+	chomp($Params{'LIBS'});
+	$Params{'CCFLAGS'} = `$opts->{'nsconfig'} --cflags`;
+	chomp($Params{'CCFLAGS'});
+	$Params{'CCFLAGS'} .= " " . $Config{'ccflags'};
+	if ($opts->{'insource'} eq "true") {
+	    $Params{'LIBS'} = "-L../../snmplib/.libs -L../../snmplib/ " . $Params{'LIBS'};
+	    $Params{'CCFLAGS'} = "-I../../include " . $Params{'CCFLAGS'};
+#	} else {
+#	    $Params{'PREREQ_PM'} = {'SNMP' => '5.0'};
+	}
+	$Params{'CCFLAGS'} =~ s/ -W[-\w]+//g; # ignore developer warnings
+	if ($Params{'LIBS'} eq "" || $Params{'CCFLAGS'} eq "") {
+	    die "You need to install net-snmp first (I can't find net-snmp-config)";
+	}
+    }
+
+    return(%Params);
+}
+# common subroutines -- DO NOT EDIT.
+# They are imported from the Makefile.subs.pl file
+sub NetSNMPGetOpts {
+    my %ret;
+    my $rootpath = shift;
+    $rootpath = "../" if (!$rootpath);
+    $rootpath .= '/' if ($rootpath !~ /\/$/);
+    
+    if ($Config{'osname'} eq 'MSWin32') {
+      if ($ENV{'NET-SNMP-IN-SOURCE'})
+      {
+	$ret{'insource'} = $ENV{'NET-SNMP-IN-SOURCE'};
+      }
+      elsif ($ENV{'NET-SNMP-PATH'})
+      {
+	$ret{'prefix'} = $ENV{'NET-SNMP-PATH'};
+      }
+      else
+      {
+	# don't have env vars, pull from command line and put there
+	GetOptions("NET-SNMP-IN-SOURCE=s" => \$ret{'insource'},
+	           "NET-SNMP-PATH=s"      => \$ret{'prefix'});
+
+	$ENV{'NET-SNMP-IN-SOURCE'}    = $ret{'insource'};
+	$ENV{'NET-SNMP-PATH'}         = $ret{'prefix'};
+      }
+
+      $basedir = `%COMSPEC% /c cd`;
+      chomp $basedir;
+      $basedir =~ /(.*?)\\perl.*/;
+      $basedir = $1;
+      print "Net-SNMP base directory: $basedir\n";
+
+    }
+    else
+    {
+      if ($ENV{'NET-SNMP-CONFIG'} && 
+        $ENV{'NET-SNMP-IN-SOURCE'}) {
+	# have env vars, pull from there
+	$ret{'nsconfig'} = $ENV{'NET-SNMP-CONFIG'};
+	$ret{'insource'} = $ENV{'NET-SNMP-IN-SOURCE'};
+      } else {
+	# don't have env vars, pull from command line and put there
+	GetOptions("NET-SNMP-CONFIG=s" => \$ret{'nsconfig'},
+	           "NET-SNMP-IN-SOURCE=s" => \$ret{'insource'});
+
+	if ($ret{'insource'} eq "true" && $ret{'nsconfig'} eq "") {
+	    $ret{'nsconfig'}="sh ROOTPATH../net-snmp-config";
+	} elsif ($ret{'nsconfig'} eq "") {
+	    $ret{'nsconfig'}="net-snmp-config";
+	}
+
+	$ENV{'NET-SNMP-CONFIG'}    = $ret{'nsconfig'};
+	$ENV{'NET-SNMP-IN-SOURCE'} = $ret{'insource'};
+      }
+    }	
+    
+    $ret{'nsconfig'} =~ s/ROOTPATH/$rootpath/;
+
+    $ret{'rootpath'} = $rootpath;
+
+    \%ret;
+}
+
diff -Naur tomato/release/src/router/snmp/perl/OID/MANIFEST tomato121/release/src/router/snmp/perl/OID/MANIFEST
--- tomato/release/src/router/snmp/perl/OID/MANIFEST	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/perl/OID/MANIFEST	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,7 @@
+Changes
+Makefile.PL
+MANIFEST
+OID.pm
+OID.xs
+README
+test.pl
diff -Naur tomato/release/src/router/snmp/perl/OID/OID.pm tomato121/release/src/router/snmp/perl/OID/OID.pm
--- tomato/release/src/router/snmp/perl/OID/OID.pm	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/perl/OID/OID.pm	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,246 @@
+package NetSNMP::OID;
+
+use strict;
+use Carp;
+
+require Exporter;
+require DynaLoader;
+use AutoLoader;
+
+sub compare($$);
+
+use overload
+    '<=>' => \&compare,
+    'cmp' => \&oidstrcmp,
+    '""' => \&quote_oid,
+    '+' => \&add,
+;
+
+use SNMP;
+
+sub quote_oid {
+    return $_[0]->{'oidptr'}->to_string();
+}
+
+sub length {
+    return $_[0]->{'oidptr'}->length();
+}
+
+sub append {
+    my $this = shift;
+    my $str = shift;
+
+    if (ref($str) eq 'NetSNMP::OID') {
+	return $this->{'oidptr'}->append_oid($str->{'oidptr'});
+    }
+    $str = "." . $str if ($str =~ /^\d+/);
+    if ($str =~ /^[.\d]+/) {
+	# oid segment
+	return $this->{'oidptr'}->append($str);
+    }
+    if ($str =~ /^\"(.*)\"$/) {
+	# string index
+	my $newstr = "." . CORE::length($1);
+	map { $newstr .= ".$_" } unpack("c*",$1);
+	return $this->{'oidptr'}->append($newstr);
+    }
+    if ($str =~ /^\'(.*)\'$/) {
+	# string index, implied
+	my $newstr;
+	map { $newstr .= ".$_" } unpack("c*",$1);
+	return $this->{'oidptr'}->append($newstr);
+    }
+    # Just Parse it...
+    return $this->{'oidptr'}->append($str);
+}
+
+sub add {
+    my $this = shift;
+    my $str = shift;
+    my ($newoid, %newhash);
+    $newoid = \%newhash;
+    $newoid->{'oidptr'} = $this->{'oidptr'}->clone();
+    bless($newoid, ref($this));
+    $newoid->append($str);
+    return $newoid;
+}
+
+use vars qw(@ISA %EXPORT_TAGS @EXPORT_OK @EXPORT $VERSION $AUTOLOAD);
+
+@ISA = qw(Exporter DynaLoader);
+
+# Items to export into callers namespace by default. Note: do not export
+# names by default without a very good reason. Use EXPORT_OK instead.
+# Do not simply export all your public functions/methods/constants.
+
+# This allows declaration	use NetSNMP::OID ':all';
+# If you do not need this, moving things directly into @EXPORT or @EXPORT_OK
+# will save memory.
+%EXPORT_TAGS = ( 'all' => [ qw(
+	snmp_oid_compare
+        compare
+) ] );
+
+@EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } );
+
+@EXPORT = qw(
+	snmp_oid_compare
+        compare
+);
+$VERSION = '0.1';
+
+sub new {
+    my $type = shift;
+    my $arg = shift;
+    if (!$arg) {
+	$arg = $type;
+	$type = "NetSNMP::OID";
+    }
+    SNMP::init_snmp("perl");
+    my $ptr = NetSNMP::OID::newptr($arg);
+    if ($ptr) {
+      return newwithptr($type, $ptr);
+    }
+}
+
+sub newwithptr {
+    my $type = shift;
+    my $ptr = shift;
+    my $self = {};
+    if (!$ptr) {
+	$ptr = $type;
+	$type = "NetSNMP::OID";
+    }
+    SNMP::init_snmp("perl");
+    $self->{'oidptr'} = $ptr;
+    bless($self, $type);
+    return $self;
+}
+
+sub snmp_oid_compare($$) {
+    my ($oid1, $oid2) = @_;
+    return _snmp_oid_compare($oid1->{oidptr}, $oid2->{oidptr});
+}
+
+sub compare($$) {
+    my ($v1, $v2) = @_;
+    snmp_oid_compare($v1, $v2);
+}
+
+sub oidstrcmp {
+    my ($v1, $v2) = @_;
+    $v1->{'oidptr'}->to_string cmp $v2->{'oidptr'}->to_string;
+}
+
+sub to_array($) {
+    my $self = shift;
+    return $self->{oidptr}->to_array();
+}
+
+sub AUTOLOAD {
+    # This AUTOLOAD is used to 'autoload' constants from the constant()
+    # XS function.  If a constant is not found then control is passed
+    # to the AUTOLOAD in AutoLoader.
+
+    my $constname;
+    ($constname = $AUTOLOAD) =~ s/.*:://;
+    croak "& not defined" if $constname eq 'constant';
+    my $val = constant($constname, @_ ? $_[0] : 0);
+    if ($! != 0) {
+	if ($! =~ /Invalid/ || $!{EINVAL}) {
+	    $AutoLoader::AUTOLOAD = $AUTOLOAD;
+	    goto &AutoLoader::AUTOLOAD;
+	}
+	else {
+	    croak "Your vendor has not defined NetSNMP::OID macro $constname";
+	}
+    }
+    {
+	no strict 'refs';
+	# Fixed between 5.005_53 and 5.005_61
+	if ($] >= 5.00561) {
+	    *$AUTOLOAD = sub () { $val };
+	}
+	else {
+	    *$AUTOLOAD = sub { $val };
+	}
+    }
+    goto &$AUTOLOAD;
+}
+
+bootstrap NetSNMP::OID $VERSION;
+
+# Preloaded methods go here.
+
+# Autoload methods go after =cut, and are processed by the autosplit program.
+
+1;
+__END__
+# Below is stub documentation for your module. You better edit it!
+
+=head1 NAME
+
+NetSNMP::OID - Perl extension for manipulating OIDs
+
+=head1 SYNOPSIS
+
+  use NetSNMP::OID;
+
+  my $oid = new NetSNMP::OID('sysContact.0');
+
+  if ($oid < new NetSNMP::OID('ifTable')) {
+      do_something();
+  }
+
+  my @numarray = $oid->to_array();
+
+  # appending oids
+  $oid = new NetSNMP::OID('.1.3');
+  $oid += ".6.1";
+  # -> .1.3.6.1
+
+  # appending index strings
+
+  $oid2 = $oid + "\"wes\"";
+  # -> .1.3.6.1.3.119.101.115
+
+  $oid3 = $oid + "\'wes\'";
+  # -> .1.3.6.1.119.101.115
+
+  $len = $oid3->length();
+  # -> 7
+
+=head1 DESCRIPTION
+
+The NetSNMP::OID module is a simple wrapper around a C-based net-snmp
+oid (which is an array of unsigned integers).  The OID is internally
+stored as a C array of integers for speed purposes when doing
+comparisons, etc.
+
+The standard logical expression operators (<, >, ==, ...) are
+overloaded such that lexographical comparisons may be done with them.
+
+The + operator is overloaded to allow you to append stuff on to the
+end of a OID, like index segments of a table, for example.
+
+=head2 EXPORT
+
+int snmp_oid_compare(oid1, oid2)
+int compare(oid1, oid2)
+
+=head1 AUTHOR
+
+Wes Hardaker, E<lt>hardaker@users.sourceforge.netE<gt>
+
+=head1 SEE ALSO
+
+L<SNMP>, L<perl>.
+
+=head1 Copyright
+
+Copyright (c) 2002 Networks Associates Technology, Inc.  All
+Rights Reserved.  This program is free software; you can
+redistribute it and/or modify it under the same terms as Perl
+itself.
+
+=cut
diff -Naur tomato/release/src/router/snmp/perl/OID/OID.xs tomato121/release/src/router/snmp/perl/OID/OID.xs
--- tomato/release/src/router/snmp/perl/OID/OID.xs	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/perl/OID/OID.xs	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,183 @@
+/* -*- C -*- */
+#include "EXTERN.h"
+#include "perl.h"
+#include "XSUB.h"
+
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+
+/* pulled from Dave's, yet-to-be-used, net-snmp library rewrite.
+   autocompatibility for the future? */
+
+#define NETSNMP_NAMEBUF_LEN 128
+typedef struct netsnmp_oid_s {
+    oid                 *name;
+    unsigned int         len;
+    oid                  namebuf[ NETSNMP_NAMEBUF_LEN ];
+} netsnmp_oid;
+
+static int
+not_here(char *s)
+{
+    croak("%s not implemented on this architecture", s);
+    return -1;
+}
+
+static double
+constant(char *name, int len, int arg)
+{
+    errno = EINVAL;
+    return 0;
+}
+
+netsnmp_oid *
+nso_newarrayptr(oid *name, size_t name_len) 
+{
+    netsnmp_oid *RETVAL;
+    RETVAL = SNMP_MALLOC_TYPEDEF(netsnmp_oid);
+    RETVAL->name = RETVAL->namebuf;
+    RETVAL->len = name_len;
+    memcpy(RETVAL->name, name, name_len * sizeof(oid));
+    return RETVAL;
+}
+
+MODULE = NetSNMP::OID		PACKAGE = NetSNMP::OID		PREFIX=nso_
+
+netsnmp_oid *
+nso_newptr(initstring)
+    char *initstring
+    CODE:
+        RETVAL = SNMP_MALLOC_TYPEDEF(netsnmp_oid);
+        RETVAL->name = RETVAL->namebuf;
+        RETVAL->len = sizeof(RETVAL->namebuf)/sizeof(RETVAL->namebuf[0]);
+        if (!snmp_parse_oid(initstring, (oid *) RETVAL->name, &RETVAL->len)) {
+            fprintf(stderr, "Can't parse: %s\n", initstring);
+            RETVAL->len = 0;
+            RETVAL = NULL;
+        }
+    OUTPUT:
+        RETVAL
+
+double
+constant(sv,arg)
+    PREINIT:
+	STRLEN		len;
+    INPUT:
+	SV *		sv
+	char *		s = SvPV(sv, len);
+	int		arg
+    CODE:
+	RETVAL = constant(s,len,arg);
+    OUTPUT:
+	RETVAL
+
+int
+_snmp_oid_compare(oid1, oid2)
+    netsnmp_oid *oid1;
+    netsnmp_oid *oid2;
+    CODE:
+        RETVAL = snmp_oid_compare((oid *) oid1->name, oid1->len,
+                                  (oid *) oid2->name, oid2->len);
+    OUTPUT:
+        RETVAL
+
+MODULE = NetSNMP::OID  PACKAGE = netsnmp_oidPtr  PREFIX = nsop_
+
+void
+nsop_DESTROY(oid1)
+	netsnmp_oid *oid1
+    CODE:
+	free(oid1);
+        
+char *
+nsop_to_string(oid1)
+    	netsnmp_oid *oid1
+    PREINIT:
+        static char mystr[SNMP_MAXBUF];
+    CODE:
+        {
+            if (oid1->len == 0)
+                snprintf(mystr, sizeof(mystr), "Illegal OID");
+            else
+                snprint_objid(mystr, sizeof(mystr),
+                              (oid *) oid1->name, oid1->len);
+            RETVAL = mystr;
+        }
+                
+    OUTPUT:
+        RETVAL
+
+void
+nsop_to_array(oid1)
+    netsnmp_oid *oid1;
+    PREINIT:
+        int i;
+
+    PPCODE:
+        EXTEND(SP, oid1->len);
+        for(i=0; i < oid1->len; i++) {
+            PUSHs(sv_2mortal(newSVnv(oid1->name[i])));
+        }
+
+void
+nsop_append(oid1, string)
+    netsnmp_oid *oid1;
+    char *string;
+    PREINIT:
+    oid name[128];
+    size_t name_len = 128;
+    int i;
+    CODE: 
+    {
+        if (!snmp_parse_oid(string, (oid *) name, &name_len)) {
+            /* XXX */
+        }
+        if (oid1->len + name_len > 128) {
+            /* XXX: illegal */
+        }
+        for(i = 0; i < name_len; i++) {
+            oid1->name[i+oid1->len] = name[i];
+        }
+        oid1->len += name_len;
+    }
+
+void
+nsop_append_oid(oid1, oid2)
+    netsnmp_oid *oid1;
+    netsnmp_oid *oid2;
+    PREINIT:
+    int i;
+    CODE: 
+    {
+        if (oid1->len + oid2->len > 128) {
+            /* XXX: illegal */
+        }
+        for(i = 0; i < oid2->len; i++) {
+            oid1->name[i+oid1->len] = oid2->name[i];
+        }
+        oid1->len += oid2->len;
+    }
+
+int
+nsop_length(oid1)
+    netsnmp_oid *oid1;
+    CODE: 
+    {
+        RETVAL = oid1->len;
+    }
+    OUTPUT:
+    RETVAL
+    
+netsnmp_oid *
+nsop_clone(oid1)
+    netsnmp_oid *oid1;
+    PREINIT:
+    netsnmp_oid *oid2;
+    CODE:
+    {
+        oid2 = nso_newarrayptr(oid1->name, oid1->len);
+        RETVAL = oid2;
+    }
+OUTPUT:
+    RETVAL
+        
diff -Naur tomato/release/src/router/snmp/perl/OID/README tomato121/release/src/router/snmp/perl/OID/README
--- tomato/release/src/router/snmp/perl/OID/README	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/perl/OID/README	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,31 @@
+OID version 0.01
+================
+
+The NetSNMP::OID class is a simple wrapper around a C-based net-snmp
+oid.  The OID is internally stored as a C array of integers for speed
+purposes when doing comparisons, etc.  The standard logical expression
+operators (<, >, ==, ...) are overloaded such that lexographical
+comparisons may be done with them.
+
+INSTALLATION
+
+To install this module type the following:
+
+   perl Makefile.PL
+   make
+   make test
+   make install
+
+DEPENDENCIES
+
+This module requires these other modules and libraries:
+
+  The net-snmp 5.0 or greater release
+  The SNMP 5.0.1 or greater perl module.
+
+COPYRIGHT AND LICENCE
+
+Copyright (c) 2002 Networks Associates Technology, Inc.  All
+Rights Reserved.  This program is free software; you can
+redistribute it and/or modify it under the same terms as Perl
+itself.
diff -Naur tomato/release/src/router/snmp/perl/OID/test.pl tomato121/release/src/router/snmp/perl/OID/test.pl
--- tomato/release/src/router/snmp/perl/OID/test.pl	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/perl/OID/test.pl	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,104 @@
+# Before `make install' is performed this script should be runnable with
+# `make test'. After `make install' it should work as `perl test.pl'
+
+#########################
+
+# change 'tests => 1' to 'tests => last_test_to_print';
+
+use Test;
+BEGIN { plan tests => 36 ; $ENV{'SNMPCONFPATH'} = 'nopath'};
+use NetSNMP::OID;
+ok(1); # If we made it this far, we're ok.
+
+#########################
+
+# Insert your test code below, the Test module is use()ed here so read
+# its man page ( perldoc Test ) for help writing this test script.
+
+my $oid = new NetSNMP::OID(".1.3.6.1");
+ok(ref($oid) eq "NetSNMP::OID");
+ok(ref($oid->{oidptr}) eq "netsnmp_oidPtr");
+#print STDERR ref($oid),"\n";
+
+my $tostring = "$oid";
+#print STDERR "$tostring\n";
+ok($tostring eq "internet");
+
+my $oid2 = new NetSNMP::OID(".1.3.6.1.2");
+$tostring = "$oid2";
+#print STDERR "$tostring\n";
+ok($tostring eq "mgmt");
+
+my $oid3 = new NetSNMP::OID(".1.3.6.1");
+
+my $val = NetSNMP::OID::snmp_oid_compare($oid, $oid2);
+#print STDERR "compare result: $val\n";
+ok($val == -1);
+
+$val = $oid2->snmp_oid_compare($oid);
+#print STDERR "compare result: $val\n";
+ok($val == 1);
+
+$val = NetSNMP::OID::compare($oid, $oid);
+#print STDERR "compare result: $val\n";
+ok($val == 0);
+
+$val = $oid->compare($oid3);
+#print STDERR "compare result: $val\n";
+ok($val == 0);
+
+ok(($oid <=> $oid2) == -1);
+ok(($oid2 <=> $oid) == 1);
+ok(($oid <=> $oid3) == 0);
+
+ok($oid < $oid2);
+ok($oid <= $oid2);
+ok($oid2 > $oid);
+ok($oid2 >= $oid);
+ok($oid == $oid3);
+ok($oid <= $oid3);
+ok($oid >= $oid3);
+
+ok(new NetSNMP::OID('system') < new NetSNMP::OID('interfaces'));
+ok(new NetSNMP::OID('interfaces') > new NetSNMP::OID('system'));
+ok(new NetSNMP::OID('sysORTable') > new NetSNMP::OID('system'));
+
+my @a = $oid->to_array();
+ok($a[0] == 1 && $a[1] == 3 && $a[2] == 6 && $a[3] == 1 && $#a == 3);
+
+$oid->append(".1.2.3");
+ok("$oid" eq "directory.2.3");
+
+$oidmore = $oid + ".8.9.10";
+ok($oidmore == new NetSNMP::OID("directory.2.3.8.9.10"));
+ok("$oid" eq "directory.2.3");
+ok(ref($oidmore) eq "NetSNMP::OID");
+
+# += should work
+$oidmore += ".11";
+ok($oidmore == new NetSNMP::OID("directory.2.3.8.9.10.11"));
+
+$oidstr = $oidmore + "\"wes\"";
+ok($oidstr == new NetSNMP::OID("directory.2.3.8.9.10.11.3.119.101.115"));
+
+$oidstr = $oidmore + "\'wes\'";
+ok($oidstr == new NetSNMP::OID("directory.2.3.8.9.10.11.119.101.115"));
+
+# just make sure you can do it twice (ie, not modify the original)
+$oidstr = $oidmore + "\'wes\'";
+ok($oidstr == new NetSNMP::OID("directory.2.3.8.9.10.11.119.101.115"));
+
+$oidstr = $oidmore + "internet";
+ok($oidstr == new NetSNMP::OID("directory.2.3.8.9.10.11.1.3.6.1"));
+
+$oidstr = $oidmore + "999";
+ok($oidstr == new NetSNMP::OID("directory.2.3.8.9.10.11.999"));
+
+$oidstr = $oidmore + (new NetSNMP::OID(".1.3.6.1"));
+ok($oidstr == new NetSNMP::OID("directory.2.3.8.9.10.11.1.3.6.1"));
+
+$oid = new NetSNMP::OID("nosuchoidexists");
+ok(ref($oid) ne "NetSNMP::OID");
+
+ok($oidstr->length() == 15);
+
diff -Naur tomato/release/src/router/snmp/perl/OID/typemap tomato121/release/src/router/snmp/perl/OID/typemap
--- tomato/release/src/router/snmp/perl/OID/typemap	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/perl/OID/typemap	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,2 @@
+TYPEMAP
+netsnmp_oid *			T_PTROBJ
diff -Naur tomato/release/src/router/snmp/perl/SNMP/BUG tomato121/release/src/router/snmp/perl/SNMP/BUG
--- tomato/release/src/router/snmp/perl/SNMP/BUG	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/perl/SNMP/BUG	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,40 @@
+
+1) Memory leak (have not seen this lately)
+
+The following snippet used to grow in memory (and may still) - please
+notify me if anyone still observes this and even better has a fix.
+
+perl -le '
+use SNMP;
+$obj = new SNMP::Session DestHost, "dubravka";
+while (){
+print $obj->get(["ifNumber",0]);
+}
+'
+
+***Note: need to verify this with the async API as well***
+
+2) not sure if this is a bug but I can cause a crash with a 'goto
+LABEL;' from within an async callback function.
+
+3) the following varbind format is not encoded correctly ... I have seen this crash the agent as well
+
+$sess->get(["sysDescr.0"]);
+
+use the following instead:
+
+$sess->get(["sysDescr",0]);
+or
+$sess->get("sysDescr.0");
+
+4) this is not handled yet
+$sess->get(['MODULE-NAME::mibName',0]);
+but strangely
+$sess->get(['MODULE-NAME::mibName.0']);
+works
+
+5) if you are on a system that does not have vsnprintf in libc but you
+do have BerkleyDB installed ucd configure will assume you will get it
+from there - you will need to change hints/solaris.pl to
+
+$self->{LIBS} .= ' -lkstat -ldb';
diff -Naur tomato/release/src/router/snmp/perl/SNMP/.cvsignore tomato121/release/src/router/snmp/perl/SNMP/.cvsignore
--- tomato/release/src/router/snmp/perl/SNMP/.cvsignore	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/perl/SNMP/.cvsignore	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,5 @@
+Makefile
+SNMP.bs
+SNMP.c
+blib
+pm_to_blib
diff -Naur tomato/release/src/router/snmp/perl/SNMP/examples/async1.pl tomato121/release/src/router/snmp/perl/SNMP/examples/async1.pl
--- tomato/release/src/router/snmp/perl/SNMP/examples/async1.pl	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/perl/SNMP/examples/async1.pl	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,17 @@
+use SNMP;
+
+$SNMP::auto_init_mib = 0; 
+
+$sess = new SNMP::Session(); 
+
+sub poller {  
+   # VarList is undefined if TIMEOUT occured
+   if (!defined($_[1])) { die "request timed out[$_[0]->{ErrorStr}]\n"; }
+   if ($i++>100000) { die "completed 500 polls\n"; }
+   #print $_[1][0]->tag, " = ", $_[1][0]->val, "\n";
+   $_[0]->get($_[1], [\&poller, $_[0]]);
+} 
+
+$sess->get([[".1.3.6.1.2.1.1.3.0"]], [\&poller, $sess]); 
+
+SNMP::MainLoop();
diff -Naur tomato/release/src/router/snmp/perl/SNMP/examples/async2.pl tomato121/release/src/router/snmp/perl/SNMP/examples/async2.pl
--- tomato/release/src/router/snmp/perl/SNMP/examples/async2.pl	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/perl/SNMP/examples/async2.pl	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,19 @@
+use SNMP;
+
+$SNMP::auto_init_mib = 0; 
+
+$sess = new SNMP::Session(); 
+
+sub poller_handler {  
+   if (++$i>500) { die "completed 500 polls\n"; };
+   # VarList is undefined if TIMEOUT occured
+   if (!defined($_[1])) { 
+       warn "request timed out[$_[0]->{ErrorStr}]\n";
+       return;
+   }
+#   print "$i) ",$_[1][0]->tag, " = ", $_[1][0]->val, "\n";
+} 
+
+# $sess->get([[".1.3.6.1.2.1.1.3.0"]], [\&poller_handler, $sess]); 
+
+SNMP::MainLoop(.1,sub {for (1..50) {$sess->get([['.1.3.6.1.2.1.1.3.0']], [\&poller_handler, $sess]);} });
diff -Naur tomato/release/src/router/snmp/perl/SNMP/examples/bulkwalk.pl tomato121/release/src/router/snmp/perl/SNMP/examples/bulkwalk.pl
--- tomato/release/src/router/snmp/perl/SNMP/examples/bulkwalk.pl	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/perl/SNMP/examples/bulkwalk.pl	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,126 @@
+#!/usr/local/bin/perl
+#
+# $Id: bulkwalk.pl,v 1.1.2.1 2004/06/20 21:54:58 nikki Exp $
+#
+
+use SNMP;
+
+# Hard-coded hostname and community.  This is icky, but I didn't want to 
+# muddle the example with parsing command line arguments.  Deal with it. -r
+#
+my $hostname='localhost';
+my $port='161';
+my $community='public';
+
+$SNMP::debugging = 0;
+$SNMP::dump_packet = 0;
+
+$sess = new SNMP::Session( 'DestHost'	=> $hostname,
+			   'Community'	=> $community,
+			   'RemotePort'	=> $port,
+			   'Timeout'	=> 300000,
+			   'Retries'	=> 3,
+			   'Version'	=> '2c',
+			   'UseLongNames' => 1,	   # Return full OID tags
+			   'UseNumeric' => 1,	   # Return dotted decimal OID
+			   'UseEnums'	=> 0,	   # Don't use enumerated vals
+			   'UseSprintValue' => 0); # Don't pretty-print values
+
+die "Cannot create session: ${SNMP::ErrorStr}\n" unless defined $sess;
+
+# Set up a list of two non-repeaters and some repeated variables.
+#
+# IMPORTANT NOTE:
+#
+#   The 'get' performed for non-repeaters is a "GETNEXT" (the non-repeater
+#   requests are not fulfilled with SNMP GET's).  This means that you must
+#   ask for the lexicographically preceeding variable for non-repeaters.
+#
+#   For most branches (i.e. 'sysUpTime'), this "just works" -- be sure you
+#   don't ask for an instance, and the response will be as expected.  However,
+#   if you want a specific variable instance (i.e. 'ifSpeed.5'), you must 
+#   ask for the _preceeding_ variable ('ifSpeed.4' in this example).
+#
+#   See section 4.2.3 of RFC 1905 for more details on GETBULK PDU handling.
+#
+
+my $vars = new SNMP::VarList(	['sysUpTime'],	# Nonrepeater variable
+				['ifNumber'],	# Nonrepeater variable
+				['ifSpeed'],	# Repeated variable
+				['ifDescr'] );  # Repeated variable.
+
+# Do the bulkwalk of the two non-repeaters, and the repeaters.  Ask for no
+# more than 8 values per response packet.  If the caller already knows how
+# many instances will be returned for the repeaters, it can ask only for
+# that many repeaters.
+#
+@resp = $sess->bulkwalk(2, 8, $vars);
+die "Cannot do bulkwalk: $sess->{ErrorStr} ($sess->{ErrorNum})\n"
+							if $sess->{ErrorNum};
+
+# Print out the returned response for each variable.
+for $vbarr ( @resp ) {
+    # Determine which OID this request queried.  This is kept in the VarList
+    # reference passed to bulkwalk().
+    $oid = $$vars[$i++]->tag();
+
+    # Count the number of responses to this query.  The count will be 1 for
+    # non-repeaters, 1 or more for repeaters.
+    $num = scalar @$vbarr;
+    print "$num responses for oid $oid: \n";
+
+    # Display the returned list of varbinds using the SNMP::Varbind methods.
+    for $v (@$vbarr) {
+	printf("\t%s = %s (%s)\n", $v->name, $v->val, $v->type);
+    }
+    print "\n";
+}
+
+#
+# Now do the same bulkwalk again, but in asynchronous mode.  Set up a Perl
+# callback to receive the reference to the array of arrays of Varbind's for
+# the return value, and pass along the $vars VarList to it.  This allows us
+# to print the oid tags (the callback code is almost the same as above).
+#
+# First, define the Perl callback to be called when the bulkwalk completes.
+# The call to SNMP::finish() will cause the SNMP::MainLoop() to return once
+# the callback has completed, so that processing can continue.
+#
+sub callback {
+    my ($vars, $values) = @_;
+    
+    for $vbarr ( @$values ) {
+	# Determine which OID this request queried.  This is kept in the 
+	# '$vars' VarList reference passed to the Perl callback by the
+	# asynchronous callback.
+	$oid = (shift @$vars)->tag();
+
+	# Count the number of responses to this query.  The count will be 1 for
+	# non-repeaters, 1 or more for repeaters.
+	$num = scalar @$vbarr;
+	print "$num responses for oid $oid: \n";
+
+	# Display the returned list of varbinds using the SNMP::Varbind methods.
+	for $v (@$vbarr) {
+	    printf("\t%s = %s (%s)\n", $v->name, $v->val, $v->type);
+	}
+	print "\n";
+    }
+
+    SNMP::finish();
+}
+
+# The actual bulkwalk request is done here.  Note that the $vars VarList 
+# reference will be passed to the Perl callback when the bulkwalk completes.
+# 
+my $reqid = $sess->bulkwalk(2, 8, $vars, [ \&callback, $vars ]);
+die "Cannot do async bulkwalk: $sess->{ErrorStr} ($sess->{ErrorNum})\n"
+							if $sess->{ErrorNum};
+
+# Now drop into the SNMP event loop and await completion of the bulkwalk.
+# The call to SNMP::finish() in &callback will make the SNMP::MainLoop()
+# return to the caller.
+#
+SNMP::MainLoop();
+
+exit 0;
diff -Naur tomato/release/src/router/snmp/perl/SNMP/examples/ipforward.pl tomato121/release/src/router/snmp/perl/SNMP/examples/ipforward.pl
--- tomato/release/src/router/snmp/perl/SNMP/examples/ipforward.pl	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/perl/SNMP/examples/ipforward.pl	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,30 @@
+use SNMP;
+$SNMP::use_enums = 1;
+
+my $host = shift;
+my $comm = shift;
+$sess = new SNMP::Session(DestHost => $host, Community => $comm);
+
+$vars = new SNMP::VarList( ['ipRouteIfIndex'], ['ipRouteType'],
+                           ['ipRouteProto'], ['ipRouteMask'],
+                           ['ipRouteNextHop'], ['ipRouteAge'],
+			   ['ipRouteMetric1']);
+
+format STDOUT_TOP =
+  Destination      Next Hop          Mask       Proto    Age    Metric
+--------------- --------------- -------------- ------- -------- ------
+.
+
+format STDOUT =
+@<<<<<<<<<<<<<< @<<<<<<<<<<<<<< @<<<<<<<<<<<<< @|||||| @||||||| @|||||
+$dest,          $nhop,          $mask,         $proto, $age,    $metric
+.
+
+for (($index,$type,$proto,$mask,$nhop,$age,$metric) = $sess->getnext($vars);
+     $$vars[0]->tag eq 'ipRouteIfIndex' and not $sess->{ErrorStr};
+     ($index,$type,$proto,$mask,$nhop,$age,$metric) = $sess->getnext($vars)) {
+    $dest = $$vars[0]->iid;
+    write;
+}
+
+print "$sess->{ErrorStr}\n";
diff -Naur tomato/release/src/router/snmp/perl/SNMP/examples/mibtree.pl tomato121/release/src/router/snmp/perl/SNMP/examples/mibtree.pl
--- tomato/release/src/router/snmp/perl/SNMP/examples/mibtree.pl	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/perl/SNMP/examples/mibtree.pl	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,20 @@
+use SNMP;
+$SNMP::save_descriptions = 1; # must be set prior to mib initialization
+SNMP::initMib(); # parses default list of Mib modules from default dirs
+
+# read dotted decimal oid or symbolic name to look up
+# partial name will be searched and all matches returned
+$val = shift || die "supply partial or complete object name or identifier\n";
+
+if ($node = $SNMP::MIB{$val}) {
+    print "$node:$node->{label} [$node->{objectID}]\n";
+    while (($k,$v) = each %$node) {
+	print "\t$k => $v\n";
+    }
+} else {
+    while (($k,$v) = each %SNMP::MIB) {
+	print "$v->{label} [$v->{obj}]\n" #accepts unique partial key(objectID)
+	    if $k =~ /$val/ or $v->{label} =~ /$val/;
+    }
+}
+
diff -Naur tomato/release/src/router/snmp/perl/SNMP/examples/mibwalk.pl tomato121/release/src/router/snmp/perl/SNMP/examples/mibwalk.pl
--- tomato/release/src/router/snmp/perl/SNMP/examples/mibwalk.pl	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/perl/SNMP/examples/mibwalk.pl	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,17 @@
+# snmpwalk of entire MIB
+# stop on error at end of MIB
+
+use SNMP 1.8;
+$SNMP::use_sprint_value = 1;
+my $host = shift || localhost;
+my $comm = shift || public;
+
+$sess = new SNMP::Session(DestHost => $host, Community => $comm);
+
+$var = new SNMP::Varbind([]);
+
+do {
+  $val = $sess->getnext($var);
+  print "$var->[$SNMP::Varbind::tag_f].$var->[$SNMP::Varbind::iid_f] = ",
+        "$var->[$SNMP::Varbind::val_f]\n";
+} until ($sess->{ErrorStr});
diff -Naur tomato/release/src/router/snmp/perl/SNMP/examples/pingmib.pl tomato121/release/src/router/snmp/perl/SNMP/examples/pingmib.pl
--- tomato/release/src/router/snmp/perl/SNMP/examples/pingmib.pl	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/perl/SNMP/examples/pingmib.pl	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,36 @@
+use strict;
+use SNMP;
+
+my $target = shift || die "no ping target supplied\n"; # numeric ip address
+my $host = shift || 'localhost';
+my $community = shift || 'private';
+
+{
+        my $sess = new SNMP::Session (DestHost => $host,
+				      Community => $community,
+				      Retries => 1);
+
+        my $dec = pack("C*",split /\./, $target);
+        my $oid = ".1.3.6.1.4.1.9.9.16.1.1.1";
+        my $row = "300";
+
+        $sess->set([
+                ["$oid.16", $row, 6, "INTEGER"],
+                ["$oid.16", $row, 5, "INTEGER"],
+                ["$oid.15", $row, "MoNDS", "OCTETSTR"],
+                ["$oid.2", $row, 1, "INTEGER"],
+                ["$oid.4", $row, 20, "INTEGER"],
+                ["$oid.5", $row, 150, "INTEGER"],
+                ["$oid.3", $row, $dec, "OCTETSTR"]]);
+
+        $sess->set([["$oid.16", $row, 1, "INTEGER"]]);
+        sleep 30;
+        my ($sent, $received, $low, $avg, $high, $completed) = $sess->get([
+                ["$oid.9", $row], ["$oid.10", $row], ["$oid.11", $row],
+                ["$oid.12", $row], ["$oid.13", $row], ["$oid.14", $row]]);
+
+        printf "Packet loss: %d% (%d/%d)\n", (100 * ($sent-$received)) / $sent,
+                $received, $sent;
+        print "Average delay $avg (low: $low high: $high)\n";
+        $sess->set(["$oid.16", $row, 6, "INTEGER"]);
+}
diff -Naur tomato/release/src/router/snmp/perl/SNMP/examples/tablewalk.pl tomato121/release/src/router/snmp/perl/SNMP/examples/tablewalk.pl
--- tomato/release/src/router/snmp/perl/SNMP/examples/tablewalk.pl	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/perl/SNMP/examples/tablewalk.pl	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,19 @@
+# snmpwalk of a single table
+# getnext of 3 columns from ipAddrEntry table
+# stop after last row in table
+
+use SNMP 1.8;
+
+my $host = shift || localhost;
+my $comm = shift || public;
+
+my $sess = new SNMP::Session ( DestHost => $host, Community => $comm );
+
+my $vars = new SNMP::VarList([ipAdEntAddr],[ipAdEntIfIndex],[ipAdEntNetMask]);
+
+for (@vals = $sess->getnext($vars);
+     $vars->[0]->tag =~ /ipAdEntAddr/       # still in table
+     and not $sess->{ErrorStr};          # and not end of mib or other error
+     @vals = $sess->getnext($vars)) {
+     print "   ($vals[1]) $vals[0]/$vals[2]\n";
+}
diff -Naur tomato/release/src/router/snmp/perl/SNMP/examples/testleak.pl tomato121/release/src/router/snmp/perl/SNMP/examples/testleak.pl
--- tomato/release/src/router/snmp/perl/SNMP/examples/testleak.pl	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/perl/SNMP/examples/testleak.pl	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,19 @@
+use SNMP 1.6;
+
+$host = shift;
+unless ($host) {
+  $| = 1;  print "enter SNMP host address: "; $| = 0;
+  chomp($host = <STDIN>);
+}
+
+$obj = new SNMP::Session DestHost, $host;
+
+while (){
+print $obj->get(["ifNumber",0]);
+  open(COM,"ps -u$$|") || die;
+  @bar = <COM>; 
+  $siz = (split(' ',$bar[1]))[4];
+  $rss = (split(' ',$bar[1]))[5];
+  close(COM);
+  print "siz = $siz, rss = $rss\n";
+}
diff -Naur tomato/release/src/router/snmp/perl/SNMP/examples/trap-example.pl tomato121/release/src/router/snmp/perl/SNMP/examples/trap-example.pl
--- tomato/release/src/router/snmp/perl/SNMP/examples/trap-example.pl	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/perl/SNMP/examples/trap-example.pl	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,96 @@
+#!/usr/bin/perl -w
+
+use strict;
+use vars qw();
+use SNMP qw();
+
+&SNMP::initMib();
+
+&SNMP::loadModules(
+  'RFC2127-MIB',
+  );
+
+sub trap_call_setup;
+sub trap_dummy;
+
+#
+# should eventually get these out of the MIB...
+#
+my %dispatch_table = (
+  'isdnMibCallInformation', \&trap_call_setup,
+  '.', \&trap_dummy,
+);
+
+sub trap_dispatcher
+{
+  my $session = shift;
+  my $ref = shift;
+  my $trapType;
+  my ($reqid, $addr, $community);
+
+  # if this is a timeout, then there will be no args...
+  if (defined($ref)) {
+    $ref->[1]->[2] = SNMP::translateObj($ref->[1]->val);
+    $trapType = $ref->[1]->val;
+    my $args = shift;
+    ($reqid, $addr, $community) = @{$args};
+  } else {
+    $trapType = 'timeout';
+  }
+
+  if (defined($dispatch_table{$trapType})) {
+    &{$dispatch_table{$trapType}}($session, $ref);
+  } elsif (defined($dispatch_table{'.'})) {
+    &{$dispatch_table{'.'}}($session, $ref);
+  } else {
+    # don't do anything... silently discard.
+  }
+}
+
+sub trap_dummy
+{
+  my $session = shift;
+  my $ref = shift;
+
+  my $trapType = $ref->[1]->val;
+
+  warn "unexpected trap " . $trapType;
+}
+
+
+sub trap_call_setup
+{
+  my $session = shift;
+  my $varlist = shift;
+  my $args = shift;
+
+  my $ifIndex = $varlist->[2]->val;
+  my $isdnBearerOperStatus = $varlist->[3]->val;
+  my $isdnBearerPeerAddress = $varlist->[4]->val;
+  my $isdnBearerPeerSubAddress = $varlist->[5]->val;
+  my $isdnBearerInfoType = $varlist->[6]->val;
+  my $isdnBearerCallOrigin = $varlist->[5]->val;
+
+  my ($reqid, $ipaddr, $community) = @{$args};
+
+  printf "Call from %s", $isdnBearerPeerAddress;
+  printf "*%s", $isdnBearerPeerSubAddress if ($isdnBearerPeerSubAddress ne '');
+  printf "\n";
+}
+
+my $session = new SNMP::Session(
+  DestHost => '0.0.0.0',
+  LocalPort => 162,
+  Version => '2c',
+  UseEnums => 0,
+  );
+
+if (!defined($session)) {
+  die "can't create listener session";
+}
+
+# otherwise assume that ErrorNum is zero...
+
+$session->SNMP::_catch([\&trap_dispatcher, $session]);
+
+&SNMP::MainLoop();
diff -Naur tomato/release/src/router/snmp/perl/SNMP/hints/irix.pl tomato121/release/src/router/snmp/perl/SNMP/hints/irix.pl
--- tomato/release/src/router/snmp/perl/SNMP/hints/irix.pl	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/perl/SNMP/hints/irix.pl	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,2 @@
+# uses libelf for nlist on irix (>= 5.3?)
+$self->{LIBS} .= ' -lelf';
diff -Naur tomato/release/src/router/snmp/perl/SNMP/hints/solaris.pl tomato121/release/src/router/snmp/perl/SNMP/hints/solaris.pl
--- tomato/release/src/router/snmp/perl/SNMP/hints/solaris.pl	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/perl/SNMP/hints/solaris.pl	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,4 @@
+# uses kstat on solaris for get_uptime
+$self->{LIBS} .= ' -lkstat';
+# add -ldb if you are getting the vsnprintf not found error
+# $self->{LIBS} .= ' -lkstat -ldb';
diff -Naur tomato/release/src/router/snmp/perl/SNMP/Makefile.PL tomato121/release/src/router/snmp/perl/SNMP/Makefile.PL
--- tomato/release/src/router/snmp/perl/SNMP/Makefile.PL	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/perl/SNMP/Makefile.PL	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,272 @@
+use ExtUtils::MakeMaker;
+require 5;
+use Config;
+use Getopt::Long;
+my %MakeParams = ();
+
+# See lib/ExtUtils/MakeMaker.pm for details of how to influence
+# the contents of the Makefile that is written.
+
+%MakeParams = InitMakeParams();
+
+WriteMakefile(%MakeParams);
+
+GetTestInfo();
+
+sub InitMakeParams {
+    my $opts;
+    my %Params = (
+		  NAME         => 'SNMP',
+		  dist         => { SUFFIX => "gz", COMPRESS => "gzip -9f"},
+		  MAN3PODS => { 'SNMP.pm' => '$(INST_MAN3DIR)/SNMP.3' },
+		  XSPROTOARG   => '-noprototypes', 	# XXX remove later?
+		  VERSION_FROM => 'SNMP.pm',
+		  realclean        => { FILES => 'host' },
+		  );
+
+    my ($snmp_lib, $snmp_llib, $sep);
+    if ($Config{'osname'} eq 'MSWin32') {
+      $opts = NetSNMPGetOpts();	
+      $snmp_lib = 'libsnmp.lib';
+      $snmp_link_lib = 'libsnmp';
+      $sep = '\\';
+
+      $Params{'DEFINE'} = "-DMSVC_PERL";
+      
+      if ($opts->{'insource'}) {
+	$Params{'LIBS'} = "-L$basedir\\win32\\lib\\ -l$snmp_link_lib";
+      }
+      else {
+	my @LibDirs = split (';',$ENV{LIB});
+	if ($opts->{'prefix'}) {
+	  push (@LibDirs,"$ENV{'NET-SNMP-PATH'}${sep}lib");
+	}
+	$noLibDir = 1;
+	while ($noLibDir) {
+	  $LibDir = find_files(["$snmp_lib"],\@LibDirs);
+	  if ($LibDir ne '') {
+	    $noLibDir = 0;
+	  }
+	  else
+	  {
+	    @LibDirs = ();
+	    @LibDirs[0] = prompt("The Net-SNMP library ($snmp_lib) could not be found.\nPlease enter the directory where it is located:");
+	    @LibDirs[0] =~ s/\\$//;
+	  }
+	}
+	$Params{LIBS} = "-L$LibDir -l$snmp_link_lib";
+      }
+
+      $Params{'INC'} = "-I$basedir\\include\\ -I$basedir\\include\\net-snmp\\ -I$basedir\\win32\\ ";
+    }
+    else {
+	$opts = NetSNMPGetOpts();
+	if (!$ENV{'NETSNMP_LIBS'}) {
+	    $Params{'LIBS'}    = `$opts->{'nsconfig'} --libs`;
+	    chomp($Params{'LIBS'});
+	} else {
+	    $Params{'LIBS'} = $ENV{'NETSNMP_LIBS'};
+	}
+	if (!$ENV{'NETSNMP_CCFLAGS'}) {
+	    $Params{'CCFLAGS'} = `$opts->{'nsconfig'} --cflags`;
+	    chomp($Params{'CCFLAGS'});
+	    $Params{'CCFLAGS'} .= " " . $Config{'ccflags'};
+	} else {
+	    $Params{'CCFLAGS'} = $ENV{'NETSNMP_CCFLAGS'};
+	}
+	if ($opts->{'insource'} eq "true") {
+	    $Params{'LIBS'} = "-L../../snmplib/.libs -L../../snmplib/ " . $Params{'LIBS'};
+	    $Params{'CCFLAGS'} = "-I../../include " . $Params{'CCFLAGS'};
+#	} else {
+#	    $Params{'PREREQ_PM'} = { 'NetSNMP::default_store' => 0.01 };
+	}
+	$Params{'CCFLAGS'} =~ s/ -W[-\w]+//g; # ignore developer warnings
+	if (!$ENV{'NETSNMP_PREFIX'}) {
+	    $prefix            = `$opts->{'nsconfig'} --prefix`;
+	    chomp($prefix);
+	    $sep = '/';
+	} else {
+	    $prefix = $ENV{'NETSNMP_PREFIX'};
+	}
+	if ($Params{'LIBS'} eq "" || $Params{'CCFLAGS'} eq "") {
+	    die "You need to install net-snmp first (I can't find net-snmp-config)";
+	}
+    }
+
+    return(%Params);
+
+}
+
+sub find_files {
+    my($f,$d) = @_;
+    my ($dir,$found,$file);
+    for $dir (@$d){
+	$found = 0;
+	for $file (@$f) {
+	    $found++ if -f "$dir/$file";
+	}
+	if ($found == @$f) {
+	    return $dir;
+	}
+    }
+}
+
+sub GetTestInfo {
+    my $sep = ($^O =~ /win32/i ? '\\' : '/');
+    my $info_file = "t${sep}snmptest.cmd";
+    my $snmpd_path1 = "${prefix}${sep}sbin";
+    my $snmpd_path2 = "${sep}usr${sep}sbin";
+    my $snmpd_path3 = "${sep}usr${sep}bin";
+    open(H, ">$info_file") || die "Error: could not open file '$info_file'($!)";
+    if($^O =~ /win32/i) {
+#you are using WIN 32
+	my $mibdir = "${prefix}${sep}share${sep}snmp${sep}mibs";
+	print <<WIN32
+==================================================================
+You are using Windows 32. The testing of Perl/SNMP API here would
+require you to start an snmpd agent and a trap receiver using the
+config file provided ( t\\snmptest.conf) manually.The
+test scripts will not do this(as in unix testing). So, please
+run those agents and enter the following information.If the data
+about host, agent_port and trap_port are already present in your
+snmptest.cmd file, make test will use those data for testing.
+=================================================================
+WIN32
+;
+
+	$host = prompt("Please enter the host IP address/host name: ", "localhost");
+	print H "HOST => $host\n";
+	$agent_port = prompt("Please enter the agent port number: ", 161);
+	print H "AGENT_PORT => $agent_port\n";
+	$trap_port = prompt("Please enter the trap port number: ", 162);
+	print H "TRAP_PORT => $trap_port\n";
+	$mibdir = prompt("Please enter the MIB directory: ", "/usr/mibs");
+	print H "MIBDIR => $mibdir\n";
+    } else {
+# you are using UNIX
+	my ($mibdir, $snmpd, $snmptrapd);
+	if ($opts->{'insource'} eq "true") {
+	    $mibdir = "../../mibs";
+	    $snmpd = "../../agent/snmpd";
+	    $snmptrapd = "../../apps/snmptrapd";
+	} else {
+	    $mibdir = "${prefix}${sep}share${sep}snmp${sep}mibs";
+	    $snmpd = find_files(["snmpd"], [$snmpd_path1, $snmpd_path2]);
+	    $snmptrapd = find_files(["snmptrapd"], [$snmpd_path1, $snmpd_path2]);
+	}
+	$mibdir = find_files(["NET-SNMP-MIB.txt"],[$mibdir]);
+
+	$mibdir ||= prompt("Unable to locate the MIBs, Please enter the path: ",
+			   $mibdir);
+	$snmpd ||= prompt("Unable to locate \"snmpd\". Please enter the path: ",
+			  $snmpd_path1);
+	$snmptrapd ||=
+	    prompt("Unable to locate \"snmptrapd\". Please enter the path: ",
+		   $snmpd_path1);
+
+        $snmpd =~ s/($sep)?(snmpd)?$/${sep}snmpd/;
+        $snmptrapd =~ s/($sep)?(snmptrapd)?$/${sep}snmptrapd/;
+
+	print H "SNMPD => $snmpd\n";
+	print H "SNMPTRAPD => $snmptrapd\n";
+	print H "MIBDIR => $mibdir\n";
+
+	if (!$opts->{'insource'}) {
+	    if (-e $snmpd and -r $snmpd) {
+		if (not -x $snmpd) {
+		    warn("Error: $snmpd not executable. 'make test' will not work.\n");
+		}
+	    } else {
+		warn("Error: $snmpd does not exist or is unreadable. 'make test' will not work.\n");
+	    }
+
+	    if (-e $snmptrapd and -r $snmptrapd) {
+		if (not -x $snmptrapd) {
+		    warn("Error: $snmptrapd not executable. 'make test' will not work.\n");
+		}
+	    } else {
+		warn("Error: $snmptrapd does not exist or is unreadable. 'make test' will not work.\n");
+	    }
+	}
+    }
+# end of else
+    close H;
+}
+
+sub HasSSL {
+    my $config_header = shift;
+    my $has_ssl;
+    unless (open(C,"<$config_header")) {
+	warn("Unable to open $config_header, assuming no SSL\n");
+	return undef;
+    }
+    while (<C>) {
+	$has_ssl++, last if /^\s*#define\s+USE_OPENSSL/;
+    }
+    close C;
+    return $has_ssl;
+}
+# common subroutines -- DO NOT EDIT.
+# They are imported from the Makefile.subs.pl file
+sub NetSNMPGetOpts {
+    my %ret;
+    my $rootpath = shift;
+    $rootpath = "../" if (!$rootpath);
+    $rootpath .= '/' if ($rootpath !~ /\/$/);
+    
+    if ($Config{'osname'} eq 'MSWin32') {
+      if ($ENV{'NET-SNMP-IN-SOURCE'})
+      {
+	$ret{'insource'} = $ENV{'NET-SNMP-IN-SOURCE'};
+      }
+      elsif ($ENV{'NET-SNMP-PATH'})
+      {
+	$ret{'prefix'} = $ENV{'NET-SNMP-PATH'};
+      }
+      else
+      {
+	# don't have env vars, pull from command line and put there
+	GetOptions("NET-SNMP-IN-SOURCE=s" => \$ret{'insource'},
+	           "NET-SNMP-PATH=s"      => \$ret{'prefix'});
+
+	$ENV{'NET-SNMP-IN-SOURCE'}    = $ret{'insource'};
+	$ENV{'NET-SNMP-PATH'}         = $ret{'prefix'};
+      }
+
+      $basedir = `%COMSPEC% /c cd`;
+      chomp $basedir;
+      $basedir =~ /(.*?)\\perl.*/;
+      $basedir = $1;
+      print "Net-SNMP base directory: $basedir\n";
+
+    }
+    else
+    {
+      if ($ENV{'NET-SNMP-CONFIG'} && 
+        $ENV{'NET-SNMP-IN-SOURCE'}) {
+	# have env vars, pull from there
+	$ret{'nsconfig'} = $ENV{'NET-SNMP-CONFIG'};
+	$ret{'insource'} = $ENV{'NET-SNMP-IN-SOURCE'};
+      } else {
+	# don't have env vars, pull from command line and put there
+	GetOptions("NET-SNMP-CONFIG=s" => \$ret{'nsconfig'},
+	           "NET-SNMP-IN-SOURCE=s" => \$ret{'insource'});
+
+	if ($ret{'insource'} eq "true" && $ret{'nsconfig'} eq "") {
+	    $ret{'nsconfig'}="sh ROOTPATH../net-snmp-config";
+	} elsif ($ret{'nsconfig'} eq "") {
+	    $ret{'nsconfig'}="net-snmp-config";
+	}
+
+	$ENV{'NET-SNMP-CONFIG'}    = $ret{'nsconfig'};
+	$ENV{'NET-SNMP-IN-SOURCE'} = $ret{'insource'};
+      }
+    }	
+    
+    $ret{'nsconfig'} =~ s/ROOTPATH/$rootpath/;
+
+    $ret{'rootpath'} = $rootpath;
+
+    \%ret;
+}
+
diff -Naur tomato/release/src/router/snmp/perl/SNMP/MANIFEST tomato121/release/src/router/snmp/perl/SNMP/MANIFEST
--- tomato/release/src/router/snmp/perl/SNMP/MANIFEST	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/perl/SNMP/MANIFEST	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,36 @@
+BUG
+MANIFEST
+MANIFEST.SKIP
+Makefile.PL
+README
+SNMP.pm
+SNMP.xs
+TODO
+perlsnmp.h
+typemap
+hints/solaris.pl
+hints/irix.pl
+t/README
+t/session.t
+t/bulkwalk.t
+t/mib.t
+t/get.t
+t/getnext.t
+t/set.t
+t/async.t
+t/mib.txt
+t/notify.t
+t/mibload.t
+t/snmptest.conf
+t/startagent.pl
+examples/async1.pl
+examples/async2.pl
+examples/bulkwalk.pl
+examples/ipforward.pl
+examples/mibtree.pl
+examples/mibwalk.pl
+examples/pingmib.pl
+examples/tablewalk.pl
+examples/testleak.pl
+examples/trap-example.pl
+
diff -Naur tomato/release/src/router/snmp/perl/SNMP/MANIFEST.SKIP tomato121/release/src/router/snmp/perl/SNMP/MANIFEST.SKIP
--- tomato/release/src/router/snmp/perl/SNMP/MANIFEST.SKIP	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/perl/SNMP/MANIFEST.SKIP	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,11 @@
+\.bak$
+\.o$
+~$
+^Makefile$
+^Makefile.old$
+\.bs$
+\.bso$
+\.c
+\.em
+^include
+^host$
diff -Naur tomato/release/src/router/snmp/perl/SNMP/perlsnmp.h tomato121/release/src/router/snmp/perl/SNMP/perlsnmp.h
--- tomato/release/src/router/snmp/perl/SNMP/perlsnmp.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/perl/SNMP/perlsnmp.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,24 @@
+#ifndef timeradd
+#define	timeradd(a, b, result)						      \
+  do {									      \
+    (result)->tv_sec = (a)->tv_sec + (b)->tv_sec;			      \
+    (result)->tv_usec = (a)->tv_usec + (b)->tv_usec;			      \
+    if ((result)->tv_usec >= 1000000)					      \
+      {									      \
+	++(result)->tv_sec;						      \
+	(result)->tv_usec -= 1000000;					      \
+      }									      \
+  } while (0)
+#endif
+
+#ifndef timersub
+#define	timersub(a, b, result)						      \
+  do {									      \
+    (result)->tv_sec = (a)->tv_sec - (b)->tv_sec;			      \
+    (result)->tv_usec = (a)->tv_usec - (b)->tv_usec;			      \
+    if ((result)->tv_usec < 0) {					      \
+      --(result)->tv_sec;						      \
+      (result)->tv_usec += 1000000;					      \
+    }									      \
+  } while (0)
+#endif
diff -Naur tomato/release/src/router/snmp/perl/SNMP/README tomato121/release/src/router/snmp/perl/SNMP/README
--- tomato/release/src/router/snmp/perl/SNMP/README	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/perl/SNMP/README	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,808 @@
+	      The Perl5 'SNMP' Extension Module v5.0
+		      for the Net-SNMP Library
+
+Contents:
+   Introduction:
+   Availability:
+   Contact:
+   Supported Platforms:
+   Release Notes:
+   Installation:
+   Operational Description:
+   Trouble Shooting:
+   Acknowledgments:
+   History:
+   Copyright:
+
+Introduction:
+
+******************************NOTE NOTE NOTE**************************
+  This module now relies on many other modules.  Do not try to build
+  it independently, as it won't work.  Instead of running "perl
+  Makefile.PL" in this directory, run it in the net-snmp/perl
+  directory instead which has a global makefile used to build all the
+  sub-modules in their proper order.
+******************************NOTE NOTE NOTE**************************
+
+Note: The perl SNMP 5.0module which comes with net-snmp 5.0 and
+higher is different than previous versions in a number of ways.  Most
+importantly, it behaves like a proper net-snmp application and calls
+init_snmp properly, which means it will read configuration files and
+use those defaults where appropriate automatically parse MIB files,
+etc.  This will likely affect your perl applications if you have, for
+instance, default values set up in your snmp.conf file (as the perl
+module will now make use of those defaults).  The docmuentation,
+however, has sadly not been updated yet (aside from this note).
+
+This is the Perl5 'SNMP' extension module. The SNMP module provides a
+full featured, tri-lingual SNMP (SNMPv3, SNMPv2c, SNMPv1) API. The
+SNMP module also provides an interface to the SMI MIB parse-tree for
+run-time access to parsed MIB data.  The SNMP module internals rely on
+the Net-SNMP toolkit library (previously known as ucd-snmp). For
+information on the Net-SNMP library see the documentation provided
+with the Net-SNMP distribution or the project web page available on
+'Source Forge':
+
+http://sourceforge.net/projects/net-snmp
+
+Availability:
+
+The most recent release of the Perl5 SNMP module can be found bundled
+with the latest Net-SNMP distibution available from:
+http://sourceforge.net/projects/net-snmp
+
+(Note: The perl SNMP distribution obtained this way has the highest
+chance of being up to date and compatible with the Net-SNMP version
+with which it is bundled.)
+
+A seperately bundled package of the SNMP module can be obtained from CPAN.
+
+Development and older releases may be found at the following FTP site:
+ftp://ftp-east.baynetworks.com/netman/snmp/perl5
+
+(Note: In previous releases this module was compatible with the CMU
+SNMP library. Starting with Perl5/SNMP-1.7 this module will *only*
+work with the Net-SNMP (aka ucd-snmp) library due to dependence on new
+features)
+
+Contact:
+	the following forums may be helpful:
+
+	comp.lang.perl.modules
+	net-snmp-users@lists.sourceforge.net mail list
+	(see http://www.net-snmp.org/lists/users/ to subscribe)
+
+Supported Platforms:
+	Linux 1.2.x, 2.x
+	Solaris 2.x
+	Many other UNIX variants
+	Win9x/NT
+
+Release Notes:
+
+SNMP module version 5.0 is being developed against NET-SNMP-5.0
+see http://sourceforge.net/projects/net-snmp for details.
+
+Compatibility with earlier or later versions of Net-SNMP or UCD-SNMP
+is not guaranteed due to the dynamic nature of open software
+development :).
+
+KNOWN BUGS:
+
+(none?)
+
+Installation:
+
+Build and install the Net-SNMP package - see Net-SNMP README and
+INSTALL docs.
+
+(Note: To ensure that any previous Net-SNMP, ucd-snmp or cmu snmp
+installation's library or headers are not used by mistake, use the
+-NET-SNMP-CONFIG directive to explicitly set the path to the
+net-snmp-config command that knows about the net-snmp installation you
+want to use.)
+
+NOTE: build all the perl modules at once using the Makefile.PL in the
+net-snmp/perl directory rather than the one in this directory.
+
+Unix:
+
+cd net-snmp/perl
+perl Makefile.PL [-NET-SNMP-CONFIG="sh ../../net-snmp-config"] [-NET-SNMP-IN-SOURCE=true]
+make
+make test
+make install
+
+Win32 (MSVC):
+
+This package only builds on NT / 2000 as far as I know. These directions are
+for VC++ 5.0-6.0 with ActiveState Perl.  See below for Cygwin.
+
+Install the regex win32 package (gnu_regex.exe).  It is available from
+http://people.delphiforums.com/gjc/gnu_regex.html
+
+Run vcvars32.bat.
+
+cd net-snmp\perl
+perl Makefile.PL CAPI=TRUE -NET-SNMP-IN-SOURCE=TRUE
+nmake
+nmake test
+nmake install
+
+Note:  The --NET-SNMP-IN-SOURCE=TRUE causes the Makefile to use the library files
+from the net-snmp source directory.  To specify the installed Net-SNMP directory,
+use:
+
+perl Makefile.PL CAPI=TRUE -NET-SNMP-PATH=c:\usr
+
+OpenSSL note: see the net-snmp/README.win32 to compile libsnmp with
+              libeay32 and see that libeay.lib is in usr\lib
+
+for the older perl5.004_02 distribution by gsarathy
+
+cd net-snmp\perl
+perl Makefile.PL
+nmake
+nmake test
+nmake install
+
+
+Win32 Testing Note:
+
+'nmake test' requires that an agent(snmpd) and trap receiver (snmptrapd)
+are running. Before running 'nmake test' start these servers using the
+config file provided (t/snmpd.conf). You will be asked for the test host
+and port numbers by Makefile.PL
+
+
+Win32 (Cygwin):
+
+cd net-snmp\perl
+perl Makefile.PL -NET-SNMP-IN-SOURCE=true
+make
+make test
+make install
+
+If you get an error saying your system can't compile, you are probably missing
+the regex library.  Install regex from 
+http://mirrors.sunsite.dk/cygwin/release/regex/regex-4.4-2-src.tar.bz2
+
+
+Operational Description:
+
+The basic operations of the SNMP protocol are provided by this module
+through an object oriented interface for modularity and ease of use.
+The primary class is SNMP::Session which encapsulates the persistent
+aspects of a connection between the management application and the
+managed agent. Internally the class is implemented as a blessed hash
+reference. This class supplies 'get', 'getnext', 'set', 'fget', and
+'fgetnext' and other method calls. The methods take a variety of input
+argument formats and support both synchronous and asynchronous
+operation through a polymorphic API (i.e., method behaviour varies
+dependent on args passed - see below).
+
+A description of the fields which can be specified when an
+SNMP::Session object is created follows:
+
+SNMP::Session
+public:
+ DestHost    - default 'localhost', hostname or ip addr of SNMP agent
+ Community   - default 'public', SNMP community string (used for both R/W)
+ Version     - default '1', [2 (same as 2c), 2c, 3]
+ RemotePort  - default '161', allow remote UDP port to be overridden
+ Timeout     - default '1000000', micro-seconds before retry
+ Retries     - default '5', retries before failure
+ RetryNoSuch - default '0', if enabled NOSUCH errors in 'get' pdus will
+               be repaired, removing the varbind in error, and resent -
+               undef will be returned for all NOSUCH varbinds, when set
+               to '0' this feature is disabled and the entire get request
+               will fail on any NOSUCH error (applies to v1 only)
+ SecName     - default 'initial', security name (v3)
+ SecLevel    - default 'noAuthNoPriv', security level [noAuthNoPriv,
+               authNoPriv, authPriv] (v3)
+ SecEngineId - default <none>, security engineID, will be probed if not
+               supplied (v3)
+ ContextEngineId - default <SecEngineId>, context engineID, will be
+                   probed if not supplied (v3)
+ Context     - default '', context name (v3)
+ AuthProto   - default 'MD5', authentication protocol [MD5, SHA] (v3)
+ AuthPass    - default <none>, authentication passphrase
+ PrivProto   - default 'DES', privacy protocol [DES] (v3)
+ PrivPass    - default <none>, privacy passphrase (v3)
+ VarFormats  - default 'undef', used by 'fget[next]', holds an hash
+               reference of output value formatters, (e.g., {<obj> =>
+               <sub-ref>, ... }, <obj> must match the <obj> and format
+               used in the get operation. A special <obj>, '*', may be
+               used to apply all <obj>s, the supplied sub is called to
+               translate the value to a new format. The sub is called
+               passing the Varbind as the arg
+ TypeFormats - default 'undef', used by 'fget[next]', holds an hash
+               reference of output value formatters, (e.g., {<type> =>
+               <sub-ref>, ... }, the supplied sub is called to translate
+               the value to a new format, unless a VarFormat mathces first
+               (e.g., $session->{TypeFormats}{INTEGER} = \&mapEnum();
+                although this can be done more efficiently by enabling
+                $SNMP::use_enums or session creation param 'UseEnums')
+ UseLongNames - defaults to the value of SNMP::use_long_names at time
+               of session creation. set to non-zero to have <tags>
+               for 'getnext' methods generated preferring longer Mib name
+               convention (e.g., system.sysDescr vs just sysDescr)
+ UseSprintValue - defaults to the value of SNMP::use_sprint_value at time
+               of session creation. set to non-zero to have return values
+               for 'get' and 'getnext' methods formatted with the libraries
+               sprint_value function. This will result in certain data types
+               being returned in non-canonical format Note: values returned
+               with this option set may not be appropriate for 'set' operations
+               (see discussion of value formats in <vars> description section)
+ UseEnums    - defaults to the value of SNMP::use_enums at time of session
+               creation. set to non-zero to have integer return values
+               converted to enumeration identifiers if possible, these values
+               will also be acceptable when supplied to 'set' operations
+ UseNumeric  - defaults to the value of SNMP::use_numeric at time of session
+               creation. set to non-zero to have <tags> returned by the 'get'
+               methods untranslated (i.e. dotted-decimal).  Setting the
+               UseLongNames value for the session is highly recommended.
+ ErrorStr    - read-only, holds the error message assoc. w/ last request
+ ErrorNum    - read-only, holds the snmp_err or status of last request
+ ErrorInd    - read-only, holds the snmp_err_index when appropriate
+
+private:
+ DestAddr    - internal field used to hold the translated DestHost field
+ SessPtr     - internal field used to cache a created session structure
+
+methods:
+ new(<fields>)   - Constructs a new SNMP::Session object. The fields are
+                   passed to the constructor as a hash list
+                   (e.g., $session = new SNMP::Session(DestHost => 'foo',
+                   Community => 'private');), returns an object reference
+                   or undef in case of error.
+ update(<fields>)- Updates the SNMP::Session object with the values fields
+                   passed in as a hash list (similar to new(<fields>))
+                   (WARNING! not fully implemented)
+ get(<vars>[,<callback>])
+                 - do SNMP GET, multiple <vars> formats accepted.
+                   for synchronous operation <vars> will be updated
+                   with value(s) and type(s) and will also return
+                   retrieved value(s). If <callback> supplied method
+                   will operate asynchronously
+ fget(<vars>[,<callback>])
+                 - do SNMP GET like 'get' and format the values according
+                   the handlers specified in $sess->{VarFormats} and
+                   $sess->{TypeFormats}. Async *not supported*
+ getnext(<vars>[,<callback>])
+                 - do SNMP GETNEXT, multiple <vars> formats accepted,
+                   returns retrieved value(s), <vars> passed as arguments are
+                   updated to indicate next lexicographical <obj>,<iid>,<val>,
+                   and <type> Note: simple string <vars>,(e.g., 'sysDescr.0')
+                   form is not updated. If <callback> supplied method
+                   will operate asynchronously
+ fgetnext(<vars>[,<callback>])
+                 - do SNMP GETNEXT like getnext and format the values according
+                   the handlers specified in $sess->{VarFormats} and
+                   $sess->{TypeFormats}. Async *not supported*
+ set(<vars>[,<callback>])
+                 - do SNMP SET, multiple <vars> formats accepted.
+                   the value field in all <vars> formats must be in a canonical
+                   format (i.e., well known format) to ensure unambiguous
+                   translation to SNMP MIB data value (see discussion of
+                   canonical value format <vars> description section),
+                   returns true on success or undef on error. If <callback>
+                   supplied method will operate asynchronously
+ getbulk(<non-repeaters>, <max-repeaters>, <vars> [, <callback>])
+                 - do an SNMP GETBULK, from the list of Varbinds, the single
+                   next lexico instance is fetched for the first n Varbinds
+                   as defined by <non-repeaters>. For remaining Varbinds,
+                   the m lexico instances are retrieved each of the remaining
+                   Varbinds, where m is <max-repeaters>.
+ bulkwalk(<non-repeaters>, <max-repeaters>, <vars> [, <callback>])
+                 - do an "SNMP bulkwalk" on the given variables.  Bulkwalk is
+                   implemented by sending an SNMP GETBULK request to fetch the
+                   variables.  Objects are copied to the return list until the
+                   sub-tree is exited.  If the request is not completed at the
+                   end of a packet, a new request is created, starting where
+                   the previous packet left off.  This implementation is able
+                   to handle multiple repeated vars, as well as non-repeaters.
+                   Returns a list (or, in scalar context, a reference to a
+                   list) of arrays of VarBinds.  The VarBinds consist of the
+                   responses for each requested variable.  bulkwalk() leaves
+                   the original Varbinds list intact to facilitate querying
+                   of multiple devices.
+
+SNMP::TrapSession - supports all applicable fields from SNMP::Session
+                    (see above)
+methods:
+ new(<fields>)   - Constructs a new SNMP::TrapSession object. The fields are
+                   passed to the constructor as a hash list
+                   (e.g., $trapsess = new SNMP::Session(DestHost => 'foo',
+                   Community => 'private');), returns an object reference
+                   or undef in case of error.
+ trap(enterprise, agent, generic, specific, uptime, <vars>)
+    $sess->trap(enterprise=>'.1.3.6.1.4.1.2021', # or 'ucdavis' [default]
+                agent => '127.0.0.1', # or 'localhost',[dflt 1st intf on host]
+                generic => specific,  # can be omitted if 'specific' supplied
+                specific => 5,        # can be omitted if 'generic' supplied
+                uptime => 1234,       # dflt to localhost uptime (0 on win32)
+                [[ifIndex, 1, 1],[sysLocation, 0, "here"]]); # optional vars
+                                                             # always last
+ or v2 format
+ trap(oid, uptime, <vars>)
+    $sess->trap(oid => 'snmpRisingAlarm',
+                uptime => 1234,
+                [[ifIndex, 1, 1],[sysLocation, 0, "here"]]); # optional vars
+                                                             # always last
+
+
+Acceptable variable formats:
+<vars> may be one of the following forms:
+
+ SNMP::VarList:  - represents an array of MIB objects to get or set,
+                   implemented as a blessed reference to an array of
+                   SNMP::Varbinds, (e.g., [<varbind1>, <varbind2>, ...])
+
+ SNMP::Varbind:  - represents a single MIB object to get or set, implemented as
+                   a blessed reference to a 4 element array;
+                   [<obj>, <iid>, <val>, <type>].
+                   <obj>  - one of the following forms:
+                          1) leaf identifier (e.g., 'sysDescr') assumed to be
+                             unique for practical purposes
+                          2) fully qualified identifier (e.g.,
+			     '.iso.org.dod.internet.mgmt.mib-2.system.sysDescr')
+                          3) fully qualified, dotted-decimal, numeric OID (e.g.,
+                             '.1.3.6.1.2.1.1.1')
+                   <iid>  - the dotted-decimal, instance identifier. for
+                            scalar MIB objects use '0'
+		   <val>  - the SNMP data value retrieved from or being set
+                            to the agents MIB. for (f)get(next) operations
+                            <val> may have a variety of formats as determined by
+                            session and package settings. However for set
+                            operations the <val> format must be canonical to
+                            ensure unambiguous translation. The canonical forms
+                            are as follows:
+	                    OBJECTID => dotted-decimal (e.g., .1.3.6.1.2.1.1.1)
+			    OCTETSTR => perl scalar containing octets,
+		            INTEGER => decimal signed integer (or enum),
+			    NETADDR => dotted-decimal,
+			    IPADDR => dotted-decimal,
+			    COUNTER => decimal unsigned integer,
+			    COUNTER64  => decimal unsigned integer,
+			    GAUGE,  => decimal unsigned integer,
+			    UINTEGER,  => decimal unsigned integer,
+                            TICKS,  => decimal unsigned integer,
+                            OPAQUE => perl scalar containing octets,
+       			    NULL,  => perl scalar containing nothing,
+
+
+                   <type> - SNMP data type (see list above), this field is
+                            populated by 'get' and 'getnext' operations. In
+                            some cases the programmer needs to populate this
+                            field when passing to a 'set' operation. this
+                            field need not be supplied when the attribute
+                            indicated by <tag> is already described by loaded
+                            Mib modules. for 'set's, if a numeric OID is used
+                            and the object is not currently in the loaded Mib,
+                            the <type> field must be supplied
+
+ simple string   - light weight form of <var> used to 'set' or 'get' a
+                   single attribute without constructing an SNMP::Varbind.
+                   stored in a perl scalar, has the form '<tag>.<iid>',
+                   (e.g., 'sysDescr.0'). for 'set' operations the value
+                   is passed as a second arg. Note: This argument form is
+                   not updated in get[next] operations as are the other forms.
+
+Acceptable callback formats:
+<callback> may be one of the following forms:
+
+ without arguments:
+    \&subname
+    sub { ... }
+ or with arguments:
+    [ \&subname, $arg1, ... ]
+    [ sub { ... }, $arg1, ... ]
+    [ "method", $obj, $arg1, ... ]
+
+callback will be called when response is received or timeout
+occurs. the last argument passed to callback will be a
+SNMP::VarList reference. In case of timeout the last argument
+will be undef.
+
+SNMP package variables and functions:
+
+ $SNMP::VERSION       - the current version specifier (e.g., 3.1.0)
+
+ $SNMP::auto_init_mib - default '1', set to 0 to disable automatic reading
+                        of the MIB upon session creation. set to non-zero
+                        to call initMib at session creation which will result
+                        in MIB loading according to Net-SNMP env. variables
+			(see man mib_api)
+
+ $SNMP::verbose       - default '0', controls warning/info output of
+                        SNMP module, 0 => no output, 1 => enables warning/info
+                        output from SNMP module itself (is also controlled
+                        by SNMP::debugging - see below)
+
+ $SNMP::use_long_names - default '0', set to non-zero to enable the use of
+                        longer Mib identifiers. see translateObj. will also
+                        influence the formatting of <tag> in varbinds returned
+                        from 'getnext' operations. Can be set on a per session
+                        basis (UseLongNames)
+
+ $SNMP::use_sprint_value - default '0', set to non-zero to enable formatting of
+                        response values using the snmp libraries sprint_value
+                        function. can also be set on a per session basis (see
+                        UseSprintValue) Note: returned values may not be
+                        suitable for 'set' operations
+
+ $SNMP::use_enums     - default '0',set non-zero to return values as enums and
+                        allow sets using enums where appropriate. integer data
+                        will still be accepted for set operations. can also be
+                        set on a per session basis (see UseEnums)
+
+ $SNMP::use_numeric   - default '0', set to non-zero to return tags as numeric
+                        OID's, instead of translating them.  Also setting
+                        $SNMP::use_long_names to non-zero is highly recommended.
+
+ $SNMP::save_descriptions - default '0',set non-zero to have mib parser save
+                        attribute descriptions. must be set prior to mib
+                        initialization
+
+ $SNMP::debugging     - default '0', controls debugging output level
+                        within SNMP module and libsnmp
+                        1 => enables 'SNMP::verbose' (see above)
+                        2 => level 1 plus snmp_set_do_debugging(1),
+                        3 => level 2 plus snmp_set_dump_packet(1)
+
+ $SNMP::dump_packet   - default '0', set [non-]zero to independently set
+                        snmp_set_dump_packet()
+
+ %SNMP::MIB           - a tied hash to access parsed MIB information. After
+                        the MIB has been loaded this hash allows access to
+                        to the parsed in MIB meta-data(the structure of the
+                        MIB (i.e., schema)). The hash returns blessed
+                        references to SNMP::MIB::NODE objects which represent
+                        a single MIB attribute. The nodes can be fetched with
+                        multiple 'key' formats - the leaf name (e.g.,sysDescr)
+                        or fully/partially qualified name (e.g.,
+                        system.sysDescr) or fully qualified numeric OID. The
+                        returned node object supports the following fields:
+
+        objectID      - dotted decimal fully qualified OID
+        label         - leaf textual identifier (e.g., 'sysDescr')
+        subID         - leaf numeric OID component of objectID (e.g., '1')
+        moduleID      - textual identifier for module (e.g., 'RFC1213-MIB')
+        parent        - parent node
+        children      - array reference of children nodes
+        nextNode      - next lexico node (BUG!does not return in lexico order)
+        type          - returns application type (see getType for values)
+        access        - returns ACCESS (ReadOnly, ReadWrite, WriteOnly,
+                        NoAccess, Notify, Create)
+        status        - returns STATUS (Mandatory, Optional, Obsolete,
+                        Deprecated, Current)
+        syntax        - returns 'textualConvention' if defined else 'type'
+        textualConvention - returns TEXTUAL-CONVENTION
+        units         - returns UNITS
+        hint          - returns HINT
+        enums         - returns hash ref {tag => num, ...}
+        ranges        - returns array ref of hash ref [{low=>num, high=>num}]
+        defaultValue  - returns default value
+        description   - returns DESCRIPTION ($SNMP::save_descriptions must
+                        be set prior to MIB initialization/parsing)
+
+
+ &SNMP::setMib(<file>) - allows dynamic parsing of the mib and explicit
+                         specification of mib file independent of environment
+                         variables. called with no args acts like initMib,
+                         loading MIBs indicated by environment variables (see
+                         Net-SNMP mib_api docs). passing non-zero second arg
+                         forces previous mib to be freed and replaced
+                         (Note: second arg not working since freeing previous
+                          Mib is more involved than before).
+
+ &SNMP::initMib()     - calls library init_mib function if Mib not already
+                        loaded - does nothing if Mib already loaded. will
+                        parse directories and load modules according to
+                        environment variables described in Net-SNMP
+                        documentations.
+                        (see man mib_api, MIBDIRS, MIBS, MIBFILE(S), etc.)
+
+ &SNMP::addMibDirs(<dir>,...) - calls library add_mibdir for each directory
+                        supplied. will cause directory(s) to be added to
+                        internal list and made available for searching in
+                        subsequent loadModules calls
+
+ &SNMP::addMibFiles(<file>,...) - calls library read_mib function. The file(s)
+                       supplied will be read and all Mib module definitions
+                       contained therein will be added to internal mib tree
+                       structure
+
+ &SNMP::loadModules(<mod>,...) - calls library read_module function. The
+                       module(s) supplied will be searched for in the
+                       current mibdirs and and added to internal mib tree
+                       structure. Passing special <mod>, 'ALL', will cause
+                       all known modules to be loaded.
+
+ &SNMP::unloadModules(<mod>,...) - *Not Implemented*
+
+ &SNMP::translateObj(<var>[,arg]) - will convert a text obj tag to an OID and
+                            vice-versa. any iid suffix is retained numerically.
+                            default behaviour when converting a numeric OID
+                            to text form is to return leaf identifier only
+                            (e.g.,'sysDescr') but when $SNMP::use_long_names
+                            is non-zero or a non-zero second arg is supplied
+                            will return longer textual identifier. If no Mib
+                            is loaded when called and $SNMP::auto_init_mib is
+                            enabled then the Mib will be loaded. Will return
+                            'undef' upon failure.
+
+ &SNMP::getType(<var>) - return SNMP data type for given textual identifier
+                        OBJECTID, OCTETSTR, INTEGER, NETADDR, IPADDR, COUNTER
+                        GAUGE, TIMETICKS, OPAQUE, or undef
+
+ &SNMP::mapEnum(<var>) - converts integer value to enumeration tag defined
+                         in Mib or converts tag to integer depending on
+                         input. the function will return the corresponding
+                         integer value *or* tag for a given MIB attribute
+                         and value. The function will sense which direction
+                         to perform the conversion. Various arg formats are
+                         supported
+                         $val = SNMP::mapEnum($varbind);
+                         # where $varbind is SNMP::Varbind or equiv
+                         # note: $varbind will be updated
+                         $val = SNMP::mapEnum('ipForwarding', 'forwarding');
+                         $val = SNMP::mapEnum('ipForwarding', 1);
+
+ &SNMP::MainLoop([<timeout>, [<callback>]])
+                   - to be used with async SNMP::Session
+                     calls. MainLoop must be called after initial async calls
+                     so return packets from the agent will not be processed.
+                     If no args supplied this function enters an infinite loop
+                     so program must be exited in a callback or externally
+                     interrupted. If <timeout
+
+ &SNMP::finish()
+		   - This function, when called from an SNMP::MainLoop()
+		     callback function, will cause the current SNMP::MainLoop
+		     to return after the callback is completed. finish() can
+		     be used to terminate an otherwise-infinite MainLoop. A
+		     new MainLoop() instance can then be started to handle
+		     further requests.
+
+Exported SNMP utility functions
+&snmp_get() - takes args of SNMP::Session::new followed by those of
+              SNMP::Session::get
+
+&snmp_getnext() - takes args of SNMP::Session::new followed by those of
+                  SNMP::Session::getnext
+
+&snmp_set() - takes args of SNMP::Session::new followed by those of
+              SNMP::Session::set
+
+&snmp_trap() - takes args of SNMP::TrapSession::new followed by those of
+               SNMP::TrapSession::trap
+
+Note: utility functions do not support async operation yet.
+
+Trouble Shooting:
+
+If problems occur there are number areas to look at to narrow down the
+possibilities.
+
+The first step should be to test the Net-SNMP installation
+independently from the Perl5 SNMP interface.
+
+Try running the apps from the Net-SNMP distribution.
+
+Make sure your agent (snmpd) is running and properly configured with
+read-write access for the community you are using.
+
+Ensure that your MIBs are installed and environment variables are set
+appropriately (see man mib_api)
+
+Be sure to ensure headers and libraries from old CMU installations are
+not being used by mistake (see -NET-SNMP-PATH).
+
+If the problem occurs during compilation/linking check that the snmp
+library being linked is actually the Net-SNMP library (there have been
+name conflicts with existing snmp libs).
+
+Also check that the header files are correct and up to date.
+
+Sometimes compiling the Net-SNMP library with
+'position-independent-code' enabled is required (HPUX specifically).
+
+If you cannot resolve the problem you can post to
+comp.lang.perl.modules or email net-snmp-users@lists.sourceforge.net.
+
+please give sufficient information to analyze the problem (OS type,
+versions for OS/Perl/net-SNMP/compiler, complete error output, etc.)
+
+Acknowledgments:
+
+Many thanks to all those who supplied patches, suggestions and
+feedback.
+
+Wes Hardaker and the net-snmp-coders
+Dave Perkins
+Marcel Wiget
+David Blackburn
+John Stofell
+Gary Hayward
+Claire Harrison
+Achim Bohnet
+Doug Kingston
+Jacques Vidrine
+Carl Jacobsen
+Wayne Marquette
+Scott Schumate
+Michael Slifcak
+Srivathsan Srinivasagopalan
+Bill Fenner
+Jef Peeraer
+Daniel Hagerty
+Karl "Rat" Schilke and Electric Lightwave, Inc.
+Perl5 Porters
+
+Apologies to any/all who's patch/feature/request was not mentioned or
+included - most likely it was lost when paying work intruded on my
+fun. Please try again if you do not see a desired feature. This may
+actually turn out to be a decent package with such excellent help and
+the fact that I have more time to work on it than in the past.
+
+------
+History:
+
+Bugs fixed and changes in 3.1.0
+1) update to ucd-snmp-4.1.0
+
+2) support much of SNMPv3
+
+3) add support for getbulk - Thanks Daniel
+
+4) further regularize error return codes - will return undef on error
+for most cases except where values are expected from a varbind (will
+themselves be undef)
+
+5) fix bug where session deletion inadvertently occurred with async calls
+if calling Session went out of scope - a reference is saved which will
+not destruct until after async callback completes
+
+6) pass protocol errors to callbacks
+
+7) added lower level async API so SNMP events can be integrated with
+arbitrary event loop (Event.pm?) - thanks Jef
+
+8) Major enhancement to 'make test' - thanks Sri
+
+9) POD documentation - thanks Bill
+
+10) fix OBJECTID translations (unsigned long)
+
+11) display Mib info on 'status' and 'indexes'
+
+
+Bugs fixed and changes in 1.8.2
+1) minor bug fix
+
+Bugs fixed and changes in 1.8.1
+
+1) updated docs
+
+2) fixed #defines from MAX_NAME_LEN to MAX_OID_LEN (mslifcak)
+
+3) reverted __tag2oid to use read_objid rather than get_node. this
+gives full name resolution provided by libsnmp and no longer creates
+problems on failure since 3.6.2 removes the call to 'exit' in
+read_objid
+
+4) fixed Makefile.PL to use win32 'type' vs. 'cat'
+
+Bugs fixed and changes in 1.8
+
+1) added async API (async api should be considered beta -
+   potential changes are most likely in the event loop integration
+   area - would like to integrate with Event.pm)
+
+2) added trap generation API (implemented v1 traps only for now)
+
+3) added and exported non-OO utility API (snmp_get, snmp_set, etc.)
+
+4) added $SNMP::debugging to dynamically control libsnmp debugging output
+
+5) added $SNMP::save_descriptions to control libsnmp parsing/saving
+   of MIB descriptions
+
+6) added $SNMP::dump_packet to control libsnmp packet dumping
+
+7) implemented the SNMP::mapEnum function (thanks to Wayne Marquette)
+
+8) officially added(documented) tied %SNMP::MIB hash to allow access
+   to parsed MIB meta-data (new support for textualConvention and syntax)
+
+9) fixed bug related to AUTOLOAD recursion
+
+10) fixed bug with SNMP::use_enums so 'set' (and trap) should now accept
+   enums as input values
+
+11) fixed bug with fget[next] - formatted values are supplied as return
+    values as well as within args passed
+
+12) fixed Makefile to link with -kstat on solaris
+
+13) fixed bug when handling noSuchName returns for getnext calls with
+    varbinds w/ no iid supplied (__get_label_iid should not use the
+    FAIL_ON_NULL_IID flag)
+
+14) fixed bug with uninitialized sprintval_flag
+
+15) fixed bug when no val is passed to SNMP::Session::set - now
+    will not core or complain about uninitialized data
+
+16) fixed bug with __translate_appl_type in case of NULL or empty string
+
+17) eliminated the use of strtoul for portability - use sscanf(,"%lu",)
+
+18) getType() supports all tag formats now
+
+19) fixed bug when setting values of type OBJID (thanks Scott Schumate)
+
+20) *WARNING* RetryNoSuch in session creation had a bug which prevented
+    it from being disabled. It now defaults to being disabled - this may
+    break code *WARNING*
+
+
+Bugs fixed and changes in 1.7
+
+1) fixed seg fault on use of unknown/unparsed attribute in Varbind or
+   passed to translateObj
+
+2) fixed truncation of last char of attribute name in translateObj
+
+3) handles variable args to setMib without complaint
+
+4) added SNMP::getType to query data type of a given attribute and
+   extended Varbind structure to return type wherever possible
+
+5) added RemotePort to SNMP::Session initialization list to allow override
+   of port 161
+
+6) removed noisy announcement of mib parse success unless verbose is set
+
+	       *WARNING*  *this may break existing scripts*
+7) changed return format for IpAddress and ObjID data types - these are
+   now always returned as dotted decimal strings as opposed to the
+   packed binary forms in 1.6
+	       *WARNING*  *this may break existing scripts*
+
+8) Session now sets ErrorInd (e.g., $session->{ErrorInd}) where appropriate
+
+9) Support for ucd-snmp-3.2 (and greater) style of Mib loading
+
+10) Fully qualified attribute names and numeric OIDs are now valid <obj>
+   definitions.
+
+11) Numeric OIDs can be used even if they have not been parsed in the
+    current Mib - Mib loading is now optional
+
+12) Support for Win32 perl
+
+13) Updated docs and examples
+
+14) Reworked/extended the test harness to use the perl t/* facility
+    (thanks to jfs@fluent.com)
+
+15) fixed up error handling to be more consistent with library and more
+    useful in general. Now returns both library API errors and snmp
+    protocol error numbers and strings.
+
+16) added per object and per type formatting of returned values - more
+    control of value formatting with UseEnums and UseSprintValue
+
+Copyright:
+
+     Copyright (c) 1995-2000 G. S. Marzot. All rights reserved.
+     This program is free software; you can redistribute it and/or
+     modify it under the same terms as Perl itself.
+
+     Copyright (c) 2001-2002 Networks Associates Technology, Inc.  All
+     Rights Reserved.  This program is free software; you can
+     redistribute it and/or modify it under the same terms as Perl
+     itself.
diff -Naur tomato/release/src/router/snmp/perl/SNMP/SNMP.pm tomato121/release/src/router/snmp/perl/SNMP/SNMP.pm
--- tomato/release/src/router/snmp/perl/SNMP/SNMP.pm	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/perl/SNMP/SNMP.pm	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,1986 @@
+# SNMP.pm -- Perl 5 interface to the net-snmp toolkit
+#
+# written by G. S. Marzot (gmarzot@nortelnetworks.com)
+#
+#     Copyright (c) 1995-2000 G. S. Marzot. All rights reserved.
+#     This program is free software; you can redistribute it and/or
+#     modify it under the same terms as Perl itself.
+
+package SNMP;
+$VERSION = '5.0.9';   # current release version number
+
+require Exporter;
+require DynaLoader;
+require AutoLoader;
+
+use NetSNMP::default_store (':all');
+
+@SNMP::ISA = qw(Exporter AutoLoader DynaLoader);
+# Items to export into callers namespace by default. Note: do not export
+# names by default without a very good reason. Use EXPORT_OK instead.
+# Do not simply export all your public functions/methods/constants.
+@SNMP::EXPORT = qw(
+	RECEIVED_MESSAGE
+	SNMPERR_BAD_ADDRESS
+	SNMPERR_BAD_LOCPORT
+	SNMPERR_BAD_SESSION
+	SNMPERR_GENERR
+	SNMPERR_TOO_LONG
+	SNMP_DEFAULT_ADDRESS
+	SNMP_DEFAULT_COMMUNITY_LEN
+	SNMP_DEFAULT_ENTERPRISE_LENGTH
+	SNMP_DEFAULT_ERRINDEX
+	SNMP_DEFAULT_ERRSTAT
+	SNMP_DEFAULT_PEERNAME
+	SNMP_DEFAULT_REMPORT
+	SNMP_DEFAULT_REQID
+	SNMP_DEFAULT_RETRIES
+	SNMP_DEFAULT_TIME
+	SNMP_DEFAULT_TIMEOUT
+	SNMP_DEFAULT_VERSION
+	TIMED_OUT
+	snmp_get
+        snmp_getnext
+        snmp_set
+        snmp_trap
+);
+
+sub AUTOLOAD {
+    # This AUTOLOAD is used to 'autoload' constants from the constant()
+    # XS function.  If a constant is not found then control is passed
+    # to the AUTOLOAD in AutoLoader.
+    my($val,$pack,$file,$line);
+    local($constname);
+    ($constname = $AUTOLOAD) =~ s/.*:://;
+    # croak "&$module::constant not defined" if $constname eq 'constant';
+    $val = constant($constname, @_ ? $_[0] : 0);
+    if ($! != 0) {
+	if ($! =~ /Invalid/) {
+	    $AutoLoader::AUTOLOAD = $AUTOLOAD;
+	    goto &AutoLoader::AUTOLOAD;
+	}
+	else {
+	    ($pack,$file,$line) = caller;
+	    die "Your vendor has not defined SNMP macro $constname, used at $file line $line.
+";
+	}
+    }
+    eval "sub $AUTOLOAD { $val }";
+    goto &$AUTOLOAD;
+}
+
+bootstrap SNMP;
+
+# Preloaded methods go here.
+
+# Package variables
+tie $SNMP::debugging, SNMP::DEBUGGING;
+tie $SNMP::debug_internals, SNMP::DEBUG_INTERNALS;
+tie $SNMP::dump_packet, SNMP::DUMP_PACKET;
+tie %SNMP::MIB, SNMP::MIB;
+tie $SNMP::save_descriptions, SNMP::MIB::SAVE_DESCR;
+tie $SNMP::replace_newer, SNMP::MIB::REPLACE_NEWER;
+
+%SNMP::V3_SEC_LEVEL_MAP = (noAuthNoPriv => 1, authNoPriv => 2, authPriv =>3);
+
+$auto_init_mib = 1; # enable automatic MIB loading at session creation time
+$use_long_names = 0; # non-zero to prefer longer mib textual identifiers rather
+                   # than just leaf indentifiers (see translateObj)
+                   # may also be set on a per session basis(see UseLongNames)
+$use_sprint_value = 0; # non-zero to enable formatting of response values
+                   # using the snmp libraries "snprint_value"
+                   # may also be set on a per session basis(see UseSprintValue)
+                   # note: returned values not suitable for 'set' operations
+$use_enums = 0; # non-zero to return integers as enums and allow sets
+                # using enums where appropriate - integer data will
+                # still be accepted for set operations
+                # may also be set on a per session basis (see UseEnums)
+$use_numeric = 0; # non-zero to return object tags as numeric OID's instead
+                  # of converting to textual representations.  use_long_names,
+                  # if non-zero, returns the entire OID, otherwise, return just
+                  # the label portion.  use_long_names is also set if the
+		  # use_numeric variable is set.
+%MIB = ();      # tied hash to access libraries internal mib tree structure
+                # parsed in from mib files
+$verbose = 0;   # controls warning/info output of SNMP module,
+                # 0 => no output, 1 => enables warning and info
+                # output from SNMP module itself (is also controlled
+                # by SNMP::debugging)
+$debugging = 0; # non-zero to globally enable libsnmp do_debugging output
+                # set to >= 2 to enabling packet dumping (see below)
+$dump_packet = 0; # non-zero to globally enable libsnmp dump_packet output.
+                  # is also enabled when $debugging >= 2
+$save_descriptions = 0; #tied scalar to control saving descriptions during
+               # mib parsing - must be set prior to mib loading
+$best_guess = 0;  # determine whether or not to enable best-guess regular
+                  # expression object name translation
+$replace_newer = 0; # determine whether or not to tell the parser to replace
+                    # older MIB modules with newer ones when loading MIBs.
+                    # WARNING: This can cause an incorrect hierarchy.
+
+sub setMib {
+# loads mib from file name provided
+# setting second arg to true causes currently loaded mib to be replaced
+# otherwise mib file will be added to existing loaded mib database
+# NOTE: now deprecated in favor of addMibFiles and new module based funcs
+   my $file = shift;
+   my $force = shift || '0';
+   return 0 if $file and not (-r $file);
+   SNMP::_read_mib($file,$force);
+}
+
+sub initMib {
+# eqivalent to calling the snmp library init_mib if Mib is NULL
+# if Mib is already loaded this function does nothing
+# Pass a zero valued argument to get minimal mib tree initialzation
+# If non zero agrgument or no argument then full mib initialization
+
+  SNMP::init_snmp("perl");
+  return;
+
+
+  if (defined $_[0] and $_[0] == 0) {
+    SNMP::_init_mib_internals();
+  } else {
+    SNMP::_read_mib("");
+  }
+}
+
+sub addMibDirs {
+# adds directories to search path when a module is requested to be loaded
+  SNMP::init_snmp("perl");
+  foreach (@_) {
+    SNMP::_add_mib_dir($_) or return undef;
+  }
+  return 1;
+}
+
+sub addMibFiles {
+# adds mib definitions to currently loaded mib database from
+# file(s) supplied
+  SNMP::init_snmp("perl");
+  foreach (@_) {
+    SNMP::_read_mib($_) or return undef;
+  }
+  return 1;
+}
+
+sub loadModules {
+# adds mib module definitions to currently loaded mib database.
+# Modules will be searched from previously defined mib search dirs
+# Passing and arg of 'ALL' will cause all known modules to be loaded
+   SNMP::init_snmp("perl");
+   foreach (@_) {
+     SNMP::_read_module($_) or return undef;
+   }
+   return 1;
+}
+
+sub unloadModules {
+# causes modules to be unloaded from mib database
+# Passing and arg of 'ALL' will cause all known modules to be unloaded
+  warn("SNMP::unloadModules not implemented! (yet)");
+}
+
+sub translateObj {
+# translate object identifier(tag or numeric) into alternate representation
+# (i.e., sysDescr => '.1.3.6.1.2.1.1.1' and '.1.3.6.1.2.1.1.1' => sysDescr)
+# when $SNMP::use_long_names or second arg is non-zero the translation will
+# return longer textual identifiers (e.g., system.sysDescr)
+# if Mib is not loaded and $SNMP::auto_init_mib is enabled Mib will be loaded
+# returns 'undef' upon failure
+   SNMP::init_snmp("perl");
+   my $obj = shift;
+   my $long_names = shift || $SNMP::use_long_names;
+   return undef if not defined $obj;
+   my $res;
+   if ($obj =~ /^\.?(\d+\.)*\d+$/) {
+      $res = SNMP::_translate_obj($obj,1,$long_names,$SNMP::auto_init_mib,0);
+   } elsif ($obj =~ /(\.\d+)*$/ && $SNMP::best_guess == 0) {
+      $res = SNMP::_translate_obj($`,0,$long_names,$SNMP::auto_init_mib,0);
+      $res .= $& if defined $res and defined $&;
+   } elsif ($SNMP::best_guess) {
+      $res = SNMP::_translate_obj($obj,0,$long_names,$SNMP::auto_init_mib,$SNMP::best_guess);
+   }
+
+   return($res);
+}
+
+sub getType {
+# return SNMP data type for given textual identifier
+# OBJECTID, OCTETSTR, INTEGER, NETADDR, IPADDR, COUNTER
+# GAUGE, TIMETICKS, OPAQUE, or undef
+  my $tag = shift;
+  SNMP::_get_type($tag);
+}
+
+sub mapEnum {
+# return the corresponding integer value *or* tag for a given MIB attribute
+# and value. The function will sense which direction to perform the conversion
+# various arg formats are supported
+#    $val = SNMP::mapEnum($varbind); # note: will update $varbind
+#    $val = SNMP::mapEnum('ipForwarding', 'forwarding');
+#    $val = SNMP::mapEnum('ipForwarding', 1);
+#
+  my $var = shift;
+  my ($tag, $val, $update);
+  if (ref($var) =~ /ARRAY/ or ref($var) =~ /Varbind/) {
+      $tag = $var->[$SNMP::Varbind::tag_f];
+      $val = $var->[$SNMP::Varbind::val_f];
+      $update = 1;
+  } else {
+      $tag = $var;
+      $val = shift;
+  }
+  my $iflag = $val =~ /^\d+$/;
+  my $res = SNMP::_map_enum($tag, $val, $iflag);
+  if ($update and defined $res) { $var->[$SNMP::Varbind::val_f] = $res; }
+  return($res);
+}
+
+%session_params = (DestHost => 1,
+		   Community => 1,
+		   Version => 1,
+		   Timeout => 1,
+		   Retries => 1,
+		   RemotePort => 1,
+                   LocalPort => 1);
+
+sub strip_session_params {
+    my @params;
+    my @args;
+    my $param;
+    while ($param = shift) {
+	push(@params,$param, shift), next
+	    if $session_params{$param};
+	push(@args,$param);
+    }
+    @_ = @args;
+    @params;
+}
+
+
+sub snmp_get {
+# procedural form of 'get' method. sometimes quicker to code
+# but is less efficient since the Session is created and destroyed
+# with each call. Takes all the parameters of both SNMP::Session::new and
+# SNMP::Session::get (*NOTE*: this api does not support async callbacks)
+
+    my @sess_params = &strip_session_params;
+    my $sess = new SNMP::Session(@sess_params);
+
+    $sess->get(@_);
+}
+
+sub snmp_getnext {
+# procedural form of 'getnext' method. sometimes quicker to code
+# but is less efficient since the Session is created and destroyed
+# with each call. Takes all the parameters of both SNMP::Session::new and
+# SNMP::Session::getnext (*NOTE*: this api does not support async callbacks)
+
+    my @sess_params = &strip_session_params;
+    my $sess = new SNMP::Session(@sess_params);
+
+    $sess->getnext(@_);
+}
+
+sub snmp_set {
+# procedural form of 'set' method. sometimes quicker to code
+# but is less efficient since the Session is created and destroyed
+# with each call. Takes all the parameters of both SNMP::Session::new and
+# SNMP::Session::set (*NOTE*: this api does not support async callbacks)
+
+    my @sess_params = &strip_session_params;
+    my $sess = new SNMP::Session(@sess_params);
+
+    $sess->set(@_);
+}
+
+sub snmp_trap {
+# procedural form of 'trap' method. sometimes quicker to code
+# but is less efficient since the Session is created and destroyed
+# with each call. Takes all the parameters of both SNMP::TrapSession::new and
+# SNMP::TrapSession::trap
+
+    my @sess_params = &strip_session_params;
+    my $sess = new SNMP::TrapSession(@sess_params);
+
+    $sess->trap(@_);
+}
+
+sub MainLoop {
+    my $time = shift;
+    my $callback = shift;
+    my $time_sec = ($time ? int $time : 0);
+    my $time_usec = ($time ? int(($time-$time_sec)*1000000) : 0);
+    SNMP::_main_loop($time_sec,$time_usec,$callback);
+}
+
+sub finish {
+    SNMP::_mainloop_finish();
+}
+
+sub reply_cb {
+    # callback function for async snmp calls
+    # when triggered, will do a SNMP read on the
+    # given fd
+    my $fd = shift;
+  SNMP::_read_on_fd($fd);
+}
+
+sub select_info {
+    # retrieves SNMP used fd's and timeout info
+    # calculates timeout in fractional seconds
+    # ( easy to use with select statement )
+    my($block, $to_sec, $to_usec, @fd_set)=SNMP::_get_select_info();
+    my $time_sec_dec = ($block? 0 : $to_sec + $to_usec * 1e-6);
+    #print "fd's for snmp -> ", @fd_set, "\n";
+    #print "block		-> ", $block, "\n";
+    #print "timeout_sec	-> ", $to_sec, "\n";
+    #print "timeout_usec	-> ", $to_usec, "\n";
+    #print "timeout dec	-> ", $time_sec_dec, "\n";
+    return ($time_sec_dec,@fd_set);
+}
+
+sub check_timeout {
+  # check to see if a snmp session
+  # timed out, and if so triggers
+  # the callback function
+  SNMP::_check_timeout();
+  # check to see when have to check again
+  my($block, $to_sec, $to_usec, @fd_set)=SNMP::_get_select_info();
+  my $time_sec_dec = ($block? 0 : $to_sec + $to_usec * 1e-6);
+  #print "fd's for snmp -> ", @fd_set, "\n";
+  #print "block		-> ", $block, "\n";
+  #print "timeout_sec	-> ", $to_sec, "\n";
+  #print "timeout_usec	-> ", $to_usec, "\n";
+  #print "timeout dec	-> ", $time_sec_dec, "\n";
+  return ($time_sec_dec);
+}
+
+sub _tie {
+# this is a little implementation hack so ActiveState can access pp_tie
+# thru perl code. All other environments allow the calling of pp_tie from
+# XS code but AS was not exporting it when PERL_OBJECT was used.
+#
+# short term solution was call this perl func which calls 'tie'
+#
+# longterm fix is to supply a patch which allows AS to export pp_tie in
+# such a way that it can be called from XS code. gsarathy says:
+# a patch to util.c is needed to provide access to PL_paddr
+# so it is possible to call PL_paddr[OP_TIE] as the compiler does
+    tie($_[0],$_[1],$_[2],$_[3]);
+}
+
+package SNMP::Session;
+
+sub new {
+   my $type = shift;
+   my $this = {};
+   my ($name, $aliases, $host_type, $len, $thisaddr);
+
+   SNMP::init_snmp("perl");
+
+   %$this = @_;
+
+   $this->{ErrorStr} = ''; # if methods return undef check for expln.
+   $this->{ErrorNum} = 0;  # contains SNMP error return
+
+   $this->{Version} ||= 
+     NetSNMP::default_store::netsnmp_ds_get_int(NetSNMP::default_store::NETSNMP_DS_LIBRARY_ID, 
+				      NetSNMP::default_store::NETSNMP_DS_LIB_SNMPVERSION) ||
+					SNMP::SNMP_DEFAULT_VERSION();
+
+   if ($this->{Version} eq 128) {
+       # special handling of the bogus v1 definition.
+       $this->{Version} = 1;
+   }
+
+   # allow override of local SNMP port
+   $this->{LocalPort} ||= 0;
+
+   # destination host defaults to localhost
+   $this->{DestHost} ||= 'localhost';
+
+   # community defaults to public
+   $this->{Community} ||= NetSNMP::default_store::netsnmp_ds_get_string(NetSNMP::default_store::NETSNMP_DS_LIBRARY_ID(), 
+				        NetSNMP::default_store::NETSNMP_DS_LIB_COMMUNITY()) || 'public';
+
+   # number of retries before giving up, defaults to SNMP_DEFAULT_RETRIES
+   $this->{Retries} = SNMP::SNMP_DEFAULT_RETRIES() unless defined($this->{Retries});
+
+   # timeout before retry, defaults to SNMP_DEFAULT_TIMEOUT
+   $this->{Timeout} = SNMP::SNMP_DEFAULT_TIMEOUT() unless defined($this->{Timeout});
+   # flag to enable fixing pdu and retrying with a NoSuch error
+   $this->{RetryNoSuch} ||= 0;
+
+   # backwards compatibility.  Make host = host:port
+   if ($this->{RemotePort} && $this->{DestHost} !~ /:/) {
+       $this->{DestHost} = $this->{DestHost} . ":" . $this->{RemotePort};
+   }
+
+   if ($this->{Version} eq '1' or $this->{Version} eq '2'
+       or $this->{Version} eq '2c') {
+       $this->{SessPtr} = SNMP::_new_session($this->{Version},
+					     $this->{Community},
+					     $this->{DestHost},
+					     $this->{LocalPort},
+					     $this->{Retries},
+					     $this->{Timeout},
+					     );
+   } elsif ($this->{Version} eq '3' ) {
+       $this->{SecName} ||= 
+	   NetSNMP::default_store::netsnmp_ds_get_string(NetSNMP::default_store::NETSNMP_DS_LIBRARY_ID(), 
+		         NetSNMP::default_store::NETSNMP_DS_LIB_SECNAME()) || 
+			   'initial';
+       if (!$this->{SecLevel}) {
+	   $this->{SecLevel} = 
+	       NetSNMP::default_store::netsnmp_ds_get_int(NetSNMP::default_store::NETSNMP_DS_LIBRARY_ID(), 
+			  NetSNMP::default_store::NETSNMP_DS_LIB_SECLEVEL()) || 
+			      $SNMP::V3_SEC_LEVEL_MAP{'noAuthNoPriv'};
+       } elsif ($this->{SecLevel} !~ /^\d+$/) {
+	   $this->{SecLevel} = $SNMP::V3_SEC_LEVEL_MAP{$this->{SecLevel}};
+       }
+       $this->{SecEngineId} ||= '';
+       $this->{ContextEngineId} ||= $this->{SecEngineId};
+       $this->{Context} ||= 
+	   NetSNMP::default_store::netsnmp_ds_get_string(NetSNMP::default_store::NETSNMP_DS_LIBRARY_ID(), 
+		         NetSNMP::default_store::NETSNMP_DS_LIB_CONTEXT()) || '';
+       $this->{AuthProto} ||= 'MD5'; # defaults XXX
+       $this->{AuthPass} ||=
+       NetSNMP::default_store::netsnmp_ds_get_string(NetSNMP::default_store::NETSNMP_DS_LIBRARY_ID(), 
+		     NetSNMP::default_store::NETSNMP_DS_LIB_AUTHPASSPHRASE()) ||
+       NetSNMP::default_store::netsnmp_ds_get_string(NetSNMP::default_store::NETSNMP_DS_LIBRARY_ID(), 
+		     NetSNMP::default_store::NETSNMP_DS_LIB_PASSPHRASE()) || '';
+       $this->{PrivProto} ||= 'DES';  # defaults XXX
+       $this->{PrivPass} ||=
+       NetSNMP::default_store::netsnmp_ds_get_string(NetSNMP::default_store::NETSNMP_DS_LIBRARY_ID(), 
+		     NetSNMP::default_store::NETSNMP_DS_LIB_PRIVPASSPHRASE()) ||
+       NetSNMP::default_store::netsnmp_ds_get_string(NetSNMP::default_store::NETSNMP_DS_LIBRARY_ID(), 
+		     NetSNMP::default_store::NETSNMP_DS_LIB_PASSPHRASE()) || '';
+       $this->{EngineBoots} = 0 if not defined $this->{EngineBoots};
+       $this->{EngineTime} = 0 if not defined $this->{EngineTime};
+
+       $this->{SessPtr} = SNMP::_new_v3_session($this->{Version},
+						$this->{DestHost},
+						$this->{Retries},
+						$this->{Timeout},
+						$this->{SecName},
+						$this->{SecLevel},
+						$this->{SecEngineId},
+						$this->{ContextEngineId},
+						$this->{Context},
+						$this->{AuthProto},
+						$this->{AuthPass},
+						$this->{PrivProto},
+						$this->{PrivPass},
+						$this->{EngineBoots},
+						$this->{EngineTime},
+						);
+   }
+   unless ($this->{SessPtr}) {
+       warn("unable to create session") if $SNMP::verbose;
+       return undef;
+   }
+
+   SNMP::initMib($SNMP::auto_init_mib); # ensures that *some* mib is loaded
+
+   $this->{UseLongNames} ||= $SNMP::use_long_names;
+   $this->{UseSprintValue} ||= $SNMP::use_sprint_value;
+   $this->{UseEnums} ||= $SNMP::use_enums;
+   $this->{UseNumeric} ||= $SNMP::use_numeric;
+
+   # Force UseLongNames if UseNumeric is in use.
+   $this->{UseLongNames}++  if $this->{UseNumeric};
+
+   bless $this, $type;
+}
+
+sub update {
+# *Not Implemented*
+# designed to update the fields of session to allow retargetting to different
+# host, community name change, timeout, retry changes etc. Unfortunately not
+# working yet because some updates (the address in particular) need to be
+# done on the internal session pointer which cannot be fetched w/o touching
+# globals at this point which breaks win32. A patch to the ucd-snmp toolkit
+# is needed
+   my $this = shift;
+   my ($name, $aliases, $host_type, $len, $thisaddr);
+   my %new_fields = @_;
+
+   @$this{keys %new_fields} = values %new_fields;
+
+   $this->{UseLongNames} ||= $SNMP::use_long_names;
+   $this->{UseSprintValue} ||= $SNMP::use_sprint_value;
+   $this->{UseEnums} ||= $SNMP::use_enums;
+   $this->{UseNumeric} ||= $SNMP::use_numeric;
+
+   # Force UseLongNames if UseNumeric is in use.
+   $this->{UseLongNames}++  if $this->{UseNumeric};
+
+   SNMP::_update_session($this->{Version},
+		 $this->{Community},
+		 $this->{DestHost},
+		 $this->{RemotePort},
+		 $this->{LocalPort},
+		 $this->{Retries},
+		 $this->{Timeout},
+		);
+
+
+}
+
+sub set {
+   my $this = shift;
+   my $vars = shift;
+   my $varbind_list_ref;
+   my $res = 0;
+
+   if (ref($vars) =~ /SNMP::VarList/) {
+     $varbind_list_ref = $vars;
+   } elsif (ref($vars) =~ /SNMP::Varbind/) {
+     $varbind_list_ref = [$vars];
+   } elsif (ref($vars) =~ /ARRAY/) {
+     $varbind_list_ref = [$vars];
+     $varbind_list_ref = $vars if ref($$vars[0]) =~ /ARRAY/;
+   } else {
+     my ($tag, $iid) = ($vars =~ /^((?:\.\d+)+|(?:\w+(?:\-*\w+)+))\.?(.*)$/);
+     my $val = shift;
+     $varbind_list_ref = [[$tag, $iid, $val]];
+   }
+   my $cb = shift;
+
+   $res = SNMP::_set($this, $varbind_list_ref, $cb);
+}
+
+sub get {
+   my $this = shift;
+   my $vars = shift;
+   my ($varbind_list_ref, @res);
+
+   if (ref($vars) =~ /SNMP::VarList/) {
+     $varbind_list_ref = $vars;
+   } elsif (ref($vars) =~ /SNMP::Varbind/) {
+     $varbind_list_ref = [$vars];
+   } elsif (ref($vars) =~ /ARRAY/) {
+     $varbind_list_ref = [$vars];
+     $varbind_list_ref = $vars if ref($$vars[0]) =~ /ARRAY/;
+   } else {
+     my ($tag, $iid) = ($vars =~ /^((?:\.\d+)+|(?:\w+(?:\-*\w+)+))\.?(.*)$/);
+     $varbind_list_ref = [[$tag, $iid]];
+   }
+
+   my $cb = shift;
+
+   @res = SNMP::_get($this, $this->{RetryNoSuch}, $varbind_list_ref, $cb);
+
+   return(wantarray() ? @res : $res[0]);
+}
+
+sub fget {
+   my $this = shift;
+   my $vars = shift;
+   my ($varbind_list_ref, @res);
+
+   if (ref($vars) =~ /SNMP::VarList/) {
+     $varbind_list_ref = $vars;
+   } elsif (ref($vars) =~ /SNMP::Varbind/) {
+     $varbind_list_ref = [$vars];
+   } elsif (ref($vars) =~ /ARRAY/) {
+     $varbind_list_ref = [$vars];
+     $varbind_list_ref = $vars if ref($$vars[0]) =~ /ARRAY/;
+   } else {
+     my ($tag, $iid) = ($vars =~ /^((?:\.\d+)+|(?:\w+(?:\-*\w+)+))\.?(.*)$/);
+     $varbind_list_ref = [[$tag, $iid]];
+   }
+
+   my $cb = shift;
+
+   SNMP::_get($this, $this->{RetryNoSuch}, $varbind_list_ref, $cb);
+
+   foreach $varbind (@$varbind_list_ref) {
+     $sub = $this->{VarFormats}{$varbind->[$SNMP::Varbind::tag_f]} ||
+	 $this->{TypeFormats}{$varbind->[$SNMP::Varbind::type_f]};
+     &$sub($varbind) if defined $sub;
+     push(@res, $varbind->[$SNMP::Varbind::val_f]);
+   }
+
+   return(wantarray() ? @res : $res[0]);
+}
+
+sub getnext {
+   my $this = shift;
+   my $vars = shift;
+   my ($varbind_list_ref, @res);
+
+   if (ref($vars) =~ /SNMP::VarList/) {
+     $varbind_list_ref = $vars;
+   } elsif (ref($vars) =~ /SNMP::Varbind/) {
+     $varbind_list_ref = [$vars];
+   } elsif (ref($vars) =~ /ARRAY/) {
+     $varbind_list_ref = [$vars];
+     $varbind_list_ref = $vars if ref($$vars[0]) =~ /ARRAY/;
+   } else {
+     my ($tag, $iid) = ($vars =~ /^((?:\.\d+)+|(?:\w+(?:\-*\w+)+))\.?(.*)$/);
+     $varbind_list_ref = [[$tag, $iid]];
+   }
+
+   my $cb = shift;
+
+   @res = SNMP::_getnext($this, $varbind_list_ref, $cb);
+
+   return(wantarray() ? @res : $res[0]);
+}
+
+sub fgetnext {
+   my $this = shift;
+   my $vars = shift;
+   my ($varbind_list_ref, @res);
+
+   if (ref($vars) =~ /SNMP::VarList/) {
+     $varbind_list_ref = $vars;
+   } elsif (ref($vars) =~ /SNMP::Varbind/) {
+     $varbind_list_ref = [$vars];
+   } elsif (ref($vars) =~ /ARRAY/) {
+     $varbind_list_ref = [$vars];
+     $varbind_list_ref = $vars if ref($$vars[0]) =~ /ARRAY/;
+   } else {
+     my ($tag, $iid) = ($vars =~ /^((?:\.\d+)+|(?:\w+(?:\-*\w+)+))\.?(.*)$/);
+     $varbind_list_ref = [[$tag, $iid]];
+   }
+
+   my $cb = shift;
+
+   SNMP::_getnext($this, $varbind_list_ref, $cb);
+
+   foreach $varbind (@$varbind_list_ref) {
+     $sub = $this->{VarFormats}{$varbind->[$SNMP::Varbind::tag_f]} ||
+	 $this->{TypeFormats}{$varbind->[$SNMP::Varbind::type_f]};
+     &$sub($varbind) if defined $sub;
+     push(@res, $varbind->[$SNMP::Varbind::val_f]);
+   }
+
+   return(wantarray() ? @res : $res[0]);
+}
+
+sub getbulk {
+   my $this = shift;
+   my $nonrepeaters = shift;
+   my $maxrepetitions = shift;
+   my $vars = shift;
+   my ($varbind_list_ref, @res);
+
+   if (ref($vars) =~ /SNMP::VarList/) {
+     $varbind_list_ref = $vars;
+   } elsif (ref($vars) =~ /SNMP::Varbind/) {
+     $varbind_list_ref = [$vars];
+   } elsif (ref($vars) =~ /ARRAY/) {
+     $varbind_list_ref = [$vars];
+     $varbind_list_ref = $vars if ref($$vars[0]) =~ /ARRAY/;
+   } else {
+     my ($tag, $iid) = ($vars =~ /^((?:\.\d+)+|(?:\w+(?:\-*\w+)+))\.?(.*)$/);
+     $varbind_list_ref = [[$tag, $iid]];
+   }
+
+   my $cb = shift;
+
+   @res = SNMP::_getbulk($this, $nonrepeaters, $maxrepetitions, $varbind_list_ref, $cb);
+
+   return(wantarray() ? @res : $res[0]);
+}
+
+sub bulkwalk {
+   my $this = shift;
+   my $nonrepeaters = shift;
+   my $maxrepetitions = shift;
+   my $vars = shift;
+   my ($varbind_list_ref, @res);
+
+   if (ref($vars) =~ /SNMP::VarList/) {
+      $varbind_list_ref = $vars;
+   } elsif (ref($vars) =~ /SNMP::Varbind/) {
+      $varbind_list_ref = [$vars];
+   } elsif (ref($vars) =~ /ARRAY/) {
+      $varbind_list_ref = [$vars];
+      $varbind_list_ref = $vars if ref($$vars[0]) =~ /ARRAY/;
+   } else {
+      my ($tag, $iid) = ($vars =~ /^((?:\.\d+)+|\w+)\.?(.*)$/);
+      $varbind_list_ref = [[$tag, $iid]];
+   }
+
+   if (scalar @$varbind_list_ref == 0) {
+      $this->{ErrorNum} = SNMP::constant("SNMPERR_GENERR", 0);
+      $this->{ErrorStr} = "cannot bulkwalk() empty variable list";
+      return undef;
+   }
+   if (scalar @$varbind_list_ref < $nonrepeaters) {
+      $this->{ErrorNum} = SNMP::constant("SNMPERR_GENERR", 0);
+      $this->{ErrorStr} = "bulkwalk() needs at least $nonrepeaters varbinds";
+      return undef;
+   }
+
+   my $cb = shift;
+   @res = SNMP::_bulkwalk($this, $nonrepeaters, $maxrepetitions,
+						$varbind_list_ref, $cb);
+
+   # Return, in list context, a copy of the array of arrays of Varbind refs.
+   # In scalar context, return either a reference to the array of arrays of
+   # Varbind refs, or the request ID for an asynchronous bulkwalk.  This is
+   # a compromise between the getbulk()-ish return, and the more useful array
+   # of arrays of Varbinds return from the synchronous bulkwalk().
+   #
+   return @res if (wantarray());
+   return defined($cb) ? $res[0] : \@res;
+}
+
+%trap_type = (coldStart => 0, warmStart => 1, linkDown => 2, linkUp => 3,
+	      authFailure => 4, egpNeighborLoss => 5, specific => 6 );
+sub trap {
+# (v1) enterprise, agent, generic, specific, uptime, <vars>
+# $sess->trap(enterprise=>'.1.3.6.1.4.1.2021', # or 'ucdavis' [default]
+#             agent => '127.0.0.1', # or 'localhost',[default 1st intf on host]
+#             generic => specific,  # can be omitted if 'specific' supplied
+#             specific => 5,        # can be omitted if 'generic' supplied
+#             uptime => 1234,       # default to localhost uptime (0 on win32)
+#             [[ifIndex, 1, 1],[sysLocation, 0, "here"]]); # optional vars
+#                                                          # always last
+# (v2) oid, uptime, <vars>
+# $sess->trap(uptime => 1234,
+#             oid => 'snmpRisingAlarm',
+#             [[ifIndex, 1, 1],[sysLocation, 0, "here"]]); # optional vars
+#                                                          # always last
+#                                                          # always last
+
+
+   my $this = shift;
+   my $vars = pop if ref($_[$#_]); # last arg may be varbind or varlist
+   my %param = @_;
+   my ($varbind_list_ref, @res);
+
+   if (ref($vars) =~ /SNMP::VarList/) {
+     $varbind_list_ref = $vars;
+   } elsif (ref($vars) =~ /SNMP::Varbind/) {
+     $varbind_list_ref = [$vars];
+   } elsif (ref($vars) =~ /ARRAY/) {
+     $varbind_list_ref = [$vars];
+     $varbind_list_ref = $vars if ref($$vars[0]) =~ /ARRAY/;
+   }
+
+   if ($this->{Version} eq '1') {
+       my $enterprise = $param{enterprise} || 'ucdavis';
+       $enterprise = SNMP::translateObj($enterprise)
+	   unless $enterprise =~ /^[\.\d]+$/;
+       my $agent = $param{agent} || '';
+       my $generic = $param{generic} || 'specific';
+       $generic = $trap_type{$generic} || $generic;
+       my $uptime = $param{uptime} || SNMP::_sys_uptime();
+       my $specific = $param{specific} || 0;
+       @res = SNMP::_trapV1($this, $enterprise, $agent, $generic, $specific,
+			  $uptime, $varbind_list_ref);
+   } elsif  (($this->{Version} eq '2')|| ($this->{Version} eq '2c')) {
+       my $trap_oid = $param{oid} || $param{trapoid} || '.0.0';
+       my $uptime = $param{uptime} || SNMP::_sys_uptime();
+       @res = SNMP::_trapV2($this, $uptime, $trap_oid, $varbind_list_ref);
+   }
+
+   return(wantarray() ? @res : $res[0]);
+}
+
+sub inform {
+# (v3) oid, uptime, <vars>
+# $sess->inform(uptime => 1234,
+#             oid => 'coldStart',
+#             [[ifIndex, 1, 1],[sysLocation, 0, "here"]]); # optional vars
+#                                                          # then callback
+                                                           # always last
+
+
+   my $this = shift;
+   my $vars;
+   my $cb;
+   $cb = pop if ref($_[$#_]) eq 'CODE'; # last arg may be code
+   $vars = pop if ref($_[$#_]); # varbind or varlist
+   my %param = @_;
+   my ($varbind_list_ref, @res);
+
+   if (ref($vars) =~ /SNMP::VarList/) {
+     $varbind_list_ref = $vars;
+   } elsif (ref($vars) =~ /SNMP::Varbind/) {
+     $varbind_list_ref = [$vars];
+   } elsif (ref($vars) =~ /ARRAY/) {
+     $varbind_list_ref = [$vars];
+     $varbind_list_ref = $vars if ref($$vars[0]) =~ /ARRAY/;
+   }
+
+   my $trap_oid = $param{oid} || $param{trapoid};
+   my $uptime = $param{uptime} || SNMP::_sys_uptime();
+
+   if($this->{Version} eq '3') {
+     @res = SNMP::_inform($this, $uptime, $trap_oid, $varbind_list_ref, $cb);
+   } else {
+     warn("error:inform: This version doesn't support the command\n");
+   }
+
+   return(wantarray() ? @res : $res[0]);
+}
+
+package SNMP::TrapSession;
+@ISA = ('SNMP::Session');
+
+sub new {
+   my $type = shift;
+
+   # allow override of remote SNMP trap port
+   unless (grep(/RemotePort/, @_)) {
+       push(@_, 'RemotePort', 162); # push on new default for trap session
+   }
+
+   SNMP::Session::new($type, @_);
+}
+
+package SNMP::Varbind;
+
+$tag_f = 0;
+$iid_f = 1;
+$val_f = 2;
+$type_f = 3;
+$time_f = 4;
+
+sub new {
+   my $type = shift;
+   my $this = shift;
+   $this ||= [];
+   bless $this;
+}
+
+sub tag {
+  $_[0]->[$tag_f];
+}
+
+sub iid {
+  $_[0]->[$iid_f];
+}
+
+sub val {
+  $_[0]->[$val_f];
+}
+
+sub type {
+  $_[0]->[$type_f];
+}
+
+sub name {
+   if (defined($_[0]->[$iid_f]) && ($_[0]->[$iid_f] =~ m/^[0-9]+$/)) {
+      return $_[0]->[$tag_f] . "." . $_[0]->[$iid_f];
+   }
+
+   return $_[0]->[$tag_f];
+}
+
+sub fmt {
+    my $self = shift;
+    return $self->name . " = \"" . $self->val . "\" (" . $self->type . ")";
+}
+
+
+#sub DESTROY {
+#    print "SNMP::Varbind::DESTROY($_[0])\n";
+#}
+
+package SNMP::VarList;
+
+sub new {
+   my $type = shift;
+   my $this = [];
+   my $varb;
+   foreach $varb (@_) {
+     $varb = new SNMP::Varbind($varb) unless ref($varb) =~ /SNMP::Varbind/;
+     push(@{$this}, $varb);
+   }
+
+   bless $this;
+}
+
+#sub DESTROY {
+#    print "SNMP::VarList::DESTROY($_[0])\n";
+#}
+
+package SNMP::DEBUGGING;
+# controls info/debugging output from SNMP module and libsnmp
+# $SNMP::debugging == 1    =>   enables general info and warning output
+#                                (eqiv. to setting $SNMP::verbose)
+# $SNMP::debugging == 2    =>   enables do_debugging from libsnmp as well
+# $SNMP::debugging == 3    =>   enables packet_dump from libsnmp as well
+sub TIESCALAR { my $class = shift; my $val; bless \$val, $class; }
+
+sub FETCH { ${$_[0]}; }
+
+sub STORE {
+    $SNMP::verbose = $_[1];
+    SNMP::_set_debugging($_[1]>1);
+    $SNMP::dump_packet = ($_[1]>2);
+    ${$_[0]} = $_[1];
+}
+
+sub DELETE {
+    $SNMP::verbose = 0;
+    SNMP::_set_debugging(0);
+    $SNMP::dump_packet = 0;
+    ${$_[0]} = undef;
+}
+
+package SNMP::DEBUG_INTERNALS;		# Controls SNMP.xs debugging.
+sub TIESCALAR { my $class = shift; my $val; bless \$val, $class; }
+
+sub FETCH { ${$_[0]}; }
+
+sub STORE {
+    SNMP::_debug_internals($_[1]);
+    ${$_[0]} = $_[1];
+}
+
+sub DELETE {
+    SNMP::_debug_internals(0);
+    ${$_[0]} = undef;
+}
+
+package SNMP::DUMP_PACKET;
+# controls packet dump output from libsnmp
+
+sub TIESCALAR { my $class = shift; my $val; bless \$val, $class; }
+
+sub FETCH { ${$_[0]}; }
+
+sub STORE { SNMP::_dump_packet($_[1]); ${$_[0]} = $_[1]; }
+
+sub DELETE { SNMP::_dump_packet(0); ${$_[0]} = 0; }
+
+package SNMP::MIB;
+
+sub TIEHASH {
+    bless {};
+}
+
+sub FETCH {
+    my $this = shift;
+    my $key = shift;
+
+    if (!defined $this->{$key}) {
+	tie(%{$this->{$key}}, SNMP::MIB::NODE, $key) or return undef;
+    }
+    $this->{$key};
+}
+
+sub STORE {
+    warn "STORE(@_) : write access to the MIB not implemented\n";
+}
+
+sub DELETE {
+    delete $_[0]->{$_[1]}; # just delete cache entry
+}
+
+sub FIRSTKEY { return '.1'; } # this should actually start at .0 but
+                              # because nodes are not stored in lexico
+                              # order in ucd-snmp node tree walk will
+                              # miss most of the tree
+sub NEXTKEY { # this could be sped up by using an XS __get_next_oid maybe
+   my $node = $_[0]->FETCH($_[1])->{nextNode};
+   $node->{objectID};
+}
+sub EXISTS { exists $_[0]->{$_[1]} || $_[0]->FETCH($_[1]); }
+sub CLEAR { undef %{$_[0]}; } # clear the cache
+
+package SNMP::MIB::NODE;
+my %node_elements =
+    (
+     objectID => 0, # dotted decimal fully qualified OID
+     label => 0,    # leaf textual identifier (e.g., 'sysDescr')
+     subID => 0,    # leaf numeric OID component of objectID (e.g., '1')
+     moduleID => 0, # textual identifier for module (e.g., 'RFC1213-MIB')
+     parent => 0,   # parent node
+     children => 0, # array reference of children nodes
+     indexes => 0,  # returns array of column labels
+     varbinds => 0, # returns array of trap/notification varbinds
+     nextNode => 0, # next lexico node (BUG! does not return in lexico order)
+     type => 0,     # returns simple type (see getType for values)
+     access => 0,   # returns ACCESS (ReadOnly, ReadWrite, WriteOnly,
+                    # NoAccess, Notify, Create)
+     status => 0,   # returns STATUS (Mandatory, Optional, Obsolete,
+                    # Deprecated)
+     syntax => 0,   # returns 'textualConvention' if defined else 'type'
+     textualConvention => 0, # returns TEXTUAL-CONVENTION
+     units => 0,    # returns UNITS
+     hint => 0,     # returns HINT
+     enums => 0,    # returns hash ref {tag => num, ...}
+     ranges => 0,   # returns array ref of hash ref [{low => num, high => num}]
+     defaultValue => 0, # returns default value
+     description => 0, # returns DESCRIPTION ($SNMP::save_descriptions must
+                    # be set prior to MIB initialization/parsing
+    );
+
+# sub TIEHASH - implemented in SNMP.xs
+
+# sub FETCH - implemented in SNMP.xs
+
+sub STORE {
+    warn "STORE(@_): write access to MIB node not implemented\n";
+}
+
+sub DELETE {
+    warn "DELETE(@_): write access to MIB node not implemented\n";
+}
+
+sub FIRSTKEY { my $k = keys %node_elements; (each(%node_elements))[0]; }
+sub NEXTKEY { (each(%node_elements))[0]; }
+sub EXISTS { exists($node_elements{$_[1]}); }
+sub CLEAR {
+    warn "CLEAR(@_): write access to MIB node not implemented\n";
+}
+
+#sub DESTROY {
+#    warn "DESTROY(@_): write access to MIB node not implemented\n";
+#    # print "SNMP::MIB::NODE::DESTROY : $_[0]->{label} ($_[0])\n";
+#}
+package SNMP::MIB::SAVE_DESCR;
+
+sub TIESCALAR { my $class = shift; my $val; bless \$val, $class; }
+
+sub FETCH { ${$_[0]}; }
+
+sub STORE { SNMP::_set_save_descriptions($_[1]); ${$_[0]} = $_[1]; }
+
+sub DELETE { SNMP::_set_save_descriptions(0); ${$_[0]} = 0; }
+
+package SNMP::MIB::REPLACE_NEWER;               # Controls MIB parsing
+
+sub TIESCALAR { my $class = shift; my $val; bless \$val, $class; }
+
+sub FETCH { ${$_[0]}; }
+
+sub STORE {
+    SNMP::_set_replace_newer($_[1]);
+    ${$_[0]} = $_[1];
+}
+
+sub DELETE {
+    SNMP::_set_replace_newer(0);
+    ${$_[0]} = 0;
+}
+
+package SNMP;
+END{SNMP::_sock_cleanup() if defined &SNMP::_sock_cleanup;}
+# Autoload methods go after __END__, and are processed by the autosplit prog.
+
+1;
+__END__
+
+=head1 NAME
+
+SNMP - The Perl5 'SNMP' Extension Module v3.1.0 for the UCD SNMPv3 Library
+
+=head1 SYNOPSIS
+
+ use SNMP;
+ ...
+ $sess = new SNMP::Session(DestHost => localhost, Community => public);
+ $val = $sess->get('sysDescr.0');
+ ...
+ $vars = new SNMP::VarList([sysDescr,0], [sysContact,0], [sysLocation,0]);
+ @vals = $sess->get($vars);
+ ...
+ $vb = new SNMP::Varbind();
+ do {
+    $val = $sess->getnext($vb);
+    print "@{$vb}\n";
+ } until ($sess->{ErrorNum});
+ ...
+ $SNMP::save_descriptions = 1;
+ SNMP::initMib(); # assuming mib is not already loaded
+ print "$SNMP::MIB{sysDescr}{description}\n";
+
+=head1 DESCRIPTION
+
+
+Note: The perl SNMP 5.0 module which comes with net-snmp 5.0 and
+higher is different than previous versions in a number of ways.  Most
+importantly, it behaves like a proper net-snmp application and calls
+init_snmp properly, which means it will read configuration files and
+use those defaults where appropriate automatically parse MIB files,
+etc.  This will likely affect your perl applications if you have, for
+instance, default values set up in your snmp.conf file (as the perl
+module will now make use of those defaults).  The docmuentation,
+however, has sadly not been updated yet (aside from this note), nor is
+the read_config default usage implementation fully complete.
+
+The basic operations of the SNMP protocol are provided by this module
+through an object oriented interface for modularity and ease of use.
+The primary class is SNMP::Session which encapsulates the persistent
+aspects of a connection between the management application and the
+managed agent. Internally the class is implemented as a blessed hash
+reference. This class supplies 'get', 'getnext', 'set', 'fget', and
+'fgetnext' method calls. The methods take a variety of input argument
+formats and support both syncronous and asyncronous operation through
+a polymorphic API (i.e., method behaviour varies dependent on args
+passed - see below).
+
+=head1 SNMP::Session
+
+$sess = new SNMP::Session(DestHost => 'host', ...)
+
+The following arguments may be passed to new as a hash.
+
+=over 4
+
+=item DestHost
+
+default 'localhost', hostname or ip addr of SNMP agent
+
+=item Community
+
+default 'public', SNMP community string (used for both R/W)
+
+=item Version
+
+default '1', [2 (same as 2c), 2c, 3]
+
+=item RemotePort
+
+default '161', allow remote UDP port to be overriden
+
+=item Timeout
+
+default '1000000', micro-seconds before retry
+
+=item Retries
+
+default '5', retries before failure
+
+=item RetryNoSuch
+
+default '0', if enabled NOSUCH errors in 'get' pdus will
+be repaired, removing the varbind in error, and resent -
+undef will be returned for all NOSUCH varbinds, when set
+to '0' this feature is disabled and the entire get request
+will fail on any NOSUCH error (applies to v1 only)
+
+=item SecName
+
+default 'initial', security name (v3)
+
+=item SecLevel
+
+default 'noAuthNoPriv', security level [noAuthNoPriv,
+authNoPriv, authPriv] (v3)
+
+=item SecEngineId
+
+default <none>, security engineID, will be probed if not
+supplied (v3)
+
+=item ContextEngineId
+
+default <SecEngineId>, context engineID, will be
+probed if not supplied (v3)
+
+=item Context
+
+default '', context name (v3)
+
+=item AuthProto
+
+default 'MD5', authentication protocol [MD5, SHA] (v3)
+
+=item AuthPass
+
+default <none>, authentication passphrase
+
+=item PrivProto
+
+default 'DES', privacy protocol [DES] (v3)
+
+=item PrivPass
+
+default <none>, privacy passphrase (v3)
+
+=item VarFormats
+
+default 'undef', used by 'fget[next]', holds an hash
+reference of output value formatters, (e.g., {<obj> =>
+<sub-ref>, ... }, <obj> must match the <obj> and format
+used in the get operation. A special <obj>, '*', may be
+used to apply all <obj>s, the supplied sub is called to
+translate the value to a new format. The sub is called
+passing the Varbind as the arg
+
+=item TypeFormats
+
+default 'undef', used by 'fget[next]', holds an hash
+reference of output value formatters, (e.g., {<type> =>
+<sub-ref>, ... }, the supplied sub is called to translate
+the value to a new format, unless a VarFormat mathces first
+(e.g., $sess->{TypeFormats}{INTEGER} = \&mapEnum();
+although this can be done more efficiently by enabling
+$SNMP::use_enums or session creation param 'UseEnums')
+
+=item UseLongNames
+
+defaults to the value of SNMP::use_long_names at time
+of session creation. set to non-zero to have <tags>
+for 'getnext' methods generated preferring longer Mib name
+convention (e.g., system.sysDescr vs just sysDescr)
+
+=item UseSprintValue
+
+defaults to the value of SNMP::use_sprint_value at time
+of session creation. set to non-zero to have return values
+for 'get' and 'getnext' methods formatted with the libraries
+snprint_value function. This will result in certain data types
+being returned in non-canonical format Note: values returned
+with this option set may not be appropriate for 'set' operations
+(see discussion of value formats in <vars> description section)
+
+=item UseEnums
+
+defaults to the value of SNMP::use_enums at time of session
+creation. set to non-zero to have integer return values
+converted to enumeration identifiers if possible, these values
+will also be acceptable when supplied to 'set' operations
+
+=item UseNumeric
+
+defaults to the value of SNMP::use_numeric at time of session
+creation. set to non-zero to have <tags> for get methods returned
+as numeric OID's rather than descriptions.  UseLongNames will be
+set so that the full OID is returned to the caller.
+
+=item ErrorStr
+
+read-only, holds the error message assoc. w/ last request
+
+=item ErrorNum
+
+read-only, holds the snmp_err or staus of last request
+
+=item ErrorInd
+
+read-only, holds the snmp_err_index when appropriate
+
+=back
+
+Private variables:
+
+=over
+
+=item DestAddr
+
+internal field used to hold the translated DestHost field
+
+=item SessPtr
+
+internal field used to cache a created session structure
+
+=back
+
+=head2 SNMP::Session methods
+
+=over
+
+=item $sess->update(E<lt>fieldsE<gt>)
+
+Updates the SNMP::Session object with the values fields
+passed in as a hash list (similar to new(E<lt>fieldsE<gt>))
+B<(WARNING! not fully implemented)>
+
+=item $sess->get(E<lt>varsE<gt> [,E<lt>callbackE<gt>])
+
+do SNMP GET, multiple <vars> formats accepted.
+for syncronous operation <vars> will be updated
+with value(s) and type(s) and will also return
+retrieved value(s). If <callback> supplied method
+will operate asyncronously
+
+=item $sess->fget(E<lt>varsE<gt> [,E<lt>callbackE<gt>])
+
+do SNMP GET like 'get' and format the values according
+the handlers specified in $sess->{VarFormats} and
+$sess->{TypeFormats}
+
+=item $sess->getnext(E<lt>varsE<gt> [,E<lt>callbackE<gt>])
+
+do SNMP GETNEXT, multiple <vars> formats accepted,
+returns retrieved value(s), <vars> passed as arguments are
+updated to indicate next lexicographical <obj>,<iid>,<val>,
+and <type>
+
+Note: simple string <vars>,(e.g., 'sysDescr.0')
+form is not updated. If <callback> supplied method
+will operate asyncronously
+
+=item $sess->fgetnext(E<lt>varsE<gt> [,E<lt>callbackE<gt>])
+
+do SNMP GETNEXT like getnext and format the values according
+the handlers specified in $sess->{VarFormats} and
+$sess->{TypeFormats}
+
+=item $sess->set(E<lt>varsE<gt> [,E<lt>callbackE<gt>])
+
+do SNMP SET, multiple <vars> formats accepted.
+the value field in all <vars> formats must be in a canonical
+format (i.e., well known format) to ensure unambiguous
+translation to SNMP MIB data value (see discussion of
+canonical value format <vars> description section),
+returns snmp_errno. If <callback> supplied method
+will operate asyncronously
+
+=item $sess->getbulk(E<lt>non-repeatersE<gt>, E<lt>max-repeatersE<gt>, E<lt>varsE<gt>)
+
+do an SNMP GETBULK, from the list of Varbinds, the single
+next lexico instance is fetched for the first n Varbinds
+as defined by <non-repeaters>. For remaining Varbinds,
+the m lexico instances are retrieved each of the remaining
+Varbinds, where m is <max-repeaters>.
+
+=item $sess->bulkwalk(E<lt>non-repeatersE<gt>, E<lt>max-repeatersE<gt>, E<lt>varsE<gt> [,E<lt>callbackE<gt>])
+
+Do a "bulkwalk" of the list of Varbinds.  This is done by
+sending a GETBULK request (see getbulk() above) for the
+Varbinds.  For each requested variable, the response is
+examined to see if the next lexico instance has left the
+requested sub-tree.  Any further instances returned for
+this variable are ignored, and the walk for that sub-tree
+is considered complete.
+
+If any sub-trees were not completed when the end of the
+responses is reached, another request is composed, consisting
+of the remaining variables.  This process is repeated until
+all sub-trees have been completed, or too many packets have
+been exchanged (to avoid loops).
+
+The bulkwalk() method returns an array containing an array of
+Varbinds, one for each requested variable, in the order of the
+variable requests.  Upon error, bulkwalk() returns undef and
+sets $sess->ErrorStr and $sess->ErrorNum.  If a callback is
+supplied, bulkwalk() returns the SNMP request id, and returns
+immediately.  The callback will be called with the supplied
+argument list and the returned variables list.
+
+Note: Because the client must "discover" that the tree is
+complete by comparing the returned variables with those that
+were requested, there is a potential "gotcha" when using the
+max-repeaters value.  Consider the following code to print a
+list of interfaces and byte counts:
+
+    $numInts = $sess->get('ifNumber.0');
+    ($desc, $in, $out) = $sess->bulkwalk(0, $numInts,
+		  [['ifDescr'], ['ifInOctets'], ['ifOutOctets']]);
+
+    for $i (0..($numInts - 1)) {
+        printf "Interface %4s: %s inOctets, %s outOctets\n",
+                  $$desc[$i]->val, $$in[$i]->val, $$out[$i]->val;
+    }
+
+This code will produce *two* requests to the agent -- the first
+to get the interface values, and the second to discover that all
+the information was in the first packet.  To get around this,
+use '$numInts + 1' for the max_repeaters value.  This asks the
+agent to include one additional (unrelated) variable that signals
+the end of the sub-tree, allowing bulkwalk() to determine that
+the request is complete.
+
+=back
+
+=head1 SNMP::TrapSession
+
+$sess = new SNMP::Session(DestHost => 'host', ...)
+
+supports all applicable fields from SNMP::Session
+(see above)
+
+=head2 SNMP::TrapSession methods
+
+=over
+
+=item $sess->trap(enterprise, agent, generic, specific, uptime, <vars>)
+
+    $sess->trap(enterprise=>'.1.3.6.1.4.1.2021', # or 'ucdavis' [default]
+                agent => '127.0.0.1', # or 'localhost',[dflt 1st intf on host]
+                generic => specific,  # can be omitted if 'specific' supplied
+                specific => 5,        # can be omitted if 'generic' supplied
+                uptime => 1234,       # dflt to localhost uptime (0 on win32)
+                [[ifIndex, 1, 1],[sysLocation, 0, "here"]]); # optional vars
+                                                             # always last
+
+=item trap(oid, uptime, <vars>) - v2 format
+
+    $sess->trap(oid => 'snmpRisingAlarm',
+                uptime => 1234,
+                [[ifIndex, 1, 1],[sysLocation, 0, "here"]]); # optional vars
+                                                             # always last
+
+=back
+
+=head1 Acceptable variable formats:
+
+<vars> may be one of the following forms:
+
+=over
+
+=item SNMP::VarList
+
+represents an array of MIB objects to get or set,
+implemented as a blessed reference to an array of
+SNMP::Varbinds, (e.g., [<varbind1>, <varbind2>, ...])
+
+=item SNMP::Varbind
+
+represents a single MIB object to get or set, implemented as
+a blessed reference to a 4 element array;
+[<obj>, <iid>, <val>, <type>].
+
+=over
+
+=item <obj>
+
+one of the following forms:
+
+=over
+
+=item 1)
+
+leaf identifier (e.g., 'sysDescr') assumed to be
+unique for practical purposes
+
+=item 2)
+
+fully qualified identifier (e.g.,
+'.iso.org.dod.internet.mgmt.mib-2.system.sysDescr')
+
+=item 3)
+
+fully qualified, dotted-decimal, numeric OID (e.g.,
+'.1.3.6.1.2.1.1.1')
+
+=back
+
+=item <iid>
+
+the dotted-decimal, instance identifier. for
+scalar MIB objects use '0'
+
+=item <val>
+
+the SNMP data value retrieved from or being set
+to the agents MIB. for (f)get(next) operations
+<val> may have a variety of formats as determined by
+session and package settings. However for set
+operations the <val> format must be canonical to
+ensure unambiguous translation. The canonical forms
+are as follows:
+
+=over
+
+=item OBJECTID
+
+dotted-decimal (e.g., .1.3.6.1.2.1.1.1)
+
+=item OCTETSTR
+
+perl scalar containing octets
+
+=item INTEGER
+
+decimal signed integer (or enum)
+
+=item NETADDR
+
+dotted-decimal
+
+=item IPADDR
+
+dotted-decimal
+
+=item COUNTER
+
+decimal unsigned integer
+
+=item COUNTER64
+
+decimal unsigned integer
+
+=item GAUGE
+
+decimal unsigned integer
+
+=item UINTEGER
+
+decimal unsigned integer
+
+=item TICKS
+
+decimal unsigned integer
+
+=item OPAQUE
+
+perl scalar containing octets
+
+=item NULL
+
+perl scalar containing nothing
+
+=back
+
+=item <type>
+
+SNMP data type (see list above), this field is
+populated by 'get' and 'getnext' operations. In
+some cases the programmer needs to populate this
+field when passing to a 'set' operation. this
+field need not be supplied when the attribute
+indicated by <tag> is already described by loaded
+Mib modules. for 'set's, if a numeric OID is used
+and the object is not currently in the loaded Mib,
+the <type> field must be supplied
+
+=back
+
+=item simple string
+
+light weight form of <var> used to 'set' or 'get' a
+single attribute without constructing an SNMP::Varbind.
+stored in a perl scalar, has the form '<tag>.<iid>',
+(e.g., 'sysDescr.0'). for 'set' operations the value
+is passed as a second arg. Note: This argument form is
+not updated in get[next] operations as are the other forms.
+
+=back
+
+=head1 Acceptable callback formats
+
+<callback> may be one of the following forms:
+
+=over
+
+=item without arguments
+
+=over
+
+=item \&subname
+
+=item sub { ... }
+
+=back
+
+=item or with arguments
+
+=over
+
+=item [ \&subname, $arg1, ... ]
+
+=item [ sub { ... }, $arg1, ... ]
+
+=item [ "method", $obj, $arg1, ... ]
+
+=back
+
+=back
+
+callback will be called when response is received or timeout
+occurs. the last argument passed to callback will be a
+SNMP::VarList reference. In case of timeout the last argument
+will be undef.
+
+=over
+
+=item &SNMP::MainLoop([<timeout>, [<callback>]])
+
+to be used with async SNMP::Session
+calls. MainLoop must be called after initial async calls
+so return packets from the agent will not be processed.
+If no args suplied this function enters an infinite loop
+so program must be exited in a callback or externally
+interupted. If <timeout(sic)
+
+=item &SNMP::finish()
+
+This function, when called from an SNMP::MainLoop() callback
+function, will cause the current SNMP::MainLoop() to return
+after the callback is completed.  finish() can be used to
+terminate an otherwise-infinite MainLoop.  A new MainLoop()
+instance can then be started to handle further requests.
+
+=back
+
+=head1 SNMP package variables and functions
+
+=over
+
+=item $SNMP::VERSION
+
+the current version specifier (e.g., 3.1.0)
+
+=item $SNMP::auto_init_mib
+
+default '1', set to 0 to disable automatic reading
+of the MIB upon session creation. set to non-zero
+to call initMib at session creation which will result
+in MIB loading according to UCD env. variables (see
+man mib_api)
+
+=item $SNMP::verbose
+
+default '0', controls warning/info output of
+SNMP module, 0 => no output, 1 => enables warning/info
+output from SNMP module itself (is also controlled
+by SNMP::debugging - see below)
+
+=item $SNMP::use_long_names
+
+default '0', set to non-zero to enable the use of
+longer Mib identifiers. see translateObj. will also
+influence the formatting of <tag> in varbinds returned
+from 'getnext' operations. Can be set on a per session
+basis (UseLongNames)
+
+=item $SNMP::use_sprint_value
+
+default '0', set to non-zero to enable formatting of
+response values using the snmp libraries snprint_value
+function. can also be set on a per session basis (see
+UseSprintValue) Note: returned values may not be
+suitable for 'set' operations
+
+=item $SNMP::use_enums
+
+default '0',set non-zero to return values as enums and
+allow sets using enums where appropriate. integer data
+will still be accepted for set operations. can also be
+set on a per session basis (see UseEnums)
+
+=item $SNMP::use_numeric
+
+default to '0',set to non-zero to have <tags> for 'get'
+methods returned as numeric OID's rather than descriptions.
+UseLongNames will be set so that the entire OID will be
+returned.  Set on a per-session basis (see UseNumeric).
+
+=item $SNMP::save_descriptions
+
+default '0',set non-zero to have mib parser save
+attribute descriptions. must be set prior to mib
+initialization
+
+=item $SNMP::debugging
+
+default '0', controlls debugging output level
+within SNMP module and libsnmp
+
+=over
+
+=item 1
+
+enables 'SNMP::verbose' (see above)
+
+=item 2
+
+level 1 plus snmp_set_do_debugging(1)
+
+=item 3
+
+level 2 plus snmp_set_dump_packet(1)
+
+=back
+
+=item $SNMP::dump_packet
+
+default '0', set [non-]zero to independently set
+snmp_set_dump_packet()
+
+=back
+
+=head1 %SNMP::MIB
+
+a tied hash to access parsed MIB information. After
+the MIB has been loaded this hash allows access to
+to the parsed in MIB meta-data(the structure of the
+MIB (i.e., schema)). The hash returns blessed
+references to SNMP::MIB::NODE objects which represent
+a single MIB attribute. The nodes can be fetched with
+multiple 'key' formats - the leaf name (e.g.,sysDescr)
+or fully/partially qualified name (e.g.,
+system.sysDescr) or fully qualified numeric OID. The
+returned node object supports the following fields:
+
+=over
+
+=item objectID
+
+dotted decimal fully qualified OID
+
+=item label
+
+leaf textual identifier (e.g., 'sysDescr')
+
+=item subID
+
+leaf numeric OID component of objectID (e.g., '1')
+
+=item moduleID
+
+textual identifier for module (e.g., 'RFC1213-MIB')
+
+=item parent
+
+parent node
+
+=item children
+
+array reference of children nodes
+
+=item nextNode
+
+next lexico node B<(BUG!does not return in lexico order)>
+
+=item type
+
+returns application type (see getType for values)
+
+=item access
+
+returns ACCESS (ReadOnly, ReadWrite, WriteOnly,
+NoAccess, Notify, Create)
+
+=item status
+
+returns STATUS (Mandatory, Optional, Obsolete,
+Deprecated)
+
+=item syntax
+
+returns 'textualConvention' if defined else 'type'
+
+=item textualConvention
+
+returns TEXTUAL-CONVENTION
+
+=item units
+
+returns UNITS
+
+=item hint
+
+returns HINT
+
+=item enums
+
+returns hash ref {tag => num, ...}
+
+=item ranges
+
+returns array ref of hash ref [{low => num, high => num}, ...]
+
+=item description
+
+returns DESCRIPTION ($SNMP::save_descriptions must
+be set prior to MIB initialization/parsing)
+
+=back
+
+=head1 MIB Functions
+
+=over
+
+=item &SNMP::setMib(<file>)
+
+allows dynamic parsing of the mib and explicit
+specification of mib file independent of enviroment
+variables. called with no args acts like initMib,
+loading MIBs indicated by environment variables (see
+ucd mib_api docs). passing non-zero second arg
+forces previous mib to be freed and replaced
+B<(Note: second arg not working since freeing previous
+Mib is more involved than before)>.
+
+=item &SNMP::initMib()
+
+calls library init_mib function if Mib not already
+loaded - does nothing if Mib already loaded. will
+parse directories and load modules according to
+environment variables described in UCD documentations.
+(see man mib_api, MIBDIRS, MIBS, MIBFILE(S), etc.)
+
+=item &SNMP::addMibDirs(<dir>,...)
+
+calls library add_mibdir for each directory
+supplied. will cause directory(s) to be added to
+internal list and made available for searching in
+subsequent loadModules calls
+
+=item &SNMP::addMibFiles(<file>,...)
+
+calls library read_mib function. The file(s)
+supplied will be read and all Mib module definitions
+contained therein will be added to internal mib tree
+structure
+
+=item &SNMP::loadModules(<mod>,...)
+
+calls library read_module function. The
+module(s) supplied will be searched for in the
+current mibdirs and and added to internal mib tree
+structure. Passing special <mod>, 'ALL', will cause
+all known modules to be loaded.
+
+=item &SNMP::unloadModules(<mod>,...)
+
+B<*Not Implemented*>
+
+=item &SNMP::translateObj(<var>[,arg])
+
+will convert a text obj tag to an OID and
+vice-versa. any iid suffix is retained numerically.
+default behaviour when converting a numeric OID
+to text form is to return leaf indentifier only
+(e.g.,'sysDescr') but when $SNMP::use_long_names
+is non-zero or a non-zero second arg is supplied
+will return longer textual identifier. If no Mib
+is loaded when called and $SNMP::auto_init_mib is
+enabled then the Mib will be loaded. Will return
+'undef' upon failure.
+
+=item &SNMP::getType(<var>)
+
+return SNMP data type for given textual identifier
+OBJECTID, OCTETSTR, INTEGER, NETADDR, IPADDR, COUNTER
+GAUGE, TIMETICKS, OPAQUE, or undef
+
+=item &SNMP::mapEnum(<var>)
+
+converts integer value to enumertion tag defined
+in Mib or converts tag to integer depending on
+input. the function will return the corresponding
+integer value *or* tag for a given MIB attribute
+and value. The function will sense which direction
+to perform the conversion. Various arg formats are
+supported
+
+=over
+
+=item $val = SNMP::mapEnum($varbind);
+
+where $varbind is SNMP::Varbind or equiv.
+note: $varbind will be updated
+
+=item $val = SNMP::mapEnum('ipForwarding', 'forwarding');
+
+=item $val = SNMP::mapEnum('ipForwarding', 1);
+
+=back
+
+=back
+
+=head1 Exported SNMP utility functions
+
+Note: utility functions do not support async operation yet.
+
+=over
+
+=item &snmp_get()
+
+takes args of SNMP::Session::new followed by those of
+SNMP::Session::get
+
+=item &snmp_getnext()
+
+takes args of SNMP::Session::new followed by those of
+SNMP::Session::getnext
+
+=item &snmp_set()
+
+takes args of SNMP::Session::new followed by those of
+SNMP::Session::set
+
+=item &snmp_trap()
+
+takes args of SNMP::TrapSession::new followed by those of
+SNMP::TrapSession::trap
+
+=back
+
+=head1 Trouble Shooting
+
+If problems occur there are number areas to look at to narrow down the
+possibilities.
+
+The first step should be to test the UCD SNMP installation
+independently from the Perl5 SNMP interface.
+
+Try running the apps from the UCD SNMP distribution.
+
+Make sure your agent (snmpd) is running and properly configured with
+read-write access for the community you are using.
+
+Ensure that your MIBs are installed and enviroment variables are set
+appropriately (see man mib_api)
+
+Be sure to remove old ucd-snmp installations and ensure headers and
+libraries from old CMU installations are not being used by mistake.
+
+If the problem occurs during compilation/linking check that the snmp
+library being linked is actually the UCD SNMP library (there have been
+name conflicts with existing snmp libs).
+
+Also check that the header files are correct and up to date.
+
+Sometimes compiling the UCD SNMP library with
+'position-independent-code' enabled is required (HPUX specifically).
+
+If you cannot resolve the problem you can post to
+comp.lang.perl.modules or
+net-snmp-users@net-snmp-users@lists.sourceforge.net
+
+please give sufficient information to analyze the problem (OS type,
+versions for OS/Perl/UCD/compiler, complete error output, etc.)
+
+=head1 Acknowledments
+
+Many thanks to all those who supplied patches, suggestions and
+feedback.
+
+ Joe Marzot (the original author)
+ Wes Hardaker and the net-snmp-coders
+ Dave Perkins
+ Marcel Wiget
+ David Blackburn
+ John Stofell
+ Gary Hayward
+ Claire Harrison
+ Achim Bohnet
+ Doug Kingston
+ Jacques Vidrine
+ Carl Jacobsen
+ Wayne Marquette
+ Scott Schumate
+ Michael Slifcak
+ Perl5 Porters
+
+Apologies to any/all who's patch/feature/request was not mentioned or
+included - most likely it was lost when paying work intruded on my
+fun. Please try again if you do not see a desired feature. This may
+actually turn out to be a decent package with such excellent help and
+the fact that I have more time to work on it than in the past.
+
+=head1 AUTHOR
+
+bugs, comments, questions to net-snmp-users@lists.sourceforge.net
+
+=head1 Copyright
+
+     Copyright (c) 1995-2000 G. S. Marzot. All rights reserved.
+     This program is free software; you can redistribute it and/or
+     modify it under the same terms as Perl itself.
+
+     Copyright (c) 2001-2002 Networks Associates Technology, Inc.  All
+     Rights Reserved.  This program is free software; you can
+     redistribute it and/or modify it under the same terms as Perl
+     itself.
+=cut
diff -Naur tomato/release/src/router/snmp/perl/SNMP/SNMP.xs tomato121/release/src/router/snmp/perl/SNMP/SNMP.xs
--- tomato/release/src/router/snmp/perl/SNMP/SNMP.xs	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/perl/SNMP/SNMP.xs	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,5024 @@
+/* -*- C -*-
+     SNMP.xs -- Perl 5 interface to the UCD SNMP toolkit
+
+     written by G. S. Marzot (gmarzot@nortelnetworks.com)
+
+     Copyright (c) 1995-1999 G. S. Marzot. All rights reserved.
+     This program is free software; you can redistribute it and/or
+     modify it under the same terms as Perl itself.
+*/
+#define WIN32SCK_IS_STDSCK
+#include "EXTERN.h"
+#include "perl.h"
+#include "XSUB.h"
+
+#include <sys/types.h>
+#include <arpa/inet.h>
+#include <errno.h>
+#ifndef MSVC_PERL
+	#include <signal.h>
+#endif
+#include <stdio.h>
+#include <ctype.h>
+#ifdef I_SYS_TIME
+#include <sys/time.h>
+#endif
+#include <netdb.h>
+#include <stdlib.h>
+#ifndef MSVC_PERL
+	#include <unistd.h>
+#endif
+/* XXX This is a problem if regex.h is not on the system. */
+#include <regex.h>
+
+#ifndef __P
+#define __P(x) x
+#endif
+
+#ifndef na
+#define na PL_na
+#endif
+
+#ifndef sv_undef
+#define sv_undef PL_sv_undef
+#endif
+
+#ifndef stack_base
+#define stack_base PL_stack_base
+#endif
+
+#ifndef G_VOID
+#define G_VOID G_DISCARD
+#endif
+
+#ifdef WIN32
+#define SOCK_STARTUP winsock_startup()
+#define SOCK_CLEANUP winsock_cleanup()
+#define DLL_IMPORT   __declspec( dllimport )
+#define strcasecmp _stricmp
+#define strncasecmp _strnicmp
+#else
+#define SOCK_STARTUP
+#define SOCK_CLEANUP
+#define DLL_IMPORT
+#endif
+
+DLL_IMPORT extern struct tree *Mib;
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+
+#include "perlsnmp.h"
+
+#define SUCCESS 1
+#define FAILURE 0
+
+#define ZERO_BUT_TRUE "0 but true"
+
+#define VARBIND_TAG_F 0
+#define VARBIND_IID_F 1
+#define VARBIND_VAL_F 2
+#define VARBIND_TYPE_F 3
+
+#define TYPE_UNKNOWN 0
+#define MAX_TYPE_NAME_LEN 16
+#define STR_BUF_SIZE 1024
+#define ENG_ID_BUF_SIZE 32
+
+#define SYS_UPTIME_OID_LEN 9
+#define SNMP_TRAP_OID_LEN 11
+#define NO_RETRY_NOSUCH 0
+static oid sysUpTime[SYS_UPTIME_OID_LEN] = {1, 3, 6, 1, 2, 1, 1, 3, 0};
+static oid snmpTrapOID[SNMP_TRAP_OID_LEN] = {1, 3, 6, 1, 6, 3, 1, 1, 4, 1, 0};
+
+/* Internal flag to determine snmp_main_loop() should return after callback */
+static int mainloop_finish = 0;
+
+/* these should be part of transform_oids.h ? */
+#define USM_AUTH_PROTO_MD5_LEN 10
+#define USM_AUTH_PROTO_SHA_LEN 10
+#define USM_PRIV_PROTO_DES_LEN 10
+
+/* why does ucd-snmp redefine sockaddr_in ??? */
+#define SIN_ADDR(snmp_addr) (((struct sockaddr_in *) &(snmp_addr))->sin_addr)
+
+typedef netsnmp_session SnmpSession;
+typedef struct tree SnmpMibNode;
+typedef struct snmp_xs_cb_data {
+    SV* perl_cb;
+    SV* sess_ref;
+} snmp_xs_cb_data;
+
+static void __recalc_timeout _((struct timeval*,struct timeval*,
+                                struct timeval*,struct timeval*, int* ));
+static in_addr_t __parse_address _((char*));
+static int __is_numeric_oid _((char*));
+static int __is_leaf _((struct tree*));
+static int __translate_appl_type _((char*));
+static int __translate_asn_type _((int));
+static int __snprint_value _((char *, size_t,
+                              netsnmp_variable_list*, struct tree *,
+                             int, int));
+static int __sprint_num_objid _((char *, oid *, int));
+static int __scan_num_objid _((char *, oid *, int *));
+static int __get_type_str _((int, char *));
+static int __get_label_iid _((char *, char **, char **, int));
+static int __oid_cmp _((oid *, int, oid *, int));
+static int __tp_sprint_num_objid _((char*,SnmpMibNode *));
+static SnmpMibNode * __get_next_mib_node _((SnmpMibNode *));
+static struct tree * __oid2tp _((oid*, int, struct tree *, int*));
+static struct tree * __tag2oid _((char *, char *, oid  *, int  *, int *, int));
+static int __concat_oid_str _((oid *, int *, char *));
+static int __add_var_val_str _((netsnmp_pdu *, oid *, int, char *,
+                                 int, int));
+static int __send_sync_pdu _((netsnmp_session *, netsnmp_pdu *,
+                              netsnmp_pdu **, int , SV *, SV *, SV *));
+static int __snmp_xs_cb __P((int, netsnmp_session *, int,
+                             netsnmp_pdu *, void *));
+static int __callback_wrapper __P((int, netsnmp_session *, int,
+	                             netsnmp_pdu *, void *));
+static SV* __push_cb_args2 _((SV * sv, SV * esv, SV * tsv));
+#define __push_cb_args(a,b) __push_cb_args2(a,b,NULL)
+static int __call_callback _((SV * sv, int flags));
+static char* __av_elem_pv _((AV * av, I32 key, char *dflt));
+static u_int compute_match _((const char *, const char *));
+
+#define USE_NUMERIC_OIDS 0x08
+#define NON_LEAF_NAME 0x04
+#define USE_LONG_NAMES 0x02
+#define FAIL_ON_NULL_IID 0x01
+#define NO_FLAGS 0x00
+
+/* Structures used by snmp_bulkwalk method to track requested OID's/subtrees. */
+typedef struct bulktbl {
+   oid	req_oid[MAX_OID_LEN];	/* The OID originally requested.    */
+   oid	last_oid[MAX_OID_LEN];	/* Last-seen OID under this branch. */
+   AV	*vars;			/* Array of Varbinds for this OID.  */
+   char	req_len;		/* Length of requested OID.         */
+   char	last_len;		/* Length of last-seen OID.         */
+   char norepeat;		/* Is this a non-repeater OID?      */
+   char	complete;		/* Non-zero if this tree complete.  */
+   char	ignore;			/* Ignore this OID, not requested.  */
+} bulktbl;
+
+/* Context for bulkwalk() sessions.  Used to store state across callbacks. */
+typedef struct walk_context {
+   SV		*sess_ref;	/* Reference to Perl SNMP session object.   */
+   SV		*perl_cb;	/* Pointer to Perl callback func or array.  */
+   bulktbl	*req_oids;	/* Pointer to bulktbl[] for requested OIDs. */
+   bulktbl	*repbase;	/* Pointer to first repeater in req_oids[]. */
+   bulktbl	*reqbase;	/* Pointer to start of requests req_oids[]. */
+   int	  	nreq_oids;	/* Number of valid bulktbls in req_oids[].  */
+   int	  	req_remain;	/* Number of outstanding requests remaining */
+   int		non_reps;	/* Number of nonrepeater vars in req_oids[] */
+   int		repeaters;	/* Number of repeater vars in req_oids[].   */
+   int		max_reps;	/* Maximum repetitions of variable per PDU. */
+   int		exp_reqid;	/* Expect a response to this request only.  */
+   int		getlabel_f;	/* Flag long/numeric names for get_label(). */
+   int		sprintval_f;	/* Flag enum/sprint values for sprintval(). */
+   int		pkts_exch;	/* Number of packet exchanges with agent.   */
+   int		oid_total;	/* Total number of OIDs received this walk. */
+   int		oid_saved;	/* Total number of OIDs saved as results.   */
+} walk_context;
+
+/* Prototypes for bulkwalk support functions. */
+static netsnmp_pdu *_bulkwalk_send_pdu _((walk_context *context));
+static int _bulkwalk_done     _((walk_context *context));
+static int _bulkwalk_recv_pdu _((walk_context *context, netsnmp_pdu *pdu));
+static int _bulkwalk_finish   _((walk_context *context, int okay));
+static int _bulkwalk_async_cb _((int op, SnmpSession *ss, int reqid,
+				     netsnmp_pdu *pdu, void *context_ptr));
+
+/* Structure to hold valid context sessions. */
+struct valid_contexts {
+   walk_context	**valid;	/* Array of valid walk_context pointers.    */
+   int		sz_valid;	/* Maximum size of valid contexts array.    */
+   int		num_valid;	/* Count of valid contexts in the array.    */
+};
+static struct valid_contexts  *_valid_contexts = NULL;
+static int _context_add       _((walk_context *context));
+static int _context_del       _((walk_context *context));
+static int _context_okay      _((walk_context *context));
+
+/* Wrapper around fprintf(stderr, ...) for clean and easy debug output. */
+#ifdef	DEBUGGING
+static int _debug_level = 0;
+#define DBOUT PerlIO_stderr(),
+#define	DBPRT(severity, otherargs)					\
+	do {								\
+	    if (_debug_level && severity <= _debug_level) {		\
+		(void)PerlIO_fprintf(PerlIO_stderr(), otherargs);		\
+	    }								\
+	} while (/*CONSTCOND*/0)
+
+char	_debugx[1024];	/* Space to sprintf() into - used by sprint_objid(). */
+
+#else	/* DEBUGGING */
+#define DBOUT
+#define	DBPRT(severity, otherargs)	/* Ignore */
+
+#endif	/* DEBUGGING */
+
+void
+__libraries_init(char *appname)
+    {
+        static int have_inited = 0;
+
+        if (have_inited)
+            return;
+        have_inited = 1;
+
+        snmp_set_quick_print(1);
+        init_snmp(appname);
+    
+        netsnmp_ds_set_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_DONT_BREAKDOWN_OIDS, 1);
+        netsnmp_ds_set_int(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_PRINT_SUFFIX_ONLY, 1);
+
+        SOCK_STARTUP;
+    
+    }
+
+static void
+__recalc_timeout (tvp, ctvp, ltvp, itvp, block)
+struct timeval* tvp;
+struct timeval* ctvp;
+struct timeval* ltvp;
+struct timeval* itvp;
+int *block;
+{
+   struct timeval now;
+
+   if (!timerisset(itvp)) return;  /* interval zero means loop forever */
+   *block = 0;
+   gettimeofday(&now,(struct timezone *)0);
+
+   if (ctvp->tv_sec < 0) { /* first time or callback just fired */
+      timersub(&now,ltvp,ctvp);
+      timersub(ctvp,itvp,ctvp);
+      timersub(itvp,ctvp,ctvp);
+      timeradd(ltvp,itvp,ltvp);
+   } else {
+      timersub(&now,ltvp,ctvp);
+      timersub(itvp,ctvp,ctvp);
+   }
+
+   /* flag is set for callback but still hasnt fired so set to something
+    * small and we will service packets first if there are any ready
+    * (also guard against negative timeout - should never happen?)
+    */
+   if (!timerisset(ctvp) || ctvp->tv_sec < 0 || ctvp->tv_usec < 0) {
+      ctvp->tv_sec = 0;
+      ctvp->tv_usec = 10;
+   }
+
+   /* if snmp timeout > callback timeout or no more requests to process */
+   if (timercmp(tvp, ctvp, >) || !timerisset(tvp)) {
+      *tvp = *ctvp; /* use the smaller non-zero timeout */
+      timerclear(ctvp); /* used as a flag to let callback fire on timeout */
+   }
+}
+
+static in_addr_t
+__parse_address(address)
+char *address;
+{
+    in_addr_t addr;
+    struct sockaddr_in saddr;
+    struct hostent *hp;
+
+    if ((addr = inet_addr(address)) != -1)
+	return addr;
+    hp = gethostbyname(address);
+    if (hp == NULL){
+        return (-1); /* error value */
+    } else {
+	memcpy(&saddr.sin_addr, hp->h_addr, hp->h_length);
+	return saddr.sin_addr.s_addr;
+    }
+
+}
+
+static int
+__is_numeric_oid (oidstr)
+char* oidstr;
+{
+  if (!oidstr) return 0;
+  for (; *oidstr; oidstr++) {
+     if (isalpha((int)*oidstr)) return 0;
+  }
+  return(1);
+}
+
+static int
+__is_leaf (tp)
+struct tree* tp;
+{
+   char buf[MAX_TYPE_NAME_LEN];
+   return (tp && __get_type_str(tp->type,buf));
+}
+
+static SnmpMibNode*
+__get_next_mib_node (tp)
+SnmpMibNode* tp;
+{
+   /* printf("tp = %lX, parent = %lX, peer = %lX, child = %lX\n",
+              tp, tp->parent, tp->next_peer, tp->child_list); */
+   if (tp->child_list) return(tp->child_list);
+   if (tp->next_peer) return(tp->next_peer);
+   if (!tp->parent) return(NULL);
+   for (tp = tp->parent; !tp->next_peer; tp = tp->parent) {
+      if (!tp->parent) return(NULL);
+   }
+   return(tp->next_peer);
+}
+
+static int
+__translate_appl_type(typestr)
+char* typestr;
+{
+	if (typestr == NULL || *typestr == '\0') return TYPE_UNKNOWN;
+
+	if (!strncasecmp(typestr,"INTEGER32",8))
+            return(TYPE_INTEGER32);
+	if (!strncasecmp(typestr,"INTEGER",3))
+            return(TYPE_INTEGER);
+	if (!strncasecmp(typestr,"UNSIGNED32",3))
+            return(TYPE_UNSIGNED32);
+	if (!strcasecmp(typestr,"COUNTER")) /* check all in case counter64 */
+            return(TYPE_COUNTER);
+	if (!strncasecmp(typestr,"GAUGE",3))
+            return(TYPE_GAUGE);
+	if (!strncasecmp(typestr,"IPADDR",3))
+            return(TYPE_IPADDR);
+	if (!strncasecmp(typestr,"OCTETSTR",3))
+            return(TYPE_OCTETSTR);
+	if (!strncasecmp(typestr,"TICKS",3))
+            return(TYPE_TIMETICKS);
+	if (!strncasecmp(typestr,"OPAQUE",3))
+            return(TYPE_OPAQUE);
+	if (!strncasecmp(typestr,"OBJECTID",3))
+            return(TYPE_OBJID);
+	if (!strncasecmp(typestr,"NETADDR",3))
+	    return(TYPE_NETADDR);
+	if (!strncasecmp(typestr,"COUNTER64",3))
+	    return(TYPE_COUNTER64);
+	if (!strncasecmp(typestr,"NULL",3))
+	    return(TYPE_NULL);
+	if (!strncasecmp(typestr,"BITS",3))
+	    return(TYPE_BITSTRING);
+	if (!strncasecmp(typestr,"ENDOFMIBVIEW",3))
+	    return(SNMP_ENDOFMIBVIEW);
+	if (!strncasecmp(typestr,"NOSUCHOBJECT",7))
+	    return(SNMP_NOSUCHOBJECT);
+	if (!strncasecmp(typestr,"NOSUCHINSTANCE",7))
+	    return(SNMP_NOSUCHINSTANCE);
+	if (!strncasecmp(typestr,"UINTEGER",3))
+	    return(TYPE_UINTEGER); /* historic - should not show up */
+                                   /* but it does?                  */
+	if (!strncasecmp(typestr, "NOTIF", 3))
+		return(TYPE_NOTIFTYPE);
+	if (!strncasecmp(typestr, "TRAP", 4))
+		return(TYPE_TRAPTYPE);
+        return(TYPE_UNKNOWN);
+}
+
+static int
+__translate_asn_type(type)
+int type;
+{
+   switch (type) {
+        case ASN_INTEGER:
+            return(TYPE_INTEGER);
+	    break;
+	case ASN_OCTET_STR:
+            return(TYPE_OCTETSTR);
+	    break;
+	case ASN_OPAQUE:
+            return(TYPE_OPAQUE);
+	    break;
+	case ASN_OBJECT_ID:
+            return(TYPE_OBJID);
+	    break;
+	case ASN_TIMETICKS:
+            return(TYPE_TIMETICKS);
+	    break;
+	case ASN_GAUGE:
+            return(TYPE_GAUGE);
+	    break;
+	case ASN_COUNTER:
+            return(TYPE_COUNTER);
+	    break;
+	case ASN_IPADDRESS:
+            return(TYPE_IPADDR);
+	    break;
+	case ASN_BIT_STR:
+            return(TYPE_BITSTRING);
+	    break;
+	case ASN_NULL:
+            return(TYPE_NULL);
+	    break;
+	/* no translation for these exception type values */
+	case SNMP_ENDOFMIBVIEW:
+	case SNMP_NOSUCHOBJECT:
+	case SNMP_NOSUCHINSTANCE:
+	    return(type);
+	    break;
+	case ASN_UINTEGER:
+            return(TYPE_UINTEGER);
+	    break;
+	case ASN_COUNTER64:
+            return(TYPE_COUNTER64);
+	    break;
+	default:
+            warn("translate_asn_type: unhandled asn type (%d)\n",type);
+            return(TYPE_OTHER);
+            break;
+        }
+}
+
+#define USE_BASIC 0
+#define USE_ENUMS 1
+#define USE_SPRINT_VALUE 2
+static int
+__snprint_value (buf, buf_len, var, tp, type, flag)
+char * buf;
+size_t buf_len;
+netsnmp_variable_list * var;
+struct tree * tp;
+int type;
+int flag;
+{
+   int len = 0;
+   u_char* ip;
+   struct enum_list *ep;
+
+
+   buf[0] = '\0';
+   if (flag == USE_SPRINT_VALUE) {
+	snprint_value(buf, buf_len, var->name, var->name_length, var);
+	len = strlen(buf);
+   } else {
+     switch (var->type) {
+        case ASN_INTEGER:
+           if (flag == USE_ENUMS) {
+              for(ep = tp->enums; ep; ep = ep->next) {
+                 if (ep->value == *var->val.integer) {
+                    strcpy(buf, ep->label);
+                    len = strlen(buf);
+                    break;
+                 }
+              }
+           }
+           if (!len) {
+              sprintf(buf,"%ld", *var->val.integer);
+              len = strlen(buf);
+           }
+           break;
+
+        case ASN_GAUGE:
+        case ASN_COUNTER:
+        case ASN_TIMETICKS:
+        case ASN_UINTEGER:
+           sprintf(buf,"%lu", (unsigned long) *var->val.integer);
+           len = strlen(buf);
+           break;
+
+        case ASN_OCTET_STR:
+        case ASN_OPAQUE:
+           memcpy(buf, (char*)var->val.string, var->val_len);
+           len = var->val_len;
+           break;
+
+        case ASN_IPADDRESS:
+          ip = (u_char*)var->val.string;
+          sprintf(buf, "%d.%d.%d.%d", ip[0], ip[1], ip[2], ip[3]);
+          len = strlen(buf);
+          break;
+
+        case ASN_NULL:
+           break;
+
+        case ASN_OBJECT_ID:
+          __sprint_num_objid(buf, (oid *)(var->val.objid),
+                             var->val_len/sizeof(oid));
+          len = strlen(buf);
+          break;
+
+	case SNMP_ENDOFMIBVIEW:
+          sprintf(buf,"%s", "ENDOFMIBVIEW");
+	  break;
+	case SNMP_NOSUCHOBJECT:
+	  sprintf(buf,"%s", "NOSUCHOBJECT");
+	  break;
+	case SNMP_NOSUCHINSTANCE:
+	  sprintf(buf,"%s", "NOSUCHINSTANCE");
+	  break;
+
+        case ASN_COUNTER64:
+          printU64(buf,(struct counter64 *)var->val.counter64);
+          len = strlen(buf);
+          break;
+
+        case ASN_BIT_STR:
+            snprint_bitstring(buf, sizeof(buf), var, NULL, NULL, NULL);
+            len = strlen(buf);
+            break;
+
+        case ASN_NSAP:
+        default:
+           warn("snprint_value: asn type not handled %d\n",var->type);
+     }
+   }
+   return(len);
+}
+
+static int
+__sprint_num_objid (buf, objid, len)
+char *buf;
+oid *objid;
+int len;
+{
+   int i;
+   buf[0] = '\0';
+   for (i=0; i < len; i++) {
+	sprintf(buf,".%lu",*objid++);
+	buf += strlen(buf);
+   }
+   return SUCCESS;
+}
+
+static int
+__tp_sprint_num_objid (buf, tp)
+char *buf;
+SnmpMibNode *tp;
+{
+   oid newname[MAX_OID_LEN], *op;
+   /* code taken from get_node in snmp_client.c */
+   for (op = newname + MAX_OID_LEN - 1; op >= newname; op--) {
+      *op = tp->subid;
+      tp = tp->parent;
+      if (tp == NULL) break;
+   }
+   return __sprint_num_objid(buf, op, newname + MAX_OID_LEN - op);
+}
+
+static int
+__scan_num_objid (buf, objid, len)
+char *buf;
+oid *objid;
+int *len;
+{
+   char *cp;
+   *len = 0;
+   if (*buf == '.') buf++;
+   cp = buf;
+   while (*buf) {
+      if (*buf++ == '.') {
+         sscanf(cp, "%lu", objid++);
+         /* *objid++ = atoi(cp); */
+         (*len)++;
+         cp = buf;
+      } else {
+         if (isalpha((int)*buf)) {
+	    return FAILURE;
+         }
+      }
+   }
+   sscanf(cp, "%lu", objid++);
+   /* *objid++ = atoi(cp); */
+   (*len)++;
+   return SUCCESS;
+}
+
+static int
+__get_type_str (type, str)
+int type;
+char * str;
+{
+   switch (type) {
+	case TYPE_OBJID:
+       		strcpy(str, "OBJECTID");
+	        break;
+	case TYPE_OCTETSTR:
+       		strcpy(str, "OCTETSTR");
+	        break;
+	case TYPE_INTEGER:
+       		strcpy(str, "INTEGER");
+	        break;
+	case TYPE_INTEGER32:
+       		strcpy(str, "INTEGER32");
+	        break;
+	case TYPE_UNSIGNED32:
+       		strcpy(str, "UNSIGNED32");
+	        break;
+	case TYPE_NETADDR:
+       		strcpy(str, "NETADDR");
+	        break;
+	case TYPE_IPADDR:
+       		strcpy(str, "IPADDR");
+	        break;
+	case TYPE_COUNTER:
+       		strcpy(str, "COUNTER");
+	        break;
+	case TYPE_GAUGE:
+       		strcpy(str, "GAUGE");
+	        break;
+	case TYPE_TIMETICKS:
+       		strcpy(str, "TICKS");
+	        break;
+	case TYPE_OPAQUE:
+       		strcpy(str, "OPAQUE");
+	        break;
+	case TYPE_COUNTER64:
+       		strcpy(str, "COUNTER64");
+	        break;
+	case TYPE_NULL:
+                strcpy(str, "NULL");
+                break;
+	case SNMP_ENDOFMIBVIEW:
+                strcpy(str, "ENDOFMIBVIEW");
+                break;
+	case SNMP_NOSUCHOBJECT:
+                strcpy(str, "NOSUCHOBJECT");
+                break;
+	case SNMP_NOSUCHINSTANCE:
+                strcpy(str, "NOSUCHINSTANCE");
+                break;
+	case TYPE_UINTEGER:
+                strcpy(str, "UINTEGER"); /* historic - should not show up */
+                                          /* but it does?                  */
+                break;
+	case TYPE_NOTIFTYPE:
+		strcpy(str, "NOTIF");
+		break;
+	case TYPE_BITSTRING:
+		strcpy(str, "BITS");
+		break;
+	case TYPE_TRAPTYPE:
+		strcpy(str, "TRAP");
+		break;
+	case TYPE_OTHER: /* not sure if this is a valid leaf type?? */
+	case TYPE_NSAPADDRESS:
+        default: /* unsupported types for now */
+           strcpy(str, "");
+           return(FAILURE);
+   }
+   return SUCCESS;
+}
+
+/* does a destructive disection of <label1>...<labeln>.<iid> returning
+   <labeln> and <iid> in seperate strings (note: will destructively
+   alter input string, 'name') */
+static int
+__get_label_iid (name, last_label, iid, flag)
+char * name;
+char ** last_label;
+char ** iid;
+int flag;
+{
+   char *lcp;
+   char *icp;
+   int len = strlen(name);
+   int found_label = 0;
+
+   *last_label = *iid = NULL;
+
+   if (len == 0) return(FAILURE);
+
+   /* Handle case where numeric oid's have been requested.  The input 'name'
+   ** in this case should be a numeric OID -- return failure if not.
+   */
+   if ((flag & USE_NUMERIC_OIDS)) {
+      if (!__is_numeric_oid(name))
+       return(FAILURE);
+
+      /* Walk backward through the string, looking for first two '.' chars */
+      lcp = &(name[len]);
+      icp = NULL;
+      while (lcp > name) {
+       if (*lcp == '.') {
+
+          /* If this is the first occurence of '.', note it in icp.
+          ** Otherwise, this must be the second occurrence, so break
+          ** out of the loop.
+          */
+          if (icp == NULL)
+             icp = lcp;
+          else
+             break;
+       }
+       lcp --;
+      }
+
+      /* Make sure we found at least a label and index. */
+      if (!icp)
+         return(FAILURE);
+
+      /* Push forward past leading '.' chars and separate the strings. */
+      lcp ++;
+      *icp ++ = '\0';
+
+      *last_label = (flag & USE_LONG_NAMES) ? name : lcp;
+      *iid        = icp;
+
+      return(SUCCESS);
+   }
+
+   lcp = icp = &(name[len]);
+
+   while (lcp > name) {
+      if (*lcp == '.') {
+	if (found_label) {
+	   lcp++;
+           break;
+        } else {
+           icp = lcp;
+        }
+      }
+      if (!found_label && isalpha((int)*lcp)) found_label = 1;
+      lcp--;
+   }
+
+   if (!found_label || (!isdigit((int)*(icp+1)) && (flag & FAIL_ON_NULL_IID)))
+      return(FAILURE);
+
+   if (flag & NON_LEAF_NAME) { /* dont know where to start instance id */
+     /* put the whole thing in label */
+     icp = &(name[len]);
+     flag |= USE_LONG_NAMES;
+     /* special hack in case no mib loaded - object identifiers will
+      * start with .iso.<num>.<num>...., in which case it is preferable
+      * to make the label entirely numeric (i.e., convert "iso" => "1")
+      */
+      if (*lcp == '.' && lcp == name) {
+         if (!strncmp(".ccitt.",lcp,7)) {
+            name += 2;
+            *name = '.';
+            *(name+1) = '0';
+         } else if (!strncmp(".iso.",lcp,5)) {
+            name += 2;
+            *name = '.';
+            *(name+1) = '1';
+         } else if (!strncmp(".joint-iso-ccitt.",lcp,17)) {
+            name += 2;
+            *name = '.';
+            *(name+1) = '2';
+         }
+      }
+   } else if (*icp) {
+      *(icp++) = '\0';
+   }
+   *last_label = (flag & USE_LONG_NAMES ? name : lcp);
+
+   *iid = icp;
+
+   return(SUCCESS);
+}
+
+
+static int
+__oid_cmp(oida_arr, oida_arr_len, oidb_arr, oidb_arr_len)
+oid *oida_arr;
+int oida_arr_len;
+oid *oidb_arr;
+int oidb_arr_len;
+{
+   for (;oida_arr_len && oidb_arr_len;
+	oida_arr++, oida_arr_len--, oidb_arr++, oidb_arr_len--) {
+	if (*oida_arr == *oidb_arr) continue;
+	return(*oida_arr > *oidb_arr ? 1 : -1);
+   }
+   if (oida_arr_len == oidb_arr_len) return(0);
+   return(oida_arr_len > oidb_arr_len ? 1 : -1);
+}
+
+#define MAX_BAD 0xffffff
+
+static u_int
+compute_match(search_base, key)
+const char *search_base;
+const char *key;
+{
+   int rc;
+   regex_t parsetree;
+   regmatch_t pmatch;
+
+   rc = regcomp(&parsetree, key, REG_ICASE | REG_EXTENDED);
+   if (rc == 0)
+      rc = regexec(&parsetree, search_base, 1, &pmatch, 0);
+   regfree(&parsetree);
+   if (rc == 0) {
+      return pmatch.rm_so;
+   }
+
+   return MAX_BAD;
+}
+
+static struct tree *
+__tag2oid(tag, iid, oid_arr, oid_arr_len, type, best_guess)
+char * tag;
+char * iid;
+oid  * oid_arr;
+int  * oid_arr_len;
+int  * type;
+int    best_guess;
+{
+   struct tree *tp = NULL;
+   struct tree *rtp = NULL;
+   DLL_IMPORT extern struct tree *tree_head;
+   oid newname[MAX_OID_LEN], *op;
+   int newname_len = 0;
+
+   if (type) *type = TYPE_UNKNOWN;
+   if (oid_arr_len) *oid_arr_len = 0;
+   if (!tag) goto done;
+
+   if (best_guess) {
+      tp = rtp = find_best_tree_node(tag, tree_head, NULL);
+      if (tp) {
+	 if (type) *type = tp->type;
+	 if ((oid_arr == NULL) || (oid_arr_len == NULL)) return rtp;
+	 for (op = newname + MAX_OID_LEN - 1; op >= newname; op--) {
+            *op = tp->subid;
+	    tp = tp->parent;
+	    if (tp == NULL)
+	       break;
+	 }
+	 *oid_arr_len = newname + MAX_OID_LEN - op;
+	 memcpy(oid_arr, op, *oid_arr_len * sizeof(oid));
+      }
+      return(rtp);
+   }
+
+   if (strchr(tag,'.')) { /* if multi part tag  */
+      if (!__scan_num_objid(tag, newname, &newname_len)) { /* numeric tag */
+         newname_len = MAX_OID_LEN;
+         read_objid(tag, newname, &newname_len); /* long name */
+      }
+      if (type) *type = (tp ? tp->type : TYPE_UNKNOWN);
+      if ((oid_arr == NULL) || (oid_arr_len == NULL)) return rtp;
+      memcpy(oid_arr,(char*)newname,newname_len*sizeof(oid));
+      *oid_arr_len = newname_len;
+   } else { /* else it is a leaf */
+      rtp = tp = find_node(tag, Mib);
+      if (tp) {
+         if (type) *type = tp->type;
+         if ((oid_arr == NULL) || (oid_arr_len == NULL)) return rtp;
+         /* code taken from get_node in snmp_client.c */
+         for(op = newname + MAX_OID_LEN - 1; op >= newname; op--){
+           *op = tp->subid;
+	   tp = tp->parent;
+	   if (tp == NULL)
+	      break;
+         }
+         *oid_arr_len = newname + MAX_OID_LEN - op;
+         memcpy(oid_arr, op, *oid_arr_len * sizeof(oid));
+      } else {
+         return(rtp);   /* HACK: otherwise, concat_oid_str confuses things */
+      }
+   }
+ done:
+   if (iid && *iid) __concat_oid_str(oid_arr, oid_arr_len, iid);
+   return(rtp);
+}
+/* searches down the mib tree for the given oid
+   returns the last found tp and its index in lastind
+ */
+static struct tree *
+__oid2tp (oidp, len, subtree, lastind)
+oid* oidp;
+int len;
+struct tree * subtree;
+int* lastind;
+{
+    struct tree    *return_tree = NULL;
+
+
+    for (; subtree; subtree = subtree->next_peer) {
+	if (*oidp == subtree->subid){
+	    goto found;
+	}
+    }
+    *lastind=0;
+    return NULL;
+
+found:
+    if (len > 1){
+       return_tree =
+          __oid2tp(oidp + 1, len - 1, subtree->child_list, lastind);
+       (*lastind)++;
+    } else {
+       *lastind=1;
+    }
+    if (return_tree)
+	return return_tree;
+    else
+	return subtree;
+}
+
+/* function: __concat_oid_str
+ *
+ * This function converts a dotted-decimal string, soid_str, to an array
+ * of oid types and concatenates them on doid_arr begining at the index
+ * specified by doid_arr_len.
+ *
+ * returns : SUCCESS, FAILURE
+ */
+static int
+__concat_oid_str(doid_arr, doid_arr_len, soid_str)
+oid *doid_arr;
+int *doid_arr_len;
+char * soid_str;
+{
+   char soid_buf[STR_BUF_SIZE];
+   char *cp;
+
+   if (!soid_str || !*soid_str) return SUCCESS;/* successfully added nothing */
+   if (*soid_str == '.') soid_str++;
+   strcpy(soid_buf, soid_str);
+   cp = strtok(soid_buf,".");
+   while (cp) {
+     sscanf(cp, "%lu", &(doid_arr[(*doid_arr_len)++]));
+     /* doid_arr[(*doid_arr_len)++] =  atoi(cp); */
+     cp = strtok(NULL,".");
+   }
+   return(SUCCESS);
+}
+
+/*
+ * add a varbind to PDU
+ */
+static int
+__add_var_val_str(pdu, name, name_length, val, len, type)
+    netsnmp_pdu *pdu;
+    oid *name;
+    int name_length;
+    char * val;
+    int len;
+    int type;
+{
+    netsnmp_variable_list *vars;
+    oid oidbuf[MAX_OID_LEN];
+    int ret = SUCCESS;
+    struct tree *tp;
+
+    if (pdu->variables == NULL){
+	pdu->variables = vars =
+           (netsnmp_variable_list *)calloc(1,sizeof(netsnmp_variable_list));
+    } else {
+	for(vars = pdu->variables;
+            vars->next_variable;
+            vars = vars->next_variable)
+	    /*EXIT*/;
+	vars->next_variable =
+           (netsnmp_variable_list *)calloc(1,sizeof(netsnmp_variable_list));
+	vars = vars->next_variable;
+    }
+
+    vars->next_variable = NULL;
+    vars->name = (oid *)malloc(name_length * sizeof(oid));
+    memcpy((char *)vars->name, (char *)name, name_length * sizeof(oid));
+    vars->name_length = name_length;
+    switch (type) {
+      case TYPE_INTEGER:
+      case TYPE_INTEGER32:
+        vars->type = ASN_INTEGER;
+        vars->val.integer = (long *)malloc(sizeof(long));
+        if (val)
+            *(vars->val.integer) = strtol(val,NULL,0);
+        else {
+            ret = FAILURE;
+            *(vars->val.integer) = 0;
+        }
+        vars->val_len = sizeof(long);
+        break;
+
+      case TYPE_GAUGE:
+      case TYPE_UNSIGNED32:
+        vars->type = ASN_GAUGE;
+        goto UINT;
+      case TYPE_COUNTER:
+        vars->type = ASN_COUNTER;
+        goto UINT;
+      case TYPE_TIMETICKS:
+        vars->type = ASN_TIMETICKS;
+        goto UINT;
+      case TYPE_UINTEGER:
+        vars->type = ASN_UINTEGER;
+UINT:
+        vars->val.integer = (long *)malloc(sizeof(long));
+        if (val)
+            sscanf(val,"%lu",vars->val.integer);
+        else {
+            ret = FAILURE;
+            *(vars->val.integer) = 0;
+        }
+        vars->val_len = sizeof(long);
+        break;
+
+      case TYPE_OCTETSTR:
+	vars->type = ASN_OCTET_STR;
+	goto OCT;
+
+      case TYPE_BITSTRING:
+	vars->type = ASN_OCTET_STR;
+	goto OCT;
+
+      case TYPE_OPAQUE:
+        vars->type = ASN_OCTET_STR;
+OCT:
+        vars->val.string = (u_char *)malloc(len);
+        vars->val_len = len;
+        if (val && len)
+            memcpy((char *)vars->val.string, val, len);
+        else {
+            ret = FAILURE;
+            vars->val.string = strdup("");
+            vars->val_len = 0;
+        }
+        break;
+
+      case TYPE_IPADDR:
+        vars->type = ASN_IPADDRESS;
+        vars->val.integer = (long *)malloc(sizeof(long));
+        if (val)
+            *(vars->val.integer) = inet_addr(val);
+        else {
+            ret = FAILURE;
+            *(vars->val.integer) = 0;
+        }
+        vars->val_len = sizeof(long);
+        break;
+
+      case TYPE_OBJID:
+        vars->type = ASN_OBJECT_ID;
+	vars->val_len = MAX_OID_LEN;
+        /* if (read_objid(val, oidbuf, &(vars->val_len))) { */
+	/* tp = __tag2oid(val,NULL,oidbuf,&(vars->val_len),NULL,0); */
+        if (!val || !snmp_parse_oid(val, oidbuf, &vars->val_len)) {
+            vars->val.objid = NULL;
+	    ret = FAILURE;
+        } else {
+            vars->val_len *= sizeof(oid);
+            vars->val.objid = (oid *)malloc(vars->val_len);
+            memcpy((char *)vars->val.objid, (char *)oidbuf, vars->val_len);
+        }
+        break;
+
+      default:
+        vars->type = ASN_NULL;
+	vars->val_len = 0;
+	vars->val.string = NULL;
+	ret = FAILURE;
+    }
+
+     return ret;
+}
+
+/* takes ss and pdu as input and updates the 'response' argument */
+/* the input 'pdu' argument will be freed */
+static int
+__send_sync_pdu(ss, pdu, response, retry_nosuch,
+	        err_str_sv, err_num_sv, err_ind_sv)
+netsnmp_session *ss;
+netsnmp_pdu *pdu;
+netsnmp_pdu **response;
+int retry_nosuch;
+SV * err_str_sv;
+SV * err_num_sv;
+SV * err_ind_sv;
+{
+   int status;
+   long command = pdu->command;
+   *response = NULL;
+retry:
+
+   status = snmp_synch_response(ss, pdu, response);
+
+   if ((*response == NULL) && (status == STAT_SUCCESS)) status = STAT_ERROR;
+
+   switch (status) {
+      case STAT_SUCCESS:
+	 switch ((*response)->errstat) {
+	    case SNMP_ERR_NOERROR:
+	       break;
+
+            case SNMP_ERR_NOSUCHNAME:
+               if (retry_nosuch && (pdu = snmp_fix_pdu(*response, command))) {
+                  if (*response) snmp_free_pdu(*response);
+                  goto retry;
+               }
+
+            /* Pv1, SNMPsec, Pv2p, v2c, v2u, v2*, and SNMPv3 PDUs */
+            case SNMP_ERR_TOOBIG:
+            case SNMP_ERR_BADVALUE:
+            case SNMP_ERR_READONLY:
+            case SNMP_ERR_GENERR:
+            /* in SNMPv2p, SNMPv2c, SNMPv2u, SNMPv2*, and SNMPv3 PDUs */
+            case SNMP_ERR_NOACCESS:
+            case SNMP_ERR_WRONGTYPE:
+            case SNMP_ERR_WRONGLENGTH:
+            case SNMP_ERR_WRONGENCODING:
+            case SNMP_ERR_WRONGVALUE:
+            case SNMP_ERR_NOCREATION:
+            case SNMP_ERR_INCONSISTENTVALUE:
+            case SNMP_ERR_RESOURCEUNAVAILABLE:
+            case SNMP_ERR_COMMITFAILED:
+            case SNMP_ERR_UNDOFAILED:
+            case SNMP_ERR_AUTHORIZATIONERROR:
+            case SNMP_ERR_NOTWRITABLE:
+            /* in SNMPv2c, SNMPv2u, SNMPv2*, and SNMPv3 PDUs */
+            case SNMP_ERR_INCONSISTENTNAME:
+            default:
+               sv_catpv(err_str_sv,
+                        (char*)snmp_errstring((*response)->errstat));
+               sv_setiv(err_num_sv, (*response)->errstat);
+	       sv_setiv(err_ind_sv, (*response)->errindex);
+               status = (*response)->errstat;
+               break;
+	 }
+         break;
+
+      case STAT_TIMEOUT:
+      case STAT_ERROR:
+          sv_catpv(err_str_sv, (char*)snmp_api_errstring(ss->s_snmp_errno));
+          sv_setiv(err_num_sv, ss->s_snmp_errno);
+         break;
+
+      default:
+         sv_catpv(err_str_sv, "send_sync_pdu: unknown status");
+         sv_setiv(err_num_sv, ss->s_snmp_errno);
+         break;
+   }
+
+   return(status);
+}
+
+static int
+__callback_wrapper (op, ss, reqid, pdu, cb_data)
+int op;
+netsnmp_session *ss;
+int reqid;
+netsnmp_pdu *pdu;
+void *cb_data;
+{
+  /* we should probably just increment the reference counter... */
+  /*  sv_inc(cb_data); */
+  return __snmp_xs_cb(op, ss, reqid, pdu, newSVsv(cb_data));
+}
+
+
+static int
+__snmp_xs_cb (op, ss, reqid, pdu, cb_data)
+int op;
+netsnmp_session *ss;
+int reqid;
+netsnmp_pdu *pdu;
+void *cb_data;
+{
+  SV *varlist_ref;
+  AV *varlist;
+  SV *varbind_ref;
+  AV *varbind;
+  SV *traplist_ref = NULL;
+  AV *traplist = NULL;
+  netsnmp_variable_list *vars;
+  struct tree *tp;
+  int len;
+  SV *tmp_sv;
+  int type;
+  char tmp_type_str[MAX_TYPE_NAME_LEN];
+  u_char str_buf[STR_BUF_SIZE], *str_bufp = str_buf;
+  size_t str_buf_len = sizeof(str_buf);
+  size_t out_len = 0;
+  int buf_over = 0;
+  char *label;
+  char *iid;
+  char *cp;
+  int getlabel_flag = NO_FLAGS;
+  int sprintval_flag = USE_BASIC;
+  netsnmp_pdu *reply_pdu;
+  int old_numeric, old_printfull;
+  netsnmp_transport *transport = NULL;
+
+  SV* cb = ((struct snmp_xs_cb_data*)cb_data)->perl_cb;
+  SV* sess_ref = ((struct snmp_xs_cb_data*)cb_data)->sess_ref;
+  SV **err_str_svp = hv_fetch((HV*)SvRV(sess_ref), "ErrorStr", 8, 1);
+  SV **err_num_svp = hv_fetch((HV*)SvRV(sess_ref), "ErrorNum", 8, 1);
+  SV **err_ind_svp = hv_fetch((HV*)SvRV(sess_ref), "ErrorInd", 8, 1);
+
+  dSP;
+  ENTER;
+  SAVETMPS;
+
+  free(cb_data);
+
+  sv_setpv(*err_str_svp, (char*)snmp_errstring(pdu->errstat));
+  sv_setiv(*err_num_svp, pdu->errstat);
+  sv_setiv(*err_ind_svp, pdu->errindex);
+
+  varlist_ref = &sv_undef;	/* Prevent unintialized use below. */
+
+  switch (op) {
+  case NETSNMP_CALLBACK_OP_RECEIVED_MESSAGE:
+    traplist_ref = NULL;
+    switch (pdu->command) {
+    case SNMP_MSG_INFORM:
+      /*
+       * Ideally, we would use the return value from the callback to
+       * decide what response, if any, we send, and what the error status
+       * and error index should be.
+       */
+      reply_pdu = snmp_clone_pdu(pdu);
+      if (reply_pdu) {
+        reply_pdu->command = SNMP_MSG_RESPONSE;
+        reply_pdu->reqid = pdu->reqid;
+        reply_pdu->errstat = reply_pdu->errindex = 0;
+        snmp_send(ss, reply_pdu);
+      } else {
+        warn("Couldn't clone PDU for inform response");
+      }
+      /* FALLTHRU */
+    case SNMP_MSG_TRAP2:
+      traplist = newAV();
+      traplist_ref = newRV_noinc((SV*)traplist);
+#if 0
+      /* of dubious utility... */
+      av_push(traplist, newSViv(pdu->command));
+#endif
+      av_push(traplist, newSViv(pdu->reqid));
+      if ((transport = snmp_sess_transport(snmp_sess_pointer(ss))) != NULL) {
+	cp = transport->f_fmtaddr(transport, pdu->transport_data,
+				  pdu->transport_data_length);
+	av_push(traplist, newSVpv(cp, strlen(cp)));
+	free(cp);
+      } else {
+	/*  This shouldn't ever happen; every session has a transport.  */
+	av_push(traplist, newSVpv("", 0));
+      }
+      av_push(traplist, newSVpv((char*) pdu->community, pdu->community_len));
+      /* FALLTHRU */
+    case SNMP_MSG_RESPONSE:
+      {
+      varlist = newAV();
+      varlist_ref = newRV_noinc((SV*)varlist);
+
+      /*
+      ** Set up for numeric OID's, if necessary.  Save the old values
+      ** so that they can be restored when we finish -- these are
+      ** library-wide globals, and have to be set/restored for each
+      ** session.
+      */
+      old_numeric = netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_PRINT_NUMERIC_OIDS);
+      old_printfull = netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_PRINT_FULL_OID);
+      if (SvIV(*hv_fetch((HV*)SvRV(sess_ref),"UseLongNames", 12, 1))) {
+         getlabel_flag |= USE_LONG_NAMES;
+         netsnmp_ds_set_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_PRINT_FULL_OID, 1);
+      }
+      /* Setting UseNumeric forces UseLongNames on so check for UseNumeric
+         after UseLongNames (above) to make sure the final outcome of 
+         NETSNMP_DS_LIB_OID_OUTPUT_FORMAT is NETSNMP_OID_OUTPUT_NUMERIC */
+      if (SvIV(*hv_fetch((HV*)SvRV(sess_ref),"UseNumeric", 10, 1))) {
+         getlabel_flag |= USE_NUMERIC_OIDS;
+         netsnmp_ds_set_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_PRINT_NUMERIC_OIDS, 1);
+      }
+
+      sv_bless(varlist_ref, gv_stashpv("SNMP::VarList",0));
+      for(vars = (pdu?pdu->variables:NULL); vars; vars = vars->next_variable) {
+         varbind = newAV();
+         varbind_ref = newRV_noinc((SV*)varbind);
+         sv_bless(varbind_ref, gv_stashpv("SNMP::Varbind",0));
+         av_push(varlist, varbind_ref);
+         *str_buf = '.';
+         *(str_buf+1) = '\0';
+         out_len = 0;
+         tp = netsnmp_sprint_realloc_objid_tree(&str_bufp, &str_buf_len,
+                                                &out_len, 0, &buf_over,
+                                                vars->name,vars->name_length);
+         str_buf[sizeof(str_buf)-1] = '\0';
+         if (__is_leaf(tp)) {
+            type = tp->type;
+         } else {
+            getlabel_flag |= NON_LEAF_NAME;
+            type = __translate_asn_type(vars->type);
+         }
+         __get_label_iid(str_buf,&label,&iid,getlabel_flag);
+         av_store(varbind, VARBIND_TAG_F,
+                  newSVpv(label, strlen(label)));
+         av_store(varbind, VARBIND_IID_F,
+                  newSVpv(iid, strlen(iid)));
+         __get_type_str(type, tmp_type_str);
+         tmp_sv = newSVpv(tmp_type_str, strlen(tmp_type_str));
+         av_store(varbind, VARBIND_TYPE_F, tmp_sv);
+         len = __snprint_value(str_buf, sizeof(str_buf),
+                              vars, tp, type, sprintval_flag);
+         tmp_sv = newSVpv((char*)str_buf, len);
+         av_store(varbind, VARBIND_VAL_F, tmp_sv);
+      } /* for */
+
+      /* Reset the library's behavior for numeric/symbolic OID's. */
+      netsnmp_ds_set_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_PRINT_NUMERIC_OIDS, old_numeric );
+      netsnmp_ds_set_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_PRINT_FULL_OID, old_printfull);
+
+      } /* case SNMP_MSG_RESPONSE */
+      break;
+    default:;
+    } /* switch pdu->command */
+    break;
+
+  case NETSNMP_CALLBACK_OP_TIMED_OUT:
+    varlist_ref = &sv_undef;
+    break;
+  default:;
+  } /* switch op */
+  sv_2mortal(cb);
+  cb = __push_cb_args2(cb,
+                 (SvTRUE(varlist_ref) ? sv_2mortal(varlist_ref):varlist_ref),
+	         (SvTRUE(traplist_ref) ? sv_2mortal(traplist_ref):traplist_ref));
+  __call_callback(cb, G_DISCARD);
+
+  FREETMPS;
+  LEAVE;
+  sv_2mortal(sess_ref);
+  return 1;
+}
+
+static SV *
+__push_cb_args2(sv,esv,tsv)
+SV *sv;
+SV *esv;
+SV *tsv;
+{
+   dSP;
+   if (SvTYPE(SvRV(sv)) != SVt_PVCV) sv = SvRV(sv);
+
+   PUSHMARK(sp);
+   if (SvTYPE(sv) == SVt_PVAV) {
+      AV *av = (AV *) sv;
+      int n = av_len(av) + 1;
+      SV **x = av_fetch(av, 0, 0);
+      if (x) {
+         int i = 1;
+         sv = *x;
+
+         for (i = 1; i < n; i++) {
+            x = av_fetch(av, i, 0);
+            if (x) {
+               SV *arg = *x;
+               XPUSHs(sv_mortalcopy(arg));
+            } else {
+               XPUSHs(&sv_undef);
+            }
+         }
+      } else {
+         sv = &sv_undef;
+      }
+   }
+   if (esv) XPUSHs(sv_mortalcopy(esv));
+   if (tsv) XPUSHs(sv_mortalcopy(tsv));
+   PUTBACK;
+   return sv;
+}
+
+static int
+__call_callback(sv, flags)
+SV *sv;
+int flags;
+{
+ dSP;
+ I32 myframe = TOPMARK;
+ I32 count;
+ ENTER;
+ if (SvTYPE(sv) == SVt_PVCV)
+  {
+   count = perl_call_sv(sv, flags);
+  }
+ else if (SvROK(sv) && SvTYPE(SvRV(sv)) == SVt_PVCV)
+  {
+   count = perl_call_sv(SvRV(sv), flags);
+  }
+ else
+  {
+
+   SV **top = stack_base + myframe + 1;
+   SV *obj = *top;
+   if (SvPOK(sv) && SvROK(obj) && SvOBJECT(SvRV(obj)))
+    {
+     count = perl_call_method(SvPV(sv, na), flags);
+    }
+   else if (SvPOK(obj) && SvROK(sv) && SvOBJECT(SvRV(sv)))
+    {
+     /* We have obj method ...
+        Used to be used instead of LangMethodCall()
+      */
+     *top = sv;
+     count = perl_call_method(SvPV(obj, na), flags);
+    }
+   else
+    {
+     count = perl_call_sv(sv, flags);
+    }
+ }
+ LEAVE;
+ return count;
+}
+
+/* Bulkwalk support routines */
+
+/* Add a context pointer to the list of valid pointers.  Place it in the first
+** NULL slot in the array.
+*/
+static int
+_context_add(walk_context *context)
+{
+    int i, j, new_sz;
+
+    if ((i = _context_okay(context)) != 0)	/* Already exists?  Okay. */
+	return i;
+
+    /* Initialize the array if necessary. */
+    if (_valid_contexts == NULL) {
+
+	/* Create the _valid_contexts structure. */
+	Newz(0, _valid_contexts, 1, struct valid_contexts);
+	assert(_valid_contexts != NULL);
+
+	/* Populate the original valid contexts array. */
+	Newz(0, _valid_contexts->valid, 4, walk_context *);
+	assert(_valid_contexts->valid != NULL);
+
+	/* Computer number of slots in the array. */
+	_valid_contexts->sz_valid = sizeof(*_valid_contexts->valid) /
+							sizeof(walk_context *);
+
+	for (i = 0; i < _valid_contexts->sz_valid; i++)
+	    _valid_contexts->valid[i] = NULL;
+
+	DBPRT(3, (DBOUT "Created valid_context array 0x%p (%d slots)\n",
+			    _valid_contexts->valid, _valid_contexts->sz_valid));
+    }
+
+    /* Search through the list, looking for NULL's -- unused slots. */
+    for (i = 0; i < _valid_contexts->sz_valid; i++)
+	if (_valid_contexts->valid[i] == NULL)
+	    break;
+
+    /* Did we walk off the end of the list?  Need to grow the list.  Double
+    ** it for now.
+    */
+    if (i == _valid_contexts->sz_valid) {
+	new_sz = _valid_contexts->sz_valid * 2;
+
+	Renew(_valid_contexts->valid, new_sz, walk_context *);
+	assert(_valid_contexts->valid != NULL);
+
+	DBPRT(3, (DBOUT "Resized valid_context array 0x%p from %d to %d slots\n",
+		    _valid_contexts->valid, _valid_contexts->sz_valid, new_sz));
+
+	_valid_contexts->sz_valid = new_sz;
+
+	/* Initialize the new half of the resized array. */
+	for (j = i; j < new_sz; j++)
+	    _valid_contexts->valid[j] = NULL;
+    }
+
+    /* Store the context pointer in the array and return 0 (success). */
+    _valid_contexts->valid[i] = context;
+    DBPRT(3,( "Add context 0x%p to valid context list\n", context));
+    return 0;
+}
+
+/* Remove a context pointer from the valid list.  Replace the pointer with
+** NULL in the valid pointer list.
+*/
+static int
+_context_del(walk_context *context)
+{
+    int i;
+
+    if (_valid_contexts == NULL)	/* Make sure it was initialized. */
+	return 1;
+
+    for (i = 0; i < _valid_contexts->sz_valid; i++) {
+	if (_valid_contexts->valid[i] == context) {
+	    DBPRT(3,( "Remove context 0x%p from valid context list\n", context));
+	    _valid_contexts->valid[i] = NULL;	/* Remove it from the list.  */
+	    return 0;				/* Return successful status. */
+	}
+    }
+    return 1;
+}
+
+/* Check if a specific context pointer is in the valid list.  Return true (1)
+** if the context is still in the valid list, or 0 if not (or context is NULL).
+*/
+static int
+_context_okay(walk_context *context)
+{
+    int i;
+
+    if (_valid_contexts == NULL)	/* Make sure it was initialized. */
+	return 0;
+
+    if (context == NULL)		/* Asked about a NULL context? Fail. */
+	return 0;
+
+    for (i = 0; i < _valid_contexts->sz_valid; i++)
+	if (_valid_contexts->valid[i] == context)
+	    return 1;			/* Found it! */
+
+    return 0;				/* No match -- return failure. */
+}
+
+/* Check if the walk is completed, based upon the context.  Also set the
+** ignore flag on any completed variables -- this prevents them from being
+** being sent in later packets.
+*/
+static int
+_bulkwalk_done(walk_context *context)
+{
+   int is_done = 1;
+   int i;
+   bulktbl *bt_entry;		/* bulktbl requested OID entry */
+
+   /* Don't consider walk done until at least one packet has been exchanged. */
+   if (context->pkts_exch == 0)
+      return 0;
+
+   /* Fix up any requests that have completed.  If the complete flag is set,
+   ** or it is a non-repeater OID, set the ignore flag so that it will not
+   ** be considered further.  Assume we are done with the walk, and note
+   ** otherwise if we aren't.  Return 1 if all requests are complete, or 0
+   ** if there's more to do.
+   */
+   for (i = 0; i < context->nreq_oids; i ++) {
+      bt_entry = &context->req_oids[i];
+
+      if (bt_entry->complete || bt_entry->norepeat) {
+
+ 	/* This request is complete.  Remove it from list of
+ 	** walks still in progress.
+ 	*/
+ 	DBPRT(1, (DBOUT "Ignoring %s request oid %s\n",
+ 	      bt_entry->norepeat? "nonrepeater" : "completed",
+ 	      snprint_objid(_debugx, sizeof(_debugx), bt_entry->req_oid,
+ 				    bt_entry->req_len)));
+
+ 	/* Ignore this OID in any further packets. */
+ 	bt_entry->ignore = 1;
+      }
+
+      /* If any OID is not being ignored, the walk is not done.  Must loop
+      ** through all requests to do the fixup -- no early return possible.
+      */
+      if (!bt_entry->ignore)
+ 	 is_done = 0;
+   }
+
+   return is_done;		/* Did the walk complete? */
+}
+
+/* Callback registered with SNMP.  Return 1 from this callback to cause the
+** current request to be deleted from the retransmit queue.
+*/
+static int
+_bulkwalk_async_cb(int		op,
+		  SnmpSession	*ss,
+		  int 		reqid,
+		  netsnmp_pdu *pdu,
+		  void		*context_ptr)
+{
+   walk_context *context;
+   int	done = 0;
+   int	npushed;
+   SV **err_str_svp;
+   SV **err_num_svp;
+
+   /* Handle callback request for asynchronous bulkwalk.  If the bulkwalk has
+   ** not completed, and has not timed out, send the next request packet in
+   ** the walk.
+   **
+   ** Return 0 to indicate success (caller ignores return value).
+   */
+
+   DBPRT(2, (DBOUT "bulkwalk_async_cb(op %d, reqid 0x%08X, context 0x%p)\n",
+							op, reqid, context_ptr));
+
+   context = (walk_context *)context_ptr;
+
+   /* Make certain this is a valid context pointer.  This pdu may
+   ** have been retransmitted after the bulkwalk was completed
+   ** (and the context was destroyed).  If so, just return.
+   */
+   if (!_context_okay(context)) {
+      DBPRT(2,( "Ignoring PDU for dead context 0x%p...\n", context));
+      return 1;
+   }
+
+   /* Is this a retransmission of a request we've already seen or some
+   ** unexpected request id?  If so, just ignore it.
+   */
+   if (reqid != context->exp_reqid) {
+       DBPRT(2,
+             ("Got reqid 0x%08X, expected reqid 0x%08X.  Ignoring...\n", reqid,
+              context->exp_reqid));
+      return 1;
+   }
+   /* Ignore any future packets for this reqid. */
+   context->exp_reqid = -1;
+
+   err_str_svp = hv_fetch((HV*)SvRV(context->sess_ref), "ErrorStr", 8, 1);
+   err_num_svp = hv_fetch((HV*)SvRV(context->sess_ref), "ErrorNum", 8, 1);
+
+   switch (op) {
+      case NETSNMP_CALLBACK_OP_RECEIVED_MESSAGE:
+      {
+	 DBPRT(1,( "Received message for reqid 0x%08X ...\n", reqid));
+
+	 switch (pdu->command)
+	 {
+	    case SNMP_MSG_RESPONSE:
+	    {
+	       DBPRT(2, (DBOUT "Calling bulkwalk_recv_pdu(context 0x%p, pdu 0x%p)\n",
+							   context_ptr, pdu));
+
+	       /* Handle the response PDU.  If an error occurs or there were
+	       ** no variables in the response, consider the walk done.  If
+	       ** the response was okay, check if we have any more to do after
+	       ** this response.
+	       */
+	       if (_bulkwalk_recv_pdu(context, pdu) <= 0)
+		  done = 1;
+	       else
+		  done = _bulkwalk_done(context); /* Also set req ignore flags */
+	       break;
+	    }
+	    default:
+	    {
+	       DBPRT(1,( "unexpected pdu->command %d\n", pdu->command));
+	       done = 1;   /* "This can't happen!", so bail out when it does. */
+	       break;
+	    }
+	 }
+
+	 break;
+      }
+
+      case NETSNMP_CALLBACK_OP_TIMED_OUT:
+      {
+	 DBPRT(1,( "\n*** Timeout for reqid 0x%08X\n\n", reqid));
+
+         sv_setpv(*err_str_svp, (char*)snmp_api_errstring(SNMPERR_TIMEOUT));
+         sv_setiv(*err_num_svp, SNMPERR_TIMEOUT);
+
+	 /* Timeout means something bad has happened.  Return a not-okay
+	 ** result to the async callback.
+	 */
+	 npushed = _bulkwalk_finish(context, 0 /* NOT OKAY */);
+	 return 1;
+      }
+
+      default:
+      {
+	 DBPRT(1,( "unexpected callback op %d\n", op));
+         sv_setpv(*err_str_svp, (char*)snmp_api_errstring(SNMPERR_GENERR));
+         sv_setiv(*err_num_svp, SNMPERR_GENERR);
+	 npushed = _bulkwalk_finish(context, 0 /* NOT OKAY */);
+	 return 1;
+      }
+   }
+
+   /* We have either timed out, or received and parsed in a response.  Now,
+   ** if we have more variables to test, call bulkwalk_send_pdu() to enqueue
+   ** another async packet, and return.
+   **
+   ** If, however, the bulkwalk has completed (or an error has occurred that
+   ** cuts the walk short), call bulkwalk_finish() to push the results onto
+   ** the Perl call stack.  Then explicitly call the Perl callback that was
+   ** passed in by the user oh-so-long-ago.
+   */
+   if (!done) {
+      DBPRT(1,( "bulkwalk not complete -- send next pdu from callback\n"));
+
+      if (_bulkwalk_send_pdu(context) != NULL)
+	 return 1;
+
+      DBPRT(1,( "send_pdu() failed!\n"));
+      /* Fall through and return what we have so far. */
+   }
+
+   /* Call the perl callback with the return values and we're done. */
+   npushed = _bulkwalk_finish(context, 1 /* OKAY */);
+
+   return 1;
+}
+
+static netsnmp_pdu *
+_bulkwalk_send_pdu(walk_context *context)
+{
+   netsnmp_pdu *pdu = NULL;
+   netsnmp_pdu *response = NULL;
+   struct bulktbl  *bt_entry;
+   int	nvars = 0;
+   int	reqid;
+   int	status;
+   int	i;
+
+   /* Send a pdu requesting any remaining variables in the context.
+   **
+   ** In synchronous mode, returns a pointer to the response packet.
+   **
+   ** In asynchronous mode, it returns the request ID, cast to a struct snmp *,
+   **   not a valid SNMP response packet.  The async code should not be trying
+   **   to get variables out of this "response".
+   **
+   ** In either case, return a NULL pointer on error or failure.
+   */
+
+   SV **sess_ptr_sv = hv_fetch((HV*)SvRV(context->sess_ref), "SessPtr", 7, 1);
+   netsnmp_session *ss = (SnmpSession *)SvIV((SV*)SvRV(*sess_ptr_sv));
+   SV **err_str_svp = hv_fetch((HV*)SvRV(context->sess_ref), "ErrorStr", 8, 1);
+   SV **err_num_svp = hv_fetch((HV*)SvRV(context->sess_ref), "ErrorNum", 8, 1);
+   SV **err_ind_svp = hv_fetch((HV*)SvRV(context->sess_ref), "ErrorInd", 8, 1);
+
+   /* Create a new PDU and send the remaining set of requests to the agent. */
+   pdu = snmp_pdu_create(SNMP_MSG_GETBULK);
+   if (pdu == NULL) {
+      sv_setpv(*err_str_svp, "snmp_pdu_create(GETBULK) failed: ");
+      sv_catpv(*err_str_svp, strerror(errno));
+      sv_setiv(*err_num_svp, SNMPERR_MALLOC);
+      goto err;
+   }
+
+   /* Request non-repeater variables only in the first packet exchange. */
+   pdu->errstat  = (context->pkts_exch == 0) ? context->non_reps : 0;
+   pdu->errindex = context->max_reps;
+
+   for (i = 0; i < context->nreq_oids; i++) {
+      bt_entry = &context->req_oids[i];
+      if (bt_entry->ignore)
+	 continue;
+
+      assert(bt_entry->complete == 0);
+
+      if (!snmp_add_null_var(pdu, bt_entry->last_oid, bt_entry->last_len)) {
+	 sv_setpv(*err_str_svp, "snmp_add_null_var() failed");
+	 sv_setiv(*err_num_svp, SNMPERR_GENERR);
+	 sv_setiv(*err_ind_svp, i);
+	 goto err;
+      }
+
+      nvars ++;
+
+      DBPRT(1, (DBOUT "   Add %srepeater %s\n", bt_entry->norepeat ? "non" : "",
+	         snprint_objid(_debugx, sizeof(_debugx), bt_entry->last_oid, bt_entry->last_len)));
+   }
+
+   /* Make sure variables are actually being requested in the packet. */
+   assert (nvars != 0);
+
+   context->pkts_exch ++;
+
+   DBPRT(1, (DBOUT "Sending %ssynchronous request %d...\n",
+		     SvTRUE(context->perl_cb) ? "a" : "", context->pkts_exch));
+
+   /* We handle the asynchronous and synchronous requests differently here.
+   ** For async, we simply enqueue the packet with a callback to handle the
+   ** returned response, then return.  Note that this we call the bulkwalk
+   ** callback, and hand it the walk_context, not the Perl callback.  The
+   ** snmp_async_send() function returns the reqid on success, 0 on failure.
+   */
+   if (SvTRUE(context->perl_cb)) {
+      reqid = snmp_async_send(ss, pdu, _bulkwalk_async_cb, (void *)context);
+
+      DBPRT(2,( "bulkwalk_send_pdu(): snmp_async_send => 0x%08X\n", reqid));
+
+      if (reqid == 0) {
+	 sv_setpv(*err_str_svp, (char*)snmp_api_errstring(ss->s_snmp_errno));
+	 sv_setiv(*err_num_svp, ss->s_snmp_errno);
+	 goto err;
+      }
+
+      /* Make a note of the request we expect to be answered. */
+      context->exp_reqid = reqid;
+
+      /* Callbacks take care of the rest.  Let the caller know how many vars
+      ** we sent in this request.  Note that this is not a valid SNMP PDU,
+      ** but that's because a response has not yet been received.
+      */
+      return (netsnmp_pdu *)reqid;
+   }
+
+   /* This code is for synchronous mode support.
+   **
+   ** Send the PDU and block awaiting the response.  Return the response
+   ** packet back to the caller.  Note that snmp_sess_read() frees the pdu.
+   */
+   status = __send_sync_pdu(ss, pdu, &response, NO_RETRY_NOSUCH,
+				    *err_str_svp, *err_num_svp, *err_ind_svp);
+
+   pdu = NULL;
+
+   /* Check for a failed request.  __send_sync_pdu() will set the appropriate
+   ** values in the error string and number SV's.
+   */
+   if (status != STAT_SUCCESS) {
+      DBPRT(1,( "__send_sync_pdu() -> %d\n",(int)status));
+      goto err;
+   }
+
+   DBPRT(1, (DBOUT "%d packets exchanged, response 0x%p\n", context->pkts_exch,
+								    response));
+   return response;
+
+
+   err:
+   if (pdu)
+      snmp_free_pdu(pdu);
+   return NULL;
+}
+
+/* Handle an incoming GETBULK response PDU.  This function just pulls the
+** variables off of the PDU and builds up the arrays of returned values
+** that are stored in the context.
+**
+** Returns the number of variables found in this packet, or -1 on error.
+** Note that the caller is expected to free the pdu.
+*/
+static int
+_bulkwalk_recv_pdu(walk_context *context, netsnmp_pdu *pdu)
+{
+   netsnmp_variable_list *vars;
+   struct tree	*tp;
+   char		type_str[MAX_TYPE_NAME_LEN];
+   u_char	str_buf[STR_BUF_SIZE], *str_bufp = str_buf;
+   size_t str_buf_len = sizeof(str_buf);
+   size_t out_len = 0;
+   int buf_over = 0;
+   char		*label;
+   char		*iid;
+   bulktbl	*expect = NULL;
+   int		old_numeric;
+   int		old_printfull;
+   int		old_format;
+   int		getlabel_flag;
+   int		type;
+   int		pix;
+   int		len;
+   int		i;
+   AV		*varbind;
+   SV		*rv;
+   SV **sess_ptr_sv = hv_fetch((HV*)SvRV(context->sess_ref), "SessPtr", 7, 1);
+   SV **err_str_svp = hv_fetch((HV*)SvRV(context->sess_ref), "ErrorStr", 8, 1);
+   SV **err_num_svp = hv_fetch((HV*)SvRV(context->sess_ref), "ErrorNum", 8, 1);
+   SV **err_ind_svp = hv_fetch((HV*)SvRV(context->sess_ref), "ErrorInd", 8, 1);
+
+   DBPRT(3, (DBOUT "bulkwalk: sess_ref = 0x%p, sess_ptr_sv = 0x%p\n",
+             context->sess_ref, sess_ptr_sv));
+
+   /* Set up for numeric OID's, if necessary.  Save the old values
+   ** so that they can be restored when we finish -- these are
+   ** library-wide globals, and have to be set/restored for each
+   ** session.
+   */
+   old_numeric   = netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_PRINT_NUMERIC_OIDS);
+   old_printfull = netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_PRINT_FULL_OID);
+   old_format = netsnmp_ds_get_int(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_OID_OUTPUT_FORMAT);
+   if (context->getlabel_f & USE_NUMERIC_OIDS) {
+      DBPRT(2,( "Using numeric oid's\n"));
+      netsnmp_ds_set_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_PRINT_NUMERIC_OIDS, 1);
+      netsnmp_ds_set_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_PRINT_FULL_OID, 1);
+      netsnmp_ds_set_int(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_OID_OUTPUT_FORMAT, NETSNMP_OID_OUTPUT_NUMERIC);
+   }
+
+   /* Parse through the list of variables returned, adding each return to
+   ** the appropriate array (as a VarBind).  Also keep track of which
+   ** repeated OID we're expecting to see, and check if that tree walk has
+   ** been completed (i.e. we've walked past the root of our request).  If
+   ** so, mark the request complete so that we don't send it again in any
+   ** subsequent request packets.
+   */
+   if (context->pkts_exch == 1)
+      context->reqbase = context->req_oids;	/* Request with non-repeaters */
+   else
+      context->reqbase = context->repbase;	/* Request only repeater vars */
+
+   /* Note the first variable we expect to see.  Should be reqbase. */
+   expect = context->reqbase;
+
+   for (vars = pdu->variables, pix = 0;
+	vars != NULL;
+	vars = vars->next_variable, pix ++)
+   {
+
+      /* If no outstanding requests remain, we're done.  This works, but it
+      ** causes the reported total variable count to be wrong (since the
+      ** remaining vars on the last packet are not counted).  In practice
+      ** this is probably worth the win, but for debugging it's not.
+      */
+      if (context->req_remain == 0) {
+	 DBPRT(2,( "No outstanding requests remain.  Terminating processing.\n"));
+	 while (vars) {
+	    pix ++;
+	    vars = vars->next_variable;
+	 }
+	 break;
+      }
+
+      /* Determine which OID we expect to see next.  We assert that the OID's
+      ** must be returned in the expected order.  The first nreq_oids returns
+      ** should match the req_oids array, after that, we must cycle through
+      ** the repeaters in order.  Non-repeaters are not included in later
+      ** packets, so cannot have the "ignore" flag set.
+      */
+
+      if (context->oid_saved < context->non_reps) {
+	 assert(context->pkts_exch == 1);
+
+	 expect = context->reqbase ++;
+	 assert(expect->norepeat);
+
+      } else {
+	 /* Must be a repeater.  Look for the first one that is not being
+	 ** ignored.  Make sure we don't loop around to where we started.
+	 ** If we get here but everything is being ignored, there's a problem.
+	 **
+	 ** Note that we *do* accept completed but not ignored OID's -- these
+	 ** are OID's for trees that have been completed sometime in this
+	 ** response, but must be looked at to maintain ordering.
+	 */
+
+	 if (pix == 0) {
+	    /* Special case code for no non-repeater case.  This
+	    ** is necessary because expect normally points to the
+	    ** last non-repeater upon entry to this code (so the
+	    ** '++expect' below increments it into the repeaters
+	    ** section of the req_oids[] array).
+	    ** If there are no non-repeaters, the expect pointer
+	    ** is never initialized.  This addresses this problem.
+	    */
+	    expect = context->reqbase;
+
+	 } else {
+
+	    /* Find the repeater OID we expect to see.  Ignore any
+	    ** OID's marked 'ignore' -- these have been completed
+	    ** and were not requested in this iteration.
+	    */
+	    for (i = 0; i < context->repeaters; i++) {
+
+	       /* Loop around to first repeater if we hit the end. */
+	       if (++ expect == &context->req_oids[context->nreq_oids])
+		  expect = context->reqbase = context->repbase;
+
+	       /* Stop if this OID is not being ignored. */
+	       if (!expect->ignore)
+		  break;
+	    }
+
+	    /* Make sure we did find an expected OID. */
+	    assert(i <= context->repeaters);
+	 }
+      }
+
+      DBPRT(2, (DBOUT "Var %03d request %s\n", pix, snprint_objid(_debugx, sizeof(_debugx), 
+					     expect->req_oid, expect->req_len)));
+
+      /* Did we receive an error condition for this variable?
+      ** If it's a repeated variable, mark it as complete and
+      ** fall through to the block below.
+      */
+      if ((vars->type == SNMP_ENDOFMIBVIEW) ||
+	  (vars->type == SNMP_NOSUCHOBJECT) ||
+	  (vars->type == SNMP_NOSUCHINSTANCE))
+      {
+	 DBPRT(2,( "error type %d\n", (int)vars->type));
+
+	 /* ENDOFMIBVIEW should be okay for a repeater - just walked off the
+	 ** end of the tree.  Mark the request as complete, and go on to the
+	 ** next one.
+	 */
+	 if ((context->oid_saved >= context->non_reps) &&
+	     (vars->type == SNMP_ENDOFMIBVIEW))
+	 {
+	    expect->complete = 1;
+	    DBPRT(2, (DBOUT "Ran out of tree for oid %s\n",
+			   snprint_objid(_debugx, sizeof(_debugx), vars->name,vars->name_length)));
+
+	    context->req_remain --;
+
+	    /* Go on to the next variable. */
+	    continue;
+
+	 }
+	 sv_setpv(*err_str_svp,
+			      (char*)snmp_api_errstring(SNMPERR_UNKNOWN_OBJID));
+	 sv_setiv(*err_num_svp, SNMPERR_UNKNOWN_OBJID);
+	 sv_setiv(*err_ind_svp, pix);
+	 goto err;
+      }
+
+      /* If this is not the first packet, skip any duplicated OID values, if
+      ** present.  These should be the seed values copied from the last OID's
+      ** of the previous packet.  In practice we don't see this, but it is
+      ** easy enough to do, and will avoid confusion for the caller from mis-
+      ** behaving agents (badly misbehaving... ;^).
+      */
+      if ((context->pkts_exch > 1) && (pix < context->repeaters)) {
+	 if (__oid_cmp(vars->name, vars->name_length,
+				   context->reqbase[pix].last_oid,
+				   context->reqbase[pix].last_len) == 0)
+	 {
+	    DBPRT(2, (DBOUT "Ignoring repeat oid: %s\n",
+			snprint_objid(_debugx, sizeof(_debugx), vars->name,vars->name_length)));
+
+	    continue;
+	 }
+      }
+
+      context->oid_total ++;	/* Count each variable received. */
+
+      /* If this is a non-repeater, handle it.  Otherwise, if it is a
+      ** repeater, has the walk wandered off of the requested tree?  If so,
+      ** this request is complete, so mark it as such.  Ignore any other
+      ** variables in a completed request.  In order to maintain the correct
+      ** ordering of which variables we expect to see in this packet, we must
+      ** not set the ignore flags immediately.  It is done in bulkwalk_done().
+      ** XXX Can we use 'expect' instead of 'context->req_oids[pix]'?
+      */
+      if (context->oid_saved < context->non_reps) {
+	 DBPRT(2, (DBOUT "   expected var %s (nonrepeater %d/%d)\n",
+		     snprint_objid(_debugx, sizeof(_debugx), context->req_oids[pix].req_oid,
+					   context->req_oids[pix].req_len),
+		     pix, context->non_reps));
+	 DBPRT(2, (DBOUT "   received var %s\n",
+		     snprint_objid(_debugx, sizeof(_debugx), vars->name, vars->name_length)));
+
+	 /* This non-repeater has now been seen, so mark the sub-tree as
+	 ** completed.  Note that this may not be the same oid as requested,
+	 ** since non-repeaters act like GETNEXT requests, not GET's. <sigh>
+	 */
+	 context->req_oids[pix].complete = 1;
+	 context->req_remain --;
+
+      } else {		/* Must be a repeater variable. */
+
+	 DBPRT(2, (DBOUT "   received oid %s\n",
+	       snprint_objid(_debugx, sizeof(_debugx), vars->name, vars->name_length)));
+
+	 /* Are we already done with this tree?  If so, just ignore this
+	 ** variable and move on to the next expected variable.
+	 */
+	 if (expect->complete) {
+	    DBPRT(2,( "      this branch is complete - ignoring.\n"));
+	    continue;
+	 }
+
+	 /* If the base oid of this variable doesn't match the expected oid,
+	 ** assume that we've walked past the end of the subtree.  Set this
+	 ** subtree to be completed, and go on to the next variable.
+	 */
+	 if ((vars->name_length < expect->req_len) ||
+	     (memcmp(vars->name, expect->req_oid, expect->req_len*sizeof(oid))))
+	 {
+	    DBPRT(2,( "      walked off branch - marking subtree as complete.\n"));
+	    expect->complete = 1;
+	    context->req_remain --;
+	    continue;
+	 }
+
+	 /* Still interested in the tree -- we need to keep track of the
+	 ** last-seen value in case we need to send an additional request
+	 ** packet.
+	 */
+	 (void)memcpy(expect->last_oid, vars->name,
+					     vars->name_length * sizeof(oid));
+	 expect->last_len = vars->name_length;
+
+      }
+
+      /* Create a new Varbind and populate it with the parsed information
+      ** returned by the agent.  This Varbind is then pushed onto the arrays
+      ** maintained for each request OID in the context.  These varbinds are
+      ** collected into a return array by bulkwalk_finish().
+      */
+      varbind = (AV*) newAV();
+      if (varbind == NULL) {
+	 sv_setpv(*err_str_svp, "newAV() failed: ");
+	 sv_catpv(*err_str_svp, (char*)strerror(errno));
+	 sv_setiv(*err_num_svp, SNMPERR_MALLOC);
+	 goto err;
+      }
+
+      *str_buf = '.';
+      *(str_buf+1) = '\0';
+      out_len = 0;
+      tp = netsnmp_sprint_realloc_objid_tree(&str_bufp, &str_buf_len,
+                                             &out_len, 0, &buf_over,
+                                             vars->name,vars->name_length);
+      str_buf[sizeof(str_buf)-1] = '\0';
+
+      getlabel_flag = context->getlabel_f;
+
+      if (__is_leaf(tp)) {
+	 type = tp->type;
+      } else {
+	 getlabel_flag |= NON_LEAF_NAME;
+	 type = __translate_asn_type(vars->type);
+      }
+      if (__get_label_iid(str_buf, &label, &iid, getlabel_flag) == FAILURE) {
+          label = str_buf;
+          iid = label + strlen(label);
+      }
+
+      DBPRT(2,( "       save var %s.%s = ", label, iid));
+
+      av_store(varbind, VARBIND_TAG_F, newSVpv(label, strlen(label)));
+      av_store(varbind, VARBIND_IID_F, newSVpv(iid, strlen(iid)));
+
+      __get_type_str(type, type_str);
+      av_store(varbind, VARBIND_TYPE_F, newSVpv(type_str, strlen(type_str)));
+
+      len=__snprint_value(str_buf, sizeof(str_buf),
+                         vars, tp, type, context->sprintval_f);
+      av_store(varbind, VARBIND_VAL_F, newSVpv((char*)str_buf, len));
+
+      str_buf[len] = '\0';
+      DBPRT(3,( "'%s' (%s)\n", str_buf, type_str));
+
+#if 0
+    /* huh? */
+      /* If necessary, store a timestamp as the semi-documented 5th element. */
+      if (sv_timestamp)
+	  av_store(varbind, VARBIND_TIME_F, SvREFCNT_inc(sv_timestamp));
+#endif
+
+      /* Push ref to the varbind onto the list of vars for OID. */
+      rv = newRV_noinc((SV *)varbind);
+      sv_bless(rv, gv_stashpv("SNMP::Varbind", 0));
+      av_push(expect->vars, rv);
+
+      context->oid_saved ++;	/* Count this as a saved variable. */
+
+   } /* next variable in response packet */
+
+   DBPRT(1, (DBOUT "-- pkt %d saw %d vars, total %d (%d saved)\n", context->pkts_exch,
+			   pix, context->oid_total, context->oid_saved));
+
+   /* We assert that all non-repeaters must be returned in
+   ** the initial response (they are not repeated in additional
+   ** packets, so would be dropped).  If nonrepeaters still
+   ** exist, consider it a fatal error.
+   */
+   if ((context->pkts_exch == 1) && (context->oid_saved < context->non_reps)) {
+      /* Re-use space from the value string for error message. */
+      sprintf(str_buf, "%d non-repeaters went unanswered", context->non_reps);
+      sv_setpv(*err_str_svp, str_buf);
+      sv_setiv(*err_num_svp, SNMPERR_GENERR);
+      sv_setiv(*err_num_svp, context->oid_saved);
+      goto err;
+   }
+
+   /* Reset the library's behavior for numeric/symbolic OID's. */
+   if (context->getlabel_f & USE_NUMERIC_OIDS) {
+      netsnmp_ds_set_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_PRINT_NUMERIC_OIDS, old_numeric);
+      netsnmp_ds_set_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_PRINT_FULL_OID, old_printfull);
+      netsnmp_ds_set_int(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_OID_OUTPUT_FORMAT, old_format);
+   }
+
+   return pix;
+
+   err:
+   if (pdu)
+      snmp_free_pdu(pdu);
+   return -1;
+
+}
+
+/* Once the bulkwalk has completed, extend the stack and push references to
+** each of the arrays of SNMP::Varbind's onto the stack.  Return the number
+** of arrays pushed on the stack.  The caller should return to Perl, or call
+** the Perl callback function.
+**
+** Note that this function free()'s the walk_context and request bulktbl's.
+*/
+static int
+_bulkwalk_finish(walk_context *context, int okay)
+{
+   int		npushed = 0;
+   int		i;
+   int		async = 0;
+   bulktbl	*bt_entry;
+   AV		*ary = NULL;
+   SV		*rv;
+   SV		*perl_cb;
+
+   SV **err_str_svp = hv_fetch((HV*)SvRV(context->sess_ref), "ErrorStr", 8, 1);
+   SV **err_num_svp = hv_fetch((HV*)SvRV(context->sess_ref), "ErrorNum", 8, 1);
+
+   dXSARGS;
+
+   async = SvTRUE(context->perl_cb);
+
+   /* Successfully completed the bulkwalk.  For synchronous calls, push each
+   ** of the request value arrays onto the stack, and return the number of
+   ** items pushed onto the stack.  For async, create a new array and push
+   ** the references onto it.  The array is then passed to the Perl callback.
+   */
+   if (!async)
+      SP -= items;
+
+   DBPRT(1, (DBOUT "Bulwalk %s (saved %d/%d), ", okay ? "completed" : "had error",
+					context->oid_saved, context->oid_total));
+
+   if (okay) {
+       DBPRT(1, (DBOUT "%s %d varbind refs %s\n",
+				async ? "pass ref to array of" : "return",
+				context->nreq_oids,
+				async ? "to callback" : "on stack to caller"));
+
+       /* Create the array to hold the responses for the asynchronous callback,
+       ** or pre-extend the stack enough to hold responses for synch return.
+       */
+       if (async) {
+	   ary = (AV *)newAV();
+	  if (ary == NULL) {
+	     sv_setpv(*err_str_svp, "newAV(): ");
+	     sv_catpv(*err_str_svp, (char *)strerror(errno));
+	     sv_setiv(*err_num_svp, errno);
+	  }
+
+	  /* NULL ary pointer is okay -- we'll handle it below... */
+
+       } else {
+	   EXTEND(sp, context->nreq_oids);
+
+       }
+
+       /* Push a reference to each array of varbinds onto the stack, in
+       ** the order requested.  Note that these arrays may be empty.
+       */
+       for (i = 0; i < context->nreq_oids; i++) {
+	  bt_entry = &context->req_oids[i];
+
+	  DBPRT(2, (DBOUT "  %sreq #%d (%s) => %d var%s\n",
+		 bt_entry->complete ? "" : "incomplete ", i,
+		 snprint_objid(_debugx, sizeof(_debugx), bt_entry->req_oid, bt_entry->req_len),
+		 (int)av_len(bt_entry->vars) + 1,
+		 (int)av_len(bt_entry->vars) > 0 ? "s" : ""));
+
+	  if (async && ary == NULL) {
+	     DBPRT(2,( "    [dropped due to newAV() failure]\n"));
+	     continue;
+	  }
+
+	  /* Get a reference to the varlist, and push it onto array or stack */
+	  rv = newRV_noinc((SV *)bt_entry->vars);
+	  sv_bless(rv, gv_stashpv("SNMP::VarList",0));
+
+	  if (async)
+	     av_push(ary, rv);
+	  else
+	     PUSHs(sv_2mortal((SV *)rv));
+
+	  npushed ++;
+       }
+
+   } else {	/* Not okay -- push a single undef on the stack if not async */
+
+      if (!async) {
+	 XPUSHs(&sv_undef);
+	 npushed = 1;
+      }
+   }
+
+   /* XXX Future enhancement -- make statistics (pkts exchanged, vars
+   ** saved vs. received, total time, etc) available to caller so they
+   ** can adjust their request parameters and/or re-order requests.
+   */
+
+   PUTBACK;
+
+   if (async) {
+       /* Asynchronous callback.  Push the caller's arglist onto the stack,
+       ** and follow it with the contents of the array (or undef if newAV()
+       ** failed or the session had an error).  Then mortalize the Perl
+       ** callback pointer, and call the callback.
+       */
+       if (!okay || ary == NULL)
+          rv = &sv_undef;
+       else
+	  rv = newRV_noinc((SV *)ary);
+
+       sv_2mortal(perl_cb = context->perl_cb);
+       perl_cb = __push_cb_args(perl_cb, (SvTRUE(rv) ? sv_2mortal(rv) : rv));
+
+       __call_callback(perl_cb, G_DISCARD);
+   }
+   sv_2mortal(context->sess_ref);
+
+   /* Free the allocated space for the request states and return number of
+   ** variables found.  Remove the context from the valid context list.
+   */
+   _context_del(context);
+   DBPRT(2,( "Free() context->req_oids\n"));
+   Safefree(context->req_oids);
+   DBPRT(2,( "Free() context 0x%p\n", context));
+   Safefree(context);
+   return npushed;
+}
+
+/* End of bulkwalk support routines */
+
+static char *
+__av_elem_pv(AV *av, I32 key, char *dflt)
+{
+   SV **elem = av_fetch(av, key, 0);
+
+   return (elem && SvOK(*elem)) ? SvPV(*elem, na) : dflt;
+}
+
+static int
+not_here(s)
+char *s;
+{
+    croak("%s not implemented on this architecture", s);
+    return -1;
+}
+
+static double
+constant(name, arg)
+char *name;
+int arg;
+{
+    errno = 0;
+    switch (*name) {
+    case 'R':
+	if (strEQ(name, "NETSNMP_CALLBACK_OP_RECEIVED_MESSAGE"))
+#ifdef NETSNMP_CALLBACK_OP_RECEIVED_MESSAGE
+	    return NETSNMP_CALLBACK_OP_RECEIVED_MESSAGE;
+#else
+	    goto not_there;
+#endif
+	break;
+    case 'S':
+	if (strEQ(name, "SNMPERR_BAD_ADDRESS"))
+#ifdef SNMPERR_BAD_ADDRESS
+	    return SNMPERR_BAD_ADDRESS;
+#else
+	    goto not_there;
+#endif
+	if (strEQ(name, "SNMPERR_BAD_LOCPORT"))
+#ifdef SNMPERR_BAD_LOCPORT
+	    return SNMPERR_BAD_LOCPORT;
+#else
+	    goto not_there;
+#endif
+	if (strEQ(name, "SNMPERR_BAD_SESSION"))
+#ifdef SNMPERR_BAD_SESSION
+	    return SNMPERR_BAD_SESSION;
+#else
+	    goto not_there;
+#endif
+	if (strEQ(name, "SNMPERR_GENERR"))
+#ifdef SNMPERR_GENERR
+	    return SNMPERR_GENERR;
+#else
+	    goto not_there;
+#endif
+	if (strEQ(name, "SNMPERR_TOO_LONG"))
+#ifdef SNMPERR_TOO_LONG
+	    return SNMPERR_TOO_LONG;
+#else
+	    goto not_there;
+#endif
+	if (strEQ(name, "SNMP_DEFAULT_ADDRESS"))
+#ifdef SNMP_DEFAULT_ADDRESS
+	    return SNMP_DEFAULT_ADDRESS;
+#else
+	    goto not_there;
+#endif
+	if (strEQ(name, "SNMP_DEFAULT_COMMUNITY_LEN"))
+#ifdef SNMP_DEFAULT_COMMUNITY_LEN
+	    return SNMP_DEFAULT_COMMUNITY_LEN;
+#else
+	    goto not_there;
+#endif
+	if (strEQ(name, "SNMP_DEFAULT_ENTERPRISE_LENGTH"))
+#ifdef SNMP_DEFAULT_ENTERPRISE_LENGTH
+	    return SNMP_DEFAULT_ENTERPRISE_LENGTH;
+#else
+	    goto not_there;
+#endif
+	if (strEQ(name, "SNMP_DEFAULT_ERRINDEX"))
+#ifdef SNMP_DEFAULT_ERRINDEX
+	    return SNMP_DEFAULT_ERRINDEX;
+#else
+	    goto not_there;
+#endif
+	if (strEQ(name, "SNMP_DEFAULT_ERRSTAT"))
+#ifdef SNMP_DEFAULT_ERRSTAT
+	    return SNMP_DEFAULT_ERRSTAT;
+#else
+	    goto not_there;
+#endif
+	if (strEQ(name, "SNMP_DEFAULT_PEERNAME"))
+#ifdef SNMP_DEFAULT_PEERNAME
+	    return 0;
+#else
+	    goto not_there;
+#endif
+	if (strEQ(name, "SNMP_DEFAULT_REMPORT"))
+#ifdef SNMP_DEFAULT_REMPORT
+	    return SNMP_DEFAULT_REMPORT;
+#else
+	    goto not_there;
+#endif
+	if (strEQ(name, "SNMP_DEFAULT_REQID"))
+#ifdef SNMP_DEFAULT_REQID
+	    return SNMP_DEFAULT_REQID;
+#else
+	    goto not_there;
+#endif
+	if (strEQ(name, "SNMP_DEFAULT_RETRIES"))
+#ifdef SNMP_DEFAULT_RETRIES
+	    return SNMP_DEFAULT_RETRIES;
+#else
+	    goto not_there;
+#endif
+	if (strEQ(name, "SNMP_DEFAULT_TIME"))
+#ifdef SNMP_DEFAULT_TIME
+	    return SNMP_DEFAULT_TIME;
+#else
+	    goto not_there;
+#endif
+	if (strEQ(name, "SNMP_DEFAULT_TIMEOUT"))
+#ifdef SNMP_DEFAULT_TIMEOUT
+	    return SNMP_DEFAULT_TIMEOUT;
+#else
+	    goto not_there;
+#endif
+	if (strEQ(name, "SNMP_DEFAULT_VERSION"))
+#ifdef DEFAULT_SNMP_VERSION
+	    return DEFAULT_SNMP_VERSION;
+#else
+#ifdef SNMP_DEFAULT_VERSION
+	    return SNMP_DEFAULT_VERSION;
+#else
+	    goto not_there;
+#endif
+#endif
+	break;
+    case 'T':
+	if (strEQ(name, "NETSNMP_CALLBACK_OP_TIMED_OUT"))
+#ifdef NETSNMP_CALLBACK_OP_TIMED_OUT
+	    return NETSNMP_CALLBACK_OP_TIMED_OUT;
+#else
+	    goto not_there;
+#endif
+	break;
+    default:
+	break;
+    }
+    errno = EINVAL;
+    return 0;
+
+#ifndef NETSNMP_CALLBACK_OP_TIMED_OUT
+not_there:
+#endif
+    errno = ENOENT;
+    return 0;
+}
+
+
+MODULE = SNMP		PACKAGE = SNMP		PREFIX = snmp
+
+BOOT:
+# first blank line terminates bootstrap code
+    Mib = 0;
+
+
+double
+constant(name,arg)
+	char *		name
+	int		arg
+
+long
+snmp_sys_uptime()
+	CODE:
+	RETVAL = get_uptime();
+	OUTPUT:
+	RETVAL
+
+void
+init_snmp(appname)
+        char *appname
+    CODE:
+        __libraries_init(appname);
+
+
+SnmpSession *
+snmp_new_session(version, community, peer, lport, retries, timeout)
+        char *	version
+        char *	community
+        char *	peer
+        int	lport
+        int	retries
+        int	timeout
+	CODE:
+	{
+	   SnmpSession session = {0};
+	   SnmpSession *ss = NULL;
+           int verbose = SvIV(perl_get_sv("SNMP::verbose", 0x01 | 0x04));
+
+           __libraries_init("perl");
+           
+	   if (!strcmp(version, "1")) {
+		session.version = SNMP_VERSION_1;
+           } else if ((!strcmp(version, "2")) || (!strcmp(version, "2c"))) {
+		session.version = SNMP_VERSION_2c;
+           } else if (!strcmp(version, "3")) {
+	        session.version = SNMP_VERSION_3;
+	   } else {
+		if (verbose)
+                   warn("error:snmp_new_session:Unsupported SNMP version (%s)\n", version);
+                goto end;
+	   }
+
+           session.community_len = strlen((char *)community);
+           session.community = (u_char *)community;
+	   session.peername = peer;
+	   session.local_port = lport;
+           session.retries = retries; /* 5 */
+           session.timeout = timeout; /* 1000000L */
+           session.authenticator = NULL;
+
+           ss = snmp_open(&session);
+
+           if (ss == NULL) {
+	      if (verbose) warn("error:snmp_new_session: Couldn't open SNMP session");
+           }
+        end:
+           RETVAL = ss;
+	}
+        OUTPUT:
+        RETVAL
+
+SnmpSession *
+snmp_new_v3_session(version, peer, retries, timeout, sec_name, sec_level, sec_eng_id, context_eng_id, context, auth_proto, auth_pass, priv_proto, priv_pass, eng_boots, eng_time)
+        int	version
+        char *	peer
+        int	retries
+        int	timeout
+        char *  sec_name
+        int     sec_level
+        char *  sec_eng_id
+        char *  context_eng_id
+        char *  context
+        char *  auth_proto
+        char *  auth_pass
+        char *  priv_proto
+        char *  priv_pass
+	int     eng_boots
+	int     eng_time
+	CODE:
+	{
+/*             u_char sec_eng_id_buf[ENG_ID_BUF_SIZE]; */
+/*             u_char context_eng_id_buf[ENG_ID_BUF_SIZE]; */
+	   SnmpSession session = {0};
+	   SnmpSession *ss = NULL;
+           int verbose = SvIV(perl_get_sv("SNMP::verbose", 0x01 | 0x04));
+
+           __libraries_init("perl");
+
+	   if (version == 3) {
+		session.version = SNMP_VERSION_3;
+           } else {
+		if (verbose)
+                   warn("error:snmp_new_v3_session:Unsupported SNMP version (%d)\n", version);
+                goto end;
+	   }
+
+	   session.peername = strdup(peer);
+           session.retries = retries; /* 5 */
+           session.timeout = timeout; /* 1000000L */
+           session.authenticator = NULL;
+           session.contextNameLen = strlen(context);
+           session.contextName = context;
+           session.securityNameLen = strlen(sec_name);
+           session.securityName = sec_name;
+           session.securityLevel = sec_level;
+           session.securityModel = USM_SEC_MODEL_NUMBER;
+           /* session.securityEngineID = sec_eng_id_buf;*/
+           session.securityEngineIDLen =
+              hex_to_binary2(sec_eng_id, strlen(sec_eng_id),
+                             (char **) &session.securityEngineID);
+           /* session.contextEngineID = context_eng_id_buf; */
+           session.contextEngineIDLen =
+              hex_to_binary2(sec_eng_id, strlen(sec_eng_id),
+                             (char **) &session.contextEngineID);
+           session.engineBoots = eng_boots;
+           session.engineTime = eng_time;
+           if (!strcmp(auth_proto, "MD5")) {
+               session.securityAuthProto = 
+                  snmp_duplicate_objid(usmHMACMD5AuthProtocol,
+                                          USM_AUTH_PROTO_MD5_LEN);
+              session.securityAuthProtoLen = USM_AUTH_PROTO_MD5_LEN;
+           } else if (!strcmp(auth_proto, "SHA")) {
+               session.securityAuthProto = 
+                   snmp_duplicate_objid(usmHMACSHA1AuthProtocol,
+                                        USM_AUTH_PROTO_SHA_LEN);
+              session.securityAuthProtoLen = USM_AUTH_PROTO_SHA_LEN;
+           } else {
+              if (verbose)
+                 warn("error:snmp_new_v3_session:Unsupported authentication protocol(%s)\n", auth_proto);
+              goto end;
+           }
+           if (session.securityLevel >= SNMP_SEC_LEVEL_AUTHNOPRIV) {
+              session.securityAuthKeyLen = USM_AUTH_KU_LEN;
+              if (generate_Ku(session.securityAuthProto,
+                              session.securityAuthProtoLen,
+                              (u_char *)auth_pass, strlen(auth_pass),
+                              session.securityAuthKey,
+                              &session.securityAuthKeyLen) != SNMPERR_SUCCESS) {
+                 if (verbose)
+                    warn("error:snmp_new_v3_session:Error generating Ku from authentication password.\n");
+                 goto end;
+              }
+           }
+           if (!strcmp(priv_proto, "DES")) {
+              session.securityPrivProto =
+                  snmp_duplicate_objid(usmDESPrivProtocol,
+                                       USM_PRIV_PROTO_DES_LEN);
+              session.securityPrivProtoLen = USM_PRIV_PROTO_DES_LEN;
+           } else {
+              if (verbose)
+                 warn("error:snmp_new_v3_session:Unsupported privacy protocol(%s)\n", priv_proto);
+              goto end;
+           }
+           if (session.securityLevel >= SNMP_SEC_LEVEL_AUTHPRIV) {
+             session.securityPrivKeyLen = USM_PRIV_KU_LEN;
+              if (generate_Ku(session.securityAuthProto,
+                              session.securityAuthProtoLen,
+                              (u_char *)priv_pass, strlen(priv_pass),
+                              session.securityPrivKey,
+                              &session.securityPrivKeyLen) != SNMPERR_SUCCESS) {
+                 if (verbose)
+                    warn("error:snmp_new_v3_session:Error generating Ku from privacy pass phrase.\n");
+                 goto end;
+               }
+            }
+
+           ss = snmp_open(&session);
+
+           if (ss == NULL) {
+	      if (verbose) warn("error:snmp_new_v3_session:Couldn't open SNMP session");
+           }
+        end:
+           RETVAL = ss;
+	   free (session.contextEngineID);
+	}
+        OUTPUT:
+        RETVAL
+
+
+SnmpSession *
+snmp_update_session(sess_ref, version, community, peer, lport, retries, timeout)
+        SV *	sess_ref
+        char *	version
+        char *	community
+        char *	peer
+        int	lport
+        int	retries
+        int	timeout
+	CODE:
+	{
+           SV **sess_ptr_sv;
+	   SnmpSession *ss;
+           int verbose = SvIV(perl_get_sv("SNMP::verbose", 0x01 | 0x04));
+
+           sess_ptr_sv = hv_fetch((HV*)SvRV(sess_ref), "SessPtr", 7, 1);
+           ss = (SnmpSession *)SvIV((SV*)SvRV(*sess_ptr_sv));
+
+           if (!ss) goto update_end;
+
+           if (!strcmp(version, "1")) {
+		ss->version = SNMP_VERSION_1;
+           } else if (!strcmp(version, "2") || !strcmp(version, "2c")) {
+		ss->version = SNMP_VERSION_2c;
+	   } else if (!strcmp(version, "3")) {
+	        ss->version = SNMP_VERSION_3;
+	   } else {
+		if (verbose)
+                   warn("Unsupported SNMP version (%s)\n", version);
+                goto update_end;
+	   }
+           /* WARNING LEAKAGE but I cant free lib memory under win32 */
+           ss->community_len = strlen((char *)community);
+           ss->community = (u_char *)strdup(community);
+	   ss->peername = strdup(peer);
+	   ss->local_port = lport;
+           ss->retries = retries; /* 5 */
+           ss->timeout = timeout; /* 1000000L */
+           ss->authenticator = NULL;
+
+    update_end:
+	   RETVAL = ss;
+        }
+        OUTPUT:
+           RETVAL
+
+int
+snmp_add_mib_dir(mib_dir,force=0)
+	char *		mib_dir
+	int		force
+	CODE:
+        {
+	int result = 0;      /* Avoid use of uninitialized variable below. */
+        int verbose = SvIV(perl_get_sv("SNMP::verbose", 0x01 | 0x04));
+
+        if (mib_dir && *mib_dir) {
+	   result = add_mibdir(mib_dir);
+        }
+        if (result) {
+           if (verbose) warn("Added mib dir %s\n", mib_dir);
+        } else {
+           if (verbose) warn("Failed to add %s\n", mib_dir);
+        }
+        RETVAL = (I32)result;
+        }
+        OUTPUT:
+        RETVAL
+
+void
+snmp_init_mib_internals()
+	CODE:
+        {
+        int verbose = SvIV(perl_get_sv("SNMP::verbose", 0x01 | 0x04));
+
+        /* should test better to see if it has been done already */
+	if (Mib == NULL) {
+           if (verbose) warn("initializing MIB internals (empty)\n");
+           /* init_mib_internals(); */
+        }
+        }
+
+
+int
+snmp_read_mib(mib_file, force=0)
+	char *		mib_file
+	int		force
+	CODE:
+        {
+        int verbose = SvIV(perl_get_sv("SNMP::verbose", 0x01 | 0x04));
+
+        /* if (Mib && force) __free_tree(Mib); needs more work to cleanup */
+
+        if ((mib_file == NULL) || (*mib_file == '\0')) {
+           if (Mib == NULL) {
+              if (verbose) warn("initializing MIB\n");
+              /* init_mib_internals(); */
+              init_mib();
+              if (Mib) {
+                 if (verbose) warn("done\n");
+              } else {
+                 if (verbose) warn("failed\n");
+              }
+	   }
+        } else {
+           if (verbose) warn("reading MIB: %s [%s:%s]\n", mib_file, DEFAULT_MIBDIRS, DEFAULT_MIBS);
+           /* if (Mib == NULL) init_mib_internals();*/
+           if (strcmp("ALL",mib_file))
+              read_mib(mib_file);
+           else
+             read_all_mibs();
+           if (Mib) {
+              if (verbose) warn("done\n");
+           } else {
+              if (verbose) warn("failed\n");
+           }
+        }
+        RETVAL = (I32)Mib;
+        }
+        OUTPUT:
+        RETVAL
+
+
+int
+snmp_read_module(module)
+	char *		module
+	CODE:
+        {
+        int verbose = SvIV(perl_get_sv("SNMP::verbose", 0x01 | 0x04));
+
+        if (!strcmp(module,"ALL")) {
+           read_all_mibs();
+        } else {
+           read_module(module);
+        }
+        if (Mib) {
+           if (verbose) warn("Read %s\n", module);
+        } else {
+           if (verbose) warn("Failed reading %s\n", module);
+        }
+        RETVAL = (I32)Mib;
+        }
+        OUTPUT:
+        RETVAL
+
+
+int
+snmp_set(sess_ref, varlist_ref, perl_callback)
+        SV *	sess_ref
+        SV *	varlist_ref
+        SV *	perl_callback
+	PPCODE:
+	{
+           AV *varlist;
+           SV **varbind_ref;
+           SV **varbind_val_f;
+           AV *varbind;
+	   I32 varlist_len;
+	   I32 varlist_ind;
+           SnmpSession *ss;
+           netsnmp_pdu *pdu, *response;
+           struct tree *tp;
+	   oid *oid_arr;
+	   int oid_arr_len = MAX_OID_LEN;
+           char *tag_pv;
+           snmp_xs_cb_data *xs_cb_data;
+           SV **sess_ptr_sv;
+           SV **err_str_svp;
+           SV **err_num_svp;
+           SV **err_ind_svp;
+           int status = 0;
+           int type;
+	   int res;
+           int verbose = SvIV(perl_get_sv("SNMP::verbose", 0x01 | 0x04));
+           int use_enums;
+           struct enum_list *ep;
+
+           New (0, oid_arr, MAX_OID_LEN, oid);
+
+           if (oid_arr && SvROK(sess_ref) && SvROK(varlist_ref)) {
+
+	      use_enums = SvIV(*hv_fetch((HV*)SvRV(sess_ref),"UseEnums",8,1));
+              sess_ptr_sv = hv_fetch((HV*)SvRV(sess_ref), "SessPtr", 7, 1);
+	      ss = (SnmpSession *)SvIV((SV*)SvRV(*sess_ptr_sv));
+              err_str_svp = hv_fetch((HV*)SvRV(sess_ref), "ErrorStr", 8, 1);
+              err_num_svp = hv_fetch((HV*)SvRV(sess_ref), "ErrorNum", 8, 1);
+              err_ind_svp = hv_fetch((HV*)SvRV(sess_ref), "ErrorInd", 8, 1);
+              sv_setpv(*err_str_svp, "");
+              sv_setiv(*err_num_svp, 0);
+              sv_setiv(*err_ind_svp, 0);
+
+              pdu = snmp_pdu_create(SNMP_MSG_SET);
+
+              varlist = (AV*) SvRV(varlist_ref);
+              varlist_len = av_len(varlist);
+	      for(varlist_ind = 0; varlist_ind <= varlist_len; varlist_ind++) {
+                 varbind_ref = av_fetch(varlist, varlist_ind, 0);
+                 if (SvROK(*varbind_ref)) {
+                    varbind = (AV*) SvRV(*varbind_ref);
+                    tag_pv = __av_elem_pv(varbind, VARBIND_TAG_F,NULL);
+                    tp=__tag2oid(tag_pv,
+                                 __av_elem_pv(varbind, VARBIND_IID_F,NULL),
+                                 oid_arr, &oid_arr_len, &type,0);
+
+                    if (oid_arr_len==0) {
+                       if (verbose)
+                          warn("error: set: unknown object ID (%s)",
+                                (tag_pv?tag_pv:"<null>"));
+	               sv_catpv(*err_str_svp,
+                               (char*)snmp_api_errstring(SNMPERR_UNKNOWN_OBJID));
+                       sv_setiv(*err_num_svp, SNMPERR_UNKNOWN_OBJID);
+                       XPUSHs(&sv_undef); /* unknown OID */
+		       snmp_free_pdu(pdu);
+		       goto done;
+		    }
+
+
+                    if (type == TYPE_UNKNOWN) {
+                      type = __translate_appl_type(
+                                __av_elem_pv(varbind, VARBIND_TYPE_F, NULL));
+                      if (type == TYPE_UNKNOWN) {
+                         if (verbose)
+                            warn("error: set: no type found for object");
+	                 sv_catpv(*err_str_svp,
+                                  (char*)snmp_api_errstring(SNMPERR_VAR_TYPE));
+                         sv_setiv(*err_num_svp, SNMPERR_VAR_TYPE);
+                         XPUSHs(&sv_undef); /* unknown OID */
+		         snmp_free_pdu(pdu);
+		         goto done;
+                      }
+                    }
+
+	            varbind_val_f = av_fetch(varbind, VARBIND_VAL_F, 0);
+
+                    if (type==TYPE_INTEGER && use_enums && tp && tp->enums) {
+                      for(ep = tp->enums; ep; ep = ep->next) {
+                        if (varbind_val_f && SvOK(*varbind_val_f) &&
+                            !strcmp(ep->label, SvPV(*varbind_val_f,na))) {
+                          sv_setiv(*varbind_val_f, ep->value);
+                          break;
+                        }
+                      }
+                    }
+
+                    res = __add_var_val_str(pdu, oid_arr, oid_arr_len,
+				     (varbind_val_f && SvOK(*varbind_val_f) ?
+				      SvPV(*varbind_val_f,na):NULL),
+				      (varbind_val_f && SvOK(*varbind_val_f) ?
+				       SvCUR(*varbind_val_f):0), type);
+
+		    if (verbose && res == FAILURE)
+		      warn("error: adding variable/value to PDU");
+                 } /* if var_ref is ok */
+              } /* for all the vars */
+
+              if (SvTRUE(perl_callback)) {
+                  xs_cb_data =
+                      (snmp_xs_cb_data*)malloc(sizeof(snmp_xs_cb_data));
+                 xs_cb_data->perl_cb = newSVsv(perl_callback);
+                 xs_cb_data->sess_ref = newRV_inc(SvRV(sess_ref));
+
+                 status = snmp_async_send(ss, pdu, __snmp_xs_cb,
+                                          (void*)xs_cb_data);
+                 if (status != 0) {
+                    XPUSHs(sv_2mortal(newSViv(status))); /* push the reqid?? */
+                 } else {
+                    snmp_free_pdu(pdu);
+                    sv_catpv(*err_str_svp,
+                             (char*)snmp_api_errstring(ss->s_snmp_errno));
+                    sv_setiv(*err_num_svp, ss->s_snmp_errno);
+                    XPUSHs(&sv_undef);
+                 }
+		 goto done;
+              }
+
+	      status = __send_sync_pdu(ss, pdu, &response,
+				       NO_RETRY_NOSUCH,
+                                       *err_str_svp, *err_num_svp,
+                                       *err_ind_svp);
+
+              if (response) snmp_free_pdu(response);
+
+              if (status) {
+		 XPUSHs(&sv_undef);
+	      } else {
+                 XPUSHs(sv_2mortal(newSVpv(ZERO_BUT_TRUE,0)));
+              }
+           } else {
+
+              /* BUG!!! need to return an error value */
+              XPUSHs(&sv_undef); /* no mem or bad args */
+           }
+done:
+           Safefree(oid_arr);
+        }
+
+void
+snmp_catch(sess_ref, perl_callback)
+	SV *	sess_ref
+        SV *    perl_callback
+	PPCODE:
+	{
+	   netsnmp_session *ss;
+           SV **sess_ptr_sv;
+           SV **err_str_svp;
+           SV **err_num_svp;
+           SV **err_ind_svp;
+
+           if (SvROK(sess_ref)) {
+              sess_ptr_sv = hv_fetch((HV*)SvRV(sess_ref), "SessPtr", 7, 1);
+	      ss = (SnmpSession *)SvIV((SV*)SvRV(*sess_ptr_sv));
+              err_str_svp = hv_fetch((HV*)SvRV(sess_ref), "ErrorStr", 8, 1);
+              err_num_svp = hv_fetch((HV*)SvRV(sess_ref), "ErrorNum", 8, 1);
+              err_ind_svp = hv_fetch((HV*)SvRV(sess_ref), "ErrorInd", 8, 1);
+              sv_setpv(*err_str_svp, "");
+              sv_setiv(*err_num_svp, 0);
+              sv_setiv(*err_ind_svp, 0);
+
+              snmp_synch_reset(ss);
+              ss->callback = NULL;
+              ss->callback_magic = NULL;
+
+              if (SvTRUE(perl_callback)) {
+                 perl_callback = newSVsv(perl_callback);
+                 # it might be more efficient to pass the varbind_ref to
+                 # __snmp_xs_cb as part of perl_callback so it is not freed
+                 # and reconstructed for each call
+                 ss->callback = __callback_wrapper;
+                 ss->callback_magic = perl_callback;
+                 sv_2mortal(newSViv(1));
+                 goto done;
+              }
+           }
+           sv_2mortal(newSViv(0));
+        done:
+           ;
+        }
+
+void
+snmp_get(sess_ref, retry_nosuch, varlist_ref, perl_callback)
+        SV *    sess_ref
+        int     retry_nosuch
+        SV *    varlist_ref
+        SV *    perl_callback
+        PPCODE:
+        {
+           AV *varlist;
+           SV **varbind_ref;
+           AV *varbind;
+           I32 varlist_len;
+           I32 varlist_ind;
+           netsnmp_session *ss;
+           netsnmp_pdu *pdu, *response;
+           netsnmp_variable_list *vars;
+           netsnmp_variable_list *last_vars;
+           struct tree *tp;
+           int len;
+           oid *oid_arr = NULL;
+           int oid_arr_len = MAX_OID_LEN;
+           SV *tmp_sv;
+           char *tag_pv;
+           int type;
+           char tmp_type_str[MAX_TYPE_NAME_LEN];
+           snmp_xs_cb_data *xs_cb_data;
+           SV **sess_ptr_sv;
+           SV **err_str_svp;
+           SV **err_num_svp;
+           SV **err_ind_svp;
+           int status;
+	   u_char str_buf[STR_BUF_SIZE], *str_bufp = str_buf;
+           size_t str_buf_len = sizeof(str_buf);
+           size_t out_len = 0;
+           int buf_over = 0;
+           char *label;
+           char *iid;
+           int getlabel_flag = NO_FLAGS;
+           int sprintval_flag = USE_BASIC;
+           int verbose = SvIV(perl_get_sv("SNMP::verbose", 0x01 | 0x04));
+	   int old_format;
+	   SV *sv_timestamp = NULL;
+
+           New (0, oid_arr, MAX_OID_LEN, oid);
+
+           if (oid_arr && SvROK(sess_ref) && SvROK(varlist_ref)) {
+
+              sess_ptr_sv = hv_fetch((HV*)SvRV(sess_ref), "SessPtr", 7, 1);
+              ss = (SnmpSession *)SvIV((SV*)SvRV(*sess_ptr_sv));
+              err_str_svp = hv_fetch((HV*)SvRV(sess_ref), "ErrorStr", 8, 1);
+              err_num_svp = hv_fetch((HV*)SvRV(sess_ref), "ErrorNum", 8, 1);
+              err_ind_svp = hv_fetch((HV*)SvRV(sess_ref), "ErrorInd", 8, 1);
+              sv_setpv(*err_str_svp, "");
+              sv_setiv(*err_num_svp, 0);
+              sv_setiv(*err_ind_svp, 0);
+	      if (SvIV(*hv_fetch((HV*)SvRV(sess_ref),"UseLongNames", 12, 1)))
+                 getlabel_flag |= USE_LONG_NAMES;
+	      if (SvIV(*hv_fetch((HV*)SvRV(sess_ref),"UseNumeric", 10, 1)))
+                 getlabel_flag |= USE_NUMERIC_OIDS;
+              if (SvIV(*hv_fetch((HV*)SvRV(sess_ref),"UseEnums", 8, 1)))
+                 sprintval_flag = USE_ENUMS;
+              if (SvIV(*hv_fetch((HV*)SvRV(sess_ref),"UseSprintValue", 14, 1)))
+                 sprintval_flag = USE_SPRINT_VALUE;
+
+              pdu = snmp_pdu_create(SNMP_MSG_GET);
+
+              varlist = (AV*) SvRV(varlist_ref);
+              varlist_len = av_len(varlist);
+              for(varlist_ind = 0; varlist_ind <= varlist_len; varlist_ind++) {
+                 varbind_ref = av_fetch(varlist, varlist_ind, 0);
+                 if (SvROK(*varbind_ref)) {
+                    varbind = (AV*) SvRV(*varbind_ref);
+                    tag_pv = __av_elem_pv(varbind, VARBIND_TAG_F,NULL);
+                    tp = __tag2oid(tag_pv,
+                                   __av_elem_pv(varbind, VARBIND_IID_F,NULL),
+                                   oid_arr, &oid_arr_len, NULL,0);
+
+                    if (oid_arr_len) {
+                       snmp_add_null_var(pdu, oid_arr, oid_arr_len);
+                    } else {
+                       if (verbose)
+                          warn("error: get: unknown object ID (%s)",
+                                (tag_pv?tag_pv:"<null>"));
+	               sv_catpv(*err_str_svp,
+                                (char*)snmp_api_errstring(SNMPERR_UNKNOWN_OBJID));
+                       sv_setiv(*err_num_svp, SNMPERR_UNKNOWN_OBJID);
+                       XPUSHs(&sv_undef); /* unknown OID */
+		       snmp_free_pdu(pdu);
+		       goto done;
+                    }
+                 } /* if var_ref is ok */
+              } /* for all the vars */
+
+              if (perl_callback && SvTRUE(perl_callback)) {
+                  xs_cb_data =
+                      (snmp_xs_cb_data*)malloc(sizeof(snmp_xs_cb_data));
+                 xs_cb_data->perl_cb = newSVsv(perl_callback);
+                 xs_cb_data->sess_ref = newSVsv(sess_ref);
+
+                 status = snmp_async_send(ss, pdu, __snmp_xs_cb,
+                                          (void*)xs_cb_data);
+                 if (status != 0) {
+                    XPUSHs(sv_2mortal(newSViv(status))); /* push the reqid?? */
+                 } else {
+                    snmp_free_pdu(pdu);
+                    sv_catpv(*err_str_svp,
+                             (char*)snmp_api_errstring(ss->s_snmp_errno));
+                    sv_setiv(*err_num_svp, ss->s_snmp_errno);
+                    XPUSHs(&sv_undef);
+                 }
+                 goto done;
+              }
+
+              status = __send_sync_pdu(ss, pdu, &response, retry_nosuch,
+                                       *err_str_svp,*err_num_svp,*err_ind_svp);
+
+              last_vars = (response ? response->variables : NULL);
+
+	      /*
+	      ** Set up for numeric or full OID's, if necessary.  Save the old
+	      ** output format so that it can be restored when we finish -- this
+	      ** is a library-wide global, and has to be set/restored for each
+	      ** session.
+	      */
+	      old_format = netsnmp_ds_get_int(NETSNMP_DS_LIBRARY_ID,
+                                              NETSNMP_DS_LIB_OID_OUTPUT_FORMAT);
+
+	      if (SvIV(*hv_fetch((HV*)SvRV(sess_ref),"UseLongNames", 12, 1))) {
+	         getlabel_flag |= USE_LONG_NAMES;
+
+	         netsnmp_ds_set_int(NETSNMP_DS_LIBRARY_ID,
+                                    NETSNMP_DS_LIB_OID_OUTPUT_FORMAT,
+                                    NETSNMP_OID_OUTPUT_FULL);
+	      }
+              /* Setting UseNumeric forces UseLongNames on so check for UseNumeric
+                 after UseLongNames (above) to make sure the final outcome of 
+                 NETSNMP_DS_LIB_OID_OUTPUT_FORMAT is NETSNMP_OID_OUTPUT_NUMERIC */
+	      if (SvIV(*hv_fetch((HV*)SvRV(sess_ref),"UseNumeric", 10, 1))) {
+	         getlabel_flag |= USE_LONG_NAMES;
+	         getlabel_flag |= USE_NUMERIC_OIDS;
+
+	         netsnmp_ds_set_int(NETSNMP_DS_LIBRARY_ID,
+                                    NETSNMP_DS_LIB_OID_OUTPUT_FORMAT,
+                                    NETSNMP_OID_OUTPUT_NUMERIC);
+	      }
+
+	      if (SvIOK(*hv_fetch((HV*)SvRV(sess_ref),"TimeStamp", 9, 1)) &&
+                  SvIV(*hv_fetch((HV*)SvRV(sess_ref),"TimeStamp", 9, 1)))
+	         sv_timestamp = newSViv((IV)time(NULL));
+
+              for(vars = (response?response->variables:NULL), varlist_ind = 0;
+                  vars && (varlist_ind <= varlist_len);
+                  vars = vars->next_variable, varlist_ind++) {
+                 varbind_ref = av_fetch(varlist, varlist_ind, 0);
+                 if (SvROK(*varbind_ref)) {
+                    varbind = (AV*) SvRV(*varbind_ref);
+
+                    *str_buf = '.';
+                    *(str_buf+1) = '\0';
+                    out_len = 0;
+                    tp = netsnmp_sprint_realloc_objid_tree(&str_bufp, &str_buf_len,
+                                                           &out_len, 0, &buf_over,
+                                                           vars->name,vars->name_length);
+                    str_buf[sizeof(str_buf)-1] = '\0';
+
+                    if (__is_leaf(tp)) {
+                       type = tp->type;
+                    } else {
+                       getlabel_flag |= NON_LEAF_NAME;
+                       type = __translate_asn_type(vars->type);
+                    }
+                    __get_label_iid(str_buf,&label,&iid,getlabel_flag);
+                    if (label) {
+                        av_store(varbind, VARBIND_TAG_F,
+                                 newSVpv(label, strlen(label)));
+                    } else {
+                        av_store(varbind, VARBIND_TAG_F,
+                                 newSVpv("", 0));
+                    }
+                    if (iid) {
+                        av_store(varbind, VARBIND_IID_F,
+                                 newSVpv(iid, strlen(iid)));
+                    } else {
+                        av_store(varbind, VARBIND_IID_F,
+                                 newSVpv("", 0));
+                    }                        
+                    __get_type_str(type, tmp_type_str);
+                    tmp_sv = newSVpv(tmp_type_str, strlen(tmp_type_str));
+                    av_store(varbind, VARBIND_TYPE_F, tmp_sv);
+                    len=__snprint_value(str_buf,sizeof(str_buf),
+                                       vars,tp,type,sprintval_flag);
+                    tmp_sv = newSVpv((char*)str_buf, len);
+                    av_store(varbind, VARBIND_VAL_F, tmp_sv);
+		    if (sv_timestamp)
+                       av_store(varbind, VARBIND_TYPE_F, sv_timestamp);
+                    XPUSHs(sv_mortalcopy(tmp_sv));
+                 } else {
+		    /* Return undef for this variable. */
+                    XPUSHs(&sv_undef);
+                 }
+              }
+
+	      /* Reset the library's behavior for numeric/symbolic OID's. */
+	         netsnmp_ds_set_int(NETSNMP_DS_LIBRARY_ID,
+                                    NETSNMP_DS_LIB_OID_OUTPUT_FORMAT,
+                                    old_format);
+
+              if (response) snmp_free_pdu(response);
+           } else {
+              XPUSHs(&sv_undef); /* no mem or bad args */
+           }
+     done:
+           Safefree(oid_arr);
+        }
+
+int
+snmp_getnext(sess_ref, varlist_ref, perl_callback)
+        SV *    sess_ref
+        SV *    varlist_ref
+        SV *    perl_callback
+        PPCODE:
+        {
+           AV *varlist;
+           SV **varbind_ref;
+           AV *varbind;
+           I32 varlist_len;
+           I32 varlist_ind;
+           netsnmp_session *ss;
+           netsnmp_pdu *pdu, *response;
+           netsnmp_variable_list *vars;
+           struct tree *tp;
+           int len;
+	   oid *oid_arr;
+	   int oid_arr_len = MAX_OID_LEN;
+           SV *tmp_sv;
+           int type;
+	   char tmp_type_str[MAX_TYPE_NAME_LEN];
+           snmp_xs_cb_data *xs_cb_data;
+           SV **sess_ptr_sv;
+           SV **err_str_svp;
+           SV **err_num_svp;
+           SV **err_ind_svp;
+           int status;
+	   u_char str_buf[STR_BUF_SIZE], *str_bufp = str_buf;
+           size_t str_buf_len = sizeof(str_buf);
+           size_t out_len = 0;
+           int buf_over = 0;
+           char *label;
+           char *iid;
+           int getlabel_flag = NO_FLAGS;
+           int sprintval_flag = USE_BASIC;
+           int verbose = SvIV(perl_get_sv("SNMP::verbose", 0x01 | 0x04));
+	   int old_format;
+	   SV *sv_timestamp = NULL;
+
+           New (0, oid_arr, MAX_OID_LEN, oid);
+
+           if (oid_arr && SvROK(sess_ref) && SvROK(varlist_ref)) {
+
+              sess_ptr_sv = hv_fetch((HV*)SvRV(sess_ref), "SessPtr", 7, 1);
+	      ss = (SnmpSession *)SvIV((SV*)SvRV(*sess_ptr_sv));
+              err_str_svp = hv_fetch((HV*)SvRV(sess_ref), "ErrorStr", 8, 1);
+              err_num_svp = hv_fetch((HV*)SvRV(sess_ref), "ErrorNum", 8, 1);
+              err_ind_svp = hv_fetch((HV*)SvRV(sess_ref), "ErrorInd", 8, 1);
+              sv_setpv(*err_str_svp, "");
+              sv_setiv(*err_num_svp, 0);
+              sv_setiv(*err_ind_svp, 0);
+	      if (SvIV(*hv_fetch((HV*)SvRV(sess_ref),"UseLongNames", 12, 1)))
+                 getlabel_flag |= USE_LONG_NAMES;
+	      if (SvIV(*hv_fetch((HV*)SvRV(sess_ref),"UseEnums", 8, 1)))
+                 sprintval_flag = USE_ENUMS;
+	      if (SvIV(*hv_fetch((HV*)SvRV(sess_ref),"UseSprintValue", 14, 1)))
+                 sprintval_flag = USE_SPRINT_VALUE;
+
+              pdu = snmp_pdu_create(SNMP_MSG_GETNEXT);
+
+              varlist = (AV*) SvRV(varlist_ref);
+              varlist_len = av_len(varlist);
+	      for(varlist_ind = 0; varlist_ind <= varlist_len; varlist_ind++) {
+                 varbind_ref = av_fetch(varlist, varlist_ind, 0);
+                 if (SvROK(*varbind_ref)) {
+                    varbind = (AV*) SvRV(*varbind_ref);
+
+                    tp = __tag2oid(__av_elem_pv(varbind, VARBIND_TAG_F, ".0"),
+                              __av_elem_pv(varbind, VARBIND_IID_F, NULL),
+                              oid_arr, &oid_arr_len, NULL,0);
+
+      		    if (oid_arr_len) {
+  		       snmp_add_null_var(pdu, oid_arr, oid_arr_len);
+		    } else {
+                       if (verbose)
+                          warn("error: set: unknown object ID");
+	               sv_catpv(*err_str_svp,
+                               (char*)snmp_api_errstring(SNMPERR_UNKNOWN_OBJID));
+                       sv_setiv(*err_num_svp, SNMPERR_UNKNOWN_OBJID);
+                       XPUSHs(&sv_undef); /* unknown OID */
+		       snmp_free_pdu(pdu);
+		       goto done;
+		    }
+
+                 } /* if var_ref is ok */
+              } /* for all the vars */
+
+              if (SvTRUE(perl_callback)) {
+                  xs_cb_data =
+                      (snmp_xs_cb_data*)malloc(sizeof(snmp_xs_cb_data));
+                 xs_cb_data->perl_cb = newSVsv(perl_callback);
+                 xs_cb_data->sess_ref = newSVsv(sess_ref);
+
+                 status = snmp_async_send(ss, pdu, __snmp_xs_cb,
+                                          (void*)xs_cb_data);
+                 if (status != 0) {
+                    XPUSHs(sv_2mortal(newSViv(status))); /* push the reqid?? */
+                 } else {
+                    snmp_free_pdu(pdu);
+                    sv_catpv(*err_str_svp,
+                             (char*)snmp_api_errstring(ss->s_snmp_errno));
+                    sv_setiv(*err_num_svp, ss->s_snmp_errno);
+                    XPUSHs(&sv_undef);
+                 }
+		 goto done;
+              }
+
+	      status = __send_sync_pdu(ss, pdu, &response,
+				       NO_RETRY_NOSUCH,
+                                       *err_str_svp, *err_num_svp,
+				       *err_ind_svp);
+
+	      /*
+	      ** Set up for numeric OID's, if necessary.  Save the old values
+	      ** so that they can be restored when we finish -- these are
+	      ** library-wide globals, and have to be set/restored for each
+	      ** session.
+	      */
+	      old_format = netsnmp_ds_get_int(NETSNMP_DS_LIBRARY_ID,
+                                              NETSNMP_DS_LIB_OID_OUTPUT_FORMAT);
+
+	      if (SvIV(*hv_fetch((HV*)SvRV(sess_ref),"UseLongNames", 12, 1))) {
+	         getlabel_flag |= USE_LONG_NAMES;
+
+	         netsnmp_ds_set_int(NETSNMP_DS_LIBRARY_ID,
+                                    NETSNMP_DS_LIB_OID_OUTPUT_FORMAT,
+                                    NETSNMP_OID_OUTPUT_FULL);
+	      }
+              /* Setting UseNumeric forces UseLongNames on so check
+                 for UseNumeric after UseLongNames (above) to make
+                 sure the final outcome of
+                 NETSNMP_DS_LIB_OID_OUTPUT_FORMAT is
+                 NETSNMP_OID_OUTPUT_NUMERIC */
+	      if (SvIV(*hv_fetch((HV*)SvRV(sess_ref),"UseNumeric", 10, 1))) {
+	         getlabel_flag |= USE_LONG_NAMES;
+	         getlabel_flag |= USE_NUMERIC_OIDS;
+
+	         netsnmp_ds_set_int(NETSNMP_DS_LIBRARY_ID,
+                                    NETSNMP_DS_LIB_OID_OUTPUT_FORMAT,
+                                    NETSNMP_OID_OUTPUT_NUMERIC);
+	      }
+
+	      if (SvIOK(*hv_fetch((HV*)SvRV(sess_ref),"TimeStamp", 9, 1)) &&
+                  SvIV(*hv_fetch((HV*)SvRV(sess_ref),"TimeStamp", 9, 1)))
+	         sv_timestamp = newSViv((IV)time(NULL));
+
+              for(vars = (response?response->variables:NULL), varlist_ind = 0;
+                  vars && (varlist_ind <= varlist_len);
+                  vars = vars->next_variable, varlist_ind++) {
+                 varbind_ref = av_fetch(varlist, varlist_ind, 0);
+                 if (SvROK(*varbind_ref)) {
+                    varbind = (AV*) SvRV(*varbind_ref);
+
+                    *str_buf = '.';
+                    *(str_buf+1) = '\0';
+                    out_len = 0;
+                    tp = netsnmp_sprint_realloc_objid_tree(&str_bufp, &str_buf_len,
+                                                           &out_len, 0, &buf_over,
+                                                           vars->name,vars->name_length);
+                    str_buf[sizeof(str_buf)-1] = '\0';
+
+                    if (__is_leaf(tp)) {
+                       type = tp->type;
+                    } else {
+                       getlabel_flag |= NON_LEAF_NAME;
+                       type = __translate_asn_type(vars->type);
+                    }
+                    __get_label_iid(str_buf,&label,&iid,getlabel_flag);
+                    if (label) {
+                        av_store(varbind, VARBIND_TAG_F,
+                                 newSVpv(label, strlen(label)));
+                    } else {
+                        av_store(varbind, VARBIND_TAG_F,
+                                 newSVpv("", 0));
+                    }
+                    if (iid) {
+                        av_store(varbind, VARBIND_IID_F,
+                                 newSVpv(iid, strlen(iid)));
+                    } else {
+                        av_store(varbind, VARBIND_IID_F,
+                                 newSVpv("", 0));
+                    }                        
+                    __get_type_str(type, tmp_type_str);
+                    tmp_sv = newSVpv(tmp_type_str, strlen(tmp_type_str));
+                    av_store(varbind, VARBIND_TYPE_F, tmp_sv);
+                    len=__snprint_value(str_buf,sizeof(str_buf),
+                                       vars,tp,type,sprintval_flag);
+                    tmp_sv = newSVpv((char*)str_buf, len);
+                    av_store(varbind, VARBIND_VAL_F, tmp_sv);
+		    if (sv_timestamp)
+                       av_store(varbind, VARBIND_TYPE_F, sv_timestamp);
+                    XPUSHs(sv_mortalcopy(tmp_sv));
+                 } else {
+		    /* Return undef for this variable. */
+                    XPUSHs(&sv_undef);
+                 }
+              }
+
+	      /* Reset the library's behavior for numeric/symbolic OID's. */
+              netsnmp_ds_set_int(NETSNMP_DS_LIBRARY_ID,
+                                 NETSNMP_DS_LIB_OID_OUTPUT_FORMAT,
+                                 old_format);
+
+              if (response) snmp_free_pdu(response);
+
+           } else {
+              XPUSHs(&sv_undef); /* no mem or bad args */
+	   }
+done:
+	Safefree(oid_arr);
+	}
+
+int
+snmp_getbulk(sess_ref, nonrepeaters, maxrepetitions, varlist_ref, perl_callback)
+        SV *	sess_ref
+	int nonrepeaters
+	int maxrepetitions
+        SV *	varlist_ref
+        SV *	perl_callback
+	PPCODE:
+	{
+           AV *varlist;
+           SV **varbind_ref;
+           AV *varbind;
+	   I32 varlist_len;
+	   I32 varlist_ind;
+           netsnmp_session *ss;
+           netsnmp_pdu *pdu, *response;
+           netsnmp_variable_list *vars;
+           struct tree *tp;
+           int len;
+	   oid *oid_arr;
+	   int oid_arr_len = MAX_OID_LEN;
+           SV *tmp_sv;
+           int type;
+	   char tmp_type_str[MAX_TYPE_NAME_LEN];
+           snmp_xs_cb_data *xs_cb_data;
+           SV **sess_ptr_sv;
+           SV **err_str_svp;
+           SV **err_num_svp;
+           SV **err_ind_svp;
+           int status;
+	   u_char str_buf[STR_BUF_SIZE], *str_bufp = str_buf;
+           size_t str_buf_len = sizeof(str_buf);
+           size_t out_len = 0;
+           int buf_over = 0;
+           char *label;
+           char *iid;
+           int getlabel_flag = NO_FLAGS;
+           int sprintval_flag = USE_BASIC;
+           int verbose = SvIV(perl_get_sv("SNMP::verbose", 0x01 | 0x04));
+	   int old_format;
+	   SV *rv;
+	   SV *sv_timestamp = NULL;
+
+           New (0, oid_arr, MAX_OID_LEN, oid);
+
+           if (oid_arr && SvROK(sess_ref) && SvROK(varlist_ref)) {
+
+              sess_ptr_sv = hv_fetch((HV*)SvRV(sess_ref), "SessPtr", 7, 1);
+	      ss = (SnmpSession *)SvIV((SV*)SvRV(*sess_ptr_sv));
+              err_str_svp = hv_fetch((HV*)SvRV(sess_ref), "ErrorStr", 8, 1);
+              err_num_svp = hv_fetch((HV*)SvRV(sess_ref), "ErrorNum", 8, 1);
+              err_ind_svp = hv_fetch((HV*)SvRV(sess_ref), "ErrorInd", 8, 1);
+              sv_setpv(*err_str_svp, "");
+              sv_setiv(*err_num_svp, 0);
+              sv_setiv(*err_ind_svp, 0);
+	      if (SvIV(*hv_fetch((HV*)SvRV(sess_ref),"UseLongNames", 12, 1)))
+                 getlabel_flag |= USE_LONG_NAMES;
+	      if (SvIV(*hv_fetch((HV*)SvRV(sess_ref),"UseNumeric", 10, 1)))
+		 getlabel_flag |= USE_NUMERIC_OIDS;
+	      if (SvIV(*hv_fetch((HV*)SvRV(sess_ref),"UseEnums", 8, 1)))
+                 sprintval_flag = USE_ENUMS;
+	      if (SvIV(*hv_fetch((HV*)SvRV(sess_ref),"UseSprintValue", 14, 1)))
+                 sprintval_flag = USE_SPRINT_VALUE;
+
+              pdu = snmp_pdu_create(SNMP_MSG_GETBULK);
+
+	      pdu->errstat = nonrepeaters;
+	      pdu->errindex = maxrepetitions;
+
+              varlist = (AV*) SvRV(varlist_ref);
+              varlist_len = av_len(varlist);
+	      for(varlist_ind = 0; varlist_ind <= varlist_len; varlist_ind++) {
+                 varbind_ref = av_fetch(varlist, varlist_ind, 0);
+                 if (SvROK(*varbind_ref)) {
+                    varbind = (AV*) SvRV(*varbind_ref);
+                    __tag2oid(__av_elem_pv(varbind, VARBIND_TAG_F, "0"),
+                              __av_elem_pv(varbind, VARBIND_IID_F, NULL),
+                              oid_arr, &oid_arr_len, NULL,0);
+
+
+                    if (oid_arr_len) {
+  		       snmp_add_null_var(pdu, oid_arr, oid_arr_len);
+		    } else {
+                       if (verbose)
+                          warn("error: set: unknown object ID");
+	               sv_catpv(*err_str_svp,
+                               (char*)snmp_api_errstring(SNMPERR_UNKNOWN_OBJID));
+                       sv_setiv(*err_num_svp, SNMPERR_UNKNOWN_OBJID);
+                       XPUSHs(&sv_undef); /* unknown OID */
+		       snmp_free_pdu(pdu);
+		       goto done;
+		    }
+
+
+                 } /* if var_ref is ok */
+              } /* for all the vars */
+
+              if (SvTRUE(perl_callback)) {
+                  xs_cb_data =
+                      (snmp_xs_cb_data*)malloc(sizeof(snmp_xs_cb_data));
+                 xs_cb_data->perl_cb = newSVsv(perl_callback);
+                 xs_cb_data->sess_ref = newSVsv(sess_ref);
+
+                 status = snmp_async_send(ss, pdu, __snmp_xs_cb,
+                                          (void*)xs_cb_data);
+                 if (status != 0) {
+                    XPUSHs(sv_2mortal(newSViv(status))); /* push the reqid?? */
+                 } else {
+                    snmp_free_pdu(pdu);
+                    sv_catpv(*err_str_svp,
+                             (char*)snmp_api_errstring(ss->s_snmp_errno));
+                    sv_setiv(*err_num_svp, ss->s_snmp_errno);
+                    XPUSHs(&sv_undef);
+                 }
+		 goto done;
+              }
+
+	      status = __send_sync_pdu(ss, pdu, &response,
+				       NO_RETRY_NOSUCH,
+                                       *err_str_svp, *err_num_svp,
+				       *err_ind_svp);
+
+	      if (SvIV(*hv_fetch((HV*)SvRV(sess_ref),"TimeStamp", 9, 1)))
+	         sv_timestamp = newSViv((IV)time(NULL));
+
+	      av_clear(varlist);
+
+	      /*
+	      ** Set up for numeric or full OID's, if necessary.  Save the old
+	      ** output format so that it can be restored when we finish -- this
+	      ** is a library-wide global, and has to be set/restored for each
+	      ** session.
+	      */
+	      old_format = netsnmp_ds_get_int(NETSNMP_DS_LIBRARY_ID,
+                                              NETSNMP_DS_LIB_OID_OUTPUT_FORMAT);
+
+	      if (SvIV(*hv_fetch((HV*)SvRV(sess_ref),"UseLongNames", 12, 1))) {
+	         getlabel_flag |= USE_LONG_NAMES;
+
+	         netsnmp_ds_set_int(NETSNMP_DS_LIBRARY_ID,
+                                    NETSNMP_DS_LIB_OID_OUTPUT_FORMAT,
+                                    NETSNMP_OID_OUTPUT_FULL);
+	      }
+              /* Setting UseNumeric forces UseLongNames on so check
+                 for UseNumeric after UseLongNames (above) to make
+                 sure the final outcome of
+                 NETSNMP_DS_LIB_OID_OUTPUT_FORMAT is
+                 NETSNMP_OID_OUTPUT_NUMERIC */
+	      if (SvIV(*hv_fetch((HV*)SvRV(sess_ref),"UseNumeric", 10, 1))) {
+	         getlabel_flag |= USE_LONG_NAMES;
+	         getlabel_flag |= USE_NUMERIC_OIDS;
+
+	         netsnmp_ds_set_int(NETSNMP_DS_LIBRARY_ID,
+                                    NETSNMP_DS_LIB_OID_OUTPUT_FORMAT,
+                                    NETSNMP_OID_OUTPUT_NUMERIC);
+	      }
+
+	      if(response && response->variables) {
+              for(vars = response->variables;
+                  vars;
+                  vars = vars->next_variable) {
+
+                    varbind = (AV*) newAV();
+                    *str_buf = '.';
+                    *(str_buf+1) = '\0';
+                    out_len = 0;
+                    tp = netsnmp_sprint_realloc_objid_tree(&str_bufp, &str_buf_len,
+                                                           &out_len, 0, &buf_over,
+                                                           vars->name,vars->name_length);
+                    str_buf[sizeof(str_buf)-1] = '\0';
+                    if (__is_leaf(tp)) {
+                       type = tp->type;
+                    } else {
+                       getlabel_flag |= NON_LEAF_NAME;
+                       type = __translate_asn_type(vars->type);
+                    }
+                    __get_label_iid(str_buf,&label,&iid,getlabel_flag);
+
+		    av_store(varbind, VARBIND_TAG_F,
+			     newSVpv(label, strlen(label)));
+		    av_store(varbind, VARBIND_IID_F,
+			     newSVpv(iid, strlen(iid)));
+
+                    __get_type_str(type, tmp_type_str);
+		    av_store(varbind, VARBIND_TYPE_F, newSVpv(tmp_type_str,
+				     strlen(tmp_type_str)));
+
+                    len=__snprint_value(str_buf,sizeof(str_buf),
+                                       vars,tp,type,sprintval_flag);
+                    tmp_sv = newSVpv((char*)str_buf, len);
+		    av_store(varbind, VARBIND_VAL_F, tmp_sv);
+		    if (sv_timestamp)
+		       av_store(varbind, VARBIND_TYPE_F, SvREFCNT_inc(sv_timestamp));
+
+		    rv = newRV_noinc((SV *)varbind);
+		    sv_bless(rv, gv_stashpv("SNMP::Varbind",0));
+		    av_push(varlist, rv);
+
+                    XPUSHs(sv_mortalcopy(tmp_sv));
+                 }
+              } else {
+                    XPUSHs(&sv_undef);
+	      }
+
+	      /* Reset the library's behavior for numeric/symbolic OID's. */
+              netsnmp_ds_set_int(NETSNMP_DS_LIBRARY_ID,
+                                 NETSNMP_DS_LIB_OID_OUTPUT_FORMAT,
+                                 old_format);
+
+              if (response) snmp_free_pdu(response);
+
+           } else {
+              XPUSHs(&sv_undef); /* no mem or bad args */
+	   }
+done:
+	Safefree(oid_arr);
+	}
+
+int
+snmp_bulkwalk(sess_ref, nonrepeaters, maxrepetitions, varlist_ref,perl_callback)
+        SV *	sess_ref
+	int nonrepeaters
+	int maxrepetitions
+        SV *	varlist_ref
+        SV *	perl_callback
+	PPCODE:
+	{
+           AV *varlist;
+           SV **varbind_ref;
+           AV *varbind;
+	   I32 varlist_len;
+	   I32 varlist_ind;
+           netsnmp_session *ss;
+           netsnmp_pdu *pdu = NULL;
+	   oid oid_arr[MAX_OID_LEN];
+	   int oid_arr_len;
+           SV **sess_ptr_sv;
+           SV **err_str_svp;
+           SV **err_num_svp;
+           SV **err_ind_svp;
+	   char str_buf[STR_BUF_SIZE];
+           int verbose = SvIV(perl_get_sv("SNMP::verbose", 0x01 | 0x04));
+	   walk_context *context = NULL;	/* Context for this bulkwalk */
+	   bulktbl *bt_entry;			/* Current bulktbl/OID entry */
+	   int i;				/* General purpose iterator  */
+	   int npushed;				/* Number of return arrays   */
+	   int okay;				/* Did bulkwalk complete okay */
+
+           if (!SvROK(sess_ref) || !SvROK(varlist_ref)) {
+	      if (verbose)
+		 warn("Bad session or varlist reference!\n");
+
+	      XSRETURN_UNDEF;
+	   }
+
+	   sess_ptr_sv = hv_fetch((HV*)SvRV(sess_ref), "SessPtr", 7, 1);
+	   ss = (SnmpSession *)SvIV((SV*)SvRV(*sess_ptr_sv));
+	   err_str_svp = hv_fetch((HV*)SvRV(sess_ref), "ErrorStr", 8, 1);
+	   err_num_svp = hv_fetch((HV*)SvRV(sess_ref), "ErrorNum", 8, 1);
+	   err_ind_svp = hv_fetch((HV*)SvRV(sess_ref), "ErrorInd", 8, 1);
+	   sv_setpv(*err_str_svp, "");
+	   sv_setiv(*err_num_svp, 0);
+	   sv_setiv(*err_ind_svp, 0);
+
+	   /* Create and initialize a new session context for this bulkwalk.
+	   ** This will be used to carry state between callbacks.
+	   */
+	   Newz(0x57616b6c /* "Walk" */, context, 1, walk_context);
+	   if (context == NULL) {
+	      sprintf(str_buf, "malloc(context) failed (%s)", strerror(errno));
+	      sv_setpv(*err_str_svp, str_buf);
+	      sv_setiv(*err_num_svp, SNMPERR_MALLOC);
+	      goto err;
+	   }
+
+	   /* Store the Perl callback and session reference in the context. */
+	   context->perl_cb  = newSVsv(perl_callback);
+	   context->sess_ref = newSVsv(sess_ref);
+
+	   DBPRT(3,("bulkwalk: sess_ref = 0x%p, sess_ptr_sv = 0x%p, ss = 0x%p\n",
+						    sess_ref, sess_ptr_sv, ss));
+
+           context->getlabel_f  = NO_FLAGS;	/* long/numeric name flags */
+           context->sprintval_f = USE_BASIC;	/* Don't do fancy printing */
+	   context->req_oids    = NULL;		/* List of oid's requested */
+	   context->repbase     = NULL;		/* Repeaters in req_oids[] */
+	   context->reqbase     = NULL;		/* Ptr to start of requests */
+	   context->nreq_oids   = 0;		/* Number of oid's in list */
+	   context->repeaters   = 0;		/* Repeater count (see below) */
+	   context->non_reps    = nonrepeaters;	/* Non-repeater var count */
+	   context->max_reps    = maxrepetitions; /* Max repetition/var count */
+	   context->pkts_exch   = 0;		/* Packets exchanged in walk */
+	   context->oid_total   = 0;		/* OID's received during walk */
+	   context->oid_saved   = 0;		/* OID's saved as results */
+
+	   if (SvIV(*hv_fetch((HV*)SvRV(sess_ref),"UseLongNames", 12, 1)))
+	      context->getlabel_f |= USE_LONG_NAMES;
+	   if (SvIV(*hv_fetch((HV*)SvRV(sess_ref),"UseNumeric", 10, 1)))
+	      context->getlabel_f |= USE_NUMERIC_OIDS;
+	   if (SvIV(*hv_fetch((HV*)SvRV(sess_ref),"UseEnums", 8, 1)))
+	      context->sprintval_f = USE_ENUMS;
+	   if (SvIV(*hv_fetch((HV*)SvRV(sess_ref),"UseSprintValue", 14, 1)))
+	      context->sprintval_f = USE_SPRINT_VALUE;
+
+	   /* Set up an array of bulktbl's to hold the original list of
+	   ** requested OID's.  This is used to populate the PDU's with
+	   ** oid values, to contain/sort the return values, and (through
+	   ** last_oid/last_len) to determine when the bulkwalk for each
+	   ** variable has completed.
+	   */
+	   varlist = (AV*) SvRV(varlist_ref);
+	   varlist_len = av_len(varlist) + 1;	/* XXX av_len returns index of
+						** last element not #elements */
+
+	   Newz(0, context->req_oids, varlist_len, bulktbl);
+
+	   if (context->req_oids == NULL) {
+	      sprintf(str_buf, "Newz(req_oids) failed (%s)", strerror(errno));
+	      if (verbose)
+	         warn(str_buf);
+	      sv_setpv(*err_str_svp, str_buf);
+	      sv_setiv(*err_num_svp, SNMPERR_MALLOC);
+	      goto err;
+	   }
+
+	   /* Walk through the varbind_list, parsing and copying each OID
+	   ** into a bulktbl slot in the req_oids array.  Bail if there's
+	   ** some error.  Create the initial packet to send out, which
+	   ** includes the non-repeaters.
+	   */
+	   DBPRT(1,( "Building request table:\n"));
+	   for (varlist_ind = 0; varlist_ind < varlist_len; varlist_ind++) {
+	      /* Get a handle on this entry in the request table. */
+	      bt_entry = &context->req_oids[context->nreq_oids];
+
+	      DBPRT(1,( "  request %d: ", (int)varlist_ind));
+
+	      /* Get the request varbind from the varlist, parse it out to
+	      ** tag and index, and copy it to the req_oid[] array slots.
+	      */
+	      varbind_ref = av_fetch(varlist, varlist_ind, 0);
+	      if (!SvROK(*varbind_ref)) {
+		 sv_setpv(*err_str_svp, \
+		       (char*)snmp_api_errstring(SNMPERR_BAD_NAME));
+		 sv_setiv(*err_num_svp, SNMPERR_BAD_NAME);
+		 goto err;
+	      }
+
+	      varbind = (AV*) SvRV(*varbind_ref);
+	      __tag2oid(__av_elem_pv(varbind, VARBIND_TAG_F, "0"),
+			__av_elem_pv(varbind, VARBIND_IID_F, NULL),
+			oid_arr, &oid_arr_len, NULL, 0);
+
+	      if ((oid_arr_len == 0) || (oid_arr_len > MAX_OID_LEN)) {
+		 if (verbose)
+		    warn("error: bulkwalk(): unknown object ID");
+		 sv_setpv(*err_str_svp, \
+		       (char*)snmp_api_errstring(SNMPERR_UNKNOWN_OBJID));
+		 sv_setiv(*err_num_svp, SNMPERR_UNKNOWN_OBJID);
+		 goto err;
+	      }
+
+	      /* Copy the now-parsed OID into the first available slot
+	      ** in the req_oids[] array.  Set both the req_oid (original
+	      ** request) and the last_oid (last requested/seen oid) to
+	      ** the initial value.  We build packets using last_oid (see
+	      ** below), so initialize last_oid to the initial request.
+	      */
+	      Copy((void *)oid_arr, (void *)bt_entry->req_oid,
+							oid_arr_len, oid);
+	      Copy((void *)oid_arr, (void *)bt_entry->last_oid,
+							oid_arr_len, oid);
+
+	      bt_entry->req_len  = oid_arr_len;
+	      bt_entry->last_len = oid_arr_len;
+
+	      /* Adjust offset to and count of repeaters.  Note non-repeater
+	      ** OID's in the list, if appropriate.
+	      */
+	      if (varlist_ind >= context->non_reps) {
+
+		 /* Store a pointer to the first repeater value. */
+		 if (context->repbase == NULL)
+		    context->repbase = bt_entry;
+
+		 context->repeaters ++;
+
+	      } else {
+		 bt_entry->norepeat = 1;
+		 DBPRT(1,( "(nonrepeater) "));
+	      }
+
+	      /* Initialize the array in which to hold the Varbinds to be
+	      ** returned for the OID or subtree.
+	      */
+	      if ((bt_entry->vars = (AV*) newAV()) == NULL) {
+		 sv_setpv(*err_str_svp, "newAV() failed: ");
+		 sv_catpv(*err_str_svp, strerror(errno));
+		 sv_setiv(*err_num_svp, SNMPERR_MALLOC);
+		 goto err;
+	      }
+
+	      DBPRT(1,( "%s\n", snprint_objid(_debugx, sizeof(_debugx), oid_arr, oid_arr_len)));
+
+	      context->nreq_oids ++;
+	   }
+
+	   /* Keep track of the number of outstanding requests.  This lets us
+	   ** finish processing early if we're done with all requests.
+	   */
+	   context->req_remain = context->nreq_oids;
+	   DBPRT(1,( "Total %d variable requests added\n", context->nreq_oids));
+
+	   /* If no good variable requests were found, return an error. */
+	   if (context->nreq_oids == 0) {
+		 sv_setpv(*err_str_svp, "No variables found in varlist");
+		 sv_setiv(*err_num_svp, SNMPERR_NO_VARS);
+		 goto err;
+	   }
+
+	   /* Note that this is a good context.  This allows later callbacks
+	   ** to ignore re-sent PDU's that correspond to completed (and hence
+	   ** destroyed) bulkwalk contexts.
+	   */
+	   _context_add(context);
+
+	   /* For asynchronous bulkwalk requests, all we have to do at this
+	   ** point is enqueue the asynchronous GETBULK request with our
+	   ** bulkwalk-specific callback and return.  Remember that the
+	   ** bulkwalk_send_pdu() function returns the reqid cast to an
+	   ** snmp_pdu pointer, or NULL on failure.  Return undef if the
+	   ** initial send fails; bulkwalk_send_pdu() takes care of setting
+	   ** the various error values.
+	   **
+	   ** From here, the callbacks do all the work, including sending
+	   ** requests for variables and handling responses.  The caller's
+	   ** callback will be invoked as soon as the walk completes.
+	   */
+	   if (SvTRUE(perl_callback)) {
+	      DBPRT(1,( "Starting asynchronous bulkwalk...\n"));
+
+	      pdu = _bulkwalk_send_pdu(context);
+
+	      if (pdu == NULL) {
+		 DBPRT(1,( "Initial asynchronous send failed...\n"));
+		 XSRETURN_UNDEF;
+	      }
+
+	      /* Sent okay...  Return the request ID in 'pdu' as an SvIV. */
+	      DBPRT(1,( "Okay, request id is %d\n", (int)pdu));
+/*	      XSRETURN_IV((int)pdu); */
+	      XPUSHs(sv_2mortal(newSViv((int)pdu)));
+	      XSRETURN(1);
+	   }
+
+	   /* For synchronous bulkwalk, we perform the basic send/receive
+	   ** iteration right here.  Once the walk has been completed, the
+	   ** bulkwalk_finish() function will push the return values onto
+	   ** the Perl call stack, and we return.
+	   */
+	   DBPRT(1,( "Starting synchronous bulkwalk...\n"));
+
+	   while (!(okay = _bulkwalk_done(context))) {
+
+	      /* Send a request for the next batch of variables. */
+	      DBPRT(1, (DBOUT "Building %s GETBULK bulkwalk PDU (%d)...\n",
+					context->pkts_exch ? "next" : "first",
+					context->pkts_exch));
+	      pdu = _bulkwalk_send_pdu(context);
+
+	      /* If the request failed, consider the walk done. */
+	      if (pdu == NULL) {
+		 DBPRT(1,( "bulkwalk_send_pdu() failed!\n"));
+		 break;
+	      }
+
+	      /* Handle the variables in this response packet.  Break out
+	      ** of the loop if an error occurs or no variables are found
+	      ** in the response.
+	      */
+	      if ((i = _bulkwalk_recv_pdu(context, pdu)) <= 0) {
+		 DBPRT(2,( "bulkwalk_recv_pdu() returned %d (error/empty)\n", i));
+		 break;
+	      }
+
+              /* Free the returned pdu.  Don't bother to do this for the async
+	      ** case, since the SNMP callback mechanism itself does the free
+	      ** for us.
+	      */
+	      snmp_free_pdu(pdu);
+
+	      /* And loop.  The call to bulkwalk_done() sets the ignore flags
+	      ** for any completed request subtrees.  Next time around, they
+	      ** won't be added to the request sent to the agent.
+	      */
+	      continue;
+	   }
+
+	   DBPRT(1, (DBOUT "Bulkwalk done... calling bulkwalk_finish(%s)...\n",
+	       okay ? "okay" : "error"));
+	   npushed = _bulkwalk_finish(context, okay);
+
+	   DBPRT(2,( "Returning %d values on the stack.\n", npushed));
+	   XSRETURN(npushed);
+
+	/* Handle error cases and clean up after ourselves. */
+        err:
+	   if (context->req_oids && context->nreq_oids) {
+	      bt_entry = context->req_oids;
+	      for (i = 0; i < context->nreq_oids; i++, bt_entry++)
+		 av_clear(bt_entry->vars);
+	   }
+	   if (context->req_oids)
+	      Safefree(context->req_oids);
+	   if (context)
+	      Safefree(context);
+	   if (pdu)
+	      snmp_free_pdu(pdu);
+
+           XSRETURN_UNDEF;
+	}
+
+
+int
+snmp_trapV1(sess_ref,enterprise,agent,generic,specific,uptime,varlist_ref)
+        SV *	sess_ref
+        char *	enterprise
+        char *	agent
+        int	generic
+        int	specific
+        long	uptime
+        SV *	varlist_ref
+	PPCODE:
+	{
+           AV *varlist;
+           SV **varbind_ref;
+           SV **varbind_val_f;
+           AV *varbind;
+	   I32 varlist_len;
+	   I32 varlist_ind;
+           SnmpSession *ss;
+           netsnmp_pdu *pdu = NULL;
+           struct tree *tp;
+	   oid *oid_arr;
+	   int oid_arr_len = MAX_OID_LEN;
+           SV **sess_ptr_sv;
+           SV **err_str_svp;
+           SV **err_num_svp;
+           SV **err_ind_svp;
+           int type;
+           int res;
+           int verbose = SvIV(perl_get_sv("SNMP::verbose", 0x01 | 0x04));
+           int use_enums = SvIV(*hv_fetch((HV*)SvRV(sess_ref),"UseEnums",8,1));
+           struct enum_list *ep;
+
+           New (0, oid_arr, MAX_OID_LEN, oid);
+
+           if (oid_arr && SvROK(sess_ref)) {
+
+              sess_ptr_sv = hv_fetch((HV*)SvRV(sess_ref), "SessPtr", 7, 1);
+	      ss = (SnmpSession *)SvIV((SV*)SvRV(*sess_ptr_sv));
+              err_str_svp = hv_fetch((HV*)SvRV(sess_ref), "ErrorStr", 8, 1);
+              err_num_svp = hv_fetch((HV*)SvRV(sess_ref), "ErrorNum", 8, 1);
+              err_ind_svp = hv_fetch((HV*)SvRV(sess_ref), "ErrorInd", 8, 1);
+              sv_setpv(*err_str_svp, "");
+              sv_setiv(*err_num_svp, 0);
+              sv_setiv(*err_ind_svp, 0);
+
+              pdu = snmp_pdu_create(SNMP_MSG_TRAP);
+
+              if (SvROK(varlist_ref)) {
+              varlist = (AV*) SvRV(varlist_ref);
+              varlist_len = av_len(varlist);
+	      for(varlist_ind = 0; varlist_ind <= varlist_len; varlist_ind++) {
+                 varbind_ref = av_fetch(varlist, varlist_ind, 0);
+                 if (SvROK(*varbind_ref)) {
+                    varbind = (AV*) SvRV(*varbind_ref);
+
+                    tp=__tag2oid(__av_elem_pv(varbind, VARBIND_TAG_F, NULL),
+                                 __av_elem_pv(varbind, VARBIND_IID_F, NULL),
+                                 oid_arr, &oid_arr_len, &type,0);
+
+                    if (oid_arr_len == 0) {
+                       if (verbose)
+                        warn("error:trap: unable to determine oid for object");
+                       goto err;
+                    }
+
+                    if (type == TYPE_UNKNOWN) {
+                      type = __translate_appl_type(
+                              __av_elem_pv(varbind, VARBIND_TYPE_F, NULL));
+                      if (type == TYPE_UNKNOWN) {
+                         if (verbose)
+                            warn("error:trap: no type found for object");
+                         goto err;
+                      }
+                    }
+
+	            varbind_val_f = av_fetch(varbind, VARBIND_VAL_F, 0);
+
+                    if (type==TYPE_INTEGER && use_enums && tp && tp->enums) {
+                      for(ep = tp->enums; ep; ep = ep->next) {
+                        if (varbind_val_f && SvOK(*varbind_val_f) &&
+                            !strcmp(ep->label, SvPV(*varbind_val_f,na))) {
+                          sv_setiv(*varbind_val_f, ep->value);
+                          break;
+                        }
+                      }
+                    }
+
+                    res = __add_var_val_str(pdu, oid_arr, oid_arr_len,
+                                  (varbind_val_f && SvOK(*varbind_val_f) ?
+                                   SvPV(*varbind_val_f,na):NULL),
+                                  (varbind_val_f && SvOK(*varbind_val_f) ?
+                                   SvCUR(*varbind_val_f):0),
+                                  type);
+
+                    if(res == FAILURE) {
+                        if(verbose) warn("error:trap: adding varbind");
+                        goto err;
+                    }
+
+                 } /* if var_ref is ok */
+              } /* for all the vars */
+              }
+
+	      pdu->enterprise = (oid *)malloc( MAX_OID_LEN * sizeof(oid));
+              tp = __tag2oid(enterprise,NULL, pdu->enterprise,
+                             &pdu->enterprise_length, NULL,0);
+  	      if (pdu->enterprise_length == 0) {
+		  if (verbose) warn("error:trap:invalid enterprise id: %s", enterprise);
+                  goto err;
+	      }
+	      /*  If agent is given then set the v1-TRAP specific
+		  agent-address field to that.  Otherwise set it to
+		  our address.  */
+              if (agent && strlen(agent)) {
+                 if (__parse_address(agent) == -1 && verbose) {
+		   warn("error:trap:invalid agent address: %s", agent);
+		   goto err;
+                 } else {
+		   *((in_addr_t *)pdu->agent_addr) = __parse_address(agent);
+		 }
+              } else {
+                 *((in_addr_t *)pdu->agent_addr) = get_myaddr();
+              }
+              pdu->trap_type = generic;
+              pdu->specific_type = specific;
+              pdu->time = uptime;
+
+              if (snmp_send(ss, pdu) == 0) {
+	         snmp_free_pdu(pdu);
+              }
+              XPUSHs(sv_2mortal(newSVpv(ZERO_BUT_TRUE,0)));
+           } else {
+err:
+              XPUSHs(&sv_undef); /* no mem or bad args */
+              if (pdu) snmp_free_pdu(pdu);
+           }
+	Safefree(oid_arr);
+        }
+
+
+int
+snmp_trapV2(sess_ref,uptime,trap_oid,varlist_ref)
+        SV *	sess_ref
+        char *	uptime
+        char *	trap_oid
+        SV *	varlist_ref
+	PPCODE:
+	{
+           AV *varlist;
+           SV **varbind_ref;
+           SV **varbind_val_f;
+           AV *varbind;
+	   I32 varlist_len;
+	   I32 varlist_ind;
+           SnmpSession *ss;
+           netsnmp_pdu *pdu = NULL;
+           struct tree *tp;
+	   oid *oid_arr;
+	   int oid_arr_len = MAX_OID_LEN;
+           SV **sess_ptr_sv;
+           SV **err_str_svp;
+           SV **err_num_svp;
+           SV **err_ind_svp;
+           int type;
+           int res;
+           int verbose = SvIV(perl_get_sv("SNMP::verbose", 0x01 | 0x04));
+           int use_enums = SvIV(*hv_fetch((HV*)SvRV(sess_ref),"UseEnums",8,1));
+           struct enum_list *ep;
+
+           New (0, oid_arr, MAX_OID_LEN, oid);
+
+           if (oid_arr && SvROK(sess_ref) && SvROK(varlist_ref)) {
+
+              sess_ptr_sv = hv_fetch((HV*)SvRV(sess_ref), "SessPtr", 7, 1);
+	      ss = (SnmpSession *)SvIV((SV*)SvRV(*sess_ptr_sv));
+              err_str_svp = hv_fetch((HV*)SvRV(sess_ref), "ErrorStr", 8, 1);
+              err_num_svp = hv_fetch((HV*)SvRV(sess_ref), "ErrorNum", 8, 1);
+              err_ind_svp = hv_fetch((HV*)SvRV(sess_ref), "ErrorInd", 8, 1);
+              sv_setpv(*err_str_svp, "");
+              sv_setiv(*err_num_svp, 0);
+              sv_setiv(*err_ind_svp, 0);
+
+              pdu = snmp_pdu_create(SNMP_MSG_TRAP2);
+
+              varlist = (AV*) SvRV(varlist_ref);
+              varlist_len = av_len(varlist);
+	      /************************************************/
+              res = __add_var_val_str(pdu, sysUpTime, SYS_UPTIME_OID_LEN,
+				uptime, strlen(uptime), TYPE_TIMETICKS);
+
+              if(res == FAILURE) {
+                if(verbose) warn("error:trap v2: adding sysUpTime varbind");
+		goto err;
+              }
+
+	      res = __add_var_val_str(pdu, snmpTrapOID, SNMP_TRAP_OID_LEN,
+				trap_oid ,strlen(trap_oid) ,TYPE_OBJID);
+
+              if(res == FAILURE) {
+                if(verbose) warn("error:trap v2: adding snmpTrapOID varbind");
+		goto err;
+              }
+
+
+	      /******************************************************/
+
+	      for(varlist_ind = 0; varlist_ind <= varlist_len; varlist_ind++) {
+                 varbind_ref = av_fetch(varlist, varlist_ind, 0);
+                 if (SvROK(*varbind_ref)) {
+                    varbind = (AV*) SvRV(*varbind_ref);
+
+                    tp=__tag2oid(__av_elem_pv(varbind, VARBIND_TAG_F,NULL),
+                                 __av_elem_pv(varbind, VARBIND_IID_F,NULL),
+                                 oid_arr, &oid_arr_len, &type,0);
+
+                    if (oid_arr_len == 0) {
+                       if (verbose)
+                        warn("error:trap v2: unable to determine oid for object");
+                       goto err;
+                    }
+
+                    if (type == TYPE_UNKNOWN) {
+                      type = __translate_appl_type(
+                                 __av_elem_pv(varbind, VARBIND_TYPE_F, NULL));
+                      if (type == TYPE_UNKNOWN) {
+                         if (verbose)
+                            warn("error:trap v2: no type found for object");
+                         goto err;
+                      }
+                    }
+
+	            varbind_val_f = av_fetch(varbind, VARBIND_VAL_F, 0);
+
+                    if (type==TYPE_INTEGER && use_enums && tp && tp->enums) {
+                      for(ep = tp->enums; ep; ep = ep->next) {
+                        if (varbind_val_f && SvOK(*varbind_val_f) &&
+                            !strcmp(ep->label, SvPV(*varbind_val_f,na))) {
+                          sv_setiv(*varbind_val_f, ep->value);
+                          break;
+                        }
+                      }
+                    }
+
+                    res = __add_var_val_str(pdu, oid_arr, oid_arr_len,
+                                  (varbind_val_f && SvOK(*varbind_val_f) ?
+                                   SvPV(*varbind_val_f,na):NULL),
+                                  (varbind_val_f && SvOK(*varbind_val_f) ?
+                                   SvCUR(*varbind_val_f):0),
+                                  type);
+
+                    if(res == FAILURE) {
+                        if(verbose) warn("error:trap v2: adding varbind");
+                        goto err;
+                    }
+
+                 } /* if var_ref is ok */
+              } /* for all the vars */
+
+              if (snmp_send(ss, pdu) == 0) {
+	         snmp_free_pdu(pdu);
+              }
+
+              XPUSHs(sv_2mortal(newSVpv(ZERO_BUT_TRUE,0)));
+           } else {
+err:
+              XPUSHs(&sv_undef); /* no mem or bad args */
+              if (pdu) snmp_free_pdu(pdu);
+           }
+	Safefree(oid_arr);
+        }
+
+
+
+int
+snmp_inform(sess_ref,uptime,trap_oid,varlist_ref,perl_callback)
+        SV *	sess_ref
+        char *	uptime
+        char *	trap_oid
+        SV *	varlist_ref
+        SV *	perl_callback
+	PPCODE:
+	{
+           AV *varlist;
+           SV **varbind_ref;
+           SV **varbind_val_f;
+           AV *varbind;
+	   I32 varlist_len;
+	   I32 varlist_ind;
+           SnmpSession *ss;
+           netsnmp_pdu *pdu = NULL;
+           netsnmp_pdu *response;
+           struct tree *tp;
+	   oid *oid_arr;
+	   int oid_arr_len = MAX_OID_LEN;
+           snmp_xs_cb_data *xs_cb_data;
+           SV **sess_ptr_sv;
+           SV **err_str_svp;
+           SV **err_num_svp;
+           SV **err_ind_svp;
+           int status = 0;
+           int type;
+           int res;
+           int verbose = SvIV(perl_get_sv("SNMP::verbose", 0x01 | 0x04));
+           int use_enums = SvIV(*hv_fetch((HV*)SvRV(sess_ref),"UseEnums",8,1));
+           struct enum_list *ep;
+
+           New (0, oid_arr, MAX_OID_LEN, oid);
+
+           if (oid_arr && SvROK(sess_ref) && SvROK(varlist_ref)) {
+
+              sess_ptr_sv = hv_fetch((HV*)SvRV(sess_ref), "SessPtr", 7, 1);
+	      ss = (SnmpSession *)SvIV((SV*)SvRV(*sess_ptr_sv));
+              err_str_svp = hv_fetch((HV*)SvRV(sess_ref), "ErrorStr", 8, 1);
+              err_num_svp = hv_fetch((HV*)SvRV(sess_ref), "ErrorNum", 8, 1);
+              err_ind_svp = hv_fetch((HV*)SvRV(sess_ref), "ErrorInd", 8, 1);
+              sv_setpv(*err_str_svp, "");
+              sv_setiv(*err_num_svp, 0);
+              sv_setiv(*err_ind_svp, 0);
+
+              pdu = snmp_pdu_create(SNMP_MSG_INFORM);
+
+              varlist = (AV*) SvRV(varlist_ref);
+              varlist_len = av_len(varlist);
+	      /************************************************/
+              res = __add_var_val_str(pdu, sysUpTime, SYS_UPTIME_OID_LEN,
+				uptime, strlen(uptime), TYPE_TIMETICKS);
+
+              if(res == FAILURE) {
+                if(verbose) warn("error:inform: adding sysUpTime varbind");
+		goto err;
+              }
+
+	      res = __add_var_val_str(pdu, snmpTrapOID, SNMP_TRAP_OID_LEN,
+				trap_oid ,strlen(trap_oid) ,TYPE_OBJID);
+
+              if(res == FAILURE) {
+                if(verbose) warn("error:inform: adding snmpTrapOID varbind");
+		goto err;
+              }
+
+
+	      /******************************************************/
+
+	      for(varlist_ind = 0; varlist_ind <= varlist_len; varlist_ind++) {
+                 varbind_ref = av_fetch(varlist, varlist_ind, 0);
+                 if (SvROK(*varbind_ref)) {
+                    varbind = (AV*) SvRV(*varbind_ref);
+
+                    tp=__tag2oid(__av_elem_pv(varbind, VARBIND_TAG_F,NULL),
+                                 __av_elem_pv(varbind, VARBIND_IID_F,NULL),
+                                 oid_arr, &oid_arr_len, &type,0);
+
+                    if (oid_arr_len == 0) {
+                       if (verbose)
+                        warn("error:inform: unable to determine oid for object");
+                       goto err;
+                    }
+
+                    if (type == TYPE_UNKNOWN) {
+                      type = __translate_appl_type(
+                                 __av_elem_pv(varbind, VARBIND_TYPE_F, NULL));
+                      if (type == TYPE_UNKNOWN) {
+                         if (verbose)
+                            warn("error:inform: no type found for object");
+                         goto err;
+                      }
+                    }
+
+	            varbind_val_f = av_fetch(varbind, VARBIND_VAL_F, 0);
+
+                    if (type==TYPE_INTEGER && use_enums && tp && tp->enums) {
+                      for(ep = tp->enums; ep; ep = ep->next) {
+                        if (varbind_val_f && SvOK(*varbind_val_f) &&
+                            !strcmp(ep->label, SvPV(*varbind_val_f,na))) {
+                          sv_setiv(*varbind_val_f, ep->value);
+                          break;
+                        }
+                      }
+                    }
+
+                    res = __add_var_val_str(pdu, oid_arr, oid_arr_len,
+                                  (varbind_val_f && SvOK(*varbind_val_f) ?
+                                   SvPV(*varbind_val_f,na):NULL),
+                                  (varbind_val_f && SvOK(*varbind_val_f) ?
+                                   SvCUR(*varbind_val_f):0),
+                                  type);
+
+                    if(res == FAILURE) {
+                        if(verbose) warn("error:inform: adding varbind");
+                        goto err;
+                    }
+
+                 } /* if var_ref is ok */
+              } /* for all the vars */
+
+
+              if (SvTRUE(perl_callback)) {
+                  xs_cb_data =
+                      (snmp_xs_cb_data*)malloc(sizeof(snmp_xs_cb_data));
+                 xs_cb_data->perl_cb = newSVsv(perl_callback);
+                 xs_cb_data->sess_ref = newRV_inc(SvRV(sess_ref));
+
+                 status = snmp_async_send(ss, pdu, __snmp_xs_cb,
+                                          (void*)xs_cb_data);
+                 if (status != 0) {
+                    XPUSHs(sv_2mortal(newSViv(status))); /* push the reqid?? */
+                 } else {
+                    snmp_free_pdu(pdu);
+                    sv_catpv(*err_str_svp,
+                             (char*)snmp_api_errstring(ss->s_snmp_errno));
+                    sv_setiv(*err_num_svp, ss->s_snmp_errno);
+                    XPUSHs(&sv_undef);
+                 }
+		 goto done;
+              }
+
+	      status = __send_sync_pdu(ss, pdu, &response,
+				       NO_RETRY_NOSUCH,
+                                       *err_str_svp, *err_num_svp,
+                                       *err_ind_svp);
+
+              if (response) snmp_free_pdu(response);
+
+              if (status) {
+		 XPUSHs(&sv_undef);
+	      } else {
+                 XPUSHs(sv_2mortal(newSVpv(ZERO_BUT_TRUE,0)));
+              }
+           } else {
+err:
+              XPUSHs(&sv_undef); /* no mem or bad args */
+              if (pdu) snmp_free_pdu(pdu);
+           }
+done:
+	Safefree(oid_arr);
+        }
+
+
+
+char *
+snmp_get_type(tag)
+	char *		tag
+	CODE:
+	{
+	   struct tree *tp  = NULL;
+	   static char type_str[MAX_TYPE_NAME_LEN];
+           char *ret = NULL;
+
+           if (tag && *tag) tp = __tag2oid(tag, NULL, NULL, NULL, NULL,0);
+           if (tp) __get_type_str(tp->type, ret = type_str);
+	   RETVAL = ret;
+	}
+	OUTPUT:
+        RETVAL
+
+
+void
+snmp_dump_packet(flag)
+	int		flag
+	CODE:
+	{
+	   snmp_set_dump_packet(flag);
+	}
+
+
+char *
+snmp_map_enum(tag, val, iflag)
+	char *		tag
+	char *		val
+	int		iflag
+	CODE:
+	{
+	   struct tree *tp  = NULL;
+           struct enum_list *ep;
+           char str_buf[STR_BUF_SIZE];
+           int ival;
+
+           RETVAL = NULL;
+
+           if (tag && *tag) tp = __tag2oid(tag, NULL, NULL, NULL, NULL,0);
+
+           if (tp) {
+              if (iflag) {
+                 ival = atoi(val);
+                 for(ep = tp->enums; ep; ep = ep->next) {
+                    if (ep->value == ival) {
+                       RETVAL = ep->label;
+                       break;
+                    }
+                 }
+              } else {
+                 for(ep = tp->enums; ep; ep = ep->next) {
+                    if (strEQ(ep->label, val)) {
+                       sprintf(str_buf,"%d", ep->value);
+                       RETVAL = str_buf;
+                       break;
+                    }
+                 }
+              }
+           }
+	}
+	OUTPUT:
+        RETVAL
+
+#define SNMP_XLATE_MODE_OID2TAG 1
+#define SNMP_XLATE_MODE_TAG2OID 0
+
+char *
+snmp_translate_obj(var,mode,use_long,auto_init,best_guess)
+	char *		var
+	int		mode
+	int		use_long
+	int		auto_init
+	int             best_guess
+	CODE:
+	{
+	   char str_buf[STR_BUF_SIZE];
+	   oid oid_arr[MAX_OID_LEN];
+           int oid_arr_len = MAX_OID_LEN;
+           char * label;
+           char * iid;
+           int status = FAILURE;
+           int verbose = SvIV(perl_get_sv("SNMP::verbose", 0x01 | 0x04));
+
+           str_buf[0] = '\0';
+  	   switch (mode) {
+              case SNMP_XLATE_MODE_TAG2OID:
+		if (!__tag2oid(var, NULL, oid_arr, &oid_arr_len, NULL, best_guess)) {
+		   if (verbose) warn("error:snmp_translate_obj:Unknown OID %s\n",var);
+                } else {
+                   status = __sprint_num_objid(str_buf, oid_arr, oid_arr_len);
+                }
+                break;
+             case SNMP_XLATE_MODE_OID2TAG:
+		oid_arr_len = 0;
+		__concat_oid_str(oid_arr, &oid_arr_len, var);
+		snprint_objid(str_buf, sizeof(str_buf), oid_arr, oid_arr_len);
+		if (!use_long) {
+                  label = NULL; iid = NULL;
+		  if (((status=__get_label_iid(str_buf,
+		       &label, &iid, NO_FLAGS)) == SUCCESS)
+		      && label) {
+		     strcpy(str_buf, label);
+		     if (iid && *iid) {
+		       strcat(str_buf, ".");
+		       strcat(str_buf, iid);
+		     }
+ 	          }
+	        }
+                break;
+             default:
+	       if (verbose) warn("snmp_translate_obj:unknown translation mode: %s\n", mode);
+           }
+           if (*str_buf) {
+              RETVAL = (char*)str_buf;
+           } else {
+              RETVAL = (char*)NULL;
+           }
+	}
+        OUTPUT:
+        RETVAL
+
+void
+snmp_set_replace_newer(val)
+	int val
+	CODE:
+	{
+	   netsnmp_ds_toggle_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_MIB_REPLACE);
+	}
+
+void
+snmp_set_save_descriptions(val)
+	int	val
+	CODE:
+	{
+	   snmp_set_save_descriptions(val);
+	}
+
+void
+snmp_set_debugging(val)
+	int	val
+	CODE:
+	{
+	   snmp_set_do_debugging(val);
+	}
+
+void
+snmp_debug_internals(val)
+	int     val
+	CODE:
+	{
+#ifdef		DEBUGGING
+	   _debug_level = val;
+#endif		/* DEBUGGING */
+	}
+
+
+void
+snmp_sock_cleanup()
+	CODE:
+	{
+	   SOCK_CLEANUP;
+	}
+
+void
+snmp_mainloop_finish()
+	CODE:
+	{
+	    mainloop_finish = 1;
+	}
+
+
+void
+snmp_main_loop(timeout_sec,timeout_usec,perl_callback)
+	int 	timeout_sec
+	int 	timeout_usec
+	SV *	perl_callback
+	CODE:
+	{
+        int numfds, fd_count;
+        fd_set fdset;
+        struct timeval time_val, *tvp;
+        struct timeval last_time, *ltvp;
+        struct timeval ctimeout, *ctvp;
+        struct timeval interval, *itvp;
+        int block;
+	SV *cb;
+
+
+ 	mainloop_finish = 0;
+
+	itvp = &interval;
+	itvp->tv_sec = timeout_sec;
+	itvp->tv_usec = timeout_usec;
+        ctvp = &ctimeout;
+        ctvp->tv_sec = -1;
+        ltvp = &last_time;
+        gettimeofday(ltvp,(struct timezone*)0);
+	timersub(ltvp,itvp,ltvp);
+        while (1) {
+           numfds = 0;
+           FD_ZERO(&fdset);
+           block = 1;
+           tvp = &time_val;
+           timerclear(tvp);
+           snmp_select_info(&numfds, &fdset, tvp, &block);
+           __recalc_timeout(tvp,ctvp,ltvp,itvp,&block);
+           # printf("pre-select: numfds = %ld, block = %ld\n", numfds, block);
+           if (block == 1) tvp = NULL; /* block without timeout */
+           fd_count = select(numfds, &fdset, 0, 0, tvp);
+           #printf("post-select: fd_count = %ld,block = %ld\n",fd_count,block);
+           if (fd_count > 0) {
+                       dSP;
+                       ENTER;
+                       SAVETMPS;
+              snmp_read(&fdset);
+                       FREETMPS;
+                       LEAVE;
+
+           } else switch(fd_count) {
+              case 0:
+		 SPAGAIN;
+		 ENTER;
+		 SAVETMPS;
+                 snmp_timeout();
+                 if (!timerisset(ctvp)) {
+                    if (SvTRUE(perl_callback)) {
+                       /* sv_2mortal(perl_callback); */
+                       cb = __push_cb_args(perl_callback, NULL);
+                       __call_callback(cb, G_DISCARD);
+                       ctvp->tv_sec = -1;
+
+                    } else {
+                       FREETMPS;
+                       LEAVE;
+                       goto done;
+                    }
+                 }
+                 FREETMPS;
+                 LEAVE;
+                 break;
+              case -1:
+                 if (errno == EINTR) {
+                    continue;
+                 } else {
+                    /* snmp_set_detail(strerror(errno)); */
+                    /* snmp_errno = SNMPERR_GENERR; */
+                 }
+              default:;
+           }
+
+	   /* A call to snmp_mainloop_finish() in the callback sets the
+	   ** mainloop_finish flag.  Exit the loop after the callback returns.
+	   */
+	   if (mainloop_finish)
+	      goto done;
+
+        }
+     done:
+           return;
+	}
+
+
+void
+snmp_get_select_info()
+	PPCODE:
+	{
+        int numfds;
+        fd_set fdset;
+        struct timeval time_val, *tvp;
+        int block;
+	int i;
+
+        numfds = 0;
+        block = 1;
+        tvp = &time_val;
+        FD_ZERO(&fdset);
+        snmp_select_info(&numfds, &fdset, tvp, &block);
+	XPUSHs(sv_2mortal(newSViv(block)));
+	if(block){
+            XPUSHs(sv_2mortal(newSViv(0)));
+            XPUSHs(sv_2mortal(newSViv(0)));
+	} else {
+            XPUSHs(sv_2mortal(newSViv(tvp->tv_sec)));
+            XPUSHs(sv_2mortal(newSViv(tvp->tv_usec)));
+	}
+	if ( numfds ) {
+            for(i=0; i<numfds ; i++) {
+                if(FD_ISSET(i, &fdset)){
+                    XPUSHs(sv_2mortal(newSViv(i)));
+                }
+            }
+	} else {
+            XPUSHs(&sv_undef);  /* no mem or bad args */
+	}
+	}
+
+void
+snmp_read_on_fd(fd)
+	int fd
+	CODE:
+	{
+           fd_set fdset;
+
+           FD_ZERO(&fdset);
+           FD_SET(fd, &fdset);
+
+           snmp_read(&fdset);
+	}
+
+void
+snmp_check_timeout()
+	CODE:
+	{
+          snmp_timeout();
+	}
+
+MODULE = SNMP	PACKAGE = SNMP::MIB::NODE 	PREFIX = snmp_mib_node_
+SV *
+snmp_mib_node_TIEHASH(class,key,tp=0)
+	char *	class
+	char *	key
+        IV tp
+	CODE:
+	{
+            __libraries_init("perl");
+           if (!tp) tp = (IV)__tag2oid(key, NULL, NULL, NULL, NULL,0);
+           if (tp) {
+              ST(0) = sv_newmortal();
+              sv_setref_iv(ST(0), class, tp);
+           } else {
+              ST(0) = &sv_undef;
+           }
+
+	}
+
+SV *
+snmp_mib_node_FETCH(tp_ref, key)
+	SV *	tp_ref
+	char *	key
+	CODE:
+	{
+	   char c = *key;
+	   char str_buf[STR_BUF_SIZE];
+           SnmpMibNode *tp = NULL;
+           struct index_list *ip;
+           struct enum_list *ep;
+           struct range_list *rp;
+	   struct varbind_list *vp;
+           struct module *mp;
+           SV *child_list_aref, *next_node_href, *mib_tied_href = NULL;
+	   SV **nn_hrefp;
+           HV *mib_hv, *enum_hv, *range_hv;
+           AV *index_av, *varbind_av, *ranges_av;
+           MAGIC *mg = NULL;
+
+           if (SvROK(tp_ref)) tp = (SnmpMibNode*)SvIV((SV*)SvRV(tp_ref));
+
+	   ST(0) = sv_newmortal();
+           if (tp)
+	   switch (c) {
+	      case 'a': /* access */
+                  if (strncmp("access", key, strlen(key)) == 0) {
+                 switch	(tp->access) {
+                   case MIB_ACCESS_READONLY:
+                     sv_setpv(ST(0),"ReadOnly");
+                     break;
+                   case MIB_ACCESS_READWRITE:
+                     sv_setpv(ST(0),"ReadWrite");
+                     break;
+                   case MIB_ACCESS_WRITEONLY:
+                     sv_setpv(ST(0),"WriteOnly");
+                     break;
+                   case MIB_ACCESS_NOACCESS:
+                     sv_setpv(ST(0),"NoAccess");
+                     break;
+                   case MIB_ACCESS_NOTIFY:
+                     sv_setpv(ST(0),"Notify");
+                     break;
+                   case MIB_ACCESS_CREATE:
+                     sv_setpv(ST(0),"Create");
+                     break;
+                   default:
+                     break;
+                 }
+                  } else if (strncmp("augments", key, strlen(key)) == 0) {
+                      sv_setpv(ST(0),tp->augments);
+                  }
+                 break;
+  	      case 'c': /* children */
+                 if (strncmp("children", key, strlen(key))) break;
+                 child_list_aref = newRV((SV*)newAV());
+                 for (tp = tp->child_list; tp; tp = tp->next_peer) {
+                    mib_hv = perl_get_hv("SNMP::MIB", FALSE);
+                    if (SvMAGICAL(mib_hv)) mg = mg_find((SV*)mib_hv, 'P');
+                    if (mg) mib_tied_href = (SV*)mg->mg_obj;
+                    next_node_href = newRV((SV*)newHV());
+                    __tp_sprint_num_objid(str_buf, tp);
+                    nn_hrefp = hv_fetch((HV*)SvRV(mib_tied_href),
+                                        str_buf, strlen(str_buf), 1);
+                    if (!SvROK(*nn_hrefp)) {
+                       sv_setsv(*nn_hrefp, next_node_href);
+                       ENTER ;
+                       SAVETMPS ;
+                       PUSHMARK(sp) ;
+                       XPUSHs(SvRV(*nn_hrefp));
+                       XPUSHs(sv_2mortal(newSVpv("SNMP::MIB::NODE",0)));
+                       XPUSHs(sv_2mortal(newSVpv(str_buf,0)));
+                       XPUSHs(sv_2mortal(newSViv((IV)tp)));
+                       PUTBACK ;
+                       perl_call_pv("SNMP::_tie",G_VOID);
+                       /* pp_tie(ARGS); */
+                       SPAGAIN ;
+                       FREETMPS ;
+                       LEAVE ;
+                    } /* if SvROK */
+                    av_push((AV*)SvRV(child_list_aref), *nn_hrefp);
+                 } /* for child_list */
+                 sv_setsv(ST(0), child_list_aref);
+                 break;
+	      case 'v':
+	         if (strncmp("varbinds", key, strlen(key))) break;
+		 varbind_av = newAV();
+		 for (vp = tp->varbinds; vp; vp = vp->next) {
+	            av_push(varbind_av, newSVpv((vp->vblabel),strlen(vp->vblabel)));
+		 }
+		 sv_setsv(ST(0), newRV((SV*)varbind_av));
+		 break;
+	      case 'd': /* description */
+                  if (strncmp("description", key, strlen(key))) {
+                      if(!(strncmp("defaultValue",key,strlen(key)))) {
+                          /* We're looking at defaultValue */
+                          sv_setpv(ST(0), tp->defaultValue);
+                          break;
+                      } /* end if */
+                  } /* end if */
+	          /* we must be looking at description */
+                 sv_setpv(ST(0),tp->description);
+                 break;
+              case 'i': /* indexes */
+                 if (strncmp("indexes", key, strlen(key))) break;
+                 index_av = newAV();
+                 for(ip=tp->indexes; ip != NULL; ip = ip->next) {
+                    av_push(index_av,newSVpv((ip->ilabel),strlen(ip->ilabel)));
+                 }
+                sv_setsv(ST(0), newRV((SV*)index_av));
+                break;
+	      case 'l': /* label */
+                 if (strncmp("label", key, strlen(key))) break;
+                 sv_setpv(ST(0),tp->label);
+                 break;
+	      case 'm': /* moduleID */
+                 if (strncmp("moduleID", key, strlen(key))) break;
+                 mp = find_module(tp->modid);
+                 if (mp) sv_setpv(ST(0), mp->name);
+                 break;
+	      case 'n': /* nextNode */
+                 if (strncmp("nextNode", key, strlen(key))) break;
+                 tp = __get_next_mib_node(tp);
+                 if (tp == NULL) {
+                    sv_setsv(ST(0), &sv_undef);
+                    break;
+                 }
+                 mib_hv = perl_get_hv("SNMP::MIB", FALSE);
+                 if (SvMAGICAL(mib_hv)) mg = mg_find((SV*)mib_hv, 'P');
+                 if (mg) mib_tied_href = (SV*)mg->mg_obj;
+                 __tp_sprint_num_objid(str_buf, tp);
+
+                 nn_hrefp = hv_fetch((HV*)SvRV(mib_tied_href),
+                                     str_buf, strlen(str_buf), 1);
+                 /* if (!SvROK(*nn_hrefp)) { */ /* bug in ucd - 2 .0.0 nodes */
+                 next_node_href = newRV((SV*)newHV());
+                 sv_setsv(*nn_hrefp, next_node_href);
+                 ENTER ;
+                 SAVETMPS ;
+                 PUSHMARK(sp) ;
+                 XPUSHs(SvRV(*nn_hrefp));
+                 XPUSHs(sv_2mortal(newSVpv("SNMP::MIB::NODE",0)));
+                 XPUSHs(sv_2mortal(newSVpv(str_buf,0)));
+                 XPUSHs(sv_2mortal(newSViv((IV)tp)));
+                 PUTBACK ;
+                 perl_call_pv("SNMP::_tie",G_VOID);
+                 /* pp_tie(ARGS); */
+                 SPAGAIN ;
+                 FREETMPS ;
+                 LEAVE ;
+                 /* } */
+                 sv_setsv(ST(0), *nn_hrefp);
+                 break;
+	      case 'o': /* objectID */
+                 if (strncmp("objectID", key, strlen(key))) break;
+                 __tp_sprint_num_objid(str_buf, tp);
+                 sv_setpv(ST(0),str_buf);
+                 break;
+	      case 'p': /* parent */
+                 if (strncmp("parent", key, strlen(key))) break;
+                 tp = tp->parent;
+                 if (tp == NULL) {
+                    sv_setsv(ST(0), &sv_undef);
+                    break;
+                 }
+                 mib_hv = perl_get_hv("SNMP::MIB", FALSE);
+                 if (SvMAGICAL(mib_hv)) mg = mg_find((SV*)mib_hv, 'P');
+                 if (mg) mib_tied_href = (SV*)mg->mg_obj;
+                 next_node_href = newRV((SV*)newHV());
+                 __tp_sprint_num_objid(str_buf, tp);
+                 nn_hrefp = hv_fetch((HV*)SvRV(mib_tied_href),
+                                     str_buf, strlen(str_buf), 1);
+                 if (!SvROK(*nn_hrefp)) {
+                 sv_setsv(*nn_hrefp, next_node_href);
+                 ENTER ;
+                 SAVETMPS ;
+                 PUSHMARK(sp) ;
+                 XPUSHs(SvRV(*nn_hrefp));
+                 XPUSHs(sv_2mortal(newSVpv("SNMP::MIB::NODE",0)));
+                 XPUSHs(sv_2mortal(newSVpv(str_buf,0)));
+                 XPUSHs(sv_2mortal(newSViv((IV)tp)));
+                 PUTBACK ;
+                 perl_call_pv("SNMP::_tie",G_VOID);
+                 /* pp_tie(ARGS); */
+                 SPAGAIN ;
+                 FREETMPS ;
+                 LEAVE ;
+                 }
+                 sv_setsv(ST(0), *nn_hrefp);
+                 break;
+	      case 'r': /* ranges */
+                 if (strncmp("ranges", key, strlen(key))) break;
+                 ranges_av = newAV();
+                 for(rp=tp->ranges; rp ; rp = rp->next) {
+		   range_hv = newHV();
+                   hv_store(range_hv, "low", strlen("low"), newSViv(rp->low), 0);
+                   hv_store(range_hv, "high", strlen("high"), newSViv(rp->high), 0);
+		   av_push(ranges_av, newRV((SV*)range_hv));
+                 }
+                 sv_setsv(ST(0), newRV((SV*)ranges_av));
+                 break;
+	      case 's': /* subID */
+                 if (strncmp("subID", key, strlen(key))) {
+                   if (strncmp("status", key, strlen(key))) {
+                      if (strncmp("syntax", key, strlen(key))) break;
+                      if (tp->tc_index >= 0) {
+                         sv_setpv(ST(0), get_tc_descriptor(tp->tc_index));
+                      } else {
+                         __get_type_str(tp->type, str_buf);
+                         sv_setpv(ST(0), str_buf);
+                      }
+                      break;
+                   }
+
+                   switch(tp->status) {
+                     case MIB_STATUS_MANDATORY:
+                       sv_setpv(ST(0),"Mandatory");
+                       break;
+                     case MIB_STATUS_OPTIONAL:
+                       sv_setpv(ST(0),"Optional");
+                       break;
+                     case MIB_STATUS_OBSOLETE:
+                       sv_setpv(ST(0),"Obsolete");
+                       break;
+                     case MIB_STATUS_DEPRECATED:
+                       sv_setpv(ST(0),"Deprecated");
+                       break;
+		     case MIB_STATUS_CURRENT:
+                       sv_setpv(ST(0),"Current");
+                       break;
+                     default:
+                       break;
+                   }
+                 } else {
+                   sv_setiv(ST(0),(I32)tp->subid);
+                 }
+                 break;
+	      case 't': /* type */
+                 if (strncmp("type", key, strlen(key))) {
+                    if (strncmp("textualConvention", key, strlen(key))) break;
+                    sv_setpv(ST(0), get_tc_descriptor(tp->tc_index));
+                    break;
+                 }
+                 __get_type_str(tp->type, str_buf);
+                 sv_setpv(ST(0), str_buf);
+                 break;
+	      case 'u': /* units */
+                 if (strncmp("units", key, strlen(key))) break;
+                 sv_setpv(ST(0),tp->units);
+                 break;
+	      case 'h': /* hint */
+                 if (strncmp("hint", key, strlen(key))) break;
+                 sv_setpv(ST(0),tp->hint);
+                 break;
+	      case 'e': /* enums */
+                 if (strncmp("enums", key, strlen(key))) break;
+                 enum_hv = newHV();
+                 for(ep=tp->enums; ep != NULL; ep = ep->next) {
+                   hv_store(enum_hv, ep->label, strlen(ep->label),
+                                newSViv(ep->value), 0);
+                 }
+                 sv_setsv(ST(0), newRV((SV*)enum_hv));
+                 break;
+              default:
+                 break;
+	   }
+	}
+
+MODULE = SNMP	PACKAGE = SnmpSessionPtr	PREFIX = snmp_session_
+void
+snmp_session_DESTROY(sess_ptr)
+	SnmpSession *sess_ptr
+	CODE:
+	{
+           snmp_close( sess_ptr );
+	}
+
diff -Naur tomato/release/src/router/snmp/perl/SNMP/SNMP.xs.use-numeric tomato121/release/src/router/snmp/perl/SNMP/SNMP.xs.use-numeric
--- tomato/release/src/router/snmp/perl/SNMP/SNMP.xs.use-numeric	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/perl/SNMP/SNMP.xs.use-numeric	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,4942 @@
+/* -*- C -*-
+     SNMP.xs -- Perl 5 interface to the UCD SNMP toolkit
+
+     written by G. S. Marzot (gmarzot@nortelnetworks.com)
+
+     Copyright (c) 1995-1999 G. S. Marzot. All rights reserved.
+     This program is free software; you can redistribute it and/or
+     modify it under the same terms as Perl itself.
+*/
+#define WIN32SCK_IS_STDSCK
+#include "EXTERN.h"
+#include "perl.h"
+#include "XSUB.h"
+
+#include <sys/types.h>
+#include <arpa/inet.h>
+#include <errno.h>
+#ifndef MSVC_PERL
+	#include <signal.h>
+#endif
+#include <stdio.h>
+#include <ctype.h>
+#ifdef I_SYS_TIME
+#include <sys/time.h>
+#endif
+#include <netdb.h>
+#include <stdlib.h>
+#ifndef MSVC_PERL
+	#include <unistd.h>
+#endif
+/* XXX This is a problem if regex.h is not on the system. */
+#include <regex.h>
+
+#ifndef __P
+#define __P(x) x
+#endif
+
+#ifndef na
+#define na PL_na
+#endif
+
+#ifndef sv_undef
+#define sv_undef PL_sv_undef
+#endif
+
+#ifndef stack_base
+#define stack_base PL_stack_base
+#endif
+
+#ifndef G_VOID
+#define G_VOID G_DISCARD
+#endif
+
+#ifdef WIN32
+#define SOCK_STARTUP winsock_startup()
+#define SOCK_CLEANUP winsock_cleanup()
+#define DLL_IMPORT   __declspec( dllimport )
+#define strcasecmp _stricmp
+#define strncasecmp _strnicmp
+#else
+#define SOCK_STARTUP
+#define SOCK_CLEANUP
+#define DLL_IMPORT
+#endif
+
+DLL_IMPORT extern struct tree *Mib;
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+
+#include "perlsnmp.h"
+
+#define SUCCESS 1
+#define FAILURE 0
+
+#define ZERO_BUT_TRUE "0 but true"
+
+#define VARBIND_TAG_F 0
+#define VARBIND_IID_F 1
+#define VARBIND_VAL_F 2
+#define VARBIND_TYPE_F 3
+
+#define TYPE_UNKNOWN 0
+#define MAX_TYPE_NAME_LEN 16
+#define STR_BUF_SIZE 1024
+#define ENG_ID_BUF_SIZE 32
+
+#define SYS_UPTIME_OID_LEN 9
+#define SNMP_TRAP_OID_LEN 11
+#define NO_RETRY_NOSUCH 0
+static oid sysUpTime[SYS_UPTIME_OID_LEN] = {1, 3, 6, 1, 2, 1, 1, 3, 0};
+static oid snmpTrapOID[SNMP_TRAP_OID_LEN] = {1, 3, 6, 1, 6, 3, 1, 1, 4, 1, 0};
+
+/* Internal flag to determine snmp_main_loop() should return after callback */
+static int mainloop_finish = 0;
+
+/* these should be part of transform_oids.h ? */
+#define USM_AUTH_PROTO_MD5_LEN 10
+#define USM_AUTH_PROTO_SHA_LEN 10
+#define USM_PRIV_PROTO_DES_LEN 10
+
+/* why does ucd-snmp redefine sockaddr_in ??? */
+#define SIN_ADDR(snmp_addr) (((struct sockaddr_in *) &(snmp_addr))->sin_addr)
+
+typedef netsnmp_session SnmpSession;
+typedef struct tree SnmpMibNode;
+typedef struct snmp_xs_cb_data {
+    SV* perl_cb;
+    SV* sess_ref;
+} snmp_xs_cb_data;
+
+static void __recalc_timeout _((struct timeval*,struct timeval*,
+                                struct timeval*,struct timeval*, int* ));
+static in_addr_t __parse_address _((char*));
+static int __is_numeric_oid _((char*));
+static int __is_leaf _((struct tree*));
+static int __translate_appl_type _((char*));
+static int __translate_asn_type _((int));
+static int __snprint_value _((char *, size_t,
+                              netsnmp_variable_list*, struct tree *,
+                             int, int));
+static int __sprint_num_objid _((char *, oid *, int));
+static int __scan_num_objid _((char *, oid *, int *));
+static int __get_type_str _((int, char *));
+static int __get_label_iid _((char *, char **, char **, int));
+static int __oid_cmp _((oid *, int, oid *, int));
+static int __tp_sprint_num_objid _((char*,SnmpMibNode *));
+static SnmpMibNode * __get_next_mib_node _((SnmpMibNode *));
+static struct tree * __oid2tp _((oid*, int, struct tree *, int*));
+static struct tree * __tag2oid _((char *, char *, oid  *, int  *, int *, int));
+static int __concat_oid_str _((oid *, int *, char *));
+static int __add_var_val_str _((netsnmp_pdu *, oid *, int, char *,
+                                 int, int));
+static int __send_sync_pdu _((netsnmp_session *, netsnmp_pdu *,
+                              netsnmp_pdu **, int , SV *, SV *, SV *));
+static int __snmp_xs_cb __P((int, netsnmp_session *, int,
+                             netsnmp_pdu *, void *));
+static int __callback_wrapper __P((int, netsnmp_session *, int,
+	                             netsnmp_pdu *, void *));
+static SV* __push_cb_args2 _((SV * sv, SV * esv, SV * tsv));
+#define __push_cb_args(a,b) __push_cb_args2(a,b,NULL)
+static int __call_callback _((SV * sv, int flags));
+static char* __av_elem_pv _((AV * av, I32 key, char *dflt));
+static u_int compute_match _((const char *, const char *));
+
+#define USE_NUMERIC_OIDS 0x08
+#define NON_LEAF_NAME 0x04
+#define USE_LONG_NAMES 0x02
+#define FAIL_ON_NULL_IID 0x01
+#define NO_FLAGS 0x00
+
+/* Structures used by snmp_bulkwalk method to track requested OID's/subtrees. */
+typedef struct bulktbl {
+   oid	req_oid[MAX_OID_LEN];	/* The OID originally requested.    */
+   oid	last_oid[MAX_OID_LEN];	/* Last-seen OID under this branch. */
+   AV	*vars;			/* Array of Varbinds for this OID.  */
+   char	req_len;		/* Length of requested OID.         */
+   char	last_len;		/* Length of last-seen OID.         */
+   char norepeat;		/* Is this a non-repeater OID?      */
+   char	complete;		/* Non-zero if this tree complete.  */
+   char	ignore;			/* Ignore this OID, not requested.  */
+} bulktbl;
+
+/* Context for bulkwalk() sessions.  Used to store state across callbacks. */
+typedef struct walk_context {
+   SV		*sess_ref;	/* Reference to Perl SNMP session object.   */
+   SV		*perl_cb;	/* Pointer to Perl callback func or array.  */
+   bulktbl	*req_oids;	/* Pointer to bulktbl[] for requested OIDs. */
+   bulktbl	*repbase;	/* Pointer to first repeater in req_oids[]. */
+   bulktbl	*reqbase;	/* Pointer to start of requests req_oids[]. */
+   int	  	nreq_oids;	/* Number of valid bulktbls in req_oids[].  */
+   int	  	req_remain;	/* Number of outstanding requests remaining */
+   int		non_reps;	/* Number of nonrepeater vars in req_oids[] */
+   int		repeaters;	/* Number of repeater vars in req_oids[].   */
+   int		max_reps;	/* Maximum repetitions of variable per PDU. */
+   int		exp_reqid;	/* Expect a response to this request only.  */
+   int		getlabel_f;	/* Flag long/numeric names for get_label(). */
+   int		sprintval_f;	/* Flag enum/sprint values for sprintval(). */
+   int		pkts_exch;	/* Number of packet exchanges with agent.   */
+   int		oid_total;	/* Total number of OIDs received this walk. */
+   int		oid_saved;	/* Total number of OIDs saved as results.   */
+} walk_context;
+
+/* Prototypes for bulkwalk support functions. */
+static netsnmp_pdu *_bulkwalk_send_pdu _((walk_context *context));
+static int _bulkwalk_done     _((walk_context *context));
+static int _bulkwalk_recv_pdu _((walk_context *context, netsnmp_pdu *pdu));
+static int _bulkwalk_finish   _((walk_context *context, int okay));
+static int _bulkwalk_async_cb _((int op, SnmpSession *ss, int reqid,
+				     netsnmp_pdu *pdu, void *context_ptr));
+
+/* Structure to hold valid context sessions. */
+struct valid_contexts {
+   walk_context	**valid;	/* Array of valid walk_context pointers.    */
+   int		sz_valid;	/* Maximum size of valid contexts array.    */
+   int		num_valid;	/* Count of valid contexts in the array.    */
+};
+static struct valid_contexts  *_valid_contexts = NULL;
+static int _context_add       _((walk_context *context));
+static int _context_del       _((walk_context *context));
+static int _context_okay      _((walk_context *context));
+
+/* Wrapper around fprintf(stderr, ...) for clean and easy debug output. */
+#ifdef	DEBUGGING
+static int _debug_level = 0;
+#define DBOUT PerlIO_stderr(),
+#define	DBPRT(severity, otherargs)					\
+	do {								\
+	    if (_debug_level && severity <= _debug_level) {		\
+		(void)PerlIO_fprintf(PerlIO_stderr(), otherargs);		\
+	    }								\
+	} while (/*CONSTCOND*/0)
+
+char	_debugx[1024];	/* Space to sprintf() into - used by sprint_objid(). */
+
+#else	/* DEBUGGING */
+#define DBOUT
+#define	DBPRT(severity, otherargs)	/* Ignore */
+
+#endif	/* DEBUGGING */
+
+void
+__libraries_init(char *appname)
+    {
+        static int have_inited = 0;
+
+        if (have_inited)
+            return;
+        have_inited = 1;
+
+        snmp_set_quick_print(1);
+        init_snmp(appname);
+    
+        netsnmp_ds_set_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_DONT_BREAKDOWN_OIDS, 1);
+        netsnmp_ds_set_int(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_PRINT_SUFFIX_ONLY, 1);
+
+        SOCK_STARTUP;
+    
+    }
+
+static void
+__recalc_timeout (tvp, ctvp, ltvp, itvp, block)
+struct timeval* tvp;
+struct timeval* ctvp;
+struct timeval* ltvp;
+struct timeval* itvp;
+int *block;
+{
+   struct timeval now;
+
+   if (!timerisset(itvp)) return;  /* interval zero means loop forever */
+   *block = 0;
+   gettimeofday(&now,(struct timezone *)0);
+
+   if (ctvp->tv_sec < 0) { /* first time or callback just fired */
+      timersub(&now,ltvp,ctvp);
+      timersub(ctvp,itvp,ctvp);
+      timersub(itvp,ctvp,ctvp);
+      timeradd(ltvp,itvp,ltvp);
+   } else {
+      timersub(&now,ltvp,ctvp);
+      timersub(itvp,ctvp,ctvp);
+   }
+
+   /* flag is set for callback but still hasnt fired so set to something
+    * small and we will service packets first if there are any ready
+    * (also guard against negative timeout - should never happen?)
+    */
+   if (!timerisset(ctvp) || ctvp->tv_sec < 0 || ctvp->tv_usec < 0) {
+      ctvp->tv_sec = 0;
+      ctvp->tv_usec = 10;
+   }
+
+   /* if snmp timeout > callback timeout or no more requests to process */
+   if (timercmp(tvp, ctvp, >) || !timerisset(tvp)) {
+      *tvp = *ctvp; /* use the smaller non-zero timeout */
+      timerclear(ctvp); /* used as a flag to let callback fire on timeout */
+   }
+}
+
+static in_addr_t
+__parse_address(address)
+char *address;
+{
+    in_addr_t addr;
+    struct sockaddr_in saddr;
+    struct hostent *hp;
+
+    if ((addr = inet_addr(address)) != -1)
+	return addr;
+    hp = gethostbyname(address);
+    if (hp == NULL){
+        return (-1); /* error value */
+    } else {
+	memcpy(&saddr.sin_addr, hp->h_addr, hp->h_length);
+	return saddr.sin_addr.s_addr;
+    }
+
+}
+
+static int
+__is_numeric_oid (oidstr)
+char* oidstr;
+{
+  if (!oidstr) return 0;
+  for (; *oidstr; oidstr++) {
+     if (isalpha((int)*oidstr)) return 0;
+  }
+  return(1);
+}
+
+static int
+__is_leaf (tp)
+struct tree* tp;
+{
+   char buf[MAX_TYPE_NAME_LEN];
+   return (tp && __get_type_str(tp->type,buf));
+}
+
+static SnmpMibNode*
+__get_next_mib_node (tp)
+SnmpMibNode* tp;
+{
+   /* printf("tp = %lX, parent = %lX, peer = %lX, child = %lX\n",
+              tp, tp->parent, tp->next_peer, tp->child_list); */
+   if (tp->child_list) return(tp->child_list);
+   if (tp->next_peer) return(tp->next_peer);
+   if (!tp->parent) return(NULL);
+   for (tp = tp->parent; !tp->next_peer; tp = tp->parent) {
+      if (!tp->parent) return(NULL);
+   }
+   return(tp->next_peer);
+}
+
+static int
+__translate_appl_type(typestr)
+char* typestr;
+{
+	if (typestr == NULL || *typestr == '\0') return TYPE_UNKNOWN;
+
+	if (!strncasecmp(typestr,"INTEGER32",8))
+            return(TYPE_INTEGER32);
+	if (!strncasecmp(typestr,"INTEGER",3))
+            return(TYPE_INTEGER);
+	if (!strncasecmp(typestr,"UNSIGNED32",3))
+            return(TYPE_UNSIGNED32);
+	if (!strcasecmp(typestr,"COUNTER")) /* check all in case counter64 */
+            return(TYPE_COUNTER);
+	if (!strncasecmp(typestr,"GAUGE",3))
+            return(TYPE_GAUGE);
+	if (!strncasecmp(typestr,"IPADDR",3))
+            return(TYPE_IPADDR);
+	if (!strncasecmp(typestr,"OCTETSTR",3))
+            return(TYPE_OCTETSTR);
+	if (!strncasecmp(typestr,"TICKS",3))
+            return(TYPE_TIMETICKS);
+	if (!strncasecmp(typestr,"OPAQUE",3))
+            return(TYPE_OPAQUE);
+	if (!strncasecmp(typestr,"OBJECTID",3))
+            return(TYPE_OBJID);
+	if (!strncasecmp(typestr,"NETADDR",3))
+	    return(TYPE_NETADDR);
+	if (!strncasecmp(typestr,"COUNTER64",3))
+	    return(TYPE_COUNTER64);
+	if (!strncasecmp(typestr,"NULL",3))
+	    return(TYPE_NULL);
+	if (!strncasecmp(typestr,"BITS",3))
+	    return(TYPE_BITSTRING);
+	if (!strncasecmp(typestr,"ENDOFMIBVIEW",3))
+	    return(SNMP_ENDOFMIBVIEW);
+	if (!strncasecmp(typestr,"NOSUCHOBJECT",7))
+	    return(SNMP_NOSUCHOBJECT);
+	if (!strncasecmp(typestr,"NOSUCHINSTANCE",7))
+	    return(SNMP_NOSUCHINSTANCE);
+	if (!strncasecmp(typestr,"UINTEGER",3))
+	    return(TYPE_UINTEGER); /* historic - should not show up */
+                                   /* but it does?                  */
+	if (!strncasecmp(typestr, "NOTIF", 3))
+		return(TYPE_NOTIFTYPE);
+	if (!strncasecmp(typestr, "TRAP", 4))
+		return(TYPE_TRAPTYPE);
+        return(TYPE_UNKNOWN);
+}
+
+static int
+__translate_asn_type(type)
+int type;
+{
+   switch (type) {
+        case ASN_INTEGER:
+            return(TYPE_INTEGER);
+	    break;
+	case ASN_OCTET_STR:
+            return(TYPE_OCTETSTR);
+	    break;
+	case ASN_OPAQUE:
+            return(TYPE_OPAQUE);
+	    break;
+	case ASN_OBJECT_ID:
+            return(TYPE_OBJID);
+	    break;
+	case ASN_TIMETICKS:
+            return(TYPE_TIMETICKS);
+	    break;
+	case ASN_GAUGE:
+            return(TYPE_GAUGE);
+	    break;
+	case ASN_COUNTER:
+            return(TYPE_COUNTER);
+	    break;
+	case ASN_IPADDRESS:
+            return(TYPE_IPADDR);
+	    break;
+	case ASN_BIT_STR:
+            return(TYPE_BITSTRING);
+	    break;
+	case ASN_NULL:
+            return(TYPE_NULL);
+	    break;
+	/* no translation for these exception type values */
+	case SNMP_ENDOFMIBVIEW:
+	case SNMP_NOSUCHOBJECT:
+	case SNMP_NOSUCHINSTANCE:
+	    return(type);
+	    break;
+	case ASN_UINTEGER:
+            return(TYPE_UINTEGER);
+	    break;
+	case ASN_COUNTER64:
+            return(TYPE_COUNTER64);
+	    break;
+	default:
+            warn("translate_asn_type: unhandled asn type (%d)\n",type);
+            return(TYPE_OTHER);
+            break;
+        }
+}
+
+#define USE_BASIC 0
+#define USE_ENUMS 1
+#define USE_SPRINT_VALUE 2
+static int
+__snprint_value (buf, buf_len, var, tp, type, flag)
+char * buf;
+size_t buf_len;
+netsnmp_variable_list * var;
+struct tree * tp;
+int type;
+int flag;
+{
+   int len = 0;
+   u_char* ip;
+   struct enum_list *ep;
+
+
+   buf[0] = '\0';
+   if (flag == USE_SPRINT_VALUE) {
+	snprint_value(buf, buf_len, var->name, var->name_length, var);
+	len = strlen(buf);
+   } else {
+     switch (var->type) {
+        case ASN_INTEGER:
+           if (flag == USE_ENUMS) {
+              for(ep = tp->enums; ep; ep = ep->next) {
+                 if (ep->value == *var->val.integer) {
+                    strcpy(buf, ep->label);
+                    len = strlen(buf);
+                    break;
+                 }
+              }
+           }
+           if (!len) {
+              sprintf(buf,"%ld", *var->val.integer);
+              len = strlen(buf);
+           }
+           break;
+
+        case ASN_GAUGE:
+        case ASN_COUNTER:
+        case ASN_TIMETICKS:
+        case ASN_UINTEGER:
+           sprintf(buf,"%lu", (unsigned long) *var->val.integer);
+           len = strlen(buf);
+           break;
+
+        case ASN_OCTET_STR:
+        case ASN_OPAQUE:
+           memcpy(buf, (char*)var->val.string, var->val_len);
+           len = var->val_len;
+           break;
+
+        case ASN_IPADDRESS:
+          ip = (u_char*)var->val.string;
+          sprintf(buf, "%d.%d.%d.%d", ip[0], ip[1], ip[2], ip[3]);
+          len = strlen(buf);
+          break;
+
+        case ASN_NULL:
+           break;
+
+        case ASN_OBJECT_ID:
+          __sprint_num_objid(buf, (oid *)(var->val.objid),
+                             var->val_len/sizeof(oid));
+          len = strlen(buf);
+          break;
+
+	case SNMP_ENDOFMIBVIEW:
+          sprintf(buf,"%s", "ENDOFMIBVIEW");
+	  break;
+	case SNMP_NOSUCHOBJECT:
+	  sprintf(buf,"%s", "NOSUCHOBJECT");
+	  break;
+	case SNMP_NOSUCHINSTANCE:
+	  sprintf(buf,"%s", "NOSUCHINSTANCE");
+	  break;
+
+        case ASN_COUNTER64:
+          printU64(buf,(struct counter64 *)var->val.counter64);
+          len = strlen(buf);
+          break;
+
+        case ASN_BIT_STR:
+            snprint_bitstring(buf, sizeof(buf), var, NULL, NULL, NULL);
+            len = strlen(buf);
+            break;
+
+        case ASN_NSAP:
+        default:
+           warn("snprint_value: asn type not handled %d\n",var->type);
+     }
+   }
+   return(len);
+}
+
+static int
+__sprint_num_objid (buf, objid, len)
+char *buf;
+oid *objid;
+int len;
+{
+   int i;
+   buf[0] = '\0';
+   for (i=0; i < len; i++) {
+	sprintf(buf,".%lu",*objid++);
+	buf += strlen(buf);
+   }
+   return SUCCESS;
+}
+
+static int
+__tp_sprint_num_objid (buf, tp)
+char *buf;
+SnmpMibNode *tp;
+{
+   oid newname[MAX_OID_LEN], *op;
+   /* code taken from get_node in snmp_client.c */
+   for (op = newname + MAX_OID_LEN - 1; op >= newname; op--) {
+      *op = tp->subid;
+      tp = tp->parent;
+      if (tp == NULL) break;
+   }
+   return __sprint_num_objid(buf, op, newname + MAX_OID_LEN - op);
+}
+
+static int
+__scan_num_objid (buf, objid, len)
+char *buf;
+oid *objid;
+int *len;
+{
+   char *cp;
+   *len = 0;
+   if (*buf == '.') buf++;
+   cp = buf;
+   while (*buf) {
+      if (*buf++ == '.') {
+         sscanf(cp, "%lu", objid++);
+         /* *objid++ = atoi(cp); */
+         (*len)++;
+         cp = buf;
+      } else {
+         if (isalpha((int)*buf)) {
+	    return FAILURE;
+         }
+      }
+   }
+   sscanf(cp, "%lu", objid++);
+   /* *objid++ = atoi(cp); */
+   (*len)++;
+   return SUCCESS;
+}
+
+static int
+__get_type_str (type, str)
+int type;
+char * str;
+{
+   switch (type) {
+	case TYPE_OBJID:
+       		strcpy(str, "OBJECTID");
+	        break;
+	case TYPE_OCTETSTR:
+       		strcpy(str, "OCTETSTR");
+	        break;
+	case TYPE_INTEGER:
+       		strcpy(str, "INTEGER");
+	        break;
+	case TYPE_INTEGER32:
+       		strcpy(str, "INTEGER32");
+	        break;
+	case TYPE_UNSIGNED32:
+       		strcpy(str, "UNSIGNED32");
+	        break;
+	case TYPE_NETADDR:
+       		strcpy(str, "NETADDR");
+	        break;
+	case TYPE_IPADDR:
+       		strcpy(str, "IPADDR");
+	        break;
+	case TYPE_COUNTER:
+       		strcpy(str, "COUNTER");
+	        break;
+	case TYPE_GAUGE:
+       		strcpy(str, "GAUGE");
+	        break;
+	case TYPE_TIMETICKS:
+       		strcpy(str, "TICKS");
+	        break;
+	case TYPE_OPAQUE:
+       		strcpy(str, "OPAQUE");
+	        break;
+	case TYPE_COUNTER64:
+       		strcpy(str, "COUNTER64");
+	        break;
+	case TYPE_NULL:
+                strcpy(str, "NULL");
+                break;
+	case SNMP_ENDOFMIBVIEW:
+                strcpy(str, "ENDOFMIBVIEW");
+                break;
+	case SNMP_NOSUCHOBJECT:
+                strcpy(str, "NOSUCHOBJECT");
+                break;
+	case SNMP_NOSUCHINSTANCE:
+                strcpy(str, "NOSUCHINSTANCE");
+                break;
+	case TYPE_UINTEGER:
+                strcpy(str, "UINTEGER"); /* historic - should not show up */
+                                          /* but it does?                  */
+                break;
+	case TYPE_NOTIFTYPE:
+		strcpy(str, "NOTIF");
+		break;
+	case TYPE_BITSTRING:
+		strcpy(str, "BITS");
+		break;
+	case TYPE_TRAPTYPE:
+		strcpy(str, "TRAP");
+		break;
+	case TYPE_OTHER: /* not sure if this is a valid leaf type?? */
+	case TYPE_NSAPADDRESS:
+        default: /* unsupported types for now */
+           strcpy(str, "");
+           return(FAILURE);
+   }
+   return SUCCESS;
+}
+
+/* does a destructive disection of <label1>...<labeln>.<iid> returning
+   <labeln> and <iid> in seperate strings (note: will destructively
+   alter input string, 'name') */
+static int
+__get_label_iid (name, last_label, iid, flag)
+char * name;
+char ** last_label;
+char ** iid;
+int flag;
+{
+   char *lcp;
+   char *icp;
+   int len = strlen(name);
+   int found_label = 0;
+
+   *last_label = *iid = NULL;
+
+   if (len == 0) return(FAILURE);
+
+   /* Handle case where numeric oid's have been requested.  The input 'name'
+   ** in this case should be a numeric OID -- return failure if not.
+   */
+   if ((flag & USE_NUMERIC_OIDS)) {
+      if (!__is_numeric_oid(name))
+       return(FAILURE);
+
+      /* Walk backward through the string, looking for first two '.' chars */
+      lcp = &(name[len]);
+      icp = NULL;
+      while (lcp > name) {
+       if (*lcp == '.') {
+
+          /* If this is the first occurence of '.', note it in icp.
+          ** Otherwise, this must be the second occurrence, so break
+          ** out of the loop.
+          */
+          if (icp == NULL)
+             icp = lcp;
+          else
+             break;
+       }
+       lcp --;
+      }
+
+      /* Make sure we found at least a label and index. */
+      if (!icp)
+         return(FAILURE);
+
+      /* Push forward past leading '.' chars and separate the strings. */
+      lcp ++;
+      *icp ++ = '\0';
+
+      *last_label = (flag & USE_LONG_NAMES) ? name : lcp;
+      *iid        = icp;
+
+      return(SUCCESS);
+   }
+
+   lcp = icp = &(name[len]);
+
+   while (lcp > name) {
+      if (*lcp == '.') {
+	if (found_label) {
+	   lcp++;
+           break;
+        } else {
+           icp = lcp;
+        }
+      }
+      if (!found_label && isalpha((int)*lcp)) found_label = 1;
+      lcp--;
+   }
+
+   if (!found_label || (!isdigit((int)*(icp+1)) && (flag & FAIL_ON_NULL_IID)))
+      return(FAILURE);
+
+   if (flag & NON_LEAF_NAME) { /* dont know where to start instance id */
+     /* put the whole thing in label */
+     icp = &(name[len]);
+     flag |= USE_LONG_NAMES;
+     /* special hack in case no mib loaded - object identifiers will
+      * start with .iso.<num>.<num>...., in which case it is preferable
+      * to make the label entirely numeric (i.e., convert "iso" => "1")
+      */
+      if (*lcp == '.' && lcp == name) {
+         if (!strncmp(".ccitt.",lcp,7)) {
+            name += 2;
+            *name = '.';
+            *(name+1) = '0';
+         } else if (!strncmp(".iso.",lcp,5)) {
+            name += 2;
+            *name = '.';
+            *(name+1) = '1';
+         } else if (!strncmp(".joint-iso-ccitt.",lcp,17)) {
+            name += 2;
+            *name = '.';
+            *(name+1) = '2';
+         }
+      }
+   } else if (*icp) {
+      *(icp++) = '\0';
+   }
+   *last_label = (flag & USE_LONG_NAMES ? name : lcp);
+
+   *iid = icp;
+
+   return(SUCCESS);
+}
+
+
+static int
+__oid_cmp(oida_arr, oida_arr_len, oidb_arr, oidb_arr_len)
+oid *oida_arr;
+int oida_arr_len;
+oid *oidb_arr;
+int oidb_arr_len;
+{
+   for (;oida_arr_len && oidb_arr_len;
+	oida_arr++, oida_arr_len--, oidb_arr++, oidb_arr_len--) {
+	if (*oida_arr == *oidb_arr) continue;
+	return(*oida_arr > *oidb_arr ? 1 : -1);
+   }
+   if (oida_arr_len == oidb_arr_len) return(0);
+   return(oida_arr_len > oidb_arr_len ? 1 : -1);
+}
+
+#define MAX_BAD 0xffffff
+
+static u_int
+compute_match(search_base, key)
+const char *search_base;
+const char *key;
+{
+   int rc;
+   regex_t parsetree;
+   regmatch_t pmatch;
+
+   rc = regcomp(&parsetree, key, REG_ICASE | REG_EXTENDED);
+   if (rc == 0)
+      rc = regexec(&parsetree, search_base, 1, &pmatch, 0);
+   regfree(&parsetree);
+   if (rc == 0) {
+      return pmatch.rm_so;
+   }
+
+   return MAX_BAD;
+}
+
+static struct tree *
+__tag2oid(tag, iid, oid_arr, oid_arr_len, type, best_guess)
+char * tag;
+char * iid;
+oid  * oid_arr;
+int  * oid_arr_len;
+int  * type;
+int    best_guess;
+{
+   struct tree *tp = NULL;
+   struct tree *rtp = NULL;
+   DLL_IMPORT extern struct tree *tree_head;
+   oid newname[MAX_OID_LEN], *op;
+   int newname_len = 0;
+
+   if (type) *type = TYPE_UNKNOWN;
+   if (oid_arr_len) *oid_arr_len = 0;
+   if (!tag) goto done;
+
+   if (best_guess) {
+      tp = rtp = find_best_tree_node(tag, tree_head, NULL);
+      if (tp) {
+	 if (type) *type = tp->type;
+	 if ((oid_arr == NULL) || (oid_arr_len == NULL)) return rtp;
+	 for (op = newname + MAX_OID_LEN - 1; op >= newname; op--) {
+            *op = tp->subid;
+	    tp = tp->parent;
+	    if (tp == NULL)
+	       break;
+	 }
+	 *oid_arr_len = newname + MAX_OID_LEN - op;
+	 memcpy(oid_arr, op, *oid_arr_len * sizeof(oid));
+      }
+      return(rtp);
+   }
+
+   if (strchr(tag,'.')) { /* if multi part tag  */
+      if (!__scan_num_objid(tag, newname, &newname_len)) { /* numeric tag */
+         newname_len = MAX_OID_LEN;
+         read_objid(tag, newname, &newname_len); /* long name */
+      }
+      if (type) *type = (tp ? tp->type : TYPE_UNKNOWN);
+      if ((oid_arr == NULL) || (oid_arr_len == NULL)) return rtp;
+      memcpy(oid_arr,(char*)newname,newname_len*sizeof(oid));
+      *oid_arr_len = newname_len;
+   } else { /* else it is a leaf */
+      rtp = tp = find_node(tag, Mib);
+      if (tp) {
+         if (type) *type = tp->type;
+         if ((oid_arr == NULL) || (oid_arr_len == NULL)) return rtp;
+         /* code taken from get_node in snmp_client.c */
+         for(op = newname + MAX_OID_LEN - 1; op >= newname; op--){
+           *op = tp->subid;
+	   tp = tp->parent;
+	   if (tp == NULL)
+	      break;
+         }
+         *oid_arr_len = newname + MAX_OID_LEN - op;
+         memcpy(oid_arr, op, *oid_arr_len * sizeof(oid));
+      } else {
+         return(rtp);   /* HACK: otherwise, concat_oid_str confuses things */
+      }
+   }
+ done:
+   if (iid && *iid) __concat_oid_str(oid_arr, oid_arr_len, iid);
+   return(rtp);
+}
+/* searches down the mib tree for the given oid
+   returns the last found tp and its index in lastind
+ */
+static struct tree *
+__oid2tp (oidp, len, subtree, lastind)
+oid* oidp;
+int len;
+struct tree * subtree;
+int* lastind;
+{
+    struct tree    *return_tree = NULL;
+
+
+    for (; subtree; subtree = subtree->next_peer) {
+	if (*oidp == subtree->subid){
+	    goto found;
+	}
+    }
+    *lastind=0;
+    return NULL;
+
+found:
+    if (len > 1){
+       return_tree =
+          __oid2tp(oidp + 1, len - 1, subtree->child_list, lastind);
+       (*lastind)++;
+    } else {
+       *lastind=1;
+    }
+    if (return_tree)
+	return return_tree;
+    else
+	return subtree;
+}
+
+/* function: __concat_oid_str
+ *
+ * This function converts a dotted-decimal string, soid_str, to an array
+ * of oid types and concatenates them on doid_arr begining at the index
+ * specified by doid_arr_len.
+ *
+ * returns : SUCCESS, FAILURE
+ */
+static int
+__concat_oid_str(doid_arr, doid_arr_len, soid_str)
+oid *doid_arr;
+int *doid_arr_len;
+char * soid_str;
+{
+   char soid_buf[STR_BUF_SIZE];
+   char *cp;
+
+   if (!soid_str || !*soid_str) return SUCCESS;/* successfully added nothing */
+   if (*soid_str == '.') soid_str++;
+   strcpy(soid_buf, soid_str);
+   cp = strtok(soid_buf,".");
+   while (cp) {
+     sscanf(cp, "%lu", &(doid_arr[(*doid_arr_len)++]));
+     /* doid_arr[(*doid_arr_len)++] =  atoi(cp); */
+     cp = strtok(NULL,".");
+   }
+   return(SUCCESS);
+}
+
+/*
+ * add a varbind to PDU
+ */
+static int
+__add_var_val_str(pdu, name, name_length, val, len, type)
+    netsnmp_pdu *pdu;
+    oid *name;
+    int name_length;
+    char * val;
+    int len;
+    int type;
+{
+    netsnmp_variable_list *vars;
+    oid oidbuf[MAX_OID_LEN];
+    int ret = SUCCESS;
+    struct tree *tp;
+
+    if (pdu->variables == NULL){
+	pdu->variables = vars =
+           (netsnmp_variable_list *)calloc(1,sizeof(netsnmp_variable_list));
+    } else {
+	for(vars = pdu->variables;
+            vars->next_variable;
+            vars = vars->next_variable)
+	    /*EXIT*/;
+	vars->next_variable =
+           (netsnmp_variable_list *)calloc(1,sizeof(netsnmp_variable_list));
+	vars = vars->next_variable;
+    }
+
+    vars->next_variable = NULL;
+    vars->name = (oid *)malloc(name_length * sizeof(oid));
+    memcpy((char *)vars->name, (char *)name, name_length * sizeof(oid));
+    vars->name_length = name_length;
+    switch (type) {
+      case TYPE_INTEGER:
+      case TYPE_INTEGER32:
+        vars->type = ASN_INTEGER;
+        vars->val.integer = (long *)malloc(sizeof(long));
+        if (val)
+            *(vars->val.integer) = strtol(val,NULL,0);
+        else {
+            ret = FAILURE;
+            *(vars->val.integer) = 0;
+        }
+        vars->val_len = sizeof(long);
+        break;
+
+      case TYPE_GAUGE:
+      case TYPE_UNSIGNED32:
+        vars->type = ASN_GAUGE;
+        goto UINT;
+      case TYPE_COUNTER:
+        vars->type = ASN_COUNTER;
+        goto UINT;
+      case TYPE_TIMETICKS:
+        vars->type = ASN_TIMETICKS;
+        goto UINT;
+      case TYPE_UINTEGER:
+        vars->type = ASN_UINTEGER;
+UINT:
+        vars->val.integer = (long *)malloc(sizeof(long));
+        if (val)
+            sscanf(val,"%lu",vars->val.integer);
+        else {
+            ret = FAILURE;
+            *(vars->val.integer) = 0;
+        }
+        vars->val_len = sizeof(long);
+        break;
+
+      case TYPE_OCTETSTR:
+	vars->type = ASN_OCTET_STR;
+	goto OCT;
+
+      case TYPE_BITSTRING:
+	vars->type = ASN_OCTET_STR;
+	goto OCT;
+
+      case TYPE_OPAQUE:
+        vars->type = ASN_OCTET_STR;
+OCT:
+        vars->val.string = (u_char *)malloc(len);
+        vars->val_len = len;
+        if (val && len)
+            memcpy((char *)vars->val.string, val, len);
+        else {
+            ret = FAILURE;
+            vars->val.string = strdup("");
+            vars->val_len = 0;
+        }
+        break;
+
+      case TYPE_IPADDR:
+        vars->type = ASN_IPADDRESS;
+        vars->val.integer = (long *)malloc(sizeof(long));
+        if (val)
+            *(vars->val.integer) = inet_addr(val);
+        else {
+            ret = FAILURE;
+            *(vars->val.integer) = 0;
+        }
+        vars->val_len = sizeof(long);
+        break;
+
+      case TYPE_OBJID:
+        vars->type = ASN_OBJECT_ID;
+	vars->val_len = MAX_OID_LEN;
+        /* if (read_objid(val, oidbuf, &(vars->val_len))) { */
+	/* tp = __tag2oid(val,NULL,oidbuf,&(vars->val_len),NULL,0); */
+        if (!val || !snmp_parse_oid(val, oidbuf, &vars->val_len)) {
+            vars->val.objid = NULL;
+	    ret = FAILURE;
+        } else {
+            vars->val_len *= sizeof(oid);
+            vars->val.objid = (oid *)malloc(vars->val_len);
+            memcpy((char *)vars->val.objid, (char *)oidbuf, vars->val_len);
+        }
+        break;
+
+      default:
+        vars->type = ASN_NULL;
+	vars->val_len = 0;
+	vars->val.string = NULL;
+	ret = FAILURE;
+    }
+
+     return ret;
+}
+
+/* takes ss and pdu as input and updates the 'response' argument */
+/* the input 'pdu' argument will be freed */
+static int
+__send_sync_pdu(ss, pdu, response, retry_nosuch,
+	        err_str_sv, err_num_sv, err_ind_sv)
+netsnmp_session *ss;
+netsnmp_pdu *pdu;
+netsnmp_pdu **response;
+int retry_nosuch;
+SV * err_str_sv;
+SV * err_num_sv;
+SV * err_ind_sv;
+{
+   int status;
+   long command = pdu->command;
+   *response = NULL;
+retry:
+
+   status = snmp_synch_response(ss, pdu, response);
+
+   if ((*response == NULL) && (status == STAT_SUCCESS)) status = STAT_ERROR;
+
+   switch (status) {
+      case STAT_SUCCESS:
+	 switch ((*response)->errstat) {
+	    case SNMP_ERR_NOERROR:
+	       break;
+
+            case SNMP_ERR_NOSUCHNAME:
+               if (retry_nosuch && (pdu = snmp_fix_pdu(*response, command))) {
+                  if (*response) snmp_free_pdu(*response);
+                  goto retry;
+               }
+
+            /* Pv1, SNMPsec, Pv2p, v2c, v2u, v2*, and SNMPv3 PDUs */
+            case SNMP_ERR_TOOBIG:
+            case SNMP_ERR_BADVALUE:
+            case SNMP_ERR_READONLY:
+            case SNMP_ERR_GENERR:
+            /* in SNMPv2p, SNMPv2c, SNMPv2u, SNMPv2*, and SNMPv3 PDUs */
+            case SNMP_ERR_NOACCESS:
+            case SNMP_ERR_WRONGTYPE:
+            case SNMP_ERR_WRONGLENGTH:
+            case SNMP_ERR_WRONGENCODING:
+            case SNMP_ERR_WRONGVALUE:
+            case SNMP_ERR_NOCREATION:
+            case SNMP_ERR_INCONSISTENTVALUE:
+            case SNMP_ERR_RESOURCEUNAVAILABLE:
+            case SNMP_ERR_COMMITFAILED:
+            case SNMP_ERR_UNDOFAILED:
+            case SNMP_ERR_AUTHORIZATIONERROR:
+            case SNMP_ERR_NOTWRITABLE:
+            /* in SNMPv2c, SNMPv2u, SNMPv2*, and SNMPv3 PDUs */
+            case SNMP_ERR_INCONSISTENTNAME:
+            default:
+               sv_catpv(err_str_sv,
+                        (char*)snmp_errstring((*response)->errstat));
+               sv_setiv(err_num_sv, (*response)->errstat);
+	       sv_setiv(err_ind_sv, (*response)->errindex);
+               status = (*response)->errstat;
+               break;
+	 }
+         break;
+
+      case STAT_TIMEOUT:
+      case STAT_ERROR:
+          sv_catpv(err_str_sv, (char*)snmp_api_errstring(ss->s_snmp_errno));
+          sv_setiv(err_num_sv, ss->s_snmp_errno);
+         break;
+
+      default:
+         sv_catpv(err_str_sv, "send_sync_pdu: unknown status");
+         sv_setiv(err_num_sv, ss->s_snmp_errno);
+         break;
+   }
+
+   return(status);
+}
+
+static int
+__callback_wrapper (op, ss, reqid, pdu, cb_data)
+int op;
+netsnmp_session *ss;
+int reqid;
+netsnmp_pdu *pdu;
+void *cb_data;
+{
+  /* we should probably just increment the reference counter... */
+  /*  sv_inc(cb_data); */
+  return __snmp_xs_cb(op, ss, reqid, pdu, newSVsv(cb_data));
+}
+
+
+static int
+__snmp_xs_cb (op, ss, reqid, pdu, cb_data)
+int op;
+netsnmp_session *ss;
+int reqid;
+netsnmp_pdu *pdu;
+void *cb_data;
+{
+  SV *varlist_ref;
+  AV *varlist;
+  SV *varbind_ref;
+  AV *varbind;
+  SV *traplist_ref = NULL;
+  AV *traplist = NULL;
+  netsnmp_variable_list *vars;
+  struct tree *tp;
+  int len;
+  SV *tmp_sv;
+  int type;
+  char tmp_type_str[MAX_TYPE_NAME_LEN];
+  u_char str_buf[STR_BUF_SIZE], *str_bufp = str_buf;
+  size_t str_buf_len = sizeof(str_buf);
+  size_t out_len = 0;
+  int buf_over = 0;
+  char *label;
+  char *iid;
+  char *cp;
+  int getlabel_flag = NO_FLAGS;
+  int sprintval_flag = USE_BASIC;
+  netsnmp_pdu *reply_pdu;
+  int old_numeric, old_printfull;
+  netsnmp_transport *transport = NULL;
+
+  SV* cb = ((struct snmp_xs_cb_data*)cb_data)->perl_cb;
+  SV* sess_ref = ((struct snmp_xs_cb_data*)cb_data)->sess_ref;
+  SV **err_str_svp = hv_fetch((HV*)SvRV(sess_ref), "ErrorStr", 8, 1);
+  SV **err_num_svp = hv_fetch((HV*)SvRV(sess_ref), "ErrorNum", 8, 1);
+  SV **err_ind_svp = hv_fetch((HV*)SvRV(sess_ref), "ErrorInd", 8, 1);
+
+  dSP;
+  ENTER;
+  SAVETMPS;
+
+  free(cb_data);
+
+  sv_setpv(*err_str_svp, (char*)snmp_errstring(pdu->errstat));
+  sv_setiv(*err_num_svp, pdu->errstat);
+  sv_setiv(*err_ind_svp, pdu->errindex);
+
+  varlist_ref = &sv_undef;	/* Prevent unintialized use below. */
+
+  switch (op) {
+  case NETSNMP_CALLBACK_OP_RECEIVED_MESSAGE:
+    traplist_ref = NULL;
+    switch (pdu->command) {
+    case SNMP_MSG_INFORM:
+      /*
+       * Ideally, we would use the return value from the callback to
+       * decide what response, if any, we send, and what the error status
+       * and error index should be.
+       */
+      reply_pdu = snmp_clone_pdu(pdu);
+      if (reply_pdu) {
+        reply_pdu->command = SNMP_MSG_RESPONSE;
+        reply_pdu->reqid = pdu->reqid;
+        reply_pdu->errstat = reply_pdu->errindex = 0;
+        snmp_send(ss, reply_pdu);
+      } else {
+        warn("Couldn't clone PDU for inform response");
+      }
+      /* FALLTHRU */
+    case SNMP_MSG_TRAP2:
+      traplist = newAV();
+      traplist_ref = newRV_noinc((SV*)traplist);
+#if 0
+      /* of dubious utility... */
+      av_push(traplist, newSViv(pdu->command));
+#endif
+      av_push(traplist, newSViv(pdu->reqid));
+      if ((transport = snmp_sess_transport(snmp_sess_pointer(ss))) != NULL) {
+	cp = transport->f_fmtaddr(transport, pdu->transport_data,
+				  pdu->transport_data_length);
+	av_push(traplist, newSVpv(cp, strlen(cp)));
+	free(cp);
+      } else {
+	/*  This shouldn't ever happen; every session has a transport.  */
+	av_push(traplist, newSVpv("", 0));
+      }
+      av_push(traplist, newSVpv((char*) pdu->community, pdu->community_len));
+      /* FALLTHRU */
+    case SNMP_MSG_RESPONSE:
+      {
+      varlist = newAV();
+      varlist_ref = newRV_noinc((SV*)varlist);
+
+      /*
+      ** Set up for numeric OID's, if necessary.  Save the old values
+      ** so that they can be restored when we finish -- these are
+      ** library-wide globals, and have to be set/restored for each
+      ** session.
+      */
+      old_numeric = netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_PRINT_NUMERIC_OIDS);
+      old_printfull = netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_PRINT_FULL_OID);
+      if (SvIV(*hv_fetch((HV*)SvRV(sess_ref),"UseNumeric", 10, 1))) {
+         getlabel_flag |= USE_NUMERIC_OIDS;
+         netsnmp_ds_set_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_PRINT_NUMERIC_OIDS, 1);
+      }
+      if (SvIV(*hv_fetch((HV*)SvRV(sess_ref),"UseLongNames", 12, 1))) {
+         getlabel_flag |= USE_LONG_NAMES;
+         netsnmp_ds_set_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_PRINT_FULL_OID, 1);
+      }
+
+      sv_bless(varlist_ref, gv_stashpv("SNMP::VarList",0));
+      for(vars = (pdu?pdu->variables:NULL); vars; vars = vars->next_variable) {
+         varbind = newAV();
+         varbind_ref = newRV_noinc((SV*)varbind);
+         sv_bless(varbind_ref, gv_stashpv("SNMP::Varbind",0));
+         av_push(varlist, varbind_ref);
+         *str_buf = '.';
+         *(str_buf+1) = '\0';
+         out_len = 0;
+         tp = netsnmp_sprint_realloc_objid_tree(&str_bufp, &str_buf_len,
+                                                &out_len, 0, &buf_over,
+                                                vars->name,vars->name_length);
+         str_buf[sizeof(str_buf)-1] = '\0';
+         if (__is_leaf(tp)) {
+            type = tp->type;
+         } else {
+            getlabel_flag |= NON_LEAF_NAME;
+            type = __translate_asn_type(vars->type);
+         }
+         __get_label_iid(str_buf,&label,&iid,getlabel_flag);
+         av_store(varbind, VARBIND_TAG_F,
+                  newSVpv(label, strlen(label)));
+         av_store(varbind, VARBIND_IID_F,
+                  newSVpv(iid, strlen(iid)));
+         __get_type_str(type, tmp_type_str);
+         tmp_sv = newSVpv(tmp_type_str, strlen(tmp_type_str));
+         av_store(varbind, VARBIND_TYPE_F, tmp_sv);
+         len = __snprint_value(str_buf, sizeof(str_buf),
+                              vars, tp, type, sprintval_flag);
+         tmp_sv = newSVpv((char*)str_buf, len);
+         av_store(varbind, VARBIND_VAL_F, tmp_sv);
+      } /* for */
+
+      /* Reset the library's behavior for numeric/symbolic OID's. */
+      netsnmp_ds_set_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_PRINT_NUMERIC_OIDS, old_numeric );
+      netsnmp_ds_set_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_PRINT_FULL_OID, old_printfull);
+
+      } /* case SNMP_MSG_RESPONSE */
+      break;
+    default:;
+    } /* switch pdu->command */
+    break;
+
+  case NETSNMP_CALLBACK_OP_TIMED_OUT:
+    varlist_ref = &sv_undef;
+    break;
+  default:;
+  } /* switch op */
+  sv_2mortal(cb);
+  cb = __push_cb_args2(cb,
+                 (SvTRUE(varlist_ref) ? sv_2mortal(varlist_ref):varlist_ref),
+	         (SvTRUE(traplist_ref) ? sv_2mortal(traplist_ref):traplist_ref));
+  __call_callback(cb, G_DISCARD);
+
+  FREETMPS;
+  LEAVE;
+  sv_2mortal(sess_ref);
+  return 1;
+}
+
+static SV *
+__push_cb_args2(sv,esv,tsv)
+SV *sv;
+SV *esv;
+SV *tsv;
+{
+   dSP;
+   if (SvTYPE(SvRV(sv)) != SVt_PVCV) sv = SvRV(sv);
+
+   PUSHMARK(sp);
+   if (SvTYPE(sv) == SVt_PVAV) {
+      AV *av = (AV *) sv;
+      int n = av_len(av) + 1;
+      SV **x = av_fetch(av, 0, 0);
+      if (x) {
+         int i = 1;
+         sv = *x;
+
+         for (i = 1; i < n; i++) {
+            x = av_fetch(av, i, 0);
+            if (x) {
+               SV *arg = *x;
+               XPUSHs(sv_mortalcopy(arg));
+            } else {
+               XPUSHs(&sv_undef);
+            }
+         }
+      } else {
+         sv = &sv_undef;
+      }
+   }
+   if (esv) XPUSHs(sv_mortalcopy(esv));
+   if (tsv) XPUSHs(sv_mortalcopy(tsv));
+   PUTBACK;
+   return sv;
+}
+
+static int
+__call_callback(sv, flags)
+SV *sv;
+int flags;
+{
+ dSP;
+ I32 myframe = TOPMARK;
+ I32 count;
+ ENTER;
+ if (SvTYPE(sv) == SVt_PVCV)
+  {
+   count = perl_call_sv(sv, flags);
+  }
+ else if (SvROK(sv) && SvTYPE(SvRV(sv)) == SVt_PVCV)
+  {
+   count = perl_call_sv(SvRV(sv), flags);
+  }
+ else
+  {
+
+   SV **top = stack_base + myframe + 1;
+   SV *obj = *top;
+   if (SvPOK(sv) && SvROK(obj) && SvOBJECT(SvRV(obj)))
+    {
+     count = perl_call_method(SvPV(sv, na), flags);
+    }
+   else if (SvPOK(obj) && SvROK(sv) && SvOBJECT(SvRV(sv)))
+    {
+     /* We have obj method ...
+        Used to be used instead of LangMethodCall()
+      */
+     *top = sv;
+     count = perl_call_method(SvPV(obj, na), flags);
+    }
+   else
+    {
+     count = perl_call_sv(sv, flags);
+    }
+ }
+ LEAVE;
+ return count;
+}
+
+/* Bulkwalk support routines */
+
+/* Add a context pointer to the list of valid pointers.  Place it in the first
+** NULL slot in the array.
+*/
+static int
+_context_add(walk_context *context)
+{
+    int i, j, new_sz;
+
+    if ((i = _context_okay(context)) != 0)	/* Already exists?  Okay. */
+	return i;
+
+    /* Initialize the array if necessary. */
+    if (_valid_contexts == NULL) {
+
+	/* Create the _valid_contexts structure. */
+	Newz(0, _valid_contexts, 1, struct valid_contexts);
+	assert(_valid_contexts != NULL);
+
+	/* Populate the original valid contexts array. */
+	Newz(0, _valid_contexts->valid, 4, walk_context *);
+	assert(_valid_contexts->valid != NULL);
+
+	/* Computer number of slots in the array. */
+	_valid_contexts->sz_valid = sizeof(*_valid_contexts->valid) /
+							sizeof(walk_context *);
+
+	for (i = 0; i < _valid_contexts->sz_valid; i++)
+	    _valid_contexts->valid[i] = NULL;
+
+	DBPRT(3, (DBOUT "Created valid_context array 0x%p (%d slots)\n",
+			    _valid_contexts->valid, _valid_contexts->sz_valid));
+    }
+
+    /* Search through the list, looking for NULL's -- unused slots. */
+    for (i = 0; i < _valid_contexts->sz_valid; i++)
+	if (_valid_contexts->valid[i] == NULL)
+	    break;
+
+    /* Did we walk off the end of the list?  Need to grow the list.  Double
+    ** it for now.
+    */
+    if (i == _valid_contexts->sz_valid) {
+	new_sz = _valid_contexts->sz_valid * 2;
+
+	Renew(_valid_contexts->valid, new_sz, walk_context *);
+	assert(_valid_contexts->valid != NULL);
+
+	DBPRT(3, (DBOUT "Resized valid_context array 0x%p from %d to %d slots\n",
+		    _valid_contexts->valid, _valid_contexts->sz_valid, new_sz));
+
+	_valid_contexts->sz_valid = new_sz;
+
+	/* Initialize the new half of the resized array. */
+	for (j = i; j < new_sz; j++)
+	    _valid_contexts->valid[j] = NULL;
+    }
+
+    /* Store the context pointer in the array and return 0 (success). */
+    _valid_contexts->valid[i] = context;
+    DBPRT(3,( "Add context 0x%p to valid context list\n", context));
+    return 0;
+}
+
+/* Remove a context pointer from the valid list.  Replace the pointer with
+** NULL in the valid pointer list.
+*/
+static int
+_context_del(walk_context *context)
+{
+    int i;
+
+    if (_valid_contexts == NULL)	/* Make sure it was initialized. */
+	return 1;
+
+    for (i = 0; i < _valid_contexts->sz_valid; i++) {
+	if (_valid_contexts->valid[i] == context) {
+	    DBPRT(3,( "Remove context 0x%p from valid context list\n", context));
+	    _valid_contexts->valid[i] = NULL;	/* Remove it from the list.  */
+	    return 0;				/* Return successful status. */
+	}
+    }
+    return 1;
+}
+
+/* Check if a specific context pointer is in the valid list.  Return true (1)
+** if the context is still in the valid list, or 0 if not (or context is NULL).
+*/
+static int
+_context_okay(walk_context *context)
+{
+    int i;
+
+    if (_valid_contexts == NULL)	/* Make sure it was initialized. */
+	return 0;
+
+    if (context == NULL)		/* Asked about a NULL context? Fail. */
+	return 0;
+
+    for (i = 0; i < _valid_contexts->sz_valid; i++)
+	if (_valid_contexts->valid[i] == context)
+	    return 1;			/* Found it! */
+
+    return 0;				/* No match -- return failure. */
+}
+
+/* Check if the walk is completed, based upon the context.  Also set the
+** ignore flag on any completed variables -- this prevents them from being
+** being sent in later packets.
+*/
+static int
+_bulkwalk_done(walk_context *context)
+{
+   int is_done = 1;
+   int i;
+   bulktbl *bt_entry;		/* bulktbl requested OID entry */
+
+   /* Don't consider walk done until at least one packet has been exchanged. */
+   if (context->pkts_exch == 0)
+      return 0;
+
+   /* Fix up any requests that have completed.  If the complete flag is set,
+   ** or it is a non-repeater OID, set the ignore flag so that it will not
+   ** be considered further.  Assume we are done with the walk, and note
+   ** otherwise if we aren't.  Return 1 if all requests are complete, or 0
+   ** if there's more to do.
+   */
+   for (i = 0; i < context->nreq_oids; i ++) {
+      bt_entry = &context->req_oids[i];
+
+      if (bt_entry->complete || bt_entry->norepeat) {
+
+ 	/* This request is complete.  Remove it from list of
+ 	** walks still in progress.
+ 	*/
+ 	DBPRT(1, (DBOUT "Ignoring %s request oid %s\n",
+ 	      bt_entry->norepeat? "nonrepeater" : "completed",
+ 	      snprint_objid(_debugx, sizeof(_debugx), bt_entry->req_oid,
+ 				    bt_entry->req_len)));
+
+ 	/* Ignore this OID in any further packets. */
+ 	bt_entry->ignore = 1;
+      }
+
+      /* If any OID is not being ignored, the walk is not done.  Must loop
+      ** through all requests to do the fixup -- no early return possible.
+      */
+      if (!bt_entry->ignore)
+ 	 is_done = 0;
+   }
+
+   return is_done;		/* Did the walk complete? */
+}
+
+/* Callback registered with SNMP.  Return 1 from this callback to cause the
+** current request to be deleted from the retransmit queue.
+*/
+static int
+_bulkwalk_async_cb(int		op,
+		  SnmpSession	*ss,
+		  int 		reqid,
+		  netsnmp_pdu *pdu,
+		  void		*context_ptr)
+{
+   walk_context *context;
+   int	done = 0;
+   int	npushed;
+   SV **err_str_svp;
+   SV **err_num_svp;
+
+   /* Handle callback request for asynchronous bulkwalk.  If the bulkwalk has
+   ** not completed, and has not timed out, send the next request packet in
+   ** the walk.
+   **
+   ** Return 0 to indicate success (caller ignores return value).
+   */
+
+   DBPRT(2, (DBOUT "bulkwalk_async_cb(op %d, reqid 0x%08X, context 0x%p)\n",
+							op, reqid, context_ptr));
+
+   context = (walk_context *)context_ptr;
+
+   /* Make certain this is a valid context pointer.  This pdu may
+   ** have been retransmitted after the bulkwalk was completed
+   ** (and the context was destroyed).  If so, just return.
+   */
+   if (!_context_okay(context)) {
+      DBPRT(2,( "Ignoring PDU for dead context 0x%p...\n", context));
+      return 1;
+   }
+
+   /* Is this a retransmission of a request we've already seen or some
+   ** unexpected request id?  If so, just ignore it.
+   */
+   if (reqid != context->exp_reqid) {
+       DBPRT(2,
+             ("Got reqid 0x%08X, expected reqid 0x%08X.  Ignoring...\n", reqid,
+              context->exp_reqid));
+      return 1;
+   }
+   /* Ignore any future packets for this reqid. */
+   context->exp_reqid = -1;
+
+   err_str_svp = hv_fetch((HV*)SvRV(context->sess_ref), "ErrorStr", 8, 1);
+   err_num_svp = hv_fetch((HV*)SvRV(context->sess_ref), "ErrorNum", 8, 1);
+
+   switch (op) {
+      case NETSNMP_CALLBACK_OP_RECEIVED_MESSAGE:
+      {
+	 DBPRT(1,( "Received message for reqid 0x%08X ...\n", reqid));
+
+	 switch (pdu->command)
+	 {
+	    case SNMP_MSG_RESPONSE:
+	    {
+	       DBPRT(2, (DBOUT "Calling bulkwalk_recv_pdu(context 0x%p, pdu 0x%p)\n",
+							   context_ptr, pdu));
+
+	       /* Handle the response PDU.  If an error occurs or there were
+	       ** no variables in the response, consider the walk done.  If
+	       ** the response was okay, check if we have any more to do after
+	       ** this response.
+	       */
+	       if (_bulkwalk_recv_pdu(context, pdu) <= 0)
+		  done = 1;
+	       else
+		  done = _bulkwalk_done(context); /* Also set req ignore flags */
+	       break;
+	    }
+	    default:
+	    {
+	       DBPRT(1,( "unexpected pdu->command %d\n", pdu->command));
+	       done = 1;   /* "This can't happen!", so bail out when it does. */
+	       break;
+	    }
+	 }
+
+	 break;
+      }
+
+      case NETSNMP_CALLBACK_OP_TIMED_OUT:
+      {
+	 DBPRT(1,( "\n*** Timeout for reqid 0x%08X\n\n", reqid));
+
+         sv_setpv(*err_str_svp, (char*)snmp_api_errstring(SNMPERR_TIMEOUT));
+         sv_setiv(*err_num_svp, SNMPERR_TIMEOUT);
+
+	 /* Timeout means something bad has happened.  Return a not-okay
+	 ** result to the async callback.
+	 */
+	 npushed = _bulkwalk_finish(context, 0 /* NOT OKAY */);
+	 return 1;
+      }
+
+      default:
+      {
+	 DBPRT(1,( "unexpected callback op %d\n", op));
+         sv_setpv(*err_str_svp, (char*)snmp_api_errstring(SNMPERR_GENERR));
+         sv_setiv(*err_num_svp, SNMPERR_GENERR);
+	 npushed = _bulkwalk_finish(context, 0 /* NOT OKAY */);
+	 return 1;
+      }
+   }
+
+   /* We have either timed out, or received and parsed in a response.  Now,
+   ** if we have more variables to test, call bulkwalk_send_pdu() to enqueue
+   ** another async packet, and return.
+   **
+   ** If, however, the bulkwalk has completed (or an error has occurred that
+   ** cuts the walk short), call bulkwalk_finish() to push the results onto
+   ** the Perl call stack.  Then explicitly call the Perl callback that was
+   ** passed in by the user oh-so-long-ago.
+   */
+   if (!done) {
+      DBPRT(1,( "bulkwalk not complete -- send next pdu from callback\n"));
+
+      if (_bulkwalk_send_pdu(context) != NULL)
+	 return 1;
+
+      DBPRT(1,( "send_pdu() failed!\n"));
+      /* Fall through and return what we have so far. */
+   }
+
+   /* Call the perl callback with the return values and we're done. */
+   npushed = _bulkwalk_finish(context, 1 /* OKAY */);
+
+   return 1;
+}
+
+static netsnmp_pdu *
+_bulkwalk_send_pdu(walk_context *context)
+{
+   netsnmp_pdu *pdu = NULL;
+   netsnmp_pdu *response = NULL;
+   struct bulktbl  *bt_entry;
+   int	nvars = 0;
+   int	reqid;
+   int	status;
+   int	i;
+
+   /* Send a pdu requesting any remaining variables in the context.
+   **
+   ** In synchronous mode, returns a pointer to the response packet.
+   **
+   ** In asynchronous mode, it returns the request ID, cast to a struct snmp *,
+   **   not a valid SNMP response packet.  The async code should not be trying
+   **   to get variables out of this "response".
+   **
+   ** In either case, return a NULL pointer on error or failure.
+   */
+
+   SV **sess_ptr_sv = hv_fetch((HV*)SvRV(context->sess_ref), "SessPtr", 7, 1);
+   netsnmp_session *ss = (SnmpSession *)SvIV((SV*)SvRV(*sess_ptr_sv));
+   SV **err_str_svp = hv_fetch((HV*)SvRV(context->sess_ref), "ErrorStr", 8, 1);
+   SV **err_num_svp = hv_fetch((HV*)SvRV(context->sess_ref), "ErrorNum", 8, 1);
+   SV **err_ind_svp = hv_fetch((HV*)SvRV(context->sess_ref), "ErrorInd", 8, 1);
+
+   /* Create a new PDU and send the remaining set of requests to the agent. */
+   pdu = snmp_pdu_create(SNMP_MSG_GETBULK);
+   if (pdu == NULL) {
+      sv_setpv(*err_str_svp, "snmp_pdu_create(GETBULK) failed: ");
+      sv_catpv(*err_str_svp, strerror(errno));
+      sv_setiv(*err_num_svp, SNMPERR_MALLOC);
+      goto err;
+   }
+
+   /* Request non-repeater variables only in the first packet exchange. */
+   pdu->errstat  = (context->pkts_exch == 0) ? context->non_reps : 0;
+   pdu->errindex = context->max_reps;
+
+   for (i = 0; i < context->nreq_oids; i++) {
+      bt_entry = &context->req_oids[i];
+      if (bt_entry->ignore)
+	 continue;
+
+      assert(bt_entry->complete == 0);
+
+      if (!snmp_add_null_var(pdu, bt_entry->last_oid, bt_entry->last_len)) {
+	 sv_setpv(*err_str_svp, "snmp_add_null_var() failed");
+	 sv_setiv(*err_num_svp, SNMPERR_GENERR);
+	 sv_setiv(*err_ind_svp, i);
+	 goto err;
+      }
+
+      nvars ++;
+
+      DBPRT(1, (DBOUT "   Add %srepeater %s\n", bt_entry->norepeat ? "non" : "",
+	         snprint_objid(_debugx, sizeof(_debugx), bt_entry->last_oid, bt_entry->last_len)));
+   }
+
+   /* Make sure variables are actually being requested in the packet. */
+   assert (nvars != 0);
+
+   context->pkts_exch ++;
+
+   DBPRT(1, (DBOUT "Sending %ssynchronous request %d...\n",
+		     SvTRUE(context->perl_cb) ? "a" : "", context->pkts_exch));
+
+   /* We handle the asynchronous and synchronous requests differently here.
+   ** For async, we simply enqueue the packet with a callback to handle the
+   ** returned response, then return.  Note that this we call the bulkwalk
+   ** callback, and hand it the walk_context, not the Perl callback.  The
+   ** snmp_async_send() function returns the reqid on success, 0 on failure.
+   */
+   if (SvTRUE(context->perl_cb)) {
+      reqid = snmp_async_send(ss, pdu, _bulkwalk_async_cb, (void *)context);
+
+      DBPRT(2,( "bulkwalk_send_pdu(): snmp_async_send => 0x%08X\n", reqid));
+
+      if (reqid == 0) {
+	 sv_setpv(*err_str_svp, (char*)snmp_api_errstring(ss->s_snmp_errno));
+	 sv_setiv(*err_num_svp, ss->s_snmp_errno);
+	 goto err;
+      }
+
+      /* Make a note of the request we expect to be answered. */
+      context->exp_reqid = reqid;
+
+      /* Callbacks take care of the rest.  Let the caller know how many vars
+      ** we sent in this request.  Note that this is not a valid SNMP PDU,
+      ** but that's because a response has not yet been received.
+      */
+      return (netsnmp_pdu *)reqid;
+   }
+
+   /* This code is for synchronous mode support.
+   **
+   ** Send the PDU and block awaiting the response.  Return the response
+   ** packet back to the caller.  Note that snmp_sess_read() frees the pdu.
+   */
+   status = __send_sync_pdu(ss, pdu, &response, NO_RETRY_NOSUCH,
+				    *err_str_svp, *err_num_svp, *err_ind_svp);
+
+   pdu = NULL;
+
+   /* Check for a failed request.  __send_sync_pdu() will set the appropriate
+   ** values in the error string and number SV's.
+   */
+   if (status != STAT_SUCCESS) {
+      DBPRT(1,( "__send_sync_pdu() -> %d\n",(int)status));
+      goto err;
+   }
+
+   DBPRT(1, (DBOUT "%d packets exchanged, response 0x%p\n", context->pkts_exch,
+								    response));
+   return response;
+
+
+   err:
+   if (pdu)
+      snmp_free_pdu(pdu);
+   return NULL;
+}
+
+/* Handle an incoming GETBULK response PDU.  This function just pulls the
+** variables off of the PDU and builds up the arrays of returned values
+** that are stored in the context.
+**
+** Returns the number of variables found in this packet, or -1 on error.
+** Note that the caller is expected to free the pdu.
+*/
+static int
+_bulkwalk_recv_pdu(walk_context *context, netsnmp_pdu *pdu)
+{
+   netsnmp_variable_list *vars;
+   struct tree	*tp;
+   char		type_str[MAX_TYPE_NAME_LEN];
+   u_char	str_buf[STR_BUF_SIZE], *str_bufp = str_buf;
+   size_t str_buf_len = sizeof(str_buf);
+   size_t out_len = 0;
+   int buf_over = 0;
+   char		*label;
+   char		*iid;
+   bulktbl	*expect = NULL;
+   int		old_numeric;
+   int		old_printfull;
+   int		old_format;
+   int		getlabel_flag;
+   int		type;
+   int		pix;
+   int		len;
+   int		i;
+   AV		*varbind;
+   SV		*rv;
+   SV **sess_ptr_sv = hv_fetch((HV*)SvRV(context->sess_ref), "SessPtr", 7, 1);
+   SV **err_str_svp = hv_fetch((HV*)SvRV(context->sess_ref), "ErrorStr", 8, 1);
+   SV **err_num_svp = hv_fetch((HV*)SvRV(context->sess_ref), "ErrorNum", 8, 1);
+   SV **err_ind_svp = hv_fetch((HV*)SvRV(context->sess_ref), "ErrorInd", 8, 1);
+
+   DBPRT(3, (DBOUT "bulkwalk: sess_ref = 0x%p, sess_ptr_sv = 0x%p\n",
+             context->sess_ref, sess_ptr_sv));
+
+   /* Set up for numeric OID's, if necessary.  Save the old values
+   ** so that they can be restored when we finish -- these are
+   ** library-wide globals, and have to be set/restored for each
+   ** session.
+   */
+   old_numeric   = netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_PRINT_NUMERIC_OIDS);
+   old_printfull = netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_PRINT_FULL_OID);
+   old_format = netsnmp_ds_get_int(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_OID_OUTPUT_FORMAT);
+   if (context->getlabel_f & USE_NUMERIC_OIDS) {
+      DBPRT(2,( "Using numeric oid's\n"));
+      netsnmp_ds_set_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_PRINT_NUMERIC_OIDS, 1);
+      netsnmp_ds_set_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_PRINT_FULL_OID, 1);
+      netsnmp_ds_set_int(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_OID_OUTPUT_FORMAT, NETSNMP_OID_OUTPUT_NUMERIC);
+   }
+
+   /* Parse through the list of variables returned, adding each return to
+   ** the appropriate array (as a VarBind).  Also keep track of which
+   ** repeated OID we're expecting to see, and check if that tree walk has
+   ** been completed (i.e. we've walked past the root of our request).  If
+   ** so, mark the request complete so that we don't send it again in any
+   ** subsequent request packets.
+   */
+   if (context->pkts_exch == 1)
+      context->reqbase = context->req_oids;	/* Request with non-repeaters */
+   else
+      context->reqbase = context->repbase;	/* Request only repeater vars */
+
+   /* Note the first variable we expect to see.  Should be reqbase. */
+   expect = context->reqbase;
+
+   for (vars = pdu->variables, pix = 0;
+	vars != NULL;
+	vars = vars->next_variable, pix ++)
+   {
+
+      /* If no outstanding requests remain, we're done.  This works, but it
+      ** causes the reported total variable count to be wrong (since the
+      ** remaining vars on the last packet are not counted).  In practice
+      ** this is probably worth the win, but for debugging it's not.
+      */
+      if (context->req_remain == 0) {
+	 DBPRT(2,( "No outstanding requests remain.  Terminating processing.\n"));
+	 while (vars) {
+	    pix ++;
+	    vars = vars->next_variable;
+	 }
+	 break;
+      }
+
+      /* Determine which OID we expect to see next.  We assert that the OID's
+      ** must be returned in the expected order.  The first nreq_oids returns
+      ** should match the req_oids array, after that, we must cycle through
+      ** the repeaters in order.  Non-repeaters are not included in later
+      ** packets, so cannot have the "ignore" flag set.
+      */
+
+      if (context->oid_saved < context->non_reps) {
+	 assert(context->pkts_exch == 1);
+
+	 expect = context->reqbase ++;
+	 assert(expect->norepeat);
+
+      } else {
+	 /* Must be a repeater.  Look for the first one that is not being
+	 ** ignored.  Make sure we don't loop around to where we started.
+	 ** If we get here but everything is being ignored, there's a problem.
+	 **
+	 ** Note that we *do* accept completed but not ignored OID's -- these
+	 ** are OID's for trees that have been completed sometime in this
+	 ** response, but must be looked at to maintain ordering.
+	 */
+
+	 if (pix == 0) {
+	    /* Special case code for no non-repeater case.  This
+	    ** is necessary because expect normally points to the
+	    ** last non-repeater upon entry to this code (so the
+	    ** '++expect' below increments it into the repeaters
+	    ** section of the req_oids[] array).
+	    ** If there are no non-repeaters, the expect pointer
+	    ** is never initialized.  This addresses this problem.
+	    */
+	    expect = context->reqbase;
+
+	 } else {
+
+	    /* Find the repeater OID we expect to see.  Ignore any
+	    ** OID's marked 'ignore' -- these have been completed
+	    ** and were not requested in this iteration.
+	    */
+	    for (i = 0; i < context->repeaters; i++) {
+
+	       /* Loop around to first repeater if we hit the end. */
+	       if (++ expect == &context->req_oids[context->nreq_oids])
+		  expect = context->reqbase = context->repbase;
+
+	       /* Stop if this OID is not being ignored. */
+	       if (!expect->ignore)
+		  break;
+	    }
+
+	    /* Make sure we did find an expected OID. */
+	    assert(i <= context->repeaters);
+	 }
+      }
+
+      DBPRT(2, (DBOUT "Var %03d request %s\n", pix, snprint_objid(_debugx, sizeof(_debugx), 
+					     expect->req_oid, expect->req_len)));
+
+      /* Did we receive an error condition for this variable?
+      ** If it's a repeated variable, mark it as complete and
+      ** fall through to the block below.
+      */
+      if ((vars->type == SNMP_ENDOFMIBVIEW) ||
+	  (vars->type == SNMP_NOSUCHOBJECT) ||
+	  (vars->type == SNMP_NOSUCHINSTANCE))
+      {
+	 DBPRT(2,( "error type %d\n", (int)vars->type));
+
+	 /* ENDOFMIBVIEW should be okay for a repeater - just walked off the
+	 ** end of the tree.  Mark the request as complete, and go on to the
+	 ** next one.
+	 */
+	 if ((context->oid_saved >= context->non_reps) &&
+	     (vars->type == SNMP_ENDOFMIBVIEW))
+	 {
+	    expect->complete = 1;
+	    DBPRT(2, (DBOUT "Ran out of tree for oid %s\n",
+			   snprint_objid(_debugx, sizeof(_debugx), vars->name,vars->name_length)));
+
+	    context->req_remain --;
+
+	    /* Go on to the next variable. */
+	    continue;
+
+	 }
+	 sv_setpv(*err_str_svp,
+			      (char*)snmp_api_errstring(SNMPERR_UNKNOWN_OBJID));
+	 sv_setiv(*err_num_svp, SNMPERR_UNKNOWN_OBJID);
+	 sv_setiv(*err_ind_svp, pix);
+	 goto err;
+      }
+
+      /* If this is not the first packet, skip any duplicated OID values, if
+      ** present.  These should be the seed values copied from the last OID's
+      ** of the previous packet.  In practice we don't see this, but it is
+      ** easy enough to do, and will avoid confusion for the caller from mis-
+      ** behaving agents (badly misbehaving... ;^).
+      */
+      if ((context->pkts_exch > 1) && (pix < context->repeaters)) {
+	 if (__oid_cmp(vars->name, vars->name_length,
+				   context->reqbase[pix].last_oid,
+				   context->reqbase[pix].last_len) == 0)
+	 {
+	    DBPRT(2, (DBOUT "Ignoring repeat oid: %s\n",
+			snprint_objid(_debugx, sizeof(_debugx), vars->name,vars->name_length)));
+
+	    continue;
+	 }
+      }
+
+      context->oid_total ++;	/* Count each variable received. */
+
+      /* If this is a non-repeater, handle it.  Otherwise, if it is a
+      ** repeater, has the walk wandered off of the requested tree?  If so,
+      ** this request is complete, so mark it as such.  Ignore any other
+      ** variables in a completed request.  In order to maintain the correct
+      ** ordering of which variables we expect to see in this packet, we must
+      ** not set the ignore flags immediately.  It is done in bulkwalk_done().
+      ** XXX Can we use 'expect' instead of 'context->req_oids[pix]'?
+      */
+      if (context->oid_saved < context->non_reps) {
+	 DBPRT(2, (DBOUT "   expected var %s (nonrepeater %d/%d)\n",
+		     snprint_objid(_debugx, sizeof(_debugx), context->req_oids[pix].req_oid,
+					   context->req_oids[pix].req_len),
+		     pix, context->non_reps));
+	 DBPRT(2, (DBOUT "   received var %s\n",
+		     snprint_objid(_debugx, sizeof(_debugx), vars->name, vars->name_length)));
+
+	 /* This non-repeater has now been seen, so mark the sub-tree as
+	 ** completed.  Note that this may not be the same oid as requested,
+	 ** since non-repeaters act like GETNEXT requests, not GET's. <sigh>
+	 */
+	 context->req_oids[pix].complete = 1;
+	 context->req_remain --;
+
+      } else {		/* Must be a repeater variable. */
+
+	 DBPRT(2, (DBOUT "   received oid %s\n",
+	       snprint_objid(_debugx, sizeof(_debugx), vars->name, vars->name_length)));
+
+	 /* Are we already done with this tree?  If so, just ignore this
+	 ** variable and move on to the next expected variable.
+	 */
+	 if (expect->complete) {
+	    DBPRT(2,( "      this branch is complete - ignoring.\n"));
+	    continue;
+	 }
+
+	 /* If the base oid of this variable doesn't match the expected oid,
+	 ** assume that we've walked past the end of the subtree.  Set this
+	 ** subtree to be completed, and go on to the next variable.
+	 */
+	 if ((vars->name_length < expect->req_len) ||
+	     (memcmp(vars->name, expect->req_oid, expect->req_len*sizeof(oid))))
+	 {
+	    DBPRT(2,( "      walked off branch - marking subtree as complete.\n"));
+	    expect->complete = 1;
+	    context->req_remain --;
+	    continue;
+	 }
+
+	 /* Still interested in the tree -- we need to keep track of the
+	 ** last-seen value in case we need to send an additional request
+	 ** packet.
+	 */
+	 (void)memcpy(expect->last_oid, vars->name,
+					     vars->name_length * sizeof(oid));
+	 expect->last_len = vars->name_length;
+
+      }
+
+      /* Create a new Varbind and populate it with the parsed information
+      ** returned by the agent.  This Varbind is then pushed onto the arrays
+      ** maintained for each request OID in the context.  These varbinds are
+      ** collected into a return array by bulkwalk_finish().
+      */
+      varbind = (AV*) newAV();
+      if (varbind == NULL) {
+	 sv_setpv(*err_str_svp, "newAV() failed: ");
+	 sv_catpv(*err_str_svp, (char*)strerror(errno));
+	 sv_setiv(*err_num_svp, SNMPERR_MALLOC);
+	 goto err;
+      }
+
+      *str_buf = '.';
+      *(str_buf+1) = '\0';
+      out_len = 0;
+      tp = netsnmp_sprint_realloc_objid_tree(&str_bufp, &str_buf_len,
+                                             &out_len, 0, &buf_over,
+                                             vars->name,vars->name_length);
+      str_buf[sizeof(str_buf)-1] = '\0';
+
+      getlabel_flag = context->getlabel_f;
+
+      if (__is_leaf(tp)) {
+	 type = tp->type;
+      } else {
+	 getlabel_flag |= NON_LEAF_NAME;
+	 type = __translate_asn_type(vars->type);
+      }
+      if (__get_label_iid(str_buf, &label, &iid, getlabel_flag) == FAILURE) {
+          label = str_buf;
+          iid = label + strlen(label);
+      }
+
+      DBPRT(2,( "       save var %s.%s = ", label, iid));
+
+      av_store(varbind, VARBIND_TAG_F, newSVpv(label, strlen(label)));
+      av_store(varbind, VARBIND_IID_F, newSVpv(iid, strlen(iid)));
+
+      __get_type_str(type, type_str);
+      av_store(varbind, VARBIND_TYPE_F, newSVpv(type_str, strlen(type_str)));
+
+      len=__snprint_value(str_buf, sizeof(str_buf),
+                         vars, tp, type, context->sprintval_f);
+      av_store(varbind, VARBIND_VAL_F, newSVpv((char*)str_buf, len));
+
+      str_buf[len] = '\0';
+      DBPRT(3,( "'%s' (%s)\n", str_buf, type_str));
+
+#if 0
+    /* huh? */
+      /* If necessary, store a timestamp as the semi-documented 5th element. */
+      if (sv_timestamp)
+	  av_store(varbind, VARBIND_TIME_F, SvREFCNT_inc(sv_timestamp));
+#endif
+
+      /* Push ref to the varbind onto the list of vars for OID. */
+      rv = newRV_noinc((SV *)varbind);
+      sv_bless(rv, gv_stashpv("SNMP::Varbind", 0));
+      av_push(expect->vars, rv);
+
+      context->oid_saved ++;	/* Count this as a saved variable. */
+
+   } /* next variable in response packet */
+
+   DBPRT(1, (DBOUT "-- pkt %d saw %d vars, total %d (%d saved)\n", context->pkts_exch,
+			   pix, context->oid_total, context->oid_saved));
+
+   /* We assert that all non-repeaters must be returned in
+   ** the initial response (they are not repeated in additional
+   ** packets, so would be dropped).  If nonrepeaters still
+   ** exist, consider it a fatal error.
+   */
+   if ((context->pkts_exch == 1) && (context->oid_saved < context->non_reps)) {
+      /* Re-use space from the value string for error message. */
+      sprintf(str_buf, "%d non-repeaters went unanswered", context->non_reps);
+      sv_setpv(*err_str_svp, str_buf);
+      sv_setiv(*err_num_svp, SNMPERR_GENERR);
+      sv_setiv(*err_num_svp, context->oid_saved);
+      goto err;
+   }
+
+   /* Reset the library's behavior for numeric/symbolic OID's. */
+   if (context->getlabel_f & USE_NUMERIC_OIDS) {
+      netsnmp_ds_set_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_PRINT_NUMERIC_OIDS, old_numeric);
+      netsnmp_ds_set_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_PRINT_FULL_OID, old_printfull);
+      netsnmp_ds_set_int(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_OID_OUTPUT_FORMAT, old_format);
+   }
+
+   return pix;
+
+   err:
+   if (pdu)
+      snmp_free_pdu(pdu);
+   return -1;
+
+}
+
+/* Once the bulkwalk has completed, extend the stack and push references to
+** each of the arrays of SNMP::Varbind's onto the stack.  Return the number
+** of arrays pushed on the stack.  The caller should return to Perl, or call
+** the Perl callback function.
+**
+** Note that this function free()'s the walk_context and request bulktbl's.
+*/
+static int
+_bulkwalk_finish(walk_context *context, int okay)
+{
+   int		npushed = 0;
+   int		i;
+   int		async = 0;
+   bulktbl	*bt_entry;
+   AV		*ary = NULL;
+   SV		*rv;
+   SV		*perl_cb;
+
+   SV **err_str_svp = hv_fetch((HV*)SvRV(context->sess_ref), "ErrorStr", 8, 1);
+   SV **err_num_svp = hv_fetch((HV*)SvRV(context->sess_ref), "ErrorNum", 8, 1);
+
+   dXSARGS;
+
+   async = SvTRUE(context->perl_cb);
+
+   /* Successfully completed the bulkwalk.  For synchronous calls, push each
+   ** of the request value arrays onto the stack, and return the number of
+   ** items pushed onto the stack.  For async, create a new array and push
+   ** the references onto it.  The array is then passed to the Perl callback.
+   */
+   if (!async)
+      SP -= items;
+
+   DBPRT(1, (DBOUT "Bulwalk %s (saved %d/%d), ", okay ? "completed" : "had error",
+					context->oid_saved, context->oid_total));
+
+   if (okay) {
+       DBPRT(1, (DBOUT "%s %d varbind refs %s\n",
+				async ? "pass ref to array of" : "return",
+				context->nreq_oids,
+				async ? "to callback" : "on stack to caller"));
+
+       /* Create the array to hold the responses for the asynchronous callback,
+       ** or pre-extend the stack enough to hold responses for synch return.
+       */
+       if (async) {
+	   ary = (AV *)newAV();
+	  if (ary == NULL) {
+	     sv_setpv(*err_str_svp, "newAV(): ");
+	     sv_catpv(*err_str_svp, (char *)strerror(errno));
+	     sv_setiv(*err_num_svp, errno);
+	  }
+
+	  /* NULL ary pointer is okay -- we'll handle it below... */
+
+       } else {
+	   EXTEND(sp, context->nreq_oids);
+
+       }
+
+       /* Push a reference to each array of varbinds onto the stack, in
+       ** the order requested.  Note that these arrays may be empty.
+       */
+       for (i = 0; i < context->nreq_oids; i++) {
+	  bt_entry = &context->req_oids[i];
+
+	  DBPRT(2, (DBOUT "  %sreq #%d (%s) => %d var%s\n",
+		 bt_entry->complete ? "" : "incomplete ", i,
+		 snprint_objid(_debugx, sizeof(_debugx), bt_entry->req_oid, bt_entry->req_len),
+		 (int)av_len(bt_entry->vars) + 1,
+		 (int)av_len(bt_entry->vars) > 0 ? "s" : ""));
+
+	  if (async && ary == NULL) {
+	     DBPRT(2,( "    [dropped due to newAV() failure]\n"));
+	     continue;
+	  }
+
+	  /* Get a reference to the varlist, and push it onto array or stack */
+	  rv = newRV_noinc((SV *)bt_entry->vars);
+	  sv_bless(rv, gv_stashpv("SNMP::VarList",0));
+
+	  if (async)
+	     av_push(ary, rv);
+	  else
+	     PUSHs(sv_2mortal((SV *)rv));
+
+	  npushed ++;
+       }
+
+   } else {	/* Not okay -- push a single undef on the stack if not async */
+
+      if (!async) {
+	 XPUSHs(&sv_undef);
+	 npushed = 1;
+      }
+   }
+
+   /* XXX Future enhancement -- make statistics (pkts exchanged, vars
+   ** saved vs. received, total time, etc) available to caller so they
+   ** can adjust their request parameters and/or re-order requests.
+   */
+
+   PUTBACK;
+
+   if (async) {
+       /* Asynchronous callback.  Push the caller's arglist onto the stack,
+       ** and follow it with the contents of the array (or undef if newAV()
+       ** failed or the session had an error).  Then mortalize the Perl
+       ** callback pointer, and call the callback.
+       */
+       if (!okay || ary == NULL)
+          rv = &sv_undef;
+       else
+	  rv = newRV_noinc((SV *)ary);
+
+       sv_2mortal(perl_cb = context->perl_cb);
+       perl_cb = __push_cb_args(perl_cb, (SvTRUE(rv) ? sv_2mortal(rv) : rv));
+
+       __call_callback(perl_cb, G_DISCARD);
+   }
+   sv_2mortal(context->sess_ref);
+
+   /* Free the allocated space for the request states and return number of
+   ** variables found.  Remove the context from the valid context list.
+   */
+   _context_del(context);
+   DBPRT(2,( "Free() context->req_oids\n"));
+   Safefree(context->req_oids);
+   DBPRT(2,( "Free() context 0x%p\n", context));
+   Safefree(context);
+   return npushed;
+}
+
+/* End of bulkwalk support routines */
+
+static char *
+__av_elem_pv(AV *av, I32 key, char *dflt)
+{
+   SV **elem = av_fetch(av, key, 0);
+
+   return (elem && SvOK(*elem)) ? SvPV(*elem, na) : dflt;
+}
+
+static int
+not_here(s)
+char *s;
+{
+    croak("%s not implemented on this architecture", s);
+    return -1;
+}
+
+static double
+constant(name, arg)
+char *name;
+int arg;
+{
+    errno = 0;
+    switch (*name) {
+    case 'R':
+	if (strEQ(name, "NETSNMP_CALLBACK_OP_RECEIVED_MESSAGE"))
+#ifdef NETSNMP_CALLBACK_OP_RECEIVED_MESSAGE
+	    return NETSNMP_CALLBACK_OP_RECEIVED_MESSAGE;
+#else
+	    goto not_there;
+#endif
+	break;
+    case 'S':
+	if (strEQ(name, "SNMPERR_BAD_ADDRESS"))
+#ifdef SNMPERR_BAD_ADDRESS
+	    return SNMPERR_BAD_ADDRESS;
+#else
+	    goto not_there;
+#endif
+	if (strEQ(name, "SNMPERR_BAD_LOCPORT"))
+#ifdef SNMPERR_BAD_LOCPORT
+	    return SNMPERR_BAD_LOCPORT;
+#else
+	    goto not_there;
+#endif
+	if (strEQ(name, "SNMPERR_BAD_SESSION"))
+#ifdef SNMPERR_BAD_SESSION
+	    return SNMPERR_BAD_SESSION;
+#else
+	    goto not_there;
+#endif
+	if (strEQ(name, "SNMPERR_GENERR"))
+#ifdef SNMPERR_GENERR
+	    return SNMPERR_GENERR;
+#else
+	    goto not_there;
+#endif
+	if (strEQ(name, "SNMPERR_TOO_LONG"))
+#ifdef SNMPERR_TOO_LONG
+	    return SNMPERR_TOO_LONG;
+#else
+	    goto not_there;
+#endif
+	if (strEQ(name, "SNMP_DEFAULT_ADDRESS"))
+#ifdef SNMP_DEFAULT_ADDRESS
+	    return SNMP_DEFAULT_ADDRESS;
+#else
+	    goto not_there;
+#endif
+	if (strEQ(name, "SNMP_DEFAULT_COMMUNITY_LEN"))
+#ifdef SNMP_DEFAULT_COMMUNITY_LEN
+	    return SNMP_DEFAULT_COMMUNITY_LEN;
+#else
+	    goto not_there;
+#endif
+	if (strEQ(name, "SNMP_DEFAULT_ENTERPRISE_LENGTH"))
+#ifdef SNMP_DEFAULT_ENTERPRISE_LENGTH
+	    return SNMP_DEFAULT_ENTERPRISE_LENGTH;
+#else
+	    goto not_there;
+#endif
+	if (strEQ(name, "SNMP_DEFAULT_ERRINDEX"))
+#ifdef SNMP_DEFAULT_ERRINDEX
+	    return SNMP_DEFAULT_ERRINDEX;
+#else
+	    goto not_there;
+#endif
+	if (strEQ(name, "SNMP_DEFAULT_ERRSTAT"))
+#ifdef SNMP_DEFAULT_ERRSTAT
+	    return SNMP_DEFAULT_ERRSTAT;
+#else
+	    goto not_there;
+#endif
+	if (strEQ(name, "SNMP_DEFAULT_PEERNAME"))
+#ifdef SNMP_DEFAULT_PEERNAME
+	    return 0;
+#else
+	    goto not_there;
+#endif
+	if (strEQ(name, "SNMP_DEFAULT_REMPORT"))
+#ifdef SNMP_DEFAULT_REMPORT
+	    return SNMP_DEFAULT_REMPORT;
+#else
+	    goto not_there;
+#endif
+	if (strEQ(name, "SNMP_DEFAULT_REQID"))
+#ifdef SNMP_DEFAULT_REQID
+	    return SNMP_DEFAULT_REQID;
+#else
+	    goto not_there;
+#endif
+	if (strEQ(name, "SNMP_DEFAULT_RETRIES"))
+#ifdef SNMP_DEFAULT_RETRIES
+	    return SNMP_DEFAULT_RETRIES;
+#else
+	    goto not_there;
+#endif
+	if (strEQ(name, "SNMP_DEFAULT_TIME"))
+#ifdef SNMP_DEFAULT_TIME
+	    return SNMP_DEFAULT_TIME;
+#else
+	    goto not_there;
+#endif
+	if (strEQ(name, "SNMP_DEFAULT_TIMEOUT"))
+#ifdef SNMP_DEFAULT_TIMEOUT
+	    return SNMP_DEFAULT_TIMEOUT;
+#else
+	    goto not_there;
+#endif
+	if (strEQ(name, "SNMP_DEFAULT_VERSION"))
+#ifdef DEFAULT_SNMP_VERSION
+	    return DEFAULT_SNMP_VERSION;
+#else
+#ifdef SNMP_DEFAULT_VERSION
+	    return SNMP_DEFAULT_VERSION;
+#else
+	    goto not_there;
+#endif
+#endif
+	break;
+    case 'T':
+	if (strEQ(name, "NETSNMP_CALLBACK_OP_TIMED_OUT"))
+#ifdef NETSNMP_CALLBACK_OP_TIMED_OUT
+	    return NETSNMP_CALLBACK_OP_TIMED_OUT;
+#else
+	    goto not_there;
+#endif
+	break;
+    default:
+	break;
+    }
+    errno = EINVAL;
+    return 0;
+
+#ifndef NETSNMP_CALLBACK_OP_TIMED_OUT
+not_there:
+#endif
+    errno = ENOENT;
+    return 0;
+}
+
+
+MODULE = SNMP		PACKAGE = SNMP		PREFIX = snmp
+
+BOOT:
+# first blank line terminates bootstrap code
+    Mib = 0;
+
+
+double
+constant(name,arg)
+	char *		name
+	int		arg
+
+long
+snmp_sys_uptime()
+	CODE:
+	RETVAL = get_uptime();
+	OUTPUT:
+	RETVAL
+
+void
+init_snmp(appname)
+        char *appname
+    CODE:
+        __libraries_init(appname);
+
+
+SnmpSession *
+snmp_new_session(version, community, peer, lport, retries, timeout)
+        char *	version
+        char *	community
+        char *	peer
+        int	lport
+        int	retries
+        int	timeout
+	CODE:
+	{
+	   SnmpSession session = {0};
+	   SnmpSession *ss = NULL;
+           int verbose = SvIV(perl_get_sv("SNMP::verbose", 0x01 | 0x04));
+
+           __libraries_init("perl");
+           
+	   if (!strcmp(version, "1")) {
+		session.version = SNMP_VERSION_1;
+           } else if ((!strcmp(version, "2")) || (!strcmp(version, "2c"))) {
+		session.version = SNMP_VERSION_2c;
+           } else if (!strcmp(version, "3")) {
+	        session.version = SNMP_VERSION_3;
+	   } else {
+		if (verbose)
+                   warn("error:snmp_new_session:Unsupported SNMP version (%s)\n", version);
+                goto end;
+	   }
+
+           session.community_len = strlen((char *)community);
+           session.community = (u_char *)community;
+	   session.peername = peer;
+	   session.local_port = lport;
+           session.retries = retries; /* 5 */
+           session.timeout = timeout; /* 1000000L */
+           session.authenticator = NULL;
+
+           ss = snmp_open(&session);
+
+           if (ss == NULL) {
+	      if (verbose) warn("error:snmp_new_session: Couldn't open SNMP session");
+           }
+        end:
+           RETVAL = ss;
+	}
+        OUTPUT:
+        RETVAL
+
+SnmpSession *
+snmp_new_v3_session(version, peer, retries, timeout, sec_name, sec_level, sec_eng_id, context_eng_id, context, auth_proto, auth_pass, priv_proto, priv_pass, eng_boots, eng_time)
+        int	version
+        char *	peer
+        int	retries
+        int	timeout
+        char *  sec_name
+        int     sec_level
+        char *  sec_eng_id
+        char *  context_eng_id
+        char *  context
+        char *  auth_proto
+        char *  auth_pass
+        char *  priv_proto
+        char *  priv_pass
+	int     eng_boots
+	int     eng_time
+	CODE:
+	{
+/*             u_char sec_eng_id_buf[ENG_ID_BUF_SIZE]; */
+/*             u_char context_eng_id_buf[ENG_ID_BUF_SIZE]; */
+	   SnmpSession session = {0};
+	   SnmpSession *ss = NULL;
+           int verbose = SvIV(perl_get_sv("SNMP::verbose", 0x01 | 0x04));
+
+           __libraries_init("perl");
+
+	   if (version == 3) {
+		session.version = SNMP_VERSION_3;
+           } else {
+		if (verbose)
+                   warn("error:snmp_new_v3_session:Unsupported SNMP version (%d)\n", version);
+                goto end;
+	   }
+
+	   session.peername = strdup(peer);
+           session.retries = retries; /* 5 */
+           session.timeout = timeout; /* 1000000L */
+           session.authenticator = NULL;
+           session.contextNameLen = strlen(context);
+           session.contextName = context;
+           session.securityNameLen = strlen(sec_name);
+           session.securityName = sec_name;
+           session.securityLevel = sec_level;
+           session.securityModel = USM_SEC_MODEL_NUMBER;
+           /* session.securityEngineID = sec_eng_id_buf;*/
+           session.securityEngineIDLen =
+              hex_to_binary2(sec_eng_id, strlen(sec_eng_id),
+                             (char **) &session.securityEngineID);
+           /* session.contextEngineID = context_eng_id_buf; */
+           session.contextEngineIDLen =
+              hex_to_binary2(sec_eng_id, strlen(sec_eng_id),
+                             (char **) &session.contextEngineID);
+           session.engineBoots = eng_boots;
+           session.engineTime = eng_time;
+           if (!strcmp(auth_proto, "MD5")) {
+               session.securityAuthProto = 
+                  snmp_duplicate_objid(usmHMACMD5AuthProtocol,
+                                          USM_AUTH_PROTO_MD5_LEN);
+              session.securityAuthProtoLen = USM_AUTH_PROTO_MD5_LEN;
+           } else if (!strcmp(auth_proto, "SHA")) {
+               session.securityAuthProto = 
+                   snmp_duplicate_objid(usmHMACSHA1AuthProtocol,
+                                        USM_AUTH_PROTO_SHA_LEN);
+              session.securityAuthProtoLen = USM_AUTH_PROTO_SHA_LEN;
+           } else {
+              if (verbose)
+                 warn("error:snmp_new_v3_session:Unsupported authentication protocol(%s)\n", auth_proto);
+              goto end;
+           }
+           if (session.securityLevel >= SNMP_SEC_LEVEL_AUTHNOPRIV) {
+              session.securityAuthKeyLen = USM_AUTH_KU_LEN;
+              if (generate_Ku(session.securityAuthProto,
+                              session.securityAuthProtoLen,
+                              (u_char *)auth_pass, strlen(auth_pass),
+                              session.securityAuthKey,
+                              &session.securityAuthKeyLen) != SNMPERR_SUCCESS) {
+                 if (verbose)
+                    warn("error:snmp_new_v3_session:Error generating Ku from authentication password.\n");
+                 goto end;
+              }
+           }
+           if (!strcmp(priv_proto, "DES")) {
+              session.securityPrivProto =
+                  snmp_duplicate_objid(usmDESPrivProtocol,
+                                       USM_PRIV_PROTO_DES_LEN);
+              session.securityPrivProtoLen = USM_PRIV_PROTO_DES_LEN;
+           } else {
+              if (verbose)
+                 warn("error:snmp_new_v3_session:Unsupported privacy protocol(%s)\n", priv_proto);
+              goto end;
+           }
+           if (session.securityLevel >= SNMP_SEC_LEVEL_AUTHPRIV) {
+             session.securityPrivKeyLen = USM_PRIV_KU_LEN;
+              if (generate_Ku(session.securityAuthProto,
+                              session.securityAuthProtoLen,
+                              (u_char *)priv_pass, strlen(priv_pass),
+                              session.securityPrivKey,
+                              &session.securityPrivKeyLen) != SNMPERR_SUCCESS) {
+                 if (verbose)
+                    warn("error:snmp_new_v3_session:Error generating Ku from privacy pass phrase.\n");
+                 goto end;
+               }
+            }
+
+           ss = snmp_open(&session);
+
+           if (ss == NULL) {
+	      if (verbose) warn("error:snmp_new_v3_session:Couldn't open SNMP session");
+           }
+        end:
+           RETVAL = ss;
+	   free (session.contextEngineID);
+	}
+        OUTPUT:
+        RETVAL
+
+
+SnmpSession *
+snmp_update_session(sess_ref, version, community, peer, lport, retries, timeout)
+        SV *	sess_ref
+        char *	version
+        char *	community
+        char *	peer
+        int	lport
+        int	retries
+        int	timeout
+	CODE:
+	{
+           SV **sess_ptr_sv;
+	   SnmpSession *ss;
+           int verbose = SvIV(perl_get_sv("SNMP::verbose", 0x01 | 0x04));
+
+           sess_ptr_sv = hv_fetch((HV*)SvRV(sess_ref), "SessPtr", 7, 1);
+           ss = (SnmpSession *)SvIV((SV*)SvRV(*sess_ptr_sv));
+
+           if (!ss) goto update_end;
+
+           if (!strcmp(version, "1")) {
+		ss->version = SNMP_VERSION_1;
+           } else if (!strcmp(version, "2") || !strcmp(version, "2c")) {
+		ss->version = SNMP_VERSION_2c;
+	   } else if (!strcmp(version, "3")) {
+	        ss->version = SNMP_VERSION_3;
+	   } else {
+		if (verbose)
+                   warn("Unsupported SNMP version (%s)\n", version);
+                goto update_end;
+	   }
+           /* WARNING LEAKAGE but I cant free lib memory under win32 */
+           ss->community_len = strlen((char *)community);
+           ss->community = (u_char *)strdup(community);
+	   ss->peername = strdup(peer);
+	   ss->local_port = lport;
+           ss->retries = retries; /* 5 */
+           ss->timeout = timeout; /* 1000000L */
+           ss->authenticator = NULL;
+
+    update_end:
+	   RETVAL = ss;
+        }
+        OUTPUT:
+           RETVAL
+
+int
+snmp_add_mib_dir(mib_dir,force=0)
+	char *		mib_dir
+	int		force
+	CODE:
+        {
+	int result = 0;      /* Avoid use of uninitialized variable below. */
+        int verbose = SvIV(perl_get_sv("SNMP::verbose", 0x01 | 0x04));
+
+        if (mib_dir && *mib_dir) {
+	   result = add_mibdir(mib_dir);
+        }
+        if (result) {
+           if (verbose) warn("Added mib dir %s\n", mib_dir);
+        } else {
+           if (verbose) warn("Failed to add %s\n", mib_dir);
+        }
+        RETVAL = (I32)result;
+        }
+        OUTPUT:
+        RETVAL
+
+void
+snmp_init_mib_internals()
+	CODE:
+        {
+        int verbose = SvIV(perl_get_sv("SNMP::verbose", 0x01 | 0x04));
+
+        /* should test better to see if it has been done already */
+	if (Mib == NULL) {
+           if (verbose) warn("initializing MIB internals (empty)\n");
+           /* init_mib_internals(); */
+        }
+        }
+
+
+int
+snmp_read_mib(mib_file, force=0)
+	char *		mib_file
+	int		force
+	CODE:
+        {
+        int verbose = SvIV(perl_get_sv("SNMP::verbose", 0x01 | 0x04));
+
+        /* if (Mib && force) __free_tree(Mib); needs more work to cleanup */
+
+        if ((mib_file == NULL) || (*mib_file == '\0')) {
+           if (Mib == NULL) {
+              if (verbose) warn("initializing MIB\n");
+              /* init_mib_internals(); */
+              init_mib();
+              if (Mib) {
+                 if (verbose) warn("done\n");
+              } else {
+                 if (verbose) warn("failed\n");
+              }
+	   }
+        } else {
+           if (verbose) warn("reading MIB: %s [%s:%s]\n", mib_file, DEFAULT_MIBDIRS, DEFAULT_MIBS);
+           /* if (Mib == NULL) init_mib_internals();*/
+           if (strcmp("ALL",mib_file))
+              read_mib(mib_file);
+           else
+             read_all_mibs();
+           if (Mib) {
+              if (verbose) warn("done\n");
+           } else {
+              if (verbose) warn("failed\n");
+           }
+        }
+        RETVAL = (I32)Mib;
+        }
+        OUTPUT:
+        RETVAL
+
+
+int
+snmp_read_module(module)
+	char *		module
+	CODE:
+        {
+        int verbose = SvIV(perl_get_sv("SNMP::verbose", 0x01 | 0x04));
+
+        if (!strcmp(module,"ALL")) {
+           read_all_mibs();
+        } else {
+           read_module(module);
+        }
+        if (Mib) {
+           if (verbose) warn("Read %s\n", module);
+        } else {
+           if (verbose) warn("Failed reading %s\n", module);
+        }
+        RETVAL = (I32)Mib;
+        }
+        OUTPUT:
+        RETVAL
+
+
+int
+snmp_set(sess_ref, varlist_ref, perl_callback)
+        SV *	sess_ref
+        SV *	varlist_ref
+        SV *	perl_callback
+	PPCODE:
+	{
+           AV *varlist;
+           SV **varbind_ref;
+           SV **varbind_val_f;
+           AV *varbind;
+	   I32 varlist_len;
+	   I32 varlist_ind;
+           SnmpSession *ss;
+           netsnmp_pdu *pdu, *response;
+           struct tree *tp;
+	   oid *oid_arr;
+	   int oid_arr_len = MAX_OID_LEN;
+           char *tag_pv;
+           snmp_xs_cb_data *xs_cb_data;
+           SV **sess_ptr_sv;
+           SV **err_str_svp;
+           SV **err_num_svp;
+           SV **err_ind_svp;
+           int status = 0;
+           int type;
+	   int res;
+           int verbose = SvIV(perl_get_sv("SNMP::verbose", 0x01 | 0x04));
+           int use_enums;
+           struct enum_list *ep;
+
+           New (0, oid_arr, MAX_OID_LEN, oid);
+
+           if (oid_arr && SvROK(sess_ref) && SvROK(varlist_ref)) {
+
+	      use_enums = SvIV(*hv_fetch((HV*)SvRV(sess_ref),"UseEnums",8,1));
+              sess_ptr_sv = hv_fetch((HV*)SvRV(sess_ref), "SessPtr", 7, 1);
+	      ss = (SnmpSession *)SvIV((SV*)SvRV(*sess_ptr_sv));
+              err_str_svp = hv_fetch((HV*)SvRV(sess_ref), "ErrorStr", 8, 1);
+              err_num_svp = hv_fetch((HV*)SvRV(sess_ref), "ErrorNum", 8, 1);
+              err_ind_svp = hv_fetch((HV*)SvRV(sess_ref), "ErrorInd", 8, 1);
+              sv_setpv(*err_str_svp, "");
+              sv_setiv(*err_num_svp, 0);
+              sv_setiv(*err_ind_svp, 0);
+
+              pdu = snmp_pdu_create(SNMP_MSG_SET);
+
+              varlist = (AV*) SvRV(varlist_ref);
+              varlist_len = av_len(varlist);
+	      for(varlist_ind = 0; varlist_ind <= varlist_len; varlist_ind++) {
+                 varbind_ref = av_fetch(varlist, varlist_ind, 0);
+                 if (SvROK(*varbind_ref)) {
+                    varbind = (AV*) SvRV(*varbind_ref);
+                    tag_pv = __av_elem_pv(varbind, VARBIND_TAG_F,NULL);
+                    tp=__tag2oid(tag_pv,
+                                 __av_elem_pv(varbind, VARBIND_IID_F,NULL),
+                                 oid_arr, &oid_arr_len, &type,0);
+
+                    if (oid_arr_len==0) {
+                       if (verbose)
+                          warn("error: set: unknown object ID (%s)",
+                                (tag_pv?tag_pv:"<null>"));
+	               sv_catpv(*err_str_svp,
+                               (char*)snmp_api_errstring(SNMPERR_UNKNOWN_OBJID));
+                       sv_setiv(*err_num_svp, SNMPERR_UNKNOWN_OBJID);
+                       XPUSHs(&sv_undef); /* unknown OID */
+		       snmp_free_pdu(pdu);
+		       goto done;
+		    }
+
+
+                    if (type == TYPE_UNKNOWN) {
+                      type = __translate_appl_type(
+                                __av_elem_pv(varbind, VARBIND_TYPE_F, NULL));
+                      if (type == TYPE_UNKNOWN) {
+                         if (verbose)
+                            warn("error: set: no type found for object");
+	                 sv_catpv(*err_str_svp,
+                                  (char*)snmp_api_errstring(SNMPERR_VAR_TYPE));
+                         sv_setiv(*err_num_svp, SNMPERR_VAR_TYPE);
+                         XPUSHs(&sv_undef); /* unknown OID */
+		         snmp_free_pdu(pdu);
+		         goto done;
+                      }
+                    }
+
+	            varbind_val_f = av_fetch(varbind, VARBIND_VAL_F, 0);
+
+                    if (type==TYPE_INTEGER && use_enums && tp && tp->enums) {
+                      for(ep = tp->enums; ep; ep = ep->next) {
+                        if (varbind_val_f && SvOK(*varbind_val_f) &&
+                            !strcmp(ep->label, SvPV(*varbind_val_f,na))) {
+                          sv_setiv(*varbind_val_f, ep->value);
+                          break;
+                        }
+                      }
+                    }
+
+                    res = __add_var_val_str(pdu, oid_arr, oid_arr_len,
+				     (varbind_val_f && SvOK(*varbind_val_f) ?
+				      SvPV(*varbind_val_f,na):NULL),
+				      (varbind_val_f && SvOK(*varbind_val_f) ?
+				       SvCUR(*varbind_val_f):0), type);
+
+		    if (verbose && res == FAILURE)
+		      warn("error: adding variable/value to PDU");
+                 } /* if var_ref is ok */
+              } /* for all the vars */
+
+              if (SvTRUE(perl_callback)) {
+                  xs_cb_data =
+                      (snmp_xs_cb_data*)malloc(sizeof(snmp_xs_cb_data));
+                 xs_cb_data->perl_cb = newSVsv(perl_callback);
+                 xs_cb_data->sess_ref = newRV_inc(SvRV(sess_ref));
+
+                 status = snmp_async_send(ss, pdu, __snmp_xs_cb,
+                                          (void*)xs_cb_data);
+                 if (status != 0) {
+                    XPUSHs(sv_2mortal(newSViv(status))); /* push the reqid?? */
+                 } else {
+                    snmp_free_pdu(pdu);
+                    sv_catpv(*err_str_svp,
+                             (char*)snmp_api_errstring(ss->s_snmp_errno));
+                    sv_setiv(*err_num_svp, ss->s_snmp_errno);
+                    XPUSHs(&sv_undef);
+                 }
+		 goto done;
+              }
+
+	      status = __send_sync_pdu(ss, pdu, &response,
+				       NO_RETRY_NOSUCH,
+                                       *err_str_svp, *err_num_svp,
+                                       *err_ind_svp);
+
+              if (response) snmp_free_pdu(response);
+
+              if (status) {
+		 XPUSHs(&sv_undef);
+	      } else {
+                 XPUSHs(sv_2mortal(newSVpv(ZERO_BUT_TRUE,0)));
+              }
+           } else {
+
+              /* BUG!!! need to return an error value */
+              XPUSHs(&sv_undef); /* no mem or bad args */
+           }
+done:
+           Safefree(oid_arr);
+        }
+
+void
+snmp_catch(sess_ref, perl_callback)
+	SV *	sess_ref
+        SV *    perl_callback
+	PPCODE:
+	{
+	   netsnmp_session *ss;
+           SV **sess_ptr_sv;
+           SV **err_str_svp;
+           SV **err_num_svp;
+           SV **err_ind_svp;
+
+           if (SvROK(sess_ref)) {
+              sess_ptr_sv = hv_fetch((HV*)SvRV(sess_ref), "SessPtr", 7, 1);
+	      ss = (SnmpSession *)SvIV((SV*)SvRV(*sess_ptr_sv));
+              err_str_svp = hv_fetch((HV*)SvRV(sess_ref), "ErrorStr", 8, 1);
+              err_num_svp = hv_fetch((HV*)SvRV(sess_ref), "ErrorNum", 8, 1);
+              err_ind_svp = hv_fetch((HV*)SvRV(sess_ref), "ErrorInd", 8, 1);
+              sv_setpv(*err_str_svp, "");
+              sv_setiv(*err_num_svp, 0);
+              sv_setiv(*err_ind_svp, 0);
+
+              snmp_synch_reset(ss);
+              ss->callback = NULL;
+              ss->callback_magic = NULL;
+
+              if (SvTRUE(perl_callback)) {
+                 perl_callback = newSVsv(perl_callback);
+                 # it might be more efficient to pass the varbind_ref to
+                 # __snmp_xs_cb as part of perl_callback so it is not freed
+                 # and reconstructed for each call
+                 ss->callback = __callback_wrapper;
+                 ss->callback_magic = perl_callback;
+                 sv_2mortal(newSViv(1));
+                 goto done;
+              }
+           }
+           sv_2mortal(newSViv(0));
+        done:
+           ;
+        }
+
+void
+snmp_get(sess_ref, retry_nosuch, varlist_ref, perl_callback)
+        SV *    sess_ref
+        int     retry_nosuch
+        SV *    varlist_ref
+        SV *    perl_callback
+        PPCODE:
+        {
+           AV *varlist;
+           SV **varbind_ref;
+           AV *varbind;
+           I32 varlist_len;
+           I32 varlist_ind;
+           netsnmp_session *ss;
+           netsnmp_pdu *pdu, *response;
+           netsnmp_variable_list *vars;
+           netsnmp_variable_list *last_vars;
+           struct tree *tp;
+           int len;
+           oid *oid_arr = NULL;
+           int oid_arr_len = MAX_OID_LEN;
+           SV *tmp_sv;
+           char *tag_pv;
+           int type;
+           char tmp_type_str[MAX_TYPE_NAME_LEN];
+           char str_buf[STR_BUF_SIZE];
+           snmp_xs_cb_data *xs_cb_data;
+           SV **sess_ptr_sv;
+           SV **err_str_svp;
+           SV **err_num_svp;
+           SV **err_ind_svp;
+           int status;
+           int sprintval_flag = USE_BASIC;
+           int verbose = SvIV(perl_get_sv("SNMP::verbose", 0x01 | 0x04));
+	   SV *sv_timestamp = NULL;
+
+           New (0, oid_arr, MAX_OID_LEN, oid);
+
+           if (oid_arr && SvROK(sess_ref) && SvROK(varlist_ref)) {
+
+              sess_ptr_sv = hv_fetch((HV*)SvRV(sess_ref), "SessPtr", 7, 1);
+              ss = (SnmpSession *)SvIV((SV*)SvRV(*sess_ptr_sv));
+              err_str_svp = hv_fetch((HV*)SvRV(sess_ref), "ErrorStr", 8, 1);
+              err_num_svp = hv_fetch((HV*)SvRV(sess_ref), "ErrorNum", 8, 1);
+              err_ind_svp = hv_fetch((HV*)SvRV(sess_ref), "ErrorInd", 8, 1);
+              sv_setpv(*err_str_svp, "");
+              sv_setiv(*err_num_svp, 0);
+              sv_setiv(*err_ind_svp, 0);
+              if (SvIV(*hv_fetch((HV*)SvRV(sess_ref),"UseEnums", 8, 1)))
+                 sprintval_flag = USE_ENUMS;
+              if (SvIV(*hv_fetch((HV*)SvRV(sess_ref),"UseSprintValue", 14, 1)))
+                 sprintval_flag = USE_SPRINT_VALUE;
+
+              pdu = snmp_pdu_create(SNMP_MSG_GET);
+
+              varlist = (AV*) SvRV(varlist_ref);
+              varlist_len = av_len(varlist);
+              for(varlist_ind = 0; varlist_ind <= varlist_len; varlist_ind++) {
+                 varbind_ref = av_fetch(varlist, varlist_ind, 0);
+                 if (SvROK(*varbind_ref)) {
+                    varbind = (AV*) SvRV(*varbind_ref);
+                    tag_pv = __av_elem_pv(varbind, VARBIND_TAG_F,NULL);
+                    tp = __tag2oid(tag_pv,
+                                   __av_elem_pv(varbind, VARBIND_IID_F,NULL),
+                                   oid_arr, &oid_arr_len, NULL,0);
+
+                    if (oid_arr_len) {
+                       snmp_add_null_var(pdu, oid_arr, oid_arr_len);
+                    } else {
+                       if (verbose)
+                          warn("error: get: unknown object ID (%s)",
+                                (tag_pv?tag_pv:"<null>"));
+	               sv_catpv(*err_str_svp,
+                                (char*)snmp_api_errstring(SNMPERR_UNKNOWN_OBJID));
+                       sv_setiv(*err_num_svp, SNMPERR_UNKNOWN_OBJID);
+                       XPUSHs(&sv_undef); /* unknown OID */
+		       snmp_free_pdu(pdu);
+		       goto done;
+                    }
+                 } /* if var_ref is ok */
+              } /* for all the vars */
+
+              if (perl_callback && SvTRUE(perl_callback)) {
+                  xs_cb_data =
+                      (snmp_xs_cb_data*)malloc(sizeof(snmp_xs_cb_data));
+                 xs_cb_data->perl_cb = newSVsv(perl_callback);
+                 xs_cb_data->sess_ref = newSVsv(sess_ref);
+
+                 status = snmp_async_send(ss, pdu, __snmp_xs_cb,
+                                          (void*)xs_cb_data);
+                 if (status != 0) {
+                    XPUSHs(sv_2mortal(newSViv(status))); /* push the reqid?? */
+                 } else {
+                    snmp_free_pdu(pdu);
+                    sv_catpv(*err_str_svp,
+                             (char*)snmp_api_errstring(ss->s_snmp_errno));
+                    sv_setiv(*err_num_svp, ss->s_snmp_errno);
+                    XPUSHs(&sv_undef);
+                 }
+                 goto done;
+              }
+
+              status = __send_sync_pdu(ss, pdu, &response, retry_nosuch,
+                                       *err_str_svp,*err_num_svp,*err_ind_svp);
+
+              last_vars = (response ? response->variables : NULL);
+
+	      if (SvIOK(*hv_fetch((HV*)SvRV(sess_ref),"TimeStamp", 9, 1)) &&
+                  SvIV(*hv_fetch((HV*)SvRV(sess_ref),"TimeStamp", 9, 1)))
+	         sv_timestamp = newSViv((IV)time(NULL));
+
+              for(varlist_ind = 0; varlist_ind <= varlist_len; varlist_ind++) {
+                 varbind_ref = av_fetch(varlist, varlist_ind, 0);
+                 if (SvROK(*varbind_ref)) {
+                    varbind = (AV*) SvRV(*varbind_ref);
+
+                    tp=__tag2oid(__av_elem_pv(varbind, VARBIND_TAG_F,NULL),
+                                 __av_elem_pv(varbind, VARBIND_IID_F,NULL),
+                                 oid_arr, &oid_arr_len, &type,0);
+
+                    for (vars = last_vars; vars; vars=vars->next_variable) {
+	            if (__oid_cmp(oid_arr, oid_arr_len, vars->name,
+                                     vars->name_length) == 0) {
+                          if (type == TYPE_UNKNOWN)
+                             type = __translate_asn_type(vars->type);
+                          last_vars = vars->next_variable;
+                          break;
+                       }
+                    }
+                    if (vars) {
+                       __get_type_str(type, tmp_type_str);
+                       tmp_sv = newSVpv(tmp_type_str,strlen(tmp_type_str));
+                       av_store(varbind, VARBIND_TYPE_F, tmp_sv);
+                       len=__snprint_value(str_buf,sizeof(str_buf),
+                                          vars,tp,type,sprintval_flag);
+                       tmp_sv=newSVpv((char*)str_buf, len);
+                       av_store(varbind, VARBIND_VAL_F, tmp_sv);
+		       if (sv_timestamp)
+                          av_store(varbind, VARBIND_TYPE_F, sv_timestamp);
+                       XPUSHs(sv_mortalcopy(tmp_sv));
+                    } else {
+                       av_store(varbind, VARBIND_VAL_F, &sv_undef);
+                       av_store(varbind, VARBIND_TYPE_F, &sv_undef);
+                       XPUSHs(&sv_undef);
+                    }
+                 }
+              }
+              if (response) snmp_free_pdu(response);
+           } else {
+              XPUSHs(&sv_undef); /* no mem or bad args */
+           }
+     done:
+           Safefree(oid_arr);
+        }
+
+int
+snmp_getnext(sess_ref, varlist_ref, perl_callback)
+        SV *    sess_ref
+        SV *    varlist_ref
+        SV *    perl_callback
+        PPCODE:
+        {
+           AV *varlist;
+           SV **varbind_ref;
+           AV *varbind;
+           I32 varlist_len;
+           I32 varlist_ind;
+           netsnmp_session *ss;
+           netsnmp_pdu *pdu, *response;
+           netsnmp_variable_list *vars;
+           struct tree *tp;
+           int len;
+	   oid *oid_arr;
+	   int oid_arr_len = MAX_OID_LEN;
+           SV *tmp_sv;
+           int type;
+	   char tmp_type_str[MAX_TYPE_NAME_LEN];
+           snmp_xs_cb_data *xs_cb_data;
+           SV **sess_ptr_sv;
+           SV **err_str_svp;
+           SV **err_num_svp;
+           SV **err_ind_svp;
+           int status;
+	   u_char str_buf[STR_BUF_SIZE], *str_bufp = str_buf;
+           size_t str_buf_len = sizeof(str_buf);
+           size_t out_len = 0;
+           int buf_over = 0;
+           char *label;
+           char *iid;
+           int getlabel_flag = NO_FLAGS;
+           int sprintval_flag = USE_BASIC;
+           int verbose = SvIV(perl_get_sv("SNMP::verbose", 0x01 | 0x04));
+	   int old_numeric, old_printfull;	/* Old values of globals */
+	   SV *sv_timestamp = NULL;
+
+           New (0, oid_arr, MAX_OID_LEN, oid);
+
+           if (oid_arr && SvROK(sess_ref) && SvROK(varlist_ref)) {
+
+              sess_ptr_sv = hv_fetch((HV*)SvRV(sess_ref), "SessPtr", 7, 1);
+	      ss = (SnmpSession *)SvIV((SV*)SvRV(*sess_ptr_sv));
+              err_str_svp = hv_fetch((HV*)SvRV(sess_ref), "ErrorStr", 8, 1);
+              err_num_svp = hv_fetch((HV*)SvRV(sess_ref), "ErrorNum", 8, 1);
+              err_ind_svp = hv_fetch((HV*)SvRV(sess_ref), "ErrorInd", 8, 1);
+              sv_setpv(*err_str_svp, "");
+              sv_setiv(*err_num_svp, 0);
+              sv_setiv(*err_ind_svp, 0);
+	      if (SvIV(*hv_fetch((HV*)SvRV(sess_ref),"UseLongNames", 12, 1)))
+                 getlabel_flag |= USE_LONG_NAMES;
+	      if (SvIV(*hv_fetch((HV*)SvRV(sess_ref),"UseEnums", 8, 1)))
+                 sprintval_flag = USE_ENUMS;
+	      if (SvIV(*hv_fetch((HV*)SvRV(sess_ref),"UseSprintValue", 14, 1)))
+                 sprintval_flag = USE_SPRINT_VALUE;
+
+              pdu = snmp_pdu_create(SNMP_MSG_GETNEXT);
+
+              varlist = (AV*) SvRV(varlist_ref);
+              varlist_len = av_len(varlist);
+	      for(varlist_ind = 0; varlist_ind <= varlist_len; varlist_ind++) {
+                 varbind_ref = av_fetch(varlist, varlist_ind, 0);
+                 if (SvROK(*varbind_ref)) {
+                    varbind = (AV*) SvRV(*varbind_ref);
+
+                    tp = __tag2oid(__av_elem_pv(varbind, VARBIND_TAG_F, ".0"),
+                              __av_elem_pv(varbind, VARBIND_IID_F, NULL),
+                              oid_arr, &oid_arr_len, NULL,0);
+
+      		    if (oid_arr_len) {
+  		       snmp_add_null_var(pdu, oid_arr, oid_arr_len);
+		    } else {
+                       if (verbose)
+                          warn("error: set: unknown object ID");
+	               sv_catpv(*err_str_svp,
+                               (char*)snmp_api_errstring(SNMPERR_UNKNOWN_OBJID));
+                       sv_setiv(*err_num_svp, SNMPERR_UNKNOWN_OBJID);
+                       XPUSHs(&sv_undef); /* unknown OID */
+		       snmp_free_pdu(pdu);
+		       goto done;
+		    }
+
+                 } /* if var_ref is ok */
+              } /* for all the vars */
+
+              if (SvTRUE(perl_callback)) {
+                  xs_cb_data =
+                      (snmp_xs_cb_data*)malloc(sizeof(snmp_xs_cb_data));
+                 xs_cb_data->perl_cb = newSVsv(perl_callback);
+                 xs_cb_data->sess_ref = newSVsv(sess_ref);
+
+                 status = snmp_async_send(ss, pdu, __snmp_xs_cb,
+                                          (void*)xs_cb_data);
+                 if (status != 0) {
+                    XPUSHs(sv_2mortal(newSViv(status))); /* push the reqid?? */
+                 } else {
+                    snmp_free_pdu(pdu);
+                    sv_catpv(*err_str_svp,
+                             (char*)snmp_api_errstring(ss->s_snmp_errno));
+                    sv_setiv(*err_num_svp, ss->s_snmp_errno);
+                    XPUSHs(&sv_undef);
+                 }
+		 goto done;
+              }
+
+	      status = __send_sync_pdu(ss, pdu, &response,
+				       NO_RETRY_NOSUCH,
+                                       *err_str_svp, *err_num_svp,
+				       *err_ind_svp);
+
+	      /*
+	      ** Set up for numeric OID's, if necessary.  Save the old values
+	      ** so that they can be restored when we finish -- these are
+	      ** library-wide globals, and have to be set/restored for each
+	      ** session.
+	      */
+	      old_numeric = netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID,
+						    NETSNMP_DS_LIB_PRINT_NUMERIC_OIDS);
+	      old_printfull = netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID,
+						    NETSNMP_DS_LIB_PRINT_FULL_OID);
+
+	      if (SvIV(*hv_fetch((HV*)SvRV(sess_ref),"UseNumeric", 10, 1))) {
+	         getlabel_flag |= USE_NUMERIC_OIDS;
+
+	         netsnmp_ds_set_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_PRINT_NUMERIC_OIDS, 1);
+		 netsnmp_ds_set_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_PRINT_FULL_OID, 1);
+	      }
+
+	      if (SvIOK(*hv_fetch((HV*)SvRV(sess_ref),"TimeStamp", 9, 1)) &&
+                  SvIV(*hv_fetch((HV*)SvRV(sess_ref),"TimeStamp", 9, 1)))
+	         sv_timestamp = newSViv((IV)time(NULL));
+
+              for(vars = (response?response->variables:NULL), varlist_ind = 0;
+                  vars && (varlist_ind <= varlist_len);
+                  vars = vars->next_variable, varlist_ind++) {
+                 varbind_ref = av_fetch(varlist, varlist_ind, 0);
+                 if (SvROK(*varbind_ref)) {
+                    varbind = (AV*) SvRV(*varbind_ref);
+
+                    *str_buf = '.';
+                    *(str_buf+1) = '\0';
+                    out_len = 0;
+                    tp = netsnmp_sprint_realloc_objid_tree(&str_bufp, &str_buf_len,
+                                                           &out_len, 0, &buf_over,
+                                                           vars->name,vars->name_length);
+                    str_buf[sizeof(str_buf)-1] = '\0';
+
+                    if (__is_leaf(tp)) {
+                       type = tp->type;
+                    } else {
+                       getlabel_flag |= NON_LEAF_NAME;
+                       type = __translate_asn_type(vars->type);
+                    }
+                    __get_label_iid(str_buf,&label,&iid,getlabel_flag);
+                    if (label) {
+                        av_store(varbind, VARBIND_TAG_F,
+                                 newSVpv(label, strlen(label)));
+                    } else {
+                        av_store(varbind, VARBIND_TAG_F,
+                                 newSVpv("", 0));
+                    }
+                    if (iid) {
+                        av_store(varbind, VARBIND_IID_F,
+                                 newSVpv(iid, strlen(iid)));
+                    } else {
+                        av_store(varbind, VARBIND_IID_F,
+                                 newSVpv("", 0));
+                    }                        
+                    __get_type_str(type, tmp_type_str);
+                    tmp_sv = newSVpv(tmp_type_str, strlen(tmp_type_str));
+                    av_store(varbind, VARBIND_TYPE_F, tmp_sv);
+                    len=__snprint_value(str_buf,sizeof(str_buf),
+                                       vars,tp,type,sprintval_flag);
+                    tmp_sv = newSVpv((char*)str_buf, len);
+                    av_store(varbind, VARBIND_VAL_F, tmp_sv);
+		    if (sv_timestamp)
+                       av_store(varbind, VARBIND_TYPE_F, sv_timestamp);
+                    XPUSHs(sv_mortalcopy(tmp_sv));
+                 } else {
+		    /* Return undef for this variable. */
+                    XPUSHs(&sv_undef);
+                 }
+              }
+
+	      /* Reset the library's behavior for numeric/symbolic OID's. */
+	      if (getlabel_flag & USE_NUMERIC_OIDS) {
+	         netsnmp_ds_set_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_PRINT_NUMERIC_OIDS,
+								 old_numeric );
+	         netsnmp_ds_set_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_PRINT_FULL_OID,
+								 old_printfull);
+	      }
+
+              if (response) snmp_free_pdu(response);
+
+           } else {
+              XPUSHs(&sv_undef); /* no mem or bad args */
+	   }
+done:
+	Safefree(oid_arr);
+	}
+
+int
+snmp_getbulk(sess_ref, nonrepeaters, maxrepetitions, varlist_ref, perl_callback)
+        SV *	sess_ref
+	int nonrepeaters
+	int maxrepetitions
+        SV *	varlist_ref
+        SV *	perl_callback
+	PPCODE:
+	{
+           AV *varlist;
+           SV **varbind_ref;
+           AV *varbind;
+	   I32 varlist_len;
+	   I32 varlist_ind;
+           netsnmp_session *ss;
+           netsnmp_pdu *pdu, *response;
+           netsnmp_variable_list *vars;
+           struct tree *tp;
+           int len;
+	   oid *oid_arr;
+	   int oid_arr_len = MAX_OID_LEN;
+           SV *tmp_sv;
+           int type;
+	   char tmp_type_str[MAX_TYPE_NAME_LEN];
+           snmp_xs_cb_data *xs_cb_data;
+           SV **sess_ptr_sv;
+           SV **err_str_svp;
+           SV **err_num_svp;
+           SV **err_ind_svp;
+           int status;
+	   u_char str_buf[STR_BUF_SIZE], *str_bufp = str_buf;
+           size_t str_buf_len = sizeof(str_buf);
+           size_t out_len = 0;
+           int buf_over = 0;
+           char *label;
+           char *iid;
+           int getlabel_flag = NO_FLAGS;
+           int sprintval_flag = USE_BASIC;
+           int verbose = SvIV(perl_get_sv("SNMP::verbose", 0x01 | 0x04));
+	   int old_numeric, old_printfull;	/* Old values of globals */
+	   SV *rv;
+	   SV *sv_timestamp = NULL;
+
+           New (0, oid_arr, MAX_OID_LEN, oid);
+
+           if (oid_arr && SvROK(sess_ref) && SvROK(varlist_ref)) {
+
+              sess_ptr_sv = hv_fetch((HV*)SvRV(sess_ref), "SessPtr", 7, 1);
+	      ss = (SnmpSession *)SvIV((SV*)SvRV(*sess_ptr_sv));
+              err_str_svp = hv_fetch((HV*)SvRV(sess_ref), "ErrorStr", 8, 1);
+              err_num_svp = hv_fetch((HV*)SvRV(sess_ref), "ErrorNum", 8, 1);
+              err_ind_svp = hv_fetch((HV*)SvRV(sess_ref), "ErrorInd", 8, 1);
+              sv_setpv(*err_str_svp, "");
+              sv_setiv(*err_num_svp, 0);
+              sv_setiv(*err_ind_svp, 0);
+	      if (SvIV(*hv_fetch((HV*)SvRV(sess_ref),"UseLongNames", 12, 1)))
+                 getlabel_flag |= USE_LONG_NAMES;
+	      if (SvIV(*hv_fetch((HV*)SvRV(sess_ref),"UseNumeric", 10, 1)))
+		 getlabel_flag |= USE_NUMERIC_OIDS;
+	      if (SvIV(*hv_fetch((HV*)SvRV(sess_ref),"UseEnums", 8, 1)))
+                 sprintval_flag = USE_ENUMS;
+	      if (SvIV(*hv_fetch((HV*)SvRV(sess_ref),"UseSprintValue", 14, 1)))
+                 sprintval_flag = USE_SPRINT_VALUE;
+
+              pdu = snmp_pdu_create(SNMP_MSG_GETBULK);
+
+	      pdu->errstat = nonrepeaters;
+	      pdu->errindex = maxrepetitions;
+
+              varlist = (AV*) SvRV(varlist_ref);
+              varlist_len = av_len(varlist);
+	      for(varlist_ind = 0; varlist_ind <= varlist_len; varlist_ind++) {
+                 varbind_ref = av_fetch(varlist, varlist_ind, 0);
+                 if (SvROK(*varbind_ref)) {
+                    varbind = (AV*) SvRV(*varbind_ref);
+                    __tag2oid(__av_elem_pv(varbind, VARBIND_TAG_F, "0"),
+                              __av_elem_pv(varbind, VARBIND_IID_F, NULL),
+                              oid_arr, &oid_arr_len, NULL,0);
+
+
+                    if (oid_arr_len) {
+  		       snmp_add_null_var(pdu, oid_arr, oid_arr_len);
+		    } else {
+                       if (verbose)
+                          warn("error: set: unknown object ID");
+	               sv_catpv(*err_str_svp,
+                               (char*)snmp_api_errstring(SNMPERR_UNKNOWN_OBJID));
+                       sv_setiv(*err_num_svp, SNMPERR_UNKNOWN_OBJID);
+                       XPUSHs(&sv_undef); /* unknown OID */
+		       snmp_free_pdu(pdu);
+		       goto done;
+		    }
+
+
+                 } /* if var_ref is ok */
+              } /* for all the vars */
+
+              if (SvTRUE(perl_callback)) {
+                  xs_cb_data =
+                      (snmp_xs_cb_data*)malloc(sizeof(snmp_xs_cb_data));
+                 xs_cb_data->perl_cb = newSVsv(perl_callback);
+                 xs_cb_data->sess_ref = newSVsv(sess_ref);
+
+                 status = snmp_async_send(ss, pdu, __snmp_xs_cb,
+                                          (void*)xs_cb_data);
+                 if (status != 0) {
+                    XPUSHs(sv_2mortal(newSViv(status))); /* push the reqid?? */
+                 } else {
+                    snmp_free_pdu(pdu);
+                    sv_catpv(*err_str_svp,
+                             (char*)snmp_api_errstring(ss->s_snmp_errno));
+                    sv_setiv(*err_num_svp, ss->s_snmp_errno);
+                    XPUSHs(&sv_undef);
+                 }
+		 goto done;
+              }
+
+	      status = __send_sync_pdu(ss, pdu, &response,
+				       NO_RETRY_NOSUCH,
+                                       *err_str_svp, *err_num_svp,
+				       *err_ind_svp);
+
+	      if (SvIV(*hv_fetch((HV*)SvRV(sess_ref),"TimeStamp", 9, 1)))
+	         sv_timestamp = newSViv((IV)time(NULL));
+
+	      av_clear(varlist);
+
+	      /*
+	      ** Set up for numeric OID's, if necessary.  Save the old values
+	      ** so that they can be restored when we finish -- these are
+	      ** library-wide globals, and have to be set/restored for each
+	      ** session.
+	      */
+	      old_numeric = netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID,
+						  NETSNMP_DS_LIB_PRINT_NUMERIC_OIDS);
+	      old_printfull = netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID,
+						  NETSNMP_DS_LIB_PRINT_FULL_OID);
+	      if (SvIV(*hv_fetch((HV*)SvRV(sess_ref),"UseNumeric", 10, 1))) {
+	         getlabel_flag |= USE_NUMERIC_OIDS;
+
+	         netsnmp_ds_set_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_PRINT_NUMERIC_OIDS, 1);
+	         netsnmp_ds_set_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_PRINT_FULL_OID, 1);
+	      }
+
+	      if(response && response->variables) {
+              for(vars = response->variables;
+                  vars;
+                  vars = vars->next_variable) {
+
+                    varbind = (AV*) newAV();
+                    *str_buf = '.';
+                    *(str_buf+1) = '\0';
+                    out_len = 0;
+                    tp = netsnmp_sprint_realloc_objid_tree(&str_bufp, &str_buf_len,
+                                                           &out_len, 0, &buf_over,
+                                                           vars->name,vars->name_length);
+                    str_buf[sizeof(str_buf)-1] = '\0';
+                    if (__is_leaf(tp)) {
+                       type = tp->type;
+                    } else {
+                       getlabel_flag |= NON_LEAF_NAME;
+                       type = __translate_asn_type(vars->type);
+                    }
+                    __get_label_iid(str_buf,&label,&iid,getlabel_flag);
+
+		    av_store(varbind, VARBIND_TAG_F,
+			     newSVpv(label, strlen(label)));
+		    av_store(varbind, VARBIND_IID_F,
+			     newSVpv(iid, strlen(iid)));
+
+                    __get_type_str(type, tmp_type_str);
+		    av_store(varbind, VARBIND_TYPE_F, newSVpv(tmp_type_str,
+				     strlen(tmp_type_str)));
+
+                    len=__snprint_value(str_buf,sizeof(str_buf),
+                                       vars,tp,type,sprintval_flag);
+                    tmp_sv = newSVpv((char*)str_buf, len);
+		    av_store(varbind, VARBIND_VAL_F, tmp_sv);
+		    if (sv_timestamp)
+		       av_store(varbind, VARBIND_TYPE_F, SvREFCNT_inc(sv_timestamp));
+
+		    rv = newRV_noinc((SV *)varbind);
+		    sv_bless(rv, gv_stashpv("SNMP::Varbind",0));
+		    av_push(varlist, rv);
+
+                    XPUSHs(sv_mortalcopy(tmp_sv));
+                 }
+              } else {
+                    XPUSHs(&sv_undef);
+	      }
+
+	      /* Reset the library's behavior for numeric/symbolic OID's. */
+	      if (getlabel_flag & USE_NUMERIC_OIDS) {
+	          netsnmp_ds_set_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_PRINT_NUMERIC_OIDS,
+							      old_numeric );
+	          netsnmp_ds_set_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_PRINT_FULL_OID,
+							      old_printfull);
+	      }
+
+              if (response) snmp_free_pdu(response);
+
+           } else {
+              XPUSHs(&sv_undef); /* no mem or bad args */
+	   }
+done:
+	Safefree(oid_arr);
+	}
+
+int
+snmp_bulkwalk(sess_ref, nonrepeaters, maxrepetitions, varlist_ref,perl_callback)
+        SV *	sess_ref
+	int nonrepeaters
+	int maxrepetitions
+        SV *	varlist_ref
+        SV *	perl_callback
+	PPCODE:
+	{
+           AV *varlist;
+           SV **varbind_ref;
+           AV *varbind;
+	   I32 varlist_len;
+	   I32 varlist_ind;
+           netsnmp_session *ss;
+           netsnmp_pdu *pdu = NULL;
+	   oid oid_arr[MAX_OID_LEN];
+	   int oid_arr_len;
+           SV **sess_ptr_sv;
+           SV **err_str_svp;
+           SV **err_num_svp;
+           SV **err_ind_svp;
+	   char str_buf[STR_BUF_SIZE];
+           int verbose = SvIV(perl_get_sv("SNMP::verbose", 0x01 | 0x04));
+	   walk_context *context = NULL;	/* Context for this bulkwalk */
+	   bulktbl *bt_entry;			/* Current bulktbl/OID entry */
+	   int i;				/* General purpose iterator  */
+	   int npushed;				/* Number of return arrays   */
+	   int okay;				/* Did bulkwalk complete okay */
+
+           if (!SvROK(sess_ref) || !SvROK(varlist_ref)) {
+	      if (verbose)
+		 warn("Bad session or varlist reference!\n");
+
+	      XSRETURN_UNDEF;
+	   }
+
+	   sess_ptr_sv = hv_fetch((HV*)SvRV(sess_ref), "SessPtr", 7, 1);
+	   ss = (SnmpSession *)SvIV((SV*)SvRV(*sess_ptr_sv));
+	   err_str_svp = hv_fetch((HV*)SvRV(sess_ref), "ErrorStr", 8, 1);
+	   err_num_svp = hv_fetch((HV*)SvRV(sess_ref), "ErrorNum", 8, 1);
+	   err_ind_svp = hv_fetch((HV*)SvRV(sess_ref), "ErrorInd", 8, 1);
+	   sv_setpv(*err_str_svp, "");
+	   sv_setiv(*err_num_svp, 0);
+	   sv_setiv(*err_ind_svp, 0);
+
+	   /* Create and initialize a new session context for this bulkwalk.
+	   ** This will be used to carry state between callbacks.
+	   */
+	   Newz(0x57616b6c /* "Walk" */, context, 1, walk_context);
+	   if (context == NULL) {
+	      sprintf(str_buf, "malloc(context) failed (%s)", strerror(errno));
+	      sv_setpv(*err_str_svp, str_buf);
+	      sv_setiv(*err_num_svp, SNMPERR_MALLOC);
+	      goto err;
+	   }
+
+	   /* Store the Perl callback and session reference in the context. */
+	   context->perl_cb  = newSVsv(perl_callback);
+	   context->sess_ref = newSVsv(sess_ref);
+
+	   DBPRT(3,("bulkwalk: sess_ref = 0x%p, sess_ptr_sv = 0x%p, ss = 0x%p\n",
+						    sess_ref, sess_ptr_sv, ss));
+
+           context->getlabel_f  = NO_FLAGS;	/* long/numeric name flags */
+           context->sprintval_f = USE_BASIC;	/* Don't do fancy printing */
+	   context->req_oids    = NULL;		/* List of oid's requested */
+	   context->repbase     = NULL;		/* Repeaters in req_oids[] */
+	   context->reqbase     = NULL;		/* Ptr to start of requests */
+	   context->nreq_oids   = 0;		/* Number of oid's in list */
+	   context->repeaters   = 0;		/* Repeater count (see below) */
+	   context->non_reps    = nonrepeaters;	/* Non-repeater var count */
+	   context->max_reps    = maxrepetitions; /* Max repetition/var count */
+	   context->pkts_exch   = 0;		/* Packets exchanged in walk */
+	   context->oid_total   = 0;		/* OID's received during walk */
+	   context->oid_saved   = 0;		/* OID's saved as results */
+
+	   if (SvIV(*hv_fetch((HV*)SvRV(sess_ref),"UseLongNames", 12, 1)))
+	      context->getlabel_f |= USE_LONG_NAMES;
+	   if (SvIV(*hv_fetch((HV*)SvRV(sess_ref),"UseNumeric", 10, 1)))
+	      context->getlabel_f |= USE_NUMERIC_OIDS;
+	   if (SvIV(*hv_fetch((HV*)SvRV(sess_ref),"UseEnums", 8, 1)))
+	      context->sprintval_f = USE_ENUMS;
+	   if (SvIV(*hv_fetch((HV*)SvRV(sess_ref),"UseSprintValue", 14, 1)))
+	      context->sprintval_f = USE_SPRINT_VALUE;
+
+	   /* Set up an array of bulktbl's to hold the original list of
+	   ** requested OID's.  This is used to populate the PDU's with
+	   ** oid values, to contain/sort the return values, and (through
+	   ** last_oid/last_len) to determine when the bulkwalk for each
+	   ** variable has completed.
+	   */
+	   varlist = (AV*) SvRV(varlist_ref);
+	   varlist_len = av_len(varlist) + 1;	/* XXX av_len returns index of
+						** last element not #elements */
+
+	   Newz(0, context->req_oids, varlist_len, bulktbl);
+
+	   if (context->req_oids == NULL) {
+	      sprintf(str_buf, "Newz(req_oids) failed (%s)", strerror(errno));
+	      if (verbose)
+	         warn(str_buf);
+	      sv_setpv(*err_str_svp, str_buf);
+	      sv_setiv(*err_num_svp, SNMPERR_MALLOC);
+	      goto err;
+	   }
+
+	   /* Walk through the varbind_list, parsing and copying each OID
+	   ** into a bulktbl slot in the req_oids array.  Bail if there's
+	   ** some error.  Create the initial packet to send out, which
+	   ** includes the non-repeaters.
+	   */
+	   DBPRT(1,( "Building request table:\n"));
+	   for (varlist_ind = 0; varlist_ind < varlist_len; varlist_ind++) {
+	      /* Get a handle on this entry in the request table. */
+	      bt_entry = &context->req_oids[context->nreq_oids];
+
+	      DBPRT(1,( "  request %d: ", (int)varlist_ind));
+
+	      /* Get the request varbind from the varlist, parse it out to
+	      ** tag and index, and copy it to the req_oid[] array slots.
+	      */
+	      varbind_ref = av_fetch(varlist, varlist_ind, 0);
+	      if (!SvROK(*varbind_ref)) {
+		 sv_setpv(*err_str_svp, \
+		       (char*)snmp_api_errstring(SNMPERR_BAD_NAME));
+		 sv_setiv(*err_num_svp, SNMPERR_BAD_NAME);
+		 goto err;
+	      }
+
+	      varbind = (AV*) SvRV(*varbind_ref);
+	      __tag2oid(__av_elem_pv(varbind, VARBIND_TAG_F, "0"),
+			__av_elem_pv(varbind, VARBIND_IID_F, NULL),
+			oid_arr, &oid_arr_len, NULL, 0);
+
+	      if ((oid_arr_len == 0) || (oid_arr_len > MAX_OID_LEN)) {
+		 if (verbose)
+		    warn("error: bulkwalk(): unknown object ID");
+		 sv_setpv(*err_str_svp, \
+		       (char*)snmp_api_errstring(SNMPERR_UNKNOWN_OBJID));
+		 sv_setiv(*err_num_svp, SNMPERR_UNKNOWN_OBJID);
+		 goto err;
+	      }
+
+	      /* Copy the now-parsed OID into the first available slot
+	      ** in the req_oids[] array.  Set both the req_oid (original
+	      ** request) and the last_oid (last requested/seen oid) to
+	      ** the initial value.  We build packets using last_oid (see
+	      ** below), so initialize last_oid to the initial request.
+	      */
+	      Copy((void *)oid_arr, (void *)bt_entry->req_oid,
+							oid_arr_len, oid);
+	      Copy((void *)oid_arr, (void *)bt_entry->last_oid,
+							oid_arr_len, oid);
+
+	      bt_entry->req_len  = oid_arr_len;
+	      bt_entry->last_len = oid_arr_len;
+
+	      /* Adjust offset to and count of repeaters.  Note non-repeater
+	      ** OID's in the list, if appropriate.
+	      */
+	      if (varlist_ind >= context->non_reps) {
+
+		 /* Store a pointer to the first repeater value. */
+		 if (context->repbase == NULL)
+		    context->repbase = bt_entry;
+
+		 context->repeaters ++;
+
+	      } else {
+		 bt_entry->norepeat = 1;
+		 DBPRT(1,( "(nonrepeater) "));
+	      }
+
+	      /* Initialize the array in which to hold the Varbinds to be
+	      ** returned for the OID or subtree.
+	      */
+	      if ((bt_entry->vars = (AV*) newAV()) == NULL) {
+		 sv_setpv(*err_str_svp, "newAV() failed: ");
+		 sv_catpv(*err_str_svp, strerror(errno));
+		 sv_setiv(*err_num_svp, SNMPERR_MALLOC);
+		 goto err;
+	      }
+
+	      DBPRT(1,( "%s\n", snprint_objid(_debugx, sizeof(_debugx), oid_arr, oid_arr_len)));
+
+	      context->nreq_oids ++;
+	   }
+
+	   /* Keep track of the number of outstanding requests.  This lets us
+	   ** finish processing early if we're done with all requests.
+	   */
+	   context->req_remain = context->nreq_oids;
+	   DBPRT(1,( "Total %d variable requests added\n", context->nreq_oids));
+
+	   /* If no good variable requests were found, return an error. */
+	   if (context->nreq_oids == 0) {
+		 sv_setpv(*err_str_svp, "No variables found in varlist");
+		 sv_setiv(*err_num_svp, SNMPERR_NO_VARS);
+		 goto err;
+	   }
+
+	   /* Note that this is a good context.  This allows later callbacks
+	   ** to ignore re-sent PDU's that correspond to completed (and hence
+	   ** destroyed) bulkwalk contexts.
+	   */
+	   _context_add(context);
+
+	   /* For asynchronous bulkwalk requests, all we have to do at this
+	   ** point is enqueue the asynchronous GETBULK request with our
+	   ** bulkwalk-specific callback and return.  Remember that the
+	   ** bulkwalk_send_pdu() function returns the reqid cast to an
+	   ** snmp_pdu pointer, or NULL on failure.  Return undef if the
+	   ** initial send fails; bulkwalk_send_pdu() takes care of setting
+	   ** the various error values.
+	   **
+	   ** From here, the callbacks do all the work, including sending
+	   ** requests for variables and handling responses.  The caller's
+	   ** callback will be invoked as soon as the walk completes.
+	   */
+	   if (SvTRUE(perl_callback)) {
+	      DBPRT(1,( "Starting asynchronous bulkwalk...\n"));
+
+	      pdu = _bulkwalk_send_pdu(context);
+
+	      if (pdu == NULL) {
+		 DBPRT(1,( "Initial asynchronous send failed...\n"));
+		 XSRETURN_UNDEF;
+	      }
+
+	      /* Sent okay...  Return the request ID in 'pdu' as an SvIV. */
+	      DBPRT(1,( "Okay, request id is %d\n", (int)pdu));
+/*	      XSRETURN_IV((int)pdu); */
+	      XPUSHs(sv_2mortal(newSViv((int)pdu)));
+	      XSRETURN(1);
+	   }
+
+	   /* For synchronous bulkwalk, we perform the basic send/receive
+	   ** iteration right here.  Once the walk has been completed, the
+	   ** bulkwalk_finish() function will push the return values onto
+	   ** the Perl call stack, and we return.
+	   */
+	   DBPRT(1,( "Starting synchronous bulkwalk...\n"));
+
+	   while (!(okay = _bulkwalk_done(context))) {
+
+	      /* Send a request for the next batch of variables. */
+	      DBPRT(1, (DBOUT "Building %s GETBULK bulkwalk PDU (%d)...\n",
+					context->pkts_exch ? "next" : "first",
+					context->pkts_exch));
+	      pdu = _bulkwalk_send_pdu(context);
+
+	      /* If the request failed, consider the walk done. */
+	      if (pdu == NULL) {
+		 DBPRT(1,( "bulkwalk_send_pdu() failed!\n"));
+		 break;
+	      }
+
+	      /* Handle the variables in this response packet.  Break out
+	      ** of the loop if an error occurs or no variables are found
+	      ** in the response.
+	      */
+	      if ((i = _bulkwalk_recv_pdu(context, pdu)) <= 0) {
+		 DBPRT(2,( "bulkwalk_recv_pdu() returned %d (error/empty)\n", i));
+		 break;
+	      }
+
+              /* Free the returned pdu.  Don't bother to do this for the async
+	      ** case, since the SNMP callback mechanism itself does the free
+	      ** for us.
+	      */
+	      snmp_free_pdu(pdu);
+
+	      /* And loop.  The call to bulkwalk_done() sets the ignore flags
+	      ** for any completed request subtrees.  Next time around, they
+	      ** won't be added to the request sent to the agent.
+	      */
+	      continue;
+	   }
+
+	   DBPRT(1, (DBOUT "Bulkwalk done... calling bulkwalk_finish(%s)...\n",
+	       okay ? "okay" : "error"));
+	   npushed = _bulkwalk_finish(context, okay);
+
+	   DBPRT(2,( "Returning %d values on the stack.\n", npushed));
+	   XSRETURN(npushed);
+
+	/* Handle error cases and clean up after ourselves. */
+        err:
+	   if (context->req_oids && context->nreq_oids) {
+	      bt_entry = context->req_oids;
+	      for (i = 0; i < context->nreq_oids; i++, bt_entry++)
+		 av_clear(bt_entry->vars);
+	   }
+	   if (context->req_oids)
+	      Safefree(context->req_oids);
+	   if (context)
+	      Safefree(context);
+	   if (pdu)
+	      snmp_free_pdu(pdu);
+
+           XSRETURN_UNDEF;
+	}
+
+
+int
+snmp_trapV1(sess_ref,enterprise,agent,generic,specific,uptime,varlist_ref)
+        SV *	sess_ref
+        char *	enterprise
+        char *	agent
+        int	generic
+        int	specific
+        long	uptime
+        SV *	varlist_ref
+	PPCODE:
+	{
+           AV *varlist;
+           SV **varbind_ref;
+           SV **varbind_val_f;
+           AV *varbind;
+	   I32 varlist_len;
+	   I32 varlist_ind;
+           SnmpSession *ss;
+           netsnmp_pdu *pdu = NULL;
+           struct tree *tp;
+	   oid *oid_arr;
+	   int oid_arr_len = MAX_OID_LEN;
+           SV **sess_ptr_sv;
+           SV **err_str_svp;
+           SV **err_num_svp;
+           SV **err_ind_svp;
+           int type;
+           int res;
+           int verbose = SvIV(perl_get_sv("SNMP::verbose", 0x01 | 0x04));
+           int use_enums = SvIV(*hv_fetch((HV*)SvRV(sess_ref),"UseEnums",8,1));
+           struct enum_list *ep;
+
+           New (0, oid_arr, MAX_OID_LEN, oid);
+
+           if (oid_arr && SvROK(sess_ref)) {
+
+              sess_ptr_sv = hv_fetch((HV*)SvRV(sess_ref), "SessPtr", 7, 1);
+	      ss = (SnmpSession *)SvIV((SV*)SvRV(*sess_ptr_sv));
+              err_str_svp = hv_fetch((HV*)SvRV(sess_ref), "ErrorStr", 8, 1);
+              err_num_svp = hv_fetch((HV*)SvRV(sess_ref), "ErrorNum", 8, 1);
+              err_ind_svp = hv_fetch((HV*)SvRV(sess_ref), "ErrorInd", 8, 1);
+              sv_setpv(*err_str_svp, "");
+              sv_setiv(*err_num_svp, 0);
+              sv_setiv(*err_ind_svp, 0);
+
+              pdu = snmp_pdu_create(SNMP_MSG_TRAP);
+
+              if (SvROK(varlist_ref)) {
+              varlist = (AV*) SvRV(varlist_ref);
+              varlist_len = av_len(varlist);
+	      for(varlist_ind = 0; varlist_ind <= varlist_len; varlist_ind++) {
+                 varbind_ref = av_fetch(varlist, varlist_ind, 0);
+                 if (SvROK(*varbind_ref)) {
+                    varbind = (AV*) SvRV(*varbind_ref);
+
+                    tp=__tag2oid(__av_elem_pv(varbind, VARBIND_TAG_F, NULL),
+                                 __av_elem_pv(varbind, VARBIND_IID_F, NULL),
+                                 oid_arr, &oid_arr_len, &type,0);
+
+                    if (oid_arr_len == 0) {
+                       if (verbose)
+                        warn("error:trap: unable to determine oid for object");
+                       goto err;
+                    }
+
+                    if (type == TYPE_UNKNOWN) {
+                      type = __translate_appl_type(
+                              __av_elem_pv(varbind, VARBIND_TYPE_F, NULL));
+                      if (type == TYPE_UNKNOWN) {
+                         if (verbose)
+                            warn("error:trap: no type found for object");
+                         goto err;
+                      }
+                    }
+
+	            varbind_val_f = av_fetch(varbind, VARBIND_VAL_F, 0);
+
+                    if (type==TYPE_INTEGER && use_enums && tp && tp->enums) {
+                      for(ep = tp->enums; ep; ep = ep->next) {
+                        if (varbind_val_f && SvOK(*varbind_val_f) &&
+                            !strcmp(ep->label, SvPV(*varbind_val_f,na))) {
+                          sv_setiv(*varbind_val_f, ep->value);
+                          break;
+                        }
+                      }
+                    }
+
+                    res = __add_var_val_str(pdu, oid_arr, oid_arr_len,
+                                  (varbind_val_f && SvOK(*varbind_val_f) ?
+                                   SvPV(*varbind_val_f,na):NULL),
+                                  (varbind_val_f && SvOK(*varbind_val_f) ?
+                                   SvCUR(*varbind_val_f):0),
+                                  type);
+
+                    if(res == FAILURE) {
+                        if(verbose) warn("error:trap: adding varbind");
+                        goto err;
+                    }
+
+                 } /* if var_ref is ok */
+              } /* for all the vars */
+              }
+
+	      pdu->enterprise = (oid *)malloc( MAX_OID_LEN * sizeof(oid));
+              tp = __tag2oid(enterprise,NULL, pdu->enterprise,
+                             &pdu->enterprise_length, NULL,0);
+  	      if (pdu->enterprise_length == 0) {
+		  if (verbose) warn("error:trap:invalid enterprise id: %s", enterprise);
+                  goto err;
+	      }
+	      /*  If agent is given then set the v1-TRAP specific
+		  agent-address field to that.  Otherwise set it to
+		  our address.  */
+              if (agent && strlen(agent)) {
+                 if (__parse_address(agent) == -1 && verbose) {
+		   warn("error:trap:invalid agent address: %s", agent);
+		   goto err;
+                 } else {
+		   *((in_addr_t *)pdu->agent_addr) = __parse_address(agent);
+		 }
+              } else {
+                 *((in_addr_t *)pdu->agent_addr) = get_myaddr();
+              }
+              pdu->trap_type = generic;
+              pdu->specific_type = specific;
+              pdu->time = uptime;
+
+              if (snmp_send(ss, pdu) == 0) {
+	         snmp_free_pdu(pdu);
+              }
+              XPUSHs(sv_2mortal(newSVpv(ZERO_BUT_TRUE,0)));
+           } else {
+err:
+              XPUSHs(&sv_undef); /* no mem or bad args */
+              if (pdu) snmp_free_pdu(pdu);
+           }
+	Safefree(oid_arr);
+        }
+
+
+int
+snmp_trapV2(sess_ref,uptime,trap_oid,varlist_ref)
+        SV *	sess_ref
+        char *	uptime
+        char *	trap_oid
+        SV *	varlist_ref
+	PPCODE:
+	{
+           AV *varlist;
+           SV **varbind_ref;
+           SV **varbind_val_f;
+           AV *varbind;
+	   I32 varlist_len;
+	   I32 varlist_ind;
+           SnmpSession *ss;
+           netsnmp_pdu *pdu = NULL;
+           struct tree *tp;
+	   oid *oid_arr;
+	   int oid_arr_len = MAX_OID_LEN;
+           SV **sess_ptr_sv;
+           SV **err_str_svp;
+           SV **err_num_svp;
+           SV **err_ind_svp;
+           int type;
+           int res;
+           int verbose = SvIV(perl_get_sv("SNMP::verbose", 0x01 | 0x04));
+           int use_enums = SvIV(*hv_fetch((HV*)SvRV(sess_ref),"UseEnums",8,1));
+           struct enum_list *ep;
+
+           New (0, oid_arr, MAX_OID_LEN, oid);
+
+           if (oid_arr && SvROK(sess_ref) && SvROK(varlist_ref)) {
+
+              sess_ptr_sv = hv_fetch((HV*)SvRV(sess_ref), "SessPtr", 7, 1);
+	      ss = (SnmpSession *)SvIV((SV*)SvRV(*sess_ptr_sv));
+              err_str_svp = hv_fetch((HV*)SvRV(sess_ref), "ErrorStr", 8, 1);
+              err_num_svp = hv_fetch((HV*)SvRV(sess_ref), "ErrorNum", 8, 1);
+              err_ind_svp = hv_fetch((HV*)SvRV(sess_ref), "ErrorInd", 8, 1);
+              sv_setpv(*err_str_svp, "");
+              sv_setiv(*err_num_svp, 0);
+              sv_setiv(*err_ind_svp, 0);
+
+              pdu = snmp_pdu_create(SNMP_MSG_TRAP2);
+
+              varlist = (AV*) SvRV(varlist_ref);
+              varlist_len = av_len(varlist);
+	      /************************************************/
+              res = __add_var_val_str(pdu, sysUpTime, SYS_UPTIME_OID_LEN,
+				uptime, strlen(uptime), TYPE_TIMETICKS);
+
+              if(res == FAILURE) {
+                if(verbose) warn("error:trap v2: adding sysUpTime varbind");
+		goto err;
+              }
+
+	      res = __add_var_val_str(pdu, snmpTrapOID, SNMP_TRAP_OID_LEN,
+				trap_oid ,strlen(trap_oid) ,TYPE_OBJID);
+
+              if(res == FAILURE) {
+                if(verbose) warn("error:trap v2: adding snmpTrapOID varbind");
+		goto err;
+              }
+
+
+	      /******************************************************/
+
+	      for(varlist_ind = 0; varlist_ind <= varlist_len; varlist_ind++) {
+                 varbind_ref = av_fetch(varlist, varlist_ind, 0);
+                 if (SvROK(*varbind_ref)) {
+                    varbind = (AV*) SvRV(*varbind_ref);
+
+                    tp=__tag2oid(__av_elem_pv(varbind, VARBIND_TAG_F,NULL),
+                                 __av_elem_pv(varbind, VARBIND_IID_F,NULL),
+                                 oid_arr, &oid_arr_len, &type,0);
+
+                    if (oid_arr_len == 0) {
+                       if (verbose)
+                        warn("error:trap v2: unable to determine oid for object");
+                       goto err;
+                    }
+
+                    if (type == TYPE_UNKNOWN) {
+                      type = __translate_appl_type(
+                                 __av_elem_pv(varbind, VARBIND_TYPE_F, NULL));
+                      if (type == TYPE_UNKNOWN) {
+                         if (verbose)
+                            warn("error:trap v2: no type found for object");
+                         goto err;
+                      }
+                    }
+
+	            varbind_val_f = av_fetch(varbind, VARBIND_VAL_F, 0);
+
+                    if (type==TYPE_INTEGER && use_enums && tp && tp->enums) {
+                      for(ep = tp->enums; ep; ep = ep->next) {
+                        if (varbind_val_f && SvOK(*varbind_val_f) &&
+                            !strcmp(ep->label, SvPV(*varbind_val_f,na))) {
+                          sv_setiv(*varbind_val_f, ep->value);
+                          break;
+                        }
+                      }
+                    }
+
+                    res = __add_var_val_str(pdu, oid_arr, oid_arr_len,
+                                  (varbind_val_f && SvOK(*varbind_val_f) ?
+                                   SvPV(*varbind_val_f,na):NULL),
+                                  (varbind_val_f && SvOK(*varbind_val_f) ?
+                                   SvCUR(*varbind_val_f):0),
+                                  type);
+
+                    if(res == FAILURE) {
+                        if(verbose) warn("error:trap v2: adding varbind");
+                        goto err;
+                    }
+
+                 } /* if var_ref is ok */
+              } /* for all the vars */
+
+              if (snmp_send(ss, pdu) == 0) {
+	         snmp_free_pdu(pdu);
+              }
+
+              XPUSHs(sv_2mortal(newSVpv(ZERO_BUT_TRUE,0)));
+           } else {
+err:
+              XPUSHs(&sv_undef); /* no mem or bad args */
+              if (pdu) snmp_free_pdu(pdu);
+           }
+	Safefree(oid_arr);
+        }
+
+
+
+int
+snmp_inform(sess_ref,uptime,trap_oid,varlist_ref,perl_callback)
+        SV *	sess_ref
+        char *	uptime
+        char *	trap_oid
+        SV *	varlist_ref
+        SV *	perl_callback
+	PPCODE:
+	{
+           AV *varlist;
+           SV **varbind_ref;
+           SV **varbind_val_f;
+           AV *varbind;
+	   I32 varlist_len;
+	   I32 varlist_ind;
+           SnmpSession *ss;
+           netsnmp_pdu *pdu = NULL;
+           netsnmp_pdu *response;
+           struct tree *tp;
+	   oid *oid_arr;
+	   int oid_arr_len = MAX_OID_LEN;
+           snmp_xs_cb_data *xs_cb_data;
+           SV **sess_ptr_sv;
+           SV **err_str_svp;
+           SV **err_num_svp;
+           SV **err_ind_svp;
+           int status = 0;
+           int type;
+           int res;
+           int verbose = SvIV(perl_get_sv("SNMP::verbose", 0x01 | 0x04));
+           int use_enums = SvIV(*hv_fetch((HV*)SvRV(sess_ref),"UseEnums",8,1));
+           struct enum_list *ep;
+
+           New (0, oid_arr, MAX_OID_LEN, oid);
+
+           if (oid_arr && SvROK(sess_ref) && SvROK(varlist_ref)) {
+
+              sess_ptr_sv = hv_fetch((HV*)SvRV(sess_ref), "SessPtr", 7, 1);
+	      ss = (SnmpSession *)SvIV((SV*)SvRV(*sess_ptr_sv));
+              err_str_svp = hv_fetch((HV*)SvRV(sess_ref), "ErrorStr", 8, 1);
+              err_num_svp = hv_fetch((HV*)SvRV(sess_ref), "ErrorNum", 8, 1);
+              err_ind_svp = hv_fetch((HV*)SvRV(sess_ref), "ErrorInd", 8, 1);
+              sv_setpv(*err_str_svp, "");
+              sv_setiv(*err_num_svp, 0);
+              sv_setiv(*err_ind_svp, 0);
+
+              pdu = snmp_pdu_create(SNMP_MSG_INFORM);
+
+              varlist = (AV*) SvRV(varlist_ref);
+              varlist_len = av_len(varlist);
+	      /************************************************/
+              res = __add_var_val_str(pdu, sysUpTime, SYS_UPTIME_OID_LEN,
+				uptime, strlen(uptime), TYPE_TIMETICKS);
+
+              if(res == FAILURE) {
+                if(verbose) warn("error:inform: adding sysUpTime varbind");
+		goto err;
+              }
+
+	      res = __add_var_val_str(pdu, snmpTrapOID, SNMP_TRAP_OID_LEN,
+				trap_oid ,strlen(trap_oid) ,TYPE_OBJID);
+
+              if(res == FAILURE) {
+                if(verbose) warn("error:inform: adding snmpTrapOID varbind");
+		goto err;
+              }
+
+
+	      /******************************************************/
+
+	      for(varlist_ind = 0; varlist_ind <= varlist_len; varlist_ind++) {
+                 varbind_ref = av_fetch(varlist, varlist_ind, 0);
+                 if (SvROK(*varbind_ref)) {
+                    varbind = (AV*) SvRV(*varbind_ref);
+
+                    tp=__tag2oid(__av_elem_pv(varbind, VARBIND_TAG_F,NULL),
+                                 __av_elem_pv(varbind, VARBIND_IID_F,NULL),
+                                 oid_arr, &oid_arr_len, &type,0);
+
+                    if (oid_arr_len == 0) {
+                       if (verbose)
+                        warn("error:inform: unable to determine oid for object");
+                       goto err;
+                    }
+
+                    if (type == TYPE_UNKNOWN) {
+                      type = __translate_appl_type(
+                                 __av_elem_pv(varbind, VARBIND_TYPE_F, NULL));
+                      if (type == TYPE_UNKNOWN) {
+                         if (verbose)
+                            warn("error:inform: no type found for object");
+                         goto err;
+                      }
+                    }
+
+	            varbind_val_f = av_fetch(varbind, VARBIND_VAL_F, 0);
+
+                    if (type==TYPE_INTEGER && use_enums && tp && tp->enums) {
+                      for(ep = tp->enums; ep; ep = ep->next) {
+                        if (varbind_val_f && SvOK(*varbind_val_f) &&
+                            !strcmp(ep->label, SvPV(*varbind_val_f,na))) {
+                          sv_setiv(*varbind_val_f, ep->value);
+                          break;
+                        }
+                      }
+                    }
+
+                    res = __add_var_val_str(pdu, oid_arr, oid_arr_len,
+                                  (varbind_val_f && SvOK(*varbind_val_f) ?
+                                   SvPV(*varbind_val_f,na):NULL),
+                                  (varbind_val_f && SvOK(*varbind_val_f) ?
+                                   SvCUR(*varbind_val_f):0),
+                                  type);
+
+                    if(res == FAILURE) {
+                        if(verbose) warn("error:inform: adding varbind");
+                        goto err;
+                    }
+
+                 } /* if var_ref is ok */
+              } /* for all the vars */
+
+
+              if (SvTRUE(perl_callback)) {
+                  xs_cb_data =
+                      (snmp_xs_cb_data*)malloc(sizeof(snmp_xs_cb_data));
+                 xs_cb_data->perl_cb = newSVsv(perl_callback);
+                 xs_cb_data->sess_ref = newRV_inc(SvRV(sess_ref));
+
+                 status = snmp_async_send(ss, pdu, __snmp_xs_cb,
+                                          (void*)xs_cb_data);
+                 if (status != 0) {
+                    XPUSHs(sv_2mortal(newSViv(status))); /* push the reqid?? */
+                 } else {
+                    snmp_free_pdu(pdu);
+                    sv_catpv(*err_str_svp,
+                             (char*)snmp_api_errstring(ss->s_snmp_errno));
+                    sv_setiv(*err_num_svp, ss->s_snmp_errno);
+                    XPUSHs(&sv_undef);
+                 }
+		 goto done;
+              }
+
+	      status = __send_sync_pdu(ss, pdu, &response,
+				       NO_RETRY_NOSUCH,
+                                       *err_str_svp, *err_num_svp,
+                                       *err_ind_svp);
+
+              if (response) snmp_free_pdu(response);
+
+              if (status) {
+		 XPUSHs(&sv_undef);
+	      } else {
+                 XPUSHs(sv_2mortal(newSVpv(ZERO_BUT_TRUE,0)));
+              }
+           } else {
+err:
+              XPUSHs(&sv_undef); /* no mem or bad args */
+              if (pdu) snmp_free_pdu(pdu);
+           }
+done:
+	Safefree(oid_arr);
+        }
+
+
+
+char *
+snmp_get_type(tag)
+	char *		tag
+	CODE:
+	{
+	   struct tree *tp  = NULL;
+	   static char type_str[MAX_TYPE_NAME_LEN];
+           char *ret = NULL;
+
+           if (tag && *tag) tp = __tag2oid(tag, NULL, NULL, NULL, NULL,0);
+           if (tp) __get_type_str(tp->type, ret = type_str);
+	   RETVAL = ret;
+	}
+	OUTPUT:
+        RETVAL
+
+
+void
+snmp_dump_packet(flag)
+	int		flag
+	CODE:
+	{
+	   snmp_set_dump_packet(flag);
+	}
+
+
+char *
+snmp_map_enum(tag, val, iflag)
+	char *		tag
+	char *		val
+	int		iflag
+	CODE:
+	{
+	   struct tree *tp  = NULL;
+           struct enum_list *ep;
+           char str_buf[STR_BUF_SIZE];
+           int ival;
+
+           RETVAL = NULL;
+
+           if (tag && *tag) tp = __tag2oid(tag, NULL, NULL, NULL, NULL,0);
+
+           if (tp) {
+              if (iflag) {
+                 ival = atoi(val);
+                 for(ep = tp->enums; ep; ep = ep->next) {
+                    if (ep->value == ival) {
+                       RETVAL = ep->label;
+                       break;
+                    }
+                 }
+              } else {
+                 for(ep = tp->enums; ep; ep = ep->next) {
+                    if (strEQ(ep->label, val)) {
+                       sprintf(str_buf,"%d", ep->value);
+                       RETVAL = str_buf;
+                       break;
+                    }
+                 }
+              }
+           }
+	}
+	OUTPUT:
+        RETVAL
+
+#define SNMP_XLATE_MODE_OID2TAG 1
+#define SNMP_XLATE_MODE_TAG2OID 0
+
+char *
+snmp_translate_obj(var,mode,use_long,auto_init,best_guess)
+	char *		var
+	int		mode
+	int		use_long
+	int		auto_init
+	int             best_guess
+	CODE:
+	{
+	   char str_buf[STR_BUF_SIZE];
+	   oid oid_arr[MAX_OID_LEN];
+           int oid_arr_len = MAX_OID_LEN;
+           char * label;
+           char * iid;
+           int status = FAILURE;
+           int verbose = SvIV(perl_get_sv("SNMP::verbose", 0x01 | 0x04));
+
+           str_buf[0] = '\0';
+  	   switch (mode) {
+              case SNMP_XLATE_MODE_TAG2OID:
+		if (!__tag2oid(var, NULL, oid_arr, &oid_arr_len, NULL, best_guess)) {
+		   if (verbose) warn("error:snmp_translate_obj:Unknown OID %s\n",var);
+                } else {
+                   status = __sprint_num_objid(str_buf, oid_arr, oid_arr_len);
+                }
+                break;
+             case SNMP_XLATE_MODE_OID2TAG:
+		oid_arr_len = 0;
+		__concat_oid_str(oid_arr, &oid_arr_len, var);
+		snprint_objid(str_buf, sizeof(str_buf), oid_arr, oid_arr_len);
+		if (!use_long) {
+                  label = NULL; iid = NULL;
+		  if (((status=__get_label_iid(str_buf,
+		       &label, &iid, NO_FLAGS)) == SUCCESS)
+		      && label) {
+		     strcpy(str_buf, label);
+		     if (iid && *iid) {
+		       strcat(str_buf, ".");
+		       strcat(str_buf, iid);
+		     }
+ 	          }
+	        }
+                break;
+             default:
+	       if (verbose) warn("snmp_translate_obj:unknown translation mode: %s\n", mode);
+           }
+           if (*str_buf) {
+              RETVAL = (char*)str_buf;
+           } else {
+              RETVAL = (char*)NULL;
+           }
+	}
+        OUTPUT:
+        RETVAL
+
+void
+snmp_set_replace_newer(val)
+	int val
+	CODE:
+	{
+	   netsnmp_ds_toggle_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_MIB_REPLACE);
+	}
+
+void
+snmp_set_save_descriptions(val)
+	int	val
+	CODE:
+	{
+	   snmp_set_save_descriptions(val);
+	}
+
+void
+snmp_set_debugging(val)
+	int	val
+	CODE:
+	{
+	   snmp_set_do_debugging(val);
+	}
+
+void
+snmp_debug_internals(val)
+	int     val
+	CODE:
+	{
+#ifdef		DEBUGGING
+	   _debug_level = val;
+#endif		/* DEBUGGING */
+	}
+
+
+void
+snmp_sock_cleanup()
+	CODE:
+	{
+	   SOCK_CLEANUP;
+	}
+
+void
+snmp_mainloop_finish()
+	CODE:
+	{
+	    mainloop_finish = 1;
+	}
+
+
+void
+snmp_main_loop(timeout_sec,timeout_usec,perl_callback)
+	int 	timeout_sec
+	int 	timeout_usec
+	SV *	perl_callback
+	CODE:
+	{
+        int numfds, fd_count;
+        fd_set fdset;
+        struct timeval time_val, *tvp;
+        struct timeval last_time, *ltvp;
+        struct timeval ctimeout, *ctvp;
+        struct timeval interval, *itvp;
+        int block;
+	SV *cb;
+
+
+ 	mainloop_finish = 0;
+
+	itvp = &interval;
+	itvp->tv_sec = timeout_sec;
+	itvp->tv_usec = timeout_usec;
+        ctvp = &ctimeout;
+        ctvp->tv_sec = -1;
+        ltvp = &last_time;
+        gettimeofday(ltvp,(struct timezone*)0);
+	timersub(ltvp,itvp,ltvp);
+        while (1) {
+           numfds = 0;
+           FD_ZERO(&fdset);
+           block = 1;
+           tvp = &time_val;
+           timerclear(tvp);
+           snmp_select_info(&numfds, &fdset, tvp, &block);
+           __recalc_timeout(tvp,ctvp,ltvp,itvp,&block);
+           # printf("pre-select: numfds = %ld, block = %ld\n", numfds, block);
+           if (block == 1) tvp = NULL; /* block without timeout */
+           fd_count = select(numfds, &fdset, 0, 0, tvp);
+           #printf("post-select: fd_count = %ld,block = %ld\n",fd_count,block);
+           if (fd_count > 0) {
+                       dSP;
+                       ENTER;
+                       SAVETMPS;
+              snmp_read(&fdset);
+                       FREETMPS;
+                       LEAVE;
+
+           } else switch(fd_count) {
+              case 0:
+		 SPAGAIN;
+		 ENTER;
+		 SAVETMPS;
+                 snmp_timeout();
+                 if (!timerisset(ctvp)) {
+                    if (SvTRUE(perl_callback)) {
+                       /* sv_2mortal(perl_callback); */
+                       cb = __push_cb_args(perl_callback, NULL);
+                       __call_callback(cb, G_DISCARD);
+                       ctvp->tv_sec = -1;
+
+                    } else {
+                       FREETMPS;
+                       LEAVE;
+                       goto done;
+                    }
+                 }
+                 FREETMPS;
+                 LEAVE;
+                 break;
+              case -1:
+                 if (errno == EINTR) {
+                    continue;
+                 } else {
+                    /* snmp_set_detail(strerror(errno)); */
+                    /* snmp_errno = SNMPERR_GENERR; */
+                 }
+              default:;
+           }
+
+	   /* A call to snmp_mainloop_finish() in the callback sets the
+	   ** mainloop_finish flag.  Exit the loop after the callback returns.
+	   */
+	   if (mainloop_finish)
+	      goto done;
+
+        }
+     done:
+           return;
+	}
+
+
+void
+snmp_get_select_info()
+	PPCODE:
+	{
+        int numfds;
+        fd_set fdset;
+        struct timeval time_val, *tvp;
+        int block;
+	int i;
+
+        numfds = 0;
+        block = 1;
+        tvp = &time_val;
+        FD_ZERO(&fdset);
+        snmp_select_info(&numfds, &fdset, tvp, &block);
+	XPUSHs(sv_2mortal(newSViv(block)));
+	if(block){
+            XPUSHs(sv_2mortal(newSViv(0)));
+            XPUSHs(sv_2mortal(newSViv(0)));
+	} else {
+            XPUSHs(sv_2mortal(newSViv(tvp->tv_sec)));
+            XPUSHs(sv_2mortal(newSViv(tvp->tv_usec)));
+	}
+	if ( numfds ) {
+            for(i=0; i<numfds ; i++) {
+                if(FD_ISSET(i, &fdset)){
+                    XPUSHs(sv_2mortal(newSViv(i)));
+                }
+            }
+	} else {
+            XPUSHs(&sv_undef);  /* no mem or bad args */
+	}
+	}
+
+void
+snmp_read_on_fd(fd)
+	int fd
+	CODE:
+	{
+           fd_set fdset;
+
+           FD_ZERO(&fdset);
+           FD_SET(fd, &fdset);
+
+           snmp_read(&fdset);
+	}
+
+void
+snmp_check_timeout()
+	CODE:
+	{
+          snmp_timeout();
+	}
+
+MODULE = SNMP	PACKAGE = SNMP::MIB::NODE 	PREFIX = snmp_mib_node_
+SV *
+snmp_mib_node_TIEHASH(class,key,tp=0)
+	char *	class
+	char *	key
+        IV tp
+	CODE:
+	{
+            __libraries_init("perl");
+           if (!tp) tp = (IV)__tag2oid(key, NULL, NULL, NULL, NULL,0);
+           if (tp) {
+              ST(0) = sv_newmortal();
+              sv_setref_iv(ST(0), class, tp);
+           } else {
+              ST(0) = &sv_undef;
+           }
+
+	}
+
+SV *
+snmp_mib_node_FETCH(tp_ref, key)
+	SV *	tp_ref
+	char *	key
+	CODE:
+	{
+	   char c = *key;
+	   char str_buf[STR_BUF_SIZE];
+           SnmpMibNode *tp = NULL;
+           struct index_list *ip;
+           struct enum_list *ep;
+           struct range_list *rp;
+	   struct varbind_list *vp;
+           struct module *mp;
+           SV *child_list_aref, *next_node_href, *mib_tied_href = NULL;
+	   SV **nn_hrefp;
+           HV *mib_hv, *enum_hv, *range_hv;
+           AV *index_av, *varbind_av, *ranges_av;
+           MAGIC *mg = NULL;
+
+           if (SvROK(tp_ref)) tp = (SnmpMibNode*)SvIV((SV*)SvRV(tp_ref));
+
+	   ST(0) = sv_newmortal();
+           if (tp)
+	   switch (c) {
+	      case 'a': /* access */
+                  if (strncmp("access", key, strlen(key)) == 0) {
+                 switch	(tp->access) {
+                   case MIB_ACCESS_READONLY:
+                     sv_setpv(ST(0),"ReadOnly");
+                     break;
+                   case MIB_ACCESS_READWRITE:
+                     sv_setpv(ST(0),"ReadWrite");
+                     break;
+                   case MIB_ACCESS_WRITEONLY:
+                     sv_setpv(ST(0),"WriteOnly");
+                     break;
+                   case MIB_ACCESS_NOACCESS:
+                     sv_setpv(ST(0),"NoAccess");
+                     break;
+                   case MIB_ACCESS_NOTIFY:
+                     sv_setpv(ST(0),"Notify");
+                     break;
+                   case MIB_ACCESS_CREATE:
+                     sv_setpv(ST(0),"Create");
+                     break;
+                   default:
+                     break;
+                 }
+                  } else if (strncmp("augments", key, strlen(key)) == 0) {
+                      sv_setpv(ST(0),tp->augments);
+                  }
+                 break;
+  	      case 'c': /* children */
+                 if (strncmp("children", key, strlen(key))) break;
+                 child_list_aref = newRV((SV*)newAV());
+                 for (tp = tp->child_list; tp; tp = tp->next_peer) {
+                    mib_hv = perl_get_hv("SNMP::MIB", FALSE);
+                    if (SvMAGICAL(mib_hv)) mg = mg_find((SV*)mib_hv, 'P');
+                    if (mg) mib_tied_href = (SV*)mg->mg_obj;
+                    next_node_href = newRV((SV*)newHV());
+                    __tp_sprint_num_objid(str_buf, tp);
+                    nn_hrefp = hv_fetch((HV*)SvRV(mib_tied_href),
+                                        str_buf, strlen(str_buf), 1);
+                    if (!SvROK(*nn_hrefp)) {
+                       sv_setsv(*nn_hrefp, next_node_href);
+                       ENTER ;
+                       SAVETMPS ;
+                       PUSHMARK(sp) ;
+                       XPUSHs(SvRV(*nn_hrefp));
+                       XPUSHs(sv_2mortal(newSVpv("SNMP::MIB::NODE",0)));
+                       XPUSHs(sv_2mortal(newSVpv(str_buf,0)));
+                       XPUSHs(sv_2mortal(newSViv((IV)tp)));
+                       PUTBACK ;
+                       perl_call_pv("SNMP::_tie",G_VOID);
+                       /* pp_tie(ARGS); */
+                       SPAGAIN ;
+                       FREETMPS ;
+                       LEAVE ;
+                    } /* if SvROK */
+                    av_push((AV*)SvRV(child_list_aref), *nn_hrefp);
+                 } /* for child_list */
+                 sv_setsv(ST(0), child_list_aref);
+                 break;
+	      case 'v':
+	         if (strncmp("varbinds", key, strlen(key))) break;
+		 varbind_av = newAV();
+		 for (vp = tp->varbinds; vp; vp = vp->next) {
+	            av_push(varbind_av, newSVpv((vp->vblabel),strlen(vp->vblabel)));
+		 }
+		 sv_setsv(ST(0), newRV((SV*)varbind_av));
+		 break;
+	      case 'd': /* description */
+                  if (strncmp("description", key, strlen(key))) {
+                      if(!(strncmp("defaultValue",key,strlen(key)))) {
+                          /* We're looking at defaultValue */
+                          sv_setpv(ST(0), tp->defaultValue);
+                          break;
+                      } /* end if */
+                  } /* end if */
+	          /* we must be looking at description */
+                 sv_setpv(ST(0),tp->description);
+                 break;
+              case 'i': /* indexes */
+                 if (strncmp("indexes", key, strlen(key))) break;
+                 index_av = newAV();
+                 for(ip=tp->indexes; ip != NULL; ip = ip->next) {
+                    av_push(index_av,newSVpv((ip->ilabel),strlen(ip->ilabel)));
+                 }
+                sv_setsv(ST(0), newRV((SV*)index_av));
+                break;
+	      case 'l': /* label */
+                 if (strncmp("label", key, strlen(key))) break;
+                 sv_setpv(ST(0),tp->label);
+                 break;
+	      case 'm': /* moduleID */
+                 if (strncmp("moduleID", key, strlen(key))) break;
+                 mp = find_module(tp->modid);
+                 if (mp) sv_setpv(ST(0), mp->name);
+                 break;
+	      case 'n': /* nextNode */
+                 if (strncmp("nextNode", key, strlen(key))) break;
+                 tp = __get_next_mib_node(tp);
+                 if (tp == NULL) {
+                    sv_setsv(ST(0), &sv_undef);
+                    break;
+                 }
+                 mib_hv = perl_get_hv("SNMP::MIB", FALSE);
+                 if (SvMAGICAL(mib_hv)) mg = mg_find((SV*)mib_hv, 'P');
+                 if (mg) mib_tied_href = (SV*)mg->mg_obj;
+                 __tp_sprint_num_objid(str_buf, tp);
+
+                 nn_hrefp = hv_fetch((HV*)SvRV(mib_tied_href),
+                                     str_buf, strlen(str_buf), 1);
+                 /* if (!SvROK(*nn_hrefp)) { */ /* bug in ucd - 2 .0.0 nodes */
+                 next_node_href = newRV((SV*)newHV());
+                 sv_setsv(*nn_hrefp, next_node_href);
+                 ENTER ;
+                 SAVETMPS ;
+                 PUSHMARK(sp) ;
+                 XPUSHs(SvRV(*nn_hrefp));
+                 XPUSHs(sv_2mortal(newSVpv("SNMP::MIB::NODE",0)));
+                 XPUSHs(sv_2mortal(newSVpv(str_buf,0)));
+                 XPUSHs(sv_2mortal(newSViv((IV)tp)));
+                 PUTBACK ;
+                 perl_call_pv("SNMP::_tie",G_VOID);
+                 /* pp_tie(ARGS); */
+                 SPAGAIN ;
+                 FREETMPS ;
+                 LEAVE ;
+                 /* } */
+                 sv_setsv(ST(0), *nn_hrefp);
+                 break;
+	      case 'o': /* objectID */
+                 if (strncmp("objectID", key, strlen(key))) break;
+                 __tp_sprint_num_objid(str_buf, tp);
+                 sv_setpv(ST(0),str_buf);
+                 break;
+	      case 'p': /* parent */
+                 if (strncmp("parent", key, strlen(key))) break;
+                 tp = tp->parent;
+                 if (tp == NULL) {
+                    sv_setsv(ST(0), &sv_undef);
+                    break;
+                 }
+                 mib_hv = perl_get_hv("SNMP::MIB", FALSE);
+                 if (SvMAGICAL(mib_hv)) mg = mg_find((SV*)mib_hv, 'P');
+                 if (mg) mib_tied_href = (SV*)mg->mg_obj;
+                 next_node_href = newRV((SV*)newHV());
+                 __tp_sprint_num_objid(str_buf, tp);
+                 nn_hrefp = hv_fetch((HV*)SvRV(mib_tied_href),
+                                     str_buf, strlen(str_buf), 1);
+                 if (!SvROK(*nn_hrefp)) {
+                 sv_setsv(*nn_hrefp, next_node_href);
+                 ENTER ;
+                 SAVETMPS ;
+                 PUSHMARK(sp) ;
+                 XPUSHs(SvRV(*nn_hrefp));
+                 XPUSHs(sv_2mortal(newSVpv("SNMP::MIB::NODE",0)));
+                 XPUSHs(sv_2mortal(newSVpv(str_buf,0)));
+                 XPUSHs(sv_2mortal(newSViv((IV)tp)));
+                 PUTBACK ;
+                 perl_call_pv("SNMP::_tie",G_VOID);
+                 /* pp_tie(ARGS); */
+                 SPAGAIN ;
+                 FREETMPS ;
+                 LEAVE ;
+                 }
+                 sv_setsv(ST(0), *nn_hrefp);
+                 break;
+	      case 'r': /* ranges */
+                 if (strncmp("ranges", key, strlen(key))) break;
+                 ranges_av = newAV();
+                 for(rp=tp->ranges; rp ; rp = rp->next) {
+		   range_hv = newHV();
+                   hv_store(range_hv, "low", strlen("low"), newSViv(rp->low), 0);
+                   hv_store(range_hv, "high", strlen("high"), newSViv(rp->high), 0);
+		   av_push(ranges_av, newRV((SV*)range_hv));
+                 }
+                 sv_setsv(ST(0), newRV((SV*)ranges_av));
+                 break;
+	      case 's': /* subID */
+                 if (strncmp("subID", key, strlen(key))) {
+                   if (strncmp("status", key, strlen(key))) {
+                      if (strncmp("syntax", key, strlen(key))) break;
+                      if (tp->tc_index >= 0) {
+                         sv_setpv(ST(0), get_tc_descriptor(tp->tc_index));
+                      } else {
+                         __get_type_str(tp->type, str_buf);
+                         sv_setpv(ST(0), str_buf);
+                      }
+                      break;
+                   }
+
+                   switch(tp->status) {
+                     case MIB_STATUS_MANDATORY:
+                       sv_setpv(ST(0),"Mandatory");
+                       break;
+                     case MIB_STATUS_OPTIONAL:
+                       sv_setpv(ST(0),"Optional");
+                       break;
+                     case MIB_STATUS_OBSOLETE:
+                       sv_setpv(ST(0),"Obsolete");
+                       break;
+                     case MIB_STATUS_DEPRECATED:
+                       sv_setpv(ST(0),"Deprecated");
+                       break;
+		     case MIB_STATUS_CURRENT:
+                       sv_setpv(ST(0),"Current");
+                       break;
+                     default:
+                       break;
+                   }
+                 } else {
+                   sv_setiv(ST(0),(I32)tp->subid);
+                 }
+                 break;
+	      case 't': /* type */
+                 if (strncmp("type", key, strlen(key))) {
+                    if (strncmp("textualConvention", key, strlen(key))) break;
+                    sv_setpv(ST(0), get_tc_descriptor(tp->tc_index));
+                    break;
+                 }
+                 __get_type_str(tp->type, str_buf);
+                 sv_setpv(ST(0), str_buf);
+                 break;
+	      case 'u': /* units */
+                 if (strncmp("units", key, strlen(key))) break;
+                 sv_setpv(ST(0),tp->units);
+                 break;
+	      case 'h': /* hint */
+                 if (strncmp("hint", key, strlen(key))) break;
+                 sv_setpv(ST(0),tp->hint);
+                 break;
+	      case 'e': /* enums */
+                 if (strncmp("enums", key, strlen(key))) break;
+                 enum_hv = newHV();
+                 for(ep=tp->enums; ep != NULL; ep = ep->next) {
+                   hv_store(enum_hv, ep->label, strlen(ep->label),
+                                newSViv(ep->value), 0);
+                 }
+                 sv_setsv(ST(0), newRV((SV*)enum_hv));
+                 break;
+              default:
+                 break;
+	   }
+	}
+
+MODULE = SNMP	PACKAGE = SnmpSessionPtr	PREFIX = snmp_session_
+void
+snmp_session_DESTROY(sess_ptr)
+	SnmpSession *sess_ptr
+	CODE:
+	{
+           snmp_close( sess_ptr );
+	}
+
diff -Naur tomato/release/src/router/snmp/perl/SNMP/t/async.t tomato121/release/src/router/snmp/perl/SNMP/t/async.t
--- tomato/release/src/router/snmp/perl/SNMP/t/async.t	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/perl/SNMP/t/async.t	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,157 @@
+#!./perl
+
+BEGIN {
+    unless(grep /blib/, @INC) {
+        chdir 't' if -d 't';
+        @INC = '../lib' if -d '../lib';
+    }
+}
+
+use Test;
+BEGIN {plan tests => 20}
+use SNMP;
+use vars qw($agent_port $comm $agent_host);
+require "t/startagent.pl";
+
+
+sub cb1; # forward reference
+sub cb2;
+sub cb3;
+sub cb4;
+sub cb5;
+sub cb6;
+sub cb7;
+sub cbDummy;
+
+$SNMP::verbose = 0;
+$SNMP::dump_packet = 0;
+
+my $sess = new SNMP::Session(DestHost => $agent_host, 
+			  Version => 1, 
+			  Community => $comm, 
+			  RemotePort => $agent_port);
+
+# try getting unregistered OID.
+my $result = $sess->get([["HooHaaHooHaa","0"]], [\&cbDummy, $sess]);
+ok(!defined($result));
+
+# this get should work
+$result = $sess->get([["sysDescr","0"]], [\&cb1, $sess]);
+ok($result);
+
+SNMP::MainLoop();
+
+sub cb1{
+    my $sess = shift;
+    my $vlist = shift;
+
+    ok(defined($vlist));
+    my $tag = $vlist->[0]->tag;
+    ok($tag eq 'sysDescr');
+    my $val = $vlist->[0]->val;
+    ok(defined $val);
+    my $iid = $vlist->[0]->iid;
+    my $type = $vlist->[0]->type;
+    ok($type eq 'OCTETSTR');
+    my $res = $sess->getnext([["sysDescr",0]], [\&cb2, $sess]);
+    ok ($res);
+} # end of cb1
+
+sub cb2{
+    my $sess = shift;
+    my $vlist = shift;
+
+    ok(defined($vlist));
+    ok(ref($vlist->[0]) =~ /Varbind/);
+    ok($vlist->[0][0] eq 'sysObjectID');
+    my $res = $sess->get([[".1.3.6.1.2.1.1.1.0"]], [\&cb3, $sess]);
+    ok($res);
+} # end of cb2
+
+sub cb3{
+    my $sess = shift;
+    my $vlist = shift;
+
+    ok(defined($vlist));
+
+    ok($vlist->[0][0] eq 'sysDescr');
+
+    my $res = $sess->getnext([["sysDescr",0]], [\&cb4, $sess]);
+    ok($res);
+} # end of cb3
+
+sub cb4{
+    my $sess = shift;
+    my $vlist = shift;
+
+    ok(defined $vlist);
+    my $res = $sess->set("sysDescr.0", "hahaha", [\&cb5, $sess]);
+} # end of cb4
+
+sub cb5{
+    my $sess = shift;
+    my $vlist = shift;
+
+    ok(defined($vlist));
+
+    my $res = $sess->set("sysORID.1", ".1.3.6.1.2.1.1.1", [\&cb6, $sess]);
+    ok(defined $res);
+} # end of cb5
+
+sub cb6{
+    my $sess = shift;
+    my $vlist = shift;
+    my $tag = $vlist->[0]->tag;
+    my $val = $vlist->[0]->val;
+
+    ok($tag =~ /^sysORID/);
+# create list of varbinds for GETS, val field can be null or omitted
+    my $vars =
+	new SNMP::VarList (
+			   ['sysDescr', '0', ''],
+			   ['sysObjectID', '0'],
+			   ['sysUpTime', '0'],
+			   ['sysContact', '0'],
+			   ['sysName', '0'],
+			   ['sysLocation', '0'],
+			   ['sysServices', '0'],
+			   ['ifNumber', '0'],
+			   ['ifDescr', '1'],
+			   ['ifSpeed', '1'],
+			   ['snmpInPkts', '0'],
+			   ['snmpInBadVersions', '0'],
+			   ['snmpInBadCommunityNames', '0'],
+			   ['snmpInBadCommunityUses', '0'],
+			   ['snmpInASNParseErrs', '0'],
+			   ['snmpEnableAuthenTraps', '0'],
+			   ['sysORID', '1'],
+			   ['sysORDescr', '1'],
+			   ['sysORUpTime', '1'],
+			   ['sysORLastChange', '0'],
+			   ['ipInHdrErrors', '0'],
+			   ['ipDefaultTTL', '0'],
+			   ['ipInHdrErrors', '0'],
+			   );
+    my $res = $sess->get($vars, [\&cb7, $sess]);
+    ok(defined $res);
+} # end of cb6
+
+sub cb7{
+    my $sess = shift;
+    my $vlist = shift;
+
+
+    my $tag = $vlist->[0]->tag;
+    my $val = $vlist->[0]->val;
+
+    ok(@{$vlist} == 23);
+
+    snmptest_cleanup();
+
+    exit(0);
+} # end of cb7
+
+sub cbDummy {
+    warn("error: this should not get called");
+}
+
diff -Naur tomato/release/src/router/snmp/perl/SNMP/t/bulkwalk.t tomato121/release/src/router/snmp/perl/SNMP/t/bulkwalk.t
--- tomato/release/src/router/snmp/perl/SNMP/t/bulkwalk.t	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/perl/SNMP/t/bulkwalk.t	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,214 @@
+#!/usr/local/bin/perl
+#
+# $Id: bulkwalk.t,v 1.1.2.1 2004/06/20 21:54:58 nikki Exp $
+#
+# Test bulkwalk functionality.
+use Data::Dumper;
+
+BEGIN {
+    unless(grep /blib/, @INC) {
+        chdir 't' if -d 't';
+        @INC = '../lib' if -d '../lib';
+    }
+}
+use Test;
+BEGIN { $num = 62; plan test => $num; }
+
+use SNMP;
+
+require "t/startagent.pl";
+
+use vars qw($agent_port $comm2 $agent_host);
+
+$SNMP::debugging = 0;
+$SNMP::verbose = 0;
+
+#print "1..$num\n";
+
+######################################################################
+# Fire up a session.
+$s1 = new SNMP::Session(
+    'DestHost'   => $agent_host,
+    'Community'  => $comm2,
+    'RemotePort' => $agent_port,
+    'Version'    => '2c',
+    'UseNumeric' => 1,
+    'UseEnum'    => 0,
+    'UseLongNames' => 1
+);
+ok(defined($s1));
+
+######################################################################
+# 
+# Attempt to use the bulkwalk method to get a few variables from the
+# SNMP agent.
+# test 1
+$vars = new SNMP::VarList ( ['sysUpTime'], ['ifNumber'], # NON-repeaters
+			    ['ifSpeed'], ['ifDescr']);	 # Repeated variables.
+
+$expect = scalar @$vars;
+@list = $s1->bulkwalk(2, 16, $vars);
+
+ok($s1->{ErrorNum} == 0);
+
+# Did we get back the list of references to returned values?
+#
+ok(scalar @list == $expect);
+
+# Sanity check the returned values.  list[0] is sysUptime nonrepeater.
+ok($list[0][0]->tag eq ".1.3.6.1.2.1.1.3");	# check system.sysUptime OID
+ok($list[0][0]->iid eq "0");			# check system.sysUptime.0 IID
+ok($list[0][0]->val =~ m/^\d+$/);		# Uptime is numeric 
+ok($list[0][0]->type eq "TICKS");		# Uptime should be in ticks.
+
+# Find out how many interfaces to expect.  list[1] is ifNumber nonrepeater.
+ok($list[1][0]->tag eq ".1.3.6.1.2.1.2.1");	# Should be system.ifNumber OID.
+ok($list[1][0]->iid eq "0");			# system.ifNumber.0 IID.
+ok($list[1][0]->val =~ m/^\d+$/);		# Number is all numeric 
+#XXX: test fails due SMIv1 codes being returned intstead of SMIv2...
+#ok($list[1][0]->type eq "INTEGER32");		# Number should be integer.
+
+$ifaces = $list[1][0]->val;
+
+# Make sure we got an ifSpeed for each interface.  list[2] is ifSpeed repeater.
+ok(scalar @{$list[2]} == $ifaces);
+
+# Make sure we got an ifDescr for each interface.  list[3] is ifDescr repeater.
+ok(scalar @{$list[3]} == $ifaces);
+
+# Test for reasonable values from the agent.
+ok($list[2][0]->tag eq ".1.3.6.1.2.1.2.2.1.5");	# Should be system.ifSpeed OID.
+ok($list[2][0]->iid eq "1");			# Instance should be 1.
+ok($list[2][0]->val =~ m/^\d+$/);		# Number is all numeric 
+ok($list[2][0]->type eq "GAUGE");		# Number should be a gauge.
+
+ok($list[3][0]->tag eq ".1.3.6.1.2.1.2.2.1.2");	# Should be system.ifDescr OID.
+ok($list[3][0]->iid eq "1");			# Instance should be 1.
+
+# The first interface is probably loopback.  Check this.
+ok($list[3][0]->type eq "OCTETSTR");		# Description is a string.
+
+# This might fail for some weird (Windows?) systems.  Can be safely ignored.
+$loopback = $list[3][0]->val;
+ok(($loopback =~ /^lo/));
+
+###############################################################################
+# Attempt to use the bulkwalk method to get only non-repeaters
+# test 2
+$vars = new SNMP::VarList ( ['sysUpTime'], ['ifNumber'] ); # NON-repeaters
+
+$expect = scalar @$vars;
+@list = $s1->bulkwalk(2, 16, $vars);
+ok($s1->{ErrorNum} == 0);
+
+# Did we get back the list of references to returned values?
+#
+ok(scalar @list == $expect);
+
+# Sanity check the returned values.  list[0] is sysUptime nonrepeater.
+ok($list[0][0]->tag eq ".1.3.6.1.2.1.1.3");	# check system.sysUptime OID
+ok($list[0][0]->iid eq "0");			# check system.sysUptime.0 IID
+ok($list[0][0]->val =~ m/^\d+$/);		# Uptime is numeric 
+ok($list[0][0]->type eq "TICKS");		# Uptime should be in ticks.
+
+# Find out how many interfaces to expect.  list[1] is ifNumber nonrepeater.
+ok($list[1][0]->tag eq ".1.3.6.1.2.1.2.1");	# Should be system.ifNumber OID.
+ok($list[1][0]->iid eq "0");			# system.ifNumber.0 IID.
+ok($list[1][0]->val =~ m/^\d+$/);		# Number is all numeric 
+#XXX: test fails due SMIv1 codes being returned intstead of SMIv2...
+#ok($list[1][0]->type eq "INTEGER32");		# Number should be integer.
+$ifaces = $list[1][0]->val;
+
+
+###############################################################################
+# Attempt to use the bulkwalk method to get only repeated variables
+# test 3
+$vars = new SNMP::VarList ( ['ifIndex'], ['ifSpeed'] ); # repeaters
+
+$expect = scalar @$vars;
+@list = $s1->bulkwalk(0, 16, $vars);
+ok($s1->{ErrorNum} == 0);
+
+# Did we get back the list of references to returned values?
+#
+ok(scalar @list == $expect);
+
+# Make sure we got an ifIndex for each interface.  list[0] is ifIndex repeater.
+ok(scalar @{$list[0]} == $ifaces);
+
+# Make sure we got an ifSpeed for each interface.  list[0] is ifSpeed repeater.
+ok(scalar @{$list[1]} == $ifaces);
+
+# Test for reasonable values from the agent.
+ok($list[0][0]->tag eq ".1.3.6.1.2.1.2.2.1.1");	# Should be system.ifIndex OID.
+ok($list[0][0]->iid eq "1");			# Instance should be 1.
+ok($list[0][0]->val =~ m/^\d+$/);		# Number is all numeric 
+#XXX: test fails due SMIv1 codes being returned intstead of SMIv2...
+#ok($list[0][0]->type eq "INTEGER32");		# Number should be an integer.
+
+ok($list[1][0]->tag eq ".1.3.6.1.2.1.2.2.1.5");	# Should be system.ifSpeed OID.
+ok($list[1][0]->iid eq "1");			# Instance should be 1.
+ok($list[1][0]->val =~ m/^\d+$/);		# Number is all numeric 
+ok($list[1][0]->type eq "GAUGE");		# Number should be a gauge.
+
+######################################################################
+#  Asynchronous Bulkwalk Methods
+######################################################################
+# 
+# Attempt to use the bulkwalk method to get a few variables from the
+# SNMP agent.
+# test 4
+sub async_cb1 {
+    my ($vars, $list) = @_;
+    ok(defined $list && ref($list) =~ m/ARRAY/);
+    ok(defined $vars && ref($vars) =~ m/SNMP::VarList/);
+
+    ok(scalar @$list == scalar @$vars);
+
+    my $vbr;
+
+    # Sanity check the returned values.  First is sysUptime nonrepeater.
+    $vbr = $list->[0][0];
+    ok($vbr->tag eq ".1.3.6.1.2.1.1.3");	# check system.sysUptime OID
+    ok($vbr->iid eq "0");			# check system.sysUptime.0 IID
+    ok($vbr->val =~ m/^\d+$/);			# Uptime is numeric 
+    ok($vbr->type eq "TICKS");			# Uptime should be in ticks.
+
+    # Find out how many interfaces to expect.  Next is ifNumber nonrepeater.
+    $vbr = $list->[1][0];
+    ok($vbr->tag eq ".1.3.6.1.2.1.2.1");	# Should be system.ifNumber OID.
+    ok($vbr->iid eq "0");			# system.ifNumber.0 IID.
+    ok($vbr->val =~ m/^\d+$/);			# Number is all numeric 
+#XXX: test fails due SMIv1 codes being returned intstead of SMIv2...
+#    ok($vbr->type eq "INTEGER32");		# Number should be integer.
+    $ifaces = $vbr->[2];
+
+    # Test for reasonable values from the agent.
+    ok(scalar @{$list->[2]} == $ifaces);
+    $vbr = $list->[2][0];
+    ok($vbr->tag eq ".1.3.6.1.2.1.2.2.1.5");	# Should be ifSpeed OID
+    ok($vbr->iid eq "1");			# Instance should be 1.
+    ok($vbr->val =~ m/^\d+$/);			# Number is all numeric 
+    ok($vbr->type eq "GAUGE");			# Should be a gauge.
+
+    ok(scalar @{$list->[3]} == $ifaces);
+    $vbr = $list->[3][0];
+    ok($vbr->tag eq ".1.3.6.1.2.1.2.2.1.2");	# Should be ifDescr OID
+    ok($vbr->iid eq "1");			# Instance should be 1.
+
+    # The first interface is probably loopback.  Check this.
+    ok($vbr->type eq "OCTETSTR");
+
+    # This might fail for some weird (Windows?) systems.  Can be safely ignored.
+    ok(($vbr->val =~ /^lo/));
+
+    SNMP::finish();
+}
+
+$vars = new SNMP::VarList ( ['sysUpTime'], ['ifNumber'], # NON-repeaters
+			    ['ifSpeed'], ['ifDescr']);	 # Repeated variables.
+
+@list = $s1->bulkwalk(2, 16, $vars, [ \&async_cb1, $vars ] );
+ok($s1->{ErrorNum} == 0);
+SNMP::MainLoop();
+ok(1);
diff -Naur tomato/release/src/router/snmp/perl/SNMP/t/conf.t tomato121/release/src/router/snmp/perl/SNMP/t/conf.t
--- tomato/release/src/router/snmp/perl/SNMP/t/conf.t	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/perl/SNMP/t/conf.t	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,50 @@
+#!./perl
+
+BEGIN {
+    unless(grep /blib/, @INC) {
+        chdir 't' if -d 't';
+        @INC = '../lib' if -d '../lib';
+    }
+}
+
+# This merely checks to see if the default_store routines work from
+# read configuration files.  Functionally, if this fails then it's a
+# serious problem because they linked with static libraries instead of
+# shared ones as the memory space is different.
+
+use Test;
+BEGIN {plan tests => 3}
+
+$ENV{'SNMPCONFPATH'} = ".:t";
+
+ok(1); # just start up
+
+use SNMP;
+use NetSNMP::default_store(':all');
+
+# should be 0, as it's un-initialized
+$myint = netsnmp_ds_get_int(NETSNMP_DS_LIBRARY_ID, 
+			    NETSNMP_DS_LIB_NUMERIC_TIMETICKS);
+
+ok($myint == 0);
+
+SNMP::init_snmp("conftest");
+
+$myint = netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID,
+				NETSNMP_DS_LIB_NUMERIC_TIMETICKS);
+
+# ok, should be 1 as it's initalized by the snmp.conf config file.
+ok($myint == 1);
+
+# this is a pretty major error, so if it's not true we really really
+# print a big big warning.  Technically, I suspect this is a bad thing
+# to do in perl tests but...
+if ($myint != 1) {
+    die "\n\n\n" . "*" x 75 . "\nBIG PROBLEM: I wasn't able to read
+    data from a configuration file.  This likely means that you've
+    complied th net-snmp package with static libraries, which can
+    cause real problems with the perl module.  Please reconfigure your
+    net-snmp package for use with shared libraries (run configure with
+    --enable-shared)\n" . "*" x 75 . "\n\n\n\n";
+}
+
diff -Naur tomato/release/src/router/snmp/perl/SNMP/t/conftest.conf tomato121/release/src/router/snmp/perl/SNMP/t/conftest.conf
--- tomato/release/src/router/snmp/perl/SNMP/t/conftest.conf	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/perl/SNMP/t/conftest.conf	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,2 @@
+[snmp]
+numericTimeticks 1
diff -Naur tomato/release/src/router/snmp/perl/SNMP/t/.cvsignore tomato121/release/src/router/snmp/perl/SNMP/t/.cvsignore
--- tomato/release/src/router/snmp/perl/SNMP/t/.cvsignore	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/perl/SNMP/t/.cvsignore	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,3 @@
+snmpd.pid
+snmptest.cmd
+snmptest.log
diff -Naur tomato/release/src/router/snmp/perl/SNMP/t/getnext.t tomato121/release/src/router/snmp/perl/SNMP/t/getnext.t
--- tomato/release/src/router/snmp/perl/SNMP/t/getnext.t	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/perl/SNMP/t/getnext.t	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,99 @@
+#!./perl
+
+BEGIN {
+    unless(grep /blib/, @INC) {
+        chdir 't' if -d 't';
+        @INC = '../lib' if -d '../lib';
+    }
+}
+
+use Test;
+BEGIN { plan tests => 9 }
+use SNMP;
+use vars qw($agent_port $comm $agent_host);
+require "t/startagent.pl";
+
+
+my $junk_oid = ".1.3.6.1.2.1.1.1.1.1.1";
+my $oid = '.1.3.6.1.2.1.1.1';
+my $junk_name = 'fooDescr';
+my $junk_host = 'no.host.here';
+my $name = "gmarzot\@nortelnetworks.com";
+
+$SNMP::debugging = 0;
+my $n = 9;  # Number of tests to run
+
+#print "1..$n\n";
+#if ($n == 0) { exit 0; }
+
+# create list of varbinds for GETS, val field can be null or omitted
+my $vars = new SNMP::VarList (
+			   ['sysDescr', '0', ''],
+			   ['sysContact', '0'],
+			   ['sysName', '0'],
+			   ['sysLocation', '0'],
+			   ['sysServices', '0'],
+			   ['ifNumber', '0'],
+			   ['ifDescr', '1'],
+			   ['ifSpeed', '1'],
+			  );
+
+
+##############################  1  #####################################
+# Fire up a session.
+    my $s1 =
+    new SNMP::Session (DestHost=>$agent_host,Version=>1,Community=>$comm,RemotePort=>$agent_port);
+    ok(defined($s1));
+
+#############################  2  #######################################
+# Try getnext on sysDescr.0
+
+my $next = $s1->getnext('sysDescr.0');
+#print ("The next OID is : $next\n");
+ok($s1->{ErrorStr} eq '');
+#print STDERR "Error string1 = $s1->{ErrorStr}:$s1->{ErrorInd}\n";
+#print("\n");
+
+###########################  3  ########################################
+#$v1 = $s1->getnext('sysLocation.0');
+#print ("The next OID is : $v1\n");
+my $v2 = $s1->getnext('sysServices.0');
+#print ("The next OID is : $v2\n");
+ok($s1->{ErrorStr} eq '');
+#print STDERR "Error string2 = $s1->{ErrorStr}:$s1->{ErrorInd}\n";
+#print("\n");
+
+
+############################  4  #######################################
+# try it on an unknown OID
+my $v3 = $s1->getnext('Srivathsan.0');
+#print ("The unknown  OID is : $v3\n");
+ok($s1->{ErrorStr} =~ /^Unknown/);
+#print STDERR "Error string5 = $s1->{ErrorStr}:$s1->{ErrorInd}\n";
+#print("\n");
+############################# 5  #######################################
+# On a non-accessible value
+#my $kkk = $s1->getnext('vacmSecurityName.1');
+#print("kkk is $kkk\n");
+#ok($s1->{ErrorInd} != 0);
+#print STDERR "Error string5 = $s1->{ErrorStr}:$s1->{ErrorInd}\n";
+#print("\n");
+
+#############################  6  ####################################
+# We should get back sysDescr.0 here.
+my $var = new SNMP::Varbind(['sysDescr']);
+my $res2 = $s1->getnext($var);
+#print("res2 is : $res2\n");
+ok((not $s1->{ErrorStr} and not $s1->{ErrorInd}));
+ok((defined $var->iid and $var->iid eq 0));
+ok((defined $var->val and $var->val eq $res2));
+
+#############################  7  ######################################
+# get the next one after that as well for a second check
+my $res3 = $s1->getnext($var);
+#print("res3 is : $res3\n");
+ok((defined $var->tag and $var->tag eq 'sysObjectID'));
+ok((defined $var->val and $var->val eq $res3));
+
+
+    snmptest_cleanup();
diff -Naur tomato/release/src/router/snmp/perl/SNMP/t/get.t tomato121/release/src/router/snmp/perl/SNMP/t/get.t
--- tomato/release/src/router/snmp/perl/SNMP/t/get.t	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/perl/SNMP/t/get.t	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,210 @@
+#!./perl
+
+BEGIN {
+    unless(grep /blib/, @INC) {
+        chdir 't' if -d 't';
+        @INC = '../lib' if -d '../lib';
+    }
+}
+use Test;
+BEGIN { $n = 17; plan tests => $n }
+use SNMP;
+use vars qw($agent_port $comm $agent_host);
+require "t/startagent.pl";
+$SNMP::debugging = 0;
+$SNMP::verbose = 0;
+$SNMP::dump_packet = 0;
+
+my $junk_oid = ".1.3.6.1.2.1.1.1.1.1.1";
+my $oid = '.1.3.6.1.2.1.1.1';
+my $junk_name = 'fooDescr';
+my $junk_host = 'no.host.here';
+my $name = "gmarzot\@nortelnetworks.com";
+my $s1;
+
+# create list of varbinds for GETS, val field can be null or omitted
+$vars = new SNMP::VarList (
+			   ['sysDescr', '0', ''],
+			   ['sysObjectID', '0'],
+			   ['sysUpTime', '0'],
+			   ['sysContact', '0'],
+			   ['sysName', '0'],
+			   ['sysLocation', '0'],
+			   ['sysServices', '0'],
+			   ['ifNumber', '0'],
+			   ['ifDescr', '1'],
+			   ['ifSpeed', '1'],
+
+			   ['snmpInPkts', '0'],
+			   ['snmpInBadVersions', '0'],
+			   ['snmpInBadCommunityNames', '0'],
+			   ['snmpInBadCommunityUses', '0'],
+			   ['snmpInASNParseErrs', '0'],
+			   ['snmpEnableAuthenTraps', '0'],
+#			   ['snmpSilentDrops', '0'],
+#			   ['snmpProxyDrops', '0'],
+#			   ['snmpTrapEnterprise', '2'],
+
+#			   ['hrStorageType', '2'],
+#			   ['hrSystemDate', '0'],
+#			   ['sysORIndex', '1'],
+			   ['sysORID', '1'],
+			   ['sysORDescr', '1'],
+			   ['sysORUpTime', '1'],
+#			   ['ifName', '1'],
+			   ['sysORLastChange', '0'],
+			   ['ipInHdrErrors', '0'],
+			   ['ipDefaultTTL', '0'],
+			   ['ipInHdrErrors', '0'],
+		          );
+################################################################
+# Yet to do:
+# test for the max limit the 'get' can provide.
+# Figure out why the IP and Physical address are not getting printed.
+# why ifname is not getting printed?
+################################################################
+#			   ['ipNetToMediaPhysAddress', '0'],
+#			   ['ipAdEntAddr', '0'],
+#			   ['snmpTrapOID', '0'],
+#			   ['hrSystemNumUsers', '0'],
+#			   ['hrFSLastFullBackupDate', '0'],
+#			   ['ifPromiscuousMode', '0'],
+
+
+
+######################################################################
+# Fire up a session.
+    $s1 =
+    new SNMP::Session (DestHost=>$agent_host,Version=>1,Community=>$comm,RemotePort=>$agent_port);
+    ok(defined($s1));
+
+######################################################################
+# Get the standard Vars and check that we got some defined vars back
+@ret = $s1->get($vars);
+ok(!$s1->{ErrorStr} and defined($ret[0]));
+#print STDERR "Error string = $s1->{ErrorStr}:$s1->{ErrorInd}\n";
+######################################################################
+# Check that we got back the number we asked for.
+ok($#ret == $#{$vars});
+#print("dude : $#ret\n");
+################################################
+
+# Test for a string
+$contact = $s1->get('sysContact.0');
+#print("contact is : $contact\n");
+ok( defined($contact));
+
+
+$name = $s1->get('sysName.0');
+#print("Name is : $name\n");
+ok( defined($name));
+
+
+$location = $s1->get('sysLocation.0');
+#print("Location is : $location\n");
+ok( defined($location));
+#########################################
+
+
+# Test for an integer
+$ttl = $s1->get('ipDefaultTTL.0');
+#print("TTL is : $ttl\n");
+ok( defined($ttl));
+########################################
+
+
+# Test for a TimeTicks
+$time = $s1->get('sysUpTime.0');
+#print("up time is : $time hundredths of a second\n");
+ok( defined($time));
+#########################################
+
+
+#Test for a Counter32 type.
+$totalDatagramsReceived = $s1->get('ipInHdrErrors.0');
+#print("totalDatagramsReceived is : $totalDatagramsReceived\n");
+ok( defined($totalDatagramsReceived));
+################################################
+
+
+#Test for a PhysicalAddr type
+$physaddr = $s1->get('ipNetToMediaPhysAddress.0');
+#print("physical addr is : $physaddr \n");
+ok( defined($physaddr));
+##############################################
+
+
+#Test for a IpAddr type
+$ipaddr = $s1->get('ipAdEntAddr.0');
+#print("Ip address is : $ipaddr \n");
+ok( defined($ipaddr));
+##############################################
+
+
+#Test for a OID type
+$trapOID = $s1->get('snmpTrapOID.0');
+#print("trap OID is : $trapOID $s1->{ErrorStr}\n");
+ok( defined($trapOID));
+##############################################
+
+
+#Test for a Gauge type
+#$numusers = $s1->get('hrSystemNumUsers.0');
+#print("Number of users is : $numusers \n");
+#ok( defined($numusers));
+##############################################
+
+#nosuchname
+#Test for a date & time type
+#$datetime = $s1->get('hrFSLastFullBackupDate.0');
+#print("Number of users is : $datetime \n");
+#ok( defined($datetime));
+##############################################
+
+#nosuchname
+#Test for a Truth value type
+#$mode = $s1->get('ifPromiscuousMode.16');
+#print("Truth value(1 true, 2 false) is : $mode \n");
+#ok( defined($mode));
+##############################################
+
+# Time stamp test
+$time = $s1->get('sysORLastChange.0');
+#print("time stamp is : $time \n");
+ok(defined($time));
+#############################################
+
+# Integer test
+#$index = $s1->get('sysORIndex.0');
+#print("index is : $index\n");
+#ok(defined($index));
+#############################################
+
+# OID test
+$oid = $s1->get('sysORID.1');
+#print("index is : $oid\n");
+ok(defined($oid));
+#############################################
+
+# String test
+$descr = $s1->get('sysORDescr.1');
+#print("Sys Descr is : $descr\n");
+ok(defined($descr));
+#############################################
+
+# string String test
+$ifname = $s1->get('ifDescr.1');
+#print("ifname is : $ifname $s1->{ErrorStr}\n");
+ok(defined($ifname));
+#############################################
+
+
+# Try getting some unknown(wrong ?) data
+$unknown = $s1->get('ifmyData.0');
+ok(!defined($unknown));
+##############################################
+
+
+snmptest_cleanup();
+
+
diff -Naur tomato/release/src/router/snmp/perl/SNMP/t/mibload.t tomato121/release/src/router/snmp/perl/SNMP/t/mibload.t
--- tomato/release/src/router/snmp/perl/SNMP/t/mibload.t	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/perl/SNMP/t/mibload.t	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,68 @@
+#!./perl
+
+BEGIN {
+    unless(grep /blib/, @INC) {
+        chdir 't' if -d 't';
+        @INC = '../lib' if -d '../lib';
+    }
+}
+
+use Test;
+BEGIN {plan tests => 7}
+use SNMP;
+
+require "t/startagent.pl";
+
+use vars qw($mibdir);
+
+$SNMP::verbose = 0;
+
+my $mib_file = 't/mib.txt';
+my $junk_mib_file = 'mib.txt';
+my $mibfile1 = "$mibdir/TCP-MIB.txt";
+my @mibdir = ("$mibdir");
+my $mibfile2 = "$mibdir/IPV6-TCP-MIB.txt";
+
+######################################################################
+# See if we can find a mib to use, return of 0 means the file wasn't
+# found or isn't readable.
+
+$res = SNMP::setMib($junk_mib_file,1);
+ok(defined(!$res));
+######################################################################
+# Now we give the right name
+
+$res = SNMP::setMib($mib_file,1);
+ok(defined($res));
+######################################################################
+# See if we can find a mib to use
+
+$res = SNMP::setMib($mib_file,0);
+ok(defined($res));
+######################## 4 ################################
+# add a mib dir
+
+$res = SNMP::addMibDirs($mibdir[0]);
+
+SNMP::loadModules("IP-MIB", "IF-MIB", "IANAifType-MIB", "RFC1213-MIB");
+#SNMP::unloadModules(RMON-MIB);
+#etherStatsDataSource shouldn't be found.
+#present only in 1271 & RMON-MIB.
+$res = $SNMP::MIB{etherStatsDataSource};
+
+ok(!defined($res));
+
+########################  5  ############################
+# add mib file
+
+$res1 = SNMP::addMibFiles($mibfile1);
+ok(defined($res1));
+$res2 = SNMP::addMibFiles($mibfile2);
+ok(defined($res2));
+
+$res = $SNMP::MIB{ipv6TcpConnState}{moduleID};
+
+ok($res =~ /^IPV6-TCP-MIB/);
+#################################################
+
+
diff -Naur tomato/release/src/router/snmp/perl/SNMP/t/mib.t tomato121/release/src/router/snmp/perl/SNMP/t/mib.t
--- tomato/release/src/router/snmp/perl/SNMP/t/mib.t	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/perl/SNMP/t/mib.t	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,189 @@
+#!./perl
+
+# Written by John Stoffel (jfs@fluent.com) - 10/13/1997
+
+BEGIN {
+    unless(grep /blib/, @INC) {
+        chdir 't' if -d 't';
+        @INC = '../lib' if -d '../lib';
+    }
+}
+
+# to print the description...
+$SNMP::save_descriptions = 1;
+
+use Test;
+BEGIN {plan tests => 28}
+use SNMP;
+
+$SNMP::verbose = 0;
+
+use vars qw($bad_oid);
+require "t/startagent.pl";
+my $mib_file = 't/mib.txt';
+my $bad_mib_file = 'mib.txt';
+
+#############################  1  ######################################
+#check if
+my $res = $SNMP::MIB{sysDescr}{label};
+#print("Label is:$res\n");
+ok("sysDescr" eq $res);
+#print("\n");
+#############################  2  ######################################
+$res =  $SNMP::MIB{sysDescr}{objectID};
+#print("OID is: $res\n");
+ok(defined($res));
+#print("\n");
+#############################  3  ######################################
+$res =  $SNMP::MIB{sysDescr}{access};
+#print("access is: $res\n");
+ok($res eq 'ReadOnly');
+#print("\n");
+##############################  4  ###################################
+$res =  $SNMP::MIB{sysLocation}{access};
+#$res =  $SNMP::MIB{sysORIndex}{access};
+ok($res eq 'ReadWrite');
+##############################  5  ###################################
+$res =  $SNMP::MIB{sysLocation}{type};
+ok($res eq 'OCTETSTR');
+#############################  6  ####################################
+$res =  $SNMP::MIB{sysLocation}{status};
+#print STDERR ("status is: $res\n");
+#XXX: test fails due SMIv1 codes being returned intstead of SMIv2...
+#ok($res eq 'Current');
+#print STDERR ("\n");
+#############################  7  #################################
+$res =  $SNMP::MIB{sysORTable}{access};
+#print("access is: $res\n");
+ok($res eq 'NoAccess');
+#print("\n");
+#############################  8  ###############################
+$res = $SNMP::MIB{sysLocation}{subID};
+#print("subID is: $res\n");
+ok(defined($res));
+#print("\n");
+############################  9  ##############################
+$res = $SNMP::MIB{sysLocation}{syntax};
+#print("syntax is: $res\n");
+ok($res eq 'DisplayString');
+#print("\n");
+############################  10  ###########################
+$res = $SNMP::MIB{ipAdEntAddr}{syntax};
+ok($res eq 'IPADDR');
+#print("\n");
+##########################  11  ##########################
+$res = $SNMP::MIB{atNetAddress}{syntax};
+#print("syntax is: $res\n");
+#XXX: test fails due SMIv1 codes being returned intstead of SMIv2...
+#ok($res eq 'IPADDR');
+#print("\n");
+########################   12  ###############################
+$res = $SNMP::MIB{ipReasmOKs}{syntax};
+#print("syntax is: $res\n");
+ok($res eq 'COUNTER');
+#print("\n");
+######################   13  ##############################
+$res = $SNMP::MIB{sysDescr}{moduleID};
+#print("Module ID is: $res\n");
+ok(defined($res));
+#print("\n");
+######################  14   #########################
+$des = $SNMP::MIB{atNetAddress}{description};
+#print("des is --> $des\n");
+ok(defined($des));
+#print("\n");
+
+######################  15   #########################
+$res = $SNMP::MIB{atNetAddress}{nextNode};
+#print("res is --> $res\n");
+ok(ref($res) eq "HASH");
+#print("\n");
+
+########################  16   #########################
+$res = $SNMP::MIB{sysDescr}{children};
+#print("res is --> $res\n");
+ok(ref($res) eq "ARRAY");
+#print("\n");
+####################  17   #########################
+
+$res = $SNMP::MIB{sysDescr}{badField};
+ok(!defined($res));
+
+
+######################  18   #########################
+$res = $SNMP::MIB{sysDescr}{hint};
+#print("res is --> $res\n");
+#XXX: test fails due SMIv1 codes being returned intstead of SMIv2...
+#ok(defined($res) && $res =~ /^255a/);
+#print("\n");
+######################  19   #########################
+
+$res = $SNMP::MIB{ifPhysAddress}{hint};
+#print("res is --> $res\n");
+#XXX: test fails due SMIv1 codes being returned intstead of SMIv2...
+#ok(defined($res) && $res =~ /^1x:/);
+#print("\n");
+
+
+######################  some translate tests  #######
+
+#####################  20  #########################
+# Garbage names return Undef.
+
+my $type1 = SNMP::getType($bad_name);
+ok(!defined($type1));
+#printf "%s %d\n", (!defined($type1)) ? "ok" :"not ok", $n++;
+
+######################################################################
+# getType() supports numeric OIDs now
+
+my $type2 = SNMP::getType($oid);
+#XXX: test fails due SMIv1 codes being returned intstead of SMIv2...
+#ok(defined($type2) && $type2 =~ /OCTETSTR/);
+
+######################################################################
+# This tests that sysDescr returns a valid type.
+
+my $type3 = SNMP::getType($name);
+ok(defined($type3));
+
+######################################################################
+# Translation tests from Name -> oid -> Name
+######################################################################
+# name -> OID
+$oid_tag = SNMP::translateObj($name);
+ok($oid eq $oid_tag);
+
+######################################################################
+# bad name returns 'undef'
+
+$oid_tag = '';
+$oid_tag = SNMP::translateObj($bad_name);
+ok(!defined($oid_tag));
+######################################################################
+# OID -> name
+
+$name_tag = SNMP::translateObj($oid);
+ok($name eq $name_tag);
+
+######################################################################
+# bad OID -> Name
+
+$name_tag = SNMP::translateObj($bad_oid);
+ok($name ne $name_tag);
+#printf "%s %d\n", ($name ne $name_tag) ? "ok" :"not ok", $n++;
+
+######################################################################
+# ranges
+
+$node = $SNMP::MIB{snmpTargetAddrMMS};
+ok($node);
+$ranges = $node->{ranges};
+ok($ranges and ref $ranges eq 'ARRAY');
+ok(@$ranges == 2);
+ok($$ranges[0]{low} == 0);
+ok($$ranges[0]{high} == 0);
+ok($$ranges[1]{low} == 484);
+ok($$ranges[1]{high} == 2147483647);
+
+snmptest_cleanup();
diff -Naur tomato/release/src/router/snmp/perl/SNMP/t/mib.txt tomato121/release/src/router/snmp/perl/SNMP/t/mib.txt
--- tomato/release/src/router/snmp/perl/SNMP/t/mib.txt	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/perl/SNMP/t/mib.txt	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,4208 @@
+RFC1155-SMI DEFINITIONS ::= BEGIN
+    nullOID       OBJECT IDENTIFIER ::= { ccitt 0 }
+    internet      OBJECT IDENTIFIER ::= { iso org(3) dod(6) 1 }
+    directory     OBJECT IDENTIFIER ::= { internet 1 }
+    mgmt          OBJECT IDENTIFIER ::= { internet 2 }
+    experimental  OBJECT IDENTIFIER ::= { internet 3 }
+    private       OBJECT IDENTIFIER ::= { internet 4 }
+    enterprises   OBJECT IDENTIFIER ::= { private 1 }
+END
+
+-- @(#)WSCCS o/mibs-rfc1213.mib 1.1 8/30/95
+-- Changes to rfc1213 (MIB-II):
+--      No changes needed.
+
+
+          RFC1213-MIB DEFINITIONS ::= BEGIN
+
+          IMPORTS
+                  mgmt, NetworkAddress, IpAddress, Counter, Gauge,
+                          TimeTicks
+                      FROM RFC1155-SMI
+                  OBJECT-TYPE
+                          FROM RFC-1212;
+
+          --  This MIB module uses the extended OBJECT-TYPE macro as
+          --  defined in [14];
+
+
+          --  MIB-II (same prefix as MIB-I)
+
+          mib-2      OBJECT IDENTIFIER ::= { mgmt 1 }
+
+          -- textual conventions
+
+          DisplayString ::=
+              OCTET STRING
+          -- This data type is used to model textual information taken
+          -- from the NVT ASCII character set.  By convention, objects
+          -- with this syntax are declared as having
+          --
+          --      SIZE (0..255)
+
+          PhysAddress ::=
+              OCTET STRING
+          -- This data type is used to model media addresses.  For many
+          -- types of media, this will be in a binary representation.
+          -- For example, an ethernet address would be represented as
+          -- a string of 6 octets.
+
+
+          -- groups in MIB-II
+
+          system       OBJECT IDENTIFIER ::= { mib-2 1 }
+
+          interfaces   OBJECT IDENTIFIER ::= { mib-2 2 }
+
+          at           OBJECT IDENTIFIER ::= { mib-2 3 }
+
+          ip           OBJECT IDENTIFIER ::= { mib-2 4 }
+
+          icmp         OBJECT IDENTIFIER ::= { mib-2 5 }
+
+          tcp          OBJECT IDENTIFIER ::= { mib-2 6 }
+
+          udp          OBJECT IDENTIFIER ::= { mib-2 7 }
+
+          egp          OBJECT IDENTIFIER ::= { mib-2 8 }
+
+          -- historical (some say hysterical)
+          -- cmot      OBJECT IDENTIFIER ::= { mib-2 9 }
+
+          transmission OBJECT IDENTIFIER ::= { mib-2 10 }
+
+          snmp         OBJECT IDENTIFIER ::= { mib-2 11 }
+
+
+          -- the System group
+
+          -- Implementation of the System group is mandatory for all
+          -- systems.  If an agent is not configured to have a value
+          -- for any of these variables, a string of length 0 is
+          -- returned.
+
+          sysDescr OBJECT-TYPE
+              SYNTAX  DisplayString (SIZE (0..255))
+              ACCESS  read-only
+              STATUS  mandatory
+              DESCRIPTION
+                      "A textual description of the entity.  This value
+                      should include the full name and version
+                      identification of the system's hardware type,
+                      software operating-system, and networking
+                      software.  It is mandatory that this only contain
+                      printable ASCII characters."
+              ::= { system 1 }
+
+          sysObjectID OBJECT-TYPE
+              SYNTAX  OBJECT IDENTIFIER
+              ACCESS  read-only
+              STATUS  mandatory
+              DESCRIPTION
+                      "The vendor's authoritative identification of the
+                      network management subsystem contained in the
+                      entity.  This value is allocated within the SMI
+                      enterprises subtree (1.3.6.1.4.1) and provides an
+                      easy and unambiguous means for determining `what
+                      kind of box' is being managed.  For example, if
+                      vendor `Flintstones, Inc.' was assigned the
+                      subtree 1.3.6.1.4.1.4242, it could assign the
+                      identifier 1.3.6.1.4.1.4242.1.1 to its `Fred
+                      Router'."
+              ::= { system 2 }
+
+          sysUpTime OBJECT-TYPE
+              SYNTAX  TimeTicks
+              ACCESS  read-only
+              STATUS  mandatory
+              DESCRIPTION
+                      "The time (in hundredths of a second) since the
+                      network management portion of the system was last
+                      re-initialized."
+              ::= { system 3 }
+
+          sysContact OBJECT-TYPE
+              SYNTAX  DisplayString (SIZE (0..255))
+              ACCESS  read-write
+              STATUS  mandatory
+              DESCRIPTION
+                      "The textual identification of the contact person
+                      for this managed node, together with information
+                      on how to contact this person."
+              ::= { system 4 }
+
+          sysName OBJECT-TYPE
+              SYNTAX  DisplayString (SIZE (0..255))
+              ACCESS  read-write
+              STATUS  mandatory
+              DESCRIPTION
+                      "An administratively-assigned name for this
+                      managed node.  By convention, this is the node's
+                      fully-qualified domain name."
+              ::= { system 5 }
+
+          sysLocation OBJECT-TYPE
+              SYNTAX  DisplayString (SIZE (0..255))
+              ACCESS  read-write
+              STATUS  mandatory
+              DESCRIPTION
+                      "The physical location of this node (e.g.,
+                      `telephone closet, 3rd floor')."
+              ::= { system 6 }
+
+          sysServices OBJECT-TYPE
+              SYNTAX  INTEGER (0..127)
+              ACCESS  read-only
+              STATUS  mandatory
+              DESCRIPTION
+                      "A value which indicates the set of services that
+                      this entity primarily offers.
+
+                      The value is a sum.  This sum initially takes the
+                      value zero, Then, for each layer, L, in the range
+                      1 through 7, that this node performs transactions
+                      for, 2 raised to (L - 1) is added to the sum.  For
+                      example, a node which performs primarily routing
+                      functions would have a value of 4 (2^(3-1)).  In
+                      contrast, a node which is a host offering
+                      application services would have a value of 72
+                      (2^(4-1) + 2^(7-1)).  Note that in the context of
+                      the Internet suite of protocols, values should be
+                      calculated accordingly:
+
+                           layer  functionality
+                               1  physical (e.g., repeaters)
+                               2  datalink/subnetwork (e.g., bridges)
+                               3  internet (e.g., IP gateways)
+                               4  end-to-end  (e.g., IP hosts)
+                               7  applications (e.g., mail relays)
+
+                      For systems including OSI protocols, layers 5 and
+                      6 may also be counted."
+              ::= { system 7 }
+
+
+          -- the Interfaces group
+
+          -- Implementation of the Interfaces group is mandatory for
+          -- all systems.
+
+          ifNumber OBJECT-TYPE
+              SYNTAX  INTEGER
+              ACCESS  read-only
+              STATUS  mandatory
+              DESCRIPTION
+                      "The number of network interfaces (regardless of
+                      their current state) present on this system."
+              ::= { interfaces 1 }
+
+
+          -- the Interfaces table
+
+          -- The Interfaces table contains information on the entity's
+          -- interfaces.  Each interface is thought of as being
+          -- attached to a `subnetwork'.  Note that this term should
+          -- not be confused with `subnet' which refers to an
+          -- addressing partitioning scheme used in the Internet suite
+          -- of protocols.
+
+          ifTable OBJECT-TYPE
+              SYNTAX  SEQUENCE OF IfEntry
+              ACCESS  not-accessible
+              STATUS  mandatory
+              DESCRIPTION
+                      "A list of interface entries.  The number of
+                      entries is given by the value of ifNumber."
+              ::= { interfaces 2 }
+
+          ifEntry OBJECT-TYPE
+              SYNTAX  IfEntry
+              ACCESS  not-accessible
+              STATUS  mandatory
+              DESCRIPTION
+                      "An interface entry containing objects at the
+                      subnetwork layer and below for a particular
+                      interface."
+              INDEX   { ifIndex }
+              ::= { ifTable 1 }
+
+          IfEntry ::=
+              SEQUENCE {
+                  ifIndex
+                      INTEGER,
+                  ifDescr
+                      DisplayString,
+                  ifType
+                      INTEGER,
+                  ifMtu
+                      INTEGER,
+                  ifSpeed
+                      Gauge,
+                  ifPhysAddress
+                      PhysAddress,
+                  ifAdminStatus
+                      INTEGER,
+                  ifOperStatus
+                      INTEGER,
+                  ifLastChange
+                      TimeTicks,
+                  ifInOctets
+                      Counter,
+                  ifInUcastPkts
+                      Counter,
+                  ifInNUcastPkts
+                      Counter,
+                  ifInDiscards
+                      Counter,
+                  ifInErrors
+                      Counter,
+                  ifInUnknownProtos
+                      Counter,
+                  ifOutOctets
+                      Counter,
+                  ifOutUcastPkts
+                      Counter,
+                  ifOutNUcastPkts
+                      Counter,
+                  ifOutDiscards
+                      Counter,
+                  ifOutErrors
+                      Counter,
+                  ifOutQLen
+                      Gauge,
+                  ifSpecific
+                      OBJECT IDENTIFIER
+              }
+
+          ifIndex OBJECT-TYPE
+              SYNTAX  INTEGER
+              ACCESS  read-only
+              STATUS  mandatory
+              DESCRIPTION
+                      "A unique value for each interface.  Its value
+                      ranges between 1 and the value of ifNumber.  The
+                      value for each interface must remain constant at
+                      least from one re-initialization of the entity's
+                      network management system to the next re-
+                      initialization."
+              ::= { ifEntry 1 }
+
+          ifDescr OBJECT-TYPE
+              SYNTAX  DisplayString (SIZE (0..255))
+              ACCESS  read-only
+              STATUS  mandatory
+              DESCRIPTION
+                      "A textual string containing information about the
+                      interface.  This string should include the name of
+                      the manufacturer, the product name and the version
+                      of the hardware interface."
+              ::= { ifEntry 2 }
+
+          ifType OBJECT-TYPE
+              SYNTAX  INTEGER {
+                          other(1),          -- none of the following
+                          regular1822(2),
+                          hdh1822(3),
+                          ddn-x25(4),
+                          rfc877-x25(5),
+                          ethernet-csmacd(6),
+                          iso88023-csmacd(7),
+                          iso88024-tokenBus(8),
+                          iso88025-tokenRing(9),
+                          iso88026-man(10),
+                          starLan(11),
+                          proteon-10Mbit(12),
+                          proteon-80Mbit(13),
+                          hyperchannel(14),
+                          fddi(15),
+                          lapb(16),
+                          sdlc(17),
+                          ds1(18),           -- T-1
+                          e1(19),            -- european equiv. of T-1
+                          basicISDN(20),
+                          primaryISDN(21),   -- proprietary serial
+                          propPointToPointSerial(22),
+                          ppp(23),
+                          softwareLoopback(24),
+                          eon(25),            -- CLNP over IP [11]
+                          ethernet-3Mbit(26),
+                          nsip(27),           -- XNS over IP
+                          slip(28),           -- generic SLIP
+                          ultra(29),          -- ULTRA technologies
+                          ds3(30),            -- T-3
+                          sip(31),            -- SMDS
+                          frame-relay(32)
+                      }
+              ACCESS  read-only
+              STATUS  mandatory
+              DESCRIPTION
+                      "The type of interface, distinguished according to
+                      the physical/link protocol(s) immediately `below'
+                      the network layer in the protocol stack."
+              ::= { ifEntry 3 }
+
+          ifMtu OBJECT-TYPE
+              SYNTAX  INTEGER
+              ACCESS  read-only
+              STATUS  mandatory
+              DESCRIPTION
+                      "The size of the largest datagram which can be
+                      sent/received on the interface, specified in
+                      octets.  For interfaces that are used for
+                      transmitting network datagrams, this is the size
+                      of the largest network datagram that can be sent
+                      on the interface."
+              ::= { ifEntry 4 }
+
+          ifSpeed OBJECT-TYPE
+              SYNTAX  Gauge
+              ACCESS  read-only
+              STATUS  mandatory
+              DESCRIPTION
+                      "An estimate of the interface's current bandwidth
+                      in bits per second.  For interfaces which do not
+                      vary in bandwidth or for those where no accurate
+                      estimation can be made, this object should contain
+                      the nominal bandwidth."
+              ::= { ifEntry 5 }
+
+          ifPhysAddress OBJECT-TYPE
+              SYNTAX  PhysAddress
+              ACCESS  read-only
+              STATUS  mandatory
+              DESCRIPTION
+                      "The interface's address at the protocol layer
+                      immediately `below' the network layer in the
+                      protocol stack.  For interfaces which do not have
+                      such an address (e.g., a serial line), this object
+                      should contain an octet string of zero length."
+              ::= { ifEntry 6 }
+
+          ifAdminStatus OBJECT-TYPE
+              SYNTAX  INTEGER {
+                          up(1),       -- ready to pass packets
+                          down(2),
+                          testing(3)   -- in some test mode
+                      }
+              ACCESS  read-write
+              STATUS  mandatory
+              DESCRIPTION
+                      "The desired state of the interface.  The
+                      testing(3) state indicates that no operational
+                      packets can be passed."
+              ::= { ifEntry 7 }
+
+          ifOperStatus OBJECT-TYPE
+              SYNTAX  INTEGER {
+                          up(1),       -- ready to pass packets
+                          down(2),
+                          testing(3)   -- in some test mode
+                      }
+              ACCESS  read-only
+              STATUS  mandatory
+              DESCRIPTION
+                      "The current operational state of the interface.
+                      The testing(3) state indicates that no operational
+                      packets can be passed."
+              ::= { ifEntry 8 }
+
+          ifLastChange OBJECT-TYPE
+              SYNTAX  TimeTicks
+              ACCESS  read-only
+              STATUS  mandatory
+              DESCRIPTION
+                      "The value of sysUpTime at the time the interface
+                      entered its current operational state.  If the
+                      current state was entered prior to the last re-
+                      initialization of the local network management
+                      subsystem, then this object contains a zero
+                      value."
+              ::= { ifEntry 9 }
+
+          ifInOctets OBJECT-TYPE
+              SYNTAX  Counter
+              ACCESS  read-only
+              STATUS  mandatory
+              DESCRIPTION
+                      "The total number of octets received on the
+                      interface, including framing characters."
+              ::= { ifEntry 10 }
+
+          ifInUcastPkts OBJECT-TYPE
+              SYNTAX  Counter
+              ACCESS  read-only
+              STATUS  mandatory
+              DESCRIPTION
+                      "The number of subnetwork-unicast packets
+                      delivered to a higher-layer protocol."
+              ::= { ifEntry 11 }
+
+          ifInNUcastPkts OBJECT-TYPE
+              SYNTAX  Counter
+              ACCESS  read-only
+              STATUS  mandatory
+              DESCRIPTION
+                      "The number of non-unicast (i.e., subnetwork-
+                      broadcast or subnetwork-multicast) packets
+                      delivered to a higher-layer protocol."
+              ::= { ifEntry 12 }
+
+          ifInDiscards OBJECT-TYPE
+              SYNTAX  Counter
+              ACCESS  read-only
+              STATUS  mandatory
+              DESCRIPTION
+                      "The number of inbound packets which were chosen
+                      to be discarded even though no errors had been
+                      detected to prevent their being deliverable to a
+                      higher-layer protocol.  One possible reason for
+                      discarding such a packet could be to free up
+                      buffer space."
+              ::= { ifEntry 13 }
+
+          ifInErrors OBJECT-TYPE
+              SYNTAX  Counter
+              ACCESS  read-only
+              STATUS  mandatory
+              DESCRIPTION
+                      "The number of inbound packets that contained
+                      errors preventing them from being deliverable to a
+                      higher-layer protocol."
+              ::= { ifEntry 14 }
+          ifInUnknownProtos OBJECT-TYPE
+              SYNTAX  Counter
+              ACCESS  read-only
+              STATUS  mandatory
+              DESCRIPTION
+                      "The number of packets received via the interface
+                      which were discarded because of an unknown or
+                      unsupported protocol."
+              ::= { ifEntry 15 }
+
+          ifOutOctets OBJECT-TYPE
+              SYNTAX  Counter
+              ACCESS  read-only
+              STATUS  mandatory
+              DESCRIPTION
+                      "The total number of octets transmitted out of the
+                      interface, including framing characters."
+              ::= { ifEntry 16 }
+
+          ifOutUcastPkts OBJECT-TYPE
+              SYNTAX  Counter
+              ACCESS  read-only
+              STATUS  mandatory
+              DESCRIPTION
+                      "The total number of packets that higher-level
+                      protocols requested be transmitted to a
+                      subnetwork-unicast address, including those that
+                      were discarded or not sent."
+              ::= { ifEntry 17 }
+
+          ifOutNUcastPkts OBJECT-TYPE
+              SYNTAX  Counter
+              ACCESS  read-only
+              STATUS  mandatory
+              DESCRIPTION
+                      "The total number of packets that higher-level
+                      protocols requested be transmitted to a non-
+                      unicast (i.e., a subnetwork-broadcast or
+                      subnetwork-multicast) address, including those
+                      that were discarded or not sent."
+              ::= { ifEntry 18 }
+
+          ifOutDiscards OBJECT-TYPE
+              SYNTAX  Counter
+              ACCESS  read-only
+              STATUS  mandatory
+              DESCRIPTION
+                      "The number of outbound packets which were chosen
+                      to be discarded even though no errors had been
+                      detected to prevent their being transmitted.  One
+                      possible reason for discarding such a packet could
+                      be to free up buffer space."
+              ::= { ifEntry 19 }
+
+          ifOutErrors OBJECT-TYPE
+              SYNTAX  Counter
+              ACCESS  read-only
+              STATUS  mandatory
+              DESCRIPTION
+                      "The number of outbound packets that could not be
+                      transmitted because of errors."
+              ::= { ifEntry 20 }
+
+          ifOutQLen OBJECT-TYPE
+              SYNTAX  Gauge
+              ACCESS  read-only
+              STATUS  mandatory
+              DESCRIPTION
+                      "The length of the output packet queue (in
+                      packets)."
+              ::= { ifEntry 21 }
+
+          ifSpecific OBJECT-TYPE
+              SYNTAX  OBJECT IDENTIFIER
+              ACCESS  read-only
+              STATUS  mandatory
+              DESCRIPTION
+                      "A reference to MIB definitions specific to the
+                      particular media being used to realize the
+                      interface.  For example, if the interface is
+                      realized by an ethernet, then the value of this
+                      object refers to a document defining objects
+                      specific to ethernet.  If this information is not
+                      present, its value should be set to the OBJECT
+                      IDENTIFIER { 0 0 }, which is a syntatically valid
+                      object identifier, and any conformant
+                      implementation of ASN.1 and BER must be able to
+                      generate and recognize this value."
+              ::= { ifEntry 22 }
+
+
+          -- the Address Translation group
+
+          -- Implementation of the Address Translation group is
+          -- mandatory for all systems.  Note however that this group
+          -- is deprecated by MIB-II. That is, it is being included
+          -- solely for compatibility with MIB-I nodes, and will most
+          -- likely be excluded from MIB-III nodes.  From MIB-II and
+          -- onwards, each network protocol group contains its own
+          -- address translation tables.
+
+          -- The Address Translation group contains one table which is
+          -- the union across all interfaces of the translation tables
+          -- for converting a NetworkAddress (e.g., an IP address) into
+          -- a subnetwork-specific address.  For lack of a better term,
+          -- this document refers to such a subnetwork-specific address
+          -- as a `physical' address.
+
+          -- Examples of such translation tables are: for broadcast
+          -- media where ARP is in use, the translation table is
+          -- equivalent to the ARP cache; or, on an X.25 network where
+          -- non-algorithmic translation to X.121 addresses is
+          -- required, the translation table contains the
+          -- NetworkAddress to X.121 address equivalences.
+
+          atTable OBJECT-TYPE
+              SYNTAX  SEQUENCE OF AtEntry
+              ACCESS  not-accessible
+              STATUS  deprecated
+              DESCRIPTION
+                      "The Address Translation tables contain the
+                      NetworkAddress to `physical' address equivalences.
+                      Some interfaces do not use translation tables for
+                      determining address equivalences (e.g., DDN-X.25
+                      has an algorithmic method); if all interfaces are
+                      of this type, then the Address Translation table
+                      is empty, i.e., has zero entries."
+              ::= { at 1 }
+
+          atEntry OBJECT-TYPE
+              SYNTAX  AtEntry
+              ACCESS  not-accessible
+              STATUS  deprecated
+              DESCRIPTION
+                      "Each entry contains one NetworkAddress to
+                      `physical' address equivalence."
+              INDEX   { atIfIndex,
+                        atNetAddress }
+              ::= { atTable 1 }
+
+          AtEntry ::=
+              SEQUENCE {
+                  atIfIndex
+                      INTEGER,
+                  atPhysAddress
+                      PhysAddress,
+                  atNetAddress
+                      NetworkAddress
+              }
+
+          atIfIndex OBJECT-TYPE
+              SYNTAX  INTEGER
+              ACCESS  read-write
+              STATUS  deprecated
+              DESCRIPTION
+                      "The interface on which this entry's equivalence
+                      is effective.  The interface identified by a
+                      particular value of this index is the same
+                      interface as identified by the same value of
+                      ifIndex."
+              ::= { atEntry 1 }
+
+          atPhysAddress OBJECT-TYPE
+              SYNTAX  PhysAddress
+              ACCESS  read-write
+              STATUS  deprecated
+              DESCRIPTION
+                      "The media-dependent `physical' address.
+
+                      Setting this object to a null string (one of zero
+                      length) has the effect of invaliding the
+                      corresponding entry in the atTable object.  That
+                      is, it effectively dissasociates the interface
+                      identified with said entry from the mapping
+                      identified with said entry.  It is an
+                      implementation-specific matter as to whether the
+                      agent removes an invalidated entry from the table.
+                      Accordingly, management stations must be prepared
+                      to receive tabular information from agents that
+                      corresponds to entries not currently in use.
+                      Proper interpretation of such entries requires
+                      examination of the relevant atPhysAddress object."
+              ::= { atEntry 2 }
+
+          atNetAddress OBJECT-TYPE
+              SYNTAX  NetworkAddress
+              ACCESS  read-write
+              STATUS  deprecated
+              DESCRIPTION
+                      "The NetworkAddress (e.g., the IP address)
+                      corresponding to the media-dependent `physical'
+                      address."
+              ::= { atEntry 3 }
+
+
+          -- the IP group
+
+          -- Implementation of the IP group is mandatory for all
+          -- systems.
+
+          ipForwarding OBJECT-TYPE
+              SYNTAX  INTEGER {
+                          forwarding(1),    -- acting as a gateway
+                          not-forwarding(2) -- NOT acting as a gateway
+                      }
+              ACCESS  read-write
+              STATUS  mandatory
+              DESCRIPTION
+                      "The indication of whether this entity is acting
+                      as an IP gateway in respect to the forwarding of
+                      datagrams received by, but not addressed to, this
+                      entity.  IP gateways forward datagrams.  IP hosts
+                      do not (except those source-routed via the host).
+
+                      Note that for some managed nodes, this object may
+                      take on only a subset of the values possible.
+                      Accordingly, it is appropriate for an agent to
+                      return a `badValue' response if a management
+                      station attempts to change this object to an
+                      inappropriate value."
+              ::= { ip 1 }
+
+          ipDefaultTTL OBJECT-TYPE
+              SYNTAX  INTEGER
+              ACCESS  read-write
+              STATUS  mandatory
+              DESCRIPTION
+                      "The default value inserted into the Time-To-Live
+                      field of the IP header of datagrams originated at
+                      this entity, whenever a TTL value is not supplied
+                      by the transport layer protocol."
+              ::= { ip 2 }
+
+          ipInReceives OBJECT-TYPE
+              SYNTAX  Counter
+              ACCESS  read-only
+              STATUS  mandatory
+              DESCRIPTION
+                      "The total number of input datagrams received from
+                      interfaces, including those received in error."
+              ::= { ip 3 }
+
+          ipInHdrErrors OBJECT-TYPE
+              SYNTAX  Counter
+              ACCESS  read-only
+              STATUS  mandatory
+              DESCRIPTION
+                      "The number of input datagrams discarded due to
+                      errors in their IP headers, including bad
+                      checksums, version number mismatch, other format
+                      errors, time-to-live exceeded, errors discovered
+                      in processing their IP options, etc."
+              ::= { ip 4 }
+
+          ipInAddrErrors OBJECT-TYPE
+              SYNTAX  Counter
+              ACCESS  read-only
+              STATUS  mandatory
+              DESCRIPTION
+                      "The number of input datagrams discarded because
+                      the IP address in their IP header's destination
+                      field was not a valid address to be received at
+                      this entity.  This count includes invalid
+                      addresses (e.g., 0.0.0.0) and addresses of
+                      unsupported Classes (e.g., Class E).  For entities
+                      which are not IP Gateways and therefore do not
+                      forward datagrams, this counter includes datagrams
+                      discarded because the destination address was not
+                      a local address."
+              ::= { ip 5 }
+
+          ipForwDatagrams OBJECT-TYPE
+              SYNTAX  Counter
+              ACCESS  read-only
+              STATUS  mandatory
+              DESCRIPTION
+                      "The number of input datagrams for which this
+                      entity was not their final IP destination, as a
+                      result of which an attempt was made to find a
+                      route to forward them to that final destination.
+                      In entities which do not act as IP Gateways, this
+                      counter will include only those packets which were
+                      Source-Routed via this entity, and the Source-
+                      Route option processing was successful."
+              ::= { ip 6 }
+
+          ipInUnknownProtos OBJECT-TYPE
+              SYNTAX  Counter
+              ACCESS  read-only
+              STATUS  mandatory
+              DESCRIPTION
+                      "The number of locally-addressed datagrams
+                      received successfully but discarded because of an
+                      unknown or unsupported protocol."
+              ::= { ip 7 }
+
+          ipInDiscards OBJECT-TYPE
+              SYNTAX  Counter
+              ACCESS  read-only
+              STATUS  mandatory
+              DESCRIPTION
+                      "The number of input IP datagrams for which no
+                      problems were encountered to prevent their
+                      continued processing, but which were discarded
+                      (e.g., for lack of buffer space).  Note that this
+                      counter does not include any datagrams discarded
+                      while awaiting re-assembly."
+              ::= { ip 8 }
+
+          ipInDelivers OBJECT-TYPE
+              SYNTAX  Counter
+              ACCESS  read-only
+              STATUS  mandatory
+              DESCRIPTION
+                      "The total number of input datagrams successfully
+                      delivered to IP user-protocols (including ICMP)."
+              ::= { ip 9 }
+
+          ipOutRequests OBJECT-TYPE
+              SYNTAX  Counter
+              ACCESS  read-only
+              STATUS  mandatory
+              DESCRIPTION
+                      "The total number of IP datagrams which local IP
+                      user-protocols (including ICMP) supplied to IP in
+                      requests for transmission.  Note that this counter
+                      does not include any datagrams counted in
+                      ipForwDatagrams."
+              ::= { ip 10 }
+
+          ipOutDiscards OBJECT-TYPE
+              SYNTAX  Counter
+              ACCESS  read-only
+              STATUS  mandatory
+              DESCRIPTION
+                      "The number of output IP datagrams for which no
+                      problem was encountered to prevent their
+                      transmission to their destination, but which were
+                      discarded (e.g., for lack of buffer space).  Note
+                      that this counter would include datagrams counted
+                      in ipForwDatagrams if any such packets met this
+                      (discretionary) discard criterion."
+              ::= { ip 11 }
+
+          ipOutNoRoutes OBJECT-TYPE
+              SYNTAX  Counter
+              ACCESS  read-only
+              STATUS  mandatory
+              DESCRIPTION
+                      "The number of IP datagrams discarded because no
+                      route could be found to transmit them to their
+                      destination.  Note that this counter includes any
+                      packets counted in ipForwDatagrams which meet this
+                      `no-route' criterion.  Note that this includes any
+                      datagarms which a host cannot route because all of
+                      its default gateways are down."
+              ::= { ip 12 }
+
+          ipReasmTimeout OBJECT-TYPE
+              SYNTAX  INTEGER
+              ACCESS  read-only
+              STATUS  mandatory
+              DESCRIPTION
+                      "The maximum number of seconds which received
+                      fragments are held while they are awaiting
+                      reassembly at this entity."
+              ::= { ip 13 }
+
+          ipReasmReqds OBJECT-TYPE
+              SYNTAX  Counter
+              ACCESS  read-only
+              STATUS  mandatory
+              DESCRIPTION
+                      "The number of IP fragments received which needed
+                      to be reassembled at this entity."
+              ::= { ip 14 }
+
+          ipReasmOKs OBJECT-TYPE
+              SYNTAX  Counter
+              ACCESS  read-only
+              STATUS  mandatory
+              DESCRIPTION
+                      "The number of IP datagrams successfully re-
+                      assembled."
+              ::= { ip 15 }
+
+          ipReasmFails OBJECT-TYPE
+              SYNTAX  Counter
+              ACCESS  read-only
+              STATUS  mandatory
+              DESCRIPTION
+                      "The number of failures detected by the IP re-
+                      assembly algorithm (for whatever reason: timed
+                      out, errors, etc).  Note that this is not
+                      necessarily a count of discarded IP fragments
+                      since some algorithms (notably the algorithm in
+                      RFC 815) can lose track of the number of fragments
+                      by combining them as they are received."
+              ::= { ip 16 }
+
+          ipFragOKs OBJECT-TYPE
+              SYNTAX  Counter
+              ACCESS  read-only
+              STATUS  mandatory
+              DESCRIPTION
+                      "The number of IP datagrams that have been
+                      successfully fragmented at this entity."
+              ::= { ip 17 }
+
+          ipFragFails OBJECT-TYPE
+              SYNTAX  Counter
+              ACCESS  read-only
+              STATUS  mandatory
+              DESCRIPTION
+                      "The number of IP datagrams that have been
+                      discarded because they needed to be fragmented at
+                      this entity but could not be, e.g., because their
+                      Don't Fragment flag was set."
+              ::= { ip 18 }
+
+          ipFragCreates OBJECT-TYPE
+              SYNTAX  Counter
+              ACCESS  read-only
+              STATUS  mandatory
+              DESCRIPTION
+                      "The number of IP datagram fragments that have
+                      been generated as a result of fragmentation at
+                      this entity."
+              ::= { ip 19 }
+
+          -- the IP address table
+
+          -- The IP address table contains this entity's IP addressing
+          -- information.
+
+          ipAddrTable OBJECT-TYPE
+              SYNTAX  SEQUENCE OF IpAddrEntry
+              ACCESS  not-accessible
+              STATUS  mandatory
+              DESCRIPTION
+                      "The table of addressing information relevant to
+                      this entity's IP addresses."
+              ::= { ip 20 }
+
+          ipAddrEntry OBJECT-TYPE
+              SYNTAX  IpAddrEntry
+              ACCESS  not-accessible
+              STATUS  mandatory
+              DESCRIPTION
+                      "The addressing information for one of this
+                      entity's IP addresses."
+              INDEX   { ipAdEntAddr }
+              ::= { ipAddrTable 1 }
+
+          IpAddrEntry ::=
+              SEQUENCE {
+                  ipAdEntAddr
+                      IpAddress,
+                  ipAdEntIfIndex
+                      INTEGER,
+                  ipAdEntNetMask
+                      IpAddress,
+                  ipAdEntBcastAddr
+                      INTEGER,
+                  ipAdEntReasmMaxSize
+                      INTEGER (0..65535)
+              }
+
+          ipAdEntAddr OBJECT-TYPE
+              SYNTAX  IpAddress
+              ACCESS  read-only
+              STATUS  mandatory
+              DESCRIPTION
+                      "The IP address to which this entry's addressing
+                      information pertains."
+              ::= { ipAddrEntry 1 }
+
+          ipAdEntIfIndex OBJECT-TYPE
+              SYNTAX  INTEGER
+              ACCESS  read-only
+              STATUS  mandatory
+              DESCRIPTION
+                      "The index value which uniquely identifies the
+                      interface to which this entry is applicable.  The
+                      interface identified by a particular value of this
+                      index is the same interface as identified by the
+                      same value of ifIndex."
+              ::= { ipAddrEntry 2 }
+
+          ipAdEntNetMask OBJECT-TYPE
+              SYNTAX  IpAddress
+              ACCESS  read-only
+              STATUS  mandatory
+              DESCRIPTION
+                      "The subnet mask associated with the IP address of
+                      this entry.  The value of the mask is an IP
+                      address with all the network bits set to 1 and all
+                      the hosts bits set to 0."
+              ::= { ipAddrEntry 3 }
+
+          ipAdEntBcastAddr OBJECT-TYPE
+              SYNTAX  INTEGER
+              ACCESS  read-only
+              STATUS  mandatory
+              DESCRIPTION
+                      "The value of the least-significant bit in the IP
+                      broadcast address used for sending datagrams on
+                      the (logical) interface associated with the IP
+                      address of this entry.  For example, when the
+                      Internet standard all-ones broadcast address is
+                      used, the value will be 1.  This value applies to
+                      both the subnet and network broadcasts addresses
+                      used by the entity on this (logical) interface."
+              ::= { ipAddrEntry 4 }
+
+          ipAdEntReasmMaxSize OBJECT-TYPE
+              SYNTAX  INTEGER (0..65535)
+              ACCESS  read-only
+              STATUS  mandatory
+              DESCRIPTION
+                      "The size of the largest IP datagram which this
+                      entity can re-assemble from incoming IP fragmented
+                      datagrams received on this interface."
+              ::= { ipAddrEntry 5 }
+
+          -- the IP routing table
+
+          -- The IP routing table contains an entry for each route
+          -- presently known to this entity.
+
+          ipRouteTable OBJECT-TYPE
+              SYNTAX  SEQUENCE OF IpRouteEntry
+              ACCESS  not-accessible
+              STATUS  mandatory
+              DESCRIPTION
+                      "This entity's IP Routing table."
+              ::= { ip 21 }
+
+          ipRouteEntry OBJECT-TYPE
+              SYNTAX  IpRouteEntry
+              ACCESS  not-accessible
+              STATUS  mandatory
+              DESCRIPTION
+                      "A route to a particular destination."
+              INDEX   { ipRouteDest }
+              ::= { ipRouteTable 1 }
+
+          IpRouteEntry ::=
+              SEQUENCE {
+                  ipRouteDest
+                      IpAddress,
+                  ipRouteIfIndex
+                      INTEGER,
+                  ipRouteMetric1
+                      INTEGER,
+                  ipRouteMetric2
+                      INTEGER,
+                  ipRouteMetric3
+                      INTEGER,
+                  ipRouteMetric4
+                      INTEGER,
+                  ipRouteNextHop
+                      IpAddress,
+                  ipRouteType
+                      INTEGER,
+                  ipRouteProto
+                      INTEGER,
+                  ipRouteAge
+                      INTEGER,
+                  ipRouteMask
+                      IpAddress,
+                  ipRouteMetric5
+                      INTEGER,
+                  ipRouteInfo
+                      OBJECT IDENTIFIER
+              }
+
+          ipRouteDest OBJECT-TYPE
+              SYNTAX  IpAddress
+              ACCESS  read-write
+              STATUS  mandatory
+              DESCRIPTION
+                      "The destination IP address of this route.  An
+                      entry with a value of 0.0.0.0 is considered a
+                      default route.  Multiple routes to a single
+                      destination can appear in the table, but access to
+                      such multiple entries is dependent on the table-
+                      access mechanisms defined by the network
+                      management protocol in use."
+              ::= { ipRouteEntry 1 }
+
+          ipRouteIfIndex OBJECT-TYPE
+              SYNTAX  INTEGER
+              ACCESS  read-write
+              STATUS  mandatory
+              DESCRIPTION
+                      "The index value which uniquely identifies the
+                      local interface through which the next hop of this
+                      route should be reached.  The interface identified
+                      by a particular value of this index is the same
+                      interface as identified by the same value of
+                      ifIndex."
+              ::= { ipRouteEntry 2 }
+
+          ipRouteMetric1 OBJECT-TYPE
+              SYNTAX  INTEGER
+              ACCESS  read-write
+              STATUS  mandatory
+              DESCRIPTION
+                      "The primary routing metric for this route.  The
+                      semantics of this metric are determined by the
+                      routing-protocol specified in the route's
+                      ipRouteProto value.  If this metric is not used,
+                      its value should be set to -1."
+              ::= { ipRouteEntry 3 }
+
+          ipRouteMetric2 OBJECT-TYPE
+              SYNTAX  INTEGER
+              ACCESS  read-write
+              STATUS  mandatory
+              DESCRIPTION
+                      "An alternate routing metric for this route.  The
+                      semantics of this metric are determined by the
+                      routing-protocol specified in the route's
+                      ipRouteProto value.  If this metric is not used,
+                      its value should be set to -1."
+              ::= { ipRouteEntry 4 }
+
+          ipRouteMetric3 OBJECT-TYPE
+              SYNTAX  INTEGER
+              ACCESS  read-write
+              STATUS  mandatory
+              DESCRIPTION
+                      "An alternate routing metric for this route.  The
+                      semantics of this metric are determined by the
+                      routing-protocol specified in the route's
+                      ipRouteProto value.  If this metric is not used,
+                      its value should be set to -1."
+              ::= { ipRouteEntry 5 }
+
+          ipRouteMetric4 OBJECT-TYPE
+              SYNTAX  INTEGER
+              ACCESS  read-write
+              STATUS  mandatory
+              DESCRIPTION
+                      "An alternate routing metric for this route.  The
+                      semantics of this metric are determined by the
+                      routing-protocol specified in the route's
+                      ipRouteProto value.  If this metric is not used,
+                      its value should be set to -1."
+              ::= { ipRouteEntry 6 }
+
+          ipRouteNextHop OBJECT-TYPE
+              SYNTAX  IpAddress
+              ACCESS  read-write
+              STATUS  mandatory
+              DESCRIPTION
+                      "The IP address of the next hop of this route.
+                      (In the case of a route bound to an interface
+                      which is realized via a broadcast media, the value
+                      of this field is the agent's IP address on that
+                      interface.)"
+              ::= { ipRouteEntry 7 }
+
+          ipRouteType OBJECT-TYPE
+              SYNTAX  INTEGER {
+                          other(1),        -- none of the following
+
+                          invalid(2),      -- an invalidated route
+                                           -- route to directly
+
+                          direct(3),       -- connected (sub-)network
+
+                                           -- route to a non-local
+                          indirect(4)      -- host/network/sub-network
+                      }
+              ACCESS  read-write
+              STATUS  mandatory
+              DESCRIPTION
+                      "The type of route.  Note that the values
+                      direct(3) and indirect(4) refer to the notion of
+                      direct and indirect routing in the IP
+                      architecture.
+
+                      Setting this object to the value invalid(2) has
+                      the effect of invalidating the corresponding entry
+                      in the ipRouteTable object.  That is, it
+                      effectively dissasociates the destination
+                      identified with said entry from the route
+                      identified with said entry.  It is an
+                      implementation-specific matter as to whether the
+                      agent removes an invalidated entry from the table.
+                      Accordingly, management stations must be prepared
+                      to receive tabular information from agents that
+                      corresponds to entries not currently in use.
+                      Proper interpretation of such entries requires
+                      examination of the relevant ipRouteType object."
+              ::= { ipRouteEntry 8 }
+
+          ipRouteProto OBJECT-TYPE
+              SYNTAX  INTEGER {
+                          other(1),       -- none of the following
+
+                                          -- non-protocol information,
+                                          -- e.g., manually configured
+                          local(2),       -- entries
+
+                                          -- set via a network
+                          netmgmt(3),     -- management protocol
+
+                                          -- obtained via ICMP,
+                          icmp(4),        -- e.g., Redirect
+
+                                          -- the remaining values are
+                                          -- all gateway routing
+                                          -- protocols
+                          egp(5),
+                          ggp(6),
+                          hello(7),
+                          rip(8),
+                          is-is(9),
+                          es-is(10),
+                          ciscoIgrp(11),
+                          bbnSpfIgp(12),
+                          ospf(13),
+                          bgp(14)
+                      }
+              ACCESS  read-only
+              STATUS  mandatory
+              DESCRIPTION
+                      "The routing mechanism via which this route was
+                      learned.  Inclusion of values for gateway routing
+                      protocols is not intended to imply that hosts
+                      should support those protocols."
+              ::= { ipRouteEntry 9 }
+
+          ipRouteAge OBJECT-TYPE
+              SYNTAX  INTEGER
+              ACCESS  read-write
+              STATUS  mandatory
+              DESCRIPTION
+                      "The number of seconds since this route was last
+                      updated or otherwise determined to be correct.
+                      Note that no semantics of `too old' can be implied
+                      except through knowledge of the routing protocol
+                      by which the route was learned."
+              ::= { ipRouteEntry 10 }
+
+          ipRouteMask OBJECT-TYPE
+              SYNTAX  IpAddress
+              ACCESS  read-write
+              STATUS  mandatory
+              DESCRIPTION
+                      "Indicate the mask to be logical-ANDed with the
+                      destination address before being compared to the
+                      value in the ipRouteDest field.  For those systems
+                      that do not support arbitrary subnet masks, an
+                      agent constructs the value of the ipRouteMask by
+                      determining whether the value of the correspondent
+                      ipRouteDest field belong to a class-A, B, or C
+                      network, and then using one of:
+
+                           mask           network
+                           255.0.0.0      class-A
+                           255.255.0.0    class-B
+                           255.255.255.0  class-C
+
+                      If the value of the ipRouteDest is 0.0.0.0 (a
+                      default route), then the mask value is also
+                      0.0.0.0.  It should be noted that all IP routing
+                      subsystems implicitly use this mechanism."
+              ::= { ipRouteEntry 11 }
+
+          ipRouteMetric5 OBJECT-TYPE
+              SYNTAX  INTEGER
+              ACCESS  read-write
+              STATUS  mandatory
+              DESCRIPTION
+                      "An alternate routing metric for this route.  The
+                      semantics of this metric are determined by the
+                      routing-protocol specified in the route's
+                      ipRouteProto value.  If this metric is not used,
+                      its value should be set to -1."
+              ::= { ipRouteEntry 12 }
+
+          ipRouteInfo OBJECT-TYPE
+              SYNTAX  OBJECT IDENTIFIER
+              ACCESS  read-only
+              STATUS  mandatory
+              DESCRIPTION
+                      "A reference to MIB definitions specific to the
+                      particular routing protocol which is responsible
+                      for this route, as determined by the value
+                      specified in the route's ipRouteProto value.  If
+                      this information is not present, its value should
+                      be set to the OBJECT IDENTIFIER { 0 0 }, which is
+                      a syntatically valid object identifier, and any
+                      conformant implementation of ASN.1 and BER must be
+                      able to generate and recognize this value."
+              ::= { ipRouteEntry 13 }
+
+
+          -- the IP Address Translation table
+
+          -- The IP address translation table contain the IpAddress to
+          -- `physical' address equivalences.  Some interfaces do not
+          -- use translation tables for determining address
+          -- equivalences (e.g., DDN-X.25 has an algorithmic method);
+          -- if all interfaces are of this type, then the Address
+          -- Translation table is empty, i.e., has zero entries.
+
+          ipNetToMediaTable OBJECT-TYPE
+              SYNTAX  SEQUENCE OF IpNetToMediaEntry
+              ACCESS  not-accessible
+              STATUS  mandatory
+              DESCRIPTION
+                      "The IP Address Translation table used for mapping
+                      from IP addresses to physical addresses."
+              ::= { ip 22 }
+
+          ipNetToMediaEntry OBJECT-TYPE
+              SYNTAX  IpNetToMediaEntry
+              ACCESS  not-accessible
+              STATUS  mandatory
+              DESCRIPTION
+                      "Each entry contains one IpAddress to `physical'
+                      address equivalence."
+              INDEX   { ipNetToMediaIfIndex,
+                        ipNetToMediaNetAddress }
+              ::= { ipNetToMediaTable 1 }
+
+          IpNetToMediaEntry ::=
+              SEQUENCE {
+                  ipNetToMediaIfIndex
+                      INTEGER,
+                  ipNetToMediaPhysAddress
+                      PhysAddress,
+                  ipNetToMediaNetAddress
+                      IpAddress,
+                  ipNetToMediaType
+                      INTEGER
+              }
+
+          ipNetToMediaIfIndex OBJECT-TYPE
+              SYNTAX  INTEGER
+              ACCESS  read-write
+              STATUS  mandatory
+              DESCRIPTION
+                      "The interface on which this entry's equivalence
+                      is effective.  The interface identified by a
+                      particular value of this index is the same
+                      interface as identified by the same value of
+                      ifIndex."
+              ::= { ipNetToMediaEntry 1 }
+
+          ipNetToMediaPhysAddress OBJECT-TYPE
+              SYNTAX  PhysAddress
+              ACCESS  read-write
+              STATUS  mandatory
+              DESCRIPTION
+                      "The media-dependent `physical' address."
+              ::= { ipNetToMediaEntry 2 }
+
+          ipNetToMediaNetAddress OBJECT-TYPE
+              SYNTAX  IpAddress
+              ACCESS  read-write
+              STATUS  mandatory
+              DESCRIPTION
+                      "The IpAddress corresponding to the media-
+                      dependent `physical' address."
+              ::= { ipNetToMediaEntry 3 }
+
+          ipNetToMediaType OBJECT-TYPE
+              SYNTAX  INTEGER {
+                          other(1),        -- none of the following
+                          invalid(2),      -- an invalidated mapping
+                          dynamic(3),
+                          static(4)
+                      }
+              ACCESS  read-write
+              STATUS  mandatory
+              DESCRIPTION
+                      "The type of mapping.
+
+                      Setting this object to the value invalid(2) has
+                      the effect of invalidating the corresponding entry
+                      in the ipNetToMediaTable.  That is, it effectively
+                      dissasociates the interface identified with said
+                      entry from the mapping identified with said entry.
+                      It is an implementation-specific matter as to
+                      whether the agent removes an invalidated entry
+                      from the table.  Accordingly, management stations
+                      must be prepared to receive tabular information
+                      from agents that corresponds to entries not
+                      currently in use.  Proper interpretation of such
+                      entries requires examination of the relevant
+                      ipNetToMediaType object."
+              ::= { ipNetToMediaEntry 4 }
+
+
+          -- additional IP objects
+
+          ipRoutingDiscards OBJECT-TYPE
+              SYNTAX  Counter
+              ACCESS  read-only
+              STATUS  mandatory
+              DESCRIPTION
+                      "The number of routing entries which were chosen
+                      to be discarded even though they are valid.  One
+                      possible reason for discarding such an entry could
+                      be to free-up buffer space for other routing
+                      entries."
+              ::= { ip 23 }
+
+
+          -- the ICMP group
+
+          -- Implementation of the ICMP group is mandatory for all
+          -- systems.
+
+          icmpInMsgs OBJECT-TYPE
+              SYNTAX  Counter
+              ACCESS  read-only
+              STATUS  mandatory
+              DESCRIPTION
+                      "The total number of ICMP messages which the
+                      entity received.  Note that this counter includes
+                      all those counted by icmpInErrors."
+              ::= { icmp 1 }
+
+          icmpInErrors OBJECT-TYPE
+              SYNTAX  Counter
+              ACCESS  read-only
+              STATUS  mandatory
+              DESCRIPTION
+                      "The number of ICMP messages which the entity
+                      received but determined as having ICMP-specific
+                      errors (bad ICMP checksums, bad length, etc.)."
+              ::= { icmp 2 }
+
+          icmpInDestUnreachs OBJECT-TYPE
+              SYNTAX  Counter
+              ACCESS  read-only
+              STATUS  mandatory
+              DESCRIPTION
+                      "The number of ICMP Destination Unreachable
+                      messages received."
+              ::= { icmp 3 }
+
+          icmpInTimeExcds OBJECT-TYPE
+              SYNTAX  Counter
+              ACCESS  read-only
+              STATUS  mandatory
+              DESCRIPTION
+                      "The number of ICMP Time Exceeded messages
+                      received."
+              ::= { icmp 4 }
+
+          icmpInParmProbs OBJECT-TYPE
+              SYNTAX  Counter
+              ACCESS  read-only
+              STATUS  mandatory
+              DESCRIPTION
+                      "The number of ICMP Parameter Problem messages
+                      received."
+              ::= { icmp 5 }
+
+          icmpInSrcQuenchs OBJECT-TYPE
+              SYNTAX  Counter
+              ACCESS  read-only
+              STATUS  mandatory
+              DESCRIPTION
+                      "The number of ICMP Source Quench messages
+                      received."
+              ::= { icmp 6 }
+
+          icmpInRedirects OBJECT-TYPE
+              SYNTAX  Counter
+              ACCESS  read-only
+              STATUS  mandatory
+              DESCRIPTION
+                      "The number of ICMP Redirect messages received."
+              ::= { icmp 7 }
+
+          icmpInEchos OBJECT-TYPE
+              SYNTAX  Counter
+              ACCESS  read-only
+              STATUS  mandatory
+              DESCRIPTION
+                      "The number of ICMP Echo (request) messages
+                      received."
+              ::= { icmp 8 }
+
+          icmpInEchoReps OBJECT-TYPE
+              SYNTAX  Counter
+              ACCESS  read-only
+              STATUS  mandatory
+              DESCRIPTION
+                      "The number of ICMP Echo Reply messages received."
+              ::= { icmp 9 }
+
+          icmpInTimestamps OBJECT-TYPE
+              SYNTAX  Counter
+              ACCESS  read-only
+              STATUS  mandatory
+              DESCRIPTION
+                      "The number of ICMP Timestamp (request) messages
+                      received."
+              ::= { icmp 10 }
+
+          icmpInTimestampReps OBJECT-TYPE
+              SYNTAX  Counter
+              ACCESS  read-only
+              STATUS  mandatory
+              DESCRIPTION
+                      "The number of ICMP Timestamp Reply messages
+                      received."
+              ::= { icmp 11 }
+
+          icmpInAddrMasks OBJECT-TYPE
+              SYNTAX  Counter
+              ACCESS  read-only
+              STATUS  mandatory
+              DESCRIPTION
+                      "The number of ICMP Address Mask Request messages
+                      received."
+              ::= { icmp 12 }
+
+          icmpInAddrMaskReps OBJECT-TYPE
+              SYNTAX  Counter
+              ACCESS  read-only
+              STATUS  mandatory
+              DESCRIPTION
+                      "The number of ICMP Address Mask Reply messages
+                      received."
+              ::= { icmp 13 }
+
+          icmpOutMsgs OBJECT-TYPE
+              SYNTAX  Counter
+              ACCESS  read-only
+              STATUS  mandatory
+              DESCRIPTION
+                      "The total number of ICMP messages which this
+                      entity attempted to send.  Note that this counter
+                      includes all those counted by icmpOutErrors."
+              ::= { icmp 14 }
+
+          icmpOutErrors OBJECT-TYPE
+              SYNTAX  Counter
+              ACCESS  read-only
+              STATUS  mandatory
+              DESCRIPTION
+                      "The number of ICMP messages which this entity did
+                      not send due to problems discovered within ICMP
+                      such as a lack of buffers.  This value should not
+                      include errors discovered outside the ICMP layer
+                      such as the inability of IP to route the resultant
+                      datagram.  In some implementations there may be no
+                      types of error which contribute to this counter's
+                      value."
+              ::= { icmp 15 }
+
+          icmpOutDestUnreachs OBJECT-TYPE
+              SYNTAX  Counter
+              ACCESS  read-only
+              STATUS  mandatory
+              DESCRIPTION
+                      "The number of ICMP Destination Unreachable
+                      messages sent."
+              ::= { icmp 16 }
+
+          icmpOutTimeExcds OBJECT-TYPE
+              SYNTAX  Counter
+              ACCESS  read-only
+              STATUS  mandatory
+              DESCRIPTION
+                      "The number of ICMP Time Exceeded messages sent."
+              ::= { icmp 17 }
+
+          icmpOutParmProbs OBJECT-TYPE
+              SYNTAX  Counter
+              ACCESS  read-only
+              STATUS  mandatory
+              DESCRIPTION
+                      "The number of ICMP Parameter Problem messages
+                      sent."
+              ::= { icmp 18 }
+
+          icmpOutSrcQuenchs OBJECT-TYPE
+              SYNTAX  Counter
+              ACCESS  read-only
+              STATUS  mandatory
+              DESCRIPTION
+                      "The number of ICMP Source Quench messages sent."
+              ::= { icmp 19 }
+
+          icmpOutRedirects OBJECT-TYPE
+              SYNTAX  Counter
+              ACCESS  read-only
+              STATUS  mandatory
+              DESCRIPTION
+                      "The number of ICMP Redirect messages sent.  For a
+                      host, this object will always be zero, since hosts
+                      do not send redirects."
+              ::= { icmp 20 }
+
+          icmpOutEchos OBJECT-TYPE
+              SYNTAX  Counter
+              ACCESS  read-only
+              STATUS  mandatory
+              DESCRIPTION
+                      "The number of ICMP Echo (request) messages sent."
+              ::= { icmp 21 }
+
+          icmpOutEchoReps OBJECT-TYPE
+              SYNTAX  Counter
+              ACCESS  read-only
+              STATUS  mandatory
+              DESCRIPTION
+                      "The number of ICMP Echo Reply messages sent."
+              ::= { icmp 22 }
+
+          icmpOutTimestamps OBJECT-TYPE
+              SYNTAX  Counter
+              ACCESS  read-only
+              STATUS  mandatory
+              DESCRIPTION
+                      "The number of ICMP Timestamp (request) messages
+                      sent."
+              ::= { icmp 23 }
+
+          icmpOutTimestampReps OBJECT-TYPE
+              SYNTAX  Counter
+              ACCESS  read-only
+              STATUS  mandatory
+              DESCRIPTION
+                      "The number of ICMP Timestamp Reply messages
+                      sent."
+              ::= { icmp 24 }
+
+          icmpOutAddrMasks OBJECT-TYPE
+              SYNTAX  Counter
+              ACCESS  read-only
+              STATUS  mandatory
+              DESCRIPTION
+                      "The number of ICMP Address Mask Request messages
+                      sent."
+              ::= { icmp 25 }
+
+          icmpOutAddrMaskReps OBJECT-TYPE
+              SYNTAX  Counter
+              ACCESS  read-only
+              STATUS  mandatory
+              DESCRIPTION
+                      "The number of ICMP Address Mask Reply messages
+                      sent."
+              ::= { icmp 26 }
+
+
+          -- the TCP group
+
+          -- Implementation of the TCP group is mandatory for all
+          -- systems that implement the TCP.
+
+          -- Note that instances of object types that represent
+          -- information about a particular TCP connection are
+          -- transient; they persist only as long as the connection
+          -- in question.
+
+          tcpRtoAlgorithm OBJECT-TYPE
+              SYNTAX  INTEGER {
+                          other(1),    -- none of the following
+
+                          constant(2), -- a constant rto
+                          rsre(3),     -- MIL-STD-1778, Appendix B
+                          vanj(4)      -- Van Jacobson's algorithm [10]
+                      }
+              ACCESS  read-only
+              STATUS  mandatory
+              DESCRIPTION
+                      "The algorithm used to determine the timeout value
+                      used for retransmitting unacknowledged octets."
+              ::= { tcp 1 }
+
+          tcpRtoMin OBJECT-TYPE
+              SYNTAX  INTEGER
+              ACCESS  read-only
+              STATUS  mandatory
+              DESCRIPTION
+                      "The minimum value permitted by a TCP
+                      implementation for the retransmission timeout,
+                      measured in milliseconds.  More refined semantics
+                      for objects of this type depend upon the algorithm
+                      used to determine the retransmission timeout.  In
+                      particular, when the timeout algorithm is rsre(3),
+                      an object of this type has the semantics of the
+                      LBOUND quantity described in RFC 793."
+              ::= { tcp 2 }
+
+
+          tcpRtoMax OBJECT-TYPE
+              SYNTAX  INTEGER
+              ACCESS  read-only
+              STATUS  mandatory
+              DESCRIPTION
+                      "The maximum value permitted by a TCP
+                      implementation for the retransmission timeout,
+                      measured in milliseconds.  More refined semantics
+                      for objects of this type depend upon the algorithm
+                      used to determine the retransmission timeout.  In
+                      particular, when the timeout algorithm is rsre(3),
+                      an object of this type has the semantics of the
+                      UBOUND quantity described in RFC 793."
+              ::= { tcp 3 }
+
+          tcpMaxConn OBJECT-TYPE
+              SYNTAX  INTEGER
+              ACCESS  read-only
+              STATUS  mandatory
+              DESCRIPTION
+                      "The limit on the total number of TCP connections
+                      the entity can support.  In entities where the
+                      maximum number of connections is dynamic, this
+                      object should contain the value -1."
+              ::= { tcp 4 }
+
+          tcpActiveOpens OBJECT-TYPE
+              SYNTAX  Counter
+              ACCESS  read-only
+              STATUS  mandatory
+              DESCRIPTION
+                      "The number of times TCP connections have made a
+                      direct transition to the SYN-SENT state from the
+                      CLOSED state."
+              ::= { tcp 5 }
+
+          tcpPassiveOpens OBJECT-TYPE
+              SYNTAX  Counter
+              ACCESS  read-only
+              STATUS  mandatory
+              DESCRIPTION
+                      "The number of times TCP connections have made a
+                      direct transition to the SYN-RCVD state from the
+                      LISTEN state."
+              ::= { tcp 6 }
+
+          tcpAttemptFails OBJECT-TYPE
+              SYNTAX  Counter
+              ACCESS  read-only
+              STATUS  mandatory
+              DESCRIPTION
+                      "The number of times TCP connections have made a
+                      direct transition to the CLOSED state from either
+                      the SYN-SENT state or the SYN-RCVD state, plus the
+                      number of times TCP connections have made a direct
+                      transition to the LISTEN state from the SYN-RCVD
+                      state."
+              ::= { tcp 7 }
+
+          tcpEstabResets OBJECT-TYPE
+              SYNTAX  Counter
+              ACCESS  read-only
+              STATUS  mandatory
+              DESCRIPTION
+                      "The number of times TCP connections have made a
+                      direct transition to the CLOSED state from either
+                      the ESTABLISHED state or the CLOSE-WAIT state."
+              ::= { tcp 8 }
+
+          tcpCurrEstab OBJECT-TYPE
+              SYNTAX  Gauge
+              ACCESS  read-only
+              STATUS  mandatory
+              DESCRIPTION
+                      "The number of TCP connections for which the
+                      current state is either ESTABLISHED or CLOSE-
+                      WAIT."
+              ::= { tcp 9 }
+
+          tcpInSegs OBJECT-TYPE
+              SYNTAX  Counter
+              ACCESS  read-only
+              STATUS  mandatory
+              DESCRIPTION
+                      "The total number of segments received, including
+                      those received in error.  This count includes
+                      segments received on currently established
+                      connections."
+              ::= { tcp 10 }
+
+          tcpOutSegs OBJECT-TYPE
+              SYNTAX  Counter
+              ACCESS  read-only
+              STATUS  mandatory
+              DESCRIPTION
+                      "The total number of segments sent, including
+                      those on current connections but excluding those
+                      containing only retransmitted octets."
+              ::= { tcp 11 }
+
+          tcpRetransSegs OBJECT-TYPE
+              SYNTAX  Counter
+              ACCESS  read-only
+              STATUS  mandatory
+              DESCRIPTION
+                      "The total number of segments retransmitted - that
+                      is, the number of TCP segments transmitted
+                      containing one or more previously transmitted
+                      octets."
+              ::= { tcp 12 }
+
+
+          -- the TCP Connection table
+
+          -- The TCP connection table contains information about this
+          -- entity's existing TCP connections.
+
+          tcpConnTable OBJECT-TYPE
+              SYNTAX  SEQUENCE OF TcpConnEntry
+              ACCESS  not-accessible
+              STATUS  mandatory
+              DESCRIPTION
+                      "A table containing TCP connection-specific
+                      information."
+              ::= { tcp 13 }
+
+          tcpConnEntry OBJECT-TYPE
+              SYNTAX  TcpConnEntry
+              ACCESS  not-accessible
+              STATUS  mandatory
+              DESCRIPTION
+                      "Information about a particular current TCP
+                      connection.  An object of this type is transient,
+                      in that it ceases to exist when (or soon after)
+                      the connection makes the transition to the CLOSED
+                      state."
+              INDEX   { tcpConnLocalAddress,
+                        tcpConnLocalPort,
+                        tcpConnRemAddress,
+                        tcpConnRemPort }
+              ::= { tcpConnTable 1 }
+
+          TcpConnEntry ::=
+              SEQUENCE {
+                  tcpConnState
+                      INTEGER,
+                  tcpConnLocalAddress
+                      IpAddress,
+                  tcpConnLocalPort
+                      INTEGER (0..65535),
+                  tcpConnRemAddress
+                      IpAddress,
+                  tcpConnRemPort
+                      INTEGER (0..65535)
+              }
+
+          tcpConnState OBJECT-TYPE
+              SYNTAX  INTEGER {
+                          closed(1),
+                          listen(2),
+                          synSent(3),
+                          synReceived(4),
+                          established(5),
+                          finWait1(6),
+                          finWait2(7),
+                          closeWait(8),
+                          lastAck(9),
+                          closing(10),
+                          timeWait(11),
+                          deleteTCB(12)
+                      }
+              ACCESS  read-write
+              STATUS  mandatory
+              DESCRIPTION
+                      "The state of this TCP connection.
+
+                      The only value which may be set by a management
+                      station is deleteTCB(12).  Accordingly, it is
+                      appropriate for an agent to return a `badValue'
+                      response if a management station attempts to set
+                      this object to any other value.
+
+                      If a management station sets this object to the
+                      value deleteTCB(12), then this has the effect of
+                      deleting the TCB (as defined in RFC 793) of the
+                      corresponding connection on the managed node,
+                      resulting in immediate termination of the
+                      connection.
+
+                      As an implementation-specific option, a RST
+                      segment may be sent from the managed node to the
+                      other TCP endpoint (note however that RST segments
+                      are not sent reliably)."
+              ::= { tcpConnEntry 1 }
+
+          tcpConnLocalAddress OBJECT-TYPE
+              SYNTAX  IpAddress
+              ACCESS  read-only
+              STATUS  mandatory
+              DESCRIPTION
+                      "The local IP address for this TCP connection.  In
+                      the case of a connection in the listen state which
+                      is willing to accept connections for any IP
+                      interface associated with the node, the value
+                      0.0.0.0 is used."
+              ::= { tcpConnEntry 2 }
+
+          tcpConnLocalPort OBJECT-TYPE
+              SYNTAX  INTEGER (0..65535)
+              ACCESS  read-only
+              STATUS  mandatory
+              DESCRIPTION
+                      "The local port number for this TCP connection."
+              ::= { tcpConnEntry 3 }
+
+          tcpConnRemAddress OBJECT-TYPE
+              SYNTAX  IpAddress
+              ACCESS  read-only
+              STATUS  mandatory
+              DESCRIPTION
+                      "The remote IP address for this TCP connection."
+              ::= { tcpConnEntry 4 }
+
+          tcpConnRemPort OBJECT-TYPE
+              SYNTAX  INTEGER (0..65535)
+              ACCESS  read-only
+              STATUS  mandatory
+              DESCRIPTION
+                      "The remote port number for this TCP connection."
+              ::= { tcpConnEntry 5 }
+
+
+          -- additional TCP objects
+
+          tcpInErrs OBJECT-TYPE
+              SYNTAX  Counter
+              ACCESS  read-only
+              STATUS  mandatory
+              DESCRIPTION
+                      "The total number of segments received in error
+                      (e.g., bad TCP checksums)."
+              ::= { tcp 14 }
+
+          tcpOutRsts OBJECT-TYPE
+              SYNTAX  Counter
+              ACCESS  read-only
+              STATUS  mandatory
+              DESCRIPTION
+                      "The number of TCP segments sent containing the
+                      RST flag."
+              ::= { tcp 15 }
+
+
+          -- the UDP group
+
+          -- Implementation of the UDP group is mandatory for all
+          -- systems which implement the UDP.
+
+          udpInDatagrams OBJECT-TYPE
+              SYNTAX  Counter
+              ACCESS  read-only
+              STATUS  mandatory
+              DESCRIPTION
+                      "The total number of UDP datagrams delivered to
+                      UDP users."
+              ::= { udp 1 }
+
+          udpNoPorts OBJECT-TYPE
+              SYNTAX  Counter
+              ACCESS  read-only
+              STATUS  mandatory
+              DESCRIPTION
+                      "The total number of received UDP datagrams for
+                      which there was no application at the destination
+                      port."
+              ::= { udp 2 }
+
+          udpInErrors OBJECT-TYPE
+              SYNTAX  Counter
+              ACCESS  read-only
+              STATUS  mandatory
+              DESCRIPTION
+                      "The number of received UDP datagrams that could
+                      not be delivered for reasons other than the lack
+                      of an application at the destination port."
+              ::= { udp 3 }
+
+          udpOutDatagrams OBJECT-TYPE
+              SYNTAX  Counter
+              ACCESS  read-only
+              STATUS  mandatory
+              DESCRIPTION
+                      "The total number of UDP datagrams sent from this
+                      entity."
+              ::= { udp 4 }
+
+
+          -- the UDP Listener table
+
+          -- The UDP listener table contains information about this
+          -- entity's UDP end-points on which a local application is
+          -- currently accepting datagrams.
+
+          udpTable OBJECT-TYPE
+              SYNTAX  SEQUENCE OF UdpEntry
+              ACCESS  not-accessible
+              STATUS  mandatory
+              DESCRIPTION
+                      "A table containing UDP listener information."
+              ::= { udp 5 }
+
+          udpEntry OBJECT-TYPE
+              SYNTAX  UdpEntry
+              ACCESS  not-accessible
+              STATUS  mandatory
+              DESCRIPTION
+                      "Information about a particular current UDP
+                      listener."
+              INDEX   { udpLocalAddress, udpLocalPort }
+              ::= { udpTable 1 }
+
+          UdpEntry ::=
+              SEQUENCE {
+                  udpLocalAddress
+                      IpAddress,
+                  udpLocalPort
+                      INTEGER (0..65535)
+              }
+
+          udpLocalAddress OBJECT-TYPE
+              SYNTAX  IpAddress
+              ACCESS  read-only
+              STATUS  mandatory
+              DESCRIPTION
+                      "The local IP address for this UDP listener.  In
+                      the case of a UDP listener which is willing to
+                      accept datagrams for any IP interface associated
+                      with the node, the value 0.0.0.0 is used."
+              ::= { udpEntry 1 }
+
+          udpLocalPort OBJECT-TYPE
+              SYNTAX  INTEGER (0..65535)
+              ACCESS  read-only
+              STATUS  mandatory
+              DESCRIPTION
+                      "The local port number for this UDP listener."
+              ::= { udpEntry 2 }
+
+
+          -- the EGP group
+
+          -- Implementation of the EGP group is mandatory for all
+          -- systems which implement the EGP.
+
+          egpInMsgs OBJECT-TYPE
+              SYNTAX  Counter
+              ACCESS  read-only
+              STATUS  mandatory
+              DESCRIPTION
+                      "The number of EGP messages received without
+                      error."
+              ::= { egp 1 }
+
+          egpInErrors OBJECT-TYPE
+              SYNTAX  Counter
+              ACCESS  read-only
+              STATUS  mandatory
+              DESCRIPTION
+                      "The number of EGP messages received that proved
+                      to be in error."
+              ::= { egp 2 }
+
+          egpOutMsgs OBJECT-TYPE
+              SYNTAX  Counter
+              ACCESS  read-only
+              STATUS  mandatory
+              DESCRIPTION
+                      "The total number of locally generated EGP
+                      messages."
+              ::= { egp 3 }
+
+          egpOutErrors OBJECT-TYPE
+              SYNTAX  Counter
+              ACCESS  read-only
+              STATUS  mandatory
+              DESCRIPTION
+                      "The number of locally generated EGP messages not
+                      sent due to resource limitations within an EGP
+                      entity."
+              ::= { egp 4 }
+
+
+          -- the EGP Neighbor table
+
+          -- The EGP neighbor table contains information about this
+          -- entity's EGP neighbors.
+
+          egpNeighTable OBJECT-TYPE
+              SYNTAX  SEQUENCE OF EgpNeighEntry
+              ACCESS  not-accessible
+              STATUS  mandatory
+              DESCRIPTION
+                      "The EGP neighbor table."
+              ::= { egp 5 }
+
+          egpNeighEntry OBJECT-TYPE
+              SYNTAX  EgpNeighEntry
+              ACCESS  not-accessible
+              STATUS  mandatory
+              DESCRIPTION
+                      "Information about this entity's relationship with
+                      a particular EGP neighbor."
+              INDEX   { egpNeighAddr }
+              ::= { egpNeighTable 1 }
+
+          EgpNeighEntry ::=
+              SEQUENCE {
+                  egpNeighState
+                      INTEGER,
+                  egpNeighAddr
+                      IpAddress,
+                  egpNeighAs
+                      INTEGER,
+                  egpNeighInMsgs
+                      Counter,
+                  egpNeighInErrs
+                      Counter,
+                  egpNeighOutMsgs
+                      Counter,
+                  egpNeighOutErrs
+                      Counter,
+                  egpNeighInErrMsgs
+                      Counter,
+                  egpNeighOutErrMsgs
+                      Counter,
+                  egpNeighStateUps
+                      Counter,
+                  egpNeighStateDowns
+                      Counter,
+                  egpNeighIntervalHello
+                      INTEGER,
+                  egpNeighIntervalPoll
+                      INTEGER,
+                  egpNeighMode
+                      INTEGER,
+                  egpNeighEventTrigger
+                      INTEGER
+              }
+
+          egpNeighState OBJECT-TYPE
+              SYNTAX  INTEGER {
+                          idle(1),
+                          acquisition(2),
+                          down(3),
+                          up(4),
+                          cease(5)
+                      }
+              ACCESS  read-only
+              STATUS  mandatory
+              DESCRIPTION
+                      "The EGP state of the local system with respect to
+                      this entry's EGP neighbor.  Each EGP state is
+                      represented by a value that is one greater than
+                      the numerical value associated with said state in
+                      RFC 904."
+              ::= { egpNeighEntry 1 }
+
+          egpNeighAddr OBJECT-TYPE
+              SYNTAX  IpAddress
+              ACCESS  read-only
+              STATUS  mandatory
+              DESCRIPTION
+                      "The IP address of this entry's EGP neighbor."
+              ::= { egpNeighEntry 2 }
+
+          egpNeighAs OBJECT-TYPE
+              SYNTAX  INTEGER
+              ACCESS  read-only
+              STATUS  mandatory
+              DESCRIPTION
+                      "The autonomous system of this EGP peer.  Zero
+                      should be specified if the autonomous system
+                      number of the neighbor is not yet known."
+              ::= { egpNeighEntry 3 }
+
+          egpNeighInMsgs OBJECT-TYPE
+              SYNTAX  Counter
+              ACCESS  read-only
+              STATUS  mandatory
+              DESCRIPTION
+                      "The number of EGP messages received without error
+                      from this EGP peer."
+              ::= { egpNeighEntry 4 }
+
+          egpNeighInErrs OBJECT-TYPE
+              SYNTAX  Counter
+              ACCESS  read-only
+              STATUS  mandatory
+              DESCRIPTION
+                      "The number of EGP messages received from this EGP
+                      peer that proved to be in error (e.g., bad EGP
+                      checksum)."
+              ::= { egpNeighEntry 5 }
+
+          egpNeighOutMsgs OBJECT-TYPE
+              SYNTAX  Counter
+              ACCESS  read-only
+              STATUS  mandatory
+              DESCRIPTION
+                      "The number of locally generated EGP messages to
+                      this EGP peer."
+              ::= { egpNeighEntry 6 }
+
+          egpNeighOutErrs OBJECT-TYPE
+              SYNTAX  Counter
+              ACCESS  read-only
+              STATUS  mandatory
+              DESCRIPTION
+                      "The number of locally generated EGP messages not
+                      sent to this EGP peer due to resource limitations
+                      within an EGP entity."
+              ::= { egpNeighEntry 7 }
+
+          egpNeighInErrMsgs OBJECT-TYPE
+              SYNTAX  Counter
+              ACCESS  read-only
+              STATUS  mandatory
+              DESCRIPTION
+                      "The number of EGP-defined error messages received
+                      from this EGP peer."
+              ::= { egpNeighEntry 8 }
+
+          egpNeighOutErrMsgs OBJECT-TYPE
+              SYNTAX  Counter
+              ACCESS  read-only
+              STATUS  mandatory
+              DESCRIPTION
+                      "The number of EGP-defined error messages sent to
+                      this EGP peer."
+              ::= { egpNeighEntry 9 }
+
+          egpNeighStateUps OBJECT-TYPE
+              SYNTAX  Counter
+              ACCESS  read-only
+              STATUS  mandatory
+              DESCRIPTION
+                      "The number of EGP state transitions to the UP
+                      state with this EGP peer."
+              ::= { egpNeighEntry 10 }
+
+          egpNeighStateDowns OBJECT-TYPE
+              SYNTAX  Counter
+              ACCESS  read-only
+              STATUS  mandatory
+              DESCRIPTION
+                      "The number of EGP state transitions from the UP
+                      state to any other state with this EGP peer."
+              ::= { egpNeighEntry 11 }
+
+          egpNeighIntervalHello OBJECT-TYPE
+              SYNTAX  INTEGER
+              ACCESS  read-only
+              STATUS  mandatory
+              DESCRIPTION
+                      "The interval between EGP Hello command
+                      retransmissions (in hundredths of a second).  This
+                      represents the t1 timer as defined in RFC 904."
+              ::= { egpNeighEntry 12 }
+
+          egpNeighIntervalPoll OBJECT-TYPE
+              SYNTAX  INTEGER
+              ACCESS  read-only
+              STATUS  mandatory
+              DESCRIPTION
+                      "The interval between EGP poll command
+                      retransmissions (in hundredths of a second).  This
+                      represents the t3 timer as defined in RFC 904."
+              ::= { egpNeighEntry 13 }
+
+          egpNeighMode OBJECT-TYPE
+              SYNTAX  INTEGER { active(1), passive(2) }
+              ACCESS  read-only
+              STATUS  mandatory
+              DESCRIPTION
+                      "The polling mode of this EGP entity, either
+                      passive or active."
+              ::= { egpNeighEntry 14 }
+
+          egpNeighEventTrigger OBJECT-TYPE
+              SYNTAX  INTEGER { start(1), stop(2) }
+              ACCESS  read-write
+              STATUS  mandatory
+              DESCRIPTION
+                      "A control variable used to trigger operator-
+                      initiated Start and Stop events.  When read, this
+                      variable always returns the most recent value that
+                      egpNeighEventTrigger was set to.  If it has not
+                      been set since the last initialization of the
+                      network management subsystem on the node, it
+                      returns a value of `stop'.
+
+                      When set, this variable causes a Start or Stop
+                      event on the specified neighbor, as specified on
+                      pages 8-10 of RFC 904.  Briefly, a Start event
+                      causes an Idle peer to begin neighbor acquisition
+                      and a non-Idle peer to reinitiate neighbor
+                      acquisition.  A stop event causes a non-Idle peer
+                      to return to the Idle state until a Start event
+                      occurs, either via egpNeighEventTrigger or
+                      otherwise."
+              ::= { egpNeighEntry 15 }
+
+
+          -- additional EGP objects
+
+          egpAs OBJECT-TYPE
+              SYNTAX  INTEGER
+              ACCESS  read-only
+              STATUS  mandatory
+              DESCRIPTION
+                      "The autonomous system number of this EGP entity."
+              ::= { egp 6 }
+
+
+          -- the Transmission group
+
+          -- Based on the transmission media underlying each interface
+          -- on a system, the corresponding portion of the Transmission
+          -- group is mandatory for that system.
+
+          -- When Internet-standard definitions for managing
+          -- transmission media are defined, the transmission group is
+          -- used to provide a prefix for the names of those objects.
+
+          -- Typically, such definitions reside in the experimental
+          -- portion of the MIB until they are "proven", then as a
+          -- part of the Internet standardization process, the
+          -- definitions are accordingly elevated and a new object
+          -- identifier, under the transmission group is defined. By
+          -- convention, the name assigned is:
+          --
+          --     type OBJECT IDENTIFIER    ::= { transmission number }
+          --
+          -- where "type" is the symbolic value used for the media in
+          -- the ifType column of the ifTable object, and "number" is
+          -- the actual integer value corresponding to the symbol.
+
+
+          -- the SNMP group
+
+          -- Implementation of the SNMP group is mandatory for all
+          -- systems which support an SNMP protocol entity.  Some of
+          -- the objects defined below will be zero-valued in those
+          -- SNMP implementations that are optimized to support only
+          -- those functions specific to either a management agent or
+          -- a management station.  In particular, it should be
+          -- observed that the objects below refer to an SNMP entity,
+          -- and there may be several SNMP entities residing on a
+          -- managed node (e.g., if the node is hosting acting as
+          -- a management station).
+
+          snmpInPkts OBJECT-TYPE
+              SYNTAX  Counter
+              ACCESS  read-only
+              STATUS  mandatory
+              DESCRIPTION
+                      "The total number of Messages delivered to the
+                      SNMP entity from the transport service."
+              ::= { snmp 1 }
+
+          snmpOutPkts OBJECT-TYPE
+              SYNTAX  Counter
+              ACCESS  read-only
+              STATUS  mandatory
+              DESCRIPTION
+                      "The total number of SNMP Messages which were
+                      passed from the SNMP protocol entity to the
+                      transport service."
+              ::= { snmp 2 }
+
+          snmpInBadVersions OBJECT-TYPE
+              SYNTAX  Counter
+              ACCESS  read-only
+              STATUS  mandatory
+              DESCRIPTION
+                      "The total number of SNMP Messages which were
+                      delivered to the SNMP protocol entity and were for
+                      an unsupported SNMP version."
+              ::= { snmp 3 }
+
+          snmpInBadCommunityNames OBJECT-TYPE
+              SYNTAX  Counter
+              ACCESS  read-only
+              STATUS  mandatory
+              DESCRIPTION
+                      "The total number of SNMP Messages delivered to
+                      the SNMP protocol entity which used a SNMP
+                      community name not known to said entity."
+              ::= { snmp 4 }
+
+          snmpInBadCommunityUses OBJECT-TYPE
+              SYNTAX  Counter
+              ACCESS  read-only
+              STATUS  mandatory
+              DESCRIPTION
+                      "The total number of SNMP Messages delivered to
+                      the SNMP protocol entity which represented an SNMP
+                      operation which was not allowed by the SNMP
+                      community named in the Message."
+              ::= { snmp 5 }
+
+          snmpInASNParseErrs OBJECT-TYPE
+              SYNTAX  Counter
+              ACCESS  read-only
+              STATUS  mandatory
+              DESCRIPTION
+                      "The total number of ASN.1 or BER errors
+                      encountered by the SNMP protocol entity when
+                      decoding received SNMP Messages."
+              ::= { snmp 6 }
+
+          -- { snmp 7 } is not used in rfc1213, but MIBII.mdl had one :(
+          snmpInBadTypes OBJECT-TYPE
+              SYNTAX  Counter
+              ACCESS  read-only
+              STATUS  mandatory
+              DESCRIPTION
+                      "Total number of PDUs having an unknown PDU type"
+              ::= { snmp 7 }
+
+          snmpInTooBigs OBJECT-TYPE
+              SYNTAX  Counter
+              ACCESS  read-only
+              STATUS  mandatory
+              DESCRIPTION
+                      "The total number of SNMP PDUs which were
+                      delivered to the SNMP protocol entity and for
+                      which the value of the error-status field is
+                      `tooBig'."
+              ::= { snmp 8 }
+
+          snmpInNoSuchNames OBJECT-TYPE
+              SYNTAX  Counter
+              ACCESS  read-only
+              STATUS  mandatory
+              DESCRIPTION
+                      "The total number of SNMP PDUs which were
+                      delivered to the SNMP protocol entity and for
+                      which the value of the error-status field is
+                      `noSuchName'."
+              ::= { snmp 9 }
+
+          snmpInBadValues OBJECT-TYPE
+              SYNTAX  Counter
+              ACCESS  read-only
+              STATUS  mandatory
+              DESCRIPTION
+                      "The total number of SNMP PDUs which were
+                      delivered to the SNMP protocol entity and for
+                      which the value of the error-status field is
+                      `badValue'."
+              ::= { snmp 10 }
+
+          snmpInReadOnlys OBJECT-TYPE
+              SYNTAX  Counter
+              ACCESS  read-only
+              STATUS  mandatory
+              DESCRIPTION
+                      "The total number valid SNMP PDUs which were
+                      delivered to the SNMP protocol entity and for
+                      which the value of the error-status field is
+                      `readOnly'.  It should be noted that it is a
+                      protocol error to generate an SNMP PDU which
+                      contains the value `readOnly' in the error-status
+                      field, as such this object is provided as a means
+                      of detecting incorrect implementations of the
+                      SNMP."
+              ::= { snmp 11 }
+
+          snmpInGenErrs OBJECT-TYPE
+              SYNTAX  Counter
+              ACCESS  read-only
+              STATUS  mandatory
+              DESCRIPTION
+                      "The total number of SNMP PDUs which were
+                      delivered to the SNMP protocol entity and for
+                      which the value of the error-status field is
+                      `genErr'."
+              ::= { snmp 12 }
+
+          snmpInTotalReqVars OBJECT-TYPE
+              SYNTAX  Counter
+              ACCESS  read-only
+              STATUS  mandatory
+              DESCRIPTION
+                      "The total number of MIB objects which have been
+                      retrieved successfully by the SNMP protocol entity
+                      as the result of receiving valid SNMP Get-Request
+                      and Get-Next PDUs."
+              ::= { snmp 13 }
+
+          snmpInTotalSetVars OBJECT-TYPE
+              SYNTAX  Counter
+              ACCESS  read-only
+              STATUS  mandatory
+              DESCRIPTION
+                      "The total number of MIB objects which have been
+                      altered successfully by the SNMP protocol entity
+                      as the result of receiving valid SNMP Set-Request
+                      PDUs."
+              ::= { snmp 14 }
+
+          snmpInGetRequests OBJECT-TYPE
+              SYNTAX  Counter
+              ACCESS  read-only
+              STATUS  mandatory
+              DESCRIPTION
+                      "The total number of SNMP Get-Request PDUs which
+                      have been accepted and processed by the SNMP
+                      protocol entity."
+              ::= { snmp 15 }
+
+          snmpInGetNexts OBJECT-TYPE
+              SYNTAX  Counter
+              ACCESS  read-only
+              STATUS  mandatory
+              DESCRIPTION
+                      "The total number of SNMP Get-Next PDUs which have
+                      been accepted and processed by the SNMP protocol
+                      entity."
+              ::= { snmp 16 }
+
+          snmpInSetRequests OBJECT-TYPE
+              SYNTAX  Counter
+              ACCESS  read-only
+              STATUS  mandatory
+              DESCRIPTION
+                      "The total number of SNMP Set-Request PDUs which
+                      have been accepted and processed by the SNMP
+                      protocol entity."
+              ::= { snmp 17 }
+
+          snmpInGetResponses OBJECT-TYPE
+              SYNTAX  Counter
+              ACCESS  read-only
+              STATUS  mandatory
+              DESCRIPTION
+                      "The total number of SNMP Get-Response PDUs which
+                      have been accepted and processed by the SNMP
+                      protocol entity."
+              ::= { snmp 18 }
+
+          snmpInTraps OBJECT-TYPE
+              SYNTAX  Counter
+              ACCESS  read-only
+              STATUS  mandatory
+              DESCRIPTION
+                      "The total number of SNMP Trap PDUs which have
+                      been accepted and processed by the SNMP protocol
+                      entity."
+              ::= { snmp 19 }
+
+          snmpOutTooBigs OBJECT-TYPE
+              SYNTAX  Counter
+              ACCESS  read-only
+              STATUS  mandatory
+              DESCRIPTION
+                      "The total number of SNMP PDUs which were
+                      generated by the SNMP protocol entity and for
+                      which the value of the error-status field is
+                      `tooBig.'"
+              ::= { snmp 20 }
+
+          snmpOutNoSuchNames OBJECT-TYPE
+              SYNTAX  Counter
+              ACCESS  read-only
+              STATUS  mandatory
+              DESCRIPTION
+                      "The total number of SNMP PDUs which were
+                      generated by the SNMP protocol entity and for
+                      which the value of the error-status is
+                      `noSuchName'."
+              ::= { snmp 21 }
+
+          snmpOutBadValues OBJECT-TYPE
+              SYNTAX  Counter
+              ACCESS  read-only
+              STATUS  mandatory
+              DESCRIPTION
+                      "The total number of SNMP PDUs which were
+                      generated by the SNMP protocol entity and for
+                      which the value of the error-status field is
+                      `badValue'."
+              ::= { snmp 22 }
+
+          -- { snmp 23 } is not used in rfc1213, but MIBII.mdl had one :(
+          snmpOutReadOnlys OBJECT-TYPE
+              SYNTAX  Counter
+              ACCESS  read-only
+              STATUS  mandatory
+              DESCRIPTION
+                      "The total number of SNMP PDUs which were
+                      generated by the SNMP protocol entity and for
+                      which the value of the error-status field is
+                      `readOnly'."
+              ::= { snmp 23 }
+
+          snmpOutGenErrs OBJECT-TYPE
+              SYNTAX  Counter
+              ACCESS  read-only
+              STATUS  mandatory
+              DESCRIPTION
+                      "The total number of SNMP PDUs which were
+                      generated by the SNMP protocol entity and for
+                      which the value of the error-status field is
+                      `genErr'."
+              ::= { snmp 24 }
+
+          snmpOutGetRequests OBJECT-TYPE
+              SYNTAX  Counter
+              ACCESS  read-only
+              STATUS  mandatory
+              DESCRIPTION
+                      "The total number of SNMP Get-Request PDUs which
+                      have been generated by the SNMP protocol entity."
+              ::= { snmp 25 }
+
+          snmpOutGetNexts OBJECT-TYPE
+              SYNTAX  Counter
+              ACCESS  read-only
+              STATUS  mandatory
+              DESCRIPTION
+                      "The total number of SNMP Get-Next PDUs which have
+                      been generated by the SNMP protocol entity."
+              ::= { snmp 26 }
+
+          snmpOutSetRequests OBJECT-TYPE
+              SYNTAX  Counter
+              ACCESS  read-only
+              STATUS  mandatory
+              DESCRIPTION
+                      "The total number of SNMP Set-Request PDUs which
+                      have been generated by the SNMP protocol entity."
+              ::= { snmp 27 }
+
+          snmpOutGetResponses OBJECT-TYPE
+              SYNTAX  Counter
+              ACCESS  read-only
+              STATUS  mandatory
+              DESCRIPTION
+                      "The total number of SNMP Get-Response PDUs which
+                      have been generated by the SNMP protocol entity."
+              ::= { snmp 28 }
+
+          snmpOutTraps OBJECT-TYPE
+              SYNTAX  Counter
+              ACCESS  read-only
+              STATUS  mandatory
+              DESCRIPTION
+                      "The total number of SNMP Trap PDUs which have
+                      been generated by the SNMP protocol entity."
+              ::= { snmp 29 }
+
+          snmpEnableAuthenTraps OBJECT-TYPE
+              SYNTAX  INTEGER { enabled(1), disabled(2) }
+              ACCESS  read-write
+              STATUS  mandatory
+              DESCRIPTION
+                      "Indicates whether the SNMP agent process is
+                      permitted to generate authentication-failure
+                      traps.  The value of this object overrides any
+                      configuration information; as such, it provides a
+                      means whereby all authentication-failure traps may
+                      be disabled.
+
+                      Note that it is strongly recommended that this
+                      object be stored in non-volatile memory so that it
+                      remains constant between re-initializations of the
+                      network management system."
+              ::= { snmp 30 }
+
+          END
+-- @(#)WSCCS g/mibs-wfcommon.mib 1.4 10/26/95
+Wellfleet-COMMON-MIB
+
+DEFINITIONS ::= BEGIN
+
+IMPORTS
+
+  enterprises
+    FROM RFC1155-SMI;
+
+wellfleet		OBJECT IDENTIFIER ::= { enterprises 18 }
+
+wfSwSeries7		OBJECT IDENTIFIER ::= { wellfleet 3 }
+
+wfHardwareConfig	OBJECT IDENTIFIER ::= { wfSwSeries7 1 }
+
+wfHwModuleGroup		OBJECT IDENTIFIER ::= { wfHardwareConfig 4 }
+
+wfSystem		OBJECT IDENTIFIER ::= { wfSwSeries7 3 }
+
+END  -- Wellfleet-COMMON-MIB
+-- @(#)WSCCS i/mibs-hardware.mib 1.2 10/9/95
+Wellfleet-HARDWARE-MIB DEFINITIONS ::= BEGIN
+
+-- Created by mdl2asn version 3.1
+-- Creation date: Wed Aug 30 16:42:01 EDT 1995
+
+
+    IMPORTS
+
+      IpAddress, Counter, Gauge, TimeTicks, Opaque, enterprises, mgmt
+        FROM RFC1155-SMI
+      OBJECT-TYPE
+        FROM RFC-1212
+      TRAP-TYPE
+        FROM RFC-1215
+      DisplayString, mib-2
+        FROM RFC1213-MIB
+      wfHardwareConfig
+        FROM Wellfleet-COMMON-MIB;
+
+
+    wfHwBase	OBJECT IDENTIFIER ::= { wfHardwareConfig 1 }
+
+    wfHwBpIdOpt OBJECT-TYPE
+        SYNTAX	INTEGER {
+    		    acefn(1),
+    		    aceln(2),
+    		    acecn(3),
+    		    afn(4),
+    		    in(5),
+    		    an(16),
+    		    sys5000(5000),
+    		    freln(16640),
+    		    frecn(16896),
+    		    frerbln(17152),
+    		    asn(20480),
+    		    asnzcable(20736),
+    		    asnbcable(20992)
+    		}
+        ACCESS	read-only
+        STATUS	mandatory
+        DESCRIPTION
+                "The BackPlane identification number."
+        ::= { wfHwBase 1 }
+
+    wfHwBpRev OBJECT-TYPE
+        SYNTAX	OCTET STRING
+        ACCESS	read-only
+        STATUS	mandatory
+        DESCRIPTION
+                "The revision level of the BackPlane. High byte is in upper 2 bytes."
+        ::= { wfHwBase 2 }
+
+    wfHwBpSerialNumber OBJECT-TYPE
+        SYNTAX	OCTET STRING
+        ACCESS	read-only
+        STATUS	mandatory
+        DESCRIPTION
+                "The serial number of the BackPlane."
+        ::= { wfHwBase 3 }
+
+    wfBCNPwrSupply1 OBJECT-TYPE
+        SYNTAX	INTEGER {
+    		    ok(1),
+    		    fail(2),
+    		    notpresent(3)
+    		}
+        ACCESS	read-only
+        STATUS	mandatory
+        DESCRIPTION
+                "Status of BCN Hot-Swappable Power Supply 1"
+        DEFVAL	{ notpresent }
+        ::= { wfHwBase 4 }
+
+    wfBCNPwrSupply2 OBJECT-TYPE
+        SYNTAX	INTEGER {
+    		    ok(1),
+    		    fail(2),
+    		    notpresent(3)
+    		}
+        ACCESS	read-only
+        STATUS	mandatory
+        DESCRIPTION
+                "Status of BCN Hot-Swappable Power Supply 2"
+        DEFVAL	{ notpresent }
+        ::= { wfHwBase 5 }
+
+    wfBCNPwrSupply3 OBJECT-TYPE
+        SYNTAX	INTEGER {
+    		    ok(1),
+    		    fail(2),
+    		    notpresent(3)
+    		}
+        ACCESS	read-only
+        STATUS	mandatory
+        DESCRIPTION
+                "Status of BCN Hot-Swappable Power Supply 3"
+        DEFVAL	{ notpresent }
+        ::= { wfHwBase 6 }
+
+    wfBCNPwrSupply4 OBJECT-TYPE
+        SYNTAX	INTEGER {
+    		    ok(1),
+    		    fail(2),
+    		    notpresent(3)
+    		}
+        ACCESS	read-only
+        STATUS	mandatory
+        DESCRIPTION
+                "Status of BCN Hot-Swappable Power Supply 4"
+        DEFVAL	{ notpresent }
+        ::= { wfHwBase 7 }
+
+    wfBCNFanStatus OBJECT-TYPE
+        SYNTAX	INTEGER {
+    		    ok(1),
+    		    fail(2),
+    		    notpresent(3)
+    		}
+        ACCESS	read-only
+        STATUS	mandatory
+        DESCRIPTION
+                "Status of BCN Fan Tray"
+        DEFVAL	{ notpresent }
+        ::= { wfHwBase 8 }
+
+    wfBCNTemperature OBJECT-TYPE
+        SYNTAX	INTEGER {
+    		    ok(1),
+    		    caution(2),
+    		    notpresent(3)
+    		}
+        ACCESS	read-only
+        STATUS	mandatory
+        DESCRIPTION
+                "Status of BCN Temperature sensor"
+        DEFVAL	{ notpresent }
+        ::= { wfHwBase 9 }
+
+    wfHwTable OBJECT-TYPE
+        SYNTAX	SEQUENCE OF WfHwEntry
+        ACCESS	not-accessible
+        STATUS	mandatory
+        DESCRIPTION
+                "Hardware Table  - indexed by slot number"
+        ::= { wfHardwareConfig 2 }
+
+    wfHwEntry OBJECT-TYPE
+        SYNTAX	WfHwEntry
+        ACCESS	not-accessible
+        STATUS	mandatory
+        DESCRIPTION
+                "Hardware specific information about a slot."
+        INDEX	{ wfHwSlot }
+        ::= { wfHwTable 1 }
+
+    WfHwEntry ::= SEQUENCE {
+    	    wfHwSlot
+    		INTEGER,
+    	    wfHwModIdOpt
+    		INTEGER,
+    	    wfHwModRev
+    		OCTET STRING,
+    	    wfHwModSerialNumber
+    		OCTET STRING,
+    	    wfHwMotherBdIdOpt
+    		INTEGER,
+    	    wfHwMotherBdRev
+    		OCTET STRING,
+    	    wfHwMotherBdSerialNumber
+    		OCTET STRING,
+    	    wfHwDaughterBdIdOpt
+    		INTEGER,
+    	    wfHwDaughterBdRev
+    		OCTET STRING,
+    	    wfHwDaughterBdSerialNumber
+    		OCTET STRING,
+    	    wfHwBabyBdIdOpt
+    		INTEGER,
+    	    wfHwBabyBdRev
+    		OCTET STRING,
+    	    wfHwBabyBdSerialNumber
+    		OCTET STRING,
+    	    wfHwDiagPromRev
+    		OCTET STRING,
+    	    wfHwDiagPromDate
+    		DisplayString,
+    	    wfHwDiagPromSource
+    		DisplayString,
+    	    wfHwBootPromRev
+    		OCTET STRING,
+    	    wfHwBootPromDate
+    		DisplayString,
+    	    wfHwBootPromSource
+    		DisplayString,
+    	    wfHwSparePromRev
+    		OCTET STRING,
+    	    wfHwSparePromDate
+    		DisplayString,
+    	    wfHwSparePromSource
+    		DisplayString,
+    	    wfHwFileSysPresent
+    		INTEGER,
+    	    wfHwFileSysPresent2
+    		INTEGER,
+    	    wfHwConfigServer
+    		INTEGER,
+    	    wfHwConfigFile
+    		DisplayString,
+    	    wfHwConfigDateAndTime
+    		OCTET STRING,
+    	    wfHwActiveImageName
+    		DisplayString,
+    	    wfHwActiveImageSource
+    		DisplayString,
+    	    wfHwActiveImageDate
+    		DisplayString,
+    	    wfHwMotherBdMemorySize
+    		INTEGER,
+    	    wfHwFastPacketCacheSize
+    		INTEGER,
+    	    wfHwModDaughterBd1IdOpt
+    		INTEGER,
+    	    wfHwModDaughterBd1AwRev
+    		OCTET STRING,
+    	    wfHwModDaughterBd1Rev
+    		OCTET STRING,
+    	    wfHwModDaughterBd1SerialNumber
+    		OCTET STRING,
+    	    wfHwModDaughterBd2IdOpt
+    		INTEGER,
+    	    wfHwModDaughterBd2AwRev
+    		OCTET STRING,
+    	    wfHwModDaughterBd2Rev
+    		OCTET STRING,
+    	    wfHwModDaughterBd2SerialNumber
+    		OCTET STRING
+        }
+
+    wfHwSlot OBJECT-TYPE
+        SYNTAX	INTEGER
+        ACCESS	read-only
+        STATUS	mandatory
+        DESCRIPTION
+                "A unique value for each slot.
+                Its value ranges between 1 and 14.
+                There are products in this family that contain 1, 5, and 14 slots."
+        ::= { wfHwEntry 1 }
+
+    wfHwModIdOpt OBJECT-TYPE
+        SYNTAX	INTEGER {
+    		    enet1(1),
+    		    enet2(8),
+    		    sync1(16),
+    		    sync1a(17),
+    		    t11(24),
+    		    dse1(32),
+    		    dse1a(33),
+    		    dst416(40),
+    		    sst416a(41),
+    		    dst4(42),
+    		    sst4a(43),
+    		    sst416(44),
+    		    stok416(45),
+    		    sst4(46),
+    		    stok4(47),
+    		    floppy(48),
+    		    necfloppy(49),
+    		    t12(56),
+    		    t12a(57),
+    		    st1(58),
+    		    t156k(60),
+    		    e1(61),
+    		    st156k(62),
+    		    se1(63),
+    		    t12n(64),
+    		    st1n(65),
+    		    t156kn(66),
+    		    st156kn(67),
+    		    e1n(68),
+    		    se1n(69),
+    		    sync(80),
+    		    sync2a(81),
+    		    cmcfddi(88),
+    		    iphfddi(89),
+    		    dt(104),
+    		    dsde1(112),
+    		    dsde1a(113),
+    		    enet(114),
+    		    dse2(116),
+    		    dse2a(117),
+    		    sse(118),
+    		    ssea(119),
+    		    dsde10bt(120),
+    		    enet3(132),
+    		    dsde2(156),
+    		    oldqenf(160),
+    		    denf(161),
+    		    qenf(162),
+    		    qef(164),
+    		    def(165),
+    		    mct1(168),
+    		    smct1(169),
+    		    dtok(176),
+    		    mce1(184),
+    		    smce1(185),
+    		    mce1ii75(188),
+    		    smce1ii75(189),
+    		    mce1ii120(190),
+    		    smce1ii120(191),
+    		    wffddi2m(192),
+    		    wffddi1m(193),
+    		    wffddi2s(194),
+    		    wffddi1s(195),
+    		    wffddi2mf(196),
+    		    wffddi1mf(197),
+    		    wffddi2sf(198),
+    		    wffddi1sf(199),
+    		    fmdset(200),
+    		    fmdst(201),
+    		    fmdse(202),
+    		    fmsst(203),
+    		    fmsse(204),
+    		    fnsdse(208),
+    		    fnsdsdt(216),
+    		    fnsdst(217),
+    		    dhssi(224),
+    		    shssi(225),
+    		    esafnf(232),
+    		    esafdsenf(233),
+    		    esafssenf(234),
+    		    esafdenf(235),
+    		    esaf(236),
+    		    esafdse(237),
+    		    esafsse(238),
+    		    esafde(239),
+    		    qtok(256),
+    		    asn(511),
+    		    anseds(1024),
+    		    ansedst(1025),
+    		    ansedsh(1026),
+    		    ansedsi(1027),
+    		    ansedsti(1028),
+    		    ansedshi(1029),
+    		    ansets(1030),
+    		    ansetst(1031),
+    		    ansetsh(1032),
+    		    andeds(1033),
+    		    andedst(1034),
+    		    andedsh(1035),
+    		    andstx(1036),
+    		    andst(1037),
+    		    andsti(1038),
+    		    antst(1039),
+    		    antstx(1040),
+    		    ansdsedst(1041),
+    		    ansdsedstx(1042),
+    		    ansedsi2(1043),
+    		    ansedsti2(1044),
+    		    ansedshi2(1045),
+    		    andsti2(1046),
+    		    ansedsg(1047),
+    		    ansedsgx(1048),
+    		    ansetsg(1049),
+    		    andedsg(1050),
+    		    ansedsgi(1051),
+    		    ansetsgx(1052),
+    		    andedsgx(1053),
+    		    ansedsgix(1054),
+    		    ansedsx(1055),
+    		    ansetsx(1056),
+    		    andedsx(1057),
+    		    ansedstx(1058),
+    		    ansetstx(1059),
+    		    andedstx(1060),
+    		    andsti2x(1061),
+    		    ansedsi2x(1062),
+    		    ansedsti2x(1063),
+    		    atmalc(4096),
+    		    atmalctaxi100(4097),
+    		    atmalcsonetmm(4098),
+    		    atmalcsonetsm(4099),
+    		    osync(4352),
+    		    comp(4353),
+    		    comp128(4354),
+    		    atmcoc3mm(4608),
+    		    atmcoc3sm(4609),
+    		    atmcoc3utp5(4610),
+    		    de100(4864),
+    		    atmcds3(5120),
+    		    atmce3(5121),
+		    qmct1rj45(5376),
+		    qmct1db15(5377),
+    		    srml(8448),
+		    atm5000ah(524288),
+    		    qe(1048799),
+    		    qehwf(1048798),
+    		    qefddi2m(1048831),
+    		    qefddi2mhwf(1048830),
+    		    qefddi2s(1048823),
+    		    qefddi2shwf(1048822),
+    		    qefddi1m(1048815),
+    		    qefddi1mhwf(1048814),
+    		    qefddi1s(1048807),
+    		    qefddi1shwf(1048806),
+    		    qecddi2stp(1048827),
+    		    qecddi2stphwf(1048826),
+    		    qecddi1stp(1048811),
+    		    qecddi1stphwf(1048810),
+    		    qecddi2utp(1048763),
+    		    qecddi2utphwf(1048762),
+    		    qecddi1utp(1048747),
+    		    qecddi1utphwf(1048746),
+    		    enet3atm(1048832),
+    		    enet3enet(1048833),
+    		    enet3fddi(1048834),
+    		    enet3tok(1048835),
+    		    enet3tokf(1048836),
+    		    enet3sync(1048837),
+    		    enet3only(1048863),
+    		    fddiatm(1048864),
+    		    fddienet(1048865),
+    		    fddifddi(1048866),
+    		    fdditok(1048867),
+    		    fdditokf(1048868),
+    		    fddisync(1048869),
+    		    fddionly(1048895),
+    		    tok3atm(1048896),
+    		    tok3enet(1048897),
+    		    tok3fddi(1048898),
+    		    tok3tok(1048899),
+    		    tok3tokf(1048900),
+    		    tok3sync(1048901),
+    		    tok3only(1048927),
+    		    tokf3atm(1048928),
+    		    tokf3enet(1048929),
+    		    tokf3fddi(1048930),
+    		    tokf3tok(1048931),
+    		    tokf3tokf(1048932),
+    		    tokf3sync(1048933),
+    		    tokf3only(1048959),
+    		    enet3datm(1048960),
+    		    enet3denet(1048961),
+    		    enet3dfddi(1048962),
+    		    enet3dtok(1048963),
+    		    enet3dtokf(1048964),
+    		    enet3dsync(1048965),
+    		    enet3donly(1048991),
+    		    chipcomfenet(1049089),
+    		    chipcomffddi(1049090),
+    		    chipcomftok(1049091),
+    		    chipcomftokf(1049092),
+    		    chipcomfdsync(1049093),
+    		    chipcomfisdn(1049094),
+    		    chipcomffddis(1049095),
+    		    chipcomfonly(1049119),
+    		    chipcomenet(1049217),
+    		    chipcomfddi(1049218),
+    		    chipcomtok(1049219),
+    		    chipcomtokf(1049220),
+    		    chipcomdsync(1049221),
+    		    chipcomisdn(1049222),
+    		    chipcomfddis(1049223),
+    		    chipcomonly(1049247)
+    		}
+        ACCESS	read-only
+        STATUS	mandatory
+        DESCRIPTION
+                "The module identification number.
+
+                     Port Configurations
+                 HWStat Name  Enet Sync Async Token Framer Fiber
+                 ------ ------------ ------ ---- ----- ----- ------ -----
+                    1 ENET-1  2 0 0 0 0 0
+                    8 ENET-2  2 0 0 0 0 0
+
+                   16 SYNC-1  0 4 1 0 0 0
+                   17 SYNC-1 [1] 0 4 1 0 0 0
+
+                   24 T1-1  0 2 1 0 2 0
+
+                   32 DSE-1  1 2 1 0 0 0
+                   33 DSE-1  [1] 1 2 1 0 0 0
+
+                   40 DST-4/16 0 2 1 1 0 0
+                   41 SST-4/16  [1] 0 1 1 1 0 0
+                   42 DST-4  0 2 1 1 0 0
+                   43 SST-4   [1] 0 1 1 1 0 0
+                   44 SST-4/16 0 1 1 1 0 0
+                   45 STOK-4/16 [3] 0 0 0 1 0 0
+                   46 SST-4  0 1 1 1 0 0
+                   47 STOK-4   [3] 0 0 0 1 0 0
+
+                   48 FLOPPY    0 0 0 0 0 0
+
+                   56 T1-2  0 2 1 0 2 0
+                   57 T1-2  0 2 1 0 2 0
+                   58 ST1  0 1 1 0 1 0
+                   60 T1-56K  0 1 1 0 1 0
+                   61 E1 [3] 0 2 0 0 2 0
+                   62 ST1-56K  0 1 1 0 1 0
+                   63 SE1 [3] 0 1 0 0 1 0
+
+                   64 T1-2n  0 2 1 0 2 0
+                   65 ST1n  0 1 1 0 1 0
+                   66 T1-56Kn  0 1 1 0 1 0
+                   67 ST1-56Kn 0 1 1 0 1 0
+                   68 E1n [3] 0 2 0 0 2 0
+                   69 SE1n [3] 0 1 0 0 1 0
+
+                   80 SYNC-2  0 4 1 0 0 0
+                   81 SYNC-2  [1] 0 4 1 0 0 0
+
+                   88 CMC-FDDI    [6] 0 0 0 0 0 1
+                   89 IPHASE-FDDI [6] 0 0 0 0 0 1
+
+                  112 DSDE-1  2 2 1 0 0 0
+                  113 DSDE-1  [1] 2 2 1 0 0 0
+                  114 ENET  2 0 0 0 0 0
+                  116 DSE-2  1 2 1 0 0 0
+                  117 DSE-2   [1] 1 2 1 0 0 0
+                  118 SSE  1 1 1 0 0 0
+                  119 SSE     [1] 1 1 1 0 0 0
+
+                  132 ENET-3 [2] 2 0 0 0 0 0
+
+                  156 DSDE-2 [2] 2 2 1 0 0 0
+
+                  160 QE/NF  4 0 0 0 0 0
+                  161 DE/NF [5] 2 0 0 0 0 0
+                  162 QE/NF  4 0 0 0 0 0
+                  164 QE/F [4] 4 0 0 0 0 0
+                  165 DE/F [4,5] 2 0 0 0 0 0
+
+                      168    MCT1            0    2 Munich   0       0       2       0
+                      169    SMCT1           0    1 Munich   0       0       1       0
+
+                  176 DTOK  0 0 0 2 0 0
+
+                      184    MCE1            0    2 Munich   0       0       2       0
+                      185    SMCE1           0    1 Munich   0       0       1       0
+                      188    MCE1II75        0    2 Munich   0       0       2       0
+                      189    SMCE1II75       0    1 Munich   0       0       1       0
+                      190    MCE1II120       0    2 Munich   0       0       2       0
+                      191    SMCE1II120      0    1 Munich   0       0       1       0
+
+                  192 WF_FDDI_2M 0 0 0 0 0 1
+                  193 WF_FDDI_1M 0 0 0 0 0 1
+                  194 WF_FDDI_2S 0 0 0 0 0 1
+                  195 WF_FDDI_1S 0 0 0 0 0 1
+                  196 WF_FDDI_2MF 0 0 0 0 0 1
+                  197 WF_FDDI_1MF 0 0 0 0 0 1
+                  198 WF_FDDI_2SF 0 0 0 0 0 1
+                  199 WF_FDDI_1SF 0 0 0 0 0 1
+
+                  200 HW_MODULE_FMDSET  [7] 1 2 0 1 0 0
+                  201 HW_MODULE_FMDST   [7] 0 2 0 1 0 0
+                  202 HW_MODULE_FMDSE   [7] 1 2 0 0 0 0
+                  203 HW_MODULE_FMSST   [7] 0 1 0 1 0 0
+                  204 HW_MODULE_FMSSE   [7] 1 1 0 0 0 0
+
+                  208 FNSDSE   [7] 1 2 0 0 0 0
+                  216 FNSDSDT  [7] 0 2 0 2 0 0
+                  217 FNSDST   [7] 0 2 0 1 0 0
+
+                      224    DHSSI           0    2 hssi     0       0       0       0
+                      225    SHSSI           0    1 hssi     0       0       0       0
+
+                      232    ESAF_NF         2       2       0       0       0       0
+                      233    ESAF_DSE_NF     1       2       0       0       0       0
+                      234    ESAF_SSE_NF     1       1       0       0       0       0
+                      235    ESAF_DE_NF      2       0       0       0       0       0
+                      236    ESAF [2]        2       2       0       0       0       0
+                      237    ESAF_DSE [2]    1       2       0       0       0       0
+                      238    ESAF_SSE [2]    1       1       0       0       0       0
+                      239    ESAF_DE [2]     2       0       0       0       0       0
+
+                      256    QTOK  0 0 0 4 0 0
+
+                 ASN (Barracuda)
+
+                  511    ASN[8]
+
+
+                 AN Module IDs (Piranha, Guppy...)
+
+                 ID      Mnemonic        ENET    SYNC    ISDN    TR      HUB     DCM
+                 --      --------        ----    ----    ----    --      ---     ---
+                 1024    ANSEDS          1       2       0       0       0       N
+
+                 1025    ANSEDST         1       2       0       1       0       N
+
+                 1026    ANSEDSH         1       2       0       0       12      N
+
+                 1027    ANSEDSI         1       2       1       0       0       N
+
+                 1028    ANSEDSTI        1       2       1       1       0       N
+
+                 1029    ANSEDSHI        1       2       1       0       12      N
+
+                 1030    ANSETS          1       3       0       0       0       N
+
+                 1031    ANSETST         1       3       0       1       0       N
+
+                 1032    ANSETSH         1       3       0       0       12      N
+
+                 1033    ANDEDS          2       2       0       0       0       N
+
+                 1034    ANDEDST         2       2       0       1       0       N
+
+                 1035    ANDEDSH         2       2       0       0       12      N
+
+                 1036    ANDSTX          0       2       0       1       0       Y
+                 (formerly ANDS)
+
+                 1037    ANDST           0       2       0       1       0       N
+
+                 1038    ANDSTI          0       2       1       1       0       N
+
+                 1039    ANTST           0       3       0       1       0       N
+
+                 1040    ANTSTX          0       3       0       1       0       Y
+                 (formerly ANSDSEDS)
+
+                 1041    ANSDSEDST       1       2       0       1       0       N
+
+                 1042    ANSDSEDSTX      1       2       0       1       0       Y
+                 (formerly ANSDSEDSH)
+
+                 1043    ANSEDSI2        1       2       1       0       0       N
+
+                 1044    ANSEDSTI2       1       2       1       1       0       N
+
+                 1045    ANSEDSHI2       1       2       1       0       12      N
+
+                 1046    ANDSTI2         0       2       1       1       0       N
+
+                 1047    ANSEDSG         1       2       0       0       8       N
+
+                 1048    ANSEDSGX        1       2       0       0       8       Y
+
+                 1049    ANSETSG         1       3       0       0       8       N
+
+                 1050    ANDEDSG         2       2       0       0       8       N
+
+                 1051    ANSEDSGI        1       2       1       0       8       N
+
+                 1052    ANSETSGX        1       3       0       0       8       Y
+
+                 1053    ANDEDSGX        2       2       0       0       8       Y
+
+                 1054    ANSEDSGIX       1       2       1       0       8       Y
+
+                 1055    ANSEDSX         1       2       0       0       0       Y
+
+                 1056    ANSETSX         1       3       0       0       0       Y
+
+                 1057    ANDEDSX         2       2       0       0       0       Y
+
+                 1058    ANSEDSTX        1       2       0       1       0       Y
+
+                 1059    ANSETSTX        1       3       0       1       0       Y
+
+                 1060    ANDEDSTX        2       2       0       1       0       Y
+
+                 1061    ANDSTI2X        0       2       1       0       0       Y
+
+                 1062    ANSEDSI2X       1       2       1       0       0       Y
+
+                 1063    ANSEDSTI2X      1       2       1       1       0       Y
+
+
+                     4096    ATMALC          0       0       0       0       0       0
+                     4097    ATMALCTAXI100   0       0       0       0       0       1
+                     4098    ATMALCSONETMM   0       0       0       0       1       1 [9]
+                     4099    ATMALCSONETSM   0       0       0       0       1       1 [9]
+                     4352    OSYNC           0       8       0       0       0       0
+                     4353    OSYNC_COMP (32) 0       8       0       0       0       0
+                     4354    OSYNC_COMP128   0       8       0       0       0       0
+
+                     4608    ATMCOC3MM       0       0       0       0       1       1 [10]
+                     4609    ATMCOC3SM       0       0       0       0       1       1 [10]
+                     4610    ATMCOC3UTP5     0       0       0       0       1       0 [10]
+
+                     4864    DE100           2       0       0       0       0       0
+
+                     5120    ATMCDS3         0       0       0       0       1       0 [10]
+                     5121    ATMCE3          0       0       0       0       1       0 [10]
+
+                 8448 SRML  0 0 0 0 0 0
+
+
+                 NOTES:
+                  [1] Indicates Module has COM Port 1 configured for ASYNC.
+                   The AM8530's port B is configured for COM1.
+
+                  [2] This Module contains the DEFA - Hardware Filtering.  CAMS
+                   must be programmed (can contain 2 - 6 CAMS onboard).
+
+                  [3] The AM8530 has been removed (depopulated) from this module.
+                   Programming this device should not be performed.
+
+                  [4] Contains Dual Defa hardware. (Can be depopulated)
+
+                  [5] Depop'd two ports of hardware to make Dual Ethernet module.
+
+                  [6] These are FDDI modules.  The ID cannot be read from the Link
+                   module I/O space.
+
+                     [7] These are AFN Platform Integrated 'Modules' - Cannot be detached
+                             or be used by any other platform.
+
+                 [8] Module IDs from 1280(0x500) to 2559(0x9ff) are used
+                  for the ASN Net Modules. Module ID 512(0x200) is
+                  used for the ASN SPEX. These IDs are documented in
+                  MODULE.mdl. A module ID of 511(0x1ff) in
+                  'wfHwEntry.wfHwModIdOpt' indicates that it is an
+                  ASN platform and the user should refer to
+                  'wfHwModuleEntry.wfHwModuleModIdOpt' for Module ID details
+
+                     [9]     ATMALC link modules. The physical option for SONET includes a
+                             framer and the medium is fiber optics. Only one port per physical
+                             daughtercard per link module.
+
+                     [10]    ARE UTOPIA link modules. "
+        ::= { wfHwEntry 2 }
+
+    wfHwModRev OBJECT-TYPE
+        SYNTAX	OCTET STRING
+        ACCESS	read-only
+        STATUS	mandatory
+        DESCRIPTION
+                "The revision level of the module. High byte is in upper 2 bytes."
+        ::= { wfHwEntry 3 }
+
+    wfHwModSerialNumber OBJECT-TYPE
+        SYNTAX	OCTET STRING
+        ACCESS	read-only
+        STATUS	mandatory
+        DESCRIPTION
+                "The serial number of the module."
+        ::= { wfHwEntry 4 }
+
+    wfHwMotherBdIdOpt OBJECT-TYPE
+        SYNTAX	INTEGER {
+    		    sysctrl(1),
+    		    ace12(2),
+    		    ace25(3),
+    		    ace32(4),
+    		    afn(5),
+    		    in(6),
+    		    sysctrl2(7),
+    		    an(16),
+    		    fre(256),
+    		    fre2(768),
+    		    o60(769),
+    		    asn(1024),
+    		    are(1280),
+    		    srmf(8704)
+    		}
+        ACCESS	read-only
+        STATUS	mandatory
+        DESCRIPTION
+                "The mother board identification number."
+        ::= { wfHwEntry 5 }
+
+    wfHwMotherBdRev OBJECT-TYPE
+        SYNTAX	OCTET STRING
+        ACCESS	read-only
+        STATUS	mandatory
+        DESCRIPTION
+                "The revision level of the mother board. High byte is in upper 2 bytes."
+        ::= { wfHwEntry 6 }
+
+    wfHwMotherBdSerialNumber OBJECT-TYPE
+        SYNTAX	OCTET STRING
+        ACCESS	read-only
+        STATUS	mandatory
+        DESCRIPTION
+                "The serial number of the mother board."
+        ::= { wfHwEntry 7 }
+
+    wfHwDaughterBdIdOpt OBJECT-TYPE
+        SYNTAX	INTEGER {
+    		    sysctrl(1),
+    		    ace68020mhz12(2),
+    		    ace68020mhz25(3),
+    		    ace68030mhz32(4),
+    		    fre68040mhz25(4352),
+    		    fre68040mhz33(4608)
+    		}
+        ACCESS	read-only
+        STATUS	mandatory
+        DESCRIPTION
+                "The daughter board identification number."
+        ::= { wfHwEntry 8 }
+
+    wfHwDaughterBdRev OBJECT-TYPE
+        SYNTAX	OCTET STRING
+        ACCESS	read-only
+        STATUS	mandatory
+        DESCRIPTION
+                "The revision level of the daughter board. High byte is in upper 2 bytes."
+        ::= { wfHwEntry 9 }
+
+    wfHwDaughterBdSerialNumber OBJECT-TYPE
+        SYNTAX	OCTET STRING
+        ACCESS	read-only
+        STATUS	mandatory
+        DESCRIPTION
+                "The serial number of the daughter board."
+        ::= { wfHwEntry 10 }
+
+    wfHwBabyBdIdOpt OBJECT-TYPE
+        SYNTAX	INTEGER
+        ACCESS	read-only
+        STATUS	mandatory
+        DESCRIPTION
+                "The baby board identification number."
+        ::= { wfHwEntry 11 }
+
+    wfHwBabyBdRev OBJECT-TYPE
+        SYNTAX	OCTET STRING
+        ACCESS	read-only
+        STATUS	mandatory
+        DESCRIPTION
+                "The revision level of the baby board. High byte is in upper 2 bytes."
+        ::= { wfHwEntry 12 }
+
+    wfHwBabyBdSerialNumber OBJECT-TYPE
+        SYNTAX	OCTET STRING
+        ACCESS	read-only
+        STATUS	mandatory
+        DESCRIPTION
+                "The serial number of the baby board."
+        ::= { wfHwEntry 13 }
+
+    wfHwDiagPromRev OBJECT-TYPE
+        SYNTAX	OCTET STRING
+        ACCESS	read-only
+        STATUS	mandatory
+        DESCRIPTION
+                "The revision level of the Diagnostic PROM. Major revision level
+                is in the upper 2 bytes, minor revision level in the lower 2 bytes."
+        ::= { wfHwEntry 14 }
+
+    wfHwDiagPromDate OBJECT-TYPE
+        SYNTAX	DisplayString
+        ACCESS	read-only
+        STATUS	mandatory
+        DESCRIPTION
+                "The creation date of the Diagnostic PROM"
+        ::= { wfHwEntry 15 }
+
+    wfHwDiagPromSource OBJECT-TYPE
+        SYNTAX	DisplayString
+        ACCESS	read-only
+        STATUS	mandatory
+        DESCRIPTION
+                "The origin of the Diagnostic PROM contents"
+        ::= { wfHwEntry 16 }
+
+    wfHwBootPromRev OBJECT-TYPE
+        SYNTAX	OCTET STRING
+        ACCESS	read-only
+        STATUS	mandatory
+        DESCRIPTION
+                "The revision level of the BOOT PROM. Major revision level
+                is in the upper 2 bytes, minor revision level in the lower 2 bytes."
+        ::= { wfHwEntry 17 }
+
+    wfHwBootPromDate OBJECT-TYPE
+        SYNTAX	DisplayString
+        ACCESS	read-only
+        STATUS	mandatory
+        DESCRIPTION
+                "The creation date of the Boot PROM"
+        ::= { wfHwEntry 18 }
+
+    wfHwBootPromSource OBJECT-TYPE
+        SYNTAX	DisplayString
+        ACCESS	read-only
+        STATUS	mandatory
+        DESCRIPTION
+                "The origin of the Boot PROM contents"
+        ::= { wfHwEntry 19 }
+
+    wfHwSparePromRev OBJECT-TYPE
+        SYNTAX	OCTET STRING
+        ACCESS	read-only
+        STATUS	mandatory
+        DESCRIPTION
+                "The revision level of the BOOT PROM. Major revision level
+                is in the upper 2 bytes, minor revision level in the lower 2 bytes."
+        ::= { wfHwEntry 20 }
+
+    wfHwSparePromDate OBJECT-TYPE
+        SYNTAX	DisplayString
+        ACCESS	read-only
+        STATUS	mandatory
+        DESCRIPTION
+                "The creation date of the Spare PROM"
+        ::= { wfHwEntry 21 }
+
+    wfHwSparePromSource OBJECT-TYPE
+        SYNTAX	DisplayString
+        ACCESS	read-only
+        STATUS	mandatory
+        DESCRIPTION
+                "The origin of the Spare PROM contents"
+        ::= { wfHwEntry 22 }
+
+    wfHwFileSysPresent OBJECT-TYPE
+        SYNTAX	INTEGER {
+    		    filesys(1),
+    		    nofilesys(2)
+    		}
+        ACCESS	read-only
+        STATUS	mandatory
+        DESCRIPTION
+                "Flag indicating presence of File System on this slot."
+        DEFVAL	{ nofilesys }
+        ::= { wfHwEntry 23 }
+
+    wfHwFileSysPresent2 OBJECT-TYPE
+        SYNTAX	INTEGER {
+    		    filesys(1),
+    		    nofilesys(2)
+    		}
+        ACCESS	read-only
+        STATUS	mandatory
+        DESCRIPTION
+                "Flag indicating presence of File System (Syscon2 volume#2) on this slot."
+        DEFVAL	{ nofilesys }
+        ::= { wfHwEntry 24 }
+
+    wfHwConfigServer OBJECT-TYPE
+        SYNTAX	INTEGER
+        ACCESS	read-only
+        STATUS	mandatory
+        DESCRIPTION
+                "The slot number from which this slot was served its
+                configuration.  If the value for this attribute is 0, this
+                slot obtained its configuration from a file system resource
+                (not necessarily local); If the value for this attribute is
+                -1, this slot does not participate in the boot process (e.g.
+                SRM). A positive value indicates that the configuration was
+                obtained from memory from the slot indicated by the value of
+                this attribute."
+        ::= { wfHwEntry 25 }
+
+    wfHwConfigFile OBJECT-TYPE
+        SYNTAX	DisplayString
+        ACCESS	read-only
+        STATUS	mandatory
+        DESCRIPTION
+                "The name of the config file the active configuration was
+                derived from.  This does NOT necessarily reflect the
+                current configuration!"
+        ::= { wfHwEntry 26 }
+
+    wfHwConfigDateAndTime OBJECT-TYPE
+        SYNTAX	OCTET STRING
+        ACCESS	read-only
+        STATUS	mandatory
+        DESCRIPTION
+                "The 11 octet date and time that a configuration was
+                loaded on/served to this slot. Octet map: 1-2 Year,
+                3 Month, 4 Day, 5 Hour, 6 Minutes, 7 Seconds,
+                8 Deci-seconds, 9 Direction from GMT ('+'|`-'), 10 GMT Hour
+                Offset, 11 GMT Minute Offset."
+        ::= { wfHwEntry 27 }
+
+    wfHwActiveImageName OBJECT-TYPE
+        SYNTAX	DisplayString
+        ACCESS	read-only
+        STATUS	mandatory
+        DESCRIPTION
+                "If slot was booted from a local source: this is the name of the active
+                image, which is in the form of <volume>:<image name>.
+                If slot was booted from a network source: this is the full pathname
+                where the active image was found on the remote server."
+        ::= { wfHwEntry 28 }
+
+    wfHwActiveImageSource OBJECT-TYPE
+        SYNTAX	DisplayString
+        ACCESS	read-only
+        STATUS	mandatory
+        DESCRIPTION
+                "The origin of the active image"
+        ::= { wfHwEntry 29 }
+
+    wfHwActiveImageDate OBJECT-TYPE
+        SYNTAX	DisplayString
+        ACCESS	read-only
+        STATUS	mandatory
+        DESCRIPTION
+                "The date which the active image was created"
+        ::= { wfHwEntry 30 }
+
+    wfHwMotherBdMemorySize OBJECT-TYPE
+        SYNTAX	INTEGER
+        ACCESS	read-only
+        STATUS	mandatory
+        DESCRIPTION
+                "The total installed dram size in kilobytes."
+        ::= { wfHwEntry 31 }
+
+    wfHwFastPacketCacheSize OBJECT-TYPE
+        SYNTAX	INTEGER
+        ACCESS	read-only
+        STATUS	mandatory
+        DESCRIPTION
+                "The size of the installed fast packet cache in kilobytes."
+        ::= { wfHwEntry 32 }
+
+    wfHwModDaughterBd1IdOpt OBJECT-TYPE
+        SYNTAX	INTEGER
+        ACCESS	read-only
+        STATUS	mandatory
+        DESCRIPTION
+                "Link module daughter board #1 identification number"
+        ::= { wfHwEntry 33 }
+
+    wfHwModDaughterBd1AwRev OBJECT-TYPE
+        SYNTAX	OCTET STRING
+        ACCESS	read-only
+        STATUS	mandatory
+        DESCRIPTION
+                "Link module daughter board #1 artwork revision level"
+        ::= { wfHwEntry 34 }
+
+    wfHwModDaughterBd1Rev OBJECT-TYPE
+        SYNTAX	OCTET STRING
+        ACCESS	read-only
+        STATUS	mandatory
+        DESCRIPTION
+                "Link module daughter board #1 board revision level"
+        ::= { wfHwEntry 35 }
+
+    wfHwModDaughterBd1SerialNumber OBJECT-TYPE
+        SYNTAX	OCTET STRING
+        ACCESS	read-only
+        STATUS	mandatory
+        DESCRIPTION
+                "Link module daughter board #1 serial number"
+        ::= { wfHwEntry 36 }
+
+    wfHwModDaughterBd2IdOpt OBJECT-TYPE
+        SYNTAX	INTEGER
+        ACCESS	read-only
+        STATUS	mandatory
+        DESCRIPTION
+                "Link module daughter board #2 identification number"
+        ::= { wfHwEntry 37 }
+
+    wfHwModDaughterBd2AwRev OBJECT-TYPE
+        SYNTAX	OCTET STRING
+        ACCESS	read-only
+        STATUS	mandatory
+        DESCRIPTION
+                "Link module daughter board #2 artwork revision level"
+        ::= { wfHwEntry 38 }
+
+    wfHwModDaughterBd2Rev OBJECT-TYPE
+        SYNTAX	OCTET STRING
+        ACCESS	read-only
+        STATUS	mandatory
+        DESCRIPTION
+                "Link module daughter board #2 board revision level"
+        ::= { wfHwEntry 39 }
+
+    wfHwModDaughterBd2SerialNumber OBJECT-TYPE
+        SYNTAX	OCTET STRING
+        ACCESS	read-only
+        STATUS	mandatory
+        DESCRIPTION
+                "Link module daughter board #2 serial number"
+        ::= { wfHwEntry 40 }
+
+    END  -- Wellfleet-HARDWARE-MIB
+-- @(#)WSCCS q/mibs-module.mib 1.1 8/30/95
+Wellfleet-MODULE-MIB DEFINITIONS ::= BEGIN
+
+-- Created by mdl2asn version 3.1
+-- Creation date: Wed Aug 30 16:45:27 EDT 1995
+
+
+    IMPORTS
+
+      IpAddress, Counter, Gauge, TimeTicks, Opaque, enterprises, mgmt
+        FROM RFC1155-SMI
+      OBJECT-TYPE
+        FROM RFC-1212
+      TRAP-TYPE
+        FROM RFC-1215
+      DisplayString, mib-2
+        FROM RFC1213-MIB
+      wfHwModuleGroup
+        FROM Wellfleet-COMMON-MIB;
+
+
+    wfHwModuleTable OBJECT-TYPE
+        SYNTAX	SEQUENCE OF WfHwModuleEntry
+        ACCESS	not-accessible
+        STATUS	mandatory
+        DESCRIPTION
+                "Hardware Module Table
+                Filled in by the Module Driver. Read by SNMP to
+                build the driver load records "
+        ::= { wfHwModuleGroup 1 }
+
+    wfHwModuleEntry OBJECT-TYPE
+        SYNTAX	WfHwModuleEntry
+        ACCESS	not-accessible
+        STATUS	mandatory
+        DESCRIPTION
+                "Hardware specific information about a slot."
+        INDEX	{ wfHwModuleSlot,
+    		  wfHwModuleModule }
+        ::= { wfHwModuleTable 1 }
+
+    WfHwModuleEntry ::= SEQUENCE {
+    	    wfHwModuleSlot
+    		INTEGER,
+    	    wfHwModuleModule
+    		INTEGER,
+    	    wfHwModuleModIdOpt
+    		INTEGER,
+    	    wfHwModuleModRev
+    		OCTET STRING,
+    	    wfHwModuleModSerialNumber
+    		OCTET STRING,
+    	    wfHwModuleArtworkRev
+    		DisplayString
+        }
+
+    wfHwModuleSlot OBJECT-TYPE
+        SYNTAX	INTEGER
+        ACCESS	read-only
+        STATUS	mandatory
+        DESCRIPTION
+                "A unique value for each slot.
+                Its value ranges between 1 and 4."
+        ::= { wfHwModuleEntry 1 }
+
+    wfHwModuleModule OBJECT-TYPE
+        SYNTAX	INTEGER
+        ACCESS	read-only
+        STATUS	mandatory
+        DESCRIPTION
+                "This value ranges between 1 and 4"
+        ::= { wfHwModuleEntry 2 }
+
+    wfHwModuleModIdOpt OBJECT-TYPE
+        SYNTAX	INTEGER {
+    		    spex(512),
+    		    hss(768),
+    		    hsd(769),
+    		    denm(1280),
+    		    denmhwf(1281),
+    		    dsnmnn(1536),
+    		    dsnmn1(1537),
+    		    dsnmn2(1538),
+    		    dsnm1n(1540),
+    		    dsnm11(1541),
+    		    dsnm12(1542),
+    		    dsnm2n(1544),
+    		    dsnm21(1545),
+    		    dsnm22(1546),
+    		    dsnmnnisdn(1584),
+    		    dsnmn1isdn(1585),
+    		    dsnmn2isdn(1586),
+    		    dsnm1nisdn(1588),
+    		    dsnm11isdn(1589),
+    		    dsnm12isdn(1590),
+    		    dsnm2nisdn(1592),
+    		    dsnm21isdn(1593),
+    		    dsnm22isdn(1594),
+    		    mmfsdsas(1792),
+    		    mmfsddas(1793),
+    		    smfsdsas(1800),
+    		    smfsddas(1801),
+    		    mmscsas(1808),
+    		    mmscdas(1809),
+    		    smammbdas(1825),
+    		    mmasmbdas(1833),
+    		    mmfsdsashwf(1856),
+    		    mmfsddashwf(1857),
+    		    smfsdsashwf(1864),
+    		    smfsddashwf(1865),
+    		    mmscsashwf(1872),
+    		    mmscdashwf(1873),
+    		    smammbdashwf(1889),
+    		    mmasmbdashwf(1897),
+    		    dtnm(2048),
+    		    cam(2049),
+    		    se100nm(2304),
+    		    asnqbri(2560)
+    		}
+        ACCESS	read-only
+        STATUS	mandatory
+        DESCRIPTION
+                "Module IDs for the net modules modules"
+        ::= { wfHwModuleEntry 3 }
+
+    wfHwModuleModRev OBJECT-TYPE
+        SYNTAX	OCTET STRING
+        ACCESS	read-only
+        STATUS	mandatory
+        DESCRIPTION
+                "The revision level of the module. High byte is in upper 2 bytes."
+        ::= { wfHwModuleEntry 4 }
+
+    wfHwModuleModSerialNumber OBJECT-TYPE
+        SYNTAX	OCTET STRING
+        ACCESS	read-only
+        STATUS	mandatory
+        DESCRIPTION
+                "The serial number of the module."
+        ::= { wfHwModuleEntry 5 }
+
+    wfHwModuleArtworkRev OBJECT-TYPE
+        SYNTAX	DisplayString
+        ACCESS	read-only
+        STATUS	mandatory
+        DESCRIPTION
+                "The Artwork Revision number of the module"
+        ::= { wfHwModuleEntry 6 }
+
+    wfModuleTable OBJECT-TYPE
+        SYNTAX	SEQUENCE OF WfModuleEntry
+        ACCESS	not-accessible
+        STATUS	mandatory
+        DESCRIPTION
+                "This table is used by the module driver for Barracuda"
+        ::= { wfHwModuleGroup 2 }
+
+    wfModuleEntry OBJECT-TYPE
+        SYNTAX	WfModuleEntry
+        ACCESS	not-accessible
+        STATUS	mandatory
+        DESCRIPTION
+                "Hardware specific information about a slot."
+        INDEX	{ wfModuleSlot }
+        ::= { wfModuleTable 1 }
+
+    WfModuleEntry ::= SEQUENCE {
+    	    wfModuleDelete
+    		INTEGER,
+    	    wfModuleSlot
+    		INTEGER,
+    	    wfModuleTimerFrequency
+    		INTEGER,
+    	    wfModuleBufferBalance
+    		INTEGER,
+    	    wfModuleFddiWeight
+    		INTEGER,
+    	    wfModuleTokenRingWeight
+    		INTEGER,
+    	    wfModuleCsmacdWeight
+    		INTEGER,
+    	    wfModuleSyncWeight
+    		INTEGER,
+    	    wfModuleFreeBufferCredits
+    		INTEGER,
+    	    wfModuleTotalBufferCredits
+    		INTEGER,
+    	    wfModuleRestart
+    		INTEGER,
+    	    wfModuleCsmacd100Weight
+    		INTEGER
+        }
+
+    wfModuleDelete OBJECT-TYPE
+        SYNTAX	INTEGER {
+    		    created(1),
+    		    deleted(2)
+    		}
+        ACCESS	read-write
+        STATUS	mandatory
+        DESCRIPTION
+                "create/delete parameter"
+        DEFVAL	{ created }
+        ::= { wfModuleEntry 1 }
+
+    wfModuleSlot OBJECT-TYPE
+        SYNTAX	INTEGER
+        ACCESS	read-only
+        STATUS	mandatory
+        DESCRIPTION
+                "A unique value for each slot.
+                Its value ranges between 1 and 14.
+                There are products in this family that contain 1, 5, and 14 slots."
+        ::= { wfModuleEntry 2 }
+
+    wfModuleTimerFrequency OBJECT-TYPE
+        SYNTAX	INTEGER {
+    		    timerdefault(1)
+    		}
+        ACCESS	read-write
+        STATUS	mandatory
+        DESCRIPTION
+                "This value determines the frequency for the buffer balance
+                algorithm to run"
+        DEFVAL	{ timerdefault }
+        ::= { wfModuleEntry 3 }
+
+    wfModuleBufferBalance OBJECT-TYPE
+        SYNTAX	INTEGER {
+    		    txrx(1),
+    		    none(2),
+    		    rx(3),
+    		    tx(4)
+    		}
+        ACCESS	read-write
+        STATUS	mandatory
+        DESCRIPTION
+                "Enable/Disable buffer balancing algorithm selectively"
+        DEFVAL	{ txrx }
+        ::= { wfModuleEntry 4 }
+
+    wfModuleFddiWeight OBJECT-TYPE
+        SYNTAX	INTEGER(1..10)
+        ACCESS	read-write
+        STATUS	mandatory
+        DESCRIPTION
+                "This value determines the weight of the fddi line
+                for the buffer balancing algorithm"
+        DEFVAL	{ 6 }
+        ::= { wfModuleEntry 5 }
+
+    wfModuleTokenRingWeight OBJECT-TYPE
+        SYNTAX	INTEGER(1..10)
+        ACCESS	read-write
+        STATUS	mandatory
+        DESCRIPTION
+                "This value determines the weight of the token-ring
+                for the buffer balancing algorithm"
+        DEFVAL	{ 4 }
+        ::= { wfModuleEntry 6 }
+
+    wfModuleCsmacdWeight OBJECT-TYPE
+        SYNTAX	INTEGER(1..10)
+        ACCESS	read-write
+        STATUS	mandatory
+        DESCRIPTION
+                "This value determines the weight of the csmacd line
+                for the buffer balancing algorithm"
+        DEFVAL	{ 3 }
+        ::= { wfModuleEntry 7 }
+
+    wfModuleSyncWeight OBJECT-TYPE
+        SYNTAX	INTEGER(1..10)
+        ACCESS	read-write
+        STATUS	mandatory
+        DESCRIPTION
+                "This value determines the weight of the sync line
+                for the buffer balancing algorithm"
+        DEFVAL	{ 2 }
+        ::= { wfModuleEntry 8 }
+
+    wfModuleFreeBufferCredits OBJECT-TYPE
+        SYNTAX	INTEGER
+        ACCESS	read-only
+        STATUS	mandatory
+        DESCRIPTION
+                "This attribute indicates the number of buffers
+                available to line drivers but not used by them"
+        ::= { wfModuleEntry 9 }
+
+    wfModuleTotalBufferCredits OBJECT-TYPE
+        SYNTAX	INTEGER
+        ACCESS	read-only
+        STATUS	mandatory
+        DESCRIPTION
+                "This attribute indicates the total number of buffers
+                available to line drivers"
+        ::= { wfModuleEntry 10 }
+
+    wfModuleRestart OBJECT-TYPE
+        SYNTAX	INTEGER
+        ACCESS	read-write
+        STATUS	mandatory
+        DESCRIPTION
+                "This attribute should be touched after the queue
+                lengths are configured in the line-records"
+        ::= { wfModuleEntry 11 }
+
+    wfModuleCsmacd100Weight OBJECT-TYPE
+        SYNTAX	INTEGER(1..10)
+        ACCESS	read-write
+        STATUS	mandatory
+        DESCRIPTION
+                "This value determines the weight of the csmacd 100MB line
+                for the buffer balancing algorithm"
+        DEFVAL	{ 6 }
+        ::= { wfModuleEntry 12 }
+
+    END  -- Wellfleet-MODULE-MIB
+-- @(#)WSCCS h/mibs-sys.mib 1.1 8/30/95
+Wellfleet-SYS-MIB DEFINITIONS ::= BEGIN
+
+-- Created by mdl2asn version 3.1
+-- Creation date: Wed Aug 30 16:48:50 EDT 1995
+
+
+    IMPORTS
+
+      IpAddress, Counter, Gauge, TimeTicks, Opaque, enterprises, mgmt
+        FROM RFC1155-SMI
+      OBJECT-TYPE
+        FROM RFC-1212
+      TRAP-TYPE
+        FROM RFC-1215
+      DisplayString, mib-2
+        FROM RFC1213-MIB
+      wfSystem
+        FROM Wellfleet-COMMON-MIB;
+
+
+    wfSys		OBJECT IDENTIFIER ::= { wfSystem 1 }
+
+    wfSysDescr OBJECT-TYPE
+        SYNTAX	DisplayString
+        ACCESS	read-only
+        STATUS	mandatory
+        DESCRIPTION
+                "A textual description of the entity including full name and version of
+                the system's hardware type, OS, and networking SW "
+        ::= { wfSys 1 }
+
+    wfSysObjectID OBJECT-TYPE
+        SYNTAX	OBJECT IDENTIFIER
+        ACCESS	read-only
+        STATUS	mandatory
+        DESCRIPTION
+                "Provides an unambiguous means for determining the MIB type (old product vs.
+                harpoon MIB)."
+        ::= { wfSys 2 }
+
+    wfSysUpTime OBJECT-TYPE
+        SYNTAX	TimeTicks
+        ACCESS	read-only
+        STATUS	mandatory
+        DESCRIPTION
+                "Time in seconds/100 since the last cold start"
+        ::= { wfSys 3 }
+
+    wfSysContact OBJECT-TYPE
+        SYNTAX	DisplayString
+        ACCESS	read-write
+        STATUS	mandatory
+        DESCRIPTION
+                "Contact person for this node and where/how to contact them"
+        ::= { wfSys 4 }
+
+    wfSysName OBJECT-TYPE
+        SYNTAX	DisplayString
+        ACCESS	read-write
+        STATUS	mandatory
+        DESCRIPTION
+                "Node's fully qualified domain name or administratively assigned name"
+        ::= { wfSys 5 }
+
+    wfSysLocation OBJECT-TYPE
+        SYNTAX	DisplayString
+        ACCESS	read-write
+        STATUS	mandatory
+        DESCRIPTION
+                "Physical Location of this Node"
+        ::= { wfSys 6 }
+
+    wfSysServices OBJECT-TYPE
+        SYNTAX	INTEGER
+        ACCESS	read-only
+        STATUS	mandatory
+        DESCRIPTION
+                "A sum of numbers indicating the set of services the entity offers. For each
+                layer L, add 2**(L - 1). Example: 78 = Layers 2,3,4, and 7."
+        DEFVAL	{ 78 }
+        ::= { wfSys 7 }
+
+    wfSysGmtOffset OBJECT-TYPE
+        SYNTAX	INTEGER
+        ACCESS	read-only
+        STATUS	mandatory
+        DESCRIPTION
+                "The positive or negative offset from Greenwich Mean Time (GMT). This
+                effectively describes the time zone."
+        ::= { wfSys 8 }
+
+    wfSysMibVersion OBJECT-TYPE
+        SYNTAX	DisplayString
+        ACCESS	read-only
+        STATUS	mandatory
+        DESCRIPTION
+                "The version of the private management information base currently being
+                used by the system software. Format is: xV.RR"
+        ::= { wfSys 9 }
+
+    wfSysMibRevision OBJECT-TYPE
+        SYNTAX	INTEGER
+        ACCESS	read-write
+        STATUS	mandatory
+        DESCRIPTION
+                "The revision level of the private management information base currently
+                being used by the system software."
+        ::= { wfSys 10 }
+
+    wfSysAgentType OBJECT-TYPE
+        SYNTAX	INTEGER {
+    		    anrptragenttype(29),
+    		    anhubagenttype(30)
+    		}
+        ACCESS	read-only
+        STATUS	mandatory
+        DESCRIPTION
+                "The network management agent's module type"
+        ::= { wfSys 11 }
+
+    wfSysMibCounterEnable OBJECT-TYPE
+        SYNTAX	INTEGER {
+    		    enabled(1),
+    		    disabled(2)
+    		}
+        ACCESS	read-write
+        STATUS	mandatory
+        DESCRIPTION
+                "Mib II counter Switch"
+        DEFVAL	{ enabled }
+        ::= { wfSys 12 }
+
+    END  -- Wellfleet-SYS-MIB
diff -Naur tomato/release/src/router/snmp/perl/SNMP/t/notify.t tomato121/release/src/router/snmp/perl/SNMP/t/notify.t
--- tomato/release/src/router/snmp/perl/SNMP/t/notify.t	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/perl/SNMP/t/notify.t	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,78 @@
+#!./perl
+
+BEGIN {
+    unless(grep /blib/, @INC) {
+        chdir 't' if -d 't';
+        @INC = '../lib' if -d '../lib';
+    }
+}
+use Test;
+BEGIN { $n = 10; plan tests => $n }
+use SNMP;
+use vars qw($agent_port $comm $comm2 $trap_port $agent_host $sec_name $priv_pass $auth_pass $bad_name);
+require 't/startagent.pl';
+$SNMP::debugging = 0;
+
+my $res;
+my $enterprise = '.1.3.6.1.2.1.1.1.0';
+my $generic = 'specific';
+
+#                         V1 trap testing
+######################  1  #############################
+# Fire up a trap session.
+my $s1 =
+    new SNMP::Session (DestHost=>$agent_host,Version=>1,Community=>$comm,RemotePort=>$trap_port);
+ok(defined($s1));
+
+##########################  2  ####################################
+# test v1 trap
+$res = $s1->trap(enterprise => $enterprise, agent=>$agent_host, generic=>$generic,[[sysContact, 0, 'root@localhost'], [sysLocation, 0, 'here']] );
+ok($res =~ /^0 but true/);
+
+########################### 3 #############################
+# test with wrong varbind
+$res = $s1->trap([[$bad_name, 0, 'root@localhost'], [sysLocation, 0, 'here']] );
+#print("res is $res\n");
+ok(!defined($res));
+#########################################################
+
+#                      V2 testing
+########################## 4 ############################
+# Fire up a v2 trap session.
+my $s2 =
+    new SNMP::Session (Version=>2, DestHost=>$agent_host,Community=>$comm2,RemotePort=>$trap_port);
+ok(defined($s2));
+#########################  5  ###########################
+# test v2 trap
+$res = $s2->trap(uptime=>200, trapoid=>'coldStart',[[sysContact, 0, 'root@localhost'], [sysLocation, 0, 'here']] );
+#print("res is $res\n");
+ok($res =~ /^0 but true/);
+##########################  6  ##########################
+# no trapoid and uptime given. Should take defaults...
+my $ret = $s2->trap([[sysContact, 0, 'root@localhost'], [sysLocation, 0, 'here']] );
+#print("res is $ret\n");
+ok(defined($ret));
+
+#########################################################
+
+#                     v3 testing
+########################  7  ############################
+# Fire up a v3 trap session.
+my $s3 = new SNMP::Session(Version=>3, DestHost=> $agent_host, RemotePort=>$trap_port, SecName => $sec_name);
+ok(defined($s3));
+
+########################  8  ###########################
+$res = $s3->inform(uptime=>111, trapoid=>'coldStart', [[sysContact, 0, 'root@localhost'], [sysLocation, 0, 'here']] );
+ok($res =~ /^0 but true/);
+
+#################### 9 #####################
+# Fire up a v3 trap session.
+$s3 = new SNMP::Session(Version=>3, DestHost=> $agent_host, RemotePort=>$trap_port, SecName => $sec_name, SecLevel => authPriv, AuthPass => $auth_pass, PrivPass => $priv_pass);
+ok(defined($s3));
+
+########################  10  ###########################
+$res = $s3->inform(uptime=>111, trapoid=>'coldStart', [[sysContact, 0, 'root@localhost'], [sysLocation, 0, 'here']] );
+print "res = $res\n";
+ok($res =~ /^0 but true/);
+
+    snmptest_cleanup();
diff -Naur tomato/release/src/router/snmp/perl/SNMP/t/README tomato121/release/src/router/snmp/perl/SNMP/t/README
--- tomato/release/src/router/snmp/perl/SNMP/t/README	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/perl/SNMP/t/README	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,81 @@
+
+mibload
+(save_descriptions, use_long_names) 
+  setmib
+  initMib
+  addMibDirs
+  addMibFiles
+  loadModules
+  unloadModules (todo)
+
+mib
+ translateObj
+ getType
+ mapEnum
+ SNMP::MIB::NODE
+
+session
+  connectivity
+  error handling
+  mib loading
+  parameters
+
+get
+(use_enums, sprint_val, long_names)
+  var formats
+  fget
+  multi varbinds
+  error reporting
+
+getnext
+
+set
+
+trap??
+
+async
+
+snmpv3
+
+
+This is the first stab at setting up comprehensive tests for
+SNMP-1.7 which look and act like regular perl5 test results.
+
+Use teststub.t attached below as a template for creating additional
+test modules.
+
+Add more tests and feed them back into the distribution!  The more the
+better!
+
+Written by John Stoffel (jfs@fluent.com =or= john@nesc.org) 10/14/1997
+
+------------<teststub.t>--------------------------------
+#!./perl
+
+BEGIN {
+    unless(grep /blib/, @INC) {
+        chdir 't' if -d 't';
+        @INC = '../lib' if -d '../lib';
+    }
+}
+use Test;
+use SNMP 3.0;
+
+$SNMP::verbose = 0;
+$num = 0;  # Number of tests to run
+
+print "1..$num\n";
+$n = 1;
+
+my $junk_oid = ".1.3.6.1.2.1.1.1.1.1.1";
+my $oid = '.1.3.6.1.2.1.1.1';
+my $name = 'sysDescr';
+my $junk_name = 'fooDescr';
+
+######################################################################
+# Garbage names return Undef.
+# test 1
+$type = SNMP::getType($junk_name);
+printf "%s %d\n", (!defined($type)) ? "ok" :"not ok", $n++;
+
+
diff -Naur tomato/release/src/router/snmp/perl/SNMP/t/session.t tomato121/release/src/router/snmp/perl/SNMP/t/session.t
--- tomato/release/src/router/snmp/perl/SNMP/t/session.t	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/perl/SNMP/t/session.t	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,73 @@
+#!./perl
+
+BEGIN {
+    unless(grep /blib/, @INC) {
+        chdir 't' if -d 't';
+        @INC = '../lib' if -d '../lib';
+    }
+}
+use Test;
+BEGIN { plan tests => 5}
+use SNMP;
+use vars qw($agent_port $comm $agent_host $bad_auth_pass $auth_pass $sec_name $bad_sec_name $bad_version $bad_priv_pass $priv_pass);
+require "t/startagent.pl";
+
+$SNMP::debugging = 0;
+
+# create list of varbinds for GETS, val field can be null or omitted
+my $vars = new SNMP::VarList (
+			   ['sysDescr', '0', ''],
+			   ['sysContact', '0'],
+			   ['sysName', '0'],
+			   ['sysLocation', '0'],
+			   ['sysServices', '0'],
+			   ['ifNumber', '0'],
+			   ['ifDescr', '1'],
+			   ['ifSpeed', '1'],
+			  );
+
+#########################== 1 ===#########################################
+# Create a bogus session, undef means the host can't be found.
+# removed! this test can hang for a long time if DNS is not functioning
+# my $s1 = new SNMP::Session (DestHost => $bad_host );
+# ok(!defined($s1));
+#print("\n");
+#####################== 2 ====############################################
+# Fire up a session.
+    my $s2 =
+    new SNMP::Session (DestHost=>$agent_host, Community=>$comm,
+		       RemotePort=>$agent_port);
+    ok(defined($s2));
+######################==  3 ==== ##########################################
+
+# Fire up a V3 session 
+my $s3 = new SNMP::Session (Version => 3 , RemotePort => $agent_port, 
+			    SecName => $sec_name );
+ok(defined($s3));
+#print STDERR "Error string1 = $s3->{ErrorStr}:$s3->{ErrorInd}\n";
+#print("\n");
+#####################=== 4 ====###########################################
+#create a V3 session by setting an IP address/port not running an agent
+my $s4 = new SNMP::Session (Version => 3, RemotePort => 1002, Retries => 0);
+# engineId discovery should fail resulting in session creation failure (undef)
+ok(!defined($s4));
+#print STDERR "Error string1 = $s4->{ErrorStr}:$s4->{ErrorInd}\n";
+#print("\n");
+######################  5  ###########################################
+#create a session with bad version
+my $s5 = new SNMP::Session (Version=>$bad_version);
+ok(!defined($s5));
+#print("\n");
+########################  6  ########################################
+#Test for v3 session creation success
+my $s6 = new SNMP::Session (Version => 3, RemotePort => $agent_port,
+			    SecLevel => 'authPriv', 
+			    SecName => $sec_name, 
+			    PrivPass => $priv_pass, 
+			    AuthPass => $auth_pass);
+ok(defined($s6));
+#print STDERR "Error string2 = $s6->{ErrorStr}:$s6->{ErrorInd}\n";
+#print("\n");
+#####################  7  ############################################
+
+snmptest_cleanup();
diff -Naur tomato/release/src/router/snmp/perl/SNMP/t/set.t tomato121/release/src/router/snmp/perl/SNMP/t/set.t
--- tomato/release/src/router/snmp/perl/SNMP/t/set.t	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/perl/SNMP/t/set.t	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,221 @@
+#!./perl
+
+BEGIN {
+    unless(grep /blib/, @INC) {
+        chdir 't' if -d 't';
+        @INC = '../lib' if -d '../lib';
+    }
+}
+use Test;
+BEGIN { plan tests => 7 }
+use SNMP;
+use vars qw($agent_port $comm $agent_host);
+require "t/startagent.pl";
+
+
+my $junk_oid = ".1.3.6.1.2.1.1.1.1.1.1";
+my $oid = ".1.3.6.1.2.1.1.1";
+my $junk_name = 'fooDescr';
+my $junk_host = 'no.host.here';
+my $name = "gmarzot\@nortelnetworks.com";
+
+$SNMP::debugging = 0;
+$n = 15;  # Number of tests to run
+
+#print "1..$n\n";
+if ($n == 0) { exit 0; }
+
+# create list of varbinds for GETS, val field can be null or omitted
+my $vars = new SNMP::VarList (
+			   ['sysDescr', '0', ''],
+			   ['sysObjectID', '0'],
+			   ['sysUpTime', '0'],
+			   ['sysContact', '0'],
+			   ['sysName', '0'],
+			   ['sysLocation', '0'],
+			   ['sysServices', '0'],
+			   ['ifNumber', '0'],
+			   ['ifDescr', '1'],
+			   ['ifSpeed', '1'],
+
+			   ['snmpInPkts', '0'],
+			   ['snmpInBadVersions', '0'],
+			   ['snmpInBadCommunityNames', '0'],
+			   ['snmpInBadCommunityUses', '0'],
+			   ['snmpInASNParseErrs', '0'],
+			   ['snmpEnableAuthenTraps', '0'],
+#			   ['snmpSilentDrops', '0'],
+#			   ['snmpProxyDrops', '0'],
+#			   ['snmpTrapEnterprise', '2'],
+
+#			   ['hrStorageType', '2'],
+#			   ['hrSystemDate', '0'],
+			   ['sysORIndex', '1'],
+			   ['sysORID', '2'],
+			   ['sysORDescr', '3'],
+			   ['sysORUpTime', '4'],
+#			   ['ifName', '1'],
+			   ['sysORLastChange', '0'],
+			   ['ipInHdrErrors', '0'],
+			   ['ipDefaultTTL', '0'],
+			   ['ipInHdrErrors', '0'],
+		          );
+################################################################
+#			   ['ipNetToMediaPhysAddress', '0'],
+#			   ['ipAdEntAddr', '0'],
+#			   ['snmpTrapOID', '0'],
+#			   ['hrSystemNumUsers', '0'],
+#			   ['hrFSLastFullBackupDate', '0'],
+#			   ['ifPromiscuousMode', '0'],
+
+
+
+#########################  1  #######################################
+# Fire up a session.
+    my $s1 =
+    new SNMP::Session (DestHost=>$agent_host,Version=>1,Community=>$comm,RemotePort=>$agent_port);
+    ok(defined($s1));
+
+#######################  2  ##########################################
+# Set some value and see if the value is set properly.
+
+$originalLocation = $s1->get('sysLocation.0');
+$value = 'Router Management Labs';
+$s1->set('sysLocation.0', $value);
+$finalvalue = $s1->get('sysLocation.0');
+ok($originalLocation ne $finalvalue);
+#print STDERR "Error string = $s1->{ErrorStr}:$s1->{ErrorInd}\n";
+#print("set value is: $finalvalue\n\n");
+$s1->set('sysLocation.0', $originalLocation);
+
+########################   3   #######################################
+
+# Now, reset that string with a non-string value.
+# This will FAIL. :)
+
+#$nonstrvalue = '.9.23.56.7';
+#$s1->set('sysLocation.0', $nonstrvalue);
+#$finalvalue = $s1->get('sysLocation.0');
+#ok(!defined($finalvalue));
+
+#if (($initialvalue cmp $finalvalue) != 0 ) {
+#    ok(1);
+#}
+#print STDERR "Error string = $s1->{ErrorStr}:$s1->{ErrorInd}\n";
+#print("set value is: $finalvalue\n\n");
+#$s1->set('sysLocation.0', $originalLocation);
+
+#######################   4   #####################################
+
+# Test for an integer (READ-ONLY)
+$originalservice = $s1->get('sysServices.0');
+#print("services is: $originalservice\n");
+$junk_service = "Nortel Networks";
+$s1->set('sysServices.0', $junk_service);
+
+$finalvalue = $s1->get('sysServices.0');
+#print("services is: $finalvalue\n");
+#print("Services is: $originalservice\n");
+ok($originalservice eq $finalvalue);
+#print STDERR "Error string = $s1->{ErrorStr}:$s1->{ErrorInd}\n";
+$s1->set('sysServices.0',$originalservice);
+#print("\n");
+
+##################   5   ######################
+# Test for an integer (READ-WRITE)
+# The snmpEnableAuthenTraps takes only two values - 1 and 2.
+# If any other value is tried to be set, it doesn't set and
+# retains the old value.
+
+$originalTrap = $s1->get('snmpEnableAuthenTraps.0');
+#print("trap is -- $originalTrap\n");
+$junk_trap = "Nortel Networks";
+$s1->set('snmpEnableAuthenTraps.0', $junk_trap);
+$finalvalue = $s1->get('snmpEnableAuthenTraps.0');
+#print("final trap is: $finalvalue\n");
+ok($finalvalue ne $junk_trap);
+# Should the error be 'Value out of range: SNMPERR_RANGE ?
+#print STDERR "Error string = $s1->{ErrorStr}:$s1->{ErrorInd}\n";
+$s1->set('snmpEnableAuthenTraps.0',$originalTrap);
+#print("\n");
+###################  6  #######################
+# Test for a TimeTicks (is this advisable? )
+# Trying to set uptime which cannot be done (READ-ONLY).
+#$time = $s1->get('sysUpTime.0');
+#print("up time is : $time hundredths of a second\n");
+#$junk_time = 12345;
+#$s1->set('sysUpTime.0', $junk_time);
+#$finalvalue = $s1->get('sysUpTime.0');
+#print("final time is: $finalvalue hundredths of a second \n");
+# Will the final value always be equal to the initial value?
+# depends on how fast this piece of code executes?
+#ok($finalvalue == $time);
+#print STDERR "Error string = $s1->{ErrorStr}:$s1->{ErrorInd}\n";
+#print("\n");
+
+###################   7   ######################
+
+
+#Test for a Counter32 type.
+# READ-ONLY.
+
+#$Pkts = $s1->get('snmpInPkts.0');
+#print(" pkts is : $Pkts\n");
+#$junk_pkts = -1234;
+#$s1->set('snmpInPkts.0', $junk_pkts);
+#$finalPkts = $s1->get('snmpInPkts.0');
+#print("now pkts is : $finalPkts\n");
+#ok($finalPkts > $Pkts);
+# Expecting genErr
+#ok($s1->{ErrorStr} =~ /^\(gen/);
+#print STDERR "pkts is = $s1->{ErrorStr}:$s1->{ErrorInd}\n";
+#print("\n");
+##################   8   ##############################
+
+# Set a non-accessible attribute
+$s1->set('ipAddrEntry.1', 'MyEID');
+# What should I expect - genErr or Bad variable type ?
+# What gets checked first - type or accessibility?
+# if type, then this is right..else, genErr is expected.
+ok($s1->{ErrorStr} =~ /^Bad/ );
+#print STDERR "Error string = $s1->{ErrorStr}:$s1->{ErrorInd}\n";
+#print("\n");
+
+#################  12  ##########################
+# Time stamp test - READ-ONLY
+#$origtime = $s1->get('sysORLastChange.0');
+#print("Time is: $origtime\n");
+#print STDERR "Error string = $s1->{ErrorStr}:$s1->{ErrorInd}\n";
+#$time = $s1->set('sysORLastChange.0', 12345);
+#print("time stamp is : $time \n");
+# Should get genErr.
+#ok($time =~ /^genErr/);
+#print STDERR "Error string = $s1->{ErrorStr}:$s1->{ErrorInd}\n";
+#print("\n");
+
+##############   13   ############################
+
+# OID test
+my $oldoid = $s1->get("sysORID.1");
+#print("OID is : $oldoid\n");
+$junk_OID = ".6.6.6.6.6.6";
+$s1->set('sysORID.1', $junk_OID);
+$newOID = $s1->get("sysORID.1");
+#print("new oid is $newOID\n");
+ok($oldoid eq $newOID);
+#print STDERR "Error string = $s1->{ErrorStr}:$s1->{ErrorInd}\n";
+#print("\n");
+################  14  ##########################
+
+# Try setting an unregistered OID.
+$junk_data = 'hehehe';
+$s1->set('ifmyData.0', $junk_data);
+
+#print STDERR "Error string = $s1->{ErrorStr}:$s1->{ErrorInd}\n";
+ok( $s1->{ErrorStr} =~ /^Unknown/ );
+
+##############################################
+
+snmptest_cleanup();
+
+
diff -Naur tomato/release/src/router/snmp/perl/SNMP/t/snmptest.conf tomato121/release/src/router/snmp/perl/SNMP/t/snmptest.conf
--- tomato/release/src/router/snmp/perl/SNMP/t/snmptest.conf	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/perl/SNMP/t/snmptest.conf	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,21 @@
+sysservices 72
+
+createUser v3_user MD5 test_pass_auth DES test_pass_priv
+
+#       sec.name  source          community
+com2sec v2c_user  default       v2c_private
+com2sec v1_user   default       v1_private
+com2sec v3_user   default       v3_private
+
+#                  sec.model   sec.name
+group   v2c_group  v2c         v2c_user
+group   v1_group   v1          v1_user
+group   v3_group   usm         v3_user
+
+#               incl/excl subtree  mask
+view    all     included .1        80
+
+#                 context sec.model sec.level  match  read   write  notif
+access  v2c_group   ""      any       noauth   exact  all    all    all
+access  v1_group    ""      any       noauth   exact  all    all    all
+access  v3_group    ""      any       noauth   exact  all    all    all
diff -Naur tomato/release/src/router/snmp/perl/SNMP/t/startagent.pl tomato121/release/src/router/snmp/perl/SNMP/t/startagent.pl
--- tomato/release/src/router/snmp/perl/SNMP/t/startagent.pl	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/perl/SNMP/t/startagent.pl	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,89 @@
+# common parameters used in SNMP::Session creation and tests
+$agent_host = 'localhost';
+$agent_port = 7000;
+$trap_port = 8000;
+$mibdir = '/usr/local/share/snmp/mibs';
+$comm = 'v1_private';
+$comm2 = 'v2c_private';
+$comm3 = 'v3_private';
+$sec_name = 'v3_user';
+$oid = '.1.3.6.1.2.1.1.1';
+$name = 'sysDescr';
+$auth_pass = 'test_pass_auth';
+$priv_pass = 'test_pass_priv';
+
+# don't use any .conf files other than those specified.
+$ENV{'SNMPCONFPATH'} |= "bogus";
+
+# erroneous input to test failure cases
+$bad_comm = 'BAD_COMMUNITY';
+$bad_name = "badName";
+$bad_oid = ".1.3.6.1.2.1.1.1.1.1.1";
+$bad_host = 'bad.host.here';
+$bad_port = '9999999';
+$bad_auth_pass = 'bad_auth_pass';
+$bad_priv_pass = 'bad_priv_pass';
+$bad_sec_name = 'bad_sec_name';
+$bad_version = 7;
+
+local $snmpd_cmd;
+local $snmptrapd_cmd;
+
+my $line;
+
+sub snmptest_cleanup {
+    sleep 1; # strangely we need to wait for pid files to appear ??
+    if ((-e "t/snmpd.pid") && (-r "t/snmpd.pid")) {
+        # Making sure that any running agents are killed.
+	# warn "killing snmpd:", `cat t/snmpd.pid`, "\n";
+	system "kill `cat t/snmpd.pid` > /dev/null 2>&1";
+	unlink "t/snmpd.pid";
+    }
+    if ((-e "t/snmptrapd.pid") && (-r "t/snmptrapd.pid")) {
+        # Making sure that any running agents are killed.
+	# warn "killing snmptrap:", `cat t/snmptrapd.pid`, "\n";
+	system "kill `cat t/snmptrapd.pid` > /dev/null 2>&1";
+	unlink "t/snmptrapd.pid";
+    }
+}
+snmptest_cleanup();
+#Open the snmptest.cmd file and get the info
+if (open(CMD, "<t/snmptest.cmd")) {
+  while ($line = <CMD>) {
+    if ($line =~ /HOST\s*=>\s*(\S+)/) {
+      $agent_host = $1;
+    } elsif ($line =~ /MIBDIR\s*=>\s*(\S+)/) {
+      $mibdir = $1;
+    } elsif ($line =~ /AGENT_PORT\s*=>\s*(\S+)/) {
+      $agent_port = $1;
+    } elsif ($line =~ /SNMPD\s*=>\s*(\S+)/) {
+      $snmpd_cmd = $1;
+    } elsif ($line =~ /SNMPTRAPD\s*=>\s*(\S+)/) {
+      $snmptrapd_cmd = $1;
+    }
+  } # end of while
+  close CMD;
+} else {
+  die ("Could not start agent. Couldn't find snmptest.cmd file\n");
+}
+
+if ($^O !~ /win32/i) {
+  if ($snmpd_cmd) {
+    if (-r $snmpd_cmd and -x $snmpd_cmd) {
+#      print STDERR "running: $snmpd_cmd -r -l t/snmptest.log -C -c t/snmptest.conf -P t/snmpd.pid $agent_port > /dev/null 2>&1\n";
+      system "$snmpd_cmd -r -l t/snmptest.log -C -c t/snmptest.conf -P t/snmpd.pid $agent_port > /dev/null 2>&1";
+    } else {
+      warn("Couldn't run snmpd\n");
+    }
+  }
+  if ($snmptrapd_cmd) {
+    if (-r $snmptrapd_cmd and -x $snmptrapd_cmd) {
+      system "$snmptrapd_cmd -u t/snmptrapd.pid -c t/snmptest.conf -C $trap_port > /dev/null 2>&1";
+    } else {
+      warn("Couldn't run snmptrapd\n");
+    }
+  }
+}
+
+1;
+
diff -Naur tomato/release/src/router/snmp/perl/SNMP/TODO tomato121/release/src/router/snmp/perl/SNMP/TODO
--- tomato/release/src/router/snmp/perl/SNMP/TODO	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/perl/SNMP/TODO	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,40 @@
+enhance make test
+
+implement v2 traps and v3 inform requests.
+
+solidify/enhance the V3 api
+
+handle TCP sessions
+
+See that informative strings are returned and the the error number is
+useful in all cases. (need to set $! for errors where a session is not
+returned (failed engineId discovery, memory alloc error, failed key
+computation?))
+
+PC and other unix builds - any platform issues
+
+building with shared libs
+
+ensure module does not complain with -w.
+
+enhance async api so that a boolean false return from a callback exits
+the MainLoop
+
+enhance async api to store a reference to the perl SNMP::Sesion object
+for 2 reasons: 1) if the initial calling session goes out of scope we
+won't destroy the C-struct session until the callback is called. 2) it
+allows us to set error codes in the perl SNMP::Session object
+
+see if new async hooks play with Event.pm
+
+handle dynamic changes to Session parameters, perhaps tie Error* to
+snmp_session struct rather than current duplicate representation.
+
+make the parsed mib interface $SNMP::MIB writable
+
+allow unloading and reinitialization of parsed MIB
+
+attach to libucdagent - provide agent functionality
+
+look for *Not Implemeted* and implement :)
+
diff -Naur tomato/release/src/router/snmp/perl/SNMP/typemap tomato121/release/src/router/snmp/perl/SNMP/typemap
--- tomato/release/src/router/snmp/perl/SNMP/typemap	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/perl/SNMP/typemap	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,2 @@
+SnmpSession *	T_PTROBJ
+SnmpMibNode *	T_PTROBJ
diff -Naur tomato/release/src/router/snmp/PORTING tomato121/release/src/router/snmp/PORTING
--- tomato/release/src/router/snmp/PORTING	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/PORTING	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,108 @@
+--- INTRODUCTION
+
+Just a quick note on porting and sending me patches:
+
+First off, you probably should subscribe to
+net-snmp-coders@lists.sourceforge.net by sending a message to
+net-snmp-coders-request@lists.sourceforge.net with a subject line of
+subscribe.  This is a mailing list to discuss all oft the coding
+aspects of the project.
+
+Additionally, you should probably be developing against the latest
+snapshot of the source code, which can be obtained through the
+net-snmp cvs server.  Details can be found at
+http://www.net-snmp.org/cvs/.
+
+If you send patches to us, it would greatly help us if you sent them
+to us based on the current checked out copy from CVS.  To do this,
+send us the output of "cvs diff -u" run in the top level net-snmp
+source tree after you have modified the files that will fix the
+problem or add the feature you're submitting the patch for.
+
+Quite a while back I started using the GNU autoconf testing suite to
+greatly enhance portability.  Because of this porting to new
+architectures is much easier than before.  However, new people porting
+the package to new architectures rarely take advantage of this setup
+and send me patches with lots of '#ifdef ARCH' type C code in it.  Let
+me say up front, I *hate* this type of coding now (even though I used
+to use it a lot).  What is better is to check for the necissary
+functionality using the configure script and then use the results of
+those tests.
+
+To do this, you need to install the GNU 'autoconf' package which also
+requires the GNU 'm4' (gm4) package as well.  This double installation
+is extremely easy and shouldn't take you more than 15 minutes max.
+After that, modify the configure.in and acconfig.h files as needed
+instead of modifying the config.h or configure files directly.  The
+Makefile will re-produce these files from the first two.
+
+Worst case: Don't put in #ifdef architecture style statements.
+Rather, create a new define in the s/ and m/ system specific header
+files and use those defines to test against in the C code.  This
+should only be done for things that can't be checked using configure
+though.
+
+Some autoconf examples:
+
+--- HEADER FILES
+
+In configure.in:
+  AC_CHECK_HEADERS(headdir/header.h)
+
+Then in your source code:
+  #ifdef HAVE_HEADDIR_HEADER_H
+    #include <headdir/header.h>
+  #ENDIF
+
+--- LIBRARY ROUTIENS
+
+In configure.in:
+  AC_CHECK_LIB(libexample, example_function)
+
+Thats it.  The Makefiles will automatically link against -llibexample
+if example_function is found in the library.
+
+--- FUNCTION CHECKS
+
+In configure.in:
+  AC_CHECK_FUNCS(example_function)
+
+In source code:
+  #ifdef HAVE_EXAMPLE_FUNCTION
+    /* use it */
+  #endif
+
+--- STRUCTURE MEMBER CHECKS
+
+In configure.in:
+  AC_CHECK_STRUCT_FOR([
+#include lines
+], STRUCTURE, MEMBER)
+   ^^^^^^^^^  ^^^^^^  (change)
+
+In acconfig.h:
+  #undef STRUCT_STRUCTURE_HAS_MEMBER
+                ^^^^^^^^^     ^^^^^^  (change)
+
+In source code:
+  #ifdef STRUCT_STRUCTURE_HAS_MEMBER
+    /* use it */
+  #endif
+
+--- READ THE MANUAL
+
+The GNU autoconf info files are extremely well written and easy to
+follow.  Please check them out.
+
+I'd be happy to help you through anything you don't understand or
+through more complex examples (eg, checking for structure parts or
+existance).  I'd be far less happy to get patches ignoring the above
+request.  If you simple can't abide by this, please send the patches
+anyway, but it'll just take me longer to get them applied.
+
+Submit the patch to http://www.net-snmp.org/patches/.
+Please include what version of the net-snmp package it was applied to
+and state the arcitectures you have tested it on.
+
+Thanks a lot for the consideration,
+Wes
diff -Naur tomato/release/src/router/snmp/README tomato121/release/src/router/snmp/README
--- tomato/release/src/router/snmp/README	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/README	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,306 @@
+	       README file for net-snmp Version: 5.0.9
+
+DISCLAIMER
+
+  The Authors assume no responsibility for damage or loss of system
+  performance as a direct or indirect result of the use of this
+  software.  This software is provided "as is" without express or
+  implied warranty.
+
+TABLE OF CONTENTS
+
+  Disclaimer
+  Table Of Contents
+  Introduction
+* Supported Architectures
+  Availability
+  Web Page
+* Installation
+  Copying And Copyrights
+* Frequently Asked Questions
+  Helping Out
+* Code Update Announcements
+* Mailing Lists
+  Agent Extensibility
+  Example Agent Configuration and Usage
+  Configuration
+  Submitting Bug Reports
+  Closing
+  Thanks
+
+  * = Required Reading.
+
+INTRODUCTION
+
+  This package was originally based on the CMU 2.1.2.1 snmp code.  It
+  has been greatly modified, restructured, enhanced and fixed.  It
+  hardly looks the same as anything that CMU has ever released.  It
+  was renamed from cmu-snmp to ucd-snmp in 1995 and later renamed from
+  ucd-snmp to net-snmp in November 2000.
+
+SUPPORTED ARCHITECTURES
+
+  Please see the FAQ for this information.
+
+  Please let us know if you compile it on other OS versions and it
+  works for you so we can add them to the above list.
+
+  Porting:  Please! read the PORTING file.
+
+AVAILABILITY
+
+  Download:
+    - http://www.net-snmp.org/download/
+    - ftp://ftp.net-snmp.org/pub/sourceforge/net-snmp/
+  Web page:
+    - http://www.net-snmp.org/
+  Sourceforge Project page:
+    - http://www.net-snmp.org/project/
+  Mirrors:
+    - US:        ftp://ftp.freesnmp.com/mirrors/net-snmp/
+    - Bulgaria:  http://rtfm.uni-svishtov.bg/net-snmp/
+    - Japan:     ftp://ftp.ayamura.org/pub/net-snmp/
+    - Germany:   ftp://ftp.mpg.goe.ni.schule.de/pub/internet/net-snmp/
+
+  The old ucd-snmp.ucdavis.edu web site and ftp server is now
+  offline and should not be accessed any longer.
+
+WEB PAGES
+
+  http://www.net-snmp.org/
+  http://www.net-snmp.org/project/
+
+  Make sure you check out the logo there, which is created using
+  postcards submitted from various locations that make use of the
+  net-snmp package.
+
+INSTALLATION
+
+  See the INSTALL file distributed with this package.
+
+COPYING AND COPYRIGHTS
+
+  See the COPYING file distributed with this package.
+
+FREQUENTLY ASKED QUESTIONS
+
+  See the FAQ file distributed with this package.
+
+HELPING OUT
+
+  This is a project worked on by people around the net.  We'd love
+  your help, but please read the PORTING file first.  Also, subscribe
+  to the net-snmp-coders list described below and mention what you're
+  going to work on to make sure no one else is already doing so!
+  You'll also need to keep up to date with the latest code snap shot,
+  which can be obtained from CVS using the information found at
+  http://www.net-snmp.org/cvs/.
+
+  Contributions to the Net-SNMP source code in any form are greatly
+  appreciated.  We expect the parties providing such contributions to
+  have the right to contribute them to the Net-SNMP project or that
+  the parties that do have the right have directed the person
+  submitting the contribution to do so.  In addition, all contributors
+  need to be aware that if the contribution is accepted and
+  incorporated into the Net-SNMP project, it will be redistributed
+  under the terms of the license agreement used for the entire body of
+  work that comprises the Net-SNMP project (see the COPYING file for
+  details).  If this license agreement ever changes the contribution
+  will continue to be released under any new licenses as well.  Thank
+  you, in advance, for your gracious contributions.
+
+CODE UPDATE ANNOUNCEMENTS
+
+  See the NEWS file and the ChangeLog file for details on what has
+  changed between releases.
+
+  We hate broadcasting announce messages to other mailing lists and
+  newsgroups, so there is a mailing list set up to handle release
+  announcements.  Any time we put new software out for ftp, we'll mail
+  this fact to net-snmp-announce@lists.sourceforge.net.  See the
+  MAILING LISTS section described below to sign up for these
+  announcements.
+
+  We will post new announcements on a very infrequent basis to the
+  other channels (the other snmp mailing lists and newsgroups like
+  comp.protocols.snmp), but only for major code revisions and not for
+  bug-fix patches or small feature upgrades.
+
+MAILING LISTS
+
+  The lists:
+
+    The following mailing lists have been created for your use:
+
+      net-snmp-announce@lists.sourceforge.net  -- For announcements
+      net-snmp-users@lists.sourceforge.net     -- For usage discussions
+      net-snmp-coders@lists.sourceforge.net    -- For development discussions
+      net-snmp-cvs@lists.sourceforge.net       -- For cvs update announcements
+
+    To subscribe to these lists, please see:
+  
+      http://www.net-snmp.org/lists/
+
+    The lists you definitely want to subscribe to is the
+    net-snmp-announce@lists.sourceforge.net list and the
+    net-snmp-users@lists.sourceforge.net list.
+
+    Please do *NOT* send messages to both -users and -coders lists.
+    This is completely unnecessary, and simply serves to further
+    overload (and annoy) the core development team.  Thank you.
+
+  Archives:
+    The archives for these mailing lists can be found by following links at
+
+      http://www.net-snmp.org/lists/
+
+AGENT EXTENSIBILITY
+
+  The agent that comes with this package is extensible through use of
+  shell scripts and other methods.  See the configuration manual pages
+  (like snmpd.conf) and run the snmpconf perl script for further details.
+
+  You can also extend the agent by writing C code directly.  The agent
+  is extremely modular in nature and you need only create new files,
+  re-run configure and re-compile (or link against its libraries).  No
+  modification of the distributed source files are necessary.  See the
+  following files for details on how to go about this:
+  http://www.net-snmp.org/tutorial-5/toolkit/,
+  agent/mibgroup/examples/*.c
+
+  Also, see the local/mib2c program and its README file for help in
+  turning a textual mib description into a C code template.
+
+  We now support AgentX for subagent extensibility.  The net-snmp
+  agent can run as both a master agent and a subagent.  Additionally,
+  a toolkit is provided that enables users of it to easily embed a
+  agentx client into external applications.  See the tutorial at
+  http://www.net-snmp.org/tutorial-5/toolkit/ for an example of how
+  go about doing this.
+
+CONFIGURATION
+
+  See the man/snmp.conf.5 manual page.
+
+  For the agent, additionally see the man/snmpd.conf.5 manual page.
+
+  For the snmptrapd, see the man/snmptrapd.conf.5 manual page.
+
+  You can also run the snmpconf perl script to help you create some of
+  these files.
+
+SUBMITTING BUG REPORTS
+
+  Important: *Please* include what version of the net-snmp (or
+  ucd-snmp) package you are using and what architecture(s) you're
+  using, as well as detailed information about exactly what is wrong.
+
+  To submit a bug report, please use the web interface at
+  http://www.net-snmp.org/bugs/.  It is a full-fledged
+  bug-tracking system that will allow you to search for already
+  existing bug reports as well as track the status of your report as
+  it is processed by the core developers.
+
+  If you intend to submit a patch as well, please read the PORTING
+  file before you do so and then submit it to
+  http://www.net-snmp.org/patches/.
+
+CLOSING
+
+  We love patches.  Send some to us!  But before you do, please see
+  the 'PORTING' file for information on helping us out with the
+  process of integrating your patches (regardless of whether its a new
+  feature implementation or a new port).
+
+  Also, We're interested if anyone actually uses/likes/hates/whatever
+  this package...  Mail us a note and let us know what you think of it!
+
+  Have fun and may it make your life easier,
+
+    The net-snmp developers
+
+THANKS
+
+  The following people have contributed various patches and
+  improvements.  To them we owe our deepest thanks (and you do too!):
+
+    Wes Hardaker <hardaker@users.sourceforge.net>
+    Steve Waldbusser <waldbusser@nextbeacon.com>
+    Dan A. Dickey <ddickey@transition.com>
+    Dave Shield <D.T.Shield@csc.liv.ac.uk>
+    Giovanni S. Marzot <gmarzot@nortelnetworks.com>
+    Niels Baggesen <recnba@mediator.uni-c.dk>
+    Simon Leinen <simon@limmat.switch.ch>
+    David T. Perkins <dperkins@dsperkins.com>
+    Mike Perik <mikep@crt.com>
+    Sanjai Narain <narain@thumper.bellcore.com>
+    francus@metsny.delphi.com
+    Gary Palmer <gpalmer@freebsd.org>
+    Marc G. Fournier <scrappy@ki.net>
+    Gary A. Hayward <gah@bellcore.com>
+    Jennifer Bray <jbray@origin-at.co.uk>
+    Philip Guenther <guenther@gac.edu>
+    Elwyn B Davies <edavies@origin-at.co.uk>
+    Simon Burge <simonb@telstra.com.au>
+    David Paul Zimmerman <dpz@apple.com>
+    Alan Batie <batie@aahz.jf.intel.com>
+    Michael Douglass <mikedoug@texas.net>
+    Ted Rule <Ted_Rule@FLEXTECH.CO.UK>
+    Craig Bevins <craigb@bitcom.net.au>
+    Arther Hyun <arthur@psi.com>
+    Cristian Estan <Cristian.Estan@net.utcluj.ro>
+    Eugene Polovnikov <eugen@rd.zgik.zaporizhzhe.ua>
+    Jakob Ellerstedt <jakob@dynarc.se>
+    Michael J. Slifcak <slif@bellsouth.net>
+    Jonas Olsson <jolsson@erv.ericsson.se>
+    James H. Young <sysjhy@gsu.edu>
+    Jeff Johnson <jbj@redhat.com>
+    Markku Laukkanen <marlaukk@stybba.ntc.nokia.com>
+    Derek Simkowiak <dereks@kd-dev.com>
+    David F. Newman <dnewman@epnet.com>
+    Nick Amato <naamato@merit.edu>
+    Mike Baer <baerm@calweb.com>
+    Patrick Lawrence <pjlawrence@ucdavis.edu>
+    Russ Mundy <mundy@tislabs.com>
+    Olafur Gudmundsson <ogud@tislabs.com>
+    David Reeder <dreeder@tislabs.com>
+    Ed Lewis <lewis@tislabs.com>
+    Bill Babson <wbabson@tislabs.com>
+    Chris Smith <csmith@platform.com>
+    Mike Michaud <mikemichaud@earthlink.net>
+    Andy Hood <ahood@westpac.com.au>
+    Robert Story <rstory@freesnmp.com>
+    Bert Driehuis <driehuis@playbeing.org>
+    Juergen Schoenwaelder <schoenw@ibr.cs.tu-bs.de>
+    Frank Strauss <strauss@ibr.cs.tu-bs.de>
+    Ragnar Kjørstad <ucd@ragnark.vestdata.no>
+    Jochen Kmietsch <jochen.kmietsch@tu-clausthal.de>
+    Jun-ichiro itojun Hagino <itojun@iijlab.net>
+    John L Villalovos <john.l.villalovos@intel.com>
+    Christoph Mammitzsch <Christoph.Mammitzsch@tu-clausthal.de>
+    Arne Oesleboe <Arne.Oesleboe@item.ntnu.no>
+    Jeff Cours <jeff@ultradns.com>
+    Karl Schilke <karl_schilke@eli.net>
+    John Naylon <jbpn@cambridgebroadband.com>
+    Ken Hornstein <kenh@cmf.nrl.navy.mil>
+    Martin Oldfield <m@mail.tc>
+    Harrie Hazewinkel <harrie@users.sourceforge.net>
+    Mark Ferlatte <ferlatte@users.sourceforge.net>
+    Marus Meissner <marcusmeissner@users.sourceforge.net>
+    Stephan Wenzer <stephanwenzel@users.sourceforge.net>
+    Ron Mevissen <ron.mevissen@eed.ericsson.se>
+    T.J. Mather <tjmather@tjmather.com>
+    Craig Setera <seterajunk@charter.net>
+    Katsuhisa ABE <abekatsu@cysols.com>
+    Axel Kittenberger <Axel.Kittenberger@maxxio.com>
+    Johannes Schmidt-Fischer <jsf@InterFace-AG.com>
+    Jeffrey Watson <nostaw@users.sourceforge.net>
+    Bruce Shaw <Bruce.Shaw@gov.ab.ca>
+    Stefan Radman <sradman@users.sourceforge.net>
+    Stephen J. Friedl <sjfriedl@users.sourceforge.net>
+    Alex Burger <alex_b@users.sourceforge.net>
+    Andrew Findlay <andrew.findlay@skills-1st.co.uk>
+    Bob Rowlands <robert.rowlands@sun.com>
+
+  We've probably forgotten people on this list.  Let us know if you've
+  contributed code and we've left you out.
diff -Naur tomato/release/src/router/snmp/README.agentx tomato121/release/src/router/snmp/README.agentx
--- tomato/release/src/router/snmp/README.agentx	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/README.agentx	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,53 @@
+This sub-group of the UCD agent is a 'mature beta' implementation of
+the AgentX agent extensibility protocol, as described in RFC 2741.
+
+  This is a reasonably full implementation, in as much as it 
+supports all the protocol operations described in this document.
+The core functionality has received a reasonable amount of exposure,
+and is believed to be more or less stable in normal use.   It will
+now also handle the non-graceful termination of subagents - returning
+a 'genErr' error for three successive requests before unregistering
+the unresponsive subagent.
+
+  Note that the reverse is not true, and a subagent will not
+re-establish contact with a dead and resurrected master in the default
+configuration.  Putting the following line in your
+APPLICATION.conf file:
+  agentxPingInterval 60
+will make the subagent try to ping the master every 60 seconds, and if
+the connection is deemed broken it'll try and reconnect to the master
+agent after that point (once every 60 seconds).
+
+  Similarly, a subagent will not be able to re-register in place of a
+defunct colleague until the master agent has received three requests
+for the dead connection (and hence unregistered it).
+
+  Some of the less frequently used features (index allocation,
+range registration, etc), have received less thorough testing,
+and may well not be fully functional.   Many of the omissions
+of the earlier release (Contexts, use of GetBulk, the AgentX MIB)
+are still missing from this version.
+
+While the implementation is not yet suitable for mission-critical
+production systems, it should prove sufficiently reliable for
+general-purpose use.
+
+
+  AgentX support is now included in the agent by default, but needs
+to be explicitly enabled before use.  (This *is* still beta code
+after all).  Activate this using by putting a line
+
+		master	agentx
+
+in the snmpd.conf file.  This support is also enabled automatically
+when the '-x' flag is given (to specify a different master AgentX socket),
+or when the agent is invoked as an AgentX subagent (i.e. via the name
+'agentxd' or with the '-X' flag).
+
+  See the main project web page for an examples of a simple stand-alone
+subagent.  (http://www.net-snmp.org/tutorial-5/toolkit/)
+
+
+  Please report any problems experienced to the ucd-snmp-coders list.
+
+Dave
diff -Naur tomato/release/src/router/snmp/README.hpux11 tomato121/release/src/router/snmp/README.hpux11
--- tomato/release/src/router/snmp/README.hpux11	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/README.hpux11	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,34 @@
+Some notes for the HP-UX 11.0/11i port
+======================================
+
+1. Additional libraries needed for linking
+------------------------------------------
+
+Due to the changes I've made to the net-snmp sources it is necessary to link
+the snmp daemon with the libnm library. For doing so you have to pass the
+following option to configure:
+
+	--with-libs=-lnm
+
+You might check in agent/Makefile that the library -lnm has been added to
+the LIBS macro (it should stand at the end of this macro).
+
+2. Starting the net-snmp daemon via rc script
+---------------------------------------------
+
+When starting the net-snmp daemon via rc script you have to trap some signals
+because otherwise the daemon will die the moment the rc script ends. I trap
+the signals 1, 2 and 3 via "trap '' 1 2 3" immediately before starting the
+daemon. I didn't check whether all these signals need to be trapped, probably
+SIGHUP will suffice. BTW this applies to the HP-UX 10.x version as well. It
+would be a good idea to ignore or handle these signals in the daemon...
+
+3. Author, credits, comments
+----------------------------
+
+The HP-UX 11.0 port was done by Johannes Schmidt-Fischer <jsf@InterFace-AG.com>
+
+If you have questions or problems please feel free to contact me via the
+above mentioned e-mail address. Please send a copy of your e-mail to the 
+net-snmp-coders mailing list - probably someone else can answer your
+question earlier than me;-)
diff -Naur tomato/release/src/router/snmp/README.krb5 tomato121/release/src/router/snmp/README.krb5
--- tomato/release/src/router/snmp/README.krb5	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/README.krb5	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,165 @@
+This version of net-snmp supports an experimental SNMPv3 security model
+using Kerberos 5 for authentication.  The protocol is described in an
+up-and-coming IETF Internet-Draft.
+
+This document describes a brief overview of the Kerberos Security Model
+and how to use it.
+
+DESCRIPTION:
+
+The Kerberos Security Model does not use USM; it is completely seperate
+and is not tied to USM in any way.  It works by placing the following
+ASN.1 sequence inside of the SNMPv3 msgSecurityParameters:
+
+ksmSecurityParameters ::= SEQUENCE {
+-- The Kerberos 5 checksum type used to checksum this message
+    ksmChecksumType		INTEGER(0..2147483647),
+-- The actual keyed checksum data returned by Kerberos
+    ksmChecksum			OCTET STRING,
+-- The Kerberos 5 message (either an AP_REQ or AP_REP)
+    ksmKerberosMsg		OCTET STRING,
+-- The cached ticket identifier
+    ksmCachedTicket		INTEGER(0..2147483647)
+}
+
+Note that the whole SEQUENCE is BER encoded as an OCTET STRING.
+
+ksmChecksumType is an integer which corresponded to the checksum algorithm
+used to secure this message as defined by Kerberos (see section 8.3 of
+RFC1510).
+
+ksmChecksum is the output of the checksum algoritm defined by ksmChecksumtype
+(with all NULs in the space for the checksum).
+
+ksmKerberosMsg is a Kerberos 5 AP_REQ or AP_REP message, depending on
+whether or not it is a request or a response (AP_REQ for requests, AP_REP
+for responses).
+
+ksmCachedTicket is a integer which uniquely identifies a ticked already
+cached on the agent to save the overhead of transferring a whole AP_REQ/AP_REP.
+If there is no such cached ticket, it is left at zero.
+
+An agent, upon receiving a message using the KSM, will decode the AP_REQ
+contained within the security parameters and thus validate the client's
+identity.  Using the subkey contained within the AP_REQ, the agent will
+validate the checksum (after first clearing the checksum bytes to zero),
+and issue a response, encoding the appropriate AP_REP message in the
+ksmSecurityParameters.
+
+If the securityLevel of the message is set to AuthPriv, the scopedPdu
+payload will be encrypted using the encryption key and algorithm of the
+AP_REQ subkey.  Note that in this case, the msgData will be a BER-encoded
+OCTET STRING corresponding to the "cipher" element of the EncryptedData
+sequence defined in RFC 1510, section 6.1.
+
+Since this security model is experimental, the number assigned to this
+security model is taken from the recommendations of RFC 2271, section 5,
+which specify enterprise-specific Security Models of the form:
+
+	SnmpSecurityModel = enterpriseID * 256 + security model number
+						 in that enterprise ID;
+
+In the case of KSM this gives us:
+
+	SnmpSecurityModel = 8072 * 256 + 0 = 2066432
+
+
+USAGE:
+
+To actually USE the Kerberos Security Model, do the following:
+
+0) Install Kerberos
+
+   Let it be stated up front - Installing Kerberos completely "cold", without
+   any Kerberos experience at all, can be daunting (to say the least).  If you
+   already have a Kerberos infrastructure at your site, then all of the hard
+   work has been done.  If you do NOT, but you still want to tackle it,
+   you might be interested in the Kerberos FAQ, which can be found at:
+
+   http://www.nrl.navy.mil/CCS/people/kenh/kerberos-faq.html
+
+   Currently the code in net-snmp only supports using MIT Kerberos
+   libraries to link against (you should be able to use any kind of Kerberos
+   server, however).
+
+1) Compile net-snmp with Kerberos.
+
+   This assumes that you already have Kerberos libraries in place.
+
+   Configure net-snmp to include the Kerberos Security Model (ksm) and
+   use --with-cflags and --with-ldflags to specify the location and names
+   of Kerberos header files and libraries.  For example, on my system I
+   run:
+
+   ./configure --with-cflags='-I/usr/krb5/include' \
+      --with-ldflags='-L/usr/krb5/lib -lkrb5 -lcrypto -lcom_err -R/usr/krb5/lib'
+
+   Note that this is on Solaris, and that -R is required to set the correct
+   shared library path.  If you have a newer version of Kerberos, you might
+   instead have to use:
+
+   -lkrb5 -lk5crypto -lcom_err
+
+   as the libraries to link against.  If you get errors (for example, you
+   get a message that says the compiler isn't working) you can check
+   config.log for the output of the compiler.
+
+2) Configure Kerberos and SNMP
+
+   Currently, net-snmp uses the "host" principal assigned to a host.  This
+   may change in the future.  You will want to create host principals of
+   the form:
+
+   host/f.q.d.n@YOUR.REALM
+
+   For example:
+
+   host/mydesktop.example.org@EXAMPLE.ORG
+
+   and place the encryption keys for these principals on every machine you
+   wish to run a SNMP agent (you place each key on it's corresponding machine).
+   Your Kerberos documentation should explain how to do this (in the case
+   of MIT Kerberos, you want to look at the "ktadd" command inside of
+   kadmin).
+
+   If you have a Kerberos infrastructure, you likely already have these
+   principals in place on your systems.
+
+   If you're installing Kerberos for the first time as well, you also
+   need to create client principals corresponding to your userid.  See
+   your Kerberos documentation.
+
+   On the SNMP _agent_ side, you'll want to place in your snmpd.conf file
+   (the one that lives in /usr/local/share/snmp/snmpd.conf, or whereever
+   you have configured on your system):
+
+   rwuser -s ksm userid@YOUR.REALM
+
+   to allow the Kerberos principal 'userid@YOUR.REALM' read/write access to
+   the MIB tree.
+
+3) Run the agent and client applications
+
+   Note that before you do any of this, you will have to have valid Kerberos
+   credentials (generally acquired with the "kinit" program).
+
+   The agent should run without any additional flags.
+
+   You should run the client apps with the following flags:
+
+   -Y defSecurityModel=ksm
+   -v 3
+   -u username
+   -l authNoPriv
+
+   for example:
+
+   snmpget -v 3 -Y defSecurityModel=ksm -u myname -l authNoPriv testhost \
+						system.sysDescr.0
+
+   If you wish to encrypt the payload, change the -l argument to "authPriv".
+
+   If you run into problems, you can add the -Dksm flag to both the manager
+   applications and the agent to get more detailed Kerberos error messages.
+   Note that this setup assumes a working Kerberos infrastructure; if you
+   run into problems, check to make sure Kerberos is working for you.
diff -Naur tomato/release/src/router/snmp/README.Matsushita.txt tomato121/release/src/router/snmp/README.Matsushita.txt
--- tomato/release/src/router/snmp/README.Matsushita.txt	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/README.Matsushita.txt	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,118 @@
+1. INTRODUCTION 
+
+   Last revision 05/30/2003	
+
+   This document describes the process to build net-snmp-5.0.8 stack for embedded linux 
+   platforms based on the following Matsushita(Panasonic) processors family.
+
+   AM33,AM34
+   MN10300,MN103E0HRA
+  
+   The same procedure can be followed to build the net-snmp stack for other Matsushita 
+   family of processors also.
+
+2. ENVIRONMENT
+   
+   Host Machine      : Linux 7.1 or later ( with nfs server or samba server installed ).
+   Target Machine    : Am33 Based Embedded platform.
+   Cross-compiler    : GNU compiler version 3.1 for AM33/AM34/MN10300/MN103E010HRA
+                       am33_2.0-linux-gnu-gcc
+   Host-Target Setup : Samba mount or NFS mount
+      
+
+2. CONFIGURATION
+   
+   The following configuration flags can be used to create Makefile.You can reaplce
+   some of the configuration flags according to your platform and compiler.
+
+   Perl support was NOT compiled in due to unavailability of perl support for 
+   AM3X platform at this time.
+
+   The parameters passed to configure are as follows...
+   ( you can down load the script configure.am33 script )
+
+   --with-cc=am33_2.0-linux-gnu-gcc 
+   --host=i686-pc-linux-gnu 
+   --target=am33-linux ( Can be removed, if it stops building process )
+   --disable-dlopen 
+   --disable-dlclose 
+   --disable-dlerror 
+   --with-endianness=little 
+   --with-openssl=no 
+   --with-cflags="-g -mam33 -O2 -static" 
+   --oldincludedir=./usr/local 
+   --prefix=./usr/local 
+   --exec-prefix=./usr/local 
+   --with-persistent-directory=./usr/local
+
+   These parameters passed are depending on the capabilities available for the
+   AM33/AM34 development environment at the time of build. These parameter can be 
+   changed depending on the avialable capabilities and desired preferences.
+  
+   You can use the below shell script directly to create Makefiles and other files.
+   This script also insttals all binaries ,libraries in usr directory in the directory 
+   in which this scrip executed.
+
+# configure.am33 
+#--------------------------------------------------------------------------
+./configure --with-cc=am33_2.0-linux-gnu-gcc --host=i686-pc-linux-gnu \
+--disable-dlopen --target=am33-linux --disable-dlclose --disable-dlerror \
+--with-endianness=little --with-openssl=no --with-cflags="-g -mam33 -O2 -static" \
+--oldincludedir=./usr/local --prefix=./usr/local --exec-prefix=./usr/local \
+--with-persistent-directory=./usr/local
+
+make 
+make install
+#--------------------------------------------------------------------------
+
+2. INSTALLATION
+
+   Find a partition with 60 Mb available space which will be mounted on to target machine.
+   Copy or ftp the binary to this location ( copy entire usr directory tree ). 
+   Copy net-snmp configuration files from host machine (.snmp directory) on to target / directory.
+   snmp configuration files can be created on host machine by running sbmpconf command. Make sure 
+   that host is using snmpconf from net-snmp-5.0.8 version.
+        
+   -:ON AM3X target Shell :-
+   Mount the above directory on AM3X platform either using NFS or sambs clients on target machine.
+   
+   If you are running a previous version, stop the daemon
+
+   ps -ef | grep snmp
+
+   will return something like:
+
+   root 17736 1 - Jan 26 ? 0:00 /usr/local/sbin/snmpd
+
+   the PID is 17736, so you need to type
+
+   kill {PID}
+
+   in our example this would be
+
+   kill 17736.
+
+   cd /usr/local/sbin
+   ./snmpd
+   
+2.  TESTING
+
+   You will need to know your SNMP community.  For this example, we will use "public".
+
+   snmpwalk -v 2c -m ALL -c public -t 100 localhost .1.3 > snmpwalk.txt
+   more snmpwalk.txt
+
+   This should return a considerable amount of output.
+  
+3. ISSUES
+   
+   You may not see correct target name in the build summary. Just ignore it.
+
+
+   Please refer net-snmp documentation for more information...
+
+
+Srinivasa Rao Gurusu
+Engineer
+Panasonic Semiconductor Development Center ( PSDC )
+gurusus@research.panasonic.com
diff -Naur tomato/release/src/router/snmp/README.snmpv3 tomato121/release/src/router/snmp/README.snmpv3
--- tomato/release/src/router/snmp/README.snmpv3	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/README.snmpv3	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,103 @@
+README.snmpv3
+-------------
+How to setup SNMPv3, a very brief document for Dave to elaborate and
+do a better job on since I suck at writing documentation and he
+doesn't ;-) --Wes:
+
+Note: SHA authentication and DES encryption support is only available
+if you have OpenSSL installed.
+
+Note: encryption support isn't enabled in the binary releases downloadable
+from the net-snmp web site.
+
+Note: this description assumes you're using the software compiled from
+source, and so installed using the default prefix location (/usr/local).
+If you're working with a vendor-provided system, or have configured
+things with a different prefix, you'll need to adjust locations accordingly.
+
+CREATING THE FIRST USER:
+------------------------
+  First, you need to create a new snmpv3 user and give them rights to
+  do things:
+
+    net-snmp-config --create-snmpv3-user -a "my_password" myuser
+
+  WARNING: SNMPv3 pass phrases must be at least 8 characters long!
+
+  The above line creates the user "myuser" with a password of
+  "my_password" (and uses MD5 and DES for protection).  (Note that
+  encryption support isn't enabled in the binary releases downloadable
+  from the net-snmp web site.)  net-snmp-config will also add a line
+  to your snmpd.conf file to let that user have read/write access to
+  your agent.  You may want to change this in your snmpd.conf file
+  (see the snmpd.conf manual page).  Run net-snmp-config --help for
+  more information about it.
+
+  Start the agent and test your setup:
+    /usr/local/sbin/snmpd
+       [...wait a few seconds...  It will run in the background and
+        return you to your shell immediately.]
+
+    snmpget -v 3 -u myuser -l authNoPriv -a MD5 -A my_password localhost sysUpTime.0
+       [ this should return information about how long your agent has been up]
+  
+    snmpget -v 3 -u myuser -l authPriv   -a MD5 -A my_password
+                                         -x DES -X my_password localhost sysUpTime.0
+       [ this should return similar information, but encrypts the transmission ]
+
+CREATING A SECOND USER:
+-----------------------
+  Start the agent (if you didn't do so above).
+
+  You can create as many users as you like using the above method, but
+  this details another way of doing it while the agent is running by
+  modifying the user database using the snmp protocol itself:
+
+  Now, lets create a second user using the first user (just for fun)
+  for both authentication purposes and as a template (or "cloning
+  source"):
+
+    snmpusm -v 3 -u myuser -l authNoPriv -a MD5 -A my_password localhost create wes myuser
+
+  The above should have created the user "wes" with the same password as
+  the "myuser" user.  So then, you need to change his password using:
+
+    snmpusm -v 3 -u wes -l authNoPriv -a MD5 -A my_password localhost passwd my_password new_passphrase
+
+  See, wasn't that easy?  You can now create users.  Wheeee....
+
+  But, you'll have to add a configuration line that allows them access
+  to do things.  Do this with another "rwuser" line in your
+  /usr/local/share/snmp/snmpd.conf file (you'll need to stop and start 
+  the agent again, or send the agent a SIGHUP signal):
+
+    rwuser wes
+
+  Or, optional use the "rouser" token instead of the "rwuser" token to
+  only grant them read-only access.
+
+  Now, test your new user:
+
+    snmpget -v 3 -u wes -l authNoPriv -a MD5 -A new_passphrase localhost sysUpTime.0
+
+
+FURTHER STUDIES:
+---------------
+
+Tired of all those command line authentication options?
+----------------------------------------
+put something like this in your $HOME/.snmp/snmp.conf file (make it
+readable only by you!!!):
+
+  defSecurityName wes
+  defContext ""
+  defAuthType MD5
+  defSecurityLevel authNoPriv
+  defAuthPassphrase new_passphrase
+  defVersion 3
+
+And this is in place the last of the above example lines boils down to:
+
+  snmpget localhost sysUpTime.0
+
+Which is about as simple as I can make it for ya ;-)
diff -Naur tomato/release/src/router/snmp/README.solaris tomato121/release/src/router/snmp/README.solaris
--- tomato/release/src/router/snmp/README.solaris	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/README.solaris	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,214 @@
+README.solaris
+
+The following is a brief explanation of how to compile net-snmp
+to work successfully on Sun Solaris 2.6, 2.7, and 8 machines.  This
+should also work for Solaris 9.
+
+First off, you need to disable Sun's SNMP daemons.
+
+cd /etc/rc3.d
+./S76snmpd stop
+./S88dmi stop
+mv S76snmpd s76snmpd  (lowercase s disables the script)
+mv S77dmi s77dmi
+
+You will need to have installed the development libraries.  If
+you have installed the FORTE C compiler, these are included.
+They are also installed if you have done a "full" or "full plus OEM" install.
+
+To confirm, type:
+
+which ld
+
+It should return
+
+/usr/ccs/bin/ld
+
+If they are not present, they can be installed from the distribution cd.  If this
+is not available, you may want to try downloading the binutils from http://www.sunfreeware.com.
+
+You will also need to install a working compiler if you aren't using Sun's.
+Download gcc from http://www.sunfreeware.com.  Version 2.95.3 works well
+but the 3.0 stream should work as well.
+
+You will also need a proper "make", which can also be downloaded from http://www.sunfreeware.com.
+It installs in /usr/local/bin.
+
+Because of this, you need to modify your path so it includes at least the following directories
+in this order
+
+/usr/bin:/usr/sbin:/usr/local/bin:/usr/ccs/bin:/usr/ucb
+
+Use the following configure calling sequence.
+
+./configure --with-mib-modules="host disman/event-mib ucd-snmp/diskio smux agentx mibII/mta_sendmail" 
+
+If you wish to have perl functionality, see my long note below.
+
+Then do the following:
+
+make
+make install
+
+snmpconf -g basic_setup  (choose a community string besides "public")
+
+/usr/local/sbin/snmpd
+
+snmpwalk -v 2c -m ALL -t 100 -c community_string localhost .1.3
+
+This should return pages of information about your system.
+
+Eventually you will need to make a new startup script for snmpd in /etc/rc3.d.
+
+Addition notes below are from a variety of sources concerning
+various technical matters.
+
+------------------------------------------------------
+
+Solaris has a limitation on the number of file descriptors (255)
+available in stdio, so that fopen() fails if more than
+255 file descriptors (sockets) are open. This prevents mibs from 
+being loaded after 250 sockets are open, since parse.c uses stdio.
+
+SEan <burke_sp@pacbell.net> investigated this problem, and had this
+report on using the SFIO package to solve this problem.
+
+ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+
+The SFIO package ( http://www.research.att.com/sw/tools/sfio/ ) 
+is a buffered streams IO package that is much more more sophisticated 
+than stdio, but it does support stdio API's for backward compatibility,
+and that's the aspect that is important here.
+
+To compile with SFIO, we simply add -I/usr/local/sfio/include to the
+$CPPFLAGS before compiling net-snmp. This causes SFIO's stdio.h to
+preempt Solaris stdio, mapping calls like fopen() and fprintf() to
+the SFIO implementations. This produces a libnetsnmp that does not
+have the fopen() limitation. Any application that links to this 
+libnetsnmp must also be linked to libsfio. 
+
+Here are the two caveats:
+
+1. libsfio exports the functions 'getc' and 'putc', for reasons that
+are not clear. These are the only symbols it exports that conflict
+with stdio. While getc and putc are traditionally macros, Solaris
+makes them functions in multithreaded code (compiled with -mt,
+-pthread, or -D_REENTRANT). If your native stdio code links to the
+libsfio versions, a crash will result.
+
+There are two solutions to this problem. You may remove getc and putc 
+from libsfio, since SFIO defines getc and putc as macros, by doing:
+
+	ar d libsfio.a getc.o
+	ar d libsfio.a putc.o
+
+or link to SFIO's stdio compatibility library, libstdio, ahead of
+libsfio. This library wraps all of the native stdio calls with 
+versions that are safe for native or sfio streams, in case you
+need to share streams between SFIO and native stdio codes.
+
+2. libsfio provides 64-bit offsets in fseek(), ftell(). This is
+a good thing, since SFIO is intened to avoid needless limitations,
+but it means that SFIO's stdio.h defines off_t to be a 64-bit offset. 
+Net-SNMP uses readdir(), which returns a struct dirent containing 
+a 32-bit off_t, so the code compiled for SFIO doesn't access 
+struct dirent's correctly.
+
+There are two solutions to this problem, as well. The first is to
+include <dirent.h> at the start of SFIO's stdio.h. Since SFIO 
+defines a macro substitution for off_t, this leaves struct dirent's 
+definition unchanged.
+
+An alternative, which I haven't verified, is to define _FILE_OFFSET_BITS
+to be 64 when compiling libnetsnmp. According to what I see in Solaris's 
+/usr/include/sys/feature_tests.h, you can select a 64-bit off_t at 
+compile time with this setting, which should make readdir()'s off_t 
+compatible with SFIO's ftell(), fseek().
+ [[ We have received reports that this approach does not in fact work ]]
+
+Finally, thanks to Phong Vo and AT&T Labs for a fast, robust and
+portable package that solves this headache very neatly.
+
+-SEan <burke_sp@pacbell.net>
+
+------------------------------------------------------------
+
+Solaris 8 ships with a version of PERL compiled using sun's cc.  
+
+This causes a problem when attempting to compile net-snmp with the
+new PERL functionality ie.
+
+./configure --with-mib-modules="host disman/event-mib ucd-snmp/diskio smux agentx mibII/mta_sendmail" --enable-shared --enable-embedded-perl
+
+because during the PERL section of the compile, it attempts to do so using the methodology used to
+compile the original PERL, not what you're currently using.  This can be discovered by typing
+
+perl -V
+
+and it says (among other things)
+
+  Compiler:
+    cc='cc'
+
+and you don't have the full version of Sun's C compiler on your system, it's going to break.
+
+If you have downloaded the PERL on www.sunfreeware.com, it is compiled with some extra flags
+that cause the net-snmp compile to break.  Given that the PERL provided with Solaris 8 (5.005_03)
+is rather stale, upgrading may be to your advantage.
+
+Download the current stable release of PERL
+
+http://www.cpan.org/src/stable.tar.gz and gunzip and untar.  
+
+When doing the PERL ./Configure, accept most of the defaults, except
+for the following:
+
+Use which C compiler? [cc]  gcc
+
+(it tends to default to cc even if not installed)
+
+Any additional gcc flags? [-fno-strict-aliasing -I/usr/local/include]
+
+(if there are any additional flags, especially relating to 64 offsets, remove these)
+
+What command should be used to create dynamic libraries? [cc] gcc
+
+Any special flags to pass to gcc to create a dynamically loaded library?
+[-G -L/usr/local/lib]
+
+(There shouldn't be anything extra here (see above))
+
+Any special flags to pass to gcc to use dynamic linking? [none] 
+
+(There shouldn't be anything extra here either (see above))
+
+What is your domain name? [.foo.com] 
+
+(it may guess wrong)
+
+What pager is used on your system? [/bin/less] /usr/bin/more
+
+(It wants less even if it's not installed)
+
+It will prompt you for make depend, then do:
+
+make
+make test
+make install
+perl -V
+
+if everything looks all right, do the net-snmp ./configure (don't forget to make clean if necessary)
+
+ -- Bruce Shaw <Bruce.Shaw@gov.ab.ca>
+
+------------------------------------------------------------
+
+The version of sed in /usr/ucb on Solaris 2.5.1 and 2.6 can't
+cope with the size of the subsitution strings used in config.status.
+
+Putting /usr/bin ahead of /usr/ucb in the search path fixes this.
+
+/usr/xpg4/bin/sed is seen to segfault under Solaris 8 when running configure.
+Putting /usr/bin ahead of /usr/xpg4/bin fixes this.
+Thanks to zach dot metzinger at removeme microtune dot com.
+
diff -Naur tomato/release/src/router/snmp/README.thread tomato121/release/src/router/snmp/README.thread
--- tomato/release/src/router/snmp/README.thread	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/README.thread	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,338 @@
+Improved Error Reporting and Thread-Safe Use of the SNMP Library
+
+There is a need in some environments to support multiple threads
+in a single application.  The SNMP Library provides the Single Session
+functions which support thread-safe operation when certain precautions
+are taken.  This document describes the operation of the SNMP Library
+with a focus on its session management functions.  The Traditional API
+and the Single API functions are compared and contrasted.
+A working understanding of the CMU or UCD SNMP Library
+API is recommended to fully appreciate the concepts discussed.
+The document ends with a list of restrictions for using the Single API
+in a multi-threaded application.
+
+  ***** IMPORTANT ANNOUNCEMENT *****
+  To the point, no resource locks are applied within the SNMP Library.
+  The APDU encoding and some session management functions can be used
+  in thread-safe manners. The MIB file parsing is not thread-safe.
+  The Single Session API was made available in November 1998.
+  Existing applications use the Traditional API, which is not thread-safe.
+  The thread-safe considerations are discussed throughout this document.
+
+The research and development of the Single Session API that I've completed
+was wholly funded by my employer, Internet Security Systems, Inc.
+and is distributed freely to the Internet community.
+
+-Mike Slifcak, 23 April 1999
+
+09 July 1999 Removed references to snmp_synch_setup and snmp_synch_reset
+
+
+Availability
+
+The Single Session API is integrated into the currently available
+versions of the CMU SNMP library and the UC-Davis SNMP package.
+
+ ftp://ftp.net.cmu.edu/pub/snmp/cmu-snmp-V1.13.tar.gz and later
+  Read : snmp_sess_api.3, Changes.SingleSession
+
+ ftp://ucd-snmp.ucdavis.edu/ucd-snmp-3.6.tar.gz and later
+  Read : snmp_sess_api.3, README.thread (after version 3.6.1)
+
+Both libraries work equally well in Windows NT and various
+UNIX platforms.  Please read this document and refer to
+the snmp_sess_api section 3 manual page.
+
+Glossary of Terms
+
+APDU    Application Protocol Data Unit
+API     Application Programming Interface
+CMU     Carnegie-Mellon University, Pittsburgh, PA.
+Library The SNMP library; Both CMU and UCD versions are applicable.
+Session Concept embodying the management of transacting SNMP APDUS.
+SNMP    Simple Network Management Protocol
+UCD     University of California at Davis, CA.
+
+Introduction
+
+The Library extends the UNIX file concept (open, close, read, write) to a Session.
+Opening a Session binds a local socket to a well-known port and creates internal
+structures to help with controlling the transaction of SNMP APDUs.  Closing a
+Session releases the memory and system resources used for these purposes.
+
+Since the mid-1980s, many SNMP applications have used the Traditional Session
+API to transact SNMP APDUs between the local host and SNMP-enabled devices.
+
+  The Traditional Session API does not support multi-threaded applications:
+
+  1)  There are no resource locks to prevent exposing the Library's
+      global data resources to corruption in a multi-threaded application;
+
+  2)  The Traditional API functions that receive SNMP APDUs
+      do not provide an interface for one of many sessions;
+
+  3)  Errors discovered by the Library are communicated through global
+      data structures and are not associated with the session
+      in which the error occurred.
+
+  The Single Session API provides these capabilities:
+
+  1)  Manage a single SNMP session safely, in multi-threaded or
+      non-threaded applications, by avoiding access to data structures
+      that the Traditional Session API may share between Sessions;
+
+  2)  Associate errors with the session context for threaded
+      and non-threaded applications.
+
+
+Contrasting and Comparing Traditional API and Single API
+
+The Traditional API uses the struct snmp_session pointer returned
+from snmp_open() to identify one SNMP session.  The Single API uses
+the opaque pointer returned from snmp_sess_open() to identify one
+SNMP session.
+
+   Helpful Hint : The Library copies the contents of the
+   structure which is input to snmp_open() and snmp_sess_open().
+   Once copied, changing that input structure's data
+   has no effect on the opened SNMP Session.
+
+The Traditional API uses the snmp_error() function to identify any
+library and system errors that occurred during the processing for
+one SNMP session.   The Single API uses snmp_sess_error() for the
+same purpose.
+
+The Traditional API manages the private Sessions list structure;
+adding to the list during snmp_open(), removing during snmp_close.
+
+With few exceptions, the Traditional API calls the Single API
+for each session that appears on the Sessions list.
+
+The Traditional API reads from all Sessions on the Sessions list;
+The Single API does not use the Sessions list.
+The Single API can read from only one Session.
+
+   Helpful Hint :
+   This is the basis for thread-safe-ness of the Library.
+   There are no resource locks applied.
+
+
+Using the Single API
+
+A multi-threaded application that deploys the SNMP Library should
+should complete all MIB file parsing before additional threads
+are activated.  Drawing from the parsed contents of the MIB does
+not incur any data corruption exposure once the internal MIB structures
+are initialised.
+
+The application may create threads such that a single thread may manage
+a single SNMP session.  The thread should call snmp_sess_init()
+to prepare a struct snmp_session structure.  The thread can adjust
+session parameters such as the remote UDP port or the local UDP port,
+which must be set prior to invoking snmp_sess_open().
+
+The first call to snmp_sess_init() initialises the SNMP Library,
+including the MIB parse trees, before any SNMP sessions are created.
+Applications that call snmp_sess_init() do not need to read MIBs
+nor setup environment variables to utilize the Library.
+
+After the struct snmp_session is setup, the thread must call
+snmp_sess_open() to create an SNMP session.  If at any time
+the thread must change the Session configuration,
+snmp_sess_session() returns the pointer to the internal configuration
+structure (a struct snmp_session, copied from snmp_sess_open).
+The thread can adjust parameters such as the session timeout
+or the community string with this returned struct snmp_session pointer.
+Changes to the remote or local port values have no effect on an opened Session.
+ 
+The thread can build PDUs and bind variables to PDUs, as it performs its duties.
+The thread then calls snmp_sess_send() or snmp_sess_async_send() to build and send
+an SNMP APDU to the remote device. If a Get-Response-PDU is expected, the thread
+should call snmp_sess_synch_response() instead.
+
+When the thread is finished using the session, it must free the resources
+that the Library used to manage the session.
+Finally, the thread must call snmp_sess_close() to end the Session.
+
+Snmp_sess_init(), snmp_open(), and snmp_sess_open()
+must use the same calling parameter for a given Session.
+Other methods should use only the returned parameter from
+snmp_open() and snmp_sess_open() to access the opened SNMP Session.
+
+
+Error Processing
+
+Two calls were added : snmp_error() and snmp_sess_error() return the
+"errno" and "snmp_errno" values from the per session data, and a string
+that describes the errors that they represent.  The string must be freed
+by the caller.
+
+Use snmp_error() to process failures after Traditional API calls,
+or snmp_sess_error() to process failure after Single API calls.
+In the case where an SNMP session could not be opened,
+call snmp_error() using the struct snmp_session supplied to either snmp_open()
+or snmp_sess_open().
+
+
+The following variables and functions are obsolete and may create problems
+in a multi-threaded application :
+
+  int    snmp_errno
+  char * snmp_detail
+  snmp_set_detail()
+  snmp_api_errstring()
+
+
+Function Summary
+ 
+The functions in the following table are functionally equivalent,
+with the exception of these behaviors:
+- The Traditional API manages many sessions
+- The Traditional API passes a struct snmp_session pointer,
+       and touches the Sessions list
+- The Single API manages only one session
+- The Single API passes an opaque pointer, and does not use Sessions list
+ 
+  Traditional        Single                    Comment
+  ===========        ==============            =======
+  snmp_sess_init     snmp_sess_init            Call before either open
+  snmp_open          snmp_sess_open            Single not on Sessions list
+                     snmp_sess_session         Exposes snmp_session pointer
+  snmp_send          snmp_sess_send            Send one APDU
+  snmp_async_send    snmp_sess_async_send      Send one APDU with callback
+  snmp_select_info   snmp_sess_select_info     Which session(s) have input
+  snmp_read          snmp_sess_read            Read APDUs
+  snmp_timeout       snmp_sess_timeout         Check for timeout
+  snmp_close         snmp_sess_close           Single not on Sessions list
+ snmp_synch_response snmp_sess_synch_response  Send/receive one APDU
+  snmp_error         snmp_sess_error           Get library,system errno
+
+
+Example 1 : Traditional API use.
+
+    #include "snmp_api.h"
+      ...
+      int liberr, syserr;
+      char *errstr;
+      struct snmp_session Session, *sptr;
+      ...
+      snmp_sess_init(&Session);
+      Session.peername = "foo.bar.net";
+      sptr = snmp_open(&Session);
+      if (sptr == NULL) {
+          /* Error codes found in open calling argument */
+          snmp_error(&Session, &liberr, &syserr, &errstr);
+          printf("SNMP create error %s.\n", errstr);
+          free(errstr);
+          return 0;
+      }
+      /* Pass sptr to snmp_error from here forward */
+      ...
+      /* Change the community name */
+      free(sptr->community);
+      sptr->community = strdup("public");
+      sptr->community_len = strlen("public");
+      ...
+      if (0 == snmp_send(sptr, pdu)) {
+          snmp_error(sptr, &liberr, &syserr, &errstr);
+          printf("SNMP write error %s.\n", errstr);
+          free(errstr);
+          return 0;
+      }
+      snmp_close(sptr);
+
+
+Example 2 : Single API use.
+
+    #include "snmp_api.h"
+      ...
+      int liberr, syserr;
+      char *errstr;
+      void *sessp;  /* <-- an opaque pointer, not a struct pointer */
+      struct snmp_session Session, *sptr;
+      ...
+      snmp_sess_init(&Session);
+      Session.peername = "foo.bar.net";
+      sessp = snmp_sess_open(&Session);
+      if (sessp == NULL) {
+          /* Error codes found in open calling argument */
+          snmp_error(&Session, &liberr, &syserr, &errstr);
+          printf("SNMP create error %s.\n", errstr);
+          free(errstr);
+          return 0;
+      }
+      sptr = snmp_sess_session(sessp); /* <-- get the snmp_session pointer */
+
+      /* Pass sptr to snmp_sess_error from here forward */
+      ...
+      /* Change the community name */
+      free(sptr->community);
+      sptr->community = strdup("public");
+      sptr->community_len = strlen("public");
+      ...
+      if (0 == snmp_sess_send(sessp, pdu)) {
+          snmp_sess_error(sessp, &liberr, &syserr, &errstr);
+          printf("SNMP write error %s.\n", errstr);
+          free(errstr);
+          return 0;
+      }
+      snmp_sess_close(sessp);
+ 
+Example 3. Differences Between Traditional API and Single API Usage
+5a6
+>       void *sessp;  /* <-- an opaque pointer, not a struct pointer */
+11,13c12,14
+<       sptr = snmp_open(&Session);
+<       if (sptr == NULL) {
+---
+>       sessp = snmp_sess_open(&Session);
+>       if (sessp == NULL) {
+19c20,22
+<       /* Pass sptr to snmp_error from here forward */
+---
+>       sptr = snmp_sess_session(sessp); /* <-- get the snmp_session pointer */
+> 
+>       /* Pass sptr to snmp_sess_error from here forward */
+26,27c29,30
+<       if (0 == snmp_send(sptr, pdu)) {
+<           snmp_error(sptr, &liberr, &syserr, &errstr);
+---
+>       if (0 == snmp_sess_send(sessp, pdu)) {
+>           snmp_sess_error(sessp, &liberr, &syserr, &errstr);
+33c36
+<       snmp_close(sptr);
+---
+>       snmp_sess_close(sessp);
+
+
+Restrictions on Multi-threaded Use of the SNMP Library
+
+  1. Invoke SOCK_STARTUP or SOCK_CLEANUP from the main thread only.
+
+  2. The MIB parsing functions use global shared data and are not
+     multi-thread safe when the MIB tree is under construction.
+     Once the tree is built, the data can be safely referenced from
+     any thread.  There is no provision for freeing the MIB tree.
+     Suggestion: Read the MIB files before an SNMP session is created.
+     This can be accomplished by invoking snmp_sess_init from the main
+     thread and discarding the buffer which is initialised.
+
+  3. Invoke the SNMPv2p initialisation before an SNMP session is created,
+     for reasons similar to reading the MIB file.
+     The SNMPv2p structures should be available to all SNMP sessions.
+     CAUTION: These structures have not been tested in a multi-threaded
+     application.
+
+  4. Sessions created using the Single API do not interact with other
+     SNMP sessions.  If you choose to use Traditional API calls, call
+     them from a single thread.  The Library cannot reference an SNMP
+     session using both Traditional and Single API calls.
+
+  5. Using the callback mechanism for asynchronous response PDUs
+     requires additional caution in a multi-threaded application.
+     This means a callback function probably should probably not use
+     Single API calls to further process the session.
+
+  6. Each call to snmp_sess_open() creates an IDS.  Only a call to
+     snmp_sess_close() releases the resources used by the IDS.
+
diff -Naur tomato/release/src/router/snmp/README.win32 tomato121/release/src/router/snmp/README.win32
--- tomato/release/src/router/snmp/README.win32	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/README.win32	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,452 @@
+***************************************************************************
+*
+* README.win32
+*
+***************************************************************************
+
+This guide describes building with Microsoft C++ and with
+the gcc compiler from Cygwin.  As developers build with
+other Win32 environments, their notes will be included here.
+
+
+The remainder of this guide has the following sections :
+
+Status as of 18-Sep-2002 for Win32 platforms
+Status as of 5-Nov-2001 for Win32 platforms
+Installing Platform SDK
+Building with MS VC++
+Building with OpenSSL with MS VC++
+Installing from MS VC++ build
+Building with Cygwin
+Extending the Agent with MS VC++
+Notes on SET support for WIN32 ports
+Acknowledgements
+
+
+***************************************************************************
+*
+* Status as of 18-Sep-2002 for Win32 platforms
+*
+***************************************************************************
+
+  -  new project files created for those wishing to use the platform sdk
+     for more functionality. The default workspace, win32.dsw, does not
+     require the platform sdk. Uses who have installed the platform sdk
+     can use win32sdk.dsw for additional functionality.
+  -  For some as-yet unknown reason, the file descriptors created for the
+     internal callback transport are causing problems with select(), so
+     internal callbacks have been disabled until a fix can be found.
+     This almost certainly means that AgentX will no longer work for win32.
+  -  There appears to be a problem with the libsnmp_dll project, so build
+     the regular libsnmp instead. This, of course, means that the
+     applications will be a bit bigger, but at least they run.
+
+WIN32 savy developers are strongly encouraged to lend a hand in helping
+to fix these problems, as none of the core developers are very enthusiastic
+about working on windows. We'll probably get around to fixing things
+eventually, but if you can help, let us know.
+
+
+***************************************************************************
+*
+* Status as of 5-Nov-2001 for Win32 platforms
+*
+***************************************************************************
+
+  -  the client applications work
+  -  the core framework of the agent works
+  -  the system, snmp, ip, tcp, udp, icmp mibgroups work
+          (assuming one installs the option Platform SDK)
+  -  the target, agentx, smux, notification groups compile
+  -  extending the agent to support enterprise-specific MIBs works
+  -  running the agent on a non-standard port works
+  -  running the UCD agent instead of the MS supplied one "works"
+          (at the loss of most of the functionality)
+  -  running the UCD agent as a "subagent" of the MS one does not work
+          (i.e. using the SNMP.dll interface)
+  -  running the UCD agent as a subagent of an AgentX master "works"
+          (bearing in mind this support is alpha-code)
+
+All applications build with both MS VC++ and Cygwin.
+
+Note: The agent cannot be built as an extensible SNMP agent that
+will work with Microsoft's agent.
+
+Neither snmpd nor snmptrapd register as NT services.
+
+Snmptrapd does not "share" nor multiplex traps with SNMPTRAP.EXE,
+a program that is available from Microsoft or ACE#COMM.
+
+
+***************************************************************************
+*
+* Installing Platform SDK
+*
+***************************************************************************
+
+The core elements of the mibII group of the agent, use the "IP Helper API"
+which is part of Microsoft's "Core Platform SDK".  This is typically
+not installed by default, but can be downloaded from
+		http://msdn.microsoft.com/downloads/
+as follows:
+
+    -  Using Internet Explorer (Netscape won't work), go to the above URL
+    -  From the menu at the left, select
+		"Software Development Kits"
+		"Platform SDK"
+    -  From the new window that appears, select "Core SDK".
+    -  The full Core SDK is ~240Mb (expanding to ~560Mb on installation).
+       In fact, the only portion that's required is the basic "Build
+       Environment" (36Mb) So it's safe to deselect the pre-release version,
+       documentation, sample code and 64-bit elements.
+
+    -  Once this package has installed, from the Start Menu run
+	"Register PSDK directories with Visual Studio"
+
+
+To buld the agent, make sure you use the win32sdk.dsw workspace.
+
+The full agent should now compile successfully.
+
+
+***************************************************************************
+*
+* Building with MS VC++
+*
+***************************************************************************
+
+The win32 directory contains a Microsoft VC++ (6.0) workspace and
+project files to build both static and DLL versions of the UCD SNMP
+library and the applications. Until recently it is known to build with
+VC++ 5.0 too, unfortunately none of the developers have this version around
+anymore.
+
+Building with earlier compiler versions has not been attempted.  Success
+stories are welcomed.
+
+A manually generated config.h file has been provided for use with the
+win32 build since the basic win32 environment does not support autoconf.
+Note: the compiled in MIB path is \usr\mibs which may be changed by
+editing win32/config.h.  Note that the install instructions below
+should be adjusted when changes are made to paths.
+
+To build the libraries and applications, open the workspace file
+"win32\win32.dsw" from VC++.
+
+Note there is a Debug version and Release version for each subproject.
+Due to the way the libraries are organized, there are exactly two
+library versions that work :
+
+  1) libsnmp Debug ;  and 2) libsnmp_dll Release
+
+[Actaully, I'm not sure that is true anymore. I have had success with
+both libsnmp Debug and Release, and no luch with libsnmp_dll.]
+
+The projects are arranged so that ALL of the usable products,
+the .lib, .dll, and .exe files, are written to the win32\bin
+directory.  The win32\lib directory is used only to build the
+the files in the win32\bin directory.  Once building is completed,
+there is no further use for the files in the win32\lib directory.
+
+The Debug product .exe files have "_d" appended to the basename
+of the applications.  This is so the Debug and Release versions
+of an application can be built and tested separately.
+
+
+Runtime libraries
+-----------------
+
+Note that the library must be built using the same options as the
+application which it will be linked with. In particular, the run-time
+libraries must match (Project settings, C/C++ tab, 'Code Generation'
+category).
+
+For example, linking in an snmplib built to use the Multithreaded DLL
+runtime library to an application configured for the Debug
+Multithreaded DLL runtime library results in a link error along the
+lines of 'defaultlib "MSVCRT" conflicts with use of other libs'.   If
+you receive a similar message, check that the projects settings
+between library and application match up.
+
+Debug Information
+-----------------
+
+Note that VC++ 6.0 has new options for for debugging information -
+the 'Program Database'.  This option is set in the Project settings,
+C/C++ tab, 'General' category, and is turned on by default during the
+conversion of the project files. This option is not for use with a
+library, as it embeds debug information into the library that
+references an external file that will not be available to the linking
+application. If you get an error message along the lines of
+'debugging information not available in file vc60.pdb, make sure the
+library debug option is set to 'C7 compatible'.
+
+To build the Release versions:
+Click Build->Batch Build. Uncheck all Debug and libsnmp versions.
+Make sure libsnmp_dll Release and all other Release versions
+are checked.  Rebuild All.  If the library DLL link fails, add
+missing function names to libsnmp_dll/libsnmp.def.
+
+To build the Debug versions:
+Click Build->Batch Build. Uncheck all Release and libsnmp_dll versions.
+Make sure libsnmp Debug and all other Debug versions
+are checked. Rebuild All.
+
+To build both Debug and Release versions:
+Click Build->Batch Build.  Check all versions.  Uncheck
+"libsnmp Release" and "libsnmp_dll Debug" versions only.
+Then click Release All.
+
+
+***************************************************************************
+*
+* Building with OpenSSL with MS VC++
+*
+***************************************************************************
+
+OpenSSL is required to support the encryption capabilities in SNMPv3
+(and will also support MD5 authentication). The win32 version of OpenSSL
+can be built from the source at:
+
+ftp://ftp.openssl.org/source/
+
+Follow the instructions for building on win32 in that package. if you do
+not have the M$ assembler installed (MASM) you can get a free one(NASM)
+from:
+
+http://www.kernel.org/pub/software/devel/nasm
+
+You will also need to change the win32/config.h file from
+
+---
+/* define if you are using the internal MD5 code */
+#define USE_INTERNAL_MD5 1
+---
+to
+---
+/* define if you are using the internal MD5 code */
+#undef USE_INTERNAL_MD5
+
+/* define if you are using OpenSSL */
+#define USE_OPENSSL 1
+---
+
+now you will need to edit the VC++ Project settings for the libraries
+and applications. Change the Settings->Link->'Object/Library Modules' to
+include
+
+libeay32.lib
+
+when installing be sure to place libeay32.dll on your search path (e.g.,
+usr\bin)
+
+
+***************************************************************************
+*
+* Installing from MS VC++ build
+*
+***************************************************************************
+
+Create these subdirectories on the root directory of the
+volume you wish to hold the UC-Davis SNMP applications :
+
+  usr, usr\bin, usr\mibs, usr\lib, usr\include\ucd-snmp
+
+Copy mibs\*.txt to usr\mibs
+Copy win32\bin\*.* to usr\bin
+Copy win32\lib\*.* to usr\lib
+Copy snmplib\*.h to usr\include\ucd-snmp
+Copy win32\config.h to usr\include\ucd-snmp\ucd-snmp-config.h
+
+if using OpenSSL
+Copy libeay32.dll to usr\bin
+Copy libeay32.lib to usr\lib
+
+Installing is complete.  You may want to create a compressed
+archive of the \usr hierarchy.
+
+
+***************************************************************************
+*
+* Building with Cygwin
+*
+***************************************************************************
+
+An alternate way to build UCD SNMP for win32 is to use Cygnus's cygwin32
+environment.  Information on the Cygnus cygwin32 environment is available
+on the web at: http://sources.redhat.com/cygwin/.
+
+Cygwin allows you to compile almost the complete agent and applications.
+The following configure options creates a working set of programs:
+
+./configure --with-mib-modules="host agentx smux examples/example" \
+ 	--with-out-mib-modules=host/hr_network \
+	--with-libs="-lregex -liphlpapi"
+
+This has been tested for Windows 98 and Windows NT 4.0.  In order for
+the process part of the host resources MIB to work under NT you will need
+to get hold of the PSAPI.DLL. This available under the download section
+of www.microsoft.com. The DLL is included with Windows 2000 and XP,
+and is also part of the VC++ distribution.  The IPHLPAPI library is
+part of the "Microsoft Platform SDK", which is also available from
+www.microsoft.com.  See above for details.
+
+
+***************************************************************************
+*
+* Extending the Agent with MS VC++
+*
+***************************************************************************
+
+Assuming that the MIB compiler generated the my.h and my.c files for the
+custom MIB "my", the following changes are required to extend the agent
+using VC++:
+
+   - Add the my.h and my.c files to your 'netsnmpmibs' project in VC++.
+   - Next edit the '<sourcedir>\win32\mib_module_includes.h' file to
+     add an include to your .h file.
+
+        #include "mibgroup/my.h"
+
+   - Next edit the '<sourcedir>\win32\mib_module_inits.h' file to add
+     code to call your initialize function.
+
+        if (should_init("my")) init_my();
+
+
+That's all that is needed. Now go ahead and compile the 'netsnmpmibs'
+and 'snmpd' project. And things should work just fine.
+
+
+***************************************************************************
+*
+* Notes on SET support for WIN32 ports
+*
+***************************************************************************
+
+Requirements:
+
+  Windows NT/2000 or later: Requires Windows NT 4.0 SP4 or later. 
+  Windows 95/98/Me: Requires Windows 98 or later. 
+  Library: Use IPHLPAPI.LIB 
+
+Note: IPHLPAPI.LIB is part of the "Microsoft Platform SDK", which may be
+      freely downloaded from www.microsoft.com.  See above for details.
+
+Windows support for SET on following groups:
+
+interfaces:
+----------
+ifAdminStatus is read-write. Status can be set with either 'up' or
+'down'. (IE, 'testing' status is not supported.)
+
+
+ip group:
+--------
+Scalar objects: 
+ipForwarding:Currently windows supports only ON->OFF (IE,
+enable->disable). For any other value, it returns with failure.
+
+ipDefaultTTL: Supports value greater than or equal to 0. 
+
+Table objects:
+-------------
+1. ipRouteTable:
+   ------------
+route_write.c implements this.
+
+ipRouteDest: Setting this value, updates row with new ipRouteDest and all other
+             entries will be same as old row. 
+    EX:
+    Consider there is an entry with ipRouteDest = 10.0.0.20
+    Request, snmpset localhost private ip.ipRouteTable.ipRouteEntry.ipRouteDest.10.0.0.20 -a 10.0.0.16
+    Updates that row with ipRouteDest = 10.0.0.16
+
+ipRouteIfIndex:Write supported.
+
+ipRouteMetric1: Supports value greater than or equal to -1
+
+ipRouteMetric2, ipRouteMetric3, ipRouteMetric4, ipRouteMetric5: Even though
+		call returns with success, Windows doesn't change these (as
+		these are not used in Windows)
+
+ipRouteNextHop: Write supported.
+
+ipRouteType: Write Supported. If value is 2, IE 'invalid', it deletes the entry.
+
+ipRouteAge: Whenever any row is updated this will be automatically reset.
+
+ipRouteMask: Write Supported.
+
+Creation of ipRouteTable row:
+-----------------------------
+snmpset request for non existent OID with ipRouteIfIndex, ipRouteMetric1, 
+ipRouteNextHop and ipRouteMask varbinds, creates a row.
+
+snmpset with create option is not supported, as row creation requires 
+ipRouteIfIndex, ipRouteMetric1, ipRouteNextHop and ipRouteMask  in a single 
+request.
+
+Example to create a row:
+-----------------------
+Consider there is no entry for 10.0.0.18
+
+snmpset localhost private ip.ipRouteTable.ipRouteEntry.ipRouteIfIndex.10.0.0.18 i 2 4.21.1.ipRouteMask.10.0.0.18 a 255.255.255.255 4.21.1.ipRouteNextHop.10.0.0.0 a 10.0.0.0 4.21.1.ipRouteMetric1.10.0.0.18 i 1
+
+If ipRouteIfIndex is valid then creates row with:
+ipRouteIfIndex = 2
+ipRouteMask = 255.255.255.255
+ipRouteNextHop = 10.0.0.0
+ipRouteMetric1 = 1
+
+2. ipNetToMediaTable:
+--------------------
+ipNetToMediaIfIndex: write supported
+ipNetToMediaPhysAddress: write supported
+ipNetToMediaNetAddress: write supported
+ipNetToMediaType: write supported, setting with value 2, deletes the row.
+
+Creation of row:
+--------------------
+snmpset request for non existent OID with ipNetToMediaPhysAddress varbind
+creates a row.
+
+snmpset with create option is not supported, as row creation requires 
+ipNetToMediaPhysAddress in a request 
+request.
+
+Example to create a row:
+-----------------------
+Consider there is no entry for 10.0.0.32
+
+snmpset localhost private ip.ipNetToMediaTable.ipNetToMediaEntry.ipNetToMediaPhysAddress.2.10.0.0.32 x efcd12130103
+
+If ipNetToMediaIfIndex is valid then creates row with:
+ipNetToMediaIfIndex = 2
+ipNetToMediaPhysAddress = ef:cd:12:12:01:03
+ipNetToMediaNetAddress = 10.0.0.32
+ipNetToMediaType = 4
+
+TCP:
+---
+tcpConnState of tcpConnTable is writable and the only value which may
+be set by a management station is deleteTCB(12)
+
+
+
+***************************************************************************
+*
+* Acknowledgements
+*
+***************************************************************************
+
+These people are known to have contributed to one or more of
+the Win32 platform ports.  If you have, and your name is not here,
+please accept our apologies, and tell us so we can add your name.
+
+David Perkins, Joe Marzot, Wes Hardaker, Niels Baggesen, Dave Shield,
+Robert Story, Suvrit Sra, Mike Slifcak.
+
+A very special thank you goes to Latha Prabhu who contributed the complete
+MIB-II support, including write support. This has put the Windows port
+in the top support class for net-snmp.
diff -Naur tomato/release/src/router/snmp/sedscript.in tomato121/release/src/router/snmp/sedscript.in
--- tomato/release/src/router/snmp/sedscript.in	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/sedscript.in	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,94 @@
+#include <net-snmp/net-snmp-config.h>
+#include <agent/mibgroup/mibdefs.h>
+
+s/EREMOVEMEXTENSIBLEDOTMIB/UCDAVIS_DOT_MIB/g
+
+s/PREMOVEMEROCMIBNUM/PROCMIBNUM/g
+s/SREMOVEMEHELLMIBNUM/SHELLMIBNUM/g
+s/MREMOVEMEEMMIBNUM/MEMMIBNUM/g
+s/DREMOVEMEISKMIBNUM/DISKMIBNUM/g
+s/LREMOVEMEOADAVEMIBNUM/LOADAVEMIBNUM/g
+s/VREMOVEMEERSIONMIBNUM/VERSIONMIBNUM/g
+s/EREMOVEMERRORMIBNUM/ERRORMIBNUM/g
+
+s/MREMOVEMEIBINDEX/MIBINDEX/g
+s/EREMOVEMERRORFLAG/ERRORFLAG/g
+s/EREMOVEMERRORMSG/ERRORMSG/g
+s/EREMOVEMERRORFIX/ERRORFIX/g
+s/EREMOVEMERRORNAME/ERRORNAME/g
+
+#ifdef USING_UCD_SNMP_PROC_MODULE
+#include <agent/mibgroup/ucd-snmp/proc.h>
+s/PREMOVEMEROCMIN/3/g
+s/PREMOVEMEROCMAX/4/g
+s/PREMOVEMEROCCOUNT/5/g
+#endif
+
+#ifdef USING_UCD_SNMP_EXTENSIBLE_MODULE
+#include <agent/mibgroup/ucd-snmp/extensible.h>
+s/SREMOVEMEHELLCOMMAND/SHELLCOMMAND/g
+#endif
+
+
+#ifdef USING_UCD_SNMP_MEMORY_MODULE
+#include <agent/mibgroup/ucd-snmp/memory.h>
+s/MREMOVEMEEMTOTALSWAPTXT/MEMTOTALSWAPTXT/g
+s/MREMOVEMEEMUSEDSWAPTXT/MEMUSEDSWAPTXT/g
+s/MREMOVEMEEMTOTALREALTXT/MEMTOTALREALTXT/g
+s/MREMOVEMEEMUSEDREALTXT/MEMUSEDREALTXT/g
+s/MREMOVEMEEMTOTALSWAP/MEMTOTALSWAP/g
+s/MREMOVEMEEMUSEDSWAP/MEMUSEDSWAP/g
+s/MREMOVEMEEMTOTALREAL/MEMTOTALREAL/g
+s/MREMOVEMEEMUSEDREAL/MEMUSEDREAL/g
+s/MREMOVEMEEMTOTALFREE/MEMTOTALFREE/g
+s/MREMOVEMEEMSWAPMINIMUM/MEMSWAPMINIMUM/g
+#endif
+
+#ifdef USING_UCD_SNMP_DISK_MODULE
+#include <agent/mibgroup/ucd-snmp/disk.h>
+s/DREMOVEMEEFDISKMINIMUMSPACE/DEFDISKMINIMUMSPACE/g
+s/DREMOVEMEEFDISKMINPERCENT/DEFDISKMAXIMUMPERCENT/g
+s/DREMOVEMEISKDEVICE/DISKDEVICE/g
+s/DREMOVEMEISKMINIMUM/DISKMINIMUM/g
+s/DREMOVEMEISKTOTAL/DISKTOTAL/g
+s/DREMOVEMEISKAVAIL/DISKAVAIL/g
+s/DREMOVEMEISKUSED/DISKUSED/g
+s/DREMOVEMEISKPERCENT/DISKPERCENT/g
+s/DREMOVEMEISKPERCENTNODE/DISKPERCENTNODE/g
+#endif
+
+#ifdef USING_UCD_SNMP_LOADAVE_MODULE
+#include <agent/mibgroup/ucd-snmp/loadave.h>
+s/DREMOVEMEEFMAXLOADAVE/DEFMAXLOADAVE/g
+s/LREMOVEMEOADAVE/LOADAVE/g
+s/LREMOVEMEOADMAXVAL/LOADMAXVAL/g
+#endif
+
+#ifdef USING_UCD_SNMP_VERSIONINFO_MODULE
+#include <agent/mibgroup/ucd-snmp/versioninfo.h>
+s/VREMOVEMEERDATE/VERDATE/g
+s/VREMOVEMEERCDATE/VERCDATE/g
+s/VREMOVEMEERIDENT/VERIDENT/g
+s/VREMOVEMEERCLEARCACHE/VERCLEARCACHE/g
+s/VREMOVEMEERUPDATECONFIG/VERUPDATECONFIG/g
+s/VREMOVEMEERRESTARTAGENT/VERRESTARTAGENT/g
+#endif
+
+s/EREMOVEMERRORTIMELENGTH/ERRORTIMELENGTH/g
+
+s/AREMOVEMEGENTID/AGENTID/g
+s/HREMOVEMEPUX9ID/HPUX9ID/g
+s/HREMOVEMEPUX10ID/HPUX10ID/g
+s/SREMOVEMEUNOS4ID/SUNOS4ID/g
+s/SREMOVEMEOLARISID/SOLARISID/g
+s/OREMOVEMESFID/OSFID/g
+s/UREMOVEMELTRIXID/ULTRIXID/g
+s/NREMOVEMEETBSD1ID/NETBSD1ID/g
+s/FREMOVEMEREEBSDID/FREEBSDID/g
+s/IREMOVEMERIXID/IRIXID/g
+s/LREMOVEMEINUXID/LINUXID/g
+s/BREMOVEMESDIID/BSDIID/g
+s/UREMOVEMENKNOWNID/UNKNOWNID/g
+
+s#PREMOVEMESCMD#PSCMD#g
+s/VERSIONINFO/5.0.9/g
diff -Naur tomato/release/src/router/snmp/snmpd.conf tomato121/release/src/router/snmp/snmpd.conf
--- tomato/release/src/router/snmp/snmpd.conf	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/snmpd.conf	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,111 @@
+###########################################################################
+#
+# snmpd.conf
+#
+#   - created by the snmpconf configuration program
+#
+###########################################################################
+# SECTION: Access Control Setup
+#
+#   This section defines who is allowed to talk to your running
+#   snmp agent.
+
+# rwuser: a SNMPv3 read-write user
+#   arguments:  user [noauth|auth|priv] [restriction_oid]
+
+rwuser  nikki  
+
+# rouser: a SNMPv3 read-only user
+#   arguments:  user [noauth|auth|priv] [restriction_oid]
+
+rouser  nikki  
+
+# rocommunity: a SNMPv1/SNMPv2c read-only access community name
+#   arguments:  community [default|hostname|network/bits] [oid]
+
+rocommunity  public  
+
+
+
+
+
+
+###########################################################################
+# SECTION: Monitor Various Aspects of the Running Host
+#
+#   The following check up on various aspects of a host.
+
+# proc: Check for processes that should be running.
+#     proc NAME [MAX=0] [MIN=0]
+#   
+#     NAME:  the name of the process to check for.  It must match
+#            exactly (ie, http will not find httpd processes).
+#     MAX:   the maximum number allowed to be running.  Defaults to 0.
+#     MIN:   the minimum number to be running.  Defaults to 0.
+#   
+#   The results are reported in the prTable section of the UCD-SNMP-MIB tree
+#   Special Case:  When the min and max numbers are both 0, it assumes
+#   you want a max of infinity and a min of 1.
+
+proc    0
+
+
+
+
+
+
+###########################################################################
+# SECTION: Trap Destinations
+#
+#   Here we define who the agent will send traps to.
+
+# informsink: A SNMPv2c inform (acknowledged trap) receiver
+#   arguments: host [community] [portnum]
+
+informsink  fekda traps 160
+
+# trapcommunity: Default trap sink community to use
+#   arguments: community-string
+
+trapcommunity  traps
+
+# authtrapenable: Should we send traps when authentication failures occur
+#   arguments: 1 | 2   (1 = yes, 2 = no)
+
+authtrapenable  1
+
+
+
+###########################################################################
+# SECTION: System Information Setup
+#
+#   This section defines some of the information reported in
+#   the "system" mib group in the mibII tree.
+
+# syslocation: The [typically physical] location of the system.
+#   Note that setting this value here means that when trying to
+#   perform an snmp SET operation to the sysLocation.0 variable will make
+#   the agent return the "notWritable" error code.  IE, including
+#   this token in the snmpd.conf file will disable write access to
+#   the variable.
+#   arguments:  location_string
+
+syslocation  "Moscow, Russia"
+
+# syscontact: The contact information for the administrator
+#   Note that setting this value here means that when trying to
+#   perform an snmp SET operation to the sysContact.0 variable will make
+#   the agent return the "notWritable" error code.  IE, including
+#   this token in the snmpd.conf file will disable write access to
+#   the variable.
+#   arguments:  contact_string
+
+syscontact  Unknown
+
+# sysservices: The proper value for the sysServices object.
+#   arguments:  sysservices_number
+
+sysservices 15
+
+
+
diff -Naur tomato/release/src/router/snmp/snmplib/asn1.c tomato121/release/src/router/snmp/snmplib/asn1.c
--- tomato/release/src/router/snmp/snmplib/asn1.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/snmplib/asn1.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,3040 @@
+/*
+ * Abstract Syntax Notation One, ASN.1
+ * As defined in ISO/IS 8824 and ISO/IS 8825
+ * This implements a subset of the above International Standards that
+ * is sufficient to implement SNMP.
+ *
+ * Encodes abstract data types into a machine independent stream of bytes.
+ *
+ */
+/**********************************************************************
+	Copyright 1988, 1989, 1991, 1992 by Carnegie Mellon University
+
+                      All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its 
+documentation for any purpose and without fee is hereby granted, 
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in 
+supporting documentation, and that the name of CMU not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.  
+
+CMU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+CMU BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+******************************************************************/
+#include <net-snmp/net-snmp-config.h>
+
+#ifdef KINETICS
+#include "gw.h"
+#endif
+
+#if HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+
+#include <sys/types.h>
+#include <stdio.h>
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#if HAVE_WINSOCK_H
+#include <winsock.h>
+#endif
+#if HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+
+#ifdef vms
+#include <in.h>
+#endif
+
+#if HAVE_DMALLOC_H
+#include <dmalloc.h>
+#endif
+
+#include <net-snmp/output_api.h>
+#include <net-snmp/utilities.h>
+
+#include <net-snmp/library/asn1.h>
+#include <net-snmp/library/int64.h>
+#include <net-snmp/library/mib.h>
+
+#ifndef NULL
+#define NULL	0
+#endif
+
+#include <net-snmp/library/snmp_api.h>
+
+static
+    void
+_asn_size_err(const char *str, size_t wrongsize, size_t rightsize)
+{
+    char            ebuf[128];
+
+    snprintf(ebuf, sizeof(ebuf),
+            "%s size %d: s/b %d", str, wrongsize, rightsize);
+    ebuf[ sizeof(ebuf)-1 ] = 0;
+    ERROR_MSG(ebuf);
+}
+
+static
+    void
+_asn_length_err(const char *str, size_t wrongsize, size_t rightsize)
+{
+    char            ebuf[128];
+
+    snprintf(ebuf, sizeof(ebuf),
+            "%s length %d too large: exceeds %d", str, wrongsize,
+            rightsize);
+    ebuf[ sizeof(ebuf)-1 ] = 0;
+    ERROR_MSG(ebuf);
+}
+
+/*
+ * call after asn_parse_length to verify result.
+ */
+static
+    int
+_asn_parse_length_check(const char *str,
+                        u_char * bufp, u_char * data,
+                        u_long plen, size_t dlen)
+{
+    char            ebuf[128];
+    size_t          header_len;
+
+    if (bufp == NULL) {
+        /*
+         * error message is set 
+         */
+        return 1;
+    }
+    header_len = bufp - data;
+    if (plen > 0x7fffffff || header_len > 0x7fffffff ||
+        ((size_t) plen + header_len) > dlen) {
+        snprintf(ebuf, sizeof(ebuf),
+                "%s: message overflow: %d len + %d delta > %d len",
+                str, (int) plen, (int) header_len, (int) dlen);
+        ebuf[ sizeof(ebuf)-1 ] = 0;
+        ERROR_MSG(ebuf);
+        return 1;
+    }
+    return 0;
+}
+
+/*
+ * call after asn_build_header to verify result.
+ */
+static
+    int
+_asn_build_header_check(const char *str, u_char * data,
+                        size_t datalen, size_t typedlen)
+{
+    char            ebuf[128];
+
+    if (data == NULL) {
+        /*
+         * error message is set 
+         */
+        return 1;
+    }
+    if (datalen < typedlen) {
+        snprintf(ebuf, sizeof(ebuf),
+                "%s: bad header, length too short: %d < %d", str,
+                datalen, typedlen);
+        ebuf[ sizeof(ebuf)-1 ] = 0;
+        ERROR_MSG(ebuf);
+        return 1;
+    }
+    return 0;
+}
+
+static
+    int
+_asn_realloc_build_header_check(const char *str,
+                                u_char ** pkt, size_t * pkt_len,
+                                size_t typedlen)
+{
+    char            ebuf[128];
+
+    if (pkt == NULL || *pkt == NULL) {
+        /*
+         * Error message is set.  
+         */
+        return 1;
+    }
+
+    if (*pkt_len < typedlen) {
+        snprintf(ebuf, sizeof(ebuf),
+                "%s: bad header, length too short: %d < %d", str,
+                *pkt_len, typedlen);
+        ebuf[ sizeof(ebuf)-1 ] = 0;
+        ERROR_MSG(ebuf);
+        return 1;
+    }
+    return 0;
+}
+
+/*
+ * checks the incoming packet for validity and returns its size or 0 
+ */
+int
+asn_check_packet(u_char * pkt, size_t len)
+{
+    u_long          asn_length;
+
+    if (len < 2)
+        return 0;               /* always too short */
+
+    if (*pkt != (u_char) (ASN_SEQUENCE | ASN_CONSTRUCTOR))
+        return -1;              /* wrong type */
+
+    if (*(pkt + 1) & 0x80) {
+        /*
+         * long length 
+         */
+        if ((int) len < (int) (*(pkt + 1) & ~0x80) + 2)
+            return 0;           /* still to short, incomplete length */
+        asn_parse_length(pkt + 1, &asn_length);
+        return (asn_length + 2 + (*(pkt + 1) & ~0x80));
+    } else {
+        /*
+         * short length 
+         */
+        return (*(pkt + 1) + 2);
+    }
+}
+
+static
+    int
+_asn_bitstring_check(const char *str, size_t asn_length, u_char datum)
+{
+    char            ebuf[128];
+
+    if (asn_length < 1) {
+        snprintf(ebuf, sizeof(ebuf),
+                "%s: length %d too small", str, (int) asn_length);
+        ebuf[ sizeof(ebuf)-1 ] = 0;
+        ERROR_MSG(ebuf);
+        return 1;
+    }
+    /*
+     * if (datum > 7){
+     * sprintf(ebuf,"%s: datum %d >7: too large", str, (int)(datum));
+     * ERROR_MSG(ebuf);
+     * return 1;
+     * }
+     */
+    return 0;
+}
+
+/*
+ * asn_parse_int - pulls a long out of an int type.
+ *  On entry, datalength is input as the number of valid bytes following
+ *   "data".  On exit, it is returned as the number of valid bytes
+ *   following the end of this object.
+ *
+ *  Returns a pointer to the first byte past the end
+ *   of this object (i.e. the start of the next object).
+ *  Returns NULL on any error.
+ 
+ u_char * asn_parse_int(
+ u_char     *data         IN - pointer to start of object
+ int        *datalength   IN/OUT - number of valid bytes left in buffer
+ u_char     *type         OUT - asn type of object
+ long       *intp         IN/OUT - pointer to start of output buffer
+ int         intsize      IN - size of output buffer
+ */
+
+u_char         *
+asn_parse_int(u_char * data,
+              size_t * datalength,
+              u_char * type, long *intp, size_t intsize)
+{
+    /*
+     * ASN.1 integer ::= 0x02 asnlength byte {byte}*
+     */
+    static const char *errpre = "parse int";
+    register u_char *bufp = data;
+    u_long          asn_length;
+    register long   value = 0;
+
+    if (intsize != sizeof(long)) {
+        _asn_size_err(errpre, intsize, sizeof(long));
+        return NULL;
+    }
+    *type = *bufp++;
+    bufp = asn_parse_length(bufp, &asn_length);
+    if (_asn_parse_length_check
+        (errpre, bufp, data, asn_length, *datalength))
+        return NULL;
+
+    if ((size_t) asn_length > intsize) {
+        _asn_length_err(errpre, (size_t) asn_length, intsize);
+        return NULL;
+    }
+
+    *datalength -= (int) asn_length + (bufp - data);
+    if (*bufp & 0x80)
+        value = -1;             /* integer is negative */
+
+    DEBUGDUMPSETUP("recv", data, bufp - data + asn_length);
+
+    while (asn_length--)
+        value = (value << 8) | *bufp++;
+
+    DEBUGMSG(("dumpv_recv", "  Integer:\t%ld (0x%.2X)\n", value, value));
+
+    *intp = value;
+    return bufp;
+}
+
+
+/*
+ * asn_parse_unsigned_int - pulls an unsigned long out of an ASN int type.
+ *  On entry, datalength is input as the number of valid bytes following
+ *   "data".  On exit, it is returned as the number of valid bytes
+ *   following the end of this object.
+ *
+ *  Returns a pointer to the first byte past the end
+ *   of this object (i.e. the start of the next object).
+ *  Returns NULL on any error.
+ 
+ u_char * asn_parse_unsigned_int(
+ u_char     *data         IN - pointer to start of object
+ int        *datalength   IN/OUT - number of valid bytes left in buffer
+ u_char     *type         OUT - asn type of object
+ u_long     *intp         IN/OUT - pointer to start of output buffer
+ int         intsize      IN - size of output buffer
+ */
+u_char         *
+asn_parse_unsigned_int(u_char * data,
+                       size_t * datalength,
+                       u_char * type, u_long * intp, size_t intsize)
+{
+    /*
+     * ASN.1 integer ::= 0x02 asnlength byte {byte}*
+     */
+    static const char *errpre = "parse uint";
+    register u_char *bufp = data;
+    u_long          asn_length;
+    register u_long value = 0;
+
+    if (intsize != sizeof(long)) {
+        _asn_size_err(errpre, intsize, sizeof(long));
+        return NULL;
+    }
+    *type = *bufp++;
+    bufp = asn_parse_length(bufp, &asn_length);
+    if (_asn_parse_length_check
+        (errpre, bufp, data, asn_length, *datalength))
+        return NULL;
+
+    if (((int) asn_length > (intsize + 1)) ||
+        (((int) asn_length == intsize + 1) && *bufp != 0x00)) {
+        _asn_length_err(errpre, (size_t) asn_length, intsize);
+        return NULL;
+    }
+    *datalength -= (int) asn_length + (bufp - data);
+    if (*bufp & 0x80)
+        value = ~value;         /* integer is negative */
+
+    DEBUGDUMPSETUP("recv", data, bufp - data + asn_length);
+
+    while (asn_length--)
+        value = (value << 8) | *bufp++;
+
+    DEBUGMSG(("dumpv_recv", "  UInteger:\t%ld (0x%.2X)\n", value, value));
+
+    *intp = value;
+    return bufp;
+}
+
+
+/*
+ * asn_build_int - builds an ASN object containing an integer.
+ *  On entry, datalength is input as the number of valid bytes following
+ *   "data".  On exit, it is returned as the number of valid bytes
+ *   following the end of this object.
+ *
+ *  Returns a pointer to the first byte past the end
+ *   of this object (i.e. the start of the next object).
+ *  Returns NULL on any error.
+ 
+ u_char * asn_build_int(
+ u_char     *data         IN - pointer to start of output buffer
+ int        *datalength   IN/OUT - number of valid bytes left in buffer
+ int         type         IN  - asn type of object
+ long       *intp         IN - pointer to start of long integer
+ int         intsize      IN - size of input buffer
+ */
+u_char         *
+asn_build_int(u_char * data,
+              size_t * datalength, u_char type, long *intp, size_t intsize)
+{
+    /*
+     * ASN.1 integer ::= 0x02 asnlength byte {byte}*
+     */
+    static const char *errpre = "build int";
+    register long   integer;
+    register u_long mask;
+#ifndef SNMP_NO_DEBUGGING
+    u_char         *initdatap = data;
+#endif
+
+    if (intsize != sizeof(long)) {
+        _asn_size_err(errpre, intsize, sizeof(long));
+        return NULL;
+    }
+    integer = *intp;
+    /*
+     * Truncate "unnecessary" bytes off of the most significant end of this
+     * 2's complement integer.  There should be no sequence of 9
+     * consecutive 1's or 0's at the most significant end of the
+     * integer.
+     */
+    mask = ((u_long) 0x1FF) << ((8 * (sizeof(long) - 1)) - 1);
+    /*
+     * mask is 0xFF800000 on a big-endian machine 
+     */
+    while ((((integer & mask) == 0) || ((integer & mask) == mask))
+           && intsize > 1) {
+        intsize--;
+        integer <<= 8;
+    }
+    data = asn_build_header(data, datalength, type, intsize);
+    if (_asn_build_header_check(errpre, data, *datalength, intsize))
+        return NULL;
+
+    *datalength -= intsize;
+    mask = ((u_long) 0xFF) << (8 * (sizeof(long) - 1));
+    /*
+     * mask is 0xFF000000 on a big-endian machine 
+     */
+    while (intsize--) {
+        *data++ = (u_char) ((integer & mask) >> (8 * (sizeof(long) - 1)));
+        integer <<= 8;
+    }
+    DEBUGDUMPSETUP("send", initdatap, data - initdatap);
+    DEBUGMSG(("dumpv_send", "  Integer:\t%ld (0x%.2X)\n", *intp, *intp));
+    return data;
+}
+
+
+/*
+ * asn_build_unsigned_int - builds an ASN object containing an integer.
+ *  On entry, datalength is input as the number of valid bytes following
+ *   "data".  On exit, it is returned as the number of valid bytes
+ *   following the end of this object.
+ *
+ *  Returns a pointer to the first byte past the end
+ *   of this object (i.e. the start of the next object).
+ *  Returns NULL on any error.
+ 
+ u_char * asn_build_unsigned_int(
+ u_char     *data         IN - pointer to start of output buffer
+ int        *datalength   IN/OUT - number of valid bytes left in buffer
+ u_char      type         IN  - asn type of object
+ u_long     *intp         IN - pointer to start of long integer
+ int         intsize      IN - size of input buffer
+ */
+u_char         *
+asn_build_unsigned_int(u_char * data,
+                       size_t * datalength,
+                       u_char type, u_long * intp, size_t intsize)
+{
+    /*
+     * ASN.1 integer ::= 0x02 asnlength byte {byte}*
+     */
+    static const char *errpre = "build uint";
+    register u_long integer;
+    register u_long mask;
+    int             add_null_byte = 0;
+#ifndef SNMP_NO_DEBUGGING
+    u_char         *initdatap = data;
+#endif
+
+    if (intsize != sizeof(long)) {
+        _asn_size_err(errpre, intsize, sizeof(long));
+        return NULL;
+    }
+    integer = *intp;
+    mask = ((u_long) 0xFF) << (8 * (sizeof(long) - 1));
+    /*
+     * mask is 0xFF000000 on a big-endian machine 
+     */
+    if ((u_char) ((integer & mask) >> (8 * (sizeof(long) - 1))) & 0x80) {
+        /*
+         * if MSB is set 
+         */
+        add_null_byte = 1;
+        intsize++;
+    } else {
+        /*
+         * Truncate "unnecessary" bytes off of the most significant end of this 2's complement integer.
+         * There should be no sequence of 9 consecutive 1's or 0's at the most significant end of the
+         * integer.
+         */
+        mask = ((u_long) 0x1FF) << ((8 * (sizeof(long) - 1)) - 1);
+        /*
+         * mask is 0xFF800000 on a big-endian machine 
+         */
+        while ((((integer & mask) == 0) || ((integer & mask) == mask))
+               && intsize > 1) {
+            intsize--;
+            integer <<= 8;
+        }
+    }
+    data = asn_build_header(data, datalength, type, intsize);
+    if (_asn_build_header_check(errpre, data, *datalength, intsize))
+        return NULL;
+
+    *datalength -= intsize;
+    if (add_null_byte == 1) {
+        *data++ = '\0';
+        intsize--;
+    }
+    mask = ((u_long) 0xFF) << (8 * (sizeof(long) - 1));
+    /*
+     * mask is 0xFF000000 on a big-endian machine 
+     */
+    while (intsize--) {
+        *data++ = (u_char) ((integer & mask) >> (8 * (sizeof(long) - 1)));
+        integer <<= 8;
+    }
+    DEBUGDUMPSETUP("send", initdatap, data - initdatap);
+    DEBUGMSG(("dumpv_send", "  UInteger:\t%ld (0x%.2X)\n", *intp, *intp));
+    return data;
+}
+
+
+/*
+ * asn_parse_string - pulls an octet string out of an ASN octet string type.
+ *  On entry, datalength is input as the number of valid bytes following
+ *   "data".  On exit, it is returned as the number of valid bytes
+ *   following the beginning of the next object.
+ *
+ *  "string" is filled with the octet string.
+ *
+ *  Returns a pointer to the first byte past the end
+ *   of this object (i.e. the start of the next object).
+ *  Returns NULL on any error.
+ *
+ * u_char * asn_parse_string(
+ *     u_char     *data         IN - pointer to start of object
+ *     int        *datalength   IN/OUT - number of valid bytes left in buffer
+ *     u_char     *type         OUT - asn type of object
+ *     u_char     *string       IN/OUT - pointer to start of output buffer
+ *     int        *strlength    IN/OUT - size of output buffer
+ *
+ *
+ * ASN.1 octet string   ::=      primstring | cmpdstring
+ * primstring           ::= 0x04 asnlength byte {byte}*
+ * cmpdstring           ::= 0x24 asnlength string {string}*
+ */
+u_char         *
+asn_parse_string(u_char * data,
+                 size_t * datalength,
+                 u_char * type, u_char * string, size_t * strlength)
+{
+    static const char *errpre = "parse string";
+    u_char         *bufp = data;
+    u_long          asn_length;
+
+    *type = *bufp++;
+    bufp = asn_parse_length(bufp, &asn_length);
+    if (_asn_parse_length_check
+        (errpre, bufp, data, asn_length, *datalength)) {
+        return NULL;
+    }
+
+    if ((int) asn_length > *strlength) {
+        _asn_length_err(errpre, (size_t) asn_length, *strlength);
+        return NULL;
+    }
+
+    DEBUGDUMPSETUP("recv", data, bufp - data + asn_length);
+
+    memmove(string, bufp, asn_length);
+    if (*strlength > (int) asn_length)
+        string[asn_length] = 0;
+    *strlength = (int) asn_length;
+    *datalength -= (int) asn_length + (bufp - data);
+
+    DEBUGIF("dumpv_recv") {
+        u_char         *buf = (u_char *) malloc(1 + asn_length);
+        size_t          l = (buf != NULL) ? (1 + asn_length) : 0, ol = 0;
+
+        if (sprint_realloc_asciistring
+            (&buf, &l, &ol, 1, string, asn_length)) {
+            DEBUGMSG(("dumpv_recv", "  String:\t%s\n", buf));
+        } else {
+            if (buf == NULL) {
+                DEBUGMSG(("dumpv_recv", "  String:\t[TRUNCATED]\n"));
+            } else {
+                DEBUGMSG(("dumpv_recv", "  String:\t%s [TRUNCATED]\n",
+                          buf));
+            }
+        }
+        if (buf != NULL) {
+            free(buf);
+        }
+    }
+
+    return bufp + asn_length;
+}
+
+
+/*
+ * asn_build_string - Builds an ASN octet string object containing the input string.
+ *  On entry, datalength is input as the number of valid bytes following
+ *   "data".  On exit, it is returned as the number of valid bytes
+ *   following the beginning of the next object.
+ *
+ *  Returns a pointer to the first byte past the end
+ *   of this object (i.e. the start of the next object).
+ *  Returns NULL on any error.
+ 
+ u_char * asn_build_string(
+ u_char     *data         IN - pointer to start of object
+ int        *datalength   IN/OUT - number of valid bytes left in buffer
+ u_char      type         IN - asn type of object
+ u_char     *string       IN - pointer to start of input buffer
+ int         strlength    IN - size of input buffer
+ */
+u_char         *
+asn_build_string(u_char * data,
+                 size_t * datalength,
+                 u_char type, const u_char * string, size_t strlength)
+{
+    /*
+     * ASN.1 octet string ::= primstring | cmpdstring
+     * primstring ::= 0x04 asnlength byte {byte}*
+     * cmpdstring ::= 0x24 asnlength string {string}*
+     * This code will never send a compound string.
+     */
+#ifndef SNMP_NO_DEBUGGING
+    u_char         *initdatap = data;
+#endif
+    data = asn_build_header(data, datalength, type, strlength);
+    if (_asn_build_header_check
+        ("build string", data, *datalength, strlength))
+        return NULL;
+
+    if (strlength) {
+        if (string == NULL) {
+            memset(data, 0, strlength);
+        } else {
+            memmove(data, string, strlength);
+        }
+    }
+    *datalength -= strlength;
+    DEBUGDUMPSETUP("send", initdatap, data - initdatap + strlength);
+    DEBUGIF("dumpv_send") {
+        u_char         *buf = (u_char *) malloc(1 + strlength);
+        size_t          l = (buf != NULL) ? (1 + strlength) : 0, ol = 0;
+
+        if (sprint_realloc_asciistring
+            (&buf, &l, &ol, 1, string, strlength)) {
+            DEBUGMSG(("dumpv_send", "  String:\t%s\n", buf));
+        } else {
+            if (buf == NULL) {
+                DEBUGMSG(("dumpv_send", "  String:\t[TRUNCATED]\n"));
+            } else {
+                DEBUGMSG(("dumpv_send", "  String:\t%s [TRUNCATED]\n",
+                          buf));
+            }
+        }
+        if (buf != NULL) {
+            free(buf);
+        }
+    }
+    return data + strlength;
+}
+
+
+
+/*
+ * asn_parse_header - interprets the ID and length of the current object.
+ *  On entry, datalength is input as the number of valid bytes following
+ *   "data".  On exit, it is returned as the number of valid bytes
+ *   in this object following the id and length.
+ *
+ *  Returns a pointer to the first byte of the contents of this object.
+ *  Returns NULL on any error.
+ 
+ u_char * asn_parse_header(
+ u_char     *data         IN - pointer to start of object
+ int        *datalength   IN/OUT - number of valid bytes left in buffer
+ u_char     *type         OUT - asn type of object
+ */
+u_char         *
+asn_parse_header(u_char * data, size_t * datalength, u_char * type)
+{
+    register u_char *bufp;
+    u_long          asn_length;
+
+    if (!data || !datalength || !type) {
+        ERROR_MSG("parse header: NULL pointer");
+        return NULL;
+    }
+    bufp = data;
+    /*
+     * this only works on data types < 30, i.e. no extension octets 
+     */
+    if (IS_EXTENSION_ID(*bufp)) {
+        ERROR_MSG("can't process ID >= 30");
+        return NULL;
+    }
+    *type = *bufp;
+    bufp = asn_parse_length(bufp + 1, &asn_length);
+
+    if (_asn_parse_length_check
+        ("parse header", bufp, data, asn_length, *datalength))
+        return NULL;
+
+#ifdef DUMP_PRINT_HEADERS
+    DEBUGDUMPSETUP("recv", data, (bufp - data));
+    DEBUGMSG(("dumpv_recv", "  Header: 0x%.2X, len = %d (0x%X)\n", *data,
+              asn_length, asn_length));
+#else
+    /*
+     * DEBUGMSGHEXTLI(("recv",data,(bufp-data)));
+     * DEBUGMSG(("dumpH_recv","\n"));
+     */
+#endif
+
+#ifdef OPAQUE_SPECIAL_TYPES
+
+    if ((*type == ASN_OPAQUE) && (*bufp == ASN_OPAQUE_TAG1)) {
+
+        /*
+         * check if 64-but counter 
+         */
+        switch (*(bufp + 1)) {
+        case ASN_OPAQUE_COUNTER64:
+        case ASN_OPAQUE_U64:
+        case ASN_OPAQUE_FLOAT:
+        case ASN_OPAQUE_DOUBLE:
+        case ASN_OPAQUE_I64:
+            *type = *(bufp + 1);
+            break;
+
+        default:
+            /*
+             * just an Opaque 
+             */
+            *datalength = (int) asn_length;
+            return bufp;
+        }
+        /*
+         * value is encoded as special format 
+         */
+        bufp = asn_parse_length(bufp + 2, &asn_length);
+        if (_asn_parse_length_check("parse opaque header", bufp, data,
+                                    asn_length, *datalength))
+            return NULL;
+    }
+#endif                          /* OPAQUE_SPECIAL_TYPES */
+
+    *datalength = (int) asn_length;
+
+    return bufp;
+}
+
+/*
+ * same as asn_parse_header with test for expected type.
+ */
+u_char         *
+asn_parse_sequence(u_char * data, size_t * datalength, u_char * type, u_char expected_type,     /* must be this type */
+                   const char *estr)
+{                               /* error message prefix */
+    data = asn_parse_header(data, datalength, type);
+    if (data && (*type != expected_type)) {
+        char            ebuf[128];
+        snprintf(ebuf, sizeof(ebuf),
+                 "%s header type %02X: s/b %02X", estr,
+                (u_char) * type, (u_char) expected_type);
+        ebuf[ sizeof(ebuf)-1 ] = 0;
+        ERROR_MSG(ebuf);
+        return NULL;
+    }
+    return data;
+}
+
+
+
+/*
+ * asn_build_header - builds an ASN header for an object with the ID and
+ * length specified.
+ *  On entry, datalength is input as the number of valid bytes following
+ *   "data".  On exit, it is returned as the number of valid bytes
+ *   in this object following the id and length.
+ *
+ *  This only works on data types < 30, i.e. no extension octets.
+ *  The maximum length is 0xFFFF;
+ *
+ *  Returns a pointer to the first byte of the contents of this object.
+ *  Returns NULL on any error.
+ 
+ u_char * asn_build_header(
+ u_char     *data         IN - pointer to start of object
+ size_t     *datalength   IN/OUT - number of valid bytes left in buffer
+ u_char      type         IN - asn type of object
+ size_t      length       IN - length of object
+ */
+u_char         *
+asn_build_header(u_char * data,
+                 size_t * datalength, u_char type, size_t length)
+{
+    char            ebuf[128];
+
+    if (*datalength < 1) {
+        snprintf(ebuf, sizeof(ebuf),
+                "bad header length < 1 :%d, %d", *datalength,
+                length);
+        ebuf[ sizeof(ebuf)-1 ] = 0;
+        ERROR_MSG(ebuf);
+        return NULL;
+    }
+    *data++ = type;
+    (*datalength)--;
+    return asn_build_length(data, datalength, length);
+}
+
+/*
+ * asn_build_sequence - builds an ASN header for a sequence with the ID and
+ * length specified.
+ *  On entry, datalength is input as the number of valid bytes following
+ *   "data".  On exit, it is returned as the number of valid bytes
+ *   in this object following the id and length.
+ *
+ *  This only works on data types < 30, i.e. no extension octets.
+ *  The maximum length is 0xFFFF;
+ *
+ *  Returns a pointer to the first byte of the contents of this object.
+ *  Returns NULL on any error.
+ 
+ u_char * asn_build_sequence(
+ u_char     *data         IN - pointer to start of object
+ int        *datalength   IN/OUT - number of valid bytes left in buffer
+ u_char      type         IN - asn type of object
+ int         length       IN - length of object
+ */
+u_char         *
+asn_build_sequence(u_char * data,
+                   size_t * datalength, u_char type, size_t length)
+{
+    static const char *errpre = "build seq";
+    char            ebuf[128];
+
+    if (*datalength < 4) {
+        snprintf(ebuf, sizeof(ebuf),
+                "%s: length %d < 4: PUNT", errpre,
+                (int) *datalength);
+        ebuf[ sizeof(ebuf)-1 ] = 0;
+        ERROR_MSG(ebuf);
+        return NULL;
+    }
+    *datalength -= 4;
+    *data++ = type;
+    *data++ = (u_char) (0x02 | ASN_LONG_LEN);
+    *data++ = (u_char) ((length >> 8) & 0xFF);
+    *data++ = (u_char) (length & 0xFF);
+    return data;
+}
+
+/*
+ * asn_parse_length - interprets the length of the current object.
+ *  On exit, length contains the value of this length field.
+ *
+ *  Returns a pointer to the first byte after this length
+ *  field (aka: the start of the data field).
+ *  Returns NULL on any error.
+ 
+ u_char * asn_parse_length(
+ u_char     *data         IN - pointer to start of length field
+ u_long     *length       OUT - value of length field
+ */
+u_char         *
+asn_parse_length(u_char * data, u_long * length)
+{
+    static const char *errpre = "parse length";
+    char            ebuf[128];
+    register u_char lengthbyte;
+
+    if (!data || !length) {
+        ERROR_MSG("parse length: NULL pointer");
+        return NULL;
+    }
+    lengthbyte = *data;
+
+    if (lengthbyte & ASN_LONG_LEN) {
+        lengthbyte &= ~ASN_LONG_LEN;    /* turn MSb off */
+        if (lengthbyte == 0) {
+            snprintf(ebuf, sizeof(ebuf),
+                     "%s: indefinite length not supported", errpre);
+            ebuf[ sizeof(ebuf)-1 ] = 0;
+            ERROR_MSG(ebuf);
+            return NULL;
+        }
+        if (lengthbyte > sizeof(long)) {
+            snprintf(ebuf, sizeof(ebuf),
+                    "%s: data length %d > %d not supported", errpre,
+                    lengthbyte, sizeof(long));
+            ebuf[ sizeof(ebuf)-1 ] = 0;
+            ERROR_MSG(ebuf);
+            return NULL;
+        }
+        data++;
+        *length = 0;            /* protect against short lengths */
+        while (lengthbyte--) {
+            *length <<= 8;
+            *length |= *data++;
+        }
+        if ((long) *length < 0) {
+            snprintf(ebuf, sizeof(ebuf),
+                     "%s: negative data length %ld\n", errpre,
+                     (long) *length);
+            ebuf[ sizeof(ebuf)-1 ] = 0;
+            ERROR_MSG(ebuf);
+            return NULL;
+        }
+        return data;
+    } else {                    /* short asnlength */
+        *length = (long) lengthbyte;
+        return data + 1;
+    }
+}
+
+/*
+ * 
+ * u_char * asn_build_length(
+ * u_char     *data         IN - pointer to start of object
+ * int        *datalength   IN/OUT - number of valid bytes left in buffer
+ * int         length       IN - length of object
+ */
+u_char         *
+asn_build_length(u_char * data, size_t * datalength, size_t length)
+{
+    static const char *errpre = "build length";
+    char            ebuf[128];
+
+    u_char         *start_data = data;
+
+    /*
+     * no indefinite lengths sent 
+     */
+    if (length < 0x80) {
+        if (*datalength < 1) {
+            snprintf(ebuf, sizeof(ebuf),
+                    "%s: bad length < 1 :%d, %d", errpre,
+                    *datalength, length);
+            ebuf[ sizeof(ebuf)-1 ] = 0;
+            ERROR_MSG(ebuf);
+            return NULL;
+        }
+        *data++ = (u_char) length;
+    } else if (length <= 0xFF) {
+        if (*datalength < 2) {
+            snprintf(ebuf, sizeof(ebuf),
+                    "%s: bad length < 2 :%d, %d", errpre,
+                    *datalength, length);
+            ebuf[ sizeof(ebuf)-1 ] = 0;
+            ERROR_MSG(ebuf);
+            return NULL;
+        }
+        *data++ = (u_char) (0x01 | ASN_LONG_LEN);
+        *data++ = (u_char) length;
+    } else {                    /* 0xFF < length <= 0xFFFF */
+        if (*datalength < 3) {
+            snprintf(ebuf, sizeof(ebuf),
+                    "%s: bad length < 3 :%d, %d", errpre,
+                    *datalength, length);
+            ebuf[ sizeof(ebuf)-1 ] = 0;
+            ERROR_MSG(ebuf);
+            return NULL;
+        }
+        *data++ = (u_char) (0x02 | ASN_LONG_LEN);
+        *data++ = (u_char) ((length >> 8) & 0xFF);
+        *data++ = (u_char) (length & 0xFF);
+    }
+    *datalength -= (data - start_data);
+    return data;
+
+}
+
+/*
+ * asn_parse_objid - pulls an object indentifier out of an ASN object identifier type.
+ *  On entry, datalength is input as the number of valid bytes following
+ *   "data".  On exit, it is returned as the number of valid bytes
+ *   following the beginning of the next object.
+ *
+ *  "objid" is filled with the object identifier.
+ *
+ *  Returns a pointer to the first byte past the end
+ *   of this object (i.e. the start of the next object).
+ *  Returns NULL on any error.
+ 
+ u_char * asn_parse_objid(
+ u_char     *data         IN - pointer to start of object
+ int        *datalength   IN/OUT - number of valid bytes left in buffer
+ u_char     *type         OUT - asn type of object
+ oid        *objid        IN/OUT - pointer to start of output buffer
+ int        *objidlength  IN/OUT - number of sub-id's in objid
+ */
+u_char         *
+asn_parse_objid(u_char * data,
+                size_t * datalength,
+                u_char * type, oid * objid, size_t * objidlength)
+{
+    /*
+     * ASN.1 objid ::= 0x06 asnlength subidentifier {subidentifier}*
+     * subidentifier ::= {leadingbyte}* lastbyte
+     * leadingbyte ::= 1 7bitvalue
+     * lastbyte ::= 0 7bitvalue
+     */
+    register u_char *bufp = data;
+    register oid   *oidp = objid + 1;
+    register u_long subidentifier;
+    register long   length;
+    u_long          asn_length;
+
+    *type = *bufp++;
+    bufp = asn_parse_length(bufp, &asn_length);
+    if (_asn_parse_length_check("parse objid", bufp, data,
+                                asn_length, *datalength))
+        return NULL;
+
+    *datalength -= (int) asn_length + (bufp - data);
+
+    DEBUGDUMPSETUP("recv", data, bufp - data + asn_length);
+
+    /*
+     * Handle invalid object identifier encodings of the form 06 00 robustly 
+     */
+    if (asn_length == 0)
+        objid[0] = objid[1] = 0;
+
+    length = asn_length;
+    (*objidlength)--;           /* account for expansion of first byte */
+
+    while (length > 0 && (*objidlength)-- > 0) {
+        subidentifier = 0;
+        do {                    /* shift and add in low order 7 bits */
+            subidentifier =
+                (subidentifier << 7) + (*(u_char *) bufp & ~ASN_BIT8);
+            length--;
+        } while (*(u_char *) bufp++ & ASN_BIT8);        /* last byte has high bit clear */
+        /*
+         * ?? note, this test will never be true, since the largest value
+         * of subidentifier is the value of MAX_SUBID! 
+         */
+        if (subidentifier > (u_long) MAX_SUBID) {
+            ERROR_MSG("subidentifier too large");
+            return NULL;
+        }
+        *oidp++ = (oid) subidentifier;
+    }
+
+    /*
+     * The first two subidentifiers are encoded into the first component
+     * with the value (X * 40) + Y, where:
+     *  X is the value of the first subidentifier.
+     *  Y is the value of the second subidentifier.
+     */
+    subidentifier = (u_long) objid[1];
+    if (subidentifier == 0x2B) {
+        objid[0] = 1;
+        objid[1] = 3;
+    } else {
+        if (subidentifier < 40) {
+            objid[0] = 0;
+            objid[1] = subidentifier;
+        } else if (subidentifier < 80) {
+            objid[0] = 1;
+            objid[1] = subidentifier - 40;
+        } else {
+            objid[0] = 2;
+            objid[1] = subidentifier - 80;
+        }
+    }
+
+    *objidlength = (int) (oidp - objid);
+
+    DEBUGMSG(("dumpv_recv", "  ObjID: "));
+    DEBUGMSGOID(("dumpv_recv", objid, *objidlength));
+    DEBUGMSG(("dumpv_recv", "\n"));
+    return bufp;
+}
+
+/*
+ * asn_build_objid - Builds an ASN object identifier object containing the
+ * input string.
+ *  On entry, datalength is input as the number of valid bytes following
+ *   "data".  On exit, it is returned as the number of valid bytes
+ *   following the beginning of the next object.
+ *
+ *  Returns a pointer to the first byte past the end
+ *   of this object (i.e. the start of the next object).
+ *  Returns NULL on any error.
+ 
+ u_char * asn_build_objid(
+ u_char     *data         IN - pointer to start of object
+ int        *datalength   IN/OUT - number of valid bytes left in buffer
+ int        type         IN - asn type of object
+ oid        *objid        IN - pointer to start of input buffer
+ int         objidlength  IN - number of sub-id's in objid
+ */
+u_char         *
+asn_build_objid(u_char * data,
+                size_t * datalength,
+                u_char type, oid * objid, size_t objidlength)
+{
+    /*
+     * ASN.1 objid ::= 0x06 asnlength subidentifier {subidentifier}*
+     * subidentifier ::= {leadingbyte}* lastbyte
+     * leadingbyte ::= 1 7bitvalue
+     * lastbyte ::= 0 7bitvalue
+     */
+    size_t          asnlength;
+    register oid   *op = objid;
+    u_char          objid_size[MAX_OID_LEN];
+    register u_long objid_val;
+    u_long          first_objid_val;
+    register int    i;
+#ifndef SNMP_NO_DEBUGGING
+    u_char         *initdatap = data;
+#endif
+
+    /*
+     * check if there are at least 2 sub-identifiers 
+     */
+    if (objidlength == 0) {
+        /*
+         * there are not, so make OID have two with value of zero 
+         */
+        objid_val = 0;
+        objidlength = 2;
+    } else if (objid[0] > 2) {
+        ERROR_MSG("build objid: bad first subidentifier");
+        return NULL;
+    } else if (objidlength == 1) {
+        /*
+         * encode the first value 
+         */
+        objid_val = (op[0] * 40);
+        objidlength = 2;
+        op++;
+    } else {
+        /*
+         * combine the first two values 
+         */
+        if ((op[1] > 40) &&
+            (op[0] < 2)) {
+            ERROR_MSG("build objid: bad second subidentifier");
+            return NULL;
+        }
+        objid_val = (op[0] * 40) + op[1];
+        op += 2;
+    }
+    first_objid_val = objid_val;
+
+    /*
+     * ditch illegal calls now 
+     */
+    if (objidlength > MAX_OID_LEN)
+        return NULL;
+
+    /*
+     * calculate the number of bytes needed to store the encoded value 
+     */
+    for (i = 1, asnlength = 0;;) {
+        if (objid_val < (unsigned) 0x80) {
+            objid_size[i] = 1;
+            asnlength += 1;
+        } else if (objid_val < (unsigned) 0x4000) {
+            objid_size[i] = 2;
+            asnlength += 2;
+        } else if (objid_val < (unsigned) 0x200000) {
+            objid_size[i] = 3;
+            asnlength += 3;
+        } else if (objid_val < (unsigned) 0x10000000) {
+            objid_size[i] = 4;
+            asnlength += 4;
+        } else {
+            objid_size[i] = 5;
+            asnlength += 5;
+        }
+        i++;
+        if (i >= (int) objidlength)
+            break;
+        objid_val = *op++;	/* XXX - doesn't handle 2.X (X > 40) */
+    }
+
+    /*
+     * store the ASN.1 tag and length 
+     */
+    data = asn_build_header(data, datalength, type, asnlength);
+    if (_asn_build_header_check
+        ("build objid", data, *datalength, asnlength))
+        return NULL;
+
+    /*
+     * store the encoded OID value 
+     */
+    for (i = 1, objid_val = first_objid_val, op = objid + 2;
+         i < (int) objidlength; i++) {
+        if (i != 1)
+            objid_val = *op++;
+        switch (objid_size[i]) {
+        case 1:
+            *data++ = (u_char) objid_val;
+            break;
+
+        case 2:
+            *data++ = (u_char) ((objid_val >> 7) | 0x80);
+            *data++ = (u_char) (objid_val & 0x07f);
+            break;
+
+        case 3:
+            *data++ = (u_char) ((objid_val >> 14) | 0x80);
+            *data++ = (u_char) ((objid_val >> 7 & 0x7f) | 0x80);
+            *data++ = (u_char) (objid_val & 0x07f);
+            break;
+
+        case 4:
+            *data++ = (u_char) ((objid_val >> 21) | 0x80);
+            *data++ = (u_char) ((objid_val >> 14 & 0x7f) | 0x80);
+            *data++ = (u_char) ((objid_val >> 7 & 0x7f) | 0x80);
+            *data++ = (u_char) (objid_val & 0x07f);
+            break;
+
+        case 5:
+            *data++ = (u_char) ((objid_val >> 28) | 0x80);
+            *data++ = (u_char) ((objid_val >> 21 & 0x7f) | 0x80);
+            *data++ = (u_char) ((objid_val >> 14 & 0x7f) | 0x80);
+            *data++ = (u_char) ((objid_val >> 7 & 0x7f) | 0x80);
+            *data++ = (u_char) (objid_val & 0x07f);
+            break;
+        }
+    }
+
+    /*
+     * return the length and data ptr 
+     */
+    *datalength -= asnlength;
+    DEBUGDUMPSETUP("send", initdatap, data - initdatap);
+    DEBUGMSG(("dumpv_send", "  ObjID: "));
+    DEBUGMSGOID(("dumpv_send", objid, objidlength));
+    DEBUGMSG(("dumpv_send", "\n"));
+    return data;
+}
+
+/*
+ * asn_parse_null - Interprets an ASN null type.
+ *  On entry, datalength is input as the number of valid bytes following
+ *   "data".  On exit, it is returned as the number of valid bytes
+ *   following the beginning of the next object.
+ *
+ *  Returns a pointer to the first byte past the end
+ *   of this object (i.e. the start of the next object).
+ *  Returns NULL on any error.
+ 
+ u_char * asn_parse_null(
+ u_char     *data         IN - pointer to start of object
+ int        *datalength   IN/OUT - number of valid bytes left in buffer
+ u_char     *type         OUT - asn type of object
+ */
+u_char         *
+asn_parse_null(u_char * data, size_t * datalength, u_char * type)
+{
+    /*
+     * ASN.1 null ::= 0x05 0x00
+     */
+    register u_char *bufp = data;
+    u_long          asn_length;
+
+    *type = *bufp++;
+    bufp = asn_parse_length(bufp, &asn_length);
+    if (bufp == NULL) {
+        ERROR_MSG("parse null: bad length");
+        return NULL;
+    }
+    if (asn_length != 0) {
+        ERROR_MSG("parse null: malformed ASN.1 null");
+        return NULL;
+    }
+
+    *datalength -= (bufp - data);
+
+    DEBUGDUMPSETUP("recv", data, bufp - data);
+    DEBUGMSG(("dumpv_recv", "  NULL\n"));
+
+    return bufp + asn_length;
+}
+
+
+/*
+ * asn_build_null - Builds an ASN null object.
+ *  On entry, datalength is input as the number of valid bytes following
+ *   "data".  On exit, it is returned as the number of valid bytes
+ *   following the beginning of the next object.
+ *
+ *  Returns a pointer to the first byte past the end
+ *   of this object (i.e. the start of the next object).
+ *  Returns NULL on any error.
+ 
+ u_char * asn_build_null(
+ u_char     *data         IN - pointer to start of object
+ int        *datalength   IN/OUT - number of valid bytes left in buffer
+ u_char      type         IN - asn type of object
+ */
+u_char         *
+asn_build_null(u_char * data, size_t * datalength, u_char type)
+{
+    /*
+     * ASN.1 null ::= 0x05 0x00
+     */
+#ifndef SNMP_NO_DEBUGGING
+    u_char         *initdatap = data;
+#endif
+    data = asn_build_header(data, datalength, type, 0);
+    DEBUGDUMPSETUP("send", initdatap, data - initdatap);
+    DEBUGMSG(("dumpv_send", "  NULL\n"));
+    return data;
+}
+
+/*
+ * asn_parse_bitstring - pulls a bitstring out of an ASN bitstring type.
+ *  On entry, datalength is input as the number of valid bytes following
+ *   "data".  On exit, it is returned as the number of valid bytes
+ *   following the beginning of the next object.
+ *
+ *  "string" is filled with the bit string.
+ *
+ *  Returns a pointer to the first byte past the end
+ *   of this object (i.e. the start of the next object).
+ *  Returns NULL on any error.
+ 
+ u_char * asn_parse_bitstring(
+ u_char     *data         IN - pointer to start of object
+ size_t     *datalength   IN/OUT - number of valid bytes left in buffer
+ u_char     *type         OUT - asn type of object
+ u_char     *string       IN/OUT - pointer to start of output buffer
+ size_t     *strlength    IN/OUT - size of output buffer
+ */
+u_char         *
+asn_parse_bitstring(u_char * data,
+                    size_t * datalength,
+                    u_char * type, u_char * string, size_t * strlength)
+{
+    /*
+     * bitstring ::= 0x03 asnlength unused {byte}*
+     */
+    static const char *errpre = "parse bitstring";
+    register u_char *bufp = data;
+    u_long          asn_length;
+
+    *type = *bufp++;
+    bufp = asn_parse_length(bufp, &asn_length);
+    if (_asn_parse_length_check(errpre, bufp, data,
+                                asn_length, *datalength))
+        return NULL;
+
+    if ((size_t) asn_length > *strlength) {
+        _asn_length_err(errpre, (size_t) asn_length, *strlength);
+        return NULL;
+    }
+    if (_asn_bitstring_check(errpre, asn_length, *bufp))
+        return NULL;
+
+    DEBUGDUMPSETUP("recv", data, bufp - data);
+    DEBUGMSG(("dumpv_recv", "  Bitstring: "));
+    DEBUGMSGHEX(("dumpv_recv", data, asn_length));
+    DEBUGMSG(("dumpv_recv", "\n"));
+
+    memmove(string, bufp, asn_length);
+    *strlength = (int) asn_length;
+    *datalength -= (int) asn_length + (bufp - data);
+    return bufp + asn_length;
+}
+
+
+/*
+ * asn_build_bitstring - Builds an ASN bit string object containing the
+ * input string.
+ *  On entry, datalength is input as the number of valid bytes following
+ *   "data".  On exit, it is returned as the number of valid bytes
+ *   following the beginning of the next object.
+ *
+ *  Returns a pointer to the first byte past the end
+ *   of this object (i.e. the start of the next object).
+ *  Returns NULL on any error.
+ 
+ u_char * asn_build_bitstring(
+ u_char     *data         IN - pointer to start of object
+ int        *datalength   IN/OUT - number of valid bytes left in buffer
+ u_char      type         IN - asn type of object
+ u_char     *string       IN - pointer to start of input buffer
+ int         strlength    IN - size of input buffer
+ */
+u_char         *
+asn_build_bitstring(u_char * data,
+                    size_t * datalength,
+                    u_char type, u_char * string, size_t strlength)
+{
+    /*
+     * ASN.1 bit string ::= 0x03 asnlength unused {byte}*
+     */
+    static const char *errpre = "build bitstring";
+    if (_asn_bitstring_check
+        (errpre, strlength, ((string) ? *string : (u_char) 0)))
+        return NULL;
+
+    data = asn_build_header(data, datalength, type, strlength);
+    if (_asn_build_header_check(errpre, data, *datalength, strlength))
+        return NULL;
+
+    if (strlength > 0 && string)
+        memmove(data, string, strlength);
+    else if (strlength > 0 && !string) {
+        ERROR_MSG("no string passed into asn_build_bitstring\n");
+        return NULL;
+    }
+
+    *datalength -= strlength;
+    DEBUGDUMPSETUP("send", data, strlength);
+    DEBUGMSG(("dumpv_send", "  Bitstring: "));
+    DEBUGMSGHEX(("dumpv_send", data, strlength));
+    DEBUGMSG(("dumpv_send", "\n"));
+    return data + strlength;
+}
+
+/*
+ * asn_parse_unsigned_int64 - pulls a 64 bit unsigned long out of an ASN int
+ * type.
+ *  On entry, datalength is input as the number of valid bytes following
+ *   "data".  On exit, it is returned as the number of valid bytes
+ *   following the end of this object.
+ *
+ *  Returns a pointer to the first byte past the end
+ *   of this object (i.e. the start of the next object).
+ *  Returns NULL on any error.
+ 
+ u_char * asn_parse_unsigned_int64(
+ u_char     *data         IN - pointer to start of object
+ int        *datalength   IN/OUT - number of valid bytes left in buffer
+ u_char     *type         OUT - asn type of object
+ struct counter64 *cp     IN/OUT - pointer to counter struct
+ int         countersize  IN - size of output buffer
+ */
+u_char         *
+asn_parse_unsigned_int64(u_char * data,
+                         size_t * datalength,
+                         u_char * type,
+                         struct counter64 * cp, size_t countersize)
+{
+    /*
+     * ASN.1 integer ::= 0x02 asnlength byte {byte}*
+     */
+    static const char *errpre = "parse uint64";
+    const int       uint64sizelimit = (4 * 2) + 1;
+    register u_char *bufp = data;
+    u_long          asn_length;
+    register u_long low = 0, high = 0;
+
+    if (countersize != sizeof(struct counter64)) {
+        _asn_size_err(errpre, countersize, sizeof(struct counter64));
+        return NULL;
+    }
+    *type = *bufp++;
+    bufp = asn_parse_length(bufp, &asn_length);
+    if (_asn_parse_length_check
+        (errpre, bufp, data, asn_length, *datalength))
+        return NULL;
+
+    DEBUGDUMPSETUP("recv", data, bufp - data);
+#ifdef OPAQUE_SPECIAL_TYPES
+    /*
+     * 64 bit counters as opaque 
+     */
+    if ((*type == ASN_OPAQUE) &&
+        (asn_length <= ASN_OPAQUE_COUNTER64_MX_BER_LEN) &&
+        (*bufp == ASN_OPAQUE_TAG1) &&
+        ((*(bufp + 1) == ASN_OPAQUE_COUNTER64) ||
+         (*(bufp + 1) == ASN_OPAQUE_U64))) {
+        /*
+         * change type to Counter64 or U64 
+         */
+        *type = *(bufp + 1);
+        /*
+         * value is encoded as special format 
+         */
+        bufp = asn_parse_length(bufp + 2, &asn_length);
+        if (_asn_parse_length_check("parse opaque uint64", bufp, data,
+                                    asn_length, *datalength))
+            return NULL;
+    }
+#endif                          /* OPAQUE_SPECIAL_TYPES */
+    if (((int) asn_length > uint64sizelimit) ||
+        (((int) asn_length == uint64sizelimit) && *bufp != 0x00)) {
+        _asn_length_err(errpre, (size_t) asn_length, uint64sizelimit);
+        return NULL;
+    }
+    *datalength -= (int) asn_length + (bufp - data);
+    if (*bufp & 0x80) {
+        low = ~low;             /* integer is negative */
+        high = ~high;
+    }
+
+    while (asn_length--) {
+        high = (high << 8) | ((low & 0xFF000000) >> 24);
+        low = (low << 8) | *bufp++;
+    }
+
+    cp->low = low;
+    cp->high = high;
+
+    DEBUGIF("dumpv_recv") {
+        char            i64buf[I64CHARSZ + 1];
+        printU64(i64buf, cp);
+        DEBUGMSG(("dumpv_recv", "Counter64: ", i64buf));
+    }
+
+    return bufp;
+}
+
+
+/*
+ * asn_build_unsigned_int64 - builds an ASN object containing a 64 bit integer.
+ *  On entry, datalength is input as the number of valid bytes following
+ *   "data".  On exit, it is returned as the number of valid bytes
+ *   following the end of this object.
+ *
+ *  Returns a pointer to the first byte past the end
+ *   of this object (i.e. the start of the next object).
+ *  Returns NULL on any error.
+ 
+ u_char * asn_build_unsigned_int64(
+ u_char     *data         IN - pointer to start of output buffer
+ size_t     *datalength   IN/OUT - number of valid bytes left in buffer
+ u_char      type         IN  - asn type of object
+ struct counter64 *cp     IN - pointer to counter struct
+ size_t      countersize  IN - size of input buffer
+ */
+u_char         *
+asn_build_unsigned_int64(u_char * data,
+                         size_t * datalength,
+                         u_char type,
+                         struct counter64 * cp, size_t countersize)
+{
+    /*
+     * ASN.1 integer ::= 0x02 asnlength byte {byte}*
+     */
+
+    register u_long low, high;
+    register u_long mask, mask2;
+    int             add_null_byte = 0;
+    size_t          intsize;
+#ifndef SNMP_NO_DEBUGGING
+    u_char         *initdatap = data;
+#endif
+
+    if (countersize != sizeof(struct counter64)) {
+        _asn_size_err("build uint64", countersize,
+                      sizeof(struct counter64));
+        return NULL;
+    }
+    intsize = 8;
+    low = cp->low;
+    high = cp->high;
+    mask = ((u_long) 0xFF) << (8 * (sizeof(long) - 1));
+    /*
+     * mask is 0xFF000000 on a big-endian machine 
+     */
+    if ((u_char) ((high & mask) >> (8 * (sizeof(long) - 1))) & 0x80) {
+        /*
+         * if MSB is set 
+         */
+        add_null_byte = 1;
+        intsize++;
+    } else {
+        /*
+         * Truncate "unnecessary" bytes off of the most significant end of this 2's
+         * complement integer.
+         * There should be no sequence of 9 consecutive 1's or 0's at the most
+         * significant end of the integer.
+         */
+        mask2 = ((u_long) 0x1FF) << ((8 * (sizeof(long) - 1)) - 1);
+        /*
+         * mask2 is 0xFF800000 on a big-endian machine 
+         */
+        while ((((high & mask2) == 0) || ((high & mask2) == mask2))
+               && intsize > 1) {
+            intsize--;
+            high = (high << 8)
+                | ((low & mask) >> (8 * (sizeof(long) - 1)));
+            low <<= 8;
+        }
+    }
+#ifdef OPAQUE_SPECIAL_TYPES
+    /*
+     * encode a Counter64 as an opaque (it also works in SNMPv1) 
+     */
+    /*
+     * turn into Opaque holding special tagged value 
+     */
+    if (type == ASN_OPAQUE_COUNTER64) {
+        /*
+         * put the tag and length for the Opaque wrapper 
+         */
+        data = asn_build_header(data, datalength, ASN_OPAQUE, intsize + 3);
+        if (_asn_build_header_check
+            ("build counter u64", data, *datalength, intsize + 3))
+            return NULL;
+
+        /*
+         * put the special tag and length 
+         */
+        *data++ = ASN_OPAQUE_TAG1;
+        *data++ = ASN_OPAQUE_COUNTER64;
+        *data++ = (u_char) intsize;
+        *datalength = *datalength - 3;
+    } else
+        /*
+         * Encode the Unsigned int64 in an opaque 
+         */
+        /*
+         * turn into Opaque holding special tagged value 
+         */
+    if (type == ASN_OPAQUE_U64) {
+        /*
+         * put the tag and length for the Opaque wrapper 
+         */
+        data = asn_build_header(data, datalength, ASN_OPAQUE, intsize + 3);
+        if (_asn_build_header_check
+            ("build opaque u64", data, *datalength, intsize + 3))
+            return NULL;
+
+        /*
+         * put the special tag and length 
+         */
+        *data++ = ASN_OPAQUE_TAG1;
+        *data++ = ASN_OPAQUE_U64;
+        *data++ = (u_char) intsize;
+        *datalength = *datalength - 3;
+    } else {
+#endif                          /* OPAQUE_SPECIAL_TYPES */
+        data = asn_build_header(data, datalength, type, intsize);
+        if (_asn_build_header_check
+            ("build uint64", data, *datalength, intsize))
+            return NULL;
+
+#ifdef OPAQUE_SPECIAL_TYPES
+    }
+#endif                          /* OPAQUE_SPECIAL_TYPES */
+    *datalength -= intsize;
+    if (add_null_byte == 1) {
+        *data++ = '\0';
+        intsize--;
+    }
+    while (intsize--) {
+        *data++ = (u_char) ((high & mask) >> (8 * (sizeof(long) - 1)));
+        high = (high << 8)
+            | ((low & mask) >> (8 * (sizeof(long) - 1)));
+        low <<= 8;
+
+    }
+    DEBUGDUMPSETUP("send", initdatap, data - initdatap);
+    DEBUGIF("dumpv_send") {
+        char            i64buf[I64CHARSZ + 1];
+        printU64(i64buf, cp);
+        DEBUGMSG(("dumpv_send", i64buf));
+    }
+    return data;
+}
+
+#ifdef OPAQUE_SPECIAL_TYPES
+
+/*
+ * 
+ * u_char * asn_parse_signed_int64(
+ * u_char     *data         IN - pointer to start of object
+ * int        *datalength   IN/OUT - number of valid bytes left in buffer
+ * u_char     *type         OUT - asn type of object
+ * struct counter64 *cp     IN/OUT - pointer to counter struct
+ * int         countersize  IN - size of output buffer
+ */
+
+u_char         *
+asn_parse_signed_int64(u_char * data,
+                       size_t * datalength,
+                       u_char * type,
+                       struct counter64 * cp, size_t countersize)
+{
+    static const char *errpre = "parse int64";
+    const int       int64sizelimit = (4 * 2) + 1;
+    char            ebuf[128];
+    register u_char *bufp = data;
+    u_long          asn_length;
+    register u_int  low = 0, high = 0;
+
+    if (countersize != sizeof(struct counter64)) {
+        _asn_size_err(errpre, countersize, sizeof(struct counter64));
+        return NULL;
+    }
+    *type = *bufp++;
+    bufp = asn_parse_length(bufp, &asn_length);
+    if (_asn_parse_length_check
+        (errpre, bufp, data, asn_length, *datalength))
+        return NULL;
+
+    DEBUGDUMPSETUP("recv", data, bufp - data);
+    if ((*type == ASN_OPAQUE) &&
+        (asn_length <= ASN_OPAQUE_COUNTER64_MX_BER_LEN) &&
+        (*bufp == ASN_OPAQUE_TAG1) && (*(bufp + 1) == ASN_OPAQUE_I64)) {
+        /*
+         * change type to Int64 
+         */
+        *type = *(bufp + 1);
+        /*
+         * value is encoded as special format 
+         */
+        bufp = asn_parse_length(bufp + 2, &asn_length);
+        if (_asn_parse_length_check("parse opaque int64", bufp, data,
+                                    asn_length, *datalength))
+            return NULL;
+    }
+    /*
+     * this should always have been true until snmp gets int64 PDU types 
+     */
+    else {
+        snprintf(ebuf, sizeof(ebuf),
+                "%s: wrong type: %d, len %d, buf bytes (%02X,%02X)",
+                errpre, *type, (int) asn_length, *bufp, *(bufp + 1));
+        ebuf[ sizeof(ebuf)-1 ] = 0;
+        ERROR_MSG(ebuf);
+        return NULL;
+    }
+    if (((int) asn_length > int64sizelimit) ||
+        (((int) asn_length == int64sizelimit) && *bufp != 0x00)) {
+        _asn_length_err(errpre, (size_t) asn_length, int64sizelimit);
+        return NULL;
+    }
+    *datalength -= (int) asn_length + (bufp - data);
+    if (*bufp & 0x80) {
+        low = ~low;             /* integer is negative */
+        high = ~high;
+    }
+
+    while (asn_length--) {
+        high = (high << 8) | ((low & 0xFF000000) >> 24);
+        low = (low << 8) | *bufp++;
+    }
+
+    cp->low = low;
+    cp->high = high;
+
+    DEBUGIF("dumpv_recv") {
+        char            i64buf[I64CHARSZ + 1];
+        printI64(i64buf, cp);
+        DEBUGMSG(("dumpv_recv", "Integer64: %s", i64buf));
+    }
+
+    return bufp;
+}
+
+
+/*
+ * 
+ * u_char * asn_build_signed_int64(
+ * u_char     *data         IN - pointer to start of object
+ * int        *datalength   IN/OUT - number of valid bytes left in buffer
+ * u_char      type         IN - asn type of object
+ * struct counter64 *cp     IN - pointer to counter struct
+ * int         countersize  IN - size of input buffer
+ */
+u_char         *
+asn_build_signed_int64(u_char * data,
+                       size_t * datalength,
+                       u_char type,
+                       struct counter64 * cp, size_t countersize)
+{
+    /*
+     * ASN.1 integer ::= 0x02 asnlength byte {byte}*
+     */
+
+    struct counter64 c64;
+    register u_int  mask, mask2;
+    u_long          low, high;
+    size_t          intsize;
+#ifndef SNMP_NO_DEBUGGING
+    u_char         *initdatap = data;
+#endif
+
+    if (countersize != sizeof(struct counter64)) {
+        _asn_size_err("build int64", countersize,
+                      sizeof(struct counter64));
+        return NULL;
+    }
+    intsize = 8;
+    memcpy(&c64, cp, sizeof(struct counter64)); /* we're may modify it */
+    low = c64.low;
+    high = c64.high;
+
+    /*
+     * Truncate "unnecessary" bytes off of the most significant end of this
+     * 2's complement integer.  There should be no sequence of 9
+     * consecutive 1's or 0's at the most significant end of the
+     * integer.
+     */
+    mask = ((u_int) 0xFF) << (8 * (sizeof(u_int) - 1));
+    mask2 = ((u_int) 0x1FF) << ((8 * (sizeof(u_int) - 1)) - 1);
+    /*
+     * mask is 0xFF800000 on a big-endian machine 
+     */
+    while ((((high & mask2) == 0) || ((high & mask2) == mask2))
+           && intsize > 1) {
+        intsize--;
+        high = (high << 8)
+            | ((low & mask) >> (8 * (sizeof(u_int) - 1)));
+        low <<= 8;
+    }
+    /*
+     * until a real int64 gets incorperated into SNMP, we are going to
+     * encode it as an opaque instead.  First, we build the opaque
+     * header and then the int64 tag type we use to mark it as an
+     * int64 in the opaque string. 
+     */
+    data = asn_build_header(data, datalength, ASN_OPAQUE, intsize + 3);
+    if (_asn_build_header_check
+        ("build int64", data, *datalength, intsize + 3))
+        return NULL;
+
+    *data++ = ASN_OPAQUE_TAG1;
+    *data++ = ASN_OPAQUE_I64;
+    *data++ = (u_char) intsize;
+    *datalength -= (3 + intsize);
+
+    while (intsize--) {
+        *data++ = (u_char) ((high & mask) >> (8 * (sizeof(u_int) - 1)));
+        high = (high << 8)
+            | ((low & mask) >> (8 * (sizeof(u_int) - 1)));
+        low <<= 8;
+    }
+    DEBUGDUMPSETUP("send", initdatap, data - initdatap);
+    DEBUGIF("dumpv_send") {
+        char            i64buf[I64CHARSZ + 1];
+        printU64(i64buf, cp);
+        DEBUGMSG(("dumpv_send", i64buf));
+    }
+    return data;
+}
+
+
+/*
+ * asn_parse_float - pulls a single precision floating-point out of an opaque type.
+ *
+ *  On entry, datalength is input as the number of valid bytes following
+ *   "data".  On exit, it is returned as the number of valid bytes
+ *   following the end of this object.
+ *
+ *  Returns a pointer to the first byte past the end
+ *   of this object (i.e. the start of the next object).
+ *  Returns NULL on any error.
+ 
+ u_char * asn_parse_float(
+ u_char     *data         IN - pointer to start of object
+ int        *datalength   IN/OUT - number of valid bytes left in buffer
+ u_char     *type         OUT - asn type of object
+ float      *floatp       IN/OUT - pointer to float
+ int         floatsize    IN - size of output buffer
+ */
+u_char         *
+asn_parse_float(u_char * data,
+                size_t * datalength,
+                u_char * type, float *floatp, size_t floatsize)
+{
+    register u_char *bufp = data;
+    u_long          asn_length;
+    union {
+        float           floatVal;
+        long            longVal;
+        u_char          c[sizeof(float)];
+    } fu;
+
+    if (floatsize != sizeof(float)) {
+        _asn_size_err("parse float", floatsize, sizeof(float));
+        return NULL;
+    }
+    *type = *bufp++;
+    bufp = asn_parse_length(bufp, &asn_length);
+    if (_asn_parse_length_check("parse float", bufp, data,
+                                asn_length, *datalength))
+        return NULL;
+
+    DEBUGDUMPSETUP("recv", data, bufp - data + asn_length);
+    /*
+     * the float is encoded as an opaque 
+     */
+    if ((*type == ASN_OPAQUE) &&
+        (asn_length == ASN_OPAQUE_FLOAT_BER_LEN) &&
+        (*bufp == ASN_OPAQUE_TAG1) && (*(bufp + 1) == ASN_OPAQUE_FLOAT)) {
+
+        /*
+         * value is encoded as special format 
+         */
+        bufp = asn_parse_length(bufp + 2, &asn_length);
+        if (_asn_parse_length_check("parse opaque float", bufp, data,
+                                    asn_length, *datalength))
+            return NULL;
+
+        /*
+         * change type to Float 
+         */
+        *type = ASN_OPAQUE_FLOAT;
+    }
+
+    if (asn_length != sizeof(float)) {
+        _asn_size_err("parse seq float", asn_length, sizeof(float));
+        return NULL;
+    }
+
+    *datalength -= (int) asn_length + (bufp - data);
+    memcpy(&fu.c[0], bufp, asn_length);
+
+    /*
+     * correct for endian differences 
+     */
+    fu.longVal = ntohl(fu.longVal);
+
+    *floatp = fu.floatVal;
+
+    DEBUGMSG(("dumpv_recv", "Opaque float: %f\n", *floatp));
+    return bufp;
+}
+
+/*
+ * asn_build_float - builds an ASN object containing a single precision floating-point
+ *                    number in an Opaque value.
+ *
+ *  On entry, datalength is input as the number of valid bytes following
+ *   "data".  On exit, it is returned as the number of valid bytes
+ *   following the end of this object.
+ *
+ *  Returns a pointer to the first byte past the end
+ *   of this object (i.e. the start of the next object).
+ *  Returns NULL on any error.
+ 
+ u_char * asn_build_float(
+ u_char     *data         IN - pointer to start of object
+ int        *datalength   IN/OUT - number of valid bytes left in buffer
+ u_char      type         IN - asn type of object
+ float      *floatp       IN - pointer to float
+ int         floatsize    IN - size of input buffer
+ */
+u_char         *
+asn_build_float(u_char * data,
+                size_t * datalength,
+                u_char type, float *floatp, size_t floatsize)
+{
+    union {
+        float           floatVal;
+        int             intVal;
+        u_char          c[sizeof(float)];
+    } fu;
+#ifndef SNMP_NO_DEBUGGING
+    u_char         *initdatap = data;
+#endif
+
+    if (floatsize != sizeof(float)) {
+        _asn_size_err("build float", floatsize, sizeof(float));
+        return NULL;
+    }
+    /*
+     * encode the float as an opaque 
+     */
+    /*
+     * turn into Opaque holding special tagged value 
+     */
+
+    /*
+     * put the tag and length for the Opaque wrapper 
+     */
+    data = asn_build_header(data, datalength, ASN_OPAQUE, floatsize + 3);
+    if (_asn_build_header_check
+        ("build float", data, *datalength, (floatsize + 3)))
+        return NULL;
+
+    /*
+     * put the special tag and length 
+     */
+    *data++ = ASN_OPAQUE_TAG1;
+    *data++ = ASN_OPAQUE_FLOAT;
+    *data++ = (u_char) floatsize;
+    *datalength = *datalength - 3;
+
+    fu.floatVal = *floatp;
+    /*
+     * correct for endian differences 
+     */
+    fu.intVal = htonl(fu.intVal);
+
+    *datalength -= floatsize;
+    memcpy(data, &fu.c[0], floatsize);
+
+    DEBUGDUMPSETUP("send", initdatap, data - initdatap);
+    DEBUGMSG(("dumpv_send", "Opaque float: %f\n", *floatp));
+    data += floatsize;
+    return data;
+}
+
+/*
+ * 
+ * u_char * asn_parse_double(
+ * u_char     *data         IN - pointer to start of object
+ * int        *datalength   IN/OUT - number of valid bytes left in buffer
+ * u_char     *type         OUT - asn type of object
+ * double     *doublep      IN/OUT - pointer to double
+ * int         doublesize   IN - size of output buffer
+ */
+u_char         *
+asn_parse_double(u_char * data,
+                 size_t * datalength,
+                 u_char * type, double *doublep, size_t doublesize)
+{
+    register u_char *bufp = data;
+    u_long          asn_length;
+    long            tmp;
+    union {
+        double          doubleVal;
+        int             intVal[2];
+        u_char          c[sizeof(double)];
+    } fu;
+
+
+    if (doublesize != sizeof(double)) {
+        _asn_size_err("parse double", doublesize, sizeof(double));
+        return NULL;
+    }
+    *type = *bufp++;
+    bufp = asn_parse_length(bufp, &asn_length);
+    if (_asn_parse_length_check("parse double", bufp, data,
+                                asn_length, *datalength))
+        return NULL;
+
+    DEBUGDUMPSETUP("recv", data, bufp - data + asn_length);
+    /*
+     * the double is encoded as an opaque 
+     */
+    if ((*type == ASN_OPAQUE) &&
+        (asn_length == ASN_OPAQUE_DOUBLE_BER_LEN) &&
+        (*bufp == ASN_OPAQUE_TAG1) && (*(bufp + 1) == ASN_OPAQUE_DOUBLE)) {
+
+        /*
+         * value is encoded as special format 
+         */
+        bufp = asn_parse_length(bufp + 2, &asn_length);
+        if (_asn_parse_length_check("parse opaque double", bufp, data,
+                                    asn_length, *datalength))
+            return NULL;
+
+        /*
+         * change type to Double 
+         */
+        *type = ASN_OPAQUE_DOUBLE;
+    }
+
+    if (asn_length != sizeof(double)) {
+        _asn_size_err("parse seq double", asn_length, sizeof(double));
+        return NULL;
+    }
+    *datalength -= (int) asn_length + (bufp - data);
+    memcpy(&fu.c[0], bufp, asn_length);
+
+    /*
+     * correct for endian differences 
+     */
+
+    tmp = ntohl(fu.intVal[0]);
+    fu.intVal[0] = ntohl(fu.intVal[1]);
+    fu.intVal[1] = tmp;
+
+    *doublep = fu.doubleVal;
+    DEBUGMSG(("dumpv_recv", "  Opaque Double:\t%f\n", *doublep));
+
+    return bufp;
+}
+
+/*
+ * 
+ * u_char * asn_build_double(
+ * u_char     *data         IN - pointer to start of object
+ * int        *datalength   IN/OUT - number of valid bytes left in buffer
+ * u_char      type         IN - asn type of object
+ * double     *doublep      IN - pointer to double
+ * int         doublesize   IN - size of input buffer
+ */
+u_char         *
+asn_build_double(u_char * data,
+                 size_t * datalength,
+                 u_char type, double *doublep, size_t doublesize)
+{
+    long            tmp;
+    union {
+        double          doubleVal;
+        int             intVal[2];
+        u_char          c[sizeof(double)];
+    } fu;
+#ifndef SNMP_NO_DEBUGGING
+    u_char         *initdatap = data;
+#endif
+
+    if (doublesize != sizeof(double)) {
+        _asn_size_err("build double", doublesize, sizeof(double));
+        return NULL;
+    }
+
+    /*
+     * encode the double as an opaque 
+     */
+    /*
+     * turn into Opaque holding special tagged value 
+     */
+
+    /*
+     * put the tag and length for the Opaque wrapper 
+     */
+    data = asn_build_header(data, datalength, ASN_OPAQUE, doublesize + 3);
+    if (_asn_build_header_check
+        ("build double", data, *datalength, doublesize + 3))
+        return NULL;
+
+    /*
+     * put the special tag and length 
+     */
+    *data++ = ASN_OPAQUE_TAG1;
+    *data++ = ASN_OPAQUE_DOUBLE;
+    *data++ = (u_char) doublesize;
+    *datalength = *datalength - 3;
+
+    fu.doubleVal = *doublep;
+    /*
+     * correct for endian differences 
+     */
+    tmp = htonl(fu.intVal[0]);
+    fu.intVal[0] = htonl(fu.intVal[1]);
+    fu.intVal[1] = tmp;
+    *datalength -= doublesize;
+    memcpy(data, &fu.c[0], doublesize);
+
+    data += doublesize;
+    DEBUGDUMPSETUP("send", initdatap, data - initdatap);
+    DEBUGMSG(("dumpv_send", "  Opaque double: %f", *doublep));
+    return data;
+}
+
+#endif                          /* OPAQUE_SPECIAL_TYPES */
+
+
+/*
+ * This function increases the size of the buffer pointed to by *pkt, which
+ * is initially of size *pkt_len.  Contents are preserved **AT THE TOP END OF 
+ * THE BUFFER** (hence making this function useful for reverse encoding).
+ * You can change the reallocation scheme, but you **MUST** guarantee to
+ * allocate **AT LEAST** one extra byte.  If memory cannot be reallocated,
+ * then return 0; otherwise return 1.  
+ */
+
+int
+asn_realloc(u_char ** pkt, size_t * pkt_len)
+{
+    if (pkt != NULL && pkt_len != NULL) {
+        size_t          old_pkt_len = *pkt_len;
+
+        DEBUGMSGTL(("asn_realloc", " old_pkt %08p, old_pkt_len %08x\n",
+                    *pkt, old_pkt_len));
+
+        if (snmp_realloc(pkt, pkt_len)) {
+            DEBUGMSGTL(("asn_realloc", " new_pkt %08p, new_pkt_len %08x\n",
+                        *pkt, *pkt_len));
+            DEBUGMSGTL(("asn_realloc",
+                        " memmove(%08p + %08x, %08p, %08x)\n", *pkt,
+                        (*pkt_len - old_pkt_len), *pkt, old_pkt_len));
+            memmove(*pkt + (*pkt_len - old_pkt_len), *pkt, old_pkt_len);
+            memset(*pkt, (int) ' ', *pkt_len - old_pkt_len);
+            return 1;
+        } else {
+            DEBUGMSG(("asn_realloc", " CANNOT REALLOC()\n"));
+        }
+    }
+    return 0;
+}
+
+#ifdef USE_REVERSE_ASNENCODING
+
+int
+asn_realloc_rbuild_length(u_char ** pkt, size_t * pkt_len,
+                          size_t * offset, int r, size_t length)
+{
+    static const char *errpre = "build length";
+    char            ebuf[128];
+    int             tmp_int;
+    size_t          start_offset = *offset;
+
+    if (length <= 0x7f) {
+        if (((*pkt_len - *offset) < 1)
+            && !(r && asn_realloc(pkt, pkt_len))) {
+            snprintf(ebuf, sizeof(ebuf),
+                    "%s: bad length < 1 :%d, %d", errpre,
+                    *pkt_len - *offset, length);
+            ebuf[ sizeof(ebuf)-1 ] = 0;
+            ERROR_MSG(ebuf);
+            return 0;
+        }
+        *(*pkt + *pkt_len - (++*offset)) = length;
+    } else {
+        while (length > 0xff) {
+            if (((*pkt_len - *offset) < 1)
+                && !(r && asn_realloc(pkt, pkt_len))) {
+                snprintf(ebuf, sizeof(ebuf),
+                        "%s: bad length < 1 :%d, %d", errpre,
+                        *pkt_len - *offset, length);
+                ebuf[ sizeof(ebuf)-1 ] = 0;
+                ERROR_MSG(ebuf);
+                return 0;
+            }
+            *(*pkt + *pkt_len - (++*offset)) = length & 0xff;
+            length >>= 8;
+        }
+
+        while ((*pkt_len - *offset) < 2) {
+            if (!(r && asn_realloc(pkt, pkt_len))) {
+                snprintf(ebuf, sizeof(ebuf),
+                        "%s: bad length < 1 :%d, %d", errpre,
+                        *pkt_len - *offset, length);
+                ebuf[ sizeof(ebuf)-1 ] = 0;
+                ERROR_MSG(ebuf);
+                return 0;
+            }
+        }
+
+        *(*pkt + *pkt_len - (++*offset)) = length & 0xff;
+        tmp_int = *offset - start_offset;
+        *(*pkt + *pkt_len - (++*offset)) = tmp_int | 0x80;
+    }
+
+    return 1;
+}
+
+int
+asn_realloc_rbuild_header(u_char ** pkt, size_t * pkt_len,
+                          size_t * offset, int r,
+                          u_char type, size_t length)
+{
+    char            ebuf[128];
+
+    if (asn_realloc_rbuild_length(pkt, pkt_len, offset, r, length)) {
+        if (((*pkt_len - *offset) < 1)
+            && !(r && asn_realloc(pkt, pkt_len))) {
+            snprintf(ebuf, sizeof(ebuf),
+                    "bad header length < 1 :%d, %d",
+                    *pkt_len - *offset, length);
+            ebuf[ sizeof(ebuf)-1 ] = 0;
+            ERROR_MSG(ebuf);
+            return 0;
+        }
+        *(*pkt + *pkt_len - (++*offset)) = type;
+        return 1;
+    }
+    return 0;
+}
+
+int
+asn_realloc_rbuild_int(u_char ** pkt, size_t * pkt_len,
+                       size_t * offset, int r,
+                       u_char type, long *intp, size_t intsize)
+{
+    static const char *errpre = "build int";
+    register long   integer = *intp;
+    int             testvalue = (*intp < 0) ? -1 : 0;
+    size_t          start_offset = *offset;
+
+    if (intsize != sizeof(long)) {
+        _asn_size_err(errpre, intsize, sizeof(long));
+        return 0;
+    }
+
+    if (((*pkt_len - *offset) < 1) && !(r && asn_realloc(pkt, pkt_len))) {
+        return 0;
+    }
+    *(*pkt + *pkt_len - (++*offset)) = (u_char) integer;
+    integer >>= 8;
+
+    while (integer != testvalue) {
+        if (((*pkt_len - *offset) < 1)
+            && !(r && asn_realloc(pkt, pkt_len))) {
+            return 0;
+        }
+        *(*pkt + *pkt_len - (++*offset)) = (u_char) integer;
+        integer >>= 8;
+    }
+
+    if ((*(*pkt + *pkt_len - *offset) & 0x80) != (testvalue & 0x80)) {
+        /*
+         * Make sure left most bit is representational of the rest of the bits
+         * that aren't encoded.  
+         */
+        if (((*pkt_len - *offset) < 1)
+            && !(r && asn_realloc(pkt, pkt_len))) {
+            return 0;
+        }
+        *(*pkt + *pkt_len - (++*offset)) = testvalue & 0xff;
+    }
+
+    if (asn_realloc_rbuild_header(pkt, pkt_len, offset, r, type,
+                                  (*offset - start_offset))) {
+        if (_asn_realloc_build_header_check(errpre, pkt, pkt_len,
+                                            (*offset - start_offset))) {
+            return 0;
+        } else {
+            DEBUGDUMPSETUP("send", (*pkt + *pkt_len - *offset),
+                           (*offset - start_offset));
+            DEBUGMSG(("dumpv_send", "  Integer:\t%ld (0x%.2X)\n", *intp,
+                      *intp));
+            return 1;
+        }
+    }
+
+    return 0;
+}
+
+int
+asn_realloc_rbuild_string(u_char ** pkt, size_t * pkt_len,
+                          size_t * offset, int r,
+                          u_char type,
+                          const u_char * string, size_t strlength)
+{
+    static const char *errpre = "build string";
+    size_t          start_offset = *offset;
+
+    while ((*pkt_len - *offset) < strlength) {
+        if (!(r && asn_realloc(pkt, pkt_len))) {
+            return 0;
+        }
+    }
+
+    *offset += strlength;
+    memcpy(*pkt + *pkt_len - *offset, string, strlength);
+
+    if (asn_realloc_rbuild_header
+        (pkt, pkt_len, offset, r, type, strlength)) {
+        if (_asn_realloc_build_header_check
+            (errpre, pkt, pkt_len, strlength)) {
+            return 0;
+        } else {
+            DEBUGDUMPSETUP("send", (*pkt + *pkt_len - *offset),
+                           *offset - start_offset);
+            DEBUGIF("dumpv_send") {
+                if (strlength == 0) {
+                    DEBUGMSG(("dumpv_send", "  String: [NULL]\n"));
+                } else {
+                    u_char         *buf = (u_char *) malloc(2 * strlength);
+                    size_t          l =
+                        (buf != NULL) ? (2 * strlength) : 0, ol = 0;
+
+                    if (sprint_realloc_asciistring
+                        (&buf, &l, &ol, 1, string, strlength)) {
+                        DEBUGMSG(("dumpv_send", "  String:\t%s\n", buf));
+                    } else {
+                        if (buf == NULL) {
+                            DEBUGMSG(("dumpv_send",
+                                      "  String:\t[TRUNCATED]\n"));
+                        } else {
+                            DEBUGMSG(("dumpv_send",
+                                      "  String:\t%s [TRUNCATED]\n", buf));
+                        }
+                    }
+                    if (buf != NULL) {
+                        free(buf);
+                    }
+                }
+            }
+        }
+        return 1;
+    }
+
+    return 0;
+}
+
+int
+asn_realloc_rbuild_unsigned_int(u_char ** pkt, size_t * pkt_len,
+                                size_t * offset, int r,
+                                u_char type, u_long * intp, size_t intsize)
+{
+    static const char *errpre = "build uint";
+    register u_long integer = *intp;
+    size_t          start_offset = *offset;
+
+    if (intsize != sizeof(unsigned long)) {
+        _asn_size_err(errpre, intsize, sizeof(unsigned long));
+        return 0;
+    }
+
+    if (((*pkt_len - *offset) < 1) && !(r && asn_realloc(pkt, pkt_len))) {
+        return 0;
+    }
+    *(*pkt + *pkt_len - (++*offset)) = (u_char) integer;
+    integer >>= 8;
+
+    while (integer != 0) {
+        if (((*pkt_len - *offset) < 1)
+            && !(r && asn_realloc(pkt, pkt_len))) {
+            return 0;
+        }
+        *(*pkt + *pkt_len - (++*offset)) = (u_char) integer;
+        integer >>= 8;
+    }
+
+    if ((*(*pkt + *pkt_len - *offset) & 0x80) != (0 & 0x80)) {
+        /*
+         * Make sure left most bit is representational of the rest of the bits
+         * that aren't encoded.  
+         */
+        if (((*pkt_len - *offset) < 1)
+            && !(r && asn_realloc(pkt, pkt_len))) {
+            return 0;
+        }
+        *(*pkt + *pkt_len - (++*offset)) = 0;
+    }
+
+    if (asn_realloc_rbuild_header(pkt, pkt_len, offset, r, type,
+                                  (*offset - start_offset))) {
+        if (_asn_realloc_build_header_check(errpre, pkt, pkt_len,
+                                            (*offset - start_offset))) {
+            return 0;
+        } else {
+            DEBUGDUMPSETUP("send", (*pkt + *pkt_len - *offset),
+                           (*offset - start_offset));
+            DEBUGMSG(("dumpv_send", "  UInteger:\t%lu (0x%.2X)\n", *intp,
+                      *intp));
+            return 1;
+        }
+    }
+
+    return 0;
+}
+
+int
+asn_realloc_rbuild_sequence(u_char ** pkt, size_t * pkt_len,
+                            size_t * offset, int r,
+                            u_char type, size_t length)
+{
+    return asn_realloc_rbuild_header(pkt, pkt_len, offset, r, type,
+                                     length);
+}
+
+int
+asn_realloc_rbuild_objid(u_char ** pkt, size_t * pkt_len,
+                         size_t * offset, int r,
+                         u_char type,
+                         const oid * objid, size_t objidlength)
+{
+    /*
+     * ASN.1 objid ::= 0x06 asnlength subidentifier {subidentifier}*
+     * subidentifier ::= {leadingbyte}* lastbyte
+     * leadingbyte ::= 1 7bitvalue
+     * lastbyte ::= 0 7bitvalue
+     */
+    register size_t i;
+    register oid    tmpint;
+    size_t          start_offset = *offset;
+    const char     *errpre = "build objid";
+
+    /*
+     * Check if there are at least 2 sub-identifiers.  
+     */
+    if (objidlength == 0) {
+        /*
+         * There are not, so make OID have two with value of zero.  
+         */
+        while ((*pkt_len - *offset) < 2) {
+            if (!(r && asn_realloc(pkt, pkt_len))) {
+                return 0;
+            }
+        }
+
+        *(*pkt + *pkt_len - (++*offset)) = 0;
+        *(*pkt + *pkt_len - (++*offset)) = 0;
+    } else if (objid[0] > 2) {
+        ERROR_MSG("build objid: bad first subidentifier");
+        return 0;
+    } else if (objidlength == 1) {
+        /*
+         * Encode the first value.  
+         */
+        if (((*pkt_len - *offset) < 1)
+            && !(r && asn_realloc(pkt, pkt_len))) {
+            return 0;
+        }
+        *(*pkt + *pkt_len - (++*offset)) = (u_char) objid[0];
+    } else {
+        for (i = objidlength; i > 2; i--) {
+            tmpint = objid[i - 1];
+
+            if (((*pkt_len - *offset) < 1)
+                && !(r && asn_realloc(pkt, pkt_len))) {
+                return 0;
+            }
+            *(*pkt + *pkt_len - (++*offset)) = (u_char) tmpint & 0x7f;
+            tmpint >>= 7;
+
+            while (tmpint > 0) {
+                if (((*pkt_len - *offset) < 1)
+                    && !(r && asn_realloc(pkt, pkt_len))) {
+                    return 0;
+                }
+                *(*pkt + *pkt_len - (++*offset)) =
+                    (u_char) ((tmpint & 0x7f) | 0x80);
+                tmpint >>= 7;
+            }
+        }
+
+        /*
+         * Combine the first two values.  
+         */
+        if ((objid[1] > 40) &&
+            (objid[0] < 2)) {
+            ERROR_MSG("build objid: bad second subidentifier");
+            return 0;
+        }
+        tmpint = ((objid[0] * 40) + objid[1]);
+        if (((*pkt_len - *offset) < 1)
+            && !(r && asn_realloc(pkt, pkt_len))) {
+            return 0;
+        }
+        *(*pkt + *pkt_len - (++*offset)) = (u_char) tmpint & 0x7f;
+        tmpint >>= 7;
+
+        while (tmpint > 0) {
+            if (((*pkt_len - *offset) < 1)
+                && !(r && asn_realloc(pkt, pkt_len))) {
+                return 0;
+            }
+            *(*pkt + *pkt_len - (++*offset)) =
+                (u_char) ((tmpint & 0x7f) | 0x80);
+            tmpint >>= 7;
+        }
+    }
+
+    tmpint = *offset - start_offset;
+    if (asn_realloc_rbuild_header(pkt, pkt_len, offset, r, type,
+                                  (*offset - start_offset))) {
+        if (_asn_realloc_build_header_check(errpre, pkt, pkt_len,
+                                            (*offset - start_offset))) {
+            return 0;
+        } else {
+            DEBUGDUMPSETUP("send", (*pkt + *pkt_len - *offset),
+                           (*offset - start_offset));
+            DEBUGMSG(("dumpv_send", "  ObjID: "));
+            DEBUGMSGOID(("dumpv_send", objid, objidlength));
+            DEBUGMSG(("dumpv_send", "\n"));
+            return 1;
+        }
+    }
+
+    return 0;
+}
+
+int
+asn_realloc_rbuild_null(u_char ** pkt, size_t * pkt_len,
+                        size_t * offset, int r, u_char type)
+{
+    /*
+     * ASN.1 null ::= 0x05 0x00
+     */
+    size_t          start_offset = *offset;
+
+    if (asn_realloc_rbuild_header(pkt, pkt_len, offset, r, type, 0)) {
+        DEBUGDUMPSETUP("send", (*pkt + *pkt_len - *offset),
+                       (*offset - start_offset));
+        DEBUGMSG(("dumpv_send", "  NULL\n"));
+        return 1;
+    } else {
+        return 0;
+    }
+}
+
+int
+asn_realloc_rbuild_bitstring(u_char ** pkt, size_t * pkt_len,
+                             size_t * offset, int r,
+                             u_char type,
+                             u_char * string, size_t strlength)
+{
+    /*
+     * ASN.1 bit string ::= 0x03 asnlength unused {byte}*
+     */
+    static const char *errpre = "build bitstring";
+    size_t          start_offset = *offset;
+
+    while ((*pkt_len - *offset) < strlength) {
+        if (!(r && asn_realloc(pkt, pkt_len))) {
+            return 0;
+        }
+    }
+
+    *offset += strlength;
+    memcpy(*pkt + *pkt_len - *offset, string, strlength);
+
+    if (asn_realloc_rbuild_header
+        (pkt, pkt_len, offset, r, type, strlength)) {
+        if (_asn_realloc_build_header_check
+            (errpre, pkt, pkt_len, strlength)) {
+            return 0;
+        } else {
+            DEBUGDUMPSETUP("send", (*pkt + *pkt_len - *offset),
+                           *offset - start_offset);
+            DEBUGIF("dumpv_send") {
+                if (strlength == 0) {
+                    DEBUGMSG(("dumpv_send", "  Bitstring: [NULL]\n"));
+                } else {
+                    u_char         *buf = (u_char *) malloc(2 * strlength);
+                    size_t          l =
+                        (buf != NULL) ? (2 * strlength) : 0, ol = 0;
+
+                    if (sprint_realloc_asciistring
+                        (&buf, &l, &ol, 1, string, strlength)) {
+                        DEBUGMSG(("dumpv_send", "  Bitstring:\t%s\n",
+                                  buf));
+                    } else {
+                        if (buf == NULL) {
+                            DEBUGMSG(("dumpv_send",
+                                      "  Bitstring:\t[TRUNCATED]\n"));
+                        } else {
+                            DEBUGMSG(("dumpv_send",
+                                      "  Bitstring:\t%s [TRUNCATED]\n",
+                                      buf));
+                        }
+                    }
+                    if (buf != NULL) {
+                        free(buf);
+                    }
+                }
+            }
+        }
+        return 1;
+    }
+
+    return 0;
+}
+
+int
+asn_realloc_rbuild_unsigned_int64(u_char ** pkt, size_t * pkt_len,
+                                  size_t * offset, int r,
+                                  u_char type,
+                                  struct counter64 *cp, size_t countersize)
+{
+    /*
+     * ASN.1 integer ::= 0x02 asnlength byte {byte}*
+     */
+    register u_long low = cp->low, high = cp->high;
+    size_t          intsize, start_offset = *offset;
+    int             count;
+
+    if (countersize != sizeof(struct counter64)) {
+        _asn_size_err("build uint64", countersize,
+                      sizeof(struct counter64));
+        return 0;
+    }
+
+    /*
+     * Encode the low 4 bytes first.  
+     */
+    if (((*pkt_len - *offset) < 1) && !(r && asn_realloc(pkt, pkt_len))) {
+        return 0;
+    }
+    *(*pkt + *pkt_len - (++*offset)) = (u_char) low;
+    low >>= 8;
+    count = 1;
+
+    while (low != 0) {
+        count++;
+        if (((*pkt_len - *offset) < 1)
+            && !(r && asn_realloc(pkt, pkt_len))) {
+            return 0;
+        }
+        *(*pkt + *pkt_len - (++*offset)) = (u_char) low;
+        low >>= 8;
+    }
+
+    /*
+     * Then the high byte if present.  
+     */
+    if (high) {
+        /*
+         * Do the rest of the low byte.  
+         */
+        for (; count < 4; count++) {
+            if (((*pkt_len - *offset) < 1)
+                && !(r && asn_realloc(pkt, pkt_len))) {
+                return 0;
+            }
+            *(*pkt + *pkt_len - (++*offset)) = 0;
+        }
+
+        /*
+         * Do high byte.  
+         */
+        if (((*pkt_len - *offset) < 1)
+            && !(r && asn_realloc(pkt, pkt_len))) {
+            return 0;
+        }
+        *(*pkt + *pkt_len - (++*offset)) = (u_char) high;
+        high >>= 8;
+
+        while (high != 0) {
+            if (((*pkt_len - *offset) < 1)
+                && !(r && asn_realloc(pkt, pkt_len))) {
+                return 0;
+            }
+            *(*pkt + *pkt_len - (++*offset)) = (u_char) high;
+            high >>= 8;
+        }
+    }
+
+    if ((*(*pkt + *pkt_len - *offset) & 0x80) != (0 & 0x80)) {
+        /*
+         * Make sure left most bit is representational of the rest of the bits
+         * that aren't encoded.  
+         */
+        if (((*pkt_len - *offset) < 1)
+            && !(r && asn_realloc(pkt, pkt_len))) {
+            return 0;
+        }
+        *(*pkt + *pkt_len - (++*offset)) = 0;
+    }
+
+    intsize = *offset - start_offset;
+
+#ifdef OPAQUE_SPECIAL_TYPES
+    /*
+     * Encode a Counter64 as an opaque (it also works in SNMPv1).  
+     */
+    if (type == ASN_OPAQUE_COUNTER64) {
+        while ((*pkt_len - *offset) < 5) {
+            if (!(r && asn_realloc(pkt, pkt_len))) {
+                return 0;
+            }
+        }
+
+        *(*pkt + *pkt_len - (++*offset)) = (u_char) intsize;
+        *(*pkt + *pkt_len - (++*offset)) = ASN_OPAQUE_COUNTER64;
+        *(*pkt + *pkt_len - (++*offset)) = ASN_OPAQUE_TAG1;
+
+        /*
+         * Put the tag and length for the Opaque wrapper.  
+         */
+        if (asn_realloc_rbuild_header(pkt, pkt_len, offset, r,
+                                      ASN_OPAQUE, intsize + 3)) {
+            if (_asn_realloc_build_header_check
+                ("build counter u64", pkt, pkt_len, intsize + 3)) {
+                return 0;
+            }
+        } else {
+            return 0;
+        }
+    } else if (type == ASN_OPAQUE_U64) {
+        /*
+         * Encode the Unsigned int64 in an opaque.  
+         */
+        while ((*pkt_len - *offset) < 5) {
+            if (!(r && asn_realloc(pkt, pkt_len))) {
+                return 0;
+            }
+        }
+
+        *(*pkt + *pkt_len - (++*offset)) = (u_char) intsize;
+        *(*pkt + *pkt_len - (++*offset)) = ASN_OPAQUE_U64;
+        *(*pkt + *pkt_len - (++*offset)) = ASN_OPAQUE_TAG1;
+
+        /*
+         * Put the tag and length for the Opaque wrapper.  
+         */
+        if (asn_realloc_rbuild_header(pkt, pkt_len, offset, r,
+                                      ASN_OPAQUE, intsize + 3)) {
+            if (_asn_realloc_build_header_check
+                ("build counter u64", pkt, pkt_len, intsize + 3)) {
+                return 0;
+            }
+        } else {
+            return 0;
+        }
+    } else {
+
+#endif                          /* OPAQUE_SPECIAL_TYPES */
+        if (asn_realloc_rbuild_header
+            (pkt, pkt_len, offset, r, type, intsize)) {
+            if (_asn_realloc_build_header_check
+                ("build uint64", pkt, pkt_len, intsize)) {
+                return 0;
+            }
+        } else {
+            return 0;
+        }
+#ifdef OPAQUE_SPECIAL_TYPES
+    }
+#endif                          /* OPAQUE_SPECIAL_TYPES */
+
+    DEBUGDUMPSETUP("send", (*pkt + *pkt_len - *offset), intsize);
+    DEBUGMSG(("dumpv_send", "  U64:\t%lu %lu\n", cp->high, cp->low));
+    return 1;
+}
+
+#ifdef OPAQUE_SPECIAL_TYPES
+int
+asn_realloc_rbuild_signed_int64(u_char ** pkt, size_t * pkt_len,
+                                size_t * offset, int r,
+                                u_char type,
+                                struct counter64 *cp, size_t countersize)
+{
+    /*
+     * ASN.1 integer ::= 0x02 asnlength byte {byte}*
+     */
+    register u_long low = cp->low, high = cp->high;
+    size_t          intsize, start_offset = *offset;
+    int             count, testvalue = (high & 0x80000000) ? -1 : 0;
+
+    if (countersize != sizeof(struct counter64)) {
+        _asn_size_err("build uint64", countersize,
+                      sizeof(struct counter64));
+        return 0;
+    }
+
+    /*
+     * Encode the low 4 bytes first.  
+     */
+    if (((*pkt_len - *offset) < 1) && !(r && asn_realloc(pkt, pkt_len))) {
+        return 0;
+    }
+    *(*pkt + *pkt_len - (++*offset)) = (u_char) low;
+    low >>= 8;
+    count = 1;
+
+    while ((int) low != testvalue) {
+        count++;
+        if (((*pkt_len - *offset) < 1)
+            && !(r && asn_realloc(pkt, pkt_len))) {
+            return 0;
+        }
+        *(*pkt + *pkt_len - (++*offset)) = (u_char) low;
+        low >>= 8;
+    }
+
+    /*
+     * Then the high byte if present.  
+     */
+    if (high) {
+        /*
+         * Do the rest of the low byte.  
+         */
+        for (; count < 4; count++) {
+            if (((*pkt_len - *offset) < 1)
+                && !(r && asn_realloc(pkt, pkt_len))) {
+                return 0;
+            }
+            *(*pkt + *pkt_len - (++*offset)) = (testvalue == 0) ? 0 : 0xff;
+        }
+
+        /*
+         * Do high byte.  
+         */
+        if (((*pkt_len - *offset) < 1)
+            && !(r && asn_realloc(pkt, pkt_len))) {
+            return 0;
+        }
+        *(*pkt + *pkt_len - (++*offset)) = (u_char) high;
+        high >>= 8;
+
+        while ((int) high != testvalue) {
+            if (((*pkt_len - *offset) < 1)
+                && !(r && asn_realloc(pkt, pkt_len))) {
+                return 0;
+            }
+            *(*pkt + *pkt_len - (++*offset)) = (u_char) high;
+            high >>= 8;
+        }
+    }
+
+    if ((*(*pkt + *pkt_len - *offset) & 0x80) != (0 & 0x80)) {
+        /*
+         * Make sure left most bit is representational of the rest of the bits
+         * that aren't encoded.  
+         */
+        if (((*pkt_len - *offset) < 1)
+            && !(r && asn_realloc(pkt, pkt_len))) {
+            return 0;
+        }
+        *(*pkt + *pkt_len - (++*offset)) = (testvalue == 0) ? 0 : 0xff;
+    }
+
+    intsize = *offset - start_offset;
+
+    while ((*pkt_len - *offset) < 5) {
+        if (!(r && asn_realloc(pkt, pkt_len))) {
+            return 0;
+        }
+    }
+
+    *(*pkt + *pkt_len - (++*offset)) = (u_char) intsize;
+    *(*pkt + *pkt_len - (++*offset)) = ASN_OPAQUE_I64;
+    *(*pkt + *pkt_len - (++*offset)) = ASN_OPAQUE_TAG1;
+
+    /*
+     * Put the tag and length for the Opaque wrapper.  
+     */
+    if (asn_realloc_rbuild_header(pkt, pkt_len, offset, r,
+                                  ASN_OPAQUE, intsize + 3)) {
+        if (_asn_realloc_build_header_check
+            ("build counter u64", pkt, pkt_len, intsize + 3)) {
+            return 0;
+        }
+    } else {
+        return 0;
+    }
+
+    DEBUGDUMPSETUP("send", (*pkt + *pkt_len - *offset), intsize);
+    DEBUGMSG(("dumpv_send", "  UInt64:\t%lu %lu\n", cp->high, cp->low));
+    return 1;
+}
+
+int
+asn_realloc_rbuild_float(u_char ** pkt, size_t * pkt_len,
+                         size_t * offset, int r,
+                         u_char type, float *floatp, size_t floatsize)
+{
+    size_t          start_offset = *offset;
+    union {
+        float           floatVal;
+        int             intVal;
+        u_char          c[sizeof(float)];
+    } fu;
+
+    /*
+     * Floatsize better not be larger than realistic.  
+     */
+    if (floatsize != sizeof(float) || floatsize > 122) {
+        return 0;
+    }
+
+    while ((*pkt_len - *offset) < floatsize + 3) {
+        if (!(r && asn_realloc(pkt, pkt_len))) {
+            return 0;
+        }
+    }
+
+    /*
+     * Correct for endian differences and copy value.  
+     */
+    fu.floatVal = *floatp;
+    fu.intVal = htonl(fu.intVal);
+    *offset += floatsize;
+    memcpy(*pkt + *pkt_len - *offset, &(fu.c[0]), floatsize);
+
+    /*
+     * Put the special tag and length (3 bytes).  
+     */
+    *(*pkt + *pkt_len - (++*offset)) = (u_char) floatsize;
+    *(*pkt + *pkt_len - (++*offset)) = ASN_OPAQUE_FLOAT;
+    *(*pkt + *pkt_len - (++*offset)) = ASN_OPAQUE_TAG1;
+
+    /*
+     * Put the tag and length for the Opaque wrapper.  
+     */
+    if (asn_realloc_rbuild_header(pkt, pkt_len, offset, r,
+                                  ASN_OPAQUE, floatsize + 3)) {
+        if (_asn_realloc_build_header_check("build float", pkt, pkt_len,
+                                            floatsize + 3)) {
+            return 0;
+        } else {
+            DEBUGDUMPSETUP("send", (*pkt + *pkt_len - *offset),
+                           *offset - start_offset);
+            DEBUGMSG(("dumpv_send", "Opaque Float:\t%f\n", *floatp));
+            return 1;
+        }
+    }
+
+    return 0;
+}
+
+int
+asn_realloc_rbuild_double(u_char ** pkt, size_t * pkt_len,
+                          size_t * offset, int r,
+                          u_char type, double *doublep, size_t doublesize)
+{
+    size_t          start_offset = *offset;
+    long            tmp;
+    union {
+        double          doubleVal;
+        int             intVal[2];
+        u_char          c[sizeof(double)];
+    } fu;
+
+    /*
+     * Doublesize better not be larger than realistic.  
+     */
+    if (doublesize != sizeof(double) || doublesize > 122) {
+        return 0;
+    }
+
+    while ((*pkt_len - *offset) < doublesize + 3) {
+        if (!(r && asn_realloc(pkt, pkt_len))) {
+            return 0;
+        }
+    }
+
+    /*
+     * Correct for endian differences and copy value.  
+     */
+    fu.doubleVal = *doublep;
+    tmp = htonl(fu.intVal[0]);
+    fu.intVal[0] = htonl(fu.intVal[1]);
+    fu.intVal[1] = tmp;
+    *offset += doublesize;
+    memcpy(*pkt + *pkt_len - *offset, &(fu.c[0]), doublesize);
+
+    /*
+     * Put the special tag and length (3 bytes).  
+     */
+    *(*pkt + *pkt_len - (++*offset)) = (u_char) doublesize;
+    *(*pkt + *pkt_len - (++*offset)) = ASN_OPAQUE_DOUBLE;
+    *(*pkt + *pkt_len - (++*offset)) = ASN_OPAQUE_TAG1;
+
+    /*
+     * Put the tag and length for the Opaque wrapper.  
+     */
+    if (asn_realloc_rbuild_header(pkt, pkt_len, offset, r,
+                                  ASN_OPAQUE, doublesize + 3)) {
+        if (_asn_realloc_build_header_check("build float", pkt, pkt_len,
+                                            doublesize + 3)) {
+            return 0;
+        } else {
+            DEBUGDUMPSETUP("send", (*pkt + *pkt_len - *offset),
+                           *offset - start_offset);
+            DEBUGMSG(("dumpv_send", "  Opaque Double:\t%f\n", *doublep));
+            return 1;
+        }
+    }
+
+    return 0;
+}
+
+#endif                          /* OPAQUE_SPECIAL_TYPES */
+#endif                          /*  USE_REVERSE_ASNENCODING  */
diff -Naur tomato/release/src/router/snmp/snmplib/callback.c tomato121/release/src/router/snmp/snmplib/callback.c
--- tomato/release/src/router/snmp/snmplib/callback.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/snmplib/callback.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,185 @@
+/*
+ * callback.c: A generic callback mechanism 
+ */
+
+#include <net-snmp/net-snmp-config.h>
+#include <sys/types.h>
+#include <stdio.h>
+#if HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#if HAVE_WINSOCK_H
+#include <winsock.h>
+#endif
+#if HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+#if HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+
+#if HAVE_DMALLOC_H
+#include <dmalloc.h>
+#endif
+
+#include <net-snmp/types.h>
+#include <net-snmp/output_api.h>
+#include <net-snmp/utilities.h>
+
+#include <net-snmp/library/callback.h>
+#include <net-snmp/library/snmp_api.h>
+
+static struct snmp_gen_callback
+               *thecallbacks[MAX_CALLBACK_IDS][MAX_CALLBACK_SUBIDS];
+
+/*
+ * the chicken. or the egg.  You pick. 
+ */
+void
+init_callbacks(void)
+{
+    /*
+     * probably not needed? Should be full of 0's anyway? 
+     */
+    /*
+     * (poses a problem if you put init_callbacks() inside of
+     * init_snmp() and then want the app to register a callback before
+     * init_snmp() is called in the first place.  -- Wes 
+     */
+    /*
+     * memset(thecallbacks, 0, sizeof(thecallbacks)); 
+     */
+    DEBUGMSGTL(("callback", "initialized\n"));
+}
+
+int
+snmp_register_callback(int major, int minor, SNMPCallback * new_callback,
+                       void *arg)
+{
+    struct snmp_gen_callback *newscp = NULL, *scp = NULL;
+    struct snmp_gen_callback **prevNext = &(thecallbacks[major][minor]);
+
+    if (major >= MAX_CALLBACK_IDS || minor >= MAX_CALLBACK_SUBIDS) {
+        return SNMPERR_GENERR;
+    }
+
+    if ((newscp = SNMP_MALLOC_STRUCT(snmp_gen_callback)) == NULL) {
+        return SNMPERR_GENERR;
+    } else {
+        newscp->sc_client_arg = arg;
+        newscp->sc_callback = new_callback;
+        newscp->next = NULL;
+
+        for (scp = thecallbacks[major][minor]; scp != NULL;
+             scp = scp->next) {
+            prevNext = &(scp->next);
+        }
+
+        *prevNext = newscp;
+
+        DEBUGMSGTL(("callback", "registered (%d,%d) at %p\n", major, minor,
+                    newscp));
+        return SNMPERR_SUCCESS;
+    }
+}
+
+int
+snmp_call_callbacks(int major, int minor, void *caller_arg)
+{
+    struct snmp_gen_callback *scp;
+    unsigned int    count = 0;
+
+    if (major >= MAX_CALLBACK_IDS || minor >= MAX_CALLBACK_SUBIDS) {
+        return SNMPERR_GENERR;
+    }
+
+    DEBUGMSGTL(("callback", "START calling callbacks for maj=%d min=%d\n",
+                major, minor));
+
+    /*
+     * for each registered callback of type major and minor 
+     */
+    for (scp = thecallbacks[major][minor]; scp != NULL; scp = scp->next) {
+
+        DEBUGMSGTL(("callback", "calling a callback for maj=%d min=%d\n",
+                    major, minor));
+
+        /*
+         * call them 
+         */
+        (*(scp->sc_callback)) (major, minor, caller_arg,
+                               scp->sc_client_arg);
+        count++;
+    }
+
+    DEBUGMSGTL(("callback",
+                "END calling callbacks for maj=%d min=%d (%d called)\n",
+                major, minor, count));
+
+    return SNMPERR_SUCCESS;
+}
+
+int
+snmp_count_callbacks(int major, int minor)
+{
+    int             count = 0;
+    struct snmp_gen_callback *scp;
+
+    if (major >= MAX_CALLBACK_IDS || minor >= MAX_CALLBACK_SUBIDS) {
+        return SNMPERR_GENERR;
+    }
+
+    for (scp = thecallbacks[major][minor]; scp != NULL; scp = scp->next) {
+        count++;
+    }
+
+    return count;
+}
+
+int
+snmp_callback_available(int major, int minor)
+{
+    if (major >= MAX_CALLBACK_IDS || minor >= MAX_CALLBACK_SUBIDS) {
+        return SNMPERR_GENERR;
+    }
+
+    if (thecallbacks[major][minor] != NULL) {
+        return SNMPERR_SUCCESS;
+    }
+
+    return SNMPERR_GENERR;
+}
+
+int
+snmp_unregister_callback(int major, int minor, SNMPCallback * target,
+                         void *arg, int matchargs)
+{
+    struct snmp_gen_callback *scp = thecallbacks[major][minor];
+    struct snmp_gen_callback **prevNext = &(thecallbacks[major][minor]);
+    int             count = 0;
+
+    while (scp != NULL) {
+        if ((scp->sc_callback == target) &&
+            (!matchargs || (scp->sc_client_arg == arg))) {
+            DEBUGMSGTL(("callback", "unregistering (%d,%d) at %p\n", major,
+                        minor, scp));
+            *prevNext = scp->next;
+            SNMP_FREE(scp);
+            scp = *prevNext;
+            count++;
+        } else {
+            prevNext = &(scp->next);
+            scp = scp->next;
+        }
+    }
+
+    return count;
+}
+
+struct snmp_gen_callback *
+snmp_callback_list(int major, int minor)
+{
+    return (thecallbacks[major][minor]);
+}
diff -Naur tomato/release/src/router/snmp/snmplib/check_varbind.c tomato121/release/src/router/snmp/snmplib/check_varbind.c
--- tomato/release/src/router/snmp/snmplib/check_varbind.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/snmplib/check_varbind.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,81 @@
+#include <net-snmp/net-snmp-config.h>
+
+#include <net-snmp/net-snmp-includes.h>
+
+#include <net-snmp/library/check_varbind.h>
+
+
+
+int
+netsnmp_check_vb_type_and_size(netsnmp_variable_list *var,
+                               int type, size_t size)
+{
+    register int rc = SNMP_ERR_NOERROR;
+
+    if (NULL == var)
+        return SNMP_ERR_GENERR;
+    
+    if (var->type != type) {
+        rc = SNMP_ERR_WRONGTYPE;
+    } else if (var->val_len != size) {
+        rc = SNMP_ERR_WRONGLENGTH;
+    }
+
+    return rc;
+}
+
+int
+netsnmp_check_vb_int_range(netsnmp_variable_list *var, int low, int high)
+{
+    register int rc = SNMP_ERR_NOERROR;
+    
+    if ((rc = netsnmp_check_vb_type_and_size(var, ASN_INTEGER, sizeof(int))))
+        return rc;
+    
+    if ((*var->val.integer < low) || (*var->val.integer > high)) {
+        rc = SNMP_ERR_BADVALUE;
+    }
+
+    return rc;
+}
+
+int
+netsnmp_check_vb_truthvalue(netsnmp_variable_list *var)
+{
+    register int rc = SNMP_ERR_NOERROR;
+    
+    if ((rc = netsnmp_check_vb_type_and_size(var, ASN_INTEGER, sizeof(int))))
+        return rc;
+    
+    return netsnmp_check_vb_int_range(var, 1, 2);
+}
+
+int
+netsnmp_check_vb_rowstatus(netsnmp_variable_list *var, int old_value)
+{
+    register int rc = SNMP_ERR_NOERROR;
+
+    if ((rc = netsnmp_check_vb_type_and_size(var, ASN_INTEGER, sizeof(int))))
+        return rc;
+    
+    if ((rc = netsnmp_check_vb_int_range(var, SNMP_ROW_NONEXISTENT,
+                                         SNMP_ROW_DESTROY)))
+        return rc;
+
+    return check_rowstatus_transition(old_value, *var->val.integer);
+}
+
+int
+netsnmp_check_vb_storagetype(netsnmp_variable_list *var, int old_value)
+{
+    int rc = SNMP_ERR_NOERROR;
+
+    if ((rc = netsnmp_check_vb_type_and_size(var, ASN_INTEGER, sizeof(int))))
+        return rc;
+    
+    if ((rc = netsnmp_check_vb_int_range(var, SNMP_STORAGE_NONE,
+                                        SNMP_STORAGE_READONLY)))
+        return rc;
+        
+    return check_storage_transition(old_value, *var->val.integer);
+}
diff -Naur tomato/release/src/router/snmp/snmplib/cmu_compat.c tomato121/release/src/router/snmp/snmplib/cmu_compat.c
--- tomato/release/src/router/snmp/snmplib/cmu_compat.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/snmplib/cmu_compat.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,129 @@
+
+#ifdef CMU_COMPATIBLE
+
+#include <net-snmp/mib_api.h>
+#include <net-snmp/pdu_api.h>
+#include <net-snmp/session_api.h>
+
+int
+mib_TxtToOid(char *Buf, oid ** OidP, size_t * LenP)
+{
+    return read_objid(Buf, *OidP, LenP);
+}
+
+int
+mib_OidToTxt(oid * O, size_t OidLen, char *Buf, size_t BufLen)
+{
+    _sprint_objid(Buf, O, OidLen);
+    return 1;
+}
+
+
+
+char           *
+snmp_pdu_type(netsnmp_pdu *PDU)
+{
+    switch (PDU->command) {
+    case SNMP_MSG_GET:
+        return ("GET");
+        break;
+    case SNMP_MSG_GETNEXT:
+        return ("GETNEXT");
+        break;
+    case SNMP_MSG_RESPONSE:
+        return ("RESPONSE");
+        break;
+    case SNMP_MSG_SET:
+        return ("SET");
+        break;
+    case SNMP_MSG_GETBULK:
+        return ("GETBULK");
+        break;
+    case SNMP_MSG_INFORM:
+        return ("INFORM");
+        break;
+    case SNMP_MSG_TRAP2:
+        return ("V2TRAP");
+        break;
+    case SNMP_MSG_REPORT:
+        return ("REPORT");
+        break;
+
+    case SNMP_MSG_TRAP:
+        return ("V1TRAP");
+        break;
+    default:
+        return ("Unknown");
+        break;
+    }
+}
+
+/*
+ * cmu_snmp_parse - emulate CMU library's snmp_parse.
+ *
+ * Parse packet, storing results into PDU.
+ * Returns community string if success, NULL if fail.
+ * WARNING: may return a zero length community string.
+ *
+ * Note:
+ * Some CMU-aware apps call init_mib(), but do not
+ * initialize a session.
+ * Check Reqid to make sure that this module is initialized.
+ */
+
+u_char         *
+cmu_snmp_parse(netsnmp_session * session,
+               netsnmp_pdu *pdu, u_char * data, size_t length)
+{
+    u_char         *bufp = NULL;
+
+    snmp_sess_init(session);    /* gimme a break! */
+
+    switch (pdu->version) {
+    case SNMP_VERSION_1:
+    case SNMP_VERSION_2c:
+    case SNMP_DEFAULT_VERSION:
+        break;
+    default:
+        return NULL;
+    }
+#ifndef NO_INTERNAL_VARLIST
+    if (snmp_parse(0, session, pdu, data, length) != SNMP_ERR_NOERROR) {
+        return NULL;
+    }
+#else
+    /*
+     * while there are two versions of variable_list:
+     * use an internal variable list for snmp_parse;
+     * clone the result.
+     */
+    if (1) {
+        netsnmp_pdu    *snmp_clone_pdu(netsnmp_pdu *);
+        netsnmp_pdu    *snmp_2clone_pdu(netsnmp_pdu *from_pdu,
+                                        netsnmp_pdu *to_pdu);
+
+        netsnmp_pdu    *ipdu;
+        ipdu = snmp_clone_pdu(pdu);
+        if (snmp_parse(0, session, ipdu, data, length) != SNMP_ERR_NOERROR) {
+            snmp_free_internal_pdu(ipdu);
+            return NULL;
+        }
+        pdu = snmp_2clone_pdu(ipdu, pdu);
+        snmp_free_internal_pdu(ipdu);
+    }
+#endif                          /* NO_INTERNAL_VAR_LIST */
+
+    /*
+     * Add a null to meet the caller's expectations. 
+     */
+
+    bufp = (u_char *) malloc(1 + pdu->community_len);
+    if (bufp && pdu->community_len) {
+        memcpy(bufp, pdu->community, pdu->community_len);
+        bufp[pdu->community_len] = '\0';
+    }
+    return (bufp);
+}
+
+
+#endif                          /* CMU_COMPATIBLE */
diff -Naur tomato/release/src/router/snmp/snmplib/container_binary_array.c tomato121/release/src/router/snmp/snmplib/container_binary_array.c
--- tomato/release/src/router/snmp/snmplib/container_binary_array.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/snmplib/container_binary_array.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,675 @@
+/*
+ * container_binary_array.c
+ * $Id: container_binary_array.c,v 1.1.2.1 2004/06/20 21:55:00 nikki Exp $
+ *
+ * see comments in header file.
+ *
+ */
+
+#include <net-snmp/net-snmp-config.h>
+
+#if HAVE_IO_H
+#include <io.h>
+#endif
+#include <stdio.h>
+#if HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#if HAVE_MALLOC_H
+#include <malloc.h>
+#endif
+#include <sys/types.h>
+#if HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/types.h>
+#include <net-snmp/library/snmp_api.h>
+#include <net-snmp/library/container.h>
+#include <net-snmp/library/container_binary_array.h>
+#include <net-snmp/library/tools.h>
+#include <net-snmp/library/snmp_assert.h>
+
+typedef struct binary_array_table_s {
+    size_t                     max_size;   /* Size of the current data table */
+    size_t                     count;      /* Index of the next free entry */
+    int                        dirty;
+    int                        data_size;  /* Size of an individual entry */
+    void                     **data;       /* The table itself */
+} binary_array_table;
+
+static void
+array_qsort(void **data, int first, int last, netsnmp_container_compare *f)
+{
+    int i, j;
+    void *mid, *tmp;
+    
+    i = first;
+    j = last;
+    mid = data[(first+last)/2];
+    
+    do {
+        while ( ((*f)(data[i], mid) < 0) && (i < last))
+            ++i;
+        while ( ((*f)(mid, data[j]) < 0) && (j > first))
+            --j;
+
+        if(i < j) {
+            tmp = data[i];
+            data[i] = data[j];
+            data[j] = tmp;
+            ++i;
+            --j;
+        }
+        else if (i == j) {
+            ++i;
+            --j;
+            break;
+        }
+    } while(i <= j);
+
+    if (j > first)
+        array_qsort(data, first, j, f);
+    
+    if (i < last)
+        array_qsort(data, i, last, f);
+}
+
+static int
+Sort_Array(netsnmp_container *c)
+{
+    binary_array_table *t = (binary_array_table*)c->private;
+    netsnmp_assert(t!=NULL);
+    netsnmp_assert(c->compare!=NULL);
+    
+    if (t->dirty) {
+        /*
+         * Sort the table 
+         */
+        if (t->count > 1)
+            array_qsort(t->data, 0, t->count - 1, c->compare);
+        t->dirty = 0;
+    }
+
+    return 1;
+}
+
+static int
+binary_search(const void *val, netsnmp_container *c, int exact)
+{
+    binary_array_table *t = (binary_array_table*)c->private;
+    size_t             len = t->count;
+    size_t             half;
+    size_t             middle;
+    size_t             first = 0;
+    int                result = 0;
+
+    if (!len)
+        return -1;
+
+    if (t->dirty)
+        Sort_Array(c);
+
+    while (len > 0) {
+        half = len >> 1;
+        middle = first;
+        middle += half;
+        if ((result =
+             c->compare(t->data[middle], val)) < 0) {
+            first = middle;
+            ++first;
+            len = len - half - 1;
+        } else {
+            if(result == 0) {
+                first = middle;
+                break;
+            }
+            len = half;
+        }
+    }
+
+    if (first >= t->count)
+        return -1;
+
+    if(first != middle) {
+        /* last compare wasn't against first, so get actual result */
+        result = c->compare(t->data[first], val);
+    }
+
+    if(result == 0) {
+        if (!exact) {
+            if (++first == t->count)
+               first = -1;
+        }
+    }
+    else {
+        if(exact)
+            first = -1;
+    }
+
+    return first;
+}
+
+binary_array_table *
+netsnmp_binary_array_initialize(void)
+{
+    binary_array_table *t;
+
+    t = SNMP_MALLOC_TYPEDEF(binary_array_table);
+    if (t == NULL)
+        return NULL;
+
+    t->max_size = 0;
+    t->count = 0;
+    t->dirty = 0;
+    t->data_size = 4;
+    t->data = NULL;
+
+    return t;
+}
+
+void
+netsnmp_binary_array_release(netsnmp_container *c)
+{
+    binary_array_table *t = (binary_array_table*)c->private;
+    free(t);
+    free(c);
+}
+
+size_t
+netsnmp_binary_array_count(netsnmp_container *c)
+{
+    binary_array_table *t = (binary_array_table*)c->private;
+    /*
+     * return count
+     */
+    return t ? t->count : 0;
+}
+
+void           *
+netsnmp_binary_array_get(netsnmp_container *c, const void *key, int exact)
+{
+    binary_array_table *t = (binary_array_table*)c->private;
+    int             index = 0;
+
+    /*
+     * if there is no data, return NULL;
+     */
+    if (!t->count)
+        return 0;
+
+    /*
+     * if the table is dirty, sort it.
+     */
+    if (t->dirty)
+        Sort_Array(c);
+
+    /*
+     * if there is a key, search. Otherwise default is 0;
+     */
+    if (key) {
+        if ((index = binary_search(key, c, exact)) == -1)
+            return 0;
+    }
+
+    return t->data[index];
+}
+
+int
+netsnmp_binary_array_replace(netsnmp_container *c, void *entry)
+{
+    binary_array_table *t = (binary_array_table*)c->private;
+    int             index = 0;
+
+    /*
+     * if there is no data, return NULL;
+     */
+    if (!t->count)
+        return 0;
+
+    /*
+     * if the table is dirty, sort it.
+     */
+    if (t->dirty)
+        Sort_Array(c);
+
+    /*
+     * search
+     */
+    if ((index = binary_search(entry, c, 1)) == -1)
+        return 0;
+
+    t->data[index] = entry;
+
+    return 0;
+}
+
+int
+netsnmp_binary_array_remove(netsnmp_container *c, const void *key, void **save)
+{
+    binary_array_table *t = (binary_array_table*)c->private;
+    int             index = 0;
+
+    if (save)
+        *save = NULL;
+    
+    /*
+     * if there is no data, return NULL;
+     */
+    if (!t->count)
+        return 0;
+
+    /*
+     * if the table is dirty, sort it.
+     */
+    if (t->dirty)
+        Sort_Array(c);
+
+    /*
+     * search
+     */
+    if ((index = binary_search(key, c, 1)) == -1)
+        return -1;
+
+    /*
+     * find old data and save it, if ptr provided
+     */
+    if (save)
+        *save = t->data[index];
+
+    /*
+     * if entry was last item, just decrement count
+     */
+    --t->count;
+    if (index != t->count) {
+        /*
+         * otherwise, shift array down
+         */
+        memmove(&t->data[index], &t->data[index+1], t->data_size * (t->count - index));
+    }
+
+    return 0;
+}
+
+void
+netsnmp_binary_array_for_each(netsnmp_container *c,
+                              netsnmp_container_obj_func *fe,
+                              void *context, int sort)
+{
+    binary_array_table *t = (binary_array_table*)c->private;
+    size_t             i;
+
+    if (sort && t->dirty)
+        Sort_Array(c);
+
+    for (i = 0; i < t->count; ++i)
+        (*fe) (t->data[i], context);
+}
+
+int
+netsnmp_binary_array_insert(netsnmp_container *c, const void *entry)
+{
+    binary_array_table *t = (binary_array_table*)c->private;
+    int             new_max;
+    void           *new_data;   /* Used for * a) extending the data table
+                                 * * b) the next entry to use */
+
+    if (t->max_size <= t->count) {
+        /*
+         * Table is full, so extend it to double the size
+         */
+        new_max = 2 * t->max_size;
+        if (new_max == 0)
+            new_max = 10;       /* Start with 10 entries */
+
+        new_data = (void *) calloc(new_max, t->data_size);
+        if (new_data == NULL)
+            return -1;
+
+        if (t->data) {
+            memcpy(new_data, t->data, t->max_size * t->data_size);
+            free(t->data);
+        }
+        t->data = new_data;
+        t->max_size = new_max;
+    }
+
+    /*
+     * Insert the new entry into the data array
+     */
+    t->data[t->count++] = (void*)entry;
+    t->dirty = 1;
+    return 0;
+}
+
+void           *
+netsnmp_binary_array_retrieve(netsnmp_container *c, int *max_oids, int sort)
+{
+    binary_array_table *t = (binary_array_table*)c->private;
+    if (sort && t->dirty)
+        Sort_Array(c);
+
+    *max_oids = t->count;
+    return t->data;
+}
+
+/**********************************************************************
+ *
+ * Special case support for subsets
+ *
+ */
+static int
+binary_search_for_start(netsnmp_index *val, netsnmp_container *c)
+{
+    binary_array_table *t = (binary_array_table*)c->private;
+    size_t             len = t->count;
+    size_t             half;
+    size_t             middle;
+    size_t             first = 0;
+    int                result = 0;
+
+    if (!len)
+        return -1;
+
+    if (t->dirty)
+        Sort_Array(c);
+
+    while (len > 0) {
+        half = len >> 1;
+        middle = first;
+        middle += half;
+        if ((result = c->ncompare(t->data[middle], val)) < 0) {
+            first = middle;
+            ++first;
+            len = len - half - 1;
+        } else
+            len = half;
+    }
+
+    if ((first >= t->count) ||
+        c->ncompare(t->data[first], val) != 0)
+        return -1;
+
+    return first;
+}
+
+void          **
+netsnmp_binary_array_get_subset(netsnmp_container *c, void *key, int *len)
+{
+    binary_array_table *t = (binary_array_table*)c->private;
+    void          **subset;
+    int             start, end;
+    size_t          i;
+
+    /*
+     * if there is no data, return NULL;
+     */
+    if (!t->count || !key)
+        return 0;
+
+    /*
+     * if the table is dirty, sort it.
+     */
+    if (t->dirty)
+        Sort_Array(c);
+
+    /*
+     * find matching items
+     */
+    start = end = binary_search_for_start(key, c);
+    if (start == -1)
+        return 0;
+
+    for (i = start + 1; i < t->count; ++i) {
+        if (0 != c->ncompare(t->data[i], key))
+            break;
+        ++end;
+    }
+
+    *len = end - start + 1;
+    subset = malloc((*len) * t->data_size);
+    memcpy(subset, &t->data[start], t->data_size * (*len));
+
+    return subset;
+}
+
+/**********************************************************************
+ *
+ * container
+ *
+ */
+static void *
+_ba_find(netsnmp_container *container, const void *data)
+{
+    return netsnmp_binary_array_get(container, data, 1);
+}
+
+static void *
+_ba_find_next(netsnmp_container *container, const void *data)
+{
+    return netsnmp_binary_array_get(container, data, 0);
+}
+
+static int
+_ba_insert(netsnmp_container *container, const void *data)
+{
+    return netsnmp_binary_array_insert(container, data);
+}
+
+static int
+_ba_remove(netsnmp_container *container, const void *data)
+{
+    return netsnmp_binary_array_remove(container,data, NULL);
+}
+
+static int
+_ba_free(netsnmp_container *container)
+{
+    netsnmp_binary_array_release(container);
+    return 0;
+}
+
+static size_t
+_ba_size(netsnmp_container *container)
+{
+    return netsnmp_binary_array_count(container);
+}
+
+static void
+_ba_for_each(netsnmp_container *container, netsnmp_container_obj_func *f,
+             void *context)
+{
+    netsnmp_binary_array_for_each(container, f, context, 0);
+}
+
+static netsnmp_void_array *
+_ba_get_subset(netsnmp_container *container, void *data)
+{
+    netsnmp_void_array * va;
+    void ** rtn;
+    int len;
+
+    rtn = netsnmp_binary_array_get_subset(container, data, &len);
+    if ((NULL==rtn) || (len <=0))
+        return NULL;
+    
+    va = SNMP_MALLOC_TYPEDEF(netsnmp_void_array);
+    if (NULL==va)
+        return NULL;
+
+    va->size = len;
+    va->array = rtn;
+
+    return va;
+}
+
+int
+netsnmp_container_get_binary_array_noalloc(netsnmp_container *c)
+{
+    if (NULL==c)
+        return -1;
+    
+    c->private = netsnmp_binary_array_initialize();
+        
+    c->get_size = _ba_size;
+    c->init = NULL;
+    c->cfree = _ba_free;
+    c->insert = _ba_insert;
+    c->remove = _ba_remove;
+    c->find = _ba_find;
+    c->find_next = _ba_find_next;
+    c->get_subset = _ba_get_subset;
+    c->get_iterator = NULL;
+    c->for_each = _ba_for_each;
+
+    return 0;
+}
+
+netsnmp_container *
+netsnmp_container_get_binary_array(void)
+{
+    /*
+     * allocate memory
+     */
+    netsnmp_container *c = SNMP_MALLOC_TYPEDEF(netsnmp_container);
+    if (NULL==c) {
+        snmp_log(LOG_ERR, "couldn't allocate memory\n");
+        return NULL;
+    }
+
+    if (0 != netsnmp_container_get_binary_array_noalloc(c)) {
+        free(c);
+        return NULL;
+    }
+        
+    return c;
+}
+
+netsnmp_factory *
+netsnmp_container_get_binary_array_factory(void)
+{
+    static netsnmp_factory f = { "binary_array",
+                                 (netsnmp_factory_produce_f*)
+                                 netsnmp_container_get_binary_array,
+                                 (netsnmp_factory_produce_noalloc_f*)
+                                 netsnmp_container_get_binary_array_noalloc };
+    
+    return &f;
+}
+
+#ifdef NOT_YET
+void *
+netsnmp_binary_array_iterator_first(netsnmp_iterator *it)
+{
+    binary_array_table *t;
+
+    if(NULL == it) {
+        netsnmp_assert(NULL != it);
+        return NULL;
+    }
+    if(NULL == it->container) {
+        netsnmp_assert(NULL != it->container);
+        return NULL;
+    }
+    if(NULL == it->container->private) {
+        netsnmp_assert(NULL != it->container->private);
+        return NULL;
+    }
+    t = (binary_array_table*)(it->container->private);
+    
+    (int)(it->context) = 0;
+
+    if((int)(it->context) <= t->count)
+        return NULL;
+
+    return t->data[ (int)(it->context) ];
+}
+
+netsnmp_binary_array_iterator_next(netsnmp_iterator *it)
+{
+    if(NULL == it) {
+        netsnmp_assert(NULL != it);
+        return NULL;
+    }
+    if(NULL == it->container) {
+        netsnmp_assert(NULL != it->container);
+        return NULL;
+    }
+    if(NULL == it->container->private) {
+        netsnmp_assert(NULL != it->container->private);
+        return NULL;
+    }
+    t = (binary_array_table*)(it->container->private);
+
+    ++(int)(it->context);
+
+    if((int)(it->context) <= t->count)
+        return NULL;
+
+    return t->data[ (int)(it->context) ];
+   
+}
+
+void *
+netsnmp_binary_array_iterator_last(netsnmp_iterator *it)
+{
+    if(NULL == it) {
+        netsnmp_assert(NULL != it);
+        return NULL;
+    }
+    if(NULL == it->container) {
+        netsnmp_assert(NULL != it->container);
+        return NULL;
+    }
+    if(NULL == it->container->private) {
+        netsnmp_assert(NULL != it->container->private);
+        return NULL;
+    }
+    t = (binary_array_table*)(it->container->private);
+    
+    return t->data[ t->count - 1 ];
+}
+
+/*  void * */
+/*  netsnmp_binary_array_iterator_position(netsnmp_iterator *it) */
+/*  { */
+/*      if(NULL == it) { */
+/*          netsnmp_assert(NULL != it); */
+/*          return NULL; */
+/*      } */
+/*      if(NULL == it->container) { */
+/*          netsnmp_assert(NULL != it->container); */
+/*          return NULL; */
+/*      } */
+/*      if(NULL == it->container->private) { */
+/*          netsnmp_assert(NULL != it->container->private); */
+/*          return NULL; */
+/*      } */
+/*      t = (binary_array_table*)(it->container->private); */
+    
+/*  } */
+
+netsnmp_iterator *
+netsnmp_binary_array_get_iterator(netsnmp_container *c)
+{
+    netsnmp_iterator* it;
+
+    if(NULL == c)
+        return NULL;
+
+    it = SNMP_MALLOC_TYPEDEF(netsnmp_iterator);
+    if(NULL == it)
+        return NULL;
+
+    it->container = c;
+    (int)(it->context) = 0;
+
+    it->first = netsnmp_binary_array_iterator_first;
+    it->next = netsnmp_binary_array_iterator_next;
+    it->last = netsnmp_binary_array_iterator_last;
+    it->position = NULL;/*netsnmp_binary_array_iterator_position;*/
+}
+#endif
diff -Naur tomato/release/src/router/snmp/snmplib/container.c tomato121/release/src/router/snmp/snmplib/container.c
--- tomato/release/src/router/snmp/snmplib/container.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/snmplib/container.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,331 @@
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/library/container.h>
+#include <net-snmp/library/container_binary_array.h>
+
+/*------------------------------------------------------------------
+ */
+static netsnmp_container *containers = NULL;
+
+typedef struct container_type_s {
+   const char                 *name;
+   netsnmp_factory            *factory;
+} container_type;
+
+
+/*------------------------------------------------------------------
+ */
+void
+netsnmp_container_init_list(void)
+{
+    container_type *ct;
+    
+    if (NULL != containers)
+        return;
+
+    containers = netsnmp_container_get_binary_array();
+    containers->compare = netsnmp_compare_cstring;
+
+    /*
+     */
+    ct = SNMP_MALLOC_TYPEDEF(container_type);
+    if (NULL == ct)
+        return;
+    ct->name = "binary_array";
+    ct->factory = netsnmp_container_get_binary_array_factory();
+    CONTAINER_INSERT(containers, ct);
+
+    netsnmp_container_register("table_container", ct->factory);
+}
+
+int
+netsnmp_container_register(const char* name, netsnmp_factory *f)
+{
+    container_type *ct, tmp;
+
+    tmp.name = name;
+    ct = CONTAINER_FIND(containers, &tmp);
+    if (NULL!=ct) {
+        DEBUGMSGT(("container_registry",
+                   "replacing previous container factory\n"));
+        ct->factory = f;
+    }
+    else {
+        ct = SNMP_MALLOC_TYPEDEF(container_type);
+        if (NULL == ct)
+            return -1;
+        ct->name = strdup(name);
+        ct->factory = f;
+        CONTAINER_INSERT(containers, ct);
+    }
+    DEBUGMSGT(("container_registry", "registered container factory %s (%s)\n",
+               ct->name, f->product));
+
+    return 0;
+}
+
+/*------------------------------------------------------------------
+ */
+netsnmp_factory *
+netsnmp_container_get_factory(const char *type)
+{
+    container_type ct, *found;
+    
+    ct.name = type;
+    found = CONTAINER_FIND(containers, &ct);
+
+    return found ? found->factory : NULL;
+}
+
+netsnmp_factory *
+netsnmp_container_find_factory(const char *type_list)
+{
+    netsnmp_factory   *f = NULL;
+    char              *list, *entry;
+
+    if (NULL==type_list)
+        return NULL;
+
+    list = strdup(type_list);
+    entry = strtok(list, ":");
+    while(entry) {
+        f = netsnmp_container_get_factory(entry);
+        if (NULL != f)
+            break;
+        entry = strtok(NULL, ":");
+    }
+
+    free(list);
+    return f;
+}
+
+/*------------------------------------------------------------------
+ */
+netsnmp_container *
+netsnmp_container_get(const char *type)
+{
+    netsnmp_factory *f = netsnmp_container_get_factory(type);
+    if (f)
+        return f->produce();
+
+    return NULL;
+}
+
+int
+netsnmp_container_get_noalloc(const char *type, netsnmp_container *mem)
+{
+    netsnmp_factory *f = netsnmp_container_get_factory(type);
+    if (f)
+        return f->produce_noalloc(mem);
+
+    return FACTORY_NOTFOUND;
+}
+
+/*------------------------------------------------------------------
+ */
+netsnmp_container *
+netsnmp_container_find(const char *type)
+{
+    netsnmp_factory *f = netsnmp_container_find_factory(type);
+    if (f)
+        return f->produce();
+
+    return NULL;
+}
+
+int
+netsnmp_container_find_noalloc(const char *type, netsnmp_container *mem)
+{
+    netsnmp_factory *f = netsnmp_container_find_factory(type);
+    if (f)
+        return f->produce_noalloc(mem);
+
+    return FACTORY_NOTFOUND;
+}
+
+/*------------------------------------------------------------------
+ */
+void
+netsnmp_container_add_index(netsnmp_container *primary,
+                            netsnmp_container *new_index)
+{
+    while(primary->next)
+        primary = primary->next;
+
+    primary->next = new_index;
+}
+
+#ifdef NETSNMP_NO_INLINE /* default is to inline */
+
+/*------------------------------------------------------------------
+ * These functions should EXACTLY match the inline version in
+ * container.h. If you chance one, change them both.
+ */
+int CONTAINER_INSERT(netsnmp_container *x, const void *k)
+{
+    int rc;
+
+    rc = x->insert(x,k);
+    if (NULL != x->next) {
+        netsnmp_container *tmp = x->next;
+        int                rc2;
+        while(tmp) {
+            rc2 = tmp->insert(tmp,k);
+            if (rc2)
+                snmp_log(LOG_ERR,"error on subcontainer insert (%d)\n", rc2);
+            tmp = tmp->next;
+        }
+    }
+    return rc;
+}
+
+/*------------------------------------------------------------------
+ * These functions should EXACTLY match the inline version in
+ * container.h. If you chance one, change them both.
+ */
+int CONTAINER_REMOVE(netsnmp_container *x, const void *k)
+{
+    if (NULL != x->next) {
+        netsnmp_container *tmp = x->next;
+        int                rc;
+        while(tmp->next)
+            tmp = tmp->next;
+        while(tmp) {
+            rc = tmp->remove(tmp,k);
+            if (rc)
+                snmp_log(LOG_ERR,"error on subcontainer remove (%d)\n", rc);
+            tmp = tmp->prev;
+        }
+    }
+    return x->remove(x,k);
+}
+
+/*------------------------------------------------------------------
+ * These functions should EXACTLY match the inline version in
+ * container.h. If you chance one, change them both.
+ */
+int CONTAINER_FREE(netsnmp_container *x)
+{
+    if (NULL != x->next) {
+        netsnmp_container *prev, *tmp = x->next;
+        int                rc;
+        while(tmp->next)
+            tmp = tmp->next;
+        while(tmp) {
+            prev = tmp->prev;
+            rc = tmp->cfree(tmp);
+            if (rc)
+                snmp_log(LOG_ERR,"error on subcontainer free (%d)\n", rc);
+            tmp = prev;
+        }
+    }
+    return x->cfree(x);
+}
+#endif
+
+
+/*------------------------------------------------------------------
+ */
+void
+netsnmp_init_container(netsnmp_container         *c,
+                       netsnmp_container_rc      *init,
+                       netsnmp_container_rc      *cfree,
+                       netsnmp_container_size    *size,
+                       netsnmp_container_compare *cmp,
+                       netsnmp_container_op      *ins,
+                       netsnmp_container_op      *rem,
+                       netsnmp_container_rtn     *fnd)
+{
+    if (c == NULL)
+        return;
+
+    c->init = init;
+    c->cfree = cfree;
+    c->get_size = size;
+    c->compare = cmp;
+    c->insert = ins;
+    c->remove = rem;
+    c->find = fnd;
+}
+
+/*------------------------------------------------------------------
+ *
+ * simple comparison routines
+ *
+ */
+int
+netsnmp_compare_netsnmp_index(const void *lhs, const void *rhs)
+{
+    int rc;
+#ifndef NDEBUG
+    DEBUGIF("compare:index") {
+        DEBUGMSGT(("compare:index", "compare "));
+        DEBUGMSGOID(("compare:index", ((const netsnmp_index *) lhs)->oids,
+                     ((const netsnmp_index *) lhs)->len));
+        DEBUGMSG(("compare:index", " to "));
+        DEBUGMSGOID(("compare:index", ((const netsnmp_index *) rhs)->oids,
+                     ((const netsnmp_index *) rhs)->len));
+        DEBUGMSG(("compare:index", "\n"));
+    }
+#endif
+    rc = snmp_oid_compare(((const netsnmp_index *) lhs)->oids,
+                          ((const netsnmp_index *) lhs)->len,
+                          ((const netsnmp_index *) rhs)->oids,
+                          ((const netsnmp_index *) rhs)->len);
+    return rc;
+}
+
+int
+netsnmp_ncompare_netsnmp_index(const void *lhs, const void *rhs)
+{
+    int rc;
+#ifndef NDEBUG
+    DEBUGIF("compare:index") {
+        DEBUGMSGT(("compare:index", "compare "));
+        DEBUGMSGOID(("compare:index", ((const netsnmp_index *) lhs)->oids,
+                     ((const netsnmp_index *) lhs)->len));
+        DEBUGMSG(("compare:index", " to "));
+        DEBUGMSGOID(("compare:index", ((const netsnmp_index *) rhs)->oids,
+                     ((const netsnmp_index *) rhs)->len));
+        DEBUGMSG(("compare:index", "\n"));
+    }
+#endif
+    rc = snmp_oid_ncompare(((const netsnmp_index *) lhs)->oids,
+                           ((const netsnmp_index *) lhs)->len,
+                           ((const netsnmp_index *) rhs)->oids,
+                           ((const netsnmp_index *) rhs)->len,
+                           ((const netsnmp_index *) rhs)->len);
+    return rc;
+}
+
+int
+netsnmp_compare_cstring(const void * lhs, const void * rhs)
+{
+    return strcmp(((const container_type*)lhs)->name,
+                  ((const container_type*)rhs)->name);
+}
+
+int
+netsnmp_ncompare_cstring(const void * lhs, const void * rhs)
+{
+    return strncmp(((const container_type*)lhs)->name,
+                   ((const container_type*)rhs)->name,
+                   strlen(((const container_type*)rhs)->name));
+}
+
+int
+netsnmp_compare_mem(const char * lhs, size_t lhs_len,
+                    const char * rhs, size_t rhs_len)
+{
+    int rc, min = SNMP_MIN(lhs_len, rhs_len);
+
+    rc = memcmp(lhs, rhs, min);
+    if((rc==0) && (lhs_len != rhs_len)) {
+        if(lhs_len < rhs_len)
+            rc = -1;
+        else
+            rc = 1;
+    }
+
+    return rc;
+}
diff -Naur tomato/release/src/router/snmp/snmplib/.cvsignore tomato121/release/src/router/snmp/snmplib/.cvsignore
--- tomato/release/src/router/snmp/snmplib/.cvsignore	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/snmplib/.cvsignore	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,5 @@
+Makefile
+.libs
+*.lo
+*.la
+snmpsm_init.h
diff -Naur tomato/release/src/router/snmp/snmplib/data_list.c tomato121/release/src/router/snmp/snmplib/data_list.c
--- tomato/release/src/router/snmp/snmplib/data_list.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/snmplib/data_list.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,128 @@
+/*
+ * netsnmp_data_list.c
+ *
+ * $Id: data_list.c,v 1.1.2.1 2004/06/20 21:55:00 nikki Exp $
+ */
+#include <net-snmp/net-snmp-config.h>
+#include <sys/types.h>
+#include <stdlib.h>
+
+#if HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+
+#if HAVE_DMALLOC_H
+#include <dmalloc.h>
+#endif
+
+#include <net-snmp/library/data_list.h>
+
+/***********************************************************************/
+/*
+ * New Handler based API 
+ */
+/***********************************************************************/
+
+NETSNMP_INLINE void
+netsnmp_free_list_data(netsnmp_data_list *node)
+{
+    Netsnmp_Free_List_Data *beer;
+    if (!node)
+        return;
+
+    beer = node->free_func;
+    if (beer)
+        (beer) (node->data);
+    SNMP_FREE(node->name);
+}
+
+NETSNMP_INLINE void
+netsnmp_free_all_list_data(netsnmp_data_list *head)
+{
+    netsnmp_data_list *tmpptr;
+    for (; head;) {
+        netsnmp_free_list_data(head);
+        tmpptr = head;
+        head = head->next;
+        SNMP_FREE(tmpptr);
+    }
+}
+
+NETSNMP_INLINE netsnmp_data_list *
+netsnmp_create_data_list(const char *name, void *data,
+                         Netsnmp_Free_List_Data * beer)
+{
+    netsnmp_data_list *node = SNMP_MALLOC_TYPEDEF(netsnmp_data_list);
+    if (!node)
+        return NULL;
+    node->name = strdup(name);
+    node->data = data;
+    node->free_func = beer;
+    return node;
+}
+
+
+NETSNMP_INLINE void
+netsnmp_add_list_data(netsnmp_data_list **head, netsnmp_data_list *node)
+{
+    netsnmp_data_list *ptr;
+    if (!*head) {
+        *head = node;
+        return;
+    }
+
+    /*
+     * xxx-rks: check for duplicate names? 
+     */
+    for (ptr = *head; ptr->next != NULL; ptr = ptr->next) {
+        /*
+         * noop 
+         */
+    }
+
+    if (ptr)                    /* should always be true */
+        ptr->next = node;
+}
+
+NETSNMP_INLINE void    *
+netsnmp_get_list_data(netsnmp_data_list *head, const char *name)
+{
+    for (; head; head = head->next)
+        if (head->name && strcmp(head->name, name) == 0)
+            break;
+    if (head)
+        return head->data;
+    return NULL;
+}
+
+NETSNMP_INLINE void    *
+netsnmp_get_list_node(netsnmp_data_list *head, const char *name)
+{
+    for (; head; head = head->next)
+        if (head->name && strcmp(head->name, name) == 0)
+            break;
+    if (head)
+        return head;
+    return NULL;
+}
+
+int
+netsnmp_remove_list_node(netsnmp_data_list **realhead, const char *name)
+{
+    netsnmp_data_list *head, *prev;
+    for (head = *realhead, prev = NULL; head;
+         prev = head, head = head->next) {
+        if (head->name && strcmp(head->name, name) == 0) {
+            if (prev)
+                prev->next = head->next;
+            else
+                *realhead = head->next;
+            netsnmp_free_list_data(head);
+            free(head);
+            return 0;
+        }
+    }
+    return 1;
+}
diff -Naur tomato/release/src/router/snmp/snmplib/default_store.c tomato121/release/src/router/snmp/snmplib/default_store.c
--- tomato/release/src/router/snmp/snmplib/default_store.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/snmplib/default_store.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,398 @@
+/*
+ * default_store.h: storage space for defaults 
+ */
+
+#include <net-snmp/net-snmp-config.h>
+#include <sys/types.h>
+#if HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#if HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+#if HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#if HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+#if HAVE_WINSOCK_H
+#include <winsock.h>
+#endif
+
+#if HAVE_DMALLOC_H
+#include <dmalloc.h>
+#endif
+
+#include <net-snmp/types.h>
+#include <net-snmp/output_api.h>
+#include <net-snmp/config_api.h>
+#include <net-snmp/library/default_store.h>    /* for "internal" definitions */
+#include <net-snmp/utilities.h>
+
+#include <net-snmp/library/snmp_api.h>
+
+static const char * stores [NETSNMP_DS_MAX_IDS] = { "LIB", "APP", "TOK" };
+
+typedef struct netsnmp_ds_read_config_s {
+  u_char          type;
+  char           *token;
+  char           *ftype;
+  int             storeid;
+  int             which;
+  struct netsnmp_ds_read_config_s *next;
+} netsnmp_ds_read_config;
+
+static netsnmp_ds_read_config *netsnmp_ds_configs = NULL;
+
+static int   netsnmp_ds_integers[NETSNMP_DS_MAX_IDS][NETSNMP_DS_MAX_SUBIDS];
+static char  netsnmp_ds_booleans[NETSNMP_DS_MAX_IDS][NETSNMP_DS_MAX_SUBIDS/8];
+static char *netsnmp_ds_strings[NETSNMP_DS_MAX_IDS][NETSNMP_DS_MAX_SUBIDS];
+static void *netsnmp_ds_voids[NETSNMP_DS_MAX_IDS][NETSNMP_DS_MAX_SUBIDS];
+
+/*
+ * Prototype definitions 
+ */
+void            netsnmp_ds_handle_config(const char *token, char *line);
+
+int
+netsnmp_ds_set_boolean(int storeid, int which, int value)
+{
+    if (storeid < 0 || storeid >= NETSNMP_DS_MAX_IDS || 
+	which   < 0 || which   >= NETSNMP_DS_MAX_SUBIDS) {
+        return SNMPERR_GENERR;
+    }
+
+    DEBUGMSGTL(("netsnmp_ds_set_boolean", "Setting %s:%d = %d/%s\n",
+                stores[storeid], which, value, ((value) ? "True" : "False")));
+
+    if (value > 0) {
+        netsnmp_ds_booleans[storeid][which/8] |= (1 << (which % 8));
+    } else {
+        netsnmp_ds_booleans[storeid][which/8] &= (0xff7f >> (7 - (which % 8)));
+    }
+
+    return SNMPERR_SUCCESS;
+}
+
+int
+netsnmp_ds_toggle_boolean(int storeid, int which)
+{
+    if (storeid < 0 || storeid >= NETSNMP_DS_MAX_IDS || 
+	which   < 0 || which   >= NETSNMP_DS_MAX_SUBIDS) {
+        return SNMPERR_GENERR;
+    }
+
+    if ((netsnmp_ds_booleans[storeid][which/8] & (1 << (which % 8))) == 0) {
+        netsnmp_ds_booleans[storeid][which/8] |= (1 << (which % 8));
+    } else {
+        netsnmp_ds_booleans[storeid][which/8] &= (0xff7f >> (7 - (which % 8)));
+    }
+
+    DEBUGMSGTL(("netsnmp_ds_toggle_boolean", "Setting %s:%d = %d/%s\n",
+                stores[storeid], which, netsnmp_ds_booleans[storeid][which/8],
+                ((netsnmp_ds_booleans[storeid][which/8]) ? "True" : "False")));
+
+    return SNMPERR_SUCCESS;
+}
+
+int
+netsnmp_ds_get_boolean(int storeid, int which)
+{
+    if (storeid < 0 || storeid >= NETSNMP_DS_MAX_IDS || 
+	which   < 0 || which   >= NETSNMP_DS_MAX_SUBIDS) {
+        return SNMPERR_GENERR;
+    }
+
+    return (netsnmp_ds_booleans[storeid][which/8] & (1 << (which % 8))) ? 1:0;
+}
+
+int
+netsnmp_ds_set_int(int storeid, int which, int value)
+{
+    if (storeid < 0 || storeid >= NETSNMP_DS_MAX_IDS || 
+	which   < 0 || which   >= NETSNMP_DS_MAX_SUBIDS) {
+        return SNMPERR_GENERR;
+    }
+
+    DEBUGMSGTL(("netsnmp_ds_set_int", "Setting %s:%d = %d\n",
+                stores[storeid], which, value));
+
+    netsnmp_ds_integers[storeid][which] = value;
+    return SNMPERR_SUCCESS;
+}
+
+int
+netsnmp_ds_get_int(int storeid, int which)
+{
+    if (storeid < 0 || storeid >= NETSNMP_DS_MAX_IDS || 
+	which   < 0 || which   >= NETSNMP_DS_MAX_SUBIDS) {
+        return SNMPERR_GENERR;
+    }
+
+    return netsnmp_ds_integers[storeid][which];
+}
+
+int
+netsnmp_ds_set_string(int storeid, int which, const char *value)
+{
+    if (storeid < 0 || storeid >= NETSNMP_DS_MAX_IDS || 
+	which   < 0 || which   >= NETSNMP_DS_MAX_SUBIDS) {
+        return SNMPERR_GENERR;
+    }
+
+    DEBUGMSGTL(("netsnmp_ds_set_string", "Setting %s:%d = \"%s\"\n",
+                stores[storeid], which, (value ? value : "(null)")));
+
+    /*
+     * is some silly person is calling us with our own pointer?
+     */
+    if (netsnmp_ds_strings[storeid][which] == value)
+        return SNMPERR_SUCCESS;
+    
+    if (netsnmp_ds_strings[storeid][which] != NULL) {
+        free(netsnmp_ds_strings[storeid][which]);
+	netsnmp_ds_strings[storeid][which] = NULL;
+    }
+
+    if (value) {
+        netsnmp_ds_strings[storeid][which] = strdup(value);
+    } else {
+        netsnmp_ds_strings[storeid][which] = NULL;
+    }
+
+    return SNMPERR_SUCCESS;
+}
+
+char *
+netsnmp_ds_get_string(int storeid, int which)
+{
+    if (storeid < 0 || storeid >= NETSNMP_DS_MAX_IDS || 
+	which   < 0 || which   >= NETSNMP_DS_MAX_SUBIDS) {
+        return NULL;
+    }
+
+    return netsnmp_ds_strings[storeid][which];
+}
+
+int
+netsnmp_ds_set_void(int storeid, int which, void *value)
+{
+    if (storeid < 0 || storeid >= NETSNMP_DS_MAX_IDS || 
+	which   < 0 || which   >= NETSNMP_DS_MAX_SUBIDS) {
+        return SNMPERR_GENERR;
+    }
+
+    DEBUGMSGTL(("netsnmp_ds_set_void", "Setting %s:%d = %x\n",
+                stores[storeid], which, value));
+
+    netsnmp_ds_voids[storeid][which] = value;
+
+    return SNMPERR_SUCCESS;
+}
+
+void *
+netsnmp_ds_get_void(int storeid, int which)
+{
+    if (storeid < 0 || storeid >= NETSNMP_DS_MAX_IDS || 
+	which   < 0 || which   >= NETSNMP_DS_MAX_SUBIDS) {
+        return NULL;
+    }
+
+    return netsnmp_ds_voids[storeid][which];
+}
+
+void
+netsnmp_ds_handle_config(const char *token, char *line)
+{
+    netsnmp_ds_read_config *drsp;
+    char            buf[SNMP_MAXBUF];
+    char           *value, *endptr;
+    int             itmp;
+
+    DEBUGMSGTL(("netsnmp_ds_handle_config", "handling %s\n", token));
+
+    for (drsp = netsnmp_ds_configs;
+         drsp != NULL && strcasecmp(token, drsp->token) != 0;
+         drsp = drsp->next);
+
+    if (drsp != NULL) {
+        DEBUGMSGTL(("netsnmp_ds_handle_config",
+                    "setting: token=%s, type=%d, id=%s, which=%d\n",
+                    drsp->token, drsp->type, stores[drsp->storeid],
+                    drsp->which));
+
+        switch (drsp->type) {
+        case ASN_BOOLEAN:
+            value = strtok(line, " \t\n");
+            if (strcasecmp(value, "yes") == 0 || 
+		strcasecmp(value, "true") == 0) {
+                itmp = 1;
+            } else if (strcasecmp(value, "no") == 0 ||
+		       strcasecmp(value, "false") == 0) {
+                itmp = 0;
+            } else {
+                itmp = strtol(value, &endptr, 10);
+                if (*endptr != 0 || itmp < 0 || itmp > 1) {
+                    config_perror("Should be yes|no|true|false|0|1");
+		}
+            }
+            netsnmp_ds_set_boolean(drsp->storeid, drsp->which, itmp);
+            DEBUGMSGTL(("netsnmp_ds_handle_config", "bool: %d\n", itmp));
+            break;
+
+        case ASN_INTEGER:
+            value = strtok(line, " \t\n");
+            itmp = strtol(value, &endptr, 10);
+            if (*endptr != 0) {
+                config_perror("Bad integer value");
+	    } else {
+                netsnmp_ds_set_int(drsp->storeid, drsp->which, itmp);
+	    }
+            DEBUGMSGTL(("netsnmp_ds_handle_config", "int: %d\n", itmp));
+            break;
+
+        case ASN_OCTET_STR:
+            if (*line == '"') {
+                copy_nword(line, buf, sizeof(buf));
+                netsnmp_ds_set_string(drsp->storeid, drsp->which, buf);
+            } else {
+                netsnmp_ds_set_string(drsp->storeid, drsp->which, line);
+            }
+            DEBUGMSGTL(("netsnmp_ds_handle_config", "string: %s\n", line));
+            break;
+
+        default:
+            snmp_log(LOG_ERR, "netsnmp_ds_handle_config: type %d (0x%02x)\n",
+                     drsp->type, drsp->type);
+            break;
+        }
+    } else {
+        snmp_log(LOG_ERR, "netsnmp_ds_handle_config: no registration for %s\n",
+                 token);
+    }
+}
+
+
+int
+netsnmp_ds_register_config(u_char type, const char *ftype, const char *token,
+			   int storeid, int which)
+{
+    netsnmp_ds_read_config *drsp;
+
+    if (storeid < 0 || storeid >= NETSNMP_DS_MAX_IDS    || 
+	which   < 0 || which   >= NETSNMP_DS_MAX_SUBIDS || token == NULL) {
+        return SNMPERR_GENERR;
+    }
+
+    if (netsnmp_ds_configs == NULL) {
+        netsnmp_ds_configs = SNMP_MALLOC_TYPEDEF(netsnmp_ds_read_config);
+        drsp = netsnmp_ds_configs;
+    } else {
+        for (drsp = netsnmp_ds_configs; drsp->next != NULL; drsp = drsp->next);
+        drsp->next = SNMP_MALLOC_TYPEDEF(netsnmp_ds_read_config);
+        drsp = drsp->next;
+    }
+
+    drsp->type    = type;
+    drsp->ftype   = strdup(ftype);
+    drsp->token   = strdup(token);
+    drsp->storeid = storeid;
+    drsp->which   = which;
+
+    switch (type) {
+    case ASN_BOOLEAN:
+        register_config_handler(ftype, token, netsnmp_ds_handle_config, NULL,
+                                "(1|yes|true|0|no|false)");
+        break;
+
+    case ASN_INTEGER:
+        register_config_handler(ftype, token, netsnmp_ds_handle_config, NULL,
+                                "integerValue");
+        break;
+
+    case ASN_OCTET_STR:
+        register_config_handler(ftype, token, netsnmp_ds_handle_config, NULL,
+                                "string");
+        break;
+
+    }
+    return SNMPERR_SUCCESS;
+}
+
+int
+netsnmp_ds_register_premib(u_char type, const char *ftype, const char *token,
+			   int storeid, int which)
+{
+    netsnmp_ds_read_config *drsp;
+
+    if (storeid < 0 || storeid >= NETSNMP_DS_MAX_IDS    || 
+	which   < 0 || which   >= NETSNMP_DS_MAX_SUBIDS || token == NULL) {
+        return SNMPERR_GENERR;
+    }
+
+    if (netsnmp_ds_configs == NULL) {
+        netsnmp_ds_configs = SNMP_MALLOC_TYPEDEF(netsnmp_ds_read_config);
+        drsp = netsnmp_ds_configs;
+    } else {
+        for (drsp = netsnmp_ds_configs; drsp->next != NULL; drsp = drsp->next);
+        drsp->next = SNMP_MALLOC_TYPEDEF(netsnmp_ds_read_config);
+        drsp = drsp->next;
+    }
+
+    drsp->type    = type;
+    drsp->ftype   = strdup(ftype);
+    drsp->token   = strdup(token);
+    drsp->storeid = storeid;
+    drsp->which   = which;
+
+    switch (type) {
+    case ASN_BOOLEAN:
+        register_prenetsnmp_mib_handler(ftype, token, netsnmp_ds_handle_config,
+                                        NULL, "(1|yes|true|0|no|false)");
+        break;
+
+    case ASN_INTEGER:
+        register_prenetsnmp_mib_handler(ftype, token, netsnmp_ds_handle_config,
+                                        NULL, "integerValue");
+        break;
+
+    case ASN_OCTET_STR:
+        register_prenetsnmp_mib_handler(ftype, token, netsnmp_ds_handle_config,
+                                        NULL, "string");
+        break;
+
+    }
+    return SNMPERR_SUCCESS;
+}
+
+void
+netsnmp_ds_shutdown()
+{
+    netsnmp_ds_read_config *drsp;
+    int             i, j;
+
+    for (drsp = netsnmp_ds_configs; drsp; drsp = netsnmp_ds_configs) {
+        netsnmp_ds_configs = drsp->next;
+
+        unregister_config_handler(drsp->ftype, drsp->token);
+	if (drsp->ftype != NULL) {
+	    free(drsp->ftype);
+	}
+	if (drsp->token != NULL) {
+	    free(drsp->token);
+	}
+        free(drsp);
+    }
+
+    for (i = 0; i < NETSNMP_DS_MAX_IDS; i++) {
+        for (j = 0; j < NETSNMP_DS_MAX_SUBIDS; j++) {
+            if (netsnmp_ds_strings[i][j] != NULL) {
+                free(netsnmp_ds_strings[i][j]);
+                netsnmp_ds_strings[i][j] = NULL;
+            }
+        }
+    }
+}
diff -Naur tomato/release/src/router/snmp/snmplib/getopt.c tomato121/release/src/router/snmp/snmplib/getopt.c
--- tomato/release/src/router/snmp/snmplib/getopt.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/snmplib/getopt.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,122 @@
+/*
+ * Copyright (c) 1987, 1993, 1994
+ *      The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *      This product includes software developed by the University of
+ *      California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#if defined(LIBC_SCCS) && !defined(lint)
+/*
+ * static char sccsid[] = "from: @(#)getopt.c   8.2 (Berkeley) 4/2/94"; 
+ */
+static char    *rcsid =
+    "$Id: getopt.c,v 1.1.2.1 2004/06/20 21:55:01 nikki Exp $";
+#endif                          /* LIBC_SCCS and not lint */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#ifdef _BSD
+extern char    *__progname;
+#else
+#define __progname "getopt"
+#endif
+
+int             opterr = 1,     /* if error message should be printed */
+                optind = 1,     /* index into parent argv vector */
+                optopt,         /* character checked for validity */
+                optreset;       /* reset getopt */
+char           *optarg;         /* argument associated with option */
+char            EMSG[] = "";
+
+#define	BADCH	(int)'?'
+#define	BADARG	(int)':'
+
+/*
+ * getopt --
+ *      Parse argc/argv argument vector.
+ */
+int
+getopt(int nargc, char *const *nargv, const char *ostr)
+{
+    static char    *place = EMSG;       /* option letter processing */
+    char           *oli;        /* option letter list index */
+
+    if (optreset || !*place) {  /* update scanning pointer */
+        optreset = 0;
+        if (optind >= nargc || *(place = nargv[optind]) != '-') {
+            place = EMSG;
+            return (-1);
+        }
+        if (place[1] && *++place == '-') {      /* found "--" */
+            ++optind;
+            place = EMSG;
+            return (-1);
+        }
+    }                           /* option letter okay? */
+    if ((optopt = (int) *place++) == (int) ':' ||
+        !(oli = strchr(ostr, optopt))) {
+        /*
+         * if the user didn't specify '-' as an option,
+         * assume it means -1.
+         */
+        if (optopt == (int) '-')
+            return (-1);
+        if (!*place)
+            ++optind;
+        if (opterr && *ostr != ':')
+            (void) fprintf(stderr,
+                           "%s: illegal option -- %c\n", __progname,
+                           optopt);
+        return (BADCH);
+    }
+    if (*++oli != ':') {        /* don't need argument */
+        optarg = NULL;
+        if (!*place)
+            ++optind;
+    } else {                    /* need an argument */
+        if (*place)             /* no white space */
+            optarg = place;
+        else if (nargc <= ++optind) {   /* no arg */
+            place = EMSG;
+            if (*ostr == ':')
+                return (BADARG);
+            if (opterr)
+                (void) fprintf(stderr,
+                               "%s: option requires an argument -- %c\n",
+                               __progname, optopt);
+            return (BADCH);
+        } else                  /* white space */
+            optarg = nargv[optind];
+        place = EMSG;
+        ++optind;
+    }
+    return (optopt);            /* dump back option letter */
+}
diff -Naur tomato/release/src/router/snmp/snmplib/int64.c tomato121/release/src/router/snmp/snmplib/int64.c
--- tomato/release/src/router/snmp/snmplib/int64.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/snmplib/int64.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,389 @@
+/** file: test.c - test of 64-bit integer stuff
+*
+*
+* 21-jan-1998: David Perkins <dperkins@dsperkins.com>
+*
+*/
+
+#include <net-snmp/net-snmp-config.h>
+#include <sys/types.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <ctype.h>
+#if HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+#if HAVE_WINSOCK_H
+#include <winsock.h>
+#endif
+
+#include <net-snmp/types.h>
+#include <net-snmp/library/int64.h>
+
+#define TRUE 1
+#define FALSE 0
+
+/** divBy10 - divide an unsigned 64-bit integer by 10
+*
+* call with:
+*   u64 - number to be divided
+*   pu64Q - location to store quotient
+*   puR - location to store remainder
+*
+*/
+void
+divBy10(U64 u64, U64 * pu64Q, unsigned int *puR)
+{
+    unsigned long   ulT;
+    unsigned long   ulQ;
+    unsigned long   ulR;
+
+
+    /*
+     * top 16 bits 
+     */
+    ulT = (u64.high >> 16) & 0x0ffff;
+    ulQ = ulT / 10;
+    ulR = ulT % 10;
+    pu64Q->high = ulQ << 16;
+
+    /*
+     * next 16 
+     */
+    ulT = (u64.high & 0x0ffff);
+    ulT += (ulR << 16);
+    ulQ = ulT / 10;
+    ulR = ulT % 10;
+    pu64Q->high = pu64Q->high | ulQ;
+
+    /*
+     * next 16 
+     */
+    ulT = ((u64.low >> 16) & 0x0ffff) + (ulR << 16);
+    ulQ = ulT / 10;
+    ulR = ulT % 10;
+    pu64Q->low = ulQ << 16;
+
+    /*
+     * final 16 
+     */
+    ulT = (u64.low & 0x0ffff);
+    ulT += (ulR << 16);
+    ulQ = ulT / 10;
+    ulR = ulT % 10;
+    pu64Q->low = pu64Q->low | ulQ;
+
+    *puR = (unsigned int) (ulR);
+
+
+}                               /* divBy10 */
+
+
+/** multBy10 - multiply an unsigned 64-bit integer by 10
+*
+* call with:
+*   u64 - number to be multiplied
+*   pu64P - location to store product
+*
+*/
+void
+multBy10(U64 u64, U64 * pu64P)
+{
+    unsigned long   ulT;
+    unsigned long   ulP;
+    unsigned long   ulK;
+
+
+    /*
+     * lower 16 bits 
+     */
+    ulT = u64.low & 0x0ffff;
+    ulP = ulT * 10;
+    ulK = ulP >> 16;
+    pu64P->low = ulP & 0x0ffff;
+
+    /*
+     * next 16 
+     */
+    ulT = (u64.low >> 16) & 0x0ffff;
+    ulP = (ulT * 10) + ulK;
+    ulK = ulP >> 16;
+    pu64P->low = (ulP & 0x0ffff) << 16 | pu64P->low;
+
+    /*
+     * next 16 bits 
+     */
+    ulT = u64.high & 0x0ffff;
+    ulP = (ulT * 10) + ulK;
+    ulK = ulP >> 16;
+    pu64P->high = ulP & 0x0ffff;
+
+    /*
+     * final 16 
+     */
+    ulT = (u64.high >> 16) & 0x0ffff;
+    ulP = (ulT * 10) + ulK;
+    ulK = ulP >> 16;
+    pu64P->high = (ulP & 0x0ffff) << 16 | pu64P->high;
+
+
+}                               /* multBy10 */
+
+
+/** incrByU16 - add an unsigned 16-bit int to an unsigned 64-bit integer
+*
+* call with:
+*   pu64 - number to be incremented
+*   u16 - amount to add
+*
+*/
+void
+incrByU16(U64 * pu64, unsigned int u16)
+{
+    unsigned long   ulT1;
+    unsigned long   ulT2;
+    unsigned long   ulR;
+    unsigned long   ulK;
+
+
+    /*
+     * lower 16 bits 
+     */
+    ulT1 = pu64->low;
+    ulT2 = ulT1 & 0x0ffff;
+    ulR = ulT2 + u16;
+    ulK = ulR >> 16;
+    if (ulK == 0) {
+        pu64->low = ulT1 + u16;
+        return;
+    }
+
+    /*
+     * next 16 bits 
+     */
+    ulT2 = (ulT1 >> 16) & 0x0ffff;
+    ulR = ulT2 + 1;
+    ulK = ulR >> 16;
+    if (ulK == 0) {
+        pu64->low = ulT1 + u16;
+        return;
+    }
+
+    /*
+     * next 32 - ignore any overflow 
+     */
+    pu64->low = (ulT1 + u16) & 0x0FFFFFFFFL;
+    pu64->high++;
+
+}                               /* incrByV16 */
+
+void
+incrByU32(U64 * pu64, unsigned int u32)
+{
+    unsigned int    tmp;
+    tmp = pu64->low;
+    pu64->low += u32;
+    if (pu64->low < tmp)
+        pu64->high++;
+}
+
+/*
+ * pu64out = pu64one - pu64two 
+ */
+void
+u64Subtract(U64 * pu64one, U64 * pu64two, U64 * pu64out)
+{
+    if (pu64one->low < pu64two->low) {
+        pu64out->low = 0xffffffff - pu64two->low + pu64one->low + 1;
+        pu64out->high = pu64one->high - pu64two->high - 1;
+    } else {
+        pu64out->low = pu64one->low - pu64two->low;
+        pu64out->high = pu64one->high - pu64two->high;
+    }
+}
+
+/** zeroU64 - set an unsigned 64-bit number to zero
+*
+* call with:
+*   pu64 - number to be zero'ed
+*
+*/
+void
+zeroU64(U64 * pu64)
+{
+
+    pu64->low = 0;
+    pu64->high = 0;
+}                               /* zeroU64 */
+
+
+/** isZeroU64 - check if an unsigned 64-bit number is
+*
+* call with:
+*   pu64 - number to be zero'ed
+*
+*/
+int
+isZeroU64(U64 * pu64)
+{
+
+    if ((pu64->low == 0) && (pu64->high == 0))
+        return (TRUE);
+    else
+        return (FALSE);
+
+}                               /* isZeroU64 */
+
+void
+                printU64(char *buf,     /* char [I64CHARSZ+1]; */
+                         U64 * pu64) {
+    U64             u64a;
+    U64             u64b;
+
+    char            aRes[I64CHARSZ + 1];
+    unsigned int    u;
+    int             j;
+
+    u64a.high = pu64->high;
+    u64a.low = pu64->low;
+    aRes[I64CHARSZ] = 0;
+    for (j = 0; j < I64CHARSZ; j++) {
+        divBy10(u64a, &u64b, &u);
+        aRes[(I64CHARSZ - 1) - j] = (char) ('0' + u);
+        u64a.high = u64b.high;
+        u64a.low = u64b.low;
+        if (isZeroU64(&u64a))
+            break;
+    }
+    strcpy(buf, &aRes[(I64CHARSZ - 1) - j]);
+}
+
+void
+                printI64(char *buf,     /* char [I64CHARSZ+1]; */
+                         U64 * pu64) {
+    U64             u64a;
+    U64             u64b;
+
+    char            aRes[I64CHARSZ + 1];
+    unsigned int    u;
+    int             j, sign = 0;
+
+    if (pu64->high & 0x80000000) {
+        u64a.high = ~pu64->high;
+        u64a.low = ~pu64->low;
+        sign = 1;
+        incrByU32(&u64a, 1);    /* bit invert and incr by 1 to print 2s complement */
+    } else {
+        u64a.high = pu64->high;
+        u64a.low = pu64->low;
+    }
+
+    aRes[I64CHARSZ] = 0;
+    for (j = 0; j < I64CHARSZ; j++) {
+        divBy10(u64a, &u64b, &u);
+        aRes[(I64CHARSZ - 1) - j] = (char) ('0' + u);
+        u64a.high = u64b.high;
+        u64a.low = u64b.low;
+        if (isZeroU64(&u64a))
+            break;
+    }
+    if (sign == 1) {
+        aRes[(I64CHARSZ - 1) - j - 1] = '-';
+        strcpy(buf, &aRes[(I64CHARSZ - 1) - j - 1]);
+        return;
+    }
+    strcpy(buf, &aRes[(I64CHARSZ - 1) - j]);
+}
+
+int
+read64(U64 * i64, const char *string)
+{
+    U64             i64p;
+    unsigned int    u;
+    int             sign = 0;
+    int             ok = 0;
+
+    zeroU64(i64);
+    if (*string == '-') {
+        sign = 1;
+        string++;
+    }
+
+    while (*string && isdigit(*string)) {
+        ok = 1;
+        u = *string - '0';
+        multBy10(*i64, &i64p);
+        memcpy(i64, &i64p, sizeof(i64p));
+        incrByU16(i64, u);
+        string++;
+    }
+    if (sign) {
+        i64->high = ~i64->high;
+        i64->low = ~i64->low;
+        incrByU16(i64, 1);
+    }
+    return ok;
+}
+
+
+
+
+#ifdef TESTING
+void
+main(int argc, char *argv[])
+{
+    int             i;
+    int             j;
+    int             l;
+    unsigned int    u;
+    U64             u64a;
+    U64             u64b;
+#define MXSZ 20
+    char            aRes[MXSZ + 1];
+
+
+    if (argc < 2) {
+        printf("This program takes numbers from the command line\n"
+               "and prints them out.\n" "Usage: test <unsignedInt>...\n");
+        exit(1);
+    }
+
+    aRes[MXSZ] = 0;
+
+    for (i = 1; i < argc; i++) {
+        l = strlen(argv[i]);
+        zeroU64(&u64a);
+        for (j = 0; j < l; j++) {
+            if (!isdigit(argv[i][j])) {
+                printf("Argument is not a number \"%s\"\n", argv[i]);
+                exit(1);
+            }
+            u = argv[i][j] - '0';
+            multBy10(u64a, &u64b);
+            u64a = u64b;
+            incrByU16(&u64a, u);
+        }
+
+        printf("number \"%s\" in hex is '%08x%08x'h\n",
+               argv[i], u64a.high, u64a.low);
+
+        printf("number is \"%s\"\n", printU64(&u64a));
+        for (j = 0; j < MXSZ; j++) {
+            divBy10(u64a, &u64b, &u);
+            aRes[(MXSZ - 1) - j] = (char) ('0' + u);
+            u64a = u64b;
+            if (isZeroU64(&u64a))
+                break;
+        }
+
+        printf("number is \"%s\"\n", &aRes[(MXSZ - 1) - j]);
+    }
+    exit(0);
+}                               /* main */
+#endif                          /* TESTING */
+
+/*
+ * file: test.c 
+ */
diff -Naur tomato/release/src/router/snmp/snmplib/keytools.c tomato121/release/src/router/snmp/snmplib/keytools.c
--- tomato/release/src/router/snmp/snmplib/keytools.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/snmplib/keytools.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,531 @@
+/*
+ * keytools.c
+ */
+
+#include <net-snmp/net-snmp-config.h>
+
+#include <stdio.h>
+#include <sys/types.h>
+#if HAVE_WINSOCK_H
+#include <winsock.h>
+#endif
+#ifdef HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#if HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+
+#if HAVE_DMALLOC_H
+#include <dmalloc.h>
+#endif
+
+#include <net-snmp/types.h>
+#include <net-snmp/output_api.h>
+#include <net-snmp/utilities.h>
+
+#include <net-snmp/library/snmp_api.h>
+#ifdef USE_OPENSSL
+#	include <openssl/hmac.h>
+#else
+#ifdef USE_INTERNAL_MD5
+#include <net-snmp/library/md5.h>
+#endif
+#endif
+
+#include <net-snmp/library/scapi.h>
+#include <net-snmp/library/keytools.h>
+
+#include <net-snmp/library/transform_oids.h>
+
+/*******************************************************************-o-******
+ * generate_Ku
+ *
+ * Parameters:
+ *	*hashtype	MIB OID for the transform type for hashing.
+ *	 hashtype_len	Length of OID value.
+ *	*P		Pre-allocated bytes of passpharase.
+ *	 pplen		Length of passphrase.
+ *	*Ku		Buffer to contain Ku.
+ *	*kulen		Length of Ku buffer.
+ *      
+ * Returns:
+ *	SNMPERR_SUCCESS			Success.
+ *	SNMPERR_GENERR			All errors.
+ *
+ *
+ * Convert a passphrase into a master user key, Ku, according to the
+ * algorithm given in RFC 2274 concerning the SNMPv3 User Security Model (USM)
+ * as follows:
+ *
+ * Expand the passphrase to fill the passphrase buffer space, if necessary,
+ * concatenation as many duplicates as possible of P to itself.  If P is
+ * larger than the buffer space, truncate it to fit.
+ *
+ * Then hash the result with the given hashtype transform.  Return
+ * the result as Ku.
+ *
+ * If successful, kulen contains the size of the hash written to Ku.
+ *
+ * NOTE  Passphrases less than USM_LENGTH_P_MIN characters in length
+ *	 cause an error to be returned.
+ *	 (Punt this check to the cmdline apps?  XXX)
+ */
+int
+generate_Ku(const oid * hashtype, u_int hashtype_len,
+            u_char * P, size_t pplen, u_char * Ku, size_t * kulen)
+#if defined(USE_INTERNAL_MD5) || defined(USE_OPENSSL)
+{
+    int             rval = SNMPERR_SUCCESS,
+        nbytes = USM_LENGTH_EXPANDED_PASSPHRASE;
+
+    u_int           i, pindex = 0;
+
+    u_char          buf[USM_LENGTH_KU_HASHBLOCK], *bufp;
+
+#ifdef USE_OPENSSL
+    EVP_MD_CTX     *ctx = malloc(sizeof(EVP_MD_CTX));
+#else
+    MDstruct        MD;
+#endif
+    /*
+     * Sanity check.
+     */
+    if (!hashtype || !P || !Ku || !kulen || (*kulen <= 0)
+        || (hashtype_len != USM_LENGTH_OID_TRANSFORM)) {
+        QUITFUN(SNMPERR_GENERR, generate_Ku_quit);
+    }
+
+    if (pplen < USM_LENGTH_P_MIN) {
+        snmp_log(LOG_ERR, "Error: passphrase chosen is below the length "
+                 "requirements of the USM (min=%d).\n",USM_LENGTH_P_MIN);
+        snmp_set_detail("The supplied password length is too short.");
+        QUITFUN(SNMPERR_GENERR, generate_Ku_quit);
+    }
+
+
+    /*
+     * Setup for the transform type.
+     */
+#ifdef USE_OPENSSL
+
+    if (ISTRANSFORM(hashtype, HMACMD5Auth))
+        EVP_DigestInit(ctx, EVP_md5());
+    else if (ISTRANSFORM(hashtype, HMACSHA1Auth))
+        EVP_DigestInit(ctx, EVP_sha1());
+    else {
+        free(ctx);
+        return (SNMPERR_GENERR);
+    }
+#else
+    MDbegin(&MD);
+#endif                          /* USE_OPENSSL */
+
+    while (nbytes > 0) {
+        bufp = buf;
+        for (i = 0; i < USM_LENGTH_KU_HASHBLOCK; i++) {
+            *bufp++ = P[pindex++ % pplen];
+        }
+#ifdef USE_OPENSSL
+        EVP_DigestUpdate(ctx, buf, USM_LENGTH_KU_HASHBLOCK);
+#else
+        if (MDupdate(&MD, buf, USM_LENGTH_KU_HASHBLOCK * 8)) {
+            rval = SNMPERR_USM_ENCRYPTIONERROR;
+            goto md5_fin;
+        }
+#endif                          /* USE_OPENSSL */
+
+        nbytes -= USM_LENGTH_KU_HASHBLOCK;
+    }
+
+#ifdef USE_OPENSSL
+    EVP_DigestFinal(ctx, (unsigned char *) Ku, (unsigned int *) kulen);
+    /*
+     * what about free() 
+     */
+#else
+    if (MDupdate(&MD, buf, 0)) {
+        rval = SNMPERR_USM_ENCRYPTIONERROR;
+        goto md5_fin;
+    }
+    *kulen = sc_get_properlength(hashtype, hashtype_len);
+    MDget(&MD, Ku, *kulen);
+  md5_fin:
+    memset(&MD, 0, sizeof(MD));
+#endif                          /* USE_OPENSSL */
+
+
+#ifdef SNMP_TESTING_CODE
+    DEBUGMSGTL(("generate_Ku", "generating Ku (from %s): ", P));
+    for (i = 0; i < *kulen; i++)
+        DEBUGMSG(("generate_Ku", "%02x", Ku[i]));
+    DEBUGMSG(("generate_Ku", "\n"));
+#endif                          /* SNMP_TESTING_CODE */
+
+
+  generate_Ku_quit:
+    memset(buf, 0, sizeof(buf));
+#ifdef USE_OPENSSL
+    free(ctx);
+#endif
+    return rval;
+
+}                               /* end generate_Ku() */
+
+#else
+_KEYTOOLS_NOT_AVAILABLE
+#endif                          /* internal or openssl */
+/*******************************************************************-o-******
+ * generate_kul
+ *
+ * Parameters:
+ *	*hashtype
+ *	 hashtype_len
+ *	*engineID
+ *	 engineID_len
+ *	*Ku		Master key for a given user.
+ *	 ku_len		Length of Ku in bytes.
+ *	*Kul		Localized key for a given user at engineID.
+ *	*kul_len	Length of Kul buffer (IN); Length of Kul key (OUT).
+ *      
+ * Returns:
+ *	SNMPERR_SUCCESS			Success.
+ *	SNMPERR_GENERR			All errors.
+ *
+ *
+ * Ku MUST be the proper length (currently fixed) for the given hashtype.
+ *
+ * Upon successful return, Kul contains the localized form of Ku at
+ * engineID, and the length of the key is stored in kul_len.
+ *
+ * The localized key method is defined in RFC2274, Sections 2.6 and A.2, and
+ * originally documented in:
+ *  	U. Blumenthal, N. C. Hien, B. Wijnen,
+ *     	"Key Derivation for Network Management Applications",
+ *	IEEE Network Magazine, April/May issue, 1997.
+ *
+ *
+ * ASSUMES  SNMP_MAXBUF >= sizeof(Ku + engineID + Ku).
+ *
+ * NOTE  Localized keys for privacy transforms are generated via
+ *	 the authentication transform held by the same usmUser.
+ *
+ * XXX	An engineID of any length is accepted, even if larger than
+ *	what is spec'ed for the textual convention.
+ */
+int
+generate_kul(const oid * hashtype, u_int hashtype_len,
+             u_char * engineID, size_t engineID_len,
+             u_char * Ku, size_t ku_len,
+             u_char * Kul, size_t * kul_len)
+#if defined(USE_OPENSSL) || defined(USE_INTERNAL_MD5)
+{
+    int             rval = SNMPERR_SUCCESS;
+    u_int           nbytes = 0;
+    size_t          properlength;
+
+    u_char          buf[SNMP_MAXBUF];
+#ifdef SNMP_TESTING_CODE
+    int             i;
+#endif
+
+
+    /*
+     * Sanity check.
+     */
+    if (!hashtype || !engineID || !Ku || !Kul || !kul_len
+        || (engineID_len <= 0) || (ku_len <= 0) || (*kul_len <= 0)
+        || (hashtype_len != USM_LENGTH_OID_TRANSFORM)) {
+        QUITFUN(SNMPERR_GENERR, generate_kul_quit);
+    }
+
+
+    properlength = sc_get_properlength(hashtype, hashtype_len);
+    if (properlength == SNMPERR_GENERR)
+        QUITFUN(SNMPERR_GENERR, generate_kul_quit);
+
+
+    if (((int) *kul_len < properlength) || ((int) ku_len < properlength)) {
+        QUITFUN(SNMPERR_GENERR, generate_kul_quit);
+    }
+
+    /*
+     * Concatenate Ku and engineID properly, then hash the result.
+     * Store it in Kul.
+     */
+    nbytes = 0;
+    memcpy(buf, Ku, properlength);
+    nbytes += properlength;
+    memcpy(buf + nbytes, engineID, engineID_len);
+    nbytes += engineID_len;
+    memcpy(buf + nbytes, Ku, properlength);
+    nbytes += properlength;
+
+    rval = sc_hash(hashtype, hashtype_len, buf, nbytes, Kul, kul_len);
+
+#ifdef SNMP_TESTING_CODE
+    DEBUGMSGTL(("generate_kul", "generating Kul (from Ku): "));
+    for (i = 0; i < *kul_len; i++)
+        DEBUGMSG(("generate_kul", "%02x", Kul[i]));
+    DEBUGMSG(("generate_kul", "keytools\n"));
+#endif                          /* SNMP_TESTING_CODE */
+
+    QUITFUN(rval, generate_kul_quit);
+
+
+  generate_kul_quit:
+    return rval;
+
+}                               /* end generate_kul() */
+
+#else
+_KEYTOOLS_NOT_AVAILABLE
+#endif                          /* internal or openssl */
+/*******************************************************************-o-******
+ * encode_keychange
+ *
+ * Parameters:
+ *	*hashtype	MIB OID for the hash transform type.
+ *	 hashtype_len	Length of the MIB OID hash transform type.
+ *	*oldkey		Old key that is used to encodes the new key.
+ *	 oldkey_len	Length of oldkey in bytes.
+ *	*newkey		New key that is encoded using the old key.
+ *	 newkey_len	Length of new key in bytes.
+ *	*kcstring	Buffer to contain the KeyChange TC string.
+ *	*kcstring_len	Length of kcstring buffer.
+ *      
+ * Returns:
+ *	SNMPERR_SUCCESS			Success.
+ *	SNMPERR_GENERR			All errors.
+ *
+ *
+ * Uses oldkey and acquired random bytes to encode newkey into kcstring
+ * according to the rules of the KeyChange TC described in RFC 2274, Section 5.
+ *
+ * Upon successful return, *kcstring_len contains the length of the
+ * encoded string.
+ *
+ * ASSUMES	Old and new key are always equal to each other, although
+ *		this may be less than the transform type hash output
+ * 		output length (eg, using KeyChange for a DESPriv key when
+ *		the user also uses SHA1Auth).  This also implies that the
+ *		hash placed in the second 1/2 of the key change string
+ *		will be truncated before the XOR'ing when the hash output is 
+ *		larger than that 1/2 of the key change string.
+ *
+ *		*kcstring_len will be returned as exactly twice that same
+ *		length though the input buffer may be larger.
+ *
+ * XXX FIX:     Does not handle varibable length keys.
+ * XXX FIX:     Does not handle keys larger than the hash algorithm used.
+ */
+int
+encode_keychange(const oid * hashtype, u_int hashtype_len,
+                 u_char * oldkey, size_t oldkey_len,
+                 u_char * newkey, size_t newkey_len,
+                 u_char * kcstring, size_t * kcstring_len)
+#if defined(USE_OPENSSL) || defined(USE_INTERNAL_MD5)
+{
+    int             rval = SNMPERR_SUCCESS;
+    size_t          properlength;
+    size_t          nbytes = 0;
+
+    u_char         *tmpbuf = NULL;
+
+
+    /*
+     * Sanity check.
+     */
+    if (!hashtype || !oldkey || !newkey || !kcstring || !kcstring_len
+        || (oldkey_len <= 0) || (newkey_len <= 0) || (*kcstring_len <= 0)
+        || (hashtype_len != USM_LENGTH_OID_TRANSFORM)) {
+        QUITFUN(SNMPERR_GENERR, encode_keychange_quit);
+    }
+
+    /*
+     * Setup for the transform type.
+     */
+    properlength = sc_get_properlength(hashtype, hashtype_len);
+    if (properlength == SNMPERR_GENERR)
+        QUITFUN(SNMPERR_GENERR, encode_keychange_quit);
+
+    if ((oldkey_len != newkey_len) || (*kcstring_len < (2 * oldkey_len))) {
+        QUITFUN(SNMPERR_GENERR, encode_keychange_quit);
+    }
+
+    properlength = SNMP_MIN((int) oldkey_len, properlength);
+
+    /*
+     * Use the old key and some random bytes to encode the new key
+     * in the KeyChange TC format:
+     *      . Get random bytes (store in first half of kcstring),
+     *      . Hash (oldkey | random_bytes) (into second half of kcstring),
+     *      . XOR hash and newkey (into second half of kcstring).
+     *
+     * Getting the wrong number of random bytes is considered an error.
+     */
+    nbytes = properlength;
+
+#if defined(SNMP_TESTING_CODE) && defined(RANDOMZEROS)
+    memset(kcstring, 0, nbytes);
+    DEBUGMSG(("encode_keychange",
+              "** Using all zero bits for \"random\" delta of )"
+              "the keychange string! **\n"));
+#else                           /* !SNMP_TESTING_CODE */
+    rval = sc_random(kcstring, &nbytes);
+    QUITFUN(rval, encode_keychange_quit);
+    if ((int) nbytes != properlength) {
+        QUITFUN(SNMPERR_GENERR, encode_keychange_quit);
+    }
+#endif                          /* !SNMP_TESTING_CODE */
+
+    tmpbuf = (u_char *) malloc(properlength * 2);
+    if (tmpbuf) {
+        memcpy(tmpbuf, oldkey, properlength);
+        memcpy(tmpbuf + properlength, kcstring, properlength);
+
+        *kcstring_len -= properlength;
+        rval = sc_hash(hashtype, hashtype_len, tmpbuf, properlength * 2,
+                       kcstring + properlength, kcstring_len);
+
+        QUITFUN(rval, encode_keychange_quit);
+
+        *kcstring_len = (properlength * 2);
+
+        kcstring += properlength;
+        nbytes = 0;
+        while ((int) (nbytes++) < properlength) {
+            *kcstring++ ^= *newkey++;
+        }
+    }
+
+  encode_keychange_quit:
+    if (rval != SNMPERR_SUCCESS)
+        memset(kcstring, 0, *kcstring_len);
+    SNMP_FREE(tmpbuf);
+
+    return rval;
+
+}                               /* end encode_keychange() */
+
+#else
+_KEYTOOLS_NOT_AVAILABLE
+#endif                          /* internal or openssl */
+/*******************************************************************-o-******
+ * decode_keychange
+ *
+ * Parameters:
+ *	*hashtype	MIB OID of the hash transform to use.
+ *	 hashtype_len	Length of the hash transform MIB OID.
+ *	*oldkey		Old key that is used to encode the new key.
+ *	 oldkey_len	Length of oldkey in bytes.
+ *	*kcstring	Encoded KeyString buffer containing the new key.
+ *	 kcstring_len	Length of kcstring in bytes.
+ *	*newkey		Buffer to hold the extracted new key.
+ *	*newkey_len	Length of newkey in bytes.
+ *      
+ * Returns:
+ *	SNMPERR_SUCCESS			Success.
+ *	SNMPERR_GENERR			All errors.
+ *
+ *
+ * Decodes a string of bits encoded according to the KeyChange TC described
+ * in RFC 2274, Section 5.  The new key is extracted from *kcstring with
+ * the aid of the old key.
+ *
+ * Upon successful return, *newkey_len contains the length of the new key.
+ *
+ *
+ * ASSUMES	Old key is exactly 1/2 the length of the KeyChange buffer,
+ *		although this length may be less than the hash transform
+ *		output.  Thus the new key length will be equal to the old
+ *		key length.
+ */
+/*
+ * XXX:  if the newkey is not long enough, it should be freed and remalloced 
+ */
+int
+decode_keychange(const oid * hashtype, u_int hashtype_len,
+                 u_char * oldkey, size_t oldkey_len,
+                 u_char * kcstring, size_t kcstring_len,
+                 u_char * newkey, size_t * newkey_len)
+#if defined(USE_OPENSSL) || defined(USE_INTERNAL_MD5)
+{
+    int             rval = SNMPERR_SUCCESS;
+    size_t          properlength = 0;
+    u_int           nbytes = 0;
+
+    u_char         *bufp, tmp_buf[SNMP_MAXBUF];
+    size_t          tmp_buf_len = SNMP_MAXBUF;
+    u_char         *tmpbuf = NULL;
+
+
+
+    /*
+     * Sanity check.
+     */
+    if (!hashtype || !oldkey || !kcstring || !newkey || !newkey_len
+        || (oldkey_len <= 0) || (kcstring_len <= 0) || (*newkey_len <= 0)
+        || (hashtype_len != USM_LENGTH_OID_TRANSFORM)) {
+        QUITFUN(SNMPERR_GENERR, decode_keychange_quit);
+    }
+
+
+    /*
+     * Setup for the transform type.
+     */
+    properlength = sc_get_properlength(hashtype, hashtype_len);
+    if (properlength == SNMPERR_GENERR)
+        QUITFUN(SNMPERR_GENERR, decode_keychange_quit);
+
+
+    if (((oldkey_len * 2) != kcstring_len) || (*newkey_len < oldkey_len)) {
+        QUITFUN(SNMPERR_GENERR, decode_keychange_quit);
+    }
+
+    properlength = oldkey_len;
+    *newkey_len = properlength;
+
+    /*
+     * Use the old key and the given KeyChange TC string to recover
+     * the new key:
+     *      . Hash (oldkey | random_bytes) (into newkey),
+     *      . XOR hash and encoded (second) half of kcstring (into newkey).
+     */
+    tmpbuf = (u_char *) malloc(properlength * 2);
+    if (tmpbuf) {
+        memcpy(tmpbuf, oldkey, properlength);
+        memcpy(tmpbuf + properlength, kcstring, properlength);
+
+        rval = sc_hash(hashtype, hashtype_len, tmpbuf, properlength * 2,
+                       tmp_buf, &tmp_buf_len);
+        QUITFUN(rval, decode_keychange_quit);
+
+        memcpy(newkey, tmp_buf, properlength);
+        bufp = kcstring + properlength;
+        nbytes = 0;
+        while ((int) (nbytes++) < properlength) {
+            *newkey++ ^= *bufp++;
+        }
+    }
+
+  decode_keychange_quit:
+    if (rval != SNMPERR_SUCCESS) {
+        memset(newkey, 0, properlength);
+    }
+    memset(tmp_buf, 0, SNMP_MAXBUF);
+    if (tmpbuf != NULL)
+        SNMP_FREE(tmpbuf);
+
+    return rval;
+
+}                               /* end decode_keychange() */
+
+#else
+_KEYTOOLS_NOT_AVAILABLE
+#endif                          /* internal or openssl */
diff -Naur tomato/release/src/router/snmp/snmplib/lcd_time.c tomato121/release/src/router/snmp/snmplib/lcd_time.c
--- tomato/release/src/router/snmp/snmplib/lcd_time.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/snmplib/lcd_time.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,543 @@
+/*
+ * lcd_time.c
+ *
+ * XXX  Should etimelist entries with <0,0> time tuples be timed out?
+ * XXX  Need a routine to free the memory?  (Perhaps at shutdown?)
+ */
+
+#include <net-snmp/net-snmp-config.h>
+
+#include <sys/types.h>
+#if HAVE_WINSOCK_H
+#include <winsock.h>
+#endif
+#include <stdio.h>
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#if HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+#if TIME_WITH_SYS_TIME
+# ifdef WIN32
+#  include <sys/timeb.h>
+# else
+#  include <sys/time.h>
+# endif
+# include <time.h>
+#else
+# if HAVE_SYS_TIME_H
+#  include <sys/time.h>
+# else
+#  include <time.h>
+# endif
+#endif
+#ifdef HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+
+#if HAVE_DMALLOC_H
+#include <dmalloc.h>
+#endif
+
+#include <net-snmp/types.h>
+#include <net-snmp/output_api.h>
+#include <net-snmp/utilities.h>
+
+#include <net-snmp/library/snmp_api.h>
+#include <net-snmp/library/callback.h>
+#include <net-snmp/library/snmp_secmod.h>
+#include <net-snmp/library/snmpusm.h>
+#include <net-snmp/library/lcd_time.h>
+#include <net-snmp/library/scapi.h>
+
+#include <net-snmp/library/transform_oids.h>
+
+
+/*
+ * Global static hashlist to contain Enginetime entries.
+ *
+ * New records are prepended to the appropriate list at the hash index.
+ */
+static Enginetime etimelist[ETIMELIST_SIZE];
+
+
+
+
+/*******************************************************************-o-******
+ * get_enginetime
+ *
+ * Parameters:
+ *	*engineID
+ *	 engineID_len
+ *	*engineboot
+ *	*engine_time
+ *      
+ * Returns:
+ *	SNMPERR_SUCCESS		Success -- when a record for engineID is found.
+ *	SNMPERR_GENERR		Otherwise.
+ *
+ *
+ * Lookup engineID and return the recorded values for the
+ * <engine_time, engineboot> tuple adjusted to reflect the estimated time
+ * at the engine in question.
+ *
+ * Special case: if engineID is NULL or if engineID_len is 0 then
+ * the time tuple is returned immediately as zero.
+ *
+ * XXX	What if timediff wraps?  >shrug<
+ * XXX  Then: you need to increment the boots value.  Now.  Detecting
+ *            this is another matter.
+ */
+int
+get_enginetime(u_char * engineID,
+               u_int engineID_len,
+               u_int * engineboot,
+               u_int * engine_time, u_int authenticated)
+{
+    int             rval = SNMPERR_SUCCESS;
+    time_t          timediff = 0;
+    Enginetime      e = NULL;
+
+
+
+    /*
+     * Sanity check.
+     */
+    if (!engine_time || !engineboot) {
+        QUITFUN(SNMPERR_GENERR, get_enginetime_quit);
+    }
+
+
+    /*
+     * Compute estimated current engine_time tuple at engineID if
+     * a record is cached for it.
+     */
+    *engine_time = *engineboot = 0;
+
+    if (!engineID || (engineID_len <= 0)) {
+        QUITFUN(SNMPERR_GENERR, get_enginetime_quit);
+    }
+
+    if (!(e = search_enginetime_list(engineID, engineID_len))) {
+        QUITFUN(SNMPERR_GENERR, get_enginetime_quit);
+    }
+#ifdef LCD_TIME_SYNC_OPT
+    if (!authenticated || e->authenticatedFlag) {
+#endif
+        *engine_time = e->engineTime;
+        *engineboot = e->engineBoot;
+
+        timediff = time(NULL) - e->lastReceivedEngineTime;
+#ifdef LCD_TIME_SYNC_OPT
+    }
+#endif
+
+    if (timediff > (int) (ENGINETIME_MAX - *engine_time)) {
+        *engine_time = (timediff - (ENGINETIME_MAX - *engine_time));
+
+        /*
+         * FIX -- move this check up... should not change anything
+         * * if engineboot is already locked.  ???
+         */
+        if (*engineboot < ENGINEBOOT_MAX) {
+            *engineboot += 1;
+        }
+
+    } else {
+        *engine_time += timediff;
+    }
+
+    DEBUGMSGTL(("lcd_get_enginetime", "engineID "));
+    DEBUGMSGHEX(("lcd_get_enginetime", engineID, engineID_len));
+    DEBUGMSG(("lcd_get_enginetime", ": boots=%d, time=%d\n", *engineboot,
+              *engine_time));
+
+  get_enginetime_quit:
+    return rval;
+
+}                               /* end get_enginetime() */
+
+/*******************************************************************-o-******
+ * get_enginetime
+ *
+ * Parameters:
+ *	*engineID
+ *	 engineID_len
+ *	*engineboot
+ *	*engine_time
+ *      
+ * Returns:
+ *	SNMPERR_SUCCESS		Success -- when a record for engineID is found.
+ *	SNMPERR_GENERR		Otherwise.
+ *
+ *
+ * Lookup engineID and return the recorded values for the
+ * <engine_time, engineboot> tuple adjusted to reflect the estimated time
+ * at the engine in question.
+ *
+ * Special case: if engineID is NULL or if engineID_len is 0 then
+ * the time tuple is returned immediately as zero.
+ *
+ * XXX	What if timediff wraps?  >shrug<
+ * XXX  Then: you need to increment the boots value.  Now.  Detecting
+ *            this is another matter.
+ */
+int
+get_enginetime_ex(u_char * engineID,
+                  u_int engineID_len,
+                  u_int * engineboot,
+                  u_int * engine_time,
+                  u_int * last_engine_time, u_int authenticated)
+{
+    int             rval = SNMPERR_SUCCESS;
+    time_t          timediff = 0;
+    Enginetime      e = NULL;
+
+
+
+    /*
+     * Sanity check.
+     */
+    if (!engine_time || !engineboot || !last_engine_time) {
+        QUITFUN(SNMPERR_GENERR, get_enginetime_ex_quit);
+    }
+
+
+    /*
+     * Compute estimated current engine_time tuple at engineID if
+     * a record is cached for it.
+     */
+    *last_engine_time = *engine_time = *engineboot = 0;
+
+    if (!engineID || (engineID_len <= 0)) {
+        QUITFUN(SNMPERR_GENERR, get_enginetime_ex_quit);
+    }
+
+    if (!(e = search_enginetime_list(engineID, engineID_len))) {
+        QUITFUN(SNMPERR_GENERR, get_enginetime_ex_quit);
+    }
+#ifdef LCD_TIME_SYNC_OPT
+    if (!authenticated || e->authenticatedFlag) {
+#endif
+        *last_engine_time = *engine_time = e->engineTime;
+        *engineboot = e->engineBoot;
+
+        timediff = time(NULL) - e->lastReceivedEngineTime;
+#ifdef LCD_TIME_SYNC_OPT
+    }
+#endif
+
+    if (timediff > (int) (ENGINETIME_MAX - *engine_time)) {
+        *engine_time = (timediff - (ENGINETIME_MAX - *engine_time));
+
+        /*
+         * FIX -- move this check up... should not change anything
+         * * if engineboot is already locked.  ???
+         */
+        if (*engineboot < ENGINEBOOT_MAX) {
+            *engineboot += 1;
+        }
+
+    } else {
+        *engine_time += timediff;
+    }
+
+    DEBUGMSGTL(("lcd_get_enginetime_ex", "engineID "));
+    DEBUGMSGHEX(("lcd_get_enginetime_ex", engineID, engineID_len));
+    DEBUGMSG(("lcd_get_enginetime_ex", ": boots=%d, time=%d\n",
+              *engineboot, *engine_time));
+
+  get_enginetime_ex_quit:
+    return rval;
+
+}                               /* end get_enginetime_ex() */
+
+
+
+
+/*******************************************************************-o-******
+ * set_enginetime
+ *
+ * Parameters:
+ *	*engineID
+ *	 engineID_len
+ *	 engineboot
+ *	 engine_time
+ *      
+ * Returns:
+ *	SNMPERR_SUCCESS		Success.
+ *	SNMPERR_GENERR		Otherwise.
+ *
+ *
+ * Lookup engineID and store the given <engine_time, engineboot> tuple
+ * and then stamp the record with a consistent source of local time.
+ * If the engineID record does not exist, create one.
+ *
+ * Special case: engineID is NULL or engineID_len is 0 defines an engineID
+ * that is "always set."
+ *
+ * XXX	"Current time within the local engine" == time(NULL)...
+ */
+int
+set_enginetime(u_char * engineID,
+               u_int engineID_len,
+               u_int engineboot, u_int engine_time, u_int authenticated)
+{
+    int             rval = SNMPERR_SUCCESS, iindex;
+    Enginetime      e = NULL;
+
+
+
+    /*
+     * Sanity check.
+     */
+    if (!engineID || (engineID_len <= 0)) {
+        return rval;
+    }
+
+
+    /*
+     * Store the given <engine_time, engineboot> tuple in the record
+     * for engineID.  Create a new record if necessary.
+     */
+    if (!(e = search_enginetime_list(engineID, engineID_len))) {
+        if ((iindex = hash_engineID(engineID, engineID_len)) < 0) {
+            QUITFUN(SNMPERR_GENERR, set_enginetime_quit);
+        }
+
+        e = (Enginetime) calloc(1, sizeof(*e));
+
+        e->next = etimelist[iindex];
+        etimelist[iindex] = e;
+
+        e->engineID = (u_char *) calloc(1, engineID_len);
+        memcpy(e->engineID, engineID, engineID_len);
+
+        e->engineID_len = engineID_len;
+    }
+#ifdef LCD_TIME_SYNC_OPT
+    if (authenticated || !e->authenticatedFlag) {
+        e->authenticatedFlag = authenticated;
+#else
+    if (authenticated) {
+#endif
+        e->engineTime = engine_time;
+        e->engineBoot = engineboot;
+        e->lastReceivedEngineTime = time(NULL);
+    }
+
+    e = NULL;                   /* Indicates a successful update. */
+
+    DEBUGMSGTL(("lcd_set_enginetime", "engineID "));
+    DEBUGMSGHEX(("lcd_set_enginetime", engineID, engineID_len));
+    DEBUGMSG(("lcd_set_enginetime", ": boots=%d, time=%d\n", engineboot,
+              engine_time));
+
+  set_enginetime_quit:
+    SNMP_FREE(e);
+
+    return rval;
+
+}                               /* end set_enginetime() */
+
+
+
+
+/*******************************************************************-o-******
+ * search_enginetime_list
+ *
+ * Parameters:
+ *	*engineID
+ *	 engineID_len
+ *      
+ * Returns:
+ *	Pointer to a etimelist record with engineID <engineID>  -OR-
+ *	NULL if no record exists.
+ *
+ *
+ * Search etimelist for an entry with engineID.
+ *
+ * ASSUMES that no engineID will have more than one record in the list.
+ */
+Enginetime
+search_enginetime_list(u_char * engineID, u_int engineID_len)
+{
+    int             rval = SNMPERR_SUCCESS;
+    Enginetime      e = NULL;
+
+
+    /*
+     * Sanity check.
+     */
+    if (!engineID || (engineID_len <= 0)) {
+        QUITFUN(SNMPERR_GENERR, search_enginetime_list_quit);
+    }
+
+
+    /*
+     * Find the entry for engineID if there be one.
+     */
+    rval = hash_engineID(engineID, engineID_len);
+    if (rval < 0) {
+        QUITFUN(SNMPERR_GENERR, search_enginetime_list_quit);
+    }
+    e = etimelist[rval];
+
+    for ( /*EMPTY*/; e; e = e->next) {
+        if ((engineID_len == e->engineID_len)
+            && !memcmp(e->engineID, engineID, engineID_len)) {
+            break;
+        }
+    }
+
+
+  search_enginetime_list_quit:
+    return e;
+
+}                               /* end search_enginetime_list() */
+
+
+
+
+
+/*******************************************************************-o-******
+ * hash_engineID
+ *
+ * Parameters:
+ *	*engineID
+ *	 engineID_len
+ *      
+ * Returns:
+ *	>0			etimelist index for this engineID.
+ *	SNMPERR_GENERR		Error.
+ *	
+ * 
+ * Use a cheap hash to build an index into the etimelist.  Method is 
+ * to hash the engineID, then split the hash into u_int's and add them up
+ * and modulo the size of the list.
+ *
+ */
+int
+hash_engineID(u_char * engineID, u_int engineID_len)
+{
+    int             rval = SNMPERR_GENERR;
+    size_t          buf_len = SNMP_MAXBUF;
+    u_int           additive = 0;
+    u_char         *bufp, buf[SNMP_MAXBUF];
+    void           *context = NULL;
+
+
+
+    /*
+     * Sanity check.
+     */
+    if (!engineID || (engineID_len <= 0)) {
+        QUITFUN(SNMPERR_GENERR, hash_engineID_quit);
+    }
+
+
+    /*
+     * Hash engineID into a list index.
+     */
+    rval = sc_hash(usmHMACMD5AuthProtocol,
+                   sizeof(usmHMACMD5AuthProtocol) / sizeof(oid),
+                   engineID, engineID_len, buf, &buf_len);
+    QUITFUN(rval, hash_engineID_quit);
+
+    for (bufp = buf; (bufp - buf) < (int) buf_len; bufp += 4) {
+        additive += (u_int) * bufp;
+    }
+
+  hash_engineID_quit:
+    SNMP_FREE(context);
+    memset(buf, 0, SNMP_MAXBUF);
+
+    return (rval < 0) ? rval : (additive % ETIMELIST_SIZE);
+
+}                               /* end hash_engineID() */
+
+
+
+
+#ifdef SNMP_TESTING_CODE
+/*******************************************************************-o-******
+ * dump_etimelist_entry
+ *
+ * Parameters:
+ *	e
+ *	count
+ */
+void
+dump_etimelist_entry(Enginetime e, int count)
+{
+    u_int           buflen;
+    char            tabs[SNMP_MAXBUF], *t = tabs, *s;
+
+
+
+    count += 1;
+    while (count--) {
+        t += sprintf(t, "  ");
+    }
+
+
+    buflen = e->engineID_len;
+#ifdef SNMP_TESTING_CODE
+    if (!(s = dump_snmpEngineID(e->engineID, &buflen))) {
+#endif
+        binary_to_hex(e->engineID, e->engineID_len, &s);
+#ifdef SNMP_TESTING_CODE
+    }
+#endif
+
+    DEBUGMSGTL(("dump_etimelist", "%s\n", tabs));
+    DEBUGMSGTL(("dump_etimelist", "%s%s (len=%d) <%d,%d>\n", tabs,
+                s, e->engineID_len, e->engineTime, e->engineBoot));
+    DEBUGMSGTL(("dump_etimelist", "%s%ld (%ld) -- %s", tabs,
+                e->lastReceivedEngineTime,
+                time(NULL) - e->lastReceivedEngineTime,
+                ctime(&e->lastReceivedEngineTime)));
+
+    SNMP_FREE(s);
+
+}                               /* end dump_etimelist_entry() */
+
+
+
+
+/*******************************************************************-o-******
+ * dump_etimelist
+ */
+void
+dump_etimelist(void)
+{
+    int             iindex = -1, count = 0;
+    Enginetime      e;
+
+
+
+    DEBUGMSGTL(("dump_etimelist", "\n"));
+
+    while (++iindex < ETIMELIST_SIZE) {
+        DEBUGMSG(("dump_etimelist", "[%d]", iindex));
+
+        count = 0;
+        e = etimelist[iindex];
+
+        while (e) {
+            dump_etimelist_entry(e, count++);
+            e = e->next;
+        }
+
+        if (count > 0) {
+            DEBUGMSG(("dump_etimelist", "\n"));
+        }
+    }                           /* endwhile */
+
+    DEBUGMSG(("dump_etimelist", "\n"));
+
+}                               /* end dump_etimelist() */
+#endif                          /* SNMP_TESTING_CODE */
diff -Naur tomato/release/src/router/snmp/snmplib/Makefile.depend tomato121/release/src/router/snmp/snmplib/Makefile.depend
--- tomato/release/src/router/snmp/snmplib/Makefile.depend	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/snmplib/Makefile.depend	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,1443 @@
+# DO NOT DELETE THIS LINE -- make depend depends on it.
+
+./asn1.lo: ../include/net-snmp/net-snmp-config.h
+./asn1.lo: ../include/net-snmp/system/linux.h
+./asn1.lo: ../include/net-snmp/system/sysv.h
+./asn1.lo: ../include/net-snmp/system/generic.h
+./asn1.lo: ../include/net-snmp/machine/generic.h 
+./asn1.lo: ../include/net-snmp/output_api.h ../include/net-snmp/types.h
+./asn1.lo:  ../include/net-snmp/definitions.h
+./asn1.lo: ../include/net-snmp/library/snmp_api.h
+./asn1.lo: ../include/net-snmp/library/asn1.h
+./asn1.lo: ../include/net-snmp/library/snmp_impl.h
+./asn1.lo: ../include/net-snmp/library/snmp.h
+./asn1.lo: ../include/net-snmp/library/snmp-tc.h
+./asn1.lo: ../include/net-snmp/library/snmp_client.h
+./asn1.lo: ../include/net-snmp/library/snmp_debug.h
+./asn1.lo: ../include/net-snmp/library/snmp_logging.h 
+./asn1.lo:  ../include/net-snmp/utilities.h
+./asn1.lo: ../include/net-snmp/library/getopt.h
+./asn1.lo: ../include/net-snmp/library/system.h
+./asn1.lo: ../include/net-snmp/library/tools.h
+./asn1.lo: ../include/net-snmp/library/int64.h
+./asn1.lo: ../include/net-snmp/library/mt_support.h
+./asn1.lo: ../include/net-snmp/library/snmp_alarm.h
+./asn1.lo: ../include/net-snmp/library/data_list.h
+./asn1.lo: ../include/net-snmp/library/callback.h
+./asn1.lo: ../include/net-snmp/library/oid_stash.h
+./asn1.lo: ../include/net-snmp/library/check_varbind.h
+./asn1.lo: ../include/net-snmp/version.h ../include/net-snmp/library/mib.h
+./callback.lo: ../include/net-snmp/net-snmp-config.h
+./callback.lo: ../include/net-snmp/system/linux.h
+./callback.lo: ../include/net-snmp/system/sysv.h
+./callback.lo: ../include/net-snmp/system/generic.h
+./callback.lo: ../include/net-snmp/machine/generic.h 
+./callback.lo:  ../include/net-snmp/types.h
+./callback.lo:  ../include/net-snmp/definitions.h
+./callback.lo: ../include/net-snmp/library/snmp_api.h
+./callback.lo: ../include/net-snmp/library/asn1.h
+./callback.lo: ../include/net-snmp/library/snmp_impl.h
+./callback.lo: ../include/net-snmp/library/snmp.h
+./callback.lo: ../include/net-snmp/library/snmp-tc.h
+./callback.lo: ../include/net-snmp/output_api.h
+./callback.lo: ../include/net-snmp/library/snmp_client.h
+./callback.lo: ../include/net-snmp/library/snmp_debug.h
+./callback.lo: ../include/net-snmp/library/snmp_logging.h
+./callback.lo: ../include/net-snmp/utilities.h
+./callback.lo: ../include/net-snmp/library/getopt.h
+./callback.lo: ../include/net-snmp/library/system.h
+./callback.lo: ../include/net-snmp/library/tools.h
+./callback.lo: ../include/net-snmp/library/int64.h
+./callback.lo: ../include/net-snmp/library/mt_support.h
+./callback.lo: ../include/net-snmp/library/snmp_alarm.h
+./callback.lo: ../include/net-snmp/library/data_list.h
+./callback.lo: ../include/net-snmp/library/callback.h
+./callback.lo: ../include/net-snmp/library/oid_stash.h
+./callback.lo: ../include/net-snmp/library/check_varbind.h
+./callback.lo: ../include/net-snmp/version.h
+./check_varbind.lo: ../include/net-snmp/net-snmp-config.h
+./check_varbind.lo: ../include/net-snmp/system/linux.h
+./check_varbind.lo: ../include/net-snmp/system/sysv.h
+./check_varbind.lo: ../include/net-snmp/system/generic.h
+./check_varbind.lo: ../include/net-snmp/machine/generic.h
+./check_varbind.lo: ../include/net-snmp/net-snmp-includes.h
+./check_varbind.lo: ../include/net-snmp/definitions.h
+./check_varbind.lo: ../include/net-snmp/types.h
+./check_varbind.lo: ../include/net-snmp/library/snmp_api.h
+./check_varbind.lo: ../include/net-snmp/library/asn1.h
+./check_varbind.lo: ../include/net-snmp/library/snmp_impl.h
+./check_varbind.lo: ../include/net-snmp/library/snmp.h
+./check_varbind.lo: ../include/net-snmp/library/snmp-tc.h
+./check_varbind.lo: ../include/net-snmp/utilities.h
+./check_varbind.lo: ../include/net-snmp/library/snmp_client.h
+./check_varbind.lo: ../include/net-snmp/library/getopt.h
+./check_varbind.lo: ../include/net-snmp/library/system.h
+./check_varbind.lo: ../include/net-snmp/library/tools.h
+./check_varbind.lo: ../include/net-snmp/library/int64.h
+./check_varbind.lo: ../include/net-snmp/library/mt_support.h
+./check_varbind.lo: ../include/net-snmp/library/snmp_alarm.h
+./check_varbind.lo: ../include/net-snmp/library/data_list.h
+./check_varbind.lo: ../include/net-snmp/library/callback.h
+./check_varbind.lo: ../include/net-snmp/library/oid_stash.h
+./check_varbind.lo: ../include/net-snmp/library/check_varbind.h
+./check_varbind.lo: ../include/net-snmp/version.h
+./check_varbind.lo: ../include/net-snmp/session_api.h
+./check_varbind.lo: ../include/net-snmp/library/snmp_transport.h
+./check_varbind.lo: ../include/net-snmp/library/snmpCallbackDomain.h
+./check_varbind.lo: ../include/net-snmp/library/snmpUnixDomain.h
+./check_varbind.lo: ../include/net-snmp/library/snmpUDPDomain.h
+./check_varbind.lo: ../include/net-snmp/library/snmpTCPDomain.h
+./check_varbind.lo: ../include/net-snmp/library/snmpUDPIPv6Domain.h
+./check_varbind.lo: ../include/net-snmp/library/snmpTCPIPv6Domain.h
+./check_varbind.lo: ../include/net-snmp/library/snmpIPXDomain.h
+./check_varbind.lo: ../include/net-snmp/library/ucd_compat.h
+./check_varbind.lo: ../include/net-snmp/pdu_api.h
+./check_varbind.lo: ../include/net-snmp/mib_api.h
+./check_varbind.lo: ../include/net-snmp/library/mib.h
+./check_varbind.lo: ../include/net-snmp/library/parse.h
+./check_varbind.lo: ../include/net-snmp/varbind_api.h
+./check_varbind.lo: ../include/net-snmp/config_api.h
+./check_varbind.lo: ../include/net-snmp/library/read_config.h
+./check_varbind.lo: ../include/net-snmp/library/default_store.h
+./check_varbind.lo: ../include/net-snmp/library/snmp_parse_args.h
+./check_varbind.lo: ../include/net-snmp/library/snmp_enum.h
+./check_varbind.lo: ../include/net-snmp/library/vacm.h
+./check_varbind.lo: ../include/net-snmp/output_api.h
+./check_varbind.lo: ../include/net-snmp/library/snmp_debug.h
+./check_varbind.lo: ../include/net-snmp/library/snmp_logging.h
+./check_varbind.lo: ../include/net-snmp/snmpv3_api.h
+./check_varbind.lo: ../include/net-snmp/library/snmpv3.h
+./check_varbind.lo: ../include/net-snmp/library/transform_oids.h
+./check_varbind.lo: ../include/net-snmp/library/keytools.h
+./check_varbind.lo: ../include/net-snmp/library/scapi.h
+./check_varbind.lo: ../include/net-snmp/library/lcd_time.h
+./check_varbind.lo: ../include/net-snmp/library/snmp_secmod.h
+./check_varbind.lo: ../include/net-snmp/library/snmpv3-security-includes.h
+./check_varbind.lo: ../include/net-snmp/library/snmpusm.h
+./container_binary_array.lo: ../include/net-snmp/net-snmp-config.h
+./container_binary_array.lo: ../include/net-snmp/system/linux.h
+./container_binary_array.lo: ../include/net-snmp/system/sysv.h
+./container_binary_array.lo: ../include/net-snmp/system/generic.h
+./container_binary_array.lo: ../include/net-snmp/machine/generic.h
+./container_binary_array.lo: ../include/net-snmp/net-snmp-includes.h
+./container_binary_array.lo: ../include/net-snmp/definitions.h
+./container_binary_array.lo: ../include/net-snmp/types.h
+./container_binary_array.lo: ../include/net-snmp/library/snmp_api.h
+./container_binary_array.lo: ../include/net-snmp/library/asn1.h
+./container_binary_array.lo: ../include/net-snmp/library/snmp_impl.h
+./container_binary_array.lo: ../include/net-snmp/library/snmp.h
+./container_binary_array.lo: ../include/net-snmp/library/snmp-tc.h
+./container_binary_array.lo: ../include/net-snmp/utilities.h
+./container_binary_array.lo: ../include/net-snmp/library/snmp_client.h
+./container_binary_array.lo: ../include/net-snmp/library/getopt.h
+./container_binary_array.lo: ../include/net-snmp/library/system.h
+./container_binary_array.lo: ../include/net-snmp/library/tools.h
+./container_binary_array.lo: ../include/net-snmp/library/int64.h
+./container_binary_array.lo: ../include/net-snmp/library/mt_support.h
+./container_binary_array.lo: ../include/net-snmp/library/snmp_alarm.h
+./container_binary_array.lo: ../include/net-snmp/library/data_list.h
+./container_binary_array.lo: ../include/net-snmp/library/callback.h
+./container_binary_array.lo: ../include/net-snmp/library/oid_stash.h
+./container_binary_array.lo: ../include/net-snmp/library/check_varbind.h
+./container_binary_array.lo: ../include/net-snmp/version.h
+./container_binary_array.lo: ../include/net-snmp/session_api.h
+./container_binary_array.lo: ../include/net-snmp/library/snmp_transport.h
+./container_binary_array.lo: ../include/net-snmp/library/snmpCallbackDomain.h
+./container_binary_array.lo: ../include/net-snmp/library/snmpUnixDomain.h
+./container_binary_array.lo: ../include/net-snmp/library/snmpUDPDomain.h
+./container_binary_array.lo: ../include/net-snmp/library/snmpTCPDomain.h
+./container_binary_array.lo: ../include/net-snmp/library/snmpUDPIPv6Domain.h
+./container_binary_array.lo: ../include/net-snmp/library/snmpTCPIPv6Domain.h
+./container_binary_array.lo: ../include/net-snmp/library/snmpIPXDomain.h
+./container_binary_array.lo: ../include/net-snmp/library/ucd_compat.h
+./container_binary_array.lo: ../include/net-snmp/pdu_api.h
+./container_binary_array.lo: ../include/net-snmp/mib_api.h
+./container_binary_array.lo: ../include/net-snmp/library/mib.h
+./container_binary_array.lo: ../include/net-snmp/library/parse.h
+./container_binary_array.lo: ../include/net-snmp/varbind_api.h
+./container_binary_array.lo: ../include/net-snmp/config_api.h
+./container_binary_array.lo: ../include/net-snmp/library/read_config.h
+./container_binary_array.lo: ../include/net-snmp/library/default_store.h
+./container_binary_array.lo: ../include/net-snmp/library/snmp_parse_args.h
+./container_binary_array.lo: ../include/net-snmp/library/snmp_enum.h
+./container_binary_array.lo: ../include/net-snmp/library/vacm.h
+./container_binary_array.lo: ../include/net-snmp/output_api.h
+./container_binary_array.lo: ../include/net-snmp/library/snmp_debug.h
+./container_binary_array.lo: ../include/net-snmp/library/snmp_logging.h
+./container_binary_array.lo: ../include/net-snmp/snmpv3_api.h
+./container_binary_array.lo: ../include/net-snmp/library/snmpv3.h
+./container_binary_array.lo: ../include/net-snmp/library/transform_oids.h
+./container_binary_array.lo: ../include/net-snmp/library/keytools.h
+./container_binary_array.lo: ../include/net-snmp/library/scapi.h
+./container_binary_array.lo: ../include/net-snmp/library/lcd_time.h
+./container_binary_array.lo: ../include/net-snmp/library/snmp_secmod.h
+./container_binary_array.lo: ../include/net-snmp/library/snmpv3-security-includes.h
+./container_binary_array.lo: ../include/net-snmp/library/snmpusm.h
+./container_binary_array.lo: ../include/net-snmp/library/container.h
+./container_binary_array.lo: ../include/net-snmp/library/factory.h
+./container_binary_array.lo: ../include/net-snmp/library/container_binary_array.h
+./container_binary_array.lo: ../include/net-snmp/library/snmp_assert.h
+./container.lo: ../include/net-snmp/net-snmp-config.h
+./container.lo: ../include/net-snmp/system/linux.h
+./container.lo: ../include/net-snmp/system/sysv.h
+./container.lo: ../include/net-snmp/system/generic.h
+./container.lo: ../include/net-snmp/machine/generic.h
+./container.lo: ../include/net-snmp/net-snmp-includes.h 
+./container.lo:  ../include/net-snmp/definitions.h
+./container.lo: ../include/net-snmp/types.h
+./container.lo: ../include/net-snmp/library/snmp_api.h
+./container.lo: ../include/net-snmp/library/asn1.h
+./container.lo: ../include/net-snmp/library/snmp_impl.h
+./container.lo: ../include/net-snmp/library/snmp.h
+./container.lo: ../include/net-snmp/library/snmp-tc.h
+./container.lo: ../include/net-snmp/utilities.h
+./container.lo: ../include/net-snmp/library/snmp_client.h
+./container.lo: ../include/net-snmp/library/getopt.h
+./container.lo: ../include/net-snmp/library/system.h
+./container.lo: ../include/net-snmp/library/tools.h
+./container.lo: ../include/net-snmp/library/int64.h
+./container.lo: ../include/net-snmp/library/mt_support.h
+./container.lo: ../include/net-snmp/library/snmp_alarm.h
+./container.lo: ../include/net-snmp/library/data_list.h
+./container.lo: ../include/net-snmp/library/callback.h
+./container.lo: ../include/net-snmp/library/oid_stash.h
+./container.lo: ../include/net-snmp/library/check_varbind.h
+./container.lo: ../include/net-snmp/version.h
+./container.lo: ../include/net-snmp/session_api.h
+./container.lo: ../include/net-snmp/library/snmp_transport.h
+./container.lo: ../include/net-snmp/library/snmpCallbackDomain.h
+./container.lo: ../include/net-snmp/library/snmpUnixDomain.h
+./container.lo: ../include/net-snmp/library/snmpUDPDomain.h
+./container.lo: ../include/net-snmp/library/snmpTCPDomain.h
+./container.lo: ../include/net-snmp/library/snmpUDPIPv6Domain.h
+./container.lo: ../include/net-snmp/library/snmpTCPIPv6Domain.h
+./container.lo: ../include/net-snmp/library/snmpIPXDomain.h
+./container.lo: ../include/net-snmp/library/ucd_compat.h
+./container.lo: ../include/net-snmp/pdu_api.h ../include/net-snmp/mib_api.h
+./container.lo: ../include/net-snmp/library/mib.h
+./container.lo: ../include/net-snmp/library/parse.h
+./container.lo: ../include/net-snmp/varbind_api.h
+./container.lo: ../include/net-snmp/config_api.h
+./container.lo: ../include/net-snmp/library/read_config.h
+./container.lo: ../include/net-snmp/library/default_store.h
+./container.lo: ../include/net-snmp/library/snmp_parse_args.h
+./container.lo: ../include/net-snmp/library/snmp_enum.h
+./container.lo: ../include/net-snmp/library/vacm.h
+./container.lo: ../include/net-snmp/output_api.h
+./container.lo: ../include/net-snmp/library/snmp_debug.h
+./container.lo: ../include/net-snmp/library/snmp_logging.h
+./container.lo: ../include/net-snmp/snmpv3_api.h
+./container.lo: ../include/net-snmp/library/snmpv3.h
+./container.lo: ../include/net-snmp/library/transform_oids.h
+./container.lo: ../include/net-snmp/library/keytools.h
+./container.lo: ../include/net-snmp/library/scapi.h
+./container.lo: ../include/net-snmp/library/lcd_time.h
+./container.lo: ../include/net-snmp/library/snmp_secmod.h
+./container.lo: ../include/net-snmp/library/snmpv3-security-includes.h
+./container.lo: ../include/net-snmp/library/snmpusm.h
+./container.lo: ../include/net-snmp/library/container.h
+./container.lo: ../include/net-snmp/library/factory.h
+./container.lo: ../include/net-snmp/library/container_binary_array.h
+./data_list.lo: ../include/net-snmp/net-snmp-config.h
+./data_list.lo: ../include/net-snmp/system/linux.h
+./data_list.lo: ../include/net-snmp/system/sysv.h
+./data_list.lo: ../include/net-snmp/system/generic.h
+./data_list.lo: ../include/net-snmp/machine/generic.h
+./data_list.lo:  ../include/net-snmp/library/data_list.h
+./data_list.lo: ../include/net-snmp/library/snmp_impl.h 
+./data_list.lo: ../include/net-snmp/types.h 
+./data_list.lo: ../include/net-snmp/definitions.h
+./data_list.lo: ../include/net-snmp/library/snmp_api.h
+./data_list.lo: ../include/net-snmp/library/asn1.h
+./data_list.lo: ../include/net-snmp/library/snmp.h
+./data_list.lo: ../include/net-snmp/library/snmp-tc.h
+./data_list.lo: ../include/net-snmp/library/tools.h
+./default_store.lo: ../include/net-snmp/net-snmp-config.h
+./default_store.lo: ../include/net-snmp/system/linux.h
+./default_store.lo: ../include/net-snmp/system/sysv.h
+./default_store.lo: ../include/net-snmp/system/generic.h
+./default_store.lo: ../include/net-snmp/machine/generic.h
+./default_store.lo: ../include/net-snmp/types.h 
+./default_store.lo: ../include/net-snmp/definitions.h
+./default_store.lo: ../include/net-snmp/library/snmp_api.h
+./default_store.lo: ../include/net-snmp/library/asn1.h
+./default_store.lo: ../include/net-snmp/library/snmp_impl.h
+./default_store.lo: ../include/net-snmp/library/snmp.h
+./default_store.lo: ../include/net-snmp/library/snmp-tc.h
+./default_store.lo: ../include/net-snmp/output_api.h
+./default_store.lo: ../include/net-snmp/library/snmp_client.h
+./default_store.lo: ../include/net-snmp/library/snmp_debug.h
+./default_store.lo: ../include/net-snmp/library/snmp_logging.h
+./default_store.lo: ../include/net-snmp/config_api.h
+./default_store.lo: ../include/net-snmp/library/read_config.h
+./default_store.lo: ../include/net-snmp/library/default_store.h
+./default_store.lo: ../include/net-snmp/library/snmp_parse_args.h
+./default_store.lo: ../include/net-snmp/library/snmp_enum.h
+./default_store.lo: ../include/net-snmp/library/vacm.h
+./default_store.lo: ../include/net-snmp/utilities.h
+./default_store.lo: ../include/net-snmp/library/getopt.h
+./default_store.lo: ../include/net-snmp/library/system.h
+./default_store.lo: ../include/net-snmp/library/tools.h
+./default_store.lo: ../include/net-snmp/library/int64.h
+./default_store.lo: ../include/net-snmp/library/mt_support.h
+./default_store.lo: ../include/net-snmp/library/snmp_alarm.h
+./default_store.lo: ../include/net-snmp/library/data_list.h
+./default_store.lo: ../include/net-snmp/library/callback.h
+./default_store.lo: ../include/net-snmp/library/oid_stash.h
+./default_store.lo: ../include/net-snmp/library/check_varbind.h
+./default_store.lo: ../include/net-snmp/version.h
+./int64.lo: ../include/net-snmp/net-snmp-config.h
+./int64.lo: ../include/net-snmp/system/linux.h
+./int64.lo: ../include/net-snmp/system/sysv.h
+./int64.lo: ../include/net-snmp/system/generic.h
+./int64.lo: ../include/net-snmp/machine/generic.h 
+./int64.lo: ../include/net-snmp/types.h 
+./int64.lo: ../include/net-snmp/definitions.h
+./int64.lo: ../include/net-snmp/library/snmp_api.h
+./int64.lo: ../include/net-snmp/library/asn1.h
+./int64.lo: ../include/net-snmp/library/snmp_impl.h
+./int64.lo: ../include/net-snmp/library/snmp.h
+./int64.lo: ../include/net-snmp/library/snmp-tc.h
+./int64.lo: ../include/net-snmp/library/int64.h
+./keytools.lo: ../include/net-snmp/net-snmp-config.h
+./keytools.lo: ../include/net-snmp/system/linux.h
+./keytools.lo: ../include/net-snmp/system/sysv.h
+./keytools.lo: ../include/net-snmp/system/generic.h
+./keytools.lo: ../include/net-snmp/machine/generic.h 
+./keytools.lo: ../include/net-snmp/types.h 
+./keytools.lo: ../include/net-snmp/definitions.h
+./keytools.lo: ../include/net-snmp/library/snmp_api.h
+./keytools.lo: ../include/net-snmp/library/asn1.h
+./keytools.lo: ../include/net-snmp/library/snmp_impl.h
+./keytools.lo: ../include/net-snmp/library/snmp.h
+./keytools.lo: ../include/net-snmp/library/snmp-tc.h
+./keytools.lo: ../include/net-snmp/output_api.h
+./keytools.lo: ../include/net-snmp/library/snmp_client.h
+./keytools.lo: ../include/net-snmp/library/snmp_debug.h
+./keytools.lo: ../include/net-snmp/library/snmp_logging.h
+./keytools.lo: ../include/net-snmp/utilities.h
+./keytools.lo: ../include/net-snmp/library/getopt.h
+./keytools.lo: ../include/net-snmp/library/system.h
+./keytools.lo: ../include/net-snmp/library/tools.h
+./keytools.lo: ../include/net-snmp/library/int64.h
+./keytools.lo: ../include/net-snmp/library/mt_support.h
+./keytools.lo: ../include/net-snmp/library/snmp_alarm.h
+./keytools.lo: ../include/net-snmp/library/data_list.h
+./keytools.lo: ../include/net-snmp/library/callback.h
+./keytools.lo: ../include/net-snmp/library/oid_stash.h
+./keytools.lo: ../include/net-snmp/library/check_varbind.h
+./keytools.lo: ../include/net-snmp/version.h
+./keytools.lo: ../include/net-snmp/library/scapi.h
+./keytools.lo: ../include/net-snmp/library/keytools.h
+./keytools.lo: ../include/net-snmp/library/transform_oids.h
+./lcd_time.lo: ../include/net-snmp/net-snmp-config.h
+./lcd_time.lo: ../include/net-snmp/system/linux.h
+./lcd_time.lo: ../include/net-snmp/system/sysv.h
+./lcd_time.lo: ../include/net-snmp/system/generic.h
+./lcd_time.lo: ../include/net-snmp/machine/generic.h 
+./lcd_time.lo: ../include/net-snmp/types.h ../include/net-snmp/definitions.h
+./lcd_time.lo: ../include/net-snmp/library/snmp_api.h
+./lcd_time.lo: ../include/net-snmp/library/asn1.h
+./lcd_time.lo: ../include/net-snmp/library/snmp_impl.h
+./lcd_time.lo: ../include/net-snmp/library/snmp.h
+./lcd_time.lo: ../include/net-snmp/library/snmp-tc.h
+./lcd_time.lo: ../include/net-snmp/output_api.h
+./lcd_time.lo: ../include/net-snmp/library/snmp_client.h
+./lcd_time.lo: ../include/net-snmp/library/snmp_debug.h
+./lcd_time.lo: ../include/net-snmp/library/snmp_logging.h
+./lcd_time.lo: ../include/net-snmp/utilities.h
+./lcd_time.lo: ../include/net-snmp/library/getopt.h
+./lcd_time.lo: ../include/net-snmp/library/system.h
+./lcd_time.lo: ../include/net-snmp/library/tools.h
+./lcd_time.lo: ../include/net-snmp/library/int64.h
+./lcd_time.lo: ../include/net-snmp/library/mt_support.h
+./lcd_time.lo: ../include/net-snmp/library/snmp_alarm.h
+./lcd_time.lo: ../include/net-snmp/library/data_list.h
+./lcd_time.lo: ../include/net-snmp/library/callback.h
+./lcd_time.lo: ../include/net-snmp/library/oid_stash.h
+./lcd_time.lo: ../include/net-snmp/library/check_varbind.h
+./lcd_time.lo: ../include/net-snmp/version.h
+./lcd_time.lo: ../include/net-snmp/library/snmp_secmod.h
+./lcd_time.lo: ../include/net-snmp/library/snmpusm.h
+./lcd_time.lo: ../include/net-snmp/library/lcd_time.h
+./lcd_time.lo: ../include/net-snmp/library/scapi.h
+./lcd_time.lo: ../include/net-snmp/library/transform_oids.h
+./md5.lo: ../include/net-snmp/net-snmp-config.h
+./md5.lo: ../include/net-snmp/system/linux.h
+./md5.lo: ../include/net-snmp/system/sysv.h
+./md5.lo: ../include/net-snmp/system/generic.h
+./md5.lo: ../include/net-snmp/machine/generic.h 
+./md5.lo:  ../include/net-snmp/utilities.h
+./md5.lo: ../include/net-snmp/types.h 
+./md5.lo: ../include/net-snmp/definitions.h
+./md5.lo: ../include/net-snmp/library/snmp_api.h
+./md5.lo: ../include/net-snmp/library/asn1.h
+./md5.lo: ../include/net-snmp/library/snmp_impl.h
+./md5.lo: ../include/net-snmp/library/snmp.h
+./md5.lo: ../include/net-snmp/library/snmp-tc.h
+./md5.lo: ../include/net-snmp/library/snmp_client.h
+./md5.lo: ../include/net-snmp/library/getopt.h
+./md5.lo: ../include/net-snmp/library/system.h
+./md5.lo: ../include/net-snmp/library/tools.h
+./md5.lo: ../include/net-snmp/library/int64.h
+./md5.lo: ../include/net-snmp/library/mt_support.h
+./md5.lo: ../include/net-snmp/library/snmp_alarm.h
+./md5.lo: ../include/net-snmp/library/data_list.h
+./md5.lo: ../include/net-snmp/library/callback.h
+./md5.lo: ../include/net-snmp/library/oid_stash.h
+./md5.lo: ../include/net-snmp/library/check_varbind.h
+./md5.lo: ../include/net-snmp/version.h ../include/net-snmp/library/md5.h
+./mib.lo: ../include/net-snmp/net-snmp-config.h
+./mib.lo: ../include/net-snmp/system/linux.h
+./mib.lo: ../include/net-snmp/system/sysv.h
+./mib.lo: ../include/net-snmp/system/generic.h
+./mib.lo: ../include/net-snmp/machine/generic.h 
+./mib.lo:  ../include/net-snmp/types.h
+./mib.lo: ../include/net-snmp/definitions.h
+./mib.lo: ../include/net-snmp/library/snmp_api.h
+./mib.lo: ../include/net-snmp/library/asn1.h
+./mib.lo: ../include/net-snmp/library/snmp_impl.h
+./mib.lo: ../include/net-snmp/library/snmp.h
+./mib.lo: ../include/net-snmp/library/snmp-tc.h
+./mib.lo: ../include/net-snmp/output_api.h
+./mib.lo: ../include/net-snmp/library/snmp_client.h
+./mib.lo: ../include/net-snmp/library/snmp_debug.h
+./mib.lo: ../include/net-snmp/library/snmp_logging.h 
+./mib.lo:  ../include/net-snmp/config_api.h
+./mib.lo: ../include/net-snmp/library/read_config.h
+./mib.lo: ../include/net-snmp/library/default_store.h
+./mib.lo: ../include/net-snmp/library/snmp_parse_args.h
+./mib.lo: ../include/net-snmp/library/snmp_enum.h
+./mib.lo: ../include/net-snmp/library/vacm.h ../include/net-snmp/utilities.h
+./mib.lo: ../include/net-snmp/library/getopt.h
+./mib.lo: ../include/net-snmp/library/system.h
+./mib.lo: ../include/net-snmp/library/tools.h
+./mib.lo: ../include/net-snmp/library/int64.h
+./mib.lo: ../include/net-snmp/library/mt_support.h
+./mib.lo: ../include/net-snmp/library/snmp_alarm.h
+./mib.lo: ../include/net-snmp/library/data_list.h
+./mib.lo: ../include/net-snmp/library/callback.h
+./mib.lo: ../include/net-snmp/library/oid_stash.h
+./mib.lo: ../include/net-snmp/library/check_varbind.h
+./mib.lo: ../include/net-snmp/version.h ../include/net-snmp/library/mib.h
+./mib.lo: ../include/net-snmp/library/parse.h
+./mt_support.lo: ../include/net-snmp/net-snmp-config.h
+./mt_support.lo: ../include/net-snmp/system/linux.h
+./mt_support.lo: ../include/net-snmp/system/sysv.h
+./mt_support.lo: ../include/net-snmp/system/generic.h
+./mt_support.lo: ../include/net-snmp/machine/generic.h 
+./mt_support.lo: ../include/net-snmp/library/mt_support.h
+./oid_stash.lo: ../include/net-snmp/net-snmp-config.h
+./oid_stash.lo: ../include/net-snmp/system/linux.h
+./oid_stash.lo: ../include/net-snmp/system/sysv.h
+./oid_stash.lo: ../include/net-snmp/system/generic.h
+./oid_stash.lo: ../include/net-snmp/machine/generic.h 
+./oid_stash.lo:  ../include/net-snmp/net-snmp-includes.h
+./oid_stash.lo:  ../include/net-snmp/definitions.h
+./oid_stash.lo: ../include/net-snmp/types.h
+./oid_stash.lo: ../include/net-snmp/library/snmp_api.h
+./oid_stash.lo: ../include/net-snmp/library/asn1.h
+./oid_stash.lo: ../include/net-snmp/library/snmp_impl.h
+./oid_stash.lo: ../include/net-snmp/library/snmp.h
+./oid_stash.lo: ../include/net-snmp/library/snmp-tc.h
+./oid_stash.lo: ../include/net-snmp/utilities.h
+./oid_stash.lo: ../include/net-snmp/library/snmp_client.h
+./oid_stash.lo: ../include/net-snmp/library/getopt.h
+./oid_stash.lo: ../include/net-snmp/library/system.h
+./oid_stash.lo: ../include/net-snmp/library/tools.h
+./oid_stash.lo: ../include/net-snmp/library/int64.h
+./oid_stash.lo: ../include/net-snmp/library/mt_support.h
+./oid_stash.lo: ../include/net-snmp/library/snmp_alarm.h
+./oid_stash.lo: ../include/net-snmp/library/data_list.h
+./oid_stash.lo: ../include/net-snmp/library/callback.h
+./oid_stash.lo: ../include/net-snmp/library/oid_stash.h
+./oid_stash.lo: ../include/net-snmp/library/check_varbind.h
+./oid_stash.lo: ../include/net-snmp/version.h
+./oid_stash.lo: ../include/net-snmp/session_api.h
+./oid_stash.lo: ../include/net-snmp/library/snmp_transport.h
+./oid_stash.lo: ../include/net-snmp/library/snmpCallbackDomain.h
+./oid_stash.lo: ../include/net-snmp/library/snmpUnixDomain.h
+./oid_stash.lo: ../include/net-snmp/library/snmpUDPDomain.h
+./oid_stash.lo: ../include/net-snmp/library/snmpTCPDomain.h
+./oid_stash.lo: ../include/net-snmp/library/snmpUDPIPv6Domain.h
+./oid_stash.lo: ../include/net-snmp/library/snmpTCPIPv6Domain.h
+./oid_stash.lo: ../include/net-snmp/library/snmpIPXDomain.h
+./oid_stash.lo: ../include/net-snmp/library/ucd_compat.h
+./oid_stash.lo: ../include/net-snmp/pdu_api.h ../include/net-snmp/mib_api.h
+./oid_stash.lo: ../include/net-snmp/library/mib.h
+./oid_stash.lo: ../include/net-snmp/library/parse.h
+./oid_stash.lo: ../include/net-snmp/varbind_api.h
+./oid_stash.lo: ../include/net-snmp/config_api.h
+./oid_stash.lo: ../include/net-snmp/library/read_config.h
+./oid_stash.lo: ../include/net-snmp/library/default_store.h
+./oid_stash.lo: ../include/net-snmp/library/snmp_parse_args.h
+./oid_stash.lo: ../include/net-snmp/library/snmp_enum.h
+./oid_stash.lo: ../include/net-snmp/library/vacm.h
+./oid_stash.lo: ../include/net-snmp/output_api.h
+./oid_stash.lo: ../include/net-snmp/library/snmp_debug.h
+./oid_stash.lo: ../include/net-snmp/library/snmp_logging.h
+./oid_stash.lo: ../include/net-snmp/snmpv3_api.h
+./oid_stash.lo: ../include/net-snmp/library/snmpv3.h
+./oid_stash.lo: ../include/net-snmp/library/transform_oids.h
+./oid_stash.lo: ../include/net-snmp/library/keytools.h
+./oid_stash.lo: ../include/net-snmp/library/scapi.h
+./oid_stash.lo: ../include/net-snmp/library/lcd_time.h
+./oid_stash.lo: ../include/net-snmp/library/snmp_secmod.h
+./oid_stash.lo: ../include/net-snmp/library/snmpv3-security-includes.h
+./oid_stash.lo: ../include/net-snmp/library/snmpusm.h
+./parse.lo: ../include/net-snmp/net-snmp-config.h
+./parse.lo: ../include/net-snmp/system/linux.h
+./parse.lo: ../include/net-snmp/system/sysv.h
+./parse.lo: ../include/net-snmp/system/generic.h
+./parse.lo: ../include/net-snmp/machine/generic.h 
+./parse.lo: ../include/net-snmp/types.h ../include/net-snmp/definitions.h
+./parse.lo: ../include/net-snmp/library/snmp_api.h
+./parse.lo: ../include/net-snmp/library/asn1.h
+./parse.lo: ../include/net-snmp/library/snmp_impl.h
+./parse.lo: ../include/net-snmp/library/snmp.h
+./parse.lo: ../include/net-snmp/library/snmp-tc.h
+./parse.lo: ../include/net-snmp/output_api.h
+./parse.lo: ../include/net-snmp/library/snmp_client.h
+./parse.lo: ../include/net-snmp/library/snmp_debug.h
+./parse.lo: ../include/net-snmp/library/snmp_logging.h 
+./parse.lo:  ../include/net-snmp/config_api.h
+./parse.lo: ../include/net-snmp/library/read_config.h
+./parse.lo: ../include/net-snmp/library/default_store.h
+./parse.lo: ../include/net-snmp/library/snmp_parse_args.h
+./parse.lo: ../include/net-snmp/library/snmp_enum.h
+./parse.lo: ../include/net-snmp/library/vacm.h
+./parse.lo: ../include/net-snmp/utilities.h
+./parse.lo: ../include/net-snmp/library/getopt.h
+./parse.lo: ../include/net-snmp/library/system.h
+./parse.lo: ../include/net-snmp/library/tools.h
+./parse.lo: ../include/net-snmp/library/int64.h
+./parse.lo: ../include/net-snmp/library/mt_support.h
+./parse.lo: ../include/net-snmp/library/snmp_alarm.h
+./parse.lo: ../include/net-snmp/library/data_list.h
+./parse.lo: ../include/net-snmp/library/callback.h
+./parse.lo: ../include/net-snmp/library/oid_stash.h
+./parse.lo: ../include/net-snmp/library/check_varbind.h
+./parse.lo: ../include/net-snmp/version.h ../include/net-snmp/library/parse.h
+./parse.lo: ../include/net-snmp/library/mib.h
+./read_config.lo: ../include/net-snmp/net-snmp-config.h
+./read_config.lo: ../include/net-snmp/system/linux.h
+./read_config.lo: ../include/net-snmp/system/sysv.h
+./read_config.lo: ../include/net-snmp/system/generic.h
+./read_config.lo: ../include/net-snmp/machine/generic.h 
+./read_config.lo: ../include/net-snmp/types.h
+./read_config.lo: ../include/net-snmp/definitions.h
+./read_config.lo: ../include/net-snmp/library/snmp_api.h
+./read_config.lo: ../include/net-snmp/library/asn1.h
+./read_config.lo: ../include/net-snmp/library/snmp_impl.h
+./read_config.lo: ../include/net-snmp/library/snmp.h
+./read_config.lo: ../include/net-snmp/library/snmp-tc.h
+./read_config.lo: ../include/net-snmp/output_api.h
+./read_config.lo: ../include/net-snmp/library/snmp_client.h
+./read_config.lo: ../include/net-snmp/library/snmp_debug.h
+./read_config.lo: ../include/net-snmp/library/snmp_logging.h
+./read_config.lo: ../include/net-snmp/config_api.h
+./read_config.lo: ../include/net-snmp/library/read_config.h
+./read_config.lo: ../include/net-snmp/library/default_store.h
+./read_config.lo: ../include/net-snmp/library/snmp_parse_args.h
+./read_config.lo: ../include/net-snmp/library/snmp_enum.h
+./read_config.lo: ../include/net-snmp/library/vacm.h
+./read_config.lo: ../include/net-snmp/utilities.h
+./read_config.lo: ../include/net-snmp/library/getopt.h
+./read_config.lo: ../include/net-snmp/library/system.h
+./read_config.lo: ../include/net-snmp/library/tools.h
+./read_config.lo: ../include/net-snmp/library/int64.h
+./read_config.lo: ../include/net-snmp/library/mt_support.h
+./read_config.lo: ../include/net-snmp/library/snmp_alarm.h
+./read_config.lo: ../include/net-snmp/library/data_list.h
+./read_config.lo: ../include/net-snmp/library/callback.h
+./read_config.lo: ../include/net-snmp/library/oid_stash.h
+./read_config.lo: ../include/net-snmp/library/check_varbind.h
+./read_config.lo: ../include/net-snmp/version.h
+./read_config.lo: ../include/net-snmp/library/mib.h
+./read_config.lo: ../include/net-snmp/library/parse.h
+./scapi.lo: ../include/net-snmp/net-snmp-config.h
+./scapi.lo: ../include/net-snmp/system/linux.h
+./scapi.lo: ../include/net-snmp/system/sysv.h
+./scapi.lo: ../include/net-snmp/system/generic.h
+./scapi.lo: ../include/net-snmp/machine/generic.h 
+./scapi.lo:  ../include/net-snmp/types.h
+./scapi.lo:  ../include/net-snmp/definitions.h
+./scapi.lo: ../include/net-snmp/library/snmp_api.h
+./scapi.lo: ../include/net-snmp/library/asn1.h
+./scapi.lo: ../include/net-snmp/library/snmp_impl.h
+./scapi.lo: ../include/net-snmp/library/snmp.h
+./scapi.lo: ../include/net-snmp/library/snmp-tc.h
+./scapi.lo: ../include/net-snmp/output_api.h
+./scapi.lo: ../include/net-snmp/library/snmp_client.h
+./scapi.lo: ../include/net-snmp/library/snmp_debug.h
+./scapi.lo: ../include/net-snmp/library/snmp_logging.h 
+./scapi.lo:  ../include/net-snmp/utilities.h
+./scapi.lo: ../include/net-snmp/library/getopt.h
+./scapi.lo: ../include/net-snmp/library/system.h
+./scapi.lo: ../include/net-snmp/library/tools.h
+./scapi.lo: ../include/net-snmp/library/int64.h
+./scapi.lo: ../include/net-snmp/library/mt_support.h
+./scapi.lo: ../include/net-snmp/library/snmp_alarm.h
+./scapi.lo: ../include/net-snmp/library/data_list.h
+./scapi.lo: ../include/net-snmp/library/callback.h
+./scapi.lo: ../include/net-snmp/library/oid_stash.h
+./scapi.lo: ../include/net-snmp/library/check_varbind.h
+./scapi.lo: ../include/net-snmp/version.h
+./scapi.lo: ../include/net-snmp/library/snmp_secmod.h
+./scapi.lo: ../include/net-snmp/library/snmpusm.h
+./scapi.lo: ../include/net-snmp/library/keytools.h
+./scapi.lo: ../include/net-snmp/library/scapi.h
+./scapi.lo: ../include/net-snmp/library/mib.h
+./scapi.lo: ../include/net-snmp/library/transform_oids.h
+./snmpAAL5PVCDomain.lo: ../include/net-snmp/net-snmp-config.h
+./snmpAAL5PVCDomain.lo: ../include/net-snmp/system/linux.h
+./snmpAAL5PVCDomain.lo: ../include/net-snmp/system/sysv.h
+./snmpAAL5PVCDomain.lo: ../include/net-snmp/system/generic.h
+./snmpAAL5PVCDomain.lo: ../include/net-snmp/machine/generic.h
+./snmpAAL5PVCDomain.lo: ../include/net-snmp/types.h 
+./snmpAAL5PVCDomain.lo: ../include/net-snmp/definitions.h
+./snmpAAL5PVCDomain.lo: ../include/net-snmp/library/snmp_api.h
+./snmpAAL5PVCDomain.lo: ../include/net-snmp/library/asn1.h
+./snmpAAL5PVCDomain.lo: ../include/net-snmp/library/snmp_impl.h
+./snmpAAL5PVCDomain.lo: ../include/net-snmp/library/snmp.h
+./snmpAAL5PVCDomain.lo: ../include/net-snmp/library/snmp-tc.h
+./snmpAAL5PVCDomain.lo: ../include/net-snmp/output_api.h
+./snmpAAL5PVCDomain.lo: ../include/net-snmp/library/snmp_client.h
+./snmpAAL5PVCDomain.lo: ../include/net-snmp/library/snmp_debug.h
+./snmpAAL5PVCDomain.lo: ../include/net-snmp/library/snmp_logging.h
+./snmpAAL5PVCDomain.lo: ../include/net-snmp/config_api.h
+./snmpAAL5PVCDomain.lo: ../include/net-snmp/library/read_config.h
+./snmpAAL5PVCDomain.lo: ../include/net-snmp/library/default_store.h
+./snmpAAL5PVCDomain.lo: ../include/net-snmp/library/snmp_parse_args.h
+./snmpAAL5PVCDomain.lo: ../include/net-snmp/library/snmp_enum.h
+./snmpAAL5PVCDomain.lo: ../include/net-snmp/library/vacm.h
+./snmpAAL5PVCDomain.lo: ../include/net-snmp/library/snmp_transport.h
+./snmpAAL5PVCDomain.lo: ../include/net-snmp/library/snmpAAL5PVCDomain.h
+./snmp_alarm.lo: ../include/net-snmp/net-snmp-config.h
+./snmp_alarm.lo: ../include/net-snmp/system/linux.h
+./snmp_alarm.lo: ../include/net-snmp/system/sysv.h
+./snmp_alarm.lo: ../include/net-snmp/system/generic.h
+./snmp_alarm.lo: ../include/net-snmp/machine/generic.h 
+./snmp_alarm.lo: ../include/net-snmp/types.h 
+./snmp_alarm.lo: ../include/net-snmp/definitions.h
+./snmp_alarm.lo: ../include/net-snmp/library/snmp_api.h
+./snmp_alarm.lo: ../include/net-snmp/library/asn1.h
+./snmp_alarm.lo: ../include/net-snmp/library/snmp_impl.h
+./snmp_alarm.lo: ../include/net-snmp/library/snmp.h
+./snmp_alarm.lo: ../include/net-snmp/library/snmp-tc.h
+./snmp_alarm.lo: ../include/net-snmp/output_api.h
+./snmp_alarm.lo: ../include/net-snmp/library/snmp_client.h
+./snmp_alarm.lo: ../include/net-snmp/library/snmp_debug.h
+./snmp_alarm.lo: ../include/net-snmp/library/snmp_logging.h
+./snmp_alarm.lo: ../include/net-snmp/config_api.h
+./snmp_alarm.lo: ../include/net-snmp/library/read_config.h
+./snmp_alarm.lo: ../include/net-snmp/library/default_store.h
+./snmp_alarm.lo: ../include/net-snmp/library/snmp_parse_args.h
+./snmp_alarm.lo: ../include/net-snmp/library/snmp_enum.h
+./snmp_alarm.lo: ../include/net-snmp/library/vacm.h
+./snmp_alarm.lo: ../include/net-snmp/utilities.h
+./snmp_alarm.lo: ../include/net-snmp/library/getopt.h
+./snmp_alarm.lo: ../include/net-snmp/library/system.h
+./snmp_alarm.lo: ../include/net-snmp/library/tools.h
+./snmp_alarm.lo: ../include/net-snmp/library/int64.h
+./snmp_alarm.lo: ../include/net-snmp/library/mt_support.h
+./snmp_alarm.lo: ../include/net-snmp/library/snmp_alarm.h
+./snmp_alarm.lo: ../include/net-snmp/library/data_list.h
+./snmp_alarm.lo: ../include/net-snmp/library/callback.h
+./snmp_alarm.lo: ../include/net-snmp/library/oid_stash.h
+./snmp_alarm.lo: ../include/net-snmp/library/check_varbind.h
+./snmp_alarm.lo: ../include/net-snmp/version.h
+./snmp_api.lo: ../include/net-snmp/net-snmp-config.h
+./snmp_api.lo: ../include/net-snmp/system/linux.h
+./snmp_api.lo: ../include/net-snmp/system/sysv.h
+./snmp_api.lo: ../include/net-snmp/system/generic.h
+./snmp_api.lo: ../include/net-snmp/machine/generic.h 
+./snmp_api.lo:  ../include/net-snmp/types.h
+./snmp_api.lo: ../include/net-snmp/definitions.h
+./snmp_api.lo: ../include/net-snmp/library/snmp_api.h
+./snmp_api.lo: ../include/net-snmp/library/asn1.h
+./snmp_api.lo: ../include/net-snmp/library/snmp_impl.h
+./snmp_api.lo: ../include/net-snmp/library/snmp.h
+./snmp_api.lo: ../include/net-snmp/library/snmp-tc.h
+./snmp_api.lo: ../include/net-snmp/output_api.h
+./snmp_api.lo: ../include/net-snmp/library/snmp_client.h
+./snmp_api.lo: ../include/net-snmp/library/snmp_debug.h
+./snmp_api.lo: ../include/net-snmp/library/snmp_logging.h
+./snmp_api.lo: ../include/net-snmp/config_api.h
+./snmp_api.lo: ../include/net-snmp/library/read_config.h
+./snmp_api.lo: ../include/net-snmp/library/default_store.h
+./snmp_api.lo: ../include/net-snmp/library/snmp_parse_args.h
+./snmp_api.lo: ../include/net-snmp/library/snmp_enum.h
+./snmp_api.lo: ../include/net-snmp/library/vacm.h
+./snmp_api.lo: ../include/net-snmp/utilities.h
+./snmp_api.lo: ../include/net-snmp/library/getopt.h
+./snmp_api.lo: ../include/net-snmp/library/system.h
+./snmp_api.lo: ../include/net-snmp/library/tools.h
+./snmp_api.lo: ../include/net-snmp/library/int64.h
+./snmp_api.lo: ../include/net-snmp/library/mt_support.h
+./snmp_api.lo: ../include/net-snmp/library/snmp_alarm.h
+./snmp_api.lo: ../include/net-snmp/library/data_list.h
+./snmp_api.lo: ../include/net-snmp/library/callback.h
+./snmp_api.lo: ../include/net-snmp/library/oid_stash.h
+./snmp_api.lo: ../include/net-snmp/library/check_varbind.h
+./snmp_api.lo: ../include/net-snmp/version.h
+./snmp_api.lo: ../include/net-snmp/library/parse.h
+./snmp_api.lo: ../include/net-snmp/library/mib.h
+./snmp_api.lo: ../include/net-snmp/library/snmpv3.h
+./snmp_api.lo: ../include/net-snmp/library/container.h
+./snmp_api.lo: ../include/net-snmp/library/factory.h
+./snmp_api.lo: ../include/net-snmp/library/snmp_secmod.h
+./snmp_api.lo: ../include/net-snmp/library/snmpusm.h
+./snmp_api.lo: ../include/net-snmp/library/keytools.h
+./snmp_api.lo: ../include/net-snmp/library/lcd_time.h
+./snmp_api.lo: ../include/net-snmp/library/snmp_transport.h
+./snmp_api.lo: ../include/net-snmp/library/transform_oids.h
+./snmp_auth.lo: ../include/net-snmp/net-snmp-config.h
+./snmp_auth.lo: ../include/net-snmp/system/linux.h
+./snmp_auth.lo: ../include/net-snmp/system/sysv.h
+./snmp_auth.lo: ../include/net-snmp/system/generic.h
+./snmp_auth.lo: ../include/net-snmp/machine/generic.h 
+./snmp_auth.lo:  ../include/net-snmp/types.h
+./snmp_auth.lo: ../include/net-snmp/definitions.h
+./snmp_auth.lo: ../include/net-snmp/library/snmp_api.h
+./snmp_auth.lo: ../include/net-snmp/library/asn1.h
+./snmp_auth.lo: ../include/net-snmp/library/snmp_impl.h
+./snmp_auth.lo: ../include/net-snmp/library/snmp.h
+./snmp_auth.lo: ../include/net-snmp/library/snmp-tc.h
+./snmp_auth.lo: ../include/net-snmp/output_api.h
+./snmp_auth.lo: ../include/net-snmp/library/snmp_client.h
+./snmp_auth.lo: ../include/net-snmp/library/snmp_debug.h
+./snmp_auth.lo: ../include/net-snmp/library/snmp_logging.h
+./snmp_auth.lo: ../include/net-snmp/utilities.h
+./snmp_auth.lo: ../include/net-snmp/library/getopt.h
+./snmp_auth.lo: ../include/net-snmp/library/system.h
+./snmp_auth.lo: ../include/net-snmp/library/tools.h
+./snmp_auth.lo: ../include/net-snmp/library/int64.h
+./snmp_auth.lo: ../include/net-snmp/library/mt_support.h
+./snmp_auth.lo: ../include/net-snmp/library/snmp_alarm.h
+./snmp_auth.lo: ../include/net-snmp/library/data_list.h
+./snmp_auth.lo: ../include/net-snmp/library/callback.h
+./snmp_auth.lo: ../include/net-snmp/library/oid_stash.h
+./snmp_auth.lo: ../include/net-snmp/library/check_varbind.h
+./snmp_auth.lo: ../include/net-snmp/version.h
+./snmp_auth.lo: ../include/net-snmp/library/mib.h
+./snmp_auth.lo: ../include/net-snmp/library/md5.h
+./snmp_auth.lo: ../include/net-snmp/library/scapi.h
+./snmp.lo: ../include/net-snmp/net-snmp-config.h
+./snmp.lo: ../include/net-snmp/system/linux.h
+./snmp.lo: ../include/net-snmp/system/sysv.h
+./snmp.lo: ../include/net-snmp/system/generic.h
+./snmp.lo: ../include/net-snmp/machine/generic.h 
+./snmp.lo: ../include/net-snmp/types.h 
+./snmp.lo: ../include/net-snmp/definitions.h
+./snmp.lo: ../include/net-snmp/library/snmp_api.h
+./snmp.lo: ../include/net-snmp/library/asn1.h
+./snmp.lo: ../include/net-snmp/library/snmp_impl.h
+./snmp.lo: ../include/net-snmp/library/snmp.h
+./snmp.lo: ../include/net-snmp/library/snmp-tc.h
+./snmp.lo: ../include/net-snmp/output_api.h
+./snmp.lo: ../include/net-snmp/library/snmp_client.h
+./snmp.lo: ../include/net-snmp/library/snmp_debug.h
+./snmp.lo: ../include/net-snmp/library/snmp_logging.h 
+./snmp.lo:  ../include/net-snmp/library/mib.h
+./snmpCallbackDomain.lo: ../include/net-snmp/net-snmp-config.h
+./snmpCallbackDomain.lo: ../include/net-snmp/system/linux.h
+./snmpCallbackDomain.lo: ../include/net-snmp/system/sysv.h
+./snmpCallbackDomain.lo: ../include/net-snmp/system/generic.h
+./snmpCallbackDomain.lo: ../include/net-snmp/machine/generic.h
+./snmpCallbackDomain.lo:  ../include/net-snmp/types.h
+./snmpCallbackDomain.lo: ../include/net-snmp/definitions.h
+./snmpCallbackDomain.lo: ../include/net-snmp/library/snmp_api.h
+./snmpCallbackDomain.lo: ../include/net-snmp/library/asn1.h
+./snmpCallbackDomain.lo: ../include/net-snmp/library/snmp_impl.h
+./snmpCallbackDomain.lo: ../include/net-snmp/library/snmp.h
+./snmpCallbackDomain.lo: ../include/net-snmp/library/snmp-tc.h
+./snmpCallbackDomain.lo: ../include/net-snmp/output_api.h
+./snmpCallbackDomain.lo: ../include/net-snmp/library/snmp_client.h
+./snmpCallbackDomain.lo: ../include/net-snmp/library/snmp_debug.h
+./snmpCallbackDomain.lo: ../include/net-snmp/library/snmp_logging.h
+./snmpCallbackDomain.lo: ../include/net-snmp/config_api.h
+./snmpCallbackDomain.lo: ../include/net-snmp/library/read_config.h
+./snmpCallbackDomain.lo: ../include/net-snmp/library/default_store.h
+./snmpCallbackDomain.lo: ../include/net-snmp/library/snmp_parse_args.h
+./snmpCallbackDomain.lo: ../include/net-snmp/library/snmp_enum.h
+./snmpCallbackDomain.lo: ../include/net-snmp/library/vacm.h
+./snmpCallbackDomain.lo: ../include/net-snmp/utilities.h
+./snmpCallbackDomain.lo: ../include/net-snmp/library/getopt.h
+./snmpCallbackDomain.lo: ../include/net-snmp/library/system.h
+./snmpCallbackDomain.lo: ../include/net-snmp/library/tools.h
+./snmpCallbackDomain.lo: ../include/net-snmp/library/int64.h
+./snmpCallbackDomain.lo: ../include/net-snmp/library/mt_support.h
+./snmpCallbackDomain.lo: ../include/net-snmp/library/snmp_alarm.h
+./snmpCallbackDomain.lo: ../include/net-snmp/library/data_list.h
+./snmpCallbackDomain.lo: ../include/net-snmp/library/callback.h
+./snmpCallbackDomain.lo: ../include/net-snmp/library/oid_stash.h
+./snmpCallbackDomain.lo: ../include/net-snmp/library/check_varbind.h
+./snmpCallbackDomain.lo: ../include/net-snmp/version.h
+./snmpCallbackDomain.lo: ../include/net-snmp/library/snmp_transport.h
+./snmpCallbackDomain.lo: ../include/net-snmp/library/snmpUnixDomain.h
+./snmpCallbackDomain.lo: ../include/net-snmp/library/snmpCallbackDomain.h
+./snmp_client.lo: ../include/net-snmp/net-snmp-config.h
+./snmp_client.lo: ../include/net-snmp/system/linux.h
+./snmp_client.lo: ../include/net-snmp/system/sysv.h
+./snmp_client.lo: ../include/net-snmp/system/generic.h
+./snmp_client.lo: ../include/net-snmp/machine/generic.h 
+./snmp_client.lo: ../include/net-snmp/types.h
+./snmp_client.lo: ../include/net-snmp/definitions.h
+./snmp_client.lo: ../include/net-snmp/library/snmp_api.h
+./snmp_client.lo: ../include/net-snmp/library/asn1.h
+./snmp_client.lo: ../include/net-snmp/library/snmp_impl.h
+./snmp_client.lo: ../include/net-snmp/library/snmp.h
+./snmp_client.lo: ../include/net-snmp/library/snmp-tc.h
+./snmp_client.lo: ../include/net-snmp/library/snmp_client.h
+./snmp_client.lo: ../include/net-snmp/library/snmp_secmod.h
+./snmp_client.lo: ../include/net-snmp/library/mib.h
+./snmp_debug.lo: ../include/net-snmp/net-snmp-config.h
+./snmp_debug.lo: ../include/net-snmp/system/linux.h
+./snmp_debug.lo: ../include/net-snmp/system/sysv.h
+./snmp_debug.lo: ../include/net-snmp/system/generic.h
+./snmp_debug.lo: ../include/net-snmp/machine/generic.h 
+./snmp_debug.lo: ../include/net-snmp/types.h 
+./snmp_debug.lo: ../include/net-snmp/definitions.h
+./snmp_debug.lo: ../include/net-snmp/library/snmp_api.h
+./snmp_debug.lo: ../include/net-snmp/library/asn1.h
+./snmp_debug.lo: ../include/net-snmp/library/snmp_impl.h
+./snmp_debug.lo: ../include/net-snmp/library/snmp.h
+./snmp_debug.lo: ../include/net-snmp/library/snmp-tc.h
+./snmp_debug.lo: ../include/net-snmp/output_api.h
+./snmp_debug.lo: ../include/net-snmp/library/snmp_client.h
+./snmp_debug.lo: ../include/net-snmp/library/snmp_debug.h
+./snmp_debug.lo: ../include/net-snmp/library/snmp_logging.h
+./snmp_debug.lo: ../include/net-snmp/config_api.h
+./snmp_debug.lo: ../include/net-snmp/library/read_config.h
+./snmp_debug.lo: ../include/net-snmp/library/default_store.h
+./snmp_debug.lo: ../include/net-snmp/library/snmp_parse_args.h
+./snmp_debug.lo: ../include/net-snmp/library/snmp_enum.h
+./snmp_debug.lo: ../include/net-snmp/library/vacm.h
+./snmp_debug.lo: ../include/net-snmp/utilities.h
+./snmp_debug.lo: ../include/net-snmp/library/getopt.h
+./snmp_debug.lo: ../include/net-snmp/library/system.h
+./snmp_debug.lo: ../include/net-snmp/library/tools.h
+./snmp_debug.lo: ../include/net-snmp/library/int64.h
+./snmp_debug.lo: ../include/net-snmp/library/mt_support.h
+./snmp_debug.lo: ../include/net-snmp/library/snmp_alarm.h
+./snmp_debug.lo: ../include/net-snmp/library/data_list.h
+./snmp_debug.lo: ../include/net-snmp/library/callback.h
+./snmp_debug.lo: ../include/net-snmp/library/oid_stash.h
+./snmp_debug.lo: ../include/net-snmp/library/check_varbind.h
+./snmp_debug.lo: ../include/net-snmp/version.h
+./snmp_debug.lo: ../include/net-snmp/library/mib.h
+./snmp_enum.lo: ../include/net-snmp/net-snmp-config.h
+./snmp_enum.lo: ../include/net-snmp/system/linux.h
+./snmp_enum.lo: ../include/net-snmp/system/sysv.h
+./snmp_enum.lo: ../include/net-snmp/system/generic.h
+./snmp_enum.lo: ../include/net-snmp/machine/generic.h 
+./snmp_enum.lo:  ../include/net-snmp/library/snmp_enum.h
+./snmpIPXDomain.lo: ../include/net-snmp/net-snmp-config.h
+./snmpIPXDomain.lo: ../include/net-snmp/system/linux.h
+./snmpIPXDomain.lo: ../include/net-snmp/system/sysv.h
+./snmpIPXDomain.lo: ../include/net-snmp/system/generic.h
+./snmpIPXDomain.lo: ../include/net-snmp/machine/generic.h
+./snmpIPXDomain.lo:  ../include/net-snmp/types.h
+./snmpIPXDomain.lo:  ../include/net-snmp/definitions.h
+./snmpIPXDomain.lo: ../include/net-snmp/library/snmp_api.h
+./snmpIPXDomain.lo: ../include/net-snmp/library/asn1.h
+./snmpIPXDomain.lo: ../include/net-snmp/library/snmp_impl.h
+./snmpIPXDomain.lo: ../include/net-snmp/library/snmp.h
+./snmpIPXDomain.lo: ../include/net-snmp/library/snmp-tc.h
+./snmpIPXDomain.lo: ../include/net-snmp/output_api.h
+./snmpIPXDomain.lo: ../include/net-snmp/library/snmp_client.h
+./snmpIPXDomain.lo: ../include/net-snmp/library/snmp_debug.h
+./snmpIPXDomain.lo: ../include/net-snmp/library/snmp_logging.h
+./snmpIPXDomain.lo: ../include/net-snmp/config_api.h
+./snmpIPXDomain.lo: ../include/net-snmp/library/read_config.h
+./snmpIPXDomain.lo: ../include/net-snmp/library/default_store.h
+./snmpIPXDomain.lo: ../include/net-snmp/library/snmp_parse_args.h
+./snmpIPXDomain.lo: ../include/net-snmp/library/snmp_enum.h
+./snmpIPXDomain.lo: ../include/net-snmp/library/vacm.h
+./snmpIPXDomain.lo: ../include/net-snmp/library/snmp_transport.h
+./snmpIPXDomain.lo: ../include/net-snmp/library/snmpIPXDomain.h
+./snmpksm.lo: ../include/net-snmp/net-snmp-config.h
+./snmpksm.lo: ../include/net-snmp/system/linux.h
+./snmpksm.lo: ../include/net-snmp/system/sysv.h
+./snmpksm.lo: ../include/net-snmp/system/generic.h
+./snmpksm.lo: ../include/net-snmp/machine/generic.h 
+./snmpksm.lo: ../include/net-snmp/output_api.h ../include/net-snmp/types.h
+./snmpksm.lo: ../include/net-snmp/definitions.h
+./snmpksm.lo: ../include/net-snmp/library/snmp_api.h
+./snmpksm.lo: ../include/net-snmp/library/asn1.h
+./snmpksm.lo: ../include/net-snmp/library/snmp_impl.h
+./snmpksm.lo: ../include/net-snmp/library/snmp.h
+./snmpksm.lo: ../include/net-snmp/library/snmp-tc.h
+./snmpksm.lo: ../include/net-snmp/library/snmp_client.h
+./snmpksm.lo: ../include/net-snmp/library/snmp_debug.h
+./snmpksm.lo: ../include/net-snmp/library/snmp_logging.h
+./snmpksm.lo: ../include/net-snmp/config_api.h
+./snmpksm.lo: ../include/net-snmp/library/read_config.h
+./snmpksm.lo: ../include/net-snmp/library/default_store.h
+./snmpksm.lo: ../include/net-snmp/library/snmp_parse_args.h
+./snmpksm.lo: ../include/net-snmp/library/snmp_enum.h
+./snmpksm.lo: ../include/net-snmp/library/vacm.h
+./snmpksm.lo: ../include/net-snmp/utilities.h
+./snmpksm.lo: ../include/net-snmp/library/getopt.h
+./snmpksm.lo: ../include/net-snmp/library/system.h
+./snmpksm.lo: ../include/net-snmp/library/tools.h
+./snmpksm.lo: ../include/net-snmp/library/int64.h
+./snmpksm.lo: ../include/net-snmp/library/mt_support.h
+./snmpksm.lo: ../include/net-snmp/library/snmp_alarm.h
+./snmpksm.lo: ../include/net-snmp/library/data_list.h
+./snmpksm.lo: ../include/net-snmp/library/callback.h
+./snmpksm.lo: ../include/net-snmp/library/oid_stash.h
+./snmpksm.lo: ../include/net-snmp/library/check_varbind.h
+./snmpksm.lo: ../include/net-snmp/version.h
+./snmpksm.lo: ../include/net-snmp/library/keytools.h
+./snmpksm.lo: ../include/net-snmp/library/snmpv3.h
+./snmpksm.lo: ../include/net-snmp/library/lcd_time.h
+./snmpksm.lo: ../include/net-snmp/library/scapi.h
+./snmpksm.lo: ../include/net-snmp/library/snmp_secmod.h
+./snmpksm.lo: ../include/net-snmp/library/snmpksm.h
+./snmp_logging.lo: ../include/net-snmp/net-snmp-config.h
+./snmp_logging.lo: ../include/net-snmp/system/linux.h
+./snmp_logging.lo: ../include/net-snmp/system/sysv.h
+./snmp_logging.lo: ../include/net-snmp/system/generic.h
+./snmp_logging.lo: ../include/net-snmp/machine/generic.h 
+./snmp_logging.lo: ../include/net-snmp/types.h
+./snmp_logging.lo: ../include/net-snmp/definitions.h
+./snmp_logging.lo: ../include/net-snmp/library/snmp_api.h
+./snmp_logging.lo: ../include/net-snmp/library/asn1.h
+./snmp_logging.lo: ../include/net-snmp/library/snmp_impl.h
+./snmp_logging.lo: ../include/net-snmp/library/snmp.h
+./snmp_logging.lo: ../include/net-snmp/library/snmp-tc.h
+./snmp_logging.lo: ../include/net-snmp/output_api.h
+./snmp_logging.lo: ../include/net-snmp/library/snmp_client.h
+./snmp_logging.lo: ../include/net-snmp/library/snmp_debug.h
+./snmp_logging.lo: ../include/net-snmp/library/snmp_logging.h
+./snmp_logging.lo: ../include/net-snmp/config_api.h
+./snmp_logging.lo: ../include/net-snmp/library/read_config.h
+./snmp_logging.lo: ../include/net-snmp/library/default_store.h
+./snmp_logging.lo: ../include/net-snmp/library/snmp_parse_args.h
+./snmp_logging.lo: ../include/net-snmp/library/snmp_enum.h
+./snmp_logging.lo: ../include/net-snmp/library/vacm.h
+./snmp_logging.lo: ../include/net-snmp/utilities.h
+./snmp_logging.lo: ../include/net-snmp/library/getopt.h
+./snmp_logging.lo: ../include/net-snmp/library/system.h
+./snmp_logging.lo: ../include/net-snmp/library/tools.h
+./snmp_logging.lo: ../include/net-snmp/library/int64.h
+./snmp_logging.lo: ../include/net-snmp/library/mt_support.h
+./snmp_logging.lo: ../include/net-snmp/library/snmp_alarm.h
+./snmp_logging.lo: ../include/net-snmp/library/data_list.h
+./snmp_logging.lo: ../include/net-snmp/library/callback.h
+./snmp_logging.lo: ../include/net-snmp/library/oid_stash.h
+./snmp_logging.lo: ../include/net-snmp/library/check_varbind.h
+./snmp_logging.lo: ../include/net-snmp/version.h
+./snmp_parse_args.lo: ../include/net-snmp/net-snmp-config.h
+./snmp_parse_args.lo: ../include/net-snmp/system/linux.h
+./snmp_parse_args.lo: ../include/net-snmp/system/sysv.h
+./snmp_parse_args.lo: ../include/net-snmp/system/generic.h
+./snmp_parse_args.lo: ../include/net-snmp/machine/generic.h
+./snmp_parse_args.lo:  ../include/net-snmp/types.h
+./snmp_parse_args.lo: ../include/net-snmp/definitions.h
+./snmp_parse_args.lo: ../include/net-snmp/library/snmp_api.h
+./snmp_parse_args.lo: ../include/net-snmp/library/asn1.h
+./snmp_parse_args.lo: ../include/net-snmp/library/snmp_impl.h
+./snmp_parse_args.lo: ../include/net-snmp/library/snmp.h
+./snmp_parse_args.lo: ../include/net-snmp/library/snmp-tc.h
+./snmp_parse_args.lo: ../include/net-snmp/output_api.h
+./snmp_parse_args.lo: ../include/net-snmp/library/snmp_client.h
+./snmp_parse_args.lo: ../include/net-snmp/library/snmp_debug.h
+./snmp_parse_args.lo: ../include/net-snmp/library/snmp_logging.h
+./snmp_parse_args.lo: ../include/net-snmp/config_api.h
+./snmp_parse_args.lo: ../include/net-snmp/library/read_config.h
+./snmp_parse_args.lo: ../include/net-snmp/library/default_store.h
+./snmp_parse_args.lo: ../include/net-snmp/library/snmp_parse_args.h
+./snmp_parse_args.lo: ../include/net-snmp/library/snmp_enum.h
+./snmp_parse_args.lo: ../include/net-snmp/library/vacm.h
+./snmp_parse_args.lo: ../include/net-snmp/utilities.h
+./snmp_parse_args.lo: ../include/net-snmp/library/getopt.h
+./snmp_parse_args.lo: ../include/net-snmp/library/system.h
+./snmp_parse_args.lo: ../include/net-snmp/library/tools.h
+./snmp_parse_args.lo: ../include/net-snmp/library/int64.h
+./snmp_parse_args.lo: ../include/net-snmp/library/mt_support.h
+./snmp_parse_args.lo: ../include/net-snmp/library/snmp_alarm.h
+./snmp_parse_args.lo: ../include/net-snmp/library/data_list.h
+./snmp_parse_args.lo: ../include/net-snmp/library/callback.h
+./snmp_parse_args.lo: ../include/net-snmp/library/oid_stash.h
+./snmp_parse_args.lo: ../include/net-snmp/library/check_varbind.h
+./snmp_parse_args.lo: ../include/net-snmp/version.h
+./snmp_parse_args.lo: ../include/net-snmp/library/mib.h
+./snmp_parse_args.lo: ../include/net-snmp/library/scapi.h
+./snmp_parse_args.lo: ../include/net-snmp/library/keytools.h
+./snmp_parse_args.lo: ../include/net-snmp/library/parse.h
+./snmp_parse_args.lo: ../include/net-snmp/library/snmpv3.h
+./snmp_parse_args.lo: ../include/net-snmp/library/transform_oids.h
+./snmp_secmod.lo: ../include/net-snmp/net-snmp-config.h
+./snmp_secmod.lo: ../include/net-snmp/system/linux.h
+./snmp_secmod.lo: ../include/net-snmp/system/sysv.h
+./snmp_secmod.lo: ../include/net-snmp/system/generic.h
+./snmp_secmod.lo: ../include/net-snmp/machine/generic.h 
+./snmp_secmod.lo: ../include/net-snmp/types.h 
+./snmp_secmod.lo: ../include/net-snmp/definitions.h
+./snmp_secmod.lo: ../include/net-snmp/library/snmp_api.h
+./snmp_secmod.lo: ../include/net-snmp/library/asn1.h
+./snmp_secmod.lo: ../include/net-snmp/library/snmp_impl.h
+./snmp_secmod.lo: ../include/net-snmp/library/snmp.h
+./snmp_secmod.lo: ../include/net-snmp/library/snmp-tc.h
+./snmp_secmod.lo: ../include/net-snmp/output_api.h
+./snmp_secmod.lo: ../include/net-snmp/library/snmp_client.h
+./snmp_secmod.lo: ../include/net-snmp/library/snmp_debug.h
+./snmp_secmod.lo: ../include/net-snmp/library/snmp_logging.h
+./snmp_secmod.lo: ../include/net-snmp/config_api.h
+./snmp_secmod.lo: ../include/net-snmp/library/read_config.h
+./snmp_secmod.lo: ../include/net-snmp/library/default_store.h
+./snmp_secmod.lo: ../include/net-snmp/library/snmp_parse_args.h
+./snmp_secmod.lo: ../include/net-snmp/library/snmp_enum.h
+./snmp_secmod.lo: ../include/net-snmp/library/vacm.h
+./snmp_secmod.lo: ../include/net-snmp/utilities.h
+./snmp_secmod.lo: ../include/net-snmp/library/getopt.h
+./snmp_secmod.lo: ../include/net-snmp/library/system.h
+./snmp_secmod.lo: ../include/net-snmp/library/tools.h
+./snmp_secmod.lo: ../include/net-snmp/library/int64.h
+./snmp_secmod.lo: ../include/net-snmp/library/mt_support.h
+./snmp_secmod.lo: ../include/net-snmp/library/snmp_alarm.h
+./snmp_secmod.lo: ../include/net-snmp/library/data_list.h
+./snmp_secmod.lo: ../include/net-snmp/library/callback.h
+./snmp_secmod.lo: ../include/net-snmp/library/oid_stash.h
+./snmp_secmod.lo: ../include/net-snmp/library/check_varbind.h
+./snmp_secmod.lo: ../include/net-snmp/version.h
+./snmp_secmod.lo: ../include/net-snmp/library/snmp_secmod.h
+./snmp_secmod.lo: ../include/net-snmp/library/snmpusm.h snmpsm_init.h
+./snmp-tc.lo: ../include/net-snmp/net-snmp-config.h
+./snmp-tc.lo: ../include/net-snmp/system/linux.h
+./snmp-tc.lo: ../include/net-snmp/system/sysv.h
+./snmp-tc.lo: ../include/net-snmp/system/generic.h
+./snmp-tc.lo: ../include/net-snmp/machine/generic.h 
+./snmp-tc.lo:  ../include/net-snmp/types.h
+./snmp-tc.lo: ../include/net-snmp/definitions.h
+./snmp-tc.lo: ../include/net-snmp/library/snmp_api.h
+./snmp-tc.lo: ../include/net-snmp/library/asn1.h
+./snmp-tc.lo: ../include/net-snmp/library/snmp_impl.h
+./snmp-tc.lo: ../include/net-snmp/library/snmp.h
+./snmp-tc.lo: ../include/net-snmp/library/snmp-tc.h
+./snmpTCPDomain.lo: ../include/net-snmp/net-snmp-config.h
+./snmpTCPDomain.lo: ../include/net-snmp/system/linux.h
+./snmpTCPDomain.lo: ../include/net-snmp/system/sysv.h
+./snmpTCPDomain.lo: ../include/net-snmp/system/generic.h
+./snmpTCPDomain.lo: ../include/net-snmp/machine/generic.h
+./snmpTCPDomain.lo: ../include/net-snmp/types.h 
+./snmpTCPDomain.lo: ../include/net-snmp/definitions.h
+./snmpTCPDomain.lo: ../include/net-snmp/library/snmp_api.h
+./snmpTCPDomain.lo: ../include/net-snmp/library/asn1.h
+./snmpTCPDomain.lo: ../include/net-snmp/library/snmp_impl.h
+./snmpTCPDomain.lo: ../include/net-snmp/library/snmp.h
+./snmpTCPDomain.lo: ../include/net-snmp/library/snmp-tc.h
+./snmpTCPDomain.lo: ../include/net-snmp/output_api.h
+./snmpTCPDomain.lo: ../include/net-snmp/library/snmp_client.h
+./snmpTCPDomain.lo: ../include/net-snmp/library/snmp_debug.h
+./snmpTCPDomain.lo: ../include/net-snmp/library/snmp_logging.h
+./snmpTCPDomain.lo: ../include/net-snmp/library/snmp_transport.h
+./snmpTCPDomain.lo: ../include/net-snmp/library/snmpUDPDomain.h
+./snmpTCPDomain.lo: ../include/net-snmp/library/snmpTCPDomain.h
+./snmpTCPIPv6Domain.lo: ../include/net-snmp/net-snmp-config.h
+./snmpTCPIPv6Domain.lo: ../include/net-snmp/system/linux.h
+./snmpTCPIPv6Domain.lo: ../include/net-snmp/system/sysv.h
+./snmpTCPIPv6Domain.lo: ../include/net-snmp/system/generic.h
+./snmpTCPIPv6Domain.lo: ../include/net-snmp/machine/generic.h
+./snmpTCPIPv6Domain.lo:  ../include/net-snmp/types.h
+./snmpTCPIPv6Domain.lo: ../include/net-snmp/definitions.h
+./snmpTCPIPv6Domain.lo: ../include/net-snmp/library/snmp_api.h
+./snmpTCPIPv6Domain.lo: ../include/net-snmp/library/asn1.h
+./snmpTCPIPv6Domain.lo: ../include/net-snmp/library/snmp_impl.h
+./snmpTCPIPv6Domain.lo: ../include/net-snmp/library/snmp.h
+./snmpTCPIPv6Domain.lo: ../include/net-snmp/library/snmp-tc.h
+./snmpTCPIPv6Domain.lo: ../include/net-snmp/output_api.h
+./snmpTCPIPv6Domain.lo: ../include/net-snmp/library/snmp_client.h
+./snmpTCPIPv6Domain.lo: ../include/net-snmp/library/snmp_debug.h
+./snmpTCPIPv6Domain.lo: ../include/net-snmp/library/snmp_logging.h
+./snmpTCPIPv6Domain.lo: ../include/net-snmp/config_api.h
+./snmpTCPIPv6Domain.lo: ../include/net-snmp/library/read_config.h
+./snmpTCPIPv6Domain.lo: ../include/net-snmp/library/default_store.h
+./snmpTCPIPv6Domain.lo: ../include/net-snmp/library/snmp_parse_args.h
+./snmpTCPIPv6Domain.lo: ../include/net-snmp/library/snmp_enum.h
+./snmpTCPIPv6Domain.lo: ../include/net-snmp/library/vacm.h
+./snmpTCPIPv6Domain.lo: ../include/net-snmp/library/snmp_transport.h
+./snmpTCPIPv6Domain.lo: ../include/net-snmp/library/snmpUDPIPv6Domain.h
+./snmpTCPIPv6Domain.lo: ../include/net-snmp/library/snmpTCPIPv6Domain.h
+./snmp_transport.lo: ../include/net-snmp/net-snmp-config.h
+./snmp_transport.lo: ../include/net-snmp/system/linux.h
+./snmp_transport.lo: ../include/net-snmp/system/sysv.h
+./snmp_transport.lo: ../include/net-snmp/system/generic.h
+./snmp_transport.lo: ../include/net-snmp/machine/generic.h
+./snmp_transport.lo: ../include/net-snmp/output_api.h
+./snmp_transport.lo: ../include/net-snmp/types.h 
+./snmp_transport.lo: ../include/net-snmp/definitions.h
+./snmp_transport.lo: ../include/net-snmp/library/snmp_api.h
+./snmp_transport.lo: ../include/net-snmp/library/asn1.h
+./snmp_transport.lo: ../include/net-snmp/library/snmp_impl.h
+./snmp_transport.lo: ../include/net-snmp/library/snmp.h
+./snmp_transport.lo: ../include/net-snmp/library/snmp-tc.h
+./snmp_transport.lo: ../include/net-snmp/library/snmp_client.h
+./snmp_transport.lo: ../include/net-snmp/library/snmp_debug.h
+./snmp_transport.lo: ../include/net-snmp/library/snmp_logging.h
+./snmp_transport.lo: ../include/net-snmp/utilities.h
+./snmp_transport.lo: ../include/net-snmp/library/getopt.h
+./snmp_transport.lo: ../include/net-snmp/library/system.h
+./snmp_transport.lo: ../include/net-snmp/library/tools.h
+./snmp_transport.lo: ../include/net-snmp/library/int64.h
+./snmp_transport.lo: ../include/net-snmp/library/mt_support.h
+./snmp_transport.lo: ../include/net-snmp/library/snmp_alarm.h
+./snmp_transport.lo: ../include/net-snmp/library/data_list.h
+./snmp_transport.lo: ../include/net-snmp/library/callback.h
+./snmp_transport.lo: ../include/net-snmp/library/oid_stash.h
+./snmp_transport.lo: ../include/net-snmp/library/check_varbind.h
+./snmp_transport.lo: ../include/net-snmp/version.h
+./snmp_transport.lo: ../include/net-snmp/library/snmp_transport.h
+./snmp_transport.lo: ../include/net-snmp/library/snmpUDPDomain.h
+./snmp_transport.lo: ../include/net-snmp/library/snmpTCPDomain.h
+./snmp_transport.lo: ../include/net-snmp/library/snmpIPXDomain.h
+./snmp_transport.lo: ../include/net-snmp/library/snmpUnixDomain.h
+./snmp_transport.lo: ../include/net-snmp/library/snmpUDPIPv6Domain.h
+./snmp_transport.lo: ../include/net-snmp/library/snmpTCPIPv6Domain.h
+./snmpUDPDomain.lo: ../include/net-snmp/net-snmp-config.h
+./snmpUDPDomain.lo: ../include/net-snmp/system/linux.h
+./snmpUDPDomain.lo: ../include/net-snmp/system/sysv.h
+./snmpUDPDomain.lo: ../include/net-snmp/system/generic.h
+./snmpUDPDomain.lo: ../include/net-snmp/machine/generic.h
+./snmpUDPDomain.lo: ../include/net-snmp/types.h 
+./snmpUDPDomain.lo: ../include/net-snmp/definitions.h
+./snmpUDPDomain.lo: ../include/net-snmp/library/snmp_api.h
+./snmpUDPDomain.lo: ../include/net-snmp/library/asn1.h
+./snmpUDPDomain.lo: ../include/net-snmp/library/snmp_impl.h
+./snmpUDPDomain.lo: ../include/net-snmp/library/snmp.h
+./snmpUDPDomain.lo: ../include/net-snmp/library/snmp-tc.h
+./snmpUDPDomain.lo: ../include/net-snmp/output_api.h
+./snmpUDPDomain.lo: ../include/net-snmp/library/snmp_client.h
+./snmpUDPDomain.lo: ../include/net-snmp/library/snmp_debug.h
+./snmpUDPDomain.lo: ../include/net-snmp/library/snmp_logging.h
+./snmpUDPDomain.lo: ../include/net-snmp/config_api.h
+./snmpUDPDomain.lo: ../include/net-snmp/library/read_config.h
+./snmpUDPDomain.lo: ../include/net-snmp/library/default_store.h
+./snmpUDPDomain.lo: ../include/net-snmp/library/snmp_parse_args.h
+./snmpUDPDomain.lo: ../include/net-snmp/library/snmp_enum.h
+./snmpUDPDomain.lo: ../include/net-snmp/library/vacm.h
+./snmpUDPDomain.lo: ../include/net-snmp/library/snmp_transport.h
+./snmpUDPDomain.lo: ../include/net-snmp/library/snmpUDPDomain.h
+./snmpUDPIPv6Domain.lo: ../include/net-snmp/net-snmp-config.h
+./snmpUDPIPv6Domain.lo: ../include/net-snmp/system/linux.h
+./snmpUDPIPv6Domain.lo: ../include/net-snmp/system/sysv.h
+./snmpUDPIPv6Domain.lo: ../include/net-snmp/system/generic.h
+./snmpUDPIPv6Domain.lo: ../include/net-snmp/machine/generic.h
+./snmpUDPIPv6Domain.lo: ../include/net-snmp/types.h 
+./snmpUDPIPv6Domain.lo: ../include/net-snmp/definitions.h
+./snmpUDPIPv6Domain.lo: ../include/net-snmp/library/snmp_api.h
+./snmpUDPIPv6Domain.lo: ../include/net-snmp/library/asn1.h
+./snmpUDPIPv6Domain.lo: ../include/net-snmp/library/snmp_impl.h
+./snmpUDPIPv6Domain.lo: ../include/net-snmp/library/snmp.h
+./snmpUDPIPv6Domain.lo: ../include/net-snmp/library/snmp-tc.h
+./snmpUDPIPv6Domain.lo: ../include/net-snmp/output_api.h
+./snmpUDPIPv6Domain.lo: ../include/net-snmp/library/snmp_client.h
+./snmpUDPIPv6Domain.lo: ../include/net-snmp/library/snmp_debug.h
+./snmpUDPIPv6Domain.lo: ../include/net-snmp/library/snmp_logging.h
+./snmpUDPIPv6Domain.lo: ../include/net-snmp/config_api.h
+./snmpUDPIPv6Domain.lo: ../include/net-snmp/library/read_config.h
+./snmpUDPIPv6Domain.lo: ../include/net-snmp/library/default_store.h
+./snmpUDPIPv6Domain.lo: ../include/net-snmp/library/snmp_parse_args.h
+./snmpUDPIPv6Domain.lo: ../include/net-snmp/library/snmp_enum.h
+./snmpUDPIPv6Domain.lo: ../include/net-snmp/library/vacm.h
+./snmpUDPIPv6Domain.lo: ../include/net-snmp/library/snmp_transport.h
+./snmpUDPIPv6Domain.lo: ../include/net-snmp/library/snmpUDPIPv6Domain.h
+./snmpUnixDomain.lo: ../include/net-snmp/net-snmp-config.h
+./snmpUnixDomain.lo: ../include/net-snmp/system/linux.h
+./snmpUnixDomain.lo: ../include/net-snmp/system/sysv.h
+./snmpUnixDomain.lo: ../include/net-snmp/system/generic.h
+./snmpUnixDomain.lo: ../include/net-snmp/machine/generic.h
+./snmpUnixDomain.lo: ../include/net-snmp/types.h 
+./snmpUnixDomain.lo: ../include/net-snmp/definitions.h
+./snmpUnixDomain.lo: ../include/net-snmp/library/snmp_api.h
+./snmpUnixDomain.lo: ../include/net-snmp/library/asn1.h
+./snmpUnixDomain.lo: ../include/net-snmp/library/snmp_impl.h
+./snmpUnixDomain.lo: ../include/net-snmp/library/snmp.h
+./snmpUnixDomain.lo: ../include/net-snmp/library/snmp-tc.h
+./snmpUnixDomain.lo: ../include/net-snmp/output_api.h
+./snmpUnixDomain.lo: ../include/net-snmp/library/snmp_client.h
+./snmpUnixDomain.lo: ../include/net-snmp/library/snmp_debug.h
+./snmpUnixDomain.lo: ../include/net-snmp/library/snmp_logging.h
+./snmpUnixDomain.lo: ../include/net-snmp/config_api.h
+./snmpUnixDomain.lo: ../include/net-snmp/library/read_config.h
+./snmpUnixDomain.lo: ../include/net-snmp/library/default_store.h
+./snmpUnixDomain.lo: ../include/net-snmp/library/snmp_parse_args.h
+./snmpUnixDomain.lo: ../include/net-snmp/library/snmp_enum.h
+./snmpUnixDomain.lo: ../include/net-snmp/library/vacm.h
+./snmpUnixDomain.lo: ../include/net-snmp/library/snmp_transport.h
+./snmpUnixDomain.lo: ../include/net-snmp/library/snmpUnixDomain.h
+./snmpusm.lo: ../include/net-snmp/net-snmp-config.h
+./snmpusm.lo: ../include/net-snmp/system/linux.h
+./snmpusm.lo: ../include/net-snmp/system/sysv.h
+./snmpusm.lo: ../include/net-snmp/system/generic.h
+./snmpusm.lo: ../include/net-snmp/machine/generic.h 
+./snmpusm.lo: ../include/net-snmp/types.h ../include/net-snmp/definitions.h
+./snmpusm.lo: ../include/net-snmp/library/snmp_api.h
+./snmpusm.lo: ../include/net-snmp/library/asn1.h
+./snmpusm.lo: ../include/net-snmp/library/snmp_impl.h
+./snmpusm.lo: ../include/net-snmp/library/snmp.h
+./snmpusm.lo: ../include/net-snmp/library/snmp-tc.h
+./snmpusm.lo: ../include/net-snmp/output_api.h
+./snmpusm.lo: ../include/net-snmp/library/snmp_client.h
+./snmpusm.lo: ../include/net-snmp/library/snmp_debug.h
+./snmpusm.lo: ../include/net-snmp/library/snmp_logging.h
+./snmpusm.lo: ../include/net-snmp/config_api.h
+./snmpusm.lo: ../include/net-snmp/library/read_config.h
+./snmpusm.lo: ../include/net-snmp/library/default_store.h
+./snmpusm.lo: ../include/net-snmp/library/snmp_parse_args.h
+./snmpusm.lo: ../include/net-snmp/library/snmp_enum.h
+./snmpusm.lo: ../include/net-snmp/library/vacm.h
+./snmpusm.lo: ../include/net-snmp/utilities.h
+./snmpusm.lo: ../include/net-snmp/library/getopt.h
+./snmpusm.lo: ../include/net-snmp/library/system.h
+./snmpusm.lo: ../include/net-snmp/library/tools.h
+./snmpusm.lo: ../include/net-snmp/library/int64.h
+./snmpusm.lo: ../include/net-snmp/library/mt_support.h
+./snmpusm.lo: ../include/net-snmp/library/snmp_alarm.h
+./snmpusm.lo: ../include/net-snmp/library/data_list.h
+./snmpusm.lo: ../include/net-snmp/library/callback.h
+./snmpusm.lo: ../include/net-snmp/library/oid_stash.h
+./snmpusm.lo: ../include/net-snmp/library/check_varbind.h
+./snmpusm.lo: ../include/net-snmp/version.h
+./snmpusm.lo: ../include/net-snmp/library/keytools.h
+./snmpusm.lo: ../include/net-snmp/library/snmpv3.h
+./snmpusm.lo: ../include/net-snmp/library/lcd_time.h
+./snmpusm.lo: ../include/net-snmp/library/scapi.h
+./snmpusm.lo: ../include/net-snmp/library/snmp_secmod.h
+./snmpusm.lo: ../include/net-snmp/library/snmpusm.h
+./snmpv3.lo: ../include/net-snmp/net-snmp-config.h
+./snmpv3.lo: ../include/net-snmp/system/linux.h
+./snmpv3.lo: ../include/net-snmp/system/sysv.h
+./snmpv3.lo: ../include/net-snmp/system/generic.h
+./snmpv3.lo: ../include/net-snmp/machine/generic.h 
+./snmpv3.lo:  ../include/net-snmp/types.h
+./snmpv3.lo: ../include/net-snmp/definitions.h
+./snmpv3.lo: ../include/net-snmp/library/snmp_api.h
+./snmpv3.lo: ../include/net-snmp/library/asn1.h
+./snmpv3.lo: ../include/net-snmp/library/snmp_impl.h
+./snmpv3.lo: ../include/net-snmp/library/snmp.h
+./snmpv3.lo: ../include/net-snmp/library/snmp-tc.h
+./snmpv3.lo: ../include/net-snmp/output_api.h
+./snmpv3.lo: ../include/net-snmp/library/snmp_client.h
+./snmpv3.lo: ../include/net-snmp/library/snmp_debug.h
+./snmpv3.lo: ../include/net-snmp/library/snmp_logging.h 
+./snmpv3.lo:  ../include/net-snmp/config_api.h
+./snmpv3.lo: ../include/net-snmp/library/read_config.h
+./snmpv3.lo: ../include/net-snmp/library/default_store.h
+./snmpv3.lo: ../include/net-snmp/library/snmp_parse_args.h
+./snmpv3.lo: ../include/net-snmp/library/snmp_enum.h
+./snmpv3.lo: ../include/net-snmp/library/vacm.h
+./snmpv3.lo: ../include/net-snmp/utilities.h
+./snmpv3.lo: ../include/net-snmp/library/getopt.h
+./snmpv3.lo: ../include/net-snmp/library/system.h
+./snmpv3.lo: ../include/net-snmp/library/tools.h
+./snmpv3.lo: ../include/net-snmp/library/int64.h
+./snmpv3.lo: ../include/net-snmp/library/mt_support.h
+./snmpv3.lo: ../include/net-snmp/library/snmp_alarm.h
+./snmpv3.lo: ../include/net-snmp/library/data_list.h
+./snmpv3.lo: ../include/net-snmp/library/callback.h
+./snmpv3.lo: ../include/net-snmp/library/oid_stash.h
+./snmpv3.lo: ../include/net-snmp/library/check_varbind.h
+./snmpv3.lo: ../include/net-snmp/version.h
+./snmpv3.lo: ../include/net-snmp/library/snmpv3.h
+./snmpv3.lo: ../include/net-snmp/library/lcd_time.h
+./snmpv3.lo: ../include/net-snmp/library/scapi.h
+./snmpv3.lo: ../include/net-snmp/library/keytools.h
+./snmpv3.lo: ../include/net-snmp/library/snmp_secmod.h
+./snmpv3.lo: ../include/net-snmp/library/snmpusm.h
+./snmpv3.lo: ../include/net-snmp/library/transform_oids.h
+./snmp_version.lo: ../include/net-snmp/version.h
+./snprintf.lo: ../include/net-snmp/net-snmp-config.h
+./snprintf.lo: ../include/net-snmp/system/linux.h
+./snprintf.lo: ../include/net-snmp/system/sysv.h
+./snprintf.lo: ../include/net-snmp/system/generic.h
+./snprintf.lo: ../include/net-snmp/machine/generic.h
+./strlcpy.lo: ../include/net-snmp/net-snmp-config.h
+./strlcpy.lo: ../include/net-snmp/system/linux.h
+./strlcpy.lo: ../include/net-snmp/system/sysv.h
+./strlcpy.lo: ../include/net-snmp/system/generic.h
+./strlcpy.lo: ../include/net-snmp/machine/generic.h 
+./strtol.lo: ../include/net-snmp/net-snmp-config.h
+./strtol.lo: ../include/net-snmp/system/linux.h
+./strtol.lo: ../include/net-snmp/system/sysv.h
+./strtol.lo: ../include/net-snmp/system/generic.h
+./strtol.lo: ../include/net-snmp/machine/generic.h
+./strtoul.lo: ../include/net-snmp/net-snmp-config.h
+./strtoul.lo: ../include/net-snmp/system/linux.h
+./strtoul.lo: ../include/net-snmp/system/sysv.h
+./strtoul.lo: ../include/net-snmp/system/generic.h
+./strtoul.lo: ../include/net-snmp/machine/generic.h
+./system.lo: ../include/net-snmp/net-snmp-config.h
+./system.lo: ../include/net-snmp/system/linux.h
+./system.lo: ../include/net-snmp/system/sysv.h
+./system.lo: ../include/net-snmp/system/generic.h
+./system.lo: ../include/net-snmp/machine/generic.h 
+./system.lo: ../include/net-snmp/types.h ../include/net-snmp/definitions.h
+./system.lo: ../include/net-snmp/library/snmp_api.h
+./system.lo: ../include/net-snmp/library/asn1.h
+./system.lo: ../include/net-snmp/library/snmp_impl.h
+./system.lo: ../include/net-snmp/library/snmp.h
+./system.lo: ../include/net-snmp/library/snmp-tc.h
+./system.lo: ../include/net-snmp/output_api.h
+./system.lo: ../include/net-snmp/library/snmp_client.h
+./system.lo: ../include/net-snmp/library/snmp_debug.h
+./system.lo: ../include/net-snmp/library/snmp_logging.h 
+./system.lo:  ../include/net-snmp/utilities.h
+./system.lo: ../include/net-snmp/library/getopt.h
+./system.lo: ../include/net-snmp/library/system.h
+./system.lo: ../include/net-snmp/library/tools.h
+./system.lo: ../include/net-snmp/library/int64.h
+./system.lo: ../include/net-snmp/library/mt_support.h
+./system.lo: ../include/net-snmp/library/snmp_alarm.h
+./system.lo: ../include/net-snmp/library/data_list.h
+./system.lo: ../include/net-snmp/library/callback.h
+./system.lo: ../include/net-snmp/library/oid_stash.h
+./system.lo: ../include/net-snmp/library/check_varbind.h
+./system.lo: ../include/net-snmp/version.h
+./test_binary_array.lo: ../include/net-snmp/net-snmp-config.h
+./test_binary_array.lo: ../include/net-snmp/system/linux.h
+./test_binary_array.lo: ../include/net-snmp/system/sysv.h
+./test_binary_array.lo: ../include/net-snmp/system/generic.h
+./test_binary_array.lo: ../include/net-snmp/machine/generic.h
+./test_binary_array.lo: ../include/net-snmp/net-snmp-includes.h
+./test_binary_array.lo: ../include/net-snmp/definitions.h
+./test_binary_array.lo: ../include/net-snmp/types.h
+./test_binary_array.lo: ../include/net-snmp/library/snmp_api.h
+./test_binary_array.lo: ../include/net-snmp/library/asn1.h
+./test_binary_array.lo: ../include/net-snmp/library/snmp_impl.h
+./test_binary_array.lo: ../include/net-snmp/library/snmp.h
+./test_binary_array.lo: ../include/net-snmp/library/snmp-tc.h
+./test_binary_array.lo: ../include/net-snmp/utilities.h
+./test_binary_array.lo: ../include/net-snmp/library/snmp_client.h
+./test_binary_array.lo: ../include/net-snmp/library/getopt.h
+./test_binary_array.lo: ../include/net-snmp/library/system.h
+./test_binary_array.lo: ../include/net-snmp/library/tools.h
+./test_binary_array.lo: ../include/net-snmp/library/int64.h
+./test_binary_array.lo: ../include/net-snmp/library/mt_support.h
+./test_binary_array.lo: ../include/net-snmp/library/snmp_alarm.h
+./test_binary_array.lo: ../include/net-snmp/library/data_list.h
+./test_binary_array.lo: ../include/net-snmp/library/callback.h
+./test_binary_array.lo: ../include/net-snmp/library/oid_stash.h
+./test_binary_array.lo: ../include/net-snmp/library/check_varbind.h
+./test_binary_array.lo: ../include/net-snmp/version.h
+./test_binary_array.lo: ../include/net-snmp/session_api.h
+./test_binary_array.lo: ../include/net-snmp/library/snmp_transport.h
+./test_binary_array.lo: ../include/net-snmp/library/snmpCallbackDomain.h
+./test_binary_array.lo: ../include/net-snmp/library/snmpUnixDomain.h
+./test_binary_array.lo: ../include/net-snmp/library/snmpUDPDomain.h
+./test_binary_array.lo: ../include/net-snmp/library/snmpTCPDomain.h
+./test_binary_array.lo: ../include/net-snmp/library/snmpUDPIPv6Domain.h
+./test_binary_array.lo: ../include/net-snmp/library/snmpTCPIPv6Domain.h
+./test_binary_array.lo: ../include/net-snmp/library/snmpIPXDomain.h
+./test_binary_array.lo: ../include/net-snmp/library/ucd_compat.h
+./test_binary_array.lo: ../include/net-snmp/pdu_api.h
+./test_binary_array.lo: ../include/net-snmp/mib_api.h
+./test_binary_array.lo: ../include/net-snmp/library/mib.h
+./test_binary_array.lo: ../include/net-snmp/library/parse.h
+./test_binary_array.lo: ../include/net-snmp/varbind_api.h
+./test_binary_array.lo: ../include/net-snmp/config_api.h
+./test_binary_array.lo: ../include/net-snmp/library/read_config.h
+./test_binary_array.lo: ../include/net-snmp/library/default_store.h
+./test_binary_array.lo: ../include/net-snmp/library/snmp_parse_args.h
+./test_binary_array.lo: ../include/net-snmp/library/snmp_enum.h
+./test_binary_array.lo: ../include/net-snmp/library/vacm.h
+./test_binary_array.lo: ../include/net-snmp/output_api.h
+./test_binary_array.lo: ../include/net-snmp/library/snmp_debug.h
+./test_binary_array.lo: ../include/net-snmp/library/snmp_logging.h
+./test_binary_array.lo: ../include/net-snmp/snmpv3_api.h
+./test_binary_array.lo: ../include/net-snmp/library/snmpv3.h
+./test_binary_array.lo: ../include/net-snmp/library/transform_oids.h
+./test_binary_array.lo: ../include/net-snmp/library/keytools.h
+./test_binary_array.lo: ../include/net-snmp/library/scapi.h
+./test_binary_array.lo: ../include/net-snmp/library/lcd_time.h
+./test_binary_array.lo: ../include/net-snmp/library/snmp_secmod.h
+./test_binary_array.lo: ../include/net-snmp/library/snmpv3-security-includes.h
+./test_binary_array.lo: ../include/net-snmp/library/snmpusm.h
+./test_binary_array.lo: ../include/net-snmp/library/container.h
+./test_binary_array.lo: ../include/net-snmp/library/factory.h
+./test_binary_array.lo: ../include/net-snmp/library/container_binary_array.h
+./test_binary_array.lo: ../include/net-snmp/library/snmp_assert.h
+./tools.lo: ../include/net-snmp/net-snmp-config.h
+./tools.lo: ../include/net-snmp/system/linux.h
+./tools.lo: ../include/net-snmp/system/sysv.h
+./tools.lo: ../include/net-snmp/system/generic.h
+./tools.lo: ../include/net-snmp/machine/generic.h 
+./tools.lo: ../include/net-snmp/types.h ../include/net-snmp/definitions.h
+./tools.lo: ../include/net-snmp/library/snmp_api.h
+./tools.lo: ../include/net-snmp/library/asn1.h
+./tools.lo: ../include/net-snmp/library/snmp_impl.h
+./tools.lo: ../include/net-snmp/library/snmp.h
+./tools.lo: ../include/net-snmp/library/snmp-tc.h
+./tools.lo: ../include/net-snmp/output_api.h
+./tools.lo: ../include/net-snmp/library/snmp_client.h
+./tools.lo: ../include/net-snmp/library/snmp_debug.h
+./tools.lo: ../include/net-snmp/library/snmp_logging.h 
+./tools.lo:  ../include/net-snmp/utilities.h
+./tools.lo: ../include/net-snmp/library/getopt.h
+./tools.lo: ../include/net-snmp/library/system.h
+./tools.lo: ../include/net-snmp/library/tools.h
+./tools.lo: ../include/net-snmp/library/int64.h
+./tools.lo: ../include/net-snmp/library/mt_support.h
+./tools.lo: ../include/net-snmp/library/snmp_alarm.h
+./tools.lo: ../include/net-snmp/library/data_list.h
+./tools.lo: ../include/net-snmp/library/callback.h
+./tools.lo: ../include/net-snmp/library/oid_stash.h
+./tools.lo: ../include/net-snmp/library/check_varbind.h
+./tools.lo: ../include/net-snmp/version.h ../include/net-snmp/library/mib.h
+./tools.lo: ../include/net-snmp/library/scapi.h
+./ucd_compat.lo: ../include/net-snmp/net-snmp-config.h
+./ucd_compat.lo: ../include/net-snmp/system/linux.h
+./ucd_compat.lo: ../include/net-snmp/system/sysv.h
+./ucd_compat.lo: ../include/net-snmp/system/generic.h
+./ucd_compat.lo: ../include/net-snmp/machine/generic.h
+./ucd_compat.lo: ../include/net-snmp/types.h 
+./ucd_compat.lo: ../include/net-snmp/definitions.h
+./ucd_compat.lo: ../include/net-snmp/library/snmp_api.h
+./ucd_compat.lo: ../include/net-snmp/library/asn1.h
+./ucd_compat.lo: ../include/net-snmp/library/snmp_impl.h
+./ucd_compat.lo: ../include/net-snmp/library/snmp.h
+./ucd_compat.lo: ../include/net-snmp/library/snmp-tc.h
+./ucd_compat.lo: ../include/net-snmp/session_api.h
+./ucd_compat.lo: ../include/net-snmp/library/snmp_client.h
+./ucd_compat.lo: ../include/net-snmp/library/callback.h
+./ucd_compat.lo: ../include/net-snmp/library/snmp_transport.h
+./ucd_compat.lo: ../include/net-snmp/library/snmpCallbackDomain.h
+./ucd_compat.lo: ../include/net-snmp/library/snmpUnixDomain.h
+./ucd_compat.lo: ../include/net-snmp/library/snmpUDPDomain.h
+./ucd_compat.lo: ../include/net-snmp/library/snmpTCPDomain.h
+./ucd_compat.lo: ../include/net-snmp/library/snmpUDPIPv6Domain.h
+./ucd_compat.lo: ../include/net-snmp/library/snmpTCPIPv6Domain.h
+./ucd_compat.lo: ../include/net-snmp/library/snmpIPXDomain.h
+./ucd_compat.lo: ../include/net-snmp/library/ucd_compat.h
+./ucd_compat.lo: ../include/net-snmp/config_api.h
+./ucd_compat.lo: ../include/net-snmp/library/read_config.h
+./ucd_compat.lo: ../include/net-snmp/library/default_store.h
+./ucd_compat.lo: ../include/net-snmp/library/snmp_parse_args.h
+./ucd_compat.lo: ../include/net-snmp/library/snmp_enum.h
+./ucd_compat.lo: ../include/net-snmp/library/vacm.h
+./ucd_compat.lo: ../include/net-snmp/library/mib.h
+./vacm.lo: ../include/net-snmp/net-snmp-config.h
+./vacm.lo: ../include/net-snmp/system/linux.h
+./vacm.lo: ../include/net-snmp/system/sysv.h
+./vacm.lo: ../include/net-snmp/system/generic.h
+./vacm.lo: ../include/net-snmp/machine/generic.h 
+./vacm.lo: ../include/net-snmp/types.h ../include/net-snmp/definitions.h
+./vacm.lo: ../include/net-snmp/library/snmp_api.h
+./vacm.lo: ../include/net-snmp/library/asn1.h
+./vacm.lo: ../include/net-snmp/library/snmp_impl.h
+./vacm.lo: ../include/net-snmp/library/snmp.h
+./vacm.lo: ../include/net-snmp/library/snmp-tc.h
+./vacm.lo: ../include/net-snmp/output_api.h
+./vacm.lo: ../include/net-snmp/library/snmp_client.h
+./vacm.lo: ../include/net-snmp/library/snmp_debug.h
+./vacm.lo: ../include/net-snmp/library/snmp_logging.h 
+./vacm.lo:  ../include/net-snmp/config_api.h
+./vacm.lo: ../include/net-snmp/library/read_config.h
+./vacm.lo: ../include/net-snmp/library/default_store.h
+./vacm.lo: ../include/net-snmp/library/snmp_parse_args.h
+./vacm.lo: ../include/net-snmp/library/snmp_enum.h
+./vacm.lo: ../include/net-snmp/library/vacm.h
+./winservice.lo: ../include/net-snmp/library/winservice.h
diff -Naur tomato/release/src/router/snmp/snmplib/Makefile.in tomato121/release/src/router/snmp/snmplib/Makefile.in
--- tomato/release/src/router/snmp/snmplib/Makefile.in	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/snmplib/Makefile.in	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,164 @@
+# Portions of this file are subject to the following copyright.  See
+# the Net-SNMP's COPYING file for more details and other copyrights
+# that may apply:
+#
+# Copyright © 2003 Sun Microsystems, Inc. All rights reserved.
+# Use is subject to license terms specified in the COPYING file
+# distributed with the Net-SNMP package.
+#
+
+#
+# Makefile for snmplib
+#
+
+top_builddir=..
+
+#
+# Things to install
+#
+
+# headers
+INSTALLHEADERS=\
+	net-snmp-includes.h \
+	config_api.h  \
+	mib_api.h     \
+	output_api.h  \
+	pdu_api.h     \
+	session_api.h \
+	snmpv3_api.h  \
+	varbind_api.h \
+	types.h       \
+	utilities.h   \
+	version.h     \
+	definitions.h
+
+INCLUDESUBDIR=library
+INCLUDESUBDIRHEADERS=README \
+	asn1.h \
+	callback.h \
+	container.h \
+	container_binary_array.h \
+	factory.h \
+	data_list.h \
+	default_store.h \
+	int64.h \
+	keytools.h \
+	mib.h \
+	md5.h \
+	parse.h \
+	read_config.h \
+	scapi.h \
+	snmp.h \
+	snmp_alarm.h \
+	snmp_api.h \
+	snmp_assert.h \
+	snmp_client.h \
+	snmp_debug.h \
+	snmp_impl.h \
+	snmp_logging.h \
+	snmp_parse_args.h \
+	snmp-tc.h \
+	snmpv3.h \
+	system.h \
+	tools.h \
+	transform_oids.h \
+	winservice.h \
+        cmu_compat.h \
+        getopt.h \
+        lcd_time.h \
+        mt_support.h \
+        oid_stash.h \
+        snmp_enum.h \
+        snmp_locking.h \
+        snmp_secmod.h \
+        ucd_compat.h \
+        vacm.h \
+	check_varbind.h \
+	snmp_transport.h \
+	@transport_hdr_list@ \
+	@security_hdr_list@
+
+INSTALLBUILTSUBDIRHEADERS=../include/net-snmp/library/snmpv3-security-includes.h
+INSTALLBUILTSUBDIR=library
+
+
+INSTALLUCDHEADERS= asn1.h \
+	callback.h	\
+	default_store.h	\
+	int64.h		\
+	keytools.h	\
+	mib.h		\
+	parse.h		\
+	read_config.h	\
+	scapi.h		\
+	snmp_alarm.h	\
+	snmp_api.h	\
+	snmp_client.h	\
+	snmp_debug.h	\
+	snmp.h		\
+	snmp_impl.h	\
+	snmp_logging.h	\
+	snmp_parse_args.h \
+	snmp-tc.h	\
+	snmpusm.h	\
+	snmpv3.h	\
+	snmp_vars.h	\
+	struct.h	\
+	system.h	\
+	tools.h		\
+	transform_oids.h
+
+# libraries
+INSTALLLIBS=libnetsnmp.$(LIB_EXTENSION)$(LIB_VERSION)
+INSTALLUCDLIBS=libsnmp.$(LIB_EXTENSION)$(LIB_VERSION)
+
+#
+# Things to build
+#
+CSRCS=	snmp_client.c mib.c parse.c snmp_api.c snmp.c 		\
+	snmp_auth.c asn1.c md5.c snmp_parse_args.c		\
+	system.c vacm.c int64.c read_config.c 			\
+	snmp_debug.c tools.c  snmp_logging.c			\
+	snmpv3.c lcd_time.c keytools.c		                \
+	scapi.c callback.c default_store.c snmp_alarm.c		\
+	data_list.c oid_stash.c 				\
+	mt_support.c snmp_enum.c snmp-tc.c 			\
+	snprintf.c strlcpy.c strtol.c strtoul.c			\
+	snmp_transport.c                                        \
+	@transport_src_list@ \
+	snmp_secmod.c snmp_version.c                            \
+	@security_src_list@ \
+	check_varbind.c container.c container_binary_array.c	\
+	cmu_compat.c ucd_compat.c
+
+OBJS=	$(CSRCS:.c=.o)
+
+LOBJS=	$(CSRCS:.c=.lo)
+
+# just in case someone wants to remove libtool, change this to OBJS.
+TOBJS=$(LOBJS)
+
+CPPFLAGS = -I$(top_srcdir)/include -I../include \
+	-I. -I.. -I$(srcdir) -I$(srcdir)/.. @CPPFLAGS@
+
+all: standardall
+
+# how to build the libraries.
+libnetsnmp.$(LIB_EXTENSION)$(LIB_VERSION):    ${TOBJS}
+	$(LIB_LD_CMD) libnetsnmp.$(LIB_EXTENSION)$(LIB_VERSION) ${TOBJS}
+	$(RANLIB) libnetsnmp.$(LIB_EXTENSION)$(LIB_VERSION)
+
+libsnmp.$(LIB_EXTENSION)$(LIB_VERSION):    ${TOBJS}
+	$(LIB_LD_CMD) libsnmp.$(LIB_EXTENSION)$(LIB_VERSION) ${TOBJS}
+	$(RANLIB) libsnmp.$(LIB_EXTENSION)$(LIB_VERSION)
+
+#
+# internal test objects
+#
+parse:  mib.o parse.c
+	$(CC) $(CFLAGS) -DTEST parse.c -o parse \
+		`$(top_srcdir)/net-snmp-config --libs`
+
+test_binary_array: test_binary_array.c
+	$(CC) $(CFLAGS) test_binary_array.c  -o $@ \
+		`$(top_srcdir)/net-snmp-config --libs`
diff -Naur tomato/release/src/router/snmp/snmplib/md5.c tomato121/release/src/router/snmp/snmplib/md5.c
--- tomato/release/src/router/snmp/snmplib/md5.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/snmplib/md5.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,533 @@
+/*
+ * ** **************************************************************************
+ * ** md5.c -- Implementation of MD5 Message Digest Algorithm                 **
+ * ** Updated: 2/16/90 by Ronald L. Rivest                                    **
+ * ** (C) 1990 RSA Data Security, Inc.                                        **
+ * ** **************************************************************************
+ */
+
+/*
+ * ** To use MD5:
+ * **   -- Include md5.h in your program
+ * **   -- Declare an MDstruct MD to hold the state of the digest computation.
+ * **   -- Initialize MD using MDbegin(&MD)
+ * **   -- For each full block (64 bytes) X you wish to process, call
+ * **          MDupdate(&MD,X,512)
+ * **      (512 is the number of bits in a full block.)
+ * **   -- For the last block (less than 64 bytes) you wish to process,
+ * **          MDupdate(&MD,X,n)
+ * **      where n is the number of bits in the partial block. A partial
+ * **      block terminates the computation, so every MD computation should
+ * **      terminate by processing a partial block, even if it has n = 0.
+ * **   -- The message digest is available in MD.buffer[0] ... MD.buffer[3].
+ * **      (Least-significant byte of each word should be output first.)
+ * **   -- You can print out the digest using MDprint(&MD)
+ */
+
+/*
+ * Implementation notes:
+ * ** This implementation assumes that ints are 32-bit quantities.
+ * ** If the machine stores the least-significant byte of an int in the
+ * ** least-addressed byte (eg., VAX and 8086), then LOWBYTEFIRST should be
+ * ** set to TRUE.  Otherwise (eg., SUNS), LOWBYTEFIRST should be set to
+ * ** FALSE.  Note that on machines with LOWBYTEFIRST FALSE the routine
+ * ** MDupdate modifies has a side-effect on its input array (the order of bytes
+ * ** in each word are reversed).  If this is undesired a call to MDreverse(X) can
+ * ** reverse the bytes of X back into order after each call to MDupdate.
+ */
+
+/*
+ * code uses WORDS_BIGENDIAN defined by configure now  -- WH 9/27/95 
+ */
+
+/*
+ * Compile-time includes 
+ */
+
+#include <net-snmp/net-snmp-config.h>
+
+#include <stdio.h>
+#include <sys/types.h>
+#if HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+#if HAVE_WINSOCK_H
+#include <winsock.h>
+#endif
+
+#if HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+
+#include <net-snmp/utilities.h>
+#include <net-snmp/library/md5.h>
+
+/*
+ * Compile-time declarations of MD5 ``magic constants''.
+ */
+#define I0  0x67452301          /* Initial values for MD buffer */
+#define I1  0xefcdab89
+#define I2  0x98badcfe
+#define I3  0x10325476
+#define fs1  7                  /* round 1 shift amounts */
+#define fs2 12
+#define fs3 17
+#define fs4 22
+#define gs1  5                  /* round 2 shift amounts */
+#define gs2  9
+#define gs3 14
+#define gs4 20
+#define hs1  4                  /* round 3 shift amounts */
+#define hs2 11
+#define hs3 16
+#define hs4 23
+#define is1  6                  /* round 4 shift amounts */
+#define is2 10
+#define is3 15
+#define is4 21
+
+
+/*
+ * Compile-time macro declarations for MD5.
+ * ** Note: The ``rot'' operator uses the variable ``tmp''.
+ * ** It assumes tmp is declared as unsigned int, so that the >>
+ * ** operator will shift in zeros rather than extending the sign bit.
+ */
+#define	f(X,Y,Z)             ((X&Y) | ((~X)&Z))
+#define	g(X,Y,Z)             ((X&Z) | (Y&(~Z)))
+#define h(X,Y,Z)             (X^Y^Z)
+#define i_(X,Y,Z)            (Y ^ ((X) | (~Z)))
+#define rot(X,S)             (tmp=X,(tmp<<S) | (tmp>>(32-S)))
+#define ff(A,B,C,D,i,s,lp)   A = rot((A + f(B,C,D) + X[i] + lp),s) + B
+#define gg(A,B,C,D,i,s,lp)   A = rot((A + g(B,C,D) + X[i] + lp),s) + B
+#define hh(A,B,C,D,i,s,lp)   A = rot((A + h(B,C,D) + X[i] + lp),s) + B
+#define ii(A,B,C,D,i,s,lp)   A = rot((A + i_(B,C,D) + X[i] + lp),s) + B
+
+#ifdef STDC_HEADERS
+#define Uns(num) num##U
+#else
+#define Uns(num) num
+#endif                          /* STDC_HEADERS */
+
+void            MDreverse(unsigned int *);
+static void     MDblock(MDptr, unsigned int *);
+
+#ifdef SNMP_TESTING_CODE
+/*
+ * MDprint(MDp)
+ * ** Print message digest buffer MDp as 32 hexadecimal digits.
+ * ** Order is from low-order byte of buffer[0] to high-order byte of buffer[3].
+ * ** Each byte is printed with high-order hexadecimal digit first.
+ * ** This is a user-callable routine.
+ */
+void
+MDprint(MDptr MDp)
+{
+    int             i, j;
+    for (i = 0; i < 4; i++)
+        for (j = 0; j < 32; j = j + 8)
+            printf("%02x", (MDp->buffer[i] >> j) & 0xFF);
+    printf("\n");
+    fflush(stdout);
+}
+#endif                          /* SNMP_TESTING_CODE */
+
+/*
+ * MDbegin(MDp)
+ * ** Initialize message digest buffer MDp. 
+ * ** This is a user-callable routine.
+ */
+void
+MDbegin(MDptr MDp)
+{
+    int             i;
+    MDp->buffer[0] = I0;
+    MDp->buffer[1] = I1;
+    MDp->buffer[2] = I2;
+    MDp->buffer[3] = I3;
+    for (i = 0; i < 8; i++)
+        MDp->count[i] = 0;
+    MDp->done = 0;
+}
+
+/*
+ * MDreverse(X)
+ * ** Reverse the byte-ordering of every int in X.
+ * ** Assumes X is an array of 16 ints.
+ * ** The macro revx reverses the byte-ordering of the next word of X.
+ */
+#define revx { t = (*X << 16) | (*X >> 16); \
+	       *X++ = ((t & 0xFF00FF00) >> 8) | ((t & 0x00FF00FF) << 8); }
+
+void
+MDreverse(unsigned int *X)
+{
+    register unsigned int t;
+    revx;
+    revx;
+    revx;
+    revx;
+    revx;
+    revx;
+    revx;
+    revx;
+    revx;
+    revx;
+    revx;
+    revx;
+    revx;
+    revx;
+    revx;
+    revx;
+}
+
+/*
+ * MDblock(MDp,X)
+ * ** Update message digest buffer MDp->buffer using 16-word data block X.
+ * ** Assumes all 16 words of X are full of data.
+ * ** Does not update MDp->count.
+ * ** This routine is not user-callable. 
+ */
+static void
+MDblock(MDptr MDp, unsigned int *X)
+{
+    register unsigned int tmp, A, B, C, D;      /* hpux sysv sun */
+#ifdef WORDS_BIGENDIAN
+    MDreverse(X);
+#endif
+    A = MDp->buffer[0];
+    B = MDp->buffer[1];
+    C = MDp->buffer[2];
+    D = MDp->buffer[3];
+
+    /*
+     * Update the message digest buffer 
+     */
+    ff(A, B, C, D, 0, fs1, Uns(3614090360));    /* Round 1 */
+    ff(D, A, B, C, 1, fs2, Uns(3905402710));
+    ff(C, D, A, B, 2, fs3, Uns(606105819));
+    ff(B, C, D, A, 3, fs4, Uns(3250441966));
+    ff(A, B, C, D, 4, fs1, Uns(4118548399));
+    ff(D, A, B, C, 5, fs2, Uns(1200080426));
+    ff(C, D, A, B, 6, fs3, Uns(2821735955));
+    ff(B, C, D, A, 7, fs4, Uns(4249261313));
+    ff(A, B, C, D, 8, fs1, Uns(1770035416));
+    ff(D, A, B, C, 9, fs2, Uns(2336552879));
+    ff(C, D, A, B, 10, fs3, Uns(4294925233));
+    ff(B, C, D, A, 11, fs4, Uns(2304563134));
+    ff(A, B, C, D, 12, fs1, Uns(1804603682));
+    ff(D, A, B, C, 13, fs2, Uns(4254626195));
+    ff(C, D, A, B, 14, fs3, Uns(2792965006));
+    ff(B, C, D, A, 15, fs4, Uns(1236535329));
+    gg(A, B, C, D, 1, gs1, Uns(4129170786));    /* Round 2 */
+    gg(D, A, B, C, 6, gs2, Uns(3225465664));
+    gg(C, D, A, B, 11, gs3, Uns(643717713));
+    gg(B, C, D, A, 0, gs4, Uns(3921069994));
+    gg(A, B, C, D, 5, gs1, Uns(3593408605));
+    gg(D, A, B, C, 10, gs2, Uns(38016083));
+    gg(C, D, A, B, 15, gs3, Uns(3634488961));
+    gg(B, C, D, A, 4, gs4, Uns(3889429448));
+    gg(A, B, C, D, 9, gs1, Uns(568446438));
+    gg(D, A, B, C, 14, gs2, Uns(3275163606));
+    gg(C, D, A, B, 3, gs3, Uns(4107603335));
+    gg(B, C, D, A, 8, gs4, Uns(1163531501));
+    gg(A, B, C, D, 13, gs1, Uns(2850285829));
+    gg(D, A, B, C, 2, gs2, Uns(4243563512));
+    gg(C, D, A, B, 7, gs3, Uns(1735328473));
+    gg(B, C, D, A, 12, gs4, Uns(2368359562));
+    hh(A, B, C, D, 5, hs1, Uns(4294588738));    /* Round 3 */
+    hh(D, A, B, C, 8, hs2, Uns(2272392833));
+    hh(C, D, A, B, 11, hs3, Uns(1839030562));
+    hh(B, C, D, A, 14, hs4, Uns(4259657740));
+    hh(A, B, C, D, 1, hs1, Uns(2763975236));
+    hh(D, A, B, C, 4, hs2, Uns(1272893353));
+    hh(C, D, A, B, 7, hs3, Uns(4139469664));
+    hh(B, C, D, A, 10, hs4, Uns(3200236656));
+    hh(A, B, C, D, 13, hs1, Uns(681279174));
+    hh(D, A, B, C, 0, hs2, Uns(3936430074));
+    hh(C, D, A, B, 3, hs3, Uns(3572445317));
+    hh(B, C, D, A, 6, hs4, Uns(76029189));
+    hh(A, B, C, D, 9, hs1, Uns(3654602809));
+    hh(D, A, B, C, 12, hs2, Uns(3873151461));
+    hh(C, D, A, B, 15, hs3, Uns(530742520));
+    hh(B, C, D, A, 2, hs4, Uns(3299628645));
+    ii(A, B, C, D, 0, is1, Uns(4096336452));    /* Round 4 */
+    ii(D, A, B, C, 7, is2, Uns(1126891415));
+    ii(C, D, A, B, 14, is3, Uns(2878612391));
+    ii(B, C, D, A, 5, is4, Uns(4237533241));
+    ii(A, B, C, D, 12, is1, Uns(1700485571));
+    ii(D, A, B, C, 3, is2, Uns(2399980690));
+    ii(C, D, A, B, 10, is3, Uns(4293915773));
+    ii(B, C, D, A, 1, is4, Uns(2240044497));
+    ii(A, B, C, D, 8, is1, Uns(1873313359));
+    ii(D, A, B, C, 15, is2, Uns(4264355552));
+    ii(C, D, A, B, 6, is3, Uns(2734768916));
+    ii(B, C, D, A, 13, is4, Uns(1309151649));
+    ii(A, B, C, D, 4, is1, Uns(4149444226));
+    ii(D, A, B, C, 11, is2, Uns(3174756917));
+    ii(C, D, A, B, 2, is3, Uns(718787259));
+    ii(B, C, D, A, 9, is4, Uns(3951481745));
+
+    MDp->buffer[0] += A;
+    MDp->buffer[1] += B;
+    MDp->buffer[2] += C;
+    MDp->buffer[3] += D;
+#ifdef WORDS_BIGENDIAN
+    MDreverse(X);
+#endif
+}
+
+/*
+ * MDupdate(MDp,X,count)
+ * ** Input: MDp -- an MDptr
+ * **        X -- a pointer to an array of unsigned characters.
+ * **        count -- the number of bits of X to use.
+ * **                 (if not a multiple of 8, uses high bits of last byte.)
+ * ** Update MDp using the number of bits of X given by count.
+ * ** This is the basic input routine for an MD5 user.
+ * ** The routine completes the MD computation when count < 512, so
+ * ** every MD computation should end with one call to MDupdate with a
+ * ** count less than 512.  A call with count 0 will be ignored if the
+ * ** MD has already been terminated (done != 0), so an extra call with count
+ * ** 0 can be given as a ``courtesy close'' to force termination if desired.
+ * ** Returns : 0 if processing succeeds or was already done;
+ * **          -1 if processing was already done
+ * **          -2 if count was too large
+ */
+int
+MDupdate(MDptr MDp, unsigned char *X, unsigned int count)
+{
+    unsigned int    i, tmp, bit, byte, mask;
+    unsigned char   XX[64];
+    unsigned char  *p;
+    /*
+     * return with no error if this is a courtesy close with count
+     * ** zero and MDp->done is true.
+     */
+    if (count == 0 && MDp->done)
+        return 0;
+    /*
+     * check to see if MD is already done and report error 
+     */
+    if (MDp->done) {
+        return -1;
+    }
+    /*
+     * if (MDp->done) { fprintf(stderr,"\nError: MDupdate MD already done."); return; }
+     */
+    /*
+     * Add count to MDp->count 
+     */
+    tmp = count;
+    p = MDp->count;
+    while (tmp) {
+        tmp += *p;
+        *p++ = tmp;
+        tmp = tmp >> 8;
+    }
+    /*
+     * Process data 
+     */
+    if (count == 512) {         /* Full block of data to handle */
+        MDblock(MDp, (unsigned int *) X);
+    } else if (count > 512)     /* Check for count too large */
+        return -2;
+    /*
+     * { fprintf(stderr,"\nError: MDupdate called with illegal count value %d.",count);
+     * return;
+     * }
+     */
+    else {                      /* partial block -- must be last block so finish up */
+        /*
+         * Find out how many bytes and residual bits there are 
+         */
+        int             copycount;
+        byte = count >> 3;
+        bit = count & 7;
+        copycount = byte;
+        if (bit)
+            copycount++;
+        /*
+         * Copy X into XX since we need to modify it 
+         */
+        memset(XX, 0, sizeof(XX));
+        memcpy(XX, X, copycount);
+
+        /*
+         * Add padding '1' bit and low-order zeros in last byte 
+         */
+        mask = ((unsigned long) 1) << (7 - bit);
+        XX[byte] = (XX[byte] | mask) & ~(mask - 1);
+        /*
+         * If room for bit count, finish up with this block 
+         */
+        if (byte <= 55) {
+            for (i = 0; i < 8; i++)
+                XX[56 + i] = MDp->count[i];
+            MDblock(MDp, (unsigned int *) XX);
+        } else {                /* need to do two blocks to finish up */
+            MDblock(MDp, (unsigned int *) XX);
+            for (i = 0; i < 56; i++)
+                XX[i] = 0;
+            for (i = 0; i < 8; i++)
+                XX[56 + i] = MDp->count[i];
+            MDblock(MDp, (unsigned int *) XX);
+        }
+        /*
+         * Set flag saying we're done with MD computation 
+         */
+        MDp->done = 1;
+    }
+    return 0;
+}
+
+/*
+ * MDchecksum(data, len, MD5): do a checksum on an arbirtrary amount of data 
+ */
+int
+MDchecksum(u_char * data, size_t len, u_char * mac, size_t maclen)
+{
+    MDstruct        md;
+    MDstruct       *MD = &md;
+    int             rc = 0;
+
+    MDbegin(MD);
+    while (len >= 64) {
+        rc = MDupdate(MD, data, 64 * 8);
+        if (rc)
+            goto check_end;
+        data += 64;
+        len -= 64;
+    }
+    rc = MDupdate(MD, data, len * 8);
+    if (rc)
+        goto check_end;
+
+    /*
+     * copy the checksum to the outgoing data (all of it that is requested). 
+     */
+    MDget(MD, mac, maclen);
+
+  check_end:
+    memset(&md, 0, sizeof(md));
+    return rc;
+}
+
+
+/*
+ * MDsign(data, len, MD5): do a checksum on an arbirtrary amount
+ * of data, and prepended with a secret in the standard fashion 
+ */
+int
+MDsign(u_char * data, size_t len, u_char * mac, size_t maclen,
+       u_char * secret, size_t secretlen)
+{
+#define HASHKEYLEN 64
+
+    MDstruct        MD;
+    u_char          K1[HASHKEYLEN];
+    u_char          K2[HASHKEYLEN];
+    u_char          extendedAuthKey[HASHKEYLEN];
+    u_char          buf[HASHKEYLEN];
+    size_t          i;
+    u_char         *cp, *newdata = 0;
+    int             rc = 0;
+
+    /*
+     * memset(K1,0,HASHKEYLEN);
+     * memset(K2,0,HASHKEYLEN);
+     * memset(buf,0,HASHKEYLEN);
+     * memset(extendedAuthKey,0,HASHKEYLEN);
+     */
+
+    if (secretlen != 16 || secret == NULL || mac == NULL || data == NULL ||
+        len <= 0 || maclen <= 0) {
+        /*
+         * DEBUGMSGTL(("md5","MD5 signing not properly initialized")); 
+         */
+        return -1;
+    }
+
+    memset(extendedAuthKey, 0, HASHKEYLEN);
+    memcpy(extendedAuthKey, secret, secretlen);
+    for (i = 0; i < HASHKEYLEN; i++) {
+        K1[i] = extendedAuthKey[i] ^ 0x36;
+        K2[i] = extendedAuthKey[i] ^ 0x5c;
+    }
+
+    MDbegin(&MD);
+    rc = MDupdate(&MD, K1, HASHKEYLEN * 8);
+    if (rc)
+        goto update_end;
+
+    i = len;
+    if (((unsigned int) data) % 32 != 0) {
+        /*
+         * this relies on the ability to use integer math and thus we
+         * must rely on data that aligns on 32-bit-word-boundries 
+         */
+        memdup(&newdata, data, len);
+        cp = newdata;
+    } else {
+        cp = data;
+    }
+
+    while (i >= 64) {
+        rc = MDupdate(&MD, cp, 64 * 8);
+        if (rc)
+            goto update_end;
+        cp += 64;
+        i -= 64;
+    }
+
+    rc = MDupdate(&MD, cp, i * 8);
+    if (rc)
+        goto update_end;
+
+    memset(buf, 0, HASHKEYLEN);
+    MDget(&MD, buf, HASHKEYLEN);
+
+    MDbegin(&MD);
+    rc = MDupdate(&MD, K2, HASHKEYLEN * 8);
+    if (rc)
+        goto update_end;
+    rc = MDupdate(&MD, buf, 16 * 8);
+    if (rc)
+        goto update_end;
+
+    /*
+     * copy the sign checksum to the outgoing pointer 
+     */
+    MDget(&MD, mac, maclen);
+
+  update_end:
+    memset(buf, 0, HASHKEYLEN);
+    memset(K1, 0, HASHKEYLEN);
+    memset(K2, 0, HASHKEYLEN);
+    memset(extendedAuthKey, 0, HASHKEYLEN);
+    memset(&MD, 0, sizeof(MD));
+
+    if (newdata)
+        free(newdata);
+    return rc;
+}
+
+void
+MDget(MDstruct * MD, u_char * buf, size_t buflen)
+{
+    int             i, j;
+
+    /*
+     * copy the checksum to the outgoing data (all of it that is requested). 
+     */
+    for (i = 0; i < 4 && i * 4 < (int) buflen; i++)
+        for (j = 0; j < 4 && i * 4 + j < (int) buflen; j++)
+            buf[i * 4 + j] = (MD->buffer[i] >> j * 8) & 0xff;
+}
+
+/*
+ * ** End of md5.c
+ * ****************************(cut)****************************************
+ */
diff -Naur tomato/release/src/router/snmp/snmplib/mib.c tomato121/release/src/router/snmp/snmplib/mib.c
--- tomato/release/src/router/snmp/snmplib/mib.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/snmplib/mib.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,5965 @@
+/*
+ * mib.c
+ *
+ * $Id: mib.c,v 1.1.2.1 2004/06/20 21:55:01 nikki Exp $
+ *
+ * Update: 1998-07-17 <jhy@gsu.edu>
+ * Added print_oid_report* functions.
+ */
+/* Portions of this file are subject to the following copyrights.  See
+ * the Net-SNMP's COPYING file for more details and other copyrights
+ * that may apply:
+ */
+/**********************************************************************
+	Copyright 1988, 1989, 1991, 1992 by Carnegie Mellon University
+
+                      All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of CMU not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+CMU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+CMU BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+******************************************************************/
+/*
+ * Copyright © 2003 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms specified in the COPYING file
+ * distributed with the Net-SNMP package.
+ */
+#include <net-snmp/net-snmp-config.h>
+
+#include <stdio.h>
+#include <ctype.h>
+#include <sys/types.h>
+#if HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+#if TIME_WITH_SYS_TIME
+# ifdef WIN32
+#  include <sys/timeb.h>
+# else
+#  include <sys/time.h>
+# endif
+# include <time.h>
+#else
+# if HAVE_SYS_TIME_H
+#  include <sys/time.h>
+# else
+#  include <time.h>
+# endif
+#endif
+#if HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+#if HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#if HAVE_SYS_SELECT_H
+#include <sys/select.h>
+#endif
+
+#if HAVE_WINSOCK_H
+#include <winsock.h>
+#endif
+
+#if HAVE_DMALLOC_H
+#include <dmalloc.h>
+#endif
+
+#include <net-snmp/types.h>
+#include <net-snmp/output_api.h>
+#include <net-snmp/config_api.h>
+#include <net-snmp/utilities.h>
+
+#include <net-snmp/library/asn1.h>
+#include <net-snmp/library/snmp_api.h>
+#include <net-snmp/library/mib.h>
+#include <net-snmp/library/parse.h>
+#include <net-snmp/library/int64.h>
+#include <net-snmp/library/snmp_client.h>
+
+/** @defgroup mib_utilities mib parsing and datatype manipulation routines.
+ *  @ingroup library
+ *
+ *  @{
+ */
+
+static char    *uptimeString(u_long, char *);
+
+static struct tree *_get_realloc_symbol(const oid * objid, size_t objidlen,
+                                        struct tree *subtree,
+                                        u_char ** buf, size_t * buf_len,
+                                        size_t * out_len,
+                                        int allow_realloc,
+                                        int *buf_overflow,
+                                        struct index_list *in_dices,
+                                        size_t * end_of_known);
+
+static void     print_tree_node(FILE *, struct tree *, int);
+static void     handle_mibdirs_conf(const char *token, char *line);
+static void     handle_mibs_conf(const char *token, char *line);
+static void     handle_mibfile_conf(const char *token, char *line);
+
+
+/*
+ * helper functions for get_module_node 
+ */
+static int      node_to_oid(struct tree *, oid *, size_t *);
+static int      _add_strings_to_oid(struct tree *, char *,
+                                    oid *, size_t *, size_t);
+
+extern struct tree *tree_head;
+static struct tree *tree_top;
+
+struct tree    *Mib;            /* Backwards compatibility */
+
+oid             RFC1213_MIB[] = { 1, 3, 6, 1, 2, 1 };
+static char     Standard_Prefix[] = ".1.3.6.1.2.1";
+
+/*
+ * Set default here as some uses of read_objid require valid pointer. 
+ */
+static char    *Prefix = &Standard_Prefix[0];
+typedef struct _PrefixList {
+    const char     *str;
+    int             len;
+}              *PrefixListPtr, PrefixList;
+
+/*
+ * Here are the prefix strings.
+ * Note that the first one finds the value of Prefix or Standard_Prefix.
+ * Any of these MAY start with period; all will NOT end with period.
+ * Period is added where needed.  See use of Prefix in this module.
+ */
+PrefixList      mib_prefixes[] = {
+    {&Standard_Prefix[0]},      /* placeholder for Prefix data */
+    {".iso.org.dod.internet.mgmt.mib-2"},
+    {".iso.org.dod.internet.experimental"},
+    {".iso.org.dod.internet.private"},
+    {".iso.org.dod.internet.snmpParties"},
+    {".iso.org.dod.internet.snmpSecrets"},
+    {NULL, 0}                   /* end of list */
+};
+
+
+/**
+ * @internal
+ * Converts timeticks to hours, minutes, seconds string.
+ *
+ * @param timeticks    The timeticks to convert.
+ * @param buf          Buffer to write to, has to be at 
+ *                     least 64 Bytes large.
+ *       
+ * @return The buffer.
+ */
+static char    *
+uptimeString(u_long timeticks, char *buf)
+{
+    int             centisecs, seconds, minutes, hours, days;
+
+    if (netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_NUMERIC_TIMETICKS)) {
+        sprintf(buf, "%lu", timeticks);
+        return buf;
+    }
+
+
+    centisecs = timeticks % 100;
+    timeticks /= 100;
+    days = timeticks / (60 * 60 * 24);
+    timeticks %= (60 * 60 * 24);
+
+    hours = timeticks / (60 * 60);
+    timeticks %= (60 * 60);
+
+    minutes = timeticks / 60;
+    seconds = timeticks % 60;
+
+    if (netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_QUICK_PRINT))
+        sprintf(buf, "%d:%d:%02d:%02d.%02d",
+                days, hours, minutes, seconds, centisecs);
+    else {
+        if (days == 0) {
+            sprintf(buf, "%d:%02d:%02d.%02d",
+                    hours, minutes, seconds, centisecs);
+        } else if (days == 1) {
+            sprintf(buf, "%d day, %d:%02d:%02d.%02d",
+                    days, hours, minutes, seconds, centisecs);
+        } else {
+            sprintf(buf, "%d days, %d:%02d:%02d.%02d",
+                    days, hours, minutes, seconds, centisecs);
+        }
+    }
+    return buf;
+}
+
+
+
+/**
+ * @internal
+ * Prints the character pointed to if in human-readable ASCII range,
+ * otherwise prints a dot.
+ *
+ * @param buf Buffer to print the character to.
+ * @param ch  Character to print.
+ */
+static void
+sprint_char(char *buf, const u_char ch)
+{
+    if (isprint(ch)) {
+        sprintf(buf, "%c", (int) ch);
+    } else {
+        sprintf(buf, ".");
+    }
+}
+
+
+
+/**
+ * Prints a hexadecimal string into a buffer.
+ *
+ * The characters pointed by *cp are encoded as hexadecimal string.
+ *
+ * If allow_realloc is true the buffer will be (re)allocated to fit in the 
+ * needed size. (Note: *buf may change due to this.)
+ * 
+ * @param buf      address of the buffer to print to.
+ * @param buf_len  address to an integer containing the size of buf.
+ * @param out_len  incremented by the number of characters printed.
+ * @param allow_realloc if not zero reallocate the buffer to fit the 
+ *                      needed size.
+ * @param cp       the array of characters to encode.
+ * @param len      the array length of cp.
+ * 
+ * @return 1 on success, or 0 on failure (out of memory, or buffer to
+ *         small when not allowed to realloc.)
+ */
+int
+sprint_realloc_hexstring(u_char ** buf, size_t * buf_len, size_t * out_len,
+                         int allow_realloc, const u_char * cp, size_t len)
+{
+    const u_char   *tp;
+    size_t          lenleft;
+
+    for (; len >= 16; len -= 16) {
+        while ((*out_len + 50) >= *buf_len) {
+            if (!(allow_realloc && snmp_realloc(buf, buf_len))) {
+                return 0;
+            }
+        }
+
+        sprintf((char *) (*buf + *out_len),
+                "%02X %02X %02X %02X %02X %02X %02X %02X ", cp[0], cp[1],
+                cp[2], cp[3], cp[4], cp[5], cp[6], cp[7]);
+        *out_len += strlen((char *) (*buf + *out_len));
+        cp += 8;
+        sprintf((char *) (*buf + *out_len),
+                "%02X %02X %02X %02X %02X %02X %02X %02X", cp[0], cp[1],
+                cp[2], cp[3], cp[4], cp[5], cp[6], cp[7]);
+        *out_len += strlen((char *) (*buf + *out_len));
+        cp += 8;
+
+        if (netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_PRINT_HEX_TEXT)) {
+            while ((*out_len + 21) >= *buf_len) {
+                if (!(allow_realloc && snmp_realloc(buf, buf_len))) {
+                    return 0;
+                }
+            }
+            sprintf((char *) (*buf + *out_len), "  [");
+            *out_len += strlen((char *) (*buf + *out_len));
+            for (tp = cp - 16; tp < cp; tp++) {
+                sprint_char((char *) (*buf + *out_len), *tp);
+                (*out_len)++;
+            }
+            sprintf((char *) (*buf + *out_len), "]");
+            *out_len += strlen((char *) (*buf + *out_len));
+        }
+        if (len > 16) {
+            while ((*out_len + 2) >= *buf_len) {
+                if (!(allow_realloc && snmp_realloc(buf, buf_len))) {
+                    return 0;
+                }
+            }
+            *(*buf + (*out_len)++) = '\n';
+            *(*buf + *out_len) = 0;
+        }
+    }
+
+    lenleft = len;
+    for (; len > 0; len--) {
+        while ((*out_len + 4) >= *buf_len) {
+            if (!(allow_realloc && snmp_realloc(buf, buf_len))) {
+                return 0;
+            }
+        }
+        sprintf((char *) (*buf + *out_len), "%02X ", *cp++);
+        *out_len += strlen((char *) (*buf + *out_len));
+    }
+
+    if ((lenleft > 0)
+        && netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_PRINT_HEX_TEXT)) {
+        while ((*out_len + 5 + lenleft) >= *buf_len) {
+            if (!(allow_realloc && snmp_realloc(buf, buf_len))) {
+                return 0;
+            }
+        }
+        sprintf((char *) (*buf + *out_len), "  [");
+        *out_len += strlen((char *) (*buf + *out_len));
+        for (tp = cp - lenleft; tp < cp; tp++) {
+            sprint_char((char *) (*buf + *out_len), *tp);
+            (*out_len)++;
+        }
+        sprintf((char *) (*buf + *out_len), "]");
+        *out_len += strlen((char *) (*buf + *out_len));
+    }
+    return 1;
+}
+
+
+
+/**
+ * Prints an ascii string into a buffer.
+ *
+ * The characters pointed by *cp are encoded as an ascii string.
+ * 
+ * If allow_realloc is true the buffer will be (re)allocated to fit in the 
+ * needed size. (Note: *buf may change due to this.)
+ * 
+ * @param buf      address of the buffer to print to.
+ * @param buf_len  address to an integer containing the size of buf.
+ * @param out_len  incremented by the number of characters printed.
+ * @param allow_realloc if not zero reallocate the buffer to fit the 
+ *                      needed size.
+ * @param cp       the array of characters to encode.
+ * @param len      the array length of cp.
+ * 
+ * @return 1 on success, or 0 on failure (out of memory, or buffer to
+ *         small when not allowed to realloc.)
+ */
+int
+sprint_realloc_asciistring(u_char ** buf, size_t * buf_len,
+                           size_t * out_len, int allow_realloc,
+                           const u_char * cp, size_t len)
+{
+    int             i;
+
+    for (i = 0; i < (int) len; i++) {
+        if (isprint(*cp)) {
+            if (*cp == '\\' || *cp == '"') {
+                if ((*out_len >= *buf_len) &&
+                    !(allow_realloc && snmp_realloc(buf, buf_len))) {
+                    return 0;
+                }
+                *(*buf + (*out_len)++) = '\\';
+            }
+            if ((*out_len >= *buf_len) &&
+                !(allow_realloc && snmp_realloc(buf, buf_len))) {
+                return 0;
+            }
+            *(*buf + (*out_len)++) = *cp++;
+        } else {
+            if ((*out_len >= *buf_len) &&
+                !(allow_realloc && snmp_realloc(buf, buf_len))) {
+                return 0;
+            }
+            *(*buf + (*out_len)++) = '.';
+            cp++;
+        }
+    }
+    if ((*out_len >= *buf_len) &&
+        !(allow_realloc && snmp_realloc(buf, buf_len))) {
+        return 0;
+    }
+    *(*buf + *out_len) = '\0';
+    return 1;
+}
+
+/**
+ * Prints an octet string into a buffer.
+ *
+ * The variable var is encoded as octet string.
+ * 
+ * If allow_realloc is true the buffer will be (re)allocated to fit in the 
+ * needed size. (Note: *buf may change due to this.)
+ * 
+ * @param buf      Address of the buffer to print to.
+ * @param buf_len  Address to an integer containing the size of buf.
+ * @param out_len  Incremented by the number of characters printed.
+ * @param allow_realloc if not zero reallocate the buffer to fit the 
+ *                      needed size.
+ * @param var      The variable to encode.
+ * @param enums    The enumeration ff this variable is enumerated. may be NULL.
+ * @param hint     Contents of the DISPLAY-HINT clause of the MIB.
+ *                 See RFC 1903 Section 3.1 for details. may be NULL.
+ * @param units    Contents of the UNITS clause of the MIB. may be NULL.
+ * 
+ * @return 1 on success, or 0 on failure (out of memory, or buffer to
+ *         small when not allowed to realloc.)
+ */
+int
+sprint_realloc_octet_string(u_char ** buf, size_t * buf_len,
+                            size_t * out_len, int allow_realloc,
+                            const netsnmp_variable_list * var,
+                            const struct enum_list *enums, const char *hint,
+                            const char *units)
+{
+    size_t          saved_out_len = *out_len;
+    const char     *saved_hint = hint;
+    int             hex = 0, x = 0;
+    u_char         *cp;
+    int             output_format;
+
+    if ((var->type != ASN_OCTET_STR) && 
+        (!netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_QUICKE_PRINT))) {
+        const char      str[] = "Wrong Type (should be OCTET STRING): ";
+        if (snmp_strcat
+            (buf, buf_len, out_len, allow_realloc, (const u_char *) str)) {
+            return sprint_realloc_by_type(buf, buf_len, out_len,
+                                          allow_realloc, var, NULL, NULL,
+                                          NULL);
+        } else {
+            return 0;
+        }
+    }
+
+
+    if (hint) {
+        int             repeat, width = 1;
+        long            value;
+        char            code = 'd', separ = 0, term = 0, ch, intbuf[16];
+        u_char         *ecp;
+
+        if (!netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_QUICK_PRINT)) {
+            if (!snmp_strcat(buf, buf_len, out_len, allow_realloc,
+                             (const u_char *) "STRING: ")) {
+                return 0;
+            }
+        }
+        cp = var->val.string;
+        ecp = cp + var->val_len;
+
+        while (cp < ecp) {
+            repeat = 1;
+            if (*hint) {
+                if (*hint == '*') {
+                    repeat = *cp++;
+                    hint++;
+                }
+                width = 0;
+                while ('0' <= *hint && *hint <= '9')
+                    width = (width * 10) + (*hint++ - '0');
+                code = *hint++;
+                if ((ch = *hint) && ch != '*' && (ch < '0' || ch > '9')
+                    && (width != 0
+                        || (ch != 'x' && ch != 'd' && ch != 'o')))
+                    separ = *hint++;
+                else
+                    separ = 0;
+                if ((ch = *hint) && ch != '*' && (ch < '0' || ch > '9')
+                    && (width != 0
+                        || (ch != 'x' && ch != 'd' && ch != 'o')))
+                    term = *hint++;
+                else
+                    term = 0;
+                if (width == 0)
+                    width = 1;
+            }
+
+            while (repeat && cp < ecp) {
+                value = 0;
+                if (code != 'a' && code != 't') {
+                    for (x = 0; x < width; x++) {
+                        value = value * 256 + *cp++;
+                    }
+                }
+                switch (code) {
+                case 'x':
+                    sprintf(intbuf, "%lx", value);
+                    if (!snmp_strcat
+                        (buf, buf_len, out_len, allow_realloc,
+                         (u_char *) intbuf)) {
+                        return 0;
+                    }
+                    break;
+                case 'd':
+                    sprintf(intbuf, "%ld", value);
+                    if (!snmp_strcat
+                        (buf, buf_len, out_len, allow_realloc,
+                         (u_char *) intbuf)) {
+                        return 0;
+                    }
+                    break;
+                case 'o':
+                    sprintf(intbuf, "%lo", value);
+                    if (!snmp_strcat
+                        (buf, buf_len, out_len, allow_realloc,
+                         (u_char *) intbuf)) {
+                        return 0;
+                    }
+                    break;
+                case 't': /* new in rfc 3411 */
+                case 'a':
+                    while ((*out_len + width + 1) >= *buf_len) {
+                        if (!(allow_realloc && snmp_realloc(buf, buf_len))) {
+                            return 0;
+                        }
+                    }
+                    for (x = 0; x < width && cp < ecp; x++) {
+                        *(*buf + *out_len) = *cp++;
+                        (*out_len)++;
+                    }
+                    *(*buf + *out_len) = '\0';
+                    break;
+                default:
+                    *out_len = saved_out_len;
+                    if (snmp_strcat(buf, buf_len, out_len, allow_realloc,
+                                    (const u_char *) "(Bad hint ignored: ")
+                        && snmp_strcat(buf, buf_len, out_len,
+                                       allow_realloc,
+                                       (const u_char *) saved_hint)
+                        && snmp_strcat(buf, buf_len, out_len,
+                                       allow_realloc,
+                                       (const u_char *) ") ")) {
+                        return sprint_realloc_octet_string(buf, buf_len,
+                                                           out_len,
+                                                           allow_realloc,
+                                                           var, enums,
+                                                           NULL, NULL);
+                    } else {
+                        return 0;
+                    }
+                }
+
+                if (cp < ecp && separ) {
+                    while ((*out_len + 1) >= *buf_len) {
+                        if (!(allow_realloc && snmp_realloc(buf, buf_len))) {
+                            return 0;
+                        }
+                    }
+                    *(*buf + *out_len) = separ;
+                    (*out_len)++;
+                    *(*buf + *out_len) = '\0';
+                }
+                repeat--;
+            }
+
+            if (term && cp < ecp) {
+                while ((*out_len + 1) >= *buf_len) {
+                    if (!(allow_realloc && snmp_realloc(buf, buf_len))) {
+                        return 0;
+                    }
+                }
+                *(*buf + *out_len) = term;
+                (*out_len)++;
+                *(*buf + *out_len) = '\0';
+            }
+        }
+
+        if (units) {
+            return (snmp_strcat
+                    (buf, buf_len, out_len, allow_realloc,
+                     (const u_char *) " ")
+                    && snmp_strcat(buf, buf_len, out_len, allow_realloc,
+                                   (const u_char *) units));
+        }
+        if ((*out_len >= *buf_len) &&
+            !(allow_realloc && snmp_realloc(buf, buf_len))) {
+            return 0;
+        }
+        *(*buf + *out_len) = '\0';
+
+        return 1;
+    }
+
+    output_format = netsnmp_ds_get_int(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_STRING_OUTPUT_FORMAT);
+    if (0 == output_format) {
+        output_format = NETSNMP_STRING_OUTPUT_GUESS;
+    }
+    switch (output_format) {
+    case NETSNMP_STRING_OUTPUT_GUESS:
+        hex = 0;
+        for (cp = var->val.string, x = 0; x < (int) var->val_len; x++, cp++) {
+            if (!isprint(*cp)) {
+                hex = 1;
+            }
+        }
+        break;
+
+    case NETSNMP_STRING_OUTPUT_ASCII:
+        hex = 0;
+        break;
+
+    case NETSNMP_STRING_OUTPUT_HEX:
+        hex = 1;
+        break;
+    }
+
+    if (var->val_len == 0) {
+        return snmp_strcat(buf, buf_len, out_len, allow_realloc,
+                           (const u_char *) "\"\"");
+    }
+
+    if (hex) {
+        if (netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_QUICK_PRINT)) {
+            if (!snmp_strcat
+                (buf, buf_len, out_len, allow_realloc,
+                 (const u_char *) "\"")) {
+                return 0;
+            }
+        } else {
+            if (!snmp_strcat
+                (buf, buf_len, out_len, allow_realloc,
+                 (const u_char *) "Hex-STRING: ")) {
+                return 0;
+            }
+        }
+
+        if (!sprint_realloc_hexstring(buf, buf_len, out_len, allow_realloc,
+                                      var->val.string, var->val_len)) {
+            return 0;
+        }
+
+        if (netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_QUICK_PRINT)) {
+            if (!snmp_strcat
+                (buf, buf_len, out_len, allow_realloc,
+                 (const u_char *) "\"")) {
+                return 0;
+            }
+        }
+    } else {
+        if (!netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_QUICK_PRINT)) {
+            if (!snmp_strcat(buf, buf_len, out_len, allow_realloc,
+                             (const u_char *) "STRING: ")) {
+                return 0;
+            }
+        }
+        if (!snmp_strcat
+            (buf, buf_len, out_len, allow_realloc,
+             (const u_char *) "\"")) {
+            return 0;
+        }
+        if (!sprint_realloc_asciistring
+            (buf, buf_len, out_len, allow_realloc, var->val.string,
+             var->val_len)) {
+            return 0;
+        }
+        if (!snmp_strcat
+            (buf, buf_len, out_len, allow_realloc,
+             (const u_char *) "\"")) {
+            return 0;
+        }
+    }
+
+    if (units) {
+        return (snmp_strcat
+                (buf, buf_len, out_len, allow_realloc,
+                 (const u_char *) " ")
+                && snmp_strcat(buf, buf_len, out_len, allow_realloc,
+                               (const u_char *) units));
+    }
+    return 1;
+}
+
+#ifdef OPAQUE_SPECIAL_TYPES
+
+/**
+ * Prints a float into a buffer.
+ *
+ * The variable var is encoded as a floating point value.
+ * 
+ * If allow_realloc is true the buffer will be (re)allocated to fit in the 
+ * needed size. (Note: *buf may change due to this.)
+ * 
+ * @param buf      Address of the buffer to print to.
+ * @param buf_len  Address to an integer containing the size of buf.
+ * @param out_len  Incremented by the number of characters printed.
+ * @param allow_realloc if not zero reallocate the buffer to fit the 
+ *                      needed size.
+ * @param var      The variable to encode.
+ * @param enums    The enumeration ff this variable is enumerated. may be NULL.
+ * @param hint     Contents of the DISPLAY-HINT clause of the MIB.
+ *                 See RFC 1903 Section 3.1 for details. may be NULL.
+ * @param units    Contents of the UNITS clause of the MIB. may be NULL.
+ * 
+ * @return 1 on success, or 0 on failure (out of memory, or buffer to
+ *         small when not allowed to realloc.)
+ */
+int
+sprint_realloc_float(u_char ** buf, size_t * buf_len,
+                     size_t * out_len, int allow_realloc,
+                     const netsnmp_variable_list * var,
+                     const struct enum_list *enums,
+                     const char *hint, const char *units)
+{
+    if ((var->type != ASN_OPAQUE_FLOAT) &&
+        (!netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_QUICKE_PRINT))) {
+        u_char          str[] = "Wrong Type (should be Float): ";
+        if (snmp_strcat(buf, buf_len, out_len, allow_realloc, str)) {
+            return sprint_realloc_by_type(buf, buf_len, out_len,
+                                          allow_realloc, var, NULL, NULL,
+                                          NULL);
+        } else {
+            return 0;
+        }
+    }
+
+    if (!netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_QUICK_PRINT)) {
+        if (!snmp_strcat
+            (buf, buf_len, out_len, allow_realloc,
+             (const u_char *) "Opaque: Float: ")) {
+            return 0;
+        }
+    }
+
+
+    /*
+     * How much space needed for max. length float?  128 is overkill.  
+     */
+
+    while ((*out_len + 128 + 1) >= *buf_len) {
+        if (!(allow_realloc && snmp_realloc(buf, buf_len))) {
+            return 0;
+        }
+    }
+
+    sprintf((char *) (*buf + *out_len), "%f", *var->val.floatVal);
+    *out_len += strlen((char *) (*buf + *out_len));
+
+    if (units) {
+        return (snmp_strcat
+                (buf, buf_len, out_len, allow_realloc,
+                 (const u_char *) " ")
+                && snmp_strcat(buf, buf_len, out_len, allow_realloc,
+                               (const u_char *) units));
+    }
+    return 1;
+}
+
+
+/**
+ * Prints a double into a buffer.
+ *
+ * The variable var is encoded as a double precision floating point value.
+ * 
+ * If allow_realloc is true the buffer will be (re)allocated to fit in the 
+ * needed size. (Note: *buf may change due to this.)
+ * 
+ * @param buf      Address of the buffer to print to.
+ * @param buf_len  Address to an integer containing the size of buf.
+ * @param out_len  Incremented by the number of characters printed.
+ * @param allow_realloc if not zero reallocate the buffer to fit the 
+ *                      needed size.
+ * @param var      The variable to encode.
+ * @param enums    The enumeration ff this variable is enumerated. may be NULL.
+ * @param hint     Contents of the DISPLAY-HINT clause of the MIB.
+ *                 See RFC 1903 Section 3.1 for details. may be NULL.
+ * @param units    Contents of the UNITS clause of the MIB. may be NULL.
+ * 
+ * @return 1 on success, or 0 on failure (out of memory, or buffer to
+ *         small when not allowed to realloc.)
+ */
+int
+sprint_realloc_double(u_char ** buf, size_t * buf_len,
+                      size_t * out_len, int allow_realloc,
+                      const netsnmp_variable_list * var,
+                      const struct enum_list *enums,
+                      const char *hint, const char *units)
+{
+    if ((var->type != ASN_OPAQUE_DOUBLE) && 
+        (!netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_QUICKE_PRINT))) {
+        const char      str[] = "Wrong Type (should be Double): ";
+        if (snmp_strcat
+            (buf, buf_len, out_len, allow_realloc, (const u_char *) str)) {
+            return sprint_realloc_by_type(buf, buf_len, out_len,
+                                          allow_realloc, var, NULL, NULL,
+                                          NULL);
+        } else {
+            return 0;
+        }
+    }
+
+    if (!netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_QUICK_PRINT)) {
+        if (!snmp_strcat
+            (buf, buf_len, out_len, allow_realloc,
+             (const u_char *) "Opaque: Float: ")) {
+            return 0;
+        }
+    }
+
+    /*
+     * How much space needed for max. length double?  128 is overkill.  
+     */
+
+    while ((*out_len + 128 + 1) >= *buf_len) {
+        if (!(allow_realloc && snmp_realloc(buf, buf_len))) {
+            return 0;
+        }
+    }
+
+    sprintf((char *) (*buf + *out_len), "%f", *var->val.doubleVal);
+    *out_len += strlen((char *) (*buf + *out_len));
+
+    if (units) {
+        return (snmp_strcat
+                (buf, buf_len, out_len, allow_realloc,
+                 (const u_char *) " ")
+                && snmp_strcat(buf, buf_len, out_len, allow_realloc,
+                               (const u_char *) units));
+    }
+    return 1;
+}
+
+#endif                          /* OPAQUE_SPECIAL_TYPES */
+
+
+/**
+ * Prints a counter into a buffer.
+ *
+ * The variable var is encoded as a counter value.
+ * 
+ * If allow_realloc is true the buffer will be (re)allocated to fit in the 
+ * needed size. (Note: *buf may change due to this.)
+ * 
+ * @param buf      Address of the buffer to print to.
+ * @param buf_len  Address to an integer containing the size of buf.
+ * @param out_len  Incremented by the number of characters printed.
+ * @param allow_realloc if not zero reallocate the buffer to fit the 
+ *                      needed size.
+ * @param var      The variable to encode.
+ * @param enums    The enumeration ff this variable is enumerated. may be NULL.
+ * @param hint     Contents of the DISPLAY-HINT clause of the MIB.
+ *                 See RFC 1903 Section 3.1 for details. may be NULL.
+ * @param units    Contents of the UNITS clause of the MIB. may be NULL.
+ * 
+ * @return 1 on success, or 0 on failure (out of memory, or buffer to
+ *         small when not allowed to realloc.)
+ */
+int
+sprint_realloc_counter64(u_char ** buf, size_t * buf_len, size_t * out_len,
+                         int allow_realloc,
+                         const netsnmp_variable_list * var,
+                         const struct enum_list *enums,
+                         const char *hint, const char *units)
+{
+    char            a64buf[I64CHARSZ + 1];
+
+    if ((var->type != ASN_COUNTER64
+#ifdef OPAQUE_SPECIAL_TYPES
+        && var->type != ASN_OPAQUE_COUNTER64
+        && var->type != ASN_OPAQUE_I64 && var->type != ASN_OPAQUE_U64
+#endif
+        ) && (!netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_QUICKE_PRINT))) {
+        u_char          str[] = "Wrong Type (should be Counter64): ";
+        if (snmp_strcat(buf, buf_len, out_len, allow_realloc, str)) {
+            return sprint_realloc_by_type(buf, buf_len, out_len,
+                                          allow_realloc, var, NULL, NULL,
+                                          NULL);
+        } else {
+            return 0;
+        }
+    }
+
+    if (!netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_QUICK_PRINT)) {
+#ifdef OPAQUE_SPECIAL_TYPES
+        if (var->type != ASN_COUNTER64) {
+            if (!snmp_strcat
+                (buf, buf_len, out_len, allow_realloc,
+                 (const u_char *) "Opaque: ")) {
+                return 0;
+            }
+        }
+#endif
+#ifdef OPAQUE_SPECIAL_TYPES
+        switch (var->type) {
+        case ASN_OPAQUE_U64:
+            if (!snmp_strcat
+                (buf, buf_len, out_len, allow_realloc,
+                 (const u_char *) "UInt64: ")) {
+                return 0;
+            }
+            break;
+        case ASN_OPAQUE_I64:
+            if (!snmp_strcat
+                (buf, buf_len, out_len, allow_realloc,
+                 (const u_char *) "Int64: ")) {
+                return 0;
+            }
+            break;
+        case ASN_COUNTER64:
+        case ASN_OPAQUE_COUNTER64:
+#endif
+            if (!snmp_strcat
+                (buf, buf_len, out_len, allow_realloc,
+                 (const u_char *) "Counter64: ")) {
+                return 0;
+            }
+#ifdef OPAQUE_SPECIAL_TYPES
+        }
+#endif
+    }
+#ifdef OPAQUE_SPECIAL_TYPES
+    if (var->type == ASN_OPAQUE_I64) {
+        printI64(a64buf, var->val.counter64);
+        if (!snmp_strcat
+            (buf, buf_len, out_len, allow_realloc,
+             (const u_char *) a64buf)) {
+            return 0;
+        }
+    } else {
+#endif
+        printU64(a64buf, var->val.counter64);
+        if (!snmp_strcat
+            (buf, buf_len, out_len, allow_realloc,
+             (const u_char *) a64buf)) {
+            return 0;
+        }
+#ifdef OPAQUE_SPECIAL_TYPES
+    }
+#endif
+
+    if (units) {
+        return (snmp_strcat
+                (buf, buf_len, out_len, allow_realloc,
+                 (const u_char *) " ")
+                && snmp_strcat(buf, buf_len, out_len, allow_realloc,
+                               (const u_char *) units));
+    }
+    return 1;
+}
+
+
+/**
+ * Prints an object identifier into a buffer.
+ *
+ * If allow_realloc is true the buffer will be (re)allocated to fit in the 
+ * needed size. (Note: *buf may change due to this.)
+ * 
+ * @param buf      Address of the buffer to print to.
+ * @param buf_len  Address to an integer containing the size of buf.
+ * @param out_len  Incremented by the number of characters printed.
+ * @param allow_realloc if not zero reallocate the buffer to fit the 
+ *                      needed size.
+ * @param var      The variable to encode.
+ * @param enums    The enumeration ff this variable is enumerated. may be NULL.
+ * @param hint     Contents of the DISPLAY-HINT clause of the MIB.
+ *                 See RFC 1903 Section 3.1 for details. may be NULL.
+ * @param units    Contents of the UNITS clause of the MIB. may be NULL.
+ * 
+ * @return 1 on success, or 0 on failure (out of memory, or buffer to
+ *         small when not allowed to realloc.)
+ */
+int
+sprint_realloc_opaque(u_char ** buf, size_t * buf_len,
+                      size_t * out_len, int allow_realloc,
+                      const netsnmp_variable_list * var,
+                      const struct enum_list *enums,
+                      const char *hint, const char *units)
+{
+    if ((var->type != ASN_OPAQUE
+#ifdef OPAQUE_SPECIAL_TYPES
+        && var->type != ASN_OPAQUE_COUNTER64
+        && var->type != ASN_OPAQUE_U64
+        && var->type != ASN_OPAQUE_I64
+        && var->type != ASN_OPAQUE_FLOAT && var->type != ASN_OPAQUE_DOUBLE
+#endif                          /* OPAQUE_SPECIAL_TYPES */
+        ) && (!netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_QUICKE_PRINT))) {
+        u_char          str[] = "Wrong Type (should be Opaque): ";
+        if (snmp_strcat(buf, buf_len, out_len, allow_realloc, str)) {
+            return sprint_realloc_by_type(buf, buf_len, out_len,
+                                          allow_realloc, var, NULL, NULL,
+                                          NULL);
+        } else {
+            return 0;
+        }
+    }
+#ifdef OPAQUE_SPECIAL_TYPES
+    switch (var->type) {
+    case ASN_OPAQUE_COUNTER64:
+    case ASN_OPAQUE_U64:
+    case ASN_OPAQUE_I64:
+        return sprint_realloc_counter64(buf, buf_len, out_len,
+                                        allow_realloc, var, enums, hint,
+                                        units);
+        break;
+
+    case ASN_OPAQUE_FLOAT:
+        return sprint_realloc_float(buf, buf_len, out_len, allow_realloc,
+                                    var, enums, hint, units);
+        break;
+
+    case ASN_OPAQUE_DOUBLE:
+        return sprint_realloc_double(buf, buf_len, out_len, allow_realloc,
+                                     var, enums, hint, units);
+        break;
+
+    case ASN_OPAQUE:
+#endif
+        if (!netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_QUICK_PRINT)) {
+            u_char          str[] = "OPAQUE: ";
+            if (!snmp_strcat(buf, buf_len, out_len, allow_realloc, str)) {
+                return 0;
+            }
+        }
+        if (!sprint_realloc_hexstring(buf, buf_len, out_len, allow_realloc,
+                                      var->val.string, var->val_len)) {
+            return 0;
+        }
+#ifdef OPAQUE_SPECIAL_TYPES
+    }
+#endif
+    if (units) {
+        return (snmp_strcat
+                (buf, buf_len, out_len, allow_realloc,
+                 (const u_char *) " ")
+                && snmp_strcat(buf, buf_len, out_len, allow_realloc,
+                               (const u_char *) units));
+    }
+    return 1;
+}
+
+
+/**
+ * Prints an object identifier into a buffer.
+ *
+ * If allow_realloc is true the buffer will be (re)allocated to fit in the 
+ * needed size. (Note: *buf may change due to this.)
+ * 
+ * @param buf      Address of the buffer to print to.
+ * @param buf_len  Address to an integer containing the size of buf.
+ * @param out_len  Incremented by the number of characters printed.
+ * @param allow_realloc if not zero reallocate the buffer to fit the 
+ *                      needed size.
+ * @param var      The variable to encode.
+ * @param enums    The enumeration ff this variable is enumerated. may be NULL.
+ * @param hint     Contents of the DISPLAY-HINT clause of the MIB.
+ *                 See RFC 1903 Section 3.1 for details. may be NULL.
+ * @param units    Contents of the UNITS clause of the MIB. may be NULL.
+ * 
+ * @return 1 on success, or 0 on failure (out of memory, or buffer to
+ *         small when not allowed to realloc.)
+ */
+int
+sprint_realloc_object_identifier(u_char ** buf, size_t * buf_len,
+                                 size_t * out_len, int allow_realloc,
+                                 const netsnmp_variable_list * var,
+                                 const struct enum_list *enums,
+                                 const char *hint, const char *units)
+{
+    int             buf_overflow = 0;
+
+    if ((var->type != ASN_OBJECT_ID) &&
+        (!netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_QUICKE_PRINT))) {
+        u_char          str[] =
+            "Wrong Type (should be OBJECT IDENTIFIER): ";
+        if (snmp_strcat(buf, buf_len, out_len, allow_realloc, str)) {
+            return sprint_realloc_by_type(buf, buf_len, out_len,
+                                          allow_realloc, var, NULL, NULL,
+                                          NULL);
+        } else {
+            return 0;
+        }
+    }
+
+    if (!netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_QUICK_PRINT)) {
+        u_char          str[] = "OID: ";
+        if (!snmp_strcat(buf, buf_len, out_len, allow_realloc, str)) {
+            return 0;
+        }
+    }
+
+    netsnmp_sprint_realloc_objid_tree(buf, buf_len, out_len, allow_realloc,
+                                      &buf_overflow,
+                                      (oid *) (var->val.objid),
+                                      var->val_len / sizeof(oid));
+
+    if (buf_overflow) {
+        return 0;
+    }
+
+    if (units) {
+        return (snmp_strcat
+                (buf, buf_len, out_len, allow_realloc,
+                 (const u_char *) " ")
+                && snmp_strcat(buf, buf_len, out_len, allow_realloc,
+                               (const u_char *) units));
+    }
+    return 1;
+}
+
+
+
+/**
+ * Prints a timetick variable into a buffer.
+ *
+ * If allow_realloc is true the buffer will be (re)allocated to fit in the 
+ * needed size. (Note: *buf may change due to this.)
+ * 
+ * @param buf      Address of the buffer to print to.
+ * @param buf_len  Address to an integer containing the size of buf.
+ * @param out_len  Incremented by the number of characters printed.
+ * @param allow_realloc if not zero reallocate the buffer to fit the 
+ *                      needed size.
+ * @param var      The variable to encode.
+ * @param enums    The enumeration ff this variable is enumerated. may be NULL.
+ * @param hint     Contents of the DISPLAY-HINT clause of the MIB.
+ *                 See RFC 1903 Section 3.1 for details. may be NULL.
+ * @param units    Contents of the UNITS clause of the MIB. may be NULL.
+ * 
+ * @return 1 on success, or 0 on failure (out of memory, or buffer to
+ *         small when not allowed to realloc.)
+ */
+int
+sprint_realloc_timeticks(u_char ** buf, size_t * buf_len, size_t * out_len,
+                         int allow_realloc,
+                         const netsnmp_variable_list * var,
+                         const struct enum_list *enums,
+                         const char *hint, const char *units)
+{
+    char            timebuf[32];
+
+    if ((var->type != ASN_TIMETICKS) && 
+        (!netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_QUICKE_PRINT))) {
+        u_char          str[] = "Wrong Type (should be Timeticks): ";
+        if (snmp_strcat(buf, buf_len, out_len, allow_realloc, str)) {
+            return sprint_realloc_by_type(buf, buf_len, out_len,
+                                          allow_realloc, var, NULL, NULL,
+                                          NULL);
+        } else {
+            return 0;
+        }
+    }
+
+    if (netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_NUMERIC_TIMETICKS)) {
+        char            str[16];
+        sprintf(str, "%lu", *(u_long *) var->val.integer);
+        if (!snmp_strcat
+            (buf, buf_len, out_len, allow_realloc, (const u_char *) str)) {
+            return 0;
+        }
+        return 1;
+    }
+    if (!netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_QUICK_PRINT)) {
+        char            str[32];
+        sprintf(str, "Timeticks: (%lu) ", *(u_long *) var->val.integer);
+        if (!snmp_strcat
+            (buf, buf_len, out_len, allow_realloc, (const u_char *) str)) {
+            return 0;
+        }
+    }
+    uptimeString(*(u_long *) (var->val.integer), timebuf);
+    if (!snmp_strcat
+        (buf, buf_len, out_len, allow_realloc, (const u_char *) timebuf)) {
+        return 0;
+    }
+    if (units) {
+        return (snmp_strcat
+                (buf, buf_len, out_len, allow_realloc,
+                 (const u_char *) " ")
+                && snmp_strcat(buf, buf_len, out_len, allow_realloc,
+                               (const u_char *) units));
+    }
+    return 1;
+}
+
+
+/**
+ * Prints an integer according to the hint into a buffer.
+ *
+ * If allow_realloc is true the buffer will be (re)allocated to fit in the 
+ * needed size. (Note: *buf may change due to this.)
+ * 
+ * @param buf      Address of the buffer to print to.
+ * @param buf_len  Address to an integer containing the size of buf.
+ * @param out_len  Incremented by the number of characters printed.
+ * @param allow_realloc if not zero reallocate the buffer to fit the 
+ *                      needed size.
+ * @param var      The variable to encode.
+ * @param enums    The enumeration ff this variable is enumerated. may be NULL.
+ * @param hint     Contents of the DISPLAY-HINT clause of the MIB.
+ *                 See RFC 1903 Section 3.1 for details. may _NOT_ be NULL.
+ * @param units    Contents of the UNITS clause of the MIB. may be NULL.
+ * 
+ * @return 1 on success, or 0 on failure (out of memory, or buffer to
+ *         small when not allowed to realloc.)
+ */
+int
+sprint_realloc_hinted_integer(u_char ** buf, size_t * buf_len,
+                              size_t * out_len, int allow_realloc,
+                              long val, const char decimaltype,
+                              const char *hint, const char *units)
+{
+    char            fmt[10] = "%l@", tmp[256];
+    int             shift, len;
+
+    if (hint[1] == '-') {
+        shift = atoi(hint + 2);
+    } else {
+        shift = 0;
+    }
+
+    if (hint[0] == 'd') {
+        /*
+         * We might *actually* want a 'u' here.  
+         */
+        fmt[2] = decimaltype;
+    } else {
+        /*
+         * DISPLAY-HINT character is 'b', 'o', or 'x'.  
+         */
+        fmt[2] = hint[0];
+    }
+
+    sprintf(tmp, fmt, val);
+    if (shift != 0) {
+        len = strlen(tmp);
+        if (shift <= len) {
+            tmp[len + 1] = 0;
+            while (shift--) {
+                tmp[len] = tmp[len - 1];
+                len--;
+            }
+            tmp[len] = '.';
+        } else {
+            tmp[shift + 1] = 0;
+            while (shift) {
+                if (len-- > 0) {
+                    tmp[shift] = tmp[len];
+                } else {
+                    tmp[shift] = '0';
+                }
+                shift--;
+            }
+            tmp[0] = '.';
+        }
+    }
+    return snmp_strcat(buf, buf_len, out_len, allow_realloc, tmp);
+}
+
+
+/**
+ * Prints an integer into a buffer.
+ *
+ * If allow_realloc is true the buffer will be (re)allocated to fit in the 
+ * needed size. (Note: *buf may change due to this.)
+ * 
+ * @param buf      Address of the buffer to print to.
+ * @param buf_len  Address to an integer containing the size of buf.
+ * @param out_len  Incremented by the number of characters printed.
+ * @param allow_realloc if not zero reallocate the buffer to fit the 
+ *                      needed size.
+ * @param var      The variable to encode.
+ * @param enums    The enumeration ff this variable is enumerated. may be NULL.
+ * @param hint     Contents of the DISPLAY-HINT clause of the MIB.
+ *                 See RFC 1903 Section 3.1 for details. may be NULL.
+ * @param units    Contents of the UNITS clause of the MIB. may be NULL.
+ * 
+ * @return 1 on success, or 0 on failure (out of memory, or buffer to
+ *         small when not allowed to realloc.)
+ */
+int
+sprint_realloc_integer(u_char ** buf, size_t * buf_len, size_t * out_len,
+                       int allow_realloc,
+                       const netsnmp_variable_list * var,
+                       const struct enum_list *enums,
+                       const char *hint, const char *units)
+{
+    char           *enum_string = NULL;
+
+    if ((var->type != ASN_INTEGER) && 
+        (!netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_QUICKE_PRINT))) {
+        u_char          str[] = "Wrong Type (should be INTEGER): ";
+        if (snmp_strcat(buf, buf_len, out_len, allow_realloc, str)) {
+            return sprint_realloc_by_type(buf, buf_len, out_len,
+                                          allow_realloc, var, NULL, NULL,
+                                          NULL);
+        } else {
+            return 0;
+        }
+    }
+    for (; enums; enums = enums->next) {
+        if (enums->value == *var->val.integer) {
+            enum_string = enums->label;
+            break;
+        }
+    }
+
+    if (!netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_QUICK_PRINT)) {
+        if (!snmp_strcat(buf, buf_len, out_len, allow_realloc,
+                         (const u_char *) "INTEGER: ")) {
+            return 0;
+        }
+    }
+
+    if (enum_string == NULL ||
+        netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_PRINT_NUMERIC_ENUM)) {
+        if (hint) {
+            if (!(sprint_realloc_hinted_integer(buf, buf_len, out_len,
+                                                allow_realloc,
+                                                *var->val.integer, 'd',
+                                                hint, units))) {
+                return 0;
+            }
+        } else {
+            char            str[16];
+            sprintf(str, "%ld", *var->val.integer);
+            if (!snmp_strcat
+                (buf, buf_len, out_len, allow_realloc,
+                 (const u_char *) str)) {
+                return 0;
+            }
+        }
+    } else if (netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_QUICK_PRINT)) {
+        if (!snmp_strcat
+            (buf, buf_len, out_len, allow_realloc,
+             (const u_char *) enum_string)) {
+            return 0;
+        }
+    } else {
+        char            str[16];
+        sprintf(str, "(%ld)", *var->val.integer);
+        if (!snmp_strcat
+            (buf, buf_len, out_len, allow_realloc,
+             (const u_char *) enum_string)) {
+            return 0;
+        }
+        if (!snmp_strcat
+            (buf, buf_len, out_len, allow_realloc, (const u_char *) str)) {
+            return 0;
+        }
+    }
+
+    if (units) {
+        return (snmp_strcat
+                (buf, buf_len, out_len, allow_realloc,
+                 (const u_char *) " ")
+                && snmp_strcat(buf, buf_len, out_len, allow_realloc,
+                               (const u_char *) units));
+    }
+    return 1;
+}
+
+
+/**
+ * Prints an unsigned integer into a buffer.
+ *
+ * If allow_realloc is true the buffer will be (re)allocated to fit in the 
+ * needed size. (Note: *buf may change due to this.)
+ * 
+ * @param buf      Address of the buffer to print to.
+ * @param buf_len  Address to an integer containing the size of buf.
+ * @param out_len  Incremented by the number of characters printed.
+ * @param allow_realloc if not zero reallocate the buffer to fit the 
+ *                      needed size.
+ * @param var      The variable to encode.
+ * @param enums    The enumeration ff this variable is enumerated. may be NULL.
+ * @param hint     Contents of the DISPLAY-HINT clause of the MIB.
+ *                 See RFC 1903 Section 3.1 for details. may be NULL.
+ * @param units    Contents of the UNITS clause of the MIB. may be NULL.
+ * 
+ * @return 1 on success, or 0 on failure (out of memory, or buffer to
+ *         small when not allowed to realloc.)
+ */
+int
+sprint_realloc_uinteger(u_char ** buf, size_t * buf_len, size_t * out_len,
+                        int allow_realloc,
+                        const netsnmp_variable_list * var,
+                        const struct enum_list *enums,
+                        const char *hint, const char *units)
+{
+    char           *enum_string = NULL;
+
+    if ((var->type != ASN_UINTEGER) && 
+        (!netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_QUICKE_PRINT))) {
+        u_char          str[] = "Wrong Type (should be UInteger32): ";
+        if (snmp_strcat(buf, buf_len, out_len, allow_realloc, str)) {
+            return sprint_realloc_by_type(buf, buf_len, out_len,
+                                          allow_realloc, var, NULL, NULL,
+                                          NULL);
+        } else {
+            return 0;
+        }
+    }
+
+    for (; enums; enums = enums->next) {
+        if (enums->value == *var->val.integer) {
+            enum_string = enums->label;
+            break;
+        }
+    }
+
+    if (enum_string == NULL ||
+        netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_PRINT_NUMERIC_ENUM)) {
+        if (hint) {
+            if (!(sprint_realloc_hinted_integer(buf, buf_len, out_len,
+                                                allow_realloc,
+                                                *var->val.integer, 'u',
+                                                hint, units))) {
+                return 0;
+            }
+        } else {
+            char            str[16];
+            sprintf(str, "%lu", *var->val.integer);
+            if (!snmp_strcat
+                (buf, buf_len, out_len, allow_realloc,
+                 (const u_char *) str)) {
+                return 0;
+            }
+        }
+    } else if (netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_QUICK_PRINT)) {
+        if (!snmp_strcat
+            (buf, buf_len, out_len, allow_realloc,
+             (const u_char *) enum_string)) {
+            return 0;
+        }
+    } else {
+        char            str[16];
+        sprintf(str, "(%lu)", *var->val.integer);
+        if (!snmp_strcat
+            (buf, buf_len, out_len, allow_realloc,
+             (const u_char *) enum_string)) {
+            return 0;
+        }
+        if (!snmp_strcat
+            (buf, buf_len, out_len, allow_realloc, (const u_char *) str)) {
+            return 0;
+        }
+    }
+
+    if (units) {
+        return (snmp_strcat
+                (buf, buf_len, out_len, allow_realloc,
+                 (const u_char *) " ")
+                && snmp_strcat(buf, buf_len, out_len, allow_realloc,
+                               (const u_char *) units));
+    }
+    return 1;
+}
+
+
+/**
+ * Prints a gauge value into a buffer.
+ *
+ * If allow_realloc is true the buffer will be (re)allocated to fit in the 
+ * needed size. (Note: *buf may change due to this.)
+ * 
+ * @param buf      Address of the buffer to print to.
+ * @param buf_len  Address to an integer containing the size of buf.
+ * @param out_len  Incremented by the number of characters printed.
+ * @param allow_realloc if not zero reallocate the buffer to fit the 
+ *                      needed size.
+ * @param var      The variable to encode.
+ * @param enums    The enumeration ff this variable is enumerated. may be NULL.
+ * @param hint     Contents of the DISPLAY-HINT clause of the MIB.
+ *                 See RFC 1903 Section 3.1 for details. may be NULL.
+ * @param units    Contents of the UNITS clause of the MIB. may be NULL.
+ * 
+ * @return 1 on success, or 0 on failure (out of memory, or buffer to
+ *         small when not allowed to realloc.)
+ */
+int
+sprint_realloc_gauge(u_char ** buf, size_t * buf_len, size_t * out_len,
+                     int allow_realloc,
+                     const netsnmp_variable_list * var,
+                     const struct enum_list *enums,
+                     const char *hint, const char *units)
+{
+    char            tmp[32];
+
+    if ((var->type != ASN_GAUGE) && 
+        (!netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_QUICKE_PRINT))) {
+        u_char          str[] =
+            "Wrong Type (should be Gauge32 or Unsigned32): ";
+        if (snmp_strcat(buf, buf_len, out_len, allow_realloc, str)) {
+            return sprint_realloc_by_type(buf, buf_len, out_len,
+                                          allow_realloc, var, NULL, NULL,
+                                          NULL);
+        } else {
+            return 0;
+        }
+    }
+
+    if (!netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_QUICK_PRINT)) {
+        u_char          str[] = "Gauge32: ";
+        if (!snmp_strcat(buf, buf_len, out_len, allow_realloc, str)) {
+            return 0;
+        }
+    }
+    if (hint) {
+        if (!sprint_realloc_hinted_integer(buf, buf_len, out_len,
+                                           allow_realloc,
+                                           *var->val.integer, 'u', hint,
+                                           units)) {
+            return 0;
+        }
+    } else {
+        sprintf(tmp, "%lu", *var->val.integer);
+        if (!snmp_strcat
+            (buf, buf_len, out_len, allow_realloc, (const u_char *) tmp)) {
+            return 0;
+        }
+    }
+    if (units) {
+        return (snmp_strcat
+                (buf, buf_len, out_len, allow_realloc,
+                 (const u_char *) " ")
+                && snmp_strcat(buf, buf_len, out_len, allow_realloc,
+                               (const u_char *) units));
+    }
+    return 1;
+}
+
+
+/**
+ * Prints a counter value into a buffer.
+ *
+ * If allow_realloc is true the buffer will be (re)allocated to fit in the 
+ * needed size. (Note: *buf may change due to this.)
+ * 
+ * @param buf      Address of the buffer to print to.
+ * @param buf_len  Address to an integer containing the size of buf.
+ * @param out_len  Incremented by the number of characters printed.
+ * @param allow_realloc if not zero reallocate the buffer to fit the 
+ *                      needed size.
+ * @param var      The variable to encode.
+ * @param enums    The enumeration ff this variable is enumerated. may be NULL.
+ * @param hint     Contents of the DISPLAY-HINT clause of the MIB.
+ *                 See RFC 1903 Section 3.1 for details. may be NULL.
+ * @param units    Contents of the UNITS clause of the MIB. may be NULL.
+ * 
+ * @return 1 on success, or 0 on failure (out of memory, or buffer to
+ *         small when not allowed to realloc.)
+ */
+int
+sprint_realloc_counter(u_char ** buf, size_t * buf_len, size_t * out_len,
+                       int allow_realloc,
+                       const netsnmp_variable_list * var,
+                       const struct enum_list *enums,
+                       const char *hint, const char *units)
+{
+    char            tmp[32];
+
+    if ((var->type != ASN_COUNTER) && 
+        (!netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_QUICKE_PRINT))) {
+        u_char          str[] = "Wrong Type (should be Counter32): ";
+        if (snmp_strcat(buf, buf_len, out_len, allow_realloc, str)) {
+            return sprint_realloc_by_type(buf, buf_len, out_len,
+                                          allow_realloc, var, NULL, NULL,
+                                          NULL);
+        } else {
+            return 0;
+        }
+    }
+
+    if (!netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_QUICK_PRINT)) {
+        u_char          str[] = "Counter32: ";
+        if (!snmp_strcat(buf, buf_len, out_len, allow_realloc, str)) {
+            return 0;
+        }
+    }
+    sprintf(tmp, "%lu", *var->val.integer);
+    if (!snmp_strcat
+        (buf, buf_len, out_len, allow_realloc, (const u_char *) tmp)) {
+        return 0;
+    }
+    if (units) {
+        return (snmp_strcat
+                (buf, buf_len, out_len, allow_realloc,
+                 (const u_char *) " ")
+                && snmp_strcat(buf, buf_len, out_len, allow_realloc,
+                               (const u_char *) units));
+    }
+    return 1;
+}
+
+
+/**
+ * Prints a network address into a buffer.
+ *
+ * If allow_realloc is true the buffer will be (re)allocated to fit in the 
+ * needed size. (Note: *buf may change due to this.)
+ * 
+ * @param buf      Address of the buffer to print to.
+ * @param buf_len  Address to an integer containing the size of buf.
+ * @param out_len  Incremented by the number of characters printed.
+ * @param allow_realloc if not zero reallocate the buffer to fit the 
+ *                      needed size.
+ * @param var      The variable to encode.
+ * @param enums    The enumeration ff this variable is enumerated. may be NULL.
+ * @param hint     Contents of the DISPLAY-HINT clause of the MIB.
+ *                 See RFC 1903 Section 3.1 for details. may be NULL.
+ * @param units    Contents of the UNITS clause of the MIB. may be NULL.
+ * 
+ * @return 1 on success, or 0 on failure (out of memory, or buffer to
+ *         small when not allowed to realloc.)
+ */
+int
+sprint_realloc_networkaddress(u_char ** buf, size_t * buf_len,
+                              size_t * out_len, int allow_realloc,
+                              const netsnmp_variable_list * var,
+                              const struct enum_list *enums, const char *hint,
+                              const char *units)
+{
+    size_t          i;
+
+    if ((var->type != ASN_IPADDRESS) && 
+        (!netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_QUICKE_PRINT))) {
+        u_char          str[] = "Wrong Type (should be NetworkAddress): ";
+        if (snmp_strcat(buf, buf_len, out_len, allow_realloc, str)) {
+            return sprint_realloc_by_type(buf, buf_len, out_len,
+                                          allow_realloc, var, NULL, NULL,
+                                          NULL);
+        } else {
+            return 0;
+        }
+    }
+
+    if (!netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_QUICK_PRINT)) {
+        u_char          str[] = "Network Address: ";
+        if (!snmp_strcat(buf, buf_len, out_len, allow_realloc, str)) {
+            return 0;
+        }
+    }
+
+    while ((*out_len + (var->val_len * 3) + 2) >= *buf_len) {
+        if (!(allow_realloc && snmp_realloc(buf, buf_len))) {
+            return 0;
+        }
+    }
+
+    for (i = 0; i < var->val_len; i++) {
+        sprintf((char *) (*buf + *out_len), "%02X", var->val.string[i]);
+        *out_len += 2;
+        if (i < var->val_len - 1) {
+            *(*buf + *out_len) = ':';
+            (*out_len)++;
+        }
+    }
+    return 1;
+}
+
+
+/**
+ * Prints an ip-address into a buffer.
+ *
+ * If allow_realloc is true the buffer will be (re)allocated to fit in the 
+ * needed size. (Note: *buf may change due to this.)
+ * 
+ * @param buf      Address of the buffer to print to.
+ * @param buf_len  Address to an integer containing the size of buf.
+ * @param out_len  Incremented by the number of characters printed.
+ * @param allow_realloc if not zero reallocate the buffer to fit the 
+ *                      needed size.
+ * @param var      The variable to encode.
+ * @param enums    The enumeration ff this variable is enumerated. may be NULL.
+ * @param hint     Contents of the DISPLAY-HINT clause of the MIB.
+ *                 See RFC 1903 Section 3.1 for details. may be NULL.
+ * @param units    Contents of the UNITS clause of the MIB. may be NULL.
+ * 
+ * @return 1 on success, or 0 on failure (out of memory, or buffer to
+ *         small when not allowed to realloc.)
+ */
+int
+sprint_realloc_ipaddress(u_char ** buf, size_t * buf_len, size_t * out_len,
+                         int allow_realloc,
+                         const netsnmp_variable_list * var,
+                         const struct enum_list *enums,
+                         const char *hint, const char *units)
+{
+    u_char         *ip = var->val.string;
+
+    if ((var->type != ASN_IPADDRESS) && 
+        (!netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_QUICKE_PRINT))) {
+        u_char          str[] = "Wrong Type (should be IpAddress): ";
+        if (snmp_strcat(buf, buf_len, out_len, allow_realloc, str)) {
+            return sprint_realloc_by_type(buf, buf_len, out_len,
+                                          allow_realloc, var, NULL, NULL,
+                                          NULL);
+        } else {
+            return 0;
+        }
+    }
+
+    if (!netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_QUICK_PRINT)) {
+        u_char          str[] = "IpAddress: ";
+        if (!snmp_strcat(buf, buf_len, out_len, allow_realloc, str)) {
+            return 0;
+        }
+    }
+    while ((*out_len + 17) >= *buf_len) {
+        if (!(allow_realloc && snmp_realloc(buf, buf_len))) {
+            return 0;
+        }
+    }
+    sprintf((char *) (*buf + *out_len), "%d.%d.%d.%d", ip[0], ip[1], ip[2],
+            ip[3]);
+    *out_len += strlen((char *) (*buf + *out_len));
+    return 1;
+}
+
+
+/**
+ * Prints a null value into a buffer.
+ *
+ * If allow_realloc is true the buffer will be (re)allocated to fit in the 
+ * needed size. (Note: *buf may change due to this.)
+ * 
+ * @param buf      Address of the buffer to print to.
+ * @param buf_len  Address to an integer containing the size of buf.
+ * @param out_len  Incremented by the number of characters printed.
+ * @param allow_realloc if not zero reallocate the buffer to fit the 
+ *                      needed size.
+ * @param var      The variable to encode.
+ * @param enums    The enumeration ff this variable is enumerated. may be NULL.
+ * @param hint     Contents of the DISPLAY-HINT clause of the MIB.
+ *                 See RFC 1903 Section 3.1 for details. may be NULL.
+ * @param units    Contents of the UNITS clause of the MIB. may be NULL.
+ * 
+ * @return 1 on success, or 0 on failure (out of memory, or buffer to
+ *         small when not allowed to realloc.)
+ */
+int
+sprint_realloc_null(u_char ** buf, size_t * buf_len, size_t * out_len,
+                    int allow_realloc,
+                    const netsnmp_variable_list * var,
+                    const struct enum_list *enums,
+                    const char *hint, const char *units)
+{
+    if ((var->type != ASN_NULL) && 
+        (!netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_QUICKE_PRINT))) {
+        u_char          str[] = "Wrong Type (should be NULL): ";
+        if (snmp_strcat(buf, buf_len, out_len, allow_realloc, str)) {
+            return sprint_realloc_by_type(buf, buf_len, out_len,
+                                          allow_realloc, var, NULL, NULL,
+                                          NULL);
+        } else {
+            return 0;
+        }
+    } else {
+        u_char          str[] = "NULL";
+        return snmp_strcat(buf, buf_len, out_len, allow_realloc, str);
+    }
+}
+
+
+/**
+ * Prints a bit string into a buffer.
+ *
+ * If allow_realloc is true the buffer will be (re)allocated to fit in the 
+ * needed size. (Note: *buf may change due to this.)
+ * 
+ * @param buf      Address of the buffer to print to.
+ * @param buf_len  Address to an integer containing the size of buf.
+ * @param out_len  Incremented by the number of characters printed.
+ * @param allow_realloc if not zero reallocate the buffer to fit the 
+ *                      needed size.
+ * @param var      The variable to encode.
+ * @param enums    The enumeration ff this variable is enumerated. may be NULL.
+ * @param hint     Contents of the DISPLAY-HINT clause of the MIB.
+ *                 See RFC 1903 Section 3.1 for details. may be NULL.
+ * @param units    Contents of the UNITS clause of the MIB. may be NULL.
+ * 
+ * @return 1 on success, or 0 on failure (out of memory, or buffer to
+ *         small when not allowed to realloc.)
+ */
+int
+sprint_realloc_bitstring(u_char ** buf, size_t * buf_len, size_t * out_len,
+                         int allow_realloc,
+                         const netsnmp_variable_list * var,
+                         const struct enum_list *enums,
+                         const char *hint, const char *units)
+{
+    int             len, bit;
+    u_char         *cp;
+    char           *enum_string;
+
+    if ((var->type != ASN_BIT_STR && var->type != ASN_OCTET_STR) &&
+        (!netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_QUICKE_PRINT))) {
+        u_char          str[] = "Wrong Type (should be BITS): ";
+        if (snmp_strcat(buf, buf_len, out_len, allow_realloc, str)) {
+            return sprint_realloc_by_type(buf, buf_len, out_len,
+                                          allow_realloc, var, NULL, NULL,
+                                          NULL);
+        } else {
+            return 0;
+        }
+    }
+
+    if (netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_QUICK_PRINT)) {
+        u_char          str[] = "\"";
+        if (!snmp_strcat(buf, buf_len, out_len, allow_realloc, str)) {
+            return 0;
+        }
+    } else {
+        u_char          str[] = "BITS: ";
+        if (!snmp_strcat(buf, buf_len, out_len, allow_realloc, str)) {
+            return 0;
+        }
+    }
+    if (!sprint_realloc_hexstring(buf, buf_len, out_len, allow_realloc,
+                                  var->val.bitstring, var->val_len)) {
+        return 0;
+    }
+
+    if (netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_QUICK_PRINT)) {
+        u_char          str[] = "\"";
+        if (!snmp_strcat(buf, buf_len, out_len, allow_realloc, str)) {
+            return 0;
+        }
+    } else {
+        cp = var->val.bitstring;
+        for (len = 0; len < (int) var->val_len; len++) {
+            for (bit = 0; bit < 8; bit++) {
+                if (*cp & (0x80 >> bit)) {
+                    enum_string = NULL;
+                    for (; enums; enums = enums->next) {
+                        if (enums->value == (len * 8) + bit) {
+                            enum_string = enums->label;
+                            break;
+                        }
+                    }
+                    if (enum_string == NULL ||
+                        netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID,
+                                       NETSNMP_DS_LIB_PRINT_NUMERIC_ENUM)) {
+                        char            str[16];
+                        sprintf(str, "%d ", (len * 8) + bit);
+                        if (!snmp_strcat
+                            (buf, buf_len, out_len, allow_realloc,
+                             (const u_char *) str)) {
+                            return 0;
+                        }
+                    } else {
+                        char            str[16];
+                        sprintf(str, "(%d) ", (len * 8) + bit);
+                        if (!snmp_strcat
+                            (buf, buf_len, out_len, allow_realloc,
+                             (const u_char *) enum_string)) {
+                            return 0;
+                        }
+                        if (!snmp_strcat
+                            (buf, buf_len, out_len, allow_realloc,
+                             (const u_char *) str)) {
+                            return 0;
+                        }
+                    }
+                }
+            }
+            cp++;
+        }
+    }
+    return 1;
+}
+
+int
+sprint_realloc_nsapaddress(u_char ** buf, size_t * buf_len,
+                           size_t * out_len, int allow_realloc,
+                           const netsnmp_variable_list * var,
+                           const struct enum_list *enums, const char *hint,
+                           const char *units)
+{
+    if ((var->type != ASN_NSAP) && 
+        (!netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_QUICKE_PRINT))) {
+        u_char          str[] = "Wrong Type (should be NsapAddress): ";
+        if (snmp_strcat(buf, buf_len, out_len, allow_realloc, str)) {
+            return sprint_realloc_by_type(buf, buf_len, out_len,
+                                          allow_realloc, var, NULL, NULL,
+                                          NULL);
+        } else {
+            return 0;
+        }
+    }
+
+    if (!netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_QUICK_PRINT)) {
+        u_char          str[] = "NsapAddress: ";
+        if (!snmp_strcat(buf, buf_len, out_len, allow_realloc, str)) {
+            return 0;
+        }
+    }
+
+    return sprint_realloc_hexstring(buf, buf_len, out_len, allow_realloc,
+                                    var->val.string, var->val_len);
+}
+
+
+/**
+ * Fallback routine for a bad type, prints "Variable has bad type" into a buffer.
+ *
+ * If allow_realloc is true the buffer will be (re)allocated to fit in the 
+ * needed size. (Note: *buf may change due to this.)
+ * 
+ * @param buf      Address of the buffer to print to.
+ * @param buf_len  Address to an integer containing the size of buf.
+ * @param out_len  Incremented by the number of characters printed.
+ * @param allow_realloc if not zero reallocate the buffer to fit the 
+ *                      needed size.
+ * @param var      The variable to encode.
+ * @param enums    The enumeration ff this variable is enumerated. may be NULL.
+ * @param hint     Contents of the DISPLAY-HINT clause of the MIB.
+ *                 See RFC 1903 Section 3.1 for details. may be NULL.
+ * @param units    Contents of the UNITS clause of the MIB. may be NULL.
+ * 
+ * @return 1 on success, or 0 on failure (out of memory, or buffer to
+ *         small when not allowed to realloc.)
+ */
+int
+sprint_realloc_badtype(u_char ** buf, size_t * buf_len, size_t * out_len,
+                       int allow_realloc,
+                       const netsnmp_variable_list * var,
+                       const struct enum_list *enums,
+                       const char *hint, const char *units)
+{
+    u_char          str[] = "Variable has bad type";
+
+    return snmp_strcat(buf, buf_len, out_len, allow_realloc, str);
+}
+
+
+
+/**
+ * Universal print routine, prints a variable into a buffer according to the variable 
+ * type.
+ *
+ * If allow_realloc is true the buffer will be (re)allocated to fit in the 
+ * needed size. (Note: *buf may change due to this.)
+ * 
+ * @param buf      Address of the buffer to print to.
+ * @param buf_len  Address to an integer containing the size of buf.
+ * @param out_len  Incremented by the number of characters printed.
+ * @param allow_realloc if not zero reallocate the buffer to fit the 
+ *                      needed size.
+ * @param var      The variable to encode.
+ * @param enums    The enumeration ff this variable is enumerated. may be NULL.
+ * @param hint     Contents of the DISPLAY-HINT clause of the MIB.
+ *                 See RFC 1903 Section 3.1 for details. may be NULL.
+ * @param units    Contents of the UNITS clause of the MIB. may be NULL.
+ * 
+ * @return 1 on success, or 0 on failure (out of memory, or buffer to
+ *         small when not allowed to realloc.)
+ */
+int
+sprint_realloc_by_type(u_char ** buf, size_t * buf_len, size_t * out_len,
+                       int allow_realloc,
+                       const netsnmp_variable_list * var,
+                       const struct enum_list *enums,
+                       const char *hint, const char *units)
+{
+    DEBUGMSGTL(("output", "sprint_by_type, type %d\n", var->type));
+
+    switch (var->type) {
+    case ASN_INTEGER:
+        return sprint_realloc_integer(buf, buf_len, out_len, allow_realloc,
+                                      var, enums, hint, units);
+    case ASN_OCTET_STR:
+        return sprint_realloc_octet_string(buf, buf_len, out_len,
+                                           allow_realloc, var, enums, hint,
+                                           units);
+    case ASN_BIT_STR:
+        return sprint_realloc_bitstring(buf, buf_len, out_len,
+                                        allow_realloc, var, enums, hint,
+                                        units);
+    case ASN_OPAQUE:
+        return sprint_realloc_opaque(buf, buf_len, out_len, allow_realloc,
+                                     var, enums, hint, units);
+    case ASN_OBJECT_ID:
+        return sprint_realloc_object_identifier(buf, buf_len, out_len,
+                                                allow_realloc, var, enums,
+                                                hint, units);
+    case ASN_TIMETICKS:
+        return sprint_realloc_timeticks(buf, buf_len, out_len,
+                                        allow_realloc, var, enums, hint,
+                                        units);
+    case ASN_GAUGE:
+        return sprint_realloc_gauge(buf, buf_len, out_len, allow_realloc,
+                                    var, enums, hint, units);
+    case ASN_COUNTER:
+        return sprint_realloc_counter(buf, buf_len, out_len, allow_realloc,
+                                      var, enums, hint, units);
+    case ASN_IPADDRESS:
+        return sprint_realloc_ipaddress(buf, buf_len, out_len,
+                                        allow_realloc, var, enums, hint,
+                                        units);
+    case ASN_NULL:
+        return sprint_realloc_null(buf, buf_len, out_len, allow_realloc,
+                                   var, enums, hint, units);
+    case ASN_UINTEGER:
+        return sprint_realloc_uinteger(buf, buf_len, out_len,
+                                       allow_realloc, var, enums, hint,
+                                       units);
+    case ASN_COUNTER64:
+#ifdef OPAQUE_SPECIAL_TYPES
+    case ASN_OPAQUE_U64:
+    case ASN_OPAQUE_I64:
+    case ASN_OPAQUE_COUNTER64:
+#endif                          /* OPAQUE_SPECIAL_TYPES */
+        return sprint_realloc_counter64(buf, buf_len, out_len,
+                                        allow_realloc, var, enums, hint,
+                                        units);
+#ifdef OPAQUE_SPECIAL_TYPES
+    case ASN_OPAQUE_FLOAT:
+        return sprint_realloc_float(buf, buf_len, out_len, allow_realloc,
+                                    var, enums, hint, units);
+    case ASN_OPAQUE_DOUBLE:
+        return sprint_realloc_double(buf, buf_len, out_len, allow_realloc,
+                                     var, enums, hint, units);
+#endif                          /* OPAQUE_SPECIAL_TYPES */
+    default:
+        DEBUGMSGTL(("sprint_by_type", "bad type: %d\n", var->type));
+        return sprint_realloc_badtype(buf, buf_len, out_len, allow_realloc,
+                                      var, enums, hint, units);
+    }
+}
+
+
+/**
+ * Retrieves the tree head.
+ *
+ * @return the tree head.
+ */
+struct tree    *
+get_tree_head(void)
+{
+    return (tree_head);
+}
+
+static char    *confmibdir = NULL;
+static char    *confmibs = NULL;
+
+static void
+handle_mibdirs_conf(const char *token, char *line)
+{
+    char           *ctmp;
+
+    if (confmibdir) {
+        ctmp = (char *) malloc(strlen(confmibdir) + strlen(line) + 1);
+        if (!ctmp) {
+            DEBUGMSGTL(("read_config:initmib", "mibdir conf malloc failed"));
+            return;
+        }
+        if (*line == '+')
+            line++;
+        sprintf(ctmp, "%s%c%s", confmibdir, ENV_SEPARATOR_CHAR, line);
+        free(confmibdir);
+        confmibdir = ctmp;
+    } else {
+        confmibdir = strdup(line);
+    }
+    DEBUGMSGTL(("read_config:initmib", "using mibdirs: %s\n", confmibdir));
+}
+
+static void
+handle_mibs_conf(const char *token, char *line)
+{
+    char           *ctmp;
+
+    if (confmibs) {
+        ctmp = (char *) malloc(strlen(confmibs) + strlen(line) + 1);
+        if (!ctmp) {
+            DEBUGMSGTL(("read_config:initmib", "mibs conf malloc failed"));
+            return;
+        }
+        if (*line == '+')
+            line++;
+        sprintf(ctmp, "%s%c%s", confmibs, ENV_SEPARATOR_CHAR, line);
+        free(confmibs);
+        confmibs = ctmp;
+    } else {
+        confmibs = strdup(line);
+    }
+    DEBUGMSGTL(("read_config:initmib", "using mibs: %s\n", confmibs));
+}
+
+
+static void
+handle_mibfile_conf(const char *token, char *line)
+{
+    DEBUGMSGTL(("read_config:initmib", "reading mibfile: %s\n", line));
+    read_mib(line);
+}
+
+static void
+handle_print_numeric(const char *token, char *line)
+{
+    const char *value;
+
+    value = strtok(line, " \t\n");
+    if ((strcasecmp(value, "yes")  == 0) || 
+	(strcasecmp(value, "true") == 0) ||
+	(*value == '1')) {
+
+        netsnmp_ds_set_int(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_OID_OUTPUT_FORMAT,
+                                                  NETSNMP_OID_OUTPUT_NUMERIC);
+    }
+}
+
+char           *
+snmp_out_toggle_options(char *options)
+{
+    while (*options) {
+        switch (*options++) {
+        case 'a':
+            netsnmp_ds_set_int(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_STRING_OUTPUT_FORMAT,
+                                                      NETSNMP_STRING_OUTPUT_ASCII);
+            break;
+        case 'b':
+            netsnmp_ds_toggle_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_DONT_BREAKDOWN_OIDS);
+            break;
+        case 'e':
+            netsnmp_ds_toggle_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_PRINT_NUMERIC_ENUM);
+            break;
+        case 'E':
+            netsnmp_ds_toggle_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_ESCAPE_QUOTES);
+            break;
+        case 'f':
+            netsnmp_ds_set_int(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_OID_OUTPUT_FORMAT,
+                                                      NETSNMP_OID_OUTPUT_FULL);
+            break;
+        case 'n':
+            netsnmp_ds_set_int(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_OID_OUTPUT_FORMAT,
+                                                      NETSNMP_OID_OUTPUT_NUMERIC);
+            break;
+        case 'q':
+            netsnmp_ds_toggle_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_QUICK_PRINT);
+            break;
+        case 'Q':
+            netsnmp_ds_set_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_QUICKE_PRINT, 1);
+            netsnmp_ds_toggle_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_QUICK_PRINT);
+            break;
+        case 's':
+            netsnmp_ds_set_int(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_OID_OUTPUT_FORMAT,
+                                                      NETSNMP_OID_OUTPUT_SUFFIX);
+            break;
+        case 'S':
+            netsnmp_ds_set_int(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_OID_OUTPUT_FORMAT,
+                                                      NETSNMP_OID_OUTPUT_MODULE);
+            break;
+        case 't':
+            netsnmp_ds_toggle_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_NUMERIC_TIMETICKS);
+            break;
+        case 'T':
+            netsnmp_ds_toggle_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_PRINT_HEX_TEXT);
+            break;
+        case 'u':
+            netsnmp_ds_set_int(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_OID_OUTPUT_FORMAT,
+                                                      NETSNMP_OID_OUTPUT_UCD);
+            break;
+        case 'U':
+            netsnmp_ds_toggle_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_DONT_PRINT_UNITS);
+            break;
+        case 'v':
+            netsnmp_ds_toggle_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_PRINT_BARE_VALUE);
+            break;
+        case 'x':
+            netsnmp_ds_set_int(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_STRING_OUTPUT_FORMAT,
+                                                      NETSNMP_STRING_OUTPUT_HEX);
+            break;
+        case 'X':
+            netsnmp_ds_toggle_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_EXTENDED_INDEX);
+            break;
+        default:
+            return options - 1;
+        }
+    }
+    return NULL;
+}
+
+void
+snmp_out_toggle_options_usage(const char *lead, FILE * outf)
+{
+    fprintf(outf, "%sa:  print all strings in ascii format\n", lead);
+    fprintf(outf, "%sb:  do not break OID indexes down\n", lead);
+    fprintf(outf, "%se:  print enums numerically\n", lead);
+    fprintf(outf, "%sE:  escape quotes in string indices\n", lead);
+    fprintf(outf, "%sf:  print full OIDs on output\n", lead);
+    fprintf(outf, "%sn:  print OIDs numerically\n", lead);
+    fprintf(outf, "%sq:  quick print for easier parsing\n", lead);
+    fprintf(outf, "%sQ:  quick print with equal-signs\n", lead);    /* @@JDW */
+    fprintf(outf, "%ss:  print only last symbolic element of OID\n", lead);
+    fprintf(outf, "%sS:  print MIB module-id plus last element\n", lead);
+    fprintf(outf, "%st:  print timeticks unparsed as numeric integers\n",
+            lead);
+    fprintf(outf,
+            "%sT:  print human-readable text along with hex strings\n",
+            lead);
+    fprintf(outf, "%su:  print OIDs using UCD-style prefix suppression\n",
+            lead);
+    fprintf(outf, "%sU:  don't print units\n", lead);
+    fprintf(outf, "%sv:  print values only (not OID = value)\n", lead);
+    fprintf(outf, "%sx:  print all strings in hex format\n", lead);
+    fprintf(outf, "%sX:  extended index format\n", lead);
+}
+
+char           *
+snmp_in_toggle_options(char *options)
+{
+    while (*options) {
+        switch (*options++) {
+        case 'b':
+            netsnmp_ds_toggle_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_REGEX_ACCESS);
+            break;
+        case 'R':
+            netsnmp_ds_toggle_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_RANDOM_ACCESS);
+            break;
+        case 'r':
+            netsnmp_ds_toggle_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_DONT_CHECK_RANGE);
+            break;
+        case 'h':
+            netsnmp_ds_toggle_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_NO_DISPLAY_HINT);
+            break;
+        case 'u':
+            netsnmp_ds_toggle_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_READ_UCD_STYLE_OID);
+            break;
+        default:
+            return options - 1;
+        }
+    }
+    return NULL;
+}
+
+
+/**
+ * Prints out a help usage for the in* toggle options.
+ *
+ * @param lead      The lead to print for every line.
+ * @param outf      The file descriptor to write to.
+ * 
+ */
+void
+snmp_in_toggle_options_usage(const char *lead, FILE * outf)
+{
+    fprintf(outf, "%sb:  do best/regex matching to find a MIB node\n",
+            lead);
+    fprintf(outf, "%sr:  do not check values for range/type legality\n",
+            lead);
+    fprintf(outf, "%sR:  do random access to OID labels\n", lead);
+    fprintf(outf, "%sh:  don't apply DISPLAY-HINTs\n", lead);
+    fprintf(outf,
+            "%su:  top-level OIDs must have '.' prefix (UCD-style)\n",
+            lead);
+}
+
+/***
+ *
+ */ 
+void
+register_mib_handlers(void)
+{
+    register_prenetsnmp_mib_handler("snmp", "mibdirs",
+                                    handle_mibdirs_conf, NULL,
+                                    "[mib-dirs|+mib-dirs]");
+    register_prenetsnmp_mib_handler("snmp", "mibs",
+                                    handle_mibs_conf, NULL,
+                                    "[mib-tokens|+mib-tokens]");
+    register_config_handler("snmp", "mibfile",
+                            handle_mibfile_conf, NULL, "mibfile-to-read");
+
+    /*
+     * register the snmp.conf configuration handlers for default
+     * parsing behaviour 
+     */
+
+    netsnmp_ds_register_premib(ASN_BOOLEAN, "snmp", "showMibErrors",
+                       NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_MIB_ERRORS);
+    netsnmp_ds_register_premib(ASN_BOOLEAN, "snmp", "strictCommentTerm",
+                       NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_MIB_COMMENT_TERM);
+    netsnmp_ds_register_premib(ASN_BOOLEAN, "snmp", "mibAllowUnderline",
+                       NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_MIB_PARSE_LABEL);
+    netsnmp_ds_register_premib(ASN_INTEGER, "snmp", "mibWarningLevel",
+                       NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_MIB_WARNINGS);
+    netsnmp_ds_register_premib(ASN_BOOLEAN, "snmp", "mibReplaceWithLatest",
+                       NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_MIB_REPLACE);
+
+    netsnmp_ds_register_premib(ASN_BOOLEAN, "snmp", "printNumericEnums",
+                       NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_PRINT_NUMERIC_ENUM);
+    register_prenetsnmp_mib_handler("snmp", "printNumericOids",
+                       handle_print_numeric, NULL, "(1|yes|true|0|no|false)");
+    netsnmp_ds_register_premib(ASN_BOOLEAN, "snmp", "escapeQuotes",
+                       NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_ESCAPE_QUOTES);
+    netsnmp_ds_register_premib(ASN_BOOLEAN, "snmp", "dontBreakdownOids",
+                       NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_DONT_BREAKDOWN_OIDS);
+    netsnmp_ds_register_premib(ASN_BOOLEAN, "snmp", "quickPrinting",
+                       NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_QUICK_PRINT);
+    netsnmp_ds_register_premib(ASN_BOOLEAN, "snmp", "numericTimeticks",
+                       NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_NUMERIC_TIMETICKS);
+    netsnmp_ds_register_premib(ASN_INTEGER, "snmp", "oidOutputFormat",
+                       NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_OID_OUTPUT_FORMAT);
+    netsnmp_ds_register_premib(ASN_INTEGER, "snmp", "suffixPrinting",
+                       NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_OID_OUTPUT_FORMAT);
+    netsnmp_ds_register_premib(ASN_BOOLEAN, "snmp", "extendedIndex",
+                       NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_EXTENDED_INDEX);
+    netsnmp_ds_register_premib(ASN_BOOLEAN, "snmp", "printHexText",
+                       NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_PRINT_HEX_TEXT);
+    netsnmp_ds_register_premib(ASN_BOOLEAN, "snmp", "printValueOnly",
+                       NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_PRINT_BARE_VALUE);
+    netsnmp_ds_register_premib(ASN_BOOLEAN, "snmp", "dontPrintUnits",
+                       NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_DONT_PRINT_UNITS);
+
+}
+
+/*
+ * function : netsnmp_set_mib_directory
+ *            - This function sets the string of the directories
+ *              from which the MIB modules will be searched or
+ *              loaded.
+ * arguments: const char *dir, which are the directories
+ *              from which the MIB modules will be searched or
+ *              loaded.
+ * returns  : -
+ */
+void
+netsnmp_set_mib_directory(const char *dir)
+{
+    const char *newdir;
+    char *olddir, *tmpdir = NULL;
+
+    DEBUGTRACE;
+    if (NULL == dir) {
+        return;
+    }
+    
+    olddir = netsnmp_ds_get_string(NETSNMP_DS_LIBRARY_ID,
+				   NETSNMP_DS_LIB_MIBDIRS);
+    if (olddir) {
+        if (*dir == '+') {
+            /** New dir starts with '+', thus we add it. */
+            tmpdir = malloc(strlen(dir) + strlen(olddir) + 1);
+            if (!tmpdir) {
+                DEBUGMSGTL(("read_config:initmib", "set mibdir malloc failed"));
+                return;
+            }
+            sprintf(tmpdir, "%s%c%s", ++dir, ENV_SEPARATOR_CHAR, olddir);
+            newdir = tmpdir;
+        } else {
+            newdir = dir;
+        }
+    } else {
+        /** If dir starts with '+' skip '+' it. */
+        newdir = ((*dir == '+') ? ++dir : dir);
+    }
+    netsnmp_ds_set_string(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_MIBDIRS,
+                          newdir);
+
+    /** set_string calls strdup, so if we allocated memory, free it */
+    if (tmpdir == newdir) {
+        free(tmpdir);
+    }
+}
+
+/*
+ * function : netsnmp_get_mib_directory
+ *            - This function returns a string of the directories
+ *              from which the MIB modules will be searched or
+ *              loaded.
+ *              If the value still does not exists, it will be made
+ *              from the evironment variable 'MIBDIRS' and/or the
+ *              default.
+ * arguments: -
+ * returns  : char * of the directories in which the MIB modules
+ *            will be searched/loaded.
+ */
+
+char *
+netsnmp_get_mib_directory(void)
+{
+    char *dir;
+
+    DEBUGTRACE;
+    dir = netsnmp_ds_get_string(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_MIBDIRS);
+    if (dir == NULL) {
+        DEBUGMSGTL(("get_mib_directory", "no mib directories set\n"));
+
+        /** Check if the environment variable is set */
+        dir = getenv("MIBDIRS");
+        if (dir == NULL) {
+            DEBUGMSGTL(("get_mib_directory", "no mib directories set by environment\n"));
+            /** Not set use hard coded path */
+            if (confmibdir == NULL) {
+                DEBUGMSGTL(("get_mib_directory", "no mib directories set by config\n"));
+                netsnmp_set_mib_directory(DEFAULT_MIBDIRS);
+            }
+            else if (*confmibdir == '+') {
+                DEBUGMSGTL(("get_mib_directory", "mib directories set by config (but added)\n"));
+                netsnmp_set_mib_directory(DEFAULT_MIBDIRS);
+                netsnmp_set_mib_directory(confmibdir);
+            }
+            else {
+                DEBUGMSGTL(("get_mib_directory", "mib directories set by config\n"));
+                netsnmp_set_mib_directory(confmibdir);
+            }
+        } else if (*dir == '+') {
+            DEBUGMSGTL(("get_mib_directory", "mib directories set by environment (but added)\n"));
+            netsnmp_set_mib_directory(DEFAULT_MIBDIRS);
+            netsnmp_set_mib_directory(dir);
+        } else {
+            DEBUGMSGTL(("get_mib_directory", "mib directories set by environment\n"));
+            netsnmp_set_mib_directory(dir);
+        }
+        dir = netsnmp_ds_get_string(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_MIBDIRS);
+    }
+    DEBUGMSGTL(("get_mib_directory", "mib directories set '%s'\n", dir));
+    return(dir);
+}
+
+/*
+ * function : netsnmp_fixup_mib_directory
+ * arguments: -
+ * returns  : -
+ */
+void
+netsnmp_fixup_mib_directory(void)
+{
+    char *homepath = getenv("HOME");
+    char *mibpath = netsnmp_get_mib_directory();
+    char *oldmibpath = NULL;
+    char *ptr_home;
+    char *new_mibpath;
+
+    DEBUGTRACE;
+    if (homepath && mibpath) {
+        DEBUGMSGTL(("fixup_mib_directory", "mib directories '%s'\n", mibpath));
+        while ((ptr_home = strstr(mibpath, "$HOME"))) {
+            new_mibpath = (char *)malloc(strlen(mibpath) - strlen("$HOME") +
+					 strlen(homepath)+1);
+            if (new_mibpath) {
+                *ptr_home = 0; /* null out the spot where we stop copying */
+                sprintf(new_mibpath, "%s%s%s", mibpath, homepath,
+			ptr_home + strlen("$HOME"));
+                /** swap in the new value and repeat */
+                mibpath = new_mibpath;
+		if (oldmibpath != NULL) {
+		    free(oldmibpath);
+		}
+		oldmibpath = new_mibpath;
+            } else {
+                break;
+            }
+        }
+
+        netsnmp_set_mib_directory(mibpath);
+	
+	/*  The above copies the mibpath for us, so...  */
+
+	if (oldmibpath != NULL) {
+	    free(oldmibpath);
+	}
+    }
+
+}
+
+/**
+ * Initialises the mib reader.
+ *
+ * Reads in all settings from the environment.
+ */
+void
+init_mib(void)
+{
+    const char     *prefix;
+    char           *env_var, *entry;
+    PrefixListPtr   pp = &mib_prefixes[0];
+
+    if (Mib)
+        return;
+    init_mib_internals();
+
+    /*
+     * Initialise the MIB directory/ies 
+     */
+    netsnmp_fixup_mib_directory();
+    env_var = strdup(netsnmp_get_mib_directory());
+
+    DEBUGMSGTL(("init_mib",
+                "Seen MIBDIRS: Looking in '%s' for mib dirs ...\n",
+                env_var));
+
+    entry = strtok(env_var, ENV_SEPARATOR);
+    while (entry) {
+        add_mibdir(entry);
+        entry = strtok(NULL, ENV_SEPARATOR);
+    }
+    free(env_var);
+
+    init_mib_internals();
+
+    /*
+     * Read in any modules or mibs requested 
+     */
+
+    env_var = getenv("MIBS");
+    if (env_var == NULL) {
+        if (confmibs != NULL)
+            env_var = strdup(confmibs);
+        else
+            env_var = strdup(DEFAULT_MIBS);
+    } else {
+        env_var = strdup(env_var);
+    }
+    if (env_var && *env_var == '+') {
+        entry =
+            (char *) malloc(strlen(DEFAULT_MIBS) + strlen(env_var) + 2);
+        if (!entry) {
+            DEBUGMSGTL(("init_mib", "env mibs malloc failed"));
+            return;
+        } else
+            sprintf(entry, "%s%c%s", DEFAULT_MIBS, ENV_SEPARATOR_CHAR,
+                env_var + 1);
+        free(env_var);
+        env_var = entry;
+    }
+
+    DEBUGMSGTL(("init_mib",
+                "Seen MIBS: Looking in '%s' for mib files ...\n",
+                env_var));
+    entry = strtok(env_var, ENV_SEPARATOR);
+    while (entry) {
+        if (strcasecmp(entry, DEBUG_ALWAYS_TOKEN) == 0) {
+            read_all_mibs();
+        } else if (strstr(entry, "/") != 0) {
+            read_mib(entry);
+        } else {
+            read_module(entry);
+        }
+        entry = strtok(NULL, ENV_SEPARATOR);
+    }
+    adopt_orphans();
+    free(env_var);
+
+    env_var = getenv("MIBFILES");
+    if (env_var != NULL) {
+        if (*env_var == '+') {
+#ifdef DEFAULT_MIBFILES
+            entry =
+                (char *) malloc(strlen(DEFAULT_MIBFILES) +
+                                strlen(env_var) + 2);
+            if (!entry) {
+                DEBUGMSGTL(("init_mib", "env mibfiles malloc failed"));
+            } else
+                sprintf(entry, "%s%c%s", DEFAULT_MIBFILES, ENV_SEPARATOR_CHAR,
+                    env_var + 1);
+            free(env_var);
+            env_var = entry;
+#else
+            env_var = strdup(env_var + 1);
+#endif
+        } else {
+            env_var = strdup(env_var);
+        }
+    } else {
+#ifdef DEFAULT_MIBFILES
+        env_var = strdup(DEFAULT_MIBFILES);
+#endif
+    }
+
+    if (env_var != 0) {
+        DEBUGMSGTL(("init_mib",
+                    "Seen MIBFILES: Looking in '%s' for mib files ...\n",
+                    env_var));
+        entry = strtok(env_var, ENV_SEPARATOR);
+        while (entry) {
+            read_mib(entry);
+            entry = strtok(NULL, ENV_SEPARATOR);
+        }
+        free(env_var);
+    }
+
+    prefix = getenv("PREFIX");
+
+    if (!prefix)
+        prefix = Standard_Prefix;
+
+    Prefix = (char *) malloc(strlen(prefix) + 2);
+    if (!Prefix)
+        DEBUGMSGTL(("init_mib", "Prefix malloc failed"));
+    else
+        strcpy(Prefix, prefix);
+
+    DEBUGMSGTL(("init_mib",
+                "Seen PREFIX: Looking in '%s' for prefix ...\n", Prefix));
+
+    /*
+     * remove trailing dot 
+     */
+    if (Prefix) {
+        env_var = &Prefix[strlen(Prefix) - 1];
+        if (*env_var == '.')
+            *env_var = '\0';
+    }
+
+    pp->str = Prefix;           /* fixup first mib_prefix entry */
+    /*
+     * now that the list of prefixes is built, save each string length. 
+     */
+    while (pp->str) {
+        pp->len = strlen(pp->str);
+        pp++;
+    }
+
+    Mib = tree_head;            /* Backwards compatibility */
+    tree_top = (struct tree *) calloc(1, sizeof(struct tree));
+    /*
+     * XX error check ? 
+     */
+    if (tree_top) {
+        tree_top->label = strdup("(top)");
+        tree_top->child_list = tree_head;
+    }
+}
+
+/**
+ * Unloads all mibs.
+ */
+void
+shutdown_mib(void)
+{
+    unload_all_mibs();
+    if (tree_top) {
+        if (tree_top->label)
+            free(tree_top->label);
+        free(tree_top);
+        tree_top = NULL;
+    }
+    tree_head = NULL;
+    Mib = NULL;
+    if (Prefix != NULL && Prefix != &Standard_Prefix[0])
+        free(Prefix);
+    if (Prefix)
+        Prefix = NULL;
+}
+
+/**
+ * Prints the MIBs to the file fp.
+ *
+ * @param fp   The file descriptor to print to.
+ */
+void
+print_mib(FILE * fp)
+{
+    print_subtree(fp, tree_head, 0);
+}
+
+void
+print_ascii_dump(FILE * fp)
+{
+    fprintf(fp, "dump DEFINITIONS ::= BEGIN\n");
+    print_ascii_dump_tree(fp, tree_head, 0);
+    fprintf(fp, "END\n");
+}
+
+
+/**
+ * Set's the printing function printomat in a subtree according
+ * it's type
+ *
+ * @param subtree    The subtree to set.
+ */
+void
+set_function(struct tree *subtree)
+{
+    subtree->printer = NULL;
+    switch (subtree->type) {
+    case TYPE_OBJID:
+        subtree->printomat = sprint_realloc_object_identifier;
+        break;
+    case TYPE_OCTETSTR:
+        subtree->printomat = sprint_realloc_octet_string;
+        break;
+    case TYPE_INTEGER:
+        subtree->printomat = sprint_realloc_integer;
+        break;
+    case TYPE_INTEGER32:
+        subtree->printomat = sprint_realloc_integer;
+        break;
+    case TYPE_NETADDR:
+        subtree->printomat = sprint_realloc_networkaddress;
+        break;
+    case TYPE_IPADDR:
+        subtree->printomat = sprint_realloc_ipaddress;
+        break;
+    case TYPE_COUNTER:
+        subtree->printomat = sprint_realloc_counter;
+        break;
+    case TYPE_GAUGE:
+        subtree->printomat = sprint_realloc_gauge;
+        break;
+    case TYPE_TIMETICKS:
+        subtree->printomat = sprint_realloc_timeticks;
+        break;
+    case TYPE_OPAQUE:
+        subtree->printomat = sprint_realloc_opaque;
+        break;
+    case TYPE_NULL:
+        subtree->printomat = sprint_realloc_null;
+        break;
+    case TYPE_BITSTRING:
+        subtree->printomat = sprint_realloc_bitstring;
+        break;
+    case TYPE_NSAPADDRESS:
+        subtree->printomat = sprint_realloc_nsapaddress;
+        break;
+    case TYPE_COUNTER64:
+        subtree->printomat = sprint_realloc_counter64;
+        break;
+    case TYPE_UINTEGER:
+        subtree->printomat = sprint_realloc_uinteger;
+        break;
+    case TYPE_UNSIGNED32:
+        subtree->printomat = sprint_realloc_gauge;
+        break;
+    case TYPE_OTHER:
+    default:
+        subtree->printomat = sprint_realloc_by_type;
+        break;
+    }
+}
+
+/**
+ * Reads an object identifier from an input string into internal OID form.
+ * 
+ * When called, out_len must hold the maximum length of the output array.
+ *
+ * @param input     the input string.
+ * @param output    the oid wirte.
+ * @param out_len   number of subid's in output.
+ * 
+ * @return 1 if successful.
+ * 
+ * If an error occurs, this function returns 0 and MAY set snmp_errno.
+ * snmp_errno is NOT set if SET_SNMP_ERROR evaluates to nothing.
+ * This can make multi-threaded use a tiny bit more robust.
+ */
+int
+read_objid(const char *input, oid * output, size_t * out_len)
+{                               /* number of subid's in "output" */
+    struct tree    *root = tree_top;
+    char            buf[SPRINT_MAX_LEN];
+    int             ret, max_out_len;
+    char           *name, ch;
+    const char     *cp;
+
+    cp = input;
+    while ((ch = *cp))
+        if (('0' <= ch && ch <= '9')
+            || ('a' <= ch && ch <= 'z')
+            || ('A' <= ch && ch <= 'Z')
+            || ch == '-')
+            cp++;
+        else
+            break;
+    if (ch == ':')
+        return get_node(input, output, out_len);
+
+    if (*input == '.')
+        input++;
+    else if (netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_READ_UCD_STYLE_OID)) {
+        /*
+         * get past leading '.', append '.' to Prefix. 
+         */
+        if (*Prefix == '.')
+            strncpy(buf, Prefix + 1, sizeof(buf)-1);
+        else
+            strncpy(buf, Prefix, sizeof(buf)-1);
+        buf[ sizeof(buf)-1 ] = 0;
+        strcat(buf, ".");
+        buf[ sizeof(buf)-1 ] = 0;
+        strncat(buf, input, sizeof(buf)-strlen(buf));
+        buf[ sizeof(buf)-1 ] = 0;
+        input = buf;
+    }
+
+    if (root == NULL) {
+        SET_SNMP_ERROR(SNMPERR_NOMIB);
+        *out_len = 0;
+        return 0;
+    }
+    name = strdup(input);
+    max_out_len = *out_len;
+    *out_len = 0;
+    if ((ret =
+         _add_strings_to_oid(root, name, output, out_len,
+                             max_out_len)) <= 0) {
+        if (ret == 0)
+            ret = SNMPERR_UNKNOWN_OBJID;
+        SET_SNMP_ERROR(ret);
+        free(name);
+        return 0;
+    }
+    free(name);
+
+    return 1;
+}
+
+/**
+ * 
+ */
+struct tree    *
+netsnmp_sprint_realloc_objid_tree(u_char ** buf, size_t * buf_len,
+                                  size_t * out_len, int allow_realloc,
+                                  int *buf_overflow,
+                                  const oid * objid, size_t objidlen)
+{
+    u_char         *tbuf = NULL, *cp = NULL;
+    size_t          tbuf_len = 256, tout_len = 0;
+    struct tree    *subtree = tree_head;
+    size_t          midpoint_offset = 0;
+    int             tbuf_overflow = 0;
+    int             output_format;
+
+    if ((tbuf = (u_char *) calloc(tbuf_len, 1)) == NULL) {
+        tbuf_overflow = 1;
+    } else {
+        *tbuf = '.';
+        tout_len = 1;
+    }
+
+    subtree = _get_realloc_symbol(objid, objidlen, subtree,
+                                  &tbuf, &tbuf_len, &tout_len,
+                                  allow_realloc, &tbuf_overflow, NULL,
+                                  &midpoint_offset);
+
+    if (tbuf_overflow) {
+        if (!*buf_overflow) {
+            snmp_strcat(buf, buf_len, out_len, allow_realloc, tbuf);
+            *buf_overflow = 1;
+        }
+        free(tbuf);
+        return subtree;
+    }
+
+    output_format = netsnmp_ds_get_int(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_OID_OUTPUT_FORMAT);
+    if (0 == output_format) {
+        output_format = NETSNMP_OID_OUTPUT_MODULE;
+    }
+    switch (output_format) {
+    case NETSNMP_OID_OUTPUT_FULL:
+    case NETSNMP_OID_OUTPUT_NUMERIC:
+        cp = tbuf;
+        break;
+
+    case NETSNMP_OID_OUTPUT_SUFFIX:
+    case NETSNMP_OID_OUTPUT_MODULE:
+        for (cp = tbuf; *cp; cp++);
+
+        if (midpoint_offset != 0) {
+            cp = tbuf + midpoint_offset - 2;    /*  beyond the '.'  */
+        } else {
+            while (cp >= tbuf) {
+                if (isalpha(*cp)) {
+                    break;
+                }
+                cp--;
+            }
+        }
+
+        while (cp >= tbuf) {
+            if (*cp == '.') {
+                break;
+            }
+            cp--;
+        }
+
+        cp++;
+
+        if ((NETSNMP_OID_OUTPUT_MODULE == output_format)
+            && cp > tbuf) {
+            char            modbuf[256] = { 0 }, *mod =
+                module_name(subtree->modid, modbuf);
+
+            /*
+             * Don't add the module ID if it's just numeric (i.e. we couldn't look
+             * it up properly.  
+             */
+
+            if (!*buf_overflow && modbuf[0] != '#') {
+                if (!snmp_strcat
+                    (buf, buf_len, out_len, allow_realloc,
+                     (const u_char *) mod)
+                    || !snmp_strcat(buf, buf_len, out_len, allow_realloc,
+                                    (const u_char *) "::")) {
+                    *buf_overflow = 1;
+                }
+            }
+        }
+        break;
+
+    case NETSNMP_OID_OUTPUT_UCD:
+    {
+        PrefixListPtr   pp = &mib_prefixes[0];
+        size_t          ilen, tlen;
+        const char     *testcp;
+
+        cp = tbuf;
+        tlen = strlen((char *) tbuf);
+
+        while (pp->str) {
+            ilen = pp->len;
+            testcp = pp->str;
+
+            if ((tlen > ilen) && memcmp(tbuf, testcp, ilen) == 0) {
+                cp += (ilen + 1);
+                break;
+            }
+            pp++;
+        }
+        break;
+    }
+
+    case NETSNMP_OID_OUTPUT_NONE:
+    default:
+        cp = NULL;
+    }
+
+    if (!*buf_overflow &&
+        !snmp_strcat(buf, buf_len, out_len, allow_realloc, cp)) {
+        *buf_overflow = 1;
+    }
+    free(tbuf);
+    return subtree;
+}
+
+int
+sprint_realloc_objid(u_char ** buf, size_t * buf_len,
+                     size_t * out_len, int allow_realloc,
+                     const oid * objid, size_t objidlen)
+{
+    int             buf_overflow = 0;
+
+    netsnmp_sprint_realloc_objid_tree(buf, buf_len, out_len, allow_realloc,
+                                      &buf_overflow, objid, objidlen);
+    return !buf_overflow;
+}
+
+int
+snprint_objid(char *buf, size_t buf_len,
+              const oid * objid, size_t objidlen)
+{
+    size_t          out_len = 0;
+
+    if (sprint_realloc_objid((u_char **) & buf, &buf_len, &out_len, 0,
+                             objid, objidlen)) {
+        return (int) out_len;
+    } else {
+        return -1;
+    }
+}
+
+/**
+ * Prints an oid to stdout.
+ *
+ * @param objid      The oid to print
+ * @param objidlen   The length of oidid.
+ */
+void
+print_objid(const oid * objid, size_t objidlen)
+{                               /* number of subidentifiers */
+    fprint_objid(stdout, objid, objidlen);
+}
+
+
+/**
+ * Prints an oid to a file descriptor.
+ *
+ * @param f          The file descriptor to print to.
+ * @param objid      The oid to print
+ * @param objidlen   The length of oidid.
+ */
+void
+fprint_objid(FILE * f, const oid * objid, size_t objidlen)
+{                               /* number of subidentifiers */
+    u_char         *buf = NULL;
+    size_t          buf_len = 256, out_len = 0;
+    int             buf_overflow = 0;
+
+    if ((buf = (u_char *) calloc(buf_len, 1)) == NULL) {
+        fprintf(f, "[TRUNCATED]\n");
+        return;
+    } else {
+        netsnmp_sprint_realloc_objid_tree(&buf, &buf_len, &out_len, 1,
+                                          &buf_overflow, objid, objidlen);
+        if (buf_overflow) {
+            fprintf(f, "%s [TRUNCATED]\n", buf);
+        } else {
+            fprintf(f, "%s\n", buf);
+        }
+    }
+
+    free(buf);
+}
+
+int
+sprint_realloc_variable(u_char ** buf, size_t * buf_len,
+                        size_t * out_len, int allow_realloc,
+                        const oid * objid, size_t objidlen,
+                        const netsnmp_variable_list * variable)
+{
+    struct tree    *subtree = tree_head;
+    int             buf_overflow = 0;
+
+    subtree =
+        netsnmp_sprint_realloc_objid_tree(buf, buf_len, out_len,
+                                          allow_realloc, &buf_overflow,
+                                          objid, objidlen);
+
+    if (buf_overflow) {
+        return 0;
+    }
+    if (!netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_PRINT_BARE_VALUE)) {
+        if (netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_QUICKE_PRINT)) {
+            if (!snmp_strcat
+                (buf, buf_len, out_len, allow_realloc,
+                 (const u_char *) " = ")) {
+                return 0;
+            }
+        } else {
+            if (netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_QUICK_PRINT)) {
+                if (!snmp_strcat
+                    (buf, buf_len, out_len, allow_realloc,
+                     (const u_char *) " ")) {
+                    return 0;
+                }
+            } else {
+                if (!snmp_strcat
+                    (buf, buf_len, out_len, allow_realloc,
+                     (const u_char *) " = ")) {
+                    return 0;
+                }
+            }                   /* end if-else NETSNMP_DS_LIB_QUICK_PRINT */
+        }                       /* end if-else NETSNMP_DS_LIB_QUICKE_PRINT */
+    } else {
+        *out_len = 0;
+    }
+
+    if (variable->type == SNMP_NOSUCHOBJECT) {
+        return snmp_strcat(buf, buf_len, out_len, allow_realloc,
+                           (const u_char *)
+                           "No Such Object available on this agent at this OID");
+    } else if (variable->type == SNMP_NOSUCHINSTANCE) {
+        return snmp_strcat(buf, buf_len, out_len, allow_realloc,
+                           (const u_char *)
+                           "No Such Instance currently exists at this OID");
+    } else if (variable->type == SNMP_ENDOFMIBVIEW) {
+        return snmp_strcat(buf, buf_len, out_len, allow_realloc,
+                           (const u_char *)
+                           "No more variables left in this MIB View (It is past the end of the MIB tree)");
+    } else if (subtree) {
+        const char *units = NULL;
+        if (!netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID,
+                                    NETSNMP_DS_LIB_DONT_PRINT_UNITS)) {
+            units = subtree->units;
+        }
+        if (subtree->printomat) {
+            return (*subtree->printomat) (buf, buf_len, out_len,
+                                          allow_realloc, variable,
+                                          subtree->enums, subtree->hint,
+                                          units);
+        } else {
+            return sprint_realloc_by_type(buf, buf_len, out_len,
+                                          allow_realloc, variable,
+                                          subtree->enums, subtree->hint,
+                                          units);
+        }
+    } else {
+        /*
+         * Handle rare case where tree is empty.  
+         */
+        return sprint_realloc_by_type(buf, buf_len, out_len, allow_realloc,
+                                      variable, 0, 0, 0);
+    }
+}
+
+int
+snprint_variable(char *buf, size_t buf_len,
+                 const oid * objid, size_t objidlen,
+                 const netsnmp_variable_list * variable)
+{
+    size_t          out_len = 0;
+
+    if (sprint_realloc_variable((u_char **) & buf, &buf_len, &out_len, 0,
+                                objid, objidlen, variable)) {
+        return (int) out_len;
+    } else {
+        return -1;
+    }
+}
+
+/**
+ * Prints a variable to stdout.
+ *
+ * @param objid     The object id.
+ * @param objidlen  The length of teh object id.
+ * @param variable  The variable to print.
+ */
+void
+print_variable(const oid * objid,
+               size_t objidlen, const netsnmp_variable_list * variable)
+{
+    fprint_variable(stdout, objid, objidlen, variable);
+}
+
+
+/**
+ * Prints a variable to a file descriptor.
+ *
+ * @param f         The file descriptor to print to.
+ * @param objid     The object id.
+ * @param objidlen  The length of teh object id.
+ * @param variable  The variable to print.
+ */
+void
+fprint_variable(FILE * f,
+                const oid * objid,
+                size_t objidlen, const netsnmp_variable_list * variable)
+{
+    u_char         *buf = NULL;
+    size_t          buf_len = 256, out_len = 0;
+
+    if ((buf = (u_char *) calloc(buf_len, 1)) == NULL) {
+        fprintf(f, "[TRUNCATED]\n");
+        return;
+    } else {
+        if (sprint_realloc_variable(&buf, &buf_len, &out_len, 1,
+                                    objid, objidlen, variable)) {
+            fprintf(f, "%s\n", buf);
+        } else {
+            fprintf(f, "%s [TRUNCATED]\n", buf);
+        }
+    }
+
+    free(buf);
+}
+
+int
+sprint_realloc_value(u_char ** buf, size_t * buf_len,
+                     size_t * out_len, int allow_realloc,
+                     const oid * objid, size_t objidlen,
+                     const netsnmp_variable_list * variable)
+{
+    struct tree    *subtree = tree_head;
+
+    if (variable->type == SNMP_NOSUCHOBJECT) {
+        return snmp_strcat(buf, buf_len, out_len, allow_realloc,
+                           (const u_char *)
+                           "No Such Object available on this agent at this OID");
+    } else if (variable->type == SNMP_NOSUCHINSTANCE) {
+        return snmp_strcat(buf, buf_len, out_len, allow_realloc,
+                           (const u_char *)
+                           "No Such Instance currently exists at this OID");
+    } else if (variable->type == SNMP_ENDOFMIBVIEW) {
+        return snmp_strcat(buf, buf_len, out_len, allow_realloc,
+                           (const u_char *)
+                           "No more variables left in this MIB View (It is past the end of the MIB tree)");
+    } else {
+        const char *units = NULL;
+        subtree = get_tree(objid, objidlen, subtree);
+        if (subtree && !netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID,
+                                            NETSNMP_DS_LIB_DONT_PRINT_UNITS)) {
+            units = subtree->units;
+        }
+        if (subtree && subtree->printomat) {
+            return (*subtree->printomat) (buf, buf_len, out_len,
+                                          allow_realloc, variable,
+                                          subtree->enums, subtree->hint,
+                                          units);
+        } else {
+            return sprint_realloc_by_type(buf, buf_len, out_len,
+                                          allow_realloc, variable,
+                                          subtree->enums, subtree->hint,
+                                          units);
+        }
+    }
+}
+
+int
+snprint_value(char *buf, size_t buf_len,
+              const oid * objid, size_t objidlen,
+              const netsnmp_variable_list * variable)
+{
+    size_t          out_len = 0;
+
+    if (sprint_realloc_value((u_char **) & buf, &buf_len, &out_len, 0,
+                             objid, objidlen, variable)) {
+        return (int) out_len;
+    } else {
+        return -1;
+    }
+}
+
+void
+print_value(const oid * objid,
+            size_t objidlen, const netsnmp_variable_list * variable)
+{
+    fprint_value(stdout, objid, objidlen, variable);
+}
+
+void
+fprint_value(FILE * f,
+             const oid * objid,
+             size_t objidlen, const netsnmp_variable_list * variable)
+{
+    u_char         *buf = NULL;
+    size_t          buf_len = 256, out_len = 0;
+
+    if ((buf = (u_char *) calloc(buf_len, 1)) == NULL) {
+        fprintf(f, "[TRUNCATED]\n");
+        return;
+    } else {
+        if (sprint_realloc_value(&buf, &buf_len, &out_len, 1,
+                                 objid, objidlen, variable)) {
+            fprintf(f, "%s\n", buf);
+        } else {
+            fprintf(f, "%s [TRUNCATED]\n", buf);
+        }
+    }
+
+    free(buf);
+}
+
+
+/**
+ * Takes the value in VAR and turns it into an OID segment in var->name.
+ *  
+ * @param var    The variable.
+ *
+ * @return SNMPERR_SUCCESS or SNMPERR_GENERR 
+ */
+int
+build_oid_segment(netsnmp_variable_list * var)
+{
+    int             i;
+
+    if (var->name && var->name != var->name_loc)
+        SNMP_FREE(var->name);
+    switch (var->type) {
+    case ASN_INTEGER:
+    case ASN_COUNTER:
+    case ASN_GAUGE:
+    case ASN_TIMETICKS:
+        var->name_length = 1;
+        var->name = var->name_loc;
+        var->name[0] = *(var->val.integer);
+        break;
+
+    case ASN_IPADDRESS:
+        var->name_length = 4;
+        var->name = var->name_loc;
+        var->name[0] =
+            (((unsigned int) *(var->val.integer)) & 0xff000000) >> 24;
+        var->name[1] =
+            (((unsigned int) *(var->val.integer)) & 0x00ff0000) >> 16;
+        var->name[2] =
+            (((unsigned int) *(var->val.integer)) & 0x0000ff00) >> 8;
+        var->name[3] =
+            (((unsigned int) *(var->val.integer)) & 0x000000ff);
+        break;
+        
+    case ASN_PRIV_IMPLIED_OBJECT_ID:
+        var->name_length = var->val_len / sizeof(oid);
+        if (var->name_length > (sizeof(var->name_loc) / sizeof(oid)))
+            var->name = (oid *) malloc(sizeof(oid) * (var->name_length));
+        else
+            var->name = var->name_loc;
+        if (var->name == NULL)
+            return SNMPERR_GENERR;
+
+        for (i = 0; i < (int) var->name_length; i++)
+            var->name[i] = var->val.objid[i];
+        break;
+
+    case ASN_OBJECT_ID:
+        var->name_length = var->val_len / sizeof(oid) + 1;
+        if (var->name_length > (sizeof(var->name_loc) / sizeof(oid)))
+            var->name = (oid *) malloc(sizeof(oid) * (var->name_length));
+        else
+            var->name = var->name_loc;
+        if (var->name == NULL)
+            return SNMPERR_GENERR;
+
+        var->name[0] = var->name_length - 1;
+        for (i = 0; i < (int) var->name_length - 1; i++)
+            var->name[i + 1] = var->val.objid[i];
+        break;
+
+    case ASN_PRIV_IMPLIED_OCTET_STR:
+        var->name_length = var->val_len;
+        if (var->name_length > (sizeof(var->name_loc) / sizeof(oid)))
+            var->name = (oid *) malloc(sizeof(oid) * (var->name_length));
+        else
+            var->name = var->name_loc;
+        if (var->name == NULL)
+            return SNMPERR_GENERR;
+
+        for (i = 0; i < (int) var->val_len; i++)
+            var->name[i] = (oid) var->val.string[i];
+        break;
+
+    case ASN_OPAQUE:
+    case ASN_OCTET_STR:
+        var->name_length = var->val_len + 1;
+        if (var->name_length > (sizeof(var->name_loc) / sizeof(oid)))
+            var->name = (oid *) malloc(sizeof(oid) * (var->name_length));
+        else
+            var->name = var->name_loc;
+        if (var->name == NULL)
+            return SNMPERR_GENERR;
+
+        var->name[0] = (oid) var->val_len;
+        for (i = 0; i < (int) var->val_len; i++)
+            var->name[i + 1] = (oid) var->val.string[i];
+        break;
+
+    default:
+        DEBUGMSGTL(("build_oid_segment",
+                    "invalid asn type: %d\n", var->type));
+        return SNMPERR_GENERR;
+    }
+
+    if (var->name_length > MAX_OID_LEN) {
+        DEBUGMSGTL(("build_oid_segment",
+                    "Something terribly wrong, namelen = %d\n",
+                    var->name_length));
+        return SNMPERR_GENERR;
+    }
+
+    return SNMPERR_SUCCESS;
+}
+
+
+int
+build_oid_noalloc(oid * in, size_t in_len, size_t * out_len,
+                  oid * prefix, size_t prefix_len,
+                  netsnmp_variable_list * indexes)
+{
+    netsnmp_variable_list *var;
+
+    if (prefix) {
+        if (in_len < prefix_len)
+            return SNMPERR_GENERR;
+        memcpy(in, prefix, prefix_len * sizeof(oid));
+        *out_len = prefix_len;
+    } else {
+        *out_len = 0;
+    }
+
+    for (var = indexes; var != NULL; var = var->next_variable) {
+        if (build_oid_segment(var) != SNMPERR_SUCCESS)
+            return SNMPERR_GENERR;
+        if (var->name_length + *out_len < in_len) {
+            memcpy(&(in[*out_len]), var->name,
+                   sizeof(oid) * var->name_length);
+            *out_len += var->name_length;
+        } else {
+            return SNMPERR_GENERR;
+        }
+    }
+
+    DEBUGMSGTL(("build_oid_noalloc", "generated: "));
+    DEBUGMSGOID(("build_oid_noalloc", in, *out_len));
+    DEBUGMSG(("build_oid_noalloc", "\n"));
+    return SNMPERR_SUCCESS;
+}
+
+int
+build_oid(oid ** out, size_t * out_len,
+          oid * prefix, size_t prefix_len, netsnmp_variable_list * indexes)
+{
+    oid             tmpout[MAX_OID_LEN];
+
+    if (build_oid_noalloc(tmpout, sizeof(tmpout), out_len,
+                          prefix, prefix_len, indexes) != SNMPERR_SUCCESS)
+        return SNMPERR_GENERR;
+
+    snmp_clone_mem((void **) out, (void *) tmpout, *out_len * sizeof(oid));
+
+    return SNMPERR_SUCCESS;
+}
+
+/*
+ * vblist_out must contain a pre-allocated string of variables into
+ * which indexes can be extracted based on the previously existing
+ * types in the variable chain
+ * returns:
+ * SNMPERR_GENERR  on error
+ * SNMPERR_SUCCESS on success
+ */
+
+int
+parse_oid_indexes(oid * oidIndex, size_t oidLen,
+                  netsnmp_variable_list * data)
+{
+    netsnmp_variable_list *var = data;
+
+    while (var && oidLen > 0) {
+
+        if (parse_one_oid_index(&oidIndex, &oidLen, var, 0) !=
+            SNMPERR_SUCCESS)
+            break;
+
+        var = var->next_variable;
+    }
+
+    if (var != NULL || oidLen != 0)
+        return SNMPERR_GENERR;
+    return SNMPERR_SUCCESS;
+}
+
+
+int
+parse_one_oid_index(oid ** oidStart, size_t * oidLen,
+                    netsnmp_variable_list * data, int complete)
+{
+    netsnmp_variable_list *var = data;
+    oid             tmpout[MAX_OID_LEN];
+    unsigned int    i;
+    unsigned int    uitmp = 0;
+
+    oid            *oidIndex = *oidStart;
+
+    if (var == NULL || ((*oidLen == 0) && (complete == 0)))
+        return SNMPERR_GENERR;
+    else {
+        switch (var->type) {
+        case ASN_INTEGER:
+        case ASN_COUNTER:
+        case ASN_GAUGE:
+        case ASN_TIMETICKS:
+            if (*oidLen) {
+                snmp_set_var_value(var, (u_char *) oidIndex++,
+                                   sizeof(long));
+                --(*oidLen);
+            } else {
+                snmp_set_var_value(var, (u_char *) oidLen, sizeof(long));
+            }
+            DEBUGMSGTL(("parse_oid_indexes",
+                        "Parsed int(%d): %d\n", var->type,
+                        *var->val.integer));
+            break;
+
+        case ASN_IPADDRESS:
+            if ((4 > *oidLen) && (complete == 0))
+                return SNMPERR_GENERR;
+            
+            for (i = 0; i < 4 && i < *oidLen; ++i) {
+                if (oidIndex[i] > 255) {
+                    DEBUGMSGTL(("parse_oid_indexes",
+                                "illegal oid in index: %d\n", oidIndex[0]));
+                        return SNMPERR_GENERR;  /* sub-identifier too large */
+                    }
+                    uitmp = uitmp + (oidIndex[i] << (8*(3-i)));
+                }
+            if (4 > (int) (*oidLen)) {
+                oidIndex += *oidLen;
+                (*oidLen) = 0;
+            } else {
+                oidIndex += 4;
+                (*oidLen) -= 4;
+            }
+            uitmp = 
+                snmp_set_var_value(var, (u_char *) &uitmp, 4);
+            DEBUGMSGTL(("parse_oid_indexes",
+                        "Parsed ipaddr(%d): %d.%d.%d.%d\n", var->type,
+                        var->val.string[0], var->val.string[1],
+                        var->val.string[2], var->val.string[3]));
+            break;
+
+        case ASN_OBJECT_ID:
+        case ASN_PRIV_IMPLIED_OBJECT_ID:
+            if (var->type == ASN_PRIV_IMPLIED_OBJECT_ID) {
+                uitmp = *oidLen;
+            } else {
+                if (*oidLen) {
+                    uitmp = *oidIndex++;
+                    --(*oidLen);
+                } else {
+                    uitmp = 0;
+                }
+                if ((uitmp > *oidLen) && (complete == 0))
+                    return SNMPERR_GENERR;
+            }
+
+            if (uitmp > MAX_OID_LEN)
+                return SNMPERR_GENERR;  /* too big and illegal */
+
+            if (uitmp > *oidLen) {
+                memcpy(tmpout, oidIndex, sizeof(oid) * (*oidLen));
+                memset(&tmpout[*oidLen], 0x00,
+                       sizeof(oid) * (uitmp - *oidLen));
+                snmp_set_var_value(var, (u_char *) tmpout,
+                                   sizeof(oid) * uitmp);
+                oidIndex += *oidLen;
+                (*oidLen) = 0;
+            } else {
+                snmp_set_var_value(var, (u_char *) oidIndex,
+                                   sizeof(oid) * uitmp);
+                oidIndex += uitmp;
+                (*oidLen) -= uitmp;
+            }
+
+            DEBUGMSGTL(("parse_oid_indexes", "Parsed oid: "));
+            DEBUGMSGOID(("parse_oid_indexes",
+                         var->val.objid, var->val_len / sizeof(oid)));
+            DEBUGMSG(("parse_oid_indexes", "\n"));
+            break;
+
+        case ASN_OPAQUE:
+        case ASN_OCTET_STR:
+        case ASN_PRIV_IMPLIED_OCTET_STR:
+            if (var->type == ASN_PRIV_IMPLIED_OCTET_STR) {
+                uitmp = *oidLen;
+            } else {
+                if (*oidLen) {
+                    uitmp = *oidIndex++;
+                    --(*oidLen);
+                } else {
+                    uitmp = 0;
+                }
+                if ((uitmp > *oidLen) && (complete == 0))
+                    return SNMPERR_GENERR;
+            }
+
+            /*
+             * we handle this one ourselves since we don't have
+             * pre-allocated memory to copy from using
+             * snmp_set_var_value() 
+             */
+
+            if (uitmp == 0)
+                break;          /* zero length strings shouldn't malloc */
+
+            if (uitmp > MAX_OID_LEN)
+                return SNMPERR_GENERR;  /* too big and illegal */
+
+            /*
+             * malloc by size+1 to allow a null to be appended. 
+             */
+            var->val_len = uitmp;
+            var->val.string = (u_char *) calloc(1, uitmp + 1);
+            if (var->val.string == NULL)
+                return SNMPERR_GENERR;
+
+            if (uitmp > (int) (*oidLen)) {
+                for (i = 0; i < *oidLen; ++i)
+                    var->val.string[i] = (u_char) * oidIndex++;
+                for (i = 0; i < uitmp; ++i)
+                    var->val.string[i] = '\0';
+                (*oidLen) = 0;
+            } else {
+                for (i = 0; i < uitmp; ++i)
+                    var->val.string[i] = (u_char) * oidIndex++;
+                (*oidLen) -= uitmp;
+            }
+            var->val.string[uitmp] = '\0';
+
+            DEBUGMSGTL(("parse_oid_indexes",
+                        "Parsed str(%d): %s\n", var->type,
+                        var->val.string));
+            break;
+
+        default:
+            DEBUGMSGTL(("parse_oid_indexes",
+                        "invalid asn type: %d\n", var->type));
+            return SNMPERR_GENERR;
+        }
+    }
+    (*oidStart) = oidIndex;
+    return SNMPERR_SUCCESS;
+}
+
+int
+dump_realloc_oid_to_string(const oid * objid, size_t objidlen,
+                           u_char ** buf, size_t * buf_len,
+                           size_t * out_len, int allow_realloc,
+                           char quotechar)
+{
+    if (buf) {
+        int             i, alen;
+
+        for (i = 0, alen = 0; i < (int) objidlen; i++) {
+            oid             tst = objid[i];
+            if ((tst > 254) || (!isprint(tst))) {
+                tst = (oid) '.';
+            }
+
+            if (alen == 0) {
+                if (netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_ESCAPE_QUOTES)) {
+                    while ((*out_len + 2) >= *buf_len) {
+                        if (!(allow_realloc && snmp_realloc(buf, buf_len))) {
+                            return 0;
+                        }
+                    }
+                    *(*buf + *out_len) = '\\';
+                    (*out_len)++;
+                }
+                while ((*out_len + 2) >= *buf_len) {
+                    if (!(allow_realloc && snmp_realloc(buf, buf_len))) {
+                        return 0;
+                    }
+                }
+                *(*buf + *out_len) = quotechar;
+                (*out_len)++;
+            }
+
+            while ((*out_len + 2) >= *buf_len) {
+                if (!(allow_realloc && snmp_realloc(buf, buf_len))) {
+                    return 0;
+                }
+            }
+            *(*buf + *out_len) = (char) tst;
+            (*out_len)++;
+            alen++;
+        }
+
+        if (alen) {
+            if (netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_ESCAPE_QUOTES)) {
+                while ((*out_len + 2) >= *buf_len) {
+                    if (!(allow_realloc && snmp_realloc(buf, buf_len))) {
+                        return 0;
+                    }
+                }
+                *(*buf + *out_len) = '\\';
+                (*out_len)++;
+            }
+            while ((*out_len + 2) >= *buf_len) {
+                if (!(allow_realloc && snmp_realloc(buf, buf_len))) {
+                    return 0;
+                }
+            }
+            *(*buf + *out_len) = quotechar;
+            (*out_len)++;
+        }
+
+        *(*buf + *out_len) = '\0';
+    }
+
+    return 1;
+}
+
+static struct tree *
+_get_realloc_symbol(const oid * objid, size_t objidlen,
+                    struct tree *subtree,
+                    u_char ** buf, size_t * buf_len, size_t * out_len,
+                    int allow_realloc, int *buf_overflow,
+                    struct index_list *in_dices, size_t * end_of_known)
+{
+    struct tree    *return_tree = NULL;
+    int             extended_index =
+        netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_EXTENDED_INDEX);
+    int             output_format =
+        netsnmp_ds_get_int(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_OID_OUTPUT_FORMAT);
+    char            intbuf[64];
+
+    if (!objid || !buf) {
+        return NULL;
+    }
+
+    for (; subtree; subtree = subtree->next_peer) {
+        if (*objid == subtree->subid) {
+	    while (subtree->next_peer && subtree->next_peer->subid == *objid)
+		subtree = subtree->next_peer;
+            if (subtree->indexes) {
+                in_dices = subtree->indexes;
+            } else if (subtree->augments) {
+                struct tree    *tp2 =
+                    find_tree_node(subtree->augments, -1);
+                if (tp2) {
+                    in_dices = tp2->indexes;
+                }
+            }
+
+            if (!strncmp(subtree->label, ANON, ANON_LEN) ||
+                (NETSNMP_OID_OUTPUT_NUMERIC == output_format)) {
+                sprintf(intbuf, "%lu", subtree->subid);
+                if (!*buf_overflow && !snmp_strcat(buf, buf_len, out_len,
+                                                   allow_realloc,
+                                                   (const u_char *)
+                                                   intbuf)) {
+                    *buf_overflow = 1;
+                }
+            } else {
+                if (!*buf_overflow && !snmp_strcat(buf, buf_len, out_len,
+                                                   allow_realloc,
+                                                   (const u_char *)
+                                                   subtree->label)) {
+                    *buf_overflow = 1;
+                }
+            }
+
+            if (objidlen > 1) {
+                if (!*buf_overflow && !snmp_strcat(buf, buf_len, out_len,
+                                                   allow_realloc,
+                                                   (const u_char *) ".")) {
+                    *buf_overflow = 1;
+                }
+
+                return_tree = _get_realloc_symbol(objid + 1, objidlen - 1,
+                                                  subtree->child_list,
+                                                  buf, buf_len, out_len,
+                                                  allow_realloc,
+                                                  buf_overflow, in_dices,
+                                                  end_of_known);
+            }
+
+            if (return_tree != NULL) {
+                return return_tree;
+            } else {
+                return subtree;
+            }
+        }
+    }
+
+
+    if (end_of_known) {
+        *end_of_known = *out_len;
+    }
+
+    /*
+     * Subtree not found.  
+     */
+
+    while (in_dices && (objidlen > 0) &&
+           (NETSNMP_OID_OUTPUT_NUMERIC != output_format) &&
+           !netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_DONT_BREAKDOWN_OIDS)) {
+        size_t          numids;
+        struct tree    *tp;
+
+        tp = find_tree_node(in_dices->ilabel, -1);
+
+        if (!tp) {
+            /*
+             * Can't find an index in the mib tree.  Bail.  
+             */
+            goto finish_it;
+        }
+
+        if (extended_index) {
+            if (*buf != NULL && *(*buf + *out_len - 1) == '.') {
+                (*out_len)--;
+            }
+            if (!*buf_overflow && !snmp_strcat(buf, buf_len, out_len,
+                                               allow_realloc,
+                                               (const u_char *) "[")) {
+                *buf_overflow = 1;
+            }
+        }
+
+        switch (tp->type) {
+        case TYPE_OCTETSTR:
+            if (extended_index && tp->hint) {
+                netsnmp_variable_list var;
+                u_char          buffer[1024];
+                int             i;
+
+                memset(&var, 0, sizeof var);
+                if (in_dices->isimplied) {
+                    numids = objidlen;
+                    if (numids > objidlen)
+                        goto finish_it;
+                } else if (tp->ranges && !tp->ranges->next
+                           && tp->ranges->low == tp->ranges->high) {
+                    numids = tp->ranges->low;
+                    if (numids > objidlen)
+                        goto finish_it;
+                } else {
+                    numids = *objid;
+                    if (numids >= objidlen)
+                        goto finish_it;
+                    objid++;
+                    objidlen--;
+                }
+                if (numids > objidlen)
+                    goto finish_it;
+                for (i = 0; i < (int) numids; i++)
+                    buffer[i] = (u_char) objid[i];
+                var.type = ASN_OCTET_STR;
+                var.val.string = buffer;
+                var.val_len = numids;
+                if (!*buf_overflow) {
+                    if (!sprint_realloc_octet_string(buf, buf_len, out_len,
+                                                     allow_realloc, &var,
+                                                     NULL, tp->hint,
+                                                     NULL)) {
+                        *buf_overflow = 1;
+                    }
+                }
+            } else if (in_dices->isimplied) {
+                numids = objidlen;
+                if (numids > objidlen)
+                    goto finish_it;
+
+                if (!*buf_overflow) {
+                    if (!dump_realloc_oid_to_string
+                        (objid, numids, buf, buf_len, out_len,
+                         allow_realloc, '\'')) {
+                        *buf_overflow = 1;
+                    }
+                }
+            } else if (tp->ranges && !tp->ranges->next
+                       && tp->ranges->low == tp->ranges->high) {
+                /*
+                 * a fixed-length object string 
+                 */
+                numids = tp->ranges->low;
+                if (numids > objidlen)
+                    goto finish_it;
+
+                if (!*buf_overflow) {
+                    if (!dump_realloc_oid_to_string
+                        (objid, numids, buf, buf_len, out_len,
+                         allow_realloc, '\'')) {
+                        *buf_overflow = 1;
+                    }
+                }
+            } else {
+                numids = (size_t) * objid + 1;
+                if (numids > objidlen)
+                    goto finish_it;
+                if (numids == 1) {
+                    if (netsnmp_ds_get_boolean
+                        (NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_ESCAPE_QUOTES)) {
+                        if (!*buf_overflow
+                            && !snmp_strcat(buf, buf_len, out_len,
+                                            allow_realloc,
+                                            (const u_char *) "\\")) {
+                            *buf_overflow = 1;
+                        }
+                    }
+                    if (!*buf_overflow
+                        && !snmp_strcat(buf, buf_len, out_len,
+                                        allow_realloc,
+                                        (const u_char *) "\"")) {
+                        *buf_overflow = 1;
+                    }
+                    if (netsnmp_ds_get_boolean
+                        (NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_ESCAPE_QUOTES)) {
+                        if (!*buf_overflow
+                            && !snmp_strcat(buf, buf_len, out_len,
+                                            allow_realloc,
+                                            (const u_char *) "\\")) {
+                            *buf_overflow = 1;
+                        }
+                    }
+                    if (!*buf_overflow
+                        && !snmp_strcat(buf, buf_len, out_len,
+                                        allow_realloc,
+                                        (const u_char *) "\"")) {
+                        *buf_overflow = 1;
+                    }
+                } else {
+                    if (!*buf_overflow) {
+                        if (!dump_realloc_oid_to_string
+                            (objid + 1, numids - 1, buf, buf_len, out_len,
+                             allow_realloc, '"')) {
+                            *buf_overflow = 1;
+                        }
+                    }
+                }
+            }
+            objid += numids;
+            objidlen -= numids;
+            break;
+
+        case TYPE_INTEGER32:
+        case TYPE_UINTEGER:
+        case TYPE_UNSIGNED32:
+        case TYPE_GAUGE:
+        case TYPE_INTEGER:
+            if (tp->enums) {
+                struct enum_list *ep = tp->enums;
+                while (ep && ep->value != (int) (*objid)) {
+                    ep = ep->next;
+                }
+                if (ep) {
+                    if (!*buf_overflow
+                        && !snmp_strcat(buf, buf_len, out_len,
+                                        allow_realloc,
+                                        (const u_char *) ep->label)) {
+                        *buf_overflow = 1;
+                    }
+                } else {
+                    sprintf(intbuf, "%lu", *objid);
+                    if (!*buf_overflow
+                        && !snmp_strcat(buf, buf_len, out_len,
+                                        allow_realloc,
+                                        (const u_char *) intbuf)) {
+                        *buf_overflow = 1;
+                    }
+                }
+            } else {
+                sprintf(intbuf, "%lu", *objid);
+                if (!*buf_overflow && !snmp_strcat(buf, buf_len, out_len,
+                                                   allow_realloc,
+                                                   (const u_char *)
+                                                   intbuf)) {
+                    *buf_overflow = 1;
+                }
+            }
+            objid++;
+            objidlen--;
+            break;
+
+        case TYPE_OBJID:
+            if (in_dices->isimplied) {
+                numids = objidlen;
+            } else {
+                numids = (size_t) * objid + 1;
+            }
+            if (numids > objidlen)
+                goto finish_it;
+            if (extended_index) {
+                if (in_dices->isimplied) {
+                    if (!*buf_overflow
+                        && !netsnmp_sprint_realloc_objid_tree(buf, buf_len,
+                                                              out_len,
+                                                              allow_realloc,
+                                                              buf_overflow,
+                                                              objid,
+                                                              numids)) {
+                        *buf_overflow = 1;
+                    }
+                } else {
+                    if (!*buf_overflow
+                        && !netsnmp_sprint_realloc_objid_tree(buf, buf_len,
+                                                              out_len,
+                                                              allow_realloc,
+                                                              buf_overflow,
+                                                              objid + 1,
+                                                              numids -
+                                                              1)) {
+                        *buf_overflow = 1;
+                    }
+                }
+            } else {
+                _get_realloc_symbol(objid, numids, NULL, buf, buf_len,
+                                    out_len, allow_realloc, buf_overflow,
+                                    NULL, NULL);
+            }
+            objid += (numids);
+            objidlen -= (numids);
+            break;
+
+        case TYPE_IPADDR:
+            if (objidlen < 4)
+                goto finish_it;
+            sprintf(intbuf, "%lu.%lu.%lu.%lu",
+                    objid[0], objid[1], objid[2], objid[3]);
+            objid += 4;
+            objidlen -= 4;
+            if (!*buf_overflow && !snmp_strcat(buf, buf_len, out_len,
+                                               allow_realloc,
+                                               (const u_char *) intbuf)) {
+                *buf_overflow = 1;
+            }
+            break;
+
+        case TYPE_NETADDR:{
+                oid             ntype = *objid++;
+
+                objidlen--;
+                sprintf(intbuf, "%lu.", ntype);
+                if (!*buf_overflow && !snmp_strcat(buf, buf_len, out_len,
+                                                   allow_realloc,
+                                                   (const u_char *)
+                                                   intbuf)) {
+                    *buf_overflow = 1;
+                }
+
+                if (ntype == 1 && objidlen >= 4) {
+                    sprintf(intbuf, "%lu.%lu.%lu.%lu",
+                            objid[0], objid[1], objid[2], objid[3]);
+                    if (!*buf_overflow
+                        && !snmp_strcat(buf, buf_len, out_len,
+                                        allow_realloc,
+                                        (const u_char *) intbuf)) {
+                        *buf_overflow = 1;
+                    }
+                    objid += 4;
+                    objidlen -= 4;
+                } else {
+                    goto finish_it;
+                }
+            }
+            break;
+
+        case TYPE_NSAPADDRESS:
+        default:
+            goto finish_it;
+            break;
+        }
+
+        if (extended_index) {
+            if (!*buf_overflow && !snmp_strcat(buf, buf_len, out_len,
+                                               allow_realloc,
+                                               (const u_char *) "]")) {
+                *buf_overflow = 1;
+            }
+        } else {
+            if (!*buf_overflow && !snmp_strcat(buf, buf_len, out_len,
+                                               allow_realloc,
+                                               (const u_char *) ".")) {
+                *buf_overflow = 1;
+            }
+        }
+        in_dices = in_dices->next;
+    }
+
+  finish_it:
+    if (*buf != NULL && *(*buf + *out_len - 1) != '.') {
+        if (!*buf_overflow && !snmp_strcat(buf, buf_len, out_len,
+                                           allow_realloc,
+                                           (const u_char *) ".")) {
+            *buf_overflow = 1;
+        }
+    }
+
+    while (objidlen-- > 0) {    /* output rest of name, uninterpreted */
+        sprintf(intbuf, "%lu.", *objid++);
+        if (!*buf_overflow && !snmp_strcat(buf, buf_len, out_len,
+                                           allow_realloc,
+                                           (const u_char *) intbuf)) {
+            *buf_overflow = 1;
+        }
+    }
+
+    if (*buf != NULL) {
+        *(*buf + *out_len - 1) = '\0';  /* remove trailing dot */
+    }
+    return NULL;
+}
+
+/**
+ * Clone of get_symbol that doesn't take a buffer argument.
+ *
+ * @see get_symbol
+ */
+struct tree    *
+get_tree(const oid * objid, size_t objidlen, struct tree *subtree)
+{
+    struct tree    *return_tree = NULL;
+
+    for (; subtree; subtree = subtree->next_peer) {
+        if (*objid == subtree->subid)
+            goto found;
+    }
+
+    return NULL;
+
+  found:
+    while (subtree->next_peer && subtree->next_peer->subid == *objid)
+	subtree = subtree->next_peer;
+    if (objidlen > 1)
+        return_tree =
+            get_tree(objid + 1, objidlen - 1, subtree->child_list);
+    if (return_tree != NULL)
+        return return_tree;
+    else
+        return subtree;
+}
+
+/**
+ * Prints on oid description on stdout.
+ *
+ * @see fprint_description
+ */
+void
+print_description(oid * objid, size_t objidlen, /* number of subidentifiers */
+                  int width)
+{
+    fprint_description(stdout, objid, objidlen, width);
+}
+
+
+/**
+ * Prints on oid description into a file descriptor.
+ * 
+ * @param f         The file descriptor to print to.
+ * @param objid     The object identifier.
+ * @param objidlen  The object id length.
+ * @param width     Number of subidentifiers.
+ */
+void
+fprint_description(FILE * f, oid * objid, size_t objidlen,
+                   int width)
+{
+    struct tree    *tp = get_tree(objid, objidlen, tree_head);
+    struct tree    *subtree = tree_head;
+    int             pos, len;
+    char            buf[128];
+    const char     *cp;
+
+    if (tp->type <= TYPE_SIMPLE_LAST)
+        cp = "OBJECT-TYPE";
+    else
+        switch (tp->type) {
+        case TYPE_TRAPTYPE:
+            cp = "TRAP-TYPE";
+            break;
+        case TYPE_NOTIFTYPE:
+            cp = "NOTIFICATION-TYPE";
+            break;
+        case TYPE_OBJGROUP:
+            cp = "OBJECT-GROUP";
+            break;
+        case TYPE_AGENTCAP:
+            cp = "AGENT-CAPABILITIES";
+            break;
+        case TYPE_MODID:
+            cp = "MODULE-IDENTITY";
+            break;
+        case TYPE_MODCOMP:
+            cp = "MODULE-COMPLIANCE";
+            break;
+        default:
+            sprintf(buf, "type_%d", tp->type);
+            cp = buf;
+        }
+    fprintf(f, "%s %s\n", tp->label, cp);
+    print_tree_node(f, tp, width);
+    fprintf(f, "::= {");
+    pos = 5;
+    while (objidlen > 1) {
+        for (; subtree; subtree = subtree->next_peer) {
+            if (*objid == subtree->subid) {
+                while (subtree->next_peer && subtree->next_peer->subid == *objid)
+                    subtree = subtree->next_peer;
+                if (strncmp(subtree->label, ANON, ANON_LEN)) {
+                    snprintf(buf, sizeof(buf), " %s(%lu)", subtree->label, subtree->subid);
+                    buf[ sizeof(buf)-1 ] = 0;
+                } else
+                    sprintf(buf, " %lu", subtree->subid);
+                len = strlen(buf);
+                if (pos + len + 2 > width) {
+                    fprintf(f, "\n     ");
+                    pos = 5;
+                }
+                fprintf(f, "%s", buf);
+                pos += len;
+                objid++;
+                objidlen--;
+                break;
+            }
+        }
+        if (subtree)
+            subtree = subtree->child_list;
+        else
+            break;
+    }
+    while (objidlen > 1) {
+        sprintf(buf, " %lu", *objid);
+        len = strlen(buf);
+        if (pos + len + 2 > width) {
+            fprintf(f, "\n     ");
+            pos = 5;
+        }
+        fprintf(f, "%s", buf);
+        pos += len;
+        objid++;
+        objidlen--;
+    }
+    sprintf(buf, " %lu }", *objid);
+    len = strlen(buf);
+    if (pos + len + 2 > width) {
+        fprintf(f, "\n     ");
+        pos = 5;
+    }
+    fprintf(f, "%s\n", buf);
+}
+
+static void
+print_tree_node(FILE * f, struct tree *tp, int width)
+{
+    const char     *cp;
+    char            str[MAXTOKEN];
+    int             i, prevmod, pos, len;
+
+    if (tp) {
+        module_name(tp->modid, str);
+        fprintf(f, "  -- FROM\t%s", str);
+        pos = 16+strlen(str);
+        for (i = 1, prevmod = tp->modid; i < tp->number_modules; i++) {
+            if (prevmod != tp->module_list[i]) {
+                module_name(tp->module_list[i], str);
+                len = strlen(str);
+                if (pos + len + 2 > width) {
+                    fprintf(f, ",\n  --\t\t");
+                    pos = 16;
+                }
+                else {
+                    fprintf(f, ", ");
+                    pos += 2;
+                }
+                fprintf(f, "%s", str);
+                pos += len;
+            }
+            prevmod = tp->module_list[i];
+        }
+        fprintf(f, "\n");
+        if (tp->tc_index != -1) {
+            fprintf(f, "  -- TEXTUAL CONVENTION %s\n",
+                    get_tc_descriptor(tp->tc_index));
+        }
+        switch (tp->type) {
+        case TYPE_OBJID:
+            cp = "OBJECT IDENTIFIER";
+            break;
+        case TYPE_OCTETSTR:
+            cp = "OCTET STRING";
+            break;
+        case TYPE_INTEGER:
+            cp = "INTEGER";
+            break;
+        case TYPE_NETADDR:
+            cp = "NetworkAddress";
+            break;
+        case TYPE_IPADDR:
+            cp = "IpAddress";
+            break;
+        case TYPE_COUNTER:
+            cp = "Counter32";
+            break;
+        case TYPE_GAUGE:
+            cp = "Gauge32";
+            break;
+        case TYPE_TIMETICKS:
+            cp = "TimeTicks";
+            break;
+        case TYPE_OPAQUE:
+            cp = "Opaque";
+            break;
+        case TYPE_NULL:
+            cp = "NULL";
+            break;
+        case TYPE_COUNTER64:
+            cp = "Counter64";
+            break;
+        case TYPE_BITSTRING:
+            cp = "BITS";
+            break;
+        case TYPE_NSAPADDRESS:
+            cp = "NsapAddress";
+            break;
+        case TYPE_UINTEGER:
+            cp = "UInteger32";
+            break;
+        case TYPE_UNSIGNED32:
+            cp = "Unsigned32";
+            break;
+        case TYPE_INTEGER32:
+            cp = "Integer32";
+            break;
+        default:
+            cp = NULL;
+            break;
+        }
+#if SNMP_TESTING_CODE
+        if (!cp && (tp->ranges || tp->enums)) { /* ranges without type ? */
+            sprintf(str, "?0 with %s %s ?",
+                    tp->ranges ? "Range" : "", tp->enums ? "Enum" : "");
+            cp = str;
+        }
+#endif                          /* SNMP_TESTING_CODE */
+        if (cp)
+            fprintf(f, "  SYNTAX\t%s", cp);
+        if (tp->ranges) {
+            struct range_list *rp = tp->ranges;
+            int             first = 1;
+            fprintf(f, " (");
+            while (rp) {
+                if (first)
+                    first = 0;
+                else
+                    fprintf(f, " | ");
+                if (rp->low == rp->high)
+                    fprintf(f, "%d", rp->low);
+                else
+                    fprintf(f, "%d..%d", rp->low, rp->high);
+                rp = rp->next;
+            }
+            fprintf(f, ") ");
+        }
+        if (tp->enums) {
+            struct enum_list *ep = tp->enums;
+            int             first = 1;
+            fprintf(f, " { ");
+            pos = 16 + strlen(cp) + 2;
+            while (ep) {
+                if (first)
+                    first = 0;
+                else
+                    fprintf(f, ", ");
+                snprintf(str, sizeof(str), "%s(%d)", ep->label, ep->value);
+                str[ sizeof(str)-1 ] = 0;
+                len = strlen(str);
+                if (pos + len + 2 > width) {
+                    fprintf(f, "\n\t\t  ");
+                    pos = 18;
+                }
+                fprintf(f, "%s", str);
+                pos += len + 2;
+                ep = ep->next;
+            }
+            fprintf(f, " } ");
+        }
+        if (cp)
+            fprintf(f, "\n");
+        if (tp->hint)
+            fprintf(f, "  DISPLAY-HINT\t\"%s\"\n", tp->hint);
+        if (tp->units)
+            fprintf(f, "  UNITS\t\"%s\"\n", tp->units);
+        switch (tp->access) {
+        case MIB_ACCESS_READONLY:
+            cp = "read-only";
+            break;
+        case MIB_ACCESS_READWRITE:
+            cp = "read-write";
+            break;
+        case MIB_ACCESS_WRITEONLY:
+            cp = "write-only";
+            break;
+        case MIB_ACCESS_NOACCESS:
+            cp = "not-accessible";
+            break;
+        case MIB_ACCESS_NOTIFY:
+            cp = "accessible-for-notify";
+            break;
+        case MIB_ACCESS_CREATE:
+            cp = "read-create";
+            break;
+        case 0:
+            cp = NULL;
+            break;
+        default:
+            sprintf(str, "access_%d", tp->access);
+            cp = str;
+        }
+        if (cp)
+            fprintf(f, "  MAX-ACCESS\t%s\n", cp);
+        switch (tp->status) {
+        case MIB_STATUS_MANDATORY:
+            cp = "mandatory";
+            break;
+        case MIB_STATUS_OPTIONAL:
+            cp = "optional";
+            break;
+        case MIB_STATUS_OBSOLETE:
+            cp = "obsolete";
+            break;
+        case MIB_STATUS_DEPRECATED:
+            cp = "deprecated";
+            break;
+        case MIB_STATUS_CURRENT:
+            cp = "current";
+            break;
+        case 0:
+            cp = NULL;
+            break;
+        default:
+            sprintf(str, "status_%d", tp->status);
+            cp = str;
+        }
+#if SNMP_TESTING_CODE
+        if (!cp && (tp->indexes)) {     /* index without status ? */
+            sprintf(str, "?0 with %s ?", tp->indexes ? "Index" : "");
+            cp = str;
+        }
+#endif                          /* SNMP_TESTING_CODE */
+        if (cp)
+            fprintf(f, "  STATUS\t%s\n", cp);
+        if (tp->augments)
+            fprintf(f, "  AUGMENTS\t{ %s }\n", tp->augments);
+        if (tp->indexes) {
+            struct index_list *ip = tp->indexes;
+            int             first = 1;
+            fprintf(f, "  INDEX\t\t");
+            fprintf(f, "{ ");
+            pos = 16 + 2;
+            while (ip) {
+                if (first)
+                    first = 0;
+                else
+                    fprintf(f, ", ");
+                snprintf(str, sizeof(str), "%s%s",
+                        ip->isimplied ? "IMPLIED " : "",
+                        ip->ilabel);
+                str[ sizeof(str)-1 ] = 0;
+                len = strlen(str);
+                if (pos + len + 2 > width) {
+                    fprintf(f, "\n\t\t  ");
+                    pos = 16 + 2;
+                }
+                fprintf(f, "%s", str);
+                pos += len + 2;
+                ip = ip->next;
+            }
+            fprintf(f, " }\n");
+        }
+        if (tp->varbinds) {
+            struct varbind_list *vp = tp->varbinds;
+            int             first = 1;
+            fprintf(f, "  %s\t", tp->type == TYPE_TRAPTYPE ?
+                    "VARIABLES" : "OBJECTS");
+            fprintf(f, "{ ");
+            pos = 16 + 2;
+            while (vp) {
+                if (first)
+                    first = 0;
+                else
+                    fprintf(f, ", ");
+                snprintf(str, sizeof(str), "%s", vp->vblabel);
+                str[ sizeof(str)-1 ] = 0;
+                len = strlen(str);
+                if (pos + len + 2 > width) {
+                    fprintf(f, "\n\t\t  ");
+                    pos = 16 + 2;
+                }
+                fprintf(f, "%s", str);
+                pos += len + 2;
+                vp = vp->next;
+            }
+            fprintf(f, " }\n");
+        }
+        if (tp->description)
+            fprintf(f, "  DESCRIPTION\t\"%s\"\n", tp->description);
+        if (tp->defaultValue)
+            fprintf(f, "  DEFVAL\t{ %s }\n", tp->defaultValue);
+    } else
+        fprintf(f, "No description\n");
+}
+
+int
+get_module_node(const char *fname,
+                const char *module, oid * objid, size_t * objidlen)
+{
+    int             modid, rc = 0;
+    struct tree    *tp;
+    char           *name, *cp;
+
+    if (!strcmp(module, "ANY"))
+        modid = -1;
+    else {
+        read_module(module);
+        modid = which_module(module);
+        if (modid == -1)
+            return 0;
+    }
+
+    /*
+     * Isolate the first component of the name ... 
+     */
+    name = strdup(fname);
+    cp = strchr(name, '.');
+    if (cp != NULL) {
+        *cp = '\0';
+        cp++;
+    }
+    /*
+     * ... and locate it in the tree. 
+     */
+    tp = find_tree_node(name, modid);
+    if (tp) {
+        size_t          maxlen = *objidlen;
+
+        /*
+         * Set the first element of the object ID 
+         */
+        if (node_to_oid(tp, objid, objidlen)) {
+            rc = 1;
+
+            /*
+             * If the name requested was more than one element,
+             * tag on the rest of the components 
+             */
+            if (cp != NULL)
+                rc = _add_strings_to_oid(tp, cp, objid, objidlen, maxlen);
+        }
+    }
+
+    free(name);
+    return (rc);
+}
+
+
+/**
+ * @internal
+ *
+ * Populates the object identifier from a node in the MIB hierarchy.
+ * Builds up the object ID, working backwards,
+ * starting from the end of the objid buffer.
+ * When the top of the MIB tree is reached, the buffer is adjusted.
+ *
+ * The buffer length is set to the number of subidentifiers
+ * for the object identifier associated with the MIB node.
+ * 
+ * @return the number of subidentifiers copied.
+ *
+ * If 0 is returned, the objid buffer is too small,
+ * and the buffer contents are indeterminate.
+ * The buffer length can be used to create a larger buffer.
+ */
+static int
+node_to_oid(struct tree *tp, oid * objid, size_t * objidlen)
+{
+    int             numids, lenids;
+    oid            *op;
+
+    if (!tp || !objid || !objidlen)
+        return 0;
+
+    lenids = (int) *objidlen;
+    op = objid + lenids;        /* points after the last element */
+
+    for (numids = 0; tp; tp = tp->parent, numids++) {
+        if (numids >= lenids)
+            continue;
+        --op;
+        *op = tp->subid;
+    }
+
+    *objidlen = (size_t) numids;
+    if (numids > lenids) {
+        return 0;
+    }
+
+    if (numids < lenids)
+        memmove(objid, op, numids * sizeof(oid));
+
+    return (numids);
+}
+
+/*
+ * Replace \x with x stop at eos_marker
+ * return NULL if eos_marker not found
+ */
+static char *_apply_escapes(char *src, char eos_marker)
+{
+    char *dst;
+    int backslash = 0;
+    
+    dst = src;
+    while (*src) {
+	if (backslash) {
+	    backslash = 0;
+	    *dst++ = *src;
+	} else {
+	    if (eos_marker == *src) break;
+	    if ('\\' == *src) {
+		backslash = 1;
+	    } else {
+		*dst++ = *src;
+	    }
+	}
+	src++;
+    }
+    if (!*src) {
+	/* never found eos_marker */
+	return NULL;
+    } else {
+	*dst = 0;
+	return src;
+    }
+}
+
+static int
+_add_strings_to_oid(struct tree *tp, char *cp,
+                    oid * objid, size_t * objidlen, size_t maxlen)
+{
+    oid             subid;
+    int             len_index = 1000000;
+    struct tree    *tp2 = NULL;
+    struct index_list *in_dices = NULL;
+    char           *fcp, *ecp, *cp2 = NULL;
+    char            doingquote;
+    int             len = -1, pos = -1;
+    int             check =
+        !netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_DONT_CHECK_RANGE);
+    int             do_hint = !netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_NO_DISPLAY_HINT);
+
+    while (cp && tp && tp->child_list) {
+        fcp = cp;
+        tp2 = tp->child_list;
+        /*
+         * Isolate the next entry 
+         */
+        cp2 = strchr(cp, '.');
+        if (cp2)
+            *cp2++ = '\0';
+
+        /*
+         * Search for the appropriate child 
+         */
+        if (isdigit(*cp)) {
+            subid = strtoul(cp, &ecp, 0);
+            if (*ecp)
+                goto bad_id;
+            while (tp2 && tp2->subid != subid)
+                tp2 = tp2->next_peer;
+        } else {
+            while (tp2 && strcmp(tp2->label, fcp))
+                tp2 = tp2->next_peer;
+            if (!tp2)
+                goto bad_id;
+            subid = tp2->subid;
+        }
+        if (*objidlen >= maxlen)
+            goto bad_id;
+	while (tp2 && tp2->next_peer && tp2->next_peer->subid == subid)
+	    tp2 = tp2->next_peer;
+        objid[*objidlen] = subid;
+        (*objidlen)++;
+
+        cp = cp2;
+        if (!tp2)
+            break;
+        tp = tp2;
+    }
+
+    if (tp && !tp->child_list) {
+        if ((tp2 = tp->parent)) {
+            if (tp2->indexes)
+                in_dices = tp2->indexes;
+            else if (tp2->augments) {
+                tp2 = find_tree_node(tp2->augments, -1);
+                if (tp2)
+                    in_dices = tp2->indexes;
+            }
+        }
+        tp = NULL;
+    }
+
+    while (cp && in_dices) {
+        fcp = cp;
+
+        tp = find_tree_node(in_dices->ilabel, -1);
+        if (!tp)
+            break;
+        switch (tp->type) {
+        case TYPE_INTEGER:
+        case TYPE_INTEGER32:
+        case TYPE_UINTEGER:
+        case TYPE_UNSIGNED32:
+        case TYPE_TIMETICKS:
+            /*
+             * Isolate the next entry 
+             */
+            cp2 = strchr(cp, '.');
+            if (cp2)
+                *cp2++ = '\0';
+            if (isdigit(*cp)) {
+                subid = strtoul(cp, &ecp, 0);
+                if (*ecp)
+                    goto bad_id;
+            } else {
+                if (tp->enums) {
+                    struct enum_list *ep = tp->enums;
+                    while (ep && strcmp(ep->label, cp))
+                        ep = ep->next;
+                    if (!ep)
+                        goto bad_id;
+                    subid = ep->value;
+                } else
+                    goto bad_id;
+            }
+            if (check && tp->ranges) {
+                struct range_list *rp = tp->ranges;
+                int             ok = 0;
+                while (!ok && rp)
+                    if ((rp->low <= (int) subid)
+                        && ((int) subid <= rp->high))
+                        ok = 1;
+                    else
+                        rp = rp->next;
+                if (!ok)
+                    goto bad_id;
+            }
+            if (*objidlen >= maxlen)
+                goto bad_id;
+            objid[*objidlen] = subid;
+            (*objidlen)++;
+            break;
+        case TYPE_IPADDR:
+            if (*objidlen + 4 > maxlen)
+                goto bad_id;
+            for (subid = 0; cp && subid < 4; subid++) {
+                fcp = cp;
+                cp2 = strchr(cp, '.');
+                if (cp2)
+                    *cp2++ = 0;
+                objid[*objidlen] = strtoul(cp, &ecp, 0);
+                if (*ecp)
+                    goto bad_id;
+                if (check && objid[*objidlen] > 255)
+                    goto bad_id;
+                (*objidlen)++;
+                cp = cp2;
+            }
+            break;
+        case TYPE_OCTETSTR:
+            if (tp->ranges && !tp->ranges->next
+                && tp->ranges->low == tp->ranges->high)
+                len = tp->ranges->low;
+            else
+                len = -1;
+            pos = 0;
+            if (*cp == '"' || *cp == '\'') {
+                doingquote = *cp++;
+                /*
+                 * insert length if requested 
+                 */
+                if (!in_dices->isimplied && len == -1) {
+                    if (doingquote == '\'') {
+                        snmp_set_detail
+                            ("'-quote is for fixed length strings");
+                        return 0;
+                    }
+                    if (*objidlen >= maxlen)
+                        goto bad_id;
+                    len_index = *objidlen;
+                    (*objidlen)++;
+                } else if (doingquote == '"') {
+                    snmp_set_detail
+                        ("\"-quote is for variable length strings");
+                    return 0;
+                }
+
+		cp2 = _apply_escapes(cp, doingquote);
+		if (!cp2) goto bad_id;
+		else {
+		    unsigned char *new_val;
+		    int new_val_len;
+		    int parsed_hint = 0;
+		    const char *parsed_value;
+
+		    if (do_hint && tp->hint) {
+			parsed_value = parse_octet_hint(tp->hint, cp,
+			                                &new_val, &new_val_len);
+			parsed_hint = parsed_value == NULL;
+		    }
+		    if (parsed_hint) {
+			int i;
+			for (i = 0; i < new_val_len; i++) {
+			    if (*objidlen >= maxlen) goto bad_id;
+			    objid[ *objidlen ] = new_val[i];
+			    (*objidlen)++;
+			    pos++;
+			}
+			free(new_val);
+		    } else {
+			while(*cp) {
+			    if (*objidlen >= maxlen) goto bad_id;
+			    objid[ *objidlen ] = *cp++;
+			    (*objidlen)++;
+			    pos++;
+			}
+		    }
+		}
+		
+		cp2++;
+                if (!*cp2)
+                    cp2 = NULL;
+                else if (*cp2 != '.')
+                    goto bad_id;
+                else
+                    cp2++;
+		if (check) {
+                    if (len == -1) {
+                        struct range_list *rp = tp->ranges;
+                        int             ok = 0;
+                        while (rp && !ok)
+                            if (rp->low <= pos && pos <= rp->high)
+                                ok = 1;
+                            else
+                                rp = rp->next;
+                        if (!ok)
+                            goto bad_id;
+                        if (!in_dices->isimplied)
+                            objid[len_index] = pos;
+                    } else if (pos != len)
+                        goto bad_id;
+		}
+		else if (len == -1 && !in_dices->isimplied)
+		    objid[len_index] = pos;
+            } else {
+                if (!in_dices->isimplied && len == -1) {
+                    fcp = cp;
+                    cp2 = strchr(cp, '.');
+                    if (cp2)
+                        *cp2++ = 0;
+                    len = strtoul(cp, &ecp, 0);
+                    if (*ecp)
+                        goto bad_id;
+                    if (*objidlen + len + 1 >= maxlen)
+                        goto bad_id;
+                    objid[*objidlen] = len;
+                    (*objidlen)++;
+                    cp = cp2;
+                }
+                while (len && cp) {
+                    fcp = cp;
+                    cp2 = strchr(cp, '.');
+                    if (cp2)
+                        *cp2++ = 0;
+                    objid[*objidlen] = strtoul(cp, &ecp, 0);
+                    if (*ecp)
+                        goto bad_id;
+                    if (check && objid[*objidlen] > 255)
+                        goto bad_id;
+                    (*objidlen)++;
+                    len--;
+                    cp = cp2;
+                }
+            }
+            break;
+        case TYPE_OBJID:
+            in_dices = NULL;
+            cp2 = cp;
+            break;
+	case TYPE_NETADDR:
+	    fcp = cp;
+	    cp2 = strchr(cp, '.');
+	    if (cp2)
+		*cp2++ = 0;
+	    subid = strtoul(cp, &ecp, 0);
+	    if (*ecp)
+		goto bad_id;
+	    if (*objidlen + 1 >= maxlen)
+		goto bad_id;
+	    objid[*objidlen] = subid;
+	    (*objidlen)++;
+	    cp = cp2;
+	    if (subid == 1) {
+		for (len = 0; len < 4; len++) {
+		    fcp = cp;
+		    cp2 = strchr(cp, '.');
+		    if (cp2)
+			*cp2++ = 0;
+		    subid = strtoul(cp, &ecp, 0);
+		    if (*ecp)
+			goto bad_id;
+		    if (*objidlen + 1 >= maxlen)
+			goto bad_id;
+		    if (subid > 255)
+			goto bad_id;
+		    objid[*objidlen] = subid;
+	            (*objidlen)++;
+		    cp = cp2;
+		}
+	    }
+	    else {
+		in_dices = NULL;
+	    }
+	    break;
+        default:
+            snmp_log(LOG_ERR, "Unexpected index type: %d %s %s\n",
+                     tp->type, in_dices->ilabel, cp);
+            in_dices = NULL;
+            cp2 = cp;
+            break;
+        }
+        cp = cp2;
+        if (in_dices)
+            in_dices = in_dices->next;
+    }
+
+    while (cp) {
+        fcp = cp;
+        switch (*cp) {
+        case '0':
+        case '1':
+        case '2':
+        case '3':
+        case '4':
+        case '5':
+        case '6':
+        case '7':
+        case '8':
+        case '9':
+            cp2 = strchr(cp, '.');
+            if (cp2)
+                *cp2++ = 0;
+            subid = strtoul(cp, &ecp, 0);
+            if (*ecp)
+                goto bad_id;
+            if (*objidlen >= maxlen)
+                goto bad_id;
+            objid[*objidlen] = subid;
+            (*objidlen)++;
+            break;
+        case '"':
+        case '\'':
+            doingquote = *cp++;
+            /*
+             * insert length if requested 
+             */
+            if (doingquote == '"') {
+                if (*objidlen >= maxlen)
+                    goto bad_id;
+                objid[*objidlen] = len = strchr(cp, doingquote) - cp;
+                (*objidlen)++;
+            }
+
+            while (*cp && *cp != doingquote) {
+                if (*objidlen >= maxlen)
+                    goto bad_id;
+                objid[*objidlen] = *cp++;
+                (*objidlen)++;
+            }
+            if (!cp)
+                goto bad_id;
+            cp2 = cp + 1;
+            if (!*cp2)
+                cp2 = NULL;
+            else if (*cp2 == '.')
+                cp2++;
+            else
+                goto bad_id;
+            break;
+        default:
+            goto bad_id;
+        }
+        cp = cp2;
+    }
+    return 1;
+
+  bad_id:
+    {
+        char            buf[256];
+        if (in_dices)
+            snprintf(buf, sizeof(buf), "Index out of range: %s (%s)",
+                    fcp, in_dices->ilabel);
+        else if (tp)
+            snprintf(buf, sizeof(buf), "Sub-id not found: %s -> %s", tp->label, fcp);
+        else
+            snprintf(buf, sizeof(buf), "%s", fcp);
+        buf[ sizeof(buf)-1 ] = 0;
+
+        snmp_set_detail(buf);
+    }
+    return 0;
+}
+
+
+/**
+ * @see comments on find_best_tree_node for usage after first time.
+ */
+int
+get_wild_node(const char *name, oid * objid, size_t * objidlen)
+{
+    struct tree    *tp = find_best_tree_node(name, tree_head, NULL);
+    if (!tp)
+        return 0;
+    return get_node(tp->label, objid, objidlen);
+}
+
+int
+get_node(const char *name, oid * objid, size_t * objidlen)
+{
+    const char     *cp;
+    char            ch;
+    int             res;
+
+    cp = name;
+    while ((ch = *cp))
+        if (('0' <= ch && ch <= '9')
+            || ('a' <= ch && ch <= 'z')
+            || ('A' <= ch && ch <= 'Z')
+            || ch == '-')
+            cp++;
+        else
+            break;
+    if (ch != ':')
+        if (*name == '.')
+            res = get_module_node(name + 1, "ANY", objid, objidlen);
+        else
+            res = get_module_node(name, "ANY", objid, objidlen);
+    else {
+        char           *module;
+        /*
+         *  requested name is of the form
+         *      "module:subidentifier"
+         */
+        module = (char *) malloc((size_t) (cp - name + 1));
+        if (!module)
+            return SNMPERR_GENERR;
+        memcpy(module, name, (size_t) (cp - name));
+        module[cp - name] = 0;
+        cp++;                   /* cp now point to the subidentifier */
+        if (*cp == ':')
+            cp++;
+
+        /*
+         * 'cp' and 'name' *do* go that way round! 
+         */
+        res = get_module_node(cp, module, objid, objidlen);
+        free(module);
+    }
+    if (res == 0) {
+        SET_SNMP_ERROR(SNMPERR_UNKNOWN_OBJID);
+    }
+
+    return res;
+}
+
+#ifdef testing
+
+main(int argc, char *argv[])
+{
+    oid             objid[MAX_OID_LEN];
+    int             objidlen = MAX_OID_LEN;
+    int             count;
+    netsnmp_variable_list variable;
+
+    init_mib();
+    if (argc < 2)
+        print_subtree(stdout, tree_head, 0);
+    variable.type = ASN_INTEGER;
+    variable.val.integer = 3;
+    variable.val_len = 4;
+    for (argc--; argc; argc--, argv++) {
+        objidlen = MAX_OID_LEN;
+        printf("read_objid(%s) = %d\n",
+               argv[1], read_objid(argv[1], objid, &objidlen));
+        for (count = 0; count < objidlen; count++)
+            printf("%d.", objid[count]);
+        printf("\n");
+        print_variable(objid, objidlen, &variable);
+    }
+}
+
+#endif                          /* testing */
+
+/*
+ * initialize: no peers included in the report. 
+ */
+void
+clear_tree_flags(register struct tree *tp)
+{
+    for (; tp; tp = tp->next_peer) {
+        tp->reported = 0;
+        if (tp->child_list)
+            clear_tree_flags(tp->child_list);
+     /*RECURSE*/}
+}
+
+/*
+ * Update: 1998-07-17 <jhy@gsu.edu>
+ * Added print_oid_report* functions.
+ */
+static int      print_subtree_oid_report_labeledoid = 0;
+static int      print_subtree_oid_report_oid = 0;
+static int      print_subtree_oid_report_symbolic = 0;
+static int      print_subtree_oid_report_suffix = 0;
+
+/*
+ * These methods recurse. 
+ */
+static void     print_parent_labeledoid(FILE *, struct tree *);
+static void     print_parent_oid(FILE *, struct tree *);
+static void     print_parent_label(FILE *, struct tree *);
+static void     print_subtree_oid_report(FILE *, struct tree *, int);
+
+
+void
+print_oid_report(FILE * fp)
+{
+    struct tree    *tp;
+    clear_tree_flags(tree_head);
+    for (tp = tree_head; tp; tp = tp->next_peer)
+        print_subtree_oid_report(fp, tp, 0);
+}
+
+void
+print_oid_report_enable_labeledoid(void)
+{
+    print_subtree_oid_report_labeledoid = 1;
+}
+
+void
+print_oid_report_enable_oid(void)
+{
+    print_subtree_oid_report_oid = 1;
+}
+
+void
+print_oid_report_enable_suffix(void)
+{
+    print_subtree_oid_report_suffix = 1;
+}
+
+void
+print_oid_report_enable_symbolic(void)
+{
+    print_subtree_oid_report_symbolic = 1;
+}
+
+/*
+ * helper methods for print_subtree_oid_report()
+ * each one traverses back up the node tree
+ * until there is no parent.  Then, the label combination
+ * is output, such that the parent is displayed first.
+ *
+ * Warning: these methods are all recursive.
+ */
+
+static void
+print_parent_labeledoid(FILE * f, struct tree *tp)
+{
+    if (tp) {
+        if (tp->parent) {
+            print_parent_labeledoid(f, tp->parent);
+         /*RECURSE*/}
+        fprintf(f, ".%s(%lu)", tp->label, tp->subid);
+    }
+}
+
+static void
+print_parent_oid(FILE * f, struct tree *tp)
+{
+    if (tp) {
+        if (tp->parent) {
+            print_parent_oid(f, tp->parent);
+         /*RECURSE*/}
+        fprintf(f, ".%lu", tp->subid);
+    }
+}
+
+static void
+print_parent_label(FILE * f, struct tree *tp)
+{
+    if (tp) {
+        if (tp->parent) {
+            print_parent_label(f, tp->parent);
+         /*RECURSE*/}
+        fprintf(f, ".%s", tp->label);
+    }
+}
+
+/**
+ * @internal
+ * This methods generates variations on the original print_subtree() report.
+ * Traverse the tree depth first, from least to greatest sub-identifier.
+ * Warning: this methods recurses and calls methods that recurse.
+ *
+ * @param f       File descriptor to print to.
+ * @param tree    ???
+ * @param count   ???
+ */
+
+static void
+print_subtree_oid_report(FILE * f, struct tree *tree, int count)
+{
+    struct tree    *tp;
+
+    count++;
+
+    /*
+     * sanity check 
+     */
+    if (!tree) {
+        return;
+    }
+
+    /*
+     * find the not reported peer with the lowest sub-identifier.
+     * if no more, break the loop and cleanup.
+     * set "reported" flag, and create report for this peer.
+     * recurse using the children of this peer, if any.
+     */
+    while (1) {
+        register struct tree *ntp;
+
+        tp = 0;
+        for (ntp = tree->child_list; ntp; ntp = ntp->next_peer) {
+            if (ntp->reported)
+                continue;
+
+            if (!tp || (tp->subid > ntp->subid))
+                tp = ntp;
+        }
+        if (!tp)
+            break;
+
+        tp->reported = 1;
+
+        if (print_subtree_oid_report_labeledoid) {
+            print_parent_labeledoid(f, tp);
+            fprintf(f, "\n");
+        }
+        if (print_subtree_oid_report_oid) {
+            print_parent_oid(f, tp);
+            fprintf(f, "\n");
+        }
+        if (print_subtree_oid_report_symbolic) {
+            print_parent_label(f, tp);
+            fprintf(f, "\n");
+        }
+        if (print_subtree_oid_report_suffix) {
+            int             i;
+            for (i = 0; i < count; i++)
+                fprintf(f, "  ");
+            fprintf(f, "%s(%ld) type=%d", tp->label, tp->subid, tp->type);
+            if (tp->tc_index != -1)
+                fprintf(f, " tc=%d", tp->tc_index);
+            if (tp->hint)
+                fprintf(f, " hint=%s", tp->hint);
+            if (tp->units)
+                fprintf(f, " units=%s", tp->units);
+
+            fprintf(f, "\n");
+        }
+        print_subtree_oid_report(f, tp, count);
+     /*RECURSE*/}
+}
+
+
+/**
+ * Converts timeticks to hours, minutes, seconds string.
+ * CMU compatible does not show centiseconds.
+ *
+ * @param timeticks    The timeticks to convert.
+ * @param buf          Buffer to write to, has to be at 
+ *                     least 64 Bytes large.
+ *       
+ * @return The buffer
+ *
+ * @see uptimeString
+ */
+char           *
+uptime_string(u_long timeticks, char *buf)
+{
+    char            tbuf[64];
+    char           *cp;
+    uptimeString(timeticks, tbuf);
+    cp = strrchr(tbuf, '.');
+#ifdef CMU_COMPATIBLE
+    if (cp)
+        *cp = '\0';
+#endif
+    strlcpy(buf, tbuf, sizeof(buf));
+    return buf;
+}
+
+oid            *
+snmp_parse_oid(const char *argv, oid * root, size_t * rootlen)
+{
+    size_t          savlen = *rootlen;
+    if (netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_RANDOM_ACCESS)
+        || strchr(argv, ':')) {
+        if (get_node(argv, root, rootlen)) {
+            return root;
+        }
+    } else if (netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_REGEX_ACCESS)) {
+        if (get_wild_node(argv, root, rootlen)) {
+            return root;
+        }
+    } else {
+        if (read_objid(argv, root, rootlen)) {
+            return root;
+        }
+        *rootlen = savlen;
+        if (get_node(argv, root, rootlen)) {
+            return root;
+        }
+        *rootlen = savlen;
+        DEBUGMSGTL(("parse_oid", "wildly parsing\n"));
+        if (get_wild_node(argv, root, rootlen)) {
+            return root;
+        }
+    }
+    return NULL;
+}
+
+/*
+ * Use DISPLAY-HINT to parse a value into an octet string.
+ *
+ * note that "1d1d", "11" could have come from an octet string that
+ * looked like { 1, 1 } or an octet string that looked like { 11 }
+ * because of this, it's doubtful that anyone would use such a display
+ * string. Therefore, the parser ignores this case.
+ */
+
+struct parse_hints {
+    int length;
+    int repeat;
+    int format;
+    int separator;
+    int terminator;
+    unsigned char *result;
+    int result_max;
+    int result_len;
+};
+
+static void parse_hints_reset(struct parse_hints *ph)
+{
+    ph->length = 0;
+    ph->repeat = 0;
+    ph->format = 0;
+    ph->separator = 0;
+    ph->terminator = 0;
+}
+
+static void parse_hints_ctor(struct parse_hints *ph)
+{
+    parse_hints_reset(ph);
+    ph->result = NULL;
+    ph->result_max = 0;
+    ph->result_len = 0;
+}
+
+static int parse_hints_add_result_octet(struct parse_hints *ph, unsigned char octet)
+{
+    if (!(ph->result_len < ph->result_max)) {
+	ph->result_max = ph->result_len + 32;
+	if (!ph->result) {
+	    ph->result = (unsigned char *)malloc(ph->result_max);
+	} else {
+	    ph->result = (unsigned char *)realloc(ph->result, ph->result_max);
+	}
+    }
+    
+    if (!ph->result) {
+	return 0;		/* failed */
+    }
+
+    ph->result[ph->result_len++] = octet;
+    return 1;			/* success */
+}
+
+static int parse_hints_parse(struct parse_hints *ph, const char **v_in_out)
+{
+    const char *v = *v_in_out;
+    char *nv;
+    int base;
+    int repeats = 0;
+    int repeat_fixup = ph->result_len;
+    
+    if (ph->repeat) {
+	if (!parse_hints_add_result_octet(ph, 0)) {
+	    return 0;
+	}
+    }
+    do {
+	base = 0;
+	switch (ph->format) {
+	case 'x': base += 6;	/* fall through */
+	case 'd': base += 2;	/* fall through */
+	case 'o': base += 8;	/* fall through */
+	    {
+		int i;
+		unsigned long number = strtol(v, &nv, base);
+		if (nv == v) return 0;
+		v = nv;
+		for (i = 0; i < ph->length; i++) {
+		    int shift = 8 * (ph->length - 1 - i);
+		    if (!parse_hints_add_result_octet(ph, (number >> shift) & 0xFF)) {
+			return 0; /* failed */
+		    }
+		}
+	    }
+	    break;
+
+	case 'a':
+	    {
+		int i;
+		    
+		for (i = 0; i < ph->length && *v; i++) {
+		    if (!parse_hints_add_result_octet(ph, *v++)) {
+			return 0;	/* failed */
+		    }
+		}
+	    }
+	    break;
+	}
+
+	repeats++;
+
+	if (ph->separator && *v) {
+	    if (*v == ph->separator) {
+		v++;
+	    } else {
+		return 0;		/* failed */
+	    }
+	}
+
+	if (ph->terminator) {
+	    if (*v == ph->terminator) {
+		v++;
+		break;
+	    }
+	}
+    } while (ph->repeat && *v);
+    if (ph->repeat) {
+	ph->result[repeat_fixup] = repeats;
+    }
+
+    *v_in_out = v;
+    return 1;
+}
+
+static void parse_hints_length_add_digit(struct parse_hints *ph, int digit)
+{
+    ph->length *= 10;
+    ph->length += digit - '0';
+}
+
+const char *parse_octet_hint(const char *hint, const char *value, unsigned char **new_val, int *new_val_len)
+{
+    const char *h = hint;
+    const char *v = value;
+    struct parse_hints ph;
+    int retval = 1;
+    /* See RFC 1443 */
+    enum {
+	HINT_1_2,
+	HINT_2_3,
+	HINT_1_2_4,
+	HINT_1_2_5,
+    } state = HINT_1_2;
+
+    parse_hints_ctor(&ph);
+    while (*h && *v && retval) {
+	switch (state) {
+	case HINT_1_2:
+	    if ('*' == *h) {
+		ph.repeat = 1;
+		state = HINT_2_3;
+	    } else if (isdigit(*h)) {
+		parse_hints_length_add_digit(&ph, *h);
+		state = HINT_2_3;
+	    } else {
+		return v;	/* failed */
+	    }
+	    break;
+
+	case HINT_2_3:
+	    if (isdigit(*h)) {
+		parse_hints_length_add_digit(&ph, *h);
+		/* state = HINT_2_3 */
+	    } else if ('x' == *h || 'd' == *h || 'o' == *h || 'a' == *h) {
+		ph.format = *h;
+		state = HINT_1_2_4;
+	    } else {
+		return v;	/* failed */
+	    }
+	    break;
+
+	case HINT_1_2_4:
+	    if ('*' == *h) {
+		retval = parse_hints_parse(&ph, &v);
+		parse_hints_reset(&ph);
+		
+		ph.repeat = 1;
+		state = HINT_2_3;
+	    } else if (isdigit(*h)) {
+		retval = parse_hints_parse(&ph, &v);
+		parse_hints_reset(&ph);
+		
+		parse_hints_length_add_digit(&ph, *h);
+		state = HINT_2_3;
+	    } else {
+		ph.separator = *h;
+		state = HINT_1_2_5;
+	    }
+	    break;
+
+	case HINT_1_2_5:
+	    if ('*' == *h) {
+		retval = parse_hints_parse(&ph, &v);
+		parse_hints_reset(&ph);
+		
+		ph.repeat = 1;
+		state = HINT_2_3;
+	    } else if (isdigit(*h)) {
+		retval = parse_hints_parse(&ph, &v);
+		parse_hints_reset(&ph);
+		
+		parse_hints_length_add_digit(&ph, *h);
+		state = HINT_2_3;
+	    } else {
+		ph.terminator = *h;
+
+		retval = parse_hints_parse(&ph, &v);
+		parse_hints_reset(&ph);
+
+		state = HINT_1_2;
+	    }
+	    break;
+	}
+	h++;
+    }
+    while (*v && retval) {
+	retval = parse_hints_parse(&ph, &v);
+    }
+    if (retval) {
+	*new_val = ph.result;
+	*new_val_len = ph.result_len;
+    } else {
+	if (ph.result) {
+	    free(ph.result);
+	}
+	*new_val = NULL;
+	*new_val_len = 0;
+    }
+    return retval ? NULL : v;
+}
+
+#ifdef test_display_hint
+
+int main(int argc, const char **argv)
+{
+    const char *hint;
+    const char *value;
+    unsigned char *new_val;
+    int new_val_len;
+    char *r;
+    
+    if (argc < 3) {
+	fprintf(stderr, "usage: dh <hint> <value>\n");
+	exit(2);
+    }
+    hint = argv[1];
+    value = argv[2];
+    r = parse_octet_hint(hint, value, &new_val, &new_val_len);
+    printf("{\"%s\", \"%s\"}: \n\t", hint, value);
+    if (r) {
+        *r = 0;
+    	printf("returned failed\n");
+	printf("value syntax error at: %s\n", value);
+    }
+    else {
+	int i;
+	printf("returned success\n");
+	for (i = 0; i < new_val_len; i++) {
+	    int c = new_val[i] & 0xFF;
+	    printf("%02X(%c) ", c, isprint(c) ? c : ' ');
+	}
+	free(new_val);
+    }
+    printf("\n");
+    exit(0);
+}
+
+#endif /* test_display_hint */
+
+u_char
+mib_to_asn_type(int mib_type)
+{
+    switch (mib_type) {
+    case TYPE_OBJID:
+        return ASN_OBJECT_ID;
+
+    case TYPE_OCTETSTR:
+    case TYPE_IPADDR:
+        return ASN_OCTET_STR;
+
+    case TYPE_NETADDR:
+        return ASN_IPADDRESS;
+
+    case TYPE_INTEGER32:
+    case TYPE_INTEGER:
+        return ASN_INTEGER;
+
+    case TYPE_COUNTER:
+        return ASN_COUNTER;
+
+    case TYPE_GAUGE:
+        return ASN_GAUGE;
+
+    case TYPE_TIMETICKS:
+        return ASN_TIMETICKS;
+
+    case TYPE_OPAQUE:
+        return ASN_OPAQUE;
+
+    case TYPE_NULL:
+        return ASN_NULL;
+
+    case TYPE_COUNTER64:
+        return ASN_COUNTER64;
+
+    case TYPE_BITSTRING:
+        return ASN_BIT_STR;
+
+    case TYPE_UINTEGER:
+    case TYPE_UNSIGNED32:
+        return ASN_UINTEGER;
+
+    case TYPE_NSAPADDRESS:
+        return ASN_NSAP;
+
+    }
+    return -1;
+}
+
+/**
+ * Converts a string to its OID form.
+ * in example  "hello" = 5 . 'h' . 'e' . 'l' . 'l' . 'o'
+ *
+ * @param S   The string.
+ * @param O   The oid.
+ * @param L   The length of the oid.
+ *
+ * @return 0 on Sucess, 1 on failure.
+ */
+int
+netsnmp_str2oid(const char *S, oid * O, int L)
+{
+    const char     *c = S;
+    oid            *o = &O[1];
+
+    --L;                        /* leave room for length prefix */
+
+    for (; *c && L; --L, ++o, ++c)
+        *o = *c;
+
+    /*
+     * make sure we got to the end of the string 
+     */
+    if (*c != 0)
+        return 1;
+
+    /*
+     * set the length of the oid 
+     */
+    *O = c - S;
+
+    return 0;
+}
+
+/**
+ * Converts an OID to its character form.
+ * in example  5 . 1 . 2 . 3 . 4 . 5 = 12345
+ *
+ * @param C   The character buffer.
+ * @param L   The length of the buffer.
+ * @param O   The oid.
+ *
+ * @return 0 on Sucess, 1 on failure.
+ */
+int
+netsnmp_oid2chars(char *C, int L, const oid * O)
+{
+    char           *c = C;
+    const oid      *o = &O[1];
+
+    if (L < *O)
+        return 1;
+
+    L = *O; /** length */
+    for (; L; --L, ++o, ++c) {
+        if (*o > 0xFF)
+            return 1;
+        *c = *o;
+    }
+    return 0;
+}
+
+/**
+ * Converts an OID to its string form.
+ * in example  5 . 'h' . 'e' . 'l' . 'l' . 'o' = "hello\0" (null terminated)
+ *
+ * @param S   The character string buffer.
+ * @param L   The length of the string buffer.
+ * @param O   The oid.
+ *
+ * @return 0 on Sucess, 1 on failure.
+ */
+int
+netsnmp_oid2str(char *S, int L, oid * O)
+{
+    int            rc;
+
+    if (L <= *O)
+        return 1;
+
+    rc = netsnmp_oid2chars(S, L, O);
+    if (rc)
+        return 1;
+
+    S[ *O ] = 0;
+
+    return 0;
+}
+
+int
+snprint_by_type(char *buf, size_t buf_len,
+                netsnmp_variable_list * var,
+                const struct enum_list *enums,
+                const char *hint, const char *units)
+{
+    size_t          out_len = 0;
+    if (sprint_realloc_by_type((u_char **) & buf, &buf_len, &out_len, 0,
+                               var, enums, hint, units))
+        return (int) out_len;
+    else
+        return -1;
+}
+
+int
+snprint_hexstring(char *buf, size_t buf_len, const u_char * cp, size_t len)
+{
+    size_t          out_len = 0;
+    if (sprint_realloc_hexstring((u_char **) & buf, &buf_len, &out_len, 0,
+                                 cp, len))
+        return (int) out_len;
+    else
+        return -1;
+}
+
+int
+snprint_asciistring(char *buf, size_t buf_len,
+                    const u_char * cp, size_t len)
+{
+    size_t          out_len = 0;
+    if (sprint_realloc_asciistring
+        ((u_char **) & buf, &buf_len, &out_len, 0, cp, len))
+        return (int) out_len;
+    else
+        return -1;
+}
+
+int
+snprint_octet_string(char *buf, size_t buf_len,
+                     const netsnmp_variable_list * var, const struct enum_list *enums,
+                     const char *hint, const char *units)
+{
+    size_t          out_len = 0;
+    if (sprint_realloc_octet_string
+        ((u_char **) & buf, &buf_len, &out_len, 0, var, enums, hint,
+         units))
+        return (int) out_len;
+    else
+        return -1;
+}
+
+int
+snprint_opaque(char *buf, size_t buf_len,
+               const netsnmp_variable_list * var, const struct enum_list *enums,
+               const char *hint, const char *units)
+{
+    size_t          out_len = 0;
+    if (sprint_realloc_opaque((u_char **) & buf, &buf_len, &out_len, 0,
+                              var, enums, hint, units))
+        return (int) out_len;
+    else
+        return -1;
+}
+
+int
+snprint_object_identifier(char *buf, size_t buf_len,
+                          const netsnmp_variable_list * var,
+                          const struct enum_list *enums, const char *hint,
+                          const char *units)
+{
+    size_t          out_len = 0;
+    if (sprint_realloc_object_identifier
+        ((u_char **) & buf, &buf_len, &out_len, 0, var, enums, hint,
+         units))
+        return (int) out_len;
+    else
+        return -1;
+}
+
+int
+snprint_timeticks(char *buf, size_t buf_len,
+                  const netsnmp_variable_list * var, const struct enum_list *enums,
+                  const char *hint, const char *units)
+{
+    size_t          out_len = 0;
+    if (sprint_realloc_timeticks((u_char **) & buf, &buf_len, &out_len, 0,
+                                 var, enums, hint, units))
+        return (int) out_len;
+    else
+        return -1;
+}
+
+int
+snprint_hinted_integer(char *buf, size_t buf_len,
+                       long val, const char *hint, const char *units)
+{
+    size_t          out_len = 0;
+    if (sprint_realloc_hinted_integer
+        ((u_char **) & buf, &buf_len, &out_len, 0, val, 'd', hint, units))
+        return (int) out_len;
+    else
+        return -1;
+}
+
+int
+snprint_integer(char *buf, size_t buf_len,
+                const netsnmp_variable_list * var, const struct enum_list *enums,
+                const char *hint, const char *units)
+{
+    size_t          out_len = 0;
+    if (sprint_realloc_integer((u_char **) & buf, &buf_len, &out_len, 0,
+                               var, enums, hint, units))
+        return (int) out_len;
+    else
+        return -1;
+}
+
+int
+snprint_uinteger(char *buf, size_t buf_len,
+                 const netsnmp_variable_list * var, const struct enum_list *enums,
+                 const char *hint, const char *units)
+{
+    size_t          out_len = 0;
+    if (sprint_realloc_uinteger((u_char **) & buf, &buf_len, &out_len, 0,
+                                var, enums, hint, units))
+        return (int) out_len;
+    else
+        return -1;
+}
+
+int
+snprint_gauge(char *buf, size_t buf_len,
+              const netsnmp_variable_list * var, const struct enum_list *enums,
+              const char *hint, const char *units)
+{
+    size_t          out_len = 0;
+    if (sprint_realloc_gauge((u_char **) & buf, &buf_len, &out_len, 0,
+                             var, enums, hint, units))
+        return (int) out_len;
+    else
+        return -1;
+}
+
+int
+snprint_counter(char *buf, size_t buf_len,
+                const netsnmp_variable_list * var, const struct enum_list *enums,
+                const char *hint, const char *units)
+{
+    size_t          out_len = 0;
+    if (sprint_realloc_counter((u_char **) & buf, &buf_len, &out_len, 0,
+                               var, enums, hint, units))
+        return (int) out_len;
+    else
+        return -1;
+}
+
+int
+snprint_networkaddress(char *buf, size_t buf_len,
+                       const netsnmp_variable_list * var,
+                       const struct enum_list *enums, const char *hint,
+                       const char *units)
+{
+    size_t          out_len = 0;
+    if (sprint_realloc_networkaddress
+        ((u_char **) & buf, &buf_len, &out_len, 0, var, enums, hint,
+         units))
+        return (int) out_len;
+    else
+        return -1;
+}
+
+int
+snprint_ipaddress(char *buf, size_t buf_len,
+                  const netsnmp_variable_list * var, const struct enum_list *enums,
+                  const char *hint, const char *units)
+{
+    size_t          out_len = 0;
+    if (sprint_realloc_ipaddress((u_char **) & buf, &buf_len, &out_len, 0,
+                                 var, enums, hint, units))
+        return (int) out_len;
+    else
+        return -1;
+}
+
+int
+snprint_null(char *buf, size_t buf_len,
+             const netsnmp_variable_list * var, const struct enum_list *enums,
+             const char *hint, const char *units)
+{
+    size_t          out_len = 0;
+    if (sprint_realloc_null((u_char **) & buf, &buf_len, &out_len, 0,
+                            var, enums, hint, units))
+        return (int) out_len;
+    else
+        return -1;
+}
+
+int
+snprint_bitstring(char *buf, size_t buf_len,
+                  const netsnmp_variable_list * var, const struct enum_list *enums,
+                  const char *hint, const char *units)
+{
+    size_t          out_len = 0;
+    if (sprint_realloc_bitstring((u_char **) & buf, &buf_len, &out_len, 0,
+                                 var, enums, hint, units))
+        return (int) out_len;
+    else
+        return -1;
+}
+
+int
+snprint_nsapaddress(char *buf, size_t buf_len,
+                    const netsnmp_variable_list * var, const struct enum_list *enums,
+                    const char *hint, const char *units)
+{
+    size_t          out_len = 0;
+    if (sprint_realloc_nsapaddress
+        ((u_char **) & buf, &buf_len, &out_len, 0, var, enums, hint,
+         units))
+        return (int) out_len;
+    else
+        return -1;
+}
+
+int
+snprint_counter64(char *buf, size_t buf_len,
+                  const netsnmp_variable_list * var, const struct enum_list *enums,
+                  const char *hint, const char *units)
+{
+    size_t          out_len = 0;
+    if (sprint_realloc_counter64((u_char **) & buf, &buf_len, &out_len, 0,
+                                 var, enums, hint, units))
+        return (int) out_len;
+    else
+        return -1;
+}
+
+int
+snprint_badtype(char *buf, size_t buf_len,
+                const netsnmp_variable_list * var, const struct enum_list *enums,
+                const char *hint, const char *units)
+{
+    size_t          out_len = 0;
+    if (sprint_realloc_badtype((u_char **) & buf, &buf_len, &out_len, 0,
+                               var, enums, hint, units))
+        return (int) out_len;
+    else
+        return -1;
+}
+
+#ifdef OPAQUE_SPECIAL_TYPES
+int
+snprint_float(char *buf, size_t buf_len,
+              const netsnmp_variable_list * var, const struct enum_list *enums,
+              const char *hint, const char *units)
+{
+    size_t          out_len = 0;
+    if (sprint_realloc_float((u_char **) & buf, &buf_len, &out_len, 0,
+                             var, enums, hint, units))
+        return (int) out_len;
+    else
+        return -1;
+}
+
+int
+snprint_double(char *buf, size_t buf_len,
+               const netsnmp_variable_list * var, const struct enum_list *enums,
+               const char *hint, const char *units)
+{
+    size_t          out_len = 0;
+    if (sprint_realloc_double((u_char **) & buf, &buf_len, &out_len, 0,
+                              var, enums, hint, units))
+        return (int) out_len;
+    else
+        return -1;
+}
+#endif
diff -Naur tomato/release/src/router/snmp/snmplib/mt_support.c tomato121/release/src/router/snmp/snmplib/mt_support.c
--- tomato/release/src/router/snmp/snmplib/mt_support.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/snmplib/mt_support.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,165 @@
+/*
+ * mt_support.c - multi-thread resource locking support 
+ */
+/*
+ * Author: Markku Laukkanen
+ * Created: 6-Sep-1999
+ * History:
+ *  8-Sep-1999 M. Slifcak method names changed;
+ *                        use array of resource locking structures.
+ */
+
+#include <net-snmp/net-snmp-config.h>
+#include <errno.h>
+#include <net-snmp/library/mt_support.h>
+
+#ifdef __cplusplus
+extern          "C" {
+#endif
+
+#ifdef NS_REENTRANT
+
+static mutex_type s_res[MT_MAX_IDS][MT_LIB_MAXIMUM];  /* locking structures */
+
+static mutex_type *
+_mt_res(int groupID, int resourceID)
+{
+    if (groupID < 1) {
+	return 0;
+    }
+    if (groupID >= MT_MAX_IDS) {
+	return 0;
+    }
+    if (resourceID < 1) {
+	return 0;
+    }
+    if (resourceID >= MT_LIB_MAXIMUM) {
+	return 0;
+    }
+    return (&s_res[groupID][resourceID]);
+}
+
+static int
+snmp_res_init_mutex(mutex_type *mutex)
+{
+    int rc = 0;
+#if HAVE_PTHREAD_H
+    rc = pthread_mutex_init(mutex, MT_MUTEX_INIT_DEFAULT);
+#elif defined(WIN32)
+    InitializeCriticalSection(mutex);
+#endif
+
+    return rc;
+}
+
+int
+snmp_res_init(void)
+{
+    int ii, jj, rc = 0;
+    mutex_type *mutex;
+
+    for (jj = 0; (0 == rc) && (jj < MT_MAX_IDS); jj++) {
+	for (ii = 0; (0 == rc) && (ii < MT_LIB_MAXIMUM); ii++) {
+	    mutex = _mt_res(jj, ii);
+	    if (!mutex) {
+		continue;
+	    }
+	    rc = snmp_res_init_mutex(mutex);
+	}
+    }
+
+    return rc;
+}
+
+int
+snmp_res_destroy_mutex(int groupID, int resourceID)
+{
+    int rc = 0;
+    mutex_type *mutex = _mt_res(groupID, resourceID);
+    if (!mutex) {
+	return EFAULT;
+    }
+
+#if HAVE_PTHREAD_H
+    rc = pthread_mutex_destroy(mutex);
+#elif defined(WIN32)
+    DeleteCriticalSection(mutex);
+#endif
+
+    return rc;
+}
+
+int
+snmp_res_lock(int groupID, int resourceID)
+{
+    int rc = 0;
+    mutex_type *mutex = _mt_res(groupID, resourceID);
+    
+    if (!mutex) {
+	return EFAULT;
+    }
+
+#if HAVE_PTHREAD_H
+    rc = pthread_mutex_lock(mutex);
+#elif defined(WIN32)
+    EnterCriticalSection(mutex);
+#endif
+
+    return rc;
+}
+
+int
+snmp_res_unlock(int groupID, int resourceID)
+{
+    int rc = 0;
+    mutex_type *mutex = _mt_res(groupID, resourceID);
+
+    if (!mutex) {
+	return EFAULT;
+    }
+
+#if HAVE_PTHREAD_H
+    rc = pthread_mutex_unlock(mutex);
+#elif defined(WIN32)
+    LeaveCriticalSection(mutex);
+#endif
+
+    return rc;
+}
+
+#else  /*  NS_REENTRANT  */
+#ifdef WIN32
+
+/*
+ * Provide "do nothing" targets for Release (.DLL) builds. 
+ */
+
+int
+snmp_res_init(void)
+{
+    return 0;
+}
+
+int
+snmp_res_lock(int groupID, int resourceID)
+{
+    return 0;
+}
+
+int
+snmp_res_unlock(int groupID, int resourceID)
+{
+    return 0;
+}
+
+int
+snmp_res_destroy_mutex(int groupID, int resourceID)
+{
+    return 0;
+}
+#endif /*  WIN32  */
+#endif /*  NS_REENTRANT  */
+
+#ifdef __cplusplus
+};
+#endif
diff -Naur tomato/release/src/router/snmp/snmplib/oid_stash.c tomato121/release/src/router/snmp/snmplib/oid_stash.c
--- tomato/release/src/router/snmp/snmplib/oid_stash.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/snmplib/oid_stash.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,279 @@
+#include <net-snmp/net-snmp-config.h>
+
+#include <string.h>
+
+#include <stdlib.h>
+#include <sys/types.h>
+
+#if HAVE_DMALLOC_H
+#include <dmalloc.h>
+#endif
+
+#include <net-snmp/net-snmp-includes.h>
+
+/*
+ * xxx-rks: when you have some spare time:
+ *
+ * a) add get-next access
+ * 
+ * b) basically, everything currently creates one node per sub-oid,
+ *    which is less than optimal. add code to create nodes with the
+ *    longest possible OID per node, and split nodes when necessary
+ *    during adds.
+ *
+ * c) If you are feeling really ambitious, also merge split nodes if
+ *    possible on a delete.
+ *
+ */
+
+/***************************************************************************
+ *
+ *
+ ***************************************************************************/
+
+/*
+ * Create an netsnmp_oid_stash node
+ *
+ * @param mysize  the size of the child pointer array
+ *
+ * @return NULL on error, otherwise the newly allocated node
+ */
+netsnmp_oid_stash_node *
+netsnmp_oid_stash_create_sized_node(size_t mysize)
+{
+    netsnmp_oid_stash_node *ret;
+    ret = SNMP_MALLOC_TYPEDEF(netsnmp_oid_stash_node);
+    if (!ret)
+        return NULL;
+    ret->children = calloc(mysize, sizeof(netsnmp_oid_stash_node *));
+    if (!ret->children) {
+        free(ret);
+        return NULL;
+    }
+    ret->children_size = mysize;
+    return ret;
+}
+
+NETSNMP_INLINE netsnmp_oid_stash_node *
+netsnmp_oid_stash_create_node(void)
+{
+    return netsnmp_oid_stash_create_sized_node(OID_STASH_CHILDREN_SIZE);
+}
+
+/** adds data to the stash at a given oid.
+ * returns SNMPERR_SUCCESS on success.
+ * returns SNMPERR_GENERR if data is already there.
+ * returns SNMPERR_MALLOC on malloc failures or if arguments passed in
+ *   with NULL values.
+ */
+int
+netsnmp_oid_stash_add_data(netsnmp_oid_stash_node **root,
+                           oid * lookup, size_t lookup_len, void *mydata)
+{
+    netsnmp_oid_stash_node *curnode, *tmpp, *loopp;
+    unsigned int    i;
+
+    if (!root || !lookup || lookup_len == 0)
+        return SNMPERR_GENERR;
+
+    if (!*root) {
+        *root = netsnmp_oid_stash_create_node();
+        if (!*root)
+            return SNMPERR_MALLOC;
+    }
+    tmpp = NULL;
+    for (curnode = *root, i = 0; i < lookup_len; i++) {
+        tmpp = curnode->children[lookup[i] % curnode->children_size];
+        if (!tmpp) {
+            /*
+             * no child in array at all 
+             */
+            tmpp = curnode->children[lookup[i] % curnode->children_size] =
+                netsnmp_oid_stash_create_node();
+            tmpp->value = lookup[i];
+        } else {
+            for (loopp = tmpp; loopp; loopp = loopp->next_sibling) {
+                if (loopp->value == lookup[i])
+                    break;
+            }
+            if (loopp) {
+                tmpp = loopp;
+            } else {
+                /*
+                 * none exists.  Create it 
+                 */
+                loopp = netsnmp_oid_stash_create_node();
+                loopp->value = lookup[i];
+                loopp->next_sibling = tmpp;
+                tmpp->prev_sibling = loopp;
+                curnode->children[lookup[i] % curnode->children_size] =
+                    loopp;
+                tmpp = loopp;
+            }
+            /*
+             * tmpp now points to the proper node 
+             */
+        }
+        curnode = tmpp;
+    }
+    /*
+     * tmpp now points to the exact match 
+     */
+    if (curnode->thedata)
+        return SNMPERR_GENERR;
+    if (NULL == tmpp)
+        return SNMPERR_GENERR;
+    tmpp->thedata = mydata;
+    return SNMPERR_SUCCESS;
+}
+
+/** returns a node associated with a given OID.
+ */
+netsnmp_oid_stash_node *
+netsnmp_oid_stash_get_node(netsnmp_oid_stash_node *root,
+                           oid * lookup, size_t lookup_len)
+{
+    netsnmp_oid_stash_node *curnode, *tmpp, *loopp;
+    unsigned int    i;
+
+    if (!root)
+        return NULL;
+    tmpp = NULL;
+    for (curnode = root, i = 0; i < lookup_len; i++) {
+        tmpp = curnode->children[lookup[i] % curnode->children_size];
+        if (!tmpp) {
+            return NULL;
+        } else {
+            for (loopp = tmpp; loopp; loopp = loopp->next_sibling) {
+                if (loopp->value == lookup[i])
+                    break;
+            }
+            if (loopp) {
+                tmpp = loopp;
+            } else {
+                return NULL;
+            }
+        }
+        curnode = tmpp;
+    }
+    return tmpp;
+}
+
+/** returns a data pointer associated with a given OID.
+ */
+void           *
+netsnmp_oid_stash_get_data(netsnmp_oid_stash_node *root,
+                           oid * lookup, size_t lookup_len)
+{
+    netsnmp_oid_stash_node *ret;
+    ret = netsnmp_oid_stash_get_node(root, lookup, lookup_len);
+    if (ret)
+        return ret->thedata;
+    return NULL;
+}
+
+int
+netsnmp_oid_stash_store_all(int majorID, int minorID,
+                            void *serverarg, void *clientarg) {
+    oid oidbase[MAX_OID_LEN];
+    netsnmp_oid_stash_save_info *sinfo;
+    
+    if (!clientarg)
+        return SNMP_ERR_NOERROR;
+    
+    sinfo = clientarg;
+    netsnmp_oid_stash_store(*(sinfo->root), sinfo->token, sinfo->dumpfn,
+                            oidbase,0);
+    return SNMP_ERR_NOERROR;
+}
+
+void
+netsnmp_oid_stash_store(netsnmp_oid_stash_node *root,
+                        const char *tokenname, NetSNMPStashDump *dumpfn,
+                        oid *curoid, size_t curoid_len) {
+
+    char buf[SNMP_MAXBUF];
+    netsnmp_oid_stash_node *tmpp;
+    char *cp;
+    char *appname = netsnmp_ds_get_string(NETSNMP_DS_LIBRARY_ID, 
+                                          NETSNMP_DS_LIB_APPTYPE);
+    int i;
+    
+    if (!tokenname || !root || !curoid || !dumpfn)
+        return;
+
+    for (i = 0; i < root->children_size; i++) {
+        if (root->children[i]) {
+            for (tmpp = root->children[i]; tmpp; tmpp = tmpp->next_sibling) {
+                curoid[curoid_len] = tmpp->value;
+                if (tmpp->thedata) {
+                    snprintf(buf, sizeof(buf), "%s ", tokenname);
+                    cp = read_config_save_objid(buf+strlen(buf), curoid,
+                                                curoid_len+1);
+                    *cp++ = ' ';
+                    *cp = '\0';
+                    if ((*dumpfn)(cp, sizeof(buf) - strlen(buf),
+                                  tmpp->thedata, tmpp))
+                        read_config_store(appname, buf);
+                }
+                netsnmp_oid_stash_store(tmpp, tokenname, dumpfn,
+                                        curoid, curoid_len+1);
+            }
+        }
+    }
+}
+
+void
+oid_stash_dump(netsnmp_oid_stash_node *root, char *prefix)
+{
+    char            myprefix[MAX_OID_LEN * 4];
+    netsnmp_oid_stash_node *tmpp;
+    int             prefix_len = strlen(prefix) + 1;    /* actually it's +2 */
+    unsigned int    i;
+
+    memset(myprefix, ' ', MAX_OID_LEN * 4);
+    myprefix[prefix_len] = '\0';
+
+    for (i = 0; i < root->children_size; i++) {
+        if (root->children[i]) {
+            for (tmpp = root->children[i]; tmpp; tmpp = tmpp->next_sibling) {
+                printf("%s%ld@%d:\n", prefix, tmpp->value, i);
+                oid_stash_dump(tmpp, myprefix);
+            }
+        }
+    }
+}
+
+void netsnmp_oid_stash_free(netsnmp_oid_stash_node **root,
+                            NetSNMPStashFreeNode *freefn) {
+     netsnmp_oid_stash_node *curnode, *tmpp;
+     unsigned int    i;
+
+     if (!root || !*root)
+         return;
+ 
+     /* loop through all our children and free each node */
+     for (i = 0; i < (*root)->children_size; i++) {
+         if ((*root)->children[i]) {
+             for(tmpp = (*root)->children[i]; tmpp; tmpp = curnode) {
+                 if (tmpp->thedata) {
+                     if (freefn)
+                         (*freefn)(tmpp->thedata);
+                     else
+                         free(tmpp->thedata);
+		 }
+		 curnode = tmpp->next_sibling;
+		 netsnmp_oid_stash_free(&tmpp, freefn);
+	     }
+	 }
+     }
+     free((*root)->children);
+     free (*root);
+     *root = NULL;
+}
+
+
+void netsnmp_oid_stash_no_free(void *bogus)
+{
+     /* noop */
+}
diff -Naur tomato/release/src/router/snmp/snmplib/parse.c tomato121/release/src/router/snmp/snmplib/parse.c
--- tomato/release/src/router/snmp/snmplib/parse.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/snmplib/parse.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,5304 @@
+/*
+ * parse.c
+ *
+ * Update: 1998-09-22 <mslifcak@iss.net>
+ * Clear nbuckets in init_node_hash.
+ * New method xcalloc returns zeroed data structures.
+ * New method alloc_node encapsulates common node creation.
+ * New method to configure terminate comment at end of line.
+ * New method to configure accept underscore in labels.
+ *
+ * Update: 1998-10-10 <daves@csc.liv.ac.uk>
+ * fully qualified OID parsing patch
+ *
+ * Update: 1998-10-20 <daves@csc.liv.ac.uk>
+ * merge_anon_children patch
+ *
+ * Update: 1998-10-21 <mslifcak@iss.net>
+ * Merge_parse_objectid associates information with last node in chain.
+ */
+/* Portions of this file are subject to the following copyrights.  See
+ * the Net-SNMP's COPYING file for more details and other copyrights
+ * that may apply:
+ */
+/******************************************************************
+        Copyright 1989, 1991, 1992 by Carnegie Mellon University
+
+                      All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of CMU not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+CMU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+CMU BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+******************************************************************/
+/*
+ * Copyright © 2003 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms specified in the COPYING file
+ * distributed with the Net-SNMP package.
+ */
+#include <net-snmp/net-snmp-config.h>
+
+#include <stdio.h>
+#if HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#if HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+#include <ctype.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+
+/*
+ * Wow.  This is ugly.  -- Wes 
+ */
+#if HAVE_DIRENT_H
+# include <dirent.h>
+# define NAMLEN(dirent) strlen((dirent)->d_name)
+#else
+# define dirent direct
+# define NAMLEN(dirent) (dirent)->d_namlen
+# if HAVE_SYS_NDIR_H
+#  include <sys/ndir.h>
+# endif
+# if HAVE_SYS_DIR_H
+#  include <sys/dir.h>
+# endif
+# if HAVE_NDIR_H
+#  include <ndir.h>
+# endif
+#endif
+#if TIME_WITH_SYS_TIME
+# ifdef WIN32
+#  include <sys/timeb.h>
+# else
+#  include <sys/time.h>
+# endif
+# include <time.h>
+#else
+# if HAVE_SYS_TIME_H
+#  include <sys/time.h>
+# else
+#  include <time.h>
+# endif
+#endif
+#if HAVE_WINSOCK_H
+#include <winsock.h>
+#endif
+#if HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+#if defined(HAVE_REGEX_H) && defined(HAVE_REGCOMP)
+#include <regex.h>
+#endif
+#if HAVE_DMALLOC_H
+#include <dmalloc.h>
+#endif
+
+#include <net-snmp/types.h>
+#include <net-snmp/output_api.h>
+#include <net-snmp/config_api.h>
+#include <net-snmp/utilities.h>
+
+#include <net-snmp/library/parse.h>
+#include <net-snmp/library/mib.h>
+#include <net-snmp/library/snmp_api.h>
+
+/*
+ * This is one element of an object identifier with either an integer
+ * subidentifier, or a textual string label, or both.
+ * The subid is -1 if not present, and label is NULL if not present.
+ */
+struct subid_s {
+    int             subid;
+    int             modid;
+    char           *label;
+};
+
+#define MAXTC   1024
+struct tc {                     /* textual conventions */
+    int             type;
+    int             modid;
+    char           *descriptor;
+    char           *hint;
+    struct enum_list *enums;
+    struct range_list *ranges;
+} tclist[MAXTC];
+
+int             mibLine = 0;
+const char     *File = "(none)";
+static int      anonymous = 0;
+
+struct objgroup {
+    char           *name;
+    int             line;
+    struct objgroup *next;
+}              *objgroups = NULL, *objects = NULL, *notifs = NULL;
+
+#define SYNTAX_MASK     0x80
+/*
+ * types of tokens
+ * Tokens wiht the SYNTAX_MASK bit set are syntax tokens 
+ */
+#define CONTINUE    -1
+#define ENDOFFILE   0
+#define LABEL       1
+#define SUBTREE     2
+#define SYNTAX      3
+#define OBJID       (4 | SYNTAX_MASK)
+#define OCTETSTR    (5 | SYNTAX_MASK)
+#define INTEGER     (6 | SYNTAX_MASK)
+#define NETADDR     (7 | SYNTAX_MASK)
+#define IPADDR      (8 | SYNTAX_MASK)
+#define COUNTER     (9 | SYNTAX_MASK)
+#define GAUGE       (10 | SYNTAX_MASK)
+#define TIMETICKS   (11 | SYNTAX_MASK)
+#define KW_OPAQUE   (12 | SYNTAX_MASK)
+#define NUL         (13 | SYNTAX_MASK)
+#define SEQUENCE    14
+#define OF          15          /* SEQUENCE OF */
+#define OBJTYPE     16
+#define ACCESS      17
+#define READONLY    18
+#define READWRITE   19
+#define WRITEONLY   20
+#ifdef NOACCESS
+#undef NOACCESS                 /* agent 'NOACCESS' token */
+#endif
+#define NOACCESS    21
+#define STATUS      22
+#define MANDATORY   23
+#define KW_OPTIONAL    24
+#define OBSOLETE    25
+/*
+ * #define RECOMMENDED 26 
+ */
+#define PUNCT       27
+#define EQUALS      28
+#define NUMBER      29
+#define LEFTBRACKET 30
+#define RIGHTBRACKET 31
+#define LEFTPAREN   32
+#define RIGHTPAREN  33
+#define COMMA       34
+#define DESCRIPTION 35
+#define QUOTESTRING 36
+#define INDEX       37
+#define DEFVAL      38
+#define DEPRECATED  39
+#define SIZE        40
+#define BITSTRING   (41 | SYNTAX_MASK)
+#define NSAPADDRESS (42 | SYNTAX_MASK)
+#define COUNTER64   (43 | SYNTAX_MASK)
+#define OBJGROUP    44
+#define NOTIFTYPE   45
+#define AUGMENTS    46
+#define COMPLIANCE  47
+#define READCREATE  48
+#define UNITS       49
+#define REFERENCE   50
+#define NUM_ENTRIES 51
+#define MODULEIDENTITY 52
+#define LASTUPDATED 53
+#define ORGANIZATION 54
+#define CONTACTINFO 55
+#define UINTEGER32 (56 | SYNTAX_MASK)
+#define CURRENT     57
+#define DEFINITIONS 58
+#define END         59
+#define SEMI        60
+#define TRAPTYPE    61
+#define ENTERPRISE  62
+/*
+ * #define DISPLAYSTR (63 | SYNTAX_MASK) 
+ */
+#define BEGIN       64
+#define IMPORTS     65
+#define EXPORTS     66
+#define ACCNOTIFY   67
+#define BAR         68
+#define RANGE       69
+#define CONVENTION  70
+#define DISPLAYHINT 71
+#define FROM        72
+#define AGENTCAP    73
+#define MACRO       74
+#define IMPLIED     75
+#define SUPPORTS    76
+#define INCLUDES    77
+#define VARIATION   78
+#define REVISION    79
+#define NOTIMPL	    80
+#define OBJECTS	    81
+#define NOTIFICATIONS	82
+#define MODULE	    83
+#define MINACCESS   84
+#define PRODREL	    85
+#define WRSYNTAX    86
+#define CREATEREQ   87
+#define NOTIFGROUP  88
+#define MANDATORYGROUPS	89
+#define GROUP	    90
+#define OBJECT	    91
+#define IDENTIFIER  92
+#define CHOICE	    93
+#define LEFTSQBRACK	95
+#define RIGHTSQBRACK	96
+#define IMPLICIT    97
+#define APPSYNTAX	(98 | SYNTAX_MASK)
+#define OBJSYNTAX	(99 | SYNTAX_MASK)
+#define SIMPLESYNTAX	(100 | SYNTAX_MASK)
+#define OBJNAME		(101 | SYNTAX_MASK)
+#define NOTIFNAME	(102 | SYNTAX_MASK)
+#define VARIABLES	103
+#define UNSIGNED32	(104 | SYNTAX_MASK)
+#define INTEGER32	(105 | SYNTAX_MASK)
+/*
+ * Beware of reaching SYNTAX_MASK (0x80) 
+ */
+
+struct tok {
+    const char     *name;       /* token name */
+    int             len;        /* length not counting nul */
+    int             token;      /* value */
+    int             hash;       /* hash of name */
+    struct tok     *next;       /* pointer to next in hash table */
+};
+
+
+static struct tok tokens[] = {
+    {"obsolete", sizeof("obsolete") - 1, OBSOLETE}
+    ,
+    {"Opaque", sizeof("Opaque") - 1, KW_OPAQUE}
+    ,
+    {"optional", sizeof("optional") - 1, KW_OPTIONAL}
+    ,
+    {"LAST-UPDATED", sizeof("LAST-UPDATED") - 1, LASTUPDATED}
+    ,
+    {"ORGANIZATION", sizeof("ORGANIZATION") - 1, ORGANIZATION}
+    ,
+    {"CONTACT-INFO", sizeof("CONTACT-INFO") - 1, CONTACTINFO}
+    ,
+    {"MODULE-IDENTITY", sizeof("MODULE-IDENTITY") - 1, MODULEIDENTITY}
+    ,
+    {"MODULE-COMPLIANCE", sizeof("MODULE-COMPLIANCE") - 1, COMPLIANCE}
+    ,
+    {"DEFINITIONS", sizeof("DEFINITIONS") - 1, DEFINITIONS}
+    ,
+    {"END", sizeof("END") - 1, END}
+    ,
+    {"AUGMENTS", sizeof("AUGMENTS") - 1, AUGMENTS}
+    ,
+    {"not-accessible", sizeof("not-accessible") - 1, NOACCESS}
+    ,
+    {"write-only", sizeof("write-only") - 1, WRITEONLY}
+    ,
+    {"NsapAddress", sizeof("NsapAddress") - 1, NSAPADDRESS}
+    ,
+    {"UNITS", sizeof("Units") - 1, UNITS}
+    ,
+    {"REFERENCE", sizeof("REFERENCE") - 1, REFERENCE}
+    ,
+    {"NUM-ENTRIES", sizeof("NUM-ENTRIES") - 1, NUM_ENTRIES}
+    ,
+    {"BITSTRING", sizeof("BITSTRING") - 1, BITSTRING}
+    ,
+    {"BIT", sizeof("BIT") - 1, CONTINUE}
+    ,
+    {"BITS", sizeof("BITS") - 1, BITSTRING}
+    ,
+    {"Counter64", sizeof("Counter64") - 1, COUNTER64}
+    ,
+    {"TimeTicks", sizeof("TimeTicks") - 1, TIMETICKS}
+    ,
+    {"NOTIFICATION-TYPE", sizeof("NOTIFICATION-TYPE") - 1, NOTIFTYPE}
+    ,
+    {"OBJECT-GROUP", sizeof("OBJECT-GROUP") - 1, OBJGROUP}
+    ,
+    {"OBJECT-IDENTITY", sizeof("OBJECT-IDENTITY") - 1, OBJGROUP}
+    ,
+    {"IDENTIFIER", sizeof("IDENTIFIER") - 1, IDENTIFIER}
+    ,
+    {"OBJECT", sizeof("OBJECT") - 1, OBJECT}
+    ,
+    {"NetworkAddress", sizeof("NetworkAddress") - 1, NETADDR}
+    ,
+    {"Gauge", sizeof("Gauge") - 1, GAUGE}
+    ,
+    {"Gauge32", sizeof("Gauge32") - 1, GAUGE}
+    ,
+    {"Unsigned32", sizeof("Unsigned32") - 1, UNSIGNED32}
+    ,
+    {"read-write", sizeof("read-write") - 1, READWRITE}
+    ,
+    {"read-create", sizeof("read-create") - 1, READCREATE}
+    ,
+    {"OCTETSTRING", sizeof("OCTETSTRING") - 1, OCTETSTR}
+    ,
+    {"OCTET", sizeof("OCTET") - 1, CONTINUE}
+    ,
+    {"OF", sizeof("OF") - 1, OF}
+    ,
+    {"SEQUENCE", sizeof("SEQUENCE") - 1, SEQUENCE}
+    ,
+    {"NULL", sizeof("NULL") - 1, NUL}
+    ,
+    {"IpAddress", sizeof("IpAddress") - 1, IPADDR}
+    ,
+    {"UInteger32", sizeof("UInteger32") - 1, UINTEGER32}
+    ,
+    {"INTEGER", sizeof("INTEGER") - 1, INTEGER}
+    ,
+    {"Integer32", sizeof("Integer32") - 1, INTEGER32}
+    ,
+    {"Counter", sizeof("Counter") - 1, COUNTER}
+    ,
+    {"Counter32", sizeof("Counter32") - 1, COUNTER}
+    ,
+    {"read-only", sizeof("read-only") - 1, READONLY}
+    ,
+    {"DESCRIPTION", sizeof("DESCRIPTION") - 1, DESCRIPTION}
+    ,
+    {"INDEX", sizeof("INDEX") - 1, INDEX}
+    ,
+    {"DEFVAL", sizeof("DEFVAL") - 1, DEFVAL}
+    ,
+    {"deprecated", sizeof("deprecated") - 1, DEPRECATED}
+    ,
+    {"SIZE", sizeof("SIZE") - 1, SIZE}
+    ,
+    {"MAX-ACCESS", sizeof("MAX-ACCESS") - 1, ACCESS}
+    ,
+    {"ACCESS", sizeof("ACCESS") - 1, ACCESS}
+    ,
+    {"mandatory", sizeof("mandatory") - 1, MANDATORY}
+    ,
+    {"current", sizeof("current") - 1, CURRENT}
+    ,
+    {"STATUS", sizeof("STATUS") - 1, STATUS}
+    ,
+    {"SYNTAX", sizeof("SYNTAX") - 1, SYNTAX}
+    ,
+    {"OBJECT-TYPE", sizeof("OBJECT-TYPE") - 1, OBJTYPE}
+    ,
+    {"TRAP-TYPE", sizeof("TRAP-TYPE") - 1, TRAPTYPE}
+    ,
+    {"ENTERPRISE", sizeof("ENTERPRISE") - 1, ENTERPRISE}
+    ,
+    {"BEGIN", sizeof("BEGIN") - 1, BEGIN}
+    ,
+    {"IMPORTS", sizeof("IMPORTS") - 1, IMPORTS}
+    ,
+    {"EXPORTS", sizeof("EXPORTS") - 1, EXPORTS}
+    ,
+    {"accessible-for-notify", sizeof("accessible-for-notify") - 1,
+     ACCNOTIFY}
+    ,
+    {"TEXTUAL-CONVENTION", sizeof("TEXTUAL-CONVENTION") - 1, CONVENTION}
+    ,
+    {"NOTIFICATION-GROUP", sizeof("NOTIFICATION-GROUP") - 1, NOTIFGROUP}
+    ,
+    {"DISPLAY-HINT", sizeof("DISPLAY-HINT") - 1, DISPLAYHINT}
+    ,
+    {"FROM", sizeof("FROM") - 1, FROM}
+    ,
+    {"AGENT-CAPABILITIES", sizeof("AGENT-CAPABILITIES") - 1, AGENTCAP}
+    ,
+    {"MACRO", sizeof("MACRO") - 1, MACRO}
+    ,
+    {"IMPLIED", sizeof("IMPLIED") - 1, IMPLIED}
+    ,
+    {"SUPPORTS", sizeof("SUPPORTS") - 1, SUPPORTS}
+    ,
+    {"INCLUDES", sizeof("INCLUDES") - 1, INCLUDES}
+    ,
+    {"VARIATION", sizeof("VARIATION") - 1, VARIATION}
+    ,
+    {"REVISION", sizeof("REVISION") - 1, REVISION}
+    ,
+    {"not-implemented", sizeof("not-implemented") - 1, NOTIMPL}
+    ,
+    {"OBJECTS", sizeof("OBJECTS") - 1, OBJECTS}
+    ,
+    {"NOTIFICATIONS", sizeof("NOTIFICATIONS") - 1, NOTIFICATIONS}
+    ,
+    {"MODULE", sizeof("MODULE") - 1, MODULE}
+    ,
+    {"MIN-ACCESS", sizeof("MIN-ACCESS") - 1, MINACCESS}
+    ,
+    {"PRODUCT-RELEASE", sizeof("PRODUCT-RELEASE") - 1, PRODREL}
+    ,
+    {"WRITE-SYNTAX", sizeof("WRITE-SYNTAX") - 1, WRSYNTAX}
+    ,
+    {"CREATION-REQUIRES", sizeof("CREATION-REQUIRES") - 1, CREATEREQ}
+    ,
+    {"MANDATORY-GROUPS", sizeof("MANDATORY-GROUPS") - 1, MANDATORYGROUPS}
+    ,
+    {"GROUP", sizeof("GROUP") - 1, GROUP}
+    ,
+    {"CHOICE", sizeof("CHOICE") - 1, CHOICE}
+    ,
+    {"IMPLICIT", sizeof("IMPLICIT") - 1, IMPLICIT}
+    ,
+    {"ObjectSyntax", sizeof("ObjectSyntax") - 1, OBJSYNTAX}
+    ,
+    {"SimpleSyntax", sizeof("SimpleSyntax") - 1, SIMPLESYNTAX}
+    ,
+    {"ApplicationSyntax", sizeof("ApplicationSyntax") - 1, APPSYNTAX}
+    ,
+    {"ObjectName", sizeof("ObjectName") - 1, OBJNAME}
+    ,
+    {"NotificationName", sizeof("NotificationName") - 1, NOTIFNAME}
+    ,
+    {"VARIABLES", sizeof("VARIABLES") - 1, VARIABLES}
+    ,
+    {NULL}
+};
+
+static struct module_compatability *module_map_head;
+static struct module_compatability module_map[] = {
+    {"RFC1065-SMI", "RFC1155-SMI", NULL, 0},
+    {"RFC1066-MIB", "RFC1156-MIB", NULL, 0},
+    /*
+     * 'mib' -> 'mib-2' 
+     */
+    {"RFC1156-MIB", "RFC1158-MIB", NULL, 0},
+    /*
+     * 'snmpEnableAuthTraps' -> 'snmpEnableAuthenTraps' 
+     */
+    {"RFC1158-MIB", "RFC1213-MIB", NULL, 0},
+    /*
+     * 'nullOID' -> 'zeroDotZero' 
+     */
+    {"RFC1155-SMI", "SNMPv2-SMI", NULL, 0},
+    {"RFC1213-MIB", "SNMPv2-SMI", "mib-2", 0},
+    {"RFC1213-MIB", "SNMPv2-MIB", "sys", 3},
+    {"RFC1213-MIB", "IF-MIB", "if", 2},
+    {"RFC1213-MIB", "IP-MIB", "ip", 2},
+    {"RFC1213-MIB", "IP-MIB", "icmp", 4},
+    {"RFC1213-MIB", "TCP-MIB", "tcp", 3},
+    {"RFC1213-MIB", "UDP-MIB", "udp", 3},
+    {"RFC1213-MIB", "SNMPv2-SMI", "transmission", 0},
+    {"RFC1213-MIB", "SNMPv2-MIB", "snmp", 4},
+    {"RFC1271-MIB", "RMON-MIB", NULL, 0},
+    {"RFC1286-MIB", "SOURCE-ROUTING-MIB", "dot1dSr", 7},
+    {"RFC1286-MIB", "BRIDGE-MIB", NULL, 0},
+    {"RFC1315-MIB", "FRAME-RELAY-DTE-MIB", NULL, 0},
+    {"RFC1316-MIB", "CHARACTER-MIB", NULL, 0},
+    {"RFC-1213", "RFC1213-MIB", NULL, 0},
+};
+
+#define MODULE_NOT_FOUND	0
+#define MODULE_LOADED_OK	1
+#define MODULE_ALREADY_LOADED	2
+/*
+ * #define MODULE_LOAD_FAILED   3       
+ */
+#define MODULE_LOAD_FAILED	MODULE_NOT_FOUND
+
+
+#define HASHSIZE        32
+#define BUCKET(x)       (x & (HASHSIZE-1))
+
+#define NHASHSIZE    128
+#define NBUCKET(x)   (x & (NHASHSIZE-1))
+
+static struct tok *buckets[HASHSIZE];
+
+static struct node *nbuckets[NHASHSIZE];
+static struct tree *tbuckets[NHASHSIZE];
+static struct module *module_head = NULL;
+
+struct node    *orphan_nodes = NULL;
+struct tree    *tree_head = NULL;
+
+#define	NUMBER_OF_ROOT_NODES	3
+static struct module_import root_imports[NUMBER_OF_ROOT_NODES];
+
+static int      current_module = 0;
+static int      max_module = 0;
+static char    *last_err_module = 0;    /* no repeats on "Cannot find module..." */
+
+static void     tree_from_node(struct tree *tp, struct node *np);
+static void     do_subtree(struct tree *, struct node **);
+static void     do_linkup(struct module *, struct node *);
+static void     dump_module_list(void);
+static int      get_token(FILE *, char *, int);
+static int      parseQuoteString(FILE *, char *, int);
+static int      tossObjectIdentifier(FILE *);
+static int      name_hash(const char *);
+static void     init_node_hash(struct node *);
+static void     print_error(const char *, const char *, int);
+static void     free_tree(struct tree *);
+static void     free_partial_tree(struct tree *, int);
+static void     free_node(struct node *);
+static void     build_translation_table(void);
+static void     init_tree_roots(void);
+static void     merge_anon_children(struct tree *, struct tree *);
+static void     unlink_tbucket(struct tree *);
+static void     unlink_tree(struct tree *);
+static int      getoid(FILE *, struct subid_s *, int);
+static struct node *parse_objectid(FILE *, char *);
+static int      get_tc(const char *, int, int *, struct enum_list **,
+                       struct range_list **, char **);
+static int      get_tc_index(const char *, int);
+static struct enum_list *parse_enumlist(FILE *, struct enum_list **);
+static struct range_list *parse_ranges(FILE * fp, struct range_list **);
+static struct node *parse_asntype(FILE *, char *, int *, char *);
+static struct node *parse_objecttype(FILE *, char *);
+static struct node *parse_objectgroup(FILE *, char *, int,
+                                      struct objgroup **);
+static struct node *parse_notificationDefinition(FILE *, char *);
+static struct node *parse_trapDefinition(FILE *, char *);
+static struct node *parse_compliance(FILE *, char *);
+static struct node *parse_capabilities(FILE *, char *);
+static struct node *parse_moduleIdentity(FILE *, char *);
+static struct node *parse_macro(FILE *, char *);
+static void     parse_imports(FILE *);
+static struct node *parse(FILE *, struct node *);
+
+static int      read_module_internal(const char *);
+static void     read_module_replacements(const char *);
+static void     read_import_replacements(const char *,
+                                         struct module_import *);
+
+static void     new_module(const char *, const char *);
+
+static struct node *merge_parse_objectid(struct node *, FILE *, char *);
+static struct index_list *getIndexes(FILE * fp, struct index_list **);
+static struct varbind_list *getVarbinds(FILE * fp, struct varbind_list **);
+static void     free_indexes(struct index_list **);
+static void     free_varbinds(struct varbind_list **);
+static void     free_ranges(struct range_list **);
+static void     free_enums(struct enum_list **);
+static struct range_list *copy_ranges(struct range_list *);
+static struct enum_list *copy_enums(struct enum_list *);
+
+static u_int    compute_match(const char *search_base, const char *key);
+
+void
+snmp_mib_toggle_options_usage(const char *lead, FILE * outf)
+{
+    fprintf(outf, "%su:  %sallow the use of underlines in MIB symbols\n",
+            lead, ((netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID,
+					   NETSNMP_DS_LIB_MIB_PARSE_LABEL)) ?
+		   "dis" : ""));
+    fprintf(outf, "%sc:  %sallow the use of \"--\" to terminate comments\n",
+            lead, ((netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID,
+					   NETSNMP_DS_LIB_MIB_COMMENT_TERM)) ?
+		   "" : "dis"));
+
+    fprintf(outf, "%sd:  %ssave the DESCRIPTIONs of the MIB objects\n",
+            lead, ((netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, 
+					   NETSNMP_DS_LIB_SAVE_MIB_DESCRS)) ?
+		   "do not " : ""));
+
+    fprintf(outf, "%se:  disable errors when MIB symbols conflict\n", lead);
+
+    fprintf(outf, "%sw:  enable warnings when MIB symbols conflict\n", lead);
+
+    fprintf(outf, "%sW:  enable detailed warnings when MIB symbols conflict\n",
+            lead);
+
+    fprintf(outf, "%sR:  replace MIB symbols from latest module\n", lead);
+}
+
+char           *
+snmp_mib_toggle_options(char *options)
+{
+    if (options) {
+        while (*options) {
+            switch (*options) {
+            case 'u':
+                netsnmp_ds_set_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_MIB_PARSE_LABEL,
+                               !netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID,
+                                               NETSNMP_DS_LIB_MIB_PARSE_LABEL));
+                break;
+
+            case 'c':
+                netsnmp_ds_toggle_boolean(NETSNMP_DS_LIBRARY_ID,
+					  NETSNMP_DS_LIB_MIB_COMMENT_TERM);
+                break;
+
+            case 'e':
+                netsnmp_ds_toggle_boolean(NETSNMP_DS_LIBRARY_ID,
+					  NETSNMP_DS_LIB_MIB_ERRORS);
+                break;
+
+            case 'w':
+                netsnmp_ds_set_int(NETSNMP_DS_LIBRARY_ID,
+				   NETSNMP_DS_LIB_MIB_WARNINGS, 1);
+                break;
+
+            case 'W':
+                netsnmp_ds_set_int(NETSNMP_DS_LIBRARY_ID,
+				   NETSNMP_DS_LIB_MIB_WARNINGS, 2);
+                break;
+
+            case 'd':
+                netsnmp_ds_toggle_boolean(NETSNMP_DS_LIBRARY_ID, 
+					  NETSNMP_DS_LIB_SAVE_MIB_DESCRS);
+                break;
+
+            case 'R':
+                netsnmp_ds_toggle_boolean(NETSNMP_DS_LIBRARY_ID, 
+					  NETSNMP_DS_LIB_MIB_REPLACE);
+                break;
+
+            default:
+                /*
+                 * return at the unknown option 
+                 */
+                return options;
+            }
+            options++;
+        }
+    }
+    return NULL;
+}
+
+static int
+name_hash(const char *name)
+{
+    int             hash = 0;
+    const char     *cp;
+
+    if (!name)
+        return 0;
+    for (cp = name; *cp; cp++)
+        hash += tolower(*cp);
+    return (hash);
+}
+
+void
+init_mib_internals(void)
+{
+    register struct tok *tp;
+    register int    b, i;
+    int             max_modc;
+
+    if (tree_head)
+        return;
+
+    /*
+     * Set up hash list of pre-defined tokens
+     */
+    memset(buckets, 0, sizeof(buckets));
+    for (tp = tokens; tp->name; tp++) {
+        tp->hash = name_hash(tp->name);
+        b = BUCKET(tp->hash);
+        if (buckets[b])
+            tp->next = buckets[b];      /* BUG ??? */
+        buckets[b] = tp;
+    }
+
+    /*
+     * Initialise other internal structures
+     */
+
+    max_modc = sizeof(module_map) / sizeof(module_map[0]) - 1;
+    for (i = 0; i < max_modc; ++i)
+        module_map[i].next = &(module_map[i + 1]);
+    module_map[max_modc].next = NULL;
+    module_map_head = module_map;
+
+    memset(nbuckets, 0, sizeof(nbuckets));
+    memset(tbuckets, 0, sizeof(tbuckets));
+    memset(tclist, 0, MAXTC * sizeof(struct tc));
+    build_translation_table();
+    init_tree_roots();          /* Set up initial roots */
+    /*
+     * Relies on 'add_mibdir' having set up the modules 
+     */
+}
+
+static void
+init_node_hash(struct node *nodes)
+{
+    struct node    *np, *nextp;
+    int             hash;
+
+    memset(nbuckets, 0, sizeof(nbuckets));
+    for (np = nodes; np;) {
+        nextp = np->next;
+        hash = NBUCKET(name_hash(np->parent));
+        np->next = nbuckets[hash];
+        nbuckets[hash] = np;
+        np = nextp;
+    }
+}
+
+static int      erroneousMibs = 0;
+
+int
+get_mib_parse_error_count(void)
+{
+    return erroneousMibs;
+}
+
+
+static void
+print_error(const char *string, const char *token, int type)
+{
+    erroneousMibs++;
+    DEBUGMSGTL(("parse-mibs", "\n"));
+    if (type == ENDOFFILE)
+        snmp_log(LOG_ERR, "%s (EOF): At line %d in %s\n", string, mibLine,
+                 File);
+    else if (token && *token)
+        snmp_log(LOG_ERR, "%s (%s): At line %d in %s\n", string, token,
+                 mibLine, File);
+    else
+        snmp_log(LOG_ERR, "%s: At line %d in %s\n", string, mibLine, File);
+}
+
+static void
+print_module_not_found(const char *cp)
+{
+    if (!last_err_module || strcmp(cp, last_err_module))
+        print_error("Cannot find module", cp, CONTINUE);
+    if (last_err_module)
+        free(last_err_module);
+    last_err_module = strdup(cp);
+}
+
+static struct node *
+alloc_node(int modid)
+{
+    struct node    *np;
+    np = (struct node *) calloc(1, sizeof(struct node));
+    if (np) {
+        np->tc_index = -1;
+        np->modid = modid;
+	np->filename = strdup(File);
+	np->lineno = mibLine;
+    }
+    return np;
+}
+
+static void
+unlink_tbucket(struct tree *tp)
+{
+    int             hash = NBUCKET(name_hash(tp->label));
+    struct tree    *otp = NULL, *ntp = tbuckets[hash];
+
+    while (ntp && ntp != tp) {
+        otp = ntp;
+        ntp = ntp->next;
+    }
+    if (!ntp)
+        snmp_log(LOG_EMERG, "Can't find %s in tbuckets\n", tp->label);
+    else if (otp)
+        otp->next = ntp->next;
+    else
+        tbuckets[hash] = tp->next;
+}
+
+static void
+unlink_tree(struct tree *tp)
+{
+    struct tree    *otp = NULL, *ntp = tp->parent;
+
+    if (!ntp) {                 /* this tree has no parent */
+        DEBUGMSGTL(("unlink_tree", "Tree node %s has no parent\n",
+                    tp->label));
+    } else {
+        ntp = ntp->child_list;
+
+        while (ntp && ntp != tp) {
+            otp = ntp;
+            ntp = ntp->next_peer;
+        }
+        if (!ntp)
+            snmp_log(LOG_EMERG, "Can't find %s in %s's children\n",
+                     tp->label, tp->parent->label);
+        else if (otp)
+            otp->next_peer = ntp->next_peer;
+        else
+            tp->parent->child_list = tp->next_peer;
+    }
+
+    if (tree_head == tp)
+        tree_head = tp->next_peer;
+}
+
+static void
+free_partial_tree(struct tree *tp, int keep_label)
+{
+    if (!tp)
+        return;
+
+    /*
+     * remove the data from this tree node 
+     */
+    free_enums(&tp->enums);
+    free_ranges(&tp->ranges);
+    free_indexes(&tp->indexes);
+    free_varbinds(&tp->varbinds);
+    if (!keep_label)
+        SNMP_FREE(tp->label);
+    SNMP_FREE(tp->hint);
+    SNMP_FREE(tp->units);
+    SNMP_FREE(tp->description);
+    SNMP_FREE(tp->augments);
+    SNMP_FREE(tp->defaultValue);
+}
+
+/*
+ * free a tree node. Note: the node must already have been unlinked
+ * from the tree when calling this routine
+ */
+static void
+free_tree(struct tree *Tree)
+{
+    if (!Tree)
+        return;
+
+    unlink_tbucket(Tree);
+    free_partial_tree(Tree, FALSE);
+    if (Tree->number_modules > 1)
+        free((char *) Tree->module_list);
+    free((char *) Tree);
+}
+
+static void
+free_node(struct node *np)
+{
+    if (!np)
+        return;
+
+    free_enums(&np->enums);
+    free_ranges(&np->ranges);
+    free_indexes(&np->indexes);
+    free_varbinds(&np->varbinds);
+    if (np->label)
+        free(np->label);
+    if (np->hint)
+        free(np->hint);
+    if (np->units)
+        free(np->units);
+    if (np->description)
+        free(np->description);
+    if (np->defaultValue)
+        free(np->defaultValue);
+    if (np->parent)
+        free(np->parent);
+    if (np->augments)
+        free(np->augments);
+    if (np->filename)
+	free(np->filename);
+    free((char *) np);
+}
+
+#ifdef TEST
+static void
+print_nodes(FILE * fp, struct node *root)
+{
+    extern void     xmalloc_stats(FILE *);
+    struct enum_list *ep;
+    struct index_list *ip;
+    struct range_list *rp;
+    struct varbind_list *vp;
+    struct node    *np;
+
+    for (np = root; np; np = np->next) {
+        fprintf(fp, "%s ::= { %s %ld } (%d)\n", np->label, np->parent,
+                np->subid, np->type);
+        if (np->tc_index >= 0)
+            fprintf(fp, "  TC = %s\n", tclist[np->tc_index].descriptor);
+        if (np->enums) {
+            fprintf(fp, "  Enums: \n");
+            for (ep = np->enums; ep; ep = ep->next) {
+                fprintf(fp, "    %s(%d)\n", ep->label, ep->value);
+            }
+        }
+        if (np->ranges) {
+            fprintf(fp, "  Ranges: \n");
+            for (rp = np->ranges; rp; rp = rp->next) {
+                fprintf(fp, "    %d..%d\n", rp->low, rp->high);
+            }
+        }
+        if (np->indexes) {
+            fprintf(fp, "  Indexes: \n");
+            for (ip = np->indexes; ip; ip = ip->next) {
+                fprintf(fp, "    %s\n", ip->ilabel);
+            }
+        }
+        if (np->augments)
+            fprintf(fp, "  Augments: %s\n", np->augments);
+        if (np->varbinds) {
+            fprintf(fp, "  Varbinds: \n");
+            for (vp = np->varbinds; vp; vp = vp->next) {
+                fprintf(fp, "    %s\n", vp->vblabel);
+            }
+        }
+        if (np->hint)
+            fprintf(fp, "  Hint: %s\n", np->hint);
+        if (np->units)
+            fprintf(fp, "  Units: %s\n", np->units);
+        if (np->defaultValue)
+            fprintf(fp, "  DefaultValue: %s\n", np->defaultValue);
+    }
+}
+#endif
+
+void
+print_subtree(FILE * f, struct tree *tree, int count)
+{
+    struct tree    *tp;
+    int             i;
+    char            modbuf[256];
+
+    for (i = 0; i < count; i++)
+        fprintf(f, "  ");
+    fprintf(f, "Children of %s(%ld):\n", tree->label, tree->subid);
+    count++;
+    for (tp = tree->child_list; tp; tp = tp->next_peer) {
+        for (i = 0; i < count; i++)
+            fprintf(f, "  ");
+        fprintf(f, "%s:%s(%ld) type=%d",
+                module_name(tp->module_list[0], modbuf),
+                tp->label, tp->subid, tp->type);
+        if (tp->tc_index != -1)
+            fprintf(f, " tc=%d", tp->tc_index);
+        if (tp->hint)
+            fprintf(f, " hint=%s", tp->hint);
+        if (tp->units)
+            fprintf(f, " units=%s", tp->units);
+        if (tp->number_modules > 1) {
+            fprintf(f, " modules:");
+            for (i = 1; i < tp->number_modules; i++)
+                fprintf(f, " %s", module_name(tp->module_list[i], modbuf));
+        }
+        fprintf(f, "\n");
+    }
+    for (tp = tree->child_list; tp; tp = tp->next_peer) {
+        if (tp->child_list)
+            print_subtree(f, tp, count);
+    }
+}
+
+void
+print_ascii_dump_tree(FILE * f, struct tree *tree, int count)
+{
+    struct tree    *tp;
+
+    count++;
+    for (tp = tree->child_list; tp; tp = tp->next_peer) {
+        fprintf(f, "%s OBJECT IDENTIFIER ::= { %s %ld }\n", tp->label,
+                tree->label, tp->subid);
+    }
+    for (tp = tree->child_list; tp; tp = tp->next_peer) {
+        if (tp->child_list)
+            print_ascii_dump_tree(f, tp, count);
+    }
+}
+
+static int      translation_table[256];
+
+static void
+build_translation_table()
+{
+    int             count;
+
+    for (count = 0; count < 256; count++) {
+        switch (count) {
+        case OBJID:
+            translation_table[count] = TYPE_OBJID;
+            break;
+        case OCTETSTR:
+            translation_table[count] = TYPE_OCTETSTR;
+            break;
+        case INTEGER:
+            translation_table[count] = TYPE_INTEGER;
+            break;
+        case NETADDR:
+            translation_table[count] = TYPE_NETADDR;
+            break;
+        case IPADDR:
+            translation_table[count] = TYPE_IPADDR;
+            break;
+        case COUNTER:
+            translation_table[count] = TYPE_COUNTER;
+            break;
+        case GAUGE:
+            translation_table[count] = TYPE_GAUGE;
+            break;
+        case TIMETICKS:
+            translation_table[count] = TYPE_TIMETICKS;
+            break;
+        case KW_OPAQUE:
+            translation_table[count] = TYPE_OPAQUE;
+            break;
+        case NUL:
+            translation_table[count] = TYPE_NULL;
+            break;
+        case COUNTER64:
+            translation_table[count] = TYPE_COUNTER64;
+            break;
+        case BITSTRING:
+            translation_table[count] = TYPE_BITSTRING;
+            break;
+        case NSAPADDRESS:
+            translation_table[count] = TYPE_NSAPADDRESS;
+            break;
+        case INTEGER32:
+            translation_table[count] = TYPE_INTEGER32;
+            break;
+        case UINTEGER32:
+            translation_table[count] = TYPE_UINTEGER;
+            break;
+        case UNSIGNED32:
+            translation_table[count] = TYPE_UNSIGNED32;
+            break;
+        case TRAPTYPE:
+            translation_table[count] = TYPE_TRAPTYPE;
+            break;
+        case NOTIFTYPE:
+            translation_table[count] = TYPE_NOTIFTYPE;
+            break;
+        case OBJGROUP:
+            translation_table[count] = TYPE_OBJGROUP;
+            break;
+        case MODULEIDENTITY:
+            translation_table[count] = TYPE_MODID;
+            break;
+        case AGENTCAP:
+            translation_table[count] = TYPE_AGENTCAP;
+            break;
+        case COMPLIANCE:
+            translation_table[count] = TYPE_MODCOMP;
+            break;
+        default:
+            translation_table[count] = TYPE_OTHER;
+            break;
+        }
+    }
+}
+
+static void
+init_tree_roots()
+{
+    struct tree    *tp, *lasttp;
+    int             base_modid;
+    int             hash;
+
+    base_modid = which_module("SNMPv2-SMI");
+    if (base_modid == -1)
+        base_modid = which_module("RFC1155-SMI");
+    if (base_modid == -1)
+        base_modid = which_module("RFC1213-MIB");
+
+    /*
+     * build root node 
+     */
+    tp = (struct tree *) calloc(1, sizeof(struct tree));
+    if (tp == NULL)
+        return;
+    tp->label = strdup("joint-iso-ccitt");
+    tp->modid = base_modid;
+    tp->number_modules = 1;
+    tp->module_list = &(tp->modid);
+    tp->subid = 2;
+    tp->tc_index = -1;
+    set_function(tp);           /* from mib.c */
+    hash = NBUCKET(name_hash(tp->label));
+    tp->next = tbuckets[hash];
+    tbuckets[hash] = tp;
+    lasttp = tp;
+    root_imports[0].label = strdup(tp->label);
+    root_imports[0].modid = base_modid;
+
+    /*
+     * build root node 
+     */
+    tp = (struct tree *) calloc(1, sizeof(struct tree));
+    if (tp == NULL)
+        return;
+    tp->next_peer = lasttp;
+    tp->label = strdup("ccitt");
+    tp->modid = base_modid;
+    tp->number_modules = 1;
+    tp->module_list = &(tp->modid);
+    tp->subid = 0;
+    tp->tc_index = -1;
+    set_function(tp);           /* from mib.c */
+    hash = NBUCKET(name_hash(tp->label));
+    tp->next = tbuckets[hash];
+    tbuckets[hash] = tp;
+    lasttp = tp;
+    root_imports[1].label = strdup(tp->label);
+    root_imports[1].modid = base_modid;
+
+    /*
+     * build root node 
+     */
+    tp = (struct tree *) calloc(1, sizeof(struct tree));
+    if (tp == NULL)
+        return;
+    tp->next_peer = lasttp;
+    tp->label = strdup("iso");
+    tp->modid = base_modid;
+    tp->number_modules = 1;
+    tp->module_list = &(tp->modid);
+    tp->subid = 1;
+    tp->tc_index = -1;
+    set_function(tp);           /* from mib.c */
+    hash = NBUCKET(name_hash(tp->label));
+    tp->next = tbuckets[hash];
+    tbuckets[hash] = tp;
+    lasttp = tp;
+    root_imports[2].label = strdup(tp->label);
+    root_imports[2].modid = base_modid;
+
+    tree_head = tp;
+}
+
+#ifdef STRICT_MIB_PARSEING
+#define	label_compare	strcasecmp
+#else
+#define	label_compare	strcmp
+#endif
+
+
+struct tree    *
+find_tree_node(const char *name, int modid)
+{
+    struct tree    *tp, *headtp;
+    int             count, *int_p;
+
+    if (!name || !*name)
+        return (NULL);
+
+    headtp = tbuckets[NBUCKET(name_hash(name))];
+    for (tp = headtp; tp; tp = tp->next) {
+        if (tp->label && !label_compare(tp->label, name)) {
+
+            if (modid == -1)    /* Any module */
+                return (tp);
+
+            for (int_p = tp->module_list, count = 0;
+                 count < tp->number_modules; ++count, ++int_p)
+                if (*int_p == modid)
+                    return (tp);
+        }
+    }
+
+    return (NULL);
+}
+
+/*
+ * computes a value which represents how close name1 is to name2.
+ * * high scores mean a worse match.
+ * * (yes, the algorithm sucks!)
+ */
+#define MAX_BAD 0xffffff
+
+static          u_int
+compute_match(const char *search_base, const char *key)
+{
+#if defined(HAVE_REGEX_H) && defined(HAVE_REGCOMP)
+    int             rc;
+    regex_t         parsetree;
+    regmatch_t      pmatch;
+
+    rc = regcomp(&parsetree, key, REG_ICASE | REG_EXTENDED);
+    if (rc == 0)
+        rc = regexec(&parsetree, search_base, 1, &pmatch, 0);
+    regfree(&parsetree);
+    if (rc == 0) {
+        /*
+         * found 
+         */
+        return pmatch.rm_so;
+    }
+#else                           /* use our own wildcard matcher */
+    /*
+     * first find the longest matching substring (ick) 
+     */
+    char           *first = NULL, *result = NULL, *entry;
+    const char     *position;
+    char           *newkey = strdup(key);
+
+
+    entry = strtok(newkey, "*");
+    position = search_base;
+    while (entry) {
+        result = strcasestr(position, entry);
+
+        if (result == NULL) {
+            free(newkey);
+            return MAX_BAD;
+        }
+
+        if (first == NULL)
+            first = result;
+
+        position = result + strlen(entry);
+        entry = strtok(NULL, "*");
+    }
+    free(newkey);
+    if (result)
+        return (first - search_base);
+#endif
+
+    /*
+     * not found 
+     */
+    return MAX_BAD;
+}
+
+/*
+ * Find the tree node that best matches the pattern string.
+ * Use the "reported" flag such that only one match
+ * is attempted for every node.
+ *
+ * Warning! This function may recurse.
+ *
+ * Caller _must_ invoke clear_tree_flags before first call
+ * to this function.  This function may be called multiple times
+ * to ensure that the entire tree is traversed.
+ */
+
+struct tree    *
+find_best_tree_node(const char *pattrn, struct tree *tree_top,
+                    u_int * match)
+{
+    struct tree    *tp, *best_so_far = NULL, *retptr;
+    u_int           old_match = MAX_BAD, new_match = MAX_BAD;
+
+    if (!pattrn || !*pattrn)
+        return (NULL);
+
+    if (!tree_top)
+        tree_top = get_tree_head();
+
+    for (tp = tree_top; tp; tp = tp->next_peer) {
+        if (!tp->reported && tp->label)
+            new_match = compute_match(tp->label, pattrn);
+        tp->reported = 1;
+
+        if (new_match < old_match) {
+            best_so_far = tp;
+            old_match = new_match;
+        }
+        if (new_match == 0)
+            break;              /* this is the best result we can get */
+        if (tp->child_list) {
+            retptr =
+                find_best_tree_node(pattrn, tp->child_list, &new_match);
+            if (new_match < old_match) {
+                best_so_far = retptr;
+                old_match = new_match;
+            }
+            if (new_match == 0)
+                break;          /* this is the best result we can get */
+        }
+    }
+
+    if (match)
+        *match = old_match;
+    return (best_so_far);
+}
+
+
+static void
+merge_anon_children(struct tree *tp1, struct tree *tp2)
+                /*
+                 * NB: tp1 is the 'anonymous' node 
+                 */
+{
+    struct tree    *child1, *child2, *previous;
+
+    for (child1 = tp1->child_list; child1;) {
+
+        for (child2 = tp2->child_list, previous = NULL;
+             child2; previous = child2, child2 = child2->next_peer) {
+
+            if (child1->subid == child2->subid) {
+                /*
+                 * Found 'matching' children,
+                 *  so merge them
+                 */
+                if (!strncmp(child1->label, ANON, ANON_LEN)) {
+                    merge_anon_children(child1, child2);
+
+                    child1->child_list = NULL;
+                    previous = child1;  /* Finished with 'child1' */
+                    child1 = child1->next_peer;
+                    free_tree(previous);
+                    goto next;
+                }
+
+                else if (!strncmp(child2->label, ANON, ANON_LEN)) {
+                    merge_anon_children(child2, child1);
+
+                    if (previous)
+                        previous->next_peer = child2->next_peer;
+                    else
+                        tp2->child_list = child2->next_peer;
+                    free_tree(child2);
+
+                    previous = child1;  /* Move 'child1' to 'tp2' */
+                    child1 = child1->next_peer;
+                    previous->next_peer = tp2->child_list;
+                    tp2->child_list = previous;
+                    for (previous = tp2->child_list;
+                         previous; previous = previous->next_peer)
+                        previous->parent = tp2;
+                    goto next;
+                } else if (!label_compare(child1->label, child2->label)) {
+                    if (netsnmp_ds_get_int(NETSNMP_DS_LIBRARY_ID, 
+					   NETSNMP_DS_LIB_MIB_WARNINGS)) {
+                        snmp_log(LOG_WARNING,
+                                 "Warning: %s.%ld is both %s and %s (%s)\n",
+                                 tp2->label, child1->subid, child1->label,
+                                 child2->label, File);
+		    }
+                    continue;
+                } else {
+                    /*
+                     * Two copies of the same node.
+                     * 'child2' adopts the children of 'child1'
+                     */
+
+                    if (child2->child_list) {
+                        for (previous = child2->child_list; previous->next_peer; previous = previous->next_peer);       /* Find the end of the list */
+                        previous->next_peer = child1->child_list;
+                    } else
+                        child2->child_list = child1->child_list;
+                    for (previous = child1->child_list;
+                         previous; previous = previous->next_peer)
+                        previous->parent = child2;
+                    child1->child_list = NULL;
+
+                    previous = child1;  /* Finished with 'child1' */
+                    child1 = child1->next_peer;
+                    free_tree(previous);
+                    goto next;
+                }
+            }
+        }
+        /*
+         * If no match, move 'child1' to 'tp2' child_list
+         */
+        if (child1) {
+            previous = child1;
+            child1 = child1->next_peer;
+            previous->parent = tp2;
+            previous->next_peer = tp2->child_list;
+            tp2->child_list = previous;
+        }
+      next:;
+    }
+}
+
+
+/*
+ * Find all the children of root in the list of nodes.  Link them into the
+ * tree and out of the nodes list.
+ */
+static void
+do_subtree(struct tree *root, struct node **nodes)
+{
+    struct tree    *tp, *anon_tp = NULL;
+    struct tree    *xroot = root;
+    struct node    *np, **headp;
+    struct node    *oldnp = NULL, *child_list = NULL, *childp = NULL;
+    int             hash;
+    int            *int_p;
+
+    while (xroot->next_peer && xroot->next_peer->subid == root->subid) {
+#if 0
+        printf("xroot: %s.%s => %s\n", xroot->parent->label, xroot->label,
+               xroot->next_peer->label);
+#endif
+        xroot = xroot->next_peer;
+    }
+
+    tp = root;
+    headp = &nbuckets[NBUCKET(name_hash(tp->label))];
+    /*
+     * Search each of the nodes for one whose parent is root, and
+     * move each into a separate list.
+     */
+    for (np = *headp; np; np = np->next) {
+        if (!label_compare(tp->label, np->parent)) {
+            /*
+             * take this node out of the node list 
+             */
+            if (oldnp == NULL) {
+                *headp = np->next;      /* fix root of node list */
+            } else {
+                oldnp->next = np->next; /* link around this node */
+            }
+            if (child_list)
+                childp->next = np;
+            else
+                child_list = np;
+            childp = np;
+        } else {
+            oldnp = np;
+        }
+
+    }
+    if (childp)
+        childp->next = NULL;
+    /*
+     * Take each element in the child list and place it into the tree.
+     */
+    for (np = child_list; np; np = np->next) {
+        struct tree    *otp = NULL;
+        struct tree    *xxroot = xroot;
+        anon_tp = NULL;
+        tp = xroot->child_list;
+
+        if (np->subid == -1) {
+            /*
+             * name ::= { parent } 
+             */
+            np->subid = xroot->subid;
+            tp = xroot;
+            xxroot = xroot->parent;
+        }
+
+        while (tp) {
+            if (tp->subid == np->subid)
+                break;
+            else {
+                otp = tp;
+                tp = tp->next_peer;
+            }
+        }
+        if (tp) {
+            if (!label_compare(tp->label, np->label)) {
+                /*
+                 * Update list of modules 
+                 */
+                int_p =
+                    (int *) malloc((tp->number_modules + 1) * sizeof(int));
+                if (int_p == NULL)
+                    return;
+                memcpy(int_p, tp->module_list,
+                       tp->number_modules * sizeof(int));
+                int_p[tp->number_modules] = np->modid;
+                if (tp->number_modules > 1)
+                    free((char *) tp->module_list);
+                ++tp->number_modules;
+                tp->module_list = int_p;
+
+                if (netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, 
+					   NETSNMP_DS_LIB_MIB_REPLACE)) {
+                    /*
+                     * Replace from node 
+                     */
+                    tree_from_node(tp, np);
+                }
+                /*
+                 * Handle children 
+                 */
+                do_subtree(tp, nodes);
+                continue;
+            }
+            if (!strncmp(np->label, ANON, ANON_LEN) ||
+                !strncmp(tp->label, ANON, ANON_LEN)) {
+                anon_tp = tp;   /* Need to merge these two trees later */
+            } else if (netsnmp_ds_get_int(NETSNMP_DS_LIBRARY_ID, 
+					  NETSNMP_DS_LIB_MIB_WARNINGS)) {
+                snmp_log(LOG_WARNING,
+                         "Warning: %s.%ld is both %s and %s (%s)\n",
+                         root->label, np->subid, tp->label, np->label,
+                         File);
+	    }
+        }
+
+        tp = (struct tree *) calloc(1, sizeof(struct tree));
+        if (tp == NULL)
+            return;
+        tp->parent = xxroot;
+        tp->modid = np->modid;
+        tp->number_modules = 1;
+        tp->module_list = &(tp->modid);
+        tree_from_node(tp, np);
+        tp->next_peer = otp ? otp->next_peer : xxroot->child_list;
+        if (otp)
+            otp->next_peer = tp;
+        else
+            xxroot->child_list = tp;
+        hash = NBUCKET(name_hash(tp->label));
+        tp->next = tbuckets[hash];
+        tbuckets[hash] = tp;
+        do_subtree(tp, nodes);
+
+        if (anon_tp) {
+            if (!strncmp(tp->label, ANON, ANON_LEN)) {
+                /*
+                 * The new node is anonymous,
+                 *  so merge it with the existing one.
+                 */
+                merge_anon_children(tp, anon_tp);
+
+                /*
+                 * unlink and destroy tp 
+                 */
+                unlink_tree(tp);
+                free_tree(tp);
+            } else if (!strncmp(anon_tp->label, ANON, ANON_LEN)) {
+                struct tree    *ntp;
+                /*
+                 * The old node was anonymous,
+                 *  so merge it with the existing one,
+                 *  and fill in the full information.
+                 */
+                merge_anon_children(anon_tp, tp);
+
+                /*
+                 * unlink anon_tp from the hash 
+                 */
+                unlink_tbucket(anon_tp);
+
+                /*
+                 * get rid of old contents of anon_tp 
+                 */
+                free_partial_tree(anon_tp, FALSE);
+
+                /*
+                 * put in the current information 
+                 */
+                anon_tp->label = tp->label;
+                anon_tp->child_list = tp->child_list;
+                anon_tp->modid = tp->modid;
+                anon_tp->tc_index = tp->tc_index;
+                anon_tp->type = tp->type;
+                anon_tp->enums = tp->enums;
+                anon_tp->indexes = tp->indexes;
+                anon_tp->augments = tp->augments;
+                anon_tp->varbinds = tp->varbinds;
+                anon_tp->ranges = tp->ranges;
+                anon_tp->hint = tp->hint;
+                anon_tp->units = tp->units;
+                anon_tp->description = tp->description;
+                anon_tp->defaultValue = tp->defaultValue;
+                anon_tp->parent = tp->parent;
+
+                set_function(anon_tp);
+
+                /*
+                 * update parent pointer in moved children 
+                 */
+                ntp = anon_tp->child_list;
+                while (ntp) {
+                    ntp->parent = anon_tp;
+                    ntp = ntp->next_peer;
+                }
+
+                /*
+                 * hash in anon_tp in its new place 
+                 */
+                hash = NBUCKET(name_hash(anon_tp->label));
+                anon_tp->next = tbuckets[hash];
+                tbuckets[hash] = anon_tp;
+
+                /*
+                 * unlink and destroy tp 
+                 */
+                unlink_tbucket(tp);
+                unlink_tree(tp);
+                free(tp);
+            } else {
+                /*
+                 * Uh?  One of these two should have been anonymous! 
+                 */
+                if (netsnmp_ds_get_int(NETSNMP_DS_LIBRARY_ID, 
+				       NETSNMP_DS_LIB_MIB_WARNINGS)) {
+                    snmp_log(LOG_WARNING,
+                             "Warning: expected anonymous node (either %s or %s) in %s\n",
+                             tp->label, anon_tp->label, File);
+		}
+            }
+            anon_tp = NULL;
+        }
+    }
+    /*
+     * free all nodes that were copied into tree 
+     */
+    oldnp = NULL;
+    for (np = child_list; np; np = np->next) {
+        if (oldnp)
+            free_node(oldnp);
+        oldnp = np;
+    }
+    if (oldnp)
+        free_node(oldnp);
+}
+
+static void
+do_linkup(struct module *mp, struct node *np)
+{
+    struct module_import *mip;
+    struct node    *onp, *oldp, *newp;
+    struct tree    *tp;
+    int             i, more;
+    /*
+     * All modules implicitly import
+     *   the roots of the tree
+     */
+    if (snmp_get_do_debugging() > 1)
+        dump_module_list();
+    DEBUGMSGTL(("parse-mibs", "Processing IMPORTS for module %d %s\n",
+                mp->modid, mp->name));
+    if (mp->no_imports == 0) {
+        mp->no_imports = NUMBER_OF_ROOT_NODES;
+        mp->imports = root_imports;
+    }
+
+    /*
+     * Build the tree
+     */
+    init_node_hash(np);
+    for (i = 0, mip = mp->imports; i < mp->no_imports; ++i, ++mip) {
+        char            modbuf[256];
+        DEBUGMSGTL(("parse-mibs", "  Processing import: %s\n",
+                    mip->label));
+        if (get_tc_index(mip->label, mip->modid) != -1)
+            continue;
+        tp = find_tree_node(mip->label, mip->modid);
+        if (!tp) {
+            if (mip->modid != -1)
+                snmp_log(LOG_WARNING,
+                         "Did not find '%s' in module %s (%s)\n",
+                         mip->label, module_name(mip->modid, modbuf),
+                         File);
+            continue;
+        }
+        do_subtree(tp, &np);
+    }
+
+    /*
+     * If any nodes left over,
+     *   check that they're not the result of a "fully qualified"
+     *   name, and then add them to the list of orphans
+     */
+
+    if (!np)
+        return;
+    for (tp = tree_head; tp; tp = tp->next_peer)
+        do_subtree(tp, &np);
+    if (!np)
+        return;
+
+    /*
+     * quietly move all internal references to the orphan list 
+     */
+    oldp = orphan_nodes;
+    do {
+        for (i = 0; i < NHASHSIZE; i++)
+            for (onp = nbuckets[i]; onp; onp = onp->next) {
+                struct node    *op = NULL;
+                int             hash = NBUCKET(name_hash(onp->label));
+                np = nbuckets[hash];
+                while (np) {
+                    if (label_compare(onp->label, np->parent)) {
+                        op = np;
+                        np = np->next;
+                    } else {
+                        if (op)
+                            op->next = np->next;
+                        else
+                            nbuckets[hash] = np->next;
+                        np->next = orphan_nodes;
+                        orphan_nodes = np;
+                        op = NULL;
+                        np = nbuckets[hash];
+                    }
+                }
+            }
+        newp = orphan_nodes;
+        more = 0;
+        for (onp = orphan_nodes; onp != oldp; onp = onp->next) {
+            struct node    *op = NULL;
+            int             hash = NBUCKET(name_hash(onp->label));
+            np = nbuckets[hash];
+            while (np) {
+                if (label_compare(onp->label, np->parent)) {
+                    op = np;
+                    np = np->next;
+                } else {
+                    if (op)
+                        op->next = np->next;
+                    else
+                        nbuckets[hash] = np->next;
+                    np->next = orphan_nodes;
+                    orphan_nodes = np;
+                    op = NULL;
+                    np = nbuckets[hash];
+                    more = 1;
+                }
+            }
+        }
+        oldp = newp;
+    } while (more);
+
+    /*
+     * complain about left over nodes 
+     */
+    for (np = orphan_nodes; np && np->next; np = np->next);     /* find the end of the orphan list */
+    for (i = 0; i < NHASHSIZE; i++)
+        if (nbuckets[i]) {
+            if (orphan_nodes)
+                onp = np->next = nbuckets[i];
+            else
+                onp = orphan_nodes = nbuckets[i];
+            nbuckets[i] = NULL;
+            while (onp) {
+                snmp_log(LOG_WARNING,
+                         "Unlinked OID in %s: %s ::= { %s %ld }\n",
+                         (mp->name ? mp->name : "<no module>"),
+                         (onp->label ? onp->label : "<no label>"),
+                         (onp->parent ? onp->parent : "<no parent>"),
+                         onp->subid);
+		 snmp_log(LOG_WARNING,
+			  "Undefined identifier: %s near line %d of %s\n",
+			  (onp->parent ? onp->parent : "<no parent>"),
+			  onp->lineno, onp->filename);
+                np = onp;
+                onp = onp->next;
+            }
+        }
+    return;
+}
+
+
+/*
+ * Takes a list of the form:
+ * { iso org(3) dod(6) 1 }
+ * and creates several nodes, one for each parent-child pair.
+ * Returns 0 on error.
+ */
+static int
+getoid(FILE * fp, struct subid_s *id,   /* an array of subids */
+       int length)
+{                               /* the length of the array */
+    register int    count;
+    int             type;
+    char            token[MAXTOKEN];
+
+    if ((type = get_token(fp, token, MAXTOKEN)) != LEFTBRACKET) {
+        print_error("Expected \"{\"", token, type);
+        return 0;
+    }
+    type = get_token(fp, token, MAXTOKEN);
+    for (count = 0; count < length; count++, id++) {
+        id->label = NULL;
+        id->modid = current_module;
+        id->subid = -1;
+        if (type == RIGHTBRACKET)
+            return count;
+        if (type == LABEL) {
+            /*
+             * this entry has a label 
+             */
+            id->label = strdup(token);
+            type = get_token(fp, token, MAXTOKEN);
+            if (type == LEFTPAREN) {
+                type = get_token(fp, token, MAXTOKEN);
+                if (type == NUMBER) {
+                    id->subid = strtoul(token, NULL, 10);
+                    if ((type =
+                         get_token(fp, token, MAXTOKEN)) != RIGHTPAREN) {
+                        print_error("Expected a closing parenthesis",
+                                    token, type);
+                        return 0;
+                    }
+                } else {
+                    print_error("Expected a number", token, type);
+                    return 0;
+                }
+            } else {
+                continue;
+            }
+        } else if (type == NUMBER) {
+            /*
+             * this entry  has just an integer sub-identifier 
+             */
+            id->subid = strtoul(token, NULL, 10);
+        } else {
+            print_error("Expected label or number", token, type);
+            return 0;
+        }
+        type = get_token(fp, token, MAXTOKEN);
+    }
+    print_error("Too long OID", token, type);
+    return 0;
+}
+
+/*
+ * Parse a sequence of object subidentifiers for the given name.
+ * The "label OBJECT IDENTIFIER ::=" portion has already been parsed.
+ *
+ * The majority of cases take this form :
+ * label OBJECT IDENTIFIER ::= { parent 2 }
+ * where a parent label and a child subidentifier number are specified.
+ *
+ * Variations on the theme include cases where a number appears with
+ * the parent, or intermediate subidentifiers are specified by label,
+ * by number, or both.
+ *
+ * Here are some representative samples :
+ * internet        OBJECT IDENTIFIER ::= { iso org(3) dod(6) 1 }
+ * mgmt            OBJECT IDENTIFIER ::= { internet 2 }
+ * rptrInfoHealth  OBJECT IDENTIFIER ::= { snmpDot3RptrMgt 0 4 }
+ *
+ * Here is a very rare form :
+ * iso             OBJECT IDENTIFIER ::= { 1 }
+ *
+ * Returns NULL on error.  When this happens, memory may be leaked.
+ */
+static struct node *
+parse_objectid(FILE * fp, char *name)
+{
+    register int    count;
+    register struct subid_s *op, *nop;
+    int             length;
+    struct subid_s  loid[32];
+    struct node    *np, *root = NULL, *oldnp = NULL;
+    struct tree    *tp;
+
+    if ((length = getoid(fp, loid, 32)) == 0) {
+        print_error("Bad object identifier", NULL, CONTINUE);
+        return NULL;
+    }
+
+    /*
+     * Handle numeric-only object identifiers,
+     *  by labelling the first sub-identifier
+     */
+    op = loid;
+    if (!op->label)
+        for (tp = tree_head; tp; tp = tp->next_peer)
+            if ((int) tp->subid == op->subid) {
+                op->label = strdup(tp->label);
+                break;
+            }
+
+    /*
+     * Handle  "label OBJECT-IDENTIFIER ::= { subid }"
+     */
+    if (length == 1) {
+        op = loid;
+        np = alloc_node(op->modid);
+        if (np == NULL)
+            return (NULL);
+        np->subid = op->subid;
+        np->label = strdup(name);
+        np->parent = op->label;
+        return np;
+    }
+
+    /*
+     * For each parent-child subid pair in the subid array,
+     * create a node and link it into the node list.
+     */
+    for (count = 0, op = loid, nop = loid + 1; count < (length - 1);
+         count++, op++, nop++) {
+        /*
+         * every node must have parent's name and child's name or number 
+         */
+        /*
+         * XX the next statement is always true -- does it matter ?? 
+         */
+        if (op->label && (nop->label || (nop->subid != -1))) {
+            np = alloc_node(nop->modid);
+            if (np == NULL)
+                return (NULL);
+            if (root == NULL)
+                root = np;
+
+            np->parent = strdup(op->label);
+            if (count == (length - 2)) {
+                /*
+                 * The name for this node is the label for this entry 
+                 */
+                np->label = strdup(name);
+            } else {
+                if (!nop->label) {
+                    nop->label = (char *) malloc(20 + ANON_LEN);
+                    if (nop->label == NULL)
+                        return (NULL);
+                    sprintf(nop->label, "%s%d", ANON, anonymous++);
+                }
+                np->label = strdup(nop->label);
+            }
+            if (nop->subid != -1)
+                np->subid = nop->subid;
+            else
+                print_error("Warning: This entry is pretty silly",
+                            np->label, CONTINUE);
+
+            /*
+             * set up next entry 
+             */
+            if (oldnp)
+                oldnp->next = np;
+            oldnp = np;
+        }                       /* end if(op->label... */
+    }
+
+    /*
+     * free the loid array 
+     */
+    for (count = 0, op = loid; count < length; count++, op++) {
+        if (op->label)
+            free(op->label);
+    }
+
+    return root;
+}
+
+static int
+get_tc(const char *descriptor,
+       int modid,
+       int *tc_index,
+       struct enum_list **ep, struct range_list **rp, char **hint)
+{
+    int             i;
+    struct tc      *tcp;
+
+    i = get_tc_index(descriptor, modid);
+    if (tc_index)
+        *tc_index = i;
+    if (i != -1) {
+        tcp = &tclist[i];
+        if (ep) {
+            free_enums(ep);
+            *ep = copy_enums(tcp->enums);
+        }
+        if (rp) {
+            free_ranges(rp);
+            *rp = copy_ranges(tcp->ranges);
+        }
+        if (hint) {
+            if (*hint)
+                free(*hint);
+            *hint = (tcp->hint ? strdup(tcp->hint) : NULL);
+        }
+        return tcp->type;
+    }
+    return LABEL;
+}
+
+/*
+ * return index into tclist of given TC descriptor
+ * return -1 if not found
+ */
+static int
+get_tc_index(const char *descriptor, int modid)
+{
+    int             i;
+    struct tc      *tcp;
+    struct module  *mp;
+    struct module_import *mip;
+
+    /*
+     * Check that the descriptor isn't imported
+     *  by searching the import list
+     */
+
+    for (mp = module_head; mp; mp = mp->next)
+        if (mp->modid == modid)
+            break;
+    if (mp)
+        for (i = 0, mip = mp->imports; i < mp->no_imports; ++i, ++mip) {
+            if (!label_compare(mip->label, descriptor)) {
+                /*
+                 * Found it - so amend the module ID 
+                 */
+                modid = mip->modid;
+                break;
+            }
+        }
+
+
+    for (i = 0, tcp = tclist; i < MAXTC; i++, tcp++) {
+        if (tcp->type == 0)
+            break;
+        if (!label_compare(descriptor, tcp->descriptor) &&
+            ((modid == tcp->modid) || (modid == -1))) {
+            return i;
+        }
+    }
+    return -1;
+}
+
+/*
+ * translate integer tc_index to string identifier from tclist
+ * *
+ * * Returns pointer to string in table (should not be modified) or NULL
+ */
+const char     *
+get_tc_descriptor(int tc_index)
+{
+    if (tc_index < 0 || tc_index >= MAXTC)
+        return NULL;
+    return (tclist[tc_index].descriptor);
+}
+
+
+/*
+ * Parses an enumeration list of the form:
+ *        { label(value) label(value) ... }
+ * The initial { has already been parsed.
+ * Returns NULL on error.
+ */
+
+static struct enum_list *
+parse_enumlist(FILE * fp, struct enum_list **retp)
+{
+    register int    type;
+    char            token[MAXTOKEN];
+    struct enum_list *ep = NULL, **epp = &ep;
+
+    free_enums(retp);
+
+    while ((type = get_token(fp, token, MAXTOKEN)) != ENDOFFILE) {
+        if (type == RIGHTBRACKET)
+            break;
+        if (type == LABEL) {
+            /*
+             * this is an enumerated label 
+             */
+            *epp =
+                (struct enum_list *) calloc(1, sizeof(struct enum_list));
+            if (*epp == NULL)
+                return (NULL);
+            /*
+             * a reasonable approximation for the length 
+             */
+            (*epp)->label = strdup(token);
+            type = get_token(fp, token, MAXTOKEN);
+            if (type != LEFTPAREN) {
+                print_error("Expected \"(\"", token, type);
+                return NULL;
+            }
+            type = get_token(fp, token, MAXTOKEN);
+            if (type != NUMBER) {
+                print_error("Expected integer", token, type);
+                return NULL;
+            }
+            (*epp)->value = strtol(token, NULL, 10);
+            type = get_token(fp, token, MAXTOKEN);
+            if (type != RIGHTPAREN) {
+                print_error("Expected \")\"", token, type);
+                return NULL;
+            }
+            epp = &(*epp)->next;
+        }
+    }
+    if (type == ENDOFFILE) {
+        print_error("Expected \"}\"", token, type);
+        return NULL;
+    }
+    *retp = ep;
+    return ep;
+}
+
+static struct range_list *
+parse_ranges(FILE * fp, struct range_list **retp)
+{
+    int             low, high;
+    char            nexttoken[MAXTOKEN];
+    int             nexttype;
+    struct range_list *rp = NULL, **rpp = &rp;
+    int             size = 0, taken = 1;
+
+    free_ranges(retp);
+
+    nexttype = get_token(fp, nexttoken, MAXTOKEN);
+    if (nexttype == SIZE) {
+        size = 1;
+        taken = 0;
+        nexttype = get_token(fp, nexttoken, MAXTOKEN);
+        if (nexttype != LEFTPAREN)
+            print_error("Expected \"(\" after SIZE", nexttoken, nexttype);
+    }
+
+    do {
+        if (!taken)
+            nexttype = get_token(fp, nexttoken, MAXTOKEN);
+        else
+            taken = 0;
+        high = low = strtol(nexttoken, NULL, 10);
+        nexttype = get_token(fp, nexttoken, MAXTOKEN);
+        if (nexttype == RANGE) {
+            nexttype = get_token(fp, nexttoken, MAXTOKEN);
+            high = strtol(nexttoken, NULL, 10);
+            nexttype = get_token(fp, nexttoken, MAXTOKEN);
+        }
+        *rpp = (struct range_list *) calloc(1, sizeof(struct range_list));
+        if (*rpp == NULL)
+            break;
+        (*rpp)->low = low;
+        (*rpp)->high = high;
+        rpp = &(*rpp)->next;
+
+    } while (nexttype == BAR);
+    if (size) {
+        if (nexttype != RIGHTPAREN)
+            print_error("Expected \")\" after SIZE", nexttoken, nexttype);
+        nexttype = get_token(fp, nexttoken, nexttype);
+    }
+    if (nexttype != RIGHTPAREN)
+        print_error("Expected \")\"", nexttoken, nexttype);
+
+    *retp = rp;
+    return rp;
+}
+
+/*
+ * Parses an asn type.  Structures are ignored by this parser.
+ * Returns NULL on error.
+ */
+static struct node *
+parse_asntype(FILE * fp, char *name, int *ntype, char *ntoken)
+{
+    int             type, i;
+    char            token[MAXTOKEN];
+    char            quoted_string_buffer[MAXQUOTESTR];
+    char           *hint = NULL;
+    struct tc      *tcp;
+    int             level;
+
+    type = get_token(fp, token, MAXTOKEN);
+    if (type == SEQUENCE || type == CHOICE) {
+        level = 0;
+        while ((type = get_token(fp, token, MAXTOKEN)) != ENDOFFILE) {
+            if (type == LEFTBRACKET) {
+                level++;
+            } else if (type == RIGHTBRACKET && --level == 0) {
+                *ntype = get_token(fp, ntoken, MAXTOKEN);
+                return NULL;
+            }
+        }
+        print_error("Expected \"}\"", token, type);
+        return NULL;
+    } else if (type == LEFTBRACKET) {
+        struct node    *np;
+        int             ch_next = '{';
+        ungetc(ch_next, fp);
+        np = parse_objectid(fp, name);
+        if (np != NULL) {
+            *ntype = get_token(fp, ntoken, MAXTOKEN);
+            return np;
+        }
+        return NULL;
+    } else if (type == LEFTSQBRACK) {
+        int             size = 0;
+        do {
+            type = get_token(fp, token, MAXTOKEN);
+        } while (type != ENDOFFILE && type != RIGHTSQBRACK);
+        if (type != RIGHTSQBRACK) {
+            print_error("Expected \"]\"", token, type);
+            return NULL;
+        }
+        type = get_token(fp, token, MAXTOKEN);
+        if (type == IMPLICIT)
+            type = get_token(fp, token, MAXTOKEN);
+        *ntype = get_token(fp, ntoken, MAXTOKEN);
+        if (*ntype == LEFTPAREN) {
+            switch (type) {
+            case OCTETSTR:
+                *ntype = get_token(fp, ntoken, MAXTOKEN);
+                if (*ntype != SIZE) {
+                    print_error("Expected SIZE", ntoken, *ntype);
+                    return NULL;
+                }
+                size = 1;
+                *ntype = get_token(fp, ntoken, MAXTOKEN);
+                if (*ntype != LEFTPAREN) {
+                    print_error("Expected \"(\" after SIZE", ntoken,
+                                *ntype);
+                    return NULL;
+                }
+                /*
+                 * fall through 
+                 */
+            case INTEGER:
+                *ntype = get_token(fp, ntoken, MAXTOKEN);
+                do {
+                    if (*ntype != NUMBER)
+                        print_error("Expected NUMBER", ntoken, *ntype);
+                    *ntype = get_token(fp, ntoken, MAXTOKEN);
+                    if (*ntype == RANGE) {
+                        *ntype = get_token(fp, ntoken, MAXTOKEN);
+                        if (*ntype != NUMBER)
+                            print_error("Expected NUMBER", ntoken, *ntype);
+                        *ntype = get_token(fp, ntoken, MAXTOKEN);
+                    }
+                } while (*ntype == BAR);
+                if (*ntype != RIGHTPAREN) {
+                    print_error("Expected \")\"", ntoken, *ntype);
+                    return NULL;
+                }
+                *ntype = get_token(fp, ntoken, MAXTOKEN);
+                if (size) {
+                    if (*ntype != RIGHTPAREN) {
+                        print_error("Expected \")\" to terminate SIZE",
+                                    ntoken, *ntype);
+                        return NULL;
+                    }
+                    *ntype = get_token(fp, ntoken, MAXTOKEN);
+                }
+            }
+        }
+        return NULL;
+    } else {
+        if (type == CONVENTION) {
+            while (type != SYNTAX && type != ENDOFFILE) {
+                if (type == DISPLAYHINT) {
+                    type = get_token(fp, token, MAXTOKEN);
+                    if (type != QUOTESTRING)
+                        print_error("DISPLAY-HINT must be string", token,
+                                    type);
+                    else
+                        hint = strdup(token);
+                } else
+                    type =
+                        get_token(fp, quoted_string_buffer, MAXQUOTESTR);
+            }
+            type = get_token(fp, token, MAXTOKEN);
+            if (type == OBJECT) {
+                type = get_token(fp, token, MAXTOKEN);
+                if (type != IDENTIFIER) {
+                    print_error("Expected IDENTIFIER", token, type);
+                    SNMP_FREE(hint);
+                    return NULL;
+                }
+                type = OBJID;
+            }
+        } else if (type == OBJECT) {
+            type = get_token(fp, token, MAXTOKEN);
+            if (type != IDENTIFIER) {
+                print_error("Expected IDENTIFIER", token, type);
+                return NULL;
+            }
+            type = OBJID;
+        }
+
+        if (type == LABEL) {
+            type = get_tc(token, current_module, NULL, NULL, NULL, NULL);
+        }
+
+        /*
+         * textual convention 
+         */
+        for (i = 0; i < MAXTC; i++) {
+            if (tclist[i].type == 0)
+                break;
+        }
+
+        if (i == MAXTC) {
+            print_error("Too many textual conventions", token, type);
+            SNMP_FREE(hint);
+            return NULL;
+        }
+        if (!(type & SYNTAX_MASK)) {
+            print_error("Textual convention doesn't map to real type",
+                        token, type);
+            SNMP_FREE(hint);
+            return NULL;
+        }
+        tcp = &tclist[i];
+        tcp->modid = current_module;
+        tcp->descriptor = strdup(name);
+        tcp->hint = hint;
+        tcp->type = type;
+        *ntype = get_token(fp, ntoken, MAXTOKEN);
+        if (*ntype == LEFTPAREN) {
+            tcp->ranges = parse_ranges(fp, &tcp->ranges);
+            *ntype = get_token(fp, ntoken, MAXTOKEN);
+        } else if (*ntype == LEFTBRACKET) {
+            /*
+             * if there is an enumeration list, parse it 
+             */
+            tcp->enums = parse_enumlist(fp, &tcp->enums);
+            *ntype = get_token(fp, ntoken, MAXTOKEN);
+        }
+        return NULL;
+    }
+}
+
+
+/*
+ * Parses an OBJECT TYPE macro.
+ * Returns 0 on error.
+ */
+static struct node *
+parse_objecttype(FILE * fp, char *name)
+{
+    register int    type;
+    char            token[MAXTOKEN];
+    char            nexttoken[MAXTOKEN];
+    char            quoted_string_buffer[MAXQUOTESTR];
+    int             nexttype, tctype;
+    register struct node *np;
+
+    type = get_token(fp, token, MAXTOKEN);
+    if (type != SYNTAX) {
+        print_error("Bad format for OBJECT-TYPE", token, type);
+        return NULL;
+    }
+    np = alloc_node(current_module);
+    if (np == NULL)
+        return (NULL);
+    type = get_token(fp, token, MAXTOKEN);
+    if (type == OBJECT) {
+        type = get_token(fp, token, MAXTOKEN);
+        if (type != IDENTIFIER) {
+            print_error("Expected IDENTIFIER", token, type);
+            free_node(np);
+            return NULL;
+        }
+        type = OBJID;
+    }
+    if (type == LABEL) {
+        int             tmp_index;
+        tctype = get_tc(token, current_module, &tmp_index,
+                        &np->enums, &np->ranges, &np->hint);
+        if (tctype == LABEL &&
+            netsnmp_ds_get_int(NETSNMP_DS_LIBRARY_ID, 
+			       NETSNMP_DS_LIB_MIB_WARNINGS) > 1) {
+            print_error("Warning: No known translation for type", token,
+                        type);
+        }
+        type = tctype;
+        np->tc_index = tmp_index;       /* store TC for later reference */
+    }
+    np->type = type;
+    nexttype = get_token(fp, nexttoken, MAXTOKEN);
+    switch (type) {
+    case SEQUENCE:
+        if (nexttype == OF) {
+            nexttype = get_token(fp, nexttoken, MAXTOKEN);
+            nexttype = get_token(fp, nexttoken, MAXTOKEN);
+
+        }
+        break;
+    case INTEGER:
+    case INTEGER32:
+    case UINTEGER32:
+    case UNSIGNED32:
+    case COUNTER:
+    case GAUGE:
+    case BITSTRING:
+    case LABEL:
+        if (nexttype == LEFTBRACKET) {
+            /*
+             * if there is an enumeration list, parse it 
+             */
+            np->enums = parse_enumlist(fp, &np->enums);
+            nexttype = get_token(fp, nexttoken, MAXTOKEN);
+        } else if (nexttype == LEFTPAREN) {
+            /*
+             * if there is a range list, parse it 
+             */
+            np->ranges = parse_ranges(fp, &np->ranges);
+            nexttype = get_token(fp, nexttoken, MAXTOKEN);
+        }
+        break;
+    case OCTETSTR:
+    case KW_OPAQUE:
+        /*
+         * parse any SIZE specification 
+         */
+        if (nexttype == LEFTPAREN) {
+            nexttype = get_token(fp, nexttoken, MAXTOKEN);
+            if (nexttype == SIZE) {
+                nexttype = get_token(fp, nexttoken, MAXTOKEN);
+                if (nexttype == LEFTPAREN) {
+                    np->ranges = parse_ranges(fp, &np->ranges);
+                    nexttype = get_token(fp, nexttoken, MAXTOKEN);      /* ) */
+                    if (nexttype == RIGHTPAREN) {
+                        nexttype = get_token(fp, nexttoken, MAXTOKEN);
+                        break;
+                    }
+                }
+            }
+            print_error("Bad SIZE syntax", token, type);
+            free_node(np);
+            return NULL;
+        }
+        break;
+    case OBJID:
+    case NETADDR:
+    case IPADDR:
+    case TIMETICKS:
+    case NUL:
+    case NSAPADDRESS:
+    case COUNTER64:
+        break;
+    default:
+        print_error("Bad syntax", token, type);
+        free_node(np);
+        return NULL;
+    }
+    if (nexttype == UNITS) {
+        type = get_token(fp, quoted_string_buffer, MAXQUOTESTR);
+        if (type != QUOTESTRING) {
+            print_error("Bad UNITS", quoted_string_buffer, type);
+            free_node(np);
+            return NULL;
+        }
+        np->units = strdup(quoted_string_buffer);
+        nexttype = get_token(fp, nexttoken, MAXTOKEN);
+    }
+    if (nexttype != ACCESS) {
+        print_error("Should be ACCESS", nexttoken, nexttype);
+        free_node(np);
+        return NULL;
+    }
+    type = get_token(fp, token, MAXTOKEN);
+    if (type != READONLY && type != READWRITE && type != WRITEONLY
+        && type != NOACCESS && type != READCREATE && type != ACCNOTIFY) {
+        print_error("Bad ACCESS type", token, type);
+        free_node(np);
+        return NULL;
+    }
+    np->access = type;
+    type = get_token(fp, token, MAXTOKEN);
+    if (type != STATUS) {
+        print_error("Should be STATUS", token, type);
+        free_node(np);
+        return NULL;
+    }
+    type = get_token(fp, token, MAXTOKEN);
+    if (type != MANDATORY && type != CURRENT && type != KW_OPTIONAL &&
+        type != OBSOLETE && type != DEPRECATED) {
+        print_error("Bad STATUS", token, type);
+        free_node(np);
+        return NULL;
+    }
+    np->status = type;
+    /*
+     * Optional parts of the OBJECT-TYPE macro
+     */
+    type = get_token(fp, token, MAXTOKEN);
+    while (type != EQUALS && type != ENDOFFILE) {
+        switch (type) {
+        case DESCRIPTION:
+            type = get_token(fp, quoted_string_buffer, MAXQUOTESTR);
+
+            if (type != QUOTESTRING) {
+                print_error("Bad DESCRIPTION", quoted_string_buffer, type);
+                free_node(np);
+                return NULL;
+            }
+            if (netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, 
+				       NETSNMP_DS_LIB_SAVE_MIB_DESCRS)) {
+                np->description = strdup(quoted_string_buffer);
+            }
+            break;
+
+        case REFERENCE:
+            type = get_token(fp, quoted_string_buffer, MAXQUOTESTR);
+            if (type != QUOTESTRING) {
+                print_error("Bad REFERENCE", quoted_string_buffer, type);
+                free_node(np);
+                return NULL;
+            }
+            break;
+        case INDEX:
+            if (np->augments) {
+                print_error("Cannot have both INDEX and AUGMENTS", token,
+                            type);
+                free_node(np);
+                return NULL;
+            }
+            np->indexes = getIndexes(fp, &np->indexes);
+            if (np->indexes == NULL) {
+                print_error("Bad INDEX list", token, type);
+                free_node(np);
+                return NULL;
+            }
+            break;
+        case AUGMENTS:
+            if (np->indexes) {
+                print_error("Cannot have both INDEX and AUGMENTS", token,
+                            type);
+                free_node(np);
+                return NULL;
+            }
+            np->indexes = getIndexes(fp, &np->indexes);
+            if (np->indexes == NULL) {
+                print_error("Bad AUGMENTS list", token, type);
+                free_node(np);
+                return NULL;
+            }
+            np->augments = strdup(np->indexes->ilabel);
+            free_indexes(&np->indexes);
+            break;
+        case DEFVAL:
+            /*
+             * Mark's defVal section 
+             */
+            type = get_token(fp, quoted_string_buffer, MAXTOKEN);
+            if (type != LEFTBRACKET) {
+                print_error("Bad DEFAULTVALUE", quoted_string_buffer,
+                            type);
+                free_node(np);
+                return NULL;
+            }
+
+            {
+                int             level = 1;
+                char            defbuf[512];
+
+                defbuf[0] = 0;
+                while (1) {
+                    type = get_token(fp, quoted_string_buffer, MAXTOKEN);
+                    if ((type == RIGHTBRACKET && --level == 0)
+                        || type == ENDOFFILE)
+                        break;
+                    else if (type == LEFTBRACKET)
+                        level++;
+                    if (type == QUOTESTRING) {
+                        if (strlen(defbuf)+2 < sizeof(defbuf)) {
+                            defbuf[ strlen(defbuf)+2 ] = 0;
+                            defbuf[ strlen(defbuf)+1 ] = '"';
+                            defbuf[ strlen(defbuf)   ] = '\\';
+                        }
+                        defbuf[ sizeof(defbuf)-1 ] = 0;
+                    }
+                    strncat(defbuf, quoted_string_buffer,
+                            sizeof(defbuf)-strlen(defbuf));
+                    defbuf[ sizeof(defbuf)-1 ] = 0;
+                    if (type == QUOTESTRING) {
+                        if (strlen(defbuf)+2 < sizeof(defbuf)) {
+                            defbuf[ strlen(defbuf)+2 ] = 0;
+                            defbuf[ strlen(defbuf)+1 ] = '"';
+                            defbuf[ strlen(defbuf)   ] = '\\';
+                        }
+                        defbuf[ sizeof(defbuf)-1 ] = 0;
+                    }
+                    if (strlen(defbuf)+1 < sizeof(defbuf)) {
+                        defbuf[ strlen(defbuf)+1 ] = 0;
+                        defbuf[ strlen(defbuf)   ] = ' ';
+                    }
+                }
+
+                if (type != RIGHTBRACKET) {
+                    print_error("Bad DEFAULTVALUE", quoted_string_buffer,
+                                type);
+                    free_node(np);
+                    return NULL;
+                }
+
+                defbuf[strlen(defbuf) - 1] = 0;
+                np->defaultValue = strdup(defbuf);
+            }
+
+            break;
+
+        case NUM_ENTRIES:
+            if (tossObjectIdentifier(fp) != OBJID) {
+                print_error("Bad Object Identifier", token, type);
+                free_node(np);
+                return NULL;
+            }
+            break;
+
+        default:
+            print_error("Bad format of optional clauses", token, type);
+            free_node(np);
+            return NULL;
+
+        }
+        type = get_token(fp, token, MAXTOKEN);
+    }
+    if (type != EQUALS) {
+        print_error("Bad format", token, type);
+        free_node(np);
+        return NULL;
+    }
+    return merge_parse_objectid(np, fp, name);
+}
+
+/*
+ * Parses an OBJECT GROUP macro.
+ * Returns 0 on error.
+ *
+ * Also parses object-identity, since they are similar (ignore STATUS).
+ *   - WJH 10/96
+ */
+static struct node *
+parse_objectgroup(FILE * fp, char *name, int what, struct objgroup **ol)
+{
+    int             type;
+    char            token[MAXTOKEN];
+    char            quoted_string_buffer[MAXQUOTESTR];
+    struct node    *np;
+
+    np = alloc_node(current_module);
+    if (np == NULL)
+        return (NULL);
+    type = get_token(fp, token, MAXTOKEN);
+    if (type == what) {
+        type = get_token(fp, token, MAXTOKEN);
+        if (type != LEFTBRACKET) {
+            print_error("Expected \"{\"", token, type);
+            goto skip;
+        }
+        do {
+            struct objgroup *o;
+            type = get_token(fp, token, MAXTOKEN);
+            if (type != LABEL) {
+                print_error("Bad identifier", token, type);
+                goto skip;
+            }
+            o = (struct objgroup *) malloc(sizeof(struct objgroup));
+            o->line = mibLine;
+            o->name = strdup(token);
+            o->next = *ol;
+            *ol = o;
+            type = get_token(fp, token, MAXTOKEN);
+        } while (type == COMMA);
+        if (type != RIGHTBRACKET) {
+            print_error("Expected \"}\" after list", token, type);
+            goto skip;
+        }
+        type = get_token(fp, token, type);
+    }
+    if (type != STATUS) {
+        print_error("Expected STATUS", token, type);
+        goto skip;
+    }
+    type = get_token(fp, token, MAXTOKEN);
+    if (type != CURRENT && type != DEPRECATED && type != OBSOLETE) {
+        print_error("Bad STATUS value", token, type);
+        goto skip;
+    }
+    type = get_token(fp, token, MAXTOKEN);
+    if (type != DESCRIPTION) {
+        print_error("Expected DESCRIPTION", token, type);
+        goto skip;
+    }
+    type = get_token(fp, quoted_string_buffer, MAXQUOTESTR);
+    if (type != QUOTESTRING) {
+        print_error("Bad DESCRIPTION", quoted_string_buffer, type);
+        free_node(np);
+        return NULL;
+    }
+    if (netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, 
+			       NETSNMP_DS_LIB_SAVE_MIB_DESCRS)) {
+        np->description = strdup(quoted_string_buffer);
+    }
+    type = get_token(fp, token, MAXTOKEN);
+    if (type == REFERENCE) {
+        type = get_token(fp, quoted_string_buffer, MAXQUOTESTR);
+        if (type != QUOTESTRING) {
+            print_error("Bad REFERENCE", quoted_string_buffer, type);
+            free_node(np);
+            return NULL;
+        }
+        type = get_token(fp, token, MAXTOKEN);
+    }
+    if (type != EQUALS)
+        print_error("Expected \"::=\"", token, type);
+  skip:
+    while (type != EQUALS && type != ENDOFFILE)
+        type = get_token(fp, token, MAXTOKEN);
+
+    return merge_parse_objectid(np, fp, name);
+}
+
+/*
+ * Parses a NOTIFICATION-TYPE macro.
+ * Returns 0 on error.
+ */
+static struct node *
+parse_notificationDefinition(FILE * fp, char *name)
+{
+    register int    type;
+    char            token[MAXTOKEN];
+    char            quoted_string_buffer[MAXQUOTESTR];
+    register struct node *np;
+
+    np = alloc_node(current_module);
+    if (np == NULL)
+        return (NULL);
+    type = get_token(fp, token, MAXTOKEN);
+    while (type != EQUALS && type != ENDOFFILE) {
+        switch (type) {
+        case DESCRIPTION:
+            type = get_token(fp, quoted_string_buffer, MAXQUOTESTR);
+            if (type != QUOTESTRING) {
+                print_error("Bad DESCRIPTION", quoted_string_buffer, type);
+                free_node(np);
+                return NULL;
+            }
+            if (netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, 
+				       NETSNMP_DS_LIB_SAVE_MIB_DESCRS)) {
+                np->description = strdup(quoted_string_buffer);
+            }
+            break;
+        case OBJECTS:
+            np->varbinds = getVarbinds(fp, &np->varbinds);
+            if (!np->varbinds) {
+                print_error("Bad OBJECTS list", token, type);
+                free_node(np);
+                return NULL;
+            }
+            break;
+        default:
+            /*
+             * NOTHING 
+             */
+            break;
+        }
+        type = get_token(fp, token, MAXTOKEN);
+    }
+    return merge_parse_objectid(np, fp, name);
+}
+
+/*
+ * Parses a TRAP-TYPE macro.
+ * Returns 0 on error.
+ */
+static struct node *
+parse_trapDefinition(FILE * fp, char *name)
+{
+    register int    type;
+    char            token[MAXTOKEN];
+    char            quoted_string_buffer[MAXQUOTESTR];
+    register struct node *np;
+
+    np = alloc_node(current_module);
+    if (np == NULL)
+        return (NULL);
+    type = get_token(fp, token, MAXTOKEN);
+    while (type != EQUALS && type != ENDOFFILE) {
+        switch (type) {
+        case DESCRIPTION:
+            type = get_token(fp, quoted_string_buffer, MAXQUOTESTR);
+            if (type != QUOTESTRING) {
+                print_error("Bad DESCRIPTION", quoted_string_buffer, type);
+                free_node(np);
+                return NULL;
+            }
+            if (netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, 
+				       NETSNMP_DS_LIB_SAVE_MIB_DESCRS)) {
+                np->description = strdup(quoted_string_buffer);
+            }
+            break;
+        case ENTERPRISE:
+            type = get_token(fp, token, MAXTOKEN);
+            if (type == LEFTBRACKET) {
+                type = get_token(fp, token, MAXTOKEN);
+                if (type != LABEL) {
+                    print_error("Bad Trap Format", token, type);
+                    free_node(np);
+                    return NULL;
+                }
+                np->parent = strdup(token);
+                /*
+                 * Get right bracket 
+                 */
+                type = get_token(fp, token, MAXTOKEN);
+            } else if (type == LABEL)
+                np->parent = strdup(token);
+            break;
+        case VARIABLES:
+            np->varbinds = getVarbinds(fp, &np->varbinds);
+            if (!np->varbinds) {
+                print_error("Bad VARIABLES list", token, type);
+                free_node(np);
+                return NULL;
+            }
+            break;
+        default:
+            /*
+             * NOTHING 
+             */
+            break;
+        }
+        type = get_token(fp, token, MAXTOKEN);
+    }
+    type = get_token(fp, token, MAXTOKEN);
+
+    np->label = strdup(name);
+
+    if (type != NUMBER) {
+        print_error("Expected a Number", token, type);
+        free_node(np);
+        return NULL;
+    }
+    np->subid = strtoul(token, NULL, 10);
+    np->next = alloc_node(current_module);
+    if (np->next == NULL) {
+        free_node(np);
+        return (NULL);
+    }
+    np->next->parent = np->parent;
+    np->parent = (char *) malloc(strlen(np->parent) + 2);
+    if (np->parent == NULL) {
+        free_node(np->next);
+        free_node(np);
+        return (NULL);
+    }
+    strcpy(np->parent, np->next->parent);
+    strcat(np->parent, "#");
+    np->next->label = strdup(np->parent);
+    return np;
+}
+
+
+/*
+ * Parses a compliance macro
+ * Returns 0 on error.
+ */
+static int
+eat_syntax(FILE * fp, char *token, int maxtoken)
+{
+    int             type, nexttype;
+    struct node    *np = alloc_node(current_module);
+    char            nexttoken[MAXTOKEN];
+
+    type = get_token(fp, token, maxtoken);
+    nexttype = get_token(fp, nexttoken, MAXTOKEN);
+    switch (type) {
+    case INTEGER:
+    case INTEGER32:
+    case UINTEGER32:
+    case UNSIGNED32:
+    case COUNTER:
+    case GAUGE:
+    case BITSTRING:
+    case LABEL:
+        if (nexttype == LEFTBRACKET) {
+            /*
+             * if there is an enumeration list, parse it 
+             */
+            np->enums = parse_enumlist(fp, &np->enums);
+            nexttype = get_token(fp, nexttoken, MAXTOKEN);
+        } else if (nexttype == LEFTPAREN) {
+            /*
+             * if there is a range list, parse it 
+             */
+            np->ranges = parse_ranges(fp, &np->ranges);
+            nexttype = get_token(fp, nexttoken, MAXTOKEN);
+        }
+        break;
+    case OCTETSTR:
+    case KW_OPAQUE:
+        /*
+         * parse any SIZE specification 
+         */
+        if (nexttype == LEFTPAREN) {
+            nexttype = get_token(fp, nexttoken, MAXTOKEN);
+            if (nexttype == SIZE) {
+                nexttype = get_token(fp, nexttoken, MAXTOKEN);
+                if (nexttype == LEFTPAREN) {
+                    np->ranges = parse_ranges(fp, &np->ranges);
+                    nexttype = get_token(fp, nexttoken, MAXTOKEN);      /* ) */
+                    if (nexttype == RIGHTPAREN) {
+                        nexttype = get_token(fp, nexttoken, MAXTOKEN);
+                        break;
+                    }
+                }
+            }
+            print_error("Bad SIZE syntax", token, type);
+            free_node(np);
+            return nexttype;
+        }
+        break;
+    case OBJID:
+    case NETADDR:
+    case IPADDR:
+    case TIMETICKS:
+    case NUL:
+    case NSAPADDRESS:
+    case COUNTER64:
+        break;
+    default:
+        print_error("Bad syntax", token, type);
+        free_node(np);
+        return nexttype;
+    }
+    free_node(np);
+    return nexttype;
+}
+
+static int
+compliance_lookup(const char *name, int modid)
+{
+    if (modid == -1) {
+        struct objgroup *op =
+            (struct objgroup *) malloc(sizeof(struct objgroup));
+        op->next = objgroups;
+        op->name = strdup(name);
+        op->line = mibLine;
+        objgroups = op;
+        return 1;
+    } else
+        return find_tree_node(name, modid) != NULL;
+}
+
+static struct node *
+parse_compliance(FILE * fp, char *name)
+{
+    int             type;
+    char            token[MAXTOKEN];
+    char            quoted_string_buffer[MAXQUOTESTR];
+    struct node    *np;
+
+    np = alloc_node(current_module);
+    if (np == NULL)
+        return (NULL);
+    type = get_token(fp, token, MAXTOKEN);
+    if (type != STATUS) {
+        print_error("Expected STATUS", token, type);
+        goto skip;
+    }
+    type = get_token(fp, token, MAXTOKEN);
+    if (type != CURRENT && type != DEPRECATED && type != OBSOLETE) {
+        print_error("Bad STATUS", token, type);
+        goto skip;
+    }
+    type = get_token(fp, token, MAXTOKEN);
+    if (type != DESCRIPTION) {
+        print_error("Expected DESCRIPTION", token, type);
+        goto skip;
+    }
+    type = get_token(fp, quoted_string_buffer, MAXQUOTESTR);
+    if (type != QUOTESTRING) {
+        print_error("Bad DESCRIPTION", quoted_string_buffer, type);
+        goto skip;
+    }
+    if (netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, 
+			       NETSNMP_DS_LIB_SAVE_MIB_DESCRS))
+        np->description = strdup(quoted_string_buffer);
+    type = get_token(fp, token, MAXTOKEN);
+    if (type == REFERENCE) {
+        type = get_token(fp, quoted_string_buffer, MAXTOKEN);
+        if (type != QUOTESTRING) {
+            print_error("Bad REFERENCE", quoted_string_buffer, type);
+            goto skip;
+        }
+        type = get_token(fp, token, MAXTOKEN);
+    }
+    if (type != MODULE) {
+        print_error("Expected MODULE", token, type);
+        goto skip;
+    }
+    while (type == MODULE) {
+        int             modid = -1;
+        char            modname[MAXTOKEN];
+        type = get_token(fp, token, MAXTOKEN);
+        if (type == LABEL
+            && strcmp(token, module_name(current_module, modname))) {
+            modid = read_module_internal(token);
+            if (modid != MODULE_LOADED_OK
+                && modid != MODULE_ALREADY_LOADED) {
+                print_error("Unknown module", token, type);
+                goto skip;
+            }
+            modid = which_module(token);
+            type = get_token(fp, token, MAXTOKEN);
+        }
+        if (type == MANDATORYGROUPS) {
+            type = get_token(fp, token, MAXTOKEN);
+            if (type != LEFTBRACKET) {
+                print_error("Expected \"{\"", token, type);
+                goto skip;
+            }
+            do {
+                type = get_token(fp, token, MAXTOKEN);
+                if (type != LABEL) {
+                    print_error("Bad group name", token, type);
+                    goto skip;
+                }
+                if (!compliance_lookup(token, modid))
+                    print_error("Unknown group", token, type);
+                type = get_token(fp, token, MAXTOKEN);
+            } while (type == COMMA);
+            if (type != RIGHTBRACKET) {
+                print_error("Expected \"}\"", token, type);
+                goto skip;
+            }
+            type = get_token(fp, token, MAXTOKEN);
+        }
+        while (type == GROUP || type == OBJECT) {
+            if (type == GROUP) {
+                type = get_token(fp, token, MAXTOKEN);
+                if (type != LABEL) {
+                    print_error("Bad group name", token, type);
+                    goto skip;
+                }
+                if (!compliance_lookup(token, modid))
+                    print_error("Unknown group", token, type);
+                type = get_token(fp, token, MAXTOKEN);
+            } else {
+                type = get_token(fp, token, MAXTOKEN);
+                if (type != LABEL) {
+                    print_error("Bad object name", token, type);
+                    goto skip;
+                }
+                if (!compliance_lookup(token, modid))
+                    print_error("Unknown group", token, type);
+                type = get_token(fp, token, MAXTOKEN);
+                if (type == SYNTAX)
+                    type = eat_syntax(fp, token, MAXTOKEN);
+                if (type == WRSYNTAX)
+                    type = eat_syntax(fp, token, MAXTOKEN);
+                if (type == MINACCESS) {
+                    type = get_token(fp, token, MAXTOKEN);
+                    if (type != NOACCESS && type != ACCNOTIFY
+                        && type != READONLY && type != WRITEONLY
+                        && type != READCREATE && type != READWRITE) {
+                        print_error("Bad MIN-ACCESS spec", token, type);
+                        goto skip;
+                    }
+                    type = get_token(fp, token, MAXTOKEN);
+                }
+            }
+            if (type != DESCRIPTION) {
+                print_error("Expected DESCRIPTION", token, type);
+                goto skip;
+            }
+            type = get_token(fp, token, MAXTOKEN);
+            if (type != QUOTESTRING) {
+                print_error("Bad DESCRIPTION", token, type);
+                goto skip;
+            }
+            type = get_token(fp, token, MAXTOKEN);
+        }
+    }
+  skip:
+    while (type != EQUALS && type != ENDOFFILE)
+        type = get_token(fp, quoted_string_buffer, MAXQUOTESTR);
+
+    return merge_parse_objectid(np, fp, name);
+}
+
+
+/*
+ * Parses a capabilities macro
+ * Returns 0 on error.
+ */
+static struct node *
+parse_capabilities(FILE * fp, char *name)
+{
+    int             type;
+    char            token[MAXTOKEN];
+    char            quoted_string_buffer[MAXQUOTESTR];
+    struct node    *np;
+
+    np = alloc_node(current_module);
+    if (np == NULL)
+        return (NULL);
+    type = get_token(fp, token, MAXTOKEN);
+    if (type != PRODREL) {
+        print_error("Expected PRODUCT-RELEASE", token, type);
+        goto skip;
+    }
+    type = get_token(fp, token, MAXTOKEN);
+    if (type != QUOTESTRING) {
+        print_error("Expected STRING after PRODUCT-RELEASE", token, type);
+        goto skip;
+    }
+    type = get_token(fp, token, MAXTOKEN);
+    if (type != STATUS) {
+        print_error("Expected STATUS", token, type);
+        goto skip;
+    }
+    type = get_token(fp, token, MAXTOKEN);
+    if (type != CURRENT && type != OBSOLETE) {
+        print_error("STATUS should be current or obsolete", token, type);
+        goto skip;
+    }
+    type = get_token(fp, token, MAXTOKEN);
+    if (type != DESCRIPTION) {
+        print_error("Expected DESCRIPTION", token, type);
+        goto skip;
+    }
+    type = get_token(fp, token, MAXTOKEN);
+    if (type != QUOTESTRING) {
+        print_error("Bad DESCRIPTION", token, type);
+        goto skip;
+    }
+    if (netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, 
+			       NETSNMP_DS_LIB_SAVE_MIB_DESCRS)) {
+        np->description = strdup(token);
+    }
+    type = get_token(fp, token, MAXTOKEN);
+    if (type == REFERENCE) {
+        type = get_token(fp, token, MAXTOKEN);
+        if (type != QUOTESTRING) {
+            print_error("Bad REFERENCE", token, type);
+            goto skip;
+        }
+        type = get_token(fp, token, type);
+    }
+    while (type == SUPPORTS) {
+        int             modid;
+        struct tree    *tp;
+
+        type = get_token(fp, token, MAXTOKEN);
+        if (type != LABEL) {
+            print_error("Bad module name", token, type);
+            goto skip;
+        }
+        modid = read_module_internal(token);
+        if (modid != MODULE_LOADED_OK && modid != MODULE_ALREADY_LOADED) {
+            print_error("Module not found", token, type);
+            goto skip;
+        }
+        modid = which_module(token);
+        type = get_token(fp, token, MAXTOKEN);
+        if (type != INCLUDES) {
+            print_error("Expected INCLUDES", token, type);
+            goto skip;
+        }
+        type = get_token(fp, token, MAXTOKEN);
+        if (type != LEFTBRACKET) {
+            print_error("Expected \"{\"", token, type);
+            goto skip;
+        }
+        do {
+            type = get_token(fp, token, MAXTOKEN);
+            if (type != LABEL) {
+                print_error("Expected group name", token, type);
+                goto skip;
+            }
+            tp = find_tree_node(token, modid);
+            if (!tp)
+                print_error("Group not found in module", token, type);
+            type = get_token(fp, token, MAXTOKEN);
+        } while (type == COMMA);
+        if (type != RIGHTBRACKET) {
+            print_error("Expected \"}\" after group list", token, type);
+            goto skip;
+        }
+        type = get_token(fp, token, MAXTOKEN);
+        while (type == VARIATION) {
+            type = get_token(fp, token, MAXTOKEN);
+            if (type != LABEL) {
+                print_error("Bad object name", token, type);
+                goto skip;
+            }
+            tp = find_tree_node(token, modid);
+            if (!tp)
+                print_error("Object not found in module", token, type);
+            type = get_token(fp, token, MAXTOKEN);
+            if (type == SYNTAX) {
+                type = eat_syntax(fp, token, MAXTOKEN);
+            }
+            if (type == WRSYNTAX) {
+                type = eat_syntax(fp, token, MAXTOKEN);
+            }
+            if (type == ACCESS) {
+                type = get_token(fp, token, MAXTOKEN);
+                if (type != ACCNOTIFY && type != READONLY
+                    && type != READWRITE && type != READCREATE
+                    && type != WRITEONLY && type != NOTIMPL) {
+                    print_error("Bad ACCESS", token, type);
+                    goto skip;
+                }
+                type = get_token(fp, token, MAXTOKEN);
+            }
+            if (type == CREATEREQ) {
+                type = get_token(fp, token, MAXTOKEN);
+                if (type != LEFTBRACKET) {
+                    print_error("Expected \"{\"", token, type);
+                    goto skip;
+                }
+                do {
+                    type = get_token(fp, token, MAXTOKEN);
+                    if (type != LABEL) {
+                        print_error("Bad object name in list", token,
+                                    type);
+                        goto skip;
+                    }
+                    type = get_token(fp, token, MAXTOKEN);
+                } while (type == COMMA);
+                if (type != RIGHTBRACKET) {
+                    print_error("Expected \"}\" after list", token, type);
+                    goto skip;
+                }
+                type = get_token(fp, token, MAXTOKEN);
+            }
+            if (type == DEFVAL) {
+                int             level = 1;
+                type = get_token(fp, token, MAXTOKEN);
+                if (type != LEFTBRACKET) {
+                    print_error("Expected \"{\" after DEFVAL", token,
+                                type);
+                    goto skip;
+                }
+                do {
+                    type = get_token(fp, token, MAXTOKEN);
+                    if (type == LEFTBRACKET)
+                        level++;
+                    else if (type == RIGHTBRACKET)
+                        level--;
+                } while (type != RIGHTBRACKET && type != ENDOFFILE
+                         && level != 0);
+                if (type != RIGHTBRACKET) {
+                    print_error("Missing \"}\" after DEFVAL", token, type);
+                    goto skip;
+                }
+                type = get_token(fp, token, MAXTOKEN);
+            }
+            if (type != DESCRIPTION) {
+                print_error("Expected DESCRIPTION", token, type);
+                goto skip;
+            }
+            type = get_token(fp, token, MAXTOKEN);
+            if (type != QUOTESTRING) {
+                print_error("Bad DESCRIPTION", token, type);
+                goto skip;
+            }
+            type = get_token(fp, token, MAXTOKEN);
+        }
+    }
+    if (type != EQUALS)
+        print_error("Expected \"::=\"", token, type);
+  skip:
+    while (type != EQUALS && type != ENDOFFILE) {
+        type = get_token(fp, quoted_string_buffer, MAXQUOTESTR);
+    }
+    return merge_parse_objectid(np, fp, name);
+}
+
+/*
+ * Parses a module identity macro
+ * Returns 0 on error.
+ */
+static void
+check_utc(const char *utc)
+{
+    int             len, year, month, day, hour, minute;
+
+    len = strlen(utc);
+    if (utc[len - 1] != 'Z' && utc[len - 1] != 'z') {
+        print_error("Timestamp should end with Z", utc, QUOTESTRING);
+        return;
+    }
+    if (len == 11) {
+        len =
+            sscanf(utc, "%2d%2d%2d%2d%2dZ", &year, &month, &day, &hour,
+                   &minute);
+        year += 1900;
+    } else if (len == 13)
+        len =
+            sscanf(utc, "%4d%2d%2d%2d%2dZ", &year, &month, &day, &hour,
+                   &minute);
+    else {
+        print_error("Bad timestamp format (11 or 13 characters)",
+                    utc, QUOTESTRING);
+        return;
+    }
+    if (len != 5) {
+        print_error("Bad timestamp format", utc, QUOTESTRING);
+        return;
+    }
+    if (month < 1 || month > 12)
+        print_error("Bad month in timestamp", utc, QUOTESTRING);
+    if (day < 1 || day > 31)
+        print_error("Bad day in timestamp", utc, QUOTESTRING);
+    if (hour < 0 || hour > 23)
+        print_error("Bad hour in timestamp", utc, QUOTESTRING);
+    if (minute < 0 || minute > 59)
+        print_error("Bad minute in timestamp", utc, QUOTESTRING);
+}
+
+static struct node *
+parse_moduleIdentity(FILE * fp, char *name)
+{
+    register int    type;
+    char            token[MAXTOKEN];
+    char            quoted_string_buffer[MAXQUOTESTR];
+    register struct node *np;
+
+    np = alloc_node(current_module);
+    if (np == NULL)
+        return (NULL);
+    type = get_token(fp, token, MAXTOKEN);
+    if (type != LASTUPDATED) {
+        print_error("Expected LAST-UPDATED", token, type);
+        goto skip;
+    }
+    type = get_token(fp, token, MAXTOKEN);
+    if (type != QUOTESTRING) {
+        print_error("Need STRING for LAST-UPDATED", token, type);
+        goto skip;
+    }
+    check_utc(token);
+    type = get_token(fp, token, MAXTOKEN);
+    if (type != ORGANIZATION) {
+        print_error("Expected ORGANIZATION", token, type);
+        goto skip;
+    }
+    type = get_token(fp, token, MAXTOKEN);
+    if (type != QUOTESTRING) {
+        print_error("Bad ORGANIZATION", token, type);
+        goto skip;
+    }
+    type = get_token(fp, token, MAXTOKEN);
+    if (type != CONTACTINFO) {
+        print_error("Expected CONTACT-INFO", token, type);
+        goto skip;
+    }
+    type = get_token(fp, quoted_string_buffer, MAXQUOTESTR);
+    if (type != QUOTESTRING) {
+        print_error("Bad CONTACT-INFO", quoted_string_buffer, type);
+        goto skip;
+    }
+    type = get_token(fp, token, MAXTOKEN);
+    if (type != DESCRIPTION) {
+        print_error("Expected DESCRIPTION", token, type);
+        goto skip;
+    }
+    type = get_token(fp, quoted_string_buffer, MAXQUOTESTR);
+    if (type != QUOTESTRING) {
+        print_error("Bad DESCRIPTION", quoted_string_buffer, type);
+        goto skip;
+    }
+    if (netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, 
+			       NETSNMP_DS_LIB_SAVE_MIB_DESCRS)) {
+        np->description = strdup(quoted_string_buffer);
+    }
+    type = get_token(fp, token, MAXTOKEN);
+    while (type == REVISION) {
+        type = get_token(fp, token, MAXTOKEN);
+        if (type != QUOTESTRING) {
+            print_error("Bad REVISION", token, type);
+            goto skip;
+        }
+        check_utc(token);
+        type = get_token(fp, token, MAXTOKEN);
+        if (type != DESCRIPTION) {
+            print_error("Expected DESCRIPTION", token, type);
+            goto skip;
+        }
+        type = get_token(fp, quoted_string_buffer, MAXQUOTESTR);
+        if (type != QUOTESTRING) {
+            print_error("Bad DESCRIPTION", quoted_string_buffer, type);
+            goto skip;
+        }
+        type = get_token(fp, token, MAXTOKEN);
+    }
+    if (type != EQUALS)
+        print_error("Expected \"::=\"", token, type);
+  skip:
+    while (type != EQUALS && type != ENDOFFILE) {
+        type = get_token(fp, quoted_string_buffer, MAXQUOTESTR);
+    }
+    return merge_parse_objectid(np, fp, name);
+}
+
+
+/*
+ * Parses a MACRO definition
+ * Expect BEGIN, discard everything to end.
+ * Returns 0 on error.
+ */
+static struct node *
+parse_macro(FILE * fp, char *name)
+{
+    register int    type;
+    char            token[MAXTOKEN];
+    struct node    *np;
+    int             iLine = mibLine;
+
+    np = alloc_node(current_module);
+    if (np == NULL)
+        return (NULL);
+    type = get_token(fp, token, sizeof(token));
+    while (type != EQUALS && type != ENDOFFILE) {
+        type = get_token(fp, token, sizeof(token));
+    }
+    if (type != EQUALS)
+        return NULL;
+    while (type != BEGIN && type != ENDOFFILE) {
+        type = get_token(fp, token, sizeof(token));
+    }
+    if (type != BEGIN)
+        return NULL;
+    while (type != END && type != ENDOFFILE) {
+        type = get_token(fp, token, sizeof(token));
+    }
+    if (type != END)
+        return NULL;
+
+    if (netsnmp_ds_get_int(NETSNMP_DS_LIBRARY_ID, 
+			   NETSNMP_DS_LIB_MIB_WARNINGS)) {
+        snmp_log(LOG_WARNING,
+                 "%s MACRO (lines %d..%d parsed and ignored).\n", name,
+                 iLine, mibLine);
+    }
+
+    return np;
+}
+
+/*
+ * Parses a module import clause
+ *   loading any modules referenced
+ */
+static void
+parse_imports(FILE * fp)
+{
+    register int    type;
+    char            token[MAXTOKEN];
+    char            modbuf[256];
+#define MAX_IMPORTS	256
+    struct module_import import_list[MAX_IMPORTS];
+    int             this_module;
+    struct module  *mp;
+
+    int             import_count = 0;   /* Total number of imported descriptors */
+    int             i = 0, old_i;       /* index of first import from each module */
+
+    type = get_token(fp, token, MAXTOKEN);
+
+    /*
+     * Parse the IMPORTS clause
+     */
+    while (type != SEMI && type != ENDOFFILE) {
+        if (type == LABEL) {
+            if (import_count == MAX_IMPORTS) {
+                print_error("Too many imported symbols", token, type);
+                do {
+                    type = get_token(fp, token, MAXTOKEN);
+                } while (type != SEMI && type != ENDOFFILE);
+                return;
+            }
+            import_list[import_count++].label = strdup(token);
+        } else if (type == FROM) {
+            type = get_token(fp, token, MAXTOKEN);
+            if (import_count == i) {    /* All imports are handled internally */
+                type = get_token(fp, token, MAXTOKEN);
+                continue;
+            }
+            this_module = which_module(token);
+
+            for (old_i = i; i < import_count; ++i)
+                import_list[i].modid = this_module;
+
+            /*
+             * Recursively read any pre-requisite modules
+             */
+            if (read_module_internal(token) == MODULE_NOT_FOUND) {
+                for (; old_i < import_count; ++old_i) {
+                    read_import_replacements(token, &import_list[old_i]);
+                }
+            }
+        }
+        type = get_token(fp, token, MAXTOKEN);
+    }
+
+    /*
+     * Save the import information
+     *   in the global module table
+     */
+    for (mp = module_head; mp; mp = mp->next)
+        if (mp->modid == current_module) {
+            if (import_count == 0)
+                return;
+            if (mp->imports && (mp->imports != root_imports)) {
+                /*
+                 * this can happen if all modules are in one source file. 
+                 */
+                for (i = 0; i < mp->no_imports; ++i) {
+                    DEBUGMSGTL(("parse-mibs",
+                                "#### freeing Module %d '%s' %d\n",
+                                mp->modid, mp->imports[i].label,
+                                mp->imports[i].modid));
+                    free((char *) mp->imports[i].label);
+                }
+                free((char *) mp->imports);
+            }
+            mp->imports = (struct module_import *)
+                calloc(import_count, sizeof(struct module_import));
+            if (mp->imports == NULL)
+                return;
+            for (i = 0; i < import_count; ++i) {
+                mp->imports[i].label = import_list[i].label;
+                mp->imports[i].modid = import_list[i].modid;
+                DEBUGMSGTL(("parse-mibs",
+                            "#### adding Module %d '%s' %d\n", mp->modid,
+                            mp->imports[i].label, mp->imports[i].modid));
+            }
+            mp->no_imports = import_count;
+            return;
+        }
+
+    /*
+     * Shouldn't get this far
+     */
+    print_module_not_found(module_name(current_module, modbuf));
+    return;
+}
+
+
+
+/*
+ * MIB module handling routines
+ */
+
+static void
+dump_module_list(void)
+{
+    struct module  *mp = module_head;
+
+    DEBUGMSGTL(("parse-mibs", "Module list:\n"));
+    while (mp) {
+        DEBUGMSGTL(("parse-mibs", "  %s %d %s %d\n", mp->name, mp->modid,
+                    mp->file, mp->no_imports));
+        mp = mp->next;
+    }
+}
+
+int
+which_module(const char *name)
+{
+    struct module  *mp;
+
+    for (mp = module_head; mp; mp = mp->next)
+        if (!label_compare(mp->name, name))
+            return (mp->modid);
+
+    DEBUGMSGTL(("parse-mibs", "Module %s not found\n", name));
+    return (-1);
+}
+
+/*
+ * module_name - copy module name to user buffer, return ptr to same.
+ */
+char           *
+module_name(int modid, char *cp)
+{
+    struct module  *mp;
+
+    for (mp = module_head; mp; mp = mp->next)
+        if (mp->modid == modid) {
+            strcpy(cp, mp->name);
+            return (cp);
+        }
+
+    DEBUGMSGTL(("parse-mibs", "Module %d not found\n", modid));
+    sprintf(cp, "#%d", modid);
+    return (cp);
+}
+
+/*
+ *  Backwards compatability
+ *  Read newer modules that replace the one specified:-
+ *      either all of them (read_module_replacements),
+ *      or those relating to a specified identifier (read_import_replacements)
+ *      plus an interface to add new replacement requirements
+ */
+void
+add_module_replacement(const char *old_module,
+                       const char *new_module_name,
+                       const char *tag, int len)
+{
+    struct module_compatability *mcp;
+
+    mcp = (struct module_compatability *)
+        calloc(1, sizeof(struct module_compatability));
+    if (mcp == NULL)
+        return;
+
+    mcp->old_module = strdup(old_module);
+    mcp->new_module = strdup(new_module_name);
+    if (tag)
+        mcp->tag = strdup(tag);
+    mcp->tag_len = len;
+
+    mcp->next = module_map_head;
+    module_map_head = mcp;
+}
+
+static void
+read_module_replacements(const char *name)
+{
+    struct module_compatability *mcp;
+
+    for (mcp = module_map_head; mcp; mcp = mcp->next) {
+        if (!label_compare(mcp->old_module, name)) {
+            if (netsnmp_ds_get_int(NETSNMP_DS_LIBRARY_ID, 
+				   NETSNMP_DS_LIB_MIB_WARNINGS)) {
+                snmp_log(LOG_WARNING,
+                         "Loading replacement module %s for %s (%s)\n",
+                         mcp->new_module, name, File);
+	    }
+            (void) read_module(mcp->new_module);
+            return;
+        }
+    }
+    if (netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, 
+			       NETSNMP_DS_LIB_MIB_ERRORS)) {
+        print_module_not_found(name);
+    }
+}
+
+static void
+read_import_replacements(const char *old_module_name,
+                         struct module_import *identifier)
+{
+    struct module_compatability *mcp;
+
+    /*
+     * Look for matches first
+     */
+    for (mcp = module_map_head; mcp; mcp = mcp->next) {
+        if (!label_compare(mcp->old_module, old_module_name)) {
+
+            if (                /* exact match */
+                   (mcp->tag_len == 0 &&
+                    (mcp->tag == NULL ||
+                     !label_compare(mcp->tag, identifier->label))) ||
+                   /*
+                    * prefix match 
+                    */
+                   (mcp->tag_len != 0 &&
+                    !strncmp(mcp->tag, identifier->label, mcp->tag_len))
+                ) {
+
+                if (netsnmp_ds_get_int(NETSNMP_DS_LIBRARY_ID, 
+				       NETSNMP_DS_LIB_MIB_WARNINGS)) {
+                    snmp_log(LOG_WARNING,
+                             "Importing %s from replacement module %s instead of %s (%s)\n",
+                             identifier->label, mcp->new_module,
+                             old_module_name, File);
+		}
+                (void) read_module(mcp->new_module);
+                identifier->modid = which_module(mcp->new_module);
+                return;         /* finished! */
+            }
+        }
+    }
+
+    /*
+     * If no exact match, load everything relevant
+     */
+    read_module_replacements(old_module_name);
+}
+
+
+/*
+ *  Read in the named module
+ *      Returns the root of the whole tree
+ *      (by analogy with 'read_mib')
+ */
+static int
+read_module_internal(const char *name)
+{
+    struct module  *mp;
+    FILE           *fp;
+    struct node    *np;
+
+    init_mib_internals();
+
+    for (mp = module_head; mp; mp = mp->next)
+        if (!label_compare(mp->name, name)) {
+            const char     *oldFile = File;
+            int             oldLine = mibLine;
+            int             oldModule = current_module;
+
+            if (mp->no_imports != -1) {
+                DEBUGMSGTL(("parse-mibs", "Module %s already loaded\n",
+                            name));
+                return MODULE_ALREADY_LOADED;
+            }
+            if ((fp = fopen(mp->file, "r")) == NULL) {
+                snmp_log_perror(mp->file);
+                return MODULE_LOAD_FAILED;
+            }
+            mp->no_imports = 0; /* Note that we've read the file */
+            File = mp->file;
+            mibLine = 1;
+            current_module = mp->modid;
+            /*
+             * Parse the file
+             */
+            np = parse(fp, NULL);
+            fclose(fp);
+            File = oldFile;
+            mibLine = oldLine;
+            current_module = oldModule;
+            return MODULE_LOADED_OK;
+        }
+
+    if (netsnmp_ds_get_int(NETSNMP_DS_LIBRARY_ID, 	
+			   NETSNMP_DS_LIB_MIB_WARNINGS) > 1) {
+        snmp_log(LOG_WARNING, "Module %s not found\n", name);
+    }
+    return MODULE_NOT_FOUND;
+}
+
+void
+adopt_orphans(void)
+{
+    struct node    *np, *onp;
+    struct tree    *tp;
+    int             i, adopted = 1;
+
+    if (!orphan_nodes)
+        return;
+    init_node_hash(orphan_nodes);
+    orphan_nodes = NULL;
+
+    while (adopted) {
+        adopted = 0;
+        for (i = 0; i < NHASHSIZE; i++)
+            if (nbuckets[i]) {
+                for (np = nbuckets[i]; np != NULL; np = np->next) {
+                    tp = find_tree_node(np->parent, -1);
+		    if (tp) {
+			do_subtree(tp, &np);
+			adopted = 1;
+		    }
+		}
+            }
+    }
+
+    /*
+     * Report on outstanding orphans
+     *    and link them back into the orphan list
+     */
+    for (i = 0; i < NHASHSIZE; i++)
+        if (nbuckets[i]) {
+            if (orphan_nodes)
+                onp = np->next = nbuckets[i];
+            else
+                onp = orphan_nodes = nbuckets[i];
+            nbuckets[i] = NULL;
+            while (onp) {
+                char            modbuf[256];
+                snmp_log(LOG_WARNING,
+                         "Cannot adopt OID in %s: %s ::= { %s %ld }\n",
+                         module_name(onp->modid, modbuf),
+                         (onp->label ? onp->label : "<no label>"),
+                         (onp->parent ? onp->parent : "<no parent>"),
+                         onp->subid);
+
+                np = onp;
+                onp = onp->next;
+            }
+        }
+}
+
+struct tree    *
+read_module(const char *name)
+{
+    if (read_module_internal(name) == MODULE_NOT_FOUND)
+        read_module_replacements(name);
+    return tree_head;
+}
+
+/*
+ * Prototype definition 
+ */
+void            unload_module_by_ID(int modID, struct tree *tree_top);
+
+void
+unload_module_by_ID(int modID, struct tree *tree_top)
+{
+    struct tree    *tp, *next;
+    int             i;
+
+    for (tp = tree_top; tp; tp = next) {
+        /*
+         * Essentially, this is equivalent to the code fragment:
+         *      if (tp->modID == modID)
+         *        tp->number_modules--;
+         * but handles one tree node being part of several modules,
+         * and possible multiple copies of the same module ID.
+         */
+        int             nmod = tp->number_modules;
+        if (nmod > 0) {         /* in some module */
+            /*
+             * Remove all copies of this module ID
+             */
+            int             cnt = 0, *pi1, *pi2 = tp->module_list;
+            for (i = 0, pi1 = pi2; i < nmod; i++, pi2++) {
+                if (*pi2 == modID)
+                    continue;
+                cnt++;
+                *pi1++ = *pi2;
+            }
+            if (nmod != cnt) {  /* in this module */
+                /*
+                 * if ( (nmod - cnt) > 1)
+                 * printf("Dup modid %d,  %d times, '%s'\n", tp->modid, (nmod-cnt), tp->label); fflush(stdout); ?* XXDEBUG 
+                 */
+                tp->number_modules = cnt;
+                switch (cnt) {
+                case 0:
+                    tp->module_list[0] = -1;    /* Mark unused, and FALL THROUGH */
+
+                case 1:        /* save the remaining module */
+                    if (&(tp->modid) != tp->module_list) {
+                        tp->modid = tp->module_list[0];
+                        free(tp->module_list);
+                        tp->module_list = &(tp->modid);
+                    }
+                    break;
+
+                default:
+                    break;
+                }
+            }                   /* if tree node is in this module */
+        }
+        /*
+         * if tree node is in some module 
+         */
+        next = tp->next_peer;
+
+
+        /*
+         *  OK - that's dealt with *this* node.
+         *    Now let's look at the children.
+         *    (Isn't recursion wonderful!)
+         */
+        if (tp->child_list)
+            unload_module_by_ID(modID, tp->child_list);
+
+
+        if (tp->number_modules == 0) {
+            /*
+             * This node isn't needed any more (except perhaps
+             * for the sake of the children) 
+             */
+            if (tp->child_list == NULL) {
+                unlink_tree(tp);
+                free_tree(tp);
+            } else {
+                free_partial_tree(tp, TRUE);
+            }
+        }
+    }
+}
+
+int
+unload_module(const char *name)
+{
+    struct module  *mp;
+    int             modID = -1;
+
+    for (mp = module_head; mp; mp = mp->next)
+        if (!label_compare(mp->name, name)) {
+            modID = mp->modid;
+            break;
+        }
+
+    if (modID == -1) {
+        DEBUGMSGTL(("unload-mib", "Module %s not found to unload\n",
+                    name));
+        return MODULE_NOT_FOUND;
+    }
+    unload_module_by_ID(modID, tree_head);
+    mp->no_imports = -1;        /* mark as unloaded */
+    return MODULE_LOADED_OK;    /* Well, you know what I mean! */
+}
+
+/*
+ * Clear module map, tree nodes, textual convention table.
+ */
+void
+unload_all_mibs()
+{
+    struct module  *mp;
+    struct module_compatability *mcp;
+    struct tc      *ptc;
+    int             i;
+
+    for (mcp = module_map_head; mcp; mcp = module_map_head) {
+        if (mcp == module_map)
+            break;
+        module_map_head = mcp->next;
+        if (mcp->tag) free((char *) mcp->tag);
+        free((char *) mcp->old_module);
+        free((char *) mcp->new_module);
+        free(mcp);
+    }
+
+    for (mp = module_head; mp; mp = module_head) {
+        struct module_import *mi = mp->imports;
+        if (mi) {
+            for (i = 0; i < mp->no_imports; ++i) {
+                SNMP_FREE((mi + i)->label);
+            }
+            mp->no_imports = 0;
+            if (mi == root_imports)
+                memset(mi, 0, sizeof(*mi));
+            else
+                free(mi);
+        }
+
+        unload_module_by_ID(mp->modid, tree_head);
+        module_head = mp->next;
+        free(mp->name);
+        free(mp->file);
+        free(mp);
+    }
+    unload_module_by_ID(-1, tree_head);
+    /*
+     * tree nodes are cleared 
+     */
+
+    for (i = 0, ptc = tclist; i < MAXTC; i++, ptc++) {
+        if (ptc->type == 0)
+            continue;
+        free_enums(&ptc->enums);
+        free_ranges(&ptc->ranges);
+        free(ptc->descriptor);
+        if (ptc->hint)
+            free(ptc->hint);
+    }
+    memset(tclist, 0, MAXTC * sizeof(struct tc));
+
+    memset(buckets, 0, sizeof(buckets));
+    memset(nbuckets, 0, sizeof(nbuckets));
+    memset(tbuckets, 0, sizeof(tbuckets));
+
+    for (i = 0; i < sizeof(root_imports) / sizeof(root_imports[0]); i++) {
+        SNMP_FREE(root_imports[i].label);
+    }
+
+    max_module = 0;
+    current_module = 0;
+    module_map_head = NULL;
+    SNMP_FREE(last_err_module);
+}
+
+static void
+new_module(const char *name, const char *file)
+{
+    struct module  *mp;
+
+    for (mp = module_head; mp; mp = mp->next)
+        if (!label_compare(mp->name, name)) {
+            DEBUGMSGTL(("parse-mibs", "Module %s already noted\n", name));
+            /*
+             * Not the same file 
+             */
+            if (label_compare(mp->file, file)) {
+                if (netsnmp_ds_get_int(NETSNMP_DS_LIBRARY_ID, 
+				       NETSNMP_DS_LIB_MIB_WARNINGS)) {
+                    snmp_log(LOG_WARNING,
+                             "Warning: Module %s was in %s now is %s\n",
+                             name, mp->file, file);
+		}
+
+                /*
+                 * Use the new one in preference 
+                 */
+                free(mp->file);
+                mp->file = strdup(file);
+            }
+            return;
+        }
+
+    /*
+     * Add this module to the list 
+     */
+    DEBUGMSGTL(("parse-mibs", "  Module %d %s is in %s\n", max_module,
+                name, file));
+    mp = (struct module *) calloc(1, sizeof(struct module));
+    if (mp == NULL)
+        return;
+    mp->name = strdup(name);
+    mp->file = strdup(file);
+    mp->imports = NULL;
+    mp->no_imports = -1;        /* Not yet loaded */
+    mp->modid = max_module;
+    ++max_module;
+
+    mp->next = module_head;     /* Or add to the *end* of the list? */
+    module_head = mp;
+}
+
+
+static void
+scan_objlist(struct node *root, struct objgroup *list, const char *error)
+{
+    int             oLine = mibLine;
+
+    while (list) {
+        struct objgroup *gp = list;
+        struct node    *np;
+        list = list->next;
+        np = root;
+        while (np)
+            if (label_compare(np->label, gp->name))
+                np = np->next;
+            else
+                break;
+        if (!np) {
+            mibLine = gp->line;
+            print_error(error, gp->name, QUOTESTRING);
+        }
+        free(gp->name);
+        free(gp);
+    }
+    mibLine = oLine;
+}
+
+/*
+ * Parses a mib file and returns a linked list of nodes found in the file.
+ * Returns NULL on error.
+ */
+static struct node *
+parse(FILE * fp, struct node *root)
+{
+    char            token[MAXTOKEN];
+    char            name[MAXTOKEN];
+    int             type = LABEL;
+    int             lasttype = LABEL;
+
+#define BETWEEN_MIBS          1
+#define IN_MIB                2
+    int             state = BETWEEN_MIBS;
+    struct node    *np, *nnp;
+    struct objgroup *oldgroups = NULL, *oldobjects = NULL, *oldnotifs =
+        NULL;
+
+    DEBUGMSGTL(("parse-file", "Parsing file:  %s...\n", File));
+
+    if (last_err_module)
+        free(last_err_module);
+    last_err_module = 0;
+
+    np = root;
+    if (np != NULL) {
+        /*
+         * now find end of chain 
+         */
+        while (np->next)
+            np = np->next;
+    }
+
+    while (type != ENDOFFILE) {
+        if (lasttype == CONTINUE)
+            lasttype = type;
+        else
+            type = lasttype = get_token(fp, token, MAXTOKEN);
+
+        switch (type) {
+        case END:
+            if (state != IN_MIB) {
+                print_error("Error, END before start of MIB", NULL, type);
+                return NULL;
+            } else {
+                struct module  *mp;
+#ifdef TEST
+                printf("\nNodes for Module %s:\n", name);
+                print_nodes(stdout, root);
+#endif
+                scan_objlist(root, objgroups, "Undefined OBJECT-GROUP");
+                scan_objlist(root, objects, "Undefined OBJECT");
+                scan_objlist(root, notifs, "Undefined NOTIFICATION");
+                objgroups = oldgroups;
+                objects = oldobjects;
+                notifs = oldnotifs;
+                for (mp = module_head; mp; mp = mp->next)
+                    if (mp->modid == current_module)
+                        break;
+                do_linkup(mp, root);
+                np = root = NULL;
+            }
+            state = BETWEEN_MIBS;
+#ifdef TEST
+            if (netsnmp_ds_get_int(NETSNMP_DS_LIBRARY_ID, 
+				   NETSNMP_DS_LIB_MIB_WARNINGS)) {
+                xmalloc_stats(stderr);
+	    }
+#endif
+            continue;
+        case IMPORTS:
+            parse_imports(fp);
+            continue;
+        case EXPORTS:
+            while (type != SEMI && type != ENDOFFILE)
+                type = get_token(fp, token, MAXTOKEN);
+            continue;
+        case LABEL:
+        case INTEGER:
+        case INTEGER32:
+        case UINTEGER32:
+        case UNSIGNED32:
+        case COUNTER:
+        case COUNTER64:
+        case GAUGE:
+        case IPADDR:
+        case NETADDR:
+        case NSAPADDRESS:
+        case OBJSYNTAX:
+        case APPSYNTAX:
+        case SIMPLESYNTAX:
+        case OBJNAME:
+        case NOTIFNAME:
+        case KW_OPAQUE:
+        case TIMETICKS:
+            break;
+        case ENDOFFILE:
+            continue;
+        default:
+            strcpy(name, token);
+            type = get_token(fp, token, MAXTOKEN);
+            nnp = NULL;
+            if (type == MACRO) {
+                nnp = parse_macro(fp, name);
+                if (nnp == NULL) {
+                    print_error("Bad parse of MACRO", NULL, type);
+                    /*
+                     * return NULL;
+                     */
+                }
+                free_node(nnp); /* IGNORE */
+                nnp = NULL;
+            } else
+                print_error(name, "is a reserved word", lasttype);
+            continue;           /* see if we can parse the rest of the file */
+        }
+        strcpy(name, token);
+        type = get_token(fp, token, MAXTOKEN);
+        nnp = NULL;
+
+        /*
+         * Handle obsolete method to assign an object identifier to a
+         * module
+         */
+        if (lasttype == LABEL && type == LEFTBRACKET) {
+            while (type != RIGHTBRACKET && type != ENDOFFILE)
+                type = get_token(fp, token, MAXTOKEN);
+            if (type == ENDOFFILE) {
+                print_error("Expected \"}\"", token, type);
+                return NULL;
+            }
+            type = get_token(fp, token, MAXTOKEN);
+        }
+
+        switch (type) {
+        case DEFINITIONS:
+            if (state != BETWEEN_MIBS) {
+                print_error("Error, nested MIBS", NULL, type);
+                return NULL;
+            }
+            state = IN_MIB;
+            current_module = which_module(name);
+            oldgroups = objgroups;
+            objgroups = NULL;
+            oldobjects = objects;
+            objects = NULL;
+            oldnotifs = notifs;
+            notifs = NULL;
+            if (current_module == -1) {
+                new_module(name, File);
+                current_module = which_module(name);
+            }
+            DEBUGMSGTL(("parse-mibs", "Parsing MIB: %d %s\n",
+                        current_module, name));
+            while ((type = get_token(fp, token, MAXTOKEN)) != ENDOFFILE)
+                if (type == BEGIN)
+                    break;
+            break;
+        case OBJTYPE:
+            nnp = parse_objecttype(fp, name);
+            if (nnp == NULL) {
+                print_error("Bad parse of OBJECT-TYPE", NULL, type);
+                return NULL;
+            }
+            break;
+        case OBJGROUP:
+            nnp = parse_objectgroup(fp, name, OBJECTS, &objects);
+            if (nnp == NULL) {
+                print_error("Bad parse of OBJECT-GROUP", NULL, type);
+                return NULL;
+            }
+            break;
+        case NOTIFGROUP:
+            nnp = parse_objectgroup(fp, name, NOTIFICATIONS, &notifs);
+            if (nnp == NULL) {
+                print_error("Bad parse of NOTIFICATION-GROUP", NULL, type);
+                return NULL;
+            }
+            break;
+        case TRAPTYPE:
+            nnp = parse_trapDefinition(fp, name);
+            if (nnp == NULL) {
+                print_error("Bad parse of TRAP-TYPE", NULL, type);
+                return NULL;
+            }
+            break;
+        case NOTIFTYPE:
+            nnp = parse_notificationDefinition(fp, name);
+            if (nnp == NULL) {
+                print_error("Bad parse of NOTIFICATION-TYPE", NULL, type);
+                return NULL;
+            }
+            break;
+        case COMPLIANCE:
+            nnp = parse_compliance(fp, name);
+            if (nnp == NULL) {
+                print_error("Bad parse of MODULE-COMPLIANCE", NULL, type);
+                return NULL;
+            }
+            break;
+        case AGENTCAP:
+            nnp = parse_capabilities(fp, name);
+            if (nnp == NULL) {
+                print_error("Bad parse of AGENT-CAPABILITIES", NULL, type);
+                return NULL;
+            }
+            break;
+        case MACRO:
+            nnp = parse_macro(fp, name);
+            if (nnp == NULL) {
+                print_error("Bad parse of MACRO", NULL, type);
+                /*
+                 * return NULL;
+                 */
+            }
+            free_node(nnp);     /* IGNORE */
+            nnp = NULL;
+            break;
+        case MODULEIDENTITY:
+            nnp = parse_moduleIdentity(fp, name);
+            if (nnp == NULL) {
+                print_error("Bad parse of MODULE-IDENTITY", NULL, type);
+                return NULL;
+            }
+            break;
+        case OBJECT:
+            type = get_token(fp, token, MAXTOKEN);
+            if (type != IDENTIFIER) {
+                print_error("Expected IDENTIFIER", token, type);
+                return NULL;
+            }
+            type = get_token(fp, token, MAXTOKEN);
+            if (type != EQUALS) {
+                print_error("Expected \"::=\"", token, type);
+                return NULL;
+            }
+            nnp = parse_objectid(fp, name);
+            if (nnp == NULL) {
+                print_error("Bad parse of OBJECT IDENTIFIER", NULL, type);
+                return NULL;
+            }
+            break;
+        case EQUALS:
+            nnp = parse_asntype(fp, name, &type, token);
+            lasttype = CONTINUE;
+            break;
+        case ENDOFFILE:
+            break;
+        default:
+            print_error("Bad operator", token, type);
+            return NULL;
+        }
+        if (nnp) {
+            if (nnp->type == TYPE_OTHER)
+                nnp->type = type;
+            if (np)
+                np->next = nnp;
+            else
+                np = root = nnp;
+            while (np->next)
+                np = np->next;
+        }
+    }
+    DEBUGMSGTL(("parse-file", "End of file (%s)\n", File));
+    return root;
+}
+
+/*
+ * return zero if character is not a label character. 
+ */
+static int
+is_labelchar(int ich)
+{
+    if ((isalnum(ich)) || (ich == '-'))
+        return 1;
+    if (ich == '_' && netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, 
+					     NETSNMP_DS_LIB_MIB_PARSE_LABEL)) {
+        return 1;
+    }
+
+    return 0;
+}
+
+/*
+ * Parses a token from the file.  The type of the token parsed is returned,
+ * and the text is placed in the string pointed to by token.
+ * Warning: this method may recurse.
+ */
+static int
+get_token(FILE * fp, char *token, int maxtlen)
+{
+    register int    ch, ch_next;
+    register char  *cp = token;
+    register int    hash = 0;
+    register struct tok *tp;
+    int             too_long = 0;
+
+    /*
+     * skip all white space 
+     */
+    do {
+        ch = getc(fp);
+        if (ch == '\n')
+            mibLine++;
+    }
+    while (isspace(ch) && ch != EOF);
+    *cp++ = ch;
+    *cp = '\0';
+    switch (ch) {
+    case EOF:
+        return ENDOFFILE;
+    case '"':
+        return parseQuoteString(fp, token, maxtlen);
+    case '\'':                 /* binary or hex constant */
+        while ((ch = getc(fp)) != EOF && ch != '\''
+               && cp - token < maxtlen - 2)
+            *cp++ = ch;
+        if (ch == '\'') {
+            unsigned long   val = 0;
+            *cp++ = '\'';
+            *cp++ = ch = getc(fp);
+            *cp = 0;
+            cp = token + 1;
+            switch (ch) {
+            case EOF:
+                return ENDOFFILE;
+            case 'b':
+            case 'B':
+                while ((ch = *cp++) != '\'')
+                    if (ch != '0' && ch != '1')
+                        return LABEL;
+                    else
+                        val = val * 2 + ch - '0';
+                break;
+            case 'h':
+            case 'H':
+                while ((ch = *cp++) != '\'')
+                    if ('0' <= ch && ch <= '9')
+                        val = val * 16 + ch - '0';
+                    else if ('a' <= ch && ch <= 'f')
+                        val = val * 16 + ch - 'a' + 10;
+                    else if ('A' <= ch && ch <= 'F')
+                        val = val * 16 + ch - 'A' + 10;
+                    else
+                        return LABEL;
+                break;
+            default:
+                return LABEL;
+            }
+            sprintf(token, "%ld", val);
+            return NUMBER;
+        } else
+            return LABEL;
+    case '(':
+        return LEFTPAREN;
+    case ')':
+        return RIGHTPAREN;
+    case '{':
+        return LEFTBRACKET;
+    case '}':
+        return RIGHTBRACKET;
+    case '[':
+        return LEFTSQBRACK;
+    case ']':
+        return RIGHTSQBRACK;
+    case ';':
+        return SEMI;
+    case ',':
+        return COMMA;
+    case '|':
+        return BAR;
+    case '.':
+        ch_next = getc(fp);
+        if (ch_next == '.')
+            return RANGE;
+        ungetc(ch_next, fp);
+        return LABEL;
+    case ':':
+        ch_next = getc(fp);
+        if (ch_next != ':') {
+            ungetc(ch_next, fp);
+            return LABEL;
+        }
+        ch_next = getc(fp);
+        if (ch_next != '=') {
+            ungetc(ch_next, fp);
+            return LABEL;
+        }
+        return EQUALS;
+    case '-':
+        ch_next = getc(fp);
+        if (ch_next == '-') {
+            if (netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, 
+				       NETSNMP_DS_LIB_MIB_COMMENT_TERM)) {
+                /*
+                 * Treat the rest of this line as a comment. 
+                 */
+                while ((ch_next != EOF) && (ch_next != '\n'))
+                    ch_next = getc(fp);
+            } else {
+                /*
+                 * Treat the rest of the line or until another '--' as a comment 
+                 */
+                /*
+                 * (this is the "technically" correct way to parse comments) 
+                 */
+                ch = ' ';
+                ch_next = getc(fp);
+                while (ch_next != EOF && ch_next != '\n' &&
+                       (ch != '-' || ch_next != '-')) {
+                    ch = ch_next;
+                    ch_next = getc(fp);
+                }
+            }
+            if (ch_next == EOF)
+                return ENDOFFILE;
+            if (ch_next == '\n')
+                mibLine++;
+            return get_token(fp, token, maxtlen);
+        }
+        ungetc(ch_next, fp);
+    default:
+        /*
+         * Accumulate characters until end of token is found.  Then attempt to
+         * match this token as a reserved word.  If a match is found, return the
+         * type.  Else it is a label.
+         */
+        if (!is_labelchar(ch))
+            return LABEL;
+        hash += tolower(ch);
+      more:
+        while (is_labelchar(ch_next = getc(fp))) {
+            hash += tolower(ch_next);
+            if (cp - token < maxtlen - 1)
+                *cp++ = ch_next;
+            else
+                too_long = 1;
+        }
+        ungetc(ch_next, fp);
+        *cp = '\0';
+
+        if (too_long)
+            print_error("Warning: token too long", token, CONTINUE);
+        for (tp = buckets[BUCKET(hash)]; tp; tp = tp->next) {
+            if ((tp->hash == hash) && (!label_compare(tp->name, token)))
+                break;
+        }
+        if (tp) {
+            if (tp->token != CONTINUE)
+                return (tp->token);
+            while (isspace((ch_next = getc(fp))))
+                if (ch_next == '\n')
+                    mibLine++;
+            if (ch_next == EOF)
+                return ENDOFFILE;
+            if (isalnum(ch_next)) {
+                *cp++ = ch_next;
+                hash += tolower(ch_next);
+                goto more;
+            }
+        }
+        if (token[0] == '-' || isdigit(token[0])) {
+            for (cp = token + 1; *cp; cp++)
+                if (!isdigit(*cp))
+                    return LABEL;
+            return NUMBER;
+        }
+        return LABEL;
+    }
+}
+
+int
+snmp_get_token(FILE * fp, char *token, int maxtlen)
+{
+    return get_token(fp, token, maxtlen);
+}
+
+int
+add_mibdir(const char *dirname)
+{
+    FILE           *fp, *ip;
+    DIR            *dir, *dir2;
+    const char     *oldFile = File;
+    struct dirent  *file;
+    char            token[MAXTOKEN], token2[MAXTOKEN];
+    char            tmpstr[300];
+    int             count = 0;
+#if !(defined(WIN32) || defined(cygwin))
+    char space;
+    char newline;
+    struct stat     dir_stat, idx_stat;
+    char            tmpstr1[300];
+#endif
+
+    DEBUGMSGTL(("parse-mibs", "Scanning directory %s\n", dirname));
+#if !(defined(WIN32) || defined(cygwin))
+    snprintf(token, sizeof(token), "%s/%s", dirname, ".index");
+    token[ sizeof(token)-1 ] = 0;
+    if (stat(token, &idx_stat) == 0 && stat(dirname, &dir_stat) == 0) {
+        if (dir_stat.st_mtime < idx_stat.st_mtime) {
+            DEBUGMSGTL(("parse-mibs", "The index is good\n"));
+            if ((ip = fopen(token, "r")) != NULL) {
+                while (fscanf(ip, "%127s%c%299s%c", token, &space, tmpstr,
+		    &newline) == 4) {
+
+		    /*
+		     * If an overflow of the token or tmpstr buffers has been
+		     * found log a message and break out of the while loop,
+		     * thus the rest of the file tokens will be ignored.
+		     */
+		    if (space != ' ' || newline != '\n') {
+			snmp_log(LOG_ERR,
+			    "add_mibdir: strings scanned in from %s/%s " \
+			    "are too large.  count = %d\n ", dirname,
+			    ".index", count);
+			    break;
+		    }
+		   
+		    snprintf(tmpstr1, sizeof(tmpstr1), "%s/%s", dirname, tmpstr);
+                    tmpstr1[ sizeof(tmpstr1)-1 ] = 0;
+                    new_module(token, tmpstr1);
+                    count++;
+                }
+                fclose(ip);
+                return count;
+            } else
+                DEBUGMSGTL(("parse-mibs", "Can't read index\n"));
+        } else
+            DEBUGMSGTL(("parse-mibs", "Index outdated\n"));
+    } else
+        DEBUGMSGTL(("parse-mibs", "No index\n"));
+#endif
+
+    if ((dir = opendir(dirname))) {
+        snprintf(tmpstr, sizeof(tmpstr), "%s/.index", dirname);
+        tmpstr[ sizeof(tmpstr)-1 ] = 0;
+        ip = fopen(tmpstr, "w");
+        while ((file = readdir(dir))) {
+            /*
+             * Only parse file names not beginning with a '.' 
+             */
+            if (file->d_name != NULL && file->d_name[0] != '.') {
+                snprintf(tmpstr, sizeof(tmpstr), "%s/%s", dirname, file->d_name);
+                tmpstr[ sizeof(tmpstr)-1 ] = 0;
+                if ((dir2 = opendir(tmpstr))) {
+                    /*
+                     * file is a directory, don't read it 
+                     */
+                    closedir(dir2);
+                } else {
+                    /*
+                     * which module is this 
+                     */
+                    if ((fp = fopen(tmpstr, "r")) == NULL) {
+                        snmp_log_perror(tmpstr);
+                        continue;
+                    }
+                    DEBUGMSGTL(("parse-mibs", "Checking file: %s...\n",
+                                tmpstr));
+                    mibLine = 1;
+                    File = tmpstr;
+                    get_token(fp, token, MAXTOKEN);
+                    /*
+                     * simple test for this being a MIB 
+                     */
+                    if (get_token(fp, token2, MAXTOKEN) == DEFINITIONS) {
+                        new_module(token, tmpstr);
+                        count++;
+                        if (ip)
+                            fprintf(ip, "%s %s\n", token, file->d_name);
+                    }
+                    fclose(fp);
+                }
+            }
+        }
+        File = oldFile;
+        closedir(dir);
+        if (ip)
+            fclose(ip);
+        return (count);
+    }
+    return (-1);
+}
+
+
+/*
+ * Returns the root of the whole tree
+ *   (for backwards compatability)
+ */
+struct tree    *
+read_mib(const char *filename)
+{
+    FILE           *fp;
+    char            token[MAXTOKEN];
+
+    fp = fopen(filename, "r");
+    if (fp == NULL) {
+        snmp_log_perror(filename);
+        return NULL;
+    }
+    mibLine = 1;
+    File = filename;
+    DEBUGMSGTL(("parse-mibs", "Parsing file: %s...\n", filename));
+    get_token(fp, token, MAXTOKEN);
+    fclose(fp);
+    new_module(token, filename);
+    (void) read_module(token);
+
+    return tree_head;
+}
+
+
+struct tree    *
+read_all_mibs()
+{
+    struct module  *mp;
+
+    for (mp = module_head; mp; mp = mp->next)
+        if (mp->no_imports == -1)
+            read_module(mp->name);
+    adopt_orphans();
+
+    return tree_head;
+}
+
+
+#ifdef TEST
+main(int argc, char *argv[])
+{
+    int             i;
+    struct tree    *tp;
+    netsnmp_ds_set_int(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_MIB_WARNINGS, 2);
+
+    init_mib();
+
+    if (argc == 1)
+        (void) read_all_mibs();
+    else
+        for (i = 1; i < argc; i++)
+            read_mib(argv[i]);
+
+    for (tp = tree_head; tp; tp = tp->next_peer)
+        print_subtree(stdout, tp, 0);
+    free_tree(tree_head);
+
+    return 0;
+}
+#endif                          /* TEST */
+
+static int
+parseQuoteString(FILE * fp, char *token, int maxtlen)
+{
+    register int    ch;
+    int             count = 0;
+    int             too_long = 0;
+    char           *token_start = token;
+
+    for (ch = getc(fp); ch != EOF; ch = getc(fp)) {
+        if (ch == '\r')
+            continue;
+        if (ch == '\n') {
+            mibLine++;
+        } else if (ch == '"') {
+            *token = '\0';
+            if (too_long && netsnmp_ds_get_int(NETSNMP_DS_LIBRARY_ID, 
+					   NETSNMP_DS_LIB_MIB_WARNINGS) > 1) {
+                /*
+                 * show short form for brevity sake 
+                 */
+                char            ch_save = *(token_start + 50);
+                *(token_start + 50) = '\0';
+                print_error("Warning: string too long",
+                            token_start, QUOTESTRING);
+                *(token_start + 50) = ch_save;
+            }
+            return QUOTESTRING;
+        }
+        /*
+         * maximum description length check.  If greater, keep parsing
+         * but truncate the string 
+         */
+        if (++count < maxtlen)
+            *token++ = ch;
+        else
+            too_long = 1;
+    }
+
+    return 0;
+}
+
+/*
+ * struct index_list *
+ * getIndexes(FILE *fp):
+ *   This routine parses a string like  { blah blah blah } and returns a
+ *   list of the strings enclosed within it.
+ *
+ */
+static struct index_list *
+getIndexes(FILE * fp, struct index_list **retp)
+{
+    int             type;
+    char            token[MAXTOKEN];
+    char            nextIsImplied = 0;
+
+    struct index_list *mylist = NULL;
+    struct index_list **mypp = &mylist;
+
+    free_indexes(retp);
+
+    type = get_token(fp, token, MAXTOKEN);
+
+    if (type != LEFTBRACKET) {
+        return NULL;
+    }
+
+    type = get_token(fp, token, MAXTOKEN);
+    while (type != RIGHTBRACKET && type != ENDOFFILE) {
+        if ((type == LABEL) || (type & SYNTAX_MASK)) {
+            *mypp =
+                (struct index_list *) calloc(1, sizeof(struct index_list));
+            if (*mypp) {
+                (*mypp)->ilabel = strdup(token);
+                (*mypp)->isimplied = nextIsImplied;
+                mypp = &(*mypp)->next;
+                nextIsImplied = 0;
+            }
+        } else if (type == IMPLIED) {
+            nextIsImplied = 1;
+        }
+        type = get_token(fp, token, MAXTOKEN);
+    }
+
+    *retp = mylist;
+    return mylist;
+}
+
+static struct varbind_list *
+getVarbinds(FILE * fp, struct varbind_list **retp)
+{
+    int             type;
+    char            token[MAXTOKEN];
+
+    struct varbind_list *mylist = NULL;
+    struct varbind_list **mypp = &mylist;
+
+    free_varbinds(retp);
+
+    type = get_token(fp, token, MAXTOKEN);
+
+    if (type != LEFTBRACKET) {
+        return NULL;
+    }
+
+    type = get_token(fp, token, MAXTOKEN);
+    while (type != RIGHTBRACKET && type != ENDOFFILE) {
+        if ((type == LABEL) || (type & SYNTAX_MASK)) {
+            *mypp =
+                (struct varbind_list *) calloc(1,
+                                               sizeof(struct
+                                                      varbind_list));
+            if (*mypp) {
+                (*mypp)->vblabel = strdup(token);
+                mypp = &(*mypp)->next;
+            }
+        }
+        type = get_token(fp, token, MAXTOKEN);
+    }
+
+    *retp = mylist;
+    return mylist;
+}
+
+static void
+free_indexes(struct index_list **spp)
+{
+    if (spp && *spp) {
+        struct index_list *pp, *npp;
+
+        pp = *spp;
+        *spp = NULL;
+
+        while (pp) {
+            npp = pp->next;
+            if (pp->ilabel)
+                free(pp->ilabel);
+            free(pp);
+            pp = npp;
+        }
+    }
+}
+
+static void
+free_varbinds(struct varbind_list **spp)
+{
+    if (spp && *spp) {
+        struct varbind_list *pp, *npp;
+
+        pp = *spp;
+        *spp = NULL;
+
+        while (pp) {
+            npp = pp->next;
+            if (pp->vblabel)
+                free(pp->vblabel);
+            free(pp);
+            pp = npp;
+        }
+    }
+}
+
+static void
+free_ranges(struct range_list **spp)
+{
+    if (spp && *spp) {
+        struct range_list *pp, *npp;
+
+        pp = *spp;
+        *spp = NULL;
+
+        while (pp) {
+            npp = pp->next;
+            free(pp);
+            pp = npp;
+        }
+    }
+}
+
+static void
+free_enums(struct enum_list **spp)
+{
+    if (spp && *spp) {
+        struct enum_list *pp, *npp;
+
+        pp = *spp;
+        *spp = NULL;
+
+        while (pp) {
+            npp = pp->next;
+            if (pp->label)
+                free(pp->label);
+            free(pp);
+            pp = npp;
+        }
+    }
+}
+
+static struct enum_list *
+copy_enums(struct enum_list *sp)
+{
+    struct enum_list *xp = NULL, **spp = &xp;
+
+    while (sp) {
+        *spp = (struct enum_list *) calloc(1, sizeof(struct enum_list));
+        if (!*spp)
+            break;
+        (*spp)->label = strdup(sp->label);
+        (*spp)->value = sp->value;
+        spp = &(*spp)->next;
+        sp = sp->next;
+    }
+    return (xp);
+}
+
+static struct range_list *
+copy_ranges(struct range_list *sp)
+{
+    struct range_list *xp = NULL, **spp = &xp;
+
+    while (sp) {
+        *spp = (struct range_list *) calloc(1, sizeof(struct range_list));
+        if (!*spp)
+            break;
+        (*spp)->low = sp->low;
+        (*spp)->high = sp->high;
+        spp = &(*spp)->next;
+        sp = sp->next;
+    }
+    return (xp);
+}
+
+/*
+ * This routine parses a string like  { blah blah blah } and returns OBJID if
+ * it is well formed, and NULL if not.
+ */
+static int
+tossObjectIdentifier(FILE * fp)
+{
+    int             type;
+    char            token[MAXTOKEN];
+    int             bracketcount = 1;
+
+    type = get_token(fp, token, MAXTOKEN);
+
+    if (type != LEFTBRACKET)
+        return 0;
+    while ((type != RIGHTBRACKET || bracketcount > 0) && type != ENDOFFILE) {
+        type = get_token(fp, token, MAXTOKEN);
+        if (type == LEFTBRACKET)
+            bracketcount++;
+        else if (type == RIGHTBRACKET)
+            bracketcount--;
+    }
+
+    if (type == RIGHTBRACKET)
+        return OBJID;
+    else
+        return 0;
+}
+
+struct tree    *
+find_node(const char *name, struct tree *subtree)
+{                               /* Unused */
+    return (find_tree_node(name, -1));
+}
+
+struct module  *
+find_module(int mid)
+{
+    struct module  *mp;
+
+    for (mp = module_head; mp != NULL; mp = mp->next) {
+        if (mp->modid == mid)
+            break;
+    }
+    if (mp != 0)
+        return mp;
+    return NULL;
+}
+
+
+static char     leave_indent[256];
+static int      leave_was_simple;
+
+static void
+print_mib_leaves(FILE * f, struct tree *tp, int width)
+{
+    struct tree    *ntp;
+    char           *ip = leave_indent + strlen(leave_indent) - 1;
+    char            last_ipch = *ip;
+
+    *ip = '+';
+    if (tp->type == TYPE_OTHER || tp->type > TYPE_SIMPLE_LAST) {
+        fprintf(f, "%s--%s(%ld)\n", leave_indent, tp->label, tp->subid);
+        if (tp->indexes) {
+            struct index_list *xp = tp->indexes;
+            int             first = 1, cpos = 0, len, cmax =
+                width - strlen(leave_indent) - 12;
+            *ip = last_ipch;
+            fprintf(f, "%s  |  Index: ", leave_indent);
+            while (xp) {
+                if (first)
+                    first = 0;
+                else
+                    fprintf(f, ", ");
+                cpos += (len = strlen(xp->ilabel) + 2);
+                if (cpos > cmax) {
+                    fprintf(f, "\n");
+                    fprintf(f, "%s  |         ", leave_indent);
+                    cpos = len;
+                }
+                fprintf(f, "%s", xp->ilabel);
+                xp = xp->next;
+            }
+            fprintf(f, "\n");
+            *ip = '+';
+        }
+    } else {
+        const char     *acc, *typ;
+        int             size = 0;
+        switch (tp->access) {
+        case MIB_ACCESS_NOACCESS:
+            acc = "----";
+            break;
+        case MIB_ACCESS_READONLY:
+            acc = "-R--";
+            break;
+        case MIB_ACCESS_WRITEONLY:
+            acc = "--W-";
+            break;
+        case MIB_ACCESS_READWRITE:
+            acc = "-RW-";
+            break;
+        case MIB_ACCESS_NOTIFY:
+            acc = "---N";
+            break;
+        case MIB_ACCESS_CREATE:
+            acc = "CR--";
+            break;
+        default:
+            acc = "    ";
+            break;
+        }
+        switch (tp->type) {
+        case TYPE_OBJID:
+            typ = "ObjID    ";
+            break;
+        case TYPE_OCTETSTR:
+            typ = "String   ";
+            size = 1;
+            break;
+        case TYPE_INTEGER:
+            if (tp->enums)
+                typ = "EnumVal  ";
+            else
+                typ = "INTEGER  ";
+            break;
+        case TYPE_NETADDR:
+            typ = "NetAddr  ";
+            break;
+        case TYPE_IPADDR:
+            typ = "IpAddr   ";
+            break;
+        case TYPE_COUNTER:
+            typ = "Counter  ";
+            break;
+        case TYPE_GAUGE:
+            typ = "Gauge    ";
+            break;
+        case TYPE_TIMETICKS:
+            typ = "TimeTicks";
+            break;
+        case TYPE_OPAQUE:
+            typ = "Opaque   ";
+            size = 1;
+            break;
+        case TYPE_NULL:
+            typ = "Null     ";
+            break;
+        case TYPE_COUNTER64:
+            typ = "Counter64";
+            break;
+        case TYPE_BITSTRING:
+            typ = "BitString";
+            break;
+        case TYPE_NSAPADDRESS:
+            typ = "NsapAddr ";
+            break;
+        case TYPE_UNSIGNED32:
+            typ = "Unsigned ";
+            break;
+        case TYPE_UINTEGER:
+            typ = "UInteger ";
+            break;
+        case TYPE_INTEGER32:
+            typ = "Integer32";
+            break;
+        default:
+            typ = "         ";
+            break;
+        }
+        fprintf(f, "%s-- %s %s %s(%ld)\n", leave_indent, acc, typ,
+                tp->label, tp->subid);
+        *ip = last_ipch;
+        if (tp->tc_index >= 0)
+            fprintf(f, "%s        Textual Convention: %s\n", leave_indent,
+                    tclist[tp->tc_index].descriptor);
+        if (tp->enums) {
+            struct enum_list *ep = tp->enums;
+            int             cpos = 0, cmax =
+                width - strlen(leave_indent) - 16;
+            fprintf(f, "%s        Values: ", leave_indent);
+            while (ep) {
+                char            buf[80];
+                int             bufw;
+                if (ep != tp->enums)
+                    fprintf(f, ", ");
+                snprintf(buf, sizeof(buf), "%s(%d)", ep->label, ep->value);
+                buf[ sizeof(buf)-1 ] = 0;
+                cpos += (bufw = strlen(buf) + 2);
+                if (cpos >= cmax) {
+                    fprintf(f, "\n%s                ", leave_indent);
+                    cpos = bufw;
+                }
+                fprintf(f, "%s", buf);
+                ep = ep->next;
+            }
+            fprintf(f, "\n");
+        }
+        if (tp->ranges) {
+            struct range_list *rp = tp->ranges;
+            if (size)
+                fprintf(f, "%s        Size: ", leave_indent);
+            else
+                fprintf(f, "%s        Range: ", leave_indent);
+            while (rp) {
+                if (rp != tp->ranges)
+                    fprintf(f, " | ");
+                if (rp->low == rp->high)
+                    fprintf(f, "%d", rp->low);
+                else
+                    fprintf(f, "%d..%d", rp->low, rp->high);
+                rp = rp->next;
+            }
+            fprintf(f, "\n");
+        }
+    }
+    *ip = last_ipch;
+    strcat(leave_indent, "  |");
+    leave_was_simple = tp->type != TYPE_OTHER;
+
+    {
+        int             i, j, count = 0;
+        struct leave {
+            oid             id;
+            struct tree    *tp;
+        }              *leaves, *lp;
+
+        for (ntp = tp->child_list; ntp; ntp = ntp->next_peer)
+            count++;
+        if (count) {
+            leaves = (struct leave *) calloc(count, sizeof(struct leave));
+            if (!leaves)
+                return;
+            for (ntp = tp->child_list, count = 0; ntp;
+                 ntp = ntp->next_peer) {
+                for (i = 0, lp = leaves; i < count; i++, lp++)
+                    if (lp->id >= ntp->subid)
+                        break;
+                for (j = count; j > i; j--)
+                    leaves[j] = leaves[j - 1];
+                lp->id = ntp->subid;
+                lp->tp = ntp;
+                count++;
+            }
+            for (i = 1, lp = leaves; i <= count; i++, lp++) {
+                if (!leave_was_simple || lp->tp->type == 0)
+                    fprintf(f, "%s\n", leave_indent);
+                if (i == count)
+                    ip[3] = ' ';
+                print_mib_leaves(f, lp->tp, width);
+            }
+            free(leaves);
+            leave_was_simple = 0;
+        }
+    }
+    ip[1] = 0;
+}
+
+void
+print_mib_tree(FILE * f, struct tree *tp, int width)
+{
+    leave_indent[0] = ' ';
+    leave_indent[1] = 0;
+    leave_was_simple = 1;
+    print_mib_leaves(f, tp, width);
+}
+
+
+/*
+ * Merge the parsed object identifier with the existing node.
+ * If there is a problem with the identifier, release the existing node.
+ */
+static struct node *
+merge_parse_objectid(struct node *np, FILE * fp, char *name)
+{
+    struct node    *nnp;
+    /*
+     * printf("merge defval --> %s\n",np->defaultValue); 
+     */
+    nnp = parse_objectid(fp, name);
+    if (nnp) {
+
+        /*
+         * apply last OID sub-identifier data to the information 
+         */
+        /*
+         * already collected for this node. 
+         */
+        struct node    *headp, *nextp;
+        int             ncount = 0;
+        nextp = headp = nnp;
+        while (nnp->next) {
+            nextp = nnp;
+            ncount++;
+            nnp = nnp->next;
+        }
+
+        np->label = nnp->label;
+        np->subid = nnp->subid;
+        np->modid = nnp->modid;
+        np->parent = nnp->parent;
+	if (nnp->filename != NULL) {
+	  free(nnp->filename);
+	}
+        free(nnp);
+
+        if (ncount) {
+            nextp->next = np;
+            np = headp;
+        }
+    } else {
+        free_node(np);
+        np = NULL;
+    }
+
+    return np;
+}
+
+/*
+ * transfer data to tree from node
+ *
+ * move pointers for alloc'd data from np to tp.
+ * this prevents them from being freed when np is released.
+ * parent member is not moved.
+ *
+ * CAUTION: nodes may be repeats of existing tree nodes.
+ * This can happen especially when resolving IMPORT clauses.
+ *
+ */
+static void
+tree_from_node(struct tree *tp, struct node *np)
+{
+    free_partial_tree(tp, FALSE);
+
+    tp->label = np->label;
+    np->label = NULL;
+    tp->enums = np->enums;
+    np->enums = NULL;
+    tp->ranges = np->ranges;
+    np->ranges = NULL;
+    tp->indexes = np->indexes;
+    np->indexes = NULL;
+    tp->augments = np->augments;
+    np->augments = NULL;
+    tp->varbinds = np->varbinds;
+    np->varbinds = NULL;
+    tp->hint = np->hint;
+    np->hint = NULL;
+    tp->units = np->units;
+    np->units = NULL;
+    tp->description = np->description;
+    np->description = NULL;
+    tp->defaultValue = np->defaultValue;
+    np->defaultValue = NULL;
+    tp->subid = np->subid;
+    tp->tc_index = np->tc_index;
+    tp->type = translation_table[np->type];
+    tp->access = np->access;
+    tp->status = np->status;
+
+    set_function(tp);
+}
diff -Naur tomato/release/src/router/snmp/snmplib/read_config.c tomato121/release/src/router/snmp/snmplib/read_config.c
--- tomato/release/src/router/snmp/snmplib/read_config.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/snmplib/read_config.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,1652 @@
+/*
+ * read_config.c
+ */
+
+#include <net-snmp/net-snmp-config.h>
+
+#include <stdio.h>
+#include <ctype.h>
+#if HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#if HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+#if HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#include <sys/types.h>
+#if HAVE_SYS_PARAM_H
+#include <sys/param.h>
+#endif
+#if TIME_WITH_SYS_TIME
+# ifdef WIN32
+#  include <sys/timeb.h>
+# else
+#  include <sys/time.h>
+# endif
+# include <time.h>
+#else
+# if HAVE_SYS_TIME_H
+#  include <sys/time.h>
+# else
+#  include <time.h>
+# endif
+#endif
+#ifdef HAVE_SYS_STAT_H
+#include <sys/stat.h>
+#endif
+#if HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+#if HAVE_ARPA_INET_H
+#include <arpa/inet.h>
+#endif
+#if HAVE_SYS_SELECT_H
+#include <sys/select.h>
+#endif
+#if HAVE_WINSOCK_H
+#include <winsock.h>
+#endif
+#if HAVE_SYS_SOCKET_H
+#include <sys/socket.h>
+#endif
+#if HAVE_NETDB_H
+#include <netdb.h>
+#endif
+#include <errno.h>
+
+#if HAVE_DMALLOC_H
+#include <dmalloc.h>
+#endif
+
+#include <net-snmp/types.h>
+#include <net-snmp/output_api.h>
+#include <net-snmp/config_api.h>
+#include <net-snmp/library/read_config.h>       /* for "internal" definitions */
+#include <net-snmp/utilities.h>
+
+#include <net-snmp/library/mib.h>
+#include <net-snmp/library/parse.h>
+#include <net-snmp/library/snmp_api.h>
+#include <net-snmp/library/callback.h>
+
+static int      config_errors;
+
+struct config_files *config_files = NULL;
+
+struct config_line *
+register_prenetsnmp_mib_handler(const char *type,
+                                const char *token,
+                                void (*parser) (const char *, char *),
+                                void (*releaser) (void), const char *help)
+{
+    struct config_line *ltmp;
+    ltmp = register_config_handler(type, token, parser, releaser, help);
+    if (ltmp != NULL)
+        ltmp->config_time = PREMIB_CONFIG;
+    return (ltmp);
+}
+
+struct config_line *
+register_app_prenetsnmp_mib_handler(const char *token,
+                                    void (*parser) (const char *, char *),
+                                    void (*releaser) (void),
+                                    const char *help)
+{
+    return (register_prenetsnmp_mib_handler
+            (NULL, token, parser, releaser, help));
+}
+
+/*******************************************************************-o-******
+ * register_config_handler
+ *
+ * Parameters:
+ *	*type
+ *	*token
+ *	*parser
+ *	*releaser
+ *      
+ * Returns:
+ *	Pointer to a new config line entry  -OR-  NULL on error.
+ */
+struct config_line *
+register_config_handler(const char *type_param,
+                        const char *token,
+                        void (*parser) (const char *, char *),
+                        void (*releaser) (void), const char *help)
+{
+    struct config_files **ctmp = &config_files;
+    struct config_line **ltmp;
+    const char     *type = type_param;
+
+    if (type == NULL) {
+        type = netsnmp_ds_get_string(NETSNMP_DS_LIBRARY_ID, 
+				     NETSNMP_DS_LIB_APPTYPE);
+    }
+
+    /*
+     * Find type in current list  -OR-  create a new file type.
+     */
+    while (*ctmp != NULL && strcmp((*ctmp)->fileHeader, type)) {
+        ctmp = &((*ctmp)->next);
+    }
+
+    if (*ctmp == NULL) {
+        *ctmp = (struct config_files *)
+            calloc(1, sizeof(struct config_files));
+        if (!*ctmp) {
+            return NULL;
+        }
+
+        (*ctmp)->fileHeader = strdup(type);
+    }
+
+    /*
+     * Find parser type in current list  -OR-  create a new
+     * line parser entry.
+     */
+    ltmp = &((*ctmp)->start);
+
+    while (*ltmp != NULL && strcmp((*ltmp)->config_token, token)) {
+        ltmp = &((*ltmp)->next);
+    }
+
+    if (*ltmp == NULL) {
+        *ltmp = (struct config_line *)
+            calloc(1, sizeof(struct config_line));
+        if (!*ltmp) {
+            return NULL;
+        }
+
+        (*ltmp)->config_time = NORMAL_CONFIG;
+        (*ltmp)->config_token = strdup(token);
+        if (help != NULL)
+            (*ltmp)->help = strdup(help);
+    }
+
+    /*
+     * Add/Replace the parse/free functions for the given line type
+     * in the given file type.
+     */
+    (*ltmp)->parse_line = parser;
+    (*ltmp)->free_func = releaser;
+
+    return (*ltmp);
+
+}                               /* end register_config_handler() */
+
+struct config_line *
+register_app_config_handler(const char *token,
+                            void (*parser) (const char *, char *),
+                            void (*releaser) (void), const char *help)
+{
+    return (register_config_handler(NULL, token, parser, releaser, help));
+}
+
+void
+unregister_config_handler(const char *type_param, const char *token)
+{
+    struct config_files **ctmp = &config_files;
+    struct config_line **ltmp, *ltmp2;
+    const char     *type = type_param;
+
+    if (type == NULL) {
+        type = netsnmp_ds_get_string(NETSNMP_DS_LIBRARY_ID, 
+				     NETSNMP_DS_LIB_APPTYPE);
+    }
+
+    /*
+     * find type in current list 
+     */
+    while (*ctmp != NULL && strcmp((*ctmp)->fileHeader, type)) {
+        ctmp = &((*ctmp)->next);
+    }
+
+    if (*ctmp == NULL) {
+        /*
+         * Not found, return. 
+         */
+        return;
+    }
+
+    ltmp = &((*ctmp)->start);
+    if (*ltmp == NULL) {
+        /*
+         * Not found, return. 
+         */
+        return;
+    }
+    if (strcmp((*ltmp)->config_token, token) == 0) {
+        /*
+         * found it at the top of the list 
+         */
+        ltmp2 = (*ltmp)->next;
+        free((*ltmp)->config_token);
+        SNMP_FREE((*ltmp)->help);
+        free(*ltmp);
+        (*ctmp)->start = ltmp2;
+        return;
+    }
+    while ((*ltmp)->next != NULL
+           && strcmp((*ltmp)->next->config_token, token)) {
+        ltmp = &((*ltmp)->next);
+    }
+    if ((*ltmp)->next != NULL) {
+        free((*ltmp)->next->config_token);
+        SNMP_FREE((*ltmp)->next->help);
+        ltmp2 = (*ltmp)->next->next;
+        free((*ltmp)->next);
+        (*ltmp)->next = ltmp2;
+    }
+}
+
+void
+unregister_app_config_handler(const char *token)
+{
+    unregister_config_handler(NULL, token);
+}
+
+void
+unregister_all_config_handlers()
+{
+    struct config_files *ctmp, *save;
+    struct config_line *ltmp;
+
+    free_config();
+
+    /*
+     * Keep using config_files until there are no more! 
+     */
+    for (ctmp = config_files; ctmp;) {
+        for (ltmp = ctmp->start; ltmp; ltmp = ctmp->start) {
+            unregister_config_handler(ctmp->fileHeader,
+                                      ltmp->config_token);
+        }
+        free(ctmp->fileHeader);
+        save = ctmp->next;
+        free(ctmp);
+        ctmp = save;
+        config_files = save;
+    }
+}
+
+#ifdef TESTING
+void
+print_config_handlers(void)
+{
+    struct config_files *ctmp = config_files;
+    struct config_line *ltmp;
+
+    for (; ctmp != NULL; ctmp = ctmp->next) {
+        DEBUGMSGTL(("read_config", "read_conf: %s\n", ctmp->fileHeader));
+        for (ltmp = ctmp->start; ltmp != NULL; ltmp = ltmp->next)
+            DEBUGMSGTL(("read_config", "                   %s\n",
+                        ltmp->config_token));
+    }
+}
+#endif
+
+int             linecount;
+const char     *curfilename;
+
+struct config_line *
+read_config_get_handlers(const char *type)
+{
+    struct config_files *ctmp = config_files;
+    for (; ctmp != NULL && strcmp(ctmp->fileHeader, type);
+         ctmp = ctmp->next);
+    if (ctmp)
+        return ctmp->start;
+    return NULL;
+}
+
+void
+read_config_with_type(const char *filename, const char *type)
+{
+    struct config_line *ctmp = read_config_get_handlers(type);
+    if (ctmp)
+        read_config(filename, ctmp, EITHER_CONFIG);
+    else
+        DEBUGMSGTL(("read_config",
+                    "read_config: I have no registrations for type:%s,file:%s\n",
+                    type, filename));
+}
+
+
+struct config_line *
+read_config_find_handler(struct config_line *line_handlers,
+                         const char *token)
+{
+    struct config_line *lptr;
+
+    for (lptr = line_handlers; lptr != NULL; lptr = lptr->next) {
+        if (!strcasecmp(token, lptr->config_token)) {
+            return lptr;
+        }
+    }
+    return NULL;
+}
+
+
+/*
+ * searches a config_line linked list for a match 
+ */
+int
+run_config_handler(struct config_line *lptr,
+                   const char *token, char *cptr, int when)
+{
+    char            tmpbuf[STRINGMAX];
+    lptr = read_config_find_handler(lptr, token);
+    if (lptr != NULL) {
+        if (when == EITHER_CONFIG || lptr->config_time == when) {
+            DEBUGMSGTL(("read_config",
+                        "Found a parser.  Calling it: %s / %s\n", token,
+                        cptr));
+            (*(lptr->parse_line)) (token, cptr);
+        }
+    } else if (when != PREMIB_CONFIG && 
+	       !netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, 
+				       NETSNMP_DS_LIB_NO_TOKEN_WARNINGS)) {
+        snprintf(tmpbuf, sizeof(tmpbuf), "Unknown token: %s.", token);
+        tmpbuf[ sizeof(tmpbuf)-1 ] = 0;
+        config_pwarn(tmpbuf);
+        return SNMPERR_GENERR;
+    }
+    return SNMPERR_SUCCESS;
+}
+
+/*
+ * takens an arbitrary string and tries to intepret it based on the
+ * known configruation handlers for all registered types.  May produce
+ * inconsistent results when multiple tokens of the same name are
+ * registered under different file types. 
+ */
+
+/*
+ * we allow = delimeters here 
+ */
+#define SNMP_CONFIG_DELIMETERS " \t="
+
+int
+snmp_config_when(char *line, int when)
+{
+    char           *cptr, buf[STRINGMAX], tmpbuf[STRINGMAX];
+    struct config_line *lptr = NULL;
+    struct config_files *ctmp = config_files;
+
+    if (line == NULL) {
+        config_perror("snmp_config() called with a null string.");
+        return SNMPERR_GENERR;
+    }
+
+    strncpy(buf, line, STRINGMAX);
+    buf[STRINGMAX - 1] = '\0';
+    cptr = strtok(buf, SNMP_CONFIG_DELIMETERS);
+    if (cptr && cptr[0] == '[') {
+        if (cptr[strlen(cptr) - 1] != ']') {
+            config_perror("no matching ']'");
+            return SNMPERR_GENERR;
+        }
+        lptr = read_config_get_handlers(cptr + 1);
+        if (lptr == NULL) {
+            snprintf(tmpbuf,  sizeof(tmpbuf),
+                     "No handlers regestered for type %s.",
+                    cptr + 1);
+            tmpbuf[ sizeof(tmpbuf)-1 ] = 0;
+            config_perror(tmpbuf);
+            return SNMPERR_GENERR;
+        }
+        cptr = strtok(NULL, SNMP_CONFIG_DELIMETERS);
+        lptr = read_config_find_handler(lptr, cptr);
+    } else {
+        /*
+         * we have to find a token 
+         */
+        for (; ctmp != NULL && lptr == NULL; ctmp = ctmp->next)
+            lptr = read_config_find_handler(ctmp->start, cptr);
+    }
+    if (lptr == NULL && netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, 
+					  NETSNMP_DS_LIB_NO_TOKEN_WARNINGS)) {
+        snprintf(tmpbuf, sizeof(tmpbuf), "Unknown token: %s.", cptr);
+        tmpbuf[ sizeof(tmpbuf)-1 ] = 0;
+        config_pwarn(tmpbuf);
+        return SNMPERR_GENERR;
+    }
+
+    /*
+     * use the original string instead since strtok messed up the original 
+     */
+    line = skip_white(line + (cptr - buf) + strlen(cptr) + 1);
+
+    return (run_config_handler(lptr, cptr, line, when));
+}
+
+int
+netsnmp_config(char *line)
+{
+    int             ret = SNMP_ERR_NOERROR;
+    DEBUGMSGTL(("snmp_config", "remembering line \"%s\"\n", line));
+    netsnmp_config_remember(line);      /* always remember it so it's read
+                                         * processed after a free_config()
+                                         * call */
+    if (netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, 
+			       NETSNMP_DS_LIB_HAVE_READ_CONFIG)) {
+        DEBUGMSGTL(("snmp_config", "  ... processing it now\n"));
+        ret = snmp_config_when(line, NORMAL_CONFIG);
+    }
+    return ret;
+}
+
+void
+netsnmp_config_remember_in_list(char *line,
+                                struct read_config_memory **mem)
+{
+    if (mem == NULL)
+        return;
+
+    while (*mem != NULL)
+        mem = &((*mem)->next);
+
+    *mem = SNMP_MALLOC_STRUCT(read_config_memory);
+    if (line)
+        (*mem)->line = strdup(line);
+}
+
+void
+netsnmp_config_remember_free_list(struct read_config_memory **mem)
+{
+    struct read_config_memory *tmpmem;
+    while (*mem) {
+        SNMP_FREE((*mem)->line);
+        tmpmem = (*mem)->next;
+        free(*mem);
+        *mem = NULL;
+        mem = &tmpmem;
+    }
+}
+
+void
+netsnmp_config_process_memory_list(struct read_config_memory **memp,
+                                   int when, int clear)
+{
+
+    struct read_config_memory *mem;
+
+    if (!memp)
+        return;
+
+    mem = *memp;
+
+    while (mem) {
+        DEBUGMSGTL(("read_config", "processing memory: %s\n", mem->line));
+        snmp_config_when(mem->line, when);
+        mem = mem->next;
+    }
+
+    if (clear)
+        netsnmp_config_remember_free_list(memp);
+}
+
+/*
+ * default storage location implementation 
+ */
+static struct read_config_memory *memorylist = NULL;
+
+void
+netsnmp_config_remember(char *line)
+{
+    netsnmp_config_remember_in_list(line, &memorylist);
+}
+
+void
+netsnmp_config_process_memories(void)
+{
+    netsnmp_config_process_memory_list(&memorylist, EITHER_CONFIG, 1);
+}
+
+void
+netsnmp_config_process_memories_when(int when, int clear)
+{
+    netsnmp_config_process_memory_list(&memorylist, when, clear);
+}
+
+/*******************************************************************-o-******
+ * read_config
+ *
+ * Parameters:
+ *	*filename
+ *	*line_handler
+ *	 when
+ *
+ * Read <filename> and process each line in accordance with the list of
+ * <line_handler> functions.
+ *
+ *
+ * For each line in <filename>, search the list of <line_handler>'s 
+ * for an entry that matches the first token on the line.  This comparison is
+ * case insensitive.
+ *
+ * For each match, check that <when> is the designated time for the
+ * <line_handler> function to be executed before processing the line.
+ */
+void
+read_config(const char *filename,
+            struct config_line *line_handler, int when)
+{
+
+    FILE           *ifile;
+    char            line[STRINGMAX], token[STRINGMAX], tmpbuf[STRINGMAX];
+    char           *cptr;
+    int             i;
+    struct config_line *lptr;
+
+    linecount = 0;
+    curfilename = filename;
+
+    if ((ifile = fopen(filename, "r")) == NULL) {
+#ifdef ENOENT
+        if (errno == ENOENT) {
+            DEBUGMSGTL(("read_config", "%s: %s\n", filename,
+                        strerror(errno)));
+        } else
+#endif                          /* ENOENT */
+#ifdef EACCES
+        if (errno == EACCES) {
+            DEBUGMSGTL(("read_config", "%s: %s\n", filename,
+                        strerror(errno)));
+        } else
+#endif                          /* EACCES */
+#if defined(ENOENT) || defined(EACCES)
+        {
+            snmp_log_perror(filename);
+        }
+#else                           /* defined(ENOENT) || defined(EACCES) */
+            snmp_log_perror(filename);
+#endif                          /* ENOENT */
+        return;
+    } else {
+        DEBUGMSGTL(("read_config", "Reading configuration %s\n",
+                    filename));
+    }
+
+    while (fgets(line, sizeof(line), ifile) != NULL) {
+        lptr = line_handler;
+        linecount++;
+        cptr = line;
+        i = strlen(line) - 1;
+        if (line[i] == '\n')
+            line[i] = 0;
+        /*
+         * check blank line or # comment 
+         */
+        if ((cptr = skip_white(cptr))) {
+            cptr = copy_nword(cptr, token, sizeof(token));
+            if (token[0] == '[') {
+                token[strlen(token) - 1] = '\0';
+                lptr = read_config_get_handlers(&token[1]);
+                if (lptr == NULL) {
+                    snprintf(tmpbuf, sizeof(tmpbuf),
+                            "No handlers regestered for type %s.",
+                            &token[1]);
+                    tmpbuf[ sizeof(tmpbuf)-1 ] = 0;
+                    config_perror(tmpbuf);
+                    continue;
+                }
+                DEBUGMSGTL(("read_config",
+                            "Switching to new context: %s%s\n",
+                            ((cptr) ? "(this line only) " : ""),
+                            &token[1]));
+                if (cptr == NULL) {
+                    /*
+                     * change context permanently 
+                     */
+                    line_handler = lptr;
+                    continue;
+                } else {
+                    /*
+                     * the rest of this line only applies. 
+                     */
+                    cptr = copy_nword(cptr, token, sizeof(token));
+                }
+            } else {
+                lptr = line_handler;
+            }
+            if (cptr == NULL) {
+                snprintf(tmpbuf, sizeof(tmpbuf),
+                        "Blank line following %s token.", token);
+                tmpbuf[ sizeof(tmpbuf)-1 ] = 0;
+                config_perror(tmpbuf);
+            } else {
+                DEBUGMSGTL(("read_config", "%s:%d examining: %s\n",
+                            filename, linecount, line));
+                run_config_handler(lptr, token, cptr, when);
+            }
+        }
+    }
+    fclose(ifile);
+    return;
+
+}                               /* end read_config() */
+
+
+
+void
+free_config(void)
+{
+    struct config_files *ctmp = config_files;
+    struct config_line *ltmp;
+
+    for (; ctmp != NULL; ctmp = ctmp->next)
+        for (ltmp = ctmp->start; ltmp != NULL; ltmp = ltmp->next)
+            if (ltmp->free_func)
+                (*(ltmp->free_func)) ();
+}
+
+void
+read_configs(void)
+{
+
+    char *optional_config = netsnmp_ds_get_string(NETSNMP_DS_LIBRARY_ID, 
+					       NETSNMP_DS_LIB_OPTIONALCONFIG);
+    char *type = netsnmp_ds_get_string(NETSNMP_DS_LIBRARY_ID, 
+				       NETSNMP_DS_LIB_APPTYPE);
+
+    DEBUGMSGTL(("read_config", "reading normal configuration tokens\n"));
+
+    if (!netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, 
+				NETSNMP_DS_LIB_DONT_READ_CONFIGS)) {
+        read_config_files(NORMAL_CONFIG);
+    }
+
+    /*
+     * do this even when the normal above wasn't done 
+     */
+    if (optional_config && type) {
+        struct stat     statbuf;
+        if (stat(optional_config, &statbuf)) {
+            DEBUGMSGTL(("read_config",
+                        "Optional File \"%s\" does not exist.\n",
+                        optional_config));
+            snmp_log_perror(optional_config);
+        } else {
+            DEBUGMSGTL(("read_config",
+                        "Reading optional config file: \"%s\"\n",
+                        optional_config));
+            read_config_with_type(optional_config, type);
+        }
+    }
+
+    netsnmp_config_process_memories_when(NORMAL_CONFIG, 1);
+
+    netsnmp_ds_set_boolean(NETSNMP_DS_LIBRARY_ID, 
+			   NETSNMP_DS_LIB_HAVE_READ_CONFIG, 1);
+    snmp_call_callbacks(SNMP_CALLBACK_LIBRARY,
+                        SNMP_CALLBACK_POST_READ_CONFIG, NULL);
+}
+
+void
+read_premib_configs(void)
+{
+    DEBUGMSGTL(("read_config", "reading premib configuration tokens\n"));
+
+    if (!netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, 
+				NETSNMP_DS_LIB_DONT_READ_CONFIGS)) {
+        read_config_files(PREMIB_CONFIG);
+    }
+
+    netsnmp_config_process_memories_when(PREMIB_CONFIG, 0);
+
+    netsnmp_ds_set_boolean(NETSNMP_DS_LIBRARY_ID, 
+			   NETSNMP_DS_LIB_HAVE_READ_PREMIB_CONFIG, 1);
+    snmp_call_callbacks(SNMP_CALLBACK_LIBRARY,
+                        SNMP_CALLBACK_POST_PREMIB_READ_CONFIG, NULL);
+}
+
+/*******************************************************************-o-******
+ * set_configuration_directory
+ *
+ * Parameters:
+ *      char *dir - value of the directory
+ * Sets the configuration directory. Multiple directories can be
+ * specified, but need to be seperated by 'ENV_SEPARATOR_CHAR'.
+ */
+void
+set_configuration_directory(const char *dir)
+{
+    netsnmp_ds_set_string(NETSNMP_DS_LIBRARY_ID, 
+			  NETSNMP_DS_LIB_CONFIGURATION_DIR, dir);
+}
+
+/*******************************************************************-o-******
+ * get_configuration_directory
+ *
+ * Parameters: -
+ * Retrieve the configuration directory or directories.
+ * (For backwards compatibility that is:
+ *       SNMPCONFPATH, SNMPSHAREPATH, SNMPLIBPATH, HOME/.snmp
+ * First check whether the value is set.
+ * If not set give it the default value.
+ * Return the value.
+ * We always retrieve it new, since we have to do it anyway if it is just set.
+ */
+const char     *
+get_configuration_directory()
+{
+    char            defaultPath[SPRINT_MAX_LEN];
+    char           *homepath;
+
+    if (NULL == netsnmp_ds_get_string(NETSNMP_DS_LIBRARY_ID, 
+				      NETSNMP_DS_LIB_CONFIGURATION_DIR)) {
+        homepath = getenv("HOME");
+        snprintf(defaultPath, sizeof(defaultPath), "%s%c%s%c%s%s%s%s",
+                SNMPCONFPATH, ENV_SEPARATOR_CHAR,
+                SNMPSHAREPATH, ENV_SEPARATOR_CHAR, SNMPLIBPATH,
+                ((homepath == NULL) ? "" : ENV_SEPARATOR),
+                ((homepath == NULL) ? "" : homepath),
+                ((homepath == NULL) ? "" : "/.snmp"));
+        defaultPath[ sizeof(defaultPath)-1 ] = 0;
+        set_configuration_directory(defaultPath);
+    }
+    return (netsnmp_ds_get_string(NETSNMP_DS_LIBRARY_ID, 
+				  NETSNMP_DS_LIB_CONFIGURATION_DIR));
+}
+
+/*******************************************************************-o-******
+ * set_persistent_directory
+ *
+ * Parameters:
+ *      char *dir - value of the directory
+ * Sets the configuration directory. 
+ * No multiple directories may be specified.
+ * (However, this is not checked)
+ */
+void
+set_persistent_directory(const char *dir)
+{
+    netsnmp_ds_set_string(NETSNMP_DS_LIBRARY_ID, 
+			  NETSNMP_DS_LIB_PERSISTENT_DIR, dir);
+}
+
+/*******************************************************************-o-******
+ * get_persistent_directory
+ *
+ * Parameters: -
+ * Function will retrieve the persisten directory value.
+ * First check whether the value is set.
+ * If not set give it the default value.
+ * Return the value. 
+ * We always retrieve it new, since we have to do it anyway if it is just set.
+ */
+const char     *
+get_persistent_directory()
+{
+    if (NULL == netsnmp_ds_get_string(NETSNMP_DS_LIBRARY_ID, 
+				      NETSNMP_DS_LIB_PERSISTENT_DIR)) {
+        set_persistent_directory(PERSISTENT_DIRECTORY);
+    }
+    return (netsnmp_ds_get_string(NETSNMP_DS_LIBRARY_ID, 
+				  NETSNMP_DS_LIB_PERSISTENT_DIR));
+}
+
+
+/*******************************************************************-o-******
+ * read_config_files
+ *
+ * Parameters:
+ *	when	== PREMIB_CONFIG, NORMAL_CONFIG  -or-  EITHER_CONFIG
+ *
+ *
+ * Traverse the list of config file types, performing the following actions
+ * for each --
+ *
+ * First, build a search path for config files.  If the contents of 
+ * environment variable SNMPCONFPATH are NULL, then use the following
+ * path list (where the last entry exists only if HOME is non-null):
+ *
+ *	SNMPSHAREPATH:SNMPLIBPATH:${HOME}/.snmp
+ *
+ * Then, In each of these directories, read config files by the name of:
+ *
+ *	<dir>/<fileHeader>.conf		-AND-
+ *	<dir>/<fileHeader>.local.conf
+ *
+ * where <fileHeader> is taken from the config file type structure.
+ *
+ *
+ * PREMIB_CONFIG causes free_config() to be invoked prior to any other action.
+ *
+ *
+ * EXITs if any 'config_errors' are logged while parsing config file lines.
+ */
+void
+read_config_files(int when)
+{
+    int             i, j;
+    char            configfile[300];
+    char           *envconfpath;
+    const char     *confpath, *perspath;
+    char           *cptr1, *cptr2;
+    char            defaultPath[SPRINT_MAX_LEN];
+
+    struct config_files *ctmp = config_files;
+    struct config_line *ltmp;
+    struct stat     statbuf;
+
+    config_errors = 0;
+
+    if (when == PREMIB_CONFIG)
+        free_config();
+
+    confpath = get_configuration_directory();
+    perspath = get_persistent_directory();
+
+    /*
+     * read all config file types 
+     */
+    for (; ctmp != NULL; ctmp = ctmp->next) {
+
+        ltmp = ctmp->start;
+
+        /*
+         * read the config files 
+         */
+        if ((envconfpath = getenv("SNMPCONFPATH")) == NULL) {
+            snprintf(defaultPath, sizeof(defaultPath), "%s%s%s",
+                    ((confpath == NULL) ? "" : confpath),
+                    ((perspath == NULL) ? "" : ENV_SEPARATOR),
+                    ((perspath == NULL) ? "" : perspath));
+            defaultPath[ sizeof(defaultPath)-1 ] = 0;
+            envconfpath = defaultPath;
+        }
+        envconfpath = strdup(envconfpath);      /* prevent actually writing in env */
+        DEBUGMSGTL(("read_config", "config path used:%s\n", envconfpath));
+        cptr1 = cptr2 = envconfpath;
+        i = 1;
+        while (i && *cptr2 != 0) {
+            while (*cptr1 != 0 && *cptr1 != ENV_SEPARATOR_CHAR)
+                cptr1++;
+            if (*cptr1 == 0)
+                i = 0;
+            else
+                *cptr1 = 0;
+            /*
+             * for proper persistent storage retrival, we need to read old backup
+             * copies of the previous storage files.  If the application in
+             * question has died without the proper call to snmp_clean_persistent,
+             * then we read all the configuration files we can, starting with
+             * the oldest first.
+             */
+            if (strncmp(cptr2, perspath,
+                        strlen(perspath)) == 0 ||
+                (getenv("SNMP_PERSISTENT_FILE") != NULL &&
+                 strncmp(cptr2, getenv("SNMP_PERSISTENT_FILE"),
+                         strlen(getenv("SNMP_PERSISTENT_FILE"))) == 0)) {
+                /*
+                 * limit this to the known storage directory only 
+                 */
+                for (j = 0; j <= MAX_PERSISTENT_BACKUPS; j++) {
+                    snprintf(configfile, sizeof(configfile),
+                           "%s/%s.%d.conf", cptr2,
+                            ctmp->fileHeader, j);
+                    configfile[ sizeof(configfile)-1 ] = 0;
+                    if (stat(configfile, &statbuf) != 0) {
+                        /*
+                         * file not there, continue 
+                         */
+                        break;
+                    } else {
+                        /*
+                         * backup exists, read it 
+                         */
+                        DEBUGMSGTL(("read_config_files",
+                                    "old config file found: %s, parsing\n",
+                                    configfile));
+                        read_config(configfile, ltmp, when);
+                    }
+                }
+            }
+            snprintf(configfile, sizeof(configfile),
+                     "%s/%s.conf", cptr2, ctmp->fileHeader);
+            configfile[ sizeof(configfile)-1 ] = 0;
+            read_config(configfile, ltmp, when);
+            snprintf(configfile, sizeof(configfile),
+                     "%s/%s.local.conf", cptr2, ctmp->fileHeader);
+            configfile[ sizeof(configfile)-1 ] = 0;
+            read_config(configfile, ltmp, when);
+            cptr2 = ++cptr1;
+        }
+        free(envconfpath);
+    }
+
+    if (config_errors) {
+        snmp_log(LOG_ERR, "net-snmp: %d error(s) in config file(s)\n",
+                 config_errors);
+        /*
+         * exit(1); 
+         */
+    }
+}
+
+void
+read_config_print_usage(const char *lead)
+{
+    struct config_files *ctmp = config_files;
+    struct config_line *ltmp;
+
+    if (lead == NULL)
+        lead = "";
+
+    for (ctmp = config_files; ctmp != NULL; ctmp = ctmp->next) {
+        snmp_log(LOG_INFO, "%sIn %s.conf and %s.local.conf:\n", lead,
+                 ctmp->fileHeader, ctmp->fileHeader);
+        for (ltmp = ctmp->start; ltmp != NULL; ltmp = ltmp->next) {
+            DEBUGIF("read_config_usage") {
+                if (ltmp->config_time == PREMIB_CONFIG)
+                    DEBUGMSG(("read_config_usage", "*"));
+                else
+                    DEBUGMSG(("read_config_usage", " "));
+            }
+            if (ltmp->help) {
+                snmp_log(LOG_INFO, "%s%s%-24s %s\n", lead, lead,
+                         ltmp->config_token, ltmp->help);
+            } else {
+                DEBUGIF("read_config_usage") {
+                    snmp_log(LOG_INFO, "%s%s%-24s [NO HELP]\n", lead, lead,
+                             ltmp->config_token);
+                }
+            }
+        }
+    }
+}
+
+/*******************************************************************-o-******
+ * read_config_store
+ *
+ * Parameters:
+ *	*type
+ *	*line
+ *      
+ * 
+ * Append line to a file named either ENV(SNMP_PERSISTENT_FILE) or
+ *   "<PERSISTENT_DIRECTORY>/<type>.conf".
+ * Add a trailing newline to the stored file if necessary.
+ *
+ * Intended for use by applications to store permenant configuration 
+ * information generated by sets or persistent counters.
+ *
+ */
+void
+read_config_store(const char *type, const char *line)
+{
+#ifdef PERSISTENT_DIRECTORY
+    char            file[512], *filep;
+    FILE           *fout;
+#ifdef PERSISTENT_MASK
+    mode_t          oldmask;
+#endif
+
+    /*
+     * store configuration directives in the following order of preference:
+     * 1. ENV variable SNMP_PERSISTENT_FILE
+     * 2. configured <PERSISTENT_DIRECTORY>/<type>.conf
+     */
+    if ((filep = getenv("SNMP_PERSISTENT_FILE")) == NULL) {
+        snprintf(file, sizeof(file),
+                 "%s/%s.conf", get_persistent_directory(), type);
+        file[ sizeof(file)-1 ] = 0;
+        filep = file;
+    }
+#ifdef PERSISTENT_MASK
+    oldmask = umask(PERSISTENT_MASK);
+#endif
+    if (mkdirhier(filep, AGENT_DIRECTORY_MODE, 1)) {
+        snmp_log(LOG_ERR,
+                 "Failed to create the persistent directory for %s\n",
+                 file);
+    }
+    if ((fout = fopen(filep, "a")) != NULL) {
+        fprintf(fout, "%s", line);
+        if (line[strlen(line)] != '\n')
+            fprintf(fout, "\n");
+        DEBUGMSGTL(("read_config", "storing: %s\n", line));
+        fclose(fout);
+    } else {
+        snmp_log(LOG_ERR, "read_config_store open failure on %s\n", filep);
+    }
+#ifdef PERSISTENT_MASK
+    umask(oldmask);
+#endif
+
+#endif
+}                               /* end read_config_store() */
+
+void
+read_app_config_store(const char *line)
+{
+    read_config_store(netsnmp_ds_get_string(NETSNMP_DS_LIBRARY_ID, 
+					    NETSNMP_DS_LIB_APPTYPE), line);
+}
+
+
+
+
+/*******************************************************************-o-******
+ * snmp_save_persistent
+ *
+ * Parameters:
+ *	*type
+ *      
+ *
+ * Save the file "<PERSISTENT_DIRECTORY>/<type>.conf" into a backup copy
+ * called "<PERSISTENT_DIRECTORY>/<type>.%d.conf", which %d is an
+ * incrementing number on each call, but less than MAX_PERSISTENT_BACKUPS.
+ *
+ * Should be called just before all persistent information is supposed to be
+ * written to move aside the existing persistent cache.
+ * snmp_clean_persistent should then be called afterward all data has been
+ * saved to remove these backup files.
+ *
+ * Note: on an rename error, the files are removed rather than saved.
+ *
+ */
+void
+snmp_save_persistent(const char *type)
+{
+    char            file[512], fileold[SPRINT_MAX_LEN];
+    struct stat     statbuf;
+    int             j;
+
+    DEBUGMSGTL(("snmp_save_persistent", "saving %s files...\n", type));
+    snprintf(file, sizeof(file),
+             "%s/%s.conf", get_persistent_directory(), type);
+    file[ sizeof(file)-1 ] = 0;
+    if (stat(file, &statbuf) == 0) {
+        for (j = 0; j <= MAX_PERSISTENT_BACKUPS; j++) {
+            snprintf(fileold, sizeof(fileold),
+                     "%s/%s.%d.conf", get_persistent_directory(), type, j);
+            fileold[ sizeof(fileold)-1 ] = 0;
+            if (stat(fileold, &statbuf) != 0) {
+                DEBUGMSGTL(("snmp_save_persistent",
+                            " saving old config file: %s -> %s.\n", file,
+                            fileold));
+                if (rename(file, fileold)) {
+                    snmp_log(LOG_ERR, "Cannot rename %s to %s\n", file, fileold);
+                     /* moving it failed, try nuking it, as leaving
+                      * it around is very bad. */
+                    if (unlink(file) == -1)
+                        snmp_log(LOG_ERR, "Cannot unlink %s\n", file);
+                }
+                break;
+            }
+        }
+    }
+    /*
+     * save a warning header to the top of the new file 
+     */
+    snprintf(fileold, sizeof(fileold),
+            "#\n# net-snmp (or ucd-snmp) persistent data file.\n#\n# DO NOT STORE CONFIGURATION ENTRIES HERE.\n# Please save normal configuration tokens for %s in SNMPCONFPATH/%s.conf.\n# Only \"createUser\" tokens should be placed here by %s administrators.\n#\n",
+            type, type, type);
+    fileold[ sizeof(fileold)-1 ] = 0;
+    read_config_store(type, fileold);
+}
+
+
+/*******************************************************************-o-******
+ * snmp_clean_persistent
+ *
+ * Parameters:
+ *	*type
+ *      
+ *
+ * Unlink all backup files called "<PERSISTENT_DIRECTORY>/<type>.%d.conf".
+ *
+ * Should be called just after we successfull dumped the last of the
+ * persistent data, to remove the backup copies of previous storage dumps.
+ *
+ * XXX  Worth overwriting with random bytes first?  This would
+ *	ensure that the data is destroyed, even a buffer containing the
+ *	data persists in memory or swap.  Only important if secrets
+ *	will be stored here.
+ */
+void
+snmp_clean_persistent(const char *type)
+{
+    char            file[512];
+    struct stat     statbuf;
+    int             j;
+
+    DEBUGMSGTL(("snmp_clean_persistent", "cleaning %s files...\n", type));
+    snprintf(file, sizeof(file),
+             "%s/%s.conf", get_persistent_directory(), type);
+    file[ sizeof(file)-1 ] = 0;
+    if (stat(file, &statbuf) == 0) {
+        for (j = 0; j <= MAX_PERSISTENT_BACKUPS; j++) {
+            snprintf(file, sizeof(file),
+                     "%s/%s.%d.conf", get_persistent_directory(), type, j);
+            file[ sizeof(file)-1 ] = 0;
+            if (stat(file, &statbuf) == 0) {
+                DEBUGMSGTL(("snmp_clean_persistent",
+                            " removing old config file: %s\n", file));
+                if (unlink(file) == -1)
+                    snmp_log(LOG_ERR, "Cannot unlink %s\n", file);
+            }
+        }
+    }
+}
+
+
+
+
+/*
+ * config_perror: prints a warning string associated with a file and
+ * line number of a .conf file and increments the error count. 
+ */
+void
+config_perror(const char *string)
+{
+    snmp_log(LOG_ERR, "%s: line %d: Error: %s\n", curfilename, linecount,
+             string);
+    config_errors++;
+}
+
+void
+config_pwarn(const char *string)
+{
+    snmp_log(LOG_WARNING, "%s: line %d: Warning: %s\n", curfilename,
+             linecount, string);
+}
+
+/*
+ * skip all white spaces and return 1 if found something either end of
+ * line or a comment character 
+ */
+char           *
+skip_white(char *ptr)
+{
+    if (ptr == NULL)
+        return (NULL);
+    while (*ptr != 0 && isspace(*ptr))
+        ptr++;
+    if (*ptr == 0 || *ptr == '#')
+        return (NULL);
+    return (ptr);
+}
+
+char           *
+skip_not_white(char *ptr)
+{
+    if (ptr == NULL)
+        return (NULL);
+    while (*ptr != 0 && !isspace(*ptr))
+        ptr++;
+    if (*ptr == 0 || *ptr == '#')
+        return (NULL);
+    return (ptr);
+}
+
+char           *
+skip_token(char *ptr)
+{
+    ptr = skip_white(ptr);
+    ptr = skip_not_white(ptr);
+    ptr = skip_white(ptr);
+    return (ptr);
+}
+
+/*
+ * copy_word
+ * copies the next 'token' from 'from' into 'to', maximum len-1 characters.
+ * currently a token is anything seperate by white space
+ * or within quotes (double or single) (i.e. "the red rose" 
+ * is one token, \"the red rose\" is three tokens)
+ * a '\' character will allow a quote character to be treated
+ * as a regular character 
+ * It returns a pointer to first non-white space after the end of the token
+ * being copied or to 0 if we reach the end.
+ * Note: Partially copied words (greater than len) still returns a !NULL ptr
+ * Note: partially copied words are, however, null terminated.
+ */
+
+char           *
+copy_nword(char *from, char *to, int len)
+{
+    char            quote;
+    if ((*from == '\"') || (*from == '\'')) {
+        quote = *(from++);
+        while ((*from != quote) && (*from != 0)) {
+            if ((*from == '\\') && (*(from + 1) != 0)) {
+                if (len > 0) {  /* don't copy beyond len bytes */
+                    *to++ = *(from + 1);
+                    if (--len == 0)
+                        *(to - 1) = '\0';       /* null protect the last spot */
+                }
+                from = from + 2;
+            } else {
+                if (len > 0) {  /* don't copy beyond len bytes */
+                    *to++ = *from++;
+                    if (--len == 0)
+                        *(to - 1) = '\0';       /* null protect the last spot */
+                } else
+                    from++;
+            }
+        }
+        if (*from == 0) {
+            DEBUGMSGTL(("read_config_copy_word",
+                        "no end quote found in config string\n"));
+        } else
+            from++;
+    } else {
+        while (*from != 0 && !isspace(*from)) {
+            if ((*from == '\\') && (*(from + 1) != 0)) {
+                if (len > 0) {  /* don't copy beyond len bytes */
+                    *to++ = *(from + 1);
+                    if (--len == 0)
+                        *(to - 1) = '\0';       /* null protect the last spot */
+                }
+                from = from + 2;
+            } else {
+                if (len > 0) {  /* don't copy beyond len bytes */
+                    *to++ = *from++;
+                    if (--len == 0)
+                        *(to - 1) = '\0';       /* null protect the last spot */
+                } else
+                    from++;
+            }
+        }
+    }
+    if (len > 0)
+        *to = 0;
+    from = skip_white(from);
+    return (from);
+}                               /* copy_word */
+
+/*
+ * copy_word
+ * copies the next 'token' from 'from' into 'to'.
+ * currently a token is anything seperate by white space
+ * or within quotes (double or single) (i.e. "the red rose" 
+ * is one token, \"the red rose\" is three tokens)
+ * a '\' character will allow a quote character to be treated
+ * as a regular character 
+ * It returns a pointer to first non-white space after the end of the token
+ * being copied or to 0 if we reach the end.
+ */
+
+static int      have_warned = 0;
+char           *
+copy_word(char *from, char *to)
+{
+    if (!have_warned) {
+        snmp_log(LOG_INFO,
+                 "copy_word() called.  Use copy_nword() instead.\n");
+        have_warned = 1;
+    }
+    return copy_nword(from, to, SPRINT_MAX_LEN);
+}                               /* copy_word */
+
+/*
+ * read_config_save_octet_string(): saves an octet string as a length
+ * followed by a string of hex 
+ */
+char           *
+read_config_save_octet_string(char *saveto, u_char * str, size_t len)
+{
+    int             i;
+    u_char         *cp;
+
+    /*
+     * is everything easily printable 
+     */
+    for (i = 0, cp = str; i < (int) len && cp &&
+         (isalpha(*cp) || isdigit(*cp) || *cp == ' '); cp++, i++);
+
+    if (len != 0 && i == (int) len) {
+        *saveto++ = '"';
+        memcpy(saveto, str, len);
+        saveto += len;
+        *saveto++ = '"';
+        *saveto = '\0';
+    } else {
+        if (str != NULL) {
+            sprintf(saveto, "0x");
+            saveto += 2;
+            for (i = 0; i < (int) len; i++) {
+                sprintf(saveto, "%02x", str[i]);
+                saveto = saveto + 2;
+            }
+        } else {
+            sprintf(saveto, "\"\"");
+            saveto += 2;
+        }
+    }
+    return saveto;
+}
+
+/*
+ * read_config_read_octet_string(): reads an octet string that was
+ * saved by the read_config_save_octet_string() function 
+ */
+char           *
+read_config_read_octet_string(char *readfrom, u_char ** str, size_t * len)
+{
+    u_char         *cptr = NULL;
+    char           *cptr1;
+    u_int           tmp;
+    int             i;
+
+    if (readfrom == NULL || str == NULL)
+        return NULL;
+
+    if (strncasecmp(readfrom, "0x", 2) == 0) {
+        /*
+         * A hex string submitted. How long? 
+         */
+        readfrom += 2;
+        cptr1 = skip_not_white(readfrom);
+        if (cptr1)
+            *len = (cptr1 - readfrom);
+        else
+            *len = strlen(readfrom);
+
+        if (*len % 2) {
+            DEBUGMSGTL(("read_config_read_octet_string",
+                        "invalid hex string: wrong length"));
+            return NULL;
+        }
+        *len = *len / 2;
+
+        /*
+         * malloc data space if needed (+1 for good measure) 
+         */
+        if (*str == NULL) {
+            if ((cptr = (u_char *) malloc(*len + 1)) == NULL) {
+                return NULL;
+            }
+            *str = cptr;
+        } else {
+            cptr = *str;
+        }
+
+        /*
+         * copy validated data 
+         */
+        for (i = 0; i < (int) *len; i++) {
+            if (1 == sscanf(readfrom, "%2x", &tmp))
+                *cptr++ = (u_char) tmp;
+            else {
+                /*
+                 * we may lose memory, but don't know caller's buffer XX free(cptr); 
+                 */
+                return (NULL);
+            }
+            readfrom += 2;
+        }
+        *cptr++ = '\0';
+        readfrom = skip_white(readfrom);
+    } else {
+        /*
+         * Normal string 
+         */
+
+        /*
+         * malloc string space if needed (including NULL terminator) 
+         */
+        if (*str == NULL) {
+            char            buf[SNMP_MAXBUF];
+            readfrom = copy_nword(readfrom, buf, sizeof(buf));
+
+            *len = strlen(buf);
+            if ((cptr = (u_char *) malloc(*len + 1)) == NULL)
+                return NULL;
+            *str = cptr;
+            if (cptr) {
+                memcpy(cptr, buf, *len + 1);
+            }
+        } else {
+            readfrom = copy_nword(readfrom, (char *) *str, *len);
+            *len = strlen(*str);
+        }
+    }
+
+    return readfrom;
+}
+
+
+/*
+ * read_config_save_objid(): saves an objid as a numerical string 
+ */
+char           *
+read_config_save_objid(char *saveto, oid * objid, size_t len)
+{
+    int             i;
+
+    if (len == 0) {
+        strcat(saveto, "NULL");
+        saveto += strlen(saveto);
+        return saveto;
+    }
+
+    /*
+     * in case len=0, this makes it easier to read it back in 
+     */
+    for (i = 0; i < (int) len; i++) {
+        sprintf(saveto, ".%ld", objid[i]);
+        saveto += strlen(saveto);
+    }
+    return saveto;
+}
+
+/*
+ * read_config_read_objid(): reads an objid from a format saved by the above 
+ */
+char           *
+read_config_read_objid(char *readfrom, oid ** objid, size_t * len)
+{
+
+    if (objid == NULL || readfrom == NULL)
+        return NULL;
+
+    if (*objid == NULL) {
+        *len = 0;
+        if ((*objid = (oid *) malloc(MAX_OID_LEN * sizeof(oid))) == NULL)
+            return NULL;
+        *len = MAX_OID_LEN;
+    }
+
+    if (strncmp(readfrom, "NULL", 4) == 0) {
+        /*
+         * null length oid 
+         */
+        *len = 0;
+    } else {
+        /*
+         * qualify the string for read_objid 
+         */
+        char            buf[SPRINT_MAX_LEN];
+        copy_nword(readfrom, buf, sizeof(buf));
+
+        if (!read_objid(buf, *objid, len)) {
+            DEBUGMSGTL(("read_config_read_objid", "Invalid OID"));
+            *len = 0;
+            return NULL;
+        }
+    }
+
+    readfrom = skip_token(readfrom);
+    return readfrom;
+}
+
+/*
+ * read_config_read_data():
+ * reads data of a given type from a token(s) on a configuration line.
+ * 
+ * Returns: character pointer to the next token in the configuration line.
+ * NULL if none left.
+ * NULL if an unknown type.
+ * 
+ * dataptr is expected to match a pointer type being read
+ * (int *, u_int *, char **, oid **)
+ */
+char           *
+read_config_read_data(int type, char *readfrom, void *dataptr,
+                      size_t * len)
+{
+    int            *intp;
+    char          **charpp;
+    oid           **oidpp;
+    unsigned int   *uintp;
+
+    if (dataptr && readfrom)
+        switch (type) {
+        case ASN_INTEGER:
+            intp = (int *) dataptr;
+            *intp = atoi(readfrom);
+            readfrom = skip_token(readfrom);
+            return readfrom;
+
+        case ASN_TIMETICKS:
+        case ASN_UNSIGNED:
+            uintp = (unsigned int *) dataptr;
+            *uintp = strtoul(readfrom, NULL, 0);
+            readfrom = skip_token(readfrom);
+            return readfrom;
+
+        case ASN_OCTET_STR:
+        case ASN_BIT_STR:
+            charpp = (char **) dataptr;
+            return read_config_read_octet_string(readfrom,
+                                                 (u_char **) charpp, len);
+
+        case ASN_OBJECT_ID:
+            oidpp = (oid **) dataptr;
+            return read_config_read_objid(readfrom, oidpp, len);
+
+        default:
+            DEBUGMSGTL(("read_config_read_data", "Fail: Unknown type: %d",
+                        type));
+            return NULL;
+        }
+    return NULL;
+}
+
+/*
+ * read_config_read_memory():
+ * 
+ * similar to read_config_read_data, but expects a generic memory
+ * pointer rather than a specific type of pointer.  Len is expected to
+ * be the amount of available memory.
+ */
+char           *
+read_config_read_memory(int type, char *readfrom,
+                        char *dataptr, size_t * len)
+{
+    int            *intp;
+    unsigned int   *uintp;
+
+    if (!dataptr || !readfrom)
+        return NULL;
+
+    switch (type) {
+    case ASN_INTEGER:
+        if (*len < sizeof(int))
+            return NULL;
+        intp = (int *) dataptr;
+        *intp = atoi(readfrom);
+        *len = sizeof(int);
+        readfrom = skip_token(readfrom);
+        return readfrom;
+
+    case ASN_TIMETICKS:
+    case ASN_UNSIGNED:
+        if (*len < sizeof(unsigned int))
+            return NULL;
+        uintp = (unsigned int *) dataptr;
+        *uintp = strtoul(readfrom, NULL, 0);
+        *len = sizeof(unsigned int);
+        readfrom = skip_token(readfrom);
+        return readfrom;
+
+    case ASN_OCTET_STR:
+    case ASN_BIT_STR:
+    case ASN_PRIV_IMPLIED_OCTET_STR:
+        return read_config_read_octet_string(readfrom,
+                                             (u_char **) & dataptr, len);
+
+    case ASN_PRIV_IMPLIED_OBJECT_ID:
+    case ASN_OBJECT_ID:
+        readfrom =
+            read_config_read_objid(readfrom, (oid **) & dataptr, len);
+        *len *= sizeof(oid);
+        return readfrom;
+
+    default:
+        DEBUGMSGTL(("read_config_read_memory", "Fail: Unknown type: %d",
+                    type));
+        return NULL;
+    }
+    return NULL;
+}
+
+/*
+ * read_config_store_data():
+ * stores data of a given type to a configuration line.
+ * 
+ * Returns: character pointer to the end of the line.
+ * NULL if an unknown type.
+ */
+char           *
+read_config_store_data(int type, char *storeto, void *dataptr, size_t * len)
+{
+    return read_config_store_data_prefix(' ', type, storeto, dataptr, *len);
+}
+
+/*
+ * read_config_store_data_prefix():
+ * stores data of a given type to a configuration line.
+ * 
+ * Returns: character pointer to the end of the line.
+ * NULL if an unknown type.
+ */
+char           *
+read_config_store_data_prefix(char prefix, int type, char *storeto,
+                              void *dataptr, size_t len)
+{
+    int            *intp;
+    u_char        **charpp;
+    unsigned int   *uintp;
+    oid           **oidpp;
+
+    if (dataptr && storeto)
+        switch (type) {
+        case ASN_INTEGER:
+            intp = (int *) dataptr;
+            sprintf(storeto, "%c%d", prefix, *intp);
+            return (storeto + strlen(storeto));
+
+        case ASN_TIMETICKS:
+        case ASN_UNSIGNED:
+            uintp = (unsigned int *) dataptr;
+            sprintf(storeto, "%c%u", prefix, *uintp);
+            return (storeto + strlen(storeto));
+
+        case ASN_OCTET_STR:
+        case ASN_BIT_STR:
+            *storeto++ = prefix;
+            charpp = (u_char **) dataptr;
+            return read_config_save_octet_string(storeto, *charpp, len);
+
+        case ASN_OBJECT_ID:
+            *storeto++ = prefix;
+            oidpp = (oid **) dataptr;
+            return read_config_save_objid(storeto, *oidpp, len);
+
+        default:
+            DEBUGMSGTL(("read_config_store_data_prefix",
+                        "Fail: Unknown type: %d", type));
+            return NULL;
+        }
+    return NULL;
+}
diff -Naur tomato/release/src/router/snmp/snmplib/scapi.c tomato121/release/src/router/snmp/snmplib/scapi.c
--- tomato/release/src/router/snmp/snmplib/scapi.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/snmplib/scapi.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,875 @@
+/*
+ * scapi.c
+ *
+ */
+
+#include <net-snmp/net-snmp-config.h>
+
+#include <sys/types.h>
+#if HAVE_WINSOCK_H
+#include <winsock.h>
+#endif
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#if HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+#if TIME_WITH_SYS_TIME
+# ifdef WIN32
+#  include <sys/timeb.h>
+# else
+#  include <sys/time.h>
+# endif
+# include <time.h>
+#else
+# if HAVE_SYS_TIME_H
+#  include <sys/time.h>
+# else
+#  include <time.h>
+# endif
+#endif
+#ifdef HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+
+#if HAVE_DMALLOC_H
+#include <dmalloc.h>
+#endif
+
+#include <net-snmp/types.h>
+#include <net-snmp/output_api.h>
+#include <net-snmp/utilities.h>
+
+#ifdef USE_INTERNAL_MD5
+#include <net-snmp/library/md5.h>
+#endif
+#include <net-snmp/library/snmp_api.h>
+#include <net-snmp/library/callback.h>
+#include <net-snmp/library/snmp_secmod.h>
+#include <net-snmp/library/snmpusm.h>
+#include <net-snmp/library/keytools.h>
+#include <net-snmp/library/scapi.h>
+#include <net-snmp/library/mib.h>
+#include <net-snmp/library/transform_oids.h>
+
+#ifdef USE_OPENSSL
+#include <openssl/hmac.h>
+#include <openssl/evp.h>
+#include <openssl/rand.h>
+#include <openssl/des.h>
+#ifdef HAVE_AES
+#include <openssl/aes.h>
+#endif
+
+#ifdef STRUCT_DES_KS_STRUCT_HAS_WEAK_KEY
+/* these are older names for newer structures that exist in openssl .9.7 */
+#define DES_key_schedule    des_key_schedule 
+#define DES_cblock          des_cblock 
+#define DES_key_sched       des_key_sched 
+#define DES_ncbc_encrypt    des_ncbc_encrypt
+#define DES_cbc_encrypt    des_cbc_encrypt
+#define OLD_DES
+#endif
+
+#endif /* HAVE_OPENSSL */
+
+#ifdef QUITFUN
+#undef QUITFUN
+#define QUITFUN(e, l)					\
+	if (e != SNMPERR_SUCCESS) {			\
+		rval = SNMPERR_SC_GENERAL_FAILURE;	\
+		goto l ;				\
+	}
+#endif
+
+
+/*
+ * sc_get_properlength(oid *hashtype, u_int hashtype_len):
+ * 
+ * Given a hashing type ("hashtype" and its length hashtype_len), return
+ * the length of the hash result.
+ * 
+ * Returns either the length or SNMPERR_GENERR for an unknown hashing type.
+ */
+int
+sc_get_properlength(const oid * hashtype, u_int hashtype_len)
+{
+    DEBUGTRACE;
+    /*
+     * Determine transform type hash length.
+     */
+    if (ISTRANSFORM(hashtype, HMACMD5Auth)) {
+        return BYTESIZE(SNMP_TRANS_AUTHLEN_HMACMD5);
+    } else if (ISTRANSFORM(hashtype, HMACSHA1Auth)) {
+        return BYTESIZE(SNMP_TRANS_AUTHLEN_HMACSHA1);
+    }
+    return SNMPERR_GENERR;
+}
+
+
+/*******************************************************************-o-******
+ * sc_init
+ *
+ * Returns:
+ *	SNMPERR_SUCCESS			Success.
+ */
+int
+sc_init(void)
+{
+    int             rval = SNMPERR_SUCCESS;
+
+#ifndef USE_OPENSSL
+#ifdef USE_INTERNAL_MD5
+    struct timeval  tv;
+
+    DEBUGTRACE;
+
+    gettimeofday(&tv, (struct timezone *) 0);
+
+    srandom(tv.tv_sec ^ tv.tv_usec);
+#else
+    rval = SNMPERR_SC_NOT_CONFIGURED;
+#endif
+    /*
+     * XXX ogud: The only reason to do anything here with openssl is to 
+     * * XXX ogud: seed random number generator 
+     */
+#endif                          /* ifndef USE_OPENSSL */
+    return rval;
+}                               /* end sc_init() */
+
+/*******************************************************************-o-******
+ * sc_random
+ *
+ * Parameters:
+ *	*buf		Pre-allocated buffer.
+ *	*buflen 	Size of buffer.
+ *      
+ * Returns:
+ *	SNMPERR_SUCCESS			Success.
+ */
+int
+sc_random(u_char * buf, size_t * buflen)
+#if defined(USE_INTERNAL_MD5) || defined(USE_OPENSSL)
+{
+    int             rval = SNMPERR_SUCCESS;
+#ifdef USE_INTERNAL_MD5
+    int             i;
+    int             rndval;
+    u_char         *ucp = buf;
+#endif
+
+    DEBUGTRACE;
+
+#ifdef USE_OPENSSL
+    RAND_bytes(buf, *buflen);   /* will never fail */
+#else                           /* USE_INTERNAL_MD5 */
+    /*
+     * fill the buffer with random integers.  Note that random()
+     * is defined in config.h and may not be truly the random()
+     * system call if something better existed 
+     */
+    rval = *buflen - *buflen % sizeof(rndval);
+    for (i = 0; i < rval; i += sizeof(rndval)) {
+        rndval = random();
+        memcpy(ucp, &rndval, sizeof(rndval));
+        ucp += sizeof(rndval);
+    }
+
+    rndval = random();
+    memcpy(ucp, &rndval, *buflen % sizeof(rndval));
+
+    rval = SNMPERR_SUCCESS;
+#endif                          /* USE_OPENSSL */
+    return rval;
+
+}                               /* end sc_random() */
+
+#else
+_SCAPI_NOT_CONFIGURED
+#endif                          /*  */
+/*******************************************************************-o-******
+ * sc_generate_keyed_hash
+ *
+ * Parameters:
+ *	 authtype	Type of authentication transform.
+ *	 authtypelen
+ *	*key		Pointer to key (Kul) to use in keyed hash.
+ *	 keylen		Length of key in bytes.
+ *	*message	Pointer to the message to hash.
+ *	 msglen		Length of the message.
+ *	*MAC		Will be returned with allocated bytes containg hash.
+ *	*maclen		Length of the hash buffer in bytes; also indicates
+ *				whether the MAC should be truncated.
+ *      
+ * Returns:
+ *	SNMPERR_SUCCESS			Success.
+ *	SNMPERR_GENERR			All errs
+ *
+ *
+ * A hash of the first msglen bytes of message using a keyed hash defined
+ * by authtype is created and stored in MAC.  MAC is ASSUMED to be a buffer
+ * of at least maclen bytes.  If the length of the hash is greater than
+ * maclen, it is truncated to fit the buffer.  If the length of the hash is
+ * less than maclen, maclen set to the number of hash bytes generated.
+ *
+ * ASSUMED that the number of hash bits is a multiple of 8.
+ */
+int
+sc_generate_keyed_hash(const oid * authtype, size_t authtypelen,
+                       u_char * key, u_int keylen,
+                       u_char * message, u_int msglen,
+                       u_char * MAC, size_t * maclen)
+#if  defined(USE_INTERNAL_MD5) || defined(USE_OPENSSL)
+{
+    int             rval = SNMPERR_SUCCESS;
+    int             properlength;
+
+    u_char          buf[SNMP_MAXBUF_SMALL];
+#if  defined(USE_OPENSSL)
+    int             buf_len = sizeof(buf);
+#endif
+
+    DEBUGTRACE;
+
+#ifdef SNMP_TESTING_CODE
+    {
+        int             i;
+        DEBUGMSG(("sc_generate_keyed_hash",
+                  "sc_generate_keyed_hash(): key=0x"));
+        for (i = 0; i < keylen; i++)
+            DEBUGMSG(("sc_generate_keyed_hash", "%02x", key[i] & 0xff));
+        DEBUGMSG(("sc_generate_keyed_hash", " (%d)\n", keylen));
+    }
+#endif                          /* SNMP_TESTING_CODE */
+
+    /*
+     * Sanity check.
+     */
+    if (!authtype || !key || !message || !MAC || !maclen
+        || (keylen <= 0) || (msglen <= 0) || (*maclen <= 0)
+        || (authtypelen != USM_LENGTH_OID_TRANSFORM)) {
+        QUITFUN(SNMPERR_GENERR, sc_generate_keyed_hash_quit);
+    }
+
+    properlength = sc_get_properlength(authtype, authtypelen);
+    if (properlength == SNMPERR_GENERR)
+        return properlength;
+
+    if (((int) keylen < properlength)) {
+        QUITFUN(SNMPERR_GENERR, sc_generate_keyed_hash_quit);
+    }
+#ifdef USE_OPENSSL
+    /*
+     * Determine transform type.
+     */
+    if (ISTRANSFORM(authtype, HMACMD5Auth))
+        HMAC(EVP_md5(), key, keylen, message, msglen, buf, &buf_len);
+    else if (ISTRANSFORM(authtype, HMACSHA1Auth))
+        HMAC(EVP_sha1(), key, keylen, message, msglen, buf, &buf_len);
+    else {
+        QUITFUN(SNMPERR_GENERR, sc_generate_keyed_hash_quit);
+    }
+    if (buf_len != properlength) {
+        QUITFUN(rval, sc_generate_keyed_hash_quit);
+    }
+    if (*maclen > buf_len)
+        *maclen = buf_len;
+    memcpy(MAC, buf, *maclen);
+#else
+    if ((int) *maclen > properlength)
+        *maclen = properlength;
+    if (MDsign(message, msglen, MAC, *maclen, key, keylen)) {
+        rval = SNMPERR_GENERR;
+        goto sc_generate_keyed_hash_quit;
+    }
+#endif                          /* USE_OPENSSL */
+
+#ifdef SNMP_TESTING_CODE
+    {
+        char           *s;
+        int             len = binary_to_hex(MAC, *maclen, &s);
+
+        DEBUGMSGTL(("scapi", "Full v3 message hash: %s\n", s));
+        SNMP_ZERO(s, len);
+        SNMP_FREE(s);
+    }
+#endif
+
+  sc_generate_keyed_hash_quit:
+    SNMP_ZERO(buf, SNMP_MAXBUF_SMALL);
+    return rval;
+}                               /* end sc_generate_keyed_hash() */
+
+#else
+                _SCAPI_NOT_CONFIGURED
+#endif                          /* */
+/*
+ * sc_hash(): a generic wrapper around whatever hashing package we are using.
+ * 
+ * IN:
+ * hashtype    - oid pointer to a hash type
+ * hashtypelen - length of oid pointer
+ * buf         - u_char buffer to be hashed
+ * buf_len     - integer length of buf data
+ * MAC_len     - length of the passed MAC buffer size.
+ * 
+ * OUT:    
+ * MAC         - pre-malloced space to store hash output.
+ * MAC_len     - length of MAC output to the MAC buffer.
+ * 
+ * Returns:
+ * SNMPERR_SUCCESS              Success.
+ * SNMP_SC_GENERAL_FAILURE      Any error.
+ */
+int
+sc_hash(const oid * hashtype, size_t hashtypelen, u_char * buf,
+        size_t buf_len, u_char * MAC, size_t * MAC_len)
+#if defined(USE_INTERNAL_MD5) || defined(USE_OPENSSL)
+{
+#ifdef USE_OPENSSL
+    int             rval = SNMPERR_SUCCESS;
+    const EVP_MD         *hashfn;
+    EVP_MD_CTX     ctx, *cptr;
+#endif
+
+    DEBUGTRACE;
+
+    if (hashtype == NULL || hashtypelen < 0 || buf == NULL ||
+        buf_len < 0 || MAC == NULL || MAC_len == NULL ||
+        (int) (*MAC_len) < sc_get_properlength(hashtype, hashtypelen))
+        return (SNMPERR_GENERR);
+
+#ifdef USE_OPENSSL
+    /*
+     * Determine transform type.
+     */
+    if (ISTRANSFORM(hashtype, HMACMD5Auth)) {
+        hashfn = (const EVP_MD *) EVP_md5();
+    } else if (ISTRANSFORM(hashtype, HMACSHA1Auth)) {
+        hashfn = (const EVP_MD *) EVP_sha1();
+    } else {
+        return (SNMPERR_GENERR);
+    }
+
+/** initialize the pointer */
+    memset(&ctx, 0, sizeof(ctx));
+    cptr = &ctx;
+#if defined(OLD_DES)
+    EVP_DigestInit(cptr, hashfn);
+#else /* !OLD_DES */
+    /* this is needed if the runtime library is different than the compiled
+       library since the openssl versions are very different. */
+    if (SSLeay() < 0x907000) {
+        /* the old version of the struct was bigger and thus more
+           memory is needed. should be 152, but we use 256 for safety. */
+        cptr = malloc(256);
+        EVP_DigestInit(cptr, hashfn);
+    } else {
+        EVP_MD_CTX_init(cptr);
+        EVP_DigestInit(cptr, hashfn);
+    }
+#endif
+
+/** pass the data */
+    EVP_DigestUpdate(cptr, buf, buf_len);
+
+/** do the final pass */
+#if defined(OLD_DES)
+    EVP_DigestFinal(cptr, MAC, MAC_len);
+#else /* !OLD_DES */
+    if (SSLeay() < 0x907000) {
+        EVP_DigestFinal(cptr, MAC, MAC_len);
+        free(cptr);
+    } else {
+        EVP_DigestFinal_ex(cptr, MAC, MAC_len);
+        EVP_MD_CTX_cleanup(cptr);
+    }
+#endif
+    return (rval);
+#else                           /* USE_INTERNAL_MD5 */
+
+    if (MDchecksum(buf, buf_len, MAC, *MAC_len)) {
+        return SNMPERR_GENERR;
+    }
+    if (*MAC_len > 16)
+        *MAC_len = 16;
+    return SNMPERR_SUCCESS;
+
+#endif                          /* USE_OPENSSL */
+}
+#else                           /* !defined(USE_OPENSSL) && !defined(USE_INTERNAL_MD5) */
+_SCAPI_NOT_CONFIGURED
+#endif                          /* !defined(USE_OPENSSL) && !defined(USE_INTERNAL_MD5) */
+/*******************************************************************-o-******
+ * sc_check_keyed_hash
+ *
+ * Parameters:
+ *	 authtype	Transform type of authentication hash.
+ *	*key		Key bits in a string of bytes.
+ *	 keylen		Length of key in bytes.
+ *	*message	Message for which to check the hash.
+ *	 msglen		Length of message.
+ *	*MAC		Given hash.
+ *	 maclen		Length of given hash; indicates truncation if it is
+ *				shorter than the normal size of output for
+ *				given hash transform.
+ * Returns:
+ *	SNMPERR_SUCCESS		Success.
+ *	SNMP_SC_GENERAL_FAILURE	Any error
+ *
+ *
+ * Check the hash given in MAC against the hash of message.  If the length
+ * of MAC is less than the length of the transform hash output, only maclen
+ * bytes are compared.  The length of MAC cannot be greater than the
+ * length of the hash transform output.
+ */
+int
+sc_check_keyed_hash(const oid * authtype, size_t authtypelen,
+                    u_char * key, u_int keylen,
+                    u_char * message, u_int msglen,
+                    u_char * MAC, u_int maclen)
+#if defined(USE_INTERNAL_MD5) || defined(USE_OPENSSL)
+{
+    int             rval = SNMPERR_SUCCESS;
+    size_t          buf_len = SNMP_MAXBUF_SMALL;
+
+    u_char          buf[SNMP_MAXBUF_SMALL];
+
+    DEBUGTRACE;
+
+#ifdef SNMP_TESTING_CODE
+    {
+        int             i;
+        DEBUGMSG(("scapi", "sc_check_keyed_hash():    key=0x"));
+        for (i = 0; i < keylen; i++)
+            DEBUGMSG(("scapi", "%02x", key[i] & 0xff));
+        DEBUGMSG(("scapi", " (%d)\n", keylen));
+    }
+#endif                          /* SNMP_TESTING_CODE */
+
+    /*
+     * Sanity check.
+     */
+    if (!authtype || !key || !message || !MAC
+        || (keylen <= 0) || (msglen <= 0) || (maclen <= 0)
+        || (authtypelen != USM_LENGTH_OID_TRANSFORM)) {
+        QUITFUN(SNMPERR_GENERR, sc_check_keyed_hash_quit);
+    }
+
+
+    /*
+     * Generate a full hash of the message, then compare
+     * the result with the given MAC which may shorter than
+     * the full hash length.
+     */
+    rval = sc_generate_keyed_hash(authtype, authtypelen,
+                                  key, keylen,
+                                  message, msglen, buf, &buf_len);
+    QUITFUN(rval, sc_check_keyed_hash_quit);
+
+    if (maclen > msglen) {
+        QUITFUN(SNMPERR_GENERR, sc_check_keyed_hash_quit);
+
+    } else if (memcmp(buf, MAC, maclen) != 0) {
+        QUITFUN(SNMPERR_GENERR, sc_check_keyed_hash_quit);
+    }
+
+
+  sc_check_keyed_hash_quit:
+    SNMP_ZERO(buf, SNMP_MAXBUF_SMALL);
+
+    return rval;
+
+}                               /* end sc_check_keyed_hash() */
+
+#else
+_SCAPI_NOT_CONFIGURED
+#endif                          /* USE_INTERNAL_MD5 */
+/*******************************************************************-o-******
+ * sc_encrypt
+ *
+ * Parameters:
+ *	 privtype	Type of privacy cryptographic transform.
+ *	*key		Key bits for crypting.
+ *	 keylen		Length of key (buffer) in bytes.
+ *	*iv		IV bits for crypting.
+ *	 ivlen		Length of iv (buffer) in bytes.
+ *	*plaintext	Plaintext to crypt.
+ *	 ptlen		Length of plaintext.
+ *	*ciphertext	Ciphertext to crypt.
+ *	*ctlen		Length of ciphertext.
+ *      
+ * Returns:
+ *	SNMPERR_SUCCESS			Success.
+ *	SNMPERR_SC_NOT_CONFIGURED	Encryption is not supported.
+ *	SNMPERR_SC_GENERAL_FAILURE	Any other error
+ *
+ *
+ * Encrypt plaintext into ciphertext using key and iv.
+ *
+ * ctlen contains actual number of crypted bytes in ciphertext upon
+ * successful return.
+ */
+int
+sc_encrypt(const oid * privtype, size_t privtypelen,
+           u_char * key, u_int keylen,
+           u_char * iv, u_int ivlen,
+           u_char * plaintext, u_int ptlen,
+           u_char * ciphertext, size_t * ctlen)
+#if defined(USE_OPENSSL)
+{
+    int             rval = SNMPERR_SUCCESS;
+    u_int           properlength, properlength_iv;
+    u_char          pad_block[128];      /* bigger than anything I need */
+    u_char          my_iv[128];  /* ditto */
+    int             pad, plast, pad_size;
+#ifdef OLD_DES
+    DES_key_schedule key_sch;
+#else
+    DES_key_schedule key_sched_store;
+    DES_key_schedule *key_sch = &key_sched_store;
+#endif
+    DES_cblock       key_struct;
+#ifdef HAVE_AES
+    AES_KEY aes_key;
+    int new_ivlen = 0;
+#endif
+
+    DEBUGTRACE;
+
+    /*
+     * Sanity check.
+     */
+#if	!defined(SCAPI_AUTHPRIV)
+    snmp_log(LOG_ERR, "Encryption support not enabled.\n");
+    return SNMPERR_SC_NOT_CONFIGURED;
+#endif
+
+    if (!privtype || !key || !iv || !plaintext || !ciphertext || !ctlen
+        || (keylen <= 0) || (ivlen <= 0) || (ptlen <= 0) || (*ctlen <= 0)
+        || (privtypelen != USM_LENGTH_OID_TRANSFORM)) {
+        QUITFUN(SNMPERR_GENERR, sc_encrypt_quit);
+    } else if (ptlen > *ctlen) {
+        QUITFUN(SNMPERR_GENERR, sc_encrypt_quit);
+    }
+#ifdef SNMP_TESTING_CODE
+    {
+        size_t          buf_len = 128, out_len = 0;
+        u_char         *buf = (u_char *) malloc(buf_len);
+
+        if (buf != NULL) {
+            if (sprint_realloc_hexstring(&buf, &buf_len, &out_len, 1,
+                                         iv, ivlen)) {
+                DEBUGMSGTL(("scapi", "encrypt: IV: %s/", buf));
+            } else {
+                DEBUGMSGTL(("scapi", "encrypt: IV: %s [TRUNCATED]/", buf));
+            }
+            out_len = 0;
+            if (sprint_realloc_hexstring(&buf, &buf_len, &out_len, 1,
+                                         key, keylen)) {
+                DEBUGMSG(("scapi", "%s\n", buf));
+            } else {
+                DEBUGMSG(("scapi", "%s [TRUNCATED]\n", buf));
+            }
+            out_len = 0;
+            if (sprint_realloc_hexstring(&buf, &buf_len, &out_len, 1,
+                                         plaintext, 16)) {
+                DEBUGMSGTL(("scapi", "encrypt: string: %s\n", buf));
+            } else {
+                DEBUGMSGTL(("scapi", "encrypt: string: %s [TRUNCATED]\n",
+                            buf));
+            }
+            free(buf);
+        } else {
+            DEBUGMSGTL(("scapi",
+                        "encrypt: malloc fail for debug output\n"));
+        }
+    }
+#endif                          /* SNMP_TESTING_CODE */
+
+
+    /*
+     * Determine privacy transform.
+     */
+    if (ISTRANSFORM(privtype, DESPriv)) {
+        properlength = BYTESIZE(SNMP_TRANS_PRIVLEN_1DES);
+        properlength_iv = BYTESIZE(SNMP_TRANS_PRIVLEN_1DES_IV);
+        pad_size = properlength;
+#ifdef HAVE_AES
+    } else if (ISTRANSFORM(privtype, AES128Priv)) {
+        properlength = BYTESIZE(SNMP_TRANS_PRIVLEN_AES128);
+        properlength_iv = BYTESIZE(SNMP_TRANS_PRIVLEN_AES128_IV);
+    } else if (ISTRANSFORM(privtype, AES192Priv)) {
+        properlength = BYTESIZE(SNMP_TRANS_PRIVLEN_AES192);
+        properlength_iv = BYTESIZE(SNMP_TRANS_PRIVLEN_AES192_IV);
+    } else if (ISTRANSFORM(privtype, AES256Priv)) {
+        properlength = BYTESIZE(SNMP_TRANS_PRIVLEN_AES256);
+        properlength_iv = BYTESIZE(SNMP_TRANS_PRIVLEN_AES256_IV);
+#endif
+    } else {
+        QUITFUN(SNMPERR_GENERR, sc_encrypt_quit);
+    }
+
+    if ((keylen < properlength) || (ivlen < properlength_iv)) {
+        QUITFUN(SNMPERR_GENERR, sc_encrypt_quit);
+    }
+
+    memset(my_iv, 0, sizeof(my_iv));
+
+    if (ISTRANSFORM(privtype, DESPriv)) {
+
+        /*
+         * now calculate the padding needed 
+         */
+        pad = pad_size - (ptlen % pad_size);
+        plast = (int) ptlen - (pad_size - pad);
+        if (pad == pad_size)
+            pad = 0;
+        if (ptlen + pad > *ctlen) {
+            QUITFUN(SNMPERR_GENERR, sc_encrypt_quit);    /* not enough space */
+        }
+        if (pad > 0) {              /* copy data into pad block if needed */
+            memcpy(pad_block, plaintext + plast, pad_size - pad);
+            memset(&pad_block[pad_size - pad], pad, pad);   /* filling in padblock */
+        }
+
+        memcpy(key_struct, key, sizeof(key_struct));
+        (void) DES_key_sched(&key_struct, key_sch);
+
+        memcpy(my_iv, iv, ivlen);
+        /*
+         * encrypt the data 
+         */
+        DES_ncbc_encrypt(plaintext, ciphertext, plast, key_sch,
+                         (DES_cblock *) my_iv, DES_ENCRYPT);
+        if (pad > 0) {
+            /*
+             * then encrypt the pad block 
+             */
+            DES_ncbc_encrypt(pad_block, ciphertext + plast, pad_size,
+                             key_sch, (DES_cblock *) my_iv, DES_ENCRYPT);
+            *ctlen = plast + pad_size;
+        } else {
+            *ctlen = plast;
+        }
+    }
+#ifdef HAVE_AES
+    else if (ISTRANSFORM(privtype, AES128Priv) ||
+             ISTRANSFORM(privtype, AES192Priv) ||
+             ISTRANSFORM(privtype, AES256Priv)) {
+        (void) AES_set_encrypt_key(key, properlength*8, &aes_key);
+
+        memcpy(my_iv, iv, ivlen);
+        /*
+         * encrypt the data 
+         */
+        AES_cfb128_encrypt(plaintext, ciphertext, ptlen,
+                           &aes_key, my_iv, &new_ivlen, AES_ENCRYPT);
+        *ctlen = ptlen;
+    }
+#endif
+  sc_encrypt_quit:
+    /*
+     * clear memory just in case 
+     */
+    memset(my_iv, 0, sizeof(my_iv));
+    memset(pad_block, 0, sizeof(pad_block));
+    memset(key_struct, 0, sizeof(key_struct));
+#ifdef OLD_DES
+    memset(&key_sch, 0, sizeof(key_sch));
+#else
+    memset(&key_sched_store, 0, sizeof(key_sched_store));
+#endif
+#ifdef HAVE_AES
+    memset(&aes_key,0,sizeof(aes_key));
+#endif
+    return rval;
+
+}                               /* end sc_encrypt() */
+
+#else
+{
+#	if USE_INTERNAL_MD5
+    {
+        snmp_log(LOG_ERR, "Encryption support not enabled.\n");
+        DEBUGMSGTL(("scapi", "Encrypt function not defined.\n"));
+        return SNMPERR_SC_GENERAL_FAILURE;
+    }
+
+#	else
+    _SCAPI_NOT_CONFIGURED
+#	endif                   /* USE_INTERNAL_MD5 */
+}
+#endif                          /* */
+
+
+
+/*******************************************************************-o-******
+ * sc_decrypt
+ *
+ * Parameters:
+ *	 privtype
+ *	*key
+ *	 keylen
+ *	*iv
+ *	 ivlen
+ *	*ciphertext
+ *	 ctlen
+ *	*plaintext
+ *	*ptlen
+ *      
+ * Returns:
+ *	SNMPERR_SUCCESS			Success.
+ *	SNMPERR_SC_NOT_CONFIGURED	Encryption is not supported.
+ *      SNMPERR_SC_GENERAL_FAILURE      Any other error
+ *
+ *
+ * Decrypt ciphertext into plaintext using key and iv.
+ *
+ * ptlen contains actual number of plaintext bytes in plaintext upon
+ * successful return.
+ */
+int
+sc_decrypt(const oid * privtype, size_t privtypelen,
+           u_char * key, u_int keylen,
+           u_char * iv, u_int ivlen,
+           u_char * ciphertext, u_int ctlen,
+           u_char * plaintext, size_t * ptlen)
+#ifdef USE_OPENSSL
+{
+
+    int             rval = SNMPERR_SUCCESS;
+    u_char          my_iv[128];
+#ifdef OLD_DES
+    DES_key_schedule key_sch;
+#else
+    DES_key_schedule key_sched_store;
+    DES_key_schedule *key_sch = &key_sched_store;
+#endif
+    DES_cblock      key_struct;
+    u_int           properlength, properlength_iv;
+#ifdef HAVE_AES
+    int new_ivlen = 0;
+    AES_KEY aes_key;
+#endif
+
+    DEBUGTRACE;
+
+    if (!privtype || !key || !iv || !plaintext || !ciphertext || !ptlen
+        || (ctlen <= 0) || (*ptlen <= 0) || (*ptlen < ctlen)
+        || (privtypelen != USM_LENGTH_OID_TRANSFORM)) {
+        QUITFUN(SNMPERR_GENERR, sc_decrypt_quit);
+    }
+#ifdef SNMP_TESTING_CODE
+    {
+        size_t          buf_len = 128, out_len = 0;
+        u_char         *buf = (u_char *) malloc(buf_len);
+
+        if (buf != NULL) {
+            if (sprint_realloc_hexstring(&buf, &buf_len, &out_len, 1,
+                                         iv, ivlen)) {
+                DEBUGMSGTL(("scapi", "decrypt: IV: %s/", buf));
+            } else {
+                DEBUGMSGTL(("scapi", "decrypt: IV: %s [TRUNCATED]/", buf));
+            }
+            out_len = 0;
+            if (sprint_realloc_hexstring(&buf, &buf_len, &out_len, 1,
+                                         key, keylen)) {
+                DEBUGMSG(("scapi", "%s\n", buf));
+            } else {
+                DEBUGMSG(("scapi", "%s\n", buf));
+            }
+            free(buf);
+        } else {
+            DEBUGMSGTL(("scapi",
+                        "decrypt: malloc fail for debug output\n"));
+        }
+    }
+#endif                          /* SNMP_TESTING_CODE */
+
+    /*
+     * Determine privacy transform.
+     */
+    if (ISTRANSFORM(privtype, DESPriv)) {
+        properlength = BYTESIZE(SNMP_TRANS_PRIVLEN_1DES);
+        properlength_iv = BYTESIZE(SNMP_TRANS_PRIVLEN_1DES_IV);
+#ifdef HAVE_AES
+    } else if (ISTRANSFORM(privtype, AES128Priv)) {
+        properlength = BYTESIZE(SNMP_TRANS_PRIVLEN_AES128);
+        properlength_iv = BYTESIZE(SNMP_TRANS_PRIVLEN_AES128_IV);
+    } else if (ISTRANSFORM(privtype, AES192Priv)) {
+        properlength = BYTESIZE(SNMP_TRANS_PRIVLEN_AES192);
+        properlength_iv = BYTESIZE(SNMP_TRANS_PRIVLEN_AES192_IV);
+    } else if (ISTRANSFORM(privtype, AES256Priv)) {
+        properlength = BYTESIZE(SNMP_TRANS_PRIVLEN_AES256);
+        properlength_iv = BYTESIZE(SNMP_TRANS_PRIVLEN_AES256_IV);
+#endif
+    } else {
+        QUITFUN(SNMPERR_GENERR, sc_decrypt_quit);
+    }
+
+    if ((keylen < properlength) || (ivlen < properlength_iv)) {
+        QUITFUN(SNMPERR_GENERR, sc_decrypt_quit);
+    }
+
+    memset(my_iv, 0, sizeof(my_iv));
+    if (ISTRANSFORM(privtype, DESPriv)) {
+        memcpy(key_struct, key, sizeof(key_struct));
+        (void) DES_key_sched(&key_struct, key_sch);
+
+        memcpy(my_iv, iv, ivlen);
+        DES_cbc_encrypt(ciphertext, plaintext, ctlen, key_sch,
+                        (DES_cblock *) my_iv, DES_DECRYPT);
+        *ptlen = ctlen;
+    }
+#ifdef HAVE_AES
+    else if (ISTRANSFORM(privtype, AES128Priv) ||
+             ISTRANSFORM(privtype, AES192Priv) ||
+             ISTRANSFORM(privtype, AES256Priv)) {
+        (void) AES_set_encrypt_key(key, properlength*8, &aes_key);
+
+        memcpy(my_iv, iv, ivlen);
+        /*
+         * encrypt the data 
+         */
+        AES_cfb128_encrypt(ciphertext, plaintext, ctlen,
+                           &aes_key, my_iv, &new_ivlen, AES_DECRYPT);
+        *ptlen = ctlen;
+    }
+#endif
+
+    /*
+     * exit cond 
+     */
+  sc_decrypt_quit:
+#ifdef OLD_DES
+    memset(&key_sch, 0, sizeof(key_sch));
+#else
+    memset(&key_sched_store, 0, sizeof(key_sched_store));
+#endif
+    memset(key_struct, 0, sizeof(key_struct));
+    memset(my_iv, 0, sizeof(my_iv));
+    return rval;
+}
+#else                           /* USE OPEN_SSL */
+{
+#if	!defined(SCAPI_AUTHPRIV)
+    snmp_log(LOG_ERR, "Encryption support not enabled.\n");
+    return SNMPERR_SC_NOT_CONFIGURED;
+#else
+#	if USE_INTERNAL_MD5
+    {
+        DEBUGMSGTL(("scapi", "Decryption function not defined.\n"));
+        return SNMPERR_SC_GENERAL_FAILURE;
+    }
+
+#	else
+    _SCAPI_NOT_CONFIGURED
+#	endif                   /* USE_INTERNAL_MD5 */
+#endif                          /*  */
+}
+#endif                          /* USE_OPENSSL */
diff -Naur tomato/release/src/router/snmp/snmplib/snmpAAL5PVCDomain.c tomato121/release/src/router/snmp/snmplib/snmpAAL5PVCDomain.c
--- tomato/release/src/router/snmp/snmplib/snmpAAL5PVCDomain.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/snmplib/snmpAAL5PVCDomain.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,353 @@
+#include <net-snmp/net-snmp-config.h>
+
+#include <stdio.h>
+#include <sys/types.h>
+#include <ctype.h>
+#include <errno.h>
+
+#if HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+#if HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#if HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#if HAVE_SYS_SOCKET_H
+#include <sys/socket.h>
+#endif
+#include <atm.h>
+
+#if HAVE_DMALLOC_H
+#include <dmalloc.h>
+#endif
+
+#include <net-snmp/types.h>
+#include <net-snmp/output_api.h>
+#include <net-snmp/config_api.h>
+
+#include <net-snmp/library/snmp_transport.h>
+#include <net-snmp/library/snmpAAL5PVCDomain.h>
+
+
+oid netsnmp_AAL5PVCDomain[10] = { ENTERPRISE_MIB, 3, 3, 3 };
+static netsnmp_tdomain aal5pvcDomain;
+
+
+/*
+ * Return a string representing the address in data, or else the "far end"
+ * address if data is NULL.  
+ */
+
+static char *
+netsnmp_aal5pvc_fmtaddr(netsnmp_transport *t, void *data, int len)
+{
+    struct sockaddr_atmpvc *to = NULL;
+
+    if (data != NULL && len == sizeof(struct sockaddr_atmpvc)) {
+        to = (struct sockaddr_atmpvc *) data;
+    } else if (t != NULL && t->data != NULL &&
+               t->data_length == sizeof(struct sockaddr_atmpvc)) {
+        to = (struct sockaddr_atmpvc *) t->data;
+    }
+    if (to == NULL) {
+        return strdup("AAL5 PVC: unknown");
+    } else {
+        char tmp[64];
+        sprintf(tmp, "AAL5 PVC: %hd.%hd.%d", to->sap_addr.itf,
+                to->sap_addr.vpi, to->sap_addr.vci);
+        return strdup(tmp);
+    }
+}
+
+
+
+/*
+ * You can write something into opaque that will subsequently get passed back 
+ * to your send function if you like.  For instance, you might want to
+ * remember where a PDU came from, so that you can send a reply there...  
+ */
+
+static int
+netsnmp_aal5pvc_recv(netsnmp_transport *t, void *buf, int size,
+		     void **opaque, int *olength)
+{
+    int rc = -1;
+
+    if (t != NULL && t->sock >= 0) {
+	while (rc < 0) {
+	    rc = recv(t->sock, buf, size, 0);
+	    if (rc < 0 && errno != EINTR) {
+		break;
+	    }
+	}
+
+        if (rc >= 0) {
+            char *string = netsnmp_aal5pvc_fmtaddr(t, NULL, 0);
+            DEBUGMSGTL(("netsnmp_aal5pvc",
+			"recv on fd %d got %d bytes (from %s)\n", t->sock,
+                        rc, string));
+            free(string);
+        } else {
+            DEBUGMSGTL(("netsnmp_aal5pvc", "recv on fd %d err %d (\"%s\")\n", 
+			t->sock, errno, strerror(errno)));
+        }
+        *opaque = NULL;
+        *olength = 0;
+    }
+    return rc;
+}
+
+
+
+static int
+netsnmp_aal5pvc_send(netsnmp_transport *t, void *buf, int size,
+                  void **opaque, int *olength)
+{
+    int rc = -1;
+    struct sockaddr *to = NULL;
+
+    if (opaque != NULL && *opaque != NULL &&
+        *olength == sizeof(struct sockaddr_atmpvc)) {
+        to = (struct sockaddr *) (*opaque);
+    } else if (t != NULL && t->data != NULL &&
+               t->data_length == sizeof(struct sockaddr_atmpvc)) {
+        to = (struct sockaddr *) (t->data);
+    }
+
+    if (to != NULL && t != NULL && t->sock >= 0) {
+        char *string = netsnmp_aal5pvc_fmtaddr(NULL, (void *)to,
+					    sizeof(struct sockaddr_atmpvc));
+        DEBUGMSGTL(("netsnmp_aal5pvc","send %d bytes from %p to %s on fd %d\n",
+		    size, buf, string, t->sock));
+        free(string);
+	while (rc < 0) {
+	    rc = send(t->sock, buf, size, 0);
+	    if (rc < 0 && errno != EINTR) {
+		break;
+	    }
+	}
+    }
+    return rc;
+}
+
+
+
+static int
+netsnmp_aal5pvc_close(netsnmp_transport *t)
+{
+    int rc = -1;
+
+    if (t->sock >= 0) {
+        DEBUGMSGTL(("netsnmp_aal5pvc", "close fd %d\n", t->sock));
+#ifndef HAVE_CLOSESOCKET
+        rc = close(t->sock);
+#else
+        rc = closesocket(t->sock);
+#endif
+        t->sock = -1;
+    }
+    return rc;
+}
+
+
+
+/*
+ * Open an AAL5 PVC transport for SNMP.  Local is TRUE if addr is the local 
+ * NSAP to bind to (i.e. this is a server-type session); otherwise addr is 
+ * the remote NSAP to send things to.  
+ */
+
+netsnmp_transport *
+netsnmp_aal5pvc_transport(struct sockaddr_atmpvc *addr, int local)
+{
+    char           *string = NULL;
+    struct atm_qos  qos;
+    netsnmp_transport *t = NULL;
+
+    if (addr == NULL || addr->sap_family != AF_ATMPVC) {
+        return NULL;
+    }
+
+    t = (netsnmp_transport *) malloc(sizeof(netsnmp_transport));
+    if (t == NULL) {
+        return NULL;
+    }
+
+    string = netsnmp_aal5pvc_fmtaddr(NULL, (void *) addr,
+                                  sizeof(struct sockaddr_atmpvc));
+    DEBUGMSGTL(("netsnmp_aal5pvc", "open %s %s\n", local ? "local" : "remote",
+                string));
+    free(string);
+
+    memset(t, 0, sizeof(netsnmp_transport));
+
+    t->domain = netsnmp_AAL5PVCDomain;
+    t->domain_length =
+        sizeof(netsnmp_AAL5PVCDomain) / sizeof(netsnmp_AAL5PVCDomain[0]);
+
+    t->sock = socket(PF_ATMPVC, SOCK_DGRAM, 0);
+    if (t->sock < 0) {
+        DEBUGMSGTL(("netsnmp_aal5pvc","socket failed (%s)\n",strerror(errno)));
+        netsnmp_transport_free(t);
+        return NULL;
+    }
+    DEBUGMSGTL(("netsnmp_aal5pvc", "fd %d opened\n", t->sock));
+
+    /*
+     * Set up the QOS parameters.  
+     */
+
+    memset(&qos, 0, sizeof(struct atm_qos));
+    qos.aal = ATM_AAL5;
+    qos.rxtp.traffic_class = ATM_UBR;
+    qos.rxtp.max_sdu = SNMP_MAX_LEN;    /*  Hmm -- this is a bit small?  */
+    qos.txtp = qos.rxtp;
+
+    if (setsockopt(t->sock, SOL_ATM, SO_ATMQOS, &qos, sizeof(qos)) < 0) {
+        DEBUGMSGTL(("netsnmp_aal5pvc", "setsockopt failed (%s)\n",
+                    strerror(errno)));
+        netsnmp_aal5pvc_close(t);
+        netsnmp_transport_free(t);
+        return NULL;
+    }
+
+    if (local) {
+        t->local = malloc(8);
+        if (t->local == NULL) {
+            netsnmp_transport_free(t);
+            return NULL;
+        }
+        t->local[0] = (addr->sap_addr.itf & 0xff00) >> 8;
+        t->local[1] = (addr->sap_addr.itf & 0x00ff) >> 0;
+        t->local[2] = (addr->sap_addr.vpi & 0xff00) >> 8;
+        t->local[3] = (addr->sap_addr.vpi & 0x00ff) >> 0;
+        t->local[4] = (addr->sap_addr.vci & 0xff000000) >> 24;
+        t->local[5] = (addr->sap_addr.vci & 0x00ff0000) >> 16;
+        t->local[6] = (addr->sap_addr.vci & 0x0000ff00) >> 8;
+        t->local[7] = (addr->sap_addr.vci & 0x000000ff) >> 0;
+        t->local_length = 8;
+
+        if (bind(t->sock, (struct sockaddr *) addr,
+                 sizeof(struct sockaddr_atmpvc)) < 0) {
+            DEBUGMSGTL(("netsnmp_aal5pvc", "bind failed (%s)\n",
+                        strerror(errno)));
+            netsnmp_aal5pvc_close(t);
+            netsnmp_transport_free(t);
+            return NULL;
+        }
+    } else {
+        t->remote = malloc(8);
+        if (t->remote == NULL) {
+            netsnmp_transport_free(t);
+            return NULL;
+        }
+        t->remote[0] = (addr->sap_addr.itf & 0xff00) >> 8;
+        t->remote[1] = (addr->sap_addr.itf & 0x00ff) >> 0;
+        t->remote[2] = (addr->sap_addr.vpi & 0xff00) >> 8;
+        t->remote[3] = (addr->sap_addr.vpi & 0x00ff) >> 0;
+        t->remote[4] = (addr->sap_addr.vci & 0xff000000) >> 24;
+        t->remote[5] = (addr->sap_addr.vci & 0x00ff0000) >> 16;
+        t->remote[6] = (addr->sap_addr.vci & 0x0000ff00) >> 8;
+        t->remote[7] = (addr->sap_addr.vci & 0x000000ff) >> 0;
+        t->remote_length = 8;
+
+        if (connect(t->sock, (struct sockaddr *) addr,
+                    sizeof(struct sockaddr_atmpvc)) < 0) {
+            DEBUGMSGTL(("netsnmp_aal5pvc", "connect failed (%s)\n",
+                        strerror(errno)));
+            netsnmp_aal5pvc_close(t);
+            netsnmp_transport_free(t);
+            return NULL;
+        }
+    }
+
+    t->data = malloc(sizeof(struct sockaddr_atmpvc));
+    if (t->data == NULL) {
+        netsnmp_transport_free(t);
+        return NULL;
+    }
+    memcpy(t->data, addr, sizeof(struct sockaddr_atmpvc));
+    t->data_length = sizeof(struct sockaddr_atmpvc);
+
+    /*
+     * 16-bit length field in the trailer, no headers.  
+     */
+
+    t->msgMaxSize = 0xffff;
+    t->f_recv     = netsnmp_aal5pvc_recv;
+    t->f_send     = netsnmp_aal5pvc_send;
+    t->f_close    = netsnmp_aal5pvc_close;
+    t->f_accept   = NULL;
+    t->f_fmtaddr  = netsnmp_aal5pvc_fmtaddr;
+
+    return t;
+}
+
+
+
+netsnmp_transport *
+netsnmp_aal5pvc_create_tstring(const char *string, int local)
+{
+    struct sockaddr_atmpvc addr;
+
+    if (string != NULL) {
+        addr.sap_family = AF_ATMPVC;
+
+        if (sscanf(string, "%hd.%hd.%d", &(addr.sap_addr.itf),
+                   &(addr.sap_addr.vpi), &(addr.sap_addr.vci)) == 3) {
+            return netsnmp_aal5pvc_transport(&addr, local);
+        } else if (sscanf(string, "%hd.%d", &(addr.sap_addr.vpi),
+                          &(addr.sap_addr.vci)) == 2) {
+            addr.sap_addr.itf = 0;
+            return netsnmp_aal5pvc_transport(&addr, local);
+        } else if (sscanf(string, "%d", &(addr.sap_addr.vci)) == 1) {
+            addr.sap_addr.itf = 0;
+            addr.sap_addr.vpi = 0;
+            return netsnmp_aal5pvc_transport(&addr, local);
+        } else {
+            return NULL;
+        }
+    } else {
+        return NULL;
+    }
+}
+
+
+
+netsnmp_transport *
+netsnmp_aal5pvc_create_ostring(const u_char * o, size_t o_len, int local)
+{
+    struct sockaddr_atmpvc addr;
+
+    if (o_len == 8) {
+        addr.sap_family = AF_ATMPVC;
+        addr.sap_addr.itf = (o[0] << 8) + (o[1] << 0);
+        addr.sap_addr.vpi = (o[2] << 8) + (o[3] << 0);
+        addr.sap_addr.vci =
+	    (o[4] << 24) + (o[5] << 16) + (o[6] << 8) + (o[7] << 0);
+        return netsnmp_aal5pvc_transport(&addr, local);
+    }
+
+    return NULL;
+}
+
+
+
+void
+netsnmp_aal5pvc_ctor(void)
+{
+    aal5pvcDomain.name = netsnmp_AAL5PVCDomain;
+    aal5pvcDomain.name_length = sizeof(netsnmp_AAL5PVCDomain) / sizeof(oid);
+    aal5pvcDomain.prefix = calloc(3, sizeof(char *));
+    aal5pvcDomain.prefix[0] = "aal5pvc";
+    aal5pvcDomain.prefix[1] = "pvc";
+
+    aal5pvcDomain.f_create_from_tstring = netsnmp_aal5pvc_create_tstring;
+    aal5pvcDomain.f_create_from_ostring = netsnmp_aal5pvc_create_ostring;
+
+    netsnmp_tdomain_register(&aal5pvcDomain);
+}
diff -Naur tomato/release/src/router/snmp/snmplib/snmp_alarm.c tomato121/release/src/router/snmp/snmplib/snmp_alarm.c
--- tomato/release/src/router/snmp/snmplib/snmp_alarm.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/snmplib/snmp_alarm.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,404 @@
+/*
+ * snmp_alarm.c: generic library based alarm timers for various parts
+ * of an application 
+ */
+
+#include <net-snmp/net-snmp-config.h>
+
+#if HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#include <signal.h>
+#if HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#include <sys/types.h>
+#if HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+
+#if TIME_WITH_SYS_TIME
+# ifdef WIN32
+#  include <sys/timeb.h>
+# else
+#  include <sys/time.h>
+# endif
+# include <time.h>
+#else
+# if HAVE_SYS_TIME_H
+#  include <sys/time.h>
+# else
+#  include <time.h>
+# endif
+#endif
+#if HAVE_WINSOCK_H
+#include <winsock.h>
+#endif
+
+#if HAVE_DMALLOC_H
+#include <dmalloc.h>
+#endif
+
+#include <net-snmp/types.h>
+#include <net-snmp/output_api.h>
+#include <net-snmp/config_api.h>
+#include <net-snmp/utilities.h>
+
+#include <net-snmp/library/snmp_api.h>
+#include <net-snmp/library/callback.h>
+#include <net-snmp/library/snmp_alarm.h>
+
+static struct snmp_alarm *thealarms = NULL;
+static int      start_alarms = 0;
+static unsigned int regnum = 1;
+
+int
+init_alarm_post_config(int majorid, int minorid, void *serverarg,
+                       void *clientarg)
+{
+    start_alarms = 1;
+    set_an_alarm();
+    return SNMPERR_SUCCESS;
+}
+
+void
+init_snmp_alarm(void)
+{
+    start_alarms = 0;
+    snmp_register_callback(SNMP_CALLBACK_LIBRARY,
+                           SNMP_CALLBACK_POST_READ_CONFIG,
+                           init_alarm_post_config, NULL);
+}
+
+void
+sa_update_entry(struct snmp_alarm *a)
+{
+    if (a->t.tv_sec == 0 && a->t.tv_usec == 0) {
+        DEBUGMSGTL(("snmp_alarm",
+                    "update_entry: illegal interval specified\n"));
+        return;
+    }
+
+    if (a->t_last.tv_sec == 0 && a->t_last.tv_usec == 0) {
+        struct timeval  t_now;
+        /*
+         * Never been called yet, call time `t' from now.  
+         */
+        gettimeofday(&t_now, NULL);
+
+        a->t_last.tv_sec = t_now.tv_sec;
+        a->t_last.tv_usec = t_now.tv_usec;
+
+        a->t_next.tv_sec = t_now.tv_sec + a->t.tv_sec;
+        a->t_next.tv_usec = t_now.tv_usec + a->t.tv_usec;
+
+        while (a->t_next.tv_usec >= 1000000) {
+            a->t_next.tv_usec -= 1000000;
+            a->t_next.tv_sec += 1;
+        }
+    } else if (a->t_next.tv_sec == 0 && a->t_next.tv_usec == 0) {
+        /*
+         * We've been called but not reset for the next call.  
+         */
+        if (a->flags & SA_REPEAT) {
+            a->t_next.tv_sec = a->t_last.tv_sec + a->t.tv_sec;
+            a->t_next.tv_usec = a->t_last.tv_usec + a->t.tv_usec;
+
+            while (a->t_next.tv_usec >= 1000000) {
+                a->t_next.tv_usec -= 1000000;
+                a->t_next.tv_sec += 1;
+            }
+        } else {
+            /*
+             * Single time call, remove it.  
+             */
+            snmp_alarm_unregister(a->clientreg);
+        }
+    }
+}
+
+void
+snmp_alarm_unregister(unsigned int clientreg)
+{
+    struct snmp_alarm *sa_ptr, **prevNext = &thealarms;
+
+    for (sa_ptr = thealarms;
+         sa_ptr != NULL && sa_ptr->clientreg != clientreg;
+         sa_ptr = sa_ptr->next) {
+        prevNext = &(sa_ptr->next);
+    }
+
+    if (sa_ptr != NULL) {
+        *prevNext = sa_ptr->next;
+        DEBUGMSGTL(("snmp_alarm", "unregistered alarm %d\n", 
+		    sa_ptr->clientreg));
+        /*
+         * Note:  do not free the clientarg, its the clients responsibility 
+         */
+        free(sa_ptr);
+    } else {
+        DEBUGMSGTL(("snmp_alarm", "no alarm %d to unregister\n", clientreg));
+    }
+}
+
+void
+snmp_alarm_unregister_all(void)
+{
+  struct snmp_alarm *sa_ptr, *sa_tmp;
+
+  for (sa_ptr = thealarms; sa_ptr != NULL; sa_ptr = sa_tmp) {
+    sa_tmp = sa_ptr->next;
+    free(sa_ptr);
+  }
+  DEBUGMSGTL(("snmp_alarm", "ALL alarms unregistered\n"));
+  thealarms = NULL;
+}  
+
+struct snmp_alarm *
+sa_find_next(void)
+{
+    struct snmp_alarm *a, *lowest = NULL;
+
+    for (a = thealarms; a != NULL; a = a->next) {
+        if (lowest == NULL) {
+            lowest = a;
+        } else if (a->t_next.tv_sec == lowest->t_next.tv_sec) {
+            if (a->t_next.tv_usec < lowest->t_next.tv_usec) {
+                lowest = a;
+            }
+        } else if (a->t_next.tv_sec < lowest->t_next.tv_sec) {
+            lowest = a;
+        }
+    }
+    return lowest;
+}
+
+struct snmp_alarm *
+sa_find_specific(unsigned int clientreg)
+{
+    struct snmp_alarm *sa_ptr;
+    for (sa_ptr = thealarms; sa_ptr != NULL; sa_ptr = sa_ptr->next) {
+        if (sa_ptr->clientreg == clientreg) {
+            return sa_ptr;
+        }
+    }
+    return NULL;
+}
+
+void
+run_alarms(void)
+{
+    int             done = 0;
+    struct snmp_alarm *a = NULL;
+    unsigned int    clientreg;
+    struct timeval  t_now;
+
+    /*
+     * Loop through everything we have repeatedly looking for the next thing to
+     * call until all events are finally in the future again.  
+     */
+
+    while (!done) {
+        if ((a = sa_find_next()) == NULL) {
+            return;
+        }
+
+        gettimeofday(&t_now, NULL);
+
+        if ((a->t_next.tv_sec < t_now.tv_sec) ||
+            ((a->t_next.tv_sec == t_now.tv_sec) &&
+             (a->t_next.tv_usec < t_now.tv_usec))) {
+            clientreg = a->clientreg;
+            DEBUGMSGTL(("snmp_alarm", "run alarm %d\n", clientreg));
+            (*(a->thecallback)) (clientreg, a->clientarg);
+            DEBUGMSGTL(("snmp_alarm", "alarm %d completed\n", clientreg));
+
+            if ((a = sa_find_specific(clientreg)) != NULL) {
+                a->t_last.tv_sec = t_now.tv_sec;
+                a->t_last.tv_usec = t_now.tv_usec;
+                a->t_next.tv_sec = 0;
+                a->t_next.tv_usec = 0;
+                sa_update_entry(a);
+            } else {
+                DEBUGMSGTL(("snmp_alarm", "alarm %d deleted itself\n",
+                            clientreg));
+            }
+        } else {
+            done = 1;
+        }
+    }
+}
+
+
+
+RETSIGTYPE
+alarm_handler(int a)
+{
+    run_alarms();
+    set_an_alarm();
+}
+
+
+
+int
+get_next_alarm_delay_time(struct timeval *delta)
+{
+    struct snmp_alarm *sa_ptr;
+    struct timeval  t_diff, t_now;
+
+    sa_ptr = sa_find_next();
+
+    if (sa_ptr) {
+        gettimeofday(&t_now, 0);
+
+        if ((t_now.tv_sec > sa_ptr->t_next.tv_sec) ||
+            ((t_now.tv_sec == sa_ptr->t_next.tv_sec) &&
+             (t_now.tv_usec > sa_ptr->t_next.tv_usec))) {
+            /*
+             * Time has already passed.  Return the smallest possible amount of
+             * time.  
+             */
+            delta->tv_sec = 0;
+            delta->tv_usec = 1;
+            return sa_ptr->clientreg;
+        } else {
+            /*
+             * Time is still in the future.  
+             */
+            t_diff.tv_sec = sa_ptr->t_next.tv_sec - t_now.tv_sec;
+            t_diff.tv_usec = sa_ptr->t_next.tv_usec - t_now.tv_usec;
+
+            while (t_diff.tv_usec < 0) {
+                t_diff.tv_sec -= 1;
+                t_diff.tv_usec += 1000000;
+            }
+
+            delta->tv_sec = t_diff.tv_sec;
+            delta->tv_usec = t_diff.tv_usec;
+            return sa_ptr->clientreg;
+        }
+    }
+
+    /*
+     * Nothing Left.  
+     */
+    return 0;
+}
+
+
+void
+set_an_alarm(void)
+{
+    struct timeval  delta;
+    int             nextalarm = get_next_alarm_delay_time(&delta);
+
+    /*
+     * We don't use signals if they asked us nicely not to.  It's expected
+     * they'll check the next alarm time and do their own calling of
+     * run_alarms().  
+     */
+
+    if (nextalarm && !netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID,
+					NETSNMP_DS_LIB_ALARM_DONT_USE_SIG)) {
+#ifndef WIN32
+# ifdef HAVE_SETITIMER
+        struct itimerval it;
+
+        it.it_value.tv_sec = delta.tv_sec;
+        it.it_value.tv_usec = delta.tv_usec;
+        it.it_interval.tv_sec = 0;
+        it.it_interval.tv_usec = 0;
+
+        signal(SIGALRM, alarm_handler);
+        setitimer(ITIMER_REAL, &it, NULL);
+        DEBUGMSGTL(("snmp_alarm", "schedule alarm %d in %d.%03d seconds\n",
+                    nextalarm, delta.tv_sec, (delta.tv_usec / 1000)));
+# else  /* HAVE_SETITIMER */
+#  ifdef SIGALRM
+        signal(SIGALRM, alarm_handler);
+        alarm(delta.tv_sec);
+        DEBUGMSGTL(("snmp_alarm",
+                    "schedule alarm %d in roughly %d seconds\n", nextalarm,
+                    delta.tv_sec));
+#  endif  /* SIGALRM */
+# endif  /* HAVE_SETITIMER */
+#endif  /* WIN32 */
+
+    } else {
+        DEBUGMSGTL(("snmp_alarm", "no alarms found to schedule\n"));
+    }
+}
+
+
+
+unsigned int
+snmp_alarm_register(unsigned int when, unsigned int flags,
+                    SNMPAlarmCallback * thecallback, void *clientarg)
+{
+    struct snmp_alarm **sa_pptr;
+    if (thealarms != NULL) {
+        for (sa_pptr = &thealarms; (*sa_pptr) != NULL;
+             sa_pptr = &((*sa_pptr)->next));
+    } else {
+        sa_pptr = &thealarms;
+    }
+
+    *sa_pptr = SNMP_MALLOC_STRUCT(snmp_alarm);
+    if (*sa_pptr == NULL)
+        return 0;
+
+    (*sa_pptr)->t.tv_sec = when;
+    (*sa_pptr)->t.tv_usec = 0;
+    (*sa_pptr)->flags = flags;
+    (*sa_pptr)->clientarg = clientarg;
+    (*sa_pptr)->thecallback = thecallback;
+    (*sa_pptr)->clientreg = regnum++;
+    (*sa_pptr)->next = NULL;
+    sa_update_entry(*sa_pptr);
+
+    DEBUGMSGTL(("snmp_alarm",
+		"registered alarm %d, t = %d.%03d, flags=0x%02x\n",
+                (*sa_pptr)->clientreg, (*sa_pptr)->t.tv_sec,
+                ((*sa_pptr)->t.tv_usec / 1000), (*sa_pptr)->flags));
+
+    if (start_alarms)
+        set_an_alarm();
+    return (*sa_pptr)->clientreg;
+}
+
+
+
+unsigned int
+snmp_alarm_register_hr(struct timeval t, unsigned int flags,
+                       SNMPAlarmCallback * cb, void *cd)
+{
+    struct snmp_alarm **s = NULL;
+
+    for (s = &(thealarms); *s != NULL; s = &((*s)->next));
+
+    *s = SNMP_MALLOC_STRUCT(snmp_alarm);
+    if (*s == NULL) {
+        return 0;
+    }
+
+    (*s)->t.tv_sec = t.tv_sec;
+    (*s)->t.tv_usec = t.tv_usec;
+    (*s)->flags = flags;
+    (*s)->clientarg = cd;
+    (*s)->thecallback = cb;
+    (*s)->clientreg = regnum++;
+    (*s)->next = NULL;
+
+    sa_update_entry(*s);
+
+    DEBUGMSGTL(("snmp_alarm",
+                "registered alarm %d, t = %d.%03d, flags=0x%02x\n",
+                (*s)->clientreg, (*s)->t.tv_sec, ((*s)->t.tv_usec / 1000),
+                (*s)->flags));
+
+    if (start_alarms) {
+        set_an_alarm();
+    }
+
+    return (*s)->clientreg;
+}
diff -Naur tomato/release/src/router/snmp/snmplib/snmp_api.c tomato121/release/src/router/snmp/snmplib/snmp_api.c
--- tomato/release/src/router/snmp/snmplib/snmp_api.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/snmplib/snmp_api.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,6862 @@
+/******************************************************************
+	Copyright 1989, 1991, 1992 by Carnegie Mellon University
+
+                      All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of CMU not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+CMU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+CMU BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+******************************************************************/
+
+/** @defgroup library The Net-SNMP library
+ *  @{
+ */
+/*
+ * snmp_api.c - API for access to snmp.
+ */
+#include <net-snmp/net-snmp-config.h>
+
+#include <stdio.h>
+#include <ctype.h>
+#if HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#if HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+#if HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#include <sys/types.h>
+#if HAVE_SYS_PARAM_H
+#include <sys/param.h>
+#endif
+#if TIME_WITH_SYS_TIME
+# ifdef WIN32
+#  include <sys/timeb.h>
+# else
+#  include <sys/time.h>
+# endif
+# include <time.h>
+#else
+# if HAVE_SYS_TIME_H
+#  include <sys/time.h>
+# else
+#  include <time.h>
+# endif
+#endif
+#if HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+#if HAVE_ARPA_INET_H
+#include <arpa/inet.h>
+#endif
+#if HAVE_SYS_SELECT_H
+#include <sys/select.h>
+#endif
+#if HAVE_IO_H
+#include <io.h>
+#endif
+#if HAVE_WINSOCK_H
+#include <winsock.h>
+#endif
+#if HAVE_SYS_SOCKET_H
+#include <sys/socket.h>
+#endif
+#if HAVE_SYS_UN_H
+#include <sys/un.h>
+#endif
+#if HAVE_NETDB_H
+#include <netdb.h>
+#endif
+#if HAVE_NET_IF_DL_H
+#ifndef dynix
+#include <net/if_dl.h>
+#else
+#include <sys/net/if_dl.h>
+#endif
+#endif
+#include <errno.h>
+
+#if HAVE_LOCALE_H
+#include <locale.h>
+#endif
+
+#if HAVE_DMALLOC_H
+#include <dmalloc.h>
+#endif
+
+#define SNMP_NEED_REQUEST_LIST
+#include <net-snmp/types.h>
+#include <net-snmp/output_api.h>
+#include <net-snmp/config_api.h>
+#include <net-snmp/utilities.h>
+
+#include <net-snmp/library/asn1.h>
+#include <net-snmp/library/snmp.h>      /* for xdump & {build,parse}_var_op */
+#include <net-snmp/library/snmp_api.h>
+#include <net-snmp/library/snmp_client.h>
+#include <net-snmp/library/parse.h>
+#include <net-snmp/library/mib.h>
+#include <net-snmp/library/int64.h>
+#include <net-snmp/library/snmpv3.h>
+#include <net-snmp/library/callback.h>
+#include <net-snmp/library/container.h>
+#include <net-snmp/library/snmp_secmod.h>
+#ifdef SNMP_SECMOD_USM
+#include <net-snmp/library/snmpusm.h>
+#endif
+#ifdef SNMP_SECMOD_KSM
+#include <net-snmp/library/snmpksm.h>
+#endif
+#include <net-snmp/library/keytools.h>
+#include <net-snmp/library/lcd_time.h>
+#include <net-snmp/library/snmp_alarm.h>
+#include <net-snmp/library/snmp_transport.h>
+
+static void     _init_snmp(void);
+
+#include <net-snmp/library/transform_oids.h>
+#ifndef timercmp
+#define	timercmp(tvp, uvp, cmp) \
+	/* CSTYLED */ \
+	((tvp)->tv_sec cmp (uvp)->tv_sec || \
+	((tvp)->tv_sec == (uvp)->tv_sec && \
+	/* CSTYLED */ \
+	(tvp)->tv_usec cmp (uvp)->tv_usec))
+#endif
+#ifndef timerclear
+#define	timerclear(tvp)		(tvp)->tv_sec = (tvp)->tv_usec = 0
+#endif
+
+/*
+ * Globals.
+ */
+#define MAX_PACKET_LENGTH	(0x7fffffff)
+#ifndef NETSNMP_STREAM_QUEUE_LEN
+#define NETSNMP_STREAM_QUEUE_LEN  5
+#endif
+
+#ifndef BSD4_3
+#define BSD4_2
+#endif
+
+#ifndef FD_SET
+
+typedef long    fd_mask;
+#define NFDBITS	(sizeof(fd_mask) * NBBY)        /* bits per mask */
+
+#define	FD_SET(n, p)	((p)->fds_bits[(n)/NFDBITS] |= (1 << ((n) % NFDBITS)))
+#define	FD_CLR(n, p)	((p)->fds_bits[(n)/NFDBITS] &= ~(1 << ((n) % NFDBITS)))
+#define	FD_ISSET(n, p)	((p)->fds_bits[(n)/NFDBITS] & (1 << ((n) % NFDBITS)))
+#define FD_ZERO(p)	memset((p), 0, sizeof(*(p)))
+#endif
+
+static oid      default_enterprise[] = { 1, 3, 6, 1, 4, 1, 3, 1, 1 };
+/*
+ * enterprises.cmu.systems.cmuSNMP 
+ */
+
+#define DEFAULT_COMMUNITY   "public"
+#define DEFAULT_RETRIES	    5
+#define DEFAULT_TIMEOUT	    1000000L
+#define DEFAULT_REMPORT	    SNMP_PORT
+#define DEFAULT_ENTERPRISE  default_enterprise
+#define DEFAULT_TIME	    0
+
+/*
+ * don't set higher than 0x7fffffff, and I doubt it should be that high
+ * * = 4 gig snmp messages max 
+ */
+#define MAXIMUM_PACKET_SIZE 0x7fffffff
+
+/*
+ * Internal information about the state of the snmp session.
+ */
+struct snmp_internal_session {
+    netsnmp_request_list *requests;     /* Info about outstanding requests */
+    netsnmp_request_list *requestsEnd;  /* ptr to end of list */
+    int             (*hook_pre) (netsnmp_session *, netsnmp_transport *,
+                                 void *, int);
+    int             (*hook_parse) (netsnmp_session *, netsnmp_pdu *,
+                                   u_char *, size_t);
+    int             (*hook_post) (netsnmp_session *, netsnmp_pdu *, int);
+    int             (*hook_build) (netsnmp_session *, netsnmp_pdu *,
+                                   u_char *, size_t *);
+    int             (*hook_realloc_build) (netsnmp_session *,
+                                           netsnmp_pdu *, u_char **,
+                                           size_t *, size_t *);
+    int             (*check_packet) (u_char *, size_t);
+    netsnmp_pdu    *(*hook_create_pdu) (netsnmp_transport *,
+                                        void *, size_t);
+
+    u_char         *packet;
+    size_t          packet_len, packet_size;
+};
+
+/*
+ * The list of active/open sessions.
+ */
+struct session_list {
+    struct session_list *next;
+    netsnmp_session *session;
+    netsnmp_transport *transport;
+    struct snmp_internal_session *internal;
+};
+
+
+
+static const char *api_errors[-SNMPERR_MAX + 1] = {
+    "No error",                 /* SNMPERR_SUCCESS */
+    "Generic error",            /* SNMPERR_GENERR */
+    "Invalid local port",       /* SNMPERR_BAD_LOCPORT */
+    "Unknown host",             /* SNMPERR_BAD_ADDRESS */
+    "Unknown session",          /* SNMPERR_BAD_SESSION */
+    "Too long",                 /* SNMPERR_TOO_LONG */
+    "No socket",                /* SNMPERR_NO_SOCKET */
+    "Cannot send V2 PDU on V1 session", /* SNMPERR_V2_IN_V1 */
+    "Cannot send V1 PDU on V2 session", /* SNMPERR_V1_IN_V2 */
+    "Bad value for non-repeaters",      /* SNMPERR_BAD_REPEATERS */
+    "Bad value for max-repetitions",    /* SNMPERR_BAD_REPETITIONS */
+    "Error building ASN.1 representation",      /* SNMPERR_BAD_ASN1_BUILD */
+    "Failure in sendto",        /* SNMPERR_BAD_SENDTO */
+    "Bad parse of ASN.1 type",  /* SNMPERR_BAD_PARSE */
+    "Bad version specified",    /* SNMPERR_BAD_VERSION */
+    "Bad source party specified",       /* SNMPERR_BAD_SRC_PARTY */
+    "Bad destination party specified",  /* SNMPERR_BAD_DST_PARTY */
+    "Bad context specified",    /* SNMPERR_BAD_CONTEXT */
+    "Bad community specified",  /* SNMPERR_BAD_COMMUNITY */
+    "Cannot send noAuth/Priv",       /* SNMPERR_NOAUTH_DESPRIV */
+    "Bad ACL definition",       /* SNMPERR_BAD_ACL */
+    "Bad Party definition",     /* SNMPERR_BAD_PARTY */
+    "Session abort failure",    /* SNMPERR_ABORT */
+    "Unknown PDU type",         /* SNMPERR_UNKNOWN_PDU */
+    "Timeout",                  /* SNMPERR_TIMEOUT */
+    "Failure in recvfrom",      /* SNMPERR_BAD_RECVFROM */
+    "Unable to determine contextEngineID",      /* SNMPERR_BAD_ENG_ID */
+    "No securityName specified",        /* SNMPERR_BAD_SEC_NAME */
+    "Unable to determine securityLevel",        /* SNMPERR_BAD_SEC_LEVEL  */
+    "ASN.1 parse error in message",     /* SNMPERR_ASN_PARSE_ERR */
+    "Unknown security model in message",        /* SNMPERR_UNKNOWN_SEC_MODEL */
+    "Invalid message (e.g. msgFlags)",  /* SNMPERR_INVALID_MSG */
+    "Unknown engine ID",        /* SNMPERR_UNKNOWN_ENG_ID */
+    "Unknown user name",        /* SNMPERR_UNKNOWN_USER_NAME */
+    "Unsupported security level",       /* SNMPERR_UNSUPPORTED_SEC_LEVEL */
+    "Authentication failure (incorrect password, community or key)",    /* SNMPERR_AUTHENTICATION_FAILURE */
+    "Not in time window",       /* SNMPERR_NOT_IN_TIME_WINDOW */
+    "Decryption error",         /* SNMPERR_DECRYPTION_ERR */
+    "SCAPI general failure",    /* SNMPERR_SC_GENERAL_FAILURE */
+    "SCAPI sub-system not configured",  /* SNMPERR_SC_NOT_CONFIGURED */
+    "Key tools not available",  /* SNMPERR_KT_NOT_AVAILABLE */
+    "Unknown Report message",   /* SNMPERR_UNKNOWN_REPORT */
+    "USM generic error",        /* SNMPERR_USM_GENERICERROR */
+    "USM unknown security name (no such user exists)",  /* SNMPERR_USM_UNKNOWNSECURITYNAME */
+    "USM unsupported security level (this user has not been configured for that level of security)",    /* SNMPERR_USM_UNSUPPORTEDSECURITYLEVEL */
+    "USM encryption error",     /* SNMPERR_USM_ENCRYPTIONERROR */
+    "USM authentication failure (incorrect password or key)",   /* SNMPERR_USM_AUTHENTICATIONFAILURE */
+    "USM parse error",          /* SNMPERR_USM_PARSEERROR */
+    "USM unknown engineID",     /* SNMPERR_USM_UNKNOWNENGINEID */
+    "USM not in time window",   /* SNMPERR_USM_NOTINTIMEWINDOW */
+    "USM decryption error",     /* SNMPERR_USM_DECRYPTIONERROR */
+    "MIB not initialized",      /* SNMPERR_NOMIB */
+    "Value out of range",       /* SNMPERR_RANGE */
+    "Sub-id out of range",      /* SNMPERR_MAX_SUBID */
+    "Bad sub-id in object identifier",  /* SNMPERR_BAD_SUBID */
+    "Object identifier too long",       /* SNMPERR_LONG_OID */
+    "Bad value name",           /* SNMPERR_BAD_NAME */
+    "Bad value notation",       /* SNMPERR_VALUE */
+    "Unknown Object Identifier",        /* SNMPERR_UNKNOWN_OBJID */
+    "No PDU in snmp_send",      /* SNMPERR_NULL_PDU */
+    "Missing variables in PDU", /* SNMPERR_NO_VARS */
+    "Bad variable type",        /* SNMPERR_VAR_TYPE */
+    "Out of memory (malloc failure)",   /* SNMPERR_MALLOC */
+    "Kerberos related error",   /* SNMPERR_KRB5 */
+};
+
+static const char *secLevelName[] = {
+    "BAD_SEC_LEVEL",
+    "noAuthNoPriv",
+    "authNoPriv",
+    "authPriv"
+};
+
+/*
+ * Multiple threads may changes these variables.
+ * Suggest using the Single API, which does not use Sessions.
+ *
+ * Reqid may need to be protected. Time will tell...
+ *
+ */
+/*
+ * MTCRITICAL_RESOURCE
+ */
+/*
+ * use token in comments to individually protect these resources 
+ */
+struct session_list *Sessions = NULL;   /* MT_LIB_SESSION */
+static long     Reqid = 0;      /* MT_LIB_REQUESTID */
+static long     Msgid = 0;      /* MT_LIB_MESSAGEID */
+static long     Sessid = 0;     /* MT_LIB_SESSIONID */
+static long     Transid = 0;    /* MT_LIB_TRANSID */
+int             snmp_errno = 0;
+/*
+ * END MTCRITICAL_RESOURCE
+ */
+
+/*
+ * global error detail storage
+ */
+static char     snmp_detail[192];
+static int      snmp_detail_f = 0;
+
+/*
+ * Prototypes.
+ */
+int             snmp_build(u_char ** pkt, size_t * pkt_len,
+                           size_t * offset, netsnmp_session * pss,
+                           netsnmp_pdu *pdu);
+static int      snmp_parse(void *, netsnmp_session *, netsnmp_pdu *,
+                           u_char *, size_t);
+
+static void     snmpv3_calc_msg_flags(int, int, u_char *);
+static int      snmpv3_verify_msg(netsnmp_request_list *, netsnmp_pdu *);
+static int      snmpv3_build_probe_pdu(netsnmp_pdu **);
+static int      snmpv3_build(u_char ** pkt, size_t * pkt_len,
+                             size_t * offset, netsnmp_session * session,
+                             netsnmp_pdu *pdu);
+static int      snmp_parse_version(u_char *, size_t);
+static int      snmp_resend_request(struct session_list *slp,
+                                    netsnmp_request_list *rp,
+                                    int incr_retries);
+static void     register_default_handlers(void);
+static struct session_list *snmp_sess_copy(netsnmp_session * pss);
+int             snmp_get_errno(void);
+void            snmp_synch_reset(netsnmp_session * notused);
+void            snmp_synch_setup(netsnmp_session * notused);
+
+#ifndef HAVE_STRERROR
+const char     *
+strerror(int err)
+{
+    extern const char *sys_errlist[];
+    extern int      sys_nerr;
+
+    if (err < 0 || err >= sys_nerr)
+        return "Unknown error";
+    return sys_errlist[err];
+}
+#endif
+
+#define DEBUGPRINTPDUTYPE(token, type) \
+    switch(type) { \
+      case SNMP_MSG_GET: \
+        DEBUGDUMPSECTION(token, "PDU-GET"); \
+        break; \
+      case SNMP_MSG_GETNEXT: \
+        DEBUGDUMPSECTION(token, "PDU-GETNEXT"); \
+        break; \
+      case SNMP_MSG_RESPONSE: \
+        DEBUGDUMPSECTION(token, "PDU-RESPONSE"); \
+        break; \
+      case SNMP_MSG_SET: \
+        DEBUGDUMPSECTION(token, "PDU-SET"); \
+        break; \
+      case SNMP_MSG_GETBULK: \
+        DEBUGDUMPSECTION(token, "PDU-GETBULK"); \
+        break; \
+      case SNMP_MSG_INFORM: \
+        DEBUGDUMPSECTION(token, "PDU-INFORM"); \
+        break; \
+      case SNMP_MSG_TRAP2: \
+        DEBUGDUMPSECTION(token, "PDU-TRAP2"); \
+        break; \
+      case SNMP_MSG_REPORT: \
+        DEBUGDUMPSECTION(token, "PDU-REPORT"); \
+        break; \
+      default: \
+        DEBUGDUMPSECTION(token, "PDU-UNKNOWN"); \
+        break; \
+    }
+
+long
+snmp_get_next_reqid(void)
+{
+    long            retVal;
+    snmp_res_lock(MT_LIBRARY_ID, MT_LIB_REQUESTID);
+    retVal = 1 + Reqid;         /*MTCRITICAL_RESOURCE */
+    if (!retVal)
+        retVal = 2;
+    Reqid = retVal;
+    snmp_res_unlock(MT_LIBRARY_ID, MT_LIB_REQUESTID);
+    if (netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_16BIT_IDS))
+        return (retVal & 0x7fff);	/* mask to 15 bits */
+    else
+        return retVal;
+}
+
+long
+snmp_get_next_msgid(void)
+{
+    long            retVal;
+    snmp_res_lock(MT_LIBRARY_ID, MT_LIB_MESSAGEID);
+    retVal = 1 + Msgid;         /*MTCRITICAL_RESOURCE */
+    if (!retVal)
+        retVal = 2;
+    Msgid = retVal;
+    snmp_res_unlock(MT_LIBRARY_ID, MT_LIB_MESSAGEID);
+    if (netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_16BIT_IDS))
+        return (retVal & 0x7fff);	/* mask to 15 bits */
+    else
+        return retVal;
+}
+
+long
+snmp_get_next_sessid(void)
+{
+    long            retVal;
+    snmp_res_lock(MT_LIBRARY_ID, MT_LIB_SESSIONID);
+    retVal = 1 + Sessid;        /*MTCRITICAL_RESOURCE */
+    if (!retVal)
+        retVal = 2;
+    Sessid = retVal;
+    snmp_res_unlock(MT_LIBRARY_ID, MT_LIB_SESSIONID);
+    if (netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_16BIT_IDS))
+        return (retVal & 0x7fff);	/* mask to 15 bits */
+    else
+        return retVal;
+}
+
+long
+snmp_get_next_transid(void)
+{
+    long            retVal;
+    snmp_res_lock(MT_LIBRARY_ID, MT_LIB_TRANSID);
+    retVal = 1 + Transid;       /*MTCRITICAL_RESOURCE */
+    if (!retVal)
+        retVal = 2;
+    Transid = retVal;
+    snmp_res_unlock(MT_LIBRARY_ID, MT_LIB_TRANSID);
+    if (netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_16BIT_IDS))
+        return (retVal & 0x7fff);	/* mask to 15 bits */
+    else
+        return retVal;
+}
+
+void
+snmp_perror(const char *prog_string)
+{
+    const char     *str;
+    int             xerr;
+    xerr = snmp_errno;          /*MTCRITICAL_RESOURCE */
+    str = snmp_api_errstring(xerr);
+    snmp_log(LOG_ERR, "%s: %s\n", prog_string, str);
+}
+
+void
+snmp_set_detail(const char *detail_string)
+{
+    if (detail_string != NULL) {
+        strncpy((char *) snmp_detail, detail_string, sizeof(snmp_detail));
+        snmp_detail[sizeof(snmp_detail) - 1] = '\0';
+        snmp_detail_f = 1;
+    }
+}
+
+/*
+ * returns pointer to static data 
+ */
+/*
+ * results not guaranteed in multi-threaded use 
+ */
+const char     *
+snmp_api_errstring(int snmp_errnumber)
+{
+    const char     *msg = "";
+    static char     msg_buf[256];
+    if (snmp_errnumber >= SNMPERR_MAX && snmp_errnumber <= SNMPERR_GENERR) {
+        msg = api_errors[-snmp_errnumber];
+    } else if (snmp_errnumber != SNMPERR_SUCCESS) {
+        msg = "Unknown Error";
+    }
+    if (snmp_detail_f) {
+        snprintf(msg_buf, 256, "%s (%s)", msg, snmp_detail);
+        snmp_detail_f = 0;
+    } else {
+        strncpy(msg_buf, msg, 256);
+    }
+    msg_buf[255] = '\0';
+
+    return (msg_buf);
+}
+
+/*
+ * snmp_error - return error data
+ * Inputs :  address of errno, address of snmp_errno, address of string
+ * Caller must free the string returned after use.
+ */
+void
+snmp_error(netsnmp_session * psess,
+           int *p_errno, int *p_snmp_errno, char **p_str)
+{
+    char            buf[SPRINT_MAX_LEN];
+    int             snmp_errnumber;
+
+    if (p_errno)
+        *p_errno = psess->s_errno;
+    if (p_snmp_errno)
+        *p_snmp_errno = psess->s_snmp_errno;
+    if (p_str == NULL)
+        return;
+
+    strcpy(buf, "");
+    snmp_errnumber = psess->s_snmp_errno;
+    if (snmp_errnumber >= SNMPERR_MAX && snmp_errnumber <= SNMPERR_GENERR) {
+        strncpy(buf, api_errors[-snmp_errnumber], 256);
+    } else {
+        if (snmp_errnumber)
+            snprintf(buf, 256, "Unknown Error %d", snmp_errnumber);
+    }
+    buf[255] = '\0';
+
+    /*
+     * append a useful system errno interpretation. 
+     */
+    if (psess->s_errno) {
+        const char* error = strerror(psess->s_errno);
+        if(error == NULL)
+            error = "Unknown Error";
+        snprintf (&buf[strlen(buf)], 256-strlen(buf),
+                 " (%s)", error);
+    }
+    buf[255] = '\0';
+    *p_str = strdup(buf);
+}
+
+/*
+ * snmp_sess_error - same as snmp_error for single session API use.
+ */
+void
+snmp_sess_error(void *sessp, int *p_errno, int *p_snmp_errno, char **p_str)
+{
+    struct session_list *slp = (struct session_list *) sessp;
+
+    if ((slp) && (slp->session))
+        snmp_error(slp->session, p_errno, p_snmp_errno, p_str);
+}
+
+/*
+ * snmp_sess_perror(): print a error stored in a session pointer 
+ */
+void
+netsnmp_sess_log_error(int priority,
+                       const char *prog_string, netsnmp_session * ss)
+{
+    char           *err;
+    snmp_error(ss, NULL, NULL, &err);
+    snmp_log(priority, "%s: %s\n", prog_string, err);
+    free(err);
+}
+
+/*
+ * snmp_sess_perror(): print a error stored in a session pointer 
+ */
+void
+snmp_sess_perror(const char *prog_string, netsnmp_session * ss)
+{
+    netsnmp_sess_log_error(LOG_ERR, prog_string, ss);
+}
+
+
+
+/*
+ * Primordial SNMP library initialization.
+ * Initializes mutex locks.
+ * Invokes minimum required initialization for displaying MIB objects.
+ * Gets initial request ID for all transactions,
+ * and finds which port SNMP over UDP uses.
+ * SNMP over AppleTalk is not currently supported.
+ *
+ * Warning: no debug messages here.
+ */
+static void
+_init_snmp(void)
+{
+#ifdef  HAVE_GETSERVBYNAME
+    struct servent *servp;
+#endif
+    static char     have_done_init = 0;
+
+    struct timeval  tv;
+    long            tmpReqid, tmpMsgid;
+    u_short         s_port = SNMP_PORT;
+
+    if (have_done_init)
+        return;
+    have_done_init = 1;
+    Reqid = 1;
+
+    snmp_res_init();            /* initialize the mt locking structures */
+    init_mib_internals();
+    netsnmp_tdomain_init();
+
+    gettimeofday(&tv, (struct timezone *) 0);
+    /*
+     * Now = tv;
+     */
+
+    /*
+     * get pseudo-random values for request ID and message ID 
+     */
+    /*
+     * don't allow zero value to repeat init 
+     */
+#ifdef SVR4
+    srand48(tv.tv_sec ^ tv.tv_usec);
+    tmpReqid = lrand48();
+    tmpMsgid = lrand48();
+#else
+    srandom(tv.tv_sec ^ tv.tv_usec);
+    tmpReqid = random();
+    tmpMsgid = random();
+#endif
+
+    if (tmpReqid == 0)
+        tmpReqid = 1;
+    if (tmpMsgid == 0)
+        tmpMsgid = 1;
+    Reqid = tmpReqid;
+    Msgid = tmpMsgid;
+
+#ifdef HAVE_GETSERVBYNAME
+    servp = getservbyname("snmp", "udp");
+    if (servp) {
+        /*
+         * store it in host byte order 
+         */
+        s_port = ntohs(servp->s_port);
+    }
+#endif
+
+    netsnmp_ds_set_int(NETSNMP_DS_LIBRARY_ID, 
+		       NETSNMP_DS_LIB_DEFAULT_PORT, s_port);
+
+#ifdef USE_REVERSE_ASNENCODING
+    netsnmp_ds_set_boolean(NETSNMP_DS_LIBRARY_ID, 
+			   NETSNMP_DS_LIB_REVERSE_ENCODE,
+			   DEFAULT_ASNENCODING_DIRECTION);
+#endif
+}
+
+/*
+ * Initializes the session structure.
+ * May perform one time minimal library initialization.
+ * No MIB file processing is done via this call.
+ */
+void
+snmp_sess_init(netsnmp_session * session)
+{
+    _init_snmp();
+
+    /*
+     * initialize session to default values 
+     */
+
+    memset(session, 0, sizeof(netsnmp_session));
+    session->remote_port = SNMP_DEFAULT_REMPORT;
+    session->timeout = SNMP_DEFAULT_TIMEOUT;
+    session->retries = SNMP_DEFAULT_RETRIES;
+    session->version = SNMP_DEFAULT_VERSION;
+    session->securityModel = SNMP_DEFAULT_SECMODEL;
+    session->rcvMsgMaxSize = SNMP_MAX_MSG_SIZE;
+}
+
+
+static void
+register_default_handlers(void)
+{
+    netsnmp_ds_register_config(ASN_BOOLEAN, "snmp", "dumpPacket",
+		      NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_DUMP_PACKET);
+    netsnmp_ds_register_config(ASN_BOOLEAN, "snmp", "reverseEncodeBER",
+		      NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_REVERSE_ENCODE);
+    netsnmp_ds_register_config(ASN_INTEGER, "snmp", "defaultPort",
+		      NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_DEFAULT_PORT);
+    netsnmp_ds_register_config(ASN_OCTET_STR, "snmp", "defCommunity",
+                      NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_COMMUNITY);
+    netsnmp_ds_register_premib(ASN_BOOLEAN, "snmp", "noTokenWarnings",
+                      NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_NO_TOKEN_WARNINGS);
+    netsnmp_ds_register_config(ASN_BOOLEAN, "snmp", "noRangeCheck",
+		      NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_DONT_CHECK_RANGE);
+    netsnmp_ds_register_config(ASN_OCTET_STR, "snmp", "persistentDir",
+	              NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_PERSISTENT_DIR);
+    netsnmp_ds_register_config(ASN_BOOLEAN, "snmp", "noDisplayHint",
+	              NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_NO_DISPLAY_HINT);
+    netsnmp_ds_register_config(ASN_BOOLEAN, "snmp", "16bitIDs",
+	              NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_16BIT_IDS);
+}
+
+void
+init_snmp_enums(void)
+{
+    se_add_pair_to_slist("asntypes", strdup("integer"), ASN_INTEGER);
+    se_add_pair_to_slist("asntypes", strdup("counter"), ASN_COUNTER);
+    se_add_pair_to_slist("asntypes", strdup("gauge"), ASN_GAUGE);
+    se_add_pair_to_slist("asntypes", strdup("timeticks"), ASN_TIMETICKS);
+    se_add_pair_to_slist("asntypes", strdup("uinteger"), ASN_UINTEGER);
+    se_add_pair_to_slist("asntypes", strdup("counter64"), ASN_COUNTER64);
+    se_add_pair_to_slist("asntypes", strdup("octet_str"), ASN_OCTET_STR);
+    se_add_pair_to_slist("asntypes", strdup("ipaddress"), ASN_IPADDRESS);
+    se_add_pair_to_slist("asntypes", strdup("opaque"), ASN_OPAQUE);
+    se_add_pair_to_slist("asntypes", strdup("nsap"), ASN_NSAP);
+    se_add_pair_to_slist("asntypes", strdup("object_id"), ASN_OBJECT_ID);
+    se_add_pair_to_slist("asntypes", strdup("null"), ASN_NULL);
+    se_add_pair_to_slist("asntypes", strdup("bit_str"), ASN_BIT_STR);
+#ifdef OPAQUE_SPECIAL_TYPES
+    se_add_pair_to_slist("asntypes", strdup("opaque_counter64"),
+                         ASN_OPAQUE_COUNTER64);
+    se_add_pair_to_slist("asntypes", strdup("opaque_u64"), ASN_OPAQUE_U64);
+    se_add_pair_to_slist("asntypes", strdup("opaque_float"),
+                         ASN_OPAQUE_FLOAT);
+    se_add_pair_to_slist("asntypes", strdup("opaque_double"),
+                         ASN_OPAQUE_DOUBLE);
+    se_add_pair_to_slist("asntypes", strdup("opaque_i64"), ASN_OPAQUE_I64);
+#endif
+}
+
+
+
+/*******************************************************************-o-******
+ * init_snmp
+ *
+ * Parameters:
+ *      *type   Label for the config file "type" used by calling entity.
+ *
+ * Call appropriately the functions to do config file loading and
+ * mib module parsing in the correct order.
+ */
+void
+init_snmp(const char *type)
+{
+    static int      done_init = 0;      /* To prevent double init's. */
+
+    if (done_init) {
+        return;
+    }
+
+    done_init = 1;
+
+    /*
+     * make the type available everywhere else 
+     */
+    if (type && !netsnmp_ds_get_string(NETSNMP_DS_LIBRARY_ID, 
+				       NETSNMP_DS_LIB_APPTYPE)) {
+        netsnmp_ds_set_string(NETSNMP_DS_LIBRARY_ID, 
+			      NETSNMP_DS_LIB_APPTYPE, type);
+    }
+
+    _init_snmp();
+
+    /*
+     * set our current locale properly to initialize isprint() type functions 
+     */
+#ifdef HAVE_SETLOCALE
+    setlocale(LC_CTYPE, "");
+#endif
+
+    snmp_debug_init();    /* should be done first, to turn on debugging ASAP */
+    netsnmp_container_init_list();
+    init_callbacks();
+    init_snmp_logging();
+    snmp_init_statistics();
+    register_mib_handlers();
+    register_default_handlers();
+    init_snmpv3(type);
+    init_snmp_alarm();
+    init_snmp_enums();
+
+    read_premib_configs();
+    init_mib();
+
+    read_configs();
+
+}                               /* end init_snmp() */
+
+void
+snmp_store(const char *type)
+{
+    DEBUGMSGTL(("snmp_store", "storing stuff...\n"));
+    snmp_save_persistent(type);
+    snmp_call_callbacks(SNMP_CALLBACK_LIBRARY, SNMP_CALLBACK_STORE_DATA, NULL);
+    snmp_clean_persistent(type);
+}
+
+
+/*
+ * snmp_shutdown(const char *type):
+ * 
+ * Parameters:
+ * *type   Label for the config file "type" used by calling entity.
+ * 
+ * Does the appropriate shutdown calls for the library, saving
+ * persistent data, clean up, etc...
+ */
+void
+snmp_shutdown(const char *type)
+{
+    snmp_store(type);
+    snmp_call_callbacks(SNMP_CALLBACK_LIBRARY, SNMP_CALLBACK_SHUTDOWN, NULL);
+    snmp_alarm_unregister_all();
+    snmp_close_sessions();
+    shutdown_mib();
+    unregister_all_config_handlers();
+    netsnmp_ds_shutdown();
+}
+
+
+/*
+ * Sets up the session with the snmp_session information provided by the user.
+ * Then opens and binds the necessary low-level transport.  A handle to the
+ * created session is returned (this is NOT the same as the pointer passed to
+ * snmp_open()).  On any error, NULL is returned and snmp_errno is set to the
+ * appropriate error code.
+ */
+netsnmp_session *
+snmp_open(netsnmp_session *session)
+{
+    struct session_list *slp;
+    slp = (struct session_list *) snmp_sess_open(session);
+    if (!slp) {
+        return NULL;
+    }
+
+    snmp_res_lock(MT_LIBRARY_ID, MT_LIB_SESSION);
+    slp->next = Sessions;
+    Sessions = slp;
+    snmp_res_unlock(MT_LIBRARY_ID, MT_LIB_SESSION);
+
+    return (slp->session);
+}
+
+/*
+ * extended open 
+ */
+netsnmp_session *
+snmp_open_ex(netsnmp_session *session,
+             int (*fpre_parse)	(netsnmp_session *, netsnmp_transport *,
+                                void *, int),
+             int (*fparse)	(netsnmp_session *, netsnmp_pdu *, u_char *,
+				 size_t),
+	     int (*fpost_parse)	(netsnmp_session *, netsnmp_pdu *, int),
+
+             int (*fbuild)	(netsnmp_session *, netsnmp_pdu *, u_char *,
+				 size_t *),
+	     int (*frbuild)	(netsnmp_session *, netsnmp_pdu *,
+				 u_char **, size_t *, size_t *),
+             int (*fcheck)	(u_char *, size_t)
+	     )
+{
+    struct session_list *slp;
+    slp = (struct session_list *) snmp_sess_open(session);
+    if (!slp) {
+        return NULL;
+    }
+    slp->internal->hook_pre = fpre_parse;
+    slp->internal->hook_parse = fparse;
+    slp->internal->hook_post = fpost_parse;
+    slp->internal->hook_build = fbuild;
+    slp->internal->hook_realloc_build = frbuild;
+    slp->internal->check_packet = fcheck;
+
+    snmp_res_lock(MT_LIBRARY_ID, MT_LIB_SESSION);
+    slp->next = Sessions;
+    Sessions = slp;
+    snmp_res_unlock(MT_LIBRARY_ID, MT_LIB_SESSION);
+
+    return (slp->session);
+}
+
+static struct session_list *
+_sess_copy(netsnmp_session * in_session)
+{
+    struct session_list *slp;
+    struct snmp_internal_session *isp;
+    netsnmp_session *session;
+    struct snmp_secmod_def *sptr;
+    char           *cp;
+    u_char         *ucp;
+    size_t          i;
+
+    in_session->s_snmp_errno = 0;
+    in_session->s_errno = 0;
+
+    /*
+     * Copy session structure and link into list 
+     */
+    slp = (struct session_list *) calloc(1, sizeof(struct session_list));
+    if (slp == NULL) {
+        in_session->s_snmp_errno = SNMPERR_MALLOC;
+        return (NULL);
+    }
+
+    slp->transport = NULL;
+
+    isp = (struct snmp_internal_session *)calloc(1, sizeof(struct snmp_internal_session));
+
+    if (isp == NULL) {
+        snmp_sess_close(slp);
+        in_session->s_snmp_errno = SNMPERR_MALLOC;
+        return (NULL);
+    }
+
+    slp->internal = isp;
+    slp->session = (netsnmp_session *)malloc(sizeof(netsnmp_session));
+    if (slp->session == NULL) {
+        snmp_sess_close(slp);
+        in_session->s_snmp_errno = SNMPERR_MALLOC;
+        return (NULL);
+    }
+    memmove(slp->session, in_session, sizeof(netsnmp_session));
+    session = slp->session;
+
+    /*
+     * zero out pointers so if we have to free the session we wont free mem
+     * owned by in_session 
+     */
+    session->peername = NULL;
+    session->community = NULL;
+    session->contextEngineID = NULL;
+    session->contextName = NULL;
+    session->securityEngineID = NULL;
+    session->securityName = NULL;
+    session->securityAuthProto = NULL;
+    session->securityPrivProto = NULL;
+    /*
+     * session now points to the new structure that still contains pointers to
+     * data allocated elsewhere.  Some of this data is copied to space malloc'd
+     * here, and the pointer replaced with the new one.
+     */
+
+    if (in_session->peername != NULL) {
+        session->peername = (char *)malloc(strlen(in_session->peername) + 1);
+        if (session->peername == NULL) {
+            snmp_sess_close(slp);
+            in_session->s_snmp_errno = SNMPERR_MALLOC;
+            return (NULL);
+        }
+        strcpy(session->peername, in_session->peername);
+    }
+
+    /*
+     * Fill in defaults if necessary 
+     */
+    if (in_session->community_len != SNMP_DEFAULT_COMMUNITY_LEN) {
+        ucp = (u_char *) malloc(in_session->community_len);
+        if (ucp != NULL)
+            memmove(ucp, in_session->community, in_session->community_len);
+    } else {
+        if ((cp = netsnmp_ds_get_string(NETSNMP_DS_LIBRARY_ID, 
+					NETSNMP_DS_LIB_COMMUNITY)) != NULL) {
+            session->community_len = strlen(cp);
+            ucp = (u_char *) malloc(session->community_len);
+            if (ucp)
+                memmove(ucp, cp, session->community_len);
+        } else {
+#ifdef NO_ZEROLENGTH_COMMUNITY
+            session->community_len = strlen(DEFAULT_COMMUNITY);
+            ucp = (u_char *) malloc(session->community_len);
+            if (ucp)
+                memmove(ucp, DEFAULT_COMMUNITY, session->community_len);
+#else
+            ucp = (u_char *) strdup("");
+#endif
+        }
+    }
+
+    if (ucp == NULL) {
+        snmp_sess_close(slp);
+        in_session->s_snmp_errno = SNMPERR_MALLOC;
+        return (NULL);
+    }
+    session->community = ucp;   /* replace pointer with pointer to new data */
+
+    if (session->securityLevel <= 0) {
+        session->securityLevel =
+            netsnmp_ds_get_int(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_SECLEVEL);
+    }
+
+    if (session->securityLevel == 0)
+        session->securityLevel = SNMP_SEC_LEVEL_NOAUTH;
+
+    if (in_session->securityAuthProtoLen > 0) {
+        session->securityAuthProto =
+            snmp_duplicate_objid(in_session->securityAuthProto,
+                                 in_session->securityAuthProtoLen);
+        if (session->securityAuthProto == NULL) {
+            snmp_sess_close(slp);
+            in_session->s_snmp_errno = SNMPERR_MALLOC;
+            return (NULL);
+        }
+    } else if (get_default_authtype(&i) != NULL) {
+        session->securityAuthProto =
+            snmp_duplicate_objid(get_default_authtype(NULL), i);
+        session->securityAuthProtoLen = i;
+    }
+
+    if (in_session->securityPrivProtoLen > 0) {
+        session->securityPrivProto =
+            snmp_duplicate_objid(in_session->securityPrivProto,
+                                 in_session->securityPrivProtoLen);
+        if (session->securityPrivProto == NULL) {
+            snmp_sess_close(slp);
+            in_session->s_snmp_errno = SNMPERR_MALLOC;
+            return (NULL);
+        }
+    } else if (get_default_privtype(&i) != NULL) {
+        session->securityPrivProto =
+            snmp_duplicate_objid(get_default_privtype(NULL), i);
+        session->securityPrivProtoLen = i;
+    }
+
+    if (in_session->securityEngineIDLen > 0) {
+        ucp = (u_char *) malloc(in_session->securityEngineIDLen);
+        if (ucp == NULL) {
+            snmp_sess_close(slp);
+            in_session->s_snmp_errno = SNMPERR_MALLOC;
+            return (NULL);
+        }
+        memmove(ucp, in_session->securityEngineID,
+                in_session->securityEngineIDLen);
+        session->securityEngineID = ucp;
+
+    }
+
+    if (in_session->contextEngineIDLen > 0) {
+        ucp = (u_char *) malloc(in_session->contextEngineIDLen);
+        if (ucp == NULL) {
+            snmp_sess_close(slp);
+            in_session->s_snmp_errno = SNMPERR_MALLOC;
+            return (NULL);
+        }
+        memmove(ucp, in_session->contextEngineID,
+                in_session->contextEngineIDLen);
+        session->contextEngineID = ucp;
+    } else if (in_session->securityEngineIDLen > 0) {
+        /*
+         * default contextEngineID to securityEngineIDLen if defined 
+         */
+        ucp = (u_char *) malloc(in_session->securityEngineIDLen);
+        if (ucp == NULL) {
+            snmp_sess_close(slp);
+            in_session->s_snmp_errno = SNMPERR_MALLOC;
+            return (NULL);
+        }
+        memmove(ucp, in_session->securityEngineID,
+                in_session->securityEngineIDLen);
+        session->contextEngineID = ucp;
+        session->contextEngineIDLen = in_session->securityEngineIDLen;
+    }
+
+    if (in_session->contextName) {
+        session->contextName = strdup(in_session->contextName);
+        if (session->contextName == NULL) {
+            snmp_sess_close(slp);
+            return (NULL);
+        }
+    } else if ((cp = netsnmp_ds_get_string(NETSNMP_DS_LIBRARY_ID, 
+					   NETSNMP_DS_LIB_CONTEXT)) != NULL) {
+        cp = strdup(cp);
+        if (cp == NULL) {
+            snmp_sess_close(slp);
+            return (NULL);
+        }
+        session->contextName = cp;
+        session->contextNameLen = strlen(cp);
+    } else {
+        cp = strdup(SNMP_DEFAULT_CONTEXT);
+        session->contextName = cp;
+        session->contextNameLen = strlen(cp);
+    }
+
+    if (in_session->securityName) {
+        session->securityName = strdup(in_session->securityName);
+        if (session->securityName == NULL) {
+            snmp_sess_close(slp);
+            return (NULL);
+        }
+    } else if ((cp = netsnmp_ds_get_string(NETSNMP_DS_LIBRARY_ID, 
+					   NETSNMP_DS_LIB_SECNAME)) != NULL) {
+        cp = strdup(cp);
+        if (cp == NULL) {
+            snmp_sess_close(slp);
+            return (NULL);
+        }
+        session->securityName = cp;
+        session->securityNameLen = strlen(cp);
+    }
+
+    if ((in_session->securityAuthKeyLen <= 0) &&
+        ((cp = netsnmp_ds_get_string(NETSNMP_DS_LIBRARY_ID, 
+				     NETSNMP_DS_LIB_AUTHPASSPHRASE)) ||
+         (cp = netsnmp_ds_get_string(NETSNMP_DS_LIBRARY_ID, 
+				     NETSNMP_DS_LIB_PASSPHRASE)))) {
+        session->securityAuthKeyLen = USM_AUTH_KU_LEN;
+        if (generate_Ku(session->securityAuthProto,
+                        session->securityAuthProtoLen,
+                        (u_char *) cp, strlen(cp),
+                        session->securityAuthKey,
+                        &session->securityAuthKeyLen) != SNMPERR_SUCCESS) {
+            snmp_set_detail
+                ("Error generating a key (Ku) from the supplied authentication pass phrase.");
+            snmp_sess_close(slp);
+            return NULL;
+        }
+    }
+
+    if ((in_session->securityPrivKeyLen <= 0) &&
+        ((cp = netsnmp_ds_get_string(NETSNMP_DS_LIBRARY_ID, 
+				     NETSNMP_DS_LIB_PRIVPASSPHRASE)) ||
+         (cp = netsnmp_ds_get_string(NETSNMP_DS_LIBRARY_ID, 
+				     NETSNMP_DS_LIB_PASSPHRASE)))) {
+        session->securityPrivKeyLen = USM_PRIV_KU_LEN;
+        if (generate_Ku(session->securityAuthProto,
+                        session->securityAuthProtoLen,
+                        (u_char *) cp, strlen(cp),
+                        session->securityPrivKey,
+                        &session->securityPrivKeyLen) != SNMPERR_SUCCESS) {
+            snmp_set_detail
+                ("Error generating a key (Ku) from the supplied privacy pass phrase.");
+            snmp_sess_close(slp);
+            return NULL;
+        }
+    }
+
+    if (session->retries == SNMP_DEFAULT_RETRIES)
+        session->retries = DEFAULT_RETRIES;
+    if (session->timeout == SNMP_DEFAULT_TIMEOUT)
+        session->timeout = DEFAULT_TIMEOUT;
+    session->sessid = snmp_get_next_sessid();
+
+    snmp_call_callbacks(SNMP_CALLBACK_LIBRARY, SNMP_CALLBACK_SESSION_INIT,
+                        session);
+
+    if ((sptr = find_sec_mod(session->securityModel)) != NULL &&
+        sptr->session_open != NULL) {
+        /*
+         * security module specific inialization 
+         */
+        (*sptr->session_open) (session);
+    }
+
+    return (slp);
+}
+
+static struct session_list *
+snmp_sess_copy(netsnmp_session * pss)
+{
+    struct session_list *psl;
+    psl = _sess_copy(pss);
+    if (!psl) {
+        if (!pss->s_snmp_errno) {
+            pss->s_snmp_errno = SNMPERR_GENERR;
+        }
+        SET_SNMP_ERROR(pss->s_snmp_errno);
+    }
+    return psl;
+}
+
+
+
+int
+snmpv3_engineID_probe(struct session_list *slp,
+                      netsnmp_session * in_session)
+{
+    netsnmp_pdu    *pdu = NULL, *response = NULL;
+    netsnmp_session *session;
+    unsigned int    i;
+    int             status;
+
+    if (slp == NULL || slp->session == NULL) {
+        return 0;
+    }
+
+    session = slp->session;
+
+    /*
+     * If we are opening a V3 session and we don't know engineID we must probe
+     * it -- this must be done after the session is created and inserted in the
+     * list so that the response can handled correctly. 
+     */
+
+    if ((session->flags & SNMP_FLAGS_DONT_PROBE) == SNMP_FLAGS_DONT_PROBE)
+        return 1;
+
+    if (session->version == SNMP_VERSION_3) {
+        if (session->securityEngineIDLen == 0) {
+            if (snmpv3_build_probe_pdu(&pdu) != 0) {
+                DEBUGMSGTL(("snmp_api", "unable to create probe PDU\n"));
+                return 0;
+            }
+            DEBUGMSGTL(("snmp_api", "probing for engineID...\n"));
+            status = snmp_sess_synch_response(slp, pdu, &response);
+
+            if ((response == NULL) && (status == STAT_SUCCESS)) {
+                status = STAT_ERROR;
+            }
+
+            switch (status) {
+            case STAT_SUCCESS:
+                in_session->s_snmp_errno = SNMPERR_INVALID_MSG; /* XX?? */
+                DEBUGMSGTL(("snmp_sess_open",
+                            "error: expected Report as response to probe: %s (%d)\n",
+                            snmp_errstring(response->errstat),
+                            response->errstat));
+                break;
+            case STAT_ERROR:   /* this is what we expected -> Report == STAT_ERROR */
+                in_session->s_snmp_errno = SNMPERR_UNKNOWN_ENG_ID;
+                break;
+            case STAT_TIMEOUT:
+                in_session->s_snmp_errno = SNMPERR_TIMEOUT;
+            default:
+                DEBUGMSGTL(("snmp_sess_open",
+                            "unable to connect with remote engine: %s (%d)\n",
+                            snmp_api_errstring(session->s_snmp_errno),
+                            session->s_snmp_errno));
+                break;
+            }
+
+            if (slp->session->securityEngineIDLen == 0) {
+                DEBUGMSGTL(("snmp_api",
+                            "unable to determine remote engine ID\n"));
+                return 0;
+            }
+
+            in_session->s_snmp_errno = SNMPERR_SUCCESS;
+            if (snmp_get_do_debugging()) {
+                DEBUGMSGTL(("snmp_sess_open",
+                            "  probe found engineID:  "));
+                for (i = 0; i < slp->session->securityEngineIDLen; i++)
+                    DEBUGMSG(("snmp_sess_open", "%02x",
+                              slp->session->securityEngineID[i]));
+                DEBUGMSG(("snmp_sess_open", "\n"));
+            }
+        }
+
+        /*
+         * if boot/time supplied set it for this engineID 
+         */
+        if (session->engineBoots || session->engineTime) {
+            set_enginetime(session->securityEngineID,
+                           session->securityEngineIDLen,
+                           session->engineBoots, session->engineTime,
+                           TRUE);
+        }
+
+        if (create_user_from_session(slp->session) != SNMPERR_SUCCESS) {
+            in_session->s_snmp_errno = SNMPERR_UNKNOWN_USER_NAME;       /* XX?? */
+            DEBUGMSGTL(("snmp_api",
+                        "snmp_sess_open(): failed(2) to create a new user from session\n"));
+            return 0;
+        }
+    }
+
+    return 1;
+}
+
+
+
+/*******************************************************************-o-******
+ * snmp_sess_open
+ *
+ * Parameters:
+ *	*in_session
+ *
+ * Returns:
+ *      Pointer to a session in the session list   -OR-		FIX -- right?
+ *	NULL on failure.
+ *
+ * The "spin-free" version of snmp_open.
+ */
+static void    *
+_sess_open(netsnmp_session * in_session)
+{
+    struct session_list *slp;
+    netsnmp_session *session;
+
+    in_session->s_snmp_errno = 0;
+    in_session->s_errno = 0;
+
+    _init_snmp();
+
+    if ((slp = snmp_sess_copy(in_session)) == NULL) {
+        return (NULL);
+    }
+    session = slp->session;
+    slp->transport = NULL;
+
+    if (session->flags & SNMP_FLAGS_STREAM_SOCKET) {
+        slp->transport = netsnmp_tdomain_transport(session->peername,
+                                                   session->local_port,
+                                                   "tcp");
+    } else {
+        slp->transport = netsnmp_tdomain_transport(session->peername,
+                                                   session->local_port,
+                                                   "udp");
+    }
+
+    if (slp->transport == NULL) {
+        DEBUGMSGTL(("_sess_open", "couldn't interpret peername\n"));
+        in_session->s_snmp_errno = SNMPERR_BAD_ADDRESS;
+        in_session->s_errno = errno;
+        snmp_set_detail(session->peername);
+        snmp_sess_close(slp);
+        return NULL;
+    }
+
+    session->rcvMsgMaxSize = slp->transport->msgMaxSize;
+
+    if (!snmpv3_engineID_probe(slp, in_session)) {
+        snmp_sess_close(slp);
+        return 0;
+    }
+
+    return (void *) slp;
+}                               /* end snmp_sess_open() */
+
+
+
+/*
+ * EXPERIMENTAL API EXTENSIONS ------------------------------------------ 
+ * 
+ * snmp_sess_add_ex, snmp_sess_add, snmp_add 
+ * 
+ * Analogous to snmp_open family of functions, but taking a netsnmp_transport
+ * pointer as an extra argument.  Unlike snmp_open et al. it doesn't attempt
+ * to interpret the in_session->peername as a transport endpoint specifier,
+ * but instead uses the supplied transport.  JBPN
+ * 
+ */
+
+netsnmp_session *
+snmp_add(netsnmp_session * in_session,
+         netsnmp_transport *transport,
+         int (*fpre_parse) (netsnmp_session *, netsnmp_transport *, void *,
+                            int), int (*fpost_parse) (netsnmp_session *,
+                                                      netsnmp_pdu *, int))
+{
+    struct session_list *slp;
+    slp = (struct session_list *) snmp_sess_add_ex(in_session, transport,
+                                                   fpre_parse, NULL,
+                                                   fpost_parse, NULL, NULL,
+                                                   NULL, NULL);
+    if (slp == NULL) {
+        return NULL;
+    }
+
+    snmp_res_lock(MT_LIBRARY_ID, MT_LIB_SESSION);
+    slp->next = Sessions;
+    Sessions = slp;
+    snmp_res_unlock(MT_LIBRARY_ID, MT_LIB_SESSION);
+
+    return (slp->session);
+}
+
+netsnmp_session *
+snmp_add_full(netsnmp_session * in_session,
+              netsnmp_transport *transport,
+              int (*fpre_parse) (netsnmp_session *, netsnmp_transport *,
+                                 void *, int),
+              int (*fparse) (netsnmp_session *, netsnmp_pdu *, u_char *,
+                             size_t),
+              int (*fpost_parse) (netsnmp_session *, netsnmp_pdu *, int),
+              int (*fbuild) (netsnmp_session *, netsnmp_pdu *, u_char *,
+                             size_t *), int (*frbuild) (netsnmp_session *,
+                                                        netsnmp_pdu *,
+                                                        u_char **,
+                                                        size_t *,
+                                                        size_t *),
+              int (*fcheck) (u_char *, size_t),
+              netsnmp_pdu *(*fcreate_pdu) (netsnmp_transport *, void *,
+                                           size_t))
+{
+    struct session_list *slp;
+    slp = (struct session_list *) snmp_sess_add_ex(in_session, transport,
+                                                   fpre_parse, fparse,
+                                                   fpost_parse, fbuild,
+                                                   frbuild, fcheck,
+                                                   fcreate_pdu);
+    if (slp == NULL) {
+        return NULL;
+    }
+
+    snmp_res_lock(MT_LIBRARY_ID, MT_LIB_SESSION);
+    slp->next = Sessions;
+    Sessions = slp;
+    snmp_res_unlock(MT_LIBRARY_ID, MT_LIB_SESSION);
+
+    return (slp->session);
+}
+
+
+
+void           *
+snmp_sess_add_ex(netsnmp_session * in_session,
+                 netsnmp_transport *transport,
+                 int (*fpre_parse) (netsnmp_session *, netsnmp_transport *,
+                                    void *, int),
+                 int (*fparse) (netsnmp_session *, netsnmp_pdu *, u_char *,
+                                size_t),
+                 int (*fpost_parse) (netsnmp_session *, netsnmp_pdu *,
+                                     int),
+                 int (*fbuild) (netsnmp_session *, netsnmp_pdu *, u_char *,
+                                size_t *),
+                 int (*frbuild) (netsnmp_session *, netsnmp_pdu *,
+                                 u_char **, size_t *, size_t *),
+                 int (*fcheck) (u_char *, size_t),
+                 netsnmp_pdu *(*fcreate_pdu) (netsnmp_transport *, void *,
+                                              size_t))
+{
+    struct session_list *slp;
+
+    _init_snmp();
+
+    if (in_session == NULL || transport == NULL) {
+        return NULL;
+    }
+
+    DEBUGMSGTL(("snmp_sess_add", "fd %d\n", transport->sock));
+
+    if ((slp = snmp_sess_copy(in_session)) == NULL) {
+        return (NULL);
+    }
+
+    slp->transport = transport;
+    slp->internal->hook_pre = fpre_parse;
+    slp->internal->hook_parse = fparse;
+    slp->internal->hook_post = fpost_parse;
+    slp->internal->hook_build = fbuild;
+    slp->internal->hook_realloc_build = frbuild;
+    slp->internal->check_packet = fcheck;
+    slp->internal->hook_create_pdu = fcreate_pdu;
+
+    slp->session->rcvMsgMaxSize = transport->msgMaxSize;
+
+    if (slp->session->version == SNMP_VERSION_3) {
+        DEBUGMSGTL(("snmp_sess_add",
+                    "adding v3 session -- engineID probe now\n"));
+        if (!snmpv3_engineID_probe(slp, in_session)) {
+            DEBUGMSGTL(("snmp_sess_add", "engine ID probe failed\n"));
+            snmp_sess_close(slp);
+            slp = NULL;
+        }
+    }
+
+    return (void *) slp;
+}                               /*  end snmp_sess_add_ex()  */
+
+
+
+void           *
+snmp_sess_add(netsnmp_session * in_session,
+              netsnmp_transport *transport,
+              int (*fpre_parse) (netsnmp_session *, netsnmp_transport *,
+                                 void *, int),
+              int (*fpost_parse) (netsnmp_session *, netsnmp_pdu *, int))
+{
+    return snmp_sess_add_ex(in_session, transport, fpre_parse, NULL,
+                            fpost_parse, NULL, NULL, NULL, NULL);
+}
+
+
+
+void           *
+snmp_sess_open(netsnmp_session * pss)
+{
+    void           *pvoid;
+    pvoid = _sess_open(pss);
+    if (!pvoid) {
+        SET_SNMP_ERROR(pss->s_snmp_errno);
+    }
+    return pvoid;
+}
+
+
+
+/*
+ * create_user_from_session(netsnmp_session *session):
+ * 
+ * creates a user in the usm table from the information in a session.
+ * If the user already exists, it is updated with the current
+ * information from the session
+ * 
+ * Parameters:
+ * session -- IN: pointer to the session to use when creating the user.
+ * 
+ * Returns:
+ * SNMPERR_SUCCESS
+ * SNMPERR_GENERR 
+ */
+int
+create_user_from_session(netsnmp_session * session)
+{
+    struct usmUser *user;
+    int             user_just_created = 0;
+
+    /*
+     * now that we have the engineID, create an entry in the USM list
+     * for this user using the information in the session 
+     */
+    user = usm_get_user_from_list(session->securityEngineID,
+                                  session->securityEngineIDLen,
+                                  session->securityName,
+                                  usm_get_userList(), 0);
+    if (user == NULL) {
+        DEBUGMSGTL(("snmp_api", "Building user %s...\n",
+                    session->securityName));
+        /*
+         * user doesn't exist so we create and add it 
+         */
+        user = (struct usmUser *) calloc(1, sizeof(struct usmUser));
+        if (user == NULL)
+            return SNMPERR_GENERR;
+
+        /*
+         * copy in the securityName 
+         */
+        if (session->securityName) {
+            user->name = strdup(session->securityName);
+            user->secName = strdup(session->securityName);
+            if (user->name == NULL || user->secName == NULL) {
+                usm_free_user(user);
+                return SNMPERR_GENERR;
+            }
+        }
+
+        /*
+         * copy in the engineID 
+         */
+        if (memdup(&user->engineID, session->securityEngineID,
+                   session->securityEngineIDLen) != SNMPERR_SUCCESS) {
+            usm_free_user(user);
+            return SNMPERR_GENERR;
+        }
+        user->engineIDLen = session->securityEngineIDLen;
+
+        user_just_created = 1;
+    }
+    /*
+     * copy the auth protocol 
+     */
+    if (session->securityAuthProto != NULL) {
+        SNMP_FREE(user->authProtocol);
+        user->authProtocol =
+            snmp_duplicate_objid(session->securityAuthProto,
+                                 session->securityAuthProtoLen);
+        if (user->authProtocol == NULL) {
+            usm_free_user(user);
+            return SNMPERR_GENERR;
+        }
+        user->authProtocolLen = session->securityAuthProtoLen;
+    }
+
+    /*
+     * copy the priv protocol 
+     */
+    if (session->securityPrivProto != NULL) {
+        SNMP_FREE(user->privProtocol);
+        user->privProtocol =
+            snmp_duplicate_objid(session->securityPrivProto,
+                                 session->securityPrivProtoLen);
+        if (user->privProtocol == NULL) {
+            usm_free_user(user);
+            return SNMPERR_GENERR;
+        }
+        user->privProtocolLen = session->securityPrivProtoLen;
+    }
+
+    /*
+     * copy in the authentication Key, and convert to the localized version 
+     */
+    if (session->securityAuthKey != NULL
+        && session->securityAuthKeyLen != 0) {
+        SNMP_FREE(user->authKey);
+        user->authKey = (u_char *) calloc(1, USM_LENGTH_KU_HASHBLOCK);
+        if (user->authKey == NULL) {
+            usm_free_user(user);
+            return SNMPERR_GENERR;
+        }
+        user->authKeyLen = USM_LENGTH_KU_HASHBLOCK;
+        if (generate_kul(user->authProtocol, user->authProtocolLen,
+                         session->securityEngineID,
+                         session->securityEngineIDLen,
+                         session->securityAuthKey,
+                         session->securityAuthKeyLen, user->authKey,
+                         &user->authKeyLen) != SNMPERR_SUCCESS) {
+            usm_free_user(user);
+            return SNMPERR_GENERR;
+        }
+    }
+
+    /*
+     * copy in the privacy Key, and convert to the localized version 
+     */
+    if (session->securityPrivKey != NULL
+        && session->securityPrivKeyLen != 0) {
+        SNMP_FREE(user->privKey);
+        user->privKey = (u_char *) calloc(1, USM_LENGTH_KU_HASHBLOCK);
+        if (user->privKey == NULL) {
+            usm_free_user(user);
+            return SNMPERR_GENERR;
+        }
+        user->privKeyLen = USM_LENGTH_KU_HASHBLOCK;
+        if (generate_kul(user->authProtocol, user->authProtocolLen,
+                         session->securityEngineID,
+                         session->securityEngineIDLen,
+                         session->securityPrivKey,
+                         session->securityPrivKeyLen, user->privKey,
+                         &user->privKeyLen) != SNMPERR_SUCCESS) {
+            usm_free_user(user);
+            return SNMPERR_GENERR;
+        }
+    }
+
+    user->userStatus = RS_ACTIVE;
+    user->userStorageType = ST_READONLY;
+
+    if (user_just_created) {
+        /*
+         * add the user into the database 
+         */
+        usm_add_user(user);
+    }
+
+    return SNMPERR_SUCCESS;
+
+
+}                               /* end create_user_from_session() */
+
+/*
+ *  Do a "deep free()" of a netsnmp_session.
+ *
+ *  CAUTION:  SHOULD ONLY BE USED FROM snmp_sess_close() OR SIMILAR.
+ *                                                      (hence it is static)
+ */
+
+static void
+snmp_free_session(netsnmp_session * s)
+{
+    if (s) {
+        SNMP_FREE(s->peername);
+        SNMP_FREE(s->community);
+        SNMP_FREE(s->contextEngineID);
+        SNMP_FREE(s->contextName);
+        SNMP_FREE(s->securityEngineID);
+        SNMP_FREE(s->securityName);
+        SNMP_FREE(s->securityAuthProto);
+        SNMP_FREE(s->securityPrivProto);
+        free((char *) s);
+    }
+}
+
+/*
+ * Close the input session.  Frees all data allocated for the session,
+ * dequeues any pending requests, and closes any sockets allocated for
+ * the session.  Returns 0 on error, 1 otherwise.
+ */
+int
+snmp_sess_close(void *sessp)
+{
+    struct session_list *slp = (struct session_list *) sessp;
+    netsnmp_transport *transport;
+    struct snmp_internal_session *isp;
+    netsnmp_session *sesp = NULL;
+    struct snmp_secmod_def *sptr;
+
+    if (slp == NULL) {
+        return 0;
+    }
+
+    if ((sptr = find_sec_mod(slp->session->securityModel)) != NULL &&
+        sptr->session_close != NULL) {
+        (*sptr->session_close) (slp->session);
+    }
+
+    isp = slp->internal;
+    slp->internal = 0;
+
+    if (isp) {
+        netsnmp_request_list *rp, *orp;
+
+        SNMP_FREE(isp->packet);
+
+        /*
+         * Free each element in the input request list.  
+         */
+        rp = isp->requests;
+        while (rp) {
+            orp = rp;
+            rp = rp->next_request;
+            snmp_free_pdu(orp->pdu);
+            free((char *) orp);
+        }
+
+        free((char *) isp);
+    }
+
+    transport = slp->transport;
+    slp->transport = 0;
+
+    if (transport) {
+        transport->f_close(transport);
+        netsnmp_transport_free(transport);
+    }
+
+    sesp = slp->session;
+    slp->session = 0;
+
+    /*
+     * The following is necessary to avoid memory leakage when closing AgentX 
+     * sessions that may have multiple subsessions.  These hang off the main
+     * session at ->subsession, and chain through ->next.  
+     */
+
+    if (sesp != NULL && sesp->subsession != NULL) {
+        netsnmp_session *subsession = sesp->subsession, *tmpsub;
+
+        while (subsession != NULL) {
+            DEBUGMSGTL(("snmp_sess_close",
+                        "closing session %p, subsession %p\n", sesp,
+                        subsession));
+            tmpsub = subsession->next;
+            snmp_free_session(subsession);
+            subsession = tmpsub;
+        }
+    }
+
+    snmp_free_session(sesp);
+    free((char *) slp);
+    return 1;
+}
+
+int
+snmp_close(netsnmp_session * session)
+{
+    struct session_list *slp = NULL, *oslp = NULL;
+
+    {                           /*MTCRITICAL_RESOURCE */
+        snmp_res_lock(MT_LIBRARY_ID, MT_LIB_SESSION);
+        if (Sessions && Sessions->session == session) { /* If first entry */
+            slp = Sessions;
+            Sessions = slp->next;
+        } else {
+            for (slp = Sessions; slp; slp = slp->next) {
+                if (slp->session == session) {
+                    if (oslp)   /* if we found entry that points here */
+                        oslp->next = slp->next; /* link around this entry */
+                    break;
+                }
+                oslp = slp;
+            }
+        }
+        snmp_res_unlock(MT_LIBRARY_ID, MT_LIB_SESSION);
+    }                           /*END MTCRITICAL_RESOURCE */
+    if (slp == NULL) {
+        return 0;
+    }
+    return snmp_sess_close((void *) slp);
+}
+
+int
+snmp_close_sessions(void)
+{
+    struct session_list *slp;
+
+    snmp_res_lock(MT_LIBRARY_ID, MT_LIB_SESSION);
+    while (Sessions) {
+        slp = Sessions;
+        Sessions = Sessions->next;
+        snmp_sess_close((void *) slp);
+    }
+    snmp_res_unlock(MT_LIBRARY_ID, MT_LIB_SESSION);
+    return 1;
+}
+
+static int
+snmpv3_build_probe_pdu(netsnmp_pdu **pdu)
+{
+    struct usmUser *user;
+
+    /*
+     * create the pdu 
+     */
+    if (!pdu)
+        return -1;
+    *pdu = snmp_pdu_create(SNMP_MSG_GET);
+    if (!(*pdu))
+        return -1;
+    (*pdu)->version = SNMP_VERSION_3;
+    (*pdu)->securityName = strdup("");
+    (*pdu)->securityNameLen = strlen((*pdu)->securityName);
+    (*pdu)->securityLevel = SNMP_SEC_LEVEL_NOAUTH;
+    (*pdu)->securityModel = SNMP_SEC_MODEL_USM;
+
+    /*
+     * create the empty user 
+     */
+    user = usm_get_user(NULL, 0, (*pdu)->securityName);
+    if (user == NULL) {
+        user = (struct usmUser *) calloc(1, sizeof(struct usmUser));
+        if (user == NULL) {
+            snmp_free_pdu(*pdu);
+            *pdu = (netsnmp_pdu *) NULL;
+            return -1;
+        }
+        user->name = strdup((*pdu)->securityName);
+        user->secName = strdup((*pdu)->securityName);
+        user->authProtocolLen = sizeof(usmNoAuthProtocol) / sizeof(oid);
+        user->authProtocol =
+            snmp_duplicate_objid(usmNoAuthProtocol, user->authProtocolLen);
+        user->privProtocolLen = sizeof(usmNoPrivProtocol) / sizeof(oid);
+        user->privProtocol =
+            snmp_duplicate_objid(usmNoPrivProtocol, user->privProtocolLen);
+        usm_add_user(user);
+    }
+    return 0;
+}
+
+static void
+snmpv3_calc_msg_flags(int sec_level, int msg_command, u_char * flags)
+{
+    *flags = 0;
+    if (sec_level == SNMP_SEC_LEVEL_AUTHNOPRIV)
+        *flags = SNMP_MSG_FLAG_AUTH_BIT;
+    else if (sec_level == SNMP_SEC_LEVEL_AUTHPRIV)
+        *flags = SNMP_MSG_FLAG_AUTH_BIT | SNMP_MSG_FLAG_PRIV_BIT;
+
+    if (SNMP_CMD_CONFIRMED(msg_command))
+        *flags |= SNMP_MSG_FLAG_RPRT_BIT;
+
+    return;
+}
+
+static int
+snmpv3_verify_msg(netsnmp_request_list *rp, netsnmp_pdu *pdu)
+{
+    netsnmp_pdu    *rpdu;
+
+    if (!rp || !rp->pdu || !pdu)
+        return 0;
+    /*
+     * Reports don't have to match anything according to the spec 
+     */
+    if (pdu->command == SNMP_MSG_REPORT)
+        return 1;
+    rpdu = rp->pdu;
+    if (rp->request_id != pdu->reqid || rpdu->reqid != pdu->reqid)
+        return 0;
+    if (rpdu->version != pdu->version)
+        return 0;
+    if (rpdu->securityModel != pdu->securityModel)
+        return 0;
+    if (rpdu->securityLevel != pdu->securityLevel)
+        return 0;
+
+    if (rpdu->contextEngineIDLen != pdu->contextEngineIDLen ||
+        memcmp(rpdu->contextEngineID, pdu->contextEngineID,
+               pdu->contextEngineIDLen))
+        return 0;
+    if (rpdu->contextNameLen != pdu->contextNameLen ||
+        memcmp(rpdu->contextName, pdu->contextName, pdu->contextNameLen))
+        return 0;
+    if (rpdu->securityEngineIDLen != pdu->securityEngineIDLen ||
+        memcmp(rpdu->securityEngineID, pdu->securityEngineID,
+               pdu->securityEngineIDLen))
+        return 0;
+    if (rpdu->securityNameLen != pdu->securityNameLen ||
+        memcmp(rpdu->securityName, pdu->securityName,
+               pdu->securityNameLen))
+        return 0;
+    return 1;
+}
+
+
+/*
+ * SNMPv3
+ * * Takes a session and a pdu and serializes the ASN PDU into the area
+ * * pointed to by packet.  out_length is the size of the data area available.
+ * * Returns the length of the completed packet in out_length.  If any errors
+ * * occur, -1 is returned.  If all goes well, 0 is returned.
+ */
+static int
+snmpv3_build(u_char ** pkt, size_t * pkt_len, size_t * offset,
+             netsnmp_session * session, netsnmp_pdu *pdu)
+{
+    int             ret;
+
+    session->s_snmp_errno = 0;
+    session->s_errno = 0;
+
+    /*
+     * do validation for PDU types 
+     */
+    switch (pdu->command) {
+    case SNMP_MSG_RESPONSE:
+    case SNMP_MSG_TRAP2:
+    case SNMP_MSG_REPORT:
+        pdu->flags &= (~UCD_MSG_FLAG_EXPECT_RESPONSE);
+        /*
+         * Fallthrough 
+         */
+    case SNMP_MSG_GET:
+    case SNMP_MSG_GETNEXT:
+    case SNMP_MSG_SET:
+    case SNMP_MSG_INFORM:
+        if (pdu->errstat == SNMP_DEFAULT_ERRSTAT)
+            pdu->errstat = 0;
+        if (pdu->errindex == SNMP_DEFAULT_ERRINDEX)
+            pdu->errindex = 0;
+        break;
+
+    case SNMP_MSG_GETBULK:
+        if (pdu->max_repetitions < 0) {
+            session->s_snmp_errno = SNMPERR_BAD_REPETITIONS;
+            return -1;
+        }
+        if (pdu->non_repeaters < 0) {
+            session->s_snmp_errno = SNMPERR_BAD_REPEATERS;
+            return -1;
+        }
+        break;
+
+    case SNMP_MSG_TRAP:
+        session->s_snmp_errno = SNMPERR_V1_IN_V2;
+        return -1;
+
+    default:
+        session->s_snmp_errno = SNMPERR_UNKNOWN_PDU;
+        return -1;
+    }
+
+    if (pdu->securityEngineIDLen == 0) {
+        if (session->securityEngineIDLen) {
+            snmpv3_clone_engineID(&pdu->securityEngineID,
+                                  &pdu->securityEngineIDLen,
+                                  session->securityEngineID,
+                                  session->securityEngineIDLen);
+        }
+    }
+
+    if (pdu->contextEngineIDLen == 0) {
+        if (session->contextEngineIDLen) {
+            snmpv3_clone_engineID(&pdu->contextEngineID,
+                                  &pdu->contextEngineIDLen,
+                                  session->contextEngineID,
+                                  session->contextEngineIDLen);
+        } else if (pdu->securityEngineIDLen) {
+            snmpv3_clone_engineID(&pdu->contextEngineID,
+                                  &pdu->contextEngineIDLen,
+                                  pdu->securityEngineID,
+                                  pdu->securityEngineIDLen);
+        }
+    }
+
+    if (pdu->contextName == NULL) {
+        if (!session->contextName) {
+            session->s_snmp_errno = SNMPERR_BAD_CONTEXT;
+            return -1;
+        }
+        pdu->contextName = strdup(session->contextName);
+        if (pdu->contextName == NULL) {
+            session->s_snmp_errno = SNMPERR_GENERR;
+            return -1;
+        }
+        pdu->contextNameLen = session->contextNameLen;
+    }
+    if (pdu->securityModel == SNMP_DEFAULT_SECMODEL) {
+        pdu->securityModel = session->securityModel;
+        if (pdu->securityModel == SNMP_DEFAULT_SECMODEL) {
+            pdu->securityModel = SNMP_SEC_MODEL_USM;
+        }
+    }
+    if (pdu->securityNameLen == 0 && pdu->securityName == 0) {
+        if (session->securityNameLen == 0) {
+            session->s_snmp_errno = SNMPERR_BAD_SEC_NAME;
+            return -1;
+        }
+        pdu->securityName = strdup(session->securityName);
+        if (pdu->securityName == NULL) {
+            session->s_snmp_errno = SNMPERR_GENERR;
+            return -1;
+        }
+        pdu->securityNameLen = session->securityNameLen;
+    }
+    if (pdu->securityLevel == 0) {
+        if (session->securityLevel == 0) {
+            session->s_snmp_errno = SNMPERR_BAD_SEC_LEVEL;
+            return -1;
+        }
+        pdu->securityLevel = session->securityLevel;
+    }
+    DEBUGMSGTL(("snmp_build",
+                "Building SNMPv3 message (secName:\"%s\", secLevel:%s)...\n",
+                ((session->securityName) ? (char *) session->securityName :
+                 ((pdu->securityName) ? (char *) pdu->securityName :
+                  "ERROR: undefined")), secLevelName[pdu->securityLevel]));
+
+    DEBUGDUMPSECTION("send", "SNMPv3 Message");
+#ifdef USE_REVERSE_ASNENCODING
+    if (netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_REVERSE_ENCODE)) {
+        ret = snmpv3_packet_realloc_rbuild(pkt, pkt_len, offset,
+                                           session, pdu, NULL, 0);
+    } else {
+#endif
+        ret = snmpv3_packet_build(session, pdu, *pkt, pkt_len, NULL, 0);
+#ifdef USE_REVERSE_ASNENCODING
+    }
+#endif
+    DEBUGINDENTLESS();
+    if (-1 != ret) {
+        session->s_snmp_errno = ret;
+    }
+
+    return ret;
+
+}                               /* end snmpv3_build() */
+
+
+
+
+static u_char  *
+snmpv3_header_build(netsnmp_session * session, netsnmp_pdu *pdu,
+                    u_char * packet, size_t * out_length,
+                    size_t length, u_char ** msg_hdr_e)
+{
+    u_char         *global_hdr, *global_hdr_e;
+    u_char         *cp;
+    u_char          msg_flags;
+    long            max_size;
+    long            sec_model;
+    u_char         *pb, *pb0e;
+
+    /*
+     * Save current location and build SEQUENCE tag and length placeholder
+     * * for SNMP message sequence (actual length inserted later)
+     */
+    cp = asn_build_sequence(packet, out_length,
+                            (u_char) (ASN_SEQUENCE | ASN_CONSTRUCTOR),
+                            length);
+    if (cp == NULL)
+        return NULL;
+    if (msg_hdr_e != NULL)
+        *msg_hdr_e = cp;
+    pb0e = cp;
+
+
+    /*
+     * store the version field - msgVersion
+     */
+    DEBUGDUMPHEADER("send", "SNMP Version Number");
+    cp = asn_build_int(cp, out_length,
+                       (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE |
+                                 ASN_INTEGER), (long *) &pdu->version,
+                       sizeof(pdu->version));
+    DEBUGINDENTLESS();
+    if (cp == NULL)
+        return NULL;
+
+    global_hdr = cp;
+    /*
+     * msgGlobalData HeaderData 
+     */
+    DEBUGDUMPSECTION("send", "msgGlobalData");
+    cp = asn_build_sequence(cp, out_length,
+                            (u_char) (ASN_SEQUENCE | ASN_CONSTRUCTOR), 0);
+    if (cp == NULL)
+        return NULL;
+    global_hdr_e = cp;
+
+
+    /*
+     * msgID 
+     */
+    DEBUGDUMPHEADER("send", "msgID");
+    cp = asn_build_int(cp, out_length,
+                       (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE |
+                                 ASN_INTEGER), &pdu->msgid,
+                       sizeof(pdu->msgid));
+    DEBUGINDENTLESS();
+    if (cp == NULL)
+        return NULL;
+
+    /*
+     * msgMaxSize 
+     */
+    max_size = session->rcvMsgMaxSize;
+    DEBUGDUMPHEADER("send", "msgMaxSize");
+    cp = asn_build_int(cp, out_length,
+                       (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE |
+                                 ASN_INTEGER), &max_size,
+                       sizeof(max_size));
+    DEBUGINDENTLESS();
+    if (cp == NULL)
+        return NULL;
+
+    /*
+     * msgFlags 
+     */
+    snmpv3_calc_msg_flags(pdu->securityLevel, pdu->command, &msg_flags);
+    DEBUGDUMPHEADER("send", "msgFlags");
+    cp = asn_build_string(cp, out_length,
+                          (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE |
+                                    ASN_OCTET_STR), &msg_flags,
+                          sizeof(msg_flags));
+    DEBUGINDENTLESS();
+    if (cp == NULL)
+        return NULL;
+
+    /*
+     * msgSecurityModel 
+     */
+    sec_model = pdu->securityModel;
+    DEBUGDUMPHEADER("send", "msgSecurityModel");
+    cp = asn_build_int(cp, out_length,
+                       (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE |
+                                 ASN_INTEGER), &sec_model,
+                       sizeof(sec_model));
+    DEBUGINDENTADD(-4);         /* return from global data indent */
+    if (cp == NULL)
+        return NULL;
+
+
+    /*
+     * insert actual length of globalData
+     */
+    pb = asn_build_sequence(global_hdr, out_length,
+                            (u_char) (ASN_SEQUENCE | ASN_CONSTRUCTOR),
+                            cp - global_hdr_e);
+    if (pb == NULL)
+        return NULL;
+
+
+    /*
+     * insert the actual length of the entire packet
+     */
+    pb = asn_build_sequence(packet, out_length,
+                            (u_char) (ASN_SEQUENCE | ASN_CONSTRUCTOR),
+                            length + (cp - pb0e));
+    if (pb == NULL)
+        return NULL;
+
+    return cp;
+
+}                               /* end snmpv3_header_build() */
+
+#ifdef USE_REVERSE_ASNENCODING
+
+static int
+snmpv3_header_realloc_rbuild(u_char ** pkt, size_t * pkt_len,
+                             size_t * offset, netsnmp_session * session,
+                             netsnmp_pdu *pdu)
+{
+    size_t          start_offset = *offset;
+    u_char          msg_flags;
+    long            max_size, sec_model;
+    int             rc = 0;
+
+    /*
+     * msgSecurityModel.  
+     */
+    sec_model = pdu->securityModel;
+    DEBUGDUMPHEADER("send", "msgSecurityModel");
+    rc = asn_realloc_rbuild_int(pkt, pkt_len, offset, 1,
+                                (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE |
+                                          ASN_INTEGER), &sec_model,
+                                sizeof(sec_model));
+    DEBUGINDENTLESS();
+    if (rc == 0) {
+        return 0;
+    }
+
+    /*
+     * msgFlags.  
+     */
+    snmpv3_calc_msg_flags(pdu->securityLevel, pdu->command, &msg_flags);
+    DEBUGDUMPHEADER("send", "msgFlags");
+    rc = asn_realloc_rbuild_string(pkt, pkt_len, offset, 1,
+                                   (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE
+                                             | ASN_OCTET_STR), &msg_flags,
+                                   sizeof(msg_flags));
+    DEBUGINDENTLESS();
+    if (rc == 0) {
+        return 0;
+    }
+
+    /*
+     * msgMaxSize.  
+     */
+    max_size = session->rcvMsgMaxSize;
+    DEBUGDUMPHEADER("send", "msgMaxSize");
+    rc = asn_realloc_rbuild_int(pkt, pkt_len, offset, 1,
+                                (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE |
+                                          ASN_INTEGER), &max_size,
+                                sizeof(max_size));
+    DEBUGINDENTLESS();
+    if (rc == 0) {
+        return 0;
+    }
+
+    /*
+     * msgID.  
+     */
+    DEBUGDUMPHEADER("send", "msgID");
+    rc = asn_realloc_rbuild_int(pkt, pkt_len, offset, 1,
+                                (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE |
+                                          ASN_INTEGER), &pdu->msgid,
+                                sizeof(pdu->msgid));
+    DEBUGINDENTLESS();
+    if (rc == 0) {
+        return 0;
+    }
+
+    /*
+     * Global data sequence.  
+     */
+    rc = asn_realloc_rbuild_sequence(pkt, pkt_len, offset, 1,
+                                     (u_char) (ASN_SEQUENCE |
+                                               ASN_CONSTRUCTOR),
+                                     *offset - start_offset);
+    if (rc == 0) {
+        return 0;
+    }
+
+    /*
+     * Store the version field - msgVersion.  
+     */
+    DEBUGDUMPHEADER("send", "SNMP Version Number");
+    rc = asn_realloc_rbuild_int(pkt, pkt_len, offset, 1,
+                                (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE |
+                                          ASN_INTEGER),
+                                (long *) &pdu->version,
+                                sizeof(pdu->version));
+    DEBUGINDENTLESS();
+    return rc;
+}                               /* end snmpv3_header_realloc_rbuild() */
+#endif                          /* USE_REVERSE_ASNENCODING */
+
+static u_char  *
+snmpv3_scopedPDU_header_build(netsnmp_pdu *pdu,
+                              u_char * packet, size_t * out_length,
+                              u_char ** spdu_e)
+{
+    size_t          init_length;
+    u_char         *scopedPdu, *pb;
+
+
+    init_length = *out_length;
+
+    pb = scopedPdu = packet;
+    pb = asn_build_sequence(pb, out_length,
+                            (u_char) (ASN_SEQUENCE | ASN_CONSTRUCTOR), 0);
+    if (pb == NULL)
+        return NULL;
+    if (spdu_e)
+        *spdu_e = pb;
+
+    DEBUGDUMPHEADER("send", "contextEngineID");
+    pb = asn_build_string(pb, out_length,
+                          (ASN_UNIVERSAL | ASN_PRIMITIVE | ASN_OCTET_STR),
+                          pdu->contextEngineID, pdu->contextEngineIDLen);
+    DEBUGINDENTLESS();
+    if (pb == NULL)
+        return NULL;
+
+    DEBUGDUMPHEADER("send", "contextName");
+    pb = asn_build_string(pb, out_length,
+                          (ASN_UNIVERSAL | ASN_PRIMITIVE | ASN_OCTET_STR),
+                          (u_char *) pdu->contextName,
+                          pdu->contextNameLen);
+    DEBUGINDENTLESS();
+    if (pb == NULL)
+        return NULL;
+
+    return pb;
+
+}                               /* end snmpv3_scopedPDU_header_build() */
+
+
+#ifdef USE_REVERSE_ASNENCODING
+static int
+snmpv3_scopedPDU_header_realloc_rbuild(u_char ** pkt, size_t * pkt_len,
+                                       size_t * offset, netsnmp_pdu *pdu,
+                                       size_t body_len)
+{
+    size_t          start_offset = *offset;
+    int             rc = 0;
+
+    /*
+     * contextName.  
+     */
+    DEBUGDUMPHEADER("send", "contextName");
+    rc = asn_realloc_rbuild_string(pkt, pkt_len, offset, 1,
+                                   (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE
+                                             | ASN_OCTET_STR),
+                                   (u_char *) pdu->contextName,
+                                   pdu->contextNameLen);
+    DEBUGINDENTLESS();
+    if (rc == 0) {
+        return 0;
+    }
+
+    /*
+     * contextEngineID.  
+     */
+    DEBUGDUMPHEADER("send", "contextEngineID");
+    rc = asn_realloc_rbuild_string(pkt, pkt_len, offset, 1,
+                                   (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE
+                                             | ASN_OCTET_STR),
+                                   pdu->contextEngineID,
+                                   pdu->contextEngineIDLen);
+    DEBUGINDENTLESS();
+    if (rc == 0) {
+        return 0;
+    }
+
+    rc = asn_realloc_rbuild_sequence(pkt, pkt_len, offset, 1,
+                                     (u_char) (ASN_SEQUENCE |
+                                               ASN_CONSTRUCTOR),
+                                     *offset - start_offset + body_len);
+
+    return rc;
+}                               /* end snmpv3_scopedPDU_header_realloc_rbuild() */
+#endif                          /* USE_REVERSE_ASNENCODING */
+
+#ifdef USE_REVERSE_ASNENCODING
+/*
+ * returns 0 if success, -1 if fail, not 0 if SM build failure 
+ */
+int
+snmpv3_packet_realloc_rbuild(u_char ** pkt, size_t * pkt_len,
+                             size_t * offset, netsnmp_session * session,
+                             netsnmp_pdu *pdu, u_char * pdu_data,
+                             size_t pdu_data_len)
+{
+    u_char         *scoped_pdu, *hdrbuf = NULL, *hdr = NULL;
+    size_t          hdrbuf_len = SNMP_MAX_MSG_V3_HDRS, hdr_offset =
+        0, spdu_offset = 0;
+    size_t          body_end_offset = *offset, body_len = 0;
+    struct snmp_secmod_def *sptr = NULL;
+    int             rc = 0;
+
+    /*
+     * Build a scopedPDU structure into the packet buffer.  
+     */
+    DEBUGPRINTPDUTYPE("send", pdu->command);
+    if (pdu_data) {
+        while ((*pkt_len - *offset) < pdu_data_len) {
+            if (!asn_realloc(pkt, pkt_len)) {
+                return -1;
+            }
+        }
+
+        *offset += pdu_data_len;
+        memcpy(*pkt + *pkt_len - *offset, pdu_data, pdu_data_len);
+    } else {
+        rc = snmp_pdu_realloc_rbuild(pkt, pkt_len, offset, pdu);
+        if (rc == 0) {
+            return -1;
+        }
+    }
+    body_len = *offset - body_end_offset;
+
+    DEBUGDUMPSECTION("send", "ScopedPdu");
+    rc = snmpv3_scopedPDU_header_realloc_rbuild(pkt, pkt_len, offset,
+                                                pdu, body_len);
+    if (rc == 0) {
+        return -1;
+    }
+    spdu_offset = *offset;
+    DEBUGINDENTADD(-4);         /*  Return from Scoped PDU.  */
+
+    if ((hdrbuf = (u_char *) malloc(hdrbuf_len)) == NULL) {
+        return -1;
+    }
+
+    rc = snmpv3_header_realloc_rbuild(&hdrbuf, &hdrbuf_len, &hdr_offset,
+                                      session, pdu);
+    if (rc == 0) {
+        free(hdrbuf);
+        return -1;
+    }
+    hdr = hdrbuf + hdrbuf_len - hdr_offset;
+    scoped_pdu = *pkt + *pkt_len - spdu_offset;
+
+    /*
+     * Call the security module to possibly encrypt and authenticate the
+     * message---the entire message to transmitted on the wire is returned.  
+     */
+
+    sptr = find_sec_mod(pdu->securityModel);
+    DEBUGDUMPSECTION("send", "SM msgSecurityParameters");
+    if (sptr && sptr->encode_reverse) {
+        struct snmp_secmod_outgoing_params parms;
+
+        parms.msgProcModel = pdu->msgParseModel;
+        parms.globalData = hdr;
+        parms.globalDataLen = hdr_offset;
+        parms.maxMsgSize = SNMP_MAX_MSG_SIZE;
+        parms.secModel = pdu->securityModel;
+        parms.secEngineID = pdu->securityEngineID;
+        parms.secEngineIDLen = pdu->securityEngineIDLen;
+        parms.secName = pdu->securityName;
+        parms.secNameLen = pdu->securityNameLen;
+        parms.secLevel = pdu->securityLevel;
+        parms.scopedPdu = scoped_pdu;
+        parms.scopedPduLen = spdu_offset;
+        parms.secStateRef = pdu->securityStateRef;
+        parms.wholeMsg = pkt;
+        parms.wholeMsgLen = pkt_len;
+        parms.wholeMsgOffset = offset;
+        parms.session = session;
+        parms.pdu = pdu;
+
+        rc = (*sptr->encode_reverse) (&parms);
+    } else {
+        if (!sptr) {
+            snmp_log(LOG_ERR,
+                     "no such security service available: %d\n",
+                     pdu->securityModel);
+        } else if (!sptr->encode_reverse) {
+            snmp_log(LOG_ERR,
+                     "security service %d doesn't support reverse encoding.\n",
+                     pdu->securityModel);
+        }
+        rc = -1;
+    }
+
+    DEBUGINDENTLESS();
+    free(hdrbuf);
+    return rc;
+}                               /* end snmpv3_packet_realloc_rbuild() */
+#endif                          /* USE_REVERSE_ASNENCODING */
+
+/*
+ * returns 0 if success, -1 if fail, not 0 if SM build failure 
+ */
+int
+snmpv3_packet_build(netsnmp_session * session, netsnmp_pdu *pdu,
+                    u_char * packet, size_t * out_length,
+                    u_char * pdu_data, size_t pdu_data_len)
+{
+    u_char         *global_data, *sec_params, *spdu_hdr_e;
+    size_t          global_data_len, sec_params_len;
+    u_char          spdu_buf[SNMP_MAX_MSG_SIZE];
+    size_t          spdu_buf_len, spdu_len;
+    u_char         *cp;
+    int             result;
+    struct snmp_secmod_def *sptr;
+
+    global_data = packet;
+
+    /*
+     * build the headers for the packet, returned addr = start of secParams
+     */
+    sec_params = snmpv3_header_build(session, pdu, global_data,
+                                     out_length, 0, NULL);
+    if (sec_params == NULL)
+        return -1;
+    global_data_len = sec_params - global_data;
+    sec_params_len = *out_length;       /* length left in packet buf for sec_params */
+
+
+    /*
+     * build a scopedPDU structure into spdu_buf
+     */
+    spdu_buf_len = SNMP_MAX_MSG_SIZE;
+    DEBUGDUMPSECTION("send", "ScopedPdu");
+    cp = snmpv3_scopedPDU_header_build(pdu, spdu_buf, &spdu_buf_len,
+                                       &spdu_hdr_e);
+    if (cp == NULL)
+        return -1;
+
+    /*
+     * build the PDU structure onto the end of spdu_buf 
+     */
+    DEBUGPRINTPDUTYPE("send", ((pdu_data) ? *pdu_data : 0x00));
+    if (pdu_data) {
+        memcpy(cp, pdu_data, pdu_data_len);
+        cp += pdu_data_len;
+    } else {
+        cp = snmp_pdu_build(pdu, cp, &spdu_buf_len);
+        if (cp == NULL)
+            return -1;
+    }
+    DEBUGINDENTADD(-4);         /* return from Scoped PDU */
+
+    /*
+     * re-encode the actual ASN.1 length of the scopedPdu
+     */
+    spdu_len = cp - spdu_hdr_e; /* length of scopedPdu minus ASN.1 headers */
+    spdu_buf_len = SNMP_MAX_MSG_SIZE;
+    if (asn_build_sequence(spdu_buf, &spdu_buf_len,
+                           (u_char) (ASN_SEQUENCE | ASN_CONSTRUCTOR),
+                           spdu_len) == NULL)
+        return -1;
+    spdu_len = cp - spdu_buf;   /* the length of the entire scopedPdu */
+
+
+    /*
+     * call the security module to possibly encrypt and authenticate the
+     * message - the entire message to transmitted on the wire is returned
+     */
+    cp = NULL;
+    *out_length = SNMP_MAX_MSG_SIZE;
+    DEBUGDUMPSECTION("send", "SM msgSecurityParameters");
+    sptr = find_sec_mod(pdu->securityModel);
+    if (sptr && sptr->encode_forward) {
+        struct snmp_secmod_outgoing_params parms;
+        parms.msgProcModel = pdu->msgParseModel;
+        parms.globalData = global_data;
+        parms.globalDataLen = global_data_len;
+        parms.maxMsgSize = SNMP_MAX_MSG_SIZE;
+        parms.secModel = pdu->securityModel;
+        parms.secEngineID = pdu->securityEngineID;
+        parms.secEngineIDLen = pdu->securityEngineIDLen;
+        parms.secName = pdu->securityName;
+        parms.secNameLen = pdu->securityNameLen;
+        parms.secLevel = pdu->securityLevel;
+        parms.scopedPdu = spdu_buf;
+        parms.scopedPduLen = spdu_len;
+        parms.secStateRef = pdu->securityStateRef;
+        parms.secParams = sec_params;
+        parms.secParamsLen = &sec_params_len;
+        parms.wholeMsg = &cp;
+        parms.wholeMsgLen = out_length;
+        parms.session = session;
+        parms.pdu = pdu;
+        result = (*sptr->encode_forward) (&parms);
+    } else {
+        if (!sptr) {
+            snmp_log(LOG_ERR, "no such security service available: %d\n",
+                     pdu->securityModel);
+        } else if (!sptr->encode_forward) {
+            snmp_log(LOG_ERR,
+                     "security service %d doesn't support forward out encoding.\n",
+                     pdu->securityModel);
+        }
+        result = -1;
+    }
+    DEBUGINDENTLESS();
+    return result;
+
+}                               /* end snmpv3_packet_build() */
+
+
+/*
+ * Takes a session and a pdu and serializes the ASN PDU into the area
+ * pointed to by *pkt.  *pkt_len is the size of the data area available.
+ * Returns the length of the completed packet in *offset.  If any errors
+ * occur, -1 is returned.  If all goes well, 0 is returned.
+ */
+
+static int
+_snmp_build(u_char ** pkt, size_t * pkt_len, size_t * offset,
+            netsnmp_session * session, netsnmp_pdu *pdu)
+{
+    u_char         *h0, *h0e = 0, *h1;
+    u_char         *cp;
+    size_t          length, start_offset = *offset;
+    long            version;
+    int             rc = 0;
+
+    session->s_snmp_errno = 0;
+    session->s_errno = 0;
+
+    if (pdu->version == SNMP_VERSION_3) {
+        return snmpv3_build(pkt, pkt_len, offset, session, pdu);
+    }
+
+    switch (pdu->command) {
+    case SNMP_MSG_RESPONSE:
+        pdu->flags &= (~UCD_MSG_FLAG_EXPECT_RESPONSE);
+        /*
+         * Fallthrough 
+         */
+    case SNMP_MSG_GET:
+    case SNMP_MSG_GETNEXT:
+    case SNMP_MSG_SET:
+        /*
+         * all versions support these PDU types 
+         */
+        /*
+         * initialize defaulted PDU fields 
+         */
+
+        if (pdu->errstat == SNMP_DEFAULT_ERRSTAT)
+            pdu->errstat = 0;
+        if (pdu->errindex == SNMP_DEFAULT_ERRINDEX)
+            pdu->errindex = 0;
+        break;
+
+    case SNMP_MSG_TRAP2:
+        pdu->flags &= (~UCD_MSG_FLAG_EXPECT_RESPONSE);
+        /*
+         * Fallthrough 
+         */
+    case SNMP_MSG_INFORM:
+        /*
+         * not supported in SNMPv1 and SNMPsec 
+         */
+        if (pdu->version == SNMP_VERSION_1) {
+            session->s_snmp_errno = SNMPERR_V2_IN_V1;
+            return -1;
+        }
+        if (pdu->errstat == SNMP_DEFAULT_ERRSTAT)
+            pdu->errstat = 0;
+        if (pdu->errindex == SNMP_DEFAULT_ERRINDEX)
+            pdu->errindex = 0;
+        break;
+
+    case SNMP_MSG_GETBULK:
+        /*
+         * not supported in SNMPv1 and SNMPsec 
+         */
+        if (pdu->version == SNMP_VERSION_1) {
+            session->s_snmp_errno = SNMPERR_V2_IN_V1;
+            return -1;
+        }
+        if (pdu->max_repetitions < 0) {
+            session->s_snmp_errno = SNMPERR_BAD_REPETITIONS;
+            return -1;
+        }
+        if (pdu->non_repeaters < 0) {
+            session->s_snmp_errno = SNMPERR_BAD_REPEATERS;
+            return -1;
+        }
+        break;
+
+    case SNMP_MSG_TRAP:
+        /*
+         * *only* supported in SNMPv1 and SNMPsec 
+         */
+        if (pdu->version != SNMP_VERSION_1) {
+            session->s_snmp_errno = SNMPERR_V1_IN_V2;
+            return -1;
+        }
+        /*
+         * initialize defaulted Trap PDU fields 
+         */
+        pdu->reqid = 1;         /* give a bogus non-error reqid for traps */
+        if (pdu->enterprise_length == SNMP_DEFAULT_ENTERPRISE_LENGTH) {
+            pdu->enterprise = (oid *) malloc(sizeof(DEFAULT_ENTERPRISE));
+            if (pdu->enterprise == NULL) {
+                session->s_snmp_errno = SNMPERR_MALLOC;
+                return -1;
+            }
+            memmove(pdu->enterprise, DEFAULT_ENTERPRISE,
+                    sizeof(DEFAULT_ENTERPRISE));
+            pdu->enterprise_length =
+                sizeof(DEFAULT_ENTERPRISE) / sizeof(oid);
+        }
+        if (pdu->time == SNMP_DEFAULT_TIME)
+            pdu->time = DEFAULT_TIME;
+        /*
+         * don't expect a response 
+         */
+        pdu->flags &= (~UCD_MSG_FLAG_EXPECT_RESPONSE);
+        break;
+
+    case SNMP_MSG_REPORT:      /* SNMPv3 only */
+    default:
+        session->s_snmp_errno = SNMPERR_UNKNOWN_PDU;
+        return -1;
+    }
+
+    /*
+     * save length 
+     */
+    length = *pkt_len;
+
+    /*
+     * setup administrative fields based on version 
+     */
+    /*
+     * build the message wrapper and all the administrative fields
+     * upto the PDU sequence
+     * (note that actual length of message will be inserted later) 
+     */
+    h0 = *pkt;
+    switch (pdu->version) {
+    case SNMP_VERSION_1:
+    case SNMP_VERSION_2c:
+#ifdef NO_ZEROLENGTH_COMMUNITY
+        if (pdu->community_len == 0) {
+            if (session->community_len == 0) {
+                session->s_snmp_errno = SNMPERR_BAD_COMMUNITY;
+                return -1;
+            }
+            pdu->community = (u_char *) malloc(session->community_len);
+            if (pdu->community == NULL) {
+                session->s_snmp_errno = SNMPERR_MALLOC;
+                return -1;
+            }
+            memmove(pdu->community,
+                    session->community, session->community_len);
+            pdu->community_len = session->community_len;
+        }
+#else                           /* !NO_ZEROLENGTH_COMMUNITY */
+        if (pdu->community_len == 0 && pdu->command != SNMP_MSG_RESPONSE) {
+            /*
+             * copy session community exactly to pdu community 
+             */
+            if (0 == session->community_len) {
+                SNMP_FREE(pdu->community);
+                pdu->community = NULL;
+            } else if (pdu->community_len == session->community_len) {
+                memmove(pdu->community,
+                        session->community, session->community_len);
+            } else {
+                SNMP_FREE(pdu->community);
+                pdu->community = (u_char *) malloc(session->community_len);
+                if (pdu->community == NULL) {
+                    session->s_snmp_errno = SNMPERR_MALLOC;
+                    return -1;
+                }
+                memmove(pdu->community,
+                        session->community, session->community_len);
+            }
+            pdu->community_len = session->community_len;
+        }
+#endif                          /* !NO_ZEROLENGTH_COMMUNITY */
+
+        DEBUGMSGTL(("snmp_send", "Building SNMPv%d message...\n",
+                    (1 + pdu->version)));
+#ifdef USE_REVERSE_ASNENCODING
+        if (netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_REVERSE_ENCODE)) {
+            DEBUGPRINTPDUTYPE("send", pdu->command);
+            rc = snmp_pdu_realloc_rbuild(pkt, pkt_len, offset, pdu);
+            if (rc == 0) {
+                return -1;
+            }
+
+            DEBUGDUMPHEADER("send", "Community String");
+            rc = asn_realloc_rbuild_string(pkt, pkt_len, offset, 1,
+                                           (u_char) (ASN_UNIVERSAL |
+                                                     ASN_PRIMITIVE |
+                                                     ASN_OCTET_STR),
+                                           pdu->community,
+                                           pdu->community_len);
+            DEBUGINDENTLESS();
+            if (rc == 0) {
+                return -1;
+            }
+
+
+            /*
+             * Store the version field.  
+             */
+            DEBUGDUMPHEADER("send", "SNMP Version Number");
+
+            version = pdu->version;
+            rc = asn_realloc_rbuild_int(pkt, pkt_len, offset, 1,
+                                        (u_char) (ASN_UNIVERSAL |
+                                                  ASN_PRIMITIVE |
+                                                  ASN_INTEGER),
+                                        (long *) &version,
+                                        sizeof(version));
+            DEBUGINDENTLESS();
+            if (rc == 0) {
+                return -1;
+            }
+
+            /*
+             * Build the final sequence.  
+             */
+            if (pdu->version == SNMP_VERSION_1) {
+                DEBUGDUMPSECTION("send", "SNMPv1 Message");
+            } else {
+                DEBUGDUMPSECTION("send", "SNMPv2c Message");
+            }
+            rc = asn_realloc_rbuild_sequence(pkt, pkt_len, offset, 1,
+                                             (u_char) (ASN_SEQUENCE |
+                                                       ASN_CONSTRUCTOR),
+                                             *offset - start_offset);
+
+            if (rc == 0) {
+                return -1;
+            }
+            return 0;
+        } else {
+
+#endif                          /* USE_REVERSE_ASNENCODING */
+            /*
+             * Save current location and build SEQUENCE tag and length
+             * placeholder for SNMP message sequence
+             * (actual length will be inserted later) 
+             */
+            cp = asn_build_sequence(*pkt, pkt_len,
+                                    (u_char) (ASN_SEQUENCE |
+                                              ASN_CONSTRUCTOR), 0);
+            if (cp == NULL) {
+                return -1;
+            }
+            h0e = cp;
+
+            if (pdu->version == SNMP_VERSION_1) {
+                DEBUGDUMPSECTION("send", "SNMPv1 Message");
+            } else {
+                DEBUGDUMPSECTION("send", "SNMPv2c Message");
+            }
+
+            /*
+             * store the version field 
+             */
+            DEBUGDUMPHEADER("send", "SNMP Version Number");
+
+            version = pdu->version;
+            cp = asn_build_int(*pkt, pkt_len,
+                               (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE |
+                                         ASN_INTEGER), (long *) &version,
+                               sizeof(version));
+            DEBUGINDENTLESS();
+            if (cp == NULL)
+                return -1;
+
+            /*
+             * store the community string 
+             */
+            DEBUGDUMPHEADER("send", "Community String");
+            cp = asn_build_string(*pkt, pkt_len,
+                                  (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE |
+                                            ASN_OCTET_STR), pdu->community,
+                                  pdu->community_len);
+            DEBUGINDENTLESS();
+            if (cp == NULL)
+                return -1;
+            break;
+
+#ifdef USE_REVERSE_ASNENCODING
+        }
+#endif                          /* USE_REVERSE_ASNENCODING */
+
+    case SNMP_VERSION_2p:
+    case SNMP_VERSION_sec:
+    case SNMP_VERSION_2u:
+    case SNMP_VERSION_2star:
+    default:
+        session->s_snmp_errno = SNMPERR_BAD_VERSION;
+        return -1;
+    }
+
+    h1 = cp;
+    DEBUGPRINTPDUTYPE("send", pdu->command);
+    cp = snmp_pdu_build(pdu, cp, pkt_len);
+    DEBUGINDENTADD(-4);         /* return from entire v1/v2c message */
+    if (cp == NULL)
+        return -1;
+
+    /*
+     * insert the actual length of the message sequence 
+     */
+    switch (pdu->version) {
+    case SNMP_VERSION_1:
+    case SNMP_VERSION_2c:
+        asn_build_sequence(*pkt, &length,
+                           (u_char) (ASN_SEQUENCE | ASN_CONSTRUCTOR),
+                           cp - h0e);
+        break;
+
+    case SNMP_VERSION_2p:
+    case SNMP_VERSION_sec:
+    case SNMP_VERSION_2u:
+    case SNMP_VERSION_2star:
+    default:
+        session->s_snmp_errno = SNMPERR_BAD_VERSION;
+        return -1;
+    }
+    *pkt_len = cp - *pkt;
+    return 0;
+}
+
+int
+snmp_build(u_char ** pkt, size_t * pkt_len, size_t * offset,
+           netsnmp_session * pss, netsnmp_pdu *pdu)
+{
+    int             rc;
+    rc = _snmp_build(pkt, pkt_len, offset, pss, pdu);
+    if (rc) {
+        if (!pss->s_snmp_errno) {
+            pss->s_snmp_errno = SNMPERR_BAD_ASN1_BUILD;
+        }
+        SET_SNMP_ERROR(pss->s_snmp_errno);
+        rc = -1;
+    }
+    return rc;
+}
+
+/*
+ * on error, returns NULL (likely an encoding problem). 
+ */
+u_char         *
+snmp_pdu_build(netsnmp_pdu *pdu, u_char * cp, size_t * out_length)
+{
+    u_char         *h1, *h1e, *h2, *h2e;
+    netsnmp_variable_list *vp;
+    size_t          length;
+
+    length = *out_length;
+    /*
+     * Save current location and build PDU tag and length placeholder
+     * (actual length will be inserted later) 
+     */
+    h1 = cp;
+    cp = asn_build_sequence(cp, out_length, (u_char) pdu->command, 0);
+    if (cp == NULL)
+        return NULL;
+    h1e = cp;
+
+    /*
+     * store fields in the PDU preceeding the variable-bindings sequence 
+     */
+    if (pdu->command != SNMP_MSG_TRAP) {
+        /*
+         * PDU is not an SNMPv1 trap 
+         */
+
+        DEBUGDUMPHEADER("send", "request_id");
+        /*
+         * request id 
+         */
+        cp = asn_build_int(cp, out_length,
+                           (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE |
+                                     ASN_INTEGER), &pdu->reqid,
+                           sizeof(pdu->reqid));
+        DEBUGINDENTLESS();
+        if (cp == NULL)
+            return NULL;
+
+        /*
+         * error status (getbulk non-repeaters) 
+         */
+        DEBUGDUMPHEADER("send", "error status");
+        cp = asn_build_int(cp, out_length,
+                           (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE |
+                                     ASN_INTEGER), &pdu->errstat,
+                           sizeof(pdu->errstat));
+        DEBUGINDENTLESS();
+        if (cp == NULL)
+            return NULL;
+
+        /*
+         * error index (getbulk max-repetitions) 
+         */
+        DEBUGDUMPHEADER("send", "error index");
+        cp = asn_build_int(cp, out_length,
+                           (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE |
+                                     ASN_INTEGER), &pdu->errindex,
+                           sizeof(pdu->errindex));
+        DEBUGINDENTLESS();
+        if (cp == NULL)
+            return NULL;
+    } else {
+        /*
+         * an SNMPv1 trap PDU 
+         */
+
+        /*
+         * enterprise 
+         */
+        DEBUGDUMPHEADER("send", "enterprise OBJID");
+        cp = asn_build_objid(cp, out_length,
+                             (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE |
+                                       ASN_OBJECT_ID),
+                             (oid *) pdu->enterprise,
+                             pdu->enterprise_length);
+        DEBUGINDENTLESS();
+        if (cp == NULL)
+            return NULL;
+
+        /*
+         * agent-addr 
+         */
+        DEBUGDUMPHEADER("send", "agent Address");
+        cp = asn_build_string(cp, out_length,
+                              (u_char) (ASN_IPADDRESS | ASN_PRIMITIVE),
+                              (u_char *) pdu->agent_addr, 4);
+        DEBUGINDENTLESS();
+        if (cp == NULL)
+            return NULL;
+
+        /*
+         * generic trap 
+         */
+        DEBUGDUMPHEADER("send", "generic trap number");
+        cp = asn_build_int(cp, out_length,
+                           (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE |
+                                     ASN_INTEGER),
+                           (long *) &pdu->trap_type,
+                           sizeof(pdu->trap_type));
+        DEBUGINDENTLESS();
+        if (cp == NULL)
+            return NULL;
+
+        /*
+         * specific trap 
+         */
+        DEBUGDUMPHEADER("send", "specific trap number");
+        cp = asn_build_int(cp, out_length,
+                           (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE |
+                                     ASN_INTEGER),
+                           (long *) &pdu->specific_type,
+                           sizeof(pdu->specific_type));
+        DEBUGINDENTLESS();
+        if (cp == NULL)
+            return NULL;
+
+        /*
+         * timestamp  
+         */
+        DEBUGDUMPHEADER("send", "timestamp");
+        cp = asn_build_unsigned_int(cp, out_length,
+                                    (u_char) (ASN_TIMETICKS |
+                                              ASN_PRIMITIVE), &pdu->time,
+                                    sizeof(pdu->time));
+        DEBUGINDENTLESS();
+        if (cp == NULL)
+            return NULL;
+    }
+
+    /*
+     * Save current location and build SEQUENCE tag and length placeholder
+     * for variable-bindings sequence
+     * (actual length will be inserted later) 
+     */
+    h2 = cp;
+    cp = asn_build_sequence(cp, out_length,
+                            (u_char) (ASN_SEQUENCE | ASN_CONSTRUCTOR), 0);
+    if (cp == NULL)
+        return NULL;
+    h2e = cp;
+
+    /*
+     * Store variable-bindings 
+     */
+    DEBUGDUMPSECTION("send", "VarBindList");
+    for (vp = pdu->variables; vp; vp = vp->next_variable) {
+        DEBUGDUMPSECTION("send", "VarBind");
+        cp = snmp_build_var_op(cp, vp->name, &vp->name_length, vp->type,
+                               vp->val_len, (u_char *) vp->val.string,
+                               out_length);
+        DEBUGINDENTLESS();
+        if (cp == NULL)
+            return NULL;
+    }
+    DEBUGINDENTLESS();
+
+    /*
+     * insert actual length of variable-bindings sequence 
+     */
+    asn_build_sequence(h2, &length,
+                       (u_char) (ASN_SEQUENCE | ASN_CONSTRUCTOR),
+                       cp - h2e);
+
+    /*
+     * insert actual length of PDU sequence 
+     */
+    asn_build_sequence(h1, &length, (u_char) pdu->command, cp - h1e);
+
+    return cp;
+}
+
+#ifdef USE_REVERSE_ASNENCODING
+/*
+ * On error, returns 0 (likely an encoding problem).  
+ */
+int
+snmp_pdu_realloc_rbuild(u_char ** pkt, size_t * pkt_len, size_t * offset,
+                        netsnmp_pdu *pdu)
+{
+#ifndef VPCACHE_SIZE
+#define VPCACHE_SIZE 50
+#endif
+    netsnmp_variable_list *vpcache[VPCACHE_SIZE];
+    netsnmp_variable_list *vp, *tmpvp;
+    size_t          start_offset = *offset;
+    int             i, wrapped = 0, notdone, final, rc = 0;
+
+    DEBUGMSGTL(("snmp_pdu_realloc_rbuild", "starting\n"));
+    for (vp = pdu->variables, i = VPCACHE_SIZE - 1; vp;
+         vp = vp->next_variable, i--) {
+        if (i < 0) {
+            wrapped = notdone = 1;
+            i = VPCACHE_SIZE - 1;
+            DEBUGMSGTL(("snmp_pdu_realloc_rbuild", "wrapped\n"));
+        }
+        vpcache[i] = vp;
+    }
+    final = i + 1;
+
+    do {
+        for (i = final; i < VPCACHE_SIZE; i++) {
+            vp = vpcache[i];
+            DEBUGDUMPSECTION("send", "VarBind");
+            rc = snmp_realloc_rbuild_var_op(pkt, pkt_len, offset, 1,
+                                            vp->name, &vp->name_length,
+                                            vp->type,
+                                            (u_char *) vp->val.string,
+                                            vp->val_len);
+            DEBUGINDENTLESS();
+            if (rc == 0) {
+                return 0;
+            }
+        }
+
+        DEBUGINDENTLESS();
+        if (wrapped) {
+            notdone = 1;
+            for (i = 0; i < final; i++) {
+                vp = vpcache[i];
+                DEBUGDUMPSECTION("send", "VarBind");
+                rc = snmp_realloc_rbuild_var_op(pkt, pkt_len, offset, 1,
+                                                vp->name, &vp->name_length,
+                                                vp->type,
+                                                (u_char *) vp->val.string,
+                                                vp->val_len);
+                DEBUGINDENTLESS();
+                if (rc == 0) {
+                    return 0;
+                }
+            }
+
+            if (final == 0) {
+                tmpvp = vpcache[VPCACHE_SIZE - 1];
+            } else {
+                tmpvp = vpcache[final - 1];
+            }
+            wrapped = 0;
+
+            for (vp = pdu->variables, i = VPCACHE_SIZE - 1;
+                 vp && vp != tmpvp; vp = vp->next_variable, i--) {
+                if (i < 0) {
+                    wrapped = 1;
+                    i = VPCACHE_SIZE - 1;
+                    DEBUGMSGTL(("snmp_pdu_realloc_rbuild", "wrapped\n"));
+                }
+                vpcache[i] = vp;
+            }
+            final = i + 1;
+        } else {
+            notdone = 0;
+        }
+    } while (notdone);
+
+    /*
+     * Save current location and build SEQUENCE tag and length placeholder for
+     * variable-bindings sequence (actual length will be inserted later).  
+     */
+
+    rc = asn_realloc_rbuild_sequence(pkt, pkt_len, offset, 1,
+                                     (u_char) (ASN_SEQUENCE |
+                                               ASN_CONSTRUCTOR),
+                                     *offset - start_offset);
+
+    /*
+     * Store fields in the PDU preceeding the variable-bindings sequence.  
+     */
+    if (pdu->command != SNMP_MSG_TRAP) {
+        /*
+         * Error index (getbulk max-repetitions).  
+         */
+        DEBUGDUMPHEADER("send", "error index");
+        rc = asn_realloc_rbuild_int(pkt, pkt_len, offset, 1,
+                                    (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE
+                                              | ASN_INTEGER),
+                                    &pdu->errindex, sizeof(pdu->errindex));
+        DEBUGINDENTLESS();
+        if (rc == 0) {
+            return 0;
+        }
+
+        /*
+         * Error status (getbulk non-repeaters).  
+         */
+        DEBUGDUMPHEADER("send", "error status");
+        rc = asn_realloc_rbuild_int(pkt, pkt_len, offset, 1,
+                                    (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE
+                                              | ASN_INTEGER),
+                                    &pdu->errstat, sizeof(pdu->errstat));
+        DEBUGINDENTLESS();
+        if (rc == 0) {
+            return 0;
+        }
+
+        /*
+         * Request ID.  
+         */
+        DEBUGDUMPHEADER("send", "request_id");
+        rc = asn_realloc_rbuild_int(pkt, pkt_len, offset, 1,
+                                    (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE
+                                              | ASN_INTEGER), &pdu->reqid,
+                                    sizeof(pdu->reqid));
+        DEBUGINDENTLESS();
+        if (rc == 0) {
+            return 0;
+        }
+    } else {
+        /*
+         * An SNMPv1 trap PDU.  
+         */
+
+        /*
+         * Timestamp.  
+         */
+        DEBUGDUMPHEADER("send", "timestamp");
+        rc = asn_realloc_rbuild_unsigned_int(pkt, pkt_len, offset, 1,
+                                             (u_char) (ASN_TIMETICKS |
+                                                       ASN_PRIMITIVE),
+                                             &pdu->time,
+                                             sizeof(pdu->time));
+        DEBUGINDENTLESS();
+        if (rc == 0) {
+            return 0;
+        }
+
+        /*
+         * Specific trap.  
+         */
+        DEBUGDUMPHEADER("send", "specific trap number");
+        rc = asn_realloc_rbuild_int(pkt, pkt_len, offset, 1,
+                                    (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE
+                                              | ASN_INTEGER),
+                                    (long *) &pdu->specific_type,
+                                    sizeof(pdu->specific_type));
+        DEBUGINDENTLESS();
+        if (rc == 0) {
+            return 0;
+        }
+
+        /*
+         * Generic trap.  
+         */
+        DEBUGDUMPHEADER("send", "generic trap number");
+        rc = asn_realloc_rbuild_int(pkt, pkt_len, offset, 1,
+                                    (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE
+                                              | ASN_INTEGER),
+                                    (long *) &pdu->trap_type,
+                                    sizeof(pdu->trap_type));
+        DEBUGINDENTLESS();
+        if (rc == 0) {
+            return 0;
+        }
+
+        /*
+         * Agent-addr.  
+         */
+        DEBUGDUMPHEADER("send", "agent Address");
+        rc = asn_realloc_rbuild_string(pkt, pkt_len, offset, 1,
+                                       (u_char) (ASN_IPADDRESS |
+                                                 ASN_PRIMITIVE),
+                                       (u_char *) pdu->agent_addr, 4);
+        DEBUGINDENTLESS();
+        if (rc == 0) {
+            return 0;
+        }
+
+        /*
+         * Enterprise.  
+         */
+        DEBUGDUMPHEADER("send", "enterprise OBJID");
+        rc = asn_realloc_rbuild_objid(pkt, pkt_len, offset, 1,
+                                      (u_char) (ASN_UNIVERSAL |
+                                                ASN_PRIMITIVE |
+                                                ASN_OBJECT_ID),
+                                      (oid *) pdu->enterprise,
+                                      pdu->enterprise_length);
+        DEBUGINDENTLESS();
+        if (rc == 0) {
+            return 0;
+        }
+    }
+
+    /*
+     * Build the PDU sequence.  
+     */
+    rc = asn_realloc_rbuild_sequence(pkt, pkt_len, offset, 1,
+                                     (u_char) pdu->command,
+                                     *offset - start_offset);
+    return rc;
+}
+#endif                          /* USE_REVERSE_ASNENCODING */
+
+/*
+ * Parses the packet received to determine version, either directly
+ * from packets version field or inferred from ASN.1 construct.
+ */
+static int
+snmp_parse_version(u_char * data, size_t length)
+{
+    u_char          type;
+    long            version = SNMPERR_BAD_VERSION;
+
+    data = asn_parse_sequence(data, &length, &type,
+                              (ASN_SEQUENCE | ASN_CONSTRUCTOR), "version");
+    if (data) {
+        data =
+            asn_parse_int(data, &length, &type, &version, sizeof(version));
+        if (!data || type != ASN_INTEGER) {
+            return SNMPERR_BAD_VERSION;
+        }
+    }
+    return version;
+}
+
+
+int
+snmpv3_parse(netsnmp_pdu *pdu,
+             u_char * data,
+             size_t * length,
+             u_char ** after_header, netsnmp_session * sess)
+{
+    u_char          type, msg_flags;
+    long            ver, msg_max_size, msg_sec_model;
+    size_t          max_size_response;
+    u_char          tmp_buf[SNMP_MAX_MSG_SIZE];
+    size_t          tmp_buf_len;
+    u_char          pdu_buf[SNMP_MAX_MSG_SIZE];
+    u_char         *mallocbuf = NULL;
+    size_t          pdu_buf_len = SNMP_MAX_MSG_SIZE;
+    u_char         *sec_params;
+    u_char         *msg_data;
+    u_char         *cp;
+    size_t          asn_len, msg_len;
+    int             ret, ret_val;
+    struct snmp_secmod_def *sptr;
+
+
+    msg_data = data;
+    msg_len = *length;
+
+
+    /*
+     * message is an ASN.1 SEQUENCE  
+     */
+    DEBUGDUMPSECTION("recv", "SNMPv3 Message");
+    data = asn_parse_sequence(data, length, &type,
+                              (ASN_SEQUENCE | ASN_CONSTRUCTOR), "message");
+    if (data == NULL) {
+        /*
+         * error msg detail is set 
+         */
+        snmp_increment_statistic(STAT_SNMPINASNPARSEERRS);
+        DEBUGINDENTLESS();
+        return SNMPERR_ASN_PARSE_ERR;
+    }
+
+    /*
+     * parse msgVersion  
+     */
+    DEBUGDUMPHEADER("recv", "SNMP Version Number");
+    data = asn_parse_int(data, length, &type, &ver, sizeof(ver));
+    DEBUGINDENTLESS();
+    if (data == NULL) {
+        ERROR_MSG("bad parse of version");
+        snmp_increment_statistic(STAT_SNMPINASNPARSEERRS);
+        DEBUGINDENTLESS();
+        return SNMPERR_ASN_PARSE_ERR;
+    }
+    pdu->version = ver;
+
+    /*
+     * parse msgGlobalData sequence  
+     */
+    cp = data;
+    asn_len = *length;
+    DEBUGDUMPSECTION("recv", "msgGlobalData");
+    data = asn_parse_sequence(data, &asn_len, &type,
+                              (ASN_SEQUENCE | ASN_CONSTRUCTOR),
+                              "msgGlobalData");
+    if (data == NULL) {
+        /*
+         * error msg detail is set 
+         */
+        snmp_increment_statistic(STAT_SNMPINASNPARSEERRS);
+        DEBUGINDENTADD(-4);
+        return SNMPERR_ASN_PARSE_ERR;
+    }
+    *length -= data - cp;       /* subtract off the length of the header */
+
+    /*
+     * msgID 
+     */
+    DEBUGDUMPHEADER("recv", "msgID");
+    data =
+        asn_parse_int(data, length, &type, &pdu->msgid,
+                      sizeof(pdu->msgid));
+    DEBUGINDENTLESS();
+    if (data == NULL || type != ASN_INTEGER) {
+        ERROR_MSG("error parsing msgID");
+        DEBUGINDENTADD(-4);
+        snmp_increment_statistic(STAT_SNMPINASNPARSEERRS);
+        return SNMPERR_ASN_PARSE_ERR;
+    }
+
+    /*
+     * Check the msgID we received is a legal value.  If not, then increment
+     * snmpInASNParseErrs and return the appropriate error (see RFC 2572,
+     * para. 7.2, section 2 -- note that a bad msgID means that the received
+     * message is NOT a serialiization of an SNMPv3Message, since the msgID
+     * field is out of bounds).  
+     */
+
+    if (pdu->msgid < 0 || pdu->msgid > 0x7fffffff) {
+        snmp_log(LOG_ERR, "Received bad msgID (%ld %s %s).\n", pdu->msgid,
+                 (pdu->msgid < 0) ? "<" : ">",
+                 (pdu->msgid < 0) ? "0" : "2^31 - 1");
+        snmp_increment_statistic(STAT_SNMPINASNPARSEERRS);
+        DEBUGINDENTADD(-4);
+        return SNMPERR_ASN_PARSE_ERR;
+    }
+
+    /*
+     * msgMaxSize 
+     */
+    DEBUGDUMPHEADER("recv", "msgMaxSize");
+    data = asn_parse_int(data, length, &type, &msg_max_size,
+                         sizeof(msg_max_size));
+    DEBUGINDENTLESS();
+    if (data == NULL || type != ASN_INTEGER) {
+        ERROR_MSG("error parsing msgMaxSize");
+        snmp_increment_statistic(STAT_SNMPINASNPARSEERRS);
+        DEBUGINDENTADD(-4);
+        return SNMPERR_ASN_PARSE_ERR;
+    }
+
+    /*
+     * Check the msgMaxSize we received is a legal value.  If not, then
+     * increment snmpInASNParseErrs and return the appropriate error (see RFC
+     * 2572, para. 7.2, section 2 -- note that a bad msgMaxSize means that the
+     * received message is NOT a serialiization of an SNMPv3Message, since the
+     * msgMaxSize field is out of bounds).
+     * 
+     * Note we store the msgMaxSize on a per-session basis which also seems
+     * reasonable; it could vary from PDU to PDU but that would be strange
+     * (also since we deal with a PDU at a time, it wouldn't make any
+     * difference to our responses, if any).  
+     */
+
+    if (msg_max_size < 484) {
+        snmp_log(LOG_ERR, "Received bad msgMaxSize (%lu < 484).\n",
+                 msg_max_size);
+        snmp_increment_statistic(STAT_SNMPINASNPARSEERRS);
+        DEBUGINDENTADD(-4);
+        return SNMPERR_ASN_PARSE_ERR;
+    } else if (msg_max_size > 0x7fffffff) {
+        snmp_log(LOG_ERR, "Received bad msgMaxSize (%lu > 2^31 - 1).\n",
+                 msg_max_size);
+        snmp_increment_statistic(STAT_SNMPINASNPARSEERRS);
+        DEBUGINDENTADD(-4);
+        return SNMPERR_ASN_PARSE_ERR;
+    } else {
+        DEBUGMSGTL(("snmpv3_parse", "msgMaxSize %lu received\n",
+                    msg_max_size));
+        sess->sndMsgMaxSize = msg_max_size;
+    }
+
+    /*
+     * msgFlags 
+     */
+    tmp_buf_len = SNMP_MAX_MSG_SIZE;
+    DEBUGDUMPHEADER("recv", "msgFlags");
+    data = asn_parse_string(data, length, &type, tmp_buf, &tmp_buf_len);
+    DEBUGINDENTLESS();
+    if (data == NULL || type != ASN_OCTET_STR || tmp_buf_len != 1) {
+        ERROR_MSG("error parsing msgFlags");
+        snmp_increment_statistic(STAT_SNMPINASNPARSEERRS);
+        DEBUGINDENTADD(-4);
+        return SNMPERR_ASN_PARSE_ERR;
+    }
+    msg_flags = *tmp_buf;
+    if (msg_flags & SNMP_MSG_FLAG_RPRT_BIT)
+        pdu->flags |= SNMP_MSG_FLAG_RPRT_BIT;
+    else
+        pdu->flags &= (~SNMP_MSG_FLAG_RPRT_BIT);
+
+    /*
+     * msgSecurityModel 
+     */
+    DEBUGDUMPHEADER("recv", "msgSecurityModel");
+    data = asn_parse_int(data, length, &type, &msg_sec_model,
+                         sizeof(msg_sec_model));
+    DEBUGINDENTADD(-4);         /* return from global data indent */
+    if (data == NULL || type != ASN_INTEGER ||
+        msg_sec_model < 1 || msg_sec_model > 0x7fffffff) {
+        ERROR_MSG("error parsing msgSecurityModel");
+        snmp_increment_statistic(STAT_SNMPINASNPARSEERRS);
+        DEBUGINDENTLESS();
+        return SNMPERR_ASN_PARSE_ERR;
+    }
+    sptr = find_sec_mod(msg_sec_model);
+    if (!sptr) {
+        snmp_log(LOG_WARNING, "unknown security model: %d\n",
+                 msg_sec_model);
+        snmp_increment_statistic(STAT_SNMPUNKNOWNSECURITYMODELS);
+        DEBUGINDENTLESS();
+        return SNMPERR_UNKNOWN_SEC_MODEL;
+    }
+    pdu->securityModel = msg_sec_model;
+
+    if (msg_flags & SNMP_MSG_FLAG_PRIV_BIT &&
+        !(msg_flags & SNMP_MSG_FLAG_AUTH_BIT)) {
+        ERROR_MSG("invalid message, illegal msgFlags");
+        snmp_increment_statistic(STAT_SNMPINVALIDMSGS);
+        DEBUGINDENTLESS();
+        return SNMPERR_INVALID_MSG;
+    }
+    pdu->securityLevel = ((msg_flags & SNMP_MSG_FLAG_AUTH_BIT)
+                          ? ((msg_flags & SNMP_MSG_FLAG_PRIV_BIT)
+                             ? SNMP_SEC_LEVEL_AUTHPRIV
+                             : SNMP_SEC_LEVEL_AUTHNOPRIV)
+                          : SNMP_SEC_LEVEL_NOAUTH);
+    /*
+     * end of msgGlobalData 
+     */
+
+    /*
+     * securtityParameters OCTET STRING begins after msgGlobalData 
+     */
+    sec_params = data;
+    pdu->contextEngineID = (u_char *) calloc(1, SNMP_MAX_ENG_SIZE);
+    pdu->contextEngineIDLen = SNMP_MAX_ENG_SIZE;
+
+    /*
+     * Note: there is no length limit on the msgAuthoritativeEngineID field,
+     * although we would EXPECT it to be limited to 32 (the SnmpEngineID TC
+     * limit).  We'll use double that here to be on the safe side.  
+     */
+
+    pdu->securityEngineID = (u_char *) calloc(1, SNMP_MAX_ENG_SIZE * 2);
+    pdu->securityEngineIDLen = SNMP_MAX_ENG_SIZE * 2;
+    pdu->securityName = (char *) calloc(1, SNMP_MAX_SEC_NAME_SIZE);
+    pdu->securityNameLen = SNMP_MAX_SEC_NAME_SIZE;
+
+    if ((pdu->securityName == NULL) ||
+        (pdu->securityEngineID == NULL) ||
+        (pdu->contextEngineID == NULL)) {
+        return SNMPERR_MALLOC;
+    }
+
+    if (pdu_buf_len < msg_len
+        && pdu->securityLevel == SNMP_SEC_LEVEL_AUTHPRIV) {
+        /*
+         * space needed is larger than we have in the default buffer 
+         */
+        mallocbuf = (u_char *) calloc(1, msg_len);
+        pdu_buf_len = msg_len;
+        cp = mallocbuf;
+    } else {
+        memset(pdu_buf, 0, pdu_buf_len);
+        cp = pdu_buf;
+    }
+
+    DEBUGDUMPSECTION("recv", "SM msgSecurityParameters");
+    if (sptr->decode) {
+        struct snmp_secmod_incoming_params parms;
+        parms.msgProcModel = pdu->msgParseModel;
+        parms.maxMsgSize = msg_max_size;
+        parms.secParams = sec_params;
+        parms.secModel = msg_sec_model;
+        parms.secLevel = pdu->securityLevel;
+        parms.wholeMsg = msg_data;
+        parms.wholeMsgLen = msg_len;
+        parms.secEngineID = pdu->securityEngineID;
+        parms.secEngineIDLen = &pdu->securityEngineIDLen;
+        parms.secName = pdu->securityName;
+        parms.secNameLen = &pdu->securityNameLen;
+        parms.scopedPdu = &cp;
+        parms.scopedPduLen = &pdu_buf_len;
+        parms.maxSizeResponse = &max_size_response;
+        parms.secStateRef = &pdu->securityStateRef;
+        parms.sess = sess;
+        parms.pdu = pdu;
+        parms.msg_flags = msg_flags;
+        ret_val = (*sptr->decode) (&parms);
+    } else {
+        DEBUGINDENTLESS();
+        snmp_log(LOG_WARNING, "security service %d can't decode packets\n",
+                 msg_sec_model);
+        return (-1);
+    }
+
+    if (ret_val != SNMPERR_SUCCESS) {
+        DEBUGDUMPSECTION("recv", "ScopedPDU");
+        /*
+         * Parse as much as possible -- though I don't see the point? [jbpn].  
+         */
+        if (cp) {
+            cp = snmpv3_scopedPDU_parse(pdu, cp, &pdu_buf_len);
+        }
+        if (cp) {
+            DEBUGPRINTPDUTYPE("recv", *cp);
+            snmp_pdu_parse(pdu, cp, &pdu_buf_len);
+            DEBUGINDENTADD(-8);
+        } else {
+            DEBUGINDENTADD(-4);
+        }
+
+        if (mallocbuf) {
+            free(mallocbuf);
+        }
+        if (pdu->securityStateRef != NULL) {
+            if (sptr && sptr->pdu_free_state_ref) {
+                sptr->pdu_free_state_ref(pdu->securityStateRef);
+                pdu->securityStateRef = NULL;
+            }
+        }
+        return ret_val;
+    }
+
+    /*
+     * parse plaintext ScopedPDU sequence 
+     */
+    *length = pdu_buf_len;
+    DEBUGDUMPSECTION("recv", "ScopedPDU");
+    data = snmpv3_scopedPDU_parse(pdu, cp, length);
+    if (data == NULL) {
+        snmp_increment_statistic(STAT_SNMPINASNPARSEERRS);
+        DEBUGINDENTADD(-4);
+        if (mallocbuf) {
+            free(mallocbuf);
+        }
+        if (pdu->securityStateRef != NULL) {
+            if (sptr && sptr->pdu_free_state_ref) {
+                sptr->pdu_free_state_ref(pdu->securityStateRef);
+                pdu->securityStateRef = NULL;
+            }
+        }
+        return SNMPERR_ASN_PARSE_ERR;
+    }
+
+    /*
+     * parse the PDU.  
+     */
+    if (after_header != NULL) {
+        *after_header = data;
+        tmp_buf_len = *length;
+    }
+
+    DEBUGPRINTPDUTYPE("recv", *data);
+    ret = snmp_pdu_parse(pdu, data, length);
+    DEBUGINDENTADD(-8);
+
+    if (after_header != NULL) {
+        *length = tmp_buf_len;
+    }
+
+    if (ret != SNMPERR_SUCCESS) {
+        ERROR_MSG("error parsing PDU");
+        snmp_increment_statistic(STAT_SNMPINASNPARSEERRS);
+        if (mallocbuf) {
+            free(mallocbuf);
+        }
+        if (pdu->securityStateRef != NULL) {
+            if (sptr && sptr->pdu_free_state_ref) {
+                sptr->pdu_free_state_ref(pdu->securityStateRef);
+                pdu->securityStateRef = NULL;
+            }
+        }
+        return SNMPERR_ASN_PARSE_ERR;
+    }
+
+    if (mallocbuf) {
+        free(mallocbuf);
+    }
+    return SNMPERR_SUCCESS;
+}                               /* end snmpv3_parse() */
+
+#define ERROR_STAT_LENGTH 11
+
+int
+snmpv3_make_report(netsnmp_pdu *pdu, int error)
+{
+
+    long            ltmp;
+    static oid      unknownSecurityLevel[] =
+        { 1, 3, 6, 1, 6, 3, 15, 1, 1, 1, 0 };
+    static oid      notInTimeWindow[] =
+        { 1, 3, 6, 1, 6, 3, 15, 1, 1, 2, 0 };
+    static oid      unknownUserName[] =
+        { 1, 3, 6, 1, 6, 3, 15, 1, 1, 3, 0 };
+    static oid      unknownEngineID[] =
+        { 1, 3, 6, 1, 6, 3, 15, 1, 1, 4, 0 };
+    static oid      wrongDigest[] = { 1, 3, 6, 1, 6, 3, 15, 1, 1, 5, 0 };
+    static oid      decryptionError[] =
+        { 1, 3, 6, 1, 6, 3, 15, 1, 1, 6, 0 };
+    oid            *err_var;
+    int             err_var_len;
+    int             stat_ind;
+    struct snmp_secmod_def *sptr;
+
+    switch (error) {
+    case SNMPERR_USM_UNKNOWNENGINEID:
+        stat_ind = STAT_USMSTATSUNKNOWNENGINEIDS;
+        err_var = unknownEngineID;
+        err_var_len = ERROR_STAT_LENGTH;
+        break;
+    case SNMPERR_USM_UNKNOWNSECURITYNAME:
+        stat_ind = STAT_USMSTATSUNKNOWNUSERNAMES;
+        err_var = unknownUserName;
+        err_var_len = ERROR_STAT_LENGTH;
+        break;
+    case SNMPERR_USM_UNSUPPORTEDSECURITYLEVEL:
+        stat_ind = STAT_USMSTATSUNSUPPORTEDSECLEVELS;
+        err_var = unknownSecurityLevel;
+        err_var_len = ERROR_STAT_LENGTH;
+        break;
+    case SNMPERR_USM_AUTHENTICATIONFAILURE:
+        stat_ind = STAT_USMSTATSWRONGDIGESTS;
+        err_var = wrongDigest;
+        err_var_len = ERROR_STAT_LENGTH;
+        break;
+    case SNMPERR_USM_NOTINTIMEWINDOW:
+        stat_ind = STAT_USMSTATSNOTINTIMEWINDOWS;
+        err_var = notInTimeWindow;
+        err_var_len = ERROR_STAT_LENGTH;
+        break;
+    case SNMPERR_USM_DECRYPTIONERROR:
+        stat_ind = STAT_USMSTATSDECRYPTIONERRORS;
+        err_var = decryptionError;
+        err_var_len = ERROR_STAT_LENGTH;
+        break;
+    default:
+        return SNMPERR_GENERR;
+    }
+
+    snmp_free_varbind(pdu->variables);  /* free the current varbind */
+
+    pdu->variables = NULL;
+    SNMP_FREE(pdu->securityEngineID);
+    pdu->securityEngineID =
+        snmpv3_generate_engineID(&pdu->securityEngineIDLen);
+    SNMP_FREE(pdu->contextEngineID);
+    pdu->contextEngineID =
+        snmpv3_generate_engineID(&pdu->contextEngineIDLen);
+    pdu->command = SNMP_MSG_REPORT;
+    pdu->errstat = 0;
+    pdu->errindex = 0;
+    SNMP_FREE(pdu->contextName);
+    pdu->contextName = strdup("");
+    pdu->contextNameLen = strlen(pdu->contextName);
+
+    /*
+     * reports shouldn't cache previous data. 
+     */
+    /*
+     * FIX - yes they should but USM needs to follow new EoP to determine
+     * which cached values to use 
+     */
+    if (pdu->securityStateRef) {
+        sptr = find_sec_mod(pdu->securityModel);
+        if (sptr) {
+            if (sptr->pdu_free_state_ref) {
+                (*sptr->pdu_free_state_ref) (pdu->securityStateRef);
+            } else {
+                snmp_log(LOG_ERR,
+                         "Security Model %d can't free state references\n",
+                         pdu->securityModel);
+            }
+        } else {
+            snmp_log(LOG_ERR,
+                     "Can't find security model to free ptr: %d\n",
+                     pdu->securityModel);
+        }
+        pdu->securityStateRef = NULL;
+    }
+
+    if (error == SNMPERR_USM_NOTINTIMEWINDOW) {
+        pdu->securityLevel = SNMP_SEC_LEVEL_AUTHNOPRIV;
+    } else {
+        pdu->securityLevel = SNMP_SEC_LEVEL_NOAUTH;
+    }
+
+    /*
+     * find the appropriate error counter  
+     */
+    ltmp = snmp_get_statistic(stat_ind);
+
+    /*
+     * return the appropriate error counter  
+     */
+    snmp_pdu_add_variable(pdu, err_var, err_var_len,
+                          ASN_COUNTER, (u_char *) & ltmp, sizeof(ltmp));
+
+    return SNMPERR_SUCCESS;
+}                               /* end snmpv3_make_report() */
+
+
+int
+snmpv3_get_report_type(netsnmp_pdu *pdu)
+{
+    static oid      snmpMPDStats[] = { 1, 3, 6, 1, 6, 3, 11, 2, 1 };
+    static oid      usmStats[] = { 1, 3, 6, 1, 6, 3, 15, 1, 1 };
+    netsnmp_variable_list *vp;
+    int             rpt_type = SNMPERR_UNKNOWN_REPORT;
+
+    if (pdu == NULL || pdu->variables == NULL)
+        return rpt_type;
+    vp = pdu->variables;
+    if (vp->name_length == REPORT_STATS_LEN + 2) {
+        if (memcmp(snmpMPDStats, vp->name, REPORT_STATS_LEN * sizeof(oid))
+            == 0) {
+            switch (vp->name[REPORT_STATS_LEN]) {
+            case REPORT_snmpUnknownSecurityModels_NUM:
+                rpt_type = SNMPERR_UNKNOWN_SEC_MODEL;
+                break;
+            case REPORT_snmpInvalidMsgs_NUM:
+                rpt_type = SNMPERR_INVALID_MSG;
+                break;
+            }
+        } else
+            if (memcmp(usmStats, vp->name, REPORT_STATS_LEN * sizeof(oid))
+                == 0) {
+            switch (vp->name[REPORT_STATS_LEN]) {
+            case REPORT_usmStatsUnsupportedSecLevels_NUM:
+                rpt_type = SNMPERR_UNSUPPORTED_SEC_LEVEL;
+                break;
+            case REPORT_usmStatsNotInTimeWindows_NUM:
+                rpt_type = SNMPERR_NOT_IN_TIME_WINDOW;
+                break;
+            case REPORT_usmStatsUnknownUserNames_NUM:
+                rpt_type = SNMPERR_UNKNOWN_USER_NAME;
+                break;
+            case REPORT_usmStatsUnknownEngineIDs_NUM:
+                rpt_type = SNMPERR_UNKNOWN_ENG_ID;
+                break;
+            case REPORT_usmStatsWrongDigests_NUM:
+                rpt_type = SNMPERR_AUTHENTICATION_FAILURE;
+                break;
+            case REPORT_usmStatsDecryptionErrors_NUM:
+                rpt_type = SNMPERR_DECRYPTION_ERR;
+                break;
+            }
+        }
+    }
+    DEBUGMSGTL(("report", "Report type: %d\n", rpt_type));
+    return rpt_type;
+}
+
+/*
+ * Parses the packet received on the input session, and places the data into
+ * the input pdu.  length is the length of the input packet.
+ * If any errors are encountered, -1 or USM error is returned.
+ * Otherwise, a 0 is returned.
+ */
+static int
+_snmp_parse(void *sessp,
+            netsnmp_session * session,
+            netsnmp_pdu *pdu, u_char * data, size_t length)
+{
+    u_char          community[COMMUNITY_MAX_LEN];
+    size_t          community_length = COMMUNITY_MAX_LEN;
+    int             result = -1;
+
+    session->s_snmp_errno = 0;
+    session->s_errno = 0;
+
+    /*
+     * Ensure all incoming PDUs have a unique means of identification 
+     * (This is not restricted to AgentX handling,
+     * though that is where the need becomes visible)   
+     */
+    pdu->transid = snmp_get_next_transid();
+
+    if (session->version != SNMP_DEFAULT_VERSION) {
+        pdu->version = session->version;
+    } else {
+        pdu->version = snmp_parse_version(data, length);
+    }
+
+    switch (pdu->version) {
+    case SNMP_VERSION_1:
+    case SNMP_VERSION_2c:
+        DEBUGMSGTL(("snmp_api", "Parsing SNMPv%d message...\n",
+                    (1 + pdu->version)));
+
+        /*
+         * authenticates message and returns length if valid 
+         */
+        if (pdu->version == SNMP_VERSION_1) {
+            DEBUGDUMPSECTION("recv", "SNMPv1 message\n");
+        } else {
+            DEBUGDUMPSECTION("recv", "SNMPv2c message\n");
+        }
+        data = snmp_comstr_parse(data, &length,
+                                 community, &community_length,
+                                 &pdu->version);
+        if (data == NULL)
+            return -1;
+
+        if (pdu->version != session->version &&
+            session->version != SNMP_DEFAULT_VERSION) {
+            session->s_snmp_errno = SNMPERR_BAD_VERSION;
+            return -1;
+        }
+
+        /*
+         * maybe get the community string. 
+         */
+        pdu->securityLevel = SNMP_SEC_LEVEL_NOAUTH;
+        pdu->securityModel = (pdu->version == SNMP_VERSION_1) ?
+            SNMP_SEC_MODEL_SNMPv1 : SNMP_SEC_MODEL_SNMPv2c;
+        SNMP_FREE(pdu->community);
+        pdu->community_len = 0;
+        pdu->community = (u_char *) 0;
+        if (community_length) {
+            pdu->community_len = community_length;
+            pdu->community = (u_char *) malloc(community_length);
+            if (pdu->community == NULL) {
+                session->s_snmp_errno = SNMPERR_MALLOC;
+                return -1;
+            }
+            memmove(pdu->community, community, community_length);
+        }
+        if (session->authenticator) {
+            data = session->authenticator(data, &length,
+                                          community, community_length);
+            if (data == NULL) {
+                session->s_snmp_errno = SNMPERR_AUTHENTICATION_FAILURE;
+                return -1;
+            }
+        }
+
+        DEBUGDUMPSECTION("recv", "PDU");
+        result = snmp_pdu_parse(pdu, data, &length);
+        if (result < 0) {
+            /*
+             * This indicates a parse error.  
+             */
+            snmp_increment_statistic(STAT_SNMPINASNPARSEERRS);
+        }
+        DEBUGINDENTADD(-6);
+        break;
+
+    case SNMP_VERSION_3:
+        result = snmpv3_parse(pdu, data, &length, NULL, session);
+        DEBUGMSGTL(("snmp_parse",
+                    "Parsed SNMPv3 message (secName:%s, secLevel:%s): %s\n",
+                    pdu->securityName, secLevelName[pdu->securityLevel],
+                    snmp_api_errstring(result)));
+
+        if (result) {
+            if (!sessp) {
+                session->s_snmp_errno = result;
+            } else {
+
+                /*
+                 * handle reportable errors 
+                 */
+                switch (result) {
+                case SNMPERR_USM_UNKNOWNENGINEID:
+                case SNMPERR_USM_UNKNOWNSECURITYNAME:
+                case SNMPERR_USM_UNSUPPORTEDSECURITYLEVEL:
+                case SNMPERR_USM_AUTHENTICATIONFAILURE:
+                case SNMPERR_USM_NOTINTIMEWINDOW:
+                case SNMPERR_USM_DECRYPTIONERROR:
+
+                    if (SNMP_CMD_CONFIRMED(pdu->command) ||
+                        (pdu->command == 0
+                         && (pdu->flags & SNMP_MSG_FLAG_RPRT_BIT))) {
+                        netsnmp_pdu    *pdu2;
+                        int             flags = pdu->flags;
+
+                        pdu->flags |= UCD_MSG_FLAG_FORCE_PDU_COPY;
+                        pdu2 = snmp_clone_pdu(pdu);
+                        pdu->flags = pdu2->flags = flags;
+                        snmpv3_make_report(pdu2, result);
+                        if (0 == snmp_sess_send(sessp, pdu2)) {
+                            snmp_free_pdu(pdu2);
+                            /*
+                             * TODO: indicate error 
+                             */
+                        }
+                    }
+                    break;
+                default:
+                    session->s_snmp_errno = result;
+                    break;
+                }
+            }
+        }
+        break;
+    case SNMPERR_BAD_VERSION:
+        ERROR_MSG("error parsing snmp message version");
+        snmp_increment_statistic(STAT_SNMPINASNPARSEERRS);
+        session->s_snmp_errno = SNMPERR_BAD_VERSION;
+        break;
+    case SNMP_VERSION_sec:
+    case SNMP_VERSION_2u:
+    case SNMP_VERSION_2star:
+    case SNMP_VERSION_2p:
+    default:
+        ERROR_MSG("unsupported snmp message version");
+        snmp_increment_statistic(STAT_SNMPINBADVERSIONS);
+        session->s_snmp_errno = SNMPERR_BAD_VERSION;
+        break;
+    }
+
+    return result;
+}
+
+static int
+snmp_parse(void *sessp,
+           netsnmp_session * pss,
+           netsnmp_pdu *pdu, u_char * data, size_t length)
+{
+    int             rc;
+
+    rc = _snmp_parse(sessp, pss, pdu, data, length);
+    if (rc) {
+        if (!pss->s_snmp_errno) {
+            pss->s_snmp_errno = SNMPERR_BAD_PARSE;
+        }
+        SET_SNMP_ERROR(pss->s_snmp_errno);
+    }
+
+    return rc;
+}
+
+int
+snmp_pdu_parse(netsnmp_pdu *pdu, u_char * data, size_t * length)
+{
+    u_char          type;
+    u_char          msg_type;
+    u_char         *var_val;
+    int             badtype = 0;
+    size_t          len;
+    size_t          four;
+    netsnmp_variable_list *vp = NULL;
+    oid             objid[MAX_OID_LEN];
+
+    /*
+     * Get the PDU type 
+     */
+    data = asn_parse_header(data, length, &msg_type);
+    if (data == NULL)
+        return -1;
+    pdu->command = msg_type;
+    pdu->flags &= (~UCD_MSG_FLAG_RESPONSE_PDU);
+
+    /*
+     * get the fields in the PDU preceeding the variable-bindings sequence 
+     */
+    switch (pdu->command) {
+    case SNMP_MSG_TRAP:
+        /*
+         * enterprise 
+         */
+        pdu->enterprise_length = MAX_OID_LEN;
+        data = asn_parse_objid(data, length, &type, objid,
+                               &pdu->enterprise_length);
+        if (data == NULL)
+            return -1;
+        pdu->enterprise =
+            (oid *) malloc(pdu->enterprise_length * sizeof(oid));
+        if (pdu->enterprise == NULL) {
+            return -1;
+        }
+        memmove(pdu->enterprise, objid,
+                pdu->enterprise_length * sizeof(oid));
+
+        /*
+         * agent-addr 
+         */
+        four = 4;
+        data = asn_parse_string(data, length, &type,
+                                (u_char *) pdu->agent_addr, &four);
+        if (data == NULL)
+            return -1;
+
+        /*
+         * generic trap 
+         */
+        data = asn_parse_int(data, length, &type, (long *) &pdu->trap_type,
+                             sizeof(pdu->trap_type));
+        if (data == NULL)
+            return -1;
+        /*
+         * specific trap 
+         */
+        data =
+            asn_parse_int(data, length, &type,
+                          (long *) &pdu->specific_type,
+                          sizeof(pdu->specific_type));
+        if (data == NULL)
+            return -1;
+
+        /*
+         * timestamp  
+         */
+        data = asn_parse_unsigned_int(data, length, &type, &pdu->time,
+                                      sizeof(pdu->time));
+        if (data == NULL)
+            return -1;
+
+        break;
+
+    case SNMP_MSG_RESPONSE:
+    case SNMP_MSG_REPORT:
+        pdu->flags |= UCD_MSG_FLAG_RESPONSE_PDU;
+        /*
+         * fallthrough 
+         */
+
+    default:
+        /*
+         * PDU is not an SNMPv1 TRAP 
+         */
+
+        /*
+         * request id 
+         */
+        DEBUGDUMPHEADER("recv", "request_id");
+        data = asn_parse_int(data, length, &type, &pdu->reqid,
+                             sizeof(pdu->reqid));
+        DEBUGINDENTLESS();
+        if (data == NULL) {
+            return -1;
+        }
+
+        /*
+         * error status (getbulk non-repeaters) 
+         */
+        DEBUGDUMPHEADER("recv", "error status");
+        data = asn_parse_int(data, length, &type, &pdu->errstat,
+                             sizeof(pdu->errstat));
+        DEBUGINDENTLESS();
+        if (data == NULL) {
+            return -1;
+        }
+
+        /*
+         * error index (getbulk max-repetitions) 
+         */
+        DEBUGDUMPHEADER("recv", "error index");
+        data = asn_parse_int(data, length, &type, &pdu->errindex,
+                             sizeof(pdu->errindex));
+        DEBUGINDENTLESS();
+        if (data == NULL) {
+            return -1;
+        }
+    }
+
+    /*
+     * get header for variable-bindings sequence 
+     */
+    DEBUGDUMPSECTION("recv", "VarBindList");
+    data = asn_parse_sequence(data, length, &type,
+                              (ASN_SEQUENCE | ASN_CONSTRUCTOR),
+                              "varbinds");
+    if (data == NULL)
+        return -1;
+
+    /*
+     * get each varBind sequence 
+     */
+    while ((int) *length > 0) {
+        netsnmp_variable_list *vptemp;
+        vptemp = (netsnmp_variable_list *) malloc(sizeof(*vptemp));
+        if (0 == vptemp) {
+            return -1;
+        }
+        if (0 == vp) {
+            pdu->variables = vptemp;
+        } else {
+            vp->next_variable = vptemp;
+        }
+        vp = vptemp;
+
+        vp->next_variable = NULL;
+        vp->val.string = NULL;
+        vp->name_length = MAX_OID_LEN;
+        vp->name = 0;
+        vp->index = 0;
+        vp->data = 0;
+        vp->dataFreeHook = 0;
+        DEBUGDUMPSECTION("recv", "VarBind");
+        data = snmp_parse_var_op(data, objid, &vp->name_length, &vp->type,
+                                 &vp->val_len, &var_val, length);
+        if (data == NULL)
+            return -1;
+        if (snmp_set_var_objid(vp, objid, vp->name_length))
+            return -1;
+
+        len = MAX_PACKET_LENGTH;
+        DEBUGDUMPHEADER("recv", "Value");
+        switch ((short) vp->type) {
+        case ASN_INTEGER:
+            vp->val.integer = (long *) vp->buf;
+            vp->val_len = sizeof(long);
+            asn_parse_int(var_val, &len, &vp->type,
+                          (long *) vp->val.integer,
+                          sizeof(vp->val.integer));
+            break;
+        case ASN_COUNTER:
+        case ASN_GAUGE:
+        case ASN_TIMETICKS:
+        case ASN_UINTEGER:
+            vp->val.integer = (long *) vp->buf;
+            vp->val_len = sizeof(u_long);
+            asn_parse_unsigned_int(var_val, &len, &vp->type,
+                                   (u_long *) vp->val.integer,
+                                   vp->val_len);
+            break;
+#ifdef OPAQUE_SPECIAL_TYPES
+        case ASN_OPAQUE_COUNTER64:
+        case ASN_OPAQUE_U64:
+#endif                          /* OPAQUE_SPECIAL_TYPES */
+        case ASN_COUNTER64:
+            vp->val.counter64 = (struct counter64 *) vp->buf;
+            vp->val_len = sizeof(struct counter64);
+            asn_parse_unsigned_int64(var_val, &len, &vp->type,
+                                     (struct counter64 *) vp->val.
+                                     counter64, vp->val_len);
+            break;
+#ifdef OPAQUE_SPECIAL_TYPES
+        case ASN_OPAQUE_FLOAT:
+            vp->val.floatVal = (float *) vp->buf;
+            vp->val_len = sizeof(float);
+            asn_parse_float(var_val, &len, &vp->type,
+                            vp->val.floatVal, vp->val_len);
+            break;
+        case ASN_OPAQUE_DOUBLE:
+            vp->val.doubleVal = (double *) vp->buf;
+            vp->val_len = sizeof(double);
+            asn_parse_double(var_val, &len, &vp->type,
+                             vp->val.doubleVal, vp->val_len);
+            break;
+        case ASN_OPAQUE_I64:
+            vp->val.counter64 = (struct counter64 *) vp->buf;
+            vp->val_len = sizeof(struct counter64);
+            asn_parse_signed_int64(var_val, &len, &vp->type,
+                                   (struct counter64 *) vp->val.counter64,
+                                   sizeof(*vp->val.counter64));
+
+            break;
+#endif                          /* OPAQUE_SPECIAL_TYPES */
+        case ASN_OCTET_STR:
+        case ASN_IPADDRESS:
+        case ASN_OPAQUE:
+        case ASN_NSAP:
+            if (vp->val_len < sizeof(vp->buf)) {
+                vp->val.string = (u_char *) vp->buf;
+            } else {
+                vp->val.string = (u_char *) malloc(vp->val_len);
+            }
+            if (vp->val.string == NULL) {
+                return -1;
+            }
+            asn_parse_string(var_val, &len, &vp->type, vp->val.string,
+                             &vp->val_len);
+            break;
+        case ASN_OBJECT_ID:
+            vp->val_len = MAX_OID_LEN;
+            asn_parse_objid(var_val, &len, &vp->type, objid, &vp->val_len);
+            vp->val_len *= sizeof(oid);
+            vp->val.objid = (oid *) malloc(vp->val_len);
+            if (vp->val.objid == NULL) {
+                return -1;
+            }
+            memmove(vp->val.objid, objid, vp->val_len);
+            break;
+        case SNMP_NOSUCHOBJECT:
+        case SNMP_NOSUCHINSTANCE:
+        case SNMP_ENDOFMIBVIEW:
+        case ASN_NULL:
+            break;
+        case ASN_BIT_STR:
+            vp->val.bitstring = (u_char *) malloc(vp->val_len);
+            if (vp->val.bitstring == NULL) {
+                return -1;
+            }
+            asn_parse_bitstring(var_val, &len, &vp->type,
+                                vp->val.bitstring, &vp->val_len);
+            break;
+        default:
+            snmp_log(LOG_ERR, "bad type returned (%x)\n", vp->type);
+            badtype = -1;
+            break;
+        }
+        DEBUGINDENTADD(-4);
+    }
+    return badtype;
+}
+
+/*
+ * snmp v3 utility function to parse into the scopedPdu. stores contextName
+ * and contextEngineID in pdu struct. Also stores pdu->command (handy for 
+ * Report generation).
+ * 
+ * returns pointer to begining of PDU or NULL on error.
+ */
+u_char         *
+snmpv3_scopedPDU_parse(netsnmp_pdu *pdu, u_char * cp, size_t * length)
+{
+    u_char          tmp_buf[SNMP_MAX_MSG_SIZE];
+    size_t          tmp_buf_len;
+    u_char          type;
+    size_t          asn_len;
+    u_char         *data;
+
+    pdu->command = 0;           /* initialize so we know if it got parsed */
+    asn_len = *length;
+    data = asn_parse_sequence(cp, &asn_len, &type,
+                              (ASN_SEQUENCE | ASN_CONSTRUCTOR),
+                              "plaintext scopedPDU");
+    if (data == NULL) {
+        return NULL;
+    }
+    *length -= data - cp;
+
+    /*
+     * contextEngineID from scopedPdu  
+     */
+    DEBUGDUMPHEADER("recv", "contextEngineID");
+    data = asn_parse_string(data, length, &type, pdu->contextEngineID,
+                            &pdu->contextEngineIDLen);
+    DEBUGINDENTLESS();
+    if (data == NULL) {
+        ERROR_MSG("error parsing contextEngineID from scopedPdu");
+        return NULL;
+    }
+
+    /*
+     * check that it agrees with engineID returned from USM above
+     * * only a warning because this could be legal if we are a proxy
+     */
+    if (pdu->securityEngineIDLen != pdu->contextEngineIDLen ||
+        memcmp(pdu->securityEngineID, pdu->contextEngineID,
+               pdu->securityEngineIDLen) != 0) {
+        DEBUGMSGTL(("scopedPDU_parse",
+                    "inconsistent engineID information in message\n"));
+    }
+
+    /*
+     * parse contextName from scopedPdu
+     */
+    tmp_buf_len = SNMP_MAX_CONTEXT_SIZE;
+    DEBUGDUMPHEADER("recv", "contextName");
+    data = asn_parse_string(data, length, &type, tmp_buf, &tmp_buf_len);
+    DEBUGINDENTLESS();
+    if (data == NULL) {
+        ERROR_MSG("error parsing contextName from scopedPdu");
+        return NULL;
+    }
+
+    if (tmp_buf_len) {
+        pdu->contextName = (char *) malloc(tmp_buf_len);
+        memmove(pdu->contextName, tmp_buf, tmp_buf_len);
+        pdu->contextNameLen = tmp_buf_len;
+    } else {
+        pdu->contextName = strdup("");
+        pdu->contextNameLen = 0;
+    }
+    if (pdu->contextName == NULL) {
+        ERROR_MSG("error copying contextName from scopedPdu");
+        return NULL;
+    }
+
+    /*
+     * Get the PDU type 
+     */
+    asn_len = *length;
+    cp = asn_parse_header(data, &asn_len, &type);
+    if (cp == NULL)
+        return NULL;
+
+    pdu->command = type;
+
+    return data;
+}
+
+/*
+ * These functions send PDUs using an active session:
+ * snmp_send             - traditional API, no callback
+ * snmp_async_send       - traditional API, with callback
+ * snmp_sess_send        - single session API, no callback
+ * snmp_sess_async_send  - single session API, with callback
+ *
+ * Call snmp_build to create a serialized packet (the pdu).
+ * If necessary, set some of the pdu data from the
+ * session defaults.
+ * If there is an expected response for this PDU,
+ * queue a corresponding request on the list
+ * of outstanding requests for this session,
+ * and store the callback vectors in the request.
+ *
+ * Send the pdu to the target identified by this session.
+ * Return on success:
+ *   The request id of the pdu is returned, and the pdu is freed.
+ * Return on failure:
+ *   Zero (0) is returned.
+ *   The caller must call snmp_free_pdu if 0 is returned.
+ */
+int
+snmp_send(netsnmp_session * session, netsnmp_pdu *pdu)
+{
+    return snmp_async_send(session, pdu, NULL, NULL);
+}
+
+int
+snmp_sess_send(void *sessp, netsnmp_pdu *pdu)
+{
+    return snmp_sess_async_send(sessp, pdu, NULL, NULL);
+}
+
+int
+snmp_async_send(netsnmp_session * session,
+                netsnmp_pdu *pdu, snmp_callback callback, void *cb_data)
+{
+    void           *sessp = snmp_sess_pointer(session);
+    return snmp_sess_async_send(sessp, pdu, callback, cb_data);
+}
+
+static int
+_sess_async_send(void *sessp,
+                 netsnmp_pdu *pdu, snmp_callback callback, void *cb_data)
+{
+    struct session_list *slp = (struct session_list *) sessp;
+    netsnmp_session *session;
+    struct snmp_internal_session *isp;
+    netsnmp_transport *transport = NULL;
+    u_char         *pktbuf = NULL, *packet = NULL;
+    size_t          pktbuf_len = 0, offset = 0, length = 0;
+    int             result;
+    long            reqid;
+
+    if (slp == NULL) {
+        return 0;
+    } else {
+        session = slp->session;
+        isp = slp->internal;
+        transport = slp->transport;
+        if (!session || !isp || !transport) {
+            DEBUGMSGTL(("sess_async_send", "send fail: closing...\n"));
+            return 0;
+        }
+    }
+
+    if (pdu == NULL) {
+        session->s_snmp_errno = SNMPERR_NULL_PDU;
+        return 0;
+    }
+
+    if ((pktbuf = malloc(2048)) == NULL) {
+        DEBUGMSGTL(("sess_async_send",
+                    "couldn't malloc initial packet buffer\n"));
+        session->s_snmp_errno = SNMPERR_MALLOC;
+        return 0;
+    } else {
+        pktbuf_len = 2048;
+    }
+
+    session->s_snmp_errno = 0;
+    session->s_errno = 0;
+
+#if TEMPORARILY_DISABLED
+    /*
+     *  NULL variable are allowed in certain PDU types.
+     *  In particular, SNMPv3 engineID probes are of this form.
+     *  There is an internal PDU flag to indicate that this
+     *    is acceptable, but until the construction of engineID
+     *    probes can be amended to set this flag, we'll simply
+     *    skip this test altogether.
+     */
+    if (pdu->variables == NULL) {
+        switch (pdu->command) {
+        case SNMP_MSG_GET:
+        case SNMP_MSG_SET:
+        case SNMP_MSG_GETNEXT:
+        case SNMP_MSG_GETBULK:
+        case SNMP_MSG_RESPONSE:
+        case SNMP_MSG_TRAP2:
+        case SNMP_MSG_REPORT:
+        case SNMP_MSG_INFORM:
+            session->s_snmp_errno = snmp_errno = SNMPERR_NO_VARS;
+            return 0;
+        case SNMP_MSG_TRAP:
+            break;
+        }
+    }
+#endif
+
+    pdu->flags |= UCD_MSG_FLAG_EXPECT_RESPONSE;
+
+    /*
+     * Check/setup the version.  
+     */
+
+    if (pdu->version == SNMP_DEFAULT_VERSION) {
+        if (session->version == SNMP_DEFAULT_VERSION) {
+            session->s_snmp_errno = SNMPERR_BAD_VERSION;
+            free(pktbuf);
+            return 0;
+        }
+        pdu->version = session->version;
+    } else if (session->version == SNMP_DEFAULT_VERSION) {
+        /*
+         * It's OK  
+         */
+    } else if (pdu->version != session->version) {
+        /*
+         * ENHANCE: we should support multi-lingual sessions  
+         */
+        session->s_snmp_errno = SNMPERR_BAD_VERSION;
+        free(pktbuf);
+        return 0;
+    }
+
+    /*
+     * Build the message to send.  
+     */
+    if (isp->hook_realloc_build) {
+        result = isp->hook_realloc_build(session, pdu,
+                                         &pktbuf, &pktbuf_len, &offset);
+        packet = pktbuf;
+        length = offset;
+    } else if (isp->hook_build) {
+        packet = pktbuf;
+        length = pktbuf_len;
+        result = isp->hook_build(session, pdu, pktbuf, &length);
+    } else {
+#ifdef USE_REVERSE_ASNENCODING
+        if (netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_REVERSE_ENCODE)) {
+            result =
+                snmp_build(&pktbuf, &pktbuf_len, &offset, session, pdu);
+            packet = pktbuf + pktbuf_len - offset;
+            length = offset;
+        } else {
+#endif
+            packet = pktbuf;
+            length = pktbuf_len;
+            result = snmp_build(&pktbuf, &length, &offset, session, pdu);
+#ifdef USE_REVERSE_ASNENCODING
+        }
+#endif
+    }
+
+    if (result < 0) {
+        DEBUGMSGTL(("sess_async_send", "encoding failure\n"));
+        free(pktbuf);
+        return 0;
+    }
+
+    /*
+     * Make sure we don't send something that is bigger than the msgMaxSize
+     * specified in the received PDU.  
+     */
+
+    if (session->sndMsgMaxSize != 0 && length > session->sndMsgMaxSize) {
+        DEBUGMSGTL(("sess_async_send",
+                    "length of packet (%lu) exceeds session maximum (%lu)\n",
+                    length, session->sndMsgMaxSize));
+        session->s_snmp_errno = SNMPERR_TOO_LONG;
+        free(pktbuf);
+        return 0;
+    }
+
+    /*
+     * Check that the underlying transport is capable of sending a packet as
+     * large as length.  
+     */
+
+    if (transport->msgMaxSize != 0 && length > transport->msgMaxSize) {
+        DEBUGMSGTL(("sess_async_send",
+                    "length of packet (%lu) exceeds transport maximum (%lu)\n",
+                    length, transport->msgMaxSize));
+        session->s_snmp_errno = SNMPERR_TOO_LONG;
+        free(pktbuf);
+        return 0;
+    }
+
+    if (netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_DUMP_PACKET)) {
+        if (transport->f_fmtaddr != NULL) {
+            char           *dest_txt =
+                transport->f_fmtaddr(transport, pdu->transport_data,
+                                     pdu->transport_data_length);
+            if (dest_txt != NULL) {
+                snmp_log(LOG_DEBUG, "\nSending %u bytes to %s\n", length,
+                         dest_txt);
+                free(dest_txt);
+            } else {
+                snmp_log(LOG_DEBUG, "\nSending %u bytes to <UNKNOWN>\n",
+                         length);
+            }
+        }
+        xdump(packet, length, "");
+    }
+
+    /*
+     * Send the message.  
+     */
+
+    result = transport->f_send(transport, packet, length,
+                               &(pdu->transport_data),
+                               &(pdu->transport_data_length));
+
+    free(pktbuf);
+
+    if (result < 0) {
+        session->s_snmp_errno = SNMPERR_BAD_SENDTO;
+        session->s_errno = errno;
+        return 0;
+    }
+
+    reqid = pdu->reqid;
+
+    /*
+     * Add to pending requests list if we expect a response.  
+     */
+    if (pdu->flags & UCD_MSG_FLAG_EXPECT_RESPONSE) {
+        netsnmp_request_list *rp;
+        struct timeval  tv;
+
+        rp = (netsnmp_request_list *) calloc(1,
+                                             sizeof(netsnmp_request_list));
+        if (rp == NULL) {
+            session->s_snmp_errno = SNMPERR_GENERR;
+            return 0;
+        }
+
+        gettimeofday(&tv, (struct timezone *) 0);
+        rp->pdu = pdu;
+        rp->request_id = pdu->reqid;
+        rp->message_id = pdu->msgid;
+        rp->callback = callback;
+        rp->cb_data = cb_data;
+        rp->retries = 0;
+        if (pdu->flags & UCD_MSG_FLAG_PDU_TIMEOUT) {
+            rp->timeout = pdu->time * 1000000L;
+        } else {
+            rp->timeout = session->timeout;
+        }
+        rp->time = tv;
+        tv.tv_usec += rp->timeout;
+        tv.tv_sec += tv.tv_usec / 1000000L;
+        tv.tv_usec %= 1000000L;
+        rp->expire = tv;
+
+        /*
+         * XX lock should be per session ! 
+         */
+        snmp_res_lock(MT_LIBRARY_ID, MT_LIB_SESSION);
+        if (isp->requestsEnd) {
+            rp->next_request = isp->requestsEnd->next_request;
+            isp->requestsEnd->next_request = rp;
+            isp->requestsEnd = rp;
+        } else {
+            rp->next_request = isp->requests;
+            isp->requests = rp;
+            isp->requestsEnd = rp;
+        }
+        snmp_res_unlock(MT_LIBRARY_ID, MT_LIB_SESSION);
+    } else {
+        /*
+         * No response expected...  
+         */
+        if (reqid) {
+            /*
+             * Free v1 or v2 TRAP PDU iff no error  
+             */
+            snmp_free_pdu(pdu);
+        }
+    }
+
+    return reqid;
+}
+
+int
+snmp_sess_async_send(void *sessp,
+                     netsnmp_pdu *pdu,
+                     snmp_callback callback, void *cb_data)
+{
+    int             rc;
+
+    if (sessp == NULL) {
+        snmp_errno = SNMPERR_BAD_SESSION;       /*MTCRITICAL_RESOURCE */
+        return (0);
+    }
+    rc = _sess_async_send(sessp, pdu, callback, cb_data);
+    if (rc == 0) {
+        struct session_list *psl;
+        netsnmp_session *pss;
+        psl = (struct session_list *) sessp;
+        pss = psl->session;
+        SET_SNMP_ERROR(pss->s_snmp_errno);
+    }
+    return rc;
+}
+
+
+/*
+ * Frees the variable and any malloc'd data associated with it.
+ */
+void
+snmp_free_var(netsnmp_variable_list * var)
+{
+    if (!var)
+        return;
+
+    if (var->name != var->name_loc)
+        SNMP_FREE(var->name);
+    if (var->val.string != var->buf)
+        SNMP_FREE(var->val.string);
+    if (var->data) {
+        if (var->dataFreeHook) {
+            var->dataFreeHook(var->data);
+            var->data = NULL;
+        } else {
+            SNMP_FREE(var->data);
+        }
+    }
+
+    free((char *) var);
+}
+
+void
+snmp_free_varbind(netsnmp_variable_list * var)
+{
+    netsnmp_variable_list *ptr;
+    while (var) {
+        ptr = var->next_variable;
+        snmp_free_var(var);
+        var = ptr;
+    }
+}
+
+/*
+ * Frees the pdu and any malloc'd data associated with it.
+ */
+void
+snmp_free_pdu(netsnmp_pdu *pdu)
+{
+    struct snmp_secmod_def *sptr;
+
+    if (!pdu)
+        return;
+
+    if ((sptr = find_sec_mod(pdu->securityModel)) != NULL &&
+        sptr->pdu_free != NULL) {
+        (*sptr->pdu_free) (pdu);
+    }
+    snmp_free_varbind(pdu->variables);
+    SNMP_FREE(pdu->enterprise);
+    SNMP_FREE(pdu->community);
+    SNMP_FREE(pdu->contextEngineID);
+    SNMP_FREE(pdu->securityEngineID);
+    SNMP_FREE(pdu->contextName);
+    SNMP_FREE(pdu->securityName);
+    SNMP_FREE(pdu->transport_data);
+    free((char *) pdu);
+}
+
+netsnmp_pdu    *
+snmp_create_sess_pdu(netsnmp_transport *transport, void *opaque,
+                     size_t olength)
+{
+    netsnmp_pdu *pdu = (netsnmp_pdu *)calloc(1, sizeof(netsnmp_pdu));
+    if (pdu == NULL) {
+        DEBUGMSGTL(("sess_process_packet", "can't malloc space for PDU\n"));
+        return NULL;
+    }
+
+    /*
+     * Save the transport-level data specific to this reception (e.g. UDP
+     * source address).  
+     */
+
+    pdu->transport_data = opaque;
+    pdu->transport_data_length = olength;
+    pdu->tDomain = transport->domain;
+    pdu->tDomainLen = transport->domain_length;
+    return pdu;
+}
+
+
+/*
+ * This function processes a complete (according to asn_check_packet or the
+ * AgentX equivalent) packet, parsing it into a PDU and calling the relevant
+ * callbacks.  On entry, packetptr points at the packet in the session's
+ * buffer and length is the length of the packet.  
+ */
+
+static int
+_sess_process_packet(void *sessp, netsnmp_session * sp,
+                     struct snmp_internal_session *isp,
+                     netsnmp_transport *transport,
+                     void *opaque, int olength,
+                     u_char * packetptr, int length)
+{
+  struct session_list *slp = (struct session_list *) sessp;
+  netsnmp_pdu    *pdu;
+  netsnmp_request_list *rp, *orp = NULL;
+  struct snmp_secmod_def *sptr;
+  int             ret = 0, handled = 0;
+
+  DEBUGMSGTL(("sess_process_packet",
+	      "session %p fd %d pkt %p length %d\n", sessp,
+	      transport->sock, packetptr, length));
+
+  if (netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, 
+			     NETSNMP_DS_LIB_DUMP_PACKET)) {
+    if (transport->f_fmtaddr != NULL) {
+      char *addrtxt = transport->f_fmtaddr(transport, opaque, olength);
+      if (addrtxt != NULL) {
+	snmp_log(LOG_DEBUG, "\nReceived %d bytes from %s\n",
+		 length, addrtxt);
+	free(addrtxt);
+      } else {
+	snmp_log(LOG_DEBUG, "\nReceived %d bytes from <UNKNOWN>\n",
+		 length);
+      }
+    }
+    xdump(packetptr, length, "");
+  }
+
+  /*
+   * Do transport-level filtering (e.g. IP-address based allow/deny).  
+   */
+
+  if (isp->hook_pre) {
+    if (isp->hook_pre(sp, transport, opaque, olength) == 0) {
+      DEBUGMSGTL(("sess_process_packet", "pre-parse fail\n"));
+      if (opaque != NULL) {
+	free(opaque);
+      }
+      return -1;
+    }
+  }
+
+  if (isp->hook_create_pdu) {
+    pdu = isp->hook_create_pdu(transport, opaque, olength);
+  } else {
+    pdu = snmp_create_sess_pdu(transport, opaque, olength);
+  }
+  if (pdu == NULL) {
+    snmp_log(LOG_ERR, "pdu failed to be created\n");
+    if (opaque != NULL) {
+      free(opaque);
+    }
+    return -1;
+  }
+
+  if (isp->hook_parse) {
+    ret = isp->hook_parse(sp, pdu, packetptr, length);
+  } else {
+    ret = snmp_parse(sessp, sp, pdu, packetptr, length);
+  }
+
+  if (ret != SNMP_ERR_NOERROR) {
+    DEBUGMSGTL(("sess_process_packet", "parse fail\n"));
+  }
+
+  if (isp->hook_post) {
+    if (isp->hook_post(sp, pdu, ret) == 0) {
+      DEBUGMSGTL(("sess_process_packet", "post-parse fail\n"));
+      ret = SNMPERR_ASN_PARSE_ERR;
+    }
+  }
+
+  if (ret != SNMP_ERR_NOERROR) {
+    /*
+     * Call USM to free any securityStateRef supplied with the message.  
+     */
+    if (pdu->securityStateRef != NULL) {
+      sptr = find_sec_mod(pdu->securityModel);
+      if (sptr != NULL) {
+	if (sptr->pdu_free_state_ref != NULL) {
+	  (*sptr->pdu_free_state_ref) (pdu->securityStateRef);
+	} else {
+	  snmp_log(LOG_ERR,
+		   "Security Model %d can't free state references\n",
+		   pdu->securityModel);
+	}
+      } else {
+	snmp_log(LOG_ERR,
+		 "Can't find security model to free ptr: %d\n",
+		 pdu->securityModel);
+      }
+      pdu->securityStateRef = NULL;
+    }
+    snmp_free_pdu(pdu);
+    return -1;
+  }
+
+  if (pdu->flags & UCD_MSG_FLAG_RESPONSE_PDU) {
+    /*
+     * Call USM to free any securityStateRef supplied with the message.  
+     */
+    if (pdu->securityStateRef) {
+      sptr = find_sec_mod(pdu->securityModel);
+      if (sptr) {
+	if (sptr->pdu_free_state_ref) {
+	  (*sptr->pdu_free_state_ref) (pdu->securityStateRef);
+	} else {
+	  snmp_log(LOG_ERR,
+		   "Security Model %d can't free state references\n",
+		   pdu->securityModel);
+	}
+      } else {
+	snmp_log(LOG_ERR,
+		 "Can't find security model to free ptr: %d\n",
+		 pdu->securityModel);
+      }
+      pdu->securityStateRef = NULL;
+    }
+
+    for (rp = isp->requests; rp; orp = rp, rp = rp->next_request) {
+      snmp_callback   callback;
+      void           *magic;
+
+      if (pdu->version == SNMP_VERSION_3) {
+	/*
+	 * msgId must match for v3 messages.  
+	 */
+	if (rp->message_id != pdu->msgid) {
+	  continue;
+	}
+
+	/*
+	 * Check that message fields match original, if not, no further
+	 * processing.  
+	 */
+	if (!snmpv3_verify_msg(rp, pdu)) {
+	  break;
+	}
+      } else {
+	if (rp->request_id != pdu->reqid) {
+	  continue;
+	}
+      }
+
+      if (rp->callback) {
+	callback = rp->callback;
+	magic = rp->cb_data;
+      } else {
+	callback = sp->callback;
+	magic = sp->callback_magic;
+      }
+      handled = 1;
+
+      /*
+       * MTR snmp_res_lock(MT_LIBRARY_ID, MT_LIB_SESSION);  ?* XX lock
+       * should be per session ! 
+       */
+
+      if (callback == NULL
+	  || callback(NETSNMP_CALLBACK_OP_RECEIVED_MESSAGE, sp,
+		      pdu->reqid, pdu, magic) == 1) {
+	if (pdu->command == SNMP_MSG_REPORT) {
+	  if (sp->s_snmp_errno == SNMPERR_NOT_IN_TIME_WINDOW ||
+	      snmpv3_get_report_type(pdu) ==
+	      SNMPERR_NOT_IN_TIME_WINDOW) {
+	    /*
+	     * trigger immediate retry on recoverable Reports 
+	     * * (notInTimeWindow), incr_retries == TRUE to prevent
+	     * * inifinite resend                      
+	     */
+	    if (rp->retries <= sp->retries) {
+	      snmp_resend_request(slp, rp, TRUE);
+	      break;
+	    }
+	  } else {
+	    if (SNMPV3_IGNORE_UNAUTH_REPORTS) {
+	      break;
+	    }
+	  }
+
+	  /*
+	   * Handle engineID discovery.  
+	   */
+	  if (!sp->securityEngineIDLen && pdu->securityEngineIDLen) {
+	    sp->securityEngineID =
+	      (u_char *) malloc(pdu->securityEngineIDLen);
+	    if (sp->securityEngineID == NULL) {
+	      /*
+	       * TODO FIX: recover after message callback *?
+	       * return -1;
+	       */
+	    }
+	    memcpy(sp->securityEngineID, pdu->securityEngineID,
+		   pdu->securityEngineIDLen);
+	    sp->securityEngineIDLen = pdu->securityEngineIDLen;
+	    if (!sp->contextEngineIDLen) {
+	      sp->contextEngineID =
+		(u_char *) malloc(pdu->
+				  securityEngineIDLen);
+	      if (sp->contextEngineID == NULL) {
+		/*
+		 * TODO FIX: recover after message callback *?
+		 * return -1;
+		 */
+	      }
+	      memcpy(sp->contextEngineID,
+		     pdu->securityEngineID,
+		     pdu->securityEngineIDLen);
+	      sp->contextEngineIDLen =
+		pdu->securityEngineIDLen;
+	    }
+	  }
+	}
+
+	/*
+	 * Successful, so delete request.  
+	 */
+	if (isp->requests == rp) {
+	  isp->requests = rp->next_request;
+	  if (isp->requestsEnd == rp) {
+	    isp->requestsEnd = NULL;
+	  }
+	} else {
+	  orp->next_request = rp->next_request;
+	  if (isp->requestsEnd == rp) {
+	    isp->requestsEnd = orp;
+	  }
+	}
+	snmp_free_pdu(rp->pdu);
+	free((char *) rp);
+	/*
+	 * There shouldn't be any more requests with the same reqid.  
+	 */
+	break;
+      }
+      /*
+       * MTR snmp_res_unlock(MT_LIBRARY_ID, MT_LIB_SESSION);  ?* XX lock should be per session ! 
+       */
+    }
+  } else {
+    if (sp->callback) {
+      /*
+       * MTR snmp_res_lock(MT_LIBRARY_ID, MT_LIB_SESSION); 
+       */
+      handled = 1;
+      sp->callback(NETSNMP_CALLBACK_OP_RECEIVED_MESSAGE,
+		   sp, pdu->reqid, pdu, sp->callback_magic);
+      /*
+       * MTR snmp_res_unlock(MT_LIBRARY_ID, MT_LIB_SESSION); 
+       */
+    }
+  }
+
+  /*
+   * Call USM to free any securityStateRef supplied with the message.  
+   */
+  if (pdu != NULL && pdu->securityStateRef &&
+      pdu->command == SNMP_MSG_TRAP2) {
+    sptr = find_sec_mod(pdu->securityModel);
+    if (sptr) {
+      if (sptr->pdu_free_state_ref) {
+	(*sptr->pdu_free_state_ref) (pdu->securityStateRef);
+      } else {
+	snmp_log(LOG_ERR,
+		 "Security Model %d can't free state references\n",
+		 pdu->securityModel);
+      }
+    } else {
+      snmp_log(LOG_ERR,
+	       "Can't find security model to free ptr: %d\n",
+	       pdu->securityModel);
+    }
+    pdu->securityStateRef = NULL;
+  }
+
+  if (!handled) {
+    snmp_increment_statistic(STAT_SNMPUNKNOWNPDUHANDLERS);
+    DEBUGMSGTL(("sess_process_packet", "unhandled PDU\n"));
+  }
+
+  snmp_free_pdu(pdu);
+  return 0;
+}
+
+/*
+ * Checks to see if any of the fd's set in the fdset belong to
+ * snmp.  Each socket with it's fd set has a packet read from it
+ * and snmp_parse is called on the packet received.  The resulting pdu
+ * is passed to the callback routine for that session.  If the callback
+ * routine returns successfully, the pdu and it's request are deleted.
+ */
+void
+snmp_read(fd_set * fdset)
+{
+    struct session_list *slp;
+    snmp_res_lock(MT_LIBRARY_ID, MT_LIB_SESSION);
+    for (slp = Sessions; slp; slp = slp->next) {
+        snmp_sess_read((void *) slp, fdset);
+    }
+    snmp_res_unlock(MT_LIBRARY_ID, MT_LIB_SESSION);
+}
+
+/*
+ * Same as snmp_read, but works just one session. 
+ * returns 0 if success, -1 if fail 
+ * MTR: can't lock here and at snmp_read 
+ * Beware recursive send maybe inside snmp_read callback function. 
+ */
+int
+_sess_read(void *sessp, fd_set * fdset)
+{
+    struct session_list *slp = (struct session_list *) sessp;
+    netsnmp_session *sp = slp ? slp->session : NULL;
+    struct snmp_internal_session *isp = slp ? slp->internal : NULL;
+    netsnmp_transport *transport = slp ? slp->transport : NULL;
+    size_t          pdulen = 0, rxbuf_len = 65536;
+    u_char         *rxbuf = NULL;
+    int             length = 0, olength = 0, rc = 0;
+    void           *opaque = NULL;
+
+    if (!sp || !isp || !transport) {
+        DEBUGMSGTL(("sess_read", "read fail: closing...\n"));
+        return 0;
+    }
+
+    if (!fdset || !(FD_ISSET(transport->sock, fdset))) {
+        DEBUGMSGTL(("sess_read", "not reading %d (fdset %p set %d)\n",
+                    transport->sock, fdset,
+                    fdset ? FD_ISSET(transport->sock, fdset) : -9));
+        return 0;
+    }
+
+    sp->s_snmp_errno = 0;
+    sp->s_errno = 0;
+
+    if (transport->flags & NETSNMP_TRANSPORT_FLAG_LISTEN) {
+        int             data_sock = transport->f_accept(transport);
+
+        if (data_sock >= 0) {
+            /*
+             * We've successfully accepted a new stream-based connection.
+             * It's not too clear what should happen here if we are using the
+             * single-session API at this point.  Basically a "session
+             * accepted" callback is probably needed to hand the new session
+             * over to the application.
+             * 
+             * However, for now, as in the original snmp_api, we will ASSUME
+             * that we're using the traditional API, and simply add the new
+             * session to the list.  Note we don't have to get the Session
+             * list lock here, because under that assumption we already hold
+             * it (this is also why we don't just use snmp_add).
+             * 
+             * The moral of the story is: don't use listening stream-based
+             * transports in a multi-threaded environment because something
+             * will go HORRIBLY wrong (and also that SNMP/TCP is not trivial).
+             * 
+             * Another open issue: what should happen to sockets that have
+             * been accept()ed from a listening socket when that original
+             * socket is closed?  If they are left open, then attempting to
+             * re-open the listening socket will fail, which is semantically
+             * confusing.  Perhaps there should be some kind of chaining in
+             * the transport structure so that they can all be closed.
+             * Discuss.  ;-)
+             */
+
+	    netsnmp_transport *new_transport=netsnmp_transport_copy(transport);
+            if (new_transport != NULL) {
+                struct session_list *nslp = NULL;
+
+                new_transport->sock = data_sock;
+                new_transport->flags &= ~NETSNMP_TRANSPORT_FLAG_LISTEN;
+
+                nslp = (struct session_list *)snmp_sess_add_ex(sp,
+			  new_transport, isp->hook_pre, isp->hook_parse,
+			  isp->hook_post, isp->hook_build,
+			  isp->hook_realloc_build, isp->check_packet,
+			  isp->hook_create_pdu);
+
+                if (nslp != NULL) {
+                    nslp->next = Sessions;
+                    Sessions = nslp;
+                } else {
+                    new_transport->f_close(new_transport);
+                    netsnmp_transport_free(new_transport);
+                }
+                return 0;
+            } else {
+                sp->s_snmp_errno = SNMPERR_MALLOC;
+                sp->s_errno = errno;
+                snmp_set_detail(strerror(errno));
+                return -1;
+            }
+        } else {
+            sp->s_snmp_errno = SNMPERR_BAD_RECVFROM;
+            sp->s_errno = errno;
+            snmp_set_detail(strerror(errno));
+            return -1;
+        }
+    }
+
+    /*
+     * Work out where to receive the data to.  
+     */
+
+    if (transport->flags & NETSNMP_TRANSPORT_FLAG_STREAM) {
+        if (isp->packet == NULL) {
+            /*
+             * We have no saved packet.  Allocate one.  
+             */
+            if ((isp->packet = (u_char *) malloc(rxbuf_len)) == NULL) {
+                DEBUGMSGTL(("sess_read", "can't malloc %d bytes for rxbuf\n",
+                            rxbuf_len));
+                return 0;
+            } else {
+                rxbuf = isp->packet;
+                isp->packet_size = rxbuf_len;
+                isp->packet_len = 0;
+            }
+        } else {
+            /*
+             * We have saved a partial packet from last time.  Extend that, if
+             * necessary, and receive new data after the old data.  
+             */
+            u_char         *newbuf;
+
+            if (isp->packet_size < isp->packet_len + rxbuf_len) {
+                newbuf =
+                    (u_char *) realloc(isp->packet,
+                                       isp->packet_len + rxbuf_len);
+                if (newbuf == NULL) {
+                    DEBUGMSGTL(("sess_read",
+                                "can't malloc %d more for rxbuf (%d tot)\n",
+                                rxbuf_len, isp->packet_len + rxbuf_len));
+                    return 0;
+                } else {
+                    isp->packet = newbuf;
+                    isp->packet_size = isp->packet_len + rxbuf_len;
+                    rxbuf = isp->packet + isp->packet_len;
+                }
+            } else {
+                rxbuf = isp->packet + isp->packet_len;
+                rxbuf_len = isp->packet_size - isp->packet_len;
+            }
+        }
+    } else {
+        if ((rxbuf = (u_char *) malloc(rxbuf_len)) == NULL) {
+            DEBUGMSGTL(("sess_read", "can't malloc %d bytes for rxbuf\n",
+                        rxbuf_len));
+            return 0;
+        }
+    }
+
+    length = transport->f_recv(transport, rxbuf, rxbuf_len, &opaque, &olength);
+
+    if (length == -1 && !(transport->flags & NETSNMP_TRANSPORT_FLAG_STREAM)) {
+        sp->s_snmp_errno = SNMPERR_BAD_RECVFROM;
+        sp->s_errno = errno;
+        snmp_set_detail(strerror(errno));
+        free(rxbuf);
+        if (opaque != NULL) {
+            free(opaque);
+        }
+        return -1;
+    }
+
+    /*
+     * Remote end closed connection.  
+     */
+
+    if (length <= 0 && transport->flags & NETSNMP_TRANSPORT_FLAG_STREAM) {
+        /*
+         * Alert the application if possible.  
+         */
+        if (sp->callback != NULL) {
+            DEBUGMSGTL(("sess_read", "perform callback with op=DISCONNECT\n"));
+            (void) sp->callback(NETSNMP_CALLBACK_OP_DISCONNECT, sp, 0,
+                                NULL, sp->callback_magic);
+        }
+        /*
+         * Close socket and mark session for deletion.  
+         */
+        DEBUGMSGTL(("sess_read", "fd %d closed\n", transport->sock));
+        transport->f_close(transport);
+        free(rxbuf);
+        isp->packet = NULL;
+        if (opaque != NULL) {
+            free(opaque);
+        }
+        return -1;
+    }
+
+    if (transport->flags & NETSNMP_TRANSPORT_FLAG_STREAM) {
+        u_char *pptr = isp->packet;
+	void *ocopy = NULL;
+
+        isp->packet_len += length;
+
+        while (isp->packet_len > 0) {
+
+            /*
+             * Get the total data length we're expecting (and need to wait
+             * for).
+             */
+            if (isp->check_packet) {
+                pdulen = isp->check_packet(pptr, isp->packet_len);
+            } else {
+                pdulen = asn_check_packet(pptr, isp->packet_len);
+            }
+
+            DEBUGMSGTL(("sess_read", "  loop packet_len %d, PDU length %d\n",
+                        isp->packet_len, pdulen));
+
+            if (pdulen > MAX_PACKET_LENGTH) {
+                /*
+                 * Illegal length, drop the connection.  
+                 */
+                snmp_log(LOG_ERR, 
+			 "Maximum packet size exceeded in a request.\n");
+		if (sp->callback != NULL) {
+		  DEBUGMSGTL(("sess_read",
+			      "perform callback with op=DISCONNECT\n"));
+		  (void)sp->callback(NETSNMP_CALLBACK_OP_DISCONNECT,
+				     sp, 0, NULL, sp->callback_magic);
+		}
+		DEBUGMSGTL(("sess_read", "fd %d closed\n", transport->sock));
+                transport->f_close(transport);
+                if (opaque != NULL) {
+                    free(opaque);
+                }
+                return -1;
+            }
+
+            if (pdulen > isp->packet_len) {
+                /*
+                 * We don't have a complete packet yet.  Return, and wait for
+                 * more data to arrive.
+                 */
+                DEBUGMSGTL(("sess_read",
+                            "pkt not complete (need %d got %d so far)\n",
+                            pdulen, isp->packet_len));
+                if (opaque != NULL) {
+                    free(opaque);
+                }
+                return 0;
+            }
+
+            /*  We have *at least* one complete packet in the buffer now.  If
+		we have possibly more than one packet, we must copy the opaque
+		pointer because we may need to reuse it for a later packet.  */
+
+	    if (pdulen < isp->packet_len) {
+		if (olength > 0 && opaque != NULL) {
+		    ocopy = malloc(olength);
+		    if (ocopy != NULL) {
+			memcpy(ocopy, opaque, olength);
+		    }
+		}
+	    } else if (pdulen == isp->packet_len) {
+		/*  Common case -- exactly one packet.  No need to copy the
+		    opaque pointer.  */
+		ocopy = opaque;
+		opaque = NULL;
+	    }
+
+            if ((rc = _sess_process_packet(sessp, sp, isp, transport,
+                                           ocopy, ocopy?olength:0, pptr,
+                                           pdulen))) {
+                /*
+                 * Something went wrong while processing this packet -- set the
+                 * errno.  
+                 */
+                if (sp->s_snmp_errno != 0) {
+                    SET_SNMP_ERROR(sp->s_snmp_errno);
+                }
+            }
+
+	    /*  ocopy has been free()d by _sess_process_packet by this point,
+		so set it to NULL.  */
+
+	    ocopy = NULL;
+
+	    /*  Step past the packet we've just dealt with.  */
+
+            pptr += pdulen;
+            isp->packet_len -= pdulen;
+        }
+
+	/*  If we had more than one packet, then we were working with copies
+	    of the opaque pointer, so we still need to free() the opaque
+	    pointer itself.  */
+
+	if (opaque != NULL) {
+	    free(opaque);
+	}
+
+        if (isp->packet_len >= MAXIMUM_PACKET_SIZE) {
+            /*
+             * Obviously this should never happen!  
+             */
+            snmp_log(LOG_ERR,
+                     "too large packet_len = %d, dropping connection %d\n",
+                     isp->packet_len, transport->sock);
+            transport->f_close(transport);
+            return -1;
+        } else if (isp->packet_len == 0) {
+            /*
+             * This is good: it means the packet buffer contained an integral
+             * number of PDUs, so we don't have to save any data for next
+             * time.  We can free() the buffer now to keep the memory
+             * footprint down.
+             */
+            free(isp->packet);
+            isp->packet = NULL;
+            isp->packet_size = 0;
+            isp->packet_len = 0;
+            return rc;
+        }
+
+        /*
+         * If we get here, then there is a partial packet of length
+         * isp->packet_len bytes starting at pptr left over.  Move that to the
+         * start of the buffer, and then realloc() the buffer down to size to
+         * reduce the memory footprint.  
+         */
+
+        memmove(isp->packet, pptr, isp->packet_len);
+        DEBUGMSGTL(("sess_read", "end: memmove(%p, %p, %d); realloc(%p, %d)\n",
+                    isp->packet, pptr, isp->packet_len, isp->packet,
+                    isp->packet_len));
+
+        if ((rxbuf = realloc(isp->packet, isp->packet_len)) == NULL) {
+            /*
+             * I don't see why this should ever fail, but it's not a big deal.
+             */
+            DEBUGMSGTL(("sess_read", "realloc() failed\n"));
+        } else {
+            DEBUGMSGTL(("sess_read", "realloc() okay, old buffer %p, new %p\n",
+                        isp->packet, rxbuf));
+            isp->packet = rxbuf;
+            isp->packet_size = isp->packet_len;
+        }
+        return rc;
+    } else {
+        rc = _sess_process_packet(sessp, sp, isp, transport, opaque,
+                                  olength, rxbuf, length);
+        free(rxbuf);
+        return rc;
+    }
+}
+
+
+
+/*
+ * returns 0 if success, -1 if fail 
+ */
+int
+snmp_sess_read(void *sessp, fd_set * fdset)
+{
+    struct session_list *psl;
+    netsnmp_session *pss;
+    int             rc;
+
+    rc = _sess_read(sessp, fdset);
+    psl = (struct session_list *) sessp;
+    pss = psl->session;
+    if (rc && pss->s_snmp_errno) {
+        SET_SNMP_ERROR(pss->s_snmp_errno);
+    }
+    return rc;
+}
+
+
+/*
+ * Returns info about what snmp requires from a select statement.
+ * numfds is the number of fds in the list that are significant.
+ * All file descriptors opened for SNMP are OR'd into the fdset.
+ * If activity occurs on any of these file descriptors, snmp_read
+ * should be called with that file descriptor set
+ *
+ * The timeout is the latest time that SNMP can wait for a timeout.  The
+ * select should be done with the minimum time between timeout and any other
+ * timeouts necessary.  This should be checked upon each invocation of select.
+ * If a timeout is received, snmp_timeout should be called to check if the
+ * timeout was for SNMP.  (snmp_timeout is idempotent)
+ *
+ * The value of block indicates how the timeout value is interpreted.
+ * If block is true on input, the timeout value will be treated as undefined,
+ * but it must be available for setting in snmp_select_info.  On return,
+ * block is set to true if the value returned for timeout is undefined;
+ * when block is set to false, timeout may be used as a parmeter to 'select'.
+ *
+ * snmp_select_info returns the number of open sockets.  (i.e. The number of
+ * sessions open)
+ */
+
+int
+snmp_select_info(int *numfds,
+                 fd_set * fdset, struct timeval *timeout, int *block)
+    /*
+     * input:  set to 1 if input timeout value is undefined  
+     * set to 0 if input timeout value is defined    
+     * output: set to 1 if output timeout value is undefined 
+     * set to 0 if output rimeout vlaue id defined   
+     */
+{
+    return snmp_sess_select_info((void *) 0, numfds, fdset, timeout,
+                                 block);
+}
+
+/*
+ * Same as snmp_select_info, but works just one session. 
+ */
+int
+snmp_sess_select_info(void *sessp,
+                      int *numfds,
+                      fd_set * fdset, struct timeval *timeout, int *block)
+{
+    struct session_list *slptest = (struct session_list *) sessp;
+    struct session_list *slp, *next = NULL;
+    netsnmp_request_list *rp;
+    struct timeval  now, earliest, delta;
+    int             timer_set = 0;
+    int             active = 0, requests = 0;
+    int             next_alarm = 0;
+
+    timerclear(&earliest);
+
+    /*
+     * For each request outstanding, add its socket to the fdset,
+     * and if it is the earliest timeout to expire, mark it as lowest.
+     * If a single session is specified, do just for that session.
+     */
+
+    if (sessp) {
+        slp = slptest;
+    } else {
+        slp = Sessions;
+    }
+
+    DEBUGMSGTL(("sess_select", "for %s session%s: ",
+                sessp ? "single" : "all", sessp ? "" : "s"));
+
+    for (; slp; slp = next) {
+        next = slp->next;
+
+        if (slp->transport == NULL) {
+            /*
+             * Close in progress -- skip this one.  
+             */
+            DEBUGMSG(("sess_select", "skip "));
+            continue;
+        }
+
+        if (slp->transport->sock == -1) {
+            /*
+             * This session was marked for deletion.  
+             */
+            DEBUGMSG(("sess_select", "delete\n"));
+            if (sessp == NULL) {
+                snmp_close(slp->session);
+            } else {
+                snmp_sess_close(slp);
+            }
+            DEBUGMSGTL(("sess_select", "for %s session%s: ",
+                        sessp ? "single" : "all", sessp ? "" : "s"));
+            continue;
+        }
+
+        DEBUGMSG(("sess_select", "%d ", slp->transport->sock));
+        if ((slp->transport->sock + 1) > *numfds) {
+            *numfds = (slp->transport->sock + 1);
+        }
+
+        FD_SET(slp->transport->sock, fdset);
+        if (slp->internal != NULL && slp->internal->requests) {
+            /*
+             * Found another session with outstanding requests.  
+             */
+            requests++;
+            for (rp = slp->internal->requests; rp; rp = rp->next_request) {
+                if ((!timerisset(&earliest)
+                     || (timercmp(&rp->expire, &earliest, <)))) {
+                    earliest = rp->expire;
+                }
+            }
+        }
+
+        active++;
+        if (sessp) {
+            /*
+             * Single session processing.  
+             */
+            break;
+        }
+    }
+    DEBUGMSG(("sess_select", "\n"));
+
+    if (netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_ALARM_DONT_USE_SIG)) {
+        next_alarm = get_next_alarm_delay_time(&delta);
+    }
+    if (next_alarm == 0 && requests == 0) {
+        /*
+         * If none are active, skip arithmetic.  
+         */
+        *block = 1;             /* can block - timeout value is undefined if no requests */
+        return active;
+    }
+
+    /*
+     * * Now find out how much time until the earliest timeout.  This
+     * * transforms earliest from an absolute time into a delta time, the
+     * * time left until the select should timeout.
+     */
+    gettimeofday(&now, (struct timezone *) 0);
+    /*
+     * Now = now;
+     */
+
+    if (next_alarm) {
+        delta.tv_sec += now.tv_sec;
+        delta.tv_usec += now.tv_usec;
+        while (delta.tv_usec >= 1000000) {
+            delta.tv_usec -= 1000000;
+            delta.tv_sec += 1;
+        }
+        if (!timerisset(&earliest) ||
+            ((earliest.tv_sec > delta.tv_sec) ||
+             ((earliest.tv_sec == delta.tv_sec) &&
+              (earliest.tv_usec > delta.tv_usec)))) {
+            earliest.tv_sec = delta.tv_sec;
+            earliest.tv_usec = delta.tv_usec;
+        }
+    }
+
+    if (timer_set || earliest.tv_sec < now.tv_sec) {
+        earliest.tv_sec = 0;
+        earliest.tv_usec = 0;
+    } else if (earliest.tv_sec == now.tv_sec) {
+        earliest.tv_sec = 0;
+        earliest.tv_usec = (earliest.tv_usec - now.tv_usec);
+        if (earliest.tv_usec < 0) {
+            earliest.tv_usec = 100;
+        }
+    } else {
+        earliest.tv_sec = (earliest.tv_sec - now.tv_sec);
+        earliest.tv_usec = (earliest.tv_usec - now.tv_usec);
+        if (earliest.tv_usec < 0) {
+            earliest.tv_sec--;
+            earliest.tv_usec = (1000000L + earliest.tv_usec);
+        }
+    }
+
+    /*
+     * if it was blocking before or our delta time is less, reset timeout 
+     */
+    if ((*block || (timercmp(&earliest, timeout, <)))) {
+        *timeout = earliest;
+        *block = 0;
+    }
+    return active;
+}
+
+/*
+ * snmp_timeout should be called whenever the timeout from snmp_select_info
+ * expires, but it is idempotent, so snmp_timeout can be polled (probably a
+ * cpu expensive proposition).  snmp_timeout checks to see if any of the
+ * sessions have an outstanding request that has timed out.  If it finds one
+ * (or more), and that pdu has more retries available, a new packet is formed
+ * from the pdu and is resent.  If there are no more retries available, the
+ *  callback for the session is used to alert the user of the timeout.
+ */
+void
+snmp_timeout(void)
+{
+    struct session_list *slp;
+    snmp_res_lock(MT_LIBRARY_ID, MT_LIB_SESSION);
+    for (slp = Sessions; slp; slp = slp->next) {
+        snmp_sess_timeout((void *) slp);
+    }
+    snmp_res_unlock(MT_LIBRARY_ID, MT_LIB_SESSION);
+}
+
+static int
+snmp_resend_request(struct session_list *slp, netsnmp_request_list *rp,
+                    int incr_retries)
+{
+    struct snmp_internal_session *isp;
+    netsnmp_session *sp;
+    netsnmp_transport *transport;
+    u_char         *pktbuf = NULL, *packet = NULL;
+    size_t          pktbuf_len = 0, offset = 0, length = 0;
+    struct timeval  tv, now;
+    int             result = 0;
+
+    sp = slp->session;
+    isp = slp->internal;
+    transport = slp->transport;
+    if (!sp || !isp || !transport) {
+        DEBUGMSGTL(("sess_read", "resend fail: closing...\n"));
+        return 0;
+    }
+
+    if ((pktbuf = malloc(2048)) == NULL) {
+        DEBUGMSGTL(("sess_resend",
+                    "couldn't malloc initial packet buffer\n"));
+        return 0;
+    } else {
+        pktbuf_len = 2048;
+    }
+
+    if (incr_retries) {
+        rp->retries++;
+    }
+
+    /*
+     * Always increment msgId for resent messages.  
+     */
+    rp->pdu->msgid = rp->message_id = snmp_get_next_msgid();
+
+    if (isp->hook_realloc_build) {
+        result = isp->hook_realloc_build(sp, rp->pdu,
+                                         &pktbuf, &pktbuf_len, &offset);
+
+        packet = pktbuf;
+        length = offset;
+    } else if (isp->hook_build) {
+        packet = pktbuf;
+        length = pktbuf_len;
+        result = isp->hook_build(sp, rp->pdu, pktbuf, &length);
+    } else {
+#ifdef USE_REVERSE_ASNENCODING
+        if (netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_REVERSE_ENCODE)) {
+            result =
+                snmp_build(&pktbuf, &pktbuf_len, &offset, sp, rp->pdu);
+            packet = pktbuf + pktbuf_len - offset;
+            length = offset;
+        } else {
+#endif
+            packet = pktbuf;
+            length = pktbuf_len;
+            result = snmp_build(&pktbuf, &length, &offset, sp, rp->pdu);
+#ifdef USE_REVERSE_ASNENCODING
+        }
+#endif
+    }
+
+    if (result < 0) {
+        /*
+         * This should never happen.  
+         */
+        DEBUGMSGTL(("sess_resend", "encoding failure\n"));
+        if (pktbuf != NULL) {
+            free(pktbuf);
+        }
+        return -1;
+    }
+
+    if (netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_DUMP_PACKET)) {
+        if (transport->f_fmtaddr != NULL) {
+            char           *string = NULL;
+            string =
+                transport->f_fmtaddr(transport, rp->pdu->transport_data,
+                                     rp->pdu->transport_data_length);
+            if (string != NULL) {
+                snmp_log(LOG_DEBUG, "\nResending %d bytes to %s\n", length,
+                         string);
+                free(string);
+            } else {
+                snmp_log(LOG_DEBUG, "\nResending %d bytes to <UNKNOWN>\n",
+                         length);
+            }
+        }
+        xdump(packet, length, "");
+    }
+
+    result = transport->f_send(transport, packet, length,
+                               &(rp->pdu->transport_data),
+                               &(rp->pdu->transport_data_length));
+
+    /*
+     * We are finished with the local packet buffer, if we allocated one (due
+     * to there being no saved packet).  
+     */
+
+    if (pktbuf != NULL) {
+        free(pktbuf);
+        pktbuf = packet = NULL;
+    }
+
+    if (result < 0) {
+        sp->s_snmp_errno = SNMPERR_BAD_SENDTO;
+        sp->s_errno = errno;
+        snmp_set_detail(strerror(errno));
+        return -1;
+    } else {
+        gettimeofday(&now, (struct timezone *) 0);
+        tv = now;
+        rp->time = tv;
+        tv.tv_usec += rp->timeout;
+        tv.tv_sec += tv.tv_usec / 1000000L;
+        tv.tv_usec %= 1000000L;
+        rp->expire = tv;
+    }
+    return 0;
+}
+
+
+
+void
+snmp_sess_timeout(void *sessp)
+{
+    struct session_list *slp = (struct session_list *) sessp;
+    netsnmp_session *sp;
+    struct snmp_internal_session *isp;
+    netsnmp_request_list *rp, *orp = NULL, *freeme = NULL;
+    struct timeval  now;
+    snmp_callback   callback;
+    void           *magic;
+    struct snmp_secmod_def *sptr;
+
+    sp = slp->session;
+    isp = slp->internal;
+    if (!sp || !isp) {
+        DEBUGMSGTL(("sess_read", "timeout fail: closing...\n"));
+        return;
+    }
+
+    gettimeofday(&now, (struct timezone *) 0);
+
+    /*
+     * For each request outstanding, check to see if it has expired.
+     */
+    for (rp = isp->requests; rp; rp = rp->next_request) {
+        if (freeme != NULL) {
+            /*
+             * frees rp's after the for loop goes on to the next_request 
+             */
+            free((char *) freeme);
+            freeme = NULL;
+        }
+
+        if ((timercmp(&rp->expire, &now, <))) {
+            if ((sptr = find_sec_mod(rp->pdu->securityModel)) != NULL &&
+                sptr->pdu_timeout != NULL) {
+                /*
+                 * call security model if it needs to know about this 
+                 */
+                (*sptr->pdu_timeout) (rp->pdu);
+            }
+
+            /*
+             * this timer has expired 
+             */
+            if (rp->retries >= sp->retries) {
+                if (rp->callback) {
+                    callback = rp->callback;
+                    magic = rp->cb_data;
+                } else {
+                    callback = sp->callback;
+                    magic = sp->callback_magic;
+                }
+
+                /*
+                 * No more chances, delete this entry 
+                 */
+                if (callback) {
+                    callback(NETSNMP_CALLBACK_OP_TIMED_OUT, sp,
+                             rp->pdu->reqid, rp->pdu, magic);
+                }
+                if (isp->requests == rp) {
+                    isp->requests = rp->next_request;
+                    if (isp->requestsEnd == rp) {
+                        isp->requestsEnd = NULL;
+                    }
+                } else {
+                    orp->next_request = rp->next_request;
+                    if (isp->requestsEnd == rp) {
+                        isp->requestsEnd = orp;
+                    }
+                }
+                snmp_free_pdu(rp->pdu); /* FIX  rp is already free'd! */
+                freeme = rp;
+                continue;       /* don't update orp below */
+            } else {
+                if (snmp_resend_request(slp, rp, TRUE)) {
+                    break;
+                }
+            }
+        }
+        orp = rp;
+    }
+
+    if (freeme != NULL) {
+        free((char *) freeme);
+        freeme = NULL;
+    }
+}
+
+/*
+ * lexicographical compare two object identifiers.
+ * * Returns -1 if name1 < name2,
+ * *          0 if name1 = name2,
+ * *          1 if name1 > name2
+ * *
+ * * Caution: this method is called often by
+ * *          command responder applications (ie, agent).
+ */
+int
+snmp_oid_ncompare(const oid * in_name1,
+                  size_t len1,
+                  const oid * in_name2, size_t len2, size_t max_len)
+{
+    register int    len;
+    register const oid *name1 = in_name1;
+    register const oid *name2 = in_name2;
+    size_t          min_len;
+
+    /*
+     * len = minimum of len1 and len2 
+     */
+    if (len1 < len2)
+        min_len = len1;
+    else
+        min_len = len2;
+
+    if (min_len > max_len)
+        min_len = max_len;
+
+    len = min_len;
+
+    /*
+     * find first non-matching OID 
+     */
+    while (len-- > 0) {
+        /*
+         * these must be done in seperate comparisons, since
+         * subtracting them and using that result has problems with
+         * subids > 2^31. 
+         */
+        if (*(name1) != *(name2)) {
+            if (*(name1) < *(name2))
+                return -1;
+            return 1;
+        }
+        name1++;
+        name2++;
+    }
+
+    if (min_len != max_len) {
+        /*
+         * both OIDs equal up to length of shorter OID 
+         */
+        if (len1 < len2)
+            return -1;
+        if (len2 < len1)
+            return 1;
+    }
+
+    return 0;
+}
+
+/** lexicographical compare two object identifiers.
+ * 
+ * Caution: this method is called often by
+ *          command responder applications (ie, agent).
+ *
+ * @return -1 if name1 < name2, 0 if name1 = name2, 1 if name1 > name2
+ */
+int
+snmp_oid_compare(const oid * in_name1,
+                 size_t len1, const oid * in_name2, size_t len2)
+{
+    register int    len;
+    register const oid *name1 = in_name1;
+    register const oid *name2 = in_name2;
+
+    /*
+     * len = minimum of len1 and len2 
+     */
+    if (len1 < len2)
+        len = len1;
+    else
+        len = len2;
+    /*
+     * find first non-matching OID 
+     */
+    while (len-- > 0) {
+        /*
+         * these must be done in seperate comparisons, since
+         * subtracting them and using that result has problems with
+         * subids > 2^31. 
+         */
+        if (*(name1) != *(name2)) {
+            if (*(name1) < *(name2))
+                return -1;
+            return 1;
+        }
+        name1++;
+        name2++;
+    }
+    /*
+     * both OIDs equal up to length of shorter OID 
+     */
+    if (len1 < len2)
+        return -1;
+    if (len2 < len1)
+        return 1;
+    return 0;
+}
+
+/** Compares 2 OIDs to determine if they are equal up until the shortest length.
+ * @param in_name1 A pointer to the first oid.
+ * @param len1     length of the first OID (in segments, not bytes)
+ * @param in_name2 A pointer to the second oid.
+ * @param len2     length of the second OID (in segments, not bytes)
+ * @return 0 if they are equal, 1 if in_name1 is > in_name2, or -1 if <.
+ */ 
+int
+snmp_oidtree_compare(const oid * in_name1,
+                     size_t len1, const oid * in_name2, size_t len2)
+{
+    int             len = ((len1 < len2) ? len1 : len2);
+
+    return (snmp_oid_compare(in_name1, len, in_name2, len));
+}
+
+/** Compares 2 OIDs to determine if they are exactly equal.
+ *  This should be faster than doing a snmp_oid_compare for different
+ *  length OIDs, since the length is checked first and if != returns
+ *  immediately.  Might be very slighly faster if lengths are ==.
+ * @param in_name1 A pointer to the first oid.
+ * @param len1     length of the first OID (in segments, not bytes)
+ * @param in_name2 A pointer to the second oid.
+ * @param len2     length of the second OID (in segments, not bytes)
+ * @return 0 if they are equal, 1 if they are not.
+ */ 
+int
+netsnmp_oid_equals(const oid * in_name1,
+                   size_t len1, const oid * in_name2, size_t len2)
+{
+    register const oid *name1 = in_name1;
+    register const oid *name2 = in_name2;
+    register int    len = len1;
+
+    /*
+     * len = minimum of len1 and len2 
+     */
+    if (len1 != len2)
+        return 1;
+    /*
+     * find first non-matching OID 
+     */
+    while (len-- > 0) {
+        /*
+         * these must be done in seperate comparisons, since
+         * subtracting them and using that result has problems with
+         * subids > 2^31. 
+         */
+        if (*(name1++) != *(name2++))
+            return 1;
+    }
+    return 0;
+}
+
+/** Identical to netsnmp_oid_equals, except only the length up to len1 is compared.
+ * Functionally, this determines if in_name2 is equal or a subtree of in_name1
+ * @param in_name1 A pointer to the first oid.
+ * @param len1     length of the first OID (in segments, not bytes)
+ * @param in_name2 A pointer to the second oid.
+ * @param len2     length of the second OID (in segments, not bytes)
+ * @return 0 if one is a common prefix of the other.
+ */ 
+int
+netsnmp_oid_is_subtree(const oid * in_name1,
+                       size_t len1, const oid * in_name2, size_t len2)
+{
+    if (len1 > len2)
+        return 1;
+
+    if (memcmp(in_name1, in_name2, len1 * sizeof(oid)))
+        return 1;
+
+    return 0;
+}
+
+/** Given two OIDs, determine the common prefix to them both.
+ * @param in_name1 A pointer to the first oid.
+ * @param len1     Length of the first oid.
+ * @param in_name2 A pointer to the second oid.
+ * @param len2     Length of the second oid.
+ * @return length of largest common index of commonality.  1 = first, 0 if none *         or -1 on error.
+ */
+int
+netsnmp_oid_find_prefix(const oid * in_name1, size_t len1,
+                        const oid * in_name2, size_t len2)
+{
+    int i;
+    size_t min_size;
+
+    if (!in_name1 || !in_name2)
+        return -1;
+
+    min_size = SNMP_MIN(len1, len2);
+    for(i = 0; i < min_size; i++) {
+        if (in_name1[i] != in_name2[i])
+            return i + 1;
+    }
+    return 0;
+}
+
+static int _check_range(struct tree *tp, long ltmp, int *resptr,
+	                const char *errmsg)
+{
+    int check = !netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID,
+	                                NETSNMP_DS_LIB_DONT_CHECK_RANGE);
+  
+    if (check && tp && tp->ranges) {
+	struct range_list *rp = tp->ranges;
+	while (rp) {
+	    if (rp->low <= ltmp && ltmp <= rp->high) break;
+	    rp = rp->next;
+	}
+	if (!rp) {
+	    *resptr = SNMPERR_RANGE;
+	    snmp_set_detail(errmsg);
+	    return 0;
+	}
+    }
+    return 1;
+}
+        
+
+/*
+ * Add a variable with the requested name to the end of the list of
+ * variables for this pdu.
+ */
+netsnmp_variable_list *
+snmp_pdu_add_variable(netsnmp_pdu *pdu,
+                      const oid * name,
+                      size_t name_length,
+                      u_char type, const u_char * value, size_t len)
+{
+    return snmp_varlist_add_variable(&pdu->variables, name, name_length,
+                                     type, value, len);
+}
+
+/*
+ * Add a variable with the requested name to the end of the list of
+ * variables for this pdu.
+ */
+netsnmp_variable_list *
+snmp_varlist_add_variable(netsnmp_variable_list ** varlist,
+                          const oid * name,
+                          size_t name_length,
+                          u_char type, const u_char * value, size_t len)
+{
+    netsnmp_variable_list *vars, *vtmp;
+    int             largeval = 1;
+    const long     *val_long = NULL;
+    const int      *val_int  = NULL;
+
+    if (varlist == NULL)
+        return NULL;
+
+    vars = (netsnmp_variable_list *) malloc(sizeof(netsnmp_variable_list));
+    if (vars == NULL)
+        return NULL;
+
+    vars->next_variable = 0;
+    vars->name = 0;
+    vars->name_length = 0;
+    vars->val.string = 0;
+    vars->data = 0;
+    vars->dataFreeHook = 0;
+    vars->index = 0;
+
+    /*
+     * use built-in storage for smaller values 
+     */
+    if (len <= (sizeof(vars->buf) - 1)) {
+        vars->val.string = (u_char *) vars->buf;
+        largeval = 0;
+    }
+
+    vars->type = type;
+    vars->val_len = len;
+    switch (type) {
+    case ASN_INTEGER:
+    case ASN_UNSIGNED:
+    case ASN_TIMETICKS:
+    case ASN_IPADDRESS:
+    case ASN_COUNTER:
+        if (value) {
+            if (vars->val_len == sizeof(int)) {
+                val_int = (const int *) value;
+                *(vars->val.integer) = (long) *val_int;
+            } else {
+                val_long = (const long *) value;
+                *(vars->val.integer) = *val_long;
+            }
+        }
+        vars->val_len = sizeof(long);
+        break;
+
+    case ASN_OBJECT_ID:
+    case ASN_PRIV_IMPLIED_OBJECT_ID:
+    case ASN_PRIV_INCL_RANGE:
+    case ASN_PRIV_EXCL_RANGE:
+        if (largeval) {
+            vars->val.objid = (oid *) malloc(vars->val_len);
+        }
+        if (vars->val.objid == NULL) {
+            return NULL;
+        }
+        memmove(vars->val.objid, value, vars->val_len);
+        break;
+
+    case ASN_PRIV_IMPLIED_OCTET_STR:
+    case ASN_OCTET_STR:
+    case ASN_BIT_STR:
+    case ASN_OPAQUE:
+    case ASN_NSAP:
+        if (largeval) {
+            vars->val.string = (u_char *) malloc(vars->val_len + 1);
+        }
+        if (vars->val.string == NULL) {
+            return NULL;
+        }
+        memmove(vars->val.string, value, vars->val_len);
+        /*
+         * Make sure the string is zero-terminated; some bits of code make
+         * this assumption.  Easier to do this here than fix all these wrong
+         * assumptions.  
+         */
+        vars->val.string[vars->val_len] = '\0';
+        break;
+
+    case SNMP_NOSUCHOBJECT:
+    case SNMP_NOSUCHINSTANCE:
+    case SNMP_ENDOFMIBVIEW:
+    case ASN_NULL:
+        vars->val_len = 0;
+        vars->val.string = NULL;
+        break;
+
+#ifdef OPAQUE_SPECIAL_TYPES
+    case ASN_OPAQUE_U64:
+    case ASN_OPAQUE_I64:
+#endif                          /* OPAQUE_SPECIAL_TYPES */
+    case ASN_COUNTER64:
+        vars->val_len = sizeof(struct counter64);
+        memmove(vars->val.counter64, value, vars->val_len);
+        break;
+
+#ifdef OPAQUE_SPECIAL_TYPES
+    case ASN_OPAQUE_FLOAT:
+        vars->val_len = sizeof(float);
+        memmove(vars->val.floatVal, value, vars->val_len);
+        break;
+
+    case ASN_OPAQUE_DOUBLE:
+        vars->val_len = sizeof(double);
+        memmove(vars->val.doubleVal, value, vars->val_len);
+        break;
+
+#endif                          /* OPAQUE_SPECIAL_TYPES */
+
+    default:
+        snmp_set_detail("Internal error in type switching\n");
+        snmp_free_var(vars);
+        return (0);
+    }
+
+    if (name != NULL && snmp_set_var_objid(vars, name, name_length)) {
+        snmp_free_var(vars);
+        return (0);
+    }
+
+    /*
+     * put only qualified variable onto varlist 
+     */
+    if (*varlist == NULL) {
+        *varlist = vars;
+    } else {
+        for (vtmp = *varlist; vtmp->next_variable;
+             vtmp = vtmp->next_variable);
+
+        vtmp->next_variable = vars;
+    }
+
+    return vars;
+}
+
+
+
+/*
+ * Add a variable with the requested name to the end of the list of
+ * variables for this pdu.
+ * Returns:
+ * may set these error types :
+ * SNMPERR_RANGE - type, value, or length not found or out of range
+ * SNMPERR_VALUE - value is not correct
+ * SNMPERR_BAD_NAME - name is not found
+ *
+ * returns 0 if success, error if failure.
+ */
+int
+snmp_add_var(netsnmp_pdu *pdu,
+             const oid * name, size_t name_length, char type, const char *value)
+{
+    const char     *cp;
+    char           *ecp, *vp;
+    int             result = SNMPERR_SUCCESS;
+    int             check = !netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID,
+					     NETSNMP_DS_LIB_DONT_CHECK_RANGE);
+    int             do_hint = !netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID,
+					     NETSNMP_DS_LIB_NO_DISPLAY_HINT);
+    u_char         *hintptr;
+    u_char         *buf = NULL;
+    const u_char   *buf_ptr = NULL;
+    size_t          buf_len = 0, value_len = 0, tint;
+    long            ltmp;
+    int             itmp;
+    struct tree    *tp;
+    struct enum_list *ep;
+#ifdef OPAQUE_SPECIAL_TYPES
+    double          dtmp;
+    float           ftmp;
+    struct counter64 c64tmp;
+#endif                          /* OPAQUE_SPECIAL_TYPES */
+
+    tp = get_tree(name, name_length, get_tree_head());
+    if (!tp || !tp->type || tp->type > TYPE_SIMPLE_LAST) {
+        check = 0;
+    }
+    if (!(tp && tp->hint))
+	do_hint = 0;
+
+    if (tp && type == '=') {
+        /*
+         * generic assignment - let the tree node decide value format 
+         */
+        switch (tp->type) {
+        case TYPE_INTEGER:
+        case TYPE_INTEGER32:
+            type = 'i';
+            break;
+        case TYPE_GAUGE:
+        case TYPE_UNSIGNED32:
+            type = 'u';
+            break;
+        case TYPE_UINTEGER:
+            type = '3';
+            break;
+        case TYPE_COUNTER:
+            type = 'c';
+            break;
+        case TYPE_TIMETICKS:
+            type = 't';
+            break;
+        case TYPE_OCTETSTR:
+            type = 's';
+            break;
+        case TYPE_BITSTRING:
+            type = 'b';
+            break;
+        case TYPE_IPADDR:
+            type = 'a';
+            break;
+        case TYPE_OBJID:
+            type = 'o';
+            break;
+        }
+    }
+
+    switch (type) {
+    case 'i':
+        if (check && tp->type != TYPE_INTEGER
+            && tp->type != TYPE_INTEGER32) {
+            value = "INTEGER";
+            result = SNMPERR_VALUE;
+            goto type_error;
+        }
+        if (!*value)
+            goto fail;
+        ltmp = strtol(value, &ecp, 10);
+        if (*ecp) {
+            ep = tp ? tp->enums : NULL;
+            while (ep) {
+                if (strcmp(value, ep->label) == 0) {
+                    ltmp = ep->value;
+                    break;
+                }
+                ep = ep->next;
+            }
+            if (!ep) {
+                result = SNMPERR_BAD_NAME;
+                snmp_set_detail(value);
+                break;
+            }
+        }
+
+        if (check && !_check_range(tp, ltmp, &result, value))
+            break;
+        snmp_pdu_add_variable(pdu, name, name_length, ASN_INTEGER,
+                              (u_char *) & ltmp, sizeof(ltmp));
+        break;
+
+    case 'u':
+        if (check && tp->type != TYPE_GAUGE && tp->type != TYPE_UNSIGNED32) {
+            value = "Unsigned32";
+            result = SNMPERR_VALUE;
+            goto type_error;
+        }
+        ltmp = strtoul(value, &ecp, 10);
+        if (*value && !*ecp)
+            snmp_pdu_add_variable(pdu, name, name_length, ASN_UNSIGNED,
+                                  (u_char *) & ltmp, sizeof(ltmp));
+        else
+            goto fail;
+        break;
+
+    case '3':
+        if (check && tp->type != TYPE_UINTEGER) {
+            value = "UInteger32";
+            result = SNMPERR_VALUE;
+            goto type_error;
+        }
+        ltmp = strtoul(value, &ecp, 10);
+        if (*value && !*ecp)
+            snmp_pdu_add_variable(pdu, name, name_length, ASN_UINTEGER,
+                                  (u_char *) & ltmp, sizeof(ltmp));
+        else
+            goto fail;
+        break;
+
+    case 'c':
+        if (check && tp->type != TYPE_COUNTER) {
+            value = "Counter32";
+            result = SNMPERR_VALUE;
+            goto type_error;
+        }
+        ltmp = strtoul(value, &ecp, 10);
+        if (*value && !*ecp)
+            snmp_pdu_add_variable(pdu, name, name_length, ASN_COUNTER,
+                                  (u_char *) & ltmp, sizeof(ltmp));
+        else
+            goto fail;
+        break;
+
+    case 't':
+        if (check && tp->type != TYPE_TIMETICKS) {
+            value = "Timeticks";
+            result = SNMPERR_VALUE;
+            goto type_error;
+        }
+        ltmp = strtoul(value, &ecp, 10);
+        if (*value && !*ecp)
+            snmp_pdu_add_variable(pdu, name, name_length, ASN_TIMETICKS,
+                                  (u_char *) & ltmp, sizeof(long));
+        else
+            goto fail;
+        break;
+
+    case 'a':
+        if (check && tp->type != TYPE_IPADDR) {
+            value = "IpAddress";
+            result = SNMPERR_VALUE;
+            goto type_error;
+        }
+        ltmp = inet_addr(value);
+        if (ltmp != (long) -1 || !strcmp(value, "255.255.255.255"))
+            snmp_pdu_add_variable(pdu, name, name_length, ASN_IPADDRESS,
+                                  (u_char *) & ltmp, sizeof(long));
+        else
+            goto fail;
+        break;
+
+    case 'o':
+        if (check && tp->type != TYPE_OBJID) {
+            value = "OBJECT IDENTIFIER";
+            result = SNMPERR_VALUE;
+            goto type_error;
+        }
+        if ((buf = malloc(sizeof(oid) * MAX_OID_LEN)) == NULL) {
+            result = SNMPERR_MALLOC;
+        } else {
+            tint = MAX_OID_LEN;
+            if (snmp_parse_oid(value, (oid *) buf, &tint)) {
+                snmp_pdu_add_variable(pdu, name, name_length,
+                                      ASN_OBJECT_ID, buf,
+                                      sizeof(oid) * tint);
+            } else {
+                result = snmp_errno;
+            }
+        }
+        break;
+
+    case 's':
+    case 'x':
+    case 'd':
+        if (check && tp->type != TYPE_OCTETSTR && tp->type != TYPE_BITSTRING) {
+            value = "OCTET STRING";
+            result = SNMPERR_VALUE;
+            goto type_error;
+        }
+	if ('s' == type && do_hint && !parse_octet_hint(tp->hint, value, &hintptr, &itmp)) {
+            if (!check || _check_range(tp, itmp, &result, "Value does not match DISPLAY-HINT")) {
+                snmp_pdu_add_variable(pdu, name, name_length,
+                                      ASN_OCTET_STR, hintptr, itmp);
+            }
+            free(hintptr);
+            hintptr = buf;
+            break;
+        }
+        if (type == 'd') {
+            if (!snmp_decimal_to_binary
+                (&buf, &buf_len, &value_len, 1, value)) {
+                result = SNMPERR_VALUE;
+                snmp_set_detail(value);
+                break;
+            }
+            buf_ptr = buf;
+        } else if (type == 'x') {
+            if (!snmp_hex_to_binary(&buf, &buf_len, &value_len, 1, value)) {
+                result = SNMPERR_VALUE;
+                snmp_set_detail(value);
+                break;
+            }
+            buf_ptr = buf;
+        } else if (type == 's') {
+            buf_ptr = value;
+            value_len = strlen(value);
+        }
+        if (check && !_check_range(tp, value_len, &result, "Bad string length"))
+            break;
+        snmp_pdu_add_variable(pdu, name, name_length, ASN_OCTET_STR,
+                              buf_ptr, value_len);
+        break;
+
+    case 'n':
+        snmp_pdu_add_variable(pdu, name, name_length, ASN_NULL, 0, 0);
+        break;
+
+    case 'b':
+        if (check && (tp->type != TYPE_BITSTRING || !tp->enums)) {
+            value = "BITS";
+            result = SNMPERR_VALUE;
+            goto type_error;
+        }
+        tint = 0;
+        if ((buf = (u_char *) malloc(256)) == NULL) {
+            result = SNMPERR_MALLOC;
+            break;
+        } else {
+            buf_len = 256;
+            memset(buf, 0, buf_len);
+        }
+
+        for (ep = tp ? tp->enums : NULL; ep; ep = ep->next) {
+            if (ep->value / 8 >= (int) tint) {
+                tint = ep->value / 8 + 1;
+            }
+        }
+
+	vp = strdup(value);
+	for (cp = strtok(vp, " ,\t"); cp; cp = strtok(NULL, " ,\t")) {
+            int             ix, bit;
+
+            ltmp = strtoul(cp, &ecp, 0);
+            if (*ecp != 0) {
+                for (ep = tp ? tp->enums : NULL; ep != NULL; ep = ep->next) {
+                    if (strncmp(ep->label, cp, strlen(ep->label)) == 0) {
+                        break;
+                    }
+                }
+                if (ep != NULL) {
+                    ltmp = ep->value;
+                } else {
+                    result = SNMPERR_BAD_NAME;
+                    snmp_set_detail(cp);
+                    free(buf);
+		    free(vp);
+                    goto out;
+                }
+            }
+
+            ix = ltmp / 8;
+            if (ix >= (int) tint) {
+                tint = ix + 1;
+            }
+            if (ix >= buf_len && !snmp_realloc(&buf, &buf_len)) {
+                result = SNMPERR_MALLOC;
+                break;
+            }
+            bit = 0x80 >> ltmp % 8;
+            buf[ix] |= bit;
+	    
+        }
+	free(vp);
+        snmp_pdu_add_variable(pdu, name, name_length, ASN_OCTET_STR,
+                              buf, tint);
+        break;
+
+#ifdef OPAQUE_SPECIAL_TYPES
+    case 'U':
+        if (read64(&c64tmp, value))
+            snmp_pdu_add_variable(pdu, name, name_length, ASN_OPAQUE_U64,
+                                  (u_char *) & c64tmp, sizeof(c64tmp));
+        else
+            goto fail;
+        break;
+
+    case 'I':
+        if (read64(&c64tmp, value))
+            snmp_pdu_add_variable(pdu, name, name_length, ASN_OPAQUE_I64,
+                                  (u_char *) & c64tmp, sizeof(c64tmp));
+        else
+            goto fail;
+        break;
+
+    case 'F':
+        if (sscanf(value, "%f", &ftmp) == 1)
+            snmp_pdu_add_variable(pdu, name, name_length, ASN_OPAQUE_FLOAT,
+                                  (u_char *) & ftmp, sizeof(ftmp));
+        else
+            goto fail;
+        break;
+
+    case 'D':
+        if (sscanf(value, "%lf", &dtmp) == 1)
+            snmp_pdu_add_variable(pdu, name, name_length,
+                                  ASN_OPAQUE_DOUBLE, (u_char *) & dtmp,
+                                  sizeof(dtmp));
+        else
+            goto fail;
+        break;
+#endif                          /* OPAQUE_SPECIAL_TYPES */
+
+    default:
+        result = SNMPERR_VAR_TYPE;
+	buf = calloc(1, 4);
+	if (buf != NULL) {
+	    sprintf((char *)buf, "\"%c\"", type);
+	    snmp_set_detail((char *)buf);
+	}
+        break;
+    }
+
+    SNMP_FREE(buf);
+    SET_SNMP_ERROR(result);
+    return result;
+
+  type_error:
+    {
+        char            error_msg[256];
+        char            undef_msg[32];
+        const char     *var_type;
+        switch (tp->type) {
+        case TYPE_OBJID:
+            var_type = "OBJECT IDENTIFIER";
+            break;
+        case TYPE_OCTETSTR:
+            var_type = "OCTET STRING";
+            break;
+        case TYPE_INTEGER:
+            var_type = "INTEGER";
+            break;
+        case TYPE_NETADDR:
+            var_type = "NetworkAddress";
+            break;
+        case TYPE_IPADDR:
+            var_type = "IpAddress";
+            break;
+        case TYPE_COUNTER:
+            var_type = "Counter32";
+            break;
+        case TYPE_GAUGE:
+            var_type = "Gauge32";
+            break;
+        case TYPE_TIMETICKS:
+            var_type = "Timeticks";
+            break;
+        case TYPE_OPAQUE:
+            var_type = "Opaque";
+            break;
+        case TYPE_NULL:
+            var_type = "Null";
+            break;
+        case TYPE_COUNTER64:
+            var_type = "Counter64";
+            break;
+        case TYPE_BITSTRING:
+            var_type = "BITS";
+            break;
+        case TYPE_NSAPADDRESS:
+            var_type = "NsapAddress";
+            break;
+        case TYPE_UINTEGER:
+            var_type = "UInteger";
+            break;
+        case TYPE_UNSIGNED32:
+            var_type = "Unsigned32";
+            break;
+        case TYPE_INTEGER32:
+            var_type = "Integer32";
+            break;
+        default:
+            sprintf(undef_msg, "TYPE_%d", tp->type);
+            var_type = undef_msg;
+        }
+        snprintf(error_msg, sizeof(error_msg),
+               "Type of attribute is %s, not %s", var_type, value);
+        error_msg[ sizeof(error_msg)-1 ] = 0;
+        result = SNMPERR_VAR_TYPE;
+        snmp_set_detail(error_msg);
+        goto out;
+    }
+  fail:
+    result = SNMPERR_VALUE;
+    snmp_set_detail(value);
+  out:
+    SET_SNMP_ERROR(result);
+    return result;
+}
+
+/*
+ * returns NULL or internal pointer to session
+ * use this pointer for the other snmp_sess* routines,
+ * which guarantee action will occur ONLY for this given session.
+ */
+void           *
+snmp_sess_pointer(netsnmp_session * session)
+{
+    struct session_list *slp;
+
+    snmp_res_lock(MT_LIBRARY_ID, MT_LIB_SESSION);
+    for (slp = Sessions; slp; slp = slp->next) {
+        if (slp->session == session) {
+            break;
+        }
+    }
+    snmp_res_unlock(MT_LIBRARY_ID, MT_LIB_SESSION);
+
+    if (slp == NULL) {
+        snmp_errno = SNMPERR_BAD_SESSION;       /*MTCRITICAL_RESOURCE */
+        return (NULL);
+    }
+    return ((void *) slp);
+}
+
+/*
+ * Input : an opaque pointer, returned by snmp_sess_open.
+ * returns NULL or pointer to session.
+ */
+netsnmp_session *
+snmp_sess_session(void *sessp)
+{
+    struct session_list *slp = (struct session_list *) sessp;
+    if (slp == NULL)
+        return (NULL);
+    return (slp->session);
+}
+
+
+
+/*
+ * snmp_sess_transport: takes an opaque pointer (as returned by
+ * snmp_sess_open or snmp_sess_pointer) and returns the corresponding
+ * netsnmp_transport pointer (or NULL if the opaque pointer does not correspond
+ * to an active internal session).  
+ */
+
+netsnmp_transport *
+snmp_sess_transport(void *sessp)
+{
+    struct session_list *slp = (struct session_list *) sessp;
+    if (slp == NULL) {
+        return NULL;
+    } else {
+        return slp->transport;
+    }
+}
+
+
+
+/*
+ * snmp_sess_transport_set: set the transport pointer for the opaque
+ * session pointer sp.  
+ */
+
+void
+snmp_sess_transport_set(void *sp, netsnmp_transport *t)
+{
+    struct session_list *slp = (struct session_list *) sp;
+    if (slp != NULL) {
+        slp->transport = t;
+    }
+}
+
+
+/*
+ * snmp_duplicate_objid: duplicates (mallocs) an objid based on the
+ * input objid 
+ */
+oid            *
+snmp_duplicate_objid(const oid * objToCopy, size_t objToCopyLen)
+{
+    oid            *returnOid = NULL;
+    if (objToCopy != NULL && objToCopyLen != 0) {
+        returnOid = (oid *) malloc(objToCopyLen * sizeof(oid));
+        if (returnOid) {
+            memmove(returnOid, objToCopy, objToCopyLen * sizeof(oid));
+        }
+    }
+    return returnOid;
+}
+
+/*
+ * generic statistics counter functions 
+ */
+static u_int    statistics[MAX_STATS];
+
+u_int
+snmp_increment_statistic(int which)
+{
+    if (which >= 0 && which < MAX_STATS) {
+        statistics[which]++;
+        return statistics[which];
+    }
+    return 0;
+}
+
+u_int
+snmp_increment_statistic_by(int which, int count)
+{
+    if (which >= 0 && which < MAX_STATS) {
+        statistics[which] += count;
+        return statistics[which];
+    }
+    return 0;
+}
+
+u_int
+snmp_get_statistic(int which)
+{
+    if (which >= 0 && which < MAX_STATS)
+        return statistics[which];
+    return 0;
+}
+
+void
+snmp_init_statistics(void)
+{
+    memset(statistics, 0, sizeof(statistics));
+}
diff -Naur tomato/release/src/router/snmp/snmplib/snmp_auth.c tomato121/release/src/router/snmp/snmplib/snmp_auth.c
--- tomato/release/src/router/snmp/snmplib/snmp_auth.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/snmplib/snmp_auth.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,240 @@
+/*
+ * snmp_auth.c
+ *
+ * Community name parse/build routines.
+ */
+/**********************************************************************
+    Copyright 1988, 1989, 1991, 1992 by Carnegie Mellon University
+
+			 All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of CMU not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+CMU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+CMU BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+******************************************************************/
+
+#include <net-snmp/net-snmp-config.h>
+
+#ifdef KINETICS
+#include "gw.h"
+#include "fp4/cmdmacro.h"
+#endif
+
+#include <stdio.h>
+#if HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+#include <sys/types.h>
+#if TIME_WITH_SYS_TIME
+# ifdef WIN32
+#  include <sys/timeb.h>
+# else
+#  include <sys/time.h>
+# endif
+# include <time.h>
+#else
+# if HAVE_SYS_TIME_H
+#  include <sys/time.h>
+# else
+#  include <time.h>
+# endif
+#endif
+#if HAVE_SYS_SELECT_H
+#include <sys/select.h>
+#endif
+#if HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+#if HAVE_ARPA_INET_H
+#include <arpa/inet.h>
+#endif
+
+#if HAVE_DMALLOC_H
+#include <dmalloc.h>
+#endif
+
+#if HAVE_WINSOCK_H
+#include <winsock.h>
+#endif
+
+#ifdef vms
+#include <in.h>
+#endif
+
+#include <net-snmp/types.h>
+#include <net-snmp/output_api.h>
+#include <net-snmp/utilities.h>
+
+#include <net-snmp/library/asn1.h>
+#include <net-snmp/library/snmp_api.h>
+#include <net-snmp/library/mib.h>
+#include <net-snmp/library/md5.h>
+#include <net-snmp/library/scapi.h>
+
+/*
+ * Globals.
+ */
+
+/*******************************************************************-o-******
+ * snmp_comstr_parse
+ *
+ * Parameters:
+ *	*data		(I)   Message.
+ *	*length		(I/O) Bytes left in message.
+ *	*psid		(O)   Community string.
+ *	*slen		(O)   Length of community string.
+ *	*version	(O)   Message version.
+ *      
+ * Returns:
+ *	Pointer to the remainder of data.
+ *
+ *
+ * Parse the header of a community string-based message such as that found
+ * in SNMPv1 and SNMPv2c.
+ */
+u_char         *
+snmp_comstr_parse(u_char * data,
+                  size_t * length,
+                  u_char * psid, size_t * slen, long *version)
+{
+    u_char          type;
+    long            ver;
+    size_t          origlen = *slen;
+
+    /*
+     * Message is an ASN.1 SEQUENCE.
+     */
+    data = asn_parse_sequence(data, length, &type,
+                              (ASN_SEQUENCE | ASN_CONSTRUCTOR),
+                              "auth message");
+    if (data == NULL) {
+        return NULL;
+    }
+
+    /*
+     * First field is the version.
+     */
+    DEBUGDUMPHEADER("recv", "SNMP version");
+    data = asn_parse_int(data, length, &type, &ver, sizeof(ver));
+    DEBUGINDENTLESS();
+    *version = ver;
+    if (data == NULL) {
+        ERROR_MSG("bad parse of version");
+        return NULL;
+    }
+
+    /*
+     * second field is the community string for SNMPv1 & SNMPv2c 
+     */
+    DEBUGDUMPHEADER("recv", "community string");
+    data = asn_parse_string(data, length, &type, psid, slen);
+    DEBUGINDENTLESS();
+    if (data == NULL) {
+        ERROR_MSG("bad parse of community");
+        return NULL;
+    }
+    psid[SNMP_MIN(*slen, origlen - 1)] = '\0';
+    return (u_char *) data;
+
+}                               /* end snmp_comstr_parse() */
+
+
+
+
+/*******************************************************************-o-******
+ * snmp_comstr_build
+ *
+ * Parameters:
+ *	*data
+ *	*length
+ *	*psid
+ *	*slen
+ *	*version
+ *	 messagelen
+ *      
+ * Returns:
+ *	Pointer into 'data' after built section.
+ *
+ *
+ * Build the header of a community string-based message such as that found
+ * in SNMPv1 and SNMPv2c.
+ *
+ * NOTE:	The length of the message will have to be inserted later,
+ *		if not known.
+ *
+ * NOTE:	Version is an 'int'.  (CMU had it as a long, but was passing
+ *		in a *int.  Grrr.)  Assign version to verfix and pass in
+ *		that to asn_build_int instead which expects a long.  -- WH
+ */
+u_char         *
+snmp_comstr_build(u_char * data,
+                  size_t * length,
+                  u_char * psid,
+                  size_t * slen, long *version, size_t messagelen)
+{
+    long            verfix = *version;
+    u_char         *h1 = data;
+    u_char         *h1e;
+    size_t          hlength = *length;
+
+
+    /*
+     * Build the the message wrapper (note length will be inserted later).
+     */
+    data =
+        asn_build_sequence(data, length,
+                           (u_char) (ASN_SEQUENCE | ASN_CONSTRUCTOR), 0);
+    if (data == NULL) {
+        return NULL;
+    }
+    h1e = data;
+
+
+    /*
+     * Store the version field.
+     */
+    data = asn_build_int(data, length,
+                         (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE |
+                                   ASN_INTEGER), &verfix, sizeof(verfix));
+    if (data == NULL) {
+        return NULL;
+    }
+
+
+    /*
+     * Store the community string.
+     */
+    data = asn_build_string(data, length,
+                            (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE |
+                                      ASN_OCTET_STR), psid,
+                            *(u_char *) slen);
+    if (data == NULL) {
+        return NULL;
+    }
+
+
+    /*
+     * Insert length.
+     */
+    asn_build_sequence(h1, &hlength,
+                       (u_char) (ASN_SEQUENCE | ASN_CONSTRUCTOR),
+                       data - h1e + messagelen);
+
+
+    return data;
+
+}                               /* end snmp_comstr_build() */
diff -Naur tomato/release/src/router/snmp/snmplib/snmp.c tomato121/release/src/router/snmp/snmplib/snmp.c
--- tomato/release/src/router/snmp/snmplib/snmp.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/snmplib/snmp.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,441 @@
+/*
+ * Simple Network Management Protocol (RFC 1067).
+ *
+ */
+/**********************************************************************
+	Copyright 1988, 1989, 1991, 1992 by Carnegie Mellon University
+
+                      All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its 
+documentation for any purpose and without fee is hereby granted, 
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in 
+supporting documentation, and that the name of CMU not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.  
+
+CMU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+CMU BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+******************************************************************/
+
+#include <net-snmp/net-snmp-config.h>
+#include <ctype.h>
+
+#ifdef KINETICS
+#include "gw.h"
+#include "ab.h"
+#include "inet.h"
+#include "fp4/cmdmacro.h"
+#include "fp4/pbuf.h"
+#include "glob.h"
+#endif
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include <sys/types.h>
+#ifdef HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+#if HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+#ifdef HAVE_SYS_SELECT_H
+#include <sys/select.h>
+#endif
+#if HAVE_WINSOCK_H
+#include <winsock.h>
+#endif
+#ifndef NULL
+#define NULL 0
+#endif
+
+#if HAVE_DMALLOC_H
+#include <dmalloc.h>
+#endif
+
+#ifdef vms
+#include <in.h>
+#endif
+
+#include <net-snmp/types.h>
+#include <net-snmp/output_api.h>
+
+#include <net-snmp/library/asn1.h>
+#include <net-snmp/library/snmp.h>      /* for "internal" definitions */
+#include <net-snmp/library/snmp_api.h>
+#include <net-snmp/library/mib.h>
+
+void
+xdump(const u_char * cp, size_t length, const char *prefix)
+{
+    int             col, count;
+    char           *buffer;
+
+    buffer = (char *) malloc(strlen(prefix) + 80);
+    if (!buffer) {
+        snmp_log(LOG_NOTICE,
+                 "xdump: malloc failed. packet-dump skipped\n");
+        return;
+    }
+
+    count = 0;
+    while (count < (int) length) {
+        strcpy(buffer, prefix);
+        sprintf(buffer + strlen(buffer), "%.4d: ", count);
+
+        for (col = 0; ((count + col) < (int) length) && col < 16; col++) {
+            sprintf(buffer + strlen(buffer), "%02X ", cp[count + col]);
+            if (col % 4 == 3)
+                strcat(buffer, " ");
+        }
+        for (; col < 16; col++) {       /* pad end of buffer with zeros */
+            strcat(buffer, "   ");
+            if (col % 4 == 3)
+                strcat(buffer, " ");
+        }
+        strcat(buffer, "  ");
+        for (col = 0; ((count + col) < (int) length) && col < 16; col++) {
+            buffer[col + 60] =
+                isprint(cp[count + col]) ? cp[count + col] : '.';
+        }
+        buffer[col + 60] = '\n';
+        buffer[col + 60 + 1] = 0;
+        snmp_log(LOG_DEBUG, "%s", buffer);
+        count += col;
+    }
+    snmp_log(LOG_DEBUG, "\n");
+    free(buffer);
+
+}                               /* end xdump() */
+
+/*
+ * u_char * snmp_parse_var_op(
+ * u_char *data              IN - pointer to the start of object
+ * oid *var_name             OUT - object id of variable 
+ * int *var_name_len         IN/OUT - length of variable name 
+ * u_char *var_val_type      OUT - type of variable (int or octet string) (one byte) 
+ * int *var_val_len          OUT - length of variable 
+ * u_char **var_val          OUT - pointer to ASN1 encoded value of variable 
+ * int *listlength          IN/OUT - number of valid bytes left in var_op_list 
+ */
+
+u_char         *
+snmp_parse_var_op(u_char * data,
+                  oid * var_name,
+                  size_t * var_name_len,
+                  u_char * var_val_type,
+                  size_t * var_val_len,
+                  u_char ** var_val, size_t * listlength)
+{
+    u_char          var_op_type;
+    size_t          var_op_len = *listlength;
+    u_char         *var_op_start = data;
+
+    data = asn_parse_sequence(data, &var_op_len, &var_op_type,
+                              (ASN_SEQUENCE | ASN_CONSTRUCTOR), "var_op");
+    if (data == NULL) {
+        /*
+         * msg detail is set 
+         */
+        return NULL;
+    }
+    DEBUGDUMPHEADER("recv", "Name");
+    data =
+        asn_parse_objid(data, &var_op_len, &var_op_type, var_name,
+                        var_name_len);
+    DEBUGINDENTLESS();
+    if (data == NULL) {
+        ERROR_MSG("No OID for variable");
+        return NULL;
+    }
+    if (var_op_type !=
+        (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE | ASN_OBJECT_ID))
+        return NULL;
+    *var_val = data;            /* save pointer to this object */
+    /*
+     * find out what type of object this is 
+     */
+    data = asn_parse_header(data, &var_op_len, var_val_type);
+    if (data == NULL) {
+        ERROR_MSG("No header for value");
+        return NULL;
+    }
+    /*
+     * XXX no check for type! 
+     */
+    *var_val_len = var_op_len;
+    data += var_op_len;
+    *listlength -= (int) (data - var_op_start);
+    return data;
+}
+
+/*
+ * u_char * snmp_build_var_op(
+ * u_char *data      IN - pointer to the beginning of the output buffer
+ * oid *var_name        IN - object id of variable 
+ * int *var_name_len    IN - length of object id 
+ * u_char var_val_type  IN - type of variable 
+ * int    var_val_len   IN - length of variable 
+ * u_char *var_val      IN - value of variable 
+ * int *listlength      IN/OUT - number of valid bytes left in
+ * output buffer 
+ */
+
+u_char         *
+snmp_build_var_op(u_char * data,
+                  oid * var_name,
+                  size_t * var_name_len,
+                  u_char var_val_type,
+                  size_t var_val_len,
+                  u_char * var_val, size_t * listlength)
+{
+    size_t          dummyLen, headerLen;
+    u_char         *dataPtr;
+
+    dummyLen = *listlength;
+    dataPtr = data;
+#if 0
+    data = asn_build_sequence(data, &dummyLen,
+                              (u_char) (ASN_SEQUENCE | ASN_CONSTRUCTOR),
+                              0);
+    if (data == NULL) {
+        return NULL;
+    }
+#endif
+    if (dummyLen < 4)
+        return NULL;
+    data += 4;
+    dummyLen -= 4;
+
+    headerLen = data - dataPtr;
+    *listlength -= headerLen;
+    DEBUGDUMPHEADER("send", "Name");
+    data = asn_build_objid(data, listlength,
+                           (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE |
+                                     ASN_OBJECT_ID), var_name,
+                           *var_name_len);
+    DEBUGINDENTLESS();
+    if (data == NULL) {
+        ERROR_MSG("Can't build OID for variable");
+        return NULL;
+    }
+    DEBUGDUMPHEADER("send", "Value");
+    switch (var_val_type) {
+    case ASN_INTEGER:
+        data = asn_build_int(data, listlength, var_val_type,
+                             (long *) var_val, var_val_len);
+        break;
+    case ASN_GAUGE:
+    case ASN_COUNTER:
+    case ASN_TIMETICKS:
+    case ASN_UINTEGER:
+        data = asn_build_unsigned_int(data, listlength, var_val_type,
+                                      (u_long *) var_val, var_val_len);
+        break;
+#ifdef OPAQUE_SPECIAL_TYPES
+    case ASN_OPAQUE_COUNTER64:
+    case ASN_OPAQUE_U64:
+#endif
+    case ASN_COUNTER64:
+        data = asn_build_unsigned_int64(data, listlength, var_val_type,
+                                        (struct counter64 *) var_val,
+                                        var_val_len);
+        break;
+    case ASN_OCTET_STR:
+    case ASN_IPADDRESS:
+    case ASN_OPAQUE:
+    case ASN_NSAP:
+        data = asn_build_string(data, listlength, var_val_type,
+                                var_val, var_val_len);
+        break;
+    case ASN_OBJECT_ID:
+        data = asn_build_objid(data, listlength, var_val_type,
+                               (oid *) var_val, var_val_len / sizeof(oid));
+        break;
+    case ASN_NULL:
+        data = asn_build_null(data, listlength, var_val_type);
+        break;
+    case ASN_BIT_STR:
+        data = asn_build_bitstring(data, listlength, var_val_type,
+                                   var_val, var_val_len);
+        break;
+    case SNMP_NOSUCHOBJECT:
+    case SNMP_NOSUCHINSTANCE:
+    case SNMP_ENDOFMIBVIEW:
+        data = asn_build_null(data, listlength, var_val_type);
+        break;
+#ifdef OPAQUE_SPECIAL_TYPES
+    case ASN_OPAQUE_FLOAT:
+        data = asn_build_float(data, listlength, var_val_type,
+                               (float *) var_val, var_val_len);
+        break;
+    case ASN_OPAQUE_DOUBLE:
+        data = asn_build_double(data, listlength, var_val_type,
+                                (double *) var_val, var_val_len);
+        break;
+    case ASN_OPAQUE_I64:
+        data = asn_build_signed_int64(data, listlength, var_val_type,
+                                      (struct counter64 *) var_val,
+                                      var_val_len);
+        break;
+#endif                          /* OPAQUE_SPECIAL_TYPES */
+    default:
+        ERROR_MSG("wrong type");
+        return NULL;
+    }
+    DEBUGINDENTLESS();
+    if (data == NULL) {
+        ERROR_MSG("Can't build value");
+        return NULL;
+    }
+    dummyLen = (data - dataPtr) - headerLen;
+
+    asn_build_sequence(dataPtr, &dummyLen,
+                       (u_char) (ASN_SEQUENCE | ASN_CONSTRUCTOR),
+                       dummyLen);
+    return data;
+}
+
+#ifdef USE_REVERSE_ASNENCODING
+int
+snmp_realloc_rbuild_var_op(u_char ** pkt, size_t * pkt_len,
+                           size_t * offset, int allow_realloc,
+                           const oid * var_name, size_t * var_name_len,
+                           u_char var_val_type,
+                           u_char * var_val, size_t var_val_len)
+{
+    size_t          start_offset = *offset;
+    int             rc = 0;
+
+    /*
+     * Encode the value.  
+     */
+    DEBUGDUMPHEADER("send", "Value");
+
+    switch (var_val_type) {
+    case ASN_INTEGER:
+        rc = asn_realloc_rbuild_int(pkt, pkt_len, offset, allow_realloc,
+                                    var_val_type, (long *) var_val,
+                                    var_val_len);
+        break;
+
+    case ASN_GAUGE:
+    case ASN_COUNTER:
+    case ASN_TIMETICKS:
+    case ASN_UINTEGER:
+        rc = asn_realloc_rbuild_unsigned_int(pkt, pkt_len, offset,
+                                             allow_realloc, var_val_type,
+                                             (u_long *) var_val,
+                                             var_val_len);
+        break;
+
+#ifdef OPAQUE_SPECIAL_TYPES
+    case ASN_OPAQUE_COUNTER64:
+    case ASN_OPAQUE_U64:
+#endif
+    case ASN_COUNTER64:
+        rc = asn_realloc_rbuild_unsigned_int64(pkt, pkt_len, offset,
+                                               allow_realloc, var_val_type,
+                                               (struct counter64 *)
+                                               var_val, var_val_len);
+        break;
+
+    case ASN_OCTET_STR:
+    case ASN_IPADDRESS:
+    case ASN_OPAQUE:
+    case ASN_NSAP:
+        rc = asn_realloc_rbuild_string(pkt, pkt_len, offset, allow_realloc,
+                                       var_val_type, var_val, var_val_len);
+        break;
+
+    case ASN_OBJECT_ID:
+        rc = asn_realloc_rbuild_objid(pkt, pkt_len, offset, allow_realloc,
+                                      var_val_type, (oid *) var_val,
+                                      var_val_len / sizeof(oid));
+        break;
+
+    case ASN_NULL:
+        rc = asn_realloc_rbuild_null(pkt, pkt_len, offset, allow_realloc,
+                                     var_val_type);
+        break;
+
+    case ASN_BIT_STR:
+        rc = asn_realloc_rbuild_bitstring(pkt, pkt_len, offset,
+                                          allow_realloc, var_val_type,
+                                          var_val, var_val_len);
+        break;
+
+    case SNMP_NOSUCHOBJECT:
+    case SNMP_NOSUCHINSTANCE:
+    case SNMP_ENDOFMIBVIEW:
+        rc = asn_realloc_rbuild_null(pkt, pkt_len, offset, allow_realloc,
+                                     var_val_type);
+        break;
+
+#ifdef OPAQUE_SPECIAL_TYPES
+    case ASN_OPAQUE_FLOAT:
+        rc = asn_realloc_rbuild_float(pkt, pkt_len, offset, allow_realloc,
+                                      var_val_type, (float *) var_val,
+                                      var_val_len);
+        break;
+
+    case ASN_OPAQUE_DOUBLE:
+        rc = asn_realloc_rbuild_double(pkt, pkt_len, offset, allow_realloc,
+                                       var_val_type, (double *) var_val,
+                                       var_val_len);
+        break;
+
+    case ASN_OPAQUE_I64:
+        rc = asn_realloc_rbuild_signed_int64(pkt, pkt_len, offset,
+                                             allow_realloc, var_val_type,
+                                             (struct counter64 *) var_val,
+                                             var_val_len);
+        break;
+#endif                          /* OPAQUE_SPECIAL_TYPES */
+    default:
+        ERROR_MSG("wrong type");
+        return 0;
+    }
+    DEBUGINDENTLESS();
+
+    if (rc == 0) {
+        ERROR_MSG("Can't build value");
+        return 0;
+    }
+
+    /*
+     * Build the OID.  
+     */
+
+    DEBUGDUMPHEADER("send", "Name");
+    rc = asn_realloc_rbuild_objid(pkt, pkt_len, offset, allow_realloc,
+                                  (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE |
+                                            ASN_OBJECT_ID), var_name,
+                                  *var_name_len);
+    DEBUGINDENTLESS();
+    if (rc == 0) {
+        ERROR_MSG("Can't build OID for variable");
+        return 0;
+    }
+
+    /*
+     * Build the sequence header.  
+     */
+
+    rc = asn_realloc_rbuild_sequence(pkt, pkt_len, offset, allow_realloc,
+                                     (u_char) (ASN_SEQUENCE |
+                                               ASN_CONSTRUCTOR),
+                                     *offset - start_offset);
+    return rc;
+}
+
+#endif                          /* USE_REVERSE_ASNENCODING */
diff -Naur tomato/release/src/router/snmp/snmplib/snmpCallbackDomain.c tomato121/release/src/router/snmp/snmplib/snmpCallbackDomain.c
--- tomato/release/src/router/snmp/snmplib/snmpCallbackDomain.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/snmplib/snmpCallbackDomain.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,505 @@
+#include <net-snmp/net-snmp-config.h>
+
+#include <stdio.h>
+#include <sys/types.h>
+#include <ctype.h>
+#include <errno.h>
+
+#if HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+#if HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#if HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#if HAVE_SYS_SOCKET_H
+#include <sys/socket.h>
+#endif
+#if HAVE_SYS_UN_H
+#include <sys/un.h>
+#endif
+#if HAVE_IO_H
+#include <io.h>
+#endif
+#if HAVE_FCNTL_H
+#include <fcntl.h>
+#endif
+
+#if HAVE_DMALLOC_H
+#include <dmalloc.h>
+#endif
+
+#include <net-snmp/types.h>
+#include <net-snmp/output_api.h>
+#include <net-snmp/config_api.h>
+#include <net-snmp/utilities.h>
+
+#include <net-snmp/library/snmp_transport.h>
+#include <net-snmp/library/snmpUnixDomain.h>
+#include <net-snmp/library/snmp_api.h>
+#include <net-snmp/library/snmp_client.h>
+#include <net-snmp/library/snmpCallbackDomain.h>
+
+#ifndef NETSNMP_STREAM_QUEUE_LEN
+#define NETSNMP_STREAM_QUEUE_LEN  5
+#endif
+
+static netsnmp_transport_list *trlist = NULL;
+
+static int      callback_count = 0;
+
+typedef struct callback_hack_s {
+    void           *orig_transport_data;
+    netsnmp_pdu    *pdu;
+} callback_hack;
+
+typedef struct callback_queue_s {
+    int             callback_num;
+    netsnmp_callback_pass *item;
+    struct callback_queue_s *next, *prev;
+} callback_queue;
+
+callback_queue *thequeue;
+
+static netsnmp_transport *
+find_transport_from_callback_num(int num)
+{
+    static netsnmp_transport_list *ptr;
+    for (ptr = trlist; ptr; ptr = ptr->next)
+        if (((netsnmp_callback_info *) ptr->transport->data)->
+            callback_num == num)
+            return ptr->transport;
+    return NULL;
+}
+
+static void
+callback_debug_pdu(const char *ourstring, netsnmp_pdu *pdu)
+{
+    netsnmp_variable_list *vb;
+    int             i = 1;
+    DEBUGMSGTL((ourstring,
+                "PDU: command = %d, errstat = %d, errindex = %d\n",
+                pdu->command, pdu->errstat, pdu->errindex));
+    for (vb = pdu->variables; vb; vb = vb->next_variable) {
+        DEBUGMSGTL((ourstring, "  var %d:", i++));
+        DEBUGMSGVAR((ourstring, vb));
+        DEBUGMSG((ourstring, "\n"));
+    }
+}
+
+void
+callback_push_queue(int num, netsnmp_callback_pass *item)
+{
+    callback_queue *newitem = SNMP_MALLOC_TYPEDEF(callback_queue);
+    callback_queue *ptr;
+
+    newitem->callback_num = num;
+    newitem->item = item;
+    if (thequeue) {
+        for (ptr = thequeue; ptr && ptr->next; ptr = ptr->next) {
+        }
+        ptr->next = newitem;
+        newitem->prev = ptr;
+    } else {
+        thequeue = newitem;
+    }
+    DEBUGIF("dump_send_callback_transport") {
+        callback_debug_pdu("dump_send_callback_transport", item->pdu);
+    }
+}
+
+netsnmp_callback_pass *
+callback_pop_queue(int num)
+{
+    netsnmp_callback_pass *cp;
+    callback_queue *ptr;
+
+    for (ptr = thequeue; ptr; ptr = ptr->next) {
+        if (ptr->callback_num == num) {
+            if (ptr->prev) {
+                ptr->prev->next = ptr->next;
+            } else {
+                thequeue = ptr->next;
+            }
+            if (ptr->next) {
+                ptr->next->prev = ptr->prev;
+            }
+            cp = ptr->item;
+            free(ptr);
+            DEBUGIF("dump_recv_callback_transport") {
+                callback_debug_pdu("dump_recv_callback_transport",
+                                   cp->pdu);
+            }
+            return cp;
+        }
+    }
+    return NULL;
+}
+
+/*
+ * Return a string representing the address in data, or else the "far end"
+ * address if data is NULL.  
+ */
+
+char *
+netsnmp_callback_fmtaddr(netsnmp_transport *t, void *data, int len)
+{
+    char buf[SPRINT_MAX_LEN];
+    netsnmp_callback_info *mystuff;
+
+    if (!t)
+        return strdup("callback: unknown");
+
+    mystuff = (netsnmp_callback_info *) t->data;
+
+    if (!mystuff)
+        return strdup("callback: unknown");
+
+    snprintf(buf, SPRINT_MAX_LEN, "callback: %d on fd %d",
+             mystuff->callback_num, mystuff->pipefds[0]);
+    return strdup(buf);
+}
+
+
+
+/*
+ * You can write something into opaque that will subsequently get passed back 
+ * to your send function if you like.  For instance, you might want to
+ * remember where a PDU came from, so that you can send a reply there...  
+ */
+
+int
+netsnmp_callback_recv(netsnmp_transport *t, void *buf, int size,
+		      void **opaque, int *olength)
+{
+    int rc = -1;
+    char newbuf[1];
+    netsnmp_callback_info *mystuff = (netsnmp_callback_info *) t->data;
+
+    DEBUGMSGTL(("transport_callback", "hook_recv enter\n"));
+
+    while (rc < 0) {
+	rc = read(mystuff->pipefds[0], newbuf, 1);
+	if (rc < 0 && errno != EINTR) {
+	    break;
+	}
+    }
+
+    if (mystuff->linkedto) {
+        /*
+         * we're the client.  We don't need to do anything. 
+         */
+    } else {
+        /*
+         * malloc the space here, but it's filled in by
+         * snmp_callback_created_pdu() below 
+         */
+        int            *returnnum = (int *) calloc(1, sizeof(int));
+        *opaque = returnnum;
+        *olength = sizeof(int);
+    }
+    DEBUGMSGTL(("transport_callback", "hook_recv exit\n"));
+    return rc;
+}
+
+
+
+int
+netsnmp_callback_send(netsnmp_transport *t, void *buf, int size,
+		      void **opaque, int *olength)
+{
+    int from, rc = -1;
+    netsnmp_callback_info *mystuff = (netsnmp_callback_info *) t->data;
+    netsnmp_callback_pass *cp;
+
+    /*
+     * extract the pdu from the hacked buffer 
+     */
+    netsnmp_transport *other_side;
+    callback_hack  *ch = (callback_hack *) * opaque;
+    netsnmp_pdu    *pdu = ch->pdu;
+    *opaque = ch->orig_transport_data;
+    free(ch);
+
+    DEBUGMSGTL(("transport_callback", "hook_send enter\n"));
+
+    cp = SNMP_MALLOC_TYPEDEF(netsnmp_callback_pass);
+    if (!cp)
+        return -1;
+
+    cp->pdu = snmp_clone_pdu(pdu);
+    if (cp->pdu->transport_data) {
+        /*
+         * not needed and not properly freed later 
+         */
+        SNMP_FREE(cp->pdu->transport_data);
+    }
+
+    if (cp->pdu->flags & UCD_MSG_FLAG_EXPECT_RESPONSE)
+        cp->pdu->flags ^= UCD_MSG_FLAG_EXPECT_RESPONSE;
+
+    /*
+     * push the sent pdu onto the stack 
+     */
+    /*
+     * AND send a bogus byte to the remote callback receiver's pipe 
+     */
+    if (mystuff->linkedto) {
+        /*
+         * we're the client, send it to the parent 
+         */
+        cp->return_transport_num = mystuff->callback_num;
+
+        other_side = find_transport_from_callback_num(mystuff->linkedto);
+        if (!other_side)
+            return -1;
+
+	while (rc < 0) {
+	    rc = write(((netsnmp_callback_info *)other_side->data)->pipefds[1],
+		       " ", 1);
+	    if (rc < 0 && errno != EINTR) {
+		break;
+	    }
+	}
+        callback_push_queue(mystuff->linkedto, cp);
+        /*
+         * we don't need the transport data any more 
+         */
+        if (*opaque) {
+            free(*opaque);
+            *opaque = NULL;
+        }
+    } else {
+        /*
+         * we're the server, send it to the person that sent us the request 
+         */
+        from = **((int **) opaque);
+        /*
+         * we don't need the transport data any more 
+         */
+        if (*opaque) {
+            free(*opaque);
+            *opaque = NULL;
+        }
+        other_side = find_transport_from_callback_num(from);
+        if (!other_side)
+            return -1;
+	while (rc < 0) {
+	    rc = write(((netsnmp_callback_info *)other_side->data)->pipefds[1],
+		       " ", 1);
+	    if (rc < 0 && errno != EINTR) {
+		break;
+	    }
+	}
+        callback_push_queue(from, cp);
+    }
+
+    DEBUGMSGTL(("transport_callback", "hook_send exit\n"));
+    return 0;
+}
+
+
+
+int
+netsnmp_callback_close(netsnmp_transport *t)
+{
+    int             rc;
+    netsnmp_callback_info *mystuff = (netsnmp_callback_info *) t->data;
+    DEBUGMSGTL(("transport_callback", "hook_close enter\n"));
+
+    rc = close(mystuff->pipefds[0]);
+    rc = close(mystuff->pipefds[1]);
+
+    netsnmp_transport_remove_from_list(&trlist, t);
+
+    DEBUGMSGTL(("transport_callback", "hook_close exit\n"));
+    return rc;
+}
+
+
+
+int
+netsnmp_callback_accept(netsnmp_transport *t)
+{
+    DEBUGMSGTL(("transport_callback", "hook_accept enter\n"));
+    DEBUGMSGTL(("transport_callback", "hook_accept exit\n"));
+    return 0;
+}
+
+
+
+/*
+ * Open a Callback-domain transport for SNMP.  Local is TRUE if addr
+ * is the local address to bind to (i.e. this is a server-type
+ * session); otherwise addr is the remote address to send things to
+ * (and we make up a temporary name for the local end of the
+ * connection).  
+ */
+
+netsnmp_transport *
+netsnmp_callback_transport(int to)
+{
+
+    netsnmp_transport *t = NULL;
+    netsnmp_callback_info *mydata;
+    int             rc;
+
+    /*
+     * transport 
+     */
+    t = SNMP_MALLOC_TYPEDEF(netsnmp_transport);
+    if (!t)
+        return NULL;
+
+    /*
+     * our stuff 
+     */
+    mydata = SNMP_MALLOC_TYPEDEF(netsnmp_callback_info);
+    mydata->linkedto = to;
+    mydata->callback_num = ++callback_count;
+    mydata->data = NULL;
+    t->data = mydata;
+
+#ifdef WIN32
+    rc = _pipe(mydata->pipefds, 1024, O_BINARY);
+#else
+    rc = pipe(mydata->pipefds);
+#endif
+    t->sock = mydata->pipefds[0];
+
+    if (rc) {
+        free(mydata);
+        free(t);
+        return NULL;
+    }
+
+    t->f_recv    = netsnmp_callback_recv;
+    t->f_send    = netsnmp_callback_send;
+    t->f_close   = netsnmp_callback_close;
+    t->f_accept  = netsnmp_callback_accept;
+    t->f_fmtaddr = netsnmp_callback_fmtaddr;
+
+    netsnmp_transport_add_to_list(&trlist, t);
+
+    if (to)
+        DEBUGMSGTL(("transport_callback", "initialized %d linked to %d\n",
+                    mydata->callback_num, to));
+    else
+        DEBUGMSGTL(("transport_callback",
+                    "initialized master listening on %d\n",
+                    mydata->callback_num));
+    return t;
+}
+
+int
+netsnmp_callback_hook_parse(netsnmp_session * sp,
+                            netsnmp_pdu *pdu,
+                            u_char * packetptr, size_t len)
+{
+    if (SNMP_MSG_RESPONSE == pdu->command ||
+        SNMP_MSG_REPORT == pdu->command)
+        pdu->flags |= UCD_MSG_FLAG_RESPONSE_PDU;
+    else
+        pdu->flags &= (~UCD_MSG_FLAG_RESPONSE_PDU);
+
+    return SNMP_ERR_NOERROR;
+}
+
+int
+netsnmp_callback_hook_build(netsnmp_session * sp,
+                            netsnmp_pdu *pdu, u_char * ptk, size_t * len)
+{
+    /*
+     * very gross hack, as this is passed later to the transport_send
+     * function 
+     */
+    callback_hack  *ch = SNMP_MALLOC_TYPEDEF(callback_hack);
+    DEBUGMSGTL(("transport_callback", "hook_build enter\n"));
+    ch->pdu = pdu;
+    ch->orig_transport_data = pdu->transport_data;
+    pdu->transport_data = ch;
+    switch (pdu->command) {
+    case SNMP_MSG_RESPONSE:
+    case SNMP_MSG_TRAP:
+    case SNMP_MSG_TRAP2:
+        pdu->flags &= (~UCD_MSG_FLAG_EXPECT_RESPONSE);
+        break;
+    }
+    *len = 1;
+    DEBUGMSGTL(("transport_callback", "hook_build exit\n"));
+    return 1;
+}
+
+int
+netsnmp_callback_check_packet(u_char * pkt, size_t len)
+{
+    return 1;
+}
+
+netsnmp_pdu    *
+netsnmp_callback_create_pdu(netsnmp_transport *transport,
+                            void *opaque, size_t olength)
+{
+    netsnmp_pdu    *pdu;
+    netsnmp_callback_pass *cp =
+        callback_pop_queue(((netsnmp_callback_info *) transport->data)->
+                           callback_num);
+    if (!cp)
+        return NULL;
+    pdu = cp->pdu;
+    pdu->transport_data = opaque;
+    pdu->transport_data_length = olength;
+    if (opaque)                 /* if created, we're the server */
+        *((int *) opaque) = cp->return_transport_num;
+    free(cp);
+    return pdu;
+}
+
+netsnmp_session *
+netsnmp_callback_open(int attach_to,
+                      int (*return_func) (int op,
+                                          netsnmp_session * session,
+                                          int reqid, netsnmp_pdu *pdu,
+                                          void *magic),
+                      int (*fpre_parse) (netsnmp_session *,
+                                         struct netsnmp_transport_s *,
+                                         void *, int),
+                      int (*fpost_parse) (netsnmp_session *, netsnmp_pdu *,
+                                          int))
+{
+    netsnmp_session callback_sess, *callback_ss;
+    netsnmp_transport *callback_tr;
+
+    callback_tr = netsnmp_callback_transport(attach_to);
+    snmp_sess_init(&callback_sess);
+    callback_sess.callback = return_func;
+    if (attach_to) {
+        /*
+         * client 
+         */
+        /*
+         * trysess.community = (u_char *) callback_ss; 
+         */
+    } else {
+        callback_sess.isAuthoritative = SNMP_SESS_AUTHORITATIVE;
+    }
+    callback_sess.remote_port = 0;
+    callback_sess.retries = 0;
+    callback_sess.timeout = 30000000;
+    callback_sess.version = SNMP_DEFAULT_VERSION;       /* (mostly) bogus */
+    callback_ss = snmp_add_full(&callback_sess, callback_tr,
+                                fpre_parse,
+                                netsnmp_callback_hook_parse, fpost_parse,
+                                netsnmp_callback_hook_build,
+                                NULL,
+                                netsnmp_callback_check_packet,
+                                netsnmp_callback_create_pdu);
+    if (callback_ss)
+        callback_ss->local_port =
+            ((netsnmp_callback_info *) callback_tr->data)->callback_num;
+    return callback_ss;
+}
diff -Naur tomato/release/src/router/snmp/snmplib/snmp_client.c tomato121/release/src/router/snmp/snmplib/snmp_client.c
--- tomato/release/src/router/snmp/snmplib/snmp_client.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/snmplib/snmp_client.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,921 @@
+/*
+ * snmp_client.c - a toolkit of common functions for an SNMP client.
+ *
+ */
+/**********************************************************************
+	Copyright 1988, 1989, 1991, 1992 by Carnegie Mellon University
+
+                      All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of CMU not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+CMU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+CMU BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+******************************************************************/
+
+#include <net-snmp/net-snmp-config.h>
+
+#include <stdio.h>
+#include <errno.h>
+#if HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#if HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+#if HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#include <sys/types.h>
+#if TIME_WITH_SYS_TIME
+# ifdef WIN32
+#  include <sys/timeb.h>
+# else
+#  include <sys/time.h>
+# endif
+# include <time.h>
+#else
+# if HAVE_SYS_TIME_H
+#  include <sys/time.h>
+# else
+#  include <time.h>
+# endif
+#endif
+#if HAVE_SYS_PARAM_H
+#include <sys/param.h>
+#endif
+#if HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+#if HAVE_ARPA_INET_H
+#include <arpa/inet.h>
+#endif
+#if HAVE_SYS_SELECT_H
+#include <sys/select.h>
+#endif
+
+#if HAVE_DMALLOC_H
+#include <dmalloc.h>
+#endif
+
+#if HAVE_WINSOCK_H
+#include <winsock.h>
+#endif
+
+#include <net-snmp/types.h>
+
+#include <net-snmp/library/snmp_api.h>
+#include <net-snmp/library/snmp_client.h>
+#include <net-snmp/library/snmp_secmod.h>
+#include <net-snmp/library/mib.h>
+
+
+#ifndef BSD4_3
+#define BSD4_2
+#endif
+
+#ifndef FD_SET
+
+typedef long    fd_mask;
+#define NFDBITS	(sizeof(fd_mask) * NBBY)        /* bits per mask */
+
+#define	FD_SET(n, p)	((p)->fds_bits[(n)/NFDBITS] |= (1 << ((n) % NFDBITS)))
+#define	FD_CLR(n, p)	((p)->fds_bits[(n)/NFDBITS] &= ~(1 << ((n) % NFDBITS)))
+#define	FD_ISSET(n, p)	((p)->fds_bits[(n)/NFDBITS] & (1 << ((n) % NFDBITS)))
+#define FD_ZERO(p)	memset((p), 0, sizeof(*(p)))
+#endif
+
+/*
+ * Prototype definitions 
+ */
+static int      snmp_synch_input(int op, netsnmp_session * session,
+                                 int reqid, netsnmp_pdu *pdu, void *magic);
+
+netsnmp_pdu    *
+snmp_pdu_create(int command)
+{
+    netsnmp_pdu    *pdu;
+
+    pdu = (netsnmp_pdu *) calloc(1, sizeof(netsnmp_pdu));
+    if (pdu) {
+        pdu->version = SNMP_DEFAULT_VERSION;
+        pdu->command = command;
+        pdu->errstat = SNMP_DEFAULT_ERRSTAT;
+        pdu->errindex = SNMP_DEFAULT_ERRINDEX;
+        pdu->securityModel = SNMP_DEFAULT_SECMODEL;
+        pdu->transport_data = NULL;
+        pdu->transport_data_length = 0;
+        pdu->securityNameLen = 0;
+        pdu->contextNameLen = 0;
+        pdu->time = 0;
+        pdu->reqid = snmp_get_next_reqid();
+        pdu->msgid = snmp_get_next_msgid();
+    }
+    return pdu;
+
+}
+
+
+/*
+ * Add a null variable with the requested name to the end of the list of
+ * variables for this pdu.
+ */
+netsnmp_variable_list *
+snmp_add_null_var(netsnmp_pdu *pdu, const oid * name, size_t name_length)
+{
+    return snmp_pdu_add_variable(pdu, name, name_length, ASN_NULL, NULL, 0);
+}
+
+
+static int
+snmp_synch_input(int op,
+                 netsnmp_session * session,
+                 int reqid, netsnmp_pdu *pdu, void *magic)
+{
+    struct synch_state *state = (struct synch_state *) magic;
+    int             rpt_type;
+
+    if (reqid != state->reqid && pdu && pdu->command != SNMP_MSG_REPORT) {
+        return 0;
+    }
+
+    state->waiting = 0;
+
+    if (op == NETSNMP_CALLBACK_OP_RECEIVED_MESSAGE) {
+        if (pdu->command == SNMP_MSG_REPORT) {
+            rpt_type = snmpv3_get_report_type(pdu);
+            if (SNMPV3_IGNORE_UNAUTH_REPORTS ||
+                rpt_type == SNMPERR_NOT_IN_TIME_WINDOW) {
+                state->waiting = 1;
+            }
+            state->pdu = NULL;
+            state->status = STAT_ERROR;
+            session->s_snmp_errno = rpt_type;
+            SET_SNMP_ERROR(rpt_type);
+        } else if (pdu->command == SNMP_MSG_RESPONSE) {
+            /*
+             * clone the pdu to return to snmp_synch_response 
+             */
+            state->pdu = snmp_clone_pdu(pdu);
+            state->status = STAT_SUCCESS;
+            session->s_snmp_errno = SNMPERR_SUCCESS;
+        }
+    } else if (op == NETSNMP_CALLBACK_OP_TIMED_OUT) {
+        state->pdu = NULL;
+        state->status = STAT_TIMEOUT;
+        session->s_snmp_errno = SNMPERR_TIMEOUT;
+        SET_SNMP_ERROR(SNMPERR_TIMEOUT);
+    } else if (op == NETSNMP_CALLBACK_OP_DISCONNECT) {
+        state->pdu = NULL;
+        state->status = STAT_ERROR;
+        session->s_snmp_errno = SNMPERR_ABORT;
+        SET_SNMP_ERROR(SNMPERR_ABORT);
+    }
+
+    return 1;
+}
+
+
+/*
+ * Clone an SNMP variable data structure.
+ * Sets pointers to structure private storage, or
+ * allocates larger object identifiers and values as needed.
+ *
+ * Caller must make list association for cloned variable.
+ *
+ * Returns 0 if successful.
+ */
+int
+snmp_clone_var(netsnmp_variable_list * var, netsnmp_variable_list * newvar)
+{
+    if (!newvar || !var)
+        return 1;
+
+    memmove(newvar, var, sizeof(netsnmp_variable_list));
+    newvar->next_variable = 0;
+    newvar->name = 0;
+    newvar->val.string = 0;
+    newvar->data = 0;
+    newvar->dataFreeHook = 0;
+    newvar->index = 0;
+
+    /*
+     * Clone the object identifier and the value.
+     * Allocate memory iff original will not fit into local storage.
+     */
+    if (snmp_set_var_objid(newvar, var->name, var->name_length))
+        return 1;
+
+    /*
+     * need a pointer and a length to copy a string value. 
+     */
+    if (var->val.string && var->val_len) {
+        if (var->val.string != &var->buf[0]) {
+            if (var->val_len <= sizeof(var->buf))
+                newvar->val.string = newvar->buf;
+            else {
+                newvar->val.string = (u_char *) malloc(var->val_len);
+                if (!newvar->val.string)
+                    return 1;
+            }
+            memmove(newvar->val.string, var->val.string, var->val_len);
+        } else {                /* fix the pointer to new local store */
+            newvar->val.string = newvar->buf;
+        }
+    } else {
+        newvar->val.string = 0;
+        newvar->val_len = 0;
+    }
+
+    return 0;
+}
+
+
+/*
+ * Possibly make a copy of source memory buffer.
+ * Will reset destination pointer if source pointer is NULL.
+ * Returns 0 if successful, 1 if memory allocation fails.
+ */
+int
+snmp_clone_mem(void **dstPtr, void *srcPtr, unsigned len)
+{
+    *dstPtr = 0;
+    if (srcPtr) {
+        *dstPtr = malloc(len + 1);
+        if (!*dstPtr) {
+            return 1;
+        }
+        memmove(*dstPtr, srcPtr, len);
+        /*
+         * this is for those routines that expect 0-terminated strings!!!
+         * someone should rather have called strdup
+         */
+        ((char *) *dstPtr)[len] = 0;
+    }
+    return 0;
+}
+
+
+/*
+ * Walks through a list of varbinds and frees and allocated memory,
+ * restoring pointers to local buffers
+ */
+void
+snmp_reset_var_buffers(netsnmp_variable_list * var)
+{
+    while (var) {
+        if (var->name != var->name_loc) {
+            free(var->name);
+            var->name = var->name_loc;
+            var->name_length = 0;
+        }
+        if (var->val.string != var->buf) {
+            free(var->val.string);
+            var->val.string = var->buf;
+            var->val_len = 0;
+        }
+        var = var->next_variable;
+    }
+}
+
+/*
+ * Creates and allocates a clone of the input PDU,
+ * but does NOT copy the variables.
+ * This function should be used with another function,
+ * such as _copy_pdu_vars.
+ *
+ * Returns a pointer to the cloned PDU if successful.
+ * Returns 0 if failure.
+ */
+static
+netsnmp_pdu    *
+_clone_pdu_header(netsnmp_pdu *pdu)
+{
+    netsnmp_pdu    *newpdu;
+    struct snmp_secmod_def *sptr;
+
+    newpdu = (netsnmp_pdu *) malloc(sizeof(netsnmp_pdu));
+    if (!newpdu)
+        return 0;
+    memmove(newpdu, pdu, sizeof(netsnmp_pdu));
+
+    /*
+     * reset copied pointers if copy fails 
+     */
+    newpdu->variables = 0;
+    newpdu->enterprise = 0;
+    newpdu->community = 0;
+    newpdu->securityEngineID = 0;
+    newpdu->securityName = 0;
+    newpdu->contextEngineID = 0;
+    newpdu->contextName = 0;
+    newpdu->transport_data = 0;
+
+    /*
+     * copy buffers individually. If any copy fails, all are freed. 
+     */
+    if (snmp_clone_mem((void **) &newpdu->enterprise, pdu->enterprise,
+                       sizeof(oid) * pdu->enterprise_length) ||
+        snmp_clone_mem((void **) &newpdu->community, pdu->community,
+                       pdu->community_len) ||
+        snmp_clone_mem((void **) &newpdu->contextEngineID,
+                       pdu->contextEngineID, pdu->contextEngineIDLen)
+        || snmp_clone_mem((void **) &newpdu->securityEngineID,
+                          pdu->securityEngineID, pdu->securityEngineIDLen)
+        || snmp_clone_mem((void **) &newpdu->contextName, pdu->contextName,
+                          pdu->contextNameLen)
+        || snmp_clone_mem((void **) &newpdu->securityName,
+                          pdu->securityName, pdu->securityNameLen)
+        || snmp_clone_mem((void **) &newpdu->transport_data,
+                          pdu->transport_data,
+                          pdu->transport_data_length)) {
+        snmp_free_pdu(newpdu);
+        return 0;
+    }
+    if ((sptr = find_sec_mod(newpdu->securityModel)) != NULL &&
+        sptr->pdu_clone != NULL) {
+        /*
+         * call security model if it needs to know about this 
+         */
+        (*sptr->pdu_clone) (pdu, newpdu);
+    }
+
+    return newpdu;
+}
+
+static
+netsnmp_variable_list *
+_copy_varlist(netsnmp_variable_list * var,      /* source varList */
+              int errindex,     /* index of variable to drop (if any) */
+              int copy_count)
+{                               /* !=0 number variables to copy */
+    netsnmp_variable_list *newhead, *newvar, *oldvar;
+    int             ii = 0;
+
+    newhead = NULL;
+    oldvar = NULL;
+
+    while (var && (copy_count-- > 0)) {
+        /*
+         * Drop the specified variable (if applicable) 
+         */
+        if (++ii == errindex) {
+            var = var->next_variable;
+            continue;
+        }
+
+        /*
+         * clone the next variable. Cleanup if alloc fails 
+         */
+        newvar = (netsnmp_variable_list *)
+            malloc(sizeof(netsnmp_variable_list));
+        if (snmp_clone_var(var, newvar)) {
+            if (newvar)
+                free((char *) newvar);
+            snmp_free_varbind(newhead);
+            return 0;
+        }
+
+        /*
+         * add cloned variable to new list  
+         */
+        if (0 == newhead)
+            newhead = newvar;
+        if (oldvar)
+            oldvar->next_variable = newvar;
+        oldvar = newvar;
+
+        var = var->next_variable;
+    }
+    return newhead;
+}
+
+
+/*
+ * Copy some or all variables from source PDU to target PDU.
+ * This function consolidates many of the needs of PDU variables:
+ * Clone PDU : copy all the variables.
+ * Split PDU : skip over some variables to copy other variables.
+ * Fix PDU   : remove variable associated with error index.
+ *
+ * Designed to work with _clone_pdu_header.
+ *
+ * If drop_err is set, drop any variable associated with errindex.
+ * If skip_count is set, skip the number of variable in pdu's list.
+ * While copy_count is greater than zero, copy pdu variables to newpdu.
+ *
+ * If an error occurs, newpdu is freed and pointer is set to 0.
+ *
+ * Returns a pointer to the cloned PDU if successful.
+ * Returns 0 if failure.
+ */
+static
+netsnmp_pdu    *
+_copy_pdu_vars(netsnmp_pdu *pdu,        /* source PDU */
+               netsnmp_pdu *newpdu,     /* target PDU */
+               int drop_err,    /* !=0 drop errored variable */
+               int skip_count,  /* !=0 number of variables to skip */
+               int copy_count)
+{                               /* !=0 number of variables to copy */
+    netsnmp_variable_list *var, *oldvar;
+    int             ii, copied, drop_idx;
+
+    if (!newpdu)
+        return 0;               /* where is PDU to copy to ? */
+
+    if (drop_err)
+        drop_idx = pdu->errindex - skip_count;
+    else
+        drop_idx = 0;
+
+    var = pdu->variables;
+    while (var && (skip_count-- > 0))   /* skip over pdu variables */
+        var = var->next_variable;
+
+    oldvar = 0;
+    ii = 0;
+    copied = 0;
+    if (pdu->flags & UCD_MSG_FLAG_FORCE_PDU_COPY)
+        copied = 1;             /* We're interested in 'empty' responses too */
+
+    newpdu->variables = _copy_varlist(var, drop_idx, copy_count);
+    if (newpdu->variables)
+        copied = 1;
+
+#if ALSO_TEMPORARILY_DISABLED
+    /*
+     * Error if bad errindex or if target PDU has no variables copied 
+     */
+    if ((drop_err && (ii < pdu->errindex))
+#if TEMPORARILY_DISABLED
+        /*
+         * SNMPv3 engineID probes are allowed to be empty.
+         * See the comment in snmp_api.c for further details 
+         */
+        || copied == 0
+#endif
+        ) {
+        snmp_free_pdu(newpdu);
+        return 0;
+    }
+#endif
+    return newpdu;
+}
+
+
+/*
+ * Creates (allocates and copies) a clone of the input PDU.
+ * If drop_err is set, don't copy any variable associated with errindex.
+ * This function is called by snmp_clone_pdu and snmp_fix_pdu.
+ *
+ * Returns a pointer to the cloned PDU if successful.
+ * Returns 0 if failure.
+ */
+static
+netsnmp_pdu    *
+_clone_pdu(netsnmp_pdu *pdu, int drop_err)
+{
+    netsnmp_pdu    *newpdu;
+    newpdu = _clone_pdu_header(pdu);
+    newpdu = _copy_pdu_vars(pdu, newpdu, drop_err, 0, 10000);   /* skip none, copy all */
+
+    return newpdu;
+}
+
+
+/*
+ * This function will clone a full varbind list
+ *
+ * Returns a pointer to the cloned PDU if successful.
+ * Returns 0 if failure
+ */
+netsnmp_variable_list *
+snmp_clone_varbind(netsnmp_variable_list * varlist)
+{
+    return _copy_varlist(varlist, 0, 10000);    /* skip none, copy all */
+}
+
+/*
+ * This function will clone a PDU including all of its variables.
+ *
+ * Returns a pointer to the cloned PDU if successful.
+ * Returns 0 if failure
+ */
+netsnmp_pdu    *
+snmp_clone_pdu(netsnmp_pdu *pdu)
+{
+    return _clone_pdu(pdu, 0);  /* copies all variables */
+}
+
+
+/*
+ * This function will clone a PDU including some of its variables.
+ *
+ * If skip_count is not zero, it defines the number of variables to skip.
+ * If copy_count is not zero, it defines the number of variables to copy.
+ *
+ * Returns a pointer to the cloned PDU if successful.
+ * Returns 0 if failure.
+ */
+netsnmp_pdu    *
+snmp_split_pdu(netsnmp_pdu *pdu, int skip_count, int copy_count)
+{
+    netsnmp_pdu    *newpdu;
+    newpdu = _clone_pdu_header(pdu);
+    newpdu = _copy_pdu_vars(pdu, newpdu, 0,     /* don't drop any variables */
+                            skip_count, copy_count);
+
+    return newpdu;
+}
+
+
+/*
+ * If there was an error in the input pdu, creates a clone of the pdu
+ * that includes all the variables except the one marked by the errindex.
+ * The command is set to the input command and the reqid, errstat, and
+ * errindex are set to default values.
+ * If the error status didn't indicate an error, the error index didn't
+ * indicate a variable, the pdu wasn't a get response message, or there
+ * would be no remaining variables, this function will return 0.
+ * If everything was successful, a pointer to the fixed cloned pdu will
+ * be returned.
+ */
+netsnmp_pdu    *
+snmp_fix_pdu(netsnmp_pdu *pdu, int command)
+{
+    netsnmp_pdu    *newpdu;
+
+    if ((pdu->command != SNMP_MSG_RESPONSE)
+        || (pdu->errstat == SNMP_ERR_NOERROR)
+        || (0 == pdu->variables)
+        || (pdu->errindex <= 0)) {
+        return 0;               /* pre-condition tests fail */
+    }
+
+    newpdu = _clone_pdu(pdu, 1);        /* copies all except errored variable */
+    if (!newpdu)
+        return 0;
+    if (!newpdu->variables) {
+        snmp_free_pdu(newpdu);
+        return 0;               /* no variables. "should not happen" */
+    }
+    newpdu->command = command;
+    newpdu->reqid = snmp_get_next_reqid();
+    newpdu->msgid = snmp_get_next_msgid();
+    newpdu->errstat = SNMP_DEFAULT_ERRSTAT;
+    newpdu->errindex = SNMP_DEFAULT_ERRINDEX;
+
+    return newpdu;
+}
+
+
+/*
+ * Returns the number of variables bound to a PDU structure
+ */
+unsigned long
+snmp_varbind_len(netsnmp_pdu *pdu)
+{
+    register netsnmp_variable_list *vars;
+    unsigned long   retVal = 0;
+    if (pdu)
+        for (vars = pdu->variables; vars; vars = vars->next_variable) {
+            retVal++;
+        }
+
+    return retVal;
+}
+
+/*
+ * Add object identifier name to SNMP variable.
+ * If the name is large, additional memory is allocated.
+ * Returns 0 if successful.
+ */
+
+int
+snmp_set_var_objid(netsnmp_variable_list * vp,
+                   const oid * objid, size_t name_length)
+{
+    size_t          len = sizeof(oid) * name_length;
+
+    if (vp->name != vp->name_loc && vp->name != NULL &&
+        vp->name_length > (sizeof(vp->name_loc) / sizeof(oid))) {
+        /*
+         * Probably previously-allocated "big storage".  Better free it
+         * else memory leaks possible.  
+         */
+        free(vp->name);
+    }
+
+    /*
+     * use built-in storage for smaller values 
+     */
+    if (len <= sizeof(vp->name_loc)) {
+        vp->name = vp->name_loc;
+    } else {
+        vp->name = (oid *) malloc(len);
+        if (!vp->name)
+            return 1;
+    }
+    if (objid)
+        memmove(vp->name, objid, len);
+    vp->name_length = name_length;
+    return 0;
+}
+
+int
+snmp_set_var_typed_value(netsnmp_variable_list * newvar, u_char type,
+                         const u_char * val_str, size_t val_len)
+{
+    newvar->type = type;
+    return snmp_set_var_value(newvar, val_str, val_len);
+}
+
+int
+count_varbinds(netsnmp_variable_list * var_ptr)
+{
+    int             count = 0;
+
+    for (; var_ptr != NULL; var_ptr = var_ptr->next_variable)
+        count++;
+
+    return count;
+}
+
+int
+count_varbinds_of_type(netsnmp_variable_list * var_ptr, u_char type)
+{
+    int             count = 0;
+
+    for (; var_ptr != NULL; var_ptr = var_ptr->next_variable)
+        if (var_ptr->type == type)
+            count++;
+
+    return count;
+}
+
+netsnmp_variable_list *
+find_varbind_of_type(netsnmp_variable_list * var_ptr, u_char type)
+{
+    for (; var_ptr != NULL && var_ptr->type != type;
+         var_ptr = var_ptr->next_variable);
+
+    return var_ptr;
+}
+
+/*
+ * Add some value to SNMP variable.
+ * If the value is large, additional memory is allocated.
+ * Returns 0 if successful.
+ */
+
+int
+snmp_set_var_value(netsnmp_variable_list * newvar,
+                   const u_char * val_str, size_t val_len)
+{
+    if (newvar->val.string && newvar->val.string != newvar->buf) {
+        free(newvar->val.string);
+    }
+
+    newvar->val.string = 0;
+    newvar->val_len = 0;
+
+    /*
+     * need a pointer and a length to copy a string value. 
+     */
+    if (val_str && val_len) {
+        if (val_len <= sizeof(newvar->buf))
+            newvar->val.string = newvar->buf;
+        else {
+            newvar->val.string = (u_char *) malloc(val_len);
+            if (!newvar->val.string)
+                return 1;
+        }
+        memmove(newvar->val.string, val_str, val_len);
+        newvar->val_len = val_len;
+    } else if (val_str) {
+        /*
+         * NULL STRING != NULL ptr 
+         */
+        newvar->val.string = newvar->buf;
+        newvar->val.string[0] = '\0';
+        newvar->val_len = 0;
+    }
+    return 0;
+}
+
+void
+snmp_replace_var_types(netsnmp_variable_list * vbl, u_char old_type,
+                       u_char new_type)
+{
+    while (vbl) {
+        if (vbl->type == old_type) {
+            snmp_set_var_typed_value(vbl, new_type, NULL, 0);
+        }
+        vbl = vbl->next_variable;
+    }
+}
+
+void
+snmp_reset_var_types(netsnmp_variable_list * vbl, u_char new_type)
+{
+    while (vbl) {
+        snmp_set_var_typed_value(vbl, new_type, NULL, 0);
+        vbl = vbl->next_variable;
+    }
+}
+
+int
+snmp_synch_response_cb(netsnmp_session * ss,
+                       netsnmp_pdu *pdu,
+                       netsnmp_pdu **response, snmp_callback pcb)
+{
+    struct synch_state lstate, *state;
+    snmp_callback   cbsav;
+    void           *cbmagsav;
+    int             numfds, count;
+    fd_set          fdset;
+    struct timeval  timeout, *tvp;
+    int             block;
+
+    memset((void *) &lstate, 0, sizeof(lstate));
+    state = &lstate;
+    cbsav = ss->callback;
+    cbmagsav = ss->callback_magic;
+    ss->callback = pcb;
+    ss->callback_magic = (void *) state;
+
+    if ((state->reqid = snmp_send(ss, pdu)) == 0) {
+        snmp_free_pdu(pdu);
+        state->status = STAT_ERROR;
+    } else
+        state->waiting = 1;
+
+    while (state->waiting) {
+        numfds = 0;
+        FD_ZERO(&fdset);
+        block = SNMPBLOCK;
+        tvp = &timeout;
+        timerclear(tvp);
+        snmp_select_info(&numfds, &fdset, tvp, &block);
+        if (block == 1)
+            tvp = NULL;         /* block without timeout */
+        count = select(numfds, &fdset, 0, 0, tvp);
+        if (count > 0) {
+            snmp_read(&fdset);
+        } else
+            switch (count) {
+            case 0:
+                snmp_timeout();
+                break;
+            case -1:
+                if (errno == EINTR) {
+                    continue;
+                } else {
+                    snmp_errno = SNMPERR_GENERR;
+                    /*
+                     * CAUTION! if another thread closed the socket(s)
+                     * waited on here, the session structure was freed.
+                     * It would be nice, but we can't rely on the pointer.
+                     * ss->s_snmp_errno = SNMPERR_GENERR;
+                     * ss->s_errno = errno;
+                     */
+                    snmp_set_detail(strerror(errno));
+                }
+                /*
+                 * FALLTHRU 
+                 */
+            default:
+                state->status = STAT_ERROR;
+                state->waiting = 0;
+            }
+    }
+    *response = state->pdu;
+    ss->callback = cbsav;
+    ss->callback_magic = cbmagsav;
+    return state->status;
+}
+
+int
+snmp_synch_response(netsnmp_session * ss,
+                    netsnmp_pdu *pdu, netsnmp_pdu **response)
+{
+    return snmp_synch_response_cb(ss, pdu, response, snmp_synch_input);
+}
+
+int
+snmp_sess_synch_response(void *sessp,
+                         netsnmp_pdu *pdu, netsnmp_pdu **response)
+{
+    netsnmp_session *ss;
+    struct synch_state lstate, *state;
+    snmp_callback   cbsav;
+    void           *cbmagsav;
+    int             numfds, count;
+    fd_set          fdset;
+    struct timeval  timeout, *tvp;
+    int             block;
+
+    ss = snmp_sess_session(sessp);
+    memset((void *) &lstate, 0, sizeof(lstate));
+    state = &lstate;
+    cbsav = ss->callback;
+    cbmagsav = ss->callback_magic;
+    ss->callback = snmp_synch_input;
+    ss->callback_magic = (void *) state;
+
+    if ((state->reqid = snmp_sess_send(sessp, pdu)) == 0) {
+        snmp_free_pdu(pdu);
+        state->status = STAT_ERROR;
+    } else
+        state->waiting = 1;
+
+    while (state->waiting) {
+        numfds = 0;
+        FD_ZERO(&fdset);
+        block = SNMPBLOCK;
+        tvp = &timeout;
+        timerclear(tvp);
+        snmp_sess_select_info(sessp, &numfds, &fdset, tvp, &block);
+        if (block == 1)
+            tvp = NULL;         /* block without timeout */
+        count = select(numfds, &fdset, 0, 0, tvp);
+        if (count > 0) {
+            snmp_sess_read(sessp, &fdset);
+        } else
+            switch (count) {
+            case 0:
+                snmp_sess_timeout(sessp);
+                break;
+            case -1:
+                if (errno == EINTR) {
+                    continue;
+                } else {
+                    snmp_errno = SNMPERR_GENERR;
+                    /*
+                     * CAUTION! if another thread closed the socket(s)
+                     * waited on here, the session structure was freed.
+                     * It would be nice, but we can't rely on the pointer.
+                     * ss->s_snmp_errno = SNMPERR_GENERR;
+                     * ss->s_errno = errno;
+                     */
+                    snmp_set_detail(strerror(errno));
+                }
+                /*
+                 * FALLTHRU 
+                 */
+            default:
+                state->status = STAT_ERROR;
+                state->waiting = 0;
+            }
+    }
+    *response = state->pdu;
+    ss->callback = cbsav;
+    ss->callback_magic = cbmagsav;
+    return state->status;
+}
+
+
+const char     *error_string[19] = {
+    "(noError) No Error",
+    "(tooBig) Response message would have been too large.",
+    "(noSuchName) There is no such variable name in this MIB.",
+    "(badValue) The value given has the wrong type or length.",
+    "(readOnly) The two parties used do not have access to use the specified SNMP PDU.",
+    "(genError) A general failure occured",
+    "noAccess",
+    "wrongType (The set datatype does not match the data type the agent expects)",
+    "wrongLength (The set value has an illegal length from what the agent expects)",
+    "wrongEncoding",
+    "wrongValue (The set value is illegal or unsupported in some way)",
+    "noCreation (that table does not support row creation)",
+    "inconsistentValue (The set value is illegal or unsupported in some way)",
+    "resourceUnavailable (This is likely a out-of-memory failure within the agent)",
+    "commitFailed",
+    "undoFailed",
+    "authorizationError (access denied to that object)",
+    "notWritable (that object does not support modification)",
+    "inconsistentName"
+};
+
+const char     *
+snmp_errstring(int errstat)
+{
+    if (errstat <= MAX_SNMP_ERR && errstat >= SNMP_ERR_NOERROR) {
+        return error_string[errstat];
+    } else {
+        return "Unknown Error";
+    }
+}
diff -Naur tomato/release/src/router/snmp/snmplib/snmp_debug.c tomato121/release/src/router/snmp/snmplib/snmp_debug.c
--- tomato/release/src/router/snmp/snmplib/snmp_debug.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/snmplib/snmp_debug.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,367 @@
+#include <net-snmp/net-snmp-config.h>
+
+#include <stdio.h>
+#if HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#if HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+#include <sys/types.h>
+#if HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+#if HAVE_STDARG_H
+#include <stdarg.h>
+#else
+#include <varargs.h>
+#endif
+#if HAVE_WINSOCK_H
+#include <winsock.h>
+#endif
+
+#if HAVE_DMALLOC_H
+#include <dmalloc.h>
+#endif
+
+#include <net-snmp/types.h>
+#include <net-snmp/output_api.h>
+#include <net-snmp/library/snmp_debug.h>        /* For this file's "internal" definitions */
+#include <net-snmp/config_api.h>
+#include <net-snmp/utilities.h>
+
+#include <net-snmp/library/mib.h>
+#include <net-snmp/library/snmp_api.h>
+
+static int      dodebug = SNMP_ALWAYS_DEBUG;
+static int      debug_num_tokens = 0;
+static char    *debug_tokens[MAX_DEBUG_TOKENS];
+static int      debug_print_everything = 0;
+
+/*
+ * indent debugging:  provide a space padded section to return an indent for 
+ */
+static int      debugindent = 0;
+#define INDENTMAX 80
+static char     debugindentchars[] =
+    "                                                                                ";
+
+/*
+ * Prototype definitions 
+ */
+void            debug_config_register_tokens(const char *configtoken,
+                                             char *tokens);
+void            debug_config_turn_on_debugging(const char *configtoken,
+                                               char *line);
+
+char           *
+debug_indent(void)
+{
+    return debugindentchars;
+}
+
+void
+debug_indent_add(int amount)
+{
+    if (debugindent + amount >= 0 && debugindent + amount < 80) {
+        debugindentchars[debugindent] = ' ';
+        debugindent += amount;
+        debugindentchars[debugindent] = '\0';
+    }
+}
+
+void
+debug_config_register_tokens(const char *configtoken, char *tokens)
+{
+    debug_register_tokens(tokens);
+}
+
+void
+debug_config_turn_on_debugging(const char *configtoken, char *line)
+{
+    snmp_set_do_debugging(atoi(line));
+}
+
+void
+snmp_debug_init(void)
+{
+    debugindentchars[0] = '\0'; /* zero out the debugging indent array. */
+    register_prenetsnmp_mib_handler("snmp", "doDebugging",
+                                    debug_config_turn_on_debugging, NULL,
+                                    "(1|0)");
+    register_prenetsnmp_mib_handler("snmp", "debugTokens",
+                                    debug_config_register_tokens, NULL,
+                                    "token[,token...]");
+}
+
+void
+debug_register_tokens(char *tokens)
+{
+    char           *newp, *cp;
+
+    if (tokens == 0 || *tokens == 0)
+        return;
+
+    newp = strdup(tokens);      /* strtok messes it up */
+    cp = strtok(newp, DEBUG_TOKEN_DELIMITER);
+    while (cp) {
+        if (strlen(cp) < MAX_DEBUG_TOKEN_LEN) {
+            if (strcasecmp(cp, DEBUG_ALWAYS_TOKEN) == 0)
+                debug_print_everything = 1;
+            else if (debug_num_tokens < MAX_DEBUG_TOKENS)
+                debug_tokens[debug_num_tokens++] = strdup(cp);
+        }
+        cp = strtok(NULL, DEBUG_TOKEN_DELIMITER);
+    }
+    free(newp);
+}
+
+
+/*
+ * debug_is_token_registered(char *TOKEN):
+ * 
+ * returns SNMPERR_SUCCESS
+ * or SNMPERR_GENERR
+ * 
+ * if TOKEN has been registered and debugging support is turned on.
+ */
+int
+debug_is_token_registered(const char *token)
+{
+    int             i;
+
+    /*
+     * debugging flag is on or off 
+     */
+    if (!dodebug)
+        return SNMPERR_GENERR;
+
+    if (debug_num_tokens == 0 || debug_print_everything) {
+        /*
+         * no tokens specified, print everything 
+         */
+        return SNMPERR_SUCCESS;
+    } else {
+        for (i = 0; i < debug_num_tokens; i++) {
+            if (strncmp(debug_tokens[i], token, strlen(debug_tokens[i])) ==
+                0) {
+                return SNMPERR_SUCCESS;
+            }
+        }
+    }
+    return SNMPERR_GENERR;
+}
+
+void
+#if HAVE_STDARG_H
+debugmsg(const char *token, const char *format, ...)
+#else
+debugmsg(va_alist)
+     va_dcl
+#endif
+{
+    va_list         debugargs;
+
+#if HAVE_STDARG_H
+    va_start(debugargs, format);
+#else
+    const char     *format;
+    const char     *token;
+
+    va_start(debugargs);
+    token = va_arg(debugargs, const char *);
+    format = va_arg(debugargs, const char *);   /* ??? */
+#endif
+
+    if (debug_is_token_registered(token) == SNMPERR_SUCCESS) {
+        snmp_vlog(LOG_DEBUG, format, debugargs);
+    }
+    va_end(debugargs);
+}
+
+void
+debugmsg_oid(const char *token, const oid * theoid, size_t len)
+{
+    u_char         *buf = NULL;
+    size_t          buf_len = 0, out_len = 0;
+
+    if (sprint_realloc_objid(&buf, &buf_len, &out_len, 1, theoid, len)) {
+        if (buf != NULL) {
+            debugmsg(token, "%s", buf);
+        }
+    } else {
+        if (buf != NULL) {
+            debugmsg(token, "%s [TRUNCATED]", buf);
+        }
+    }
+
+    if (buf != NULL) {
+        free(buf);
+    }
+}
+
+void
+debugmsg_var(const char *token, netsnmp_variable_list * var)
+{
+    u_char         *buf = NULL;
+    size_t          buf_len = 0, out_len = 0;
+
+    if (var == NULL || token == NULL) {
+        return;
+    }
+
+    if (sprint_realloc_variable(&buf, &buf_len, &out_len, 1,
+                                var->name, var->name_length, var)) {
+        if (buf != NULL) {
+            debugmsg(token, "%s", buf);
+        }
+    } else {
+        if (buf != NULL) {
+            debugmsg(token, "%s [TRUNCATED]", buf);
+        }
+    }
+
+    if (buf != NULL) {
+        free(buf);
+    }
+}
+
+void
+debugmsg_oidrange(const char *token, const oid * theoid, size_t len,
+                  size_t var_subid, oid range_ubound)
+{
+    u_char         *buf = NULL;
+    size_t          buf_len = 0, out_len = 0, i = 0;
+    int             rc = 0;
+
+    if (var_subid == 0) {
+        rc = sprint_realloc_objid(&buf, &buf_len, &out_len, 1, theoid,
+                                  len);
+    } else {
+        char            tmpbuf[128];
+        rc = sprint_realloc_objid(&buf, &buf_len, &out_len, 1, theoid,
+                                  var_subid);
+        if (rc) {
+            sprintf(tmpbuf, ".%lu--%lu", theoid[var_subid - 1],
+                    range_ubound);
+            rc = snmp_strcat(&buf, &buf_len, &out_len, 1, tmpbuf);
+            if (rc) {
+                for (i = var_subid; i < len; i++) {
+                    sprintf(tmpbuf, ".%lu", theoid[i]);
+                    if (!snmp_strcat(&buf, &buf_len, &out_len, 1, tmpbuf)) {
+                        break;
+                    }
+                }
+            }
+        }
+    }
+
+
+    if (buf != NULL) {
+        debugmsg(token, "%s%s", buf, rc ? "" : " [TRUNCATED]");
+        free(buf);
+    }
+}
+
+void
+debugmsg_hex(const char *token, u_char * thedata, size_t len)
+{
+    u_char         *buf = NULL;
+    size_t          buf_len = 0, out_len = 0;
+
+    if (sprint_realloc_hexstring
+        (&buf, &buf_len, &out_len, 1, thedata, len)) {
+        if (buf != NULL) {
+            debugmsg(token, "%s", buf);
+        }
+    } else {
+        if (buf != NULL) {
+            debugmsg(token, "%s [TRUNCATED]", buf);
+        }
+    }
+
+    if (buf != NULL) {
+        free(buf);
+    }
+}
+
+void
+debugmsg_hextli(const char *token, u_char * thedata, size_t len)
+{
+    char            buf[SPRINT_MAX_LEN], token2[SPRINT_MAX_LEN];
+    u_char         *b3 = NULL;
+    size_t          b3_len = 0, o3_len = 0;
+    int             incr;
+    sprintf(token2, "dumpx_%s", token);
+
+    /*
+     * XX tracing lines removed from this function DEBUGTRACE; 
+     */
+    DEBUGIF(token2) {
+        for (incr = 16; len > 0; len -= incr, thedata += incr) {
+            if ((int) len < incr) {
+                incr = len;
+            }
+            /*
+             * XXnext two lines were DEBUGPRINTINDENT(token);
+             */
+            sprintf(buf, "dumpx%s", token);
+            debugmsg(buf, "%s: %s", token2, debug_indent());
+            if (sprint_realloc_hexstring
+                (&b3, &b3_len, &o3_len, 1, thedata, incr)) {
+                if (b3 != NULL) {
+                    debugmsg(token2, "%s", b3);
+                }
+            } else {
+                if (b3 != NULL) {
+                    debugmsg(token2, "%s [TRUNCATED]", b3);
+                }
+            }
+            o3_len = 0;
+        }
+    }
+    if (b3 != NULL) {
+        free(b3);
+    }
+}
+
+void
+#if HAVE_STDARG_H
+debugmsgtoken(const char *token, const char *format, ...)
+#else
+debugmsgtoken(va_alist)
+     va_dcl
+#endif
+{
+    va_list         debugargs;
+
+#if HAVE_STDARG_H
+    va_start(debugargs, format);
+#else
+    const char     *token;
+
+    va_start(debugargs);
+    token = va_arg(debugargs, const char *);
+#endif
+
+    debugmsg(token, "%s: ", token);
+
+    va_end(debugargs);
+}
+
+/*
+ * for speed, these shouldn't be in default_storage space 
+ */
+void
+snmp_set_do_debugging(int val)
+{
+    dodebug = val;
+}
+
+int
+snmp_get_do_debugging(void)
+{
+    return dodebug;
+}
diff -Naur tomato/release/src/router/snmp/snmplib/snmp_enum.c tomato121/release/src/router/snmp/snmplib/snmp_enum.c
--- tomato/release/src/router/snmp/snmplib/snmp_enum.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/snmplib/snmp_enum.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,249 @@
+#include <net-snmp/net-snmp-config.h>
+
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#if HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+
+#if HAVE_DMALLOC_H
+#include <dmalloc.h>
+#endif
+
+#include <net-snmp/library/snmp_enum.h>
+
+struct snmp_enum_list_str {
+    char           *name;
+    struct snmp_enum_list *list;
+    struct snmp_enum_list_str *next;
+};
+
+static struct snmp_enum_list ***snmp_enum_lists;
+unsigned int    current_maj_num;
+unsigned int    current_min_num;
+struct snmp_enum_list_str *sliststorage;
+
+int
+init_snmp_enum(void)
+{
+    int             i;
+
+    if (!snmp_enum_lists)
+        snmp_enum_lists = (struct snmp_enum_list ***)
+            malloc(sizeof(struct snmp_enum_list **) * SE_MAX_IDS);
+    if (!snmp_enum_lists)
+        return SE_NOMEM;
+    current_maj_num = SE_MAX_IDS;
+
+    for (i = 0; i < SE_MAX_IDS; i++) {
+        if (!snmp_enum_lists[i])
+            snmp_enum_lists[i] = (struct snmp_enum_list **)
+                malloc(sizeof(struct snmp_enum_list *) * SE_MAX_SUBIDS);
+        if (!snmp_enum_lists[i])
+            return SE_NOMEM;
+    }
+    current_min_num = SE_MAX_SUBIDS;
+
+    if (!sliststorage)
+        sliststorage = NULL;
+    return SE_OK;
+}
+
+int
+se_store_list(struct snmp_enum_list *new_list,
+              unsigned int major, unsigned int minor)
+{
+    int             ret = SE_OK;
+
+    if (major > current_maj_num || minor > current_min_num) {
+        /*
+         * XXX: realloc 
+         */
+        return SE_NOMEM;
+    }
+
+
+    if (snmp_enum_lists[major][minor] != NULL)
+        ret = SE_ALREADY_THERE;
+
+    snmp_enum_lists[major][minor] = new_list;
+
+    return ret;
+}
+
+struct snmp_enum_list *
+se_find_list(unsigned int major, unsigned int minor)
+{
+    if (major > current_maj_num || minor > current_min_num)
+        return NULL;
+
+    return snmp_enum_lists[major][minor];
+}
+
+int
+se_find_value_in_list(struct snmp_enum_list *list, char *label)
+{
+    if (!list)
+        return SE_DNE;          /* XXX: um, no good solution here */
+    while (list) {
+        if (strcmp(list->label, label) == 0)
+            return (list->value);
+        list = list->next;
+    }
+
+    return SE_DNE;              /* XXX: um, no good solution here */
+}
+
+int
+se_find_value(unsigned int major, unsigned int minor, char *label)
+{
+    return se_find_value_in_list(se_find_list(major, minor), label);
+}
+
+char           *
+se_find_label_in_list(struct snmp_enum_list *list, int value)
+{
+    if (!list)
+        return NULL;
+    while (list) {
+        if (list->value == value)
+            return (list->label);
+        list = list->next;
+    }
+    return NULL;
+}
+
+char           *
+se_find_label(unsigned int major, unsigned int minor, int value)
+{
+    return se_find_label_in_list(se_find_list(major, minor), value);
+}
+
+int
+se_add_pair_to_list(struct snmp_enum_list **list, char *label, int value)
+{
+    struct snmp_enum_list *lastnode = NULL;
+
+    if (!list)
+        return SE_DNE;
+
+    while (*list) {
+        if ((*list)->value == value)
+            return (SE_ALREADY_THERE);
+        lastnode = (*list);
+        (*list) = (*list)->next;
+    }
+
+    if (lastnode) {
+        lastnode->next = (struct snmp_enum_list *)
+            malloc(sizeof(struct snmp_enum_list));
+        lastnode = lastnode->next;
+    } else {
+        (*list) = (struct snmp_enum_list *)
+            malloc(sizeof(struct snmp_enum_list));
+        lastnode = (*list);
+    }
+    if (!lastnode)
+        return (SE_NOMEM);
+    lastnode->label = label;
+    lastnode->value = value;
+    lastnode->next = NULL;
+    return (SE_OK);
+}
+
+int
+se_add_pair(unsigned int major, unsigned int minor, char *label, int value)
+{
+    struct snmp_enum_list *list = se_find_list(major, minor);
+    int             created = (list) ? 1 : 0;
+    int             ret = se_add_pair_to_list(&list, label, value);
+    if (!created)
+        se_store_list(list, major, minor);
+    return ret;
+}
+
+/*
+ * remember a list of enums based on a lookup name.
+ */
+struct snmp_enum_list *
+se_find_slist(const char *listname)
+{
+    struct snmp_enum_list_str *sptr, *lastp = NULL;
+    if (!listname)
+        return NULL;
+
+    for (sptr = sliststorage;
+         sptr != NULL; lastp = sptr, sptr = sptr->next)
+        if (sptr->name && strcmp(sptr->name, listname) == 0)
+            return sptr->list;
+
+    if (lastp) {
+        lastp->next = (struct snmp_enum_list_str *)
+            malloc(sizeof(struct snmp_enum_list_str));
+        sptr = lastp->next;
+    } else {
+        sptr = (struct snmp_enum_list_str *)
+            malloc(sizeof(struct snmp_enum_list_str));
+        sliststorage = sptr;
+    }
+    sptr->list = NULL;
+    sptr->name = strdup(listname);
+    sptr->next = NULL;
+    return sptr->list;
+}
+
+
+char           *
+se_find_label_in_slist(const char *listname, int value)
+{
+    return (se_find_label_in_list(se_find_slist(listname), value));
+}
+
+
+int
+se_find_value_in_slist(const char *listname, char *label)
+{
+    return (se_find_value_in_list(se_find_slist(listname), label));
+}
+
+int
+se_add_pair_to_slist(const char *listname, char *label, int value)
+{
+    struct snmp_enum_list *list = se_find_slist(listname);
+    int             created = (list) ? 1 : 0;
+    int             ret = se_add_pair_to_list(&list, label, value);
+
+    if (!created) {
+        struct snmp_enum_list_str *sptr = (struct snmp_enum_list_str *)
+            malloc(sizeof(struct snmp_enum_list_str));
+        if (!sptr)
+            return SE_NOMEM;
+        sptr->next = sliststorage;
+        sptr->name = strdup(listname);
+        sptr->list = list;
+        sliststorage = sptr;
+    }
+    return ret;
+}
+
+#ifdef TESTING
+main()
+{
+    init_snmp_enum();
+    se_add_pair(1, 1, "hi", 1);
+    se_add_pair(1, 1, "there", 2);
+    printf("hi: %d\n", se_find_value(1, 1, "hi"));
+    printf("2: %s\n", se_find_label(1, 1, 2));
+
+    se_add_pair_to_slist("testing", "life, and everything", 42);
+    se_add_pair_to_slist("testing", "resturant at the end of the universe",
+                         2);
+
+    printf("life, and everything: %d\n",
+           se_find_value_in_slist("testing", "life, and everything"));
+    printf("2: %s\n", se_find_label_in_slist("testing", 2));
+}
+#endif                          /* TESTING */
diff -Naur tomato/release/src/router/snmp/snmplib/snmpIPXDomain.c tomato121/release/src/router/snmp/snmplib/snmpIPXDomain.c
--- tomato/release/src/router/snmp/snmplib/snmpIPXDomain.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/snmplib/snmpIPXDomain.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,427 @@
+#include <net-snmp/net-snmp-config.h>
+
+#include <stdio.h>
+#include <sys/types.h>
+#include <ctype.h>
+#include <errno.h>
+
+#if HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+#if HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#if HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#if HAVE_SYS_SOCKET_H
+#include <sys/socket.h>
+#endif
+#if HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+
+#if HAVE_DMALLOC_H
+#include <dmalloc.h>
+#endif
+
+#include <net-snmp/types.h>
+#include <net-snmp/output_api.h>
+#include <net-snmp/config_api.h>
+
+#include <net-snmp/library/snmp_transport.h>
+#include <net-snmp/library/snmpIPXDomain.h>
+
+#define SNMP_IPX_DEFAULT_PORT	36879   /*  Specified in RFC 1420.  */
+static netsnmp_tdomain ipxDomain;
+
+/*
+ * Return a string representing the address in data, or else the "far end"
+ * address if data is NULL.  
+ */
+
+static char *
+netsnmp_ipx_fmtaddr(netsnmp_transport *t, void *data, int len)
+{
+    struct sockaddr_ipx *to = NULL;
+
+    if (data != NULL && len == sizeof(struct sockaddr_ipx)) {
+        to = (struct sockaddr_ipx *) data;
+    } else if (t != NULL && t->data != NULL) {
+        to = (struct sockaddr_ipx *) t->data;
+    }
+    if (to == NULL) {
+        return strdup("IPX: unknown");
+    } else {
+        char tmp[64];
+        sprintf(tmp, "IPX: %08X:%02X%02X%02X%02X%02X%02X/%hu",
+                ntohl(to->sipx_network), to->sipx_node[0],
+                to->sipx_node[1], to->sipx_node[2], to->sipx_node[3],
+                to->sipx_node[4], to->sipx_node[5], ntohs(to->sipx_port));
+        return strdup(tmp);
+    }
+}
+
+
+
+/*
+ * You can write something into opaque that will subsequently get passed back 
+ * to your send function if you like.  For instance, you might want to
+ * remember where a PDU came from, so that you can send a reply there...  
+ */
+
+static int
+netsnmp_ipx_recv(netsnmp_transport *t, void *buf, int size,
+		 void **opaque, int *olength)
+{
+    int rc = -1, fromlen = sizeof(struct sockaddr);
+    struct sockaddr *from;
+
+    if (t != NULL && t->sock >= 0) {
+        from = (struct sockaddr *)malloc(sizeof(struct sockaddr_ipx));
+        if (from == NULL) {
+            *opaque = NULL;
+            *olength = 0;
+            return -1;
+        } else {
+            memset(from, 0, fromlen);
+        }
+
+	while (rc < 0) {
+	  rc = recvfrom(t->sock, buf, size, 0, from, &fromlen);
+	  if (rc < 0 && errno != EINTR) {
+	    break;
+	  }
+	}
+
+        if (rc >= 0) {
+            char *string = netsnmp_ipx_fmtaddr(NULL, from, fromlen);
+            DEBUGMSGTL(("netsnmp_ipx","recvfrom fd %d got %d bytes(from %s)\n",
+			t->sock, rc, string));
+            free(string);
+        } else {
+            DEBUGMSGTL(("netsnmp_ipx", "recvfrom fd %d err %d (\"%s\")\n",
+                        t->sock, errno, strerror(errno)));
+        }
+        *opaque = (void *) from;
+        *olength = sizeof(struct sockaddr_ipx);
+    }
+    return rc;
+}
+
+
+
+static int
+netsnmp_ipx_send(netsnmp_transport *t, void *buf, int size,
+		 void **opaque, int *olength)
+{
+    int rc = -1;
+    struct sockaddr *to = NULL;
+
+    if (opaque != NULL && *opaque != NULL &&
+	*olength == sizeof(struct sockaddr_ipx)) {
+        to = (struct sockaddr *) (*opaque);
+    } else if (t != NULL && t->data != NULL &&
+               t->data_length == sizeof(struct sockaddr_ipx)) {
+        to = (struct sockaddr *) (t->data);
+    }
+
+    if (to != NULL && t != NULL && t->sock >= 0) {
+        char *string = netsnmp_ipx_fmtaddr(NULL, (void *)to,
+					sizeof(struct sockaddr_ipx));
+        DEBUGMSGTL(("netsnmp_ipx", "send %d bytes from %p to %s on fd %d\n",
+                    size, buf, string, t->sock));
+        free(string);
+	while (rc < 0) {
+	    rc = sendto(t->sock, buf, size, 0, to, sizeof(struct sockaddr));
+	    if (rc < 0 && errno != EINTR) {
+		break;
+	    }
+	}
+    }
+    return rc;
+}
+
+
+
+static int
+netsnmp_ipx_close(netsnmp_transport *t)
+{
+    int rc = -1;
+    if (t->sock >= 0) {
+#ifndef HAVE_CLOSESOCKET
+        rc = close(t->sock);
+#else
+        rc = closesocket(t->sock);
+#endif
+        t->sock = -1;
+    }
+    return rc;
+}
+
+
+
+/*
+ * Open a IPX-based transport for SNMP.  Local is TRUE if addr is the local
+ * address to bind to (i.e. this is a server-type session); otherwise addr is 
+ * the remote address to send things to.  
+ */
+
+netsnmp_transport *
+netsnmp_ipx_transport(struct sockaddr_ipx *addr, int local)
+{
+    netsnmp_transport *t = NULL;
+    int             rc = 0;
+    char           *string = NULL;
+
+    if (addr == NULL || addr->sipx_family != AF_IPX) {
+        return NULL;
+    }
+
+    t = (netsnmp_transport *) malloc(sizeof(netsnmp_transport));
+    if (t == NULL) {
+        return NULL;
+    }
+
+    string = netsnmp_ipx_fmtaddr(NULL, (void *)addr, 
+				 sizeof(struct sockaddr_ipx));
+    DEBUGMSGTL(("netsnmp_ipx", "open %s %s\n", local ? "local" : "remote",
+                string));
+    free(string);
+
+    memset(t, 0, sizeof(netsnmp_transport));
+
+    t->domain = netsnmpIPXDomain;
+    t->domain_length = netsnmpIPXDomain_len;
+
+    t->sock = socket(AF_IPX, SOCK_DGRAM, AF_IPX);
+    if (t->sock < 0) {
+        netsnmp_transport_free(t);
+        return NULL;
+    }
+
+    if (local) {
+        t->local = malloc(12);
+        if (t->local == NULL) {
+            netsnmp_transport_free(t);
+            return NULL;
+        }
+        memcpy(&(t->local[00]), (u_char *) & (addr->sipx_network), 4);
+        memcpy(&(t->local[04]), (u_char *) & (addr->sipx_node), 6);
+        memcpy(&(t->local[10]), (u_char *) & (addr->sipx_port), 2);
+        t->local_length = 12;
+
+        /*
+         * This session is inteneded as a server, so we must bind on to the
+         * given address (which may include a particular network and/or node
+         * address, but definitely includes a port number).
+         */
+
+        rc = bind(t->sock, (struct sockaddr *) addr,
+                  sizeof(struct sockaddr));
+        if (rc != 0) {
+            netsnmp_ipx_close(t);
+            netsnmp_transport_free(t);
+            return NULL;
+        }
+        t->data = NULL;
+        t->data_length = 0;
+    } else {
+        t->remote = malloc(12);
+        if (t->remote == NULL) {
+            netsnmp_transport_free(t);
+            return NULL;
+        }
+        memcpy(&(t->remote[00]), (u_char *) & (addr->sipx_network), 4);
+        memcpy(&(t->remote[04]), (u_char *) & (addr->sipx_node), 6);
+        memcpy(&(t->remote[10]), (u_char *) & (addr->sipx_port), 2);
+        t->remote_length = 12;
+
+        /*
+         * This is a client session.  Save the address in the
+         * transport-specific data pointer for later use by snmp_ipx_send.
+         */
+
+        t->data = malloc(sizeof(struct sockaddr_ipx));
+        if (t->data == NULL) {
+            netsnmp_transport_free(t);
+            return NULL;
+        }
+        memcpy(t->data, addr, sizeof(struct sockaddr_ipx));
+        t->data_length = sizeof(struct sockaddr_ipx);
+    }
+
+    /*
+     * Maximum size of an IPX PDU is 576 bytes including a 30-byte header.
+     * Ridiculous!  
+     */
+
+    t->msgMaxSize = 576 - 30;
+    t->f_recv     = netsnmp_ipx_recv;
+    t->f_send     = netsnmp_ipx_send;
+    t->f_close    = netsnmp_ipx_close;
+    t->f_accept   = NULL;
+    t->f_fmtaddr  = netsnmp_ipx_fmtaddr;
+
+    return t;
+}
+
+
+
+/*
+ * Attempt to parse a string of the form [%08x]:%12x[/%d] where the parts
+ * are the network number, the node address and the port in that order.  
+ */
+
+int
+netsnmp_sockaddr_ipx(struct sockaddr_ipx *addr, const char *peername)
+{
+    char           *cp = NULL;
+    unsigned int    network = 0, i = 0;
+
+    if (addr == NULL) {
+        return 0;
+    }
+    memset(addr, 0, sizeof(struct sockaddr_ipx));
+
+    DEBUGMSGTL(("netsnmp_sockaddr_ipx", "addr %p, peername \"%s\"\n",
+                addr, peername ? peername : "[NIL]"));
+
+    addr->sipx_family = AF_IPX;
+    addr->sipx_type = 4;        /*  Specified in RFC 1420.  */
+
+    if (peername == NULL) {
+        return 0;
+    }
+
+    /*
+     * Skip leading white space.  
+     */
+
+    while (*peername && isspace((int) *peername)) {
+        peername++;
+    }
+
+    if (!*peername) {
+        /*
+         * Completely blank address.  Let this mean "any network, any address,
+         * default SNMP port".  
+         */
+        addr->sipx_network = htonl(0);
+        for (i = 0; i < 6; i++) {
+            addr->sipx_node[i] = 0;
+        }
+        addr->sipx_port = htons(SNMP_IPX_DEFAULT_PORT);
+        return 1;
+    }
+
+    /*
+     * Try to get a leading network address.  
+     */
+
+    network = strtoul(peername, &cp, 16);
+    if (cp != peername) {
+        DEBUGMSGTL(("netsnmp_sockaddr_ipx", "network parsed okay\n"));
+        addr->sipx_network = htonl(network);
+        peername = cp;
+    } else {
+        DEBUGMSGTL(("netsnmp_sockaddr_ipx",
+                    "no network part of address\n"));
+        addr->sipx_network = htonl(0);
+    }
+
+    if (*peername == ':') {
+        /*
+         * Okay we are looking for a node number plus optionally a port here.  
+         */
+        int             node[6] = { 0, 0, 0, 0, 0, 0 }, rc = 0;
+        unsigned short  port = 0;
+        rc = sscanf(peername, ":%02X%02X%02X%02X%02X%02X/%hu",
+                    &node[0], &node[1], &node[2], &node[3], &node[4],
+                    &node[5], &port);
+        if (rc < 6) {
+            DEBUGMSGTL(("netsnmp_sockaddr_ipx",
+                        "no node -- fail (rc %d)\n", rc));
+            return 0;
+        } else if (rc == 6) {
+            DEBUGMSGTL(("netsnmp_sockaddr_ipx", "node, no port\n"));
+            for (i = 0; i < 6; i++) {
+                addr->sipx_node[i] = node[i];
+            }
+            addr->sipx_port = htons(SNMP_IPX_DEFAULT_PORT);
+        } else if (rc == 7) {
+            DEBUGMSGTL(("netsnmp_sockaddr_ipx", "node and port\n"));
+            for (i = 0; i < 6; i++) {
+                addr->sipx_node[i] = node[i];
+            }
+            addr->sipx_port = htons(port);
+        }
+    } else if (*peername == '/') {
+        /*
+         * Okay we are just looking for a port number here.  
+         */
+        unsigned short  port = 0;
+        for (i = 0; i < 6; i++) {
+            addr->sipx_node[i] = 0;
+        }
+        if (sscanf(peername, "/%hu", &port) != 1) {
+            DEBUGMSGTL(("netsnmp_sockaddr_ipx", "no port\n"));
+            addr->sipx_port = htons(SNMP_IPX_DEFAULT_PORT);
+        } else {
+            addr->sipx_port = htons(port);
+        }
+    } else {
+        return 0;
+    }
+
+    return 1;
+}
+
+
+
+netsnmp_transport *
+netsnmp_ipx_create_tstring(const char *string, int local)
+{
+    struct sockaddr_ipx addr;
+
+    if (netsnmp_sockaddr_ipx(&addr, string)) {
+        return netsnmp_ipx_transport(&addr, local);
+    } else {
+        return NULL;
+    }
+}
+
+
+
+netsnmp_transport *
+netsnmp_ipx_create_ostring(const u_char * o, size_t o_len, int local)
+{
+    struct sockaddr_ipx addr;
+
+    if (o_len == 12) {
+        addr.sipx_family = AF_IPX;
+        memcpy((u_char *) & (addr.sipx_network), &(o[00]), 4);
+        memcpy((u_char *) & (addr.sipx_node), &(o[04]), 6);
+        memcpy((u_char *) & (addr.sipx_port), &(o[10]), 2);
+        return netsnmp_ipx_transport(&addr, local);
+    }
+    return NULL;
+}
+
+
+
+void
+netsnmp_ipx_ctor(void)
+{
+    ipxDomain.name = netsnmpIPXDomain;
+    ipxDomain.name_length = netsnmpIPXDomain_len;
+    ipxDomain.prefix = calloc(2, sizeof(char *));
+    ipxDomain.prefix[0] = "ipx";
+
+    ipxDomain.f_create_from_tstring = netsnmp_ipx_create_tstring;
+    ipxDomain.f_create_from_ostring = netsnmp_ipx_create_ostring;
+
+    netsnmp_tdomain_register(&ipxDomain);
+}
diff -Naur tomato/release/src/router/snmp/snmplib/snmpksm.c tomato121/release/src/router/snmp/snmplib/snmpksm.c
--- tomato/release/src/router/snmp/snmplib/snmpksm.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/snmplib/snmpksm.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,1617 @@
+/*
+ * snmpksm.c
+ *
+ * This code implements the Kerberos Security Model (KSM) for SNMP.
+ *
+ * Security number - 2066432
+ */
+
+#include <net-snmp/net-snmp-config.h>
+
+#include <sys/types.h>
+#if HAVE_WINSOCK_H
+#include <winsock.h>
+#endif
+#include <stdio.h>
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#if TIME_WITH_SYS_TIME
+# ifdef WIN32
+#  include <sys/timeb.h>
+# else
+#  include <sys/time.h>
+# endif
+# include <time.h>
+#else
+# if HAVE_SYS_TIME_H
+#  include <sys/time.h>
+# else
+#  include <time.h>
+# endif
+#endif
+#if HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+#ifdef HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+#include <errno.h>
+
+
+#if HAVE_DMALLOC_H
+#include <dmalloc.h>
+#endif
+
+#include <krb5.h>
+#include <com_err.h>
+
+#include <net-snmp/output_api.h>
+#include <net-snmp/config_api.h>
+#include <net-snmp/utilities.h>
+
+#include <net-snmp/library/asn1.h>
+#include <net-snmp/library/snmp_api.h>
+#include <net-snmp/library/callback.h>
+#include <net-snmp/library/keytools.h>
+#include <net-snmp/library/snmpv3.h>
+#include <net-snmp/library/lcd_time.h>
+#include <net-snmp/library/scapi.h>
+#include <net-snmp/library/callback.h>
+#include <net-snmp/library/snmp_secmod.h>
+#include <net-snmp/library/snmpksm.h>
+
+static krb5_context kcontext = NULL;
+static krb5_rcache rcache = NULL;
+
+static int      ksm_session_init(netsnmp_session *);
+static void     ksm_free_state_ref(void *);
+static int      ksm_free_pdu(netsnmp_pdu *);
+static int      ksm_clone_pdu(netsnmp_pdu *, netsnmp_pdu *);
+
+static int      ksm_insert_cache(long, krb5_auth_context, u_char *,
+                                 size_t);
+static void     ksm_decrement_ref_count(long);
+static void     ksm_increment_ref_count(long);
+static struct ksm_cache_entry *ksm_get_cache(long);
+
+#define HASHSIZE	64
+
+/*
+ * Our information stored for the response PDU.
+ */
+
+struct ksm_secStateRef {
+    krb5_auth_context auth_context;
+    krb5_cksumtype  cksumtype;
+};
+
+/*
+ * A KSM outgoing pdu cache entry
+ */
+
+struct ksm_cache_entry {
+    long            msgid;
+    int             refcount;
+    krb5_auth_context auth_context;
+    u_char         *secName;
+    size_t          secNameLen;
+    struct ksm_cache_entry *next;
+};
+
+/*
+ * Poor man's hash table
+ */
+
+static struct ksm_cache_entry *ksm_hash_table[HASHSIZE];
+
+/*
+ * Initialize all of the state required for Kerberos (right now, just call
+ * krb5_init_context).
+ */
+
+void
+init_ksm(void)
+{
+    krb5_error_code retval;
+    struct snmp_secmod_def *def;
+    int             i;
+
+    if (kcontext == NULL) {
+        retval = krb5_init_context(&kcontext);
+
+        if (retval) {
+            DEBUGMSGTL(("ksm", "krb5_init_context failed (%s), not "
+                        "registering KSM\n", error_message(retval)));
+            return;
+        }
+    }
+
+    for (i = 0; i < HASHSIZE; i++)
+        ksm_hash_table[i] = NULL;
+
+    def = SNMP_MALLOC_STRUCT(snmp_secmod_def);
+
+    if (!def) {
+        DEBUGMSGTL(("ksm", "Unable to malloc snmp_secmod struct, not "
+                    "registering KSM\n"));
+        return;
+    }
+
+    def->encode_reverse = ksm_rgenerate_out_msg;
+    def->decode = ksm_process_in_msg;
+    def->session_open = ksm_session_init;
+    def->pdu_free_state_ref = ksm_free_state_ref;
+    def->pdu_free = ksm_free_pdu;
+    def->pdu_clone = ksm_clone_pdu;
+
+    register_sec_mod(2066432, "ksm", def);
+}
+
+/*
+ * These routines implement a simple cache for information we need to
+ * process responses.  When we send out a request, it contains an AP_REQ;
+ * we get back an AP_REP, and we need the authorization context from the
+ * AP_REQ to decrypt the AP_REP.  But because right now there's nothing
+ * that gets preserved across calls to rgenerate_out_msg to process_in_msg,
+ * we cache these internally based on the message ID (we also cache the
+ * passed-in security name, for reasons that are mostly stupid).
+ */
+
+static int
+ksm_insert_cache(long msgid, krb5_auth_context auth_context,
+                 u_char * secName, size_t secNameLen)
+{
+    struct ksm_cache_entry *entry;
+    int             bucket;
+    int             retval;
+
+    entry = SNMP_MALLOC_STRUCT(ksm_cache_entry);
+
+    if (!entry)
+        return SNMPERR_MALLOC;
+
+    entry->msgid = msgid;
+    entry->auth_context = auth_context;
+    entry->refcount = 1;
+
+    retval = memdup(&entry->secName, secName, secNameLen);
+
+    if (retval != SNMPERR_SUCCESS) {
+        free(entry);
+        return retval;
+    }
+
+    entry->secNameLen = secNameLen;
+
+    bucket = msgid % HASHSIZE;
+
+    entry->next = ksm_hash_table[bucket];
+    ksm_hash_table[bucket] = entry;
+
+    return SNMPERR_SUCCESS;
+}
+
+static struct ksm_cache_entry *
+ksm_get_cache(long msgid)
+{
+    struct ksm_cache_entry *entry;
+    int             bucket;
+
+    bucket = msgid % HASHSIZE;
+
+    for (entry = ksm_hash_table[bucket]; entry != NULL;
+         entry = entry->next)
+        if (entry->msgid == msgid)
+            return entry;
+
+    return NULL;
+}
+
+static void
+ksm_decrement_ref_count(long msgid)
+{
+    struct ksm_cache_entry *entry, *entry1;
+    int             bucket;
+
+    bucket = msgid % HASHSIZE;
+
+    if (ksm_hash_table[bucket] && ksm_hash_table[bucket]->msgid == msgid) {
+        entry = ksm_hash_table[bucket];
+
+        /*
+         * If the reference count is zero, then free it
+         */
+
+        if (--entry->refcount <= 0) {
+            DEBUGMSGTL(("ksm", "Freeing entry for msgid %ld\n", msgid));
+            krb5_auth_con_free(kcontext, entry->auth_context);
+            free(entry->secName);
+            ksm_hash_table[bucket] = entry->next;
+            free(entry);
+        }
+
+        return;
+
+    } else if (ksm_hash_table[bucket])
+        for (entry1 = ksm_hash_table[bucket], entry = entry1->next;
+             entry != NULL; entry1 = entry, entry = entry->next)
+            if (entry->msgid == msgid) {
+
+                if (--entry->refcount <= 0) {
+                    DEBUGMSGTL(("ksm", "Freeing entry for msgid %ld\n",
+                                msgid));
+                    krb5_auth_con_free(kcontext, entry->auth_context);
+                    free(entry->secName);
+                    entry1->next = entry->next;
+                    free(entry);
+                }
+
+                return;
+            }
+
+    DEBUGMSGTL(("ksm",
+                "KSM: Unable to decrement cache entry for msgid %ld.\n",
+                msgid));
+}
+
+static void
+ksm_increment_ref_count(long msgid)
+{
+    struct ksm_cache_entry *entry = ksm_get_cache(msgid);
+
+    if (!entry) {
+        DEBUGMSGTL(("ksm", "Unable to find cache entry for msgid %ld "
+                    "for increment\n", msgid));
+        return;
+    }
+
+    entry->refcount++;
+}
+
+/*
+ * Initialize specific session information (right now, just set up things to
+ * not do an engineID probe)
+ */
+
+static int
+ksm_session_init(netsnmp_session * sess)
+{
+    DEBUGMSGTL(("ksm",
+                "KSM: Reached our session initialization callback\n"));
+
+    sess->flags |= SNMP_FLAGS_DONT_PROBE;
+
+    return SNMPERR_SUCCESS;
+}
+
+/*
+ * Free our state information (this is only done on the agent side)
+ */
+
+static void
+ksm_free_state_ref(void *ptr)
+{
+    struct ksm_secStateRef *ref = (struct ksm_secStateRef *) ptr;
+
+    DEBUGMSGTL(("ksm", "KSM: Freeing state reference\n"));
+
+    krb5_auth_con_free(kcontext, ref->auth_context);
+
+    free(ref);
+}
+
+/*
+ * This is called when the PDU is freed; this will decrement reference counts
+ * for entries in our state cache.
+ */
+
+static int
+ksm_free_pdu(netsnmp_pdu *pdu)
+{
+    ksm_decrement_ref_count(pdu->msgid);
+
+    DEBUGMSGTL(("ksm", "Decrementing cache entry for PDU msgid %ld\n",
+                pdu->msgid));
+
+    return SNMPERR_SUCCESS;
+}
+
+/*
+ * This is called when a PDU is cloned (to increase reference counts)
+ */
+
+static int
+ksm_clone_pdu(netsnmp_pdu *pdu, netsnmp_pdu *pdu2)
+{
+    ksm_increment_ref_count(pdu->msgid);
+
+    DEBUGMSGTL(("ksm", "Incrementing cache entry for PDU msgid %ld\n",
+                pdu->msgid));
+
+    return SNMPERR_SUCCESS;
+}
+
+/****************************************************************************
+ *
+ * ksm_generate_out_msg
+ *
+ * Parameters:
+ *	(See list below...)
+ *
+ * Returns:
+ *	SNMPERR_GENERIC                        On success.
+ *	SNMPERR_KRB5
+ *	... and others
+ *
+ *
+ * Generate an outgoing message.
+ *
+ ****************************************************************************/
+
+int
+ksm_rgenerate_out_msg(struct snmp_secmod_outgoing_params *parms)
+{
+    krb5_auth_context auth_context = NULL;
+    krb5_error_code retcode;
+    krb5_ccache     cc = NULL;
+    int             retval = SNMPERR_SUCCESS;
+    krb5_data       outdata, ivector;
+    krb5_keyblock  *subkey = NULL;
+#ifdef MIT_NEW_CRYPTO
+    krb5_data       input;
+    krb5_enc_data   output;
+    unsigned int    numcksumtypes;
+    krb5_cksumtype  *cksumtype_array;
+#else                           /* MIT_NEW_CRYPTO */
+    krb5_encrypt_block eblock;
+#endif                          /* MIT_NEW_CRYPTO */
+    size_t          blocksize, encrypted_length;
+    unsigned char  *encrypted_data = NULL;
+    int             zero = 0, i;
+    u_char         *cksum_pointer, *endp = *parms->wholeMsg;
+    krb5_cksumtype  cksumtype;
+    krb5_checksum   pdu_checksum;
+    u_char         **wholeMsg = parms->wholeMsg;
+    size_t	   *offset = parms->wholeMsgOffset, seq_offset;
+    struct ksm_secStateRef *ksm_state = (struct ksm_secStateRef *)
+        parms->secStateRef;
+    int rc;
+
+    DEBUGMSGTL(("ksm", "Starting KSM processing\n"));
+
+    outdata.length = 0;
+    outdata.data = NULL;
+    ivector.length = 0;
+    ivector.data = NULL;
+    pdu_checksum.contents = NULL;
+
+    if (!ksm_state) {
+        /*
+         * If we don't have a ksm_state, then we're a request.  Get a
+         * credential cache and build a ap_req.
+         */
+        retcode = krb5_cc_default(kcontext, &cc);
+
+        if (retcode) {
+            DEBUGMSGTL(("ksm", "KSM: krb5_cc_default failed: %s\n",
+                        error_message(retcode)));
+            snmp_set_detail(error_message(retcode));
+            retval = SNMPERR_KRB5;
+            goto error;
+        }
+
+        DEBUGMSGTL(("ksm", "KSM: Set credential cache successfully\n"));
+
+        /*
+         * This seems odd, since we don't need this until later (or earlier,
+         * depending on how you look at it), but because the most likely
+         * errors are Kerberos at this point, I'll get this now to save
+         * time not encoding the rest of the packet.
+         *
+         * Also, we need the subkey to encrypt the PDU (if required).
+         */
+
+        retcode =
+            krb5_mk_req(kcontext, &auth_context,
+                        AP_OPTS_MUTUAL_REQUIRED | AP_OPTS_USE_SUBKEY,
+                        (char *) "host", parms->session->peername, NULL,
+                        cc, &outdata);
+
+        if (retcode) {
+            DEBUGMSGTL(("ksm", "KSM: krb5_mk_req failed: %s\n",
+                        error_message(retcode)));
+            snmp_set_detail(error_message(retcode));
+            retval = SNMPERR_KRB5;
+            goto error;
+        }
+
+        DEBUGMSGTL(("ksm", "KSM: ticket retrieved successfully\n"));
+
+    } else {
+
+        /*
+         * Grab the auth_context from our security state reference
+         */
+
+        auth_context = ksm_state->auth_context;
+
+        /*
+         * Bundle up an AP_REP.  Note that we do this only when we
+         * have a security state reference (which means we're in an agent
+         * and we're sending a response).
+         */
+
+        DEBUGMSGTL(("ksm", "KSM: Starting reply processing.\n"));
+
+        retcode = krb5_mk_rep(kcontext, auth_context, &outdata);
+
+        if (retcode) {
+            DEBUGMSGTL(("ksm", "KSM: krb5_mk_rep failed: %s\n",
+                        error_message(retcode)));
+            snmp_set_detail(error_message(retcode));
+            retval = SNMPERR_KRB5;
+            goto error;
+        }
+
+        DEBUGMSGTL(("ksm", "KSM: Finished with krb5_mk_rep()\n"));
+    }
+
+    /*
+     * If we have to encrypt the PDU, do that now
+     */
+
+    if (parms->secLevel == SNMP_SEC_LEVEL_AUTHPRIV) {
+
+        DEBUGMSGTL(("ksm", "KSM: Starting PDU encryption.\n"));
+
+        /*
+         * It's weird -
+         *
+         * If we're on the manager, it's a local subkey (because that's in
+         * our AP_REQ)
+         *
+         * If we're on the agent, it's a remote subkey (because that comes
+         * FROM the received AP_REQ).
+         */
+
+        if (ksm_state)
+            retcode = krb5_auth_con_getremotesubkey(kcontext, auth_context,
+                                                    &subkey);
+        else
+            retcode = krb5_auth_con_getlocalsubkey(kcontext, auth_context,
+                                                   &subkey);
+
+        if (retcode) {
+            DEBUGMSGTL(("ksm",
+                        "KSM: krb5_auth_con_getlocalsubkey failed: %s\n",
+                        error_message(retcode)));
+            snmp_set_detail(error_message(retcode));
+            retval = SNMPERR_KRB5;
+            goto error;
+        }
+
+        /*
+         * Note that here we need to handle different things between the
+         * old and new crypto APIs.  First, we need to get the final encrypted
+         * length of the PDU.
+         */
+
+#ifdef MIT_NEW_CRYPTO
+        retcode = krb5_c_encrypt_length(kcontext, subkey->enctype,
+                                        parms->scopedPduLen,
+                                        &encrypted_length);
+
+        if (retcode) {
+            DEBUGMSGTL(("ksm",
+                        "Encryption length calculation failed: %s\n",
+                        error_message(retcode)));
+            snmp_set_detail(error_message(retcode));
+            retval = SNMPERR_KRB5;
+            goto error;
+        }
+#else                           /* MIT_NEW_CRYPTO */
+
+        krb5_use_enctype(kcontext, &eblock, subkey->enctype);
+        retcode = krb5_process_key(kcontext, &eblock, subkey);
+
+        if (retcode) {
+            DEBUGMSGTL(("ksm", "krb5_process_key failed: %s\n",
+                        error_message(retcode)));
+            snmp_set_detail(error_message(retcode));
+            retval = SNMPERR_KRB5;
+            goto error;
+        }
+
+        encrypted_length = krb5_encrypt_size(parms->scopedPduLen,
+                                             eblock.crypto_entry);
+#endif                          /* MIT_NEW_CRYPTO */
+
+        encrypted_data = malloc(encrypted_length);
+
+        if (!encrypted_data) {
+            DEBUGMSGTL(("ksm",
+                        "KSM: Unable to malloc %d bytes for encrypt "
+                        "buffer: %s\n", parms->scopedPduLen,
+                        strerror(errno)));
+            retval = SNMPERR_MALLOC;
+#ifndef MIT_NEW_CRYPTO
+            krb5_finish_key(kcontext, &eblock);
+#endif                          /* ! MIT_NEW_CRYPTO */
+
+            goto error;
+        }
+
+        /*
+         * We need to set up a blank initialization vector for the encryption.
+         * Use a block of all zero's (which is dependent on the block size
+         * of the encryption method).
+         */
+
+#ifdef MIT_NEW_CRYPTO
+
+        retcode = krb5_c_block_size(kcontext, subkey->enctype, &blocksize);
+
+        if (retcode) {
+            DEBUGMSGTL(("ksm",
+                        "Unable to determine crypto block size: %s\n",
+                        error_message(retcode)));
+            snmp_set_detail(error_message(retcode));
+            retval = SNMPERR_KRB5;
+            goto error;
+        }
+#else                           /* MIT_NEW_CRYPTO */
+
+        blocksize =
+            krb5_enctype_array[subkey->enctype]->system->block_length;
+
+#endif                          /* MIT_NEW_CRYPTO */
+
+        ivector.data = malloc(blocksize);
+
+        if (!ivector.data) {
+            DEBUGMSGTL(("ksm", "Unable to allocate %d bytes for ivector\n",
+                        blocksize));
+            retval = SNMPERR_MALLOC;
+            goto error;
+        }
+
+        ivector.length = blocksize;
+        memset(ivector.data, 0, blocksize);
+
+        /*
+         * Finally!  Do the encryption!
+         */
+
+#ifdef MIT_NEW_CRYPTO
+
+        input.data = (char *) parms->scopedPdu;
+        input.length = parms->scopedPduLen;
+        output.ciphertext.data = (char *) encrypted_data;
+        output.ciphertext.length = encrypted_length;
+
+        retcode =
+            krb5_c_encrypt(kcontext, subkey, KSM_KEY_USAGE_ENCRYPTION,
+                           &ivector, &input, &output);
+
+#else                           /* MIT_NEW_CRYPTO */
+
+        retcode = krb5_encrypt(kcontext, (krb5_pointer) parms->scopedPdu,
+                               (krb5_pointer) encrypted_data,
+                               parms->scopedPduLen, &eblock, ivector.data);
+
+        krb5_finish_key(kcontext, &eblock);
+
+#endif                          /* MIT_NEW_CRYPTO */
+
+        if (retcode) {
+            DEBUGMSGTL(("ksm", "KSM: krb5_encrypt failed: %s\n",
+                        error_message(retcode)));
+            retval = SNMPERR_KRB5;
+            snmp_set_detail(error_message(retcode));
+            goto error;
+        }
+
+	*offset = 0;
+
+        rc = asn_realloc_rbuild_string(wholeMsg, parms->wholeMsgLen,
+                                             offset, 1,
+                                             (u_char) (ASN_UNIVERSAL |
+                                                       ASN_PRIMITIVE |
+                                                       ASN_OCTET_STR),
+                                             encrypted_data,
+                                             encrypted_length);
+
+        if (rc == 0) {
+            DEBUGMSGTL(("ksm", "Building encrypted payload failed.\n"));
+            retval = SNMPERR_TOO_LONG;
+            goto error;
+        }
+
+        DEBUGMSGTL(("ksm", "KSM: Encryption complete.\n"));
+
+    } else {
+        /*
+         * Plaintext PDU (not encrypted)
+         */
+
+        if (*parms->wholeMsgLen < parms->scopedPduLen) {
+            DEBUGMSGTL(("ksm", "Not enough room for plaintext PDU.\n"));
+            retval = SNMPERR_TOO_LONG;
+            goto error;
+        }
+    }
+
+    /*
+     * Start encoding the msgSecurityParameters
+     *
+     * For now, use 0 for the response hint
+     */
+
+    DEBUGMSGTL(("ksm", "KSM: scopedPdu added to payload\n"));
+
+    seq_offset = *offset;
+
+    rc = asn_realloc_rbuild_int(wholeMsg, parms->wholeMsgLen,
+                                      offset, 1,
+                                      (u_char) (ASN_UNIVERSAL |
+                                                ASN_PRIMITIVE |
+                                                ASN_INTEGER),
+                                      (long *) &zero, sizeof(zero));
+
+    if (rc == 0) {
+        DEBUGMSGTL(("ksm", "Building ksm security parameters failed.\n"));
+        retval = SNMPERR_TOO_LONG;
+        goto error;
+    }
+
+    rc = asn_realloc_rbuild_string(wholeMsg, parms->wholeMsgLen,
+                                         offset, 1,
+                                         (u_char) (ASN_UNIVERSAL |
+                                                   ASN_PRIMITIVE |
+                                                   ASN_OCTET_STR),
+                                         (u_char *) outdata.data,
+                                         outdata.length);
+
+    if (rc == 0) {
+        DEBUGMSGTL(("ksm", "Building ksm AP_REQ failed.\n"));
+        retval = SNMPERR_TOO_LONG;
+        goto error;
+    }
+
+    /*
+     * Now, we need to pick the "right" checksum algorithm.  For old
+     * crypto, just pick CKSUMTYPE_RSA_MD5_DES; for new crypto, pick
+     * one of the "approved" ones.
+     */
+
+#ifdef MIT_NEW_CRYPTO
+    retcode = krb5_c_keyed_checksum_types(kcontext, subkey->enctype,
+                                          &numcksumtypes, &cksumtype_array);
+
+    if (retcode) {
+	DEBUGMSGTL(("ksm", "Unable to find appropriate keyed checksum: %s\n",
+		    error_message(retcode)));
+	snmp_set_detail(error_message(retcode));
+        retval = SNMPERR_KRB5;
+        goto error;
+    }
+
+    if (numcksumtypes <= 0) {
+	DEBUGMSGTL(("ksm", "We received a list of zero cksumtypes for this "
+		    "enctype (%d)\n", subkey->enctype));
+	snmp_set_detail("No valid checksum type for this encryption type");
+	retval = SNMPERR_KRB5;
+	goto error;
+    }
+
+    /*
+     * It's not clear to me from the API which checksum you're supposed
+     * to support, so I'm taking a guess at the first one
+     */
+
+    cksumtype = cksumtype_array[0];
+
+    krb5_free_cksumtypes(kcontext, cksumtype_array);
+
+    DEBUGMSGTL(("ksm", "KSM: Choosing checksum type of %d (subkey type "
+		"of %d)\n", cksumtype, subkey->enctype));
+
+    retcode = krb5_c_checksum_length(kcontext, cksumtype, &blocksize);
+
+    if (retcode) {
+        DEBUGMSGTL(("ksm", "Unable to determine checksum length: %s\n",
+                    error_message(retcode)));
+        snmp_set_detail(error_message(retcode));
+        retval = SNMPERR_KRB5;
+        goto error;
+    }
+
+    pdu_checksum.length = blocksize;
+
+#else /* MIT_NEW_CRYPTO */
+    if (ksm_state)
+        cksumtype = ksm_state->cksumtype;
+    else
+	cksumtype = CKSUMTYPE_RSA_MD5_DES;
+
+    if (!is_keyed_cksum(cksumtype)) {
+        DEBUGMSGTL(("ksm", "Checksum type %d is not a keyed checksum\n",
+                    cksumtype));
+        snmp_set_detail("Checksum is not a keyed checksum");
+        retval = SNMPERR_KRB5;
+        goto error;
+    }
+
+    if (!is_coll_proof_cksum(cksumtype)) {
+        DEBUGMSGTL(("ksm", "Checksum type %d is not a collision-proof "
+                    "checksum\n", cksumtype));
+        snmp_set_detail("Checksum is not a collision-proof checksum");
+        retval = SNMPERR_KRB5;
+        goto error;
+    }
+
+    pdu_checksum.length = krb5_checksum_size(kcontext, cksumtype);
+    pdu_checksum.checksum_type = cksumtype;
+
+#endif /* MIT_NEW_CRYPTO */
+
+    /*
+     * Note that here, we're just leaving blank space for the checksum;
+     * we remember where that is, and we'll fill it in later.
+     */
+
+    *offset += pdu_checksum.length;
+    memset(*wholeMsg + *parms->wholeMsgLen - *offset, 0, pdu_checksum.length);
+
+    cksum_pointer = *wholeMsg + *parms->wholeMsgLen - *offset;
+
+    rc = asn_realloc_rbuild_header(wholeMsg, parms->wholeMsgLen,
+                                         parms->wholeMsgOffset, 1,
+                                         (u_char) (ASN_UNIVERSAL |
+                                                   ASN_PRIMITIVE |
+                                                   ASN_OCTET_STR),
+                                         pdu_checksum.length);
+
+    if (rc == 0) {
+        DEBUGMSGTL(("ksm", "Building ksm security parameters failed.\n"));
+        retval = SNMPERR_TOO_LONG;
+        goto error;
+    }
+
+    rc = asn_realloc_rbuild_int(wholeMsg, parms->wholeMsgLen,
+                                      parms->wholeMsgOffset, 1,
+                                      (u_char) (ASN_UNIVERSAL |
+                                                ASN_PRIMITIVE |
+                                                ASN_OCTET_STR),
+                                      (long *) &cksumtype,
+                                      sizeof(cksumtype));
+
+    if (rc == 0) {
+        DEBUGMSGTL(("ksm", "Building ksm security parameters failed.\n"));
+        retval = SNMPERR_TOO_LONG;
+        goto error;
+    }
+
+    rc = asn_realloc_rbuild_sequence(wholeMsg, parms->wholeMsgLen,
+                                           parms->wholeMsgOffset, 1,
+                                           (u_char) (ASN_SEQUENCE |
+                                                     ASN_CONSTRUCTOR),
+                                           *offset - seq_offset);
+
+    if (rc == 0) {
+        DEBUGMSGTL(("ksm", "Building ksm security parameters failed.\n"));
+        retval = SNMPERR_TOO_LONG;
+        goto error;
+    }
+
+    rc = asn_realloc_rbuild_header(wholeMsg, parms->wholeMsgLen,
+                                         parms->wholeMsgOffset, 1,
+                                         (u_char) (ASN_UNIVERSAL |
+                                                   ASN_PRIMITIVE |
+                                                   ASN_OCTET_STR),
+                                         *offset - seq_offset);
+
+    if (rc == 0) {
+        DEBUGMSGTL(("ksm", "Building ksm security parameters failed.\n"));
+        retval = SNMPERR_TOO_LONG;
+        goto error;
+    }
+
+    DEBUGMSGTL(("ksm", "KSM: Security parameter encoding completed\n"));
+
+    /*
+     * We're done with the KSM security parameters - now we do the global
+     * header and wrap up the whole PDU.
+     */
+
+    if (*parms->wholeMsgLen < parms->globalDataLen) {
+        DEBUGMSGTL(("ksm", "Building global data failed.\n"));
+        retval = SNMPERR_TOO_LONG;
+        goto error;
+    }
+
+    *offset += parms->globalDataLen;
+    memcpy(*wholeMsg + *parms->wholeMsgLen - *offset,
+	   parms->globalData, parms->globalDataLen);
+
+    rc = asn_realloc_rbuild_sequence(wholeMsg, parms->wholeMsgLen,
+                                           offset, 1,
+                                           (u_char) (ASN_SEQUENCE |
+                                                     ASN_CONSTRUCTOR),
+                                           *offset);
+
+    if (rc == 0) {
+        DEBUGMSGTL(("ksm", "Building master packet sequence.\n"));
+        retval = SNMPERR_TOO_LONG;
+        goto error;
+    }
+
+    DEBUGMSGTL(("ksm", "KSM: PDU master packet encoding complete.\n"));
+
+    /*
+     * Now we need to checksum the entire PDU (since it's built).
+     */
+
+    pdu_checksum.contents = malloc(pdu_checksum.length);
+
+    if (!pdu_checksum.contents) {
+        DEBUGMSGTL(("ksm", "Unable to malloc %d bytes for checksum\n",
+                    pdu_checksum.length));
+        retval = SNMPERR_MALLOC;
+        goto error;
+    }
+
+    /*
+     * If we didn't encrypt the packet, we haven't yet got the subkey.
+     * Get that now.
+     */
+
+    if (!subkey) {
+        if (ksm_state)
+            retcode = krb5_auth_con_getremotesubkey(kcontext, auth_context,
+                                                    &subkey);
+        else
+            retcode = krb5_auth_con_getlocalsubkey(kcontext, auth_context,
+                                                   &subkey);
+        if (retcode) {
+            DEBUGMSGTL(("ksm", "krb5_auth_con_getlocalsubkey failed: %s\n",
+                        error_message(retcode)));
+            snmp_set_detail(error_message(retcode));
+            retval = SNMPERR_KRB5;
+            goto error;
+        }
+    }
+#ifdef MIT_NEW_CRYPTO
+
+    input.data = (char *) (*wholeMsg + *parms->wholeMsgLen - *offset);
+    input.length = *offset;
+        retcode = krb5_c_make_checksum(kcontext, cksumtype, subkey,
+                                       KSM_KEY_USAGE_CHECKSUM, &input,
+                                       &pdu_checksum);
+
+#else                           /* MIT_NEW_CRYPTO */
+
+    retcode = krb5_calculate_checksum(kcontext, cksumtype, *wholeMsg +
+				      *parms->wholeMsgLen - *offset,
+                                      *offset,
+                                      (krb5_pointer) subkey->contents,
+                                      subkey->length, &pdu_checksum);
+
+#endif                          /* MIT_NEW_CRYPTO */
+
+    if (retcode) {
+        DEBUGMSGTL(("ksm", "Calculate checksum failed: %s\n",
+                    error_message(retcode)));
+        retval = SNMPERR_KRB5;
+        snmp_set_detail(error_message(retcode));
+        goto error;
+    }
+
+    DEBUGMSGTL(("ksm", "KSM: Checksum calculation complete.\n"));
+
+    memcpy(cksum_pointer, pdu_checksum.contents, pdu_checksum.length);
+
+    DEBUGMSGTL(("ksm", "KSM: Writing checksum of %d bytes at offset %d\n",
+                pdu_checksum.length, cksum_pointer - (*wholeMsg + 1)));
+
+    DEBUGMSGTL(("ksm", "KSM: Checksum:"));
+
+    for (i = 0; i < pdu_checksum.length; i++)
+        DEBUGMSG(("ksm", " %02x",
+                  (unsigned int) pdu_checksum.contents[i]));
+
+    DEBUGMSG(("ksm", "\n"));
+
+    /*
+     * If we're _not_ called as part of a response (null ksm_state),
+     * then save the auth_context for later using our cache routines.
+     */
+
+    if (!ksm_state) {
+        if ((retval = ksm_insert_cache(parms->pdu->msgid, auth_context,
+                                       (u_char *) parms->secName,
+                                       parms->secNameLen)) !=
+            SNMPERR_SUCCESS)
+            goto error;
+        auth_context = NULL;
+    }
+
+    DEBUGMSGTL(("ksm", "KSM processing complete!\n"));
+
+  error:
+
+    if (pdu_checksum.contents)
+#ifdef MIT_NEW_CRYPTO
+        krb5_free_checksum_contents(kcontext, &pdu_checksum);
+#else                           /* MIT_NEW_CRYPTO */
+        free(pdu_checksum.contents);
+#endif                          /* MIT_NEW_CRYPTO */
+
+    if (ivector.data)
+        free(ivector.data);
+
+    if (subkey)
+        krb5_free_keyblock(kcontext, subkey);
+
+    if (encrypted_data)
+        free(encrypted_data);
+
+    if (cc)
+        krb5_cc_close(kcontext, cc);
+
+    if (auth_context && !ksm_state)
+        krb5_auth_con_free(kcontext, auth_context);
+
+    return retval;
+}
+
+/****************************************************************************
+ *
+ * ksm_process_in_msg
+ *
+ * Parameters:
+ *	(See list below...)
+ *
+ * Returns:
+ *	KSM_ERR_NO_ERROR                        On success.
+ *	SNMPERR_KRB5
+ *	KSM_ERR_GENERIC_ERROR
+ *	KSM_ERR_UNSUPPORTED_SECURITY_LEVEL
+ *
+ *
+ * Processes an incoming message.
+ *
+ ****************************************************************************/
+
+int
+ksm_process_in_msg(struct snmp_secmod_incoming_params *parms)
+{
+    long            temp;
+    krb5_cksumtype  cksumtype;
+    krb5_auth_context auth_context = NULL;
+    krb5_error_code retcode;
+    krb5_checksum   checksum;
+    krb5_data       ap_req, ivector;
+    krb5_flags      flags;
+    krb5_keyblock  *subkey = NULL;
+#ifdef MIT_NEW_CRYPTO
+    krb5_data       input, output;
+    krb5_boolean    valid;
+    krb5_enc_data   in_crypt;
+#else                           /* MIT_NEW_CRYPTO */
+    krb5_encrypt_block eblock;
+#endif                          /* MIT_NEW_CRYPTO */
+    krb5_ticket    *ticket = NULL;
+    int             retval = SNMPERR_SUCCESS, response = 0;
+    size_t          length =
+        parms->wholeMsgLen - (u_int) (parms->secParams - parms->wholeMsg);
+    u_char         *current = parms->secParams, type;
+    size_t          cksumlength, blocksize;
+    long            hint;
+    char           *cname;
+    struct ksm_secStateRef *ksm_state;
+    struct ksm_cache_entry *entry;
+
+    DEBUGMSGTL(("ksm", "Processing has begun\n"));
+
+    checksum.contents = NULL;
+    ap_req.data = NULL;
+    ivector.length = 0;
+    ivector.data = NULL;
+
+    /*
+     * First, parse the security parameters (because we need the subkey inside
+     * of the ticket to do anything
+     */
+
+    if ((current = asn_parse_sequence(current, &length, &type,
+                                      (ASN_UNIVERSAL | ASN_PRIMITIVE |
+                                       ASN_OCTET_STR),
+                                      "ksm first octet")) == NULL) {
+        DEBUGMSGTL(("ksm", "Initial security paramter parsing failed\n"));
+
+        retval = SNMPERR_ASN_PARSE_ERR;
+        goto error;
+    }
+
+    if ((current = asn_parse_sequence(current, &length, &type,
+                                      (ASN_SEQUENCE | ASN_CONSTRUCTOR),
+                                      "ksm sequence")) == NULL) {
+        DEBUGMSGTL(("ksm",
+                    "Security parameter sequence parsing failed\n"));
+
+        retval = SNMPERR_ASN_PARSE_ERR;
+        goto error;
+    }
+
+    if ((current = asn_parse_int(current, &length, &type, &temp,
+                                 sizeof(temp))) == NULL) {
+        DEBUGMSGTL(("ksm", "Security parameter checksum type parsing"
+                    "failed\n"));
+
+        retval = SNMPERR_ASN_PARSE_ERR;
+        goto error;
+    }
+
+    cksumtype = temp;
+
+#ifdef MIT_NEW_CRYPTO
+    if (!krb5_c_valid_cksumtype(cksumtype)) {
+        DEBUGMSGTL(("ksm", "Invalid checksum type (%d)\n", cksumtype));
+
+        retval = SNMPERR_KRB5;
+        snmp_set_detail("Invalid checksum type");
+        goto error;
+    }
+
+    if (!krb5_c_is_keyed_cksum(cksumtype)) {
+        DEBUGMSGTL(("ksm", "Checksum type %d is not a keyed checksum\n",
+                    cksumtype));
+        snmp_set_detail("Checksum is not a keyed checksum");
+        retval = SNMPERR_KRB5;
+        goto error;
+    }
+
+    if (!krb5_c_is_coll_proof_cksum(cksumtype)) {
+        DEBUGMSGTL(("ksm", "Checksum type %d is not a collision-proof "
+                    "checksum\n", cksumtype));
+        snmp_set_detail("Checksum is not a collision-proof checksum");
+        retval = SNMPERR_KRB5;
+        goto error;
+    }
+#else /* ! MIT_NEW_CRYPTO */
+    if (!valid_cksumtype(cksumtype)) {
+        DEBUGMSGTL(("ksm", "Invalid checksum type (%d)\n", cksumtype));
+
+        retval = SNMPERR_KRB5;
+        snmp_set_detail("Invalid checksum type");
+        goto error;
+    }
+
+    if (!is_keyed_cksum(cksumtype)) {
+        DEBUGMSGTL(("ksm", "Checksum type %d is not a keyed checksum\n",
+                    cksumtype));
+        snmp_set_detail("Checksum is not a keyed checksum");
+        retval = SNMPERR_KRB5;
+        goto error;
+    }
+
+    if (!is_coll_proof_cksum(cksumtype)) {
+        DEBUGMSGTL(("ksm", "Checksum type %d is not a collision-proof "
+                    "checksum\n", cksumtype));
+        snmp_set_detail("Checksum is not a collision-proof checksum");
+        retval = SNMPERR_KRB5;
+        goto error;
+    }
+#endif /* MIT_NEW_CRYPTO */
+
+    checksum.checksum_type = cksumtype;
+
+    cksumlength = length;
+
+    if ((current = asn_parse_sequence(current, &cksumlength, &type,
+                                      (ASN_UNIVERSAL | ASN_PRIMITIVE |
+                                       ASN_OCTET_STR), "ksm checksum")) ==
+        NULL) {
+        DEBUGMSGTL(("ksm",
+                    "Security parameter checksum parsing failed\n"));
+
+        retval = SNMPERR_ASN_PARSE_ERR;
+        goto error;
+    }
+
+    checksum.contents = malloc(cksumlength);
+    if (!checksum.contents) {
+        DEBUGMSGTL(("ksm", "Unable to malloc %d bytes for checksum.\n",
+                    cksumlength));
+        retval = SNMPERR_MALLOC;
+        goto error;
+    }
+
+    memcpy(checksum.contents, current, cksumlength);
+
+    checksum.length = cksumlength;
+    checksum.checksum_type = cksumtype;
+
+    /*
+     * Zero out the checksum so the validation works correctly
+     */
+
+    memset(current, 0, cksumlength);
+
+    current += cksumlength;
+    length = parms->wholeMsgLen - (u_int) (current - parms->wholeMsg);
+
+    if ((current = asn_parse_sequence(current, &length, &type,
+                                      (ASN_UNIVERSAL | ASN_PRIMITIVE |
+                                       ASN_OCTET_STR), "ksm ap_req")) ==
+        NULL) {
+        DEBUGMSGTL(("ksm", "KSM security parameter AP_REQ/REP parsing "
+                    "failed\n"));
+
+        retval = SNMPERR_ASN_PARSE_ERR;
+        goto error;
+    }
+
+    ap_req.length = length;
+    ap_req.data = malloc(length);
+    if (!ap_req.data) {
+        DEBUGMSGTL(("ksm",
+                    "KSM unable to malloc %d bytes for AP_REQ/REP.\n",
+                    length));
+        retval = SNMPERR_MALLOC;
+        goto error;
+    }
+
+    memcpy(ap_req.data, current, length);
+
+    current += length;
+    length = parms->wholeMsgLen - (u_int) (current - parms->wholeMsg);
+
+    if ((current = asn_parse_int(current, &length, &type, &hint,
+                                 sizeof(hint))) == NULL) {
+        DEBUGMSGTL(("ksm",
+                    "KSM security parameter hint parsing failed\n"));
+
+        retval = SNMPERR_ASN_PARSE_ERR;
+        goto error;
+    }
+
+    /*
+     * Okay!  We've got it all!  Now try decoding the damn ticket.
+     *
+     * But of course there's a WRINKLE!  We need to figure out if we're
+     * processing a AP_REQ or an AP_REP.  How do we do that?  We're going
+     * to cheat, and look at the first couple of bytes (which is what
+     * the Kerberos library routines do anyway).
+     *
+     * If there are ever new Kerberos message formats, we'll need to fix
+     * this here.
+     *
+     * If it's a _response_, then we need to get the auth_context
+     * from our cache.
+     */
+
+    if (ap_req.length
+        && (ap_req.data[0] == 0x6e || ap_req.data[0] == 0x4e)) {
+
+        /*
+         * We need to initalize the authorization context, and set the
+         * replay cache in it (and initialize the replay cache if we
+         * haven't already
+         */
+
+        retcode = krb5_auth_con_init(kcontext, &auth_context);
+
+        if (retcode) {
+            DEBUGMSGTL(("ksm", "krb5_auth_con_init failed: %s\n",
+                        error_message(retcode)));
+            retval = SNMPERR_KRB5;
+            snmp_set_detail(error_message(retcode));
+            goto error;
+        }
+
+        if (!rcache) {
+            krb5_data       server;
+            server.data = "host";
+            server.length = strlen(server.data);
+
+            retcode = krb5_get_server_rcache(kcontext, &server, &rcache);
+
+            if (retcode) {
+                DEBUGMSGTL(("ksm", "krb5_get_server_rcache failed: %s\n",
+                            error_message(retcode)));
+                retval = SNMPERR_KRB5;
+                snmp_set_detail(error_message(retcode));
+                goto error;
+            }
+        }
+
+        retcode = krb5_auth_con_setrcache(kcontext, auth_context, rcache);
+
+        if (retcode) {
+            DEBUGMSGTL(("ksm", "krb5_auth_con_setrcache failed: %s\n",
+                        error_message(retcode)));
+            retval = SNMPERR_KRB5;
+            snmp_set_detail(error_message(retcode));
+            goto error;
+        }
+
+        retcode = krb5_rd_req(kcontext, &auth_context, &ap_req, NULL,
+                              NULL, &flags, &ticket);
+
+        krb5_auth_con_setrcache(kcontext, auth_context, NULL);
+
+        if (retcode) {
+            DEBUGMSGTL(("ksm", "krb5_rd_req() failed: %s\n",
+                        error_message(retcode)));
+            retval = SNMPERR_KRB5;
+            snmp_set_detail(error_message(retcode));
+            goto error;
+        }
+
+        retcode =
+            krb5_unparse_name(kcontext, ticket->enc_part2->client, &cname);
+
+        if (retcode == 0) {
+            DEBUGMSGTL(("ksm", "KSM authenticated principal name: %s\n",
+                        cname));
+            free(cname);
+        }
+
+        /*
+         * Check to make sure AP_OPTS_MUTUAL_REQUIRED was set
+         */
+
+        if (!(flags & AP_OPTS_MUTUAL_REQUIRED)) {
+            DEBUGMSGTL(("ksm",
+                        "KSM MUTUAL_REQUIRED not set in request!\n"));
+            retval = SNMPERR_KRB5;
+            snmp_set_detail("MUTUAL_REQUIRED not set in message");
+            goto error;
+        }
+
+        retcode =
+            krb5_auth_con_getremotesubkey(kcontext, auth_context, &subkey);
+
+        if (retcode) {
+            DEBUGMSGTL(("ksm", "KSM remote subkey retrieval failed: %s\n",
+                        error_message(retcode)));
+            retval = SNMPERR_KRB5;
+            snmp_set_detail(error_message(retcode));
+            goto error;
+        }
+
+    } else if (ap_req.length && (ap_req.data[0] == 0x6f ||
+                                 ap_req.data[0] == 0x4f)) {
+        /*
+         * Looks like a response; let's see if we've got that auth_context
+         * in our cache.
+         */
+
+        krb5_ap_rep_enc_part *repl = NULL;
+
+        response = 1;
+
+        entry = ksm_get_cache(parms->pdu->msgid);
+
+        if (!entry) {
+            DEBUGMSGTL(("ksm",
+                        "KSM: Unable to find auth_context for PDU with "
+                        "message ID of %ld\n", parms->pdu->msgid));
+            retval = SNMPERR_KRB5;
+            goto error;
+        }
+
+        auth_context = entry->auth_context;
+
+        /*
+         * In that case, let's call the rd_rep function
+         */
+
+        retcode = krb5_rd_rep(kcontext, auth_context, &ap_req, &repl);
+
+        if (repl)
+            krb5_free_ap_rep_enc_part(kcontext, repl);
+
+        if (retcode) {
+            DEBUGMSGTL(("ksm", "KSM: krb5_rd_rep() failed: %s\n",
+                        error_message(retcode)));
+            retval = SNMPERR_KRB5;
+            goto error;
+        }
+
+        DEBUGMSGTL(("ksm", "KSM: krb5_rd_rep() decoded successfully.\n"));
+
+        retcode =
+            krb5_auth_con_getlocalsubkey(kcontext, auth_context, &subkey);
+
+        if (retcode) {
+            DEBUGMSGTL(("ksm", "Unable to retrieve local subkey: %s\n",
+                        error_message(retcode)));
+            retval = SNMPERR_KRB5;
+            snmp_set_detail("Unable to retrieve local subkey");
+            goto error;
+        }
+
+    } else {
+        DEBUGMSGTL(("ksm", "Unknown Kerberos message type (%02x)\n",
+                    ap_req.data[0]));
+        retval = SNMPERR_KRB5;
+        snmp_set_detail("Unknown Kerberos message type");
+        goto error;
+    }
+
+#ifdef MIT_NEW_CRYPTO
+    input.data = (char *) parms->wholeMsg;
+    input.length = parms->wholeMsgLen;
+
+    retcode =
+        krb5_c_verify_checksum(kcontext, subkey, KSM_KEY_USAGE_CHECKSUM,
+                               &input, &checksum, &valid);
+#else                           /* MIT_NEW_CRYPTO */
+    retcode = krb5_verify_checksum(kcontext, cksumtype, &checksum,
+                                   parms->wholeMsg, parms->wholeMsgLen,
+                                   (krb5_pointer) subkey->contents,
+                                   subkey->length);
+#endif                          /* MIT_NEW_CRYPTO */
+
+    if (retcode) {
+        DEBUGMSGTL(("ksm", "KSM checksum verification failed: %s\n",
+                    error_message(retcode)));
+        retval = SNMPERR_KRB5;
+        snmp_set_detail(error_message(retcode));
+        goto error;
+    }
+
+    /*
+     * Don't ask me why they didn't simply return an error, but we have
+     * to check to see if "valid" is false.
+     */
+
+#ifdef MIT_NEW_CRYPTO
+    if (!valid) {
+        DEBUGMSGTL(("ksm", "Computed checksum did not match supplied "
+                    "checksum!\n"));
+        retval = SNMPERR_KRB5;
+        snmp_set_detail
+            ("Computed checksum did not match supplied checksum");
+        goto error;
+    }
+#endif                          /* MIT_NEW_CRYPTO */
+
+    /*
+     * Handle an encrypted PDU.  Note that it's an OCTET_STRING of the
+     * output of whatever Kerberos cryptosystem you're using (defined by
+     * the encryption type).  Note that this is NOT the EncryptedData
+     * sequence - it's what goes in the "cipher" field of EncryptedData.
+     */
+
+    if (parms->secLevel == SNMP_SEC_LEVEL_AUTHPRIV) {
+
+        if ((current = asn_parse_sequence(current, &length, &type,
+                                          (ASN_UNIVERSAL | ASN_PRIMITIVE |
+                                           ASN_OCTET_STR), "ksm pdu")) ==
+            NULL) {
+            DEBUGMSGTL(("ksm", "KSM sPDU octet decoding failed\n"));
+            retval = SNMPERR_ASN_PARSE_ERR;
+            goto error;
+        }
+
+        /*
+         * The PDU is now pointed at by "current", and the length is in
+         * "length".
+         */
+
+        DEBUGMSGTL(("ksm", "KSM starting sPDU decode\n"));
+
+        /*
+         * We need to set up a blank initialization vector for the decryption.
+         * Use a block of all zero's (which is dependent on the block size
+         * of the encryption method).
+         */
+
+#ifdef MIT_NEW_CRYPTO
+
+        retcode = krb5_c_block_size(kcontext, subkey->enctype, &blocksize);
+
+        if (retcode) {
+            DEBUGMSGTL(("ksm",
+                        "Unable to determine crypto block size: %s\n",
+                        error_message(retcode)));
+            snmp_set_detail(error_message(retcode));
+            retval = SNMPERR_KRB5;
+            goto error;
+        }
+#else                           /* MIT_NEW_CRYPTO */
+
+        blocksize =
+            krb5_enctype_array[subkey->enctype]->system->block_length;
+
+#endif                          /* MIT_NEW_CRYPTO */
+
+        ivector.data = malloc(blocksize);
+
+        if (!ivector.data) {
+            DEBUGMSGTL(("ksm", "Unable to allocate %d bytes for ivector\n",
+                        blocksize));
+            retval = SNMPERR_MALLOC;
+            goto error;
+        }
+
+        ivector.length = blocksize;
+        memset(ivector.data, 0, blocksize);
+
+#ifndef MIT_NEW_CRYPTO
+
+        krb5_use_enctype(kcontext, &eblock, subkey->enctype);
+
+        retcode = krb5_process_key(kcontext, &eblock, subkey);
+
+        if (retcode) {
+            DEBUGMSGTL(("ksm", "KSM key post-processing failed: %s\n",
+                        error_message(retcode)));
+            snmp_set_detail(error_message(retcode));
+            retval = SNMPERR_KRB5;
+            goto error;
+        }
+#endif                          /* !MIT_NEW_CRYPTO */
+
+        if (length > *parms->scopedPduLen) {
+            DEBUGMSGTL(("ksm", "KSM not enough room - have %d bytes to "
+                        "decrypt but only %d bytes available\n", length,
+                        *parms->scopedPduLen));
+            retval = SNMPERR_TOO_LONG;
+#ifndef MIT_NEW_CRYPTO
+            krb5_finish_key(kcontext, &eblock);
+#endif                          /* ! MIT_NEW_CRYPTO */
+            goto error;
+        }
+#ifdef MIT_NEW_CRYPTO
+        in_crypt.ciphertext.data = (char *) current;
+        in_crypt.ciphertext.length = length;
+        in_crypt.enctype = subkey->enctype;
+        output.data = (char *) *parms->scopedPdu;
+        output.length = *parms->scopedPduLen;
+
+        retcode =
+            krb5_c_decrypt(kcontext, subkey, KSM_KEY_USAGE_ENCRYPTION,
+                           &ivector, &in_crypt, &output);
+#else                           /* MIT_NEW_CRYPTO */
+
+        retcode = krb5_decrypt(kcontext, (krb5_pointer) current,
+                               *parms->scopedPdu, length, &eblock,
+                               ivector.data);
+
+        krb5_finish_key(kcontext, &eblock);
+
+#endif                          /* MIT_NEW_CRYPTO */
+
+        if (retcode) {
+            DEBUGMSGTL(("ksm", "Decryption failed: %s\n",
+                        error_message(retcode)));
+            snmp_set_detail(error_message(retcode));
+            retval = SNMPERR_KRB5;
+            goto error;
+        }
+
+        *parms->scopedPduLen = length;
+
+    } else {
+        /*
+         * Clear PDU
+         */
+
+        *parms->scopedPdu = current;
+        *parms->scopedPduLen =
+            parms->wholeMsgLen - (current - parms->wholeMsg);
+    }
+
+    /*
+     * A HUGE GROSS HACK
+     */
+
+    *parms->maxSizeResponse = parms->maxMsgSize - 200;
+
+    DEBUGMSGTL(("ksm", "KSM processing complete\n"));
+
+    /*
+     * Set the secName to the right value (a hack for now).  But that's
+     * only used for when we're processing a request, not a response.
+     */
+
+    if (!response) {
+
+        retcode = krb5_unparse_name(kcontext, ticket->enc_part2->client,
+                                    &cname);
+
+        if (retcode) {
+            DEBUGMSGTL(("ksm", "KSM krb5_unparse_name failed: %s\n",
+                        error_message(retcode)));
+            snmp_set_detail(error_message(retcode));
+            retval = SNMPERR_KRB5;
+            goto error;
+        }
+
+        if (strlen(cname) > *parms->secNameLen + 1) {
+            DEBUGMSGTL(("ksm",
+                        "KSM: Principal length (%d) is too long (%d)\n",
+                        strlen(cname), parms->secNameLen));
+            retval = SNMPERR_TOO_LONG;
+            free(cname);
+            goto error;
+        }
+
+        strcpy(parms->secName, cname);
+        *parms->secNameLen = strlen(cname);
+
+        free(cname);
+
+        /*
+         * Also, if we're not a response, keep around our auth_context so we
+         * can encode the reply message correctly
+         */
+
+        ksm_state = SNMP_MALLOC_STRUCT(ksm_secStateRef);
+
+        if (!ksm_state) {
+            DEBUGMSGTL(("ksm", "KSM unable to malloc memory for "
+                        "ksm_secStateRef\n"));
+            retval = SNMPERR_MALLOC;
+            goto error;
+        }
+
+        ksm_state->auth_context = auth_context;
+        auth_context = NULL;
+        ksm_state->cksumtype = cksumtype;
+
+        *parms->secStateRef = ksm_state;
+    } else {
+
+        /*
+         * We _still_ have to set the secName in process_in_msg().  Do
+         * that now with what we were passed in before (we cached it,
+         * remember?)
+         */
+
+        memcpy(parms->secName, entry->secName, entry->secNameLen);
+        *parms->secNameLen = entry->secNameLen;
+    }
+
+    /*
+     * Just in case
+     */
+
+    parms->secEngineID = (u_char *) "";
+    *parms->secEngineIDLen = 0;
+
+    auth_context = NULL;        /* So we don't try to free it on success */
+
+  error:
+    if (retval == SNMPERR_ASN_PARSE_ERR &&
+        snmp_increment_statistic(STAT_SNMPINASNPARSEERRS) == 0)
+        DEBUGMSGTL(("ksm", "Failed to increment statistics.\n"));
+
+    if (subkey)
+        krb5_free_keyblock(kcontext, subkey);
+
+    if (checksum.contents)
+        free(checksum.contents);
+
+    if (ivector.data)
+        free(ivector.data);
+
+    if (ticket)
+        krb5_free_ticket(kcontext, ticket);
+
+    if (!response && auth_context)
+        krb5_auth_con_free(kcontext, auth_context);
+
+    if (ap_req.data)
+        free(ap_req.data);
+
+    return retval;
+}
diff -Naur tomato/release/src/router/snmp/snmplib/snmp_logging.c tomato121/release/src/router/snmp/snmplib/snmp_logging.c
--- tomato/release/src/router/snmp/snmplib/snmp_logging.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/snmplib/snmp_logging.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,419 @@
+/*
+ * logging.c - generic logging for snmp-agent
+ * * Contributed by Ragnar Kjørstad, ucd@ragnark.vestdata.no 1999-06-26 
+ */
+
+#include <net-snmp/net-snmp-config.h>
+#include <stdio.h>
+#if HAVE_MALLOC_H
+#include <malloc.h>
+#endif
+#if HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+#if HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <errno.h>
+#if HAVE_SYSLOG_H
+#include <syslog.h>
+#ifndef LOG_CONS                /* Interesting Ultrix feature */
+#include <sys/syslog.h>
+#endif
+#endif
+#if TIME_WITH_SYS_TIME
+# ifdef WIN32
+#  include <sys/timeb.h>
+# else
+#  include <sys/time.h>
+# endif
+# include <time.h>
+#else
+# if HAVE_SYS_TIME_H
+#  include <sys/time.h>
+# else
+#  include <time.h>
+# endif
+#endif
+#if HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+
+#if HAVE_STDARG_H
+#include <stdarg.h>
+#else
+#include <varargs.h>
+#endif
+
+#if HAVE_DMALLOC_H
+#include <dmalloc.h>
+#endif
+
+#if HAVE_WINSOCK_H
+#include <winsock.h>
+#endif
+
+#if HAVE_WINDOWS_H
+#include <windows.h>
+#endif
+
+#include <net-snmp/types.h>
+#include <net-snmp/output_api.h>
+#include <net-snmp/library/snmp_logging.h>      /* For this file's "internal" definitions */
+#include <net-snmp/config_api.h>
+#include <net-snmp/utilities.h>
+
+#include <net-snmp/library/callback.h>
+#define LOGLENGTH 1024
+
+static int      do_syslogging = 0;
+static int      do_filelogging = 0;
+static int      do_stderrlogging = 1;
+static int      do_log_callback = 0;
+static int      newline = 1;
+static FILE    *logfile;
+#ifdef WIN32
+static HANDLE   eventlog_h;
+#endif
+
+#ifndef HAVE_VSNPRINTF
+                /*
+                 * Need to use the UCD-provided one 
+                 */
+int             vsnprintf(char *str, size_t count, const char *fmt,
+                          va_list arg);
+#endif
+
+void
+init_snmp_logging(void)
+{
+    netsnmp_ds_register_premib(ASN_BOOLEAN, "snmp", "logTimestamp", 
+			 NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_LOG_TIMESTAMP);
+}
+
+int
+snmp_get_do_logging(void)
+{
+    return (do_syslogging || do_filelogging || do_stderrlogging ||
+            do_log_callback);
+}
+
+
+static char    *
+sprintf_stamp(time_t * now, char *sbuf)
+{
+    time_t          Now;
+    struct tm      *tm;
+
+    if (now == NULL) {
+        now = &Now;
+        time(now);
+    }
+    tm = localtime(now);
+    sprintf(sbuf, "%.4d-%.2d-%.2d %.2d:%.2d:%.2d ",
+            tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday,
+            tm->tm_hour, tm->tm_min, tm->tm_sec);
+    return sbuf;
+}
+
+void
+snmp_disable_syslog(void)
+{
+#if HAVE_SYSLOG_H
+    if (do_syslogging)
+        closelog();
+#endif
+#ifdef WIN32
+    if (eventlog_h != NULL) {
+        if (!CloseEventLog(eventlog_h)) {
+            fprintf(stderr, "Could not close event log. "
+                    "Last error: 0x%x\n", GetLastError());
+        } else {
+            eventlog_h = NULL;
+        }
+    }
+#endif                          /* WIN32 */
+    do_syslogging = 0;
+}
+
+
+void
+snmp_disable_filelog(void)
+{
+    if (do_filelogging) {
+        fputs("\n", logfile);
+        fclose(logfile);
+    }
+    do_filelogging = 0;
+}
+
+
+void
+snmp_disable_stderrlog(void)
+{
+    do_stderrlogging = 0;
+}
+
+
+void
+snmp_disable_log(void)
+{
+    snmp_disable_syslog();
+    snmp_disable_filelog();
+    snmp_disable_stderrlog();
+    snmp_disable_calllog();
+}
+
+void
+snmp_enable_syslog(void)
+{
+    /*
+     * This default should probably be net-snmp at some point 
+     */
+    snmp_enable_syslog_ident(DEFAULT_LOG_ID, LOG_DAEMON);
+}
+
+void
+snmp_enable_syslog_ident(const char *ident, const int facility)
+{
+    snmp_disable_syslog();
+    if (ident == NULL)
+        /*
+         * This default should probably be net-snmp at some point 
+         */
+        ident = DEFAULT_LOG_ID;
+#if HAVE_SYSLOG_H
+    openlog(ident, LOG_CONS | LOG_PID, facility);
+    do_syslogging = 1;
+#endif
+#ifdef WIN32
+    eventlog_h = OpenEventLog(NULL, ident);
+    if (eventlog_h == NULL) {
+        fprintf(stderr, "Could not open event log for %s. "
+                "Last error: 0x%x\n", ident, GetLastError());
+        do_syslogging = 0;
+    } else
+        do_syslogging = 1;
+#endif                          /* WIN32 */
+}
+
+void
+snmp_enable_filelog(const char *logfilename, int dont_zero_log)
+{
+    snmp_disable_filelog();
+    logfile = fopen(logfilename, dont_zero_log ? "a" : "w");
+    if (logfile) {
+        do_filelogging = 1;
+#ifdef WIN32
+        /*
+         * Apparently, "line buffering" under Windows is
+         *  actually implemented as "full buffering".
+         *  Let's try turning off buffering completely.
+         */
+        setvbuf(logfile, NULL, _IONBF, BUFSIZ);
+#else
+        setvbuf(logfile, NULL, _IOLBF, BUFSIZ);
+#endif
+    } else
+        do_filelogging = 0;
+}
+
+
+void
+snmp_enable_stderrlog(void)
+{
+    do_stderrlogging = 1;
+}
+
+
+void
+snmp_enable_calllog(void)
+{
+    do_log_callback = 1;
+}
+
+
+void
+snmp_disable_calllog(void)
+{
+    do_log_callback = 0;
+}
+
+
+void
+snmp_log_string(int priority, const char *string)
+{
+    char            sbuf[40];
+    struct snmp_log_message slm;
+#ifdef WIN32
+    WORD            etype;
+    LPCTSTR         event_msg[2];
+#endif                          /* WIN32 */
+
+#if HAVE_SYSLOG_H
+    if (do_syslogging) {
+        syslog(priority, "%s", string);
+    }
+#endif
+
+#ifdef WIN32
+    if (do_syslogging) {
+        /*
+         **  EVENT TYPES:
+         **
+         **  Information (EVENTLOG_INFORMATION_TYPE)
+         **      Information events indicate infrequent but significant
+         **      successful operations.
+         **  Warning (EVENTLOG_WARNING_TYPE)
+         **      Warning events indicate problems that are not immediately
+         **      significant, but that may indicate conditions that could
+         **      cause future problems. Resource consumption is a good
+         **      candidate for a warning event.
+         **  Error (EVENTLOG_ERROR_TYPE)
+         **      Error events indicate significant problems that the user
+         **      should know about. Error events usually indicate a loss of
+         **      functionality or data.
+         */
+        switch (priority) {
+        case LOG_EMERG:
+        case LOG_ALERT:
+        case LOG_CRIT:
+        case LOG_ERR:
+            etype = EVENTLOG_ERROR_TYPE;
+            break;
+        case LOG_WARNING:
+            etype = EVENTLOG_WARNING_TYPE;
+            break;
+        case LOG_NOTICE:
+        case LOG_INFO:
+        case LOG_DEBUG:
+            etype = EVENTLOG_INFORMATION_TYPE;
+            break;
+        default:
+            etype = EVENTLOG_INFORMATION_TYPE;
+            break;
+        }
+        event_msg[0] = string;
+        event_msg[1] = NULL;
+        if (!ReportEvent(eventlog_h, etype, 0, 0, NULL, 1, 0,
+                         event_msg, NULL))
+            fprintf(stderr, "Could not report event.  Last error: "
+                    "0x%x\n", GetLastError());
+    }
+#endif                          /* WIN32 */
+
+    if (do_log_callback) {
+        int             dodebug = snmp_get_do_debugging();
+        slm.priority = priority;
+        slm.msg = string;
+        if (dodebug)            /* turn off debugging inside the callbacks else will loop */
+            snmp_set_do_debugging(0);
+        snmp_call_callbacks(SNMP_CALLBACK_LIBRARY, SNMP_CALLBACK_LOGGING,
+                            &slm);
+        if (dodebug)
+            snmp_set_do_debugging(dodebug);
+    }
+
+    if (do_filelogging || do_stderrlogging) {
+        if (netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, 
+				   NETSNMP_DS_LIB_LOG_TIMESTAMP) && newline) {
+            sprintf_stamp(NULL, sbuf);
+        } else {
+            strcpy(sbuf, "");
+        }
+        newline = string[strlen(string) - 1] == '\n';
+
+        if (do_filelogging)
+            fprintf(logfile, "%s%s", sbuf, string);
+
+        if (do_stderrlogging)
+            fprintf(stderr, "%s%s", sbuf, string);
+    }
+}
+
+int
+snmp_vlog(int priority, const char *format, va_list ap)
+{
+    char            buffer[LOGLENGTH];
+    int             length;
+    char           *dynamic;
+
+    length = vsnprintf(buffer, LOGLENGTH, format, ap);
+
+    if (length == 0)
+        return (0);             /* Empty string */
+
+    if (length == -1) {
+        snmp_log_string(LOG_ERR, "Could not format log-string\n");
+        return (-1);
+    }
+
+    if (length < LOGLENGTH) {
+        snmp_log_string(priority, buffer);
+        return (0);
+    }
+
+    dynamic = (char *) malloc(length + 1);
+    if (dynamic == NULL) {
+        snmp_log_string(LOG_ERR,
+                        "Could not allocate memory for log-message\n");
+        snmp_log_string(priority, buffer);
+        return (-2);
+    }
+
+    vsnprintf(dynamic, length + 1, format, ap);
+    snmp_log_string(priority, dynamic);
+    free(dynamic);
+    return 0;
+}
+
+
+int
+#if HAVE_STDARG_H
+snmp_log(int priority, const char *format, ...)
+#else
+snmp_log(va_alist)
+     va_dcl
+#endif
+{
+    va_list         ap;
+    int             ret;
+#if HAVE_STDARG_H
+    va_start(ap, format);
+#else
+    int             priority;
+    const char     *format;
+    va_start(ap);
+
+    priority = va_arg(ap, int);
+    format = va_arg(ap, const char *);
+#endif
+    ret = snmp_vlog(priority, format, ap);
+    va_end(ap);
+    return (ret);
+}
+
+/*
+ * log a critical error.
+ */
+void
+snmp_log_perror(const char *s)
+{
+    char           *error = strerror(errno);
+    if (s) {
+        if (error)
+            snmp_log(LOG_ERR, "%s: %s\n", s, error);
+        else
+            snmp_log(LOG_ERR, "%s: Error %d out-of-range\n", s, errno);
+    } else {
+        if (error)
+            snmp_log(LOG_ERR, "%s\n", error);
+        else
+            snmp_log(LOG_ERR, "Error %d out-of-range\n", errno);
+    }
+}
diff -Naur tomato/release/src/router/snmp/snmplib/snmp_parse_args.c tomato121/release/src/router/snmp/snmplib/snmp_parse_args.c
--- tomato/release/src/router/snmp/snmplib/snmp_parse_args.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/snmplib/snmp_parse_args.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,626 @@
+/*
+ * snmp_parse_args.c
+ */
+
+#include <net-snmp/net-snmp-config.h>
+
+#if HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#if HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#if HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+#include <sys/types.h>
+#include <stdio.h>
+#if HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#include <ctype.h>
+#if HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+#if TIME_WITH_SYS_TIME
+# ifdef WIN32
+#  include <sys/timeb.h>
+# else
+#  include <sys/time.h>
+# endif
+# include <time.h>
+#else
+# if HAVE_SYS_TIME_H
+#  include <sys/time.h>
+# else
+#  include <time.h>
+# endif
+#endif
+#if HAVE_SYS_SELECT_H
+#include <sys/select.h>
+#endif
+#if HAVE_WINSOCK_H
+#include <winsock.h>
+#endif
+#if HAVE_NETDB_H
+#include <netdb.h>
+#endif
+#if HAVE_ARPA_INET_H
+#include <arpa/inet.h>
+#endif
+
+#include <net-snmp/types.h>
+#include <net-snmp/output_api.h>
+#include <net-snmp/config_api.h>
+#include <net-snmp/library/snmp_parse_args.h>   /* for "internal" definitions */
+#include <net-snmp/utilities.h>
+
+#include <net-snmp/library/snmp_api.h>
+#include <net-snmp/library/snmp_client.h>
+#include <net-snmp/library/mib.h>
+#include <net-snmp/library/scapi.h>
+#include <net-snmp/library/keytools.h>
+
+#include <net-snmp/version.h>
+#include <net-snmp/library/parse.h>
+#include <net-snmp/library/snmpv3.h>
+#include <net-snmp/library/transform_oids.h>
+
+int             random_access = 0;
+
+void
+snmp_parse_args_usage(FILE * outf)
+{
+    fprintf(outf, "[OPTIONS] AGENT");
+}
+
+void
+snmp_parse_args_descriptions(FILE * outf)
+{
+    fprintf(outf, "  Version:  %s\n", netsnmp_get_version());
+    fprintf(outf, "  Web:      http://www.net-snmp.org/\n");
+    fprintf(outf,
+            "  Email:    net-snmp-coders@lists.sourceforge.net\n\nOPTIONS:\n");
+    fprintf(outf, "  -h, --help\t\tdisplay this help message\n");
+    fprintf(outf,
+            "  -H\t\t\tdisplay configuration file directives understood\n");
+    fprintf(outf, "  -v 1|2c|3\t\tspecifies SNMP version to use\n");
+    fprintf(outf, "  -V, --version\t\tdisplay package version number\n");
+    fprintf(outf, "SNMP Version 1 or 2c specific\n");
+    fprintf(outf, "  -c COMMUNITY\t\tset the community string\n");
+    fprintf(outf, "SNMP Version 3 specific\n");
+    fprintf(outf,
+            "  -a PROTOCOL\t\tset authentication protocol (MD5|SHA)\n");
+    fprintf(outf,
+            "  -A PASSPHRASE\t\tset authentication protocol pass phrase\n");
+    fprintf(outf,
+            "  -e ENGINE-ID\t\tset security engine ID (e.g. 800000020109840301)\n");
+    fprintf(outf,
+            "  -E ENGINE-ID\t\tset context engine ID (e.g. 800000020109840301)\n");
+    fprintf(outf,
+            "  -l LEVEL\t\tset security level (noAuthNoPriv|authNoPriv|authPriv)\n");
+    fprintf(outf, "  -n CONTEXT\t\tset context name (e.g. bridge1)\n");
+    fprintf(outf, "  -u USER-NAME\t\tset security name (e.g. bert)\n");
+#ifdef HAVE_AES
+    fprintf(outf, "  -x PROTOCOL\t\tset privacy protocol (DES|AES)\n");
+#else
+    fprintf(outf, "  -x PROTOCOL\t\tset privacy protocol (DES)\n");
+#endif
+    fprintf(outf, "  -X PASSPHRASE\t\tset privacy protocol pass phrase\n");
+    fprintf(outf,
+            "  -Z BOOTS,TIME\t\tset destination engine boots/time\n");
+    fprintf(outf, "General communication options\n");
+    fprintf(outf, "  -r RETRIES\t\tset the number of retries\n");
+    fprintf(outf,
+            "  -t TIMEOUT\t\tset the request timeout (in seconds)\n");
+    fprintf(outf, "Debugging\n");
+    fprintf(outf, "  -d\t\t\tdump input/output packets in hexadecimal\n");
+    fprintf(outf,
+            "  -D TOKEN[,...]\tturn on debugging output for the specified TOKENs\n\t\t\t   (ALL gives extremely verbose debugging output)\n");
+    fprintf(outf, "General options\n");
+    fprintf(outf,
+            "  -m MIB[:...]\t\tload given list of MIBs (ALL loads everything)\n");
+    fprintf(outf,
+            "  -M DIR[:...]\t\tlook in given list of directories for MIBs\n");
+    fprintf(outf,
+            "  -P MIBOPTS\t\tToggle various defaults controlling MIB parsing:\n");
+    snmp_mib_toggle_options_usage("\t\t\t  ", outf);
+    fprintf(outf,
+            "  -O OUTOPTS\t\tToggle various defaults controlling output display:\n");
+    snmp_out_toggle_options_usage("\t\t\t  ", outf);
+    fprintf(outf,
+            "  -I INOPTS\t\tToggle various defaults controlling input parsing:\n");
+    snmp_in_toggle_options_usage("\t\t\t  ", outf);
+    fflush(outf);
+}
+
+#define BUF_SIZE 512
+
+void
+handle_long_opt(const char *myoptarg)
+{
+    char           *cp, *cp2;
+    /*
+     * else it's a long option, so process it like name=value 
+     */
+    cp = malloc(strlen(myoptarg) + 3);
+    strcpy(cp, myoptarg);
+    cp2 = strchr(cp, '=');
+    if (!cp2 && !strchr(cp, ' ')) {
+        /*
+         * well, they didn't specify an argument as far as we
+         * can tell.  Give them a '1' as the argument (which
+         * works for boolean tokens and a few others) and let
+         * them suffer from there if it's not what they
+         * wanted 
+         */
+        strcat(cp, " 1");
+    } else {
+        /*
+         * replace the '=' with a ' ' 
+         */
+        if (cp2)
+            *cp2 = ' ';
+    }
+    netsnmp_config(cp);
+    free(cp);
+}
+
+extern int      snmpv3_options(char *optarg, netsnmp_session * session,
+                               char **Apsz, char **Xpsz, int argc,
+                               char *const *argv);
+int
+snmp_parse_args(int argc,
+                char *const *argv,
+                netsnmp_session * session, const char *localOpts,
+                void (*proc) (int, char *const *, int))
+{
+    int             arg;
+    char           *cp;
+    char           *Apsz = NULL;
+    char           *Xpsz = NULL;
+    char           *Cpsz = NULL;
+    char            Opts[BUF_SIZE];
+
+    /*
+     * initialize session to default values 
+     */
+    snmp_sess_init(session);
+    strcpy(Opts, "Y:VhHm:M:O:I:P:D:dv:r:t:c:Z:e:E:n:u:l:x:X:a:A:p:T:-:3:");
+    if (localOpts)
+        strcat(Opts, localOpts);
+
+    /*
+     * get the options 
+     */
+    DEBUGMSGTL(("snmp_parse_args", "starting: %d/%d\n", optind, argc));
+    for (arg = 0; arg < argc; arg++) {
+        DEBUGMSGTL(("snmp_parse_args", " arg %d = %s\n", arg, argv[arg]));
+    }
+
+    optind = 1;
+    while ((arg = getopt(argc, argv, Opts)) != EOF) {
+        DEBUGMSGTL(("snmp_parse_args", "handling (#%d): %c\n", optind,
+                    arg));
+        switch (arg) {
+        case '-':
+            if (strcasecmp(optarg, "help") == 0) {
+                return (-1);
+            }
+            if (strcasecmp(optarg, "version") == 0) {
+                fprintf(stderr, "NET-SNMP version: %s\n",
+                        netsnmp_get_version());
+                return (-2);
+            }
+
+            handle_long_opt(optarg);
+            break;
+
+        case 'V':
+            fprintf(stderr, "NET-SNMP version: %s\n",
+                    netsnmp_get_version());
+            return (-2);
+
+        case 'h':
+            return (-1);
+            break;
+
+        case 'H':
+            init_snmp("snmpapp");
+            fprintf(stderr, "Configuration directives understood:\n");
+            read_config_print_usage("  ");
+            return (-2);
+
+        case 'Y':
+            netsnmp_config_remember(optarg);
+            break;
+
+        case 'm':
+            setenv("MIBS", optarg, 1);
+            break;
+
+        case 'M':
+            netsnmp_set_mib_directory(optarg);
+            break;
+
+        case 'O':
+            cp = snmp_out_toggle_options(optarg);
+            if (cp != NULL) {
+                fprintf(stderr,
+                        "Unknown output option passed to -O: %c.\n", *cp);
+                return (-1);
+            }
+            break;
+
+        case 'I':
+            cp = snmp_in_toggle_options(optarg);
+            if (cp != NULL) {
+                fprintf(stderr, "Unknown input option passed to -I: %c.\n",
+                        *cp);
+                return (-1);
+            }
+            break;
+
+        case 'P':
+            cp = snmp_mib_toggle_options(optarg);
+            if (cp != NULL) {
+                fprintf(stderr,
+                        "Unknown parsing option passed to -P: %c.\n", *cp);
+                return (-1);
+            }
+            break;
+
+        case 'D':
+            debug_register_tokens(optarg);
+            snmp_set_do_debugging(1);
+            break;
+
+        case 'd':
+            netsnmp_ds_set_boolean(NETSNMP_DS_LIBRARY_ID, 
+				   NETSNMP_DS_LIB_DUMP_PACKET, 1);
+            break;
+
+        case 'v':
+            if (!strcmp(optarg, "1")) {
+                session->version = SNMP_VERSION_1;
+            } else if (!strcasecmp(optarg, "2c")) {
+                session->version = SNMP_VERSION_2c;
+            } else if (!strcasecmp(optarg, "3")) {
+                session->version = SNMP_VERSION_3;
+            } else {
+                fprintf(stderr,
+                        "Invalid version specified after -v flag: %s\n",
+                        optarg);
+                return (-1);
+            }
+            break;
+
+        case 'p':
+            fprintf(stderr, "Warning: -p option is no longer used - ");
+            fprintf(stderr, "specify the remote host as HOST:PORT\n");
+            return (-1);
+            break;
+
+        case 'T':
+            fprintf(stderr, "Warning: -T option is no longer used - ");
+            fprintf(stderr, "specify the remote host as TRANSPORT:HOST\n");
+            return (-1);
+            break;
+
+        case 't':
+            session->timeout = atoi(optarg) * 1000000L;
+            if (session->timeout < 0 || !isdigit(optarg[0])) {
+                fprintf(stderr,
+                        "Invalid timeout in seconds after -t flag.\n");
+                return (-1);
+            }
+            break;
+
+        case 'r':
+            session->retries = atoi(optarg);
+            if (session->retries < 0 || !isdigit(optarg[0])) {
+                fprintf(stderr,
+                        "Invalid number of retries after -r flag.\n");
+                return (-1);
+            }
+            break;
+
+        case 'c':
+            Cpsz = optarg;
+            break;
+
+        case '3':
+            if (snmpv3_options(optarg, session, &Apsz, &Xpsz, argc, argv) <
+                0) {
+                return (-1);
+            }
+            break;
+
+#define SNMPV3_CMD_OPTIONS
+#ifdef  SNMPV3_CMD_OPTIONS
+        case 'Z':
+            session->engineBoots = strtoul(optarg, NULL, 10);
+            if (session->engineBoots == 0 || !isdigit(optarg[0])) {
+                fprintf(stderr,
+                        "Need engine boots value after -Z flag.\n");
+                return (-1);
+            }
+            cp = strchr(optarg, ',');
+            if (cp && *(++cp) && isdigit(*cp))
+                session->engineTime = strtoul(cp, NULL, 10);
+            /*
+             * Handle previous '-Z boot time' syntax 
+             */
+            else if ((optind < argc) && isdigit(argv[optind][0]))
+                session->engineTime = strtoul(argv[optind], NULL, 10);
+            else {
+                fprintf(stderr, "Need engine time value after -Z flag.\n");
+                return (-1);
+            }
+            break;
+
+        case 'e':{
+                size_t          ebuf_len = 32, eout_len = 0;
+                u_char         *ebuf = (u_char *) malloc(ebuf_len);
+
+                if (ebuf == NULL) {
+                    fprintf(stderr,
+                            "malloc failure processing -e flag.\n");
+                    return (-1);
+                }
+                if (!snmp_hex_to_binary
+                    (&ebuf, &ebuf_len, &eout_len, 1, optarg)) {
+                    fprintf(stderr,
+                            "Bad engine ID value after -e flag.\n");
+                    free(ebuf);
+                    return (-1);
+                }
+                session->securityEngineID = ebuf;
+                session->securityEngineIDLen = eout_len;
+                break;
+            }
+
+        case 'E':{
+                size_t          ebuf_len = 32, eout_len = 0;
+                u_char         *ebuf = (u_char *) malloc(ebuf_len);
+
+                if (ebuf == NULL) {
+                    fprintf(stderr,
+                            "malloc failure processing -E flag.\n");
+                    return (-1);
+                }
+                if (!snmp_hex_to_binary
+                    (&ebuf, &ebuf_len, &eout_len, 1, optarg)) {
+                    fprintf(stderr,
+                            "Bad engine ID value after -E flag.\n");
+                    free(ebuf);
+                    return (-1);
+                }
+                session->contextEngineID = ebuf;
+                session->contextEngineIDLen = eout_len;
+                break;
+            }
+
+        case 'n':
+            session->contextName = optarg;
+            session->contextNameLen = strlen(optarg);
+            break;
+
+        case 'u':
+            session->securityName = optarg;
+            session->securityNameLen = strlen(optarg);
+            break;
+
+        case 'l':
+            if (!strcasecmp(optarg, "noAuthNoPriv") || !strcmp(optarg, "1")
+                || !strcasecmp(optarg, "nanp")) {
+                session->securityLevel = SNMP_SEC_LEVEL_NOAUTH;
+            } else if (!strcasecmp(optarg, "authNoPriv")
+                       || !strcmp(optarg, "2")
+                       || !strcasecmp(optarg, "anp")) {
+                session->securityLevel = SNMP_SEC_LEVEL_AUTHNOPRIV;
+            } else if (!strcasecmp(optarg, "authPriv")
+                       || !strcmp(optarg, "3")
+                       || !strcasecmp(optarg, "ap")) {
+                session->securityLevel = SNMP_SEC_LEVEL_AUTHPRIV;
+            } else {
+                fprintf(stderr,
+                        "Invalid security level specified after -l flag: %s\n",
+                        optarg);
+                return (-1);
+            }
+
+            break;
+
+        case 'a':
+            if (!strcasecmp(optarg, "MD5")) {
+                session->securityAuthProto = usmHMACMD5AuthProtocol;
+                session->securityAuthProtoLen = USM_AUTH_PROTO_MD5_LEN;
+            } else if (!strcasecmp(optarg, "SHA")) {
+                session->securityAuthProto = usmHMACSHA1AuthProtocol;
+                session->securityAuthProtoLen = USM_AUTH_PROTO_SHA_LEN;
+            } else {
+                fprintf(stderr,
+                        "Invalid authentication protocol specified after -a flag: %s\n",
+                        optarg);
+                return (-1);
+            }
+            break;
+
+        case 'x':
+            if (!strcasecmp(optarg, "DES")) {
+                session->securityPrivProto = usmDESPrivProtocol;
+                session->securityPrivProtoLen = USM_PRIV_PROTO_DES_LEN;
+#ifdef HAVE_AES
+            } else if (!strcasecmp(optarg, "AES128")) {
+                session->securityPrivProto = usmAES128PrivProtocol;
+                session->securityPrivProtoLen = USM_PRIV_PROTO_AES128_LEN;
+            } else if (!strcasecmp(optarg, "AES192")) {
+                session->securityPrivProto = usmAES192PrivProtocol;
+                session->securityPrivProtoLen = USM_PRIV_PROTO_AES192_LEN;
+            } else if (!strcasecmp(optarg, "AES256")) {
+                session->securityPrivProto = usmAES256PrivProtocol;
+                session->securityPrivProtoLen = USM_PRIV_PROTO_AES256_LEN;
+#endif
+            } else {
+                fprintf(stderr,
+                        "Invalid privacy protocol specified after -x flag: %s\n",
+                        optarg);
+                return (-1);
+            }
+            break;
+
+        case 'A':
+            Apsz = optarg;
+            break;
+
+        case 'X':
+            Xpsz = optarg;
+            break;
+#endif                          /* SNMPV3_CMD_OPTIONS */
+
+        case '?':
+            return (-1);
+            break;
+
+        default:
+            proc(argc, argv, arg);
+            break;
+        }
+    }
+    DEBUGMSGTL(("snmp_parse_args", "finished: %d/%d\n", optind, argc));
+
+    /*
+     * read in MIB database and initialize the snmp library
+     */
+    init_snmp("snmpapp");
+
+    /*
+     * session default version 
+     */
+    if (session->version == SNMP_DEFAULT_VERSION) {
+        /*
+         * run time default version 
+         */
+        session->version = netsnmp_ds_get_int(NETSNMP_DS_LIBRARY_ID, 
+					      NETSNMP_DS_LIB_SNMPVERSION);
+
+        /*
+         * compile time default version 
+         */
+        if (!session->version) {
+            switch (DEFAULT_SNMP_VERSION) {
+            case 1:
+                session->version = SNMP_VERSION_1;
+                break;
+
+            case 2:
+                session->version = SNMP_VERSION_2c;
+                break;
+
+            case 3:
+                session->version = SNMP_VERSION_3;
+                break;
+            }
+        } else {
+            if (session->version == NETSNMP_DS_SNMP_VERSION_1)  /* bogus value.  version 1 actually = 0 */
+                session->version = SNMP_VERSION_1;
+        }
+    }
+
+    /*
+     * make master key from pass phrases 
+     */
+    if (Apsz) {
+        session->securityAuthKeyLen = USM_AUTH_KU_LEN;
+        if (session->securityAuthProto == NULL) {
+            /*
+             * get .conf set default 
+             */
+            const oid      *def =
+                get_default_authtype(&session->securityAuthProtoLen);
+            session->securityAuthProto =
+                snmp_duplicate_objid(def, session->securityAuthProtoLen);
+        }
+        if (session->securityAuthProto == NULL) {
+            /*
+             * assume MD5 
+             */
+            session->securityAuthProto =
+                snmp_duplicate_objid(usmHMACMD5AuthProtocol,
+                                     USM_AUTH_PROTO_MD5_LEN);
+            session->securityAuthProtoLen = USM_AUTH_PROTO_MD5_LEN;
+        }
+        if (generate_Ku(session->securityAuthProto,
+                        session->securityAuthProtoLen,
+                        (u_char *) Apsz, strlen(Apsz),
+                        session->securityAuthKey,
+                        &session->securityAuthKeyLen) != SNMPERR_SUCCESS) {
+            snmp_perror(argv[0]);
+            fprintf(stderr,
+                    "Error generating a key (Ku) from the supplied authentication pass phrase. \n");
+            return (-2);
+        }
+    }
+    if (Xpsz) {
+        session->securityPrivKeyLen = USM_PRIV_KU_LEN;
+        if (session->securityPrivProto == NULL) {
+            /*
+             * get .conf set default 
+             */
+            const oid      *def =
+                get_default_privtype(&session->securityPrivProtoLen);
+            session->securityPrivProto =
+                snmp_duplicate_objid(def, session->securityPrivProtoLen);
+        }
+        if (session->securityPrivProto == NULL) {
+            /*
+             * assume DES 
+             */
+            session->securityPrivProto =
+                snmp_duplicate_objid(usmDESPrivProtocol,
+                                     USM_PRIV_PROTO_DES_LEN);
+            session->securityPrivProtoLen = USM_PRIV_PROTO_DES_LEN;
+        }
+        if (generate_Ku(session->securityAuthProto,
+                        session->securityAuthProtoLen,
+                        (u_char *) Xpsz, strlen(Xpsz),
+                        session->securityPrivKey,
+                        &session->securityPrivKeyLen) != SNMPERR_SUCCESS) {
+            snmp_perror(argv[0]);
+            fprintf(stderr,
+                    "Error generating a key (Ku) from the supplied privacy pass phrase. \n");
+            return (-2);
+        }
+    }
+    /*
+     * get the hostname 
+     */
+    if (optind == argc) {
+        fprintf(stderr, "No hostname specified.\n");
+        return (-1);
+    }
+    session->peername = argv[optind++]; /* hostname */
+
+    /*
+     * If v1 or v2c, check community has been set, either by a -c option above,
+     * or via a default token somewhere.  
+     */
+
+    if (session->version == SNMP_VERSION_1 ||
+        session->version == SNMP_VERSION_2c) {
+        if (Cpsz == NULL) {
+            Cpsz = netsnmp_ds_get_string(NETSNMP_DS_LIBRARY_ID, 
+					 NETSNMP_DS_LIB_COMMUNITY);
+        }
+        if (Cpsz == NULL) {
+            fprintf(stderr, "No community name specified.\n");
+            return (-1);
+        }
+        session->community = (unsigned char *) Cpsz;
+        session->community_len = strlen(Cpsz);
+    }
+    return optind;
+}
diff -Naur tomato/release/src/router/snmp/snmplib/snmp_secmod.c tomato121/release/src/router/snmp/snmplib/snmp_secmod.c
--- tomato/release/src/router/snmp/snmplib/snmp_secmod.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/snmplib/snmp_secmod.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,164 @@
+/*
+ * security service wrapper to support pluggable security models 
+ */
+
+#include <net-snmp/net-snmp-config.h>
+#include <stdio.h>
+#include <ctype.h>
+#if HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#if HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+#if HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+
+#if HAVE_DMALLOC_H
+#include <dmalloc.h>
+#endif
+
+#include <net-snmp/types.h>
+#include <net-snmp/output_api.h>
+#include <net-snmp/config_api.h>
+#include <net-snmp/utilities.h>
+
+#include <net-snmp/library/snmp_api.h>
+#include <net-snmp/library/snmp_enum.h>
+#include <net-snmp/library/callback.h>
+#include <net-snmp/library/snmp_secmod.h>
+#include <net-snmp/library/snmpusm.h>
+
+static struct snmp_secmod_list *registered_services = NULL;
+
+static SNMPCallback set_default_secmod;
+
+void
+init_secmod(void)
+{
+    snmp_register_callback(SNMP_CALLBACK_LIBRARY,
+                           SNMP_CALLBACK_SESSION_INIT, set_default_secmod,
+                           NULL);
+
+    netsnmp_ds_register_config(ASN_OCTET_STR, "snmp", "defSecurityModel",
+			       NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_SECMODEL);
+    /*
+     * this file is generated by configure for all the stuff we're using 
+     */
+#include "snmpsm_init.h"
+}
+
+
+int
+register_sec_mod(int secmod, const char *modname,
+                 struct snmp_secmod_def *newdef)
+{
+    int             result;
+    struct snmp_secmod_list *sptr;
+    char           *othername;
+
+    for (sptr = registered_services; sptr; sptr = sptr->next) {
+        if (sptr->securityModel == secmod) {
+            return SNMPERR_GENERR;
+        }
+    }
+    sptr = SNMP_MALLOC_STRUCT(snmp_secmod_list);
+    if (sptr == NULL)
+        return SNMPERR_MALLOC;
+    sptr->secDef = newdef;
+    sptr->securityModel = secmod;
+    sptr->next = registered_services;
+    registered_services = sptr;
+    if ((result =
+         se_add_pair_to_slist("snmp_secmods", strdup(modname), secmod))
+        != SE_OK) {
+        switch (result) {
+        case SE_NOMEM:
+            snmp_log(LOG_CRIT, "snmp_secmod: no memory\n");
+            break;
+
+        case SE_ALREADY_THERE:
+            othername = se_find_label_in_slist("snmp_secmods", secmod);
+            if (strcmp(othername, modname) != 0) {
+                snmp_log(LOG_ERR,
+                         "snmp_secmod: two security modules %s and %s registered with the same security number\n",
+                         secmod, othername);
+            }
+            break;
+
+        default:
+            snmp_log(LOG_ERR,
+                     "snmp_secmod: unknown error trying to register a new security module\n");
+            break;
+        }
+        return SNMPERR_GENERR;
+    }
+    return SNMPERR_SUCCESS;
+}
+
+int
+unregister_sec_mod(int secmod)
+{
+    struct snmp_secmod_list *sptr, *lptr;
+
+    for (sptr = registered_services, lptr = NULL; sptr;
+         lptr = sptr, sptr = sptr->next) {
+        if (sptr->securityModel == secmod) {
+            lptr->next = sptr->next;
+            free(sptr);
+            return SNMPERR_SUCCESS;
+        }
+    }
+    /*
+     * not registered 
+     */
+    return SNMPERR_GENERR;
+}
+
+struct snmp_secmod_def *
+find_sec_mod(int secmod)
+{
+    struct snmp_secmod_list *sptr;
+
+    for (sptr = registered_services; sptr; sptr = sptr->next) {
+        if (sptr->securityModel == secmod) {
+            return sptr->secDef;
+        }
+    }
+    /*
+     * not registered 
+     */
+    return NULL;
+}
+
+static int
+set_default_secmod(int major, int minor, void *serverarg, void *clientarg)
+{
+    netsnmp_session *sess = (netsnmp_session *) serverarg;
+    char           *cptr;
+    int             model;
+
+    if (!sess)
+        return SNMPERR_GENERR;
+    if (sess->securityModel == SNMP_DEFAULT_SECMODEL) {
+        if ((cptr = netsnmp_ds_get_string(NETSNMP_DS_LIBRARY_ID, 
+					  NETSNMP_DS_LIB_SECMODEL)) != NULL) {
+            if ((model = se_find_value_in_slist("snmp_secmods", cptr))
+		!= SE_DNE) {
+                sess->securityModel = model;
+            } else {
+                snmp_log(LOG_ERR,
+                         "unknown security model name: %s.  Forcing USM instead.\n",
+                         cptr);
+                sess->securityModel = USM_SEC_MODEL_NUMBER;
+                return SNMPERR_GENERR;
+            }
+        } else {
+            sess->securityModel = USM_SEC_MODEL_NUMBER;
+        }
+    }
+    return SNMPERR_SUCCESS;
+}
diff -Naur tomato/release/src/router/snmp/snmplib/snmp-tc.c tomato121/release/src/router/snmp/snmplib/snmp-tc.c
--- tomato/release/src/router/snmp/snmplib/snmp-tc.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/snmplib/snmp-tc.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,376 @@
+/*
+ *  Host Resources MIB - utility functions - hr_utils.c
+ *
+ */
+
+
+#include <net-snmp/net-snmp-config.h>
+#include <sys/types.h>
+#if HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+#if HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#include <ctype.h>
+#if HAVE_STRING_H
+#include <string.h>
+#endif
+#if HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+
+#if TIME_WITH_SYS_TIME
+#ifdef WIN32
+# include <sys/timeb.h>
+#else
+# include <sys/time.h>
+#endif
+# include <time.h>
+#else
+# if HAVE_SYS_TIME_H
+#  include <sys/time.h>
+# else
+#  include <time.h>
+# endif
+#endif
+
+#include <net-snmp/types.h>
+#include <net-snmp/library/snmp-tc.h>   /* for "internal" definitions */
+#include <net-snmp/library/snmp_api.h>
+
+u_char         *
+date_n_time(time_t * when, size_t * length)
+{
+    struct tm      *tm_p;
+    static u_char   string[11];
+
+    /*
+     * Null time
+     */
+    if (when == NULL || *when == 0 || *when == (time_t) - 1) {
+        string[0] = 0;
+        string[1] = 0;
+        string[2] = 1;
+        string[3] = 1;
+        string[4] = 0;
+        string[5] = 0;
+        string[6] = 0;
+        string[7] = 0;
+        *length = 8;
+        return string;
+    }
+
+
+    /*
+     * Basic 'local' time handling
+     */
+    tm_p = localtime(when);
+    *(short *) string = htons(tm_p->tm_year + 1900);
+    string[2] = tm_p->tm_mon + 1;
+    string[3] = tm_p->tm_mday;
+    string[4] = tm_p->tm_hour;
+    string[5] = tm_p->tm_min;
+    string[6] = tm_p->tm_sec;
+    string[7] = 0;
+    *length = 8;
+
+#ifndef cygwin
+    /*
+     * Timezone offset
+     */
+#if !defined(SYSV) && !defined(aix4) && !defined(aix5) && !defined(WIN32) && !defined(irix6)
+#if !defined(__UCLIBC__)
+#  define timezone tm_p->tm_gmtoff
+#else
+// #  define timezone tm_gmtoff
+#endif
+#endif
+    if (timezone > 0)
+        string[8] = '-';
+    else
+        string[8] = '+';
+    string[9] = abs(timezone) / 3600;
+    string[10] = (abs(timezone) - string[9] * 3600) / 60;
+    *length = 11;
+#endif
+
+#ifdef SYSV
+    /*
+     * Daylight saving time
+     */
+    if (tm_p->tm_isdst > 0) {
+        /*
+         * Assume add one hour 
+         */
+        if (string[8] == '-')
+            --string[9];
+        else
+            ++string[9];
+
+        if (string[9] == 0)
+            string[8] = '+';
+    }
+#endif
+
+    return string;
+}
+
+
+time_t
+ctime_to_timet(char *string)
+{
+    struct tm       tm;
+
+    if (strlen(string) < 24)
+        return 0;
+
+    /*
+     * Month 
+     */
+    if (!strncmp(string + 4, "Jan", 3))
+        tm.tm_mon = 0;
+    else if (!strncmp(string + 4, "Feb", 3))
+        tm.tm_mon = 1;
+    else if (!strncmp(string + 4, "Mar", 3))
+        tm.tm_mon = 2;
+    else if (!strncmp(string + 4, "Apr", 3))
+        tm.tm_mon = 3;
+    else if (!strncmp(string + 4, "May", 3))
+        tm.tm_mon = 4;
+    else if (!strncmp(string + 4, "Jun", 3))
+        tm.tm_mon = 5;
+    else if (!strncmp(string + 4, "Jul", 3))
+        tm.tm_mon = 6;
+    else if (!strncmp(string + 4, "Aug", 3))
+        tm.tm_mon = 7;
+    else if (!strncmp(string + 4, "Sep", 3))
+        tm.tm_mon = 8;
+    else if (!strncmp(string + 4, "Oct", 3))
+        tm.tm_mon = 9;
+    else if (!strncmp(string + 4, "Nov", 3))
+        tm.tm_mon = 10;
+    else if (!strncmp(string + 4, "Dec", 3))
+        tm.tm_mon = 11;
+    else
+        return 0;
+
+    tm.tm_mday = atoi(string + 8);
+    tm.tm_hour = atoi(string + 11);
+    tm.tm_min = atoi(string + 14);
+    tm.tm_sec = atoi(string + 17);
+    tm.tm_year = atoi(string + 20) - 1900;
+
+    /*
+     *  Cope with timezone and DST
+     */
+
+#ifdef SYSV
+    if (daylight)
+        tm.tm_isdst = 1;
+
+    tm.tm_sec -= timezone;
+#endif
+
+    return (mktime(&tm));
+}
+
+/*
+ * blatantly lifted from opensmp 
+ */
+char
+check_rowstatus_transition(int oldValue, int newValue)
+{
+    /*
+     * From the SNMPv2-TC MIB:
+     *                                          STATE
+     *               +--------------+-----------+-------------+-------------
+     *               |      A       |     B     |      C      |      D
+     *               |              |status col.|status column|
+     *               |status column |    is     |      is     |status column
+     *     ACTION    |does not exist|  notReady | notInService|  is active
+     * --------------+--------------+-----------+-------------+-------------
+     * set status    |noError    ->D|inconsist- |inconsistent-|inconsistent-
+     * column to     |       or     |   entValue|        Value|        Value
+     * createAndGo   |inconsistent- |           |             |
+     *               |         Value|           |             |
+     * --------------+--------------+-----------+-------------+-------------
+     * set status    |noError  see 1|inconsist- |inconsistent-|inconsistent-
+     * column to     |       or     |   entValue|        Value|        Value
+     * createAndWait |wrongValue    |           |             |
+     * --------------+--------------+-----------+-------------+-------------
+     * set status    |inconsistent- |inconsist- |noError      |noError
+     * column to     |         Value|   entValue|             |
+     * active        |              |           |             |
+     *               |              |     or    |             |
+     *               |              |           |             |
+     *               |              |see 2   ->D|see 8     ->D|          ->D
+     * --------------+--------------+-----------+-------------+-------------
+     * set status    |inconsistent- |inconsist- |noError      |noError   ->C
+     * column to     |         Value|   entValue|             |
+     * notInService  |              |           |             |
+     *               |              |     or    |             |      or
+     *               |              |           |             |
+     *               |              |see 3   ->C|          ->C|see 6
+     * --------------+--------------+-----------+-------------+-------------
+     * set status    |noError       |noError    |noError      |noError   ->A
+     * column to     |              |           |             |      or
+     * destroy       |           ->A|        ->A|          ->A|see 7
+     * --------------+--------------+-----------+-------------+-------------
+     * set any other |see 4         |noError    |noError      |see 5
+     * column to some|              |           |             |
+     * value         |              |      see 1|          ->C|          ->D
+     * --------------+--------------+-----------+-------------+-------------
+     
+     *             (1) goto B or C, depending on information available to the
+     *             agent.
+     
+     *             (2) if other variable bindings included in the same PDU,
+     *             provide values for all columns which are missing but
+     *             required, and all columns have acceptable values, then
+     *             return noError and goto D.
+     
+     *             (3) if other variable bindings included in the same PDU,
+     *             provide legal values for all columns which are missing but
+     *             required, then return noError and goto C.
+     
+     *             (4) at the discretion of the agent, the return value may be
+     *             either:
+     
+     *                  inconsistentName:  because the agent does not choose to
+     *                  create such an instance when the corresponding
+     *                  RowStatus instance does not exist, or
+     
+     *                  inconsistentValue:  if the supplied value is
+     *                  inconsistent with the state of some other MIB object's
+     *                  value, or
+     
+     *                  noError: because the agent chooses to create the
+     *                  instance.
+     
+     *             If noError is returned, then the instance of the status
+     *             column must also be created, and the new state is B or C,
+     *             depending on the information available to the agent.  If
+     *             inconsistentName or inconsistentValue is returned, the row
+     *             remains in state A.
+     
+     *             (5) depending on the MIB definition for the column/table,
+     *             either noError or inconsistentValue may be returned.
+     
+     *             (6) the return value can indicate one of the following
+     *             errors:
+     
+     *                  wrongValue: because the agent does not support
+     *                  notInService (e.g., an agent which does not support
+     *                  createAndWait), or
+     
+     *                  inconsistentValue: because the agent is unable to take
+     *                  the row out of service at this time, perhaps because it
+     *                  is in use and cannot be de-activated.
+     
+     *             (7) the return value can indicate the following error:
+     
+     *                  inconsistentValue: because the agent is unable to
+     *                  remove the row at this time, perhaps because it is in
+     *                  use and cannot be de-activated.
+     
+     *             (8) the transition to D can fail, e.g., if the values of the
+     *             conceptual row are inconsistent, then the error code would
+     *             be inconsistentValue.
+     
+     *             NOTE: Other processing of (this and other varbinds of) the
+     *             set request may result in a response other than noError
+     *             being returned, e.g., wrongValue, noCreation, etc.
+     */
+
+    switch (newValue) {
+        /*
+         * these two end up being equivelent as far as checking the 
+         */
+        /*
+         * status goes, although the final states are based on the 
+         */
+        /*
+         * newValue. 
+         */
+    case RS_ACTIVE:
+    case RS_NOTINSERVICE:
+        if (oldValue == RS_NOTINSERVICE || oldValue == RS_ACTIVE);
+        else
+            return SNMP_ERR_INCONSISTENTVALUE;
+        break;
+
+    case RS_NOTREADY:
+        /*
+         * Illegal set value. 
+         */
+        return SNMP_ERR_INCONSISTENTVALUE;
+        break;
+
+    case RS_CREATEANDGO:
+        if (oldValue != RS_NONEXISTENT)
+            /*
+             * impossible, we already exist. 
+             */
+            return SNMP_ERR_INCONSISTENTVALUE;
+        break;
+
+    case RS_CREATEANDWAIT:
+        if (oldValue != RS_NONEXISTENT)
+            /*
+             * impossible, we already exist. 
+             */
+            return SNMP_ERR_INCONSISTENTVALUE;
+        break;
+
+    case RS_DESTROY:
+        break;
+
+    default:
+        return SNMP_ERR_INCONSISTENTVALUE;
+        break;
+    }
+
+    return SNMP_ERR_NOERROR;
+}
+
+char
+check_storage_transition(int oldValue, int newValue)
+{
+    /*
+     * From the SNMPv2-TC MIB:
+     
+     *             "Describes the memory realization of a conceptual row.  A
+     *             row which is volatile(2) is lost upon reboot.  A row which
+     *             is either nonVolatile(3), permanent(4) or readOnly(5), is
+     *             backed up by stable storage.  A row which is permanent(4)
+     *             can be changed but not deleted.  A row which is readOnly(5)
+     *             cannot be changed nor deleted.
+     
+     *             If the value of an object with this syntax is either
+     *             permanent(4) or readOnly(5), it cannot be written.
+     *             Conversely, if the value is either other(1), volatile(2) or
+     *             nonVolatile(3), it cannot be modified to be permanent(4) or
+     *             readOnly(5).  (All illegal modifications result in a
+     *             'wrongValue' error.)
+     
+     *             Every usage of this textual convention is required to
+     *             specify the columnar objects which a permanent(4) row must
+     *             at a minimum allow to be writable."
+     */
+    switch (oldValue) {
+    case SNMP_STORAGE_PERMANENT:
+    case SNMP_STORAGE_READONLY:
+        return SNMP_ERR_INCONSISTENTVALUE;
+
+    case SNMP_STORAGE_NONE:
+    case SNMP_STORAGE_OTHER:
+    case SNMP_STORAGE_VOLATILE:
+    case SNMP_STORAGE_NONVOLATILE:
+        if (newValue == SNMP_STORAGE_PERMANENT ||
+            newValue == SNMP_STORAGE_READONLY)
+            return SNMP_ERR_INCONSISTENTVALUE;
+    }
+
+    return SNMP_ERR_NOERROR;
+}
diff -Naur tomato/release/src/router/snmp/snmplib/snmpTCPDomain.c tomato121/release/src/router/snmp/snmplib/snmpTCPDomain.c
--- tomato/release/src/router/snmp/snmplib/snmpTCPDomain.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/snmplib/snmpTCPDomain.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,416 @@
+#include <net-snmp/net-snmp-config.h>
+
+#include <stdio.h>
+#include <sys/types.h>
+#include <errno.h>
+
+#if HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+#if HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#if HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#if HAVE_SYS_SOCKET_H
+#include <sys/socket.h>
+#endif
+#if HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+#if HAVE_ARPA_INET_H
+#include <arpa/inet.h>
+#endif
+#if HAVE_FCNTL_H
+#include <fcntl.h>
+#endif
+
+#if HAVE_DMALLOC_H
+#include <dmalloc.h>
+#endif
+
+#include <net-snmp/types.h>
+#include <net-snmp/output_api.h>
+
+#include <net-snmp/library/snmp_transport.h>
+#include <net-snmp/library/snmpUDPDomain.h>
+#include <net-snmp/library/snmpTCPDomain.h>
+
+
+oid netsnmp_snmpTCPDomain[8] = { 1, 3, 6, 1, 3, 91, 1, 1 };
+static netsnmp_tdomain tcpDomain;
+
+
+/*
+ * Return a string representing the address in data, or else the "far end"
+ * address if data is NULL.  
+ */
+
+static char *
+netsnmp_tcp_fmtaddr(netsnmp_transport *t, void *data, int len)
+{
+    struct sockaddr_in *to = NULL;
+
+    if (data != NULL && len == sizeof(struct sockaddr_in)) {
+        to = (struct sockaddr_in *) data;
+    } else if (t != NULL && t->data != NULL &&
+               t->data_length == sizeof(struct sockaddr_in)) {
+        to = (struct sockaddr_in *) t->data;
+    }
+    if (to == NULL) {
+        return strdup("TCP: unknown");
+    } else {
+        char tmp[64];
+
+        /*
+         * Here we just print the IP address of the peer for compatibility
+         * purposes.  It would be nice if we could include the port number and
+         * some indication of the domain (c.f. AAL5PVC).  
+         */
+
+        sprintf(tmp, "%s", inet_ntoa(to->sin_addr));
+        return strdup(tmp);
+    }
+}
+
+
+
+/*
+ * You can write something into opaque that will subsequently get passed back 
+ * to your send function if you like.  For instance, you might want to
+ * remember where a PDU came from, so that you can send a reply there...  
+ */
+
+static int
+netsnmp_tcp_recv(netsnmp_transport *t, void *buf, int size,
+		 void **opaque, int *olength)
+{
+    int rc = -1;
+
+    if (t != NULL && t->sock >= 0) {
+	while (rc < 0) {
+	    rc = recv(t->sock, buf, size, 0);
+	    if (rc < 0 && errno != EINTR) {
+		DEBUGMSGTL(("netsnmp_tcp", "recv fd %d err %d (\"%s\")\n",
+			    t->sock, errno, strerror(errno)));
+		break;
+	    }
+	    DEBUGMSGTL(("netsnmp_tcp", "recv fd %d got %d bytes\n",
+			t->sock, rc));
+	}
+    } else {
+        return -1;
+    }
+
+    if (opaque != NULL && olength != NULL) {
+        if (t->data_length > 0) {
+            if ((*opaque = malloc(t->data_length)) != NULL) {
+                memcpy(*opaque, t->data, t->data_length);
+                *olength = t->data_length;
+            } else {
+                *olength = 0;
+            }
+        } else {
+            *opaque = NULL;
+            *olength = 0;
+        }
+    }
+
+    return rc;
+}
+
+
+
+static int
+netsnmp_tcp_send(netsnmp_transport *t, void *buf, int size,
+		 void **opaque, int *olength)
+{
+    int rc = -1;
+
+    if (t != NULL && t->sock >= 0) {
+	while (rc < 0) {
+	    rc = send(t->sock, buf, size, 0);
+	    if (rc < 0 && errno != EINTR) {
+		break;
+	    }
+	}
+    }
+    return rc;
+}
+
+
+
+static int
+netsnmp_tcp_close(netsnmp_transport *t)
+{
+    int rc = -1;
+    if (t != NULL && t->sock >= 0) {
+        DEBUGMSGTL(("netsnmp_tcp", "close fd %d\n", t->sock));
+#ifndef HAVE_CLOSESOCKET
+        rc = close(t->sock);
+#else
+        rc = closesocket(t->sock);
+#endif
+        t->sock = -1;
+    }
+    return rc;
+}
+
+
+
+static int
+netsnmp_tcp_accept(netsnmp_transport *t)
+{
+    struct sockaddr *farend = NULL;
+    int             newsock = -1, sockflags = 0;
+    socklen_t       farendlen = sizeof(struct sockaddr_in);
+    char           *string = NULL;
+
+    farend = (struct sockaddr *) malloc(sizeof(struct sockaddr_in));
+
+    if (farend == NULL) {
+        /*
+         * Indicate that the acceptance of this socket failed.  
+         */
+        DEBUGMSGTL(("netsnmp_tcp", "accept: malloc failed\n"));
+        return -1;
+    }
+
+    if (t != NULL && t->sock >= 0) {
+        newsock = accept(t->sock, farend, &farendlen);
+
+        if (newsock < 0) {
+            DEBUGMSGTL(("netsnmp_tcp", "accept failed rc %d errno %d \"%s\"\n",
+			newsock, errno, strerror(errno)));
+            free(farend);
+            return newsock;
+        }
+
+        if (t->data != NULL) {
+            free(t->data);
+        }
+
+        t->data = farend;
+        t->data_length = farendlen;
+        string = netsnmp_tcp_fmtaddr(NULL, farend, farendlen);
+        DEBUGMSGTL(("netsnmp_tcp", "accept succeeded (from %s)\n", string));
+        free(string);
+
+        /*
+         * Try to make the new socket blocking.  
+         */
+
+#ifdef WIN32
+        ioctlsocket(newsock, FIONBIO, &sockflags);
+#else
+        if ((sockflags = fcntl(newsock, F_GETFL, 0)) >= 0) {
+            fcntl(newsock, F_SETFL, (sockflags & ~O_NONBLOCK));
+        } else {
+            DEBUGMSGTL(("netsnmp_tcp", "couldn't f_getfl of fd %d\n",newsock));
+        }
+#endif
+        return newsock;
+    } else {
+        free(farend);
+        return -1;
+    }
+}
+
+
+
+/*
+ * Open a TCP-based transport for SNMP.  Local is TRUE if addr is the local
+ * address to bind to (i.e. this is a server-type session); otherwise addr is 
+ * the remote address to send things to.  
+ */
+
+netsnmp_transport *
+netsnmp_tcp_transport(struct sockaddr_in *addr, int local)
+{
+    netsnmp_transport *t = NULL;
+    int rc = 0;
+
+
+    if (addr == NULL || addr->sin_family != AF_INET) {
+        return NULL;
+    }
+
+    t = (netsnmp_transport *) malloc(sizeof(netsnmp_transport));
+    if (t == NULL) {
+        return NULL;
+    }
+    memset(t, 0, sizeof(netsnmp_transport));
+
+    t->data = malloc(sizeof(struct sockaddr_in));
+    if (t->data == NULL) {
+        netsnmp_transport_free(t);
+        return NULL;
+    }
+    t->data_length = sizeof(struct sockaddr_in);
+    memcpy(t->data, addr, sizeof(struct sockaddr_in));
+
+    t->domain = netsnmp_snmpTCPDomain;
+    t->domain_length =
+        sizeof(netsnmp_snmpTCPDomain) / sizeof(netsnmp_snmpTCPDomain[0]);
+
+    t->sock = socket(PF_INET, SOCK_STREAM, 0);
+    if (t->sock < 0) {
+        netsnmp_transport_free(t);
+        return NULL;
+    }
+
+    t->flags = NETSNMP_TRANSPORT_FLAG_STREAM;
+
+    if (local) {
+        int sockflags = 0, opt = 1;
+
+        /*
+         * This session is inteneded as a server, so we must bind to the given 
+         * IP address (which may include an interface address, or could be
+         * INADDR_ANY, but will always include a port number.  
+         */
+
+        t->flags |= NETSNMP_TRANSPORT_FLAG_LISTEN;
+        t->local = malloc(6);
+        if (t->local == NULL) {
+            netsnmp_tcp_close(t);
+            netsnmp_transport_free(t);
+            return NULL;
+        }
+        memcpy(t->local, (u_char *) & (addr->sin_addr.s_addr), 4);
+        t->local[4] = (htons(addr->sin_port) & 0xff00) >> 8;
+        t->local[5] = (htons(addr->sin_port) & 0x00ff) >> 0;
+        t->local_length = 6;
+
+        /*
+         * We should set SO_REUSEADDR too.  
+         */
+
+        setsockopt(t->sock, SOL_SOCKET, SO_REUSEADDR, (void *)&opt,
+		   sizeof(opt));
+
+        rc = bind(t->sock, (struct sockaddr *)addr, sizeof(struct sockaddr));
+        if (rc != 0) {
+            netsnmp_tcp_close(t);
+            netsnmp_transport_free(t);
+            return NULL;
+        }
+
+        /*
+         * Since we are going to be letting select() tell us when connections
+         * are ready to be accept()ed, we need to make the socket n0n-blocking
+         * to avoid the race condition described in W. R. Stevens, ``Unix
+         * Network Programming Volume I Second Edition'', pp. 422--4, which
+         * could otherwise wedge the agent.
+         */
+
+#ifdef WIN32
+        opt = 1;
+        ioctlsocket(t->sock, FIONBIO, &opt);
+#else
+        sockflags = fcntl(t->sock, F_GETFL, 0);
+        fcntl(t->sock, F_SETFL, sockflags | O_NONBLOCK);
+#endif
+
+        /*
+         * Now sit here and wait for connections to arrive.  
+         */
+
+        rc = listen(t->sock, NETSNMP_STREAM_QUEUE_LEN);
+        if (rc != 0) {
+            netsnmp_tcp_close(t);
+            netsnmp_transport_free(t);
+            return NULL;
+        }
+    } else {
+        t->remote = malloc(6);
+        if (t->remote == NULL) {
+            netsnmp_tcp_close(t);
+            netsnmp_transport_free(t);
+            return NULL;
+        }
+        memcpy(t->remote, (u_char *) & (addr->sin_addr.s_addr), 4);
+        t->remote[4] = (htons(addr->sin_port) & 0xff00) >> 8;
+        t->remote[5] = (htons(addr->sin_port) & 0x00ff) >> 0;
+        t->remote_length = 6;
+
+        /*
+         * This is a client-type session, so attempt to connect to the far
+         * end.  We don't go non-blocking here because it's not obvious what
+         * you'd then do if you tried to do snmp_sends before the connection
+         * had completed.  So this can block.
+         */
+
+        rc = connect(t->sock, (struct sockaddr *)addr,
+		     sizeof(struct sockaddr));
+
+        if (rc < 0) {
+            netsnmp_tcp_close(t);
+            netsnmp_transport_free(t);
+            return NULL;
+        }
+    }
+
+    /*
+     * Message size is not limited by this transport (hence msgMaxSize
+     * is equal to the maximum legal size of an SNMP message).  
+     */
+
+    t->msgMaxSize = 0x7fffffff;
+    t->f_recv     = netsnmp_tcp_recv;
+    t->f_send     = netsnmp_tcp_send;
+    t->f_close    = netsnmp_tcp_close;
+    t->f_accept   = netsnmp_tcp_accept;
+    t->f_fmtaddr  = netsnmp_tcp_fmtaddr;
+
+    return t;
+}
+
+
+
+netsnmp_transport *
+netsnmp_tcp_create_tstring(const char *string, int local)
+{
+    struct sockaddr_in addr;
+
+    if (netsnmp_sockaddr_in(&addr, string, 0)) {
+        return netsnmp_tcp_transport(&addr, local);
+    } else {
+        return NULL;
+    }
+}
+
+
+
+netsnmp_transport *
+netsnmp_tcp_create_ostring(const u_char * o, size_t o_len, int local)
+{
+    struct sockaddr_in addr;
+
+    if (o_len == 6) {
+        addr.sin_family = AF_INET;
+        memcpy((u_char *) & (addr.sin_addr.s_addr), o, 4);
+        addr.sin_port = ntohs((o[4] << 8) + o[5]);
+        return netsnmp_tcp_transport(&addr, local);
+    }
+    return NULL;
+}
+
+
+
+void
+netsnmp_tcp_ctor(void)
+{
+    tcpDomain.name = netsnmp_snmpTCPDomain;
+    tcpDomain.name_length = sizeof(netsnmp_snmpTCPDomain) / sizeof(oid);
+    tcpDomain.prefix = calloc(2, sizeof(char *));
+    tcpDomain.prefix[0] = "tcp";
+
+    tcpDomain.f_create_from_tstring = netsnmp_tcp_create_tstring;
+    tcpDomain.f_create_from_ostring = netsnmp_tcp_create_ostring;
+
+    netsnmp_tdomain_register(&tcpDomain);
+}
diff -Naur tomato/release/src/router/snmp/snmplib/snmpTCPIPv6Domain.c tomato121/release/src/router/snmp/snmplib/snmpTCPIPv6Domain.c
--- tomato/release/src/router/snmp/snmplib/snmpTCPIPv6Domain.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/snmplib/snmpTCPIPv6Domain.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,426 @@
+#include <net-snmp/net-snmp-config.h>
+
+#include <stdio.h>
+#include <sys/types.h>
+#include <errno.h>
+
+#if HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+#if HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#if HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#if HAVE_SYS_SOCKET_H
+#include <sys/socket.h>
+#endif
+#if HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+#if HAVE_ARPA_INET_H
+#include <arpa/inet.h>
+#endif
+#if HAVE_NETDB_H
+#include <netdb.h>
+#endif
+#if HAVE_FCNTL_H
+#include <fcntl.h>
+#endif
+
+#if HAVE_DMALLOC_H
+#include <dmalloc.h>
+#endif
+
+#include <net-snmp/types.h>
+#include <net-snmp/output_api.h>
+#include <net-snmp/config_api.h>
+
+#include <net-snmp/library/snmp_transport.h>
+#include <net-snmp/library/snmpUDPIPv6Domain.h>
+#include <net-snmp/library/snmpTCPIPv6Domain.h>
+
+oid netsnmp_TCPIPv6Domain[] = { ENTERPRISE_MIB, 3, 3, 5 };
+static netsnmp_tdomain tcp6Domain;
+
+/*
+ * Return a string representing the address in data, or else the "far end"
+ * address if data is NULL.  
+ */
+
+static char *
+netsnmp_tcp6_fmtaddr(netsnmp_transport *t, void *data, int len)
+{
+    struct sockaddr_in6 *to = NULL;
+
+    DEBUGMSGTL(("netsnmp_tcp6", "fmtaddr: t = %p, data = %p, len = %d\n", t,
+                data, len));
+    if (data != NULL && len == sizeof(struct sockaddr_in6)) {
+        to = (struct sockaddr_in6 *) data;
+    } else if (t != NULL && t->data != NULL) {
+        to = (struct sockaddr_in6 *) t->data;
+    }
+    if (to == NULL) {
+        return strdup("TCP/IPv6: unknown");
+    } else {
+        char addr[INET6_ADDRSTRLEN];
+        char tmp[INET6_ADDRSTRLEN + 8];
+
+        sprintf(tmp, "[%s]:%hd",
+                inet_ntop(AF_INET6, (void *) &(to->sin6_addr), addr,
+                          INET6_ADDRSTRLEN), ntohs(to->sin6_port));
+        return strdup(tmp);
+    }
+}
+
+/*
+ * You can write something into opaque that will subsequently get passed back 
+ * to your send function if you like.  For instance, you might want to
+ * remember where a PDU came from, so that you can send a reply there...  
+ */
+
+static int
+netsnmp_tcp6_recv(netsnmp_transport *t, void *buf, int size,
+		  void **opaque, int *olength)
+{
+    int rc = -1;
+
+    if (t != NULL && t->sock >= 0) {
+	while (rc < 0) {
+	    rc = recv(t->sock, buf, size, 0);
+	    if (rc < 0 && errno != EINTR) {
+		DEBUGMSGTL(("netsnmp_tcp6", "recv fd %d err %d (\"%s\")\n",
+			    t->sock, errno, strerror(errno)));
+		return -1;
+	    }
+	}
+        DEBUGMSGTL(("netsnmp_tcp6", "recv fd %d got %d bytes\n", t->sock, rc));
+    } else {
+        return -1;
+    }
+
+    if (opaque != NULL && olength != NULL) {
+        if (t->data_length > 0) {
+            if ((*opaque = malloc(t->data_length)) != NULL) {
+                memcpy(*opaque, t->data, t->data_length);
+                *olength = t->data_length;
+            } else {
+                *olength = 0;
+            }
+        } else {
+            *opaque = NULL;
+            *olength = 0;
+        }
+    }
+
+    return rc;
+}
+
+static int
+netsnmp_tcp6_send(netsnmp_transport *t, void *buf, int size,
+		  void **opaque, int *olength)
+{
+    int rc = -1;
+
+    if (t != NULL && t->sock >= 0) {
+	while (rc < 0) {
+	    rc = send(t->sock, buf, size, 0);
+	    if (rc < 0 && errno != EINTR) {
+		break;
+	    }
+	}
+    }
+    return rc;
+}
+
+static int
+netsnmp_tcp6_close(netsnmp_transport *t)
+{
+    int rc = -1;
+    if (t != NULL && t->sock >= 0) {
+        DEBUGMSGTL(("netsnmp_tcp6", "close fd %d\n", t->sock));
+#ifndef HAVE_CLOSESOCKET
+        rc = close(t->sock);
+#else
+        rc = closesocket(t->sock);
+#endif
+        t->sock = -1;
+    }
+    return rc;
+}
+
+static int
+netsnmp_tcp6_accept(netsnmp_transport *t)
+{
+    struct sockaddr_in6 *farend = NULL;
+    int             newsock = -1, sockflags = 0;
+    socklen_t       farendlen = sizeof(struct sockaddr_in6);
+    char           *string = NULL;
+
+    farend = (struct sockaddr_in6 *) malloc(sizeof(struct sockaddr_in6));
+
+    if (farend == NULL) {
+        /*
+         * Indicate that the acceptance of this socket failed.  
+         */
+        DEBUGMSGTL(("netsnmp_tcp6", "accept: malloc failed\n"));
+        return -1;
+    }
+
+    if (t != NULL && t->sock >= 0) {
+        newsock = accept(t->sock, (struct sockaddr *) farend, &farendlen);
+
+        if (newsock < 0) {
+            DEBUGMSGTL(("netsnmp_tcp6","accept failed rc %d errno %d \"%s\"\n",
+			newsock, errno, strerror(errno)));
+            free(farend);
+            return newsock;
+        }
+
+        if (t->data != NULL) {
+            free(t->data);
+        }
+
+        t->data = farend;
+        t->data_length = farendlen;
+        string = netsnmp_tcp6_fmtaddr(NULL, farend, farendlen);
+        DEBUGMSGTL(("netsnmp_tcp6", "accept succeeded (from %s)\n", string));
+        free(string);
+
+        /*
+         * Try to make the new socket blocking.  
+         */
+
+#ifdef WIN32
+        ioctlsocket(newsock, FIONBIO, &sockflags);
+#else
+        if ((sockflags = fcntl(newsock, F_GETFL, 0)) >= 0) {
+            fcntl(newsock, F_SETFL, (sockflags & ~O_NONBLOCK));
+        } else {
+            DEBUGMSGTL(("netsnmp_tcp6", "accept: couldn't f_getfl of fd %d\n",
+                        newsock));
+        }
+#endif
+        return newsock;
+    } else {
+        free(farend);
+        return -1;
+    }
+}
+
+
+
+/*
+ * Open a TCP/IPv6-based transport for SNMP.  Local is TRUE if addr is the
+ * local address to bind to (i.e. this is a server-type session); otherwise
+ * addr is the remote address to send things to.  
+ */
+
+netsnmp_transport *
+netsnmp_tcp6_transport(struct sockaddr_in6 *addr, int local)
+{
+    netsnmp_transport *t = NULL;
+    int             rc = 0;
+    char           *string = NULL;
+
+    if (addr == NULL || addr->sin6_family != AF_INET6) {
+        return NULL;
+    }
+
+    t = (netsnmp_transport *) malloc(sizeof(netsnmp_transport));
+    if (t == NULL) {
+        return NULL;
+    }
+    memset(t, 0, sizeof(netsnmp_transport));
+
+    string = netsnmp_tcp6_fmtaddr(NULL, (void *)addr,
+				  sizeof(struct sockaddr_in6));
+    DEBUGMSGTL(("netsnmp_tcp6", "open %s %s\n", local ? "local" : "remote",
+                string));
+    free(string);
+
+    memset(t, 0, sizeof(netsnmp_transport));
+
+    t->data = malloc(sizeof(struct sockaddr_in6));
+    if (t->data == NULL) {
+        netsnmp_transport_free(t);
+        return NULL;
+    }
+    t->data_length = sizeof(struct sockaddr_in6);
+    memcpy(t->data, addr, sizeof(struct sockaddr_in6));
+
+    t->domain = netsnmp_TCPIPv6Domain;
+    t->domain_length = sizeof(netsnmp_TCPIPv6Domain) / sizeof(oid);
+
+    t->sock = socket(PF_INET6, SOCK_STREAM, 0);
+    if (t->sock < 0) {
+        netsnmp_transport_free(t);
+        return NULL;
+    }
+
+    t->flags = NETSNMP_TRANSPORT_FLAG_STREAM;
+
+    if (local) {
+        int sockflags = 0, opt = 1;
+
+        /*
+         * This session is inteneded as a server, so we must bind on to the
+         * given IP address, which may include an interface address, or could
+         * be INADDR_ANY, but certainly includes a port number.
+         */
+
+        t->flags |= NETSNMP_TRANSPORT_FLAG_LISTEN;
+        t->local = malloc(18);
+        if (t->local == NULL) {
+            netsnmp_tcp6_close(t);
+            netsnmp_transport_free(t);
+            return NULL;
+        }
+        memcpy(t->local, addr->sin6_addr.s6_addr, 16);
+        t->local[16] = (addr->sin6_port & 0xff00) >> 8;
+        t->local[17] = (addr->sin6_port & 0x00ff) >> 0;
+        t->local_length = 18;
+
+        /*
+         * We should set SO_REUSEADDR too.  
+         */
+
+        setsockopt(t->sock, SOL_SOCKET, SO_REUSEADDR, &opt, sizeof(opt));
+
+        rc = bind(t->sock, (struct sockaddr *) addr,
+		  sizeof(struct sockaddr_in6));
+        if (rc != 0) {
+            netsnmp_tcp6_close(t);
+            netsnmp_transport_free(t);
+            return NULL;
+        }
+
+        /*
+         * Since we are going to be letting select() tell us when connections
+         * are ready to be accept()ed, we need to make the socket n0n-blocking
+         * to avoid the race condition described in W. R. Stevens, ``Unix
+         * Network Programming Volume I Second Edition'', pp. 422--4, which
+         * could otherwise wedge the agent.
+         */
+
+#ifdef WIN32
+        opt = 1;
+        ioctlsocket(t->sock, FIONBIO, &opt);
+#else
+        sockflags = fcntl(t->sock, F_GETFL, 0);
+        fcntl(t->sock, F_SETFL, sockflags | O_NONBLOCK);
+#endif
+
+        /*
+         * Now sit here and wait for connections to arrive.  
+         */
+
+        rc = listen(t->sock, NETSNMP_STREAM_QUEUE_LEN);
+        if (rc != 0) {
+            netsnmp_tcp6_close(t);
+            netsnmp_transport_free(t);
+            return NULL;
+        }
+    } else {
+        t->remote = malloc(18);
+        if (t->remote == NULL) {
+            netsnmp_tcp6_close(t);
+            netsnmp_transport_free(t);
+            return NULL;
+        }
+        memcpy(t->remote, addr->sin6_addr.s6_addr, 16);
+        t->remote[16] = (addr->sin6_port & 0xff00) >> 8;
+        t->remote[17] = (addr->sin6_port & 0x00ff) >> 0;
+        t->remote_length = 18;
+
+        /*
+         * This is a client-type session, so attempt to connect to the far
+         * end.  We don't go non-blocking here because it's not obvious what
+         * you'd then do if you tried to do snmp_sends before the connection
+         * had completed.  So this can block.
+         */
+
+        rc = connect(t->sock, (struct sockaddr *) addr,
+                     sizeof(struct sockaddr_in6));
+
+        DEBUGMSGTL(("netsnmp_tcp6", "connect returns %d\n", rc));
+
+        if (rc < 0) {
+            netsnmp_tcp6_close(t);
+            netsnmp_transport_free(t);
+            return NULL;
+        }
+    }
+
+    /*
+     * Message size is not limited by this transport (hence msgMaxSize
+     * is equal to the maximum legal size of an SNMP message).  
+     */
+
+    t->msgMaxSize = 0x7fffffff;
+    t->f_recv     = netsnmp_tcp6_recv;
+    t->f_send     = netsnmp_tcp6_send;
+    t->f_close    = netsnmp_tcp6_close;
+    t->f_accept   = netsnmp_tcp6_accept;
+    t->f_fmtaddr  = netsnmp_tcp6_fmtaddr;
+
+    return t;
+}
+
+
+
+netsnmp_transport *
+netsnmp_tcp6_create_tstring(const char *string, int local)
+{
+    struct sockaddr_in6 addr;
+
+    if (netsnmp_sockaddr_in6(&addr, string, 0)) {
+        return netsnmp_tcp6_transport(&addr, local);
+    } else {
+        return NULL;
+    }
+}
+
+
+/*
+ * See:
+ * 
+ * http://www.ietf.org/internet-drafts/draft-ietf-ops-taddress-mib-01.txt
+ * 
+ * (or newer equivalent) for details of the TC which we are using for
+ * the mapping here.  
+ */
+
+netsnmp_transport *
+netsnmp_tcp6_create_ostring(const u_char * o, size_t o_len, int local)
+{
+    struct sockaddr_in6 addr;
+
+    if (o_len == 18) {
+        memset((u_char *) & addr, 0, sizeof(struct sockaddr_in6));
+        addr.sin6_family = AF_INET6;
+        memcpy((u_char *) & (addr.sin6_addr.s6_addr), o, 16);
+        addr.sin6_port = (o[16] << 8) + o[17];
+        return netsnmp_tcp6_transport(&addr, local);
+    }
+    return NULL;
+}
+
+
+void
+netsnmp_tcp6_ctor(void)
+{
+    tcp6Domain.name = netsnmp_TCPIPv6Domain;
+    tcp6Domain.name_length = sizeof(netsnmp_TCPIPv6Domain) / sizeof(oid);
+    tcp6Domain.f_create_from_tstring = netsnmp_tcp6_create_tstring;
+    tcp6Domain.f_create_from_ostring = netsnmp_tcp6_create_ostring;
+    tcp6Domain.prefix = calloc(4, sizeof(char *));
+    tcp6Domain.prefix[0] = "tcp6";
+    tcp6Domain.prefix[1] = "tcpv6";
+    tcp6Domain.prefix[2] = "tcpipv6";
+
+    netsnmp_tdomain_register(&tcp6Domain);
+}
diff -Naur tomato/release/src/router/snmp/snmplib/snmp_transport.c tomato121/release/src/router/snmp/snmplib/snmp_transport.c
--- tomato/release/src/router/snmp/snmplib/snmp_transport.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/snmplib/snmp_transport.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,449 @@
+#include <net-snmp/net-snmp-config.h>
+
+#include <stdio.h>
+#if HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+#include <sys/types.h>
+
+#if HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+
+#if HAVE_DMALLOC_H
+#include <dmalloc.h>
+#endif
+
+#include <net-snmp/output_api.h>
+#include <net-snmp/utilities.h>
+
+#include <net-snmp/library/snmp_transport.h>
+#include <net-snmp/library/snmpUDPDomain.h>
+#ifdef SNMP_TRANSPORT_TCP_DOMAIN
+#include <net-snmp/library/snmpTCPDomain.h>
+#endif
+#ifdef SNMP_TRANSPORT_IPX_DOMAIN
+#include <net-snmp/library/snmpIPXDomain.h>
+#endif
+#ifdef SNMP_TRANSPORT_UNIX_DOMAIN
+#include <net-snmp/library/snmpUnixDomain.h>
+#endif
+#ifdef SNMP_TRANSPORT_AAL5PVC_DOMAIN
+#include <net-snmp/library/snmpAAL5PVCDomain.h>
+#endif
+#ifdef SNMP_TRANSPORT_UDPIPV6_DOMAIN
+#include <net-snmp/library/snmpUDPIPv6Domain.h>
+#endif
+#ifdef SNMP_TRANSPORT_TCPIPV6_DOMAIN
+#include <net-snmp/library/snmpTCPIPv6Domain.h>
+#endif
+#include <net-snmp/library/snmp_api.h>
+
+
+/*
+ * Our list of supported transport domains.  
+ */
+
+static netsnmp_tdomain *domain_list = NULL;
+
+
+
+/*
+ * The standard SNMP domains.  
+ */
+
+oid             netsnmpUDPDomain[] = { 1, 3, 6, 1, 6, 1, 1 };
+size_t          netsnmpUDPDomain_len = OID_LENGTH(netsnmpUDPDomain);
+oid             netsnmpCLNSDomain[] = { 1, 3, 6, 1, 6, 1, 2 };
+size_t          netsnmpCLNSDomain_len = OID_LENGTH(netsnmpCLNSDomain);
+oid             netsnmpCONSDomain[] = { 1, 3, 6, 1, 6, 1, 3 };
+size_t          netsnmpCONSDomain_len = OID_LENGTH(netsnmpCONSDomain);
+oid             netsnmpDDPDomain[] = { 1, 3, 6, 1, 6, 1, 4 };
+size_t          netsnmpDDPDomain_len = OID_LENGTH(netsnmpDDPDomain);
+oid             netsnmpIPXDomain[] = { 1, 3, 6, 1, 6, 1, 5 };
+size_t          netsnmpIPXDomain_len = OID_LENGTH(netsnmpIPXDomain);
+
+
+
+static void     netsnmp_tdomain_dump(void);
+
+
+/*
+ * Make a deep copy of an netsnmp_transport.  
+ */
+
+netsnmp_transport *
+netsnmp_transport_copy(netsnmp_transport *t)
+{
+    netsnmp_transport *n = NULL;
+
+    n = (netsnmp_transport *) malloc(sizeof(netsnmp_transport));
+    if (n == NULL) {
+        return NULL;
+    }
+    memset(n, 0, sizeof(netsnmp_transport));
+
+    if (t->domain != NULL) {
+        n->domain = t->domain;
+        n->domain_length = t->domain_length;
+    } else {
+        n->domain = NULL;
+        n->domain_length = 0;
+    }
+
+    if (t->local != NULL) {
+        n->local = (u_char *) malloc(t->local_length);
+        if (n->local == NULL) {
+            netsnmp_transport_free(n);
+            return NULL;
+        }
+        n->local_length = t->local_length;
+        memcpy(n->local, t->local, t->local_length);
+    } else {
+        n->local = NULL;
+        n->local_length = 0;
+    }
+
+    if (t->remote != NULL) {
+        n->remote = (u_char *) malloc(t->remote_length);
+        if (n->remote == NULL) {
+            netsnmp_transport_free(n);
+            return NULL;
+        }
+        n->remote_length = t->remote_length;
+        memcpy(n->remote, t->remote, t->remote_length);
+    } else {
+        n->remote = NULL;
+        n->remote_length = 0;
+    }
+
+    if (t->data != NULL && t->data_length > 0) {
+        n->data = malloc(t->data_length);
+        if (n->data == NULL) {
+            netsnmp_transport_free(n);
+            return NULL;
+        }
+        n->data_length = t->data_length;
+        memcpy(n->data, t->data, t->data_length);
+    } else {
+        n->data = NULL;
+        n->data_length = 0;
+    }
+
+    n->msgMaxSize = t->msgMaxSize;
+    n->f_accept = t->f_accept;
+    n->f_recv = t->f_recv;
+    n->f_send = t->f_send;
+    n->f_close = t->f_close;
+    n->f_fmtaddr = t->f_fmtaddr;
+    n->sock = t->sock;
+    n->flags = t->flags;
+
+    return n;
+}
+
+
+
+void
+netsnmp_transport_free(netsnmp_transport *t)
+{
+    if (t->local != NULL) {
+        free(t->local);
+    }
+    if (t->remote != NULL) {
+        free(t->remote);
+    }
+    if (t->data != NULL) {
+        free(t->data);
+    }
+    free(t);
+}
+
+
+
+int
+netsnmp_tdomain_support(const oid * in_oid,
+                        size_t in_len,
+                        const oid ** out_oid, size_t * out_len)
+{
+    netsnmp_tdomain *d = NULL;
+
+    for (d = domain_list; d != NULL; d = d->next) {
+        if (netsnmp_oid_equals(in_oid, in_len, d->name, d->name_length) == 0) {
+            if (out_oid != NULL && out_len != NULL) {
+                *out_oid = d->name;
+                *out_len = d->name_length;
+            }
+            return 1;
+        }
+    }
+    return 0;
+}
+
+
+
+void
+netsnmp_tdomain_init(void)
+{
+    DEBUGMSGTL(("tdomain", "netsnmp_tdomain_init() called\n"));
+    netsnmp_udp_ctor();
+#ifdef SNMP_TRANSPORT_TCP_DOMAIN
+    netsnmp_tcp_ctor();
+#endif
+#ifdef SNMP_TRANSPORT_IPX_DOMAIN
+    netsnmp_ipx_ctor();
+#endif
+#ifdef SNMP_TRANSPORT_UNIX_DOMAIN
+    netsnmp_unix_ctor();
+#endif
+#ifdef SNMP_TRANSPORT_AAL5PVC_DOMAIN
+    netsnmp_aal5pvc_ctor();
+#endif
+#ifdef SNMP_TRANSPORT_UDPIPV6_DOMAIN
+    netsnmp_udp6_ctor();
+#endif
+#ifdef SNMP_TRANSPORT_TCPIPV6_DOMAIN
+    netsnmp_tcp6_ctor();
+#endif
+    netsnmp_tdomain_dump();
+}
+
+
+static void
+netsnmp_tdomain_dump(void)
+{
+    netsnmp_tdomain *d;
+    int i = 0;
+
+    DEBUGMSGTL(("tdomain", "domain_list -> "));
+    for (d = domain_list; d != NULL; d = d->next) {
+        DEBUGMSG(("tdomain", "{ "));
+        DEBUGMSGOID(("tdomain", d->name, d->name_length));
+        DEBUGMSG(("tdomain", ", \""));
+        for (i = 0; d->prefix[i] != NULL; i++) {
+            DEBUGMSG(("tdomain", "%s%s", d->prefix[i],
+		      (d->prefix[i + 1]) ? "/" : ""));
+        }
+        DEBUGMSG(("tdomain", "\" } -> "));
+    }
+    DEBUGMSG(("tdomain", "[NIL]\n"));
+}
+
+
+
+int
+netsnmp_tdomain_register(netsnmp_tdomain *n)
+{
+    netsnmp_tdomain **prevNext = &domain_list, *d;
+
+    if (n != NULL) {
+        for (d = domain_list; d != NULL; d = d->next) {
+            if (netsnmp_oid_equals(n->name, n->name_length,
+                                d->name, d->name_length) == 0) {
+                /*
+                 * Already registered.  
+                 */
+                return 0;
+            }
+            prevNext = &(d->next);
+        }
+        n->next = NULL;
+        *prevNext = n;
+        return 1;
+    } else {
+        return 0;
+    }
+}
+
+
+
+int
+netsnmp_tdomain_unregister(netsnmp_tdomain *n)
+{
+    netsnmp_tdomain **prevNext = &domain_list, *d;
+
+    if (n != NULL) {
+        for (d = domain_list; d != NULL; d = d->next) {
+            if (netsnmp_oid_equals(n->name, n->name_length,
+                                d->name, d->name_length) == 0) {
+                *prevNext = n->next;
+                return 1;
+            }
+            prevNext = &(d->next);
+        }
+        return 0;
+    } else {
+        return 0;
+    }
+}
+
+
+
+netsnmp_transport *
+netsnmp_tdomain_transport(const char *string, int local,
+                          const char *default_domain)
+{
+    netsnmp_tdomain *d;
+    netsnmp_transport *t = NULL;
+    const char     *spec, *addr;
+    char           *cp, *mystring;
+    int             i;
+
+    if (string == NULL) {
+        return NULL;
+    }
+
+    if ((mystring = strdup(string)) == NULL) {
+        DEBUGMSGTL(("tdomain", "can't strdup(\"%s\")\n", string));
+        return NULL;
+    }
+
+    if ((cp = strchr(mystring, ':')) == NULL) {
+        /*
+         * There doesn't appear to be a transport specifier.  
+         */
+        DEBUGMSGTL(("tdomain", "no specifier in \"%s\"\n", mystring));
+        if (*mystring == '/') {
+            spec = "unix";
+            addr = mystring;
+        } else {
+            if (default_domain) {
+                spec = default_domain;
+            } else {
+                spec = "udp";
+            }
+            addr = mystring;
+        }
+    } else {
+        *cp = '\0';
+        spec = mystring;
+        addr = cp + 1;
+    }
+    DEBUGMSGTL(("tdomain", "specifier \"%s\" address \"%s\"\n", spec,
+                addr));
+
+    for (d = domain_list; d != NULL; d = d->next) {
+        for (i = 0; d->prefix[i] != NULL; i++) {
+            if (strcasecmp(d->prefix[i], spec) == 0) {
+                DEBUGMSGTL(("tdomain", "specifier \"%s\" matched\n",
+                            spec));
+                t = d->f_create_from_tstring(addr, local);
+                free(mystring);
+                return t;
+            }
+        }
+    }
+
+    /*
+     * Okay no match so far.  Consider the possibility that we have something
+     * like hostname.domain.com:port which will have confused the parser above.
+     * Try and match again with the appropriate default domain.  
+     */
+
+    if (default_domain) {
+        spec = default_domain;
+    } else {
+        spec = "udp";
+    }
+    if (cp) {
+        *cp = ':';
+    }
+
+    addr = mystring;
+    DEBUGMSGTL(("tdomain",
+                "try again with specifier \"%s\" address \"%s\"\n", spec,
+                addr));
+
+    for (d = domain_list; d != NULL; d = d->next) {
+        for (i = 0; d->prefix[i] != NULL; i++) {
+            if (strcmp(d->prefix[i], spec) == 0) {
+                DEBUGMSGTL(("tdomain", "specifier \"%s\" matched\n",
+                            spec));
+                t = d->f_create_from_tstring(addr, local);
+                free(mystring);
+                return t;
+            }
+        }
+    }
+
+    snmp_log(LOG_ERR, "No support for requested transport domain \"%s\"\n",
+             spec);
+    free(mystring);
+    return NULL;
+}
+
+
+netsnmp_transport *
+netsnmp_tdomain_transport_oid(const oid * dom,
+                              size_t dom_len,
+                              const u_char * o, size_t o_len, int local)
+{
+    netsnmp_tdomain *d;
+    int             i;
+
+    DEBUGMSGTL(("tdomain", "domain \""));
+    DEBUGMSGOID(("tdomain", dom, dom_len));
+    DEBUGMSG(("tdomain", "\"\n"));
+
+    for (d = domain_list; d != NULL; d = d->next) {
+        for (i = 0; d->prefix[i] != NULL; i++) {
+            if (netsnmp_oid_equals(dom, dom_len, d->name, d->name_length) ==
+                0) {
+                return d->f_create_from_ostring(o, o_len, local);
+            }
+        }
+    }
+
+    snmp_log(LOG_ERR, "No support for requested transport domain\n");
+    return NULL;
+}
+
+
+/** adds a transport to a linked list of transports.
+    Returns 1 on failure, 0 on success */
+int
+netsnmp_transport_add_to_list(netsnmp_transport_list **transport_list,
+                              netsnmp_transport *transport)
+{
+    netsnmp_transport_list *newptr =
+        SNMP_MALLOC_TYPEDEF(netsnmp_transport_list);
+
+    if (!newptr)
+        return 1;
+
+    newptr->next = *transport_list;
+    newptr->transport = transport;
+
+    *transport_list = newptr;
+
+    return 0;
+}
+
+
+/**  removes a transport from a linked list of transports.
+     Returns 1 on failure, 0 on success */
+int
+netsnmp_transport_remove_from_list(netsnmp_transport_list **transport_list,
+                                   netsnmp_transport *transport)
+{
+    netsnmp_transport_list *ptr = *transport_list, *lastptr = NULL;
+
+    while (ptr && ptr->transport != transport) {
+        lastptr = ptr;
+        ptr = ptr->next;
+    }
+
+    if (!ptr)
+        return 1;
+
+    if (lastptr)
+        lastptr->next = ptr->next;
+    else
+        *transport_list = ptr->next;
+
+    free(ptr);
+
+    return 0;
+}
diff -Naur tomato/release/src/router/snmp/snmplib/snmpUDPDomain.c tomato121/release/src/router/snmp/snmplib/snmpUDPDomain.c
--- tomato/release/src/router/snmp/snmplib/snmpUDPDomain.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/snmplib/snmpUDPDomain.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,777 @@
+#include <net-snmp/net-snmp-config.h>
+
+#include <stdio.h>
+#include <sys/types.h>
+#include <ctype.h>
+#include <errno.h>
+
+#if HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+#if HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#if HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#if HAVE_SYS_SOCKET_H
+#include <sys/socket.h>
+#endif
+#if HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+#if HAVE_ARPA_INET_H
+#include <arpa/inet.h>
+#endif
+#if HAVE_NETDB_H
+#include <netdb.h>
+#endif
+
+#if HAVE_DMALLOC_H
+#include <dmalloc.h>
+#endif
+
+#include <net-snmp/types.h>
+#include <net-snmp/output_api.h>
+#include <net-snmp/config_api.h>
+
+#include <net-snmp/library/snmp_transport.h>
+#include <net-snmp/library/snmpUDPDomain.h>
+
+#ifndef INADDR_NONE
+#define INADDR_NONE	-1
+#endif
+
+static netsnmp_tdomain udpDomain;
+
+/*
+ * Return a string representing the address in data, or else the "far end"
+ * address if data is NULL.  
+ */
+
+static char *
+netsnmp_udp_fmtaddr(netsnmp_transport *t, void *data, int len)
+{
+    struct sockaddr_in *to = NULL;
+
+    if (data != NULL && len == sizeof(struct sockaddr_in)) {
+        to = (struct sockaddr_in *) data;
+    } else if (t != NULL && t->data != NULL) {
+        to = (struct sockaddr_in *) t->data;
+    }
+    if (to == NULL) {
+        return strdup("UDP: unknown");
+    } else {
+	char tmp[64];
+
+        /*
+         * Here we just print the IP address of the peer for compatibility
+         * purposes.  It would be nice if we could include the port number and
+         * some indication of the domain (c.f. AAL5PVC).  
+         */
+
+        sprintf(tmp, "%s", inet_ntoa(to->sin_addr));
+        return strdup(tmp);
+    }
+}
+
+
+
+/*
+ * You can write something into opaque that will subsequently get passed back 
+ * to your send function if you like.  For instance, you might want to
+ * remember where a PDU came from, so that you can send a reply there...  
+ */
+
+static int
+netsnmp_udp_recv(netsnmp_transport *t, void *buf, int size,
+		 void **opaque, int *olength)
+{
+    int             rc = -1;
+    socklen_t       fromlen = sizeof(struct sockaddr);
+    struct sockaddr *from;
+
+    if (t != NULL && t->sock >= 0) {
+        from = (struct sockaddr *) malloc(sizeof(struct sockaddr_in));
+        if (from == NULL) {
+            *opaque = NULL;
+            *olength = 0;
+            return -1;
+        } else {
+            memset(from, 0, fromlen);
+        }
+
+	while (rc < 0) {
+	    rc = recvfrom(t->sock, buf, size, 0, from, &fromlen);
+	    if (rc < 0 && errno != EINTR) {
+		break;
+	    }
+	}
+
+        if (rc >= 0) {
+            char *string = netsnmp_udp_fmtaddr(NULL, from, fromlen);
+            DEBUGMSGTL(("netsnmp_udp",
+			"recvfrom fd %d got %d bytes (from %s)\n",
+			t->sock, rc, string));
+            free(string);
+        } else {
+            DEBUGMSGTL(("netsnmp_udp", "recvfrom fd %d err %d (\"%s\")\n",
+                        t->sock, errno, strerror(errno)));
+        }
+        *opaque = (void *)from;
+        *olength = sizeof(struct sockaddr_in);
+    }
+    return rc;
+}
+
+
+
+static int
+netsnmp_udp_send(netsnmp_transport *t, void *buf, int size,
+		 void **opaque, int *olength)
+{
+    int rc = -1;
+    struct sockaddr *to = NULL;
+
+    if (opaque != NULL && *opaque != NULL &&
+        *olength == sizeof(struct sockaddr_in)) {
+        to = (struct sockaddr *) (*opaque);
+    } else if (t != NULL && t->data != NULL &&
+               t->data_length == sizeof(struct sockaddr_in)) {
+        to = (struct sockaddr *) (t->data);
+    }
+
+    if (to != NULL && t != NULL && t->sock >= 0) {
+        char *string = netsnmp_udp_fmtaddr(NULL, (void *) to,
+					sizeof(struct sockaddr_in));
+        DEBUGMSGTL(("netsnmp_udp", "send %d bytes from %p to %s on fd %d\n",
+                    size, buf, string, t->sock));
+        free(string);
+	while (rc < 0) {
+	    rc = sendto(t->sock, buf, size, 0, to, sizeof(struct sockaddr));
+	    if (rc < 0 && errno != EINTR) {
+		break;
+	    }
+	}
+    }
+    return rc;
+}
+
+
+
+static int
+netsnmp_udp_close(netsnmp_transport *t)
+{
+    int rc = -1;
+    if (t->sock >= 0) {
+#ifndef HAVE_CLOSESOCKET
+        rc = close(t->sock);
+#else
+        rc = closesocket(t->sock);
+#endif
+        t->sock = -1;
+    }
+    return rc;
+}
+
+
+
+/*
+ * Open a UDP-based transport for SNMP.  Local is TRUE if addr is the local
+ * address to bind to (i.e. this is a server-type session); otherwise addr is 
+ * the remote address to send things to.  
+ */
+
+netsnmp_transport *
+netsnmp_udp_transport(struct sockaddr_in *addr, int local)
+{
+    netsnmp_transport *t = NULL;
+    int             rc = 0, udpbuf = (1 << 17);
+    char           *string = NULL;
+
+    if (addr == NULL || addr->sin_family != AF_INET) {
+        return NULL;
+    }
+
+    t = (netsnmp_transport *) malloc(sizeof(netsnmp_transport));
+    if (t == NULL) {
+        return NULL;
+    }
+
+    string = netsnmp_udp_fmtaddr(NULL, (void *)addr, 
+				 sizeof(struct sockaddr_in));
+    DEBUGMSGTL(("netsnmp_udp", "open %s %s\n", local ? "local" : "remote",
+                string));
+    free(string);
+
+    memset(t, 0, sizeof(netsnmp_transport));
+
+    t->domain = netsnmpUDPDomain;
+    t->domain_length = netsnmpUDPDomain_len;
+
+    t->sock = socket(PF_INET, SOCK_DGRAM, 0);
+    if (t->sock < 0) {
+        netsnmp_transport_free(t);
+        return NULL;
+    }
+#ifdef  SO_BSDCOMPAT
+    /*
+     * Patch for Linux.  Without this, UDP packets that fail get an ICMP
+     * response.  Linux turns the failed ICMP response into an error message
+     * and return value, unlike all other OS's.  
+     */
+    {
+        int             one = 1;
+        setsockopt(t->sock, SOL_SOCKET, SO_BSDCOMPAT, (void *) &one,
+                   sizeof(one));
+    }
+#endif                          /*SO_BSDCOMPAT */
+    /*
+     * SO_REUSEADDR will allow multiple apps to open the same port at
+     * the same time. Only the last one to open the socket will get
+     * data. Obviously, for an agent, this is a bad thing. There should
+     * only be one listener.
+     */
+#ifdef ALLOW_PORT_HIJACKING
+#ifdef  SO_REUSEADDR
+    /*
+     * Allow the same port to be specified multiple times without failing.
+     *    (useful for a listener)
+     */
+    {
+        int             one = 1;
+        setsockopt(t->sock, SOL_SOCKET, SO_REUSEADDR, (void *) &one,
+                   sizeof(one));
+    }
+#endif                          /*SO_REUSEADDR */
+#endif
+    /*
+     * Try to set the send and receive buffers to a reasonably large value, so
+     * that we can send and receive big PDUs (defaults to 8192 bytes (!) on
+     * Solaris, for instance).  Don't worry too much about errors -- just
+     * plough on regardless.  
+     */
+
+#ifdef  SO_SNDBUF
+    if (setsockopt
+        (t->sock, SOL_SOCKET, SO_SNDBUF, (void *) &udpbuf,
+         sizeof(int)) != 0) {
+        DEBUGMSGTL(("netsnmp_udp", "couldn't set SO_SNDBUF to %d bytes: %s\n",
+                    udpbuf, strerror(errno)));
+    }
+#endif                          /*SO_SNDBUF */
+
+#ifdef  SO_RCVBUF
+    if (setsockopt
+        (t->sock, SOL_SOCKET, SO_RCVBUF, (void *) &udpbuf,
+         sizeof(int)) != 0) {
+        DEBUGMSGTL(("netsnmp_udp", "couldn't set SO_RCVBUF to %d bytes: %s\n",
+                    udpbuf, strerror(errno)));
+    }
+#endif                          /*SO_RCVBUF */
+
+    if (local) {
+        /*
+         * This session is inteneded as a server, so we must bind on to the
+         * given IP address, which may include an interface address, or could
+         * be INADDR_ANY, but certainly includes a port number.
+         */
+
+        t->local = malloc(6);
+        if (t->local == NULL) {
+            netsnmp_transport_free(t);
+            return NULL;
+        }
+        memcpy(t->local, (u_char *) & (addr->sin_addr.s_addr), 4);
+        t->local[4] = (htons(addr->sin_port) & 0xff00) >> 8;
+        t->local[5] = (htons(addr->sin_port) & 0x00ff) >> 0;
+        t->local_length = 6;
+
+        rc = bind(t->sock, (struct sockaddr *) addr,
+                  sizeof(struct sockaddr));
+        if (rc != 0) {
+            netsnmp_udp_close(t);
+            netsnmp_transport_free(t);
+            return NULL;
+        }
+        t->data = NULL;
+        t->data_length = 0;
+    } else {
+        /*
+         * This is a client session.  Save the address in the
+         * transport-specific data pointer for later use by netsnmp_udp_send.
+         */
+
+        t->data = malloc(sizeof(struct sockaddr_in));
+        t->remote = malloc(6);
+        if (t->data == NULL || t->remote == NULL) {
+            netsnmp_transport_free(t);
+            return NULL;
+        }
+        memcpy(t->remote, (u_char *) & (addr->sin_addr.s_addr), 4);
+        t->remote[4] = (htons(addr->sin_port) & 0xff00) >> 8;
+        t->remote[5] = (htons(addr->sin_port) & 0x00ff) >> 0;
+        t->remote_length = 6;
+        memcpy(t->data, addr, sizeof(struct sockaddr_in));
+        t->data_length = sizeof(struct sockaddr_in);
+    }
+
+    /*
+     * 16-bit length field, 8 byte UDP header, 20 byte IPv4 header  
+     */
+
+    t->msgMaxSize = 0xffff - 8 - 20;
+    t->f_recv     = netsnmp_udp_recv;
+    t->f_send     = netsnmp_udp_send;
+    t->f_close    = netsnmp_udp_close;
+    t->f_accept   = NULL;
+    t->f_fmtaddr  = netsnmp_udp_fmtaddr;
+
+    return t;
+}
+
+
+
+int
+netsnmp_sockaddr_in(struct sockaddr_in *addr,
+                    const char *inpeername, int remote_port)
+{
+    char           *cp = NULL, *peername = NULL;
+
+    if (addr == NULL) {
+        return 0;
+    }
+    memset(addr, 0, sizeof(struct sockaddr_in));
+
+    DEBUGMSGTL(("netsnmp_sockaddr_in", "addr %p, peername \"%s\"\n",
+                addr, inpeername ? inpeername : "[NIL]"));
+
+    addr->sin_addr.s_addr = htonl(INADDR_ANY);
+    addr->sin_family = AF_INET;
+    if (remote_port > 0) {
+        addr->sin_port = htons(remote_port);
+    } else if (netsnmp_ds_get_int(NETSNMP_DS_LIBRARY_ID, 
+				  NETSNMP_DS_LIB_DEFAULT_PORT) > 0) {
+        addr->sin_port = htons(netsnmp_ds_get_int(NETSNMP_DS_LIBRARY_ID, 
+						 NETSNMP_DS_LIB_DEFAULT_PORT));
+    } else {
+        addr->sin_port = htons(SNMP_PORT);
+    }
+
+    if (inpeername != NULL) {
+        /*
+         * Duplicate the peername because we might want to mank around with
+         * it.  
+         */
+
+        peername = strdup(inpeername);
+        if (peername == NULL) {
+            return 0;
+        }
+
+        /*
+         * Try and extract an appended port number.  
+         */
+        cp = strchr(peername, ':');
+        if (cp != NULL) {
+            *cp = '\0';
+            cp++;
+            if (atoi(cp) != 0) {
+                DEBUGMSGTL(("netsnmp_sockaddr_in",
+                            "port number suffix :%d\n", atoi(cp)));
+                addr->sin_port = htons(atoi(cp));
+            }
+        }
+
+        for (cp = peername; *cp && isdigit((int) *cp); cp++);
+        if (!*cp && atoi(peername) != 0) {
+            /*
+             * Okay, it looks like just a port number.  
+             */
+            DEBUGMSGTL(("netsnmp_sockaddr_in", "totally numeric: %d\n",
+                        atoi(peername)));
+            addr->sin_port = htons(atoi(peername));
+        } else if (inet_addr(peername) != INADDR_NONE) {
+            /*
+             * It looks like an IP address.  
+             */
+            DEBUGMSGTL(("netsnmp_sockaddr_in", "IP address\n"));
+            addr->sin_addr.s_addr = inet_addr(peername);
+        } else {
+            /*
+             * Well, it must be a hostname then.  
+             */
+#ifdef  HAVE_GETHOSTBYNAME
+            struct hostent *hp = gethostbyname(peername);
+            if (hp == NULL) {
+                DEBUGMSGTL(("netsnmp_sockaddr_in",
+                            "hostname (couldn't resolve)\n"));
+                free(peername);
+                return 0;
+            } else {
+                if (hp->h_addrtype != AF_INET) {
+                    DEBUGMSGTL(("netsnmp_sockaddr_in",
+                                "hostname (not AF_INET!)\n"));
+                    free(peername);
+                    return 0;
+                } else {
+                    DEBUGMSGTL(("netsnmp_sockaddr_in",
+                                "hostname (resolved okay)\n"));
+                    memcpy(&(addr->sin_addr), hp->h_addr, hp->h_length);
+                }
+            }
+#else                           /*HAVE_GETHOSTBYNAME */
+            DEBUGMSGTL(("netsnmp_sockaddr_in",
+                        "hostname (no gethostbyname)\n"));
+            free(peername);
+            return 0;
+#endif                          /*HAVE_GETHOSTBYNAME */
+        }
+    } else {
+        DEBUGMSGTL(("netsnmp_sockaddr_in", "NULL peername"));
+        return 0;
+    }
+    DEBUGMSGTL(("netsnmp_sockaddr_in", "return { AF_INET, %s:%hu }\n",
+                inet_ntoa(addr->sin_addr), ntohs(addr->sin_port)));
+    free(peername);
+    return 1;
+}
+
+
+
+/*
+ * The following functions provide the "com2sec" configuration token
+ * functionality for compatibility.  
+ */
+
+#define EXAMPLE_NETWORK		"NETWORK"
+#define EXAMPLE_COMMUNITY	"COMMUNITY"
+
+typedef struct _com2SecEntry {
+    char            community[VACMSTRINGLEN];
+    unsigned long   network;
+    unsigned long   mask;
+    char            secName[VACMSTRINGLEN];
+    struct _com2SecEntry *next;
+} com2SecEntry;
+
+com2SecEntry   *com2SecList = NULL, *com2SecListLast = NULL;
+
+void
+netsnmp_udp_parse_security(const char *token, char *param)
+{
+    char           *secName = NULL, *community = NULL, *source = NULL;
+    char           *cp = NULL;
+    const char     *strmask = NULL;
+    com2SecEntry   *e = NULL;
+    unsigned long   network = 0, mask = 0;
+
+    /*
+     * Get security, source address/netmask and community strings.  
+     */
+
+    secName = strtok(param, "\t\n ");
+    if (secName == NULL) {
+        config_perror("missing NAME parameter");
+        return;
+    } else if (strlen(secName) > (VACMSTRINGLEN - 1)) {
+        config_perror("security name too long");
+        return;
+    }
+    source = strtok(NULL, "\t\n ");
+    if (source == NULL) {
+        config_perror("missing SOURCE parameter");
+        return;
+    } else if (strncmp(source, EXAMPLE_NETWORK, strlen(EXAMPLE_NETWORK)) ==
+               0) {
+        config_perror("example config NETWORK not properly configured");
+        return;
+    }
+    community = strtok(NULL, "\t\n ");
+    if (community == NULL) {
+        config_perror("missing COMMUNITY parameter\n");
+        return;
+    } else
+        if (strncmp
+            (community, EXAMPLE_COMMUNITY, strlen(EXAMPLE_COMMUNITY))
+            == 0) {
+        config_perror("example config COMMUNITY not properly configured");
+        return;
+    } else if (strlen(community) > (VACMSTRINGLEN - 1)) {
+        config_perror("community name too long");
+        return;
+    }
+
+    /*
+     * Process the source address/netmask string.  
+     */
+
+    cp = strchr(source, '/');
+    if (cp != NULL) {
+        /*
+         * Mask given.  
+         */
+        *cp = '\0';
+        strmask = cp + 1;
+    }
+
+    /*
+     * Deal with the network part first.  
+     */
+
+    if ((strcmp(source, "default") == 0)
+        || (strcmp(source, "0.0.0.0") == 0)) {
+        network = 0;
+        strmask = "0.0.0.0";
+    } else {
+        /*
+         * Try interpreting as a dotted quad.  
+         */
+        network = inet_addr(source);
+
+        if (network == (unsigned long) -1) {
+            /*
+             * Nope, wasn't a dotted quad.  Must be a hostname.  
+             */
+#ifdef  HAVE_GETHOSTBYNAME
+            struct hostent *hp = gethostbyname(source);
+            if (hp == NULL) {
+                config_perror("bad source address");
+                return;
+            } else {
+                if (hp->h_addrtype != AF_INET) {
+                    config_perror("no IP address for source hostname");
+                    return;
+                }
+                network = *((unsigned long *) hp->h_addr);
+            }
+#else                           /*HAVE_GETHOSTBYNAME */
+            /*
+             * Oh dear.  
+             */
+            config_perror("cannot resolve source hostname");
+            return;
+#endif                          /*HAVE_GETHOSTBYNAME */
+        }
+    }
+
+    /*
+     * Now work out the mask.  
+     */
+
+    if (strmask == NULL || *strmask == '\0') {
+        /*
+         * No mask was given.  Use 255.255.255.255.  
+         */
+        mask = 0xffffffffL;
+    } else {
+        if (strchr(strmask, '.')) {
+            /*
+             * Try to interpret mask as a dotted quad.  
+             */
+            mask = inet_addr(strmask);
+            if (mask == (unsigned long) -1 &&
+                strncmp(strmask, "255.255.255.255", 15) != 0) {
+                config_perror("bad mask");
+                return;
+            }
+        } else {
+            /*
+             * Try to interpret mask as a "number of 1 bits".  
+             */
+            int             maskLen = atoi(strmask), maskBit = 0x80000000L;
+            if (maskLen <= 0 || maskLen > 32) {
+                config_perror("bad mask length");
+                return;
+            }
+            while (maskLen--) {
+                mask |= maskBit;
+                maskBit >>= 1;
+            }
+            mask = htonl(mask);
+        }
+    }
+
+    /*
+     * Check that the network and mask are consistent.  
+     */
+
+    if (network & ~mask) {
+        config_perror("source/mask mismatch");
+        return;
+    }
+
+    e = (com2SecEntry *) malloc(sizeof(com2SecEntry));
+    if (e == NULL) {
+        config_perror("memory error");
+        return;
+    }
+
+    /*
+     * Everything is okay.  Copy the parameters to the structure allocated
+     * above and add it to END of the list.  
+     */
+
+    DEBUGMSGTL(("netsnmp_udp_parse_security",
+                "<\"%s\", 0x%08x/0x%08x> => \"%s\"\n", community, network,
+                mask, secName));
+
+    strcpy(e->secName, secName);
+    strcpy(e->community, community);
+    e->network = network;
+    e->mask = mask;
+    e->next = NULL;
+
+    if (com2SecListLast != NULL) {
+        com2SecListLast->next = e;
+        com2SecListLast = e;
+    } else {
+        com2SecListLast = com2SecList = e;
+    }
+}
+
+
+void
+netsnmp_udp_com2SecList_free(void)
+{
+    com2SecEntry   *e = com2SecList;
+    while (e != NULL) {
+        com2SecEntry   *tmp = e;
+        e = e->next;
+        free(tmp);
+    }
+    com2SecList = com2SecListLast = NULL;
+}
+
+
+void
+netsnmp_udp_agent_config_tokens_register(void)
+{
+    register_app_config_handler("com2sec", netsnmp_udp_parse_security,
+                                netsnmp_udp_com2SecList_free,
+                                "name IPv4-network-address[/netmask] community");
+}
+
+
+
+/*
+ * Return 0 if there are no com2sec entries, or return 1 if there ARE com2sec 
+ * entries.  On return, if a com2sec entry matched the passed parameters,
+ * then *secName points at the appropriate security name, or is NULL if the
+ * parameters did not match any com2sec entry.  
+ */
+
+int
+netsnmp_udp_getSecName(void *opaque, int olength,
+                       const char *community,
+                       size_t community_len, char **secName)
+{
+    com2SecEntry   *c;
+    struct sockaddr_in *from = (struct sockaddr_in *) opaque;
+    char           *ztcommunity = NULL;
+
+    /*
+     * Special case if there are NO entries (as opposed to no MATCHING
+     * entries).  
+     */
+
+    if (com2SecList == NULL) {
+        DEBUGMSGTL(("netsnmp_udp_getSecName", "no com2sec entries\n"));
+        if (secName != NULL) {
+            *secName = NULL;
+        }
+        return 0;
+    }
+
+    /*
+     * If there is no IPv4 source address, then there can be no valid security
+     * name.  
+     */
+
+    if (opaque == NULL || olength != sizeof(struct sockaddr_in) ||
+        from->sin_family != AF_INET) {
+        DEBUGMSGTL(("netsnmp_udp_getSecName",
+		    "no IPv4 source address in PDU?\n"));
+        if (secName != NULL) {
+            *secName = NULL;
+        }
+        return 1;
+    }
+
+    DEBUGIF("netsnmp_udp_getSecName") {
+	ztcommunity = (char *)malloc(community_len + 1);
+	if (ztcommunity != NULL) {
+	    memcpy(ztcommunity, community, community_len);
+	    ztcommunity[community_len] = '\0';
+	}
+
+	DEBUGMSGTL(("netsnmp_udp_getSecName", "resolve <\"%s\", 0x%08x>\n",
+		    ztcommunity ? ztcommunity : "<malloc error>",
+		    from->sin_addr.s_addr));
+    }
+
+    for (c = com2SecList; c != NULL; c = c->next) {
+        DEBUGMSGTL(("netsnmp_udp_getSecName","compare <\"%s\", 0x%08x/0x%08x>",
+		    c->community, c->network, c->mask));
+        if ((community_len == strlen(c->community)) &&
+	    (memcmp(community, c->community, community_len) == 0) &&
+            ((from->sin_addr.s_addr & c->mask) == c->network)) {
+            DEBUGMSG(("netsnmp_udp_getSecName", "... SUCCESS\n"));
+            if (secName != NULL) {
+                *secName = c->secName;
+            }
+            break;
+        }
+        DEBUGMSG(("netsnmp_udp_getSecName", "... nope\n"));
+    }
+    if (ztcommunity != NULL) {
+        free(ztcommunity);
+    }
+    return 1;
+}
+
+
+
+netsnmp_transport *
+netsnmp_udp_create_tstring(const char *string, int local)
+{
+    struct sockaddr_in addr;
+
+    if (netsnmp_sockaddr_in(&addr, string, 0)) {
+        return netsnmp_udp_transport(&addr, local);
+    } else {
+        return NULL;
+    }
+}
+
+
+netsnmp_transport *
+netsnmp_udp_create_ostring(const u_char * o, size_t o_len, int local)
+{
+    struct sockaddr_in addr;
+
+    if (o_len == 6) {
+        addr.sin_family = AF_INET;
+        memcpy((u_char *) & (addr.sin_addr.s_addr), o, 4);
+        addr.sin_port = ntohs((o[4] << 8) + o[5]);
+        return netsnmp_udp_transport(&addr, local);
+    }
+    return NULL;
+}
+
+
+void
+netsnmp_udp_ctor(void)
+{
+    udpDomain.name = netsnmpUDPDomain;
+    udpDomain.name_length = netsnmpUDPDomain_len;
+    udpDomain.prefix = calloc(2, sizeof(char *));
+    udpDomain.prefix[0] = "udp";
+
+    udpDomain.f_create_from_tstring = netsnmp_udp_create_tstring;
+    udpDomain.f_create_from_ostring = netsnmp_udp_create_ostring;
+
+    netsnmp_tdomain_register(&udpDomain);
+}
diff -Naur tomato/release/src/router/snmp/snmplib/snmpUDPIPv6Domain.c tomato121/release/src/router/snmp/snmplib/snmpUDPIPv6Domain.c
--- tomato/release/src/router/snmp/snmplib/snmpUDPIPv6Domain.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/snmplib/snmpUDPIPv6Domain.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,1265 @@
+#include <net-snmp/net-snmp-config.h>
+
+#include <stdio.h>
+#include <sys/types.h>
+#include <ctype.h>
+#include <errno.h>
+
+#if HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+#if HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#if HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#if HAVE_SYS_SOCKET_H
+#include <sys/socket.h>
+#endif
+#if HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+#if HAVE_ARPA_INET_H
+#include <arpa/inet.h>
+#endif
+#if HAVE_NETDB_H
+#include <netdb.h>
+#endif
+#if HAVE_NET_IF_H
+#include <net/if.h>
+#endif
+
+#if HAVE_DMALLOC_H
+#include <dmalloc.h>
+#endif
+
+#include <net-snmp/types.h>
+#include <net-snmp/output_api.h>
+#include <net-snmp/config_api.h>
+
+#include <net-snmp/library/snmp_transport.h>
+#include <net-snmp/library/snmpUDPIPv6Domain.h>
+
+oid netsnmp_UDPIPv6Domain[10] = { ENTERPRISE_MIB, 3, 3, 4 };
+static netsnmp_tdomain udp6Domain;
+
+/*
+ * Return a string representing the address in data, or else the "far end"
+ * address if data is NULL.  
+ */
+
+static char *
+netsnmp_udp6_fmtaddr(netsnmp_transport *t, void *data, int len)
+{
+    struct sockaddr_in6 *to = NULL;
+
+    DEBUGMSGTL(("netsnmp_udp6", "fmtaddr: t = %p, data = %p, len = %d\n", t,
+                data, len));
+    if (data != NULL && len == sizeof(struct sockaddr_in6)) {
+        to = (struct sockaddr_in6 *) data;
+    } else if (t != NULL && t->data != NULL) {
+        to = (struct sockaddr_in6 *) t->data;
+    }
+    if (to == NULL) {
+        return strdup("UDP/IPv6: unknown");
+    } else {
+        char addr[INET6_ADDRSTRLEN];
+        char tmp[INET6_ADDRSTRLEN + 8];
+
+        sprintf(tmp, "[%s]:%hd",
+                inet_ntop(AF_INET6, (void *) &(to->sin6_addr), addr,
+                          INET6_ADDRSTRLEN), ntohs(to->sin6_port));
+        return strdup(tmp);
+    }
+}
+
+
+
+/*
+ * You can write something into opaque that will subsequently get passed back 
+ * to your send function if you like.  For instance, you might want to
+ * remember where a PDU came from, so that you can send a reply there...  
+ */
+
+static int
+netsnmp_udp6_recv(netsnmp_transport *t, void *buf, int size,
+		  void **opaque, int *olength)
+{
+    int             rc = -1;
+    socklen_t       fromlen = sizeof(struct sockaddr_in6);
+    struct sockaddr *from;
+
+    if (t != NULL && t->sock >= 0) {
+        from = (struct sockaddr *) malloc(sizeof(struct sockaddr_in6));
+        if (from == NULL) {
+            *opaque = NULL;
+            *olength = 0;
+            return -1;
+        } else {
+            memset(from, 0, fromlen);
+        }
+
+	while (rc < 0) {
+	  rc = recvfrom(t->sock, buf, size, 0, from, &fromlen);
+	  if (rc < 0 && errno != EINTR) {
+	    break;
+	  }
+	}
+
+        if (rc >= 0) {
+	    char *string = netsnmp_udp6_fmtaddr(NULL, from, fromlen);
+            DEBUGMSGTL(("netsnmp_udp6",
+			"recvfrom fd %d got %d bytes (from %s)\n", t->sock,
+                        rc, string));
+            free(string);
+        } else {
+            DEBUGMSGTL(("netsnmp_udp6", "recvfrom fd %d err %d (\"%s\")\n",
+			t->sock, errno, strerror(errno)));
+        }
+        *opaque = (void *) from;
+        *olength = sizeof(struct sockaddr_in6);
+    }
+    return rc;
+}
+
+
+
+static int
+netsnmp_udp6_send(netsnmp_transport *t, void *buf, int size,
+		  void **opaque, int *olength)
+{
+    int rc = -1;
+    struct sockaddr *to = NULL;
+
+    if (opaque != NULL && *opaque != NULL &&
+        *olength == sizeof(struct sockaddr_in6)) {
+        to = (struct sockaddr *) (*opaque);
+    } else if (t != NULL && t->data != NULL &&
+               t->data_length == sizeof(struct sockaddr_in6)) {
+        to = (struct sockaddr *) (t->data);
+    }
+
+    if (to != NULL && t != NULL && t->sock >= 0) {
+        char *string = netsnmp_udp6_fmtaddr(NULL, (void *)to,
+					    sizeof(struct sockaddr_in6));
+        DEBUGMSGTL(("netsnmp_udp6", "send %d bytes from %p to %s on fd %d\n",
+                    size, buf, string, t->sock));
+        free(string);
+	while (rc < 0) {
+	    rc = sendto(t->sock, buf, size, 0, to,sizeof(struct sockaddr_in6));
+	    if (rc < 0 && errno != EINTR) {
+		break;
+	    }
+	}
+    }
+    return rc;
+}
+
+
+
+static int
+netsnmp_udp6_close(netsnmp_transport *t)
+{
+    int rc = -1;
+    if (t != NULL && t->sock >= 0) {
+        DEBUGMSGTL(("netsnmp_udp6", "close fd %d\n", t->sock));
+#ifndef HAVE_CLOSESOCKET
+        rc = close(t->sock);
+#else
+        rc = closesocket(t->sock);
+#endif
+        t->sock = -1;
+    }
+    return rc;
+}
+
+
+
+/*
+ * Open a UDP/IPv6-based transport for SNMP.  Local is TRUE if addr is the
+ * local address to bind to (i.e. this is a server-type session); otherwise
+ * addr is the remote address to send things to.  
+ */
+
+netsnmp_transport *
+netsnmp_udp6_transport(struct sockaddr_in6 *addr, int local)
+{
+    netsnmp_transport *t = NULL;
+    int             rc = 0, udpbuf = (1 << 17);
+    char           *string = NULL;
+
+    if (addr == NULL || addr->sin6_family != AF_INET6) {
+        return NULL;
+    }
+
+    t = (netsnmp_transport *) malloc(sizeof(netsnmp_transport));
+    if (t == NULL) {
+        return NULL;
+    }
+
+    string = netsnmp_udp6_fmtaddr(NULL, (void *) addr,
+				  sizeof(struct sockaddr_in6));
+    DEBUGMSGTL(("netsnmp_udp6", "open %s %s\n", local ? "local" : "remote",
+                string));
+    free(string);
+
+    memset(t, 0, sizeof(netsnmp_transport));
+
+    t->domain = netsnmp_UDPIPv6Domain;
+    t->domain_length =
+        sizeof(netsnmp_UDPIPv6Domain) / sizeof(netsnmp_UDPIPv6Domain[0]);
+
+    t->sock = socket(PF_INET6, SOCK_DGRAM, 0);
+    if (t->sock < 0) {
+        netsnmp_transport_free(t);
+        return NULL;
+    }
+#ifdef  SO_BSDCOMPAT
+    /*
+     * Patch for Linux.  Without this, UDP packets that fail get an ICMP
+     * response.  Linux turns the failed ICMP response into an error message
+     * and return value, unlike all other OS's.  
+     */
+    {
+        int             one = 1;
+        setsockopt(t->sock, SOL_SOCKET, SO_BSDCOMPAT, &one, sizeof(one));
+    }
+#endif                          /*SO_BSDCOMPAT */
+
+    /*
+     * Try to set the send and receive buffers to a reasonably large value, so
+     * that we can send and receive big PDUs (defaults to 8192 bytes (!) on
+     * Solaris, for instance).  Don't worry too much about errors -- just
+     * plough on regardless.  
+     */
+
+#ifdef  SO_SNDBUF
+    if (setsockopt(t->sock, SOL_SOCKET, SO_SNDBUF, &udpbuf, sizeof(int)) != 0){
+        DEBUGMSGTL(("netsnmp_udp6", "couldn't set SO_SNDBUF to %d bytes: %s\n",
+		    udpbuf, strerror(errno)));
+    }
+#endif                          /*SO_SNDBUF */
+
+#ifdef  SO_RCVBUF
+    if (setsockopt(t->sock, SOL_SOCKET, SO_RCVBUF, &udpbuf, sizeof(int)) != 0){
+        DEBUGMSGTL(("netsnmp_udp6", "couldn't set SO_RCVBUF to %d bytes: %s\n",
+		    udpbuf, strerror(errno)));
+    }
+#endif                          /*SO_RCVBUF */
+
+    if (local) {
+        /*
+         * This session is inteneded as a server, so we must bind on to the
+         * given IP address, which may include an interface address, or could
+         * be INADDR_ANY, but certainly includes a port number.
+         */
+
+#ifdef IPV6_V6ONLY
+        /* Try to restrict PF_INET6 socket to IPv6 communications only. */
+        {
+	  int one=1;
+	  if (setsockopt(t->sock, IPPROTO_IPV6, IPV6_V6ONLY, (char *)&one, sizeof(one)) != 0) {
+	    DEBUGMSGTL(("netsnmp_udp6", "couldn't set IPV6_V6ONLY to %d bytes: %s\n", one, strerror(errno)));
+	  } 
+	}
+#endif
+
+        rc = bind(t->sock, (struct sockaddr *) addr,
+		  sizeof(struct sockaddr_in6));
+        if (rc != 0) {
+            netsnmp_udp6_close(t);
+            netsnmp_transport_free(t);
+            return NULL;
+        }
+        t->local = malloc(18);
+        if (t->local == NULL) {
+            netsnmp_udp6_close(t);
+            netsnmp_transport_free(t);
+        }
+        memcpy(t->local, addr->sin6_addr.s6_addr, 16);
+        t->local[16] = (addr->sin6_port & 0xff00) >> 8;
+        t->local[17] = (addr->sin6_port & 0x00ff) >> 0;
+        t->local_length = 18;
+        t->data = NULL;
+        t->data_length = 0;
+    } else {
+        /*
+         * This is a client session.  Save the address in the
+         * transport-specific data pointer for later use by netsnmp_udp6_send.
+         */
+
+        t->data = malloc(sizeof(struct sockaddr_in6));
+        if (t->data == NULL) {
+            netsnmp_transport_free(t);
+            return NULL;
+        }
+        memcpy(t->data, addr, sizeof(struct sockaddr_in6));
+        t->data_length = sizeof(struct sockaddr_in6);
+        t->remote = malloc(18);
+        if (t->remote == NULL) {
+            netsnmp_udp6_close(t);
+            netsnmp_transport_free(t);
+            return NULL;
+        }
+        memcpy(t->remote, addr->sin6_addr.s6_addr, 16);
+        t->remote[16] = (addr->sin6_port & 0xff00) >> 8;
+        t->remote[17] = (addr->sin6_port & 0x00ff) >> 0;
+        t->remote_length = 18;
+    }
+
+    /*
+     * 16-bit length field, 8 byte UDP header, 40 byte IPv6 header.  
+     */
+
+    t->msgMaxSize = 0xffff - 8 - 40;
+    t->f_recv     = netsnmp_udp6_recv;
+    t->f_send     = netsnmp_udp6_send;
+    t->f_close    = netsnmp_udp6_close;
+    t->f_accept   = NULL;
+    t->f_fmtaddr  = netsnmp_udp6_fmtaddr;
+
+    return t;
+}
+
+
+
+int
+netsnmp_sockaddr_in6(struct sockaddr_in6 *addr,
+                     const char *inpeername, int remote_port)
+{
+    char           *cp = NULL, *peername = NULL;
+    char            debug_addr[INET6_ADDRSTRLEN];
+#if HAVE_GETADDRINFO
+    struct addrinfo *addrs = NULL;
+    struct addrinfo hint;
+    int             err;
+#elif HAVE_GETIPNODEBYNAME
+    struct hostent *hp = NULL;
+    int             err;
+#elif HAVE_GETHOSTBYNAME
+    struct hostent *hp = NULL;
+#endif
+
+    if (addr == NULL) {
+        return 0;
+    }
+
+    DEBUGMSGTL(("netsnmp_sockaddr_in6", "addr %p, peername \"%s\"\n",
+                addr, inpeername ? inpeername : "[NIL]"));
+
+    memset(addr, 0, sizeof(struct sockaddr_in6));
+    addr->sin6_family = AF_INET6;
+    addr->sin6_addr = in6addr_any;
+
+    if (remote_port > 0) {
+        addr->sin6_port = htons(remote_port);
+    } else if (netsnmp_ds_get_int(NETSNMP_DS_LIBRARY_ID, 
+				  NETSNMP_DS_LIB_DEFAULT_PORT) > 0) {
+        addr->sin6_port = htons(netsnmp_ds_get_int(NETSNMP_DS_LIBRARY_ID, 
+						 NETSNMP_DS_LIB_DEFAULT_PORT));
+    } else {
+        addr->sin6_port = htons(SNMP_PORT);
+    }
+
+    if (inpeername != NULL) {
+        /*
+         * Duplicate the peername because we might want to mank around with
+         * it.  
+         */
+
+        peername = strdup(inpeername);
+        if (peername == NULL) {
+            return 0;
+        }
+
+        for (cp = peername; *cp && isdigit((int) *cp); cp++);
+        if (!*cp && atoi(peername) != 0) {
+            /*
+             * Okay, it looks like JUST a port number.  
+             */
+            DEBUGMSGTL(("netsnmp_sockaddr_in6", "totally numeric: %d\n",
+                        atoi(peername)));
+            addr->sin6_port = htons(atoi(peername));
+            goto resolved;
+        }
+
+        /*
+         * See if it is an IPv6 address, which covered with square brankets
+         * with an appended :port.  
+         */
+        if (*peername == '[') {
+            cp = strchr(peername, ']');
+            if (cp != NULL) {
+	      /*
+	       * See if it is an IPv6 link-local address with interface
+	       * name as <zone_id>, like fe80::1234%eth0.
+	       * Please refer to the internet draft, IPv6 Scoped Address Architecture
+	       * http://www.ietf.org/internet-drafts/draft-ietf-ipngwg-scoping-arch-04.txt
+	       *
+	       */
+	        char *scope_id;
+		unsigned int if_index = 0;
+                *cp = '\0';
+		scope_id = strchr(peername + 1, '%');
+		if (scope_id != NULL) {
+		    *scope_id = '\0';
+		    if_index = if_nametoindex(scope_id + 1);
+		}
+                if (*(cp + 1) == ':') {
+                    if (atoi(cp + 2) != 0 &&
+                        inet_pton(AF_INET6, peername + 1,
+                                  (void *) &(addr->sin6_addr))) {
+                        DEBUGMSGTL(("netsnmp_sockaddr_in6",
+                                    "IPv6 address with port suffix :%d\n",
+                                    atoi(cp + 2)));
+                        addr->sin6_port = htons(atoi(cp + 2));
+			addr->sin6_scope_id = if_index;
+                        goto resolved;
+                    }
+                } else {
+                    if (inet_pton
+                        (AF_INET6, peername + 1,
+                         (void *) &(addr->sin6_addr))) {
+                        DEBUGMSGTL(("netsnmp_sockaddr_in6",
+                                    "IPv6 address with square brankets\n"));
+                        addr->sin6_port = htons(SNMP_PORT);
+			addr->sin6_scope_id = if_index;
+                        goto resolved;
+                    }
+                }
+		if (scope_id != NULL) {
+		  *scope_id = '%';
+		}
+		*cp = ']';
+            }
+        }
+
+        cp = strrchr(peername, ':');
+        if (cp != NULL) {
+	    char *scope_id;
+	    unsigned int if_index = 0;
+            *cp = '\0';
+	    scope_id = strchr(peername + 1, '%');
+	    if (scope_id != NULL) {
+	      *scope_id = '\0';
+	      if_index = if_nametoindex(scope_id + 1);
+	    }
+            if (atoi(cp + 1) != 0 &&
+                inet_pton(AF_INET6, peername,
+                          (void *) &(addr->sin6_addr))) {
+                DEBUGMSGTL(("netsnmp_sockaddr_in6",
+                            "IPv6 address with port suffix :%d\n",
+                            atoi(cp + 1)));
+                addr->sin6_port = htons(atoi(cp + 1));
+		addr->sin6_scope_id = if_index;
+                goto resolved;
+            }
+	    if (scope_id != NULL) {
+	      *scope_id = '%';
+	    }
+            *cp = ':';
+        }
+
+        /*
+         * See if it is JUST an IPv6 address.  
+         */
+        if (inet_pton(AF_INET6, peername, (void *) &(addr->sin6_addr))) {
+            DEBUGMSGTL(("netsnmp_sockaddr_in6", "just IPv6 address\n"));
+            goto resolved;
+        }
+
+        /*
+         * Well, it must be a hostname then, possibly with an appended :port.
+         * Sort that out first.  
+         */
+
+        cp = strrchr(peername, ':');
+        if (cp != NULL) {
+            *cp = '\0';
+            if (atoi(cp + 1) != 0) {
+                DEBUGMSGTL(("netsnmp_sockaddr_in6",
+                            "hostname(?) with port suffix :%d\n",
+                            atoi(cp + 1)));
+                addr->sin6_port = htons(atoi(cp + 1));
+            } else {
+                /*
+                 * No idea, looks bogus but we might as well pass the full thing to
+                 * the name resolver below.  
+                 */
+                *cp = ':';
+                DEBUGMSGTL(("netsnmp_sockaddr_in6",
+                            "hostname(?) with embedded ':'?\n"));
+            }
+            /*
+             * Fall through.  
+             */
+        }
+#if HAVE_GETADDRINFO
+        memset(&hint, 0, sizeof hint);
+        hint.ai_flags = 0;
+        hint.ai_family = PF_INET6;
+        hint.ai_socktype = SOCK_DGRAM;
+        hint.ai_protocol = 0;
+
+        err = getaddrinfo(peername, NULL, &hint, &addrs);
+        if (err != 0) {
+            snmp_log(LOG_ERR, "getaddrinfo: %s %s\n", peername,
+                     gai_strerror(err));
+            free(peername);
+            return 0;
+        }
+        DEBUGMSGTL(("netsnmp_sockaddr_in6", "hostname (resolved okay)\n"));
+        memcpy(&addr->sin6_addr,
+               &((struct sockaddr_in6 *) addrs->ai_addr)->sin6_addr,
+               sizeof(struct in6_addr));
+#elif HAVE_GETIPNODEBYNAME
+        hp = getipnodebyname(peername, AF_INET6, 0, &err);
+        if (hp == NULL) {
+            DEBUGMSGTL(("netsnmp_sockaddr_in6",
+                        "hostname (couldn't resolve = %d)\n", err));
+            free(peername);
+            return 0;
+        }
+        DEBUGMSGTL(("netsnmp_sockaddr_in6", "hostname (resolved okay)\n"));
+        memcpy(&(addr->sin6_addr), hp->h_addr, hp->h_length);
+#elif HAVE_GETHOSTBYNAME
+        hp = gethostbyname(peername);
+        if (hp == NULL) {
+            DEBUGMSGTL(("netsnmp_sockaddr_in6",
+                        "hostname (couldn't resolve)\n"));
+            free(peername);
+            return 0;
+        } else {
+            if (hp->h_addrtype != AF_INET6) {
+                DEBUGMSGTL(("netsnmp_sockaddr_in6",
+                            "hostname (not AF_INET6!)\n"));
+                free(peername);
+                return 0;
+            } else {
+                DEBUGMSGTL(("netsnmp_sockaddr_in6",
+                            "hostname (resolved okay)\n"));
+                memcpy(&(addr->sin6_addr), hp->h_addr, hp->h_length);
+            }
+        }
+#else                           /*HAVE_GETHOSTBYNAME */
+        /*
+         * There is no name resolving function available.  
+         */
+        snmp_log(LOG_ERR,
+                 "no getaddrinfo()/getipnodebyname()/gethostbyname()\n");
+        free(peername);
+        return 0;
+#endif                          /*HAVE_GETHOSTBYNAME */
+    } else {
+        DEBUGMSGTL(("netsnmp_sockaddr_in6", "NULL peername"));
+        return 0;
+    }
+
+  resolved:
+    DEBUGMSGTL(("netsnmp_sockaddr_in6", "return { AF_INET6, [%s]:%hu }\n",
+                inet_ntop(AF_INET6, &addr->sin6_addr, debug_addr,
+                          sizeof(debug_addr)), ntohs(addr->sin6_port)));
+    free(peername);
+    return 1;
+}
+
+
+/*
+ * int
+ * inet_make_mask_addr( int pf, void *dst, int masklength )
+ *      convert from bit length specified masklength to network format, 
+ *      which fills 1 from until specified bit length.
+ *      dst is usally the structer of sockaddr_in or sockaddr_in6. 
+ *      makelength must be an interger from 0 to 32 if pf is PF_INET,
+ *      or from 0 to 128 if pf is PF_INET6.
+ * return:
+ *      0 if the input data, masklength was valid for 
+ *      the specified protocol family.
+ *      -1 if the the input data wasn't valid.
+ */
+
+int
+inet_make_mask_addr(int pf, void *dst, int masklength)
+{
+
+    unsigned long   Mask = 0;
+    int             maskBit = 0x80000000L;
+    unsigned char   mask = 0;
+    unsigned char   maskbit = 0x80L;
+    int             i, j, jj;
+
+
+    switch (pf) {
+    case PF_INET:
+        if (masklength < 0 || masklength > 32)
+            return -1;
+
+        ((struct in_addr *) dst)->s_addr = 0;
+
+        while (masklength--) {
+            Mask |= maskBit;
+            maskBit >>= 1;
+        }
+        ((struct in_addr *) dst)->s_addr = htonl(Mask);
+        break;
+
+    case PF_INET6:
+        if (masklength < 0 || masklength > 128)
+            return -1;
+
+
+        for (i = 0; i < 16; i++) {
+            (*(uint8_t *) (&((struct in6_addr *) dst)->s6_addr[i])) = 0x00;
+        }
+
+        j = (int) masklength / 8;
+        jj = masklength % 8;
+
+        for (i = 0; i < j; i++) {
+            (*(uint8_t *) (&((struct in6_addr *) dst)->s6_addr[i])) = 0xff;
+        }
+        while (jj--) {
+            mask |= maskbit;
+            maskbit >>= 1;
+        }
+        (*(uint8_t *) (&((struct in6_addr *) dst)->s6_addr[j])) = mask;
+        break;
+    default:
+        return -1;              /* unsupported protocol family */
+    }
+    return 0;
+}
+
+/*
+ * int
+ * inet_addr_complement( int pf, void *src, void *dst )
+ *      convert from src to dst, which all bits 
+ *      are bit-compliment of src.
+ *      Src, dst are ususally sockaddr_in or sockaddr_in6.  
+ * return:
+ *      0 if the input data src and dst have the same size
+ *      -1 if the the input data wasn't valid.
+ */
+
+int
+inet_addr_complement(int pf, void *src, void *dst)
+{
+
+    int             i;
+
+    if (sizeof(src) != sizeof(dst))
+        return -1;
+
+    switch (pf) {
+    case PF_INET:
+        ((struct in_addr *) dst)->s_addr =
+            ~((struct in_addr *) src)->s_addr;
+        break;
+    case PF_INET6:
+        for (i = 0; i < 16; i++) {
+            (*(uint8_t *) (&((struct in6_addr *) dst)->s6_addr[i])) =
+                (~(*(uint8_t *) (&((struct in6_addr *) src)->s6_addr[i])))
+                & 0xff;
+        }
+        break;
+    default:
+        return -1;
+    }
+    return 0;
+}
+
+/*
+ * int
+ * inet_addr_and( int pf, void *src1, void *src2, void *dst) 
+ *      take AND operation on src1 and src2, and output the result to dst.
+ *      Src1, src2, and dst are ususally sockaddr_in or sockaddr_in6.  
+ * return:
+ *      0 if the input data src and dst have the same size
+ *      -1 if the the input data are not the same size
+ */
+
+int
+inet_addr_and(int pf, void *src1, void *src2, void *dst)
+{
+    int             i;
+
+    if (sizeof(src1) != sizeof(src2) || sizeof(src2) != sizeof(dst))
+        return -1;
+
+    switch (pf) {
+    case PF_INET:
+        ((struct in_addr *) dst)->s_addr =
+            ((struct in_addr *) src1)->s_addr & ((struct in_addr *) src2)->
+            s_addr;
+        break;
+
+    case PF_INET6:
+        for (i = 0; i < 16; i++) {
+            (*(uint8_t *) (&((struct in6_addr *) dst)->s6_addr[i])) =
+                (*(uint8_t *) (&((struct in6_addr *) src1)->s6_addr[i])) &
+                (*(uint8_t *) (&((struct in6_addr *) src2)->s6_addr[i]));
+        }
+        break;
+    default:
+        return -1;
+    }
+    return 0;
+}
+
+
+/*
+ * int
+ * inet_addrs_consistence (int pf, void *net, void *mask ) 
+ *      This function checks if the network address net is consistent
+ *      with the netmask address, mask.
+ *      Net and mask are ususally sockaddr_in or sockaddr_in6.  
+ * Note:
+ *      Must spefiey protocol family in pf.
+ * return:
+ *      0 if there is no consistence with address "net" and "mask".
+ *      -1 if network address is inconsistent with netmask address, for 
+ *      instance, network address is 192.168.0.128 in spite of netmask, 
+ *      which is 255.255.255.0. 
+ *      The case that the size of net and mask are different also returns -1.
+ */
+
+int
+inet_addrs_consistence(int pf, void *net, void *mask)
+{
+    struct sockaddr_in *tmp, *dst;
+    struct sockaddr_in6 *tmp6, *dst6;
+    int             ret;
+
+    switch (pf) {
+    case PF_INET:
+        tmp = (struct sockaddr_in *) malloc(sizeof(struct sockaddr_in));
+        memset(tmp, 0, sizeof(*tmp));
+        tmp->sin_family = PF_INET;
+        if (inet_addr_complement
+            (PF_INET, (struct in_addr *) mask, &tmp->sin_addr) != 0) {
+            config_perror("Fail in function of inet_addr_complement()");
+            free(tmp);
+            return -1;
+        }
+        dst = (struct sockaddr_in *) malloc(sizeof(struct sockaddr_in));
+        memset(dst, 0, sizeof(*dst));
+        dst->sin_family = PF_INET;
+        if (inet_addr_and
+            (PF_INET, (struct in_addr *) net, &tmp->sin_addr,
+             &dst->sin_addr) != 0) {
+            config_perror("Fail in function of inet_addr_and()");
+            free(dst);
+            free(tmp);
+            return -1;
+        }
+        ret = ((dst->sin_addr.s_addr == INADDR_ANY) ? 0 : -1);
+        free(dst);
+        free(tmp);
+        break;
+    case PF_INET6:
+        tmp6 = (struct sockaddr_in6 *) malloc(sizeof(struct sockaddr_in6));
+        memset(tmp6, 0, sizeof(*tmp6));
+        tmp6->sin6_family = PF_INET6;
+        if (inet_addr_complement
+            (PF_INET6, (struct in6_addr *) mask, &tmp6->sin6_addr) != 0) {
+            config_perror("Fail in function of inet_addr_complement()");
+            free(tmp6);
+            return -1;
+        }
+        dst6 = (struct sockaddr_in6 *) malloc(sizeof(struct sockaddr_in6));
+        memset(dst6, 0, sizeof(*dst6));
+        dst6->sin6_family = PF_INET6;
+        if (inet_addr_and
+            (PF_INET6, (struct in6_addr *) net, &tmp6->sin6_addr,
+             &dst6->sin6_addr)) {
+            config_perror("Fail in function of inet_addr_and()");
+            free(dst6);
+            free(tmp6);
+            return -1;
+        }
+        ret = (IN6_IS_ADDR_UNSPECIFIED(&dst6->sin6_addr) == 1 ? 0 : -1);
+        free(dst6);
+        free(tmp6);
+        break;
+    default:
+        return -1;
+    }
+    return ret;
+}
+
+/*
+ * int
+ * masked_address_are_equal (pf, from, mask, network) 
+ *      This function takes AND operation on address "from" and "mask",
+ *      and check the result is equal to address "network". 
+ *      From, net and mask are ususally sockaddr_in or sockaddr_in6.  
+ * Note:
+ *      Must spefiey protocol family in pf.
+ * return:
+ *      0 if address "from" masked by address "mask" is eqaul to 
+ *      address "network". 
+ *      -1 if address "from" masked by address "mask" isn't eqaul to 
+ *      address "network". For instance, address "from" is 
+ *       192.168.0.129 and "mask" is 255.255.255.128. Then, masked 
+ *      address is 192.168.0.128. If address "network" is 192.168.0.128,
+ *      return 0, otherwise -1.
+ *      Also retunn -1 if each address family of from, mask, network
+ *      isn't the same.
+ */
+
+int
+masked_address_are_equal(int af, struct sockaddr_storage *from,
+                         struct sockaddr_storage *mask,
+                         struct sockaddr_storage *network)
+{
+
+    struct sockaddr_storage ss;
+    memset(&ss, 0, sizeof(ss));
+
+    switch (af) {
+    case PF_INET:
+        if (mask->ss_family != PF_INET || network->ss_family != PF_INET) {
+            return -1;
+        }
+        ss.ss_family = PF_INET;
+        inet_addr_and(PF_INET,
+                      &((struct sockaddr_in *) from)->sin_addr,
+                      &((struct sockaddr_in *) mask)->sin_addr,
+                      &((struct sockaddr_in *) &ss)->sin_addr);
+        if (((struct sockaddr_in *) &ss)->sin_addr.s_addr ==
+            ((struct sockaddr_in *) network)->sin_addr.s_addr) {
+            return 0;
+        } else {
+            return -1;
+        }
+        break;
+    case PF_INET6:
+        if (mask->ss_family != PF_INET6 || network->ss_family != PF_INET6) {
+            return -1;
+        }
+        ss.ss_family = PF_INET6;
+        inet_addr_and(PF_INET6,
+                      &((struct sockaddr_in6 *) from)->sin6_addr,
+                      &((struct sockaddr_in6 *) mask)->sin6_addr,
+                      &((struct sockaddr_in6 *) &ss)->sin6_addr);
+        if (IN6_ARE_ADDR_EQUAL(&((struct sockaddr_in6 *) &ss)->sin6_addr,
+                               &((struct sockaddr_in6 *) network)->
+                               sin6_addr) == 1) {
+            return 0;
+        } else {
+            return -1;
+        }
+        break;
+    default:
+        return -1;
+    }
+}
+
+/*
+ * The following functions provide the "com2sec6" configuration token
+ * functionality for compatibility.  
+ */
+
+#define EXAMPLE_NETWORK       "NETWORK"
+#define EXAMPLE_COMMUNITY     "COMMUNITY"
+
+typedef struct _com2Sec6Entry {
+    char            community[VACMSTRINGLEN];
+    struct sockaddr_in6 network;
+    struct sockaddr_in6 mask;
+    char            secName[VACMSTRINGLEN];
+    struct _com2Sec6Entry *next;
+} com2Sec6Entry;
+
+com2Sec6Entry  *com2Sec6List = NULL, *com2Sec6ListLast = NULL;
+
+
+void
+memmove_com2Sec6Entry(com2Sec6Entry * c,
+                      char *secName,
+                      char *community,
+                      struct sockaddr_in6 net, struct sockaddr_in6 mask)
+{
+    snprintf(c->secName, strlen(secName) + 1, "%s", secName);
+    snprintf(c->community, strlen(community) + 1, "%s", community);
+    memmove(&c->network, &net, sizeof(net));
+    memmove(&c->mask, &mask, sizeof(mask));
+    c->next = NULL;
+}
+
+
+void
+netsnmp_udp6_parse_security(const char *token, char *param)
+{
+    char           *secName = NULL, *community = NULL, *source = NULL;
+    char           *cp = NULL, *strnetwork = NULL, *strmask = NULL;
+    com2Sec6Entry  *e = NULL;
+    struct sockaddr_in6 net, mask;
+    struct sockaddr_in tmp;
+
+    memset(&net, 0, sizeof(net));
+    memset(&mask, 0, sizeof(mask));
+    memset(&tmp, 0, sizeof(tmp));
+    net.sin6_family = AF_INET6;
+    mask.sin6_family = AF_INET6;
+    tmp.sin_family = AF_INET;
+
+
+    /*
+     * Get security, source address/netmask and community strings.  
+     */
+    secName = strtok(param, "\t\n ");
+    if (secName == NULL) {
+        config_perror("missing NAME parameter");
+        return;
+    } else if (strlen(secName) > (VACMSTRINGLEN - 1)) {
+        config_perror("security name too long");
+        return;
+    }
+    source = strtok(NULL, "\t\n ");
+    if (source == NULL) {
+        config_perror("missing SOURCE parameter");
+        return;
+    } else if (strncmp(source, EXAMPLE_NETWORK, strlen(EXAMPLE_NETWORK)) ==
+               0) {
+        config_perror("example config NETWORK not properly configured");
+        return;
+    }
+    community = strtok(NULL, "\t\n ");
+    if (community == NULL) {
+        config_perror("missing COMMUNITY parameter\n");
+        return;
+    } else
+        if (strncmp
+            (community, EXAMPLE_COMMUNITY, strlen(EXAMPLE_COMMUNITY))
+            == 0) {
+        config_perror("example config COMMUNITY not properly configured");
+        return;
+    } else if (strlen(community) > (VACMSTRINGLEN - 1)) {
+        config_perror("community name too long");
+        return;
+    }
+
+    /*
+     * Process the source address/netmask string.  
+     */
+    cp = strchr(source, '/');
+    if (cp != NULL) {
+        /*
+         * Mask given.  
+         */
+        *cp = '\0';
+        strmask = cp + 1;
+    }
+
+    /*
+     * Deal with the network part first.  
+     */
+    if ((strcmp(source, "default") == 0) || (strcmp(source, "::") == 0)) {
+        strnetwork = strdup("0::0");
+        strmask = strdup("0::0");
+
+        inet_pton(AF_INET6, strnetwork, &net.sin6_addr);
+        inet_pton(AF_INET6, strmask, &mask.sin6_addr);
+
+        e = (com2Sec6Entry *) malloc(sizeof(com2Sec6Entry));
+        if (e == NULL) {
+            config_perror("memory error");
+            return;
+        }
+        /*
+         * Everything is okay.  Copy the parameters to the structure allocated
+         * above and add it to END of the list.  
+         */
+        if (strmask != NULL && strnetwork != NULL) {
+            DEBUGMSGTL(("netsnmp_udp6_parse_security",
+                        "<\"%s\", %s/%s> => \"%s\"\n", community,
+                        strnetwork, strmask, secName));
+            free(strmask);
+            free(strnetwork);
+        } else {
+            DEBUGMSGTL(("netsnmp_udp6_parse_security",
+                        "Couldn't allocate enough memory\n"));
+        }
+        memmove_com2Sec6Entry(e, secName, community, net, mask);
+        if (com2Sec6ListLast != NULL) {
+            com2Sec6ListLast->next = e;
+            com2Sec6ListLast = e;
+        } else {
+            com2Sec6ListLast = com2Sec6List = e;
+        }
+
+    } else {
+        /*
+         * Try interpreting as IPv6 address.  
+         */
+        if (inet_pton(AF_INET6, source, &net.sin6_addr) == 1) {
+            if (strmask == NULL || *strmask == '\0') {
+                inet_make_mask_addr(PF_INET6, &mask.sin6_addr, 128);
+            } else {
+                if (strchr(strmask, ':')) {
+                    if (inet_pton(PF_INET6, strmask, &net.sin6_addr) != 1) {
+                        config_perror("bad mask");
+                        return;
+                    }
+                } else {
+                    if (inet_make_mask_addr
+                        (PF_INET6, &mask.sin6_addr, atoi(strmask)) != 0) {
+                        config_perror("bad mask");
+                        return;
+
+                    }
+                }
+            }
+            /*
+             * Check that the network and mask are consistent.  
+             */
+            if (inet_addrs_consistence
+                (PF_INET6, &net.sin6_addr, &mask.sin6_addr) != 0) {
+                config_perror("source/mask mismatch");
+                return;
+            }
+
+            e = (com2Sec6Entry *) malloc(sizeof(com2Sec6Entry));
+            if (e == NULL) {
+                config_perror("memory error");
+                return;
+            }
+
+            /*
+             * Everything is okay.  Copy the parameters to the structure allocated
+             * above and add it to END of the list.  
+             */
+            if (strmask != NULL && strnetwork != NULL) {
+                DEBUGMSGTL(("netsnmp_udp6_parse_security",
+                            "<\"%s\", %s/%s> => \"%s\"\n", community,
+                            strnetwork, strmask, secName));
+                free(strmask);
+                free(strnetwork);
+            } else {
+                DEBUGMSGTL(("netsnmp_udp6_parse_security",
+                            "Couldn't allocate enough memory\n"));
+            }
+            memmove_com2Sec6Entry(e, secName, community, net, mask);
+            if (com2Sec6ListLast != NULL) {
+                com2Sec6ListLast->next = e;
+                com2Sec6ListLast = e;
+            } else {
+                com2Sec6ListLast = com2Sec6List = e;
+            }
+
+        } else {
+            /*
+             * Nope, Must be a hostname.  
+             */
+            struct addrinfo hints, *ai, *res;
+            char            hbuf[NI_MAXHOST];
+            int             gai_error;
+
+            memset(&hints, 0, sizeof(hints));
+            hints.ai_family = PF_INET6;
+            hints.ai_socktype = SOCK_DGRAM;
+            if ((gai_error = getaddrinfo(source, NULL, &hints, &res)) != 0) {
+                config_perror(gai_strerror(gai_error));
+                return;
+            }
+
+            for (ai = res; ai != NULL; ai = ai->ai_next) {
+                if (getnameinfo
+                    (ai->ai_addr, ai->ai_addrlen, hbuf, sizeof(hbuf), NULL,
+                     0, NI_NUMERICHOST)) {
+                    config_perror("getnameinfo failed");
+                }
+                memmove(ai->ai_addr, &net, sizeof(struct sockaddr_in6));
+                inet_make_mask_addr(AF_INET6, &mask.sin6_addr, 128);
+
+                e = (com2Sec6Entry *) malloc(sizeof(com2Sec6Entry));
+                if (e == NULL) {
+                    config_perror("memory error");
+                    return;
+                }
+
+                /*
+                 * Everything is okay.  Copy the parameters to the structure allocated
+                 * above and add it to END of the list.  
+                 */
+                DEBUGMSGTL(("netsnmp_udp6_parse_security",
+                            "<\"%s\", %s> => \"%s\"\n", community, hbuf,
+                            secName));
+                memmove_com2Sec6Entry(e, secName, community, net, mask);
+                if (com2Sec6ListLast != NULL) {
+                    com2Sec6ListLast->next = e;
+                    com2Sec6ListLast = e;
+                } else {
+                    com2Sec6ListLast = com2Sec6List = e;
+                }
+            }
+            if (res != NULL)
+                freeaddrinfo(res);
+        }
+        /*
+         * free(strnetwork); 
+         */
+    }
+}
+
+void
+netsnmp_udp6_com2Sec6List_free(void)
+{
+    com2Sec6Entry  *e = com2Sec6List;
+    while (e != NULL) {
+        com2Sec6Entry  *tmp = e;
+        e = e->next;
+        free(tmp);
+    }
+    com2Sec6List = com2Sec6ListLast = NULL;
+}
+
+
+void
+netsnmp_udp6_agent_config_tokens_register(void)
+{
+    register_app_config_handler("com2sec6", netsnmp_udp6_parse_security,
+                                netsnmp_udp6_com2Sec6List_free,
+                                "name IPv6-network-address[/netmask] community");
+}
+
+
+
+/*
+ * Return 0 if there are no com2sec entries, or return 1 if there ARE com2sec 
+ * entries.  On return, if a com2sec entry matched the passed parameters,
+ * then *secName points at the appropriate security name, or is NULL if the
+ * parameters did not match any com2sec entry.  
+ */
+
+int
+netsnmp_udp6_getSecName(void *opaque, int olength,
+                        const char *community,
+                        int community_len, char **secName)
+{
+    com2Sec6Entry  *c;
+    struct sockaddr_in6 *from = (struct sockaddr_in6 *) opaque;
+    char           *ztcommunity = NULL;
+    char            str6[INET6_ADDRSTRLEN];
+
+    /*
+     * Special case if there are NO entries (as opposed to no MATCHING
+     * entries).  
+     */
+
+    if (com2Sec6List == NULL) {
+        DEBUGMSGTL(("netsnmp_udp6_getSecName", "no com2sec entries\n"));
+        if (secName != NULL) {
+            *secName = NULL;
+        }
+        return 0;
+    }
+
+    /*
+     * If there is no IPv6 source address, 
+     * then there can be no valid security name.  
+     */
+
+    if (opaque == NULL || olength != sizeof(struct sockaddr_in6)
+        || from->sin6_family != PF_INET6) {
+        DEBUGMSGTL(("netsnmp_udp6_getSecName",
+                    "no IPv6 source address in PDU?\n"));
+        if (secName != NULL) {
+            *secName = NULL;
+        }
+        return 1;
+    }
+
+    ztcommunity = (char *) malloc(community_len + 1);
+    if (ztcommunity != NULL) {
+        memcpy(ztcommunity, community, community_len);
+        ztcommunity[community_len] = '\0';
+    }
+
+    inet_ntop(AF_INET6, &from->sin6_addr, str6, sizeof(str6));
+    DEBUGMSGTL(("netsnmp_udp6_getSecName", "resolve <\"%s\", %s>\n",
+                ztcommunity ? ztcommunity : "<malloc error>", str6));
+
+    for (c = com2Sec6List; c != NULL; c = c->next) {
+        DEBUGMSGTL(("netsnmp_udp6_getSecName",
+                    "compare <\"%s\", 0x%032/0x%032x>", c->community,
+                    c->network, c->mask));
+
+        if ((community_len == strlen(c->community)) &&
+            (memcmp(community, c->community, community_len) == 0) &&
+            (masked_address_are_equal(from->sin6_family,
+                                      (struct sockaddr_storage *) from,
+                                      (struct sockaddr_storage *) &c->mask,
+                                      (struct sockaddr_storage *) &c->
+                                      network) == 0)) {
+            DEBUGMSG(("netsnmp_udp6_getSecName", "... SUCCESS\n"));
+            if (secName != NULL) {
+                *secName = c->secName;
+            }
+            break;
+        }
+        DEBUGMSG(("netsnmp_udp6_getSecName", "... nope\n"));
+    }
+    if (ztcommunity != NULL) {
+        free(ztcommunity);
+    }
+    return 1;
+}
+
+netsnmp_transport *
+netsnmp_udp6_create_tstring(const char *string, int local)
+{
+    struct sockaddr_in6 addr;
+
+    if (netsnmp_sockaddr_in6(&addr, string, 0)) {
+        return netsnmp_udp6_transport(&addr, local);
+    } else {
+        return NULL;
+    }
+}
+
+
+/*
+ * See:
+ * 
+ * http://www.ietf.org/internet-drafts/draft-ietf-ops-taddress-mib-01.txt
+ * 
+ * (or newer equivalent) for details of the TC which we are using for
+ * the mapping here.  
+ */
+
+netsnmp_transport *
+netsnmp_udp6_create_ostring(const u_char * o, size_t o_len, int local)
+{
+    struct sockaddr_in6 addr;
+
+    if (o_len == 18) {
+        memset((u_char *) & addr, 0, sizeof(struct sockaddr_in6));
+        addr.sin6_family = AF_INET6;
+        memcpy((u_char *) & (addr.sin6_addr.s6_addr), o, 16);
+        addr.sin6_port = (o[16] << 8) + o[17];
+        return netsnmp_udp6_transport(&addr, local);
+    }
+    return NULL;
+}
+
+
+void
+netsnmp_udp6_ctor(void)
+{
+    udp6Domain.name = netsnmp_UDPIPv6Domain;
+    udp6Domain.name_length = sizeof(netsnmp_UDPIPv6Domain) / sizeof(oid);
+    udp6Domain.f_create_from_tstring = netsnmp_udp6_create_tstring;
+    udp6Domain.f_create_from_ostring = netsnmp_udp6_create_ostring;
+    udp6Domain.prefix = calloc(5, sizeof(char *));
+    udp6Domain.prefix[0] = "udp6";
+    udp6Domain.prefix[1] = "ipv6";
+    udp6Domain.prefix[2] = "udpv6";
+    udp6Domain.prefix[3] = "udpipv6";
+
+    netsnmp_tdomain_register(&udp6Domain);
+}
diff -Naur tomato/release/src/router/snmp/snmplib/snmpUnixDomain.c tomato121/release/src/router/snmp/snmplib/snmpUnixDomain.c
--- tomato/release/src/router/snmp/snmplib/snmpUnixDomain.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/snmplib/snmpUnixDomain.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,432 @@
+#include <net-snmp/net-snmp-config.h>
+
+#include <stdio.h>
+#include <sys/types.h>
+#include <ctype.h>
+#include <errno.h>
+
+#if HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+#if HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#if HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#if HAVE_SYS_SOCKET_H
+#include <sys/socket.h>
+#endif
+#if HAVE_SYS_UN_H
+#include <sys/un.h>
+#endif
+
+#if HAVE_DMALLOC_H
+#include <dmalloc.h>
+#endif
+
+#include <net-snmp/types.h>
+#include <net-snmp/output_api.h>
+#include <net-snmp/config_api.h>
+
+#include <net-snmp/library/snmp_transport.h>
+#include <net-snmp/library/snmpUnixDomain.h>
+
+
+#ifndef NETSNMP_STREAM_QUEUE_LEN
+#define NETSNMP_STREAM_QUEUE_LEN  5
+#endif
+
+#ifndef SUN_LEN
+/*
+ * Evaluate to actual length of the `sockaddr_un' structure.  
+ */
+#define SUN_LEN(ptr) ((size_t) (((struct sockaddr_un *) 0)->sun_path)         \
+                      + strlen ((ptr)->sun_path))
+#endif
+
+oid netsnmp_UnixDomain[10] = { ENTERPRISE_MIB, 3, 3, 2 };
+static netsnmp_tdomain unixDomain;
+
+
+/*
+ * This is the structure we use to hold transport-specific data.  
+ */
+
+typedef struct _sockaddr_un_pair {
+    int             local;
+    struct sockaddr_un server;
+    struct sockaddr_un client;
+} sockaddr_un_pair;
+
+
+/*
+ * Return a string representing the address in data, or else the "far end"
+ * address if data is NULL.  
+ */
+
+static char *
+netsnmp_unix_fmtaddr(netsnmp_transport *t, void *data, int len)
+{
+    struct sockaddr_un *to = NULL;
+
+    if (data != NULL) {
+        to = (struct sockaddr_un *) data;
+    } else if (t != NULL && t->data != NULL) {
+        to = &(((sockaddr_un_pair *) t->data)->server);
+        len = SUN_LEN(to);
+    }
+    if (to == NULL) {
+        /*
+         * "Local IPC" is the Posix.1g term for Unix domain protocols,
+         * according to W. R. Stevens, ``Unix Network Programming Volume I
+         * Second Edition'', p. 374.
+         */
+        return strdup("Local IPC: unknown");
+    } else if (to->sun_path[0] == 0) {
+        /*
+         * This is an abstract name.  We could render it as hex or something
+         * but let's not worry about that for now.
+         */
+        return strdup("Local IPC: abstract");
+    } else {
+        char           *tmp = (char *) malloc(16 + len);
+        if (tmp != NULL) {
+            sprintf(tmp, "Local IPC: %s", to->sun_path);
+        }
+        return tmp;
+    }
+}
+
+
+
+/*
+ * You can write something into opaque that will subsequently get passed back 
+ * to your send function if you like.  For instance, you might want to
+ * remember where a PDU came from, so that you can send a reply there...  
+ */
+
+static int
+netsnmp_unix_recv(netsnmp_transport *t, void *buf, int size,
+                  void **opaque, int *olength)
+{
+    int rc = -1;
+
+    *opaque = NULL;
+    *olength = 0;
+    if (t != NULL && t->sock >= 0) {
+	while (rc < 0) {
+	    rc = recv(t->sock, buf, size, 0);
+	    if (rc < 0 && errno != EINTR) {
+		DEBUGMSGTL(("netsnmp_unix", "recv fd %d err %d (\"%s\")\n",
+			    t->sock, errno, strerror(errno)));
+		return rc;
+	    }
+	}
+	DEBUGMSGTL(("netsnmp_unix", "recv fd %d got %d bytes\n", t->sock, rc));
+    }
+    return rc;
+}
+
+
+
+static int
+netsnmp_unix_send(netsnmp_transport *t, void *buf, int size,
+                  void **opaque, int *olength)
+{
+    int rc = -1;
+
+    if (t != NULL && t->sock >= 0) {
+        DEBUGMSGTL(("netsnmp_unix", "send %d bytes from %p on fd %d\n",
+                    size, buf, t->sock));
+	while (rc < 0) {
+	    rc = send(t->sock, buf, size, 0);
+	    if (rc < 0 && errno != EINTR) {
+		break;
+	    }
+	}
+    }
+    return rc;
+}
+
+
+
+static int
+netsnmp_unix_close(netsnmp_transport *t)
+{
+    int rc = 0;
+    sockaddr_un_pair *sup = (sockaddr_un_pair *) t->data;
+
+    if (t->sock >= 0) {
+#ifndef HAVE_CLOSESOCKET
+        rc = close(t->sock);
+#else
+        rc = closesocket(t->sock);
+#endif
+        t->sock = -1;
+        if (sup != NULL) {
+            if (sup->local) {
+                DEBUGMSGTL(("netsnmp_unix", "close: server unlink(\"%s\")\n",
+                            sup->server.sun_path));
+                unlink(sup->server.sun_path);
+            } else {
+                DEBUGMSGTL(("netsnmp_unix", "close: client unlink(\"%s\")\n",
+                            sup->client.sun_path));
+                unlink(sup->client.sun_path);
+            }
+        }
+        return rc;
+    } else {
+        return -1;
+    }
+}
+
+
+
+static int
+netsnmp_unix_accept(netsnmp_transport *t)
+{
+    struct sockaddr *farend = NULL;
+    int             newsock = -1;
+    socklen_t       farendlen = sizeof(struct sockaddr_un);
+
+    farend = (struct sockaddr *) malloc(farendlen);
+
+    if (farend == NULL) {
+        /*
+         * Indicate that the acceptance of this socket failed.  
+         */
+        DEBUGMSGTL(("netsnmp_unix", "accept: malloc failed\n"));
+        return -1;
+    }
+    memset(farend, 0, farendlen);
+
+    if (t != NULL && t->sock >= 0) {
+        newsock = accept(t->sock, farend, &farendlen);
+
+        if (newsock < 0) {
+            DEBUGMSGTL(("netsnmp_unix","accept failed rc %d errno %d \"%s\"\n",
+			newsock, errno, strerror(errno)));
+            free(farend);
+            return newsock;
+        }
+
+        if (t->data != NULL) {
+            free(t->data);
+        }
+
+        DEBUGMSGTL(("netsnmp_unix", "accept succeeded (farend %p len %d)\n",
+		    farend, farendlen));
+        t->data = farend;
+        t->data_length = sizeof(struct sockaddr_un);
+        return newsock;
+    } else {
+        free(farend);
+        return -1;
+    }
+}
+
+
+
+/*
+ * Open a Unix-domain transport for SNMP.  Local is TRUE if addr is the local 
+ * address to bind to (i.e. this is a server-type session); otherwise addr is 
+ * the remote address to send things to (and we make up a temporary name for
+ * the local end of the connection).  
+ */
+
+netsnmp_transport *
+netsnmp_unix_transport(struct sockaddr_un *addr, int local)
+{
+    netsnmp_transport *t = NULL;
+    sockaddr_un_pair *sup = NULL;
+    int             rc = 0;
+    char           *string = NULL;
+
+    if (addr == NULL || addr->sun_family != AF_UNIX) {
+        return NULL;
+    }
+
+    t = (netsnmp_transport *) malloc(sizeof(netsnmp_transport));
+    if (t == NULL) {
+        return NULL;
+    }
+
+    string = netsnmp_unix_fmtaddr(NULL, (void *)addr, 
+				  sizeof(struct sockaddr_un));
+    DEBUGMSGTL(("netsnmp_unix", "open %s %s\n", local ? "local" : "remote",
+                string));
+    free(string);
+
+    memset(t, 0, sizeof(netsnmp_transport));
+
+    t->domain = netsnmp_UnixDomain;
+    t->domain_length =
+        sizeof(netsnmp_UnixDomain) / sizeof(netsnmp_UnixDomain[0]);
+
+    t->data = malloc(sizeof(sockaddr_un_pair));
+    if (t->data == NULL) {
+        netsnmp_transport_free(t);
+        return NULL;
+    }
+    memset(t->data, 0, sizeof(sockaddr_un_pair));
+    t->data_length = sizeof(sockaddr_un_pair);
+    sup = (sockaddr_un_pair *) t->data;
+
+    t->sock = socket(PF_UNIX, SOCK_STREAM, 0);
+    if (t->sock < 0) {
+        netsnmp_transport_free(t);
+        return NULL;
+    }
+
+    t->flags = NETSNMP_TRANSPORT_FLAG_STREAM;
+
+    if (local) {
+        t->local = malloc(strlen(addr->sun_path));
+        if (t->local == NULL) {
+            netsnmp_transport_free(t);
+            return NULL;
+        }
+        memcpy(t->local, addr->sun_path, strlen(addr->sun_path));
+        t->local_length = strlen(addr->sun_path);
+
+        /*
+         * This session is inteneded as a server, so we must bind to the given
+         * path (unlinking it first, to avoid errors).  
+         */
+
+        t->flags |= NETSNMP_TRANSPORT_FLAG_LISTEN;
+
+        unlink(addr->sun_path);
+        rc = bind(t->sock, (struct sockaddr *) addr, SUN_LEN(addr));
+        if (rc != 0) {
+            DEBUGMSGTL(("netsnmp_unix_transport",
+                        "couldn't bind \"%s\", errno %d (%s)\n",
+                        addr->sun_path, errno, strerror(errno)));
+            netsnmp_unix_close(t);
+            netsnmp_transport_free(t);
+            return NULL;
+        }
+
+        /*
+         * Save the address in the transport-specific data pointer for later
+         * use by netsnmp_unix_close.
+         */
+
+        sup->server.sun_family = AF_UNIX;
+        strcpy(sup->server.sun_path, addr->sun_path);
+        sup->local = 1;
+
+        /*
+         * Now sit here and listen for connections to arrive.  
+         */
+
+        rc = listen(t->sock, NETSNMP_STREAM_QUEUE_LEN);
+        if (rc != 0) {
+            DEBUGMSGTL(("netsnmp_unix_transport",
+                        "couldn't listen to \"%s\", errno %d (%s)\n",
+                        addr->sun_path, errno, strerror(errno)));
+            netsnmp_unix_close(t);
+            netsnmp_transport_free(t);
+        }
+
+    } else {
+        t->remote = malloc(strlen(addr->sun_path));
+        if (t->remote == NULL) {
+            netsnmp_transport_free(t);
+            return NULL;
+        }
+        memcpy(t->remote, addr->sun_path, strlen(addr->sun_path));
+        t->remote_length = strlen(addr->sun_path);
+
+        rc = connect(t->sock, (struct sockaddr *) addr,
+                     sizeof(struct sockaddr_un));
+        if (rc != 0) {
+            DEBUGMSGTL(("netsnmp_unix_transport",
+                        "couldn't connect to \"%s\", errno %d (%s)\n",
+                        addr->sun_path, errno, strerror(errno)));
+            netsnmp_unix_close(t);
+            netsnmp_transport_free(t);
+            return NULL;
+        }
+
+        /*
+         * Save the remote address in the transport-specific data pointer for
+         * later use by netsnmp_unix_send.  
+         */
+
+        sup->server.sun_family = AF_UNIX;
+        strcpy(sup->server.sun_path, addr->sun_path);
+        sup->local = 0;
+    }
+
+    /*
+     * Message size is not limited by this transport (hence msgMaxSize
+     * is equal to the maximum legal size of an SNMP message).  
+     */
+
+    t->msgMaxSize = 0x7fffffff;
+    t->f_recv     = netsnmp_unix_recv;
+    t->f_send     = netsnmp_unix_send;
+    t->f_close    = netsnmp_unix_close;
+    t->f_accept   = netsnmp_unix_accept;
+    t->f_fmtaddr  = netsnmp_unix_fmtaddr;
+
+    return t;
+}
+
+netsnmp_transport *
+netsnmp_unix_create_tstring(const char *string, int local)
+{
+    struct sockaddr_un addr;
+
+    if ((string != NULL) && (strlen(string) < sizeof(addr.sun_path))) {
+        addr.sun_family = AF_UNIX;
+        memset(addr.sun_path, 0, sizeof(addr.sun_path));
+        strncpy(addr.sun_path, string, sizeof(addr.sun_path) - 1);
+        return netsnmp_unix_transport(&addr, local);
+    } else {
+        if (string != NULL) {
+            snmp_log(LOG_ERR, "Path too long for Unix domain transport\n");
+        }
+        return NULL;
+    }
+}
+
+
+
+netsnmp_transport *
+netsnmp_unix_create_ostring(const u_char * o, size_t o_len, int local)
+{
+    struct sockaddr_un addr;
+
+    if (o_len > 0 && o_len < (sizeof(addr.sun_path) - 1)) {
+        addr.sun_family = AF_UNIX;
+        memset(addr.sun_path, 0, sizeof(addr.sun_path));
+        strncpy(addr.sun_path, o, o_len);
+        return netsnmp_unix_transport(&addr, local);
+    } else {
+        if (o_len > 0) {
+            snmp_log(LOG_ERR, "Path too long for Unix domain transport\n");
+        }
+    }
+    return NULL;
+}
+
+
+
+void
+netsnmp_unix_ctor(void)
+{
+    unixDomain.name = netsnmp_UnixDomain;
+    unixDomain.name_length = sizeof(netsnmp_UnixDomain) / sizeof(oid);
+    unixDomain.prefix = calloc(2, sizeof(char *));
+    unixDomain.prefix[0] = "unix";
+
+    unixDomain.f_create_from_tstring = netsnmp_unix_create_tstring;
+    unixDomain.f_create_from_ostring = netsnmp_unix_create_ostring;
+
+    netsnmp_tdomain_register(&unixDomain);
+}
diff -Naur tomato/release/src/router/snmp/snmplib/snmpusm.c tomato121/release/src/router/snmp/snmplib/snmpusm.c
--- tomato/release/src/router/snmp/snmplib/snmpusm.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/snmplib/snmpusm.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,3595 @@
+/*
+ * snmpusm.c
+ *
+ * Routines to manipulate a information about a "user" as
+ * defined by the SNMP-USER-BASED-SM-MIB MIB.
+ *
+ * All functions usm_set_usmStateReference_*() return 0 on success, -1
+ * otherwise.
+ *
+ * !! Tab stops set to 4 in some parts of this file. !!
+ *    (Designated on a per function.)
+ */
+
+#include <net-snmp/net-snmp-config.h>
+
+#include <sys/types.h>
+#if HAVE_WINSOCK_H
+#include <winsock.h>
+#endif
+#include <stdio.h>
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#if TIME_WITH_SYS_TIME
+# ifdef WIN32
+#  include <sys/timeb.h>
+# else
+#  include <sys/time.h>
+# endif
+# include <time.h>
+#else
+# if HAVE_SYS_TIME_H
+#  include <sys/time.h>
+# else
+#  include <time.h>
+# endif
+#endif
+#if HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+#ifdef HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+
+#if HAVE_DMALLOC_H
+#include <dmalloc.h>
+#endif
+
+#include <net-snmp/types.h>
+#include <net-snmp/output_api.h>
+#include <net-snmp/config_api.h>
+#include <net-snmp/utilities.h>
+
+#include <net-snmp/library/asn1.h>
+#include <net-snmp/library/snmp_api.h>
+#include <net-snmp/library/callback.h>
+#include <net-snmp/library/keytools.h>
+#include <net-snmp/library/snmpv3.h>
+#include <net-snmp/library/lcd_time.h>
+#include <net-snmp/library/scapi.h>
+#include <net-snmp/library/callback.h>
+#include <net-snmp/library/snmp_secmod.h>
+#include <net-snmp/library/snmpusm.h>
+
+oid             usmNoAuthProtocol[10] = { 1, 3, 6, 1, 6, 3, 10, 1, 1, 1 };
+oid             usmHMACMD5AuthProtocol[10] =
+    { 1, 3, 6, 1, 6, 3, 10, 1, 1, 2 };
+oid             usmHMACSHA1AuthProtocol[10] =
+    { 1, 3, 6, 1, 6, 3, 10, 1, 1, 3 };
+oid             usmNoPrivProtocol[10] = { 1, 3, 6, 1, 6, 3, 10, 1, 2, 1 };
+oid             usmDESPrivProtocol[10] = { 1, 3, 6, 1, 6, 3, 10, 1, 2, 2 };
+oid             usmAES128PrivProtocol[10] = { 1, 3, 6, 1, 4, 1, 8072, 876,876,128 };
+oid             usmAES192PrivProtocol[10] = { 1, 3, 6, 1, 4, 1, 8072, 876,876,192 };
+oid             usmAES256PrivProtocol[10] = { 1, 3, 6, 1, 4, 1, 8072, 876,876,256 };
+
+static u_int    dummy_etime, dummy_eboot;       /* For ISENGINEKNOWN(). */
+
+/*
+ * Globals.
+ */
+static u_int    salt_integer;
+#ifdef HAVE_AES
+static u_int    salt_integer64_1, salt_integer64_2;
+#endif
+        /*
+         * 1/2 of seed for the salt.   Cf. RFC2274, Sect 8.1.1.1.
+         */
+
+static struct usmUser *noNameUser = NULL;
+/*
+ * Local storage (LCD) of the default user list.
+ */
+static struct usmUser *userList = NULL;
+
+/*
+ * Prototypes
+ */
+int
+                usm_check_secLevel_vs_protocols(int level,
+                                                const oid * authProtocol,
+                                                u_int authProtocolLen,
+                                                const oid * privProtocol,
+                                                u_int privProtocolLen);
+int
+                usm_calc_offsets(size_t globalDataLen,
+                                 int secLevel, size_t secEngineIDLen,
+                                 size_t secNameLen, size_t scopedPduLen,
+                                 u_long engineboots, long engine_time,
+                                 size_t * theTotalLength,
+                                 size_t * authParamsOffset,
+                                 size_t * privParamsOffset,
+                                 size_t * dataOffset, size_t * datalen,
+                                 size_t * msgAuthParmLen,
+                                 size_t * msgPrivParmLen, size_t * otstlen,
+                                 size_t * seq_len, size_t * msgSecParmLen);
+/*
+ * Set a given field of the secStateRef.
+ *
+ * Allocate <len> bytes for type <type> pointed to by ref-><field>.
+ * Then copy in <item> and record its length in ref-><field_len>.
+ *
+ * Return 0 on success, -1 otherwise.
+ */
+#define MAKE_ENTRY( type, item, len, field, field_len )			\
+{									\
+	if (ref == NULL)						\
+		return -1;						\
+	if (ref->field != NULL)	{					\
+		SNMP_ZERO(ref->field, ref->field_len);			\
+		SNMP_FREE(ref->field);					\
+	}								\
+	ref->field_len = 0;						\
+        if (len == 0 || item == NULL) {					\
+		return 0;						\
+	}					 			\
+	if ((ref->field = (type*) malloc (len * sizeof(type))) == NULL)	\
+	{								\
+		return -1;						\
+	}								\
+									\
+	memcpy (ref->field, item, len * sizeof(type));			\
+	ref->field_len = len;						\
+									\
+	return 0;							\
+}
+
+
+struct usmStateReference *
+usm_malloc_usmStateReference(void)
+{
+    struct usmStateReference *retval = (struct usmStateReference *)
+        calloc(1, sizeof(struct usmStateReference));
+
+    return retval;
+}                               /* end usm_malloc_usmStateReference() */
+
+
+void
+usm_free_usmStateReference(void *old)
+{
+    struct usmStateReference *old_ref = (struct usmStateReference *) old;
+
+    if (old_ref) {
+
+        SNMP_FREE(old_ref->usr_name);
+        SNMP_FREE(old_ref->usr_engine_id);
+        SNMP_FREE(old_ref->usr_auth_protocol);
+        SNMP_FREE(old_ref->usr_priv_protocol);
+
+        if (old_ref->usr_auth_key) {
+            SNMP_ZERO(old_ref->usr_auth_key, old_ref->usr_auth_key_length);
+            SNMP_FREE(old_ref->usr_auth_key);
+        }
+        if (old_ref->usr_priv_key) {
+            SNMP_ZERO(old_ref->usr_priv_key, old_ref->usr_priv_key_length);
+            SNMP_FREE(old_ref->usr_priv_key);
+        }
+
+        SNMP_ZERO(old_ref, sizeof(*old_ref));
+        SNMP_FREE(old_ref);
+
+    }
+
+}                               /* end usm_free_usmStateReference() */
+
+struct usmUser *
+usm_get_userList(void)
+{
+    return userList;
+}
+
+int
+usm_set_usmStateReference_name(struct usmStateReference *ref,
+                               char *name, size_t name_len)
+{
+    MAKE_ENTRY(char, name, name_len, usr_name, usr_name_length);
+}
+
+int
+usm_set_usmStateReference_engine_id(struct usmStateReference *ref,
+                                    u_char * engine_id,
+                                    size_t engine_id_len)
+{
+    MAKE_ENTRY(u_char, engine_id, engine_id_len,
+               usr_engine_id, usr_engine_id_length);
+}
+
+int
+usm_set_usmStateReference_auth_protocol(struct usmStateReference *ref,
+                                        oid * auth_protocol,
+                                        size_t auth_protocol_len)
+{
+    MAKE_ENTRY(oid, auth_protocol, auth_protocol_len,
+               usr_auth_protocol, usr_auth_protocol_length);
+}
+
+int
+usm_set_usmStateReference_auth_key(struct usmStateReference *ref,
+                                   u_char * auth_key, size_t auth_key_len)
+{
+    MAKE_ENTRY(u_char, auth_key, auth_key_len,
+               usr_auth_key, usr_auth_key_length);
+}
+
+int
+usm_set_usmStateReference_priv_protocol(struct usmStateReference *ref,
+                                        oid * priv_protocol,
+                                        size_t priv_protocol_len)
+{
+    MAKE_ENTRY(oid, priv_protocol, priv_protocol_len,
+               usr_priv_protocol, usr_priv_protocol_length);
+}
+
+int
+usm_set_usmStateReference_priv_key(struct usmStateReference *ref,
+                                   u_char * priv_key, size_t priv_key_len)
+{
+    MAKE_ENTRY(u_char, priv_key, priv_key_len,
+               usr_priv_key, usr_priv_key_length);
+}
+
+int
+usm_set_usmStateReference_sec_level(struct usmStateReference *ref,
+                                    int sec_level)
+{
+    if (ref == NULL)
+        return -1;
+    ref->usr_sec_level = sec_level;
+    return 0;
+}
+
+
+
+#ifdef SNMP_TESTING_CODE
+/*******************************************************************-o-******
+ * emergency_print
+ *
+ * Parameters:
+ *	*field
+ *	 length
+ *      
+ *	This is a print routine that is solely included so that it can be
+ *	used in gdb.  Don't use it as a function, it will be pulled before
+ *	a real release of the code.
+ *
+ *	tab stop 4
+ *
+ *	XXX fflush() only works on FreeBSD; core dumps on Sun OS's
+ */
+void
+emergency_print(u_char * field, u_int length)
+{
+    int             iindex;
+    int             start = 0;
+    int             stop = 25;
+
+    while (start < stop) {
+        for (iindex = start; iindex < stop; iindex++)
+            printf("%02X ", field[iindex]);
+
+        printf("\n");
+        start = stop;
+        stop = stop + 25 < length ? stop + 25 : length;
+    }
+    fflush(0);
+
+}                               /* end emergency_print() */
+#endif                          /* SNMP_TESTING_CODE */
+
+
+/*******************************************************************-o-******
+ * asn_predict_int_length
+ *
+ * Parameters:
+ *	type	(UNUSED)
+ *	number
+ *	len
+ *      
+ * Returns:
+ *	Number of bytes necessary to store the ASN.1 encoded value of 'number'.
+ *
+ *
+ *	This gives the number of bytes that the ASN.1 encoder (in asn1.c) will
+ *	use to encode a particular integer value.
+ *
+ *	Returns the length of the integer -- NOT THE HEADER!
+ *
+ *	Do this the same way as asn_build_int()...
+ */
+int
+asn_predict_int_length(int type, long number, size_t len)
+{
+    register u_long mask;
+
+
+    if (len != sizeof(long))
+        return -1;
+
+    mask = ((u_long) 0x1FF) << ((8 * (sizeof(long) - 1)) - 1);
+    /*
+     * mask is 0xFF800000 on a big-endian machine 
+     */
+
+    while ((((number & mask) == 0) || ((number & mask) == mask))
+           && len > 1) {
+        len--;
+        number <<= 8;
+    }
+
+    return len;
+
+}                               /* end asn_predict_length() */
+
+
+
+
+/*******************************************************************-o-******
+ * asn_predict_length
+ *
+ * Parameters:
+ *	 type
+ *	*ptr
+ *	 u_char_len
+ *      
+ * Returns:
+ *	Length in bytes:	1 + <n> + <u_char_len>, where
+ *
+ *		1		For the ASN.1 type.
+ *		<n>		# of bytes to store length of data.
+ *		<u_char_len>	Length of data associated with ASN.1 type.
+ *
+ *	This gives the number of bytes that the ASN.1 encoder (in asn1.c) will
+ *	use to encode a particular integer value.  This is as broken as the
+ *	currently used encoder.
+ *
+ * XXX	How is <n> chosen, exactly??
+ */
+int
+asn_predict_length(int type, u_char * ptr, size_t u_char_len)
+{
+
+    if (type & ASN_SEQUENCE)
+        return 1 + 3 + u_char_len;
+
+    if (type & ASN_INTEGER) {
+        u_long          value;
+        memcpy(&value, ptr, u_char_len);
+        u_char_len = asn_predict_int_length(type, value, u_char_len);
+    }
+
+    if (u_char_len < 0x80)
+        return 1 + 1 + u_char_len;
+    else if (u_char_len < 0xFF)
+        return 1 + 2 + u_char_len;
+    else
+        return 1 + 3 + u_char_len;
+
+}                               /* end asn_predict_length() */
+
+
+
+
+/*******************************************************************-o-******
+ * usm_calc_offsets
+ *
+ * Parameters:
+ *	(See list below...)
+ *      
+ * Returns:
+ *	0	On success,
+ *	-1	Otherwise.
+ *
+ *
+ *	This routine calculates the offsets into an outgoing message buffer
+ *	for the necessary values.  The outgoing buffer will generically
+ *	look like this:
+ *
+ *	SNMPv3 Message
+ *	SEQ len[11]
+ *		INT len version
+ *	Header
+ *		SEQ len
+ *			INT len MsgID
+ *			INT len msgMaxSize
+ *			OST len msgFlags (OST = OCTET STRING)
+ *			INT len msgSecurityModel
+ *	MsgSecurityParameters
+ *		[1] OST len[2]
+ *			SEQ len[3]
+ *				OST len msgAuthoritativeEngineID
+ *				INT len msgAuthoritativeEngineBoots
+ *				INT len msgAuthoritativeEngineTime
+ *				OST len msgUserName
+ *				OST len[4] [5] msgAuthenticationParameters
+ *				OST len[6] [7] msgPrivacyParameters
+ *	MsgData
+ *		[8] OST len[9] [10] encryptedPDU
+ *		or
+ *		[8,10] SEQUENCE len[9] scopedPDU
+ *	[12]
+ *
+ *	The bracketed points will be needed to be identified ([x] is an index
+ *	value, len[x] means a length value).  Here is a semantic guide to them:
+ *
+ *	[1] = globalDataLen (input)
+ *	[2] = otstlen
+ *	[3] = seq_len
+ *	[4] = msgAuthParmLen (may be 0 or 12)
+ *	[5] = authParamsOffset
+ *	[6] = msgPrivParmLen (may be 0 or 8)
+ *	[7] = privParamsOffset
+ *	[8] = globalDataLen + msgSecParmLen
+ *	[9] = datalen
+ *	[10] = dataOffset
+ *	[11] = theTotalLength - the length of the header itself
+ *	[12] = theTotalLength
+ */
+int
+usm_calc_offsets(size_t globalDataLen,  /* SNMPv3Message + HeaderData */
+                 int secLevel, size_t secEngineIDLen, size_t secNameLen, size_t scopedPduLen,   /* An BER encoded sequence. */
+                 u_long engineboots,    /* XXX (asn1.c works in long, not int.) */
+                 long engine_time,      /* XXX (asn1.c works in long, not int.) */
+                 size_t * theTotalLength,       /* globalDataLen + msgSecurityP. + msgData */
+                 size_t * authParamsOffset,     /* Distance to auth bytes.                 */
+                 size_t * privParamsOffset,     /* Distance to priv bytes.                 */
+                 size_t * dataOffset,   /* Distance to scopedPdu SEQ  -or-  the
+                                         *   crypted (data) portion of msgData.    */
+                 size_t * datalen,      /* Size of msgData OCTET STRING encoding.  */
+                 size_t * msgAuthParmLen,       /* Size of msgAuthenticationParameters.    */
+                 size_t * msgPrivParmLen,       /* Size of msgPrivacyParameters.           */
+                 size_t * otstlen,      /* Size of msgSecurityP. O.S. encoding.    */
+                 size_t * seq_len,      /* Size of msgSecurityP. SEQ data.         */
+                 size_t * msgSecParmLen)
+{                               /* Size of msgSecurityP. SEQ.              */
+    int             engIDlen,   /* Sizes of OCTET STRING and SEQ encodings */
+                    engBtlen,   /*   for fields within                     */
+                    engTmlen,   /*   msgSecurityParameters portion of      */
+                    namelen,    /*   SNMPv3Message.                        */
+                    authlen, privlen;
+
+    /*
+     * If doing authentication, msgAuthParmLen = 12 else msgAuthParmLen = 0.
+     * If doing encryption,     msgPrivParmLen = 8  else msgPrivParmLen = 0.
+     */
+    *msgAuthParmLen = (secLevel == SNMP_SEC_LEVEL_AUTHNOPRIV
+                       || secLevel == SNMP_SEC_LEVEL_AUTHPRIV) ? 12 : 0;
+
+    *msgPrivParmLen = (secLevel == SNMP_SEC_LEVEL_AUTHPRIV) ? 8 : 0;
+
+
+    /*
+     * Calculate lengths.
+     */
+    if ((engIDlen = asn_predict_length(ASN_OCTET_STR,
+                                       0, secEngineIDLen)) == -1) {
+        return -1;
+    }
+
+    if ((engBtlen = asn_predict_length(ASN_INTEGER,
+                                       (u_char *) & engineboots,
+                                       sizeof(long))) == -1) {
+        return -1;
+    }
+
+    if ((engTmlen = asn_predict_length(ASN_INTEGER,
+                                       (u_char *) & engine_time,
+                                       sizeof(long))) == -1) {
+        return -1;
+    }
+
+    if ((namelen = asn_predict_length(ASN_OCTET_STR, 0, secNameLen)) == -1) {
+        return -1;
+    }
+
+    if ((authlen = asn_predict_length(ASN_OCTET_STR,
+                                      0, *msgAuthParmLen)) == -1) {
+        return -1;
+    }
+
+    if ((privlen = asn_predict_length(ASN_OCTET_STR,
+                                      0, *msgPrivParmLen)) == -1) {
+        return -1;
+    }
+
+    *seq_len =
+        engIDlen + engBtlen + engTmlen + namelen + authlen + privlen;
+
+    if ((*otstlen = asn_predict_length(ASN_SEQUENCE, 0, *seq_len)) == -1) {
+        return -1;
+    }
+
+    if ((*msgSecParmLen = asn_predict_length(ASN_OCTET_STR,
+                                             0, *otstlen)) == -1) {
+        return -1;
+    }
+
+    *authParamsOffset = globalDataLen + +(*msgSecParmLen - *seq_len)
+        + engIDlen + engBtlen + engTmlen + namelen
+        + (authlen - *msgAuthParmLen);
+
+    *privParamsOffset = *authParamsOffset + *msgAuthParmLen
+        + (privlen - *msgPrivParmLen);
+
+
+    /*
+     * Compute the size of the plaintext.  Round up to account for cipher
+     * block size, if necessary.
+     *
+     * XXX  This is hardwired for 1DES... If scopedPduLen is already
+     *      a multiple of 8, then *add* 8 more; otherwise, round up
+     *      to the next multiple of 8.
+     *
+     * FIX  Calculation of encrypted portion of msgData and consequent
+     *      setting and sanity checking of theTotalLength, et al. should
+     *      occur *after* encryption has taken place.
+     */
+    if (secLevel == SNMP_SEC_LEVEL_AUTHPRIV) {
+        scopedPduLen = ROUNDUP8(scopedPduLen);
+
+        if ((*datalen =
+             asn_predict_length(ASN_OCTET_STR, 0, scopedPduLen)) == -1) {
+            return -1;
+        }
+    } else {
+        *datalen = scopedPduLen;
+    }
+
+    *dataOffset = globalDataLen + *msgSecParmLen +
+        (*datalen - scopedPduLen);
+    *theTotalLength = globalDataLen + *msgSecParmLen + *datalen;
+
+    return 0;
+
+}                               /* end usm_calc_offsets() */
+
+
+
+
+
+/*******************************************************************-o-******
+ * usm_set_salt
+ *
+ * Parameters:
+ *	*iv		  (O)   Buffer to contain IV.
+ *	*iv_length	  (O)   Length of iv.
+ *	*priv_salt	  (I)   Salt portion of private key.
+ *	 priv_salt_length (I)   Length of priv_salt.
+ *	*msgSalt	  (I/O) Pointer salt portion of outgoing msg buffer.
+ *      
+ * Returns:
+ *	0	On success,
+ *	-1	Otherwise.
+ *
+ *	Determine the initialization vector for the DES-CBC encryption.
+ *	(Cf. RFC 2274, 8.1.1.1.)
+ *
+ *	iv is defined as the concatenation of engineBoots and the
+ *		salt integer.
+ *	The salt integer is incremented.
+ *	The resulting salt is copied into the msgSalt buffer.
+ *	The result of the concatenation is then XORed with the salt
+ *		portion of the private key (last 8 bytes).
+ *	The IV result is returned individually for further use.
+ */
+int
+usm_set_salt(u_char * iv,
+             size_t * iv_length,
+             u_char * priv_salt, size_t priv_salt_length, u_char * msgSalt)
+{
+    size_t          propersize_salt = BYTESIZE(USM_DES_SALT_LENGTH);
+    int             net_boots;
+    int             net_salt_int;
+    /*
+     * net_* should be encoded in network byte order.  XXX  Why?
+     */
+    int             iindex;
+
+
+    /*
+     * Sanity check.
+     */
+    if (!iv || !iv_length || !priv_salt || (*iv_length != propersize_salt)
+        || (priv_salt_length < propersize_salt)) {
+        return -1;
+    }
+
+
+    net_boots = htonl(snmpv3_local_snmpEngineBoots());
+    net_salt_int = htonl(salt_integer);
+
+    salt_integer += 1;
+
+    memcpy(iv, &net_boots, propersize_salt / 2);
+    memcpy(iv + (propersize_salt / 2), &net_salt_int, propersize_salt / 2);
+
+    if (msgSalt)
+        memcpy(msgSalt, iv, propersize_salt);
+
+
+    /*
+     * Turn the salt into an IV: XOR <boots, salt_int> with salt
+     * portion of priv_key.
+     */
+    for (iindex = 0; iindex < (int) propersize_salt; iindex++)
+        iv[iindex] ^= priv_salt[iindex];
+
+
+    return 0;
+
+}                               /* end usm_set_salt() */
+
+#ifdef HAVE_AES
+/*******************************************************************-o-******
+ * usm_set_aes_iv
+ *
+ * Parameters:
+ *	*iv		  (O)   Buffer to contain IV.
+ *	*iv_length	  (O)   Length of iv.
+ *      net_boots         (I)   the network byte order of the authEng boots val
+ *      net_time         (I)   the network byte order of the authEng time val
+ *      *salt             (O)   A buffer for the outgoing salt (= 8 bytes of iv)
+ *      
+ * Returns:
+ *	0	On success,
+ *	-1	Otherwise.
+ *
+ *	Determine the initialization vector for AES encryption.
+ *	(draft-blumenthal-aes-usm-03.txt, 3.1.2.2)
+ *
+ *	iv is defined as the concatenation of engineBoots, engineTime
+  	and a 64 bit salt-integer.
+ *	The 64 bit salt integer is incremented.
+ *	The resulting salt is copied into the salt buffer.
+ *	The IV result is returned individually for further use.
+ */
+int
+usm_set_aes_iv(u_char * iv,
+               size_t * iv_length,
+               u_int net_boots,
+               u_int net_time,
+               u_char * salt)
+{
+    /*
+     * net_* should be encoded in network byte order.
+     */
+    int             net_salt_int1, net_salt_int2;
+#define PROPER_AES_IV_SIZE 64
+
+    /*
+     * Sanity check.
+     */
+    if (!iv || !iv_length) {
+        return -1;
+    }
+
+    net_salt_int1 = htonl(salt_integer64_1);
+    net_salt_int2 = htonl(salt_integer64_2);
+
+    if ((salt_integer64_2 += 1) == 0)
+        salt_integer64_2 += 1;
+    
+    /* XXX: warning: hard coded proper lengths */
+    memcpy(iv, &net_boots, 4);
+    memcpy(iv+4, &net_time, 4);
+    memcpy(iv+8, &net_salt_int1, 4);
+    memcpy(iv+12, &net_salt_int2, 4);
+
+    memcpy(salt, iv+8, 8); /* only copy the needed portion */
+    return 0;
+}                               /* end usm_set_salt() */
+#endif /* HAVE_AES */
+
+int
+usm_secmod_generate_out_msg(struct snmp_secmod_outgoing_params *parms)
+{
+    if (!parms)
+        return SNMPERR_GENERR;
+
+    return usm_generate_out_msg(parms->msgProcModel,
+                                parms->globalData, parms->globalDataLen,
+                                parms->maxMsgSize, parms->secModel,
+                                parms->secEngineID, parms->secEngineIDLen,
+                                parms->secName, parms->secNameLen,
+                                parms->secLevel,
+                                parms->scopedPdu, parms->scopedPduLen,
+                                parms->secStateRef,
+                                parms->secParams, parms->secParamsLen,
+                                parms->wholeMsg, parms->wholeMsgLen);
+}
+
+/*******************************************************************-o-******
+ * usm_generate_out_msg
+ *
+ * Parameters:
+ *	(See list below...)
+ *      
+ * Returns:
+ *	SNMPERR_SUCCESS			On success.
+ *	SNMPERR_USM_AUTHENTICATIONFAILURE
+ *	SNMPERR_USM_ENCRYPTIONERROR
+ *	SNMPERR_USM_GENERICERROR
+ *	SNMPERR_USM_UNKNOWNSECURITYNAME
+ *	SNMPERR_USM_GENERICERROR
+ *	SNMPERR_USM_UNSUPPORTEDSECURITYLEVEL
+ *	
+ *
+ * Generates an outgoing message.
+ *
+ * XXX	Beware of misnomers!
+ */
+int
+usm_generate_out_msg(int msgProcModel,  /* (UNUSED) */
+                     u_char * globalData,       /* IN */
+                     /*
+                      * Pointer to msg header data will point to the beginning
+                      * * of the entire packet buffer to be transmitted on wire,
+                      * * memory will be contiguous with secParams, typically
+                      * * this pointer will be passed back as beginning of
+                      * * wholeMsg below.  asn seq. length is updated w/ new length.
+                      * *
+                      * * While this points to a buffer that should be big enough
+                      * * for the whole message, only the first two parts
+                      * * of the message are completed, namely SNMPv3Message and
+                      * * HeaderData.  globalDataLen (next parameter) represents
+                      * * the length of these two completed parts.
+                      */
+                     size_t globalDataLen,      /* IN - Length of msg header data.      */
+                     int maxMsgSize,    /* (UNUSED) */
+                     int secModel,      /* (UNUSED) */
+                     u_char * secEngineID,      /* IN - Pointer snmpEngineID.           */
+                     size_t secEngineIDLen,     /* IN - SnmpEngineID length.            */
+                     char *secName,     /* IN - Pointer to securityName.        */
+                     size_t secNameLen, /* IN - SecurityName length.            */
+                     int secLevel,      /* IN - AuthNoPriv, authPriv etc.       */
+                     u_char * scopedPdu,        /* IN */
+                     /*
+                      * Pointer to scopedPdu will be encrypted by USM if needed
+                      * * and written to packet buffer immediately following
+                      * * securityParameters, entire msg will be authenticated by
+                      * * USM if needed.
+                      */
+                     size_t scopedPduLen,       /* IN - scopedPdu length. */
+                     void *secStateRef, /* IN */
+                     /*
+                      * secStateRef, pointer to cached info provided only for
+                      * * Response, otherwise NULL.
+                      */
+                     u_char * secParams,        /* OUT */
+                     /*
+                      * BER encoded securityParameters pointer to offset within
+                      * * packet buffer where secParams should be written, the
+                      * * entire BER encoded OCTET STRING (including header) is
+                      * * written here by USM secParams = globalData +
+                      * * globalDataLen.
+                      */
+                     size_t * secParamsLen,     /* IN/OUT - Len available, len returned. */
+                     u_char ** wholeMsg,        /* OUT */
+                     /*
+                      * Complete authenticated/encrypted message - typically
+                      * * the pointer to start of packet buffer provided in
+                      * * globalData is returned here, could also be a separate
+                      * * buffer.
+                      */
+                     size_t * wholeMsgLen)
+{                               /* IN/OUT - Len available, len returned. */
+    size_t          otstlen;
+    size_t          seq_len;
+    size_t          msgAuthParmLen;
+    size_t          msgPrivParmLen;
+    size_t          msgSecParmLen;
+    size_t          authParamsOffset;
+    size_t          privParamsOffset;
+    size_t          datalen;
+    size_t          dataOffset;
+    size_t          theTotalLength;
+
+    u_char         *ptr;
+    size_t          ptr_len;
+    size_t          remaining;
+    size_t          offSet;
+    u_int           boots_uint;
+    u_int           time_uint;
+    long            boots_long;
+    long            time_long;
+
+    /*
+     * Indirection because secStateRef values override parameters.
+     * 
+     * None of these are to be free'd - they are either pointing to
+     * what's in the secStateRef or to something either in the
+     * actual prarmeter list or the user list.
+     */
+
+    char           *theName = NULL;
+    u_int           theNameLength = 0;
+    u_char         *theEngineID = NULL;
+    u_int           theEngineIDLength = 0;
+    u_char         *theAuthKey = NULL;
+    u_int           theAuthKeyLength = 0;
+    const oid      *theAuthProtocol = NULL;
+    u_int           theAuthProtocolLength = 0;
+    u_char         *thePrivKey = NULL;
+    u_int           thePrivKeyLength = 0;
+    const oid      *thePrivProtocol = NULL;
+    u_int           thePrivProtocolLength = 0;
+    int             theSecLevel = 0;    /* No defined const for bad
+                                         * value (other then err).
+                                         */
+
+    DEBUGMSGTL(("usm", "USM processing has begun.\n"));
+
+    if (secStateRef != NULL) {
+        /*
+         * To hush the compiler for now.  XXX 
+         */
+        struct usmStateReference *ref
+            = (struct usmStateReference *) secStateRef;
+
+        theName = ref->usr_name;
+        theNameLength = ref->usr_name_length;
+        theEngineID = ref->usr_engine_id;
+        theEngineIDLength = ref->usr_engine_id_length;
+
+        if (!theEngineIDLength) {
+            theEngineID = secEngineID;
+            theEngineIDLength = secEngineIDLen;
+        }
+
+        theAuthProtocol = ref->usr_auth_protocol;
+        theAuthProtocolLength = ref->usr_auth_protocol_length;
+        theAuthKey = ref->usr_auth_key;
+        theAuthKeyLength = ref->usr_auth_key_length;
+        thePrivProtocol = ref->usr_priv_protocol;
+        thePrivProtocolLength = ref->usr_priv_protocol_length;
+        thePrivKey = ref->usr_priv_key;
+        thePrivKeyLength = ref->usr_priv_key_length;
+        theSecLevel = ref->usr_sec_level;
+    }
+
+    /*
+     * Identify the user record.
+     */
+    else {
+        struct usmUser *user;
+
+        /*
+         * we do allow an unknown user name for
+         * unauthenticated requests. 
+         */
+        if ((user = usm_get_user(secEngineID, secEngineIDLen, secName))
+            == NULL && secLevel != SNMP_SEC_LEVEL_NOAUTH) {
+            DEBUGMSGTL(("usm", "Unknown User(%s)\n", secName));
+            usm_free_usmStateReference(secStateRef);
+            return SNMPERR_USM_UNKNOWNSECURITYNAME;
+        }
+
+        theName = secName;
+        theNameLength = secNameLen;
+        theEngineID = secEngineID;
+        theSecLevel = secLevel;
+        theEngineIDLength = secEngineIDLen;
+        if (user) {
+            theAuthProtocol = user->authProtocol;
+            theAuthProtocolLength = user->authProtocolLen;
+            theAuthKey = user->authKey;
+            theAuthKeyLength = user->authKeyLen;
+            thePrivProtocol = user->privProtocol;
+            thePrivProtocolLength = user->privProtocolLen;
+            thePrivKey = user->privKey;
+            thePrivKeyLength = user->privKeyLen;
+        } else {
+            /*
+             * unknown users can not do authentication (obviously) 
+             */
+            theAuthProtocol = usmNoAuthProtocol;
+            theAuthProtocolLength =
+                sizeof(usmNoAuthProtocol) / sizeof(oid);
+            theAuthKey = NULL;
+            theAuthKeyLength = 0;
+            thePrivProtocol = usmNoPrivProtocol;
+            thePrivProtocolLength =
+                sizeof(usmNoPrivProtocol) / sizeof(oid);
+            thePrivKey = NULL;
+            thePrivKeyLength = 0;
+        }
+    }                           /* endif -- secStateRef==NULL */
+
+
+    /*
+     * From here to the end of the function, avoid reference to
+     * secName, secEngineID, secLevel, and associated lengths.
+     */
+
+
+    /*
+     * Check to see if the user can use the requested sec services.
+     */
+    if (usm_check_secLevel_vs_protocols(theSecLevel,
+                                        theAuthProtocol,
+                                        theAuthProtocolLength,
+                                        thePrivProtocol,
+                                        thePrivProtocolLength) == 1) {
+        DEBUGMSGTL(("usm", "Unsupported Security Level (%d)\n",
+                    theSecLevel));
+        usm_free_usmStateReference(secStateRef);
+        return SNMPERR_USM_UNSUPPORTEDSECURITYLEVEL;
+    }
+
+
+    /*
+     * Retrieve the engine information.
+     *
+     * XXX  No error is declared in the EoP when sending messages to
+     *      unknown engines, processing continues w/ boots/time == (0,0).
+     */
+    if (get_enginetime(theEngineID, theEngineIDLength,
+                       &boots_uint, &time_uint, FALSE) == -1) {
+        DEBUGMSGTL(("usm", "%s\n", "Failed to find engine data."));
+    }
+
+    boots_long = boots_uint;
+    time_long = time_uint;
+
+
+    /*
+     * Set up the Offsets.
+     */
+    if (usm_calc_offsets(globalDataLen, theSecLevel, theEngineIDLength,
+                         theNameLength, scopedPduLen, boots_long,
+                         time_long, &theTotalLength, &authParamsOffset,
+                         &privParamsOffset, &dataOffset, &datalen,
+                         &msgAuthParmLen, &msgPrivParmLen, &otstlen,
+                         &seq_len, &msgSecParmLen) == -1) {
+        DEBUGMSGTL(("usm", "Failed calculating offsets.\n"));
+        usm_free_usmStateReference(secStateRef);
+        return SNMPERR_USM_GENERICERROR;
+    }
+
+    /*
+     * So, we have the offsets for the three parts that need to be
+     * determined, and an overall length.  Now we need to make
+     * sure all of this would fit in the outgoing buffer, and
+     * whether or not we need to make a new buffer, etc.
+     */
+
+
+    /*
+     * Set wholeMsg as a pointer to globalData.  Sanity check for
+     * the proper size.
+     * 
+     * Mark workspace in the message with bytes of all 1's to make it
+     * easier to find mistakes in raw message dumps.
+     */
+    ptr = *wholeMsg = globalData;
+    if (theTotalLength > *wholeMsgLen) {
+        DEBUGMSGTL(("usm", "Message won't fit in buffer.\n"));
+        usm_free_usmStateReference(secStateRef);
+        return SNMPERR_USM_GENERICERROR;
+    }
+
+    ptr_len = *wholeMsgLen = theTotalLength;
+
+#ifdef SNMP_TESTING_CODE
+    memset(&ptr[globalDataLen], 0xFF, theTotalLength - globalDataLen);
+#endif                          /* SNMP_TESTING_CODE */
+
+    /*
+     * Do the encryption.
+     */
+    if (theSecLevel == SNMP_SEC_LEVEL_AUTHPRIV) {
+        size_t          encrypted_length = theTotalLength - dataOffset;
+        size_t          salt_length = BYTESIZE(USM_MAX_SALT_LENGTH);
+        u_char          salt[BYTESIZE(USM_MAX_SALT_LENGTH)];
+
+        /*
+         * XXX  Hardwired to seek into a 1DES private key!
+         */
+#ifdef HAVE_AES
+        if (ISTRANSFORM(thePrivProtocol, AES128Priv) &&
+            ISTRANSFORM(thePrivProtocol, AES192Priv) &&
+            ISTRANSFORM(thePrivProtocol, AES256Priv)) {
+            if (!thePrivKey ||
+                usm_set_aes_iv(salt, &salt_length,
+                               htonl(boots_uint), htonl(time_uint),
+                               &ptr[privParamsOffset]) == -1) {
+                DEBUGMSGTL(("usm", "Can't set AES iv.\n"));
+                usm_free_usmStateReference(secStateRef);
+                return SNMPERR_USM_GENERICERROR;
+            }
+        } else if (ISTRANSFORM(thePrivProtocol, DESPriv)) {
+#endif
+        if (!thePrivKey ||
+            (usm_set_salt(salt, &salt_length,
+                          thePrivKey + 8, thePrivKeyLength - 8,
+                          &ptr[privParamsOffset])
+             == -1)) {
+            DEBUGMSGTL(("usm", "Can't set DES-CBC salt.\n"));
+            usm_free_usmStateReference(secStateRef);
+            return SNMPERR_USM_GENERICERROR;
+        }
+#ifdef HAVE_AES
+        }
+#endif
+
+        if (sc_encrypt(thePrivProtocol, thePrivProtocolLength,
+                       thePrivKey, thePrivKeyLength,
+                       salt, salt_length,
+                       scopedPdu, scopedPduLen,
+                       &ptr[dataOffset], &encrypted_length)
+            != SNMP_ERR_NOERROR) {
+            DEBUGMSGTL(("usm", "DES-CBC error.\n"));
+            usm_free_usmStateReference(secStateRef);
+            return SNMPERR_USM_ENCRYPTIONERROR;
+        }
+#ifdef SNMP_TESTING_CODE
+        if (debug_is_token_registered("usm/dump") == SNMPERR_SUCCESS) {
+            dump_chunk("usm/dump", "This data was encrypted:",
+                       scopedPdu, scopedPduLen);
+            dump_chunk("usm/dump", "salt + Encrypted form:",
+                       salt, salt_length);
+            dump_chunk("usm/dump", NULL,
+                       &ptr[dataOffset], encrypted_length);
+            dump_chunk("usm/dump", "*wholeMsg:",
+                       *wholeMsg, theTotalLength);
+        }
+#endif
+
+
+        ptr = *wholeMsg;
+        ptr_len = *wholeMsgLen = theTotalLength;
+
+
+        /*
+         * XXX  Sanity check for salt length should be moved up
+         *      under usm_calc_offsets() or tossed.
+         */
+        if ((encrypted_length != (theTotalLength - dataOffset))
+            || (salt_length != msgPrivParmLen)) {
+            DEBUGMSGTL(("usm", "DES-CBC length error.\n"));
+            usm_free_usmStateReference(secStateRef);
+            return SNMPERR_USM_ENCRYPTIONERROR;
+        }
+
+        DEBUGMSGTL(("usm", "Encryption successful.\n"));
+    }
+
+    /*
+     * No encryption for you!
+     */
+    else {
+        memcpy(&ptr[dataOffset], scopedPdu, scopedPduLen);
+    }
+
+
+
+    /*
+     * Start filling in the other fields (in prep for authentication).
+     * 
+     * offSet is an octet string header, which is different from all
+     * the other headers.
+     */
+    remaining = ptr_len - globalDataLen;
+
+    offSet = ptr_len - remaining;
+    asn_build_header(&ptr[offSet], &remaining,
+                     (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE |
+                               ASN_OCTET_STR), otstlen);
+
+    offSet = ptr_len - remaining;
+    asn_build_sequence(&ptr[offSet], &remaining,
+                       (u_char) (ASN_SEQUENCE | ASN_CONSTRUCTOR), seq_len);
+
+    offSet = ptr_len - remaining;
+    DEBUGDUMPHEADER("send", "msgAuthoritativeEngineID");
+    asn_build_string(&ptr[offSet], &remaining,
+                     (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE |
+                               ASN_OCTET_STR), theEngineID,
+                     theEngineIDLength);
+    DEBUGINDENTLESS();
+
+    offSet = ptr_len - remaining;
+    DEBUGDUMPHEADER("send", "msgAuthoritativeEngineBoots");
+    asn_build_int(&ptr[offSet], &remaining,
+                  (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE | ASN_INTEGER),
+                  &boots_long, sizeof(long));
+    DEBUGINDENTLESS();
+
+    offSet = ptr_len - remaining;
+    DEBUGDUMPHEADER("send", "msgAuthoritativeEngineTime");
+    asn_build_int(&ptr[offSet], &remaining,
+                  (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE | ASN_INTEGER),
+                  &time_long, sizeof(long));
+    DEBUGINDENTLESS();
+
+    offSet = ptr_len - remaining;
+    DEBUGDUMPHEADER("send", "msgUserName");
+    asn_build_string(&ptr[offSet], &remaining,
+                     (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE |
+                               ASN_OCTET_STR), (u_char *) theName,
+                     theNameLength);
+    DEBUGINDENTLESS();
+
+
+    /*
+     * Note: if there is no authentication being done,
+     * msgAuthParmLen is 0, and there is no effect (other than
+     * inserting a zero-length header) of the following
+     * statements.
+     */
+
+    offSet = ptr_len - remaining;
+    asn_build_header(&ptr[offSet],
+                     &remaining,
+                     (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE |
+                               ASN_OCTET_STR), msgAuthParmLen);
+
+    if (theSecLevel == SNMP_SEC_LEVEL_AUTHNOPRIV
+        || theSecLevel == SNMP_SEC_LEVEL_AUTHPRIV) {
+        offSet = ptr_len - remaining;
+        memset(&ptr[offSet], 0, msgAuthParmLen);
+    }
+
+    remaining -= msgAuthParmLen;
+
+
+    /*
+     * Note: if there is no encryption being done, msgPrivParmLen
+     * is 0, and there is no effect (other than inserting a
+     * zero-length header) of the following statements.
+     */
+
+    offSet = ptr_len - remaining;
+    asn_build_header(&ptr[offSet],
+                     &remaining,
+                     (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE |
+                               ASN_OCTET_STR), msgPrivParmLen);
+
+    remaining -= msgPrivParmLen;        /* Skipping the IV already there. */
+
+
+    /*
+     * For privacy, need to add the octet string header for it.
+     */
+    if (theSecLevel == SNMP_SEC_LEVEL_AUTHPRIV) {
+        offSet = ptr_len - remaining;
+        asn_build_header(&ptr[offSet],
+                         &remaining,
+                         (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE |
+                                   ASN_OCTET_STR),
+                         theTotalLength - dataOffset);
+    }
+
+
+    /*
+     * Adjust overall length and store it as the first SEQ length
+     * of the SNMPv3Message.
+     *
+     * FIX  4 is a magic number!
+     */
+    remaining = theTotalLength;
+    asn_build_sequence(ptr, &remaining,
+                       (u_char) (ASN_SEQUENCE | ASN_CONSTRUCTOR),
+                       theTotalLength - 4);
+
+
+    /*
+     * Now, time to consider / do authentication.
+     */
+    if (theSecLevel == SNMP_SEC_LEVEL_AUTHNOPRIV
+        || theSecLevel == SNMP_SEC_LEVEL_AUTHPRIV) {
+        size_t          temp_sig_len = msgAuthParmLen;
+        u_char         *temp_sig = (u_char *) malloc(temp_sig_len);
+
+        if (temp_sig == NULL) {
+            DEBUGMSGTL(("usm", "Out of memory.\n"));
+            usm_free_usmStateReference(secStateRef);
+            return SNMPERR_USM_GENERICERROR;
+        }
+
+        if (sc_generate_keyed_hash(theAuthProtocol, theAuthProtocolLength,
+                                   theAuthKey, theAuthKeyLength,
+                                   ptr, ptr_len, temp_sig, &temp_sig_len)
+            != SNMP_ERR_NOERROR) {
+            /*
+             * FIX temp_sig_len defined?!
+             */
+            SNMP_ZERO(temp_sig, temp_sig_len);
+            SNMP_FREE(temp_sig);
+            DEBUGMSGTL(("usm", "Signing failed.\n"));
+            usm_free_usmStateReference(secStateRef);
+            return SNMPERR_USM_AUTHENTICATIONFAILURE;
+        }
+
+        if (temp_sig_len != msgAuthParmLen) {
+            SNMP_ZERO(temp_sig, temp_sig_len);
+            SNMP_FREE(temp_sig);
+            DEBUGMSGTL(("usm", "Signing lengths failed.\n"));
+            usm_free_usmStateReference(secStateRef);
+            return SNMPERR_USM_AUTHENTICATIONFAILURE;
+        }
+
+        memcpy(&ptr[authParamsOffset], temp_sig, msgAuthParmLen);
+
+        SNMP_ZERO(temp_sig, temp_sig_len);
+        SNMP_FREE(temp_sig);
+
+    }
+
+    /*
+     * endif -- create keyed hash 
+     */
+    usm_free_usmStateReference(secStateRef);
+
+    DEBUGMSGTL(("usm", "USM processing completed.\n"));
+
+    return SNMPERR_SUCCESS;
+
+}                               /* end usm_generate_out_msg() */
+
+#ifdef USE_REVERSE_ASNENCODING
+int
+usm_secmod_rgenerate_out_msg(struct snmp_secmod_outgoing_params *parms)
+{
+    if (!parms)
+        return SNMPERR_GENERR;
+
+    return usm_rgenerate_out_msg(parms->msgProcModel,
+                                 parms->globalData, parms->globalDataLen,
+                                 parms->maxMsgSize, parms->secModel,
+                                 parms->secEngineID, parms->secEngineIDLen,
+                                 parms->secName, parms->secNameLen,
+                                 parms->secLevel,
+                                 parms->scopedPdu, parms->scopedPduLen,
+                                 parms->secStateRef,
+                                 parms->wholeMsg, parms->wholeMsgLen,
+                                 parms->wholeMsgOffset);
+}
+
+int
+usm_rgenerate_out_msg(int msgProcModel, /* (UNUSED) */
+                      u_char * globalData,      /* IN */
+                      /*
+                       * points at the msgGlobalData, which is of length given by next 
+                       * parameter.  
+                       */
+                      size_t globalDataLen,     /* IN - Length of msg header data.      */
+                      int maxMsgSize,   /* (UNUSED) */
+                      int secModel,     /* (UNUSED) */
+                      u_char * secEngineID,     /* IN - Pointer snmpEngineID.           */
+                      size_t secEngineIDLen,    /* IN - SnmpEngineID length.            */
+                      char *secName,    /* IN - Pointer to securityName.        */
+                      size_t secNameLen,        /* IN - SecurityName length.            */
+                      int secLevel,     /* IN - AuthNoPriv, authPriv etc.       */
+                      u_char * scopedPdu,       /* IN */
+                      /*
+                       * Pointer to scopedPdu will be encrypted by USM if needed
+                       * * and written to packet buffer immediately following
+                       * * securityParameters, entire msg will be authenticated by
+                       * * USM if needed.
+                       */
+                      size_t scopedPduLen,      /* IN - scopedPdu length. */
+                      void *secStateRef,        /* IN */
+                      /*
+                       * secStateRef, pointer to cached info provided only for
+                       * * Response, otherwise NULL.
+                       */
+                      u_char ** wholeMsg,       /*  IN/OUT  */
+                      /*
+                       * Points at the pointer to the packet buffer, which might get extended
+                       * if necessary via realloc().  
+                       */
+                      size_t * wholeMsgLen,     /*  IN/OUT  */
+                      /*
+                       * Length of the entire packet buffer, **not** the length of the
+                       * packet.  
+                       */
+                      size_t * offset   /*  IN/OUT  */
+                      /*
+                       * Offset from the end of the packet buffer to the start of the packet,
+                       * also known as the packet length.  
+                       */
+    )
+{
+    size_t          msgAuthParmLen = 0;
+#ifdef SNMP_TESTING_CODE
+    size_t          theTotalLength;
+#endif
+
+    u_int           boots_uint;
+    u_int           time_uint;
+    long            boots_long;
+    long            time_long;
+
+    /*
+     * Indirection because secStateRef values override parameters.
+     * 
+     * None of these are to be free'd - they are either pointing to
+     * what's in the secStateRef or to something either in the
+     * actual prarmeter list or the user list.
+     */
+
+    char           *theName = NULL;
+    u_int           theNameLength = 0;
+    u_char         *theEngineID = NULL;
+    u_int           theEngineIDLength = 0;
+    u_char         *theAuthKey = NULL;
+    u_int           theAuthKeyLength = 0;
+    const oid      *theAuthProtocol = NULL;
+    u_int           theAuthProtocolLength = 0;
+    u_char         *thePrivKey = NULL;
+    u_int           thePrivKeyLength = 0;
+    const oid      *thePrivProtocol = NULL;
+    u_int           thePrivProtocolLength = 0;
+    int             theSecLevel = 0;    /* No defined const for bad
+                                         * value (other then err). */
+    size_t          salt_length = 0, save_salt_length = 0, save_salt_offset = 0;
+    u_char          salt[BYTESIZE(USM_MAX_SALT_LENGTH)];
+    u_char          authParams[USM_MAX_AUTHSIZE];
+    u_char          iv[BYTESIZE(USM_MAX_SALT_LENGTH)];
+    size_t          sp_offset = 0, mac_offset = 0;
+    int             rc = 0;
+
+    DEBUGMSGTL(("usm", "USM processing has begun (offset %d)\n", *offset));
+
+    if (secStateRef != NULL) {
+        /*
+         * To hush the compiler for now.  XXX 
+         */
+        struct usmStateReference *ref
+            = (struct usmStateReference *) secStateRef;
+
+        theName = ref->usr_name;
+        theNameLength = ref->usr_name_length;
+        theEngineID = ref->usr_engine_id;
+        theEngineIDLength = ref->usr_engine_id_length;
+
+        if (!theEngineIDLength) {
+            theEngineID = secEngineID;
+            theEngineIDLength = secEngineIDLen;
+        }
+
+        theAuthProtocol = ref->usr_auth_protocol;
+        theAuthProtocolLength = ref->usr_auth_protocol_length;
+        theAuthKey = ref->usr_auth_key;
+        theAuthKeyLength = ref->usr_auth_key_length;
+        thePrivProtocol = ref->usr_priv_protocol;
+        thePrivProtocolLength = ref->usr_priv_protocol_length;
+        thePrivKey = ref->usr_priv_key;
+        thePrivKeyLength = ref->usr_priv_key_length;
+        theSecLevel = ref->usr_sec_level;
+    }
+
+    /*
+     * * Identify the user record.
+     */
+    else {
+        struct usmUser *user;
+
+        /*
+         * we do allow an unknown user name for
+         * unauthenticated requests. 
+         */
+        if ((user = usm_get_user(secEngineID, secEngineIDLen, secName))
+            == NULL && secLevel != SNMP_SEC_LEVEL_NOAUTH) {
+            DEBUGMSGTL(("usm", "Unknown User\n"));
+            usm_free_usmStateReference(secStateRef);
+            return SNMPERR_USM_UNKNOWNSECURITYNAME;
+        }
+
+        theName = secName;
+        theNameLength = secNameLen;
+        theEngineID = secEngineID;
+        theSecLevel = secLevel;
+        theEngineIDLength = secEngineIDLen;
+        if (user) {
+            theAuthProtocol = user->authProtocol;
+            theAuthProtocolLength = user->authProtocolLen;
+            theAuthKey = user->authKey;
+            theAuthKeyLength = user->authKeyLen;
+            thePrivProtocol = user->privProtocol;
+            thePrivProtocolLength = user->privProtocolLen;
+            thePrivKey = user->privKey;
+            thePrivKeyLength = user->privKeyLen;
+        } else {
+            /*
+             * unknown users can not do authentication (obviously) 
+             */
+            theAuthProtocol = usmNoAuthProtocol;
+            theAuthProtocolLength =
+                sizeof(usmNoAuthProtocol) / sizeof(oid);
+            theAuthKey = NULL;
+            theAuthKeyLength = 0;
+            thePrivProtocol = usmNoPrivProtocol;
+            thePrivProtocolLength =
+                sizeof(usmNoPrivProtocol) / sizeof(oid);
+            thePrivKey = NULL;
+            thePrivKeyLength = 0;
+        }
+    }                           /* endif -- secStateRef==NULL */
+
+
+    /*
+     * From here to the end of the function, avoid reference to
+     * secName, secEngineID, secLevel, and associated lengths.
+     */
+
+
+    /*
+     * Check to see if the user can use the requested sec services.
+     */
+    if (usm_check_secLevel_vs_protocols(theSecLevel,
+                                        theAuthProtocol,
+                                        theAuthProtocolLength,
+                                        thePrivProtocol,
+                                        thePrivProtocolLength) == 1) {
+        DEBUGMSGTL(("usm", "Unsupported Security Level or type (%d)\n",
+                    theSecLevel));
+
+        usm_free_usmStateReference(secStateRef);
+        return SNMPERR_USM_UNSUPPORTEDSECURITYLEVEL;
+    }
+
+
+    /*
+     * * Retrieve the engine information.
+     * *
+     * * XXX    No error is declared in the EoP when sending messages to
+     * *        unknown engines, processing continues w/ boots/time == (0,0).
+     */
+    if (get_enginetime(theEngineID, theEngineIDLength,
+                       &boots_uint, &time_uint, FALSE) == -1) {
+        DEBUGMSGTL(("usm", "%s\n", "Failed to find engine data."));
+    }
+
+    boots_long = boots_uint;
+    time_long = time_uint;
+
+    if (theSecLevel == SNMP_SEC_LEVEL_AUTHPRIV) {
+        /*
+         * Initially assume that the ciphertext will end up the same size as
+         * the plaintext plus some padding.  Really sc_encrypt ought to be able
+         * to grow this for us, a la asn_realloc_rbuild_<type> functions, but
+         * this will do for now.  
+         */
+        u_char         *ciphertext = NULL;
+        size_t          ciphertextlen = scopedPduLen + 64;
+
+        if ((ciphertext = (u_char *) malloc(ciphertextlen)) == NULL) {
+            DEBUGMSGTL(("usm",
+                        "couldn't malloc %d bytes for encrypted PDU\n",
+                        ciphertextlen));
+            usm_free_usmStateReference(secStateRef);
+            return SNMPERR_MALLOC;
+        }
+
+        /*
+         * XXX Hardwired to seek into a 1DES private key!  
+         */
+#ifdef HAVE_AES
+        if (ISTRANSFORM(thePrivProtocol, AES128Priv) ||
+            ISTRANSFORM(thePrivProtocol, AES192Priv) ||
+            ISTRANSFORM(thePrivProtocol, AES256Priv)) {
+            salt_length = BYTESIZE(USM_AES_SALT_LENGTH);
+            save_salt_length = BYTESIZE(USM_AES_SALT_LENGTH)/2;
+            save_salt_offset = 0;
+            if (!thePrivKey ||
+                usm_set_aes_iv(salt, &salt_length,
+                               htonl(boots_uint), htonl(time_uint),
+                               iv) == -1) {
+                DEBUGMSGTL(("usm", "Can't set AES iv.\n"));
+                usm_free_usmStateReference(secStateRef);
+                free(ciphertext);
+                return SNMPERR_USM_GENERICERROR;
+            }
+        } else if (ISTRANSFORM(thePrivProtocol, DESPriv)) {
+#endif
+            salt_length = BYTESIZE(USM_DES_SALT_LENGTH);
+            save_salt_length = BYTESIZE(USM_DES_SALT_LENGTH);
+            save_salt_offset = 0;
+            if (!thePrivKey || (usm_set_salt(salt, &salt_length,
+                                             thePrivKey + 8,
+                                             thePrivKeyLength - 8,
+                                             iv) == -1)) {
+                DEBUGMSGTL(("usm", "Can't set DES-CBC salt.\n"));
+                usm_free_usmStateReference(secStateRef);
+                free(ciphertext);
+                return SNMPERR_USM_GENERICERROR;
+            }
+#ifdef HAVE_AES
+        }
+#endif
+#ifdef SNMP_TESTING_CODE
+        if (debug_is_token_registered("usm/dump") == SNMPERR_SUCCESS) {
+            dump_chunk("usm/dump", "This data was encrypted:",
+                       scopedPdu, scopedPduLen);
+        }
+#endif
+
+        if (sc_encrypt(thePrivProtocol, thePrivProtocolLength,
+                       thePrivKey, thePrivKeyLength,
+                       salt, salt_length,
+                       scopedPdu, scopedPduLen,
+                       ciphertext, &ciphertextlen) != SNMP_ERR_NOERROR) {
+            DEBUGMSGTL(("usm", "DES-CBC error.\n"));
+            usm_free_usmStateReference(secStateRef);
+            free(ciphertext);
+            return SNMPERR_USM_ENCRYPTIONERROR;
+        }
+
+        /*
+         * Write the encrypted scopedPdu back into the packet buffer.  
+         */
+
+#ifdef SNMP_TESTING_CODE
+        theTotalLength = *wholeMsgLen;
+#endif
+        *offset = 0;
+        rc = asn_realloc_rbuild_string(wholeMsg, wholeMsgLen, offset, 1,
+                                       (u_char) (ASN_UNIVERSAL |
+                                                 ASN_PRIMITIVE |
+                                                 ASN_OCTET_STR),
+                                       ciphertext, ciphertextlen);
+#ifdef SNMP_TESTING_CODE
+        if (debug_is_token_registered("usm/dump") == SNMPERR_SUCCESS) {
+            dump_chunk("usm/dump", "salt + Encrypted form: ", salt,
+                       salt_length);
+            dump_chunk("usm/dump", "wholeMsg:",
+                       (*wholeMsg + *wholeMsgLen - *offset), *offset);
+        }
+#endif
+
+        DEBUGMSGTL(("usm", "Encryption successful.\n"));
+        free(ciphertext);
+    } else {
+        /*
+         * theSecLevel != SNMP_SEC_LEVEL_AUTHPRIV  
+         */
+    }
+
+    /*
+     * Start encoding the msgSecurityParameters.  
+     */
+
+    sp_offset = *offset;
+
+    DEBUGDUMPHEADER("send", "msgPrivacyParameters");
+    /*
+     * msgPrivacyParameters (warning: assumes DES salt).  
+     */
+    rc = asn_realloc_rbuild_string(wholeMsg, wholeMsgLen, offset, 1,
+                                   (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE
+                                             | ASN_OCTET_STR),
+                                   iv,
+                                   save_salt_length);
+    DEBUGINDENTLESS();
+    if (rc == 0) {
+        DEBUGMSGTL(("usm", "building privParams failed.\n"));
+        usm_free_usmStateReference(secStateRef);
+        return SNMPERR_TOO_LONG;
+    }
+
+    DEBUGDUMPHEADER("send", "msgAuthenticationParameters");
+    /*
+     * msgAuthenticationParameters (warnings assumes 0x00 by 12).  
+     */
+    if (theSecLevel == SNMP_SEC_LEVEL_AUTHNOPRIV
+        || theSecLevel == SNMP_SEC_LEVEL_AUTHPRIV) {
+        memset(authParams, 0, USM_MD5_AND_SHA_AUTH_LEN);
+        msgAuthParmLen = USM_MD5_AND_SHA_AUTH_LEN;
+    }
+
+    rc = asn_realloc_rbuild_string(wholeMsg, wholeMsgLen, offset, 1,
+                                   (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE
+                                             | ASN_OCTET_STR), authParams,
+                                   msgAuthParmLen);
+    DEBUGINDENTLESS();
+    if (rc == 0) {
+        DEBUGMSGTL(("usm", "building authParams failed.\n"));
+        usm_free_usmStateReference(secStateRef);
+        return SNMPERR_TOO_LONG;
+    }
+
+    /*
+     * Remember where to put the actual HMAC we calculate later on.  An
+     * encoded OCTET STRING of length USM_MD5_AND_SHA_AUTH_LEN has an ASN.1
+     * header of length 2, hence the fudge factor.  
+     */
+
+    mac_offset = *offset - 2;
+
+    /*
+     * msgUserName.  
+     */
+    DEBUGDUMPHEADER("send", "msgUserName");
+    rc = asn_realloc_rbuild_string(wholeMsg, wholeMsgLen, offset, 1,
+                                   (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE
+                                             | ASN_OCTET_STR),
+                                   (u_char *) theName, theNameLength);
+    DEBUGINDENTLESS();
+    if (rc == 0) {
+        DEBUGMSGTL(("usm", "building authParams failed.\n"));
+        usm_free_usmStateReference(secStateRef);
+        return SNMPERR_TOO_LONG;
+    }
+
+    /*
+     * msgAuthoritativeEngineTime.  
+     */
+    DEBUGDUMPHEADER("send", "msgAuthoritativeEngineTime");
+    rc = asn_realloc_rbuild_int(wholeMsg, wholeMsgLen, offset, 1,
+                                (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE |
+                                          ASN_INTEGER), &time_long,
+                                sizeof(long));
+    DEBUGINDENTLESS();
+    if (rc == 0) {
+        DEBUGMSGTL(("usm",
+                    "building msgAuthoritativeEngineTime failed.\n"));
+        usm_free_usmStateReference(secStateRef);
+        return SNMPERR_TOO_LONG;
+    }
+
+    /*
+     * msgAuthoritativeEngineBoots.  
+     */
+    DEBUGDUMPHEADER("send", "msgAuthoritativeEngineBoots");
+    rc = asn_realloc_rbuild_int(wholeMsg, wholeMsgLen, offset, 1,
+                                (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE |
+                                          ASN_INTEGER), &boots_long,
+                                sizeof(long));
+    DEBUGINDENTLESS();
+    if (rc == 0) {
+        DEBUGMSGTL(("usm",
+                    "building msgAuthoritativeEngineBoots failed.\n"));
+        usm_free_usmStateReference(secStateRef);
+        return SNMPERR_TOO_LONG;
+    }
+
+    DEBUGDUMPHEADER("send", "msgAuthoritativeEngineID");
+    rc = asn_realloc_rbuild_string(wholeMsg, wholeMsgLen, offset, 1,
+                                   (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE
+                                             | ASN_OCTET_STR), theEngineID,
+                                   theEngineIDLength);
+    DEBUGINDENTLESS();
+    if (rc == 0) {
+        DEBUGMSGTL(("usm", "building msgAuthoritativeEngineID failed.\n"));
+        usm_free_usmStateReference(secStateRef);
+        return SNMPERR_TOO_LONG;
+    }
+
+    /*
+     * USM msgSecurityParameters sequence header  
+     */
+    rc = asn_realloc_rbuild_sequence(wholeMsg, wholeMsgLen, offset, 1,
+                                     (u_char) (ASN_SEQUENCE |
+                                               ASN_CONSTRUCTOR),
+                                     *offset - sp_offset);
+    if (rc == 0) {
+        DEBUGMSGTL(("usm", "building usm security parameters failed.\n"));
+        usm_free_usmStateReference(secStateRef);
+        return SNMPERR_TOO_LONG;
+    }
+
+    /*
+     * msgSecurityParameters OCTET STRING wrapper.  
+     */
+    rc = asn_realloc_rbuild_header(wholeMsg, wholeMsgLen, offset, 1,
+                                   (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE
+                                             | ASN_OCTET_STR),
+                                   *offset - sp_offset);
+
+    if (rc == 0) {
+        DEBUGMSGTL(("usm", "building msgSecurityParameters failed.\n"));
+        usm_free_usmStateReference(secStateRef);
+        return SNMPERR_TOO_LONG;
+    }
+
+    /*
+     * Copy in the msgGlobalData and msgVersion.  
+     */
+    while ((*wholeMsgLen - *offset) < globalDataLen) {
+        if (!asn_realloc(wholeMsg, wholeMsgLen)) {
+            DEBUGMSGTL(("usm", "building global data failed.\n"));
+            usm_free_usmStateReference(secStateRef);
+            return SNMPERR_TOO_LONG;
+        }
+    }
+
+    *offset += globalDataLen;
+    memcpy(*wholeMsg + *wholeMsgLen - *offset, globalData, globalDataLen);
+
+    /*
+     * Total packet sequence.  
+     */
+    rc = asn_realloc_rbuild_sequence(wholeMsg, wholeMsgLen, offset, 1,
+                                     (u_char) (ASN_SEQUENCE |
+                                               ASN_CONSTRUCTOR), *offset);
+    if (rc == 0) {
+        DEBUGMSGTL(("usm", "building master packet sequence failed.\n"));
+        usm_free_usmStateReference(secStateRef);
+        return SNMPERR_TOO_LONG;
+    }
+
+    /*
+     * Now consider / do authentication.  
+     */
+
+    if (theSecLevel == SNMP_SEC_LEVEL_AUTHNOPRIV ||
+        theSecLevel == SNMP_SEC_LEVEL_AUTHPRIV) {
+        size_t          temp_sig_len = msgAuthParmLen;
+        u_char         *temp_sig = (u_char *) malloc(temp_sig_len);
+        u_char         *proto_msg = *wholeMsg + *wholeMsgLen - *offset;
+        size_t          proto_msg_len = *offset;
+
+
+        if (temp_sig == NULL) {
+            DEBUGMSGTL(("usm", "Out of memory.\n"));
+            usm_free_usmStateReference(secStateRef);
+            return SNMPERR_USM_GENERICERROR;
+        }
+
+        if (sc_generate_keyed_hash(theAuthProtocol, theAuthProtocolLength,
+                                   theAuthKey, theAuthKeyLength,
+                                   proto_msg, proto_msg_len,
+                                   temp_sig, &temp_sig_len)
+            != SNMP_ERR_NOERROR) {
+            SNMP_FREE(temp_sig);
+            DEBUGMSGTL(("usm", "Signing failed.\n"));
+            usm_free_usmStateReference(secStateRef);
+            return SNMPERR_USM_AUTHENTICATIONFAILURE;
+        }
+
+        if (temp_sig_len != msgAuthParmLen) {
+            SNMP_FREE(temp_sig);
+            DEBUGMSGTL(("usm", "Signing lengths failed.\n"));
+            usm_free_usmStateReference(secStateRef);
+            return SNMPERR_USM_AUTHENTICATIONFAILURE;
+        }
+
+        memcpy(*wholeMsg + *wholeMsgLen - mac_offset, temp_sig,
+               msgAuthParmLen);
+        SNMP_FREE(temp_sig);
+    }
+    /*
+     * endif -- create keyed hash 
+     */
+    usm_free_usmStateReference(secStateRef);
+    DEBUGMSGTL(("usm", "USM processing completed.\n"));
+    return SNMPERR_SUCCESS;
+}                               /* end usm_rgenerate_out_msg() */
+
+#endif                          /* */
+
+
+
+/*******************************************************************-o-******
+ * usm_parse_security_parameters
+ *
+ * Parameters:
+ *	(See list below...)
+ *      
+ * Returns:
+ *	0	On success,
+ *	-1	Otherwise.
+ *
+ *	tab stop 4
+ *
+ *	Extracts values from the security header and data portions of the
+ *	incoming buffer.
+ */
+int
+usm_parse_security_parameters(u_char * secParams,
+                              size_t remaining,
+                              u_char * secEngineID,
+                              size_t * secEngineIDLen,
+                              u_int * boots_uint,
+                              u_int * time_uint,
+                              char *secName,
+                              size_t * secNameLen,
+                              u_char * signature,
+                              size_t * signature_length,
+                              u_char * salt,
+                              size_t * salt_length, u_char ** data_ptr)
+{
+    u_char         *parse_ptr = secParams;
+    u_char         *value_ptr;
+    u_char         *next_ptr;
+    u_char          type_value;
+
+    size_t          octet_string_length = remaining;
+    size_t          sequence_length;
+    size_t          remaining_bytes;
+
+    long            boots_long;
+    long            time_long;
+
+    u_int           origNameLen;
+
+
+    /*
+     * Eat the first octet header.
+     */
+    if ((value_ptr = asn_parse_sequence(parse_ptr, &octet_string_length,
+                                        &type_value,
+                                        (ASN_UNIVERSAL | ASN_PRIMITIVE |
+                                         ASN_OCTET_STR),
+                                        "usm first octet")) == NULL) {
+        /*
+         * RETURN parse error 
+         */ return -1;
+    }
+
+
+    /*
+     * Eat the sequence header.
+     */
+    parse_ptr = value_ptr;
+    sequence_length = octet_string_length;
+
+    if ((value_ptr = asn_parse_sequence(parse_ptr, &sequence_length,
+                                        &type_value,
+                                        (ASN_SEQUENCE | ASN_CONSTRUCTOR),
+                                        "usm sequence")) == NULL) {
+        /*
+         * RETURN parse error 
+         */ return -1;
+    }
+
+
+    /*
+     * Retrieve the engineID.
+     */
+    parse_ptr = value_ptr;
+    remaining_bytes = sequence_length;
+
+    DEBUGDUMPHEADER("recv", "msgAuthoritativeEngineID");
+    if ((next_ptr
+         = asn_parse_string(parse_ptr, &remaining_bytes, &type_value,
+                            secEngineID, secEngineIDLen)) == NULL) {
+        DEBUGINDENTLESS();
+        /*
+         * RETURN parse error 
+         */ return -1;
+    }
+    DEBUGINDENTLESS();
+
+    if (type_value !=
+        (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE | ASN_OCTET_STR)) {
+        /*
+         * RETURN parse error 
+         */ return -1;
+    }
+
+
+    /*
+     * Retrieve the engine boots, notice switch in the way next_ptr and
+     * remaining_bytes are used (to accomodate the asn code).
+     */
+    DEBUGDUMPHEADER("recv", "msgAuthoritativeEngineBoots");
+    if ((next_ptr = asn_parse_int(next_ptr, &remaining_bytes, &type_value,
+                                  &boots_long, sizeof(long))) == NULL) {
+        DEBUGINDENTLESS();
+        /*
+         * RETURN parse error 
+         */ return -1;
+    }
+    DEBUGINDENTLESS();
+
+    if (type_value !=
+        (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE | ASN_INTEGER)) {
+        DEBUGINDENTLESS();
+        /*
+         * RETURN parse error 
+         */ return -1;
+    }
+
+    *boots_uint = (u_int) boots_long;
+
+
+    /*
+     * Retrieve the time value.
+     */
+    DEBUGDUMPHEADER("recv", "msgAuthoritativeEngineTime");
+    if ((next_ptr = asn_parse_int(next_ptr, &remaining_bytes, &type_value,
+                                  &time_long, sizeof(long))) == NULL) {
+        /*
+         * RETURN parse error 
+         */ return -1;
+    }
+    DEBUGINDENTLESS();
+
+    if (type_value !=
+        (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE | ASN_INTEGER)) {
+        /*
+         * RETURN parse error 
+         */ return -1;
+    }
+
+    *time_uint = (u_int) time_long;
+
+
+    /*
+     * Retrieve the secName.
+     */
+    origNameLen = *secNameLen;
+
+
+    DEBUGDUMPHEADER("recv", "msgUserName");
+    if ((next_ptr
+         = asn_parse_string(next_ptr, &remaining_bytes, &type_value,
+                            (u_char *) secName, secNameLen)) == NULL) {
+        DEBUGINDENTLESS();
+        /*
+         * RETURN parse error 
+         */ return -1;
+    }
+    DEBUGINDENTLESS();
+
+    /*
+     * FIX -- doesn't this also indicate a buffer overrun?
+     */
+    if ((int) origNameLen < *secNameLen + 1) {
+        /*
+         * RETURN parse error, but it's really a parameter error 
+         */
+        return -1;
+    }
+
+    if (*secNameLen > 32) {
+        /*
+         * This is a USM-specific limitation over and above the above
+         * limitation (which will probably default to the length of an
+         * SnmpAdminString, i.e. 255).  See RFC 2574, sec. 2.4.  
+         */
+        return -1;
+    }
+
+    secName[*secNameLen] = '\0';
+
+    if (type_value !=
+        (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE | ASN_OCTET_STR)) {
+        /*
+         * RETURN parse error 
+         */ return -1;
+    }
+
+
+    /*
+     * Retrieve the signature and blank it if there.
+     */
+    DEBUGDUMPHEADER("recv", "msgAuthenticationParameters");
+    if ((next_ptr
+         = asn_parse_string(next_ptr, &remaining_bytes, &type_value,
+                            signature, signature_length)) == NULL) {
+        DEBUGINDENTLESS();
+        /*
+         * RETURN parse error 
+         */ return -1;
+    }
+    DEBUGINDENTLESS();
+
+    if (type_value !=
+        (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE | ASN_OCTET_STR)) {
+        /*
+         * RETURN parse error 
+         */ return -1;
+    }
+
+    if (*signature_length != 0) {       /* Blanking for authentication step later */
+        memset(next_ptr - (u_long) * signature_length,
+               0, *signature_length);
+    }
+
+
+    /*
+     * Retrieve the salt.
+     *
+     * Note that the next ptr is where the data section starts.
+     */
+    DEBUGDUMPHEADER("recv", "msgPrivacyParameters");
+    if ((*data_ptr
+         = asn_parse_string(next_ptr, &remaining_bytes, &type_value,
+                            salt, salt_length)) == NULL) {
+        DEBUGINDENTLESS();
+        /*
+         * RETURN parse error 
+         */ return -2;
+    }
+    DEBUGINDENTLESS();
+
+    if (type_value !=
+        (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE | ASN_OCTET_STR)) {
+        /*
+         * RETURN parse error 
+         */ return -2;
+    }
+
+    return 0;
+
+}                               /* end usm_parse_security_parameters() */
+
+
+
+
+/*******************************************************************-o-******
+ * usm_check_and_update_timeliness
+ *
+ * Parameters:
+ *	*secEngineID
+ *	 secEngineIDen
+ *	 boots_uint
+ *	 time_uint
+ *	*error
+ *      
+ * Returns:
+ *	0	On success,
+ *	-1	Otherwise.
+ *	
+ *
+ * Performs the incoming timeliness checking and setting.
+ */
+int
+usm_check_and_update_timeliness(u_char * secEngineID,
+                                size_t secEngineIDLen,
+                                u_int boots_uint,
+                                u_int time_uint, int *error)
+{
+    u_char          myID[USM_MAX_ID_LENGTH];
+    u_long          myIDLength =
+        snmpv3_get_engineID(myID, USM_MAX_ID_LENGTH);
+    u_int           myBoots;
+    u_int           myTime;
+
+
+
+    if ((myIDLength > USM_MAX_ID_LENGTH) || (myIDLength == 0)) {
+        /*
+         * We're probably already screwed...buffer overwrite.  XXX? 
+         */
+        DEBUGMSGTL(("usm", "Buffer overflow.\n"));
+        *error = SNMPERR_USM_GENERICERROR;
+        return -1;
+    }
+
+    myBoots = snmpv3_local_snmpEngineBoots();
+    myTime = snmpv3_local_snmpEngineTime();
+
+
+    /*
+     * IF the time involved is local
+     *     Make sure  message is inside the time window 
+     * ELSE 
+     *      IF boots is higher or boots is the same and time is higher
+     *              remember this new data
+     *      ELSE
+     *              IF !(boots same and time within USM_TIME_WINDOW secs)
+     *                      Message is too old 
+     *              ELSE    
+     *                      Message is ok, but don't take time
+     *              ENDIF
+     *      ENDIF
+     * ENDIF
+     */
+
+    /*
+     * This is a local reference.
+     */
+    if ((int) secEngineIDLen == myIDLength
+        && memcmp(secEngineID, myID, myIDLength) == 0) {
+        u_int           time_difference = myTime > time_uint ?
+            myTime - time_uint : time_uint - myTime;
+
+        if (boots_uint == ENGINEBOOT_MAX
+            || boots_uint != myBoots
+            || time_difference > USM_TIME_WINDOW) {
+            if (snmp_increment_statistic(STAT_USMSTATSNOTINTIMEWINDOWS) ==
+                0) {
+                DEBUGMSGTL(("usm", "%s\n",
+                            "Failed to increment statistic."));
+            }
+
+            DEBUGMSGTL(("usm",
+                        "boot_uint %u myBoots %u time_diff %u => not in time window\n",
+                        boots_uint, myBoots, time_difference));
+            *error = SNMPERR_USM_NOTINTIMEWINDOW;
+            return -1;
+        }
+
+        *error = SNMPERR_SUCCESS;
+        return 0;
+    }
+
+    /*
+     * This is a remote reference.
+     */
+    else {
+        u_int           theirBoots, theirTime, theirLastTime;
+        u_int           time_difference;
+
+        if (get_enginetime_ex(secEngineID, secEngineIDLen,
+                              &theirBoots, &theirTime,
+                              &theirLastTime, TRUE)
+            != SNMPERR_SUCCESS) {
+            DEBUGMSGTL(("usm", "%s\n",
+                        "Failed to get remote engine's times."));
+
+            *error = SNMPERR_USM_GENERICERROR;
+            return -1;
+        }
+
+        time_difference = theirTime > time_uint ?
+            theirTime - time_uint : time_uint - theirTime;
+
+
+        /*
+         * XXX  Contrary to the pseudocode:
+         *      See if boots is invalid first.
+         */
+        if (theirBoots == ENGINEBOOT_MAX || theirBoots > boots_uint) {
+            DEBUGMSGTL(("usm", "%s\n", "Remote boot count invalid."));
+
+            *error = SNMPERR_USM_NOTINTIMEWINDOW;
+            return -1;
+        }
+
+
+        /*
+         * Boots is ok, see if the boots is the same but the time
+         * is old.
+         */
+        if (theirBoots == boots_uint && time_uint < theirLastTime) {
+            if (time_difference > USM_TIME_WINDOW) {
+                DEBUGMSGTL(("usm", "%s\n", "Message too old."));
+                *error = SNMPERR_USM_NOTINTIMEWINDOW;
+                return -1;
+            }
+
+            else {              /* Old, but acceptable */
+
+                *error = SNMPERR_SUCCESS;
+                return 0;
+            }
+        }
+
+
+        /*
+         * Message is ok, either boots has been advanced, or
+         * time is greater than before with the same boots.
+         */
+
+        if (set_enginetime(secEngineID, secEngineIDLen,
+                           boots_uint, time_uint, TRUE)
+            != SNMPERR_SUCCESS) {
+            DEBUGMSGTL(("usm", "%s\n",
+                        "Failed updating remote boot/time."));
+            *error = SNMPERR_USM_GENERICERROR;
+            return -1;
+        }
+
+        *error = SNMPERR_SUCCESS;
+        return 0;               /* Fresh message and time updated */
+
+    }                           /* endif -- local or remote time reference. */
+
+
+}                               /* end usm_check_and_update_timeliness() */
+
+
+
+int
+usm_secmod_process_in_msg(struct snmp_secmod_incoming_params *parms)
+{
+    if (!parms)
+        return SNMPERR_GENERR;
+
+    return usm_process_in_msg(parms->msgProcModel,
+                              parms->maxMsgSize,
+                              parms->secParams,
+                              parms->secModel,
+                              parms->secLevel,
+                              parms->wholeMsg,
+                              parms->wholeMsgLen,
+                              parms->secEngineID,
+                              parms->secEngineIDLen,
+                              parms->secName,
+                              parms->secNameLen,
+                              parms->scopedPdu,
+                              parms->scopedPduLen,
+                              parms->maxSizeResponse,
+                              parms->secStateRef,
+                              parms->sess, parms->msg_flags);
+}
+
+/*******************************************************************-o-******
+ * usm_process_in_msg
+ *
+ * Parameters:
+ *	(See list below...)
+ *      
+ * Returns:
+ *	SNMPERR_SUCCESS			On success.
+ *	SNMPERR_USM_AUTHENTICATIONFAILURE
+ *	SNMPERR_USM_DECRYPTIONERROR
+ *	SNMPERR_USM_GENERICERROR
+ *	SNMPERR_USM_PARSEERROR
+ *	SNMPERR_USM_UNKNOWNENGINEID
+ *	SNMPERR_USM_PARSEERROR
+ *	SNMPERR_USM_UNKNOWNSECURITYNAME
+ *	SNMPERR_USM_UNSUPPORTEDSECURITYLEVEL
+ *
+ *
+ * ASSUMES size of decrypt_buf will always be >= size of encrypted sPDU.
+ *
+ * FIX  Memory leaks if secStateRef is allocated and a return occurs
+ *	without cleaning up.  May contain secrets...
+ */
+int
+usm_process_in_msg(int msgProcModel,    /* (UNUSED) */
+                   size_t maxMsgSize,   /* IN     - Used to calc maxSizeResponse.  */
+                   u_char * secParams,  /* IN     - BER encoded securityParameters. */
+                   int secModel,        /* (UNUSED) */
+                   int secLevel,        /* IN     - AuthNoPriv, authPriv etc.      */
+                   u_char * wholeMsg,   /* IN     - Original v3 message.           */
+                   size_t wholeMsgLen,  /* IN     - Msg length.                    */
+                   u_char * secEngineID,        /* OUT    - Pointer snmpEngineID.          */
+                   size_t * secEngineIDLen,     /* IN/OUT - Len available, len returned.   */
+                   /*
+                    * NOTE: Memory provided by caller.      
+                    */
+                   char *secName,       /* OUT    - Pointer to securityName.       */
+                   size_t * secNameLen, /* IN/OUT - Len available, len returned.   */
+                   u_char ** scopedPdu, /* OUT    - Pointer to plaintext scopedPdu. */
+                   size_t * scopedPduLen,       /* IN/OUT - Len available, len returned.   */
+                   size_t * maxSizeResponse,    /* OUT    - Max size of Response PDU.      */
+                   void **secStateRf,   /* OUT    - Ref to security state.         */
+                   netsnmp_session * sess,      /* IN     - session which got the message  */
+                   u_char msg_flags)
+{                               /* IN     - v3 Message flags.              */
+    size_t          remaining = wholeMsgLen - (u_int)
+        ((u_long) * secParams - (u_long) * wholeMsg);
+    u_int           boots_uint;
+    u_int           time_uint;
+#ifdef HAVE_AES
+    u_int           net_boots, net_time;
+#endif
+    u_char          signature[BYTESIZE(USM_MAX_KEYEDHASH_LENGTH)];
+    size_t          signature_length = BYTESIZE(USM_MAX_KEYEDHASH_LENGTH);
+    u_char          salt[BYTESIZE(USM_MAX_SALT_LENGTH)];
+    size_t          salt_length = BYTESIZE(USM_MAX_SALT_LENGTH);
+    u_char          iv[BYTESIZE(USM_MAX_SALT_LENGTH)];
+    u_int           iv_length = BYTESIZE(USM_MAX_SALT_LENGTH);
+    u_char         *data_ptr;
+    u_char         *value_ptr;
+    u_char          type_value;
+    u_char         *end_of_overhead;
+    int             error;
+    int             i, rc = 0;
+    struct usmStateReference **secStateRef =
+        (struct usmStateReference **) secStateRf;
+
+    struct usmUser *user;
+
+
+    DEBUGMSGTL(("usm", "USM processing begun...\n"));
+
+
+    if (secStateRef) {
+        usm_free_usmStateReference(*secStateRef);
+        *secStateRef = usm_malloc_usmStateReference();
+        if (*secStateRef == NULL) {
+            DEBUGMSGTL(("usm", "Out of memory.\n"));
+            return SNMPERR_USM_GENERICERROR;
+        }
+    }
+
+
+    /*
+     * Make sure the *secParms is an OCTET STRING.
+     * Extract the user name, engine ID, and security level.
+     */
+    if ((rc = usm_parse_security_parameters(secParams, remaining,
+                                            secEngineID, secEngineIDLen,
+                                            &boots_uint, &time_uint,
+                                            secName, secNameLen,
+                                            signature, &signature_length,
+                                            salt, &salt_length,
+                                            &data_ptr)) < 0) {
+        DEBUGMSGTL(("usm", "Parsing failed (rc %d).\n", rc));
+        if (rc == -2) {
+            /*
+             * This indicates a decryptionError.  
+             */
+            if (snmp_increment_statistic(STAT_USMSTATSDECRYPTIONERRORS) ==
+                0) {
+                DEBUGMSGTL(("usm", "%s\n",
+                            "Failed to increment statistic."));
+            }
+            return SNMPERR_USM_DECRYPTIONERROR;
+        }
+        if (snmp_increment_statistic(STAT_SNMPINASNPARSEERRS) == 0) {
+            DEBUGMSGTL(("usm", "%s\n", "Failed to increment statistic."));
+        }
+        return SNMPERR_USM_PARSEERROR;
+    }
+
+
+    if (secLevel != SNMP_SEC_LEVEL_AUTHPRIV) {
+        /*
+         * pull these out now so reports can use them 
+         */
+        *scopedPdu = data_ptr;
+        *scopedPduLen = wholeMsgLen - (data_ptr - wholeMsg);
+        end_of_overhead = data_ptr;
+    }
+
+    if (secStateRef) {
+        /*
+         * Cache the name, engine ID, and security level,
+         * * per step 2 (section 3.2)
+         */
+        if (usm_set_usmStateReference_name
+            (*secStateRef, secName, *secNameLen) == -1) {
+            DEBUGMSGTL(("usm", "%s\n", "Couldn't cache name."));
+            return SNMPERR_USM_GENERICERROR;
+        }
+
+        if (usm_set_usmStateReference_engine_id
+            (*secStateRef, secEngineID, *secEngineIDLen) == -1) {
+            DEBUGMSGTL(("usm", "%s\n", "Couldn't cache engine id."));
+            return SNMPERR_USM_GENERICERROR;
+        }
+
+        if (usm_set_usmStateReference_sec_level(*secStateRef, secLevel) ==
+            -1) {
+            DEBUGMSGTL(("usm", "%s\n", "Couldn't cache security level."));
+            return SNMPERR_USM_GENERICERROR;
+        }
+    }
+
+
+    /*
+     * Locate the engine ID record.
+     * If it is unknown, then either create one or note this as an error.
+     */
+    if ((sess && (sess->isAuthoritative == SNMP_SESS_AUTHORITATIVE ||
+                  (sess->isAuthoritative == SNMP_SESS_UNKNOWNAUTH &&
+                   (msg_flags & SNMP_MSG_FLAG_RPRT_BIT)))) ||
+        (!sess && (msg_flags & SNMP_MSG_FLAG_RPRT_BIT))) {
+        if (ISENGINEKNOWN(secEngineID, *secEngineIDLen) == FALSE) {
+            DEBUGMSGTL(("usm", "Unknown Engine ID.\n"));
+            if (snmp_increment_statistic(STAT_USMSTATSUNKNOWNENGINEIDS) ==
+                0) {
+                DEBUGMSGTL(("usm", "%s\n",
+                            "Failed to increment statistic."));
+            }
+            return SNMPERR_USM_UNKNOWNENGINEID;
+        }
+    } else {
+        if (ENSURE_ENGINE_RECORD(secEngineID, *secEngineIDLen)
+            != SNMPERR_SUCCESS) {
+            DEBUGMSGTL(("usm", "%s\n", "Couldn't ensure engine record."));
+            return SNMPERR_USM_GENERICERROR;
+        }
+
+    }
+
+
+    /*
+     * Locate the User record.
+     * If the user/engine ID is unknown, report this as an error.
+     */
+    if ((user = usm_get_user_from_list(secEngineID, *secEngineIDLen,
+                                       secName, userList,
+                                       (sess->isAuthoritative ==
+                                        SNMP_SESS_AUTHORITATIVE) ? 0 : 1))
+        == NULL) {
+        DEBUGMSGTL(("usm", "Unknown User(%s)\n", secName));
+        if (snmp_increment_statistic(STAT_USMSTATSUNKNOWNUSERNAMES) == 0) {
+            DEBUGMSGTL(("usm", "%s\n", "Failed to increment statistic."));
+        }
+        return SNMPERR_USM_UNKNOWNSECURITYNAME;
+    }
+
+
+    /*
+     * Make sure the security level is appropriate.
+     */
+    if (usm_check_secLevel(secLevel, user) == 1) {
+        DEBUGMSGTL(("usm", "Unsupported Security Level (%d).\n",
+                    secLevel));
+        if (snmp_increment_statistic
+            (STAT_USMSTATSUNSUPPORTEDSECLEVELS) == 0) {
+            DEBUGMSGTL(("usm", "%s\n", "Failed to increment statistic."));
+        }
+        return SNMPERR_USM_UNSUPPORTEDSECURITYLEVEL;
+    }
+
+
+    /*
+     * Check the authentication credentials of the message.
+     */
+    if (secLevel == SNMP_SEC_LEVEL_AUTHNOPRIV
+        || secLevel == SNMP_SEC_LEVEL_AUTHPRIV) {
+        if (sc_check_keyed_hash(user->authProtocol, user->authProtocolLen,
+                                user->authKey, user->authKeyLen,
+                                wholeMsg, wholeMsgLen,
+                                signature, signature_length)
+            != SNMP_ERR_NOERROR) {
+            DEBUGMSGTL(("usm", "Verification failed.\n"));
+            if (snmp_increment_statistic(STAT_USMSTATSWRONGDIGESTS) == 0) {
+                DEBUGMSGTL(("usm", "%s\n",
+                            "Failed to increment statistic."));
+            }
+            return SNMPERR_USM_AUTHENTICATIONFAILURE;
+        }
+
+        DEBUGMSGTL(("usm", "Verification succeeded.\n"));
+    }
+
+
+    /*
+     * Steps 10-11  user is already set - relocated before timeliness 
+     * check in case it fails - still save user data for response.
+     *
+     * Cache the keys and protocol oids, per step 11 (s3.2).
+     */
+    if (secStateRef) {
+        if (usm_set_usmStateReference_auth_protocol(*secStateRef,
+                                                    user->authProtocol,
+                                                    user->
+                                                    authProtocolLen) ==
+            -1) {
+            DEBUGMSGTL(("usm", "%s\n",
+                        "Couldn't cache authentication protocol."));
+            return SNMPERR_USM_GENERICERROR;
+        }
+
+        if (usm_set_usmStateReference_auth_key(*secStateRef,
+                                               user->authKey,
+                                               user->authKeyLen) == -1) {
+            DEBUGMSGTL(("usm", "%s\n",
+                        "Couldn't cache authentiation key."));
+            return SNMPERR_USM_GENERICERROR;
+        }
+
+        if (usm_set_usmStateReference_priv_protocol(*secStateRef,
+                                                    user->privProtocol,
+                                                    user->
+                                                    privProtocolLen) ==
+            -1) {
+            DEBUGMSGTL(("usm", "%s\n",
+                        "Couldn't cache privacy protocol."));
+            return SNMPERR_USM_GENERICERROR;
+        }
+
+        if (usm_set_usmStateReference_priv_key(*secStateRef,
+                                               user->privKey,
+                                               user->privKeyLen) == -1) {
+            DEBUGMSGTL(("usm", "%s\n", "Couldn't cache privacy key."));
+            return SNMPERR_USM_GENERICERROR;
+        }
+    }
+
+
+    /*
+     * Perform the timeliness/time manager functions.
+     */
+    if (secLevel == SNMP_SEC_LEVEL_AUTHNOPRIV
+        || secLevel == SNMP_SEC_LEVEL_AUTHPRIV) {
+        if (usm_check_and_update_timeliness(secEngineID, *secEngineIDLen,
+                                            boots_uint, time_uint,
+                                            &error) == -1) {
+            return error;
+        }
+    }
+#ifdef							LCD_TIME_SYNC_OPT
+    /*
+     * Cache the unauthenticated time to use in case we don't have
+     * anything better - this guess will be no worse than (0,0)
+     * that we normally use.
+     */
+    else {
+        set_enginetime(secEngineID, *secEngineIDLen,
+                       boots_uint, time_uint, FALSE);
+    }
+#endif                          /* LCD_TIME_SYNC_OPT */
+
+
+    /*
+     * If needed, decrypt the scoped PDU.
+     */
+    if (secLevel == SNMP_SEC_LEVEL_AUTHPRIV) {
+        remaining = wholeMsgLen - (data_ptr - wholeMsg);
+
+        if ((value_ptr = asn_parse_sequence(data_ptr, &remaining,
+                                            &type_value,
+                                            (ASN_UNIVERSAL | ASN_PRIMITIVE
+                                             | ASN_OCTET_STR),
+                                            "encrypted sPDU")) == NULL) {
+            DEBUGMSGTL(("usm", "%s\n",
+                        "Failed while parsing encrypted sPDU."));
+            if (snmp_increment_statistic(STAT_SNMPINASNPARSEERRS) == 0) {
+                DEBUGMSGTL(("usm", "%s\n", "Failed increment statistic."));
+            }
+            usm_free_usmStateReference(*secStateRef);
+            *secStateRef = NULL;
+            return SNMPERR_USM_PARSEERROR;
+        }
+
+        if (ISTRANSFORM(user->privProtocol, DESPriv)) {
+            /*
+             * From RFC2574:
+             * 
+             * "Before decryption, the encrypted data length is verified.
+             * If the length of the OCTET STRING to be decrypted is not
+             * an integral multiple of 8 octets, the decryption process
+             * is halted and an appropriate exception noted."  
+             */
+
+            if (remaining % 8 != 0) {
+                DEBUGMSGTL(("usm",
+                            "Ciphertext is %lu bytes, not an integer multiple of 8 (rem %d)\n",
+                            remaining, remaining % 8));
+                if (snmp_increment_statistic(STAT_USMSTATSDECRYPTIONERRORS) ==
+                    0) {
+                    DEBUGMSGTL(("usm", "%s\n", "Failed increment statistic."));
+                }
+                usm_free_usmStateReference(*secStateRef);
+                *secStateRef = NULL;
+                return SNMPERR_USM_DECRYPTIONERROR;
+            }
+
+            end_of_overhead = value_ptr;
+
+            /*
+             * XOR the salt with the last (iv_length) bytes
+             * of the priv_key to obtain the IV.
+             */
+            iv_length = BYTESIZE(USM_DES_SALT_LENGTH);
+            for (i = 0; i < (int) iv_length; i++)
+                iv[i] = salt[i] ^ user->privKey[iv_length + i];
+        }
+#ifdef HAVE_AES
+        else if (ISTRANSFORM(user->privProtocol, AES128Priv) ||
+                 ISTRANSFORM(user->privProtocol, AES192Priv) ||
+                 ISTRANSFORM(user->privProtocol, AES256Priv)) {
+            iv_length = BYTESIZE(USM_AES_SALT_LENGTH);
+            net_boots = ntohl(boots_uint);
+            net_time = ntohl(time_uint);
+            memcpy(iv, &net_boots, 4);
+            memcpy(iv+4, &net_time, 4);
+            memcpy(iv+8, salt, salt_length);
+        }
+#endif
+        
+        if (sc_decrypt(user->privProtocol, user->privProtocolLen,
+                       user->privKey, user->privKeyLen,
+                       iv, iv_length,
+                       value_ptr, remaining, *scopedPdu, scopedPduLen)
+            != SNMP_ERR_NOERROR) {
+            DEBUGMSGTL(("usm", "%s\n", "Failed decryption."));
+            if (snmp_increment_statistic
+                (STAT_USMSTATSDECRYPTIONERRORS) == 0) {
+                DEBUGMSGTL(("usm", "%s\n", "Failed increment statistic."));
+            }
+            return SNMPERR_USM_DECRYPTIONERROR;
+        }
+#ifdef SNMP_TESTING_CODE
+        if (debug_is_token_registered("usm/dump") == SNMPERR_SUCCESS) {
+            dump_chunk("usm/dump", "Cypher Text", value_ptr, remaining);
+            dump_chunk("usm/dump", "salt + Encrypted form:",
+                       salt, salt_length);
+            dump_chunk("usm/dump", "IV + Encrypted form:", iv, iv_length);
+            dump_chunk("usm/dump", "Decrypted chunk:",
+                       *scopedPdu, *scopedPduLen);
+        }
+#endif
+    }
+    /*
+     * sPDU is plaintext.
+     */
+    else {
+        *scopedPdu = data_ptr;
+        *scopedPduLen = wholeMsgLen - (data_ptr - wholeMsg);
+        end_of_overhead = data_ptr;
+
+    }                           /* endif -- PDU decryption */
+
+
+    /*
+     * Calculate the biggest sPDU for the response (i.e., whole - ovrhd).
+     *
+     * FIX  Correct? 
+     */
+    *maxSizeResponse = maxMsgSize - (int)
+        ((u_long) end_of_overhead - (u_long) wholeMsg);
+
+
+    DEBUGMSGTL(("usm", "USM processing completed.\n"));
+
+    return SNMPERR_SUCCESS;
+
+}                               /* end usm_process_in_msg() */
+
+void
+init_usm(void)
+{
+    struct snmp_secmod_def *def;
+
+    DEBUGMSGTL(("init_usm", "unit_usm: %d %d\n", usmNoPrivProtocol[0],
+                usmNoPrivProtocol[1]));
+
+    sc_init();                  /* initalize scapi code */
+
+    /*
+     * register ourselves as a security service 
+     */
+    def = SNMP_MALLOC_STRUCT(snmp_secmod_def);
+    /*
+     * XXX: def->init_sess_secmod move stuff from snmp_api.c 
+     */
+    def->encode_reverse = usm_secmod_rgenerate_out_msg;
+    def->encode_forward = usm_secmod_generate_out_msg;
+    def->decode = usm_secmod_process_in_msg;
+    def->pdu_free_state_ref = usm_free_usmStateReference;
+    register_sec_mod(USM_SEC_MODEL_NUMBER, "usm", def);
+
+    snmp_register_callback(SNMP_CALLBACK_LIBRARY,
+                           SNMP_CALLBACK_POST_PREMIB_READ_CONFIG,
+                           init_usm_post_config, NULL);
+}
+
+/*
+ * initializations for the USM.
+ *
+ * Should be called after the (engineid) configuration files have been read.
+ *
+ * Set "arbitrary" portion of salt to a random number.
+ */
+int
+init_usm_post_config(int majorid, int minorid, void *serverarg,
+                     void *clientarg)
+{
+    size_t          salt_integer_len = sizeof(salt_integer);
+
+    if (sc_random((u_char *) & salt_integer, &salt_integer_len) !=
+        SNMPERR_SUCCESS) {
+        DEBUGMSGTL(("usm", "sc_random() failed: using time() as salt.\n"));
+        salt_integer = (u_int) time(NULL);
+    }
+
+#ifdef HAVE_AES
+    salt_integer_len = sizeof (salt_integer64_1);
+    if (sc_random((u_char *) & salt_integer64_1, &salt_integer_len) !=
+        SNMPERR_SUCCESS) {
+        DEBUGMSGTL(("usm", "sc_random() failed: using time() as aes1 salt.\n"));
+        salt_integer64_1 = (u_int) time(NULL);
+    }
+    salt_integer_len = sizeof (salt_integer64_1);
+    if (sc_random((u_char *) & salt_integer64_2, &salt_integer_len) !=
+        SNMPERR_SUCCESS) {
+        DEBUGMSGTL(("usm", "sc_random() failed: using time() as aes2 salt.\n"));
+        salt_integer64_2 = (u_int) time(NULL);
+    }
+#endif
+    
+    noNameUser = usm_create_initial_user("", usmHMACMD5AuthProtocol,
+                                         USM_LENGTH_OID_TRANSFORM,
+                                         usmDESPrivProtocol,
+                                         USM_LENGTH_OID_TRANSFORM);
+
+    SNMP_FREE(noNameUser->engineID);
+    noNameUser->engineIDLen = 0;
+
+    return SNMPERR_SUCCESS;
+}                               /* end init_usm_post_config() */
+
+
+/*******************************************************************-o-******
+ * usm_check_secLevel
+ *
+ * Parameters:
+ *	 level
+ *	*user
+ *      
+ * Returns:
+ *	0	On success,
+ *	-1	Otherwise.
+ *
+ * Checks that a given security level is valid for a given user.
+ */
+int
+usm_check_secLevel(int level, struct usmUser *user)
+{
+
+    DEBUGMSGTL(("comparex", "Comparing: %d %d ", usmNoPrivProtocol[0],
+                usmNoPrivProtocol[1]));
+    DEBUGMSGOID(("comparex", usmNoPrivProtocol,
+                 sizeof(usmNoPrivProtocol) / sizeof(oid)));
+    DEBUGMSG(("comparex", "\n"));
+    if (level == SNMP_SEC_LEVEL_AUTHPRIV
+        && (netsnmp_oid_equals(user->privProtocol, user->privProtocolLen,
+                             usmNoPrivProtocol,
+                             sizeof(usmNoPrivProtocol) / sizeof(oid)) ==
+            0)) {
+        DEBUGMSGTL(("usm", "Level: %d\n", level));
+        DEBUGMSGTL(("usm", "User (%s) Auth Protocol: ", user->name));
+        DEBUGMSGOID(("usm", user->authProtocol, user->authProtocolLen));
+        DEBUGMSG(("usm", ", User Priv Protocol: "));
+        DEBUGMSGOID(("usm", user->privProtocol, user->privProtocolLen));
+        DEBUGMSG(("usm", "\n"));
+        return 1;
+    }
+    if ((level == SNMP_SEC_LEVEL_AUTHPRIV
+         || level == SNMP_SEC_LEVEL_AUTHNOPRIV)
+        &&
+        (netsnmp_oid_equals
+         (user->authProtocol, user->authProtocolLen, usmNoAuthProtocol,
+          sizeof(usmNoAuthProtocol) / sizeof(oid)) == 0)) {
+        DEBUGMSGTL(("usm", "Level: %d\n", level));
+        DEBUGMSGTL(("usm", "User (%s) Auth Protocol: ", user->name));
+        DEBUGMSGOID(("usm", user->authProtocol, user->authProtocolLen));
+        DEBUGMSG(("usm", ", User Priv Protocol: "));
+        DEBUGMSGOID(("usm", user->privProtocol, user->privProtocolLen));
+        DEBUGMSG(("usm", "\n"));
+        return 1;
+    }
+
+    return 0;
+
+}                               /* end usm_check_secLevel() */
+
+
+
+
+/*******************************************************************-o-******
+ * usm_check_secLevel_vs_protocols
+ *
+ * Parameters:
+ *	 level
+ *	*authProtocol
+ *	 authProtocolLen
+ *	*privProtocol
+ *	 privProtocolLen
+ *      
+ * Returns:
+ *	0	On success,
+ *	1	Otherwise.
+ *
+ * Same as above but with explicitly named transform types instead of taking
+ * from the usmUser structure.
+ */
+int
+usm_check_secLevel_vs_protocols(int level,
+                                const oid * authProtocol,
+                                u_int authProtocolLen,
+                                const oid * privProtocol,
+                                u_int privProtocolLen)
+{
+
+    if (level == SNMP_SEC_LEVEL_AUTHPRIV
+        &&
+        (netsnmp_oid_equals
+         (privProtocol, privProtocolLen, usmNoPrivProtocol,
+          sizeof(usmNoPrivProtocol) / sizeof(oid)) == 0)) {
+        DEBUGMSGTL(("usm", "Level: %d\n", level));
+        DEBUGMSGTL(("usm", "Auth Protocol: "));
+        DEBUGMSGOID(("usm", authProtocol, authProtocolLen));
+        DEBUGMSG(("usm", ", Priv Protocol: "));
+        DEBUGMSGOID(("usm", privProtocol, privProtocolLen));
+        DEBUGMSG(("usm", "\n"));
+        return 1;
+    }
+    if ((level == SNMP_SEC_LEVEL_AUTHPRIV
+         || level == SNMP_SEC_LEVEL_AUTHNOPRIV)
+        &&
+        (netsnmp_oid_equals
+         (authProtocol, authProtocolLen, usmNoAuthProtocol,
+          sizeof(usmNoAuthProtocol) / sizeof(oid)) == 0)) {
+        DEBUGMSGTL(("usm", "Level: %d\n", level));
+        DEBUGMSGTL(("usm", "Auth Protocol: "));
+        DEBUGMSGOID(("usm", authProtocol, authProtocolLen));
+        DEBUGMSG(("usm", ", Priv Protocol: "));
+        DEBUGMSGOID(("usm", privProtocol, privProtocolLen));
+        DEBUGMSG(("usm", "\n"));
+        return 1;
+    }
+
+    return 0;
+
+}                               /* end usm_check_secLevel_vs_protocols() */
+
+
+
+
+/*
+ * usm_get_user(): Returns a user from userList based on the engineID,
+ * engineIDLen and name of the requested user. 
+ */
+
+struct usmUser *
+usm_get_user(u_char * engineID, size_t engineIDLen, char *name)
+{
+    DEBUGMSGTL(("usm", "getting user %s\n", name));
+    return usm_get_user_from_list(engineID, engineIDLen, name, userList,
+                                  1);
+}
+
+struct usmUser *
+usm_get_user_from_list(u_char * engineID, size_t engineIDLen,
+                       char *name, struct usmUser *puserList,
+                       int use_default)
+{
+    struct usmUser *ptr;
+    char            noName[] = "";
+    if (name == NULL)
+        name = noName;
+    for (ptr = puserList; ptr != NULL; ptr = ptr->next) {
+        if (!strcmp(ptr->name, name) &&
+            ptr->engineIDLen == engineIDLen &&
+            ((ptr->engineID == NULL && engineID == NULL) ||
+             (ptr->engineID != NULL && engineID != NULL &&
+              memcmp(ptr->engineID, engineID, engineIDLen) == 0)))
+            return ptr;
+    }
+
+    /*
+     * return "" user used to facilitate engineID discovery 
+     */
+    if (use_default && !strcmp(name, ""))
+        return noNameUser;
+    return NULL;
+}
+
+/*
+ * usm_add_user(): Add's a user to the userList, sorted by the
+ * engineIDLength then the engineID then the name length then the name
+ * to facilitate getNext calls on a usmUser table which is indexed by
+ * these values.
+ * 
+ * Note: userList must not be NULL (obviously), as thats a rather trivial
+ * addition and is left to the API user.
+ * 
+ * returns the head of the list (which could change due to this add).
+ */
+
+struct usmUser *
+usm_add_user(struct usmUser *user)
+{
+    struct usmUser *uptr;
+    uptr = usm_add_user_to_list(user, userList);
+    if (uptr != NULL)
+        userList = uptr;
+    return uptr;
+}
+
+struct usmUser *
+usm_add_user_to_list(struct usmUser *user, struct usmUser *puserList)
+{
+    struct usmUser *nptr, *pptr, *optr;
+
+    /*
+     * loop through puserList till we find the proper, sorted place to
+     * insert the new user 
+     */
+    for (nptr = puserList, pptr = NULL; nptr != NULL;
+         pptr = nptr, nptr = nptr->next) {
+        if (nptr->engineIDLen > user->engineIDLen)
+            break;
+
+        if (user->engineID == NULL && nptr->engineID != NULL)
+            break;
+
+        if (nptr->engineIDLen == user->engineIDLen &&
+            (nptr->engineID != NULL && user->engineID != NULL &&
+             memcmp(nptr->engineID, user->engineID,
+                    user->engineIDLen) > 0))
+            break;
+
+        if (!(nptr->engineID == NULL && user->engineID != NULL)) {
+            if (nptr->engineIDLen == user->engineIDLen &&
+                ((nptr->engineID == NULL && user->engineID == NULL) ||
+                 memcmp(nptr->engineID, user->engineID,
+                        user->engineIDLen) == 0)
+                && strlen(nptr->name) > strlen(user->name))
+                break;
+
+            if (nptr->engineIDLen == user->engineIDLen &&
+                ((nptr->engineID == NULL && user->engineID == NULL) ||
+                 memcmp(nptr->engineID, user->engineID,
+                        user->engineIDLen) == 0)
+                && strlen(nptr->name) == strlen(user->name)
+                && strcmp(nptr->name, user->name) > 0)
+                break;
+
+            if (nptr->engineIDLen == user->engineIDLen &&
+                ((nptr->engineID == NULL && user->engineID == NULL) ||
+                 memcmp(nptr->engineID, user->engineID,
+                        user->engineIDLen) == 0)
+                && strlen(nptr->name) == strlen(user->name)
+                && strcmp(nptr->name, user->name) == 0) {
+                /*
+                 * the user is an exact match of a previous entry.
+                 * Credentials may be different, though, so remove
+                 * the old entry (and add the new one)!
+                 */
+                if (pptr) { /* change prev's next pointer */
+                  pptr->next = nptr->next;
+                }
+                if (nptr->next) { /* change next's prev pointer */
+                  nptr->next->prev = pptr;
+                } 
+                optr = nptr;
+                nptr = optr->next; /* add new user at this position */
+                /* free the old user */
+                optr->next=NULL;
+                optr->prev=NULL;
+                usm_free_user(optr); 
+                break; /* new user will be added below */
+            }
+        }
+    }
+
+    /*
+     * nptr should now point to the user that we need to add ourselves
+     * in front of, and pptr should be our new 'prev'. 
+     */
+
+    /*
+     * change our pointers 
+     */
+    user->prev = pptr;
+    user->next = nptr;
+
+    /*
+     * change the next's prev pointer 
+     */
+    if (user->next)
+        user->next->prev = user;
+
+    /*
+     * change the prev's next pointer 
+     */
+    if (user->prev)
+        user->prev->next = user;
+
+    /*
+     * rewind to the head of the list and return it (since the new head
+     * could be us, we need to notify the above routine who the head now is. 
+     */
+    for (pptr = user; pptr->prev != NULL; pptr = pptr->prev);
+    return pptr;
+}
+
+/*
+ * usm_remove_user(): finds and removes a user from a list 
+ */
+struct usmUser *
+usm_remove_user(struct usmUser *user)
+{
+    return usm_remove_user_from_list(user, &userList);
+}
+
+struct usmUser *
+usm_remove_user_from_list(struct usmUser *user,
+                          struct usmUser **ppuserList)
+{
+    struct usmUser *nptr, *pptr;
+
+    /*
+     * NULL pointers aren't allowed 
+     */
+    if (ppuserList == NULL)
+        return NULL;
+
+    /*
+     * find the user in the list 
+     */
+    for (nptr = *ppuserList, pptr = NULL; nptr != NULL;
+         pptr = nptr, nptr = nptr->next) {
+        if (nptr == user)
+            break;
+    }
+
+    if (nptr) {
+        /*
+         * remove the user from the linked list 
+         */
+        if (pptr) {
+            pptr->next = nptr->next;
+        }
+        if (nptr->next) {
+            nptr->next->prev = pptr;
+        }
+    } else {
+        /*
+         * user didn't exist 
+         */
+        return NULL;
+    }
+    if (nptr == *ppuserList)    /* we're the head of the list, need to change
+                                 * * the head to the next user */
+        *ppuserList = nptr->next;
+    return *ppuserList;
+}                               /* end usm_remove_user_from_list() */
+
+
+
+
+/*
+ * usm_free_user():  calls free() on all needed parts of struct usmUser and
+ * the user himself.
+ * 
+ * Note: This should *not* be called on an object in a list (IE,
+ * remove it from the list first, and set next and prev to NULL), but
+ * will try to reconnect the list pieces again if it is called this
+ * way.  If called on the head of the list, the entire list will be
+ * lost. 
+ */
+struct usmUser *
+usm_free_user(struct usmUser *user)
+{
+    if (user == NULL)
+        return NULL;
+
+    SNMP_FREE(user->engineID);
+    SNMP_FREE(user->name);
+    SNMP_FREE(user->secName);
+    SNMP_FREE(user->cloneFrom);
+    SNMP_FREE(user->userPublicString);
+    SNMP_FREE(user->authProtocol);
+    SNMP_FREE(user->privProtocol);
+
+    if (user->authKey != NULL) {
+        SNMP_ZERO(user->authKey, user->authKeyLen);
+        SNMP_FREE(user->authKey);
+    }
+
+    if (user->privKey != NULL) {
+        SNMP_ZERO(user->privKey, user->privKeyLen);
+        SNMP_FREE(user->privKey);
+    }
+
+
+    /*
+     * FIX  Why not put this check *first?*
+     */
+    if (user->prev != NULL) {   /* ack, this shouldn't happen */
+        user->prev->next = user->next;
+    }
+    if (user->next != NULL) {
+        user->next->prev = user->prev;
+        if (user->prev != NULL) /* ack this is really bad, because it means
+                                 * * we'll loose the head of some structure tree */
+            DEBUGMSGTL(("usm",
+                        "Severe: Asked to free the head of a usmUser tree somewhere."));
+    }
+
+
+    SNMP_ZERO(user, sizeof(*user));
+    SNMP_FREE(user);
+
+    return NULL;                /* for convenience to returns from calling functions */
+
+}                               /* end usm_free_user() */
+
+
+
+
+/*
+ * take a given user and clone the security info into another 
+ */
+struct usmUser *
+usm_cloneFrom_user(struct usmUser *from, struct usmUser *to)
+{
+    /*
+     * copy the authProtocol oid row pointer 
+     */
+    SNMP_FREE(to->authProtocol);
+
+    if ((to->authProtocol =
+         snmp_duplicate_objid(from->authProtocol,
+                              from->authProtocolLen)) != NULL)
+        to->authProtocolLen = from->authProtocolLen;
+    else
+        to->authProtocolLen = 0;
+
+
+    /*
+     * copy the authKey 
+     */
+    SNMP_FREE(to->authKey);
+
+    if (from->authKeyLen > 0 &&
+        (to->authKey = (u_char *) malloc(from->authKeyLen))
+        != NULL) {
+        to->authKeyLen = from->authKeyLen;
+        memcpy(to->authKey, from->authKey, to->authKeyLen);
+    } else {
+        to->authKey = NULL;
+        to->authKeyLen = 0;
+    }
+
+
+    /*
+     * copy the privProtocol oid row pointer 
+     */
+    SNMP_FREE(to->privProtocol);
+
+    if ((to->privProtocol =
+         snmp_duplicate_objid(from->privProtocol,
+                              from->privProtocolLen)) != NULL)
+        to->privProtocolLen = from->privProtocolLen;
+    else
+        to->privProtocolLen = 0;
+
+    /*
+     * copy the privKey 
+     */
+    SNMP_FREE(to->privKey);
+
+    if (from->privKeyLen > 0 &&
+        (to->privKey = (u_char *) malloc(from->privKeyLen))
+        != NULL) {
+        to->privKeyLen = from->privKeyLen;
+        memcpy(to->privKey, from->privKey, to->privKeyLen);
+    } else {
+        to->privKey = NULL;
+        to->privKeyLen = 0;
+    }
+    return to;
+}
+
+/*
+ * usm_create_user(void):
+ * create a default empty user, instantiating only the auth/priv
+ * protocols to noAuth and noPriv OID pointers
+ */
+struct usmUser *
+usm_create_user(void)
+{
+    struct usmUser *newUser;
+
+    /*
+     * create the new user 
+     */
+    newUser = (struct usmUser *) calloc(1, sizeof(struct usmUser));
+    if (newUser == NULL)
+        return NULL;
+
+    /*
+     * fill the auth/priv protocols 
+     */
+    if ((newUser->authProtocol =
+         snmp_duplicate_objid(usmNoAuthProtocol,
+                              sizeof(usmNoAuthProtocol) / sizeof(oid))) ==
+        NULL)
+        return usm_free_user(newUser);
+    newUser->authProtocolLen = sizeof(usmNoAuthProtocol) / sizeof(oid);
+
+    if ((newUser->privProtocol =
+         snmp_duplicate_objid(usmNoPrivProtocol,
+                              sizeof(usmNoPrivProtocol) / sizeof(oid))) ==
+        NULL)
+        return usm_free_user(newUser);
+    newUser->privProtocolLen = sizeof(usmNoPrivProtocol) / sizeof(oid);
+
+    /*
+     * set the storage type to nonvolatile, and the status to ACTIVE 
+     */
+    newUser->userStorageType = ST_NONVOLATILE;
+    newUser->userStatus = RS_ACTIVE;
+    return newUser;
+
+}                               /* end usm_clone_user() */
+
+
+
+
+/*
+ * usm_create_initial_user(void):
+ * creates an initial user, filled with the defaults defined in the
+ * USM document.
+ */
+struct usmUser *
+usm_create_initial_user(const char *name,
+                        const oid * authProtocol, size_t authProtocolLen,
+                        const oid * privProtocol, size_t privProtocolLen)
+{
+    struct usmUser *newUser = usm_create_user();
+    if (newUser == NULL)
+        return NULL;
+
+    if ((newUser->name = strdup(name)) == NULL)
+        return usm_free_user(newUser);
+
+    if ((newUser->secName = strdup(name)) == NULL)
+        return usm_free_user(newUser);
+
+    if ((newUser->engineID =
+         snmpv3_generate_engineID(&newUser->engineIDLen)) == NULL)
+        return usm_free_user(newUser);
+
+    if ((newUser->cloneFrom = (oid *) malloc(sizeof(oid) * 2)) == NULL)
+        return usm_free_user(newUser);
+    newUser->cloneFrom[0] = 0;
+    newUser->cloneFrom[1] = 0;
+    newUser->cloneFromLen = 2;
+
+    SNMP_FREE(newUser->privProtocol);
+    if ((newUser->privProtocol = snmp_duplicate_objid(privProtocol,
+                                                      privProtocolLen)) ==
+        NULL) {
+        return usm_free_user(newUser);
+    }
+    newUser->privProtocolLen = privProtocolLen;
+
+    SNMP_FREE(newUser->authProtocol);
+    if ((newUser->authProtocol = snmp_duplicate_objid(authProtocol,
+                                                      authProtocolLen)) ==
+        NULL) {
+        return usm_free_user(newUser);
+    }
+    newUser->authProtocolLen = authProtocolLen;
+
+    newUser->userStatus = RS_ACTIVE;
+    newUser->userStorageType = ST_READONLY;
+
+    return newUser;
+}
+
+/*
+ * this is a callback that can store all known users based on a
+ * previously registered application ID 
+ */
+int
+usm_store_users(int majorID, int minorID, void *serverarg, void *clientarg)
+{
+    /*
+     * figure out our application name 
+     */
+    char           *appname = (char *) clientarg;
+    if (appname == NULL) {
+        appname = netsnmp_ds_get_string(NETSNMP_DS_LIBRARY_ID, 
+					NETSNMP_DS_LIB_APPTYPE);
+    }
+
+    /*
+     * save the user base 
+     */
+    usm_save_users("usmUser", appname);
+
+    /*
+     * never fails 
+     */
+    return SNMPERR_SUCCESS;
+}
+
+
+/*
+ * usm_save_users(): saves a list of users to the persistent cache 
+ */
+void
+usm_save_users(const char *token, const char *type)
+{
+    usm_save_users_from_list(userList, token, type);
+}
+
+void
+usm_save_users_from_list(struct usmUser *puserList, const char *token,
+                         const char *type)
+{
+    struct usmUser *uptr;
+    for (uptr = puserList; uptr != NULL; uptr = uptr->next) {
+        if (uptr->userStorageType == ST_NONVOLATILE)
+            usm_save_user(uptr, token, type);
+    }
+}
+
+/*
+ * usm_save_user(): saves a user to the persistent cache 
+ */
+void
+usm_save_user(struct usmUser *user, const char *token, const char *type)
+{
+    char            line[4096];
+    char           *cptr;
+
+    memset(line, 0, sizeof(line));
+
+    sprintf(line, "%s %d %d ", token, user->userStatus,
+            user->userStorageType);
+    cptr = &line[strlen(line)]; /* the NULL */
+    cptr =
+        read_config_save_octet_string(cptr, user->engineID,
+                                      user->engineIDLen);
+    *cptr++ = ' ';
+    cptr = read_config_save_octet_string(cptr, (u_char *) user->name,
+                                         (user->name == NULL) ? 0 :
+                                         strlen(user->name) + 1);
+    *cptr++ = ' ';
+    cptr = read_config_save_octet_string(cptr, (u_char *) user->secName,
+                                         (user->secName == NULL) ? 0 :
+                                         strlen(user->secName) + 1);
+    *cptr++ = ' ';
+    cptr =
+        read_config_save_objid(cptr, user->cloneFrom, user->cloneFromLen);
+    *cptr++ = ' ';
+    cptr = read_config_save_objid(cptr, user->authProtocol,
+                                  user->authProtocolLen);
+    *cptr++ = ' ';
+    cptr =
+        read_config_save_octet_string(cptr, user->authKey,
+                                      user->authKeyLen);
+    *cptr++ = ' ';
+    cptr = read_config_save_objid(cptr, user->privProtocol,
+                                  user->privProtocolLen);
+    *cptr++ = ' ';
+    cptr =
+        read_config_save_octet_string(cptr, user->privKey,
+                                      user->privKeyLen);
+    *cptr++ = ' ';
+    cptr = read_config_save_octet_string(cptr, user->userPublicString,
+                                         (user->userPublicString ==
+                                          NULL) ? 0 : strlen((char *)
+                                                             user->
+                                                             userPublicString)
+                                         + 1);
+    read_config_store(type, line);
+}
+
+/*
+ * usm_parse_user(): reads in a line containing a saved user profile
+ * and returns a pointer to a newly created struct usmUser. 
+ */
+struct usmUser *
+usm_read_user(char *line)
+{
+    struct usmUser *user;
+    size_t          len;
+
+    user = usm_create_user();
+    if (user == NULL)
+        return NULL;
+
+    user->userStatus = atoi(line);
+    line = skip_token(line);
+    user->userStorageType = atoi(line);
+    line = skip_token(line);
+    line = read_config_read_octet_string(line, &user->engineID,
+                                         &user->engineIDLen);
+
+    /*
+     * set the lcd entry for this engineID to the minimum boots/time
+     * values so that its a known engineid and won't return a report pdu.
+     * This is mostly important when receiving v3 traps so that the usm
+     * will at least continue processing them. 
+     */
+    set_enginetime(user->engineID, user->engineIDLen, 1, 0, 0);
+
+    line = read_config_read_octet_string(line, (u_char **) & user->name,
+                                         &len);
+    line = read_config_read_octet_string(line, (u_char **) & user->secName,
+                                         &len);
+    SNMP_FREE(user->cloneFrom);
+    user->cloneFromLen = 0;
+
+    line =
+        read_config_read_objid(line, &user->cloneFrom,
+                               &user->cloneFromLen);
+
+    SNMP_FREE(user->authProtocol);
+    user->authProtocolLen = 0;
+
+    line = read_config_read_objid(line, &user->authProtocol,
+                                  &user->authProtocolLen);
+    line = read_config_read_octet_string(line, &user->authKey,
+                                         &user->authKeyLen);
+    SNMP_FREE(user->privProtocol);
+    user->privProtocolLen = 0;
+
+    line = read_config_read_objid(line, &user->privProtocol,
+                                  &user->privProtocolLen);
+    line = read_config_read_octet_string(line, &user->privKey,
+                                         &user->privKeyLen);
+    line = read_config_read_octet_string(line, &user->userPublicString,
+                                         &len);
+    return user;
+}
+
+/*
+ * snmpd.conf parsing routines 
+ */
+void
+usm_parse_config_usmUser(const char *token, char *line)
+{
+    struct usmUser *uptr;
+
+    uptr = usm_read_user(line);
+    usm_add_user(uptr);
+}
+
+
+
+
+/*******************************************************************-o-******
+ * usm_set_password
+ *
+ * Parameters:
+ *	*token
+ *	*line
+ *      
+ *
+ * format: userSetAuthPass     secname engineIDLen engineID pass
+ *     or: userSetPrivPass     secname engineIDLen engineID pass 
+ *     or: userSetAuthKey      secname engineIDLen engineID KuLen Ku
+ *     or: userSetPrivKey      secname engineIDLen engineID KuLen Ku 
+ *     or: userSetAuthLocalKey secname engineIDLen engineID KulLen Kul
+ *     or: userSetPrivLocalKey secname engineIDLen engineID KulLen Kul 
+ *
+ * type is:	1=passphrase; 2=Ku; 3=Kul.
+ *
+ *
+ * ASSUMES  Passwords are null-terminated printable strings.
+ */
+void
+usm_set_password(const char *token, char *line)
+{
+    char           *cp;
+    char            nameBuf[SNMP_MAXBUF];
+    u_char         *engineID;
+    size_t          engineIDLen;
+    struct usmUser *user;
+
+    cp = copy_nword(line, nameBuf, sizeof(nameBuf));
+    if (cp == NULL) {
+        config_perror("invalid name specifier");
+        return;
+    }
+
+    DEBUGMSGTL(("usm", "comparing: %s and %s\n", cp, WILDCARDSTRING));
+    if (strncmp(cp, WILDCARDSTRING, strlen(WILDCARDSTRING)) == 0) {
+        /*
+         * match against all engineIDs we know about 
+         */
+        cp = skip_token(cp);
+        for (user = userList; user != NULL; user = user->next) {
+            if (strcmp(user->secName, nameBuf) == 0) {
+                usm_set_user_password(user, token, cp);
+            }
+        }
+    } else {
+        cp = read_config_read_octet_string(cp, &engineID, &engineIDLen);
+        if (cp == NULL) {
+            config_perror("invalid engineID specifier");
+            return;
+        }
+
+        user = usm_get_user(engineID, engineIDLen, nameBuf);
+        if (user == NULL) {
+            config_perror("not a valid user/engineID pair");
+            return;
+        }
+        usm_set_user_password(user, token, cp);
+    }
+}
+
+/*
+ * uses the rest of LINE to configure USER's password of type TOKEN 
+ */
+void
+usm_set_user_password(struct usmUser *user, const char *token, char *line)
+{
+    char           *cp = line;
+    u_char         *engineID = user->engineID;
+    size_t          engineIDLen = user->engineIDLen;
+
+    u_char        **key;
+    size_t         *keyLen;
+    u_char          userKey[SNMP_MAXBUF_SMALL];
+    size_t          userKeyLen = SNMP_MAXBUF_SMALL;
+    u_char         *userKeyP = userKey;
+    int             type, ret;
+
+    /*
+     * Retrieve the "old" key and set the key type.
+     */
+    if (strcmp(token, "userSetAuthPass") == 0) {
+        key = &user->authKey;
+        keyLen = &user->authKeyLen;
+        type = 0;
+    } else if (strcmp(token, "userSetPrivPass") == 0) {
+        key = &user->privKey;
+        keyLen = &user->privKeyLen;
+        type = 0;
+    } else if (strcmp(token, "userSetAuthKey") == 0) {
+        key = &user->authKey;
+        keyLen = &user->authKeyLen;
+        type = 1;
+    } else if (strcmp(token, "userSetPrivKey") == 0) {
+        key = &user->privKey;
+        keyLen = &user->privKeyLen;
+        type = 1;
+    } else if (strcmp(token, "userSetAuthLocalKey") == 0) {
+        key = &user->authKey;
+        keyLen = &user->authKeyLen;
+        type = 2;
+    } else if (strcmp(token, "userSetPrivLocalKey") == 0) {
+        key = &user->privKey;
+        keyLen = &user->privKeyLen;
+        type = 2;
+    } else {
+        /*
+         * no old key, or token was not recognized 
+         */
+        return;
+    }
+
+    if (*key) {
+        /*
+         * (destroy and) free the old key 
+         */
+        memset(*key, 0, *keyLen);
+        free(*key);
+    }
+
+    if (type == 0) {
+        /*
+         * convert the password into a key 
+         */
+        ret = generate_Ku(user->authProtocol, user->authProtocolLen,
+                          (u_char *) cp, strlen(cp), userKey, &userKeyLen);
+
+        if (ret != SNMPERR_SUCCESS) {
+            config_perror("setting key failed (in sc_genKu())");
+            return;
+        }
+    } else if (type == 1) {
+        cp = read_config_read_octet_string(cp, &userKeyP, &userKeyLen);
+
+        if (cp == NULL) {
+            config_perror("invalid user key");
+            return;
+        }
+    }
+
+    if (type < 2) {
+        *key = (u_char *) malloc(SNMP_MAXBUF_SMALL);
+        *keyLen = SNMP_MAXBUF_SMALL;
+        ret = generate_kul(user->authProtocol, user->authProtocolLen,
+                           engineID, engineIDLen,
+                           userKey, userKeyLen, *key, keyLen);
+        if (ret != SNMPERR_SUCCESS) {
+            config_perror("setting key failed (in generate_kul())");
+            return;
+        }
+
+        /*
+         * (destroy and) free the old key 
+         */
+        memset(userKey, 0, sizeof(userKey));
+
+    } else {
+        /*
+         * the key is given, copy it in 
+         */
+        cp = read_config_read_octet_string(cp, key, keyLen);
+
+        if (cp == NULL) {
+            config_perror("invalid localized user key");
+            return;
+        }
+    }
+}                               /* end usm_set_password() */
diff -Naur tomato/release/src/router/snmp/snmplib/snmpv3.c tomato121/release/src/router/snmp/snmplib/snmpv3.c
--- tomato/release/src/router/snmp/snmplib/snmpv3.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/snmplib/snmpv3.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,1363 @@
+/*
+ * snmpv3.c
+ */
+
+#include <net-snmp/net-snmp-config.h>
+
+#include <stdio.h>
+#include <sys/types.h>
+#if TIME_WITH_SYS_TIME
+# ifdef WIN32
+#  include <sys/timeb.h>
+# else
+#  include <sys/time.h>
+# endif
+# include <time.h>
+#else
+# if HAVE_SYS_TIME_H
+#  include <sys/time.h>
+# else
+#  include <time.h>
+# endif
+#endif
+#if HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+#include <ctype.h>
+#if HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+#if HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#if HAVE_WINSOCK_H
+#include <winsock.h>
+#endif
+#if HAVE_SYS_SOCKET_H
+#include <sys/socket.h>
+#endif
+#if HAVE_NETDB_H
+#include <netdb.h>
+#endif
+#if HAVE_STDLIB_H
+#       include <stdlib.h>
+#endif
+
+/*
+ * Stuff needed for getHwAddress(...) 
+ */
+#ifdef HAVE_SYS_IOCTL_H
+#	include <sys/ioctl.h>
+#endif
+#ifdef HAVE_NET_IF_H
+#	include <net/if.h>
+#endif
+
+#if HAVE_DMALLOC_H
+#include <dmalloc.h>
+#endif
+
+#include <net-snmp/types.h>
+#include <net-snmp/output_api.h>
+#include <net-snmp/config_api.h>
+#include <net-snmp/utilities.h>
+
+#include <net-snmp/library/snmpv3.h>
+#include <net-snmp/library/callback.h>
+#include <net-snmp/library/snmp_api.h>
+#include <net-snmp/library/lcd_time.h>
+#include <net-snmp/library/scapi.h>
+#include <net-snmp/library/keytools.h>
+#include <net-snmp/library/lcd_time.h>
+#include <net-snmp/library/snmp_secmod.h>
+#include <net-snmp/library/snmpusm.h>
+#include <net-snmp/library/transform_oids.h>
+
+static u_long   engineBoots = 1;
+static unsigned int engineIDType = ENGINEID_TYPE_UCD_RND;
+static unsigned char *engineID = NULL;
+static size_t   engineIDLength = 0;
+static unsigned char *engineIDNic = NULL;
+static unsigned int engineIDIsSet = 0;  /* flag if ID set by config */
+static unsigned char *oldEngineID = NULL;
+static size_t   oldEngineIDLength = 0;
+static struct timeval snmpv3starttime;
+
+/*
+ * Set up default snmpv3 parameter value storage.
+ */
+static const oid *defaultAuthType = NULL;
+static size_t   defaultAuthTypeLen = 0;
+static const oid *defaultPrivType = NULL;
+static size_t   defaultPrivTypeLen = 0;
+
+#if defined(IFHWADDRLEN) && defined(SIOCGIFHWADDR)
+static int      getHwAddress(const char *networkDevice, char *addressOut);
+#endif
+
+void
+snmpv3_authtype_conf(const char *word, char *cptr)
+{
+    if (strcasecmp(cptr, "MD5") == 0)
+        defaultAuthType = usmHMACMD5AuthProtocol;
+    else if (strcasecmp(cptr, "SHA") == 0)
+        defaultAuthType = usmHMACSHA1AuthProtocol;
+    else
+        config_perror("Unknown authentication type");
+    defaultAuthTypeLen = USM_LENGTH_OID_TRANSFORM;
+    DEBUGMSGTL(("snmpv3", "set default authentication type: %s\n", cptr));
+}
+
+const oid      *
+get_default_authtype(size_t * len)
+{
+    if (defaultAuthType == NULL) {
+        defaultAuthType = SNMP_DEFAULT_AUTH_PROTO;
+        defaultAuthTypeLen = SNMP_DEFAULT_AUTH_PROTOLEN;
+    }
+    if (len)
+        *len = defaultAuthTypeLen;
+    return defaultAuthType;
+}
+
+void
+snmpv3_privtype_conf(const char *word, char *cptr)
+{
+    if (strcasecmp(cptr, "DES") == 0)
+        defaultPrivType = usmDESPrivProtocol;
+#if HAVE_AES
+    /* XXX AES: assumes oid length == des oid length */
+    else if (strcasecmp(cptr, "AES128") == 0)
+        defaultPrivType = usmAES128PrivProtocol;
+    else if (strcasecmp(cptr, "AES192") == 0)
+        defaultPrivType = usmAES192PrivProtocol;
+    else if (strcasecmp(cptr, "AES256") == 0)
+        defaultPrivType = usmAES256PrivProtocol;
+#endif
+    else
+        config_perror("Unknown privacy type");
+    defaultPrivTypeLen = SNMP_DEFAULT_PRIV_PROTOLEN;
+    DEBUGMSGTL(("snmpv3", "set default privacy type: %s\n", cptr));
+}
+
+const oid      *
+get_default_privtype(size_t * len)
+{
+    if (defaultPrivType == NULL) {
+        defaultPrivType = usmDESPrivProtocol;
+        defaultPrivTypeLen = USM_LENGTH_OID_TRANSFORM;
+    }
+    if (len)
+        *len = defaultPrivTypeLen;
+    return defaultPrivType;
+}
+
+/*******************************************************************-o-******
+ * snmpv3_secLevel_conf
+ *
+ * Parameters:
+ *	*word
+ *	*cptr
+ *
+ * Line syntax:
+ *	defSecurityLevel "noAuthNoPriv" | "authNoPriv" | "authPriv"
+ */
+void
+snmpv3_secLevel_conf(const char *word, char *cptr)
+{
+    char            buf[1024];
+
+    if (strcasecmp(cptr, "noAuthNoPriv") == 0 || strcmp(cptr, "1") == 0 ||
+	strcasecmp(cptr, "nanp") == 0) {
+        netsnmp_ds_set_int(NETSNMP_DS_LIBRARY_ID, 
+			   NETSNMP_DS_LIB_SECLEVEL, SNMP_SEC_LEVEL_NOAUTH);
+    } else if (strcasecmp(cptr, "authNoPriv") == 0 || strcmp(cptr, "2") == 0 ||
+	       strcasecmp(cptr, "anp") == 0) {
+        netsnmp_ds_set_int(NETSNMP_DS_LIBRARY_ID, 
+			   NETSNMP_DS_LIB_SECLEVEL, SNMP_SEC_LEVEL_AUTHNOPRIV);
+    } else if (strcasecmp(cptr, "authPriv") == 0 || strcmp(cptr, "3") == 0 ||
+	       strcasecmp(cptr, "ap") == 0) {
+        netsnmp_ds_set_int(NETSNMP_DS_LIBRARY_ID, 
+			   NETSNMP_DS_LIB_SECLEVEL, SNMP_SEC_LEVEL_AUTHPRIV);
+    } else {
+        snprintf(buf, sizeof(buf), "Unknown security level: %s", cptr);
+        buf[ sizeof(buf)-1 ] = 0;
+        config_perror(buf);
+    }
+    DEBUGMSGTL(("snmpv3", "default secLevel set to: %s = %d\n", cptr,
+                netsnmp_ds_get_int(NETSNMP_DS_LIBRARY_ID, 
+				   NETSNMP_DS_LIB_SECLEVEL)));
+}
+
+
+int
+snmpv3_options(char *optarg, netsnmp_session * session, char **Apsz,
+               char **Xpsz, int argc, char *const *argv)
+{
+    char           *cp = optarg;
+    optarg++;
+    /*
+     * Support '... -3x=value ....' syntax
+     */
+    if (*optarg == '=') {
+        optarg++;
+    }
+    /*
+     * and '.... "-3x value" ....'  (*with* the quotes)
+     */
+    while (*optarg && isspace(*optarg)) {
+        optarg++;
+    }
+    /*
+     * Finally, handle ".... -3x value ...." syntax
+     *   (*without* surrounding quotes)
+     */
+    if (!*optarg) {
+        /*
+         * We've run off the end of the argument
+         *  so move on the the next.
+         */
+        optarg = argv[optind++];
+        if (optind > argc) {
+            fprintf(stderr,
+                    "Missing argument after SNMPv3 '-3%c' option.\n", *cp);
+            return (-1);
+        }
+    }
+
+    switch (*cp) {
+
+    case 'Z':
+        session->engineBoots = strtoul(optarg, NULL, 10);
+        if (session->engineBoots == 0 || !isdigit(optarg[0])) {
+            fprintf(stderr, "Need engine boots value after -3Z flag.\n");
+            return (-1);
+        }
+        cp = strchr(optarg, ',');
+        if (cp && *(++cp) && isdigit(*cp))
+            session->engineTime = strtoul(cp, NULL, 10);
+        else {
+            fprintf(stderr, "Need engine time value after -3Z flag.\n");
+            return (-1);
+        }
+        break;
+
+    case 'e':{
+            size_t          ebuf_len = 32, eout_len = 0;
+            u_char         *ebuf = (u_char *) malloc(ebuf_len);
+
+            if (ebuf == NULL) {
+                fprintf(stderr, "malloc failure processing -3e flag.\n");
+                return (-1);
+            }
+            if (!snmp_hex_to_binary
+                (&ebuf, &ebuf_len, &eout_len, 1, optarg)) {
+                fprintf(stderr, "Bad engine ID value after -3e flag.\n");
+                free(ebuf);
+                return (-1);
+            }
+            session->securityEngineID = ebuf;
+            session->securityEngineIDLen = eout_len;
+            break;
+        }
+
+    case 'E':{
+            size_t          ebuf_len = 32, eout_len = 0;
+            u_char         *ebuf = (u_char *) malloc(ebuf_len);
+
+            if (ebuf == NULL) {
+                fprintf(stderr, "malloc failure processing -3E flag.\n");
+                return (-1);
+            }
+            if (!snmp_hex_to_binary
+                (&ebuf, &ebuf_len, &eout_len, 1, optarg)) {
+                fprintf(stderr, "Bad engine ID value after -3E flag.\n");
+                free(ebuf);
+                return (-1);
+            }
+            session->contextEngineID = ebuf;
+            session->contextEngineIDLen = eout_len;
+            break;
+        }
+
+    case 'n':
+        session->contextName = optarg;
+        session->contextNameLen = strlen(optarg);
+        break;
+
+    case 'u':
+        session->securityName = optarg;
+        session->securityNameLen = strlen(optarg);
+        break;
+
+    case 'l':
+        if (!strcasecmp(optarg, "noAuthNoPriv") || !strcmp(optarg, "1") ||
+            !strcasecmp(optarg, "nanp")) {
+            session->securityLevel = SNMP_SEC_LEVEL_NOAUTH;
+        } else if (!strcasecmp(optarg, "authNoPriv")
+                   || !strcmp(optarg, "2") || !strcasecmp(optarg, "anp")) {
+            session->securityLevel = SNMP_SEC_LEVEL_AUTHNOPRIV;
+        } else if (!strcasecmp(optarg, "authPriv") || !strcmp(optarg, "3")
+                   || !strcasecmp(optarg, "ap")) {
+            session->securityLevel = SNMP_SEC_LEVEL_AUTHPRIV;
+        } else {
+            fprintf(stderr,
+                    "Invalid security level specified after -3l flag: %s\n",
+                    optarg);
+            return (-1);
+        }
+
+        break;
+
+    case 'a':
+        if (!strcasecmp(optarg, "MD5")) {
+            session->securityAuthProto = usmHMACMD5AuthProtocol;
+            session->securityAuthProtoLen = USM_AUTH_PROTO_MD5_LEN;
+        } else if (!strcasecmp(optarg, "SHA")) {
+            session->securityAuthProto = usmHMACSHA1AuthProtocol;
+            session->securityAuthProtoLen = USM_AUTH_PROTO_SHA_LEN;
+        } else {
+            fprintf(stderr,
+                    "Invalid authentication protocol specified after -3a flag: %s\n",
+                    optarg);
+            return (-1);
+        }
+        break;
+
+    case 'x':
+        if (!strcasecmp(optarg, "DES")) {
+            session->securityPrivProto = usmDESPrivProtocol;
+            session->securityPrivProtoLen = USM_PRIV_PROTO_DES_LEN;
+#ifdef HAVE_AES
+        } else if (!strcasecmp(optarg, "AES128")) {
+            session->securityPrivProto = usmAES128PrivProtocol;
+            session->securityPrivProtoLen = USM_PRIV_PROTO_AES128_LEN;
+        } else if (!strcasecmp(optarg, "AES192")) {
+            session->securityPrivProto = usmAES192PrivProtocol;
+            session->securityPrivProtoLen = USM_PRIV_PROTO_AES192_LEN;
+        } else if (!strcasecmp(optarg, "AES256")) {
+            session->securityPrivProto = usmAES256PrivProtocol;
+            session->securityPrivProtoLen = USM_PRIV_PROTO_AES256_LEN;
+#endif
+        } else {
+            fprintf(stderr,
+                    "Invalid privacy protocol specified after -3x flag: %s\n",
+                    optarg);
+            return (-1);
+        }
+        break;
+
+    case 'A':
+        *Apsz = optarg;
+        break;
+
+    case 'X':
+        *Xpsz = optarg;
+        break;
+
+    default:
+        fprintf(stderr, "Unknown SNMPv3 option passed to -3: %c.\n", *cp);
+        return -1;
+    }
+    return 0;
+}
+
+/*******************************************************************-o-******
+ * setup_engineID
+ *
+ * Parameters:
+ *	**eidp
+ *	 *text	Printable (?) text to be plugged into the snmpEngineID.
+ *
+ * Return:
+ *	Length of allocated engineID string in bytes,  -OR-
+ *	-1 on error.
+ *
+ *
+ * Create an snmpEngineID using text and the local IP address.  If eidp
+ * is defined, use it to return a pointer to the newly allocated data.
+ * Otherwise, use the result to define engineID defined in this module.
+ *
+ * Line syntax:
+ *	engineID <text> | NULL
+ *
+ * XXX	What if a node has multiple interfaces?
+ * XXX	What if multiple engines all choose the same address?
+ *      (answer:  You're screwed, because you might need a kul database
+ *       which is dependant on the current engineID.  Enumeration and other
+ *       tricks won't work). 
+ */
+int
+setup_engineID(u_char ** eidp, const char *text)
+{
+    int             enterpriseid = htonl(ENTERPRISE_OID),
+        ucdavisid = htonl(UCDAVIS_OID), localsetup = (eidp) ? 0 : 1;
+
+    /*
+     * Use local engineID if *eidp == NULL.  
+     */
+#ifdef HAVE_GETHOSTNAME
+    u_char          buf[SNMP_MAXBUF_SMALL];
+    struct hostent *hent;
+#endif
+    u_char         *bufp = NULL;
+    size_t          len;
+    int             localEngineIDType = engineIDType;
+    int             tmpint;
+    time_t          tmptime;
+
+    engineIDIsSet = 1;
+
+    /*
+     * get the host name and save the information 
+     */
+#ifdef HAVE_GETHOSTNAME
+    gethostname((char *) buf, sizeof(buf));
+    hent = gethostbyname((char *) buf);
+    /*
+     * Determine if we are using IPV6 
+     */
+#ifdef AF_INET6
+    /*
+     * see if they selected IPV4 or IPV6 support 
+     */
+    if ((ENGINEID_TYPE_IPV6 == localEngineIDType) ||
+        (ENGINEID_TYPE_IPV4 == localEngineIDType)) {
+        if (hent && hent->h_addrtype == AF_INET6) {
+            localEngineIDType = ENGINEID_TYPE_IPV6;
+        } else {
+            /*
+             * Not IPV6 so we go with default 
+             */
+            localEngineIDType = ENGINEID_TYPE_IPV4;
+        }
+    }
+#else
+    /*
+     * No IPV6 support.  Check if they selected IPV6 engineID type.  If so
+     * * make it IPV4 for them 
+     */
+    if (ENGINEID_TYPE_IPV6 == localEngineIDType) {
+        localEngineIDType = ENGINEID_TYPE_IPV4;
+    }
+#endif
+#endif                          /* HAVE_GETHOSTNAME */
+
+    /*
+     * Determine if we have text and if so setup our localEngineIDType
+     * * appropriately.  
+     */
+    if (NULL != text) {
+        engineIDType = localEngineIDType = ENGINEID_TYPE_TEXT;
+    }
+    /*
+     * Determine length of the engineID string. 
+     */
+    len = 5;                    /* always have 5 leading bytes */
+    switch (localEngineIDType) {
+    case ENGINEID_TYPE_TEXT:
+        len += strlen(text);    /* 5 leading bytes+text. No NULL char */
+        break;
+#if defined(IFHWADDRLEN) && defined(SIOCGIFHWADDR)
+    case ENGINEID_TYPE_MACADDR:        /* MAC address */
+        len += 6;               /* + 6 bytes for MAC address */
+        break;
+#endif
+    case ENGINEID_TYPE_IPV4:   /* IPv4 */
+        len += 4;               /* + 4 byte IPV4 address */
+        break;
+    case ENGINEID_TYPE_IPV6:   /* IPv6 */
+        len += 16;              /* + 16 byte IPV6 address */
+        break;
+    case ENGINEID_TYPE_UCD_RND:        /* UCD specific encoding */
+        if (engineID)           /* already setup, keep current value */
+            return engineIDLength;
+        if (oldEngineID) {
+            len = oldEngineIDLength;
+        } else {
+            len += sizeof(int) + sizeof(time_t);
+        }
+        break;
+    default:
+        snmp_log(LOG_ERR,
+                 "Unknown EngineID type requested for setup (%d).  Using IPv4.\n",
+                 localEngineIDType);
+        localEngineIDType = ENGINEID_TYPE_IPV4; /* make into IPV4 */
+        len += 4;               /* + 4 byte IPv4 address */
+        break;
+    }                           /* switch */
+
+
+    /*
+     * Allocate memory and store enterprise ID.
+     */
+    if ((bufp = (u_char *) malloc(len)) == NULL) {
+        snmp_log_perror("setup_engineID malloc");
+        return -1;
+    }
+    if (localEngineIDType == ENGINEID_TYPE_UCD_RND)
+        /*
+         * we must use the net-snmp enterprise id here, regardless 
+         */
+        memcpy(bufp, &ucdavisid, sizeof(ucdavisid));    /* XXX Must be 4 bytes! */
+    else
+        memcpy(bufp, &enterpriseid, sizeof(enterpriseid));      /* XXX Must be 4 bytes! */
+
+    bufp[0] |= 0x80;
+
+
+    /*
+     * Store the given text  -OR-   the first found IP address.
+     */
+    switch (localEngineIDType) {
+    case ENGINEID_TYPE_UCD_RND:
+        if (oldEngineID) {
+            /*
+             * keep our previous notion of the engineID 
+             */
+            memcpy(bufp, oldEngineID, oldEngineIDLength);
+        } else {
+            /*
+             * Here we've desigend our own ENGINEID that is not based on
+             * an address which may change and may even become conflicting
+             * in the future like most of the default v3 engineID types
+             * suffer from.
+             * 
+             * Ours is built from 2 fairly random elements: a random number and
+             * the current time in seconds.  This method suffers from boxes
+             * that may not have a correct clock setting and random number
+             * seed at startup, but few OSes should have that problem.
+             */
+            bufp[4] = ENGINEID_TYPE_UCD_RND;
+            tmpint = random();
+            memcpy(bufp + 5, &tmpint, sizeof(tmpint));
+            tmptime = time(NULL);
+            memcpy(bufp + 5 + sizeof(tmpint), &tmptime, sizeof(tmptime));
+        }
+        break;
+    case ENGINEID_TYPE_TEXT:
+        bufp[4] = ENGINEID_TYPE_TEXT;
+        memcpy((char *) bufp + 5, text, strlen(text));
+        break;
+#ifdef HAVE_GETHOSTNAME
+#ifdef AF_INET6
+    case ENGINEID_TYPE_IPV6:
+        bufp[4] = ENGINEID_TYPE_IPV6;
+        memcpy(bufp + 5, hent->h_addr_list[0], hent->h_length);
+        break;
+#endif
+#endif
+#if defined(IFHWADDRLEN) && defined(SIOCGIFHWADDR)
+    case ENGINEID_TYPE_MACADDR:
+        {
+            int             x;
+            bufp[4] = ENGINEID_TYPE_MACADDR;
+            /*
+             * use default NIC if none provided 
+             */
+            if (NULL == engineIDNic) {
+                x = getHwAddress(DEFAULT_NIC, &bufp[5]);
+            } else {
+                x = getHwAddress(engineIDNic, &bufp[5]);
+            }
+            if (0 != x)
+                /*
+                 * function failed fill MAC address with zeros 
+                 */
+            {
+                memset(&bufp[5], 0, 6);
+            }
+        }
+        break;
+#endif
+    case ENGINEID_TYPE_IPV4:
+    default:
+        bufp[4] = ENGINEID_TYPE_IPV4;
+#ifdef HAVE_GETHOSTNAME
+        if (hent && hent->h_addrtype == AF_INET) {
+            memcpy(bufp + 5, hent->h_addr_list[0], hent->h_length);
+        } else {                /* Unknown address type.  Default to 127.0.0.1. */
+
+            bufp[5] = 127;
+            bufp[6] = 0;
+            bufp[7] = 0;
+            bufp[8] = 1;
+        }
+#else                           /* HAVE_GETHOSTNAME */
+        /*
+         * Unknown address type.  Default to 127.0.0.1. 
+         */
+        bufp[5] = 127;
+        bufp[6] = 0;
+        bufp[7] = 0;
+        bufp[8] = 1;
+#endif                          /* HAVE_GETHOSTNAME */
+        break;
+    }
+
+    /*
+     * Pass the string back to the calling environment, or use it for
+     * our local engineID.
+     */
+    if (localsetup) {
+        SNMP_FREE(engineID);
+        engineID = bufp;
+        engineIDLength = len;
+
+    } else {
+        *eidp = bufp;
+    }
+
+
+    return len;
+
+}                               /* end setup_engineID() */
+
+void
+usm_parse_create_usmUser(const char *token, char *line)
+{
+    char           *cp;
+    char            buf[SNMP_MAXBUF_MEDIUM];
+    struct usmUser *newuser;
+    u_char          userKey[SNMP_MAXBUF_SMALL];
+    size_t          userKeyLen = SNMP_MAXBUF_SMALL;
+    size_t          ret;
+
+    newuser = usm_create_user();
+
+    /*
+     * READ: Security Name 
+     */
+    cp = copy_nword(line, buf, sizeof(buf));
+
+    /*
+     * might be a -e ENGINEID argument 
+     */
+    if (strcmp(buf, "-e") == 0) {
+        size_t          ebuf_len = 32, eout_len = 0;
+        u_char         *ebuf = (u_char *) malloc(ebuf_len);
+
+        if (ebuf == NULL) {
+            config_perror("malloc failure processing -e flag");
+            usm_free_user(newuser);
+            return;
+        }
+
+        /*
+         * Get the specified engineid from the line.  
+         */
+        cp = copy_nword(cp, buf, sizeof(buf));
+        if (!snmp_hex_to_binary(&ebuf, &ebuf_len, &eout_len, 1, buf)) {
+            config_perror("invalid EngineID argument to -e");
+            usm_free_user(newuser);
+            free(ebuf);
+            return;
+        }
+
+        newuser->engineID = ebuf;
+        newuser->engineIDLen = eout_len;
+        cp = copy_nword(cp, buf, sizeof(buf));
+    } else {
+        newuser->engineID = snmpv3_generate_engineID(&ret);
+        if (ret == 0) {
+            usm_free_user(newuser);
+            return;
+        }
+        newuser->engineIDLen = ret;
+    }
+
+    newuser->secName = strdup(buf);
+    newuser->name = strdup(buf);
+
+    if (!cp)
+        goto add;               /* no authentication or privacy type */
+
+    /*
+     * READ: Authentication Type 
+     */
+    if (strncmp(cp, "MD5", 3) == 0) {
+        memcpy(newuser->authProtocol, usmHMACMD5AuthProtocol,
+               sizeof(usmHMACMD5AuthProtocol));
+    } else if (strncmp(cp, "SHA", 3) == 0) {
+        memcpy(newuser->authProtocol, usmHMACSHA1AuthProtocol,
+               sizeof(usmHMACSHA1AuthProtocol));
+    } else {
+        config_perror("Unknown authentication protocol");
+        usm_free_user(newuser);
+        return;
+    }
+
+    cp = skip_token(cp);
+
+    /*
+     * READ: Authentication Pass Phrase 
+     */
+    if (!cp) {
+        config_perror("no authentication pass phrase");
+        usm_free_user(newuser);
+        return;
+    }
+    cp = copy_nword(cp, buf, sizeof(buf));
+    /*
+     * And turn it into a localized key 
+     */
+    ret = generate_Ku(newuser->authProtocol, newuser->authProtocolLen,
+                      (u_char *) buf, strlen(buf), userKey, &userKeyLen);
+    if (ret != SNMPERR_SUCCESS) {
+        config_perror("could not generate the authentication key from the "
+                      "suppiled pass phrase.");
+        usm_free_user(newuser);
+        return;
+    }
+    newuser->authKeyLen =
+        sc_get_properlength(newuser->authProtocol,
+                            newuser->authProtocolLen);
+    newuser->authKey = (u_char *) malloc(newuser->authKeyLen);
+    ret = generate_kul(newuser->authProtocol, newuser->authProtocolLen,
+                       newuser->engineID, newuser->engineIDLen,
+                       userKey, userKeyLen,
+                       newuser->authKey, &newuser->authKeyLen);
+    if (ret != SNMPERR_SUCCESS) {
+        config_perror("could not generate localized authentication key (Kul) "
+                      "from the master key (Ku).");
+        usm_free_user(newuser);
+        return;
+    }
+
+    if (!cp)
+        goto add;               /* no privacy type (which is legal) */
+
+    /*
+     * READ: Privacy Type 
+     */
+    if (strncmp(cp, "DES", 3) == 0) {
+        memcpy(newuser->privProtocol, usmDESPrivProtocol,
+               sizeof(usmDESPrivProtocol));
+#ifdef HAVE_AES
+    } else if (strncmp(cp, "AES128", 3) == 0) {
+        memcpy(newuser->privProtocol, usmAES128PrivProtocol,
+               sizeof(usmAES128PrivProtocol));
+    } else if (strncmp(cp, "AES192", 3) == 0) {
+        memcpy(newuser->privProtocol, usmAES192PrivProtocol,
+               sizeof(usmAES192PrivProtocol));
+    } else if (strncmp(cp, "AES256", 3) == 0) {
+        memcpy(newuser->privProtocol, usmAES256PrivProtocol,
+               sizeof(usmAES256PrivProtocol));
+#endif
+    } else {
+        config_perror("Unknown privacy protocol");
+        usm_free_user(newuser);
+        return;
+    }
+
+    cp = skip_token(cp);
+    /*
+     * READ: Authentication Pass Phrase 
+     */
+    if (!cp) {
+        /*
+         * assume the same as the authentication key 
+         */
+        memdup(&newuser->privKey, newuser->authKey, newuser->authKeyLen);
+        newuser->privKeyLen = newuser->authKeyLen;
+    } else {
+        cp = copy_nword(cp, buf, sizeof(buf));
+        /*
+         * And turn it into a localized key 
+         */
+        ret = generate_Ku(newuser->authProtocol, newuser->authProtocolLen,
+                          (u_char *) buf, strlen(buf),
+                          userKey, &userKeyLen);
+        if (ret != SNMPERR_SUCCESS) {
+            config_perror("could not generate privacy key from the supplied "
+                          "pass phrase.");
+            usm_free_user(newuser);
+            return;
+        }
+
+        ret =
+            sc_get_properlength(newuser->authProtocol,
+                                newuser->authProtocolLen);
+        if (ret < 0) {
+            config_perror("could not get proper key length to use for the "
+                          "privacy algorithm.");
+            usm_free_user(newuser);
+            return;
+        }
+        newuser->privKeyLen = ret;
+
+        newuser->privKey = (u_char *) malloc(newuser->privKeyLen);
+        ret = generate_kul(newuser->authProtocol, newuser->authProtocolLen,
+                           newuser->engineID, newuser->engineIDLen,
+                           userKey, userKeyLen,
+                           newuser->privKey, &newuser->privKeyLen);
+        if (ret != SNMPERR_SUCCESS) {
+            config_perror("could not generate the localized privacy key (Kul) "
+                          "from the master key (Ku).");
+            usm_free_user(newuser);
+            return;
+        }
+    }
+  add:
+    usm_add_user(newuser);
+    DEBUGMSGTL(("usmUser", "created a new user %s at ", newuser->secName));
+    DEBUGMSGHEX(("usmUser", newuser->engineID, newuser->engineIDLen));
+    DEBUGMSG(("usmUser", "\n"));
+}
+
+/*******************************************************************-o-******
+ * engineBoots_conf
+ *
+ * Parameters:
+ *	*word
+ *	*cptr
+ *
+ * Line syntax:
+ *	engineBoots <num_boots>
+ */
+void
+engineBoots_conf(const char *word, char *cptr)
+{
+    engineBoots = atoi(cptr) + 1;
+    DEBUGMSGTL(("snmpv3", "engineBoots: %d\n", engineBoots));
+}
+
+/*******************************************************************-o-******
+ * engineIDType_conf
+ *
+ * Parameters:
+ *	*word
+ *	*cptr
+ *
+ * Line syntax:
+ *	engineIDType <1 or 3>
+ *		1 is default for IPv4 engine ID type.  Will automatically
+ *		    chose between IPv4 & IPv6 if either 1 or 2 is specified.
+ *		2 is for IPv6.
+ *		3 is hardware (MAC) address, currently supported under Linux
+ */
+void
+engineIDType_conf(const char *word, char *cptr)
+{
+    engineIDType = atoi(cptr);
+    /*
+     * verify valid type selected 
+     */
+    switch (engineIDType) {
+    case ENGINEID_TYPE_IPV4:   /* IPv4 */
+    case ENGINEID_TYPE_IPV6:   /* IPv6 */
+        /*
+         * IPV? is always good 
+         */
+        break;
+#if defined(IFHWADDRLEN) && defined(SIOCGIFHWADDR)
+    case ENGINEID_TYPE_MACADDR:        /* MAC address */
+        break;
+#endif
+    default:
+        /*
+         * unsupported one chosen 
+         */
+        config_perror("Unsupported enginedIDType, forcing IPv4");
+        engineIDType = ENGINEID_TYPE_IPV4;
+    }
+    DEBUGMSGTL(("snmpv3", "engineIDType: %d\n", engineIDType));
+}
+
+/*******************************************************************-o-******
+ * engineIDNic_conf
+ *
+ * Parameters:
+ *	*word
+ *	*cptr
+ *
+ * Line syntax:
+ *	engineIDNic <string>
+ *		eth0 is default
+ */
+void
+engineIDNic_conf(const char *word, char *cptr)
+{
+    /*
+     * Make sure they haven't already specified the engineID via the
+     * * configuration file 
+     */
+    if (0 == engineIDIsSet)
+        /*
+         * engineID has NOT been set via configuration file 
+         */
+    {
+        /*
+         * See if already set if so erase & release it 
+         */
+        if (NULL != engineIDNic) {
+            free(engineIDNic);
+        }
+        engineIDNic = (u_char *) malloc(strlen(cptr) + 1);
+        if (NULL != engineIDNic) {
+            strcpy((char *) engineIDNic, cptr);
+            DEBUGMSGTL(("snmpv3", "Initializing engineIDNic: %s\n",
+                        engineIDNic));
+        } else {
+            DEBUGMSGTL(("snmpv3",
+                        "Error allocating memory for engineIDNic!\n"));
+        }
+    } else {
+        DEBUGMSGTL(("snmpv3",
+                    "NOT setting engineIDNic, engineID already set\n"));
+    }
+}
+
+/*******************************************************************-o-******
+ * engineID_conf
+ *
+ * Parameters:
+ *	*word
+ *	*cptr
+ *
+ * This function reads a string from the configuration file and uses that
+ * string to initialize the engineID.  It's assumed to be human readable.
+ */
+void
+engineID_conf(const char *word, char *cptr)
+{
+    setup_engineID(NULL, cptr);
+    DEBUGMSGTL(("snmpv3", "initialized engineID with: %s\n", cptr));
+}
+
+void
+version_conf(const char *word, char *cptr)
+{
+    if ((strcmp(cptr,  "1") == 0) ||
+        (strcmp(cptr, "v1") == 0)) {
+        netsnmp_ds_set_int(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_SNMPVERSION, 
+			   NETSNMP_DS_SNMP_VERSION_1);       /* bogus value */
+    } else if ((strcasecmp(cptr,  "2c") == 0) ||
+               (strcasecmp(cptr, "v2c") == 0)) {
+        netsnmp_ds_set_int(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_SNMPVERSION, 
+			   NETSNMP_DS_SNMP_VERSION_2c);
+    } else if ((strcasecmp(cptr,  "3" ) == 0) ||
+               (strcasecmp(cptr, "v3" ) == 0)) {
+        netsnmp_ds_set_int(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_SNMPVERSION, 
+			   NETSNMP_DS_SNMP_VERSION_3);
+    } else {
+        config_perror("Unknown version specification");
+        return;
+    }
+    DEBUGMSGTL(("snmpv3", "set default version to %d\n",
+                netsnmp_ds_get_int(NETSNMP_DS_LIBRARY_ID, 
+				   NETSNMP_DS_LIB_SNMPVERSION)));
+}
+
+/*
+ * engineID_old_conf(const char *, char *):
+ * 
+ * Reads a octet string encoded engineID into the oldEngineID and
+ * oldEngineIDLen pointers.
+ */
+void
+oldengineID_conf(const char *word, char *cptr)
+{
+    read_config_read_octet_string(cptr, &oldEngineID, &oldEngineIDLength);
+}
+
+
+/*******************************************************************-o-******
+ * init_snmpv3
+ *
+ * Parameters:
+ *	*type	Label for the config file "type" used by calling entity.
+ *      
+ * Set time and engineID.
+ * Set parsing functions for config file tokens.
+ * Initialize SNMP Crypto API (SCAPI).
+ */
+void
+init_snmpv3(const char *type)
+{
+
+    gettimeofday(&snmpv3starttime, NULL);
+
+    if (!type)
+        type = "__snmpapp__";
+
+    /*
+     * we need to be called back later 
+     */
+    snmp_register_callback(SNMP_CALLBACK_LIBRARY,
+                           SNMP_CALLBACK_POST_READ_CONFIG,
+                           init_snmpv3_post_config, NULL);
+    snmp_register_callback(SNMP_CALLBACK_LIBRARY,
+                           SNMP_CALLBACK_POST_PREMIB_READ_CONFIG,
+                           init_snmpv3_post_premib_config, NULL);
+    /*
+     * we need to be called back later 
+     */
+    snmp_register_callback(SNMP_CALLBACK_LIBRARY, SNMP_CALLBACK_STORE_DATA,
+                           snmpv3_store, (void *) strdup(type));
+
+    /*
+     * initialize submodules 
+     */
+    /*
+     * NOTE: this must be after the callbacks are registered above,
+     * since they need to be called before the USM callbacks. 
+     */
+    init_secmod();
+
+    /*
+     * register all our configuration handlers (ack, there's a lot) 
+     */
+
+    /*
+     * handle engineID setup before everything else which may depend on it 
+     */
+    register_prenetsnmp_mib_handler(type, "engineID", engineID_conf, NULL,
+                                    "string");
+    register_prenetsnmp_mib_handler(type, "oldEngineID", oldengineID_conf,
+                                    NULL, NULL);
+    register_prenetsnmp_mib_handler(type, "engineIDType",
+                                    engineIDType_conf, NULL, "num");
+    register_prenetsnmp_mib_handler(type, "engineIDNic", engineIDNic_conf,
+                                    NULL, "string");
+    register_config_handler(type, "engineBoots", engineBoots_conf, NULL,
+                            NULL);
+
+    /*
+     * default store config entries 
+     */
+    netsnmp_ds_register_config(ASN_OCTET_STR, "snmp", "defSecurityName",
+			       NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_SECNAME);
+    netsnmp_ds_register_config(ASN_OCTET_STR, "snmp", "defContext", 
+			       NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_CONTEXT);
+    netsnmp_ds_register_config(ASN_OCTET_STR, "snmp", "defPassphrase",
+			     NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_PASSPHRASE);
+    netsnmp_ds_register_config(ASN_OCTET_STR, "snmp", "defAuthPassphrase",
+			 NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_AUTHPASSPHRASE);
+    netsnmp_ds_register_config(ASN_OCTET_STR, "snmp", "defPrivPassphrase",
+			 NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_PRIVPASSPHRASE);
+    register_config_handler("snmp", "defVersion", version_conf, NULL,
+                            "1|2c|3");
+
+    register_config_handler("snmp", "defAuthType", snmpv3_authtype_conf,
+                            NULL, "MD5|SHA");
+    register_config_handler("snmp", "defPrivType", snmpv3_privtype_conf,
+                            NULL,
+#ifdef HAVE_AES
+                            "DES (AES support not available)");
+#else
+                            "DES|AES128|AES192|AES256");
+#endif
+    register_config_handler("snmp", "defSecurityLevel",
+                            snmpv3_secLevel_conf, NULL,
+                            "noAuthNoPriv|authNoPriv|authPriv");
+    register_config_handler(type, "userSetAuthPass", usm_set_password,
+                            NULL, NULL);
+    register_config_handler(type, "userSetPrivPass", usm_set_password,
+                            NULL, NULL);
+    register_config_handler(type, "userSetAuthKey", usm_set_password, NULL,
+                            NULL);
+    register_config_handler(type, "userSetPrivKey", usm_set_password, NULL,
+                            NULL);
+    register_config_handler(type, "userSetAuthLocalKey", usm_set_password,
+                            NULL, NULL);
+    register_config_handler(type, "userSetPrivLocalKey", usm_set_password,
+                            NULL, NULL);
+}
+
+/*
+ * initializations for SNMPv3 to be called after the configuration files
+ * have been read.
+ */
+
+int
+init_snmpv3_post_config(int majorid, int minorid, void *serverarg,
+                        void *clientarg)
+{
+
+    size_t          engineIDLen;
+    u_char         *c_engineID;
+
+    c_engineID = snmpv3_generate_engineID(&engineIDLen);
+
+    if (engineIDLen == 0) {
+        /*
+         * Somethine went wrong - help! 
+         */
+        return SNMPERR_GENERR;
+    }
+
+    /*
+     * if our engineID has changed at all, the boots record must be set to 1 
+     */
+    if (engineIDLen != (int) oldEngineIDLength ||
+        oldEngineID == NULL || c_engineID == NULL ||
+        memcmp(oldEngineID, c_engineID, engineIDLen) != 0) {
+        engineBoots = 1;
+    }
+
+    /*
+     * set our local engineTime in the LCD timing cache 
+     */
+    set_enginetime(c_engineID, engineIDLen,
+                   snmpv3_local_snmpEngineBoots(),
+                   snmpv3_local_snmpEngineTime(), TRUE);
+
+    free(c_engineID);
+    return SNMPERR_SUCCESS;
+}
+
+int
+init_snmpv3_post_premib_config(int majorid, int minorid, void *serverarg,
+                               void *clientarg)
+{
+    if (!engineIDIsSet)
+        setup_engineID(NULL, NULL);
+
+    return SNMPERR_SUCCESS;
+}
+
+/*******************************************************************-o-******
+ * store_snmpv3
+ *
+ * Parameters:
+ *	*type
+ */
+int
+snmpv3_store(int majorID, int minorID, void *serverarg, void *clientarg)
+{
+    char            line[SNMP_MAXBUF_SMALL];
+    u_char          c_engineID[SNMP_MAXBUF_SMALL];
+    int             engineIDLen;
+    const char     *type = (const char *) clientarg;
+
+    if (type == NULL)           /* should never happen, since the arg is ours */
+        type = "unknown";
+
+    sprintf(line, "engineBoots %ld", engineBoots);
+    read_config_store(type, line);
+
+    engineIDLen = snmpv3_get_engineID(c_engineID, SNMP_MAXBUF_SMALL);
+
+    if (engineIDLen) {
+        /*
+         * store the engineID used for this run 
+         */
+        sprintf(line, "oldEngineID ");
+        read_config_save_octet_string(line + strlen(line), c_engineID,
+                                      engineIDLen);
+        read_config_store(type, line);
+    }
+    return SNMPERR_SUCCESS;
+}                               /* snmpv3_store() */
+
+u_long
+snmpv3_local_snmpEngineBoots(void)
+{
+    return engineBoots;
+}
+
+
+/*******************************************************************-o-******
+ * snmpv3_get_engineID
+ *
+ * Parameters:
+ *	*buf
+ *	 buflen
+ *      
+ * Returns:
+ *	Length of engineID	On Success
+ *	SNMPERR_GENERR		Otherwise.
+ *
+ *
+ * Store engineID in buf; return the length.
+ *
+ */
+size_t
+snmpv3_get_engineID(u_char * buf, size_t buflen)
+{
+    /*
+     * Sanity check.
+     */
+    if (!buf || (buflen < engineIDLength)) {
+        return 0;
+    }
+
+    memcpy(buf, engineID, engineIDLength);
+    return engineIDLength;
+
+}                               /* end snmpv3_get_engineID() */
+
+/*******************************************************************-o-******
+ * snmpv3_clone_engineID
+ *
+ * Parameters:
+ *	**dest
+ *       *dest_len
+ *       src
+ *	 srclen
+ *      
+ * Returns:
+ *	Length of engineID	On Success
+ *	0		        Otherwise.
+ *
+ *
+ * Clones engineID, creates memory
+ *
+ */
+int
+snmpv3_clone_engineID(u_char ** dest, size_t * destlen, u_char * src,
+                      size_t srclen)
+{
+    if (!dest || !destlen)
+        return 0;
+
+    if (*dest) {
+        SNMP_FREE(*dest);
+        *dest = NULL;
+    }
+    *destlen = 0;
+
+    if (srclen && src) {
+        *dest = (u_char *) malloc(srclen);
+        if (*dest == NULL)
+            return 0;
+        memmove(*dest, src, srclen);
+        *destlen = srclen;
+    }
+    return *destlen;
+}                               /* end snmpv3_clone_engineID() */
+
+
+/*******************************************************************-o-******
+ * snmpv3_generate_engineID
+ *
+ * Parameters:
+ *	*length
+ *      
+ * Returns:
+ *	Pointer to copy of engineID	On Success.
+ *	NULL				If malloc() or snmpv3_get_engineID()
+ *						fail.
+ *
+ * Generates a malloced copy of our engineID.
+ *
+ * 'length' is set to the length of engineID  -OR-  < 0 on failure.
+ */
+u_char         *
+snmpv3_generate_engineID(size_t * length)
+{
+    u_char         *newID;
+    newID = (u_char *) malloc(engineIDLength);
+
+    if (newID) {
+        *length = snmpv3_get_engineID(newID, engineIDLength);
+    }
+
+    if (*length == 0) {
+        SNMP_FREE(newID);
+        newID = NULL;
+    }
+
+    return newID;
+
+}                               /* end snmpv3_generate_engineID() */
+
+/*
+ * snmpv3_local_snmpEngineTime(): return the number of seconds since the
+ * snmpv3 engine last incremented engine_boots 
+ */
+u_long
+snmpv3_local_snmpEngineTime(void)
+{
+    struct timeval  now;
+
+    gettimeofday(&now, NULL);
+    return calculate_time_diff(&now, &snmpv3starttime) / 100;
+}
+
+
+/*
+ * Code only for Linux systems 
+ */
+#if defined(IFHWADDRLEN) && defined(SIOCGIFHWADDR)
+static int
+getHwAddress(const char *networkDevice, /* e.g. "eth0", "eth1" */
+             char *addressOut)
+{                               /* return address. Len=IFHWADDRLEN */
+    /*
+     * getHwAddress(...)
+     * *
+     * *  This function will return a Network Interfaces Card's Hardware
+     * *  address (aka MAC address).
+     * *
+     * *  Input Parameter(s):
+     * *      networkDevice - a null terminated string with the name of a network
+     * *                      device.  Examples: eth0, eth1, etc...
+     * *
+     * *  Output Parameter(s):
+     * *      addressOut -    This is the binary value of the hardware address.
+     * *                      This value is NOT converted into a hexadecimal string.
+     * *                      The caller must pre-allocate for a return value of
+     * *                      length IFHWADDRLEN
+     * *
+     * *  Return value:   This function will return zero (0) for success.  If
+     * *                  an error occurred the function will return -1.
+     * *
+     * *  Caveats:    This has only been tested on Ethernet networking cards.
+     */
+    int             sock;       /* our socket */
+    struct ifreq    request;    /* struct which will have HW address */
+
+    if ((NULL == networkDevice) || (NULL == addressOut)) {
+        return -1;
+    }
+    /*
+     * In order to find out the hardware (MAC) address of our system under
+     * * Linux we must do the following:
+     * * 1.  Create a socket
+     * * 2.  Do an ioctl(...) call with the SIOCGIFHWADDRLEN operation.
+     */
+    sock = socket(AF_INET, SOCK_DGRAM, 0);
+    if (sock < 0) {
+        return -1;
+    }
+    /*
+     * erase the request block 
+     */
+    memset(&request, 0, sizeof(request));
+    /*
+     * copy the name of the net device we want to find the HW address for 
+     */
+    strncpy(request.ifr_name, networkDevice, IFNAMSIZ - 1);
+    /*
+     * Get the HW address 
+     */
+    if (ioctl(sock, SIOCGIFHWADDR, &request)) {
+        close(sock);
+        return -1;
+    }
+    close(sock);
+    memcpy(addressOut, request.ifr_hwaddr.sa_data, IFHWADDRLEN);
+    return 0;
+}
+#endif
+
+#ifdef SNMP_TESTING_CODE
+/*
+ * snmpv3_set_engineBootsAndTime(): this function does not exist.  Go away. 
+ */
+/*
+ * It certainly should never be used, unless in a testing scenero,
+ * which is why it was created 
+ */
+void
+snmpv3_set_engineBootsAndTime(int boots, int ttime)
+{
+    engineBoots = boots;
+    gettimeofday(&snmpv3starttime, NULL);
+    snmpv3starttime.tv_sec -= ttime;
+}
+#endif
diff -Naur tomato/release/src/router/snmp/snmplib/snmp_version.c tomato121/release/src/router/snmp/snmplib/snmp_version.c
--- tomato/release/src/router/snmp/snmplib/snmp_version.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/snmplib/snmp_version.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,9 @@
+#include <net-snmp/version.h>
+
+const char     *NetSnmpVersionInfo = "5.0.9";
+
+const char     *
+netsnmp_get_version()
+{
+    return NetSnmpVersionInfo;
+}
diff -Naur tomato/release/src/router/snmp/snmplib/snprintf.c tomato121/release/src/router/snmp/snmplib/snprintf.c
--- tomato/release/src/router/snmp/snmplib/snprintf.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/snmplib/snprintf.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,831 @@
+/*
+ * Copyright Patrick Powell 1995
+ * This code is based on code written by Patrick Powell (papowell@astart.com)
+ * It may be used for any purpose as long as this notice remains intact
+ * on all source code distributions
+ */
+
+/**************************************************************
+ * Original:
+ * Patrick Powell Tue Apr 11 09:48:21 PDT 1995
+ * A bombproof version of doprnt (dopr) included.
+ * Sigh.  This sort of thing is always nasty do deal with.  Note that
+ * the version here does not include floating point...
+ *
+ * snprintf() is used instead of sprintf() as it does limit checks
+ * for string length.  This covers a nasty loophole.
+ *
+ * The other functions are there to prevent NULL pointers from
+ * causing nast effects.
+ *
+ * More Recently:
+ *  Brandon Long <blong@fiction.net> 9/15/96 for mutt 0.43
+ *  This was ugly.  It is still ugly.  I opted out of floating point
+ *  numbers, but the formatter understands just about everything
+ *  from the normal C string format, at least as far as I can tell from
+ *  the Solaris 2.5 printf(3S) man page.
+ *
+ *  Brandon Long <blong@fiction.net> 10/22/97 for mutt 0.87.1
+ *    Ok, added some minimal floating point support, which means this
+ *    probably requires libm on most operating systems.  Don't yet
+ *    support the exponent (e,E) and sigfig (g,G).  Also, fmtint()
+ *    was pretty badly broken, it just wasn't being exercised in ways
+ *    which showed it, so that's been fixed.  Also, formated the code
+ *    to mutt conventions, and removed dead code left over from the
+ *    original.  Also, there is now a builtin-test, just compile with:
+ *           gcc -DTEST_SNPRINTF -o snprintf snprintf.c -lm
+ *    and run snprintf for results.
+ * 
+ *  Thomas Roessler <roessler@guug.de> 01/27/98 for mutt 0.89i
+ *    The PGP code was using unsigned hexadecimal formats. 
+ *    Unfortunately, unsigned formats simply didn't work.
+ *
+ *  Michael Elkins <me@cs.hmc.edu> 03/05/98 for mutt 0.90.8
+ *    The original code assumed that both snprintf() and vsnprintf() were
+ *    missing.  Some systems only have snprintf() but not vsnprintf(), so
+ *    the code is now broken down under HAVE_SNPRINTF and HAVE_VSNPRINTF.
+ *
+ *  Andrew Tridgell (tridge@samba.org) Oct 1998
+ *    fixed handling of %.0f
+ *    added test for HAVE_LONG_DOUBLE
+ *
+ **************************************************************/
+
+#include <net-snmp/net-snmp-config.h>
+
+#if !defined(HAVE_SNPRINTF) || !defined(HAVE_VSNPRINTF)
+
+#if HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+#include <ctype.h>
+#include <sys/types.h>
+
+#if HAVE_STDARG_H
+# include <stdarg.h>
+# define HAVE_STDARGS           /* let's hope that works everywhere (mj) */
+# define VA_LOCAL_DECL   va_list ap
+# define VA_START(f)     va_start(ap, f)
+# define VA_SHIFT(v,t)  ;       /* no-op for ANSI */
+# define VA_END          va_end(ap)
+#elif HAVE_VARARGS_H
+#  include <varargs.h>
+#  undef HAVE_STDARGS
+#  define VA_LOCAL_DECL   va_list ap
+#  define VA_START(f)     va_start(ap)  /* f is ignored! */
+#  define VA_SHIFT(v,t) v = va_arg(ap,t)
+#  define VA_END        va_end(ap)
+#else
+/*
+ * XX ** NO VARARGS ** XX
+ */
+#endif
+
+#ifdef HAVE_LONG_DOUBLE
+#define LDOUBLE long double
+#else
+#define LDOUBLE double
+#endif
+
+int             snprintf(char *str, size_t count, const char *fmt, ...);
+int             vsnprintf(char *str, size_t count, const char *fmt,
+                          va_list arg);
+
+static void     dopr(char *buffer, size_t maxlen, const char *format,
+                     va_list args);
+static void     fmtstr(char *buffer, size_t * currlen, size_t maxlen,
+                       char *value, int flags, int min, int max);
+static void     fmtint(char *buffer, size_t * currlen, size_t maxlen,
+                       long value, int base, int min, int max, int flags);
+static void     fmtfp(char *buffer, size_t * currlen, size_t maxlen,
+                      LDOUBLE fvalue, int min, int max, int flags);
+static void     dopr_outch(char *buffer, size_t * currlen, size_t maxlen,
+                           char c);
+
+/*
+ * dopr(): poor man's version of doprintf
+ */
+
+/*
+ * format read states 
+ */
+#define DP_S_DEFAULT 0
+#define DP_S_FLAGS   1
+#define DP_S_MIN     2
+#define DP_S_DOT     3
+#define DP_S_MAX     4
+#define DP_S_MOD     5
+#define DP_S_CONV    6
+#define DP_S_DONE    7
+
+/*
+ * format flags - Bits 
+ */
+#define DP_F_MINUS 	(1 << 0)
+#define DP_F_PLUS  	(1 << 1)
+#define DP_F_SPACE 	(1 << 2)
+#define DP_F_NUM   	(1 << 3)
+#define DP_F_ZERO  	(1 << 4)
+#define DP_F_UP    	(1 << 5)
+#define DP_F_UNSIGNED 	(1 << 6)
+
+/*
+ * Conversion Flags 
+ */
+#define DP_C_SHORT   1
+#define DP_C_LONG    2
+#define DP_C_LDOUBLE 3
+
+#define char_to_int(p) (p - '0')
+#define MAX(p,q) ((p >= q) ? p : q)
+
+static void
+dopr(char *buffer, size_t maxlen, const char *format, va_list args)
+{
+    char            ch;
+    long            value;
+    LDOUBLE         fvalue;
+    char           *strvalue;
+    int             min;
+    int             max;
+    int             state;
+    int             flags;
+    int             cflags;
+    size_t          currlen;
+
+    state = DP_S_DEFAULT;
+    currlen = flags = cflags = min = 0;
+    max = -1;
+    ch = *format++;
+
+    while (state != DP_S_DONE) {
+        if ((ch == '\0') || (currlen >= maxlen))
+            state = DP_S_DONE;
+
+        switch (state) {
+        case DP_S_DEFAULT:
+            if (ch == '%')
+                state = DP_S_FLAGS;
+            else
+                dopr_outch(buffer, &currlen, maxlen, ch);
+            ch = *format++;
+            break;
+        case DP_S_FLAGS:
+            switch (ch) {
+            case '-':
+                flags |= DP_F_MINUS;
+                ch = *format++;
+                break;
+            case '+':
+                flags |= DP_F_PLUS;
+                ch = *format++;
+                break;
+            case ' ':
+                flags |= DP_F_SPACE;
+                ch = *format++;
+                break;
+            case '#':
+                flags |= DP_F_NUM;
+                ch = *format++;
+                break;
+            case '0':
+                flags |= DP_F_ZERO;
+                ch = *format++;
+                break;
+            default:
+                state = DP_S_MIN;
+                break;
+            }
+            break;
+        case DP_S_MIN:
+            if (isdigit(ch)) {
+                min = 10 * min + char_to_int(ch);
+                ch = *format++;
+            } else if (ch == '*') {
+                min = va_arg(args, int);
+                ch = *format++;
+                state = DP_S_DOT;
+            } else
+                state = DP_S_DOT;
+            break;
+        case DP_S_DOT:
+            if (ch == '.') {
+                state = DP_S_MAX;
+                ch = *format++;
+            } else
+                state = DP_S_MOD;
+            break;
+        case DP_S_MAX:
+            if (isdigit(ch)) {
+                if (max < 0)
+                    max = 0;
+                max = 10 * max + char_to_int(ch);
+                ch = *format++;
+            } else if (ch == '*') {
+                max = va_arg(args, int);
+                ch = *format++;
+                state = DP_S_MOD;
+            } else
+                state = DP_S_MOD;
+            break;
+        case DP_S_MOD:
+            /*
+             * Currently, we don't support Long Long, bummer 
+             */
+            switch (ch) {
+            case 'h':
+                cflags = DP_C_SHORT;
+                ch = *format++;
+                break;
+            case 'l':
+                cflags = DP_C_LONG;
+                ch = *format++;
+                break;
+            case 'L':
+                cflags = DP_C_LDOUBLE;
+                ch = *format++;
+                break;
+            default:
+                break;
+            }
+            state = DP_S_CONV;
+            break;
+        case DP_S_CONV:
+            switch (ch) {
+            case 'd':
+            case 'i':
+                if (cflags == DP_C_SHORT)
+                    value = va_arg(args, short int);
+                else if (cflags == DP_C_LONG)
+                    value = va_arg(args, long int);
+                else
+                    value = va_arg(args, int);
+                fmtint(buffer, &currlen, maxlen, value, 10, min, max,
+                       flags);
+                break;
+            case 'o':
+                flags |= DP_F_UNSIGNED;
+                if (cflags == DP_C_SHORT)
+                    value = va_arg(args, unsigned short int);
+                else if (cflags == DP_C_LONG)
+                    value = va_arg(args, unsigned long int);
+                else
+                    value = va_arg(args, unsigned int);
+                fmtint(buffer, &currlen, maxlen, value, 8, min, max,
+                       flags);
+                break;
+            case 'u':
+                flags |= DP_F_UNSIGNED;
+                if (cflags == DP_C_SHORT)
+                    value = va_arg(args, unsigned short int);
+                else if (cflags == DP_C_LONG)
+                    value = va_arg(args, unsigned long int);
+                else
+                    value = va_arg(args, unsigned int);
+                fmtint(buffer, &currlen, maxlen, value, 10, min, max,
+                       flags);
+                break;
+            case 'X':
+                flags |= DP_F_UP;
+            case 'x':
+                flags |= DP_F_UNSIGNED;
+                if (cflags == DP_C_SHORT)
+                    value = va_arg(args, unsigned short int);
+                else if (cflags == DP_C_LONG)
+                    value = va_arg(args, unsigned long int);
+                else
+                    value = va_arg(args, unsigned int);
+                fmtint(buffer, &currlen, maxlen, value, 16, min, max,
+                       flags);
+                break;
+            case 'f':
+                if (cflags == DP_C_LDOUBLE)
+                    fvalue = va_arg(args, LDOUBLE);
+                else
+                    fvalue = va_arg(args, double);
+                /*
+                 * um, floating point? 
+                 */
+                fmtfp(buffer, &currlen, maxlen, fvalue, min, max, flags);
+                break;
+            case 'E':
+                flags |= DP_F_UP;
+            case 'e':
+                if (cflags == DP_C_LDOUBLE)
+                    fvalue = va_arg(args, LDOUBLE);
+                else
+                    fvalue = va_arg(args, double);
+                break;
+            case 'G':
+                flags |= DP_F_UP;
+            case 'g':
+                if (cflags == DP_C_LDOUBLE)
+                    fvalue = va_arg(args, LDOUBLE);
+                else
+                    fvalue = va_arg(args, double);
+                break;
+            case 'c':
+                dopr_outch(buffer, &currlen, maxlen, va_arg(args, int));
+                break;
+            case 's':
+                strvalue = va_arg(args, char *);
+                if (max < 0)
+                    max = maxlen;       /* ie, no max */
+                fmtstr(buffer, &currlen, maxlen, strvalue, flags, min,
+                       max);
+                break;
+            case 'p':
+                strvalue = (char *) va_arg(args, void *);
+                fmtint(buffer, &currlen, maxlen, (long) strvalue, 16, min,
+                       max, flags);
+                break;
+            case 'n':
+                if (cflags == DP_C_SHORT) {
+                    short int      *num;
+                    num = va_arg(args, short int *);
+                    *num = currlen;
+                } else if (cflags == DP_C_LONG) {
+                    long int       *num;
+                    num = va_arg(args, long int *);
+                    *num = currlen;
+                } else {
+                    int            *num;
+                    num = va_arg(args, int *);
+                    *num = currlen;
+                }
+                break;
+            case '%':
+                dopr_outch(buffer, &currlen, maxlen, ch);
+                break;
+            case 'w':
+                /*
+                 * not supported yet, treat as next char 
+                 */
+                ch = *format++;
+                break;
+            default:
+                /*
+                 * Unknown, skip 
+                 */
+                break;
+            }
+            ch = *format++;
+            state = DP_S_DEFAULT;
+            flags = cflags = min = 0;
+            max = -1;
+            break;
+        case DP_S_DONE:
+            break;
+        default:
+            /*
+             * hmm? 
+             */
+            break;              /* some picky compilers need this */
+        }
+    }
+    if (currlen < maxlen - 1)
+        buffer[currlen] = '\0';
+    else
+        buffer[maxlen - 1] = '\0';
+}
+
+static void
+fmtstr(char *buffer, size_t * currlen, size_t maxlen,
+       char *value, int flags, int min, int max)
+{
+    int             padlen, strln;      /* amount to pad */
+    int             cnt = 0;
+
+    if (value == 0) {
+        value = "<NULL>";
+    }
+
+    for (strln = 0; value[strln]; ++strln);     /* strlen */
+    padlen = min - strln;
+    if (padlen < 0)
+        padlen = 0;
+    if (flags & DP_F_MINUS)
+        padlen = -padlen;       /* Left Justify */
+
+    while ((padlen > 0) && (cnt < max)) {
+        dopr_outch(buffer, currlen, maxlen, ' ');
+        --padlen;
+        ++cnt;
+    }
+    while (*value && (cnt < max)) {
+        dopr_outch(buffer, currlen, maxlen, *value++);
+        ++cnt;
+    }
+    while ((padlen < 0) && (cnt < max)) {
+        dopr_outch(buffer, currlen, maxlen, ' ');
+        ++padlen;
+        ++cnt;
+    }
+}
+
+/*
+ * Have to handle DP_F_NUM (ie 0x and 0 alternates) 
+ */
+
+static void
+fmtint(char *buffer, size_t * currlen, size_t maxlen,
+       long value, int base, int min, int max, int flags)
+{
+    int             signvalue = 0;
+    unsigned long   uvalue;
+    char            convert[20];
+    int             place = 0;
+    int             spadlen = 0;        /* amount to space pad */
+    int             zpadlen = 0;        /* amount to zero pad */
+    int             caps = 0;
+
+    if (max < 0)
+        max = 0;
+
+    uvalue = value;
+
+    if (!(flags & DP_F_UNSIGNED)) {
+        if (value < 0) {
+            signvalue = '-';
+            uvalue = -value;
+        } else if (flags & DP_F_PLUS)   /* Do a sign (+/i) */
+            signvalue = '+';
+        else if (flags & DP_F_SPACE)
+            signvalue = ' ';
+    }
+
+    if (flags & DP_F_UP)
+        caps = 1;               /* Should characters be upper case? */
+
+    do {
+        convert[place++] = (caps ? "0123456789ABCDEF" : "0123456789abcdef")
+            [uvalue % (unsigned) base];
+        uvalue = (uvalue / (unsigned) base);
+    } while (uvalue && (place < 20));
+    if (place == 20)
+        place--;
+    convert[place] = 0;
+
+    zpadlen = max - place;
+    spadlen = min - MAX(max, place) - (signvalue ? 1 : 0);
+    if (zpadlen < 0)
+        zpadlen = 0;
+    if (spadlen < 0)
+        spadlen = 0;
+    if (flags & DP_F_ZERO) {
+        zpadlen = MAX(zpadlen, spadlen);
+        spadlen = 0;
+    }
+    if (flags & DP_F_MINUS)
+        spadlen = -spadlen;     /* Left Justifty */
+
+#ifdef DEBUG_SNPRINTF
+    dprint(1,
+           (debugfile, "zpad: %d, spad: %d, min: %d, max: %d, place: %d\n",
+            zpadlen, spadlen, min, max, place));
+#endif
+
+    /*
+     * Spaces 
+     */
+    while (spadlen > 0) {
+        dopr_outch(buffer, currlen, maxlen, ' ');
+        --spadlen;
+    }
+
+    /*
+     * Sign 
+     */
+    if (signvalue)
+        dopr_outch(buffer, currlen, maxlen, signvalue);
+
+    /*
+     * Zeros 
+     */
+    if (zpadlen > 0) {
+        while (zpadlen > 0) {
+            dopr_outch(buffer, currlen, maxlen, '0');
+            --zpadlen;
+        }
+    }
+
+    /*
+     * Digits 
+     */
+    while (place > 0)
+        dopr_outch(buffer, currlen, maxlen, convert[--place]);
+
+    /*
+     * Left Justified spaces 
+     */
+    while (spadlen < 0) {
+        dopr_outch(buffer, currlen, maxlen, ' ');
+        ++spadlen;
+    }
+}
+
+static          LDOUBLE
+abs_val(LDOUBLE value)
+{
+    LDOUBLE         result = value;
+
+    if (value < 0)
+        result = -value;
+
+    return result;
+}
+
+static          LDOUBLE
+pow10(int exp)
+{
+    LDOUBLE         result = 1;
+
+    while (exp) {
+        result *= 10;
+        exp--;
+    }
+
+    return result;
+}
+
+static long
+round(LDOUBLE value)
+{
+    long            intpart;
+
+    intpart = value;
+    value = value - intpart;
+    if (value >= 0.5)
+        intpart++;
+
+    return intpart;
+}
+
+static void
+fmtfp(char *buffer, size_t * currlen, size_t maxlen,
+      LDOUBLE fvalue, int min, int max, int flags)
+{
+    int             signvalue = 0;
+    LDOUBLE         ufvalue;
+    char            iconvert[20];
+    char            fconvert[20];
+    int             iplace = 0;
+    int             fplace = 0;
+    int             padlen = 0; /* amount to pad */
+    int             zpadlen = 0;
+    int             caps = 0;
+    long            intpart;
+    long            fracpart;
+
+    /*
+     * AIX manpage says the default is 0, but Solaris says the default
+     * is 6, and sprintf on AIX defaults to 6
+     */
+    if (max < 0)
+        max = 6;
+
+    ufvalue = abs_val(fvalue);
+
+    if (fvalue < 0)
+        signvalue = '-';
+    else if (flags & DP_F_PLUS) /* Do a sign (+/i) */
+        signvalue = '+';
+    else if (flags & DP_F_SPACE)
+        signvalue = ' ';
+
+#if 0
+    if (flags & DP_F_UP)
+        caps = 1;               /* Should characters be upper case? */
+#endif
+
+    intpart = ufvalue;
+
+    /*
+     * Sorry, we only support 9 digits past the decimal because of our 
+     * conversion method
+     */
+    if (max > 9)
+        max = 9;
+
+    /*
+     * We "cheat" by converting the fractional part to integer by
+     * * multiplying by a factor of 10
+     */
+    fracpart = round((pow10(max)) * (ufvalue - intpart));
+
+    if (fracpart >= pow10(max)) {
+        intpart++;
+        fracpart -= pow10(max);
+    }
+#ifdef DEBUG_SNPRINTF
+    dprint(1,
+           (debugfile, "fmtfp: %f =? %d.%d\n", fvalue, intpart, fracpart));
+#endif
+
+    /*
+     * Convert integer part 
+     */
+    do {
+        iconvert[iplace++] =
+            (caps ? "0123456789ABCDEF" : "0123456789abcdef")[intpart % 10];
+        intpart = (intpart / 10);
+    } while (intpart && (iplace < 20));
+    if (iplace == 20)
+        iplace--;
+    iconvert[iplace] = 0;
+
+    /*
+     * Convert fractional part 
+     */
+    do {
+        fconvert[fplace++] =
+            (caps ? "0123456789ABCDEF" : "0123456789abcdef")[fracpart %
+                                                             10];
+        fracpart = (fracpart / 10);
+    } while (fracpart && (fplace < 20));
+    if (fplace == 20)
+        fplace--;
+    fconvert[fplace] = 0;
+
+    /*
+     * -1 for decimal point, another -1 if we are printing a sign 
+     */
+    padlen = min - iplace - max - 1 - ((signvalue) ? 1 : 0);
+    zpadlen = max - fplace;
+    if (zpadlen < 0)
+        zpadlen = 0;
+    if (padlen < 0)
+        padlen = 0;
+    if (flags & DP_F_MINUS)
+        padlen = -padlen;       /* Left Justifty */
+
+    if ((flags & DP_F_ZERO) && (padlen > 0)) {
+        if (signvalue) {
+            dopr_outch(buffer, currlen, maxlen, signvalue);
+            --padlen;
+            signvalue = 0;
+        }
+        while (padlen > 0) {
+            dopr_outch(buffer, currlen, maxlen, '0');
+            --padlen;
+        }
+    }
+    while (padlen > 0) {
+        dopr_outch(buffer, currlen, maxlen, ' ');
+        --padlen;
+    }
+    if (signvalue)
+        dopr_outch(buffer, currlen, maxlen, signvalue);
+
+    while (iplace > 0)
+        dopr_outch(buffer, currlen, maxlen, iconvert[--iplace]);
+
+    /*
+     * Decimal point.  This should probably use locale to find the correct
+     * char to print out.
+     */
+    if (max > 0) {
+        dopr_outch(buffer, currlen, maxlen, '.');
+
+        while (fplace > 0)
+            dopr_outch(buffer, currlen, maxlen, fconvert[--fplace]);
+    }
+
+    while (zpadlen > 0) {
+        dopr_outch(buffer, currlen, maxlen, '0');
+        --zpadlen;
+    }
+
+    while (padlen < 0) {
+        dopr_outch(buffer, currlen, maxlen, ' ');
+        ++padlen;
+    }
+}
+
+static void
+dopr_outch(char *buffer, size_t * currlen, size_t maxlen, char c)
+{
+    if (*currlen < maxlen)
+        buffer[(*currlen)++] = c;
+}
+
+#ifndef HAVE_VSNPRINTF
+int
+vsnprintf(char *str, size_t count, const char *fmt, va_list args)
+{
+    str[0] = 0;
+    dopr(str, count, fmt, args);
+    return (strlen(str));
+}
+#endif                          /* !HAVE_VSNPRINTF */
+
+#ifndef HAVE_SNPRINTF
+/*
+ * VARARGS3 
+ */
+#ifdef HAVE_STDARGS
+int
+snprintf(char *str, size_t count, const char *fmt, ...)
+#else
+int
+snprintf(va_alist)
+     va_dcl
+#endif
+{
+#ifndef HAVE_STDARGS
+    char           *str;
+    size_t          count;
+    char           *fmt;
+#endif
+    VA_LOCAL_DECL;
+
+    VA_START(fmt);
+    VA_SHIFT(str, char *);
+    VA_SHIFT(count, size_t);
+    VA_SHIFT(fmt, char *);
+    (void) vsnprintf(str, count, fmt, ap);
+    VA_END;
+    return (strlen(str));
+}
+#endif                          /* !HAVE_SNPRINTF */
+
+#ifdef TEST_SNPRINTF
+#ifndef LONG_STRING
+#define LONG_STRING 1024
+#endif
+int
+main(void)
+{
+    char            buf1[LONG_STRING];
+    char            buf2[LONG_STRING];
+    char           *fp_fmt[] = {
+        "%-1.5f",
+        "%1.5f",
+        "%123.9f",
+        "%10.5f",
+        "% 10.5f",
+        "%+22.9f",
+        "%+4.9f",
+        "%01.3f",
+        "%4f",
+        "%3.1f",
+        "%3.2f",
+        "%.0f",
+        "%.1f",
+        NULL
+    };
+    double          fp_nums[] =
+        { -1.5, 134.21, 91340.2, 341.1234, 0203.9, 0.96, 0.996,
+        0.9996, 1.996, 4.136, 0
+    };
+    char           *int_fmt[] = {
+        "%-1.5d",
+        "%1.5d",
+        "%123.9d",
+        "%5.5d",
+        "%10.5d",
+        "% 10.5d",
+        "%+22.33d",
+        "%01.3d",
+        "%4d",
+        NULL
+    };
+    long            int_nums[] = { -1, 134, 91340, 341, 0203, 0 };
+    int             x, y;
+    int             fail = 0;
+    int             num = 0;
+
+    printf("Testing snprintf format codes against system sprintf...\n");
+
+    for (x = 0; fp_fmt[x] != NULL; x++)
+        for (y = 0; fp_nums[y] != 0; y++) {
+            snprintf(buf1, sizeof(buf1), fp_fmt[x], fp_nums[y]);
+            sprintf(buf2, fp_fmt[x], fp_nums[y]);
+            if (strcmp(buf1, buf2)) {
+                printf
+                    ("snprintf doesn't match Format: %s\n\tsnprintf = %s\n\tsprintf  = %s\n",
+                     fp_fmt[x], buf1, buf2);
+                fail++;
+            }
+            num++;
+        }
+
+    for (x = 0; int_fmt[x] != NULL; x++)
+        for (y = 0; int_nums[y] != 0; y++) {
+            snprintf(buf1, sizeof(buf1), int_fmt[x], int_nums[y]);
+            sprintf(buf2, int_fmt[x], int_nums[y]);
+            if (strcmp(buf1, buf2)) {
+                printf
+                    ("snprintf doesn't match Format: %s\n\tsnprintf = %s\n\tsprintf  = %s\n",
+                     int_fmt[x], buf1, buf2);
+                fail++;
+            }
+            num++;
+        }
+    printf("%d tests failed out of %d.\n", fail, num);
+}
+#endif                          /* SNPRINTF_TEST */
+
+#endif                          /* !HAVE_SNPRINTF */
diff -Naur tomato/release/src/router/snmp/snmplib/strlcpy.c tomato121/release/src/router/snmp/snmplib/strlcpy.c
--- tomato/release/src/router/snmp/snmplib/strlcpy.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/snmplib/strlcpy.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,45 @@
+/*
+ * Copyright © 2003 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms specified in the COPYING file
+ * distributed with the Net-SNMP package.
+ */
+#include <net-snmp/net-snmp-config.h>
+
+#if !HAVE_STRLCPY
+
+#if HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+
+#include <sys/types.h>
+
+/* 
+ * Copies src to the dest buffer. The copy will never overflow the dest buffer
+ * and dest will always be null terminated, len is the size of the dest buffer.
+ *
+ * Returns the length of the src buffer.
+ */ 
+size_t 
+strlcpy(char *dest, const char *src, size_t len) 
+{ 
+	size_t src_len = strlen(src); 
+	size_t new_len; 
+
+	if (len == 0) {
+		return (src_len);
+	}
+
+        if (src_len >= len) {
+		new_len = len - 1;
+	} else {
+                new_len = src_len;
+	}
+
+        memcpy(dest, src, new_len); 
+	dest[new_len] = '\0'; 
+	return (src_len); 
+}
+
+#endif                    /* !HAVE_STRLCPY */
diff -Naur tomato/release/src/router/snmp/snmplib/strtol.c tomato121/release/src/router/snmp/snmplib/strtol.c
--- tomato/release/src/router/snmp/snmplib/strtol.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/snmplib/strtol.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,133 @@
+/*
+ * Copyright (c) 1990 The Regents of the University of California.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *        notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *        notice, this list of conditions and the following disclaimer in the
+ *        documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *        must display the following acknowledgement:
+ *              This product includes software developed by the University of
+ *              California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ *        may be used to endorse or promote products derived from this software
+ *        without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.      IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <net-snmp/net-snmp-config.h>
+
+#if defined(LIBC_SCCS) && !defined(lint)
+static char     sccsid[] = "@(#)strtol.c    5.4 (Berkeley) 2/23/91";
+#endif                          /* LIBC_SCCS and not lint */
+
+#if !HAVE_STRTOL
+
+#if HAVE_LIMITS_H
+#include <limits.h>
+#endif
+#include <ctype.h>
+#include <errno.h>
+#if HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+
+/*
+ * Convert a string to a long integer.
+ *
+ * Ignores `locale' stuff.  Assumes that the upper and lower case
+ * alphabets and digits are each contiguous.
+ */
+long
+strtol(const char *nptr, char **endptr, int base)
+{
+    const char     *s = nptr;
+    unsigned long   acc;
+    int             c;
+    unsigned long   cutoff;
+    int             neg = 0, any, cutlim;
+
+    /*
+     * Skip white space and pick up leading +/- sign if any. If base is 0,
+     * allow 0x for hex and 0 for octal, else assume decimal; if base is
+     * already 16, allow 0x.
+     */
+    do {
+        c = *s++;
+    } while (isspace(c));
+    if (c == '-') {
+        neg = 1;
+        c = *s++;
+    } else if (c == '+')
+        c = *s++;
+    if ((base == 0 || base == 16) && c == '0' && (*s == 'x' || *s == 'X')) {
+        c = s[1];
+        s += 2;
+        base = 16;
+    }
+    if (base == 0)
+        base = c == '0' ? 8 : 10;
+
+    /*
+     * Compute the cutoff value between legal numbers and illegal numbers.
+     * That is the largest legal value, divided by the base.  An input
+     * number that is greater than this value, if followed by a legal
+     * input character, is too big.  One that is equal to this value may
+     * be valid or not; the limit between valid and invalid numbers is
+     * then based on the last digit.  For instance, if the range for longs
+     * is [-2147483648..2147483647] and the input base is 10, cutoff will
+     * be set to 214748364 and cutlim to either 7 (neg==0) or 8 (neg==1),
+     * meaning that if we have accumulated a value > 214748364, or equal
+     * but the next digit is > 7 (or 8), the number is too big, and we
+     * will return a range error.
+     *
+     * Set any if any `digits' consumed; make it negative to indicate
+     * overflow.
+     */
+    cutoff = neg ? -(unsigned long) LONG_MIN : LONG_MAX;
+    cutlim = cutoff % (unsigned long) base;
+    cutoff /= (unsigned long) base;
+    for (acc = 0, any = 0;; c = *s++) {
+        if (isdigit(c))
+            c -= '0';
+        else if (isalpha(c))
+            c -= isupper(c) ? 'A' - 10 : 'a' - 10;
+        else
+            break;
+        if (c >= base)
+            break;
+        if (any < 0 || acc > cutoff || acc == cutoff && c > cutlim)
+            any = -1;
+        else {
+            any = 1;
+            acc *= base;
+            acc += c;
+        }
+    }
+    if (any < 0) {
+        acc = neg ? LONG_MIN : LONG_MAX;
+        errno = ERANGE;
+    } else if (neg)
+        acc = -acc;
+    if (endptr != 0)
+        *endptr = any ? s - 1 : (char *) nptr;
+    return (acc);
+}
+
+#endif                          /* !HAVE_STRTOL */
diff -Naur tomato/release/src/router/snmp/snmplib/strtoul.c tomato121/release/src/router/snmp/snmplib/strtoul.c
--- tomato/release/src/router/snmp/snmplib/strtoul.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/snmplib/strtoul.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,115 @@
+/*
+ * Copyright (c) 1990, 1993
+ *      The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *        notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *        notice, this list of conditions and the following disclaimer in the
+ *        documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *        must display the following acknowledgement:
+ *      This product includes software developed by the University of
+ *      California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ *        may be used to endorse or promote products derived from this software
+ *        without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.      IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <net-snmp/net-snmp-config.h>
+
+#if !HAVE_STRTOUL
+
+#if defined(LIBC_SCCS) && !defined(lint)
+static char     sccsid[] = "@(#)strtoul.c   8.1 (Berkeley) 6/4/93";
+#endif                          /* LIBC_SCCS and not lint */
+
+#if HAVE_LIMITS_H
+#include <limits.h>
+#endif
+#include <ctype.h>
+#include <errno.h>
+#if HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+
+/*
+ * Convert a string to an unsigned long integer.
+ *
+ * Ignores `locale' stuff.  Assumes that the upper and lower case
+ * alphabets and digits are each contiguous.
+ */
+unsigned long
+strtoul(const char *nptr, char **endptr, int base)
+{
+    const char     *s = nptr;
+    unsigned long   acc;
+    unsigned char   c;
+    unsigned long   cutoff;
+    int             neg = 0, any, cutlim;
+
+    /*
+     * See strtol for comments as to the logic used.
+     */
+    do {
+        c = *s++;
+    } while (isspace(c));
+    if (c == '-') {
+        neg = 1;
+        c = *s++;
+    } else if (c == '+')
+        c = *s++;
+    if ((base == 0 || base == 16) && c == '0' && (*s == 'x' || *s == 'X')) {
+        c = s[1];
+        s += 2;
+        base = 16;
+    }
+    if (base == 0)
+        base = c == '0' ? 8 : 10;
+    cutoff = (unsigned long) ULONG_MAX / (unsigned long) base;
+    cutlim = (unsigned long) ULONG_MAX % (unsigned long) base;
+    for (acc = 0, any = 0;; c = *s++) {
+        if (!isascii(c))
+            break;
+        if (isdigit(c))
+            c -= '0';
+        else if (isalpha(c))
+            c -= isupper(c) ? 'A' - 10 : 'a' - 10;
+        else
+            break;
+        if (c >= base)
+            break;
+        if (any < 0 || acc > cutoff || (acc == cutoff && c > cutlim))
+            any = -1;
+        else {
+            any = 1;
+            acc *= base;
+            acc += c;
+        }
+    }
+    if (any < 0) {
+        acc = ULONG_MAX;
+        errno = ERANGE;
+    } else if (neg)
+        acc = -acc;
+    if (endptr != 0)
+        *endptr = (char *) (any ? s - 1 : nptr);
+    return (acc);
+}
+
+#endif                          /* !HAVE_STRTOUL */
diff -Naur tomato/release/src/router/snmp/snmplib/system.c tomato121/release/src/router/snmp/snmplib/system.c
--- tomato/release/src/router/snmp/snmplib/system.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/snmplib/system.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,894 @@
+/*
+ * system.c
+ */
+/***********************************************************
+        Copyright 1992 by Carnegie Mellon University
+
+                      All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of CMU not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+CMU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+CMU BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+******************************************************************/
+/*
+ * System dependent routines go here
+ */
+#include <net-snmp/net-snmp-config.h>
+#include <stdio.h>
+#include <ctype.h>
+#include <errno.h>
+
+#if HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#if HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+
+#if TIME_WITH_SYS_TIME
+# ifdef WIN32
+#  include <sys/timeb.h>
+# else
+#  include <sys/time.h>
+# endif
+# include <time.h>
+#else
+# if HAVE_SYS_TIME_H
+#  include <sys/time.h>
+# else
+#  include <time.h>
+# endif
+#endif
+
+#include <sys/types.h>
+
+#if HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+
+#if HAVE_WINSOCK_H
+#include <winsock.h>
+#endif
+#if HAVE_SYS_SOCKET_H
+#include <sys/socket.h>
+#endif
+#if HAVE_NET_IF_H
+#include <net/if.h>
+#endif
+
+#if HAVE_SYS_SOCKIO_H
+#include <sys/sockio.h>
+#endif
+
+#if HAVE_SYS_IOCTL_H
+#include <sys/ioctl.h>
+#endif
+
+#ifdef HAVE_NLIST_H
+#include <nlist.h>
+#endif
+
+#if HAVE_SYS_FILE_H
+#include <sys/file.h>
+#endif
+
+#if HAVE_KSTAT_H
+#include <kstat.h>
+#endif
+
+#if HAVE_SYS_PARAM_H
+#include <sys/param.h>
+#endif
+#if HAVE_SYS_SYSCTL_H
+#include <sys/sysctl.h>
+#endif
+
+#if HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+
+#if HAVE_DMALLOC_H
+#include <dmalloc.h>
+#endif
+
+#ifdef HAVE_SYS_STAT_H
+#include <sys/stat.h>
+#endif
+
+#if defined(hpux10) || defined(hpux11)
+#include <sys/pstat.h>
+#endif
+
+#include <net-snmp/types.h>
+#include <net-snmp/output_api.h>
+#include <net-snmp/utilities.h>
+#include <net-snmp/library/system.h>    /* for "internal" definitions */
+
+#include <net-snmp/library/snmp_api.h>
+
+#ifndef IFF_LOOPBACK
+#	define IFF_LOOPBACK 0
+#endif
+
+#ifdef  INADDR_LOOPBACK
+# define LOOPBACK    INADDR_LOOPBACK
+#else
+# define LOOPBACK    0x7f000001
+#endif
+
+
+
+/*
+ * ********************************************* 
+ */
+#ifdef							WIN32
+#	define WIN32_LEAN_AND_MEAN
+#	define WIN32IO_IS_STDIO
+#	define PATHLEN	1024
+
+#	include <tchar.h>
+#	include <windows.h>
+
+
+/*
+ * The idea here is to read all the directory names into a string table
+ * * (separated by nulls) and when one of the other dir functions is called
+ * * return the pointer to the current file name.
+ */
+DIR            *
+opendir(const char *filename)
+{
+    DIR            *p;
+    long            len;
+    long            idx;
+    char            scannamespc[PATHLEN];
+    char           *scanname = scannamespc;
+    struct stat     sbuf;
+    WIN32_FIND_DATA FindData;
+    HANDLE          fh;
+
+    /*
+     * check to see if filename is a directory 
+     */
+    if (stat(filename, &sbuf) < 0 || sbuf.st_mode & S_IFDIR == 0) {
+        return NULL;
+    }
+
+    /*
+     * get the file system characteristics 
+     */
+    /*
+     * if(GetFullPathName(filename, SNMP_MAXPATH, root, &dummy)) {
+     * *    if(dummy = strchr(root, '\\'))
+     * *        *++dummy = '\0';
+     * *    if(GetVolumeInformation(root, volname, SNMP_MAXPATH, &serial,
+     * *                            &maxname, &flags, 0, 0)) {
+     * *        downcase = !(flags & FS_CASE_IS_PRESERVED);
+     * *    }
+     * *  }
+     * *  else {
+     * *    downcase = TRUE;
+     * *  }
+     */
+
+    /*
+     * Create the search pattern 
+     */
+    strcpy(scanname, filename);
+
+    if (strchr("/\\", *(scanname + strlen(scanname) - 1)) == NULL)
+        strcat(scanname, "/*");
+    else
+        strcat(scanname, "*");
+
+    /*
+     * do the FindFirstFile call 
+     */
+    fh = FindFirstFile(scanname, &FindData);
+    if (fh == INVALID_HANDLE_VALUE) {
+        return NULL;
+    }
+
+    /*
+     * Get us a DIR structure 
+     */
+    p = (DIR *) malloc(sizeof(DIR));
+    /*
+     * Newz(1303, p, 1, DIR); 
+     */
+    if (p == NULL)
+        return NULL;
+
+    /*
+     * now allocate the first part of the string table for
+     * * the filenames that we find.
+     */
+    idx = strlen(FindData.cFileName) + 1;
+    p->start = (char *) malloc(idx);
+    /*
+     * New(1304, p->start, idx, char);
+     */
+    if (p->start == NULL) {
+        free(p);
+        return NULL;
+    }
+    strcpy(p->start, FindData.cFileName);
+    /*
+     * if(downcase)
+     * *    strlwr(p->start);
+     */
+    p->nfiles = 0;
+
+    /*
+     * loop finding all the files that match the wildcard
+     * * (which should be all of them in this directory!).
+     * * the variable idx should point one past the null terminator
+     * * of the previous string found.
+     */
+    while (FindNextFile(fh, &FindData)) {
+        len = strlen(FindData.cFileName);
+        /*
+         * bump the string table size by enough for the
+         * * new name and it's null terminator
+         */
+        p->start = (char *) realloc((void *) p->start, idx + len + 1);
+        /*
+         * Renew(p->start, idx+len+1, char);
+         */
+        if (p->start == NULL) {
+            free(p);
+            return NULL;
+        }
+        strcpy(&p->start[idx], FindData.cFileName);
+        /*
+         * if (downcase) 
+         * *        strlwr(&p->start[idx]);
+         */
+        p->nfiles++;
+        idx += len + 1;
+    }
+    FindClose(fh);
+    p->size = idx;
+    p->curr = p->start;
+    return p;
+}
+
+
+/*
+ * Readdir just returns the current string pointer and bumps the
+ * * string pointer to the nDllExport entry.
+ */
+struct direct  *
+readdir(DIR * dirp)
+{
+    int             len;
+    static int      dummy = 0;
+
+    if (dirp->curr) {
+        /*
+         * first set up the structure to return 
+         */
+        len = strlen(dirp->curr);
+        strcpy(dirp->dirstr.d_name, dirp->curr);
+        dirp->dirstr.d_namlen = len;
+
+        /*
+         * Fake an inode 
+         */
+        dirp->dirstr.d_ino = dummy++;
+
+        /*
+         * Now set up for the nDllExport call to readdir 
+         */
+        dirp->curr += len + 1;
+        if (dirp->curr >= (dirp->start + dirp->size)) {
+            dirp->curr = NULL;
+        }
+
+        return &(dirp->dirstr);
+    } else
+        return NULL;
+}
+
+/*
+ * free the memory allocated by opendir 
+ */
+int
+closedir(DIR * dirp)
+{
+    free(dirp->start);
+    free(dirp);
+    return 1;
+}
+
+#ifndef HAVE_GETTIMEOFDAY
+
+int
+gettimeofday(struct timeval *tv, struct timezone *tz)
+{
+    struct _timeb   timebuffer;
+
+    _ftime(&timebuffer);
+    tv->tv_usec = timebuffer.millitm * 1000;
+    tv->tv_sec = timebuffer.time;
+    return (0);
+}
+#endif                          /* !HAVE_GETTIMEOFDAY */
+
+in_addr_t
+get_myaddr(void)
+{
+    char            local_host[130];
+    int             result;
+    LPHOSTENT       lpstHostent;
+    SOCKADDR_IN     in_addr, remote_in_addr;
+    SOCKET          hSock;
+    int             nAddrSize = sizeof(SOCKADDR);
+
+    in_addr.sin_addr.s_addr = INADDR_ANY;
+
+    result = gethostname(local_host, sizeof(local_host));
+    if (result == 0) {
+        lpstHostent = gethostbyname((LPSTR) local_host);
+        if (lpstHostent) {
+            in_addr.sin_addr.s_addr =
+                *((u_long FAR *) (lpstHostent->h_addr));
+            return ((in_addr_t) in_addr.sin_addr.s_addr);
+        }
+    }
+
+    /*
+     * if we are here, than we don't have host addr 
+     */
+    hSock = socket(AF_INET, SOCK_DGRAM, 0);
+    if (hSock != INVALID_SOCKET) {
+        /*
+         * connect to any port and address 
+         */
+        remote_in_addr.sin_family = AF_INET;
+        remote_in_addr.sin_port = htons(IPPORT_ECHO);
+        remote_in_addr.sin_addr.s_addr = inet_addr("128.22.33.11");
+        result =
+            connect(hSock, (LPSOCKADDR) & remote_in_addr,
+                    sizeof(SOCKADDR));
+        if (result != SOCKET_ERROR) {
+            /*
+             * get local ip address 
+             */
+            getsockname(hSock, (LPSOCKADDR) & in_addr,
+                        (int FAR *) &nAddrSize);
+        }
+        closesocket(hSock);
+    }
+    return ((in_addr_t) in_addr.sin_addr.s_addr);
+}
+
+long
+get_uptime(void)
+{
+    long            return_value = 0;
+    DWORD           buffersize = (sizeof(PERF_DATA_BLOCK) +
+                                  sizeof(PERF_OBJECT_TYPE)),
+        type = REG_EXPAND_SZ;
+    PPERF_DATA_BLOCK perfdata = NULL;
+
+    /*
+     * min requirement is one PERF_DATA_BLOCK plus one PERF_OBJECT_TYPE 
+     */
+    perfdata = (PPERF_DATA_BLOCK) malloc(buffersize);
+
+
+    memset(perfdata, 0, buffersize);
+
+    RegQueryValueEx(HKEY_PERFORMANCE_DATA,
+                    "Global", NULL, &type, (LPBYTE) perfdata, &buffersize);
+
+    /*
+     * we can not rely on the return value since there is always more so
+     * we check the signature 
+     */
+
+    if (wcsncmp(perfdata->Signature, L"PERF", 4) == 0) {
+        /*
+         * signature ok, and all we need is in the in the PERF_DATA_BLOCK 
+         */
+        return_value = (long) ((perfdata->PerfTime100nSec.QuadPart /
+                                (LONGLONG) 100000));
+    } else
+        return_value = GetTickCount() / 10;
+
+    RegCloseKey(HKEY_PERFORMANCE_DATA);
+    free(perfdata);
+
+    return return_value;
+}
+
+char           *
+winsock_startup(void)
+{
+    WORD            VersionRequested;
+    WSADATA         stWSAData;
+    int             i;
+    static char     errmsg[100];
+
+    VersionRequested = MAKEWORD(1, 1);
+    i = WSAStartup(VersionRequested, &stWSAData);
+    if (i != 0) {
+        if (i == WSAVERNOTSUPPORTED)
+            sprintf(errmsg,
+                    "Unable to init. socket lib, does not support 1.1");
+        else {
+            sprintf(errmsg, "Socket Startup error %d", i);
+        }
+        return (errmsg);
+    }
+    return (NULL);
+}
+
+void
+winsock_cleanup(void)
+{
+    WSACleanup();
+}
+
+#else                           /* ! WIN32 */
+/*******************************************************************/
+
+/*
+ * XXX  What if we have multiple addresses?  Or no addresses for that matter?
+ * XXX  Could it be computed once then cached?  Probably not worth it (not
+ *                                                           used very often).
+ */
+in_addr_t
+get_myaddr(void)
+{
+    int             sd, i, lastlen = 0;
+    struct ifconf   ifc;
+    struct ifreq   *ifrp = NULL;
+    in_addr_t       addr;
+    char           *buf = NULL;
+
+    if ((sd = socket(AF_INET, SOCK_DGRAM, 0)) < 0) {
+        return 0;
+    }
+
+    /*
+     * Cope with lots of interfaces and brokenness of ioctl SIOCGIFCONF on
+     * some platforms; see W. R. Stevens, ``Unix Network Programming Volume
+     * I'', p.435.  
+     */
+
+    for (i = 8;; i += 8) {
+        buf = (char *) calloc(i, sizeof(struct ifreq));
+        if (buf == NULL) {
+            close(sd);
+            return 0;
+        }
+        ifc.ifc_len = i * sizeof(struct ifreq);
+        ifc.ifc_buf = (caddr_t) buf;
+
+        if (ioctl(sd, SIOCGIFCONF, (char *) &ifc) < 0) {
+            if (errno != EINVAL || lastlen != 0) {
+                /*
+                 * Something has gone genuinely wrong.  
+                 */
+                free(buf);
+                close(sd);
+                return 0;
+            }
+            /*
+             * Otherwise, it could just be that the buffer is too small.  
+             */
+        } else {
+            if (ifc.ifc_len == lastlen) {
+                /*
+                 * The length is the same as the last time; we're done.  
+                 */
+                break;
+            }
+            lastlen = ifc.ifc_len;
+        }
+        free(buf);
+    }
+
+    for (ifrp = ifc.ifc_req;
+        (char *)ifrp < (char *)ifc.ifc_req + ifc.ifc_len;
+#ifdef STRUCT_SOCKADDR_HAS_SA_LEN
+        ifrp = (struct ifreq *)(((char *) ifrp) +
+                                sizeof(ifrp->ifr_name) +
+                                ifrp->ifr_addr.sa_len)
+#else
+        ifrp++
+#endif
+        ) {
+        if (ifrp->ifr_addr.sa_family != AF_INET) {
+            continue;
+        }
+        addr = ((struct sockaddr_in *) &(ifrp->ifr_addr))->sin_addr.s_addr;
+
+        if (ioctl(sd, SIOCGIFFLAGS, (char *) ifrp) < 0) {
+            continue;
+        }
+        if ((ifrp->ifr_flags & IFF_UP)
+#ifdef IFF_RUNNING
+            && (ifrp->ifr_flags & IFF_RUNNING)
+#endif                          /* IFF_RUNNING */
+            && !(ifrp->ifr_flags & IFF_LOOPBACK)
+            && addr != LOOPBACK) {
+            /*
+             * I *really* don't understand why this is necessary.  Perhaps for
+             * some broken platform?  Leave it for now.  JBPN  
+             */
+#ifdef SYS_IOCTL_H_HAS_SIOCGIFADDR
+            if (ioctl(sd, SIOCGIFADDR, (char *) ifrp) < 0) {
+                continue;
+            }
+            addr =
+                ((struct sockaddr_in *) &(ifrp->ifr_addr))->sin_addr.
+                s_addr;
+#endif
+            free(buf);
+            close(sd);
+            return addr;
+        }
+    }
+    free(buf);
+    close(sd);
+    return 0;
+}
+
+
+#if !defined(solaris2) && !defined(linux) && !defined(cygwin)
+/*
+ * Returns boottime in centiseconds(!).
+ *      Caches this for future use.
+ */
+long
+get_boottime(void)
+{
+    static long     boottime_csecs = 0;
+#if defined(hpux10) || defined(hpux11)
+    struct pst_static pst_buf;
+#else
+    struct timeval  boottime;
+#ifdef	CAN_USE_SYSCTL
+    int             mib[2];
+    size_t          len;
+#else
+    int             kmem;
+    static struct nlist nl[] = {
+#if !defined(hpux)
+        {(char *) "_boottime"},
+#else
+        {(char *) "boottime"},
+#endif
+        {(char *) ""}
+    };
+#endif                          /* CAN_USE_SYSCTL */
+#endif                          /* hpux10 || hpux 11 */
+
+
+    if (boottime_csecs != 0)
+        return (boottime_csecs);
+
+#if defined(hpux10) || defined(hpux11)
+    pstat_getstatic(&pst_buf, sizeof(struct pst_static), 1, 0);
+    boottime_csecs = pst_buf.boot_time * 100;
+#else
+#ifdef CAN_USE_SYSCTL
+    mib[0] = CTL_KERN;
+    mib[1] = KERN_BOOTTIME;
+
+    len = sizeof(boottime);
+
+    sysctl(mib, 2, &boottime, &len, NULL, NULL);
+    boottime_csecs = (boottime.tv_sec * 100) + (boottime.tv_usec / 10000);
+#else                           /* CAN_USE_SYSCTL */
+    if ((kmem = open("/dev/kmem", 0)) < 0)
+        return 0;
+    nlist(KERNEL_LOC, nl);
+    if (nl[0].n_type == 0) {
+        close(kmem);
+        return 0;
+    }
+
+    lseek(kmem, (long) nl[0].n_value, L_SET);
+    read(kmem, &boottime, sizeof(boottime));
+    close(kmem);
+    boottime_csecs = (boottime.tv_sec * 100) + (boottime.tv_usec / 10000);
+#endif                          /* CAN_USE_SYSCTL */
+#endif                          /* hpux10 || hpux 11 */
+
+    return (boottime_csecs);
+}
+#endif
+
+/*
+ * Returns uptime in centiseconds(!).
+ */
+long
+get_uptime(void)
+{
+#if !defined(solaris2) && !defined(linux) && !defined(cygwin)
+    struct timeval  now;
+    long            boottime_csecs, nowtime_csecs;
+
+    boottime_csecs = get_boottime();
+    if (boottime_csecs == 0)
+        return 0;
+    gettimeofday(&now, (struct timezone *) 0);
+    nowtime_csecs = (now.tv_sec * 100) + (now.tv_usec / 10000);
+
+    return (nowtime_csecs - boottime_csecs);
+#endif
+
+#ifdef solaris2
+    kstat_ctl_t    *ksc = kstat_open();
+    kstat_t        *ks;
+    kid_t           kid;
+    kstat_named_t  *named;
+    u_long          lbolt = 0;
+
+    if (ksc) {
+        ks = kstat_lookup(ksc, "unix", -1, "system_misc");
+        if (ks) {
+            kid = kstat_read(ksc, ks, NULL);
+            if (kid != -1) {
+                named = kstat_data_lookup(ks, "lbolt");
+                if (named) {
+#ifdef KSTAT_DATA_INT32
+                    lbolt = named->value.ul;
+#else
+                    lbolt = named->value.ul;
+#endif
+                }
+            }
+        }
+        kstat_close(ksc);
+    }
+    return lbolt;
+#endif                          /* solaris2 */
+
+#ifdef linux
+    FILE           *in = fopen("/proc/uptime", "r");
+    long            uptim = 0, a, b;
+    if (in) {
+        if (2 == fscanf(in, "%ld.%ld", &a, &b))
+            uptim = a * 100 + b;
+        fclose(in);
+    }
+    return uptim;
+#endif                          /* linux */
+
+#ifdef cygwin
+    return (0);                 /* not implemented */
+#endif
+}
+
+#endif                          /* ! WIN32 */
+/*******************************************************************/
+
+#ifndef HAVE_STRNCASECMP
+
+/*
+ * test for NULL pointers before and NULL characters after
+ * * comparing possibly non-NULL strings.
+ * * WARNING: This function does NOT check for array overflow.
+ */
+int
+strncasecmp(const char *s1, const char *s2, size_t nch)
+{
+    size_t          ii;
+    int             res = -1;
+
+    if (!s1) {
+        if (!s2)
+            return 0;
+        return (-1);
+    }
+    if (!s2)
+        return (1);
+
+    for (ii = 0; (ii < nch) && *s1 && *s2; ii++, s1++, s2++) {
+        res = (int) (tolower(*s1) - tolower(*s2));
+        if (res != 0)
+            break;
+    }
+
+    if (ii == nch) {
+        s1--;
+        s2--;
+    }
+
+    if (!*s1) {
+        if (!*s2)
+            return 0;
+        return (-1);
+    }
+    if (!*s2)
+        return (1);
+
+    return (res);
+}
+
+int
+strcasecmp(const char *s1, const char *s2)
+{
+    return strncasecmp(s1, s2, 1000000);
+}
+
+#endif                          /* HAVE_STRNCASECMP */
+
+
+#ifndef HAVE_STRDUP
+char           *
+strdup(const char *src)
+{
+    int             len;
+    char           *dst;
+
+    len = strlen(src) + 1;
+    if ((dst = (char *) malloc(len)) == NULL)
+        return (NULL);
+    strcpy(dst, src);
+    return (dst);
+}
+#endif                          /* HAVE_STRDUP */
+
+#ifndef HAVE_SETENV
+int
+setenv(const char *name, const char *value, int overwrite)
+{
+    char           *cp;
+    int             ret;
+
+    if (overwrite == 0) {
+        if (getenv(name))
+            return 0;
+    }
+    cp = (char *) malloc(strlen(name) + strlen(value) + 2);
+    if (cp == NULL)
+        return -1;
+    sprintf(cp, "%s=%s", name, value);
+    ret = putenv(cp);
+#ifdef WIN32
+    free(cp);
+#endif
+    return ret;
+}
+#endif                          /* HAVE_SETENV */
+
+int
+calculate_time_diff(struct timeval *now, struct timeval *then)
+{
+    struct timeval  tmp, diff;
+    memcpy(&tmp, now, sizeof(struct timeval));
+    tmp.tv_sec--;
+    tmp.tv_usec += 1000000L;
+    diff.tv_sec = tmp.tv_sec - then->tv_sec;
+    diff.tv_usec = tmp.tv_usec - then->tv_usec;
+    if (diff.tv_usec > 1000000L) {
+        diff.tv_usec -= 1000000L;
+        diff.tv_sec++;
+    }
+    return ((diff.tv_sec * 100) + (diff.tv_usec / 10000));
+}
+
+#ifndef HAVE_STRCASESTR
+/*
+ * only glibc2 has this.
+ */
+char           *
+strcasestr(const char *haystack, const char *needle)
+{
+    const char     *cp1 = haystack, *cp2 = needle;
+    const char     *cx;
+    int             tstch1, tstch2;
+
+    /*
+     * printf("looking for '%s' in '%s'\n", needle, haystack); 
+     */
+    if (cp1 && cp2 && *cp1 && *cp2)
+        for (cp1 = haystack, cp2 = needle; *cp1;) {
+            cx = cp1;
+            cp2 = needle;
+            do {
+                /*
+                 * printf("T'%c' ", *cp1); 
+                 */
+                if (!*cp2) {    /* found the needle */
+                    /*
+                     * printf("\nfound '%s' in '%s'\n", needle, cx); 
+                     */
+                    return (char *) cx;
+                }
+                if (!*cp1)
+                    break;
+
+                tstch1 = toupper(*cp1);
+                tstch2 = toupper(*cp2);
+                if (tstch1 != tstch2)
+                    break;
+                /*
+                 * printf("M'%c' ", *cp1); 
+                 */
+                cp1++;
+                cp2++;
+            }
+            while (1);
+            if (*cp1)
+                cp1++;
+        }
+    /*
+     * printf("\n"); 
+     */
+    if (cp1 && *cp1)
+        return (char *) cp1;
+
+    return NULL;
+}
+#endif
+
+int
+mkdirhier(const char *pathname, mode_t mode, int skiplast)
+{
+    struct stat     sbuf;
+    char           *ourcopy = strdup(pathname);
+    char           *entry;
+    char            buf[SNMP_MAXPATH];
+
+    entry = strtok(ourcopy, "/");
+
+    buf[0] = '\0';
+    /*
+     * check to see if filename is a directory 
+     */
+    while (entry) {
+        strcat(buf, "/");
+        strcat(buf, entry);
+        entry = strtok(NULL, "/");
+        if (entry == NULL && skiplast)
+            break;
+        if (stat(buf, &sbuf) < 0) {
+            /*
+             * DNE, make it 
+             */
+            snmp_log(LOG_INFO, "Creating directory: %s\n", buf);
+#ifdef WIN32
+            CreateDirectory(buf, NULL);
+#else
+            if (mkdir(buf, mode) == -1) {
+                free(ourcopy);
+                return SNMPERR_GENERR;
+            }
+#endif
+        } else {
+            /*
+             * exists, is it a file? 
+             */
+            if ((sbuf.st_mode & S_IFDIR) == 0) {
+                /*
+                 * ack! can't make a directory on top of a file 
+                 */
+                free(ourcopy);
+                return SNMPERR_GENERR;
+            }
+        }
+    }
+    free(ourcopy);
+    return SNMPERR_SUCCESS;
+}
diff -Naur tomato/release/src/router/snmp/snmplib/test_binary_array.c tomato121/release/src/router/snmp/snmplib/test_binary_array.c
--- tomato/release/src/router/snmp/snmplib/test_binary_array.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/snmplib/test_binary_array.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,171 @@
+#include <net-snmp/net-snmp-config.h>
+
+#if HAVE_IO_H
+#include <io.h>
+#endif
+#include <stdio.h>
+#if HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#if HAVE_MALLOC_H
+#include <malloc.h>
+#endif
+#include <sys/types.h>
+#if HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/types.h>
+#include <net-snmp/library/snmp_api.h>
+#include <net-snmp/library/container.h>
+#include <net-snmp/library/container_binary_array.h>
+#include <net-snmp/library/tools.h>
+#include <net-snmp/library/snmp_assert.h>
+
+#define TEST_SIZE 7
+
+void
+print_int(netsnmp_index *i, void *v)
+{
+    printf("item %p = %ld\n", i, i->oids[0]);
+}
+
+int
+test_int(void)
+{
+    oid o1 = 1;
+    oid o2 = 2;
+    oid o3 = 6;
+    oid o4 = 8;
+    oid o5 = 9;
+    oid ox = 7;
+    oid oy = 10;
+    netsnmp_index i1,i2,i3,i4,i5,ix,iy, *ip;
+    netsnmp_index *a[TEST_SIZE] = { &i1, &i2, &i3, &ix, &i4, &i5, &iy };
+    netsnmp_container *c = netsnmp_container_get_binary_array();
+    int i;
+
+    c->compare = netsnmp_compare_netsnmp_index;
+    
+    i1.oids = &o1;
+    i2.oids = &o2;
+    i3.oids = &o3;
+    i4.oids = &o4;
+    i5.oids = &o5;
+    ix.oids = &ox;
+    iy.oids = &oy;
+    i1.len = i2.len = i3.len = i4.len = i5.len = ix.len = iy.len = 1;
+
+    printf("Creating container...\n");
+
+    printf("Inserting data...\n");
+    CONTAINER_INSERT(c,&i4);
+    CONTAINER_INSERT(c,&i2);
+    CONTAINER_INSERT(c,&i3);
+    CONTAINER_INSERT(c,&i1);
+    CONTAINER_INSERT(c,&i5);
+
+    printf("For each...\n");
+    CONTAINER_FOR_EACH(c, print_int, NULL);
+    printf("Done.\n");
+
+    printf("\n");
+    ip = CONTAINER_FIRST(c);
+    printf("Find first = %p %ld\n",ip, ip->oids[0]);
+    while( ip ) {
+        ip = CONTAINER_NEXT(c,ip);
+        if(ip)
+            printf("Find next = %p %ld\n",ip, ip->oids[0]);
+        else
+            printf("Find next = %s\n",ip);
+    }
+
+    for( i=0; i < TEST_SIZE; ++i) {
+        printf("\n");
+        ip = CONTAINER_FIND(c,a[i]);
+        printf("Find %ld = %p %ld\n", a[i]->oids[0], ip, ip ? ip->oids[0] : 0);
+        ip = CONTAINER_NEXT(c,a[i]);
+        printf("Next %ld = %p %ld\n", a[i]->oids[0], ip, ip ? ip->oids[0] : 0);
+    }
+
+    printf("Done.\n");
+
+    return 0;
+}
+
+void
+print_string(char *i, void *v)
+{
+    printf("item %s\n", i);
+}
+
+int
+my_strcmp(char *lhs, char *rhs)
+{
+    int rc = strcmp(lhs,rhs);
+/*      printf("%s %d %s\n",lhs, rc, rhs); */
+    return rc;
+}
+
+int
+test_string()
+{
+    const char *o1 = "zebra";
+    const char *o2 = "b-two";
+    const char *o3 = "b";
+    const char *o4 = "cedar";
+    const char *o5 = "alpha";
+    const char *ox = "dev";
+    const char *oy = "aa";
+    const char * ip;
+    
+    const char *a[TEST_SIZE] = { o1, o2, o3, ox, o4, o5, oy };
+    netsnmp_container *c = netsnmp_container_get_binary_array();
+    int i;
+
+    c->compare = my_strcmp;
+    
+    printf("Creating container...\n");
+
+    printf("Inserting data...\n");
+    CONTAINER_INSERT(c,o4);
+    CONTAINER_INSERT(c,o2);
+    CONTAINER_INSERT(c,o3);
+    CONTAINER_INSERT(c,o1);
+    CONTAINER_INSERT(c,o5);
+    printf("\n");
+    printf("For each...\n");
+    CONTAINER_FOR_EACH(c, print_string, NULL);
+    printf("Done.\n");
+
+    printf("\n");
+    ip = CONTAINER_FIRST(c);
+    printf("Find first = %s\n",ip);
+    while( ip ) {
+        ip = CONTAINER_NEXT(c,ip);
+        printf("Find next = %s\n",ip);
+    }
+
+    for( i=0; i < TEST_SIZE; ++i) {
+        printf("\n");
+        ip = CONTAINER_FIND(c,a[i]);
+        printf("Find %s = %s\n", a[i], ip);
+        ip = CONTAINER_NEXT(c,a[i]);
+        printf("Next %s = %s\n", a[i], ip);
+    }
+
+    printf("Done.\n");
+
+    return 0;
+}
+
+int
+main(int argc, char** argv)
+{
+
+    test_int();
+    test_string();
+}
diff -Naur tomato/release/src/router/snmp/snmplib/tools.c tomato121/release/src/router/snmp/snmplib/tools.c
--- tomato/release/src/router/snmp/snmplib/tools.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/snmplib/tools.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,839 @@
+/*
+ * tools.c
+ */
+
+#include <net-snmp/net-snmp-config.h>
+
+#include <ctype.h>
+#include <stdio.h>
+#include <sys/types.h>
+#if TIME_WITH_SYS_TIME
+# ifdef WIN32
+#  include <sys/timeb.h>
+# else
+#  include <sys/time.h>
+# endif
+# include <time.h>
+#else
+# if HAVE_SYS_TIME_H
+#  include <sys/time.h>
+# else
+#  include <time.h>
+# endif
+#endif
+#ifdef HAVE_SYS_SOCKET_H
+#include <sys/socket.h>
+#endif
+#if HAVE_WINSOCK_H
+#include <winsock.h>
+#endif
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#if HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+#ifdef HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+#ifdef HAVE_ARPA_INET_H
+#include <arpa/inet.h>
+#endif
+
+#if HAVE_DMALLOC_H
+#include <dmalloc.h>
+#endif
+
+#include <net-snmp/types.h>
+#include <net-snmp/output_api.h>
+#include <net-snmp/utilities.h>
+#include <net-snmp/library/tools.h>     /* for "internal" definitions */
+
+#include <net-snmp/library/snmp_api.h>
+#include <net-snmp/library/mib.h>
+#include <net-snmp/library/scapi.h>
+
+
+/*
+ * snmp_realloc:
+ * 
+ * Parameters:
+ * 
+ * buf  pointer to a buffer pointer
+ * buf_len      pointer to current size of buffer in bytes
+ * 
+ * This function increase the size of the buffer pointed at by *buf, which is
+ * initially of size *buf_len.  Contents are preserved **AT THE BOTTOM END OF
+ * THE BUFFER**.  If memory can be (re-)allocated then it returns 1, else it
+ * returns 0.
+ * 
+ */
+
+int
+snmp_realloc(u_char ** buf, size_t * buf_len)
+{
+    u_char         *new_buf = NULL;
+    size_t          new_buf_len = 0;
+
+    if (buf == NULL) {
+        return 0;
+    }
+
+    /*
+     * The current re-allocation algorithm is to increase the buffer size by
+     * whichever is the greater of 256 bytes or the current buffer size, up to
+     * a maximum increase of 8192 bytes.  
+     */
+
+    if (*buf_len <= 255) {
+        new_buf_len = *buf_len + 256;
+    } else if (*buf_len > 255 && *buf_len <= 8191) {
+        new_buf_len = *buf_len * 2;
+    } else if (*buf_len > 8191) {
+        new_buf_len = *buf_len + 8192;
+    }
+
+    if (*buf == NULL) {
+        new_buf = (u_char *) malloc(new_buf_len);
+    } else {
+        new_buf = (u_char *) realloc(*buf, new_buf_len);
+    }
+
+    if (new_buf != NULL) {
+        *buf = new_buf;
+        *buf_len = new_buf_len;
+        return 1;
+    } else {
+        return 0;
+    }
+}
+
+int
+snmp_strcat(u_char ** buf, size_t * buf_len, size_t * out_len,
+            int allow_realloc, const u_char * s)
+{
+    if (buf == NULL || buf_len == NULL || out_len == NULL) {
+        return 0;
+    }
+
+    if (s == NULL) {
+        /*
+         * Appending a NULL string always succeeds since it is a NOP.  
+         */
+        return 1;
+    }
+
+    while ((*out_len + strlen((const char *) s) + 1) >= *buf_len) {
+        if (!(allow_realloc && snmp_realloc(buf, buf_len))) {
+            return 0;
+        }
+    }
+
+    strcpy((char *) (*buf + *out_len), (const char *) s);
+    *out_len += strlen((char *) (*buf + *out_len));
+    return 1;
+}
+
+/*******************************************************************-o-******
+ * free_zero
+ *
+ * Parameters:
+ *	*buf	Pointer at bytes to free.
+ *	size	Number of bytes in buf.
+ */
+void
+free_zero(void *buf, size_t size)
+{
+    if (buf) {
+        memset(buf, 0, size);
+        free(buf);
+    }
+
+}                               /* end free_zero() */
+
+
+
+
+/*******************************************************************-o-******
+ * malloc_random
+ *
+ * Parameters:
+ *	size	Number of bytes to malloc() and fill with random bytes.
+ *      
+ * Returns pointer to allocaed & set buffer on success, size contains
+ * number of random bytes filled.
+ *
+ * buf is NULL and *size set to KMT error value upon failure.
+ *
+ */
+u_char         *
+malloc_random(size_t * size)
+{
+    int             rval = SNMPERR_SUCCESS;
+    u_char         *buf = (u_char *) calloc(1, *size);
+
+    if (buf) {
+        rval = sc_random(buf, size);
+
+        if (rval < 0) {
+            free_zero(buf, *size);
+            buf = NULL;
+        } else {
+            *size = rval;
+        }
+    }
+
+    return buf;
+
+}                               /* end malloc_random() */
+
+
+
+
+/*******************************************************************-o-******
+ * memdup
+ *
+ * Parameters:
+ *	to       Pointer to allocate and copy memory to.
+ *      from     Pointer to copy memory from.
+ *      size     Size of the data to be copied.
+ *      
+ * Returns
+ *	SNMPERR_SUCCESS	On success.
+ *      SNMPERR_GENERR	On failure.
+ */
+int
+memdup(u_char ** to, const u_char * from, size_t size)
+{
+    if (to == NULL)
+        return SNMPERR_GENERR;
+    if (from == NULL) {
+        *to = NULL;
+        return SNMPERR_SUCCESS;
+    }
+    if ((*to = (u_char *) malloc(size)) == NULL)
+        return SNMPERR_GENERR;
+    memcpy(*to, from, size);
+    return SNMPERR_SUCCESS;
+
+}                               /* end memdup() */
+
+/** copies a (possible) unterminated string of a given length into a
+ *  new buffer and null terminates it as well (new buffer MAY be one
+ *  byte longer to account for this */
+char           *
+netsnmp_strdup_and_null(const u_char * from, size_t from_len)
+{
+    u_char         *ret;
+
+    if (from_len == 0 || from[from_len - 1] != '\0') {
+        ret = malloc(from_len + 1);
+        if (!ret)
+            return NULL;
+        ret[from_len] = '\0';
+    } else {
+        ret = malloc(from_len);
+        if (!ret)
+            return NULL;
+        ret[from_len - 1] = '\0';
+    }
+    memcpy(ret, from, from_len);
+    return ret;
+}
+
+/*******************************************************************-o-******
+ * binary_to_hex
+ *
+ * Parameters:
+ *	*input		Binary data.
+ *	len		Length of binary data.
+ *	**output	NULL terminated string equivalent in hex.
+ *      
+ * Returns:
+ *	olen	Length of output string not including NULL terminator.
+ *
+ * FIX	Is there already one of these in the UCD SNMP codebase?
+ *	The old one should be used, or this one should be moved to
+ *	snmplib/snmp_api.c.
+ */
+u_int
+binary_to_hex(const u_char * input, size_t len, char **output)
+{
+    u_int           olen = (len * 2) + 1;
+    char           *s = (char *) calloc(1, olen), *op = s;
+    const u_char   *ip = input;
+
+
+    while (ip - input < (int) len) {
+        *op++ = VAL2HEX((*ip >> 4) & 0xf);
+        *op++ = VAL2HEX(*ip & 0xf);
+        ip++;
+    }
+    *op = '\0';
+
+    *output = s;
+    return olen;
+
+}                               /* end binary_to_hex() */
+
+
+
+
+/*******************************************************************-o-******
+ * hex_to_binary2
+ *
+ * Parameters:
+ *	*input		Printable data in base16.
+ *	len		Length in bytes of data.
+ *	**output	Binary data equivalent to input.
+ *      
+ * Returns:
+ *	SNMPERR_GENERR	Failure.
+ *	<len>		Otherwise, Length of allocated string.
+ *
+ *
+ * Input of an odd length is right aligned.
+ *
+ * FIX	Another version of "hex-to-binary" which takes odd length input
+ *	strings.  It also allocates the memory to hold the binary data.
+ *	Should be integrated with the official hex_to_binary() function.
+ */
+int
+hex_to_binary2(const u_char * input, size_t len, char **output)
+{
+    u_int           olen = (len / 2) + (len % 2);
+    char           *s = (char *) calloc(1, (olen) ? olen : 1), *op = s;
+    const u_char   *ip = input;
+
+
+    *output = NULL;
+    *op = 0;
+    if (len % 2) {
+        if (!isxdigit(*ip))
+            goto hex_to_binary2_quit;
+        *op++ = HEX2VAL(*ip);
+        ip++;
+    }
+
+    while (ip - input < (int) len) {
+        if (!isxdigit(*ip))
+            goto hex_to_binary2_quit;
+        *op = HEX2VAL(*ip) << 4;
+        ip++;
+
+        if (!isxdigit(*ip))
+            goto hex_to_binary2_quit;
+        *op++ += HEX2VAL(*ip);
+        ip++;
+    }
+
+    *output = s;
+    return olen;
+
+  hex_to_binary2_quit:
+    free_zero(s, olen);
+    return -1;
+
+}                               /* end hex_to_binary2() */
+
+int
+snmp_decimal_to_binary(u_char ** buf, size_t * buf_len, size_t * out_len,
+                       int allow_realloc, const char *decimal)
+{
+    int             subid = 0;
+    const char     *cp = decimal;
+
+    if (buf == NULL || buf_len == NULL || out_len == NULL
+        || decimal == NULL) {
+        return 0;
+    }
+
+    while (*cp != '\0') {
+        if (isspace((int) *cp) || *cp == '.') {
+            cp++;
+            continue;
+        }
+        if (!isdigit((int) *cp)) {
+            return 0;
+        }
+        if ((subid = atoi(cp)) > 255) {
+            return 0;
+        }
+        if ((*out_len >= *buf_len) &&
+            !(allow_realloc && snmp_realloc(buf, buf_len))) {
+            return 0;
+        }
+        *(*buf + *out_len) = (u_char) subid;
+        (*out_len)++;
+        while (isdigit((int) *cp)) {
+            cp++;
+        }
+    }
+    return 1;
+}
+
+int
+snmp_hex_to_binary(u_char ** buf, size_t * buf_len, size_t * out_len,
+                   int allow_realloc, const char *hex)
+{
+    int             subid = 0;
+    const char     *cp = hex;
+
+    if (buf == NULL || buf_len == NULL || out_len == NULL || hex == NULL) {
+        return 0;
+    }
+
+    if ((*cp == '0') && ((*(cp + 1) == 'x') || (*(cp + 1) == 'X'))) {
+        cp += 2;
+    }
+
+    while (*cp != '\0') {
+        if (isspace((int) *cp)) {
+            cp++;
+            continue;
+        }
+        if (!isxdigit((int) *cp)) {
+            return 0;
+        }
+        if (sscanf(cp, "%2x", &subid) == 0) {
+            return 0;
+        }
+        if ((*out_len >= *buf_len) &&
+            !(allow_realloc && snmp_realloc(buf, buf_len))) {
+            return 0;
+        }
+        *(*buf + *out_len) = (u_char) subid;
+        (*out_len)++;
+        if (*++cp == '\0') {
+            /*
+             * Odd number of hex digits is an error.  
+             */
+            return 0;
+        } else {
+            cp++;
+        }
+    }
+    return 1;
+}
+
+/*******************************************************************-o-******
+ * dump_chunk
+ *
+ * Parameters:
+ *	*title	(May be NULL.)
+ *	*buf
+ *	 size
+ */
+void
+dump_chunk(const char *debugtoken, const char *title, const u_char * buf,
+           int size)
+{
+    u_int           printunit = 64;     /* XXX  Make global. */
+    char            chunk[SNMP_MAXBUF], *s, *sp;
+
+    if (title && (*title != '\0')) {
+        DEBUGMSGTL((debugtoken, "%s\n", title));
+    }
+
+
+    memset(chunk, 0, SNMP_MAXBUF);
+    size = binary_to_hex(buf, size, &s);
+    sp = s;
+
+    while (size > 0) {
+        if (size > (int) printunit) {
+            strncpy(chunk, sp, printunit);
+            chunk[printunit] = '\0';
+            DEBUGMSGTL((debugtoken, "\t%s\n", chunk));
+        } else {
+            DEBUGMSGTL((debugtoken, "\t%s\n", sp));
+        }
+
+        sp += printunit;
+        size -= printunit;
+    }
+
+
+    SNMP_FREE(s);
+
+}                               /* end dump_chunk() */
+
+
+
+
+/*******************************************************************-o-******
+ * dump_snmpEngineID
+ *
+ * Parameters:
+ *	*estring
+ *	*estring_len
+ *      
+ * Returns:
+ *	Allocated memory pointing to a string of buflen char representing
+ *	a printf'able form of the snmpEngineID.
+ *
+ *	-OR- NULL on error.
+ *
+ *
+ * Translates the snmpEngineID TC into a printable string.  From RFC 2271,
+ * Section 5 (pp. 36-37):
+ *
+ * First bit:	0	Bit string structured by means non-SNMPv3.
+ *  		1	Structure described by SNMPv3 SnmpEngineID TC.
+ *  
+ * Bytes 1-4:		Enterprise ID.  (High bit of first byte is ignored.)
+ *  
+ * Byte 5:	0	(RESERVED by IANA.)
+ *  		1	IPv4 address.		(   4 octets)
+ *  		2	IPv6 address.		(  16 octets)
+ *  		3	MAC address.		(   6 octets)
+ *  		4	Locally defined text.	(0-27 octets)
+ *  		5	Locally defined octets.	(0-27 octets)
+ *  		6-127	(RESERVED for enterprise.)
+ *  
+ * Bytes 6-32:		(Determined by byte 5.)
+ *  
+ *
+ * Non-printable characters are given in hex.  Text is given in quotes.
+ * IP and MAC addresses are given in standard (UN*X) conventions.  Sections
+ * are comma separated.
+ *
+ * esp, remaining_len and s trace the state of the constructed buffer.
+ * s will be defined if there is something to return, and it will point
+ * to the end of the constructed buffer.
+ *
+ *
+ * ASSUME  "Text" means printable characters.
+ *
+ * XXX	Must the snmpEngineID always have a minimum length of 12?
+ *	(Cf. part 2 of the TC definition.)
+ * XXX	Does not enforce upper-bound of 32 bytes.
+ * XXX	Need a switch to decide whether to use DNS name instead of a simple
+ *	IP address.
+ *
+ * FIX	Use something other than sprint_hexstring which doesn't add 
+ *	trailing spaces and (sometimes embedded) newlines...
+ */
+#ifdef SNMP_TESTING_CODE
+char           *
+dump_snmpEngineID(const u_char * estring, size_t * estring_len)
+{
+#define eb(b)	( *(esp+b) & 0xff )
+
+    int             rval = SNMPERR_SUCCESS, gotviolation = 0, slen = 0;
+    u_int           remaining_len;
+
+    char            buf[SNMP_MAXBUF], *s = NULL, *t;
+    const u_char   *esp = estring;
+
+    struct in_addr  iaddr;
+
+
+
+    /*
+     * Sanity check.
+     */
+    if (!estring || (*estring_len <= 0)) {
+        QUITFUN(SNMPERR_GENERR, dump_snmpEngineID_quit);
+    }
+    remaining_len = *estring_len;
+    memset(buf, 0, SNMP_MAXBUF);
+
+
+
+    /*
+     * Test first bit.  Return immediately with a hex string, or
+     * begin by formatting the enterprise ID.
+     */
+    if (!(*esp & 0x80)) {
+        sprint_hexstring(buf, esp, remaining_len);
+        s = strchr(buf, '\0');
+        s -= 1;
+        goto dump_snmpEngineID_quit;
+    }
+
+    s = buf;
+    s += sprintf(s, "enterprise %d, ", ((*(esp + 0) & 0x7f) << 24) |
+                 ((*(esp + 1) & 0xff) << 16) |
+                 ((*(esp + 2) & 0xff) << 8) | ((*(esp + 3) & 0xff)));
+    /*
+     * XXX  Ick. 
+     */
+
+    if (remaining_len < 5) {    /* XXX  Violating string. */
+        goto dump_snmpEngineID_quit;
+    }
+
+    esp += 4;                   /* Incremented one more in the switch below. */
+    remaining_len -= 5;
+
+
+
+    /*
+     * Act on the fifth byte.
+     */
+    switch ((int) *esp++) {
+    case 1:                    /* IPv4 address. */
+
+        if (remaining_len < 4)
+            goto dump_snmpEngineID_violation;
+        memcpy(&iaddr.s_addr, esp, 4);
+
+        if (!(t = inet_ntoa(iaddr)))
+            goto dump_snmpEngineID_violation;
+        s += sprintf(s, "%s", t);
+
+        esp += 4;
+        remaining_len -= 4;
+        break;
+
+    case 2:                    /* IPv6 address. */
+
+        if (remaining_len < 16)
+            goto dump_snmpEngineID_violation;
+
+        s += sprintf(s,
+                     "%02X%02X %02X%02X %02X%02X %02X%02X::"
+                     "%02X%02X %02X%02X %02X%02X %02X%02X",
+                     eb(0), eb(1), eb(2), eb(3),
+                     eb(4), eb(5), eb(6), eb(7),
+                     eb(8), eb(9), eb(10), eb(11),
+                     eb(12), eb(13), eb(14), eb(15));
+
+        esp += 16;
+        remaining_len -= 16;
+        break;
+
+    case 3:                    /* MAC address. */
+
+        if (remaining_len < 6)
+            goto dump_snmpEngineID_violation;
+
+        s += sprintf(s, "%02X:%02X:%02X:%02X:%02X:%02X",
+                     eb(0), eb(1), eb(2), eb(3), eb(4), eb(5));
+
+        esp += 6;
+        remaining_len -= 6;
+        break;
+
+    case 4:                    /* Text. */
+
+        /*
+         * Doesn't exist on all (many) architectures 
+         */
+        /*
+         * s += snprintf(s, remaining_len+3, "\"%s\"", esp); 
+         */
+        s += sprintf(s, "\"%s\"", esp);
+        goto dump_snmpEngineID_quit;
+        break;
+     /*NOTREACHED*/ case 5:    /* Octets. */
+
+        sprint_hexstring(s, esp, remaining_len);
+        s = strchr(buf, '\0');
+        s -= 1;
+        goto dump_snmpEngineID_quit;
+        break;
+       /*NOTREACHED*/ dump_snmpEngineID_violation:
+    case 0:                    /* Violation of RESERVED, 
+                                 * *   -OR- of expected length.
+                                 */
+        gotviolation = 1;
+        s += sprintf(s, "!!! ");
+
+    default:                   /* Unknown encoding. */
+
+        if (!gotviolation) {
+            s += sprintf(s, "??? ");
+        }
+        sprint_hexstring(s, esp, remaining_len);
+        s = strchr(buf, '\0');
+        s -= 1;
+
+        goto dump_snmpEngineID_quit;
+
+    }                           /* endswitch */
+
+
+
+    /*
+     * Cases 1-3 (IP and MAC addresses) should not have trailing
+     * octets, but perhaps they do.  Throw them in too.  XXX
+     */
+    if (remaining_len > 0) {
+        s += sprintf(s, " (??? ");
+
+        sprint_hexstring(s, esp, remaining_len);
+        s = strchr(buf, '\0');
+        s -= 1;
+
+        s += sprintf(s, ")");
+    }
+
+
+
+  dump_snmpEngineID_quit:
+    if (s) {
+        slen = s - buf + 1;
+        s = calloc(1, slen);
+        memcpy(s, buf, (slen) - 1);
+    }
+
+    memset(buf, 0, SNMP_MAXBUF);        /* XXX -- Overkill? XXX: Yes! */
+
+    return s;
+
+#undef eb
+}                               /* end dump_snmpEngineID() */
+#endif                          /* SNMP_TESTING_CODE */
+
+
+/*
+ * create a new time marker.
+ * NOTE: Caller must free time marker when no longer needed.
+ */
+marker_t
+atime_newMarker(void)
+{
+    marker_t        pm = (marker_t) calloc(1, sizeof(struct timeval));
+    gettimeofday((struct timeval *) pm, 0);
+    return pm;
+}
+
+/*
+ * set a time marker.
+ */
+void
+atime_setMarker(marker_t pm)
+{
+    if (!pm)
+        return;
+
+    gettimeofday((struct timeval *) pm, 0);
+}
+
+
+/*
+ * Returns the difference (in msec) between the two markers
+ */
+long
+atime_diff(marker_t first, marker_t second)
+{
+    struct timeval *tv1, *tv2, diff;
+
+    tv1 = (struct timeval *) first;
+    tv2 = (struct timeval *) second;
+
+    diff.tv_sec = tv2->tv_sec - tv1->tv_sec - 1;
+    diff.tv_usec = tv2->tv_usec - tv1->tv_usec + 1000000;
+
+    return (diff.tv_sec * 1000 + diff.tv_usec / 1000);
+}
+
+/*
+ * Returns the difference (in u_long msec) between the two markers
+ */
+u_long
+uatime_diff(marker_t first, marker_t second)
+{
+    struct timeval *tv1, *tv2, diff;
+
+    tv1 = (struct timeval *) first;
+    tv2 = (struct timeval *) second;
+
+    diff.tv_sec = tv2->tv_sec - tv1->tv_sec - 1;
+    diff.tv_usec = tv2->tv_usec - tv1->tv_usec + 1000000;
+
+    return (((u_long) diff.tv_sec) * 1000 + diff.tv_usec / 1000);
+}
+
+/*
+ * Returns the difference (in u_long 1/100th secs) between the two markers
+ * (functionally this is what sysUpTime needs)
+ */
+u_long
+uatime_hdiff(marker_t first, marker_t second)
+{
+    struct timeval *tv1, *tv2, diff;
+    u_long          res;
+
+    tv1 = (struct timeval *) first;
+    tv2 = (struct timeval *) second;
+
+    diff.tv_sec = tv2->tv_sec - tv1->tv_sec - 1;
+    diff.tv_usec = tv2->tv_usec - tv1->tv_usec + 1000000;
+
+    res = ((u_long) diff.tv_sec) * 100 + diff.tv_usec / 10000;
+    return res;
+}
+
+/*
+ * Test: Has (marked time plus delta) exceeded current time (in msec) ?
+ * Returns 0 if test fails or cannot be tested (no marker).
+ */
+int
+atime_ready(marker_t pm, int deltaT)
+{
+    marker_t        now;
+    long            diff;
+    if (!pm)
+        return 0;
+
+    now = atime_newMarker();
+
+    diff = atime_diff(pm, now);
+    free(now);
+    if (diff < deltaT)
+        return 0;
+
+    return 1;
+}
+
+/*
+ * Test: Has (marked time plus delta) exceeded current time (in msec) ?
+ * Returns 0 if test fails or cannot be tested (no marker).
+ */
+int
+uatime_ready(marker_t pm, unsigned int deltaT)
+{
+    marker_t        now;
+    u_long          diff;
+    if (!pm)
+        return 0;
+
+    now = atime_newMarker();
+
+    diff = uatime_diff(pm, now);
+    free(now);
+    if (diff < deltaT)
+        return 0;
+
+    return 1;
+}
+
+
+        /*
+         * Time-related utility functions
+         */
+
+                /*
+                 * Return the number of timeTicks since the given marker 
+                 */
+int
+marker_tticks(marker_t pm)
+{
+    int             res;
+    marker_t        now = atime_newMarker();
+
+    res = atime_diff(pm, now);
+    free(now);
+    return res / 10;            /* atime_diff works in msec, not csec */
+}
+
+int
+timeval_tticks(struct timeval *tv)
+{
+    return marker_tticks((marker_t) tv);
+}
diff -Naur tomato/release/src/router/snmp/snmplib/ucd_compat.c tomato121/release/src/router/snmp/snmplib/ucd_compat.c
--- tomato/release/src/router/snmp/snmplib/ucd_compat.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/snmplib/ucd_compat.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,220 @@
+/*
+ * For compatibility with applications built using
+ * previous versions of the UCD library only.
+ */
+
+#include <net-snmp/net-snmp-config.h>
+
+#include <net-snmp/types.h>
+#include <net-snmp/session_api.h>
+#include <net-snmp/config_api.h>
+#include <net-snmp/library/mib.h>	/* for OID O/P format enums */
+
+/*
+ * use <netsnmp_session *)->s_snmp_errno instead 
+ */
+int
+snmp_get_errno(void)
+{
+    return SNMPERR_SUCCESS;
+}
+
+/*
+ * synch_reset and synch_setup are no longer used. 
+ */
+void
+snmp_synch_reset(netsnmp_session * notused)
+{
+}
+void
+snmp_synch_setup(netsnmp_session * notused)
+{
+}
+
+
+void
+snmp_set_dump_packet(int x)
+{
+    netsnmp_ds_set_boolean(NETSNMP_DS_LIBRARY_ID, 
+			   NETSNMP_DS_LIB_DUMP_PACKET, x);
+}
+
+int
+snmp_get_dump_packet(void)
+{
+    return netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, 
+				  NETSNMP_DS_LIB_DUMP_PACKET);
+}
+
+void
+snmp_set_quick_print(int x)
+{
+    netsnmp_ds_set_boolean(NETSNMP_DS_LIBRARY_ID, 
+			   NETSNMP_DS_LIB_QUICK_PRINT, x);
+}
+
+int
+snmp_get_quick_print(void)
+{
+    return netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, 
+				  NETSNMP_DS_LIB_QUICK_PRINT);
+}
+
+
+void
+snmp_set_suffix_only(int x)
+{
+    netsnmp_ds_set_int(NETSNMP_DS_LIBRARY_ID,
+		       NETSNMP_DS_LIB_OID_OUTPUT_FORMAT, x);
+}
+
+int
+snmp_get_suffix_only(void)
+{
+    return netsnmp_ds_get_int(NETSNMP_DS_LIBRARY_ID,
+			      NETSNMP_DS_LIB_OID_OUTPUT_FORMAT);
+}
+
+void
+snmp_set_full_objid(int x)
+{
+    netsnmp_ds_set_int(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_OID_OUTPUT_FORMAT,
+                                              NETSNMP_OID_OUTPUT_FULL);
+}
+
+int
+snmp_get_full_objid(void)
+{
+    return (NETSNMP_OID_OUTPUT_FULL ==
+        netsnmp_ds_get_int(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_OID_OUTPUT_FORMAT));
+}
+
+void
+snmp_set_random_access(int x)
+{
+    netsnmp_ds_set_boolean(NETSNMP_DS_LIBRARY_ID, 
+			   NETSNMP_DS_LIB_RANDOM_ACCESS, x);
+}
+
+int
+snmp_get_random_access(void)
+{
+    return netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, 
+				  NETSNMP_DS_LIB_RANDOM_ACCESS);
+}
+
+void
+snmp_set_mib_errors(int err)
+{
+    netsnmp_ds_set_boolean(NETSNMP_DS_LIBRARY_ID, 
+			   NETSNMP_DS_LIB_MIB_ERRORS, err);
+}
+
+void
+snmp_set_mib_warnings(int warn)
+{
+    netsnmp_ds_set_int(NETSNMP_DS_LIBRARY_ID, 
+		       NETSNMP_DS_LIB_MIB_WARNINGS, warn);
+}
+
+void
+snmp_set_save_descriptions(int save)
+{
+    netsnmp_ds_set_boolean(NETSNMP_DS_LIBRARY_ID, 
+			   NETSNMP_DS_LIB_SAVE_MIB_DESCRS, save);
+}
+
+void
+snmp_set_mib_comment_term(int save)
+{
+    /*
+     * 0=strict, 1=EOL terminated 
+     */
+    netsnmp_ds_set_boolean(NETSNMP_DS_LIBRARY_ID, 
+			   NETSNMP_DS_LIB_MIB_COMMENT_TERM, save);
+}
+
+void
+snmp_set_mib_parse_label(int save)
+{
+    /*
+     * 0=strict, 1=underscore OK in label 
+     */
+    netsnmp_ds_set_boolean(NETSNMP_DS_LIBRARY_ID, 
+			   NETSNMP_DS_LIB_MIB_PARSE_LABEL, save);
+}
+
+int
+ds_set_boolean		(int storeid, int which, int value)
+{
+  return netsnmp_ds_set_boolean(storeid, which, value);
+}
+
+int
+ds_get_boolean		(int storeid, int which)
+{
+  return netsnmp_ds_get_boolean(storeid, which);
+}
+
+int
+ds_toggle_boolean	(int storeid, int which)
+{
+  return netsnmp_ds_toggle_boolean(storeid, which);
+}
+
+int
+ds_set_int		(int storeid, int which, int value)
+{
+  return netsnmp_ds_set_int(storeid, which, value);
+}
+
+int
+ds_get_int		(int storeid, int which)
+{
+  return netsnmp_ds_get_int(storeid, which);
+}
+
+
+int
+ds_set_string		(int storeid, int which, const char *value)
+{
+  return netsnmp_ds_set_string(storeid, which, value);
+}
+
+char *
+ds_get_string		(int storeid, int which)
+{
+  return netsnmp_ds_get_string(storeid, which);
+}
+
+int
+ds_set_void		(int storeid, int which, void *value)
+{
+  return netsnmp_ds_set_void(storeid, which, value);
+}
+
+void *
+ds_get_void		(int storeid, int which)
+{
+  return netsnmp_ds_get_void(storeid, which);
+}
+
+int
+ds_register_config	(u_char type, const char *ftype,
+			 const char *token, int storeid, int which)
+{
+  return netsnmp_ds_register_config(type, ftype, token, storeid, which);
+}
+
+int
+ds_register_premib	(u_char type, const char *ftype,
+			 const char *token, int storeid, int which)
+{
+  return netsnmp_ds_register_premib(type, ftype, token, storeid, which);
+}
+
+void
+ds_shutdown		(void)
+{
+  netsnmp_ds_shutdown();
+}
diff -Naur tomato/release/src/router/snmp/snmplib/ucd-snmp-includes.h tomato121/release/src/router/snmp/snmplib/ucd-snmp-includes.h
--- tomato/release/src/router/snmp/snmplib/ucd-snmp-includes.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/snmplib/ucd-snmp-includes.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,26 @@
+#include <stdio.h>
+#include <sys/types.h>
+
+#include <netinet/in.h>
+#include <sys/time.h>
+
+/*
+ * uncomment if you don't have in_addr_t in netinet/in.h 
+ */
+/*
+ * typedef u_int in_addr_t; 
+ */
+
+#include <ucd-snmp/asn1.h>
+#include <ucd-snmp/snmp_api.h>
+#include <ucd-snmp/snmp_impl.h>
+#include <ucd-snmp/snmp_client.h>
+#include <ucd-snmp/mib.h>
+#include <ucd-snmp/snmp.h>
+
+#include <ucd-snmp/default_store.h>
+#include <ucd-snmp/snmp_logging.h>
+#include <ucd-snmp/snmp_debug.h>
+#include <ucd-snmp/read_config.h>
+#include <ucd-snmp/tools.h>
+#include <ucd-snmp/system.h>
diff -Naur tomato/release/src/router/snmp/snmplib/vacm.c tomato121/release/src/router/snmp/snmplib/vacm.c
--- tomato/release/src/router/snmp/snmplib/vacm.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/snmplib/vacm.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,946 @@
+/*
+ * vacm.c
+ *
+ * SNMPv3 View-based Access Control Model
+ */
+
+#include <net-snmp/net-snmp-config.h>
+
+#if HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#if HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+#if HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#include <sys/types.h>
+#include <stdio.h>
+#if TIME_WITH_SYS_TIME
+# ifdef WIN32
+#  include <sys/timeb.h>
+# else
+#  include <sys/time.h>
+# endif
+# include <time.h>
+#else
+# if HAVE_SYS_TIME_H
+#  include <sys/time.h>
+# else
+#  include <time.h>
+# endif
+#endif
+
+#if HAVE_WINSOCK_H
+#include <winsock.h>
+#endif
+
+#if HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+
+#if HAVE_DMALLOC_H
+#include <dmalloc.h>
+#endif
+
+#include <net-snmp/types.h>
+#include <net-snmp/output_api.h>
+#include <net-snmp/config_api.h>
+
+#include <net-snmp/library/snmp_api.h>
+#include <net-snmp/library/vacm.h>
+
+static struct vacm_viewEntry *viewList = NULL, *viewScanPtr = NULL;
+static struct vacm_accessEntry *accessList = NULL, *accessScanPtr = NULL;
+static struct vacm_groupEntry *groupList = NULL, *groupScanPtr = NULL;
+
+void
+vacm_save(const char *token, const char *type)
+{
+    struct vacm_viewEntry *vptr;
+    struct vacm_accessEntry *aptr;
+    struct vacm_groupEntry *gptr;
+
+    for (vptr = viewList; vptr != NULL; vptr = vptr->next) {
+        if (vptr->viewStorageType == ST_NONVOLATILE)
+            vacm_save_view(vptr, token, type);
+    }
+
+    for (aptr = accessList; aptr != NULL; aptr = aptr->next) {
+        if (aptr->storageType == ST_NONVOLATILE)
+            vacm_save_access(aptr, token, type);
+    }
+
+    for (gptr = groupList; gptr != NULL; gptr = gptr->next) {
+        if (gptr->storageType == ST_NONVOLATILE)
+            vacm_save_group(gptr, token, type);
+    }
+}
+
+/*
+ * vacm_save_view(): saves a view entry to the persistent cache 
+ */
+void
+vacm_save_view(struct vacm_viewEntry *view, const char *token,
+               const char *type)
+{
+    char            line[4096];
+    char           *cptr;
+
+    memset(line, 0, sizeof(line));
+    snprintf(line, sizeof(line), "%s%s %d %d %d ", token, "View",
+            view->viewStatus, view->viewStorageType, view->viewType);
+    line[ sizeof(line)-1 ] = 0;
+    cptr = &line[strlen(line)]; /* the NULL */
+
+    cptr =
+        read_config_save_octet_string(cptr, (u_char *) view->viewName + 1,
+                                      view->viewName[0] + 1);
+    *cptr++ = ' ';
+    cptr =
+        read_config_save_objid(cptr, view->viewSubtree,
+                               view->viewSubtreeLen);
+    *cptr++ = ' ';
+    cptr = read_config_save_octet_string(cptr, (u_char *) view->viewMask,
+                                         view->viewMaskLen);
+
+    read_config_store(type, line);
+}
+
+void
+vacm_parse_config_view(const char *token, char *line)
+{
+    struct vacm_viewEntry view;
+    struct vacm_viewEntry *vptr;
+    char           *viewName = (char *) &view.viewName;
+    oid            *viewSubtree = (oid *) & view.viewSubtree;
+    u_char         *viewMask;
+    size_t          len;
+
+    view.viewStatus = atoi(line);
+    line = skip_token(line);
+    view.viewStorageType = atoi(line);
+    line = skip_token(line);
+    view.viewType = atoi(line);
+    line = skip_token(line);
+    line =
+        read_config_read_octet_string(line, (u_char **) & viewName, &len);
+    view.viewSubtreeLen = MAX_OID_LEN;
+    line =
+        read_config_read_objid(line, (oid **) & viewSubtree,
+                               &view.viewSubtreeLen);
+
+    vptr =
+        vacm_createViewEntry(view.viewName, view.viewSubtree,
+                             view.viewSubtreeLen);
+    if (!vptr)
+        return;
+
+    vptr->viewStatus = view.viewStatus;
+    vptr->viewStorageType = view.viewStorageType;
+    vptr->viewType = view.viewType;
+    viewMask = (u_char *) vptr->viewMask;
+    line =
+        read_config_read_octet_string(line, (u_char **) & viewMask,
+                                      &vptr->viewMaskLen);
+}
+
+/*
+ * vacm_save_access(): saves an access entry to the persistent cache 
+ */
+void
+vacm_save_access(struct vacm_accessEntry *access_entry, const char *token,
+                 const char *type)
+{
+    char            line[4096];
+    char           *cptr;
+
+    memset(line, 0, sizeof(line));
+    snprintf(line, sizeof(line), "%s%s %d %d %d %d %d ",
+            token, "Access", access_entry->status,
+            access_entry->storageType, access_entry->securityModel,
+            access_entry->securityLevel, access_entry->contextMatch);
+    line[ sizeof(line)-1 ] = 0;
+    cptr = &line[strlen(line)]; /* the NULL */
+    cptr =
+        read_config_save_octet_string(cptr,
+                                      (u_char *) access_entry->groupName + 1,
+                                      access_entry->groupName[0] + 1);
+    *cptr++ = ' ';
+    cptr =
+        read_config_save_octet_string(cptr,
+                                      (u_char *) access_entry->contextPrefix + 1,
+                                      access_entry->contextPrefix[0] + 1);
+
+    *cptr++ = ' ';
+    cptr = read_config_save_octet_string(cptr, (u_char *) access_entry->readView,
+                                         strlen(access_entry->readView) + 1);
+    *cptr++ = ' ';
+    cptr =
+        read_config_save_octet_string(cptr, (u_char *) access_entry->writeView,
+                                      strlen(access_entry->writeView) + 1);
+    *cptr++ = ' ';
+    cptr =
+        read_config_save_octet_string(cptr, (u_char *) access_entry->notifyView,
+                                      strlen(access_entry->notifyView) + 1);
+
+    read_config_store(type, line);
+}
+
+void
+vacm_parse_config_access(const char *token, char *line)
+{
+    struct vacm_accessEntry access;
+    struct vacm_accessEntry *aptr;
+    char           *contextPrefix = (char *) &access.contextPrefix;
+    char           *groupName = (char *) &access.groupName;
+    char           *readView, *writeView, *notifyView;
+    size_t          len;
+
+    access.status = atoi(line);
+    line = skip_token(line);
+    access.storageType = atoi(line);
+    line = skip_token(line);
+    access.securityModel = atoi(line);
+    line = skip_token(line);
+    access.securityLevel = atoi(line);
+    line = skip_token(line);
+    access.contextMatch = atoi(line);
+    line = skip_token(line);
+    line =
+        read_config_read_octet_string(line, (u_char **) & groupName, &len);
+    line =
+        read_config_read_octet_string(line, (u_char **) & contextPrefix,
+                                      &len);
+
+    aptr = vacm_createAccessEntry(access.groupName, access.contextPrefix,
+                                  access.securityModel,
+                                  access.securityLevel);
+    if (!aptr)
+        return;
+
+    aptr->status = access.status;
+    aptr->storageType = access.storageType;
+    aptr->securityModel = access.securityModel;
+    aptr->securityLevel = access.securityLevel;
+    aptr->contextMatch = access.contextMatch;
+    readView = (char *) aptr->readView;
+    line =
+        read_config_read_octet_string(line, (u_char **) & readView, &len);
+    writeView = (char *) aptr->writeView;
+    line =
+        read_config_read_octet_string(line, (u_char **) & writeView, &len);
+    notifyView = (char *) aptr->notifyView;
+    line =
+        read_config_read_octet_string(line, (u_char **) & notifyView,
+                                      &len);
+}
+
+/*
+ * vacm_save_group(): saves a group entry to the persistent cache 
+ */
+void
+vacm_save_group(struct vacm_groupEntry *group_entry, const char *token,
+                const char *type)
+{
+    char            line[4096];
+    char           *cptr;
+
+    memset(line, 0, sizeof(line));
+    snprintf(line, sizeof(line), "%s%s %d %d %d ",
+            token, "Group", group_entry->status,
+            group_entry->storageType, group_entry->securityModel);
+    line[ sizeof(line)-1 ] = 0;
+    cptr = &line[strlen(line)]; /* the NULL */
+
+    cptr =
+        read_config_save_octet_string(cptr,
+                                      (u_char *) group_entry->securityName + 1,
+                                      group_entry->securityName[0] + 1);
+    *cptr++ = ' ';
+    cptr = read_config_save_octet_string(cptr, (u_char *) group_entry->groupName,
+                                         strlen(group_entry->groupName) + 1);
+
+    read_config_store(type, line);
+}
+
+void
+vacm_parse_config_group(const char *token, char *line)
+{
+    struct vacm_groupEntry group;
+    struct vacm_groupEntry *gptr;
+    char           *securityName = (char *) &group.securityName;
+    char           *groupName;
+    size_t          len;
+
+    group.status = atoi(line);
+    line = skip_token(line);
+    group.storageType = atoi(line);
+    line = skip_token(line);
+    group.securityModel = atoi(line);
+    line = skip_token(line);
+    line =
+        read_config_read_octet_string(line, (u_char **) & securityName,
+                                      &len);
+
+    gptr = vacm_createGroupEntry(group.securityModel, group.securityName);
+    if (!gptr)
+        return;
+
+    gptr->status = group.status;
+    gptr->storageType = group.storageType;
+    groupName = (char *) gptr->groupName;
+    line =
+        read_config_read_octet_string(line, (u_char **) & groupName, &len);
+}
+
+struct vacm_viewEntry *
+vacm_getViewEntry(const char *viewName,
+                  oid * viewSubtree, size_t viewSubtreeLen, int mode)
+{
+    struct vacm_viewEntry *vp, *vpret = NULL;
+    char            view[VACMSTRINGLEN];
+    int             found, glen;
+    int count=0;
+
+    glen = (int) strlen(viewName);
+    if (glen < 0 || glen >= VACM_MAX_STRING)
+        return NULL;
+    view[0] = glen;
+    strcpy(view + 1, viewName);
+    for (vp = viewList; vp; vp = vp->next) {
+        if (!memcmp(view, vp->viewName, glen + 1)
+            && viewSubtreeLen >= (vp->viewSubtreeLen - 1)) {
+            int             mask = 0x80, maskpos = 0;
+            int             oidpos;
+            found = 1;
+
+            if (mode != VACM_MODE_IGNORE_MASK) {  /* check the mask */
+                for (oidpos = 0;
+                     found && oidpos < (int) vp->viewSubtreeLen - 1;
+                     oidpos++) {
+                    if ((vp->viewMask[maskpos] & mask) != 0) {
+                        if (viewSubtree[oidpos] !=
+                            vp->viewSubtree[oidpos + 1])
+                            found = 0;
+                    }
+                    if (mask == 1) {
+                        mask = 0x80;
+                        maskpos++;
+                    } else
+                        mask >>= 1;
+                }
+            }
+            if (found) {
+                /*
+                 * match successful, keep this node if its longer than
+                 * the previous or (equal and lexicographically greater
+                 * than the previous). 
+                 */
+                count++;
+                if (mode == VACM_MODE_CHECK_SUBTREE) {
+                    vpret = vp;
+                } else if (vpret == NULL
+                           || vp->viewSubtreeLen > vpret->viewSubtreeLen
+                           || (vp->viewSubtreeLen == vpret->viewSubtreeLen
+                               && snmp_oid_compare(vp->viewSubtree + 1,
+                                                   vp->viewSubtreeLen - 1,
+                                                   vpret->viewSubtree + 1,
+                                                   vpret->viewSubtreeLen - 1) >
+                               0)) {
+                    vpret = vp;
+                }
+            }
+        }
+    }
+    DEBUGMSGTL(("vacm:getView", ", %s\n", (vpret) ? "found" : "none"));
+    if (mode == VACM_MODE_CHECK_SUBTREE && count > 1) {
+        return NULL;
+    }
+    return vpret;
+}
+
+/*******************************************************************o-o******
+ * vacm_checkSubtree
+ *
+ * Check to see if everything within a subtree is in view, not in view,
+ * or possibly both.
+ *
+ * Parameters:
+ *   *viewName           - Name of view to check
+ *   *viewSubtree        - OID of subtree
+ *    viewSubtreeLen     - length of subtree OID
+ *      
+ * Returns:
+ *   VACM_SUCCESS          The OID is included in the view.
+ *   VACM_NOTINVIEW        If no entry in the view list includes the
+ *                         provided OID, or the OID is explicitly excluded
+ *                         from the view. 
+ *   VACM_SUBTREE_UNKNOWN  The entire subtree has both allowed and disallowed
+ *                         portions.
+ */
+int
+vacm_checkSubtree(const char *viewName,
+                  oid * viewSubtree, size_t viewSubtreeLen)
+{
+    struct vacm_viewEntry *vp, *vpShorter = NULL, *vpLonger = NULL;
+    char            view[VACMSTRINGLEN];
+    int             found, glen;
+    int count=0;
+
+    glen = (int) strlen(viewName);
+    if (glen < 0 || glen >= VACM_MAX_STRING)
+        return VACM_NOTINVIEW;
+    view[0] = glen;
+    strcpy(view + 1, viewName);
+    for (vp = viewList; vp; vp = vp->next) {
+        if (!memcmp(view, vp->viewName, glen + 1)) {
+            /*
+             * If the subtree defined in the view is shorter than or equal
+             * to the subtree we are comparing, then it might envelop the
+             * subtree we are comparing against.
+             */
+            if (viewSubtreeLen >= (vp->viewSubtreeLen - 1)) {
+                int             mask = 0x80, maskpos = 0;
+                int             oidpos;
+                found = 1;
+
+                /*
+                 * check the mask
+                 */
+                for (oidpos = 0;
+                     found && oidpos < (int) vp->viewSubtreeLen - 1;
+                     oidpos++) {
+                    if ((vp->viewMask[maskpos] & mask) != 0) {
+                        if (viewSubtree[oidpos] !=
+                            vp->viewSubtree[oidpos + 1])
+                            found = 0;
+                    }
+                    if (mask == 1) {
+                        mask = 0x80;
+                        maskpos++;
+                    } else
+                        mask >>= 1;
+                }
+
+                if (found) {
+                    /*
+                     * match successful, keep this node if it's longer than
+                     * the previous or (equal and lexicographically greater
+                     * than the previous). 
+                     */
+    
+                    if (vpShorter == NULL
+                        || vp->viewSubtreeLen > vpShorter->viewSubtreeLen
+                        || (vp->viewSubtreeLen == vpShorter->viewSubtreeLen
+                           && snmp_oid_compare(vp->viewSubtree + 1,
+                                               vp->viewSubtreeLen - 1,
+                                               vpShorter->viewSubtree + 1,
+                                               vpShorter->viewSubtreeLen - 1) >
+                                   0)) {
+                        vpShorter = vp;
+                    }
+                }
+            }
+            /*
+             * If the subtree defined in the view is longer than the
+             * subtree we are comparing, then it might ambiguate our
+             * response.
+             */
+            else {
+                int             mask = 0x80, maskpos = 0;
+                int             oidpos;
+                found = 1;
+
+                /*
+                 * check the mask up to the length of the provided subtree
+                 */
+                for (oidpos = 0;
+                     found && oidpos < (int) viewSubtreeLen;
+                     oidpos++) {
+                    if ((vp->viewMask[maskpos] & mask) != 0) {
+                        if (viewSubtree[oidpos] !=
+                            vp->viewSubtree[oidpos + 1])
+                            found = 0;
+                    }
+                    if (mask == 1) {
+                        mask = 0x80;
+                        maskpos++;
+                    } else
+                        mask >>= 1;
+                }
+
+                if (found) {
+                    /*
+                     * match successful.  If we already found a match
+                     * with a different view type, then parts of the subtree 
+                     * are included and others are excluded, so return UNKNOWN.
+                     */
+                    if (vpLonger != NULL
+                        && (vpLonger->viewType != vp->viewType)) {
+                        DEBUGMSGTL(("vacm:checkSubtree", ", %s\n", "unknown"));
+                        return VACM_SUBTREE_UNKNOWN;
+                    }
+                    else if (vpLonger == NULL) {
+                        vpLonger = vp;
+                    }
+                }
+            }
+        }
+    }
+
+    /*
+     * If we found a matching view subtree with a longer OID than the provided
+     * OID, check to see if its type is consistent with any matching view
+     * subtree we may have found with a shorter OID than the provided OID.
+     *
+     * The view type of the longer OID is inconsistent with the shorter OID in
+     * either of these two cases:
+     *  1) No matching shorter OID was found and the view type of the longer
+     *     OID is INCLUDE.
+     *  2) A matching shorter ID was found and its view type doesn't match
+     *     the view type of the longer OID.
+     */
+    if (vpLonger != NULL) {
+        if ((!vpShorter && vpLonger->viewType != SNMP_VIEW_EXCLUDED)
+            || (vpShorter && vpLonger->viewType != vpShorter->viewType)) {
+            DEBUGMSGTL(("vacm:checkSubtree", ", %s\n", "unknown"));
+            return VACM_SUBTREE_UNKNOWN;
+        }
+    }
+
+    if (vpShorter && vpShorter->viewType != SNMP_VIEW_EXCLUDED) {
+        DEBUGMSGTL(("vacm:checkSubtree", ", %s\n", "included"));
+        return VACM_SUCCESS;
+    }
+
+    DEBUGMSGTL(("vacm:checkSubtree", ", %s\n", "excluded"));
+    return VACM_NOTINVIEW;
+}
+
+void
+vacm_scanViewInit(void)
+{
+    viewScanPtr = viewList;
+}
+
+struct vacm_viewEntry *
+vacm_scanViewNext(void)
+{
+    struct vacm_viewEntry *returnval = viewScanPtr;
+    if (viewScanPtr)
+        viewScanPtr = viewScanPtr->next;
+    return returnval;
+}
+
+struct vacm_viewEntry *
+vacm_createViewEntry(const char *viewName,
+                     oid * viewSubtree, size_t viewSubtreeLen)
+{
+    struct vacm_viewEntry *vp, *lp, *op = NULL;
+    int             cmp, cmp2, glen;
+
+    glen = (int) strlen(viewName);
+    if (glen < 0 || glen >= VACM_MAX_STRING)
+        return NULL;
+    vp = (struct vacm_viewEntry *) calloc(1,
+                                          sizeof(struct vacm_viewEntry));
+    if (vp == NULL)
+        return NULL;
+    vp->reserved =
+        (struct vacm_viewEntry *) calloc(1, sizeof(struct vacm_viewEntry));
+    if (vp->reserved == NULL) {
+        free(vp);
+        return NULL;
+    }
+
+    vp->viewName[0] = glen;
+    strcpy(vp->viewName + 1, viewName);
+    vp->viewSubtree[0] = viewSubtreeLen;
+    memcpy(vp->viewSubtree + 1, viewSubtree, viewSubtreeLen * sizeof(oid));
+    vp->viewSubtreeLen = viewSubtreeLen + 1;
+
+    lp = viewList;
+    while (lp) {
+        cmp = memcmp(lp->viewName, vp->viewName, glen + 1);
+        cmp2 = snmp_oid_compare(lp->viewSubtree, lp->viewSubtreeLen,
+                                vp->viewSubtree, vp->viewSubtreeLen);
+        if (cmp == 0 && cmp2 > 0)
+            break;
+        if (cmp > 0)
+            break;
+        op = lp;
+        lp = lp->next;
+    }
+    vp->next = lp;
+    if (op)
+        op->next = vp;
+    else
+        viewList = vp;
+    return vp;
+}
+
+void
+vacm_destroyViewEntry(const char *viewName,
+                      oid * viewSubtree, size_t viewSubtreeLen)
+{
+    struct vacm_viewEntry *vp, *lastvp = NULL;
+
+    if (viewList && !strcmp(viewList->viewName + 1, viewName)
+        && viewList->viewSubtreeLen == viewSubtreeLen
+        && !memcmp((char *) viewList->viewSubtree, (char *) viewSubtree,
+                   viewSubtreeLen * sizeof(oid))) {
+        vp = viewList;
+        viewList = viewList->next;
+    } else {
+        for (vp = viewList; vp; vp = vp->next) {
+            if (!strcmp(vp->viewName + 1, viewName)
+                && vp->viewSubtreeLen == viewSubtreeLen
+                && !memcmp((char *) vp->viewSubtree, (char *) viewSubtree,
+                           viewSubtreeLen * sizeof(oid)))
+                break;
+            lastvp = vp;
+        }
+        if (!vp)
+            return;
+        lastvp->next = vp->next;
+    }
+    if (vp->reserved)
+        free(vp->reserved);
+    free(vp);
+    return;
+}
+
+void
+vacm_destroyAllViewEntries(void)
+{
+    struct vacm_viewEntry *vp;
+    while ((vp = viewList)) {
+        viewList = vp->next;
+        if (vp->reserved)
+            free(vp->reserved);
+        free(vp);
+    }
+}
+
+struct vacm_groupEntry *
+vacm_getGroupEntry(int securityModel, const char *securityName)
+{
+    struct vacm_groupEntry *vp;
+    char            secname[VACMSTRINGLEN];
+    int             glen;
+
+    glen = (int) strlen(securityName);
+    if (glen < 0 || glen >= VACM_MAX_STRING)
+        return NULL;
+    secname[0] = glen;
+    strcpy(secname + 1, securityName);
+
+    for (vp = groupList; vp; vp = vp->next) {
+        if ((securityModel == vp->securityModel
+             || vp->securityModel == SNMP_SEC_MODEL_ANY)
+            && !memcmp(vp->securityName, secname, glen + 1))
+            return vp;
+    }
+    return NULL;
+}
+
+void
+vacm_scanGroupInit(void)
+{
+    groupScanPtr = groupList;
+}
+
+struct vacm_groupEntry *
+vacm_scanGroupNext(void)
+{
+    struct vacm_groupEntry *returnval = groupScanPtr;
+    if (groupScanPtr)
+        groupScanPtr = groupScanPtr->next;
+    return returnval;
+}
+
+struct vacm_groupEntry *
+vacm_createGroupEntry(int securityModel, const char *securityName)
+{
+    struct vacm_groupEntry *gp, *lg, *og;
+    int             cmp, glen;
+
+    glen = (int) strlen(securityName);
+    if (glen < 0 || glen >= VACM_MAX_STRING)
+        return NULL;
+    gp = (struct vacm_groupEntry *) calloc(1,
+                                           sizeof(struct vacm_groupEntry));
+    if (gp == NULL)
+        return NULL;
+    gp->reserved =
+        (struct vacm_groupEntry *) calloc(1,
+                                          sizeof(struct vacm_groupEntry));
+    if (gp->reserved == NULL) {
+        free(gp);
+        return NULL;
+    }
+
+    gp->securityModel = securityModel;
+    gp->securityName[0] = glen;
+    strcpy(gp->securityName + 1, securityName);
+
+    lg = groupList;
+    og = NULL;
+    while (lg) {
+        if (lg->securityModel > securityModel)
+            break;
+        if (lg->securityModel == securityModel &&
+            (cmp =
+             memcmp(lg->securityName, gp->securityName, glen + 1)) > 0)
+            break;
+        /*
+         * if (lg->securityModel == securityModel && cmp == 0) abort(); 
+         */
+        og = lg;
+        lg = lg->next;
+    }
+    gp->next = lg;
+    if (og == NULL)
+        groupList = gp;
+    else
+        og->next = gp;
+    return gp;
+}
+
+void
+vacm_destroyGroupEntry(int securityModel, const char *securityName)
+{
+    struct vacm_groupEntry *vp, *lastvp = NULL;
+
+    if (groupList && groupList->securityModel == securityModel
+        && !strcmp(groupList->securityName + 1, securityName)) {
+        vp = groupList;
+        groupList = groupList->next;
+    } else {
+        for (vp = groupList; vp; vp = vp->next) {
+            if (vp->securityModel == securityModel
+                && !strcmp(vp->securityName + 1, securityName))
+                break;
+            lastvp = vp;
+        }
+        if (!vp)
+            return;
+        lastvp->next = vp->next;
+    }
+    if (vp->reserved)
+        free(vp->reserved);
+    free(vp);
+    return;
+}
+
+void
+vacm_destroyAllGroupEntries(void)
+{
+    struct vacm_groupEntry *gp;
+    while ((gp = groupList)) {
+        groupList = gp->next;
+        if (gp->reserved)
+            free(gp->reserved);
+        free(gp);
+    }
+}
+
+struct vacm_accessEntry *
+vacm_getAccessEntry(const char *groupName,
+                    const char *contextPrefix,
+                    int securityModel, int securityLevel)
+{
+    struct vacm_accessEntry *vp;
+    char            group[VACMSTRINGLEN];
+    char            context[VACMSTRINGLEN];
+    int             glen, clen;
+
+    glen = (int) strlen(groupName);
+    if (glen < 0 || glen >= VACM_MAX_STRING)
+        return NULL;
+    clen = (int) strlen(contextPrefix);
+    if (clen < 0 || clen >= VACM_MAX_STRING)
+        return NULL;
+
+    group[0] = glen;
+    strcpy(group + 1, groupName);
+    context[0] = clen;
+    strcpy(context + 1, contextPrefix);
+    for (vp = accessList; vp; vp = vp->next) {
+        if ((securityModel == vp->securityModel
+             || vp->securityModel == SNMP_SEC_MODEL_ANY)
+            && securityLevel >= vp->securityLevel
+            && !memcmp(vp->groupName, group, glen + 1)
+            &&
+            ((vp->contextMatch == CONTEXT_MATCH_EXACT
+              && clen == vp->contextPrefix[0]
+              && (memcmp(vp->contextPrefix, context, clen + 1) == 0))
+             || (vp->contextMatch == CONTEXT_MATCH_PREFIX
+                 && clen >= vp->contextPrefix[0]
+                 && (memcmp(vp->contextPrefix + 1, context + 1,
+                            vp->contextPrefix[0]) == 0))))
+            return vp;
+    }
+    return NULL;
+}
+
+void
+vacm_scanAccessInit(void)
+{
+    accessScanPtr = accessList;
+}
+
+struct vacm_accessEntry *
+vacm_scanAccessNext(void)
+{
+    struct vacm_accessEntry *returnval = accessScanPtr;
+    if (accessScanPtr)
+        accessScanPtr = accessScanPtr->next;
+    return returnval;
+}
+
+struct vacm_accessEntry *
+vacm_createAccessEntry(const char *groupName,
+                       const char *contextPrefix,
+                       int securityModel, int securityLevel)
+{
+    struct vacm_accessEntry *vp, *lp, *op = NULL;
+    int             cmp, glen, clen;
+
+    glen = (int) strlen(groupName);
+    if (glen < 0 || glen >= VACM_MAX_STRING)
+        return NULL;
+    clen = (int) strlen(contextPrefix);
+    if (clen < 0 || clen >= VACM_MAX_STRING)
+        return NULL;
+    vp = (struct vacm_accessEntry *) calloc(1,
+                                            sizeof(struct
+                                                   vacm_accessEntry));
+    if (vp == NULL)
+        return NULL;
+    vp->reserved =
+        (struct vacm_accessEntry *) calloc(1,
+                                           sizeof(struct
+                                                  vacm_accessEntry));
+    if (vp->reserved == NULL) {
+        free(vp);
+        return NULL;
+    }
+
+    vp->securityModel = securityModel;
+    vp->securityLevel = securityLevel;
+    vp->groupName[0] = glen;
+    strcpy(vp->groupName + 1, groupName);
+    vp->contextPrefix[0] = clen;
+    strcpy(vp->contextPrefix + 1, contextPrefix);
+
+    lp = accessList;
+    while (lp) {
+        cmp = memcmp(lp->groupName, vp->groupName, glen + 1);
+        if (cmp > 0)
+            break;
+        if (cmp < 0)
+            goto next;
+        cmp = memcmp(lp->contextPrefix, vp->contextPrefix, clen + 1);
+        if (cmp > 0)
+            break;
+        if (cmp < 0)
+            goto next;
+        if (lp->securityModel > securityModel)
+            break;
+        if (lp->securityModel < securityModel)
+            goto next;
+        if (lp->securityLevel > securityLevel)
+            break;
+      next:
+        op = lp;
+        lp = lp->next;
+    }
+    vp->next = lp;
+    if (op == NULL)
+        accessList = vp;
+    else
+        op->next = vp;
+    return vp;
+}
+
+void
+vacm_destroyAccessEntry(const char *groupName,
+                        const char *contextPrefix,
+                        int securityModel, int securityLevel)
+{
+    struct vacm_accessEntry *vp, *lastvp = NULL;
+
+    if (accessList && accessList->securityModel == securityModel
+        && accessList->securityModel == securityModel
+        && !strcmp(accessList->groupName + 1, groupName)
+        && !strcmp(accessList->contextPrefix + 1, contextPrefix)) {
+        vp = accessList;
+        accessList = accessList->next;
+    } else {
+        for (vp = accessList; vp; vp = vp->next) {
+            if (vp->securityModel == securityModel
+                && vp->securityLevel == securityLevel
+                && !strcmp(vp->groupName + 1, groupName)
+                && !strcmp(vp->contextPrefix + 1, contextPrefix))
+                break;
+            lastvp = vp;
+        }
+        if (!vp)
+            return;
+        lastvp->next = vp->next;
+    }
+    if (vp->reserved)
+        free(vp->reserved);
+    free(vp);
+    return;
+}
+
+void
+vacm_destroyAllAccessEntries(void)
+{
+    struct vacm_accessEntry *ap;
+    while ((ap = accessList)) {
+        accessList = ap->next;
+        if (ap->reserved)
+            free(ap->reserved);
+        free(ap);
+    }
+}
+
+int
+store_vacm(int majorID, int minorID, void *serverarg, void *clientarg)
+{
+    /*
+     * figure out our application name 
+     */
+    char           *appname = (char *) clientarg;
+    if (appname == NULL) {
+        appname = netsnmp_ds_get_string(NETSNMP_DS_LIBRARY_ID, 
+					NETSNMP_DS_LIB_APPTYPE);
+    }
+
+    /*
+     * save the VACM MIB 
+     */
+    vacm_save("vacm", appname);
+    return SNMPERR_SUCCESS;
+}
+
+/*
+ * returns 1 if vacm has *any* configuration entries in it (regardless
+ * of weather or not there is enough to make a decision based on it),
+ * else return 0 
+ */
+int
+vacm_is_configured(void)
+{
+    if (viewList == NULL && accessList == NULL && groupList == NULL) {
+        return 0;
+    }
+    return 1;
+}
diff -Naur tomato/release/src/router/snmp/snmplib/winservice.c tomato121/release/src/router/snmp/snmplib/winservice.c
--- tomato/release/src/router/snmp/snmplib/winservice.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/snmplib/winservice.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,1038 @@
+/*
+ * 
+ * * Windows Service related function definitions
+ * * By Raju Krishnappa(raju_krishnappa@yahoo.com)
+ * *
+ */  
+    
+#include <windows.h>
+#include <tchar.h>
+    
+#include <stdio.h>   /* sprintf */
+#include <process.h>  /* beginthreadex  */
+    
+#include <net-snmp/library/winservice.h>
+    
+    /*
+     * 
+     * * External global variables used here
+     */ 
+    
+    /*
+     * Application Name 
+     */ 
+    /*
+     * This should be decalred by the application, which wants to register as
+     * * windows servcie
+     */ 
+extern LPTSTR   g_szAppName;
+

+    /*
+     * 
+     * * Declare global variable
+     */ 
+    
+    /*
+     * Flag to indicate, whether process is running as Service 
+     */ 
+    BOOL g_fRunningAsService = FALSE;
+

+    /*
+     * Varibale to maintain Current Service status 
+     */ 
+static SERVICE_STATUS ServiceStatus;
+

+    /*
+     * Service Handle 
+     */ 
+static SERVICE_STATUS_HANDLE hServiceStatus = 0L;
+

+    /*
+     * Service Table Entry 
+     */ 
+    SERVICE_TABLE_ENTRY ServiceTableEntry[] = {
+    
NULL, ServiceMain, /* Service Main function */ 
+NULL, NULL};
+
+

+    /*
+     * Handle to Thread, to implement Pause,Resume and stop funcitonality 
+     */ 
+static HANDLE   hServiceThread = NULL;  /* Thread Handle */
+


+    /*
+     * Holds calling partys Function Entry point, that should started 
+     * * when entered to service mode
+     */ 
+static          INT(*ServiceEntryPoint) (INT Argc, LPTSTR Argv[]) = 0L;
+

+    /*
+     * 
+     * * To hold Stop Function address, to be called when STOP request
+     * * recived from the SCM
+     */ 
+static          VOID(*StopFunction) () = 0L;
+


+    /*
+     * 
+     * * To register as Windows Service with SCM(Service Control Manager)
+     * * Input - Service Name, Serivce Display Name,Service Description and
+     * * Service startup arguments
+     */ 
+    
VOID RegisterService(LPCTSTR lpszServiceName, 
LPCTSTR lpszServiceDisplayName, 
LPCTSTR lpszServiceDescription, 
InputParams * StartUpArg) /* Startup argument to the service */
+    
+{
+    
TCHAR szServicePath[MAX_PATH];     /* To hold module File name */
+    
TCHAR MsgErrorString[MAX_STR_SIZE];        /* Message or Error string */
+    
TCHAR szServiceCommand[MAX_PATH + 9];      /* Command to execute */
+    

SC_HANDLE hSCManager = NULL;
+    
SC_HANDLE hService = NULL;
+    

TCHAR szRegAppLogKey[] =
+        "SYSTEM\\CurrentControlSet\\Services\\EventLog\\Application\\";
+    
TCHAR szRegKey[512];
+    
HKEY hKey = NULL;          /* Key to registry entry */
+    
HKEY hParamKey = NULL;     /* To store startup parameters */
+    
DWORD dwData;              /* Type of logging supported */
+    

DWORD i, j;               /* Loop variables */
+    

GetModuleFileName(NULL, szServicePath, MAX_PATH);
+    
__try 
 {
+        
+            /*
+             * Open Service Control Manager handle 
+             */ 
+            hSCManager =
+            OpenSCManager(NULL, 
NULL, 
SC_MANAGER_CREATE_SERVICE);
+        
if (hSCManager == NULL)
+            
 {
+            
DisplayError(_T("Can't open SCM"));
+            
__leave;
+            
}
+        

+            /*
+             * Generate the Command to be executed by SCM 
+             */ 
+            _stprintf(szServiceCommand, "%s %s", szServicePath,
+                      _T("-service"));
+        

+            /*
+             * Create the Desired service 
+             */ 
+            hService = CreateService(hSCManager, 
lpszServiceName, 
lpszServiceDisplayName, 
SERVICE_ALL_ACCESS, 
SERVICE_WIN32_OWN_PROCESS, 
SERVICE_AUTO_START, 
SERVICE_ERROR_NORMAL, 
szServiceCommand, 
NULL,      /* load-order group */
+                                     NULL,      /* group member tag */
+                                     NULL,      /* dependencies */
+                                     NULL,      /* account */
+                                     NULL);     /* password */
+        
if (hService == NULL)
+            
 {
+            
+                /*
+                 * Generate Error String 
+                 */ 
+                _stprintf(MsgErrorString, "%s %s",
+                          _T("Can't Create Service"),
+                          lpszServiceDisplayName);
+            
DisplayError(MsgErrorString);
+            
__leave;
+            
}
+        

+            /*
+             * Create registry entires for EventLog 
+             */ 
+            /*
+             * Create registry Application event log key 
+             */ 
+            _tcscpy(szRegKey, szRegAppLogKey);
+        
_tcscat(szRegKey, lpszServiceName);
+        

+            /*
+             * Create registry key 
+             */ 
+            if (RegCreateKey(HKEY_LOCAL_MACHINE, szRegKey, &hKey) !=
+                ERROR_SUCCESS)
+            
 {
+            
_stprintf(MsgErrorString, "%s %s",
+                       _T("Unable to create registry entires"),
+                       lpszServiceDisplayName);
+            
DisplayError(MsgErrorString);
+            
__leave;
+            
}
+        

+            /*
+             * Add Event ID message file name to the 'EventMessageFile' subkey 
+             */ 
+            RegSetValueEx(hKey, 
"EventMessageFile", 
0, 
REG_EXPAND_SZ, 
+                          (CONST BYTE *) szServicePath,
+                          
_tcslen(szServicePath) + sizeof(TCHAR));
+        

+            /*
+             * Set the supported types flags. 
+             */ 
+            dwData =
+            EVENTLOG_ERROR_TYPE | EVENTLOG_WARNING_TYPE |
+            EVENTLOG_INFORMATION_TYPE;
+        
RegSetValueEx(hKey, 
"TypesSupported", 
0, 
REG_DWORD,
+                       
(CONST BYTE *) & dwData, 
sizeof(DWORD));
+        

+            /*
+             * Close Registry key 
+             */ 
+            RegCloseKey(hKey);
+        

+            /*
+             * Set Service Description String  and save startup parameters if present
+             */ 
+            if (lpszServiceDescription != NULL || StartUpArg->Argc > 2)
+            
 {
+            
+                /*
+                 * Create Registry Key path 
+                 */ 
+                _tcscpy(szRegKey,
+                        _T("SYSTEM\\CurrentControlSet\\Services\\"));
+            
_tcscat(szRegKey, g_szAppName);
+            

hKey = NULL;
+            
+                /*
+                 * Open Registry key 
+                 */ 
+                if (RegOpenKeyEx
+                    (HKEY_LOCAL_MACHINE, 
szRegKey, 
0, 
KEY_WRITE,
+                     /*
+                      * Create and Set access 
+                      */ 
+                     &hKey) != ERROR_SUCCESS)
+                
 {
+                
_stprintf(MsgErrorString, "%s %s",
+                           _T("Unable to create registry entires"),
+                           lpszServiceDisplayName);
+                
DisplayError(MsgErrorString);
+                
__leave;
+                
}
+            

+                /*
+                 * Create description subkey and the set value 
+                 */ 
+                if (lpszServiceDescription != NULL)
+                
 {
+                
if (RegSetValueEx(hKey, 
"Description", 
0, 
REG_SZ, 
+                                   (CONST BYTE *) lpszServiceDescription,
+                                   
_tcslen(lpszServiceDescription) +
+                                   sizeof(TCHAR)) != ERROR_SUCCESS)
+                    
 {
+                    
_stprintf(MsgErrorString, "%s %s",
+                               _T("Unable to create registry entires"),
+                               lpszServiceDisplayName);
+                    
DisplayError(MsgErrorString);
+                    
__leave;
+                    
};
+                
}
+            

+                /*
+                 * Save startup arguments if they are present 
+                 */ 
+                if (StartUpArg->Argc > 2)
+                
 {
+                
+                    /*
+                     * Create Subkey parameters 
+                     */ 
+                    if (RegCreateKeyEx
+                        (hKey, "Parameters", 0, NULL,
+                         
REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL,
+                         &hParamKey, NULL) != ERROR_SUCCESS)
+                    
 {
+                    
_stprintf(MsgErrorString, "%s %s",
+                               _T("Unable to create registry entires"),
+                               lpszServiceDisplayName);
+                    
DisplayError(MsgErrorString);
+                    
__leave;
+                    
}
+                
+                    /*
+                     * Save parameters 
+                     */ 
+                    
+                    /*
+                     * Loop through arguments 
+                     */ 
+                    for (i = 2, j = 1; i < StartUpArg->Argc; i++, j++)
+                    
 {
+                    
_stprintf(szRegKey, "%s%d", _T("Param"), j);
+                    
+                        /*
+                         * Create registry key 
+                         */ 
+                        if (RegSetValueEx
+                            (hParamKey, 
szRegKey, 
0, 
REG_SZ,
+                             
(CONST BYTE *) StartUpArg->Argv[i],
+                             
_tcslen(StartUpArg->Argv[i]) +
+                             sizeof(TCHAR)) != ERROR_SUCCESS)
+                        
 {
+                        
_stprintf(MsgErrorString, "%s %s",
+                                   _T("Unable to create registry entires"),
+                                   lpszServiceDisplayName);
+                        
DisplayError(MsgErrorString);
+                        
__leave;
+                        
};
+                    
}
+                
}
+            

+                /*
+                 * Everything is set, delete hKey 
+                 */ 
+                RegCloseKey(hParamKey);
+            
RegCloseKey(hKey);
+            
}
+        

+            /*
+             * Ready to Log messages 
+             */ 
+            
+            /*
+             * Successfully registered as service 
+             */ 
+            _stprintf(MsgErrorString, "%s %s", lpszServiceName,
+                      _T("- Successfully registered as Service"));
+        

+            /*
+             * Log message to eventlog 
+             */ 
+            WriteToEventLog(EVENTLOG_INFORMATION_TYPE, MsgErrorString);
+        

MessageBox(NULL, 
MsgErrorString, 
g_szAppName,
+                     
MB_ICONINFORMATION);
+    
}
+    
__finally 
 {
+        
if (hSCManager)
+            CloseServiceHandle(hSCManager);
+        
if (hService)
+            CloseServiceHandle(hService);
+        
if (hKey)
+            RegCloseKey(hKey);
+        
if (hParamKey)
+            RegCloseKey(hParamKey);
+    
}
+
}
+
+


+    /*
+     * 
+     * * Unregister the service with the  Windows SCM 
+     * * Input - ServiceName
+     * *
+     */ 
+    
VOID UnregisterService(LPCSTR lpszServiceName) 
+{
+    
TCHAR MsgErrorString[MAX_STR_SIZE];        /* Message or Error string */
+    

SC_HANDLE hSCManager = NULL;      /* SCM handle */
+    
SC_HANDLE hService = NULL; /* Service Handle */
+    

SERVICE_STATUS sStatus;
+    
TCHAR szRegAppLogKey[] =
+        "SYSTEM\\CurrentControlSet\\Services\\EventLog\\Application\\";
+    
TCHAR szRegKey[512];
+    
HKEY hKey = NULL;          /* Key to registry entry */
+    

__try 
 {
+        
+            /*
+             * Open Service Control Manager 
+             */ 
+            hSCManager =
+            OpenSCManager(NULL, 
NULL, 
SC_MANAGER_CREATE_SERVICE);
+        
if (hSCManager == NULL)
+            
 {
+            
+                /*
+                 * Error while opening SCM 
+                 */ 
+                
MessageBox(NULL, 
_T("Can't open SCM"), 
g_szAppName,
+                            
MB_ICONHAND);
+            
__leave;
+            
}
+        

+            /*
+             * Open registered service 
+             */ 
+            
hService =
+            OpenService(hSCManager, 
lpszServiceName, 
SERVICE_ALL_ACCESS);
+        

if (hService == NULL)
+            
 {
+            
_stprintf(MsgErrorString, "%s %s", _T("Can't open service"),
+                       lpszServiceName);
+            
MessageBox(NULL, 
MsgErrorString, 
g_szAppName, 
MB_ICONHAND);
+            
__leave;
+            
}
+        

+            /*
+             * Query service status 
+             */ 
+            /*
+             * If running stop before deleting 
+             */ 
+            if (QueryServiceStatus(hService, &sStatus))
+            
 {
+            
if (sStatus.dwCurrentState == SERVICE_RUNNING
+                 || 
sStatus.dwCurrentState == SERVICE_PAUSED)
+                
 {
+                
+                    /*
+                     * Shutdown the service 
+                     */ 
+                    ControlService(hService, SERVICE_CONTROL_STOP,
+                                   &sStatus);
+                
}
+            
};
+        

+            /*
+             * Delete the service  
+             */ 
+            if (DeleteService(hService) == FALSE)
+            
 {
+            
_stprintf(MsgErrorString, "%s %s", _T("Can't delete service"),
+                       lpszServiceName);
+            
MessageBox(NULL, 
MsgErrorString, 
g_szAppName, 
MB_ICONHAND);
+            
+                /*
+                 * Log message to eventlog 
+                 */ 
+                WriteToEventLog(EVENTLOG_INFORMATION_TYPE, MsgErrorString);
+            
__leave;
+            
}
+        

+            /*
+             * Service deleted successfully 
+             */ 
+            _stprintf(MsgErrorString, "%s %s", lpszServiceName,
+                      _T("- Service deleted"));
+        

+            /*
+             * Log message to eventlog 
+             */ 
+            WriteToEventLog(EVENTLOG_INFORMATION_TYPE, MsgErrorString);
+        

+            /*
+             * Delete registry entires for EventLog 
+             */ 
+            _tcscpy(szRegKey, szRegAppLogKey);
+        
_tcscat(szRegKey, lpszServiceName);
+        
RegDeleteKey(HKEY_LOCAL_MACHINE, szRegKey);
+        

MessageBox(NULL, 
MsgErrorString, 
g_szAppName,
+                     
MB_ICONINFORMATION);
+    
}
+    

+        /*
+         * Delete the handles 
+         */ 
+        __finally 
 {
+        
if (hService)
+            CloseServiceHandle(hService);
+        
if (hSCManager)
+            CloseServiceHandle(hSCManager);
+    
}
+
}
+
+


+    /*
+     * 
+     * * To write message to Windows Event log
+     * * Input - Event Type, Message string
+     * *
+     */ 
+    
VOID WriteToEventLog(WORD wType, LPCTSTR pszFormat,...) 
+{
+    
TCHAR szMessage[512];
+    
LPTSTR LogStr[1];
+    
va_list ArgList;
+    
HANDLE hEventSource = NULL;
+    

va_start(ArgList, pszFormat);
+    
_vstprintf(szMessage, pszFormat, ArgList);
+    
va_end(ArgList);
+    

LogStr[0] = szMessage;
+    


hEventSource = RegisterEventSource(NULL, g_szAppName);
+    
if (hEventSource == NULL)
+        return;
+    

ReportEvent(hEventSource, 
wType, 
0, 
DISPLAY_MSG, /* To Just output the text to event log */ 
+                  NULL, 
1, 
0, 
LogStr, 
NULL);
+    

DeregisterEventSource(hEventSource);
+    

if (!g_fRunningAsService)
+        
 {
+        
+            /*
+             * We are running in command mode, output the string 
+             */ 
+            _putts(szMessage);
+        
}
+
}
+
+


+    /*
+     * 
+     * * Handle command-line arguments from the user. 
+     * *     Serivce related options are:
+     * *     -register       - registers the service
+     * *     -unregister     - unregisters the service
+     * *     -service        - run as serivce
+     * *     other command-line arguments are unaltered/ignored.
+     * *     They should supplied as first arguments(other wise they will be ignored
+     * * Return: Type indicating the option specified
+     */ 
+    
INT ParseCmdLineForServiceOption(int argc, TCHAR * argv[]) 
+{
+    
int            nReturn = RUN_AS_CONSOLE;   /* Defualted to run as console */
+    

if (argc >= 2)
+        
 {
+        
+            /*
+             * second argument present 
+             */ 
+            if (lstrcmpi(_T("-register"), argv[1]) == 0)
+            
 {
+            
nReturn = REGISTER_SERVICE;
+            
}
+        
+        else if (lstrcmpi(_T("-unregister"), argv[1]) == 0)
+            
 {
+            
nReturn = UN_REGISTER_SERVICE;
+            
}
+        
+        else if (lstrcmpi(_T("-service"), argv[1]) == 0)
+            
 {
+            
nReturn = RUN_AS_SERVICE;
+            
}
+        
}
+    
return nReturn;
+
}
+
+

+    /*
+     * 
+     * * To Display an error message describing the last system error
+     * * message, along with a title passed as a parameter.
+     */ 
+    VOID DisplayError(LPCTSTR pszTitle) 
+{
+    
LPVOID pErrorMsg;
+    

+        /*
+         * Build Error String 
+         */ 
+        FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER |
+                      
FORMAT_MESSAGE_FROM_SYSTEM, 
NULL, 
GetLastError(),
+                      
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
+                      
(LPTSTR) & pErrorMsg, 
0, 
NULL);
+    
if (g_fRunningAsService != FALSE)
+        
 {
+        
WriteToEventLog(EVENTLOG_ERROR_TYPE, pErrorMsg);
+        
}
+    
+    else
+        
 {
+        
MessageBox(NULL, pErrorMsg, pszTitle, MB_ICONHAND);
+        
}
+    

LocalFree(pErrorMsg);
+
}
+
+


+    /*
+     * 
+     * *  To update current service status 
+     * *  Sends the current service status to the SCM. Also updates
+     * *  the global service status structure.
+     */ 
+static          BOOL
+UpdateServiceStatus(DWORD dwStatus, 
DWORD dwErrorCode,
+                    
DWORD dwWaitHint) 
+{
+    
BOOL fReturn = FALSE;
+    
DWORD static   dwCheckpoint = 1;
+    
DWORD dwControls =
+        SERVICE_ACCEPT_STOP | SERVICE_ACCEPT_PAUSE_CONTINUE;
+    

if (g_fRunningAsService == FALSE)
+        return FALSE;
+    

ZeroMemory(&ServiceStatus, sizeof(ServiceStatus));
+    
ServiceStatus.dwServiceType = SERVICE_WIN32;
+    
ServiceStatus.dwCurrentState = dwStatus;
+    
ServiceStatus.dwWaitHint = dwWaitHint;
+    

if (dwErrorCode)
+        
 {
+        
ServiceStatus.dwWin32ExitCode = ERROR_SERVICE_SPECIFIC_ERROR;
+        
ServiceStatus.dwServiceSpecificExitCode = dwErrorCode;
+        
}
+    
+        /*
+         * special cases that depend on the new state 
+         */ 
+        switch (dwStatus)
+        
 {
+    
case SERVICE_START_PENDING:
+        
dwControls = 0;
+        
break;
+    

case SERVICE_RUNNING:
+    
case SERVICE_STOPPED:
+        
dwCheckpoint = 0;
+        
break;
+        
}
+    
ServiceStatus.dwCheckPoint = dwCheckpoint++;
+    
ServiceStatus.dwControlsAccepted = dwControls;
+    

return ReportCurrentServiceStatus();
+
}
+
+


+    /*
+     * 
+     * * Reports current Service status to SCM
+     */ 
+static          BOOL
+ReportCurrentServiceStatus() 
+{
+    
return SetServiceStatus(hServiceStatus, &ServiceStatus);
+
}
+
+


+    /*
+     * 
+     * * The ServiceMain function to start service.
+     */ 
+    VOID WINAPI ServiceMain(DWORD argc, LPTSTR argv[]) 
+{
+    

SECURITY_ATTRIBUTES SecurityAttributes;
+    
DWORD dwThreadId;
+    

+        /*
+         * Input Arguments to function startup 
+         */ 
+        DWORD ArgCount = 0;
+    
LPTSTR * ArgArray = NULL;
+    
TCHAR szRegKey[512];
+    
TCHAR szValue[128];
+    
DWORD nSize;
+    
HKEY hParamKey = NULL;     /* To read startup parameters */
+    
DWORD TotalParams = 0;
+    
DWORD i;
+    
InputParams ThreadInputParams;
+    

+        /*
+         * Build the Input parameters to pass to thread 
+         */ 
+        
+        /*
+         * SCM sends Service Name as first arg, increment to point
+         * * arguments user specified while starting contorl agent
+         */ 
+        

+        /*
+         * Read registry parameter 
+         */ 
+        /*
+         * Initialize count to 1 
+         */ 
+        ArgCount = 1;
+    

+        /*
+         * Create Registry Key path 
+         */ 
+        _stprintf(szRegKey, "%s%s\\%s",
+                  _T("SYSTEM\\CurrentControlSet\\Services\\"), g_szAppName,
+                  "Parameters");
+    
if (RegOpenKeyEx
+         (HKEY_LOCAL_MACHINE, szRegKey, 0, KEY_ALL_ACCESS,
+          &hParamKey) == ERROR_SUCCESS)
+        
 {
+        

+            /*
+             * Read startup Configuration information 
+             */ 
+            /*
+             * Find number of subkeys inside parameters 
+             */ 
+            
if (RegQueryInfoKey
+                 (hParamKey, NULL, NULL, 0, NULL, NULL, NULL, &TotalParams,
+                  NULL, NULL, NULL, NULL) == ERROR_SUCCESS)
+            
 {
+            
if (TotalParams != 0)
+                
 {
+                
ArgCount += TotalParams;
+                

+                    /*
+                     * Allocate memory to hold strings 
+                     */ 
+                    ArgArray =
+                    (LPTSTR *) malloc(sizeof(LPTSTR) * ArgCount);
+                

+                    /*
+                     * Copy first argument 
+                     */ 
+                    ArgArray[0] = _tcsdup(argv[0]);
+                

for (i = 1; i <= TotalParams; i++)
+                    
 {
+                    
+                        /*
+                         * Create Subkey value name 
+                         */ 
+                        _stprintf(szRegKey, "%s%d", "Param", i);
+                    

+                        /*
+                         * Set size 
+                         */ 
+                        nSize = 128;
+                    
RegQueryValueEx(hParamKey, szRegKey, 0, NULL,
+                                     (LPBYTE) & szValue, &nSize);
+                    
ArgArray[i] = _tcsdup(szValue);
+                    
}
+                
}
+            
}
+        
RegCloseKey(hParamKey);
+        
}
+    


if (ArgCount == 1)
+        
 {
+        
+            /*
+             * No statup agrs are given 
+             */ 
+            ThreadInputParams.Argc = argc;
+        
ThreadInputParams.Argv = argv;
+        
}
+    
+    else
+        
 {
+        
ThreadInputParams.Argc = ArgCount;
+        
ThreadInputParams.Argv = ArgArray;
+        
}
+    

+        /*
+         * Register Serivce Control Handler 
+         */ 
+        hServiceStatus =
+        RegisterServiceCtrlHandler(g_szAppName, 
ControlHandler);
+    
if (hServiceStatus == 0)
+        
 {
+        
WriteToEventLog(EVENTLOG_ERROR_TYPE,
+                         
_T("RegisterServiceCtrlHandler failed"));
+        
return;
+        
}
+    

+        /*
+         * Update the service status to START_PENDING 
+         */ 
+        UpdateServiceStatus(SERVICE_START_PENDING, 
NO_ERROR,
+                            
SCM_WAIT_INTERVAL);
+    

+        /*
+         * Spin of worker thread, which does majority of the work 
+         */ 
+        
__try 
 {
+        
if (SetSimpleSecurityAttributes(&SecurityAttributes) == FALSE)
+            
 {
+            
WriteToEventLog(EVENTLOG_ERROR_TYPE,
+                             
_T("Couldn't init security attributes"));
+            
__leave;
+            
}
+        
hServiceThread =
+            (void *) _beginthreadex(&SecurityAttributes, 
0,
+                                    
ThreadFunction,
+                                    
(void *) &ThreadInputParams, 
0,
+                                    
&dwThreadId);
+        
if (hServiceThread == NULL)
+            
 {
+            
WriteToEventLog(EVENTLOG_ERROR_TYPE,
+                             
_T("Couldn't start worker thread"));
+            
__leave;
+            
}
+        

+            /*
+             * Set Service Status to Running 
+             */ 
+            UpdateServiceStatus(SERVICE_RUNNING, 
NO_ERROR,
+                                
SCM_WAIT_INTERVAL);
+        

+            /*
+             * Wait for termination event and worker thread to
+             * * spin down.
+             */ 
+            
WaitForSingleObject(hServiceThread, INFINITE);
+    
}
+    
__finally 
 {
+        
+            /*
+             * Release resources 
+             */ 
+            UpdateServiceStatus(SERVICE_STOPPED, 
NO_ERROR,
+                                
SCM_WAIT_INTERVAL);
+        

if (hServiceThread)
+            
CloseHandle(hServiceThread);
+        
FreeSecurityAttributes(&SecurityAttributes);
+        

+            /*
+             * Delete allocated argument list 
+             */ 
+            if (ArgCount > 1 && ArgArray != NULL)
+            
 {
+            
+                /*
+                 * Delete all strings 
+                 */ 
+                for (i = 0; i < ArgCount; i++)
+                
 {
+                
free(ArgArray[i]);
+                
}
+            
free(ArgArray);
+            
}
+    
}
+
}
+
+

+    /*
+     * 
+     * * Function to start as Windows service
+     * * The calling party should specify their entry point as input parameter
+     * * Returns TRUE if the Service is started successfully
+     */ 
+    
BOOL RunAsService(INT(*ServiceFunction) (INT, LPTSTR *)) 
+{
+    

+        /*
+         * Set the ServiceEntryPoint 
+         */ 
+        ServiceEntryPoint = ServiceFunction;
+    

+        /*
+         * By default, mark as Running as a service 
+         */ 
+        g_fRunningAsService = TRUE;
+    

+        /*
+         * Initialize ServiceTableEntry table 
+         */ 
+        ServiceTableEntry[0].lpServiceName = g_szAppName;       /* Application Name */
+    

+        /*
+         * Call SCM via StartServiceCtrlDispatcher to run as Service 
+         * * If the function returns TRUE we are running as Service, 
+         */ 
+        
if (StartServiceCtrlDispatcher(ServiceTableEntry) == FALSE)
+        
 {
+        
g_fRunningAsService = FALSE;
+        

+            /*
+             * Some other error has occurred. 
+             */ 
+            WriteToEventLog(EVENTLOG_ERROR_TYPE,
+                            
_T("Couldn't start service - %s"),
+                            g_szAppName);
+        

}
+    

return g_fRunningAsService;
+
}
+
+


+    /*
+     * 
+     * * Service control handler function
+     * * Responds to SCM commands/requests
+     * * The service handles 4 commands
+     * * commands - interrogate,pause, continue and stop.
+     */ 
+    VOID WINAPI ControlHandler(DWORD dwControl) 
+{
+    
switch (dwControl)
+        
 {
+    
case SERVICE_CONTROL_STOP:
+        
ProcessServiceStop();  /* To stop the service */
+        
break;
+    
case SERVICE_CONTROL_INTERROGATE:
+        
ProcessServiceInterrogate();   /* Report Current state of the Service */
+        
break;
+    
case SERVICE_CONTROL_PAUSE:
+        
ProcessServicePause(); /* To puase service */
+        
break;
+    
case SERVICE_CONTROL_CONTINUE:
+        
ProcessServiceContinue();      /* To continue Service */
+        
break;
+        
}
+
}
+
+

+    /*
+     * 
+     * * To stop the service.  This invokes registered
+     * * stop function to stop the service(gracefull exit)
+     * * After stopping, Service status is set to STOP in 
+     * * main loop
+     */ 
+    VOID ProcessServiceStop(VOID) 
+{
+    
UpdateServiceStatus(SERVICE_STOP_PENDING, 
NO_ERROR,
+                         
SCM_WAIT_INTERVAL);
+    

+        /*
+         * Invoke registered Stop funciton 
+         */ 
+        if (StopFunction != NULL)
+        
 {
+        
(*StopFunction) ();
+        
}
+    
+    else
+        
 {
+        
+            /*
+             * There is no registered stop function, so terminate the thread 
+             */ 
+            TerminateThread(hServiceThread, 0);
+        
}
+
}
+
+


+    /*
+     * 
+     * * Returns the current state of the service to the SCM.
+     */ 
+    VOID ProcessServiceInterrogate(VOID) 
+{
+    
ReportCurrentServiceStatus();
+
}
+
+


+    /*
+     * 
+     * * To Create a security descriptor with a NULL ACL, which
+     * * allows unlimited access. Returns a SECURITY_ATTRIBUTES
+     * * structure that contains the security descriptor.
+     * * The structure contains a dynamically allocated security
+     * * descriptor that must be freed; either manually, or by
+     * * calling FreeSecurityAttributes 
+     */ 
+    BOOL SetSimpleSecurityAttributes(SECURITY_ATTRIBUTES * pSecurityAttr) 
+{
+    
BOOL fReturn = FALSE;
+    
SECURITY_DESCRIPTOR * pSecurityDesc = NULL;
+    

+        /*
+         * If an invalid address passed as a parameter, return
+         * * FALSE right away. 
+         */ 
+        
if (!pSecurityAttr)
+        return FALSE;
+    

pSecurityDesc =
+        (SECURITY_DESCRIPTOR *) LocalAlloc(LPTR,
+                                           
SECURITY_DESCRIPTOR_MIN_LENGTH);
+    
if (!pSecurityDesc)
+        return FALSE;
+    

fReturn =
+        InitializeSecurityDescriptor(pSecurityDesc,
+                                     
SECURITY_DESCRIPTOR_REVISION);
+    
if (fReturn != FALSE)
+        
 {
+        
fReturn =
+            SetSecurityDescriptorDacl(pSecurityDesc, TRUE, NULL, FALSE);
+        
}
+    

if (fReturn != FALSE)
+        
 {
+        
pSecurityAttr->nLength = sizeof(SECURITY_ATTRIBUTES);
+        
pSecurityAttr->lpSecurityDescriptor = pSecurityDesc;
+        
pSecurityAttr->bInheritHandle = TRUE;
+        
}
+    
+    else
+        
 {
+        
+            /*
+             * Couldn't initialize or set security descriptor. 
+             */ 
+            LocalFree(pSecurityDesc);
+        
}
+    
return fReturn;
+
}
+
+

+    /*
+     * 
+     * * This funciton Frees the security descriptor owned by a SECURITY_ATTRIBUTES
+     * * structure.
+     */ 
+    VOID FreeSecurityAttributes(SECURITY_ATTRIBUTES * pSecurityAttr) 
+{
+    
if (pSecurityAttr && pSecurityAttr->lpSecurityDescriptor)
+        
LocalFree(pSecurityAttr->lpSecurityDescriptor);
+
}
+
+

+    /*
+     * TheadFunction
+     * * This function is spawn as thread.
+     * * Invokes registered service function
+     * * Returns when called registered function returns
+     */ 
+    DWORD WINAPI ThreadFunction(LPVOID lpParam) 
+{
+    
+        /*
+         * lpParam contains argc and argv, pass to service main function 
+         */ 
+        
+        /*
+         * Declare pointer to InputParams 
+         */ 
+        InputParams * pInputArg;
+    
pInputArg = (InputParams *) lpParam;
+    
return (*ServiceEntryPoint) (pInputArg->Argc, pInputArg->Argv);
+
}
+
+

+    /*
+     * 
+     * * To register STOP function with the framework
+     * * This function will be inovked when SCM sends
+     * * STOP command
+     */ 
+    
VOID RegisterStopFunction(void (*StopFunc) ()) 
+{
+    
StopFunction = StopFunc;
+
} 


+
+    /*
+     * 
+     * * To Pause the service whec SCM sends pause command
+     * * Invokes PauseThread on worker Thread handle, only
+     * * when Service status is Running
+     */ 
+    VOID ProcessServicePause(VOID) 
+{
+    

if (ServiceStatus.dwCurrentState == SERVICE_RUNNING)
+        
 {
+        
UpdateServiceStatus(SERVICE_PAUSE_PENDING, 
NO_ERROR,
+                             
SCM_WAIT_INTERVAL);
+        

+            /*
+             * Invoke Thread pause on ThreadHandle 
+             */ 
+            if (SuspendThread(hServiceThread) != -1)
+            
 {
+            
UpdateServiceStatus(SERVICE_PAUSED, 
NO_ERROR,
+                                 
SCM_WAIT_INTERVAL);
+            
}
+        

}
+
}
+
+



+    /*
+     * 
+     * * To Continue paused service
+     * * Invoke ResumeThread, if thread is paused
+     */ 
+    VOID ProcessServiceContinue(VOID) 
+{
+    

if (ServiceStatus.dwCurrentState == SERVICE_PAUSED)
+        
 {
+        
UpdateServiceStatus(SERVICE_CONTINUE_PENDING, 
NO_ERROR,
+                             
SCM_WAIT_INTERVAL);
+        


+            /*
+             * Invoke Thread pause on ThreadHandle 
+             */ 
+            if (ResumeThread(hServiceThread) != -1)
+            
 {
+            
UpdateServiceStatus(SERVICE_RUNNING, 
NO_ERROR,
+                                 
SCM_WAIT_INTERVAL);
+            
}
+        

}
+
}
+
+
diff -Naur tomato/release/src/router/snmp/snmplib/winservice.mc tomato121/release/src/router/snmp/snmplib/winservice.mc
--- tomato/release/src/router/snmp/snmplib/winservice.mc	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/snmplib/winservice.mc	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,11 @@
+;//Message catalog for Windows Serivce Support routines
+;//To support event logging functionality
+;//By Raju Krishnappa(raju_krishnappa@yahoo.com)
+
+;//Message ID descriptions
+
+MessageId=100
+SymbolicName=DISPLAY_MSG
+Language=English
+%1.
+.
diff -Naur tomato/release/src/router/snmp/snmplib/winservice.rc tomato121/release/src/router/snmp/snmplib/winservice.rc
--- tomato/release/src/router/snmp/snmplib/winservice.rc	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/snmplib/winservice.rc	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,2 @@
+LANGUAGE 0x9,0x1
+1 11 MSG00001.bin
diff -Naur tomato/release/src/router/snmp/stamp-h tomato121/release/src/router/snmp/stamp-h
--- tomato/release/src/router/snmp/stamp-h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/stamp-h	2008-10-12 17:03:41.000000000 +1100
@@ -0,0 +1 @@
+timestamp
diff -Naur tomato/release/src/router/snmp/stamp-h.in tomato121/release/src/router/snmp/stamp-h.in
--- tomato/release/src/router/snmp/stamp-h.in	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/stamp-h.in	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1 @@
+timestamp
diff -Naur tomato/release/src/router/snmp/testing/.cvsignore tomato121/release/src/router/snmp/testing/.cvsignore
--- tomato/release/src/router/snmp/testing/.cvsignore	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/testing/.cvsignore	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,5 @@
+Makefile
+etest
+ktest
+misctest
+stest
diff -Naur tomato/release/src/router/snmp/testing/data.keychange-md5 tomato121/release/src/router/snmp/testing/data.keychange-md5
--- tomato/release/src/router/snmp/testing/data.keychange-md5	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/testing/data.keychange-md5	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,26 @@
+0x526f5eed9fcce26f8964c2930787d82b	# old kul
+0x87021d7bd9d101ba05ea6e3bf9d9bd4a	# new kul
+000000000000000000000000000000008805615141676cc9196174e742a32551							# keychange string -- auth/privacy
+
+
+		#		#		#		#
+
+#
+# Following data exerpted from:
+#
+#	Message-Id: <199809282003.QAA27494@relay.hq.tis.com>
+#	Date: Mon, 28 Sep 98 21:57:48 DST
+#	From: "Bert Wijnen" <WIJNEN@vnet.ibm.com>
+#	To: snmpv3@tis.com
+#	Subject: suggested new appendix section A.5 for RFC2274
+#
+maplesyrup				# old passphrase
+0x000000000000000000000002		# engineID
+
+newsyrup				# new passphrase
+01add273107c4e596b4b00f82b1d42a7	# new Ku
+87021d7bd9d101ba05ea6e3bf9d9bd4a	# new kul
+
+00000000000000000000000000000000	# random delta
+
+000000000000000000000000000000008805615141676cc9196174e742a32551							# keychange string -- auth/privacy
diff -Naur tomato/release/src/router/snmp/testing/data.keychange-sha1 tomato121/release/src/router/snmp/testing/data.keychange-sha1
--- tomato/release/src/router/snmp/testing/data.keychange-sha1	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/testing/data.keychange-sha1	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,26 @@
+0x6695febc9288e36282235fc7151f128497b38f3f	# old kul -- for auth
+0x78e2dcce79d59403b58c1bbaa5bff46391f1cd25	# new kul -- for auth
+00000000000000000000000000000000000000009c1017f4fd483d2de8d5fadbf84392cb06457051						# keychange string -- auth
+
+
+		#		#		#		#
+
+#
+# Following data exerpted from:
+#
+#       Message-Id: <199809282003.QAA27494@relay.hq.tis.com>
+#       Date: Mon, 28 Sep 98 21:57:48 DST
+#       From: "Bert Wijnen" <WIJNEN@vnet.ibm.com>
+#       To: snmpv3@tis.com
+#       Subject: suggested new appendix section A.5 for RFC2274
+#
+maplesyrup					# old passphrase
+0x000000000000000000000002			# engineID
+
+newsyrup					# new passphrase
+3a51a6d736aa347b83dc4a87e3e55ee4d698ac71	# new Ku -- auth
+78e2dcce79d59403b58c1bbaa5bff46391f1cd25	# new kul -- auth
+
+0000000000000000000000000000000000000000	# random delta
+
+00000000000000000000000000000000000000009c1017f4fd483d2de8d5fadbf84392cb06457051						# keychange string -- auth
diff -Naur tomato/release/src/router/snmp/testing/data.keychange-sha1-des tomato121/release/src/router/snmp/testing/data.keychange-sha1-des
--- tomato/release/src/router/snmp/testing/data.keychange-sha1-des	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/testing/data.keychange-sha1-des	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,26 @@
+0x6695febc9288e36282235fc7151f1284		# old kul -- privacy
+0x78e2dcce79d59403b58c1bbaa5bff463		# new kul -- privacy
+000000000000000000000000000000007ef8d8a4c9cdb26b47591cd852ff88b5								# keychange string -- privacy
+
+
+		#		#		#		#
+
+#
+# Following data exerpted from:
+#
+#       Message-Id: <199809282003.QAA27494@relay.hq.tis.com>
+#       Date: Mon, 28 Sep 98 21:57:48 DST
+#       From: "Bert Wijnen" <WIJNEN@vnet.ibm.com>
+#       To: snmpv3@tis.com
+#       Subject: suggested new appendix section A.5 for RFC2274
+#
+maplesyrup					# old passphrase
+0x000000000000000000000002			# engineID
+
+newsyrup					# new passphrase
+3a51a6d736aa347b83dc4a87e3e55ee4d698ac71	# new Ku -- privacy
+78e2dcce79d59403b58c1bbaa5bff463		# new kul -- privacy
+
+00000000000000000000000000000000		# random delta
+
+000000000000000000000000000000007ef8d8a4c9cdb26b47591cd852ff88b5								# keychange string -- privacy
diff -Naur tomato/release/src/router/snmp/testing/data.kul-md5 tomato121/release/src/router/snmp/testing/data.kul-md5
--- tomato/release/src/router/snmp/testing/data.kul-md5	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/testing/data.kul-md5	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,8 @@
+maplesyrup				# passphrase
+9faf3283884e92834ebc9847d8edd963	# Ku
+0x000000000000000000000002		# engineID
+526f5eed9fcce26f8964c2930787d82b	# kul
+
+#
+# Taken from <draft-ietf-snmpv3-usm-v2-01.txt>, Section A.3.
+#
diff -Naur tomato/release/src/router/snmp/testing/data.kul-sha1 tomato121/release/src/router/snmp/testing/data.kul-sha1
--- tomato/release/src/router/snmp/testing/data.kul-sha1	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/testing/data.kul-sha1	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,8 @@
+maplesyrup					# passphrase
+9fb5cc0381497b3793528939ff788d5d79145211	# Ku
+0x000000000000000000000002			# engineID
+6695febc9288e36282235fc7151f128497b38f3f	# kul
+
+#
+# Taken from <draft-ietf-snmpv3-usm-v2-01.txt>, Section A.3.
+#
diff -Naur tomato/release/src/router/snmp/testing/etimetest.c tomato121/release/src/router/snmp/testing/etimetest.c
--- tomato/release/src/router/snmp/testing/etimetest.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/testing/etimetest.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,423 @@
+/*
+ * etimetest.c
+ *
+ * Expected SUCCESSes for all tests:    3
+ *
+ * Returns:
+ *      Number of FAILUREs.
+ *
+ * Test of hash_engineID().                             SUCCESSes:  0
+ * Test of LCD Engine ID and Time List.                 SUCCESSes:  3
+ *
+ * FIX  Devise a test for {set,get}_enginetime(..., FALSE).
+ */
+
+static char    *rcsid = "$Id: etimetest.c,v 1.1.2.1 2004/06/20 21:55:08 nikki Exp $";    /* */
+
+
+#include <net-snmp/net-snmp-config.h>
+
+#include <stdio.h>
+#include <sys/types.h>
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#ifdef HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+
+#include "asn1.h"
+#include "snmp_api.h"
+#include "tools.h"
+#include "lcd_time.h"
+#include "snmp_debug.h"
+#include "callback.h"
+
+static u_int    dummy_etime, dummy_eboot;       /* For ISENGINEKNOWN(). */
+
+
+#include <stdlib.h>
+
+extern char    *optarg;
+extern int      optind, optopt, opterr;
+
+
+
+/*
+ * Globals, &c...
+ */
+char           *local_progname;
+
+#define USAGE	"Usage: %s [-h][-s <seconds>][-aeH]"
+#define OPTIONLIST	"aehHs:"
+
+int             doalltests = 0, dohashindex = 0, doetimetest = 0;
+
+#define	ALLOPTIONS	(doalltests + dohashindex + doetimetest)
+
+
+
+#define LOCAL_MAXBUF	(1024 * 8)
+#define NL		"\n"
+
+#define OUTPUT(o)	fprintf(stdout, "\n\n%s\n\n", o);
+
+#define SUCCESS(s)					\
+{							\
+	if (!failcount)					\
+		fprintf(stdout, "\nSUCCESS: %s\n", s);	\
+}
+
+#define FAILED(e, f)					\
+{							\
+	if (e != SNMPERR_SUCCESS) {			\
+		fprintf(stdout, "\nFAILED: %s\n", f);	\
+		failcount += 1;				\
+	}						\
+}
+
+
+
+/*
+ * Global variables.
+ */
+int             sleeptime = 7;
+
+#define BLAT "alk;djf;an riu;alicenmrul;aiknglksajhe1 adcfalcenrco2"
+
+
+
+
+/*
+ * Prototypes.
+ */
+void            usage(FILE * ofp);
+
+int             test_etime(void);
+int             test_hashindex(void);
+
+
+
+
+int
+main(int argc, char **argv)
+{
+    int             rval = SNMPERR_SUCCESS, failcount = 0;
+    char            ch;
+
+    local_progname = argv[0];
+
+    /*
+     * Parse.
+     */
+    while ((ch = getopt(argc, argv, OPTIONLIST)) != EOF) {
+        switch (ch) {
+        case 'a':
+            doalltests = 1;
+            break;
+        case 'e':
+            doetimetest = 1;
+            break;
+        case 'H':
+            dohashindex = 1;
+            break;
+        case 's':
+            sleeptime = atoi(optarg);
+            if (sleeptime < 0) {
+                usage(stderr);
+                exit(1000);
+            }
+            break;
+            break;
+        case 'h':
+            rval = 0;
+        default:
+            usage(stdout);
+            exit(rval);
+        }
+
+        argc -= 1;
+        argv += 1;
+        if (optarg) {
+            argc -= 1;
+            argv += 1;
+            optarg = NULL;
+        }
+        optind = 1;
+    }                           /* endwhile getopt */
+
+    if ((argc > 1)) {
+        usage(stdout);
+        exit(1000);
+
+    } else if (ALLOPTIONS != 1) {
+        usage(stdout);
+        exit(1000);
+    }
+
+
+    /*
+     * Test stuff.
+     */
+    rval = sc_init();
+    FAILED(rval, "sc_init()");
+
+
+    if (dohashindex || doalltests) {
+        failcount += test_hashindex();
+    }
+    if (doetimetest || doalltests) {
+        failcount += test_etime();
+    }
+
+
+    /*
+     * Cleanup.
+     */
+    rval = sc_shutdown(SNMP_CALLBACK_LIBRARY, SNMP_CALLBACK_SHUTDOWN,
+                       NULL, NULL);
+    FAILED(rval, "sc_shutdown()");
+
+    return failcount;
+
+}                               /* end main() */
+
+
+
+
+
+void
+usage(FILE * ofp)
+{
+    fprintf(ofp,
+            USAGE
+            "" NL
+            "    -a			All tests." NL
+            "    -e			Exercise the list of enginetimes."
+            NL
+            "    -h			Help."
+            NL
+            "    -H			Test hash_engineID()."
+            NL
+            "    -s <seconds>	Seconds to pause.  (Default: 0.)"
+            NL NL, local_progname);
+
+}                               /* end usage() */
+
+
+
+
+#ifdef EXAMPLE
+/*******************************************************************-o-******
+ * test_dosomething
+ *
+ * Returns:
+ *	Number of failures.
+ *
+ *
+ * Test template.
+ */
+int
+test_dosomething(void)
+{
+    int             rval = SNMPERR_SUCCESS, failcount = 0;
+
+  test_dosomething_quit:
+    return failcount;
+
+}                               /* end test_dosomething() */
+#endif                          /* EXAMPLE */
+
+
+
+
+
+/*******************************************************************-o-******
+ * test_hashindex
+ *
+ * Returns:
+ *	Number of failures.
+ *
+ *
+ * Test hash_engineID().
+ */
+int
+test_hashindex(void)
+{
+    int                         /* rval = SNMPERR_SUCCESS,  */
+                    failcount = 0;
+    char           *s;
+
+    OUTPUT("Visual spot check of hash index outputs.  "
+           "(Success or failure not noted.)");
+
+    s = "A";
+    fprintf(stdout, "%s = %d\n", s, hash_engineID(s, strlen(s)));
+
+    s = "BB";
+    fprintf(stdout, "%s = %d\n", s, hash_engineID(s, strlen(s)));
+
+    s = "CCC";
+    fprintf(stdout, "%s = %d\n", s, hash_engineID(s, strlen(s)));
+
+    s = "DDDD";
+    fprintf(stdout, "%s = %d\n", s, hash_engineID(s, strlen(s)));
+
+    s = "EEEEE";
+    fprintf(stdout, "%s = %d\n", s, hash_engineID(s, strlen(s)));
+
+    s = BLAT;
+    fprintf(stdout, "%s = %d\n", s, hash_engineID(s, strlen(s)));
+
+
+    OUTPUT("Visual spot check -- DONE.");
+
+    return failcount;
+
+}                               /* end test_hashindex() */
+
+
+
+
+
+/*******************************************************************-o-******
+ * test_etime
+ *
+ * Returns:
+ *	Number of failures.
+ *
+ * Test of LCD Engine ID and Time List.	
+ */
+int
+test_etime(void)
+{
+    int             rval = SNMPERR_SUCCESS, failcount = 0;
+    u_int           etime, eboot;
+
+    /*
+     * ------------------------------------ -o-
+     */
+    OUTPUT("Query of empty list, two set actions.");
+
+
+    rval = ISENGINEKNOWN("A", 1);
+    if (rval == TRUE) {
+        FAILED(SNMPERR_GENERR, "Query of empty list returned TRUE.")
+    }
+
+
+    rval = set_enginetime("BB", 2, 2, 20, TRUE);
+    FAILED(rval, "set_enginetime()");
+
+
+    rval = set_enginetime("CCC", 3, 31, 90127, TRUE);
+    FAILED(rval, "set_enginetime()");
+
+
+    SUCCESS("Check of empty list, and two additions.");
+
+
+
+    /*
+     * ------------------------------------ -o-
+     */
+    OUTPUT("Add entries using macros, test for existence with macros.");
+
+
+    rval = ENSURE_ENGINE_RECORD("DDDD", 4);
+    FAILED(rval, "ENSURE_ENGINE_RECORD()");
+
+
+    rval = MAKENEW_ENGINE_RECORD("EEEEE", 5);
+    if (rval == SNMPERR_SUCCESS) {
+        FAILED(rval,
+               "MAKENEW_ENGINE_RECORD returned success for "
+               "missing record.");
+    }
+
+
+    rval = MAKENEW_ENGINE_RECORD("BB", 2);
+    FAILED(rval, "MAKENEW_ENGINE_RECORD().");
+
+
+    SUCCESS
+        ("Added entries with macros, tested for existence with macros.");
+
+
+
+    /*
+     * ------------------------------------ -o-
+     */
+    OUTPUT("Dump the list and then sleep.");
+
+#ifdef SNMP_TESTING_CODE
+    dump_etimelist();
+#endif
+
+    fprintf(stdout, "\nSleeping for %d second%s... ",
+            sleeptime, (sleeptime == 1) ? "" : "s");
+    fflush(stdout);
+
+    sleep(sleeptime);
+    fprintf(stdout, "\n");
+
+
+
+    /*
+     * ------------------------------------ -o-
+     */
+    OUTPUT
+        ("Retrieve data from real/stubbed records, update real/stubbed.");
+
+
+
+    rval = get_enginetime("BB", 2, &eboot, &etime, TRUE);
+    FAILED(rval, "get_enginetime().");
+
+    fprintf(stdout, "BB = <%d,%d>\n", eboot, etime);
+    if ((etime < 20) || (eboot < 2)) {
+        FAILED(SNMPERR_GENERR,
+               "get_enginetime() returned bad values.  (1)");
+    }
+
+    rval = get_enginetime("DDDD", 4, &eboot, &etime, FALSE);
+    FAILED(rval, "get_enginetime().");
+
+    fprintf(stdout, "DDDD = <%d,%d>\n", eboot, etime);
+    if ((etime < sleeptime) || (eboot != 0)) {
+        FAILED(SNMPERR_GENERR,
+               "get_enginetime() returned bad values.  (2)");
+    }
+
+
+    rval = set_enginetime("CCC", 3, 234, 10000, TRUE);
+    FAILED(rval, "set_enginetime().");
+
+
+    rval = set_enginetime("EEEEE", 5, 9876, 55555, TRUE);
+    FAILED(rval, "set_enginetime().");
+
+
+    SUCCESS("Retrieval and updates.");
+
+
+
+    /*
+     * ------------------------------------ -o-
+     */
+    OUTPUT("Sleep again, then dump the list one last time.");
+
+    fprintf(stdout, "Sleeping for %d second%s... ",
+            sleeptime, (sleeptime == 1) ? "" : "s");
+    fflush(stdout);
+
+    sleep(sleeptime);
+    fprintf(stdout, "\n");
+
+#ifdef SNMP_TESTING_CODE
+    dump_etimelist();
+#endif
+
+    return failcount;
+
+}                               /* end test_etime() */
diff -Naur tomato/release/src/router/snmp/testing/eval_oneprogram.sh tomato121/release/src/router/snmp/testing/eval_oneprogram.sh
--- tomato/release/src/router/snmp/testing/eval_oneprogram.sh	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/testing/eval_oneprogram.sh	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,138 @@
+#!/bin/sh
+#
+# eval_oneprogram.sh [-h][-lk] <program> [<program_args>]
+#
+# CALLED BY: eval_suite.sh
+#
+#
+# Runs <program> and reports how many instances of the strings SUCCESS
+# or FAILED occur.
+#
+#
+# FIX	Output from $PROGRAM on stderr is separated out and comes first.
+#
+#
+USAGE_LONG='
+#
+# -h	Help.
+# -k	Save the program output in "__<program_args>__<pid>o".
+# -l	Long form.  (Short form by default.)
+#
+# <program> is the executable to run and collect the output of.
+'
+
+USAGE="Usage: `basename $0` [-h][-lk] <program>"
+
+
+
+
+#------------------------------------ -o- 
+# Globals.
+#
+AWKFILE="_`basename $0`$$.awk"
+SCRIPTFILE=
+
+dolongform=0
+dokeepoutput=
+
+TOTALFAILED=0
+
+
+
+#------------------------------------ -o- 
+# Parse & setup.
+#
+while [ -n "$1" ]; do
+	case "$1" in
+	-k)	dokeepoutput=true
+		;;
+	-l)	dolongform=1
+		;;
+	-h)	echo $USAGE
+		cat <<BLIK | sed 's/^#//' | sed '1d'    1>&2
+$USAGE_LONG
+BLIK
+		exit 0
+		;;
+	*)	PROGRAM="$*"
+		shift `expr $# - 1`
+		;;
+	esac
+
+	shift
+done
+
+[ -z "$PROGRAM" ] && echo $USAGE && exit 1
+
+
+SCRIPTFILE="__`echo \`basename $PROGRAM\` | sed 's/ /_/g'`__$$o"
+
+
+
+#------------------------------------ -o- 
+# Create awk script.
+#
+
+cat <<GRONK >$AWKFILE
+
+BEGIN {
+	pass = 0
+	passlist[0] = ""
+
+	fail = 0
+	faillist[0] = ""
+
+	longform = $dolongform + 0
+}
+
+/SUCCESS/	{
+	passlist[pass] = \$0
+	pass += 1
+}
+
+/FAILED/	{
+	faillist[fail] = \$0
+	fail += 1
+}
+
+END {
+	printf "$PROGRAM SUCCESS: %d\n", pass
+	printf "$PROGRAM FAILED: %d\n", fail
+
+	if (longform) {
+		printf "\n"
+		for (i=0; i<pass; i++)
+			print passlist[i]
+
+		for (i=0; i<fail; i++)
+			print faillist[i]
+	}
+
+	exit fail
+}
+GRONK
+
+
+
+
+#------------------------------------ -o- 
+# Get and print results.
+#
+
+{ $PROGRAM $* 2>&1 ; } >$SCRIPTFILE
+
+awk -f $AWKFILE $SCRIPTFILE
+TOTALFAILED=$?
+
+rm -f $AWKFILE
+[ -z "$dokeepoutput" ] && rm -f $SCRIPTFILE
+
+
+
+
+#------------------------------------ -o- 
+# Exit, cleanup.
+#
+exit $TOTALFAILED
+
+
diff -Naur tomato/release/src/router/snmp/testing/eval_onescript.sh tomato121/release/src/router/snmp/testing/eval_onescript.sh
--- tomato/release/src/router/snmp/testing/eval_onescript.sh	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/testing/eval_onescript.sh	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,37 @@
+#!/bin/sh
+#
+# eval_onescript.sh SCRIPT  [TESTNUMBER [HEADERONLY] ]
+#
+# Evaluates one test program, and helps it out by doing a bit of setup
+# for it.  It does this by sourcing some configuration files for it
+# first, and if it exited without calling FINISHED, call it.
+#
+# Not intended to be a tool for the common user!  Called by RUNTESTS
+# directly instead.
+#
+
+testnum=1
+if [ "x$2" != "x" ]; then
+	testnum=$2
+fi
+export testnum
+
+unset SNMP_HEADERONLY
+if [ "x$3" = "xyes" ]; then
+    SNMP_HEADERONLY=yes
+fi
+export SNMP_HEADERONLY
+
+. TESTCONF.sh
+
+. eval_tools.sh
+
+ECHO "$testnum:  "
+
+. ./$1
+
+# We shouldn't get here...
+# If we do, it means they didn't exit properly.
+# So we will.
+STOPAGENT      # Just in case.
+FINISHED
diff -Naur tomato/release/src/router/snmp/testing/eval_suite.sh tomato121/release/src/router/snmp/testing/eval_suite.sh
--- tomato/release/src/router/snmp/testing/eval_suite.sh	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/testing/eval_suite.sh	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,212 @@
+#!/bin/sh
+#
+# eval_suite.sh [-h][<args_passed_to_getresults>]
+#
+# CALLS: eval_oneprogram.sh [-h][-lk] <program>
+#
+# RETURNS:	Number of failed tests, regardless of how that failure occured
+#		or how many failures there were in a given test.
+#
+#
+
+
+								USAGE_LONG='
+#
+# HOW TO ENTER A NEW TEST
+#
+# To add a test to the testlist, add a line to the TESTLISTFILE (eval_testlist)
+# using the following format:
+#
+#	<#_of_expected_successes> [#]<program> <args>
+#
+# Any white space may be used as separator.  If <program> is immediately
+# preceeded by a pound sign (#) that test will be skipped.  (No white space
+# allowed after the pound.  Eg, "#<program>".)
+#
+#
+# HOW TESTS ARE RUN AND EVALUATED
+#
+# The harness for individual tests is the script "eval_oneprogram.sh".
+# It expects that the test print FAILED when something fails, and SUCCESS
+# when something succeeds.  If a test executes properly there should be
+# some SUCCESS strings and NO FAILED strings.  If the reason for the
+# success or failure of the test should be printed on the SAME line as the
+# SUCCESS/FAILED string to allow the dianostic to be easilly grepped from
+# the its output.
+#
+# The long form of the output (-l flag) will capture that output which may
+# help to diagnosis the problem.  For more information:
+#
+#	% eval_oneprogram.sh -h
+#
+# 
+# MISSING TESTS ARE NOTED
+#
+# If an executable is found MISSING, a note is printed to that effect
+# and TESTFAILURE is incremented by 1.
+#
+'
+
+#
+# Suggested improvement(s):
+#	Have two (or more?) arbitrary script(s) that may be associated
+#	with a given test.  One could prepare the environment, the other
+#	could clean up the environment after running the test.  This could
+#	help when testing large subsystems that might require legitimately
+#	building or changing things such that the testable item may be 
+#	accessed in the first place (eg). ...
+#
+
+
+#------------------------------------ -o- 
+# Usage mess.  (No, it works.)
+#
+USAGE="Usage: `basename $0` [-h][<args_for_getresults>]"
+
+usage() { echo; echo $USAGE; cat <<BLIK | sed 's/^#//' | sed '1d' | $PAGER
+$USAGE_LONG
+BLIK
+exit 0
+}
+
+[ "x$1" = "x-h" ] && usage
+
+
+
+#------------------------------------ -o- 
+# Globals.
+#
+PROGRAM=
+ARGUMENTS="$*"
+
+TMPFILE=/tmp/eval_suite.sh$$
+
+TESTLISTFILE=eval_testlist
+
+EXPECTEDSUCCESSES=
+TESTFAILURE=0
+
+testname=
+
+success_count=
+failed_count=
+
+#
+# TESTLISTFILE format:
+#  	<expected_successes>	<program> <arg(s)> ...
+#  	<expected_successes>	<program> <arg(s)> ...
+#	...
+#
+TESTLIST="`cat $TESTLISTFILE | sed 's/$/   ===/'`"
+
+
+
+
+
+#------------------------------------ -o- 
+# Run all tests in the testlist.  For each test do the following:
+#
+#	1) Note whether the test is SKIPPED or MISSING.
+#
+#	2) Run the test; collect the number of FAILED strings from the
+#		return value of eval_oneprogram.sh.
+#
+#	3) Count the number of SUCCESSes from the test output.
+#
+#	4) Print the results.  If there were no FAILED strings *and* the
+#		number of SUCCESS strings is what we expect, simply
+#		note that the test passed.  Otherwise, cat the output
+#		generated by eval_oneprogram.sh and (possibly)
+#		print other details.
+#
+set x $TESTLIST
+shift
+
+while [ -n "$1" ] ; do
+	#
+	# Parse agument stream...
+	#
+	EXPECTEDSUCCESSES=$1
+	shift
+
+	PROGRAM=
+	while [ "$1" != "===" ] ; do { PROGRAM="$PROGRAM $1" ; shift ; } done
+	shift
+
+	testname="`echo $PROGRAM | grep '^#' | sed 's/^#//'`"
+
+	echo '+==================================-o-===+'
+	echo
+
+
+
+	#
+	# Decide whether to skip the test, if it's mising, else run it.
+	#
+	[ -n "$testname" ] && {					# Skip the test?
+		echo "SKIPPING test for \"$testname\"."
+		echo
+		continue
+	}
+	[ ! -e "`echo $PROGRAM | awk '{ print $1 }'`" ] && {	# Missing test?
+		TESTFAILURE=`expr $TESTFAILURE + 1`
+
+		echo "MISSING test for \"$PROGRAM\"."
+		echo
+		continue
+	}
+
+	echo "TESTING \"$PROGRAM\"..."				# Announce test!
+
+
+
+	#
+	# Run the test and collect the failed_count and success_count.
+	#
+	eval_oneprogram.sh $ARGUMENTS $PROGRAM >$TMPFILE
+	failed_count=$?
+
+	success_count=`awk '$(NF-1) == "SUCCESS:" { print $NF; exit }' $TMPFILE`
+	[ -z "$success_count" ] && success_count=0
+
+
+	
+	#
+	# Output best-effort results of the test  -OR-  a fully successful run.
+	#
+	[ "$failed_count" -eq 0 -a \
+			"$success_count" -eq "$EXPECTEDSUCCESSES" ] &&
+	{
+		echo
+		echo $PROGRAM PASSED		# Successful, fully, completed
+		echo
+		
+		true
+	} || {
+		TESTFAILURE=`expr $TESTFAILURE + 1`
+
+		echo
+		cat $TMPFILE
+		echo
+
+		[ "$success_count" -ne $EXPECTEDSUCCESSES ] && {
+			echo "Got $success_count SUCCESSes"\
+						"out of $EXPECTEDSUCCESSES."
+			echo
+		}
+		true
+	}  # end -- evaluation of and output based upon test success.
+done  # endwhile
+
+
+
+
+#------------------------------------ -o- 
+# Cleanup, exit.
+#
+rm -f $TMPFILE
+
+exit $TESTFAILURE
+
+
+
diff -Naur tomato/release/src/router/snmp/testing/eval_testlist tomato121/release/src/router/snmp/testing/eval_testlist
--- tomato/release/src/router/snmp/testing/eval_testlist	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/testing/eval_testlist	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,5 @@
+7	ktest -a
+13	stest -a		
+3	#test_keychange.sh
+2	test_kul.sh
+3	etest -a
diff -Naur tomato/release/src/router/snmp/testing/eval_tools.sh tomato121/release/src/router/snmp/testing/eval_tools.sh
--- tomato/release/src/router/snmp/testing/eval_tools.sh	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/testing/eval_tools.sh	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,491 @@
+#
+# eval_tools.sh
+#
+# Output functions for script tests.  Source this from other test scripts
+# to establish a standardized repertory of test functions.
+#
+#
+# Except where noted, all functions return:
+#	0	On success,	(Bourne Shell's ``true'')
+#	non-0	Otherwise.
+#
+# Input arguments to each function are documented with each function.
+#
+#
+# XXX  Suggestions:
+#	DEBUG ON|OFF
+#	dump CAPTURE output to stdout as well as to junkoutputfile.
+#
+
+#
+# Only allow ourselves to be eval'ed once
+#
+if [ "x$EVAL_TOOLS_SH_EVALED" != "xyes" ]; then
+    EVAL_TOOLS_SH_EVALED=yes
+    . TESTCONF.sh
+
+#
+# Variables used in global environment of calling script.
+#
+failcount=0
+junkoutputfile="$SNMP_TMPDIR/output-`basename $0`$$"
+seperator="-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-="
+
+#
+# HEADER: returns a single line when SNMP_HEADERONLY mode and exits.
+#
+HEADER() {
+    if [ "x$SNMP_HEADERONLY" != "x" ]; then
+        echo test $*
+	exit 0;
+    else
+	ECHO "testing $*...  "
+	headerStr="testing $*"
+    fi
+}
+
+
+#------------------------------------ -o-
+#
+OUTPUT() {	# <any_arguments>
+	cat <<GRONK
+
+
+$*
+
+
+GRONK
+}
+
+CAN_USLEEP() {
+   if [ "$SNMP_CAN_USLEEP" = 0 -o "$SNMP_CAN_USLEEP" = 0 ] ; then
+     return $SNMP_CAN_USLEEP
+   fi
+   sleep .1 > /dev/null 2>&1
+   if [ $? = 0 ] ; then
+     SNMP_CAN_USLEEP=1
+   else
+     SNMP_CAN_USLEEP=0
+   fi
+   export SNMP_CAN_USLEEP
+}
+
+
+#------------------------------------ -o-
+#
+SUCCESS() {	# <any_arguments>
+	[ "$failcount" -ne 0 ] && return
+	cat <<GROINK
+
+SUCCESS: $*
+
+GROINK
+}
+
+
+
+#------------------------------------ -o-
+#
+FAILED() {	# <return_value>, <any_arguments>
+	[ "$1" -eq 0 ] && return
+	shift
+
+	failcount=`expr $failcount + 1`
+	cat <<GRONIK
+
+FAILED: $*
+
+GRONIK
+}
+
+#------------------------------------ -o-
+#
+SKIPIFNOT() {
+	grep "define $1" $SNMP_UPDIR/include/net-snmp/net-snmp-config.h $SNMP_UPDIR/include/net-snmp/agent/mib_module_config.h > /dev/null
+	if [ $? != 0 ]; then
+	    REMOVETESTDATA
+	    echo "SKIPPED"
+	    exit 0;
+	fi
+}
+	
+
+#------------------------------------ -o-
+#
+VERIFY() {	# <path_to_file(s)>
+	local	missingfiles=
+
+	for f in $*; do
+		[ -e "$f" ] && continue
+		echo "FAILED: Cannot find file \"$f\"."
+		missingfiles=true
+	done
+
+	[ "$missingfiles" = true ] && exit 1000
+}
+
+
+#------------------------------------ -o-
+#
+STARTTEST() {	
+	[ ! -e "$junkoutputfile" ] && {
+		touch $junkoutputfile
+		return
+	}
+	echo "FAILED: Output file already exists: \"$junkoutputfile\"."
+	exit 1000
+}
+
+
+#------------------------------------ -o-
+#
+STOPTEST() {
+	rm -f "$junkoutputfile"
+}
+
+
+#------------------------------------ -o-
+#
+REMOVETESTDATA() {
+#	ECHO "removing $SNMP_TMPDIR  "
+	rm -rf $SNMP_TMPDIR
+}
+
+
+#------------------------------------ -o-
+#
+CAPTURE() {	# <command_with_arguments_to_execute>
+    echo $* >> $SNMP_TMPDIR/invoked
+
+	if [ $SNMP_VERBOSE -gt 0 ]; then
+		cat <<KNORG
+
+EXECUTING: $*
+
+KNORG
+
+	fi
+	( $* 2>&1 ) > $junkoutputfile 2>&1
+
+	if [ $SNMP_VERBOSE -gt 1 ]; then
+		echo "Command Output: "
+		echo "MIBDIR $MIBDIRS $MIBS"
+		echo "$seperator"
+		cat $junkoutputfile | sed 's/^/  /'
+		echo "$seperator"
+	fi
+}
+
+#------------------------------------ -o-
+# Delay to let processes settle
+DELAY() {
+    if [ "$SNMP_SLEEP" != "0" ] ; then
+	sleep $SNMP_SLEEP
+    fi
+}
+
+SAVE_RESULTS() {
+   real_return_value=$return_value
+}
+
+#
+# Checks the output result against what we expect.
+#   Sets return_value to 0 or 1.
+#
+EXPECTRESULT() {
+    if [ "$snmp_last_test_result" = "$1" ]; then
+	return_value=0
+    else
+	return_value=1
+    fi
+}
+
+#------------------------------------ -o-
+# Returns: Count of matched lines.
+#
+CHECK() {	# <pattern_to_match>
+    if [ $SNMP_VERBOSE -gt 0 ]; then
+	echo -n "checking output for \"$*\"..."
+    fi
+
+    rval=`grep -c "$*" "$junkoutputfile" 2>/dev/null`
+
+    if [ $SNMP_VERBOSE -gt 0 ]; then
+	echo "$rval matches found"
+    fi
+
+    snmp_last_test_result=$rval
+    EXPECTRESULT 1  # default
+    return $rval
+}
+
+CHECKFILE() {
+    file=$1
+    if [ "x$file" = "x" ] ; then
+        file=$junkoutputfile
+    fi
+    shift
+    myoldjunkoutputfile="$junkoutputfile"
+    junkoutputfile="$file"
+    CHECK $*
+    junkoutputfile="$myoldjunkoutputfile"
+}
+
+CHECKTRAPD() {
+    CHECKFILE $SNMP_SNMPTRAPD_LOG_FILE $@
+}
+
+CHECKAGENT() {
+    CHECKGAENT $SNMP_SNMPD_LOG_FILE $@
+}
+
+WAITFORAGENT() {
+    WAITFOR "$@" $SNMP_SNMPD_LOG_FILE
+}
+
+WAITFORTRAPD() {
+    WAITFOR "$@" $SNMP_SNMPTRAPD_LOG_FILE
+}
+
+WAITFOR() {
+    sleeptime=$SNMP_SLEEP
+    oldsleeptime=$SNMP_SLEEP
+    if [ "$1" != "" ] ; then
+	CAN_USLEEP
+	if [ $SNMP_CAN_USLEEP = 1 ] ; then
+	  sleeptime=`expr $SNMP_SLEEP '*' 10`
+          SNMP_SLEEP=.1
+	else 
+	  SNMP_SLEEP=1
+	fi
+        while [ $sleeptime -gt 0 ] ; do
+	  if [ "$2" = "" ] ; then
+            CHECK "$@"
+          else
+	    CHECKFILE "$2" "$1"
+	  fi
+          if [ "$snmp_last_test_result" != "" ] ; then
+              if [ "$snmp_last_test_result" -gt 0 ] ; then
+	         SNMP_SLEEP=$oldsleeptime
+	         return 0;
+              fi
+	  fi
+          DELAY
+          sleeptime=`expr $sleeptime - 1`
+        done
+        SNMP_SLEEP=$oldsleeptime
+    else
+        if [ $SNMP_SLEEP -ne 0 ] ; then
+	    sleep $SNMP_SLEEP
+        fi
+    fi
+}    
+
+# WAITFORORDIE "grep string" ["file"]
+WAITFORORDIE() {
+    WAITFOR "$1" "$2"
+    if [ "$snmp_last_test_result" != 0 ] ; then
+        FINISHED
+    fi
+    ECHO "."
+}
+
+# CHECKFILE "grep string" ["file"]
+CHECKORDIE() {
+    CHECKFILE "$2" "$1"
+    if [ "$snmp_last_test_result" = 0 ] ; then
+        FINISHED
+    fi
+    ECHO "."
+}
+
+#------------------------------------ -o-
+# Returns: Count of matched lines.
+#
+CHECKEXACT() {	# <pattern_to_match_exactly>
+	rval=`grep -wc "$*" "$junkoutputfile" 2>/dev/null`
+	snmp_last_test_result=$rval
+	EXPECTRESULT 1  # default
+	return $rval
+}
+
+CONFIGAGENT() {
+    if [ "x$SNMP_CONFIG_FILE" = "x" ]; then
+	echo "$0: failed because var: SNMP_CONFIG_FILE wasn't set"
+	exit 1;
+    fi
+    echo $* >> $SNMP_CONFIG_FILE
+}
+
+CONFIGTRAPD() {
+    if [ "x$SNMPTRAPD_CONFIG_FILE" = "x" ]; then
+	echo "$0: failed because var: SNMPTRAPD_CONFIG_FILE wasn't set"
+	exit 1;
+    fi
+    echo $* >> $SNMPTRAPD_CONFIG_FILE
+}
+
+#
+# common to STARTAGENT and STARTTRAPD
+# log command to "invoked" file
+# delay after command to allow for settle
+#
+STARTPROG() {
+    if [ $SNMP_VERBOSE -gt 1 ]; then
+	echo "$CFG_FILE contains: "
+	if [ -f $CFG_FILE ]; then
+	    cat $CFG_FILE
+	else
+	    echo "[no config file]"
+	fi
+    fi
+    if test -f $CFG_FILE; then
+	COMMAND="$COMMAND -C -c $CFG_FILE"
+    fi
+    if [ $SNMP_VERBOSE -gt 0 ]; then
+	echo "running: $COMMAND"
+    fi
+    if [ "x$PORT_SPEC" != "x" ]; then
+        COMMAND="$COMMAND $PORT_SPEC"
+    fi
+    echo $COMMAND >> $SNMP_TMPDIR/invoked
+    $COMMAND > $LOG_FILE.stdout 2>&1
+
+    DELAY
+}
+
+STARTPROGNOSLEEP() {
+    sleepxxx=$SNMP_SLEEP
+    SNMP_SLEEP=0
+    STARTPROG
+    SNMP_SLEEP=$sleepxxx
+}
+
+#------------------------------------ -o-
+STARTAGENT() {
+    SNMPDSTARTED=1
+    COMMAND="snmpd $SNMP_FLAGS -r -U -P $SNMP_SNMPD_PID_FILE -l $SNMP_SNMPD_LOG_FILE $AGENT_FLAGS"
+    CFG_FILE=$SNMP_CONFIG_FILE
+    LOG_FILE=$SNMP_SNMPD_LOG_FILE
+    PORT_SPEC="$SNMP_SNMPD_PORT"
+
+    STARTPROGNOSLEEP
+    WAITFORAGENT "NET-SNMP version"
+}
+
+#------------------------------------ -o-
+STARTTRAPD() {
+    TRAPDSTARTED=1
+    COMMAND="snmptrapd -d -u $SNMP_SNMPTRAPD_PID_FILE -o $SNMP_SNMPTRAPD_LOG_FILE"
+    CFG_FILE=$SNMPTRAPD_CONFIG_FILE
+    LOG_FILE=$SNMP_SNMPTRAPD_LOG_FILE
+    PORT_SPEC="$SNMP_SNMPTRAPD_PORT"
+
+    STARTPROGNOSLEEP
+    WAITFORTRAPD "NET-SNMP version"
+}
+
+
+## used by STOPAGENT and STOPTRAPD
+# delay before kill to allow previous action to finish
+#    this is especially important for interaction between
+#    master agent and sub agent.
+STOPPROG() {
+    if [ -f $1 ]; then
+	COMMAND="kill -TERM `cat $1`"
+	echo $COMMAND >> $SNMP_TMPDIR/invoked
+
+	DELAY
+	$COMMAND > /dev/null 2>&1
+    fi
+}
+
+STOPPROGNOSLEEP() {
+    sleepxxx=$SNMP_SLEEP
+    SNMP_SLEEP=0
+    STOPPROG "$1"
+    SNMP_SLEEP=$sleepxxx
+}
+
+#------------------------------------ -o-
+#
+STOPAGENT() {
+    SAVE_RESULTS
+    STOPPROGNOSLEEP $SNMP_SNMPD_PID_FILE
+    WAITFORAGENT "shutting down"
+    if [ $SNMP_VERBOSE -gt 1 ]; then
+	echo "Agent Output:"
+	echo "$seperator [stdout]"
+	cat $SNMP_SNMPD_LOG_FILE.stdout
+	echo "$seperator [logfile]"
+	cat $SNMP_SNMPD_LOG_FILE
+	echo "$seperator"
+    fi
+}
+
+#------------------------------------ -o-
+#
+STOPTRAPD() {
+    SAVE_RESULTS
+    STOPPROGNOSLEEP $SNMP_SNMPTRAPD_PID_FILE
+    WAITFORTRAPD "Stopped"
+    if [ $SNMP_VERBOSE -gt 1 ]; then
+	echo "snmptrapd Output:"
+	echo "$seperator [stdout]"
+	cat $SNMP_SNMPTRAPD_LOG_FILE.stdout
+	echo "$seperator [logfile]"
+	cat $SNMP_SNMPTRAPD_LOG_FILE
+	echo "$seperator"
+    fi
+}
+
+#------------------------------------ -o-
+#
+FINISHED() {
+    if [ "$SNMPDSTARTED" = "1" ] ; then
+      STOPAGENT
+    fi
+    if [ "$TRAPDSTARTED" = "1" ] ; then
+      STOPTRAPD
+    fi
+    for pfile in $SNMP_TMPDIR/*pid* ; do
+	pid=`cat $pfile`
+	ps -e | egrep "^[ ]*$pid" > /dev/null 2>&1
+	if [ $? = 0 ] ; then
+	    SNMP_SAVE_TMPDIR=yes
+	    COMMAND="kill -9 $pid"
+	    echo $COMMAND "($pfile)" >> $SNMP_TMPDIR/invoked
+	    $COMMAND > /dev/null 2>&1
+	    return_value=1
+	fi
+    done
+    if [ "x$real_return_value" != "x0" ]; then
+	if [ -s core ] ; then
+	    # XX hope that only one prog cores !
+	    cp core $SNMP_TMPDIR/core.$$
+	    rm -f core
+	fi
+	echo "FAIL"
+	echo "$headerStr...FAIL" >> $SNMP_TMPDIR/invoked
+	exit $real_return_value
+    fi
+
+    echo "ok"
+    echo "$headerStr...ok" >> $SNMP_TMPDIR/invoked
+
+    if [ "x$SNMP_SAVE_TMPDIR" != "xyes" ]; then
+	REMOVETESTDATA
+    fi
+    exit $real_return_value
+}
+
+#------------------------------------ -o-
+#
+VERBOSE_OUT() {
+    if [ $SNMP_VERBOSE > $1 ]; then
+	shift
+	echo "$*"
+    fi
+}
+
+fi # Only allow ourselves to be eval'ed once
diff -Naur tomato/release/src/router/snmp/testing/keymanagetest.c tomato121/release/src/router/snmp/testing/keymanagetest.c
--- tomato/release/src/router/snmp/testing/keymanagetest.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/testing/keymanagetest.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,651 @@
+/*
+ * keymanagetest.c
+ *
+ * Expected SUCCESSes:  2 + 2 + 3 for all tests.
+ *
+ * Returns:
+ *      Number of FAILUREs.
+ * 
+ *
+ * FIX  Or how about passing a usmUser name and looking up the entry as
+ *      a means of getting key material?  This means the userList is
+ *      available from an application...
+ *
+ * ASSUMES  No key management functions return non-zero success codes.
+ *
+ * Test of generate_Ku().                       SUCCESSes: 2
+ * Test of generate_kul().                      SUCCESSes: 2
+ * Test of {encode,decode}_keychange().         SUCCESSes: 3
+ */
+
+static char    *rcsid = "$Id: keymanagetest.c,v 1.1.2.1 2004/06/20 21:55:08 nikki Exp $";        /* */
+
+#include <net-snmp/net-snmp-config.h>
+
+#include <stdio.h>
+#ifdef HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+
+#include "asn1.h"
+#include "snmp_api.h"
+#include "keytools.h"
+#include "tools.h"
+#include "scapi.h"
+#include "transform_oids.h"
+#include "callback.h"
+
+#include <stdlib.h>
+
+extern char    *optarg;
+extern int      optind, optopt, opterr;
+
+
+
+/*
+ * Globals, &c...
+ */
+char           *local_progname;
+
+#define USAGE	"Usage: %s [-h][-aklu][-E <engineID>][-N <newkey>][-O <oldkey>][-P <passphrase>]"
+#define OPTIONLIST	"aqE:hklN:O:P:u"
+
+int             doalltests = 0, dogenKu = 0, dogenkul = 0, dokeychange = 0;
+
+#define	ALLOPTIONS	(doalltests + dogenKu + dogenkul + dokeychange)
+
+
+#define LOCAL_MAXBUF	(1024 * 8)
+#define NL		"\n"
+
+#define OUTPUTALWAYS(o)	fprintf(stdout, "\n\n%s\n\n", o);
+#define OUTPUT(o)	if (!bequiet) { OUTPUTALWAYS(o); }
+
+#define SUCCESS(s)					\
+{							\
+	if (!failcount && !bequiet)					\
+		fprintf(stdout, "\nSUCCESS: %s\n", s);	\
+}
+
+#define FAILED(e, f)					\
+{							\
+	if (e != SNMPERR_SUCCESS && !bequiet) {			\
+		fprintf(stdout, "\nFAILED: %s\n", f);	\
+		failcount += 1;				\
+	}						\
+}
+
+
+
+/*
+ * Test specific globals.
+ */
+#define	ENGINEID_DEFAULT	"1.2.3.4wild"
+#define PASSPHRASE_DEFAULT	"Clay's Conclusion: Creativity is great, " \
+					"but plagiarism is faster."
+#define OLDKEY_DEFAULT		"This is a very old key."
+#define NEWKEY_DEFAULT		"This key, on the other hand, is very new."
+
+char           *engineID = NULL;
+char           *passphrase = NULL;
+char           *oldkey = NULL;
+char           *newkey = NULL;
+int             bequiet = 0;
+
+
+/*
+ * Prototypes.
+ */
+void            usage(FILE * ofp);
+
+int             test_genkul(void);
+int             test_genKu(void);
+int             test_keychange(void);
+
+
+
+
+int
+main(int argc, char **argv)
+{
+    int             rval = SNMPERR_SUCCESS, failcount = 0;
+    char            ch;
+
+    local_progname = argv[0];
+    optarg = NULL;
+
+    /*
+     * Parse.
+     */
+    while ((ch = getopt(argc, argv, OPTIONLIST)) != EOF) {
+        switch (ch) {
+        case 'a':
+            doalltests = 1;
+            break;
+        case 'E':
+            engineID = optarg;
+            break;
+        case 'k':
+            dokeychange = 1;
+            break;
+        case 'l':
+            dogenkul = 1;
+            break;
+        case 'N':
+            newkey = optarg;
+            break;
+        case 'O':
+            oldkey = optarg;
+            break;
+        case 'P':
+            passphrase = optarg;
+            break;
+        case 'u':
+            dogenKu = 1;
+            break;
+        case 'q':
+            bequiet = 1;
+            break;
+        case 'h':
+            rval = 0;
+        default:
+            usage(stdout);
+            exit(rval);
+        }
+
+        argc -= 1;
+        argv += 1;
+        if (optarg) {
+            argc -= 1;
+            argv += 1;
+        }
+
+        optind = 1;
+        optarg = NULL;
+    }                           /* endwhile getopt */
+
+    if ((argc > 1)) {
+        usage(stdout);
+        exit(1000);
+
+    } else if (ALLOPTIONS != 1) {
+        usage(stdout);
+        exit(1000);
+    }
+
+
+    /*
+     * Test stuff.
+     */
+    rval = sc_init();
+    FAILED(rval, "sc_init().");
+
+    if (dogenKu || doalltests) {
+        failcount += test_genKu();
+    }
+    if (dogenkul || doalltests) {
+        failcount += test_genkul();
+    }
+    if (dokeychange || doalltests) {
+        failcount += test_keychange();
+    }
+
+
+    /*
+     * Cleanup.
+     */
+    rval = sc_shutdown(SNMP_CALLBACK_LIBRARY, SNMP_CALLBACK_SHUTDOWN,
+                       NULL, NULL);
+    FAILED(rval, "sc_shutdown().");
+
+    return failcount;
+
+}                               /* end main() */
+
+
+
+
+
+void
+usage(FILE * ofp)
+{
+    fprintf(ofp,
+            USAGE
+            "" NL
+            "    -a			All tests." NL
+            "    -E [0x]<engineID>	snmpEngineID string."
+            NL
+            "    -k			Test {encode,decode}_keychange()."
+            NL
+            "    -l			generate_kul()."
+            NL
+            "    -h			Help."
+            NL
+            "    -N [0x]<newkey>	New key (for testing KeyChange TC)."
+            NL
+            "    -O [0x]<oldkey>	Old key (for testing KeyChange TC)."
+            NL
+            "    -P <passphrase>	Source string for usmUser master key."
+            NL
+            "    -u			generate_Ku()."
+            NL
+            "    -q			be quiet."
+            NL "" NL, local_progname);
+
+}                               /* end usage() */
+
+
+
+
+#ifdef EXAMPLE
+/*******************************************************************-o-******
+ * test_dosomething
+ *
+ * Test template.
+ *
+ * Returns:
+ *	Number of failures.
+ */
+int
+test_dosomething(void)
+{
+    int             rval = SNMPERR_SUCCESS, failcount = 0;
+
+    EM0(1, "UNIMPLEMENTED");    /* EM(1); /* */
+
+  test_dosomething_quit:
+    return failcount;
+
+}                               /* end test_dosomething() */
+#endif                          /* EXAMPLE */
+
+
+
+/*******************************************************************-o-******
+ * test_genKu
+ *
+ * Returns:
+ *	Number of failures.
+ *
+ *
+ * Test generation of usmUser master key from a passphrase.
+ *
+ * ASSUMES  Passphrase is made of printable characters!
+ */
+int
+test_genKu(void)
+{
+    int             rval = SNMPERR_SUCCESS,
+        failcount = 0,
+        properlength = BYTESIZE(SNMP_TRANS_AUTHLEN_HMACMD5), kulen;
+    char           *hashname = "usmHMACMD5AuthProtocol.", *s;
+    u_char          Ku[LOCAL_MAXBUF];
+    oid            *hashtype = usmHMACMD5AuthProtocol;
+
+    OUTPUT("Test of generate_Ku --");
+
+    /*
+     * Set passphrase.
+     */
+    if (!passphrase) {
+        passphrase = PASSPHRASE_DEFAULT;
+    }
+    if (!bequiet)
+        fprintf(stdout, "Passphrase%s:\n\t%s\n\n",
+                (passphrase == PASSPHRASE_DEFAULT) ? " (default)" : "",
+                passphrase);
+
+
+  test_genKu_again:
+    memset(Ku, 0, LOCAL_MAXBUF);
+    kulen = LOCAL_MAXBUF;
+
+    rval = generate_Ku(hashtype, USM_LENGTH_OID_TRANSFORM,
+                       passphrase, strlen(passphrase), Ku, &kulen);
+    FAILED(rval, "generate_Ku().");
+
+    if (kulen != properlength) {
+        FAILED(SNMPERR_GENERR, "Ku length is wrong for this hashtype.");
+    }
+
+    binary_to_hex(Ku, kulen, &s);
+    if (!bequiet)
+        fprintf(stdout, "Ku (len=%d):  %s\n", kulen, s);
+    free_zero(s, kulen);
+
+    SUCCESS(hashname);
+    if (!bequiet)
+        fprintf(stdout, "\n");
+
+    if (hashtype == usmHMACMD5AuthProtocol) {
+        hashtype = usmHMACSHA1AuthProtocol;
+        hashname = "usmHMACSHA1AuthProtocol.";
+        properlength = BYTESIZE(SNMP_TRANS_AUTHLEN_HMACSHA1);
+        goto test_genKu_again;
+    }
+
+    return failcount;
+
+}                               /* end test_genKu() */
+
+
+
+
+/*******************************************************************-o-******
+ * test_genkul
+ *
+ * Returns:
+ *	Number of failures.
+ *
+ *
+ * Test of generate_kul().
+ *
+ * A passphrase and engineID are hashed into a master key Ku using
+ * both known hash transforms.  Localized keys, also using both hash
+ * transforms, are generated from each of these master keys.
+ *
+ * ASSUME  generate_Ku is already tested.
+ * ASSUME  engineID is initially a NULL terminated string.
+ */
+int
+test_genkul(void)
+{
+    int             rval = SNMPERR_SUCCESS,
+        failcount = 0,
+        properlength, kulen, kul_len, engineID_len, isdefault = FALSE;
+
+    char           *s = NULL,
+        *testname = "Using HMACMD5 to create master key.",
+        *hashname_Ku = "usmHMACMD5AuthProtocol", *hashname_kul;
+
+    u_char          Ku[LOCAL_MAXBUF], kul[LOCAL_MAXBUF];
+
+    oid            *hashtype_Ku = usmHMACMD5AuthProtocol, *hashtype_kul;
+
+    OUTPUT("Test of generate_kul --");
+
+
+    /*
+     * Set passphrase and engineID.
+     *
+     * If engineID begins with 0x, assume it is written in (printable)
+     * hex and convert it to binary data.
+     */
+    if (!passphrase) {
+        passphrase = PASSPHRASE_DEFAULT;
+    }
+    if (!bequiet)
+        fprintf(stdout, "Passphrase%s:\n\t%s\n\n",
+                (passphrase == PASSPHRASE_DEFAULT) ? " (default)" : "",
+                passphrase);
+
+    if (!engineID) {
+        engineID = ENGINEID_DEFAULT;
+        isdefault = TRUE;
+    }
+
+    engineID_len = strlen(engineID);
+
+    if (tolower(*(engineID + 1)) == 'x') {
+        engineID_len = hex_to_binary2(engineID + 2, engineID_len - 2, &s);
+        if (engineID_len < 0) {
+            FAILED((rval = SNMPERR_GENERR),
+                   "Could not resolve hex engineID.");
+        }
+        engineID = s;
+        binary_to_hex(engineID, engineID_len, &s);
+    }
+
+    if (!bequiet)
+        fprintf(stdout, "engineID%s (len=%d):  %s\n\n",
+                (isdefault) ? " (default)" : "",
+                engineID_len, (s) ? s : engineID);
+    if (s) {
+        SNMP_FREE(s);
+    }
+
+
+
+    /*
+     * Create a master key using both hash transforms; create localized
+     * keys using both hash transforms from each master key.
+     */
+  test_genkul_again_master:
+    memset(Ku, 0, LOCAL_MAXBUF);
+    kulen = LOCAL_MAXBUF;
+    hashname_kul = "usmHMACMD5AuthProtocol";
+    hashtype_kul = usmHMACMD5AuthProtocol;
+    properlength = BYTESIZE(SNMP_TRANS_AUTHLEN_HMACMD5);
+
+
+    rval = generate_Ku(hashtype_Ku, USM_LENGTH_OID_TRANSFORM,
+                       passphrase, strlen(passphrase), Ku, &kulen);
+    FAILED(rval, "generate_Ku().");
+
+    binary_to_hex(Ku, kulen, &s);
+    if (!bequiet)
+        fprintf(stdout,
+                "\n\nMaster Ku using \"%s\":\n\t%s\n\n", hashname_Ku, s);
+    free_zero(s, kulen);
+
+
+  test_genkul_again_local:
+    memset(kul, 0, LOCAL_MAXBUF);
+    kul_len = LOCAL_MAXBUF;
+
+    rval = generate_kul(hashtype_kul, USM_LENGTH_OID_TRANSFORM,
+                        engineID, engineID_len, Ku, kulen, kul, &kul_len);
+
+    if ((hashtype_Ku == usmHMACMD5AuthProtocol)
+        && (hashtype_kul == usmHMACSHA1AuthProtocol)) {
+        if (rval == SNMPERR_SUCCESS) {
+            FAILED(SNMPERR_GENERR,
+                   "generate_kul SHOULD fail when Ku length is "
+                   "less than hash transform length.");
+        }
+
+    } else {
+        FAILED(rval, "generate_kul().");
+
+        if (kul_len != properlength) {
+            FAILED(SNMPERR_GENERR,
+                   "kul length is wrong for the given hashtype.");
+        }
+
+        binary_to_hex(kul, kul_len, &s);
+        fprintf(stdout, "kul (%s) (len=%d):  %s\n",
+                ((hashtype_Ku == usmHMACMD5AuthProtocol) ? "MD5" : "SHA"),
+                kul_len, s);
+        free_zero(s, kul_len);
+    }
+
+
+    /*
+     * Create localized key using the other hash transform, but from
+     * * the same master key.
+     */
+    if (hashtype_kul == usmHMACMD5AuthProtocol) {
+        hashtype_kul = usmHMACSHA1AuthProtocol;
+        hashname_kul = "usmHMACSHA1AuthProtocol";
+        properlength = BYTESIZE(SNMP_TRANS_AUTHLEN_HMACSHA1);
+        goto test_genkul_again_local;
+    }
+
+    SUCCESS(testname);
+
+
+    /*
+     * Re-create the master key using the other hash transform.
+     */
+    if (hashtype_Ku == usmHMACMD5AuthProtocol) {
+        hashtype_Ku = usmHMACSHA1AuthProtocol;
+        hashname_Ku = "usmHMACSHA1AuthProtocol";
+        testname = "Using HMACSHA1 to create master key.";
+        goto test_genkul_again_master;
+    }
+
+    return failcount;
+
+}                               /* end test_genkul() */
+
+
+
+
+/*******************************************************************-o-******
+ * test_keychange
+ *
+ * Returns:
+ *	Number of failures.
+ *
+ *
+ * Test of KeyChange TC implementation.
+ *
+ * ASSUME newkey and oldkey begin as NULL terminated strings.
+ */
+int
+test_keychange(void)
+{
+    int             rval = SNMPERR_SUCCESS,
+        failcount = 0,
+        properlength = BYTESIZE(SNMP_TRANS_AUTHLEN_HMACMD5),
+        oldkey_len,
+        newkey_len,
+        keychange_len,
+        temp_len, isdefault_new = FALSE, isdefault_old = FALSE;
+
+    char           *hashname = "usmHMACMD5AuthProtocol.", *s;
+
+    u_char          oldkey_buf[LOCAL_MAXBUF],
+        newkey_buf[LOCAL_MAXBUF],
+        temp_buf[LOCAL_MAXBUF], keychange_buf[LOCAL_MAXBUF];
+
+    oid            *hashtype = usmHMACMD5AuthProtocol;
+
+    OUTPUT("Test of KeyChange TC --");
+
+
+    /*
+     * Set newkey and oldkey.
+     */
+    if (!newkey) {              /* newkey */
+        newkey = NEWKEY_DEFAULT;
+        isdefault_new = TRUE;
+    }
+    newkey_len = strlen(newkey);
+
+    if (tolower(*(newkey + 1)) == 'x') {
+        newkey_len = hex_to_binary2(newkey + 2, newkey_len - 2, &s);
+        if (newkey_len < 0) {
+            FAILED((rval = SNMPERR_GENERR),
+                   "Could not resolve hex newkey.");
+        }
+        newkey = s;
+        binary_to_hex(newkey, newkey_len, &s);
+    }
+
+    if (!oldkey) {              /* oldkey */
+        oldkey = OLDKEY_DEFAULT;
+        isdefault_old = TRUE;
+    }
+    oldkey_len = strlen(oldkey);
+
+    if (tolower(*(oldkey + 1)) == 'x') {
+        oldkey_len = hex_to_binary2(oldkey + 2, oldkey_len - 2, &s);
+        if (oldkey_len < 0) {
+            FAILED((rval = SNMPERR_GENERR),
+                   "Could not resolve hex oldkey.");
+        }
+        oldkey = s;
+        binary_to_hex(oldkey, oldkey_len, &s);
+    }
+
+
+
+  test_keychange_again:
+    memset(oldkey_buf, 0, LOCAL_MAXBUF);
+    memset(newkey_buf, 0, LOCAL_MAXBUF);
+    memset(keychange_buf, 0, LOCAL_MAXBUF);
+    memset(temp_buf, 0, LOCAL_MAXBUF);
+
+    memcpy(oldkey_buf, oldkey, SNMP_MIN(oldkey_len, properlength));
+    memcpy(newkey_buf, newkey, SNMP_MIN(newkey_len, properlength));
+    keychange_len = LOCAL_MAXBUF;
+
+
+    binary_to_hex(oldkey_buf, properlength, &s);
+    fprintf(stdout, "\noldkey%s (len=%d):  %s\n",
+            (isdefault_old) ? " (default)" : "", properlength, s);
+    SNMP_FREE(s);
+
+    binary_to_hex(newkey_buf, properlength, &s);
+    fprintf(stdout, "newkey%s (len=%d):  %s\n\n",
+            (isdefault_new) ? " (default)" : "", properlength, s);
+    SNMP_FREE(s);
+
+
+    rval = encode_keychange(hashtype, USM_LENGTH_OID_TRANSFORM,
+                            oldkey_buf, properlength,
+                            newkey_buf, properlength,
+                            keychange_buf, &keychange_len);
+    FAILED(rval, "encode_keychange().");
+
+    if (keychange_len != (properlength * 2)) {
+        FAILED(SNMPERR_GENERR,
+               "KeyChange string (encoded) is not proper length "
+               "for this hash transform.");
+    }
+
+    binary_to_hex(keychange_buf, keychange_len, &s);
+    fprintf(stdout, "(%s) KeyChange string:  %s\n\n",
+            ((hashtype == usmHMACMD5AuthProtocol) ? "MD5" : "SHA"), s);
+    SNMP_FREE(s);
+
+    temp_len = properlength;
+    rval = decode_keychange(hashtype, USM_LENGTH_OID_TRANSFORM,
+                            oldkey_buf, properlength,
+                            keychange_buf, properlength * 2,
+                            temp_buf, &temp_len);
+    FAILED(rval, "decode_keychange().");
+
+    if (temp_len != properlength) {
+        FAILED(SNMPERR_GENERR,
+               "decoded newkey is not proper length for "
+               "this hash transform.");
+    }
+
+    binary_to_hex(temp_buf, temp_len, &s);
+    fprintf(stdout, "decoded newkey:  %s\n\n", s);
+    SNMP_FREE(s);
+
+
+    if (memcmp(newkey_buf, temp_buf, temp_len)) {
+        FAILED(SNMPERR_GENERR, "newkey did not decode properly.");
+    }
+
+
+    SUCCESS(hashname);
+    fprintf(stdout, "\n");
+
+
+    /*
+     * Multiplex different test combinations.
+     *
+     * First clause is for Test #2, second clause is for (last) Test #3.
+     */
+    if (hashtype == usmHMACMD5AuthProtocol) {
+        hashtype = usmHMACSHA1AuthProtocol;
+        hashname = "usmHMACSHA1AuthProtocol (w/DES length kul's).";
+        properlength = BYTESIZE(SNMP_TRANS_PRIVLEN_1DES)
+            + BYTESIZE(SNMP_TRANS_PRIVLEN_1DES_IV);
+        goto test_keychange_again;
+
+    } else if (properlength < BYTESIZE(SNMP_TRANS_AUTHLEN_HMACSHA1)) {
+        hashtype = usmHMACSHA1AuthProtocol;
+        hashname = "usmHMACSHA1AuthProtocol.";
+        properlength = BYTESIZE(SNMP_TRANS_AUTHLEN_HMACSHA1);
+        goto test_keychange_again;
+    }
+
+    return failcount;
+
+}                               /* end test_keychange() */
diff -Naur tomato/release/src/router/snmp/testing/Makefile.in tomato121/release/src/router/snmp/testing/Makefile.in
--- tomato/release/src/router/snmp/testing/Makefile.in	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/testing/Makefile.in	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,78 @@
+#
+# Makefile for testing
+#
+
+#TARG		= etest ktest misctest stest
+
+USELIBS		= ../snmplib/libsnmp.$(LIB_EXTENSION)$(LIB_VERSION)
+LIBS		= -L../snmplib $(CC_RUNTIME_ARG) -lsnmp @LIBS@
+
+PARSEOBJS	=
+
+CPPFLAGS	= -I.. -I$(srcdir)/.. -I$(srcdir)/../snmplib @CPPFLAGS@
+CC		= @CC@ $(CPPFLAGS)
+
+all: $(TARG)
+
+test:
+	$(srcdir)/RUNTESTS -a -D `pwd`/..
+
+etest:    etimetest.o $(PARSEOBJS) $(USELIBS)
+	${CC} -o $@ etimetest.o $(PARSEOBJS) ${LDFLAGS} ${LIBS} 
+
+ktest:    keymanagetest.o $(PARSEOBJS) $(USELIBS)
+	${CC} -o $@ keymanagetest.o $(PARSEOBJS) ${LDFLAGS} ${LIBS} 
+
+misctest:    misctest.o $(PARSEOBJS) $(USELIBS)
+	${CC} -o $@ misctest.o $(PARSEOBJS) ${LDFLAGS} ${LIBS} 
+
+stest:    scapitest.o $(PARSEOBJS) $(USELIBS)
+	${CC} -o $@ scapitest.o $(PARSEOBJS) ${LDFLAGS} ${LIBS} 
+
+clean: testclean
+	rm -f *.o core *.core $(TARG)
+
+testclean:
+	-rm -fr /tmp/snmp-test*
+
+install: installdirs $(TARG)
+	@for i in $(TARG) ; \
+		do $(INSTALL) $$i $(bindir) ; \
+		echo "install:  installed $$i in $(bindir)" ; \
+	done
+
+installdirs:
+	@$(SHELL) $(srcdir)/../mkinstalldirs $(snmplibdir) $(bindir)
+
+dependlocal: 
+	makedepend $(CPPFLAGS) -o.lo $(srcdir)/*.c
+
+depend: dependlocal
+
+nosysdepend: 
+	makedepend $(CPPFLAGS) -o.lo *.c
+	perl -n -i.bak $(top_srcdir)/makenosysdepend.pl Makefile
+
+makefileindepend: nosysdepend
+	perl $(top_srcdir)/makefileindepend.pl
+
+
+# DO NOT DELETE THIS LINE -- make depend depends on it.
+
+
+etimetest.lo: ../config.h ../m/generic.h ../s/generic.h ../s/linux.h
+etimetest.lo: ../snmplib/asn1.h ../snmplib/callback.h ../snmplib/lcd_time.h
+etimetest.lo: ../snmplib/snmp_api.h ../snmplib/snmp_debug.h ../snmplib/tools.h
+etimetest.lo: ../s/sysv.h  
+keymanagetest.lo: ../config.h ../m/generic.h ../s/generic.h ../s/linux.h
+keymanagetest.lo: ../snmplib/asn1.h ../snmplib/callback.h ../snmplib/keytools.h
+keymanagetest.lo: ../snmplib/scapi.h ../snmplib/snmp_api.h ../snmplib/tools.h
+keymanagetest.lo: ../snmplib/transform_oids.h ../s/sysv.h 
+misctest.lo: ../config.h ../m/generic.h ../s/generic.h ../s/linux.h
+misctest.lo: ../snmplib/asn1.h ../snmplib/callback.h ../snmplib/snmp_api.h
+misctest.lo: ../snmplib/tools.h ../snmplib/transform_oids.h ../s/sysv.h
+scapitest.lo: ../config.h ../m/generic.h ../s/generic.h ../s/linux.h
+scapitest.lo: ../snmplib/asn1.h ../snmplib/callback.h ../snmplib/keytools.h
+scapitest.lo: ../snmplib/scapi.h ../snmplib/snmp_api.h ../snmplib/tools.h
+scapitest.lo: ../snmplib/transform_oids.h ../s/sysv.h 
+T.lo: ../config.h ../m/generic.h ../s/generic.h ../s/linux.h ../s/sysv.h
diff -Naur tomato/release/src/router/snmp/testing/misctest.c tomato121/release/src/router/snmp/testing/misctest.c
--- tomato/release/src/router/snmp/testing/misctest.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/testing/misctest.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,266 @@
+/*
+ * misctest.c
+ *
+ * Expected SUCCESSes for all tests:    0
+ *
+ * Returns:
+ *      Number of FAILUREs.
+ *
+ * Test of dump_snmpEngineID().                 SUCCESSes:  0
+ */
+
+static char    *rcsid = "$Id: misctest.c,v 1.1.2.1 2004/06/20 21:55:08 nikki Exp $";     /* */
+
+#include <net-snmp/net-snmp-config.h>
+
+#include <stdio.h>
+#ifdef HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+
+#include "asn1.h"
+#include "snmp_api.h"
+#include "tools.h"
+#include "transform_oids.h"
+#include "callback.h"
+
+#include <stdlib.h>
+
+extern char    *optarg;
+extern int      optind, optopt, opterr;
+
+
+
+/*
+ * Globals, &c...
+ */
+char           *local_progname;
+
+#define USAGE	"Usage: %s [-h][-1a]"
+#define OPTIONLIST	"1ah"
+
+int             doalltests = 0, dodumpseid = 0;
+
+#define	ALLOPTIONS	(doalltests + dodumpseid)
+
+
+
+#define LOCAL_MAXBUF	(1024 * 8)
+#define NL		"\n"
+
+#define OUTPUT(o)	fprintf(stdout, "\n\n%s\n\n", o);
+
+#define SUCCESS(s)					\
+{							\
+	if (!failcount)					\
+		fprintf(stdout, "\nSUCCESS: %s\n", s);	\
+}
+
+#define FAILED(e, f)					\
+{							\
+	if (e != SNMPERR_SUCCESS) {			\
+		fprintf(stdout, "\nFAILED: %s\n", f);	\
+		failcount += 1;				\
+	}						\
+}
+
+
+
+
+#define IDBLAT_4	"00010203"
+
+#define IDVIOLATE1	"8000000300deedcafe"
+
+#define IDIPv4		"80000003010a090807"
+#define IDIPv6		"8000000302100f0e0d0c0b0a090807060504030201"
+#define IDMAC		"8000000303ffeeddccbbaa"
+
+#define IDTEXT		"8000000304"
+#define PRINTABLE	"Let this be printable."
+
+#define IDOCTETS_7	"80000003050001020304050607"
+
+#define IDLOCAL_11	"8000000306000102030405060708090a0b"
+
+#define IDIPv4_EXTRA3	"80000003010a090807010203"
+
+#define ID_NUMSTRINGS		10
+
+
+
+
+/*
+ * Prototypes.
+ */
+void            usage(FILE * ofp);
+
+int             test_dumpseid(void);
+
+
+
+
+
+int
+main(int argc, char **argv)
+{
+    int             rval = SNMPERR_SUCCESS, failcount = 0;
+    char            ch;
+
+    local_progname = argv[0];
+
+    /*
+     * Parse.
+     */
+    while ((ch = getopt(argc, argv, OPTIONLIST)) != EOF) {
+        switch (ch) {
+        case '1':
+            dodumpseid = 1;
+            break;
+        case 'a':
+            doalltests = 1;
+            break;
+        case 'h':
+            rval = 0;
+        default:
+            usage(stdout);
+            exit(rval);
+        }
+
+        argc -= 1;
+        argv += 1;
+        if (optarg) {
+            argc -= 1;
+            argv += 1;
+            optarg = NULL;
+        }
+        optind = 1;
+    }                           /* endwhile getopt */
+
+    if ((argc > 1)) {
+        usage(stdout);
+        exit(1000);
+
+    } else if (ALLOPTIONS != 1) {
+        usage(stdout);
+        exit(1000);
+    }
+
+
+    /*
+     * Test stuff.
+     */
+    if (dodumpseid || doalltests) {
+        failcount += test_dumpseid();
+    }
+
+
+    /*
+     * Cleanup.
+     */
+    return failcount;
+
+}                               /* end main() */
+
+
+
+
+
+void
+usage(FILE * ofp)
+{
+    fprintf(ofp,
+            USAGE
+            "" NL
+            "	-1		Test dump_snmpEngineID()." NL
+            "	-a		All tests." NL
+            "	-h		Help." NL "" NL, local_progname);
+
+}                               /* end usage() */
+
+
+
+
+#ifdef EXAMPLE
+/*******************************************************************-o-******
+ * test_dosomething
+ *
+ * Returns:
+ *	Number of failures.
+ *
+ *
+ * Test template.
+ */
+int
+test_dosomething(void)
+{
+    int             rval = SNMPERR_SUCCESS, failcount = 0;
+
+    EM0(1, "UNIMPLEMENTED");    /* EM(1); /* */
+
+  test_dosomething_quit:
+    return failcount;
+
+}                               /* end test_dosomething() */
+#endif                          /* EXAMPLE */
+
+
+
+
+/*******************************************************************-o-******
+ * test_dumpseid
+ *
+ * Returns:
+ *	Number of failures.
+ *
+ * Test dump_snmpEngineID().
+ */
+int
+test_dumpseid(void)
+{
+    int                         /* rval = SNMPERR_SUCCESS, */
+                    failcount = 0, tlen, count = 0;
+
+    char            buf[SNMP_MAXBUF],
+        *s, *t, *ris, *rawid_set[ID_NUMSTRINGS + 1] = {
+        IDBLAT_4,
+        IDVIOLATE1,
+        IDIPv4,
+        IDIPv6,
+        IDMAC,
+        IDTEXT,
+        IDOCTETS_7,
+        IDLOCAL_11,
+        IDIPv4_EXTRA3,
+        NULL
+    };
+
+    OUTPUT("Test of dump_snmpEngineID.  "
+           "(Does not report failure or success.)");
+
+
+    while ((ris = rawid_set[count++])) {
+        tlen = hex_to_binary2(ris, strlen(ris), &t);
+
+        if (ris == IDTEXT) {
+            memset(buf, 0, SNMP_MAXBUF);
+            memcpy(buf, t, tlen);
+            tlen += sprintf(buf + tlen, "%s", PRINTABLE);
+
+            SNMP_FREE(t);
+            t = buf;
+        }
+#ifdef SNMP_TESTING_CODE
+        s = dump_snmpEngineID(t, &tlen);
+        printf("%s    (len=%d)\n", s, tlen);
+#endif
+
+        SNMP_FREE(s);
+        if (t != buf) {
+            SNMP_FREE(t);
+        }
+    }
+
+
+    return failcount;
+
+}                               /* end test_dumpseid() */
diff -Naur tomato/release/src/router/snmp/testing/README tomato121/release/src/router/snmp/testing/README
--- tomato/release/src/router/snmp/testing/README	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/testing/README	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,92 @@
+
+README testing/
+===============
+
+All tests may be run using the following:
+
+	% eval_suite.sh -l
+
+This runs all the registered tests and reports whether they passed, or not.
+Some information is given about the nature of test failures (if they occur).
+
+
+Tests need to be written so that the string "FAILED" is associated with
+failed sections, and "SUCCESS" with proper closure of a section or
+function.  The number of SUCCESSes to check for during evaluation is
+given in the eval_testlist file.
+
+If a test has no FAILEDs and and the proper number of SUCCESSes, it is
+considered to have PASSED.  If a test has any FAILEDs or does not achieve
+the proper number of SUCCESSes, some diagnostic info it output to help
+determine what happened.
+
+The test templates for C and Bourne Shell code are T.c and T.sh.  They
+provide an example of how a test should be instrumented to fit into this
+scheme.
+
+
+See also the help output of:
+
+	% eval_suite.sh -h
+	% eval_oneprogram.sh -h
+
+For a description of the format of "eval_testlist" and what one gets by
+running with the verbose switches set.
+
+
+
+		#		#		#		#
+
+
+FILE LISTING
+============
+
+Test suite control scripts
+--------------------------
+eval_oneprogram.sh	Runs a single program taken from eval_testlist.
+
+eval_suite.sh		Runs all programs in evel_testlist and verifies
+				the number of SUCCESSes and FAILUREs
+				for each to judge the health of the test.
+
+eval_testlist		List of current tests.  ADD NEW TESTS HERE.
+
+
+
+C tests
+-------
+etimetest.c		Test of LCD EngineID and Time List.
+keymanagetest.c		Test for key management functions.
+misctest.c		Miscellaneous tests: currently, dump_snmpEngineID().
+scapitest.c		Test for SCAPI functions.
+
+
+
+Script tests
+------------
+test_keychange.sh	Test KeyChange TC against a gold standard.
+test_kul.sh		Test other key manipulation functions against
+				gold standard.
+
+
+
+Data files  ("Gold standards")
+------------------------------
+	Data files for pre-existing tests.
+	Syntax of the name is: "data.<test_sub_name>-<modifier_for_each_part>"
+
+data.keychange-md5
+data.keychange-sha1
+data.keychange-sha1-des
+data.kul-md5
+data.kul-sha1		
+
+
+
+Test templates and tools environment
+------------------------------------
+test_tools.sh		Standard environment to include in script tests.
+T.c
+T.sh			Templates for future C and sh tests.
+
+
diff -Naur tomato/release/src/router/snmp/testing/RUNTESTS tomato121/release/src/router/snmp/testing/RUNTESTS
--- tomato/release/src/router/snmp/testing/RUNTESTS	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/testing/RUNTESTS	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,333 @@
+#!/bin/sh
+#
+# RUNTESTS [-h]...
+#
+# RETURNS:	Number of failed tests.
+#
+# CALLS: eval_oneprogram.sh [-h][-lk] <program>
+#
+# SOURCES: TESTCONF.sh
+#
+#
+
+								USAGE_LONG='
+#
+# HOW TO ENTER A NEW TEST
+#
+# Copy the template file (T2.sh) XXX to the tests directory, and have
+# the file begin with a 'T'.  All files in the tests directory
+# begining with a 'T' are assumed to be a test.  See the file for
+# further instructions
+#
+# HOW TESTS ARE RUN AND EVALUATED
+#
+# ...
+# 
+'
+
+#
+# Suggested improvement(s):
+#	Run a given test against a running agent.
+#	Display errors
+#	interactively pick tests to run.
+#	options arguments to pick tests to run.
+#
+#
+# Variables:  (* = exported)
+#  *SNMP_BASEDIR:  	  the source base directory for tests
+#  *SNMP_UPDIR:  	  directory above where the test binaries live (-D option)
+#  *SNMP_PATH	## yes, PATH is already setup
+#  *SNMP_VERBOSE	## 0=silent, 1=warnings, 2=more
+
+# Usage mess.  (No, it works.)
+#
+USAGE="Usage: `basename $0` [-h] [-i] [-v] [-V] [-s] [-T TESTNUMS] [-D bindir] [-S seconds]"
+
+usage() { 
+    echo; 
+    echo $USAGE;
+    #cat <<BLIK | sed 's/^#//' | sed '1d' | $PAGER
+    #$USAGE_LONG
+    #BLIK
+    exit 0
+}
+
+trap "exit 1;" 1 2 3 9 13 15 17
+
+SNMP_BASEDIR=`dirname $0`
+
+### Check for the configuration script.
+##if [ ! -s "${SNMP_BASEDIR}/TESTCONF.sh"  ] ; then 
+##  echo "No TESTCONF.sh in \"$SNMP_BASEDIR\" ; exiting"
+##  exit 0
+##fi
+
+ORIGDIR=`pwd`		## this script may be invoked with relative path
+SNMP_UPDIR=..		## building from the source tree
+interactive=no
+SNMP_VERBOSE=0
+SNMP_SLEEP=${SNMP_SLEEP:=1}	## default seconds to sleep
+SH_DEBUG=0
+
+while [ -n "$1" ]; do
+    case "$1" in
+	-h)
+	    usage
+	    exit
+	    ;;
+
+	-i)
+	    interactive="yes"
+	    ;;
+	-v)
+	    SNMP_VERBOSE=1
+	    ;;
+	-V)
+	    SNMP_VERBOSE=2
+	    ;;
+	-s)
+	    SNMP_SAVE_TMPDIR="yes"
+	    export SNMP_SAVE_TMPDIR
+	    ;;
+	-D)
+	    shift
+	    SNMP_UPDIR="$1"
+	    ;;
+	-T)
+	    shift
+	    test_nums=`echo $1 | sed 's/,/ /g'`
+	    ;;
+	-a)
+	    test_nums="all"
+	    ;;
+
+	-A)
+	    shift
+	    AGENT_FLAGS="$1"
+	    export AGENT_FLAGS
+	    ;;
+	-S)
+	    shift
+	    SNMP_SLEEP="$1"
+	    ;;
+
+	-x)
+	    SH_DEBUG=1
+	    ;;
+
+    esac
+
+    shift
+done
+
+export SNMP_SLEEP
+
+# Find executables in source first, then build, then existing PATH.
+## Add to PATH if a binary is found.
+
+cd $SNMP_UPDIR
+SNMP_UPDIR=`pwd`
+bf=snmpget
+if [ -f "$bf" ] ; then
+   PATH=$SNMP_UPDIR:$PATH
+else
+   bf=apps/snmpget
+   if [ -f "$bf" ] ; then
+      PATH=$SNMP_UPDIR/apps:$PATH
+   fi
+fi
+bf=agent/snmpd
+if [ -f "$bf" ] ; then
+   PATH=$SNMP_UPDIR/agent:$PATH
+fi
+
+bf=include/net-snmp/net-snmp-config.h
+if [ ! -s "$bf" ] ; then
+   echo "No \"$bf\" in $SNMP_UPDIR . Some tests will be skipped"
+fi
+unset bf
+
+# Run from the test scripts directory.
+cd $ORIGDIR ; cd ${SNMP_BASEDIR}
+SNMP_BASEDIR=`pwd`
+
+# Setup for the next test run.
+rm -f core tests/core
+
+PATH=${SNMP_BASEDIR}:$PATH
+SNMP_PATH=yes
+
+export PATH
+export SNMP_BASEDIR
+export SNMP_PATH
+export SNMP_UPDIR
+export SNMP_VERBOSE
+
+WHICH=which
+$WHICH $0 > /dev/null 2>&1
+if [ $? -ne 0 ] ; then
+    WHICH=type
+fi
+
+for needed in snmpd snmpget snmpgetnext; do
+    $WHICH $needed > /dev/null 2>&1
+    if [ $? -ne 0  ] ; then 
+        echo "No $needed found. Exiting"
+        exit 1
+    fi
+done
+
+#
+# Distinguished expectations.
+#
+if [ $SNMP_VERBOSE -gt 0 ]; then
+    echo ${SNMP_UPDIR}/testing
+    echo path is $PATH
+    echo top of build is $SNMP_UPDIR
+    echo source testing is $SNMP_BASEDIR
+    $WHICH snmpusm
+fi
+
+#
+# Source the testing configuration file
+#
+
+. TESTCONF.sh
+
+# Hack: the above created a directory, now we have to nuke it and
+# forget about it...  All for the convenience of the test writer.
+rmdir $SNMP_TMPDIR
+unset SNMP_TMPDIR
+export SNMP_TMPDIR
+
+#
+# Switch to the testing directory, for ease of the client test packages.
+#
+cd ./tests
+
+#------------------------------------ -o- 
+# Globals.
+#
+PROGRAM=
+ARGUMENTS="$*"
+
+TMPFILE=$SNMP_TMPDIR/eval_suite.sh$$
+
+testname=
+
+success_count=0
+failed_count=0
+
+if [ "x$do_tests" = "x" ]; then
+    #
+    # List the tests in question
+    #
+    num=0
+    for testfile in T*; do
+	case $testfile in
+	    # Skip backup files, and the like.
+	    *~)     ;;
+	    *.bak)  ;;
+	    *.orig) ;;
+	    *.rej)  ;;
+
+	    # Do the rest
+	    *)
+		num=`expr $num + 1`
+		if [ "x$interactive" != "xyes" -a "x$test_nums" = "x" ]; then
+		    eval_onescript.sh $testfile $num "yes"
+		fi
+		all_tests="$all_tests $num"
+		all_files="$all_files $testfile"
+		;;
+	esac
+    done
+
+    #
+    # TODO: allow user to interactively pick the list of tests to run.
+    #
+
+    if [ "x$interactive" != "xyes" ]; then
+	if [ "x$test_nums" = "x" ]; then
+	    ECHO "Enter test numbers [all]: "
+	    read inp
+	else
+	    if [ "x$test_nums" = "xall" ]; then
+		inp=""
+	    else
+		inp="$test_nums"
+	    fi
+	fi
+	if [ "x$inp" = "x" ]; then
+	    do_tests="$all_files"
+	else
+	    a=1
+	    set $all_files
+	    while [ $a -le $num ]; do
+		if echo " $inp " | grep " $a " > /dev/null; then
+		    do_tests="$do_tests $1"
+		    if [ "x$test_nums" = "x" ] ; then
+			test_nums=$a
+		    fi
+		fi
+		shift
+		a=`expr $a + 1`
+	    done
+	fi
+    fi
+
+    #echo Starting: Running tests $do_tests
+fi
+
+#
+# Run the tests
+#
+if [ "x$test_nums" = "xall" -o "x$test_nums" = "x" ] ; then
+    num=1
+else
+    num="$test_nums"
+fi
+cntr=0
+for testfile in $do_tests; do
+    dothisone="yes"
+    id_x=0
+    for itest in $inp; do
+        if [ "$cntr" = "$id_x" ] ; then
+            num="$itest"
+        fi
+    id_x=`expr $id_x + 1`
+    done
+    if [ "x$interactive" = "xyes" ]; then
+
+        if [ $SH_DEBUG = 1 ] ; then
+	    sh -x eval_onescript.sh $testfile $num "yes"
+	else
+	    eval_onescript.sh $testfile $num "yes"
+	fi
+
+	ECHO "  Run test #$num (y/n) [y]? "
+	read inp2
+	if [ "x$inp2" = "xn" ]; then
+	    dothisone=no
+	fi
+    fi
+  
+    if [ "x$dothisone" = "xyes" ]; then
+        if [ $SH_DEBUG = 1 ] ; then
+	    sh -x eval_onescript.sh $testfile $num "no"
+	else
+	    eval_onescript.sh $testfile $num "no"
+	fi
+	if [ $? = 0 ]; then
+	    success_count=`expr $success_count + 1`
+	else
+	    failed_count=`expr $failed_count + 1`
+	fi
+    fi
+    num=`expr $num + 1`
+    cntr=`expr $cntr + 1`
+done
+
+echo Summary: $success_count / `expr $failed_count + $success_count` succeeded.
+
+exit $failed_count
diff -Naur tomato/release/src/router/snmp/testing/scapitest.c tomato121/release/src/router/snmp/testing/scapitest.c
--- tomato/release/src/router/snmp/testing/scapitest.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/testing/scapitest.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,489 @@
+/*
+ * scapitest.c
+ *
+ * Expected SUCCESSes:  2 + 10 + 1 for all tests.
+ *
+ * Returns:
+ *      Number of FAILUREs.
+ *
+ *
+ * ASSUMES  No key management functions return non-zero success codes.
+ *
+ * XXX  Split into individual modules?
+ * XXX  Error/fringe conditions should be tested.
+ *
+ *
+ * Test of sc_random.                                           SUCCESSes: 2.
+ *      REQUIRES a human to spot check for obvious non-randomness...
+ *
+ * Test of sc_generate_keyed_hash and sc_check_keyed_hash.      SUCCESSes: 10.
+ *
+ * Test of sc_encrypt and sc_decrypt.                           SUCCESSes: 1.
+ */
+
+static char    *rcsid = "$Id: scapitest.c,v 1.1.2.1 2004/06/20 21:55:08 nikki Exp $";    /* */
+
+
+#include <net-snmp/net-snmp-config.h>
+
+#include <stdio.h>
+#ifdef HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+
+#include "asn1.h"
+#include "snmp_api.h"
+#include "keytools.h"
+#include "tools.h"
+#include "scapi.h"
+#include "transform_oids.h"
+#include "callback.h"
+
+#include <stdlib.h>
+
+extern char    *optarg;
+extern int      optind, optopt, opterr;
+
+#define DEBUG                   /* */
+
+
+
+/*
+ * Globals, &c...
+ */
+char           *local_progname;
+
+#define USAGE	"Usage: %s [-h][-acHr]"
+#define OPTIONLIST	"achHr"
+
+int             doalltests = 0, docrypt = 0, dokeyedhash = 0, dorandom = 0;
+
+#define	ALLOPTIONS	(doalltests + docrypt + dokeyedhash + dorandom)
+
+
+
+#define LOCAL_MAXBUF	(1024 * 8)
+#define NL		"\n"
+
+#define OUTPUT(o)	fprintf(stdout, "\n\n%s\n\n", o);
+
+#define SUCCESS(s)					\
+{							\
+	if (!failcount)					\
+		fprintf(stdout, "\nSUCCESS: %s\n", s);	\
+}
+
+#define FAILED(e, f)					\
+{							\
+	if (e != SNMPERR_SUCCESS) {			\
+		fprintf(stdout, "\nFAILED: %s\n", f);	\
+		failcount += 1;				\
+	}						\
+}
+
+
+#define BIGSTRING							\
+    "   A port may be a pleasant retreat for any mind grown weary of"	\
+    "the struggle for existence.  The vast expanse of sky, the"		\
+    "mobile architecture of the clouds, the chameleon coloration"	\
+    "of the sea, the beacons flashing on the shore, together make"	\
+    "a prism which is marvellously calculated to entertain but not"	\
+    "fatigue the eye.  The lofty ships with their complex webs of"	\
+    "rigging, swayed to and fro by the swell in harmonious dance,"	\
+    "all help to maintain a taste for rhythm and beauty in the"		\
+    "mind.  And above all there is a mysterious, aristrocratic kind"	\
+    "of pleasure to be had, for those who have lost all curiosity"	\
+    "or ambition, as they strech on the belvedere or lean over the"	\
+    "mole to watch the arrivals and departures of other men, those"	\
+    "who still have sufficient strength of purpose in them, the"	\
+    "urge to travel or enrich themselves."				\
+    "	-- Baudelaire"							\
+    "	   From _The_Poems_in_Prose_, \"The Port\" (XLI)."
+
+#define BIGSECRET	"Shhhh... Don't tell *anyone* about this.  Not a soul."
+#define BKWDSECRET	".luos a toN  .siht tuoba *enoyna* llet t'noD ...hhhhS"
+
+#define MLCOUNT_MAX	6       /* MAC Length Count Maximum. */
+
+
+
+/*
+ * Prototypes.
+ */
+void            usage(FILE * ofp);
+
+int             test_docrypt(void);
+int             test_dokeyedhash(void);
+int             test_dorandom(void);
+
+
+
+
+int
+main(int argc, char **argv)
+{
+    int             rval = SNMPERR_SUCCESS, failcount = 0;
+    char            ch;
+
+    local_progname = argv[0];
+
+    /*
+     * Parse.
+     */
+    while ((ch = getopt(argc, argv, OPTIONLIST)) != EOF) {
+        switch (ch) {
+        case 'a':
+            doalltests = 1;
+            break;
+        case 'c':
+            docrypt = 1;
+            break;
+        case 'H':
+            dokeyedhash = 1;
+            break;
+        case 'r':
+            dorandom = 1;
+            break;
+        case 'h':
+            rval = 0;
+        default:
+            usage(stdout);
+            exit(rval);
+        }
+
+        argc -= 1;
+        argv += 1;
+        optind = 1;
+    }                           /* endwhile getopt */
+
+    if ((argc > 1)) {
+        usage(stdout);
+        exit(1000);
+
+    } else if (ALLOPTIONS != 1) {
+        usage(stdout);
+        exit(1000);
+    }
+
+
+    /*
+     * Test stuff.
+     */
+    rval = sc_init();
+    FAILED(rval, "sc_init().");
+
+
+    if (docrypt || doalltests) {
+        failcount += test_docrypt();
+    }
+    if (dokeyedhash || doalltests) {
+        failcount += test_dokeyedhash();
+    }
+    if (dorandom || doalltests) {
+        failcount += test_dorandom();
+    }
+
+
+    /*
+     * Cleanup.
+     */
+    rval = sc_shutdown(SNMP_CALLBACK_LIBRARY, SNMP_CALLBACK_SHUTDOWN,
+                       NULL, NULL);
+    FAILED(rval, "sc_shutdown().");
+
+    return failcount;
+
+}                               /* end main() */
+
+
+
+
+
+void
+usage(FILE * ofp)
+{
+    fprintf(ofp,
+            USAGE
+            "" NL
+            "	-a		All tests." NL
+            "	-c		Test of sc_encrypt()/sc_decrypt()."
+            NL
+            "	-h		Help."
+            NL
+            "	-H              Test sc_{generate,check}_keyed_hash()."
+            NL
+            "	-r              Test sc_random()."
+            NL "" NL, local_progname);
+
+}                               /* end usage() */
+
+
+
+
+#ifdef EXAMPLE
+/*******************************************************************-o-******
+ * test_dosomething
+ *
+ * Test template.
+ *
+ * Returns:
+ *	Number of failures.
+ */
+int
+test_dosomething(void)
+{
+    int             rval = SNMPERR_SUCCESS, failcount = 0;
+
+    EM0(1, "UNIMPLEMENTED");    /* EM(1); /* */
+
+  test_dosomething_quit:
+    return failcount;
+
+}                               /* end test_dosomething() */
+#endif                          /* EXAMPLE */
+
+
+
+
+
+/*******************************************************************-o-******
+ * test_dorandom
+ *
+ * One large request, one set of short requests.
+ *
+ * Returns:
+ *	Number of failures.
+ *
+ * XXX	probably should split up into individual options.
+ */
+int
+test_dorandom(void)
+{
+    int             rval = SNMPERR_SUCCESS,
+        failcount = 0,
+        origrequest = (1024 * 2),
+        origrequest_short = 19, nbytes = origrequest, shortcount = 7, i;
+    char            buf[LOCAL_MAXBUF];
+
+    OUTPUT("Random test -- large request:");
+
+    rval = sc_random(buf, &nbytes);
+    FAILED(rval, "sc_random().");
+
+    if (nbytes != origrequest) {
+        FAILED(SNMPERR_GENERR,
+               "sc_random() returned different than requested.");
+    }
+
+    dump_chunk("scapitest", NULL, buf, nbytes);
+
+    SUCCESS("Random test -- large request.");
+
+
+    OUTPUT("Random test -- short requests:");
+    origrequest_short = 16;
+
+    for (i = 0; i < shortcount; i++) {
+        nbytes = origrequest_short;
+        rval = sc_random(buf, &nbytes);
+        FAILED(rval, "sc_random().");
+
+        if (nbytes != origrequest_short) {
+            FAILED(SNMPERR_GENERR,
+                   "sc_random() returned different " "than requested.");
+        }
+
+        dump_chunk("scapitest", NULL, buf, nbytes);
+    }                           /* endfor */
+
+    SUCCESS("Random test -- short requests.");
+
+
+    return failcount;
+
+}                               /* end test_dorandom() */
+
+
+
+/*******************************************************************-o-******
+ * test_dokeyedhash
+ *
+ * Returns:
+ *	Number of failures.
+ *
+ *
+ * Test keyed hashes with a variety of MAC length requests.
+ *
+ *
+ * NOTE Both tests intentionally use the same secret
+ *
+ * FIX	Get input or output from some other package which hashes...
+ * XXX	Could cut this in half with a little indirection...
+ */
+int
+test_dokeyedhash(void)
+{
+    int             rval = SNMPERR_SUCCESS, failcount = 0, bigstring_len = strlen(BIGSTRING), secret_len = strlen(BIGSECRET), properlength, mlcount = 0,        /* MAC Length count.   */
+                    hblen;      /* Hash Buffer length. */
+
+    u_int           hashbuf_len[MLCOUNT_MAX] = {
+        LOCAL_MAXBUF,
+        BYTESIZE(SNMP_TRANS_AUTHLEN_HMACSHA1),
+        BYTESIZE(SNMP_TRANS_AUTHLEN_HMACMD5),
+        BYTESIZE(SNMP_TRANS_AUTHLEN_HMAC96),
+        7,
+        0,
+    };
+
+    u_char          hashbuf[LOCAL_MAXBUF];
+    char           *s;
+
+  test_dokeyedhash_again:
+
+    OUTPUT("Keyed hash test using MD5 --");
+
+    memset(hashbuf, 0, LOCAL_MAXBUF);
+    hblen = hashbuf_len[mlcount];
+    properlength = BYTESIZE(SNMP_TRANS_AUTHLEN_HMACMD5);
+
+    rval =
+        sc_generate_keyed_hash(usmHMACMD5AuthProtocol,
+                               USM_LENGTH_OID_TRANSFORM, BIGSECRET,
+                               secret_len, BIGSTRING, bigstring_len,
+                               hashbuf, &hblen);
+    FAILED(rval, "sc_generate_keyed_hash().");
+
+    if (hashbuf_len[mlcount] > properlength) {
+        if (hblen != properlength) {
+            FAILED(SNMPERR_GENERR, "Wrong MD5 hash length returned.  (1)");
+        }
+
+    } else if (hblen != hashbuf_len[mlcount]) {
+        FAILED(SNMPERR_GENERR, "Wrong MD5 hash length returned.  (2)");
+    }
+
+    rval =
+        sc_check_keyed_hash(usmHMACMD5AuthProtocol,
+                            USM_LENGTH_OID_TRANSFORM, BIGSECRET,
+                            secret_len, BIGSTRING, bigstring_len, hashbuf,
+                            hblen);
+    FAILED(rval, "sc_check_keyed_hash().");
+
+    binary_to_hex(hashbuf, hblen, &s);
+    fprintf(stdout, "hash buffer (len=%d, request=%d):   %s\n",
+            hblen, hashbuf_len[mlcount], s);
+    SNMP_FREE(s);
+
+    SUCCESS("Keyed hash test using MD5.");
+
+
+
+    OUTPUT("Keyed hash test using SHA1 --");
+
+    memset(hashbuf, 0, LOCAL_MAXBUF);
+    hblen = hashbuf_len[mlcount];
+    properlength = BYTESIZE(SNMP_TRANS_AUTHLEN_HMACSHA1);
+
+    rval =
+        sc_generate_keyed_hash(usmHMACSHA1AuthProtocol,
+                               USM_LENGTH_OID_TRANSFORM, BIGSECRET,
+                               secret_len, BIGSTRING, bigstring_len,
+                               hashbuf, &hblen);
+    FAILED(rval, "sc_generate_keyed_hash().");
+
+    if (hashbuf_len[mlcount] > properlength) {
+        if (hblen != properlength) {
+            FAILED(SNMPERR_GENERR,
+                   "Wrong SHA1 hash length returned.  (1)");
+        }
+
+    } else if (hblen != hashbuf_len[mlcount]) {
+        FAILED(SNMPERR_GENERR, "Wrong SHA1 hash length returned.  (2)");
+    }
+
+    rval =
+        sc_check_keyed_hash(usmHMACSHA1AuthProtocol,
+                            USM_LENGTH_OID_TRANSFORM, BIGSECRET,
+                            secret_len, BIGSTRING, bigstring_len, hashbuf,
+                            hblen);
+    FAILED(rval, "sc_check_keyed_hash().");
+
+    binary_to_hex(hashbuf, hblen, &s);
+    fprintf(stdout, "hash buffer (len=%d, request=%d):   %s\n",
+            hblen, hashbuf_len[mlcount], s);
+    SNMP_FREE(s);
+
+    SUCCESS("Keyed hash test using SHA1.");
+
+
+
+    /*
+     * Run the basic hash tests but vary the size MAC requests.
+     */
+    if (hashbuf_len[++mlcount] != 0) {
+        goto test_dokeyedhash_again;
+    }
+
+
+    return failcount;
+
+}                               /* end test_dokeyedhash() */
+
+
+
+
+
+/*******************************************************************-o-******
+ * test_docrypt
+ *
+ * Returns:
+ *	Number of failures.
+ */
+int
+test_docrypt(void)
+{
+    int             rval = SNMPERR_SUCCESS,
+        failcount = 0,
+        bigstring_len = strlen(BIGSTRING),
+        secret_len = BYTESIZE(SNMP_TRANS_PRIVLEN_1DES),
+        iv_len = BYTESIZE(SNMP_TRANS_PRIVLEN_1DES_IV);
+
+    u_int           buf_len = LOCAL_MAXBUF, cryptbuf_len = LOCAL_MAXBUF;
+
+    char            buf[LOCAL_MAXBUF],
+        cryptbuf[LOCAL_MAXBUF], secret[LOCAL_MAXBUF], iv[LOCAL_MAXBUF];
+
+    OUTPUT("Test 1DES-CBC --");
+
+
+    memset(buf, 0, LOCAL_MAXBUF);
+
+    memcpy(secret, BIGSECRET, secret_len);
+    memcpy(iv, BKWDSECRET, iv_len);
+
+
+    rval = sc_encrypt(usmDESPrivProtocol, USM_LENGTH_OID_TRANSFORM,
+                      secret, secret_len,
+                      iv, iv_len,
+                      BIGSTRING, bigstring_len, cryptbuf, &cryptbuf_len);
+    FAILED(rval, "sc_encrypt().");
+
+    rval = sc_decrypt(usmDESPrivProtocol, USM_LENGTH_OID_TRANSFORM,
+                      secret, secret_len,
+                      iv, iv_len, cryptbuf, cryptbuf_len, buf, &buf_len);
+    FAILED(rval, "sc_decrypt().");
+
+    if (buf_len != bigstring_len) {
+        FAILED(SNMPERR_GENERR, "Decrypted buffer is the wrong length.");
+    }
+    if (memcmp(buf, BIGSTRING, bigstring_len)) {
+        FAILED(SNMPERR_GENERR,
+               "Decrypted buffer is not equal to original plaintext.");
+    }
+
+
+    SUCCESS("Test 1DES-CBC --");
+
+    return failcount;
+
+}                               /* end test_docrypt() */
diff -Naur tomato/release/src/router/snmp/testing/T2.sh tomato121/release/src/router/snmp/testing/T2.sh
--- tomato/release/src/router/snmp/testing/T2.sh	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/testing/T2.sh	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,32 @@
+#!/bin/sh
+#
+# T.sh
+#
+# FIX  Short description.
+#
+
+. eval_tools.sh
+
+HEADER a short description of your test
+
+#------------------------------------ -o- 
+# Test.
+#
+
+# Start the agent if needed (make sure it stop it below)
+STARTAGENT
+
+CAPTURE "<executable_with_arguments:_stores_stdout/stderr_for_use_later>"
+
+CHECKEXACT "<string_to_look_for_an_exact_match_of_in_the_CAPTUREd_file_output>"
+[ $? -eq 1 ]
+FAILED $? "<diagnostic_label>"
+
+#------------------------------------ -o- 
+# Cleanup, exit.
+#
+
+# Stop the agent if necessary
+STOPAGENT
+
+FINISHED
diff -Naur tomato/release/src/router/snmp/testing/T.c tomato121/release/src/router/snmp/testing/T.c
--- tomato/release/src/router/snmp/testing/T.c	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/testing/T.c	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,182 @@
+/*
+ * T.c
+ *
+ * Expected SUCCESSes for all tests:    FIX [+ FIX ...]
+ *                                      (List number of lines containing the
+ *                                       string "SUCCESS" that are expected
+ *                                       to be printed to stdout.)
+ *
+ * Returns:
+ *      Number of FAILUREs.
+ *
+ * FIX  Short test description/table of contents.       SUCCESSes: FIX
+ */
+
+#include <net-snmp/net-snmp-config.h>
+
+#include <sys/types.h>
+#include <stdio.h>
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+
+/*
+ * #include ... 
+ */
+
+extern char    *optarg;
+extern int      optind, optopt, opterr;
+
+
+
+/*
+ * Globals, &c...
+ */
+char           *local_progname;
+
+#define USAGE	"Usage: %s [-h][-aS]"
+#define OPTIONLIST	"ahS"
+
+int             doalltests = 0, dosomething = 0;
+
+#define	ALLOPTIONS	(doalltests + dosomething)
+
+
+
+#define LOCAL_MAXBUF	(1024 * 8)
+#define NL		"\n"
+
+#define OUTPUT(o)	fprintf(stdout, "\n\n%s\n\n", o);
+
+#define SUCCESS(s)					\
+{							\
+	if (!failcount)					\
+		fprintf(stdout, "\nSUCCESS: %s\n", s);	\
+}
+
+#define FAILED(e, f)					\
+{							\
+	if (e != SNMPERR_SUCCESS) {			\
+		fprintf(stdout, "\nFAILED: %s\n", f);	\
+		failcount += 1;				\
+	}						\
+}
+
+
+
+
+
+/*
+ * Prototypes.
+ */
+void            usage(FILE * ofp);
+
+int             test_dosomething(void);
+
+
+
+
+int
+main(int argc, char **argv)
+{
+    int             rval = SNMPERR_SUCCESS, failcount = 0;
+    char            ch;
+
+    local_progname = argv[0];
+
+    EM(-1);                     /* */
+
+    /*
+     * Parse.
+     */
+    while ((ch = getopt(argc, argv, OPTIONLIST)) != EOF) {
+        switch (ch) {
+        case 'a':
+            doalltests = 1;
+            break;
+        case 'S':
+            dosomething = 1;
+            break;
+        case 'h':
+            rval = 0;
+        default:
+            usage(stdout);
+            exit(rval);
+        }
+
+        argc -= 1;
+        argv += 1;
+        if (optarg) {
+            argc -= 1;
+            argv += 1;
+            optarg = NULL;
+        }
+        optind = 1;
+    }                           /* endwhile getopt */
+
+    if ((argc > 1)) {
+        usage(stdout);
+        exit(1000);
+
+    } else if (ALLOPTIONS != 1) {
+        usage(stdout);
+        exit(1000);
+    }
+
+
+    /*
+     * Test stuff.
+     */
+    if (dosomething || doalltests) {
+        failcount += test_dosomething();
+    }
+
+
+    /*
+     * Cleanup.
+     */
+    return failcount;
+
+}                               /* end main() */
+
+
+
+
+
+void
+usage(FILE * ofp)
+{
+    fprintf(ofp,
+            USAGE
+            "" NL
+            "	-a		All tests." NL
+            "	-S		Test something." NL
+            "	-h		Help." NL "" NL, local_progname);
+
+}                               /* end usage() */
+
+
+
+
+#ifdef EXAMPLE
+#endif                          /* EXAMPLE */
+/*******************************************************************-o-******
+ * test_dosomething
+ *
+ * Returns:
+ *	Number of failures.
+ *
+ *
+ * Test template.
+ */
+int
+test_dosomething(void)
+{
+    int             rval = SNMPERR_SUCCESS, failcount = 0;
+
+    EM0(1, "UNIMPLEMENTED");    /* EM(1); /* */
+
+  test_dosomething_quit:
+    return failcount;
+
+}                               /* end test_dosomething() */
diff -Naur tomato/release/src/router/snmp/testing/TESTCONF.sh tomato121/release/src/router/snmp/testing/TESTCONF.sh
--- tomato/release/src/router/snmp/testing/TESTCONF.sh	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/testing/TESTCONF.sh	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,134 @@
+#! /bin/sh -f
+
+#
+# Variables:  (* = exported)
+#  *SNMP_TMPDIR:  	  place to put files used in testing.
+#   SNMP_TESTDIR: 	  where the test scripts are kept.
+#  *SNMP_PERSISTENT_FILE: where to store the agent's persistent information
+#                         (XXX: this should be specific to just the agent)
+
+#
+# Only allow ourselves to be eval'ed once
+#
+if [ "x$TESTCONF_SH_EVALED" != "xyes" ]; then
+    TESTCONF_SH_EVALED=yes
+
+#
+# Set up an NL suppressing echo command
+#
+case "`echo 'x\c'`" in
+  'x\c')
+    ECHO() { echo -n $*; }
+    ;;
+  x)
+    ECHO() { echo $*\\c; }
+    ;;
+  *)
+    echo "I don't understand your echo command ..."
+    exit 1
+    ;;
+esac
+#
+# how verbose should we be (0 or 1)
+#
+if [ "x$SNMP_VERBOSE" = "x" ]; then
+    SNMP_VERBOSE=0
+    export SNMP_VERBOSE
+fi
+
+if [ "x$MIBDIRS" = "x" ]; then
+    MIBDIRS=${SNMP_BASEDIR}/../mibs
+    export MIBDIRS
+fi
+
+# Set up the path to the programs we want to use.
+if [ "x$SNMP_PATH" = "x" ]; then
+    PATH=../agent:../apps:../../agent:../../apps:$PATH
+    export PATH
+    SNMP_PATH=yes
+    export SNMP_PATH
+fi
+    
+
+# Set up temporary directory
+if [ "x$SNMP_TMPDIR" = "x" -a "x$SNMP_HEADERONLY" != "xyes" ]; then
+    if [ "x$testnum" = "x" ] ; then
+        testnum=1
+    fi
+    SNMP_TMPDIR="/tmp/snmp-test-$testnum-$$"
+    export SNMP_TMPDIR
+    if [ -d $SNMP_TMPDIR ]; then
+	echo "$0: ERROR: $SNMP_TMPDIR already existed."
+	exit 1;
+    fi
+    mkdir $SNMP_TMPDIR
+fi
+
+if [ "x$SNMP_SAVE_TMPDIR" = "x" ]; then
+    SNMP_SAVE_TMPDIR="no"
+    export SNMP_SAVE_TMPDIR
+fi
+
+SNMP_TESTDIR="$SNMP_BASEDIR/tests"
+SNMP_CONFIG_FILE="$SNMP_TMPDIR/snmpd.conf"
+SNMPTRAPD_CONFIG_FILE="$SNMP_TMPDIR/snmptrapd.conf"
+SNMP_SNMPTRAPD_LOG_FILE="$SNMP_TMPDIR/snmptrapd.log"
+SNMP_SNMPTRAPD_PID_FILE="$SNMP_TMPDIR/snmptrapd.pid"
+SNMP_SNMPD_PID_FILE="$SNMP_TMPDIR/snmpd.pid"
+SNMP_SNMPD_LOG_FILE="$SNMP_TMPDIR/snmpd.log"
+SNMP_PERSISTENT_FILE="$SNMP_TMPDIR/persistent-store.conf"
+export SNMP_PERSISTENT_FILE
+
+## Setup default flags and ports iff not done
+if [ "x$SNMP_FLAGS" = "x" ]; then
+    SNMP_FLAGS="-d"
+fi
+
+BASE_PORT=8765
+MAX_RETRIES=3
+if test -x /bin/netstat ; then
+    NETSTAT=/bin/netstat
+elif test -x /usr/bin/netstat ; then
+    NETSTAT=/usr/bin/netstat
+else
+    NETSTAT=""
+fi
+if test -x $NETSTAT ; then
+    if test -z "$RANDOM"; then
+        RANDOM=2
+    fi
+    while :
+    do
+        IN_USE=`$NETSTAT -a 2>/dev/null | grep "[\.:]$BASE_PORT "`
+        if [ $? -eq 0 ]; then
+            #echo "Port $BASE_PORT in use:"
+            #echo "->$IN_USE"
+            BASE_PORT=`expr $BASE_PORT + \( $RANDOM % 100 \)`
+        else
+            #echo "Using port $BASE_PORT"
+            break
+        fi
+        MAX_RETRIES=`expr $MAX_RETRIES - 1`
+        if [ $MAX_RETRIES -eq 0 ]; then
+            echo "ERROR: Could not find available port."
+            exit 255
+        fi
+    done
+fi
+
+if [ "x$SNMP_SNMPD_PORT" = "x" ]; then
+    SNMP_SNMPD_PORT=$BASE_PORT
+fi
+
+if [ "x$SNMP_SNMPTRAPD_PORT" = "x" ]; then
+    SNMP_SNMPTRAPD_PORT=`expr $BASE_PORT - 1`
+fi
+export SNMP_FLAGS SNMP_SNMPD_PORT SNMP_SNMPTRAPD_PORT
+
+# Make sure the agent doesn't parse any config file but what we give it.  
+# this is mainly to protect against a broken agent that doesn't
+# properly handle combinations of -c and -C.  (since I've broke it before).
+SNMPCONFPATH="$SNMP_TMPDIR/does-not-exist"
+export SNMPCONFPATH
+
+fi # Only allow ourselves to be eval'ed once
diff -Naur tomato/release/src/router/snmp/testing/test_keychange.sh tomato121/release/src/router/snmp/testing/test_keychange.sh
--- tomato/release/src/router/snmp/testing/test_keychange.sh	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/testing/test_keychange.sh	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,71 @@
+#!/bin/sh
+#
+# test_keychange.sh
+#
+# Number of SUCCESSes:  3
+#
+#
+# Run test of KeyChange TC against data given by Bert Wijnen in email.
+#
+# NOTE	The snmp_debug flag bit DEBUG_RANDOMZEROS in file snmplib/debug.h
+#	MUST be set before compiling and linking libsnmp.a to testing/ktest
+#	for this to succeed.
+#
+
+
+. eval_tools.sh
+
+VERIFY ktest
+
+STARTTEST
+
+
+#------------------------------------ -o- 
+# Declarations.
+#
+DATAFILE_PREFIX=data.keychange-
+DATAFILE_SUFFIXES="md5 sha1 sha1-des"
+
+oldkul=
+newkul=
+keychangestring=
+
+
+
+#------------------------------------ -o- 
+# Test.
+#
+for dfs in $DATAFILE_SUFFIXES; do
+	OUTPUT "== Test of KeyChange TC correctness for \"$dfs\"."
+
+	set x `awk '{ print $1 }' ${DATAFILE_PREFIX}$dfs`
+	shift
+
+	[ $# -lt 3 ] && FAILED 1 \
+	    "Wrong number of lines ($#) in datafile \"$DATAFILE_PREFIX}$dfs\"."
+
+	oldkey=$1
+	newkey=$2
+	keychangestring=$3
+
+	CAPTURE "ktest -k -O $oldkey -N $newkey"
+	FAILED $? "ktest"
+
+	CHECKEXACT $keychangestring
+	[ $? -eq 1 ]
+	FAILED $? "Proper KeyChange string was not generated."
+
+
+	SUCCESS "KeyChange TC correctness test for \"$dfs\"."
+done
+
+
+
+
+#------------------------------------ -o- 
+# Cleanup, exit.
+#
+STOPTEST
+
+exit $failcount
+
diff -Naur tomato/release/src/router/snmp/testing/test_kul.sh tomato121/release/src/router/snmp/testing/test_kul.sh
--- tomato/release/src/router/snmp/testing/test_kul.sh	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/testing/test_kul.sh	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,78 @@
+#!/bin/sh
+#
+# test_kul.sh
+#
+# Number of SUCCESSes:	2
+#
+# Run key localization tests and compare with data given in the USM
+# documentation.
+#
+# FIX	CHECKEXACT() will produce 2 lines when SCAPI is built with
+#	SNMP_TESTING_CODE, but only 1 line without the #define.  The script
+#	assumes SNMP_TESTING_CODE is defined.
+#
+#
+
+
+. eval_tools.sh
+
+VERIFY ktest
+
+STARTTEST
+
+
+#------------------------------------ -o- 
+# Declarations.
+#
+DATAFILE_PREFIX=data.kul-
+DATAFILE_SUFFIXES="md5 sha1"
+
+P=
+Ku=
+engineID=
+kul=
+
+
+
+#------------------------------------ -o- 
+# Test.
+#
+for dfs in $DATAFILE_SUFFIXES; do
+	OUTPUT "== Test of key localization correctness with transform \"$dfs\"."
+
+	set x `awk '{ print $1 }' ${DATAFILE_PREFIX}$dfs`
+	shift
+
+	[ $# -lt 4 ] && FAILED 1 \
+	    "Wrong number of lines ($#) in datafile \"$DATAFILE_PREFIX}$dfs\"."
+
+	P=$1
+	Ku=$2
+	engineID=$3
+	kul=$4
+
+	CAPTURE "ktest -l -P $P -E $engineID "
+	FAILED $? "ktest"
+
+	CHECKEXACT $Ku
+	[ $? -eq 2 ]
+	FAILED $? "Master key was not generated."
+
+	CHECKEXACT $kul
+	[ $? -eq 2 ]
+	FAILED $? "Localized key was not generated."
+
+
+	SUCCESS "Key localization correctness test with transform \"$dfs\"."
+done
+
+
+
+
+#------------------------------------ -o- 
+# Cleanup, exit.
+#
+STOPTEST
+
+exit $failcount
+
diff -Naur tomato/release/src/router/snmp/testing/tests/Sv1config tomato121/release/src/router/snmp/testing/tests/Sv1config
--- tomato/release/src/router/snmp/testing/tests/Sv1config	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/testing/tests/Sv1config	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,4 @@
+#!/bin/sh
+
+snmp_version=v1
+. ./Svanyconfig
diff -Naur tomato/release/src/router/snmp/testing/tests/Sv2cconfig tomato121/release/src/router/snmp/testing/tests/Sv2cconfig
--- tomato/release/src/router/snmp/testing/tests/Sv2cconfig	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/testing/tests/Sv2cconfig	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,4 @@
+#!/bin/sh
+
+snmp_version=v2c
+. ./Svanyconfig
diff -Naur tomato/release/src/router/snmp/testing/tests/Sv3config tomato121/release/src/router/snmp/testing/tests/Sv3config
--- tomato/release/src/router/snmp/testing/tests/Sv3config	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/testing/tests/Sv3config	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+CONFIGAGENT createUser initial MD5 initial_test_pass_auth DES
+CONFIGAGENT createUser templateMD5 MD5 templateMD5_test_pass_auth DES
+CONFIGAGENT rwuser initial
+CONFIGAGENT rwuser newtestuser
diff -Naur tomato/release/src/router/snmp/testing/tests/Sv3configsha tomato121/release/src/router/snmp/testing/tests/Sv3configsha
--- tomato/release/src/router/snmp/testing/tests/Sv3configsha	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/testing/tests/Sv3configsha	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+CONFIGAGENT createUser initial SHA initial_test_pass_auth
+CONFIGAGENT createUser templateMD5 SHA templateMD5_test_pass_auth
+CONFIGAGENT rwuser initial
+CONFIGAGENT rwuser newtestuser
diff -Naur tomato/release/src/router/snmp/testing/tests/Sv3DESconfig tomato121/release/src/router/snmp/testing/tests/Sv3DESconfig
--- tomato/release/src/router/snmp/testing/tests/Sv3DESconfig	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/testing/tests/Sv3DESconfig	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+CONFIGAGENT createUser initial MD5 initial_test_pass_auth DES initial_test_pass_priv
+CONFIGAGENT createUser templateMD5 MD5 templateMD5_test_pass_auth DES templateMD5_test_pass_priv
+CONFIGAGENT rwuser initial
+CONFIGAGENT rwuser newtestuser
diff -Naur tomato/release/src/router/snmp/testing/tests/Sv3SHADESconfig tomato121/release/src/router/snmp/testing/tests/Sv3SHADESconfig
--- tomato/release/src/router/snmp/testing/tests/Sv3SHADESconfig	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/testing/tests/Sv3SHADESconfig	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+CONFIGAGENT createUser initial SHA initial_test_pass_auth DES initial_test_pass_priv
+CONFIGAGENT createUser templateSHA SHA templateSHA_test_pass_auth DES templateSHA_test_pass_priv
+CONFIGAGENT rwuser initial
+CONFIGAGENT rwuser newtestuser
diff -Naur tomato/release/src/router/snmp/testing/tests/Svanyconfig tomato121/release/src/router/snmp/testing/tests/Svanyconfig
--- tomato/release/src/router/snmp/testing/tests/Svanyconfig	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/testing/tests/Svanyconfig	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+# generically set up the community "testcommunity" for various snmp
+# version access to the agent.
+
+if [ "x$snmp_version" = "x" ]; then
+  snmp_version="any"
+fi
+
+CONFIGAGENT com2sec testcommunitysec  default testcommunity
+CONFIGAGENT group   testcommunitygroup  $snmp_version     testcommunitysec
+CONFIGAGENT view    all     included .1 80
+CONFIGAGENT 'access  testcommunitygroup  "" any noauth exact all none none'
diff -Naur tomato/release/src/router/snmp/testing/tests/T001snmpv1get tomato121/release/src/router/snmp/testing/tests/T001snmpv1get
--- tomato/release/src/router/snmp/testing/tests/T001snmpv1get	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/testing/tests/T001snmpv1get	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,34 @@
+#!/bin/sh
+
+. ../eval_tools.sh
+
+HEADER SNMPv1 support
+
+#
+# Begin test
+#
+
+# standard V1 configuration: testcomunnity
+. ./Sv1config
+
+STARTAGENT
+
+CAPTURE "snmpget -On $SNMP_FLAGS -c testcommunity -v 1 udp:localhost:$SNMP_SNMPD_PORT .1.3.6.1.2.1.1.3.0"
+
+CHECKORDIE ".1.3.6.1.2.1.1.3.0 = Timeticks:"
+
+CAPTURE "snmpgetnext -On $SNMP_FLAGS -c testcommunity -v 1 udp:localhost:$SNMP_SNMPD_PORT .1.3.6.1.2.1.1.3"
+
+CHECKORDIE ".1.3.6.1.2.1.1.3.0 = Timeticks:"
+
+CAPTURE "snmpget -On $SNMP_FLAGS -c testcommunity -v 1 udp:localhost:$SNMP_SNMPD_PORT .1.3.6.1.2.1.1.3.1"
+
+CHECKORDIE "Error in packet"
+
+CAPTURE "snmpget -On $SNMP_FLAGS -c notavalidcommunity -v 1 udp:localhost:$SNMP_SNMPD_PORT .1.3.6.1.2.1.1.3.0"
+
+CHECKORDIE "Timeout"
+
+STOPAGENT
+
+FINISHED
diff -Naur tomato/release/src/router/snmp/testing/tests/T014snmpv2cget tomato121/release/src/router/snmp/testing/tests/T014snmpv2cget
--- tomato/release/src/router/snmp/testing/tests/T014snmpv2cget	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/testing/tests/T014snmpv2cget	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,22 @@
+#!/bin/sh
+
+. ../eval_tools.sh
+
+HEADER SNMPv2c get of system.sysUpTime.0
+
+#
+# Begin test
+#
+
+# standard V2C configuration: testcomunnity
+. ./Sv2cconfig
+
+STARTAGENT
+
+CAPTURE "snmpget -On $SNMP_FLAGS -c testcommunity -v 2c udp:localhost:$SNMP_SNMPD_PORT .1.3.6.1.2.1.1.3.0"
+
+STOPAGENT
+
+CHECK ".1.3.6.1.2.1.1.3.0 = Timeticks:"
+
+FINISHED
diff -Naur tomato/release/src/router/snmp/testing/tests/T015snmpv2cgetnext tomato121/release/src/router/snmp/testing/tests/T015snmpv2cgetnext
--- tomato/release/src/router/snmp/testing/tests/T015snmpv2cgetnext	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/testing/tests/T015snmpv2cgetnext	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,22 @@
+#!/bin/sh
+
+. ../eval_tools.sh
+
+HEADER SNMPv2c getnext of system.sysUpTime
+
+#
+# Begin test
+#
+
+# standard V2C configuration: testcomunnity
+. ./Sv2cconfig
+
+STARTAGENT
+
+CAPTURE "snmpgetnext -On $SNMP_FLAGS -c testcommunity -v 2c udp:localhost:$SNMP_SNMPD_PORT .1.3.6.1.2.1.1.3"
+
+STOPAGENT
+
+CHECK ".1.3.6.1.2.1.1.3.0 = Timeticks:"
+
+FINISHED
diff -Naur tomato/release/src/router/snmp/testing/tests/T0160snmpv2cbulkget tomato121/release/src/router/snmp/testing/tests/T0160snmpv2cbulkget
--- tomato/release/src/router/snmp/testing/tests/T0160snmpv2cbulkget	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/testing/tests/T0160snmpv2cbulkget	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,37 @@
+#!/bin/sh
+
+. ../eval_tools.sh
+
+HEADER SNMPv2 bulkget of system components
+
+#
+# Begin test
+#
+
+# standard V2 configuration: testcomunnity
+. ./Sv2cconfig
+
+STARTAGENT
+
+CAPTURE "snmpbulkget $SNMP_FLAGS -v2c -On -Cn1 -Cr2 -c testcommunity udp:localhost:$SNMP_SNMPD_PORT .1.3.6.1.2.1.1.4 .1.3.6.1.2.1.1"
+
+STOPAGENT
+
+CHECKORDIE ".1.3.6.1.2.1.1.4.0 = STRING:"
+CHECKORDIE ".1.3.6.1.2.1.1.1.0 = STRING:"
+CHECKORDIE ".1.3.6.1.2.1.1.2.0 = OID:"
+
+CHECK ".1.3.6.1.2.1.1.3.0"
+if [ "$snmp_last_test_result" != 0 ] ; then
+    return_value=1
+    FINISHED
+fi
+
+CHECK ".1.3.6.1.2.1.1.5.0"
+EXPECTRESULT 0
+if [ "$snmp_last_test_result" != 0 ] ; then
+    return_value=1
+    FINISHED
+fi
+
+FINISHED
diff -Naur tomato/release/src/router/snmp/testing/tests/T016snmpv2cgetfail tomato121/release/src/router/snmp/testing/tests/T016snmpv2cgetfail
--- tomato/release/src/router/snmp/testing/tests/T016snmpv2cgetfail	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/testing/tests/T016snmpv2cgetfail	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,26 @@
+#!/bin/sh
+
+#
+# test snmpv2c get support by reading a variable
+#
+
+. ../eval_tools.sh
+
+HEADER for failure of SNMPv2c get with wrong community
+
+#
+# Begin test
+#
+
+# standard V2C configuration: testcomunnity
+. ./Sv2cconfig
+
+STARTAGENT
+
+CAPTURE "snmpget -On $SNMP_FLAGS -c notavalidcommunity -v 2c udp:localhost:$SNMP_SNMPD_PORT .1.3.6.1.2.1.1.3.0"
+
+STOPAGENT
+
+CHECK "Timeout"
+
+FINISHED
diff -Naur tomato/release/src/router/snmp/testing/tests/T017snmpv2ctov1getfail tomato121/release/src/router/snmp/testing/tests/T017snmpv2ctov1getfail
--- tomato/release/src/router/snmp/testing/tests/T017snmpv2ctov1getfail	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/testing/tests/T017snmpv2ctov1getfail	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,26 @@
+#!/bin/sh
+
+#
+# test snmpv2c get support by reading a variable
+#
+
+. ../eval_tools.sh
+
+HEADER for failure of SNMPv2c get against SNMPv1 agent
+
+#
+# Begin test
+#
+
+# standard V2C configuration: testcomunnity
+. ./Sv1config
+
+STARTAGENT
+
+CAPTURE "snmpget -On $SNMP_FLAGS -c notavalidcommunity -v 2c udp:localhost:$SNMP_SNMPD_PORT .1.3.6.1.2.1.1.3.0"
+
+STOPAGENT
+
+CHECK "Timeout"
+
+FINISHED
diff -Naur tomato/release/src/router/snmp/testing/tests/T018snmpv1tov2cgetfail tomato121/release/src/router/snmp/testing/tests/T018snmpv1tov2cgetfail
--- tomato/release/src/router/snmp/testing/tests/T018snmpv1tov2cgetfail	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/testing/tests/T018snmpv1tov2cgetfail	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,22 @@
+#!/bin/sh
+
+. ../eval_tools.sh
+
+HEADER for failure of SNMPv1 get against SNMPv2c agent
+
+#
+# Begin test
+#
+
+# standard V2C configuration: testcomunnity
+. ./Sv2cconfig
+
+STARTAGENT
+
+CAPTURE "snmpget -On $SNMP_FLAGS -c notavalidcommunity -v 1 udp:localhost:$SNMP_SNMPD_PORT .1.3.6.1.2.1.1.3.0"
+
+STOPAGENT
+
+CHECK "Timeout"
+
+FINISHED
diff -Naur tomato/release/src/router/snmp/testing/tests/T019snmpv2cnosuch tomato121/release/src/router/snmp/testing/tests/T019snmpv2cnosuch
--- tomato/release/src/router/snmp/testing/tests/T019snmpv2cnosuch	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/testing/tests/T019snmpv2cnosuch	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,22 @@
+#!/bin/sh
+
+. ../eval_tools.sh
+
+HEADER SNMPv2c get of system.sysUpTime.1
+
+#
+# Begin test
+#
+
+# standard V2C configuration: testcomunnity
+. ./Sv2cconfig
+
+STARTAGENT
+
+CAPTURE "snmpget -On $SNMP_FLAGS -c testcommunity -v 2c udp:localhost:$SNMP_SNMPD_PORT .1.3.6.1.2.1.1.3.1"
+
+STOPAGENT
+
+CHECK ".1.3.6.1.2.1.1.3.1 = No Such Instance"
+
+FINISHED
diff -Naur tomato/release/src/router/snmp/testing/tests/T020snmpv3get tomato121/release/src/router/snmp/testing/tests/T020snmpv3get
--- tomato/release/src/router/snmp/testing/tests/T020snmpv3get	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/testing/tests/T020snmpv3get	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,26 @@
+#!/bin/sh
+
+. ../eval_tools.sh
+
+HEADER SNMPv3 get using initial of .1.3.6.1.2.1.1.3.0
+
+#
+# Begin test
+#
+
+# configure the agent to accept user initial with noAuthNoPriv
+CONFIGAGENT rwUser initial
+CONFIGAGENT createUser initial MD5 initial_PASS DES final_pass
+CONFIGAGENT group   testinitialgroup  usm     initial
+CONFIGAGENT view    all     included .1 80
+CONFIGAGENT 'access  testinitialgroup  "" any noauth exact all all all'
+
+STARTAGENT
+
+CAPTURE "snmpget -On $SNMP_FLAGS -v 3 -l nanp -u initial udp:localhost:$SNMP_SNMPD_PORT .1.3.6.1.2.1.1.3.0"
+
+STOPAGENT
+
+CHECK ".1.3.6.1.2.1.1.3.0 = Timeticks:"
+
+FINISHED
diff -Naur tomato/release/src/router/snmp/testing/tests/T021snmpv3getnext tomato121/release/src/router/snmp/testing/tests/T021snmpv3getnext
--- tomato/release/src/router/snmp/testing/tests/T021snmpv3getnext	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/testing/tests/T021snmpv3getnext	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,26 @@
+#!/bin/sh
+
+. ../eval_tools.sh
+
+HEADER SNMPv3 getnext using initial of .1.3.6.1.2.1.1.3.0
+
+#
+# Begin test
+#
+
+# configure the agent to accept user initial with noAuthNoPriv
+CONFIGAGENT rwUser initial
+CONFIGAGENT createUser initial MD5 initial_PASS DES final_pass
+CONFIGAGENT group   testinitialgroup  usm     initial
+CONFIGAGENT view    all     included .1 80
+CONFIGAGENT 'access  testinitialgroup  "" any noauth exact all all all'
+
+STARTAGENT
+
+CAPTURE "snmpgetnext -On $SNMP_FLAGS -v 3 -l nanp -u initial udp:localhost:$SNMP_SNMPD_PORT system.sysUpTime"
+
+STOPAGENT
+
+CHECK ".1.3.6.1.2.1.1.3.0 = Timeticks:"
+
+FINISHED
diff -Naur tomato/release/src/router/snmp/testing/tests/T0220snmpv3bulkget tomato121/release/src/router/snmp/testing/tests/T0220snmpv3bulkget
--- tomato/release/src/router/snmp/testing/tests/T0220snmpv3bulkget	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/testing/tests/T0220snmpv3bulkget	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,37 @@
+#!/bin/sh
+
+. ../eval_tools.sh
+
+HEADER SNMPv3 bulkget of system
+
+#
+# Begin test
+#
+
+# standard V3 configuration: 
+. ./Sv3config
+
+STARTAGENT
+
+CAPTURE "snmpbulkget $SNMP_FLAGS -v3 -On -Cn1 -Cr2 -a MD5 -A initial_test_pass_auth -l anp -u initial  udp:localhost:$SNMP_SNMPD_PORT .1.3.6.1.2.1.1.4 .1.3.6.1.2.1.1"
+
+STOPAGENT
+
+CHECKORDIE ".1.3.6.1.2.1.1.4.0 = STRING:"
+CHECKORDIE ".1.3.6.1.2.1.1.1.0 = STRING:"
+CHECKORDIE ".1.3.6.1.2.1.1.2.0 = OID:"
+
+CHECK ".1.3.6.1.2.1.1.3.0"
+if [ "$snmp_last_test_result" != 0 ] ; then
+    return_value=1
+    FINISHED
+fi
+
+CHECK ".1.3.6.1.2.1.1.5.0"
+EXPECTRESULT 0
+if [ "$snmp_last_test_result" != 0 ] ; then
+    return_value=1
+    FINISHED
+fi
+
+FINISHED
diff -Naur tomato/release/src/router/snmp/testing/tests/T022snmpv3getMD5 tomato121/release/src/router/snmp/testing/tests/T022snmpv3getMD5
--- tomato/release/src/router/snmp/testing/tests/T022snmpv3getMD5	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/testing/tests/T022snmpv3getMD5	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,22 @@
+#!/bin/sh
+
+. ../eval_tools.sh
+
+HEADER SNMPv3 get using initial/MD5 of .1.3.6.1.2.1.1.3.0
+
+#
+# Begin test
+#
+
+# standard V3 configuration for initial user
+. ./Sv3config
+
+STARTAGENT
+
+CAPTURE "snmpget -On $SNMP_FLAGS -v 3 -a MD5 -A initial_test_pass_auth -l anp -u initial udp:localhost:$SNMP_SNMPD_PORT .1.3.6.1.2.1.1.3.0"
+
+STOPAGENT
+
+CHECK ".1.3.6.1.2.1.1.3.0 = Timeticks:"
+
+FINISHED
diff -Naur tomato/release/src/router/snmp/testing/tests/T023snmpv3getMD5DES tomato121/release/src/router/snmp/testing/tests/T023snmpv3getMD5DES
--- tomato/release/src/router/snmp/testing/tests/T023snmpv3getMD5DES	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/testing/tests/T023snmpv3getMD5DES	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,25 @@
+#!/bin/sh
+
+. ../eval_tools.sh
+
+HEADER SNMPv3 get using initial/MD5DES of .1.3.6.1.2.1.1.3.0
+
+SKIPIFNOT USE_OPENSSL
+SKIPIFNOT USE_AUTHPRIV
+
+#
+# Begin test
+#
+
+# standard V3 configuration for initial user
+. ./Sv3DESconfig
+
+STARTAGENT
+
+CAPTURE "snmpget -On $SNMP_FLAGS -v 3 -x DES -X initial_test_pass_priv -a MD5 -A initial_test_pass_auth -l ap -u initial udp:localhost:$SNMP_SNMPD_PORT .1.3.6.1.2.1.1.3.0"
+
+STOPAGENT
+
+CHECK ".1.3.6.1.2.1.1.3.0 = Timeticks:"
+
+FINISHED
diff -Naur tomato/release/src/router/snmp/testing/tests/T024snmpv3getSHA1 tomato121/release/src/router/snmp/testing/tests/T024snmpv3getSHA1
--- tomato/release/src/router/snmp/testing/tests/T024snmpv3getSHA1	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/testing/tests/T024snmpv3getSHA1	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,24 @@
+#!/bin/sh
+
+. ../eval_tools.sh
+
+HEADER SNMPv3 get using templateSHA/SHA of .1.3.6.1.2.1.1.3.0
+
+SKIPIFNOT USE_OPENSSL
+
+#
+# Begin test
+#
+
+# standard V3 configuration for templateSHA user
+. ./Sv3configsha
+
+STARTAGENT
+
+CAPTURE "snmpget -On $SNMP_FLAGS -v 3 -a SHA -A initial_test_pass_auth -l anp -u initial udp:localhost:$SNMP_SNMPD_PORT .1.3.6.1.2.1.1.3.0"
+
+STOPAGENT
+
+CHECK ".1.3.6.1.2.1.1.3.0 = Timeticks:"
+
+FINISHED
diff -Naur tomato/release/src/router/snmp/testing/tests/T025snmpv3getSHADES tomato121/release/src/router/snmp/testing/tests/T025snmpv3getSHADES
--- tomato/release/src/router/snmp/testing/tests/T025snmpv3getSHADES	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/testing/tests/T025snmpv3getSHADES	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,25 @@
+#!/bin/sh
+
+. ../eval_tools.sh
+
+HEADER SNMPv3 get using templateSHA/MD5DES of .1.3.6.1.2.1.1.3.0
+
+SKIPIFNOT USE_OPENSSL
+SKIPIFNOT USE_AUTHPRIV
+
+#
+# Begin test
+#
+
+# standard V3 configuration for templateSHA user
+. ./Sv3SHADESconfig
+
+STARTAGENT
+
+CAPTURE "snmpget -On $SNMP_FLAGS -v 3 -x DES -X initial_test_pass_priv -a SHA -A initial_test_pass_auth -l ap -u initial udp:localhost:$SNMP_SNMPD_PORT .1.3.6.1.2.1.1.3.0"
+
+STOPAGENT
+
+CHECK ".1.3.6.1.2.1.1.3.0 = Timeticks:"
+
+FINISHED
diff -Naur tomato/release/src/router/snmp/testing/tests/T028snmpv3getfail tomato121/release/src/router/snmp/testing/tests/T028snmpv3getfail
--- tomato/release/src/router/snmp/testing/tests/T028snmpv3getfail	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/testing/tests/T028snmpv3getfail	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,22 @@
+#!/bin/sh
+
+. ../eval_tools.sh
+
+HEADER for failure of SNMPv3 get using unknown user.
+
+#
+# Begin test
+#
+
+# standard V3 configuration for initial user
+. ./Sv3config
+
+STARTAGENT
+
+CAPTURE "snmpget -On $SNMP_FLAGS -v 3 -l nanp -u unknownuser udp:localhost:$SNMP_SNMPD_PORT .1.3.6.1.2.1.1.3.0"
+
+STOPAGENT
+
+CHECK "Unknown user name"
+
+FINISHED
diff -Naur tomato/release/src/router/snmp/testing/tests/T030snmpv3usercreation tomato121/release/src/router/snmp/testing/tests/T030snmpv3usercreation
--- tomato/release/src/router/snmp/testing/tests/T030snmpv3usercreation	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/testing/tests/T030snmpv3usercreation	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,48 @@
+#!/bin/sh
+
+. ../eval_tools.sh
+
+HEADER SNMPv3 user creation and usage using snmpusm
+SKIPIFNOT USE_OPENSSL
+
+#
+# Begin test
+#
+
+# standard V3 configuration for initial user
+. ./Sv3config
+
+STARTAGENT
+
+CAPTURE "snmpusm $SNMP_FLAGS -v 3 -a MD5 -A initial_test_pass_auth -l anp -u initial udp:localhost:$SNMP_SNMPD_PORT create newtestuser templateMD5"
+CHECKORDIE "User successfully created"
+
+CAPTURE "snmpusm $SNMP_FLAGS -Cx -v 3 -a MD5 -A templateMD5_test_pass_auth -l anp -u newtestuser udp:localhost:$SNMP_SNMPD_PORT passwd templateMD5_test_pass_auth newtestpass"
+CHECKORDIE "SNMPv3 Key(s) successfully changed"
+
+CAPTURE "snmpusm $SNMP_FLAGS -Ca -v 3 -a MD5 -A templateMD5_test_pass_auth -l anp -u newtestuser udp:localhost:$SNMP_SNMPD_PORT passwd templateMD5_test_pass_auth newtestpass"
+CHECKORDIE "SNMPv3 Key(s) successfully changed"
+
+CAPTURE "snmpget -On $SNMP_FLAGS -v 3 -a MD5 -A newtestpass -l anp -u newtestuser udp:localhost:$SNMP_SNMPD_PORT .1.3.6.1.2.1.1.3.0"
+CHECKORDIE ".1.3.6.1.2.1.1.3.0 = Timeticks:"
+
+# auth
+CAPTURE "snmpget -On $SNMP_FLAGS -v 3 -a MD5 -A newtestpass -l anp -u newtestuser udp:localhost:$SNMP_SNMPD_PORT .1.3.6.1.2.1.1.3.0"
+CHECKORDIE ".1.3.6.1.2.1.1.3.0 = Timeticks:"
+
+# auth & encr
+CAPTURE "snmpget -On $SNMP_FLAGS -v 3 -a MD5 -A newtestpass -x DES -X newtestpass -l ap -u newtestuser udp:localhost:$SNMP_SNMPD_PORT .1.3.6.1.2.1.1.3.0"
+CHECKORDIE ".1.3.6.1.2.1.1.3.0 = Timeticks:"
+
+# change both keys at once
+CAPTURE "snmpusm $SNMP_FLAGS -v 3 -a MD5 -A newtestpass -l anp -u newtestuser udp:localhost:$SNMP_SNMPD_PORT passwd newtestpass myotherpass"
+CHECKORDIE "SNMPv3 Key(s) successfully changed"
+
+# auth & encr
+CAPTURE "snmpget -On $SNMP_FLAGS -v 3 -a MD5 -A myotherpass -x DES -X myotherpass -l ap -u newtestuser udp:localhost:$SNMP_SNMPD_PORT .1.3.6.1.2.1.1.3.0"
+CHECKORDIE ".1.3.6.1.2.1.1.3.0 = Timeticks:"
+
+STOPAGENT
+
+
+FINISHED
diff -Naur tomato/release/src/router/snmp/testing/tests/T049snmpv3inform tomato121/release/src/router/snmp/testing/tests/T049snmpv3inform
--- tomato/release/src/router/snmp/testing/tests/T049snmpv3inform	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/testing/tests/T049snmpv3inform	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,21 @@
+#!/bin/sh
+
+. ../eval_tools.sh
+
+HEADER SNMPv3 informs received and sent by tools
+
+#
+# Begin test
+#
+
+CONFIGTRAPD createUser testuser MD5 TESTPASSPHRASE
+
+STARTTRAPD
+
+CAPTURE "snmptrap -Ci -d -v 3 -u testuser -a MD5 -A TESTPASSPHRASE -l anp udp:localhost:$SNMP_SNMPTRAPD_PORT 0 .1.3.6.1.6.3.1.1.5.1 system.sysContact.0 s blah"
+
+STOPTRAPD
+
+CHECKTRAPD "coldStart"
+
+FINISHED
diff -Naur tomato/release/src/router/snmp/testing/tests/T050snmpv3trap tomato121/release/src/router/snmp/testing/tests/T050snmpv3trap
--- tomato/release/src/router/snmp/testing/tests/T050snmpv3trap	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/testing/tests/T050snmpv3trap	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,21 @@
+#!/bin/sh
+
+. ../eval_tools.sh
+
+HEADER SNMPv3 traps received and sent by tools
+
+#
+# Begin test
+#
+
+CONFIGTRAPD createUser -e 0x001122 testuser MD5 TESTPASSPHRASE
+
+STARTTRAPD
+
+CAPTURE "snmptrap -e 0x001122 -d -v 3 -u testuser -a MD5 -A TESTPASSPHRASE -l anp udp:localhost:$SNMP_SNMPTRAPD_PORT 0 .1.3.6.1.6.3.1.1.5.1 system.sysContact.0 s blah"
+
+STOPTRAPD
+
+CHECKTRAPD "coldStart"
+
+FINISHED
diff -Naur tomato/release/src/router/snmp/testing/tests/T051snmpv2ctrap tomato121/release/src/router/snmp/testing/tests/T051snmpv2ctrap
--- tomato/release/src/router/snmp/testing/tests/T051snmpv2ctrap	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/testing/tests/T051snmpv2ctrap	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,19 @@
+#!/bin/sh
+
+. ../eval_tools.sh
+
+HEADER SNMPv2c traps received and sent by tools
+
+#
+# Begin test
+#
+
+STARTTRAPD
+
+CAPTURE "snmptrap -d -v 2c -c testcommunity udp:localhost:$SNMP_SNMPTRAPD_PORT 0 .1.3.6.1.6.3.1.1.5.1 system.sysContact.0 s blah"
+
+STOPTRAPD
+
+CHECKTRAPD "coldStart"
+
+FINISHED
diff -Naur tomato/release/src/router/snmp/testing/tests/T052snmpv2cinform tomato121/release/src/router/snmp/testing/tests/T052snmpv2cinform
--- tomato/release/src/router/snmp/testing/tests/T052snmpv2cinform	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/testing/tests/T052snmpv2cinform	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,19 @@
+#!/bin/sh
+
+. ../eval_tools.sh
+
+HEADER SNMPv2c informs received and sent by tools
+
+#
+# Begin test
+#
+
+STARTTRAPD
+
+CAPTURE "snmptrap -Ci -d -v 2c -c testcommunity udp:localhost:$SNMP_SNMPTRAPD_PORT 0 .1.3.6.1.6.3.1.1.5.1 system.sysContact.0 s blah"
+
+STOPTRAPD
+
+CHECKTRAPD "Received"
+
+FINISHED
diff -Naur tomato/release/src/router/snmp/testing/tests/T053agentv1trap tomato121/release/src/router/snmp/testing/tests/T053agentv1trap
--- tomato/release/src/router/snmp/testing/tests/T053agentv1trap	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/testing/tests/T053agentv1trap	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,30 @@
+#!/bin/sh
+
+. ../eval_tools.sh
+
+HEADER snmpv1 traps are sent by snmpd API
+
+SKIPIFNOT USING_EXAMPLES_EXAMPLE_MODULE
+
+#
+# Begin test
+#
+
+# standard V1 configuration: testcomunnity
+. ./Sv3config
+CONFIGAGENT trapsink localhost public $SNMP_SNMPTRAPD_PORT
+
+STARTTRAPD
+
+AGENT_FLAGS="$AGENT_FLAGS -Dexample,header_generic,add_trap"
+STARTAGENT
+
+CAPTURE "snmpset -On $SNMP_FLAGS -v 3 -a MD5 -A initial_test_pass_auth -l anp -u initial udp:localhost:$SNMP_SNMPD_PORT ucdavis.254.7.0 i 1"
+
+STOPAGENT
+
+STOPTRAPD
+
+CHECKTRAPD "Enterprise Specific Trap (99)"
+
+FINISHED
diff -Naur tomato/release/src/router/snmp/testing/tests/T054agentv2ctrap tomato121/release/src/router/snmp/testing/tests/T054agentv2ctrap
--- tomato/release/src/router/snmp/testing/tests/T054agentv2ctrap	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/testing/tests/T054agentv2ctrap	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,31 @@
+#!/bin/sh
+
+. ../eval_tools.sh
+
+HEADER snmpv2c traps are sent by snmpd API
+
+SKIPIFNOT USING_EXAMPLES_EXAMPLE_MODULE
+
+#
+# Begin test
+#
+
+# standard V1 configuration: testcomunnity
+. ./Sv3config
+CONFIGAGENT trap2sink localhost public $SNMP_SNMPTRAPD_PORT
+
+STARTTRAPD
+
+AGENT_FLAGS="$AGENT_FLAGS"
+STARTAGENT
+
+#DELAY
+CAPTURE "snmpset -On -t 3 -r 0 $SNMP_FLAGS -v 3 -a MD5 -A initial_test_pass_auth -l anp -u initial udp:localhost:$SNMP_SNMPD_PORT ucdavis.254.8.0 i 1"
+
+STOPAGENT
+
+STOPTRAPD
+
+CHECKTRAPD "life the universe and everything"
+
+FINISHED
diff -Naur tomato/release/src/router/snmp/testing/tests/T055agentv1mintrap tomato121/release/src/router/snmp/testing/tests/T055agentv1mintrap
--- tomato/release/src/router/snmp/testing/tests/T055agentv1mintrap	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/testing/tests/T055agentv1mintrap	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,31 @@
+#!/bin/sh
+
+. ../eval_tools.sh
+
+HEADER snmpv1 traps are sent by snmpd without notification mib support
+
+SKIPIFNOT USING_EXAMPLES_EXAMPLE_MODULE
+
+#
+# Begin test
+#
+
+# standard V1 configuration: testcomunnity
+. ./Sv3config
+CONFIGAGENT trapsink localhost public $SNMP_SNMPTRAPD_PORT
+
+STARTTRAPD
+
+# initialize only the example mib, and not the notification mib stuff
+AGENT_FLAGS="$AGENT_FLAGS -Dexample,header_generic,add_trap,mib_init,callback -I example,usmUser,vacm_vars"
+STARTAGENT
+
+CAPTURE "snmpset -On $SNMP_FLAGS -v 3 -a MD5 -A initial_test_pass_auth -l anp -u initial udp:localhost:$SNMP_SNMPD_PORT ucdavis.254.7.0 i 1"
+
+STOPAGENT
+
+STOPTRAPD
+
+CHECKTRAPD "Enterprise Specific Trap (99)"
+
+FINISHED
diff -Naur tomato/release/src/router/snmp/testing/tests/T056agentv2cmintrap tomato121/release/src/router/snmp/testing/tests/T056agentv2cmintrap
--- tomato/release/src/router/snmp/testing/tests/T056agentv2cmintrap	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/testing/tests/T056agentv2cmintrap	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,32 @@
+#!/bin/sh
+
+. ../eval_tools.sh
+
+HEADER snmpv2c traps are sent by snmpd without notification mib support
+
+SKIPIFNOT USING_EXAMPLES_EXAMPLE_MODULE
+
+#
+# Begin test
+#
+
+# standard V1 configuration: testcomunnity
+. ./Sv3config
+CONFIGAGENT trap2sink localhost public $SNMP_SNMPTRAPD_PORT
+
+STARTTRAPD
+
+# initialize only the example mib, and not the notification mib stuff
+AGENT_FLAGS="$AGENT_FLAGS -Dexample,header_generic,add_trap,mib_init,callback -I example,usmUser,vacm_vars"
+STARTAGENT
+
+#DELAY
+CAPTURE "snmpset -On -t 3 -r 0 $SNMP_FLAGS -v 3 -a MD5 -A initial_test_pass_auth -l anp -u initial udp:localhost:$SNMP_SNMPD_PORT ucdavis.254.8.0 i 1"
+
+STOPAGENT
+
+STOPTRAPD
+
+CHECKTRAPD "life the universe and everything"
+
+FINISHED
diff -Naur tomato/release/src/router/snmp/testing/tests/T058agentauthtrap tomato121/release/src/router/snmp/testing/tests/T058agentauthtrap
--- tomato/release/src/router/snmp/testing/tests/T058agentauthtrap	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/testing/tests/T058agentauthtrap	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,32 @@
+#!/bin/sh
+
+. ../eval_tools.sh
+
+HEADER authentication failure traps are sent by snmpd
+
+#
+# Begin test
+#
+
+# standard V1 configuration: testcomunnity
+. ./Sv1config
+# add in a v1 trap sink
+CONFIGAGENT trapsink localhost public $SNMP_SNMPTRAPD_PORT
+CONFIGAGENT authtrapenable 1
+
+STARTTRAPD
+
+STARTAGENT
+
+# give the agent more time to start up.  We only want to fire one
+# request (retries = 0) to make sure only one trap is sent.
+#DELAY
+CAPTURE "snmpget -On -r 0 -t 5 $SNMP_FLAGS -v 1 -c wrongcommunity udp:localhost:$SNMP_SNMPD_PORT .1.3.6.1.2.1.1.3.0"
+
+STOPAGENT
+
+STOPTRAPD
+
+CHECKTRAPD "Authentication Failure Trap"
+
+FINISHED
diff -Naur tomato/release/src/router/snmp/testing/tests/T100agenthup tomato121/release/src/router/snmp/testing/tests/T100agenthup
--- tomato/release/src/router/snmp/testing/tests/T100agenthup	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/testing/tests/T100agenthup	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,32 @@
+#!/bin/sh
+
+. ../eval_tools.sh
+
+HEADER that the agent responds properly to a kill -HUP
+
+#
+# Begin test
+#
+
+# standard V1 configuration: testcomunnity
+. ./Sv1config
+
+STARTAGENT
+
+# add a agent configuration line that wouldn't have been there when
+# the started up.
+CONFIGAGENT syslocation not-anywhere-in-particular
+
+# kill -HUP the agent to get it to re-read the .conf file.
+DELAY
+kill -HUP `cat $SNMP_SNMPD_PID_FILE` > /dev/null 2>&1
+DELAY
+
+# And see if it has the new value.
+CAPTURE "snmpget -On $SNMP_FLAGS -c testcommunity -v 1 udp:localhost:$SNMP_SNMPD_PORT system.sysLocation.0"
+
+STOPAGENT
+
+CHECK "not-anywhere-in-particular"
+
+FINISHED
diff -Naur tomato/release/src/router/snmp/testing/tests/T110agentxget tomato121/release/src/router/snmp/testing/tests/T110agentxget
--- tomato/release/src/router/snmp/testing/tests/T110agentxget	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/testing/tests/T110agentxget	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,54 @@
+#!/bin/sh
+
+. ../eval_tools.sh
+
+HEADER AgentX GET support
+
+SKIPIFNOT USING_AGENTX_MODULE
+SKIPIFNOT USING_MIBII_SYSTEM_MIB_MODULE
+
+#
+# Begin test
+#
+
+# standard V3 configuration for initial user
+. ./Sv3config
+
+# Start the agent without initializing the system mib.
+ORIG_AGENT_FLAGS="$AGENT_FLAGS -x $SNMP_TMPDIR/agentx_socket"
+AGENT_FLAGS="$ORIG_AGENT_FLAGS -I -system_mib"
+STARTAGENT
+
+# test to see that the current agent doesn't support the system mib
+CAPTURE "snmpget -On $SNMP_FLAGS -v 3 -a MD5 -A initial_test_pass_auth -l anp -u initial udp:localhost:$SNMP_SNMPD_PORT .1.3.6.1.2.1.1.3.0"
+
+CHECK ".1.3.6.1.2.1.1.3.0 = No Such Object"
+
+if test "$snmp_last_test_result" = 1; then
+  # test the agentx subagent by first running it...
+
+  SNMP_SNMPD_PID_FILE_ORIG=$SNMP_SNMPD_PID_FILE
+  SNMP_SNMPD_LOG_FILE_ORIG=$SNMP_SNMPD_LOG_FILE
+  SNMP_SNMPD_PID_FILE=$SNMP_SNMPD_PID_FILE.num2
+  SNMP_SNMPD_LOG_FILE=$SNMP_SNMPD_LOG_FILE.num2
+  AGENT_FLAGS="$ORIG_AGENT_FLAGS -X -I system_mib"
+  SNMP_CONFIG_FILE="$SNMP_TMPDIR/bogus.conf"
+  STARTAGENT
+
+  # test to see that the agent now supports setting the system mib
+  CAPTURE "snmpget -On $SNMP_FLAGS -t 3 -v 3 -a MD5 -A initial_test_pass_auth -l anp -u initial udp:localhost:$SNMP_SNMPD_PORT .1.3.6.1.2.1.1.3.0"
+
+  CHECK ".1.3.6.1.2.1.1.3.0 = Timeticks:"
+
+  # stop the subagent
+  STOPAGENT
+
+  SNMP_SNMPD_PID_FILE=$SNMP_SNMPD_PID_FILE_ORIG
+  SNMP_SNMPD_LOG_FILE=$SNMP_SNMPD_LOG_FILE_ORIG
+fi
+
+# stop the master agent
+STOPAGENT
+
+# all done (whew)
+FINISHED
diff -Naur tomato/release/src/router/snmp/testing/tests/T111agentxset tomato121/release/src/router/snmp/testing/tests/T111agentxset
--- tomato/release/src/router/snmp/testing/tests/T111agentxset	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/testing/tests/T111agentxset	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,71 @@
+#!/bin/sh
+
+. ../eval_tools.sh
+
+HEADER AgentX SET support
+
+SKIPIFNOT USING_AGENTX_MODULE
+SKIPIFNOT USING_MIBII_SYSTEM_MIB_MODULE
+
+#
+# Begin test
+#
+
+# standard V3 configuration for initial user
+. ./Sv3config
+
+# Start the agent without initializing the system mib.
+ORIG_AGENT_FLAGS="$AGENT_FLAGS -x $SNMP_TMPDIR/agentx_socket"
+AGENT_FLAGS="$ORIG_AGENT_FLAGS -I -system_mib -DAgentX"
+STARTAGENT
+
+# test to see that the current agent doesn't support the system mib
+CAPTURE "snmpget -On -t 3 $SNMP_FLAGS -v 3 -a MD5 -A initial_test_pass_auth -l anp -u initial udp:localhost:$SNMP_SNMPD_PORT .1.3.6.1.2.1.1.4.0"
+
+CHECK ".1.3.6.1.2.1.1.4.0 = No Such Object"
+
+if test "$snmp_last_test_result" = 1; then
+  # test the AgentX subagent by first running it...
+
+  SNMP_SNMPD_PID_FILE_ORIG=$SNMP_SNMPD_PID_FILE
+  SNMP_SNMPD_LOG_FILE_ORIG=$SNMP_SNMPD_LOG_FILE
+  SNMP_SNMPD_PID_FILE=$SNMP_SNMPD_PID_FILE.num2
+  SNMP_SNMPD_LOG_FILE=$SNMP_SNMPD_LOG_FILE.num2
+  AGENT_FLAGS="$ORIG_AGENT_FLAGS -X -I system_mib"
+  SNMP_CONFIG_FILE="$SNMP_TMPDIR/bogus.conf"
+  echo "psyscontact testcontact" >> $SNMP_CONFIG_FILE
+  STARTAGENT
+
+  # test to see that the agent now supports the system mib
+  CAPTURE "snmpget -On $SNMP_FLAGS -t 5 -v 3 -a MD5 -A initial_test_pass_auth -l anp -u initial udp:localhost:$SNMP_SNMPD_PORT sysContact.0"
+
+  CHECK ".1.3.6.1.2.1.1.4.0 = STRING: testcontact"
+
+  if test "$snmp_last_test_result" = 1; then
+
+    # test to see that the agent now supports setting the system mib
+    CAPTURE "snmpset -On $SNMP_FLAGS -t 5 -v 3 -a MD5 -A initial_test_pass_auth -l anp -u initial udp:localhost:$SNMP_SNMPD_PORT sysContact.0 s newtestcontact"
+
+    CHECK ".1.3.6.1.2.1.1.4.0 = STRING: newtestcontact"
+
+    if test "$snmp_last_test_result" = 1; then
+
+	# test to see that the agent now supports the system mib
+	CAPTURE "snmpget -On $SNMP_FLAGS -t 5 -v 3 -a MD5 -A initial_test_pass_auth -l anp -u initial udp:localhost:$SNMP_SNMPD_PORT sysContact.0"
+	
+	CHECK ".1.3.6.1.2.1.1.4.0 = STRING: newtestcontact"
+    fi
+  fi
+
+  # stop the subagent
+  STOPAGENT
+
+  SNMP_SNMPD_PID_FILE=$SNMP_SNMPD_PID_FILE_ORIG
+  SNMP_SNMPD_LOG_FILE=$SNMP_SNMPD_LOG_FILE_ORIG
+fi
+
+# stop the master agent
+STOPAGENT
+
+# all done (whew)
+FINISHED
diff -Naur tomato/release/src/router/snmp/testing/tests/T112agentxsetfail tomato121/release/src/router/snmp/testing/tests/T112agentxsetfail
--- tomato/release/src/router/snmp/testing/tests/T112agentxsetfail	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/testing/tests/T112agentxsetfail	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,65 @@
+#!/bin/sh
+
+. ../eval_tools.sh
+
+HEADER AgentX illegal SET handling support
+
+SKIPIFNOT USING_AGENTX_MODULE
+SKIPIFNOT USING_MIBII_SYSTEM_MIB_MODULE
+
+#
+# Begin test
+#
+
+# standard V3 configuration for initial user
+. ./Sv3config
+
+# Start the agent without initializing the system mib.
+ORIG_AGENT_FLAGS="$AGENT_FLAGS -x $SNMP_TMPDIR/agentx_socket"
+AGENT_FLAGS="$ORIG_AGENT_FLAGS -I -system_mib -DAgentX"
+STARTAGENT
+
+# test to see that the current agent doesn't support the system mib
+CAPTURE "snmpget -On -t 3 $SNMP_FLAGS -v 3 -a MD5 -A initial_test_pass_auth -l anp -u initial udp:localhost:$SNMP_SNMPD_PORT system.sysContact.0"
+
+CHECK ".1.3.6.1.2.1.1.4.0 = No Such Object"
+
+if test "$snmp_last_test_result" = 1; then
+  # test the AgentX subagent by first running it...
+
+  SNMP_SNMPD_PID_FILE_ORIG=$SNMP_SNMPD_PID_FILE
+  SNMP_SNMPD_LOG_FILE_ORIG=$SNMP_SNMPD_LOG_FILE
+  SNMP_SNMPD_PID_FILE=$SNMP_SNMPD_PID_FILE.num2
+  SNMP_SNMPD_LOG_FILE=$SNMP_SNMPD_LOG_FILE.num2
+  AGENT_FLAGS="$ORIG_AGENT_FLAGS -X -I system_mib"
+  SNMP_CONFIG_FILE="$SNMP_TMPDIR/bogus.conf"
+  STARTAGENT
+
+  # test to see that the agent now supports the system mib
+  CAPTURE "snmpget -On $SNMP_FLAGS -t 5 -v 3 -a MD5 -A initial_test_pass_auth -l anp -u initial udp:localhost:$SNMP_SNMPD_PORT sysContact.0"
+
+  # we don't know the real value, unfortunately, so we test for what
+  # we should *not* get back.
+  CHECK ".1.3.6.1.2.1.1.4.0 = No Such Object"
+
+  if test "$snmp_last_test_result" = 0; then
+
+    # test to see that the agent now supports setting the system mib
+    CAPTURE "snmpset -On -Ir $SNMP_FLAGS -t 5 -v 3 -a MD5 -A initial_test_pass_auth -l anp -u initial udp:localhost:$SNMP_SNMPD_PORT sysContact.0 i 4"
+
+    CHECK "wrongType"
+
+  fi
+
+  # stop the subagent
+  STOPAGENT
+
+  SNMP_SNMPD_PID_FILE=$SNMP_SNMPD_PID_FILE_ORIG
+  SNMP_SNMPD_LOG_FILE=$SNMP_SNMPD_LOG_FILE_ORIG
+fi
+
+# stop the master agent
+STOPAGENT
+
+# all done (whew)
+FINISHED
diff -Naur tomato/release/src/router/snmp/testing/tests/T113agentxtrap tomato121/release/src/router/snmp/testing/tests/T113agentxtrap
--- tomato/release/src/router/snmp/testing/tests/T113agentxtrap	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/testing/tests/T113agentxtrap	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,72 @@
+#!/bin/sh
+
+. ../eval_tools.sh
+
+HEADER AgentX trap sending support
+
+SKIPIFNOT USING_AGENTX_MODULE
+SKIPIFNOT USING_EXAMPLES_EXAMPLE_MODULE
+
+#
+# Begin test
+#
+
+# start the trap demon
+STARTTRAPD
+
+# standard V3 configuration for initial user
+. ./Sv3config
+# configure the trap receiver.
+CONFIGAGENT trapsink localhost public $SNMP_SNMPTRAPD_PORT
+
+# Start the agent without initializing the example mib.
+ORIG_AGENT_FLAGS="$AGENT_FLAGS -x $SNMP_TMPDIR/agentx_socket"
+AGENT_FLAGS="$ORIG_AGENT_FLAGS -I -example"
+STARTAGENT
+
+# test to see that the current agent doesn't support the example mib
+CAPTURE "snmpget -On -t 3 $SNMP_FLAGS -v 3 -a MD5 -A initial_test_pass_auth -l anp -u initial udp:localhost:$SNMP_SNMPD_PORT ucdavis.254.1.0"
+
+CHECK "No Such Object"
+
+if test "$snmp_last_test_result" = 1; then
+  # test the AgentX subagent by first running it...
+
+  SNMP_SNMPD_PID_FILE_ORIG=$SNMP_SNMPD_PID_FILE
+  SNMP_SNMPD_LOG_FILE_ORIG=$SNMP_SNMPD_LOG_FILE
+  SNMP_SNMPD_PID_FILE=$SNMP_SNMPD_PID_FILE.num2
+  SNMP_SNMPD_LOG_FILE=$SNMP_SNMPD_LOG_FILE.num2
+  AGENT_FLAGS="$ORIG_AGENT_FLAGS -X -I example -Dadd"
+  SNMP_CONFIG_FILE="$SNMP_TMPDIR/bogus.conf"
+
+  STARTAGENT
+
+  # test to see that the agent now supports the example mib
+  CAPTURE "snmpget -On $SNMP_FLAGS -t 5 -v 3 -a MD5 -A initial_test_pass_auth -l anp -u initial udp:localhost:$SNMP_SNMPD_PORT ucdavis.254.1.0"
+
+  CHECK "life the universe and everything"
+
+  if test "$snmp_last_test_result" = 1; then
+
+    # test to see that the agent now sends a trap from the exmaple mib
+    CAPTURE "snmpset -On -r 0 -t 3 $SNMP_FLAGS -v 3 -a MD5 -A initial_test_pass_auth -l anp -u initial udp:localhost:$SNMP_SNMPD_PORT ucdavis.254.8.0 i 1"
+
+    CHECKTRAPD "life the universe and everything"
+
+  fi
+
+  # stop the subagent
+  STOPAGENT
+
+  SNMP_SNMPD_PID_FILE=$SNMP_SNMPD_PID_FILE_ORIG
+  SNMP_SNMPD_LOG_FILE=$SNMP_SNMPD_LOG_FILE_ORIG
+fi
+
+# stop the master agent
+STOPAGENT
+
+# stop the trap demon
+STOPTRAPD
+
+# all done (whew)
+FINISHED
diff -Naur tomato/release/src/router/snmp/testing/tests/T120proxyget tomato121/release/src/router/snmp/testing/tests/T120proxyget
--- tomato/release/src/router/snmp/testing/tests/T120proxyget	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/testing/tests/T120proxyget	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,60 @@
+#!/bin/sh
+
+. ../eval_tools.sh
+
+HEADER Proxy GET support
+
+SKIPIFNOT USING_UCD_SNMP_PROXY_MODULE
+SKIPIFNOT USING_MIBII_SYSTEM_MIB_MODULE
+
+#
+# Begin test
+#
+
+# standard V3 configuration for initial user
+. ./Sv3config
+# config the proxy
+CONFIGAGENT proxy -t 2 -r 1 -v 2c -c testcommunity udp:localhost:7676 system
+
+# Start the agent without initializing the system mib.
+ORIG_AGENT_FLAGS="$AGENT_FLAGS"
+AGENT_FLAGS="$ORIG_AGENT_FLAGS -I -system_mib -Dproxy"
+STARTAGENT
+
+# test to see that the current agent doesn't support the system mib
+#CAPTURE "snmpget -On -t 3 $SNMP_FLAGS -v 3 -a MD5 -A initial_test_pass_auth -l anp -u initial udp:localhost:$SNMP_SNMPD_PORT .1.3.6.1.2.1.1.3.0"
+
+#CHECK ".1.3.6.1.2.1.1.3.0 = No Such Object"
+
+#if test "$snmp_last_test_result" = 1; then
+  # test the proxy subagent by first running it...
+
+  SNMP_SNMPD_PID_FILE_ORIG=$SNMP_SNMPD_PID_FILE
+  SNMP_SNMPD_LOG_FILE_ORIG=$SNMP_SNMPD_LOG_FILE
+  SNMP_SNMPD_PID_FILE=$SNMP_SNMPD_PID_FILE.num2
+  SNMP_SNMPD_LOG_FILE=$SNMP_SNMPD_LOG_FILE.num2
+  SNMP_CONFIG_FILE="$SNMP_TMPDIR/proxy.conf"
+  echo "rwcommunity testcommunity" >> $SNMP_CONFIG_FILE
+  AGENT_FLAGS=$ORIG_AGENT_FLAGS
+  ORIG_SNMP_SNMPD_PORT=$SNMP_SNMPD_PORT
+  SNMP_SNMPD_PORT="7676"
+  STARTAGENT
+  SNMP_SNMPD_PORT=$ORIG_SNMP_SNMPD_PORT
+
+  # test to see that the agent now supports the system mib
+  CAPTURE "snmpget -On $SNMP_FLAGS -t 5 -v 3 -a MD5 -A initial_test_pass_auth -l anp -u initial udp:localhost:$SNMP_SNMPD_PORT .1.3.6.1.2.1.1.3.0"
+
+  CHECK ".1.3.6.1.2.1.1.3.0 = Timeticks:"
+
+  # stop the subagent
+  STOPAGENT
+
+  SNMP_SNMPD_PID_FILE=$SNMP_SNMPD_PID_FILE_ORIG
+  SNMP_SNMPD_LOG_FILE=$SNMP_SNMPD_LOG_FILE_ORIG
+#fi
+
+# stop the master agent
+STOPAGENT
+
+# all done (whew)
+FINISHED
diff -Naur tomato/release/src/router/snmp/testing/tests/T121proxyset tomato121/release/src/router/snmp/testing/tests/T121proxyset
--- tomato/release/src/router/snmp/testing/tests/T121proxyset	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/testing/tests/T121proxyset	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,77 @@
+#!/bin/sh
+
+. ../eval_tools.sh
+
+HEADER Proxy SET support
+
+SKIPIFNOT USING_UCD_SNMP_PROXY_MODULE
+SKIPIFNOT USING_MIBII_SYSTEM_MIB_MODULE
+
+#
+# Begin test
+#
+
+# standard V3 configuration for initial user
+. ./Sv3config
+# config the proxy
+CONFIGAGENT proxy -t 2 -r 1 -v 2c -c testcommunity udp:localhost:7676 system
+
+# Start the agent without initializing the system mib.
+ORIG_AGENT_FLAGS="$AGENT_FLAGS"
+AGENT_FLAGS="$ORIG_AGENT_FLAGS -I -system_mib -Dproxy"
+STARTAGENT
+
+# test to see that the current agent doesn't support the system mib
+#CAPTURE "snmpget -On -t 3 $SNMP_FLAGS -v 3 -a MD5 -A initial_test_pass_auth -l anp -u initial udp:localhost:$SNMP_SNMPD_PORT .1.3.6.1.2.1.1.3.0"
+
+#CHECK ".1.3.6.1.2.1.1.3.0 = No Such Object"
+
+#if test "$snmp_last_test_result" = 1; then
+  # test the proxy subagent by first running it...
+
+  SNMP_SNMPD_PID_FILE_ORIG=$SNMP_SNMPD_PID_FILE
+  SNMP_SNMPD_LOG_FILE_ORIG=$SNMP_SNMPD_LOG_FILE
+  SNMP_SNMPD_PID_FILE=$SNMP_SNMPD_PID_FILE.num2
+  SNMP_SNMPD_LOG_FILE=$SNMP_SNMPD_LOG_FILE.num2
+  SNMP_CONFIG_FILE="$SNMP_TMPDIR/proxy.conf"
+  echo "rwcommunity testcommunity" >> $SNMP_CONFIG_FILE
+  echo "psyscontact testcontact" >> $SNMP_CONFIG_FILE
+  AGENT_FLAGS="$ORIG_AGENT_FLAGS -Dmib_init"
+  ORIG_SNMP_SNMPD_PORT=$SNMP_SNMPD_PORT
+  SNMP_SNMPD_PORT="7676"
+  STARTAGENT
+  SNMP_SNMPD_PORT=$ORIG_SNMP_SNMPD_PORT
+
+  # test to see that the agent now supports the system mib
+  CAPTURE "snmpget -On $SNMP_FLAGS -t 5 -v 3 -a MD5 -A initial_test_pass_auth -l anp -u initial udp:localhost:$SNMP_SNMPD_PORT sysContact.0"
+
+  CHECK ".1.3.6.1.2.1.1.4.0 = STRING: testcontact"
+
+  if test "$snmp_last_test_result" = 1; then
+
+    # test to see that the agent now supports the system mib
+    CAPTURE "snmpset -On $SNMP_FLAGS -t 5 -v 3 -a MD5 -A initial_test_pass_auth -l anp -u initial udp:localhost:$SNMP_SNMPD_PORT sysContact.0 s newtestcontact"
+
+    CHECK ".1.3.6.1.2.1.1.4.0 = STRING: newtestcontact"
+
+    if test "$snmp_last_test_result" = 1; then
+
+	# test to see that the agent now supports the system mib
+	CAPTURE "snmpget -On $SNMP_FLAGS -t 5 -v 3 -a MD5 -A initial_test_pass_auth -l anp -u initial udp:localhost:$SNMP_SNMPD_PORT sysContact.0"
+	
+	CHECK ".1.3.6.1.2.1.1.4.0 = STRING: newtestcontact"
+    fi
+  fi
+
+  # stop the subagent
+  STOPAGENT
+
+  SNMP_SNMPD_PID_FILE=$SNMP_SNMPD_PID_FILE_ORIG
+  SNMP_SNMPD_LOG_FILE=$SNMP_SNMPD_LOG_FILE_ORIG
+#fi
+
+# stop the master agent
+STOPAGENT
+
+# all done (whew)
+FINISHED
diff -Naur tomato/release/src/router/snmp/testing/tests/T122proxysetfail tomato121/release/src/router/snmp/testing/tests/T122proxysetfail
--- tomato/release/src/router/snmp/testing/tests/T122proxysetfail	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/testing/tests/T122proxysetfail	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,73 @@
+#!/bin/sh
+
+. ../eval_tools.sh
+
+HEADER Proxy illegal SET handling support
+
+SKIPIFNOT USING_UCD_SNMP_PROXY_MODULE
+SKIPIFNOT USING_MIBII_SYSTEM_MIB_MODULE
+
+#
+# Begin test
+#
+
+# standard V3 configuration for initial user
+. ./Sv3config
+# config the proxy
+CONFIGAGENT proxy -t 2 -r 1 -v 2c -c testcommunity udp:localhost:7676 system
+
+# Start the agent without initializing the system mib.
+ORIG_AGENT_FLAGS="$AGENT_FLAGS"
+AGENT_FLAGS="$ORIG_AGENT_FLAGS -I -system_mib -Dproxy"
+STARTAGENT
+
+# test to see that the current agent doesn't support the system mib
+#CAPTURE "snmpget -On -t 3 $SNMP_FLAGS -v 3 -a MD5 -A initial_test_pass_auth -l anp -u initial udp:localhost:$SNMP_SNMPD_PORT .1.3.6.1.2.1.1.3.0"
+
+#CHECK ".1.3.6.1.2.1.1.3.0 = No Such Object"
+
+#if test "$snmp_last_test_result" = 1; then
+  # test the proxy subagent by first running it...
+
+  SNMP_SNMPD_PID_FILE_ORIG=$SNMP_SNMPD_PID_FILE
+  SNMP_SNMPD_LOG_FILE_ORIG=$SNMP_SNMPD_LOG_FILE
+  SNMP_SNMPD_PID_FILE=$SNMP_SNMPD_PID_FILE.num2
+  SNMP_SNMPD_LOG_FILE=$SNMP_SNMPD_LOG_FILE.num2
+  SNMP_CONFIG_FILE="$SNMP_TMPDIR/proxy.conf"
+  echo "rwcommunity testcommunity" >> $SNMP_CONFIG_FILE
+#  echo "syscontact testcontact" >> $SNMP_CONFIG_FILE
+  AGENT_FLAGS="$ORIG_AGENT_FLAGS -Dmib_init"
+  ORIG_SNMP_SNMPD_PORT=$SNMP_SNMPD_PORT
+  SNMP_SNMPD_PORT="7676"
+  STARTAGENT
+  SNMP_SNMPD_PORT=$ORIG_SNMP_SNMPD_PORT
+
+  # test to see that the agent now supports the system mib
+  CAPTURE "snmpget -On $SNMP_FLAGS -t 5 -v 3 -a MD5 -A initial_test_pass_auth -l anp -u initial udp:localhost:$SNMP_SNMPD_PORT sysContact.0"
+
+  
+  # we don't know the real value, unfortunately, so we test for what
+  # we should *not* get back.
+  CHECK ".1.3.6.1.2.1.1.4.0 = No Such Object"
+
+  if test "$snmp_last_test_result" = 0; then
+
+    # test to see that the agent now supports the system mib
+    CAPTURE "snmpset -On -Ir $SNMP_FLAGS -t 5 -v 3 -a MD5 -A initial_test_pass_auth -l anp -u initial udp:localhost:$SNMP_SNMPD_PORT sysContact.0 i 42"
+
+    CHECK ".1.3.6.1.2.1.1.4.0 = Wrong Type"
+
+  fi
+
+  # stop the subagent
+  STOPAGENT
+
+  SNMP_SNMPD_PID_FILE=$SNMP_SNMPD_PID_FILE_ORIG
+  SNMP_SNMPD_LOG_FILE=$SNMP_SNMPD_LOG_FILE_ORIG
+#fi
+
+# stop the master agent
+STOPAGENT
+
+# all done (whew)
+FINISHED
diff -Naur tomato/release/src/router/snmp/TODO tomato121/release/src/router/snmp/TODO
--- tomato/release/src/router/snmp/TODO	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/TODO	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,143 @@
+TODO list for the ucd-snmp-coders:
+
+  create our own source rpm spec file, independent from RedHat
+  possibly add WinSNMP wrappers around the ucd-snmp functions
+  Continue to add and improve manual pages/documentation.
+  More snmpset'able variables.
+  Should be able to set the fix script line in the .conf files per type.
+  Implement IP routing table manipulation using sysctl() on systems that
+    support the route socket (BSD 4.4 and IRIX >= 6.2)
+  Implement new IP forwarding table MIB (RFC 2096), at least on systems
+    that have classless routing tables internally
+  Implement IP/UDP/TCP statistics on IRIX 6.2 and later using
+    sysmp(MP_SAGET,MPSA_TCPIPSTAT,...) and <sys/tcpipstats.h>
+  Follow the evolution of the Interfaces Group MIB
+    (draft-ietf-ifmib-mib-05.txt) and implement what can be
+    implemented.
+  Make read_objid and sprint_objid agree on which shorthands they accept.
+  snmpset should check against MIB size if possible?
+  Remove unsuppored mib nodes from output instead of returning '0's.
+  Support for Counter64 in snmpdelta
+  API for traps that pass scripts can use.
+  Make memory/swap variables UInts instead of Ints.
+
+===================
+
+Issues:
+
+	CODE-RELATED ISSUES
+	-------------------
+
+Architecture-specific implementations:
+	How to handle differences between architectures
+	   - overall common template
+	   - "standard" implementation (with minor differences)
+	   - architecture unique implementations
+	pre-processor #ifdefs or separate files
+
+Function argument handling:
+	Function declaration prototypes
+	Function definition prototypes
+	How to handle both ANSI and K&R compilers
+
+Threading
+	Single thread / multi-thread / event driven / asynchronous
+
+Lookup design
+	Kernel digging vs "clean" interfaces (sysctl/ioctl)
+
+Error Handling
+	Ensure all return values are checked for validity
+
+Documented APIs
+
+WinSNMP interface
+
+Package name
+	UCD-snmp vs Net-snmp
+
+
+
+	FUNCTIONALITY-RELATED ISSUES
+	----------------------------
+
+Per-interface information
+	(speed/type/counters/non-ethernet address)
+
+Multi-CPU support
+
+Real Time O/S support
+
+64-bit counters
+
+Non-ethernet interface support
+	Address handling code tends to assume 6 octet
+	physical addresses and 4 octet transport addresses
+
+Non-fully-qualified name output
+	(Probably covered now?)
+
+Formatted dump
+	unpick the ASN encoding, rather than
+	simply dumping the bare data
+
+Module interdependence
+
+
+
+	EXTENSIBILITY-RELATED ISSUES
+	----------------------------
+
+AgentX
+
+SMUX
+
+Dynamic loading of modules
+
+"Intelligent" Agent
+	agent-initiated traps
+	threshold monitoring
+
+PHP scripting
+
+Extensible trapd
+
+
+
+	PERFORMANCE-RELATED ISSUES
+	--------------------------
+
+Memory Leaks
+
+Information caching
+	(e.g. Host Resources information)
+
+Intelligent table handling
+	(i.e. not resetting internal state for each request)
+
+Pre-compiled MIBs
+	to speed up MIB parsing
+
+Duplicate requests
+	Currently these are processed afresh each time.
+	They should probably be either dropped or use cached replies
+
+Security
+	Go through the library and apps and check all arrays and
+	buffers for overruns. There are a lot of unchecked ones.
+
+===================
+
+Other Ideas:
+  Make the mib parser figure out which of the above files it needs to
+    load rather than loading them all -- Tom Georges & Joe Marzot
+
+===================
+
+Want something done?  Have ideas?  Have code to submit?  Need
+something earlier than it is listed above? Please!  
+                                           Write us!
+                                           net-snmp-coders@lists.sourceforge.net
+
+(even if just to announce that you are going to be working on it so we 
+can avoid multiple people working on the same thing)
diff -Naur tomato/release/src/router/snmp/win32/bin/.cvsignore tomato121/release/src/router/snmp/win32/bin/.cvsignore
--- tomato/release/src/router/snmp/win32/bin/.cvsignore	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/win32/bin/.cvsignore	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,6 @@
+Release
+Debug
+*.plg
+*.ilk
+*.dll
+
diff -Naur tomato/release/src/router/snmp/win32/config.h tomato121/release/src/router/snmp/win32/config.h
--- tomato/release/src/router/snmp/win32/config.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/win32/config.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,875 @@
+/* config.h:  a general config file */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* UC-Davis' IANA-assigned enterprise number is 2021 */
+#define ENTERPRISE_NUMBER 2021
+
+/* don't change these values! */
+#define SNMPV1      0xAAAA       /* readable by anyone */
+#define SNMPV2ANY   0xA000       /* V2 Any type (includes NoAuth) */
+#define SNMPV2AUTH  0x8000       /* V2 Authenticated requests only */
+
+/* default list of mibs to load */
+#define DEFAULT_MIBS "IP-MIB;IF-MIB;TCP-MIB;UDP-MIB;SNMPv2-MIB;RFC1213-MIB;UCD-SNMP-MIB;UCD-DEMO-MIB;SNMP-TARGET-MIB;SNMP-VIEW-BASED-ACM-MIB;SNMP-COMMUNITY-MIB;UCD-DLMOD-MIB;SNMP-FRAMEWORK-MIB;SNMP-MPD-MIB;SNMP-USER-BASED-SM-MIB;SNMP-NOTIFICATION-MIB;SNMPv2-TM"
+
+/* default location to look for mibs to load using the above tokens
+   and/or those in the MIBS envrionment variable*/
+
+#define DEFAULT_MIBDIRS "/USR/MIBS"
+
+/* default mib files to load, specified by path. */
+
+#undef DEFAULT_MIBFILES
+
+/* should we compile to use special opaque types: float, double,
+   counter64, i64, ui64, union? */
+#define OPAQUE_SPECIAL_TYPES 1
+
+/* comment the next line if you are compiling with libsnmp.h
+   and are not using the UC-Davis SNMP library. */
+#define UCD_SNMP_LIBRARY 1
+
+/* define if you want to compile support for both authentication and
+   privacy support. */
+#define SCAPI_AUTHPRIV 1
+
+/* define if you are using the internal MD5 code */
+#define USE_INTERNAL_MD5 1
+
+/* add in recent CMU library extensions (not complete) */
+#define CMU_COMPATIBLE 1
+
+/* should "--" comments in mibs be a comment till the end of the line
+   or also until another "--", the latter being the technically
+   correct. */
+#undef MIB_COMMENT_IS_EOL_TERMINATED
+
+/* debugging stuff */
+#undef SNMP_NO_DEBUGGING           /* if defined, we optimize the code
+                                      to exclude all debugging calls. */
+#define SNMP_ALWAYS_DEBUG 0        /* Always print debugging information and
+                                      ignore the -D flag passed to the cmds */
+
+/* Define if using alloca.c.  */
+#undef C_ALLOCA
+
+/* Define to one of _getb67, GETB67, getb67 for Cray-2 and Cray-YMP systems.
+   This function is required for alloca.c support on those systems.  */
+#undef CRAY_STACKSEG_END
+
+/* Define if you have alloca, as a function or macro.  */
+#undef HAVE_ALLOCA
+
+/* Define if you have <alloca.h> and it should be used (not on Ultrix).  */
+#undef HAVE_ALLOCA_H
+
+/* Define if you have the getmntent function.  */
+#undef HAVE_GETMNTENT
+
+/* Define if you have <sys/wait.h> that is POSIX.1 compatible.  */
+#undef HAVE_SYS_WAIT_H
+
+/* Define to `long' if <sys/types.h> doesn't define.  */
+#undef off_t
+
+/* Define to `int' if <sys/types.h> doesn't define.  */
+#undef pid_t
+
+/* Define as the return type of signal handlers (int or void).  */
+#define RETSIGTYPE void
+
+/* Define if you have raise() instead of alarm() */
+
+#define HAVE_RAISE 1
+
+/* If using the C implementation of alloca, define if you know the
+   direction of stack growth for your system; otherwise it will be
+   automatically deduced at run-time.
+ STACK_DIRECTION > 0 => grows toward higher addresses
+ STACK_DIRECTION < 0 => grows toward lower addresses
+ STACK_DIRECTION = 0 => direction of growth unknown
+ */
+#undef STACK_DIRECTION
+
+/* Define if you have the ANSI C header files.  */
+#define STDC_HEADERS 1
+
+/* Define if you can safely include both <sys/time.h> and <time.h>.  */
+#define TIME_WITH_SYS_TIME 1
+
+/* Define if you have the gettimeofday function.  */
+#undef HAVE_GETTIMEOFDAY
+
+/* Define if you have the <sys/time.h> header file.  */
+#undef HAVE_SYS_TIME_H
+
+/* Define if your processor stores words with the most significant
+   byte first (like Motorola and SPARC, unlike Intel and VAX).  */
+#undef WORDS_BIGENDIAN
+
+#define SNMPDLMODPATH "/USR/LIB/DLMOD"
+#define SNMPLIBPATH "/USR/LIB"
+#define SNMPSHAREPATH "/USR/SHARE/SNMP"
+#define SNMPCONFPATH "/USR"
+
+/* SNMPPATH contains (more) important files */
+
+#undef SNMPPATH
+
+/* LOGFILE:  If defined it closes stdout/err/in and opens this in out/err's
+   place.  (stdin is closed so that sh scripts won't wait for it) */
+
+#undef LOGFILE
+
+/* PERSISTENT_DIRECTORY: If defined, the library is capabile of saving
+   persisant information to this directory in the form of configuration
+   lines: PERSISTENT_DIRECTORY/NAME.persistent.conf */
+#define PERSISTENT_DIRECTORY "/USR/SNMP/PERSIST"
+
+#define MAX_PERSISTENT_BACKUPS 10
+/* default system contact */
+#define SYS_CONTACT "unknown"
+
+/* system location */
+#define SYS_LOC "unknown"
+
+/* location of UNIX kernel */
+#define KERNEL_LOC "unknown"
+
+/* location of mount table list */
+#define ETC_MNTTAB "unknown"
+
+/* location of swap device (ok if not found) */
+#undef DMEM_LOC
+
+/* define rtentry to ortentry on SYSV machines (alphas) */
+#define RTENTRY rtentry;
+
+/* Use BSD 4.4 routing table entries? */
+#undef RTENTRY_4_4
+
+/* Does the rtentry structure have a rt_next node */
+#undef RTENTRY_RT_NEXT
+
+#define PSCMD "/bin/ps"
+
+/* Where is the uname command */
+#define UNAMEPROG "/bin/uname"
+
+/* testing code sections. */
+/* #undef SNMP_TESTING_CODE */
+
+/* If you don't have root access don't exit upon kmem errors */
+#undef NO_ROOT_ACCESS
+
+/* Define if you have the bcopy function.  */
+#undef HAVE_BCOPY
+
+/* Define if you have the gethostbyname function.  */
+#define HAVE_GETHOSTBYNAME 1
+
+/* Define if you have the gethostname function.  */
+#define HAVE_GETHOSTNAME 1
+
+/* Define if you have the getloadavg function.  */
+#undef HAVE_GETLOADAVG
+
+/* Define if you have the getservbyname function.  */
+#define HAVE_GETSERVBYNAME 1
+
+/* Define if you have the setenv function.  */
+#undef HAVE_SETENV
+
+/* Define if you have the strtoul function.  */
+#define HAVE_STRTOUL 1
+
+/* Define if you have the vsnprintf function.  */
+#define HAVE_VSNPRINTF 1
+#define HAVE_SNPRINTF 1
+
+/* Define if you have the index function.  */
+#undef HAVE_INDEX
+
+/* Define if you have the kvm_openfiles function.  */
+#undef HAVE_KVM_OPENFILES
+
+/* Define if you have the lrand48 function.  */
+#undef HAVE_LRAND48
+
+/* Define if you have the memcpy function.  */
+#define HAVE_MEMCPY 1
+
+/* Define if you have the memmove function.  */
+#define HAVE_MEMMOVE 1
+
+/* Define if you have the rand function.  */
+#define HAVE_RAND 1
+
+/* Define if you have the random function.  */
+#undef HAVE_RANDOM
+
+/* Define if you have the select function.  */
+#undef HAVE_SELECT
+
+/* Define if you have the setmntent function.  */
+#undef HAVE_SETMNTENT
+
+/* Define if you have the sigblock function.  */
+#undef HAVE_SIGBLOCK
+
+/* Define if you have the sighold function.  */
+#undef HAVE_SIGHOLD
+
+/* Define if you have the signal function.  */
+#undef HAVE_SIGNAL
+
+/* Define if you have the sigset function.  */
+#undef HAVE_SIGSET
+
+/* Define if you have the socket function.  */
+#define HAVE_SOCKET 1
+
+/* Define if you have <winsock.h> header file. */
+#define HAVE_WINSOCK_H 1
+
+/* Define if you have the closesocket function.  */
+#define HAVE_CLOSESOCKET 1
+
+/* Define if you have the statfs function.  */
+#undef HAVE_STATFS
+
+/* Define if you have the statvfs function.  */
+#undef HAVE_STATVFS
+
+/* Define if you have the strchr function.  */
+#define HAVE_STRCHR 1
+
+/* use win32 strdup */
+#define strdup _strdup
+
+/* Define if you have the strtol function.  */
+#define HAVE_STRTOL 1
+
+/* Define if you have the tcgetattr function.  */
+/* #define HAVE_TCGETATTR 1 */
+
+/* Define if you have the uname function.  */
+#undef HAVE_UNAME
+
+/* Define if you have <io.h> header file. */
+#define HAVE_IO_H 1
+
+/* Define if you have <process.h> header file. (Win32-getpid) */
+#define HAVE_PROCESS_H 1
+
+/* Define if you have the <arpa/inet.h> header file.  */
+#undef HAVE_ARPA_INET_H
+
+/* Define if you have the <dirent.h> header file.  */
+#undef HAVE_DIRENT_H
+
+/* Define if you have the <err.h> header file.  */
+#undef HAVE_ERR_H
+
+/* Define if you have the <fcntl.h> header file.  */
+#define HAVE_FCNTL_H 1
+
+/* Define if you have the <fstab.h> header file.  */
+#undef HAVE_FSTAB_H
+
+/* Define if you have the <inet/mib2.h> header file.  */
+#undef HAVE_INET_MIB2_H
+
+/* Define if you have the <kstat.h> header file.  */
+#undef HAVE_KSTAT_H
+
+/* Define if you have the <kvm.h> header file.  */
+#undef HAVE_KVM_H
+
+/* Define if you have the <limits.h> header file.  */
+#define HAVE_LIMITS_H 1
+
+/* Define if you have the <machine/param.h> header file.  */
+#undef HAVE_MACHINE_PARAM_H
+
+/* Define if you have the <machine/pte.h> header file.  */
+#undef HAVE_MACHINE_PTE_H
+
+/* Define if you have the <malloc.h> header file.  */
+#undef HAVE_MALLOC_H
+
+/* Define if you have the <mntent.h> header file.  */
+#undef HAVE_MNTENT_H
+
+/* Define if you have the <mtab.h> header file.  */
+#undef HAVE_MTAB_H
+
+/* Define if you have the <ndir.h> header file.  */
+#undef HAVE_NDIR_H
+
+/* Define if you have the <net/if_dl.h> header file.  */
+#undef HAVE_NET_IF_DL_H
+
+/* Define if you have the <net/if_types.h> header file.  */
+#undef HAVE_NET_IF_TYPES_H
+
+/* Define if you have the <netinet/icmp_var.h> header file.  */
+#undef HAVE_NETINET_ICMP_VAR_H
+
+/* Define if you have the <netinet/if_ether.h> header file.  */
+#undef HAVE_NETINET_IF_ETHER_H
+
+/* Define if you have the <netinet/in.h> header file.  */
+#undef HAVE_NETINET_IN_H
+
+/* Define if you have the <netinet/in_pcb.h> header file.  */
+#undef HAVE_NETINET_IN_PCB_H
+
+/* Define if you have the <netinet/in_var.h> header file.  */
+#undef HAVE_NETINET_IN_VAR_H
+
+/* Define if you have the <netinet/ip_var.h> header file.  */
+#undef HAVE_NETINET_IP_VAR_H
+
+/* Define if you have the <netinet/tcp_fsm.h> header file.  */
+#undef HAVE_NETINET_TCP_FSM_H
+
+/* Define if you have the <netinet/tcp_timer.h> header file.  */
+#undef HAVE_NETINET_TCP_TIMER_H
+
+/* Define if you have the <netinet/tcp_var.h> header file.  */
+#undef HAVE_NETINET_TCP_VAR_H
+
+/* Define if you have the <netinet/tcpip.h> header file.  */
+#undef HAVE_NETINET_TCPIP_H
+
+/* Define if you have the <netinet/udp_var.h> header file.  */
+#undef HAVE_NETINET_UDP_VAR_H
+
+/* Define if you have the <sgtty.h> header file.  */
+#undef HAVE_SGTTY_H
+
+/* Define if you have the <stdarg.h> header file.  */
+#define HAVE_STDARG_H 1
+
+/* Define if you have the <stdlib.h> header file.  */
+#define HAVE_STDLIB_H 1
+
+/* Define if you have the <string.h> header file.  */
+#define HAVE_STRING_H 1
+
+/* Define if you have the <sys/conf.h> header file.  */
+#undef HAVE_SYS_CONF_H
+
+/* Define if you have the <sys/dir.h> header file.  */
+#undef HAVE_SYS_DIR_H
+
+/* Define if you have the <sys/dmap.h> header file.  */
+#undef HAVE_SYS_DMAP_H
+
+/* Define if you have the <sys/file.h> header file.  */
+#undef HAVE_SYS_FILE_H
+
+/* Define if you have the <sys/filio.h> header file.  */
+#undef HAVE_SYS_FILIO_H
+
+/* Define if you have the <sys/fixpoint.h> header file.  */
+#undef HAVE_SYS_FIXPOINT_H
+
+/* Define if you have the <sys/fs.h> header file.  */
+#undef HAVE_SYS_FS_H
+
+/* Define if you have the <sys/stat.h> header file.  */
+#define HAVE_SYS_STAT_H 1
+
+/* Define if you have the <sys/hashing.h> header file.  */
+#undef HAVE_SYS_HASHING_H
+
+/* Define if you have the <sys/ioctl.h> header file.  */
+#undef HAVE_SYS_IOCTL_H
+
+/* Define if you have the <sys/mbuf.h> header file.  */
+#undef HAVE_SYS_MBUF_H
+
+/* Define if you have the <sys/mnttab.h> header file.  */
+#undef HAVE_SYS_MNTTAB_H
+
+/* Define if you have the <sys/mount.h> header file.  */
+#undef HAVE_SYS_MOUNT_H
+
+/* Define if you have the <sys/ndir.h> header file.  */
+#undef HAVE_SYS_NDIR_H
+
+/* Define if you have the <sys/param.h> header file.  */
+#undef HAVE_SYS_PARAM_H
+
+/* Define if you have the <sys/proc.h> header file.  */
+#undef HAVE_SYS_PROC_H
+
+/* Define if you have the <sys/protosw.h> header file.  */
+#undef HAVE_SYS_PROTOSW_H
+
+/* Define if you have the <sys/select.h> header file.  */
+#undef HAVE_SYS_SELECT_H
+
+/* Define if you have the <sys/sockio.h> header file.  */
+#undef HAVE_SYS_SOCKIO_H
+
+/* Define if you have the <sys/statvfs.h> header file.  */
+#undef HAVE_SYS_STATVFS_H
+
+/* Define if you have the <sys/swap.h> header file.  */
+#undef HAVE_SYS_SWAP_H
+
+/* Define if you have the <sys/sysctl.h> header file.  */
+#undef HAVE_SYS_SYSCTL_H
+
+/* Define if you have the <sys/tcpipstats.h> header file.  */
+#undef HAVE_SYS_TCPIPSTATS_H
+
+/* Define if you have the <sys/user.h> header file.  */
+#undef HAVE_SYS_USER_H
+
+/* Define if you have the <sys/utsname.h> header file.  */
+#undef HAVE_SYS_UTSNAME_H
+
+/* Define if you have the <sys/vfs.h> header file.  */
+#undef HAVE_SYS_VFS_H
+
+/* Define if you have the <sys/vm.h> header file.  */
+#undef HAVE_SYS_VM_H
+
+/* Define if you have the <sys/vmmac.h> header file.  */
+#undef HAVE_SYS_VMMAC_H
+
+/* Define if you have the <sys/vmmeter.h> header file.  */
+#undef HAVE_SYS_VMMETER_H
+
+/* Define if you have the <sys/vmparam.h> header file.  */
+#undef HAVE_SYS_VMPARAM_H
+
+/* Define if you have the <sys/vmsystm.h> header file.  */
+#undef HAVE_SYS_VMSYSTM_H
+
+/* Define if you have the <syslog.h> header file.  */
+#undef HAVE_SYSLOG_H
+
+#ifndef LOG_DAEMON
+#define       LOG_DAEMON      (3<<3)  /* system daemons */
+#endif
+
+/* Define if you have the <ufs/ffs/fs.h> header file.  */
+#undef HAVE_UFS_FFS_FS_H
+
+/* Define if you have the <ufs/fs.h> header file.  */
+#undef HAVE_UFS_FS_H
+
+/* Define if you have the <ufs/ufs/dinode.h> header file.  */
+#undef HAVE_UFS_UFS_DINODE_H
+
+/* Define if you have the <unistd.h> header file.  */
+#undef HAVE_UNISTD_H
+
+/* Define if you have the <utsname.h> header file.  */
+#undef HAVE_UTSNAME_H
+
+/* Define if you have the <vm/swap_pager.h> header file.  */
+#undef HAVE_VM_SWAP_PAGER_H
+
+/* Define if you have the <vm/vm.h> header file.  */
+#undef HAVE_VM_VM_H
+
+/* Define if you have the <xti.h> header file.  */
+#undef HAVE_XTI_H
+
+/* Define if you have the crypto library (-lcrypto).  */
+#undef HAVE_LIBCRYPTO
+
+/* Define if you have the elf library (-lelf).  */
+#undef HAVE_LIBELF
+
+/* Define if you have the kstat library (-lkstat).  */
+#undef HAVE_LIBKSTAT
+
+/* Define if you have the kvm library (-lkvm).  */
+#undef HAVE_LIBKVM
+
+/* Define if you have the m library (-lm).  */
+#undef HAVE_LIBM
+
+/* Define if you have the mld library (-lmld).  */
+#undef HAVE_LIBMLD
+
+/* Define if you have the nsl library (-lnsl).  */
+#undef HAVE_LIBNSL
+
+/* Define if you have the socket library (-lsocket).  */
+#undef HAVE_LIBSOCKET
+
+/* ifnet structure tests */
+#undef STRUCT_IFNET_HAS_IF_BAUDRATE
+#undef STRUCT_IFNET_HAS_IF_TYPE
+#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_NOPROTO
+#undef STRUCT_IFNET_HAS_IF_OMCASTS
+#undef STRUCT_IFNET_HAS_IF_XNAME
+#undef STRUCT_IFNET_HAS_IF_OBYTES
+#undef STRUCT_IFNET_HAS_IF_IBYTES
+#undef STRUCT_IFNET_HAS_IF_ADDRLIST
+
+/* tcpstat.tcps_rcvmemdrop */
+#undef STRUCT_TCPSTAT_HAS_TCPS_RCVMEMDROP
+
+/* udpstat.udps_discard */
+#undef STRUCT_UDPSTAT_HAS_UDPS_DISCARD
+
+/* arphd.at_next */
+#undef STRUCT_ARPHD_HAS_AT_NEXT
+
+/* ifaddr.ifa_next */
+#undef STRUCT_IFADDR_HAS_IFA_NEXT
+
+/* ifnet.if_mtu */
+#undef STRUCT_IFNET_HAS_IF_MTU
+
+/* ifnet needs to have _KERNEL defined */
+#undef IFNET_NEEDS_KERNEL
+
+/* sysctl works to get boottime, etc... */
+#undef CAN_USE_SYSCTL
+
+/* define if your compiler (processor) defines __FUNCTION__ for you */
+#undef HAVE_CPP_UNDERBAR_FUNCTION_DEFINED
+
+/* mib pointer to the top of the extensible tree.  This has been
+ assigned to UCDavis by the iana group.  Optionally, point this to the
+ location in the tree your company/organization has been allocated. */
+
+/* location of the extensible mib tree */
+#define EXTENSIBLEMIB 1,3,6,1,4,1,2021
+/* location of the extensible mib tree */
+#define EXTENSIBLEDOTMIB 1.3.6.1.4.1.2021
+/* count the above numbers */
+#define EXTENSIBLENUM 7
+
+/* the ErrorFlag is V1 accessable because HP Openview does not support
+   V2.  You can make this list of pairs as long as you want, just make
+   sure to end it in -1.*/
+
+#define SECURITYEXCEPTIONS {100,SNMPV1,-1} /* the ErrorFlag is V1 */
+
+/* Mib-2 tree Info */
+/* These are the system information variables. */
+
+#define VERS_DESC   "unknown"             /* overridden at run time */
+#define SYS_NAME    "unknown"             /* overridden at run time */
+
+/* comment out the second define to turn off functionality for any of
+   these: (See README for details) */
+
+/*   proc PROCESSNAME [MAX] [MIN] */
+#define PROCMIBNUM 2
+#define USEPROCMIB
+
+/*   exec/shell NAME COMMAND      */
+#define SHELLMIBNUM 8
+#define USESHELLMIB
+
+/*   swap MIN                     */
+#define MEMMIBNUM 4
+#if defined(hpux9) || defined(bsdi2)
+#define USEMEMMIB
+#endif
+
+/*   disk DISK MINSIZE            */
+#define DISKMIBNUM 9
+#if (HAVE_FSTAB_H || HAVE_SYS_STATVFS_H)
+#define USEDISKMIB
+#endif
+
+/*   load 1 5 15                  */
+#define LOADAVEMIBNUM 10
+#define USELOADAVEMIB
+
+/*   pass MIBOID command */
+#define USEPASSMIB
+
+/* which version are you using? This mibloc will tell you */
+#define VERSIONMIBNUM 100
+#define USEVERSIONMIB
+
+/* Reports errors the agent runs into */
+/* (typically its "can't fork, no mem" problems) */
+#define ERRORMIBNUM 101
+#define USEERRORMIB
+
+/* The sub id of EXENSIBLEMIB returned to queries of
+   .iso.org.dod.internet.mgmt.mib-2.system.sysObjectID.0 */
+#define AGENTID 250
+
+/* This ID is returned after the AGENTID above.  IE, the resulting
+   value returned by a query to sysObjectID is
+   EXTENSIBLEMIB.AGENTID.???, where ??? is defined below by OSTYPE */
+
+#define HPUX9ID 1
+#define SUNOS4ID 2
+#define SOLARISID 3
+#define OSFID 4
+#define ULTRIXID 5
+#define HPUX10ID 6
+#define NETBSD1ID 7
+#define FREEBSDID 8
+#define IRIXID 9
+#define LINUXID 10
+#define BSDIID 11
+#define OPENBSDID 12
+#define UNKNOWNID 255
+
+#ifdef hpux9
+#define OSTYPE HPUX9ID
+#endif
+#ifdef hpux10
+#define OSTYPE HPUX10ID
+#endif
+#ifdef sunos4
+#define OSTYPE SUNOS4ID
+#endif
+#ifdef solaris2
+#define OSTYPE SOLARISID
+#endif
+#if defined(osf3) || defined(osf4)
+#define OSTYPE OSFID
+#endif
+#ifdef ultrix4
+#define OSTYPE ULTRIXID
+#endif
+#ifdef netbsd1
+#define OSTYPE NETBSD1ID
+#endif
+#ifdef freebsd2
+#define OSTYPE FREEBSDID
+#endif
+#if defined(irix6) || defined(irix5)
+#define OSTYPE IRIXID
+#endif
+#ifdef linux
+#define OSTYPE LINUXID
+#endif
+#if defined(bsdi2) || defined(bsdi3)
+#define OSTYPE BSDIID
+#endif
+#ifdef openbsd2
+#define OSTYPE OPENBSDID
+#endif
+/* unknown */
+#ifndef OSTYPE
+#define OSTYPE UNKNOWNID
+#endif
+
+/* The enterprise number has been assigned by the IANA group.   */
+/* Optionally, this may point to the location in the tree your  */
+/* company/organization has been allocated.                     */
+/* The assigned enterprise number for the NET_SNMP MIB modules. */
+#define ENTERPRISE_OID			8072
+#define ENTERPRISE_MIB			1,3,6,1,4,1,8072
+#define ENTERPRISE_DOT_MIB		1.3.6.1.4.1.8072
+#define ENTERPRISE_DOT_MIB_LENGTH	7
+
+/* The assigned enterprise number for sysObjectID. */
+#define SYSTEM_MIB		1,3,6,1,4,1,2021,AGENTID,OSTYPE
+#define SYSTEM_DOT_MIB		1.3.6.1.4.1.2021.AGENTID.OSTYPE
+#define SYSTEM_DOT_MIB_LENGTH	9
+
+/* The assigned enterprise number for notifications. */
+#define NOTIFICATION_MIB		1,3,6,1,4,1,2021,251
+#define NOTIFICATION_DOT_MIB		1.3.6.1.4.1.2021.251
+#define NOTIFICATION_DOT_MIB_LENGTH	8
+
+/* this is the location of the ucdavis mib tree.  It shouldn't be
+   changed, as the places it is used are expected to be constant
+   values or are directly tied to the UCD-SNMP-MIB. */
+#define UCDAVIS_OID		2021
+#define UCDAVIS_MIB		1,3,6,1,4,1,2021
+#define UCDAVIS_DOT_MIB		1.3.6.1.4.1.2021
+#define UCDAVIS_DOT_MIB_LENGTH	7
+
+/* how long to wait (seconds) for error querys before reseting the error trap.*/
+#define ERRORTIMELENGTH 600
+
+/* Exec command to fix PROC problems */
+/* %s will be replaced by the process name in error */
+
+#define PROCFIXCMD "/usr/local/bin/perl /local/scripts/fixproc %s"
+
+/* Exec command to fix EXEC problems */
+/* %s will be replaced by the exec/script name in error */
+
+#define EXECFIXCMD "/usr/local/bin/perl /local/scripts/fixproc %s"
+
+/* Should exec output Cashing be used (speeds up things greatly), and
+   if so, After how many seconds should the cache re-newed?  Note:
+   Don't define CASHETIME to disable cashing completely */
+
+#define EXCACHETIME 30
+#define CACHEFILE ".snmp-exec-cache"
+#define MAXCACHESIZE (200*80)   /* roughly 200 lines max */
+
+#define MAXDISKS 10                      /* can't scan more than this number */
+
+/* misc defaults */
+
+/* default of 100 meg minimum if the minimum size is not specified in
+   the config file */
+#define DEFDISKMINIMUMSPACE 100000
+
+#define DEFMAXLOADAVE 12.0      /* default maximum load average before error */
+
+#define MAXREADCOUNT 20   /* max times to loop reading output from
+                             execs.  Because of sleep(1)s, this will also
+                             be time to wait (in seconds) for exec to finish */
+
+#define SNMPBLOCK 1       /* Set to 1 if you want snmpgets to block and never
+                             timeout.  Original CMU code had this
+                             hardcoded into the code as = 1 */
+
+#define RESTARTSLEEP 5    /* How long to wait after a snmpset to
+                             EXTENSIBLEMIB.VERSIONMIBNUM.VERRESTARTAGENT
+                             before restarting the agent.  This is
+                             necessary to finish the snmpset reply
+                             before restarting. */
+
+/* Number of community strings to store */
+#define NUM_COMMUNITIES	5
+
+/* UNdefine to allow specifying zero-length community string */
+/* #define NO_ZEROLENGTH_COMMUNITY 1 */
+
+/* #define EXIT_ON_BAD_KLREAD  */
+/* define to exit the agent on a bad kernel read */
+
+#define LASTFIELD -1      /* internal define */
+
+/* Define if you have the strdup function.  */
+#define HAVE_STRDUP 1
+
+/* Define if you have the strerror function.  */
+#define HAVE_STRERROR 1
+
+#ifndef HAVE_STRCHR
+#ifdef HAVE_INDEX
+# define strchr index
+# define strrchr rindex
+#endif
+#endif
+
+#ifndef HAVE_INDEX
+#ifdef HAVE_STRCHR
+# define index strchr
+# define rindex strrchr
+#endif
+#endif
+
+#ifndef HAVE_MEMCPY
+#ifdef HAVE_BCOPY
+# define memcpy(d, s, n) bcopy ((s), (d), (n))
+# define memmove(d, s, n) bcopy ((s), (d), (n))
+# define memcmp bcmp
+#endif
+#endif
+
+#ifndef HAVE_MEMMOVE
+#ifdef HAVE_MEMCPY
+# define memmove memcpy
+#endif
+#endif
+
+#ifndef HAVE_BCOPY
+#ifdef HAVE_MEMCPY
+# define bcopy(s, d, n) memcpy ((d), (s), (n))
+# define bzero(p,n) memset((p),(0),(n))
+# define bcmp memcmp
+#endif
+#endif
+
+
+/* define random functions */
+
+#ifndef HAVE_RANDOM
+#ifdef HAVE_LRAND48
+#define random lrand48
+#define srandom(s) srand48(s)
+#else
+#ifdef HAVE_RAND
+#define random rand
+#define srandom(s) srand(s)
+#endif
+#endif
+#endif
+
+/* define signal if DNE */
+
+#ifndef HAVE_SIGNAL
+#ifdef HAVE_SIGSET
+#define signal(a,b) sigset(a,b)
+#endif
+#endif
+
+/* Not-to-be-compiled macros for use by configure only */
+#define config_require(x)
+#define config_arch_require(x,y)
+#define config_parse_dot_conf(w,x,y,z)
+#define config_add_mib(x)
+
+#ifndef DONT_INC_STRUCTS
+/*#include "agent/mibgroup/struct.h" */
+#endif
+
+#ifndef linux
+#ifndef solaris2
+#define bsdlike
+#endif
+#endif
+
+#ifdef WIN32
+
+#define HAVE_GETPID 1
+
+int strcasecmp(const char *s1, const char *s2);
+#define vsnprintf _vsnprintf
+#define snprintf  _snprintf
+
+#define EADDRINUSE	WSAEADDRINUSE
+
+#define ENV_SEPARATOR ";"
+#define ENV_SEPARATOR_CHAR ';'
+
+
+#else
+
+#define ENV_SEPARATOR ":"
+#define ENV_SEPARATOR_CHAR ':'
+
+#endif
+
+typedef unsigned short mode_t;
+
+#define AGENT_DIRECTORY_MODE 0700
+
+/* reverse encoding BER packets is both faster and more efficient in space. */
+#define USE_REVERSE_ASNENCODING       1
+#define DEFAULT_ASNENCODING_DIRECTION 1 /* 1 = reverse, 0 = forwards */
+
+#ifndef NETSNMP_INLINE
+#   define NETSNMP_NO_INLINE
+#   define NETSNMP_INLINE
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
diff -Naur tomato/release/src/router/snmp/win32/config.h.borland tomato121/release/src/router/snmp/win32/config.h.borland
--- tomato/release/src/router/snmp/win32/config.h.borland	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/win32/config.h.borland	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,848 @@
+/* config.h:  a general config file */
+
+/* Define IN_UCD_SNMP_SOURCE if compiling inside the ucd-snmp source tree */
+#define IN_UCD_SNMP_SOURCE 1
+
+/* UC-Davis' IANA-assigned enterprise number is 2021 */
+#define ENTERPRISE_NUMBER 2021
+
+/* don't change these values! */
+#define SNMPV1      0xAAAA       /* readable by anyone */
+#define SNMPV2ANY   0xA000       /* V2 Any type (includes NoAuth) */
+#define SNMPV2AUTH  0x8000       /* V2 Authenticated requests only */
+
+/* default list of mibs to load */
+#define DEFAULT_MIBS "IP-MIB;IF-MIB;TCP-MIB;UDP-MIB;SNMPv2-MIB;RFC1213-MIB;UCD-SNMP-MIB;UCD-DEMO-MIB;SNMP-TARGET-MIB;SNMP-VIEW-BASED-ACM-MIB;SNMP-COMMUNITY-MIB;UCD-DLMOD-MIB;SNMP-FRAMEWORK-MIB;SNMP-MPD-MIB;SNMP-USER-BASED-SM-MIB;SNMP-NOTIFICATION-MIB;SNMPv2-TM"
+
+/* default location to look for mibs to load using the above tokens
+   and/or those in the MIBS envrionment variable*/
+
+#define DEFAULT_MIBDIRS "/USR/MIBS"
+
+/* default mib files to load, specified by path. */
+
+#undef DEFAULT_MIBFILES
+
+/* should we compile to use special opaque types: float, double,
+   counter64, i64, ui64, union? */
+#define OPAQUE_SPECIAL_TYPES 1
+
+/* comment the next line if you are compiling with libsnmp.h
+   and are not using the UC-Davis SNMP library. */
+#define UCD_SNMP_LIBRARY 1
+
+/* define if you want to compile support for both authentication and
+   privacy support. */
+#define SCAPI_AUTHPRIV 1
+
+/* define if you are using the internal MD5 code */
+#define USE_INTERNAL_MD5 1
+
+/* add in recent CMU library extensions (not complete) */
+#define CMU_COMPATIBLE 1
+
+/* should "--" comments in mibs be a comment till the end of the line
+   or also until another "--", the latter being the technically
+   correct. */
+#undef MIB_COMMENT_IS_EOL_TERMINATED
+
+/* debugging stuff */
+#undef SNMP_NO_DEBUGGING           /* if defined, we optimize the code
+                                      to exclude all debugging calls. */
+#define SNMP_ALWAYS_DEBUG 0        /* Always print debugging information and
+                                      ignore the -D flag passed to the cmds */
+
+/* Define if using alloca.c.  */
+#undef C_ALLOCA
+
+/* Define to one of _getb67, GETB67, getb67 for Cray-2 and Cray-YMP systems.
+   This function is required for alloca.c support on those systems.  */
+#undef CRAY_STACKSEG_END
+
+/* Define if you have alloca, as a function or macro.  */
+#undef HAVE_ALLOCA
+
+/* Define if you have <alloca.h> and it should be used (not on Ultrix).  */
+#undef HAVE_ALLOCA_H
+
+/* Define if you have the getmntent function.  */
+#undef HAVE_GETMNTENT
+
+/* Define if you have <sys/wait.h> that is POSIX.1 compatible.  */
+#undef HAVE_SYS_WAIT_H
+
+/* Define to `long' if <sys/types.h> doesn't define.  */
+#undef off_t
+
+/* Define to `int' if <sys/types.h> doesn't define.  */
+#undef pid_t
+
+/* Define as the return type of signal handlers (int or void).  */
+#define RETSIGTYPE void
+
+/* Define if you have raise() instead of alarm() */
+
+#define HAVE_RAISE 1
+
+/* If using the C implementation of alloca, define if you know the
+   direction of stack growth for your system; otherwise it will be
+   automatically deduced at run-time.
+ STACK_DIRECTION > 0 => grows toward higher addresses
+ STACK_DIRECTION < 0 => grows toward lower addresses
+ STACK_DIRECTION = 0 => direction of growth unknown
+ */
+#undef STACK_DIRECTION
+
+/* Define if you have the ANSI C header files.  */
+#define STDC_HEADERS 1
+
+/* Define if you can safely include both <sys/time.h> and <time.h>.  */
+#define TIME_WITH_SYS_TIME 1
+
+/* Define if you have the gettimeofday function.  */
+#undef HAVE_GETTIMEOFDAY
+
+/* Define if you have the <sys/time.h> header file.  */
+#undef HAVE_SYS_TIME_H
+
+/* Define if your processor stores words with the most significant
+   byte first (like Motorola and SPARC, unlike Intel and VAX).  */
+#undef WORDS_BIGENDIAN
+
+#define SNMPDLMODPATH "/USR/LIB/DLMOD"
+#define SNMPLIBPATH "/USR/LIB"
+#define SNMPSHAREPATH "/USR/SHARE/SNMP"
+#define SNMPCONFPATH "/USR"
+
+/* SNMPPATH contains (more) important files */
+
+#undef SNMPPATH
+
+/* LOGFILE:  If defined it closes stdout/err/in and opens this in out/err's
+   place.  (stdin is closed so that sh scripts won't wait for it) */
+
+#undef LOGFILE
+
+/* PERSISTENT_DIRECTORY: If defined, the library is capabile of saving
+   persisant information to this directory in the form of configuration
+   lines: PERSISTENT_DIRECTORY/NAME.persistent.conf */
+#define PERSISTENT_DIRECTORY "/USR/SNMP/PERSIST"
+
+#define MAX_PERSISTENT_BACKUPS 10
+/* default system contact */
+#define SYS_CONTACT "unknown"
+
+/* system location */
+#define SYS_LOC "unknown"
+
+/* location of UNIX kernel */
+#define KERNEL_LOC "unknown"
+
+/* location of mount table list */
+#define ETC_MNTTAB "unknown"
+
+/* location of swap device (ok if not found) */
+#undef DMEM_LOC
+
+/* define rtentry to ortentry on SYSV machines (alphas) */
+#define RTENTRY rtentry;
+
+/* Use BSD 4.4 routing table entries? */
+#undef RTENTRY_4_4
+
+/* Does the rtentry structure have a rt_next node */
+#undef RTENTRY_RT_NEXT
+
+#define PSCMD "/bin/ps"
+
+/* Where is the uname command */
+#define UNAMEPROG "/bin/uname"
+
+/* testing code sections. */
+/* #undef SNMP_TESTING_CODE */
+
+/* If you don't have root access don't exit upon kmem errors */
+#undef NO_ROOT_ACCESS
+
+/* Define if you have the bcopy function.  */
+#undef HAVE_BCOPY
+
+/* Define if you have the gethostbyname function.  */
+#define HAVE_GETHOSTBYNAME 1
+
+/* Define if you have the gethostname function.  */
+#define HAVE_GETHOSTNAME 1
+
+/* Define if you have the getloadavg function.  */
+#undef HAVE_GETLOADAVG
+
+/* Define if you have the getservbyname function.  */
+#define HAVE_GETSERVBYNAME 1
+
+/* Define if you have the setenv function.  */
+#undef HAVE_SETENV
+
+/* Define if you have the strtoul function.  */
+#define HAVE_STRTOUL 1
+
+/* Define if you have the vsnprintf function.  */
+#define HAVE_VSNPRINTF 1
+
+/* Define if you have the index function.  */
+#undef HAVE_INDEX
+
+/* Define if you have the kvm_openfiles function.  */
+#undef HAVE_KVM_OPENFILES
+
+/* Define if you have the lrand48 function.  */
+#undef HAVE_LRAND48
+
+/* Define if you have the memcpy function.  */
+#define HAVE_MEMCPY 1
+
+/* Define if you have the memmove function.  */
+#define HAVE_MEMMOVE 1
+
+/* Define if you have the rand function.  */
+#define HAVE_RAND 1
+
+/* Define if you have the random function.  */
+#undef HAVE_RANDOM
+
+/* Define if you have the select function.  */
+#undef HAVE_SELECT
+
+/* Define if you have the setmntent function.  */
+#undef HAVE_SETMNTENT
+
+/* Define if you have the sigblock function.  */
+#undef HAVE_SIGBLOCK
+
+/* Define if you have the sighold function.  */
+#undef HAVE_SIGHOLD
+
+/* Define if you have the signal function.  */
+#undef HAVE_SIGNAL
+
+/* Define if you have the sigset function.  */
+#undef HAVE_SIGSET
+
+/* Define if you have the socket function.  */
+#define HAVE_SOCKET 1
+
+/* Define if you have <winsock.h> header file. */
+#define HAVE_WINSOCK_H 1
+
+/* Define if you have the closesocket function.  */
+#define HAVE_CLOSESOCKET 1
+
+/* Define if you have the statfs function.  */
+#undef HAVE_STATFS
+
+/* Define if you have the statvfs function.  */
+#undef HAVE_STATVFS
+
+/* Define if you have the strchr function.  */
+#define HAVE_STRCHR 1
+
+/* Define if you have the strcasecmp function */
+#define HAVE_STRCASECMP 1
+
+/* Define if you have the snprintf function */
+#define HAVE_SNPRINTF 1
+
+/* use win32 strdup */
+#define strdup _strdup
+
+/* Define if you have the strtol function.  */
+#define HAVE_STRTOL 1
+
+/* Define if you have the tcgetattr function.  */
+/* #define HAVE_TCGETATTR 1 */
+
+/* Define if you have the uname function.  */
+#undef HAVE_UNAME
+
+/* Define if you have <io.h> header file. */
+#define HAVE_IO_H 1
+
+/* Define if you have <process.h> header file. (Win32-getpid) */
+#define HAVE_PROCESS_H 1
+
+/* Define if you have the <arpa/inet.h> header file.  */
+#undef HAVE_ARPA_INET_H
+
+/* Define if you have the <dirent.h> header file.  */
+#undef HAVE_DIRENT_H
+
+/* Define if you have the <err.h> header file.  */
+#undef HAVE_ERR_H
+
+/* Define if you have the <fcntl.h> header file.  */
+#define HAVE_FCNTL_H 1
+
+/* Define if you have the <fstab.h> header file.  */
+#undef HAVE_FSTAB_H
+
+/* Define if you have the <inet/mib2.h> header file.  */
+#undef HAVE_INET_MIB2_H
+
+/* Define if you have the <kstat.h> header file.  */
+#undef HAVE_KSTAT_H
+
+/* Define if you have the <kvm.h> header file.  */
+#undef HAVE_KVM_H
+
+/* Define if you have the <limits.h> header file.  */
+#define HAVE_LIMITS_H 1
+
+/* Define if you have the <machine/param.h> header file.  */
+#undef HAVE_MACHINE_PARAM_H
+
+/* Define if you have the <machine/pte.h> header file.  */
+#undef HAVE_MACHINE_PTE_H
+
+/* Define if you have the <malloc.h> header file.  */
+#undef HAVE_MALLOC_H
+
+/* Define if you have the <mntent.h> header file.  */
+#undef HAVE_MNTENT_H
+
+/* Define if you have the <mtab.h> header file.  */
+#undef HAVE_MTAB_H
+
+/* Define if you have the <ndir.h> header file.  */
+#undef HAVE_NDIR_H
+
+/* Define if you have the <net/if_dl.h> header file.  */
+#undef HAVE_NET_IF_DL_H
+
+/* Define if you have the <net/if_types.h> header file.  */
+#undef HAVE_NET_IF_TYPES_H
+
+/* Define if you have the <netinet/icmp_var.h> header file.  */
+#undef HAVE_NETINET_ICMP_VAR_H
+
+/* Define if you have the <netinet/if_ether.h> header file.  */
+#undef HAVE_NETINET_IF_ETHER_H
+
+/* Define if you have the <netinet/in.h> header file.  */
+#undef HAVE_NETINET_IN_H
+
+/* Define if you have the <netinet/in_pcb.h> header file.  */
+#undef HAVE_NETINET_IN_PCB_H
+
+/* Define if you have the <netinet/in_var.h> header file.  */
+#undef HAVE_NETINET_IN_VAR_H
+
+/* Define if you have the <netinet/ip_var.h> header file.  */
+#undef HAVE_NETINET_IP_VAR_H
+
+/* Define if you have the <netinet/tcp_fsm.h> header file.  */
+#undef HAVE_NETINET_TCP_FSM_H
+
+/* Define if you have the <netinet/tcp_timer.h> header file.  */
+#undef HAVE_NETINET_TCP_TIMER_H
+
+/* Define if you have the <netinet/tcp_var.h> header file.  */
+#undef HAVE_NETINET_TCP_VAR_H
+
+/* Define if you have the <netinet/tcpip.h> header file.  */
+#undef HAVE_NETINET_TCPIP_H
+
+/* Define if you have the <netinet/udp_var.h> header file.  */
+#undef HAVE_NETINET_UDP_VAR_H
+
+/* Define if you have the <sgtty.h> header file.  */
+#undef HAVE_SGTTY_H
+
+/* Define if you have the <stdarg.h> header file.  */
+#define HAVE_STDARG_H 1
+
+/* Define if you have the <stdlib.h> header file.  */
+#define HAVE_STDLIB_H 1
+
+/* Define if you have the <string.h> header file.  */
+#define HAVE_STRING_H 1
+
+/* Define if you have the <sys/conf.h> header file.  */
+#undef HAVE_SYS_CONF_H
+
+/* Define if you have the <sys/dir.h> header file.  */
+#undef HAVE_SYS_DIR_H
+
+/* Define if you have the <sys/dmap.h> header file.  */
+#undef HAVE_SYS_DMAP_H
+
+/* Define if you have the <sys/file.h> header file.  */
+#undef HAVE_SYS_FILE_H
+
+/* Define if you have the <sys/filio.h> header file.  */
+#undef HAVE_SYS_FILIO_H
+
+/* Define if you have the <sys/fixpoint.h> header file.  */
+#undef HAVE_SYS_FIXPOINT_H
+
+/* Define if you have the <sys/fs.h> header file.  */
+#undef HAVE_SYS_FS_H
+
+/* Define if you have the <sys/stat.h> header file.  */
+#define HAVE_SYS_STAT_H 1
+
+/* Define if you have the <sys/hashing.h> header file.  */
+#undef HAVE_SYS_HASHING_H
+
+/* Define if you have the <sys/ioctl.h> header file.  */
+#undef HAVE_SYS_IOCTL_H
+
+/* Define if you have the <sys/mbuf.h> header file.  */
+#undef HAVE_SYS_MBUF_H
+
+/* Define if you have the <sys/mnttab.h> header file.  */
+#undef HAVE_SYS_MNTTAB_H
+
+/* Define if you have the <sys/mount.h> header file.  */
+#undef HAVE_SYS_MOUNT_H
+
+/* Define if you have the <sys/ndir.h> header file.  */
+#undef HAVE_SYS_NDIR_H
+
+/* Define if you have the <sys/param.h> header file.  */
+#undef HAVE_SYS_PARAM_H
+
+/* Define if you have the <sys/proc.h> header file.  */
+#undef HAVE_SYS_PROC_H
+
+/* Define if you have the <sys/protosw.h> header file.  */
+#undef HAVE_SYS_PROTOSW_H
+
+/* Define if you have the <sys/select.h> header file.  */
+#undef HAVE_SYS_SELECT_H
+
+/* Define if you have the <sys/sockio.h> header file.  */
+#undef HAVE_SYS_SOCKIO_H
+
+/* Define if you have the <sys/statvfs.h> header file.  */
+#undef HAVE_SYS_STATVFS_H
+
+/* Define if you have the <sys/swap.h> header file.  */
+#undef HAVE_SYS_SWAP_H
+
+/* Define if you have the <sys/sysctl.h> header file.  */
+#undef HAVE_SYS_SYSCTL_H
+
+/* Define if you have the <sys/tcpipstats.h> header file.  */
+#undef HAVE_SYS_TCPIPSTATS_H
+
+/* Define if you have the <sys/user.h> header file.  */
+#undef HAVE_SYS_USER_H
+
+/* Define if you have the <sys/utsname.h> header file.  */
+#undef HAVE_SYS_UTSNAME_H
+
+/* Define if you have the <sys/vfs.h> header file.  */
+#undef HAVE_SYS_VFS_H
+
+/* Define if you have the <sys/vm.h> header file.  */
+#undef HAVE_SYS_VM_H
+
+/* Define if you have the <sys/vmmac.h> header file.  */
+#undef HAVE_SYS_VMMAC_H
+
+/* Define if you have the <sys/vmmeter.h> header file.  */
+#undef HAVE_SYS_VMMETER_H
+
+/* Define if you have the <sys/vmparam.h> header file.  */
+#undef HAVE_SYS_VMPARAM_H
+
+/* Define if you have the <sys/vmsystm.h> header file.  */
+#undef HAVE_SYS_VMSYSTM_H
+
+/* Define if you have the <syslog.h> header file.  */
+#undef HAVE_SYSLOG_H
+
+/* Define if you have the <ufs/ffs/fs.h> header file.  */
+#undef HAVE_UFS_FFS_FS_H
+
+/* Define if you have the <ufs/fs.h> header file.  */
+#undef HAVE_UFS_FS_H
+
+/* Define if you have the <ufs/ufs/dinode.h> header file.  */
+#undef HAVE_UFS_UFS_DINODE_H
+
+/* Define if you have the <unistd.h> header file.  */
+#undef HAVE_UNISTD_H
+
+/* Define if you have the <utsname.h> header file.  */
+#undef HAVE_UTSNAME_H
+
+/* Define if you have the <vm/swap_pager.h> header file.  */
+#undef HAVE_VM_SWAP_PAGER_H
+
+/* Define if you have the <vm/vm.h> header file.  */
+#undef HAVE_VM_VM_H
+
+/* Define if you have the <xti.h> header file.  */
+#undef HAVE_XTI_H
+
+/* Define if you have the crypto library (-lcrypto).  */
+#undef HAVE_LIBCRYPTO
+
+/* Define if you have the elf library (-lelf).  */
+#undef HAVE_LIBELF
+
+/* Define if you have the kstat library (-lkstat).  */
+#undef HAVE_LIBKSTAT
+
+/* Define if you have the kvm library (-lkvm).  */
+#undef HAVE_LIBKVM
+
+/* Define if you have the m library (-lm).  */
+#undef HAVE_LIBM
+
+/* Define if you have the mld library (-lmld).  */
+#undef HAVE_LIBMLD
+
+/* Define if you have the nsl library (-lnsl).  */
+#undef HAVE_LIBNSL
+
+/* Define if you have the socket library (-lsocket).  */
+#undef HAVE_LIBSOCKET
+
+/* ifnet structure tests */
+#undef STRUCT_IFNET_HAS_IF_BAUDRATE
+#undef STRUCT_IFNET_HAS_IF_TYPE
+#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_NOPROTO
+#undef STRUCT_IFNET_HAS_IF_OMCASTS
+#undef STRUCT_IFNET_HAS_IF_XNAME
+#undef STRUCT_IFNET_HAS_IF_OBYTES
+#undef STRUCT_IFNET_HAS_IF_IBYTES
+#undef STRUCT_IFNET_HAS_IF_ADDRLIST
+
+/* tcpstat.tcps_rcvmemdrop */
+#undef STRUCT_TCPSTAT_HAS_TCPS_RCVMEMDROP
+
+/* udpstat.udps_discard */
+#undef STRUCT_UDPSTAT_HAS_UDPS_DISCARD
+
+/* arphd.at_next */
+#undef STRUCT_ARPHD_HAS_AT_NEXT
+
+/* ifaddr.ifa_next */
+#undef STRUCT_IFADDR_HAS_IFA_NEXT
+
+/* ifnet.if_mtu */
+#undef STRUCT_IFNET_HAS_IF_MTU
+
+/* ifnet needs to have _KERNEL defined */
+#undef IFNET_NEEDS_KERNEL
+
+/* sysctl works to get boottime, etc... */
+#undef CAN_USE_SYSCTL
+
+/* type check for in_addr_t */
+#define in_addr_t u_long
+
+/* define if your compiler (processor) defines __FUNCTION__ for you */
+#undef HAVE_CPP_UNDERBAR_FUNCTION_DEFINED
+
+/* mib pointer to the top of the extensible tree.  This has been
+ assigned to UCDavis by the iana group.  Optionally, point this to the
+ location in the tree your company/organization has been allocated. */
+
+/* location of the extensible mib tree */
+#define EXTENSIBLEMIB 1,3,6,1,4,1,2021
+/* location of the extensible mib tree */
+#define EXTENSIBLEDOTMIB 1.3.6.1.4.1.2021
+/* count the above numbers */
+#define EXTENSIBLENUM 7
+
+/* the ErrorFlag is V1 accessable because HP Openview does not support
+   V2.  You can make this list of pairs as long as you want, just make
+   sure to end it in -1.*/
+
+#define SECURITYEXCEPTIONS {100,SNMPV1,-1} /* the ErrorFlag is V1 */
+
+/* Mib-2 tree Info */
+/* These are the system information variables. */
+
+#define VERS_DESC   "unknown"             /* overridden at run time */
+#define SYS_NAME    "unknown"             /* overridden at run time */
+
+/* comment out the second define to turn off functionality for any of
+   these: (See README for details) */
+
+/*   proc PROCESSNAME [MAX] [MIN] */
+#define PROCMIBNUM 2
+#define USEPROCMIB
+
+/*   exec/shell NAME COMMAND      */
+#define SHELLMIBNUM 8
+#define USESHELLMIB
+
+/*   swap MIN                     */
+#define MEMMIBNUM 4
+#if defined(hpux9) || defined(bsdi2)
+#define USEMEMMIB
+#endif
+
+/*   disk DISK MINSIZE            */
+#define DISKMIBNUM 9
+#if (HAVE_FSTAB_H || HAVE_SYS_STATVFS_H)
+#define USEDISKMIB
+#endif
+
+/*   load 1 5 15                  */
+#define LOADAVEMIBNUM 10
+#define USELOADAVEMIB
+
+/*   pass MIBOID command */
+#define USEPASSMIB
+
+/* which version are you using? This mibloc will tell you */
+#define VERSIONMIBNUM 100
+#define USEVERSIONMIB
+
+/* Reports errors the agent runs into */
+/* (typically its "can't fork, no mem" problems) */
+#define ERRORMIBNUM 101
+#define USEERRORMIB
+
+/* The sub id of EXENSIBLEMIB returned to queries of
+   .iso.org.dod.internet.mgmt.mib-2.system.sysObjectID.0 */
+#define AGENTID 250
+
+/* This ID is returned after the AGENTID above.  IE, the resulting
+   value returned by a query to sysObjectID is
+   EXTENSIBLEMIB.AGENTID.???, where ??? is defined below by OSTYPE */
+
+#define HPUX9ID 1
+#define SUNOS4ID 2
+#define SOLARISID 3
+#define OSFID 4
+#define ULTRIXID 5
+#define HPUX10ID 6
+#define NETBSD1ID 7
+#define FREEBSDID 8
+#define IRIXID 9
+#define LINUXID 10
+#define BSDIID 11
+#define OPENBSDID 12
+#define UNKNOWNID 255
+
+#ifdef hpux9
+#define OSTYPE HPUX9ID
+#endif
+#ifdef hpux10
+#define OSTYPE HPUX10ID
+#endif
+#ifdef sunos4
+#define OSTYPE SUNOS4ID
+#endif
+#ifdef solaris2
+#define OSTYPE SOLARISID
+#endif
+#if defined(osf3) || defined(osf4)
+#define OSTYPE OSFID
+#endif
+#ifdef ultrix4
+#define OSTYPE ULTRIXID
+#endif
+#ifdef netbsd1
+#define OSTYPE NETBSD1ID
+#endif
+#ifdef freebsd2
+#define OSTYPE FREEBSDID
+#endif
+#if defined(irix6) || defined(irix5)
+#define OSTYPE IRIXID
+#endif
+#ifdef linux
+#define OSTYPE LINUXID
+#endif
+#if defined(bsdi2) || defined(bsdi3)
+#define OSTYPE BSDIID
+#endif
+#ifdef openbsd2
+#define OSTYPE OPENBSDID
+#endif
+/* unknown */
+#ifndef OSTYPE
+#define OSTYPE UNKNOWNID
+#endif
+
+/* how long to wait (seconds) for error querys before reseting the error trap.*/
+#define ERRORTIMELENGTH 600
+
+/* Exec command to fix PROC problems */
+/* %s will be replaced by the process name in error */
+
+#define PROCFIXCMD "/usr/local/bin/perl /local/scripts/fixproc %s"
+
+/* Exec command to fix EXEC problems */
+/* %s will be replaced by the exec/script name in error */
+
+#define EXECFIXCMD "/usr/local/bin/perl /local/scripts/fixproc %s"
+
+/* Should exec output Cashing be used (speeds up things greatly), and
+   if so, After how many seconds should the cache re-newed?  Note:
+   Don't define CASHETIME to disable cashing completely */
+
+#define EXCACHETIME 30
+#define CACHEFILE ".snmp-exec-cache"
+#define MAXCACHESIZE (200*80)   /* roughly 200 lines max */
+
+#define MAXDISKS 10                      /* can't scan more than this number */
+
+/* misc defaults */
+
+/* default of 100 meg minimum if the minimum size is not specified in
+   the config file */
+#define DEFDISKMINIMUMSPACE 100000
+
+#define DEFMAXLOADAVE 12.0      /* default maximum load average before error */
+
+#define MAXREADCOUNT 20   /* max times to loop reading output from
+                             execs.  Because of sleep(1)s, this will also
+                             be time to wait (in seconds) for exec to finish */
+
+#define SNMPBLOCK 1       /* Set to 1 if you want snmpgets to block and never
+                             timeout.  Original CMU code had this
+                             hardcoded into the code as = 1 */
+
+#define RESTARTSLEEP 5    /* How long to wait after a snmpset to
+                             EXTENSIBLEMIB.VERSIONMIBNUM.VERRESTARTAGENT
+                             before restarting the agent.  This is
+                             necessary to finish the snmpset reply
+                             before restarting. */
+
+/* Number of community strings to store */
+#define NUM_COMMUNITIES	5
+
+/* UNdefine to allow specifying zero-length community string */
+/* #define NO_ZEROLENGTH_COMMUNITY 1 */
+
+/* #define EXIT_ON_BAD_KLREAD  */
+/* define to exit the agent on a bad kernel read */
+
+#define LASTFIELD -1      /* internal define */
+
+/* Define if you have the strdup function.  */
+#undef HAVE_STRDUP
+
+/* Define if you have the strerror function.  */
+#define HAVE_STRERROR 1
+
+#ifndef HAVE_STRCHR
+#ifdef HAVE_INDEX
+# define strchr index
+# define strrchr rindex
+#endif
+#endif
+
+#ifndef HAVE_INDEX
+#ifdef HAVE_STRCHR
+# define index strchr
+# define rindex strrchr
+#endif
+#endif
+
+#ifndef HAVE_MEMCPY
+#ifdef HAVE_BCOPY
+# define memcpy(d, s, n) bcopy ((s), (d), (n))
+# define memmove(d, s, n) bcopy ((s), (d), (n))
+# define memcmp bcmp
+#endif
+#endif
+
+#ifndef HAVE_MEMMOVE
+#ifdef HAVE_MEMCPY
+# define memmove memcpy
+#endif
+#endif
+
+#ifndef HAVE_BCOPY
+#ifdef HAVE_MEMCPY
+# define bcopy(s, d, n) memcpy ((d), (s), (n))
+# define bzero(p,n) memset((p),(0),(n))
+# define bcmp memcmp
+#endif
+#endif
+
+
+/* define random functions */
+
+#ifndef HAVE_RANDOM
+#ifdef HAVE_LRAND48
+#define random lrand48
+#define srandom(s) srand48(s)
+#else
+#ifdef HAVE_RAND
+#define random rand
+#define srandom(s) srand(s)
+#endif
+#endif
+#endif
+
+/* define signal if DNE */
+
+#ifndef HAVE_SIGNAL
+#ifdef HAVE_SIGSET
+#define signal(a,b) sigset(a,b)
+#endif
+#endif
+
+/* Not-to-be-compiled macros for use by configure only */
+#define config_require(x)
+#define config_arch_require(x,y)
+#define config_parse_dot_conf(w,x,y,z)
+#define config_add_mib(x)
+
+#ifndef DONT_INC_STRUCTS
+/*#include "agent/mibgroup/struct.h" */
+#endif
+
+#ifndef linux
+#ifndef solaris2
+#define bsdlike
+#endif
+#endif
+
+/* detect Borland C++ WIN32 definition, add Visual C++ define */
+#ifdef __WIN32__
+#ifndef WIN32
+#define WIN32
+#endif /* WIN32 */
+#endif /* __WIN32__ */
+
+#ifdef WIN32
+
+#define HAVE_GETPID 1
+
+int strcasecmp(const char *s1, const char *s2);
+#define vsnprintf _vsnprintf
+
+#define EADDRINUSE	WSAEADDRINUSE
+
+#define ENV_SEPARATOR ";"
+#define ENV_SEPARATOR_CHAR ';'
+
+
+#else
+
+#define ENV_SEPARATOR ":"
+#define ENV_SEPARATOR_CHAR ':'
+
+#endif
+
+/* typedef unsigned short mode_t; */
+
+#define AGENT_DIRECTORY_MODE 0700
+
+/* reverse encoding BER packets is both faster and more efficient in space. */
+#define USE_REVERSE_ASNENCODING       1
+#define DEFAULT_ASNENCODING_DIRECTION 1 /* 1 = reverse, 0 = forwards */
+
diff -Naur tomato/release/src/router/snmp/win32/.cvsignore tomato121/release/src/router/snmp/win32/.cvsignore
--- tomato/release/src/router/snmp/win32/.cvsignore	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/win32/.cvsignore	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,8 @@
+opt
+bin
+lib
+Release
+Debug
+*.plg
+*.ilk
+*.ncb
diff -Naur tomato/release/src/router/snmp/win32/encode_keychange/.cvsignore tomato121/release/src/router/snmp/win32/encode_keychange/.cvsignore
--- tomato/release/src/router/snmp/win32/encode_keychange/.cvsignore	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/win32/encode_keychange/.cvsignore	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,8 @@
+opt
+bin
+lib
+Release
+Debug
+*.plg
+*.ilk
+*.ncb
diff -Naur tomato/release/src/router/snmp/win32/encode_keychange/encode_keychange.dsp tomato121/release/src/router/snmp/win32/encode_keychange/encode_keychange.dsp
--- tomato/release/src/router/snmp/win32/encode_keychange/encode_keychange.dsp	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/win32/encode_keychange/encode_keychange.dsp	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,90 @@
+# Microsoft Developer Studio Project File - Name="encode_keychange" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Console Application" 0x0103
+
+CFG=encode_keychange - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE 
+!MESSAGE NMAKE /f "encode_keychange.mak".
+!MESSAGE 
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE 
+!MESSAGE NMAKE /f "encode_keychange.mak" CFG="encode_keychange - Win32 Debug"
+!MESSAGE 
+!MESSAGE Possible choices for configuration are:
+!MESSAGE 
+!MESSAGE "encode_keychange - Win32 Release" (based on "Win32 (x86) Console Application")
+!MESSAGE "encode_keychange - Win32 Debug" (based on "Win32 (x86) Console Application")
+!MESSAGE 
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+RSC=rc.exe
+
+!IF  "$(CFG)" == "encode_keychange - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /MD /W3 /GX /O2 /I "." /I ".." /I "..\..\snmplib" /I "..\.." /I "..\..\include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
+# ADD LINK32 libsnmp.lib msvcrt.lib advapi32.lib wsock32.lib kernel32.lib user32.lib oldnames.lib /nologo /subsystem:console /machine:I386 /nodefaultlib /out:"../bin/encode_keychange.exe" /libpath:"..\lib"
+
+!ELSEIF  "$(CFG)" == "encode_keychange - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug"
+# PROP Intermediate_Dir "Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /MTd /W3 /GX /ZI /Od /I "." /I ".." /I "..\..\snmplib" /I "..\.." /I "..\..\include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FR /YX /FD /c
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0xffffffff /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 snmp_d.lib libcmt.lib advapi32.lib wsock32.lib kernel32.lib user32.lib oldnames.lib /nologo /subsystem:console /debug /machine:I386 /nodefaultlib /out:"../bin/encode_keychange_d.exe" /pdbtype:sept /libpath:"../lib"
+
+!ENDIF 
+
+# Begin Target
+
+# Name "encode_keychange - Win32 Release"
+# Name "encode_keychange - Win32 Debug"
+# Begin Source File
+
+SOURCE=..\..\apps\encode_keychange.c
+# End Source File
+# End Target
+# End Project
diff -Naur tomato/release/src/router/snmp/win32/lib/.cvsignore tomato121/release/src/router/snmp/win32/lib/.cvsignore
--- tomato/release/src/router/snmp/win32/lib/.cvsignore	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/win32/lib/.cvsignore	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,3 @@
+*.exp
+*.lib
+
diff -Naur tomato/release/src/router/snmp/win32/libagent/.cvsignore tomato121/release/src/router/snmp/win32/libagent/.cvsignore
--- tomato/release/src/router/snmp/win32/libagent/.cvsignore	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/win32/libagent/.cvsignore	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,8 @@
+opt
+bin
+lib
+Release
+Debug
+*.plg
+*.ilk
+*.ncb
diff -Naur tomato/release/src/router/snmp/win32/libagent/libagent.def tomato121/release/src/router/snmp/win32/libagent/libagent.def
--- tomato/release/src/router/snmp/win32/libagent/libagent.def	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/win32/libagent/libagent.def	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,16 @@
+;       @(#)libagent.def    1.0 10/26/97 (gmarzot@baynetworks.com)
+
+DESCRIPTION     'UCD SNMP Agent Library'
+;CODE            SHARED READ EXECUTE
+;DATA            SHARED READ WRITE
+EXPORTS
+	send_easy_trap
+	init_master_agent
+	init_mib_modules
+	init_agent
+	argvrestartname
+	argvrestart
+	argvrestartp
+	update_config
+	dump_idx_registry
+
diff -Naur tomato/release/src/router/snmp/win32/libagent/libagent.dsp tomato121/release/src/router/snmp/win32/libagent/libagent.dsp
--- tomato/release/src/router/snmp/win32/libagent/libagent.dsp	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/win32/libagent/libagent.dsp	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,112 @@
+# Microsoft Developer Studio Project File - Name="libagent" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Static Library" 0x0104
+
+CFG=libagent - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE 
+!MESSAGE NMAKE /f "libagent.mak".
+!MESSAGE 
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE 
+!MESSAGE NMAKE /f "libagent.mak" CFG="libagent - Win32 Debug"
+!MESSAGE 
+!MESSAGE Possible choices for configuration are:
+!MESSAGE 
+!MESSAGE "libagent - Win32 Release" (based on "Win32 (x86) Static Library")
+!MESSAGE "libagent - Win32 Debug" (based on "Win32 (x86) Static Library")
+!MESSAGE 
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+RSC=rc.exe
+
+!IF  "$(CFG)" == "libagent - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "../lib"
+# PROP Intermediate_Dir "Release"
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
+# ADD CPP /nologo /MD /W3 /GX /O2 /I "." /I ".." /I "..\..\snmplib" /I "..\.." /I "..\..\include" /I "..\..\agent" /I "..\..\agent\mibgroup" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
+# ADD BASE RSC /l 0x409
+# ADD RSC /l 0x409
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LIB32=link.exe -lib
+# ADD BASE LIB32 /nologo
+# ADD LIB32 /nologo /out:"../lib/netsnmpagent.lib"
+
+!ELSEIF  "$(CFG)" == "libagent - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "../lib"
+# PROP Intermediate_Dir "Debug"
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /Z7 /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c
+# ADD CPP /nologo /MTd /W3 /GX /Z7 /Od /I "..\..\agent" /I "..\..\agent\mibgroup" /I "." /I ".." /I "..\..\snmplib" /I "..\.." /I "..\..\include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD BASE RSC /l 0x409
+# ADD RSC /l 0xffffffff
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LIB32=link.exe -lib
+# ADD BASE LIB32 /nologo
+# ADD LIB32 /nologo /out:"../lib/netsnmpagent_d.lib"
+
+!ENDIF 
+
+# Begin Target
+
+# Name "libagent - Win32 Release"
+# Name "libagent - Win32 Debug"
+# Begin Source File
+
+SOURCE=..\..\agent\agent_handler.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\agent\agent_index.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\agent\agent_read_config.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\agent\agent_registry.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\agent\agent_trap.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\agent\snmp_agent.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\agent\snmp_vars.c
+# End Source File
+# End Target
+# End Project
diff -Naur tomato/release/src/router/snmp/win32/libhelpers/libhelpers.dsp tomato121/release/src/router/snmp/win32/libhelpers/libhelpers.dsp
--- tomato/release/src/router/snmp/win32/libhelpers/libhelpers.dsp	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/win32/libhelpers/libhelpers.dsp	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,302 @@
+# Microsoft Developer Studio Project File - Name="libhelpers" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Static Library" 0x0104
+
+CFG=libhelpers - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE 
+!MESSAGE NMAKE /f "libhelpers.mak".
+!MESSAGE 
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE 
+!MESSAGE NMAKE /f "libhelpers.mak" CFG="libhelpers - Win32 Debug"
+!MESSAGE 
+!MESSAGE Possible choices for configuration are:
+!MESSAGE 
+!MESSAGE "libhelpers - Win32 Release" (based on "Win32 (x86) Static Library")
+!MESSAGE "libhelpers - Win32 Debug" (based on "Win32 (x86) Static Library")
+!MESSAGE 
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+RSC=rc.exe
+
+!IF  "$(CFG)" == "libhelpers - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "../lib"
+# PROP Intermediate_Dir "Release"
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
+# ADD CPP /nologo /MD /W3 /GX /O2 /I "." /I ".." /I "..\..\snmplib" /I "..\.." /I "..\..\include" /I "..\..\agent" /I "..\..\agent\mibgroup" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
+# ADD BASE RSC /l 0x409
+# ADD RSC /l 0x409
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LIB32=link.exe -lib
+# ADD BASE LIB32 /nologo
+# ADD LIB32 /nologo /out:"../lib/netsnmphelpers.lib"
+
+!ELSEIF  "$(CFG)" == "libhelpers - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "../lib"
+# PROP Intermediate_Dir "Debug"
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /Z7 /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c
+# ADD CPP /nologo /MTd /W3 /GX /Z7 /Od /I "..\..\agent" /I "..\..\agent\mibgroup" /I "." /I ".." /I "..\..\snmplib" /I "..\.." /I "..\..\include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD BASE RSC /l 0x409
+# ADD RSC /l 0xffffffff
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LIB32=link.exe -lib
+# ADD BASE LIB32 /nologo
+# ADD LIB32 /nologo /out:"../lib/netsnmphelpers_d.lib"
+
+!ENDIF 
+
+# Begin Target
+
+# Name "libhelpers - Win32 Release"
+# Name "libhelpers - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=..\..\agent\helpers\all_helpers.c
+
+!IF  "$(CFG)" == "libhelpers - Win32 Release"
+
+!ELSEIF  "$(CFG)" == "libhelpers - Win32 Debug"
+
+!ENDIF 
+
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\agent\helpers\bulk_to_next.c
+
+!IF  "$(CFG)" == "libhelpers - Win32 Release"
+
+!ELSEIF  "$(CFG)" == "libhelpers - Win32 Debug"
+
+!ENDIF 
+
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\agent\helpers\debug_handler.c
+
+!IF  "$(CFG)" == "libhelpers - Win32 Release"
+
+!ELSEIF  "$(CFG)" == "libhelpers - Win32 Debug"
+
+!ENDIF 
+
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\agent\helpers\instance.c
+
+!IF  "$(CFG)" == "libhelpers - Win32 Release"
+
+!ELSEIF  "$(CFG)" == "libhelpers - Win32 Debug"
+
+!ENDIF 
+
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\agent\helpers\multiplexer.c
+
+!IF  "$(CFG)" == "libhelpers - Win32 Release"
+
+!ELSEIF  "$(CFG)" == "libhelpers - Win32 Debug"
+
+!ENDIF 
+
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\agent\helpers\null.c
+
+!IF  "$(CFG)" == "libhelpers - Win32 Release"
+
+!ELSEIF  "$(CFG)" == "libhelpers - Win32 Debug"
+
+!ENDIF 
+
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\agent\helpers\old_api.c
+
+!IF  "$(CFG)" == "libhelpers - Win32 Release"
+
+!ELSEIF  "$(CFG)" == "libhelpers - Win32 Debug"
+
+!ENDIF 
+
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\agent\helpers\read_only.c
+
+!IF  "$(CFG)" == "libhelpers - Win32 Release"
+
+!ELSEIF  "$(CFG)" == "libhelpers - Win32 Debug"
+
+!ENDIF 
+
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\agent\helpers\serialize.c
+
+!IF  "$(CFG)" == "libhelpers - Win32 Release"
+
+!ELSEIF  "$(CFG)" == "libhelpers - Win32 Debug"
+
+!ENDIF 
+
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\agent\helpers\table.c
+
+!IF  "$(CFG)" == "libhelpers - Win32 Release"
+
+!ELSEIF  "$(CFG)" == "libhelpers - Win32 Debug"
+
+!ENDIF 
+
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\agent\helpers\table_array.c
+
+!IF  "$(CFG)" == "libhelpers - Win32 Release"
+
+!ELSEIF  "$(CFG)" == "libhelpers - Win32 Debug"
+
+!ENDIF 
+
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\agent\helpers\table_data.c
+
+!IF  "$(CFG)" == "libhelpers - Win32 Release"
+
+!ELSEIF  "$(CFG)" == "libhelpers - Win32 Debug"
+
+!ENDIF 
+
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\agent\helpers\table_dataset.c
+
+!IF  "$(CFG)" == "libhelpers - Win32 Release"
+
+!ELSEIF  "$(CFG)" == "libhelpers - Win32 Debug"
+
+!ENDIF 
+
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\agent\helpers\table_iterator.c
+
+!IF  "$(CFG)" == "libhelpers - Win32 Release"
+
+!ELSEIF  "$(CFG)" == "libhelpers - Win32 Debug"
+
+!ENDIF 
+
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hm;inl"
+# Begin Source File
+
+SOURCE=..\..\agent\helpers\all_helpers.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\agent\helpers\bulk_to_next.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\agent\helpers\debug_handler.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\agent\helpers\instance.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\agent\helpers\multiplexer.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\agent\helpers\null.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\agent\helpers\old_api.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\agent\helpers\read_only.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\agent\helpers\serialize.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\agent\helpers\table.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\agent\helpers\table_array.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\agent\helpers\table_data.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\agent\helpers\table_dataset.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\agent\helpers\table_iterator.h
+# End Source File
+# End Group
+# End Target
+# End Project
diff -Naur tomato/release/src/router/snmp/win32/libsnmp/.cvsignore tomato121/release/src/router/snmp/win32/libsnmp/.cvsignore
--- tomato/release/src/router/snmp/win32/libsnmp/.cvsignore	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/win32/libsnmp/.cvsignore	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,8 @@
+opt
+bin
+lib
+Release
+Debug
+*.plg
+*.ilk
+*.ncb
diff -Naur tomato/release/src/router/snmp/win32/libsnmp/libsnmp.dsp tomato121/release/src/router/snmp/win32/libsnmp/libsnmp.dsp
--- tomato/release/src/router/snmp/win32/libsnmp/libsnmp.dsp	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/win32/libsnmp/libsnmp.dsp	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,248 @@
+# Microsoft Developer Studio Project File - Name="libsnmp" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Static Library" 0x0104
+
+CFG=libsnmp - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE 
+!MESSAGE NMAKE /f "libsnmp.mak".
+!MESSAGE 
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE 
+!MESSAGE NMAKE /f "libsnmp.mak" CFG="libsnmp - Win32 Debug"
+!MESSAGE 
+!MESSAGE Possible choices for configuration are:
+!MESSAGE 
+!MESSAGE "libsnmp - Win32 Release" (based on "Win32 (x86) Static Library")
+!MESSAGE "libsnmp - Win32 Debug" (based on "Win32 (x86) Static Library")
+!MESSAGE 
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+RSC=rc.exe
+
+!IF  "$(CFG)" == "libsnmp - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "../lib"
+# PROP Intermediate_Dir "Release"
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
+# ADD CPP /nologo /MD /W3 /GX /O2 /I "." /I ".." /I "..\..\snmplib" /I "..\.." /I "..\..\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
+# ADD BASE RSC /l 0x406
+# ADD RSC /l 0x406
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LIB32=link.exe -lib
+# ADD BASE LIB32 /nologo
+# ADD LIB32 /nologo
+
+!ELSEIF  "$(CFG)" == "libsnmp - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "../lib"
+# PROP Intermediate_Dir "Debug"
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /Z7 /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c
+# ADD CPP /nologo /MTd /W3 /GX /ZI /Od /I "." /I ".." /I "..\..\snmplib" /I "..\.." /I "..\..\include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD BASE RSC /l 0x406
+# ADD RSC /l 0xffffffff
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LIB32=link.exe -lib
+# ADD BASE LIB32 /nologo
+# ADD LIB32 /nologo /out:"../lib/snmp_d.lib"
+
+!ENDIF 
+
+# Begin Target
+
+# Name "libsnmp - Win32 Release"
+# Name "libsnmp - Win32 Debug"
+# Begin Source File
+
+SOURCE=..\..\snmplib\asn1.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\snmplib\callback.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\snmplib\check_varbind.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\snmplib\cmu_compat.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\snmplib\container.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\snmplib\container_binary_array.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\snmplib\data_list.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\snmplib\default_store.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\snmplib\getopt.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\snmplib\int64.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\snmplib\keytools.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\snmplib\lcd_time.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\snmplib\md5.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\snmplib\mib.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\snmplib\mt_support.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\snmplib\oid_stash.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\snmplib\parse.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\snmplib\read_config.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\snmplib\scapi.c
+# End Source File
+# Begin Source File
+
+SOURCE="..\..\snmplib\snmp-tc.c"
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\snmplib\snmp.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\snmplib\snmp_alarm.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\snmplib\snmp_api.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\snmplib\snmp_auth.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\snmplib\snmp_client.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\snmplib\snmp_debug.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\snmplib\snmp_enum.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\snmplib\snmp_logging.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\snmplib\snmp_parse_args.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\snmplib\snmp_secmod.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\snmplib\snmp_transport.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\snmplib\snmp_version.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\snmplib\snmpCallbackDomain.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\snmplib\snmpTCPDomain.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\snmplib\snmpUDPDomain.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\snmplib\snmpusm.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\snmplib\snmpv3.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\snmplib\system.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\snmplib\tools.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\snmplib\ucd_compat.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\snmplib\vacm.c
+# End Source File
+# End Target
+# End Project
diff -Naur tomato/release/src/router/snmp/win32/libsnmp_dll/.cvsignore tomato121/release/src/router/snmp/win32/libsnmp_dll/.cvsignore
--- tomato/release/src/router/snmp/win32/libsnmp_dll/.cvsignore	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/win32/libsnmp_dll/.cvsignore	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,8 @@
+opt
+bin
+lib
+Release
+Debug
+*.plg
+*.ilk
+*.ncb
diff -Naur tomato/release/src/router/snmp/win32/libsnmp_dll/libsnmp.def tomato121/release/src/router/snmp/win32/libsnmp_dll/libsnmp.def
--- tomato/release/src/router/snmp/win32/libsnmp_dll/libsnmp.def	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/win32/libsnmp_dll/libsnmp.def	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,361 @@
+;       @(#)snmp.def    1.0 10/26/97 (gmarzot@baynetworks.com)
+;       Single session API mods by M. Slifcak, Internet Security Systems, Inc.
+
+DESCRIPTION     'UCD SNMP Library'
+;CODE            SHARED READ EXECUTE
+;DATA            SHARED READ WRITE
+EXPORTS
+	asn_parse_int
+	asn_build_int
+	asn_parse_unsigned_int
+	asn_build_unsigned_int
+	asn_parse_string
+	asn_build_string
+	asn_parse_header
+	asn_build_header
+	asn_build_sequence
+	asn_parse_length
+	asn_build_length
+	asn_parse_objid
+	asn_build_objid
+	asn_parse_null
+	asn_build_null
+	asn_parse_bitstring
+	asn_build_bitstring
+	asn_parse_unsigned_int64
+	asn_build_unsigned_int64
+	mib_to_asn_type
+	MDbegin
+	MDupdate
+	print_mib
+	print_mib_tree
+	print_ascii_dump
+	read_objid
+	get_tree_head
+	init_mib
+	init_mib_internals
+	print_variable
+	print_value
+	printI64
+	print_objid
+	fprint_objid
+	print_description
+	fprint_description
+	get_module_node
+	get_node
+	snmp_parse_oid
+	find_node
+	find_best_tree_node
+	get_wild_node
+	find_tree_node
+	clear_tree_flags
+	get_tree
+	read_module
+	read_mib
+	read_all_mibs
+	add_mibdir
+	snmp_get_token
+	snmp_set_mib_warnings
+	snmp_set_save_descriptions
+	add_module_replacement
+	print_subtree
+	print_ascii_dump_tree
+	xdump
+	snmp_parse_var_op
+	snmp_build_var_op
+	printU64
+	u64Subtract
+	zeroU64
+	opendir
+	readdir
+	closedir
+	gettimeofday
+	mkdirhier
+	winsock_startup
+	winsock_cleanup
+	get_myaddr
+	get_uptime
+	snmp_open
+	snmp_open_ex
+	snmp_close
+	snmp_send
+	snmp_read
+	snmp_free_pdu
+	snmp_free_var
+	snmp_select_info
+	snmp_timeout
+	snmp_set_do_debugging
+	snmp_get_do_debugging
+	snmp_get_do_logging
+	snmp_disable_stderrlog
+	snmp_enable_syslog
+	snmp_enable_stderrlog
+	snmp_enable_filelog
+	snmp_log
+	snmp_log_perror
+	snmp_perror
+	snmp_sess_perror
+	snmp_add_null_var
+	snmp_pdu_create
+	snmp_fix_pdu
+	snmp_clone_pdu
+	snmp_clone_mem
+	snmp_set_var_value
+	snmp_set_var_typed_value
+	snmp_set_var_objid
+	snmp_replace_var_types
+	snmp_api_errstring
+	snmp_errstring
+	snmp_set_detail
+	snmp_synch_setup
+	snmp_synch_response
+	snmp_duplicate_objid
+	snmp_get_next_sessid
+	snmp_get_next_transid
+	snmp_increment_statistic
+	snmp_increment_statistic_by
+	snmp_get_statistic
+	init_snmp
+	snmp_shutdown
+	snmp_add_var
+	run_alarms
+	snmp_clone_var
+	print_oid_report
+	print_oid_report_enable_suffix
+	print_oid_report_enable_symbolic
+	print_oid_report_enable_oid
+	print_oid_report_enable_labeledoid
+;	ascii_to_binary
+;	hex_to_binary
+	get_tc_descriptor
+	setenv
+	find_module
+	snmp_async_send
+	snmp_error
+	snmp_sess_init
+	snmp_sess_open
+	snmp_sess_session
+	snmp_sess_send
+	snmp_sess_async_send
+	snmp_sess_select_info
+	snmp_sess_read
+	snmp_sess_timeout
+	snmp_sess_close
+	snmp_sess_error
+	snmp_sess_synch_response
+	snmp_mib_toggle_options
+	snmp_mib_toggle_options_usage
+	read_config_read_data
+	read_config_store_data
+	read_config_print_usage
+	read_config_with_type
+	read_config_store
+	read_config_read_octet_string
+	read_config_save_octet_string
+	read_config_read_memory
+	read_config_read_objid
+	free_config
+	skip_white
+	skip_not_white
+	register_app_config_handler
+	unregister_app_config_handler
+	read_app_config_store
+	unregister_config_handler
+	snmp_set_do_debugging
+	snmp_get_do_debugging
+	debug_indent
+	debug_indent_add
+	debug_is_token_registered
+	debugmsg
+	debugmsg_hex
+	debugmsg_hextli
+	debugmsgtoken
+	debugmsg_var
+	debugmsg_oidrange
+	debug_register_tokens
+	generate_Ku
+	uptime_string
+	memdup
+	dump_chunk
+	init_callbacks
+	snmp_register_callback
+	snmp_unregister_callback
+	snmp_call_callbacks
+	snmp_count_callbacks
+	snmp_callback_available
+	strncasecmp
+	strcasecmp
+	init_snmp_alarm
+	netsnmp_ds_register_premib
+	netsnmp_ds_register_config
+	netsnmp_ds_set_boolean
+	netsnmp_ds_get_boolean
+	netsnmp_ds_toggle_boolean
+	netsnmp_ds_set_int
+	netsnmp_ds_get_int
+	netsnmp_ds_set_string
+	netsnmp_ds_get_string
+	snmp_pdu_add_variable
+	snmp_varlist_add_variable
+	encode_keychange
+	decode_keychange
+	generate_kul
+	sc_init
+	setup_engineID
+	binary_to_hex
+	hex_to_binary2
+	snmp_res_init
+	snmp_res_lock
+	snmp_res_unlock
+	snmp_res_destroy_mutex
+	snmp_mib_toggle_options
+	snmp_mib_toggle_options_usage
+	snmp_in_toggle_options
+	snmp_in_toggle_options_usage
+	snmp_out_toggle_options
+	snmp_out_toggle_options_usage
+	snmp_oid_compare
+	netsnmp_oid_equals
+	usm_free_user
+	usm_add_user
+	usm_create_initial_user
+	usm_parse_create_usmUser
+	usm_save_users
+	usm_parse_config_usmUser
+	usm_get_user
+	usm_get_userList
+	usm_cloneFrom_user
+	usm_create_user
+	usm_remove_user
+	usm_set_user_password
+	read_premib_configs
+	init_snmpv3
+	snmpv3_local_snmpEngineTime
+	snmpv3_local_snmpEngineBoots
+	snmpv3_get_engineID
+	snmpv3_generate_engineID
+	get_default_authtype
+	get_default_privtype
+	register_config_handler
+	read_configs
+	debugmsg_oid
+	config_perror
+	config_pwarn
+	copy_word
+	copy_nword
+	calculate_time_diff
+	vacm_is_configured
+	vacm_createGroupEntry
+	vacm_destroyGroupEntry
+	vacm_destroyAllGroupEntries
+	vacm_createAccessEntry
+	vacm_destroyAccessEntry
+	vacm_destroyAllAccessEntries
+	vacm_createViewEntry
+	vacm_destroyViewEntry
+	vacm_destroyAllViewEntries
+	vacm_getViewEntry
+	vacm_getGroupEntry
+	vacm_getAccessEntry
+	vacm_parse_config_access
+	vacm_parse_config_group
+	vacm_parse_config_view
+	store_vacm
+	vacm_scanGroupInit
+	vacm_scanGroupNext
+	vacm_scanAccessInit
+	vacm_scanAccessNext
+	vacm_scanViewInit
+	vacm_scanViewNext
+	snmp_synch_response_cb
+	snmp_clone_varbind
+	snmp_free_varbind
+	snmp_get_dump_packet
+	snmp_get_quick_print
+	snmp_get_random_access
+	snmp_get_suffix_only
+	snmp_set_dump_packet
+	snmp_set_full_objid
+	snmp_set_quick_print
+	snmp_set_random_access
+	snmp_set_suffix_only
+	snmp_clean_persistent
+	snmp_save_persistent
+	usm_store_users
+	snmp_store
+	atime_diff
+	uatime_hdiff
+	atime_newMarker
+	atime_setMarker
+	atime_ready
+	snmp_strcat
+	fprint_variable
+	sprint_realloc_objid
+	sprint_realloc_asciistring
+	sprint_realloc_variable
+	sprint_realloc_value
+	sprint_realloc_by_type
+	snmp_realloc
+      netsnmp_config
+      netsnmp_config_remember
+      snmp_hex_to_binary
+      snmpv3_options
+      netsnmp_get_version
+      snmp_sess_transport
+      snmp_sess_pointer
+      snmp_decimal_to_binary
+	snmp_alarm_register
+	snmp_alarm_unregister
+      date_n_time
+	snmp_disable_log
+	snmp_enable_syslog_ident
+	netsnmp_sess_log_error
+	snmp_add
+	handle_long_opt
+	netsnmp_transport_free
+	netsnmp_tdomain_transport
+	netsnmp_tdomain_transport_oid
+	netsnmp_tdomain_support
+	netsnmpUDPDomain
+	netsnmp_snmpTCPDomain
+	netsnmp_create_data_list
+	netsnmp_add_list_data
+	netsnmp_get_list_data
+	netsnmp_free_list_data
+	netsnmp_free_all_list_data
+	netsnmp_oid_stash_add_data
+	netsnmp_oid_stash_get_data
+	netsnmp_oid_find_prefix
+	netsnmp_container_init_list
+	netsnmp_strdup_and_null
+	build_oid
+	build_oid_noalloc
+	parse_one_oid_index
+	parse_oid_indexes
+	count_varbinds
+	count_varbinds_of_type
+	se_find_label_in_slist
+	se_find_value_in_slist
+	se_add_pair_to_slist
+	snmp_parse_args
+	snmp_parse_args_descriptions
+	snmp_parse_args_usage
+	netsnmp_callback_open
+	netsnmp_udp_agent_config_tokens_register
+	netsnmp_udp_parse_security
+	netsnmp_udp_getSecName
+	find_sec_mod
+	NetSnmpVersionInfo
+	getopt
+	optarg
+	optind
+	usmNoAuthProtocol
+	usmHMACMD5AuthProtocol
+	usmHMACSHA1AuthProtocol
+	usmNoPrivProtocol
+	usmDESPrivProtocol
+	Mib                     DATA
+	tree_head               DATA
+	snmp_errno              DATA
+;	NetSnmpVersionInfo      DATA
+
diff -Naur tomato/release/src/router/snmp/win32/libsnmp_dll/libsnmp_dll.dsp tomato121/release/src/router/snmp/win32/libsnmp_dll/libsnmp_dll.dsp
--- tomato/release/src/router/snmp/win32/libsnmp_dll/libsnmp_dll.dsp	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/win32/libsnmp_dll/libsnmp_dll.dsp	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,255 @@
+# Microsoft Developer Studio Project File - Name="libsnmp_dll" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
+
+CFG=libsnmp_dll - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE 
+!MESSAGE NMAKE /f "libsnmp_dll.mak".
+!MESSAGE 
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE 
+!MESSAGE NMAKE /f "libsnmp_dll.mak" CFG="libsnmp_dll - Win32 Debug"
+!MESSAGE 
+!MESSAGE Possible choices for configuration are:
+!MESSAGE 
+!MESSAGE "libsnmp_dll - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE "libsnmp_dll - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE 
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+MTL=midl.exe
+RSC=rc.exe
+
+!IF  "$(CFG)" == "libsnmp_dll - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "../lib"
+# PROP Intermediate_Dir "Release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
+# ADD CPP /nologo /MD /W3 /GX /O2 /I "." /I ".." /I "..\..\snmplib" /I "..\..\include" /I "..\.." /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
+# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32
+# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386
+# ADD LINK32 wsock32.lib msvcrt.lib kernel32.lib user32.lib oldnames.lib advapi32.lib /nologo /subsystem:windows /dll /pdb:none /machine:I386 /nodefaultlib /def:".\libsnmp.def" /out:"../bin/libsnmp.dll"
+
+!ELSEIF  "$(CFG)" == "libsnmp_dll - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "../lib"
+# PROP Intermediate_Dir "Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c
+# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "." /I ".." /I "..\..\snmplib" /I "..\.." /I "..\..\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c
+# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32
+# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0xffffffff /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 wsock32.lib msvcrt.lib kernel32.lib user32.lib oldnames.lib advapi32.lib /nologo /subsystem:windows /dll /pdb:none /debug /machine:I386 /nodefaultlib /def:".\libsnmp.def" /out:"../bin/libsnmp_d.dll"
+
+!ENDIF 
+
+# Begin Target
+
+# Name "libsnmp_dll - Win32 Release"
+# Name "libsnmp_dll - Win32 Debug"
+# Begin Source File
+
+SOURCE=..\..\snmplib\asn1.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\snmplib\callback.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\snmplib\check_varbind.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\snmplib\cmu_compat.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\snmplib\container.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\snmplib\container_binary_array.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\snmplib\data_list.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\snmplib\default_store.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\snmplib\getopt.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\snmplib\int64.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\snmplib\keytools.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\snmplib\lcd_time.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\snmplib\md5.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\snmplib\mib.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\snmplib\mt_support.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\snmplib\oid_stash.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\snmplib\parse.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\snmplib\read_config.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\snmplib\scapi.c
+# End Source File
+# Begin Source File
+
+SOURCE="..\..\snmplib\snmp-tc.c"
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\snmplib\snmp.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\snmplib\snmp_alarm.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\snmplib\snmp_api.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\snmplib\snmp_auth.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\snmplib\snmp_client.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\snmplib\snmp_debug.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\snmplib\snmp_enum.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\snmplib\snmp_logging.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\snmplib\snmp_parse_args.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\snmplib\snmp_secmod.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\snmplib\snmp_transport.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\snmplib\snmp_version.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\snmplib\snmpCallbackDomain.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\snmplib\snmpTCPDomain.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\snmplib\snmpUDPDomain.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\snmplib\snmpusm.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\snmplib\snmpv3.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\snmplib\system.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\snmplib\tools.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\snmplib\ucd_compat.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\snmplib\vacm.c
+# End Source File
+# End Target
+# End Project
diff -Naur tomato/release/src/router/snmp/win32/libucdmibs/.cvsignore tomato121/release/src/router/snmp/win32/libucdmibs/.cvsignore
--- tomato/release/src/router/snmp/win32/libucdmibs/.cvsignore	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/win32/libucdmibs/.cvsignore	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,8 @@
+opt
+bin
+lib
+Release
+Debug
+*.plg
+*.ilk
+*.ncb
diff -Naur tomato/release/src/router/snmp/win32/libucdmibs/libucdmibs.def tomato121/release/src/router/snmp/win32/libucdmibs/libucdmibs.def
--- tomato/release/src/router/snmp/win32/libucdmibs/libucdmibs.def	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/win32/libucdmibs/libucdmibs.def	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,17 @@
+;       @(#)libucdmibs.def    1.0 10/26/97 (gmarzot@baynetworks.com)
+
+DESCRIPTION     'UCD SNMP MIBS Library'
+;CODE
+            SHARED READ EXECUTE
+;DATA            SHARED READ WRITE
+EXPORTS
+	send_easy_trap
+	init_master_agent
+	init_mib_modules
+	init_agent
+	argvrestartname
+	argvrestart
+	argvrestartp
+	update_config
+	get_target_sessions
+
diff -Naur tomato/release/src/router/snmp/win32/mib_module_config.h tomato121/release/src/router/snmp/win32/mib_module_config.h
--- tomato/release/src/router/snmp/win32/mib_module_config.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/win32/mib_module_config.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,144 @@
+/* This file is automatically generated by configure.  Do not modify by hand. */
+/* Define if compiling with the ucd_snmp module files.  */
+#define USING_UCD_SNMP_MODULE 1
+ 
+/* Define if compiling with the snmpv3mibs module files.  */
+#define USING_SNMPV3MIBS_MODULE 1
+ 
+/* Define if compiling with the notification module files.  */
+#define USING_NOTIFICATION_MODULE 1
+ 
+/* Define if compiling with the agentx module files.  */
+//#define USING_AGENTX_MODULE 1
+ 
+/* Define if compiling with the smux module files.  */
+#define USING_SMUX_MODULE 1
+ 
+/* Define if compiling with the target module files.  */
+#define USING_TARGET_MODULE 1
+ 
+/* Define if compiling with the examples/ucdDemoPublic module files.  */
+#define USING_EXAMPLES_UCDDEMOPUBLIC_MODULE 1
+ 
+/* Define if compiling with the examples/example module files.  */
+#define USING_EXAMPLES_EXAMPLE_MODULE 1
+ 
+/* Define if compiling with the mibII/system_mib module files.  */
+#define USING_MIBII_SYSTEM_MIB_MODULE 1
+ 
+/* Define if compiling with the mibII/vacm_vars module files.  */
+#define USING_MIBII_VACM_VARS_MODULE 1
+ 
+/* Define if compiling with the mibII/snmp_mib module files.  */
+#define USING_MIBII_SNMP_MIB_MODULE 1
+ 
+/* Define if compiling with the mibII/sysORTable module files.  */
+#define USING_MIBII_SYSORTABLE_MODULE 1
+ 
+/* Define if compiling with the ucd-snmp/proc module files.  */
+#define USING_UCD_SNMP_PROC_MODULE 1
+ 
+/* Define if compiling with the ucd-snmp/versioninfo module files.  */
+#define USING_UCD_SNMP_VERSIONINFO_MODULE 1
+ 
+/* Define if compiling with the ucd-snmp/pass module files.  */
+#define USING_UCD_SNMP_PASS_MODULE 1
+ 
+/* Define if compiling with the ucd-snmp/pass_persist module files.  */
+#define USING_UCD_SNMP_PASS_PERSIST_MODULE 1
+ 
+/* Define if compiling with the ucd-snmp/disk module files.  */
+#define USING_UCD_SNMP_DISK_MODULE 1
+ 
+/* Define if compiling with the ucd-snmp/loadave module files.  */
+#define USING_UCD_SNMP_LOADAVE_MODULE 1
+ 
+/* Define if compiling with the ucd-snmp/extensible module files.  */
+#define USING_UCD_SNMP_EXTENSIBLE_MODULE 1
+ 
+/* Define if compiling with the ucd-snmp/errormib module files.  */
+#define USING_UCD_SNMP_ERRORMIB_MODULE 1
+ 
+/* Define if compiling with the ucd-snmp/file module files.  */
+#define USING_UCD_SNMP_FILE_MODULE 1
+ 
+/* Define if compiling with the ucd-snmp/dlmod module files.  */
+#define USING_UCD_SNMP_DLMOD_MODULE 1
+ 
+/* Define if compiling with the ucd-snmp/proxy module files.  */
+#define USING_UCD_SNMP_PROXY_MODULE 1
+ 
+/* Define if compiling with the snmpv3/snmpEngine module files.  */
+#define USING_SNMPV3_SNMPENGINE_MODULE 1
+ 
+/* Define if compiling with the snmpv3/snmpMPDStats module files.  */
+#define USING_SNMPV3_SNMPMPDSTATS_MODULE 1
+ 
+/* Define if compiling with the snmpv3/usmStats module files.  */
+#define USING_SNMPV3_USMSTATS_MODULE 1
+ 
+/* Define if compiling with the snmpv3/usmUser module files.  */
+#define USING_SNMPV3_USMUSER_MODULE 1
+ 
+/* Define if compiling with the notification/snmpNotifyTable module files.  */
+#define USING_NOTIFICATION_SNMPNOTIFYTABLE_MODULE 1
+ 
+/* Define if compiling with the notification/snmpNotifyFilterTable module files.  */
+#define USING_NOTIFICATION_SNMPNOTIFYFILTERTABLE_MODULE 1
+ 
+/* Define if compiling with the notification/snmpNotifyFilterProfileTable module files.  */
+#define USING_NOTIFICATION_SNMPNOTIFYFILTERPROFILETABLE_MODULE 1
+ 
+/* Define if compiling with the agentx/master module files.  */
+//#define USING_AGENTX_MASTER_MODULE 1
+ 
+/* Define if compiling with the agentx/subagent module files.  */
+//#define USING_AGENTX_SUBAGENT_MODULE 1
+ 
+/* Define if compiling with the smux/smux module files.  */
+#define USING_SMUX_SMUX_MODULE 1
+ 
+/* Define if compiling with the target/snmpTargetAddrEntry module files.  */
+#define USING_TARGET_SNMPTARGETADDRENTRY_MODULE 1
+ 
+/* Define if compiling with the target/snmpTargetParamsEntry module files.  */
+#define USING_TARGET_SNMPTARGETPARAMSENTRY_MODULE 1
+ 
+/* Define if compiling with the target/target module files.  */
+#define USING_TARGET_TARGET_MODULE 1
+ 
+/* Define if compiling with the util_funcs module files.  */
+#define USING_UTIL_FUNCS_MODULE 1
+ 
+/* Define if compiling with the header_complex module files.  */
+#define USING_HEADER_COMPLEX_MODULE 1
+ 
+/* Define if compiling with the agentx/protocol module files.  */
+//#define USING_AGENTX_PROTOCOL_MODULE 1
+ 
+/* Define if compiling with the agentx/client module files.  */
+//#define USING_AGENTX_CLIENT_MODULE 1
+ 
+/* Define if compiling with the agentx/master_admin module files.  */
+//#define USING_AGENTX_MASTER_ADMIN_MODULE 1
+ 
+/* Define if compiling with the agentx/master_request module files.  */
+//#define USING_AGENTX_MASTER_REQUEST_MODULE 1
+ 
+/* Define if compiling with the mibII/udp module files.  */
+#define USING_MIBII_UDP_MODULE 1
+
+/* Define if compiling with the mibII/interfaces module files.  */
+#define USING_MIBII_INTERFACES_MODULE 1
+
+/* Define if compiling with the mibII/at module files.  */
+#define USING_MIBII_AT_MODULE 1
+
+/* Define if compiling with the mibII/ip module files.  */
+#define USING_MIBII_IP_MODULE 1
+
+/* Define if compiling with the mibII/icmp module files.  */
+#define USING_MIBII_ICMP_MODULE 1
+
+/* Define if compiling with the mibII/tcp module files.  */
+#define USING_MIBII_TCP_MODULE 1
diff -Naur tomato/release/src/router/snmp/win32/mib_module_dot_conf.h tomato121/release/src/router/snmp/win32/mib_module_dot_conf.h
--- tomato/release/src/router/snmp/win32/mib_module_dot_conf.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/win32/mib_module_dot_conf.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1 @@
+/* This file is automatically generated by configure.  Do not modify by hand. */
diff -Naur tomato/release/src/router/snmp/win32/mib_module_includes.h tomato121/release/src/router/snmp/win32/mib_module_includes.h
--- tomato/release/src/router/snmp/win32/mib_module_includes.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/win32/mib_module_includes.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,59 @@
+/* This file is automatically generated by configure.  Do not modify by hand. */
+#include "mibgroup/mibII.h"
+#include "mibgroup/ucd_snmp.h"
+#include "mibgroup/snmpv3mibs.h"
+#include "mibgroup/notification.h"
+#include "mibgroup/target.h"
+#include "mibgroup/agent_mibs.h"
+#include "mibgroup/agentx.h"
+#include "mibgroup/agent_mibs.h"
+#include "mibgroup/utilities.h"
+#include "mibgroup/mibII/system_mib.h"
+#include "mibgroup/mibII/sysORTable.h"
+#include "mibgroup/mibII/at.h"
+#include "mibgroup/mibII/interfaces.h"
+#include "mibgroup/mibII/snmp_mib.h"
+#include "mibgroup/mibII/tcp.h"
+#include "mibgroup/mibII/icmp.h"
+#include "mibgroup/mibII/ip.h"
+#include "mibgroup/mibII/udp.h"
+#include "mibgroup/mibII/vacm_vars.h"
+#include "mibgroup/ucd-snmp/proc.h"
+#include "mibgroup/ucd-snmp/versioninfo.h"
+#include "mibgroup/ucd-snmp/pass.h"
+#include "mibgroup/ucd-snmp/pass_persist.h"
+#include "mibgroup/ucd-snmp/disk.h"
+#include "mibgroup/ucd-snmp/loadave.h"
+#include "mibgroup/ucd-snmp/extensible.h"
+#include "mibgroup/ucd-snmp/errormib.h"
+#include "mibgroup/ucd-snmp/file.h"
+#include "mibgroup/ucd-snmp/dlmod.h"
+#include "mibgroup/ucd-snmp/proxy.h"
+#include "mibgroup/snmpv3/snmpEngine.h"
+#include "mibgroup/snmpv3/snmpMPDStats.h"
+#include "mibgroup/snmpv3/usmStats.h"
+#include "mibgroup/snmpv3/usmUser.h"
+#include "mibgroup/notification/snmpNotifyTable.h"
+#include "mibgroup/notification/snmpNotifyFilterTable.h"
+#include "mibgroup/notification/snmpNotifyFilterProfileTable.h"
+#include "mibgroup/target/snmpTargetAddrEntry.h"
+#include "mibgroup/target/snmpTargetParamsEntry.h"
+#include "mibgroup/target/target.h"
+#include "mibgroup/target/target_counters.h"
+#include "mibgroup/agent/nsTransactionTable.h"
+#include "mibgroup/agent/nsModuleTable.h"
+#include "mibgroup/agentx/master.h"
+#include "mibgroup/agentx/subagent.h"
+#include "mibgroup/utilities/override.h"
+#include "mibgroup/util_funcs.h"
+#include "mibgroup/mibII/tcpTable.h"
+#include "mibgroup/mibII/ipAddr.h"
+#include "mibgroup/mibII/var_route.h"
+#include "mibgroup/mibII/route_write.h"
+#include "mibgroup/mibII/udpTable.h"
+#include "mibgroup/mibII/vacm_context.h"
+#include "mibgroup/header_complex.h"
+#include "mibgroup/agentx/protocol.h"
+#include "mibgroup/agentx/client.h"
+#include "mibgroup/agentx/master_admin.h"
+#include "mibgroup/agentx/agentx_config.h"
diff -Naur tomato/release/src/router/snmp/win32/mib_module_inits.h tomato121/release/src/router/snmp/win32/mib_module_inits.h
--- tomato/release/src/router/snmp/win32/mib_module_inits.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/win32/mib_module_inits.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,41 @@
+/* This file is automatically generated by configure.  Do not modify by hand. */
+  if (should_init("system_mib")) init_system_mib();
+  if (should_init("sysORTable")) init_sysORTable();
+#ifdef HAVE_WIN32_PLATFORM_SDK
+  if (should_init("at")) init_at();
+  if (should_init("interfaces")) init_interfaces();
+  if (should_init("tcp")) init_tcp();
+  if (should_init("icmp")) init_icmp();
+  if (should_init("ip")) init_ip();
+  if (should_init("udp")) init_udp();
+  if (should_init("var_route")) init_var_route();
+#endif
+  if (should_init("snmp_mib")) init_snmp_mib();
+  if (should_init("vacm_vars")) init_vacm_vars();
+  if (should_init("proc")) init_proc();
+  if (should_init("versioninfo")) init_versioninfo();
+  if (should_init("pass")) init_pass();
+  if (should_init("pass_persist")) init_pass_persist();
+  if (should_init("disk")) init_disk();
+  if (should_init("loadave")) init_loadave();
+  if (should_init("extensible")) init_extensible();
+  if (should_init("errormib")) init_errormib();
+  if (should_init("file")) init_file();
+  if (should_init("dlmod")) init_dlmod();
+  if (should_init("proxy")) init_proxy();
+  if (should_init("snmpEngine")) init_snmpEngine();
+  if (should_init("snmpMPDStats")) init_snmpMPDStats();
+  if (should_init("usmStats")) init_usmStats();
+  if (should_init("usmUser")) init_usmUser();
+  if (should_init("snmpNotifyTable")) init_snmpNotifyTable();
+  if (should_init("snmpNotifyFilterTable")) init_snmpNotifyFilterTable();
+  if (should_init("snmpNotifyFilterProfileTable")) init_snmpNotifyFilterProfileTable();
+  if (should_init("snmpTargetAddrEntry")) init_snmpTargetAddrEntry();
+  if (should_init("snmpTargetParamsEntry")) init_snmpTargetParamsEntry();
+  if (should_init("target_counters")) init_target_counters();
+  if (should_init("nsTransactionTable")) init_nsTransactionTable();
+  if (should_init("nsModuleTable")) init_nsModuleTable();
+  /* if (should_init("subagent")) init_subagent(); */
+  if (should_init("override")) init_override();
+  if (should_init("vacm_context")) init_vacm_context();
+  if (should_init("agentx_config")) init_agentx_config();
diff -Naur tomato/release/src/router/snmp/win32/mib_module_shutdown.h tomato121/release/src/router/snmp/win32/mib_module_shutdown.h
--- tomato/release/src/router/snmp/win32/mib_module_shutdown.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/win32/mib_module_shutdown.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,2 @@
+/* This file is automatically generated by configure.  Do not modify by hand. */
+/* (Unless you are stuck on the Win32 platform. Then you don't have much choice. */
diff -Naur tomato/release/src/router/snmp/win32/net-snmp/agent/mib_module_config.h tomato121/release/src/router/snmp/win32/net-snmp/agent/mib_module_config.h
--- tomato/release/src/router/snmp/win32/net-snmp/agent/mib_module_config.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/win32/net-snmp/agent/mib_module_config.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,154 @@
+/* This file is automatically generated by configure.  Do not modify by hand. */
+/* Define if compiling with the mibII module files.  */
+#define USING_MIBII_MODULE 1
+ 
+/* Define if compiling with the ucd_snmp module files.  */
+#define USING_UCD_SNMP_MODULE 1
+ 
+/* Define if compiling with the snmpv3mibs module files.  */
+#define USING_SNMPV3MIBS_MODULE 1
+ 
+/* Define if compiling with the notification module files.  */
+#define USING_NOTIFICATION_MODULE 1
+ 
+/* Define if compiling with the agent_mibs module files.  */
+#define USING_AGENT_MIBS_MODULE 1
+ 
+/* Define if compiling with the mibII/system_mib module files.  */
+#define USING_MIBII_SYSTEM_MIB_MODULE 1
+ 
+/* Define if compiling with the mibII/sysORTable module files.  */
+#define USING_MIBII_SYSORTABLE_MODULE 1
+ 
+/* Define if compiling with the mibII/at module files.  */
+#define USING_MIBII_AT_MODULE 1
+ 
+/* Define if compiling with the mibII/interfaces module files.  */
+#define USING_MIBII_INTERFACES_MODULE 1
+ 
+/* Define if compiling with the mibII/snmp_mib module files.  */
+#define USING_MIBII_SNMP_MIB_MODULE 1
+ 
+/* Define if compiling with the mibII/tcp module files.  */
+#define USING_MIBII_TCP_MODULE 1
+ 
+/* Define if compiling with the mibII/icmp module files.  */
+#define USING_MIBII_ICMP_MODULE 1
+ 
+/* Define if compiling with the mibII/ip module files.  */
+#define USING_MIBII_IP_MODULE 1
+ 
+/* Define if compiling with the mibII/udp module files.  */
+#define USING_MIBII_UDP_MODULE 1
+ 
+/* Define if compiling with the mibII/vacm_vars module files.  */
+#define USING_MIBII_VACM_VARS_MODULE 1
+ 
+/* Define if compiling with the ucd-snmp/memory module files.  */
+#define USING_UCD_SNMP_MEMORY_MODULE 1
+ 
+/* Define if compiling with the ucd-snmp/vmstat module files.  */
+#define USING_UCD_SNMP_VMSTAT_MODULE 1
+ 
+/* Define if compiling with the ucd-snmp/proc module files.  */
+#define USING_UCD_SNMP_PROC_MODULE 1
+ 
+/* Define if compiling with the ucd-snmp/versioninfo module files.  */
+#define USING_UCD_SNMP_VERSIONINFO_MODULE 1
+ 
+/* Define if compiling with the ucd-snmp/pass module files.  */
+#define USING_UCD_SNMP_PASS_MODULE 1
+ 
+/* Define if compiling with the ucd-snmp/pass_persist module files.  */
+#define USING_UCD_SNMP_PASS_PERSIST_MODULE 1
+ 
+/* Define if compiling with the ucd-snmp/disk module files.  */
+#define USING_UCD_SNMP_DISK_MODULE 1
+ 
+/* Define if compiling with the ucd-snmp/loadave module files.  */
+#define USING_UCD_SNMP_LOADAVE_MODULE 1
+ 
+/* Define if compiling with the ucd-snmp/extensible module files.  */
+#define USING_UCD_SNMP_EXTENSIBLE_MODULE 1
+ 
+/* Define if compiling with the ucd-snmp/errormib module files.  */
+#define USING_UCD_SNMP_ERRORMIB_MODULE 1
+ 
+/* Define if compiling with the ucd-snmp/registry module files.  */
+#define USING_UCD_SNMP_REGISTRY_MODULE 1
+ 
+/* Define if compiling with the ucd-snmp/file module files.  */
+#define USING_UCD_SNMP_FILE_MODULE 1
+ 
+/* Define if compiling with the ucd-snmp/dlmod module files.  */
+#define USING_UCD_SNMP_DLMOD_MODULE 1
+ 
+/* Define if compiling with the ucd-snmp/proxy module files.  */
+#define USING_UCD_SNMP_PROXY_MODULE 1
+ 
+/* Define if compiling with the snmpv3/snmpEngine module files.  */
+#define USING_SNMPV3_SNMPENGINE_MODULE 1
+ 
+/* Define if compiling with the snmpv3/snmpMPDStats module files.  */
+#define USING_SNMPV3_SNMPMPDSTATS_MODULE 1
+ 
+/* Define if compiling with the snmpv3/usmStats module files.  */
+#define USING_SNMPV3_USMSTATS_MODULE 1
+ 
+/* Define if compiling with the snmpv3/usmUser module files.  */
+#define USING_SNMPV3_USMUSER_MODULE 1
+ 
+/* Define if compiling with the notification/snmpNotifyTable module files.  */
+#define USING_NOTIFICATION_SNMPNOTIFYTABLE_MODULE 1
+ 
+/* Define if compiling with the notification/snmpNotifyFilterTable module files.  */
+#define USING_NOTIFICATION_SNMPNOTIFYFILTERTABLE_MODULE 1
+ 
+/* Define if compiling with the notification/snmpNotifyFilterProfileTable module files.  */
+#define USING_NOTIFICATION_SNMPNOTIFYFILTERPROFILETABLE_MODULE 1
+ 
+/* Define if compiling with the agent/nsTransactionTable module files.  */
+#define USING_AGENT_NSTRANSACTIONTABLE_MODULE 1
+ 
+/* Define if compiling with the util_funcs module files.  */
+#define USING_UTIL_FUNCS_MODULE 1
+ 
+/* Define if compiling with the mibII/kernel_linux module files.  */
+#define USING_MIBII_KERNEL_LINUX_MODULE 1
+ 
+/* Define if compiling with the mibII/tcpTable module files.  */
+#define USING_MIBII_TCPTABLE_MODULE 1
+ 
+/* Define if compiling with the mibII/ipAddr module files.  */
+#define USING_MIBII_IPADDR_MODULE 1
+ 
+/* Define if compiling with the mibII/var_route module files.  */
+#define USING_MIBII_VAR_ROUTE_MODULE 1
+ 
+/* Define if compiling with the mibII/route_write module files.  */
+#define USING_MIBII_ROUTE_WRITE_MODULE 1
+ 
+/* Define if compiling with the mibII/udpTable module files.  */
+#define USING_MIBII_UDPTABLE_MODULE 1
+ 
+/* Define if compiling with the mibII/vacm_context module files.  */
+#define USING_MIBII_VACM_CONTEXT_MODULE 1
+ 
+/* Define if compiling with the header_complex module files.  */
+#define USING_HEADER_COMPLEX_MODULE 1
+ 
+/* Define if compiling with the target module files.  */
+#define USING_TARGET_MODULE 1
+ 
+/* Define if compiling with the target/snmpTargetAddrEntry module files.  */
+#define USING_TARGET_SNMPTARGETADDRENTRY_MODULE 1
+ 
+/* Define if compiling with the target/snmpTargetParamsEntry module files.  */
+#define USING_TARGET_SNMPTARGETPARAMSENTRY_MODULE 1
+ 
+/* Define if compiling with the target/target module files.  */
+#define USING_TARGET_TARGET_MODULE 1
+ 
+/* Define if compiling with the target/target_counters module files.  */
+#define USING_TARGET_TARGET_COUNTERS_MODULE 1
+ 
diff -Naur tomato/release/src/router/snmp/win32/net-snmp/library/snmpv3-security-includes.h tomato121/release/src/router/snmp/win32/net-snmp/library/snmpv3-security-includes.h
--- tomato/release/src/router/snmp/win32/net-snmp/library/snmpv3-security-includes.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/win32/net-snmp/library/snmpv3-security-includes.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,2 @@
+/* This file is automatically generated by configure.  Do not modify by hand. */
+#include <net-snmp/library/snmpusm.h>
diff -Naur tomato/release/src/router/snmp/win32/net-snmp/net-snmp-config.h tomato121/release/src/router/snmp/win32/net-snmp/net-snmp-config.h
--- tomato/release/src/router/snmp/win32/net-snmp/net-snmp-config.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/win32/net-snmp/net-snmp-config.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,894 @@
+/* config.h:  a general config file */
+#ifndef NET_SNMP_CONFIG_H
+#define NET_SNMP_CONFIG_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Default (SNMP) version number for the tools to use */
+#define DEFAULT_SNMP_VERSION 3
+
+/* don't change these values! */
+#define SNMPV1      0xAAAA       /* readable by anyone */
+#define SNMPV2ANY   0xA000       /* V2 Any type (includes NoAuth) */
+#define SNMPV2AUTH  0x8000       /* V2 Authenticated requests only */
+
+/* default list of mibs to load */
+#define DEFAULT_MIBS "IP-MIB;IF-MIB;TCP-MIB;UDP-MIB;SNMPv2-MIB;RFC1213-MIB;UCD-SNMP-MIB;UCD-DEMO-MIB;SNMP-TARGET-MIB;SNMP-VIEW-BASED-ACM-MIB;SNMP-COMMUNITY-MIB;UCD-DLMOD-MIB;SNMP-FRAMEWORK-MIB;SNMP-MPD-MIB;SNMP-USER-BASED-SM-MIB;SNMP-NOTIFICATION-MIB;SNMPv2-TM"
+
+/* default location to look for mibs to load using the above tokens
+   and/or those in the MIBS envrionment variable*/
+
+#define DEFAULT_MIBDIRS "/USR/MIBS"
+
+/* default mib files to load, specified by path. */
+
+#undef DEFAULT_MIBFILES
+
+/* should we compile to use special opaque types: float, double,
+   counter64, i64, ui64, union? */
+#define OPAQUE_SPECIAL_TYPES 1
+
+/* comment the next line if you are compiling with libsnmp.h
+   and are not using the UC-Davis SNMP library. */
+#define UCD_SNMP_LIBRARY 1
+
+/* define if you want to compile support for both authentication and
+   privacy support. */
+#define SCAPI_AUTHPRIV 1
+
+/* define if you are using the internal MD5 code */
+#define USE_INTERNAL_MD5 1
+
+/* add in recent CMU library extensions (not complete) */
+#define CMU_COMPATIBLE 1
+
+/* should "--" comments in mibs be a comment till the end of the line
+   or also until another "--", the latter being the technically
+   correct. */
+#undef MIB_COMMENT_IS_EOL_TERMINATED
+
+/* debugging stuff */
+#undef SNMP_NO_DEBUGGING           /* if defined, we optimize the code
+                                      to exclude all debugging calls. */
+#define SNMP_ALWAYS_DEBUG 0        /* Always print debugging information and
+                                      ignore the -D flag passed to the cmds */
+
+/* Define if using alloca.c.  */
+#undef C_ALLOCA
+
+/* Define to one of _getb67, GETB67, getb67 for Cray-2 and Cray-YMP systems.
+   This function is required for alloca.c support on those systems.  */
+#undef CRAY_STACKSEG_END
+
+/* Define if you have alloca, as a function or macro.  */
+#undef HAVE_ALLOCA
+
+/* Define if you have <alloca.h> and it should be used (not on Ultrix).  */
+#undef HAVE_ALLOCA_H
+
+/* Define if you have the getmntent function.  */
+#undef HAVE_GETMNTENT
+
+/* Define if you have <sys/wait.h> that is POSIX.1 compatible.  */
+#undef HAVE_SYS_WAIT_H
+
+/* Define to `long' if <sys/types.h> doesn't define.  */
+#undef off_t
+
+/* Define to `int' if <sys/types.h> doesn't define.  */
+#undef pid_t
+
+/* Define as the return type of signal handlers (int or void).  */
+#define RETSIGTYPE void
+
+/* Define if you have raise() instead of alarm() */
+
+#define HAVE_RAISE 1
+
+/* If using the C implementation of alloca, define if you know the
+   direction of stack growth for your system; otherwise it will be
+   automatically deduced at run-time.
+ STACK_DIRECTION > 0 => grows toward higher addresses
+ STACK_DIRECTION < 0 => grows toward lower addresses
+ STACK_DIRECTION = 0 => direction of growth unknown
+ */
+#undef STACK_DIRECTION
+
+/* Define if you have the ANSI C header files.  */
+#define STDC_HEADERS 1
+
+/* Define if you can safely include both <sys/time.h> and <time.h>.  */
+#define TIME_WITH_SYS_TIME 1
+
+/* Define if you have the gettimeofday function.  */
+#undef HAVE_GETTIMEOFDAY
+
+/* Define if you have the <sys/time.h> header file.  */
+#undef HAVE_SYS_TIME_H
+
+/* Define if your processor stores words with the most significant
+   byte first (like Motorola and SPARC, unlike Intel and VAX).  */
+#undef WORDS_BIGENDIAN
+
+#define SNMPDLMODPATH "/USR/LIB/DLMOD"
+#define SNMPLIBPATH "/USR/LIB"
+#define SNMPSHAREPATH "/USR/SHARE/SNMP"
+#define SNMPCONFPATH "/USR"
+
+/* SNMPPATH contains (more) important files */
+
+#undef SNMPPATH
+
+/* LOGFILE:  If defined it closes stdout/err/in and opens this in out/err's
+   place.  (stdin is closed so that sh scripts won't wait for it) */
+
+#undef LOGFILE
+
+/* PERSISTENT_DIRECTORY: If defined, the library is capabile of saving
+   persisant information to this directory in the form of configuration
+   lines: PERSISTENT_DIRECTORY/NAME.persistent.conf */
+#define PERSISTENT_DIRECTORY "/USR/SNMP/PERSIST"
+
+#define MAX_PERSISTENT_BACKUPS 10
+/* default system contact */
+#define SYS_CONTACT "unknown"
+
+/* system location */
+#define SYS_LOC "unknown"
+
+/* location of UNIX kernel */
+#define KERNEL_LOC "unknown"
+
+/* location of mount table list */
+#define ETC_MNTTAB "unknown"
+
+/* location of swap device (ok if not found) */
+#undef DMEM_LOC
+
+/* define rtentry to ortentry on SYSV machines (alphas) */
+#define RTENTRY rtentry;
+
+/* Use BSD 4.4 routing table entries? */
+#undef RTENTRY_4_4
+
+/* Does the rtentry structure have a rt_next node */
+#undef RTENTRY_RT_NEXT
+
+#define PSCMD "/bin/ps"
+
+/* Where is the uname command */
+#define UNAMEPROG "/bin/uname"
+
+/* testing code sections. */
+/* #undef SNMP_TESTING_CODE */
+
+/* If you don't have root access don't exit upon kmem errors */
+#undef NO_ROOT_ACCESS
+
+/* Define if you have the bcopy function.  */
+#undef HAVE_BCOPY
+
+/* Define if you have the gethostbyname function.  */
+#define HAVE_GETHOSTBYNAME 1
+
+/* Define if you have the gethostname function.  */
+#define HAVE_GETHOSTNAME 1
+
+/* Define if you have the getloadavg function.  */
+#undef HAVE_GETLOADAVG
+
+/* Define if you have the getservbyname function.  */
+#define HAVE_GETSERVBYNAME 1
+
+/* Define if you have the setenv function.  */
+#undef HAVE_SETENV
+
+/* Define if you have the strtoul function.  */
+#define HAVE_STRTOUL 1
+
+/* Define if you have the vsnprintf function.  */
+#define HAVE_VSNPRINTF 1
+#define HAVE_SNPRINTF 1
+
+/* Define if you have the index function.  */
+#undef HAVE_INDEX
+
+/* Define if you have the kvm_openfiles function.  */
+#undef HAVE_KVM_OPENFILES
+
+/* Define if you have the lrand48 function.  */
+#undef HAVE_LRAND48
+
+/* Define if you have the memcpy function.  */
+#define HAVE_MEMCPY 1
+
+/* Define if you have the memmove function.  */
+#define HAVE_MEMMOVE 1
+
+/* Define if you have the rand function.  */
+#define HAVE_RAND 1
+
+/* Define if you have the random function.  */
+#undef HAVE_RANDOM
+
+/* Define if you have the select function.  */
+#undef HAVE_SELECT
+
+/* Define if you have the setmntent function.  */
+#undef HAVE_SETMNTENT
+
+/* Define if you have the sigblock function.  */
+#undef HAVE_SIGBLOCK
+
+/* Define if you have the sighold function.  */
+#undef HAVE_SIGHOLD
+
+/* Define if you have the signal function.  */
+#undef HAVE_SIGNAL
+
+/* Define if you have the sigset function.  */
+#undef HAVE_SIGSET
+
+/* Define if you have the socket function.  */
+#define HAVE_SOCKET 1
+
+/* Define if you have <winsock.h> header file. */
+#define HAVE_WINSOCK_H 1
+
+/* Define if you have the closesocket function.  */
+#define HAVE_CLOSESOCKET 1
+
+/* Define if you have the statfs function.  */
+#undef HAVE_STATFS
+
+/* Define if you have the statvfs function.  */
+#undef HAVE_STATVFS
+
+/* Define if you have the strchr function.  */
+#define HAVE_STRCHR 1
+
+/* use win32 strdup */
+#define strdup _strdup
+
+/* Define if you have the strtol function.  */
+#define HAVE_STRTOL 1
+
+/* Define if you have the tcgetattr function.  */
+/* #define HAVE_TCGETATTR 1 */
+
+/* Define if you have the uname function.  */
+#undef HAVE_UNAME
+
+/* Define if you have <io.h> header file. */
+#define HAVE_IO_H 1
+
+/* Define if you have <process.h> header file. (Win32-getpid) */
+#define HAVE_PROCESS_H 1
+
+/* Define if you have the <arpa/inet.h> header file.  */
+#undef HAVE_ARPA_INET_H
+
+/* Define if you have the <dirent.h> header file.  */
+#undef HAVE_DIRENT_H
+
+/* Define if you have the <err.h> header file.  */
+#undef HAVE_ERR_H
+
+/* Define if you have the <fcntl.h> header file.  */
+#define HAVE_FCNTL_H 1
+
+/* Define if you have the <fstab.h> header file.  */
+#undef HAVE_FSTAB_H
+
+/* Define if you have the <inet/mib2.h> header file.  */
+#undef HAVE_INET_MIB2_H
+
+/* Define if you have the <kstat.h> header file.  */
+#undef HAVE_KSTAT_H
+
+/* Define if you have the <kvm.h> header file.  */
+#undef HAVE_KVM_H
+
+/* Define if you have the <limits.h> header file.  */
+#define HAVE_LIMITS_H 1
+
+/* Define if you have the <machine/param.h> header file.  */
+#undef HAVE_MACHINE_PARAM_H
+
+/* Define if you have the <machine/pte.h> header file.  */
+#undef HAVE_MACHINE_PTE_H
+
+/* Define if you have the <malloc.h> header file.  */
+#undef HAVE_MALLOC_H
+
+/* Define if you have the <mntent.h> header file.  */
+#undef HAVE_MNTENT_H
+
+/* Define if you have the <mtab.h> header file.  */
+#undef HAVE_MTAB_H
+
+/* Define if you have the <ndir.h> header file.  */
+#undef HAVE_NDIR_H
+
+/* Define if you have the <net/if_dl.h> header file.  */
+#undef HAVE_NET_IF_DL_H
+
+/* Define if you have the <net/if_types.h> header file.  */
+#undef HAVE_NET_IF_TYPES_H
+
+/* Define if you have the <netinet/icmp_var.h> header file.  */
+#undef HAVE_NETINET_ICMP_VAR_H
+
+/* Define if you have the <netinet/if_ether.h> header file.  */
+#undef HAVE_NETINET_IF_ETHER_H
+
+/* Define if you have the <netinet/in.h> header file.  */
+#undef HAVE_NETINET_IN_H
+
+/* Define if you have the <netinet/in_pcb.h> header file.  */
+#undef HAVE_NETINET_IN_PCB_H
+
+/* Define if you have the <netinet/in_var.h> header file.  */
+#undef HAVE_NETINET_IN_VAR_H
+
+/* Define if you have the <netinet/ip_var.h> header file.  */
+#undef HAVE_NETINET_IP_VAR_H
+
+/* Define if you have the <netinet/tcp_fsm.h> header file.  */
+#undef HAVE_NETINET_TCP_FSM_H
+
+/* Define if you have the <netinet/tcp_timer.h> header file.  */
+#undef HAVE_NETINET_TCP_TIMER_H
+
+/* Define if you have the <netinet/tcp_var.h> header file.  */
+#undef HAVE_NETINET_TCP_VAR_H
+
+/* Define if you have the <netinet/tcpip.h> header file.  */
+#undef HAVE_NETINET_TCPIP_H
+
+/* Define if you have the <netinet/udp_var.h> header file.  */
+#undef HAVE_NETINET_UDP_VAR_H
+
+/* Define if you have the <sgtty.h> header file.  */
+#undef HAVE_SGTTY_H
+
+/* Define if you have the <stdarg.h> header file.  */
+#define HAVE_STDARG_H 1
+
+/* Define if you have the <stdlib.h> header file.  */
+#define HAVE_STDLIB_H 1
+
+/* Define if you have the <string.h> header file.  */
+#define HAVE_STRING_H 1
+
+/* Define if you have the <sys/conf.h> header file.  */
+#undef HAVE_SYS_CONF_H
+
+/* Define if you have the <sys/dir.h> header file.  */
+#undef HAVE_SYS_DIR_H
+
+/* Define if you have the <sys/dmap.h> header file.  */
+#undef HAVE_SYS_DMAP_H
+
+/* Define if you have the <sys/file.h> header file.  */
+#undef HAVE_SYS_FILE_H
+
+/* Define if you have the <sys/filio.h> header file.  */
+#undef HAVE_SYS_FILIO_H
+
+/* Define if you have the <sys/fixpoint.h> header file.  */
+#undef HAVE_SYS_FIXPOINT_H
+
+/* Define if you have the <sys/fs.h> header file.  */
+#undef HAVE_SYS_FS_H
+
+/* Define if you have the <sys/stat.h> header file.  */
+#define HAVE_SYS_STAT_H 1
+
+/* Define if you have the <sys/hashing.h> header file.  */
+#undef HAVE_SYS_HASHING_H
+
+/* Define if you have the <sys/ioctl.h> header file.  */
+#undef HAVE_SYS_IOCTL_H
+
+/* Define if you have the <sys/mbuf.h> header file.  */
+#undef HAVE_SYS_MBUF_H
+
+/* Define if you have the <sys/mnttab.h> header file.  */
+#undef HAVE_SYS_MNTTAB_H
+
+/* Define if you have the <sys/mount.h> header file.  */
+#undef HAVE_SYS_MOUNT_H
+
+/* Define if you have the <sys/ndir.h> header file.  */
+#undef HAVE_SYS_NDIR_H
+
+/* Define if you have the <sys/param.h> header file.  */
+#undef HAVE_SYS_PARAM_H
+
+/* Define if you have the <sys/proc.h> header file.  */
+#undef HAVE_SYS_PROC_H
+
+/* Define if you have the <sys/protosw.h> header file.  */
+#undef HAVE_SYS_PROTOSW_H
+
+/* Define if you have the <sys/select.h> header file.  */
+#undef HAVE_SYS_SELECT_H
+
+/* Define if you have the <sys/sockio.h> header file.  */
+#undef HAVE_SYS_SOCKIO_H
+
+/* Define if you have the <sys/statvfs.h> header file.  */
+#undef HAVE_SYS_STATVFS_H
+
+/* Define if you have the <sys/swap.h> header file.  */
+#undef HAVE_SYS_SWAP_H
+
+/* Define if you have the <sys/sysctl.h> header file.  */
+#undef HAVE_SYS_SYSCTL_H
+
+/* Define if you have the <sys/tcpipstats.h> header file.  */
+#undef HAVE_SYS_TCPIPSTATS_H
+
+/* Define if you have the <sys/user.h> header file.  */
+#undef HAVE_SYS_USER_H
+
+/* Define if you have the <sys/utsname.h> header file.  */
+#undef HAVE_SYS_UTSNAME_H
+
+/* Define if you have the <sys/vfs.h> header file.  */
+#undef HAVE_SYS_VFS_H
+
+/* Define if you have the <sys/vm.h> header file.  */
+#undef HAVE_SYS_VM_H
+
+/* Define if you have the <sys/vmmac.h> header file.  */
+#undef HAVE_SYS_VMMAC_H
+
+/* Define if you have the <sys/vmmeter.h> header file.  */
+#undef HAVE_SYS_VMMETER_H
+
+/* Define if you have the <sys/vmparam.h> header file.  */
+#undef HAVE_SYS_VMPARAM_H
+
+/* Define if you have the <sys/vmsystm.h> header file.  */
+#undef HAVE_SYS_VMSYSTM_H
+
+/* Define if you have the <syslog.h> header file.  */
+#undef HAVE_SYSLOG_H
+
+#ifndef LOG_DAEMON
+#define       LOG_DAEMON      (3<<3)  /* system daemons */
+#endif
+
+/* Define if you have the <ufs/ffs/fs.h> header file.  */
+#undef HAVE_UFS_FFS_FS_H
+
+/* Define if you have the <ufs/fs.h> header file.  */
+#undef HAVE_UFS_FS_H
+
+/* Define if you have the <ufs/ufs/dinode.h> header file.  */
+#undef HAVE_UFS_UFS_DINODE_H
+
+/* Define if you have the <unistd.h> header file.  */
+#undef HAVE_UNISTD_H
+
+/* Define if you have the <utsname.h> header file.  */
+#undef HAVE_UTSNAME_H
+
+/* Define if you have the <vm/swap_pager.h> header file.  */
+#undef HAVE_VM_SWAP_PAGER_H
+
+/* Define if you have the <vm/vm.h> header file.  */
+#undef HAVE_VM_VM_H
+
+/* Define if you have the <xti.h> header file.  */
+#undef HAVE_XTI_H
+
+/* Define if you have the crypto library (-lcrypto).  */
+#undef HAVE_LIBCRYPTO
+
+/* Define if you have the elf library (-lelf).  */
+#undef HAVE_LIBELF
+
+/* Define if you have the kstat library (-lkstat).  */
+#undef HAVE_LIBKSTAT
+
+/* Define if you have the kvm library (-lkvm).  */
+#undef HAVE_LIBKVM
+
+/* Define if you have the m library (-lm).  */
+#undef HAVE_LIBM
+
+/* Define if you have the mld library (-lmld).  */
+#undef HAVE_LIBMLD
+
+/* Define if you have the nsl library (-lnsl).  */
+#undef HAVE_LIBNSL
+
+/* Define if you have the socket library (-lsocket).  */
+#undef HAVE_LIBSOCKET
+
+/* ifnet structure tests */
+#undef STRUCT_IFNET_HAS_IF_BAUDRATE
+#undef STRUCT_IFNET_HAS_IF_TYPE
+#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_NOPROTO
+#undef STRUCT_IFNET_HAS_IF_OMCASTS
+#undef STRUCT_IFNET_HAS_IF_XNAME
+#undef STRUCT_IFNET_HAS_IF_OBYTES
+#undef STRUCT_IFNET_HAS_IF_IBYTES
+#undef STRUCT_IFNET_HAS_IF_ADDRLIST
+
+/* tcpstat.tcps_rcvmemdrop */
+#undef STRUCT_TCPSTAT_HAS_TCPS_RCVMEMDROP
+
+/* udpstat.udps_discard */
+#undef STRUCT_UDPSTAT_HAS_UDPS_DISCARD
+
+/* arphd.at_next */
+#undef STRUCT_ARPHD_HAS_AT_NEXT
+
+/* ifaddr.ifa_next */
+#undef STRUCT_IFADDR_HAS_IFA_NEXT
+
+/* ifnet.if_mtu */
+#undef STRUCT_IFNET_HAS_IF_MTU
+
+/* ifnet needs to have _KERNEL defined */
+#undef IFNET_NEEDS_KERNEL
+
+/* sysctl works to get boottime, etc... */
+#undef CAN_USE_SYSCTL
+
+/* define if your compiler (processor) defines __FUNCTION__ for you */
+#undef HAVE_CPP_UNDERBAR_FUNCTION_DEFINED
+
+/* mib pointer to the top of the extensible tree.  This has been
+ assigned to UCDavis by the iana group.  Optionally, point this to the
+ location in the tree your company/organization has been allocated. */
+
+/* location of the extensible mib tree */
+#define EXTENSIBLEMIB 1,3,6,1,4,1,2021
+/* location of the extensible mib tree */
+#define EXTENSIBLEDOTMIB 1.3.6.1.4.1.2021
+/* count the above numbers */
+#define EXTENSIBLENUM 7
+
+/* the ErrorFlag is V1 accessable because HP Openview does not support
+   V2.  You can make this list of pairs as long as you want, just make
+   sure to end it in -1.*/
+
+#define SECURITYEXCEPTIONS {100,SNMPV1,-1} /* the ErrorFlag is V1 */
+
+/* Mib-2 tree Info */
+/* These are the system information variables. */
+
+#define VERS_DESC   "unknown"             /* overridden at run time */
+#define SYS_NAME    "unknown"             /* overridden at run time */
+
+/* comment out the second define to turn off functionality for any of
+   these: (See README for details) */
+
+/*   proc PROCESSNAME [MAX] [MIN] */
+#define PROCMIBNUM 2
+#define USEPROCMIB
+
+/*   exec/shell NAME COMMAND      */
+#define SHELLMIBNUM 8
+#define USESHELLMIB
+
+/*   swap MIN                     */
+#define MEMMIBNUM 4
+#if defined(hpux9) || defined(bsdi2)
+#define USEMEMMIB
+#endif
+
+/*   disk DISK MINSIZE            */
+#define DISKMIBNUM 9
+#if (HAVE_FSTAB_H || HAVE_SYS_STATVFS_H)
+#define USEDISKMIB
+#endif
+
+/*   load 1 5 15                  */
+#define LOADAVEMIBNUM 10
+#define USELOADAVEMIB
+
+/*   pass MIBOID command */
+#define USEPASSMIB
+
+/* which version are you using? This mibloc will tell you */
+#define VERSIONMIBNUM 100
+#define USEVERSIONMIB
+
+/* Reports errors the agent runs into */
+/* (typically its "can't fork, no mem" problems) */
+#define ERRORMIBNUM 101
+#define USEERRORMIB
+
+/* The sub id of EXENSIBLEMIB returned to queries of
+   .iso.org.dod.internet.mgmt.mib-2.system.sysObjectID.0 */
+#define AGENTID 250
+
+/* This ID is returned after the AGENTID above.  IE, the resulting
+   value returned by a query to sysObjectID is
+   EXTENSIBLEMIB.AGENTID.???, where ??? is defined below by OSTYPE */
+
+#define HPUX9ID 1
+#define SUNOS4ID 2
+#define SOLARISID 3
+#define OSFID 4
+#define ULTRIXID 5
+#define HPUX10ID 6
+#define NETBSD1ID 7
+#define FREEBSDID 8
+#define IRIXID 9
+#define LINUXID 10
+#define BSDIID 11
+#define OPENBSDID 12
+#define UNKNOWNID 255
+
+#ifdef hpux9
+#define OSTYPE HPUX9ID
+#endif
+#ifdef hpux10
+#define OSTYPE HPUX10ID
+#endif
+#ifdef sunos4
+#define OSTYPE SUNOS4ID
+#endif
+#ifdef solaris2
+#define OSTYPE SOLARISID
+#endif
+#if defined(osf3) || defined(osf4)
+#define OSTYPE OSFID
+#endif
+#ifdef ultrix4
+#define OSTYPE ULTRIXID
+#endif
+#ifdef netbsd1
+#define OSTYPE NETBSD1ID
+#endif
+#ifdef freebsd2
+#define OSTYPE FREEBSDID
+#endif
+#if defined(irix6) || defined(irix5)
+#define OSTYPE IRIXID
+#endif
+#ifdef linux
+#define OSTYPE LINUXID
+#endif
+#if defined(bsdi2) || defined(bsdi3)
+#define OSTYPE BSDIID
+#endif
+#ifdef openbsd2
+#define OSTYPE OPENBSDID
+#endif
+/* unknown */
+#ifndef OSTYPE
+#define OSTYPE UNKNOWNID
+#endif
+
+/* The enterprise number has been assigned by the IANA group.   */
+/* Optionally, this may point to the location in the tree your  */
+/* company/organization has been allocated.                     */
+/* The assigned enterprise number for the NET_SNMP MIB modules. */
+#define ENTERPRISE_OID			8072
+#define ENTERPRISE_MIB			1,3,6,1,4,1,8072
+#define ENTERPRISE_DOT_MIB		1.3.6.1.4.1.8072
+#define ENTERPRISE_DOT_MIB_LENGTH	7
+
+/* The assigned enterprise number for sysObjectID. */
+#define SYSTEM_MIB		1,3,6,1,4,1,8072,3,2,OSTYPE
+#define SYSTEM_DOT_MIB		1.3.6.1.4.1.8072.3.2.OSTYPE
+#define SYSTEM_DOT_MIB_LENGTH	10
+
+/* The assigned enterprise number for notifications. */
+#define NOTIFICATION_MIB		1,3,6,1,4,1,8072,4
+#define NOTIFICATION_DOT_MIB		1.3.6.1.4.1.8072.4
+#define NOTIFICATION_DOT_MIB_LENGTH	8
+
+/* this is the location of the ucdavis mib tree.  It shouldn't be
+   changed, as the places it is used are expected to be constant
+   values or are directly tied to the UCD-SNMP-MIB. */
+#define UCDAVIS_OID		2021
+#define UCDAVIS_MIB		1,3,6,1,4,1,2021
+#define UCDAVIS_DOT_MIB		1.3.6.1.4.1.2021
+#define UCDAVIS_DOT_MIB_LENGTH	7
+
+/* how long to wait (seconds) for error querys before reseting the error trap.*/
+#define ERRORTIMELENGTH 600
+
+/* Exec command to fix PROC problems */
+/* %s will be replaced by the process name in error */
+
+#define PROCFIXCMD "/usr/local/bin/perl /local/scripts/fixproc %s"
+
+/* Exec command to fix EXEC problems */
+/* %s will be replaced by the exec/script name in error */
+
+#define EXECFIXCMD "/usr/local/bin/perl /local/scripts/fixproc %s"
+
+/* Should exec output Cashing be used (speeds up things greatly), and
+   if so, After how many seconds should the cache re-newed?  Note:
+   Don't define CASHETIME to disable cashing completely */
+
+#define EXCACHETIME 30
+#define CACHEFILE ".snmp-exec-cache"
+#define MAXCACHESIZE (200*80)   /* roughly 200 lines max */
+
+#define MAXDISKS 10                      /* can't scan more than this number */
+
+/* misc defaults */
+
+/* default of 100 meg minimum if the minimum size is not specified in
+   the config file */
+#define DEFDISKMINIMUMSPACE 100000
+
+#define DEFMAXLOADAVE 12.0      /* default maximum load average before error */
+
+#define MAXREADCOUNT 20   /* max times to loop reading output from
+                             execs.  Because of sleep(1)s, this will also
+                             be time to wait (in seconds) for exec to finish */
+
+#define SNMPBLOCK 1       /* Set to 1 if you want snmpgets to block and never
+                             timeout.  Original CMU code had this
+                             hardcoded into the code as = 1 */
+
+#define RESTARTSLEEP 5    /* How long to wait after a snmpset to
+                             EXTENSIBLEMIB.VERSIONMIBNUM.VERRESTARTAGENT
+                             before restarting the agent.  This is
+                             necessary to finish the snmpset reply
+                             before restarting. */
+
+/* Number of community strings to store */
+#define NUM_COMMUNITIES	5
+
+/* UNdefine to allow specifying zero-length community string */
+/* #define NO_ZEROLENGTH_COMMUNITY 1 */
+
+/* #define EXIT_ON_BAD_KLREAD  */
+/* define to exit the agent on a bad kernel read */
+
+#define LASTFIELD -1      /* internal define */
+
+/* Define if you have the strdup function.  */
+#define HAVE_STRDUP 1
+
+/* Define if you have the strerror function.  */
+#define HAVE_STRERROR 1
+
+#ifndef HAVE_STRCHR
+#ifdef HAVE_INDEX
+# define strchr index
+# define strrchr rindex
+#endif
+#endif
+
+#ifndef HAVE_INDEX
+#ifdef HAVE_STRCHR
+# define index strchr
+# define rindex strrchr
+#endif
+#endif
+
+#ifndef HAVE_MEMCPY
+#ifdef HAVE_BCOPY
+# define memcpy(d, s, n) bcopy ((s), (d), (n))
+# define memmove(d, s, n) bcopy ((s), (d), (n))
+# define memcmp bcmp
+#endif
+#endif
+
+#ifndef HAVE_MEMMOVE
+#ifdef HAVE_MEMCPY
+# define memmove memcpy
+#endif
+#endif
+
+#ifndef HAVE_BCOPY
+#ifdef HAVE_MEMCPY
+# define bcopy(s, d, n) memcpy ((d), (s), (n))
+# define bzero(p,n) memset((p),(0),(n))
+# define bcmp memcmp
+#endif
+#endif
+
+
+/* define random functions */
+
+#ifndef HAVE_RANDOM
+#ifdef HAVE_LRAND48
+#define random lrand48
+#define srandom(s) srand48(s)
+#else
+#ifdef HAVE_RAND
+#define random rand
+#define srandom(s) srand(s)
+#endif
+#endif
+#endif
+
+/* define signal if DNE */
+
+#ifndef HAVE_SIGNAL
+#ifdef HAVE_SIGSET
+#define signal(a,b) sigset(a,b)
+#endif
+#endif
+
+/* Not-to-be-compiled macros for use by configure only */
+#define config_require(x)
+#define config_arch_require(x,y)
+#define config_parse_dot_conf(w,x,y,z)
+#define config_add_mib(x)
+
+#ifndef DONT_INC_STRUCTS
+/*#include "agent/mibgroup/struct.h" */
+#endif
+
+#ifndef linux
+#ifndef solaris2
+#define bsdlike
+#endif
+#endif
+
+/*  Pluggable transports.  */
+
+#define SNMP_TRANSPORT_CALLBACK_DOMAIN 1
+#define SNMP_TRANSPORT_UDP_DOMAIN 1
+#define SNMP_TRANSPORT_TCP_DOMAIN 1
+#undef SNMP_TRANSPORT_UNIX_DOMAIN
+#undef SNMP_TRANSPORT_AAL5PVC_DOMAIN
+#undef SNMP_TRANSPORT_IPX_DOMAIN
+#undef SNMP_TRANSPORT_UDPIPV6_DOMAIN
+#undef SNMP_TRANSPORT_TCPIPV6_DOMAIN
+
+/* Security Models */
+#define SNMP_SECMOD_USM 1
+#undef  SNMP_SECMOD_KSM
+
+#ifdef WIN32
+
+#define HAVE_GETPID 1
+
+int strcasecmp(const char *s1, const char *s2);
+#define vsnprintf _vsnprintf
+#define snprintf  _snprintf
+
+#define EADDRINUSE	WSAEADDRINUSE
+
+#define ENV_SEPARATOR ";"
+#define ENV_SEPARATOR_CHAR ';'
+
+
+#else
+
+#define ENV_SEPARATOR ":"
+#define ENV_SEPARATOR_CHAR ':'
+
+#endif
+
+typedef unsigned short mode_t;
+
+#define AGENT_DIRECTORY_MODE 0700
+
+/* reverse encoding BER packets is both faster and more efficient in space. */
+#define USE_REVERSE_ASNENCODING       1
+#define DEFAULT_ASNENCODING_DIRECTION 1 /* 1 = reverse, 0 = forwards */
+
+#ifndef NETSNMP_INLINE
+#   define NETSNMP_NO_INLINE
+#   define NETSNMP_INLINE
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+
+#endif /* NET_SNMP_CONFIG_H */
diff -Naur tomato/release/src/router/snmp/win32/netsnmpmibs/netsnmpmibs.dsp tomato121/release/src/router/snmp/win32/netsnmpmibs/netsnmpmibs.dsp
--- tomato/release/src/router/snmp/win32/netsnmpmibs/netsnmpmibs.dsp	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/win32/netsnmpmibs/netsnmpmibs.dsp	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,329 @@
+# Microsoft Developer Studio Project File - Name="netsnmpmibs" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Static Library" 0x0104
+
+CFG=netsnmpmibs - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE 
+!MESSAGE NMAKE /f "netsnmpmibs.mak".
+!MESSAGE 
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE 
+!MESSAGE NMAKE /f "netsnmpmibs.mak" CFG="netsnmpmibs - Win32 Debug"
+!MESSAGE 
+!MESSAGE Possible choices for configuration are:
+!MESSAGE 
+!MESSAGE "netsnmpmibs - Win32 Release" (based on "Win32 (x86) Static Library")
+!MESSAGE "netsnmpmibs - Win32 Debug" (based on "Win32 (x86) Static Library")
+!MESSAGE 
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+RSC=rc.exe
+
+!IF  "$(CFG)" == "netsnmpmibs - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "../lib"
+# PROP Intermediate_Dir "Release"
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
+# ADD CPP /nologo /MD /W3 /GX /O2 /I "." /I ".." /I "..\..\agent" /I "..\..\snmplib" /I "..\..\include" /I "..\..\agent\mibgroup" /I "..\.." /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
+# ADD BASE RSC /l 0x409
+# ADD RSC /l 0x409
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LIB32=link.exe -lib
+# ADD BASE LIB32 /nologo
+# ADD LIB32 /nologo
+
+!ELSEIF  "$(CFG)" == "netsnmpmibs - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "../lib"
+# PROP Intermediate_Dir "Debug"
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /Z7 /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c
+# ADD CPP /nologo /MTd /W3 /GX /ZI /Od /I "..\..\agent" /I "..\..\agent\mibgroup" /I "." /I ".." /I "..\..\snmplib" /I "..\.." /I "..\..\include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD BASE RSC /l 0x409
+# ADD RSC /l 0xffffffff
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LIB32=link.exe -lib
+# ADD BASE LIB32 /nologo
+# ADD LIB32 /nologo /out:"../lib/netsnmpmibs_d.lib"
+
+!ENDIF 
+
+# Begin Target
+
+# Name "netsnmpmibs - Win32 Release"
+# Name "netsnmpmibs - Win32 Debug"
+# Begin Group "mibII"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=..\..\agent\mibgroup\mibII\snmp_mib.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\agent\mibgroup\mibII\sysORTable.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\agent\mibgroup\mibII\system_mib.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\agent\mibgroup\mibII\vacm_context.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\agent\mibgroup\mibII\vacm_vars.c
+# End Source File
+# End Group
+# Begin Group "examples"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=..\..\agent\mibgroup\examples\example.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\agent\mibgroup\examples\ucdDemoPublic.c
+# End Source File
+# End Group
+# Begin Group "ucd-snmp"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE="..\..\agent\mibgroup\ucd-snmp\disk.c"
+# End Source File
+# Begin Source File
+
+SOURCE="..\..\agent\mibgroup\ucd-snmp\dlmod.c"
+# End Source File
+# Begin Source File
+
+SOURCE="..\..\agent\mibgroup\ucd-snmp\errormib.c"
+# End Source File
+# Begin Source File
+
+SOURCE="..\..\agent\mibgroup\ucd-snmp\extensible.c"
+# End Source File
+# Begin Source File
+
+SOURCE="..\..\agent\mibgroup\ucd-snmp\file.c"
+# End Source File
+# Begin Source File
+
+SOURCE="..\..\agent\mibgroup\ucd-snmp\loadave.c"
+# End Source File
+# Begin Source File
+
+SOURCE="..\..\agent\mibgroup\ucd-snmp\pass.c"
+# End Source File
+# Begin Source File
+
+SOURCE="..\..\agent\mibgroup\ucd-snmp\pass_persist.c"
+# End Source File
+# Begin Source File
+
+SOURCE="..\..\agent\mibgroup\ucd-snmp\proc.c"
+# End Source File
+# Begin Source File
+
+SOURCE="..\..\agent\mibgroup\ucd-snmp\proxy.c"
+# End Source File
+# Begin Source File
+
+SOURCE="..\..\agent\mibgroup\ucd-snmp\versioninfo.c"
+# End Source File
+# End Group
+# Begin Group "snmpv3"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=..\..\agent\mibgroup\snmpv3\snmpEngine.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\agent\mibgroup\snmpv3\snmpMPDStats.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\agent\mibgroup\snmpv3\usmStats.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\agent\mibgroup\snmpv3\usmUser.c
+# End Source File
+# End Group
+# Begin Group "notification"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=..\..\agent\mibgroup\notification\snmpNotifyFilterProfileTable.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\agent\mibgroup\notification\snmpNotifyFilterTable.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\agent\mibgroup\notification\snmpNotifyTable.c
+# End Source File
+# End Group
+# Begin Group "target"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=..\..\agent\mibgroup\target\snmpTargetAddrEntry.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\agent\mibgroup\target\snmpTargetParamsEntry.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\agent\mibgroup\target\target.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\agent\mibgroup\target\target_counters.c
+# End Source File
+# End Group
+# Begin Group "agentx"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=..\..\agent\mibgroup\agentx\agentx_config.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\agent\mibgroup\agentx\client.c
+
+!IF  "$(CFG)" == "netsnmpmibs - Win32 Release"
+
+!ELSEIF  "$(CFG)" == "netsnmpmibs - Win32 Debug"
+
+# PROP Exclude_From_Build 1
+
+!ENDIF 
+
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\agent\mibgroup\agentx\master.c
+
+!IF  "$(CFG)" == "netsnmpmibs - Win32 Release"
+
+!ELSEIF  "$(CFG)" == "netsnmpmibs - Win32 Debug"
+
+# PROP Exclude_From_Build 1
+
+!ENDIF 
+
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\agent\mibgroup\agentx\master_admin.c
+
+!IF  "$(CFG)" == "netsnmpmibs - Win32 Release"
+
+!ELSEIF  "$(CFG)" == "netsnmpmibs - Win32 Debug"
+
+# PROP Exclude_From_Build 1
+
+!ENDIF 
+
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\agent\mibgroup\agentx\protocol.c
+
+!IF  "$(CFG)" == "netsnmpmibs - Win32 Release"
+
+!ELSEIF  "$(CFG)" == "netsnmpmibs - Win32 Debug"
+
+# PROP Exclude_From_Build 1
+
+!ENDIF 
+
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\agent\mibgroup\agentx\subagent.c
+
+!IF  "$(CFG)" == "netsnmpmibs - Win32 Release"
+
+!ELSEIF  "$(CFG)" == "netsnmpmibs - Win32 Debug"
+
+# PROP Exclude_From_Build 1
+
+!ENDIF 
+
+# End Source File
+# End Group
+# Begin Group "agent"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=..\..\agent\mibgroup\agent\nsModuleTable.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\agent\mibgroup\agent\nsTransactionTable.c
+# End Source File
+# End Group
+# Begin Group "utilities"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=..\..\agent\mibgroup\utilities\override.c
+# End Source File
+# End Group
+# Begin Source File
+
+SOURCE=..\..\agent\mibgroup\header_complex.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\agent\mib_modules.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\agent\mibgroup\util_funcs.c
+# End Source File
+# End Target
+# End Project
diff -Naur tomato/release/src/router/snmp/win32/netsnmpmibssdk/netsnmpmibssdk.dsp tomato121/release/src/router/snmp/win32/netsnmpmibssdk/netsnmpmibssdk.dsp
--- tomato/release/src/router/snmp/win32/netsnmpmibssdk/netsnmpmibssdk.dsp	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/win32/netsnmpmibssdk/netsnmpmibssdk.dsp	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,377 @@
+# Microsoft Developer Studio Project File - Name="netsnmpmibssdk" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Static Library" 0x0104
+
+CFG=netsnmpmibssdk - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE 
+!MESSAGE NMAKE /f "netsnmpmibssdk.mak".
+!MESSAGE 
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE 
+!MESSAGE NMAKE /f "netsnmpmibssdk.mak" CFG="netsnmpmibssdk - Win32 Debug"
+!MESSAGE 
+!MESSAGE Possible choices for configuration are:
+!MESSAGE 
+!MESSAGE "netsnmpmibssdk - Win32 Release" (based on "Win32 (x86) Static Library")
+!MESSAGE "netsnmpmibssdk - Win32 Debug" (based on "Win32 (x86) Static Library")
+!MESSAGE 
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+RSC=rc.exe
+
+!IF  "$(CFG)" == "netsnmpmibssdk - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "../lib"
+# PROP Intermediate_Dir "Release"
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
+# ADD CPP /nologo /MD /W3 /GX /O2 /I "." /I ".." /I "..\..\agent" /I "..\..\snmplib" /I "..\..\include" /I "..\..\agent\mibgroup" /I "..\.." /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
+# ADD BASE RSC /l 0x409
+# ADD RSC /l 0x409
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LIB32=link.exe -lib
+# ADD BASE LIB32 /nologo
+# ADD LIB32 /nologo
+
+!ELSEIF  "$(CFG)" == "netsnmpmibssdk - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "../lib"
+# PROP Intermediate_Dir "Debug"
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /Z7 /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c
+# ADD CPP /nologo /MTd /W3 /GX /ZI /Od /I "..\..\agent" /I "..\..\agent\mibgroup" /I "." /I ".." /I "..\..\snmplib" /I "..\.." /I "..\..\include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD BASE RSC /l 0x409
+# ADD RSC /l 0xffffffff
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LIB32=link.exe -lib
+# ADD BASE LIB32 /nologo
+# ADD LIB32 /nologo /out:"../lib/netsnmpmibssdk_d.lib"
+
+!ENDIF 
+
+# Begin Target
+
+# Name "netsnmpmibssdk - Win32 Release"
+# Name "netsnmpmibssdk - Win32 Debug"
+# Begin Group "mibII"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=..\..\agent\mibgroup\mibII\snmp_mib.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\agent\mibgroup\mibII\sysORTable.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\agent\mibgroup\mibII\system_mib.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\agent\mibgroup\mibII\vacm_context.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\agent\mibgroup\mibII\vacm_vars.c
+# End Source File
+# End Group
+# Begin Group "examples"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=..\..\agent\mibgroup\examples\example.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\agent\mibgroup\examples\ucdDemoPublic.c
+# End Source File
+# End Group
+# Begin Group "snmpv3"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=..\..\agent\mibgroup\snmpv3\snmpEngine.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\agent\mibgroup\snmpv3\snmpMPDStats.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\agent\mibgroup\snmpv3\usmStats.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\agent\mibgroup\snmpv3\usmUser.c
+# End Source File
+# End Group
+# Begin Group "notification"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=..\..\agent\mibgroup\notification\snmpNotifyFilterProfileTable.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\agent\mibgroup\notification\snmpNotifyFilterTable.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\agent\mibgroup\notification\snmpNotifyTable.c
+# End Source File
+# End Group
+# Begin Group "target"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=..\..\agent\mibgroup\target\snmpTargetAddrEntry.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\agent\mibgroup\target\snmpTargetParamsEntry.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\agent\mibgroup\target\target.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\agent\mibgroup\target\target_counters.c
+# End Source File
+# End Group
+# Begin Group "agentx"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=..\..\agent\mibgroup\agentx\agentx_config.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\agent\mibgroup\agentx\client.c
+
+!IF  "$(CFG)" == "netsnmpmibssdk - Win32 Release"
+
+!ELSEIF  "$(CFG)" == "netsnmpmibssdk - Win32 Debug"
+
+# PROP Exclude_From_Build 1
+
+!ENDIF 
+
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\agent\mibgroup\agentx\master.c
+
+!IF  "$(CFG)" == "netsnmpmibssdk - Win32 Release"
+
+!ELSEIF  "$(CFG)" == "netsnmpmibssdk - Win32 Debug"
+
+# PROP Exclude_From_Build 1
+
+!ENDIF 
+
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\agent\mibgroup\agentx\master_admin.c
+
+!IF  "$(CFG)" == "netsnmpmibssdk - Win32 Release"
+
+!ELSEIF  "$(CFG)" == "netsnmpmibssdk - Win32 Debug"
+
+# PROP Exclude_From_Build 1
+
+!ENDIF 
+
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\agent\mibgroup\agentx\protocol.c
+
+!IF  "$(CFG)" == "netsnmpmibssdk - Win32 Release"
+
+!ELSEIF  "$(CFG)" == "netsnmpmibssdk - Win32 Debug"
+
+# PROP Exclude_From_Build 1
+
+!ENDIF 
+
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\agent\mibgroup\agentx\subagent.c
+
+!IF  "$(CFG)" == "netsnmpmibssdk - Win32 Release"
+
+!ELSEIF  "$(CFG)" == "netsnmpmibssdk - Win32 Debug"
+
+# PROP Exclude_From_Build 1
+
+!ENDIF 
+
+# End Source File
+# End Group
+# Begin Group "agent"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=..\..\agent\mibgroup\agent\nsModuleTable.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\agent\mibgroup\agent\nsTransactionTable.c
+# End Source File
+# End Group
+# Begin Group "utilities"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=..\..\agent\mibgroup\utilities\override.c
+# End Source File
+# End Group
+# Begin Group "mibIIsdk"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=..\..\agent\mibgroup\mibII\at.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\agent\mibgroup\mibII\icmp.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\agent\mibgroup\mibII\interfaces.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\agent\mibgroup\mibII\ip.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\agent\mibgroup\mibII\ipAddr.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\agent\mibgroup\mibII\route_write.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\agent\mibgroup\mibII\tcp.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\agent\mibgroup\mibII\tcpTable.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\agent\mibgroup\mibII\udp.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\agent\mibgroup\mibII\udpTable.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\agent\mibgroup\mibII\var_route.c
+# End Source File
+# End Group
+# Begin Group "ucd-snmp"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE="..\..\agent\mibgroup\ucd-snmp\disk.c"
+# End Source File
+# Begin Source File
+
+SOURCE="..\..\agent\mibgroup\ucd-snmp\dlmod.c"
+# End Source File
+# Begin Source File
+
+SOURCE="..\..\agent\mibgroup\ucd-snmp\errormib.c"
+# End Source File
+# Begin Source File
+
+SOURCE="..\..\agent\mibgroup\ucd-snmp\extensible.c"
+# End Source File
+# Begin Source File
+
+SOURCE="..\..\agent\mibgroup\ucd-snmp\file.c"
+# End Source File
+# Begin Source File
+
+SOURCE="..\..\agent\mibgroup\ucd-snmp\loadave.c"
+# End Source File
+# Begin Source File
+
+SOURCE="..\..\agent\mibgroup\ucd-snmp\pass.c"
+# End Source File
+# Begin Source File
+
+SOURCE="..\..\agent\mibgroup\ucd-snmp\pass_persist.c"
+# End Source File
+# Begin Source File
+
+SOURCE="..\..\agent\mibgroup\ucd-snmp\proc.c"
+# End Source File
+# Begin Source File
+
+SOURCE="..\..\agent\mibgroup\ucd-snmp\proxy.c"
+# End Source File
+# Begin Source File
+
+SOURCE="..\..\agent\mibgroup\ucd-snmp\versioninfo.c"
+# End Source File
+# End Group
+# Begin Source File
+
+SOURCE=..\..\agent\mibgroup\header_complex.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\agent\mib_modules.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\agent\mibgroup\util_funcs.c
+# End Source File
+# End Target
+# End Project
diff -Naur tomato/release/src/router/snmp/win32/snmpbulkget/.cvsignore tomato121/release/src/router/snmp/win32/snmpbulkget/.cvsignore
--- tomato/release/src/router/snmp/win32/snmpbulkget/.cvsignore	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/win32/snmpbulkget/.cvsignore	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,8 @@
+opt
+bin
+lib
+Release
+Debug
+*.plg
+*.ilk
+*.ncb
diff -Naur tomato/release/src/router/snmp/win32/snmpbulkget/snmpbulkget.dsp tomato121/release/src/router/snmp/win32/snmpbulkget/snmpbulkget.dsp
--- tomato/release/src/router/snmp/win32/snmpbulkget/snmpbulkget.dsp	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/win32/snmpbulkget/snmpbulkget.dsp	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,90 @@
+# Microsoft Developer Studio Project File - Name="snmpbulkget" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Console Application" 0x0103
+
+CFG=snmpbulkget - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE 
+!MESSAGE NMAKE /f "snmpbulkget.mak".
+!MESSAGE 
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE 
+!MESSAGE NMAKE /f "snmpbulkget.mak" CFG="snmpbulkget - Win32 Debug"
+!MESSAGE 
+!MESSAGE Possible choices for configuration are:
+!MESSAGE 
+!MESSAGE "snmpbulkget - Win32 Release" (based on "Win32 (x86) Console Application")
+!MESSAGE "snmpbulkget - Win32 Debug" (based on "Win32 (x86) Console Application")
+!MESSAGE 
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+RSC=rc.exe
+
+!IF  "$(CFG)" == "snmpbulkget - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /MD /W3 /GX /O2 /I "." /I ".." /I "..\..\snmplib" /I "..\.." /I "..\..\include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
+# ADD LINK32 libsnmp.lib msvcrt.lib advapi32.lib wsock32.lib kernel32.lib user32.lib oldnames.lib /nologo /subsystem:console /machine:I386 /nodefaultlib /out:"../bin/snmpbulkget.exe" /libpath:"..\lib"
+
+!ELSEIF  "$(CFG)" == "snmpbulkget - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug"
+# PROP Intermediate_Dir "Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /MTd /W3 /GX /ZI /Od /I "." /I ".." /I "..\..\snmplib" /I "..\.." /I "..\..\include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0xffffffff /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 snmp_d.lib libcmt.lib advapi32.lib wsock32.lib kernel32.lib user32.lib oldnames.lib /nologo /subsystem:console /debug /machine:I386 /nodefaultlib /out:"../bin/snmpbulkget_d.exe" /pdbtype:sept /libpath:"../lib"
+
+!ENDIF 
+
+# Begin Target
+
+# Name "snmpbulkget - Win32 Release"
+# Name "snmpbulkget - Win32 Debug"
+# Begin Source File
+
+SOURCE=..\..\apps\snmpbulkget.c
+# End Source File
+# End Target
+# End Project
diff -Naur tomato/release/src/router/snmp/win32/snmpbulkwalk/.cvsignore tomato121/release/src/router/snmp/win32/snmpbulkwalk/.cvsignore
--- tomato/release/src/router/snmp/win32/snmpbulkwalk/.cvsignore	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/win32/snmpbulkwalk/.cvsignore	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,8 @@
+opt
+bin
+lib
+Release
+Debug
+*.plg
+*.ilk
+*.ncb
diff -Naur tomato/release/src/router/snmp/win32/snmpbulkwalk/snmpbulkwalk.dsp tomato121/release/src/router/snmp/win32/snmpbulkwalk/snmpbulkwalk.dsp
--- tomato/release/src/router/snmp/win32/snmpbulkwalk/snmpbulkwalk.dsp	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/win32/snmpbulkwalk/snmpbulkwalk.dsp	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,90 @@
+# Microsoft Developer Studio Project File - Name="snmpbulkwalk" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Console Application" 0x0103
+
+CFG=snmpbulkwalk - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE 
+!MESSAGE NMAKE /f "snmpbulkwalk.mak".
+!MESSAGE 
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE 
+!MESSAGE NMAKE /f "snmpbulkwalk.mak" CFG="snmpbulkwalk - Win32 Debug"
+!MESSAGE 
+!MESSAGE Possible choices for configuration are:
+!MESSAGE 
+!MESSAGE "snmpbulkwalk - Win32 Release" (based on "Win32 (x86) Console Application")
+!MESSAGE "snmpbulkwalk - Win32 Debug" (based on "Win32 (x86) Console Application")
+!MESSAGE 
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+RSC=rc.exe
+
+!IF  "$(CFG)" == "snmpbulkwalk - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /MD /W3 /GX /O2 /I "." /I ".." /I "..\..\snmplib" /I "..\.." /I "..\..\include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
+# ADD LINK32 libsnmp.lib msvcrt.lib advapi32.lib wsock32.lib kernel32.lib user32.lib oldnames.lib /nologo /subsystem:console /machine:I386 /nodefaultlib /out:"../bin/snmpbulkwalk.exe" /libpath:"..\lib"
+
+!ELSEIF  "$(CFG)" == "snmpbulkwalk - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug"
+# PROP Intermediate_Dir "Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /MTd /W3 /GX /ZI /Od /I "." /I ".." /I "..\..\snmplib" /I "..\.." /I "..\..\include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0xffffffff /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 advapi32.lib snmp_d.lib libcmt.lib wsock32.lib kernel32.lib user32.lib oldnames.lib /nologo /subsystem:console /debug /machine:I386 /nodefaultlib /out:"../bin/snmpbulkwalk_d.exe" /pdbtype:sept /libpath:"../lib"
+
+!ENDIF 
+
+# Begin Target
+
+# Name "snmpbulkwalk - Win32 Release"
+# Name "snmpbulkwalk - Win32 Debug"
+# Begin Source File
+
+SOURCE=..\..\apps\snmpbulkwalk.c
+# End Source File
+# End Target
+# End Project
diff -Naur tomato/release/src/router/snmp/win32/snmpd/.cvsignore tomato121/release/src/router/snmp/win32/snmpd/.cvsignore
--- tomato/release/src/router/snmp/win32/snmpd/.cvsignore	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/win32/snmpd/.cvsignore	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,8 @@
+opt
+bin
+lib
+Release
+Debug
+*.plg
+*.ilk
+*.ncb
diff -Naur tomato/release/src/router/snmp/win32/snmpd/snmpd.dsp tomato121/release/src/router/snmp/win32/snmpd/snmpd.dsp
--- tomato/release/src/router/snmp/win32/snmpd/snmpd.dsp	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/win32/snmpd/snmpd.dsp	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,107 @@
+# Microsoft Developer Studio Project File - Name="snmpd" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Console Application" 0x0103
+
+CFG=snmpd - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE 
+!MESSAGE NMAKE /f "snmpd.mak".
+!MESSAGE 
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE 
+!MESSAGE NMAKE /f "snmpd.mak" CFG="snmpd - Win32 Debug"
+!MESSAGE 
+!MESSAGE Possible choices for configuration are:
+!MESSAGE 
+!MESSAGE "snmpd - Win32 Release" (based on "Win32 (x86) Console Application")
+!MESSAGE "snmpd - Win32 Debug" (based on "Win32 (x86) Console Application")
+!MESSAGE 
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+RSC=rc.exe
+
+!IF  "$(CFG)" == "snmpd - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\..\agent\mibgroup" /I "..\..\agent" /I "." /I ".." /I "..\..\snmplib" /I "..\.." /I "..\..\include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
+# ADD LINK32 netsnmpagent.lib netsnmpmibs.lib netsnmphelpers.lib libsnmp.lib msvcrt.lib Advapi32.lib advapi32.lib wsock32.lib kernel32.lib user32.lib oldnames.lib /nologo /subsystem:console /machine:I386 /nodefaultlib /out:"../bin/snmpd.exe" /libpath:"..\lib"
+
+!ELSEIF  "$(CFG)" == "snmpd - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug"
+# PROP Intermediate_Dir "Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /MTd /W3 /GX /ZI /Od /I "..\..\agent\mibgroup" /I "..\..\agent" /I "." /I ".." /I "..\..\snmplib" /I "..\.." /I "..\..\include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FR /YX /FD /c
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0xffffffff /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 netsnmpagent_d.lib netsnmpmibs_d.lib netsnmphelpers_d.lib snmp_d.lib libcmt.lib advapi32.lib shlwapi.lib wsock32.lib kernel32.lib user32.lib oldnames.lib /nologo /subsystem:console /incremental:no /debug /machine:I386 /nodefaultlib /out:"../bin/snmpd_d.exe" /pdbtype:sept /libpath:"../lib"
+# SUBTRACT LINK32 /pdb:none
+
+!ENDIF 
+
+# Begin Target
+
+# Name "snmpd - Win32 Release"
+# Name "snmpd - Win32 Debug"
+# Begin Source File
+
+SOURCE=..\..\agent\auto_nlist.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\agent\kernel.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\agent\snmpd.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\snmplib\winservice.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\snmplib\winservice.rc
+# End Source File
+# End Target
+# End Project
diff -Naur tomato/release/src/router/snmp/win32/snmpdelta/.cvsignore tomato121/release/src/router/snmp/win32/snmpdelta/.cvsignore
--- tomato/release/src/router/snmp/win32/snmpdelta/.cvsignore	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/win32/snmpdelta/.cvsignore	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,8 @@
+opt
+bin
+lib
+Release
+Debug
+*.plg
+*.ilk
+*.ncb
diff -Naur tomato/release/src/router/snmp/win32/snmpdelta/snmpdelta.dsp tomato121/release/src/router/snmp/win32/snmpdelta/snmpdelta.dsp
--- tomato/release/src/router/snmp/win32/snmpdelta/snmpdelta.dsp	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/win32/snmpdelta/snmpdelta.dsp	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,90 @@
+# Microsoft Developer Studio Project File - Name="snmpdelta" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Console Application" 0x0103
+
+CFG=snmpdelta - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE 
+!MESSAGE NMAKE /f "snmpdelta.mak".
+!MESSAGE 
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE 
+!MESSAGE NMAKE /f "snmpdelta.mak" CFG="snmpdelta - Win32 Debug"
+!MESSAGE 
+!MESSAGE Possible choices for configuration are:
+!MESSAGE 
+!MESSAGE "snmpdelta - Win32 Release" (based on "Win32 (x86) Console Application")
+!MESSAGE "snmpdelta - Win32 Debug" (based on "Win32 (x86) Console Application")
+!MESSAGE 
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+RSC=rc.exe
+
+!IF  "$(CFG)" == "snmpdelta - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /MD /W3 /GX /O2 /I "." /I ".." /I "..\..\snmplib" /I "..\.." /I "..\..\include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
+# ADD LINK32 libsnmp.lib msvcrt.lib advapi32.lib wsock32.lib kernel32.lib user32.lib oldnames.lib /nologo /subsystem:console /machine:I386 /nodefaultlib /out:"../bin/snmpdelta.exe" /libpath:"..\lib"
+
+!ELSEIF  "$(CFG)" == "snmpdelta - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug"
+# PROP Intermediate_Dir "Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /MTd /W3 /GX /ZI /Od /I "." /I ".." /I "..\..\snmplib" /I "..\.." /I "..\..\include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0xffffffff /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 snmp_d.lib libcmt.lib advapi32.lib wsock32.lib kernel32.lib user32.lib oldnames.lib /nologo /subsystem:console /debug /machine:I386 /nodefaultlib /out:"../bin/snmpdelta_d.exe" /pdbtype:sept /libpath:"../lib"
+
+!ENDIF 
+
+# Begin Target
+
+# Name "snmpdelta - Win32 Release"
+# Name "snmpdelta - Win32 Debug"
+# Begin Source File
+
+SOURCE=..\..\apps\snmpdelta.c
+# End Source File
+# End Target
+# End Project
diff -Naur tomato/release/src/router/snmp/win32/snmpdf/.cvsignore tomato121/release/src/router/snmp/win32/snmpdf/.cvsignore
--- tomato/release/src/router/snmp/win32/snmpdf/.cvsignore	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/win32/snmpdf/.cvsignore	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,8 @@
+opt
+bin
+lib
+Release
+Debug
+*.plg
+*.ilk
+*.ncb
diff -Naur tomato/release/src/router/snmp/win32/snmpdf/snmpdf.dsp tomato121/release/src/router/snmp/win32/snmpdf/snmpdf.dsp
--- tomato/release/src/router/snmp/win32/snmpdf/snmpdf.dsp	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/win32/snmpdf/snmpdf.dsp	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,90 @@
+# Microsoft Developer Studio Project File - Name="snmpdf" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Console Application" 0x0103
+
+CFG=snmpdf - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE 
+!MESSAGE NMAKE /f "snmpdf.mak".
+!MESSAGE 
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE 
+!MESSAGE NMAKE /f "snmpdf.mak" CFG="snmpdf - Win32 Debug"
+!MESSAGE 
+!MESSAGE Possible choices for configuration are:
+!MESSAGE 
+!MESSAGE "snmpdf - Win32 Release" (based on "Win32 (x86) Console Application")
+!MESSAGE "snmpdf - Win32 Debug" (based on "Win32 (x86) Console Application")
+!MESSAGE 
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+RSC=rc.exe
+
+!IF  "$(CFG)" == "snmpdf - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /MD /W3 /GX /O2 /I "." /I ".." /I "..\..\snmplib" /I "..\.." /I "..\..\include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
+# ADD LINK32 libsnmp.lib msvcrt.lib advapi32.lib wsock32.lib kernel32.lib user32.lib oldnames.lib /nologo /subsystem:console /machine:I386 /nodefaultlib /out:"../bin/snmpdf.exe" /libpath:"..\lib"
+
+!ELSEIF  "$(CFG)" == "snmpdf - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug"
+# PROP Intermediate_Dir "Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /MTd /W3 /GX /ZI /Od /I "." /I ".." /I "..\..\snmplib" /I "..\.." /I "..\..\include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0xffffffff /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 snmp_d.lib libcmt.lib advapi32.lib wsock32.lib kernel32.lib user32.lib oldnames.lib /nologo /subsystem:console /debug /machine:I386 /nodefaultlib /out:"../bin/snmpdf_d.exe" /pdbtype:sept /libpath:"../lib"
+
+!ENDIF 
+
+# Begin Target
+
+# Name "snmpdf - Win32 Release"
+# Name "snmpdf - Win32 Debug"
+# Begin Source File
+
+SOURCE=..\..\apps\snmpdf.c
+# End Source File
+# End Target
+# End Project
diff -Naur tomato/release/src/router/snmp/win32/snmpdsdk/snmpd.dsp tomato121/release/src/router/snmp/win32/snmpdsdk/snmpd.dsp
--- tomato/release/src/router/snmp/win32/snmpdsdk/snmpd.dsp	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/win32/snmpdsdk/snmpd.dsp	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,107 @@
+# Microsoft Developer Studio Project File - Name="snmpdsdk" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Console Application" 0x0103
+
+CFG=snmpdsdk - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE 
+!MESSAGE NMAKE /f "snmpdsdk.mak".
+!MESSAGE 
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE 
+!MESSAGE NMAKE /f "snmpdsdk.mak" CFG="snmpdsdk - Win32 Debug"
+!MESSAGE 
+!MESSAGE Possible choices for configuration are:
+!MESSAGE 
+!MESSAGE "snmpdsdk - Win32 Release" (based on "Win32 (x86) Console Application")
+!MESSAGE "snmpdsdk - Win32 Debug" (based on "Win32 (x86) Console Application")
+!MESSAGE 
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+RSC=rc.exe
+
+!IF  "$(CFG)" == "snmpdsdk - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\..\agent\mibgroup" /I "..\..\agent" /I "." /I ".." /I "..\..\snmplib" /I "..\.." /I "..\..\include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
+# ADD LINK32 netsnmpagent.lib netsnmpmibssdk.lib netsnmphelpers.lib libsnmp.lib msvcrt.lib Advapi32.lib wsock32.lib kernel32.lib user32.lib oldnames.lib /nologo /subsystem:console /machine:I386 /nodefaultlib /out:"../bin/snmpd.exe" /libpath:"..\lib"
+
+!ELSEIF  "$(CFG)" == "snmpdsdk - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug"
+# PROP Intermediate_Dir "Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /MTd /W3 /GX /ZI /Od /I "..\..\agent\mibgroup" /I "..\..\agent" /I "." /I ".." /I "..\..\snmplib" /I "..\.." /I "..\..\include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FR /YX /FD /c
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0xffffffff /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 netsnmpagent_d.lib netsnmpmibssdk_d.lib netsnmphelpers_d.lib snmp_d.lib libcmt.lib advapi32.lib shlwapi.lib wsock32.lib kernel32.lib user32.lib oldnames.lib /nologo /subsystem:console /incremental:no /debug /machine:I386 /nodefaultlib /out:"../bin/snmpd_d.exe" /pdbtype:sept /libpath:"../lib"
+# SUBTRACT LINK32 /pdb:none
+
+!ENDIF 
+
+# Begin Target
+
+# Name "snmpdsdk - Win32 Release"
+# Name "snmpdsdk - Win32 Debug"
+# Begin Source File
+
+SOURCE=..\..\agent\auto_nlist.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\agent\kernel.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\agent\snmpd.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\snmplib\winservice.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\snmplib\winservice.rc
+# End Source File
+# End Target
+# End Project
diff -Naur tomato/release/src/router/snmp/win32/snmpget/.cvsignore tomato121/release/src/router/snmp/win32/snmpget/.cvsignore
--- tomato/release/src/router/snmp/win32/snmpget/.cvsignore	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/win32/snmpget/.cvsignore	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,8 @@
+opt
+bin
+lib
+Release
+Debug
+*.plg
+*.ilk
+*.ncb
diff -Naur tomato/release/src/router/snmp/win32/snmpget/snmpget.dsp tomato121/release/src/router/snmp/win32/snmpget/snmpget.dsp
--- tomato/release/src/router/snmp/win32/snmpget/snmpget.dsp	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/win32/snmpget/snmpget.dsp	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,90 @@
+# Microsoft Developer Studio Project File - Name="snmpget" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Console Application" 0x0103
+
+CFG=snmpget - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE 
+!MESSAGE NMAKE /f "snmpget.mak".
+!MESSAGE 
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE 
+!MESSAGE NMAKE /f "snmpget.mak" CFG="snmpget - Win32 Debug"
+!MESSAGE 
+!MESSAGE Possible choices for configuration are:
+!MESSAGE 
+!MESSAGE "snmpget - Win32 Release" (based on "Win32 (x86) Console Application")
+!MESSAGE "snmpget - Win32 Debug" (based on "Win32 (x86) Console Application")
+!MESSAGE 
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+RSC=rc.exe
+
+!IF  "$(CFG)" == "snmpget - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /MD /W3 /GX /O2 /I "." /I ".." /I "..\..\snmplib" /I "..\.." /I "..\..\include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
+# ADD LINK32 libsnmp.lib advapi32.lib wsock32.lib msvcrt.lib kernel32.lib user32.lib oldnames.lib /nologo /subsystem:console /machine:I386 /nodefaultlib /out:"../bin/snmpget.exe" /libpath:"..\lib"
+
+!ELSEIF  "$(CFG)" == "snmpget - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug"
+# PROP Intermediate_Dir "Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /MTd /W3 /GX /ZI /Od /I "." /I ".." /I "..\..\snmplib" /I "..\.." /I "..\..\include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0xffffffff /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 snmp_d.lib wsock32.lib libcmt.lib kernel32.lib user32.lib oldnames.lib advapi32.lib /nologo /subsystem:console /debug /machine:I386 /nodefaultlib /out:"../bin/snmpget_d.exe" /pdbtype:sept /libpath:"../lib"
+
+!ENDIF 
+
+# Begin Target
+
+# Name "snmpget - Win32 Release"
+# Name "snmpget - Win32 Debug"
+# Begin Source File
+
+SOURCE=..\..\apps\snmpget.c
+# End Source File
+# End Target
+# End Project
diff -Naur tomato/release/src/router/snmp/win32/snmpgetnext/.cvsignore tomato121/release/src/router/snmp/win32/snmpgetnext/.cvsignore
--- tomato/release/src/router/snmp/win32/snmpgetnext/.cvsignore	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/win32/snmpgetnext/.cvsignore	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,8 @@
+opt
+bin
+lib
+Release
+Debug
+*.plg
+*.ilk
+*.ncb
diff -Naur tomato/release/src/router/snmp/win32/snmpgetnext/snmpgetnext.dsp tomato121/release/src/router/snmp/win32/snmpgetnext/snmpgetnext.dsp
--- tomato/release/src/router/snmp/win32/snmpgetnext/snmpgetnext.dsp	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/win32/snmpgetnext/snmpgetnext.dsp	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,90 @@
+# Microsoft Developer Studio Project File - Name="snmpgetnext" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Console Application" 0x0103
+
+CFG=snmpgetnext - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE 
+!MESSAGE NMAKE /f "snmpgetnext.mak".
+!MESSAGE 
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE 
+!MESSAGE NMAKE /f "snmpgetnext.mak" CFG="snmpgetnext - Win32 Debug"
+!MESSAGE 
+!MESSAGE Possible choices for configuration are:
+!MESSAGE 
+!MESSAGE "snmpgetnext - Win32 Release" (based on "Win32 (x86) Console Application")
+!MESSAGE "snmpgetnext - Win32 Debug" (based on "Win32 (x86) Console Application")
+!MESSAGE 
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+RSC=rc.exe
+
+!IF  "$(CFG)" == "snmpgetnext - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /MD /W3 /GX /O2 /I "." /I ".." /I "..\..\snmplib" /I "..\.." /I "..\..\include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
+# ADD LINK32 libsnmp.lib advapi32.lib wsock32.lib msvcrt.lib kernel32.lib user32.lib oldnames.lib /nologo /subsystem:console /machine:I386 /nodefaultlib /out:"../bin/snmpgetnext.exe" /libpath:"..\lib"
+
+!ELSEIF  "$(CFG)" == "snmpgetnext - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug"
+# PROP Intermediate_Dir "Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /MTd /W3 /GX /ZI /Od /I "." /I ".." /I "..\..\snmplib" /I "..\.." /I "..\..\include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0xffffffff /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 advapi32.lib snmp_d.lib wsock32.lib libcmt.lib kernel32.lib user32.lib oldnames.lib /nologo /subsystem:console /debug /machine:I386 /nodefaultlib /out:"../bin/snmpgetnext_d.exe" /pdbtype:sept /libpath:"../lib"
+
+!ENDIF 
+
+# Begin Target
+
+# Name "snmpgetnext - Win32 Release"
+# Name "snmpgetnext - Win32 Debug"
+# Begin Source File
+
+SOURCE=..\..\apps\snmpgetnext.c
+# End Source File
+# End Target
+# End Project
diff -Naur tomato/release/src/router/snmp/win32/snmpnetstat/.cvsignore tomato121/release/src/router/snmp/win32/snmpnetstat/.cvsignore
--- tomato/release/src/router/snmp/win32/snmpnetstat/.cvsignore	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/win32/snmpnetstat/.cvsignore	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,8 @@
+opt
+bin
+lib
+Release
+Debug
+*.plg
+*.ilk
+*.ncb
diff -Naur tomato/release/src/router/snmp/win32/snmpnetstat/snmpnetstat.dsp tomato121/release/src/router/snmp/win32/snmpnetstat/snmpnetstat.dsp
--- tomato/release/src/router/snmp/win32/snmpnetstat/snmpnetstat.dsp	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/win32/snmpnetstat/snmpnetstat.dsp	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,106 @@
+# Microsoft Developer Studio Project File - Name="snmpnetstat" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Console Application" 0x0103
+
+CFG=snmpnetstat - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE 
+!MESSAGE NMAKE /f "snmpnetstat.mak".
+!MESSAGE 
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE 
+!MESSAGE NMAKE /f "snmpnetstat.mak" CFG="snmpnetstat - Win32 Debug"
+!MESSAGE 
+!MESSAGE Possible choices for configuration are:
+!MESSAGE 
+!MESSAGE "snmpnetstat - Win32 Release" (based on "Win32 (x86) Console Application")
+!MESSAGE "snmpnetstat - Win32 Debug" (based on "Win32 (x86) Console Application")
+!MESSAGE 
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+RSC=rc.exe
+
+!IF  "$(CFG)" == "snmpnetstat - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /MD /W3 /GX /O2 /I "." /I ".." /I "..\..\snmplib" /I "..\.." /I "..\..\include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
+# ADD LINK32 libsnmp.lib msvcrt.lib advapi32.lib wsock32.lib kernel32.lib user32.lib oldnames.lib /nologo /subsystem:console /machine:I386 /nodefaultlib /out:"../bin/snmpnetstat.exe" /libpath:"..\lib"
+
+!ELSEIF  "$(CFG)" == "snmpnetstat - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug"
+# PROP Intermediate_Dir "Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "." /I ".." /I "..\..\snmplib" /I "..\.." /I "..\..\include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0xffffffff /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 snmp_d.lib libcmt.lib advapi32.lib wsock32.lib kernel32.lib user32.lib oldnames.lib /nologo /subsystem:console /debug /machine:I386 /nodefaultlib /out:"../bin/snmpnetstat_d.exe" /pdbtype:sept /libpath:"../lib"
+
+!ENDIF 
+
+# Begin Target
+
+# Name "snmpnetstat - Win32 Release"
+# Name "snmpnetstat - Win32 Debug"
+# Begin Source File
+
+SOURCE=..\..\apps\snmpnetstat\if.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\apps\snmpnetstat\inet.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\apps\snmpnetstat\main.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\apps\snmpnetstat\route.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\apps\snmpnetstat\winstub.c
+# End Source File
+# End Target
+# End Project
diff -Naur tomato/release/src/router/snmp/win32/snmpset/.cvsignore tomato121/release/src/router/snmp/win32/snmpset/.cvsignore
--- tomato/release/src/router/snmp/win32/snmpset/.cvsignore	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/win32/snmpset/.cvsignore	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,8 @@
+opt
+bin
+lib
+Release
+Debug
+*.plg
+*.ilk
+*.ncb
diff -Naur tomato/release/src/router/snmp/win32/snmpset/snmpset.dsp tomato121/release/src/router/snmp/win32/snmpset/snmpset.dsp
--- tomato/release/src/router/snmp/win32/snmpset/snmpset.dsp	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/win32/snmpset/snmpset.dsp	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,90 @@
+# Microsoft Developer Studio Project File - Name="snmpset" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Console Application" 0x0103
+
+CFG=snmpset - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE 
+!MESSAGE NMAKE /f "snmpset.mak".
+!MESSAGE 
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE 
+!MESSAGE NMAKE /f "snmpset.mak" CFG="snmpset - Win32 Debug"
+!MESSAGE 
+!MESSAGE Possible choices for configuration are:
+!MESSAGE 
+!MESSAGE "snmpset - Win32 Release" (based on "Win32 (x86) Console Application")
+!MESSAGE "snmpset - Win32 Debug" (based on "Win32 (x86) Console Application")
+!MESSAGE 
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+RSC=rc.exe
+
+!IF  "$(CFG)" == "snmpset - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /MD /W3 /GX /O2 /I "." /I ".." /I "..\..\snmplib" /I "..\.." /I "..\..\include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
+# ADD LINK32 libsnmp.lib msvcrt.lib advapi32.lib wsock32.lib kernel32.lib user32.lib oldnames.lib /nologo /subsystem:console /machine:I386 /nodefaultlib /out:"../bin/snmpset.exe" /libpath:"..\lib"
+
+!ELSEIF  "$(CFG)" == "snmpset - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug"
+# PROP Intermediate_Dir "Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "." /I ".." /I "..\..\snmplib" /I "..\.." /I "..\..\include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0xffffffff /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 snmp_d.lib libcmt.lib advapi32.lib wsock32.lib kernel32.lib user32.lib oldnames.lib /nologo /subsystem:console /debug /machine:I386 /nodefaultlib /out:"../bin/snmpset_d.exe" /pdbtype:sept /libpath:"../lib"
+
+!ENDIF 
+
+# Begin Target
+
+# Name "snmpset - Win32 Release"
+# Name "snmpset - Win32 Debug"
+# Begin Source File
+
+SOURCE=..\..\apps\snmpset.c
+# End Source File
+# End Target
+# End Project
diff -Naur tomato/release/src/router/snmp/win32/snmpsm_init.h tomato121/release/src/router/snmp/win32/snmpsm_init.h
--- tomato/release/src/router/snmp/win32/snmpsm_init.h	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/win32/snmpsm_init.h	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,2 @@
+/* This file is automatically generated by configure.  Do not modify by hand. */
+init_usm();
diff -Naur tomato/release/src/router/snmp/win32/snmpstatus/.cvsignore tomato121/release/src/router/snmp/win32/snmpstatus/.cvsignore
--- tomato/release/src/router/snmp/win32/snmpstatus/.cvsignore	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/win32/snmpstatus/.cvsignore	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,8 @@
+opt
+bin
+lib
+Release
+Debug
+*.plg
+*.ilk
+*.ncb
diff -Naur tomato/release/src/router/snmp/win32/snmpstatus/snmpstatus.dsp tomato121/release/src/router/snmp/win32/snmpstatus/snmpstatus.dsp
--- tomato/release/src/router/snmp/win32/snmpstatus/snmpstatus.dsp	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/win32/snmpstatus/snmpstatus.dsp	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,90 @@
+# Microsoft Developer Studio Project File - Name="snmpstatus" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Console Application" 0x0103
+
+CFG=snmpstatus - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE 
+!MESSAGE NMAKE /f "snmpstatus.mak".
+!MESSAGE 
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE 
+!MESSAGE NMAKE /f "snmpstatus.mak" CFG="snmpstatus - Win32 Debug"
+!MESSAGE 
+!MESSAGE Possible choices for configuration are:
+!MESSAGE 
+!MESSAGE "snmpstatus - Win32 Release" (based on "Win32 (x86) Console Application")
+!MESSAGE "snmpstatus - Win32 Debug" (based on "Win32 (x86) Console Application")
+!MESSAGE 
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+RSC=rc.exe
+
+!IF  "$(CFG)" == "snmpstatus - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /MD /W3 /GX /O2 /I "." /I ".." /I "..\..\snmplib" /I "..\.." /I "..\..\include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
+# ADD LINK32 libsnmp.lib msvcrt.lib advapi32.lib wsock32.lib kernel32.lib user32.lib oldnames.lib /nologo /subsystem:console /machine:I386 /nodefaultlib /out:"../bin/snmpstatus.exe" /libpath:"..\lib"
+
+!ELSEIF  "$(CFG)" == "snmpstatus - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug"
+# PROP Intermediate_Dir "Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /MTd /W3 /GX /ZI /Od /I "." /I ".." /I "..\..\snmplib" /I "..\.." /I "..\..\include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0xffffffff /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 snmp_d.lib libcmt.lib advapi32.lib wsock32.lib kernel32.lib user32.lib oldnames.lib /nologo /subsystem:console /debug /machine:I386 /nodefaultlib /out:"../bin/snmpstatus_d.exe" /pdbtype:sept /libpath:"../lib"
+
+!ENDIF 
+
+# Begin Target
+
+# Name "snmpstatus - Win32 Release"
+# Name "snmpstatus - Win32 Debug"
+# Begin Source File
+
+SOURCE=..\..\apps\snmpstatus.c
+# End Source File
+# End Target
+# End Project
diff -Naur tomato/release/src/router/snmp/win32/snmptable/.cvsignore tomato121/release/src/router/snmp/win32/snmptable/.cvsignore
--- tomato/release/src/router/snmp/win32/snmptable/.cvsignore	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/win32/snmptable/.cvsignore	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,8 @@
+opt
+bin
+lib
+Release
+Debug
+*.plg
+*.ilk
+*.ncb
diff -Naur tomato/release/src/router/snmp/win32/snmptable/snmptable.dsp tomato121/release/src/router/snmp/win32/snmptable/snmptable.dsp
--- tomato/release/src/router/snmp/win32/snmptable/snmptable.dsp	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/win32/snmptable/snmptable.dsp	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,90 @@
+# Microsoft Developer Studio Project File - Name="snmptable" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Console Application" 0x0103
+
+CFG=snmptable - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE 
+!MESSAGE NMAKE /f "snmptable.mak".
+!MESSAGE 
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE 
+!MESSAGE NMAKE /f "snmptable.mak" CFG="snmptable - Win32 Debug"
+!MESSAGE 
+!MESSAGE Possible choices for configuration are:
+!MESSAGE 
+!MESSAGE "snmptable - Win32 Release" (based on "Win32 (x86) Console Application")
+!MESSAGE "snmptable - Win32 Debug" (based on "Win32 (x86) Console Application")
+!MESSAGE 
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+RSC=rc.exe
+
+!IF  "$(CFG)" == "snmptable - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /MD /W3 /GX /O2 /I "." /I ".." /I "..\..\snmplib" /I "..\.." /I "..\..\include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD BASE RSC /l 0x406 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
+# ADD LINK32 libsnmp.lib msvcrt.lib advapi32.lib wsock32.lib kernel32.lib user32.lib oldnames.lib /nologo /subsystem:console /machine:I386 /nodefaultlib /out:"../bin/snmptable.exe" /libpath:"..\lib"
+
+!ELSEIF  "$(CFG)" == "snmptable - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug"
+# PROP Intermediate_Dir "Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "." /I ".." /I "..\..\snmplib" /I "..\.." /I "..\..\include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD BASE RSC /l 0x406 /d "_DEBUG"
+# ADD RSC /l 0xffffffff /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 snmp_d.lib libcmt.lib advapi32.lib wsock32.lib kernel32.lib user32.lib oldnames.lib /nologo /subsystem:console /debug /machine:I386 /nodefaultlib /out:"../bin/snmptable_d.exe" /pdbtype:sept /libpath:"..\lib"
+
+!ENDIF 
+
+# Begin Target
+
+# Name "snmptable - Win32 Release"
+# Name "snmptable - Win32 Debug"
+# Begin Source File
+
+SOURCE=..\..\apps\snmptable.c
+# End Source File
+# End Target
+# End Project
diff -Naur tomato/release/src/router/snmp/win32/snmptest/.cvsignore tomato121/release/src/router/snmp/win32/snmptest/.cvsignore
--- tomato/release/src/router/snmp/win32/snmptest/.cvsignore	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/win32/snmptest/.cvsignore	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,8 @@
+opt
+bin
+lib
+Release
+Debug
+*.plg
+*.ilk
+*.ncb
diff -Naur tomato/release/src/router/snmp/win32/snmptest/snmptest.dsp tomato121/release/src/router/snmp/win32/snmptest/snmptest.dsp
--- tomato/release/src/router/snmp/win32/snmptest/snmptest.dsp	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/win32/snmptest/snmptest.dsp	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,90 @@
+# Microsoft Developer Studio Project File - Name="snmptest" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Console Application" 0x0103
+
+CFG=snmptest - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE 
+!MESSAGE NMAKE /f "snmptest.mak".
+!MESSAGE 
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE 
+!MESSAGE NMAKE /f "snmptest.mak" CFG="snmptest - Win32 Debug"
+!MESSAGE 
+!MESSAGE Possible choices for configuration are:
+!MESSAGE 
+!MESSAGE "snmptest - Win32 Release" (based on "Win32 (x86) Console Application")
+!MESSAGE "snmptest - Win32 Debug" (based on "Win32 (x86) Console Application")
+!MESSAGE 
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+RSC=rc.exe
+
+!IF  "$(CFG)" == "snmptest - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /MD /W3 /GX /O2 /I "." /I ".." /I "..\..\snmplib" /I "..\.." /I "..\..\include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
+# ADD LINK32 libsnmp.lib msvcrt.lib advapi32.lib wsock32.lib kernel32.lib user32.lib oldnames.lib /nologo /subsystem:console /machine:I386 /nodefaultlib /out:"../bin/snmptest.exe" /libpath:"..\lib"
+
+!ELSEIF  "$(CFG)" == "snmptest - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug"
+# PROP Intermediate_Dir "Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /MTd /W3 /GX /ZI /Od /I "." /I ".." /I "..\..\snmplib" /I "..\.." /I "..\..\include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0xffffffff /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 snmp_d.lib libcmt.lib advapi32.lib wsock32.lib kernel32.lib user32.lib oldnames.lib /nologo /subsystem:console /debug /machine:I386 /nodefaultlib /out:"../bin/snmptest_d.exe" /pdbtype:sept /libpath:"../lib"
+
+!ENDIF 
+
+# Begin Target
+
+# Name "snmptest - Win32 Release"
+# Name "snmptest - Win32 Debug"
+# Begin Source File
+
+SOURCE=..\..\apps\snmptest.c
+# End Source File
+# End Target
+# End Project
diff -Naur tomato/release/src/router/snmp/win32/snmptranslate/.cvsignore tomato121/release/src/router/snmp/win32/snmptranslate/.cvsignore
--- tomato/release/src/router/snmp/win32/snmptranslate/.cvsignore	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/win32/snmptranslate/.cvsignore	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,8 @@
+opt
+bin
+lib
+Release
+Debug
+*.plg
+*.ilk
+*.ncb
diff -Naur tomato/release/src/router/snmp/win32/snmptranslate/snmptranslate.dsp tomato121/release/src/router/snmp/win32/snmptranslate/snmptranslate.dsp
--- tomato/release/src/router/snmp/win32/snmptranslate/snmptranslate.dsp	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/win32/snmptranslate/snmptranslate.dsp	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,94 @@
+# Microsoft Developer Studio Project File - Name="snmptranslate" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Console Application" 0x0103
+
+CFG=snmptranslate - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE 
+!MESSAGE NMAKE /f "snmptranslate.mak".
+!MESSAGE 
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE 
+!MESSAGE NMAKE /f "snmptranslate.mak" CFG="snmptranslate - Win32 Debug"
+!MESSAGE 
+!MESSAGE Possible choices for configuration are:
+!MESSAGE 
+!MESSAGE "snmptranslate - Win32 Release" (based on "Win32 (x86) Console Application")
+!MESSAGE "snmptranslate - Win32 Debug" (based on "Win32 (x86) Console Application")
+!MESSAGE 
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+RSC=rc.exe
+
+!IF  "$(CFG)" == "snmptranslate - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /MD /W3 /GX /O2 /I "." /I ".." /I "..\..\snmplib" /I "..\.." /I "..\..\include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD BASE RSC /l 0x406 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
+# ADD LINK32 advapi32.lib libsnmp.lib wsock32.lib msvcrt.lib kernel32.lib user32.lib oldnames.lib /nologo /subsystem:console /machine:I386 /nodefaultlib /out:"../bin/snmptranslate.exe" /libpath:"..\lib"
+
+!ELSEIF  "$(CFG)" == "snmptranslate - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug"
+# PROP Intermediate_Dir "Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "." /I ".." /I "..\..\snmplib" /I "..\.." /I "..\..\include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD BASE RSC /l 0x406 /d "_DEBUG"
+# ADD RSC /l 0xffffffff /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 snmp_d.lib wsock32.lib libcmt.lib kernel32.lib user32.lib oldnames.lib advapi32.lib /nologo /subsystem:console /debug /machine:I386 /nodefaultlib /out:"../bin/snmptranslate_d.exe" /pdbtype:sept /libpath:"../lib"
+
+!ENDIF 
+
+# Begin Target
+
+# Name "snmptranslate - Win32 Release"
+# Name "snmptranslate - Win32 Debug"
+# Begin Source File
+
+SOURCE=..\..\snmplib\getopt.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\apps\snmptranslate.c
+# End Source File
+# End Target
+# End Project
diff -Naur tomato/release/src/router/snmp/win32/snmptrap/.cvsignore tomato121/release/src/router/snmp/win32/snmptrap/.cvsignore
--- tomato/release/src/router/snmp/win32/snmptrap/.cvsignore	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/win32/snmptrap/.cvsignore	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,8 @@
+opt
+bin
+lib
+Release
+Debug
+*.plg
+*.ilk
+*.ncb
diff -Naur tomato/release/src/router/snmp/win32/snmptrap/snmptrap.dsp tomato121/release/src/router/snmp/win32/snmptrap/snmptrap.dsp
--- tomato/release/src/router/snmp/win32/snmptrap/snmptrap.dsp	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/win32/snmptrap/snmptrap.dsp	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,90 @@
+# Microsoft Developer Studio Project File - Name="snmptrap" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Console Application" 0x0103
+
+CFG=snmptrap - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE 
+!MESSAGE NMAKE /f "snmptrap.mak".
+!MESSAGE 
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE 
+!MESSAGE NMAKE /f "snmptrap.mak" CFG="snmptrap - Win32 Debug"
+!MESSAGE 
+!MESSAGE Possible choices for configuration are:
+!MESSAGE 
+!MESSAGE "snmptrap - Win32 Release" (based on "Win32 (x86) Console Application")
+!MESSAGE "snmptrap - Win32 Debug" (based on "Win32 (x86) Console Application")
+!MESSAGE 
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+RSC=rc.exe
+
+!IF  "$(CFG)" == "snmptrap - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /MD /W3 /GX /O2 /I "." /I ".." /I "..\..\snmplib" /I "..\.." /I "..\..\include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD BASE RSC /l 0x406 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
+# ADD LINK32 libsnmp.lib msvcrt.lib advapi32.lib wsock32.lib kernel32.lib user32.lib oldnames.lib /nologo /subsystem:console /machine:I386 /nodefaultlib /out:"../bin/snmptrap.exe" /libpath:"..\lib"
+
+!ELSEIF  "$(CFG)" == "snmptrap - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug"
+# PROP Intermediate_Dir "Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "." /I ".." /I "..\..\snmplib" /I "..\.." /I "..\..\include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD BASE RSC /l 0x406 /d "_DEBUG"
+# ADD RSC /l 0xffffffff /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 snmp_d.lib libcmt.lib advapi32.lib wsock32.lib kernel32.lib user32.lib oldnames.lib /nologo /subsystem:console /debug /machine:I386 /nodefaultlib /out:"../bin/snmptrap_d.exe" /pdbtype:sept /libpath:"..\lib"
+
+!ENDIF 
+
+# Begin Target
+
+# Name "snmptrap - Win32 Release"
+# Name "snmptrap - Win32 Debug"
+# Begin Source File
+
+SOURCE=..\..\apps\snmptrap.c
+# End Source File
+# End Target
+# End Project
diff -Naur tomato/release/src/router/snmp/win32/snmptrapd/.cvsignore tomato121/release/src/router/snmp/win32/snmptrapd/.cvsignore
--- tomato/release/src/router/snmp/win32/snmptrapd/.cvsignore	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/win32/snmptrapd/.cvsignore	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,8 @@
+opt
+bin
+lib
+Release
+Debug
+*.plg
+*.ilk
+*.ncb
diff -Naur tomato/release/src/router/snmp/win32/snmptrapd/snmptrapd.dsp tomato121/release/src/router/snmp/win32/snmptrapd/snmptrapd.dsp
--- tomato/release/src/router/snmp/win32/snmptrapd/snmptrapd.dsp	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/win32/snmptrapd/snmptrapd.dsp	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,102 @@
+# Microsoft Developer Studio Project File - Name="snmptrapd" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Console Application" 0x0103
+
+CFG=snmptrapd - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE 
+!MESSAGE NMAKE /f "snmptrapd.mak".
+!MESSAGE 
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE 
+!MESSAGE NMAKE /f "snmptrapd.mak" CFG="snmptrapd - Win32 Debug"
+!MESSAGE 
+!MESSAGE Possible choices for configuration are:
+!MESSAGE 
+!MESSAGE "snmptrapd - Win32 Release" (based on "Win32 (x86) Console Application")
+!MESSAGE "snmptrapd - Win32 Debug" (based on "Win32 (x86) Console Application")
+!MESSAGE 
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+RSC=rc.exe
+
+!IF  "$(CFG)" == "snmptrapd - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /MD /W3 /GX /O2 /I "." /I ".." /I "..\..\snmplib" /I "..\.." /I "..\..\include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD BASE RSC /l 0x406 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
+# ADD LINK32 libsnmp.lib msvcrt.lib advapi32.lib wsock32.lib kernel32.lib user32.lib oldnames.lib /nologo /subsystem:console /machine:I386 /nodefaultlib /out:"../bin/snmptrapd.exe" /libpath:"..\lib"
+
+!ELSEIF  "$(CFG)" == "snmptrapd - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug"
+# PROP Intermediate_Dir "Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /MTd /W3 /GX /ZI /Od /I "." /I ".." /I "..\..\snmplib" /I "..\.." /I "..\..\include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD BASE RSC /l 0x406 /d "_DEBUG"
+# ADD RSC /l 0xffffffff /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 snmp_d.lib libcmt.lib advapi32.lib wsock32.lib kernel32.lib user32.lib oldnames.lib /nologo /subsystem:console /debug /machine:I386 /nodefaultlib /out:"../bin/snmptrapd_d.exe" /pdbtype:sept /libpath:"..\lib"
+
+!ENDIF 
+
+# Begin Target
+
+# Name "snmptrapd - Win32 Release"
+# Name "snmptrapd - Win32 Debug"
+# Begin Source File
+
+SOURCE=..\..\apps\notification_log.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\apps\snmptrapd.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\apps\snmptrapd_handlers.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\apps\snmptrapd_log.c
+# End Source File
+# End Target
+# End Project
diff -Naur tomato/release/src/router/snmp/win32/snmpusm/.cvsignore tomato121/release/src/router/snmp/win32/snmpusm/.cvsignore
--- tomato/release/src/router/snmp/win32/snmpusm/.cvsignore	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/win32/snmpusm/.cvsignore	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,8 @@
+opt
+bin
+lib
+Release
+Debug
+*.plg
+*.ilk
+*.ncb
diff -Naur tomato/release/src/router/snmp/win32/snmpusm/snmpusm.dsp tomato121/release/src/router/snmp/win32/snmpusm/snmpusm.dsp
--- tomato/release/src/router/snmp/win32/snmpusm/snmpusm.dsp	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/win32/snmpusm/snmpusm.dsp	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,90 @@
+# Microsoft Developer Studio Project File - Name="snmpusm" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Console Application" 0x0103
+
+CFG=snmpusm - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE 
+!MESSAGE NMAKE /f "snmpusm.mak".
+!MESSAGE 
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE 
+!MESSAGE NMAKE /f "snmpusm.mak" CFG="snmpusm - Win32 Debug"
+!MESSAGE 
+!MESSAGE Possible choices for configuration are:
+!MESSAGE 
+!MESSAGE "snmpusm - Win32 Release" (based on "Win32 (x86) Console Application")
+!MESSAGE "snmpusm - Win32 Debug" (based on "Win32 (x86) Console Application")
+!MESSAGE 
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+RSC=rc.exe
+
+!IF  "$(CFG)" == "snmpusm - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /MD /W3 /GX /O2 /I "." /I ".." /I "..\..\snmplib" /I "..\.." /I "..\..\include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
+# ADD LINK32 libsnmp.lib msvcrt.lib advapi32.lib wsock32.lib kernel32.lib user32.lib oldnames.lib /nologo /subsystem:console /machine:I386 /nodefaultlib /out:"../bin/snmpusm.exe" /libpath:"..\lib"
+
+!ELSEIF  "$(CFG)" == "snmpusm - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug"
+# PROP Intermediate_Dir "Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /MTd /W3 /GX /ZI /Od /I "." /I ".." /I "..\..\snmplib" /I "..\.." /I "..\..\include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0xffffffff /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 snmp_d.lib libcmt.lib advapi32.lib wsock32.lib kernel32.lib user32.lib oldnames.lib /nologo /subsystem:console /debug /machine:I386 /nodefaultlib /out:"../bin/snmpusm_d.exe" /pdbtype:sept /libpath:"../lib"
+
+!ENDIF 
+
+# Begin Target
+
+# Name "snmpusm - Win32 Release"
+# Name "snmpusm - Win32 Debug"
+# Begin Source File
+
+SOURCE=..\..\apps\snmpusm.c
+# End Source File
+# End Target
+# End Project
diff -Naur tomato/release/src/router/snmp/win32/snmpvacm/.cvsignore tomato121/release/src/router/snmp/win32/snmpvacm/.cvsignore
--- tomato/release/src/router/snmp/win32/snmpvacm/.cvsignore	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/win32/snmpvacm/.cvsignore	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,8 @@
+opt
+bin
+lib
+Release
+Debug
+*.plg
+*.ilk
+*.ncb
diff -Naur tomato/release/src/router/snmp/win32/snmpvacm/snmpvacm.dsp tomato121/release/src/router/snmp/win32/snmpvacm/snmpvacm.dsp
--- tomato/release/src/router/snmp/win32/snmpvacm/snmpvacm.dsp	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/win32/snmpvacm/snmpvacm.dsp	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,90 @@
+# Microsoft Developer Studio Project File - Name="snmpvacm" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Console Application" 0x0103
+
+CFG=snmpvacm - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE 
+!MESSAGE NMAKE /f "snmpvacm.mak".
+!MESSAGE 
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE 
+!MESSAGE NMAKE /f "snmpvacm.mak" CFG="snmpvacm - Win32 Debug"
+!MESSAGE 
+!MESSAGE Possible choices for configuration are:
+!MESSAGE 
+!MESSAGE "snmpvacm - Win32 Release" (based on "Win32 (x86) Console Application")
+!MESSAGE "snmpvacm - Win32 Debug" (based on "Win32 (x86) Console Application")
+!MESSAGE 
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+RSC=rc.exe
+
+!IF  "$(CFG)" == "snmpvacm - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /MD /W3 /GX /O2 /I "." /I ".." /I "..\..\snmplib" /I "..\.." /I "..\..\include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
+# ADD LINK32 libsnmp.lib msvcrt.lib advapi32.lib wsock32.lib kernel32.lib user32.lib oldnames.lib /nologo /subsystem:console /machine:I386 /nodefaultlib /out:"../bin/snmpvacm.exe" /libpath:"..\lib"
+
+!ELSEIF  "$(CFG)" == "snmpvacm - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug"
+# PROP Intermediate_Dir "Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /MTd /W3 /GX /ZI /Od /I "." /I ".." /I "..\..\snmplib" /I "..\.." /I "..\..\include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0xffffffff /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 snmp_d.lib libcmt.lib advapi32.lib wsock32.lib kernel32.lib user32.lib oldnames.lib /nologo /subsystem:console /debug /machine:I386 /nodefaultlib /out:"../bin/snmpvacm_d.exe" /pdbtype:sept /libpath:"../lib"
+
+!ENDIF 
+
+# Begin Target
+
+# Name "snmpvacm - Win32 Release"
+# Name "snmpvacm - Win32 Debug"
+# Begin Source File
+
+SOURCE=..\..\apps\snmpvacm.c
+# End Source File
+# End Target
+# End Project
diff -Naur tomato/release/src/router/snmp/win32/snmpwalk/.cvsignore tomato121/release/src/router/snmp/win32/snmpwalk/.cvsignore
--- tomato/release/src/router/snmp/win32/snmpwalk/.cvsignore	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/win32/snmpwalk/.cvsignore	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,8 @@
+opt
+bin
+lib
+Release
+Debug
+*.plg
+*.ilk
+*.ncb
diff -Naur tomato/release/src/router/snmp/win32/snmpwalk/snmpwalk.dsp tomato121/release/src/router/snmp/win32/snmpwalk/snmpwalk.dsp
--- tomato/release/src/router/snmp/win32/snmpwalk/snmpwalk.dsp	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/win32/snmpwalk/snmpwalk.dsp	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,90 @@
+# Microsoft Developer Studio Project File - Name="snmpwalk" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Console Application" 0x0103
+
+CFG=snmpwalk - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE 
+!MESSAGE NMAKE /f "snmpwalk.mak".
+!MESSAGE 
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE 
+!MESSAGE NMAKE /f "snmpwalk.mak" CFG="snmpwalk - Win32 Debug"
+!MESSAGE 
+!MESSAGE Possible choices for configuration are:
+!MESSAGE 
+!MESSAGE "snmpwalk - Win32 Release" (based on "Win32 (x86) Console Application")
+!MESSAGE "snmpwalk - Win32 Debug" (based on "Win32 (x86) Console Application")
+!MESSAGE 
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+RSC=rc.exe
+
+!IF  "$(CFG)" == "snmpwalk - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /MD /W3 /GX /O2 /I "." /I ".." /I "..\..\snmplib" /I "..\.." /I "..\..\include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
+# ADD LINK32 libsnmp.lib msvcrt.lib advapi32.lib wsock32.lib kernel32.lib user32.lib oldnames.lib /nologo /subsystem:console /machine:I386 /nodefaultlib /out:"../bin/snmpwalk.exe" /libpath:"..\lib"
+
+!ELSEIF  "$(CFG)" == "snmpwalk - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug"
+# PROP Intermediate_Dir "Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /MTd /W3 /GX /ZI /Od /I "." /I ".." /I "..\..\snmplib" /I "..\.." /I "..\..\include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0xffffffff /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 snmp_d.lib libcmt.lib advapi32.lib wsock32.lib kernel32.lib user32.lib oldnames.lib /nologo /subsystem:console /debug /machine:I386 /nodefaultlib /out:"../bin/snmpwalk_d.exe" /pdbtype:sept /libpath:"../lib"
+
+!ENDIF 
+
+# Begin Target
+
+# Name "snmpwalk - Win32 Release"
+# Name "snmpwalk - Win32 Debug"
+# Begin Source File
+
+SOURCE=..\..\apps\snmpwalk.c
+# End Source File
+# End Target
+# End Project
diff -Naur tomato/release/src/router/snmp/win32/win32.dsw tomato121/release/src/router/snmp/win32/win32.dsw
--- tomato/release/src/router/snmp/win32/win32.dsw	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/win32/win32.dsw	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,320 @@
+Microsoft Developer Studio Workspace File, Format Version 6.00
+# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
+
+###############################################################################
+
+Project: "encode_keychange"=".\encode_keychange\encode_keychange.dsp" - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Project: "libagent"=".\libagent\libagent.dsp" - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Project: "libhelpers"=".\libhelpers\libhelpers.dsp" - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Project: "libsnmp"=".\libsnmp\libsnmp.dsp" - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Project: "libsnmp_dll"=".\libsnmp_dll\libsnmp_dll.dsp" - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Project: "netsnmpmibs"=".\netsnmpmibs\netsnmpmibs.dsp" - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Project: "snmpbulkget"=".\snmpbulkget\snmpbulkget.dsp" - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Project: "snmpbulkwalk"=".\snmpbulkwalk\snmpbulkwalk.dsp" - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Project: "snmpd"=".\snmpd\snmpd.dsp" - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+    Begin Project Dependency
+    Project_Dep_Name libucdmibs
+    End Project Dependency
+    Begin Project Dependency
+    Project_Dep_Name libagent
+    End Project Dependency
+    Begin Project Dependency
+    Project_Dep_Name libhelpers
+    End Project Dependency
+}}}
+
+###############################################################################
+
+Project: "snmpdelta"=".\snmpdelta\snmpdelta.dsp" - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Project: "snmpdf"=".\snmpdf\snmpdf.dsp" - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Project: "snmpget"=".\snmpget\snmpget.dsp" - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Project: "snmpgetnext"=".\snmpgetnext\snmpgetnext.dsp" - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Project: "snmpnetstat"=".\snmpnetstat\snmpnetstat.dsp" - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Project: "snmpset"=".\snmpset\snmpset.dsp" - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Project: "snmpstatus"=".\snmpstatus\snmpstatus.dsp" - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Project: "snmptable"=".\snmptable\snmptable.dsp" - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Project: "snmptest"=".\snmptest\snmptest.dsp" - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Project: "snmptranslate"=".\snmptranslate\snmptranslate.dsp" - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Project: "snmptrap"=".\snmptrap\snmptrap.dsp" - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Project: "snmptrapd"=".\snmptrapd\snmptrapd.dsp" - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+    Begin Project Dependency
+    Project_Dep_Name libagent
+    End Project Dependency
+    Begin Project Dependency
+    Project_Dep_Name libhelpers
+    End Project Dependency
+}}}
+
+###############################################################################
+
+Project: "snmpusm"=".\snmpusm\snmpusm.dsp" - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Project: "snmpvacm"=".\snmpvacm\snmpvacm.dsp" - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Project: "snmpwalk"=".\snmpwalk\snmpwalk.dsp" - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Global:
+
+Package=<5>
+{{{
+}}}
+
+Package=<3>
+{{{
+}}}
+
+###############################################################################
+
diff -Naur tomato/release/src/router/snmp/win32/win32sdk.dsw tomato121/release/src/router/snmp/win32/win32sdk.dsw
--- tomato/release/src/router/snmp/win32/win32sdk.dsw	1970-01-01 10:00:00.000000000 +1000
+++ tomato121/release/src/router/snmp/win32/win32sdk.dsw	2008-04-21 19:15:24.000000000 +1000
@@ -0,0 +1,311 @@
+Microsoft Developer Studio Workspace File, Format Version 6.00
+# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
+
+###############################################################################
+
+Project: "encode_keychange"=".\encode_keychange\encode_keychange.dsp" - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Project: "libagent"=".\libagent\libagent.dsp" - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Project: "libhelpers"=".\libhelpers\libhelpers.dsp" - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Project: "libsnmp"=".\libsnmp\libsnmp.dsp" - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Project: "libsnmp_dll"=".\libsnmp_dll\libsnmp_dll.dsp" - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Project: "netsnmpmibssdk"=".\netsnmpmibssdk\netsnmpmibssdk.dsp" - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Project: "snmpbulkget"=".\snmpbulkget\snmpbulkget.dsp" - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Project: "snmpbulkwalk"=".\snmpbulkwalk\snmpbulkwalk.dsp" - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Project: "snmpdelta"=".\snmpdelta\snmpdelta.dsp" - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Project: "snmpdf"=".\snmpdf\snmpdf.dsp" - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Project: "snmpdsdk"=".\snmpdsdk\snmpd.dsp" - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Project: "snmpget"=".\snmpget\snmpget.dsp" - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Project: "snmpgetnext"=".\snmpgetnext\snmpgetnext.dsp" - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Project: "snmpnetstat"=".\snmpnetstat\snmpnetstat.dsp" - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Project: "snmpset"=".\snmpset\snmpset.dsp" - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Project: "snmpstatus"=".\snmpstatus\snmpstatus.dsp" - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Project: "snmptable"=".\snmptable\snmptable.dsp" - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Project: "snmptest"=".\snmptest\snmptest.dsp" - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Project: "snmptranslate"=".\snmptranslate\snmptranslate.dsp" - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Project: "snmptrap"=".\snmptrap\snmptrap.dsp" - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Project: "snmptrapd"=".\snmptrapd\snmptrapd.dsp" - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+    Begin Project Dependency
+    Project_Dep_Name libagent
+    End Project Dependency
+    Begin Project Dependency
+    Project_Dep_Name libhelpers
+    End Project Dependency
+}}}
+
+###############################################################################
+
+Project: "snmpusm"=".\snmpusm\snmpusm.dsp" - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Project: "snmpvacm"=".\snmpvacm\snmpvacm.dsp" - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Project: "snmpwalk"=".\snmpwalk\snmpwalk.dsp" - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Global:
+
+Package=<5>
+{{{
+}}}
+
+Package=<3>
+{{{
+}}}
+
+###############################################################################
+
